@joshuaswarren/openclaw-engram 9.1.18 → 9.1.20
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/access-cli.js +4 -4
- package/dist/{calibration-WQM24F3Z.js → calibration-TJ7P7AMM.js} +2 -2
- package/dist/{causal-consolidation-GNGU4MUV.js → causal-consolidation-6XMSTBBR.js} +2 -2
- package/dist/{chunk-IEFSMVQV.js → chunk-NHDZWU4W.js} +4 -4
- package/dist/{chunk-AVOL6JGC.js → chunk-QDI2YGSG.js} +96 -168
- package/dist/chunk-QDI2YGSG.js.map +1 -0
- package/dist/{chunk-DTCQ2KEX.js → chunk-Y6DMH5LN.js} +1 -1
- package/dist/{chunk-DTCQ2KEX.js.map → chunk-Y6DMH5LN.js.map} +1 -1
- package/dist/{chunk-HOO364J6.js → chunk-YZSCPLSA.js} +6 -6
- package/dist/{engine-CNQZ35RB.js → engine-DPYHMPX4.js} +3 -3
- package/dist/{fallback-llm-GF6NMVWP.js → fallback-llm-2RS4HGWS.js} +2 -2
- package/dist/index.js +7 -7
- package/dist/{storage-GSXR3Q63.js → storage-PK7DDBRU.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-AVOL6JGC.js.map +0 -1
- /package/dist/{calibration-WQM24F3Z.js.map → calibration-TJ7P7AMM.js.map} +0 -0
- /package/dist/{causal-consolidation-GNGU4MUV.js.map → causal-consolidation-6XMSTBBR.js.map} +0 -0
- /package/dist/{chunk-IEFSMVQV.js.map → chunk-NHDZWU4W.js.map} +0 -0
- /package/dist/{chunk-HOO364J6.js.map → chunk-YZSCPLSA.js.map} +0 -0
- /package/dist/{engine-CNQZ35RB.js.map → engine-DPYHMPX4.js.map} +0 -0
- /package/dist/{fallback-llm-GF6NMVWP.js.map → fallback-llm-2RS4HGWS.js.map} +0 -0
- /package/dist/{storage-GSXR3Q63.js.map → storage-PK7DDBRU.js.map} +0 -0
package/dist/access-cli.js
CHANGED
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
EngramAccessService,
|
|
4
4
|
Orchestrator,
|
|
5
5
|
parseConfig
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-YZSCPLSA.js";
|
|
7
|
+
import "./chunk-NHDZWU4W.js";
|
|
8
8
|
import "./chunk-IMMYYNXG.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-Y6DMH5LN.js";
|
|
10
10
|
import "./chunk-6KX4XLQJ.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-QDI2YGSG.js";
|
|
12
12
|
import "./chunk-MKM2BCQH.js";
|
|
13
13
|
import "./chunk-DEIBZP3O.js";
|
|
14
14
|
import "./chunk-SSIIJJKA.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// openclaw-engram: Local-first memory plugin
|
|
2
2
|
import {
|
|
3
3
|
FallbackLlmClient
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QDI2YGSG.js";
|
|
5
5
|
import {
|
|
6
6
|
listJsonFiles
|
|
7
7
|
} from "./chunk-DEIBZP3O.js";
|
|
@@ -233,4 +233,4 @@ export {
|
|
|
233
233
|
runCalibrationIfEnabled,
|
|
234
234
|
synthesizeCalibrationRules
|
|
235
235
|
};
|
|
236
|
-
//# sourceMappingURL=calibration-
|
|
236
|
+
//# sourceMappingURL=calibration-TJ7P7AMM.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// openclaw-engram: Local-first memory plugin
|
|
2
2
|
import {
|
|
3
3
|
FallbackLlmClient
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QDI2YGSG.js";
|
|
5
5
|
import {
|
|
6
6
|
readChainIndex,
|
|
7
7
|
resolveChainsDir
|
|
@@ -203,4 +203,4 @@ export {
|
|
|
203
203
|
deriveCausalPromotionCandidates,
|
|
204
204
|
synthesizeCausalPreferencesViaLlm
|
|
205
205
|
};
|
|
206
|
-
//# sourceMappingURL=causal-consolidation-
|
|
206
|
+
//# sourceMappingURL=causal-consolidation-6XMSTBBR.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
parseContinuityImprovementLoops,
|
|
5
5
|
parseContinuityIncident,
|
|
6
6
|
sanitizeMemoryContent
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-Y6DMH5LN.js";
|
|
8
8
|
import {
|
|
9
9
|
log
|
|
10
10
|
} from "./chunk-SSIIJJKA.js";
|
|
@@ -830,7 +830,7 @@ var CompoundingEngine = class {
|
|
|
830
830
|
let promotionCandidates = this.config.compoundingSemanticEnabled ? this.derivePromotionCandidates(outcomeSummary, mistakes.registry, rubrics) : [];
|
|
831
831
|
if (this.config.cmcConsolidationEnabled) {
|
|
832
832
|
try {
|
|
833
|
-
const { deriveCausalPromotionCandidates } = await import("./causal-consolidation-
|
|
833
|
+
const { deriveCausalPromotionCandidates } = await import("./causal-consolidation-6XMSTBBR.js");
|
|
834
834
|
const causalCandidates = await deriveCausalPromotionCandidates({
|
|
835
835
|
memoryDir: this.config.memoryDir,
|
|
836
836
|
causalTrajectoryStoreDir: this.config.causalTrajectoryStoreDir,
|
|
@@ -851,7 +851,7 @@ var CompoundingEngine = class {
|
|
|
851
851
|
}
|
|
852
852
|
if (this.config.calibrationEnabled) {
|
|
853
853
|
try {
|
|
854
|
-
const { runCalibrationConsolidation } = await import("./calibration-
|
|
854
|
+
const { runCalibrationConsolidation } = await import("./calibration-TJ7P7AMM.js");
|
|
855
855
|
const calRules = await runCalibrationConsolidation({
|
|
856
856
|
memoryDir: this.config.memoryDir,
|
|
857
857
|
gatewayConfig: this.config.gatewayConfig,
|
|
@@ -1839,4 +1839,4 @@ export {
|
|
|
1839
1839
|
defaultTierMigrationCycleBudget,
|
|
1840
1840
|
CompoundingEngine
|
|
1841
1841
|
};
|
|
1842
|
-
//# sourceMappingURL=chunk-
|
|
1842
|
+
//# sourceMappingURL=chunk-NHDZWU4W.js.map
|
|
@@ -95,200 +95,132 @@ function buildChatCompletionTokenLimit(model, maxTokens, options) {
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
// src/resolve-provider-secret.ts
|
|
98
|
-
import { execFileSync } from "child_process";
|
|
99
|
-
import { readFileSync, existsSync } from "fs";
|
|
100
98
|
import path from "path";
|
|
101
99
|
import os from "os";
|
|
100
|
+
var _resolveApiKeyForProvider = null;
|
|
101
|
+
var _resolverLoaded = false;
|
|
102
102
|
var resolvedCache = /* @__PURE__ */ new Map();
|
|
103
|
-
async function
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
-
return resolveSecretRefManaged(providerId, gatewayConfig);
|
|
107
|
-
}
|
|
108
|
-
if (apiKeyValue.endsWith("-oauth") || apiKeyValue.endsWith("-local") || apiKeyValue === "lm-studio" || apiKeyValue.startsWith("gcp-")) {
|
|
109
|
-
return void 0;
|
|
110
|
-
}
|
|
111
|
-
return apiKeyValue;
|
|
112
|
-
}
|
|
113
|
-
if (isSecretRefObject(apiKeyValue)) {
|
|
114
|
-
return resolveSecretRef(providerId, apiKeyValue);
|
|
103
|
+
async function getGatewayResolver() {
|
|
104
|
+
if (_resolverLoaded) {
|
|
105
|
+
return _resolveApiKeyForProvider;
|
|
115
106
|
}
|
|
116
|
-
return void 0;
|
|
117
|
-
}
|
|
118
|
-
function isSecretRefObject(value) {
|
|
119
|
-
return typeof value === "object" && value !== null && "source" in value && "id" in value && typeof value.source === "string" && typeof value.id === "string";
|
|
120
|
-
}
|
|
121
|
-
async function resolveSecretRef(providerId, ref) {
|
|
122
|
-
const cacheKey = `ref:${ref.source}:${ref.provider ?? ""}:${ref.id}:${ref.command ?? ""}:${(ref.args ?? []).join(",")}`;
|
|
123
|
-
const cached = resolvedCache.get(cacheKey);
|
|
124
|
-
if (cached !== void 0) {
|
|
125
|
-
if (cached !== null) return cached;
|
|
126
|
-
}
|
|
127
|
-
let resolved;
|
|
128
107
|
try {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
108
|
+
const candidates = [
|
|
109
|
+
// Try glob-matching the runtime module name (hash varies per build)
|
|
110
|
+
...await findRuntimeModules()
|
|
111
|
+
];
|
|
112
|
+
const { pathToFileURL } = await import("url");
|
|
113
|
+
for (const candidate of candidates) {
|
|
114
|
+
try {
|
|
115
|
+
const importUrl = pathToFileURL(candidate).href;
|
|
116
|
+
const mod = await import(importUrl);
|
|
117
|
+
if (typeof mod.resolveApiKeyForProvider === "function") {
|
|
118
|
+
_resolveApiKeyForProvider = mod.resolveApiKeyForProvider;
|
|
119
|
+
_resolverLoaded = true;
|
|
120
|
+
log.debug("loaded gateway resolveApiKeyForProvider from runtime module");
|
|
121
|
+
return _resolveApiKeyForProvider;
|
|
122
|
+
}
|
|
123
|
+
} catch {
|
|
124
|
+
}
|
|
139
125
|
}
|
|
140
|
-
} catch
|
|
141
|
-
log.warn(
|
|
142
|
-
`secret resolution failed for provider "${providerId}" (${ref.source}/${ref.provider}): ${err instanceof Error ? err.message : String(err)}`
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
if (resolved) {
|
|
146
|
-
resolvedCache.set(cacheKey, resolved);
|
|
147
|
-
}
|
|
148
|
-
if (resolved) {
|
|
149
|
-
log.debug(`resolved API key for provider "${providerId}" via ${ref.source}/${ref.provider ?? "default"}`);
|
|
126
|
+
} catch {
|
|
150
127
|
}
|
|
151
|
-
|
|
128
|
+
log.debug("gateway resolveApiKeyForProvider not available \u2014 will retry on next call");
|
|
129
|
+
return null;
|
|
152
130
|
}
|
|
153
|
-
function
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
const args = ref.args ?? (ref.provider === "op" ? ["read", ref.id] : [ref.id]);
|
|
131
|
+
async function findRuntimeModules() {
|
|
132
|
+
const { readdirSync } = await import("fs");
|
|
133
|
+
const { createRequire } = await import("module");
|
|
134
|
+
const candidates = [];
|
|
135
|
+
const distDirs = [];
|
|
160
136
|
try {
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
return result || void 0;
|
|
167
|
-
} catch (err) {
|
|
168
|
-
log.warn(`exec secret resolution failed (${command}): ${err instanceof Error ? err.message : String(err)}`);
|
|
169
|
-
return void 0;
|
|
137
|
+
const req = createRequire(import.meta.url);
|
|
138
|
+
const openclawMain = req.resolve("openclaw");
|
|
139
|
+
const openclawDist = path.join(path.dirname(openclawMain), "..", "dist");
|
|
140
|
+
if (openclawDist) distDirs.push(path.resolve(openclawDist));
|
|
141
|
+
} catch {
|
|
170
142
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
} catch {
|
|
143
|
+
try {
|
|
144
|
+
const { realpathSync } = await import("fs");
|
|
145
|
+
const mainScript = process.argv[1];
|
|
146
|
+
if (mainScript) {
|
|
147
|
+
const realScript = realpathSync(mainScript);
|
|
148
|
+
if (realScript.includes("openclaw")) {
|
|
149
|
+
const distDir = path.dirname(realScript);
|
|
150
|
+
if (!distDirs.includes(distDir)) distDirs.push(distDir);
|
|
180
151
|
}
|
|
181
152
|
}
|
|
153
|
+
} catch {
|
|
154
|
+
}
|
|
155
|
+
for (const dir of distDirs) {
|
|
182
156
|
try {
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
return result || void 0;
|
|
189
|
-
} catch {
|
|
190
|
-
}
|
|
191
|
-
} else {
|
|
192
|
-
const filePath = path.isAbsolute(ref.id) ? ref.id : path.join(os.homedir(), ".openclaw", "secrets", ref.id.replace(/^\//, ""));
|
|
193
|
-
if (existsSync(filePath)) {
|
|
194
|
-
try {
|
|
195
|
-
return readFileSync(filePath, "utf-8").trim() || void 0;
|
|
196
|
-
} catch {
|
|
157
|
+
const files = readdirSync(dir);
|
|
158
|
+
for (const f of files) {
|
|
159
|
+
if (f.startsWith("runtime-model-auth.runtime-") && f.endsWith(".js")) {
|
|
160
|
+
candidates.push(path.join(dir, f));
|
|
161
|
+
}
|
|
197
162
|
}
|
|
163
|
+
} catch {
|
|
198
164
|
}
|
|
199
165
|
}
|
|
200
|
-
return
|
|
166
|
+
return candidates;
|
|
201
167
|
}
|
|
202
|
-
function
|
|
203
|
-
const cacheKey = `
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
return cached;
|
|
168
|
+
async function resolveProviderApiKey(providerId, apiKeyValue, gatewayConfig, agentDir) {
|
|
169
|
+
const cacheKey = `provider:${providerId}`;
|
|
170
|
+
if (resolvedCache.has(cacheKey)) {
|
|
171
|
+
return resolvedCache.get(cacheKey);
|
|
207
172
|
}
|
|
208
173
|
let resolved;
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
];
|
|
216
|
-
for (const profileKey of candidates) {
|
|
217
|
-
const raw = profiles[profileKey];
|
|
218
|
-
if (!raw || typeof raw !== "object") continue;
|
|
219
|
-
const profile = raw;
|
|
220
|
-
if (profile.token) {
|
|
221
|
-
if (typeof profile.token === "string" && !profile.token.startsWith("{")) {
|
|
222
|
-
resolved = profile.token;
|
|
223
|
-
break;
|
|
224
|
-
}
|
|
225
|
-
if (isSecretRefObject(profile.token)) {
|
|
226
|
-
try {
|
|
227
|
-
resolved = resolveSecretRefSync(providerId, profile.token);
|
|
228
|
-
} catch {
|
|
229
|
-
}
|
|
230
|
-
if (resolved) break;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
if (profile.apiKey && typeof profile.apiKey === "string") {
|
|
234
|
-
resolved = profile.apiKey;
|
|
235
|
-
break;
|
|
236
|
-
}
|
|
237
|
-
if (profile.access && typeof profile.access === "string") {
|
|
238
|
-
resolved = profile.access;
|
|
239
|
-
break;
|
|
240
|
-
}
|
|
174
|
+
if (typeof apiKeyValue === "string" && apiKeyValue.trim().length > 0) {
|
|
175
|
+
if (apiKeyValue === "secretref-managed" || apiKeyValue.endsWith("-oauth") || apiKeyValue.endsWith("-local") || apiKeyValue === "lm-studio" || apiKeyValue.startsWith("gcp-")) {
|
|
176
|
+
} else {
|
|
177
|
+
resolved = apiKeyValue;
|
|
178
|
+
resolvedCache.set(cacheKey, resolved);
|
|
179
|
+
return resolved;
|
|
241
180
|
}
|
|
242
181
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
resolved
|
|
251
|
-
|
|
182
|
+
const resolver = await getGatewayResolver();
|
|
183
|
+
if (resolver) {
|
|
184
|
+
try {
|
|
185
|
+
const resolvedAgentDir = agentDir ?? path.join(os.homedir(), ".openclaw", "agents", "main", "agent");
|
|
186
|
+
const auth = await resolver({ provider: providerId, cfg: gatewayConfig, agentDir: resolvedAgentDir });
|
|
187
|
+
if (auth?.apiKey) {
|
|
188
|
+
resolved = auth.apiKey;
|
|
189
|
+
log.debug(`resolved API key for provider "${providerId}" via gateway auth (source: ${auth.source ?? "unknown"}, mode: ${auth.mode ?? "unknown"})`);
|
|
190
|
+
resolvedCache.set(cacheKey, resolved);
|
|
191
|
+
return resolved;
|
|
252
192
|
}
|
|
193
|
+
} catch (err) {
|
|
194
|
+
log.debug(
|
|
195
|
+
`gateway auth resolution failed for provider "${providerId}": ${err instanceof Error ? err.message : String(err)}`
|
|
196
|
+
);
|
|
253
197
|
}
|
|
254
198
|
}
|
|
199
|
+
resolved = resolveFromEnv(providerId);
|
|
255
200
|
if (resolved) {
|
|
256
|
-
|
|
257
|
-
log.debug(`resolved managed API key for provider "${providerId}" via auth profile`);
|
|
201
|
+
log.debug(`resolved API key for provider "${providerId}" from environment variable`);
|
|
258
202
|
} else {
|
|
259
|
-
log.debug(`could not resolve
|
|
260
|
-
}
|
|
261
|
-
return resolved;
|
|
262
|
-
}
|
|
263
|
-
function resolveSecretRefSync(providerId, ref) {
|
|
264
|
-
const cacheKey = `ref:${ref.source}:${ref.provider ?? ""}:${ref.id}:${ref.command ?? ""}:${(ref.args ?? []).join(",")}`;
|
|
265
|
-
const cached = resolvedCache.get(cacheKey);
|
|
266
|
-
if (cached !== void 0 && cached !== null) {
|
|
267
|
-
return cached;
|
|
268
|
-
}
|
|
269
|
-
let resolved;
|
|
270
|
-
try {
|
|
271
|
-
switch (ref.source) {
|
|
272
|
-
case "exec":
|
|
273
|
-
resolved = resolveExecSecret(ref);
|
|
274
|
-
break;
|
|
275
|
-
case "file":
|
|
276
|
-
resolved = resolveFileSecret(ref);
|
|
277
|
-
break;
|
|
278
|
-
case "env":
|
|
279
|
-
resolved = process.env[ref.id] ?? void 0;
|
|
280
|
-
break;
|
|
281
|
-
}
|
|
282
|
-
} catch (err) {
|
|
283
|
-
log.warn(
|
|
284
|
-
`sync secret resolution failed for provider "${providerId}": ${err instanceof Error ? err.message : String(err)}`
|
|
285
|
-
);
|
|
203
|
+
log.debug(`could not resolve API key for provider "${providerId}" \u2014 skipping`);
|
|
286
204
|
}
|
|
287
205
|
if (resolved) {
|
|
288
206
|
resolvedCache.set(cacheKey, resolved);
|
|
289
207
|
}
|
|
290
208
|
return resolved;
|
|
291
209
|
}
|
|
210
|
+
function resolveFromEnv(providerId) {
|
|
211
|
+
const normalized = providerId.toUpperCase().replace(/[^A-Z0-9]/g, "_");
|
|
212
|
+
const candidates = [
|
|
213
|
+
`${normalized}_API_KEY`,
|
|
214
|
+
`${normalized}_TOKEN`
|
|
215
|
+
];
|
|
216
|
+
for (const envVar of candidates) {
|
|
217
|
+
const value = process.env[envVar];
|
|
218
|
+
if (value && value.trim().length > 0) {
|
|
219
|
+
return value.trim();
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return void 0;
|
|
223
|
+
}
|
|
292
224
|
|
|
293
225
|
// src/fallback-llm.ts
|
|
294
226
|
var FallbackLlmClient = class {
|
|
@@ -461,11 +393,7 @@ var FallbackLlmClient = class {
|
|
|
461
393
|
* Results are cached per provider so exec calls only happen once.
|
|
462
394
|
*/
|
|
463
395
|
async resolveApiKey(providerId, providerConfig) {
|
|
464
|
-
return resolveProviderApiKey(
|
|
465
|
-
providerId,
|
|
466
|
-
providerConfig.apiKey,
|
|
467
|
-
this.gatewayConfig
|
|
468
|
-
);
|
|
396
|
+
return resolveProviderApiKey(providerId, providerConfig.apiKey, this.gatewayConfig);
|
|
469
397
|
}
|
|
470
398
|
/**
|
|
471
399
|
* Try to call a single model.
|
|
@@ -597,4 +525,4 @@ export {
|
|
|
597
525
|
buildChatCompletionTokenLimit,
|
|
598
526
|
FallbackLlmClient
|
|
599
527
|
};
|
|
600
|
-
//# sourceMappingURL=chunk-
|
|
528
|
+
//# sourceMappingURL=chunk-QDI2YGSG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/json-extract.ts","../src/openai-chat-compat.ts","../src/resolve-provider-secret.ts","../src/fallback-llm.ts"],"sourcesContent":["/**\n * Utilities for extracting JSON payloads from LLM outputs.\n *\n * We see common failure modes:\n * - \"Here's an example: {..}\\nHere's the real answer: {..}\" (multiple JSON blocks)\n * - fenced ```json blocks\n * - leading/trailing prose around JSON\n *\n * These helpers attempt multiple candidates and let callers validate with schemas.\n */\n\nexport function stripCodeFences(text: string): string {\n return text.replace(/```(?:json)?\\s*([\\s\\S]*?)```/gi, (_m, inner) => String(inner).trim());\n}\n\nexport function extractJsonCandidates(text: string): string[] {\n const trimmed = text.trim();\n const cleaned = stripCodeFences(trimmed);\n const candidates: string[] = [];\n\n if (cleaned.length > 0) candidates.push(cleaned);\n candidates.push(...scanBalancedJsonBlocks(cleaned));\n\n // Legacy regex fallback (single object)\n const objMatch = cleaned.match(/\\{[\\s\\S]*\\}/);\n if (objMatch) candidates.push(objMatch[0]);\n\n const seen = new Set<string>();\n return candidates\n .map((c) => c.trim())\n .filter((c) => c.length > 0)\n .filter((c) => {\n if (seen.has(c)) return false;\n seen.add(c);\n return true;\n });\n}\n\nfunction scanBalancedJsonBlocks(text: string): string[] {\n const out: string[] = [];\n const opens = new Set([\"{\", \"[\"]);\n const closes: Record<string, string> = { \"{\": \"}\", \"[\": \"]\" };\n\n for (let i = 0; i < text.length; i++) {\n const start = text[i];\n if (!opens.has(start)) continue;\n\n const expectedClose = closes[start];\n let depth = 0;\n let inString = false;\n let escape = false;\n\n for (let j = i; j < text.length; j++) {\n const ch = text[j];\n\n if (inString) {\n if (escape) {\n escape = false;\n } else if (ch === \"\\\\\") {\n escape = true;\n } else if (ch === \"\\\"\") {\n inString = false;\n }\n continue;\n }\n\n if (ch === \"\\\"\") {\n inString = true;\n continue;\n }\n\n if (ch === start) depth++;\n if (ch === expectedClose) depth--;\n\n if (depth === 0) {\n out.push(text.slice(i, j + 1).trim());\n i = j;\n break;\n }\n }\n }\n\n return out;\n}\n\n","function normalizedModel(model: string): string {\n return model.trim().toLowerCase();\n}\n\nfunction matchesModelFamily(normalized: string, familyPattern: RegExp): boolean {\n return familyPattern.test(normalized);\n}\n\nexport function shouldAssumeOpenAiChatCompletions(baseUrl?: string): boolean {\n if (!baseUrl) return true;\n try {\n return new URL(baseUrl).hostname.toLowerCase() === \"api.openai.com\";\n } catch {\n return false;\n }\n}\n\nexport function usesMaxCompletionTokens(model: string, options?: { assumeOpenAI?: boolean }): boolean {\n const normalized = normalizedModel(model);\n if (options?.assumeOpenAI !== true) return false;\n if (matchesModelFamily(normalized, /^gpt-5(?:$|[-.])/)) return true;\n if (matchesModelFamily(normalized, /^gpt-4o(?:$|[-.])/)) return true;\n if (matchesModelFamily(normalized, /^gpt-4\\.1(?:$|[-.])/)) return true;\n if (matchesModelFamily(normalized, /^o1(?:$|[-.])/)) return true;\n if (matchesModelFamily(normalized, /^o3(?:$|[-.])/)) return true;\n return matchesModelFamily(normalized, /^o4-mini(?:$|[-.])/);\n}\n\nexport function buildChatCompletionTokenLimit(\n model: string,\n maxTokens: number,\n options?: { assumeOpenAI?: boolean },\n): { max_tokens: number } | { max_completion_tokens: number } {\n const safeMaxTokens = Math.max(0, Math.floor(maxTokens));\n if (usesMaxCompletionTokens(model, options)) {\n return { max_completion_tokens: safeMaxTokens };\n }\n return { max_tokens: safeMaxTokens };\n}\n","import { log } from \"./logger.js\";\nimport path from \"node:path\";\nimport os from \"node:os\";\n\n/**\n * Resolve a provider API key using OpenClaw's own auth resolution system.\n *\n * This module delegates to the gateway's `resolveApiKeyForProvider()` function,\n * which handles all secret reference formats (SecretRef objects, auth profiles,\n * \"secretref-managed\" markers, environment variables, etc.) using the same\n * codepath the gateway uses for its own agent sessions.\n *\n * For plain-text API keys, a fast path returns them directly without\n * involving the gateway auth system.\n *\n * Results are cached per provider for the gateway process lifetime.\n */\n\ntype ResolveApiKeyFn = (params: {\n provider: string;\n cfg?: unknown;\n agentDir?: string;\n}) => Promise<{ apiKey?: string; source?: string; mode?: string } | null>;\n\nlet _resolveApiKeyForProvider: ResolveApiKeyFn | null = null;\nlet _resolverLoaded = false;\nconst resolvedCache = new Map<string, string | undefined>();\n\n/**\n * Lazily load the gateway's resolveApiKeyForProvider function.\n * Returns null if not available (e.g., running outside the gateway process).\n */\nasync function getGatewayResolver(): Promise<ResolveApiKeyFn | null> {\n if (_resolverLoaded) {\n return _resolveApiKeyForProvider;\n }\n\n try {\n // The gateway bundles this in a runtime chunk — import it dynamically.\n // This import path is stable across gateway versions since it's a named runtime export.\n const candidates = [\n // Try glob-matching the runtime module name (hash varies per build)\n ...await findRuntimeModules(),\n ];\n\n const { pathToFileURL } = await import(\"node:url\");\n for (const candidate of candidates) {\n try {\n // Convert native path to file:// URL for cross-platform ESM import compatibility\n const importUrl = pathToFileURL(candidate).href;\n const mod = await import(importUrl);\n if (typeof mod.resolveApiKeyForProvider === \"function\") {\n _resolveApiKeyForProvider = mod.resolveApiKeyForProvider;\n _resolverLoaded = true;\n log.debug(\"loaded gateway resolveApiKeyForProvider from runtime module\");\n return _resolveApiKeyForProvider;\n }\n } catch {\n // Try next candidate\n }\n }\n } catch {\n // Silent\n }\n\n // Don't mark as loaded on failure — allow retry on next call\n // in case the gateway module becomes available after plugin init\n log.debug(\"gateway resolveApiKeyForProvider not available — will retry on next call\");\n return null;\n}\n\n/**\n * Find the gateway's model-auth runtime module by scanning the dist directory.\n * Uses require.resolve to find the openclaw package regardless of install method.\n */\nasync function findRuntimeModules(): Promise<string[]> {\n const { readdirSync } = await import(\"node:fs\");\n const { createRequire } = await import(\"node:module\");\n const candidates: string[] = [];\n\n // Discover the openclaw dist directory from the installed package,\n // regardless of how it was installed (Homebrew, npm global, local, etc.)\n const distDirs: string[] = [];\n\n try {\n // require.resolve finds the package from the current process context\n const req = createRequire(import.meta.url);\n const openclawMain = req.resolve(\"openclaw\");\n const openclawDist = path.join(path.dirname(openclawMain), \"..\", \"dist\");\n if (openclawDist) distDirs.push(path.resolve(openclawDist));\n } catch {\n // openclaw not resolvable from plugin context — try alternate paths\n }\n\n // Fallback: infer from the running process (gateway runs from its own dist/)\n // Use fs.realpathSync to resolve symlinks (e.g., /usr/local/bin/openclaw → actual path)\n try {\n const { realpathSync } = await import(\"node:fs\");\n const mainScript = process.argv[1];\n if (mainScript) {\n const realScript = realpathSync(mainScript);\n if (realScript.includes(\"openclaw\")) {\n const distDir = path.dirname(realScript);\n if (!distDirs.includes(distDir)) distDirs.push(distDir);\n }\n }\n } catch {\n // Silent\n }\n\n for (const dir of distDirs) {\n try {\n const files = readdirSync(dir);\n for (const f of files) {\n if (f.startsWith(\"runtime-model-auth.runtime-\") && f.endsWith(\".js\")) {\n candidates.push(path.join(dir, f));\n }\n }\n } catch {\n // Directory doesn't exist — skip\n }\n }\n\n return candidates;\n}\n\n/**\n * Resolve a provider API key from various OpenClaw formats.\n *\n * Resolution order:\n * 1. Plain-text string → returned immediately\n * 2. Gateway's resolveApiKeyForProvider → handles all secret ref formats\n * 3. Environment variable fallback (PROVIDER_NAME_API_KEY)\n * 4. undefined → provider is skipped in the fallback chain\n */\nexport async function resolveProviderApiKey(\n providerId: string,\n apiKeyValue: unknown,\n gatewayConfig?: unknown,\n agentDir?: string,\n): Promise<string | undefined> {\n // Check cache first\n const cacheKey = `provider:${providerId}`;\n if (resolvedCache.has(cacheKey)) {\n return resolvedCache.get(cacheKey);\n }\n\n let resolved: string | undefined;\n\n // Fast path: plain-text string that looks like an actual API key\n if (typeof apiKeyValue === \"string\" && apiKeyValue.trim().length > 0) {\n // Skip known non-API-key markers used by the gateway for auth modes\n // that don't use bearer tokens (OAuth, local endpoints, GCP credentials)\n if (\n apiKeyValue === \"secretref-managed\" ||\n apiKeyValue.endsWith(\"-oauth\") ||\n apiKeyValue.endsWith(\"-local\") ||\n apiKeyValue === \"lm-studio\" ||\n apiKeyValue.startsWith(\"gcp-\")\n ) {\n // Fall through to gateway resolver / env var fallback\n } else {\n resolved = apiKeyValue;\n resolvedCache.set(cacheKey, resolved);\n return resolved;\n }\n }\n\n // The API key is either a SecretRef object, \"secretref-managed\", or empty.\n // Try the gateway's own auth resolution system first.\n const resolver = await getGatewayResolver();\n if (resolver) {\n try {\n const resolvedAgentDir = agentDir ?? path.join(os.homedir(), \".openclaw\", \"agents\", \"main\", \"agent\");\n const auth = await resolver({ provider: providerId, cfg: gatewayConfig, agentDir: resolvedAgentDir });\n if (auth?.apiKey) {\n resolved = auth.apiKey;\n log.debug(`resolved API key for provider \"${providerId}\" via gateway auth (source: ${auth.source ?? \"unknown\"}, mode: ${auth.mode ?? \"unknown\"})`);\n resolvedCache.set(cacheKey, resolved);\n return resolved;\n }\n } catch (err) {\n log.debug(\n `gateway auth resolution failed for provider \"${providerId}\": ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n }\n\n // Environment variable fallback\n resolved = resolveFromEnv(providerId);\n if (resolved) {\n log.debug(`resolved API key for provider \"${providerId}\" from environment variable`);\n } else {\n log.debug(`could not resolve API key for provider \"${providerId}\" — skipping`);\n }\n\n // Only cache successful resolutions — failures are retried on next call\n // so providers can recover after transient issues (e.g., 1Password agent restart)\n if (resolved) {\n resolvedCache.set(cacheKey, resolved);\n }\n return resolved;\n}\n\n/**\n * Try to resolve an API key from environment variables.\n */\nfunction resolveFromEnv(providerId: string): string | undefined {\n const normalized = providerId.toUpperCase().replace(/[^A-Z0-9]/g, \"_\");\n const candidates = [\n `${normalized}_API_KEY`,\n `${normalized}_TOKEN`,\n ];\n for (const envVar of candidates) {\n const value = process.env[envVar];\n if (value && value.trim().length > 0) {\n return value.trim();\n }\n }\n return undefined;\n}\n\n/**\n * Clear the resolution cache (useful for testing or key rotation).\n */\nexport function clearSecretCache(): void {\n resolvedCache.clear();\n _resolveApiKeyForProvider = null;\n _resolverLoaded = false;\n}\n","import { log } from \"./logger.js\";\nimport type { GatewayConfig, ModelProviderConfig, AgentPersona } from \"./types.js\";\nimport { extractJsonCandidates } from \"./json-extract.js\";\nimport {\n buildChatCompletionTokenLimit,\n shouldAssumeOpenAiChatCompletions,\n} from \"./openai-chat-compat.js\";\nimport { resolveProviderApiKey } from \"./resolve-provider-secret.js\";\n\nexport interface FallbackLlmOptions {\n temperature?: number;\n maxTokens?: number;\n timeoutMs?: number;\n /** Override which agent persona's model chain to use (by ID from agents.list[]). */\n agentId?: string;\n}\n\nexport interface FallbackLlmResponse {\n content: string;\n modelUsed: string;\n usage?: {\n inputTokens?: number;\n outputTokens?: number;\n totalTokens?: number;\n };\n}\n\ninterface ModelRef {\n providerId: string;\n modelId: string;\n providerConfig: ModelProviderConfig;\n modelString: string;\n}\n\n/**\n * Generic fallback LLM client that uses the gateway's default AI configuration\n * and walks through the full fallback chain (primary + fallbacks).\n * Supports OpenAI and Anthropic API formats.\n */\nexport class FallbackLlmClient {\n private gatewayConfig: GatewayConfig | undefined;\n\n constructor(gatewayConfig?: GatewayConfig) {\n this.gatewayConfig = gatewayConfig;\n }\n\n /**\n * Check if fallback is available (gateway config has at least one model).\n */\n isAvailable(agentId?: string): boolean {\n const models = this.getModelChain(agentId);\n return models.length > 0;\n }\n\n /**\n * Make a chat completion request using the gateway's default AI chain.\n * Tries primary first, then each fallback in order.\n * When agentId is provided, uses that agent persona's model chain instead of defaults.\n */\n async chatCompletion(\n messages: Array<{ role: \"system\" | \"user\" | \"assistant\"; content: string }>,\n options: FallbackLlmOptions = {},\n ): Promise<FallbackLlmResponse | null> {\n const models = this.getModelChain(options.agentId);\n if (models.length === 0) {\n log.warn(\"fallback LLM: no models configured in gateway\");\n return null;\n }\n\n const runChain = async (): Promise<FallbackLlmResponse | null> => {\n // Try each model in the chain\n for (let i = 0; i < models.length; i++) {\n const model = models[i];\n const isFallback = i > 0;\n\n try {\n const result = await this.tryModel(model, messages, options);\n if (result) {\n if (isFallback) {\n log.info(`fallback LLM: succeeded using ${model.modelString} (fallback ${i})`);\n }\n return {\n content: result.content,\n modelUsed: model.modelString,\n usage: result.usage,\n };\n }\n } catch (err) {\n const errorMsg = err instanceof Error ? err.message : String(err);\n log.debug(`fallback LLM: ${model.modelString} failed (${errorMsg}), trying next...`);\n // Continue to next model in chain\n }\n }\n\n log.warn(`fallback LLM: all ${models.length} models in chain failed`);\n return null;\n };\n\n if (typeof options.timeoutMs === \"number\") {\n if (options.timeoutMs <= 0) {\n log.warn(\"fallback LLM: timed out before request started\");\n return null;\n }\n let timeoutHandle: ReturnType<typeof setTimeout> | undefined;\n try {\n return await Promise.race([\n runChain(),\n new Promise<null>((resolve) => {\n timeoutHandle = setTimeout(() => {\n log.warn(`fallback LLM: timed out after ${options.timeoutMs}ms`);\n resolve(null);\n }, options.timeoutMs);\n }),\n ]);\n } finally {\n if (timeoutHandle) clearTimeout(timeoutHandle);\n }\n }\n\n return await runChain();\n }\n\n /**\n * Make a request with structured output (Zod schema).\n * Returns parsed JSON or null on failure.\n */\n async parseWithSchema<T>(\n messages: Array<{ role: \"system\" | \"user\" | \"assistant\"; content: string }>,\n schema: { parse: (data: unknown) => T },\n options: FallbackLlmOptions = {},\n ): Promise<T | null> {\n const detailed = await this.parseWithSchemaDetailed(messages, schema, options);\n return detailed?.result ?? null;\n }\n\n /**\n * Like parseWithSchema but also returns the model that was used,\n * so callers can emit accurate trace events.\n */\n async parseWithSchemaDetailed<T>(\n messages: Array<{ role: \"system\" | \"user\" | \"assistant\"; content: string }>,\n schema: { parse: (data: unknown) => T },\n options: FallbackLlmOptions = {},\n ): Promise<{ result: T; modelUsed: string } | null> {\n const response = await this.chatCompletion(messages, options);\n if (!response?.content) return null;\n\n try {\n const candidates = extractJsonCandidates(response.content);\n for (const c of candidates) {\n try {\n const parsed = JSON.parse(c);\n return { result: schema.parse(parsed), modelUsed: response.modelUsed };\n } catch {\n // keep trying other candidates\n }\n }\n return null;\n } catch (err) {\n log.warn(\"fallback LLM: failed to parse structured output:\", err);\n return null;\n }\n }\n\n /**\n * Get the full model chain from gateway config.\n * Returns array of models in order: [primary, fallback1, fallback2, ...]\n *\n * When agentId is provided, looks up the matching entry in agents.list[]\n * and uses that persona's model chain. Falls back to agents.defaults.model\n * if agentId is not found or not provided.\n */\n private getModelChain(agentId?: string): ModelRef[] {\n const chain: ModelRef[] = [];\n const providers = this.gatewayConfig?.models?.providers;\n\n if (!providers) return chain;\n\n // Resolve the model config: agent persona chain or global defaults\n let modelConfig: { primary?: string; fallbacks?: string[] } | undefined;\n\n if (agentId) {\n const persona = this.gatewayConfig?.agents?.list?.find(\n (a) => a.id === agentId,\n );\n if (persona?.model) {\n modelConfig = persona.model;\n log.debug(`fallback LLM: using agent persona \"${agentId}\" model chain`);\n } else {\n log.warn(\n `fallback LLM: agent persona \"${agentId}\" not found or has no model config, falling back to defaults`,\n );\n }\n }\n\n if (!modelConfig) {\n modelConfig = this.gatewayConfig?.agents?.defaults?.model;\n }\n\n // Build list of model strings: primary + fallbacks\n const modelStrings: string[] = [];\n\n if (modelConfig?.primary) {\n modelStrings.push(modelConfig.primary);\n }\n\n if (Array.isArray(modelConfig?.fallbacks)) {\n for (const fb of modelConfig.fallbacks) {\n if (typeof fb === \"string\" && !modelStrings.includes(fb)) {\n modelStrings.push(fb);\n }\n }\n }\n\n // Parse each model string and look up provider config\n for (const modelString of modelStrings) {\n const modelRef = this.parseModelString(modelString, providers);\n if (modelRef) {\n chain.push(modelRef);\n }\n }\n\n return chain;\n }\n\n /**\n * Parse a \"provider/model\" string and look up its config.\n */\n private parseModelString(\n modelString: string,\n providers: Record<string, ModelProviderConfig>,\n ): ModelRef | null {\n // Parse \"provider/model\" format (e.g., \"openai/gpt-5.2\", \"anthropic/claude-opus-4-6\")\n const parts = modelString.split(\"/\");\n if (parts.length < 2) {\n log.warn(`fallback LLM: invalid model format: ${modelString}`);\n return null;\n }\n\n const providerId = parts[0];\n const modelId = parts.slice(1).join(\"/\"); // Handle cases like \"openai/gpt-5.2-turbo\"\n\n const providerConfig = providers[providerId];\n if (!providerConfig) {\n log.warn(`fallback LLM: provider not found: ${providerId}`);\n return null;\n }\n\n return { providerId, modelId, providerConfig, modelString };\n }\n\n /**\n * Resolve the API key for a provider, handling OpenClaw secret ref formats.\n * Results are cached per provider so exec calls only happen once.\n */\n private async resolveApiKey(\n providerId: string,\n providerConfig: ModelProviderConfig,\n ): Promise<string | undefined> {\n return resolveProviderApiKey(providerId, providerConfig.apiKey, this.gatewayConfig);\n }\n\n /**\n * Try to call a single model.\n */\n private async tryModel(\n model: ModelRef,\n messages: Array<{ role: \"system\" | \"user\" | \"assistant\"; content: string }>,\n options: FallbackLlmOptions,\n ): Promise<{ content: string; usage?: FallbackLlmResponse[\"usage\"] } | null> {\n // Resolve the API key from secret refs before making the call.\n // If the raw key looks like an unresolved secret ref and resolution fails,\n // skip this provider entirely so the chain falls through to the next.\n const rawKey = model.providerConfig.apiKey;\n const needsResolution = rawKey === \"secretref-managed\"\n || (typeof rawKey === \"object\" && rawKey !== null);\n const resolvedApiKey = await this.resolveApiKey(model.providerId, model.providerConfig);\n\n if (needsResolution && !resolvedApiKey) {\n throw new Error(`API key for provider \"${model.providerId}\" could not be resolved from secret ref`);\n }\n\n const configWithResolvedKey = resolvedApiKey\n ? { ...model.providerConfig, apiKey: resolvedApiKey }\n : model.providerConfig;\n\n switch (model.providerConfig.api) {\n case \"anthropic-messages\":\n return await this.callAnthropic(configWithResolvedKey, model.modelId, messages, options);\n case \"openai-completions\":\n default:\n return await this.callOpenAI(\n configWithResolvedKey,\n model.modelId,\n messages,\n options,\n shouldAssumeOpenAiChatCompletions(model.providerConfig.baseUrl),\n );\n }\n }\n\n /**\n * Call OpenAI-compatible API.\n */\n private async callOpenAI(\n config: ModelProviderConfig,\n modelId: string,\n messages: Array<{ role: \"system\" | \"user\" | \"assistant\"; content: string }>,\n options: FallbackLlmOptions,\n assumeOpenAI: boolean,\n ): Promise<{ content: string; usage?: FallbackLlmResponse[\"usage\"] } | null> {\n const base = config.baseUrl.replace(/\\/$/, \"\");\n const url = base.endsWith(\"/v1\")\n ? `${base}/chat/completions`\n : `${base}/v1/chat/completions`;\n\n const headers: Record<string, string> = {\n \"Content-Type\": \"application/json\",\n ...config.headers,\n };\n\n // Handle auth — apiKey is already resolved to a string by tryModel()\n if (config.apiKey && typeof config.apiKey === \"string\") {\n if (config.authHeader !== false) {\n headers[\"Authorization\"] = `Bearer ${config.apiKey}`;\n }\n }\n\n const body = {\n model: modelId,\n messages,\n temperature: options.temperature ?? 0.3,\n ...buildChatCompletionTokenLimit(modelId, options.maxTokens ?? 4096, {\n assumeOpenAI,\n }),\n };\n\n const response = await fetch(url, {\n method: \"POST\",\n headers,\n body: JSON.stringify(body),\n });\n\n if (!response.ok) {\n const error = await response.text();\n throw new Error(`OpenAI API error: ${response.status} ${error}`);\n }\n\n const data = (await response.json()) as {\n choices: Array<{\n message: {\n content: string;\n };\n }>;\n usage?: {\n prompt_tokens?: number;\n completion_tokens?: number;\n total_tokens?: number;\n };\n };\n\n const content = data.choices?.[0]?.message?.content;\n if (!content) {\n throw new Error(\"Empty response from OpenAI API\");\n }\n\n return {\n content,\n usage: data.usage\n ? {\n inputTokens: data.usage.prompt_tokens,\n outputTokens: data.usage.completion_tokens,\n totalTokens: data.usage.total_tokens,\n }\n : undefined,\n };\n }\n\n /**\n * Call Anthropic Messages API.\n */\n private async callAnthropic(\n config: ModelProviderConfig,\n modelId: string,\n messages: Array<{ role: \"system\" | \"user\" | \"assistant\"; content: string }>,\n options: FallbackLlmOptions,\n ): Promise<{ content: string; usage?: FallbackLlmResponse[\"usage\"] } | null> {\n const url = `${config.baseUrl.replace(/\\/$/, \"\")}/messages`;\n\n const headers: Record<string, string> = {\n \"Content-Type\": \"application/json\",\n \"anthropic-version\": \"2023-06-01\",\n ...config.headers,\n };\n\n // Handle auth - Anthropic uses x-api-key header (apiKey resolved by tryModel)\n if (config.apiKey && typeof config.apiKey === \"string\") {\n headers[\"x-api-key\"] = config.apiKey;\n }\n\n // Extract system message (Anthropic handles it separately)\n const systemMessage = messages.find((m) => m.role === \"system\")?.content;\n const nonSystemMessages = messages.filter((m) => m.role !== \"system\");\n\n // Convert messages to Anthropic format\n const anthropicMessages = nonSystemMessages.map((m) => ({\n role: m.role,\n content: m.content,\n }));\n\n const body: Record<string, unknown> = {\n model: modelId,\n messages: anthropicMessages,\n max_tokens: options.maxTokens ?? 4096,\n temperature: options.temperature ?? 0.3,\n };\n\n if (systemMessage) {\n body.system = systemMessage;\n }\n\n const response = await fetch(url, {\n method: \"POST\",\n headers,\n body: JSON.stringify(body),\n });\n\n if (!response.ok) {\n const error = await response.text();\n throw new Error(`Anthropic API error: ${response.status} ${error}`);\n }\n\n const data = (await response.json()) as {\n content: Array<{\n type: string;\n text: string;\n }>;\n usage?: {\n input_tokens?: number;\n output_tokens?: number;\n };\n };\n\n const content = data.content?.[0]?.text;\n if (!content) {\n throw new Error(\"Empty response from Anthropic API\");\n }\n\n return {\n content,\n usage: data.usage\n ? {\n inputTokens: data.usage.input_tokens,\n outputTokens: data.usage.output_tokens,\n totalTokens: (data.usage.input_tokens ?? 0) + (data.usage.output_tokens ?? 0),\n }\n : undefined,\n };\n }\n}\n"],"mappings":";;;;;;A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