/** * Agent task execution, skill dispatch, and command chaining. * * Extracted from main.ts to keep the entry point lean. All functions * receive an AppExecutionContext so they remain decoupled from the * global variables in main.ts. */ import { App } from './App'; import { ProjectContext } from '../utils/project'; export declare function getActionType(toolName: string): string; export interface AppExecutionContext { app: App; projectPath: string; projectContext: ProjectContext | null; hasWriteAccess: boolean; addedFiles: Map; isAgentRunning: () => boolean; setAgentRunning: (v: boolean) => void; abortController: AbortController | null; setAbortController: (ctrl: AbortController | null) => void; formatAddedFilesContext: () => string; handleCommand: (command: string, args: string[]) => Promise; /** The conversation this run belongs to. Saved under this id; the global * currentSessionId is only a fallback and can name a different one. */ sessionId?: string; /** The conversation on screen now. A run can outlive a switch to another * one (/new, /sessions, /rename), since tools do not stop on abort. */ getSessionId?: () => string; sessionDisplayName?: string; setSessionDisplayName?: (name: string | null) => void; } export declare function isDangerousTool(toolName: string, parameters: Record): boolean; export declare function requestToolConfirmation(app: App, tool: string, parameters: Record, onConfirm: () => void, onCancel: () => void): void; /** * Model-written text shown in a permission dialog, with every character that * could change how the rest of it looks spelled out: an ESC sequence would be * read as a style (conceal, black on black) and a bidi override or zero-width * character reorders or hides text, so the user could approve a command they * were not shown. Newlines are left for the caller to lay out. */ export declare function showControls(text: string): string; /** * The target of a tool call as dialog lines, each `width` terminal columns at * most. Shown whole where it fits: an MCP call's arguments or a long command * matter from the first character. Past `maxLines` the middle gives way, and a * line says how much of it is not shown. */ export declare function wrapConfirmTarget(target: string, width: number, maxLines?: number): string[]; export interface PendingInteractiveContext { originalTask: string; context: import('../utils/interactive').InteractiveContext; dryRun: boolean; } /** How a run ended. 'not-started' covers a run that was refused, declined at * a confirmation, or held for clarifying questions. */ export type AgentRunOutcome = 'success' | 'failed' | 'aborted' | 'interrupted' | 'not-started'; export interface RunAgentTaskOptions { /** Called once, when the run has ended or will not start. */ onFinished?: (outcome: AgentRunOutcome) => void; } export declare function runAgentTask(task: string, dryRun: boolean, ctx: AppExecutionContext, getPendingInteractive: () => PendingInteractiveContext | null, setPendingInteractive: (v: PendingInteractiveContext | null) => void, opts?: RunAgentTaskOptions): Promise; export declare function executeAgentTask(task: string, dryRun: boolean, ctx: AppExecutionContext): Promise; export declare function runSkill(nameOrShortcut: string, args: string[], ctx: AppExecutionContext): Promise; export declare function runCommandChain(commands: string[], index: number, ctx: AppExecutionContext): void;