nexus-agents 9.4.0 → 10.0.0
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/{ast-rule-runner-5U6TE6YJ.js → ast-rule-runner-AAOBENF2.js} +3 -3
- package/dist/{child-mcp-config-IR7LRMIK.js → child-mcp-config-FRWGQIHP.js} +2 -2
- package/dist/{chunk-DG2UY5QU.js → chunk-2VD5OQQR.js} +2 -2
- package/dist/{chunk-FTUBCD52.js → chunk-52Q72CPP.js} +3 -3
- package/dist/{chunk-TQEXRC5C.js → chunk-BDAR2UPN.js} +57 -151
- package/dist/chunk-BDAR2UPN.js.map +1 -0
- package/dist/{chunk-Q7RFJSR5.js → chunk-BJLP4E6Q.js} +3 -3
- package/dist/{chunk-Q5F4OBOK.js → chunk-BK6Q3VQK.js} +6 -42
- package/dist/chunk-BK6Q3VQK.js.map +1 -0
- package/dist/{chunk-ETGNAHY3.js → chunk-CYROSFMW.js} +5 -5
- package/dist/{chunk-FWSAYHGV.js → chunk-EGUISJBB.js} +4 -4
- package/dist/{chunk-ONWH4UGD.js → chunk-HBJ3CVDB.js} +54 -25
- package/dist/{chunk-ONWH4UGD.js.map → chunk-HBJ3CVDB.js.map} +1 -1
- package/dist/{chunk-XJ65J3O5.js → chunk-HVZVVDFN.js} +10 -6
- package/dist/chunk-HVZVVDFN.js.map +1 -0
- package/dist/{chunk-2AW2VHMK.js → chunk-IRFKJ2KR.js} +2 -2
- package/dist/{chunk-HK4LBUYY.js → chunk-K6M2ZWX5.js} +2 -2
- package/dist/{chunk-RI4IXOZT.js → chunk-KPGWNBDA.js} +2 -2
- package/dist/{chunk-6WPXQTQY.js → chunk-L4P4A7Z2.js} +2 -2
- package/dist/{chunk-P7327767.js → chunk-M4IJ3H6M.js} +2 -2
- package/dist/{chunk-FKMBZ53Y.js → chunk-MCWIMVG2.js} +2 -2
- package/dist/{chunk-JNRDNE26.js → chunk-MYM2TPNL.js} +2 -2
- package/dist/{chunk-TMHCN5EY.js → chunk-NUXSGWDS.js} +5 -5
- package/dist/{chunk-ONYCBTOH.js → chunk-O3VPGING.js} +11 -15
- package/dist/chunk-O3VPGING.js.map +1 -0
- package/dist/{chunk-AFAM6GK3.js → chunk-O46IOND3.js} +7 -7
- package/dist/{chunk-DYTB2XW2.js → chunk-O5OUJ3PX.js} +5 -5
- package/dist/{chunk-VQGHQVD2.js → chunk-QPU7QKPT.js} +3 -3
- package/dist/{chunk-DEQRRCHK.js → chunk-RBFHY2LF.js} +2 -2
- package/dist/{chunk-H4ACPMJS.js → chunk-SCQ5YAYO.js} +4 -4
- package/dist/{chunk-LWLFWWA7.js → chunk-TQZSPGAZ.js} +3 -3
- package/dist/{chunk-LWLFWWA7.js.map → chunk-TQZSPGAZ.js.map} +1 -1
- package/dist/{chunk-ECJ52NSK.js → chunk-TYLE7Z2S.js} +5 -3
- package/dist/{chunk-ECJ52NSK.js.map → chunk-TYLE7Z2S.js.map} +1 -1
- package/dist/{chunk-TFQMVUWQ.js → chunk-V5FGXVSX.js} +5 -7
- package/dist/{chunk-TFQMVUWQ.js.map → chunk-V5FGXVSX.js.map} +1 -1
- package/dist/{chunk-2AN5NGCQ.js → chunk-VGCRYAEH.js} +4 -4
- package/dist/{chunk-AYBOQE2Y.js → chunk-VHOOJ4FG.js} +3 -3
- package/dist/{chunk-AYBOQE2Y.js.map → chunk-VHOOJ4FG.js.map} +1 -1
- package/dist/{chunk-II4XITQ6.js → chunk-W2XP4MEN.js} +14 -20
- package/dist/{chunk-II4XITQ6.js.map → chunk-W2XP4MEN.js.map} +1 -1
- package/dist/{chunk-6H4NUU7G.js → chunk-WCHN7B2Q.js} +6 -20
- package/dist/{chunk-6H4NUU7G.js.map → chunk-WCHN7B2Q.js.map} +1 -1
- package/dist/{chunk-7XJZTSHW.js → chunk-WI73OZAU.js} +22 -125
- package/dist/chunk-WI73OZAU.js.map +1 -0
- package/dist/{chunk-EPCR2GOE.js → chunk-XFTTKOHK.js} +2 -2
- package/dist/{chunk-C5WECFBR.js → chunk-XQMQGUJT.js} +5 -5
- package/dist/{chunk-PRX4ERTK.js → chunk-XSAUVC6D.js} +2 -2
- package/dist/{chunk-AI6LKFGU.js → chunk-XTL45OBN.js} +3 -3
- package/dist/{chunk-6Z3MAHAC.js → chunk-XYYXVJSO.js} +2 -2
- package/dist/{chunk-HESQ746B.js → chunk-YHY7GMAL.js} +2 -2
- package/dist/{cli-circuit-breaker-AZHN2TMH.js → cli-circuit-breaker-AM425BRL.js} +3 -3
- package/dist/{cli-readiness-H4JTTKKU.js → cli-readiness-LWOMHZ34.js} +7 -7
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +47 -49
- package/dist/cli.js.map +1 -1
- package/dist/{composite-router-WCTNVMSX.js → composite-router-VXQFXNET.js} +2 -2
- package/dist/{consensus-vote-RD3SME3K.js → consensus-vote-IUXJHSSQ.js} +19 -19
- package/dist/{consensus-vote-types-G7Lnj3B3.d.ts → consensus-vote-types-DexdhOdB.d.ts} +9 -15
- package/dist/{context-retriever-YM2PPNSY.js → context-retriever-GEQIPCVL.js} +8 -8
- package/dist/{doctor-deep-6P23G7PN.js → doctor-deep-DSOZGB5J.js} +3 -3
- package/dist/doctor-gateway-report-RJOSOHGA.js +21 -0
- package/dist/{doctor-live-MYXZCBSP.js → doctor-live-7LVRGOS5.js} +13 -13
- package/dist/{expert-bridge-CXHYMQRL.js → expert-bridge-5A4ADUBO.js} +4 -4
- package/dist/{factory-KH2MJQ5U.js → factory-4RZLP7QV.js} +5 -5
- package/dist/{factory-3Z46455N.js → factory-UBAUIA2M.js} +12 -12
- package/dist/{improvement-review-RAISKC3W.js → improvement-review-KBMTSFYT.js} +7 -7
- package/dist/index.d.ts +49 -562
- package/dist/index.js +35 -83
- package/dist/index.js.map +1 -1
- package/dist/{init-opencode-WXRTDPFP.js → init-opencode-WUN3CTBM.js} +6 -6
- package/dist/{issue-triage-KF47ZHU7.js → issue-triage-VKEHVHO4.js} +6 -6
- package/dist/{model-config-helpers-ZH2QAFVR.js → model-config-helpers-GYPIIXOP.js} +2 -2
- package/dist/{openai-compat-adapter-PQ3JKWPZ.js → openai-compat-adapter-GSDOJ7TQ.js} +6 -6
- package/dist/{outcome-store-adapter-NTYEZXLH.js → outcome-store-adapter-PXT7AL6T.js} +2 -2
- package/dist/{pr-reviewer-helpers-AQNGDRQT.js → pr-reviewer-helpers-GUUT7G43.js} +4 -4
- package/dist/{registry-command-6EHIJ3PJ.js → registry-command-4G3WGKS5.js} +2 -2
- package/dist/{repo-security-plan-AP3QEWJ5.js → repo-security-plan-QO6ACTPZ.js} +3 -3
- package/dist/{research-helpers-synthesize-XE3RMFQT.js → research-helpers-synthesize-MPEJHPYR.js} +4 -4
- package/dist/{routing-memory-PBZIE5NX.js → routing-memory-VHQDJ6XZ.js} +2 -2
- package/dist/{session-memory-6NUK6ZAG.js → session-memory-M3CQFFL6.js} +3 -3
- package/dist/{setup-config-KEPU4NTT.js → setup-config-VGEBCEKX.js} +3 -3
- package/dist/{setup-custom-api-XY455LVS.js → setup-custom-api-DX7CNYKT.js} +5 -5
- package/dist/{setup-custom-api-XY455LVS.js.map → setup-custom-api-DX7CNYKT.js.map} +1 -1
- package/dist/setup-data-dir-JQGH2JCH.js +36 -0
- package/dist/{tool-memory-MO2KOJJ7.js → tool-memory-7QUPGCWV.js} +5 -5
- package/dist/{unified-registry-JE22THXP.js → unified-registry-CLZK3H64.js} +13 -13
- package/dist/{weather-report-TQ6KM2F2.js → weather-report-OKMXF73V.js} +2 -2
- package/node_modules/@modelcontextprotocol/sdk/README.md +8 -2
- package/node_modules/@modelcontextprotocol/sdk/package.json +1 -1
- package/package.json +3 -2
- package/dist/chunk-7XJZTSHW.js.map +0 -1
- package/dist/chunk-ONYCBTOH.js.map +0 -1
- package/dist/chunk-Q5F4OBOK.js.map +0 -1
- package/dist/chunk-TQEXRC5C.js.map +0 -1
- package/dist/chunk-XJ65J3O5.js.map +0 -1
- package/dist/doctor-gateway-report-4TXHTWUM.js +0 -21
- package/dist/setup-data-dir-5MRGQD2G.js +0 -36
- /package/dist/{ast-rule-runner-5U6TE6YJ.js.map → ast-rule-runner-AAOBENF2.js.map} +0 -0
- /package/dist/{child-mcp-config-IR7LRMIK.js.map → child-mcp-config-FRWGQIHP.js.map} +0 -0
- /package/dist/{chunk-DG2UY5QU.js.map → chunk-2VD5OQQR.js.map} +0 -0
- /package/dist/{chunk-FTUBCD52.js.map → chunk-52Q72CPP.js.map} +0 -0
- /package/dist/{chunk-Q7RFJSR5.js.map → chunk-BJLP4E6Q.js.map} +0 -0
- /package/dist/{chunk-ETGNAHY3.js.map → chunk-CYROSFMW.js.map} +0 -0
- /package/dist/{chunk-FWSAYHGV.js.map → chunk-EGUISJBB.js.map} +0 -0
- /package/dist/{chunk-2AW2VHMK.js.map → chunk-IRFKJ2KR.js.map} +0 -0
- /package/dist/{chunk-HK4LBUYY.js.map → chunk-K6M2ZWX5.js.map} +0 -0
- /package/dist/{chunk-RI4IXOZT.js.map → chunk-KPGWNBDA.js.map} +0 -0
- /package/dist/{chunk-6WPXQTQY.js.map → chunk-L4P4A7Z2.js.map} +0 -0
- /package/dist/{chunk-P7327767.js.map → chunk-M4IJ3H6M.js.map} +0 -0
- /package/dist/{chunk-FKMBZ53Y.js.map → chunk-MCWIMVG2.js.map} +0 -0
- /package/dist/{chunk-JNRDNE26.js.map → chunk-MYM2TPNL.js.map} +0 -0
- /package/dist/{chunk-TMHCN5EY.js.map → chunk-NUXSGWDS.js.map} +0 -0
- /package/dist/{chunk-AFAM6GK3.js.map → chunk-O46IOND3.js.map} +0 -0
- /package/dist/{chunk-DYTB2XW2.js.map → chunk-O5OUJ3PX.js.map} +0 -0
- /package/dist/{chunk-VQGHQVD2.js.map → chunk-QPU7QKPT.js.map} +0 -0
- /package/dist/{chunk-DEQRRCHK.js.map → chunk-RBFHY2LF.js.map} +0 -0
- /package/dist/{chunk-H4ACPMJS.js.map → chunk-SCQ5YAYO.js.map} +0 -0
- /package/dist/{chunk-2AN5NGCQ.js.map → chunk-VGCRYAEH.js.map} +0 -0
- /package/dist/{chunk-EPCR2GOE.js.map → chunk-XFTTKOHK.js.map} +0 -0
- /package/dist/{chunk-C5WECFBR.js.map → chunk-XQMQGUJT.js.map} +0 -0
- /package/dist/{chunk-PRX4ERTK.js.map → chunk-XSAUVC6D.js.map} +0 -0
- /package/dist/{chunk-AI6LKFGU.js.map → chunk-XTL45OBN.js.map} +0 -0
- /package/dist/{chunk-6Z3MAHAC.js.map → chunk-XYYXVJSO.js.map} +0 -0
- /package/dist/{chunk-HESQ746B.js.map → chunk-YHY7GMAL.js.map} +0 -0
- /package/dist/{cli-circuit-breaker-AZHN2TMH.js.map → cli-circuit-breaker-AM425BRL.js.map} +0 -0
- /package/dist/{cli-readiness-H4JTTKKU.js.map → cli-readiness-LWOMHZ34.js.map} +0 -0
- /package/dist/{composite-router-WCTNVMSX.js.map → composite-router-VXQFXNET.js.map} +0 -0
- /package/dist/{consensus-vote-RD3SME3K.js.map → consensus-vote-IUXJHSSQ.js.map} +0 -0
- /package/dist/{context-retriever-YM2PPNSY.js.map → context-retriever-GEQIPCVL.js.map} +0 -0
- /package/dist/{doctor-deep-6P23G7PN.js.map → doctor-deep-DSOZGB5J.js.map} +0 -0
- /package/dist/{doctor-gateway-report-4TXHTWUM.js.map → doctor-gateway-report-RJOSOHGA.js.map} +0 -0
- /package/dist/{doctor-live-MYXZCBSP.js.map → doctor-live-7LVRGOS5.js.map} +0 -0
- /package/dist/{expert-bridge-CXHYMQRL.js.map → expert-bridge-5A4ADUBO.js.map} +0 -0
- /package/dist/{factory-3Z46455N.js.map → factory-4RZLP7QV.js.map} +0 -0
- /package/dist/{factory-KH2MJQ5U.js.map → factory-UBAUIA2M.js.map} +0 -0
- /package/dist/{improvement-review-RAISKC3W.js.map → improvement-review-KBMTSFYT.js.map} +0 -0
- /package/dist/{init-opencode-WXRTDPFP.js.map → init-opencode-WUN3CTBM.js.map} +0 -0
- /package/dist/{issue-triage-KF47ZHU7.js.map → issue-triage-VKEHVHO4.js.map} +0 -0
- /package/dist/{model-config-helpers-ZH2QAFVR.js.map → model-config-helpers-GYPIIXOP.js.map} +0 -0
- /package/dist/{openai-compat-adapter-PQ3JKWPZ.js.map → openai-compat-adapter-GSDOJ7TQ.js.map} +0 -0
- /package/dist/{outcome-store-adapter-NTYEZXLH.js.map → outcome-store-adapter-PXT7AL6T.js.map} +0 -0
- /package/dist/{pr-reviewer-helpers-AQNGDRQT.js.map → pr-reviewer-helpers-GUUT7G43.js.map} +0 -0
- /package/dist/{registry-command-6EHIJ3PJ.js.map → registry-command-4G3WGKS5.js.map} +0 -0
- /package/dist/{repo-security-plan-AP3QEWJ5.js.map → repo-security-plan-QO6ACTPZ.js.map} +0 -0
- /package/dist/{research-helpers-synthesize-XE3RMFQT.js.map → research-helpers-synthesize-MPEJHPYR.js.map} +0 -0
- /package/dist/{routing-memory-PBZIE5NX.js.map → routing-memory-VHQDJ6XZ.js.map} +0 -0
- /package/dist/{session-memory-6NUK6ZAG.js.map → session-memory-M3CQFFL6.js.map} +0 -0
- /package/dist/{setup-config-KEPU4NTT.js.map → setup-config-VGEBCEKX.js.map} +0 -0
- /package/dist/{setup-data-dir-5MRGQD2G.js.map → setup-data-dir-JQGH2JCH.js.map} +0 -0
- /package/dist/{tool-memory-MO2KOJJ7.js.map → tool-memory-7QUPGCWV.js.map} +0 -0
- /package/dist/{unified-registry-JE22THXP.js.map → unified-registry-CLZK3H64.js.map} +0 -0
- /package/dist/{weather-report-TQ6KM2F2.js.map → weather-report-OKMXF73V.js.map} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadPapersRegistry
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YHY7GMAL.js";
|
|
4
4
|
import {
|
|
5
5
|
getErrorMessage
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-WI73OZAU.js";
|
|
7
7
|
|
|
8
8
|
// src/cli/research-helpers-synthesize.ts
|
|
9
9
|
import { z } from "zod";
|
|
@@ -876,4 +876,4 @@ export {
|
|
|
876
876
|
AttributedInsightSchema,
|
|
877
877
|
synthesizeResearch
|
|
878
878
|
};
|
|
879
|
-
//# sourceMappingURL=chunk-
|
|
879
|
+
//# sourceMappingURL=chunk-BJLP4E6Q.js.map
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CUSTOM_API_ALLOW_PRIVATE_ENV,
|
|
3
3
|
ConfigError,
|
|
4
|
-
DEPRECATED_GATEWAY_ENV_ALIASES,
|
|
5
4
|
OPENAI_COMPAT_KEY_ENV,
|
|
6
5
|
OPENAI_COMPAT_URL_ENV,
|
|
7
6
|
createLogger,
|
|
8
7
|
err,
|
|
9
8
|
ok
|
|
10
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-WI73OZAU.js";
|
|
11
10
|
|
|
12
11
|
// src/adapters/gateway-redaction.ts
|
|
13
12
|
var GATEWAY_REDACTED = "<redacted>";
|
|
@@ -22,46 +21,13 @@ function readTrimmed(env, name) {
|
|
|
22
21
|
return value === void 0 || value === "" ? void 0 : value;
|
|
23
22
|
}
|
|
24
23
|
function resolveGatewayEnv(env = process.env) {
|
|
25
|
-
const deprecated = [];
|
|
26
|
-
for (const alias of DEPRECATED_GATEWAY_ENV_ALIASES) {
|
|
27
|
-
if (readTrimmed(env, alias.deprecated) === void 0) continue;
|
|
28
|
-
deprecated.push({
|
|
29
|
-
name: alias.deprecated,
|
|
30
|
-
replacement: alias.replacement,
|
|
31
|
-
shadowed: readTrimmed(env, alias.replacement) !== void 0
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
24
|
return {
|
|
35
|
-
baseUrl:
|
|
36
|
-
apiKey:
|
|
37
|
-
deprecated
|
|
25
|
+
baseUrl: readTrimmed(env, OPENAI_COMPAT_URL_ENV),
|
|
26
|
+
apiKey: readTrimmed(env, OPENAI_COMPAT_KEY_ENV)
|
|
38
27
|
};
|
|
39
28
|
}
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
if (current !== void 0) return current;
|
|
43
|
-
const alias = DEPRECATED_GATEWAY_ENV_ALIASES.find((a) => a.replacement === replacement);
|
|
44
|
-
return alias === void 0 ? void 0 : readTrimmed(env, alias.deprecated);
|
|
45
|
-
}
|
|
46
|
-
var defaultLogger = createLogger({ component: "gateway-env" });
|
|
47
|
-
var deprecationWarned = false;
|
|
48
|
-
function warnDeprecatedGatewayEnvOnce(env = process.env, logger2 = defaultLogger) {
|
|
49
|
-
if (deprecationWarned) return;
|
|
50
|
-
const { deprecated } = resolveGatewayEnv(env);
|
|
51
|
-
if (deprecated.length === 0) return;
|
|
52
|
-
deprecationWarned = true;
|
|
53
|
-
logger2.warn(formatDeprecationWarning(deprecated));
|
|
54
|
-
}
|
|
55
|
-
function formatDeprecationWarning(deprecated) {
|
|
56
|
-
const uses = deprecated.map(
|
|
57
|
-
(d) => d.shadowed ? `${d.name} (ignored: ${d.replacement} is set)` : `${d.name} (honoured; rename to ${d.replacement})`
|
|
58
|
-
).join("; ");
|
|
59
|
-
return `Deprecated gateway environment variable(s) set (#4392): ${uses}. These names configure only the single-model custom-openai path and stay aliases until the next major (#6291). Rename to NEXUS_OPENAI_COMPAT_* to opt into the gateway path (model discovery, in-process voter transport, api:<endpoint> arm).`;
|
|
60
|
-
}
|
|
61
|
-
function readGatewayEnv(env = process.env, logger2 = defaultLogger) {
|
|
62
|
-
const resolved = resolveGatewayEnv(env);
|
|
63
|
-
if (resolved.deprecated.length > 0) warnDeprecatedGatewayEnvOnce(env, logger2);
|
|
64
|
-
return resolved;
|
|
29
|
+
function readGatewayEnv(env = process.env) {
|
|
30
|
+
return resolveGatewayEnv(env);
|
|
65
31
|
}
|
|
66
32
|
var CUSTOM_API_SURFACE_ENV = "NEXUS_CUSTOM_API_SURFACE";
|
|
67
33
|
function readCustomApiSurface(env = process.env) {
|
|
@@ -331,8 +297,6 @@ function classifyIPv6(ip) {
|
|
|
331
297
|
|
|
332
298
|
export {
|
|
333
299
|
redactGatewaySecrets,
|
|
334
|
-
resolveGatewayEnv,
|
|
335
|
-
warnDeprecatedGatewayEnvOnce,
|
|
336
300
|
readGatewayEnv,
|
|
337
301
|
readCustomApiSurface,
|
|
338
302
|
readDirectOpenAiSurface,
|
|
@@ -341,4 +305,4 @@ export {
|
|
|
341
305
|
validateCustomApiBaseUrl,
|
|
342
306
|
assertCustomApiHostResolvesPublic
|
|
343
307
|
};
|
|
344
|
-
//# sourceMappingURL=chunk-
|
|
308
|
+
//# sourceMappingURL=chunk-BK6Q3VQK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/adapters/gateway-redaction.ts","../src/adapters/sdk/gateway-env.ts","../src/adapters/sdk/custom-api-validation.ts"],"sourcesContent":["/**\n * Redaction of gateway credentials from error text.\n *\n * A gateway request carries the key (in `Authorization: Bearer` or in the\n * header `NEXUS_OPENAI_COMPAT_AUTH_HEADER` names) and every static header\n * from `NEXUS_OPENAI_COMPAT_EXTRA_HEADERS`. A gateway's error body may echo\n * any of them, and none has a vendor shape the pattern sanitizer knows, so\n * each is removed by exact match. One helper, so the discovery path, the\n * per-model adapter and `doctor --gateway` cannot disagree on what is secret.\n *\n * @module adapters/gateway-redaction\n */\n\n/** Replacement text for a redacted gateway credential. */\nconst GATEWAY_REDACTED = '<redacted>';\n\n/** The credentials one gateway call site sends. */\nexport interface GatewaySecretSource {\n /** The gateway key — also the auth-header value when a custom header carries it. */\n readonly apiKey?: string | undefined;\n /**\n * Headers sent on every request. EVERY value is treated as secret; a\n * `null` value removes a default header and carries nothing.\n */\n readonly headers?: Readonly<Record<string, string | null>> | undefined;\n}\n\n/**\n * `message` with the key and every header value replaced by `placeholder`.\n * Blank values are skipped (`replaceAll('')` would interleave the marker\n * between every character). Longer values are replaced first, so a value\n * that contains another is removed whole rather than leaving its remainder.\n */\nexport function redactGatewaySecrets(\n message: string,\n source: GatewaySecretSource,\n placeholder: string = GATEWAY_REDACTED\n): string {\n const secrets = [source.apiKey, ...Object.values(source.headers ?? {})]\n .filter((s): s is string => typeof s === 'string' && s.trim() !== '')\n .sort((a, b) => b.length - a.length);\n return secrets.reduce((text, secret) => text.replaceAll(secret, placeholder), message);\n}\n","/**\n * Canonical env resolver for the single-model `custom-openai` gateway path.\n *\n * The SDK path (`api:custom-openai`) and discovery path (`api:<endpoint>`)\n * both read `NEXUS_OPENAI_COMPAT_URL` / `NEXUS_OPENAI_COMPAT_KEY`.\n *\n * @module adapters/sdk/gateway-env\n */\n\nimport { ConfigError } from '../../core/index.js';\nimport { OPENAI_COMPAT_KEY_ENV, OPENAI_COMPAT_URL_ENV } from './types.js';\nimport { redactGatewaySecrets } from '../gateway-redaction.js';\n\n/** The resolved mechanism-A gateway pair. */\nexport interface GatewayEnv {\n /** `NEXUS_OPENAI_COMPAT_URL`, trimmed; empty is unset. */\n readonly baseUrl: string | undefined;\n /** `NEXUS_OPENAI_COMPAT_KEY`, trimmed; empty is unset. */\n readonly apiKey: string | undefined;\n}\n\n/** A set env value, trimmed; `undefined` for unset, empty, or whitespace-only. */\nfunction readTrimmed(env: NodeJS.ProcessEnv, name: string): string | undefined {\n const value = env[name]?.trim();\n return value === undefined || value === '' ? undefined : value;\n}\n\n/** Resolve the canonical mechanism-A gateway pair without logging. */\nexport function resolveGatewayEnv(env: NodeJS.ProcessEnv = process.env): GatewayEnv {\n return {\n baseUrl: readTrimmed(env, OPENAI_COMPAT_URL_ENV),\n apiKey: readTrimmed(env, OPENAI_COMPAT_KEY_ENV),\n };\n}\n\n/** The production reader for the canonical mechanism-A gateway pair. */\nexport function readGatewayEnv(env: NodeJS.ProcessEnv = process.env): GatewayEnv {\n return resolveGatewayEnv(env);\n}\n\n/**\n * The OpenAI API surface the single-model `custom-openai` path calls (#6645):\n * `chat` is `POST <base>/chat/completions`, `responses` is `POST <base>/responses`.\n */\ntype CustomApiSurface = 'chat' | 'responses';\n\nconst CUSTOM_API_SURFACE_ENV = 'NEXUS_CUSTOM_API_SURFACE';\n\n/**\n * Read `NEXUS_CUSTOM_API_SURFACE` (#6645). Unset or empty means `chat`: the\n * AI SDK's default is the Responses API, but OpenAI-spec gateways commonly\n * serve `/chat/completions` only, so `responses` is the opt-in. Any other\n * value throws a `ConfigError` rather than guessing a surface.\n */\nexport function readCustomApiSurface(env: NodeJS.ProcessEnv = process.env): CustomApiSurface {\n const raw = env[CUSTOM_API_SURFACE_ENV]?.trim().toLowerCase() ?? '';\n if (raw === '' || raw === 'chat') return 'chat';\n if (raw === 'responses') return 'responses';\n throw new ConfigError(\n `${CUSTOM_API_SURFACE_ENV} must be one of: responses, chat (default chat); got an unrecognised value`\n );\n}\n\n/** Read by `@ai-sdk/openai` itself; the direct OpenAI adapter never passes a baseURL. */\nconst OPENAI_BASE_URL_ENV = 'OPENAI_BASE_URL';\nconst OPENAI_API_HOST = 'api.openai.com';\n\n/**\n * The surface the direct OpenAI adapter (`OPENAI_API_KEY`) calls (#6654).\n * `undefined` means the provider's own default (the Responses API), exactly\n * as before: `OPENAI_BASE_URL` unset, blank, or naming `api.openai.com`, and\n * `NEXUS_CUSTOM_API_SURFACE` is then not read at all. Any other host is an\n * OpenAI-compatible gateway, so it gets {@link readCustomApiSurface}'s answer:\n * chat completions unless `NEXUS_CUSTOM_API_SURFACE=responses`.\n */\nexport function readDirectOpenAiSurface(\n env: NodeJS.ProcessEnv = process.env\n): CustomApiSurface | undefined {\n const baseUrl = env[OPENAI_BASE_URL_ENV]?.trim() ?? '';\n if (baseUrl === '' || hostnameOf(baseUrl) === OPENAI_API_HOST) return undefined;\n return readCustomApiSurface(env);\n}\n\n/**\n * The host of a gateway base URL, for log lines and error messages. A base\n * URL can carry userinfo (`https://user:key@host/v1`), so the full string\n * must never reach a log. Two failure shapes, both replaced rather than\n * echoed: a string that does not parse at all, and a scheme-less paste such\n * as `key@host/v1`, which WHATWG parses with `key:` as the SCHEME and an\n * empty hostname (measured: `new URL('u:pw@host/v1').hostname === ''`).\n */\nexport function hostnameOf(baseUrl: string): string {\n try {\n const host = new URL(baseUrl).hostname;\n return host === '' ? '<no host>' : host;\n } catch {\n return '<unparseable url>';\n }\n}\n\n/**\n * Every exact occurrence of `apiKey` in `message` replaced with `<redacted>`.\n * The pattern-based sanitizer only knows vendor key shapes; a gateway key can\n * be any string, and a 401 body may echo the one it rejected. A blank key\n * matches nothing. The key-only case of {@link redactGatewaySecrets}.\n */\nexport function redactApiKey(message: string, apiKey: string | undefined): string {\n return redactGatewaySecrets(message, { apiKey });\n}\n","/**\n * Validation for the `custom-openai` SDK adapter's gateway URL.\n *\n * The base URL is user-provided, so without validation the adapter becomes\n * an SSRF vector: a malicious prompt that reshaped env vars, or a typo in\n * the config, could point nexus-agents at `http://169.254.169.254/` (AWS\n * metadata) or `http://localhost:5432/` (internal services). This module\n * rejects such URLs unless the user explicitly opts in via\n * `NEXUS_CUSTOM_API_ALLOW_PRIVATE=1`.\n *\n * Called out in the #2119 consensus vote by the Security Engineer role.\n *\n * @module adapters/sdk/custom-api-validation\n */\n\nimport { isIPv4, isIPv6 } from 'node:net';\nimport { lookup as dnsLookup } from 'node:dns/promises';\nimport { ConfigError, ok, err, createLogger, type Result } from '../../core/index.js';\nimport { CUSTOM_API_ALLOW_PRIVATE_ENV } from './types.js';\n\nconst logger = createLogger({ module: 'custom-api-validation' });\n\n/**\n * Why a given URL was rejected. Machine-readable so error messages can\n * distinguish root causes in downstream tooling.\n */\nexport type BaseUrlRejectionReason =\n | 'empty'\n | 'not_a_url'\n | 'not_http_https'\n | 'loopback'\n | 'link_local'\n | 'private_range'\n | 'reserved';\n\ninterface RejectionDetail {\n readonly reason: BaseUrlRejectionReason;\n readonly message: string;\n}\n\n/**\n * Validates a user-provided custom-gateway base URL. Returns the URL as an\n * `ok` Result if it passes, or a `ConfigError` with a machine-readable\n * reason if it fails.\n *\n * Pass `{ allowPrivate: true }` (or set the env var) to bypass the SSRF\n * checks — use this only when the gateway is on a trusted internal host\n * and you accept the risk.\n */\nexport function validateCustomApiBaseUrl(\n raw: string | undefined,\n opts: { readonly allowPrivate?: boolean } = {}\n): Result<URL, ConfigError> {\n if (raw === undefined || raw.trim() === '') {\n return err(\n new ConfigError(\n 'Custom API base URL is required but missing. Set NEXUS_OPENAI_COMPAT_URL or pass `baseUrl` in config.'\n )\n );\n }\n\n let url: URL;\n try {\n url = new URL(raw);\n } catch {\n // Not echoed: these messages reach the resilient-adapter warn line, and\n // the raw string can carry userinfo (#4392 inc 3).\n return err(new ConfigError('Custom API base URL is not a valid URL'));\n }\n\n if (url.protocol !== 'http:' && url.protocol !== 'https:') {\n return err(\n new ConfigError(`Custom API base URL must use http or https, got \"${url.protocol}\"`)\n );\n }\n\n const allowPrivate = opts.allowPrivate === true || resolveAllowPrivateFromEnv();\n if (!allowPrivate) {\n const rejection = classifyPrivateHost(url.hostname);\n if (rejection !== null) {\n return err(\n new ConfigError(\n `Custom API base URL rejected (SSRF guard, reason=\"${rejection.reason}\"): ${rejection.message}. ` +\n `Set ${CUSTOM_API_ALLOW_PRIVATE_ENV}=1 to bypass if the gateway runs on a trusted internal host.`\n )\n );\n }\n }\n\n return ok(url);\n}\n\nfunction resolveAllowPrivateFromEnv(): boolean {\n // Deliberately strict (case-sensitive, not parseBoolEnv): this disables an\n // SSRF guard, so we don't want extra case variants (e.g. `TRUE`) to loosen\n // the control. Fail-closed on anything but exact `1`/`true` (#3297).\n const v = process.env[CUSTOM_API_ALLOW_PRIVATE_ENV];\n return v === '1' || v === 'true';\n}\n\n/**\n * Returns a rejection reason if the hostname resolves (by string form) to\n * a loopback, link-local, or RFC 1918 private address; `null` otherwise.\n *\n * Note: this is a string-level check. It does NOT perform DNS resolution,\n * so a public DNS name that secretly resolves to a private IP will pass.\n * For that level of defense, callers should additionally run\n * {@link assertCustomApiHostResolvesPublic}, which performs a DNS lookup\n * and classifies each resolved address with the same range tables below.\n */\nfunction classifyPrivateHost(hostname: string): RejectionDetail | null {\n const normalized = normalizeHost(hostname);\n\n // Literal IP addresses — classify directly against the range tables.\n const literal = classifyIpAddress(normalized);\n if (literal !== 'not_an_ip') {\n return literal;\n }\n\n // Hostname literals that resolve to loopback without needing DNS\n if (\n normalized === 'localhost' ||\n normalized.endsWith('.localhost') ||\n normalized.endsWith('.local') // mDNS\n ) {\n return {\n reason: 'loopback',\n message: `hostname \"${hostname}\" resolves to loopback/mDNS`,\n };\n }\n\n return null;\n}\n\n/**\n * Strips IPv6 bracket wrapping (URL.hostname yields \"[::1]\") and lowercases,\n * giving the bare form the `node:net` checks expect. Shared by the sync and\n * async guards so the normalization rule lives in one place.\n */\nfunction normalizeHost(hostname: string): string {\n const stripped =\n hostname.startsWith('[') && hostname.endsWith(']') ? hostname.slice(1, -1) : hostname;\n return stripped.toLowerCase();\n}\n\n/**\n * Classifies a single (already normalized, bracket-stripped) address string.\n * Returns:\n * - a {@link RejectionDetail} if it is a private/loopback/link-local/reserved IP,\n * - `null` if it is a public IP literal (safe),\n * - the sentinel `'not_an_ip'` if the string is not an IP literal at all.\n *\n * This is the shared per-address classifier reused by both the sync\n * string-level guard ({@link classifyPrivateHost}) and the async\n * DNS-resolve-time guard ({@link assertCustomApiHostResolvesPublic}), so the\n * IPv4/IPv6 range tables live in exactly one place.\n */\nfunction classifyIpAddress(normalized: string): RejectionDetail | null | 'not_an_ip' {\n if (isIPv4(normalized)) {\n return classifyIPv4(normalized);\n }\n if (isIPv6(normalized)) {\n return classifyIPv6(normalized);\n }\n return 'not_an_ip';\n}\n\n/** Verdict for a host that is already an IP literal — no DNS required. */\nfunction classifyLiteral(hostname: string, normalized: string): Result<void, ConfigError> {\n const literal = classifyIpAddress(normalized);\n if (literal === null || literal === 'not_an_ip') return ok(undefined);\n return err(\n new ConfigError(\n `Custom API host '${hostname}' is a ${literal.reason} address: ${literal.message}`\n )\n );\n}\n\n/**\n * DNS-resolve-time SSRF guard for the custom-openai gateway.\n *\n * The sync {@link validateCustomApiBaseUrl} only inspects the hostname as a\n * string, so a PUBLIC DNS name that resolves to a PRIVATE/loopback/link-local\n * IP (e.g. an attacker-controlled `gateway.evil.test` pointing at\n * `169.254.169.254`) slips past it. This function closes that gap: it resolves\n * the hostname and runs the EXISTING IP classification against every returned\n * address, failing closed if ANY of them is private.\n *\n * Behaviour:\n * - `allowPrivate` (opt or env) → bypass, returns `ok` (matches the sync guard).\n * - hostname is already an IP literal → no DNS needed; the sync guard already\n * classified literals at construction, so return `ok`.\n * - otherwise `dns.lookup(hostname, { all: true })` and classify each address.\n * If ANY resolves private → `err(ConfigError)`.\n * - on a `dns.lookup` THROW (transient/NXDOMAIN/network error) → log debug and\n * return `ok`. Failing closed here is too aggressive: it would break legit\n * gateways on a flaky resolver, and this is additive defense-in-depth layered\n * on top of the sync string guard that already ran at construction. We only\n * REJECT on a SUCCESSFUL resolution to a private address.\n *\n * Residual risk (TOCTOU): this is RESOLVE-time, not socket-connect-time. A name\n * that passes here could rebind to a private IP before the actual connect\n * (DNS rebinding). A full fix needs a custom `fetch` `lookup` hook validating\n * the peer address at the socket layer — out of scope for this LOW\n * defense-in-depth pass (#3426).\n */\nexport async function assertCustomApiHostResolvesPublic(\n hostname: string,\n opts: { readonly allowPrivate?: boolean } = {}\n): Promise<Result<void, ConfigError>> {\n const allowPrivate = opts.allowPrivate === true || resolveAllowPrivateFromEnv();\n if (allowPrivate) {\n return ok(undefined);\n }\n\n const normalized = normalizeHost(hostname);\n\n // A literal needs no DNS, but it is still classified HERE rather than\n // assumed handled elsewhere. This used to return ok for any literal on the\n // grounds that the sync guard had classified it at construction — but\n // `discoverModels` calls only this guard, never the sync one, so on that\n // path each deferred to the other and neither ran. `http://169.254.169.254/`\n // reached IMDS, from a base URL that can come from a file rather than from\n // operator intent.\n if (isIPv4(normalized) || isIPv6(normalized)) {\n return classifyLiteral(hostname, normalized);\n }\n\n // Only `address` is read; the resolver's `family` is intentionally NOT\n // trusted — `classifyIpAddress` re-derives v4/v6 from the address string, so\n // a mislabeled family in the lookup result cannot let a private IP slip past.\n let addresses: ReadonlyArray<{ readonly address: string }>;\n try {\n addresses = await dnsLookup(hostname, { all: true });\n } catch (error) {\n // Fail OPEN: transient/NXDOMAIN/network errors must not break legit\n // gateways. The sync string guard already ran; this is additive only.\n logger.debug('custom-api SSRF resolve check: DNS lookup failed, skipping (fail-open)', {\n hostname,\n error: error instanceof Error ? error.message : String(error),\n });\n return ok(undefined);\n }\n\n const rejection = firstPrivateAddress(addresses);\n if (rejection !== null) {\n return err(\n new ConfigError(\n `Custom API base URL rejected (SSRF resolve guard, reason=\"${rejection.reason}\"): ` +\n `hostname \"${hostname}\" resolved to ${rejection.message}. ` +\n `Set ${CUSTOM_API_ALLOW_PRIVATE_ENV}=1 to bypass if the gateway runs on a trusted internal host.`\n )\n );\n }\n\n return ok(undefined);\n}\n\n/**\n * Returns the {@link RejectionDetail} for the first resolved address that\n * classifies as private/loopback/link-local/reserved, or `null` if every\n * address is public. Fail-closed: any single private hit trips the guard.\n */\nfunction firstPrivateAddress(\n addresses: ReadonlyArray<{ readonly address: string }>\n): RejectionDetail | null {\n for (const { address } of addresses) {\n const rejection = classifyIpAddress(address.toLowerCase());\n if (rejection !== null && rejection !== 'not_an_ip') {\n return rejection;\n }\n }\n return null;\n}\n\n/**\n * IPv4 ranges the SSRF guard rejects, in order of specificity.\n *\n * \"Not RFC1918\" is not the same as \"public\". The blocks below RFC1918 are\n * here because each is reachable from a host and serves something: 100.64/10\n * carries Alibaba Cloud's metadata endpoint, 192.0.0/24 carries a legacy\n * Oracle Cloud one, and multicast/reserved/broadcast reach the local segment\n * rather than the internet (second pass over #4884).\n */\nconst IPV4_RULES: ReadonlyArray<{\n readonly match: (a: number, b: number, c: number) => boolean;\n readonly reason: BaseUrlRejectionReason;\n readonly label: string;\n}> = [\n { match: (a) => a === 127, reason: 'loopback', label: 'IPv4 loopback' },\n { match: (a) => a === 10, reason: 'private_range', label: 'IPv4 private (10/8)' },\n {\n match: (a, b) => a === 172 && b >= 16 && b <= 31,\n reason: 'private_range',\n label: 'IPv4 private (172.16/12)',\n },\n {\n match: (a, b) => a === 192 && b === 168,\n reason: 'private_range',\n label: 'IPv4 private (192.168/16)',\n },\n {\n match: (a, b) => a === 169 && b === 254,\n reason: 'link_local',\n label: 'IPv4 link-local (169.254/16 — AWS IMDS)',\n },\n { match: (a) => a === 0, reason: 'reserved', label: 'IPv4 reserved (0/8)' },\n {\n match: (a, b) => a === 100 && b >= 64 && b <= 127,\n reason: 'private_range',\n label: 'IPv4 shared address space (100.64/10 — CGNAT, Alibaba metadata)',\n },\n {\n match: (a, b, c) => a === 192 && b === 0 && c === 0,\n reason: 'reserved',\n label: 'IPv4 IETF protocol assignments (192.0.0/24 — legacy Oracle metadata)',\n },\n {\n match: (a, b) => a === 198 && (b === 18 || b === 19),\n reason: 'reserved',\n label: 'IPv4 benchmarking (198.18/15)',\n },\n { match: (a) => a >= 224 && a <= 239, reason: 'reserved', label: 'IPv4 multicast (224/4)' },\n {\n match: (a) => a >= 240,\n reason: 'reserved',\n label: 'IPv4 reserved (240/4, includes 255.255.255.255 broadcast)',\n },\n];\n\nfunction classifyIPv4(ip: string): RejectionDetail | null {\n const parts = ip.split('.').map((p) => Number.parseInt(p, 10));\n if (parts.length !== 4 || parts.some((n) => Number.isNaN(n))) return null;\n const [a, b, c] = parts as [number, number, number, number];\n for (const rule of IPV4_RULES) {\n if (rule.match(a, b, c)) {\n return { reason: rule.reason, message: `${rule.label} (${ip})` };\n }\n }\n return null;\n}\n\n/**\n * Expand an IPv6 literal to its eight 16-bit groups, or null if unparseable.\n *\n * A trailing dotted quad (`::ffff:1.2.3.4`) is folded into two groups first,\n * so callers see one representation regardless of spelling.\n */\nfunction foldTrailingQuad(s: string): string | null {\n const dotted = /(?:^|:)((?:\\d{1,3}\\.){3}\\d{1,3})$/.exec(s);\n if (dotted?.[1] === undefined) return s;\n const q = dotted[1].split('.').map((n) => Number.parseInt(n, 10));\n if (q.length !== 4 || q.some((n) => Number.isNaN(n) || n < 0 || n > 255)) return null;\n const hi = (((q[0] ?? 0) << 8) | (q[1] ?? 0)).toString(16);\n const lo = (((q[2] ?? 0) << 8) | (q[3] ?? 0)).toString(16);\n return `${s.slice(0, s.length - dotted[1].length)}${hi}:${lo}`;\n}\n\nfunction toHextets(ip: string): number[] | null {\n const s = foldTrailingQuad(ip.toLowerCase());\n if (s === null) return null;\n const halves = s.split('::');\n if (halves.length > 2) return null;\n const head = halves[0] === '' || halves[0] === undefined ? [] : halves[0].split(':');\n const tail = halves[1] === '' || halves[1] === undefined ? [] : halves[1].split(':');\n const groups =\n halves.length === 1\n ? head\n : [...head, ...Array<string>(8 - head.length - tail.length).fill('0'), ...tail];\n if (groups.length !== 8) return null;\n const out = groups.map((g) => Number.parseInt(g === '' ? '0' : g, 16));\n return out.some((n) => Number.isNaN(n) || n < 0 || n > 0xffff) ? null : out;\n}\n\n/**\n * The IPv4 address embedded in an IPv6 literal, in dotted form, or null.\n *\n * Covers every prefix that carries a routable IPv4 payload: IPv4-mapped\n * (`::ffff:0:0/96`), IPv4-translated (`::ffff:0:0:0/96`), the NAT64\n * well-known prefix (`64:ff9b::/96`), 6to4 (`2002::/16`), and the deprecated\n * IPv4-compatible form (`::a.b.c.d`). Each is the same destination under a\n * different spelling, and the IPv4 rules must apply to all of them.\n */\nfunction embeddedIPv4(g: readonly number[]): string | null {\n // 6to4 is the odd one out: the payload sits in hextets 1-2, not 6-7, so it\n // cannot share the trailing-quad extraction below.\n if (g[0] === 0x2002) return hextetPairToDotted(g[1] ?? 0, g[2] ?? 0);\n const top = g.slice(0, 6);\n const prefixes: ReadonlyArray<readonly number[]> = [\n [0, 0, 0, 0, 0, 0xffff], // ::ffff:0:0/96 — IPv4-mapped\n [0, 0, 0, 0, 0xffff, 0], // ::ffff:0:0:0/96 — IPv4-translated\n [0x64, 0xff9b, 0, 0, 0, 0], // 64:ff9b::/96 — NAT64 well-known\n [0, 0, 0, 0, 0, 0], // ::a.b.c.d — deprecated IPv4-compatible\n ];\n const matched = prefixes.some((p) => p.every((v, i) => top[i] === v));\n if (!matched) return null;\n const g6 = g[6] ?? 0;\n const g7 = g[7] ?? 0;\n // `::` and `::1` are their own addresses, not embedded IPv4.\n if (top.every((v) => v === 0) && g6 === 0 && g7 <= 1) return null;\n return hextetPairToDotted(g6, g7);\n}\n\n/** The dotted IPv4 address carried by two consecutive 16-bit hextets. */\nfunction hextetPairToDotted(hi: number, lo: number): string {\n return [(hi >> 8) & 255, hi & 255, (lo >> 8) & 255, lo & 255].join('.');\n}\n\n/**\n * Classify an IPv6 address by its first hextet, or null if it is not in a\n * non-global prefix.\n *\n * Numeric rather than a string prefix test. The previous `startsWith('fe80:')`\n * covered 1/64th of fe80::/10 — `febf::1` is equally link-local and was\n * allowed — and site-local fec0::/10 had no check at all (second pass over #4884).\n */\nfunction classifyIPv6Prefix(first: number, ip: string): RejectionDetail | null {\n if (first >= 0xfc00 && first <= 0xfdff) {\n return { reason: 'private_range', message: `IPv6 unique-local (${ip}, fc00::/7)` };\n }\n if (first >= 0xfe80 && first <= 0xfebf) {\n return { reason: 'link_local', message: `IPv6 link-local (${ip}, fe80::/10)` };\n }\n if (first >= 0xfec0 && first <= 0xfeff) {\n return { reason: 'private_range', message: `IPv6 site-local (${ip}, fec0::/10)` };\n }\n return null;\n}\n\nfunction classifyIPv6(ip: string): RejectionDetail | null {\n const lower = ip.toLowerCase();\n if (lower === '::1') return { reason: 'loopback', message: `IPv6 loopback (${ip})` };\n\n const groups = toHextets(lower);\n if (groups === null) return null;\n\n const prefixDetail = classifyIPv6Prefix(groups[0] ?? 0, ip);\n if (prefixDetail !== null) return prefixDetail;\n\n if (groups.every((n) => n === 0)) {\n return { reason: 'reserved', message: `IPv6 unspecified (${ip}) — routes to localhost` };\n }\n\n // An IPv4 address written in IPv6 form is still that IPv4 address, and\n // `isIPv6` is true for it so it never reached the IPv4 rules — IMDS,\n // loopback and RFC1918 were all reachable this way. Note the URL parser\n // normalises the dotted spelling to hex, so the hex form is the one that\n // actually arrives.\n const v4 = embeddedIPv4(groups);\n if (v4 === null) return null;\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Y;AAC7B,MAAI,UAAU,MAAO,QAAO,EAAE,QAAQ,YAAY,SAAS,kBAAkB,EAAE,IAAI;AAEnF,QAAM,SAAS,UAAU,KAAK;AAC9B,MAAI,WAAW,KAAM,QAAO;AAE5B,QAAM,eAAe,mBAAmB,OAAO,CAAC,KAAK,GAAG,EAAE;AAC1D,MAAI,iBAAiB,KAAM,QAAO;AAElC,MAAI,OAAO,MAAM,CAAC,MAAM,MAAM,CAAC,GAAG;AAChC,WAAO,EAAE,QAAQ,YAAY,SAAS,qBAAqB,EAAE,+BAA0B;AAAA,EACzF;AAOA,QAAM,KAAK,aAAa,MAAM;AAC9B,MAAI,OAAO,KAAM,QAAO;AACxB,QAAM,SAAS,aAAa,EAAE;AAC9B,SAAO,WAAW,OACd,OACA,EAAE,QAAQ,OAAO,QAAQ,SAAS,GAAG,OAAO,OAAO,cAAc,EAAE,IAAI;AAC7E;","names":[]}
|
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
getCurrentRequestContext,
|
|
6
6
|
runWithRequestContext,
|
|
7
7
|
serverCallerInfo
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-TQZSPGAZ.js";
|
|
9
9
|
import {
|
|
10
10
|
DEFAULT_EXECUTION_MODE
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-TYLE7Z2S.js";
|
|
12
12
|
import {
|
|
13
13
|
sanitizeErrorDetails,
|
|
14
14
|
sanitizeStringLeaves
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-IRFKJ2KR.js";
|
|
16
16
|
import {
|
|
17
17
|
SecurityError,
|
|
18
18
|
TOOL_MANIFEST,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
getTimeProvider,
|
|
27
27
|
ok,
|
|
28
28
|
resolveInsideRoot
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-WI73OZAU.js";
|
|
30
30
|
import {
|
|
31
31
|
getNexusDataDir,
|
|
32
32
|
parseBoolValue
|
|
@@ -2343,4 +2343,4 @@ export {
|
|
|
2343
2343
|
DEFAULT_CONSENSUS_CONFIG,
|
|
2344
2344
|
ConsensusMetricsSchema
|
|
2345
2345
|
};
|
|
2346
|
-
//# sourceMappingURL=chunk-
|
|
2346
|
+
//# sourceMappingURL=chunk-CYROSFMW.js.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
IN_FAMILY_FALLBACK_OPTION
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-NUXSGWDS.js";
|
|
4
4
|
import {
|
|
5
5
|
sanitizeErrorDetails
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-IRFKJ2KR.js";
|
|
7
7
|
import {
|
|
8
8
|
classifyExtractedError,
|
|
9
9
|
getTimeProvider,
|
|
10
10
|
isTimeoutText
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-WI73OZAU.js";
|
|
12
12
|
import {
|
|
13
13
|
resolveClassGuardMs
|
|
14
14
|
} from "./chunk-4PN3UVZV.js";
|
|
@@ -156,4 +156,4 @@ export {
|
|
|
156
156
|
SERVES_PROBE_PROMPT,
|
|
157
157
|
probeServes
|
|
158
158
|
};
|
|
159
|
-
//# sourceMappingURL=chunk-
|
|
159
|
+
//# sourceMappingURL=chunk-EGUISJBB.js.map
|
|
@@ -21,24 +21,24 @@ import {
|
|
|
21
21
|
toolSuccess,
|
|
22
22
|
withProgressHeartbeat,
|
|
23
23
|
wrapToolWithTimeout
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-CYROSFMW.js";
|
|
25
25
|
import {
|
|
26
26
|
getToolMemory
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-VGCRYAEH.js";
|
|
28
28
|
import {
|
|
29
29
|
allOf
|
|
30
30
|
} from "./chunk-EZNIYU5T.js";
|
|
31
31
|
import {
|
|
32
32
|
VERSION
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-TQZSPGAZ.js";
|
|
34
34
|
import {
|
|
35
35
|
isGatewayModelAdapter
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-XQMQGUJT.js";
|
|
37
37
|
import {
|
|
38
38
|
ModelBoundAdapter,
|
|
39
39
|
createEvent,
|
|
40
40
|
getGlobalRegistry
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-V5FGXVSX.js";
|
|
42
42
|
import {
|
|
43
43
|
UNVERIFIABLE_STDERR_RE,
|
|
44
44
|
classifyUnverifiable,
|
|
@@ -46,25 +46,25 @@ import {
|
|
|
46
46
|
getAvailableClis,
|
|
47
47
|
isAbsentSeat,
|
|
48
48
|
markUnverifiable
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-O3VPGING.js";
|
|
50
50
|
import {
|
|
51
51
|
ensureGatewayDiscovered
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-QPU7QKPT.js";
|
|
53
53
|
import {
|
|
54
54
|
CLI_TO_MODELSDEV_VENDOR,
|
|
55
55
|
delay,
|
|
56
56
|
getAbortObservation,
|
|
57
57
|
sleep,
|
|
58
58
|
withTimeout
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-NUXSGWDS.js";
|
|
60
60
|
import {
|
|
61
61
|
getDefaultCliCircuitBreakerRegistry
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-VHOOJ4FG.js";
|
|
63
63
|
import {
|
|
64
64
|
sanitizeErrorDetails,
|
|
65
65
|
sanitizeOutput,
|
|
66
66
|
sanitizeStringLeaves
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-IRFKJ2KR.js";
|
|
68
68
|
import {
|
|
69
69
|
AgentError,
|
|
70
70
|
DecisionCostStore,
|
|
@@ -123,7 +123,7 @@ import {
|
|
|
123
123
|
servedCostDetail,
|
|
124
124
|
stepBus,
|
|
125
125
|
voteRecordWriteFailedMessage
|
|
126
|
-
} from "./chunk-
|
|
126
|
+
} from "./chunk-WI73OZAU.js";
|
|
127
127
|
import {
|
|
128
128
|
ensureLearningDir,
|
|
129
129
|
getOutcomesFile
|
|
@@ -6658,7 +6658,7 @@ function logPartialProposal(bounded, log) {
|
|
|
6658
6658
|
}
|
|
6659
6659
|
async function runContrarianCheck(proposal, options, log, opts) {
|
|
6660
6660
|
try {
|
|
6661
|
-
const { executeExpert } = await import("./expert-bridge-
|
|
6661
|
+
const { executeExpert } = await import("./expert-bridge-5A4ADUBO.js");
|
|
6662
6662
|
const bounded = boundArtifactForReview(proposal, CONTRARIAN_PROPOSAL_BUDGET, "proposal");
|
|
6663
6663
|
logPartialProposal(bounded, log);
|
|
6664
6664
|
const result = await executeExpert(
|
|
@@ -7631,11 +7631,20 @@ async function attachPartialsOnCancel(jobId, toolName, body) {
|
|
|
7631
7631
|
}
|
|
7632
7632
|
|
|
7633
7633
|
// src/orchestration/outcomes/outcome-store-persistence.ts
|
|
7634
|
-
import {
|
|
7634
|
+
import {
|
|
7635
|
+
appendFileSync as appendFileSync2,
|
|
7636
|
+
readFileSync as readFileSync6,
|
|
7637
|
+
writeFileSync as writeFileSync3,
|
|
7638
|
+
existsSync as existsSync5,
|
|
7639
|
+
renameSync,
|
|
7640
|
+
rmSync
|
|
7641
|
+
} from "node:fs";
|
|
7635
7642
|
var PersistedOutcomeSchema = TaskOutcomeSchema.loose();
|
|
7636
7643
|
var PersistentOutcomeStore = class extends OutcomeStore {
|
|
7637
7644
|
filePath;
|
|
7638
7645
|
logger;
|
|
7646
|
+
/** Raw unreadable segments, including their original line terminators. */
|
|
7647
|
+
unreadableLines = [];
|
|
7639
7648
|
constructor(config, logger12) {
|
|
7640
7649
|
super(config);
|
|
7641
7650
|
this.filePath = config?.filePath ?? getOutcomesFile();
|
|
@@ -7691,7 +7700,7 @@ var PersistentOutcomeStore = class extends OutcomeStore {
|
|
|
7691
7700
|
}
|
|
7692
7701
|
try {
|
|
7693
7702
|
const content = readFileSync6(this.filePath, "utf-8");
|
|
7694
|
-
const lines = content.split(
|
|
7703
|
+
const lines = content.split(/(?<=\n)/).filter((line) => line.trim().length > 0);
|
|
7695
7704
|
let loaded = 0;
|
|
7696
7705
|
let skipped = 0;
|
|
7697
7706
|
for (const line of lines) {
|
|
@@ -7702,16 +7711,23 @@ var PersistentOutcomeStore = class extends OutcomeStore {
|
|
|
7702
7711
|
super.append(result.data);
|
|
7703
7712
|
loaded++;
|
|
7704
7713
|
} else {
|
|
7714
|
+
this.unreadableLines.push(line);
|
|
7705
7715
|
skipped++;
|
|
7706
7716
|
}
|
|
7707
|
-
} catch
|
|
7708
|
-
this.
|
|
7709
|
-
error: getErrorMessage(parseErr),
|
|
7710
|
-
linePreview: line.slice(0, 80)
|
|
7711
|
-
});
|
|
7717
|
+
} catch {
|
|
7718
|
+
this.unreadableLines.push(line);
|
|
7712
7719
|
skipped++;
|
|
7713
7720
|
}
|
|
7714
7721
|
}
|
|
7722
|
+
if (skipped > 0) {
|
|
7723
|
+
this.logger.warn(
|
|
7724
|
+
"Skipped unreadable outcome lines during hydration; preserving them on rewrite",
|
|
7725
|
+
{
|
|
7726
|
+
skipped,
|
|
7727
|
+
path: this.filePath
|
|
7728
|
+
}
|
|
7729
|
+
);
|
|
7730
|
+
}
|
|
7715
7731
|
this.logger.info("Hydrated outcomes from disk", {
|
|
7716
7732
|
loaded,
|
|
7717
7733
|
skipped,
|
|
@@ -7719,25 +7735,38 @@ var PersistentOutcomeStore = class extends OutcomeStore {
|
|
|
7719
7735
|
path: this.filePath
|
|
7720
7736
|
});
|
|
7721
7737
|
} catch (error) {
|
|
7722
|
-
const msg = getErrorMessage(error);
|
|
7723
7738
|
this.logger.warn("Failed to hydrate outcomes from disk", {
|
|
7724
|
-
error:
|
|
7739
|
+
error: getErrorMessage(error),
|
|
7725
7740
|
path: this.filePath
|
|
7726
7741
|
});
|
|
7727
7742
|
}
|
|
7728
7743
|
}
|
|
7729
|
-
/**
|
|
7744
|
+
/**
|
|
7745
|
+
* Atomically rewrite readable records, then append unreadable segments verbatim.
|
|
7746
|
+
* Their relative order is preserved; their positions among readable records may
|
|
7747
|
+
* change after reclassification, purge or FIFO eviction (#7146).
|
|
7748
|
+
*/
|
|
7730
7749
|
rewriteFile() {
|
|
7750
|
+
const tmpPath = `${this.filePath}.tmp.${String(process.pid)}`;
|
|
7731
7751
|
try {
|
|
7732
7752
|
const entries = this.query();
|
|
7733
|
-
const content = entries.map((e) => JSON.stringify(e)).join("
|
|
7734
|
-
writeFileSync3(
|
|
7753
|
+
const content = entries.map((e) => JSON.stringify(e) + "\n").join("") + this.unreadableLines.join("");
|
|
7754
|
+
writeFileSync3(tmpPath, content, "utf-8");
|
|
7755
|
+
renameSync(tmpPath, this.filePath);
|
|
7735
7756
|
} catch (error) {
|
|
7736
7757
|
const msg = getErrorMessage(error);
|
|
7737
7758
|
this.logger.warn("Failed to rewrite outcomes file after reclassification", {
|
|
7738
7759
|
error: msg,
|
|
7739
7760
|
path: this.filePath
|
|
7740
7761
|
});
|
|
7762
|
+
try {
|
|
7763
|
+
rmSync(tmpPath, { force: true });
|
|
7764
|
+
} catch (cleanupError) {
|
|
7765
|
+
this.logger.debug("Failed to clean up temporary outcomes file", {
|
|
7766
|
+
error: getErrorMessage(cleanupError),
|
|
7767
|
+
path: tmpPath
|
|
7768
|
+
});
|
|
7769
|
+
}
|
|
7741
7770
|
}
|
|
7742
7771
|
}
|
|
7743
7772
|
persistLine(outcome) {
|
|
@@ -9841,4 +9870,4 @@ export {
|
|
|
9841
9870
|
CONSENSUS_VOTE_TOOL_SCHEMA,
|
|
9842
9871
|
registerConsensusVoteTool
|
|
9843
9872
|
};
|
|
9844
|
-
//# sourceMappingURL=chunk-
|
|
9873
|
+
//# sourceMappingURL=chunk-HBJ3CVDB.js.map
|