@ai-sdk/devtools 1.0.0-canary.26 → 1.0.0-canary.27

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.
@@ -10,7 +10,7 @@
10
10
  href="https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500;600;700&display=swap"
11
11
  rel="stylesheet"
12
12
  />
13
- <script type="module" crossorigin src="/assets/index-Rx129Xx2.js"></script>
13
+ <script type="module" crossorigin src="/assets/index-DKzNaLaQ.js"></script>
14
14
  <link rel="stylesheet" crossorigin href="/assets/index-BVPj3Knk.css">
15
15
  </head>
16
16
  <body>
package/dist/index.js CHANGED
@@ -442,9 +442,9 @@ function DevToolsTelemetry() {
442
442
  let currentToolCallId = null;
443
443
  function resolveParentInfo() {
444
444
  if (!currentToolCallId) return void 0;
445
- const ctx = toolContextMap.get(currentToolCallId);
446
- if (!ctx) return void 0;
447
- const parentState = callStates.get(ctx.parentCallId);
445
+ const toolCallContext = toolContextMap.get(currentToolCallId);
446
+ if (!toolCallContext) return void 0;
447
+ const parentState = callStates.get(toolCallContext.parentCallId);
448
448
  if (!parentState) return void 0;
449
449
  let latestStepId;
450
450
  let latestStepNumber = -1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/devtools",
3
- "version": "1.0.0-canary.26",
3
+ "version": "1.0.0-canary.27",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -27,7 +27,7 @@
27
27
  "dependencies": {
28
28
  "@hono/node-server": "^1.19.14",
29
29
  "hono": "^4.12.18",
30
- "@ai-sdk/provider": "4.0.0-canary.17"
30
+ "@ai-sdk/provider": "4.0.0-canary.18"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@radix-ui/react-collapsible": "^1.1.12",
@@ -56,7 +56,7 @@
56
56
  "vite": "^6.4.2",
57
57
  "vitest": "^4.1.6",
58
58
  "zod": "3.25.76",
59
- "ai": "7.0.0-canary.144"
59
+ "ai": "7.0.0-canary.165"
60
60
  },
61
61
  "publishConfig": {
62
62
  "access": "public",
@@ -126,10 +126,10 @@ export function DevToolsTelemetry(): Telemetry {
126
126
  function resolveParentInfo(): { runId: string; stepId: string } | undefined {
127
127
  if (!currentToolCallId) return undefined;
128
128
 
129
- const ctx = toolContextMap.get(currentToolCallId);
130
- if (!ctx) return undefined;
129
+ const toolCallContext = toolContextMap.get(currentToolCallId);
130
+ if (!toolCallContext) return undefined;
131
131
 
132
- const parentState = callStates.get(ctx.parentCallId);
132
+ const parentState = callStates.get(toolCallContext.parentCallId);
133
133
  if (!parentState) return undefined;
134
134
 
135
135
  // Find the step that is currently executing the tool call.
@@ -469,21 +469,21 @@ export function buildTraceSpans(
469
469
 
470
470
  if (!hasSubParts) {
471
471
  const stepChildRuns = childRuns.filter(
472
- cr => cr.run.parent_step_id === step.id,
472
+ childRun => childRun.run.parent_step_id === step.id,
473
473
  );
474
- for (const cr of stepChildRuns) {
474
+ for (const childRun of stepChildRuns) {
475
475
  addStepSpans(
476
- cr.steps,
476
+ childRun.steps,
477
477
  depth + 1,
478
- cr.childRuns ?? [],
479
- cr.run.function_id,
478
+ childRun.childRuns ?? [],
479
+ childRun.run.function_id,
480
480
  );
481
481
  }
482
482
  continue;
483
483
  }
484
484
 
485
485
  const stepChildRuns = childRuns.filter(
486
- cr => cr.run.parent_step_id === step.id,
486
+ childRun => childRun.run.parent_step_id === step.id,
487
487
  );
488
488
  const sortedChildRuns = [...stepChildRuns].sort(
489
489
  (a, b) =>
@@ -499,7 +499,7 @@ export function buildTraceSpans(
499
499
  const unmatchedChildRuns: ChildRun[] = [];
500
500
 
501
501
  if (toolCallParts.length > 0 && sortedChildRuns.length > 0) {
502
- let crIdx = 0;
502
+ let childRunIndex = 0;
503
503
  for (const tc of toolCallParts) {
504
504
  const tcId = tc.toolCallId;
505
505
  if (!tcId) continue;
@@ -511,19 +511,19 @@ export function buildTraceSpans(
511
511
  p.toolCallId === tcId,
512
512
  );
513
513
 
514
- if (tcResult && crIdx < sortedChildRuns.length) {
515
- const cr = sortedChildRuns[crIdx];
516
- if (cr) {
514
+ if (tcResult && childRunIndex < sortedChildRuns.length) {
515
+ const childRun = sortedChildRuns[childRunIndex];
516
+ if (childRun) {
517
517
  const existing = toolCallToChildRuns.get(tcId) ?? [];
518
- existing.push(cr);
518
+ existing.push(childRun);
519
519
  toolCallToChildRuns.set(tcId, existing);
520
- crIdx++;
520
+ childRunIndex++;
521
521
  }
522
522
  }
523
523
  }
524
- for (let i = crIdx; i < sortedChildRuns.length; i++) {
525
- const cr = sortedChildRuns[i];
526
- if (cr) unmatchedChildRuns.push(cr);
524
+ for (let i = childRunIndex; i < sortedChildRuns.length; i++) {
525
+ const childRun = sortedChildRuns[i];
526
+ if (childRun) unmatchedChildRuns.push(childRun);
527
527
  }
528
528
  } else {
529
529
  unmatchedChildRuns.push(...sortedChildRuns);
@@ -541,18 +541,19 @@ export function buildTraceSpans(
541
541
  if (tcChildRuns.length > 0) {
542
542
  const earliest = Math.min(
543
543
  ...tcChildRuns.map(
544
- cr => new Date(cr.run.started_at).getTime() - traceStart,
544
+ childRun =>
545
+ new Date(childRun.run.started_at).getTime() - traceStart,
545
546
  ),
546
547
  );
547
548
  const latest = Math.max(
548
- ...tcChildRuns.map(cr => {
549
- const crStart =
550
- new Date(cr.run.started_at).getTime() - traceStart;
551
- const crDuration = cr.steps.reduce(
549
+ ...tcChildRuns.map(childRun => {
550
+ const childRunStart =
551
+ new Date(childRun.run.started_at).getTime() - traceStart;
552
+ const childRunDuration = childRun.steps.reduce(
552
553
  (a, s) => a + (s.duration_ms || 0),
553
554
  0,
554
555
  );
555
- return crStart + crDuration;
556
+ return childRunStart + childRunDuration;
556
557
  }),
557
558
  );
558
559
  toolTimeRanges.push({
@@ -600,11 +601,13 @@ export function buildTraceSpans(
600
601
  ? Object.entries(args as Record<string, unknown>)
601
602
  .slice(0, 3)
602
603
  .map(([, v]) => {
603
- const s =
604
+ const previewText =
604
605
  typeof v === 'string'
605
606
  ? v
606
607
  : (JSON.stringify(v) ?? String(v));
607
- return s.length > 30 ? s.slice(0, 30) + '…' : s;
608
+ return previewText.length > 30
609
+ ? previewText.slice(0, 30) + '…'
610
+ : previewText;
608
611
  })
609
612
  .join(', ')
610
613
  : typeof args === 'string'
@@ -640,12 +643,12 @@ export function buildTraceSpans(
640
643
  toolCallId: part.toolCallId,
641
644
  });
642
645
 
643
- for (const cr of tcChildRuns) {
646
+ for (const childRun of tcChildRuns) {
644
647
  addStepSpans(
645
- cr.steps,
648
+ childRun.steps,
646
649
  depth + 2,
647
- cr.childRuns ?? [],
648
- cr.run.function_id,
650
+ childRun.childRuns ?? [],
651
+ childRun.run.function_id,
649
652
  );
650
653
  }
651
654
 
@@ -687,12 +690,12 @@ export function buildTraceSpans(
687
690
  });
688
691
  }
689
692
 
690
- for (const cr of unmatchedChildRuns) {
693
+ for (const childRun of unmatchedChildRuns) {
691
694
  addStepSpans(
692
- cr.steps,
695
+ childRun.steps,
693
696
  depth + 1,
694
- cr.childRuns ?? [],
695
- cr.run.function_id,
697
+ childRun.childRuns ?? [],
698
+ childRun.run.function_id,
696
699
  );
697
700
  }
698
701
  }