| export type AcpRuntimePromptMode = "prompt" | "steer"; |
|
|
| export type AcpRuntimeSessionMode = "persistent" | "oneshot"; |
|
|
| export type AcpSessionUpdateTag = |
| | "agent_message_chunk" |
| | "agent_thought_chunk" |
| | "tool_call" |
| | "tool_call_update" |
| | "usage_update" |
| | "available_commands_update" |
| | "current_mode_update" |
| | "config_option_update" |
| | "session_info_update" |
| | "plan" |
| | (string & {}); |
|
|
| export type AcpRuntimeControl = "session/set_mode" | "session/set_config_option" | "session/status"; |
|
|
| export type AcpRuntimeHandle = { |
| sessionKey: string; |
| backend: string; |
| runtimeSessionName: string; |
| |
| cwd?: string; |
| |
| acpxRecordId?: string; |
| |
| backendSessionId?: string; |
| |
| agentSessionId?: string; |
| }; |
|
|
| export type AcpRuntimeEnsureInput = { |
| sessionKey: string; |
| agent: string; |
| mode: AcpRuntimeSessionMode; |
| resumeSessionId?: string; |
| cwd?: string; |
| env?: Record<string, string>; |
| }; |
|
|
| export type AcpRuntimeTurnAttachment = { |
| mediaType: string; |
| data: string; |
| }; |
|
|
| export type AcpRuntimeTurnInput = { |
| handle: AcpRuntimeHandle; |
| text: string; |
| attachments?: AcpRuntimeTurnAttachment[]; |
| mode: AcpRuntimePromptMode; |
| requestId: string; |
| signal?: AbortSignal; |
| }; |
|
|
| export type AcpRuntimeCapabilities = { |
| controls: AcpRuntimeControl[]; |
| |
| |
| |
| |
| configOptionKeys?: string[]; |
| }; |
|
|
| export type AcpRuntimeStatus = { |
| summary?: string; |
| |
| acpxRecordId?: string; |
| |
| backendSessionId?: string; |
| |
| agentSessionId?: string; |
| details?: Record<string, unknown>; |
| }; |
|
|
| export type AcpRuntimeDoctorReport = { |
| ok: boolean; |
| code?: string; |
| message: string; |
| installCommand?: string; |
| details?: string[]; |
| }; |
|
|
| export type AcpRuntimeEvent = |
| | { |
| type: "text_delta"; |
| text: string; |
| stream?: "output" | "thought"; |
| tag?: AcpSessionUpdateTag; |
| } |
| | { |
| type: "status"; |
| text: string; |
| tag?: AcpSessionUpdateTag; |
| used?: number; |
| size?: number; |
| } |
| | { |
| type: "tool_call"; |
| text: string; |
| tag?: AcpSessionUpdateTag; |
| toolCallId?: string; |
| status?: string; |
| title?: string; |
| } |
| | { |
| type: "done"; |
| stopReason?: string; |
| } |
| | { |
| type: "error"; |
| message: string; |
| code?: string; |
| retryable?: boolean; |
| }; |
|
|
| export interface AcpRuntime { |
| ensureSession(input: AcpRuntimeEnsureInput): Promise<AcpRuntimeHandle>; |
|
|
| runTurn(input: AcpRuntimeTurnInput): AsyncIterable<AcpRuntimeEvent>; |
|
|
| getCapabilities?(input: { |
| handle?: AcpRuntimeHandle; |
| }): Promise<AcpRuntimeCapabilities> | AcpRuntimeCapabilities; |
|
|
| getStatus?(input: { handle: AcpRuntimeHandle; signal?: AbortSignal }): Promise<AcpRuntimeStatus>; |
|
|
| setMode?(input: { handle: AcpRuntimeHandle; mode: string }): Promise<void>; |
|
|
| setConfigOption?(input: { handle: AcpRuntimeHandle; key: string; value: string }): Promise<void>; |
|
|
| doctor?(): Promise<AcpRuntimeDoctorReport>; |
|
|
| cancel(input: { handle: AcpRuntimeHandle; reason?: string }): Promise<void>; |
|
|
| close(input: { handle: AcpRuntimeHandle; reason: string }): Promise<void>; |
| } |
|
|