@zvada/agent-server 0.3.27 → 0.3.28
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/CHANGELOG.md +38 -0
- package/README.md +6 -4
- package/dist/core/agents/acp/account.js +111 -0
- package/dist/core/agents/acp/acp-agent.js +247 -158
- package/dist/core/agents/acp/adapter.js +103 -34
- package/dist/core/agents/acp/client.js +169 -42
- package/dist/core/agents/acp/known-agents.js +12 -5
- package/dist/core/agents/acp/mappings.js +84 -20
- package/dist/core/agents/acp/models.js +59 -0
- package/dist/core/agents/acp/profile.js +36 -0
- package/dist/core/agents/acp/prompts.js +248 -0
- package/dist/core/agents/acp/requests.js +4 -4
- package/dist/core/agents/claude-code/login.js +4 -1
- package/dist/core/agents/claude-code/session.js +38 -10
- package/dist/core/agents/claude-code/spawn.js +0 -26
- package/dist/core/agents/codex-app-server/client.js +12 -13
- package/dist/core/agents/codex-app-server/login.js +4 -1
- package/dist/core/agents/gemini/failures.js +133 -0
- package/dist/core/agents/gemini/login.js +173 -0
- package/dist/core/agents/gemini/profile.js +137 -0
- package/dist/core/agents/gemini/tools.js +91 -0
- package/dist/core/agents/login.js +8 -6
- package/dist/core/agents/stderr-tail.js +5 -2
- package/dist/core/presets.js +13 -0
- package/dist/core/processes/native-processes.js +23 -1
- package/dist/core/provision/install-build.js +70 -26
- package/dist/core/provision/pins.js +5 -0
- package/dist/core/provision/provisioner.js +39 -16
- package/dist/core/provision/releases.js +39 -1
- package/dist/core/provision/tools.js +87 -28
- package/dist/operator/errors.js +2 -2
- package/dist/operator/operator.js +171 -74
- package/dist/operator/render.js +33 -25
- package/dist/operator/session-tools.js +2 -1
- package/dist/protocol/account.js +5 -1
- package/dist/protocol/auth.js +5 -1
- package/dist/protocol/credentials.js +9 -1
- package/dist/protocol/harness.js +9 -1
- package/dist/server/bin.js +22 -7
- package/dist/server/install.js +6 -4
- package/dist/types/core/agents/acp/account.d.ts +55 -0
- package/dist/types/core/agents/acp/account.d.ts.map +1 -0
- package/dist/types/core/agents/acp/acp-agent.d.ts +65 -36
- package/dist/types/core/agents/acp/acp-agent.d.ts.map +1 -1
- package/dist/types/core/agents/acp/adapter.d.ts +28 -3
- package/dist/types/core/agents/acp/adapter.d.ts.map +1 -1
- package/dist/types/core/agents/acp/client.d.ts +66 -4
- package/dist/types/core/agents/acp/client.d.ts.map +1 -1
- package/dist/types/core/agents/acp/known-agents.d.ts +4 -2
- package/dist/types/core/agents/acp/known-agents.d.ts.map +1 -1
- package/dist/types/core/agents/acp/mappings.d.ts +53 -7
- package/dist/types/core/agents/acp/mappings.d.ts.map +1 -1
- package/dist/types/core/agents/acp/models.d.ts +22 -0
- package/dist/types/core/agents/acp/models.d.ts.map +1 -0
- package/dist/types/core/agents/acp/profile.d.ts +92 -0
- package/dist/types/core/agents/acp/profile.d.ts.map +1 -0
- package/dist/types/core/agents/acp/prompts.d.ts +108 -0
- package/dist/types/core/agents/acp/prompts.d.ts.map +1 -0
- package/dist/types/core/agents/acp/requests.d.ts +7 -1
- package/dist/types/core/agents/acp/requests.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/login.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/session.d.ts +3 -0
- package/dist/types/core/agents/claude-code/session.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/spawn.d.ts +0 -8
- package/dist/types/core/agents/claude-code/spawn.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/client.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/login.d.ts.map +1 -1
- package/dist/types/core/agents/gemini/failures.d.ts +25 -0
- package/dist/types/core/agents/gemini/failures.d.ts.map +1 -0
- package/dist/types/core/agents/gemini/login.d.ts +28 -0
- package/dist/types/core/agents/gemini/login.d.ts.map +1 -0
- package/dist/types/core/agents/gemini/profile.d.ts +30 -0
- package/dist/types/core/agents/gemini/profile.d.ts.map +1 -0
- package/dist/types/core/agents/gemini/tools.d.ts +18 -0
- package/dist/types/core/agents/gemini/tools.d.ts.map +1 -0
- package/dist/types/core/agents/login.d.ts +15 -5
- package/dist/types/core/agents/login.d.ts.map +1 -1
- package/dist/types/core/agents/stderr-tail.d.ts +1 -1
- package/dist/types/core/agents/stderr-tail.d.ts.map +1 -1
- package/dist/types/core/presets.d.ts +2 -2
- package/dist/types/core/presets.d.ts.map +1 -1
- package/dist/types/core/processes/native-processes.d.ts +6 -0
- package/dist/types/core/processes/native-processes.d.ts.map +1 -1
- package/dist/types/core/provision/checksums.d.ts +7 -1
- package/dist/types/core/provision/checksums.d.ts.map +1 -1
- package/dist/types/core/provision/install-build.d.ts +32 -6
- package/dist/types/core/provision/install-build.d.ts.map +1 -1
- package/dist/types/core/provision/pins.d.ts +4 -0
- package/dist/types/core/provision/pins.d.ts.map +1 -1
- package/dist/types/core/provision/provisioner.d.ts +18 -7
- package/dist/types/core/provision/provisioner.d.ts.map +1 -1
- package/dist/types/core/provision/releases.d.ts +2 -1
- package/dist/types/core/provision/releases.d.ts.map +1 -1
- package/dist/types/core/provision/tools.d.ts +36 -7
- package/dist/types/core/provision/tools.d.ts.map +1 -1
- package/dist/types/operator/errors.d.ts +5 -1
- package/dist/types/operator/errors.d.ts.map +1 -1
- package/dist/types/operator/operator.d.ts.map +1 -1
- package/dist/types/operator/render.d.ts +11 -6
- package/dist/types/operator/render.d.ts.map +1 -1
- package/dist/types/operator/session-tools.d.ts.map +1 -1
- package/dist/types/operator/types.d.ts +1 -0
- package/dist/types/operator/types.d.ts.map +1 -1
- package/dist/types/protocol/account.d.ts +4 -2
- package/dist/types/protocol/account.d.ts.map +1 -1
- package/dist/types/protocol/auth.d.ts +10 -7
- package/dist/types/protocol/auth.d.ts.map +1 -1
- package/dist/types/protocol/clis.d.ts +4 -3
- package/dist/types/protocol/clis.d.ts.map +1 -1
- package/dist/types/protocol/config.d.ts +2 -0
- package/dist/types/protocol/config.d.ts.map +1 -1
- package/dist/types/protocol/conversation.d.ts +3 -3
- package/dist/types/protocol/credentials.d.ts +8 -0
- package/dist/types/protocol/credentials.d.ts.map +1 -1
- package/dist/types/protocol/execution.d.ts +1 -1
- package/dist/types/protocol/harness.d.ts +5 -2
- package/dist/types/protocol/harness.d.ts.map +1 -1
- package/dist/types/protocol/lifecycle.d.ts +8 -8
- package/dist/types/protocol/models.d.ts +3 -0
- package/dist/types/protocol/models.d.ts.map +1 -1
- package/dist/types/protocol/wire-api.d.ts +39 -29
- package/dist/types/protocol/wire-api.d.ts.map +1 -1
- package/dist/types/protocol/wire.d.ts +13 -10
- package/dist/types/protocol/wire.d.ts.map +1 -1
- package/dist/types/server/install.d.ts +2 -1
- package/dist/types/server/install.d.ts.map +1 -1
- package/docs/consuming.md +6 -0
- package/docs/deploy.md +17 -8
- package/docs/harnesses.md +166 -44
- package/package.json +1 -1
- package/src/core/agents/acp/account.ts +158 -0
- package/src/core/agents/acp/acp-agent.ts +288 -178
- package/src/core/agents/acp/adapter.ts +126 -35
- package/src/core/agents/acp/client.ts +196 -49
- package/src/core/agents/acp/known-agents.ts +14 -5
- package/src/core/agents/acp/mappings.ts +112 -21
- package/src/core/agents/acp/models.ts +72 -0
- package/src/core/agents/acp/profile.ts +127 -0
- package/src/core/agents/acp/prompts.ts +287 -0
- package/src/core/agents/acp/requests.ts +16 -9
- package/src/core/agents/claude-code/login.ts +4 -1
- package/src/core/agents/claude-code/session.ts +38 -8
- package/src/core/agents/claude-code/spawn.ts +0 -26
- package/src/core/agents/codex-app-server/client.ts +11 -18
- package/src/core/agents/codex-app-server/login.ts +4 -5
- package/src/core/agents/gemini/failures.ts +148 -0
- package/src/core/agents/gemini/login.ts +188 -0
- package/src/core/agents/gemini/profile.ts +162 -0
- package/src/core/agents/gemini/tools.ts +99 -0
- package/src/core/agents/login.ts +14 -8
- package/src/core/agents/stderr-tail.ts +5 -2
- package/src/core/presets.ts +15 -2
- package/src/core/processes/native-processes.ts +32 -1
- package/src/core/provision/checksums.ts +12 -2
- package/src/core/provision/install-build.ts +122 -55
- package/src/core/provision/pins.ts +5 -0
- package/src/core/provision/provisioner.ts +62 -27
- package/src/core/provision/releases.ts +47 -1
- package/src/core/provision/tools.ts +124 -31
- package/src/operator/errors.ts +5 -2
- package/src/operator/operator.ts +181 -77
- package/src/operator/render.ts +60 -28
- package/src/operator/session-tools.ts +2 -1
- package/src/operator/types.ts +1 -0
- package/src/protocol/account.ts +5 -2
- package/src/protocol/auth.ts +5 -1
- package/src/protocol/credentials.ts +11 -2
- package/src/protocol/harness.ts +9 -1
- package/src/server/bin.ts +20 -6
- package/src/server/install.ts +6 -3
package/dist/protocol/account.js
CHANGED
|
@@ -46,7 +46,9 @@ const CLOUDS = {
|
|
|
46
46
|
/**
|
|
47
47
|
* What to call a login, the same wherever it lives: `Claude Max`, `ChatGPT
|
|
48
48
|
* Pro`, `Claude subscription` (plan unknown), `OpenAI API key`, `Amazon
|
|
49
|
-
* Bedrock`. A
|
|
49
|
+
* Bedrock`. A subscription whose login names its own plan (`label`) is
|
|
50
|
+
* called that; otherwise the name is made from its plan, and a plan this
|
|
51
|
+
* table does not know shows as the provider names it.
|
|
50
52
|
*/
|
|
51
53
|
export function accountLabel(harness, login) {
|
|
52
54
|
if (login.credential === "api_key")
|
|
@@ -55,6 +57,8 @@ export function accountLabel(harness, login) {
|
|
|
55
57
|
return login.provider && (CLOUDS[login.provider] ?? login.provider);
|
|
56
58
|
if (login.credential !== "subscription")
|
|
57
59
|
return undefined;
|
|
60
|
+
if (login.label)
|
|
61
|
+
return login.label;
|
|
58
62
|
const names = PLANS[harness];
|
|
59
63
|
if (!names)
|
|
60
64
|
return login.plan;
|
package/dist/protocol/auth.js
CHANGED
|
@@ -83,7 +83,11 @@ export const HarnessAuthSchema = AccountInfoSchema.extend({
|
|
|
83
83
|
state: openVocabulary(AUTH_STATES),
|
|
84
84
|
credential: openVocabulary(AUTH_CREDENTIALS).optional(),
|
|
85
85
|
source: openVocabulary(AUTH_SOURCES).optional(),
|
|
86
|
-
/**
|
|
86
|
+
/**
|
|
87
|
+
* What to show for it (`Claude Max`, `ChatGPT Pro`, `OpenAI API key`):
|
|
88
|
+
* `accountLabel`, which keeps the name a subscription's login gives its
|
|
89
|
+
* own plan, where it gives one, and otherwise makes one from its plan.
|
|
90
|
+
*/
|
|
87
91
|
label: z.string().optional(),
|
|
88
92
|
/** When the credential stops working (epoch ms), where known. */
|
|
89
93
|
expiresAt: z.number().int().optional(),
|
|
@@ -46,8 +46,16 @@ const RUNS_ON = {
|
|
|
46
46
|
"claude-code": ClaudeCredentialSchema,
|
|
47
47
|
"codex-app-server": CodexCredentialSchema,
|
|
48
48
|
};
|
|
49
|
+
/**
|
|
50
|
+
* Whether a product can hold a login for `harness`: it runs on a credential
|
|
51
|
+
* the product hands each turn (LLP 0012). One that runs only on its CLI's own
|
|
52
|
+
* sign-in, or on none (ACP, scripted), cannot.
|
|
53
|
+
*/
|
|
54
|
+
export function takesHeldCredential(harness) {
|
|
55
|
+
return Object.hasOwn(RUNS_ON, harness);
|
|
56
|
+
}
|
|
49
57
|
export function credentialRunsOn(harness, credential) {
|
|
50
|
-
if (!
|
|
58
|
+
if (!takesHeldCredential(harness))
|
|
51
59
|
return { ok: false, error: `${harness} runs on no credential a product holds.` };
|
|
52
60
|
const parsed = RUNS_ON[harness].safeParse(credential);
|
|
53
61
|
if (parsed.success)
|
package/dist/protocol/harness.js
CHANGED
|
@@ -4,13 +4,21 @@ import { openVocabulary } from "./vocabulary.js";
|
|
|
4
4
|
* The agent harnesses this engine can drive:
|
|
5
5
|
* - `claude-code` — Claude Code via @anthropic-ai/claude-agent-sdk (CLI under the hood)
|
|
6
6
|
* - `codex-app-server` — OpenAI Codex via `codex app-server` (long-lived JSON-RPC subprocess)
|
|
7
|
+
* - `gemini` — Gemini models via Google's Antigravity CLI (`agy acp`, an ACP agent),
|
|
8
|
+
* on the person's own Antigravity sign-in
|
|
7
9
|
* - `acp` — any Agent Client Protocol v1 agent subprocess (`gemini --acp`,
|
|
8
10
|
* `claude-code-acp`, `codex-acp`, ACP registry agents); the launch
|
|
9
11
|
* command is operator-configured, never taken from the wire
|
|
10
12
|
* - `scripted` — a script the operator gives plays the agent (a product's
|
|
11
13
|
* free test double); registered only with its script
|
|
12
14
|
*/
|
|
13
|
-
export const AGENT_HARNESSES = [
|
|
15
|
+
export const AGENT_HARNESSES = [
|
|
16
|
+
"claude-code",
|
|
17
|
+
"codex-app-server",
|
|
18
|
+
"gemini",
|
|
19
|
+
"acp",
|
|
20
|
+
"scripted",
|
|
21
|
+
];
|
|
14
22
|
export const AgentHarnessSchema = z.enum(AGENT_HARNESSES);
|
|
15
23
|
export const HarnessIdSchema = openVocabulary(AGENT_HARNESSES);
|
|
16
24
|
export function isAgentHarness(value) {
|
package/dist/server/bin.js
CHANGED
|
@@ -21,7 +21,8 @@ import { readFileSync, statSync } from "node:fs";
|
|
|
21
21
|
import { homedir } from "node:os";
|
|
22
22
|
import { join } from "node:path";
|
|
23
23
|
import pkg from "../../package.json" with { type: "json" };
|
|
24
|
-
import { createAgentRuntime, credentialsFromUrl, isInheritConfig, resolveAcpLaunch, resolveHarnessName, scriptedFile, } from "../core/index.js";
|
|
24
|
+
import { CLI_TOOLS, createAgentRuntime, credentialsFromUrl, isInheritConfig, resolveAcpLaunch, resolveHarnessName, scriptedFile, } from "../core/index.js";
|
|
25
|
+
import { CLI_TOOL_SPECS } from "../core/provision/tools.js";
|
|
25
26
|
import { THINKING_LEVELS } from "../protocol/index.js";
|
|
26
27
|
import { AgentServer } from "./agent-server.js";
|
|
27
28
|
import { runFeedbackCommand } from "./feedback.js";
|
|
@@ -62,7 +63,7 @@ function usage(exitCode) {
|
|
|
62
63
|
" --dial <ws-url> dial out to a consumer (auto-reconnect); its credential:",
|
|
63
64
|
" $AGENT_SERVER_DIAL_TOKEN, never argv or the URL",
|
|
64
65
|
" --harness <a,b> restrict harnesses (default: all installed)",
|
|
65
|
-
" --acp-agent <spec> ACP agent: known name (pi|gemini) or launch command",
|
|
66
|
+
" --acp-agent <spec> ACP agent: known name (pi|gemini-cli) or launch command",
|
|
66
67
|
" --script <file> the scripted harness plays this JSONL script, one step a",
|
|
67
68
|
" line (its only harness unless --harness names others);",
|
|
68
69
|
" one turn plays at a time, from the start at each start",
|
|
@@ -82,7 +83,7 @@ function usage(exitCode) {
|
|
|
82
83
|
"env: AGENT_SERVER_TOKEN (the listener's token, if no --token-file),",
|
|
83
84
|
" AGENT_SERVER_DIAL_TOKEN (what --dial presents: Authorization: Bearer),",
|
|
84
85
|
" AGENT_SERVER_CREDENTIALS_TOKEN (what --credentials-url presents),",
|
|
85
|
-
|
|
86
|
+
` ${CLI_TOOLS.map((tool) => CLI_TOOL_SPECS[tool].overrideEnv).join(" / ")} (explicit binaries),`,
|
|
86
87
|
" AGENT_SERVER_PROVISION, AGENT_SERVER_CACHE_DIR, AGENT_SERVER_NPM_REGISTRY,",
|
|
87
88
|
" AGENT_SERVER_BUNDLE_DIR (folders `install --dir` staged, a path list),",
|
|
88
89
|
" AGENT_SERVER_ACP_SESSION_DIR (--acp: where resumable session ids are kept)",
|
|
@@ -168,7 +169,7 @@ function parseArgs(argv) {
|
|
|
168
169
|
else if (arg === "--acp-agent") {
|
|
169
170
|
const spec = inline ?? argv[++i];
|
|
170
171
|
if (spec === undefined || !spec.trim() || spec.startsWith("-"))
|
|
171
|
-
fail("--acp-agent needs a known agent name (pi, gemini) or a launch command");
|
|
172
|
+
fail("--acp-agent needs a known agent name (pi, gemini-cli) or a launch command");
|
|
172
173
|
args.acpAgent = spec;
|
|
173
174
|
}
|
|
174
175
|
else if (arg === "--script") {
|
|
@@ -331,7 +332,7 @@ const named = args.harnesses?.map((h) => {
|
|
|
331
332
|
const choice = resolveHarnessName(h);
|
|
332
333
|
if (!choice)
|
|
333
334
|
fail(`unknown harness: ${h}`);
|
|
334
|
-
// Friendly ACP agent names ("pi", "gemini") ride the acp harness.
|
|
335
|
+
// Friendly ACP agent names ("pi", "gemini-cli") ride the acp harness.
|
|
335
336
|
if (choice.acpAgent)
|
|
336
337
|
args.acpAgent ??= choice.acpAgent;
|
|
337
338
|
return choice.harness;
|
|
@@ -347,10 +348,24 @@ if (args.command !== "install" && named?.includes("scripted") && args.script ===
|
|
|
347
348
|
fail("the scripted harness needs a script: --script <file>");
|
|
348
349
|
const harnesses = named ?? (args.script !== undefined ? ["scripted"] : undefined);
|
|
349
350
|
const provision = args.provisionMode ? { mode: args.provisionMode } : {};
|
|
350
|
-
|
|
351
|
+
// The ACP agent setting is read only where the acp harness runs: named, or,
|
|
352
|
+
// with no --harness, turned on by the setting itself. A stale
|
|
353
|
+
// `$AGENT_SERVER_ACP_AGENT` stops no other harness, nor `install`.
|
|
354
|
+
const acpSpec = args.acpAgent ?? process.env.AGENT_SERVER_ACP_AGENT;
|
|
355
|
+
const acpInUse = args.command !== "install" && (harnesses ? harnesses.includes("acp") : !!acpSpec);
|
|
356
|
+
const acpLaunch = (() => {
|
|
357
|
+
if (!acpInUse)
|
|
358
|
+
return undefined;
|
|
359
|
+
try {
|
|
360
|
+
return resolveAcpLaunch(acpSpec);
|
|
361
|
+
}
|
|
362
|
+
catch (error) {
|
|
363
|
+
return fail(error.message);
|
|
364
|
+
}
|
|
365
|
+
})();
|
|
351
366
|
// `install` runs no agent: an acp harness there has nothing to install, and says so.
|
|
352
367
|
if (args.command !== "install" && harnesses?.includes("acp") && !acpLaunch)
|
|
353
|
-
fail('the acp harness needs an agent: --harness pi|gemini or --acp-agent "<spec>"');
|
|
368
|
+
fail('the acp harness needs an agent: --harness pi|gemini-cli or --acp-agent "<spec>"');
|
|
354
369
|
if (args.command === "install") {
|
|
355
370
|
// A harness the engine installs nothing for is said, not passed over in silence.
|
|
356
371
|
for (const [i, harness] of (harnesses ?? []).entries())
|
package/dist/server/install.js
CHANGED
|
@@ -44,14 +44,16 @@ function claudeCodeVersion(version) {
|
|
|
44
44
|
/**
|
|
45
45
|
* The line `install` prints for a CLI it installed, saying what its version
|
|
46
46
|
* is: Claude's is the Claude SDK package's (`0.3.288`), which carries a
|
|
47
|
-
* Claude Code of its own number (`2.1.288`), the one `claude --version` says
|
|
47
|
+
* Claude Code of its own number (`2.1.288`), the one `claude --version` says;
|
|
48
|
+
* every other tool's is its CLI's own.
|
|
48
49
|
*/
|
|
49
50
|
export function installedLine({ tool, platform, cli }) {
|
|
50
51
|
const where = `for ${platform} ready: ${cli.path} (${cli.source})`;
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
const { title } = CLI_TOOL_SPECS[tool];
|
|
53
|
+
if (tool !== "claude")
|
|
54
|
+
return `${tool}: ${title} ${cli.version ?? "(version not known)"} ${where}`;
|
|
53
55
|
if (!cli.version)
|
|
54
|
-
return `claude:
|
|
56
|
+
return `claude: ${title} (version not known) ${where}`;
|
|
55
57
|
const code = claudeCodeVersion(cli.version);
|
|
56
58
|
return `claude: Claude SDK package ${cli.version}${code ? ` (Claude Code ${code})` : ""} ${where}`;
|
|
57
59
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { InitializeResponse, NewSessionResponse } from "@agentclientprotocol/sdk";
|
|
2
|
+
import type { NativeProcesses } from "../../processes/native-processes.ts";
|
|
3
|
+
import type { LoginOptions } from "../login.ts";
|
|
4
|
+
import { AcpClient, type AcpClientOptions, type AcpLaunch } from "./client.ts";
|
|
5
|
+
import type { AcpProfile } from "./profile.ts";
|
|
6
|
+
/** Deadline for session lifecycle requests (`session/new`, `session/resume`). */
|
|
7
|
+
export declare const SESSION_REQUEST_TIMEOUT_MS = 30000;
|
|
8
|
+
/** How an agent of a profile starts, for a turn or with none, and how the client introduces itself. */
|
|
9
|
+
export interface AcpStart {
|
|
10
|
+
profile: AcpProfile;
|
|
11
|
+
processes: NativeProcesses;
|
|
12
|
+
clientName?: string;
|
|
13
|
+
clientVersion?: string;
|
|
14
|
+
createClient?: (options: AcpClientOptions) => Promise<AcpClient>;
|
|
15
|
+
}
|
|
16
|
+
/** The profile's launch, refused when it has none; a cancel ends the wait. */
|
|
17
|
+
export declare function launchOf(profile: AcpProfile, signal?: AbortSignal): Promise<AcpLaunch>;
|
|
18
|
+
/** Start an agent of the profile's harness on the engine's processes. */
|
|
19
|
+
export declare function startClient(start: AcpStart, options: Pick<AcpClientOptions, "launch" | "cwd" | "env" | "sessionId" | "watchRequests">): Promise<AcpClient>;
|
|
20
|
+
/** `initialize` the agent, and refuse one its profile cannot drive. */
|
|
21
|
+
export declare function initialize(client: AcpClient, start: AcpStart): Promise<InitializeResponse>;
|
|
22
|
+
/**
|
|
23
|
+
* A folder of no project for an agent to start in, since an agent loads the
|
|
24
|
+
* rules, skills and hooks of the folder it runs in (Antigravity takes it as
|
|
25
|
+
* its workspace): a new one each time (`mkdtemp`, 0700), which nobody else
|
|
26
|
+
* can plant a project in, removed once `gone` settles (its process exited).
|
|
27
|
+
*/
|
|
28
|
+
export declare function privateFolder(): {
|
|
29
|
+
path: string;
|
|
30
|
+
removeAfter(gone?: Promise<unknown>): Promise<void>;
|
|
31
|
+
};
|
|
32
|
+
/** What a new session says of its account: the agent's `initialize`, and the session. */
|
|
33
|
+
export interface AcpAccountRead {
|
|
34
|
+
init: InitializeResponse;
|
|
35
|
+
session: NewSessionResponse;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The account an agent runs on, read through a session with no turn: the
|
|
39
|
+
* agent starts in a folder of no project, opens a session, is used, and ends.
|
|
40
|
+
* Its model list and its login read it this way.
|
|
41
|
+
*/
|
|
42
|
+
export declare class AcpAccount {
|
|
43
|
+
private readonly start;
|
|
44
|
+
constructor(start: AcpStart);
|
|
45
|
+
get processes(): NativeProcesses;
|
|
46
|
+
launch(signal?: AbortSignal): Promise<AcpLaunch>;
|
|
47
|
+
/**
|
|
48
|
+
* Start the agent in a folder of its own (`privateFolder`), `initialize`
|
|
49
|
+
* it, run `use`, and end it; `signal` ends it sooner.
|
|
50
|
+
*/
|
|
51
|
+
connect<T>(options: LoginOptions, use: (client: AcpClient, init: InitializeResponse, cwd: string) => Promise<T>): Promise<T>;
|
|
52
|
+
/** As `connect`, with a session opened in its folder for `use`, and never prompted. */
|
|
53
|
+
open<T>(options: LoginOptions, use: (client: AcpClient, read: AcpAccountRead) => Promise<T>): Promise<T>;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=account.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/acp/account.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACvF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAE3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAQ/C,iFAAiF;AACjF,eAAO,MAAM,0BAA0B,QAAS,CAAC;AAEjD,uGAAuG;AACvG,MAAM,WAAW,QAAQ;IACxB,OAAO,EAAE,UAAU,CAAC;IACpB,SAAS,EAAE,eAAe,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,SAAS,CAAC,CAAC;CACjE;AAED,8EAA8E;AAC9E,wBAAsB,QAAQ,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,CAQ5F;AAED,yEAAyE;AACzE,wBAAgB,WAAW,CAC1B,KAAK,EAAE,QAAQ,EACf,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,QAAQ,GAAG,KAAK,GAAG,KAAK,GAAG,WAAW,GAAG,eAAe,CAAC,GACvF,OAAO,CAAC,SAAS,CAAC,CAQpB;AAED,uEAAuE;AACvE,wBAAsB,UAAU,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAiBhG;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,IAAI;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpD,CASA;AAED,yFAAyF;AACzF,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,kBAAkB,CAAC;IACzB,OAAO,EAAE,kBAAkB,CAAC;CAC5B;AAED;;;;GAIG;AACH,qBAAa,UAAU;IACV,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,QAAQ;IAE5C,IAAI,SAAS,IAAI,eAAe,CAE/B;IAED,MAAM,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC;IAIhD;;;OAGG;IACG,OAAO,CAAC,CAAC,EACd,OAAO,EAAE,YAAY,EACrB,GAAG,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,kBAAkB,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,GAC3E,OAAO,CAAC,CAAC,CAAC;IAqBb,uFAAuF;IACvF,IAAI,CAAC,CAAC,EACL,OAAO,EAAE,YAAY,EACrB,GAAG,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,cAAc,KAAK,OAAO,CAAC,CAAC,CAAC,GAC1D,OAAO,CAAC,CAAC,CAAC;CAUb"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import type { AgentInput } from "../../../protocol/index.ts";
|
|
1
|
+
import type { AgentCapabilities, AgentHarness, AgentInput, ModelDescriptor } from "../../../protocol/index.ts";
|
|
2
2
|
import { type NativeProcesses } from "../../processes/native-processes.ts";
|
|
3
|
-
import type { AgentExecuteOptions, RawAgentEvent } from "../base.ts";
|
|
3
|
+
import type { AgentExecuteOptions, ListModelsOptions, RawAgentEvent } from "../base.ts";
|
|
4
4
|
import { type HostTools } from "../host-tools.ts";
|
|
5
|
+
import type { CliLogin } from "../login.ts";
|
|
5
6
|
import { SessionAgent } from "../session-agent.ts";
|
|
6
|
-
import { AcpClient,
|
|
7
|
+
import type { AcpClient, AcpClientOptions, AcpLaunch } from "./client.ts";
|
|
8
|
+
import { type AcpProfile } from "./profile.ts";
|
|
7
9
|
export interface AcpAgentOptions {
|
|
8
10
|
/**
|
|
9
11
|
* Resolve the ACP agent subprocess to launch. Operator-level only — never
|
|
@@ -45,36 +47,36 @@ export interface AcpAgentOptions {
|
|
|
45
47
|
hostTools?: HostTools;
|
|
46
48
|
}
|
|
47
49
|
/**
|
|
48
|
-
* ACP
|
|
49
|
-
* subprocess (one per logical session, reused across turns).
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
50
|
+
* An ACP agent running a profile: drives an Agent Client Protocol v1 agent
|
|
51
|
+
* as a long-lived subprocess (one per logical session, reused across turns).
|
|
52
|
+
* What is one agent's own, its name, its launch command and where it departs
|
|
53
|
+
* from its `initialize`, is its profile; `initialize` negotiates the protocol
|
|
54
|
+
* version and gates optional features (resume, images) on the agent's
|
|
55
|
+
* advertised capabilities. The turn's stopReason arrives as the
|
|
53
56
|
* `session/prompt` *response*, so `execute` re-injects it into the raw stream
|
|
54
|
-
* as a synthetic `session/prompt_result` event for the adapter.
|
|
57
|
+
* as a synthetic `session/prompt_result` event for the adapter. Internal to
|
|
58
|
+
* the engine: a harness that is a profile constructs it in its registration
|
|
59
|
+
* (`geminiHarness`); `AcpAgent` is the `acp` harness.
|
|
55
60
|
*/
|
|
56
|
-
export declare class
|
|
61
|
+
export declare class ProfiledAcpAgent extends SessionAgent {
|
|
57
62
|
private readonly agentOptions;
|
|
58
|
-
readonly harness:
|
|
59
|
-
readonly capabilities:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
thinkingLevels: boolean;
|
|
64
|
-
images: boolean;
|
|
65
|
-
files: ((string & {}) | "text" | "pdf" | "binary")[];
|
|
66
|
-
mcpServers: boolean;
|
|
67
|
-
permissionRequests: boolean;
|
|
68
|
-
rejectionMessages: boolean;
|
|
69
|
-
turnScopedSubagents?: boolean | undefined;
|
|
70
|
-
steering?: boolean | undefined;
|
|
71
|
-
ignoredSettings?: string[] | undefined;
|
|
72
|
-
};
|
|
63
|
+
readonly harness: AgentHarness;
|
|
64
|
+
readonly capabilities: AgentCapabilities;
|
|
65
|
+
readonly login?: CliLogin;
|
|
66
|
+
/** Present when its profile lists models: what the agent offers this login. */
|
|
67
|
+
readonly listModels?: (options: ListModelsOptions) => Promise<ModelDescriptor[]>;
|
|
73
68
|
/** Its CLIs start here: the runtime's, or this OS process's own when it was made without one. */
|
|
74
69
|
readonly processes: NativeProcesses;
|
|
70
|
+
private readonly profile;
|
|
75
71
|
private readonly sessions;
|
|
76
72
|
private readonly host?;
|
|
77
|
-
|
|
73
|
+
/** How its agents start: its profile's, on its processes. */
|
|
74
|
+
private readonly starts;
|
|
75
|
+
/** The agent with no turn: its account, for the login and the model list. */
|
|
76
|
+
private readonly account;
|
|
77
|
+
/** What each session's conversation was started with, when this agent started it (`newSession`). */
|
|
78
|
+
private readonly startedWith;
|
|
79
|
+
constructor(profile: AcpProfile, agentOptions: Omit<AcpAgentOptions, "resolveLaunch">);
|
|
78
80
|
private resolveSession;
|
|
79
81
|
protected hostSecret(sessionId: string): string | undefined;
|
|
80
82
|
/**
|
|
@@ -91,26 +93,53 @@ export declare class AcpAgent extends SessionAgent {
|
|
|
91
93
|
*/
|
|
92
94
|
private spawn;
|
|
93
95
|
/**
|
|
94
|
-
* Select the requested model
|
|
95
|
-
* options
|
|
96
|
-
* agent does not offer
|
|
97
|
-
*
|
|
98
|
-
*
|
|
96
|
+
* Select the requested model, then the thinking level, through the agent's
|
|
97
|
+
* config options; an agent without the option keeps its own default. A
|
|
98
|
+
* model the agent does not offer, or its profile does not take, fails the
|
|
99
|
+
* turn; a turn that names none on a profile that lists models runs the
|
|
100
|
+
* one its list marks default (`defaultModel`). The levels are the ones
|
|
101
|
+
* offered once the model is set, which are that model's, and the turn
|
|
102
|
+
* runs the nearest of them, as on Claude and Codex (`clampThinkingLevel`);
|
|
103
|
+
* a level that cannot be fitted is left alone. Returns the settings it
|
|
104
|
+
* left alone.
|
|
99
105
|
*/
|
|
100
106
|
private applyConfig;
|
|
107
|
+
/**
|
|
108
|
+
* What a conversation keeps from its start (`newSession`), said not
|
|
109
|
+
* applied by a later turn that asks otherwise; what a conversation this
|
|
110
|
+
* agent did not start was given is unknown, and nothing is said.
|
|
111
|
+
*/
|
|
112
|
+
private keptFromStart;
|
|
101
113
|
/**
|
|
102
114
|
* Put the agent in the turn's permission mode (`default` when it names
|
|
103
|
-
* none) through `session/set_mode`, by the agent's own id for it.
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
* has
|
|
115
|
+
* none) through `session/set_mode`, by the agent's own id for it. An agent
|
|
116
|
+
* with no id for the mode is put in its `default`, never left in the mode
|
|
117
|
+
* an earlier turn left it in, and the engine answers what it asks by the
|
|
118
|
+
* turn's mode (`autoDecide`), as for an agent that offers no modes; neither
|
|
119
|
+
* has a plan of its own to make, so `plan` does not hold there. An agent
|
|
120
|
+
* with no `default` either stays where it is: in a mode the engine names
|
|
121
|
+
* and was not asked, the turn is refused; in one it cannot name, it runs,
|
|
122
|
+
* and the mode is said not applied. Returns whether the mode holds.
|
|
108
123
|
*/
|
|
109
124
|
private applyMode;
|
|
110
125
|
protected executeTurn(input: AgentInput, options: AgentExecuteOptions, controller: AbortController): AsyncIterableIterator<RawAgentEvent>;
|
|
126
|
+
/** A steer's file of a kind the harness does not take is refused, as a turn's is. */
|
|
127
|
+
protected checkSteerInput(input: AgentInput): void;
|
|
111
128
|
release(sessionId: string): Promise<void>;
|
|
129
|
+
/**
|
|
130
|
+
* The agent's login changed (in `store`, or in every store): each session's
|
|
131
|
+
* next turn starts a new agent, which resumes its conversation.
|
|
132
|
+
*/
|
|
133
|
+
loginChanged(store?: string): void;
|
|
112
134
|
/** After a host resume, each session's next turn starts its agent again, on its conversation. */
|
|
113
135
|
invalidateMcpConnections(): void;
|
|
114
136
|
terminateAll(): Promise<void>;
|
|
115
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* The `acp` harness: any ACP v1 agent the operator launches
|
|
140
|
+
* (`resolveLaunch`), taken at its `initialize`'s word.
|
|
141
|
+
*/
|
|
142
|
+
export declare class AcpAgent extends ProfiledAcpAgent {
|
|
143
|
+
constructor(options: AcpAgentOptions);
|
|
144
|
+
}
|
|
116
145
|
//# sourceMappingURL=acp-agent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acp-agent.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/acp/acp-agent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"acp-agent.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/acp/acp-agent.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACX,iBAAiB,EACjB,YAAY,EACZ,UAAU,EAEV,eAAe,EAGf,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,KAAK,eAAe,EAAyB,MAAM,qCAAqC,CAAC;AAOlG,OAAO,KAAK,EACX,mBAAmB,EAEnB,iBAAiB,EACjB,aAAa,EACb,MAAM,YAAY,CAAC;AAEpB,OAAO,EAGN,KAAK,SAAS,EAId,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAUnD,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAY1E,OAAO,EAAE,KAAK,UAAU,EAAqB,MAAM,cAAc,CAAC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,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAa;IACrC,oGAAoG;IACpG,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA6D;gBAGxF,OAAO,EAAE,UAAU,EACF,YAAY,EAAE,IAAI,CAAC,eAAe,EAAE,eAAe,CAAC;YAoDxD,cAAc;cAeT,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAKpE;;;;OAIG;YACW,UAAU;IAyBxB;;;;;OAKG;YACW,KAAK;IA2InB;;;;;;;;;;OAUG;YACW,WAAW;IAoCzB;;;;OAIG;IACH,OAAO,CAAC,aAAa;IASrB;;;;;;;;;;OAUG;YACW,SAAS;cA6BG,WAAW,CACpC,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,mBAAmB,EAC5B,UAAU,EAAE,eAAe,GACzB,qBAAqB,CAAC,aAAa,CAAC;IAwHvC,qFAAqF;cAClE,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAI5C,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASxD;;;OAGG;IACH,YAAY,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;IAIlC,iGAAiG;IACjG,wBAAwB,IAAI,IAAI;IAIjB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;CAK5C;AAED;;;GAGG;AACH,qBAAa,QAAS,SAAQ,gBAAgB;gBACjC,OAAO,EAAE,eAAe;CAIpC"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import type { PromptResponse, SessionNotification } from "@agentclientprotocol/sdk";
|
|
2
|
+
import { type ErrorCategory } from "../../../protocol/index.ts";
|
|
2
3
|
import type { EventTransformer } from "../types.ts";
|
|
4
|
+
import type { AcpProfile } from "./profile.ts";
|
|
3
5
|
/**
|
|
4
6
|
* Parses ACP v1 raw events into AdapterEvents. The mapping is nearly identity:
|
|
5
7
|
* our part vocabulary (ToolKind, tool status, locations) was aligned to ACP up
|
|
6
8
|
* front, so chunks append to text/reasoning parts and
|
|
7
|
-
* `tool_call`/`tool_call_update` upsert tool parts by `toolCallId`.
|
|
9
|
+
* `tool_call`/`tool_call_update` upsert tool parts by `toolCallId`. Parts keep
|
|
10
|
+
* the order they came in: a message has one streaming part open at a time,
|
|
11
|
+
* which a new tool call or a chunk of the other kind finishes. Everything
|
|
8
12
|
* arrives through the SDK connection, which zod-validates inbound payloads —
|
|
9
13
|
* so the SDK's own types ARE the raw shapes (no defensive re-modelling).
|
|
10
14
|
*
|
|
@@ -13,7 +17,13 @@ import type { EventTransformer } from "../types.ts";
|
|
|
13
17
|
* - `{method: "session/prompt_result", params: PromptResponse}` (synthetic —
|
|
14
18
|
* ACP returns the turn's stopReason as the prompt *response*, not as a
|
|
15
19
|
* notification, so the agent re-injects it into the event stream)
|
|
16
|
-
* - `{method: "error", params: {message}}` (synthetic,
|
|
20
|
+
* - `{method: "error", params: {message, category?, usage?}}` (synthetic, a
|
|
21
|
+
* prompt that failed: its category when the reader knows it, and the usage
|
|
22
|
+
* of an answer a harness reads as a failure)
|
|
23
|
+
* - `{method: "agentServer/mcpServers", params: {names}}` (synthetic, the
|
|
24
|
+
* session's MCP servers, for a harness's tool rules)
|
|
25
|
+
* - `{method: "agentServer/steerRead", params: {steerId}}` (synthetic, the
|
|
26
|
+
* agent took a steer sent as a prompt)
|
|
17
27
|
*
|
|
18
28
|
* v1 `messageId` on chunks is optional: when present, a change opens a new
|
|
19
29
|
* wire message; when absent the whole turn is one message (the processor
|
|
@@ -29,11 +39,26 @@ export type AcpRawEvent = {
|
|
|
29
39
|
method: "error";
|
|
30
40
|
params: {
|
|
31
41
|
message?: string;
|
|
42
|
+
category?: ErrorCategory;
|
|
43
|
+
usage?: PromptResponse["usage"];
|
|
44
|
+
};
|
|
45
|
+
} | {
|
|
46
|
+
method: "agentServer/mcpServers";
|
|
47
|
+
params: {
|
|
48
|
+
names: string[];
|
|
49
|
+
};
|
|
50
|
+
} | {
|
|
51
|
+
method: "agentServer/steerRead";
|
|
52
|
+
params: {
|
|
53
|
+
steerId: string;
|
|
32
54
|
};
|
|
33
55
|
};
|
|
34
56
|
/** How a turn the agent did not get to answer ends: cancelled. */
|
|
35
57
|
export declare const CANCELLED_PROMPT_RESULT: AcpRawEvent;
|
|
58
|
+
/** What of its harness's profile an ACP turn's adapter reads: its tool rules and its mode ids. */
|
|
59
|
+
export type AcpReading = Pick<AcpProfile, "tools" | "modeIds">;
|
|
60
|
+
/** An ACP turn's adapter; `reading` is what of its harness's profile it reads beyond ACP. */
|
|
36
61
|
export declare function createAcpTransformer(ctx: {
|
|
37
62
|
sessionId: string;
|
|
38
|
-
}): EventTransformer
|
|
63
|
+
}, reading?: AcpReading): EventTransformer<AcpRawEvent>;
|
|
39
64
|
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/acp/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEX,cAAc,EACd,mBAAmB,EAInB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/acp/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEX,cAAc,EACd,mBAAmB,EAInB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAEN,KAAK,aAAa,EAelB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAgB,gBAAgB,EAAmB,MAAM,aAAa,CAAC;AAEnF,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,cAAc,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,MAAM,WAAW,GACpB;IAAE,MAAM,EAAE,gBAAgB,CAAC;IAAC,MAAM,EAAE,mBAAmB,CAAA;CAAE,GACzD;IAAE,MAAM,EAAE,uBAAuB,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;CAAE,GACpE;IACA,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,aAAa,CAAC;QAAC,KAAK,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAA;KAAE,CAAC;CACvF,GACD;IAAE,MAAM,EAAE,wBAAwB,CAAC;IAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,CAAA;CAAE,GACjE;IAAE,MAAM,EAAE,uBAAuB,CAAC;IAAC,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC;AAEpE,kEAAkE;AAClE,eAAO,MAAM,uBAAuB,EAAE,WAGrC,CAAC;AAwCF,kGAAkG;AAClG,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE,OAAO,GAAG,SAAS,CAAC,CAAC;AAiR/D,6FAA6F;AAC7F,wBAAgB,oBAAoB,CACnC,GAAG,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,EAC1B,OAAO,CAAC,EAAE,UAAU,GAClB,gBAAgB,CAAC,WAAW,CAAC,CAE/B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { AgentNotificationMethod, AgentNotificationParamsByMethod, AgentRequestMethod, AgentRequestParamsByMethod, AgentRequestResponsesByMethod, CreateElicitationRequest, CreateElicitationResponse, RequestPermissionRequest, RequestPermissionResponse, SessionNotification } from "@agentclientprotocol/sdk";
|
|
1
|
+
import type { AgentNotificationMethod, AgentNotificationParamsByMethod, AgentRequestMethod, AgentRequestParamsByMethod, AgentRequestResponsesByMethod, AnyMessage, CreateElicitationRequest, CreateElicitationResponse, RequestPermissionRequest, RequestPermissionResponse, SessionNotification, Stream } from "@agentclientprotocol/sdk";
|
|
2
|
+
import type { AgentHarness } from "../../../protocol/index.ts";
|
|
2
3
|
import type { NativeProcesses } from "../../processes/native-processes.ts";
|
|
3
4
|
/**
|
|
4
5
|
* How to start one ACP agent subprocess. Operator-level only — the wire never
|
|
@@ -10,8 +11,61 @@ export interface AcpLaunch {
|
|
|
10
11
|
args?: string[];
|
|
11
12
|
/** Extra env layered onto the subprocess (over process.env). */
|
|
12
13
|
env?: Record<string, string>;
|
|
14
|
+
/**
|
|
15
|
+
* Env set over every other, the turn's included, which comes from the
|
|
16
|
+
* wire: what the engine keeps for its own reasons (a pinned CLI's
|
|
17
|
+
* self-update off), for a turn, a read with no turn and a sign-in alike.
|
|
18
|
+
*/
|
|
19
|
+
fixedEnv?: Record<string, string>;
|
|
13
20
|
}
|
|
14
21
|
type SessionUpdateHandler = (notification: SessionNotification) => void;
|
|
22
|
+
/**
|
|
23
|
+
* What the agent is asking on one connection, read from the messages
|
|
24
|
+
* themselves, for an agent steered by prompt, which refuses a prompt while it
|
|
25
|
+
* asks. A request (a `method` and an `id`) is open from its arrival, through
|
|
26
|
+
* our answer to it (that `id`, no `method`) being handed to the writer, until
|
|
27
|
+
* the agent shows it acted on that answer: its next `session/update` for the
|
|
28
|
+
* same session about the tool call the request names
|
|
29
|
+
* (`params.toolCall.toolCallId`, a permission's; `params.toolCallId`,
|
|
30
|
+
* Antigravity's question). An agent may apply an answer after it was written
|
|
31
|
+
* (Antigravity does), and nothing else says it has. A request that names no
|
|
32
|
+
* tool call cannot be seen acted on: it stays open until nothing is asked any
|
|
33
|
+
* more (`askNothing`). A prompt goes down the same writable as the answers,
|
|
34
|
+
* so one sent once `idle()` settles reaches an agent that has acted on every
|
|
35
|
+
* answer it waited for.
|
|
36
|
+
*/
|
|
37
|
+
export declare class AgentRequests {
|
|
38
|
+
/** Each open request, by its id: what it is about, and whether our answer is given. */
|
|
39
|
+
private readonly open;
|
|
40
|
+
private arrivals;
|
|
41
|
+
private waiters;
|
|
42
|
+
/** The connection's messages, counted as they pass: what `AcpClient` hands the SDK. */
|
|
43
|
+
watch(stream: Stream): Stream;
|
|
44
|
+
/**
|
|
45
|
+
* A message from the agent: an update acts on the answers given before it
|
|
46
|
+
* that wait for it, and a request opens what it asks.
|
|
47
|
+
*/
|
|
48
|
+
received(message: AnyMessage | readonly AnyMessage[]): void;
|
|
49
|
+
/** A message on its way to the agent: an answer is given, and the agent is yet to act on it. */
|
|
50
|
+
written(message: AnyMessage | readonly AnyMessage[]): void;
|
|
51
|
+
/** Whether the agent is waiting for an answer. */
|
|
52
|
+
get pending(): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* How many requests have arrived so far: a mark a later request passes
|
|
55
|
+
* (`arrivedSince`).
|
|
56
|
+
*/
|
|
57
|
+
get arrived(): number;
|
|
58
|
+
/** Whether a request arrived after `mark` (`arrived`, read earlier). */
|
|
59
|
+
arrivedSince(mark: number): boolean;
|
|
60
|
+
/** Settles once the agent asks nothing, or nothing is asked any more (`askNothing`). */
|
|
61
|
+
idle(): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Nothing is asked any more: the connection is gone, or the turn that
|
|
64
|
+
* asked has ended, so a request the agent never acted on is forgotten.
|
|
65
|
+
*/
|
|
66
|
+
askNothing(): void;
|
|
67
|
+
private wake;
|
|
68
|
+
}
|
|
15
69
|
/** Answers agent→client `session/request_permission`. Absent handler → cancelled. */
|
|
16
70
|
type AcpPermissionHandler = (request: RequestPermissionRequest) => Promise<RequestPermissionResponse>;
|
|
17
71
|
/** Answers agent→client `elicitation/create`. Absent handler → declined. */
|
|
@@ -27,8 +81,15 @@ export interface AcpClientOptions {
|
|
|
27
81
|
* recorded for `sessionId` (`createAgentRegistry` passes the runtime's).
|
|
28
82
|
*/
|
|
29
83
|
processes: NativeProcesses;
|
|
84
|
+
/** The harness it runs under, which its record names. */
|
|
85
|
+
harness: AgentHarness;
|
|
30
86
|
/** The logical session it serves, which its record names. */
|
|
31
87
|
sessionId?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Count what the agent asks on the connection (`asking`), for an agent
|
|
90
|
+
* steered by prompt; otherwise the SDK gets the stream as it is.
|
|
91
|
+
*/
|
|
92
|
+
watchRequests?: boolean;
|
|
32
93
|
}
|
|
33
94
|
/**
|
|
34
95
|
* One ACP agent subprocess + its SDK connection. The engine talks to any
|
|
@@ -47,12 +108,15 @@ export declare class AcpClient {
|
|
|
47
108
|
private readonly closeHandlers;
|
|
48
109
|
private permissionHandler?;
|
|
49
110
|
private elicitationHandler?;
|
|
111
|
+
/** What the agent is asking, until it acted on each answer: present when `watchRequests` says so. */
|
|
112
|
+
readonly asking?: AgentRequests;
|
|
50
113
|
private exited;
|
|
51
114
|
/** The stop of its process, once one began: what `gone` waits for. */
|
|
52
115
|
private leaving?;
|
|
53
116
|
/** Why the agent stopped, once it has: its exit code and stderr tail. */
|
|
54
117
|
private exitError?;
|
|
55
|
-
private
|
|
118
|
+
private readonly pending;
|
|
119
|
+
private connectionEnd?;
|
|
56
120
|
private constructor();
|
|
57
121
|
/** Spawn the agent and connect. Fails if `@agentclientprotocol/sdk` is absent. */
|
|
58
122
|
static create(opts: AcpClientOptions): Promise<AcpClient>;
|
|
@@ -73,8 +137,6 @@ export declare class AcpClient {
|
|
|
73
137
|
* pass no timeout.
|
|
74
138
|
*/
|
|
75
139
|
request<M extends AgentRequestMethod>(method: M, params: AgentRequestParamsByMethod[M], timeoutMs?: number): Promise<AgentRequestResponsesByMethod[M]>;
|
|
76
|
-
/** Why the agent exited, waiting briefly for its exit when the connection went first. */
|
|
77
|
-
private whyExited;
|
|
78
140
|
private send;
|
|
79
141
|
/** Send a notification to the agent (`session/cancel`). */
|
|
80
142
|
notify<M extends AgentNotificationMethod>(method: M, params: AgentNotificationParamsByMethod[M]): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/acp/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/acp/client.ts"],"names":[],"mappings":"AAEA,OAAO,K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ACP agents — UX sugar, not wire vocabulary
|
|
5
5
|
* (like the model catalog). On the wire the harness is always `acp`; these names
|
|
6
|
-
* let entry points offer "pi" or "gemini" as first-class choices and expand
|
|
6
|
+
* let entry points offer "pi" or "gemini-cli" as first-class choices and expand
|
|
7
7
|
* them to launch commands at the operator edge. Anything not listed here runs
|
|
8
8
|
* via an explicit launch command — any ACP-compatible agent works.
|
|
9
9
|
*/
|
|
@@ -29,7 +29,9 @@ export declare function resolveHarnessName(name: string): {
|
|
|
29
29
|
/**
|
|
30
30
|
* Resolve an operator spec that is either a known agent name (`"pi"`) or a
|
|
31
31
|
* raw launch command (`"npx -y pi-acp"`). The canonical resolver behind
|
|
32
|
-
* `--acp-agent` and `$AGENT_SERVER_ACP_AGENT`.
|
|
32
|
+
* `--acp-agent` and `$AGENT_SERVER_ACP_AGENT`. A harness's own name is no
|
|
33
|
+
* ACP agent and no command to launch: it is refused, naming the harness and
|
|
34
|
+
* the known agents, so an old setting (`gemini`) says what to write instead.
|
|
33
35
|
*/
|
|
34
36
|
export declare function resolveAcpLaunch(spec: string | undefined): AcpLaunch | undefined;
|
|
35
37
|
//# sourceMappingURL=known-agents.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"known-agents.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/acp/known-agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAkB,MAAM,4BAA4B,CAAC;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,SAAS,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"known-agents.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/acp/known-agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAkB,MAAM,4BAA4B,CAAC;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,SAAS,CAAA;CAAE,CAYjF,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAI9E;AAOD;;;;GAIG;AACH,wBAAgB,kBAAkB,CACjC,IAAI,EAAE,MAAM,GACV;IAAE,OAAO,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAI1D;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAShF"}
|