@mastra/ai-sdk 1.3.0 → 1.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @mastra/ai-sdk
2
2
 
3
+ ## 1.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixed nested-agent streaming payload growth that could exhaust memory and crash Node in multi-step runs. Resolves #14932. ([#14986](https://github.com/mastra-ai/mastra/pull/14986))
8
+
9
+ - Updated dependencies [[`cb15509`](https://github.com/mastra-ai/mastra/commit/cb15509b58f6a83e11b765c945082afc027db972), [`81e4259`](https://github.com/mastra-ai/mastra/commit/81e425939b4ceeb4f586e9b6d89c3b1c1f2d2fe7), [`951b8a1`](https://github.com/mastra-ai/mastra/commit/951b8a1b5ef7e1474c59dc4f2b9fc1a8b1e508b6), [`80c5668`](https://github.com/mastra-ai/mastra/commit/80c5668e365470d3a96d3e953868fd7a643ff67c), [`3d478c1`](https://github.com/mastra-ai/mastra/commit/3d478c1e13f17b80f330ac49d7aa42ef929b93ff), [`2b4ea10`](https://github.com/mastra-ai/mastra/commit/2b4ea10b053e4ea1ab232d536933a4a3c4cba999), [`a0544f0`](https://github.com/mastra-ai/mastra/commit/a0544f0a1e6bd52ac12676228967c1938e43648d), [`6039f17`](https://github.com/mastra-ai/mastra/commit/6039f176f9c457304825ff1df8c83b8e457376c0), [`06b928d`](https://github.com/mastra-ai/mastra/commit/06b928dfc2f5630d023467476cc5919dfa858d0a), [`6a8d984`](https://github.com/mastra-ai/mastra/commit/6a8d9841f2933456ee1598099f488d742b600054), [`c8c86aa`](https://github.com/mastra-ai/mastra/commit/c8c86aa1458017fbd1c0776fdc0c520d129df8a6)]:
10
+ - @mastra/core@1.22.0
11
+
12
+ ## 1.3.1-alpha.0
13
+
14
+ ### Patch Changes
15
+
16
+ - Fixed nested-agent streaming payload growth that could exhaust memory and crash Node in multi-step runs. Resolves #14932. ([#14986](https://github.com/mastra-ai/mastra/pull/14986))
17
+
18
+ - Updated dependencies [[`cb15509`](https://github.com/mastra-ai/mastra/commit/cb15509b58f6a83e11b765c945082afc027db972), [`80c5668`](https://github.com/mastra-ai/mastra/commit/80c5668e365470d3a96d3e953868fd7a643ff67c), [`3d478c1`](https://github.com/mastra-ai/mastra/commit/3d478c1e13f17b80f330ac49d7aa42ef929b93ff), [`6039f17`](https://github.com/mastra-ai/mastra/commit/6039f176f9c457304825ff1df8c83b8e457376c0), [`06b928d`](https://github.com/mastra-ai/mastra/commit/06b928dfc2f5630d023467476cc5919dfa858d0a), [`6a8d984`](https://github.com/mastra-ai/mastra/commit/6a8d9841f2933456ee1598099f488d742b600054)]:
19
+ - @mastra/core@1.22.0-alpha.2
20
+
3
21
  ## 1.3.0
4
22
 
5
23
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -12508,10 +12508,17 @@ function transformAgent(payload, bufferedSteps) {
12508
12508
  break;
12509
12509
  case "step-finish": {
12510
12510
  const stepRun = ensureAgentRunState(bufferedSteps, payload.runId);
12511
+ const { steps: _steps, _textOffset, _reasoningOffset, ...stepRunWithoutSteps } = stepRun;
12512
+ const textOffset = _textOffset || 0;
12513
+ const reasoningOffset = _reasoningOffset || 0;
12514
+ const stepText = stepRun.text.slice(textOffset);
12515
+ const stepReasoning = stepRun.reasoning.slice(reasoningOffset);
12511
12516
  const stepResult = {
12512
- ...stepRun,
12517
+ ...stepRunWithoutSteps,
12518
+ text: stepText,
12519
+ reasoning: stepReasoning,
12513
12520
  stepType: stepRun.steps.length === 0 ? "initial" : "tool-result",
12514
- reasoningText: stepRun.reasoning.join(""),
12521
+ reasoningText: stepReasoning.join(""),
12515
12522
  staticToolCalls: stepRun.toolCalls.filter(
12516
12523
  (part) => part.type === "tool-call" && part.payload?.dynamic === false
12517
12524
  ),
@@ -12537,19 +12544,26 @@ function transformAgent(payload, bufferedSteps) {
12537
12544
  };
12538
12545
  bufferedSteps.set(payload.runId, {
12539
12546
  ...stepRun,
12547
+ sources: [],
12548
+ files: [],
12549
+ toolCalls: [],
12550
+ toolResults: [],
12540
12551
  usage: payload.payload.output.usage,
12541
12552
  warnings: payload.payload.stepResult.warnings || [],
12542
- steps: [...stepRun.steps, stepResult]
12553
+ steps: [...stepRun.steps, stepResult],
12554
+ _textOffset: stepRun.text.length,
12555
+ _reasoningOffset: stepRun.reasoning.length
12543
12556
  });
12544
12557
  hasChanged = true;
12545
12558
  break;
12546
12559
  }
12547
12560
  }
12548
12561
  if (hasChanged) {
12562
+ const { _textOffset: _to, _reasoningOffset: _ro, ...data } = bufferedSteps.get(payload.runId);
12549
12563
  return {
12550
12564
  type: "data-tool-agent",
12551
12565
  id: payload.runId,
12552
- data: bufferedSteps.get(payload.runId)
12566
+ data
12553
12567
  };
12554
12568
  }
12555
12569
  return null;