@copilotkit/web-inspector 1.63.3-canary.rc-1 → 1.64.1

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/index.umd.js CHANGED
@@ -191,7 +191,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
191
191
 
192
192
  //#endregion
193
193
  //#region package.json
194
- var version = "1.63.3-canary.rc-1";
194
+ var version = "1.64.1";
195
195
 
196
196
  //#endregion
197
197
  //#region src/lib/telemetry.ts
@@ -1365,7 +1365,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1365
1365
  if ((_msg$toolCalls = msg.toolCalls) === null || _msg$toolCalls === void 0 ? void 0 : _msg$toolCalls.length) for (const tc of msg.toolCalls) {
1366
1366
  let args = {};
1367
1367
  if (typeof tc.args === "string") try {
1368
- args = JSON.parse(tc.args);
1368
+ args = this.parseToolCallContent(tc.args);
1369
1369
  } catch (err) {
1370
1370
  console.error("[CopilotKit Inspector] Failed to parse tool-call arguments", {
1371
1371
  toolCallId: tc.id,
@@ -1407,10 +1407,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1407
1407
  } else if (msg.role === "tool" && msg.toolCallId) {
1408
1408
  const tc = toolCallMap.get(msg.toolCallId);
1409
1409
  if (tc) try {
1410
- var _msg$content;
1411
- tc.result = JSON.parse((_msg$content = msg.content) !== null && _msg$content !== void 0 ? _msg$content : "{}");
1410
+ tc.result = this.parseToolCallContent(msg.content);
1412
1411
  } catch (err) {
1413
- var _msg$content2;
1412
+ var _msg$content;
1414
1413
  console.error("[CopilotKit Inspector] Failed to parse tool-call result content", {
1415
1414
  toolCallId: msg.toolCallId,
1416
1415
  raw: msg.content,
@@ -1418,12 +1417,17 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1418
1417
  });
1419
1418
  tc.result = {
1420
1419
  __parseError: true,
1421
- __raw: (_msg$content2 = msg.content) !== null && _msg$content2 !== void 0 ? _msg$content2 : null
1420
+ __raw: (_msg$content = msg.content) !== null && _msg$content !== void 0 ? _msg$content : null
1422
1421
  };
1423
1422
  }
1424
1423
  }
1425
1424
  return items;
1426
1425
  }
1426
+ parseToolCallContent(content) {
1427
+ const normalizedContent = content === null || content === void 0 ? void 0 : content.trim();
1428
+ if (!normalizedContent) return {};
1429
+ return JSON.parse(normalizedContent);
1430
+ }
1427
1431
  mapApiEvents(events) {
1428
1432
  return events.map((event, index) => {
1429
1433
  const { type, timestamp, payload, ...rest } = event;