/** Per-conversation state, caller-supplied identity only: the turn index, the sealed * history, and the promise-queue mutex that serializes EVERY entry. seal(draft) * folds the TurnDraft into the stores in one move — the ONLY place session state * changes; a discarded draft leaves no trace. */ import type { Act, Correction, DeliveryMarks, FinishPayload, Question, QuestionClose, TurnRecord } from '../contract/vocabulary.js'; import type { CanonicalCallData } from '../contract/vocabulary.js'; import { type CanonicalCall } from '../contract/canonical-call.js'; import type { ActionHistory } from './action-history.js'; import { ConsentDesk } from './consent-desk.js'; import { ReadsLog } from './reads-log.js'; /** The one mutable work area of a turn, private to it and folded by seal. */ export interface TurnDraft { readonly turn: number; userText: string; servedBy: string; readonly acts: Act[]; readonly corrections: Correction[]; readonly issued: Question[]; readonly consumed: string[]; readonly closed: { readonly id: string; readonly why: QuestionClose; }[]; finish: FinishPayload | null; closedBy: 'model' | 'engine'; text: string; delivery: DeliveryMarks | null; /** Prerequisite tools whose micro-step yielded no call this turn — the debt is * asked of the model at most once per turn. */ readonly microTried: string[]; /** The last reply the desk wrote that ONLY an unspoken read refused, and that the * deterministic delivery walks passed. It reaches the operator if the retries run * out: a turn whose whole work was a question keeps its question. */ unspokenReadReply: string | null; /** Ids the conversation's own acts returned at other desks — engine-minted * provenance the grounding floor accepts alongside the desk's own reads. */ readonly grounded: string[]; /** Every model call books its cost here; zeros where the port has no numbers. */ readonly usage: { inputTokens: number; outputTokens: number; cachedInputTokens: number; reasoningTokens: number; modelCalls: number; }; } export declare class Session { readonly id: string; readonly history: ActionHistory; /** The question lifecycle; the delivered display form is masked at the desk door. */ readonly consent: ConsentDesk; /** What this conversation's calls answered — the one state a guard can see. */ readonly reads: ReadsLog; private turnIndex; private tail; constructor(id: string, history: ActionHistory, maskCall?: (call: CanonicalCall) => CanonicalCallData, now?: () => number); /** The serializing queue: a failed job never poisons the next entry. */ enter(job: () => Promise): Promise; /** The work area; discarded on failure. The desk starts a fresh overlay with it. */ draft(): TurnDraft; seal(draft: TurnDraft): TurnRecord; } //# sourceMappingURL=session.d.ts.map