ai 6.0.286 → 6.0.288

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/dist/index.mjs CHANGED
@@ -1224,7 +1224,7 @@ import {
1224
1224
  } from "@ai-sdk/provider-utils";
1225
1225
 
1226
1226
  // src/version.ts
1227
- var VERSION = true ? "6.0.286" : "0.0.0-test";
1227
+ var VERSION = true ? "6.0.288" : "0.0.0-test";
1228
1228
 
1229
1229
  // src/util/download/download.ts
1230
1230
  var download = async ({
@@ -9476,7 +9476,7 @@ async function convertToModelMessages(messages, options) {
9476
9476
  if (message.parts != null) {
9477
9477
  let block = [];
9478
9478
  async function processBlock() {
9479
- var _a23, _b, _c, _d, _e, _f, _g, _h;
9479
+ var _a23, _b, _c, _d, _e, _f, _g, _h, _i;
9480
9480
  if (block.length === 0) {
9481
9481
  return;
9482
9482
  }
@@ -9505,13 +9505,14 @@ async function convertToModelMessages(messages, options) {
9505
9505
  } else if (isToolUIPart(part)) {
9506
9506
  const toolName = getToolName(part);
9507
9507
  if (part.state !== "input-streaming") {
9508
+ const callProviderMetadata = (_a23 = part.callProviderMetadata) != null ? _a23 : part.state === "output-error" ? part.resultProviderMetadata : void 0;
9508
9509
  content.push({
9509
9510
  type: "tool-call",
9510
9511
  toolCallId: part.toolCallId,
9511
9512
  toolName,
9512
- input: part.state === "output-error" ? (_a23 = part.input) != null ? _a23 : "rawInput" in part ? part.rawInput : void 0 : part.input,
9513
+ input: part.state === "output-error" ? (_b = part.input) != null ? _b : "rawInput" in part ? part.rawInput : void 0 : part.input,
9513
9514
  providerExecuted: part.providerExecuted,
9514
- ...part.callProviderMetadata != null ? { providerOptions: part.callProviderMetadata } : {}
9515
+ ...callProviderMetadata != null ? { providerOptions: callProviderMetadata } : {}
9515
9516
  });
9516
9517
  if (part.approval != null) {
9517
9518
  content.push({
@@ -9522,7 +9523,7 @@ async function convertToModelMessages(messages, options) {
9522
9523
  });
9523
9524
  }
9524
9525
  if (part.providerExecuted === true && part.state !== "approval-responded" && (part.state === "output-available" || part.state === "output-error")) {
9525
- const resultProviderMetadata = (_b = part.resultProviderMetadata) != null ? _b : part.callProviderMetadata;
9526
+ const resultProviderMetadata = (_c = part.resultProviderMetadata) != null ? _c : part.callProviderMetadata;
9526
9527
  content.push({
9527
9528
  type: "tool-result",
9528
9529
  toolCallId: part.toolCallId,
@@ -9531,7 +9532,7 @@ async function convertToModelMessages(messages, options) {
9531
9532
  toolCallId: part.toolCallId,
9532
9533
  input: part.input,
9533
9534
  output: part.state === "output-error" ? part.errorText : part.output,
9534
- tool: (_c = options == null ? void 0 : options.tools) == null ? void 0 : _c[toolName],
9535
+ tool: (_d = options == null ? void 0 : options.tools) == null ? void 0 : _d[toolName],
9535
9536
  errorMode: part.state === "output-error" ? "json" : "none"
9536
9537
  }),
9537
9538
  ...resultProviderMetadata != null ? { providerOptions: resultProviderMetadata } : {}
@@ -9539,7 +9540,7 @@ async function convertToModelMessages(messages, options) {
9539
9540
  }
9540
9541
  }
9541
9542
  } else if (isDataUIPart(part)) {
9542
- const dataPart = (_d = options == null ? void 0 : options.convertDataPart) == null ? void 0 : _d.call(
9543
+ const dataPart = (_e = options == null ? void 0 : options.convertDataPart) == null ? void 0 : _e.call(
9543
9544
  options,
9544
9545
  part
9545
9546
  );
@@ -9567,7 +9568,7 @@ async function convertToModelMessages(messages, options) {
9567
9568
  {
9568
9569
  const content2 = [];
9569
9570
  for (const toolPart of toolParts) {
9570
- if (((_e = toolPart.approval) == null ? void 0 : _e.approved) != null) {
9571
+ if (((_f = toolPart.approval) == null ? void 0 : _f.approved) != null) {
9571
9572
  content2.push({
9572
9573
  type: "tool-approval-response",
9573
9574
  approvalId: toolPart.approval.id,
@@ -9587,7 +9588,7 @@ async function convertToModelMessages(messages, options) {
9587
9588
  toolName: getToolName(toolPart),
9588
9589
  output: {
9589
9590
  type: "error-text",
9590
- value: (_g = (_f = toolPart.approval) == null ? void 0 : _f.reason) != null ? _g : "Tool call execution denied."
9591
+ value: (_h = (_g = toolPart.approval) == null ? void 0 : _g.reason) != null ? _h : "Tool call execution denied."
9591
9592
  },
9592
9593
  ...toolPart.callProviderMetadata != null ? { providerOptions: toolPart.callProviderMetadata } : {}
9593
9594
  });
@@ -9604,7 +9605,7 @@ async function convertToModelMessages(messages, options) {
9604
9605
  toolCallId: toolPart.toolCallId,
9605
9606
  input: toolPart.input,
9606
9607
  output: toolPart.state === "output-error" ? toolPart.errorText : toolPart.output,
9607
- tool: (_h = options == null ? void 0 : options.tools) == null ? void 0 : _h[toolName],
9608
+ tool: (_i = options == null ? void 0 : options.tools) == null ? void 0 : _i[toolName],
9608
9609
  errorMode: toolPart.state === "output-error" ? "text" : "none"
9609
9610
  }),
9610
9611
  ...toolPart.callProviderMetadata != null ? { providerOptions: toolPart.callProviderMetadata } : {}