/** * Reading the session a `SessionEnd` hook is reporting. * * Claude Code delivers hook context as JSON on stdin, and for `SessionEnd` that * payload carries the `session_id` of the context that just went away. That id * is the only thing that knows which run ended, because by the time the hook * fires there is usually nothing left to infer it from: the `Stop` hook synced * after the last assistant turn and advanced the run-log cursor, so the * `SessionEnd` sync reads zero pending actions. * * That is the whole reason this file exists. `buildSyncBatches` derives * `completedSessionIds` from the actions in the upload, which is correct when * there are actions and inert when there are none — so without the payload the * `--session-complete` flag closed nothing in the ordinary case and the run * waited on the idle sweep, which itself only fires on a later sync. */ /** * Extract the session id from a hook payload, or `null` when there isn't one. * * Pure and total: every malformed shape returns `null` rather than throwing. A * sync that cannot read the payload must still upload — the flag degrades to * what it did before (naming whatever sessions the actions carry), and the * server's idle sweep remains the backstop it was always designed to be. */ export declare function sessionIdFromHookPayload(raw: string): string | null; /** * Extract the transcript path from a hook payload, or `null` when there isn't * one — same total, never-throwing contract as `sessionIdFromHookPayload`. * * Read from the payload this command is *already* holding rather than from the * run log, because by `SessionEnd` the run log cannot answer: the preceding * `Stop` sync advanced the action cursor, so `readPendingActions` reads no * lines and reports no path for this session. For a transcript the filename * lookup can find, that costs nothing. For one it cannot — not named for its * session, or under no detected root — the session's last records would go * uncounted permanently, and those are the records that matter here: the * transcript is written asynchronously and lags the `Stop` hook that read it. */ export declare function transcriptPathFromHookPayload(raw: string): string | null; /** * Read a hook payload from stdin, returning `''` when there is nothing to read. * * Guarded twice, because `auden sync --session-complete` is also a command a * person can run by hand. An interactive stdin (`isTTY`) is never read, and a * pipe that opens but never closes gives up after `timeoutMs` — a sync that * hangs waiting for input nobody is going to send would be a worse failure than * not learning the session id. */ export declare function readHookPayload(timeoutMs?: number): Promise; //# sourceMappingURL=session-end.d.ts.map