@agentclientprotocol/claude-agent-acp 0.107.4-preview.2 → 0.107.4-preview.3
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/background-output.d.ts +90 -0
- package/dist/background-output.d.ts.map +1 -1
- package/dist/background-output.js +138 -0
- package/dist/tool-calls/background.d.ts +32 -0
- package/dist/tool-calls/background.d.ts.map +1 -1
- package/dist/tool-calls/background.js +53 -0
- package/dist/v1/acp-agent.d.ts.map +1 -1
- package/dist/v1/acp-agent.js +25 -4
- package/dist/v1/background-work.d.ts +87 -9
- package/dist/v1/background-work.d.ts.map +1 -1
- package/dist/v1/background-work.js +112 -3
- package/dist/v2/session.d.ts.map +1 -1
- package/dist/v2/session.js +7 -0
- package/dist/v2/tasks.d.ts +22 -0
- package/dist/v2/tasks.d.ts.map +1 -1
- package/dist/v2/tasks.js +57 -3
- package/package.json +1 -1
|
@@ -51,4 +51,94 @@ export declare class BackgroundOutputTail {
|
|
|
51
51
|
private read;
|
|
52
52
|
private send;
|
|
53
53
|
}
|
|
54
|
+
/** What Claude Code's `get_task_output` returns: the end of a shell task's output. */
|
|
55
|
+
export interface TaskOutput {
|
|
56
|
+
/** At most the last 8 KiB of the output, decoded as UTF-8. */
|
|
57
|
+
output: string;
|
|
58
|
+
/** The size of the whole output in bytes. */
|
|
59
|
+
total_bytes: number;
|
|
60
|
+
/** Whether `output` holds only the end of the output. */
|
|
61
|
+
truncated: boolean;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Follows the output of a command that runs in the foreground, read with
|
|
65
|
+
* `read` (Claude Code's `get_task_output`), and hands each piece of new text
|
|
66
|
+
* to `publish`, in order. Claude Code streams no output of a foreground Bash
|
|
67
|
+
* command either: the output arrives in the tool result. Claude Code writes
|
|
68
|
+
* the output to the command's task before then, and `get_task_output` reads
|
|
69
|
+
* it, though the task's `task_started` names no output file.
|
|
70
|
+
*
|
|
71
|
+
* The new text is the output past the bytes already sent. When `output` does
|
|
72
|
+
* not hold all of it, or its bytes may not match the command's (not UTF-8),
|
|
73
|
+
* the whole `output` replaces the terminal's output, as a snapshot. A read
|
|
74
|
+
* that ends in U+FFFD may have cut a character that the command is still
|
|
75
|
+
* writing, so it is sent only at the next read.
|
|
76
|
+
*
|
|
77
|
+
* Once the command ends, Claude Code drops its output: the task then reads as
|
|
78
|
+
* empty (`total_bytes: 0`, CLI 2.1.325), up to the tool result that carries
|
|
79
|
+
* the whole output. A read that holds less than was sent is that end, so it
|
|
80
|
+
* stops the poll and publishes nothing: an empty snapshot would clear the
|
|
81
|
+
* terminal.
|
|
82
|
+
*
|
|
83
|
+
* One read runs at a time: a poll that comes during a read is skipped, so a
|
|
84
|
+
* read that Claude Code never answers queues nothing behind it. A read that
|
|
85
|
+
* fails is tried again at the next poll. `publish` must not reject.
|
|
86
|
+
*/
|
|
87
|
+
export declare class TaskOutputPoll {
|
|
88
|
+
private readonly read;
|
|
89
|
+
private readonly publish;
|
|
90
|
+
private sentBytes;
|
|
91
|
+
private sent;
|
|
92
|
+
private stopped;
|
|
93
|
+
/** A read is in progress, or the publish of its text. */
|
|
94
|
+
private busy;
|
|
95
|
+
/** The publish in progress, or the last one. */
|
|
96
|
+
private publishing;
|
|
97
|
+
private readonly timer;
|
|
98
|
+
constructor(read: () => Promise<TaskOutput>, publish: (output: BackgroundOutput) => Promise<void>);
|
|
99
|
+
/**
|
|
100
|
+
* Stops, once a publish in progress is out. Returns whether any text was
|
|
101
|
+
* published: the tool result then replaces it with the whole output.
|
|
102
|
+
*
|
|
103
|
+
* A read in progress is not waited for. It publishes nothing after this,
|
|
104
|
+
* and Claude Code may never answer it.
|
|
105
|
+
*/
|
|
106
|
+
finish(): Promise<boolean>;
|
|
107
|
+
/**
|
|
108
|
+
* Stops now and returns whether any text was published, for a caller whose
|
|
109
|
+
* `publish` sends in the same synchronous step (v2), so none is in progress.
|
|
110
|
+
*/
|
|
111
|
+
end(): boolean;
|
|
112
|
+
/** Stops without waiting: the command's task, the query or the session ended. */
|
|
113
|
+
stop(): void;
|
|
114
|
+
private poll;
|
|
115
|
+
/**
|
|
116
|
+
* The text that `read` adds to what was sent, or undefined when it adds none
|
|
117
|
+
* yet. `read` holds at least the bytes that were sent.
|
|
118
|
+
*/
|
|
119
|
+
private newText;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* The id of the tool call whose command the task `started` runs in the
|
|
123
|
+
* foreground, or undefined for any other task. Claude Code starts the task of
|
|
124
|
+
* a foreground command once the command has run for a few seconds (3.1 s with
|
|
125
|
+
* CLI 2.1.325). A faster command gets no task, and its output comes with its
|
|
126
|
+
* tool result, as before.
|
|
127
|
+
*/
|
|
128
|
+
export declare function foregroundCommandToolCall(started: {
|
|
129
|
+
task_type?: string;
|
|
130
|
+
is_backgrounded?: boolean;
|
|
131
|
+
tool_use_id?: string;
|
|
132
|
+
}): string | undefined;
|
|
133
|
+
/** Whether a call of the tool `name` runs a command that a terminal shows. */
|
|
134
|
+
export declare function isCommandTool(name: string | undefined): boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Claude Code's `get_task_output` on the SDK's query. Like `mcpAuthenticate`,
|
|
137
|
+
* it is on the query object but not in the public `Query` declaration yet,
|
|
138
|
+
* though the SDK types its control request (`SDKControlGetTaskOutputRequest`).
|
|
139
|
+
*/
|
|
140
|
+
export type TaskOutputQuery = {
|
|
141
|
+
getTaskOutput(taskId: string): Promise<TaskOutput>;
|
|
142
|
+
};
|
|
143
|
+
export declare function supportsTaskOutput<T extends object>(query: T): query is T & TaskOutputQuery;
|
|
54
144
|
//# sourceMappingURL=background-output.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"background-output.d.ts","sourceRoot":"","sources":["../src/background-output.ts"],"names":[],"mappings":"AAcA,yDAAyD;AACzD,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAE7C,mFAAmF;AACnF,eAAO,MAAM,4BAA4B,QAAa,CAAC;AAEvD;;;;;G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,OAAO;IAKd,iFAAiF;IACjF,IAAI,IAAI,IAAI;YAKE,IAAI;IAuBlB;;;OAGG;IACH,OAAO,CAAC,OAAO;CAchB;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,MAAM,GAAG,SAAS,CAIrB;AAED,8EAA8E;AAC9E,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAE/D;AAED;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG;IAAE,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;CAAE,CAAC;AAErF,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,IAAI,CAAC,GAAG,eAAe,CAE3F"}
|
|
@@ -120,3 +120,141 @@ export class BackgroundOutputTail {
|
|
|
120
120
|
await this.publish({ text, replaces });
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* The most bytes at the start of a truncated `output` that may not match the
|
|
125
|
+
* command's bytes: a character that the 8 KiB cut split decodes as U+FFFD.
|
|
126
|
+
*/
|
|
127
|
+
const CUT_CHARACTER_BYTES = 4;
|
|
128
|
+
/**
|
|
129
|
+
* Follows the output of a command that runs in the foreground, read with
|
|
130
|
+
* `read` (Claude Code's `get_task_output`), and hands each piece of new text
|
|
131
|
+
* to `publish`, in order. Claude Code streams no output of a foreground Bash
|
|
132
|
+
* command either: the output arrives in the tool result. Claude Code writes
|
|
133
|
+
* the output to the command's task before then, and `get_task_output` reads
|
|
134
|
+
* it, though the task's `task_started` names no output file.
|
|
135
|
+
*
|
|
136
|
+
* The new text is the output past the bytes already sent. When `output` does
|
|
137
|
+
* not hold all of it, or its bytes may not match the command's (not UTF-8),
|
|
138
|
+
* the whole `output` replaces the terminal's output, as a snapshot. A read
|
|
139
|
+
* that ends in U+FFFD may have cut a character that the command is still
|
|
140
|
+
* writing, so it is sent only at the next read.
|
|
141
|
+
*
|
|
142
|
+
* Once the command ends, Claude Code drops its output: the task then reads as
|
|
143
|
+
* empty (`total_bytes: 0`, CLI 2.1.325), up to the tool result that carries
|
|
144
|
+
* the whole output. A read that holds less than was sent is that end, so it
|
|
145
|
+
* stops the poll and publishes nothing: an empty snapshot would clear the
|
|
146
|
+
* terminal.
|
|
147
|
+
*
|
|
148
|
+
* One read runs at a time: a poll that comes during a read is skipped, so a
|
|
149
|
+
* read that Claude Code never answers queues nothing behind it. A read that
|
|
150
|
+
* fails is tried again at the next poll. `publish` must not reject.
|
|
151
|
+
*/
|
|
152
|
+
export class TaskOutputPoll {
|
|
153
|
+
read;
|
|
154
|
+
publish;
|
|
155
|
+
sentBytes = 0;
|
|
156
|
+
sent = false;
|
|
157
|
+
stopped = false;
|
|
158
|
+
/** A read is in progress, or the publish of its text. */
|
|
159
|
+
busy = false;
|
|
160
|
+
/** The publish in progress, or the last one. */
|
|
161
|
+
publishing = Promise.resolve();
|
|
162
|
+
timer;
|
|
163
|
+
constructor(read, publish) {
|
|
164
|
+
this.read = read;
|
|
165
|
+
this.publish = publish;
|
|
166
|
+
this.timer = setInterval(() => void this.poll(), BACKGROUND_OUTPUT_POLL_MS);
|
|
167
|
+
// A command that runs on must not keep the agent process alive.
|
|
168
|
+
this.timer.unref();
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Stops, once a publish in progress is out. Returns whether any text was
|
|
172
|
+
* published: the tool result then replaces it with the whole output.
|
|
173
|
+
*
|
|
174
|
+
* A read in progress is not waited for. It publishes nothing after this,
|
|
175
|
+
* and Claude Code may never answer it.
|
|
176
|
+
*/
|
|
177
|
+
async finish() {
|
|
178
|
+
this.stop();
|
|
179
|
+
await this.publishing;
|
|
180
|
+
return this.sent;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Stops now and returns whether any text was published, for a caller whose
|
|
184
|
+
* `publish` sends in the same synchronous step (v2), so none is in progress.
|
|
185
|
+
*/
|
|
186
|
+
end() {
|
|
187
|
+
this.stop();
|
|
188
|
+
return this.sent;
|
|
189
|
+
}
|
|
190
|
+
/** Stops without waiting: the command's task, the query or the session ended. */
|
|
191
|
+
stop() {
|
|
192
|
+
clearInterval(this.timer);
|
|
193
|
+
this.stopped = true;
|
|
194
|
+
}
|
|
195
|
+
async poll() {
|
|
196
|
+
if (this.stopped || this.busy)
|
|
197
|
+
return;
|
|
198
|
+
this.busy = true;
|
|
199
|
+
try {
|
|
200
|
+
const read = await this.read();
|
|
201
|
+
if (this.stopped)
|
|
202
|
+
return;
|
|
203
|
+
if (read.total_bytes < this.sentBytes) {
|
|
204
|
+
this.stop();
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
const output = this.newText(read);
|
|
208
|
+
if (output === undefined)
|
|
209
|
+
return;
|
|
210
|
+
this.sentBytes = read.total_bytes;
|
|
211
|
+
this.sent = true;
|
|
212
|
+
this.publishing = this.publish(output);
|
|
213
|
+
await this.publishing;
|
|
214
|
+
}
|
|
215
|
+
catch {
|
|
216
|
+
// The read failed: try again at the next poll.
|
|
217
|
+
}
|
|
218
|
+
finally {
|
|
219
|
+
this.busy = false;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* The text that `read` adds to what was sent, or undefined when it adds none
|
|
224
|
+
* yet. `read` holds at least the bytes that were sent.
|
|
225
|
+
*/
|
|
226
|
+
newText({ output, total_bytes, truncated }) {
|
|
227
|
+
if (total_bytes === this.sentBytes || output.endsWith("\uFFFD"))
|
|
228
|
+
return undefined;
|
|
229
|
+
const bytes = Buffer.from(output, "utf8");
|
|
230
|
+
const added = total_bytes - this.sentBytes;
|
|
231
|
+
const exact = truncated
|
|
232
|
+
? added <= bytes.length - CUT_CHARACTER_BYTES
|
|
233
|
+
: bytes.length === total_bytes;
|
|
234
|
+
// `sentBytes` ends a read that ended in a whole character, so the cut is
|
|
235
|
+
// at a character boundary.
|
|
236
|
+
if (exact) {
|
|
237
|
+
return { text: bytes.subarray(bytes.length - added).toString("utf8"), replaces: false };
|
|
238
|
+
}
|
|
239
|
+
return { text: output, replaces: true };
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* The id of the tool call whose command the task `started` runs in the
|
|
244
|
+
* foreground, or undefined for any other task. Claude Code starts the task of
|
|
245
|
+
* a foreground command once the command has run for a few seconds (3.1 s with
|
|
246
|
+
* CLI 2.1.325). A faster command gets no task, and its output comes with its
|
|
247
|
+
* tool result, as before.
|
|
248
|
+
*/
|
|
249
|
+
export function foregroundCommandToolCall(started) {
|
|
250
|
+
return started.task_type === "local_bash" && started.is_backgrounded === false
|
|
251
|
+
? started.tool_use_id
|
|
252
|
+
: undefined;
|
|
253
|
+
}
|
|
254
|
+
/** Whether a call of the tool `name` runs a command that a terminal shows. */
|
|
255
|
+
export function isCommandTool(name) {
|
|
256
|
+
return name === "Bash" || name === "PowerShell";
|
|
257
|
+
}
|
|
258
|
+
export function supportsTaskOutput(query) {
|
|
259
|
+
return typeof query.getTaskOutput === "function";
|
|
260
|
+
}
|
|
@@ -29,6 +29,38 @@ export declare function backgroundedBashToolCall(notification: SessionNotificati
|
|
|
29
29
|
* the exit when the command's task ends (see `Session.backgroundTerminals`).
|
|
30
30
|
*/
|
|
31
31
|
export declare function withRunningTerminal(notification: SessionNotification, toolCallId: string | undefined): SessionNotification;
|
|
32
|
+
/**
|
|
33
|
+
* How the tool result of each command whose terminal got output as the command
|
|
34
|
+
* ran reaches that terminal, by tool call id (see `withStreamedTerminal`).
|
|
35
|
+
*/
|
|
36
|
+
export type StreamedTerminals = ReadonlyMap<string, "replace" | "append">;
|
|
37
|
+
/**
|
|
38
|
+
* How the tool results of the commands `shown`, whose terminals got output as
|
|
39
|
+
* they ran, reach those terminals. A result that carries the command's whole
|
|
40
|
+
* output replaces what the terminal showed. Two results carry a text of Claude
|
|
41
|
+
* Code instead, so that text is appended to what the terminal showed:
|
|
42
|
+
* - the result of `backgrounded`, the command that went to the background:
|
|
43
|
+
* "Command running in background";
|
|
44
|
+
* - a result that `toolResultMeta` (the `tool_result_meta` of the result's
|
|
45
|
+
* message) stamps as not executed. CLI 2.1.325 stamps the command that a
|
|
46
|
+
* `session/cancel` stopped `user-rejected`, and its result is the notice
|
|
47
|
+
* "The user doesn't want to proceed with this tool use".
|
|
48
|
+
*/
|
|
49
|
+
export declare function streamedTerminals(shown: readonly string[], backgrounded: string | undefined, toolResultMeta: unknown): StreamedTerminals;
|
|
50
|
+
/**
|
|
51
|
+
* Makes the output of the tool result update of a command in `streamed` reach
|
|
52
|
+
* its terminal as `streamed` says. The terminal showed the command's output as
|
|
53
|
+
* it ran (see `SessionBackgroundWork.followForeground`):
|
|
54
|
+
* - `replace`: the output goes as `terminal_output`. The result carries the
|
|
55
|
+
* whole output again, also the end that the last read missed.
|
|
56
|
+
* - `append`: the output goes as `terminal_output_delta`, after what the
|
|
57
|
+
* terminal showed.
|
|
58
|
+
*
|
|
59
|
+
* Without this, the client's kind decides: the result of a client that appends
|
|
60
|
+
* chunks would repeat the output, and the result of any other client, such as
|
|
61
|
+
* a v2 client, would replace it also with a notice.
|
|
62
|
+
*/
|
|
63
|
+
export declare function withStreamedTerminal(notification: SessionNotification, streamed: StreamedTerminals): SessionNotification;
|
|
32
64
|
/**
|
|
33
65
|
* Keeps the tool call of a task that went on in the background running: the
|
|
34
66
|
* tool result update of a tool call in `toolCallIds` reports `in_progress`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"background.d.ts","sourceRoot":"","sources":["../../src/tool-calls/background.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"background.d.ts","sourceRoot":"","sources":["../../src/tool-calls/background.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAI7E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,mBAAmB,EACjC,uBAAuB,EAAE,WAAW,CAAC,MAAM,CAAC,EAC5C,mBAAmB,EAAE,OAAO,GAC3B,mBAAmB,CAgBrB;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,mBAAmB,EACjC,UAAU,EAAE,MAAM,GAAG,SAAS,GAC7B,mBAAmB,CAiBrB;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,WAAW,CAAC,MAAM,EAAE,SAAS,GAAG,QAAQ,CAAC,CAAC;AAE1E;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,cAAc,EAAE,OAAO,GACtB,iBAAiB,CAQnB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,mBAAmB,EACjC,QAAQ,EAAE,iBAAiB,GAC1B,mBAAmB,CAiBrB;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,mBAAmB,EACjC,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,GAC/B,mBAAmB,CAUrB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AIR_ASYNC_TASKS_CAPABILITY, withAirMeta } from "../air-extension.js";
|
|
2
|
+
import { parseToolResultMeta } from "../tool-result-meta.js";
|
|
2
3
|
/**
|
|
3
4
|
* Marks the Bash `tool_call_update` whose command detached into the background.
|
|
4
5
|
*
|
|
@@ -59,6 +60,58 @@ export function withRunningTerminal(notification, toolCallId) {
|
|
|
59
60
|
delete next._meta;
|
|
60
61
|
return { ...notification, update: next };
|
|
61
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* How the tool results of the commands `shown`, whose terminals got output as
|
|
65
|
+
* they ran, reach those terminals. A result that carries the command's whole
|
|
66
|
+
* output replaces what the terminal showed. Two results carry a text of Claude
|
|
67
|
+
* Code instead, so that text is appended to what the terminal showed:
|
|
68
|
+
* - the result of `backgrounded`, the command that went to the background:
|
|
69
|
+
* "Command running in background";
|
|
70
|
+
* - a result that `toolResultMeta` (the `tool_result_meta` of the result's
|
|
71
|
+
* message) stamps as not executed. CLI 2.1.325 stamps the command that a
|
|
72
|
+
* `session/cancel` stopped `user-rejected`, and its result is the notice
|
|
73
|
+
* "The user doesn't want to proceed with this tool use".
|
|
74
|
+
*/
|
|
75
|
+
export function streamedTerminals(shown, backgrounded, toolResultMeta) {
|
|
76
|
+
const notExecuted = parseToolResultMeta(toolResultMeta);
|
|
77
|
+
return new Map(shown.map((toolCallId) => [
|
|
78
|
+
toolCallId,
|
|
79
|
+
toolCallId === backgrounded || notExecuted?.has(toolCallId) ? "append" : "replace",
|
|
80
|
+
]));
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Makes the output of the tool result update of a command in `streamed` reach
|
|
84
|
+
* its terminal as `streamed` says. The terminal showed the command's output as
|
|
85
|
+
* it ran (see `SessionBackgroundWork.followForeground`):
|
|
86
|
+
* - `replace`: the output goes as `terminal_output`. The result carries the
|
|
87
|
+
* whole output again, also the end that the last read missed.
|
|
88
|
+
* - `append`: the output goes as `terminal_output_delta`, after what the
|
|
89
|
+
* terminal showed.
|
|
90
|
+
*
|
|
91
|
+
* Without this, the client's kind decides: the result of a client that appends
|
|
92
|
+
* chunks would repeat the output, and the result of any other client, such as
|
|
93
|
+
* a v2 client, would replace it also with a notice.
|
|
94
|
+
*/
|
|
95
|
+
export function withStreamedTerminal(notification, streamed) {
|
|
96
|
+
const update = notification.update;
|
|
97
|
+
const how = update.sessionUpdate === "tool_call_update" && streamed.get(update.toolCallId);
|
|
98
|
+
if (update.sessionUpdate !== "tool_call_update" || !how || !update._meta)
|
|
99
|
+
return notification;
|
|
100
|
+
const { terminal_output_delta: delta, terminal_output: whole, ...meta } = update._meta;
|
|
101
|
+
const output = delta ?? whole;
|
|
102
|
+
if (output === undefined)
|
|
103
|
+
return notification;
|
|
104
|
+
return {
|
|
105
|
+
...notification,
|
|
106
|
+
update: {
|
|
107
|
+
...update,
|
|
108
|
+
_meta: {
|
|
109
|
+
...meta,
|
|
110
|
+
...(how === "replace" ? { terminal_output: output } : { terminal_output_delta: output }),
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
}
|
|
62
115
|
/**
|
|
63
116
|
* Keeps the tool call of a task that went on in the background running: the
|
|
64
117
|
* tool result update of a tool call in `toolCallIds` reports `in_progress`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acp-agent.d.ts","sourceRoot":"","sources":["../../src/v1/acp-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EACR,mBAAmB,EAEnB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAGlB,sBAAsB,EACtB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAElB,oBAAoB,EACpB,qBAAqB,EAErB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,EAEb,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EAEpB,kBAAkB,EAClB,mBAAmB,EAEnB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAEhB,6BAA6B,EAC7B,8BAA8B,EAC9B,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,u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;;;;;oEAWoE;AACpE,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC,EAC3D,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,cAAc,CAAC,CAczB;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,GACvC,QAAQ,CAgDV"}
|
package/dist/v1/acp-agent.js
CHANGED
|
@@ -47,7 +47,7 @@ import { clientSupportsNotices, collapseHookSpeaker, informationalNotice, MAX_NO
|
|
|
47
47
|
import { clearHookCallbacks, createPostToolUseHook, createTaskHook, changedTaskPlanEntries, forgetPublishedTaskPlan, unregisterHookCallback, } from "../tools.js";
|
|
48
48
|
import { addModelUsage, getMatchingModelUsage, modelUsageIncrement, normalizeModelUsage, quotaMeta, resumedFirstResultModelUsage, snapshotFromUsage, tallyTotal, totalTokens, ZERO_USAGE, } from "../session-usage.js";
|
|
49
49
|
import { previewPatchContent } from "../diff.js";
|
|
50
|
-
import { backgroundedBashToolCall, withRunningTerminal } from "../tool-calls/background.js";
|
|
50
|
+
import { backgroundedBashToolCall, withRunningTerminal, withStreamedTerminal, } from "../tool-calls/background.js";
|
|
51
51
|
import { ChangedMetaClient, ClientConnection } from "./client-connection.js";
|
|
52
52
|
import { ToolCallFieldTracker } from "../tool-calls/field-tracker.js";
|
|
53
53
|
import { RetractedToolCalls } from "../tool-calls/retracted.js";
|
|
@@ -2482,6 +2482,12 @@ export class ClaudeAcpAgent {
|
|
|
2482
2482
|
if (results.length === 0)
|
|
2483
2483
|
return;
|
|
2484
2484
|
const resultCount = content.filter((block) => block.type === "tool_result").length;
|
|
2485
|
+
const toolResultMeta = message.tool_result_meta;
|
|
2486
|
+
// As for any tool result: the command's output is read no more, and the
|
|
2487
|
+
// result's output replaces what the terminal showed, or follows it.
|
|
2488
|
+
const streamedTerminals = await session.background.finishForeground(results, {
|
|
2489
|
+
toolResultMeta,
|
|
2490
|
+
});
|
|
2485
2491
|
for (const notification of toAcpNotifications(results, "user", params.sessionId, session.toolUseCache, routedNotificationClient, this.logger, {
|
|
2486
2492
|
clientCapabilities: this.clientCapabilities,
|
|
2487
2493
|
toolCallCapabilities: this.toolCallCapabilities,
|
|
@@ -2494,10 +2500,10 @@ export class ClaudeAcpAgent {
|
|
|
2494
2500
|
messageId: messageIdForGrouping(message),
|
|
2495
2501
|
// `tool_use_result` describes the one result of its message.
|
|
2496
2502
|
toolUseResult: results.length === resultCount ? message.tool_use_result : undefined,
|
|
2497
|
-
toolResultMeta
|
|
2503
|
+
toolResultMeta,
|
|
2498
2504
|
cancelled: true,
|
|
2499
2505
|
})) {
|
|
2500
|
-
await sendUpdate(notification);
|
|
2506
|
+
await sendUpdate(withStreamedTerminal(notification, streamedTerminals));
|
|
2501
2507
|
}
|
|
2502
2508
|
};
|
|
2503
2509
|
/** The model cycle that Claude Code started on its own ends, and its end is
|
|
@@ -3577,6 +3583,13 @@ export class ClaudeAcpAgent {
|
|
|
3577
3583
|
skip_transcript: message.skip_transcript,
|
|
3578
3584
|
tool_use_id: message.tool_use_id,
|
|
3579
3585
|
});
|
|
3586
|
+
// A foreground command's terminal shows its output as it runs.
|
|
3587
|
+
session.background.followForeground(message, {
|
|
3588
|
+
owner: session,
|
|
3589
|
+
capabilities: this.toolCallCapabilities,
|
|
3590
|
+
send: sendUpdate,
|
|
3591
|
+
logger: this.logger,
|
|
3592
|
+
});
|
|
3580
3593
|
break;
|
|
3581
3594
|
case "task_notification":
|
|
3582
3595
|
if (isLateTaskRun(session, message.task_id, message.run_id)) {
|
|
@@ -4922,6 +4935,7 @@ export class ClaudeAcpAgent {
|
|
|
4922
4935
|
const acceptedPlanToolUseId = observeExitPlanToolResults(message, content, session);
|
|
4923
4936
|
let backgroundedToolCalls = new Set();
|
|
4924
4937
|
let runningTerminal;
|
|
4938
|
+
let streamedTerminals = new Map();
|
|
4925
4939
|
if (message.type === "user") {
|
|
4926
4940
|
rememberResolvedToolNames(session, content);
|
|
4927
4941
|
recordSubagentFileEdits(session.activeTurn, message.parent_tool_use_id, content, session.toolUseCache);
|
|
@@ -4937,6 +4951,12 @@ export class ClaudeAcpAgent {
|
|
|
4937
4951
|
});
|
|
4938
4952
|
if (backgroundBashTask)
|
|
4939
4953
|
await asyncTasks.taskBackgrounded(backgroundBashTask);
|
|
4954
|
+
// The result's output replaces what a foreground command's
|
|
4955
|
+
// terminal showed as the command ran, or follows it.
|
|
4956
|
+
streamedTerminals = await session.background.finishForeground(content, {
|
|
4957
|
+
backgrounded: backgroundBashTask?.toolCallId,
|
|
4958
|
+
toolResultMeta: message.tool_result_meta,
|
|
4959
|
+
});
|
|
4940
4960
|
// The command's terminal runs until its task ends, unless the
|
|
4941
4961
|
// task has ended already (a fast command can end before the tool
|
|
4942
4962
|
// result comes).
|
|
@@ -4989,7 +5009,7 @@ export class ClaudeAcpAgent {
|
|
|
4989
5009
|
// filtered out of `content` above; blocks that do pass through
|
|
4990
5010
|
// (e.g. a subagent image) carry the stamped parentToolUseId
|
|
4991
5011
|
// meta and are excluded there.
|
|
4992
|
-
await sendUpdate(withRunningTerminal(backgroundedBashToolCall(acceptedPlanToolResult(notification, acceptedPlanToolUseId), backgroundedToolCalls, asyncTasks.enabled), runningTerminal));
|
|
5012
|
+
await sendUpdate(withRunningTerminal(withStreamedTerminal(backgroundedBashToolCall(acceptedPlanToolResult(notification, acceptedPlanToolUseId), backgroundedToolCalls, asyncTasks.enabled), streamedTerminals), runningTerminal));
|
|
4993
5013
|
}
|
|
4994
5014
|
break;
|
|
4995
5015
|
}
|
|
@@ -5643,6 +5663,7 @@ export class ClaudeAcpAgent {
|
|
|
5643
5663
|
session.contextCompaction = undefined;
|
|
5644
5664
|
session.idleCompaction?.dispose();
|
|
5645
5665
|
session.settingsManager.dispose();
|
|
5666
|
+
session.background.queryClosed();
|
|
5646
5667
|
session.input.end();
|
|
5647
5668
|
session.query.close();
|
|
5648
5669
|
}
|
|
@@ -1,22 +1,48 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* The display terminals of a session's commands, for a client that renders
|
|
3
|
+
* terminals from the terminal extension and is not AIR (AIR shows a command
|
|
4
|
+
* through its async tasks):
|
|
5
|
+
*
|
|
6
|
+
* - A command that went to the background: its terminal runs from its Bash
|
|
7
|
+
* tool result until its task ends.
|
|
8
|
+
* - A command that runs in the foreground: its terminal gets the command's
|
|
9
|
+
* output as it runs, for a client that appends chunks
|
|
10
|
+
* (`terminal_output_delta`).
|
|
6
11
|
*/
|
|
7
12
|
import type { AcpSessionNotification } from "../acp-subagents.js";
|
|
8
|
-
|
|
13
|
+
import type { Logger } from "../logger.js";
|
|
14
|
+
import { type StreamedTerminals } from "../tool-calls/background.js";
|
|
15
|
+
import type { ClientCapabilities } from "../tool-calls/client-capabilities.js";
|
|
16
|
+
/** The display terminal of a command. */
|
|
9
17
|
export interface BackgroundTerminal {
|
|
10
|
-
/** The
|
|
18
|
+
/** The command's tool call, whose id names the terminal. */
|
|
11
19
|
toolCallId: string;
|
|
12
20
|
/** The subagent tool call that ran the command, if any. */
|
|
13
21
|
parentToolUseId?: string;
|
|
14
22
|
}
|
|
15
|
-
/** The
|
|
23
|
+
/** The session's part of what {@link SessionBackgroundWork.followForeground} reads. */
|
|
24
|
+
export interface ForegroundCommandOwner {
|
|
25
|
+
/** The session's query, which reads a task's output when it has `getTaskOutput`. */
|
|
26
|
+
query: object;
|
|
27
|
+
liveBackgroundTasks: ReadonlyMap<string, {
|
|
28
|
+
parentToolUseId?: string;
|
|
29
|
+
}>;
|
|
30
|
+
toolUseCache: Record<string, {
|
|
31
|
+
name: string;
|
|
32
|
+
} | undefined>;
|
|
33
|
+
emittedToolCalls: ReadonlySet<string>;
|
|
34
|
+
}
|
|
35
|
+
/** The terminals of the commands that one root session, and its subagents, run. */
|
|
16
36
|
export declare class SessionBackgroundWork {
|
|
17
37
|
private readonly sessionId;
|
|
18
38
|
/** The terminals of the commands that went to the background, by task id. */
|
|
19
39
|
private readonly terminals;
|
|
40
|
+
/**
|
|
41
|
+
* The output polls of the commands that run in the foreground, by tool call
|
|
42
|
+
* id, each with its task. A poll stays here after its task ended, stopped,
|
|
43
|
+
* until the command's tool result asks whether its terminal got output.
|
|
44
|
+
*/
|
|
45
|
+
private readonly foreground;
|
|
20
46
|
constructor(sessionId: string);
|
|
21
47
|
/**
|
|
22
48
|
* Keeps the display terminal of the command `taskId` running after its Bash
|
|
@@ -24,11 +50,63 @@ export declare class SessionBackgroundWork {
|
|
|
24
50
|
*/
|
|
25
51
|
terminalStarted(taskId: string, terminal: BackgroundTerminal): void;
|
|
26
52
|
/**
|
|
27
|
-
* The task `
|
|
28
|
-
*
|
|
53
|
+
* The task `started` began. When it runs a command in the foreground whose
|
|
54
|
+
* terminal the client shows (see {@link foregroundBashTerminal}), reads the
|
|
55
|
+
* command's output into that terminal as it runs (see
|
|
56
|
+
* {@link TaskOutputPoll}), until its tool result ({@link finishForeground})
|
|
57
|
+
* or the end of its task ({@link taskEnded}).
|
|
58
|
+
*
|
|
59
|
+
* Only for a client that appends chunks (`terminal_output_delta`) and is not
|
|
60
|
+
* AIR. A client that declared only `terminal_output`, and AIR, get the
|
|
61
|
+
* output with the tool result. A query without `getTaskOutput` reads none.
|
|
62
|
+
*
|
|
63
|
+
* `send` sends an update of the terminal's tool call, routed as the call's
|
|
64
|
+
* other updates. A chunk that cannot be sent is logged: the tool result
|
|
65
|
+
* carries the whole output.
|
|
66
|
+
*/
|
|
67
|
+
followForeground(started: {
|
|
68
|
+
task_id: string;
|
|
69
|
+
} & Parameters<typeof foregroundBashTerminal>[1], { owner, capabilities, send, logger, }: {
|
|
70
|
+
owner: ForegroundCommandOwner;
|
|
71
|
+
capabilities: ClientCapabilities;
|
|
72
|
+
send: Send;
|
|
73
|
+
logger: Logger;
|
|
74
|
+
}): void;
|
|
75
|
+
/**
|
|
76
|
+
* The tool results in `content` came: stops reading the output of each
|
|
77
|
+
* foreground command among them. Returns how the result of each command
|
|
78
|
+
* whose terminal got output as it ran reaches that terminal (see
|
|
79
|
+
* `streamedTerminals`, for `withStreamedTerminal`): `backgrounded` is the
|
|
80
|
+
* command that went to the background, and `toolResultMeta` the
|
|
81
|
+
* `tool_result_meta` of the results' message.
|
|
82
|
+
*/
|
|
83
|
+
finishForeground(content: unknown, { backgrounded, toolResultMeta }?: {
|
|
84
|
+
backgrounded?: string;
|
|
85
|
+
toolResultMeta?: unknown;
|
|
86
|
+
}): Promise<StreamedTerminals>;
|
|
87
|
+
/** Stops every foreground output poll: the session's query closed. */
|
|
88
|
+
queryClosed(): void;
|
|
89
|
+
/**
|
|
90
|
+
* The task `taskId` ended. Its command's output is read no more: a tool call
|
|
91
|
+
* that gets no result, such as one of a reply that Claude Code took back,
|
|
92
|
+
* would otherwise be read until the query closes. The terminal of a command
|
|
93
|
+
* that went to the background exits, with no exit code: Claude Code reports
|
|
94
|
+
* none for a command.
|
|
29
95
|
*/
|
|
30
96
|
taskEnded(taskId: string, send: Send): Promise<void>;
|
|
31
97
|
}
|
|
32
98
|
type Send = (notification: AcpSessionNotification) => Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* The display terminal of the foreground command that the task `started`
|
|
101
|
+
* runs (see `foregroundCommandToolCall`), or undefined when it runs none that
|
|
102
|
+
* the client shows: a task of another kind, one of a tool call that the client
|
|
103
|
+
* was not sent, or one of a subagent whose Agent call is not known.
|
|
104
|
+
*/
|
|
105
|
+
export declare function foregroundBashTerminal(owner: Omit<ForegroundCommandOwner, "query">, started: {
|
|
106
|
+
task_type?: string;
|
|
107
|
+
is_backgrounded?: boolean;
|
|
108
|
+
tool_use_id?: string;
|
|
109
|
+
parent_task_id?: string;
|
|
110
|
+
}): BackgroundTerminal | undefined;
|
|
33
111
|
export {};
|
|
34
112
|
//# sourceMappingURL=background-work.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"background-work.d.ts","sourceRoot":"","sources":["../../src/v1/background-work.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"background-work.d.ts","sourceRoot":"","sources":["../../src/v1/background-work.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAQlE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,KAAK,iBAAiB,EAAqB,MAAM,6BAA6B,CAAC;AACxF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAE/E,yCAAyC;AACzC,MAAM,WAAW,kBAAkB;IACjC,4DAA4D;IAC5D,UAAU,EAAE,MAAM,CAAC;IACnB,2DAA2D;IAC3D,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,uFAAuF;AACvF,MAAM,WAAW,sBAAsB;IACrC,oFAAoF;IACpF,KAAK,EAAE,MAAM,CAAC;IACd,mBAAmB,EAAE,WAAW,CAAC,MAAM,EAAE;QAAE,eAAe,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACvE,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC,CAAC;IAC3D,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACvC;AAED,mFAAmF;AACnF,qBAAa,qBAAqB;IAUpB,OAAO,CAAC,QAAQ,CAAC,SAAS;IATtC,6EAA6E;IAC7E,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAyC;IACnE;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA+D;gBAE7D,SAAS,EAAE,MAAM;IAE9C;;;OAGG;IACH,eAAe,CAAC,MAAM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ool, supportsTaskOutput, TaskOutputPoll, } from "../background-output.js";
|
|
2
|
+
import { streamedTerminals } from "../tool-calls/background.js";
|
|
3
|
+
/** The terminals of the commands that one root session, and its subagents, run. */
|
|
2
4
|
export class SessionBackgroundWork {
|
|
3
5
|
sessionId;
|
|
4
6
|
/** The terminals of the commands that went to the background, by task id. */
|
|
5
7
|
terminals = new Map();
|
|
8
|
+
/**
|
|
9
|
+
* The output polls of the commands that run in the foreground, by tool call
|
|
10
|
+
* id, each with its task. A poll stays here after its task ended, stopped,
|
|
11
|
+
* until the command's tool result asks whether its terminal got output.
|
|
12
|
+
*/
|
|
13
|
+
foreground = new Map();
|
|
6
14
|
constructor(sessionId) {
|
|
7
15
|
this.sessionId = sessionId;
|
|
8
16
|
}
|
|
@@ -14,10 +22,75 @@ export class SessionBackgroundWork {
|
|
|
14
22
|
this.terminals.set(taskId, terminal);
|
|
15
23
|
}
|
|
16
24
|
/**
|
|
17
|
-
* The task `
|
|
18
|
-
*
|
|
25
|
+
* The task `started` began. When it runs a command in the foreground whose
|
|
26
|
+
* terminal the client shows (see {@link foregroundBashTerminal}), reads the
|
|
27
|
+
* command's output into that terminal as it runs (see
|
|
28
|
+
* {@link TaskOutputPoll}), until its tool result ({@link finishForeground})
|
|
29
|
+
* or the end of its task ({@link taskEnded}).
|
|
30
|
+
*
|
|
31
|
+
* Only for a client that appends chunks (`terminal_output_delta`) and is not
|
|
32
|
+
* AIR. A client that declared only `terminal_output`, and AIR, get the
|
|
33
|
+
* output with the tool result. A query without `getTaskOutput` reads none.
|
|
34
|
+
*
|
|
35
|
+
* `send` sends an update of the terminal's tool call, routed as the call's
|
|
36
|
+
* other updates. A chunk that cannot be sent is logged: the tool result
|
|
37
|
+
* carries the whole output.
|
|
38
|
+
*/
|
|
39
|
+
followForeground(started, { owner, capabilities, send, logger, }) {
|
|
40
|
+
if (!capabilities.terminalOutputDelta || capabilities.air.client)
|
|
41
|
+
return;
|
|
42
|
+
const query = owner.query;
|
|
43
|
+
const terminal = foregroundBashTerminal(owner, started);
|
|
44
|
+
if (!terminal || !supportsTaskOutput(query) || this.foreground.has(terminal.toolCallId)) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const taskId = started.task_id;
|
|
48
|
+
this.foreground.set(terminal.toolCallId, {
|
|
49
|
+
taskId,
|
|
50
|
+
poll: new TaskOutputPoll(() => query.getTaskOutput(taskId), (output) => send(terminalOutputUpdate(this.sessionId, terminal, output)).catch((error) => {
|
|
51
|
+
logger.error("Failed to send command output:", error);
|
|
52
|
+
})),
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The tool results in `content` came: stops reading the output of each
|
|
57
|
+
* foreground command among them. Returns how the result of each command
|
|
58
|
+
* whose terminal got output as it ran reaches that terminal (see
|
|
59
|
+
* `streamedTerminals`, for `withStreamedTerminal`): `backgrounded` is the
|
|
60
|
+
* command that went to the background, and `toolResultMeta` the
|
|
61
|
+
* `tool_result_meta` of the results' message.
|
|
62
|
+
*/
|
|
63
|
+
async finishForeground(content, { backgrounded, toolResultMeta } = {}) {
|
|
64
|
+
const shown = [];
|
|
65
|
+
for (const block of Array.isArray(content) ? content : []) {
|
|
66
|
+
const toolCallId = block?.type === "tool_result" ? block.tool_use_id : undefined;
|
|
67
|
+
const followed = typeof toolCallId === "string" ? this.foreground.get(toolCallId) : undefined;
|
|
68
|
+
if (!followed || typeof toolCallId !== "string")
|
|
69
|
+
continue;
|
|
70
|
+
this.foreground.delete(toolCallId);
|
|
71
|
+
if (await followed.poll.finish())
|
|
72
|
+
shown.push(toolCallId);
|
|
73
|
+
}
|
|
74
|
+
return streamedTerminals(shown, backgrounded, toolResultMeta);
|
|
75
|
+
}
|
|
76
|
+
/** Stops every foreground output poll: the session's query closed. */
|
|
77
|
+
queryClosed() {
|
|
78
|
+
for (const { poll } of this.foreground.values())
|
|
79
|
+
poll.stop();
|
|
80
|
+
this.foreground.clear();
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The task `taskId` ended. Its command's output is read no more: a tool call
|
|
84
|
+
* that gets no result, such as one of a reply that Claude Code took back,
|
|
85
|
+
* would otherwise be read until the query closes. The terminal of a command
|
|
86
|
+
* that went to the background exits, with no exit code: Claude Code reports
|
|
87
|
+
* none for a command.
|
|
19
88
|
*/
|
|
20
89
|
async taskEnded(taskId, send) {
|
|
90
|
+
for (const followed of this.foreground.values()) {
|
|
91
|
+
if (followed.taskId === taskId)
|
|
92
|
+
followed.poll.stop();
|
|
93
|
+
}
|
|
21
94
|
const terminal = this.terminals.get(taskId);
|
|
22
95
|
if (!terminal)
|
|
23
96
|
return;
|
|
@@ -25,6 +98,42 @@ export class SessionBackgroundWork {
|
|
|
25
98
|
await send(terminalExit(this.sessionId, terminal));
|
|
26
99
|
}
|
|
27
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* The display terminal of the foreground command that the task `started`
|
|
103
|
+
* runs (see `foregroundCommandToolCall`), or undefined when it runs none that
|
|
104
|
+
* the client shows: a task of another kind, one of a tool call that the client
|
|
105
|
+
* was not sent, or one of a subagent whose Agent call is not known.
|
|
106
|
+
*/
|
|
107
|
+
export function foregroundBashTerminal(owner, started) {
|
|
108
|
+
const toolCallId = foregroundCommandToolCall(started);
|
|
109
|
+
if (toolCallId === undefined ||
|
|
110
|
+
!owner.emittedToolCalls.has(toolCallId) ||
|
|
111
|
+
!isCommandTool(owner.toolUseCache[toolCallId]?.name)) {
|
|
112
|
+
return undefined;
|
|
113
|
+
}
|
|
114
|
+
if (started.parent_task_id === undefined)
|
|
115
|
+
return { toolCallId };
|
|
116
|
+
// A subagent's command: its updates go under the subagent's Agent call.
|
|
117
|
+
const parentToolUseId = owner.liveBackgroundTasks.get(started.parent_task_id)?.parentToolUseId;
|
|
118
|
+
return parentToolUseId ? { toolCallId, parentToolUseId } : undefined;
|
|
119
|
+
}
|
|
120
|
+
/** The update that gives the terminal of `terminal` the text `output`. */
|
|
121
|
+
function terminalOutputUpdate(sessionId, terminal, output) {
|
|
122
|
+
const data = { terminal_id: terminal.toolCallId, data: output.text };
|
|
123
|
+
return {
|
|
124
|
+
sessionId,
|
|
125
|
+
update: {
|
|
126
|
+
sessionUpdate: "tool_call_update",
|
|
127
|
+
toolCallId: terminal.toolCallId,
|
|
128
|
+
_meta: {
|
|
129
|
+
...(terminal.parentToolUseId
|
|
130
|
+
? { claudeCode: { parentToolUseId: terminal.parentToolUseId } }
|
|
131
|
+
: {}),
|
|
132
|
+
...(output.replaces ? { terminal_output: data } : { terminal_output_delta: data }),
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
}
|
|
28
137
|
/** The update that exits the terminal of `terminal`, with no exit code. */
|
|
29
138
|
function terminalExit(sessionId, terminal) {
|
|
30
139
|
return {
|
package/dist/v2/session.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/v2/session.ts"],"names":[],"mappings":"AAkCA,OAAO,EAEL,KAAK,+BAA+B,EACpC,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAE9B,KAAK,cAAc,EACpB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,KAAK,EAAE,MAAM,mDAAmD,CAAC;AAC7E,OAAO,KAAK,EAGV,cAAc,EACd,gBAAgB,EAChB,KAAK,EAGL,cAAc,EACf,MAAM,gCAAgC,CAAC;AAGxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/v2/session.ts"],"names":[],"mappings":"AAkCA,OAAO,EAEL,KAAK,+BAA+B,EACpC,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAE9B,KAAK,cAAc,EACpB,MAAM,mC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e;IAMvB;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAgBnB,OAAO,CAAC,WAAW;IAoBnB,OAAO,CAAC,IAAI;IAIZ,gFAAgF;IAChF,OAAO,CAAC,gBAAgB;IAKxB,yFAAyF;IACzF,OAAO,CAAC,UAAU;IAWlB,OAAO,CAAC,WAAW;CAGpB"}
|
package/dist/v2/session.js
CHANGED
|
@@ -35,6 +35,7 @@ import { randomUUID } from "node:crypto";
|
|
|
35
35
|
import { RequestError, } from "@agentclientprotocol/sdk/unstable";
|
|
36
36
|
import { AUTONOMOUS_RESULT_ORIGINS } from "../result-end.js";
|
|
37
37
|
import { promptToClaude } from "../prompt-to-claude.js";
|
|
38
|
+
import { supportsTaskOutput } from "../background-output.js";
|
|
38
39
|
import { v1PromptRequest } from "./prompt.js";
|
|
39
40
|
import { V2Background, stateUpdate as currentStateUpdate } from "./background.js";
|
|
40
41
|
import { isLocalCommandOutput } from "../message-filters.js";
|
|
@@ -211,6 +212,12 @@ export class V2Session {
|
|
|
211
212
|
stopTask: async (taskId) => {
|
|
212
213
|
await this.query?.stopTask(taskId);
|
|
213
214
|
},
|
|
215
|
+
taskOutput: () => {
|
|
216
|
+
const query = this.query;
|
|
217
|
+
return query && supportsTaskOutput(query)
|
|
218
|
+
? (taskId) => query.getTaskOutput(taskId)
|
|
219
|
+
: undefined;
|
|
220
|
+
},
|
|
214
221
|
}, this.output);
|
|
215
222
|
this.tasks.hostRequest = (request, signal) => unlessWithdrawn(signal, () => connection.requestPermission(request, signal));
|
|
216
223
|
this.elicitations = new SessionElicitations({
|
package/dist/v2/tasks.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type * as v2 from "@agentclientprotocol/sdk/experimental/v2/unstable";
|
|
|
3
3
|
import type { HookInput, SDKMessage, SDKUserMessage, SessionMessage } from "@anthropic-ai/claude-agent-sdk";
|
|
4
4
|
import type { Logger } from "../logger.js";
|
|
5
5
|
import type { AcpSessionNotification } from "../acp-subagents.js";
|
|
6
|
+
import { type TaskOutput } from "../background-output.js";
|
|
6
7
|
import { type SubagentModels } from "../native-subagents.js";
|
|
7
8
|
import type { V2Background, WorkStateName } from "./background.js";
|
|
8
9
|
import type { V2UpdateTranslator } from "./update-translator.js";
|
|
@@ -32,6 +33,11 @@ export interface TaskHost {
|
|
|
32
33
|
/** The root session's modes, for a child's `mode`. */
|
|
33
34
|
modes(): SessionModeState["availableModes"];
|
|
34
35
|
stopTask(taskId: string): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* The reader of the end of a shell task's output (Claude Code's
|
|
38
|
+
* `get_task_output`), or undefined when the query does not have the control.
|
|
39
|
+
*/
|
|
40
|
+
taskOutput(): ((taskId: string) => Promise<TaskOutput>) | undefined;
|
|
35
41
|
}
|
|
36
42
|
/** Where a permission request or elicitation goes: the root session or a child. */
|
|
37
43
|
export interface RequestTarget {
|
|
@@ -86,6 +92,12 @@ export declare class SessionTasks {
|
|
|
86
92
|
private level;
|
|
87
93
|
/** The terminals of the commands that went to the background, by task id. */
|
|
88
94
|
private readonly terminals;
|
|
95
|
+
/**
|
|
96
|
+
* The output polls of the commands that run in the foreground, by tool call
|
|
97
|
+
* id. A poll stays here after its task ended, stopped, until the command's
|
|
98
|
+
* tool result asks whether its terminal got output.
|
|
99
|
+
*/
|
|
100
|
+
private readonly foreground;
|
|
89
101
|
/**
|
|
90
102
|
* The tool calls whose tasks go on in the background, by task id. A call
|
|
91
103
|
* that the adapter started for its task (see {@link adoptTasks}) has the
|
|
@@ -495,6 +507,16 @@ export declare class SessionTasks {
|
|
|
495
507
|
private adoptTasks;
|
|
496
508
|
/** The task of the terminal or tool call `target` that `sessionId` lists. */
|
|
497
509
|
private listedTask;
|
|
510
|
+
/**
|
|
511
|
+
* Starts reading the output of the foreground command that the task
|
|
512
|
+
* `started` runs (see `foregroundCommandToolCall`) into its terminal, until
|
|
513
|
+
* its tool result or the end of its task (see {@link TaskOutputPoll}). A
|
|
514
|
+
* subagent's command goes to the subagent's session, and gets no poll
|
|
515
|
+
* before that session is announced.
|
|
516
|
+
*/
|
|
517
|
+
private followForeground;
|
|
518
|
+
/** Stops the output polls of the foreground commands: the query or the session ended. */
|
|
519
|
+
private stopForeground;
|
|
498
520
|
private followOutput;
|
|
499
521
|
private exitTerminal;
|
|
500
522
|
private endToolCall;
|
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;
|
|
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;AAElE,OAAO,EAKL,KAAK,UAAU,EAEhB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAkBL,KAAK,cAAc,EACpB,MAAM,wBAAwB,CAAC;AAUhC,OAAO,KAAK,EAAkB,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,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tasks.js
CHANGED
|
@@ -47,10 +47,10 @@ import * as fs from "node:fs";
|
|
|
47
47
|
import * as path from "node:path";
|
|
48
48
|
import { RequestError } from "@agentclientprotocol/sdk/unstable";
|
|
49
49
|
import { backgroundBashTaskFromToolResult, taskProgressFields } from "../async-tasks.js";
|
|
50
|
-
import { BackgroundOutputTail } from "../background-output.js";
|
|
50
|
+
import { BackgroundOutputTail, foregroundCommandToolCall, isCommandTool, TaskOutputPoll, } from "../background-output.js";
|
|
51
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
|
-
import { withRunningTerminal, withRunningToolCall } from "../tool-calls/background.js";
|
|
53
|
+
import { streamedTerminals, withRunningTerminal, withRunningToolCall, withStreamedTerminal, } from "../tool-calls/background.js";
|
|
54
54
|
import { ClientCapabilities } from "../tool-calls/client-capabilities.js";
|
|
55
55
|
import { AcpToolCallRenderer } from "../tool-calls/renderer.js";
|
|
56
56
|
import { workflowCard, workflowSnapshot } from "../workflow-progress.js";
|
|
@@ -99,6 +99,12 @@ export class SessionTasks {
|
|
|
99
99
|
level = new Map();
|
|
100
100
|
/** The terminals of the commands that went to the background, by task id. */
|
|
101
101
|
terminals = new Map();
|
|
102
|
+
/**
|
|
103
|
+
* The output polls of the commands that run in the foreground, by tool call
|
|
104
|
+
* id. A poll stays here after its task ended, stopped, until the command's
|
|
105
|
+
* tool result asks whether its terminal got output.
|
|
106
|
+
*/
|
|
107
|
+
foreground = new Map();
|
|
102
108
|
/**
|
|
103
109
|
* The tool calls whose tasks go on in the background, by task id. A call
|
|
104
110
|
* that the adapter started for its task (see {@link adoptTasks}) has the
|
|
@@ -236,6 +242,20 @@ export class SessionTasks {
|
|
|
236
242
|
const command = backgroundBashTaskFromToolResult(content, message.tool_use_result, toolUses, (toolUseId) => [...this.started].find(([, task]) => task.toolUseId === toolUseId && task.taskType === "local_bash")?.[0]);
|
|
237
243
|
// A fast command can end before its result: then its terminal exits with it.
|
|
238
244
|
const runningTerminal = command && this.started.has(command.taskId) ? command.toolCallId : undefined;
|
|
245
|
+
// The output that a foreground command's terminal showed as it ran is
|
|
246
|
+
// replaced by the result's, when the result carries the command's output
|
|
247
|
+
// (see `streamedTerminals`). The output file's tail goes on for a command
|
|
248
|
+
// that went to the background.
|
|
249
|
+
const shown = [];
|
|
250
|
+
for (const { tool_use_id: toolCallId } of results) {
|
|
251
|
+
const poll = this.foreground.get(toolCallId);
|
|
252
|
+
if (!poll)
|
|
253
|
+
continue;
|
|
254
|
+
this.foreground.delete(toolCallId);
|
|
255
|
+
if (poll.end())
|
|
256
|
+
shown.push(toolCallId);
|
|
257
|
+
}
|
|
258
|
+
const streamed = streamedTerminals(shown, command?.toolCallId, message.tool_result_meta);
|
|
239
259
|
if (command && runningTerminal) {
|
|
240
260
|
this.terminals.set(command.taskId, {
|
|
241
261
|
toolCallId: command.toolCallId,
|
|
@@ -275,7 +295,7 @@ export class SessionTasks {
|
|
|
275
295
|
});
|
|
276
296
|
runningToolCalls.add(toolCallId);
|
|
277
297
|
}
|
|
278
|
-
output.toolResults(message, (notification) => withRunningToolCall(withRunningTerminal(notification, runningTerminal), runningToolCalls));
|
|
298
|
+
output.toolResults(message, (notification) => withRunningToolCall(withRunningTerminal(withStreamedTerminal(notification, streamed), runningTerminal), runningToolCalls));
|
|
279
299
|
// A workflow can report progress before its launch call returns: it
|
|
280
300
|
// goes on the call after the result's own updates.
|
|
281
301
|
for (const [taskId, toolCall] of this.toolCalls) {
|
|
@@ -413,6 +433,7 @@ export class SessionTasks {
|
|
|
413
433
|
*/
|
|
414
434
|
withdrawAll() {
|
|
415
435
|
this.closed = true;
|
|
436
|
+
this.stopForeground();
|
|
416
437
|
for (const agentId of this.agentRequests.keys())
|
|
417
438
|
this.withdraw(agentId);
|
|
418
439
|
}
|
|
@@ -589,6 +610,7 @@ export class SessionTasks {
|
|
|
589
610
|
* `error`, as the root's work does.
|
|
590
611
|
*/
|
|
591
612
|
queryEnded(error) {
|
|
613
|
+
this.stopForeground();
|
|
592
614
|
for (const [taskId, terminal] of this.terminals) {
|
|
593
615
|
terminal.tail?.stop();
|
|
594
616
|
if (error)
|
|
@@ -671,6 +693,7 @@ export class SessionTasks {
|
|
|
671
693
|
taskStarted(message) {
|
|
672
694
|
const isAgent = message.task_type === "local_agent" || message.subagent_type !== undefined;
|
|
673
695
|
if (!isAgent) {
|
|
696
|
+
this.followForeground(message);
|
|
674
697
|
this.started.set(message.task_id, {
|
|
675
698
|
...(message.tool_use_id !== undefined ? { toolUseId: message.tool_use_id } : {}),
|
|
676
699
|
...(message.parent_task_id !== undefined ? { parentTaskId: message.parent_task_id } : {}),
|
|
@@ -840,6 +863,12 @@ export class SessionTasks {
|
|
|
840
863
|
: {}),
|
|
841
864
|
});
|
|
842
865
|
}
|
|
866
|
+
// A foreground command's output is read no more: a tool call that gets no
|
|
867
|
+
// result, such as one of a reply that Claude Code took back, would
|
|
868
|
+
// otherwise be read until the query ends.
|
|
869
|
+
const commandToolCall = this.started.get(taskId)?.toolUseId;
|
|
870
|
+
if (commandToolCall !== undefined)
|
|
871
|
+
this.foreground.get(commandToolCall)?.stop();
|
|
843
872
|
this.started.delete(taskId);
|
|
844
873
|
const terminal = this.terminals.get(taskId);
|
|
845
874
|
if (terminal && !terminal.ending) {
|
|
@@ -1682,6 +1711,31 @@ export class SessionTasks {
|
|
|
1682
1711
|
? [...this.toolCalls].find(([, t]) => t.toolCallId === target.toolCallId)?.[0]
|
|
1683
1712
|
: undefined;
|
|
1684
1713
|
}
|
|
1714
|
+
/**
|
|
1715
|
+
* Starts reading the output of the foreground command that the task
|
|
1716
|
+
* `started` runs (see `foregroundCommandToolCall`) into its terminal, until
|
|
1717
|
+
* its tool result or the end of its task (see {@link TaskOutputPoll}). A
|
|
1718
|
+
* subagent's command goes to the subagent's session, and gets no poll
|
|
1719
|
+
* before that session is announced.
|
|
1720
|
+
*/
|
|
1721
|
+
followForeground(started) {
|
|
1722
|
+
const read = this.host.taskOutput();
|
|
1723
|
+
const toolCallId = foregroundCommandToolCall(started);
|
|
1724
|
+
if (!read || toolCallId === undefined || this.foreground.has(toolCallId))
|
|
1725
|
+
return;
|
|
1726
|
+
const parent = started.parent_task_id === undefined ? undefined : this.children.get(started.parent_task_id);
|
|
1727
|
+
const output = started.parent_task_id === undefined ? this.rootOutput : parent?.output;
|
|
1728
|
+
if (!output?.holds(toolCallId) || !isCommandTool(output.toolUses()[toolCallId]?.name))
|
|
1729
|
+
return;
|
|
1730
|
+
const taskId = started.task_id;
|
|
1731
|
+
this.foreground.set(toolCallId, new TaskOutputPoll(() => read(taskId), async (text) => output.emitV1([terminalOutput(output.sessionId, toolCallId, text)])));
|
|
1732
|
+
}
|
|
1733
|
+
/** Stops the output polls of the foreground commands: the query or the session ended. */
|
|
1734
|
+
stopForeground() {
|
|
1735
|
+
for (const poll of this.foreground.values())
|
|
1736
|
+
poll.stop();
|
|
1737
|
+
this.foreground.clear();
|
|
1738
|
+
}
|
|
1685
1739
|
followOutput(taskId, outputFilePath) {
|
|
1686
1740
|
const terminal = this.terminals.get(taskId);
|
|
1687
1741
|
if (!terminal || !outputFilePath || !this.host.reportsBackground)
|
package/package.json
CHANGED