import type { ExtensionContext } from "@lpb-work/pi-coding-agent"; import { computeWatchdogRepoChangeSignature } from "./change-signature.ts"; import { type WatchdogLspDiagnosticsFunction } from "./lsp-diagnostics.ts"; import type { ResolvedWatchdogConfig, WatchdogEndpointConfig, WatchdogLspRuntimeSnapshot, WatchdogRuntimeStatus, WatchdogSettingsError, WatchdogSettingsResult, WatchdogSettingsSource, WatchdogWarning, WatchdogWarningDetails } from "./types.ts"; type ReviewStopReason = "stop" | "error" | "aborted" | "length"; export interface WatchdogReviewResult { warnings?: WatchdogWarning[]; stopReason?: ReviewStopReason; } export interface WatchdogReviewRequest { delta: string; epoch: number; hasScope: boolean; reviewId: number; config: ResolvedWatchdogConfig; emitWarning(warning: WatchdogWarning): boolean; signal?: AbortSignal; } export type WatchdogReviewFunction = (request: WatchdogReviewRequest) => Promise | WatchdogReviewResult | undefined; export interface WatchdogRuntimeSnapshot { status: WatchdogRuntimeStatus; enabled: boolean; config: ResolvedWatchdogConfig; configOk: boolean; errors: WatchdogSettingsError[]; sources: WatchdogSettingsSource[]; bufferedDeltas: number; epoch: number; activeReviewId?: number; sessionOverride?: boolean; sessionModelOverride?: Partial>; lastWarning?: WatchdogWarningDetails; lastError?: string; failedReviews: number; staleReviews: number; reviewConnected: boolean; reviewDescription: string; autoFollowQueued: boolean; autoFollowAttempts: number; autoFollowStalemate: boolean; reviewTrigger: "turn-delta" | "repo-edits"; changedPaths?: string[]; lsp: WatchdogLspRuntimeSnapshot; } interface MainWatchdogRuntimeOptions { cwd?: string; resolveConfig?: (cwd: string, options?: { session?: Record; }) => WatchdogSettingsResult; review?: WatchdogReviewFunction; reviewDescription?: string; displayWarning?: (warning: WatchdogWarningDetails, options?: { deliverAs?: "steer"; }) => void; sendUserMessage?: (message: string) => void | Promise; reviewChangesOnly?: boolean; lspDiagnostics?: WatchdogLspDiagnosticsFunction; repoChangeSignature?: typeof computeWatchdogRepoChangeSignature; } type ContextLike = Pick; export declare class MainWatchdogRuntime { private cwd; private readonly resolveConfig; private readonly review; private readonly reviewConnected; private readonly reviewDescription; private readonly displayWarning; private readonly sendUserMessage; private readonly reviewChangesOnly; private readonly lspDiagnostics; private readonly repoChangeSignature; private readonly lspLedger; private readonly scope; private configResult; private sessionOverrideEnabled; private sessionModelOverride; private status; private pendingDeltas; private pendingDeltaChars; private guard; private guardMaxWarnings; private epoch; private reviewIdCounter; private agentEndIdCounter; private activeAgentEndId; private activeAgentEndAbortController; private activeReviewId; private activeReviewWarning; private reviewing; private waitingAtAgentEnd; private disposed; private includeUserPromptInNextDelta; private userPrompt; private waiters; private lastWarning; private displayedWarningSequence; private lastError; private lastReviewInputSignature; private turnStartChangeSignature; private lastReviewedChangeSignature; private currentChangedPaths; private lastLspSnapshot; private observedRepoEditThisTurn; private toolResultsThisRun; private midRunReviewing; private autoFollowQueued; private autoFollowAttempts; private consecutiveAutoFollowIdentity; private consecutiveAutoFollowRepeats; private autoFollowStalemate; private pendingAutoFollowPrompts; private midRunGeneration; private activeReviewAbortController; private failedReviews; private staleReviews; constructor(options?: MainWatchdogRuntimeOptions); bindSession(ctx: ContextLike): void; refreshConfig(cwd?: string): WatchdogSettingsResult; setSessionEnabled(enabled: boolean, cwd?: string): WatchdogRuntimeSnapshot; setSessionModel(patch: { model?: string | null; thinking?: WatchdogEndpointConfig["thinking"] | null; }, cwd?: string): WatchdogRuntimeSnapshot; clearSessionModel(cwd?: string): WatchdogRuntimeSnapshot; clearSessionOverride(cwd?: string): WatchdogRuntimeSnapshot; reset(_reason?: string, options?: { clearReviewInputSignature?: boolean; resetChangeSignature?: boolean; clearLspLedger?: boolean; clearScope?: boolean; resetAutoFollow?: boolean; }): void; dispose(): void; handleBeforeAgentStart(event: unknown, ctx: ContextLike): void; handleTurnEnd(event: unknown, ctx: ContextLike): void; enqueueDelta(delta: string): void; handleToolResult(ctx: ContextLike): void; handleAgentEnd(_event: unknown, ctx: ContextLike): Promise; recordDisplayedWarning(warning: WatchdogWarning): WatchdogWarningDetails; getSnapshot(cwd?: string): WatchdogRuntimeSnapshot; waitForIdle(timeoutMs?: number): Promise; private isEnabled; private abortActiveAgentEnd; private isAgentEndCurrent; private isCurrent; private warningMeetsThreshold; private acceptWarning; private displayBoundaryWarning; private invalidateActiveReview; private reviewMidRunDelta; private cancelMidRunReview; private reviewDelta; private displayAcceptedReviewWarning; private resetAutoFollowState; private queueAutoFollowIfNeeded; private currentRepoChangeSignature; private resetRepoChangeBaseline; private resolveReviewChangeSignature; private collectLspDiagnostics; private lspSnapshot; private appendBoundedDelta; private buildReviewInput; private scopeBlock; private clearPendingDeltas; private fail; private markLastWarningStale; private isSettled; private waitForSettled; private resolveWaiters; } export {}; //# sourceMappingURL=runtime.d.ts.map