@openclaw/amazon-bedrock-provider 2026.7.2-beta.2 → 2026.7.2-beta.3
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/discovery.js +0 -2
- package/dist/stream.runtime.js +26 -8
- package/npm-shrinkwrap.json +2 -2
- package/package.json +4 -4
package/dist/discovery.js
CHANGED
|
@@ -36,9 +36,7 @@ const KNOWN_CONTEXT_WINDOWS = {
|
|
|
36
36
|
"anthropic.claude-opus-4-8": 1e6,
|
|
37
37
|
"anthropic.claude-opus-4-7": 1e6,
|
|
38
38
|
"anthropic.claude-opus-4-6-v1": 1e6,
|
|
39
|
-
"anthropic.claude-opus-4-6-v1:0": 1e6,
|
|
40
39
|
"anthropic.claude-sonnet-4-6": 1e6,
|
|
41
|
-
"anthropic.claude-sonnet-4-6-v1:0": 1e6,
|
|
42
40
|
"anthropic.claude-sonnet-4-5-20250929-v1:0": 2e5,
|
|
43
41
|
"anthropic.claude-sonnet-4-20250514-v1:0": 2e5,
|
|
44
42
|
"anthropic.claude-opus-4-5-20251101-v1:0": 2e5,
|
package/dist/stream.runtime.js
CHANGED
|
@@ -72,14 +72,15 @@ const streamBedrock = (model, context, options = {}) => {
|
|
|
72
72
|
const eventSink = refusalBuffer ?? stream;
|
|
73
73
|
const config = { profile: options.profile };
|
|
74
74
|
const configuredRegion = getConfiguredBedrockRegion(options);
|
|
75
|
+
const requestRegion = options.region || getBedrockModelArnRegion(model.id) || configuredRegion;
|
|
75
76
|
const hasConfiguredProfile = hasConfiguredBedrockProfile(options);
|
|
76
77
|
const endpointRegion = getStandardBedrockEndpointRegion(model.baseUrl);
|
|
77
|
-
const useExplicitEndpoint = shouldUseExplicitBedrockEndpoint(model.baseUrl,
|
|
78
|
+
const useExplicitEndpoint = shouldUseExplicitBedrockEndpoint(model.baseUrl, requestRegion, hasConfiguredProfile);
|
|
78
79
|
if (useExplicitEndpoint) config.endpoint = model.baseUrl;
|
|
79
80
|
const bearerToken = options.bearerToken || process.env.AWS_BEARER_TOKEN_BEDROCK || void 0;
|
|
80
81
|
const useBearerToken = bearerToken !== void 0 && process.env.AWS_BEDROCK_SKIP_AUTH !== "1";
|
|
81
82
|
if (typeof process !== "undefined" && (process.versions?.node || process.versions?.bun)) {
|
|
82
|
-
if (
|
|
83
|
+
if (requestRegion) config.region = requestRegion;
|
|
83
84
|
else if (endpointRegion && useExplicitEndpoint) config.region = endpointRegion;
|
|
84
85
|
else if (!hasConfiguredProfile) config.region = "us-east-1";
|
|
85
86
|
if (process.env.AWS_BEDROCK_SKIP_AUTH === "1") config.credentials = {
|
|
@@ -89,7 +90,7 @@ const streamBedrock = (model, context, options = {}) => {
|
|
|
89
90
|
const proxyAgents = createHttpProxyAgentsForTarget(model.baseUrl);
|
|
90
91
|
if (proxyAgents) config.requestHandler = new NodeHttpHandler(proxyAgents);
|
|
91
92
|
else if (process.env.AWS_BEDROCK_FORCE_HTTP1 === "1") config.requestHandler = new NodeHttpHandler();
|
|
92
|
-
} else config.region =
|
|
93
|
+
} else config.region = requestRegion || (endpointRegion && useExplicitEndpoint ? endpointRegion : void 0) || "us-east-1";
|
|
93
94
|
if (useBearerToken) {
|
|
94
95
|
config.token = { token: bearerToken };
|
|
95
96
|
config.authSchemePreference = ["httpBearerAuth"];
|
|
@@ -138,7 +139,11 @@ const streamBedrock = (model, context, options = {}) => {
|
|
|
138
139
|
else if (item.messageStop) {
|
|
139
140
|
sawMessageStop = true;
|
|
140
141
|
if (item.messageStop.stopReason === "refusal") applyAnthropicRefusal(output, readBedrockStopDetails(item.messageStop.additionalModelResponseFields), model.provider);
|
|
141
|
-
else
|
|
142
|
+
else {
|
|
143
|
+
const mappedStop = mapStopReason(item.messageStop.stopReason);
|
|
144
|
+
output.stopReason = mappedStop.stopReason;
|
|
145
|
+
if (mappedStop.errorMessage) output.errorMessage = mappedStop.errorMessage;
|
|
146
|
+
}
|
|
142
147
|
} else if (item.metadata) handleMetadata(item.metadata, model, output);
|
|
143
148
|
else if (item.internalServerException) throw item.internalServerException;
|
|
144
149
|
else if (item.modelStreamErrorException) throw item.modelStreamErrorException;
|
|
@@ -609,13 +614,26 @@ function convertToolConfig(tools, toolChoice) {
|
|
|
609
614
|
function mapStopReason(reason) {
|
|
610
615
|
switch (reason) {
|
|
611
616
|
case StopReason.END_TURN:
|
|
612
|
-
case StopReason.STOP_SEQUENCE: return "stop";
|
|
617
|
+
case StopReason.STOP_SEQUENCE: return { stopReason: "stop" };
|
|
613
618
|
case StopReason.MAX_TOKENS:
|
|
614
|
-
case StopReason.MODEL_CONTEXT_WINDOW_EXCEEDED: return "length";
|
|
615
|
-
case StopReason.TOOL_USE: return "toolUse";
|
|
616
|
-
|
|
619
|
+
case StopReason.MODEL_CONTEXT_WINDOW_EXCEEDED: return { stopReason: "length" };
|
|
620
|
+
case StopReason.TOOL_USE: return { stopReason: "toolUse" };
|
|
621
|
+
case StopReason.CONTENT_FILTERED:
|
|
622
|
+
case StopReason.GUARDRAIL_INTERVENED:
|
|
623
|
+
case StopReason.MALFORMED_MODEL_OUTPUT:
|
|
624
|
+
case StopReason.MALFORMED_TOOL_USE: return {
|
|
625
|
+
stopReason: "error",
|
|
626
|
+
errorMessage: reason
|
|
627
|
+
};
|
|
628
|
+
default: return reason ? {
|
|
629
|
+
stopReason: "error",
|
|
630
|
+
errorMessage: reason
|
|
631
|
+
} : { stopReason: "error" };
|
|
617
632
|
}
|
|
618
633
|
}
|
|
634
|
+
function getBedrockModelArnRegion(modelId) {
|
|
635
|
+
return /^arn:aws(?:-[a-z0-9-]+)?:bedrock:([a-z0-9-]+):/.exec(modelId)?.[1];
|
|
636
|
+
}
|
|
619
637
|
function getConfiguredBedrockRegion(options) {
|
|
620
638
|
if (typeof process === "undefined") return options.region;
|
|
621
639
|
return options.region || process.env.AWS_REGION || process.env.AWS_DEFAULT_REGION || void 0;
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/amazon-bedrock-provider",
|
|
3
|
-
"version": "2026.7.2-beta.
|
|
3
|
+
"version": "2026.7.2-beta.3",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@openclaw/amazon-bedrock-provider",
|
|
9
|
-
"version": "2026.7.2-beta.
|
|
9
|
+
"version": "2026.7.2-beta.3",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@aws-sdk/client-bedrock": "3.1078.0",
|
|
12
12
|
"@aws-sdk/client-bedrock-runtime": "3.1078.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/amazon-bedrock-provider",
|
|
3
|
-
"version": "2026.7.2-beta.
|
|
3
|
+
"version": "2026.7.2-beta.3",
|
|
4
4
|
"description": "OpenClaw Amazon Bedrock provider plugin with model discovery, embeddings, and guardrail support.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"minHostVersion": ">=2026.5.12-beta.1"
|
|
26
26
|
},
|
|
27
27
|
"compat": {
|
|
28
|
-
"pluginApi": ">=2026.7.2-beta.
|
|
28
|
+
"pluginApi": ">=2026.7.2-beta.3"
|
|
29
29
|
},
|
|
30
30
|
"build": {
|
|
31
|
-
"openclawVersion": "2026.7.2-beta.
|
|
31
|
+
"openclawVersion": "2026.7.2-beta.3",
|
|
32
32
|
"bundledDist": false
|
|
33
33
|
},
|
|
34
34
|
"release": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"README.md"
|
|
47
47
|
],
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"openclaw": ">=2026.7.2-beta.
|
|
49
|
+
"openclaw": ">=2026.7.2-beta.3"
|
|
50
50
|
},
|
|
51
51
|
"peerDependenciesMeta": {
|
|
52
52
|
"openclaw": {
|