@openclaw/amazon-bedrock-provider 2026.6.2-beta.1 → 2026.6.5-beta.1
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/aws-credential-refresh.js +3 -0
- package/dist/bedrock-options.js +1 -0
- package/dist/config-compat.js +5 -0
- package/dist/discovery-shared.js +6 -0
- package/dist/discovery.js +3 -0
- package/dist/embedding-provider.js +5 -0
- package/dist/index.js +4 -0
- package/dist/memory-embedding-adapter.js +5 -0
- package/dist/provider-policy-api.js +5 -0
- package/dist/register.sync.runtime.js +3 -0
- package/dist/setup-api.js +4 -0
- package/dist/stream.runtime.js +7 -0
- package/dist/thinking-policy.js +3 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +4 -4
|
@@ -3,6 +3,7 @@ let sharedIniFileLoaderForTest;
|
|
|
3
3
|
function hasStaticAwsCredentialEnv(env) {
|
|
4
4
|
return Boolean(env.AWS_ACCESS_KEY_ID && env.AWS_SECRET_ACCESS_KEY);
|
|
5
5
|
}
|
|
6
|
+
/** Return whether Bedrock should refresh the AWS shared config cache before discovery. */
|
|
6
7
|
function shouldRefreshAwsSharedConfigCacheForBedrock(env) {
|
|
7
8
|
if (env.AWS_BEDROCK_SKIP_AUTH === "1" || env.AWS_BEARER_TOKEN_BEDROCK) return false;
|
|
8
9
|
return !hasStaticAwsCredentialEnv(env);
|
|
@@ -14,10 +15,12 @@ async function loadSharedIniFileLoader() {
|
|
|
14
15
|
}
|
|
15
16
|
return await import("@smithy/shared-ini-file-loader");
|
|
16
17
|
}
|
|
18
|
+
/** Refresh Smithy shared config files when Bedrock needs default-chain credentials. */
|
|
17
19
|
async function refreshAwsSharedConfigCacheForBedrock(env = process.env) {
|
|
18
20
|
if (!shouldRefreshAwsSharedConfigCacheForBedrock(env)) return;
|
|
19
21
|
await (await loadSharedIniFileLoader()).loadSharedConfigFiles({ ignoreCache: true });
|
|
20
22
|
}
|
|
23
|
+
/** Override the shared INI loader for Bedrock credential-refresh tests. */
|
|
21
24
|
function setAwsSharedIniFileLoaderForTest(loader) {
|
|
22
25
|
sharedIniFileLoaderForTest = loader;
|
|
23
26
|
}
|
package/dist/bedrock-options.js
CHANGED
|
@@ -5,6 +5,7 @@ function getModelMatchCandidates(modelId, modelName) {
|
|
|
5
5
|
return [lower, lower.replace(/[\s_.:]+/g, "-")];
|
|
6
6
|
});
|
|
7
7
|
}
|
|
8
|
+
/** Return whether a Bedrock model is known to support Anthropic prompt caching. */
|
|
8
9
|
function supportsBedrockPromptCaching(modelId, modelName) {
|
|
9
10
|
const candidates = getModelMatchCandidates(modelId, modelName);
|
|
10
11
|
if (!candidates.some((s) => s.includes("claude"))) {
|
package/dist/config-compat.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
2
|
//#region extensions/amazon-bedrock/config-compat.ts
|
|
3
|
+
/**
|
|
4
|
+
* Legacy config migration for Amazon Bedrock discovery settings. It moves
|
|
5
|
+
* old `models.bedrockDiscovery` config into plugin-local config shape.
|
|
6
|
+
*/
|
|
3
7
|
const LEGACY_PATH = "models.bedrockDiscovery";
|
|
4
8
|
const TARGET_PATH = "plugins.entries.amazon-bedrock.config.discovery";
|
|
5
9
|
const BLOCKED_OBJECT_KEYS = new Set([
|
|
@@ -42,6 +46,7 @@ function pruneEmptyModelsRoot(root) {
|
|
|
42
46
|
const models = getRecord(root.models);
|
|
43
47
|
if (models && Object.keys(models).length === 0) delete root.models;
|
|
44
48
|
}
|
|
49
|
+
/** Migrate legacy Bedrock discovery config into `plugins.entries.amazon-bedrock.config`. */
|
|
45
50
|
function migrateAmazonBedrockLegacyConfig(raw) {
|
|
46
51
|
if (!isRecord(raw)) return {
|
|
47
52
|
config: raw,
|
package/dist/discovery-shared.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { resolveAwsSdkEnvVarName } from "openclaw/plugin-sdk/provider-auth-runtime";
|
|
2
2
|
//#region extensions/amazon-bedrock/discovery-shared.ts
|
|
3
|
+
/**
|
|
4
|
+
* Shared Amazon Bedrock discovery helpers used by plugin runtime and config
|
|
5
|
+
* consumers without pulling in the AWS discovery implementation.
|
|
6
|
+
*/
|
|
7
|
+
/** Resolve the config auth marker that tells OpenClaw to use AWS SDK credentials. */
|
|
3
8
|
function resolveBedrockConfigApiKey(env = process.env) {
|
|
4
9
|
return resolveAwsSdkEnvVarName(env);
|
|
5
10
|
}
|
|
11
|
+
/** Merge an implicit Bedrock provider catalog with any explicit user config. */
|
|
6
12
|
function mergeImplicitBedrockProvider(params) {
|
|
7
13
|
const { existing, implicit } = params;
|
|
8
14
|
if (!existing) return implicit;
|
package/dist/discovery.js
CHANGED
|
@@ -288,10 +288,12 @@ function resolveInferenceProfiles(profiles, defaults, providerFilter, foundation
|
|
|
288
288
|
}
|
|
289
289
|
return discovered;
|
|
290
290
|
}
|
|
291
|
+
/** Reset Bedrock discovery cache for tests. */
|
|
291
292
|
function resetBedrockDiscoveryCacheForTest() {
|
|
292
293
|
discoveryCache.clear();
|
|
293
294
|
hasLoggedBedrockError = false;
|
|
294
295
|
}
|
|
296
|
+
/** Discover Bedrock models and inference profiles for one region/config. */
|
|
295
297
|
async function discoverBedrockModels(params) {
|
|
296
298
|
const refreshIntervalSeconds = Math.max(0, Math.floor(params.config?.refreshInterval ?? DEFAULT_REFRESH_INTERVAL_SECONDS));
|
|
297
299
|
const providerFilter = normalizeProviderFilter(params.config?.providerFilter);
|
|
@@ -378,6 +380,7 @@ async function discoverBedrockModels(params) {
|
|
|
378
380
|
return [];
|
|
379
381
|
}
|
|
380
382
|
}
|
|
383
|
+
/** Resolve the implicit Bedrock provider config from env, plugin config, and discovery. */
|
|
381
384
|
async function resolveImplicitBedrockProvider(params) {
|
|
382
385
|
const env = params.env ?? process.env;
|
|
383
386
|
const discoveryConfig = params.pluginConfig?.discovery;
|
|
@@ -2,6 +2,11 @@ import { refreshAwsSharedConfigCacheForBedrock } from "./aws-credential-refresh.
|
|
|
2
2
|
import { debugEmbeddingsLog, sanitizeAndNormalizeEmbedding } from "openclaw/plugin-sdk/memory-core-host-engine-embeddings";
|
|
3
3
|
import { asOptionalRecord, normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
//#region extensions/amazon-bedrock/embedding-provider.ts
|
|
5
|
+
/**
|
|
6
|
+
* Amazon Bedrock embedding provider runtime. It normalizes model-specific
|
|
7
|
+
* request/response shapes across Titan, Cohere, Nova, and TwelveLabs models.
|
|
8
|
+
*/
|
|
9
|
+
/** Default Bedrock embedding model used when no explicit model is configured. */
|
|
5
10
|
const DEFAULT_BEDROCK_EMBEDDING_MODEL = "amazon.titan-embed-text-v2:0";
|
|
6
11
|
const MODELS = {
|
|
7
12
|
"amazon.titan-embed-text-v2:0": {
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { registerAmazonBedrockPlugin } from "./register.sync.runtime.js";
|
|
2
2
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
3
3
|
//#region extensions/amazon-bedrock/index.ts
|
|
4
|
+
/**
|
|
5
|
+
* Amazon Bedrock provider plugin entry. Registers runtime streaming, discovery,
|
|
6
|
+
* auth, thinking policy, guardrail, and memory embedding hooks.
|
|
7
|
+
*/
|
|
4
8
|
var amazon_bedrock_default = definePluginEntry({
|
|
5
9
|
id: "amazon-bedrock",
|
|
6
10
|
name: "Amazon Bedrock Provider",
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { DEFAULT_BEDROCK_EMBEDDING_MODEL, createBedrockEmbeddingProvider, hasAwsCredentials } from "./embedding-provider.js";
|
|
2
2
|
import { isMissingEmbeddingApiKeyError } from "openclaw/plugin-sdk/memory-core-host-engine-embeddings";
|
|
3
3
|
//#region extensions/amazon-bedrock/memory-embedding-adapter.ts
|
|
4
|
+
/**
|
|
5
|
+
* Memory embedding adapter for Amazon Bedrock. It exposes Bedrock embeddings to
|
|
6
|
+
* the memory-core engine and verifies AWS credentials before auto-selection.
|
|
7
|
+
*/
|
|
8
|
+
/** Memory-core adapter descriptor for Bedrock embeddings. */
|
|
4
9
|
const bedrockMemoryEmbeddingProviderAdapter = {
|
|
5
10
|
id: "bedrock",
|
|
6
11
|
defaultModel: DEFAULT_BEDROCK_EMBEDDING_MODEL,
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { resolveBedrockClaudeThinkingProfile } from "./thinking-policy.js";
|
|
2
2
|
import { normalizeProviderId } from "openclaw/plugin-sdk/provider-model-shared";
|
|
3
3
|
//#region extensions/amazon-bedrock/provider-policy-api.ts
|
|
4
|
+
/**
|
|
5
|
+
* Provider-policy API for Amazon Bedrock. Core asks this plugin for thinking
|
|
6
|
+
* profiles without importing provider registration or streaming code.
|
|
7
|
+
*/
|
|
8
|
+
/** Resolve the Bedrock thinking profile for a provider/model pair. */
|
|
4
9
|
function resolveThinkingProfile(params) {
|
|
5
10
|
if (normalizeProviderId(params.provider) !== "amazon-bedrock") return null;
|
|
6
11
|
return resolveBedrockClaudeThinkingProfile(params.modelId);
|
|
@@ -108,9 +108,11 @@ function resolvedModelSupportsCaching(modelArn) {
|
|
|
108
108
|
}
|
|
109
109
|
const appProfileTraitsCache = /* @__PURE__ */ new Map();
|
|
110
110
|
let bedrockControlPlaneOverride;
|
|
111
|
+
/** Reset app-profile prompt-cache eligibility state for tests. */
|
|
111
112
|
function resetBedrockAppProfileCacheEligibilityForTest() {
|
|
112
113
|
appProfileTraitsCache.clear();
|
|
113
114
|
}
|
|
115
|
+
/** Override Bedrock app-profile control-plane checks for tests. */
|
|
114
116
|
function setBedrockAppProfileControlPlaneForTest(controlPlane) {
|
|
115
117
|
bedrockControlPlaneOverride = controlPlane;
|
|
116
118
|
resetBedrockAppProfileCacheEligibilityForTest();
|
|
@@ -177,6 +179,7 @@ function patchOpus47MaxThinkingEffort(payload) {
|
|
|
177
179
|
fields.output_config = outputConfig;
|
|
178
180
|
payload.additionalModelRequestFields = fields;
|
|
179
181
|
}
|
|
182
|
+
/** Register Amazon Bedrock provider, discovery catalog, stream wrappers, and embeddings. */
|
|
180
183
|
function registerAmazonBedrockPlugin(api) {
|
|
181
184
|
const providerId = "amazon-bedrock";
|
|
182
185
|
const bedrockRegionRe = /bedrock-runtime\.([a-z0-9-]+)\.amazonaws\./;
|
package/dist/setup-api.js
CHANGED
|
@@ -2,6 +2,10 @@ import { resolveBedrockConfigApiKey } from "./discovery-shared.js";
|
|
|
2
2
|
import { migrateAmazonBedrockLegacyConfig } from "./config-compat.js";
|
|
3
3
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
4
4
|
//#region extensions/amazon-bedrock/setup-api.ts
|
|
5
|
+
/**
|
|
6
|
+
* Lightweight Amazon Bedrock setup entry. It exposes auth detection and config
|
|
7
|
+
* migration hooks without loading runtime streaming or AWS discovery code.
|
|
8
|
+
*/
|
|
5
9
|
var setup_api_default = definePluginEntry({
|
|
6
10
|
id: "amazon-bedrock",
|
|
7
11
|
name: "Amazon Bedrock Setup",
|
package/dist/stream.runtime.js
CHANGED
|
@@ -3,6 +3,11 @@ import { AssistantMessageEventStream, adjustMaxTokensForThinking, buildBaseOptio
|
|
|
3
3
|
import { BedrockRuntimeClient, BedrockRuntimeServiceException, CachePointType, CacheTTL, ConversationRole, ConverseStreamCommand, ImageFormat, StopReason, ToolResultStatus } from "@aws-sdk/client-bedrock-runtime";
|
|
4
4
|
import { NodeHttpHandler } from "@smithy/node-http-handler";
|
|
5
5
|
//#region extensions/amazon-bedrock/stream.runtime.ts
|
|
6
|
+
/**
|
|
7
|
+
* Amazon Bedrock Converse streaming runtime. It maps OpenClaw messages/tools,
|
|
8
|
+
* thinking, cache points, images, and usage into Bedrock Converse Stream calls.
|
|
9
|
+
*/
|
|
10
|
+
/** Stream a Bedrock Converse request using Bedrock-specific options. */
|
|
6
11
|
const streamBedrock = (model, context, options = {}) => {
|
|
7
12
|
const stream = new AssistantMessageEventStream();
|
|
8
13
|
(async () => {
|
|
@@ -147,6 +152,7 @@ function formatBedrockError(error) {
|
|
|
147
152
|
if (error instanceof BedrockRuntimeServiceException) return `${BEDROCK_ERROR_PREFIXES[error.name] ?? error.name}: ${message}`;
|
|
148
153
|
return message;
|
|
149
154
|
}
|
|
155
|
+
/** Stream a Bedrock Converse request from the generic OpenClaw stream options. */
|
|
150
156
|
const streamSimpleBedrock = (model, context, options) => {
|
|
151
157
|
const base = buildBaseOptions(model, options, void 0);
|
|
152
158
|
if (!options?.reasoning) return streamBedrock(model, context, {
|
|
@@ -597,6 +603,7 @@ function createImageBlock(mimeType, data) {
|
|
|
597
603
|
format
|
|
598
604
|
};
|
|
599
605
|
}
|
|
606
|
+
/** Test-only hooks for Bedrock runtime conversion and endpoint policy. */
|
|
600
607
|
const testing = {
|
|
601
608
|
convertMessages,
|
|
602
609
|
getConfiguredBedrockRegion,
|
package/dist/thinking-policy.js
CHANGED
|
@@ -9,12 +9,15 @@ const BASE_CLAUDE_THINKING_LEVELS = [
|
|
|
9
9
|
function isOpus48BedrockModelRef(modelRef) {
|
|
10
10
|
return /(?:^|[/.:])(?:(?:us|eu|ap|apac|au|jp|global)\.)?anthropic\.claude-opus-4[.-]8(?:$|[-.:/])/i.test(modelRef);
|
|
11
11
|
}
|
|
12
|
+
/** Return whether a Bedrock model ref names Claude Opus 4.7. */
|
|
12
13
|
function isOpus47BedrockModelRef(modelRef) {
|
|
13
14
|
return /(?:^|[/.:])(?:(?:us|eu|ap|apac|au|jp|global)\.)?anthropic\.claude-opus-4[.-]7(?:$|[-.:/])/i.test(modelRef);
|
|
14
15
|
}
|
|
16
|
+
/** Return whether a Bedrock model ref names Claude Opus 4.7 or newer. */
|
|
15
17
|
function isOpus47OrNewerBedrockModelRef(modelRef) {
|
|
16
18
|
return isOpus47BedrockModelRef(modelRef) || isOpus48BedrockModelRef(modelRef);
|
|
17
19
|
}
|
|
20
|
+
/** Resolve supported Claude thinking levels for a Bedrock model id. */
|
|
18
21
|
function resolveBedrockClaudeThinkingProfile(modelId) {
|
|
19
22
|
const trimmed = modelId.trim();
|
|
20
23
|
if (isOpus48BedrockModelRef(trimmed)) return {
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/amazon-bedrock-provider",
|
|
3
|
-
"version": "2026.6.
|
|
3
|
+
"version": "2026.6.5-beta.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@openclaw/amazon-bedrock-provider",
|
|
9
|
-
"version": "2026.6.
|
|
9
|
+
"version": "2026.6.5-beta.1",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@aws-sdk/client-bedrock": "3.1056.0",
|
|
12
12
|
"@aws-sdk/client-bedrock-runtime": "3.1056.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/amazon-bedrock-provider",
|
|
3
|
-
"version": "2026.6.
|
|
3
|
+
"version": "2026.6.5-beta.1",
|
|
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.6.
|
|
28
|
+
"pluginApi": ">=2026.6.5-beta.1"
|
|
29
29
|
},
|
|
30
30
|
"build": {
|
|
31
|
-
"openclawVersion": "2026.6.
|
|
31
|
+
"openclawVersion": "2026.6.5-beta.1",
|
|
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.6.
|
|
49
|
+
"openclaw": ">=2026.6.5-beta.1"
|
|
50
50
|
},
|
|
51
51
|
"peerDependenciesMeta": {
|
|
52
52
|
"openclaw": {
|