@openclaw/amazon-bedrock-mantle-provider 2026.7.2-beta.7 → 2026.8.1-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/api.js +2 -2
- package/dist/discovery.js +19 -13
- package/dist/mantle-anthropic.runtime.js +4 -3
- package/package.json +4 -4
package/dist/api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { MANTLE_IAM_TOKEN_MARKER, discoverMantleModels, generateBearerTokenFromIam, getCachedIamToken, mergeImplicitMantleProvider,
|
|
2
|
-
export { MANTLE_IAM_TOKEN_MARKER, discoverMantleModels, generateBearerTokenFromIam, getCachedIamToken, mergeImplicitMantleProvider,
|
|
1
|
+
import { MANTLE_IAM_TOKEN_MARKER, discoverMantleModels, generateBearerTokenFromIam, getCachedIamToken, mergeImplicitMantleProvider, resolveImplicitMantleProvider, resolveMantleBearerToken, resolveMantleRuntimeBearerToken } from "./discovery.js";
|
|
2
|
+
export { MANTLE_IAM_TOKEN_MARKER, discoverMantleModels, generateBearerTokenFromIam, getCachedIamToken, mergeImplicitMantleProvider, resolveImplicitMantleProvider, resolveMantleBearerToken, resolveMantleRuntimeBearerToken };
|
package/dist/discovery.js
CHANGED
|
@@ -75,6 +75,10 @@ function resolveMantleBearerToken(env = process.env) {
|
|
|
75
75
|
}
|
|
76
76
|
/** Token cache for IAM-derived bearer tokens, keyed by region. */
|
|
77
77
|
const iamTokenCache = /* @__PURE__ */ new Map();
|
|
78
|
+
/** Last emitted IAM token failure per region, retained until token generation succeeds. */
|
|
79
|
+
const iamTokenFailureDetailByRegion = /* @__PURE__ */ new Map();
|
|
80
|
+
/** Success epoch per region; failures spanning a recovery cannot restore stale diagnostics. */
|
|
81
|
+
const iamTokenSuccessEpochByRegion = /* @__PURE__ */ new Map();
|
|
78
82
|
const IAM_TOKEN_TTL_MS = 72e5;
|
|
79
83
|
function resolveMantleRegion(env) {
|
|
80
84
|
return normalizeOptionalString(env.AWS_REGION) ?? normalizeOptionalString(env.AWS_DEFAULT_REGION) ?? "us-east-1";
|
|
@@ -94,6 +98,7 @@ async function generateBearerTokenFromIam(params) {
|
|
|
94
98
|
const now = params.now?.() ?? Date.now();
|
|
95
99
|
const cached = getCachedIamTokenEntry(params.region, now);
|
|
96
100
|
if (cached) return cached.token;
|
|
101
|
+
const successEpoch = iamTokenSuccessEpochByRegion.get(params.region) ?? 0;
|
|
97
102
|
try {
|
|
98
103
|
const token = await (params.tokenProviderFactory ?? await loadMantleBearerTokenProviderFactory())({
|
|
99
104
|
region: params.region,
|
|
@@ -104,12 +109,21 @@ async function generateBearerTokenFromIam(params) {
|
|
|
104
109
|
token,
|
|
105
110
|
expiresAt
|
|
106
111
|
});
|
|
112
|
+
iamTokenSuccessEpochByRegion.set(params.region, (iamTokenSuccessEpochByRegion.get(params.region) ?? 0) + 1);
|
|
113
|
+
iamTokenFailureDetailByRegion.delete(params.region);
|
|
107
114
|
return token;
|
|
108
115
|
} catch (error) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
116
|
+
if (successEpoch !== (iamTokenSuccessEpochByRegion.get(params.region) ?? 0)) return;
|
|
117
|
+
if (log.isEnabled("debug")) {
|
|
118
|
+
const errorMessage = formatErrorMessage(error);
|
|
119
|
+
if (iamTokenFailureDetailByRegion.get(params.region) !== errorMessage) {
|
|
120
|
+
iamTokenFailureDetailByRegion.set(params.region, errorMessage);
|
|
121
|
+
log.debug("Mantle IAM token generation unavailable", {
|
|
122
|
+
region: params.region,
|
|
123
|
+
error: errorMessage
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
113
127
|
return;
|
|
114
128
|
}
|
|
115
129
|
}
|
|
@@ -145,10 +159,6 @@ async function resolveMantleRuntimeBearerToken(params) {
|
|
|
145
159
|
...expiresAt === void 0 ? {} : { expiresAt }
|
|
146
160
|
};
|
|
147
161
|
}
|
|
148
|
-
/** Clear the IAM token cache for tests. */
|
|
149
|
-
function resetIamTokenCacheForTest() {
|
|
150
|
-
iamTokenCache.clear();
|
|
151
|
-
}
|
|
152
162
|
/** Model ID substrings that indicate reasoning/thinking support. */
|
|
153
163
|
const REASONING_PATTERNS = [
|
|
154
164
|
"thinking",
|
|
@@ -173,10 +183,6 @@ async function readMantleModelDiscoveryJson(response) {
|
|
|
173
183
|
return body;
|
|
174
184
|
}
|
|
175
185
|
const discoveryCache = /* @__PURE__ */ new Map();
|
|
176
|
-
/** Clear the Mantle discovery cache for tests. */
|
|
177
|
-
function resetMantleDiscoveryCacheForTest() {
|
|
178
|
-
discoveryCache.clear();
|
|
179
|
-
}
|
|
180
186
|
/**
|
|
181
187
|
* Discover available models from the Mantle `/v1/models` endpoint.
|
|
182
188
|
*
|
|
@@ -388,4 +394,4 @@ function mergeImplicitMantleProvider(params) {
|
|
|
388
394
|
};
|
|
389
395
|
}
|
|
390
396
|
//#endregion
|
|
391
|
-
export { MANTLE_IAM_TOKEN_MARKER, discoverMantleModels, generateBearerTokenFromIam, getCachedIamToken, mergeImplicitMantleProvider,
|
|
397
|
+
export { MANTLE_IAM_TOKEN_MARKER, discoverMantleModels, generateBearerTokenFromIam, getCachedIamToken, mergeImplicitMantleProvider, resolveImplicitMantleProvider, resolveMantleBearerToken, resolveMantleRuntimeBearerToken, resolveMantleSonnet5Cost };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { requiresClaudeDefaultSampling, resolveClaudeMythos5ModelIdentity, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet5ModelIdentity } from "openclaw/plugin-sdk/provider-model-shared";
|
|
2
2
|
import Anthropic from "@anthropic-ai/sdk";
|
|
3
3
|
import { stream } from "openclaw/plugin-sdk/llm";
|
|
4
|
-
import { buildGuardedModelFetch } from "openclaw/plugin-sdk/provider-transport-runtime";
|
|
4
|
+
import { buildGuardedModelFetch, copyProviderAcceptanceObserver } from "openclaw/plugin-sdk/provider-transport-runtime";
|
|
5
5
|
//#region extensions/amazon-bedrock-mantle/mantle-anthropic.runtime.ts
|
|
6
6
|
/**
|
|
7
7
|
* Anthropic Messages stream adapter for Bedrock Mantle. It rewrites Mantle
|
|
@@ -61,7 +61,7 @@ function mergeHeaders(...headerSources) {
|
|
|
61
61
|
return merged;
|
|
62
62
|
}
|
|
63
63
|
function buildMantleAnthropicBaseOptions(model, options, apiKey) {
|
|
64
|
-
return {
|
|
64
|
+
return copyProviderAcceptanceObserver(options, {
|
|
65
65
|
...requiresDefaultSampling(model) ? {} : { temperature: options?.temperature },
|
|
66
66
|
maxTokens: options?.maxTokens || (isClaudeOpus5Model(model) || isClaudeSonnet5Model(model) || isClaudeMythos5Model(model) ? model.maxTokens : Math.min(model.maxTokens, 32e3)),
|
|
67
67
|
signal: options?.signal,
|
|
@@ -69,9 +69,10 @@ function buildMantleAnthropicBaseOptions(model, options, apiKey) {
|
|
|
69
69
|
cacheRetention: options?.cacheRetention,
|
|
70
70
|
sessionId: options?.sessionId,
|
|
71
71
|
onPayload: options?.onPayload,
|
|
72
|
+
onResponse: options?.onResponse,
|
|
72
73
|
maxRetryDelayMs: options?.maxRetryDelayMs,
|
|
73
74
|
metadata: options?.metadata
|
|
74
|
-
};
|
|
75
|
+
});
|
|
75
76
|
}
|
|
76
77
|
function adjustMaxTokensForThinking(baseMaxTokens, modelMaxTokens, reasoningLevel, customBudgets) {
|
|
77
78
|
const budgets = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/amazon-bedrock-mantle-provider",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.8.1-beta.3",
|
|
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.
|
|
24
|
+
"pluginApi": ">=2026.8.1-beta.3"
|
|
25
25
|
},
|
|
26
26
|
"build": {
|
|
27
|
-
"openclawVersion": "2026.
|
|
27
|
+
"openclawVersion": "2026.8.1-beta.3",
|
|
28
28
|
"bundledDist": false
|
|
29
29
|
},
|
|
30
30
|
"release": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"README.md"
|
|
42
42
|
],
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"openclaw": ">=2026.
|
|
44
|
+
"openclaw": ">=2026.8.1-beta.3"
|
|
45
45
|
},
|
|
46
46
|
"peerDependenciesMeta": {
|
|
47
47
|
"openclaw": {
|