@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 CHANGED
@@ -1,5 +1,35 @@
1
1
  # @mastra/ai-sdk
2
2
 
3
+ ## 1.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Update peer dependencies to match core package version bump (1.5.0) ([#13323](https://github.com/mastra-ai/mastra/pull/13323))
8
+
9
+ ### Patch Changes
10
+
11
+ - Fixed withMastra() re-persisting prior message history on later turns. When using generateText() multiple times on the same thread, previously stored messages were duplicated in storage. (fixes #13438) ([#13459](https://github.com/mastra-ai/mastra/pull/13459))
12
+
13
+ - Suppress completion feedback display when suppressFeedback is set ([#13323](https://github.com/mastra-ai/mastra/pull/13323))
14
+
15
+ - Updated dependencies [[`df170fd`](https://github.com/mastra-ai/mastra/commit/df170fd139b55f845bfd2de8488b16435bd3d0da), [`ae55343`](https://github.com/mastra-ai/mastra/commit/ae5534397fc006fd6eef3e4f80c235bcdc9289ef), [`c290cec`](https://github.com/mastra-ai/mastra/commit/c290cec5bf9107225de42942b56b487107aa9dce), [`f03e794`](https://github.com/mastra-ai/mastra/commit/f03e794630f812b56e95aad54f7b1993dc003add), [`aa4a5ae`](https://github.com/mastra-ai/mastra/commit/aa4a5aedb80d8d6837bab8cbb2e301215d1ba3e9), [`de3f584`](https://github.com/mastra-ai/mastra/commit/de3f58408752a8d80a295275c7f23fc306cf7f4f), [`d3fb010`](https://github.com/mastra-ai/mastra/commit/d3fb010c98f575f1c0614452667396e2653815f6), [`702ee1c`](https://github.com/mastra-ai/mastra/commit/702ee1c41be67cc532b4dbe89bcb62143508f6f0), [`f495051`](https://github.com/mastra-ai/mastra/commit/f495051eb6496a720f637fc85b6d69941c12554c), [`e622f1d`](https://github.com/mastra-ai/mastra/commit/e622f1d3ab346a8e6aca6d1fe2eac99bd961e50b), [`861f111`](https://github.com/mastra-ai/mastra/commit/861f11189211b20ddb70d8df81a6b901fc78d11e), [`00f43e8`](https://github.com/mastra-ai/mastra/commit/00f43e8e97a80c82b27d5bd30494f10a715a1df9), [`1b6f651`](https://github.com/mastra-ai/mastra/commit/1b6f65127d4a0d6c38d0a1055cb84527db529d6b), [`96a1702`](https://github.com/mastra-ai/mastra/commit/96a1702ce362c50dda20c8b4a228b4ad1a36a17a), [`cb9f921`](https://github.com/mastra-ai/mastra/commit/cb9f921320913975657abb1404855d8c510f7ac5), [`114e7c1`](https://github.com/mastra-ai/mastra/commit/114e7c146ac682925f0fb37376c1be70e5d6e6e5), [`1b6f651`](https://github.com/mastra-ai/mastra/commit/1b6f65127d4a0d6c38d0a1055cb84527db529d6b), [`72df4a8`](https://github.com/mastra-ai/mastra/commit/72df4a8f9bf1a20cfd3d9006a4fdb597ad56d10a)]:
16
+ - @mastra/core@1.8.0
17
+
18
+ ## 1.1.0-alpha.0
19
+
20
+ ### Minor Changes
21
+
22
+ - Update peer dependencies to match core package version bump (1.5.0) ([#13323](https://github.com/mastra-ai/mastra/pull/13323))
23
+
24
+ ### Patch Changes
25
+
26
+ - Fixed withMastra() re-persisting prior message history on later turns. When using generateText() multiple times on the same thread, previously stored messages were duplicated in storage. (fixes #13438) ([#13459](https://github.com/mastra-ai/mastra/pull/13459))
27
+
28
+ - Suppress completion feedback display when suppressFeedback is set ([#13323](https://github.com/mastra-ai/mastra/pull/13323))
29
+
30
+ - Updated dependencies [[`df170fd`](https://github.com/mastra-ai/mastra/commit/df170fd139b55f845bfd2de8488b16435bd3d0da), [`ae55343`](https://github.com/mastra-ai/mastra/commit/ae5534397fc006fd6eef3e4f80c235bcdc9289ef), [`c290cec`](https://github.com/mastra-ai/mastra/commit/c290cec5bf9107225de42942b56b487107aa9dce), [`f03e794`](https://github.com/mastra-ai/mastra/commit/f03e794630f812b56e95aad54f7b1993dc003add), [`aa4a5ae`](https://github.com/mastra-ai/mastra/commit/aa4a5aedb80d8d6837bab8cbb2e301215d1ba3e9), [`de3f584`](https://github.com/mastra-ai/mastra/commit/de3f58408752a8d80a295275c7f23fc306cf7f4f), [`d3fb010`](https://github.com/mastra-ai/mastra/commit/d3fb010c98f575f1c0614452667396e2653815f6), [`702ee1c`](https://github.com/mastra-ai/mastra/commit/702ee1c41be67cc532b4dbe89bcb62143508f6f0), [`f495051`](https://github.com/mastra-ai/mastra/commit/f495051eb6496a720f637fc85b6d69941c12554c), [`e622f1d`](https://github.com/mastra-ai/mastra/commit/e622f1d3ab346a8e6aca6d1fe2eac99bd961e50b), [`861f111`](https://github.com/mastra-ai/mastra/commit/861f11189211b20ddb70d8df81a6b901fc78d11e), [`00f43e8`](https://github.com/mastra-ai/mastra/commit/00f43e8e97a80c82b27d5bd30494f10a715a1df9), [`1b6f651`](https://github.com/mastra-ai/mastra/commit/1b6f65127d4a0d6c38d0a1055cb84527db529d6b), [`96a1702`](https://github.com/mastra-ai/mastra/commit/96a1702ce362c50dda20c8b4a228b4ad1a36a17a), [`cb9f921`](https://github.com/mastra-ai/mastra/commit/cb9f921320913975657abb1404855d8c510f7ac5), [`114e7c1`](https://github.com/mastra-ai/mastra/commit/114e7c146ac682925f0fb37376c1be70e5d6e6e5), [`1b6f651`](https://github.com/mastra-ai/mastra/commit/1b6f65127d4a0d6c38d0a1055cb84527db529d6b), [`72df4a8`](https://github.com/mastra-ai/mastra/commit/72df4a8f9bf1a20cfd3d9006a4fdb597ad56d10a)]:
31
+ - @mastra/core@1.8.0-alpha.0
32
+
3
33
  ## 1.0.5
4
34
 
5
35
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -4664,6 +4664,7 @@ function createProcessorMiddleware(options) {
4664
4664
  messageList.add(msg, "input");
4665
4665
  }
4666
4666
  }
4667
+ const originalInputCount = params.prompt.filter((msg) => msg.role !== "system").length;
4667
4668
  for (const processor of inputProcessors) {
4668
4669
  if (processor.processInput) {
4669
4670
  try {
@@ -4696,7 +4697,14 @@ function createProcessorMiddleware(options) {
4696
4697
  const newPrompt = messageList.get.all.aiV5.prompt().map(agent.aiV5ModelMessageToV2PromptMessage);
4697
4698
  return {
4698
4699
  ...params,
4699
- prompt: newPrompt
4700
+ prompt: newPrompt,
4701
+ providerOptions: {
4702
+ ...params.providerOptions,
4703
+ mastraProcessors: {
4704
+ ...params.providerOptions?.mastraProcessors,
4705
+ originalInputCount
4706
+ }
4707
+ }
4700
4708
  };
4701
4709
  },
4702
4710
  /**
@@ -4719,11 +4727,16 @@ function createProcessorMiddleware(options) {
4719
4727
  threadId: memory?.threadId,
4720
4728
  resourceId: memory?.resourceId
4721
4729
  });
4730
+ const originalInputCount = processorState?.originalInputCount ?? params.prompt.filter((m) => m.role !== "system").length;
4731
+ const nonSystemTotal = params.prompt.filter((m) => m.role !== "system").length;
4732
+ const memoryCount = nonSystemTotal - originalInputCount;
4733
+ let nonSystemIndex = 0;
4722
4734
  for (const msg of params.prompt) {
4723
4735
  if (msg.role === "system") {
4724
4736
  messageList.addSystem(msg.content);
4725
4737
  } else {
4726
- messageList.add(msg, "input");
4738
+ messageList.add(msg, nonSystemIndex < memoryCount ? "memory" : "input");
4739
+ nonSystemIndex++;
4727
4740
  }
4728
4741
  }
4729
4742
  const textContent = result.content.filter((c) => c.type === "text").map((c) => c.text).join("");