@agentclientprotocol/claude-agent-acp 0.95.1-preview.1 → 0.95.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.
@@ -136,6 +136,12 @@ export declare class NativeSubagentRuntime {
136
136
  * closes an unfinished call has no `toolName` to recognize it by.
137
137
  */
138
138
  private readonly hiddenLaunches;
139
+ /**
140
+ * The RFD form: the SendMessage calls that the client is not shown, until
141
+ * their final update, with their first report and the session that made
142
+ * them. A message that reaches an announced child replaces its call.
143
+ */
144
+ private readonly hiddenSendMessages;
139
145
  /**
140
146
  * The RFD form: the SubagentHandback calls of announced children that the
141
147
  * client is not shown yet, with their first report, the report from their
@@ -372,6 +378,15 @@ export declare class NativeSubagentRuntime {
372
378
  * child is shown the call after all. `undefined` for any other update.
373
379
  */
374
380
  private routeRfdHandback;
381
+ /**
382
+ * The RFD form: an update of a SendMessage call, which its message replaces
383
+ * once it reaches an announced child: the sender's outgoing view and the
384
+ * child's incoming one, see {@link linkedSessionMessages}. The SDK reports
385
+ * that delivery before the call's final update. A call whose message reached
386
+ * no announced child, such as one to the parent, is shown after all, with its
387
+ * final status. Any other update is returned as is.
388
+ */
389
+ private routeRfdSendMessage;
375
390
  /** Whether `update` is of an Agent/Task call, by its tool name or, in the
376
391
  * RFD form, by the id of a call the client is not shown. */
377
392
  private isControlUpdate;
@@ -432,8 +447,9 @@ export declare function finishNativeSubagent(session: NativeSubagentSession, tas
432
447
  * The RFD form: a message that a tool call sent, which the client is not
433
448
  * shown, as two session messages: the sender's outgoing view, then the
434
449
  * recipient's incoming one. That call is a launch's Agent/Task call, whose
435
- * prompt goes from the parent to the child, or a child's SubagentHandback
436
- * call, whose report goes from the child to the parent. Both views use the
450
+ * prompt goes from the parent to the child, a SendMessage call, whose message
451
+ * goes from its sender to a child, or a child's SubagentHandback call, whose
452
+ * report goes from the child to the parent. Both views use the
437
453
  * call's tool use id, and each names the other with the draft RFD's
438
454
  * `recipientMessageId` and `senderMessageId`.
439
455
  */
@@ -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;AAC3C,OAAO,KAAK,EAAE,sBAAsB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAI9F,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,+EAA+E;IAC/E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IAC/B;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;gDAC4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8EAA8E;IAC9E,SAAS,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACxB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACxB,4FAA4F;IAC5F,UAAU,CAA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AAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAkBlD;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,aAAa,GAAG,SAAS,CAM9E;AAED,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,sBAAsB,CAAC,QAAQ,CAAC,GACvC,MAAM,IAAI,OAAO,CAClB,sBAAsB,CAAC,QAAQ,CAAC,EAChC;IAAE,aAAa,EAAE,WAAW,GAAG,kBAAkB,CAAA;CAAE,CACpD,CASA;AAED,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAEtE"}
@@ -42,6 +42,12 @@ export class NativeSubagentRuntime {
42
42
  * closes an unfinished call has no `toolName` to recognize it by.
43
43
  */
44
44
  hiddenLaunches = new Map();
45
+ /**
46
+ * The RFD form: the SendMessage calls that the client is not shown, until
47
+ * their final update, with their first report and the session that made
48
+ * them. A message that reaches an announced child replaces its call.
49
+ */
50
+ hiddenSendMessages = new Map();
45
51
  /**
46
52
  * The RFD form: the SubagentHandback calls of announced children that the
47
53
  * client is not shown yet, with their first report, the report from their
@@ -90,9 +96,10 @@ export class NativeSubagentRuntime {
90
96
  }
91
97
  async route(notification, deliver, forcedSessionId) {
92
98
  const routed = await this.routeUpdate(notification, deliver, forcedSessionId);
93
- if (routed)
94
- this.rememberSendMessage(routed);
95
- return routed;
99
+ if (!routed)
100
+ return routed;
101
+ this.rememberSendMessage(routed);
102
+ return this.form === "rfd" ? this.routeRfdSendMessage(routed, forcedSessionId) : routed;
96
103
  }
97
104
  /**
98
105
  * The RFD form: the work state that the client holds for the announced child
@@ -781,7 +788,10 @@ export class NativeSubagentRuntime {
781
788
  });
782
789
  }
783
790
  if (prompt && toolUseId) {
784
- await publishPrompt(child, prompt, toolUseId, this.senderByToolUse.get(toolUseId), this.publish);
791
+ const sendMessage = this.hiddenSendMessages.get(toolUseId);
792
+ await publishPrompt(child, prompt, toolUseId, sendMessage?.sender ?? this.senderByToolUse.get(toolUseId), this.publish, { replacesCall: sendMessage !== undefined });
793
+ if (sendMessage)
794
+ sendMessage.delivered = true;
785
795
  }
786
796
  for (const pending of toolUseId ? this.takePending(toolUseId) : [])
787
797
  await deliver(pending);
@@ -963,6 +973,42 @@ export class NativeSubagentRuntime {
963
973
  }
964
974
  return unexposedControlFallback(handback.initial, notification, child.sessionId);
965
975
  }
976
+ /**
977
+ * The RFD form: an update of a SendMessage call, which its message replaces
978
+ * once it reaches an announced child: the sender's outgoing view and the
979
+ * child's incoming one, see {@link linkedSessionMessages}. The SDK reports
980
+ * that delivery before the call's final update. A call whose message reached
981
+ * no announced child, such as one to the parent, is shown after all, with its
982
+ * final status. Any other update is returned as is.
983
+ */
984
+ routeRfdSendMessage(notification, forcedSessionId) {
985
+ const { update } = notification;
986
+ if (update.sessionUpdate !== "tool_call" && update.sessionUpdate !== "tool_call_update") {
987
+ return notification;
988
+ }
989
+ const toolCallId = update.toolCallId;
990
+ // A permission request already showed the call to the client, so it keeps
991
+ // getting its updates, and its message goes only to the child.
992
+ if (forcedSessionId) {
993
+ this.hiddenSendMessages.delete(toolCallId);
994
+ return notification;
995
+ }
996
+ let sendMessage = this.hiddenSendMessages.get(toolCallId);
997
+ if (!sendMessage) {
998
+ const claudeMeta = update._meta?.claudeCode;
999
+ if (update.sessionUpdate !== "tool_call" || claudeMeta?.toolName !== "SendMessage") {
1000
+ return notification;
1001
+ }
1002
+ sendMessage = { initial: notification, sender: notification.sessionId, delivered: false };
1003
+ this.hiddenSendMessages.set(toolCallId, sendMessage);
1004
+ }
1005
+ if (!isFinalToolCallStatus(update.status))
1006
+ return null;
1007
+ this.hiddenSendMessages.delete(toolCallId);
1008
+ if (sendMessage.delivered)
1009
+ return null;
1010
+ return unexposedControlFallback(sendMessage.initial, notification, sendMessage.sender);
1011
+ }
966
1012
  /** Whether `update` is of an Agent/Task call, by its tool name or, in the
967
1013
  * RFD form, by the id of a call the client is not shown. */
968
1014
  isControlUpdate(update) {
@@ -1019,6 +1065,7 @@ export class NativeSubagentRuntime {
1019
1065
  this.taskFinishPromises.clear();
1020
1066
  this.senderByToolUse.clear();
1021
1067
  this.hiddenLaunches.clear();
1068
+ this.hiddenSendMessages.clear();
1022
1069
  this.handbacks.clear();
1023
1070
  this.generationByTaskId.clear();
1024
1071
  this.pending.clear();
@@ -1161,7 +1208,7 @@ export async function announceNativeSubagent(child, publish, form) {
1161
1208
  child.announced = true;
1162
1209
  // The immediate parent made the Agent/Task call that launched the child.
1163
1210
  if (child.prompt) {
1164
- await publishPrompt(child, child.prompt, child.parentToolUseId, child.parentSessionId, publish, { replacesLaunch: true });
1211
+ await publishPrompt(child, child.prompt, child.parentToolUseId, child.parentSessionId, publish, { replacesCall: true });
1165
1212
  }
1166
1213
  return;
1167
1214
  }
@@ -1221,17 +1268,17 @@ export async function finishNativeSubagent(session, taskId, state, publish) {
1221
1268
  * transcript is the same delegation and is not sent again. `sender` is the
1222
1269
  * session that made that call, when known.
1223
1270
  *
1224
- * A launch's prompt (`replacesLaunch`) also goes to the parent, see
1225
- * {@link linkedSessionMessages}. A SendMessage call stays a tool call of the
1226
- * sender, so its message has only the incoming view.
1271
+ * When the message replaces its call (`replacesCall`), a launch's or a
1272
+ * SendMessage call the client is not shown, it also goes to the sender, see
1273
+ * {@link linkedSessionMessages}. Otherwise it has only the incoming view.
1227
1274
  */
1228
- async function publishPrompt(child, prompt, toolUseId, sender, publish, { replacesLaunch = false } = {}) {
1275
+ async function publishPrompt(child, prompt, toolUseId, sender, publish, { replacesCall = false } = {}) {
1229
1276
  child.promptIds ??= new Set();
1230
1277
  const messageId = toolUseId ?? `${child.sessionId}:prompt:${child.promptIds.size + 1}`;
1231
1278
  if (child.promptIds.has(messageId))
1232
1279
  return;
1233
1280
  child.promptIds.add(messageId);
1234
- if (replacesLaunch && sender !== undefined && toolUseId !== undefined) {
1281
+ if (replacesCall && sender !== undefined && toolUseId !== undefined) {
1235
1282
  for (const view of linkedSessionMessages(toolUseId, sender, child.sessionId, prompt)) {
1236
1283
  await publish(view);
1237
1284
  }
@@ -1252,8 +1299,9 @@ async function publishPrompt(child, prompt, toolUseId, sender, publish, { replac
1252
1299
  * The RFD form: a message that a tool call sent, which the client is not
1253
1300
  * shown, as two session messages: the sender's outgoing view, then the
1254
1301
  * recipient's incoming one. That call is a launch's Agent/Task call, whose
1255
- * prompt goes from the parent to the child, or a child's SubagentHandback
1256
- * call, whose report goes from the child to the parent. Both views use the
1302
+ * prompt goes from the parent to the child, a SendMessage call, whose message
1303
+ * goes from its sender to a child, or a child's SubagentHandback call, whose
1304
+ * report goes from the child to the parent. Both views use the
1257
1305
  * call's tool use id, and each names the other with the draft RFD's
1258
1306
  * `recipientMessageId` and `senderMessageId`.
1259
1307
  */
@@ -1472,7 +1520,8 @@ function isFailedToolCallUpdate(update) {
1472
1520
  * A tool call that the client was not shown, as one `tool_call` with its
1473
1521
  * final status, shown after all: an Agent/Task call whose child was never
1474
1522
  * exposed (AIR's draft shows only a failed one, the RFD form also a completed
1475
- * one), or a failed SubagentHandback call.
1523
+ * one), a SendMessage call whose message reached no announced child, or a
1524
+ * failed SubagentHandback call.
1476
1525
  */
1477
1526
  function unexposedControlFallback(initial, terminal, sessionId) {
1478
1527
  if (terminal.update.sessionUpdate !== "tool_call" &&
@@ -16,6 +16,12 @@
16
16
  * Unlike live, the replay does not tell runs apart, so a child that handed
17
17
  * back any report gets no reply from its launch's result.
18
18
  *
19
+ * A SendMessage call whose message the replay delivered to a child before it
20
+ * reached the call is that message too: the sender's outgoing view, at the
21
+ * call, and the child's incoming one, in the child's history. A child's
22
+ * history follows its launch, so a call to a child from its parent is always
23
+ * delivered first. Any other SendMessage call stays a tool call.
24
+ *
19
25
  * A launch without metadata has no known id, so it is not announced: the RFD
20
26
  * forbids inventing one. Its Agent call stays an ordinary tool call of the
21
27
  * parent, and a notice says that subagent history is missing.
@@ -89,10 +95,11 @@ export declare class RfdSubagentReplay {
89
95
  /**
90
96
  * Takes a replayed update of a tool call, from the transcript of `owner`
91
97
  * when it is a child's. Returns whether the client is not shown it: an
92
- * update of the launch of a child that the replay shows, or of a successful
98
+ * update of the launch of a child that the replay shows, of a SendMessage
99
+ * call whose message the replay already delivered, or of a successful
93
100
  * SubagentHandback call of `owner`. A foreground launch's completed result
94
- * goes out as the child's reply, and a hand-back as the child's message to
95
- * its parent.
101
+ * goes out as the child's reply, a delivered SendMessage as the sender's
102
+ * outgoing message, and a hand-back as the child's message to its parent.
96
103
  */
97
104
  toolCallUpdate(update: AcpSessionNotification["update"], owner: ReplayChild | undefined): Promise<boolean>;
98
105
  /**
@@ -127,6 +134,9 @@ export declare class RfdSubagentReplay {
127
134
  * first undelivered SendMessage to the child whose message the delivered
128
135
  * text contains. With that call, the message has the call's id and text and
129
136
  * its sender, as live; without it, its transcript id and the delivered text.
137
+ * Unless the replay already showed the call as a tool call, the message
138
+ * replaces it, so this view names the sender's view, which goes out at the
139
+ * call (see {@link toolCallUpdate}).
130
140
  */
131
141
  private sendDelivery;
132
142
  private sendMessage;
@@ -1 +1 @@
1
- {"version":3,"file":"subagent-replay.d.ts","sourceRoot":"","sources":["../src/subagent-replay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EASL,KAAK,SAAS,EACf,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE7E,KAAK,OAAO,GAAG,CAAC,YAAY,EAAE,sBAAsB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAEvE,8DAA8D;AAC9D,MAAM,MAAM,WAAW,GAAG;IACxB,mDAAmD;IACnD,QAAQ,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,SAAS,EAAE,MAAM,CAAC;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,GAAG,SAAS;IAIzD,mFAAmF;IAC7E,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBjD;;;;;;;;;;OAUG;IACG,YAAY,CAChB,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,OAAO,CAAC;IAanB;;;;OAIG;IACG,aAAa,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,cAAc,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAO3F;;;;;;;;OAQG;IACG,cAAc,CAClB,MAAM,EAAE,sBAAsB,CAAC,QAAQ,CAAC,EACxC,KAAK,EAAE,WAAW,GAAG,SAAS,GAC7B,OAAO,CAAC,OAAO,CAAC;IAoDnB;;;OAGG;IACH,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO;IAOzD;;;OAGG;IACG,MAAM,CAAC,eAAe,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA4B5E;;;;;;;;;;OAUG;IACH,aAAa,CACX,IAAI,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,SAAS,CAAC,OAAO,CAAC,GAAG,SAAS,GAC1D,sBAAsB,EAAE;IAmB3B,OAAO,CAAC,cAAc;IAwBtB,4FAA4F;YAC9E,UAAU;IAYxB;;;;;;;;;;OAUG;YACW,YAAY;YAsBZ,WAAW;CAmB1B;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,WAAW,GAAG,QAAQ,GAAG,WAAW,CAMtC"}
@@ -41,7 +41,8 @@ export class RfdSubagentReplay {
41
41
  to: input.to,
42
42
  message: input.message,
43
43
  senderSessionId: ownerSessionId,
44
- delivered: false,
44
+ shownAsToolCall: false,
45
+ outgoingSent: false,
45
46
  });
46
47
  }
47
48
  }
@@ -119,15 +120,30 @@ export class RfdSubagentReplay {
119
120
  /**
120
121
  * Takes a replayed update of a tool call, from the transcript of `owner`
121
122
  * when it is a child's. Returns whether the client is not shown it: an
122
- * update of the launch of a child that the replay shows, or of a successful
123
+ * update of the launch of a child that the replay shows, of a SendMessage
124
+ * call whose message the replay already delivered, or of a successful
123
125
  * SubagentHandback call of `owner`. A foreground launch's completed result
124
- * goes out as the child's reply, and a hand-back as the child's message to
125
- * its parent.
126
+ * goes out as the child's reply, a delivered SendMessage as the sender's
127
+ * outgoing message, and a hand-back as the child's message to its parent.
126
128
  */
127
129
  async toolCallUpdate(update, owner) {
128
130
  if (update.sessionUpdate !== "tool_call" && update.sessionUpdate !== "tool_call_update") {
129
131
  return false;
130
132
  }
133
+ const sendMessage = this.sendMessages.find((call) => call.toolUseId === update.toolCallId);
134
+ if (sendMessage) {
135
+ if (sendMessage.recipientSessionId === undefined) {
136
+ sendMessage.shownAsToolCall = true;
137
+ return false;
138
+ }
139
+ if (!sendMessage.outgoingSent) {
140
+ sendMessage.outgoingSent = true;
141
+ const [outgoing] = linkedSessionMessages(sendMessage.toolUseId, sendMessage.senderSessionId, sendMessage.recipientSessionId, sendMessage.message);
142
+ if (outgoing)
143
+ await this.publish(outgoing);
144
+ }
145
+ return true;
146
+ }
131
147
  const handback = owner ? this.handbacks.get(update.toolCallId) : undefined;
132
148
  if (owner && handback && !handback.failed) {
133
149
  if (!handback.sent) {
@@ -256,21 +272,26 @@ export class RfdSubagentReplay {
256
272
  * first undelivered SendMessage to the child whose message the delivered
257
273
  * text contains. With that call, the message has the call's id and text and
258
274
  * its sender, as live; without it, its transcript id and the delivered text.
275
+ * Unless the replay already showed the call as a tool call, the message
276
+ * replaces it, so this view names the sender's view, which goes out at the
277
+ * call (see {@link toolCallUpdate}).
259
278
  */
260
279
  async sendDelivery(child, message, text) {
261
280
  const names = [child.sessionId, child.record.name, child.input.name];
262
- const call = this.sendMessages.find((candidate) => !candidate.delivered &&
281
+ const call = this.sendMessages.find((candidate) => candidate.recipientSessionId === undefined &&
263
282
  names.includes(candidate.to) &&
264
283
  text.includes(candidate.message.trim()));
265
284
  if (call) {
266
- call.delivered = true;
267
- await this.sendMessage(child, call.toolUseId, call.message, call.senderSessionId);
285
+ call.recipientSessionId = child.sessionId;
286
+ await this.sendMessage(child, call.toolUseId, call.message, call.senderSessionId, {
287
+ linked: !call.shownAsToolCall,
288
+ });
268
289
  }
269
290
  else {
270
291
  await this.sendMessage(child, message.uuid, text, undefined);
271
292
  }
272
293
  }
273
- async sendMessage(child, messageId, text, sender) {
294
+ async sendMessage(child, messageId, text, sender, { linked = false } = {}) {
274
295
  await this.publish({
275
296
  sessionId: child.sessionId,
276
297
  update: {
@@ -278,6 +299,7 @@ export class RfdSubagentReplay {
278
299
  messageId,
279
300
  ...(sender ? { senderSessionId: sender } : {}),
280
301
  recipientSessionId: child.sessionId,
302
+ ...(linked ? { senderMessageId: messageId } : {}),
281
303
  content: [{ type: "text", text }],
282
304
  },
283
305
  });
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.95.1-preview.1",
6
+ "version": "0.95.1-preview.2",
7
7
  "description": "An ACP-compatible coding agent powered by the Claude Agent SDK (TypeScript)",
8
8
  "main": "dist/lib.js",
9
9
  "types": "dist/lib.d.ts",