import type { ContextInfo, WorkerReport } from "./protocol.js"; import { type UsageInfo } from "./usage.js"; /** Time without a turn starting before an empty session counts as waiting for its first prompt. */ export declare const FIRST_PROMPT_MS = 5000; /** A custom() component only counts as a blocking dialog after this long (PRD R6). */ export declare const CUSTOM_DIALOG_MS = 2000; /** Row text alone is re-sent at most this often while working (SM-1). */ export declare const SUMMARY_INTERVAL_MS = 15000; export declare class WorkerTracker { private running; private settled; private dialogs; private tool; private text; private error; private question; private choices; private sawTurn; private name; private model; private thinking; private context; /** M24: what the session spent so far. */ private usage; /** SM-2: the summary model's line for the finished turn, or its progress line while running. */ private modelSummary; /** Bumped at every run start: a late summary for an older run is dropped. */ private generation; /** A session (re)starts in this worker: /new, /resume and /fork begin from scratch. */ start(info: { name?: string | null; model?: string | null; thinking?: string | null; context?: ContextInfo | null; fresh: boolean; }): void; /** A restarted worker with no new prompt: the session's last reply says where it stands. */ restore(lastAssistant: { content?: unknown; stopReason?: string; errorMessage?: string; } | undefined): void; agentStart(): void; private resetRun; /** Identifies the current run for asynchronous summaries. */ runId(): number; /** The latest assistant text of this run (the summary model's input). */ lastText(): string; /** SM-2 at turn end: the model may reword the row and correct question detection. */ applyTurnSummary(run: number, s: { summary: string; kind: "done" | "question"; reply: string | null; }): boolean; /** SM-2 during a long turn: a fresh line every few minutes. */ applyProgressSummary(run: number, summary: string): boolean; isRunning(): boolean; toolStart(name: string): void; toolEnd(): void; assistantMessage(message: { content?: unknown; stopReason?: string; errorMessage?: string; }): void; /** The run is over and pi will not continue on its own. */ agentSettled(aborted: boolean): void; dialogStart(kind: string, title: string | undefined): void; dialogEnd(): void; rename(name: string | undefined): void; setModel(model: string): void; setThinking(level: string | null): void; /** M8: the latest context window use; true when it changed. */ setContext(context: ContextInfo | null): boolean; /** M24: the session's usage; true when it changed. */ setUsage(usage: UsageInfo | null): boolean; /** No turn started yet; called once FIRST_PROMPT_MS after session start. */ firstPromptTimeout(messageCount: number): void; waitingForFirstPrompt(): boolean; report(): WorkerReport; private summary; } export declare function sameContext(a: ContextInfo | null | undefined, b: ContextInfo | null | undefined): boolean; /** Whether two reports differ in more than row text and context use (those are sent at once). */ export declare function stateChanged(a: WorkerReport | undefined, b: WorkerReport): boolean;