UNPKG

@code-yeongyu/senpi

Version:

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

54 lines • 2.48 kB
import type { StoredBinding } from "./session-binding-store.ts"; import type { ContinuityBinding } from "./session-reattach.ts"; export declare const BINDING_ENTRY_TYPE = "claude-sdk-oauth-binding"; export declare const BINDING_MARKER: { readonly schemaVersion: 2; readonly marker: true; }; export type BindingInvalidation = { readonly schemaVersion: 1; readonly invalidated: true; readonly reason: string; /** senpi#1975: first diverged field path, only on assistant_rewritten records. Paths only, never values. */ readonly divergedPath?: string; }; type BranchEntry = { readonly id?: string; readonly type: string; readonly customType?: string; readonly data?: unknown; readonly message?: unknown; }; export type StoredBindingAnchor = { readonly sessionPath: string; readonly sessionId: string; readonly markerEntryId: string; readonly assistantContentHash: string; }; export type BindingEntryState = { readonly sdkSessionId: string; readonly accountName: string; readonly modelId: string; readonly systemPromptHash: string; readonly toolsetHash: string; readonly assistantUuidByIndex: ReadonlyMap<number, string>; }; /** * The record is derived from the registry entry plus the hashes the branch * actually carries, never from the process binding map: that map holds the * previous turn's state while `message_end` runs (and only a prefix digest right * after a restart), so reading it would anchor this turn's marker to a stale or * absent sent-stream. */ export declare function storedBindingFromEntry(entry: BindingEntryState, hashes: readonly string[], anchor: StoredBindingAnchor): StoredBinding; /** Persist a completed turn whose resident registry entry closed before `message_end`. */ export declare function storedBindingFromBinding(binding: ContinuityBinding, hashes: readonly string[], anchor: StoredBindingAnchor): StoredBinding | undefined; /** * Reason carried by the newest binding ledger record, when that record is an * invalidation. A marker appended later retires it: the marker means a turn * re-established the binding, so no cause is pending any more. */ export declare function invalidationReasonFromBranch(branch: readonly BranchEntry[]): string | undefined; export declare function bindingFromStoredBranch(branch: readonly BranchEntry[], stored: StoredBinding): ContinuityBinding | undefined; export {}; //# sourceMappingURL=session-binding.d.ts.map