@agentclientprotocol/claude-agent-acp 0.109.0 → 0.109.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.
Files changed (72) hide show
  1. package/README.md +10 -5
  2. package/dist/acp-subagents.d.ts +39 -0
  3. package/dist/acp-subagents.d.ts.map +1 -1
  4. package/dist/acp-subagents.js +47 -0
  5. package/dist/auth-status-reporter.d.ts +2 -3
  6. package/dist/auth-status-reporter.d.ts.map +1 -1
  7. package/dist/auth-status-reporter.js +32 -29
  8. package/dist/auth-status.d.ts +6 -7
  9. package/dist/auth-status.d.ts.map +1 -1
  10. package/dist/auth-status.js +9 -8
  11. package/dist/client-system-prompt.d.ts +6 -4
  12. package/dist/client-system-prompt.d.ts.map +1 -1
  13. package/dist/client-system-prompt.js +7 -2
  14. package/dist/context-compaction.d.ts.map +1 -1
  15. package/dist/context-compaction.js +4 -3
  16. package/dist/native-subagents.d.ts +102 -7
  17. package/dist/native-subagents.d.ts.map +1 -1
  18. package/dist/native-subagents.js +208 -17
  19. package/dist/plans.d.ts +4 -4
  20. package/dist/providers.d.ts +34 -1
  21. package/dist/providers.d.ts.map +1 -1
  22. package/dist/providers.js +37 -1
  23. package/dist/serve.d.ts +1 -1
  24. package/dist/serve.js +1 -1
  25. package/dist/session-config-options.d.ts.map +1 -1
  26. package/dist/session-config-options.js +13 -0
  27. package/dist/subagent-replay.d.ts +49 -33
  28. package/dist/subagent-replay.d.ts.map +1 -1
  29. package/dist/subagent-replay.js +49 -52
  30. package/dist/tool-calls/renderer.d.ts +0 -9
  31. package/dist/tool-calls/renderer.d.ts.map +1 -1
  32. package/dist/tool-calls/renderer.js +1 -19
  33. package/dist/tool-calls/reporters/interaction.d.ts +9 -0
  34. package/dist/tool-calls/reporters/interaction.d.ts.map +1 -1
  35. package/dist/tool-calls/reporters/interaction.js +23 -1
  36. package/dist/tool-calls/reporters/search.d.ts +7 -3
  37. package/dist/tool-calls/reporters/search.d.ts.map +1 -1
  38. package/dist/tool-calls/reporters/search.js +9 -4
  39. package/dist/v1/acp-agent.d.ts +35 -19
  40. package/dist/v1/acp-agent.d.ts.map +1 -1
  41. package/dist/v1/acp-agent.js +123 -67
  42. package/dist/v1/client-connection.d.ts +4 -2
  43. package/dist/v1/client-connection.d.ts.map +1 -1
  44. package/dist/v1/client-connection.js +6 -2
  45. package/dist/v1/session-fingerprint.d.ts.map +1 -1
  46. package/dist/v1/session-fingerprint.js +1 -2
  47. package/dist/v2/agent.d.ts.map +1 -1
  48. package/dist/v2/agent.js +53 -19
  49. package/dist/v2/auth.d.ts +6 -5
  50. package/dist/v2/auth.d.ts.map +1 -1
  51. package/dist/v2/auth.js +2 -2
  52. package/dist/v2/permissions.d.ts +1 -1
  53. package/dist/v2/permissions.js +1 -1
  54. package/dist/v2/replay-hold.d.ts +15 -5
  55. package/dist/v2/replay-hold.d.ts.map +1 -1
  56. package/dist/v2/replay-hold.js +21 -7
  57. package/dist/v2/reports.d.ts +4 -0
  58. package/dist/v2/reports.d.ts.map +1 -1
  59. package/dist/v2/reports.js +10 -1
  60. package/dist/v2/session-requests.js +3 -1
  61. package/dist/v2/session-update.js +3 -3
  62. package/dist/v2/session.d.ts.map +1 -1
  63. package/dist/v2/session.js +2 -0
  64. package/dist/v2/subagent-replay.d.ts +20 -18
  65. package/dist/v2/subagent-replay.d.ts.map +1 -1
  66. package/dist/v2/subagent-replay.js +16 -31
  67. package/dist/v2/tasks.d.ts +55 -6
  68. package/dist/v2/tasks.d.ts.map +1 -1
  69. package/dist/v2/tasks.js +147 -19
  70. package/dist/v2/tool-call.d.ts.map +1 -1
  71. package/dist/v2/tool-call.js +23 -1
  72. package/package.json +4 -4
@@ -46,6 +46,14 @@ export type NativeSubagent = {
46
46
  endedRuns?: Set<string>;
47
47
  /** The RFD form: the calls that delegated to the child, whose runs handed back a report. */
48
48
  handedBack?: Set<string>;
49
+ /** Whether a message of it came (see `NativeSubagentRuntime.messageCame`). */
50
+ heard?: boolean;
51
+ /**
52
+ * The RFD form: the call that launched it is no Agent or Task call, such as
53
+ * the Skill call of a forked skill. The client is shown that call, so the
54
+ * prompt does not replace it.
55
+ */
56
+ launchShown?: boolean;
49
57
  announced?: boolean;
50
58
  /**
51
59
  * The RFD form: the `cwd` that the client holds for the child. Undefined or
@@ -106,6 +114,8 @@ export type TaskEnd = {
106
114
  * conversation was reset, and the runtime forgets its children.
107
115
  */
108
116
  unobservable?: boolean;
117
+ /** Whether the task ran in the foreground of its parent's work when it ended. */
118
+ foreground?: boolean;
109
119
  };
110
120
  type TaskStarted = {
111
121
  taskId: string;
@@ -113,7 +123,43 @@ type TaskStarted = {
113
123
  subagentType?: unknown;
114
124
  description?: unknown;
115
125
  prompt?: unknown;
126
+ /** The name of the tool of the call `toolUseId`, when the session has that call. */
127
+ launchTool?: string;
128
+ /** The task of the subagent that started this one. None means the root session. */
129
+ parentTaskId?: string;
116
130
  };
131
+ /**
132
+ * Whether the end of a subagent's run waits for its messages. Claude Code
133
+ * (2.1.328) holds the messages of a forked skill that the user typed, such as
134
+ * `/code-review`, and writes them after its next `init` or before its next
135
+ * result: most or all of them come after the task's end. Nothing but that
136
+ * order tells such a subagent apart: no tool call launched it, and it ran in
137
+ * the foreground.
138
+ */
139
+ export declare function endWaitsForMessages(run: {
140
+ launched: boolean;
141
+ foreground: boolean;
142
+ }): boolean;
143
+ /**
144
+ * Whether `message` ends the wait of an agent's end (see
145
+ * {@link endWaitsForMessages}):
146
+ *
147
+ * - the turn's result, which Claude Code writes after the agent's messages;
148
+ * - Claude Code's `idle`, for a turn that ends without a result;
149
+ * - once a message of the agent came (`heard`), the first message of the main
150
+ * conversation (`parent_tool_use_id: null`). Another subagent's message
151
+ * ends no wait: Claude Code holds the messages of the subagents that the
152
+ * agent launched along with the agent's own.
153
+ *
154
+ * Without a message, no more come: the turn or the query ended, or the
155
+ * conversation was reset.
156
+ */
157
+ export declare function endsMessageWait(message: {
158
+ type: string;
159
+ subtype?: unknown;
160
+ state?: unknown;
161
+ parent_tool_use_id?: unknown;
162
+ } | undefined, heard: boolean): boolean;
117
163
  export type SubagentIdentity = {
118
164
  name?: string;
119
165
  description?: string;
@@ -178,6 +224,8 @@ export declare class NativeSubagentRuntime {
178
224
  */
179
225
  private readonly childByToolCall;
180
226
  private readonly taskFinishPromises;
227
+ /** The ends that wait for their tasks' messages (see {@link finishTask}), by task id. */
228
+ private readonly heldEnds;
181
229
  /** The session that made each SendMessage call. */
182
230
  private readonly senderByToolUse;
183
231
  /**
@@ -244,6 +292,22 @@ export declare class NativeSubagentRuntime {
244
292
  reportModel(parentToolUseId: string | null, model: string | undefined, deliver: Publish): Promise<void>;
245
293
  /** The configuration that the client last got for the announced child `sessionId`, if any. */
246
294
  configurationOf(sessionId: string): SessionConfigOption[] | undefined;
295
+ /**
296
+ * The RFD form: what is current of the children that work now, for the
297
+ * time after a `session/load` or `session/resume` of the session that runs
298
+ * them. The client discarded the state and the capabilities it held for
299
+ * them, and need not keep their place in the session tree, so each one is
300
+ * announced again on its parent: with its labels, its `cwd`, the `cancel`
301
+ * capability and its state, then the configuration that the client last
302
+ * got for it. `covered` names the children that the load's replay reports
303
+ * instead (see `RfdSubagentReplay.currentStates`).
304
+ *
305
+ * An announced child that no longer works but has one that does, such as a
306
+ * background child of its own, is announced first, with its labels and
307
+ * `cwd` only: nothing of it is current, but its child's updates name it.
308
+ * Parents come before their children.
309
+ */
310
+ currentChildren(covered: (sessionId: string) => boolean): AcpSessionNotification[];
247
311
  /**
248
312
  * Takes configuration options of the child `agentId`: an SDK agent id, as a
249
313
  * hook names it, or a child session id. Hook observations can precede the
@@ -276,6 +340,39 @@ export declare class NativeSubagentRuntime {
276
340
  /** The RFD form: sends the `cwd` of the announced `child` that the client does not hold. */
277
341
  private publishCwd;
278
342
  private routeUpdate;
343
+ /**
344
+ * Takes a message of the query, before its updates are routed.
345
+ *
346
+ * A subagent's message names it by `agent_id`. A child that no tool call
347
+ * launched has no id that its updates could go by: a forked skill that the
348
+ * user typed sends `forked-command-<skill>` as `parent_tool_use_id`, for
349
+ * every run of the skill. From this message on, the updates under that id
350
+ * are the child's, and no longer those of an earlier run's child.
351
+ *
352
+ * It also ends the runs whose ends waited for their messages (see
353
+ * {@link finishTask} and {@link endsMessageWait}). Only then does it return
354
+ * a promise, for the caller to await: a caller that awaited every message
355
+ * would let a cancel run between a message and its handling.
356
+ */
357
+ messageCame(message: {
358
+ type: string;
359
+ subtype?: unknown;
360
+ state?: unknown;
361
+ parent_tool_use_id?: unknown;
362
+ agent_id?: unknown;
363
+ }, deliver: Publish): Promise<void> | undefined;
364
+ /**
365
+ * Ends the runs whose wait `message` ends; without a message, all of them.
366
+ * Undefined when it ends none.
367
+ */
368
+ private releaseHeldEnds;
369
+ /**
370
+ * The session of the call that launched `task`, when the session has that
371
+ * call and it is no Agent, Task or SendMessage call, such as the Skill call
372
+ * of a forked skill: the session of the subagent that made it, once that
373
+ * one is announced, or the root session.
374
+ */
375
+ private shownLaunchParent;
279
376
  taskStarted(task: TaskStarted, deliver: Publish): Promise<void>;
280
377
  /**
281
378
  * Opens a new generation of a finished child when the SDK resumes the same
@@ -313,6 +410,8 @@ export declare class NativeSubagentRuntime {
313
410
  /**
314
411
  * Reports that the SDK ended the task's work. `end` has what the SDK says
315
412
  * about it: its text for a failure, and its reason for an unusual end.
413
+ * The end of a child whose messages Claude Code holds until after it (see
414
+ * {@link endWaitsForMessages}) is reported once they came.
316
415
  */
317
416
  finishTask(taskId: string, status: unknown, deliver: Publish, toolUseId?: string | null, end?: TaskEnd): Promise<void>;
318
417
  /**
@@ -359,12 +458,6 @@ export declare class NativeSubagentRuntime {
359
458
  * of this runtime. AIR's draft grants no `cancel`.
360
459
  */
361
460
  cancelChild(sessionId: string, stop: (taskId: string) => Promise<void>): Promise<boolean>;
362
- /**
363
- * The RFD form: whether `sessionId` is a child session that this runtime
364
- * announced. The client can cancel such a session and nothing else (see
365
- * `restrictedChild`). False in AIR's draft, which keeps its own rules.
366
- */
367
- hasChild(sessionId: string): boolean;
368
461
  /** The RFD form: the announced child session `sessionId`, with its task id. */
369
462
  private announcedChild;
370
463
  /**
@@ -517,7 +610,9 @@ export declare class NativeSubagentRuntime {
517
610
  * - a SendMessage call that resumed the child, and stays shown because a
518
611
  * permission request showed it;
519
612
  * - an Agent/Task call that launched the child, and stays shown for the
520
- * same reason.
613
+ * same reason;
614
+ * - the call that launched a child and is no Agent/Task call, such as the
615
+ * Skill call of a forked skill, which always stays shown.
521
616
  *
522
617
  * The RFD requires the announcement before the reference, so a call whose
523
618
  * child is not announced yet gets none.
@@ -1 +1 @@
1
- {"version":3,"file":"native-subagents.d.ts","sourceRoot":"","sources":["../src/native-subagents.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACzB,MAAM,mCAAmC,CAAC;AAG3C,OAAO,KAAK,EAAE,sBAAsB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAM9F,kFAAkF;AAClF,MAAM,MAAM,SAAS,GAAG,WAAW,CACjC,OAAO,CAAC,mBAAmB,CAAC,QAAQ,CAAC,EAAE;IAAE,aAAa,EAAE,iBAAiB,CAAA;CAAE,CAAC,CAAC,OAAO,CAAC,CACtF,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2DAA2D;IAC3D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,C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ptions } from "./session-config-options.js";
6
6
  import { MODEL_CONFIG_ID } from "./session-model.js";
7
7
  import { isFinalToolCallStatus } from "./tool-calls/renderer.js";
8
+ /**
9
+ * Whether the end of a subagent's run waits for its messages. Claude Code
10
+ * (2.1.328) holds the messages of a forked skill that the user typed, such as
11
+ * `/code-review`, and writes them after its next `init` or before its next
12
+ * result: most or all of them come after the task's end. Nothing but that
13
+ * order tells such a subagent apart: no tool call launched it, and it ran in
14
+ * the foreground.
15
+ */
16
+ export function endWaitsForMessages(run) {
17
+ return !run.launched && run.foreground;
18
+ }
19
+ /**
20
+ * Whether `message` ends the wait of an agent's end (see
21
+ * {@link endWaitsForMessages}):
22
+ *
23
+ * - the turn's result, which Claude Code writes after the agent's messages;
24
+ * - Claude Code's `idle`, for a turn that ends without a result;
25
+ * - once a message of the agent came (`heard`), the first message of the main
26
+ * conversation (`parent_tool_use_id: null`). Another subagent's message
27
+ * ends no wait: Claude Code holds the messages of the subagents that the
28
+ * agent launched along with the agent's own.
29
+ *
30
+ * Without a message, no more come: the turn or the query ended, or the
31
+ * conversation was reset.
32
+ */
33
+ export function endsMessageWait(message, heard) {
34
+ if (message === undefined || message.type === "result")
35
+ return true;
36
+ if (message.type === "system") {
37
+ return message.subtype === "session_state_changed" && message.state === "idle";
38
+ }
39
+ const conversation = message.type === "assistant" || message.type === "user" || message.type === "stream_event";
40
+ return conversation && heard && message.parent_tool_use_id === null;
41
+ }
8
42
  const MAX_PENDING_PARENTS = 64;
9
43
  const MAX_PENDING_UPDATES = 256;
10
44
  const MAX_PENDING_UPDATES_PER_PARENT = 32;
@@ -44,6 +78,8 @@ export class NativeSubagentRuntime {
44
78
  */
45
79
  childByToolCall = new Map();
46
80
  taskFinishPromises = new Map();
81
+ /** The ends that wait for their tasks' messages (see {@link finishTask}), by task id. */
82
+ heldEnds = new Map();
47
83
  /** The session that made each SendMessage call. */
48
84
  senderByToolUse = new Map();
49
85
  /**
@@ -168,6 +204,63 @@ export class NativeSubagentRuntime {
168
204
  return undefined;
169
205
  return JSON.parse(published);
170
206
  }
207
+ /**
208
+ * The RFD form: what is current of the children that work now, for the
209
+ * time after a `session/load` or `session/resume` of the session that runs
210
+ * them. The client discarded the state and the capabilities it held for
211
+ * them, and need not keep their place in the session tree, so each one is
212
+ * announced again on its parent: with its labels, its `cwd`, the `cancel`
213
+ * capability and its state, then the configuration that the client last
214
+ * got for it. `covered` names the children that the load's replay reports
215
+ * instead (see `RfdSubagentReplay.currentStates`).
216
+ *
217
+ * An announced child that no longer works but has one that does, such as a
218
+ * background child of its own, is announced first, with its labels and
219
+ * `cwd` only: nothing of it is current, but its child's updates name it.
220
+ * Parents come before their children.
221
+ */
222
+ currentChildren(covered) {
223
+ if (this.form !== "rfd")
224
+ return [];
225
+ const bySession = new Map();
226
+ for (const child of this.children.values()) {
227
+ if (child.announced && !covered(child.sessionId))
228
+ bySession.set(child.sessionId, child);
229
+ }
230
+ const ordered = [];
231
+ const add = (child) => {
232
+ if (ordered.includes(child))
233
+ return;
234
+ const parent = bySession.get(child.parentSessionId);
235
+ if (parent)
236
+ add(parent);
237
+ ordered.push(child);
238
+ };
239
+ for (const child of bySession.values())
240
+ if (isWorking(child))
241
+ add(child);
242
+ return ordered.flatMap((child) => {
243
+ const announcement = rfdAnnouncement(child, child.reportedCwd);
244
+ if (!isWorking(child))
245
+ return [{ sessionId: child.parentSessionId, update: announcement }];
246
+ const configOptions = this.configurationOf(child.sessionId);
247
+ const state = child.workState === "requires_action" ? { state: "requires_action" } : { state: "running" };
248
+ return [
249
+ {
250
+ sessionId: child.parentSessionId,
251
+ update: { ...announcement, capabilities: { cancel: {} }, state },
252
+ },
253
+ ...(configOptions
254
+ ? [
255
+ {
256
+ sessionId: child.sessionId,
257
+ update: { sessionUpdate: "config_option_update", configOptions },
258
+ },
259
+ ]
260
+ : []),
261
+ ];
262
+ });
263
+ }
171
264
  /**
172
265
  * Takes configuration options of the child `agentId`: an SDK agent id, as a
173
266
  * hook names it, or a child session id. Hook observations can precede the
@@ -419,6 +512,70 @@ export class NativeSubagentRuntime {
419
512
  }
420
513
  return notification;
421
514
  }
515
+ /**
516
+ * Takes a message of the query, before its updates are routed.
517
+ *
518
+ * A subagent's message names it by `agent_id`. A child that no tool call
519
+ * launched has no id that its updates could go by: a forked skill that the
520
+ * user typed sends `forked-command-<skill>` as `parent_tool_use_id`, for
521
+ * every run of the skill. From this message on, the updates under that id
522
+ * are the child's, and no longer those of an earlier run's child.
523
+ *
524
+ * It also ends the runs whose ends waited for their messages (see
525
+ * {@link finishTask} and {@link endsMessageWait}). Only then does it return
526
+ * a promise, for the caller to await: a caller that awaited every message
527
+ * would let a cancel run between a message and its handling.
528
+ */
529
+ messageCame(message, deliver) {
530
+ if (!this.enabled)
531
+ return undefined;
532
+ const { parent_tool_use_id: launchId, agent_id: agentId } = message;
533
+ const child = typeof agentId === "string" ? this.children.get(agentId) : undefined;
534
+ if (child && typeof agentId === "string" && typeof launchId === "string") {
535
+ child.heard = true;
536
+ if (child.parentToolUseId === undefined &&
537
+ this.childByParentToolUse.get(launchId) !== child) {
538
+ this.taskByToolUse.set(launchId, agentId);
539
+ this.childByParentToolUse.set(launchId, child);
540
+ }
541
+ }
542
+ return this.releaseHeldEnds(deliver, message);
543
+ }
544
+ /**
545
+ * Ends the runs whose wait `message` ends; without a message, all of them.
546
+ * Undefined when it ends none.
547
+ */
548
+ releaseHeldEnds(deliver, message) {
549
+ if (this.heldEnds.size === 0)
550
+ return undefined;
551
+ const ended = [...this.heldEnds].filter(([taskId]) => endsMessageWait(message, this.children.get(taskId)?.heard === true));
552
+ if (ended.length === 0)
553
+ return undefined;
554
+ return (async () => {
555
+ for (const [taskId, held] of ended) {
556
+ this.heldEnds.delete(taskId);
557
+ await this.finishTask(taskId, held.status, deliver, undefined, held.end);
558
+ }
559
+ })();
560
+ }
561
+ /**
562
+ * The session of the call that launched `task`, when the session has that
563
+ * call and it is no Agent, Task or SendMessage call, such as the Skill call
564
+ * of a forked skill: the session of the subagent that made it, once that
565
+ * one is announced, or the root session.
566
+ */
567
+ shownLaunchParent(task) {
568
+ if (!task.toolUseId ||
569
+ task.launchTool === undefined ||
570
+ task.launchTool === "SendMessage" ||
571
+ isNativeSubagentControlTool(task.launchTool)) {
572
+ return undefined;
573
+ }
574
+ if (task.parentTaskId === undefined)
575
+ return this.rootSessionId;
576
+ const parent = this.children.get(task.parentTaskId);
577
+ return parent?.announced ? parent.sessionId : undefined;
578
+ }
422
579
  async taskStarted(task, deliver) {
423
580
  if (!this.enabled)
424
581
  return;
@@ -460,8 +617,10 @@ export class NativeSubagentRuntime {
460
617
  return;
461
618
  // A SendMessage resume reuses the finished generation's tool id, whose
462
619
  // control state is already cleaned up.
620
+ const shownLaunchParent = this.shownLaunchParent(task);
463
621
  const knownParentSessionId = (task.toolUseId ? this.parentByToolUse.get(task.toolUseId) : undefined) ??
464
- (previous && this.resumedParentSessionId(previous));
622
+ (previous && this.resumedParentSessionId(previous)) ??
623
+ shownLaunchParent;
465
624
  const identity = task.toolUseId ? this.identityByToolUse.get(task.toolUseId) : undefined;
466
625
  // A nested child must wait for the spawning Agent/Task frame to establish
467
626
  // its immediate parent. Root children without a tool id can be announced.
@@ -472,6 +631,7 @@ export class NativeSubagentRuntime {
472
631
  task: subagentDescription(identity?.prompt ?? task.prompt, identity?.description ?? task.description),
473
632
  ...promptField(promptText(task.prompt) ?? identity?.prompt),
474
633
  ...rfdLabels(identity?.name, identity?.subagentType ?? task.subagentType, identity?.description ?? task.description),
634
+ ...(shownLaunchParent !== undefined ? { launchShown: true } : {}),
475
635
  }, !!knownParentSessionId || !task.toolUseId, deliver);
476
636
  }
477
637
  /**
@@ -559,6 +719,8 @@ export class NativeSubagentRuntime {
559
719
  /**
560
720
  * Reports that the SDK ended the task's work. `end` has what the SDK says
561
721
  * about it: its text for a failure, and its reason for an unusual end.
722
+ * The end of a child whose messages Claude Code holds until after it (see
723
+ * {@link endWaitsForMessages}) is reported once they came.
562
724
  */
563
725
  async finishTask(taskId, status, deliver, toolUseId, end) {
564
726
  if (!this.enabled)
@@ -589,6 +751,22 @@ export class NativeSubagentRuntime {
589
751
  await this.supplyError(child, state, end?.error);
590
752
  return;
591
753
  }
754
+ const held = this.heldEnds.get(taskId);
755
+ if (held) {
756
+ // A second report of an end that waits can give the text of its failure.
757
+ if (end?.error && !held.end?.error)
758
+ held.end = { ...held.end, error: end.error };
759
+ return;
760
+ }
761
+ if (child.announced &&
762
+ endWaitsForMessages({
763
+ launched: child.parentToolUseId !== undefined,
764
+ foreground: end?.foreground === true,
765
+ })) {
766
+ // The run ends once its messages came (see `messageCame`).
767
+ this.heldEnds.set(taskId, { status, end: { ...end, foreground: false } });
768
+ return;
769
+ }
592
770
  const finish = Promise.resolve().then(async () => {
593
771
  try {
594
772
  await this.announce(child);
@@ -651,6 +829,13 @@ export class NativeSubagentRuntime {
651
829
  : mayStillRun
652
830
  ? { unobservable: true }
653
831
  : { unexplained: true };
832
+ try {
833
+ // An end that waited for its task's messages is that task's end.
834
+ await this.releaseHeldEnds(deliver);
835
+ }
836
+ catch (error) {
837
+ errors.push(error);
838
+ }
654
839
  try {
655
840
  for (const taskId of [...this.children.keys()].reverse()) {
656
841
  try {
@@ -712,14 +897,6 @@ export class NativeSubagentRuntime {
712
897
  await stop(taskId);
713
898
  return true;
714
899
  }
715
- /**
716
- * The RFD form: whether `sessionId` is a child session that this runtime
717
- * announced. The client can cancel such a session and nothing else (see
718
- * `restrictedChild`). False in AIR's draft, which keeps its own rules.
719
- */
720
- hasChild(sessionId) {
721
- return this.announcedChild(sessionId) !== undefined;
722
- }
723
900
  /** The RFD form: the announced child session `sessionId`, with its task id. */
724
901
  announcedChild(sessionId) {
725
902
  if (this.form !== "rfd")
@@ -1215,7 +1392,9 @@ export class NativeSubagentRuntime {
1215
1392
  * - a SendMessage call that resumed the child, and stays shown because a
1216
1393
  * permission request showed it;
1217
1394
  * - an Agent/Task call that launched the child, and stays shown for the
1218
- * same reason.
1395
+ * same reason;
1396
+ * - the call that launched a child and is no Agent/Task call, such as the
1397
+ * Skill call of a forked skill, which always stays shown.
1219
1398
  *
1220
1399
  * The RFD requires the announcement before the reference, so a call whose
1221
1400
  * child is not announced yet gets none.
@@ -1289,6 +1468,7 @@ export class NativeSubagentRuntime {
1289
1468
  this.cwdBySession.clear();
1290
1469
  this.childByParentToolUse.clear();
1291
1470
  this.taskFinishPromises.clear();
1471
+ this.heldEnds.clear();
1292
1472
  this.senderByToolUse.clear();
1293
1473
  this.hiddenLaunches.clear();
1294
1474
  this.hiddenSendMessages.clear();
@@ -1447,6 +1627,20 @@ export function responseModelEntry(model, models) {
1447
1627
  return undefined;
1448
1628
  return models?.entry(model) ?? { value: model, name: models?.name(model) ?? model };
1449
1629
  }
1630
+ /**
1631
+ * The RFD form: the `subagent_update` that names `child` on its parent, with
1632
+ * the parent's labels for it and `cwd`, its working directory when that is
1633
+ * not its parent's.
1634
+ */
1635
+ function rfdAnnouncement(child, cwd) {
1636
+ return {
1637
+ sessionUpdate: "subagent_update",
1638
+ sessionId: child.sessionId,
1639
+ ...(child.title ? { title: child.title } : {}),
1640
+ ...(child.description ? { description: child.description } : {}),
1641
+ ...(cwd ? { cwd } : {}),
1642
+ };
1643
+ }
1450
1644
  /**
1451
1645
  * Announces the child on its parent, once, before any update of the child.
1452
1646
  * The RFD form announces it as running and then sends the prompt as the
@@ -1466,11 +1660,7 @@ export async function announceNativeSubagent(child, publish, form, cwd) {
1466
1660
  await publish({
1467
1661
  sessionId: child.parentSessionId,
1468
1662
  update: {
1469
- sessionUpdate: "subagent_update",
1470
- sessionId: child.sessionId,
1471
- ...(child.title ? { title: child.title } : {}),
1472
- ...(child.description ? { description: child.description } : {}),
1473
- ...(cwd ? { cwd } : {}),
1663
+ ...rfdAnnouncement(child, cwd),
1474
1664
  capabilities: { cancel: {} },
1475
1665
  state: { state: "running" },
1476
1666
  },
@@ -1478,9 +1668,10 @@ export async function announceNativeSubagent(child, publish, form, cwd) {
1478
1668
  if (cwd)
1479
1669
  child.reportedCwd = cwd;
1480
1670
  child.announced = true;
1481
- // The immediate parent made the Agent/Task call that launched the child.
1671
+ // The immediate parent made the call that launched the child. The
1672
+ // prompt replaces an Agent/Task call, and not a call that stays shown.
1482
1673
  if (child.prompt) {
1483
- await publishPrompt(child, child.prompt, child.parentToolUseId, child.parentSessionId, publish, { replacesCall: true });
1674
+ await publishPrompt(child, child.prompt, child.parentToolUseId, child.parentSessionId, publish, { replacesCall: !child.launchShown });
1484
1675
  }
1485
1676
  return;
1486
1677
  }
package/dist/plans.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
- * The session updates that show the session's plans. A client with the `plan`
3
- * capability (every v2 client, and a v1 client that asks for it) tracks plans
4
- * by ID and gets `plan_update` and `plan_removed`; any other client gets the
5
- * legacy `plan` update, which holds one ID-less plan per session.
2
+ * The session updates that show the session's plans. A v2 client, and a v1
3
+ * client that advertises the `plan` capability, tracks plans by ID and gets
4
+ * `plan_update` and `plan_removed`; any other v1 client gets the legacy `plan`
5
+ * update, which holds one ID-less plan per session.
6
6
  */
7
7
  import type { PlanEntry, PlanItems, PlanRemoved, SessionNotification } from "@agentclientprotocol/sdk/unstable";
8
8
  type PlanRemovalUpdate = PlanRemoved & {
@@ -4,9 +4,12 @@
4
4
  * `providers/disable`, and the legacy gateway logins (`authenticate` or
5
5
  * `auth/login` with `gateway` or `gateway-bedrock`). Each core holds its own
6
6
  * {@link ProviderConfig} and gateway login, and builds the query env of its
7
- * sessions with {@link createEnvForProvider}.
7
+ * sessions with {@link createEnvForProvider}. It holds that route above the
8
+ * user's and the project's settings with {@link providerRouteSettings} and
9
+ * {@link applyProviderRoute}.
8
10
  */
9
11
  import { type AuthenticateRequest, type AuthMethod, type ListProvidersResponse, type LlmProtocol, type SetProviderRequest } from "@agentclientprotocol/sdk/unstable";
12
+ import type { Query } from "@anthropic-ai/claude-agent-sdk";
10
13
  type ProviderLogger = {
11
14
  log: (...args: any[]) => void;
12
15
  error: (...args: any[]) => void;
@@ -93,6 +96,36 @@ export declare function gatewayRequestToProviderConfig(request?: GatewayAuthRequ
93
96
  * skips its normal login/credential checks when a gateway is in use.
94
97
  */
95
98
  export declare function createEnvForProvider(config: ProviderConfig | null): Record<string, string>;
99
+ /** A provider's route as settings of Claude Code (see {@link providerRouteSettings}). */
100
+ export type ProviderRouteSettings = {
101
+ apiKeyHelper: "";
102
+ env: Record<string, string>;
103
+ };
104
+ /**
105
+ * The route of a provider as settings of Claude Code, for the tier of the
106
+ * `settings` option. `env` is the result of {@link createEnvForProvider}.
107
+ *
108
+ * Claude Code applies the `env` of settings files after the process env, so
109
+ * without this tier the user's or the project's settings could restore another
110
+ * `ANTHROPIC_BASE_URL`. The empty `apiKeyHelper` turns off a helper of theirs.
111
+ */
112
+ export declare function providerRouteSettings(env: Record<string, string>): ProviderRouteSettings;
113
+ /**
114
+ * Sends `route` to the running session, into the tier of the `settings`
115
+ * option (`applyFlagSettings`). Call it right after the query's initialize
116
+ * response, before a request of the session reaches the provider:
117
+ * `getContextUsage()` sends one (`count_tokens`).
118
+ *
119
+ * The `settings` option holds the route too, in one object with the client's
120
+ * settings and the model configuration. Claude Code loads that object as a
121
+ * whole or not at all: one value that fails validation, e.g.
122
+ * `permissions.allow: "Bash"`, leaves all of it out. This call does not depend
123
+ * on that object. When the object did load, the call changes nothing: Claude
124
+ * Code merges `env` key by key.
125
+ *
126
+ * Throws when Claude Code refuses the route. The caller must close the query.
127
+ */
128
+ export declare function applyProviderRoute(query: Pick<Query, "applyFlagSettings">, route: ProviderRouteSettings): Promise<void>;
96
129
  /**
97
130
  * A provider base URL as logs may show it: its origin only. The URL can come
98
131
  * from the env or the client and can carry credentials (`https://user:key@host`)
@@ -1 +1 @@
1
- {"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../src/providers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EAEhB,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