import type { SessionManager } from "@earendil-works/pi-coding-agent"; import { type ClientFrame, type ServerFrame, type TimelineEvent, type TimelinePartial } from "../protocol/v2/index.js"; import type { Correlation, TimelineRuntime, TimelineStarted } from "./runtime.js"; export type V2ActionFrame = Extract; export type V2ServiceOptions = { sessionManager: SessionManager; senderRef: string; generation?: string; runtime: TimelineRuntime; onUserMessage: (frame: Extract, correlation: Correlation) => boolean | "queued" | "duplicate" | "conflict" | "rejected"; onCancel?: () => boolean; onAction?: (frame: V2ActionFrame) => void; onQueueSnapshot?: () => ServerFrame[]; onQueuedMessageClear?: (targetId?: string) => string[]; onQueuedMessageSteer?: (targetId: string) => "sent" | "failed" | "missing"; onListModels?: () => Pick, "models" | "current">; }; export type V2Broadcast = Extract; type QueuedMessageItem = Extract["items"][number]; export declare class TimelineV2Service { private readonly state; private readonly pager; private readonly sessionManager; private readonly senderRef; private readonly runtime; private readonly onUserMessage; private readonly onCancel?; private readonly onAction?; private readonly onQueueSnapshot?; private readonly onQueuedMessageClear?; private readonly onQueuedMessageSteer?; private readonly onListModels?; private readonly requestChannels; private generationValue; constructor(options: V2ServiceOptions); get generation(): string; canQueueItem(item: QueuedMessageItem): boolean; queueSnapshot(items: readonly QueuedMessageItem[]): ServerFrame[]; reset(reason: "generation_changed" | "branch_changed" | "session_replaced"): ServerFrame[]; refreshGeneration(next: string): boolean; handle(frame: ClientFrame): ServerFrame[]; started(started: TimelineStarted): ServerFrame[]; commit(clientRequestId: string, messageId: string, groupId?: string): ServerFrame[]; canDrain(clientRequestId: string): boolean; unknownDelivery(clientRequestId: string): ServerFrame[]; partial(partial: TimelinePartial): V2Broadcast | null; publish(event: TimelineEvent): V2Broadcast | null; publishFrames(event: TimelineEvent): V2Broadcast[]; private ready; private handleHistory; private handlePing; private handleQueuedMessageClear; private handleQueuedMessageSteer; private handleCancel; private handleObserved; private handleUserMessage; private replay; private status; private handleListModels; private handleAction; private requireReady; private ensureReady; private currentQueueSnapshot; private queueFrame; private frameBytes; private terminateQueuedRequest; private direct; private error; private idempotencyPayload; private recordKey; private findRecord; } export {};