nexus-agents 8.76.2 → 8.77.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-BXBBL5G7.js → ast-rule-runner-U5N43D4U.js} +3 -3
- package/dist/{child-mcp-config-3IELNFHI.js → child-mcp-config-IRZHH2TU.js} +2 -2
- package/dist/{chunk-UF3BNMOV.js → chunk-33HHRRKZ.js} +34 -31
- package/dist/chunk-33HHRRKZ.js.map +1 -0
- package/dist/{chunk-A6QRKIGL.js → chunk-4FDESAVV.js} +3 -3
- package/dist/{chunk-WFHUSSKZ.js → chunk-5CIP4EWI.js} +21 -5
- package/dist/chunk-5CIP4EWI.js.map +1 -0
- package/dist/{chunk-PE4QQAAY.js → chunk-5XAJU5ZV.js} +44 -36
- package/dist/chunk-5XAJU5ZV.js.map +1 -0
- package/dist/{chunk-IDPA4X6J.js → chunk-6IUAMO5M.js} +3 -3
- package/dist/{chunk-T52Y554H.js → chunk-7RCC7WGS.js} +2 -2
- package/dist/{chunk-CAIJB3CO.js → chunk-ACXBBUW3.js} +72 -5
- package/dist/chunk-ACXBBUW3.js.map +1 -0
- package/dist/{chunk-NBTG2OQC.js → chunk-AE2U6NUZ.js} +2 -2
- package/dist/{chunk-ZVQ2Q7OM.js → chunk-AVEDKF3J.js} +2 -2
- package/dist/{chunk-IPI4I2UW.js → chunk-CMZPHXDH.js} +2 -2
- package/dist/{chunk-MSPYAOAU.js → chunk-DWQ7TG5L.js} +2 -2
- package/dist/{chunk-6E3DFUYA.js → chunk-EMWRUQQS.js} +5 -5
- package/dist/{chunk-T6W3N3N3.js → chunk-F7R2E74V.js} +2 -2
- package/dist/{chunk-PJZQQYLJ.js → chunk-GHNHZSDW.js} +7 -7
- package/dist/{chunk-BAGUYKZL.js → chunk-GS5OJHJJ.js} +34 -12
- package/dist/chunk-GS5OJHJJ.js.map +1 -0
- package/dist/{chunk-F76Y5QXV.js → chunk-I2MSRFXZ.js} +9 -9
- package/dist/{chunk-VFTP7WSH.js → chunk-J76ZM6QF.js} +2 -2
- package/dist/{chunk-AONC4VYB.js → chunk-LIVTFARG.js} +2 -2
- package/dist/{chunk-J527NA52.js → chunk-LZGSWYDX.js} +3 -3
- package/dist/{chunk-MRGBENPM.js → chunk-NEIPHVTA.js} +2 -2
- package/dist/{chunk-CMG3P6OI.js → chunk-PSCY6MSD.js} +4 -4
- package/dist/{chunk-RC4ZQ4ZE.js → chunk-Q6JZQWQB.js} +28 -31
- package/dist/chunk-Q6JZQWQB.js.map +1 -0
- package/dist/{chunk-EVBLCOEN.js → chunk-QBZ6DBJL.js} +2 -2
- package/dist/{chunk-AWCSYKUR.js → chunk-QNRB5U7W.js} +2 -2
- package/dist/{chunk-FRHYZJGC.js → chunk-SKAPTWVH.js} +3 -3
- package/dist/{chunk-2P4HP2A6.js → chunk-T63EIQYI.js} +2 -2
- package/dist/{chunk-FMAJIIXZ.js → chunk-UNPDTD6N.js} +2 -2
- package/dist/{chunk-GOXBEH6M.js → chunk-VFFG3HIY.js} +2 -2
- package/dist/{chunk-G744HQMZ.js → chunk-VIVM7X76.js} +5 -5
- package/dist/{chunk-MCRMY7K7.js → chunk-WABZQ477.js} +4 -4
- package/dist/{chunk-VKLUJZQV.js → chunk-WUN3IB3T.js} +2 -2
- package/dist/{chunk-MSSRXYMZ.js → chunk-XQ34WJOM.js} +2 -2
- package/dist/{chunk-NOSQXAW3.js → chunk-YUDJV6JF.js} +4 -4
- package/dist/{cli-circuit-breaker-H5CESPLC.js → cli-circuit-breaker-DJU6WTWT.js} +3 -3
- package/dist/cli.js +48 -44
- package/dist/cli.js.map +1 -1
- package/dist/{composite-router-DSYVXQ7C.js → composite-router-F3D2QRHI.js} +2 -2
- package/dist/{consensus-vote-OKA2PL74.js → consensus-vote-7JRI7YF6.js} +16 -16
- package/dist/{context-retriever-C5KY23EG.js → context-retriever-J24ZMIZG.js} +8 -8
- package/dist/{doctor-deep-LBPZXYN4.js → doctor-deep-WWOPRJJS.js} +3 -3
- package/dist/{doctor-live-QAT3FLUJ.js → doctor-live-55CKYQ6V.js} +10 -10
- package/dist/{expert-bridge-F7V2AXUD.js → expert-bridge-5MFBN4ZW.js} +4 -4
- package/dist/{factory-MZTDIMCP.js → factory-3ZA63QDH.js} +9 -9
- package/dist/{factory-ECJNRE2W.js → factory-TXEYHBQV.js} +5 -5
- package/dist/{improvement-review-UEVIATKC.js → improvement-review-JVI3RM7I.js} +5 -5
- package/dist/index.d.ts +55 -2
- package/dist/index.js +30 -30
- package/dist/{init-opencode-WXEXOV6X.js → init-opencode-R5JTQZG5.js} +5 -5
- package/dist/issue-triage-6KIGFUFJ.js +16 -0
- package/dist/{pr-reviewer-helpers-VRPD3CNI.js → pr-reviewer-helpers-HRM74BLX.js} +4 -4
- package/dist/{registry-command-JZLWVBLG.js → registry-command-ZPKPR6WV.js} +2 -2
- package/dist/{repo-security-plan-IS65FSZF.js → repo-security-plan-LXKTNEGB.js} +3 -3
- package/dist/{research-helpers-synthesize-TLZPEOAU.js → research-helpers-synthesize-FZLLZSJM.js} +4 -4
- package/dist/{routing-memory-YHEH7ULH.js → routing-memory-35Z7UVYC.js} +2 -2
- package/dist/{session-memory-5MD3ZFJX.js → session-memory-G7VGV2SC.js} +3 -3
- package/dist/{setup-config-RFOBGXUH.js → setup-config-KLKXB2LM.js} +3 -3
- package/dist/{setup-custom-api-DKXRZY4C.js → setup-custom-api-TJMRUQFK.js} +14 -11
- package/dist/setup-custom-api-TJMRUQFK.js.map +1 -0
- package/dist/setup-data-dir-VCSQTZ6L.js +30 -0
- package/dist/{tool-memory-HCCMGPVI.js → tool-memory-65MWYDEP.js} +5 -5
- package/dist/{unified-registry-3TWHRO5L.js → unified-registry-2HCLBGWM.js} +10 -10
- package/dist/{weather-report-MGOA7OOC.js → weather-report-RMRBC6LH.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-BAGUYKZL.js.map +0 -1
- package/dist/chunk-CAIJB3CO.js.map +0 -1
- package/dist/chunk-PE4QQAAY.js.map +0 -1
- package/dist/chunk-RC4ZQ4ZE.js.map +0 -1
- package/dist/chunk-UF3BNMOV.js.map +0 -1
- package/dist/chunk-WFHUSSKZ.js.map +0 -1
- package/dist/issue-triage-OJZ275JY.js +0 -16
- package/dist/setup-custom-api-DKXRZY4C.js.map +0 -1
- package/dist/setup-data-dir-JXSO4FDY.js +0 -30
- /package/dist/{ast-rule-runner-BXBBL5G7.js.map → ast-rule-runner-U5N43D4U.js.map} +0 -0
- /package/dist/{child-mcp-config-3IELNFHI.js.map → child-mcp-config-IRZHH2TU.js.map} +0 -0
- /package/dist/{chunk-A6QRKIGL.js.map → chunk-4FDESAVV.js.map} +0 -0
- /package/dist/{chunk-IDPA4X6J.js.map → chunk-6IUAMO5M.js.map} +0 -0
- /package/dist/{chunk-T52Y554H.js.map → chunk-7RCC7WGS.js.map} +0 -0
- /package/dist/{chunk-NBTG2OQC.js.map → chunk-AE2U6NUZ.js.map} +0 -0
- /package/dist/{chunk-ZVQ2Q7OM.js.map → chunk-AVEDKF3J.js.map} +0 -0
- /package/dist/{chunk-IPI4I2UW.js.map → chunk-CMZPHXDH.js.map} +0 -0
- /package/dist/{chunk-MSPYAOAU.js.map → chunk-DWQ7TG5L.js.map} +0 -0
- /package/dist/{chunk-6E3DFUYA.js.map → chunk-EMWRUQQS.js.map} +0 -0
- /package/dist/{chunk-T6W3N3N3.js.map → chunk-F7R2E74V.js.map} +0 -0
- /package/dist/{chunk-PJZQQYLJ.js.map → chunk-GHNHZSDW.js.map} +0 -0
- /package/dist/{chunk-F76Y5QXV.js.map → chunk-I2MSRFXZ.js.map} +0 -0
- /package/dist/{chunk-VFTP7WSH.js.map → chunk-J76ZM6QF.js.map} +0 -0
- /package/dist/{chunk-AONC4VYB.js.map → chunk-LIVTFARG.js.map} +0 -0
- /package/dist/{chunk-J527NA52.js.map → chunk-LZGSWYDX.js.map} +0 -0
- /package/dist/{chunk-MRGBENPM.js.map → chunk-NEIPHVTA.js.map} +0 -0
- /package/dist/{chunk-CMG3P6OI.js.map → chunk-PSCY6MSD.js.map} +0 -0
- /package/dist/{chunk-EVBLCOEN.js.map → chunk-QBZ6DBJL.js.map} +0 -0
- /package/dist/{chunk-AWCSYKUR.js.map → chunk-QNRB5U7W.js.map} +0 -0
- /package/dist/{chunk-FRHYZJGC.js.map → chunk-SKAPTWVH.js.map} +0 -0
- /package/dist/{chunk-2P4HP2A6.js.map → chunk-T63EIQYI.js.map} +0 -0
- /package/dist/{chunk-FMAJIIXZ.js.map → chunk-UNPDTD6N.js.map} +0 -0
- /package/dist/{chunk-GOXBEH6M.js.map → chunk-VFFG3HIY.js.map} +0 -0
- /package/dist/{chunk-G744HQMZ.js.map → chunk-VIVM7X76.js.map} +0 -0
- /package/dist/{chunk-MCRMY7K7.js.map → chunk-WABZQ477.js.map} +0 -0
- /package/dist/{chunk-VKLUJZQV.js.map → chunk-WUN3IB3T.js.map} +0 -0
- /package/dist/{chunk-MSSRXYMZ.js.map → chunk-XQ34WJOM.js.map} +0 -0
- /package/dist/{chunk-NOSQXAW3.js.map → chunk-YUDJV6JF.js.map} +0 -0
- /package/dist/{cli-circuit-breaker-H5CESPLC.js.map → cli-circuit-breaker-DJU6WTWT.js.map} +0 -0
- /package/dist/{composite-router-DSYVXQ7C.js.map → composite-router-F3D2QRHI.js.map} +0 -0
- /package/dist/{consensus-vote-OKA2PL74.js.map → consensus-vote-7JRI7YF6.js.map} +0 -0
- /package/dist/{context-retriever-C5KY23EG.js.map → context-retriever-J24ZMIZG.js.map} +0 -0
- /package/dist/{doctor-deep-LBPZXYN4.js.map → doctor-deep-WWOPRJJS.js.map} +0 -0
- /package/dist/{doctor-live-QAT3FLUJ.js.map → doctor-live-55CKYQ6V.js.map} +0 -0
- /package/dist/{expert-bridge-F7V2AXUD.js.map → expert-bridge-5MFBN4ZW.js.map} +0 -0
- /package/dist/{factory-ECJNRE2W.js.map → factory-3ZA63QDH.js.map} +0 -0
- /package/dist/{factory-MZTDIMCP.js.map → factory-TXEYHBQV.js.map} +0 -0
- /package/dist/{improvement-review-UEVIATKC.js.map → improvement-review-JVI3RM7I.js.map} +0 -0
- /package/dist/{init-opencode-WXEXOV6X.js.map → init-opencode-R5JTQZG5.js.map} +0 -0
- /package/dist/{issue-triage-OJZ275JY.js.map → issue-triage-6KIGFUFJ.js.map} +0 -0
- /package/dist/{pr-reviewer-helpers-VRPD3CNI.js.map → pr-reviewer-helpers-HRM74BLX.js.map} +0 -0
- /package/dist/{registry-command-JZLWVBLG.js.map → registry-command-ZPKPR6WV.js.map} +0 -0
- /package/dist/{repo-security-plan-IS65FSZF.js.map → repo-security-plan-LXKTNEGB.js.map} +0 -0
- /package/dist/{research-helpers-synthesize-TLZPEOAU.js.map → research-helpers-synthesize-FZLLZSJM.js.map} +0 -0
- /package/dist/{routing-memory-YHEH7ULH.js.map → routing-memory-35Z7UVYC.js.map} +0 -0
- /package/dist/{session-memory-5MD3ZFJX.js.map → session-memory-G7VGV2SC.js.map} +0 -0
- /package/dist/{setup-config-RFOBGXUH.js.map → setup-config-KLKXB2LM.js.map} +0 -0
- /package/dist/{setup-data-dir-JXSO4FDY.js.map → setup-data-dir-VCSQTZ6L.js.map} +0 -0
- /package/dist/{tool-memory-HCCMGPVI.js.map → tool-memory-65MWYDEP.js.map} +0 -0
- /package/dist/{unified-registry-3TWHRO5L.js.map → unified-registry-2HCLBGWM.js.map} +0 -0
- /package/dist/{weather-report-MGOA7OOC.js.map → weather-report-RMRBC6LH.js.map} +0 -0
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
toolStructuredError,
|
|
8
8
|
toolSuccessStructured,
|
|
9
9
|
wrapToolWithTimeout
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-LZGSWYDX.js";
|
|
11
11
|
import {
|
|
12
12
|
JsonlStore,
|
|
13
13
|
SECURITY_KEYWORDS,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
getTimeProvider,
|
|
21
21
|
isDeclaredNeverDeprecate,
|
|
22
22
|
isRegisteredToolName
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-5CIP4EWI.js";
|
|
24
24
|
import {
|
|
25
25
|
getNexusDataDir,
|
|
26
26
|
nexusDataPath
|
|
@@ -2282,4 +2282,4 @@ export {
|
|
|
2282
2282
|
runImprovementReview,
|
|
2283
2283
|
registerImprovementReviewTool
|
|
2284
2284
|
};
|
|
2285
|
-
//# sourceMappingURL=chunk-
|
|
2285
|
+
//# sourceMappingURL=chunk-6IUAMO5M.js.map
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
isRateLimitText,
|
|
11
11
|
observedArmDisplaySlot,
|
|
12
12
|
ok
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-5CIP4EWI.js";
|
|
14
14
|
|
|
15
15
|
// src/cli-adapters/circuit-breaker-types.ts
|
|
16
16
|
var CircuitErrorCode = {
|
|
@@ -592,4 +592,4 @@ export {
|
|
|
592
592
|
CliCircuitBreakerIntegration,
|
|
593
593
|
createCliCircuitBreakerIntegration
|
|
594
594
|
};
|
|
595
|
-
//# sourceMappingURL=chunk-
|
|
595
|
+
//# sourceMappingURL=chunk-7RCC7WGS.js.map
|
|
@@ -1,10 +1,72 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CUSTOM_API_ALLOW_PRIVATE_ENV,
|
|
3
3
|
ConfigError,
|
|
4
|
+
DEPRECATED_GATEWAY_ENV_ALIASES,
|
|
5
|
+
OPENAI_COMPAT_KEY_ENV,
|
|
6
|
+
OPENAI_COMPAT_URL_ENV,
|
|
4
7
|
createLogger,
|
|
5
8
|
err,
|
|
6
9
|
ok
|
|
7
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-5CIP4EWI.js";
|
|
11
|
+
|
|
12
|
+
// src/adapters/sdk/gateway-env.ts
|
|
13
|
+
function readTrimmed(env, name) {
|
|
14
|
+
const value = env[name]?.trim();
|
|
15
|
+
return value === void 0 || value === "" ? void 0 : value;
|
|
16
|
+
}
|
|
17
|
+
function resolveGatewayEnv(env = process.env) {
|
|
18
|
+
const deprecated = [];
|
|
19
|
+
for (const alias of DEPRECATED_GATEWAY_ENV_ALIASES) {
|
|
20
|
+
if (readTrimmed(env, alias.deprecated) === void 0) continue;
|
|
21
|
+
deprecated.push({
|
|
22
|
+
name: alias.deprecated,
|
|
23
|
+
replacement: alias.replacement,
|
|
24
|
+
shadowed: readTrimmed(env, alias.replacement) !== void 0
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
baseUrl: readWithAlias(env, OPENAI_COMPAT_URL_ENV),
|
|
29
|
+
apiKey: readWithAlias(env, OPENAI_COMPAT_KEY_ENV),
|
|
30
|
+
deprecated
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function readWithAlias(env, replacement) {
|
|
34
|
+
const current = readTrimmed(env, replacement);
|
|
35
|
+
if (current !== void 0) return current;
|
|
36
|
+
const alias = DEPRECATED_GATEWAY_ENV_ALIASES.find((a) => a.replacement === replacement);
|
|
37
|
+
return alias === void 0 ? void 0 : readTrimmed(env, alias.deprecated);
|
|
38
|
+
}
|
|
39
|
+
var defaultLogger = createLogger({ component: "gateway-env" });
|
|
40
|
+
var deprecationWarned = false;
|
|
41
|
+
function warnDeprecatedGatewayEnvOnce(env = process.env, logger2 = defaultLogger) {
|
|
42
|
+
if (deprecationWarned) return;
|
|
43
|
+
const { deprecated } = resolveGatewayEnv(env);
|
|
44
|
+
if (deprecated.length === 0) return;
|
|
45
|
+
deprecationWarned = true;
|
|
46
|
+
logger2.warn(formatDeprecationWarning(deprecated));
|
|
47
|
+
}
|
|
48
|
+
function formatDeprecationWarning(deprecated) {
|
|
49
|
+
const uses = deprecated.map(
|
|
50
|
+
(d) => d.shadowed ? `${d.name} (ignored: ${d.replacement} is set)` : `${d.name} (honoured; rename to ${d.replacement})`
|
|
51
|
+
).join("; ");
|
|
52
|
+
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).`;
|
|
53
|
+
}
|
|
54
|
+
function readGatewayEnv(env = process.env, logger2 = defaultLogger) {
|
|
55
|
+
const resolved = resolveGatewayEnv(env);
|
|
56
|
+
if (resolved.deprecated.length > 0) warnDeprecatedGatewayEnvOnce(env, logger2);
|
|
57
|
+
return resolved;
|
|
58
|
+
}
|
|
59
|
+
function hostnameOf(baseUrl) {
|
|
60
|
+
try {
|
|
61
|
+
const host = new URL(baseUrl).hostname;
|
|
62
|
+
return host === "" ? "<no host>" : host;
|
|
63
|
+
} catch {
|
|
64
|
+
return "<unparseable url>";
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function redactApiKey(message, apiKey) {
|
|
68
|
+
return apiKey === void 0 || apiKey === "" ? message : message.replaceAll(apiKey, "<redacted>");
|
|
69
|
+
}
|
|
8
70
|
|
|
9
71
|
// src/adapters/sdk/custom-api-validation.ts
|
|
10
72
|
import { isIPv4, isIPv6 } from "node:net";
|
|
@@ -14,7 +76,7 @@ function validateCustomApiBaseUrl(raw, opts = {}) {
|
|
|
14
76
|
if (raw === void 0 || raw.trim() === "") {
|
|
15
77
|
return err(
|
|
16
78
|
new ConfigError(
|
|
17
|
-
"Custom API base URL is required but missing. Set
|
|
79
|
+
"Custom API base URL is required but missing. Set NEXUS_OPENAI_COMPAT_URL or pass `baseUrl` in config."
|
|
18
80
|
)
|
|
19
81
|
);
|
|
20
82
|
}
|
|
@@ -22,11 +84,11 @@ function validateCustomApiBaseUrl(raw, opts = {}) {
|
|
|
22
84
|
try {
|
|
23
85
|
url = new URL(raw);
|
|
24
86
|
} catch {
|
|
25
|
-
return err(new ConfigError(
|
|
87
|
+
return err(new ConfigError("Custom API base URL is not a valid URL"));
|
|
26
88
|
}
|
|
27
89
|
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
28
90
|
return err(
|
|
29
|
-
new ConfigError(`Custom API base URL must use http or https, got "${url.protocol}"
|
|
91
|
+
new ConfigError(`Custom API base URL must use http or https, got "${url.protocol}"`)
|
|
30
92
|
);
|
|
31
93
|
}
|
|
32
94
|
const allowPrivate = opts.allowPrivate === true || resolveAllowPrivateFromEnv();
|
|
@@ -245,7 +307,12 @@ function classifyIPv6(ip) {
|
|
|
245
307
|
}
|
|
246
308
|
|
|
247
309
|
export {
|
|
310
|
+
resolveGatewayEnv,
|
|
311
|
+
warnDeprecatedGatewayEnvOnce,
|
|
312
|
+
readGatewayEnv,
|
|
313
|
+
hostnameOf,
|
|
314
|
+
redactApiKey,
|
|
248
315
|
validateCustomApiBaseUrl,
|
|
249
316
|
assertCustomApiHostResolvesPublic
|
|
250
317
|
};
|
|
251
|
-
//# sourceMappingURL=chunk-
|
|
318
|
+
//# sourceMappingURL=chunk-ACXBBUW3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/adapters/sdk/gateway-env.ts","../src/adapters/sdk/custom-api-validation.ts"],"sourcesContent":["/**\n * Env resolver for the single-model `custom-openai` gateway path (#4392\n * increment 3).\n *\n * Two mechanisms read an OpenAI-compatible gateway from the environment:\n *\n * A. the single-model SDK path — `SdkAdapter({ providerId: 'custom-openai' })`\n * via `auto-adapter.ts`, which mints the `api:custom-openai` routing arm\n * under `NEXUS_BILLING_MODE=api`;\n * B. the discovery path — `openai-compat-adapter.ts`, which lists the\n * gateway's models, serves voters in-process and registers ONE\n * `api:<endpoint>` arm.\n *\n * Both take a base URL and a key. Mechanism A historically read\n * `NEXUS_CUSTOM_API_BASE_URL` / `NEXUS_CUSTOM_API_KEY`; mechanism B reads\n * `NEXUS_OPENAI_COMPAT_URL` / `NEXUS_OPENAI_COMPAT_KEY`. This module makes the\n * old pair a deprecated ALIAS of the new pair for mechanism A only — a pure\n * rename shim, resolution `new ?? old` per variable (panel\n * vote-1789558437481-yup142p runoff, option C). Mechanism B is deliberately\n * NOT fed from the alias: renaming to the new names is what opts an operator\n * into the gateway path, and the deprecation warn says so. The aliases are\n * dropped in the next major (#6291).\n *\n * @module adapters/sdk/gateway-env\n */\n\nimport type { ILogger } from '../../core/index.js';\nimport { createLogger } from '../../core/index.js';\nimport {\n DEPRECATED_GATEWAY_ENV_ALIASES,\n OPENAI_COMPAT_KEY_ENV,\n OPENAI_COMPAT_URL_ENV,\n} from './types.js';\n\n/** One deprecated gateway env name found set in the environment. */\nexport interface DeprecatedGatewayEnvUse {\n readonly name: string;\n readonly replacement: string;\n /** True when the replacement is also set, so this alias is ignored. */\n readonly shadowed: boolean;\n}\n\n/** The resolved mechanism-A gateway pair plus every deprecated name in use. */\nexport interface GatewayEnv {\n /** `NEXUS_OPENAI_COMPAT_URL ?? NEXUS_CUSTOM_API_BASE_URL`, trimmed; empty is unset. */\n readonly baseUrl: string | undefined;\n /** `NEXUS_OPENAI_COMPAT_KEY ?? NEXUS_CUSTOM_API_KEY`, trimmed; empty is unset. */\n readonly apiKey: string | undefined;\n /** Deprecated names that are set, in table order — empty when none is. */\n readonly deprecated: readonly DeprecatedGatewayEnvUse[];\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/**\n * Resolve the mechanism-A gateway pair from `env` (default `process.env`).\n * Pure: no logging, no once-guard. `readGatewayEnv` is the production entry;\n * this one serves the report surfaces (env-schema, doctor) that must not warn.\n */\nexport function resolveGatewayEnv(env: NodeJS.ProcessEnv = process.env): GatewayEnv {\n const deprecated: DeprecatedGatewayEnvUse[] = [];\n for (const alias of DEPRECATED_GATEWAY_ENV_ALIASES) {\n if (readTrimmed(env, alias.deprecated) === undefined) continue;\n deprecated.push({\n name: alias.deprecated,\n replacement: alias.replacement,\n shadowed: readTrimmed(env, alias.replacement) !== undefined,\n });\n }\n return {\n baseUrl: readWithAlias(env, OPENAI_COMPAT_URL_ENV),\n apiKey: readWithAlias(env, OPENAI_COMPAT_KEY_ENV),\n deprecated,\n };\n}\n\n/** `new ?? old` for one variable, the old spelling taken from the alias table. */\nfunction readWithAlias(env: NodeJS.ProcessEnv, replacement: string): string | undefined {\n const current = readTrimmed(env, replacement);\n if (current !== undefined) return current;\n const alias = DEPRECATED_GATEWAY_ENV_ALIASES.find((a) => a.replacement === replacement);\n return alias === undefined ? undefined : readTrimmed(env, alias.deprecated);\n}\n\nconst defaultLogger = createLogger({ component: 'gateway-env' });\n\n/**\n * Once per process: a deprecated name is set, so the operator hears about it\n * exactly once, from whichever reader gets there first (or from server\n * startup). Names only — never a value.\n */\nlet deprecationWarned = false;\n\n/** Test-only: re-arm the once-guard. */\nexport function _resetDeprecatedGatewayEnvWarning(): void {\n deprecationWarned = false;\n}\n\n/**\n * Emit the one deprecation warn if any deprecated gateway name is set and it\n * has not been emitted yet in this process. Safe to call from every reader;\n * the gateway bootstrap (`cli-server-gateway.ts` `tryWireGatewayAdapters`)\n * calls it at server startup so the line appears even when no reader of the\n * alias is reached (plan billing with a CLI available never consults\n * mechanism A).\n */\nexport function warnDeprecatedGatewayEnvOnce(\n env: NodeJS.ProcessEnv = process.env,\n logger: ILogger = defaultLogger\n): void {\n if (deprecationWarned) return;\n const { deprecated } = resolveGatewayEnv(env);\n if (deprecated.length === 0) return;\n deprecationWarned = true;\n logger.warn(formatDeprecationWarning(deprecated));\n}\n\n/**\n * The warn line. Each name says whether it is honoured or ignored (shadowed\n * by its replacement), then the option-C consequence: these names configure\n * only the single-model `custom-openai` path, and the rename is the opt-in\n * to the gateway path. No value is ever interpolated — a URL can carry\n * userinfo and the key is the key.\n */\nfunction formatDeprecationWarning(deprecated: readonly DeprecatedGatewayEnvUse[]): string {\n const uses = deprecated\n .map((d) =>\n d.shadowed\n ? `${d.name} (ignored: ${d.replacement} is set)`\n : `${d.name} (honoured; rename to ${d.replacement})`\n )\n .join('; ');\n return (\n `Deprecated gateway environment variable(s) set (#4392): ${uses}. ` +\n 'These names configure only the single-model custom-openai path and stay aliases ' +\n 'until the next major (#6291). Rename to NEXUS_OPENAI_COMPAT_* to opt into the ' +\n 'gateway path (model discovery, in-process voter transport, api:<endpoint> arm).'\n );\n}\n\n/**\n * The production reader for mechanism A: resolve the pair and emit the\n * once-per-process deprecation warn when a deprecated name is set.\n */\nexport function readGatewayEnv(\n env: NodeJS.ProcessEnv = process.env,\n logger: ILogger = defaultLogger\n): GatewayEnv {\n const resolved = resolveGatewayEnv(env);\n if (resolved.deprecated.length > 0) warnDeprecatedGatewayEnvOnce(env, logger);\n return resolved;\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. An empty key\n * matches nothing (`replaceAll('')` would interleave the marker).\n */\nexport function redactApiKey(message: string, apiKey: string | undefined): string {\n return apiKey === undefined || apiKey === '' ? message : message.replaceAll(apiKey, '<redacted>');\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;\n const detail = classifyIPv4(v4);\n return detail === null\n ? null\n : { reason: detail.reason, message: `${detail.message} via IPv6 (${ip})` };\n}\n"],"mappings":";;;;;;;;;;;;AAqDA,SAAS,YAAY,KAAwB,MAAkC;AAC7E,QAAM,QAAQ,IAAI,IAAI,GAAG,KAAK;AAC9B,SAAO,UAAU,UAAa,UAAU,KAAK,SAAY;AAC3D;AAOO,SAAS,kBAAkB,MAAyB,QAAQ,KAAiB;AAClF,QAAM,aAAwC,CAAC;AAC/C,aAAW,SAAS,gCAAgC;AAClD,QAAI,YAAY,KAAK,MAAM,UAAU,MAAM,OAAW;AACtD,eAAW,KAAK;AAAA,MACd,MAAM,MAAM;AAAA,MACZ,aAAa,MAAM;AAAA,MACnB,UAAU,YAAY,KAAK,MAAM,WAAW,MAAM;AAAA,IACpD,CAAC;AAAA,EACH;AACA,SAAO;AAAA,IACL,SAAS,cAAc,KAAK,qBAAqB;AAAA,IACjD,QAAQ,cA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,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":["logger"]}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
getErrorMessage,
|
|
5
5
|
getTimeProvider,
|
|
6
6
|
ok
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-5CIP4EWI.js";
|
|
8
8
|
|
|
9
9
|
// src/context/session-memory.ts
|
|
10
10
|
import * as fs from "node:fs";
|
|
@@ -370,4 +370,4 @@ export {
|
|
|
370
370
|
SessionMemory,
|
|
371
371
|
createSessionMemory
|
|
372
372
|
};
|
|
373
|
-
//# sourceMappingURL=chunk-
|
|
373
|
+
//# sourceMappingURL=chunk-AE2U6NUZ.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
createLogger,
|
|
6
6
|
getTimeProvider
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-5CIP4EWI.js";
|
|
8
8
|
|
|
9
9
|
// src/mcp/tools/scanner-registry-fetcher.ts
|
|
10
10
|
import { z } from "zod";
|
|
@@ -740,4 +740,4 @@ export {
|
|
|
740
740
|
generateSecurityPlan,
|
|
741
741
|
buildPlanFromAnalysis
|
|
742
742
|
};
|
|
743
|
-
//# sourceMappingURL=chunk-
|
|
743
|
+
//# sourceMappingURL=chunk-AVEDKF3J.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
createLogger,
|
|
3
3
|
err,
|
|
4
4
|
ok
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-5CIP4EWI.js";
|
|
6
6
|
|
|
7
7
|
// src/scm/token-resolver.ts
|
|
8
8
|
import { execFile } from "node:child_process";
|
|
@@ -87,4 +87,4 @@ export {
|
|
|
87
87
|
hasToken,
|
|
88
88
|
getTokenEnvVars
|
|
89
89
|
};
|
|
90
|
-
//# sourceMappingURL=chunk-
|
|
90
|
+
//# sourceMappingURL=chunk-CMZPHXDH.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveClassGuardMs
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5CIP4EWI.js";
|
|
4
4
|
|
|
5
5
|
// src/cli/cli-readiness.ts
|
|
6
6
|
var READINESS_LEVELS = ["installed", "authenticated", "serves"];
|
|
@@ -90,4 +90,4 @@ export {
|
|
|
90
90
|
SERVES_PROBE_PROMPT,
|
|
91
91
|
probeServes
|
|
92
92
|
};
|
|
93
|
-
//# sourceMappingURL=chunk-
|
|
93
|
+
//# sourceMappingURL=chunk-DWQ7TG5L.js.map
|
|
@@ -8,13 +8,13 @@ import {
|
|
|
8
8
|
loadTechniquesRegistry,
|
|
9
9
|
resolveInsideRoot,
|
|
10
10
|
savePapersRegistry
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-NEIPHVTA.js";
|
|
12
12
|
import {
|
|
13
13
|
resolveToken
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-CMZPHXDH.js";
|
|
15
15
|
import {
|
|
16
16
|
getToolMemory
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-YUDJV6JF.js";
|
|
18
18
|
import {
|
|
19
19
|
capitalizeWords,
|
|
20
20
|
tokenizeFiltered,
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
ok,
|
|
44
44
|
registerPersistentDistillerFactory,
|
|
45
45
|
sigmoidConfidence
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-5CIP4EWI.js";
|
|
47
47
|
import {
|
|
48
48
|
ensureLearningDir,
|
|
49
49
|
getRulesFile
|
|
@@ -4241,4 +4241,4 @@ export {
|
|
|
4241
4241
|
DEFAULT_CONTEXT_BUDGET_TOKENS,
|
|
4242
4242
|
getContextPromptPrefix
|
|
4243
4243
|
};
|
|
4244
|
-
//# sourceMappingURL=chunk-
|
|
4244
|
+
//# sourceMappingURL=chunk-EMWRUQQS.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
CACHE_TIMEOUTS,
|
|
3
3
|
createLogger,
|
|
4
4
|
getTimeProvider
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-5CIP4EWI.js";
|
|
6
6
|
|
|
7
7
|
// src/security/trust-types.ts
|
|
8
8
|
import { z } from "zod";
|
|
@@ -610,4 +610,4 @@ export {
|
|
|
610
610
|
resolveReputationGatingMode,
|
|
611
611
|
gateWithReputation
|
|
612
612
|
};
|
|
613
|
-
//# sourceMappingURL=chunk-
|
|
613
|
+
//# sourceMappingURL=chunk-F7R2E74V.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveCliSlot
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-J76ZM6QF.js";
|
|
4
4
|
import {
|
|
5
5
|
createLogger,
|
|
6
6
|
getTimeProvider,
|
|
7
7
|
isRateLimitText
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-5CIP4EWI.js";
|
|
9
9
|
|
|
10
10
|
// src/pipeline/expert-bridge.ts
|
|
11
11
|
function resolveCliFromModelString(model) {
|
|
@@ -21,7 +21,7 @@ async function getMcpConfigPath() {
|
|
|
21
21
|
if (cachedMcpConfigPath !== null) return cachedMcpConfigPath;
|
|
22
22
|
mcpConfigInitPromise ??= (async () => {
|
|
23
23
|
try {
|
|
24
|
-
const { generateMcpConfig } = await import("./child-mcp-config-
|
|
24
|
+
const { generateMcpConfig } = await import("./child-mcp-config-IRZHH2TU.js");
|
|
25
25
|
const config = await generateMcpConfig();
|
|
26
26
|
cachedMcpConfigPath = config.configPath;
|
|
27
27
|
cachedMcpConfigCleanup = config.cleanup;
|
|
@@ -93,8 +93,8 @@ var routerInitPromise = null;
|
|
|
93
93
|
async function getRouter() {
|
|
94
94
|
if (cachedRouter !== null) return cachedRouter;
|
|
95
95
|
routerInitPromise ??= (async () => {
|
|
96
|
-
const { createAllAdapters } = await import("./factory-
|
|
97
|
-
const { createCompositeRouter } = await import("./composite-router-
|
|
96
|
+
const { createAllAdapters } = await import("./factory-3ZA63QDH.js");
|
|
97
|
+
const { createCompositeRouter } = await import("./composite-router-F3D2QRHI.js");
|
|
98
98
|
const adapters = createAllAdapters();
|
|
99
99
|
if (adapters.size === 0) {
|
|
100
100
|
routerInitPromise = null;
|
|
@@ -102,7 +102,7 @@ async function getRouter() {
|
|
|
102
102
|
}
|
|
103
103
|
cachedRouter = adaptCompositeRouter(createCompositeRouter(adapters));
|
|
104
104
|
try {
|
|
105
|
-
const { createCliCircuitBreakerIntegration } = await import("./cli-circuit-breaker-
|
|
105
|
+
const { createCliCircuitBreakerIntegration } = await import("./cli-circuit-breaker-DJU6WTWT.js");
|
|
106
106
|
cachedCircuitBreaker = createCliCircuitBreakerIntegration([...adapters.values()]);
|
|
107
107
|
} catch (error) {
|
|
108
108
|
const msg = error instanceof Error ? error.message : String(error);
|
|
@@ -216,4 +216,4 @@ export {
|
|
|
216
216
|
tokenSplitFromUsage,
|
|
217
217
|
executeExpert
|
|
218
218
|
};
|
|
219
|
-
//# sourceMappingURL=chunk-
|
|
219
|
+
//# sourceMappingURL=chunk-GHNHZSDW.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SERVES_PROBE_PROMPT
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DWQ7TG5L.js";
|
|
4
4
|
import {
|
|
5
5
|
readOpenAICompatEndpoint,
|
|
6
6
|
readOpenAICompatEnv
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-Q6JZQWQB.js";
|
|
8
8
|
import {
|
|
9
9
|
allOf
|
|
10
10
|
} from "./chunk-OQB3XC5O.js";
|
|
@@ -12,10 +12,10 @@ import {
|
|
|
12
12
|
NODE_ENGINE_RANGE,
|
|
13
13
|
VERSION,
|
|
14
14
|
isNodeVersionSupported
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-QBZ6DBJL.js";
|
|
16
16
|
import {
|
|
17
17
|
claimGlobalRegistry
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-PSCY6MSD.js";
|
|
19
19
|
import {
|
|
20
20
|
capitalize
|
|
21
21
|
} from "./chunk-7LP6VJRP.js";
|
|
@@ -26,7 +26,10 @@ import {
|
|
|
26
26
|
codexMcpServerAvailable,
|
|
27
27
|
createAllAdapters,
|
|
28
28
|
probeCli
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-33HHRRKZ.js";
|
|
30
|
+
import {
|
|
31
|
+
resolveGatewayEnv
|
|
32
|
+
} from "./chunk-ACXBBUW3.js";
|
|
30
33
|
import {
|
|
31
34
|
getNexusTmpDir
|
|
32
35
|
} from "./chunk-HERI7LXN.js";
|
|
@@ -35,6 +38,8 @@ import {
|
|
|
35
38
|
DEFAULT_OPENAI_COMPAT_ENDPOINT,
|
|
36
39
|
GATEWAY_COST_ENV,
|
|
37
40
|
OPENAI_COMPAT_ENDPOINT_ENV,
|
|
41
|
+
OPENAI_COMPAT_KEY_ENV,
|
|
42
|
+
OPENAI_COMPAT_URL_ENV,
|
|
38
43
|
colors,
|
|
39
44
|
createLogger,
|
|
40
45
|
describeGatewayCostDeclaration,
|
|
@@ -52,7 +57,7 @@ import {
|
|
|
52
57
|
resolveGatewayCostDeclaration,
|
|
53
58
|
symbols,
|
|
54
59
|
writeLine
|
|
55
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-5CIP4EWI.js";
|
|
56
61
|
import {
|
|
57
62
|
getLearningDir,
|
|
58
63
|
getOutcomesFile,
|
|
@@ -418,11 +423,25 @@ function printVoterTransportCheck(check) {
|
|
|
418
423
|
if (check.configured) {
|
|
419
424
|
writeLine(`${CHECK} Voter transport: In-process gateway`);
|
|
420
425
|
printGatewayCostLine(check.cost);
|
|
426
|
+
printDeprecatedEnvLines(check.deprecatedEnv);
|
|
421
427
|
return;
|
|
422
428
|
}
|
|
423
429
|
writeLine(`${CHECK} Voter transport: ${colors.dim}CLI subprocess${colors.reset}`);
|
|
424
430
|
writeLine(
|
|
425
|
-
` ${colors.dim}Set
|
|
431
|
+
` ${colors.dim}Set ${OPENAI_COMPAT_URL_ENV} and ${OPENAI_COMPAT_KEY_ENV} for faster in-process voting${colors.reset}`
|
|
432
|
+
);
|
|
433
|
+
printDeprecatedEnvLines(check.deprecatedEnv);
|
|
434
|
+
}
|
|
435
|
+
function printDeprecatedEnvLines(deprecatedEnv) {
|
|
436
|
+
if (deprecatedEnv === void 0 || deprecatedEnv.length === 0) return;
|
|
437
|
+
for (const d of deprecatedEnv) {
|
|
438
|
+
const status = d.shadowed ? `ignored because ${d.replacement} is set` : "honoured";
|
|
439
|
+
writeLine(
|
|
440
|
+
`${WARN} ${d.name} is deprecated \u2014 use ${d.replacement} (alias until the next major, #6291); ${status}`
|
|
441
|
+
);
|
|
442
|
+
}
|
|
443
|
+
writeLine(
|
|
444
|
+
` ${colors.dim}The legacy names configure only the single-model custom-openai path; renaming to NEXUS_OPENAI_COMPAT_* opts into the gateway path (model discovery, in-process voter transport, api:<endpoint> arm)${colors.reset}`
|
|
426
445
|
);
|
|
427
446
|
}
|
|
428
447
|
var CEILING_CONSEQUENCE = "the task-class cost ceiling and the per-task budget exclude this gateway until declared";
|
|
@@ -1263,10 +1282,13 @@ function collectEnvironmentChecks() {
|
|
|
1263
1282
|
}
|
|
1264
1283
|
function checkVoterTransport() {
|
|
1265
1284
|
const gateway = readOpenAICompatEnv();
|
|
1266
|
-
|
|
1285
|
+
const { deprecated } = resolveGatewayEnv();
|
|
1286
|
+
const deprecatedEnv = deprecated.length > 0 ? { deprecatedEnv: deprecated } : {};
|
|
1287
|
+
if (gateway === null) return { configured: false, ...deprecatedEnv };
|
|
1267
1288
|
return {
|
|
1268
1289
|
configured: true,
|
|
1269
|
-
cost: voterGatewayCostDeclaration(gateway.endpoint ?? readOpenAICompatEndpoint())
|
|
1290
|
+
cost: voterGatewayCostDeclaration(gateway.endpoint ?? readOpenAICompatEndpoint()),
|
|
1291
|
+
...deprecatedEnv
|
|
1270
1292
|
};
|
|
1271
1293
|
}
|
|
1272
1294
|
function voterGatewayCostDeclaration(endpoint) {
|
|
@@ -1350,13 +1372,13 @@ async function runDoctorFix(result) {
|
|
|
1350
1372
|
writeLine2("\u2500".repeat(40));
|
|
1351
1373
|
let fixCount = 0;
|
|
1352
1374
|
if (!result.dataDirectory.rootExists || result.dataDirectory.subdirectories.some((d) => !d.exists || !d.writable)) {
|
|
1353
|
-
const { initDataDirectories: initDataDirectories2, describeDataDirFix: describeDataDirFix2 } = await import("./setup-data-dir-
|
|
1375
|
+
const { initDataDirectories: initDataDirectories2, describeDataDirFix: describeDataDirFix2 } = await import("./setup-data-dir-VCSQTZ6L.js");
|
|
1354
1376
|
const outcome = describeDataDirFix2(initDataDirectories2());
|
|
1355
1377
|
writeLine2(outcome.line);
|
|
1356
1378
|
if (outcome.counted) fixCount++;
|
|
1357
1379
|
}
|
|
1358
1380
|
if (!result.configFile.found) {
|
|
1359
|
-
const { runConfigInitSync } = await import("./setup-config-
|
|
1381
|
+
const { runConfigInitSync } = await import("./setup-config-KLKXB2LM.js");
|
|
1360
1382
|
const configResult = runConfigInitSync(process.cwd(), false, false);
|
|
1361
1383
|
if (configResult.success && configResult.created) {
|
|
1362
1384
|
writeLine2(`\u2713 Generated config: ${configResult.path}`);
|
|
@@ -1452,4 +1474,4 @@ export {
|
|
|
1452
1474
|
startStdioServer,
|
|
1453
1475
|
closeServer
|
|
1454
1476
|
};
|
|
1455
|
-
//# sourceMappingURL=chunk-
|
|
1477
|
+
//# sourceMappingURL=chunk-GS5OJHJJ.js.map
|