@mastra/ai-sdk 1.0.5 → 1.1.0
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 +30 -0
- package/dist/index.cjs +15 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -2
- package/dist/index.js.map +1 -1
- package/dist/middleware.d.ts.map +1 -1
- package/dist/network-route.d.ts +4 -4
- package/dist/network-route.d.ts.map +1 -1
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -4643,6 +4643,7 @@ function createProcessorMiddleware(options) {
|
|
|
4643
4643
|
messageList.add(msg, "input");
|
|
4644
4644
|
}
|
|
4645
4645
|
}
|
|
4646
|
+
const originalInputCount = params.prompt.filter((msg) => msg.role !== "system").length;
|
|
4646
4647
|
for (const processor of inputProcessors) {
|
|
4647
4648
|
if (processor.processInput) {
|
|
4648
4649
|
try {
|
|
@@ -4675,7 +4676,14 @@ function createProcessorMiddleware(options) {
|
|
|
4675
4676
|
const newPrompt = messageList.get.all.aiV5.prompt().map(aiV5ModelMessageToV2PromptMessage);
|
|
4676
4677
|
return {
|
|
4677
4678
|
...params,
|
|
4678
|
-
prompt: newPrompt
|
|
4679
|
+
prompt: newPrompt,
|
|
4680
|
+
providerOptions: {
|
|
4681
|
+
...params.providerOptions,
|
|
4682
|
+
mastraProcessors: {
|
|
4683
|
+
...params.providerOptions?.mastraProcessors,
|
|
4684
|
+
originalInputCount
|
|
4685
|
+
}
|
|
4686
|
+
}
|
|
4679
4687
|
};
|
|
4680
4688
|
},
|
|
4681
4689
|
/**
|
|
@@ -4698,11 +4706,16 @@ function createProcessorMiddleware(options) {
|
|
|
4698
4706
|
threadId: memory?.threadId,
|
|
4699
4707
|
resourceId: memory?.resourceId
|
|
4700
4708
|
});
|
|
4709
|
+
const originalInputCount = processorState?.originalInputCount ?? params.prompt.filter((m) => m.role !== "system").length;
|
|
4710
|
+
const nonSystemTotal = params.prompt.filter((m) => m.role !== "system").length;
|
|
4711
|
+
const memoryCount = nonSystemTotal - originalInputCount;
|
|
4712
|
+
let nonSystemIndex = 0;
|
|
4701
4713
|
for (const msg of params.prompt) {
|
|
4702
4714
|
if (msg.role === "system") {
|
|
4703
4715
|
messageList.addSystem(msg.content);
|
|
4704
4716
|
} else {
|
|
4705
|
-
messageList.add(msg, "input");
|
|
4717
|
+
messageList.add(msg, nonSystemIndex < memoryCount ? "memory" : "input");
|
|
4718
|
+
nonSystemIndex++;
|
|
4706
4719
|
}
|
|
4707
4720
|
}
|
|
4708
4721
|
const textContent = result.content.filter((c) => c.type === "text").map((c) => c.text).join("");
|