nexus-agents 10.1.0 → 10.2.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-AAOBENF2.js → ast-rule-runner-RI7ZJ4ZI.js} +3 -3
- package/dist/{child-mcp-config-FRWGQIHP.js → child-mcp-config-73BX4OTR.js} +2 -2
- package/dist/{chunk-NUXSGWDS.js → chunk-23QA6GQD.js} +5 -5
- package/dist/{chunk-EGUISJBB.js → chunk-2DYCHHWW.js} +4 -4
- package/dist/{chunk-TLITBKMZ.js → chunk-2TA6KTRF.js} +15 -15
- package/dist/{chunk-YHY7GMAL.js → chunk-4JJI34RV.js} +2 -2
- package/dist/{chunk-KPGWNBDA.js → chunk-7EV3QAKO.js} +2 -2
- package/dist/{chunk-SCQ5YAYO.js → chunk-D6E3LJGP.js} +4 -4
- package/dist/{chunk-XYYXVJSO.js → chunk-EJ5EBTAV.js} +2 -2
- package/dist/{chunk-BJLP4E6Q.js → chunk-FNHVTDHZ.js} +3 -3
- package/dist/{chunk-VGCRYAEH.js → chunk-FWQSOPBA.js} +4 -4
- package/dist/{chunk-RBFHY2LF.js → chunk-GAX75XCV.js} +2 -2
- package/dist/{chunk-O46IOND3.js → chunk-GX5ZHZR2.js} +7 -7
- package/dist/{chunk-33C22IY4.js → chunk-J44RKRGQ.js} +3 -3
- package/dist/{chunk-L4P4A7Z2.js → chunk-JGY5HMWI.js} +2 -2
- package/dist/{chunk-WCHN7B2Q.js → chunk-JUUGLXSN.js} +8 -10
- package/dist/{chunk-WCHN7B2Q.js.map → chunk-JUUGLXSN.js.map} +1 -1
- package/dist/{chunk-BK6Q3VQK.js → chunk-KASBBKAQ.js} +2 -2
- package/dist/chunk-KASBBKAQ.js.map +1 -0
- package/dist/chunk-KLSNDPU6.js +2412 -0
- package/dist/chunk-KLSNDPU6.js.map +1 -0
- package/dist/{chunk-HQWQ7MR5.js → chunk-LP5ISXKM.js} +4 -4
- package/dist/{chunk-QPU7QKPT.js → chunk-LXYT2P2Y.js} +3 -3
- package/dist/{chunk-C6MM6Z65.js → chunk-OMSKBBL7.js} +45 -27
- package/dist/chunk-OMSKBBL7.js.map +1 -0
- package/dist/{chunk-M4IJ3H6M.js → chunk-PXYSAG5B.js} +2 -2
- package/dist/{chunk-52Q72CPP.js → chunk-QG3VDSWD.js} +3 -3
- package/dist/{chunk-IRFKJ2KR.js → chunk-QM5W3T3O.js} +2 -2
- package/dist/{chunk-O3VPGING.js → chunk-QRC3QLUQ.js} +92 -95
- package/dist/chunk-QRC3QLUQ.js.map +1 -0
- package/dist/{chunk-MCWIMVG2.js → chunk-QS5HGPCN.js} +2 -2
- package/dist/{chunk-O5OUJ3PX.js → chunk-SS53PZO6.js} +5 -5
- package/dist/{chunk-VHOOJ4FG.js → chunk-SX2XWCGA.js} +2 -2
- package/dist/{chunk-2VD5OQQR.js → chunk-TDUXUVUU.js} +2 -2
- package/dist/{chunk-XFTTKOHK.js → chunk-U37AITDA.js} +2 -2
- package/dist/{chunk-V5FGXVSX.js → chunk-UZJ6IPJR.js} +5 -5
- package/dist/{chunk-MYM2TPNL.js → chunk-V26YQQK4.js} +2 -2
- package/dist/{chunk-HVZVVDFN.js → chunk-VLOPXV47.js} +5 -5
- package/dist/{chunk-AMK4BTAV.js → chunk-WD4DENPC.js} +3 -3
- package/dist/{chunk-WI73OZAU.js → chunk-WKFPKPEM.js} +13 -13
- package/dist/chunk-WKFPKPEM.js.map +1 -0
- package/dist/{chunk-IYEZVAJT.js → chunk-XDUTAUK3.js} +40 -42
- package/dist/{chunk-IYEZVAJT.js.map → chunk-XDUTAUK3.js.map} +1 -1
- package/dist/{cli-circuit-breaker-AM425BRL.js → cli-circuit-breaker-62YOQQT3.js} +3 -3
- package/dist/{cli-readiness-LWOMHZ34.js → cli-readiness-O6EOQV4L.js} +7 -7
- package/dist/cli.js +61 -56
- package/dist/cli.js.map +1 -1
- package/dist/{composite-router-VXQFXNET.js → composite-router-YPZ3D5Y6.js} +2 -2
- package/dist/{consensus-vote-V2JQHILD.js → consensus-vote-RNQQUBXO.js} +16 -17
- package/dist/{context-retriever-GEQIPCVL.js → context-retriever-HVPLM6DH.js} +8 -8
- package/dist/{doctor-deep-DSOZGB5J.js → doctor-deep-UZQTD65D.js} +3 -3
- package/dist/{doctor-gateway-report-RJOSOHGA.js → doctor-gateway-report-LRBPPJD4.js} +6 -7
- package/dist/{doctor-live-7LVRGOS5.js → doctor-live-QFLT5SDB.js} +11 -11
- package/dist/{expert-bridge-5A4ADUBO.js → expert-bridge-O3UZXLGB.js} +4 -4
- package/dist/{factory-UBAUIA2M.js → factory-KCKQQAEH.js} +10 -10
- package/dist/{factory-4RZLP7QV.js → factory-LUKUIB6C.js} +5 -5
- package/dist/{improvement-review-UIYSAI36.js → improvement-review-7IABFAU3.js} +6 -6
- package/dist/index.d.ts +20 -22
- package/dist/index.js +35 -37
- package/dist/index.js.map +1 -1
- package/dist/{init-opencode-WUN3CTBM.js → init-opencode-RYPBCM4P.js} +5 -6
- package/dist/{init-opencode-WUN3CTBM.js.map → init-opencode-RYPBCM4P.js.map} +1 -1
- package/dist/{issue-triage-VKEHVHO4.js → issue-triage-YBVJVAUU.js} +6 -6
- package/dist/{model-config-helpers-GYPIIXOP.js → model-config-helpers-QNV3KD2W.js} +2 -2
- package/dist/{openai-compat-adapter-GSDOJ7TQ.js → openai-compat-adapter-GPZDIR3D.js} +11 -8
- package/dist/{outcome-store-adapter-PXT7AL6T.js → outcome-store-adapter-WRONSTUD.js} +2 -2
- package/dist/{pr-reviewer-helpers-GUUT7G43.js → pr-reviewer-helpers-7SMNNDFJ.js} +4 -4
- package/dist/{registry-command-4G3WGKS5.js → registry-command-U7K6HIBK.js} +2 -2
- package/dist/{repo-security-plan-QO6ACTPZ.js → repo-security-plan-LFWLVEL2.js} +3 -3
- package/dist/{research-helpers-synthesize-MPEJHPYR.js → research-helpers-synthesize-X6MVAAKT.js} +4 -4
- package/dist/{routing-memory-VHQDJ6XZ.js → routing-memory-OCIVXKOU.js} +2 -2
- package/dist/{session-memory-M3CQFFL6.js → session-memory-4LMEWO3X.js} +3 -3
- package/dist/{setup-config-VGEBCEKX.js → setup-config-YNNNR4AE.js} +3 -3
- package/dist/{setup-custom-api-DX7CNYKT.js → setup-custom-api-QEPUCHOX.js} +3 -3
- package/dist/setup-data-dir-XM5DWH7R.js +35 -0
- package/dist/{tool-memory-7QUPGCWV.js → tool-memory-EFGFXF65.js} +5 -5
- package/dist/{unified-registry-CLZK3H64.js → unified-registry-KLNC24HA.js} +11 -11
- package/dist/{weather-report-OKMXF73V.js → weather-report-PMYQ3WBW.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-BK6Q3VQK.js.map +0 -1
- package/dist/chunk-C6MM6Z65.js.map +0 -1
- package/dist/chunk-K6M2ZWX5.js +0 -1116
- package/dist/chunk-K6M2ZWX5.js.map +0 -1
- package/dist/chunk-O3VPGING.js.map +0 -1
- package/dist/chunk-WI73OZAU.js.map +0 -1
- package/dist/chunk-XQMQGUJT.js +0 -995
- package/dist/chunk-XQMQGUJT.js.map +0 -1
- package/dist/setup-data-dir-75Z5PSSB.js +0 -36
- /package/dist/{ast-rule-runner-AAOBENF2.js.map → ast-rule-runner-RI7ZJ4ZI.js.map} +0 -0
- /package/dist/{child-mcp-config-FRWGQIHP.js.map → child-mcp-config-73BX4OTR.js.map} +0 -0
- /package/dist/{chunk-NUXSGWDS.js.map → chunk-23QA6GQD.js.map} +0 -0
- /package/dist/{chunk-EGUISJBB.js.map → chunk-2DYCHHWW.js.map} +0 -0
- /package/dist/{chunk-TLITBKMZ.js.map → chunk-2TA6KTRF.js.map} +0 -0
- /package/dist/{chunk-YHY7GMAL.js.map → chunk-4JJI34RV.js.map} +0 -0
- /package/dist/{chunk-KPGWNBDA.js.map → chunk-7EV3QAKO.js.map} +0 -0
- /package/dist/{chunk-SCQ5YAYO.js.map → chunk-D6E3LJGP.js.map} +0 -0
- /package/dist/{chunk-XYYXVJSO.js.map → chunk-EJ5EBTAV.js.map} +0 -0
- /package/dist/{chunk-BJLP4E6Q.js.map → chunk-FNHVTDHZ.js.map} +0 -0
- /package/dist/{chunk-VGCRYAEH.js.map → chunk-FWQSOPBA.js.map} +0 -0
- /package/dist/{chunk-RBFHY2LF.js.map → chunk-GAX75XCV.js.map} +0 -0
- /package/dist/{chunk-O46IOND3.js.map → chunk-GX5ZHZR2.js.map} +0 -0
- /package/dist/{chunk-33C22IY4.js.map → chunk-J44RKRGQ.js.map} +0 -0
- /package/dist/{chunk-L4P4A7Z2.js.map → chunk-JGY5HMWI.js.map} +0 -0
- /package/dist/{chunk-HQWQ7MR5.js.map → chunk-LP5ISXKM.js.map} +0 -0
- /package/dist/{chunk-QPU7QKPT.js.map → chunk-LXYT2P2Y.js.map} +0 -0
- /package/dist/{chunk-M4IJ3H6M.js.map → chunk-PXYSAG5B.js.map} +0 -0
- /package/dist/{chunk-52Q72CPP.js.map → chunk-QG3VDSWD.js.map} +0 -0
- /package/dist/{chunk-IRFKJ2KR.js.map → chunk-QM5W3T3O.js.map} +0 -0
- /package/dist/{chunk-MCWIMVG2.js.map → chunk-QS5HGPCN.js.map} +0 -0
- /package/dist/{chunk-O5OUJ3PX.js.map → chunk-SS53PZO6.js.map} +0 -0
- /package/dist/{chunk-VHOOJ4FG.js.map → chunk-SX2XWCGA.js.map} +0 -0
- /package/dist/{chunk-2VD5OQQR.js.map → chunk-TDUXUVUU.js.map} +0 -0
- /package/dist/{chunk-XFTTKOHK.js.map → chunk-U37AITDA.js.map} +0 -0
- /package/dist/{chunk-V5FGXVSX.js.map → chunk-UZJ6IPJR.js.map} +0 -0
- /package/dist/{chunk-MYM2TPNL.js.map → chunk-V26YQQK4.js.map} +0 -0
- /package/dist/{chunk-HVZVVDFN.js.map → chunk-VLOPXV47.js.map} +0 -0
- /package/dist/{chunk-AMK4BTAV.js.map → chunk-WD4DENPC.js.map} +0 -0
- /package/dist/{cli-circuit-breaker-AM425BRL.js.map → cli-circuit-breaker-62YOQQT3.js.map} +0 -0
- /package/dist/{cli-readiness-LWOMHZ34.js.map → cli-readiness-O6EOQV4L.js.map} +0 -0
- /package/dist/{composite-router-VXQFXNET.js.map → composite-router-YPZ3D5Y6.js.map} +0 -0
- /package/dist/{consensus-vote-V2JQHILD.js.map → consensus-vote-RNQQUBXO.js.map} +0 -0
- /package/dist/{context-retriever-GEQIPCVL.js.map → context-retriever-HVPLM6DH.js.map} +0 -0
- /package/dist/{doctor-deep-DSOZGB5J.js.map → doctor-deep-UZQTD65D.js.map} +0 -0
- /package/dist/{doctor-gateway-report-RJOSOHGA.js.map → doctor-gateway-report-LRBPPJD4.js.map} +0 -0
- /package/dist/{doctor-live-7LVRGOS5.js.map → doctor-live-QFLT5SDB.js.map} +0 -0
- /package/dist/{expert-bridge-5A4ADUBO.js.map → expert-bridge-O3UZXLGB.js.map} +0 -0
- /package/dist/{factory-4RZLP7QV.js.map → factory-KCKQQAEH.js.map} +0 -0
- /package/dist/{factory-UBAUIA2M.js.map → factory-LUKUIB6C.js.map} +0 -0
- /package/dist/{improvement-review-UIYSAI36.js.map → improvement-review-7IABFAU3.js.map} +0 -0
- /package/dist/{issue-triage-VKEHVHO4.js.map → issue-triage-YBVJVAUU.js.map} +0 -0
- /package/dist/{model-config-helpers-GYPIIXOP.js.map → model-config-helpers-QNV3KD2W.js.map} +0 -0
- /package/dist/{openai-compat-adapter-GSDOJ7TQ.js.map → openai-compat-adapter-GPZDIR3D.js.map} +0 -0
- /package/dist/{outcome-store-adapter-PXT7AL6T.js.map → outcome-store-adapter-WRONSTUD.js.map} +0 -0
- /package/dist/{pr-reviewer-helpers-GUUT7G43.js.map → pr-reviewer-helpers-7SMNNDFJ.js.map} +0 -0
- /package/dist/{registry-command-4G3WGKS5.js.map → registry-command-U7K6HIBK.js.map} +0 -0
- /package/dist/{repo-security-plan-QO6ACTPZ.js.map → repo-security-plan-LFWLVEL2.js.map} +0 -0
- /package/dist/{research-helpers-synthesize-MPEJHPYR.js.map → research-helpers-synthesize-X6MVAAKT.js.map} +0 -0
- /package/dist/{routing-memory-VHQDJ6XZ.js.map → routing-memory-OCIVXKOU.js.map} +0 -0
- /package/dist/{session-memory-M3CQFFL6.js.map → session-memory-4LMEWO3X.js.map} +0 -0
- /package/dist/{setup-config-VGEBCEKX.js.map → setup-config-YNNNR4AE.js.map} +0 -0
- /package/dist/{setup-custom-api-DX7CNYKT.js.map → setup-custom-api-QEPUCHOX.js.map} +0 -0
- /package/dist/{setup-data-dir-75Z5PSSB.js.map → setup-data-dir-XM5DWH7R.js.map} +0 -0
- /package/dist/{tool-memory-7QUPGCWV.js.map → tool-memory-EFGFXF65.js.map} +0 -0
- /package/dist/{unified-registry-CLZK3H64.js.map → unified-registry-KLNC24HA.js.map} +0 -0
- /package/dist/{weather-report-OKMXF73V.js.map → weather-report-PMYQ3WBW.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getErrorMessage
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WKFPKPEM.js";
|
|
4
4
|
|
|
5
5
|
// src/cli/setup-config.ts
|
|
6
6
|
import { copyFileSync, existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
@@ -77,4 +77,4 @@ function ensureBackup(outputPath) {
|
|
|
77
77
|
export {
|
|
78
78
|
runConfigInitSync
|
|
79
79
|
};
|
|
80
|
-
//# sourceMappingURL=chunk-
|
|
80
|
+
//# sourceMappingURL=chunk-PXYSAG5B.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
assessReputation,
|
|
6
6
|
sanitizeInput
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-V26YQQK4.js";
|
|
8
8
|
import {
|
|
9
9
|
allOf
|
|
10
10
|
} from "./chunk-EZNIYU5T.js";
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
err,
|
|
14
14
|
getTimeProvider,
|
|
15
15
|
ok
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-WKFPKPEM.js";
|
|
17
17
|
|
|
18
18
|
// src/dogfooding/pr-reviewer-helpers.ts
|
|
19
19
|
import { randomUUID } from "node:crypto";
|
|
@@ -477,4 +477,4 @@ export {
|
|
|
477
477
|
createFailedReview,
|
|
478
478
|
reviewPostingBlock
|
|
479
479
|
};
|
|
480
|
-
//# sourceMappingURL=chunk-
|
|
480
|
+
//# sourceMappingURL=chunk-QG3VDSWD.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
redactCredentialShapes
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WKFPKPEM.js";
|
|
4
4
|
|
|
5
5
|
// src/security/output-sanitizer.ts
|
|
6
6
|
var REDACTED_KEY_PLACEHOLDER = "[REDACTED_KEY]";
|
|
@@ -54,4 +54,4 @@ export {
|
|
|
54
54
|
sanitizeErrorDetails,
|
|
55
55
|
sanitizeStringLeaves
|
|
56
56
|
};
|
|
57
|
-
//# sourceMappingURL=chunk-
|
|
57
|
+
//# sourceMappingURL=chunk-QM5W3T3O.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
ensureGatewayDiscovered,
|
|
3
3
|
gatewayDiscoveryStatus,
|
|
4
4
|
getAvailabilityCache
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-LXYT2P2Y.js";
|
|
6
6
|
import {
|
|
7
7
|
extractSystemPrompt
|
|
8
8
|
} from "./chunk-QZUG667L.js";
|
|
@@ -15,23 +15,23 @@ import {
|
|
|
15
15
|
import {
|
|
16
16
|
AdapterModelError,
|
|
17
17
|
BaseAdapter,
|
|
18
|
+
createOpenAICompatClient,
|
|
18
19
|
createStream,
|
|
19
|
-
gatewayAiSdkOptions,
|
|
20
20
|
planOptionalParams,
|
|
21
21
|
readGatewayTransport,
|
|
22
|
+
readOpenAICompatEnv,
|
|
22
23
|
requireApiKey,
|
|
23
24
|
validateApiKeyPresence,
|
|
25
|
+
validateOpenAICompatBaseUrl,
|
|
24
26
|
withGatewayUsageRecording
|
|
25
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-KLSNDPU6.js";
|
|
26
28
|
import {
|
|
27
|
-
assertCustomApiHostResolvesPublic,
|
|
28
29
|
hostnameOf,
|
|
29
30
|
readCustomApiSurface,
|
|
30
31
|
readDirectOpenAiSurface,
|
|
31
32
|
readGatewayEnv,
|
|
32
|
-
redactApiKey
|
|
33
|
-
|
|
34
|
-
} from "./chunk-BK6Q3VQK.js";
|
|
33
|
+
redactApiKey
|
|
34
|
+
} from "./chunk-KASBBKAQ.js";
|
|
35
35
|
import {
|
|
36
36
|
probeCli
|
|
37
37
|
} from "./chunk-TW6PJYTP.js";
|
|
@@ -46,13 +46,13 @@ import {
|
|
|
46
46
|
getTimeoutForTask,
|
|
47
47
|
listModelsForCli,
|
|
48
48
|
spawnCwd
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-23QA6GQD.js";
|
|
50
50
|
import {
|
|
51
51
|
getCliCircuitBreakerSnapshot
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-SX2XWCGA.js";
|
|
53
53
|
import {
|
|
54
54
|
sanitizeOutput
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-QM5W3T3O.js";
|
|
56
56
|
import {
|
|
57
57
|
CliCircuitBreaker,
|
|
58
58
|
DEFAULT_CIRCUIT_BREAKER_CONFIG,
|
|
@@ -106,7 +106,7 @@ import {
|
|
|
106
106
|
unenforcedAccessModeRefusal,
|
|
107
107
|
warnIfGatewayCostUndeclared,
|
|
108
108
|
withEnforcedAccessMode
|
|
109
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-WKFPKPEM.js";
|
|
110
110
|
import {
|
|
111
111
|
CLI_NAMES,
|
|
112
112
|
CLI_SUBPROCESS_TIMEOUTS,
|
|
@@ -761,7 +761,6 @@ function modelOnSurface(provider, surface, modelId) {
|
|
|
761
761
|
return build(modelId);
|
|
762
762
|
}
|
|
763
763
|
function apiSurfaceFor(providerId) {
|
|
764
|
-
if (providerId === "custom-openai") return readCustomApiSurface();
|
|
765
764
|
if (providerId === "openai") return readDirectOpenAiSurface();
|
|
766
765
|
return void 0;
|
|
767
766
|
}
|
|
@@ -813,12 +812,19 @@ function resolveApiKey(providerId, configKey) {
|
|
|
813
812
|
if (providerId === "custom-openai") return readGatewayEnv().apiKey;
|
|
814
813
|
return process.env[PROVIDER_ENV_KEYS[providerId]];
|
|
815
814
|
}
|
|
816
|
-
function
|
|
815
|
+
function gatewayConfigFor(config, apiKey, logger5) {
|
|
817
816
|
if (config.providerId !== "custom-openai") return void 0;
|
|
818
|
-
const
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
817
|
+
const baseUrl = validateOpenAICompatBaseUrl(config.baseUrl ?? readGatewayEnv().baseUrl);
|
|
818
|
+
return {
|
|
819
|
+
baseUrl,
|
|
820
|
+
apiKey: apiKey ?? "",
|
|
821
|
+
logger: logger5,
|
|
822
|
+
omitDefaultTokenCap: true,
|
|
823
|
+
...readGatewayTransport(baseUrl, process.env, logger5),
|
|
824
|
+
apiSurface: readCustomApiSurface(),
|
|
825
|
+
...config.timeout !== void 0 && { timeout: config.timeout },
|
|
826
|
+
...config.maxRetries !== void 0 && { maxRetries: config.maxRetries }
|
|
827
|
+
};
|
|
822
828
|
}
|
|
823
829
|
function mapFinishReason(reason) {
|
|
824
830
|
switch (reason) {
|
|
@@ -885,22 +891,16 @@ var SdkAdapter = class extends BaseAdapter {
|
|
|
885
891
|
model;
|
|
886
892
|
sdkFunctions;
|
|
887
893
|
sdkConfig;
|
|
888
|
-
/**
|
|
889
|
-
|
|
894
|
+
/** Compatibility-only custom provider delegates to the canonical gateway client. */
|
|
895
|
+
gatewayConfig;
|
|
896
|
+
gatewayAdapter;
|
|
890
897
|
/**
|
|
891
|
-
* OpenAI API surface:
|
|
892
|
-
* `openai` provider only when `OPENAI_BASE_URL` names a non-OpenAI host
|
|
898
|
+
* OpenAI API surface: for the direct `openai` provider only when `OPENAI_BASE_URL` names a non-OpenAI host
|
|
893
899
|
* (#6654). `undefined` keeps the provider's default surface.
|
|
894
900
|
*/
|
|
895
901
|
apiSurface;
|
|
896
902
|
/** Inflight init promise for coalescing concurrent calls (Issue #1438). */
|
|
897
903
|
initPromise;
|
|
898
|
-
/**
|
|
899
|
-
* Cached result of the DNS-resolve-time SSRF check for custom-openai
|
|
900
|
-
* (#3426). Resolved once on first init so we don't re-resolve the gateway
|
|
901
|
-
* hostname on every request. `undefined` until the check has run.
|
|
902
|
-
*/
|
|
903
|
-
resolveSsrfChecked = false;
|
|
904
904
|
constructor(config, logger5) {
|
|
905
905
|
const apiKey = resolveApiKey(config.providerId, config.apiKey);
|
|
906
906
|
super({
|
|
@@ -914,9 +914,22 @@ var SdkAdapter = class extends BaseAdapter {
|
|
|
914
914
|
});
|
|
915
915
|
this.sdkProviderId = config.providerId;
|
|
916
916
|
this.sdkConfig = config;
|
|
917
|
-
this.
|
|
917
|
+
this.gatewayConfig = gatewayConfigFor(config, apiKey, this.logger);
|
|
918
918
|
this.apiSurface = apiSurfaceFor(config.providerId);
|
|
919
919
|
}
|
|
920
|
+
/** Lazily acquire the B client, preserving missing-key failure at first use. */
|
|
921
|
+
resolveGatewayAdapter() {
|
|
922
|
+
if (this.gatewayConfig === void 0) return void 0;
|
|
923
|
+
if (this.gatewayAdapter !== void 0) return this.gatewayAdapter;
|
|
924
|
+
const apiKey = resolveApiKey(this.sdkConfig.providerId, this.sdkConfig.apiKey);
|
|
925
|
+
if (apiKey === void 0) {
|
|
926
|
+
throw new AdapterModelError(`No API key for ${this.sdkConfig.providerId}`, {
|
|
927
|
+
code: ErrorCode.CONFIG_INVALID
|
|
928
|
+
});
|
|
929
|
+
}
|
|
930
|
+
this.gatewayAdapter = createOpenAICompatClient(this.modelId, { ...this.gatewayConfig, apiKey });
|
|
931
|
+
return this.gatewayAdapter;
|
|
932
|
+
}
|
|
920
933
|
/**
|
|
921
934
|
* Lazily initialize the AI SDK model and functions.
|
|
922
935
|
* This allows the adapter to be created without the AI SDK installed,
|
|
@@ -936,38 +949,17 @@ var SdkAdapter = class extends BaseAdapter {
|
|
|
936
949
|
}
|
|
937
950
|
}
|
|
938
951
|
async doInitialize() {
|
|
939
|
-
const apiKey = resolveApiKey(this.
|
|
952
|
+
const apiKey = resolveApiKey(this.sdkConfig.providerId, this.sdkConfig.apiKey);
|
|
940
953
|
if (apiKey === void 0) {
|
|
941
954
|
throw new AdapterModelError(`No API key for ${this.sdkProviderId}`, {
|
|
942
955
|
code: ErrorCode.CONFIG_INVALID
|
|
943
956
|
});
|
|
944
957
|
}
|
|
945
|
-
await this.ensureCustomHostResolvesPublic();
|
|
946
958
|
const providerModule = await this.loadProvider(apiKey);
|
|
947
959
|
this.model = providerModule.model;
|
|
948
960
|
const aiModule = await import("ai");
|
|
949
961
|
this.sdkFunctions = extractAiSdkFunctions(aiModule);
|
|
950
962
|
}
|
|
951
|
-
/**
|
|
952
|
-
* For custom-openai only: run the DNS-resolve-time SSRF check exactly once
|
|
953
|
-
* and throw if the gateway hostname resolves to a private address (#3426).
|
|
954
|
-
* Cached via `resolveSsrfChecked` so the hostname is not re-resolved on
|
|
955
|
-
* every request. No-op for non-custom providers (built-in endpoints are
|
|
956
|
-
* trusted) and when no custom base URL is configured.
|
|
957
|
-
*/
|
|
958
|
-
async ensureCustomHostResolvesPublic() {
|
|
959
|
-
if (this.resolveSsrfChecked) return;
|
|
960
|
-
if (this.sdkProviderId !== "custom-openai" || this.customBaseUrl === void 0) {
|
|
961
|
-
this.resolveSsrfChecked = true;
|
|
962
|
-
return;
|
|
963
|
-
}
|
|
964
|
-
const hostname = new URL(this.customBaseUrl).hostname;
|
|
965
|
-
const result = await assertCustomApiHostResolvesPublic(hostname);
|
|
966
|
-
if (!result.ok) {
|
|
967
|
-
throw result.error;
|
|
968
|
-
}
|
|
969
|
-
this.resolveSsrfChecked = true;
|
|
970
|
-
}
|
|
971
963
|
/**
|
|
972
964
|
* Loads the provider-specific AI SDK module.
|
|
973
965
|
*
|
|
@@ -977,6 +969,10 @@ var SdkAdapter = class extends BaseAdapter {
|
|
|
977
969
|
*/
|
|
978
970
|
async loadProvider(apiKey) {
|
|
979
971
|
switch (this.sdkProviderId) {
|
|
972
|
+
case "custom-openai":
|
|
973
|
+
throw new AdapterModelError("custom-openai must use the gateway HTTP adapter", {
|
|
974
|
+
code: ErrorCode.CONFIG_INVALID
|
|
975
|
+
});
|
|
980
976
|
case "anthropic": {
|
|
981
977
|
const mod = await import("@ai-sdk/anthropic");
|
|
982
978
|
const factory = extractProviderFactory(mod, "createAnthropic");
|
|
@@ -996,20 +992,6 @@ var SdkAdapter = class extends BaseAdapter {
|
|
|
996
992
|
const provider = factory({ apiKey });
|
|
997
993
|
return { model: provider(this.modelId) };
|
|
998
994
|
}
|
|
999
|
-
case "custom-openai": {
|
|
1000
|
-
const mod = await import("@ai-sdk/openai");
|
|
1001
|
-
const factory = extractProviderFactory(mod, "createOpenAI");
|
|
1002
|
-
const opts = { apiKey };
|
|
1003
|
-
if (this.customBaseUrl !== void 0) {
|
|
1004
|
-
opts["baseURL"] = this.customBaseUrl;
|
|
1005
|
-
const transport = readGatewayTransport(this.customBaseUrl, process.env, this.logger);
|
|
1006
|
-
Object.assign(opts, gatewayAiSdkOptions({ ...transport, apiKey }));
|
|
1007
|
-
}
|
|
1008
|
-
const provider = factory(opts);
|
|
1009
|
-
return {
|
|
1010
|
-
model: modelOnSurface(provider, this.apiSurface ?? "chat", this.modelId)
|
|
1011
|
-
};
|
|
1012
|
-
}
|
|
1013
995
|
}
|
|
1014
996
|
}
|
|
1015
997
|
/**
|
|
@@ -1093,6 +1075,8 @@ var SdkAdapter = class extends BaseAdapter {
|
|
|
1093
1075
|
}
|
|
1094
1076
|
async complete(request) {
|
|
1095
1077
|
try {
|
|
1078
|
+
const gateway = this.resolveGatewayAdapter();
|
|
1079
|
+
if (gateway !== void 0) return await gateway.complete(request);
|
|
1096
1080
|
await this.ensureInitialized();
|
|
1097
1081
|
this.logRequest(request);
|
|
1098
1082
|
const sdk = this.sdkFunctions;
|
|
@@ -1113,6 +1097,11 @@ var SdkAdapter = class extends BaseAdapter {
|
|
|
1113
1097
|
}
|
|
1114
1098
|
}
|
|
1115
1099
|
async *stream(request) {
|
|
1100
|
+
const gateway = this.resolveGatewayAdapter();
|
|
1101
|
+
if (gateway !== void 0) {
|
|
1102
|
+
yield* gateway.stream(request);
|
|
1103
|
+
return;
|
|
1104
|
+
}
|
|
1116
1105
|
await this.ensureInitialized();
|
|
1117
1106
|
this.logRequest(request);
|
|
1118
1107
|
const sdk = this.sdkFunctions;
|
|
@@ -1153,19 +1142,22 @@ var SdkAdapter = class extends BaseAdapter {
|
|
|
1153
1142
|
*/
|
|
1154
1143
|
toErrorResult(error, code) {
|
|
1155
1144
|
if (error instanceof ModelError) {
|
|
1156
|
-
this.logger.error(`SDK adapter error (${this.
|
|
1145
|
+
this.logger.error(`SDK adapter error (${this.sdkConfig.providerId})`, error);
|
|
1157
1146
|
return { ok: false, error };
|
|
1158
1147
|
}
|
|
1159
|
-
const apiKey = resolveApiKey(this.
|
|
1148
|
+
const apiKey = resolveApiKey(this.sdkConfig.providerId, this.sdkConfig.apiKey);
|
|
1160
1149
|
const safeMessage = sanitizeOutput(redactApiKey(getErrorMessage(error), apiKey));
|
|
1161
1150
|
const errorObj = new Error(safeMessage);
|
|
1162
1151
|
if (error instanceof Error) errorObj.name = error.name;
|
|
1163
|
-
this.logger.error(`SDK adapter error (${this.
|
|
1152
|
+
this.logger.error(`SDK adapter error (${this.sdkConfig.providerId})`, errorObj);
|
|
1164
1153
|
const retryAfterMs = code === ErrorCode.MODEL_RATE_LIMITED ? resolveRetryAfterMs(error, safeMessage) : void 0;
|
|
1165
|
-
const modelError = new AdapterModelError(
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1154
|
+
const modelError = new AdapterModelError(
|
|
1155
|
+
`${this.sdkConfig.providerId} SDK error: ${safeMessage}`,
|
|
1156
|
+
{
|
|
1157
|
+
code,
|
|
1158
|
+
...retryAfterMs !== void 0 ? { context: { [RETRY_AFTER_CONTEXT_KEY]: retryAfterMs } } : {}
|
|
1159
|
+
}
|
|
1160
|
+
);
|
|
1169
1161
|
return { ok: false, error: modelError };
|
|
1170
1162
|
}
|
|
1171
1163
|
};
|
|
@@ -1309,25 +1301,22 @@ function tryCustomOpenAiAdapter(logger5) {
|
|
|
1309
1301
|
if (customKey === void 0 || customBaseUrl === void 0) return null;
|
|
1310
1302
|
const choice = customModelChoice(logger5);
|
|
1311
1303
|
if (choice === null) return null;
|
|
1312
|
-
const {
|
|
1304
|
+
const { adapter, note } = choice;
|
|
1305
|
+
const customModelId = adapter.modelId;
|
|
1313
1306
|
const modelVerified = choice.modelVerified;
|
|
1314
1307
|
const host = hostnameOf(customBaseUrl);
|
|
1315
|
-
logger5.info("Using custom-openai
|
|
1316
|
-
const adapter = new SdkAdapter(
|
|
1317
|
-
{
|
|
1318
|
-
providerId: "custom-openai",
|
|
1319
|
-
modelId: customModelId,
|
|
1320
|
-
apiKey: customKey,
|
|
1321
|
-
baseUrl: customBaseUrl
|
|
1322
|
-
},
|
|
1323
|
-
logger5
|
|
1324
|
-
);
|
|
1308
|
+
logger5.info("Using custom-openai gateway alias", { model: customModelId, host });
|
|
1325
1309
|
return {
|
|
1326
1310
|
// Snapshot the selection on the call's adapter, rather than reading the
|
|
1327
1311
|
// resilient proxy's mutable health after a refresh/failover (#6862).
|
|
1328
1312
|
// Always wrapped, so pricing never depends on whether discovery measured
|
|
1329
1313
|
// the choice: every custom-openai call is priced by the gateway declaration.
|
|
1330
|
-
adapter: withGatewayUsageRecording(
|
|
1314
|
+
adapter: withGatewayUsageRecording(
|
|
1315
|
+
adapter,
|
|
1316
|
+
"api:custom-openai",
|
|
1317
|
+
modelVerified,
|
|
1318
|
+
"sdk-custom-openai"
|
|
1319
|
+
),
|
|
1331
1320
|
source: "api",
|
|
1332
1321
|
name: "custom-openai",
|
|
1333
1322
|
reason: `Using custom OpenAI-compatible gateway at ${host} (model: ${customModelId}${note})`,
|
|
@@ -1336,23 +1325,31 @@ function tryCustomOpenAiAdapter(logger5) {
|
|
|
1336
1325
|
}
|
|
1337
1326
|
function customModelChoice(logger5) {
|
|
1338
1327
|
const d = resolveGatewayDefault(process.env, logger5);
|
|
1339
|
-
if (d.kind === "
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
logger5.warn(
|
|
1343
|
-
`Gateway discovery failed, so the custom-openai model '${modelId}' is sent unverified; set NEXUS_CUSTOM_MODEL to a model the gateway serves, or run \`nexus-agents doctor --gateway\``,
|
|
1344
|
-
{ model: modelId }
|
|
1345
|
-
);
|
|
1346
|
-
return { modelId, note: "; unverified: gateway discovery failed", modelVerified: false };
|
|
1328
|
+
if (d.kind === "unavailable") {
|
|
1329
|
+
logger5.warn("Gateway catalogue has no chat model; the custom-openai default is unavailable");
|
|
1330
|
+
return null;
|
|
1347
1331
|
}
|
|
1332
|
+
const config = readOpenAICompatEnv();
|
|
1333
|
+
if (config === null) return null;
|
|
1334
|
+
const modelId = d.kind === "resolved" ? d.adapter.modelId : process.env["NEXUS_CUSTOM_MODEL"] ?? CUSTOM_API_DEFAULT_MODEL;
|
|
1335
|
+
const adapter = createOpenAICompatClient(modelId, {
|
|
1336
|
+
...config,
|
|
1337
|
+
logger: logger5,
|
|
1338
|
+
apiSurface: readCustomApiSurface(),
|
|
1339
|
+
omitDefaultTokenCap: true
|
|
1340
|
+
});
|
|
1348
1341
|
if (d.kind === "resolved")
|
|
1349
1342
|
return {
|
|
1350
|
-
|
|
1343
|
+
adapter,
|
|
1351
1344
|
note: `; gateway default by ${d.via}`,
|
|
1352
1345
|
modelVerified: true
|
|
1353
1346
|
};
|
|
1354
|
-
|
|
1355
|
-
|
|
1347
|
+
if (gatewayDiscoveryStatus() !== "failed") return { adapter, note: "" };
|
|
1348
|
+
logger5.warn(
|
|
1349
|
+
`Gateway discovery failed, so the custom-openai model '${modelId}' is sent unverified; set NEXUS_CUSTOM_MODEL to a model the gateway serves, or run \`nexus-agents doctor --gateway\``,
|
|
1350
|
+
{ model: modelId }
|
|
1351
|
+
);
|
|
1352
|
+
return { adapter, note: "; unverified: gateway discovery failed", modelVerified: false };
|
|
1356
1353
|
}
|
|
1357
1354
|
|
|
1358
1355
|
// src/adapters/auto-adapter.ts
|
|
@@ -4127,4 +4124,4 @@ export {
|
|
|
4127
4124
|
SdkAdapter,
|
|
4128
4125
|
createAutoAdapter
|
|
4129
4126
|
};
|
|
4130
|
-
//# sourceMappingURL=chunk-
|
|
4127
|
+
//# sourceMappingURL=chunk-QRC3QLUQ.js.map
|