@yukino.js/yukino 0.0.4 → 0.0.6

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 (68) hide show
  1. package/README.md +90 -64
  2. package/dist/acp-U7GA5YRP.js +14 -0
  3. package/dist/anthropic-3TRLGKHZ.js +4 -0
  4. package/dist/{bwrap-MLSZLWHD.js → bwrap-BZ7Q2A5B.js} +1 -1
  5. package/dist/chunk-3OULXPVI.js +5 -0
  6. package/dist/chunk-E7FXB7TA.js +61 -0
  7. package/dist/{chunk-GYBJR2RB.js → chunk-IW5L5276.js} +2 -2
  8. package/dist/chunk-KILUTRHM.js +4 -0
  9. package/dist/chunk-ME5UYXP4.js +1031 -0
  10. package/dist/chunk-NAQRFHUX.js +4 -0
  11. package/dist/chunk-P6DHMU7R.js +4 -0
  12. package/dist/{chunk-JNCMSXQZ.js → chunk-SYLHBECV.js} +2 -2
  13. package/dist/chunk-TPWRDFEX.js +4 -0
  14. package/dist/chunk-VM4YKTHC.js +10 -0
  15. package/dist/chunk-WVT2D5AR.js +4 -0
  16. package/dist/chunk-XFVM5ZZL.js +241 -0
  17. package/dist/{devtools-YWVUN4HX.js → devtools-UVGRIXO2.js} +1 -1
  18. package/dist/esm-5V3TYPZK.js +229 -0
  19. package/dist/lib/{anthropic-MSGL4VBM.js → anthropic-GAD2PGEN.js} +2 -5
  20. package/dist/lib/{bwrap-2OL7VPSO.js → bwrap-STOJ4TEH.js} +1 -1
  21. package/dist/lib/chunk-3ONNRNKQ.js +1335 -0
  22. package/dist/lib/{chunk-FLKB4BK7.js → chunk-6NYUYSER.js} +16 -4
  23. package/dist/lib/{chunk-P3HXGEQQ.js → chunk-CBBSDV2D.js} +1 -1
  24. package/dist/lib/{chunk-ENTAZT2J.js → chunk-D3SXNTPZ.js} +449 -60
  25. package/dist/lib/{chunk-YIWNQ7OA.js → chunk-MGPT7DWP.js} +1 -0
  26. package/dist/lib/{chunk-24L3QT3J.js → chunk-OYQY3Q45.js} +68 -27
  27. package/dist/lib/{chunk-E6VFL5IO.js → chunk-RVSLQCZ5.js} +101 -59
  28. package/dist/lib/index.d.ts +3390 -2240
  29. package/dist/lib/index.js +19719 -13372
  30. package/dist/lib/{openai-DL5VBJR4.js → openai-BYOGAZU5.js} +2 -3
  31. package/dist/lib/{providers-SMRZVJ7O.js → providers-YHVXG3PP.js} +1 -1
  32. package/dist/lib/{seatbelt-WO7YWKLR.js → seatbelt-VE3I3EGH.js} +1 -1
  33. package/dist/lib/{tool-filter-PY6XY254.js → tool-filter-HUVHJN3O.js} +3 -3
  34. package/dist/main.js +203 -194
  35. package/dist/{openai-AQNX24XU.js → openai-PYPO6SKD.js} +15 -15
  36. package/dist/{providers-FZUDVU4M.js → providers-6UOA2HYN.js} +1 -1
  37. package/dist/{seatbelt-JOCANLYS.js → seatbelt-3YN3GMQO.js} +1 -1
  38. package/dist/server-NXQ6REG3.js +4 -0
  39. package/dist/tool-filter-XZ7I6KU7.js +4 -0
  40. package/package.json +69 -32
  41. package/dist/acp-JCR6GVC3.js +0 -14
  42. package/dist/agent-56R4TACG.js +0 -4
  43. package/dist/anthropic-CEUDAJL2.js +0 -4
  44. package/dist/chunk-6DXHDARX.js +0 -607
  45. package/dist/chunk-77W2UPS2.js +0 -4
  46. package/dist/chunk-7DLUKIPE.js +0 -5
  47. package/dist/chunk-HLE7243Q.js +0 -4
  48. package/dist/chunk-K4BYVVW7.js +0 -5
  49. package/dist/chunk-L2BWSPCF.js +0 -10
  50. package/dist/chunk-OFC2GD5K.js +0 -4
  51. package/dist/chunk-RCXKUD3Y.js +0 -4
  52. package/dist/chunk-SAJCBGHL.js +0 -4
  53. package/dist/chunk-U2CS2E2F.js +0 -237
  54. package/dist/chunk-UPNNYP7M.js +0 -60
  55. package/dist/chunk-XO7ITAWR.js +0 -4
  56. package/dist/chunk-ZETIYALB.js +0 -164
  57. package/dist/esm-NCEEJIH3.js +0 -229
  58. package/dist/lib/agent-INEHZXP3.js +0 -16
  59. package/dist/lib/chunk-6AKRDUQF.js +0 -259
  60. package/dist/lib/chunk-7SU77J32.js +0 -599
  61. package/dist/lib/chunk-BMODZ6SU.js +0 -673
  62. package/dist/lib/chunk-DF3ITW4K.js +0 -3470
  63. package/dist/lib/chunk-F2YJG72O.js +0 -150
  64. package/dist/lib/chunk-MDX24JQ5.js +0 -619
  65. package/dist/lib/permissions-Q4FBU5VD.js +0 -19
  66. package/dist/permissions-VCDMNX3L.js +0 -4
  67. package/dist/server-VLJWUETV.js +0 -4
  68. package/dist/tool-filter-BQZDV3TF.js +0 -4
@@ -6,12 +6,12 @@ import {
6
6
  var tool_filter_exports = {};
7
7
  __export(tool_filter_exports, {
8
8
  ASYNC_AGENT_ALLOWED_TOOLS: () => ASYNC_AGENT_ALLOWED_TOOLS,
9
- CUSTOM_AGENT_DISALLOWED_TOOLS: () => CUSTOM_AGENT_DISALLOWED_TOOLS,
10
9
  FORK_QUERY_SOURCE: () => FORK_QUERY_SOURCE,
11
10
  MAIN_AGENT_ONLY_TOOLS: () => MAIN_AGENT_ONLY_TOOLS,
12
11
  SUBAGENT_DISALLOWED_TOOLS: () => SUBAGENT_DISALLOWED_TOOLS,
13
12
  TEAMMATE_DISALLOWED_TOOLS: () => TEAMMATE_DISALLOWED_TOOLS,
14
13
  cloneRegistryForFork: () => cloneRegistryForFork,
14
+ cloneRegistryForTeammate: () => cloneRegistryForTeammate,
15
15
  filterToolsForAgent: () => filterToolsForAgent
16
16
  });
17
17
 
@@ -25,9 +25,11 @@ var ToolRegistry = class {
25
25
  discovered = /* @__PURE__ */ new Set();
26
26
  /**
27
27
  * How MCP tools are loaded, written by mcp/strategy after connecting to the
28
- * server. ToolSearch relies on it to decide what to return, and the client
29
- * relies on it to decide whether to send defer_loading. It stays eager when
30
- * there is no MCP, which behaves the same as no deferral.
28
+ * server. ToolSearch relies on it to decide what to return, and
29
+ * getAllSchemas relies on it to decide whether deferred tools ship with
30
+ * defer_loading (native) or are omitted from tools[] entirely (dispatch).
31
+ * It stays eager when there is no MCP, which behaves the same as no
32
+ * deferral.
31
33
  */
32
34
  mcpLoadingMode = "eager";
33
35
  /**
@@ -54,6 +56,11 @@ var ToolRegistry = class {
54
56
  get(name) {
55
57
  return this.tools.get(name);
56
58
  }
59
+ /** Look up a tool and narrow it to a concrete class via instanceof. */
60
+ getInstanceOf(name, ctor) {
61
+ const tool = this.tools.get(name);
62
+ return tool instanceof ctor ? tool : void 0;
63
+ }
57
64
  listTools() {
58
65
  return [...this.tools.values()];
59
66
  }
@@ -63,16 +70,10 @@ var ToolRegistry = class {
63
70
  const native = this.mcpLoadingMode === "native" && !isOpenAI;
64
71
  const schemas = [];
65
72
  for (const tool of this.tools.values()) {
66
- if (filter && !filter(tool.name)) {
67
- continue;
68
- }
69
- if (tool.name === "ToolSearch" && !this.exposeToolSearch || tool.name === "McpCall" && !this.exposeMcpCall) {
73
+ if (!this.isToolVisible(tool, native, filter)) {
70
74
  continue;
71
75
  }
72
76
  const deferred = Boolean(tool.deferred) && !this.discovered.has(tool.name);
73
- if (deferred && !native) {
74
- continue;
75
- }
76
77
  const s = tool.schema();
77
78
  if (resolvedProtocol === "openai") {
78
79
  schemas.push({
@@ -102,6 +103,39 @@ var ToolRegistry = class {
102
103
  }
103
104
  return schemas;
104
105
  }
106
+ /**
107
+ * Shared visibility predicate for getAllSchemas and listVisibleToolNames:
108
+ * the caller's filter, the search/dispatch exposure rules, and deferred
109
+ * hiding must agree everywhere tools are advertised.
110
+ */
111
+ isToolVisible(tool, native, filter) {
112
+ if (filter && !filter(tool.name)) {
113
+ return false;
114
+ }
115
+ if (tool.name === "ToolSearch" && !this.exposeToolSearch || tool.name === "McpCall" && !this.exposeMcpCall) {
116
+ return false;
117
+ }
118
+ const deferred = Boolean(tool.deferred) && !this.discovered.has(tool.name);
119
+ return !deferred || native;
120
+ }
121
+ /**
122
+ * Names of the tools getAllSchemas would emit for the same protocol and
123
+ * filter — identical visibility rules, so anything that advertises
124
+ * "available tools" (e.g. the compaction recovery attachment) matches what
125
+ * the run can actually call.
126
+ */
127
+ listVisibleToolNames(protocol, filter) {
128
+ const resolvedProtocol = protocol ?? "anthropic";
129
+ const isOpenAI = resolvedProtocol === "openai" || resolvedProtocol === "openai-compat";
130
+ const native = this.mcpLoadingMode === "native" && !isOpenAI;
131
+ const names = [];
132
+ for (const tool of this.tools.values()) {
133
+ if (this.isToolVisible(tool, native, filter)) {
134
+ names.push(tool.name);
135
+ }
136
+ }
137
+ return names;
138
+ }
105
139
  /**
106
140
  * Names of deferred tools not yet discovered, in lexicographic order.
107
141
  *
@@ -160,25 +194,22 @@ var MAIN_AGENT_ONLY_TOOLS = /* @__PURE__ */ new Set([
160
194
  "AskUserQuestion",
161
195
  "ExitPlanMode"
162
196
  ]);
163
- var SUBAGENT_DISALLOWED_TOOLS = /* @__PURE__ */ new Set([
164
- ...MAIN_AGENT_ONLY_TOOLS,
197
+ var SUBAGENT_EXTRA_TOOLS = [
165
198
  "Agent",
166
199
  // Prevents recursive spawning of subagents
167
200
  "TaskStop"
201
+ ];
202
+ var SUBAGENT_DISALLOWED_TOOLS = /* @__PURE__ */ new Set([
203
+ ...MAIN_AGENT_ONLY_TOOLS,
204
+ ...SUBAGENT_EXTRA_TOOLS
168
205
  ]);
169
206
  var TEAMMATE_DISALLOWED_TOOLS = /* @__PURE__ */ new Set([
170
207
  "TeamCreate",
171
208
  "TeamDelete"
172
209
  ]);
173
- var CUSTOM_AGENT_DISALLOWED_TOOLS = /* @__PURE__ */ new Set([
174
- "ExitPlanMode",
175
- "Agent",
176
- "AskUserQuestion",
177
- "TaskStop"
178
- ]);
179
210
  var ASYNC_AGENT_ALLOWED_TOOLS = /* @__PURE__ */ new Set([
180
211
  "ReadFile",
181
- // "WebSearch",
212
+ "WebFetch",
182
213
  "Grep",
183
214
  "Glob",
184
215
  "Bash",
@@ -197,7 +228,7 @@ var ASYNC_AGENT_ALLOWED_TOOLS = /* @__PURE__ */ new Set([
197
228
  function isMCPTool(name) {
198
229
  return name.startsWith("mcp__");
199
230
  }
200
- function filterToolsForAgent(registry, allowedTools, disallowedTools, isAsync, isCustom = false) {
231
+ function filterToolsForAgent(registry, allowedTools, disallowedTools, isAsync) {
201
232
  const disallowed = new Set(disallowedTools ?? []);
202
233
  const allowed = new Set(allowedTools ?? []);
203
234
  const hasWhitelist = allowed.size > 0 && !(allowed.size === 1 && allowed.has("*"));
@@ -214,9 +245,6 @@ function filterToolsForAgent(registry, allowedTools, disallowedTools, isAsync, i
214
245
  if (SUBAGENT_DISALLOWED_TOOLS.has(name)) {
215
246
  continue;
216
247
  }
217
- if (isCustom && CUSTOM_AGENT_DISALLOWED_TOOLS.has(name)) {
218
- continue;
219
- }
220
248
  if (isAsync && !ASYNC_AGENT_ALLOWED_TOOLS.has(name)) {
221
249
  continue;
222
250
  }
@@ -231,6 +259,20 @@ function filterToolsForAgent(registry, allowedTools, disallowedTools, isAsync, i
231
259
  return filtered;
232
260
  }
233
261
  var FORK_QUERY_SOURCE = "agent:builtin:fork";
262
+ function cloneRegistryForTeammate(registry) {
263
+ const teammate = new ToolRegistry();
264
+ teammate.mcpLoadingMode = registry.mcpLoadingMode;
265
+ for (const tool of registry.listTools()) {
266
+ if (SUBAGENT_DISALLOWED_TOOLS.has(tool.name)) {
267
+ continue;
268
+ }
269
+ if (TEAMMATE_DISALLOWED_TOOLS.has(tool.name)) {
270
+ continue;
271
+ }
272
+ teammate.register(tool);
273
+ }
274
+ return teammate;
275
+ }
234
276
  function cloneRegistryForFork(registry) {
235
277
  const forked = new ToolRegistry();
236
278
  forked.mcpLoadingMode = registry.mcpLoadingMode;
@@ -240,8 +282,7 @@ function cloneRegistryForFork(registry) {
240
282
  }
241
283
  if (tool.name === "Agent" && "querySource" in tool) {
242
284
  const clone = Object.create(
243
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
244
- Object.getPrototypeOf(tool),
285
+ Reflect.getPrototypeOf(tool),
245
286
  Object.getOwnPropertyDescriptors(tool)
246
287
  );
247
288
  clone.querySource = FORK_QUERY_SOURCE;
@@ -259,10 +300,10 @@ export {
259
300
  MAIN_AGENT_ONLY_TOOLS,
260
301
  SUBAGENT_DISALLOWED_TOOLS,
261
302
  TEAMMATE_DISALLOWED_TOOLS,
262
- CUSTOM_AGENT_DISALLOWED_TOOLS,
263
303
  ASYNC_AGENT_ALLOWED_TOOLS,
264
304
  filterToolsForAgent,
265
305
  FORK_QUERY_SOURCE,
306
+ cloneRegistryForTeammate,
266
307
  cloneRegistryForFork,
267
308
  tool_filter_exports
268
309
  };
@@ -4,23 +4,22 @@ import {
4
4
  LLMError,
5
5
  NetworkError,
6
6
  RateLimitError,
7
+ asRecord,
8
+ asString,
7
9
  clampThinkingLevel,
8
10
  containsContextLengthError,
11
+ contentToText,
12
+ createChildLogger,
9
13
  ensureToolPairing,
10
14
  getMaxOutputTokens,
11
15
  getSupportedThinkingLevels,
12
16
  getThinkingLevel,
17
+ isRecord,
18
+ parseToolArguments,
13
19
  resolveAPIKey,
20
+ strArg,
14
21
  toReasoningEffort
15
- } from "./chunk-BMODZ6SU.js";
16
- import {
17
- asRecord,
18
- asString,
19
- contentToText,
20
- createChildLogger,
21
- isRecord,
22
- strArg
23
- } from "./chunk-7SU77J32.js";
22
+ } from "./chunk-3ONNRNKQ.js";
24
23
  import {
25
24
  __export
26
25
  } from "./chunk-MLKGABMK.js";
@@ -177,6 +176,8 @@ var OpenAIClient = class {
177
176
  let jsonAccumulate = "";
178
177
  let reasoningId = "";
179
178
  let reasoningText = "";
179
+ let reasoningPartText = "";
180
+ const startedComputerCalls = /* @__PURE__ */ new Set();
180
181
  let sawTerminalResponse = false;
181
182
  for await (const event of stream) {
182
183
  if (event.type === "response.output_text.delta") {
@@ -186,14 +187,20 @@ var OpenAIClient = class {
186
187
  };
187
188
  } else if (event.type === "response.reasoning_summary_text.delta") {
188
189
  reasoningText += event.delta;
190
+ reasoningPartText += event.delta;
189
191
  yield { type: "thinking_delta", text: event.delta };
190
192
  } else if (event.type === "response.reasoning_summary_text.done") {
191
- yield {
192
- type: "thinking_complete",
193
- thinking: reasoningText,
194
- signature: reasoningId
195
- };
193
+ if (!reasoningPartText) {
194
+ reasoningText += event.text;
195
+ yield { type: "thinking_delta", text: event.text };
196
+ }
197
+ reasoningPartText = "";
196
198
  } else if (event.type === "response.function_call_arguments.delta") {
199
+ if (!currentToolId || !currentToolName) {
200
+ throw new NetworkError(
201
+ "Responses tool arguments arrived before a valid tool call"
202
+ );
203
+ }
197
204
  jsonAccumulate += event.delta;
198
205
  yield {
199
206
  type: "tool_call_delta",
@@ -201,6 +208,11 @@ var OpenAIClient = class {
201
208
  };
202
209
  } else if (event.type === "response.output_item.added") {
203
210
  if (event.item.type === "function_call") {
211
+ if (!event.item.call_id || !event.item.name) {
212
+ throw new NetworkError(
213
+ "Responses tool call started without a valid id or name"
214
+ );
215
+ }
204
216
  currentToolName = event.item.name;
205
217
  currentToolId = event.item.call_id;
206
218
  jsonAccumulate = "";
@@ -210,6 +222,12 @@ var OpenAIClient = class {
210
222
  toolId: currentToolId
211
223
  };
212
224
  } else if (event.item.type === "computer_call") {
225
+ if (!event.item.call_id || !event.item.id) {
226
+ throw new NetworkError(
227
+ "Responses computer call started without a valid id"
228
+ );
229
+ }
230
+ startedComputerCalls.add(event.item.call_id);
213
231
  yield {
214
232
  type: "tool_call_start",
215
233
  toolName: "ComputerUse",
@@ -218,29 +236,45 @@ var OpenAIClient = class {
218
236
  } else if (event.item.type === "reasoning") {
219
237
  reasoningId = event.item.id ?? "";
220
238
  reasoningText = "";
239
+ reasoningPartText = "";
221
240
  }
222
241
  } else if (event.type === "response.output_item.done") {
223
- if (event.item.type === "function_call" && currentToolName) {
224
- let args = {};
225
- if (jsonAccumulate) {
226
- try {
227
- const parsed = JSON.parse(jsonAccumulate);
228
- args = isRecord(parsed) ? asRecord(parsed) : {};
229
- } catch (err) {
230
- log.error({ err }, "llm operation failed");
231
- args = {};
232
- }
242
+ if (event.item.type === "reasoning") {
243
+ if (reasoningText) {
244
+ yield {
245
+ type: "thinking_complete",
246
+ thinking: reasoningText,
247
+ signature: reasoningId
248
+ };
233
249
  }
250
+ reasoningId = "";
251
+ reasoningText = "";
252
+ reasoningPartText = "";
253
+ } else if (event.item.type === "function_call") {
254
+ if (!currentToolId || !currentToolName) {
255
+ throw new NetworkError(
256
+ "Responses tool call completed without a valid start event"
257
+ );
258
+ }
259
+ const parsed = parseToolArguments(
260
+ jsonAccumulate.trim() ? jsonAccumulate : event.item.arguments
261
+ );
234
262
  yield {
235
263
  type: "tool_call_complete",
236
264
  toolId: currentToolId,
237
265
  toolName: currentToolName,
238
- arguments: args
266
+ arguments: parsed.arguments,
267
+ ...parsed.parseError ? { parseError: parsed.parseError } : {}
239
268
  };
240
269
  currentToolName = "";
241
270
  currentToolId = "";
242
271
  jsonAccumulate = "";
243
272
  } else if (event.item.type === "computer_call") {
273
+ if (!event.item.call_id || !event.item.id || !startedComputerCalls.delete(event.item.call_id)) {
274
+ throw new NetworkError(
275
+ "Responses computer call completed without a valid start event"
276
+ );
277
+ }
244
278
  yield {
245
279
  type: "tool_call_complete",
246
280
  toolId: event.item.call_id,
@@ -280,7 +314,6 @@ var OpenAIClient = class {
280
314
  outputTokens,
281
315
  cacheReadInputTokens,
282
316
  cacheCreationInputTokens
283
- // 0
284
317
  }
285
318
  };
286
319
  } else if (event.type === "response.failed") {
@@ -522,6 +555,9 @@ function buildOpenAIInput(messages) {
522
555
  for (const m of messages) {
523
556
  if (m.thinkingBlocks) {
524
557
  for (const tb of m.thinkingBlocks) {
558
+ if (!tb.signature.startsWith("rs_")) {
559
+ continue;
560
+ }
525
561
  result.push({
526
562
  type: "reasoning",
527
563
  id: tb.signature,
@@ -696,30 +732,33 @@ var OpenAICompatClient = class {
696
732
  }
697
733
  if (delta.tool_calls) {
698
734
  for (const tc of delta.tool_calls) {
699
- if (!toolCalls.has(tc.index)) {
700
- toolCalls.set(tc.index, {
735
+ let entry = toolCalls.get(tc.index);
736
+ if (!entry) {
737
+ entry = {
701
738
  id: tc.id ?? "",
702
739
  name: tc.function?.name ?? "",
703
- args: ""
704
- });
705
- if (tc.id) {
706
- yield {
707
- type: "tool_call_start",
708
- toolName: tc.function?.name ?? "",
709
- toolId: tc.id ?? ""
710
- };
711
- }
740
+ args: "",
741
+ started: false
742
+ };
743
+ toolCalls.set(tc.index, entry);
712
744
  }
713
- const existing = toolCalls.get(tc.index);
714
- if (existing) {
715
- if (tc.id) {
716
- existing.id = tc.id;
717
- }
718
- if (tc.function?.name) {
719
- existing.name = tc.function.name;
720
- }
721
- if (tc.function?.arguments) {
722
- existing.args += tc.function.arguments;
745
+ if (tc.id) {
746
+ entry.id = tc.id;
747
+ }
748
+ if (tc.function?.name) {
749
+ entry.name = tc.function.name;
750
+ }
751
+ if (!entry.started && entry.id && entry.name) {
752
+ entry.started = true;
753
+ yield {
754
+ type: "tool_call_start",
755
+ toolName: entry.name,
756
+ toolId: entry.id
757
+ };
758
+ }
759
+ if (tc.function?.arguments) {
760
+ entry.args += tc.function.arguments;
761
+ if (entry.started) {
723
762
  yield {
724
763
  type: "tool_call_delta",
725
764
  text: tc.function.arguments
@@ -738,23 +777,26 @@ var OpenAICompatClient = class {
738
777
  };
739
778
  reasoningAccumulate = "";
740
779
  }
780
+ const incompleteCall = [...toolCalls.values()].find(
781
+ (toolCall) => !toolCall.started
782
+ );
783
+ if (incompleteCall) {
784
+ const missing = [
785
+ ...incompleteCall.id ? [] : ["id"],
786
+ ...incompleteCall.name ? [] : ["name"]
787
+ ].join(" and ");
788
+ throw new NetworkError(
789
+ `Chat Completions tool call ended without a valid ${missing}`
790
+ );
791
+ }
741
792
  for (const tu of toolCalls.values()) {
742
- let args = {};
743
- const jsonArgs = tu.args;
744
- if (jsonArgs) {
745
- try {
746
- const parsed = JSON.parse(jsonArgs);
747
- args = isRecord(parsed) ? asRecord(parsed) : {};
748
- } catch (err) {
749
- log.error({ err }, "llm operation failed");
750
- args = {};
751
- }
752
- }
793
+ const parsed = parseToolArguments(tu.args);
753
794
  yield {
754
795
  type: "tool_call_complete",
755
796
  toolName: tu.name,
756
797
  toolId: tu.id,
757
- arguments: args
798
+ arguments: parsed.arguments,
799
+ ...parsed.parseError ? { parseError: parsed.parseError } : {}
758
800
  };
759
801
  }
760
802
  }