ai 5.0.101 → 5.0.103

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,18 @@
1
1
  # ai
2
2
 
3
+ ## 5.0.103
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [e609736]
8
+ - @ai-sdk/gateway@2.0.16
9
+
10
+ ## 5.0.102
11
+
12
+ ### Patch Changes
13
+
14
+ - 83b2c4b: fix(ai): prune messages properly when toolCalls set to 'before-last-message'
15
+
3
16
  ## 5.0.101
4
17
 
5
18
  ### Patch Changes
package/dist/index.js CHANGED
@@ -777,7 +777,7 @@ function detectMediaType({
777
777
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
778
778
 
779
779
  // src/version.ts
780
- var VERSION = true ? "5.0.101" : "0.0.0-test";
780
+ var VERSION = true ? "5.0.103" : "0.0.0-test";
781
781
 
782
782
  // src/util/download/download.ts
783
783
  var download = async ({ url }) => {
@@ -8145,7 +8145,7 @@ function pruneMessages({
8145
8145
  const keptToolCallIds = /* @__PURE__ */ new Set();
8146
8146
  const keptApprovalIds = /* @__PURE__ */ new Set();
8147
8147
  if (keepLastMessagesCount != null) {
8148
- for (const message of messages.slice(0, -keepLastMessagesCount)) {
8148
+ for (const message of messages.slice(-keepLastMessagesCount)) {
8149
8149
  if ((message.role === "assistant" || message.role === "tool") && typeof message.content !== "string") {
8150
8150
  for (const part of message.content) {
8151
8151
  if (part.type === "tool-call" || part.type === "tool-result") {