@bivy/bivy 0.16.24-staging.3 → 0.16.24-staging.4

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.
@@ -1151,13 +1151,18 @@ class ClaudeSession {
1151
1151
  const model = message.message?.model;
1152
1152
  if (model)
1153
1153
  this.currentModel = toModelInfo({ id: model });
1154
+ // The SDK stamps every message it generates inside a `Task` sub-agent
1155
+ // with the spawning Task's tool_use id. Carry it onto this turn's tool
1156
+ // calls so the UI nests the sub-agent's work under its delegation card
1157
+ // instead of rendering it flat alongside the parent's own tools.
1158
+ const parentToolUseId = typeof message.parent_tool_use_id === "string" && message.parent_tool_use_id ? message.parent_tool_use_id : undefined;
1154
1159
  const content = Array.isArray(message.message?.content) ? message.message.content : [];
1155
1160
  for (const block of content) {
1156
1161
  if (block?.type === "tool_use") {
1157
1162
  const detail = mapToolCall(String(block.name ?? "tool"), block.input, { provider: "claude", protocol: "sdk" });
1158
1163
  if (detail && typeof block.id === "string")
1159
1164
  this.toolDetailsByUseId.set(block.id, detail);
1160
- this.emit({ type: "tool_call", toolName: block.name, input: block.input, toolUseId: block.id, ...(detail ? { detail } : {}) });
1165
+ this.emit({ type: "tool_call", toolName: block.name, input: block.input, toolUseId: block.id, ...(detail ? { detail } : {}), ...(parentToolUseId ? { parentToolUseId } : {}) });
1161
1166
  if (typeof block.id === "string" && typeof block.name === "string")
1162
1167
  this.toolNamesByUseId.set(block.id, block.name);
1163
1168
  }
@@ -1169,7 +1174,7 @@ class ClaudeSession {
1169
1174
  // tool_use blocks with the tool_result messages below; otherwise the plain
1170
1175
  // text is enough. The live stream still surfaces text via message_end.
1171
1176
  if (content.length || text) {
1172
- this.messages.push({ role: "assistant", content: content.length ? content : text, timestamp: Date.now() });
1177
+ this.messages.push({ role: "assistant", content: content.length ? content : text, timestamp: Date.now(), ...(parentToolUseId ? { parentToolUseId } : {}) });
1173
1178
  }
1174
1179
  if (text) {
1175
1180
  this.beginMessage();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bivy/bivy",
3
- "version": "0.16.24-staging.3",
3
+ "version": "0.16.24-staging.4",
4
4
  "type": "module",
5
5
  "license": "AGPL-3.0-only",
6
6
  "description": "Run coding agents on machines you own. Open-source, self-hostable agent workspace.",