@openclaw/amazon-bedrock-provider 2026.9.1 → 2026.9.2

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.
@@ -8,7 +8,7 @@ import { NodeHttpHandler } from "@smithy/node-http-handler";
8
8
  import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
9
9
  import { AssistantMessageEventStream, adjustMaxTokensForThinking, buildBaseOptions, calculateCost, clampReasoning, createHttpProxyAgentsForTarget, parseStreamingJson, sanitizeSurrogates, transformMessages } from "openclaw/plugin-sdk/llm";
10
10
  import { canonicalizeBase64 } from "openclaw/plugin-sdk/media-runtime";
11
- import { describeToolResultMediaPlaceholder, finalizeTerminalToolCallArguments, notifyProviderHttpMetadata } from "openclaw/plugin-sdk/provider-transport-runtime";
11
+ import { describeToolResultMediaPlaceholder, failTransportStream, finalizeTerminalToolCallArguments, notifyProviderHttpMetadata } from "openclaw/plugin-sdk/provider-transport-runtime";
12
12
  //#region extensions/amazon-bedrock/stream.runtime.ts
13
13
  /**
14
14
  * Amazon Bedrock Converse streaming runtime. It maps OpenClaw messages/tools,
@@ -75,7 +75,7 @@ const streamBedrock = (model, context, options = {}) => {
75
75
  const pendingToolCallEnds = [];
76
76
  const redactedReasoningChunks = /* @__PURE__ */ new Map();
77
77
  const fable5 = usesClaudeFable5BedrockContract(model);
78
- const refusalBuffer = usesClaudeStreamingRefusalBedrockContract(model) ? createDeferredEventBuffer(stream, () => notifyLlmRequestActivity(options.signal)) : void 0;
78
+ const refusalBuffer = usesClaudeStreamingRefusalBedrockContract(model) ? createDeferredEventBuffer(stream) : void 0;
79
79
  const eventSink = refusalBuffer ?? stream;
80
80
  const config = { profile: options.profile };
81
81
  const configuredRegion = getConfiguredBedrockRegion(options);
@@ -143,29 +143,32 @@ const streamBedrock = (model, context, options = {}) => {
143
143
  });
144
144
  }
145
145
  let sawMessageStop = false;
146
- for await (const item of { [Symbol.asyncIterator]: () => responseIterator }) if (item.messageStart) {
147
- if (item.messageStart.role !== ConversationRole.ASSISTANT) throw new Error("Unexpected assistant message start but got user message start instead");
148
- eventSink.push({
149
- type: "start",
150
- partial: output
151
- });
152
- } else if (item.contentBlockStart) handleContentBlockStart(item.contentBlockStart, blocks, output, eventSink);
153
- else if (item.contentBlockDelta) handleContentBlockDelta(item.contentBlockDelta, blocks, output, eventSink, redactedReasoningChunks);
154
- else if (item.contentBlockStop) handleContentBlockStop(item.contentBlockStop, blocks, output, eventSink, redactedReasoningChunks, pendingToolCallEnds);
155
- else if (item.messageStop) {
156
- sawMessageStop = true;
157
- if (item.messageStop.stopReason === "refusal") applyAnthropicRefusal(output, readBedrockStopDetails(item.messageStop.additionalModelResponseFields), model.provider);
158
- else {
159
- const mappedStop = mapStopReason(item.messageStop.stopReason);
160
- output.stopReason = mappedStop.stopReason;
161
- if (mappedStop.errorMessage) output.errorMessage = mappedStop.errorMessage;
162
- }
163
- } else if (item.metadata) handleMetadata(item.metadata, model, output);
164
- else if (item.internalServerException) throw item.internalServerException;
165
- else if (item.modelStreamErrorException) throw item.modelStreamErrorException;
166
- else if (item.validationException) throw item.validationException;
167
- else if (item.throttlingException) throw item.throttlingException;
168
- else if (item.serviceUnavailableException) throw item.serviceUnavailableException;
146
+ for await (const item of { [Symbol.asyncIterator]: () => responseIterator }) {
147
+ notifyLlmRequestActivity(options.signal);
148
+ if (item.messageStart) {
149
+ if (item.messageStart.role !== ConversationRole.ASSISTANT) throw new Error("Unexpected assistant message start but got user message start instead");
150
+ eventSink.push({
151
+ type: "start",
152
+ partial: output
153
+ });
154
+ } else if (item.contentBlockStart) handleContentBlockStart(item.contentBlockStart, blocks, output, eventSink);
155
+ else if (item.contentBlockDelta) handleContentBlockDelta(item.contentBlockDelta, blocks, output, eventSink, redactedReasoningChunks);
156
+ else if (item.contentBlockStop) handleContentBlockStop(item.contentBlockStop, blocks, output, eventSink, redactedReasoningChunks, pendingToolCallEnds);
157
+ else if (item.messageStop) {
158
+ sawMessageStop = true;
159
+ if (item.messageStop.stopReason === "refusal") applyAnthropicRefusal(output, readBedrockStopDetails(item.messageStop.additionalModelResponseFields), model.provider);
160
+ else {
161
+ const mappedStop = mapStopReason(item.messageStop.stopReason);
162
+ output.stopReason = mappedStop.stopReason;
163
+ if (mappedStop.errorMessage) output.errorMessage = mappedStop.errorMessage;
164
+ }
165
+ } else if (item.metadata) handleMetadata(item.metadata, model, output);
166
+ else if (item.internalServerException) throw item.internalServerException;
167
+ else if (item.modelStreamErrorException) throw item.modelStreamErrorException;
168
+ else if (item.validationException) throw item.validationException;
169
+ else if (item.throttlingException) throw item.throttlingException;
170
+ else if (item.serviceUnavailableException) throw item.serviceUnavailableException;
171
+ }
169
172
  if (!sawMessageStop) throw new Error("Bedrock stream ended before messageStop");
170
173
  if (options.signal?.aborted) throw new Error("Request was aborted");
171
174
  if (output.stopReason === "error" || output.stopReason === "aborted") throw new Error(output.errorMessage ?? "An unknown error occurred");
@@ -179,23 +182,24 @@ const streamBedrock = (model, context, options = {}) => {
179
182
  });
180
183
  stream.end();
181
184
  } catch (error) {
182
- output.content = output.content.filter((block) => block.type !== "toolCall");
183
- for (const block of output.content) {
184
- delete block.index;
185
- delete block.partialJson;
186
- }
187
- if (refusalBuffer) {
188
- refusalBuffer.discard();
189
- output.content = [];
190
- }
191
- output.stopReason = options.signal?.aborted ? "aborted" : "error";
192
- output.errorMessage = formatBedrockError(error);
193
- stream.push({
194
- type: "error",
195
- reason: output.stopReason,
196
- error: output
185
+ failTransportStream({
186
+ stream,
187
+ output,
188
+ signal: options.signal,
189
+ error,
190
+ cleanup: () => {
191
+ output.content = output.content.filter((block) => block.type !== "toolCall");
192
+ for (const block of output.content) {
193
+ delete block.index;
194
+ delete block.partialJson;
195
+ }
196
+ if (refusalBuffer) {
197
+ refusalBuffer.discard();
198
+ output.content = [];
199
+ }
200
+ output.errorMessage = formatBedrockError(error);
201
+ }
197
202
  });
198
- stream.end();
199
203
  } finally {
200
204
  client?.destroy();
201
205
  }
@@ -221,6 +225,7 @@ const BEDROCK_ERROR_PREFIXES = {
221
225
  * extend BedrockRuntimeServiceException. We map the `.name` to a stable
222
226
  * human-readable prefix so downstream consumers (retry logic, context-overflow
223
227
  * detection) can distinguish error categories via simple string matching.
228
+ * The shared transport owner projects errorType, errorCode, and diagnostics.
224
229
  */
225
230
  function formatBedrockError(error) {
226
231
  const message = error instanceof Error ? error.message : JSON.stringify(error);
@@ -86,7 +86,7 @@ const commonParams = {
86
86
  UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
87
87
  };
88
88
 
89
- var version = "3.1115.0";
89
+ var version = "3.1116.0";
90
90
  var packageInfo = {
91
91
  version: version};
92
92
 
@@ -233,7 +233,7 @@ export interface InferenceConfiguration {
233
233
  */
234
234
  export interface ModelConfiguration {
235
235
  /**
236
- * <p>The ID of the model to use for optimization.</p>
236
+ * <p>The model to use for optimization. The value depends on the resource that you use:</p> <ul> <li> <p>If you use a base model, specify the model ID or its ARN. For a list of model IDs, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-cards.html">Models at a glance</a> in the Amazon Bedrock User Guide.</p> </li> <li> <p>If you use a cross-Region (system-defined) inference profile, specify the inference profile ID or its ARN. For a list of inference profile IDs, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference-support.html">Supported Regions and models for inference profiles</a> in the Amazon Bedrock User Guide.</p> </li> <li> <p>If you use an application inference profile, specify its full ARN, including the account ID and Region.</p> </li> </ul>
237
237
  * @public
238
238
  */
239
239
  modelId: string | undefined;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/token-providers",
3
- "version": "3.1116.0",
3
+ "version": "3.1117.0",
4
4
  "description": "A collection of token providers",
5
5
  "keywords": [
6
6
  "aws",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-bedrock",
3
- "version": "3.1116.0",
3
+ "version": "3.1117.0",
4
4
  "description": "AWS SDK for JavaScript Bedrock Client for Node.js, Browser and React Native",
5
5
  "homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-bedrock",
6
6
  "license": "Apache-2.0",
@@ -48,7 +48,7 @@
48
48
  "dependencies": {
49
49
  "@aws-sdk/core": "^3.977.9",
50
50
  "@aws-sdk/credential-provider-node": "^3.972.81",
51
- "@aws-sdk/token-providers": "3.1116.0",
51
+ "@aws-sdk/token-providers": "3.1117.0",
52
52
  "@aws-sdk/types": "^3.974.5",
53
53
  "@smithy/core": "^3.33.3",
54
54
  "@smithy/fetch-http-handler": "^5.7.2",
@@ -90,7 +90,7 @@ const commonParams = {
90
90
  UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
91
91
  };
92
92
 
93
- var version = "3.1115.0";
93
+ var version = "3.1116.0";
94
94
  var packageInfo = {
95
95
  version: version};
96
96
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/token-providers",
3
- "version": "3.1116.0",
3
+ "version": "3.1117.0",
4
4
  "description": "A collection of token providers",
5
5
  "keywords": [
6
6
  "aws",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-bedrock-runtime",
3
- "version": "3.1116.0",
3
+ "version": "3.1117.0",
4
4
  "description": "AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",
5
5
  "homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-bedrock-runtime",
6
6
  "license": "Apache-2.0",
@@ -59,7 +59,7 @@
59
59
  "@aws-sdk/eventstream-handler-node": "^3.972.34",
60
60
  "@aws-sdk/middleware-eventstream": "^3.972.29",
61
61
  "@aws-sdk/middleware-websocket": "^3.972.52",
62
- "@aws-sdk/token-providers": "3.1116.0",
62
+ "@aws-sdk/token-providers": "3.1117.0",
63
63
  "@aws-sdk/types": "^3.974.5",
64
64
  "@smithy/core": "^3.33.3",
65
65
  "@smithy/fetch-http-handler": "^5.7.2",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/amazon-bedrock-provider",
3
- "version": "2026.9.1",
3
+ "version": "2026.9.2",
4
4
  "description": "OpenClaw Amazon Bedrock provider plugin with model discovery, embeddings, and guardrail support.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -8,8 +8,8 @@
8
8
  },
9
9
  "type": "module",
10
10
  "dependencies": {
11
- "@aws-sdk/client-bedrock": "3.1116.0",
12
- "@aws-sdk/client-bedrock-runtime": "3.1116.0",
11
+ "@aws-sdk/client-bedrock": "3.1117.0",
12
+ "@aws-sdk/client-bedrock-runtime": "3.1117.0",
13
13
  "@aws-sdk/credential-provider-node": "3.972.81",
14
14
  "@smithy/node-http-handler": "4.11.3",
15
15
  "@smithy/shared-ini-file-loader": "4.7.2",
@@ -25,10 +25,10 @@
25
25
  "minHostVersion": ">=2026.5.12-beta.1"
26
26
  },
27
27
  "compat": {
28
- "pluginApi": ">=2026.9.1"
28
+ "pluginApi": ">=2026.9.2"
29
29
  },
30
30
  "build": {
31
- "openclawVersion": "2026.9.1",
31
+ "openclawVersion": "2026.9.2",
32
32
  "bundledDist": false
33
33
  },
34
34
  "release": {
@@ -45,7 +45,7 @@
45
45
  "README.md"
46
46
  ],
47
47
  "peerDependencies": {
48
- "openclaw": ">=2026.9.1"
48
+ "openclaw": ">=2026.9.2"
49
49
  },
50
50
  "peerDependenciesMeta": {
51
51
  "openclaw": {