import type { PlanManager } from '../../manager/plan/lifecycle.js'; import type { TurnBeginDraft, TurnRecorder } from '../../manager/session/turn-recorder.js'; import type { ProbeObservation } from '../../probe/registry.js'; import type { ActivityStore } from '../../store/activity/memory.js'; import type { SessionTextEvidenceSource } from '../../store/evidence/types.js'; import type { ReadSessionLogOptions } from '../../store/session-log/index.js'; import type { CheckpointId, SessionId, TurnId } from '../../types/ids/index.js'; import { type SessionEvent } from '../../types/session/events.js'; import type { SessionRecord } from '../../types/session/records.js'; import type { TaskStore } from '../../types/task/index.js'; import { type Logger } from '../../utils/logger.js'; /** * A live event as the loop builds it: `sessionId` and `turnId` may be left * out, and the translator stamps the turn's own. */ export type SessionEventDraft = SessionEvent extends infer E ? E extends SessionEvent ? Omit & { sessionId?: SessionId; turnId?: TurnId; } : never : never; export type EmitEvent = (event: SessionEventDraft) => Promise; /** * The turn's one funnel from "something happened" to the live stream and the * session log. * * Every non-ephemeral event is appended to the session log first (through * the turn's {@link TurnRecorder}, in order with its messages and records), * and only then queued for the consumer carrying the record's `seq` and * `generation`. A failed append still delivers the event, unstamped: losing * the news of a failure is worse than delivering it without a cursor. */ export declare class EventTranslator { private pendingEvents; private readonly recorder; private probes; private droppedDeltaCount; private readonly log; constructor(recorder: TurnRecorder, probeRegistry?: ProbeObservation, log?: Logger); /** Serializes appends and reads against each other. */ private appendChain; private withLogLock; /** The session log's records, read between whole appends. */ readRecords(options?: ReadSessionLogOptions): Promise; /** * A text evidence source over the turn's session log, captured while the * turn is running: every earlier turn of the session and this turn's * records so far. `undefined` for a log that is not on disk. */ captureSessionEvidence(maxReadBytes?: number, signal?: AbortSignal): Promise; /** Stamp the turn's identity on an event the loop built without it. */ private stamp; readonly emitEvent: EmitEvent; /** * Begin the turn: `turn_started` in the log (with the prompt message it * names right after it), and the same event on the live stream. */ beginTurn(draft: TurnBeginDraft): Promise; /** Continue a paused or interrupted turn: `turn_resuming`, same `turnId`. */ resumeTurn(fromCheckpointId: CheckpointId, resolvedDecisionId?: string): Promise; drainPending(): Generator; wireActivityStore(activityStore: ActivityStore): void; /** * Report the session's task list on the turn's stream. A task belongs to * the session; every change to one of its tasks during this turn is * reported, whichever turn created it. */ wireTaskStore(taskStore: TaskStore, sessionId: SessionId): () => void; wirePlanManager(planManager: PlanManager): void; } //# sourceMappingURL=events.d.ts.map