@openclaw/amazon-bedrock-mantle-provider 2026.6.2-beta.1 → 2026.6.5-beta.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.
package/dist/discovery.js
CHANGED
|
@@ -3,6 +3,10 @@ import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
|
3
3
|
import { isFutureDateTimestampMs, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
|
|
4
4
|
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
//#region extensions/amazon-bedrock-mantle/discovery.ts
|
|
6
|
+
/**
|
|
7
|
+
* Amazon Bedrock Mantle discovery and bearer-token handling. It resolves
|
|
8
|
+
* explicit tokens, IAM-generated tokens, model catalogs, and implicit provider config.
|
|
9
|
+
*/
|
|
6
10
|
const log = createSubsystemLogger("bedrock-mantle-discovery");
|
|
7
11
|
const DEFAULT_COST = {
|
|
8
12
|
input: 0,
|
|
@@ -13,6 +17,7 @@ const DEFAULT_COST = {
|
|
|
13
17
|
const DEFAULT_CONTEXT_WINDOW = 32e3;
|
|
14
18
|
const DEFAULT_MAX_TOKENS = 4096;
|
|
15
19
|
const DEFAULT_REFRESH_INTERVAL_SECONDS = 3600;
|
|
20
|
+
/** Config auth marker meaning Mantle should mint runtime bearer tokens from IAM. */
|
|
16
21
|
const MANTLE_IAM_TOKEN_MARKER = "__amazon_bedrock_mantle_iam__";
|
|
17
22
|
const MANTLE_SUPPORTED_REGIONS = [
|
|
18
23
|
"us-east-1",
|
|
@@ -98,6 +103,7 @@ async function generateBearerTokenFromIam(params) {
|
|
|
98
103
|
function getCachedIamToken(region) {
|
|
99
104
|
return getCachedIamTokenEntry(region)?.token;
|
|
100
105
|
}
|
|
106
|
+
/** Resolve the actual runtime bearer token for Mantle, generating IAM tokens when needed. */
|
|
101
107
|
async function resolveMantleRuntimeBearerToken(params) {
|
|
102
108
|
if (params.apiKey !== "__amazon_bedrock_mantle_iam__") return { apiKey: params.apiKey };
|
|
103
109
|
const now = params.now?.() ?? Date.now();
|
|
@@ -120,7 +126,7 @@ async function resolveMantleRuntimeBearerToken(params) {
|
|
|
120
126
|
...expiresAt === void 0 ? {} : { expiresAt }
|
|
121
127
|
};
|
|
122
128
|
}
|
|
123
|
-
/**
|
|
129
|
+
/** Clear the IAM token cache for tests. */
|
|
124
130
|
function resetIamTokenCacheForTest() {
|
|
125
131
|
iamTokenCache.clear();
|
|
126
132
|
}
|
|
@@ -138,7 +144,7 @@ function inferReasoningSupport(modelId) {
|
|
|
138
144
|
return REASONING_PATTERNS.some((p) => lower.includes(p));
|
|
139
145
|
}
|
|
140
146
|
const discoveryCache = /* @__PURE__ */ new Map();
|
|
141
|
-
/** Clear the discovery cache
|
|
147
|
+
/** Clear the Mantle discovery cache for tests. */
|
|
142
148
|
function resetMantleDiscoveryCacheForTest() {
|
|
143
149
|
discoveryCache.clear();
|
|
144
150
|
}
|
|
@@ -153,6 +159,7 @@ function resetMantleDiscoveryCacheForTest() {
|
|
|
153
159
|
* Results are cached per region for `DEFAULT_REFRESH_INTERVAL_SECONDS`.
|
|
154
160
|
* Returns an empty array if the request fails (no permission, network error, etc.).
|
|
155
161
|
*/
|
|
162
|
+
/** Discover Mantle models for one region/config. */
|
|
156
163
|
async function discoverMantleModels(params) {
|
|
157
164
|
const { region, bearerToken, fetchFn = fetch, now = Date.now } = params;
|
|
158
165
|
const cacheKey = region;
|
|
@@ -202,6 +209,7 @@ async function discoverMantleModels(params) {
|
|
|
202
209
|
* - Region from AWS_REGION / AWS_DEFAULT_REGION / default us-east-1
|
|
203
210
|
* - Models discovered from `/v1/models`
|
|
204
211
|
*/
|
|
212
|
+
/** Resolve implicit Mantle provider config from env, IAM token support, and discovery. */
|
|
205
213
|
async function resolveImplicitMantleProvider(params) {
|
|
206
214
|
const env = params.env ?? process.env;
|
|
207
215
|
if (params.pluginConfig?.discovery?.enabled === false) return null;
|
|
@@ -250,6 +258,7 @@ async function resolveImplicitMantleProvider(params) {
|
|
|
250
258
|
models: allModels
|
|
251
259
|
};
|
|
252
260
|
}
|
|
261
|
+
/** Merge an implicit Mantle provider catalog with explicit user config. */
|
|
253
262
|
function mergeImplicitMantleProvider(params) {
|
|
254
263
|
const { existing, implicit } = params;
|
|
255
264
|
if (!existing) return implicit;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { registerBedrockMantlePlugin } from "./register.sync.runtime.js";
|
|
2
2
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
3
3
|
//#region extensions/amazon-bedrock-mantle/index.ts
|
|
4
|
+
/**
|
|
5
|
+
* Amazon Bedrock Mantle plugin entry. Registers the OpenAI-compatible Mantle
|
|
6
|
+
* provider plus Anthropic stream compatibility hooks.
|
|
7
|
+
*/
|
|
4
8
|
var amazon_bedrock_mantle_default = definePluginEntry({
|
|
5
9
|
id: "amazon-bedrock-mantle",
|
|
6
10
|
name: "Amazon Bedrock Mantle Provider",
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import Anthropic from "@anthropic-ai/sdk";
|
|
2
2
|
import { stream } from "openclaw/plugin-sdk/llm";
|
|
3
3
|
//#region extensions/amazon-bedrock-mantle/mantle-anthropic.runtime.ts
|
|
4
|
+
/**
|
|
5
|
+
* Anthropic Messages stream adapter for Bedrock Mantle. It rewrites Mantle
|
|
6
|
+
* endpoints to Anthropic-compatible URLs and adjusts thinking-token budgets.
|
|
7
|
+
*/
|
|
4
8
|
const MANTLE_ANTHROPIC_BETA = "fine-grained-tool-streaming-2025-05-14";
|
|
9
|
+
/** Resolve the Anthropic-compatible Mantle base URL from a provider base URL. */
|
|
5
10
|
function resolveMantleAnthropicBaseUrl(baseUrl) {
|
|
6
11
|
const trimmed = baseUrl.replace(/\/+$/, "");
|
|
7
12
|
if (trimmed.endsWith("/anthropic")) return trimmed;
|
|
@@ -48,6 +53,7 @@ function adjustMaxTokensForThinking(baseMaxTokens, modelMaxTokens, reasoningLeve
|
|
|
48
53
|
thinkingBudget
|
|
49
54
|
};
|
|
50
55
|
}
|
|
56
|
+
/** Create the Mantle Anthropic Messages stream function. */
|
|
51
57
|
function createMantleAnthropicStreamFn(deps) {
|
|
52
58
|
return (model, context, options) => {
|
|
53
59
|
const apiKey = options?.apiKey ?? "";
|
|
@@ -2,6 +2,7 @@ import { mergeImplicitMantleProvider, resolveImplicitMantleProvider, resolveMant
|
|
|
2
2
|
import { createMantleAnthropicStreamFn } from "./mantle-anthropic.runtime.js";
|
|
3
3
|
import { resolvePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
4
4
|
//#region extensions/amazon-bedrock-mantle/register.sync.runtime.ts
|
|
5
|
+
/** Register the Amazon Bedrock Mantle provider with OpenClaw. */
|
|
5
6
|
function registerBedrockMantlePlugin(api) {
|
|
6
7
|
const providerId = "amazon-bedrock-mantle";
|
|
7
8
|
const startupPluginConfig = api.pluginConfig ?? {};
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/amazon-bedrock-mantle-provider",
|
|
3
|
-
"version": "2026.6.
|
|
3
|
+
"version": "2026.6.5-beta.2",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@openclaw/amazon-bedrock-mantle-provider",
|
|
9
|
-
"version": "2026.6.
|
|
9
|
+
"version": "2026.6.5-beta.2",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sdk": "0.100.1",
|
|
12
12
|
"@aws/bedrock-token-generator": "1.1.0"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/amazon-bedrock-mantle-provider",
|
|
3
|
-
"version": "2026.6.
|
|
3
|
+
"version": "2026.6.5-beta.2",
|
|
4
4
|
"description": "OpenClaw Amazon Bedrock Mantle provider plugin for OpenAI-compatible model routing.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"minHostVersion": ">=2026.5.12-beta.1"
|
|
22
22
|
},
|
|
23
23
|
"compat": {
|
|
24
|
-
"pluginApi": ">=2026.6.
|
|
24
|
+
"pluginApi": ">=2026.6.5-beta.2"
|
|
25
25
|
},
|
|
26
26
|
"build": {
|
|
27
|
-
"openclawVersion": "2026.6.
|
|
27
|
+
"openclawVersion": "2026.6.5-beta.2",
|
|
28
28
|
"bundledDist": false
|
|
29
29
|
},
|
|
30
30
|
"release": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"README.md"
|
|
43
43
|
],
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"openclaw": ">=2026.6.
|
|
45
|
+
"openclaw": ">=2026.6.5-beta.2"
|
|
46
46
|
},
|
|
47
47
|
"peerDependenciesMeta": {
|
|
48
48
|
"openclaw": {
|