@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 +18 -0
- package/dist/index.cjs +18 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -4
- package/dist/index.js.map +1 -1
- package/dist/transformers.d.ts.map +1 -1
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -12487,10 +12487,17 @@ function transformAgent(payload, bufferedSteps) {
|
|
|
12487
12487
|
break;
|
|
12488
12488
|
case "step-finish": {
|
|
12489
12489
|
const stepRun = ensureAgentRunState(bufferedSteps, payload.runId);
|
|
12490
|
+
const { steps: _steps, _textOffset, _reasoningOffset, ...stepRunWithoutSteps } = stepRun;
|
|
12491
|
+
const textOffset = _textOffset || 0;
|
|
12492
|
+
const reasoningOffset = _reasoningOffset || 0;
|
|
12493
|
+
const stepText = stepRun.text.slice(textOffset);
|
|
12494
|
+
const stepReasoning = stepRun.reasoning.slice(reasoningOffset);
|
|
12490
12495
|
const stepResult = {
|
|
12491
|
-
...
|
|
12496
|
+
...stepRunWithoutSteps,
|
|
12497
|
+
text: stepText,
|
|
12498
|
+
reasoning: stepReasoning,
|
|
12492
12499
|
stepType: stepRun.steps.length === 0 ? "initial" : "tool-result",
|
|
12493
|
-
reasoningText:
|
|
12500
|
+
reasoningText: stepReasoning.join(""),
|
|
12494
12501
|
staticToolCalls: stepRun.toolCalls.filter(
|
|
12495
12502
|
(part) => part.type === "tool-call" && part.payload?.dynamic === false
|
|
12496
12503
|
),
|
|
@@ -12516,19 +12523,26 @@ function transformAgent(payload, bufferedSteps) {
|
|
|
12516
12523
|
};
|
|
12517
12524
|
bufferedSteps.set(payload.runId, {
|
|
12518
12525
|
...stepRun,
|
|
12526
|
+
sources: [],
|
|
12527
|
+
files: [],
|
|
12528
|
+
toolCalls: [],
|
|
12529
|
+
toolResults: [],
|
|
12519
12530
|
usage: payload.payload.output.usage,
|
|
12520
12531
|
warnings: payload.payload.stepResult.warnings || [],
|
|
12521
|
-
steps: [...stepRun.steps, stepResult]
|
|
12532
|
+
steps: [...stepRun.steps, stepResult],
|
|
12533
|
+
_textOffset: stepRun.text.length,
|
|
12534
|
+
_reasoningOffset: stepRun.reasoning.length
|
|
12522
12535
|
});
|
|
12523
12536
|
hasChanged = true;
|
|
12524
12537
|
break;
|
|
12525
12538
|
}
|
|
12526
12539
|
}
|
|
12527
12540
|
if (hasChanged) {
|
|
12541
|
+
const { _textOffset: _to, _reasoningOffset: _ro, ...data } = bufferedSteps.get(payload.runId);
|
|
12528
12542
|
return {
|
|
12529
12543
|
type: "data-tool-agent",
|
|
12530
12544
|
id: payload.runId,
|
|
12531
|
-
data
|
|
12545
|
+
data
|
|
12532
12546
|
};
|
|
12533
12547
|
}
|
|
12534
12548
|
return null;
|