nexus-agents 2.56.0 → 2.57.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/{adaptive-memory-SUNFPY2W.js → adaptive-memory-TSZEJUJC.js} +3 -3
- package/dist/{chunk-4FVISCDB.js → chunk-6QU4DJYW.js} +2 -2
- package/dist/{chunk-NYNBDP7M.js → chunk-7Y36JLES.js} +2 -2
- package/dist/{chunk-FWSTXEG2.js → chunk-AFSIP6JH.js} +99 -23
- package/dist/chunk-AFSIP6JH.js.map +1 -0
- package/dist/{chunk-BPMQRYGU.js → chunk-BOZ26RIB.js} +283 -79
- package/dist/chunk-BOZ26RIB.js.map +1 -0
- package/dist/{chunk-VKZKC4SM.js → chunk-EDGG3RQE.js} +2 -2
- package/dist/{chunk-2SPRLBOS.js → chunk-EZXOJZYE.js} +2 -2
- package/dist/{chunk-W5AJRK4U.js → chunk-GMOGKX4E.js} +2 -2
- package/dist/chunk-H43PABG4.js +402 -0
- package/dist/chunk-H43PABG4.js.map +1 -0
- package/dist/{chunk-IOU7F5PH.js → chunk-K7EA5OV4.js} +2 -2
- package/dist/{chunk-KRIFBGWZ.js → chunk-PTGBJFSD.js} +3 -3
- package/dist/{chunk-EKYT4NMD.js → chunk-QGZBCD2A.js} +24 -9
- package/dist/chunk-QGZBCD2A.js.map +1 -0
- package/dist/{chunk-KGMC6F5D.js → chunk-QNYNQ257.js} +67 -61
- package/dist/chunk-QNYNQ257.js.map +1 -0
- package/dist/{chunk-UOUJZIKH.js → chunk-R2Y57PM3.js} +38 -15
- package/dist/chunk-R2Y57PM3.js.map +1 -0
- package/dist/{chunk-RSUCXOQM.js → chunk-SXWZS2V4.js} +26 -53
- package/dist/chunk-SXWZS2V4.js.map +1 -0
- package/dist/{chunk-PCMWLXT4.js → chunk-TC46TRLR.js} +2 -2
- package/dist/{chunk-3IDJSFWT.js → chunk-TFEFN37P.js} +2 -2
- package/dist/{chunk-Q5TKQWOI.js → chunk-V5CGWMYL.js} +2 -2
- package/dist/{chunk-TCQNNY4J.js → chunk-XEMRMZUN.js} +4 -4
- package/dist/{chunk-C3FGEDD7.js → chunk-Y7CD6AZW.js} +22 -406
- package/dist/chunk-Y7CD6AZW.js.map +1 -0
- package/dist/{chunk-R66AWJJ7.js → chunk-YU4NABXM.js} +2 -2
- package/dist/{chunk-EJLWDYK7.js → chunk-ZL3IBCH6.js} +658 -321
- package/dist/chunk-ZL3IBCH6.js.map +1 -0
- package/dist/{chunk-VLVHPC72.js → chunk-ZUWOFHNC.js} +6 -6
- package/dist/{cli-circuit-breaker-7MCMHSDY.js → cli-circuit-breaker-SL73NWX2.js} +4 -4
- package/dist/cli.d.ts +3 -1
- package/dist/cli.js +425 -341
- package/dist/cli.js.map +1 -1
- package/dist/{composite-router-LXFOSMSE.js → composite-router-A7URDW4X.js} +2 -2
- package/dist/{consensus-vote-G6H532ME.js → consensus-vote-CQ2JP6DC.js} +9 -8
- package/dist/{doctor-deep-RKMOZSIS.js → doctor-deep-VN6KMUCG.js} +3 -3
- package/dist/{expert-bridge-KHHE42JP.js → expert-bridge-LT7PKUPS.js} +3 -3
- package/dist/{factory-KRNR7XHD.js → factory-FA7WDPZW.js} +5 -5
- package/dist/{factory-JVN47MFN.js → factory-FZ2KSVYC.js} +4 -4
- package/dist/index.d.ts +324 -16
- package/dist/index.js +58 -43
- package/dist/index.js.map +1 -1
- package/dist/{issue-triage-O3C7P66H.js → issue-triage-YYTE6KTC.js} +4 -4
- package/dist/{mcp-config-QRERKGR4.js → mcp-config-34XMRM64.js} +3 -3
- package/dist/{mobimem-FAOAXV3B.js → mobimem-QDBP37H7.js} +2 -2
- package/dist/model-registry.generated.json +17033 -0
- package/dist/registry-command-S46JJ2SX.js +580 -0
- package/dist/registry-command-S46JJ2SX.js.map +1 -0
- package/dist/{repo-security-plan-AZ5HMGFC.js → repo-security-plan-C3LLE3Z7.js} +3 -3
- package/dist/{research-helpers-synthesize-E6WQLQKP.js → research-helpers-synthesize-NVQIWLQL.js} +3 -3
- package/dist/{routing-memory-MXF45FXT.js → routing-memory-W3YWMLJM.js} +2 -2
- package/dist/{session-memory-HL5XDBIL.js → session-memory-DWF5Z2LC.js} +3 -3
- package/dist/{setup-command-AV4MODEL.js → setup-command-6EJONTOU.js} +8 -7
- package/dist/{setup-config-PWK6WHMG.js → setup-config-JA5IX53Q.js} +3 -3
- package/dist/{setup-custom-api-XAWKRDWV.js → setup-custom-api-CSB26HWD.js} +7 -5
- package/dist/setup-custom-api-CSB26HWD.js.map +1 -0
- package/dist/{weather-report-XZ5CENHE.js → weather-report-YQSLX4MS.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-BPMQRYGU.js.map +0 -1
- package/dist/chunk-C3FGEDD7.js.map +0 -1
- package/dist/chunk-EJLWDYK7.js.map +0 -1
- package/dist/chunk-EKYT4NMD.js.map +0 -1
- package/dist/chunk-FWSTXEG2.js.map +0 -1
- package/dist/chunk-KGMC6F5D.js.map +0 -1
- package/dist/chunk-RSUCXOQM.js.map +0 -1
- package/dist/chunk-UOUJZIKH.js.map +0 -1
- package/dist/setup-custom-api-XAWKRDWV.js.map +0 -1
- /package/dist/{adaptive-memory-SUNFPY2W.js.map → adaptive-memory-TSZEJUJC.js.map} +0 -0
- /package/dist/{chunk-4FVISCDB.js.map → chunk-6QU4DJYW.js.map} +0 -0
- /package/dist/{chunk-NYNBDP7M.js.map → chunk-7Y36JLES.js.map} +0 -0
- /package/dist/{chunk-VKZKC4SM.js.map → chunk-EDGG3RQE.js.map} +0 -0
- /package/dist/{chunk-2SPRLBOS.js.map → chunk-EZXOJZYE.js.map} +0 -0
- /package/dist/{chunk-W5AJRK4U.js.map → chunk-GMOGKX4E.js.map} +0 -0
- /package/dist/{chunk-IOU7F5PH.js.map → chunk-K7EA5OV4.js.map} +0 -0
- /package/dist/{chunk-KRIFBGWZ.js.map → chunk-PTGBJFSD.js.map} +0 -0
- /package/dist/{chunk-PCMWLXT4.js.map → chunk-TC46TRLR.js.map} +0 -0
- /package/dist/{chunk-3IDJSFWT.js.map → chunk-TFEFN37P.js.map} +0 -0
- /package/dist/{chunk-Q5TKQWOI.js.map → chunk-V5CGWMYL.js.map} +0 -0
- /package/dist/{chunk-TCQNNY4J.js.map → chunk-XEMRMZUN.js.map} +0 -0
- /package/dist/{chunk-R66AWJJ7.js.map → chunk-YU4NABXM.js.map} +0 -0
- /package/dist/{chunk-VLVHPC72.js.map → chunk-ZUWOFHNC.js.map} +0 -0
- /package/dist/{cli-circuit-breaker-7MCMHSDY.js.map → cli-circuit-breaker-SL73NWX2.js.map} +0 -0
- /package/dist/{composite-router-LXFOSMSE.js.map → composite-router-A7URDW4X.js.map} +0 -0
- /package/dist/{consensus-vote-G6H532ME.js.map → consensus-vote-CQ2JP6DC.js.map} +0 -0
- /package/dist/{doctor-deep-RKMOZSIS.js.map → doctor-deep-VN6KMUCG.js.map} +0 -0
- /package/dist/{expert-bridge-KHHE42JP.js.map → expert-bridge-LT7PKUPS.js.map} +0 -0
- /package/dist/{factory-JVN47MFN.js.map → factory-FA7WDPZW.js.map} +0 -0
- /package/dist/{factory-KRNR7XHD.js.map → factory-FZ2KSVYC.js.map} +0 -0
- /package/dist/{issue-triage-O3C7P66H.js.map → issue-triage-YYTE6KTC.js.map} +0 -0
- /package/dist/{mcp-config-QRERKGR4.js.map → mcp-config-34XMRM64.js.map} +0 -0
- /package/dist/{mobimem-FAOAXV3B.js.map → mobimem-QDBP37H7.js.map} +0 -0
- /package/dist/{repo-security-plan-AZ5HMGFC.js.map → repo-security-plan-C3LLE3Z7.js.map} +0 -0
- /package/dist/{research-helpers-synthesize-E6WQLQKP.js.map → research-helpers-synthesize-NVQIWLQL.js.map} +0 -0
- /package/dist/{routing-memory-MXF45FXT.js.map → routing-memory-W3YWMLJM.js.map} +0 -0
- /package/dist/{session-memory-HL5XDBIL.js.map → session-memory-DWF5Z2LC.js.map} +0 -0
- /package/dist/{setup-command-AV4MODEL.js.map → setup-command-6EJONTOU.js.map} +0 -0
- /package/dist/{setup-config-PWK6WHMG.js.map → setup-config-JA5IX53Q.js.map} +0 -0
- /package/dist/{weather-report-XZ5CENHE.js.map → weather-report-YQSLX4MS.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createLogger
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-R2Y57PM3.js";
|
|
4
4
|
|
|
5
5
|
// src/swe-bench/mcp-config.ts
|
|
6
6
|
import { writeFile, mkdtemp, rm } from "fs/promises";
|
|
@@ -58,4 +58,4 @@ export {
|
|
|
58
58
|
generateMcpConfig,
|
|
59
59
|
getDefaultAllowedTools
|
|
60
60
|
};
|
|
61
|
-
//# sourceMappingURL=chunk-
|
|
61
|
+
//# sourceMappingURL=chunk-EDGG3RQE.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
createLogger,
|
|
3
3
|
err,
|
|
4
4
|
ok
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-R2Y57PM3.js";
|
|
6
6
|
|
|
7
7
|
// src/scm/token-resolver.ts
|
|
8
8
|
import { execFile } from "child_process";
|
|
@@ -87,4 +87,4 @@ export {
|
|
|
87
87
|
hasToken,
|
|
88
88
|
getTokenEnvVars
|
|
89
89
|
};
|
|
90
|
-
//# sourceMappingURL=chunk-
|
|
90
|
+
//# sourceMappingURL=chunk-EZXOJZYE.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
getErrorMessage,
|
|
6
6
|
getTimeProvider,
|
|
7
7
|
ok
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-R2Y57PM3.js";
|
|
9
9
|
|
|
10
10
|
// src/cli-adapters/circuit-breaker-types.ts
|
|
11
11
|
var CircuitErrorCode = {
|
|
@@ -353,4 +353,4 @@ export {
|
|
|
353
353
|
CircuitBreakerRegistry,
|
|
354
354
|
mapCliErrorToCategory
|
|
355
355
|
};
|
|
356
|
-
//# sourceMappingURL=chunk-
|
|
356
|
+
//# sourceMappingURL=chunk-GMOGKX4E.js.map
|
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import {
|
|
2
|
+
API_TIMEOUTS,
|
|
3
|
+
CLI_TIMEOUTS,
|
|
4
|
+
INTERNAL_TIMEOUTS,
|
|
5
|
+
MCP_TIMEOUTS,
|
|
6
|
+
TEST_TIMEOUTS,
|
|
7
|
+
WORKFLOW_TIMEOUTS
|
|
8
|
+
} from "./chunk-R2Y57PM3.js";
|
|
9
|
+
|
|
10
|
+
// src/config/defaults-env.ts
|
|
11
|
+
function parseIntEnv(envKey, fallback) {
|
|
12
|
+
const envValue = process.env[envKey];
|
|
13
|
+
if (envValue === void 0) {
|
|
14
|
+
return fallback;
|
|
15
|
+
}
|
|
16
|
+
const parsed = parseInt(envValue, 10);
|
|
17
|
+
return isNaN(parsed) || parsed <= 0 ? fallback : parsed;
|
|
18
|
+
}
|
|
19
|
+
function parseFloatEnv(envKey, fallback) {
|
|
20
|
+
const envValue = process.env[envKey];
|
|
21
|
+
if (envValue === void 0) {
|
|
22
|
+
return fallback;
|
|
23
|
+
}
|
|
24
|
+
const parsed = parseFloat(envValue);
|
|
25
|
+
return isNaN(parsed) || !isFinite(parsed) ? fallback : parsed;
|
|
26
|
+
}
|
|
27
|
+
function parseBoolEnv(envKey, fallback) {
|
|
28
|
+
const envValue = process.env[envKey]?.toLowerCase();
|
|
29
|
+
if (envValue === void 0) {
|
|
30
|
+
return fallback;
|
|
31
|
+
}
|
|
32
|
+
if (envValue === "true" || envValue === "1") return true;
|
|
33
|
+
if (envValue === "false" || envValue === "0") return false;
|
|
34
|
+
return fallback;
|
|
35
|
+
}
|
|
36
|
+
function createGetTimeout(timeoutDefaults) {
|
|
37
|
+
return (key) => {
|
|
38
|
+
const envKey = `NEXUS_TIMEOUT_${key.replace(/Ms$/, "").toUpperCase()}`;
|
|
39
|
+
return parseIntEnv(envKey, timeoutDefaults[key]);
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function createGetRetryConfig(retryDefaults) {
|
|
43
|
+
return () => {
|
|
44
|
+
return {
|
|
45
|
+
maxRetries: parseIntEnv("NEXUS_RETRY_MAX_RETRIES", retryDefaults.maxRetries),
|
|
46
|
+
baseDelayMs: parseIntEnv("NEXUS_RETRY_BASE_DELAY", retryDefaults.baseDelayMs),
|
|
47
|
+
maxDelayMs: parseIntEnv("NEXUS_RETRY_MAX_DELAY", retryDefaults.maxDelayMs),
|
|
48
|
+
jitterFactor: parseFloatEnv("NEXUS_RETRY_JITTER", retryDefaults.jitterFactor)
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function createGetRateLimitConfig(rateLimitDefaults) {
|
|
53
|
+
return () => {
|
|
54
|
+
return {
|
|
55
|
+
requestsPerMinute: parseIntEnv("NEXUS_RATE_LIMIT_RPM", rateLimitDefaults.requestsPerMinute),
|
|
56
|
+
enabled: parseBoolEnv("NEXUS_RATE_LIMIT_ENABLED", rateLimitDefaults.enabled),
|
|
57
|
+
maxConcurrent: parseIntEnv(
|
|
58
|
+
"NEXUS_RATE_LIMIT_MAX_CONCURRENT",
|
|
59
|
+
rateLimitDefaults.maxConcurrent
|
|
60
|
+
),
|
|
61
|
+
capacity: parseIntEnv("NEXUS_RATE_LIMIT_CAPACITY", rateLimitDefaults.capacity),
|
|
62
|
+
refillRate: parseIntEnv("NEXUS_RATE_LIMIT_REFILL_RATE", rateLimitDefaults.refillRate),
|
|
63
|
+
refillIntervalMs: parseIntEnv(
|
|
64
|
+
"NEXUS_RATE_LIMIT_REFILL_INTERVAL",
|
|
65
|
+
rateLimitDefaults.refillIntervalMs
|
|
66
|
+
)
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function createGetWorkerConfig(workerDefaults) {
|
|
71
|
+
return () => {
|
|
72
|
+
return {
|
|
73
|
+
maxWorkers: parseIntEnv("NEXUS_WORKERS_MAX", workerDefaults.maxWorkers),
|
|
74
|
+
poolSize: parseIntEnv("NEXUS_WORKERS_POOL_SIZE", workerDefaults.poolSize),
|
|
75
|
+
idleTimeoutMs: parseIntEnv("NEXUS_WORKERS_IDLE_TIMEOUT", workerDefaults.idleTimeoutMs),
|
|
76
|
+
workflowMaxParallel: parseIntEnv(
|
|
77
|
+
"NEXUS_WORKFLOW_MAX_PARALLEL",
|
|
78
|
+
workerDefaults.workflowMaxParallel
|
|
79
|
+
),
|
|
80
|
+
testParallelism: parseIntEnv("NEXUS_TEST_PARALLELISM", workerDefaults.testParallelism),
|
|
81
|
+
evaluationMaxWorkers: parseIntEnv(
|
|
82
|
+
"NEXUS_EVALUATION_MAX_WORKERS",
|
|
83
|
+
workerDefaults.evaluationMaxWorkers
|
|
84
|
+
),
|
|
85
|
+
eventBusMaxHistory: parseIntEnv(
|
|
86
|
+
"NEXUS_EVENTBUS_MAX_HISTORY",
|
|
87
|
+
workerDefaults.eventBusMaxHistory
|
|
88
|
+
),
|
|
89
|
+
swarmObserverMaxEvents: parseIntEnv(
|
|
90
|
+
"NEXUS_SWARM_OBSERVER_MAX_EVENTS",
|
|
91
|
+
workerDefaults.swarmObserverMaxEvents
|
|
92
|
+
)
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function createGetCircuitBreakerConfig(cbDefaults) {
|
|
97
|
+
return () => {
|
|
98
|
+
return {
|
|
99
|
+
failureThreshold: parseIntEnv("NEXUS_CIRCUIT_BREAKER_THRESHOLD", cbDefaults.failureThreshold),
|
|
100
|
+
resetTimeoutMs: parseIntEnv("NEXUS_CIRCUIT_BREAKER_RESET_TIMEOUT", cbDefaults.resetTimeoutMs),
|
|
101
|
+
halfOpenSuccessThreshold: cbDefaults.halfOpenSuccessThreshold,
|
|
102
|
+
countTimeoutsAsFailures: cbDefaults.countTimeoutsAsFailures,
|
|
103
|
+
countAuthFailuresAsFailures: cbDefaults.countAuthFailuresAsFailures,
|
|
104
|
+
countRateLimitsAsFailures: cbDefaults.countRateLimitsAsFailures,
|
|
105
|
+
halfOpenMaxRequests: cbDefaults.halfOpenMaxRequests
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function createGetToolRateLimit(toolRateLimits) {
|
|
110
|
+
return (tool) => {
|
|
111
|
+
return toolRateLimits[tool];
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
function createGetEnvVarDocumentation(defaults) {
|
|
115
|
+
return () => {
|
|
116
|
+
const t = defaults.TIMEOUT_DEFAULTS;
|
|
117
|
+
const r = defaults.RATE_LIMIT_DEFAULTS;
|
|
118
|
+
const rt = defaults.RETRY_DEFAULTS;
|
|
119
|
+
const w = defaults.WORKER_DEFAULTS;
|
|
120
|
+
const cb = defaults.CIRCUIT_BREAKER_DEFAULTS;
|
|
121
|
+
return `# Environment Variable Overrides
|
|
122
|
+
|
|
123
|
+
All defaults can be overridden via environment variables using the NEXUS_ prefix.
|
|
124
|
+
|
|
125
|
+
## Timeouts
|
|
126
|
+
|
|
127
|
+
| Variable | Default | Description |
|
|
128
|
+
| -------- | ------- | ----------- |
|
|
129
|
+
| NEXUS_TIMEOUT_CLI | ${String(t.cliMs)} | CLI execution timeout (ms) |
|
|
130
|
+
| NEXUS_TIMEOUT_API | ${String(t.apiMs)} | API request timeout (ms) |
|
|
131
|
+
| NEXUS_TIMEOUT_WORKFLOW | ${String(t.workflowMs)} | Workflow timeout (ms) |
|
|
132
|
+
| NEXUS_TIMEOUT_MCP | ${String(t.mcpMs)} | MCP operation timeout (ms) |
|
|
133
|
+
|
|
134
|
+
## Rate Limits
|
|
135
|
+
|
|
136
|
+
| Variable | Default | Description |
|
|
137
|
+
| -------- | ------- | ----------- |
|
|
138
|
+
| NEXUS_RATE_LIMIT_RPM | ${String(r.requestsPerMinute)} | Requests per minute |
|
|
139
|
+
| NEXUS_RATE_LIMIT_ENABLED | ${String(r.enabled)} | Enable rate limiting |
|
|
140
|
+
| NEXUS_RATE_LIMIT_CAPACITY | ${String(r.capacity)} | Token bucket capacity |
|
|
141
|
+
|
|
142
|
+
## Retries
|
|
143
|
+
|
|
144
|
+
| Variable | Default | Description |
|
|
145
|
+
| -------- | ------- | ----------- |
|
|
146
|
+
| NEXUS_RETRY_MAX_RETRIES | ${String(rt.maxRetries)} | Maximum retry attempts |
|
|
147
|
+
| NEXUS_RETRY_BASE_DELAY | ${String(rt.baseDelayMs)} | Base delay (ms) |
|
|
148
|
+
| NEXUS_RETRY_MAX_DELAY | ${String(rt.maxDelayMs)} | Maximum delay (ms) |
|
|
149
|
+
| NEXUS_RETRY_JITTER | ${String(rt.jitterFactor)} | Jitter factor (0-1) |
|
|
150
|
+
|
|
151
|
+
## Workers
|
|
152
|
+
|
|
153
|
+
| Variable | Default | Description |
|
|
154
|
+
| -------- | ------- | ----------- |
|
|
155
|
+
| NEXUS_WORKERS_MAX | ${String(w.maxWorkers)} | Maximum workers |
|
|
156
|
+
| NEXUS_WORKERS_POOL_SIZE | ${String(w.poolSize)} | Worker pool size |
|
|
157
|
+
| NEXUS_WORKFLOW_MAX_PARALLEL | ${String(w.workflowMaxParallel)} | Max parallel workflow steps |
|
|
158
|
+
| NEXUS_TEST_PARALLELISM | ${String(w.testParallelism)} | Test parallelism |
|
|
159
|
+
|
|
160
|
+
## Circuit Breaker
|
|
161
|
+
|
|
162
|
+
| Variable | Default | Description |
|
|
163
|
+
| -------- | ------- | ----------- |
|
|
164
|
+
| NEXUS_CIRCUIT_BREAKER_THRESHOLD | ${String(cb.failureThreshold)} | Failure threshold |
|
|
165
|
+
| NEXUS_CIRCUIT_BREAKER_RESET_TIMEOUT | ${String(cb.resetTimeoutMs)} | Reset timeout (ms) |
|
|
166
|
+
`;
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// src/config/defaults.ts
|
|
171
|
+
var CUSTOM_API_DEFAULT_MODEL = "gpt-4o";
|
|
172
|
+
var DEFAULTS = {
|
|
173
|
+
/**
|
|
174
|
+
* Default timeout settings in milliseconds.
|
|
175
|
+
* Values sourced from config/timeouts.ts (Issue #984).
|
|
176
|
+
*/
|
|
177
|
+
TIMEOUT_DEFAULTS: {
|
|
178
|
+
/** CLI tool execution timeout in milliseconds. */
|
|
179
|
+
cliMs: CLI_TIMEOUTS.default.standard,
|
|
180
|
+
/** Simple CLI task timeout (single function, quick query). */
|
|
181
|
+
cliSimpleMs: CLI_TIMEOUTS.default.simple,
|
|
182
|
+
/** Complex CLI task timeout (codebase-wide, deep analysis). */
|
|
183
|
+
cliComplexMs: CLI_TIMEOUTS.default.complex,
|
|
184
|
+
/** API request timeout in milliseconds. */
|
|
185
|
+
apiMs: API_TIMEOUTS.defaultMs,
|
|
186
|
+
/** Maximum API timeout in milliseconds. */
|
|
187
|
+
apiMaxMs: API_TIMEOUTS.maxMs,
|
|
188
|
+
/** Workflow-level timeout in milliseconds (5 minutes). */
|
|
189
|
+
workflowMs: WORKFLOW_TIMEOUTS.workflowMs,
|
|
190
|
+
/** Maximum workflow timeout in milliseconds (30 minutes). */
|
|
191
|
+
workflowMaxMs: WORKFLOW_TIMEOUTS.workflowMaxMs,
|
|
192
|
+
/** Step-level timeout in milliseconds. */
|
|
193
|
+
stepMs: INTERNAL_TIMEOUTS.selfEvalMs,
|
|
194
|
+
/** MCP operation default timeout in milliseconds (generic, not per-tool). */
|
|
195
|
+
mcpMs: API_TIMEOUTS.defaultMs,
|
|
196
|
+
/** MCP operation maximum timeout in milliseconds. */
|
|
197
|
+
mcpMaxMs: MCP_TIMEOUTS.maxMs,
|
|
198
|
+
/** Health check timeout in milliseconds. */
|
|
199
|
+
healthCheckMs: INTERNAL_TIMEOUTS.healthCheckMs,
|
|
200
|
+
/** Global test run timeout in milliseconds (10 minutes). */
|
|
201
|
+
testGlobalMs: TEST_TIMEOUTS.globalMs,
|
|
202
|
+
/** Per-task test timeout in milliseconds. */
|
|
203
|
+
testTaskMs: TEST_TIMEOUTS.taskMs,
|
|
204
|
+
/** Circuit breaker reset timeout in milliseconds. */
|
|
205
|
+
circuitBreakerResetMs: INTERNAL_TIMEOUTS.circuitBreakerResetMs
|
|
206
|
+
},
|
|
207
|
+
/**
|
|
208
|
+
* Default rate limit settings for outbound operations.
|
|
209
|
+
*/
|
|
210
|
+
RATE_LIMIT_DEFAULTS: {
|
|
211
|
+
/** Global requests per minute. */
|
|
212
|
+
requestsPerMinute: 60,
|
|
213
|
+
/** Whether rate limiting is enabled by default. */
|
|
214
|
+
enabled: true,
|
|
215
|
+
/** Maximum number of concurrent requests. */
|
|
216
|
+
maxConcurrent: 4,
|
|
217
|
+
/** Token bucket capacity. */
|
|
218
|
+
capacity: 100,
|
|
219
|
+
/** Token bucket refill rate per second. */
|
|
220
|
+
refillRate: 10,
|
|
221
|
+
/** Refill interval in milliseconds. */
|
|
222
|
+
refillIntervalMs: 100
|
|
223
|
+
},
|
|
224
|
+
/**
|
|
225
|
+
* Per-tool rate limit defaults for MCP tools.
|
|
226
|
+
* (Source: Issue #274 Phase 2 - per-tool rate limits)
|
|
227
|
+
*/
|
|
228
|
+
TOOL_RATE_LIMITS: {
|
|
229
|
+
orchestrate: { capacity: 10, refillRate: 10, refillIntervalMs: 6e4 },
|
|
230
|
+
delegate: { capacity: 20, refillRate: 20, refillIntervalMs: 6e4 },
|
|
231
|
+
workflow: { capacity: 5, refillRate: 5, refillIntervalMs: 6e4 },
|
|
232
|
+
expert: { capacity: 30, refillRate: 30, refillIntervalMs: 6e4 }
|
|
233
|
+
},
|
|
234
|
+
/**
|
|
235
|
+
* Default retry strategy settings for transient failures.
|
|
236
|
+
*/
|
|
237
|
+
RETRY_DEFAULTS: {
|
|
238
|
+
/** Maximum retry attempts before failing. */
|
|
239
|
+
maxRetries: 3,
|
|
240
|
+
/** Base delay between retries in milliseconds. */
|
|
241
|
+
baseDelayMs: 1e3,
|
|
242
|
+
/** Maximum delay between retries in milliseconds. */
|
|
243
|
+
maxDelayMs: 3e4,
|
|
244
|
+
/** Jitter factor (0-1) to randomize retry delays. */
|
|
245
|
+
jitterFactor: 0.1
|
|
246
|
+
},
|
|
247
|
+
/**
|
|
248
|
+
* Workflow-specific retry defaults.
|
|
249
|
+
*/
|
|
250
|
+
WORKFLOW_RETRY_DEFAULTS: {
|
|
251
|
+
/** Maximum retry attempts for workflow steps. */
|
|
252
|
+
maxRetries: 2,
|
|
253
|
+
/** Base delay for workflow retries in milliseconds. */
|
|
254
|
+
baseDelayMs: 2e3,
|
|
255
|
+
/** Maximum delay for workflow retries in milliseconds. */
|
|
256
|
+
maxDelayMs: 6e4,
|
|
257
|
+
/** Jitter factor for workflow retries. */
|
|
258
|
+
jitterFactor: 0.15
|
|
259
|
+
},
|
|
260
|
+
/**
|
|
261
|
+
* CLI-specific retry defaults.
|
|
262
|
+
*/
|
|
263
|
+
CLI_RETRY_DEFAULTS: {
|
|
264
|
+
/** Maximum retry attempts for CLI operations. */
|
|
265
|
+
maxRetries: 2,
|
|
266
|
+
/** Base delay for CLI retries in milliseconds. */
|
|
267
|
+
baseDelayMs: 5e3,
|
|
268
|
+
/** Maximum delay for CLI retries in milliseconds. */
|
|
269
|
+
maxDelayMs: 6e4,
|
|
270
|
+
/** Jitter factor for CLI retries. */
|
|
271
|
+
jitterFactor: 0.2
|
|
272
|
+
},
|
|
273
|
+
/**
|
|
274
|
+
* Test framework retry defaults.
|
|
275
|
+
*/
|
|
276
|
+
TEST_RETRY_DEFAULTS: {
|
|
277
|
+
/** Maximum retries per test task. */
|
|
278
|
+
maxRetries: 2,
|
|
279
|
+
/** Whether to retry failed tasks by default. */
|
|
280
|
+
retryFailedTasks: true
|
|
281
|
+
},
|
|
282
|
+
/**
|
|
283
|
+
* Default buffer sizing for batching and chunked processing.
|
|
284
|
+
*/
|
|
285
|
+
BUFFER_DEFAULTS: {
|
|
286
|
+
/** Preferred batch size for bulk operations. */
|
|
287
|
+
batchSize: 100,
|
|
288
|
+
/** Chunk size for streaming or segmented processing. */
|
|
289
|
+
chunkSize: 256,
|
|
290
|
+
/** Maximum items allowed in a buffer. */
|
|
291
|
+
maxItems: 1e3,
|
|
292
|
+
/** Maximum memory size in bytes (10 MB). */
|
|
293
|
+
maxMemoryBytes: 10 * 1024 * 1024,
|
|
294
|
+
/** Log buffer flush interval in milliseconds. */
|
|
295
|
+
logFlushIntervalMs: 5e3
|
|
296
|
+
},
|
|
297
|
+
/**
|
|
298
|
+
* Default worker pool sizing.
|
|
299
|
+
*/
|
|
300
|
+
WORKER_DEFAULTS: {
|
|
301
|
+
/** Maximum number of workers. */
|
|
302
|
+
maxWorkers: 8,
|
|
303
|
+
/** Default worker pool size. */
|
|
304
|
+
poolSize: 4,
|
|
305
|
+
/** Worker idle timeout in milliseconds (5 minutes). */
|
|
306
|
+
idleTimeoutMs: 5 * 6e4,
|
|
307
|
+
/** Maximum parallel workflow steps. */
|
|
308
|
+
workflowMaxParallel: 5,
|
|
309
|
+
/** Test framework parallelism. */
|
|
310
|
+
testParallelism: 3,
|
|
311
|
+
/** Evaluation harness max workers. */
|
|
312
|
+
evaluationMaxWorkers: 8,
|
|
313
|
+
/** EventBus max history size. */
|
|
314
|
+
eventBusMaxHistory: 1e3,
|
|
315
|
+
/** Swarm observer max events. */
|
|
316
|
+
swarmObserverMaxEvents: 1e4
|
|
317
|
+
},
|
|
318
|
+
/**
|
|
319
|
+
* Default circuit breaker settings.
|
|
320
|
+
* (Source: Issue #81 - Circuit breaker for CLI failures)
|
|
321
|
+
*/
|
|
322
|
+
CIRCUIT_BREAKER_DEFAULTS: {
|
|
323
|
+
/** Failure threshold to open circuit. */
|
|
324
|
+
failureThreshold: 5,
|
|
325
|
+
/** Reset timeout in milliseconds. */
|
|
326
|
+
resetTimeoutMs: 3e4,
|
|
327
|
+
/** Success threshold to close circuit in half-open state. */
|
|
328
|
+
halfOpenSuccessThreshold: 2,
|
|
329
|
+
/** Whether to count timeouts as failures. */
|
|
330
|
+
countTimeoutsAsFailures: true,
|
|
331
|
+
/** Whether to count auth failures as failures. */
|
|
332
|
+
countAuthFailuresAsFailures: false,
|
|
333
|
+
/** Whether to count rate limit errors as failures (#1529). */
|
|
334
|
+
countRateLimitsAsFailures: true,
|
|
335
|
+
/** Maximum requests allowed in half-open state. */
|
|
336
|
+
halfOpenMaxRequests: 3
|
|
337
|
+
},
|
|
338
|
+
/**
|
|
339
|
+
* Default context/memory settings.
|
|
340
|
+
*/
|
|
341
|
+
CONTEXT_DEFAULTS: {
|
|
342
|
+
/** Maximum context tokens. */
|
|
343
|
+
maxTokens: 1e5,
|
|
344
|
+
/** Token budget warning threshold (80%). */
|
|
345
|
+
warningThreshold: 0.8,
|
|
346
|
+
/** Token budget critical threshold (95%). */
|
|
347
|
+
criticalThreshold: 0.95,
|
|
348
|
+
/** Maximum history entries to retain. */
|
|
349
|
+
maxHistoryEntries: 1e3
|
|
350
|
+
},
|
|
351
|
+
/**
|
|
352
|
+
* Default provider/model settings.
|
|
353
|
+
*/
|
|
354
|
+
PROVIDER_DEFAULTS: {
|
|
355
|
+
/** Default timeout for provider API calls in ms. */
|
|
356
|
+
timeout: 3e4,
|
|
357
|
+
/** Maximum retries for provider requests. */
|
|
358
|
+
maxRetries: 3,
|
|
359
|
+
/** Default model tier. */
|
|
360
|
+
defaultTier: "balanced",
|
|
361
|
+
/** Default temperature. */
|
|
362
|
+
temperatureDefault: 0.3,
|
|
363
|
+
/** Minimum temperature. */
|
|
364
|
+
temperatureMin: 0,
|
|
365
|
+
/** Maximum temperature. */
|
|
366
|
+
temperatureMax: 1,
|
|
367
|
+
/** Billing mode: 'plan' (monthly subscription) or 'api' (pay-per-token). Env: NEXUS_BILLING_MODE */
|
|
368
|
+
billingMode: "plan"
|
|
369
|
+
},
|
|
370
|
+
/**
|
|
371
|
+
* Security-related defaults.
|
|
372
|
+
*/
|
|
373
|
+
SECURITY_DEFAULTS: {
|
|
374
|
+
/** Maximum system prompt length in characters. */
|
|
375
|
+
maxSystemPromptLength: 4e3,
|
|
376
|
+
/** Default policy execution mode. */
|
|
377
|
+
policyDefaultMode: "read-only",
|
|
378
|
+
/** Default policy mode. */
|
|
379
|
+
policyMode: "enforce",
|
|
380
|
+
/** Default sandbox mode. */
|
|
381
|
+
sandboxMode: "policy",
|
|
382
|
+
/** Whether to fall back to policy mode if container unavailable. */
|
|
383
|
+
sandboxFallbackToPolicy: true,
|
|
384
|
+
/** Whether network is enabled in container mode. */
|
|
385
|
+
sandboxNetworkEnabled: false
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
var getTimeout = createGetTimeout(DEFAULTS.TIMEOUT_DEFAULTS);
|
|
389
|
+
var getRetryConfig = createGetRetryConfig(DEFAULTS.RETRY_DEFAULTS);
|
|
390
|
+
var getRateLimitConfig = createGetRateLimitConfig(DEFAULTS.RATE_LIMIT_DEFAULTS);
|
|
391
|
+
var getWorkerConfig = createGetWorkerConfig(DEFAULTS.WORKER_DEFAULTS);
|
|
392
|
+
var getCircuitBreakerConfig = createGetCircuitBreakerConfig(
|
|
393
|
+
DEFAULTS.CIRCUIT_BREAKER_DEFAULTS
|
|
394
|
+
);
|
|
395
|
+
var getToolRateLimit = createGetToolRateLimit(DEFAULTS.TOOL_RATE_LIMITS);
|
|
396
|
+
var getEnvVarDocumentation = createGetEnvVarDocumentation(DEFAULTS);
|
|
397
|
+
|
|
398
|
+
export {
|
|
399
|
+
CUSTOM_API_DEFAULT_MODEL,
|
|
400
|
+
DEFAULTS
|
|
401
|
+
};
|
|
402
|
+
//# sourceMappingURL=chunk-H43PABG4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/config/defaults-env.ts","../src/config/defaults.ts"],"sourcesContent":["/**\n * Environment Variable Override Helpers\n *\n * Provides utilities for reading configuration from environment variables\n * with type-safe fallbacks to defaults.\n *\n * @module config/defaults-env\n */\n\nimport type {\n CircuitBreakerDefaults,\n RateLimitDefaults,\n RetryDefaults,\n ToolRateLimitConfig,\n WorkerDefaults,\n} from './defaults-types.js';\n\n// ============================================================================\n// Environment Variable Parsers\n// ============================================================================\n\n/**\n * Parses an integer from an environment variable with fallback.\n */\nexport function parseIntEnv(envKey: string, fallback: number): number {\n const envValue = process.env[envKey];\n if (envValue === undefined) {\n return fallback;\n }\n const parsed = parseInt(envValue, 10);\n return isNaN(parsed) || parsed <= 0 ? fallback : parsed;\n}\n\n/**\n * Parses a float from an environment variable with fallback.\n */\nexport function parseFloatEnv(envKey: string, fallback: number): number {\n const envValue = process.env[envKey];\n if (envValue === undefined) {\n return fallback;\n }\n const parsed = parseFloat(envValue);\n return isNaN(parsed) || !isFinite(parsed) ? fallback : parsed;\n}\n\n/**\n * Parses a boolean from an environment variable with fallback.\n * Only 'true'/'1' are truthy, 'false'/'0' are falsy.\n * Any other value returns the fallback.\n */\nexport function parseBoolEnv(envKey: string, fallback: boolean): boolean {\n const envValue = process.env[envKey]?.toLowerCase();\n if (envValue === undefined) {\n return fallback;\n }\n if (envValue === 'true' || envValue === '1') return true;\n if (envValue === 'false' || envValue === '0') return false;\n return fallback;\n}\n\n// ============================================================================\n// Config Getter Types (for lazy initialization)\n// ============================================================================\n\n/** Timeout defaults type from DEFAULTS object */\nexport interface TimeoutDefaultsConst {\n readonly cliMs: number;\n readonly cliSimpleMs: number;\n readonly cliComplexMs: number;\n readonly apiMs: number;\n readonly apiMaxMs: number;\n readonly workflowMs: number;\n readonly workflowMaxMs: number;\n readonly stepMs: number;\n readonly mcpMs: number;\n readonly mcpMaxMs: number;\n readonly healthCheckMs: number;\n readonly testGlobalMs: number;\n readonly testTaskMs: number;\n readonly circuitBreakerResetMs: number;\n}\n\n/** Tool rate limits type from DEFAULTS object */\nexport interface ToolRateLimitsConst {\n readonly orchestrate: ToolRateLimitConfig;\n readonly delegate: ToolRateLimitConfig;\n readonly workflow: ToolRateLimitConfig;\n readonly expert: ToolRateLimitConfig;\n}\n\n/** Rate limit defaults type from DEFAULTS object */\ninterface RateLimitDefaultsConst {\n readonly requestsPerMinute: number;\n readonly enabled: boolean;\n readonly maxConcurrent: number;\n readonly capacity: number;\n readonly refillRate: number;\n readonly refillIntervalMs: number;\n}\n\n/** Retry defaults type from DEFAULTS object */\ninterface RetryDefaultsConst {\n readonly maxRetries: number;\n readonly baseDelayMs: number;\n readonly maxDelayMs: number;\n readonly jitterFactor: number;\n}\n\n/** Worker defaults type from DEFAULTS object */\ninterface WorkerDefaultsConst {\n readonly maxWorkers: number;\n readonly poolSize: number;\n readonly idleTimeoutMs: number;\n readonly workflowMaxParallel: number;\n readonly testParallelism: number;\n readonly evaluationMaxWorkers: number;\n readonly eventBusMaxHistory: number;\n readonly swarmObserverMaxEvents: number;\n}\n\n/** Circuit breaker defaults type from DEFAULTS object */\ninterface CircuitBreakerDefaultsConst {\n readonly failureThreshold: number;\n readonly resetTimeoutMs: number;\n readonly halfOpenSuccessThreshold: number;\n readonly countTimeoutsAsFailures: boolean;\n readonly countAuthFailuresAsFailures: boolean;\n readonly countRateLimitsAsFailures: boolean;\n readonly halfOpenMaxRequests: number;\n}\n\n// ============================================================================\n// Config Getter Factory Functions\n// ============================================================================\n\n/**\n * Creates a timeout getter function bound to the DEFAULTS object.\n */\nexport function createGetTimeout(\n timeoutDefaults: TimeoutDefaultsConst\n): (key: keyof TimeoutDefaultsConst) => number {\n return (key: keyof TimeoutDefaultsConst): number => {\n const envKey = `NEXUS_TIMEOUT_${key.replace(/Ms$/, '').toUpperCase()}`;\n return parseIntEnv(envKey, timeoutDefaults[key]);\n };\n}\n\n/**\n * Creates a retry config getter function bound to the DEFAULTS object.\n */\nexport function createGetRetryConfig(retryDefaults: RetryDefaultsConst): () => RetryDefaults {\n return (): RetryDefaults => {\n return {\n maxRetries: parseIntEnv('NEXUS_RETRY_MAX_RETRIES', retryDefaults.maxRetries),\n baseDelayMs: parseIntEnv('NEXUS_RETRY_BASE_DELAY', retryDefaults.baseDelayMs),\n maxDelayMs: parseIntEnv('NEXUS_RETRY_MAX_DELAY', retryDefaults.maxDelayMs),\n jitterFactor: parseFloatEnv('NEXUS_RETRY_JITTER', retryDefaults.jitterFactor),\n };\n };\n}\n\n/**\n * Creates a rate limit config getter function bound to the DEFAULTS object.\n */\nexport function createGetRateLimitConfig(\n rateLimitDefaults: RateLimitDefaultsConst\n): () => RateLimitDefaults {\n return (): RateLimitDefaults => {\n return {\n requestsPerMinute: parseIntEnv('NEXUS_RATE_LIMIT_RPM', rateLimitDefaults.requestsPerMinute),\n enabled: parseBoolEnv('NEXUS_RATE_LIMIT_ENABLED', rateLimitDefaults.enabled),\n maxConcurrent: parseIntEnv(\n 'NEXUS_RATE_LIMIT_MAX_CONCURRENT',\n rateLimitDefaults.maxConcurrent\n ),\n capacity: parseIntEnv('NEXUS_RATE_LIMIT_CAPACITY', rateLimitDefaults.capacity),\n refillRate: parseIntEnv('NEXUS_RATE_LIMIT_REFILL_RATE', rateLimitDefaults.refillRate),\n refillIntervalMs: parseIntEnv(\n 'NEXUS_RATE_LIMIT_REFILL_INTERVAL',\n rateLimitDefaults.refillIntervalMs\n ),\n };\n };\n}\n\n/**\n * Creates a worker config getter function bound to the DEFAULTS object.\n */\nexport function createGetWorkerConfig(workerDefaults: WorkerDefaultsConst): () => WorkerDefaults {\n return (): WorkerDefaults => {\n return {\n maxWorkers: parseIntEnv('NEXUS_WORKERS_MAX', workerDefaults.maxWorkers),\n poolSize: parseIntEnv('NEXUS_WORKERS_POOL_SIZE', workerDefaults.poolSize),\n idleTimeoutMs: parseIntEnv('NEXUS_WORKERS_IDLE_TIMEOUT', workerDefaults.idleTimeoutMs),\n workflowMaxParallel: parseIntEnv(\n 'NEXUS_WORKFLOW_MAX_PARALLEL',\n workerDefaults.workflowMaxParallel\n ),\n testParallelism: parseIntEnv('NEXUS_TEST_PARALLELISM', workerDefaults.testParallelism),\n evaluationMaxWorkers: parseIntEnv(\n 'NEXUS_EVALUATION_MAX_WORKERS',\n workerDefaults.evaluationMaxWorkers\n ),\n eventBusMaxHistory: parseIntEnv(\n 'NEXUS_EVENTBUS_MAX_HISTORY',\n workerDefaults.eventBusMaxHistory\n ),\n swarmObserverMaxEvents: parseIntEnv(\n 'NEXUS_SWARM_OBSERVER_MAX_EVENTS',\n workerDefaults.swarmObserverMaxEvents\n ),\n };\n };\n}\n\n/**\n * Creates a circuit breaker config getter function bound to the DEFAULTS object.\n */\nexport function createGetCircuitBreakerConfig(\n cbDefaults: CircuitBreakerDefaultsConst\n): () => CircuitBreakerDefaults {\n return (): CircuitBreakerDefaults => {\n return {\n failureThreshold: parseIntEnv('NEXUS_CIRCUIT_BREAKER_THRESHOLD', cbDefaults.failureThreshold),\n resetTimeoutMs: parseIntEnv('NEXUS_CIRCUIT_BREAKER_RESET_TIMEOUT', cbDefaults.resetTimeoutMs),\n halfOpenSuccessThreshold: cbDefaults.halfOpenSuccessThreshold,\n countTimeoutsAsFailures: cbDefaults.countTimeoutsAsFailures,\n countAuthFailuresAsFailures: cbDefaults.countAuthFailuresAsFailures,\n countRateLimitsAsFailures: cbDefaults.countRateLimitsAsFailures,\n halfOpenMaxRequests: cbDefaults.halfOpenMaxRequests,\n };\n };\n}\n\n/**\n * Creates a tool rate limit getter function bound to the DEFAULTS object.\n */\nexport function createGetToolRateLimit(\n toolRateLimits: ToolRateLimitsConst\n): (tool: keyof ToolRateLimitsConst) => ToolRateLimitConfig {\n return (tool: keyof ToolRateLimitsConst): ToolRateLimitConfig => {\n return toolRateLimits[tool];\n };\n}\n\n// ============================================================================\n// Documentation Helper\n// ============================================================================\n\n/** DEFAULTS structure for documentation generation */\ninterface DefaultsForDocs {\n readonly TIMEOUT_DEFAULTS: TimeoutDefaultsConst;\n readonly RATE_LIMIT_DEFAULTS: RateLimitDefaultsConst;\n readonly RETRY_DEFAULTS: RetryDefaultsConst;\n readonly WORKER_DEFAULTS: WorkerDefaultsConst;\n readonly CIRCUIT_BREAKER_DEFAULTS: CircuitBreakerDefaultsConst;\n}\n\n/**\n * Creates a documentation generator function bound to the DEFAULTS object.\n *\n * @param defaults - The DEFAULTS object\n * @returns Function that generates environment variable documentation\n */\nexport function createGetEnvVarDocumentation(defaults: DefaultsForDocs): () => string {\n return (): string => {\n const t = defaults.TIMEOUT_DEFAULTS;\n const r = defaults.RATE_LIMIT_DEFAULTS;\n const rt = defaults.RETRY_DEFAULTS;\n const w = defaults.WORKER_DEFAULTS;\n const cb = defaults.CIRCUIT_BREAKER_DEFAULTS;\n\n return `# Environment Variable Overrides\n\nAll defaults can be overridden via environment variables using the NEXUS_ prefix.\n\n## Timeouts\n\n| Variable | Default | Description |\n| -------- | ------- | ----------- |\n| NEXUS_TIMEOUT_CLI | ${String(t.cliMs)} | CLI execution timeout (ms) |\n| NEXUS_TIMEOUT_API | ${String(t.apiMs)} | API request timeout (ms) |\n| NEXUS_TIMEOUT_WORKFLOW | ${String(t.workflowMs)} | Workflow timeout (ms) |\n| NEXUS_TIMEOUT_MCP | ${String(t.mcpMs)} | MCP operation timeout (ms) |\n\n## Rate Limits\n\n| Variable | Default | Description |\n| -------- | ------- | ----------- |\n| NEXUS_RATE_LIMIT_RPM | ${String(r.requestsPerMinute)} | Requests per minute |\n| NEXUS_RATE_LIMIT_ENABLED | ${String(r.enabled)} | Enable rate limiting |\n| NEXUS_RATE_LIMIT_CAPACITY | ${String(r.capacity)} | Token bucket capacity |\n\n## Retries\n\n| Variable | Default | Description |\n| -------- | ------- | ----------- |\n| NEXUS_RETRY_MAX_RETRIES | ${String(rt.maxRetries)} | Maximum retry attempts |\n| NEXUS_RETRY_BASE_DELAY | ${String(rt.baseDelayMs)} | Base delay (ms) |\n| NEXUS_RETRY_MAX_DELAY | ${String(rt.maxDelayMs)} | Maximum delay (ms) |\n| NEXUS_RETRY_JITTER | ${String(rt.jitterFactor)} | Jitter factor (0-1) |\n\n## Workers\n\n| Variable | Default | Description |\n| -------- | ------- | ----------- |\n| NEXUS_WORKERS_MAX | ${String(w.maxWorkers)} | Maximum workers |\n| NEXUS_WORKERS_POOL_SIZE | ${String(w.poolSize)} | Worker pool size |\n| NEXUS_WORKFLOW_MAX_PARALLEL | ${String(w.workflowMaxParallel)} | Max parallel workflow steps |\n| NEXUS_TEST_PARALLELISM | ${String(w.testParallelism)} | Test parallelism |\n\n## Circuit Breaker\n\n| Variable | Default | Description |\n| -------- | ------- | ----------- |\n| NEXUS_CIRCUIT_BREAKER_THRESHOLD | ${String(cb.failureThreshold)} | Failure threshold |\n| NEXUS_CIRCUIT_BREAKER_RESET_TIMEOUT | ${String(cb.resetTimeoutMs)} | Reset timeout (ms) |\n`;\n };\n}\n","/**\n * Central Configuration Defaults\n *\n * Consolidates common default values used across the codebase.\n * This prevents scattered magic numbers and ensures consistency.\n *\n * Usage:\n * import { DEFAULTS, getTimeout, TIMEOUT_PROFILES } from '../config/defaults.js';\n * const timeout = options.timeout ?? DEFAULTS.TIMEOUT_DEFAULTS.cliMs;\n * const cliTimeout = getTimeoutForCli('claude', 'complex');\n *\n * Environment overrides can be added via NEXUS_* environment variables.\n *\n * @module config/defaults\n * (Source: Central config consolidation initiative)\n */\n\n// Re-export types from defaults-types\nexport type {\n TaskComplexity,\n TimeoutProfile,\n KnownCliName,\n TimeoutDefaults,\n RateLimitDefaults,\n ToolRateLimitConfig,\n RetryDefaults,\n WorkerDefaults,\n CircuitBreakerDefaults,\n} from './defaults-types.js';\n\nexport { isTaskComplexity, isKnownCliName } from './defaults-types.js';\n\n// Re-export timeout profiles (delegates to config/timeouts.ts)\nexport {\n TIMEOUT_PROFILES,\n getTimeoutProfile,\n getTimeoutForCli,\n} from './defaults-timeout-profiles.js';\n\n// Re-export canonical timeout modules (Issue #984)\nexport {\n CLI_TIMEOUTS,\n VOTE_TIMEOUTS,\n MCP_TIMEOUTS,\n WORKFLOW_TIMEOUTS,\n GRAPH_TIMEOUTS,\n PER_CLI_TASK_TIMEOUTS,\n API_TIMEOUTS,\n INTERNAL_TIMEOUTS,\n TEST_TIMEOUTS,\n TIMEOUT_ENV_VARS,\n getCliTimeoutProfile,\n getCliTimeout,\n resolveVoteTimeout,\n resolveEnvTimeout,\n validateTimeout,\n BACKOFF_CONFIG,\n AGENT_ROUTER_TIMEOUTS,\n CODEX_MCP_TIMEOUTS,\n} from './timeouts.js';\n\n// Re-export env helpers (internal use)\nexport { parseIntEnv, parseFloatEnv, parseBoolEnv } from './defaults-env.js';\n\nimport {\n createGetTimeout,\n createGetRetryConfig,\n createGetRateLimitConfig,\n createGetWorkerConfig,\n createGetCircuitBreakerConfig,\n createGetToolRateLimit,\n createGetEnvVarDocumentation,\n} from './defaults-env.js';\nimport {\n API_TIMEOUTS as _API,\n WORKFLOW_TIMEOUTS as _WF,\n MCP_TIMEOUTS as _MCP,\n INTERNAL_TIMEOUTS as _INT,\n TEST_TIMEOUTS as _TEST,\n CLI_TIMEOUTS as _CLI,\n} from './timeouts.js';\n\n// ============================================================================\n// Default Model IDs (#2200 Child 4)\n// ============================================================================\n\n/**\n * Default model identifier for the custom OpenAI-compatible API gateway.\n *\n * Used by both `cli/setup-custom-api.ts` (write to nexus-agents.yaml) and\n * `adapters/auto-adapter.ts` (NEXUS_CUSTOM_MODEL env-var fallback). Single\n * source of truth so changes flow through all consumers.\n *\n * `gpt-4o` is widely supported across OpenAI-compatible gateways (vLLM,\n * LiteLLM, Together AI, etc.) — a pragmatic baseline rather than the\n * cheapest or most capable. Operators are expected to override.\n */\nexport const CUSTOM_API_DEFAULT_MODEL = 'gpt-4o';\n\n// ============================================================================\n// Central Defaults Object\n// ============================================================================\n\n/**\n * Central defaults object containing all configuration categories.\n */\nexport const DEFAULTS = {\n /**\n * Default timeout settings in milliseconds.\n * Values sourced from config/timeouts.ts (Issue #984).\n */\n TIMEOUT_DEFAULTS: {\n /** CLI tool execution timeout in milliseconds. */\n cliMs: _CLI.default.standard,\n /** Simple CLI task timeout (single function, quick query). */\n cliSimpleMs: _CLI.default.simple,\n /** Complex CLI task timeout (codebase-wide, deep analysis). */\n cliComplexMs: _CLI.default.complex,\n /** API request timeout in milliseconds. */\n apiMs: _API.defaultMs,\n /** Maximum API timeout in milliseconds. */\n apiMaxMs: _API.maxMs,\n /** Workflow-level timeout in milliseconds (5 minutes). */\n workflowMs: _WF.workflowMs,\n /** Maximum workflow timeout in milliseconds (30 minutes). */\n workflowMaxMs: _WF.workflowMaxMs,\n /** Step-level timeout in milliseconds. */\n stepMs: _INT.selfEvalMs,\n /** MCP operation default timeout in milliseconds (generic, not per-tool). */\n mcpMs: _API.defaultMs,\n /** MCP operation maximum timeout in milliseconds. */\n mcpMaxMs: _MCP.maxMs,\n /** Health check timeout in milliseconds. */\n healthCheckMs: _INT.healthCheckMs,\n /** Global test run timeout in milliseconds (10 minutes). */\n testGlobalMs: _TEST.globalMs,\n /** Per-task test timeout in milliseconds. */\n testTaskMs: _TEST.taskMs,\n /** Circuit breaker reset timeout in milliseconds. */\n circuitBreakerResetMs: _INT.circuitBreakerResetMs,\n },\n\n /**\n * Default rate limit settings for outbound operations.\n */\n RATE_LIMIT_DEFAULTS: {\n /** Global requests per minute. */\n requestsPerMinute: 60,\n /** Whether rate limiting is enabled by default. */\n enabled: true,\n /** Maximum number of concurrent requests. */\n maxConcurrent: 4,\n /** Token bucket capacity. */\n capacity: 100,\n /** Token bucket refill rate per second. */\n refillRate: 10,\n /** Refill interval in milliseconds. */\n refillIntervalMs: 100,\n },\n\n /**\n * Per-tool rate limit defaults for MCP tools.\n * (Source: Issue #274 Phase 2 - per-tool rate limits)\n */\n TOOL_RATE_LIMITS: {\n orchestrate: { capacity: 10, refillRate: 10, refillIntervalMs: 60_000 },\n delegate: { capacity: 20, refillRate: 20, refillIntervalMs: 60_000 },\n workflow: { capacity: 5, refillRate: 5, refillIntervalMs: 60_000 },\n expert: { capacity: 30, refillRate: 30, refillIntervalMs: 60_000 },\n },\n\n /**\n * Default retry strategy settings for transient failures.\n */\n RETRY_DEFAULTS: {\n /** Maximum retry attempts before failing. */\n maxRetries: 3,\n /** Base delay between retries in milliseconds. */\n baseDelayMs: 1_000,\n /** Maximum delay between retries in milliseconds. */\n maxDelayMs: 30_000,\n /** Jitter factor (0-1) to randomize retry delays. */\n jitterFactor: 0.1,\n },\n\n /**\n * Workflow-specific retry defaults.\n */\n WORKFLOW_RETRY_DEFAULTS: {\n /** Maximum retry attempts for workflow steps. */\n maxRetries: 2,\n /** Base delay for workflow retries in milliseconds. */\n baseDelayMs: 2_000,\n /** Maximum delay for workflow retries in milliseconds. */\n maxDelayMs: 60_000,\n /** Jitter factor for workflow retries. */\n jitterFactor: 0.15,\n },\n\n /**\n * CLI-specific retry defaults.\n */\n CLI_RETRY_DEFAULTS: {\n /** Maximum retry attempts for CLI operations. */\n maxRetries: 2,\n /** Base delay for CLI retries in milliseconds. */\n baseDelayMs: 5_000,\n /** Maximum delay for CLI retries in milliseconds. */\n maxDelayMs: 60_000,\n /** Jitter factor for CLI retries. */\n jitterFactor: 0.2,\n },\n\n /**\n * Test framework retry defaults.\n */\n TEST_RETRY_DEFAULTS: {\n /** Maximum retries per test task. */\n maxRetries: 2,\n /** Whether to retry failed tasks by default. */\n retryFailedTasks: true,\n },\n\n /**\n * Default buffer sizing for batching and chunked processing.\n */\n BUFFER_DEFAULTS: {\n /** Preferred batch size for bulk operations. */\n batchSize: 100,\n /** Chunk size for streaming or segmented processing. */\n chunkSize: 256,\n /** Maximum items allowed in a buffer. */\n maxItems: 1_000,\n /** Maximum memory size in bytes (10 MB). */\n maxMemoryBytes: 10 * 1024 * 1024,\n /** Log buffer flush interval in milliseconds. */\n logFlushIntervalMs: 5_000,\n },\n\n /**\n * Default worker pool sizing.\n */\n WORKER_DEFAULTS: {\n /** Maximum number of workers. */\n maxWorkers: 8,\n /** Default worker pool size. */\n poolSize: 4,\n /** Worker idle timeout in milliseconds (5 minutes). */\n idleTimeoutMs: 5 * 60_000,\n /** Maximum parallel workflow steps. */\n workflowMaxParallel: 5,\n /** Test framework parallelism. */\n testParallelism: 3,\n /** Evaluation harness max workers. */\n evaluationMaxWorkers: 8,\n /** EventBus max history size. */\n eventBusMaxHistory: 1_000,\n /** Swarm observer max events. */\n swarmObserverMaxEvents: 10_000,\n },\n\n /**\n * Default circuit breaker settings.\n * (Source: Issue #81 - Circuit breaker for CLI failures)\n */\n CIRCUIT_BREAKER_DEFAULTS: {\n /** Failure threshold to open circuit. */\n failureThreshold: 5,\n /** Reset timeout in milliseconds. */\n resetTimeoutMs: 30_000,\n /** Success threshold to close circuit in half-open state. */\n halfOpenSuccessThreshold: 2,\n /** Whether to count timeouts as failures. */\n countTimeoutsAsFailures: true,\n /** Whether to count auth failures as failures. */\n countAuthFailuresAsFailures: false,\n /** Whether to count rate limit errors as failures (#1529). */\n countRateLimitsAsFailures: true,\n /** Maximum requests allowed in half-open state. */\n halfOpenMaxRequests: 3,\n },\n\n /**\n * Default context/memory settings.\n */\n CONTEXT_DEFAULTS: {\n /** Maximum context tokens. */\n maxTokens: 100_000,\n /** Token budget warning threshold (80%). */\n warningThreshold: 0.8,\n /** Token budget critical threshold (95%). */\n criticalThreshold: 0.95,\n /** Maximum history entries to retain. */\n maxHistoryEntries: 1_000,\n },\n\n /**\n * Default provider/model settings.\n */\n PROVIDER_DEFAULTS: {\n /** Default timeout for provider API calls in ms. */\n timeout: 30_000,\n /** Maximum retries for provider requests. */\n maxRetries: 3,\n /** Default model tier. */\n defaultTier: 'balanced' as const,\n /** Default temperature. */\n temperatureDefault: 0.3,\n /** Minimum temperature. */\n temperatureMin: 0,\n /** Maximum temperature. */\n temperatureMax: 1,\n /** Billing mode: 'plan' (monthly subscription) or 'api' (pay-per-token). Env: NEXUS_BILLING_MODE */\n billingMode: 'plan' as const,\n },\n\n /**\n * Security-related defaults.\n */\n SECURITY_DEFAULTS: {\n /** Maximum system prompt length in characters. */\n maxSystemPromptLength: 4_000,\n /** Default policy execution mode. */\n policyDefaultMode: 'read-only' as const,\n /** Default policy mode. */\n policyMode: 'enforce' as const,\n /** Default sandbox mode. */\n sandboxMode: 'policy' as const,\n /** Whether to fall back to policy mode if container unavailable. */\n sandboxFallbackToPolicy: true,\n /** Whether network is enabled in container mode. */\n sandboxNetworkEnabled: false,\n },\n} as const;\n\n// ============================================================================\n// Type Exports for DEFAULTS\n// ============================================================================\n\n/** Type for the DEFAULTS object (readonly/const). */\nexport type DefaultsConfig = typeof DEFAULTS;\n\n/** Type for timeout defaults (readonly/const). */\nexport type TimeoutDefaultsConst = typeof DEFAULTS.TIMEOUT_DEFAULTS;\n\n/** Type for rate limit defaults (readonly/const). */\nexport type RateLimitDefaultsConst = typeof DEFAULTS.RATE_LIMIT_DEFAULTS;\n\n/** Type for retry defaults (readonly/const). */\nexport type RetryDefaultsConst = typeof DEFAULTS.RETRY_DEFAULTS;\n\n/** Type for buffer defaults (readonly/const). */\nexport type BufferDefaults = typeof DEFAULTS.BUFFER_DEFAULTS;\n\n/** Type for worker defaults (readonly/const). */\nexport type WorkerDefaultsConst = typeof DEFAULTS.WORKER_DEFAULTS;\n\n/** Type for circuit breaker defaults (readonly/const). */\nexport type CircuitBreakerDefaultsConst = typeof DEFAULTS.CIRCUIT_BREAKER_DEFAULTS;\n\n/** Type for context defaults (readonly/const). */\nexport type ContextDefaults = typeof DEFAULTS.CONTEXT_DEFAULTS;\n\n/** Type for provider defaults (readonly/const). */\nexport type ProviderDefaults = typeof DEFAULTS.PROVIDER_DEFAULTS;\n\n/** Type for security defaults (readonly/const). */\nexport type SecurityDefaults = typeof DEFAULTS.SECURITY_DEFAULTS;\n\n// ============================================================================\n// Environment Override Functions (bound to DEFAULTS)\n// ============================================================================\n\n/**\n * Get timeout with environment override support.\n *\n * @param key - Timeout key (e.g., 'cliMs', 'apiMs')\n * @returns Timeout value in milliseconds\n */\nexport const getTimeout = createGetTimeout(DEFAULTS.TIMEOUT_DEFAULTS);\n\n/**\n * Get retry config with environment override support.\n *\n * @returns Retry configuration\n */\nexport const getRetryConfig = createGetRetryConfig(DEFAULTS.RETRY_DEFAULTS);\n\n/**\n * Get rate limit config with environment override support.\n *\n * @returns Rate limit configuration\n */\nexport const getRateLimitConfig = createGetRateLimitConfig(DEFAULTS.RATE_LIMIT_DEFAULTS);\n\n/**\n * Get worker config with environment override support.\n *\n * @returns Worker configuration\n */\nexport const getWorkerConfig = createGetWorkerConfig(DEFAULTS.WORKER_DEFAULTS);\n\n/**\n * Gets the circuit breaker configuration.\n *\n * @returns Circuit breaker configuration\n */\nexport const getCircuitBreakerConfig = createGetCircuitBreakerConfig(\n DEFAULTS.CIRCUIT_BREAKER_DEFAULTS\n);\n\n/**\n * Gets the tool rate limit configuration for a specific tool category.\n *\n * @param tool - Tool category (orchestrate, delegate, workflow, expert)\n * @returns Rate limit configuration\n */\nexport const getToolRateLimit = createGetToolRateLimit(DEFAULTS.TOOL_RATE_LIMITS);\n\n// ============================================================================\n// Documentation Helper\n// ============================================================================\n\n/**\n * Returns documentation for all environment variable overrides.\n *\n * @returns Markdown documentation string\n */\nexport const getEnvVarDocumentation = createGetEnvVarDocumentation(DEFAULTS);\n"],"mappings":";;;;;;;;;;AAwBO,SAAS,YAAY,QAAgB,UAA0B;AACpE,QAAM,WAAW,QAAQ,IAAI,MAAM;AACnC,MAAI,aAAa,QAAW;AAC1B,WAAO;AAAA,EACT;AACA,QAAM,SAAS,SAAS,UAAU,EAAE;AACpC,SAAO,MAAM,MAAM,KAAK,UAAU,IAAI,WAAW;AACnD;AAKO,SAAS,cAAc,QAAgB,UAA0B;AACtE,QAAM,WAAW,QAAQ,IAAI,MAAM;AACnC,MAAI,aAAa,QAAW;AAC1B,WAAO;AAAA,EACT;AACA,QAAM,SAAS,WAAW,QAAQ;AAClC,SAAO,MAAM,MAAM,KAAK,CAAC,SAAS,MAAM,IAAI,WAAW;AACzD;AAOO,SAAS,aAAa,QAAgB,UAA4B;AACvE,QAAM,WAAW,QAAQ,IAAI,MAAM,GAAG,YAAY;AAClD,MAAI,aAAa,QAAW;AAC1B,WAAO;AAAA,EACT;AACA,MAAI,aAAa,UAAU,aAAa,IAAK,QAAO;AACpD,MAAI,aAAa,WAAW,aAAa,IAAK,QAAO;AACrD,SAAO;AACT;AAgFO,SAAS,iBACd,iBAC6C;AAC7C,SAAO,CAAC,QAA4C;AAClD,UAAM,SAAS,iBAAiB,IAAI,QAAQ,OAAO,EAAE,EAAE,YAAY,CA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
ScmError,
|
|
244
244
|
GitHubProvider
|
|
245
245
|
};
|
|
246
|
-
//# sourceMappingURL=chunk-
|
|
246
|
+
//# sourceMappingURL=chunk-K7EA5OV4.js.map
|
|
@@ -2,13 +2,13 @@ import {
|
|
|
2
2
|
CircuitBreakerRegistry,
|
|
3
3
|
CircuitError,
|
|
4
4
|
mapCliErrorToCategory
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-GMOGKX4E.js";
|
|
6
6
|
import {
|
|
7
7
|
createLogger,
|
|
8
8
|
err,
|
|
9
9
|
getTimeProvider,
|
|
10
10
|
ok
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-R2Y57PM3.js";
|
|
12
12
|
|
|
13
13
|
// src/cli-adapters/fallback-chains.ts
|
|
14
14
|
import { z } from "zod";
|
|
@@ -192,4 +192,4 @@ export {
|
|
|
192
192
|
CliCircuitBreakerIntegration,
|
|
193
193
|
createCliCircuitBreakerIntegration
|
|
194
194
|
};
|
|
195
|
-
//# sourceMappingURL=chunk-
|
|
195
|
+
//# sourceMappingURL=chunk-PTGBJFSD.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getErrorMessage
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-R2Y57PM3.js";
|
|
4
4
|
|
|
5
5
|
// src/cli/setup-config.ts
|
|
6
|
-
import { existsSync, writeFileSync } from "fs";
|
|
6
|
+
import { copyFileSync, existsSync, writeFileSync } from "fs";
|
|
7
7
|
import { resolve } from "path";
|
|
8
8
|
var DEFAULT_CONFIG_FILE = "nexus-agents.yaml";
|
|
9
9
|
var SETUP_CONFIG_TEMPLATE = `# Nexus Agents Configuration
|
|
@@ -38,14 +38,12 @@ function runConfigInitSync(projectRoot, force, dryRun) {
|
|
|
38
38
|
message: `Would create: ${outputPath}`
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
+
const backup = ensureBackup(outputPath);
|
|
42
|
+
if ("error" in backup) return backup.error;
|
|
41
43
|
try {
|
|
42
44
|
writeFileSync(outputPath, SETUP_CONFIG_TEMPLATE, "utf-8");
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
path: outputPath,
|
|
46
|
-
created: true,
|
|
47
|
-
message: `Created: ${outputPath}`
|
|
48
|
-
};
|
|
45
|
+
const message = backup.path !== void 0 ? `Created: ${outputPath} (backup saved at ${backup.path})` : `Created: ${outputPath}`;
|
|
46
|
+
return { success: true, path: outputPath, created: true, message };
|
|
49
47
|
} catch (error) {
|
|
50
48
|
return {
|
|
51
49
|
success: false,
|
|
@@ -55,8 +53,25 @@ function runConfigInitSync(projectRoot, force, dryRun) {
|
|
|
55
53
|
};
|
|
56
54
|
}
|
|
57
55
|
}
|
|
56
|
+
function ensureBackup(outputPath) {
|
|
57
|
+
if (!existsSync(outputPath)) return { path: void 0 };
|
|
58
|
+
const backupPath = `${outputPath}.bak.${String(Date.now())}`;
|
|
59
|
+
try {
|
|
60
|
+
copyFileSync(outputPath, backupPath);
|
|
61
|
+
return { path: backupPath };
|
|
62
|
+
} catch (err) {
|
|
63
|
+
return {
|
|
64
|
+
error: {
|
|
65
|
+
success: false,
|
|
66
|
+
path: outputPath,
|
|
67
|
+
created: false,
|
|
68
|
+
message: `Failed to back up existing config: ${getErrorMessage(err)}`
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
58
73
|
|
|
59
74
|
export {
|
|
60
75
|
runConfigInitSync
|
|
61
76
|
};
|
|
62
|
-
//# sourceMappingURL=chunk-
|
|
77
|
+
//# sourceMappingURL=chunk-QGZBCD2A.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/setup-config.ts"],"sourcesContent":["/**\n * Synchronous config file generation for setup command.\n *\n * Reuses the CONFIG_TEMPLATE from config-init.ts pattern but provides\n * a synchronous API suitable for the setup command flow.\n *\n * @module cli/setup-config\n * (Source: Issue #1252 - Setup auto-generates nexus-agents.yaml)\n */\n\nimport { copyFileSync, existsSync, writeFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { getErrorMessage } from '../core/index.js';\n\n/** Default configuration file name. */\nconst DEFAULT_CONFIG_FILE = 'nexus-agents.yaml';\n\n/** Result of the config generation step. */\nexport interface ConfigStepResult {\n readonly success: boolean;\n readonly path: string;\n readonly created: boolean;\n readonly message: string;\n}\n\n/**\n * Minimal YAML config template for setup command.\n * Intentionally brief — just enough to get started.\n * Users can run `nexus-agents config init` for the full template.\n */\nconst SETUP_CONFIG_TEMPLATE = `# Nexus Agents Configuration\n# Generated by: nexus-agents setup\n# Full template: nexus-agents config init\n\nmodels:\n default: claude-sonnet-4\n\nexperts:\n builtin: true\n\nlogging:\n level: info\n format: json\n`;\n\n/**\n * Generates a nexus-agents.yaml config file synchronously.\n *\n * @param projectRoot - Directory to create config in.\n * @param force - Overwrite existing config.\n * @param dryRun - Report what would happen without writing.\n */\nexport function runConfigInitSync(\n projectRoot: string,\n force: boolean,\n dryRun: boolean\n): ConfigStepResult {\n const outputPath = resolve(projectRoot, DEFAULT_CONFIG_FILE);\n\n if (existsSync(outputPath) && !force) {\n return {\n success: true,\n path: outputPath,\n created: false,\n message: 'Config already exists (use --force to overwrite)',\n };\n }\n\n if (dryRun) {\n return {\n success: true,\n path: outputPath,\n created: true,\n message: `Would create: ${outputPath}`,\n };\n }\n\n const backup = ensureBackup(outputPath);\n if ('error' in backup) return backup.error;\n\n try {\n writeFileSync(outputPath, SETUP_CONFIG_TEMPLATE, 'utf-8');\n const message =\n backup.path !== undefined\n ? `Created: ${outputPath} (backup saved at ${backup.path})`\n : `Created: ${outputPath}`;\n return { success: true, path: outputPath, created: true, message };\n } catch (error: unknown) {\n return {\n success: false,\n path: outputPath,\n created: false,\n message: `Failed: ${getErrorMessage(error)}`,\n };\n }\n}\n\n/**\n * Saves a timestamped backup of an existing config file before overwrite (#2183).\n *\n * Returns `{ path }` with the backup path (or undefined if no existing file)\n * on success, or `{ error }` with a populated `ConfigStepResult` on failure.\n * Failure to write the backup aborts the overwrite — better to keep the\n * user's customizations intact than to lose them silently.\n */\nfunction ensureBackup(\n outputPath: string\n): { path: string | undefined } | { error: ConfigStepResult } {\n if (!existsSync(outputPath)) return { path: undefined };\n const backupPath = `${outputPath}.bak.${String(Date.now())}`;\n try {\n copyFileSync(outputPath, backupPath);\n return { path: backupPath };\n } catch (err: unknown) {\n return {\n error: {\n success: false,\n path: outputPath,\n created: false,\n message: `Failed to back up existing config: ${getErrorMessage(err)}`,\n },\n };\n }\n}\n"],"mappings":";;;;;AAUA,SAAS,cAAc,YAAY,qBAAqB;AACxD,SAAS,eAAe;AAIxB,IAAM,sBAAsB;AAe5B,IAAM,wBAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsBvB,SAAS,kBACd,aACA,OACA,QACkB;AAClB,QAAM,aAAa,QAAQ,aAAa,mBAAmB;AAE3D,MAAI,WAAW,UAAU,KAAK,CAAC,OAAO;AACpC,WAAO;AAAA,MACL,SAAS;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA,MACT,SAAS;AAAA,IACX;AAAA,EACF;AAEA,MAAI,QAAQ;AACV,WAAO;AAAA,MACL,SAAS;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA,MACT,SAAS,iBAAiB,UAAU;AAAA,IACtC;AAAA,EACF;AAEA,QAAM,SAAS,aAAa,UAAU;AACtC,MAAI,WAAW,OAAQ,QAAO,OAAO;AAErC,MAAI;AACF,kBAAc,YAAY,uBAAuB,OAAO;AACxD,UAAM,UACJ,OAAO,SAAS,SACZ,YAAY,UAAU,qBAAqB,OAAO,IAAI,MACtD,YAAY,UAAU;AAC5B,WAAO,EAAE,SAAS,MAAM,MAAM,YAAY,SAAS,MAAM,QAAQ;AAAA,EACnE,SAAS,OAAgB;AACvB,WAAO;AAAA,MACL,SAAS;AAAA,MACT,MAAM;AAAA,MACN,SAA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