nexus-agents 11.1.5 → 11.1.6

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.
Files changed (33) hide show
  1. package/dist/{chunk-QOAIAAT5.js → chunk-4NEVM57M.js} +3 -3
  2. package/dist/{chunk-25F2TZ7W.js → chunk-CYK3XSGI.js} +8 -8
  3. package/dist/{chunk-QUKC5T4A.js → chunk-FLKQJTH7.js} +2 -2
  4. package/dist/{chunk-KHRUUX22.js → chunk-GTY64X6Z.js} +2 -2
  5. package/dist/{chunk-4QHAMZLU.js → chunk-KQMDCYC5.js} +1 -1
  6. package/dist/chunk-KQMDCYC5.js.map +1 -0
  7. package/dist/{chunk-XOEDAVAF.js → chunk-L74CB4NZ.js} +1 -1
  8. package/dist/chunk-L74CB4NZ.js.map +1 -0
  9. package/dist/{chunk-NNYNYXMV.js → chunk-R6PNGYLQ.js} +2 -2
  10. package/dist/{chunk-FGR5X76Q.js → chunk-UVJPOUXR.js} +3 -3
  11. package/dist/{cli-server-gateway-K5AS6NL5.js → cli-server-gateway-JILWULNY.js} +2 -2
  12. package/dist/cli.d.ts +1 -0
  13. package/dist/cli.js +574 -689
  14. package/dist/cli.js.map +1 -1
  15. package/dist/{consensus-vote-ZRBGPE2N.js → consensus-vote-2OE2KAY2.js} +4 -4
  16. package/dist/{doctor-live-GTJVAOK7.js → doctor-live-ZRSOQ7TC.js} +2 -2
  17. package/dist/{improvement-review-67WG4TGA.js → improvement-review-5GEJTIDN.js} +4 -4
  18. package/dist/index.js +6 -6
  19. package/dist/{setup-data-dir-3EGE3GS3.js → setup-data-dir-YTD2ZH7I.js} +3 -3
  20. package/package.json +1 -1
  21. package/dist/chunk-4QHAMZLU.js.map +0 -1
  22. package/dist/chunk-XOEDAVAF.js.map +0 -1
  23. /package/dist/{chunk-QOAIAAT5.js.map → chunk-4NEVM57M.js.map} +0 -0
  24. /package/dist/{chunk-25F2TZ7W.js.map → chunk-CYK3XSGI.js.map} +0 -0
  25. /package/dist/{chunk-QUKC5T4A.js.map → chunk-FLKQJTH7.js.map} +0 -0
  26. /package/dist/{chunk-KHRUUX22.js.map → chunk-GTY64X6Z.js.map} +0 -0
  27. /package/dist/{chunk-NNYNYXMV.js.map → chunk-R6PNGYLQ.js.map} +0 -0
  28. /package/dist/{chunk-FGR5X76Q.js.map → chunk-UVJPOUXR.js.map} +0 -0
  29. /package/dist/{cli-server-gateway-K5AS6NL5.js.map → cli-server-gateway-JILWULNY.js.map} +0 -0
  30. /package/dist/{consensus-vote-ZRBGPE2N.js.map → consensus-vote-2OE2KAY2.js.map} +0 -0
  31. /package/dist/{doctor-live-GTJVAOK7.js.map → doctor-live-ZRSOQ7TC.js.map} +0 -0
  32. /package/dist/{improvement-review-67WG4TGA.js.map → improvement-review-5GEJTIDN.js.map} +0 -0
  33. /package/dist/{setup-data-dir-3EGE3GS3.js.map → setup-data-dir-YTD2ZH7I.js.map} +0 -0
@@ -7,7 +7,7 @@ import {
7
7
  VERSION,
8
8
  isNodeVersionSupported,
9
9
  recordServerTransport
10
- } from "./chunk-NNYNYXMV.js";
10
+ } from "./chunk-R6PNGYLQ.js";
11
11
  import {
12
12
  checkGatewayHealth,
13
13
  cliFailsVerdict,
@@ -2263,7 +2263,7 @@ async function runDoctorFix(result) {
2263
2263
  writeLine2("\u2500".repeat(40));
2264
2264
  let fixCount = 0;
2265
2265
  if (!result.dataDirectory.rootExists || result.dataDirectory.subdirectories.some((d) => !d.exists || !d.writable)) {
2266
- const { initDataDirectories: initDataDirectories2, describeDataDirFix: describeDataDirFix2 } = await import("./setup-data-dir-3EGE3GS3.js");
2266
+ const { initDataDirectories: initDataDirectories2, describeDataDirFix: describeDataDirFix2 } = await import("./setup-data-dir-YTD2ZH7I.js");
2267
2267
  const outcome = describeDataDirFix2(initDataDirectories2());
2268
2268
  writeLine2(outcome.line);
2269
2269
  if (outcome.counted) fixCount++;
@@ -2383,4 +2383,4 @@ export {
2383
2383
  startStdioServer,
2384
2384
  closeServer
2385
2385
  };
2386
- //# sourceMappingURL=chunk-QOAIAAT5.js.map
2386
+ //# sourceMappingURL=chunk-4NEVM57M.js.map
@@ -58,7 +58,7 @@ import {
58
58
  updateStage,
59
59
  withFileLock,
60
60
  writeJobCancelled
61
- } from "./chunk-FGR5X76Q.js";
61
+ } from "./chunk-UVJPOUXR.js";
62
62
  import {
63
63
  normalizeTopicToCanonical,
64
64
  synthesizeResearch
@@ -77,7 +77,7 @@ import {
77
77
  } from "./chunk-HQ2SMW4Y.js";
78
78
  import {
79
79
  withPrerequisite
80
- } from "./chunk-QUKC5T4A.js";
80
+ } from "./chunk-FLKQJTH7.js";
81
81
  import {
82
82
  NOOP_NOTIFIER,
83
83
  RateLimiter,
@@ -105,7 +105,7 @@ import {
105
105
  toolSuccess,
106
106
  withProgressHeartbeat,
107
107
  wrapToolWithTimeout
108
- } from "./chunk-KHRUUX22.js";
108
+ } from "./chunk-GTY64X6Z.js";
109
109
  import {
110
110
  generateSecurityPlan
111
111
  } from "./chunk-6ZTMMN2N.js";
@@ -187,7 +187,7 @@ import {
187
187
  import {
188
188
  DEFAULT_TASK_TTL_MS,
189
189
  clampTaskTtl
190
- } from "./chunk-QOAIAAT5.js";
190
+ } from "./chunk-4NEVM57M.js";
191
191
  import {
192
192
  allOf,
193
193
  anyOf
@@ -196,7 +196,7 @@ import {
196
196
  VERSION,
197
197
  createRequestContext,
198
198
  measuredTrustTier
199
- } from "./chunk-NNYNYXMV.js";
199
+ } from "./chunk-R6PNGYLQ.js";
200
200
  import {
201
201
  BWRAP_READ_ONLY_ARGS,
202
202
  CliDetectionCache,
@@ -46669,7 +46669,7 @@ function buildVotingInput(plan, config) {
46669
46669
  }
46670
46670
  async function executeSingleVote(plan, config, log) {
46671
46671
  try {
46672
- const { executeVoting } = await import("./consensus-vote-ZRBGPE2N.js");
46672
+ const { executeVoting } = await import("./consensus-vote-2OE2KAY2.js");
46673
46673
  const input = buildVotingInput(plan, config);
46674
46674
  const result = await executeVoting(input, log);
46675
46675
  return parseVotingResult(result);
@@ -48501,7 +48501,7 @@ function createVoteStage({ config, startStage }) {
48501
48501
  const strategy = config.votingStrategy ?? "higher_order";
48502
48502
  await postProgress(config, "Vote", `Running consensus with ${strategy} strategy...`);
48503
48503
  try {
48504
- const { executeVoting } = await import("./consensus-vote-ZRBGPE2N.js");
48504
+ const { executeVoting } = await import("./consensus-vote-2OE2KAY2.js");
48505
48505
  const proposal = buildVoteProposal(plan, research);
48506
48506
  const votingResult = await executeVoting(
48507
48507
  {
@@ -58485,4 +58485,4 @@ export {
58485
58485
  initializeSandbox,
58486
58486
  getSandboxMode
58487
58487
  };
58488
- //# sourceMappingURL=chunk-25F2TZ7W.js.map
58488
+ //# sourceMappingURL=chunk-CYK3XSGI.js.map
@@ -7,7 +7,7 @@ import {
7
7
  toSdkCallback,
8
8
  toolStructuredError,
9
9
  wrapToolWithTimeout
10
- } from "./chunk-KHRUUX22.js";
10
+ } from "./chunk-GTY64X6Z.js";
11
11
  import {
12
12
  JsonlStore,
13
13
  SECURITY_KEYWORDS,
@@ -2435,4 +2435,4 @@ export {
2435
2435
  runImprovementReview,
2436
2436
  registerImprovementReviewTool
2437
2437
  };
2438
- //# sourceMappingURL=chunk-QUKC5T4A.js.map
2438
+ //# sourceMappingURL=chunk-FLKQJTH7.js.map
@@ -5,7 +5,7 @@ import {
5
5
  getCurrentRequestContext,
6
6
  runWithRequestContext,
7
7
  serverCallerInfo
8
- } from "./chunk-NNYNYXMV.js";
8
+ } from "./chunk-R6PNGYLQ.js";
9
9
  import {
10
10
  DEFAULT_EXECUTION_MODE
11
11
  } from "./chunk-TYLE7Z2S.js";
@@ -2345,4 +2345,4 @@ export {
2345
2345
  DEFAULT_CONSENSUS_CONFIG,
2346
2346
  ConsensusMetricsSchema
2347
2347
  };
2348
- //# sourceMappingURL=chunk-KHRUUX22.js.map
2348
+ //# sourceMappingURL=chunk-GTY64X6Z.js.map
@@ -68,4 +68,4 @@ export {
68
68
  detectionRecoveryHint,
69
69
  detectCliBinary
70
70
  };
71
- //# sourceMappingURL=chunk-4QHAMZLU.js.map
71
+ //# sourceMappingURL=chunk-KQMDCYC5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/cli/setup-cli-detection.ts","../src/cli/cli-detection-error.ts"],"sourcesContent":["/**\n * Shared CLI binary detection helpers (#2155, child of #2151).\n *\n * Consolidates the near-identical detection logic that previously lived in\n * `setup-codex.ts` and `setup-opencode.ts`. Each setup file now delegates\n * to `detectCliBinary(name)` instead of carrying its own copy of the\n * platform-aware locator + version-extraction logic.\n *\n * The per-CLI `ConfigResult` interfaces remain separate because they\n * legitimately differ (Codex writes via MCP, OpenCode writes to a config\n * file with a path).\n *\n * @module cli/setup-cli-detection\n */\n\nimport { execFileSync } from 'node:child_process';\nimport { platform } from 'node:os';\n\nimport { classifyExecError, type DetectionError } from './cli-detection-error.js';\n\n/** Generic CLI detection result. Consumed by every `setup-*.ts` detector. */\nexport interface CliDetectionInfo {\n readonly installed: boolean;\n readonly version: string | undefined;\n /**\n * Classification of why detection failed. Set when `installed` is `false`\n * OR when the binary was located but `--version` failed (#2152).\n */\n readonly detectionError?: DetectionError;\n}\n\n/** Returns the platform-appropriate command for locating an executable. */\nexport function getCliLocatorCommand(): 'where' | 'which' {\n return platform() === 'win32' ? 'where' : 'which';\n}\n\n/**\n * Extracts a semver triple (`X.Y.Z`) from CLI `--version` output.\n *\n * Pure helper — exported for direct unit testing. Returns the matched\n * version string or undefined when no semver-shaped substring is present.\n */\nexport function extractSemver(output: string): string | undefined {\n const match = /(\\d+\\.\\d+\\.\\d+)/.exec(output);\n return match?.[1];\n}\n\n/**\n * Detects whether a CLI binary is installed and reports its version.\n *\n * Two-phase detection:\n * 1. Locate via `which` / `where` — fast PATH check (3s timeout).\n * 2. If located, run `<name> --version` and extract semver (5s timeout).\n *\n * Both phases trap `execFileSync` exceptions and return a `CliDetectionInfo`\n * with a classified `detectionError`. Callers never see exceptions from\n * this function.\n */\nexport function detectCliBinary(name: string): CliDetectionInfo {\n try {\n execFileSync(getCliLocatorCommand(), [name], { timeout: 3000, stdio: 'pipe' });\n } catch (err: unknown) {\n return { installed: false, version: undefined, detectionError: classifyExecError(err) };\n }\n\n try {\n const output = execFileSync(name, ['--version'], {\n timeout: 5000,\n stdio: 'pipe',\n encoding: 'utf-8',\n });\n return { installed: true, version: extractSemver(output) };\n } catch (err: unknown) {\n return { installed: true, version: undefined, detectionError: classifyExecError(err) };\n }\n}\n","/**\n * nexus-agents/cli - CLI detection error classification (#2152)\n *\n * Small helper shared by `setup-codex.ts` and `setup-opencode.ts`\n * (and later `setup-cli-detection.ts` once #2155 consolidates them) so that a\n * `which`/`where` or `<cli> --version` failure is classified instead of\n * silently collapsed into `installed: false`.\n *\n * Before this file, all three setup modules did `catch { return { installed: false } }`,\n * treating `ENOENT` (genuinely not installed), `ETIMEDOUT` (PATH lookup hung),\n * `EACCES` (binary present but not executable), and arbitrary other exec\n * failures identically. That made doctor/verify diagnostics unactionable.\n *\n * @module cli/cli-detection-error\n */\n\n/**\n * Stable classification of why a CLI-detection exec failed.\n *\n * - `not-found`: binary is not on PATH (`ENOENT`). User action: install the CLI.\n * - `timeout`: the exec hung past the configured timeout (`ETIMEDOUT`,\n * `exit code null with signal`). User action: investigate PATH for hung\n * filesystems (NFS mounts, dead autofs entries).\n * - `permission`: binary is present but the current user can't execute it\n * (`EACCES`, `EPERM`). User action: fix mode bits or ownership.\n * - `other`: any other exec failure. User action: re-run with verbose\n * logging or inspect stderr directly.\n */\nexport type DetectionError = 'not-found' | 'timeout' | 'permission' | 'other';\n\n/**\n * Human-readable explanation for each detection-error class. Intended for\n * `doctor`/`verify` output — short enough to fit on one line next to the CLI\n * name.\n */\nexport const DETECTION_ERROR_MESSAGES: Record<DetectionError, string> = {\n 'not-found': 'binary not on PATH',\n timeout: 'detection timed out (hung PATH?)',\n permission: 'binary present but not executable',\n other: 'detection failed — check verbose logs',\n};\n\n/**\n * Formats a user-facing \"not installed\" message that incorporates the\n * detection-error class. Called by setup runners to replace the flat\n * \"<cli> not installed\" message when the underlying cause is more specific.\n *\n * - `not-found` or undefined → \"<cli> not installed\"\n * - other classes → \"<cli> detection failed: <class-message>\"\n */\nexport function formatDetectionMessage(cliName: string, detectionError?: DetectionError): string {\n if (detectionError === undefined || detectionError === 'not-found') {\n return `${cliName} not installed`;\n }\n return `${cliName} detection failed: ${DETECTION_ERROR_MESSAGES[detectionError]}`;\n}\n\n/**\n * Actionable recovery step for each detection-error class (#3213). Each takes\n * the CLI's **binary** name (e.g. `opencode`, not the display name) so the\n * suggested command is runnable verbatim. Intended to be shown alongside the\n * `formatDetectionMessage` line on setup/doctor failures.\n */\nexport const DETECTION_ERROR_SOLUTIONS: Record<DetectionError, (cliBinary: string) => string> = {\n 'not-found': (cli) =>\n `Install ${cli} and make sure it is on your PATH — see docs/getting-started/INSTALLATION.md.`,\n permission: (cli) =>\n `The ${cli} binary is present but not executable. Run: chmod +x \"$(command -v ${cli})\"`,\n timeout: (cli) =>\n `${cli} detection timed out. Check PATH for hung mounts (e.g. NFS); re-run with --verbose to see where detection hangs.`,\n other: (cli) => `Re-run with --verbose for detailed ${cli} detection logs.`,\n};\n\n/**\n * One-line actionable recovery hint for a detection error, with a docs pointer.\n * `cliBinary` is the runnable binary name (e.g. `codex`); defaults the class to\n * `not-found` when unclassified.\n */\nexport function detectionRecoveryHint(cliBinary: string, detectionError?: DetectionError): string {\n const cls: DetectionError = detectionError ?? 'not-found';\n return `${DETECTION_ERROR_SOLUTIONS[cls](cliBinary)} (more: docs/TROUBLESHOOTING.md)`;\n}\n\n/**\n * Classifies a thrown error from `execFileSync('which'|'where', ...)` or\n * `execFileSync(cli, ['--version'])`.\n *\n * Node's `execFileSync` throws with a `code` property on the error object\n * (string like `'ENOENT'`) for most OS-level failures. Timeouts additionally\n * set `signal: 'SIGTERM'` and may have `code: undefined`. We probe both.\n */\nexport function classifyExecError(err: unknown): DetectionError {\n if (typeof err !== 'object' || err === null) return 'other';\n\n // Duck-type rather than instanceof — execFileSync errors aren't always\n // `Error` instances across Node versions and test harnesses.\n const e = err as { code?: unknown; signal?: unknown; killed?: unknown };\n\n if (e.code === 'ENOENT') return 'not-found';\n if (e.code === 'ETIMEDOUT') return 'timeout';\n if (e.killed === true || e.signal === 'SIGTERM' || e.signal === 'SIGKILL') {\n // execFileSync sets `killed: true` + SIGTERM when its own timeout fires.\n return 'timeout';\n }\n if (e.code === 'EACCES' || e.code === 'EPERM') return 'permission';\n\n return 'other';\n}\n"],"mappings":";AAeA,SAAS,oBAAoB;AAC7B,SAAS,gBAAgB;;;ACmBlB,IAAM,2BAA2D;AAAA,EACtE,aAAa;AAAA,EACb,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,OAAO;AACT;AAUO,SAAS,uBAAuB,SAAiB,gBAAyC;AAC/F,MAAI,mBAAmB,UAAa,mBAAmB,aAAa;AAClE,WAAO,GAAG,OAAO;AAAA,EACnB;AACA,SAAO,GAAG,OAAO,sBAAsB,yBAAyB,cAAc,CAAC;AACjF;AAQO,IAAM,4BAAmF;AAAA,EAC9F,aAAa,CAAC,QACZ,WAAW,GAAG;AAAA,EAChB,YAAY,CAAC,QACX,OAAO,GAAG,sEAAsE,GAAG;AAAA,EACrF,SAAS,CAAC,QACR,GAAG,GAAG;AAAA,EACR,OAAO,CAAC,QAAQ,sCAAsC,GAAG;AAC3D;AAOO,SAAS,sBAAsB,WAAmB,gBAAyC;AAChG,QAAM,MAAsB,kBAAkB;AAC9C,SAAO,GAAG,0BAA0B,GAAG,EAAE,SAAS,CAAC;AACrD;AAUO,SAAS,kBAAkB,KAA8B;AAC9D,MAAI,OAAO,QAAQ,YAAY,QAAQ,KAAM,QAAO;AAIpD,QAAM,IAAI;AAEV,MAAI,EAAE,SAAS,SAAU,QAAO;AAChC,MAAI,EAAE,SAAS,YAAa,QAAO;AACnC,MAAI,EAAE,WAAW,QAAQ,EAAE,WAAW,aAAa,EAAE,WAAW,WAAW;AAEzE,WAAO;AAAA,EACT;AACA,MAAI,EAAE,SAAS,YAAY,EAAE,SAAS,QAAS,QAAO;AAEtD,SAAO;AACT;;;AD3EO,SAAS,uBAA0C;AACxD,SAAO,SAAS,MAAM,UAAU,UAAU;AAC5C;AAQO,SAAS,cAAc,QAAoC;AAChE,QAAM,QAAQ,kBAAkB,KAAK,MAAM;AAC3C,SAAO,QAAQ,CAAC;AAClB;AAaO,SAAS,gBAAgB,MAAgC;AAC9D,MAAI;AACF,iBAAa,qBAAqB,GAAG,CAAC,IAAI,GAAG,EAAE,SAAS,KAAM,OAAO,OAAO,CAAC;AAAA,EAC/E,SAAS,KAAc;AACrB,WAAO,EAAE,WAAW,OAAO,SAAS,QAAW,gBAAgB,kBAAkB,GAAG,EAAE;AAAA,EACxF;AAEA,MAAI;AACF,UAAM,SAAS,aAAa,MAAM,CAAC,WAAW,GAAG;AAAA,MAC/C,SAAS;AAAA,MACT,OAAO;AAAA,MACP,UAAU;AAAA,IACZ,CAAC;AACD,WAAO,EAAE,WAAW,MAAM,SAAS,cAAc,MAAM,EAAE;AAAA,EAC3D,SAAS,KAAc;AACrB,WAAO,EAAE,WAAW,MAAM,SAAS,QAAW,gBAAgB,kBAAkB,GAAG,EAAE;AAAA,EACvF;AACF;","names":[]}
@@ -1045,4 +1045,4 @@ export {
1045
1045
  registerGatewayArm,
1046
1046
  wireGateway
1047
1047
  };
1048
- //# sourceMappingURL=chunk-XOEDAVAF.js.map
1048
+ //# sourceMappingURL=chunk-L74CB4NZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/cli-command-catalog.ts","../src/cli-help-text.ts","../src/cli-types.ts","../src/cli-server-gateway.ts"],"sourcesContent":["/**\n * nexus-agents CLI command catalog (Issue #2135).\n *\n * Single source of truth for every top-level command: name, one-line\n * description, and the *audience* that cares about it. `renderHelp`\n * consumes this to produce tiered output:\n *\n * - Default `nexus-agents --help`: essential + advanced, grouped\n * - `nexus-agents --help --all`: everything, grouped\n *\n * Maintainer-audience commands (benchmarks, release tooling, deep\n * observability) are still fully functional — they just don't clutter\n * the default --help. `nexus-agents <cmd> --help` still works for all\n * of them.\n *\n * @module cli-command-catalog\n */\n\n/** Who the command is aimed at. Drives the default --help filter. */\nexport type CommandAudience = 'essential' | 'advanced' | 'maintainer' | 'internal';\n\n/** One entry per top-level command. */\nexport interface CommandCatalogEntry {\n readonly command: string;\n readonly description: string;\n readonly audience: CommandAudience;\n}\n\n/**\n * Hard cap on the `essential` audience band. Enforced by the `keeps the\n * essential tier small (<=12) so new users are not overwhelmed` test in\n * `cli-command-catalog.test.ts`.\n *\n * Rationale: the default `nexus-agents --help` lists every `essential` entry\n * up front. Past 12 it stops feeling curated — new users start scanning,\n * skipping, and missing the actually-onboarding-critical commands. If you\n * need a 13th, demote something else to `advanced` first.\n *\n * History (#2492): the cap has been tripped silently twice — first by `auth`\n * (deliberate, deserved promotion), second by `usage` (#2469, not reviewed\n * against the cap). The CI test catches it; this comment is the contract.\n */\nexport const ESSENTIAL_AUDIENCE_CAP = 12;\n\n/**\n * All top-level commands, in display order within their audience band.\n *\n * Audience rationale:\n * - **essential**: what a new user needs to install, configure, verify, and\n * run their first task. Capped at 12 entries (`ESSENTIAL_AUDIENCE_CAP`) —\n * see the cap's docstring for the policy. When proposing a 13th, demote\n * an existing entry to `advanced` first.\n * - **advanced**: useful day-to-day but not first-touch (session mgmt,\n * capability inspection, workflow scaffolding, auth token rotation).\n * Telemetry/operator-facing dashboards (e.g. `usage`,\n * `improvement-review`) belong here — operators reach for them after\n * they've been running tasks, not on first install.\n * - **maintainer**: benchmarks, release tooling, self-audits, deep\n * observability dashboards, dogfooding helpers.\n * - **internal**: dev/eval loops that aren't part of the product surface\n * (e2e-eval, routing-ab, memory-benchmark). Hidden from both default\n * `--help` AND `--help --all`. Still present for entrypoint extraction\n * (repo-index / entrypoints.yaml) because they're real CLI commands.\n */\nexport const COMMAND_CATALOG: readonly CommandCatalogEntry[] = [\n // ── Essential ────────────────────────────────────────────────────────────\n {\n command: '(default)',\n description: 'Start MCP server with stdio transport',\n audience: 'essential',\n },\n {\n command: 'hello',\n description: 'Show welcome message and quick start (no API keys needed)',\n audience: 'essential',\n },\n {\n command: 'setup',\n description: 'Configure CLI integration (MCP + .rules + data dirs)',\n audience: 'essential',\n },\n {\n command: 'verify',\n description: 'Check install health (sqlite, adapters, config)',\n audience: 'essential',\n },\n {\n command: 'doctor',\n description: 'Detailed health check; no model completions by default; --live probes models',\n audience: 'essential',\n },\n {\n command: 'config',\n description: 'Manage configuration (init, get, set, list, export, import)',\n audience: 'essential',\n },\n {\n command: 'orchestrate',\n description: 'Execute a task via CLI tools (standalone mode)',\n audience: 'essential',\n },\n {\n command: 'vote',\n // Default panel is 7 roles; `--quick` runs 3 (getVoterRoles in\n // mcp/tools/consensus-vote.ts). Prior drift: \"5-6 agents\" here, \"6 agents\"\n // in HELP_TEXT, \"6 agents by default\" in COMMAND_HELP — all wrong (#3209).\n description: 'Run consensus vote on a proposal (7 agents; --quick uses 3)',\n audience: 'essential',\n },\n {\n command: 'workflow',\n description: 'Manage and run workflow templates (list, run)',\n audience: 'essential',\n },\n {\n command: 'expert',\n description: 'Manage expert agents (list, create, execute)',\n audience: 'essential',\n },\n {\n command: 'research',\n description: 'Manage research registry (status, add, stats, refresh)',\n audience: 'essential',\n },\n\n // ── Advanced ─────────────────────────────────────────────────────────────\n {\n command: 'tour',\n description:\n 'Guided walkthrough of the four headline tools — no API keys, no quota (#2851). --non-interactive runs straight through.',\n audience: 'advanced',\n },\n {\n command: 'session',\n description: 'Manage session persistence (list, show, export, delete)',\n audience: 'advanced',\n },\n {\n command: 'auth',\n description:\n 'Manage authentication: init/show/rotate MCP tokens; status shows per-CLI auth state',\n audience: 'essential',\n },\n {\n command: 'login',\n description: '[deprecated alias] Soft alias of \"auth status\"; renamed in #2449',\n audience: 'maintainer',\n },\n {\n command: 'usage',\n description:\n 'Cost / usage / quality dashboard from per-call telemetry (#2469). --format=json for scripting.',\n audience: 'advanced',\n },\n {\n command: 'status',\n description: 'At-a-glance project health dashboard',\n audience: 'advanced',\n },\n {\n command: 'capabilities',\n description: 'Show model capabilities matrix',\n audience: 'advanced',\n },\n {\n command: 'mode',\n description: 'Inspect detected mode (server/orchestrator) + signals + reasoning (#3214)',\n audience: 'advanced',\n },\n {\n command: 'jobs',\n description:\n 'Async job-record maintenance (#6224): `prune` deletes terminal records past the 7-day retention window and marks abandoned pending records failed; --dry-run prints the counts only.',\n audience: 'advanced',\n },\n {\n command: 'registry',\n description: 'Inspect + refresh the dynamic model registry (doctor / refresh)',\n audience: 'advanced',\n },\n {\n command: 'migrate',\n description:\n 'Relocate homedir state (sessions, checkpoints, traces, runs, audit, pipeline, tasks) into <repo>/.nexus-agents/ for users adopting NEXUS_REPO_PREFERRED=1. Cross-repo state stays homedir. --dry-run for a no-op plan. Epic #2872.',\n audience: 'advanced',\n },\n {\n command: 'init',\n description:\n 'Initialize portable nexus-agents config in a repo. Flags: --portable (#2305/#2308/#2311), --install / --uninstall (#2311), --gitignore, --mcp-config, --opencode <path> (#2504), --force, --dry-run.',\n audience: 'advanced',\n },\n {\n command: 'review',\n description: 'Review a GitHub PR (dogfooding helper)',\n audience: 'advanced',\n },\n {\n command: 'scaffold',\n description: 'Generate project files from templates',\n audience: 'advanced',\n },\n {\n command: 'validate',\n description: 'Run unified validation (doctor + fitness + config)',\n audience: 'advanced',\n },\n {\n command: 'index',\n description: 'Generate and manage codebase index',\n audience: 'advanced',\n },\n {\n command: 'improvement-review',\n description:\n 'Observability-driven improvement loop (#2402). Surfaces threshold breaches; --file-issues opt-in.',\n audience: 'advanced',\n },\n {\n command: 'model-drift',\n description:\n 'Report models the registry does not know and registry models no source lists (#6625). --json; --file-issue opt-in.',\n audience: 'maintainer',\n },\n {\n command: 'auto-remediate',\n description:\n 'Run one auto-remediation cycle (#3540). OFF unless NEXUS_AUTO_REMEDIATE=audit|enforce; never auto-merges.',\n audience: 'maintainer',\n },\n {\n command: 'remediation-review',\n description:\n 'Review audit-mode selections: list · panel-judge --batch N [--quick] · sample --n 10 [--seed S] · mark --evaluator --sound|--unsound [--sample id] · sign-off --owner · readiness (human, panel and owner-sample judgments + soak-store alarm).',\n audience: 'maintainer',\n },\n\n // ── Maintainer (hidden by default) ───────────────────────────────────────\n {\n command: 'demo',\n description: 'API-free exploration mode (marketing/demo flow)',\n audience: 'maintainer',\n },\n {\n command: 'hooks',\n description: 'Claude CLI hook integration commands',\n audience: 'maintainer',\n },\n {\n command: 'routing-audit',\n description: 'Debug model routing decisions',\n audience: 'maintainer',\n },\n {\n command: 'fitness-audit',\n description: 'Run CLI orchestration fitness score audit',\n audience: 'maintainer',\n },\n {\n command: 'system-review',\n description: 'Automated system review (5-phase checklist)',\n audience: 'maintainer',\n },\n {\n command: 'sprint',\n description: 'Automated sprint planning from open issues',\n audience: 'maintainer',\n },\n {\n command: 'evaluate',\n description: 'Self-evaluation of codebase components',\n audience: 'maintainer',\n },\n {\n command: 'issue',\n description: 'Issue template validation and management',\n audience: 'maintainer',\n },\n {\n command: 'validation',\n description: 'Learning validation dashboard',\n audience: 'maintainer',\n },\n {\n command: 'learning-metrics',\n description: 'Aggregated learning metrics dashboard',\n audience: 'maintainer',\n },\n {\n command: 'visualize',\n description: 'Generate Mermaid diagrams and ASCII dashboards',\n audience: 'maintainer',\n },\n {\n command: 'health',\n description: 'Swarm health metrics dashboard',\n audience: 'maintainer',\n },\n {\n command: 'release-notes',\n description: 'Generate release notes from git commits',\n audience: 'maintainer',\n },\n {\n command: 'release-validate',\n description: 'Run expert swarm validation for releases',\n audience: 'maintainer',\n },\n {\n command: 'release-announce',\n description: 'Generate release announcements (blog, social)',\n audience: 'maintainer',\n },\n\n // ── Internal (hidden everywhere; here for extractor/index completeness) ──\n {\n command: 'server',\n // Synonym for the no-arg invocation — `nexus-agents` and\n // `nexus-agents server` both run `handleServerCommand`. Listed here for\n // extractor completeness; humans see `(default)` in --help.\n description: 'Start MCP server with stdio transport (explicit form)',\n audience: 'internal',\n },\n {\n command: 'e2e-eval',\n description: 'E2E evaluation scenario runner (dev loop)',\n audience: 'internal',\n },\n {\n command: 'memory-benchmark',\n description: 'Memory-system benchmark runner (dev loop)',\n audience: 'internal',\n },\n {\n command: 'memory-eval',\n description: 'Comparative memory evaluation benchmark (dev loop)',\n audience: 'internal',\n },\n {\n command: 'routing-ab',\n description: 'A/B comparison of routing strategies (dev loop)',\n audience: 'internal',\n },\n {\n command: 'scenario',\n description: 'Execute a named scenario from the testing framework',\n audience: 'internal',\n },\n {\n command: 'warm-up',\n description: 'Warm the model/adapter caches before a run',\n audience: 'internal',\n },\n];\n\n/**\n * Returns the catalog filtered for `--help` output.\n *\n * - `showAll: false` → essential + advanced (the default `--help` surface)\n * - `showAll: true` → essential + advanced + maintainer (`--help --all`)\n *\n * `internal` audience entries are **always excluded** from human-facing\n * output. They're still reachable via `COMMAND_CATALOG` for extractors that\n * need a complete inventory (repo-index, entrypoints.yaml).\n */\nexport function filterCatalog(showAll: boolean): readonly CommandCatalogEntry[] {\n const visible = COMMAND_CATALOG.filter((e) => e.audience !== 'internal');\n if (showAll) return visible;\n return visible.filter((e) => e.audience !== 'maintainer');\n}\n\n/**\n * Returns every real top-level command, including internal ones, but\n * excluding the `(default)` placeholder (no actual handler). Used by\n * entrypoint extractors and the repo-index generator — #2156.\n */\nexport function catalogForExtractors(): readonly CommandCatalogEntry[] {\n return COMMAND_CATALOG.filter((e) => e.command !== '(default)');\n}\n\n/**\n * Looks up the canonical one-line description for a command from the catalog\n * (the single source of truth — #3209). Returns `undefined` if the command is\n * not cataloged.\n *\n * Used by `cli-command-help.ts` so per-command help (`formatCommandHelp`,\n * `formatAllCommandsHelp`) does not keep a third independent copy of the\n * one-line summary. The richer per-command help (flags, examples) still lives\n * in `COMMAND_HELP`; only the one-liner is single-sourced here.\n */\nexport function getCommandDescription(command: string): string | undefined {\n return COMMAND_CATALOG.find((e) => e.command === command)?.description;\n}\n\n/** Groups entries by audience, preserving catalog order within each group. */\nexport function groupByAudience(\n entries: readonly CommandCatalogEntry[]\n): ReadonlyMap<CommandAudience, readonly CommandCatalogEntry[]> {\n const groups = new Map<CommandAudience, CommandCatalogEntry[]>();\n for (const entry of entries) {\n const existing = groups.get(entry.audience) ?? [];\n existing.push(entry);\n groups.set(entry.audience, existing);\n }\n return groups;\n}\n\nconst AUDIENCE_HEADINGS: Record<CommandAudience, string> = {\n essential: 'Essential — install, configure, run',\n advanced: 'Advanced — day-to-day extras',\n maintainer: 'Maintainer — benchmarks, releases, deep diagnostics',\n // Never rendered (filterCatalog strips internal before renderCommandsSection\n // iterates), but required by the Record<CommandAudience, string> contract.\n internal: 'Internal — dev/eval loops (hidden from --help)',\n};\n\n/**\n * Renders the COMMANDS section of `--help`, grouped and tiered.\n *\n * Output shape (indent-sensitive — consumed verbatim inside `COMMANDS:` block):\n *\n * ```\n * Essential — install, configure, run\n * hello Show welcome message...\n * setup Configure CLI integration...\n *\n * Advanced — day-to-day extras\n * ...\n * ```\n *\n * Trailing hint line (\"Run with --all…\") is appended only when `showAll=false`.\n */\nexport function renderCommandsSection(showAll: boolean): string {\n const filtered = filterCatalog(showAll);\n const groups = groupByAudience(filtered);\n const lines: string[] = [];\n const order: CommandAudience[] = showAll\n ? ['essential', 'advanced', 'maintainer']\n : ['essential', 'advanced'];\n for (const audience of order) {\n const entries = groups.get(audience);\n if (entries === undefined || entries.length === 0) continue;\n lines.push(` ${AUDIENCE_HEADINGS[audience]}`);\n for (const entry of entries) {\n lines.push(` ${entry.command.padEnd(16)} ${entry.description}`);\n }\n lines.push('');\n }\n if (!showAll) {\n lines.push(' Run with --all to show maintainer commands (benchmarks, release tooling).');\n }\n return lines.join('\\n').replace(/\\n+$/, '');\n}\n","/**\n * nexus-agents CLI Help Text\n *\n * Help documentation for the CLI commands and options.\n * Extracted from cli-types.ts to maintain file size limits.\n *\n * The COMMANDS list is NO LONGER hardcoded here (#3209). It is generated from\n * `COMMAND_CATALOG` in `cli-command-catalog.ts` — the single source of truth\n * for each command's one-line description — via `renderCommandsSection`. The\n * non-command sections (USAGE, OPTIONS, EXAMPLES) stay static in\n * `HELP_TEXT_FRAME`. `HELP_TEXT` is that frame with the full (`--all`)\n * catalog-derived COMMANDS block stitched in; `renderHelp({ all: false })`\n * stitches in the audience-filtered block instead.\n *\n * Do not reshape the top-level sections (USAGE / COMMANDS / OPTIONS /\n * EXAMPLES): `indexer/entrypoint-extractor.ts` loads this module by AST and\n * the catalog/help snapshot tests assert their presence. (Command names +\n * descriptions for the entrypoint index come from the catalog via\n * `catalogForExtractors()`, not from parsing this text — #2156.)\n *\n * @module cli-help-text\n */\n\nimport { renderCommandsSection } from './cli-command-catalog.js';\n\n/**\n * Placeholder token inside {@link HELP_TEXT_FRAME} that the renderers replace\n * with the catalog-derived COMMANDS block. Distinct from any real help content\n * so the single substitution is unambiguous.\n */\nconst COMMANDS_PLACEHOLDER = '__COMMANDS__';\n\n/**\n * Static help frame: everything except the COMMANDS list, which is a single\n * {@link COMMANDS_PLACEHOLDER} token filled at render time from the catalog.\n */\nconst HELP_TEXT_FRAME = `\nnexus-agents - Intelligent orchestration platform for AI coding tools\n\nUSAGE:\n nexus-agents [OPTIONS]\n nexus-agents [COMMAND] [SUBCOMMAND] [OPTIONS]\n\nCOMMANDS:\n${COMMANDS_PLACEHOLDER}\n\nOPTIONS:\n -h, --help Show this help message\n -v, --version Show version information\n --verbose Enable verbose output\n --interactive Start interactive REPL mode\n -m, --mode <mode> Server mode: server, orchestrator (default: server)\n - server: MCP server only (for Claude CLI integration)\n - orchestrator: CLI orchestrator (calls Gemini/Codex CLIs)\n\nFor command-specific options, run: nexus-agents <command> --help\n(For example: nexus-agents vote --help)\n\nEXAMPLES:\n nexus-agents hello Show welcome + quick start (no API keys needed)\n nexus-agents setup --interactive Run guided setup wizard\n nexus-agents verify Quick install check (run first)\n nexus-agents auth status Per-CLI auth state + login fix instructions\n nexus-agents doctor Detailed CLI/adapter health check\n nexus-agents orchestrate -t \"...\" Run a one-off task via the CLI orchestrator\n nexus-agents vote --quick -p \"X\" 3-agent consensus vote on proposal \"X\"\n nexus-agents --help --all Show every command (incl. maintainer tools)\n\nFor more information, visit: https://github.com/nexus-substrate/nexus-agents\n`.trim();\n\n/** Fills the COMMANDS placeholder in the frame with a catalog-derived block. */\nfunction composeHelp(commandsSection: string): string {\n return HELP_TEXT_FRAME.replace(COMMANDS_PLACEHOLDER, commandsSection);\n}\n\n/**\n * Full (`--all`) help text, with the COMMANDS list generated from\n * `COMMAND_CATALOG` (single source of truth — #3209). Equivalent to\n * `renderHelp({ all: true })`; exported for callers/tests that want the\n * canonical full view as a value.\n */\nexport const HELP_TEXT = composeHelp(renderCommandsSection(true));\n\n/**\n * Renders the top-level help output.\n *\n * @param opts.all - If true, returns the full view (includes maintainer\n * commands like benchmarks and release tooling). If false, returns a tiered\n * view that hides maintainer commands — surfaced via `--all` hint at the\n * bottom of the COMMANDS block. Both views derive the command list (and its\n * one-line descriptions) from `COMMAND_CATALOG`.\n */\nexport function renderHelp(opts: { all: boolean }): string {\n if (opts.all) return HELP_TEXT;\n return composeHelp(renderCommandsSection(false));\n}\n","/* eslint-disable max-lines -- canonical CLI types + parseArgs config, intentionally centralized */\n/**\n * nexus-agents CLI Types\n *\n * Type definitions and constants for the CLI.\n *\n * @module cli-types\n */\n\nimport type { ServerMode } from './cli/index.js';\nimport type {\n ErrorPolicy,\n VoteThreshold,\n VotingStrategy,\n} from './mcp/tools/consensus-vote-types.js';\nimport type { NoQuorumPolicy } from './cli/vote-types.js';\nimport type { VoteRecordPrBinding } from './audit/vote-record.js';\nimport type { CommandResult } from './core/command-result.js';\nimport { VOTE_TIMEOUTS } from './config/timeouts.js';\n\n// Re-export help text from extracted module for backward compatibility\nexport { HELP_TEXT } from './cli-help-text.js';\n\n/**\n * Exit codes for the CLI.\n */\nexport const EXIT_CODES = {\n SUCCESS: 0,\n SERVER_START_FAILED: 1,\n SHUTDOWN_ERROR: 2,\n INVALID_ARGS: 3,\n /** Subcommand is stubbed / advertised but not implemented (#2727). */\n NOT_IMPLEMENTED: 4,\n} as const;\n\n/**\n * A {@link CommandResult} that also carries the process exit code the\n * dispatcher should terminate with (#3210).\n *\n * Handlers RETURN this instead of calling `process.exit` inline, and the\n * single `process.exit` lives at the dispatcher boundary (see `exitWith`).\n * This makes exit behavior unit-testable (assert the returned `exitCode`)\n * without mocking `process.exit`, and centralizes the one process-killing\n * call so its policy is consistent across commands.\n */\nexport interface CliExitResult extends CommandResult {\n /** The exit code the CLI process should terminate with. */\n readonly exitCode: number;\n}\n\n/**\n * Builds a {@link CliExitResult} from a raw exit code, deriving `success`\n * from the conventional `0 == success` mapping. Optional human-readable\n * `message` is preserved for callers/tests.\n */\nexport function cliExit(exitCode: number, message?: string): CliExitResult {\n return message === undefined\n ? { success: exitCode === EXIT_CODES.SUCCESS, exitCode }\n : { success: exitCode === EXIT_CODES.SUCCESS, exitCode, message };\n}\n\n/**\n * Maps a handler's `0|non-0` status to the canonical success/failure exit\n * codes (`SUCCESS` / `SERVER_START_FAILED`) used by the bulk of CLI\n * commands, then wraps it in a {@link CliExitResult}. Centralizes the\n * `exitCode === 0 ? SUCCESS : SERVER_START_FAILED` ternary that was\n * duplicated across every handler.\n */\nexport function cliExitFromStatus(status: number, message?: string): CliExitResult {\n return cliExit(\n status === EXIT_CODES.SUCCESS ? EXIT_CODES.SUCCESS : EXIT_CODES.SERVER_START_FAILED,\n message\n );\n}\n\n/**\n * Explicit sentinel a handler RETURNS to signal \"I own my own process\n * lifecycle — do NOT force an exit at the dispatcher\" (#3942).\n *\n * Before #3942 this was conveyed by returning `undefined`/`void`, which\n * conflated *intentional* delegation (the MCP stdio server runs until its\n * transport closes, then exits itself) with an *accidentally dropped*\n * return on an error path. A missing return was not a compile error, so\n * `exitWith` would silently no-op and a non-zero exit code would be lost.\n *\n * By typing every handler as {@link CliHandlerResult} (a union that\n * excludes `undefined`/`void`), a handler that falls off the end without\n * returning is a TS2366 compile error (\"Function lacks ending return\n * statement…\"). Lifecycle-owning handlers RETURN this sentinel explicitly,\n * making delegation a deliberate, checked choice.\n *\n * Implemented as a branded const so it is a single unique value (not just\n * any object), and `exitWith` can match it by identity.\n */\nexport const LIFECYCLE_DELEGATED = {\n __lifecycleDelegated: true,\n} as const;\n\n/**\n * The type of {@link LIFECYCLE_DELEGATED}. A handler whose return type\n * includes this signals lifecycle delegation; see the sentinel docs.\n */\nexport type LifecycleDelegated = typeof LIFECYCLE_DELEGATED;\n\n/**\n * The exhaustive return contract for every CLI command handler dispatched\n * from `cli-commands.ts` (#3942). A handler EITHER returns a\n * {@link CliExitResult} (the dispatcher exits with its `exitCode`) OR the\n * {@link LIFECYCLE_DELEGATED} sentinel (the dispatcher does nothing because\n * the handler owns the process lifecycle). There is deliberately NO\n * `undefined`/`void` member: that is what makes a dropped return a compile\n * error rather than a silently-swallowed exit code.\n */\nexport type CliHandlerResult = CliExitResult | LifecycleDelegated;\n\n/**\n * Type guard distinguishing the {@link LIFECYCLE_DELEGATED} sentinel from a\n * {@link CliExitResult}. Used by `exitWith` to handle the handler-result\n * union exhaustively without a `void` fallthrough.\n *\n * Discriminates on the brand property rather than reference identity so the\n * guard is robust across module-boundary/test-mock copies of the sentinel\n * while remaining unambiguous (a `CliExitResult` never carries this brand).\n */\nexport function isLifecycleDelegated(result: CliHandlerResult): result is LifecycleDelegated {\n return (\n (result as Partial<LifecycleDelegated>).__lifecycleDelegated === true && !('exitCode' in result)\n );\n}\n\n/**\n * CLI command types that can be executed.\n */\nexport type CliCommand =\n | 'server'\n | 'help'\n | 'version'\n | 'hello'\n | 'config'\n | 'expert'\n | 'workflow'\n | 'doctor'\n | 'verify'\n | 'review'\n | 'routing-audit'\n | 'orchestrate'\n | 'system-review'\n | 'vote'\n | 'index'\n | 'research'\n | 'validation'\n | 'learning-metrics'\n | 'setup'\n | 'hooks'\n | 'demo'\n | 'sprint'\n | 'session'\n | 'evaluate'\n | 'issue'\n | 'fitness-audit'\n | 'release-notes'\n | 'release-validate'\n | 'release-announce'\n | 'scaffold'\n | 'visualize'\n | 'capabilities'\n | 'status'\n | 'memory-benchmark'\n | 'auth'\n | 'scenario'\n | 'warm-up'\n | 'e2e-eval'\n | 'routing-ab'\n | 'memory-eval'\n | 'health'\n | 'init'\n | 'validate'\n | 'registry'\n | 'login'\n | 'usage'\n | 'migrate'\n | 'tour'\n | 'improvement-review'\n | 'model-drift'\n | 'auto-remediate'\n | 'remediation-review'\n | 'mode'\n | 'jobs';\n\n/**\n * Parsed CLI arguments and command.\n */\nexport interface ParsedCliArgs {\n command: CliCommand;\n subcommand?: string;\n options: {\n help: boolean;\n version: boolean;\n verbose: boolean;\n interactive: boolean;\n // Tiered --help output (Issue #2135)\n all: boolean;\n mode: ServerMode;\n output?: string;\n force: boolean;\n format: string;\n input?: string;\n dryRun: boolean;\n banditStats: boolean;\n // Review command options\n setup: boolean;\n skipChecks: boolean;\n // Orchestrate command options (also used in orchestrator mode)\n task?: string;\n model?: string;\n maxTokens?: number;\n maxCostUsd?: number;\n engine?: 'router' | 'puppeteer';\n learn?: boolean;\n policyPath?: string;\n maxSteps?: number;\n // System review command options\n createIssue: boolean;\n fix: boolean;\n // Vote command options\n proposal?: string;\n /** File inlined into every voter proposal (--artifact-file). */\n artifactFile?: string;\n /** Legacy spelling of the bar; `strategy` wins when both are given (#6227). */\n threshold?: VoteThreshold;\n /** #6227 — `--strategy`, the tool's own enum, passed to the engine as the MCP tool passes it. */\n strategy?: VotingStrategy;\n /** #6227 — `--ratifies-pr <n>@<sha>`, already parsed into the record's binding shape. */\n ratifiesPr?: VoteRecordPrBinding;\n quick: boolean;\n timeoutMs?: number;\n /** #2630 — see `applyErrorPolicy`. */\n errorPolicy?: ErrorPolicy;\n /** #4135 — how the vote command maps a `no_quorum` decision. Default `fail`. */\n onNoQuorum?: NoQuorumPolicy;\n /** #4472 / #4941 — repeatable `--option`, the named alternatives to tally. */\n options?: string[];\n /** #6110 — `--project`, the project the panel judges (replaces `nexus-agents` in the prompts). */\n project?: string;\n // Learning-metrics and validation command options\n period?: string;\n export?: string;\n noTrends?: boolean;\n // Setup command options (Issue #363, #416, #1252, #1253, #1259, #1263)\n nonInteractive: boolean;\n skipMcp: boolean;\n skipRules: boolean;\n skipHooks: boolean;\n skipConfig: boolean;\n skipOpencode: boolean;\n /** Deprecated no-op, still parsed so existing invocations do not fail: the Gemini MCP step was removed (#4389). */\n skipGemini: boolean;\n skipCodex: boolean;\n scope?: 'user' | 'project';\n // Setup --custom-api for OpenAI-compatible gateway configuration (#2124)\n customApi?: string;\n customApiKey?: string;\n customModel?: string;\n // Demo command options\n mock: boolean;\n // Doctor command options (Issue #1031)\n deep: boolean;\n /**\n * Run the `serves` readiness level: a real completion per adapter (#4376).\n *\n * Opt-in because it spends generation quota. The default run proves\n * `installed` and `authenticated` only, and reports `serves` as\n * not-attempted rather than assuming it.\n */\n live: boolean;\n /** `doctor --gateway` (#6609): print the measured gateway section. */\n gateway: boolean;\n /** `doctor --probe` (#6609): one completion per gateway family; spends tokens. */\n probe: boolean;\n // Registry command options (#2179)\n json?: boolean;\n source?: string;\n /** model-drift `--file-issue` (#6625): open one issue per new model with `gh`. */\n fileIssue?: boolean;\n // init --portable command options (#2305)\n portable?: boolean;\n gitignore?: boolean;\n // init --portable --mcp-config flag (#2308)\n mcpConfig?: boolean;\n // init --portable --install / --uninstall flags (#2311)\n install?: boolean;\n uninstall?: boolean;\n // init --opencode <path> flag (#2504)\n opencode?: string;\n validate?: boolean;\n // remediation-review command options (#3765)\n evaluator?: string;\n owner?: string;\n note?: string;\n sound?: boolean;\n unsound?: boolean;\n batch?: string;\n n?: string;\n seed?: string;\n sample?: string;\n // improvement-review command options (#2444, #6636)\n 'file-issues'?: boolean;\n fileIssues?: boolean;\n 'lookback-days'?: string;\n lookbackDays?: string;\n 'min-sample-size'?: string;\n minSampleSize?: string;\n 'fitness-floor'?: string;\n fitnessFloor?: string;\n // session command options (#6693)\n limit?: string;\n markdown?: boolean;\n // usage command options (#6693)\n since?: string;\n until?: string;\n // validation command options (#6693)\n 'task-type'?: string;\n taskType?: string;\n 'min-sample'?: string;\n minSample?: string;\n // Subcommand flags the parser still rejected after #6705 (#6693 follow-up).\n /** `sprint --vote`, `research review|prioritize --vote`. */\n vote?: boolean;\n /** `research discover|review|prioritize|autofile --topic=<t>`. */\n topic?: string;\n /** `research status --status=<s>`. */\n status?: string;\n /** `research review --create-issues`. */\n createIssues?: boolean;\n /** `research autofile --max=<n>`. */\n max?: number;\n /** `research index --generate | --check`. */\n generate?: boolean;\n check?: boolean;\n /** `research index --validate --strict`, `release-validate --strict`. */\n strict?: boolean;\n /** `research index --silent`. */\n silent?: boolean;\n /** `research index --no-check-files`. */\n noCheckFiles?: boolean;\n /** `release-validate --skip <validator>` (repeatable). */\n skip?: string[];\n };\n positionals: string[];\n}\n\n/**\n * parseArgs configuration for the CLI.\n * (Source: Node.js 22.x util.parseArgs documentation)\n */\nexport const PARSE_ARGS_CONFIG = {\n options: {\n help: {\n type: 'boolean' as const,\n short: 'h',\n default: false,\n },\n version: {\n type: 'boolean' as const,\n short: 'v',\n default: false,\n },\n verbose: {\n type: 'boolean' as const,\n default: false,\n },\n interactive: {\n type: 'boolean' as const,\n default: false,\n },\n // Tiered --help output (Issue #2135): `--help --all` unhides maintainer commands\n all: {\n type: 'boolean' as const,\n default: false,\n },\n mode: {\n type: 'string' as const,\n short: 'm',\n default: 'server',\n },\n output: {\n type: 'string' as const,\n short: 'o',\n },\n force: {\n type: 'boolean' as const,\n short: 'f',\n default: false,\n },\n format: {\n type: 'string' as const,\n default: 'table',\n },\n input: {\n type: 'string' as const,\n short: 'i',\n },\n 'dry-run': {\n type: 'boolean' as const,\n default: false,\n },\n 'bandit-stats': {\n type: 'boolean' as const,\n default: false,\n },\n // Review command options\n setup: {\n type: 'boolean' as const,\n default: false,\n },\n 'skip-checks': {\n type: 'boolean' as const,\n default: false,\n },\n // Orchestrate command options (also used in orchestrator mode)\n task: {\n type: 'string' as const,\n short: 't',\n },\n model: {\n type: 'string' as const,\n },\n 'max-tokens': {\n type: 'string' as const,\n },\n 'max-cost-usd': {\n type: 'string' as const,\n },\n // Orchestrate engine options (Issue #386)\n engine: {\n type: 'string' as const,\n default: 'router',\n },\n learn: {\n type: 'boolean' as const,\n default: false,\n },\n 'policy-path': {\n type: 'string' as const,\n },\n 'max-steps': {\n type: 'string' as const,\n },\n // System review command options\n 'create-issue': {\n type: 'boolean' as const,\n default: false,\n },\n fix: {\n type: 'boolean' as const,\n default: false,\n },\n // Vote command options\n proposal: {\n type: 'string' as const,\n short: 'p',\n },\n // Repeatable. No short letter: every free one is taken, and the two\n // collisions that already existed silently bound the wrong option (#4922).\n option: {\n type: 'string' as const,\n multiple: true as const,\n },\n // No `short`. `parseArgs` takes one options object for every command, so\n // a short letter is global: `-t` was already `task`, which won, and\n // `vote -t supermajority` silently ran a simple-majority vote. Long form\n // only — `cli-types.test.ts` pins that no two options share a letter.\n threshold: {\n type: 'string' as const,\n },\n // #6227 — the bar as the tool spells it. `threshold` is the legacy spelling;\n // the engine's `resolveStrategy` lets `strategy` win when both are given.\n strategy: {\n type: 'string' as const,\n },\n 'artifact-file': {\n type: 'string' as const,\n },\n // #6227 — `<pr>@<40-hex sha>`: binds the record to a governor-path PR for\n // `scripts/append-ratification-record.ts`. Validated in `buildVoteOptions`.\n 'ratifies-pr': {\n type: 'string' as const,\n },\n quick: {\n type: 'boolean' as const,\n short: 'q',\n default: false,\n },\n // #6236 — seconds, read from the same constant `vote --help` renders and\n // `runVote` falls back to. A hard-coded '90' here ran every seat at less\n // than a third of the #1640 budget while the help said 300.\n timeout: {\n type: 'string' as const,\n default: String(VOTE_TIMEOUTS.defaultMs / 1000),\n },\n // #2630 — error policy for the vote command.\n 'error-policy': {\n type: 'string' as const,\n },\n // #4135 — how the vote command maps a no_quorum decision (fail|exit2|retry).\n 'on-no-quorum': {\n type: 'string' as const,\n },\n // #6110 — the project the voter prompts name; derived from the cwd when absent.\n project: {\n type: 'string' as const,\n },\n // Learning-metrics command options\n // No `short` — `-p` is `proposal`, which was declared first and won. See\n // the note on `threshold`.\n period: {\n type: 'string' as const,\n },\n export: {\n type: 'string' as const,\n },\n 'no-trends': {\n type: 'boolean' as const,\n default: false,\n },\n // Setup command options (Issue #363)\n 'non-interactive': {\n type: 'boolean' as const,\n default: false,\n },\n 'skip-mcp': {\n type: 'boolean' as const,\n default: false,\n },\n 'skip-rules': {\n type: 'boolean' as const,\n default: false,\n },\n 'skip-hooks': {\n type: 'boolean' as const,\n default: false,\n },\n 'skip-config': {\n type: 'boolean' as const,\n default: false,\n },\n 'skip-opencode': {\n type: 'boolean' as const,\n default: false,\n },\n 'skip-gemini': {\n type: 'boolean' as const,\n default: false,\n },\n 'skip-codex': {\n type: 'boolean' as const,\n default: false,\n },\n scope: {\n type: 'string' as const,\n default: 'user',\n },\n // Setup --custom-api for OpenAI-compatible gateway configuration (#2124)\n 'custom-api': {\n type: 'string' as const,\n },\n 'custom-api-key': {\n type: 'string' as const,\n },\n 'custom-model': {\n type: 'string' as const,\n },\n // Demo command options\n mock: {\n type: 'boolean' as const,\n default: false,\n },\n // Doctor command options (Issue #1031)\n deep: {\n type: 'boolean' as const,\n default: false,\n },\n // Doctor live readiness probe (#4376)\n live: {\n type: 'boolean' as const,\n default: false,\n },\n // Doctor gateway section and opt-in completion probe (#6609)\n gateway: {\n type: 'boolean' as const,\n default: false,\n },\n probe: {\n type: 'boolean' as const,\n default: false,\n },\n // Registry command options (#2179)\n json: {\n type: 'boolean' as const,\n default: false,\n },\n // model-drift command option (#6625)\n 'file-issue': {\n type: 'boolean' as const,\n default: false,\n },\n source: {\n type: 'string' as const,\n },\n // init --portable command options (#2305)\n portable: {\n type: 'boolean' as const,\n default: false,\n },\n gitignore: {\n type: 'boolean' as const,\n default: false,\n },\n // init --portable --mcp-config flag (#2308)\n 'mcp-config': {\n type: 'boolean' as const,\n default: false,\n },\n // init --portable --install / --uninstall flags (#2311)\n install: {\n type: 'boolean' as const,\n default: false,\n },\n uninstall: {\n type: 'boolean' as const,\n default: false,\n },\n // improvement-review command options (#2444)\n 'lookback-days': {\n type: 'string' as const,\n },\n 'file-issues': {\n type: 'boolean' as const,\n default: false,\n },\n 'min-sample-size': {\n type: 'string' as const,\n },\n 'fitness-floor': {\n type: 'string' as const,\n },\n // init --opencode <path> flag (#2504)\n opencode: {\n type: 'string' as const,\n },\n validate: {\n type: 'boolean' as const,\n default: false,\n },\n // remediation-review command options (#3765)\n evaluator: {\n type: 'string' as const,\n },\n owner: {\n type: 'string' as const,\n },\n note: {\n type: 'string' as const,\n },\n sound: {\n type: 'boolean' as const,\n default: false,\n },\n unsound: {\n type: 'boolean' as const,\n default: false,\n },\n batch: { type: 'string' as const },\n n: { type: 'string' as const },\n seed: { type: 'string' as const },\n sample: { type: 'string' as const },\n // session command options (#6693)\n limit: {\n type: 'string' as const,\n },\n markdown: {\n type: 'boolean' as const,\n default: false,\n },\n // usage command options (#6693)\n since: {\n type: 'string' as const,\n },\n until: {\n type: 'string' as const,\n },\n // validation command options (#6693)\n 'task-type': {\n type: 'string' as const,\n },\n 'min-sample': {\n type: 'string' as const,\n },\n // #6693 follow-up — subcommand flags that usage text advertised and\n // handlers read, still rejected after #6705. Forwarded by\n // `buildSubcommandFlagOptions` (cli/subcommand-flag-options.ts). No short\n // letters: a short letter is global (see the note on `threshold`).\n vote: { type: 'boolean' as const, default: false },\n topic: { type: 'string' as const },\n status: { type: 'string' as const },\n 'create-issues': { type: 'boolean' as const, default: false },\n max: { type: 'string' as const },\n generate: { type: 'boolean' as const, default: false },\n check: { type: 'boolean' as const, default: false },\n strict: { type: 'boolean' as const, default: false },\n silent: { type: 'boolean' as const, default: false },\n 'no-check-files': { type: 'boolean' as const, default: false },\n skip: { type: 'string' as const, multiple: true as const },\n },\n allowPositionals: true,\n strict: true,\n} as const;\n\n/**\n * Every command name {@link isValidCommand} accepts. Exported so the parity\n * gate (`command-parity.test.ts`, #3212) can assert it stays consistent with\n * the real dispatch tables and `COMMAND_CATALOG`, rather than trusting the\n * `isValidCommand` predicate alone.\n */\nexport const VALID_COMMANDS: readonly CliCommand[] = [\n 'server',\n 'help',\n 'version',\n 'hello',\n 'config',\n 'expert',\n 'workflow',\n 'doctor',\n 'verify',\n 'review',\n 'routing-audit',\n 'orchestrate',\n 'system-review',\n 'vote',\n 'index',\n 'research',\n 'validation',\n 'learning-metrics',\n 'setup',\n 'hooks',\n 'demo',\n 'sprint',\n 'session',\n 'evaluate',\n 'issue',\n 'fitness-audit',\n 'release-notes',\n 'release-validate',\n 'release-announce',\n 'scaffold',\n 'visualize',\n 'capabilities',\n 'status',\n 'memory-benchmark',\n 'auth',\n 'scenario',\n 'warm-up',\n 'e2e-eval',\n 'routing-ab',\n 'memory-eval',\n 'health',\n 'init',\n 'validate',\n 'registry',\n 'login',\n 'usage',\n 'improvement-review',\n 'model-drift',\n 'migrate',\n 'tour',\n 'auto-remediate',\n 'remediation-review',\n 'mode',\n 'jobs',\n];\n\n/**\n * Checks if a string is a valid CLI command.\n */\nexport function isValidCommand(value: string): value is CliCommand {\n return (VALID_COMMANDS as readonly string[]).includes(value);\n}\n","/**\n * Gateway adapter bootstrap (#2502, child 2 of epic #2500).\n *\n * The OpenAI-compatible gateway adapter (`adapters/openai-compat-adapter.ts`,\n * #2468) was implemented but never wired into the runtime. This module\n * closes that loop: at MCP-server startup, when `NEXUS_OPENAI_COMPAT_URL`\n * + `NEXUS_OPENAI_COMPAT_KEY` are set, we discover the gateway's models\n * and produce a single `IModelAdapter` that orchestrator/expert tools can\n * use directly. In sandbox mode (#2501), we fail-fast on misconfiguration\n * because there's no human at a CLI prompt to recover.\n *\n * @module cli-server-gateway\n */\n\nimport type { ILogger, IModelAdapter } from './core/index.js';\nimport {\n readOpenAICompatEndpoint,\n readOpenAICompatEnv,\n buildOpenAICompatAdapters,\n} from './adapters/openai-compat-adapter.js';\nimport { createGatewayArmAdapter } from './adapters/gateway-arm-adapter.js';\nimport { discoverGatewayOnce } from './adapters/gateway-discovery.js';\nimport {\n GatewayHostRefusedError,\n type GatewayHostRefused,\n} from './adapters/gateway-host-status.js';\nimport { GatewayRediscovery, setGatewayRediscovery } from './adapters/gateway-rediscovery.js';\nimport { setGatewayCatalog } from './adapters/sdk/gateway-catalog.js';\nimport {\n logGatewaySlotMapping,\n resolveGatewayDefault,\n setGatewaySlotCatalog,\n} from './adapters/gateway-family-slots.js';\nimport { gatewayEndpointRejection } from './adapters/sdk/gateway-cost.js';\nimport { hostnameOf } from './adapters/sdk/gateway-env.js';\nimport type { IResilientAdapter } from './adapters/resilient-adapter-types.js';\nimport { getDefaultCliCircuitBreakerRegistry } from './cli-adapters/cli-circuit-breaker.js';\nimport { isEndpointArmId, type EndpointArmId } from './cli-adapters/types-core.js';\nimport { detectSandbox } from './config/sandbox-detection.js';\nimport { getGlobalRegistry } from './adapters/unified-registry.js';\nimport { parseBoolEnv } from './config/defaults-env.js';\nimport { EXIT_CODES } from './cli-types.js';\n\n/**\n * Wire ALL discovered gateway adapters — one per model the gateway serves\n * (#4040), so the voter path can round-robin roles across distinct models\n * (per-role diversity, all in-process).\n *\n * Behavioural matrix:\n *\n * | Sandbox | Env vars | Probe | Outcome |\n * | :------ | :------- | :------ | :--------------------------------------- |\n * | active | unset | n/a | exit(SERVER_START_FAILED) |\n * | active | set | fails | exit(SERVER_START_FAILED) with HTTP info |\n * | active | set | succeed | log + return every discovered adapter |\n * | inactive| unset | n/a | return undefined (CLI flow handles it) |\n * | inactive| set | fails | log warning + return undefined |\n * | inactive| set | succeed | log + return every discovered adapter |\n *\n * A gateway listing 0 models is treated as a failed probe. Which adapter a\n * tool uses by default is {@link resolveDefaultModelAdapter}'s decision, not\n * list order.\n */\nexport async function tryWireGatewayAdapters(\n logger: ILogger\n): Promise<readonly IModelAdapter[] | undefined> {\n return (await wireGatewayOnce(logger)).adapters;\n}\n\n/** One wiring attempt's adapters, and whether a later attempt could succeed. */\ninterface WiringOutcome {\n readonly adapters: readonly IModelAdapter[] | undefined;\n readonly retryable: boolean;\n}\n\n/**\n * One wiring attempt. `retryable` is true when a gateway is configured but\n * the probe failed for a reason that can clear on its own — unreachable,\n * error status, zero models — and false when retrying cannot help: not\n * configured, or refused by the private-address guard (allowing it is an env\n * change, which needs a restart). Lazy re-discovery (#6608) arms only on\n * `retryable`.\n */\nasync function wireGatewayOnce(logger: ILogger): Promise<WiringOutcome> {\n const sandboxActive = detectSandbox().active;\n const env = readOpenAICompatEnv();\n if (env === null) {\n handleMissingEnv(logger, sandboxActive);\n noticeCliSubprocessFallback(logger);\n return { adapters: undefined, retryable: false };\n }\n\n // The process's one probe (#4392): a lazy discovery that ran first is\n // reused, never repeated, and a later lazy call reuses this one.\n const result = await discoverGatewayOnce(logger);\n if (result === null) {\n // env-was-set guard; build contract allows it\n noticeCliSubprocessFallback(logger);\n return { adapters: undefined, retryable: false };\n }\n if (!result.ok && result.error instanceof GatewayHostRefusedError) {\n handleHostRefused(logger, sandboxActive, result.error.status);\n noticeCliSubprocessFallback(logger);\n return { adapters: undefined, retryable: false };\n }\n if (!result.ok) {\n handleProbeFailure(logger, sandboxActive, result.error.message);\n noticeCliSubprocessFallback(logger);\n return { adapters: undefined, retryable: true };\n }\n if (result.value.length === 0) {\n handleZeroModels(logger, sandboxActive);\n noticeCliSubprocessFallback(logger);\n return { adapters: undefined, retryable: true };\n }\n\n // Log the discovered model IDs at info level — operators want to confirm\n // the gateway's catalog matches what they configured upstream. The API\n // key never reaches logs (env-only read), and neither does the full base\n // URL — it can carry userinfo — only its host (#4392 increment 3).\n logger.info('OpenAI-compatible gateway wired', {\n host: hostnameOf(env.baseUrl),\n modelCount: result.value.length,\n models: result.value.map((a) => a.modelId),\n });\n return { adapters: result.value, retryable: false };\n}\n\n/**\n * One-time operator notice (#4255): whenever no in-process gateway ends up\n * wired — env unset, probe failed, or the gateway listed 0 models — voter\n * and consensus calls fall through to the CLI-subprocess round-robin path\n * (`voter-agents.ts` `getAvailableClis`). That path is slower (~90s wall\n * time observed) and depends on each CLI's own auth/quota, but nothing told\n * the operator a faster in-process option exists (#4040). Logged once per\n * process via {@link cliSubprocessFallbackNoticeLogged} so a busy startup\n * (or repeated calls in tests) can't spam it.\n */\nlet cliSubprocessFallbackNoticeLogged = false;\n\nfunction noticeCliSubprocessFallback(logger: ILogger): void {\n if (cliSubprocessFallbackNoticeLogged) return;\n cliSubprocessFallbackNoticeLogged = true;\n logger.info(\n 'No in-process gateway is configured, so voter/consensus calls will spawn CLI ' +\n \"subprocesses (slower per-vote startup, subject to each CLI's own auth/quota). \" +\n 'Set NEXUS_OPENAI_COMPAT_URL and NEXUS_OPENAI_COMPAT_KEY to route voters through ' +\n 'an OpenAI-compatible gateway in-process instead (lower latency, no subprocess spawn).'\n );\n}\n\n/** Test-only: reset the one-time notice guard so repeated tests can re-trigger it. */\nexport function _resetCliSubprocessFallbackNotice(): void {\n cliSubprocessFallbackNoticeLogged = false;\n}\n\n/**\n * The default model adapter. With a gateway configured (#2502/#4040) it is the\n * catalogue's ranked default, `resolveGatewayDefault` (#6651) — the same rule\n * the registry's unpinned default uses, so the two cannot name different\n * models, and listing order (arbitrary, #6606) does not decide it. When that\n * rule resolves nothing (no catalogue registered, or no chat model in it) the\n * primary gateway model is kept, as before. With no gateway it is the\n * CLI-registry default. The registry is typed structurally so this stays free\n * of the adapter-registry import.\n */\nexport function resolveDefaultModelAdapter(\n gatewayAdapters: readonly IModelAdapter[] | undefined,\n adapterRegistry: { getDefault(): IModelAdapter }\n): IModelAdapter {\n const primary = gatewayAdapters?.[0];\n if (primary === undefined) return adapterRegistry.getDefault();\n const ranked = resolveGatewayDefault();\n return ranked.kind === 'resolved' ? ranked.adapter : primary;\n}\n\n/**\n * Register the discovered gateway models as ONE `api:<endpoint>` arm in the\n * adapter registry (#4392 increment 2, step 2), in EVERY billing mode — the\n * arm is what the shared breaker, the `NEXUS_GATEWAY_COST` declaration and\n * (once #6291 widens the routing ids) routing key on. `registerApiArm` warns\n * when the arm's cost is undeclared. The per-model adapters keep flowing to\n * the voter tools unchanged; this adds the arm beside them.\n *\n * Returns the arm id, or `undefined` when nothing was registered: no gateway\n * (`adapters` undefined or empty — the named empty case, logged at debug), or\n * an `endpoint` that is not a valid endpoint id (the env schema already\n * reported it; a garbage arm id is never minted from it).\n */\nexport function registerGatewayArm(\n adapters: readonly IModelAdapter[] | undefined,\n endpoint: string,\n registry: {\n registerApiArm(arm: EndpointArmId, adapter: IResilientAdapter): void;\n getLogger(): ILogger;\n }\n): EndpointArmId | undefined {\n const logger = registry.getLogger();\n if (adapters === undefined || adapters.length === 0) {\n logger.debug('No gateway adapters discovered; no api: arm registered');\n return undefined;\n }\n const armId = `api:${endpoint}`;\n const rejection = gatewayEndpointRejection(endpoint);\n if (rejection !== undefined || !isEndpointArmId(armId)) {\n // Not echoed: the likely mistake is a pasted URL, which can carry a key.\n logger.warn('Gateway endpoint is not a valid gateway endpoint; no api: arm registered', {\n reason: rejection ?? 'not a valid endpoint id',\n });\n return undefined;\n }\n registry.registerApiArm(\n armId,\n createGatewayArmAdapter(armId, adapters, {\n circuitBreakerRegistry: getDefaultCliCircuitBreakerRegistry(),\n logger,\n })\n );\n // Publish only after registration succeeds. The new wrapper already retains\n // the catalogue, so replacing an earlier wrapper cannot erase its metadata.\n setGatewayCatalog(\n armId,\n adapters.map((a) => a.modelId)\n );\n logger.info('Gateway registered as one api: arm', { arm: armId, modelCount: adapters.length });\n return armId;\n}\n\n/**\n * The bootstrap entry (#4392 inc 2 step 2): discover the gateway\n * ({@link tryWireGatewayAdapters}), register its `api:<endpoint>` arm\n * ({@link registerGatewayArm}) under the operator's endpoint id, register the\n * family-slot catalogue (#6604), and hand the per-model adapters back for the\n * tools. One call, so `cli-server.ts` cannot\n * wire the adapters without the arm.\n */\nexport async function wireGateway(\n logger: ILogger,\n registry: Parameters<typeof registerGatewayArm>[2] = getGlobalRegistry()\n): Promise<readonly IModelAdapter[] | undefined> {\n const { adapters, retryable } = await wireGatewayOnce(logger);\n const endpoint = readOpenAICompatEndpoint(process.env, logger);\n const registerArms = (found: readonly IModelAdapter[] | undefined): void => {\n registerGatewayArm(found, endpoint, registry);\n // The server's private registry retains its historical 30-minute default.\n // Router arms live in the global registry, whose CLI timeouts stay per-complexity.\n // Independent wrappers share the endpoint breaker and are disposed by their owners.\n if (parseBoolEnv('NEXUS_ROUTE_GATEWAY_ARMS', false)) {\n const global = getGlobalRegistry();\n if (global !== registry) registerGatewayArm(found, endpoint, global);\n }\n };\n registerArms(adapters);\n registerFamilySlots(adapters, logger);\n if (!retryable) return adapters;\n // #6608: a gateway that was down at boot is retried lazily. The tools get\n // an empty live list (every reader treats empty as \"no gateway\"); the first\n // gateway-needing call after the backoff fills it in place and registers\n // the arm. Every registry adapter triggers it (#6659, see\n // gateway-rediscovery.ts), and the boot-time default re-detects onto the\n // gateway once it is found.\n const live: IModelAdapter[] = [];\n setGatewayRediscovery(\n new GatewayRediscovery({\n target: live,\n logger,\n discover: () => rediscoverGateway(logger),\n onDiscovered: (found) => {\n registerArms(found);\n registerFamilySlots(found, logger);\n },\n })\n );\n return live;\n}\n\n/**\n * #6604: the family-slot catalogue — each vendor CLI slot without an\n * available CLI resolves to a gateway model of its own family. None\n * registered (no gateway, or discovery failed) means no gateway.\n */\nfunction registerFamilySlots(\n adapters: readonly IModelAdapter[] | undefined,\n logger: ILogger\n): void {\n setGatewaySlotCatalog(adapters ?? []);\n logGatewaySlotMapping(logger);\n}\n\n/**\n * One lazy re-discovery attempt: the adapters; `undefined` (logged) when it\n * failed in a way that can clear; `'refused'` when the private-address guard\n * refused the host (#6659), logged with the same remedy as at boot and never\n * retried, since allowing it is an env change that needs a restart.\n */\nasync function rediscoverGateway(\n logger: ILogger\n): Promise<readonly IModelAdapter[] | 'refused' | undefined> {\n const result = await buildOpenAICompatAdapters(logger);\n if (result === null) return undefined;\n if (!result.ok && result.error instanceof GatewayHostRefusedError) {\n // Re-discovery is armed only outside sandbox mode (a failed boot probe\n // there exits), so this never takes the sandbox exit branch.\n handleHostRefused(logger, false, result.error.status);\n return 'refused';\n }\n if (!result.ok) {\n logger.warn('Gateway re-discovery failed; calls stay on CLI subprocesses', {\n error: result.error.message,\n });\n return undefined;\n }\n return result.value;\n}\n\nfunction handleMissingEnv(logger: ILogger, sandboxActive: boolean): void {\n if (sandboxActive) {\n logger.error(\n 'Sandbox mode active but NEXUS_OPENAI_COMPAT_URL / NEXUS_OPENAI_COMPAT_KEY are not set. ' +\n 'Configure the gateway in your launch env or opencode.json. ' +\n 'See docs/guides/SANDBOXED-USAGE.md.',\n new Error('Missing gateway configuration in sandbox mode')\n );\n process.exit(EXIT_CODES.SERVER_START_FAILED);\n }\n return undefined;\n}\n\nfunction handleProbeFailure(logger: ILogger, sandboxActive: boolean, reason: string): void {\n if (sandboxActive) {\n logger.error(\n 'Sandbox mode active and OpenAI-compatible gateway probe failed.',\n new Error(reason)\n );\n process.exit(EXIT_CODES.SERVER_START_FAILED);\n }\n logger.warn('OpenAI-compatible gateway probe failed; continuing with CLI adapters', {\n error: reason,\n });\n return undefined;\n}\n\n/**\n * The private-address guard refused the gateway host (#6608). The message\n * names the variable that allows it and says the gateway is not in use —\n * before this, the operator saw a generic probe-failure line.\n */\nfunction handleHostRefused(\n logger: ILogger,\n sandboxActive: boolean,\n status: GatewayHostRefused\n): void {\n const message =\n `Gateway host ${status.host} refused by the private-address guard: the in-process ` +\n 'gateway is NOT in use, and voter/consensus calls fall back to CLI subprocesses. ' +\n status.remedy;\n if (sandboxActive) {\n logger.error(message, new Error(status.reason));\n process.exit(EXIT_CODES.SERVER_START_FAILED);\n }\n logger.warn(message, { host: status.host, reason: status.reason });\n}\n\nfunction handleZeroModels(logger: ILogger, sandboxActive: boolean): void {\n if (sandboxActive) {\n logger.error(\n 'Sandbox mode active and gateway returned 0 models. Check upstream provider quotas / list filters.',\n new Error('Gateway discovered 0 models')\n );\n process.exit(EXIT_CODES.SERVER_START_FAILED);\n }\n logger.warn('OpenAI-compatible gateway returned 0 models; ignoring');\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,MAAM,+CAA+C;AAAA,IAC3D;AACA,YAAQ,KAAK,WAAW,mBAAmB;AAAA,EAC7C;AACA,SAAO;AACT;AAEA,SAAS,mBAAmB,QAAiB,eAAwB,QAAsB;AACzF,MAAI,eAAe;AACjB,WAAO;AAAA,MACL;AAAA,MACA,IAAI,MAAM,MAAM;AAAA,IAClB;AACA,YAAQ,KAAK,WAAW,mBAAmB;AAAA,EAC7C;AACA,SAAO,KAAK,wEAAwE;AAAA,IAClF,OAAO;AAAA,EACT,CAAC;AACD,SAAO;AACT;AAOA,SAAS,kBACP,QACA,eACA,QACM;AACN,QAAM,UACJ,gBAAgB,OAAO,IAAI,2IAE3B,OAAO;AACT,MAAI,eAAe;AACjB,WAAO,MAAM,SAAS,IAAI,MAAM,OAAO,MAAM,CAAC;AAC9C,YAAQ,KAAK,WAAW,mBAAmB;AAAA,EAC7C;AACA,SAAO,KAAK,SAAS,EAAE,MAAM,OAAO,MAAM,QAAQ,OAAO,OAAO,CAAC;AACnE;AAEA,SAAS,iBAAiB,QAAiB,eAA8B;AACvE,MAAI,eAAe;AACjB,WAAO;AAAA,MACL;AAAA,MACA,IAAI,MAAM,6BAA6B;AAAA,IACzC;AACA,YAAQ,KAAK,WAAW,mBAAmB;AAAA,EAC7C;AACA,SAAO,KAAK,uDAAuD;AACnE,SAAO;AACT;","names":[]}
@@ -4,7 +4,7 @@ import {
4
4
 
5
5
  // src/version.ts
6
6
  import semver from "semver";
7
- var VERSION = true ? "11.1.5" : "dev";
7
+ var VERSION = true ? "11.1.6" : "dev";
8
8
  var NODE_ENGINE_RANGE = ">=24";
9
9
  function isNodeVersionSupported(version) {
10
10
  return semver.satisfies(version, NODE_ENGINE_RANGE);
@@ -106,4 +106,4 @@ export {
106
106
  contextForLogging,
107
107
  measuredTrustTier
108
108
  };
109
- //# sourceMappingURL=chunk-NNYNYXMV.js.map
109
+ //# sourceMappingURL=chunk-R6PNGYLQ.js.map
@@ -21,7 +21,7 @@ import {
21
21
  toolSuccess,
22
22
  withProgressHeartbeat,
23
23
  wrapToolWithTimeout
24
- } from "./chunk-KHRUUX22.js";
24
+ } from "./chunk-GTY64X6Z.js";
25
25
  import {
26
26
  getToolMemory
27
27
  } from "./chunk-TE4HHEXW.js";
@@ -30,7 +30,7 @@ import {
30
30
  } from "./chunk-EZNIYU5T.js";
31
31
  import {
32
32
  VERSION
33
- } from "./chunk-NNYNYXMV.js";
33
+ } from "./chunk-R6PNGYLQ.js";
34
34
  import {
35
35
  ModelBoundAdapter,
36
36
  UNVERIFIABLE_STDERR_RE,
@@ -9915,4 +9915,4 @@ export {
9915
9915
  CONSENSUS_VOTE_TOOL_SCHEMA,
9916
9916
  registerConsensusVoteTool
9917
9917
  };
9918
- //# sourceMappingURL=chunk-FGR5X76Q.js.map
9918
+ //# sourceMappingURL=chunk-UVJPOUXR.js.map
@@ -4,7 +4,7 @@ import {
4
4
  resolveDefaultModelAdapter,
5
5
  tryWireGatewayAdapters,
6
6
  wireGateway
7
- } from "./chunk-XOEDAVAF.js";
7
+ } from "./chunk-L74CB4NZ.js";
8
8
  import "./chunk-HT5UAK7E.js";
9
9
  import "./chunk-SBXLWHYC.js";
10
10
  import "./chunk-QZUG667L.js";
@@ -37,4 +37,4 @@ export {
37
37
  tryWireGatewayAdapters,
38
38
  wireGateway
39
39
  };
40
- //# sourceMappingURL=cli-server-gateway-K5AS6NL5.js.map
40
+ //# sourceMappingURL=cli-server-gateway-JILWULNY.js.map
package/dist/cli.d.ts CHANGED
@@ -101,6 +101,7 @@ interface ParsedCliArgs {
101
101
  skipHooks: boolean;
102
102
  skipConfig: boolean;
103
103
  skipOpencode: boolean;
104
+ /** Deprecated no-op, still parsed so existing invocations do not fail: the Gemini MCP step was removed (#4389). */
104
105
  skipGemini: boolean;
105
106
  skipCodex: boolean;
106
107
  scope?: 'user' | 'project';