/** * Session Hook Handlers - Phase 2D of T5237 * * Handlers that capture session lifecycle events. * Auto-registers on module load. * * T138: Triggers memory bridge refresh on session start and end. * T139: Regenerates bridge with session scope on start. * T144: Extracts transcript observations on session end. * T5158: The session-end SQLite snapshot used to live here. T12508 moved it * to `sessions/session-end-snapshot.ts`, called by `endSession` after * the session is persisted (hook handlers run concurrently, before * the session row is written). * T527: Removed duplicate session observeBrain writes — session data already * lives in the sessions table; writing it again to brain_observations * was pure noise. * T549 Wave 3-E: Fire-and-forget sleep-time consolidation on session end. * Priority 5. * T554: Fire-and-forget LLM reflector on session end. Runs at priority 4 * (after consolidation at priority 5) to synthesize final session knowledge. * T732: Write `transcript_pending_extraction` tombstone on session end (priority 3). * Runs after reflector so it is the last scheduled operation. Records the * session JSONL path so `cleo transcript scan --pending` can list queued work. * T1263: Append session journal entry at priority 2 (last in pipeline). * Absorbs T1262 session-end hook: calls scanBrainNoise and embeds * doctorSummary in each session_end journal entry. * MUST use `await` (not setImmediate) — process exits after this hook. */ import type { SessionEndPayload, SessionStartPayload } from '../types.js'; /** * Handle SessionStart - refresh memory bridge on session start. * * T138: Refresh memory bridge on session start. * T139: Regenerate bridge with session scope context. * T527: Removed duplicate observeBrain write — session data is already * persisted in the sessions table. */ export declare function handleSessionStart(projectRoot: string, _payload: SessionStartPayload): Promise; /** * Handle SessionEnd - run post-session tasks and refresh memory bridge. * * T138: Refresh memory bridge after session ends. * T144: Extract transcript observations via cross-provider adapter. * T527: Removed duplicate observeBrain write — session data is already * persisted in the sessions table. */ export declare function handleSessionEnd(projectRoot: string, payload: SessionEndPayload): Promise; /** * Handle SessionEnd — fire-and-forget sleep-time memory consolidation. * * T549 Wave 3-E: Runs the full consolidation pipeline (dedup, quality recompute, * tier promotion, contradiction detection, soft eviction, graph strengthening, * summary generation) in the background. * * Uses setImmediate to yield control so the session end flow completes before * consolidation begins. Consolidation errors are caught and logged to console.warn * — they MUST NOT block session end or throw to callers. * * Registered at priority 5. Priorities order the handler list only; dispatch * runs all SessionEnd handlers concurrently (see the NOTE at registration). */ export declare function handleSessionEndConsolidation(projectRoot: string, _payload: SessionEndPayload): Promise; /** * Handle SessionEnd — fire-and-forget LLM Observer compression. * * T740: GAP-6 fix — Observer was only triggered on task completion when * observation count >= threshold (default 10). Sessions with < 10 observations * never got compression. This hook runs Observer unconditionally at session end * with a threshold override of 1, ensuring even short sessions get compressed. * * Priority 4.5 (between consolidation at 5 and reflector at 4) so Observer * compresses the raw observations before Reflector synthesizes patterns/learnings * from them. This matches the intended pipeline order. * * Uses setImmediate to yield control before the LLM call. Errors are caught * and logged — they MUST NOT block session end or throw to callers. */ export declare function handleSessionEndObserver(projectRoot: string, payload: SessionEndPayload): Promise; /** * Handle SessionEnd — fire-and-forget LLM reflector synthesis. * * T554: Runs the Reflector after the consolidation pass (priority 5) to * synthesize session observations into durable patterns and learnings. * * Uses setImmediate to yield control before the LLM call. Errors are caught * and logged — they MUST NOT block session end or throw to callers. * * Priority 4 ensures this runs after consolidation (priority 5). */ export declare function handleSessionEndReflector(projectRoot: string, payload: SessionEndPayload): Promise; /** * Handle SessionEnd — write a `transcript_pending_extraction` record to brain_observations. * * T732: Records the session JSONL path so the warm-tier extractor and * `cleo transcript scan --pending` can locate queued sessions. * * The record is idempotent: re-running session end for the same session_id * updates the timestamp but does not create a duplicate (content-hash dedup * in observeBrain handles this automatically). * * Priority 3 — runs after reflector (priority 4) so it is the last step in * the session-end pipeline. * * Uses setImmediate to yield so the session-end response reaches the CLI * before the brain write occurs. */ export declare function handleSessionEndTranscriptSchedule(projectRoot: string, payload: SessionEndPayload): Promise; /** * Handle SessionEnd — append a session journal entry to `.cleo/session-journals/`. * * T1263 PSYCHE E6: Writes a `session_end` JSONL entry capturing session metadata * and the compact result of `scanBrainNoise` (T1262 absorption). * * **MUST use synchronous `await`** — this hook runs at priority 2, immediately * before process.exit. Using `setImmediate` here would silently drop the write. * * Runs at priority 2 — the last synchronous hook in the session-end pipeline, * alongside consolidation, observer, reflector and transcript scheduling * (dispatch runs SessionEnd handlers concurrently, so none is guaranteed to * have finished first). */ export declare function handleSessionEndJournal(projectRoot: string, payload: SessionEndPayload): Promise; //# sourceMappingURL=session-hooks.d.ts.map