export type ControlValue = unknown; export type AbortMode = "turn" | "terminal"; export type AbortScope = "turn" | "owned"; /** * Terminal-mode C04 `turn.abort` input. `scope` selects whether exact causal * owned work (background Bash/task jobs, detached subagents) is also stopped * (`"owned"`) or left running so its completion can resume the root worker * (`"turn"`, the default). */ export interface TerminalAbortInput { mode: "terminal"; scope?: AbortScope; } export type ControlInput = Record; /** * Narrow host contract used by control dispatch. Implementations adapt an * AgentSession and its controllers without exposing those concrete types here. */ export interface ControlSurface { prompt(text: string, images?: ControlValue, clientRef?: string): Promise | ControlValue; steer(text: string, clientRef?: string): Promise | ControlValue; followUp(text: string): Promise | ControlValue; abort(): Promise | ControlValue; /** Terminal abort: stop the current root turn (and optionally exact owned work). */ abortTerminal?(input: TerminalAbortInput, idempotencyKey?: string): Promise | ControlValue; abortAndPrompt(text: string): Promise | ControlValue; answerAsk(id: string, answer: ControlValue): Promise | ControlValue; answerGate( id: string, response: ControlValue, expectedSessionId?: string, idempotencyKey?: string, ): Promise | ControlValue; approvePlan(id: string, choice: ControlValue, expectedSessionId?: string): Promise | ControlValue; invokeSkill(name: string, args: ControlValue, clientRef?: string): Promise | ControlValue; setPlanMode(on: boolean): Promise | ControlValue; operateGoal(op: string, objective?: string): Promise | ControlValue; replaceTodo(items: ControlValue): Promise | ControlValue; setModel(id: string, thinkingLevel?: ControlValue): Promise | ControlValue; setModelProfile(id: string): Promise | ControlValue; cycleModel(): Promise | ControlValue; setThinking(level: ControlValue): Promise | ControlValue; cycleThinking(): Promise | ControlValue; setPermissionMode(mode: ControlValue): Promise | ControlValue; setQueueMode(kind: string, mode: ControlValue): Promise | ControlValue; runCompaction(): Promise | ControlValue; setAutoCompaction(on: boolean): Promise | ControlValue; setAutoRetry(on: boolean): Promise | ControlValue; abortRetry(): Promise | ControlValue; executeBash(cmd: string): Promise | ControlValue; abortBash(): Promise | ControlValue; newSession(): Promise | ControlValue; forkSession(): Promise | ControlValue; resumeSession(id: string): Promise | ControlValue; closeSession(capability?: string): Promise | ControlValue; switchSession(id: string): Promise | ControlValue; branchSession(entryId: string): Promise | ControlValue; renameSession(name: string): Promise | ControlValue; handoffSession(target: ControlValue): Promise | ControlValue; exportHtml(): Promise | ControlValue; patchConfig(patch: ControlValue): Promise | ControlValue; reloadRuntime(components: ControlValue): Promise | ControlValue; login(provider: string): Promise | ControlValue; registerHostTools(defs: ControlValue): Promise | ControlValue; registerHostUri(defs: ControlValue): Promise | ControlValue; setServiceTier(tier: ControlValue): Promise | ControlValue; setActiveTools(names: ControlValue): Promise | ControlValue; removeQueueMessage(id: string): Promise | ControlValue; moveQueueMessage(id: string, position: { before?: string; after?: string }): Promise | ControlValue; updateQueueMessage(id: string, patch: ControlValue): Promise | ControlValue; setExtensionEnabled(id: string, on: boolean): Promise | ControlValue; clearContext(confirm: boolean): Promise | ControlValue; deleteSession(id: string, confirm: boolean): Promise | ControlValue; moveCwd(path: string): Promise | ControlValue; retryLast(): Promise | ControlValue; retryNow(): Promise | ControlValue; backgroundBash(): Promise | ControlValue; /** Returns the current revision for a registry revision resource. */ /** Installed per-session registry rows. Dispatch rejects other rows before invoking a surface method. */ installedOperations?: ReadonlySet; revisionProvider?(resource: string): Promise | string | undefined; }