UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

51 lines • 3.25 kB
/** * The recovery identity of one session record. It is never a property on the record a session produces, so every * legacy record, and every record with the compact-updates flag off, keeps its bytes (R3.C1.2). One exception * (RULING-120, senpi#5331): with the flag on, the RPC host stamps the copy it sends a `compact_events` peer of a live * `message_end` (`messageId`, `terminalSequence`), `entry_appended` (`owningMessageId`) and `transcript_write_failed` * (`messageId`) with the ids the settled store recorded for that message, so that peer can join the live record to its * settled `message-<terminalSequence>` and `join-<n>` rows across a reconnect or recovery cut. The ids are opaque, * stable for the message's lifetime and never reused in the session; nothing else carries them. The same copy of a live * call record (`toolcall_*` updates, `tool_execution_*`, `tool_hook_status`) carries the `runtimeItemKey` of the call * the host changed with it, or `callUnknown: true` when it changed none (RULING-123, senpi#5346): that key is the one * the producer minted for the call's block or bridge-started start (`session-call-keys.ts`, RULING-127, senpi#5374), * which the session file persists too, and only `carryRecovery` carries an execution key beside this carrier. Calls that share one `toolCallId` inside one * assistant message are told apart only by order, so their snapshot `calls` and settled rows carry `callUnknown: true` * too (senpi#5348): the calls table's own mark, never a confident attribution that can be swapped. */ export interface RecoveryCarrier { readonly messageId: string; /** Host-issued nonce, internal to the producer/lane handshake; never serialized with a public record. */ readonly epoch: string; readonly durableEntryId?: string; } /** Internal bootstrap, kept off AgentSession's public SDK surface. */ export declare function setSessionRecoveryEpoch(session: object, epoch: string): void; export declare function recoveryCarrier(record: object): RecoveryCarrier | undefined; /** Every copy of a record on its way to the host lane keeps the original's carrier. */ export declare function carryRecovery<T extends object>(from: object, to: T): T; type MessageEvent = { readonly type: string; readonly message?: { readonly role?: unknown; }; }; /** * Mints each message's opaque id at its start, in emission order. An assistant stream copies its message per * event, so it owns one open slot from start to end; other roles are keyed by their message object. A terminal * with no start mints at that terminal; an update with no start has no owner and gets no id. */ export declare class SessionRecoveryIdentity { private openAssistant; private byMessage; private epoch; constructor(epoch?: string, owner?: object); reset(epoch: string): void; /** A committed lifecycle delivery can predate its terminal record. */ hint(event: object, durableEntryId: string | undefined): void; /** A block control belongs to the assistant message open at its emission; it gets that message's identity. */ own(control: object): void; observe(event: MessageEvent): void; } export {}; //# sourceMappingURL=session-recovery-identity.d.ts.map