@automatalabs/acp-agents 1.2.6 → 1.3.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 +67 -3
- package/dist/acp-client.d.ts +21 -1
- package/dist/acp-client.d.ts.map +1 -1
- package/dist/acp-client.js +31 -6
- package/dist/agent/acp-agent.d.ts +141 -0
- package/dist/agent/acp-agent.d.ts.map +1 -0
- package/dist/agent/acp-agent.js +832 -0
- package/dist/agent/errors.d.ts +17 -0
- package/dist/agent/errors.d.ts.map +1 -0
- package/dist/agent/errors.js +37 -0
- package/dist/agent/events.d.ts +26 -0
- package/dist/agent/events.d.ts.map +1 -0
- package/dist/agent/events.js +165 -0
- package/dist/agent/fork.d.ts +27 -0
- package/dist/agent/fork.d.ts.map +1 -0
- package/dist/agent/fork.js +28 -0
- package/dist/agent/probe.d.ts +14 -0
- package/dist/agent/probe.d.ts.map +1 -0
- package/dist/agent/probe.js +87 -0
- package/dist/agent/process-registry.d.ts +9 -0
- package/dist/agent/process-registry.d.ts.map +1 -0
- package/dist/agent/process-registry.js +28 -0
- package/dist/agent/queue.d.ts +19 -0
- package/dist/agent/queue.d.ts.map +1 -0
- package/dist/agent/queue.js +90 -0
- package/dist/agent/routing.d.ts +27 -0
- package/dist/agent/routing.d.ts.map +1 -0
- package/dist/agent/routing.js +87 -0
- package/dist/agent/structured.d.ts +47 -0
- package/dist/agent/structured.d.ts.map +1 -0
- package/dist/agent/structured.js +90 -0
- package/dist/agent/turn.d.ts +65 -0
- package/dist/agent/turn.d.ts.map +1 -0
- package/dist/agent/turn.js +187 -0
- package/dist/agent/types.d.ts +221 -0
- package/dist/agent/types.d.ts.map +1 -0
- package/dist/agent/types.js +9 -0
- package/dist/backend.d.ts +6 -0
- package/dist/backend.d.ts.map +1 -1
- package/dist/backends/claude.d.ts +1 -0
- package/dist/backends/claude.d.ts.map +1 -1
- package/dist/backends/claude.js +6 -1
- package/dist/config-catalog.d.ts +173 -0
- package/dist/config-catalog.d.ts.map +1 -0
- package/dist/config-catalog.js +408 -0
- package/dist/index.d.ts +10 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -1
- package/dist/permissions.js +5 -0
- package/dist/protocol-coverage.d.ts +56 -0
- package/dist/protocol-coverage.d.ts.map +1 -1
- package/dist/protocol-coverage.js +52 -0
- package/dist/registry.d.ts +12 -0
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +22 -0
- package/dist/routing.d.ts +14 -0
- package/dist/routing.d.ts.map +1 -0
- package/dist/routing.js +53 -0
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +3 -64
- package/dist/session-ref.d.ts +8 -0
- package/dist/session-ref.d.ts.map +1 -0
- package/dist/session-ref.js +21 -0
- package/dist/structured-tool.d.ts +4 -0
- package/dist/structured-tool.d.ts.map +1 -1
- package/dist/structured-tool.js +5 -0
- package/package.json +5 -5
|
@@ -184,6 +184,56 @@ const ACP_EXTENSION_SUPPORT_MATRIX_ROWS = [
|
|
|
184
184
|
/** Built-in support for non-standard agent request methods. Kept separate from
|
|
185
185
|
* AGENT_METHOD_COVERAGE so a vendor extension is never counted as a standard ACP method. */
|
|
186
186
|
export const ACP_EXTENSION_SUPPORT_MATRIX = Object.freeze(ACP_EXTENSION_SUPPORT_MATRIX_ROWS.map((row) => Object.freeze(row)));
|
|
187
|
+
const FORK_SESSION_TRAIT_ROWS = [
|
|
188
|
+
{ agent: "claude", disposition: "id-only", reattach: "resume-or-load", cwd: "source-only", distProbe: "claude" },
|
|
189
|
+
{ agent: "codex", disposition: "id-only", reattach: "resume-or-load", cwd: "free", distProbe: "codex" },
|
|
190
|
+
{ agent: "opencode", disposition: "live", reattach: "none", cwd: "free" },
|
|
191
|
+
{ agent: "pi", disposition: "live", reattach: "none", cwd: "free", distProbe: "pi" },
|
|
192
|
+
];
|
|
193
|
+
/** Per-built-in `session/fork` dispositions. Pinned against the installed adapter dists by the
|
|
194
|
+
* protocol coverage suite and against the public docs by the docs-drift suite. */
|
|
195
|
+
export const FORK_SESSION_TRAITS = Object.freeze(FORK_SESSION_TRAIT_ROWS.map((row) => Object.freeze(row)));
|
|
196
|
+
/** Unknown agents: a fork response is treated as live (the ACP contract), cwd free. */
|
|
197
|
+
export const FORK_SESSION_TRAIT_DEFAULT = Object.freeze({
|
|
198
|
+
agent: "*",
|
|
199
|
+
disposition: "live",
|
|
200
|
+
reattach: "none",
|
|
201
|
+
cwd: "free",
|
|
202
|
+
});
|
|
203
|
+
/** The built-in row for `agent`, or — when `declared` is given (a custom registry entry's `fork`
|
|
204
|
+
* field, `CustomBackendConfig.fork`) — the row the declaration describes. A declaration always
|
|
205
|
+
* wins over the name: a custom entry named `claude` is a different program from the built-in and
|
|
206
|
+
* never inherits its row. An undeclared unknown agent gets `FORK_SESSION_TRAIT_DEFAULT`. */
|
|
207
|
+
export function forkSessionTrait(agent, declared) {
|
|
208
|
+
if (declared) {
|
|
209
|
+
return Object.freeze({
|
|
210
|
+
agent,
|
|
211
|
+
disposition: declared.disposition,
|
|
212
|
+
reattach: declared.disposition === "id-only" ? "resume-or-load" : "none",
|
|
213
|
+
cwd: declared.cwd ?? "free",
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
return FORK_SESSION_TRAITS.find((row) => row.agent === agent) ?? FORK_SESSION_TRAIT_DEFAULT;
|
|
217
|
+
}
|
|
218
|
+
const PROMPT_USAGE_SCOPE_ROWS = [
|
|
219
|
+
{ agent: "claude", scope: "turn", distProbe: "claude" },
|
|
220
|
+
{ agent: "codex", scope: "turn", distProbe: "codex" },
|
|
221
|
+
{ agent: "opencode", scope: "turn" },
|
|
222
|
+
{ agent: "pi", scope: "turn", distProbe: "pi" },
|
|
223
|
+
];
|
|
224
|
+
/** Per-built-in `PromptResponse.usage` scope. Pinned against the installed adapter dists so an
|
|
225
|
+
* adapter that starts reporting cumulative usage fails the build instead of silently doubling
|
|
226
|
+
* a client-side session sum. */
|
|
227
|
+
export const PROMPT_USAGE_SCOPES = Object.freeze(PROMPT_USAGE_SCOPE_ROWS.map((row) => Object.freeze(row)));
|
|
228
|
+
/** Unknown agents: the ACP-client contract (`recordPromptUsage` keeps the latest per-turn report). */
|
|
229
|
+
const PROMPT_USAGE_SCOPE_DEFAULT = Object.freeze({ agent: "*", scope: "turn" });
|
|
230
|
+
function promptUsageScopeRow(agent) {
|
|
231
|
+
return PROMPT_USAGE_SCOPES.find((row) => row.agent === agent) ?? PROMPT_USAGE_SCOPE_DEFAULT;
|
|
232
|
+
}
|
|
233
|
+
/** The usage scope `agent` reports on `session/prompt`; custom agents follow the ACP-client contract. */
|
|
234
|
+
export function promptUsageScope(agent) {
|
|
235
|
+
return promptUsageScopeRow(agent).scope;
|
|
236
|
+
}
|
|
187
237
|
function coverageRow(id, installedDistProbes) {
|
|
188
238
|
return Object.freeze({
|
|
189
239
|
clientMethods: CLIENT_METHOD_COVERAGE,
|
|
@@ -192,6 +242,8 @@ function coverageRow(id, installedDistProbes) {
|
|
|
192
242
|
extensions: Object.freeze(ACP_EXTENSION_SUPPORT_MATRIX.filter((row) => row.agent === id)),
|
|
193
243
|
installedDistProbes: Object.freeze([...installedDistProbes]),
|
|
194
244
|
liveProbes: Object.freeze([id]),
|
|
245
|
+
fork: forkSessionTrait(id),
|
|
246
|
+
promptUsage: promptUsageScopeRow(id),
|
|
195
247
|
});
|
|
196
248
|
}
|
|
197
249
|
/** Central backend dispositions. Registry tests enforce exact key and reference parity. */
|
package/dist/registry.d.ts
CHANGED
|
@@ -13,6 +13,18 @@ export interface CustomBackendConfig {
|
|
|
13
13
|
/** Enable client-hosted StructuredOutput MCP tool injection when schema runs negotiate HTTP MCP.
|
|
14
14
|
* Default true; set false for custom agents that should use only the generic prompt/_meta path. */
|
|
15
15
|
structuredOutputTool?: boolean;
|
|
16
|
+
/** How the custom agent answers `session/fork` (see `FORK_SESSION_TRAITS`). Omitted = `live` /
|
|
17
|
+
* `free`: the plain ACP contract. Entries wrapping claude-agent-acp or codex-acp MUST declare
|
|
18
|
+
* `{ disposition: "id-only" }` — a registered name is a different program from the built-in it
|
|
19
|
+
* may shadow and never inherits the built-in's row. */
|
|
20
|
+
fork?: CustomBackendForkConfig;
|
|
21
|
+
}
|
|
22
|
+
/** A custom backend's declared `session/fork` disposition — data, never probed. `id-only`: the fork
|
|
23
|
+
* response names a persisted copy that must be reopened (resume, else load) before its first turn.
|
|
24
|
+
* `live`: the fork handle is the session. `cwd` says whether the fork may re-home (default `free`). */
|
|
25
|
+
export interface CustomBackendForkConfig {
|
|
26
|
+
disposition: "id-only" | "live";
|
|
27
|
+
cwd?: "source-only" | "free";
|
|
16
28
|
}
|
|
17
29
|
/** A validated registry entry: the (lowercased) name plus its config. */
|
|
18
30
|
export interface RegisteredBackend extends CustomBackendConfig {
|
package/dist/registry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,YAAY,wBAAwB,CAAC;AAIlD,0EAA0E;AAC1E,MAAM,WAAW,mBAAmB;IAClC,4DAA4D;IAC5D,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,mFAAmF;IACnF,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B;2FACuF;IACvF,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC;wGACoG;IACpG,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,yEAAyE;AACzE,MAAM,WAAW,iBAAkB,SAAQ,mBAAmB;IAC5D,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAErE;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,CAAC,EAAE,MAAM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jB;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,eAAe,EACrB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,GACxC,eAAe,CAQjB"}
|
package/dist/registry.js
CHANGED
|
@@ -78,6 +78,10 @@ function validateEntry(rawName, config, source) {
|
|
|
78
78
|
if (c.structuredOutputTool !== undefined && typeof c.structuredOutputTool !== "boolean") {
|
|
79
79
|
throw new Error(`${source}: backend "${rawName}" "structuredOutputTool" must be a boolean`);
|
|
80
80
|
}
|
|
81
|
+
const fork = c.fork !== undefined ? validateFork(c.fork) : undefined;
|
|
82
|
+
if (c.fork !== undefined && fork === undefined) {
|
|
83
|
+
throw new Error(`${source}: backend "${rawName}" "fork" must be { disposition: "id-only" | "live", cwd?: "source-only" | "free" }`);
|
|
84
|
+
}
|
|
81
85
|
return [
|
|
82
86
|
name,
|
|
83
87
|
{
|
|
@@ -87,9 +91,27 @@ function validateEntry(rawName, config, source) {
|
|
|
87
91
|
...(c.env !== undefined ? { env: c.env } : {}),
|
|
88
92
|
...(c.sessionMeta !== undefined ? { sessionMeta: c.sessionMeta } : {}),
|
|
89
93
|
...(c.structuredOutputTool !== undefined ? { structuredOutputTool: c.structuredOutputTool } : {}),
|
|
94
|
+
...(fork !== undefined ? { fork } : {}),
|
|
90
95
|
},
|
|
91
96
|
];
|
|
92
97
|
}
|
|
98
|
+
function isForkDisposition(value) {
|
|
99
|
+
return value === "id-only" || value === "live";
|
|
100
|
+
}
|
|
101
|
+
function isForkCwdRule(value) {
|
|
102
|
+
return value === "source-only" || value === "free";
|
|
103
|
+
}
|
|
104
|
+
/** The validated copy of a `fork` declaration (only the declared keys), or `undefined` when malformed. */
|
|
105
|
+
function validateFork(value) {
|
|
106
|
+
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
107
|
+
return undefined;
|
|
108
|
+
const { disposition, cwd } = value;
|
|
109
|
+
if (!isForkDisposition(disposition))
|
|
110
|
+
return undefined;
|
|
111
|
+
if (cwd !== undefined && !isForkCwdRule(cwd))
|
|
112
|
+
return undefined;
|
|
113
|
+
return { disposition, ...(cwd !== undefined ? { cwd } : {}) };
|
|
114
|
+
}
|
|
93
115
|
function asciiLowercase(value) {
|
|
94
116
|
return value.replace(/[A-Z]/g, (character) => String.fromCharCode(character.charCodeAt(0) + 32));
|
|
95
117
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Backend } from "./backend.js";
|
|
2
|
+
import type { BackendRegistry } from "./registry.js";
|
|
3
|
+
export interface ModelRoute {
|
|
4
|
+
backend: Backend;
|
|
5
|
+
modelSpec: string | undefined;
|
|
6
|
+
}
|
|
7
|
+
/** Resolve routing and the verbatim model value together so backend choice and prefix stripping
|
|
8
|
+
* cannot drift. A registered custom name has priority over a built-in on collision. */
|
|
9
|
+
export declare function resolveModelRoute(spec: string | undefined, registry?: BackendRegistry): ModelRoute;
|
|
10
|
+
/** Exported for src/agent/routing.ts (`resolveRefRoute`); deliberately NOT in the barrel. */
|
|
11
|
+
export declare function asciiLowercase(value: string): string;
|
|
12
|
+
/** Exported for runner.ts and src/agent; deliberately NOT in the barrel. */
|
|
13
|
+
export declare function assertNoModelConfigOption(configOptions: Record<string, string | boolean> | undefined, label: string | undefined): void;
|
|
14
|
+
//# sourceMappingURL=routing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routing.d.ts","sourceRoot":"","sources":["../src/routing.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAG5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED;wFACwF;AACxF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,CAAC,EAAE,eAAe,GAAG,UAAU,CAalG;AAkBD,6FAA6F;AAC7F,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,4EAA4E;AAC5E,wBAAgB,yBAAyB,CACvC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,SAAS,EAC3D,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,IAAI,CAON"}
|
package/dist/routing.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Model routing — the runner's grammar for turning a model/tier spec into a Backend plus the
|
|
2
|
+
// verbatim model value handed to session/set_config_option. Extracted from runner.ts as a pure
|
|
3
|
+
// move so the SDK-style AcpAgent (src/agent/) can share it instead of copying it.
|
|
4
|
+
//
|
|
5
|
+
// `asciiLowercase` and `assertNoModelConfigOption` are module exports for runner.ts and
|
|
6
|
+
// src/agent only — deliberately NOT re-exported from the package barrel. `defaultBackend` stays
|
|
7
|
+
// module-private: it reads AGENTPRISM_DEFAULT_BACKEND and nothing outside resolveModelRoute needs it.
|
|
8
|
+
import { WorkflowError, WorkflowErrorCode } from "@automatalabs/shared-types";
|
|
9
|
+
import { BUILTIN_BACKENDS, builtinBackend } from "./backends/builtins.js";
|
|
10
|
+
import { CustomAcpBackend } from "./backends/custom.js";
|
|
11
|
+
/** Resolve routing and the verbatim model value together so backend choice and prefix stripping
|
|
12
|
+
* cannot drift. A registered custom name has priority over a built-in on collision. */
|
|
13
|
+
export function resolveModelRoute(spec, registry) {
|
|
14
|
+
if (spec === undefined)
|
|
15
|
+
return { backend: defaultBackend(registry), modelSpec: undefined };
|
|
16
|
+
const slash = spec.indexOf("/");
|
|
17
|
+
const firstSegment = asciiLowercase(slash >= 0 ? spec.slice(0, slash) : spec);
|
|
18
|
+
const inner = slash >= 0 ? spec.slice(slash + 1) : undefined;
|
|
19
|
+
const custom = registry?.get(firstSegment);
|
|
20
|
+
if (custom)
|
|
21
|
+
return { backend: new CustomAcpBackend(custom), modelSpec: inner };
|
|
22
|
+
const builtIn = builtinBackend(firstSegment);
|
|
23
|
+
if (builtIn)
|
|
24
|
+
return { backend: builtIn, modelSpec: inner };
|
|
25
|
+
return { backend: defaultBackend(registry), modelSpec: spec };
|
|
26
|
+
}
|
|
27
|
+
/** Resolve the default backend: a registered custom name wins (returned as a Backend), else
|
|
28
|
+
* the built-in id. An unknown/unset value falls back to "claude" (the historical default). */
|
|
29
|
+
function defaultBackend(registry) {
|
|
30
|
+
const configured = process.env.AGENTPRISM_DEFAULT_BACKEND;
|
|
31
|
+
const name = configured === undefined ? undefined : asciiLowercase(configured);
|
|
32
|
+
if (name && registry) {
|
|
33
|
+
const config = registry.get(name);
|
|
34
|
+
if (config)
|
|
35
|
+
return new CustomAcpBackend(config);
|
|
36
|
+
}
|
|
37
|
+
if (name) {
|
|
38
|
+
const builtIn = builtinBackend(name);
|
|
39
|
+
if (builtIn)
|
|
40
|
+
return builtIn;
|
|
41
|
+
}
|
|
42
|
+
return BUILTIN_BACKENDS.claude.create();
|
|
43
|
+
}
|
|
44
|
+
/** Exported for src/agent/routing.ts (`resolveRefRoute`); deliberately NOT in the barrel. */
|
|
45
|
+
export function asciiLowercase(value) {
|
|
46
|
+
return value.replace(/[A-Z]/g, (character) => String.fromCharCode(character.charCodeAt(0) + 32));
|
|
47
|
+
}
|
|
48
|
+
/** Exported for runner.ts and src/agent; deliberately NOT in the barrel. */
|
|
49
|
+
export function assertNoModelConfigOption(configOptions, label) {
|
|
50
|
+
if (!configOptions || !("model" in configOptions))
|
|
51
|
+
return;
|
|
52
|
+
throw new WorkflowError(`Agent call${label ? ` "${label}"` : ""} configOptions must not contain reserved option id "model"; use the model field instead`, WorkflowErrorCode.SCRIPT_VALIDATION_ERROR, { recoverable: false, agentLabel: label });
|
|
53
|
+
}
|
package/dist/runner.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../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I,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,QAAQ,CAAC,EAAE,eAAe,GAAG,OAAO,CAE1G"}
|
package/dist/runner.js
CHANGED
|
@@ -21,10 +21,11 @@ import { PooledConnection, ReattachCapabilityUnavailable, isChildCleanupError, }
|
|
|
21
21
|
import { AcpAgentPool } from "./pool.js";
|
|
22
22
|
import { TypedEventEmitter, } from "./events.js";
|
|
23
23
|
import { InteractiveSession } from "./interactive.js";
|
|
24
|
-
import {
|
|
25
|
-
import { CustomAcpBackend } from "./backends/custom.js";
|
|
24
|
+
import { BUILTIN_BACKEND_IDS } from "./backends/builtins.js";
|
|
26
25
|
import { registryWithRunBackends, resolveBackendRegistry, } from "./registry.js";
|
|
27
26
|
import { mapThrownError } from "./errors-map.js";
|
|
27
|
+
import { assertNoModelConfigOption, resolveModelRoute } from "./routing.js";
|
|
28
|
+
import { sessionRefFor } from "./session-ref.js";
|
|
28
29
|
import { buildAuthDescriptor, } from "./auth/auth-types.js";
|
|
29
30
|
import { AuthStore, classifyCredential, } from "./auth/auth-store.js";
|
|
30
31
|
import { ProviderStore, providerVertexMeta } from "./provider-store.js";
|
|
@@ -1139,54 +1140,12 @@ async function applyModelSelection(session, spec, opts) {
|
|
|
1139
1140
|
await session.selectModel(spec);
|
|
1140
1141
|
opts.onModelResolved?.(spec);
|
|
1141
1142
|
}
|
|
1142
|
-
function assertNoModelConfigOption(configOptions, label) {
|
|
1143
|
-
if (!configOptions || !("model" in configOptions))
|
|
1144
|
-
return;
|
|
1145
|
-
throw new WorkflowError(`Agent call${label ? ` "${label}"` : ""} configOptions must not contain reserved option id "model"; use the model field instead`, WorkflowErrorCode.SCRIPT_VALIDATION_ERROR, { recoverable: false, agentLabel: label });
|
|
1146
|
-
}
|
|
1147
1143
|
/** Pick the backend for the effective model spec (`model` wins over `tier`). The first segment
|
|
1148
1144
|
* routes only when it is a registered custom or built-in harness name; everything else goes to
|
|
1149
1145
|
* the configured default backend without interpretation. */
|
|
1150
1146
|
export function selectBackend(opts, registry) {
|
|
1151
1147
|
return resolveModelRoute(opts.model ?? opts.tier, registry).backend;
|
|
1152
1148
|
}
|
|
1153
|
-
/** Resolve routing and the verbatim model value together so backend choice and prefix stripping
|
|
1154
|
-
* cannot drift. A registered custom name has priority over a built-in on collision. */
|
|
1155
|
-
function resolveModelRoute(spec, registry) {
|
|
1156
|
-
if (spec === undefined)
|
|
1157
|
-
return { backend: defaultBackend(registry), modelSpec: undefined };
|
|
1158
|
-
const slash = spec.indexOf("/");
|
|
1159
|
-
const firstSegment = asciiLowercase(slash >= 0 ? spec.slice(0, slash) : spec);
|
|
1160
|
-
const inner = slash >= 0 ? spec.slice(slash + 1) : undefined;
|
|
1161
|
-
const custom = registry?.get(firstSegment);
|
|
1162
|
-
if (custom)
|
|
1163
|
-
return { backend: new CustomAcpBackend(custom), modelSpec: inner };
|
|
1164
|
-
const builtIn = builtinBackend(firstSegment);
|
|
1165
|
-
if (builtIn)
|
|
1166
|
-
return { backend: builtIn, modelSpec: inner };
|
|
1167
|
-
return { backend: defaultBackend(registry), modelSpec: spec };
|
|
1168
|
-
}
|
|
1169
|
-
/** The re-attach handle for an open session: id + backend routing name + cwd + the
|
|
1170
|
-
* agent-advertised reopen surface. Contains no secrets; JSON-round-trippable. `backendId`
|
|
1171
|
-
* doubles as the `model` routing spec for loadSession/resumeSession/listSessions. */
|
|
1172
|
-
function sessionRefFor(session, backend, cwd) {
|
|
1173
|
-
const caps = session.capabilities;
|
|
1174
|
-
return {
|
|
1175
|
-
sessionId: session.sessionId,
|
|
1176
|
-
backendId: backend.id,
|
|
1177
|
-
poolKey: backend.poolKey ?? backend.id,
|
|
1178
|
-
...(session.initializeMeta !== undefined
|
|
1179
|
-
? { initializeMeta: session.initializeMeta }
|
|
1180
|
-
: {}),
|
|
1181
|
-
cwd,
|
|
1182
|
-
reopen: {
|
|
1183
|
-
load: caps?.supportsLoadSession === true,
|
|
1184
|
-
resume: caps?.supportsResumeSession === true,
|
|
1185
|
-
list: caps?.supportsListSessions === true,
|
|
1186
|
-
fork: caps?.supportsForkSession === true,
|
|
1187
|
-
},
|
|
1188
|
-
};
|
|
1189
|
-
}
|
|
1190
1149
|
/** Interactive sessions are public and long-lived, so fail before spawning a dedicated process
|
|
1191
1150
|
* when the required worktree root is absent or not absolute. */
|
|
1192
1151
|
function validateInteractiveCwd(cwd, label, methodName) {
|
|
@@ -1267,23 +1226,3 @@ async function disposeBestEffort(connection) {
|
|
|
1267
1226
|
// Dedicated lifecycle processes are already no longer useful; never mask the request result.
|
|
1268
1227
|
}
|
|
1269
1228
|
}
|
|
1270
|
-
/** Resolve the default backend: a registered custom name wins (returned as a Backend), else
|
|
1271
|
-
* the built-in id. An unknown/unset value falls back to "claude" (the historical default). */
|
|
1272
|
-
function defaultBackend(registry) {
|
|
1273
|
-
const configured = process.env.AGENTPRISM_DEFAULT_BACKEND;
|
|
1274
|
-
const name = configured === undefined ? undefined : asciiLowercase(configured);
|
|
1275
|
-
if (name && registry) {
|
|
1276
|
-
const config = registry.get(name);
|
|
1277
|
-
if (config)
|
|
1278
|
-
return new CustomAcpBackend(config);
|
|
1279
|
-
}
|
|
1280
|
-
if (name) {
|
|
1281
|
-
const builtIn = builtinBackend(name);
|
|
1282
|
-
if (builtIn)
|
|
1283
|
-
return builtIn;
|
|
1284
|
-
}
|
|
1285
|
-
return BUILTIN_BACKENDS.claude.create();
|
|
1286
|
-
}
|
|
1287
|
-
function asciiLowercase(value) {
|
|
1288
|
-
return value.replace(/[A-Z]/g, (character) => String.fromCharCode(character.charCodeAt(0) + 32));
|
|
1289
|
-
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AgentSessionRef } from "@automatalabs/shared-types";
|
|
2
|
+
import type { SessionHandle } from "./acp-client.js";
|
|
3
|
+
import type { Backend } from "./backend.js";
|
|
4
|
+
/** The re-attach handle for an open session: id + backend routing name + cwd + the
|
|
5
|
+
* agent-advertised reopen surface. Contains no secrets; JSON-round-trippable. `backendId`
|
|
6
|
+
* doubles as the `model` routing spec for loadSession/resumeSession/listSessions. */
|
|
7
|
+
export declare function sessionRefFor(session: SessionHandle, backend: Backend, cwd: string): AgentSessionRef;
|
|
8
|
+
//# sourceMappingURL=session-ref.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-ref.d.ts","sourceRoot":"","sources":["../src/session-ref.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C;;sFAEsF;AACtF,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,eAAe,CAiBpG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** The re-attach handle for an open session: id + backend routing name + cwd + the
|
|
2
|
+
* agent-advertised reopen surface. Contains no secrets; JSON-round-trippable. `backendId`
|
|
3
|
+
* doubles as the `model` routing spec for loadSession/resumeSession/listSessions. */
|
|
4
|
+
export function sessionRefFor(session, backend, cwd) {
|
|
5
|
+
const caps = session.capabilities;
|
|
6
|
+
return {
|
|
7
|
+
sessionId: session.sessionId,
|
|
8
|
+
backendId: backend.id,
|
|
9
|
+
poolKey: backend.poolKey ?? backend.id,
|
|
10
|
+
...(session.initializeMeta !== undefined
|
|
11
|
+
? { initializeMeta: session.initializeMeta }
|
|
12
|
+
: {}),
|
|
13
|
+
cwd,
|
|
14
|
+
reopen: {
|
|
15
|
+
load: caps?.supportsLoadSession === true,
|
|
16
|
+
resume: caps?.supportsResumeSession === true,
|
|
17
|
+
list: caps?.supportsListSessions === true,
|
|
18
|
+
fork: caps?.supportsForkSession === true,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -5,7 +5,11 @@ export declare const STRUCTURED_OUTPUT_SERVER_NAME = "structured_output";
|
|
|
5
5
|
export declare const STRUCTURED_OUTPUT_TOOL_DESCRIPTION: string;
|
|
6
6
|
export interface StructuredOutputToolRegistration {
|
|
7
7
|
readonly url: string;
|
|
8
|
+
/** Peek at the last valid capture without consuming it (the runner's single-turn read). */
|
|
8
9
|
tryCaptured(): unknown | undefined;
|
|
10
|
+
/** Return the captured value and clear the slot — a capture belongs to exactly one turn, so a
|
|
11
|
+
* long-lived registration never hands turn N's object to turn N+1. */
|
|
12
|
+
takeCaptured(): unknown | undefined;
|
|
9
13
|
release(): void;
|
|
10
14
|
}
|
|
11
15
|
/** Runner-scoped localhost MCP host. It binds only once a schema run actually needs injection. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"structured-tool.d.ts","sourceRoot":"","sources":["../src/structured-tool.ts"],"names":[],"mappings":"AASA,OAAO,EAOL,KAAK,IAAI,EACV,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAKvC,eAAO,MAAM,2BAA2B,qBAAqB,CAAC;AAC9D,eAAO,MAAM,6BAA6B,sBAAsB,CAAC;AAEjE,eAAO,MAAM,kCAAkC,QAM2C,CAAC;AAW3F,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,WAAW,IAAI,OAAO,GAAG,SAAS,CAAC;IACnC,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,kGAAkG;AAClG,qBAAa,wBAAwB;IACnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA2B;IACjD,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,CAAC,aAAa,CAA4B;IACjD,OAAO,CAAC,IAAI,CAAqB;IAEjC,WAAW,IAAI,OAAO;IAItB,aAAa,IAAI,MAAM,GAAG,SAAS;IAI7B,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"structured-tool.d.ts","sourceRoot":"","sources":["../src/structured-tool.ts"],"names":[],"mappings":"AASA,OAAO,EAOL,KAAK,IAAI,EACV,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAKvC,eAAO,MAAM,2BAA2B,qBAAqB,CAAC;AAC9D,eAAO,MAAM,6BAA6B,sBAAsB,CAAC;AAEjE,eAAO,MAAM,kCAAkC,QAM2C,CAAC;AAW3F,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,2FAA2F;IAC3F,WAAW,IAAI,OAAO,GAAG,SAAS,CAAC;IACnC;2EACuE;IACvE,YAAY,IAAI,OAAO,GAAG,SAAS,CAAC;IACpC,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,kGAAkG;AAClG,qBAAa,wBAAwB;IACnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA2B;IACjD,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,CAAC,aAAa,CAA4B;IACjD,OAAO,CAAC,IAAI,CAAqB;IAEjC,WAAW,IAAI,OAAO;IAItB,aAAa,IAAI,MAAM,GAAG,SAAS;IAI7B,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,gCAAgC,CAAC;IA6BpE,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;YAYhB,eAAe;YAoCf,aAAa;IAyB3B,OAAO,CAAC,OAAO;CAahB;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,CAI9E"}
|
package/dist/structured-tool.js
CHANGED
|
@@ -41,6 +41,11 @@ export class StructuredOutputToolHost {
|
|
|
41
41
|
return {
|
|
42
42
|
url: `http://${HOST}:${port}/${token}`,
|
|
43
43
|
tryCaptured: () => slot.captured,
|
|
44
|
+
takeCaptured: () => {
|
|
45
|
+
const captured = slot.captured;
|
|
46
|
+
slot.captured = undefined;
|
|
47
|
+
return captured;
|
|
48
|
+
},
|
|
44
49
|
release: once(() => {
|
|
45
50
|
this.slots.delete(token);
|
|
46
51
|
}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automatalabs/acp-agents",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22"
|
|
@@ -27,17 +27,17 @@
|
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@agentclientprotocol/claude-agent-acp": "0.
|
|
30
|
+
"@agentclientprotocol/claude-agent-acp": "0.78.0",
|
|
31
31
|
"@agentclientprotocol/sdk": "^1.4.0",
|
|
32
32
|
"@modelcontextprotocol/sdk": "^1.30",
|
|
33
33
|
"typebox": "1.3.2",
|
|
34
|
-
"@automatalabs/codex-acp": "2.
|
|
34
|
+
"@automatalabs/codex-acp": "2.6.0",
|
|
35
35
|
"@automatalabs/pi-acp": "0.8.0",
|
|
36
|
-
"@automatalabs/shared-types": "2.
|
|
36
|
+
"@automatalabs/shared-types": "2.3.0"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "tsc -b",
|
|
40
|
-
"typecheck": "tsc --noEmit",
|
|
40
|
+
"typecheck": "tsc -p tsconfig.test.json --noEmit",
|
|
41
41
|
"test": "tsx --test \"test/**/*.test.ts\""
|
|
42
42
|
}
|
|
43
43
|
}
|