import type { IntakeResult } from "../../routing/session-entry/intake-gate.js"; export type DelegationEventFact = { kind: "delegation-session-idle"; sessionId: string; } | { error?: string; kind: "delegation-session-error"; sessionId: string; } | { kind: "delegation-session-deleted"; sessionId: string; } | { kind: "ignored"; }; /** * Extracts delegation lifecycle facts from OpenCode events without performing writes. * * @param input - OpenCode event hook payload. * @returns A delegation event fact for write-side consumers. */ export declare function createDelegationEventObserver(): (input: { event?: unknown; }) => Promise; /** Fact emitted by the session-entry event observer. */ export type SessionEntryEventFact = { kind: "session-created"; sessionId: string; intake: IntakeResult; } | { kind: "ignored"; }; /** * Creates an event observer that classifies session intake on session.created events. * * Extracts the initial user message from the event, runs it through `resolveIntake()` * to classify purpose, detect language, resolve the developer profile, and analyze * trajectory context, then stores the result in an in-memory cache keyed by session * ID for later retrieval by the system.transform hook. * * @param projectDirectory - Absolute path to the project root for trajectory analysis. * @returns An observer function and a `getIntake` lookup function. */ export declare function createSessionEntryEventObserver(projectDirectory: string): { observer: (input: { event?: unknown; }) => Promise; getIntake: (sessionId: string) => IntakeResult | undefined; }; /** * Creates an event observer that caches whether a session is a main (level-0) session. * * Uses OpenCode's native `parentID` field on session records (D-01). * Main sessions have `parentID === undefined`; child/delegated sessions have a * `parentID` string set by the `task` tool (D-03). * * The cached boolean is read by the `system.transform` hook via HookDependencies (D-04). * * **Timing edge case:** `system.transform` may fire before the `session.created` event * observer has populated the cache. To prevent silent language-injection failure, * `isMainSession` defaults to `true` for uncached sessions. Once the observer processes * the session event, the correct status is stored and subsequent lookups return * the accurate value. * * @returns An observer function and an `isMainSession` lookup function. */ export declare function createSessionIsMainObserver(): { observer: (input: { event?: unknown; }) => Promise; isMainSession: (sessionId: string) => boolean; }; //# sourceMappingURL=event-observers.d.ts.map