@openclaw/amazon-bedrock-provider 2026.5.28-beta.1 → 2026.5.28-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 +20 -3
- package/dist/register.sync.runtime.js +12 -7
- package/dist/stream.runtime.js +6 -3
- package/dist/thinking-policy.js +16 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +4 -4
package/dist/discovery.js
CHANGED
|
@@ -27,6 +27,7 @@ const DEFAULT_MAX_TOKENS = 4096;
|
|
|
27
27
|
*/
|
|
28
28
|
const KNOWN_CONTEXT_WINDOWS = {
|
|
29
29
|
"anthropic.claude-3-7-sonnet-20250219-v1:0": 2e5,
|
|
30
|
+
"anthropic.claude-opus-4-8": 1e6,
|
|
30
31
|
"anthropic.claude-opus-4-7": 1e6,
|
|
31
32
|
"anthropic.claude-opus-4-6-v1": 1e6,
|
|
32
33
|
"anthropic.claude-opus-4-6-v1:0": 1e6,
|
|
@@ -88,11 +89,22 @@ const KNOWN_CONTEXT_WINDOWS = {
|
|
|
88
89
|
function resolveKnownContextWindow(modelId) {
|
|
89
90
|
const candidates = [modelId, modelId.replace(/^(?:us|eu|ap|apac|au|jp|global)\./, "")];
|
|
90
91
|
for (const candidate of candidates) {
|
|
92
|
+
if (/(?:^|[/.:])anthropic\.claude-opus-4[.-]8(?:$|[-.:/])/i.test(candidate)) return 1e6;
|
|
91
93
|
if (KNOWN_CONTEXT_WINDOWS[candidate] !== void 0) return KNOWN_CONTEXT_WINDOWS[candidate];
|
|
92
94
|
const withoutVersionSuffix = candidate.replace(/:0$/, "");
|
|
93
95
|
if (withoutVersionSuffix !== candidate && KNOWN_CONTEXT_WINDOWS[withoutVersionSuffix] !== void 0) return KNOWN_CONTEXT_WINDOWS[withoutVersionSuffix];
|
|
94
96
|
}
|
|
95
97
|
}
|
|
98
|
+
function isKnownClaudeOpus47OrNewerModelId(modelId) {
|
|
99
|
+
return [modelId, modelId.replace(/^(?:us|eu|ap|apac|au|jp|global)\./, "")].some((candidate) => /(?:^|[/.:])anthropic\.claude-opus-4[.-][78](?:$|[-.:/])/i.test(candidate));
|
|
100
|
+
}
|
|
101
|
+
function resolveKnownThinkingLevelMap(modelId) {
|
|
102
|
+
if (!isKnownClaudeOpus47OrNewerModelId(modelId)) return;
|
|
103
|
+
return {
|
|
104
|
+
xhigh: "xhigh",
|
|
105
|
+
max: "max"
|
|
106
|
+
};
|
|
107
|
+
}
|
|
96
108
|
const DEFAULT_COST = {
|
|
97
109
|
input: 0,
|
|
98
110
|
output: 0,
|
|
@@ -155,6 +167,7 @@ function mapInputModalities(summary) {
|
|
|
155
167
|
return Array.from(mapped);
|
|
156
168
|
}
|
|
157
169
|
function inferReasoningSupport(summary) {
|
|
170
|
+
if (isKnownClaudeOpus47OrNewerModelId(summary.modelId ?? "")) return true;
|
|
158
171
|
const haystack = normalizeLowercaseStringOrEmpty(`${summary.modelId ?? ""} ${summary.modelName ?? ""}`);
|
|
159
172
|
return haystack.includes("reasoning") || haystack.includes("thinking");
|
|
160
173
|
}
|
|
@@ -182,6 +195,7 @@ function shouldIncludeSummary(summary, filter) {
|
|
|
182
195
|
}
|
|
183
196
|
function toModelDefinition(summary, defaults) {
|
|
184
197
|
const id = summary.modelId?.trim() ?? "";
|
|
198
|
+
const thinkingLevelMap = resolveKnownThinkingLevelMap(id);
|
|
185
199
|
return {
|
|
186
200
|
id,
|
|
187
201
|
name: summary.modelName?.trim() || id,
|
|
@@ -189,7 +203,8 @@ function toModelDefinition(summary, defaults) {
|
|
|
189
203
|
input: mapInputModalities(summary),
|
|
190
204
|
cost: DEFAULT_COST,
|
|
191
205
|
contextWindow: resolveKnownContextWindow(id) ?? defaults.contextWindow,
|
|
192
|
-
maxTokens: defaults.maxTokens
|
|
206
|
+
maxTokens: defaults.maxTokens,
|
|
207
|
+
...thinkingLevelMap ? { thinkingLevelMap } : {}
|
|
193
208
|
};
|
|
194
209
|
}
|
|
195
210
|
/**
|
|
@@ -259,14 +274,16 @@ function resolveInferenceProfiles(profiles, defaults, providerFilter, foundation
|
|
|
259
274
|
}
|
|
260
275
|
const baseModelId = resolveBaseModelId(profile);
|
|
261
276
|
const baseModel = baseModelId ? foundationModels.get(normalizeLowercaseStringOrEmpty(baseModelId)) : void 0;
|
|
277
|
+
const knownThinkingLevelMap = resolveKnownThinkingLevelMap(baseModelId ?? profile.inferenceProfileId);
|
|
262
278
|
discovered.push({
|
|
263
279
|
id: profile.inferenceProfileId,
|
|
264
280
|
name: profile.inferenceProfileName?.trim() || profile.inferenceProfileId,
|
|
265
|
-
reasoning: baseModel?.reasoning ??
|
|
281
|
+
reasoning: baseModel?.reasoning ?? isKnownClaudeOpus47OrNewerModelId(baseModelId ?? profile.inferenceProfileId),
|
|
266
282
|
input: baseModel?.input ?? ["text"],
|
|
267
283
|
cost: baseModel?.cost ?? DEFAULT_COST,
|
|
268
284
|
contextWindow: baseModel?.contextWindow ?? resolveKnownContextWindow(baseModelId ?? profile.inferenceProfileId ?? "") ?? defaults.contextWindow,
|
|
269
|
-
maxTokens: baseModel?.maxTokens ?? defaults.maxTokens
|
|
285
|
+
maxTokens: baseModel?.maxTokens ?? defaults.maxTokens,
|
|
286
|
+
...baseModel?.thinkingLevelMap || knownThinkingLevelMap ? { thinkingLevelMap: baseModel?.thinkingLevelMap ?? knownThinkingLevelMap } : {}
|
|
270
287
|
});
|
|
271
288
|
}
|
|
272
289
|
return discovered;
|
|
@@ -3,7 +3,7 @@ import { supportsBedrockPromptCaching } from "./bedrock-options.js";
|
|
|
3
3
|
import { mergeImplicitBedrockProvider, resolveBedrockConfigApiKey } from "./discovery-shared.js";
|
|
4
4
|
import { bedrockMemoryEmbeddingProviderAdapter } from "./memory-embedding-adapter.js";
|
|
5
5
|
import { streamBedrock, streamSimpleBedrock } from "./stream.runtime.js";
|
|
6
|
-
import {
|
|
6
|
+
import { isOpus47OrNewerBedrockModelRef, resolveBedrockClaudeThinkingProfile } from "./thinking-policy.js";
|
|
7
7
|
import { registerApiProvider, streamSimple } from "openclaw/plugin-sdk/llm";
|
|
8
8
|
import { resolvePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
9
9
|
import { ANTHROPIC_BY_MODEL_REPLAY_HOOKS, normalizeProviderId } from "openclaw/plugin-sdk/provider-model-shared";
|
|
@@ -130,14 +130,14 @@ async function resolveAppProfileTraits(modelId, fallbackRegion) {
|
|
|
130
130
|
const modelArns = models.map((m) => m.modelArn ?? "");
|
|
131
131
|
const traits = {
|
|
132
132
|
cacheEligible: models.length > 0 && modelArns.every((modelArn) => resolvedModelSupportsCaching(modelArn)),
|
|
133
|
-
omitTemperature: modelArns.some(
|
|
133
|
+
omitTemperature: modelArns.some(isOpus47OrNewerBedrockModelRef)
|
|
134
134
|
};
|
|
135
135
|
appProfileTraitsCache.set(modelId, traits);
|
|
136
136
|
return traits;
|
|
137
137
|
} catch {
|
|
138
138
|
return {
|
|
139
139
|
cacheEligible: isAnthropicBedrockModel(modelId),
|
|
140
|
-
omitTemperature:
|
|
140
|
+
omitTemperature: isOpus47OrNewerBedrockModelRef(modelId)
|
|
141
141
|
};
|
|
142
142
|
}
|
|
143
143
|
}
|
|
@@ -203,7 +203,7 @@ function registerAmazonBedrockPlugin(api) {
|
|
|
203
203
|
return createBedrockNoCacheWrapper(streamFn);
|
|
204
204
|
};
|
|
205
205
|
function omitDeprecatedOpus47Temperature(modelId, options) {
|
|
206
|
-
if (!
|
|
206
|
+
if (!isOpus47OrNewerBedrockModelRef(modelId) || !("temperature" in options)) return options;
|
|
207
207
|
const next = { ...options };
|
|
208
208
|
delete next.temperature;
|
|
209
209
|
return next;
|
|
@@ -284,7 +284,7 @@ function registerAmazonBedrockPlugin(api) {
|
|
|
284
284
|
if (serviceTier && wrapped) wrapped = createBedrockServiceTierWrapper(wrapped, serviceTier);
|
|
285
285
|
const region = resolveBedrockRegion(config) ?? extractRegionFromBaseUrl(model?.baseUrl) ?? currentPluginConfig?.discovery?.region;
|
|
286
286
|
const mayNeedCacheInjection = isBedrockAppInferenceProfile(modelId) && !sharedRuntimeWouldInjectCachePoints(modelId);
|
|
287
|
-
const shouldOmitTemperature =
|
|
287
|
+
const shouldOmitTemperature = isOpus47OrNewerBedrockModelRef(modelId);
|
|
288
288
|
const shouldPatchMaxThinking = shouldOmitTemperature && thinkingLevel === "max";
|
|
289
289
|
const heuristicMatch = needsCachePointInjection(modelId);
|
|
290
290
|
if (!region && !mayNeedCacheInjection && !shouldOmitTemperature && !shouldPatchMaxThinking) return createAwsCredentialRefreshStreamWrapper(wrapped);
|
|
@@ -296,7 +296,11 @@ function registerAmazonBedrockPlugin(api) {
|
|
|
296
296
|
if (!mayNeedCacheInjection) return underlying(streamModel, context, withAwsCredentialRefreshOnPayload({
|
|
297
297
|
...merged,
|
|
298
298
|
...shouldPatchMaxThinking ? { onPayload: (payload, payloadModel) => {
|
|
299
|
-
if (payload && typeof payload === "object")
|
|
299
|
+
if (payload && typeof payload === "object") {
|
|
300
|
+
const payloadRecord = payload;
|
|
301
|
+
patchOpus47MaxThinkingEffort(payloadRecord);
|
|
302
|
+
omitDeprecatedOpus47PayloadTemperature(payloadRecord);
|
|
303
|
+
}
|
|
300
304
|
return originalOnPayload?.(payload, payloadModel);
|
|
301
305
|
} } : {}
|
|
302
306
|
}));
|
|
@@ -310,7 +314,8 @@ function registerAmazonBedrockPlugin(api) {
|
|
|
310
314
|
const payloadRecord = payload;
|
|
311
315
|
injectBedrockCachePoints(payloadRecord, cacheRetention);
|
|
312
316
|
if (shouldPatchMaxThinking) patchOpus47MaxThinkingEffort(payloadRecord);
|
|
313
|
-
if (
|
|
317
|
+
if (shouldOmitTemperature) omitDeprecatedOpus47PayloadTemperature(payloadRecord);
|
|
318
|
+
else if (mayNeedTemperatureTrait) {
|
|
314
319
|
if ((await resolveAppProfileTraits(modelId, region)).omitTemperature) omitDeprecatedOpus47PayloadTemperature(payloadRecord);
|
|
315
320
|
}
|
|
316
321
|
}
|
package/dist/stream.runtime.js
CHANGED
|
@@ -324,10 +324,10 @@ function getModelMatchCandidates(modelId, modelName) {
|
|
|
324
324
|
});
|
|
325
325
|
}
|
|
326
326
|
function supportsAdaptiveThinking(modelId, modelName) {
|
|
327
|
-
return getModelMatchCandidates(modelId, modelName).some((s) => s.includes("opus-4-6") || s.includes("opus-4-7") || s.includes("sonnet-4-6"));
|
|
327
|
+
return getModelMatchCandidates(modelId, modelName).some((s) => s.includes("opus-4-6") || s.includes("opus-4-7") || s.includes("opus-4-8") || s.includes("sonnet-4-6"));
|
|
328
328
|
}
|
|
329
329
|
function supportsNativeXhighEffort(model) {
|
|
330
|
-
return getModelMatchCandidates(model.id, model.name).some((s) => s.includes("opus-4-7"));
|
|
330
|
+
return getModelMatchCandidates(model.id, model.name).some((s) => s.includes("opus-4-7") || s.includes("opus-4-8"));
|
|
331
331
|
}
|
|
332
332
|
function mapThinkingLevelToEffort(model, level) {
|
|
333
333
|
if (level === "xhigh" && supportsNativeXhighEffort(model)) return "xhigh";
|
|
@@ -338,6 +338,7 @@ function mapThinkingLevelToEffort(model, level) {
|
|
|
338
338
|
case "low": return "low";
|
|
339
339
|
case "medium": return "medium";
|
|
340
340
|
case "high": return "high";
|
|
341
|
+
case "max": return supportsNativeXhighEffort(model) ? "max" : "high";
|
|
341
342
|
default: return "high";
|
|
342
343
|
}
|
|
343
344
|
}
|
|
@@ -556,7 +557,8 @@ function buildAdditionalModelRequestFields(model, options) {
|
|
|
556
557
|
low: 2048,
|
|
557
558
|
medium: 8192,
|
|
558
559
|
high: 16384,
|
|
559
|
-
xhigh: 16384
|
|
560
|
+
xhigh: 16384,
|
|
561
|
+
max: 16384
|
|
560
562
|
};
|
|
561
563
|
const level = options.reasoning === "xhigh" ? "high" : options.reasoning;
|
|
562
564
|
return { thinking: {
|
|
@@ -599,6 +601,7 @@ const testing = {
|
|
|
599
601
|
convertMessages,
|
|
600
602
|
getConfiguredBedrockRegion,
|
|
601
603
|
hasConfiguredBedrockProfile,
|
|
604
|
+
mapThinkingLevelToEffort,
|
|
602
605
|
shouldUseExplicitBedrockEndpoint
|
|
603
606
|
};
|
|
604
607
|
//#endregion
|
package/dist/thinking-policy.js
CHANGED
|
@@ -6,11 +6,26 @@ const BASE_CLAUDE_THINKING_LEVELS = [
|
|
|
6
6
|
{ id: "medium" },
|
|
7
7
|
{ id: "high" }
|
|
8
8
|
];
|
|
9
|
+
function isOpus48BedrockModelRef(modelRef) {
|
|
10
|
+
return /(?:^|[/.:])(?:(?:us|eu|ap|apac|au|jp|global)\.)?anthropic\.claude-opus-4[.-]8(?:$|[-.:/])/i.test(modelRef);
|
|
11
|
+
}
|
|
9
12
|
function isOpus47BedrockModelRef(modelRef) {
|
|
10
13
|
return /(?:^|[/.:])(?:(?:us|eu|ap|apac|au|jp|global)\.)?anthropic\.claude-opus-4[.-]7(?:$|[-.:/])/i.test(modelRef);
|
|
11
14
|
}
|
|
15
|
+
function isOpus47OrNewerBedrockModelRef(modelRef) {
|
|
16
|
+
return isOpus47BedrockModelRef(modelRef) || isOpus48BedrockModelRef(modelRef);
|
|
17
|
+
}
|
|
12
18
|
function resolveBedrockClaudeThinkingProfile(modelId) {
|
|
13
19
|
const trimmed = modelId.trim();
|
|
20
|
+
if (isOpus48BedrockModelRef(trimmed)) return {
|
|
21
|
+
levels: [
|
|
22
|
+
...BASE_CLAUDE_THINKING_LEVELS,
|
|
23
|
+
{ id: "xhigh" },
|
|
24
|
+
{ id: "adaptive" },
|
|
25
|
+
{ id: "max" }
|
|
26
|
+
],
|
|
27
|
+
defaultLevel: "off"
|
|
28
|
+
};
|
|
14
29
|
if (isOpus47BedrockModelRef(trimmed)) return {
|
|
15
30
|
levels: [
|
|
16
31
|
...BASE_CLAUDE_THINKING_LEVELS,
|
|
@@ -27,4 +42,4 @@ function resolveBedrockClaudeThinkingProfile(modelId) {
|
|
|
27
42
|
return { levels: BASE_CLAUDE_THINKING_LEVELS };
|
|
28
43
|
}
|
|
29
44
|
//#endregion
|
|
30
|
-
export { isOpus47BedrockModelRef, resolveBedrockClaudeThinkingProfile };
|
|
45
|
+
export { isOpus47BedrockModelRef, isOpus47OrNewerBedrockModelRef, resolveBedrockClaudeThinkingProfile };
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/amazon-bedrock-provider",
|
|
3
|
-
"version": "2026.5.28-beta.
|
|
3
|
+
"version": "2026.5.28-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.5.28-beta.
|
|
9
|
+
"version": "2026.5.28-beta.3",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@aws-sdk/client-bedrock": "3.1053.0",
|
|
12
12
|
"@aws-sdk/client-bedrock-runtime": "3.1053.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/amazon-bedrock-provider",
|
|
3
|
-
"version": "2026.5.28-beta.
|
|
3
|
+
"version": "2026.5.28-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.5.28-beta.
|
|
28
|
+
"pluginApi": ">=2026.5.28-beta.3"
|
|
29
29
|
},
|
|
30
30
|
"build": {
|
|
31
|
-
"openclawVersion": "2026.5.28-beta.
|
|
31
|
+
"openclawVersion": "2026.5.28-beta.3",
|
|
32
32
|
"bundledDist": false
|
|
33
33
|
},
|
|
34
34
|
"release": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"npm-shrinkwrap.json"
|
|
46
46
|
],
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"openclaw": ">=2026.5.28-beta.
|
|
48
|
+
"openclaw": ">=2026.5.28-beta.3"
|
|
49
49
|
},
|
|
50
50
|
"peerDependenciesMeta": {
|
|
51
51
|
"openclaw": {
|