import type { ChatMessage, ChatImage, Mode, ProviderId, SuccessfulRequestSnapshot, ToolCall, ToolResult } from "../types.js"; import { type BackgroundJob, type ResponderNotification } from "../tools/jobs.js"; import { type SessionPlan } from "../store/plan.js"; import type { AgentEvent } from "./events.js"; import { type SessionPolicy } from "./session-policy.js"; import { type PreviousTurnSignal } from "./continue-orient.js"; import { type ConfirmPort } from "./confirm-port.js"; export * from "./tool-call-parser.js"; export { createSessionPolicy, isPreApprovalAllowedTool, isPlanApprovedByStatus, planHasOpenWork, shouldEnableImageOcr, type SessionPolicy, } from "./session-policy.js"; export { type ConfirmPort } from "./confirm-port.js"; /** * A foreground task waits for a responder child only when the plan * Declares that dependency. Report titles carry no scheduling meaning: any * Dependency-ready foreground work is executed while children keep running, and * Their results arrive as addenda. * * A declared dependency blocks only while the child is genuinely live (running * Job or an undelivered/unanalyzed receipt), so an orphaned child can never * Stall the turn forever. */ export declare function shouldYieldForDeclaredResponderDependency(plan: SessionPlan | undefined, runningJobs: readonly BackgroundJob[], notifications: readonly ResponderNotification[], currentNotificationId?: string | undefined): boolean; export interface AgentRunOptions { provider?: ProviderId | undefined; model?: string | undefined; history?: ChatMessage[] | undefined; autoConfirm?: boolean | undefined; maxSteps?: number | undefined; signal?: AbortSignal | undefined; images?: ChatImage[] | undefined; visionProven?: boolean | undefined; onToolStart?: ((call: ToolCall) => void) | undefined; onToolResult?: ((call: ToolCall, result: ToolResult) => void) | undefined; onEvent?: ((event: AgentEvent) => void) | undefined; /** * Called when a turn ends with the FULL conversation for the turn — the user * message, every assistant tool-call, every tool result, and the final * answer (system prompts excluded). Callers persist this so a resumed * session gives the model back what it actually did (commands, outputs, * results), not just its prose answers. */ onMessages?: ((messages: ChatMessage[]) => void) | undefined; onSuccessfulRequest?: ((snapshot: SuccessfulRequestSnapshot) => void) | undefined; /** * The session's last successful main request from an earlier turn. Seeds the * local snapshot so a first-iteration auto-compaction can still replay the * exact cached prefix instead of re-rendering the transcript. */ previousSuccessfulRequest?: SuccessfulRequestSnapshot | undefined; onOutcome?: ((outcome: import("./turn-outcome.js").TurnOutcome) => void) | undefined; confirm?: ConfirmPort | undefined; requestSecret?: ((request: { title: string; prompt: string; }) => Promise) | undefined; session?: SessionPolicy | undefined; /** REPL mode: agent executes; plan is planning-only. */ mode?: Mode | undefined; /** * Transcript YOU bubble. `null` hides implement/revision choreography from * chat; model still receives `prompt`. Omit to show `prompt`. */ displayPrompt?: string | null | undefined; /** How the previous turn ended, so recovery is decided from state. */ previousTurn?: PreviousTurnSignal | undefined; /** User-declared model window for this provider/model/session. */ contextLimitTokens?: number | undefined; getContextLimitTokens?: (provider: ProviderId | undefined, model: string | undefined) => number | undefined; } export declare function runAgentTurn(prompt: string, options?: AgentRunOptions): Promise; /** Compatibility boundary for callers that consume visible assistant text. */ export declare function runAgentLoop(prompt: string, options?: AgentRunOptions): Promise;