@agentclientprotocol/claude-agent-acp 0.97.1-preview.5 → 0.97.1-preview.7
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/dist/async-tasks.d.ts +10 -6
- package/dist/async-tasks.d.ts.map +1 -1
- package/dist/async-tasks.js +29 -20
- package/package.json +1 -1
package/dist/async-tasks.d.ts
CHANGED
|
@@ -71,7 +71,8 @@ export declare class AsyncTaskRuntime {
|
|
|
71
71
|
* the tasks that a tool call in another session started, for example in
|
|
72
72
|
* a native subagent session. `toolNameOf`: the name of the tool of a tool
|
|
73
73
|
* call, or `undefined` when the tool call is unknown. A task that a
|
|
74
|
-
* `Monitor` tool call started is
|
|
74
|
+
* `Monitor` tool call started is published as a monitor: the SDK reports
|
|
75
|
+
* it as `local_bash`, so the adapter names it a monitor. */
|
|
75
76
|
private readonly options;
|
|
76
77
|
/**
|
|
77
78
|
* One registry owns both active tasks and terminal tombstones. Keeping an
|
|
@@ -96,7 +97,8 @@ export declare class AsyncTaskRuntime {
|
|
|
96
97
|
* the tasks that a tool call in another session started, for example in
|
|
97
98
|
* a native subagent session. `toolNameOf`: the name of the tool of a tool
|
|
98
99
|
* call, or `undefined` when the tool call is unknown. A task that a
|
|
99
|
-
* `Monitor` tool call started is
|
|
100
|
+
* `Monitor` tool call started is published as a monitor: the SDK reports
|
|
101
|
+
* it as `local_bash`, so the adapter names it a monitor. */
|
|
100
102
|
options?: {
|
|
101
103
|
notices?: boolean;
|
|
102
104
|
routeOf?: (toolCallId: string) => Route | undefined;
|
|
@@ -184,10 +186,12 @@ export declare class AsyncTaskRuntime {
|
|
|
184
186
|
* ends first, or when the prompt result ends the model turn
|
|
185
187
|
* ({@link releaseHeld}). No guess by the command text binds a task.
|
|
186
188
|
*
|
|
187
|
-
* A task that a `Monitor` tool call started is
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
189
|
+
* A task that a `Monitor` tool call started is published as a monitor. The
|
|
190
|
+
* SDK reports it as `local_bash`, so the adapter names it a monitor instead of
|
|
191
|
+
* a shell. It has no transcript card because Monitor streams its output to
|
|
192
|
+
* the model only, and no Stop because stopping it only ends the agent's wait
|
|
193
|
+
* (the agent's own TaskStop still works). The tool_use streams before the
|
|
194
|
+
* tool runs, so the tool name is known when the spawn has the tool call id.
|
|
191
195
|
*/
|
|
192
196
|
private announce;
|
|
193
197
|
private finish;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async-tasks.d.ts","sourceRoot":"","sources":["../src/async-tasks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAIjF,KAAK,OAAO,GAAG,CAAC,YAAY,EAAE,sBAAsB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AACvE,qEAAqE;AACrE,KAAK,KAAK,GAAG,CAAC,YAAY,EAAE,sBAAsB,KAAK,sBAAsB,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"async-tasks.d.ts","sourceRoot":"","sources":["../src/async-tasks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAIjF,KAAK,OAAO,GAAG,CAAC,YAAY,EAAE,sBAAsB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AACvE,qEAAqE;AACrE,KAAK,KAAK,GAAG,CAAC,YAAY,EAAE,sBAAsB,KAAK,sBAAsB,GAAG,IAAI,CAAC;AA4CrF,KAAK,YAAY,GAAG;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAI5D,MAAM,MAAM,gBAAgB,GAAG,YAAY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AM,CAAA;CAAE,CAAC,GAAG,SAAS,CAuCzE;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC,EAC1D,OAAO,EAAE,gBAAgB,EACzB,cAAc,CAAC,EAAE,gBAAgB,GAChC,GAAG,CAAC,MAAM,CAAC,CAmBb"}
|
package/dist/async-tasks.js
CHANGED
|
@@ -34,7 +34,8 @@ export class AsyncTaskRuntime {
|
|
|
34
34
|
* the tasks that a tool call in another session started, for example in
|
|
35
35
|
* a native subagent session. `toolNameOf`: the name of the tool of a tool
|
|
36
36
|
* call, or `undefined` when the tool call is unknown. A task that a
|
|
37
|
-
* `Monitor` tool call started is
|
|
37
|
+
* `Monitor` tool call started is published as a monitor: the SDK reports
|
|
38
|
+
* it as `local_bash`, so the adapter names it a monitor. */
|
|
38
39
|
options = {}) {
|
|
39
40
|
this.enabled = enabled;
|
|
40
41
|
this.sessionId = sessionId;
|
|
@@ -48,7 +49,7 @@ export class AsyncTaskRuntime {
|
|
|
48
49
|
if (!taskId)
|
|
49
50
|
return;
|
|
50
51
|
const task = this.task(taskId);
|
|
51
|
-
if (isSubagentTask(message)
|
|
52
|
+
if (isSubagentTask(message)) {
|
|
52
53
|
this.ignore(task);
|
|
53
54
|
return;
|
|
54
55
|
}
|
|
@@ -72,7 +73,7 @@ export class AsyncTaskRuntime {
|
|
|
72
73
|
if (!taskId)
|
|
73
74
|
return;
|
|
74
75
|
const task = this.task(taskId);
|
|
75
|
-
if (isSubagentTask(message)
|
|
76
|
+
if (isSubagentTask(message)) {
|
|
76
77
|
this.ignore(task);
|
|
77
78
|
return;
|
|
78
79
|
}
|
|
@@ -222,7 +223,7 @@ export class AsyncTaskRuntime {
|
|
|
222
223
|
if (task.ignored || isTerminal(task.state))
|
|
223
224
|
continue;
|
|
224
225
|
const levelTaskType = field(item, "taskType", "task_type");
|
|
225
|
-
if (levelTaskType === "local_agent"
|
|
226
|
+
if (levelTaskType === "local_agent") {
|
|
226
227
|
this.ignore(task);
|
|
227
228
|
continue;
|
|
228
229
|
}
|
|
@@ -273,7 +274,11 @@ export class AsyncTaskRuntime {
|
|
|
273
274
|
}
|
|
274
275
|
canStop(taskId) {
|
|
275
276
|
const task = this.tasks.get(taskId);
|
|
276
|
-
return task?.announced === true &&
|
|
277
|
+
return (task?.announced === true &&
|
|
278
|
+
!task.monitor &&
|
|
279
|
+
!task.ignored &&
|
|
280
|
+
!task.stopping &&
|
|
281
|
+
!isTerminal(task.state));
|
|
277
282
|
}
|
|
278
283
|
claimStop(taskId) {
|
|
279
284
|
if (!this.canStop(taskId))
|
|
@@ -437,6 +442,7 @@ export class AsyncTaskRuntime {
|
|
|
437
442
|
taskType: "task",
|
|
438
443
|
description: "Background task",
|
|
439
444
|
showInTranscript: true,
|
|
445
|
+
monitor: false,
|
|
440
446
|
announced: false,
|
|
441
447
|
held: false,
|
|
442
448
|
deferred: [],
|
|
@@ -457,6 +463,8 @@ export class AsyncTaskRuntime {
|
|
|
457
463
|
const rawTaskType = field(message, "taskType", "task_type");
|
|
458
464
|
if (rawTaskType !== undefined)
|
|
459
465
|
task.taskType = friendlyTaskType(rawTaskType);
|
|
466
|
+
if (rawTaskType === "local_monitor")
|
|
467
|
+
task.monitor = true;
|
|
460
468
|
const description = nonBlankString(message.description);
|
|
461
469
|
if (description)
|
|
462
470
|
task.description = description;
|
|
@@ -514,6 +522,8 @@ export class AsyncTaskRuntime {
|
|
|
514
522
|
const rawTaskType = field(level, "taskType", "task_type");
|
|
515
523
|
if (rawTaskType !== undefined)
|
|
516
524
|
task.taskType = friendlyTaskType(rawTaskType);
|
|
525
|
+
if (rawTaskType === "local_monitor")
|
|
526
|
+
task.monitor = true;
|
|
517
527
|
const description = nonBlankString(level.description);
|
|
518
528
|
if (description) {
|
|
519
529
|
task.description = description;
|
|
@@ -534,23 +544,27 @@ export class AsyncTaskRuntime {
|
|
|
534
544
|
* ends first, or when the prompt result ends the model turn
|
|
535
545
|
* ({@link releaseHeld}). No guess by the command text binds a task.
|
|
536
546
|
*
|
|
537
|
-
* A task that a `Monitor` tool call started is
|
|
538
|
-
*
|
|
539
|
-
*
|
|
540
|
-
*
|
|
547
|
+
* A task that a `Monitor` tool call started is published as a monitor. The
|
|
548
|
+
* SDK reports it as `local_bash`, so the adapter names it a monitor instead of
|
|
549
|
+
* a shell. It has no transcript card because Monitor streams its output to
|
|
550
|
+
* the model only, and no Stop because stopping it only ends the agent's wait
|
|
551
|
+
* (the agent's own TaskStop still works). The tool_use streams before the
|
|
552
|
+
* tool runs, so the tool name is known when the spawn has the tool call id.
|
|
541
553
|
*/
|
|
542
554
|
async announce(task, options = {}) {
|
|
543
555
|
if (task.announced || task.ignored)
|
|
544
556
|
return;
|
|
545
|
-
const toolName = task.toolCallId ? this.options.toolNameOf?.(task.toolCallId) : undefined;
|
|
546
|
-
if (toolName !== undefined && HIDDEN_TASK_TOOLS.has(toolName)) {
|
|
547
|
-
this.ignore(task);
|
|
548
|
-
return;
|
|
549
|
-
}
|
|
550
557
|
if (!task.toolCallId && !options.withoutToolCall && !isTerminal(task.state)) {
|
|
551
558
|
task.held = true;
|
|
552
559
|
return;
|
|
553
560
|
}
|
|
561
|
+
if (task.toolCallId && this.options.toolNameOf?.(task.toolCallId) === "Monitor") {
|
|
562
|
+
task.monitor = true;
|
|
563
|
+
}
|
|
564
|
+
if (task.monitor) {
|
|
565
|
+
task.taskType = "monitor";
|
|
566
|
+
task.showInTranscript = false;
|
|
567
|
+
}
|
|
554
568
|
if (task.toolCallId)
|
|
555
569
|
task.route ??= this.options.routeOf?.(task.toolCallId);
|
|
556
570
|
await this.send(task, {
|
|
@@ -560,7 +574,7 @@ export class AsyncTaskRuntime {
|
|
|
560
574
|
taskType: task.taskType,
|
|
561
575
|
description: task.description,
|
|
562
576
|
showInTranscript: task.showInTranscript,
|
|
563
|
-
canStop:
|
|
577
|
+
canStop: !task.monitor,
|
|
564
578
|
...(task.outputFilePath ? { outputFilePath: task.outputFilePath } : {}),
|
|
565
579
|
...(task.toolCallId ? { toolCallId: task.toolCallId } : {}),
|
|
566
580
|
});
|
|
@@ -872,11 +886,6 @@ function isBackgroundTask(isBackgrounded, taskType) {
|
|
|
872
886
|
return false;
|
|
873
887
|
return taskType !== "local_bash" && taskType !== "local_agent";
|
|
874
888
|
}
|
|
875
|
-
/** The tools whose async tasks the client never sees. */
|
|
876
|
-
const HIDDEN_TASK_TOOLS = new Set(["Monitor"]);
|
|
877
|
-
function isMonitorTask(message) {
|
|
878
|
-
return field(message, "taskType", "task_type") === "local_monitor";
|
|
879
|
-
}
|
|
880
889
|
function isSubagentTask(message) {
|
|
881
890
|
return (field(message, "subagentType", "subagent_type") !== undefined ||
|
|
882
891
|
field(message, "taskType", "task_type") === "local_agent");
|
package/package.json
CHANGED