@automatalabs/acp-agents 2.0.0 → 3.0.1
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 +53 -17
- package/dist/acp-client.d.ts +10 -4
- package/dist/acp-client.d.ts.map +1 -1
- package/dist/acp-client.js +11 -8
- package/dist/agent/acp-agent.d.ts +84 -26
- package/dist/agent/acp-agent.d.ts.map +1 -1
- package/dist/agent/acp-agent.js +458 -170
- package/dist/agent/errors.d.ts +12 -2
- package/dist/agent/errors.d.ts.map +1 -1
- package/dist/agent/errors.js +38 -9
- package/dist/agent/fork.d.ts +7 -5
- package/dist/agent/fork.d.ts.map +1 -1
- package/dist/agent/fork.js +7 -5
- package/dist/agent/messages.d.ts +42 -0
- package/dist/agent/messages.d.ts.map +1 -0
- package/dist/agent/messages.js +225 -0
- package/dist/agent/probe.d.ts +1 -1
- package/dist/agent/probe.d.ts.map +1 -1
- package/dist/agent/probe.js +5 -1
- package/dist/agent/queue.js +2 -2
- package/dist/agent/routing.d.ts +19 -1
- package/dist/agent/routing.d.ts.map +1 -1
- package/dist/agent/routing.js +41 -4
- package/dist/agent/stream.d.ts +21 -0
- package/dist/agent/stream.d.ts.map +1 -0
- package/dist/agent/stream.js +93 -0
- package/dist/agent/structured.d.ts +7 -3
- package/dist/agent/structured.d.ts.map +1 -1
- package/dist/agent/structured.js +24 -14
- package/dist/agent/tool-host.d.ts +34 -0
- package/dist/agent/tool-host.d.ts.map +1 -0
- package/dist/agent/tool-host.js +138 -0
- package/dist/agent/tools.d.ts +26 -0
- package/dist/agent/tools.d.ts.map +1 -0
- package/dist/agent/tools.js +62 -0
- package/dist/agent/turn.d.ts +6 -3
- package/dist/agent/turn.d.ts.map +1 -1
- package/dist/agent/turn.js +15 -67
- package/dist/agent/types.d.ts +174 -25
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/backend.d.ts +4 -3
- package/dist/backend.d.ts.map +1 -1
- package/dist/backends/codex.d.ts +2 -1
- package/dist/backends/codex.d.ts.map +1 -1
- package/dist/backends/codex.js +3 -2
- package/dist/config-catalog.d.ts +4 -0
- package/dist/config-catalog.d.ts.map +1 -1
- package/dist/config-catalog.js +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/local-mcp-host.d.ts +30 -0
- package/dist/local-mcp-host.d.ts.map +1 -0
- package/dist/local-mcp-host.js +151 -0
- package/dist/protocol-coverage.d.ts +8 -6
- package/dist/protocol-coverage.d.ts.map +1 -1
- package/dist/protocol-coverage.js +3 -2
- package/dist/registry.d.ts +3 -3
- package/dist/registry.d.ts.map +1 -1
- package/dist/runner.d.ts +5 -0
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +7 -4
- package/dist/structured-output.d.ts +18 -0
- package/dist/structured-output.d.ts.map +1 -1
- package/dist/structured-output.js +19 -1
- package/dist/structured-tool.d.ts +7 -9
- package/dist/structured-tool.d.ts.map +1 -1
- package/dist/structured-tool.js +14 -102
- package/dist/traits.d.ts +51 -0
- package/dist/traits.d.ts.map +1 -0
- package/dist/traits.js +88 -0
- package/package.json +4 -4
package/dist/agent/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { PromptResponse, SessionConfigOption, SessionModeState, StopReason, ToolCallContent, ToolCallLocation, ToolCallStatus, ToolKind, Usage } from "@agentclientprotocol/sdk";
|
|
1
|
+
import type { ContentBlock, PromptResponse, SessionConfigOption, SessionModeState, StopReason, ToolCallContent, ToolCallLocation, ToolCallStatus, ToolKind, Usage } from "@agentclientprotocol/sdk";
|
|
2
2
|
import type { AgentHistoryEntry, AgentUsage, McpServerConfig, PromptImage, SystemPromptOptions, WorkflowError } from "@automatalabs/shared-types";
|
|
3
|
-
import type {
|
|
3
|
+
import type { ContentBlock as McpContentBlock } from "@modelcontextprotocol/sdk/types.js";
|
|
4
|
+
import type { Static, TSchema } from "typebox";
|
|
4
5
|
import type { AuthStore } from "../auth/auth-store.js";
|
|
5
6
|
import type { ClientHandlers } from "../client-handlers.js";
|
|
6
7
|
import type { HarnessConfigReport, HarnessModelsView } from "../config-catalog.js";
|
|
@@ -9,38 +10,108 @@ import type { ElicitationResolver, PermissionResolver, ToolPolicy } from "../per
|
|
|
9
10
|
import type { ProviderStore } from "../provider-store.js";
|
|
10
11
|
import type { CustomBackendConfig } from "../registry.js";
|
|
11
12
|
export type { SessionConfigOption, SessionModeState };
|
|
13
|
+
/** What a function tool's `execute` receives next to its validated input. */
|
|
14
|
+
export interface AcpAgentToolContext {
|
|
15
|
+
/** The ACP session id of the agent that called the tool. */
|
|
16
|
+
readonly sessionId: string;
|
|
17
|
+
/** The agent's resolved backend id. */
|
|
18
|
+
readonly backendId: string;
|
|
19
|
+
/** The agent's `label`, when set. */
|
|
20
|
+
readonly label?: string;
|
|
21
|
+
/** The ACP `tool_call` id the backend surfaced for this call, when the SDK could correlate it:
|
|
22
|
+
* the latest not-yet-settled `tool_call` of the turn in flight whose standard `name` (or
|
|
23
|
+
* `title`) is the tool's name or ends in `__<name>` (pi's `mcp__agent_tools__<name>` alias).
|
|
24
|
+
* Best-effort — undefined when the backend surfaced none before calling. */
|
|
25
|
+
readonly toolCallId?: string;
|
|
26
|
+
/** Aborts when the agent's constructor `signal` fires, when the turn in flight is cancelled
|
|
27
|
+
* (`cancel()`, a per-call `signal`, an early `stream()` exit), when the agent closes or its
|
|
28
|
+
* process dies, and when the backend drops the HTTP request before the result was written. */
|
|
29
|
+
readonly signal: AbortSignal;
|
|
30
|
+
}
|
|
31
|
+
/** What `execute` may return: a string (one text block), MCP content blocks, or a complete
|
|
32
|
+
* `{ content, isError? }` result — `isError: true` is passed through to the agent as-is. The
|
|
33
|
+
* blocks are MCP's `ContentBlock` (`@modelcontextprotocol/sdk/types.js`: `text`, `image`,
|
|
34
|
+
* `audio`, `resource_link`, `resource`) — the `tools/call` result shape the agent receives on the
|
|
35
|
+
* wire — and NOT the ACP `ContentBlock` every other content on the AcpAgent surface uses
|
|
36
|
+
* (`prompt()` input, `AcpAgentMessage.content`, the update events). A `{ type: "text", text }`
|
|
37
|
+
* block is valid in both. */
|
|
38
|
+
export type AcpAgentToolResult = string | McpContentBlock[] | {
|
|
39
|
+
readonly content: McpContentBlock[];
|
|
40
|
+
readonly isError?: boolean;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* One client-side function tool (`AcpAgentOptions.tools`). The SDK serves it to the agent as an
|
|
44
|
+
* MCP tool on the per-agent local tool host (`agent_tools`): `name` and `description` are
|
|
45
|
+
* advertised verbatim, `inputSchema` (typebox, like the `schema` option) is advertised as its
|
|
46
|
+
* JSON Schema, and every `tools/call` is validated against it (typebox Convert + Check) before
|
|
47
|
+
* `execute` runs with the converted input. A validation failure or a thrown `execute` is returned
|
|
48
|
+
* to the agent as an `isError: true` result carrying the message, never a transport error. Use
|
|
49
|
+
* `defineTool()` to infer the input type from the schema.
|
|
50
|
+
*/
|
|
51
|
+
export interface AcpAgentToolDefinition<TInput extends TSchema = TSchema> {
|
|
52
|
+
/** `^[A-Za-z0-9_-]{1,64}$`, unique across the agent's tools (INVALID_ARGUMENT in the constructor). */
|
|
53
|
+
name: string;
|
|
54
|
+
description: string;
|
|
55
|
+
/** A typebox OBJECT schema (`Type.Object(...)`, JSON `type: "object"`): MCP `tools/call`
|
|
56
|
+
* arguments are an object, so any other top-level type is INVALID_ARGUMENT in the constructor. */
|
|
57
|
+
inputSchema: TInput;
|
|
58
|
+
execute(input: Static<TInput>, ctx: AcpAgentToolContext): Promise<AcpAgentToolResult> | AcpAgentToolResult;
|
|
59
|
+
}
|
|
12
60
|
export interface AcpAgentOptions {
|
|
13
61
|
/** ABSOLUTE path that exists and is a directory. Validated synchronously in the constructor and
|
|
14
|
-
* the statics BEFORE any process spawns (
|
|
62
|
+
* the statics BEFORE any process spawns (INVALID_ARGUMENT otherwise). Sent as the
|
|
15
63
|
* session/new|fork|resume|load `cwd`. */
|
|
16
64
|
cwd: string;
|
|
17
65
|
/** Model routing spec with the runner's grammar (`resolveModelRoute`): the first `/`-segment
|
|
18
66
|
* routes to a registered custom backend (wins) or a built-in; the remainder is the backend's
|
|
19
67
|
* model id VERBATIM and is sent as `session/set_config_option { configId: "model" }` right after
|
|
20
68
|
* the session opens. An unrouted spec (no known first segment) goes WHOLE to the default backend
|
|
21
|
-
* (`AGENTPRISM_DEFAULT_BACKEND`, else `claude`). Omitted = default backend, no model selection.
|
|
69
|
+
* (`AGENTPRISM_DEFAULT_BACKEND`, else `claude`). Omitted = default backend, no model selection.
|
|
70
|
+
* This is the model the agent STARTS on: `agent.setModel(spec)` and a per-turn
|
|
71
|
+
* `prompt(…, { model })` switch it mid-session (same backend only); `agent.model` follows. */
|
|
22
72
|
model?: string;
|
|
23
|
-
/** Session mode. Explicit ids are strict (unadvertised →
|
|
73
|
+
/** Session mode. Explicit ids are strict (unadvertised → INVALID_ARGUMENT at open).
|
|
24
74
|
* Omitted = the backend's `defaultModeId` when advertised (claude `auto`, codex `agent`,
|
|
25
75
|
* opencode `build`; pi/custom none). */
|
|
26
76
|
mode?: string;
|
|
27
77
|
/** Applied verbatim via `session/set_config_option` in ascending option-id order after model
|
|
28
|
-
* selection. `"model"` is reserved (
|
|
29
|
-
* advertised catalog fail at open with
|
|
78
|
+
* selection. `"model"` is reserved (INVALID_ARGUMENT in the constructor). Ids not in the
|
|
79
|
+
* advertised catalog fail at open with INVALID_ARGUMENT listing the advertised ids. */
|
|
30
80
|
configOptions?: Record<string, string | boolean>;
|
|
31
81
|
/** Session-level structured-output contract (typebox). Claude: `_meta.claudeCode.options.outputFormat`
|
|
32
82
|
* at session/new|resume|load|fork; Codex: `_meta.outputSchema` on every turn; OpenCode/pi/custom:
|
|
33
83
|
* the client-hosted `StructuredOutput` HTTP MCP tool injected into `mcpServers` when the agent
|
|
34
84
|
* advertises `mcpCapabilities.http`, plus the in-prompt contract. Each turn reports
|
|
35
|
-
* `structured` / `structuredError`;
|
|
85
|
+
* `structured` / `structuredError`; a repair ladder runs only when `schemaRetries` asks for one. */
|
|
36
86
|
schema?: TSchema;
|
|
87
|
+
/** Opt-in structured repair ladder: how many EXTRA turns `prompt()` may spend re-prompting the
|
|
88
|
+
* same session when a schema is active and the turn ended (`end_turn`) with `structured` absent
|
|
89
|
+
* — an integer ≥ 0 (INVALID_ARGUMENT otherwise), default 0 = exactly one turn per `prompt()`.
|
|
90
|
+
* A repair turn sends the runner's repair prompt (`repairPromptText`: the StructuredOutput-tool
|
|
91
|
+
* variant when the tool is active, else the JSON variant, with the previous attempt's
|
|
92
|
+
* `structuredError` appended) with the same turn `_meta`; the native channel (Claude session
|
|
93
|
+
* `outputFormat`, Codex per-turn `outputSchema`, the client-hosted tool) stays authoritative.
|
|
94
|
+
* Every repair turn is a real turn: events fire, `stream()` yields them, `usage` accumulates.
|
|
95
|
+
* The resolved `AcpAgentTurn` is the FINAL attempt's plus `structuredAttempts`. A turn that ended
|
|
96
|
+
* `cancelled` / `refusal` / `max_tokens` / `max_turn_requests` is never repaired. Overridable
|
|
97
|
+
* per turn (`AcpAgentPromptOptions.schemaRetries`); inherited by forks. */
|
|
98
|
+
schemaRetries?: number;
|
|
37
99
|
/** Client-provided MCP servers (stdio/http/sse/acp). Capability-gated by the connection exactly
|
|
38
100
|
* like the runner. */
|
|
39
101
|
mcpServers?: McpServerConfig[];
|
|
40
|
-
/**
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
*
|
|
102
|
+
/** Client-side function tools, served to the agent over HTTP MCP from a per-agent local host
|
|
103
|
+
* injected into `mcpServers` as `agent_tools` (`agent_tools_2`, … when a caller's server holds
|
|
104
|
+
* the name) on `session/new|resume|load|fork` and an id-only fork's reattach. Names are
|
|
105
|
+
* validated in the constructor (INVALID_ARGUMENT before any spawn); an agent that does not
|
|
106
|
+
* advertise `mcpCapabilities.http` fails the open with INVALID_ARGUMENT — tools are never
|
|
107
|
+
* silently dropped. Inherited by forks (each runs its own host); the host closes with the
|
|
108
|
+
* agent. An empty array is the same as omitting the option. */
|
|
109
|
+
tools?: AcpAgentToolDefinition[];
|
|
110
|
+
/** Headless permission auto-policy: allow/deny lists + `defaultOutcome` (default "allow").
|
|
111
|
+
* Consulted only when no `onPermissionRequest` resolver is installed. */
|
|
112
|
+
permissions?: ToolPolicy;
|
|
113
|
+
/** Session-scoped async permission resolver. When present it answers EVERY permission request
|
|
114
|
+
* (the runner's default precedence); `permissions` is the headless fallback without one. */
|
|
44
115
|
onPermissionRequest?: PermissionResolver;
|
|
45
116
|
/** Elicitation responder; its presence is what advertises `elicitation` at initialize. */
|
|
46
117
|
onElicitation?: ElicitationResolver;
|
|
@@ -50,8 +121,8 @@ export interface AcpAgentOptions {
|
|
|
50
121
|
/** Backend-neutral system prompt instructions: `replace` swaps the backend's built-in system
|
|
51
122
|
* prompt, `append` adds to it. Validated in the constructor (and `fork()` / the statics) against
|
|
52
123
|
* the routed backend's `Backend.systemPrompt` support BEFORE any process spawns — a field the
|
|
53
|
-
* backend cannot carry is
|
|
54
|
-
* carry both; OpenCode and custom backends carry neither). Sent on `session/new|resume|load`
|
|
124
|
+
* backend cannot carry is INVALID_ARGUMENT, never a silent no-op (Codex and Claude and pi
|
|
125
|
+
* carry both; OpenCode and custom backends carry neither). Sent on `session/new|resume|load|fork`
|
|
55
126
|
* and the reattach of an id-only fork in the backend's dialect: Codex `_meta.baseInstructions`
|
|
56
127
|
* / `_meta.developerInstructions`, Claude `_meta.systemPrompt` (string, or `{ append }`), pi
|
|
57
128
|
* `_meta.systemPrompt` `{ replace?, append? }`. Wins over the same key in `meta`. Inherited by
|
|
@@ -62,14 +133,14 @@ export interface AcpAgentOptions {
|
|
|
62
133
|
label?: string;
|
|
63
134
|
/** Custom backend registry merged over `AGENTPRISM_BACKENDS` exactly like
|
|
64
135
|
* `createAcpRunner({ backends })`. Read once in the constructor; malformed →
|
|
65
|
-
*
|
|
136
|
+
* INVALID_ARGUMENT. Forks inherit it and cannot override it. */
|
|
66
137
|
backends?: Record<string, CustomBackendConfig>;
|
|
67
138
|
/** Agent-lifetime abort: rejects queued work with `signal.reason`, cancels an in-flight turn,
|
|
68
139
|
* then closes. Not inherited by forks. */
|
|
69
140
|
signal?: AbortSignal;
|
|
70
|
-
/** Default true: the session log is retained across turns so `history`/`text` are
|
|
71
|
-
* and a fork can seed its child. `false` maps to `retainSessionLog: false`
|
|
72
|
-
* only the latest turn). */
|
|
141
|
+
/** Default true: the session log is retained across turns so `history`/`text`/`messages` are
|
|
142
|
+
* cumulative and a fork can seed its child. `false` maps to `retainSessionLog: false`
|
|
143
|
+
* (history/text/messages hold only the latest turn). */
|
|
73
144
|
retainHistory?: boolean;
|
|
74
145
|
/** Default true: ask the backend to emit its vendor notifications (`_claude/sdkMessage` on
|
|
75
146
|
* Claude) so they reach `on("raw_message")` and `turn.raw`. `false` skips
|
|
@@ -91,17 +162,27 @@ export interface AcpAgentPromptOptions {
|
|
|
91
162
|
/** Turn `_meta` passthrough, merged UNDER the backend's turn meta (backend keys win direct
|
|
92
163
|
* collisions, exactly like the runner's `mergeTurnMeta`). */
|
|
93
164
|
meta?: Record<string, unknown>;
|
|
165
|
+
/** Switch the model BEFORE this turn, inside the FIFO (first, ahead of `configOptions` and
|
|
166
|
+
* `mode` — open's order); STICKY for the session and reflected in `agent.model`. Same
|
|
167
|
+
* validation as `setModel()`: the fork rule (the spec must route to this agent's backend and
|
|
168
|
+
* poolKey, `"<backendId>/<model id>"`; a backend-only spec is rejected) → INVALID_ARGUMENT
|
|
169
|
+
* before anything is sent; then `session/set_config_option { configId: "model" }` with the
|
|
170
|
+
* routed remainder verbatim, a wire rejection mapping through the normal error path. */
|
|
171
|
+
model?: string;
|
|
94
172
|
/** Applied via `session/set_config_option` BEFORE this turn, inside the FIFO; STICKY for the
|
|
95
173
|
* session. Same validation as the constructor option. */
|
|
96
174
|
configOptions?: Record<string, string | boolean>;
|
|
97
175
|
/** Applied via `session/set_mode` before this turn, inside the FIFO; sticky; strict. */
|
|
98
176
|
mode?: string;
|
|
99
177
|
/** Per-turn schema override. Allowed ONLY when the backend carries the schema on the turn and
|
|
100
|
-
* does not embed it in the prompt (today: Codex). Otherwise
|
|
178
|
+
* does not embed it in the prompt (today: Codex). Otherwise INVALID_ARGUMENT naming the
|
|
101
179
|
* backend and pointing at the constructor `schema` option. */
|
|
102
180
|
schema?: TSchema;
|
|
181
|
+
/** Per-turn repair budget (integer ≥ 0; INVALID_ARGUMENT otherwise, before anything is sent);
|
|
182
|
+
* wins over the constructor's `schemaRetries` for this `prompt()` only. */
|
|
183
|
+
schemaRetries?: number;
|
|
103
184
|
/** Per-call abort: queued, or started but not yet on the wire (the lazy open, the per-turn
|
|
104
|
-
* `configOptions`/`mode`) → rejects with the reason without sending; in flight →
|
|
185
|
+
* `model`/`configOptions`/`mode`) → rejects with the reason without sending; in flight →
|
|
105
186
|
* `session/cancel`, then rejects with the reason. The one way to stop a turn `cancel()` cannot
|
|
106
187
|
* reach: `cancel()` targets only a turn whose `session/prompt` is on the wire. */
|
|
107
188
|
signal?: AbortSignal;
|
|
@@ -116,7 +197,7 @@ export interface AcpAgentCloseOptions {
|
|
|
116
197
|
keep?: boolean;
|
|
117
198
|
}
|
|
118
199
|
/** Everything a fork may override. The backend is fixed by the parent: a `model` override must
|
|
119
|
-
* route to the same backend (poolKey-equal) or
|
|
200
|
+
* route to the same backend (poolKey-equal) or INVALID_ARGUMENT. `backends`, `authStore`,
|
|
120
201
|
* `providerStore`, `clientHandlers` are inherited and not overridable. `label` defaults to
|
|
121
202
|
* `<parent label>/fork-<n>` (or `fork-<n>`); `signal` is never inherited. `cwd` defaults to the
|
|
122
203
|
* parent's; a different cwd is rejected on `cwd: "source-only"` backends (`FORK_SESSION_TRAITS`). */
|
|
@@ -166,6 +247,39 @@ export interface AcpAgentToolCall {
|
|
|
166
247
|
/** Shallow merge of every `_meta` seen for this id. */
|
|
167
248
|
readonly meta?: Record<string, unknown>;
|
|
168
249
|
}
|
|
250
|
+
/**
|
|
251
|
+
* One message of the transcript, folded from the session/update stream (`turn.messages` for a
|
|
252
|
+
* turn, `agent.messages` for the retained log). The assistant-message boundary is EXACTLY the
|
|
253
|
+
* `text` fold's: text chunks concatenate into one message until a `tool_call`, `tool_call_update`,
|
|
254
|
+
* `agent_thought_chunk`, `plan*` or `user_message_chunk` event (or a changed ACP `messageId`)
|
|
255
|
+
* marks a boundary, and the next text chunk opens a new message — so `turn.text` is the
|
|
256
|
+
* text-bearing assistant messages of the turn joined by `"\n\n"`. Tool calls attach to the
|
|
257
|
+
* assistant message in progress (a turn that starts with a tool call has a leading message with
|
|
258
|
+
* no text); thoughts lead and attach to the assistant message that receives the next assistant
|
|
259
|
+
* content (a trailing thought is a message of its own); a run of `user_message_chunk`s is one
|
|
260
|
+
* user message.
|
|
261
|
+
*/
|
|
262
|
+
export interface AcpAgentMessage {
|
|
263
|
+
readonly role: "user" | "assistant";
|
|
264
|
+
/** The ordered blocks of this message. Consecutive text chunks fold into one text block (the
|
|
265
|
+
* first chunk's fields, the concatenated text); other blocks are kept as sent. The verbatim
|
|
266
|
+
* chunks stay in `updates`. */
|
|
267
|
+
readonly content: ContentBlock[];
|
|
268
|
+
/** Assistant only: the tool calls this message issued, folded by `toolCallId` (first-seen
|
|
269
|
+
* order; a later `tool_call_update` updates the call where it lives). Empty for user messages. */
|
|
270
|
+
readonly toolCalls: readonly AcpAgentToolCall[];
|
|
271
|
+
/** Assistant only: the `agent_thought_chunk` blocks folded into this message, consecutive text
|
|
272
|
+
* chunks folded like `content`. A thought is held until the next assistant content and attaches
|
|
273
|
+
* to the message that content lands on: a text chunk (or a non-text block) after a thought
|
|
274
|
+
* OPENS a new message — a thought is a boundary — and the thought goes with it; a tool call
|
|
275
|
+
* attaches to the assistant message in progress, which may already hold text, so `text →
|
|
276
|
+
* thought → tool_call` puts the thought on the message with that text (opening a message when
|
|
277
|
+
* none is in progress). A thought followed by a user message or by the end of the turn is an
|
|
278
|
+
* assistant message of its own with no `content`. Empty for user messages. */
|
|
279
|
+
readonly thoughts: ContentBlock[];
|
|
280
|
+
/** The `receivedAt` of the first update folded into this message. */
|
|
281
|
+
readonly receivedAt: number;
|
|
282
|
+
}
|
|
169
283
|
export interface AcpAgentTurnUsage {
|
|
170
284
|
/** THIS turn's tokens: `response.usage` mapped to `AgentUsage` (every installed adapter reports
|
|
171
285
|
* the turn, not the session — `PROMPT_USAGE_SCOPES`); `cost` = the clamped delta of the
|
|
@@ -190,15 +304,23 @@ export interface AcpAgentTurn {
|
|
|
190
304
|
readonly updates: ReadonlyArray<AcpAgentUpdateRecord>;
|
|
191
305
|
/** Every `raw_message` of this turn (Claude `_claude/sdkMessage`). */
|
|
192
306
|
readonly raw: ReadonlyArray<AcpAgentRawRecord>;
|
|
193
|
-
/** tool_call ⊕ tool_call_update folded by toolCallId, first-seen order
|
|
307
|
+
/** tool_call ⊕ tool_call_update folded by toolCallId, first-seen order (the flattening of
|
|
308
|
+
* `messages[*].toolCalls`). */
|
|
194
309
|
readonly toolCalls: ReadonlyArray<AcpAgentToolCall>;
|
|
310
|
+
/** This turn's messages, folded from `updates` (`AcpAgentMessage`): the per-message view of
|
|
311
|
+
* the same chunks `text` folds, with each message's tool calls and thoughts attached. */
|
|
312
|
+
readonly messages: ReadonlyArray<AcpAgentMessage>;
|
|
195
313
|
readonly permissions: ReadonlyArray<AcpPermissionEvent>;
|
|
196
314
|
readonly elicitations: ReadonlyArray<AcpElicitationEvent>;
|
|
197
315
|
readonly usage: AcpAgentTurnUsage;
|
|
198
316
|
/** Validated (typebox Convert + Check) when a schema was active for the turn. */
|
|
199
317
|
readonly structured?: unknown;
|
|
200
|
-
/** Why `structured` is absent although a schema was active
|
|
318
|
+
/** Why `structured` is absent although a schema was active (the LAST attempt's failure when
|
|
319
|
+
* the repair ladder ran). */
|
|
201
320
|
readonly structuredError?: string;
|
|
321
|
+
/** When a schema was active: the turns this `prompt()` spent — 1 plus the repair turns the
|
|
322
|
+
* `schemaRetries` ladder actually ran (1 under the default budget of 0). Absent without a schema. */
|
|
323
|
+
readonly structuredAttempts?: number;
|
|
202
324
|
/** This turn's accumulator entries (copies). Per CHUNK, not per message: one `assistant`/`text`
|
|
203
325
|
* entry per streamed `agent_message_chunk` and one `tool`/`toolCall` entry per `tool_call`, so
|
|
204
326
|
* `history.length` is not a message count — `text` is the folded, per-message view. */
|
|
@@ -207,8 +329,8 @@ export interface AcpAgentTurn {
|
|
|
207
329
|
/** A `prompt()` rejection for a turn the agent walled with a typed session failure (codex-acp's
|
|
208
330
|
* negotiated extension): the runner's mapped `WorkflowError` (`mapTypedSessionFailure`, so codes,
|
|
209
331
|
* `recoverable` and `details` keep their tested contract) carrying the COMPLETE turn — verbatim
|
|
210
|
-
* `response` incl. `_meta`, `usage`, `updates`, `raw`, `toolCalls`, `history` — so
|
|
211
|
-
* stripped. Narrow with `isAcpAgentTurnError`. */
|
|
332
|
+
* `response` incl. `_meta`, `usage`, `updates`, `raw`, `toolCalls`, `messages`, `history` — so
|
|
333
|
+
* nothing is stripped. Narrow with `isAcpAgentTurnError`. */
|
|
212
334
|
export type AcpAgentTurnError = WorkflowError & {
|
|
213
335
|
readonly turn: AcpAgentTurn;
|
|
214
336
|
};
|
|
@@ -217,6 +339,33 @@ export type AcpAgentTurnError = WorkflowError & {
|
|
|
217
339
|
export type AcpAgentEventMap = AcpRunnerEventMap;
|
|
218
340
|
export type AcpAgentEventName = keyof AcpAgentEventMap;
|
|
219
341
|
export type AcpAgentEventListener<K extends AcpAgentEventName> = (event: AcpAgentEventMap[K]) => void;
|
|
342
|
+
/** The event names `stream()` yields: every bus event except the `session_update` catch-all (an
|
|
343
|
+
* update is yielded once, under its `sessionUpdate` kind). */
|
|
344
|
+
export type AcpAgentStreamEventName = Exclude<AcpAgentEventName, "session_update">;
|
|
345
|
+
/**
|
|
346
|
+
* One item of `agent.stream()`: a bus event of this turn tagged with its name as `type` (the
|
|
347
|
+
* payload is the same object `on(name)` delivers — an ACP update variant plus the event context,
|
|
348
|
+
* or a permission / elicitation / raw_message / steering / session_open / session_close /
|
|
349
|
+
* backend_error payload), or the terminal `{ type: "turn", turn }` carrying the `AcpAgentTurn`
|
|
350
|
+
* `prompt()` would have resolved. Narrow on `type`.
|
|
351
|
+
*/
|
|
352
|
+
export type AcpAgentStreamEvent = {
|
|
353
|
+
[K in AcpAgentStreamEventName]: {
|
|
354
|
+
readonly type: K;
|
|
355
|
+
} & AcpAgentEventMap[K];
|
|
356
|
+
}[AcpAgentStreamEventName] | {
|
|
357
|
+
readonly type: "turn";
|
|
358
|
+
readonly turn: AcpAgentTurn;
|
|
359
|
+
};
|
|
360
|
+
/** What `stream()` returns: an async iterable that is its own iterator, with `return()` and
|
|
361
|
+
* `throw()` always present (leaving early is part of the contract — both cancel the turn and
|
|
362
|
+
* resolve once it settled; `throw(error)` then rethrows `error`). */
|
|
363
|
+
export interface AcpAgentStream extends AsyncIterableIterator<AcpAgentStreamEvent> {
|
|
364
|
+
next(): Promise<IteratorResult<AcpAgentStreamEvent, undefined>>;
|
|
365
|
+
return(): Promise<IteratorResult<AcpAgentStreamEvent, undefined>>;
|
|
366
|
+
throw(error?: unknown): Promise<IteratorResult<AcpAgentStreamEvent, undefined>>;
|
|
367
|
+
[Symbol.asyncIterator](): AcpAgentStream;
|
|
368
|
+
}
|
|
220
369
|
/** `idle` (constructed, nothing spawned) → `opening` → `ready` ⇄ `busy` (a queued op is executing)
|
|
221
370
|
* → `closed` (set the instant `close()` is called, the constructor signal aborts, or the process
|
|
222
371
|
* dies). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/agent/types.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,KAAK,EACN,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EACV,iBAAiB,EACjB,UAAU,EACV,eAAe,EACf,WAAW,EACX,mBAAmB,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CHANGED
|
@@ -69,9 +69,10 @@ export interface Backend {
|
|
|
69
69
|
* unset; custom ACP backends opt in unless their registry entry disables it. */
|
|
70
70
|
readonly injectStructuredOutputTool?: boolean;
|
|
71
71
|
/** Which halves of `SystemPromptOptions` this backend can carry on its session `_meta`
|
|
72
|
-
* (`SYSTEM_PROMPT_SUPPORT` for the built-ins). Undefined = neither:
|
|
73
|
-
*
|
|
74
|
-
*
|
|
72
|
+
* (`SYSTEM_PROMPT_SUPPORT` for the built-ins). Undefined = neither: a `systemPrompt` for such a
|
|
73
|
+
* backend is rejected before a session opens — SCRIPT_VALIDATION_ERROR from the runner and
|
|
74
|
+
* `InteractiveSession`, INVALID_ARGUMENT from the AcpAgent SDK — so instructions are never
|
|
75
|
+
* silently dropped. */
|
|
75
76
|
readonly systemPrompt?: SystemPromptSupport;
|
|
76
77
|
/** OPTIONAL `initialize.clientCapabilities._meta` this backend adds: the namespaced vendor
|
|
77
78
|
* extensions THIS CLIENT implements for that agent, so the agent may turn them on. Backend-scoped
|
package/dist/backend.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../src/backend.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAElE,iGAAiG;AACjG,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D;sFACsF;AACtF,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,EAAE,M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@ -22,7 +22,8 @@ export declare class CodexBackend implements Backend {
|
|
|
22
22
|
spawnConfig(): SpawnConfig;
|
|
23
23
|
/** The fork reads bare `_meta.baseInstructions` (replaces Codex's base system prompt) and
|
|
24
24
|
* `_meta.developerInstructions` (developer-role instructions on top of it) at session/new,
|
|
25
|
-
* resume,
|
|
25
|
+
* resume, load, AND fork — a Codex fork is live (no reattach), so the `session/fork` request's
|
|
26
|
+
* own `_meta` is the only delivery and the adapter threads it into thread/fork. */
|
|
26
27
|
readonly systemPrompt: import("../protocol-coverage.js").SystemPromptSupport;
|
|
27
28
|
sessionMeta(_schema: TSchema | undefined, inputs?: SessionMetaInputs): Record<string, unknown> | undefined;
|
|
28
29
|
promptMeta(schema: TSchema | undefined): Record<string, unknown> | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../src/backends/codex.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EACV,OAAO,EACP,2BAA2B,EAC3B,qBAAqB,EACrB,iBAAiB,EACjB,WAAW,EACX,gBAAgB,EACjB,MAAM,eAAe,CAAC;AAUvB,6FAA6F;AAC7F,eAAO,MAAM,gBAAgB,EAAE,WAe9B,CAAC;AAEF,qBAAa,YAAa,YAAW,OAAO;IAI9B,QAAQ,CAAC,WAAW,EAAE,WAAW;IAH7C,QAAQ,CAAC,EAAE,EAAG,OAAO,CAAU;IAC/B,QAAQ,CAAC,aAAa,EAAG,OAAO,CAAU;gBAErB,WAAW,GAAE,WAA8B;IAEhE;;;qGAGiG;IACjG,QAAQ,CAAC,oBAAoB,oCAA2C;IAExE;;;;4EAIwE;IACxE,qBAAqB,CACnB,KAAK,EAAE,OAAO,EACd,QAAQ,CAAC,EAAE,qBAAqB,GAC/B,2BAA2B,GAAG,SAAS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 export class CodexBackend {
|
|
|
77
77
|
}
|
|
78
78
|
/** The fork reads bare `_meta.baseInstructions` (replaces Codex's base system prompt) and
|
|
79
79
|
* `_meta.developerInstructions` (developer-role instructions on top of it) at session/new,
|
|
80
|
-
* resume,
|
|
80
|
+
* resume, load, AND fork — a Codex fork is live (no reattach), so the `session/fork` request's
|
|
81
|
+
* own `_meta` is the only delivery and the adapter threads it into thread/fork. */
|
|
81
82
|
systemPrompt = systemPromptSupport("codex");
|
|
82
83
|
sessionMeta(_schema, inputs) {
|
|
83
84
|
// Codex carries the SCHEMA on the turn (see promptMeta), so nothing schema-related rides
|
|
84
85
|
// session/new. The neutral system-prompt instructions ARE session-scoped: the
|
|
85
86
|
// @automatalabs/codex-acp fork reads the bare `_meta` keys and threads them into
|
|
86
|
-
// thread/{start,resume}.{baseInstructions,developerInstructions}. Emit them only when set so
|
|
87
|
+
// thread/{start,resume,fork}.{baseInstructions,developerInstructions}. Emit them only when set so
|
|
87
88
|
// an unconfigured run sends no `_meta` at all (preserving the "Codex default" path).
|
|
88
89
|
const meta = {};
|
|
89
90
|
const systemPrompt = inputs?.systemPrompt;
|
package/dist/config-catalog.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { SessionConfigOption, SessionModeState } from "@agentclientprotocol/sdk";
|
|
2
2
|
import { type CustomBackendConfig } from "./registry.js";
|
|
3
3
|
import { type ProbedConfigOptions } from "./runner.js";
|
|
4
|
+
import type { AcpAgentTraits } from "./traits.js";
|
|
4
5
|
export interface ValidateProbeRunner {
|
|
5
6
|
probeConfigOptions(spec?: string, opts?: {
|
|
6
7
|
cwd?: string;
|
|
@@ -32,6 +33,9 @@ export interface ValidateHarnessOptions {
|
|
|
32
33
|
/** Effective advertised ACP modes; null means this backend/model supports no session modes. */
|
|
33
34
|
modes?: SessionModeState | null;
|
|
34
35
|
options?: SessionConfigOption[];
|
|
36
|
+
/** Present when probed=true and the probe runner reports it (the runner and the SDK probe always
|
|
37
|
+
* do): the backend's traits refined by the live initialize advertisements. */
|
|
38
|
+
traits?: AcpAgentTraits;
|
|
35
39
|
}
|
|
36
40
|
type SelectConfigOption = Extract<SessionConfigOption, {
|
|
37
41
|
type: "select";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-catalog.d.ts","sourceRoot":"","sources":["../src/config-catalog.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAGtF,OAAO,EAA0B,KAAK,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACjF,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"config-catalog.d.ts","sourceRoot":"","sources":["../src/config-catalog.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAGtF,OAAO,EAA0B,KAAK,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACjF,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,WAAW,mBAAmB;IAClC,kBAAkB,CAChB,IAAI,CAAC,EAAE,MAAM,EACb,IAAI,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;QAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GACnH,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAChC,2EAA2E;IAC3E,YAAY,CAAC,IAAI,MAAM,EAAE,CAAC;IAC1B,2EAA2E;IAC3E,kBAAkB,CAAC,IAAI,MAAM,EAAE,CAAC;IAChC,+DAA+D;IAC/D,gBAAgB,CAAC,IAAI,MAA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CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,oBAAoB;IACnC,uFAAuF;IACvF,SAAS,EAAE,yBAAyB,EAAE,CAAC;CACxC;AAmCD;;kFAEkF;AAClF,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,IAAI,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,GAClD,oBAAoB,CAqFtB;AAED,4FAA4F;AAC5F,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CAmChF"}
|
package/dist/config-catalog.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,9 @@ export { LoadedTurnFailedError, LoadedTurnStillRunningError, isLoadedTurnFailedE
|
|
|
15
15
|
export type { InteractiveSessionOptions, InteractiveTurn } from "./interactive.js";
|
|
16
16
|
export { AcpAgent } from "./agent/acp-agent.js";
|
|
17
17
|
export { isAcpAgentTurnError } from "./agent/errors.js";
|
|
18
|
-
export
|
|
18
|
+
export { defineTool, AGENT_TOOL_NAME_PATTERN } from "./agent/tools.js";
|
|
19
|
+
export { AGENT_TOOLS_SERVER_NAME } from "./agent/tool-host.js";
|
|
20
|
+
export type { AcpAgentOptions, AcpAgentToolDefinition, AcpAgentToolContext, AcpAgentToolResult, AcpAgentPromptOptions, AcpAgentSteerOptions, AcpAgentForkOptions, AcpAgentReopenOptions, AcpAgentCloseOptions, AcpAgentProbeOptions, AcpAgentCatalog, AcpAgentTurn, AcpAgentTurnError, AcpAgentToolCall, AcpAgentMessage, AcpAgentUpdateRecord, AcpAgentRawRecord, AcpAgentTurnUsage, AcpAgentEventMap, AcpAgentEventName, AcpAgentEventListener, AcpAgentStream, AcpAgentStreamEvent, AcpAgentStreamEventName, AcpAgentState, } from "./agent/types.js";
|
|
19
21
|
export { AGENT_METHODS, CLIENT_METHODS } from "@agentclientprotocol/sdk";
|
|
20
22
|
export type { AgentNotificationMethod, AgentNotificationParamsByMethod, AgentAuthCapabilities, AgentRequestMethod, AgentRequestParamsByMethod, AgentRequestResponsesByMethod, AuthCapabilities, AuthenticateRequest, AuthenticateResponse, AuthMethod, AuthMethodAgent, AuthMethodId, AuthMethodTerminal, DisableProviderRequest, DisableProviderResponse, CompleteElicitationNotification, ConnectMcpRequest, ConnectMcpResponse, CreateElicitationRequest, CreateElicitationResponse, DeleteSessionRequest, DeleteSessionResponse, DisconnectMcpRequest, DisconnectMcpResponse, ElicitationAcceptAction, ElicitationCapabilities, ElicitationContentValue, ElicitationFormCapabilities, ElicitationFormMode, ElicitationId, ElicitationPropertySchema, ElicitationRequestScope, ElicitationSchema, ElicitationSchemaType, ElicitationSessionScope, ElicitationUrlCapabilities, ElicitationUrlMode, ForkSessionRequest, ForkSessionResponse, ListProvidersRequest, ListProvidersResponse, ListSessionsRequest, ListSessionsResponse, LlmProtocol, LoadSessionRequest, LoadSessionResponse, LogoutCapabilities, LogoutRequest, LogoutResponse, McpConnectionId, McpServerAcp, McpServerAcpId, MessageMcpNotification, MessageMcpRequest, MessageMcpResponse, PermissionOption, PermissionOptionId, PermissionOptionKind, RequestPermissionRequest, RequestPermissionResponse, ResumeSessionRequest, ResumeSessionResponse, ProviderCurrentConfig, ProviderId, ProviderInfo, ProvidersCapabilities, SessionMode, SessionModeState, SessionConfigOption, SessionInfo, SendRequestOptions, SetProviderRequest, SetProviderResponse, } from "@agentclientprotocol/sdk";
|
|
21
23
|
export { BACKENDS_ENV, registryWithRunBackends, resolveBackendRegistry } from "./registry.js";
|
|
@@ -27,6 +29,8 @@ export type { AcpSessionOptions, PooledConnectionDeps, SteeringRequest, Steering
|
|
|
27
29
|
export { AGENT_METHOD_COVERAGE, ACP_EXTENSION_SUPPORT_MATRIX, ACP_AUTH_REQUIRED_CODE_EXCLUSIVE, AUTH_CAPABILITY_KEYS, AUTH_META_CONVENTION_KEYS, AUTH_META_MATRIX, CLIENT_METHOD_COVERAGE, CODEX_SPAWN_AUTH_ENV, HANDLED_AUTH_METHOD_TYPES, PI_ACP_PROTOCOL_CONTRACT, BUILTIN_PROTOCOL_COVERAGE, FORK_SESSION_TRAITS, FORK_SESSION_TRAIT_DEFAULT, PROMPT_USAGE_SCOPES, SYSTEM_PROMPT_SUPPORT, SYSTEM_PROMPT_UNSUPPORTED, assertAuthCapabilityShape, forkSessionTrait, promptUsageScope, systemPromptSupport, } from "./protocol-coverage.js";
|
|
28
30
|
export type { AgentMethodCoverage, AcpExtensionSupportMatrixRow, AuthMetaMatrixRow, BuiltinProtocolCoverageRow, ClientMethodCoverage, ForkSessionTraitRow, PromptUsageScopeRow, SystemPromptSupport, SystemPromptSupportRow, } from "./protocol-coverage.js";
|
|
29
31
|
export { assertSystemPromptSupported, describeSystemPromptSupport } from "./system-prompt.js";
|
|
32
|
+
export { describeBackendTraits } from "./traits.js";
|
|
33
|
+
export type { AcpAgentTraits } from "./traits.js";
|
|
30
34
|
export { adaptPromptContent, isSupportedProtocolVersion, negotiateCapabilities, unsupportedMcpServer, } from "./capabilities.js";
|
|
31
35
|
export type { NegotiatedCapabilities } from "./capabilities.js";
|
|
32
36
|
export { AcpAgentPool, resolvePoolSize } from "./pool.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,YAAY,EACV,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,aAAa,EAC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BAAoB,EACpB,kBAAkB,EAClB,UAAU,GACX,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,YAAY,EAAE,eAAe,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAEvG,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE7F,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,uBAAuB,EACvB,aAAa,GACd,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhF,OAAO,EAAE,4BAA4B,EAAE,SAAS,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAClH,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAKvD,OAAO,EACL,uCAAuC,EACvC,uBAAuB,EACvB,6BAA6B,GAC9B,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,mBAAmB,EACnB,yBAAyB,EACzB,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -23,6 +23,9 @@ export { LoadedTurnFailedError, LoadedTurnStillRunningError, isLoadedTurnFailedE
|
|
|
23
23
|
// live forks, cold reopen from a session ref, and the no-prompt catalog probe.
|
|
24
24
|
export { AcpAgent } from "./agent/acp-agent.js";
|
|
25
25
|
export { isAcpAgentTurnError } from "./agent/errors.js";
|
|
26
|
+
// Client-side function tools: the definition helper and the injected `mcpServers` entry name.
|
|
27
|
+
export { defineTool, AGENT_TOOL_NAME_PATTERN } from "./agent/tools.js";
|
|
28
|
+
export { AGENT_TOOLS_SERVER_NAME } from "./agent/tool-host.js";
|
|
26
29
|
export { AGENT_METHODS, CLIENT_METHODS } from "@agentclientprotocol/sdk";
|
|
27
30
|
// The custom-backend registry: run ANY ACP agent as an agent() target.
|
|
28
31
|
export { BACKENDS_ENV, registryWithRunBackends, resolveBackendRegistry } from "./registry.js";
|
|
@@ -32,6 +35,9 @@ export { CANCEL_NOT_HONORED_GRACE_MS, PI_CHILD_CLEANUP_DEADLINE_MS, PI_CLOSE_DEL
|
|
|
32
35
|
export { AGENT_METHOD_COVERAGE, ACP_EXTENSION_SUPPORT_MATRIX, ACP_AUTH_REQUIRED_CODE_EXCLUSIVE, AUTH_CAPABILITY_KEYS, AUTH_META_CONVENTION_KEYS, AUTH_META_MATRIX, CLIENT_METHOD_COVERAGE, CODEX_SPAWN_AUTH_ENV, HANDLED_AUTH_METHOD_TYPES, PI_ACP_PROTOCOL_CONTRACT, BUILTIN_PROTOCOL_COVERAGE, FORK_SESSION_TRAITS, FORK_SESSION_TRAIT_DEFAULT, PROMPT_USAGE_SCOPES, SYSTEM_PROMPT_SUPPORT, SYSTEM_PROMPT_UNSUPPORTED, assertAuthCapabilityShape, forkSessionTrait, promptUsageScope, systemPromptSupport, } from "./protocol-coverage.js";
|
|
33
36
|
// The one validator every front door runs on `systemPrompt` before a session opens.
|
|
34
37
|
export { assertSystemPromptSupported, describeSystemPromptSupport } from "./system-prompt.js";
|
|
38
|
+
// Per-agent traits: the tables before open, the live initialize advertisements after (`AcpAgent#traits`,
|
|
39
|
+
// `AcpAgent.traits()`, and the `traits` field of every probe result).
|
|
40
|
+
export { describeBackendTraits } from "./traits.js";
|
|
35
41
|
// ACP standard capability negotiation. Vendor initialize metadata stays raw for extension owners.
|
|
36
42
|
export { adaptPromptContent, isSupportedProtocolVersion, negotiateCapabilities, unsupportedMcpServer, } from "./capabilities.js";
|
|
37
43
|
export { AcpAgentPool, resolvePoolSize } from "./pool.js";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type IncomingMessage, type ServerResponse } from "node:http";
|
|
2
|
+
import type { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
3
|
+
export declare const LOCAL_MCP_HOST = "127.0.0.1";
|
|
4
|
+
export declare abstract class LocalMcpHttpHost {
|
|
5
|
+
private server;
|
|
6
|
+
/** The pending or settled bind of `server`, resolving with its port. */
|
|
7
|
+
private listenPromise;
|
|
8
|
+
private port;
|
|
9
|
+
private inFlightRequests;
|
|
10
|
+
private drained;
|
|
11
|
+
/** A human name for error messages (`<name> MCP server did not bind …`). */
|
|
12
|
+
protected abstract readonly hostName: string;
|
|
13
|
+
/** The MCP server that answers requests on `token`, or undefined for a 404. Called once per
|
|
14
|
+
* HTTP request; the returned server is connected to a fresh transport and closed with it. */
|
|
15
|
+
protected abstract mcpServerFor(token: string, req: IncomingMessage, res: ServerResponse): Server | undefined;
|
|
16
|
+
isListening(): boolean;
|
|
17
|
+
listeningPort(): number | undefined;
|
|
18
|
+
/** Stop listening. Idempotent; resolves once the HTTP server closed (immediately when it never
|
|
19
|
+
* bound). A close that lands while `ensureListening()` is still binding waits for that bind to
|
|
20
|
+
* settle and then closes the socket it produced — returning early would leave the socket to
|
|
21
|
+
* come up after the close with nothing left to close it (the racing `ensureListening()` sees
|
|
22
|
+
* the host closed and rejects). A peer's keep-alive socket never holds the close open: idle
|
|
23
|
+
* connections are closed at once, requests still being answered get a bounded grace to flush,
|
|
24
|
+
* then everything left is destroyed — the peer is the agent process, which is gone or going. */
|
|
25
|
+
protected closeServer(): Promise<void>;
|
|
26
|
+
protected urlFor(token: string, port: number): string;
|
|
27
|
+
protected ensureListening(): Promise<number>;
|
|
28
|
+
private handleRequest;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=local-mcp-host.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-mcp-host.d.ts","sourceRoot":"","sources":["../src/local-mcp-host.ts"],"names":[],"mappings":"AAOA,OAAa,EACX,KAAK,eAAe,EAEpB,KAAK,cAAc,EACpB,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAGxE,eAAO,MAAM,cAAc,cAAc,CAAC;AAO1C,8BAAsB,gBAAgB;IACpC,OAAO,CAAC,MAAM,CAAyB;IACvC,wEAAwE;IACxE,OAAO,CAAC,aAAa,CAA8B;IACnD,OAAO,CAAC,IAAI,CAAqB;IACjC,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO,CAAC,OAAO,CAA2B;IAE1C,4EAA4E;IAC5E,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE7C;kGAC8F;IAC9F,SAAS,CAAC,QAAQ,CAAC,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS;IAE7G,WAAW,IAAI,OAAO;IAItB,aAAa,IAAI,MAAM,GAAG,SAAS;IAInC;;;;;;qGAMiG;cACjF,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAyB5C,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;cAIrC,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC;YAsCpC,aAAa;CA6B5B"}
|