nexus-agents 2.29.0 → 2.29.2

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 (112) hide show
  1. package/dist/adaptive-memory-5VP5WWTE.js +15 -0
  2. package/dist/chunk-5COIDGQJ.js +1585 -0
  3. package/dist/chunk-5COIDGQJ.js.map +1 -0
  4. package/dist/{chunk-HWDBNDUX.js → chunk-63AJLNKU.js} +2 -2
  5. package/dist/chunk-66NNHMVB.js +195 -0
  6. package/dist/chunk-66NNHMVB.js.map +1 -0
  7. package/dist/chunk-AP2FD37C.js +127 -0
  8. package/dist/chunk-AP2FD37C.js.map +1 -0
  9. package/dist/chunk-BC3M4VLP.js +359 -0
  10. package/dist/chunk-BC3M4VLP.js.map +1 -0
  11. package/dist/chunk-BQ4YXGGQ.js +127 -0
  12. package/dist/chunk-BQ4YXGGQ.js.map +1 -0
  13. package/dist/{chunk-ZBZJHXRT.js → chunk-CW2Z773T.js} +19 -347
  14. package/dist/chunk-CW2Z773T.js.map +1 -0
  15. package/dist/chunk-DDQGAVQA.js +944 -0
  16. package/dist/chunk-DDQGAVQA.js.map +1 -0
  17. package/dist/chunk-ED6VQWNG.js +63 -0
  18. package/dist/chunk-ED6VQWNG.js.map +1 -0
  19. package/dist/{chunk-7F6HYUIY.js → chunk-EPMBGZQX.js} +16 -97
  20. package/dist/chunk-EPMBGZQX.js.map +1 -0
  21. package/dist/chunk-GX436VRU.js +931 -0
  22. package/dist/chunk-GX436VRU.js.map +1 -0
  23. package/dist/{chunk-IMWYKX4H.js → chunk-HSOPD265.js} +444 -399
  24. package/dist/chunk-HSOPD265.js.map +1 -0
  25. package/dist/{chunk-S3BKWNST.js → chunk-J245RJGW.js} +680 -1436
  26. package/dist/chunk-J245RJGW.js.map +1 -0
  27. package/dist/{chunk-I6YDS23R.js → chunk-KQIDTE52.js} +2 -2
  28. package/dist/{chunk-POBO4G2P.js → chunk-LDIN2PLV.js} +250 -110
  29. package/dist/chunk-LDIN2PLV.js.map +1 -0
  30. package/dist/{chunk-KGDG6PWZ.js → chunk-LKDHAJJB.js} +2 -2
  31. package/dist/{chunk-T7PU3NPQ.js → chunk-NKGTEJYU.js} +7 -5
  32. package/dist/{chunk-T7PU3NPQ.js.map → chunk-NKGTEJYU.js.map} +1 -1
  33. package/dist/chunk-QGODFK36.js +122 -0
  34. package/dist/chunk-QGODFK36.js.map +1 -0
  35. package/dist/{chunk-DAMRMAM2.js → chunk-QSNAFOE6.js} +12369 -14499
  36. package/dist/chunk-QSNAFOE6.js.map +1 -0
  37. package/dist/chunk-TL2GJMJ5.js +700 -0
  38. package/dist/chunk-TL2GJMJ5.js.map +1 -0
  39. package/dist/{chunk-WSK4VSXP.js → chunk-V6MSPUQF.js} +2 -2
  40. package/dist/chunk-VZ2YOQWU.js +90 -0
  41. package/dist/chunk-VZ2YOQWU.js.map +1 -0
  42. package/dist/{chunk-5VZLXMO7.js → chunk-WSYJN7BI.js} +7 -6
  43. package/dist/chunk-WSYJN7BI.js.map +1 -0
  44. package/dist/chunk-Y477EGI4.js +356 -0
  45. package/dist/chunk-Y477EGI4.js.map +1 -0
  46. package/dist/{chunk-HH5LVGEE.js → chunk-Z4OZ25VS.js} +4 -4
  47. package/dist/cli-circuit-breaker-6EJO3PPU.js +13 -0
  48. package/dist/cli.js +123 -68
  49. package/dist/cli.js.map +1 -1
  50. package/dist/codebase-search-CZUA37RU.js +9 -0
  51. package/dist/{composite-router-YPRWVTRB.js → composite-router-JD7URTC2.js} +2 -2
  52. package/dist/{consensus-vote-DBE6RNZG.js → consensus-vote-COW34Q2Y.js} +7 -5
  53. package/dist/{dist-7PQR2BQB.js → dist-CV74KUT7.js} +1302 -805
  54. package/dist/dist-CV74KUT7.js.map +1 -0
  55. package/dist/{doctor-deep-AWE7SRU6.js → doctor-deep-4A4X5X6U.js} +3 -3
  56. package/dist/expert-bridge-J36C7VES.js +10 -0
  57. package/dist/{expert-config-FHNBQRX2.js → expert-config-MQ5OJE3U.js} +2 -2
  58. package/dist/{factory-O5C7ZBZO.js → factory-4Z4RSUYE.js} +5 -4
  59. package/dist/{factory-PCHGQ3ZG.js → factory-NHORX63J.js} +4 -3
  60. package/dist/index.d.ts +507 -42
  61. package/dist/index.js +331 -78
  62. package/dist/index.js.map +1 -1
  63. package/dist/issue-triage-TIG3RKXF.js +15 -0
  64. package/dist/{mcp-config-AUZQPUBY.js → mcp-config-ETY7GFGW.js} +3 -3
  65. package/dist/mobimem-5PAAMVFR.js +13 -0
  66. package/dist/mobimem-5PAAMVFR.js.map +1 -0
  67. package/dist/repo-analyze-HWMXSK5C.js +24 -0
  68. package/dist/repo-analyze-HWMXSK5C.js.map +1 -0
  69. package/dist/repo-security-plan-KQB3ZJTE.js +17 -0
  70. package/dist/repo-security-plan-KQB3ZJTE.js.map +1 -0
  71. package/dist/research-helpers-synthesize-ZMERZZ5B.js +10 -0
  72. package/dist/research-helpers-synthesize-ZMERZZ5B.js.map +1 -0
  73. package/dist/{routing-memory-QY3XMU2R.js → routing-memory-3ES3OHLM.js} +2 -2
  74. package/dist/routing-memory-3ES3OHLM.js.map +1 -0
  75. package/dist/{session-memory-3MBCE5KS.js → session-memory-E2OE2CYR.js} +3 -3
  76. package/dist/session-memory-E2OE2CYR.js.map +1 -0
  77. package/dist/{setup-command-IQ4MD3FT.js → setup-command-CMCQRBJF.js} +7 -6
  78. package/dist/setup-command-CMCQRBJF.js.map +1 -0
  79. package/dist/{setup-config-5YUPLDXF.js → setup-config-KITOPV7V.js} +3 -3
  80. package/dist/setup-config-KITOPV7V.js.map +1 -0
  81. package/dist/shared-memory-AEO2HJLC.js +8 -0
  82. package/dist/shared-memory-AEO2HJLC.js.map +1 -0
  83. package/dist/symbol-extractor-UEBANFSN.js +10 -0
  84. package/dist/symbol-extractor-UEBANFSN.js.map +1 -0
  85. package/dist/{weather-report-CC2C4KAX.js → weather-report-KUSVNXDZ.js} +2 -2
  86. package/dist/weather-report-KUSVNXDZ.js.map +1 -0
  87. package/package.json +14 -13
  88. package/dist/chunk-5VZLXMO7.js.map +0 -1
  89. package/dist/chunk-7F6HYUIY.js.map +0 -1
  90. package/dist/chunk-DAMRMAM2.js.map +0 -1
  91. package/dist/chunk-IMWYKX4H.js.map +0 -1
  92. package/dist/chunk-POBO4G2P.js.map +0 -1
  93. package/dist/chunk-S3BKWNST.js.map +0 -1
  94. package/dist/chunk-ZBZJHXRT.js.map +0 -1
  95. package/dist/dist-7PQR2BQB.js.map +0 -1
  96. /package/dist/{composite-router-YPRWVTRB.js.map → adaptive-memory-5VP5WWTE.js.map} +0 -0
  97. /package/dist/{chunk-HWDBNDUX.js.map → chunk-63AJLNKU.js.map} +0 -0
  98. /package/dist/{chunk-I6YDS23R.js.map → chunk-KQIDTE52.js.map} +0 -0
  99. /package/dist/{chunk-KGDG6PWZ.js.map → chunk-LKDHAJJB.js.map} +0 -0
  100. /package/dist/{chunk-WSK4VSXP.js.map → chunk-V6MSPUQF.js.map} +0 -0
  101. /package/dist/{chunk-HH5LVGEE.js.map → chunk-Z4OZ25VS.js.map} +0 -0
  102. /package/dist/{consensus-vote-DBE6RNZG.js.map → cli-circuit-breaker-6EJO3PPU.js.map} +0 -0
  103. /package/dist/{doctor-deep-AWE7SRU6.js.map → codebase-search-CZUA37RU.js.map} +0 -0
  104. /package/dist/{expert-config-FHNBQRX2.js.map → composite-router-JD7URTC2.js.map} +0 -0
  105. /package/dist/{factory-O5C7ZBZO.js.map → consensus-vote-COW34Q2Y.js.map} +0 -0
  106. /package/dist/{factory-PCHGQ3ZG.js.map → doctor-deep-4A4X5X6U.js.map} +0 -0
  107. /package/dist/{mcp-config-AUZQPUBY.js.map → expert-bridge-J36C7VES.js.map} +0 -0
  108. /package/dist/{routing-memory-QY3XMU2R.js.map → expert-config-MQ5OJE3U.js.map} +0 -0
  109. /package/dist/{session-memory-3MBCE5KS.js.map → factory-4Z4RSUYE.js.map} +0 -0
  110. /package/dist/{setup-command-IQ4MD3FT.js.map → factory-NHORX63J.js.map} +0 -0
  111. /package/dist/{setup-config-5YUPLDXF.js.map → issue-triage-TIG3RKXF.js.map} +0 -0
  112. /package/dist/{weather-report-CC2C4KAX.js.map → mcp-config-ETY7GFGW.js.map} +0 -0
@@ -0,0 +1,931 @@
1
+ import {
2
+ ParseError,
3
+ SecurityError,
4
+ getErrorMessage
5
+ } from "./chunk-HSOPD265.js";
6
+
7
+ // src/cli/research-helpers-io.ts
8
+ import * as fs from "fs/promises";
9
+ import { join, resolve as resolve2 } from "path";
10
+
11
+ // src/security/safe-path.ts
12
+ import { resolve, sep } from "path";
13
+ function resolveInsideRoot(filePath, root = process.cwd()) {
14
+ const resolvedRoot = resolve(root);
15
+ const resolved = resolve(resolvedRoot, filePath);
16
+ if (resolved === resolvedRoot) return resolved;
17
+ if (resolved.startsWith(resolvedRoot + sep)) return resolved;
18
+ return null;
19
+ }
20
+
21
+ // src/cli/research-helpers-io.ts
22
+ import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
23
+ var REGISTRY_PATH = "docs/research/registry";
24
+ var TECHNIQUES_FILE = "techniques.yaml";
25
+ var PAPERS_FILE = "papers.yaml";
26
+ function getProjectRoot() {
27
+ return process.cwd();
28
+ }
29
+ function validatePath(constructedPath, allowedRoot) {
30
+ const resolved = resolveInsideRoot(constructedPath, allowedRoot);
31
+ if (resolved === null) {
32
+ return {
33
+ ok: false,
34
+ error: new SecurityError("Path traversal detected: path escapes allowed root directory", {
35
+ context: { constructedPath, allowedRoot: resolve2(allowedRoot) }
36
+ })
37
+ };
38
+ }
39
+ return { ok: true, value: resolved };
40
+ }
41
+ async function loadTechniquesRegistry(rootDir) {
42
+ const root = rootDir ?? process.cwd();
43
+ const filePath = join(root, REGISTRY_PATH, TECHNIQUES_FILE);
44
+ const pathValidation = validatePath(filePath, root);
45
+ if (!pathValidation.ok) {
46
+ return pathValidation;
47
+ }
48
+ try {
49
+ const content = await fs.readFile(pathValidation.value, "utf-8");
50
+ return { ok: true, value: parseYaml(content) };
51
+ } catch (error) {
52
+ const message = getErrorMessage(error);
53
+ return { ok: false, error: new ParseError(`Failed to load techniques registry: ${message}`) };
54
+ }
55
+ }
56
+ async function loadPapersRegistry(rootDir) {
57
+ const root = rootDir ?? process.cwd();
58
+ const filePath = join(root, REGISTRY_PATH, PAPERS_FILE);
59
+ const pathValidation = validatePath(filePath, root);
60
+ if (!pathValidation.ok) {
61
+ return pathValidation;
62
+ }
63
+ try {
64
+ const content = await fs.readFile(pathValidation.value, "utf-8");
65
+ return { ok: true, value: parseYaml(content) };
66
+ } catch (error) {
67
+ const message = getErrorMessage(error);
68
+ return { ok: false, error: new ParseError(`Failed to load papers registry: ${message}`) };
69
+ }
70
+ }
71
+ async function savePapersRegistry(registry, rootDir) {
72
+ const root = rootDir ?? process.cwd();
73
+ const filePath = join(root, REGISTRY_PATH, PAPERS_FILE);
74
+ const pathValidation = validatePath(filePath, root);
75
+ if (!pathValidation.ok) {
76
+ return pathValidation;
77
+ }
78
+ try {
79
+ const content = stringifyYaml(registry, { lineWidth: 100 });
80
+ await fs.writeFile(pathValidation.value, content, "utf-8");
81
+ return { ok: true, value: void 0 };
82
+ } catch (error) {
83
+ const message = getErrorMessage(error);
84
+ return { ok: false, error: new ParseError(`Failed to save papers registry: ${message}`) };
85
+ }
86
+ }
87
+
88
+ // src/cli/research-alignment-map.ts
89
+ var TECHNIQUE_IMPLEMENTATION_MAP = /* @__PURE__ */ new Map([
90
+ // Routing techniques
91
+ ["linucb-routing", { status: "implemented", path: "cli-adapters/linucb-bandit.ts" }],
92
+ ["topsis-routing", { status: "implemented", path: "cli-adapters/topsis-router.ts" }],
93
+ [
94
+ "cascade-routing",
95
+ { status: "implemented", path: "routing/stages/confidence-cascade-stage.ts" }
96
+ ],
97
+ [
98
+ "complexity-based-routing",
99
+ { status: "implemented", path: "routing/stages/confidence-cascade-stage.ts" }
100
+ ],
101
+ [
102
+ "moe-routing",
103
+ {
104
+ status: "implemented",
105
+ path: "cli-adapters/composite-router.ts",
106
+ hint: "5-stage composite routing selects among specialized CLI experts based on task features"
107
+ }
108
+ ],
109
+ ["two-stage-routing", { status: "implemented", path: "cli-adapters/composite-router-stages.ts" }],
110
+ [
111
+ "capability-instruction-tuning",
112
+ {
113
+ status: "partial",
114
+ path: "routing/stages/capability-match-stage.ts",
115
+ hint: "Static capability profiles, not instruction-tuned"
116
+ }
117
+ ],
118
+ [
119
+ "knn-routing",
120
+ {
121
+ status: "implemented",
122
+ path: "routing/stages/knn-routing-stage.ts",
123
+ hint: "KnnRoutingStage: cosine similarity over keyword vectors, K-nearest experience patterns, weighted by success rate"
124
+ }
125
+ ],
126
+ ["pilot-budget-routing", { status: "implemented", path: "cli-adapters/budget-router.ts" }],
127
+ [
128
+ "tolerance-routing",
129
+ {
130
+ status: "implemented",
131
+ path: "cli-adapters/composite-router-helpers.ts",
132
+ hint: "TOPSIS_TOLERANCE_BAND_PERCENT (5%) identifies quality-equivalent candidates after TOPSIS ranking"
133
+ }
134
+ ],
135
+ [
136
+ "sater-routing",
137
+ {
138
+ status: "implemented",
139
+ path: "routing/stages/quality-constraint-stage.ts",
140
+ hint: "QualityConstraintStage filters models by min quality (0.7), max cost, max latency before selection"
141
+ }
142
+ ],
143
+ [
144
+ "preference-trained-routing",
145
+ { status: "implemented", path: "cli-adapters/preference-router.ts" }
146
+ ],
147
+ [
148
+ "strmac-state-routing",
149
+ {
150
+ status: "implemented",
151
+ path: "context/routing-memory.ts",
152
+ hint: "RoutingMemory maintains state across calls (profile, experience, action cache) feeding LinUCB + weather bonus stages"
153
+ }
154
+ ],
155
+ [
156
+ "cross-attention-routing",
157
+ {
158
+ status: "implemented",
159
+ path: "routing/stages/capability-match-stage.ts",
160
+ hint: "AttentionMatrix maps task features to capability weights (configurable cross-attention)"
161
+ }
162
+ ],
163
+ // Consensus techniques
164
+ ["consensus-protocol", { status: "implemented", path: "consensus/engine.ts" }],
165
+ ["majority-voting", { status: "implemented", path: "consensus/engine.ts" }],
166
+ ["higher-order-voting", { status: "implemented", path: "consensus/higher-order-strategy.ts" }],
167
+ [
168
+ "anti-conformity-weighting",
169
+ { status: "implemented", path: "consensus/higher-order-strategy.ts" }
170
+ ],
171
+ [
172
+ "agreement-based-cascading",
173
+ {
174
+ status: "implemented",
175
+ path: "consensus/engine.ts",
176
+ hint: "canCascadeEarly() closes proposals when outcome is mathematically determined"
177
+ }
178
+ ],
179
+ [
180
+ "incremental-quorum",
181
+ {
182
+ status: "implemented",
183
+ path: "consensus/incremental-quorum.ts",
184
+ hint: "Ambiguity detection + voter expansion via VoterExpansionCallback (#1408)"
185
+ }
186
+ ],
187
+ [
188
+ "aegean-consensus",
189
+ { status: "partial", path: "consensus/engine.ts", hint: "Byzantine tolerance not implemented" }
190
+ ],
191
+ [
192
+ "cp-wbft-consensus",
193
+ {
194
+ status: "partial",
195
+ path: "consensus/engine.ts",
196
+ hint: "No weighted Byzantine fault tolerance"
197
+ }
198
+ ],
199
+ // Memory techniques
200
+ ["adaptive-memory", { status: "implemented", path: "memory/adaptive/" }],
201
+ ["mirix-six-type-memory", { status: "implemented", path: "memory/typed/" }],
202
+ [
203
+ "mem0-memory-architecture",
204
+ { status: "partial", path: "memory/", hint: "Multi-backend memory but not mem0 pattern" }
205
+ ],
206
+ [
207
+ "graph-based-memory",
208
+ {
209
+ status: "partial",
210
+ path: "memory/belief/",
211
+ hint: "Belief triples are graph-like but not full graph DB"
212
+ }
213
+ ],
214
+ ["experience-memory", { status: "implemented", path: "memory/session/" }],
215
+ ["hindsight-belief-memory", { status: "implemented", path: "memory/belief/" }],
216
+ [
217
+ "profile-memory",
218
+ {
219
+ status: "implemented",
220
+ path: "context/routing-memory.ts",
221
+ hint: "RoutingMemory stores model preferences per task type and feeds recommendations into composite router via PERSISTENCE_AWARE_FLAGS"
222
+ }
223
+ ],
224
+ [
225
+ "action-memory",
226
+ {
227
+ status: "implemented",
228
+ path: "orchestration/outcomes/",
229
+ hint: "OutcomeStore records actions+results+context with query-by-category/CLI/time and cross-session persistence"
230
+ }
231
+ ],
232
+ ["reflection-memory", { status: "implemented", path: "mcp/tools/orchestrate-reflection.ts" }],
233
+ [
234
+ "history-encoding",
235
+ {
236
+ status: "partial",
237
+ path: "context/token-counter.ts",
238
+ hint: "Token counting exists but no learned history encoding"
239
+ }
240
+ ],
241
+ // Orchestration techniques
242
+ [
243
+ "aflow-mcts-workflows",
244
+ {
245
+ status: "partial",
246
+ path: "workflows/aflow/",
247
+ hint: "AFlow scaffolding exists but MCTS not implemented"
248
+ }
249
+ ],
250
+ [
251
+ "dynamic-agent-selection",
252
+ { status: "implemented", path: "orchestration/aorchestra/agent-planner.ts" }
253
+ ],
254
+ ["dynamic-subagent-creation", { status: "implemented", path: "mcp/tools/create-expert.ts" }],
255
+ ["role-based-protocols", { status: "implemented", path: "agents/expert-roles.ts" }],
256
+ [
257
+ "rule-based-coordination",
258
+ { status: "implemented", path: "orchestration/aorchestra/worker-dispatcher.ts" }
259
+ ],
260
+ [
261
+ "temporal-graph-orchestration",
262
+ {
263
+ status: "partial",
264
+ path: "orchestration/graph/",
265
+ hint: "Graph workflows exist but not temporal-aware"
266
+ }
267
+ ],
268
+ [
269
+ "model-based-coordination",
270
+ {
271
+ status: "partial",
272
+ path: "orchestration/aorchestra/",
273
+ hint: "Worker dispatch but not model-based coordination theory"
274
+ }
275
+ ],
276
+ [
277
+ "trinity-roles",
278
+ {
279
+ status: "partial",
280
+ path: "agents/expert-roles.ts",
281
+ hint: "10 expert roles, not trinity pattern"
282
+ }
283
+ ],
284
+ [
285
+ "sew-self-evolving-workflows",
286
+ {
287
+ status: "partial",
288
+ path: "workflows/aflow/",
289
+ hint: "AFlow framework but no self-evolution loop"
290
+ }
291
+ ],
292
+ [
293
+ "scaling-coordination-predictor",
294
+ {
295
+ status: "partial",
296
+ path: "orchestration/aorchestra/agent-planner.ts",
297
+ hint: "Wave sizing but no scaling prediction"
298
+ }
299
+ ],
300
+ // Learning techniques
301
+ [
302
+ "self-refine-loop",
303
+ {
304
+ status: "implemented",
305
+ path: "mcp/tools/orchestrate-dispatch.ts"
306
+ }
307
+ ],
308
+ [
309
+ "recursive-improvement",
310
+ {
311
+ status: "implemented",
312
+ path: "mcp/tools/orchestrate-dispatch.ts"
313
+ }
314
+ ],
315
+ [
316
+ "rl-orchestrator",
317
+ {
318
+ status: "implemented",
319
+ path: "cli-adapters/linucb-bandit.ts",
320
+ hint: "LinUCB contextual bandit actively selects models via explore-exploit in routing pipeline"
321
+ }
322
+ ],
323
+ ["reflexion-verbal-rl", { status: "implemented", path: "mcp/tools/orchestrate-reflection.ts" }],
324
+ // Source-derived techniques (Wave 6 — from open-source project analysis)
325
+ ["failure-lesson-injection", { status: "implemented", path: "orchestration/failure-lessons.ts" }],
326
+ [
327
+ "skill-relevance-matching",
328
+ {
329
+ status: "implemented",
330
+ path: "agents/experts/skill-matcher.ts",
331
+ hint: "Matches task keywords to agent skill descriptions for optimal routing"
332
+ }
333
+ ],
334
+ [
335
+ "context-rot-prevention",
336
+ {
337
+ status: "implemented",
338
+ path: "agents/context-pruner.ts",
339
+ hint: "Token-efficient context pruning prevents quality degradation in long sessions"
340
+ }
341
+ ],
342
+ [
343
+ "wave-based-parallel-execution",
344
+ {
345
+ status: "implemented",
346
+ path: "orchestration/aorchestra/worker-dispatcher.ts",
347
+ hint: "AOrchestra worker dispatch with cross-wave context sharing"
348
+ }
349
+ ],
350
+ [
351
+ "write-time-deduplication",
352
+ {
353
+ status: "implemented",
354
+ path: "mcp/tools/memory-write.ts",
355
+ hint: "Semantic dedup at write time prevents memory bloat"
356
+ }
357
+ ]
358
+ ]);
359
+ var FEATURE_GATE_INVENTORY = [
360
+ {
361
+ envVar: "NEXUS_V2_MODE",
362
+ defaultValue: "full",
363
+ description: "V2 pipeline mode (off/partial/full)",
364
+ techniques: ["two-stage-routing", "cascade-routing"]
365
+ },
366
+ {
367
+ envVar: "NEXUS_AORCHESTRA",
368
+ defaultValue: "true",
369
+ description: "AOrchestra dynamic agent planning",
370
+ techniques: ["dynamic-agent-selection", "model-based-coordination"]
371
+ },
372
+ {
373
+ envVar: "NEXUS_AORCHESTRA_DISPATCH",
374
+ defaultValue: "true",
375
+ description: "AOrchestra worker dispatch",
376
+ techniques: ["rule-based-coordination", "self-refine-loop"]
377
+ },
378
+ {
379
+ envVar: "NEXUS_PERSIST_LEARNING",
380
+ defaultValue: "true",
381
+ description: "Cross-session routing persistence",
382
+ techniques: ["linucb-routing", "preference-trained-routing", "experience-memory"]
383
+ },
384
+ {
385
+ envVar: "NEXUS_REFLECTIVE_MEMORY",
386
+ defaultValue: "shadow",
387
+ description: "Reflective memory retrieval (shadow=default, true=full, false=off)",
388
+ techniques: ["reflection-memory", "adaptive-memory", "reflexion-verbal-rl"]
389
+ },
390
+ {
391
+ envVar: "NEXUS_BILLING_MODE",
392
+ defaultValue: "plan",
393
+ description: "Cost mode (plan=strongest, api=cost-aware)",
394
+ techniques: ["pilot-budget-routing", "topsis-routing"]
395
+ },
396
+ {
397
+ envVar: "NEXUS_WORKER_MAX_CALLS",
398
+ defaultValue: "6",
399
+ description: "Max model calls per orchestrate",
400
+ techniques: ["self-refine-loop", "recursive-improvement"]
401
+ },
402
+ { envVar: "NEXUS_AUTH_ENABLED", defaultValue: "true", description: "Server authentication" },
403
+ { envVar: "NEXUS_EVENTBUS_ENABLED", defaultValue: "true", description: "EventBus A2A bridge" },
404
+ {
405
+ envVar: "NEXUS_RATE_LIMIT_ENABLED",
406
+ defaultValue: "true",
407
+ description: "Token-bucket rate limiter"
408
+ },
409
+ {
410
+ envVar: "NEXUS_CIRCUIT_BREAKER_THRESHOLD",
411
+ defaultValue: "5",
412
+ description: "Circuit breaker failure threshold"
413
+ },
414
+ {
415
+ envVar: "NEXUS_V2_POLICY_MODE",
416
+ defaultValue: "block",
417
+ description: "Policy enforcement (off/warn/block)"
418
+ },
419
+ { envVar: "NEXUS_LOG_LEVEL", defaultValue: "info", description: "Logging verbosity" },
420
+ {
421
+ envVar: "NEXUS_DISABLE_SESSIONS",
422
+ defaultValue: "false",
423
+ description: "Disable session tracking"
424
+ },
425
+ {
426
+ envVar: "NEXUS_DISABLE_METRICS",
427
+ defaultValue: "false",
428
+ description: "Disable metrics tracking"
429
+ },
430
+ {
431
+ envVar: "NEXUS_ALLOW_MOCK_ORCHESTRATION",
432
+ defaultValue: "false",
433
+ description: "Allow mock orchestration (test/CI)"
434
+ },
435
+ {
436
+ envVar: "NEXUS_MAX_CONCURRENT_EXPERTS",
437
+ defaultValue: "6",
438
+ description: "Expert pool semaphore capacity"
439
+ },
440
+ {
441
+ envVar: "NEXUS_VOTE_TIMEOUT_MS",
442
+ defaultValue: "60000",
443
+ description: "Consensus vote timeout override"
444
+ },
445
+ {
446
+ envVar: "NEXUS_EXPERT_TIMEOUT_MS",
447
+ defaultValue: "120000",
448
+ description: "Expert handler timeout override"
449
+ },
450
+ {
451
+ envVar: "NEXUS_WORKER_TIMEOUT_MS",
452
+ defaultValue: "60000",
453
+ description: "Worker subprocess timeout override"
454
+ }
455
+ ];
456
+
457
+ // src/research/topic-aliases.ts
458
+ var TOPIC_ALIASES = {
459
+ // → consensus
460
+ voting: "consensus",
461
+ "consensus-voting": "consensus",
462
+ debate: "consensus",
463
+ quorum: "consensus",
464
+ byzantine: "consensus",
465
+ "anti-conformity": "consensus",
466
+ "agreement-based": "consensus",
467
+ "correlation-aware": "consensus",
468
+ "LLM consensus and multi-agent voting mechanisms": "consensus",
469
+ "tolerance-parameter": "consensus",
470
+ // → routing
471
+ "model-routing": "routing",
472
+ "model routing": "routing",
473
+ "llm-routing": "routing",
474
+ cascade: "routing",
475
+ "cascade-routing": "routing",
476
+ "cost-optimization": "routing",
477
+ "cost-reduction": "routing",
478
+ "model-selection": "routing",
479
+ topsis: "routing",
480
+ linucb: "routing",
481
+ "contextual-bandit": "routing",
482
+ "quality-constrained": "routing",
483
+ "budget-constraints": "routing",
484
+ "unified-routing": "routing",
485
+ "query-model-matching": "routing",
486
+ "adaptive model routing and selection optimization": "routing",
487
+ "multi-model routing optimization": "routing",
488
+ "Single-head cross-attention for query-model matching": "routing",
489
+ "performance-cost-tradeoff": "routing",
490
+ "task-routing": "routing",
491
+ "difficulty-estimation": "routing",
492
+ "score-based": "routing",
493
+ "optimal-weighting": "routing",
494
+ "hierarchical-filtering": "routing",
495
+ "preference-optimization": "routing",
496
+ "preference-data": "routing",
497
+ dpo: "routing",
498
+ "cross-attention": "routing",
499
+ "cma-es": "routing",
500
+ profile: "routing",
501
+ prediction: "routing",
502
+ lightweight: "routing",
503
+ bayesian: "routing",
504
+ "quality-diversity": "routing",
505
+ "resource-optimization": "routing",
506
+ "routing-latency": "routing",
507
+ optimization: "routing",
508
+ "model-merging": "routing",
509
+ "model-zoo": "routing",
510
+ // → memory
511
+ "context-management": "memory",
512
+ "context-compression": "memory",
513
+ "context-control": "memory",
514
+ compression: "memory",
515
+ "kv-cache": "memory",
516
+ "long-context": "memory",
517
+ "long-term-memory": "memory",
518
+ "episodic-memory": "memory",
519
+ "graph-memory": "memory",
520
+ "hierarchical-memory": "memory",
521
+ "agentic-memory": "memory",
522
+ "lifelong-learning": "memory",
523
+ "cross-session-learning": "memory",
524
+ "continual-learning": "memory",
525
+ "self-editing-memory": "memory",
526
+ "six-type-memory": "memory",
527
+ "belief-memory": "memory",
528
+ "belief-state": "memory",
529
+ "action-memory": "memory",
530
+ "memory-evolution": "memory",
531
+ "virtual-context": "memory",
532
+ paging: "memory",
533
+ "prompt-compression": "memory",
534
+ "learned-compression": "memory",
535
+ zettelkasten: "memory",
536
+ "knowledge-distillation": "memory",
537
+ "history-encoding": "memory",
538
+ "ictm-tuple": "memory",
539
+ "latent-space": "memory",
540
+ "vector-db": "memory",
541
+ embedding: "memory",
542
+ "Taxonomy of context management strategies": "memory",
543
+ "Task-specific context compression": "memory",
544
+ "Learned compression modules": "memory",
545
+ rag: "memory",
546
+ "retrieval augmented generation": "memory",
547
+ svd: "memory",
548
+ "svd-mutation": "memory",
549
+ vae: "memory",
550
+ knn: "memory",
551
+ experience: "memory",
552
+ "state-aware": "memory",
553
+ "temporal-graph": "memory",
554
+ versioning: "memory",
555
+ // → code-generation
556
+ "code-repair": "code-generation",
557
+ "code-agent": "code-generation",
558
+ "code-review": "code-generation",
559
+ "software-engineering": "code-generation",
560
+ "swe-bench": "code-generation",
561
+ "self-improvement": "code-generation",
562
+ "self-evolving": "code-generation",
563
+ "self-debug": "code-generation",
564
+ "self-modification": "code-generation",
565
+ "skill-library": "code-generation",
566
+ "skill-discovery": "code-generation",
567
+ "code review benchmarks": "code-generation",
568
+ "code generation evaluation": "code-generation",
569
+ "execution-feedback": "code-generation",
570
+ // → cli-tools
571
+ mcp: "cli-tools",
572
+ "MCP protocol": "cli-tools",
573
+ "MCP security": "cli-tools",
574
+ "MCP Security": "cli-tools",
575
+ "mcp-applications": "cli-tools",
576
+ "model-context-protocol": "cli-tools",
577
+ puppeteer: "cli-tools",
578
+ streaming: "cli-tools",
579
+ integration: "cli-tools",
580
+ // → orchestration
581
+ "multi-agent": "orchestration",
582
+ "multi-agent-systems": "orchestration",
583
+ "multi-agent orchestration": "orchestration",
584
+ "Multi-Agent Orchestration": "orchestration",
585
+ "multi-agent-orchestration": "orchestration",
586
+ "multi-agent coordination": "orchestration",
587
+ "multi-agent-coordination": "orchestration",
588
+ "multi-agent-worker-dispatch": "orchestration",
589
+ "multi-agent reliability": "orchestration",
590
+ "multi-agent-rl": "orchestration",
591
+ coordination: "orchestration",
592
+ coordinator: "orchestration",
593
+ collaboration: "orchestration",
594
+ "graph-orchestration": "orchestration",
595
+ "agent architecture": "orchestration",
596
+ "dynamic-agent-creation": "orchestration",
597
+ "specialized-agents": "orchestration",
598
+ "thinker-worker-verifier": "orchestration",
599
+ "two-agent": "orchestration",
600
+ "meta-agent": "orchestration",
601
+ agents: "orchestration",
602
+ "workflow-optimization": "orchestration",
603
+ "workflow-generation": "orchestration",
604
+ "agent-communication": "orchestration",
605
+ "inter-agent": "orchestration",
606
+ "gvu-operator": "orchestration",
607
+ "rubber-duck": "orchestration",
608
+ "parallel-exploration": "orchestration",
609
+ kubernetes: "orchestration",
610
+ "scale-to-zero": "orchestration",
611
+ edge: "orchestration",
612
+ llm: "orchestration",
613
+ multimodal: "orchestration",
614
+ production: "orchestration",
615
+ hybrid: "orchestration",
616
+ "automatic-discovery": "orchestration",
617
+ roadmap: "orchestration",
618
+ // → security
619
+ "prompt injection defense": "security",
620
+ "inter-agent-security": "security",
621
+ "agent security": "security",
622
+ compliance: "security",
623
+ "formal-verification": "security",
624
+ "formal-safety": "security",
625
+ // → evaluation
626
+ benchmark: "evaluation",
627
+ benchmarking: "evaluation",
628
+ survey: "evaluation",
629
+ "autonomous agent evaluation benchmarks": "evaluation",
630
+ "evaluation-methods": "evaluation",
631
+ "LLM evaluation": "evaluation",
632
+ "hallucination-detection": "evaluation",
633
+ "self-evaluation": "evaluation",
634
+ "confidence-probe": "evaluation",
635
+ "confidence-aware": "evaluation",
636
+ verifier: "evaluation",
637
+ observability: "evaluation",
638
+ theoretical: "evaluation",
639
+ "post-deployment": "evaluation",
640
+ capability: "evaluation",
641
+ "knowledge-gaps": "evaluation",
642
+ helm: "evaluation",
643
+ // → safety
644
+ "agentic-safety": "safety",
645
+ "agentic AI safety": "safety",
646
+ "safety-evaluation": "safety",
647
+ "reward-modeling": "safety",
648
+ "constitutional-ai": "safety",
649
+ "hazard-analysis": "safety",
650
+ stpa: "safety",
651
+ "risk-assessment": "safety",
652
+ "fault-tolerance": "safety",
653
+ "ai-feedback": "safety",
654
+ rlaif: "safety",
655
+ "human-in-the-loop": "safety",
656
+ feedback: "safety",
657
+ "feedback-loop": "safety",
658
+ "feedback-learning": "safety",
659
+ anthropic: "safety",
660
+ // → planning
661
+ "decision-making": "planning",
662
+ "tree-search": "planning",
663
+ "tree-structure": "planning",
664
+ "multi-tree": "planning",
665
+ mcts: "planning",
666
+ backtrack: "planning",
667
+ hindsight: "planning",
668
+ "task-specific": "planning",
669
+ // → tool-use
670
+ "tool use": "tool-use",
671
+ "tool-augmented reasoning and function calling": "tool-use",
672
+ "tool routing optimization": "tool-use",
673
+ "dynamic-linking": "tool-use",
674
+ "Sparse outcome rewards reduce tool calls by 72%": "tool-use",
675
+ // → reasoning
676
+ "test-time": "reasoning",
677
+ "test-time-scaling": "reasoning",
678
+ "inference-scaling": "reasoning",
679
+ "inference-optimization": "reasoning",
680
+ "self-critique": "reasoning",
681
+ "self-reflection": "reasoning",
682
+ "self-referential": "reasoning",
683
+ "self-play": "reasoning",
684
+ reflexion: "reasoning",
685
+ reflection: "reasoning",
686
+ "reasoning-optimization": "reasoning",
687
+ "meta-thinking": "reasoning",
688
+ scaling: "reasoning",
689
+ recursive: "reasoning",
690
+ "trajectory-abstraction": "reasoning",
691
+ "verbal-rl": "reasoning",
692
+ exploration: "reasoning",
693
+ "Reducible uncertainty modeling across agent trajectories": "reasoning",
694
+ "Environmental feedback reduces uncertainty at decision gates": "reasoning",
695
+ "reinforcement-learning": "reasoning",
696
+ transformer: "reasoning",
697
+ ssm: "reasoning",
698
+ "sparse-activation": "reasoning",
699
+ "behavior-distillation": "reasoning",
700
+ "training-free": "reasoning",
701
+ "transfer-learning": "reasoning",
702
+ "instruction-tuning": "reasoning",
703
+ "Dense process rewards improve performance by 22%": "reasoning",
704
+ "prompt-optimization": "reasoning"
705
+ };
706
+ function normalizeTopicToCanonical(topic) {
707
+ return TOPIC_ALIASES[topic] ?? topic;
708
+ }
709
+
710
+ // src/cli/research-helpers-synthesize.ts
711
+ var MIN_CROSS_CUTTING_CLUSTER_SIZE = 2;
712
+ var CROSS_CUTTING_TAG_THRESHOLD = 3;
713
+ async function synthesizeResearch(topicFilter) {
714
+ const registryResult = await loadPapersRegistry();
715
+ if (!registryResult.ok) {
716
+ return {
717
+ ok: false,
718
+ error: {
719
+ code: "LOAD_ERROR",
720
+ message: `Failed to load papers: ${getErrorMessage(registryResult.error)}`
721
+ }
722
+ };
723
+ }
724
+ const papers = extractPapers(registryResult.value);
725
+ if (papers.length === 0) {
726
+ return {
727
+ ok: false,
728
+ error: { code: "NO_PAPERS", message: "No papers found in registry" }
729
+ };
730
+ }
731
+ const clusters = groupByTopic(papers);
732
+ const filtered = topicFilter !== void 0 ? clusters.filter((c) => c.topic === topicFilter) : clusters;
733
+ const syntheses = filtered.map(synthesizeCluster);
734
+ const crossCutting = findCrossCuttingThemes(filtered);
735
+ const alignmentSummary = buildAlignmentSummary(syntheses);
736
+ const featureGates = buildFeatureGateSummary();
737
+ return {
738
+ ok: true,
739
+ value: {
740
+ clusters: syntheses,
741
+ totalPapers: papers.length,
742
+ topicCount: filtered.length,
743
+ crossCuttingThemes: crossCutting,
744
+ alignmentSummary,
745
+ featureGates
746
+ }
747
+ };
748
+ }
749
+ function safeArray(value) {
750
+ if (value === null || value === void 0) return [];
751
+ return Array.from(value);
752
+ }
753
+ function extractPapers(registry) {
754
+ return Object.entries(registry.papers).map(([id, p]) => ({
755
+ id,
756
+ title: p.title,
757
+ topics: safeArray(p.topics),
758
+ tags: safeArray(p.tags),
759
+ summary: p.summary.trim(),
760
+ keyFindings: safeArray(p.key_findings),
761
+ relevance: p.relevance,
762
+ implementationStatus: p.implementation_status,
763
+ techniquesExtracted: safeArray(p.techniques_extracted),
764
+ qualityScore: p.quality_score ?? 0,
765
+ evidenceTier: p.evidence_tier ?? "low"
766
+ }));
767
+ }
768
+ function groupByTopic(papers) {
769
+ const topicMap = /* @__PURE__ */ new Map();
770
+ for (const paper of papers) {
771
+ for (const rawTopic of paper.topics) {
772
+ const topic = normalizeTopicToCanonical(rawTopic);
773
+ const existing = topicMap.get(topic);
774
+ if (existing !== void 0) {
775
+ existing.push(paper);
776
+ } else {
777
+ topicMap.set(topic, [paper]);
778
+ }
779
+ }
780
+ }
781
+ const clusters = [];
782
+ for (const [topic, unsortedPapers] of topicMap) {
783
+ const topicPapers = [...unsortedPapers].sort((a, b) => b.qualityScore - a.qualityScore);
784
+ clusters.push({
785
+ topic,
786
+ papers: topicPapers,
787
+ paperCount: topicPapers.length
788
+ });
789
+ }
790
+ return clusters.sort((a, b) => b.paperCount - a.paperCount);
791
+ }
792
+ function computeClusterQuality(papers) {
793
+ const scores = papers.map((p) => p.qualityScore);
794
+ const totalScore = scores.reduce((sum, s) => sum + s, 0);
795
+ return {
796
+ avgScore: scores.length > 0 ? Math.round(totalScore / scores.length * 10) / 10 : 0,
797
+ high: papers.filter((p) => p.evidenceTier === "high").length,
798
+ medium: papers.filter((p) => p.evidenceTier === "medium").length,
799
+ low: papers.filter((p) => p.evidenceTier === "low").length
800
+ };
801
+ }
802
+ function synthesizeCluster(cluster) {
803
+ const allTags = collectFrequencies(cluster.papers.flatMap((p) => [...p.tags]));
804
+ const allTechniques = collectFrequencies(
805
+ cluster.papers.flatMap((p) => [...p.techniquesExtracted])
806
+ );
807
+ const allFindings = cluster.papers.flatMap((p) => [...p.keyFindings]);
808
+ const commonThemes = [...allTags.entries()].filter(([, count]) => count >= MIN_CROSS_CUTTING_CLUSTER_SIZE).sort((a, b) => b[1] - a[1]).map(([tag]) => tag);
809
+ const techniques = [...allTechniques.entries()].sort((a, b) => b[1] - a[1]).map(([tech, count]) => count > 1 ? `${tech} (${String(count)} papers)` : tech);
810
+ const notStarted = cluster.papers.filter((p) => p.implementationStatus === "not-started").flatMap((p) => [...p.techniquesExtracted]);
811
+ const uniqueOpportunities = [...new Set(notStarted)];
812
+ const gaps = [];
813
+ if (cluster.paperCount === 1) {
814
+ gaps.push(`Only 1 paper \u2014 more research needed on ${cluster.topic}`);
815
+ }
816
+ const highRelevanceUnimplemented = cluster.papers.filter(
817
+ (p) => p.relevance === "high" && p.implementationStatus === "not-started"
818
+ );
819
+ if (highRelevanceUnimplemented.length > 0) {
820
+ gaps.push(
821
+ `${String(highRelevanceUnimplemented.length)} high-relevance paper(s) not yet implemented`
822
+ );
823
+ }
824
+ const allTechNames = [...allTechniques.keys()];
825
+ const alignedTechniques = analyzeClusterAlignment(allTechNames);
826
+ const qualityDistribution = computeClusterQuality(cluster.papers);
827
+ if (qualityDistribution.low > qualityDistribution.high + qualityDistribution.medium) {
828
+ gaps.push(
829
+ `Mostly low-evidence papers (${String(qualityDistribution.low)}/${String(cluster.paperCount)}) \u2014 findings need stronger validation`
830
+ );
831
+ }
832
+ return {
833
+ topic: cluster.topic,
834
+ paperCount: cluster.paperCount,
835
+ papers: cluster.papers.map((p) => p.title),
836
+ commonThemes,
837
+ keyInsights: deduplicateFindings(allFindings).slice(0, 10),
838
+ techniques,
839
+ implementationOpportunities: uniqueOpportunities,
840
+ gaps,
841
+ alignedTechniques,
842
+ qualityDistribution
843
+ };
844
+ }
845
+ function findCrossCuttingThemes(clusters) {
846
+ const tagToTopics = /* @__PURE__ */ new Map();
847
+ for (const cluster of clusters) {
848
+ for (const paper of cluster.papers) {
849
+ for (const tag of paper.tags) {
850
+ const existing = tagToTopics.get(tag);
851
+ if (existing !== void 0) {
852
+ existing.add(cluster.topic);
853
+ } else {
854
+ tagToTopics.set(tag, /* @__PURE__ */ new Set([cluster.topic]));
855
+ }
856
+ }
857
+ }
858
+ }
859
+ return [...tagToTopics.entries()].filter(([, topics]) => topics.size >= CROSS_CUTTING_TAG_THRESHOLD).sort((a, b) => b[1].size - a[1].size).map(([tag, topics]) => `${tag} (spans: ${[...topics].join(", ")})`);
860
+ }
861
+ function analyzeClusterAlignment(techniques) {
862
+ const alignments = [];
863
+ for (const tech of techniques) {
864
+ const baseTech = tech.replace(/\s*\(\d+\s*papers?\)$/, "");
865
+ const mapping = TECHNIQUE_IMPLEMENTATION_MAP.get(baseTech);
866
+ if (mapping !== void 0) {
867
+ alignments.push({
868
+ technique: baseTech,
869
+ status: mapping.status,
870
+ canonicalPath: mapping.path,
871
+ ...mapping.hint !== void 0 ? { improvementHint: mapping.hint } : {}
872
+ });
873
+ } else {
874
+ alignments.push({ technique: baseTech, status: "not-started" });
875
+ }
876
+ }
877
+ return alignments;
878
+ }
879
+ function buildAlignmentSummary(clusters) {
880
+ const allAlignments = clusters.flatMap((c) => c.alignedTechniques);
881
+ const implemented = allAlignments.filter((a) => a.status === "implemented").length;
882
+ const partial = allAlignments.filter((a) => a.status === "partial").length;
883
+ const notStarted = allAlignments.filter((a) => a.status === "not-started").length;
884
+ const opportunities = allAlignments.filter((a) => a.status === "partial" && a.improvementHint !== void 0).map((a) => `${a.technique}: ${a.improvementHint ?? ""}`).slice(0, 10);
885
+ return {
886
+ implemented,
887
+ partial,
888
+ notStarted,
889
+ total: allAlignments.length,
890
+ topOpportunities: opportunities
891
+ };
892
+ }
893
+ function buildFeatureGateSummary() {
894
+ return FEATURE_GATE_INVENTORY.map((g) => ({
895
+ envVar: g.envVar,
896
+ defaultValue: g.defaultValue,
897
+ description: g.description,
898
+ linkedTechniqueCount: g.techniques?.length ?? 0
899
+ }));
900
+ }
901
+ function collectFrequencies(items) {
902
+ const counts = /* @__PURE__ */ new Map();
903
+ for (const item of items) {
904
+ counts.set(item, (counts.get(item) ?? 0) + 1);
905
+ }
906
+ return counts;
907
+ }
908
+ function deduplicateFindings(findings) {
909
+ const seen = /* @__PURE__ */ new Set();
910
+ const result = [];
911
+ for (const finding of findings) {
912
+ const normalized = finding.toLowerCase().trim();
913
+ if (normalized.length === 0) continue;
914
+ if (seen.has(normalized)) continue;
915
+ seen.add(normalized);
916
+ result.push(finding);
917
+ }
918
+ return result;
919
+ }
920
+
921
+ export {
922
+ resolveInsideRoot,
923
+ REGISTRY_PATH,
924
+ getProjectRoot,
925
+ loadTechniquesRegistry,
926
+ loadPapersRegistry,
927
+ savePapersRegistry,
928
+ normalizeTopicToCanonical,
929
+ synthesizeResearch
930
+ };
931
+ //# sourceMappingURL=chunk-GX436VRU.js.map