@1agents/acp-service 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -33
- package/dist/bin/acp-service.js +2 -2
- package/dist/src/bridge.d.ts +2 -2
- package/dist/src/bridge.js +2 -2
- package/dist/src/catalog-descriptors.js +0 -10
- package/dist/src/catalog.js +20 -3
- package/dist/src/manifest.js +1 -1
- package/package.json +26 -7
- package/vendor/runtime/LICENSE +21 -0
- package/vendor/runtime/README.md +115 -0
- package/vendor/runtime/dist/agent-registry-CMg8LHKY.js +806 -0
- package/vendor/runtime/dist/agent-registry-CMg8LHKY.js.map +1 -0
- package/vendor/runtime/dist/agent-registry.d.ts +70 -0
- package/vendor/runtime/dist/agent-registry.d.ts.map +1 -0
- package/vendor/runtime/dist/agent-registry.js +2 -0
- package/vendor/runtime/dist/cli-DUHyAADv.js +182 -0
- package/vendor/runtime/dist/cli-DUHyAADv.js.map +1 -0
- package/vendor/runtime/dist/cli.d.ts +12 -0
- package/vendor/runtime/dist/cli.d.ts.map +1 -0
- package/vendor/runtime/dist/cli.js +2632 -0
- package/vendor/runtime/dist/cli.js.map +1 -0
- package/vendor/runtime/dist/client-DjkWknf7.d.ts +262 -0
- package/vendor/runtime/dist/client-DjkWknf7.d.ts.map +1 -0
- package/vendor/runtime/dist/docs-site/.nojekyll +0 -0
- package/vendor/runtime/dist/docs-site/CLI.html +832 -0
- package/vendor/runtime/dist/docs-site/CNAME +1 -0
- package/vendor/runtime/dist/docs-site/VISION.html +415 -0
- package/vendor/runtime/dist/docs-site/agents.html +391 -0
- package/vendor/runtime/dist/docs-site/compare.html +359 -0
- package/vendor/runtime/dist/docs-site/config.html +450 -0
- package/vendor/runtime/dist/docs-site/custom-agents.html +408 -0
- package/vendor/runtime/dist/docs-site/exit-codes.html +347 -0
- package/vendor/runtime/dist/docs-site/favicon.svg +21 -0
- package/vendor/runtime/dist/docs-site/flows.html +497 -0
- package/vendor/runtime/dist/docs-site/index.html +367 -0
- package/vendor/runtime/dist/docs-site/install.html +386 -0
- package/vendor/runtime/dist/docs-site/llms.txt +35 -0
- package/vendor/runtime/dist/docs-site/output-formats.html +403 -0
- package/vendor/runtime/dist/docs-site/permissions.html +413 -0
- package/vendor/runtime/dist/docs-site/prompting.html +460 -0
- package/vendor/runtime/dist/docs-site/proof-2026-07-18-grok-ext-methods/index.html +336 -0
- package/vendor/runtime/dist/docs-site/quickstart.html +382 -0
- package/vendor/runtime/dist/docs-site/runtime-environment.html +329 -0
- package/vendor/runtime/dist/docs-site/runtime-process-lifecycle.html +335 -0
- package/vendor/runtime/dist/docs-site/session-control.html +406 -0
- package/vendor/runtime/dist/docs-site/session-watch.html +354 -0
- package/vendor/runtime/dist/docs-site/sessions.html +486 -0
- package/vendor/runtime/dist/docs-site/shared-sessions.html +377 -0
- package/vendor/runtime/dist/flows-CiJSCy4D.js +2474 -0
- package/vendor/runtime/dist/flows-CiJSCy4D.js.map +1 -0
- package/vendor/runtime/dist/flows.d.ts +334 -0
- package/vendor/runtime/dist/flows.d.ts.map +1 -0
- package/vendor/runtime/dist/flows.js +2 -0
- package/vendor/runtime/dist/invocation-options-BlIySxIw.js +345 -0
- package/vendor/runtime/dist/invocation-options-BlIySxIw.js.map +1 -0
- package/vendor/runtime/dist/ipc-BlljKR2b.js +5336 -0
- package/vendor/runtime/dist/ipc-BlljKR2b.js.map +1 -0
- package/vendor/runtime/dist/output-BzXQKArM.js +1012 -0
- package/vendor/runtime/dist/output-BzXQKArM.js.map +1 -0
- package/vendor/runtime/dist/queue-owner-runtime-DSFdsS_y.js +8867 -0
- package/vendor/runtime/dist/queue-owner-runtime-DSFdsS_y.js.map +1 -0
- package/vendor/runtime/dist/runtime.d.ts +1156 -0
- package/vendor/runtime/dist/runtime.d.ts.map +1 -0
- package/vendor/runtime/dist/runtime.js +3675 -0
- package/vendor/runtime/dist/runtime.js.map +1 -0
- package/vendor/runtime/dist/session-options-ORCchZGk.d.ts +426 -0
- package/vendor/runtime/dist/session-options-ORCchZGk.d.ts.map +1 -0
- package/vendor/runtime/dist/session-watch-BiBTBMz4.js +76 -0
- package/vendor/runtime/dist/session-watch-BiBTBMz4.js.map +1 -0
- package/vendor/runtime/dist/watch-iYiP-lOo.js +85 -0
- package/vendor/runtime/dist/watch-iYiP-lOo.js.map +1 -0
- package/vendor/runtime/package.json +46 -0
- package/vendor/runtime/skills/acpx/SKILL.md +688 -0
|
@@ -0,0 +1,1156 @@
|
|
|
1
|
+
import { AcpAgentInspection, AcpAgentInspectionOptions, AcpAgentRegistry, AcpInspectableAgentRegistry, DEFAULT_AGENT_NAME, createAgentRegistry } from "./agent-registry.js";
|
|
2
|
+
import { A as GrokAskUserAnswers, C as PermissionPolicy, D as GrokExitPlanModeRequest, E as PromptInput, M as GrokAskUserQuestionResponse, O as GrokExitPlanModeResponse, S as PermissionMode, T as SessionRecord, _ as AcpProcessSpawnFailure, a as AcpElicitationHandler, b as McpServer$1, c as AcpElicitationResponse, d as AcpPermissionHandler, f as AcpPermissionRequest, g as AcpProcessLifecycle, h as AcpProcessLaunchScope, i as AcpElicitationContext, j as GrokAskUserQuestionRequest, k as GrokExitPlanOutcome, l as AcpJsonRpcMessage, m as AcpProcessLaunch, n as SystemPromptOption, o as AcpElicitationMode, p as AcpProcessExit, s as AcpElicitationRequest, t as SessionAgentOptions, u as AcpPermissionDecision, v as AcpProcessStarted, x as NonInteractivePermissionPolicy, y as AuthPolicy } from "./session-options-ORCchZGk.js";
|
|
3
|
+
import { n as AcpControlAuthority, t as AcpClient } from "./client-DjkWknf7.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { SetSessionConfigOptionResponse, ToolCallContent, ToolCallLocation, ToolKind } from "@1agents/acp-runtime-sdk";
|
|
6
|
+
//#region src/acp/model-support.d.ts
|
|
7
|
+
export declare const REQUESTED_MODEL_UNSUPPORTED_ERROR_CODE: "ACP_MODEL_UNSUPPORTED";
|
|
8
|
+
type RequestedModelUnsupportedErrorCode = typeof REQUESTED_MODEL_UNSUPPORTED_ERROR_CODE;
|
|
9
|
+
export declare const REQUESTED_MODEL_UNSUPPORTED_REASONS: readonly ["missing-capability", "unadvertised-model"];
|
|
10
|
+
type RequestedModelUnsupportedReason = (typeof REQUESTED_MODEL_UNSUPPORTED_REASONS)[number];
|
|
11
|
+
export declare class RequestedModelUnsupportedError extends Error {
|
|
12
|
+
readonly code: "ACP_MODEL_UNSUPPORTED";
|
|
13
|
+
readonly reason: RequestedModelUnsupportedReason;
|
|
14
|
+
readonly ambiguous?: true;
|
|
15
|
+
constructor(message: string, reason: RequestedModelUnsupportedReason, details?: {
|
|
16
|
+
ambiguous?: true;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
export declare function isRequestedModelUnsupportedError(value: unknown): value is RequestedModelUnsupportedError;
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/acp/config-option-support.d.ts
|
|
22
|
+
type AcpRuntimeConfigOptionChoice = {
|
|
23
|
+
value: string;
|
|
24
|
+
name: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
};
|
|
27
|
+
type AcpRuntimeConfigOption = {
|
|
28
|
+
id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
category?: string;
|
|
31
|
+
currentValue?: string;
|
|
32
|
+
options: AcpRuntimeConfigOptionChoice[];
|
|
33
|
+
};
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/acp/mode-support.d.ts
|
|
36
|
+
type AcpRuntimeSessionModeInfo = {
|
|
37
|
+
id: string;
|
|
38
|
+
name: string;
|
|
39
|
+
description?: string;
|
|
40
|
+
};
|
|
41
|
+
type AcpRuntimeSessionModes = {
|
|
42
|
+
currentModeId?: string;
|
|
43
|
+
availableModes: AcpRuntimeSessionModeInfo[];
|
|
44
|
+
};
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/session/journal.d.ts
|
|
47
|
+
type SessionWatchResult = {
|
|
48
|
+
status: "completed" | "cancelled";
|
|
49
|
+
stopReason?: string;
|
|
50
|
+
_meta?: Record<string, unknown> | null;
|
|
51
|
+
} | {
|
|
52
|
+
status: "failed";
|
|
53
|
+
error: {
|
|
54
|
+
message: string;
|
|
55
|
+
code?: string;
|
|
56
|
+
detailCode?: string;
|
|
57
|
+
retryable?: boolean;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
type SessionWatchEvent = {
|
|
61
|
+
cursor: string;
|
|
62
|
+
} & ({
|
|
63
|
+
type: "message";
|
|
64
|
+
requestId: string | null;
|
|
65
|
+
message: AcpJsonRpcMessage;
|
|
66
|
+
} | {
|
|
67
|
+
type: "turn_started";
|
|
68
|
+
requestId: string;
|
|
69
|
+
} | {
|
|
70
|
+
type: "turn_result";
|
|
71
|
+
requestId: string;
|
|
72
|
+
result: SessionWatchResult;
|
|
73
|
+
});
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/runtime/public/contract.d.ts
|
|
76
|
+
/**
|
|
77
|
+
* ACP has no mid-turn steering request. In-process runtimes admit a "steer"
|
|
78
|
+
* turn like "prompt": it waits behind any active turn on the same session and
|
|
79
|
+
* does not change that turn. Shared runtimes reject "steer".
|
|
80
|
+
*/
|
|
81
|
+
type AcpRuntimePromptMode = "prompt" | "steer";
|
|
82
|
+
type AcpRuntimeSessionMode = "persistent" | "oneshot";
|
|
83
|
+
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 & {});
|
|
84
|
+
type AcpRuntimeControl = "session/set_mode" | "session/set_model" | "session/set_config_option" | "session/status";
|
|
85
|
+
type AcpRuntimeHandle = {
|
|
86
|
+
sessionKey: string;
|
|
87
|
+
backend: string;
|
|
88
|
+
runtimeSessionName: string;
|
|
89
|
+
cwd?: string;
|
|
90
|
+
acpxRecordId?: string;
|
|
91
|
+
backendSessionId?: string;
|
|
92
|
+
agentSessionId?: string;
|
|
93
|
+
};
|
|
94
|
+
type AcpRuntimeEnsureInput = {
|
|
95
|
+
sessionKey: string;
|
|
96
|
+
agent: string;
|
|
97
|
+
mode: AcpRuntimeSessionMode;
|
|
98
|
+
resumeSessionId?: string;
|
|
99
|
+
cwd?: string;
|
|
100
|
+
/**
|
|
101
|
+
* Per-session agent options applied when a fresh ACP session is created.
|
|
102
|
+
* Threaded into `_meta.systemPrompt` (and `_meta.claudeCode.options.*`)
|
|
103
|
+
* on the underlying `session/new` request, and persisted onto the new
|
|
104
|
+
* record. Ignored when an existing persistent session is reused — system
|
|
105
|
+
* prompts are fixed at `newSession` time, so changing them requires a
|
|
106
|
+
* different sessionKey or prepareFreshSession on the prior record first.
|
|
107
|
+
*/
|
|
108
|
+
sessionOptions?: SessionAgentOptions;
|
|
109
|
+
/** Host-resolved argv. Never sourced from a persisted user profile. */
|
|
110
|
+
agentArgv?: string[];
|
|
111
|
+
/** Credentials for this process lifetime only; never persisted. */
|
|
112
|
+
authCredentials?: Record<string, string>;
|
|
113
|
+
};
|
|
114
|
+
type AcpRuntimeTurnAttachment = {
|
|
115
|
+
/**
|
|
116
|
+
* Media type for binary prompt attachments. The runtime currently maps
|
|
117
|
+
* image/* and audio/* attachments to ACP prompt content blocks.
|
|
118
|
+
*/
|
|
119
|
+
mediaType: string;
|
|
120
|
+
data: string;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* In-process turns check synchronous host authority before prompt dispatch.
|
|
124
|
+
* A throwing assertActive rejects admission without aborting the signal.
|
|
125
|
+
*/
|
|
126
|
+
type AcpRuntimeTurnInput = AcpControlAuthority & {
|
|
127
|
+
handle: AcpRuntimeHandle;
|
|
128
|
+
text: string;
|
|
129
|
+
attachments?: AcpRuntimeTurnAttachment[];
|
|
130
|
+
mode: AcpRuntimePromptMode;
|
|
131
|
+
requestId: string;
|
|
132
|
+
timeoutMs?: number;
|
|
133
|
+
/**
|
|
134
|
+
* Overrides the client's default callback for this prompt turn. Throwing or
|
|
135
|
+
* returning undefined falls through to configured permission policy, not the
|
|
136
|
+
* default callback.
|
|
137
|
+
*/
|
|
138
|
+
onPermissionRequest?: AcpPermissionHandler;
|
|
139
|
+
/** Handles ACP elicitation requests owned by this prompt turn. */
|
|
140
|
+
onElicitation?: AcpElicitationHandler;
|
|
141
|
+
};
|
|
142
|
+
/** Caller-owned snapshot; local mutations do not change runtime capabilities. */
|
|
143
|
+
type AcpRuntimeCapabilities = {
|
|
144
|
+
controls: AcpRuntimeControl[];
|
|
145
|
+
configOptionKeys?: string[];
|
|
146
|
+
};
|
|
147
|
+
type AcpRuntimeSessionModels = {
|
|
148
|
+
currentModelId?: string;
|
|
149
|
+
availableModelIds: string[];
|
|
150
|
+
/** Native display names, when retained by the session snapshot. */
|
|
151
|
+
availableModels?: Array<{
|
|
152
|
+
modelId: string;
|
|
153
|
+
name: string;
|
|
154
|
+
}>;
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* One session mode the agent advertised (ACP `SessionMode`). `name` is the
|
|
158
|
+
* agent-facing display label; ids differ across agents (Claude Code:
|
|
159
|
+
* default/acceptEdits/plan/..., Codex: read-only/agent/...), so consumers
|
|
160
|
+
* must render data-driven rather than assume a fixed id set.
|
|
161
|
+
*/
|
|
162
|
+
/**
|
|
163
|
+
* Cumulative session cost as reported by the agent. Mirrors ACP's
|
|
164
|
+
* `Cost`, but both fields are optional here because not every adapter
|
|
165
|
+
* populates them on every event.
|
|
166
|
+
*/
|
|
167
|
+
type AcpRuntimeUsageCost = {
|
|
168
|
+
amount?: number;
|
|
169
|
+
currency?: string;
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* Per-turn token breakdown. Sourced from final prompt response usage or
|
|
173
|
+
* `UsageUpdate._meta.usage` on adapters that populate it. All fields optional —
|
|
174
|
+
* consumers should treat missing fields as "unknown", not "zero".
|
|
175
|
+
*/
|
|
176
|
+
type AcpRuntimeUsageBreakdown = {
|
|
177
|
+
inputTokens?: number;
|
|
178
|
+
outputTokens?: number;
|
|
179
|
+
cachedReadTokens?: number;
|
|
180
|
+
cachedWriteTokens?: number;
|
|
181
|
+
thoughtTokens?: number;
|
|
182
|
+
totalTokens?: number;
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* A normalized ACP session config option (a `select` — model, reasoning
|
|
186
|
+
* effort, etc.). `category` echoes the agent's grouping ("model" / "effort" /
|
|
187
|
+
* "mode" / …) when present; the "mode" option is surfaced separately via
|
|
188
|
+
* `modes`, so config-option consumers should skip it. Model option groups are
|
|
189
|
+
* flattened into a single `options` list.
|
|
190
|
+
*/
|
|
191
|
+
type AcpRuntimePlanEntryStatus = "pending" | "in_progress" | "completed";
|
|
192
|
+
/**
|
|
193
|
+
* One entry of the agent's execution plan (ACP `PlanEntry`, emitted by
|
|
194
|
+
* Claude Code's TodoWrite and Codex's plan updates). The agent re-sends the
|
|
195
|
+
* FULL list on every update — consumers replace their plan wholesale, never
|
|
196
|
+
* merge.
|
|
197
|
+
*/
|
|
198
|
+
type AcpRuntimePlanEntry = {
|
|
199
|
+
content: string;
|
|
200
|
+
status: AcpRuntimePlanEntryStatus;
|
|
201
|
+
priority?: "high" | "medium" | "low";
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* Background task snapshot from Grok Build runtime (emitted as `background_task` event).
|
|
205
|
+
* Treated as top-level panel in chat UI (similar to plan checklist).
|
|
206
|
+
*/
|
|
207
|
+
type AcpRuntimeBackgroundTask = {
|
|
208
|
+
id: string;
|
|
209
|
+
status: "running" | "completed" | "failed" | "cancelled" | "killed";
|
|
210
|
+
command: string;
|
|
211
|
+
duration?: string;
|
|
212
|
+
exitCode?: number;
|
|
213
|
+
output?: string;
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* Agent-advertised slash command. The runtime only surfaces enough to
|
|
217
|
+
* drive a picker UI ("does the agent advertise /compact?"). The full
|
|
218
|
+
* `AvailableCommandInput` schema from ACP is intentionally not plumbed
|
|
219
|
+
* through.
|
|
220
|
+
*/
|
|
221
|
+
type AcpRuntimeAvailableCommand = {
|
|
222
|
+
name: string;
|
|
223
|
+
description?: string;
|
|
224
|
+
/** True/false when ACP advertised whether this command has an input schema. */
|
|
225
|
+
hasInput?: boolean;
|
|
226
|
+
};
|
|
227
|
+
/**
|
|
228
|
+
* Session-level usage roll-up surfaced through `getStatus()`. The
|
|
229
|
+
* reducer persists the breakdowns onto the session record; this type
|
|
230
|
+
* exposes them on the runtime contract.
|
|
231
|
+
*/
|
|
232
|
+
type AcpRuntimeSessionUsage = {
|
|
233
|
+
cumulative?: AcpRuntimeUsageBreakdown;
|
|
234
|
+
/** Cumulative session cost when the agent reported it. */
|
|
235
|
+
cost?: AcpRuntimeUsageCost;
|
|
236
|
+
/** Keyed by user-message id, matching the persisted reducer state. */
|
|
237
|
+
perRequest?: Record<string, AcpRuntimeUsageBreakdown>;
|
|
238
|
+
};
|
|
239
|
+
type AcpRuntimeStatus = {
|
|
240
|
+
/** Whether the connected agent advertised ACP session fork support. */
|
|
241
|
+
forkSupported?: boolean;
|
|
242
|
+
/** Most recent host request id admitted for a prompt on this session. */
|
|
243
|
+
lastRequestId?: string;
|
|
244
|
+
summary?: string;
|
|
245
|
+
acpxRecordId?: string;
|
|
246
|
+
backendSessionId?: string;
|
|
247
|
+
agentSessionId?: string;
|
|
248
|
+
models?: AcpRuntimeSessionModels;
|
|
249
|
+
/**
|
|
250
|
+
* Session modes the agent advertised, plus the current one. Parsed from
|
|
251
|
+
* the persisted record's config options / current_mode_id; absent when
|
|
252
|
+
* the agent never advertised a mode select (mode-less agents).
|
|
253
|
+
*/
|
|
254
|
+
modes?: AcpRuntimeSessionModes;
|
|
255
|
+
/**
|
|
256
|
+
* Normalized session config options the agent advertised (model, reasoning
|
|
257
|
+
* effort, …). The "mode" select is surfaced via `modes` instead and omitted
|
|
258
|
+
* here. Absent when the agent advertised no non-mode config options.
|
|
259
|
+
*/
|
|
260
|
+
configOptions?: AcpRuntimeConfigOption[];
|
|
261
|
+
/** Token usage and cost from the persisted session record. */
|
|
262
|
+
usage?: AcpRuntimeSessionUsage;
|
|
263
|
+
/**
|
|
264
|
+
* Commands the agent advertised via `available_commands_update`.
|
|
265
|
+
* Sourced from the persisted record — older session files only
|
|
266
|
+
* preserve `name`, so `description` and `hasInput` may be undefined
|
|
267
|
+
* even when a more recent live event would have carried both.
|
|
268
|
+
*/
|
|
269
|
+
availableCommands?: AcpRuntimeAvailableCommand[];
|
|
270
|
+
details?: Record<string, unknown>;
|
|
271
|
+
};
|
|
272
|
+
type AcpRuntimeDoctorReport = {
|
|
273
|
+
ok: boolean;
|
|
274
|
+
code?: string;
|
|
275
|
+
message: string;
|
|
276
|
+
installCommand?: string;
|
|
277
|
+
details?: string[];
|
|
278
|
+
};
|
|
279
|
+
/**
|
|
280
|
+
* Fail-closed origin metadata on `text_delta` events.
|
|
281
|
+
* Only these optional string fields are preserved from ACP wire `_meta`.
|
|
282
|
+
*/
|
|
283
|
+
type AcpTextDeltaOriginMeta = {
|
|
284
|
+
origin?: string;
|
|
285
|
+
kind?: string;
|
|
286
|
+
source?: string;
|
|
287
|
+
};
|
|
288
|
+
type AcpRuntimeEvent = {
|
|
289
|
+
type: "text_delta";
|
|
290
|
+
text: string;
|
|
291
|
+
stream?: "output" | "thought";
|
|
292
|
+
tag?: AcpSessionUpdateTag;
|
|
293
|
+
/**
|
|
294
|
+
* The adapter's per-turn id (grok's `_meta.promptId`). Main-agent and
|
|
295
|
+
* subagent turns carry different ids, so consumers can isolate
|
|
296
|
+
* subagent text from the main feed.
|
|
297
|
+
*/
|
|
298
|
+
agentTurnId?: string;
|
|
299
|
+
/**
|
|
300
|
+
* Present when the originating ACP session update carried a non-empty
|
|
301
|
+
* `messageId`. Absent when the wire payload had no id.
|
|
302
|
+
* Opaque producer-supplied routing hint only: ACPX does not authenticate
|
|
303
|
+
* this value. Do not treat it as proof of authorship or as an
|
|
304
|
+
* authorization boundary. Useful for correlating chunks from the same
|
|
305
|
+
* producer message when the adapter includes an id.
|
|
306
|
+
*/
|
|
307
|
+
messageId?: string;
|
|
308
|
+
/**
|
|
309
|
+
* Allowlisted origin fields from the ACP update `_meta`.
|
|
310
|
+
* Only the documented string keys `origin`, `kind`, and `source` are
|
|
311
|
+
* preserved. All other keys (including nested objects and secret-like
|
|
312
|
+
* producer-controlled names) are dropped. Omitted when none remain.
|
|
313
|
+
* These values are opaque producer-supplied routing hints, not
|
|
314
|
+
* authenticated authorship or provenance. Consumers must not use them
|
|
315
|
+
* as an authorization boundary.
|
|
316
|
+
*/
|
|
317
|
+
meta?: AcpTextDeltaOriginMeta;
|
|
318
|
+
} | {
|
|
319
|
+
type: "status";
|
|
320
|
+
text: string;
|
|
321
|
+
tag?: AcpSessionUpdateTag;
|
|
322
|
+
used?: number;
|
|
323
|
+
size?: number;
|
|
324
|
+
/** Populated on `usage_update` events when the agent reported a cost. */
|
|
325
|
+
cost?: AcpRuntimeUsageCost;
|
|
326
|
+
/**
|
|
327
|
+
* Populated on `usage_update` events when the agent attached a
|
|
328
|
+
* per-turn breakdown via `_meta.usage` (Claude Code does this; not
|
|
329
|
+
* every adapter does).
|
|
330
|
+
*/
|
|
331
|
+
breakdown?: AcpRuntimeUsageBreakdown;
|
|
332
|
+
/**
|
|
333
|
+
* Populated on `available_commands_update` events. The list is a
|
|
334
|
+
* normalized view of the wire payload — names, descriptions, and
|
|
335
|
+
* a `hasInput` flag derived from whether the agent advertised a
|
|
336
|
+
* non-null `input` schema.
|
|
337
|
+
*/
|
|
338
|
+
availableCommands?: AcpRuntimeAvailableCommand[];
|
|
339
|
+
/**
|
|
340
|
+
* Populated on `current_mode_update` events: the mode the agent
|
|
341
|
+
* switched to (e.g. plan → default after ExitPlanMode). Consumers
|
|
342
|
+
* that mirror mode state should treat this as authoritative.
|
|
343
|
+
*/
|
|
344
|
+
currentModeId?: string;
|
|
345
|
+
/**
|
|
346
|
+
* Normalized entries on `plan` events; malformed entries are skipped.
|
|
347
|
+
* Replace the displayed plan when present, including clearing it for [].
|
|
348
|
+
*/
|
|
349
|
+
entries?: AcpRuntimePlanEntry[];
|
|
350
|
+
/** Compatibility alias for entries */
|
|
351
|
+
planEntries?: AcpRuntimePlanEntry[];
|
|
352
|
+
} | {
|
|
353
|
+
type: "background_task";
|
|
354
|
+
tasks?: AcpRuntimeBackgroundTask[];
|
|
355
|
+
} | {
|
|
356
|
+
type: "tool_call";
|
|
357
|
+
text: string;
|
|
358
|
+
tag?: AcpSessionUpdateTag;
|
|
359
|
+
toolCallId?: string;
|
|
360
|
+
status?: string;
|
|
361
|
+
title?: string;
|
|
362
|
+
kind?: ToolKind;
|
|
363
|
+
locations?: ToolCallLocation[];
|
|
364
|
+
rawInput?: unknown;
|
|
365
|
+
rawOutput?: unknown;
|
|
366
|
+
content?: ToolCallContent[];
|
|
367
|
+
toolName?: string;
|
|
368
|
+
/**
|
|
369
|
+
* The adapter's per-turn id (grok's `_meta.promptId`). Subagent tool
|
|
370
|
+
* calls carry the subagent turn's id, letting consumers fold them into
|
|
371
|
+
* the subagent's card instead of the main assistant message.
|
|
372
|
+
*/
|
|
373
|
+
agentTurnId?: string;
|
|
374
|
+
} |
|
|
375
|
+
/**
|
|
376
|
+
* Compatibility terminal event emitted by runTurn(...). startTurn(...).events
|
|
377
|
+
* does not emit terminal events; use AcpRuntimeTurn.result instead.
|
|
378
|
+
*/
|
|
379
|
+
{
|
|
380
|
+
type: "done";
|
|
381
|
+
stopReason?: string;
|
|
382
|
+
_meta?: Record<string, unknown> | null;
|
|
383
|
+
} |
|
|
384
|
+
/**
|
|
385
|
+
* Compatibility failure event emitted by runTurn(...). startTurn(...).events
|
|
386
|
+
* does not emit terminal events; use AcpRuntimeTurn.result instead.
|
|
387
|
+
*/
|
|
388
|
+
{
|
|
389
|
+
type: "error";
|
|
390
|
+
message: string;
|
|
391
|
+
code?: string;
|
|
392
|
+
detailCode?: string;
|
|
393
|
+
retryable?: boolean;
|
|
394
|
+
};
|
|
395
|
+
type AcpRuntimeTurnResultError = {
|
|
396
|
+
message: string;
|
|
397
|
+
code?: string;
|
|
398
|
+
detailCode?: string;
|
|
399
|
+
retryable?: boolean;
|
|
400
|
+
};
|
|
401
|
+
type AcpRuntimeTurnResult = {
|
|
402
|
+
status: "completed";
|
|
403
|
+
stopReason?: string;
|
|
404
|
+
finalAnswer?: string;
|
|
405
|
+
promptMessageId?: string;
|
|
406
|
+
runtimeRequestId?: string;
|
|
407
|
+
_meta?: Record<string, unknown> | null;
|
|
408
|
+
} | {
|
|
409
|
+
status: "cancelled";
|
|
410
|
+
stopReason?: string;
|
|
411
|
+
finalAnswer?: string;
|
|
412
|
+
promptMessageId?: string;
|
|
413
|
+
runtimeRequestId?: string;
|
|
414
|
+
_meta?: Record<string, unknown> | null;
|
|
415
|
+
} | {
|
|
416
|
+
status: "failed";
|
|
417
|
+
error: AcpRuntimeTurnResultError;
|
|
418
|
+
promptMessageId?: string;
|
|
419
|
+
runtimeRequestId?: string;
|
|
420
|
+
};
|
|
421
|
+
interface AcpRuntimeTurn {
|
|
422
|
+
readonly requestId: string;
|
|
423
|
+
/** Resolves after the underlying writable transport accepts the prompt request. */
|
|
424
|
+
readonly promptStarted: Promise<void>;
|
|
425
|
+
readonly events: AsyncIterable<AcpRuntimeEvent>;
|
|
426
|
+
/**
|
|
427
|
+
* Canonical completion signal for the turn. Resolves only after final record
|
|
428
|
+
* checkpoint/persistence and runtime client pooling or close cleanup attempts
|
|
429
|
+
* have settled.
|
|
430
|
+
*/
|
|
431
|
+
readonly result: Promise<AcpRuntimeTurnResult>;
|
|
432
|
+
cancel(input?: {
|
|
433
|
+
reason?: string;
|
|
434
|
+
}): Promise<void>;
|
|
435
|
+
closeStream(input?: {
|
|
436
|
+
reason?: string;
|
|
437
|
+
}): Promise<void>;
|
|
438
|
+
}
|
|
439
|
+
interface AcpRuntime {
|
|
440
|
+
/** Passively replays and follows recorded turns when the backend supports a shared journal. */
|
|
441
|
+
watchSession?(input: {
|
|
442
|
+
handle: AcpRuntimeHandle;
|
|
443
|
+
cursor?: string;
|
|
444
|
+
signal?: AbortSignal;
|
|
445
|
+
}): AsyncIterable<SessionWatchEvent>;
|
|
446
|
+
/** Stops owned connections and joins admitted work; stored sessions remain resumable. */
|
|
447
|
+
shutdown?(): Promise<void>;
|
|
448
|
+
/** Finds a persistent session handle without starting or reconnecting an agent. */
|
|
449
|
+
findSession?(input: {
|
|
450
|
+
sessionKey: string;
|
|
451
|
+
agent: string;
|
|
452
|
+
}): Promise<AcpRuntimeHandle | undefined>;
|
|
453
|
+
ensureSession(input: AcpRuntimeEnsureInput): Promise<AcpRuntimeHandle>;
|
|
454
|
+
/**
|
|
455
|
+
* Rebind a persistent runtime session to its final host-owned session key.
|
|
456
|
+
* Intended for sessions created under a temporary pre-warm key before the
|
|
457
|
+
* host session id exists.
|
|
458
|
+
*/
|
|
459
|
+
adoptSession?(input: {
|
|
460
|
+
handle: AcpRuntimeHandle;
|
|
461
|
+
sessionKey: string;
|
|
462
|
+
}): Promise<AcpRuntimeHandle>;
|
|
463
|
+
logoutSession?(input: {
|
|
464
|
+
handle: AcpRuntimeHandle;
|
|
465
|
+
}): Promise<void>;
|
|
466
|
+
authenticateSession?(input: {
|
|
467
|
+
handle: AcpRuntimeHandle;
|
|
468
|
+
methodId: string;
|
|
469
|
+
credentials?: Record<string, string>;
|
|
470
|
+
}): Promise<void>;
|
|
471
|
+
forkSession?(input: {
|
|
472
|
+
handle: AcpRuntimeHandle;
|
|
473
|
+
cwd?: string;
|
|
474
|
+
}): Promise<{
|
|
475
|
+
sessionId: string;
|
|
476
|
+
agentSessionId?: string;
|
|
477
|
+
}>;
|
|
478
|
+
deleteSession?(input: {
|
|
479
|
+
handle: AcpRuntimeHandle;
|
|
480
|
+
sessionId: string;
|
|
481
|
+
}): Promise<void>;
|
|
482
|
+
startTurn(input: AcpRuntimeTurnInput): AcpRuntimeTurn;
|
|
483
|
+
/**
|
|
484
|
+
* Compatibility adapter for consumers that expect terminal status in the
|
|
485
|
+
* event stream. Prefer startTurn(...), which separates live events from the
|
|
486
|
+
* terminal result.
|
|
487
|
+
*/
|
|
488
|
+
runTurn(input: AcpRuntimeTurnInput): AsyncIterable<AcpRuntimeEvent>;
|
|
489
|
+
getCapabilities?(input: {
|
|
490
|
+
handle?: AcpRuntimeHandle;
|
|
491
|
+
}): Promise<AcpRuntimeCapabilities> | AcpRuntimeCapabilities;
|
|
492
|
+
getStatus?(input: {
|
|
493
|
+
handle: AcpRuntimeHandle;
|
|
494
|
+
signal?: AbortSignal;
|
|
495
|
+
}): Promise<AcpRuntimeStatus>;
|
|
496
|
+
/** Authority gates dispatch; an issued control still settles its response and saved state. */
|
|
497
|
+
setMode?(input: AcpControlAuthority & {
|
|
498
|
+
handle: AcpRuntimeHandle;
|
|
499
|
+
mode: string;
|
|
500
|
+
}): Promise<void>;
|
|
501
|
+
setModel?(input: AcpControlAuthority & {
|
|
502
|
+
handle: AcpRuntimeHandle;
|
|
503
|
+
model: string;
|
|
504
|
+
}): Promise<void>;
|
|
505
|
+
setConfigOption?(input: AcpControlAuthority & {
|
|
506
|
+
handle: AcpRuntimeHandle;
|
|
507
|
+
key: string;
|
|
508
|
+
value: string;
|
|
509
|
+
}): Promise<SetSessionConfigOptionResponse | void>;
|
|
510
|
+
doctor?(): Promise<AcpRuntimeDoctorReport>;
|
|
511
|
+
cancel(input: {
|
|
512
|
+
handle: AcpRuntimeHandle;
|
|
513
|
+
reason?: string;
|
|
514
|
+
}): Promise<void>;
|
|
515
|
+
/** Locally closes the session and persists fresh creation on the next ensure without resumeSessionId. */
|
|
516
|
+
prepareFreshSession?(input: {
|
|
517
|
+
handle: AcpRuntimeHandle;
|
|
518
|
+
}): Promise<void>;
|
|
519
|
+
close(input: {
|
|
520
|
+
handle: AcpRuntimeHandle;
|
|
521
|
+
reason: string;
|
|
522
|
+
discardPersistentState?: boolean;
|
|
523
|
+
}): Promise<void>;
|
|
524
|
+
}
|
|
525
|
+
type AcpSessionRecord = SessionRecord;
|
|
526
|
+
interface AcpSessionStore {
|
|
527
|
+
load(sessionId: string): Promise<AcpSessionRecord | undefined>;
|
|
528
|
+
save(record: AcpSessionRecord): Promise<void>;
|
|
529
|
+
/**
|
|
530
|
+
* Persist `record` under its new acpxRecordId without overwriting an
|
|
531
|
+
* existing target, then remove the source record.
|
|
532
|
+
*/
|
|
533
|
+
rebind?(sourceSessionId: string, record: AcpSessionRecord): Promise<void>;
|
|
534
|
+
}
|
|
535
|
+
type AcpRuntimeSessionContext = {
|
|
536
|
+
sessionKey: string;
|
|
537
|
+
cwd: string;
|
|
538
|
+
agentCommand: string;
|
|
539
|
+
agentArgv?: string[];
|
|
540
|
+
};
|
|
541
|
+
type AcpRuntimeSessionPermissions = Partial<Pick<AcpRuntimeOptions, "permissionMode" | "nonInteractivePermissions" | "permissionPolicy" | "onPermissionRequest">>;
|
|
542
|
+
type AcpRuntimeOptions = {
|
|
543
|
+
cwd: string;
|
|
544
|
+
/** Trusted child-only environment, snapshotted at construction and never persisted. */
|
|
545
|
+
agentProcessEnv?: Record<string, string>;
|
|
546
|
+
sessionStore: AcpSessionStore;
|
|
547
|
+
agentRegistry: AcpAgentRegistry;
|
|
548
|
+
/**
|
|
549
|
+
* Servers for new and reconnected session clients. A resolver runs at connection
|
|
550
|
+
* creation with the session's stored identity; its result is never persisted.
|
|
551
|
+
* Retained connections keep their original servers. Initialization-only health
|
|
552
|
+
* probes do not call the resolver.
|
|
553
|
+
*/
|
|
554
|
+
mcpServers?: McpServer$1[] | ((session: AcpRuntimeSessionContext) => McpServer$1[]);
|
|
555
|
+
/**
|
|
556
|
+
* Client permissions for new and reconnected sessions, resolved from stored
|
|
557
|
+
* identity. Unspecified fields inherit runtime defaults. Retained clients keep
|
|
558
|
+
* their original policy; health probes do not call this resolver. Neither the
|
|
559
|
+
* policy nor its callback is persisted.
|
|
560
|
+
*/
|
|
561
|
+
sessionPermissions?: (session: AcpRuntimeSessionContext) => AcpRuntimeSessionPermissions | undefined;
|
|
562
|
+
permissionMode: PermissionMode;
|
|
563
|
+
nonInteractivePermissions?: NonInteractivePermissionPolicy;
|
|
564
|
+
permissionPolicy?: PermissionPolicy;
|
|
565
|
+
timeoutMs?: number;
|
|
566
|
+
probeAgent?: string;
|
|
567
|
+
verbose?: boolean;
|
|
568
|
+
/** ACP elicitation modes the embedding host can render for prompt turns. */
|
|
569
|
+
elicitationModes?: readonly AcpElicitationMode[];
|
|
570
|
+
/** Optional lifecycle observer for ACP agent processes owned by this runtime. */
|
|
571
|
+
processLifecycle?: AcpProcessLifecycle;
|
|
572
|
+
onPermissionRequest?: AcpPermissionHandler;
|
|
573
|
+
/**
|
|
574
|
+
* Host-driven handler for Grok Build's `_x.ai/ask_user_question` extension.
|
|
575
|
+
* Used by bridge-server to surface the questionnaire over WebSocket.
|
|
576
|
+
*/
|
|
577
|
+
onAskUserQuestion?: (req: GrokAskUserQuestionRequest, ctx: {
|
|
578
|
+
signal: AbortSignal;
|
|
579
|
+
}) => Promise<GrokAskUserQuestionResponse | GrokAskUserAnswers | undefined>;
|
|
580
|
+
/**
|
|
581
|
+
* Host-driven handler for Grok Build's `_x.ai/exit_plan_mode` extension.
|
|
582
|
+
* Used by bridge-server to surface plan approval over WebSocket.
|
|
583
|
+
*/
|
|
584
|
+
onExitPlanMode?: (req: GrokExitPlanModeRequest, ctx: {
|
|
585
|
+
signal: AbortSignal;
|
|
586
|
+
}) => Promise<GrokExitPlanModeResponse | GrokExitPlanOutcome | undefined>;
|
|
587
|
+
/**
|
|
588
|
+
* Fired after an OUT-OF-TURN session notification (one received while no
|
|
589
|
+
* runtime turn is active) has been folded into the persisted record. Lets a
|
|
590
|
+
* host refresh history or capabilities without waiting for the next
|
|
591
|
+
* turn/reconnect.
|
|
592
|
+
* `sessionKey` is the ensureSession key (the persistent record id).
|
|
593
|
+
* `update` carries the full session/update payload when the host needs the
|
|
594
|
+
* data itself (e.g. live background-task snapshots), not just the tag.
|
|
595
|
+
*/
|
|
596
|
+
onOutOfTurnSessionUpdate?: (sessionKey: string, updateTag: AcpSessionUpdateTag, update?: Record<string, unknown>) => void;
|
|
597
|
+
/**
|
|
598
|
+
* ACP filesystem callback capability for new and reconnected session clients.
|
|
599
|
+
* Omitted defaults to enabled, matching `AcpClientOptions`. Retained clients
|
|
600
|
+
* keep their original capability. Health probes disable filesystem callbacks
|
|
601
|
+
* and ignore this option. Disabling is a protocol callback policy, not an OS
|
|
602
|
+
* sandbox for the agent's own filesystem access. The setting is not persisted.
|
|
603
|
+
*/
|
|
604
|
+
fs?: boolean;
|
|
605
|
+
/**
|
|
606
|
+
* ACP terminal callback capability for new and reconnected session clients.
|
|
607
|
+
* Omitted defaults to enabled, matching `AcpClientOptions`. Retained clients
|
|
608
|
+
* keep their original capability. Health probes disable terminal callbacks
|
|
609
|
+
* and ignore this option. Disabling is a protocol callback policy, not an OS
|
|
610
|
+
* sandbox for the agent's own process access. The setting is not persisted.
|
|
611
|
+
*/
|
|
612
|
+
terminal?: boolean;
|
|
613
|
+
};
|
|
614
|
+
type AcpFileSessionStoreOptions = {
|
|
615
|
+
stateDir: string;
|
|
616
|
+
};
|
|
617
|
+
//#endregion
|
|
618
|
+
//#region src/runtime/public/probe.d.ts
|
|
619
|
+
type RuntimeHealthReport = {
|
|
620
|
+
ok: boolean;
|
|
621
|
+
message: string;
|
|
622
|
+
details?: string[];
|
|
623
|
+
};
|
|
624
|
+
type InspectAgentModelsOptions = {
|
|
625
|
+
agentCommand: string[];
|
|
626
|
+
cwd: string;
|
|
627
|
+
signal?: AbortSignal;
|
|
628
|
+
/** Positive startup/session discovery deadline; defaults to 120 seconds. Cleanup is awaited. */
|
|
629
|
+
timeoutMs?: number;
|
|
630
|
+
/** Trusted child-only environment overlay; never persisted. */
|
|
631
|
+
agentProcessEnv?: Record<string, string>;
|
|
632
|
+
};
|
|
633
|
+
/**
|
|
634
|
+
* Inspect session model metadata without a runtime store or prompt. The agent
|
|
635
|
+
* may create native session history; only its owned transport is closed.
|
|
636
|
+
*/
|
|
637
|
+
export declare function inspectAgentModels(options: InspectAgentModelsOptions): Promise<AcpRuntimeSessionModels | undefined>;
|
|
638
|
+
//#endregion
|
|
639
|
+
//#region src/runtime/engine/turn.d.ts
|
|
640
|
+
type Deferred<T> = {
|
|
641
|
+
promise: Promise<T>;
|
|
642
|
+
resolve: (value: T) => void;
|
|
643
|
+
reject: (error: unknown) => void;
|
|
644
|
+
};
|
|
645
|
+
declare class AsyncEventQueue {
|
|
646
|
+
private readonly items;
|
|
647
|
+
private readonly waits;
|
|
648
|
+
private closed;
|
|
649
|
+
push(item: AcpRuntimeEvent): void;
|
|
650
|
+
close(): void;
|
|
651
|
+
clear(): void;
|
|
652
|
+
next(): Promise<AcpRuntimeEvent | null>;
|
|
653
|
+
iterate(): AsyncIterable<AcpRuntimeEvent>;
|
|
654
|
+
}
|
|
655
|
+
//#endregion
|
|
656
|
+
//#region src/runtime/engine/manager.d.ts
|
|
657
|
+
type AcpRuntimeManagerDeps = {
|
|
658
|
+
clientFactory?: (options: ConstructorParameters<typeof AcpClient>[0]) => AcpClient;
|
|
659
|
+
};
|
|
660
|
+
type ActiveSessionController = {
|
|
661
|
+
hasActivePrompt: () => boolean;
|
|
662
|
+
requestCancelActivePrompt: () => Promise<boolean>;
|
|
663
|
+
setSessionMode: (modeId: string, authority?: AcpControlAuthority) => Promise<void>;
|
|
664
|
+
setSessionModel: (modelId: string, authority?: AcpControlAuthority) => ReturnType<AcpClient["setSessionModel"]>;
|
|
665
|
+
setSessionConfigOption: (configId: string, value: string, authority?: AcpControlAuthority) => ReturnType<AcpClient["setSessionConfigOption"]>;
|
|
666
|
+
setResolvedSessionConfigOption: (configId: string, value: string, authority?: AcpControlAuthority) => Promise<{
|
|
667
|
+
configId: string;
|
|
668
|
+
response: Awaited<ReturnType<AcpClient["setSessionConfigOption"]>>;
|
|
669
|
+
}>;
|
|
670
|
+
};
|
|
671
|
+
type RuntimeEnsureInput = {
|
|
672
|
+
sessionKey: string;
|
|
673
|
+
agent: string;
|
|
674
|
+
mode: "persistent" | "oneshot";
|
|
675
|
+
cwd?: string;
|
|
676
|
+
resumeSessionId?: string;
|
|
677
|
+
sessionOptions?: SessionAgentOptions;
|
|
678
|
+
agentArgv?: string[];
|
|
679
|
+
authCredentials?: Record<string, string>;
|
|
680
|
+
};
|
|
681
|
+
type RuntimeTurnTaskState = {
|
|
682
|
+
pendingCancel: boolean;
|
|
683
|
+
turnActive: boolean;
|
|
684
|
+
activeController: ActiveSessionController | null;
|
|
685
|
+
};
|
|
686
|
+
type RuntimeTurnTask = {
|
|
687
|
+
input: AcpRuntimeTurnInput & {
|
|
688
|
+
sessionMode: "persistent" | "oneshot";
|
|
689
|
+
};
|
|
690
|
+
promptInput: PromptInput | string;
|
|
691
|
+
queue: AsyncEventQueue;
|
|
692
|
+
promptStarted: Deferred<void>;
|
|
693
|
+
sessionReady: Deferred<void>;
|
|
694
|
+
state: RuntimeTurnTaskState;
|
|
695
|
+
settleResult: (next: AcpRuntimeTurnResult) => void;
|
|
696
|
+
abortHandler: () => void;
|
|
697
|
+
};
|
|
698
|
+
declare class AcpRuntimeManager {
|
|
699
|
+
private readonly options;
|
|
700
|
+
private readonly deps;
|
|
701
|
+
private readonly activeControllers;
|
|
702
|
+
private readonly controlSessionRecords;
|
|
703
|
+
private readonly retainedSessionOwners;
|
|
704
|
+
private readonly retiringSessionOwners;
|
|
705
|
+
private readonly pendingOneShotRecordIds;
|
|
706
|
+
private readonly ensureSessionLocks;
|
|
707
|
+
private readonly runtimeOperationLocks;
|
|
708
|
+
private readonly sessionTasks;
|
|
709
|
+
private readonly closingActiveRecords;
|
|
710
|
+
private readonly transientCredentials;
|
|
711
|
+
private readonly liveClients;
|
|
712
|
+
private readonly pendingTasks;
|
|
713
|
+
private shuttingDown;
|
|
714
|
+
private shutdownTask?;
|
|
715
|
+
constructor(options: AcpRuntimeOptions, deps?: AcpRuntimeManagerDeps);
|
|
716
|
+
private setTransientCredentials;
|
|
717
|
+
private createClient;
|
|
718
|
+
probe(): Promise<RuntimeHealthReport>;
|
|
719
|
+
private assertOpen;
|
|
720
|
+
shutdown(): Promise<void>;
|
|
721
|
+
private shutdownOwnedClients;
|
|
722
|
+
private trackTask;
|
|
723
|
+
private queueSessionTask;
|
|
724
|
+
private cancelSessionTasks;
|
|
725
|
+
private closeClient;
|
|
726
|
+
private createSessionOwner;
|
|
727
|
+
private installActiveOwnerEventHandlers;
|
|
728
|
+
private installIdleOwnerEventHandlers;
|
|
729
|
+
private saveSessionOwner;
|
|
730
|
+
private routeOwnedSessionUpdate;
|
|
731
|
+
private routeOwnedClientOperation;
|
|
732
|
+
private attachIdleProjection;
|
|
733
|
+
private drainPendingSessionUpdates;
|
|
734
|
+
private flushSessionOwner;
|
|
735
|
+
private removeRetainedSessionOwner;
|
|
736
|
+
private readRetainedSessionOwner;
|
|
737
|
+
private closeRetainedSessionOwner;
|
|
738
|
+
private stopSessionOwner;
|
|
739
|
+
private retrySessionCleanup;
|
|
740
|
+
private refreshClosedState;
|
|
741
|
+
private retainPersistentSessionOwnerAfterTurn;
|
|
742
|
+
private canRetainPersistentSessionOwner;
|
|
743
|
+
private resolveMcpServers;
|
|
744
|
+
private resolveSessionPermissions;
|
|
745
|
+
private resolveClientCapabilities;
|
|
746
|
+
private withRuntimeControlSession;
|
|
747
|
+
private refreshOwnedRecordLifecycle;
|
|
748
|
+
ensureSession(input: RuntimeEnsureInput): Promise<SessionRecord>;
|
|
749
|
+
private withEnsureSessionLock;
|
|
750
|
+
private withManagerLock;
|
|
751
|
+
private serializeManagerOperation;
|
|
752
|
+
private ensureSessionWithOwnership;
|
|
753
|
+
private reuseCompatiblePersistentSession;
|
|
754
|
+
private acquireRuntimeSession;
|
|
755
|
+
private loadExistingRuntimeSession;
|
|
756
|
+
findSession(sessionKey: string): Promise<SessionRecord | undefined>;
|
|
757
|
+
private canReuseRuntimeSession;
|
|
758
|
+
private assertRuntimeSessionIdle;
|
|
759
|
+
private reuseRuntimeSession;
|
|
760
|
+
private closeConflictingPersistentSession;
|
|
761
|
+
private createOwnedRuntimeSession;
|
|
762
|
+
private prepareInitialRuntimeRecord;
|
|
763
|
+
private retainInitializedSessionOwner;
|
|
764
|
+
startTurn(input: RuntimeTurnTask["input"]): AcpRuntimeTurn;
|
|
765
|
+
private closeRetainedOneShotHandle;
|
|
766
|
+
private runRuntimeTurnTask;
|
|
767
|
+
/**
|
|
768
|
+
* Finalization itself failed (e.g. checkpoint ENOSPC); skip the terminal
|
|
769
|
+
* turn-results snapshot because that save would fail too.
|
|
770
|
+
*/
|
|
771
|
+
private finalizationFailureResult;
|
|
772
|
+
private completedRuntimeTurnResult;
|
|
773
|
+
private runRuntimePrompt;
|
|
774
|
+
private prepareRuntimeTurn;
|
|
775
|
+
private prepareRuntimeTurnWithOwnership;
|
|
776
|
+
private prepareRuntimeTurnState;
|
|
777
|
+
private acquireRuntimeTurnState;
|
|
778
|
+
private restoreBufferedSessionOwner;
|
|
779
|
+
private resolveRuntimeTurnOwner;
|
|
780
|
+
private createRunningRuntimeTurn;
|
|
781
|
+
private activateRuntimeTurn;
|
|
782
|
+
private createTurnClient;
|
|
783
|
+
private buildRuntimeTurnController;
|
|
784
|
+
private waitForRuntimeControlSession;
|
|
785
|
+
private requestRuntimeTurnCancel;
|
|
786
|
+
private setRuntimeResolvedSessionConfigOption;
|
|
787
|
+
private emitRuntimeTurnEvent;
|
|
788
|
+
private connectRuntimeTurn;
|
|
789
|
+
private connectRuntimeTurnClient;
|
|
790
|
+
private publishRuntimeTurnController;
|
|
791
|
+
private resolveRuntimeTurnReady;
|
|
792
|
+
private cancelRuntimeTurnBeforePrompt;
|
|
793
|
+
private updateCompletedRuntimeTurn;
|
|
794
|
+
private handleRuntimeTurnFailure;
|
|
795
|
+
private saveCompletedRuntimeTurn;
|
|
796
|
+
private saveTerminalRuntimeTurn;
|
|
797
|
+
private failRuntimeTurn;
|
|
798
|
+
private finalizeRuntimeTurn;
|
|
799
|
+
private discardRetainedRuntimeTurnOwner;
|
|
800
|
+
private attachFinalRuntimeProjection;
|
|
801
|
+
private closeRuntimeTurnClient;
|
|
802
|
+
private cleanupRuntimeTurn;
|
|
803
|
+
private finalizeRuntimeTurnRecord;
|
|
804
|
+
runTurn(input: RuntimeTurnTask["input"]): AsyncIterable<AcpRuntimeEvent>;
|
|
805
|
+
getStatus(handle: AcpRuntimeHandle): Promise<AcpRuntimeStatus>;
|
|
806
|
+
private readStatus;
|
|
807
|
+
setMode(handle: AcpRuntimeHandle, mode: string, sessionMode?: "persistent" | "oneshot", authority?: AcpControlAuthority): Promise<void>;
|
|
808
|
+
private setModeWithOwnership;
|
|
809
|
+
setModel(handle: AcpRuntimeHandle, model: string, sessionMode?: "persistent" | "oneshot", authority?: AcpControlAuthority): Promise<void>;
|
|
810
|
+
private setModelWithOwnership;
|
|
811
|
+
setConfigOption(handle: AcpRuntimeHandle, key: string, value: string, sessionMode?: "persistent" | "oneshot", authority?: AcpControlAuthority): Promise<SetSessionConfigOptionResponse>;
|
|
812
|
+
private setConfigOptionWithOwnership;
|
|
813
|
+
logoutSession(input: {
|
|
814
|
+
handle: AcpRuntimeHandle;
|
|
815
|
+
}): Promise<void>;
|
|
816
|
+
authenticateSession(input: {
|
|
817
|
+
handle: AcpRuntimeHandle;
|
|
818
|
+
methodId: string;
|
|
819
|
+
credentials?: Record<string, string>;
|
|
820
|
+
}): Promise<void>;
|
|
821
|
+
forkSession(input: {
|
|
822
|
+
handle: AcpRuntimeHandle;
|
|
823
|
+
cwd?: string;
|
|
824
|
+
}): Promise<{
|
|
825
|
+
sessionId: string;
|
|
826
|
+
agentSessionId?: string;
|
|
827
|
+
}>;
|
|
828
|
+
deleteSession(input: {
|
|
829
|
+
handle: AcpRuntimeHandle;
|
|
830
|
+
sessionId: string;
|
|
831
|
+
}): Promise<void>;
|
|
832
|
+
cancel(handle: AcpRuntimeHandle): Promise<void>;
|
|
833
|
+
prepareFreshSession(handle: AcpRuntimeHandle): Promise<void>;
|
|
834
|
+
close(handle: AcpRuntimeHandle, options?: {
|
|
835
|
+
discardPersistentState?: boolean;
|
|
836
|
+
}): Promise<void>;
|
|
837
|
+
private closeRuntimeSession;
|
|
838
|
+
adoptSession(input: {
|
|
839
|
+
handle: AcpRuntimeHandle;
|
|
840
|
+
sessionKey: string;
|
|
841
|
+
}): Promise<SessionRecord>;
|
|
842
|
+
private requireSessionStoreRebind;
|
|
843
|
+
private assertAdoptableSessionSource;
|
|
844
|
+
private assertAdoptionTargetAvailable;
|
|
845
|
+
private moveAdoptedManagerState;
|
|
846
|
+
private resolveRuntimeRecordForClose;
|
|
847
|
+
private markActiveRuntimeRecordClosing;
|
|
848
|
+
private closeRuntimeRecordOwnership;
|
|
849
|
+
private closeBackendSession;
|
|
850
|
+
private finalizeSessionConnection;
|
|
851
|
+
private acquireBackendCloseConnection;
|
|
852
|
+
private requestBackendSessionClose;
|
|
853
|
+
private handleBackendSessionCloseError;
|
|
854
|
+
private requireRecord;
|
|
855
|
+
}
|
|
856
|
+
//#endregion
|
|
857
|
+
//#region src/runtime/public/file-session-store.d.ts
|
|
858
|
+
export declare function createFileSessionStore(options: AcpFileSessionStoreOptions): AcpSessionStore;
|
|
859
|
+
//#endregion
|
|
860
|
+
//#region src/runtime/public/turn-journal.d.ts
|
|
861
|
+
type AcpTurnJournalStatus = "queued" | "running" | "completed" | "failed" | "cancelled";
|
|
862
|
+
type AcpTurnJournalTurn = {
|
|
863
|
+
id: string;
|
|
864
|
+
turnId: string;
|
|
865
|
+
sessionId: string;
|
|
866
|
+
clientRequestId: string;
|
|
867
|
+
status: AcpTurnJournalStatus;
|
|
868
|
+
promptText: string;
|
|
869
|
+
requestFingerprint: string;
|
|
870
|
+
agentType?: string;
|
|
871
|
+
finalAnswer?: string;
|
|
872
|
+
errorCode?: string;
|
|
873
|
+
errorText?: string;
|
|
874
|
+
runtimeRecordId?: string;
|
|
875
|
+
runtimeRequestId?: string;
|
|
876
|
+
promptMessageId?: string;
|
|
877
|
+
stopReason?: string;
|
|
878
|
+
terminalSource?: string;
|
|
879
|
+
lastEventSeq: number;
|
|
880
|
+
createdAt: string;
|
|
881
|
+
updatedAt: string;
|
|
882
|
+
startedAt?: string;
|
|
883
|
+
completedAt?: string;
|
|
884
|
+
};
|
|
885
|
+
type AcpTurnJournalSnapshot = {
|
|
886
|
+
sessionId: string;
|
|
887
|
+
sequence: number;
|
|
888
|
+
active?: AcpTurnJournalTurn;
|
|
889
|
+
queued: AcpTurnJournalTurn[];
|
|
890
|
+
turns: AcpTurnJournalTurn[];
|
|
891
|
+
};
|
|
892
|
+
type AcpTurnJournalMutation = {
|
|
893
|
+
sessionId: string;
|
|
894
|
+
turnId: string;
|
|
895
|
+
clientRequestId?: string;
|
|
896
|
+
status: AcpTurnJournalStatus;
|
|
897
|
+
promptText?: string;
|
|
898
|
+
requestFingerprint?: string;
|
|
899
|
+
agentType?: string;
|
|
900
|
+
finalAnswer?: string;
|
|
901
|
+
errorCode?: string;
|
|
902
|
+
errorText?: string;
|
|
903
|
+
runtimeRecordId?: string;
|
|
904
|
+
runtimeRequestId?: string;
|
|
905
|
+
promptMessageId?: string;
|
|
906
|
+
stopReason?: string;
|
|
907
|
+
terminalSource?: string;
|
|
908
|
+
occurredAt?: string;
|
|
909
|
+
startedAt?: string;
|
|
910
|
+
completedAt?: string;
|
|
911
|
+
};
|
|
912
|
+
type AcpTurnJournalRecordResult = {
|
|
913
|
+
turn: AcpTurnJournalTurn;
|
|
914
|
+
created: boolean;
|
|
915
|
+
changed: boolean;
|
|
916
|
+
};
|
|
917
|
+
declare class AcpTurnJournal {
|
|
918
|
+
private readonly stateDir;
|
|
919
|
+
private readonly chains;
|
|
920
|
+
constructor(options: {
|
|
921
|
+
stateDir: string;
|
|
922
|
+
});
|
|
923
|
+
private filePath;
|
|
924
|
+
private readState;
|
|
925
|
+
private withSessionLock;
|
|
926
|
+
private appendEvent;
|
|
927
|
+
record(input: AcpTurnJournalMutation): Promise<AcpTurnJournalRecordResult>;
|
|
928
|
+
snapshot(sessionId: string): Promise<AcpTurnJournalSnapshot>;
|
|
929
|
+
}
|
|
930
|
+
export declare function createTurnJournal(options: {
|
|
931
|
+
stateDir: string;
|
|
932
|
+
}): AcpTurnJournal;
|
|
933
|
+
//#endregion
|
|
934
|
+
//#region src/runtime/public/errors.d.ts
|
|
935
|
+
declare const ACP_ERROR_CODES: readonly ["ACP_BACKEND_MISSING", "ACP_BACKEND_UNAVAILABLE", "ACP_BACKEND_UNSUPPORTED_CONTROL", "ACP_DISPATCH_DISABLED", "ACP_INVALID_RUNTIME_OPTION", "ACP_SESSION_INIT_FAILED", "ACP_TURN_FAILED"];
|
|
936
|
+
type AcpRuntimeErrorCode = (typeof ACP_ERROR_CODES)[number];
|
|
937
|
+
export declare class AcpRuntimeError extends Error {
|
|
938
|
+
readonly code: AcpRuntimeErrorCode;
|
|
939
|
+
readonly cause?: unknown;
|
|
940
|
+
constructor(code: AcpRuntimeErrorCode, message: string, options?: {
|
|
941
|
+
cause?: unknown;
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
export declare function isAcpRuntimeError(value: unknown): value is AcpRuntimeError;
|
|
945
|
+
//#endregion
|
|
946
|
+
//#region src/runtime/public/shared.d.ts
|
|
947
|
+
type AcpxHandleState = {
|
|
948
|
+
name: string;
|
|
949
|
+
agent: string;
|
|
950
|
+
cwd: string;
|
|
951
|
+
mode: "persistent" | "oneshot";
|
|
952
|
+
acpxRecordId?: string;
|
|
953
|
+
backendSessionId?: string;
|
|
954
|
+
agentSessionId?: string;
|
|
955
|
+
};
|
|
956
|
+
//#endregion
|
|
957
|
+
//#region src/runtime/public/handle-state.d.ts
|
|
958
|
+
export declare function encodeAcpxRuntimeHandleState(state: AcpxHandleState): string;
|
|
959
|
+
export declare function decodeAcpxRuntimeHandleState(runtimeSessionName: string): AcpxHandleState | null;
|
|
960
|
+
//#endregion
|
|
961
|
+
//#region src/runtime/shared.d.ts
|
|
962
|
+
type SharedAcpRuntimeOptions = {
|
|
963
|
+
cwd: string;
|
|
964
|
+
agentRegistry?: AcpAgentRegistry;
|
|
965
|
+
permissionMode: PermissionMode;
|
|
966
|
+
nonInteractivePermissions?: NonInteractivePermissionPolicy;
|
|
967
|
+
permissionPolicy?: PermissionPolicy;
|
|
968
|
+
authCredentials?: Record<string, string>;
|
|
969
|
+
authPolicy?: AuthPolicy;
|
|
970
|
+
timeoutMs?: number;
|
|
971
|
+
ttlMs?: number;
|
|
972
|
+
};
|
|
973
|
+
/** A client of the CLI's local session owner. Shutdown detaches this client. */
|
|
974
|
+
export declare class SharedAcpRuntime {
|
|
975
|
+
private readonly registry;
|
|
976
|
+
private readonly options;
|
|
977
|
+
private readonly disconnect;
|
|
978
|
+
private readonly pending;
|
|
979
|
+
private readonly controlChains;
|
|
980
|
+
constructor(options: SharedAcpRuntimeOptions);
|
|
981
|
+
private assertOpen;
|
|
982
|
+
private track;
|
|
983
|
+
private sessionOptions;
|
|
984
|
+
findSession(input: {
|
|
985
|
+
sessionKey: string;
|
|
986
|
+
agent: string;
|
|
987
|
+
cwd?: string;
|
|
988
|
+
}): Promise<AcpRuntimeHandle | undefined>;
|
|
989
|
+
ensureSession(input: AcpRuntimeEnsureInput): Promise<AcpRuntimeHandle>;
|
|
990
|
+
startTurn(input: AcpRuntimeTurnInput): AcpRuntimeTurn;
|
|
991
|
+
runTurn(input: AcpRuntimeTurnInput): AsyncGenerator<AcpRuntimeEvent, void, any>;
|
|
992
|
+
getStatus(input: {
|
|
993
|
+
handle: AcpRuntimeHandle;
|
|
994
|
+
}): Promise<AcpRuntimeStatus>;
|
|
995
|
+
getCapabilities(input?: {
|
|
996
|
+
handle?: AcpRuntimeHandle;
|
|
997
|
+
}): Promise<AcpRuntimeCapabilities>;
|
|
998
|
+
/**
|
|
999
|
+
* Preserves this client's control order, including caller-side persistence
|
|
1000
|
+
* when talking to older owners. Updated owners checkpoint accepted controls
|
|
1001
|
+
* themselves; serialization here cannot coordinate other legacy callers.
|
|
1002
|
+
*/
|
|
1003
|
+
private chainControl;
|
|
1004
|
+
/**
|
|
1005
|
+
* Checks this client's authority locally, then hands the control to the
|
|
1006
|
+
* running owner. The check gates this client's dispatch only; it cannot gate
|
|
1007
|
+
* controls other clients of the same owner send, and it cannot recall a
|
|
1008
|
+
* control the owner already accepted.
|
|
1009
|
+
*/
|
|
1010
|
+
private dispatchControl;
|
|
1011
|
+
setMode(input: AcpControlAuthority & {
|
|
1012
|
+
handle: AcpRuntimeHandle;
|
|
1013
|
+
mode: string;
|
|
1014
|
+
}): Promise<void>;
|
|
1015
|
+
setModel(input: AcpControlAuthority & {
|
|
1016
|
+
handle: AcpRuntimeHandle;
|
|
1017
|
+
model: string;
|
|
1018
|
+
}): Promise<void>;
|
|
1019
|
+
setConfigOption(input: AcpControlAuthority & {
|
|
1020
|
+
handle: AcpRuntimeHandle;
|
|
1021
|
+
key: string;
|
|
1022
|
+
value: string;
|
|
1023
|
+
}): Promise<SetSessionConfigOptionResponse>;
|
|
1024
|
+
watchSession(input: {
|
|
1025
|
+
handle: AcpRuntimeHandle;
|
|
1026
|
+
cursor?: string;
|
|
1027
|
+
signal?: AbortSignal;
|
|
1028
|
+
}): AsyncIterable<SessionWatchEvent>;
|
|
1029
|
+
cancel(input: {
|
|
1030
|
+
handle: AcpRuntimeHandle;
|
|
1031
|
+
reason?: string;
|
|
1032
|
+
}): Promise<void>;
|
|
1033
|
+
close(input: {
|
|
1034
|
+
handle: AcpRuntimeHandle;
|
|
1035
|
+
reason: string;
|
|
1036
|
+
}): Promise<void>;
|
|
1037
|
+
shutdown(): Promise<void>;
|
|
1038
|
+
}
|
|
1039
|
+
export declare function createSharedAcpRuntime(options: SharedAcpRuntimeOptions): SharedAcpRuntime;
|
|
1040
|
+
//#endregion
|
|
1041
|
+
//#region src/runtime.d.ts
|
|
1042
|
+
export declare const ACPX_BACKEND_ID = "acpx";
|
|
1043
|
+
type AcpxRuntimeLike = AcpRuntime & {
|
|
1044
|
+
probeAvailability(): Promise<void>;
|
|
1045
|
+
isHealthy(): boolean;
|
|
1046
|
+
doctor(): Promise<AcpRuntimeDoctorReport>;
|
|
1047
|
+
};
|
|
1048
|
+
export declare class AcpxRuntime implements AcpxRuntimeLike {
|
|
1049
|
+
private readonly options;
|
|
1050
|
+
private readonly testOptions?;
|
|
1051
|
+
private healthy;
|
|
1052
|
+
private shutdownTask?;
|
|
1053
|
+
private readonly probeTasks;
|
|
1054
|
+
private manager;
|
|
1055
|
+
private managerPromise;
|
|
1056
|
+
constructor(options: AcpRuntimeOptions, testOptions?: {
|
|
1057
|
+
managerFactory?: (options: AcpRuntimeOptions) => AcpRuntimeManager;
|
|
1058
|
+
probeRunner?: (options: AcpRuntimeOptions) => Promise<{
|
|
1059
|
+
ok: boolean;
|
|
1060
|
+
message: string;
|
|
1061
|
+
details?: unknown[];
|
|
1062
|
+
}>;
|
|
1063
|
+
} | undefined);
|
|
1064
|
+
isHealthy(): boolean;
|
|
1065
|
+
probeAvailability(): Promise<void>;
|
|
1066
|
+
doctor(): Promise<AcpRuntimeDoctorReport>;
|
|
1067
|
+
private resolveSessionIdentity;
|
|
1068
|
+
findSession(input: {
|
|
1069
|
+
sessionKey: string;
|
|
1070
|
+
agent: string;
|
|
1071
|
+
}): Promise<AcpRuntimeHandle | undefined>;
|
|
1072
|
+
ensureSession(input: AcpRuntimeEnsureInput): Promise<AcpRuntimeHandle>;
|
|
1073
|
+
private createSessionHandle;
|
|
1074
|
+
adoptSession(input: {
|
|
1075
|
+
handle: AcpRuntimeHandle;
|
|
1076
|
+
sessionKey: string;
|
|
1077
|
+
}): Promise<AcpRuntimeHandle>;
|
|
1078
|
+
logoutSession(input: {
|
|
1079
|
+
handle: AcpRuntimeHandle;
|
|
1080
|
+
}): Promise<void>;
|
|
1081
|
+
authenticateSession(input: {
|
|
1082
|
+
handle: AcpRuntimeHandle;
|
|
1083
|
+
methodId: string;
|
|
1084
|
+
credentials?: Record<string, string>;
|
|
1085
|
+
}): Promise<void>;
|
|
1086
|
+
forkSession(input: {
|
|
1087
|
+
handle: AcpRuntimeHandle;
|
|
1088
|
+
cwd?: string;
|
|
1089
|
+
}): Promise<{
|
|
1090
|
+
sessionId: string;
|
|
1091
|
+
agentSessionId?: string;
|
|
1092
|
+
}>;
|
|
1093
|
+
deleteSession(input: {
|
|
1094
|
+
handle: AcpRuntimeHandle;
|
|
1095
|
+
sessionId: string;
|
|
1096
|
+
}): Promise<void>;
|
|
1097
|
+
startTurn(input: AcpRuntimeTurnInput): {
|
|
1098
|
+
requestId: string;
|
|
1099
|
+
readonly promptStarted: Promise<void>;
|
|
1100
|
+
events: {
|
|
1101
|
+
[Symbol.asyncIterator](): AsyncGenerator<AcpRuntimeEvent, void, any>;
|
|
1102
|
+
};
|
|
1103
|
+
readonly result: Promise<AcpRuntimeTurnResult>;
|
|
1104
|
+
cancel(inputArgs?: {
|
|
1105
|
+
reason?: string;
|
|
1106
|
+
}): Promise<void>;
|
|
1107
|
+
closeStream(inputArgs?: {
|
|
1108
|
+
reason?: string;
|
|
1109
|
+
}): Promise<void>;
|
|
1110
|
+
};
|
|
1111
|
+
runTurn(input: AcpRuntimeTurnInput): AsyncIterable<AcpRuntimeEvent>;
|
|
1112
|
+
getCapabilities(input?: {
|
|
1113
|
+
handle?: AcpRuntimeHandle;
|
|
1114
|
+
}): Promise<AcpRuntimeCapabilities>;
|
|
1115
|
+
getStatus(input: {
|
|
1116
|
+
handle: AcpRuntimeHandle;
|
|
1117
|
+
signal?: AbortSignal;
|
|
1118
|
+
}): Promise<AcpRuntimeStatus>;
|
|
1119
|
+
setMode(input: AcpControlAuthority & {
|
|
1120
|
+
handle: AcpRuntimeHandle;
|
|
1121
|
+
mode: string;
|
|
1122
|
+
}): Promise<void>;
|
|
1123
|
+
setModel(input: AcpControlAuthority & {
|
|
1124
|
+
handle: AcpRuntimeHandle;
|
|
1125
|
+
model: string;
|
|
1126
|
+
}): Promise<void>;
|
|
1127
|
+
setConfigOption(input: AcpControlAuthority & {
|
|
1128
|
+
handle: AcpRuntimeHandle;
|
|
1129
|
+
key: string;
|
|
1130
|
+
value: string;
|
|
1131
|
+
}): Promise<SetSessionConfigOptionResponse>;
|
|
1132
|
+
cancel(input: {
|
|
1133
|
+
handle: AcpRuntimeHandle;
|
|
1134
|
+
reason?: string;
|
|
1135
|
+
}): Promise<void>;
|
|
1136
|
+
prepareFreshSession(input: {
|
|
1137
|
+
handle: AcpRuntimeHandle;
|
|
1138
|
+
}): Promise<void>;
|
|
1139
|
+
close(input: {
|
|
1140
|
+
handle: AcpRuntimeHandle;
|
|
1141
|
+
reason: string;
|
|
1142
|
+
discardPersistentState?: boolean;
|
|
1143
|
+
}): Promise<void>;
|
|
1144
|
+
shutdown(): Promise<void>;
|
|
1145
|
+
private getManager;
|
|
1146
|
+
private runProbe;
|
|
1147
|
+
private resolveManagerHandle;
|
|
1148
|
+
private resolveHandleState;
|
|
1149
|
+
}
|
|
1150
|
+
export declare function createAcpRuntime(options: AcpRuntimeOptions): AcpxRuntime;
|
|
1151
|
+
export declare function createRuntimeStore(options: {
|
|
1152
|
+
stateDir: string;
|
|
1153
|
+
}): AcpSessionStore;
|
|
1154
|
+
//#endregion
|
|
1155
|
+
export { type AcpAgentInspection, type AcpAgentInspectionOptions, type AcpAgentRegistry, type AcpElicitationContext, type AcpElicitationHandler, type AcpElicitationMode, type AcpElicitationRequest, type AcpElicitationResponse, type AcpFileSessionStoreOptions, type AcpInspectableAgentRegistry, type AcpPermissionDecision, type AcpPermissionHandler, type AcpPermissionRequest, type AcpProcessExit, type AcpProcessLaunch, type AcpProcessLaunchScope, type AcpProcessLifecycle, type AcpProcessSpawnFailure, type AcpProcessStarted, type AcpRuntime, type AcpRuntimeAvailableCommand, type AcpRuntimeCapabilities, type AcpRuntimeDoctorReport, type AcpRuntimeEnsureInput, type AcpRuntimeErrorCode, type AcpRuntimeEvent, type AcpRuntimeHandle, type AcpRuntimeOptions, type AcpRuntimePlanEntry, type AcpRuntimePromptMode, type AcpRuntimeSessionContext, type AcpRuntimeSessionMode, type AcpRuntimeSessionModels, type AcpRuntimeSessionPermissions, type AcpRuntimeSessionUsage, type AcpRuntimeStatus, type AcpRuntimeTurn, type AcpRuntimeTurnAttachment, type AcpRuntimeTurnInput, type AcpRuntimeTurnResult, type AcpRuntimeTurnResultError, type AcpRuntimeUsageBreakdown, type AcpRuntimeUsageCost, type AcpSessionRecord, type AcpSessionStore, type AcpSessionUpdateTag, type AcpTextDeltaOriginMeta, type AcpTurnJournalMutation, type AcpTurnJournalRecordResult, type AcpTurnJournalSnapshot, type AcpTurnJournalStatus, type AcpTurnJournalTurn, DEFAULT_AGENT_NAME, type InspectAgentModelsOptions, type PermissionPolicy, type RequestedModelUnsupportedErrorCode, type RequestedModelUnsupportedReason, type SessionAgentOptions, type SessionWatchEvent, type SessionWatchResult, type SharedAcpRuntimeOptions, type SystemPromptOption, createAgentRegistry };
|
|
1156
|
+
//# sourceMappingURL=runtime.d.ts.map
|