@agentclientprotocol/claude-agent-acp 0.106.0 → 0.106.1-preview.10
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 +1 -76
- package/dist/async-tasks.d.ts +1 -1
- package/dist/async-tasks.js +1 -1
- package/dist/context-window.d.ts +11 -9
- package/dist/context-window.d.ts.map +1 -1
- package/dist/context-window.js +12 -13
- package/dist/managed-policy.d.ts +9 -0
- package/dist/managed-policy.d.ts.map +1 -1
- package/dist/managed-policy.js +25 -0
- package/dist/native-subagents.d.ts +72 -9
- package/dist/native-subagents.d.ts.map +1 -1
- package/dist/native-subagents.js +130 -12
- package/dist/session-failure-extension.d.ts +15 -1
- package/dist/session-failure-extension.d.ts.map +1 -1
- package/dist/session-failure-extension.js +63 -0
- package/dist/session-fast-mode.d.ts +16 -10
- package/dist/session-fast-mode.d.ts.map +1 -1
- package/dist/session-fast-mode.js +36 -25
- package/dist/session-index/transcript-scan.d.ts +4 -2
- package/dist/session-index/transcript-scan.d.ts.map +1 -1
- package/dist/session-index/transcript-scan.js +67 -12
- package/dist/session-model.d.ts +22 -16
- package/dist/session-model.d.ts.map +1 -1
- package/dist/session-model.js +66 -38
- package/dist/session-usage.d.ts +8 -17
- package/dist/session-usage.d.ts.map +1 -1
- package/dist/session-usage.js +8 -21
- package/dist/settings.d.ts +2 -0
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +12 -0
- package/dist/subagent-replay.d.ts +16 -1
- package/dist/subagent-replay.d.ts.map +1 -1
- package/dist/subagent-replay.js +28 -1
- package/dist/tool-calls/renderer.d.ts +26 -0
- package/dist/tool-calls/renderer.d.ts.map +1 -1
- package/dist/tool-calls/renderer.js +30 -0
- package/dist/v1/acp-agent.d.ts +31 -68
- package/dist/v1/acp-agent.d.ts.map +1 -1
- package/dist/v1/acp-agent.js +71 -271
- package/dist/v1/async-task-stop.d.ts +11 -0
- package/dist/v1/async-task-stop.d.ts.map +1 -0
- package/dist/v1/async-task-stop.js +18 -0
- package/dist/v1/session-fingerprint.d.ts +16 -0
- package/dist/v1/session-fingerprint.d.ts.map +1 -0
- package/dist/v1/session-fingerprint.js +129 -0
- package/dist/v1/steering.d.ts +48 -0
- package/dist/v1/steering.d.ts.map +1 -0
- package/dist/v1/steering.js +41 -0
- package/dist/v2/agent.js +10 -4
- package/dist/v2/outcome.d.ts +3 -2
- package/dist/v2/outcome.d.ts.map +1 -1
- package/dist/v2/outcome.js +8 -3
- package/dist/v2/reports.d.ts +2 -2
- package/dist/v2/reports.d.ts.map +1 -1
- package/dist/v2/reports.js +3 -6
- package/dist/v2/session.d.ts +11 -4
- package/dist/v2/session.d.ts.map +1 -1
- package/dist/v2/session.js +18 -4
- package/dist/v2/setup.js +1 -1
- package/dist/v2/stream.d.ts +2 -4
- package/dist/v2/stream.d.ts.map +1 -1
- package/dist/v2/stream.js +5 -9
- package/dist/v2/subagent-replay.js +2 -2
- package/dist/v2/tasks.d.ts +29 -11
- package/dist/v2/tasks.d.ts.map +1 -1
- package/dist/v2/tasks.js +69 -19
- package/dist/v2/tool-call.js +3 -0
- package/package.json +5 -5
package/dist/v2/tasks.d.ts
CHANGED
|
@@ -116,6 +116,11 @@ export declare class SessionTasks {
|
|
|
116
116
|
* their input, and the call that delegated the run.
|
|
117
117
|
*/
|
|
118
118
|
private readonly handbacks;
|
|
119
|
+
/**
|
|
120
|
+
* The agent that each TaskStop or SendMessage call names (`targetAgentId`),
|
|
121
|
+
* until the call's final update.
|
|
122
|
+
*/
|
|
123
|
+
private readonly targetByToolCall;
|
|
119
124
|
/** The restore of a subagent from the session's history, while it reads it (see {@link restore}). */
|
|
120
125
|
private restoring;
|
|
121
126
|
constructor(host: TaskHost,
|
|
@@ -265,14 +270,17 @@ export declare class SessionTasks {
|
|
|
265
270
|
message: string;
|
|
266
271
|
} | undefined): void;
|
|
267
272
|
/**
|
|
268
|
-
* Claude Code mounted a fresh conversation (`conversation_reset`).
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
* child
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
*
|
|
273
|
+
* Claude Code mounted a fresh conversation (`conversation_reset`). Every
|
|
274
|
+
* child is forgotten: a later event of one changes nothing, and a child not
|
|
275
|
+
* announced yet stays unexposed. Claude Code's tasks (the live subagents,
|
|
276
|
+
* background commands and other tasks) stay as its task events report them,
|
|
277
|
+
* so a child that works may go on working, unobserved. As on v1
|
|
278
|
+
* (`finishAll`), each such child, deeper ones first, goes `unknown`, as the
|
|
279
|
+
* RFD requires when a child can no longer be observed, on its stream and in
|
|
280
|
+
* its parent's mirror, and loses its `cancel` capability: a forgotten child
|
|
281
|
+
* cannot be stopped. Nothing says that its run or its tool calls ended, so
|
|
282
|
+
* its unfinished tool calls keep their status. A child that is idle keeps
|
|
283
|
+
* its state.
|
|
276
284
|
*/
|
|
277
285
|
conversationReset(): void;
|
|
278
286
|
/**
|
|
@@ -349,9 +357,20 @@ export declare class SessionTasks {
|
|
|
349
357
|
* Rewrites an update of `output`, the output of the root or of `child`: an
|
|
350
358
|
* update of an Agent or Task call goes out as {@link launchUpdate} says,
|
|
351
359
|
* and Claude Code's late result of a call that the child's stop ended
|
|
352
|
-
* goes nowhere.
|
|
360
|
+
* goes nowhere. A tool call that the client is shown and that operates on
|
|
361
|
+
* an announced child of another session gets the RFD's `session` reference
|
|
362
|
+
* (see {@link withTarget}).
|
|
353
363
|
*/
|
|
354
364
|
private route;
|
|
365
|
+
/**
|
|
366
|
+
* `notification`, an update that the client is shown on the session
|
|
367
|
+
* `shownOn`, with a `session` reference when it is of a TaskStop or
|
|
368
|
+
* SendMessage call that names an announced child by its agent id, or of a
|
|
369
|
+
* SendMessage call that resumed one and stays shown (see
|
|
370
|
+
* {@link requestShows}), as on v1 (`NativeSubagentRuntime.withTarget`).
|
|
371
|
+
*/
|
|
372
|
+
private withTarget;
|
|
373
|
+
private routed;
|
|
355
374
|
/**
|
|
356
375
|
* An update of an Agent or Task call. Its child, if it started, is
|
|
357
376
|
* announced at the call's first update. The call goes out only once it
|
|
@@ -391,8 +410,7 @@ export declare class SessionTasks {
|
|
|
391
410
|
/**
|
|
392
411
|
* A run of `child` ended: its unfinished tool calls get their final status,
|
|
393
412
|
* except its background work, then its idle goes out, as v2 asks. A stopped
|
|
394
|
-
* run's end `cancelled`, and a failed run's
|
|
395
|
-
* (`undefined`, an idle with no stop reason) `failed`. At a completed end, a
|
|
413
|
+
* run's end `cancelled`, and a failed run's `failed`. At a completed end, a
|
|
396
414
|
* tool call that Claude dropped before it ran ends `cancelled`, as on the
|
|
397
415
|
* root (see `SessionOutput.closeUnfinished`).
|
|
398
416
|
*/
|
package/dist/v2/tasks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../src/v2/tasks.ts"],"names":[],"mappings":"AA+CA,OAAO,EAAE,YAAY,EAAE,KAAK,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACxF,OAAO,KAAK,KAAK,EAAE,MAAM,mDAAmD,CAAC;AAC7E,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EACV,cAAc,EACd,cAAc,EACf,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAGlE,OAAO,
|
|
1
|
+
{"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../src/v2/tasks.ts"],"names":[],"mappings":"AA+CA,OAAO,EAAE,YAAY,EAAE,KAAK,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACxF,OAAO,KAAK,KAAK,EAAE,MAAM,mDAAmD,CAAC;AAC7E,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EACV,cAAc,EACd,cAAc,EACf,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAA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
import { RequestError } from "@agentclientprotocol/sdk/unstable";
|
|
49
49
|
import { backgroundBashTaskFromToolResult, taskProgressFields } from "../async-tasks.js";
|
|
50
50
|
import { BackgroundOutputTail } from "../background-output.js";
|
|
51
|
-
import { childModelOption, HANDBACK_TOOL, handbackMessage, isNativeSubagentControlTool, launchReply, linkedSessionMessages, mergeSubagentIdentity, responseModelEntry, resumedNativeSubagentId, rfdLabels, sendMessageResume, subagentIdentity, unexposedControlFallback, } from "../native-subagents.js";
|
|
51
|
+
import { childModelOption, HANDBACK_TOOL, handbackMessage, isNativeSubagentControlTool, launchReply, linkedSessionMessages, mergeSubagentIdentity, responseModelEntry, resumedNativeSubagentId, rfdLabels, sendMessageResume, subagentIdentity, targetAgentId, unexposedControlFallback, withSessionReference, } from "../native-subagents.js";
|
|
52
52
|
import { subagentLineage } from "../subagent-history.js";
|
|
53
53
|
import { withRunningTerminal, withRunningToolCall } from "../tool-calls/background.js";
|
|
54
54
|
import { ClientCapabilities } from "../tool-calls/client-capabilities.js";
|
|
@@ -129,6 +129,11 @@ export class SessionTasks {
|
|
|
129
129
|
* their input, and the call that delegated the run.
|
|
130
130
|
*/
|
|
131
131
|
handbacks = new Map();
|
|
132
|
+
/**
|
|
133
|
+
* The agent that each TaskStop or SendMessage call names (`targetAgentId`),
|
|
134
|
+
* until the call's final update.
|
|
135
|
+
*/
|
|
136
|
+
targetByToolCall = new Map();
|
|
132
137
|
/** The restore of a subagent from the session's history, while it reads it (see {@link restore}). */
|
|
133
138
|
restoring;
|
|
134
139
|
constructor(host,
|
|
@@ -596,19 +601,25 @@ export class SessionTasks {
|
|
|
596
601
|
this.publish();
|
|
597
602
|
}
|
|
598
603
|
/**
|
|
599
|
-
* Claude Code mounted a fresh conversation (`conversation_reset`).
|
|
600
|
-
*
|
|
601
|
-
*
|
|
602
|
-
*
|
|
603
|
-
* child
|
|
604
|
-
*
|
|
605
|
-
*
|
|
606
|
-
*
|
|
604
|
+
* Claude Code mounted a fresh conversation (`conversation_reset`). Every
|
|
605
|
+
* child is forgotten: a later event of one changes nothing, and a child not
|
|
606
|
+
* announced yet stays unexposed. Claude Code's tasks (the live subagents,
|
|
607
|
+
* background commands and other tasks) stay as its task events report them,
|
|
608
|
+
* so a child that works may go on working, unobserved. As on v1
|
|
609
|
+
* (`finishAll`), each such child, deeper ones first, goes `unknown`, as the
|
|
610
|
+
* RFD requires when a child can no longer be observed, on its stream and in
|
|
611
|
+
* its parent's mirror, and loses its `cancel` capability: a forgotten child
|
|
612
|
+
* cannot be stopped. Nothing says that its run or its tool calls ended, so
|
|
613
|
+
* its unfinished tool calls keep their status. A child that is idle keeps
|
|
614
|
+
* its state.
|
|
607
615
|
*/
|
|
608
616
|
conversationReset() {
|
|
609
617
|
for (const child of [...this.parentsFirst()].reverse()) {
|
|
610
|
-
if (child.working)
|
|
611
|
-
|
|
618
|
+
if (!child.working)
|
|
619
|
+
continue;
|
|
620
|
+
child.working = false;
|
|
621
|
+
child.unobservable = true;
|
|
622
|
+
this.sendChildState(child, "unknown", { capabilities: null });
|
|
612
623
|
}
|
|
613
624
|
this.publish();
|
|
614
625
|
for (const child of this.children.values())
|
|
@@ -624,6 +635,7 @@ export class SessionTasks {
|
|
|
624
635
|
this.hiddenSendMessages.clear();
|
|
625
636
|
this.shownSendMessages.clear();
|
|
626
637
|
this.handbacks.clear();
|
|
638
|
+
this.targetByToolCall.clear();
|
|
627
639
|
}
|
|
628
640
|
/**
|
|
629
641
|
* Publishes the `background` list of each session that changed, deeper
|
|
@@ -877,6 +889,7 @@ export class SessionTasks {
|
|
|
877
889
|
title: undefined,
|
|
878
890
|
description: undefined,
|
|
879
891
|
working: true,
|
|
892
|
+
unobservable: false,
|
|
880
893
|
reportedState: undefined,
|
|
881
894
|
outcome: undefined,
|
|
882
895
|
openRequests: 0,
|
|
@@ -1092,9 +1105,35 @@ export class SessionTasks {
|
|
|
1092
1105
|
* Rewrites an update of `output`, the output of the root or of `child`: an
|
|
1093
1106
|
* update of an Agent or Task call goes out as {@link launchUpdate} says,
|
|
1094
1107
|
* and Claude Code's late result of a call that the child's stop ended
|
|
1095
|
-
* goes nowhere.
|
|
1108
|
+
* goes nowhere. A tool call that the client is shown and that operates on
|
|
1109
|
+
* an announced child of another session gets the RFD's `session` reference
|
|
1110
|
+
* (see {@link withTarget}).
|
|
1096
1111
|
*/
|
|
1097
1112
|
route(output, notification, child) {
|
|
1113
|
+
return this.routed(output, notification, child).map((shown) => this.withTarget(shown, output.sessionId));
|
|
1114
|
+
}
|
|
1115
|
+
/**
|
|
1116
|
+
* `notification`, an update that the client is shown on the session
|
|
1117
|
+
* `shownOn`, with a `session` reference when it is of a TaskStop or
|
|
1118
|
+
* SendMessage call that names an announced child by its agent id, or of a
|
|
1119
|
+
* SendMessage call that resumed one and stays shown (see
|
|
1120
|
+
* {@link requestShows}), as on v1 (`NativeSubagentRuntime.withTarget`).
|
|
1121
|
+
*/
|
|
1122
|
+
withTarget(notification, shownOn) {
|
|
1123
|
+
const { update } = notification;
|
|
1124
|
+
if (update.sessionUpdate !== "tool_call" && update.sessionUpdate !== "tool_call_update") {
|
|
1125
|
+
return notification;
|
|
1126
|
+
}
|
|
1127
|
+
const agentId = this.targetByToolCall.get(update.toolCallId);
|
|
1128
|
+
if (FINAL_STATUSES.has(update.status))
|
|
1129
|
+
this.targetByToolCall.delete(update.toolCallId);
|
|
1130
|
+
const child = this.childByToolUse.get(update.toolCallId) ??
|
|
1131
|
+
(agentId !== undefined ? this.children.get(agentId) : undefined);
|
|
1132
|
+
if (!child?.announced || child.sessionId === shownOn)
|
|
1133
|
+
return notification;
|
|
1134
|
+
return withSessionReference(notification, child.sessionId);
|
|
1135
|
+
}
|
|
1136
|
+
routed(output, notification, child) {
|
|
1098
1137
|
const { update } = notification;
|
|
1099
1138
|
if (update.sessionUpdate !== "tool_call" && update.sessionUpdate !== "tool_call_update") {
|
|
1100
1139
|
return [notification];
|
|
@@ -1102,6 +1141,9 @@ export class SessionTasks {
|
|
|
1102
1141
|
if (child?.stopped.has(update.toolCallId))
|
|
1103
1142
|
return [];
|
|
1104
1143
|
const toolName = update._meta?.claudeCode?.toolName;
|
|
1144
|
+
const agentId = targetAgentId(toolName, update.rawInput);
|
|
1145
|
+
if (agentId !== undefined)
|
|
1146
|
+
this.targetByToolCall.set(update.toolCallId, agentId);
|
|
1105
1147
|
if (toolName === "SendMessage")
|
|
1106
1148
|
this.senderByToolUse.set(update.toolCallId, output.sessionId);
|
|
1107
1149
|
const message = this.sendMessageUpdate(output, notification, toolName) ??
|
|
@@ -1285,15 +1327,14 @@ export class SessionTasks {
|
|
|
1285
1327
|
/**
|
|
1286
1328
|
* A run of `child` ended: its unfinished tool calls get their final status,
|
|
1287
1329
|
* except its background work, then its idle goes out, as v2 asks. A stopped
|
|
1288
|
-
* run's end `cancelled`, and a failed run's
|
|
1289
|
-
* (`undefined`, an idle with no stop reason) `failed`. At a completed end, a
|
|
1330
|
+
* run's end `cancelled`, and a failed run's `failed`. At a completed end, a
|
|
1290
1331
|
* tool call that Claude dropped before it ran ends `cancelled`, as on the
|
|
1291
1332
|
* root (see `SessionOutput.closeUnfinished`).
|
|
1292
1333
|
*/
|
|
1293
1334
|
endRun(child, outcome) {
|
|
1294
1335
|
if (!child.working) {
|
|
1295
1336
|
// A later report of the same failure can give its error text.
|
|
1296
|
-
if (outcome
|
|
1337
|
+
if (outcome.stopReason === "error" &&
|
|
1297
1338
|
outcome.error &&
|
|
1298
1339
|
child.outcome?.stopReason === "error" &&
|
|
1299
1340
|
!child.outcome.error) {
|
|
@@ -1303,11 +1344,11 @@ export class SessionTasks {
|
|
|
1303
1344
|
return;
|
|
1304
1345
|
}
|
|
1305
1346
|
const keep = this.backgroundWork(child.sessionId);
|
|
1306
|
-
if (outcome
|
|
1347
|
+
if (outcome.stopReason === "end_turn") {
|
|
1307
1348
|
child.output.closeUnfinished(false, keep);
|
|
1308
1349
|
}
|
|
1309
1350
|
else {
|
|
1310
|
-
const status = outcome
|
|
1351
|
+
const status = outcome.stopReason === "cancelled" ? "cancelled" : "failed";
|
|
1311
1352
|
const ended = child.output.finishUnfinished(status, keep, { exitTerminals: true });
|
|
1312
1353
|
for (const toolCallId of ended)
|
|
1313
1354
|
child.stopped.add(toolCallId);
|
|
@@ -1342,6 +1383,8 @@ export class SessionTasks {
|
|
|
1342
1383
|
return (notification) => withRunningToolCall(terminals.reduce(withRunningTerminal, notification), toolCalls);
|
|
1343
1384
|
}
|
|
1344
1385
|
childState(child) {
|
|
1386
|
+
if (child.unobservable)
|
|
1387
|
+
return "unknown";
|
|
1345
1388
|
if (!child.working)
|
|
1346
1389
|
return "idle";
|
|
1347
1390
|
return child.openRequests > 0 ? "requires_action" : "running";
|
|
@@ -1361,12 +1404,17 @@ export class SessionTasks {
|
|
|
1361
1404
|
}
|
|
1362
1405
|
this.sendChildState(child, state);
|
|
1363
1406
|
}
|
|
1364
|
-
sendChildState(child, state) {
|
|
1407
|
+
sendChildState(child, state, capabilities) {
|
|
1365
1408
|
child.reportedState = state;
|
|
1366
1409
|
const snapshot = stateObject(state, state === "idle" ? child.outcome : undefined);
|
|
1367
1410
|
this.host.send({
|
|
1368
1411
|
sessionId: child.parentSessionId,
|
|
1369
|
-
update: {
|
|
1412
|
+
update: {
|
|
1413
|
+
sessionUpdate: "subagent_update",
|
|
1414
|
+
sessionId: child.sessionId,
|
|
1415
|
+
...capabilities,
|
|
1416
|
+
state: snapshot,
|
|
1417
|
+
},
|
|
1370
1418
|
});
|
|
1371
1419
|
this.host.send({
|
|
1372
1420
|
sessionId: child.sessionId,
|
|
@@ -1703,6 +1751,8 @@ function stateObject(state, outcome) {
|
|
|
1703
1751
|
return { state: "running" };
|
|
1704
1752
|
case "requires_action":
|
|
1705
1753
|
return { state: "requires_action" };
|
|
1754
|
+
case "unknown":
|
|
1755
|
+
return { state: "unknown" };
|
|
1706
1756
|
default:
|
|
1707
1757
|
return { state: "idle", ...(outcome ?? {}) };
|
|
1708
1758
|
}
|
package/dist/v2/tool-call.js
CHANGED
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.106.
|
|
6
|
+
"version": "0.106.1-preview.10",
|
|
7
7
|
"description": "An ACP-compatible coding agent powered by the Claude Agent SDK (TypeScript)",
|
|
8
8
|
"main": "dist/lib.js",
|
|
9
9
|
"types": "dist/lib.d.ts",
|
|
@@ -69,14 +69,14 @@
|
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"@agentclientprotocol/sdk": "2.6.0",
|
|
72
|
-
"@anthropic-ai/claude-agent-sdk": "0.3.
|
|
72
|
+
"@anthropic-ai/claude-agent-sdk": "0.3.323",
|
|
73
73
|
"diff": "9.0.0",
|
|
74
74
|
"zod": "4.6.7"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@anthropic-ai/sdk": "1.
|
|
77
|
+
"@anthropic-ai/sdk": "1.8.0",
|
|
78
78
|
"@eslint/js": "10.0.1",
|
|
79
|
-
"@tsconfig/node22": "22.0.
|
|
79
|
+
"@tsconfig/node22": "22.0.7",
|
|
80
80
|
"@types/node": "26.6.6",
|
|
81
81
|
"@typescript-eslint/eslint-plugin": "8.72.2",
|
|
82
82
|
"@typescript-eslint/parser": "8.72.2",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"eslint": "10.14.0",
|
|
86
86
|
"eslint-config-prettier": "10.1.8",
|
|
87
87
|
"globals": "17.14.0",
|
|
88
|
-
"prettier": "3.
|
|
88
|
+
"prettier": "3.10.1",
|
|
89
89
|
"typescript": "6.0.3",
|
|
90
90
|
"vitest": "5.1.0"
|
|
91
91
|
}
|