@ai-sdk/amazon-bedrock 3.0.117 → 3.0.118

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
@@ -8,7 +8,7 @@ import {
8
8
  } from "@ai-sdk/provider-utils";
9
9
 
10
10
  // src/version.ts
11
- var VERSION = true ? "3.0.117" : "0.0.0-test";
11
+ var VERSION = true ? "3.0.118" : "0.0.0-test";
12
12
 
13
13
  // src/bedrock-provider.ts
14
14
  import { anthropicTools as anthropicTools2 } from "@ai-sdk/anthropic/internal";
@@ -359,7 +359,8 @@ import { convertToBase64, parseProviderOptions } from "@ai-sdk/provider-utils";
359
359
  import { z as z3 } from "zod/v4";
360
360
  var bedrockReasoningMetadataSchema = z3.object({
361
361
  signature: z3.string().optional(),
362
- redactedData: z3.string().optional()
362
+ redactedData: z3.string().optional(),
363
+ redactedContent: z3.string().optional()
363
364
  });
364
365
 
365
366
  // src/convert-to-bedrock-chat-messages.ts
@@ -588,6 +589,12 @@ async function convertToBedrockChatMessages(prompt) {
588
589
  }
589
590
  }
590
591
  });
592
+ } else if (reasoningMetadata.redactedContent != null) {
593
+ bedrockContent.push({
594
+ reasoningContent: {
595
+ redactedContent: reasoningMetadata.redactedContent
596
+ }
597
+ });
591
598
  } else if (reasoningMetadata.redactedData != null) {
592
599
  bedrockContent.push({
593
600
  reasoningContent: {
@@ -1049,6 +1056,16 @@ var BedrockChatLanguageModel = class {
1049
1056
  }
1050
1057
  }
1051
1058
  });
1059
+ } else if ("redactedContent" in part.reasoningContent) {
1060
+ content.push({
1061
+ type: "reasoning",
1062
+ text: "",
1063
+ providerMetadata: {
1064
+ bedrock: {
1065
+ redactedContent: part.reasoningContent.redactedContent
1066
+ }
1067
+ }
1068
+ });
1052
1069
  }
1053
1070
  }
1054
1071
  if (part.toolUse) {
@@ -1138,7 +1155,7 @@ var BedrockChatLanguageModel = class {
1138
1155
  controller.enqueue({ type: "stream-start", warnings });
1139
1156
  },
1140
1157
  transform(chunk, controller) {
1141
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
1158
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
1142
1159
  function enqueueError(bedrockError) {
1143
1160
  finishReason = "error";
1144
1161
  controller.enqueue({ type: "error", error: bedrockError });
@@ -1226,7 +1243,14 @@ var BedrockChatLanguageModel = class {
1226
1243
  if (contentBlock.type === "reasoning") {
1227
1244
  controller.enqueue({
1228
1245
  type: "reasoning-end",
1229
- id: String(blockIndex)
1246
+ id: String(blockIndex),
1247
+ ...contentBlock.redactedContent != null ? {
1248
+ providerMetadata: {
1249
+ bedrock: {
1250
+ redactedContent: contentBlock.redactedContent
1251
+ }
1252
+ }
1253
+ } : {}
1230
1254
  });
1231
1255
  } else if (contentBlock.type === "text") {
1232
1256
  controller.enqueue({
@@ -1317,10 +1341,22 @@ var BedrockChatLanguageModel = class {
1317
1341
  }
1318
1342
  }
1319
1343
  });
1344
+ } else if ("redactedContent" in reasoningContent && reasoningContent.redactedContent) {
1345
+ if (contentBlocks[blockIndex] == null) {
1346
+ contentBlocks[blockIndex] = { type: "reasoning" };
1347
+ controller.enqueue({
1348
+ type: "reasoning-start",
1349
+ id: String(blockIndex)
1350
+ });
1351
+ }
1352
+ const contentBlock = contentBlocks[blockIndex];
1353
+ if (contentBlock.type === "reasoning") {
1354
+ contentBlock.redactedContent = ((_s = contentBlock.redactedContent) != null ? _s : "") + reasoningContent.redactedContent;
1355
+ }
1320
1356
  }
1321
1357
  }
1322
1358
  const contentBlockStart = value.contentBlockStart;
1323
- if (((_s = contentBlockStart == null ? void 0 : contentBlockStart.start) == null ? void 0 : _s.toolUse) != null) {
1359
+ if (((_t = contentBlockStart == null ? void 0 : contentBlockStart.start) == null ? void 0 : _t.toolUse) != null) {
1324
1360
  const toolUse = contentBlockStart.start.toolUse;
1325
1361
  const blockIndex = contentBlockStart.contentBlockIndex;
1326
1362
  const isJsonResponseTool = usesJsonResponseTool && toolUse.name === "json";
@@ -1344,7 +1380,7 @@ var BedrockChatLanguageModel = class {
1344
1380
  const blockIndex = contentBlockDelta.contentBlockIndex;
1345
1381
  const contentBlock = contentBlocks[blockIndex];
1346
1382
  if ((contentBlock == null ? void 0 : contentBlock.type) === "tool-call") {
1347
- const delta = (_t = contentBlockDelta.delta.toolUse.input) != null ? _t : "";
1383
+ const delta = (_u = contentBlockDelta.delta.toolUse.input) != null ? _u : "";
1348
1384
  if (!contentBlock.isJsonResponseTool) {
1349
1385
  controller.enqueue({
1350
1386
  type: "tool-input-delta",
@@ -1435,6 +1471,13 @@ var BedrockResponseSchema = z4.object({
1435
1471
  }),
1436
1472
  z4.object({
1437
1473
  redactedReasoning: BedrockRedactedReasoningSchema
1474
+ }),
1475
+ // `redactedContent` is a member of the documented
1476
+ // ReasoningContentBlock union. OpenAI models on Bedrock
1477
+ // (e.g. `us.openai.gpt-5.6-luna`) return their encrypted
1478
+ // reasoning in this shape.
1479
+ z4.object({
1480
+ redactedContent: z4.string()
1438
1481
  })
1439
1482
  ]).nullish()
1440
1483
  })
@@ -1469,6 +1512,12 @@ var BedrockStreamSchema = z4.object({
1469
1512
  }),
1470
1513
  z4.object({
1471
1514
  reasoningContent: z4.object({ data: z4.string() })
1515
+ }),
1516
+ // `redactedContent` is a member of the documented
1517
+ // ReasoningContentBlockDelta union. OpenAI models on Bedrock stream
1518
+ // their encrypted reasoning in this shape.
1519
+ z4.object({
1520
+ reasoningContent: z4.object({ redactedContent: z4.string() })
1472
1521
  })
1473
1522
  ]).nullish()
1474
1523
  }).nullish(),