@agentclientprotocol/claude-agent-acp 0.112.1-preview.1 → 0.112.1-preview.2
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/v2/tasks.d.ts +9 -2
- package/dist/v2/tasks.d.ts.map +1 -1
- package/dist/v2/tasks.js +80 -15
- package/package.json +1 -1
package/dist/v2/tasks.d.ts
CHANGED
|
@@ -118,6 +118,12 @@ export declare class SessionTasks {
|
|
|
118
118
|
private readonly toolCalls;
|
|
119
119
|
/** The tool calls that returned: their tasks no longer hold their work. */
|
|
120
120
|
private readonly returned;
|
|
121
|
+
/**
|
|
122
|
+
* The tasks that already ended, by task id. A task can end before the call
|
|
123
|
+
* that started it returns: remembering the end keeps that call from being
|
|
124
|
+
* kept in progress for a task no later level can name.
|
|
125
|
+
*/
|
|
126
|
+
private readonly endedTasks;
|
|
121
127
|
/** What a subagent's hooks reported before the child was announced, by agent id. */
|
|
122
128
|
private readonly startedHooks;
|
|
123
129
|
/** The children's configurations (see `child-config.ts`). */
|
|
@@ -377,8 +383,9 @@ export declare class SessionTasks {
|
|
|
377
383
|
*/
|
|
378
384
|
private taskEnded;
|
|
379
385
|
/**
|
|
380
|
-
* Claude Code's live background task set changed.
|
|
381
|
-
*
|
|
386
|
+
* Claude Code's live background task set changed. Calls whose task it now
|
|
387
|
+
* names are added to the list, and terminals and tool calls whose tasks it no
|
|
388
|
+
* longer holds ended, without saying how.
|
|
382
389
|
*/
|
|
383
390
|
private levelChanged;
|
|
384
391
|
/** A new child, not announced, which runs; the messages of its launch that came wait for it. */
|
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":"
|
|
1
|
+
{"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../src/v2/tasks.ts"],"names":[],"mappings":"AAyDA,OAAO,EAAgB,KAAK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E,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CASlE"}
|
package/dist/v2/tasks.js
CHANGED
|
@@ -42,10 +42,12 @@
|
|
|
42
42
|
* - A task that a tool call started, such as a `Monitor` or `Workflow` call,
|
|
43
43
|
* is that tool call, kept `in_progress` (or `paused`) until the task ends.
|
|
44
44
|
* A workflow's `task_progress` shows on its call (`workflowCard`).
|
|
45
|
-
* - Any other background task, such as one that a hook started
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
45
|
+
* - Any other background task, such as one that a hook started, gets a tool
|
|
46
|
+
* call that the adapter starts for it (`task_<taskId>`), as v2 lists
|
|
47
|
+
* background work only by an entity the client knows. A Monitor or Workflow
|
|
48
|
+
* call, or a call whose `task_started` came before its result, stays its
|
|
49
|
+
* task's entity also when the task joins the live set after the result (see
|
|
50
|
+
* `toolResults` and `levelChanged`).
|
|
49
51
|
*
|
|
50
52
|
* Claude Code's interrupt spares background tasks (`perTaskStopAffordance`),
|
|
51
53
|
* so `session/cancel` leaves listed work running, as v2 asks. A session
|
|
@@ -68,6 +70,19 @@ import { REPLAY_COMPLETE } from "./setup.js";
|
|
|
68
70
|
import { SubagentReplay } from "./subagent-replay.js";
|
|
69
71
|
/** The tools whose structured result names the task that the call started. */
|
|
70
72
|
const TASK_TOOLS = new Set(["Monitor", "Workflow"]);
|
|
73
|
+
/**
|
|
74
|
+
* Whether the call of `toolUseName` is the entity of `task` in the list, rather
|
|
75
|
+
* than the display terminal of a command. Claude Code reports a Monitor's task
|
|
76
|
+
* as `local_bash`, like a shell command's: a command is its terminal, while the
|
|
77
|
+
* call of a tool that starts a task is that task.
|
|
78
|
+
*/
|
|
79
|
+
function keepsTaskCall(toolUseName, taskType) {
|
|
80
|
+
if (taskType === "local_agent")
|
|
81
|
+
return false;
|
|
82
|
+
if (taskType === "local_bash" && !TASK_TOOLS.has(toolUseName))
|
|
83
|
+
return false;
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
71
86
|
/** The most messages that wait for the announcement of one child. */
|
|
72
87
|
const MAX_PENDING_MESSAGES = 256;
|
|
73
88
|
/** The most children not announced yet whose hooks wait for them. */
|
|
@@ -127,6 +142,12 @@ export class SessionTasks {
|
|
|
127
142
|
toolCalls = new Map();
|
|
128
143
|
/** The tool calls that returned: their tasks no longer hold their work. */
|
|
129
144
|
returned = new Set();
|
|
145
|
+
/**
|
|
146
|
+
* The tasks that already ended, by task id. A task can end before the call
|
|
147
|
+
* that started it returns: remembering the end keeps that call from being
|
|
148
|
+
* kept in progress for a task no later level can name.
|
|
149
|
+
*/
|
|
150
|
+
endedTasks = new Set();
|
|
130
151
|
/** What a subagent's hooks reported before the child was announced, by agent id. */
|
|
131
152
|
startedHooks = new Map();
|
|
132
153
|
/** The children's configurations (see `child-config.ts`). */
|
|
@@ -295,14 +316,31 @@ export class SessionTasks {
|
|
|
295
316
|
}
|
|
296
317
|
const taskId = (TASK_TOOLS.has(toolUse.name) ? structuredTaskId : undefined) ??
|
|
297
318
|
[...this.started].find(([, task]) => task.toolUseId === toolCallId)?.[0];
|
|
298
|
-
|
|
299
|
-
|
|
319
|
+
if (taskId === undefined)
|
|
320
|
+
continue;
|
|
321
|
+
const task = this.level.get(taskId);
|
|
322
|
+
// A call outside TASK_TOOLS finds its task only through `this.started`.
|
|
323
|
+
// When task_started gave the task's type, a call that is not its task's
|
|
324
|
+
// entity ends with its result. Otherwise `levelChanged` ends it once a
|
|
325
|
+
// level gives the type.
|
|
326
|
+
if (!keepsTaskCall(toolUse.name, task?.taskType ?? this.started.get(taskId)?.taskType))
|
|
300
327
|
continue;
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
328
|
+
if (!task) {
|
|
329
|
+
// A task that already ended ends its call with the result: no later
|
|
330
|
+
// level can name it. Any other task can join the level after this
|
|
331
|
+
// result, so keep the call unleveled until `levelChanged` names it.
|
|
332
|
+
if (this.endedTasks.has(taskId))
|
|
333
|
+
continue;
|
|
334
|
+
this.toolCalls.set(taskId, {
|
|
335
|
+
toolCallId,
|
|
336
|
+
output,
|
|
337
|
+
toolUse: { name: toolUse.name, input: toolUse.input },
|
|
338
|
+
paused: false,
|
|
339
|
+
unleveled: true,
|
|
340
|
+
});
|
|
341
|
+
runningToolCalls.add(toolCallId);
|
|
305
342
|
continue;
|
|
343
|
+
}
|
|
306
344
|
this.toolCalls.set(taskId, {
|
|
307
345
|
toolCallId,
|
|
308
346
|
output,
|
|
@@ -989,6 +1027,7 @@ export class SessionTasks {
|
|
|
989
1027
|
if (commandToolCall !== undefined)
|
|
990
1028
|
this.foreground.get(commandToolCall)?.stop();
|
|
991
1029
|
this.started.delete(taskId);
|
|
1030
|
+
this.endedTasks.add(taskId);
|
|
992
1031
|
const terminal = this.terminals.get(taskId);
|
|
993
1032
|
if (terminal && !terminal.ending) {
|
|
994
1033
|
terminal.ending = true;
|
|
@@ -1004,10 +1043,12 @@ export class SessionTasks {
|
|
|
1004
1043
|
this.publish();
|
|
1005
1044
|
}
|
|
1006
1045
|
/**
|
|
1007
|
-
* Claude Code's live background task set changed.
|
|
1008
|
-
*
|
|
1046
|
+
* Claude Code's live background task set changed. Calls whose task it now
|
|
1047
|
+
* names are added to the list, and terminals and tool calls whose tasks it no
|
|
1048
|
+
* longer holds ended, without saying how.
|
|
1009
1049
|
*/
|
|
1010
1050
|
levelChanged(tasks) {
|
|
1051
|
+
const previous = this.level;
|
|
1011
1052
|
this.level = new Map(tasks.map((task) => [
|
|
1012
1053
|
task.task_id,
|
|
1013
1054
|
{
|
|
@@ -1018,11 +1059,35 @@ export class SessionTasks {
|
|
|
1018
1059
|
progress: this.level.get(task.task_id)?.progress,
|
|
1019
1060
|
},
|
|
1020
1061
|
]));
|
|
1062
|
+
// A task that left the live set ended, also when no task event said so: a
|
|
1063
|
+
// call whose task leaves the level before its result must not be kept.
|
|
1064
|
+
for (const taskId of previous.keys()) {
|
|
1065
|
+
if (!this.level.has(taskId))
|
|
1066
|
+
this.endedTasks.add(taskId);
|
|
1067
|
+
}
|
|
1021
1068
|
for (const [taskId, terminal] of this.terminals) {
|
|
1022
1069
|
if (this.level.get(taskId)?.ambient === false)
|
|
1023
1070
|
terminal.leveled = true;
|
|
1024
1071
|
}
|
|
1072
|
+
// A call whose task joined the level after its result is part of that task
|
|
1073
|
+
// again: it stays in progress (or paused, as a task update already set it)
|
|
1074
|
+
// and the next list names it. When the task is not the call's, the call ends
|
|
1075
|
+
// completed, as its result reported it.
|
|
1076
|
+
for (const [taskId, call] of this.toolCalls) {
|
|
1077
|
+
if (!call.unleveled)
|
|
1078
|
+
continue;
|
|
1079
|
+
const task = this.level.get(taskId);
|
|
1080
|
+
if (!task)
|
|
1081
|
+
continue;
|
|
1082
|
+
call.unleveled = false;
|
|
1083
|
+
if (call.toolUse === undefined || !keepsTaskCall(call.toolUse.name, task.taskType)) {
|
|
1084
|
+
this.endToolCall(taskId, "completed");
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1025
1087
|
for (const taskId of [...this.terminals.keys(), ...this.toolCalls.keys()]) {
|
|
1088
|
+
// A kept call waits for a later level that names its task.
|
|
1089
|
+
if (this.toolCalls.get(taskId)?.unleveled)
|
|
1090
|
+
continue;
|
|
1026
1091
|
if (!this.level.has(taskId))
|
|
1027
1092
|
this.taskEnded(taskId, "completed");
|
|
1028
1093
|
}
|
|
@@ -1867,9 +1932,9 @@ export class SessionTasks {
|
|
|
1867
1932
|
// A subagent is listed as its session.
|
|
1868
1933
|
if (task.taskType === "local_bash" || task.taskType === "local_agent")
|
|
1869
1934
|
continue;
|
|
1870
|
-
// A task joins the level before its `task_started
|
|
1871
|
-
// call that starts it returns
|
|
1872
|
-
//
|
|
1935
|
+
// A task usually joins the level before its `task_started` and the tool
|
|
1936
|
+
// call that starts it returns, but not always: a call that arrived before
|
|
1937
|
+
// its task joined the level is kept unleveled (see `toolResults`).
|
|
1873
1938
|
const started = this.started.get(taskId);
|
|
1874
1939
|
if (!started || (started.toolUseId && !this.returned.has(started.toolUseId)))
|
|
1875
1940
|
continue;
|
package/package.json
CHANGED