@zvada/agent-server 0.3.27 → 0.3.30
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 +61 -0
- package/README.md +6 -4
- package/dist/core/agents/acp/account.js +111 -0
- package/dist/core/agents/acp/acp-agent.js +249 -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/claude-agent.js +2 -12
- package/dist/core/agents/claude-code/login.js +4 -1
- package/dist/core/agents/claude-code/session.js +50 -18
- package/dist/core/agents/claude-code/spawn.js +0 -26
- package/dist/core/agents/claude-code/turn.js +6 -2
- 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 +138 -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 +201 -90
- package/dist/operator/render.js +34 -28
- 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/config.js +4 -2
- package/dist/protocol/credentials.js +9 -1
- package/dist/protocol/harness.js +9 -1
- package/dist/protocol/part-input.js +2 -6
- package/dist/protocol/text-parts.js +10 -0
- 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 +97 -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/claude-agent.d.ts +1 -2
- package/dist/types/core/agents/claude-code/claude-agent.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/options.d.ts +1 -1
- package/dist/types/core/agents/claude-code/options.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/session.d.ts +7 -6
- 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/claude-code/turn.d.ts +3 -2
- package/dist/types/core/agents/claude-code/turn.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 +5 -4
- 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 +6 -2
- 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/part-input.d.ts.map +1 -1
- package/dist/types/protocol/text-parts.d.ts +10 -0
- package/dist/types/protocol/text-parts.d.ts.map +1 -0
- 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 +8 -1
- package/docs/deploy.md +17 -8
- package/docs/harnesses.md +173 -44
- package/package.json +1 -1
- package/src/core/agents/acp/account.ts +158 -0
- package/src/core/agents/acp/acp-agent.ts +290 -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 +133 -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/claude-agent.ts +2 -13
- package/src/core/agents/claude-code/login.ts +4 -1
- package/src/core/agents/claude-code/options.ts +1 -1
- package/src/core/agents/claude-code/session.ts +50 -16
- package/src/core/agents/claude-code/spawn.ts +0 -26
- package/src/core/agents/claude-code/turn.ts +7 -2
- 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 +163 -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 +208 -91
- package/src/operator/render.ts +61 -33
- package/src/operator/session-tools.ts +2 -1
- package/src/operator/types.ts +5 -4
- package/src/protocol/account.ts +5 -2
- package/src/protocol/auth.ts +5 -1
- package/src/protocol/config.ts +4 -2
- package/src/protocol/credentials.ts +11 -2
- package/src/protocol/harness.ts +9 -1
- package/src/protocol/part-input.ts +2 -5
- package/src/protocol/text-parts.ts +10 -0
- package/src/server/bin.ts +20 -6
- package/src/server/install.ts +6 -3
package/dist/operator/render.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* name alone is ambiguous.
|
|
7
7
|
*/
|
|
8
8
|
import { PLAN_OPTION_IDS } from "../protocol/plan.js";
|
|
9
|
+
import { joinTextParts } from "../protocol/text-parts.js";
|
|
9
10
|
const clip = (text, limit) => text.length > limit ? `${text.slice(0, limit - 1)}…` : text;
|
|
10
11
|
// @ref LLP 0014#untrusted-text — text an agent wrote or a repository holds never starts a line
|
|
11
12
|
// Untrusted text (what an agent or a person wrote, a question, an option, an
|
|
@@ -22,26 +23,20 @@ const CONTROLS = /[\u0000-\u0008\u000e-\u001f\u007f-\u009f\u200e\u200f\u202a-\u2
|
|
|
22
23
|
const UNSAFE_IN_JSON = new RegExp(`${BREAKS.source}|${CONTROLS.source}`, "g");
|
|
23
24
|
/** The most messages `read_session` reads. */
|
|
24
25
|
export const MAX_LAST = 100;
|
|
26
|
+
/** A full read fits in one tool result, its continuation included. */
|
|
27
|
+
export const FULL_READ_LIMIT = 20_000;
|
|
25
28
|
/** Untrusted text as one line: no line breaks or controls, runs of space collapsed. */
|
|
26
29
|
export function oneLine(text) {
|
|
27
30
|
return text.replace(BREAKS, " ").replace(CONTROLS, "").replace(/\s+/g, " ").trim();
|
|
28
31
|
}
|
|
29
32
|
/** Untrusted text as a block: each of its lines carried after `QUOTE`. */
|
|
30
33
|
export function quote(text) {
|
|
31
|
-
return text
|
|
32
|
-
.replace(CONTROLS, "")
|
|
33
|
-
.split(BREAKS)
|
|
34
|
-
.map((line) => `${QUOTE}${line}`.trimEnd())
|
|
35
|
-
.join("\n");
|
|
34
|
+
return QUOTE + text.replace(CONTROLS, "").replace(BREAKS, `\n${QUOTE}`);
|
|
36
35
|
}
|
|
37
36
|
/** Untrusted text named in prose (a session, a project, an option): one JSON-quoted line. */
|
|
38
37
|
export const quoted = (text) => JSON.stringify(oneLine(text));
|
|
39
38
|
/** A label, then the untrusted text as a quoted block under it. */
|
|
40
39
|
const block = (label, text) => `${label}\n${quote(text)}`;
|
|
41
|
-
const textOf = (parts) => parts
|
|
42
|
-
.flatMap((part) => (part.type === "text" && "text" in part ? [String(part.text)] : []))
|
|
43
|
-
.join("")
|
|
44
|
-
.trim();
|
|
45
40
|
/**
|
|
46
41
|
* The next step, as the tool call that takes it:
|
|
47
42
|
* `-> answer_request(session: "voyager", answer: "<your answer>")`.
|
|
@@ -58,6 +53,16 @@ export function callHint(tool, args = {}) {
|
|
|
58
53
|
.map(([key, value]) => `${key}: ${json(value)}`);
|
|
59
54
|
return `-> ${tool}(${named.join(", ")})`;
|
|
60
55
|
}
|
|
56
|
+
/** A message preview and, if clipped, a read selecting its full text. */
|
|
57
|
+
function messageBlock(label, text, limit, context, selection) {
|
|
58
|
+
const shown = block(label, clip(text, limit));
|
|
59
|
+
if (text.length <= limit)
|
|
60
|
+
return shown;
|
|
61
|
+
if (selection.last !== undefined && selection.last > MAX_LAST)
|
|
62
|
+
return `${shown}\nmessage clipped. This reply is older than the last ${MAX_LAST} messages read_session can select.`;
|
|
63
|
+
const read = context.hint("read_session", { session: context.ref, ...selection, full: true });
|
|
64
|
+
return `${shown}\nmessage clipped.${read ? `\n ${read}` : ""}`;
|
|
65
|
+
}
|
|
61
66
|
/** A choice's labels on one line: `options: "USD", "EUR"`. */
|
|
62
67
|
const optionsLine = (labels) => `options: ${labels.map(quoted).join(", ")}`;
|
|
63
68
|
/** What ends a path in a command: a space, a quote, or the shell's punctuation. */
|
|
@@ -287,18 +292,18 @@ export function describeWaiting(waiting, context) {
|
|
|
287
292
|
const allow = answer("allow");
|
|
288
293
|
return `${block(`permission${named}:`, waiting.request.title)}${about}${options(choices)}${allow}${allow ? ` (or answer: "deny")` : ""}`;
|
|
289
294
|
}
|
|
290
|
-
/** The
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
295
|
+
/** The latest top-level reply since the sender spoke, and its position for a full read. */
|
|
296
|
+
function lastReply(messages, newer) {
|
|
297
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
298
|
+
const message = messages[i];
|
|
299
|
+
if (message?.role !== "assistant")
|
|
300
|
+
break;
|
|
301
|
+
if (message.nested)
|
|
302
|
+
continue;
|
|
303
|
+
const text = joinTextParts(message.parts);
|
|
304
|
+
if (text.trim())
|
|
305
|
+
return { text, last: newer + messages.length - i };
|
|
306
|
+
}
|
|
302
307
|
}
|
|
303
308
|
/** Every message of a view, oldest first. */
|
|
304
309
|
export const messagesOf = (view) => view.turns.flatMap((turn) => turn.messages);
|
|
@@ -334,9 +339,9 @@ export function renderOutcome(view, context) {
|
|
|
334
339
|
const lines = [
|
|
335
340
|
`status: ${fresh ? "idle (no messages yet)" : (STATUS_WORDS[view.status] ?? view.status)}`,
|
|
336
341
|
];
|
|
337
|
-
const reply = lastReply(messages);
|
|
342
|
+
const reply = lastReply(messages, context.newer ?? 0);
|
|
338
343
|
if (reply)
|
|
339
|
-
lines.push(
|
|
344
|
+
lines.push(messageBlock("agent said:", reply.text, 1500, context, { last: reply.last }));
|
|
340
345
|
for (const waiting of view.waiting)
|
|
341
346
|
lines.push(describeWaiting(waiting, perRequest(context, waiting)));
|
|
342
347
|
if (view.status === "error") {
|
|
@@ -345,7 +350,7 @@ export function renderOutcome(view, context) {
|
|
|
345
350
|
}
|
|
346
351
|
if (context.note)
|
|
347
352
|
lines.push(oneLine(context.note));
|
|
348
|
-
if (view.status === "error"
|
|
353
|
+
if (view.status === "error") {
|
|
349
354
|
const read = hint("read_session", { session: ref });
|
|
350
355
|
if (read)
|
|
351
356
|
lines.push(` ${read}`);
|
|
@@ -397,7 +402,8 @@ function endOf(turn, you) {
|
|
|
397
402
|
export function renderConversation(view, options) {
|
|
398
403
|
const { root, you } = options;
|
|
399
404
|
const lines = options.header ? [options.header] : [];
|
|
400
|
-
const limit = options.
|
|
405
|
+
const limit = options.after ? Number.POSITIVE_INFINITY : (options.last ?? 10);
|
|
406
|
+
const selection = options.after ? { after: options.after } : { last: limit };
|
|
401
407
|
let count = 0;
|
|
402
408
|
const shownTurns = [];
|
|
403
409
|
for (let t = view.turns.length - 1; t >= 0 && count < limit; t--) {
|
|
@@ -409,9 +415,9 @@ export function renderConversation(view, options) {
|
|
|
409
415
|
const working = view.status === "working" || view.status === "needs_input";
|
|
410
416
|
for (const { turn, messages } of shownTurns) {
|
|
411
417
|
for (const message of messages) {
|
|
412
|
-
const text =
|
|
418
|
+
const text = joinTextParts(message.parts);
|
|
413
419
|
if (message.role === "user") {
|
|
414
|
-
lines.push(
|
|
420
|
+
lines.push(messageBlock(senderLabel(message.origin, you), text, options.full ? Number.POSITIVE_INFINITY : 800, options, selection));
|
|
415
421
|
continue;
|
|
416
422
|
}
|
|
417
423
|
for (const part of message.parts) {
|
|
@@ -423,7 +429,7 @@ export function renderConversation(view, options) {
|
|
|
423
429
|
lines.push(asked.replace(/^/gm, " "));
|
|
424
430
|
}
|
|
425
431
|
if (text)
|
|
426
|
-
lines.push(
|
|
432
|
+
lines.push(messageBlock("[agent]", text, options.full ? Number.POSITIVE_INFINITY : 1200, options, selection));
|
|
427
433
|
}
|
|
428
434
|
const end = endOf(turn, you);
|
|
429
435
|
if (end)
|
|
@@ -22,7 +22,8 @@ export const OPERATOR_GUIDANCE = [
|
|
|
22
22
|
"tell the person. Change sessions the person started (message, stop) only",
|
|
23
23
|
"when the person asked you to. A message is sent only while your call is",
|
|
24
24
|
"open: to a busy session after its turn ends, if that happens within the",
|
|
25
|
-
"call; otherwise the answer says nothing was sent
|
|
25
|
+
"call; otherwise the answer says nothing was sent. End your turn with your",
|
|
26
|
+
"report for a busy starter to receive if it is waiting for you. You",
|
|
26
27
|
"cannot act on your own session, and limits apply to how many sessions you",
|
|
27
28
|
"start and how deep they nest: a refusal says which and what to do. Messages",
|
|
28
29
|
"from other agents start with a line saying so; treat them as a colleague's",
|
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(),
|
package/dist/protocol/config.js
CHANGED
|
@@ -5,8 +5,10 @@ import { AgentInputSchema } from "./part-input.js";
|
|
|
5
5
|
import { ThinkingLevelSchema } from "./thinking.js";
|
|
6
6
|
import { openVocabulary } from "./vocabulary.js";
|
|
7
7
|
/**
|
|
8
|
-
* Permission posture for a turn. `bypass_permissions`
|
|
9
|
-
*
|
|
8
|
+
* Permission posture for a turn. In `bypass_permissions` the engine allows every call it is
|
|
9
|
+
* asked about and starts Claude, Codex and Gemini with their own sandbox off; another ACP
|
|
10
|
+
* agent's is its own (LLP 0001, D4). This is the right default inside a product's own
|
|
11
|
+
* sandbox. `plan` is read-only planning;
|
|
10
12
|
* `dont_ask` never prompts — unapproved tools are denied, sandboxes stay at
|
|
11
13
|
* their normal (non-dangerous) level. Values are snake_case (LLP 0002, Casing);
|
|
12
14
|
* adapters map to provider vocabulary at the edge (Claude SDK: acceptEdits,
|
|
@@ -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) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { joinTextParts } from "./text-parts.js";
|
|
2
3
|
/**
|
|
3
4
|
* A UI-authored span over the text (mentions, pills, inline references) that
|
|
4
5
|
* survives the round trip through the model, the user echo, and persistence.
|
|
@@ -85,10 +86,5 @@ export function parseAgentInput(value) {
|
|
|
85
86
|
}
|
|
86
87
|
/** Collapse an AgentInput down to the text the model sees first. */
|
|
87
88
|
export function inputToText(input) {
|
|
88
|
-
|
|
89
|
-
return input;
|
|
90
|
-
return input
|
|
91
|
-
.filter((p) => p.type === "text")
|
|
92
|
-
.map((p) => p.text)
|
|
93
|
-
.join("\n\n");
|
|
89
|
+
return typeof input === "string" ? input : joinTextParts(input);
|
|
94
90
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A part boundary can fall inside a sentence (an ACP thought or tool call
|
|
3
|
+
* between two chunks, a mention in an input). It then shows as a break with
|
|
4
|
+
* no words lost: nothing on the stream tells it from two passages.
|
|
5
|
+
*/
|
|
6
|
+
export function joinTextParts(parts) {
|
|
7
|
+
return parts
|
|
8
|
+
.flatMap((part) => (part.type === "text" && part.text ? [part.text] : []))
|
|
9
|
+
.join("\n\n");
|
|
10
|
+
}
|
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":"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"}
|