nexus-agents 2.71.0 → 2.72.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.
Files changed (125) hide show
  1. package/dist/{adaptive-memory-MKSYEBST.js → adaptive-memory-UPE76IP6.js} +5 -5
  2. package/dist/{chunk-DWLATKBK.js → child-mcp-config-5HRJGLCR.js} +6 -4
  3. package/dist/child-mcp-config-5HRJGLCR.js.map +1 -0
  4. package/dist/{chunk-7LHQBMBM.js → chunk-2JMUX5UA.js} +25 -12
  5. package/dist/{chunk-7LHQBMBM.js.map → chunk-2JMUX5UA.js.map} +1 -1
  6. package/dist/{chunk-ZPPX2K57.js → chunk-2KB63QGE.js} +2 -2
  7. package/dist/{chunk-L2LQ3TSV.js → chunk-2MD5MWCK.js} +2 -2
  8. package/dist/{chunk-ANC3HU6F.js → chunk-345KMHWH.js} +6 -6
  9. package/dist/chunk-345KMHWH.js.map +1 -0
  10. package/dist/{chunk-NER7H3RJ.js → chunk-3FIDMWFC.js} +2 -2
  11. package/dist/{chunk-AGVLFRN7.js → chunk-3HR6UJ2E.js} +2269 -7188
  12. package/dist/chunk-3HR6UJ2E.js.map +1 -0
  13. package/dist/{chunk-POQQ7A5E.js → chunk-53K3KEKT.js} +51 -707
  14. package/dist/chunk-53K3KEKT.js.map +1 -0
  15. package/dist/chunk-5MHIWRKB.js +691 -0
  16. package/dist/chunk-5MHIWRKB.js.map +1 -0
  17. package/dist/{chunk-VGZJIR22.js → chunk-5WQ3SRSE.js} +2 -2
  18. package/dist/{chunk-TOYPY5XA.js → chunk-A35XORXU.js} +73 -10
  19. package/dist/chunk-A35XORXU.js.map +1 -0
  20. package/dist/chunk-BVETPIOQ.js +556 -0
  21. package/dist/chunk-BVETPIOQ.js.map +1 -0
  22. package/dist/{chunk-OF7CYMMA.js → chunk-DA5UDQYW.js} +2 -2
  23. package/dist/{chunk-XATH462F.js → chunk-ES6GFP35.js} +186 -34
  24. package/dist/chunk-ES6GFP35.js.map +1 -0
  25. package/dist/chunk-GOT7OAL5.js +59 -0
  26. package/dist/chunk-GOT7OAL5.js.map +1 -0
  27. package/dist/{chunk-LJT65EA7.js → chunk-I7ORMAO7.js} +2 -2
  28. package/dist/{chunk-LMRKHQG5.js → chunk-L6N2S3UB.js} +2 -2
  29. package/dist/{chunk-7OBFO4GF.js → chunk-O4KUCF5S.js} +125 -40
  30. package/dist/chunk-O4KUCF5S.js.map +1 -0
  31. package/dist/chunk-P5OFZWDW.js +303 -0
  32. package/dist/chunk-P5OFZWDW.js.map +1 -0
  33. package/dist/{chunk-MJHOSM5U.js → chunk-QECRZ3YA.js} +2 -2
  34. package/dist/{chunk-WYSHXPKK.js → chunk-QL4HCYRD.js} +4 -44
  35. package/dist/chunk-QL4HCYRD.js.map +1 -0
  36. package/dist/{chunk-E66KFRSJ.js → chunk-TF3GROMO.js} +2 -2
  37. package/dist/{chunk-U3HZQTUF.js → chunk-TQFRPFMG.js} +2 -2
  38. package/dist/{chunk-KJCSRP34.js → chunk-V7ATY4BG.js} +3 -3
  39. package/dist/{chunk-32RIOULO.js → chunk-VPC3YNFR.js} +2 -2
  40. package/dist/{chunk-3BKVYSY6.js → chunk-VTVKC4FS.js} +4 -4
  41. package/dist/{chunk-U6BK5DQU.js → chunk-XHVDKY3X.js} +315 -31
  42. package/dist/chunk-XHVDKY3X.js.map +1 -0
  43. package/dist/cli-circuit-breaker-GFF2RLBZ.js +14 -0
  44. package/dist/cli.d.ts +3 -1
  45. package/dist/cli.js +1038 -1581
  46. package/dist/cli.js.map +1 -1
  47. package/dist/{composite-router-AYVJPIOS.js → composite-router-33F3F74I.js} +4 -4
  48. package/dist/{consensus-vote-EXWACBMR.js → consensus-vote-5V4KVHBE.js} +12 -11
  49. package/dist/doctor-deep-AHDTNURD.js +13 -0
  50. package/dist/expert-bridge-DMDHHDEU.js +11 -0
  51. package/dist/factory-FVD7PZ6S.js +15 -0
  52. package/dist/{factory-KMBWFIX2.js → factory-VQS3HJ7V.js} +6 -6
  53. package/dist/index.d.ts +358 -3357
  54. package/dist/index.js +70 -807
  55. package/dist/index.js.map +1 -1
  56. package/dist/init-opencode-EIOIPVWL.js +158 -0
  57. package/dist/init-opencode-EIOIPVWL.js.map +1 -0
  58. package/dist/issue-triage-HJUJWGAD.js +16 -0
  59. package/dist/{learning-persistence-FILWP3IR.js → learning-persistence-N6ILD2HX.js} +3 -3
  60. package/dist/{mobimem-77W5ED4Z.js → mobimem-BOJFXQ7B.js} +4 -4
  61. package/dist/{nexus-data-dir-M6DYKIHJ.js → nexus-data-dir-77UO7N6J.js} +2 -2
  62. package/dist/{registry-command-BBLIXULQ.js → registry-command-NCWUJKAF.js} +4 -4
  63. package/dist/{repo-security-plan-7SNM7JQN.js → repo-security-plan-3J45VAD6.js} +5 -5
  64. package/dist/research-helpers-synthesize-UGQHZZJN.js +12 -0
  65. package/dist/{routing-memory-DCIZEEVC.js → routing-memory-NO7QEH7T.js} +4 -4
  66. package/dist/{session-memory-5TSAASQW.js → session-memory-DOXLEWEU.js} +5 -5
  67. package/dist/{setup-command-5VGIQETA.js → setup-command-DVEBFKR2.js} +10 -10
  68. package/dist/setup-config-E3JZYSLR.js +11 -0
  69. package/dist/{setup-custom-api-IQX3GD2D.js → setup-custom-api-DHJ5DRH2.js} +6 -6
  70. package/dist/{weather-report-NETGWTJX.js → weather-report-FNN4OX3N.js} +4 -4
  71. package/package.json +1 -1
  72. package/dist/chunk-7OBFO4GF.js.map +0 -1
  73. package/dist/chunk-AGVLFRN7.js.map +0 -1
  74. package/dist/chunk-ANC3HU6F.js.map +0 -1
  75. package/dist/chunk-DWLATKBK.js.map +0 -1
  76. package/dist/chunk-FDNWRZNJ.js +0 -22
  77. package/dist/chunk-FDNWRZNJ.js.map +0 -1
  78. package/dist/chunk-POQQ7A5E.js.map +0 -1
  79. package/dist/chunk-TOYPY5XA.js.map +0 -1
  80. package/dist/chunk-U6BK5DQU.js.map +0 -1
  81. package/dist/chunk-WYSHXPKK.js.map +0 -1
  82. package/dist/chunk-XATH462F.js.map +0 -1
  83. package/dist/cli-circuit-breaker-2CJ6NV52.js +0 -14
  84. package/dist/doctor-deep-BJFDBGPO.js +0 -13
  85. package/dist/expert-bridge-75WNNWI4.js +0 -11
  86. package/dist/factory-H5BYL4V5.js +0 -15
  87. package/dist/issue-triage-4SEP4WID.js +0 -16
  88. package/dist/mcp-config-OCWIXE2Y.js +0 -13
  89. package/dist/research-helpers-synthesize-7CI2FJE5.js +0 -12
  90. package/dist/setup-config-EA5RDIO2.js +0 -11
  91. package/dist/weather-report-NETGWTJX.js.map +0 -1
  92. /package/dist/{adaptive-memory-MKSYEBST.js.map → adaptive-memory-UPE76IP6.js.map} +0 -0
  93. /package/dist/{chunk-ZPPX2K57.js.map → chunk-2KB63QGE.js.map} +0 -0
  94. /package/dist/{chunk-L2LQ3TSV.js.map → chunk-2MD5MWCK.js.map} +0 -0
  95. /package/dist/{chunk-NER7H3RJ.js.map → chunk-3FIDMWFC.js.map} +0 -0
  96. /package/dist/{chunk-VGZJIR22.js.map → chunk-5WQ3SRSE.js.map} +0 -0
  97. /package/dist/{chunk-OF7CYMMA.js.map → chunk-DA5UDQYW.js.map} +0 -0
  98. /package/dist/{chunk-LJT65EA7.js.map → chunk-I7ORMAO7.js.map} +0 -0
  99. /package/dist/{chunk-LMRKHQG5.js.map → chunk-L6N2S3UB.js.map} +0 -0
  100. /package/dist/{chunk-MJHOSM5U.js.map → chunk-QECRZ3YA.js.map} +0 -0
  101. /package/dist/{chunk-E66KFRSJ.js.map → chunk-TF3GROMO.js.map} +0 -0
  102. /package/dist/{chunk-U3HZQTUF.js.map → chunk-TQFRPFMG.js.map} +0 -0
  103. /package/dist/{chunk-KJCSRP34.js.map → chunk-V7ATY4BG.js.map} +0 -0
  104. /package/dist/{chunk-32RIOULO.js.map → chunk-VPC3YNFR.js.map} +0 -0
  105. /package/dist/{chunk-3BKVYSY6.js.map → chunk-VTVKC4FS.js.map} +0 -0
  106. /package/dist/{cli-circuit-breaker-2CJ6NV52.js.map → cli-circuit-breaker-GFF2RLBZ.js.map} +0 -0
  107. /package/dist/{composite-router-AYVJPIOS.js.map → composite-router-33F3F74I.js.map} +0 -0
  108. /package/dist/{consensus-vote-EXWACBMR.js.map → consensus-vote-5V4KVHBE.js.map} +0 -0
  109. /package/dist/{doctor-deep-BJFDBGPO.js.map → doctor-deep-AHDTNURD.js.map} +0 -0
  110. /package/dist/{expert-bridge-75WNNWI4.js.map → expert-bridge-DMDHHDEU.js.map} +0 -0
  111. /package/dist/{factory-H5BYL4V5.js.map → factory-FVD7PZ6S.js.map} +0 -0
  112. /package/dist/{factory-KMBWFIX2.js.map → factory-VQS3HJ7V.js.map} +0 -0
  113. /package/dist/{issue-triage-4SEP4WID.js.map → issue-triage-HJUJWGAD.js.map} +0 -0
  114. /package/dist/{learning-persistence-FILWP3IR.js.map → learning-persistence-N6ILD2HX.js.map} +0 -0
  115. /package/dist/{mcp-config-OCWIXE2Y.js.map → mobimem-BOJFXQ7B.js.map} +0 -0
  116. /package/dist/{mobimem-77W5ED4Z.js.map → nexus-data-dir-77UO7N6J.js.map} +0 -0
  117. /package/dist/{registry-command-BBLIXULQ.js.map → registry-command-NCWUJKAF.js.map} +0 -0
  118. /package/dist/{nexus-data-dir-M6DYKIHJ.js.map → repo-security-plan-3J45VAD6.js.map} +0 -0
  119. /package/dist/{repo-security-plan-7SNM7JQN.js.map → research-helpers-synthesize-UGQHZZJN.js.map} +0 -0
  120. /package/dist/{research-helpers-synthesize-7CI2FJE5.js.map → routing-memory-NO7QEH7T.js.map} +0 -0
  121. /package/dist/{routing-memory-DCIZEEVC.js.map → session-memory-DOXLEWEU.js.map} +0 -0
  122. /package/dist/{session-memory-5TSAASQW.js.map → setup-command-DVEBFKR2.js.map} +0 -0
  123. /package/dist/{setup-command-5VGIQETA.js.map → setup-config-E3JZYSLR.js.map} +0 -0
  124. /package/dist/{setup-custom-api-IQX3GD2D.js.map → setup-custom-api-DHJ5DRH2.js.map} +0 -0
  125. /package/dist/{setup-config-EA5RDIO2.js.map → weather-report-FNN4OX3N.js.map} +0 -0
@@ -0,0 +1,59 @@
1
+ // src/config/nexus-data-dir.ts
2
+ import { homedir } from "os";
3
+ import { join, resolve } from "path";
4
+
5
+ // src/config/sandbox-detection.ts
6
+ import { existsSync, readFileSync } from "fs";
7
+ function detectSandbox() {
8
+ const flavorRaw = process.env["NEXUS_SANDBOX"]?.trim();
9
+ const flavor = flavorRaw !== void 0 && flavorRaw !== "" ? flavorRaw : void 0;
10
+ const active = flavor !== void 0;
11
+ const rootRaw = process.env["NEXUS_SANDBOX_ROOT"]?.trim();
12
+ const root = rootRaw !== void 0 && rootRaw !== "" ? rootRaw : void 0;
13
+ return {
14
+ active,
15
+ flavor,
16
+ root,
17
+ heuristicMatch: detectContainerHeuristic()
18
+ };
19
+ }
20
+ function detectContainerHeuristic() {
21
+ try {
22
+ if (existsSync("/.dockerenv")) return "docker";
23
+ if (existsSync("/run/.containerenv")) return "podman";
24
+ if (existsSync("/proc/1/cgroup")) {
25
+ const cgroup = readFileSync("/proc/1/cgroup", "utf8");
26
+ if (/\bdocker\b/.test(cgroup)) return "docker";
27
+ if (/\bcontainerd\b/.test(cgroup)) return "docker";
28
+ }
29
+ return "unknown";
30
+ } catch {
31
+ return null;
32
+ }
33
+ }
34
+
35
+ // src/config/nexus-data-dir.ts
36
+ function getNexusDataDir() {
37
+ const fromEnv = process.env["NEXUS_DATA_DIR"]?.trim();
38
+ if (fromEnv !== void 0 && fromEnv !== "") {
39
+ return resolve(fromEnv);
40
+ }
41
+ const sandbox = detectSandbox();
42
+ if (sandbox.active) {
43
+ return resolve(sandbox.root ?? "/", ".nexus-agents");
44
+ }
45
+ return join(homedir(), ".nexus-agents");
46
+ }
47
+ function resetNexusDataDirCache() {
48
+ }
49
+ function nexusDataPath(...segments) {
50
+ return join(getNexusDataDir(), ...segments);
51
+ }
52
+
53
+ export {
54
+ detectSandbox,
55
+ getNexusDataDir,
56
+ resetNexusDataDirCache,
57
+ nexusDataPath
58
+ };
59
+ //# sourceMappingURL=chunk-GOT7OAL5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/config/nexus-data-dir.ts","../src/config/sandbox-detection.ts"],"sourcesContent":["/**\n * Nexus runtime data directory resolver (#2302, child of #2301).\n *\n * Returns the absolute path under which nexus-agents stores all runtime\n * state — memory, learning, audit, voting, sessions, checkpoints, traces,\n * model registry. Single source of truth so portable / sandbox / CI\n * deployments can redirect state to a workspace-local folder via the\n * `NEXUS_DATA_DIR` environment variable.\n *\n * Resolution order (first match wins):\n * 1. `NEXUS_DATA_DIR` env var if set + non-empty (resolved against `cwd`).\n * 2. Sandbox-mode default (#2501): when `NEXUS_SANDBOX` is set, use\n * `${NEXUS_SANDBOX_ROOT ?? '/'}/.nexus-agents`. Sandboxed deployments\n * typically mount a multi-repo root; state goes there, shared across\n * repo subfolders rather than buried inside one.\n * 3. `<homedir>/.nexus-agents` (zero-breakage fallback for laptop use).\n *\n * No caching, no filesystem walks, no discovery. The contrarian-narrowed\n * scope (#2301 vote) explicitly defers ancestor-walking to a separate\n * child with a security design pass per CVE-2022-24765. Recomputing the\n * trivial env-or-homedir lookup on each call is ~100ns and avoids cache\n * coordination issues with tests that mock `homedir()`.\n *\n * @module config/nexus-data-dir\n */\n\nimport { homedir } from 'node:os';\nimport { join, resolve } from 'node:path';\n\nimport { detectSandbox } from './sandbox-detection.js';\n\n/** Returns the absolute path to the nexus-agents data directory. */\nexport function getNexusDataDir(): string {\n const fromEnv = process.env['NEXUS_DATA_DIR']?.trim();\n if (fromEnv !== undefined && fromEnv !== '') {\n return resolve(fromEnv);\n }\n const sandbox = detectSandbox();\n if (sandbox.active) {\n return resolve(sandbox.root ?? '/', '.nexus-agents');\n }\n return join(homedir(), '.nexus-agents');\n}\n\n/**\n * No-op kept for source-compatibility with consumers that called this\n * earlier in development. The resolver is no longer cached, so resetting\n * is unnecessary. Kept exported (rather than removed) to avoid breaking\n * imports in tests that may have already adopted it.\n */\nexport function resetNexusDataDirCache(): void {\n // intentionally empty — see module docstring\n}\n\n/** Returns a path joined under the resolved data directory. */\nexport function nexusDataPath(...segments: string[]): string {\n return join(getNexusDataDir(), ...segments);\n}\n","/**\n * Sandbox detection (#2501, child 1 of epic #2500).\n *\n * nexus-agents needs to know whether it's running inside a host-provided\n * sandbox (Docker Desktop Sandbox + OpenCode, Codex sandbox, locked-down\n * CI runner) so it can adjust behaviour:\n *\n * - default `NEXUS_DATA_DIR` to the multi-repo root rather than `~/...`\n * - skip CLI subprocess detection (binaries aren't there)\n * - fail-fast when the gateway is unreachable instead of degrading\n * - suppress diagnostics that don't apply\n *\n * The signal is **explicit**: the image author (Dockerfile, devcontainer,\n * harness wrapper) sets `NEXUS_SANDBOX=<flavor>`. The flavor string is\n * for diagnostics + per-flavor branching (`docker-opencode`, `codex`,\n * `claude-code`, `ci-restricted`, …); presence is the on/off signal.\n *\n * A heuristic check runs alongside for verification — if `NEXUS_SANDBOX`\n * claims `docker-opencode` but `/.dockerenv` is missing, that's a\n * misconfiguration worth surfacing to the operator.\n *\n * @module config/sandbox-detection\n */\n\nimport { existsSync, readFileSync } from 'node:fs';\n\n/**\n * Heuristic detection result. Independent from the explicit\n * `NEXUS_SANDBOX` env var; produced by inspecting filesystem markers.\n */\nexport type SandboxHeuristic = 'docker' | 'podman' | 'unknown' | null;\n\nexport interface SandboxInfo {\n /**\n * True iff `NEXUS_SANDBOX` is set + non-empty. The explicit signal\n * the rest of the codebase keys off — never `true` by heuristic alone.\n */\n readonly active: boolean;\n /**\n * Operator-supplied flavor string, e.g. `docker-opencode`. Undefined\n * when `active === false` or the env var is empty.\n */\n readonly flavor: string | undefined;\n /**\n * Multi-repo root the user mounted. From `NEXUS_SANDBOX_ROOT`. Undefined\n * when unset; consumers that need a default substitute `/`.\n */\n readonly root: string | undefined;\n /**\n * Independent heuristic match — `null` when we couldn't run the check,\n * `'unknown'` when ran but no marker matched. Used by `doctor` to flag\n * mismatches between the explicit signal and the runtime environment.\n */\n readonly heuristicMatch: SandboxHeuristic;\n}\n\n/**\n * Detect whether nexus-agents is running inside a host-provided sandbox.\n * Pure read of env + filesystem; no caching (cheap enough to recompute,\n * and tests routinely mutate process.env).\n */\nexport function detectSandbox(): SandboxInfo {\n const flavorRaw = process.env['NEXUS_SANDBOX']?.trim();\n const flavor = flavorRaw !== undefined && flavorRaw !== '' ? flavorRaw : undefined;\n const active = flavor !== undefined;\n\n const rootRaw = process.env['NEXUS_SANDBOX_ROOT']?.trim();\n const root = rootRaw !== undefined && rootRaw !== '' ? rootRaw : undefined;\n\n return {\n active,\n flavor,\n root,\n heuristicMatch: detectContainerHeuristic(),\n };\n}\n\n/**\n * Look for filesystem markers indicating a container runtime. Used as a\n * cross-check against the explicit `NEXUS_SANDBOX` signal.\n *\n * Order of checks:\n * 1. `/.dockerenv` (Docker)\n * 2. `/run/.containerenv` (Podman)\n * 3. `/proc/1/cgroup` containing `docker` or `containerd` strings\n *\n * Returns `null` when none of the checks could run (non-Linux host with\n * no `/proc`, sandbox blocks `existsSync`, etc.) — distinct from\n * `'unknown'` (checks ran, no marker matched) so the doctor message can\n * differentiate \"we couldn't tell\" from \"we checked, no container\".\n */\nfunction detectContainerHeuristic(): SandboxHeuristic {\n try {\n if (existsSync('/.dockerenv')) return 'docker';\n if (existsSync('/run/.containerenv')) return 'podman';\n if (existsSync('/proc/1/cgroup')) {\n const cgroup = readFileSync('/proc/1/cgroup', 'utf8');\n if (/\\bdocker\\b/.test(cgroup)) return 'docker';\n if (/\\bcontainerd\\b/.test(cgroup)) return 'docker';\n }\n return 'unknown';\n } catch {\n return null;\n }\n}\n"],"mappings":";AA0BA,SAAS,eAAe;AACxB,SAAS,MAAM,eAAe;;;ACH9B,SAAS,YAAY,oBAAoB;AAqClC,SAAS,gBAA6B;AAC3C,QAAM,YAAY,QAAQ,IAAI,eAAe,GAAG,KAAK;AACrD,QAAM,SAAS,cAAc,UAAa,cAAc,KAAK,YAAY;AACzE,QAAM,SAAS,WAAW;AAE1B,QAAM,UAAU,QAAQ,IAAI,oBAAoB,GAAG,KAAK;AACxD,QAAM,OAAO,YAAY,UAAa,YAAY,KAAK,UAAU;AAEjE,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,gBAAgB,yBAAyB;AAAA,EAC3C;AACF;AAgBA,SAAS,2BAA6C;AACpD,MAAI;AACF,QAAI,WAAW,aAAa,EAAG,QAAO;AACtC,QAAI,WAAW,oBAAoB,EAAG,QAAO;AAC7C,QAAI,WAAW,gBAAgB,GAAG;AAChC,YAAM,SAAS,aAAa,kBAAkB,MAAM;AACpD,UAAI,aAAa,KAAK,MAAM,EAAG,QAAO;AACtC,UAAI,iBAAiB,KAAK,MAAM,EAAG,QAAO;AAAA,IAC5C;AACA,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;;;ADxEO,SAAS,kBAA0B;AACxC,QAAM,UAAU,QAAQ,IAAI,gBAAgB,GAAG,KAAK;AACpD,MAAI,YAAY,UAAa,YAAY,IAAI;AAC3C,WAAO,QAAQ,OAAO;AAAA,EACxB;AACA,QAAM,UAAU,cAAc;AAC9B,MAAI,QAAQ,QAAQ;AAClB,WAAO,QAAQ,QAAQ,QAAQ,KAAK,eAAe;AAAA,EACrD;AACA,SAAO,KAAK,QAAQ,GAAG,eAAe;AACxC;AAQO,SAAS,yBAA+B;AAE/C;AAGO,SAAS,iBAAiB,UAA4B;AAC3D,SAAO,KAAK,gBAAgB,GAAG,GAAG,QAAQ;AAC5C;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getNexusDataDir
3
- } from "./chunk-FDNWRZNJ.js";
3
+ } from "./chunk-GOT7OAL5.js";
4
4
 
5
5
  // src/config/learning-persistence.ts
6
6
  import { mkdirSync } from "fs";
@@ -29,4 +29,4 @@ export {
29
29
  isPersistenceEnabled,
30
30
  ensureLearningDir
31
31
  };
32
- //# sourceMappingURL=chunk-LJT65EA7.js.map
32
+ //# sourceMappingURL=chunk-I7ORMAO7.js.map
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  createLogger,
6
6
  getTimeProvider
7
- } from "./chunk-7OBFO4GF.js";
7
+ } from "./chunk-O4KUCF5S.js";
8
8
 
9
9
  // src/mcp/tools/scanner-registry-fetcher.ts
10
10
  import { z } from "zod";
@@ -698,4 +698,4 @@ export {
698
698
  generateSecurityPlan,
699
699
  buildPlanFromAnalysis
700
700
  };
701
- //# sourceMappingURL=chunk-LMRKHQG5.js.map
701
+ //# sourceMappingURL=chunk-L6N2S3UB.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isPersistenceEnabled
3
- } from "./chunk-LJT65EA7.js";
3
+ } from "./chunk-I7ORMAO7.js";
4
4
  import {
5
5
  __require
6
6
  } from "./chunk-UP2VWCW5.js";
@@ -227,11 +227,18 @@ function writeLog(entry) {
227
227
  const output = globalFormat === "pretty" ? formatPretty(entry) : JSON.stringify(entry) + "\n";
228
228
  getOutputStream().write(output);
229
229
  }
230
+ var GLOBAL_LEVEL = getDefaultLogLevel();
231
+ function setGlobalLogLevel(level) {
232
+ GLOBAL_LEVEL = level;
233
+ }
230
234
  function createLogger(baseContext) {
231
- let currentLevel = getDefaultLogLevel();
235
+ let instanceLevel;
232
236
  const context = baseContext ?? {};
237
+ function effectiveLevel() {
238
+ return instanceLevel ?? GLOBAL_LEVEL;
239
+ }
233
240
  function shouldLog(level) {
234
- return LEVEL_PRIORITY[level] >= LEVEL_PRIORITY[currentLevel];
241
+ return LEVEL_PRIORITY[level] >= LEVEL_PRIORITY[effectiveLevel()];
235
242
  }
236
243
  function log(level, msg, ctx, e) {
237
244
  if (shouldLog(level)) {
@@ -253,7 +260,7 @@ function createLogger(baseContext) {
253
260
  },
254
261
  child: (childCtx) => createLogger({ ...context, ...childCtx }),
255
262
  setLevel: (level) => {
256
- currentLevel = level;
263
+ instanceLevel = level;
257
264
  },
258
265
  setFormat: (format) => {
259
266
  globalFormat = format;
@@ -3655,9 +3662,9 @@ var DEFAULT_OUTPUT_TOKENS = 500;
3655
3662
  var TopsisRouter = class {
3656
3663
  config;
3657
3664
  logger;
3658
- constructor(config = {}, logger10) {
3665
+ constructor(config = {}, logger11) {
3659
3666
  this.config = { ...DEFAULT_TOPSIS_CONFIG, ...config };
3660
- this.logger = logger10 ?? createLogger({ component: "TopsisRouter" });
3667
+ this.logger = logger11 ?? createLogger({ component: "TopsisRouter" });
3661
3668
  this.validateWeights();
3662
3669
  }
3663
3670
  /**
@@ -5014,9 +5021,9 @@ var ZeroRouter = class {
5014
5021
  logger;
5015
5022
  outcomes = [];
5016
5023
  calibrationBias = 0;
5017
- constructor(config, logger10) {
5024
+ constructor(config, logger11) {
5018
5025
  this.config = ZeroRouterConfigSchema.parse(config ?? {});
5019
- this.logger = logger10 ?? createLogger({ component: "ZeroRouter" });
5026
+ this.logger = logger11 ?? createLogger({ component: "ZeroRouter" });
5020
5027
  this.logger.debug("ZeroRouter initialized", {
5021
5028
  thresholds: this.config.thresholds,
5022
5029
  enableCalibration: this.config.enableCalibration
@@ -5708,9 +5715,9 @@ var ConfidenceCascadeStage = class {
5708
5715
  routingsCount = 0;
5709
5716
  escalationCount = 0;
5710
5717
  complexityDistribution = { simple: 0, moderate: 0, complex: 0 };
5711
- constructor(config = {}, logger10) {
5718
+ constructor(config = {}, logger11) {
5712
5719
  this.config = { ...DEFAULT_CONFIG, ...config };
5713
- this.logger = logger10 ?? createLogger({ component: "ConfidenceCascadeStage" });
5720
+ this.logger = logger11 ?? createLogger({ component: "ConfidenceCascadeStage" });
5714
5721
  }
5715
5722
  canHandle(ctx) {
5716
5723
  return getRemainingCandidates(ctx).length > 0;
@@ -6051,9 +6058,9 @@ var CapabilityMatchStage = class {
6051
6058
  creative: 0,
6052
6059
  general: 0
6053
6060
  };
6054
- constructor(config = {}, logger10) {
6061
+ constructor(config = {}, logger11) {
6055
6062
  this.config = { ...DEFAULT_CONFIG2, ...config };
6056
- this.logger = logger10 ?? createLogger({ component: "CapabilityMatchStage" });
6063
+ this.logger = logger11 ?? createLogger({ component: "CapabilityMatchStage" });
6057
6064
  }
6058
6065
  canHandle(ctx) {
6059
6066
  return getRemainingCandidates(ctx).length > 0;
@@ -6209,9 +6216,9 @@ var QualityConstraintStage = class {
6209
6216
  filteredCount = 0;
6210
6217
  fallbackCount = 0;
6211
6218
  constraintViolations = { quality: 0, cost: 0, latency: 0 };
6212
- constructor(config = {}, logger10) {
6219
+ constructor(config = {}, logger11) {
6213
6220
  this.config = { ...DEFAULT_CONFIG3, ...config };
6214
- this.logger = logger10 ?? createLogger({ component: "QualityConstraintStage" });
6221
+ this.logger = logger11 ?? createLogger({ component: "QualityConstraintStage" });
6215
6222
  }
6216
6223
  canHandle(ctx) {
6217
6224
  return getRemainingCandidates(ctx).length > 0;
@@ -6419,9 +6426,9 @@ var ResourceStrategyStage = class {
6419
6426
  logger;
6420
6427
  routingsCount = 0;
6421
6428
  tierHistory = [];
6422
- constructor(config = {}, logger10) {
6429
+ constructor(config = {}, logger11) {
6423
6430
  this.config = { ...DEFAULT_CONFIG4, ...config };
6424
- this.logger = logger10 ?? createLogger({ component: "ResourceStrategyStage" });
6431
+ this.logger = logger11 ?? createLogger({ component: "ResourceStrategyStage" });
6425
6432
  }
6426
6433
  canHandle(ctx) {
6427
6434
  return getRemainingCandidates(ctx).length > 1;
@@ -6530,10 +6537,10 @@ var DistilledRuleStage = class {
6530
6537
  config;
6531
6538
  logger;
6532
6539
  rulesAppliedCount = 0;
6533
- constructor(distiller, config, logger10) {
6540
+ constructor(distiller, config, logger11) {
6534
6541
  this.distiller = distiller;
6535
6542
  this.config = { ...DEFAULT_CONFIG5, ...config };
6536
- this.logger = logger10 ?? createLogger({ component: "DistilledRuleStage" });
6543
+ this.logger = logger11 ?? createLogger({ component: "DistilledRuleStage" });
6537
6544
  }
6538
6545
  canHandle(ctx) {
6539
6546
  const candidates = getRemainingCandidates(ctx);
@@ -6672,10 +6679,10 @@ var KnnRoutingStage = class {
6672
6679
  memory;
6673
6680
  routingsCount = 0;
6674
6681
  matchCount = 0;
6675
- constructor(memory, config = {}, logger10) {
6682
+ constructor(memory, config = {}, logger11) {
6676
6683
  this.config = { ...DEFAULT_CONFIG6, ...config };
6677
6684
  this.memory = memory;
6678
- this.logger = logger10 ?? createLogger({ component: "KnnRoutingStage" });
6685
+ this.logger = logger11 ?? createLogger({ component: "KnnRoutingStage" });
6679
6686
  }
6680
6687
  canHandle(ctx) {
6681
6688
  return getRemainingCandidates(ctx).length > 0;
@@ -6890,10 +6897,10 @@ var StrategyDistiller = class {
6890
6897
  rules = /* @__PURE__ */ new Map();
6891
6898
  outcomeCounter = 0;
6892
6899
  lastDistillAt;
6893
- constructor(outcomeStore, logger10, config) {
6900
+ constructor(outcomeStore, logger11, config) {
6894
6901
  this.outcomeStore = outcomeStore;
6895
6902
  this.config = { ...DEFAULT_DISTILLER_CONFIG, ...config };
6896
- this.logger = logger10 ?? createLogger({ component: "StrategyDistiller" });
6903
+ this.logger = logger11 ?? createLogger({ component: "StrategyDistiller" });
6897
6904
  }
6898
6905
  /** Called for each processed outcome. Triggers distillation at threshold. */
6899
6906
  onOutcome() {
@@ -7057,18 +7064,18 @@ var StrategyDistiller = class {
7057
7064
  };
7058
7065
  }
7059
7066
  };
7060
- function createStrategyDistiller(outcomeStore, logger10, config) {
7061
- return new StrategyDistiller(outcomeStore, logger10, config);
7067
+ function createStrategyDistiller(outcomeStore, logger11, config) {
7068
+ return new StrategyDistiller(outcomeStore, logger11, config);
7062
7069
  }
7063
7070
  var persistentDistillerFactory;
7064
7071
  function registerPersistentDistillerFactory(factory) {
7065
7072
  persistentDistillerFactory = factory;
7066
7073
  }
7067
- function createPersistentDistillerOrFallback(outcomeStore, logger10) {
7074
+ function createPersistentDistillerOrFallback(outcomeStore, logger11) {
7068
7075
  if (persistentDistillerFactory !== void 0) {
7069
- return persistentDistillerFactory(outcomeStore, logger10);
7076
+ return persistentDistillerFactory(outcomeStore, logger11);
7070
7077
  }
7071
- return new StrategyDistiller(outcomeStore, logger10);
7078
+ return new StrategyDistiller(outcomeStore, logger11);
7072
7079
  }
7073
7080
 
7074
7081
  // src/orchestration/outcomes/outcome-types.ts
@@ -7638,8 +7645,8 @@ function generateSyntheticPriors() {
7638
7645
  }
7639
7646
  return priors;
7640
7647
  }
7641
- function runWarmUp(logger10) {
7642
- const log = logger10 ?? createLogger({ component: "warm-up" });
7648
+ function runWarmUp(logger11) {
7649
+ const log = logger11 ?? createLogger({ component: "warm-up" });
7643
7650
  const store = getOutcomeStore();
7644
7651
  const existing = store.query();
7645
7652
  const hasSynthetic = existing.some((o) => o.qualitySignals?.includes(SYNTHETIC_MARKER) === true);
@@ -9385,7 +9392,52 @@ function convertBonusesToScoreMap(bonuses, taskCategory) {
9385
9392
  return scores;
9386
9393
  }
9387
9394
 
9395
+ // src/cli-adapters/fallback-chains.ts
9396
+ import { z as z14 } from "zod";
9397
+ var FallbackChainSchema = z14.array(z14.enum(["claude", "gemini", "codex", "opencode"])).min(1).readonly();
9398
+ var FallbackChainRegistrySchema = z14.object({
9399
+ code: FallbackChainSchema,
9400
+ research: FallbackChainSchema,
9401
+ documentation: FallbackChainSchema,
9402
+ analysis: FallbackChainSchema,
9403
+ general: FallbackChainSchema
9404
+ });
9405
+ var DEFAULT_FALLBACK_CHAINS = {
9406
+ // code_generation/code_review/testing: codex primary, claude secondary
9407
+ code: ["codex", "claude", "gemini", "opencode"],
9408
+ // research/exploration: gemini primary, claude secondary
9409
+ research: ["gemini", "claude", "codex", "opencode"],
9410
+ // documentation: gemini primary, claude secondary
9411
+ documentation: ["gemini", "claude", "codex", "opencode"],
9412
+ // architecture/security/planning: claude primary, gemini secondary
9413
+ // Weather data: gemini arch 66.7% (n=24) > codex 33.3% (n=3)
9414
+ analysis: ["claude", "gemini", "codex", "opencode"],
9415
+ // general: balanced order
9416
+ general: ["claude", "gemini", "codex", "opencode"]
9417
+ };
9418
+ var CATEGORY_CHAIN_OVERRIDES = {
9419
+ architecture: ["gemini", "claude", "codex", "opencode"],
9420
+ security_review: ["codex", "gemini", "claude", "opencode"],
9421
+ code_review: ["claude", "codex", "gemini", "opencode"],
9422
+ exploration: ["gemini", "codex", "claude", "opencode"],
9423
+ devops: ["claude", "gemini", "codex", "opencode"],
9424
+ // codex has 15% research success (n=20) — push to last position (#1536)
9425
+ research: ["gemini", "claude", "opencode", "codex"],
9426
+ // codex has 33.3% docs success (n=6) — push to last position (#1536)
9427
+ documentation: ["gemini", "claude", "opencode", "codex"]
9428
+ };
9429
+ var SENSITIVE_CATEGORIES = /* @__PURE__ */ new Set();
9430
+ function isCategoryFailClosed(category) {
9431
+ return SENSITIVE_CATEGORIES.has(category);
9432
+ }
9433
+ function getFallbackChainForCategory(category, bucketType, registry = DEFAULT_FALLBACK_CHAINS) {
9434
+ const override = CATEGORY_CHAIN_OVERRIDES[category];
9435
+ if (override !== void 0) return override;
9436
+ return registry[bucketType];
9437
+ }
9438
+
9388
9439
  // src/cli-adapters/composite-router-stages.ts
9440
+ var logger9 = createLogger({ component: "composite-router-stages" });
9389
9441
  var sharedAnalyzer2 = createSharedTaskAnalyzer();
9390
9442
  function analyzeTaskProfile(task, stagesExecuted) {
9391
9443
  const internalTask = cliTaskToTask(task);
@@ -9764,6 +9816,34 @@ async function applyQualityConstraints(candidates, stagesExecuted, deps) {
9764
9816
  }
9765
9817
  return ok({ candidates: qualityResult.eligible, qualityResult });
9766
9818
  }
9819
+ function applyCategoryOverride(task, candidates, stagesExecuted) {
9820
+ const match = detectTaskCategory(task.content);
9821
+ if (match === null) return ok(candidates);
9822
+ const override = CATEGORY_CHAIN_OVERRIDES[match.category];
9823
+ if (override === void 0) return ok(candidates);
9824
+ const candidateSet = new Set(candidates);
9825
+ const filtered = override.filter((cli) => candidateSet.has(cli));
9826
+ if (filtered.length === 0) {
9827
+ if (isCategoryFailClosed(match.category)) {
9828
+ stagesExecuted.push("category-override:fail-closed");
9829
+ logger9.warn("Category override fail-closed \u2014 every override CLI unavailable", {
9830
+ category: match.category,
9831
+ override,
9832
+ availableCandidates: candidates
9833
+ });
9834
+ return err(
9835
+ new CompositeRoutingError(
9836
+ `category '${match.category}' is fail-closed and every override CLI (${override.join(", ")}) is unavailable; route aborted to prevent silent fallback to excluded CLI`,
9837
+ "category-override"
9838
+ )
9839
+ );
9840
+ }
9841
+ stagesExecuted.push("category-override:no-eligible");
9842
+ return ok(candidates);
9843
+ }
9844
+ stagesExecuted.push("category-override");
9845
+ return ok(filtered);
9846
+ }
9767
9847
  function applyLinUCBFloorOverride(linucbCli, topsisRanking, opts) {
9768
9848
  if (opts.perfData === void 0) return linucbCli;
9769
9849
  const cliPerf = opts.perfData.get(linucbCli);
@@ -9789,6 +9869,9 @@ async function runPipeline(task, taskProfile, stagesExecuted, cliNames, deps) {
9789
9869
  const constrained = await applyQualityConstraints(candidates, stagesExecuted, deps);
9790
9870
  if (!constrained.ok) return constrained;
9791
9871
  candidates = constrained.value.candidates;
9872
+ const overrideResult = applyCategoryOverride(task, candidates, stagesExecuted);
9873
+ if (!overrideResult.ok) return overrideResult;
9874
+ candidates = overrideResult.value;
9792
9875
  const stageScores = aggregateStageScores(scoring, task.content);
9793
9876
  const topsisOpts = {
9794
9877
  performanceData: getPerformanceDataForCategory(task.content)
@@ -10044,7 +10127,7 @@ var CompositeRouter = class _CompositeRouter {
10044
10127
  lastRoutedTask;
10045
10128
  // Track last traceId for metrics correlation (Issue #559)
10046
10129
  lastTraceId;
10047
- constructor(adapters, config, logger10) {
10130
+ constructor(adapters, config, logger11) {
10048
10131
  const {
10049
10132
  preferenceRouterConfig,
10050
10133
  zeroRouterConfig,
@@ -10060,7 +10143,7 @@ var CompositeRouter = class _CompositeRouter {
10060
10143
  ...baseConfig
10061
10144
  } = config ?? {};
10062
10145
  this.config = CompositeRouterConfigSchema.parse(baseConfig);
10063
- this.logger = logger10 ?? createLogger({ component: "CompositeRouter" });
10146
+ this.logger = logger11 ?? createLogger({ component: "CompositeRouter" });
10064
10147
  this.adapters = adapters;
10065
10148
  this.cliNames = Array.from(adapters.keys());
10066
10149
  if (metricsCollector !== void 0) {
@@ -10491,8 +10574,8 @@ var CompositeRouter = class _CompositeRouter {
10491
10574
  return this.routingMemory;
10492
10575
  }
10493
10576
  };
10494
- function createCompositeRouter(adapters, config, logger10) {
10495
- return new CompositeRouter(adapters, config, logger10);
10577
+ function createCompositeRouter(adapters, config, logger11) {
10578
+ return new CompositeRouter(adapters, config, logger11);
10496
10579
  }
10497
10580
 
10498
10581
  // src/core/types/model.ts
@@ -10880,7 +10963,7 @@ var ActionCacheImpl = class {
10880
10963
  };
10881
10964
 
10882
10965
  // src/context/mobimem.ts
10883
- var logger9 = createLogger({ component: "MobiMem" });
10966
+ var logger10 = createLogger({ component: "MobiMem" });
10884
10967
  var MobiMem = class {
10885
10968
  profile;
10886
10969
  experience;
@@ -10892,7 +10975,7 @@ var MobiMem = class {
10892
10975
  this.profile = new ProfileMemoryImpl(this.config);
10893
10976
  this.experience = new ExperienceMemoryImpl(this.config);
10894
10977
  this.action = new ActionCacheImpl(this.config);
10895
- logger9.info("MobiMem initialized", {
10978
+ logger10.info("MobiMem initialized", {
10896
10979
  maxProfileEntries: this.config.maxProfileEntries,
10897
10980
  maxExperiencePatterns: this.config.maxExperiencePatterns,
10898
10981
  maxActionCacheEntries: this.config.maxActionCacheEntries
@@ -10923,12 +11006,12 @@ var MobiMem = class {
10923
11006
  if (this.config.autoEviction) {
10924
11007
  const evicted = this.action.evictExpired();
10925
11008
  if (evicted > 0) {
10926
- logger9.debug("Evicted expired action cache entries", { count: evicted });
11009
+ logger10.debug("Evicted expired action cache entries", { count: evicted });
10927
11010
  }
10928
11011
  }
10929
11012
  }
10930
11013
  close() {
10931
- logger9.info("MobiMem closed");
11014
+ logger10.info("MobiMem closed");
10932
11015
  }
10933
11016
  /** Export MobiMem state for disk persistence (#1782). */
10934
11017
  exportData() {
@@ -10945,9 +11028,9 @@ var MobiMem = class {
10945
11028
  await fs2.mkdir(path2.dirname(filePath), { recursive: true });
10946
11029
  const data = JSON.stringify(this.exportData(), null, 2);
10947
11030
  await fs2.writeFile(filePath, data, "utf-8");
10948
- logger9.debug("MobiMem state saved", { path: filePath });
11031
+ logger10.debug("MobiMem state saved", { path: filePath });
10949
11032
  } catch (error) {
10950
- logger9.warn("Failed to save MobiMem state", { error: String(error) });
11033
+ logger10.warn("Failed to save MobiMem state", { error: String(error) });
10951
11034
  }
10952
11035
  }
10953
11036
  };
@@ -10969,6 +11052,7 @@ export {
10969
11052
  getTimeProvider,
10970
11053
  withStep,
10971
11054
  sanitize,
11055
+ setGlobalLogLevel,
10972
11056
  createLogger,
10973
11057
  logger,
10974
11058
  bootstrapStepNotifications,
@@ -11124,6 +11208,7 @@ export {
11124
11208
  queryWithLookback,
11125
11209
  getAdaptiveBonus,
11126
11210
  shouldExplore,
11211
+ getFallbackChainForCategory,
11127
11212
  CompositeRouter,
11128
11213
  createCompositeRouter,
11129
11214
  ModelCapability,
@@ -11131,4 +11216,4 @@ export {
11131
11216
  ParseError,
11132
11217
  OrchestratorError
11133
11218
  };
11134
- //# sourceMappingURL=chunk-7OBFO4GF.js.map
11219
+ //# sourceMappingURL=chunk-O4KUCF5S.js.map