nexus-agents 2.77.12 → 2.78.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 (131) hide show
  1. package/dist/{child-mcp-config-MJMUF7TL.js → child-mcp-config-CTO2MBRM.js} +3 -4
  2. package/dist/{child-mcp-config-MJMUF7TL.js.map → child-mcp-config-CTO2MBRM.js.map} +1 -1
  3. package/dist/{chunk-YJ2IGAD2.js → chunk-2UYTFLMO.js} +2 -2
  4. package/dist/{chunk-6AY5DK4E.js → chunk-2YPG6PDG.js} +3 -3
  5. package/dist/{chunk-3VWMM6UF.js → chunk-3NIPH6UP.js} +2 -2
  6. package/dist/{chunk-L3TPDTP3.js → chunk-4N33QZLH.js} +13 -15
  7. package/dist/{chunk-L3TPDTP3.js.map → chunk-4N33QZLH.js.map} +1 -1
  8. package/dist/{chunk-JN6UWGHH.js → chunk-5O6XLBPP.js} +2 -2
  9. package/dist/{chunk-ERWXGXV2.js → chunk-6TFTVW77.js} +3 -3
  10. package/dist/{chunk-2IAWMNNB.js → chunk-6WBTNZAY.js} +183 -87
  11. package/dist/chunk-6WBTNZAY.js.map +1 -0
  12. package/dist/{chunk-GOT7OAL5.js → chunk-7BMOZJYS.js} +29 -5
  13. package/dist/chunk-7BMOZJYS.js.map +1 -0
  14. package/dist/{chunk-C2LLQ6TW.js → chunk-7XCUZI4G.js} +4 -4
  15. package/dist/chunk-7XCUZI4G.js.map +1 -0
  16. package/dist/{chunk-TDV5ALHY.js → chunk-D6TM2VHX.js} +3 -3
  17. package/dist/{chunk-PWTJGGKB.js → chunk-DLXT23AC.js} +2 -2
  18. package/dist/chunk-DNO2INX5.js +276 -0
  19. package/dist/chunk-DNO2INX5.js.map +1 -0
  20. package/dist/{chunk-G2CSKBY5.js → chunk-FJWWSVWB.js} +29 -6
  21. package/dist/chunk-FJWWSVWB.js.map +1 -0
  22. package/dist/{chunk-DSQ5XM4O.js → chunk-FVPYP5DD.js} +4 -4
  23. package/dist/{chunk-MGLWPN2I.js → chunk-GONMG4NM.js} +2 -2
  24. package/dist/{chunk-XYA3DPWJ.js → chunk-GTGDVBLW.js} +5 -5
  25. package/dist/{chunk-YQMQSJQK.js → chunk-HYU4GZY6.js} +2 -2
  26. package/dist/{chunk-3DH5SLFH.js → chunk-K2QILJG4.js} +6 -6
  27. package/dist/{chunk-5WHWKY32.js → chunk-KT5FIBWS.js} +2 -2
  28. package/dist/{chunk-DIB6V67T.js → chunk-L6SCKLGO.js} +3 -3
  29. package/dist/{chunk-IPWCD22D.js → chunk-PLX6FCFC.js} +2 -2
  30. package/dist/chunk-PQHVC4BD.js +639 -0
  31. package/dist/chunk-PQHVC4BD.js.map +1 -0
  32. package/dist/chunk-Q5CFPIJ5.js +5581 -0
  33. package/dist/chunk-Q5CFPIJ5.js.map +1 -0
  34. package/dist/{chunk-G6ZPVADX.js → chunk-SD76JZBG.js} +2 -2
  35. package/dist/{chunk-Y2CP4Z5B.js → chunk-SWFJU3W2.js} +220 -4580
  36. package/dist/chunk-SWFJU3W2.js.map +1 -0
  37. package/dist/{chunk-3MRM53T4.js → chunk-WDYCIJWN.js} +640 -470
  38. package/dist/chunk-WDYCIJWN.js.map +1 -0
  39. package/dist/{chunk-CM3TORGV.js → chunk-YXWGEIQR.js} +2 -2
  40. package/dist/{chunk-7NK7BTWP.js → chunk-ZVCED4Z4.js} +2 -2
  41. package/dist/cli-circuit-breaker-I74ZQ44Q.js +13 -0
  42. package/dist/cli.js +109 -58
  43. package/dist/cli.js.map +1 -1
  44. package/dist/{composite-router-S6E26BCI.js → composite-router-V3OC57IE.js} +3 -4
  45. package/dist/consensus-vote-ESFPGEJE.js +30 -0
  46. package/dist/context-retriever-MB3D7KS6.js +18 -0
  47. package/dist/dist-NIXVXYIH.js +42 -0
  48. package/dist/doctor-deep-KQ765XZA.js +12 -0
  49. package/dist/expert-bridge-JKLC57IC.js +10 -0
  50. package/dist/factory-BUUXNGIB.js +14 -0
  51. package/dist/{factory-X3VKIGKP.js → factory-LHHYDVZX.js} +5 -6
  52. package/dist/index.d.ts +72 -8
  53. package/dist/index.js +208 -316
  54. package/dist/index.js.map +1 -1
  55. package/dist/{init-opencode-CFE7M6XA.js → init-opencode-GXZN2W5S.js} +6 -7
  56. package/dist/{init-opencode-CFE7M6XA.js.map → init-opencode-GXZN2W5S.js.map} +1 -1
  57. package/dist/issue-triage-RMXPDZ2K.js +15 -0
  58. package/dist/{learning-persistence-N6ILD2HX.js → learning-persistence-Q3HTOGTU.js} +2 -3
  59. package/dist/outcome-store-adapter-QRFJJIKB.js +57 -0
  60. package/dist/outcome-store-adapter-QRFJJIKB.js.map +1 -0
  61. package/dist/{registry-command-RPPC7N2K.js → registry-command-6E4YKAMT.js} +3 -4
  62. package/dist/{registry-command-RPPC7N2K.js.map → registry-command-6E4YKAMT.js.map} +1 -1
  63. package/dist/{repo-security-plan-7ZCDVH5O.js → repo-security-plan-AGRU72DL.js} +4 -5
  64. package/dist/research-helpers-synthesize-K2UCJQQG.js +13 -0
  65. package/dist/{routing-memory-5VTX7LQX.js → routing-memory-3B6DDZ76.js} +3 -4
  66. package/dist/{session-memory-7XBV6BMY.js → session-memory-L7EQIY2O.js} +4 -5
  67. package/dist/{setup-command-3ZTEPKDA.js → setup-command-VYV4RFWW.js} +11 -12
  68. package/dist/setup-config-EQT24DD4.js +10 -0
  69. package/dist/{setup-custom-api-WM5W5AY5.js → setup-custom-api-IBDV654K.js} +5 -6
  70. package/dist/{setup-custom-api-WM5W5AY5.js.map → setup-custom-api-IBDV654K.js.map} +1 -1
  71. package/dist/tool-memory-6HCHQLAN.js +19 -0
  72. package/dist/{weather-report-YJMVKJGA.js → weather-report-ER3WUZ7S.js} +3 -4
  73. package/package.json +3 -2
  74. package/dist/adaptive-memory-EI564K4C.js +0 -16
  75. package/dist/chunk-2IAWMNNB.js.map +0 -1
  76. package/dist/chunk-3MRM53T4.js.map +0 -1
  77. package/dist/chunk-BJ2OMC7P.js +0 -944
  78. package/dist/chunk-BJ2OMC7P.js.map +0 -1
  79. package/dist/chunk-C2LLQ6TW.js.map +0 -1
  80. package/dist/chunk-G2CSKBY5.js.map +0 -1
  81. package/dist/chunk-GOT7OAL5.js.map +0 -1
  82. package/dist/chunk-I7ORMAO7.js +0 -32
  83. package/dist/chunk-I7ORMAO7.js.map +0 -1
  84. package/dist/chunk-Y2CP4Z5B.js.map +0 -1
  85. package/dist/cli-circuit-breaker-YX4BWZD5.js +0 -14
  86. package/dist/consensus-vote-MUQ4HPIF.js +0 -30
  87. package/dist/doctor-deep-BRU5ZUJI.js +0 -13
  88. package/dist/expert-bridge-ZPNVLJVN.js +0 -11
  89. package/dist/factory-A7DTCCUY.js +0 -15
  90. package/dist/issue-triage-6XD6CVPB.js +0 -16
  91. package/dist/mobimem-CG2MNS7V.js +0 -14
  92. package/dist/nexus-data-dir-77UO7N6J.js +0 -12
  93. package/dist/research-helpers-synthesize-36TUTUUA.js +0 -14
  94. package/dist/setup-config-EI5KROA3.js +0 -11
  95. /package/dist/{chunk-YJ2IGAD2.js.map → chunk-2UYTFLMO.js.map} +0 -0
  96. /package/dist/{chunk-6AY5DK4E.js.map → chunk-2YPG6PDG.js.map} +0 -0
  97. /package/dist/{chunk-3VWMM6UF.js.map → chunk-3NIPH6UP.js.map} +0 -0
  98. /package/dist/{chunk-JN6UWGHH.js.map → chunk-5O6XLBPP.js.map} +0 -0
  99. /package/dist/{chunk-ERWXGXV2.js.map → chunk-6TFTVW77.js.map} +0 -0
  100. /package/dist/{chunk-TDV5ALHY.js.map → chunk-D6TM2VHX.js.map} +0 -0
  101. /package/dist/{chunk-PWTJGGKB.js.map → chunk-DLXT23AC.js.map} +0 -0
  102. /package/dist/{chunk-DSQ5XM4O.js.map → chunk-FVPYP5DD.js.map} +0 -0
  103. /package/dist/{chunk-MGLWPN2I.js.map → chunk-GONMG4NM.js.map} +0 -0
  104. /package/dist/{chunk-XYA3DPWJ.js.map → chunk-GTGDVBLW.js.map} +0 -0
  105. /package/dist/{chunk-YQMQSJQK.js.map → chunk-HYU4GZY6.js.map} +0 -0
  106. /package/dist/{chunk-3DH5SLFH.js.map → chunk-K2QILJG4.js.map} +0 -0
  107. /package/dist/{chunk-5WHWKY32.js.map → chunk-KT5FIBWS.js.map} +0 -0
  108. /package/dist/{chunk-DIB6V67T.js.map → chunk-L6SCKLGO.js.map} +0 -0
  109. /package/dist/{chunk-IPWCD22D.js.map → chunk-PLX6FCFC.js.map} +0 -0
  110. /package/dist/{chunk-G6ZPVADX.js.map → chunk-SD76JZBG.js.map} +0 -0
  111. /package/dist/{chunk-CM3TORGV.js.map → chunk-YXWGEIQR.js.map} +0 -0
  112. /package/dist/{chunk-7NK7BTWP.js.map → chunk-ZVCED4Z4.js.map} +0 -0
  113. /package/dist/{adaptive-memory-EI564K4C.js.map → cli-circuit-breaker-I74ZQ44Q.js.map} +0 -0
  114. /package/dist/{cli-circuit-breaker-YX4BWZD5.js.map → composite-router-V3OC57IE.js.map} +0 -0
  115. /package/dist/{composite-router-S6E26BCI.js.map → consensus-vote-ESFPGEJE.js.map} +0 -0
  116. /package/dist/{consensus-vote-MUQ4HPIF.js.map → context-retriever-MB3D7KS6.js.map} +0 -0
  117. /package/dist/{doctor-deep-BRU5ZUJI.js.map → dist-NIXVXYIH.js.map} +0 -0
  118. /package/dist/{expert-bridge-ZPNVLJVN.js.map → doctor-deep-KQ765XZA.js.map} +0 -0
  119. /package/dist/{factory-A7DTCCUY.js.map → expert-bridge-JKLC57IC.js.map} +0 -0
  120. /package/dist/{factory-X3VKIGKP.js.map → factory-BUUXNGIB.js.map} +0 -0
  121. /package/dist/{issue-triage-6XD6CVPB.js.map → factory-LHHYDVZX.js.map} +0 -0
  122. /package/dist/{learning-persistence-N6ILD2HX.js.map → issue-triage-RMXPDZ2K.js.map} +0 -0
  123. /package/dist/{mobimem-CG2MNS7V.js.map → learning-persistence-Q3HTOGTU.js.map} +0 -0
  124. /package/dist/{nexus-data-dir-77UO7N6J.js.map → repo-security-plan-AGRU72DL.js.map} +0 -0
  125. /package/dist/{repo-security-plan-7ZCDVH5O.js.map → research-helpers-synthesize-K2UCJQQG.js.map} +0 -0
  126. /package/dist/{research-helpers-synthesize-36TUTUUA.js.map → routing-memory-3B6DDZ76.js.map} +0 -0
  127. /package/dist/{routing-memory-5VTX7LQX.js.map → session-memory-L7EQIY2O.js.map} +0 -0
  128. /package/dist/{session-memory-7XBV6BMY.js.map → setup-command-VYV4RFWW.js.map} +0 -0
  129. /package/dist/{setup-command-3ZTEPKDA.js.map → setup-config-EQT24DD4.js.map} +0 -0
  130. /package/dist/{setup-config-EI5KROA3.js.map → tool-memory-6HCHQLAN.js.map} +0 -0
  131. /package/dist/{weather-report-YJMVKJGA.js.map → weather-report-ER3WUZ7S.js.map} +0 -0
@@ -7,7 +7,7 @@ import {
7
7
  err,
8
8
  getErrorMessage,
9
9
  ok
10
- } from "./chunk-3MRM53T4.js";
10
+ } from "./chunk-WDYCIJWN.js";
11
11
 
12
12
  // src/cli/research-helpers-synthesize.ts
13
13
  import { z } from "zod";
@@ -1015,4 +1015,4 @@ export {
1015
1015
  AttributedInsightSchema,
1016
1016
  synthesizeResearch
1017
1017
  };
1018
- //# sourceMappingURL=chunk-JN6UWGHH.js.map
1018
+ //# sourceMappingURL=chunk-5O6XLBPP.js.map
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  GitHubProvider,
3
3
  ScmError
4
- } from "./chunk-G6ZPVADX.js";
4
+ } from "./chunk-SD76JZBG.js";
5
5
  import {
6
6
  CACHE_TIMEOUTS,
7
7
  createLogger,
8
8
  err,
9
9
  getTimeProvider,
10
10
  ok
11
- } from "./chunk-3MRM53T4.js";
11
+ } from "./chunk-WDYCIJWN.js";
12
12
 
13
13
  // src/security/trust-types.ts
14
14
  import { z } from "zod";
@@ -1656,4 +1656,4 @@ export {
1656
1656
  IssueTriage,
1657
1657
  createIssueTriage
1658
1658
  };
1659
- //# sourceMappingURL=chunk-ERWXGXV2.js.map
1659
+ //# sourceMappingURL=chunk-6TFTVW77.js.map
@@ -1,15 +1,17 @@
1
+ import {
2
+ CodebaseIndex
3
+ } from "./chunk-AP2FD37C.js";
1
4
  import {
2
5
  SharedMemoryStore
3
6
  } from "./chunk-ED6VQWNG.js";
4
7
  import {
5
8
  getTokenEnvVars,
6
9
  resolveToken
7
- } from "./chunk-MGLWPN2I.js";
10
+ } from "./chunk-GONMG4NM.js";
8
11
  import {
9
12
  executeExpert
10
- } from "./chunk-3DH5SLFH.js";
13
+ } from "./chunk-K2QILJG4.js";
11
14
  import {
12
- DEFAULT_RELEVANCE_CONFIG,
13
15
  EventTopics,
14
16
  NOOP_NOTIFIER,
15
17
  RateLimiter,
@@ -19,12 +21,9 @@ import {
19
21
  createEvent,
20
22
  createMcpNotifier,
21
23
  createSecureHandler,
22
- generateHyphenId,
23
- generateUUID,
24
24
  getGlobalEventBus,
25
25
  getGlobalRegistry,
26
26
  getToolAnnotations,
27
- getToolMemory,
28
27
  getToolTimeout,
29
28
  isRateLimitError,
30
29
  toSdkCallback,
@@ -37,7 +36,7 @@ import {
37
36
  withAccessPolicy,
38
37
  withProgressHeartbeat,
39
38
  wrapToolWithTimeout
40
- } from "./chunk-Y2CP4Z5B.js";
39
+ } from "./chunk-SWFJU3W2.js";
41
40
  import {
42
41
  REGISTRY_PATH,
43
42
  getProjectRoot,
@@ -46,37 +45,52 @@ import {
46
45
  normalizeTopicToCanonical,
47
46
  savePapersRegistry,
48
47
  synthesizeResearch
49
- } from "./chunk-JN6UWGHH.js";
48
+ } from "./chunk-5O6XLBPP.js";
50
49
  import {
51
50
  IssueTriage,
52
51
  sanitizeInput
53
- } from "./chunk-ERWXGXV2.js";
52
+ } from "./chunk-6TFTVW77.js";
54
53
  import {
55
54
  generateSecurityPlan
56
- } from "./chunk-G2CSKBY5.js";
55
+ } from "./chunk-FJWWSVWB.js";
57
56
  import {
58
57
  analyzeGitHubRepo
59
58
  } from "./chunk-7J7PNOJQ.js";
60
- import {
61
- CodebaseIndex
62
- } from "./chunk-AP2FD37C.js";
63
59
  import {
64
60
  extractSymbolIndex,
65
61
  extractSymbols
66
62
  } from "./chunk-BQ4YXGGQ.js";
63
+ import {
64
+ getContextForTask,
65
+ inferTaskCategory,
66
+ summarizeContextForPrompt
67
+ } from "./chunk-DNO2INX5.js";
68
+ import {
69
+ DEFAULT_RELEVANCE_CONFIG,
70
+ MemoryImportance,
71
+ calculateTextJaccardSimilarity,
72
+ generateHyphenId,
73
+ generateUUID,
74
+ getToolMemory
75
+ } from "./chunk-Q5CFPIJ5.js";
67
76
  import {
68
77
  DEFAULT_TASK_TTL_MS,
69
78
  DEFAULT_TOOL_RATE_LIMITS,
70
79
  clampTaskTtl,
71
80
  getAvailabilityCache,
72
81
  resolveFallback
73
- } from "./chunk-L3TPDTP3.js";
82
+ } from "./chunk-4N33QZLH.js";
74
83
  import {
75
84
  DEFAULTS
76
- } from "./chunk-YQMQSJQK.js";
85
+ } from "./chunk-HYU4GZY6.js";
77
86
  import {
78
87
  resolveInsideRoot
79
88
  } from "./chunk-NUBSJGQZ.js";
89
+ import {
90
+ STOPWORDS,
91
+ capitalizeWords,
92
+ truncateWithInfo
93
+ } from "./chunk-633WH2ML.js";
80
94
  import {
81
95
  CliDetectionCache,
82
96
  asRecord,
@@ -84,7 +98,7 @@ import {
84
98
  getAvailableClis,
85
99
  sleep,
86
100
  withTimeout
87
- } from "./chunk-TDV5ALHY.js";
101
+ } from "./chunk-D6TM2VHX.js";
88
102
  import {
89
103
  BUILT_IN_EXPERTS,
90
104
  BuiltInExpertTypeSchema,
@@ -92,17 +106,11 @@ import {
92
106
  getSecurityKnowledgePrompt
93
107
  } from "./chunk-ZM4O442V.js";
94
108
  import {
95
- createSessionMemory
96
- } from "./chunk-3VWMM6UF.js";
109
+ getMemoryRegistry
110
+ } from "./chunk-PQHVC4BD.js";
97
111
  import {
98
- MemoryImportance,
99
- calculateTextJaccardSimilarity
100
- } from "./chunk-BJ2OMC7P.js";
101
- import {
102
- STOPWORDS,
103
- capitalizeWords,
104
- truncateWithInfo
105
- } from "./chunk-633WH2ML.js";
112
+ createSessionMemory
113
+ } from "./chunk-3NIPH6UP.js";
106
114
  import {
107
115
  AGENT_ROUTER_TIMEOUTS,
108
116
  API_TIMEOUTS,
@@ -172,11 +180,11 @@ import {
172
180
  resolveModelIdentitySync,
173
181
  toExpertTaskAnalysisResult,
174
182
  withStep
175
- } from "./chunk-3MRM53T4.js";
183
+ } from "./chunk-WDYCIJWN.js";
176
184
  import {
177
185
  getNexusDataDir,
178
186
  nexusDataPath
179
- } from "./chunk-GOT7OAL5.js";
187
+ } from "./chunk-7BMOZJYS.js";
180
188
 
181
189
  // src/agents/state-machine-types.ts
182
190
  var VALID_TRANSITIONS = /* @__PURE__ */ new Map([
@@ -12513,7 +12521,8 @@ var DEFAULT_SKILL_LIBRARY_CONFIG = {
12513
12521
  executionsBeforeEvaluation: 5,
12514
12522
  enablePruning: true,
12515
12523
  trackExecutionHistory: true,
12516
- maxHistoryPerSkill: 100
12524
+ maxHistoryPerSkill: 100,
12525
+ minSuccessesForPromotion: 5
12517
12526
  };
12518
12527
  var COMPLEXITY_ORDER = {
12519
12528
  primitive: 1,
@@ -12949,6 +12958,49 @@ var SkillLibrary = class {
12949
12958
  const updated = calculateUpdatedMetrics(current, execution);
12950
12959
  this.store.metrics.set(skillId, updated);
12951
12960
  this.evaluateRetention(skillId);
12961
+ this.maybePromote(skillId, current, updated);
12962
+ }
12963
+ /**
12964
+ * Phase 6 of #2792 — promote a stabilized skill to the shared belief
12965
+ * store so future tasks (executed by other agents) see the signal.
12966
+ *
12967
+ * Fires exactly once per skill, when the successful-execution count
12968
+ * crosses {@link SkillLibraryConfig.minSuccessesForPromotion}. The
12969
+ * `previousMetrics → updatedMetrics` comparison guards against
12970
+ * re-promoting on every subsequent execution.
12971
+ *
12972
+ * Best-effort: a throwing/rejecting promoter is caught here so a
12973
+ * broken promotion bridge never breaks the local skill bookkeeping.
12974
+ */
12975
+ maybePromote(skillId, previousMetrics, updatedMetrics) {
12976
+ if (this.config.skillPromoter === void 0) return;
12977
+ const threshold = this.config.minSuccessesForPromotion;
12978
+ const justCrossed = previousMetrics.successCount < threshold && updatedMetrics.successCount >= threshold;
12979
+ if (!justCrossed) return;
12980
+ const skill = this.store.skills.get(skillId);
12981
+ if (skill === void 0) return;
12982
+ try {
12983
+ const maybePromise = this.config.skillPromoter({
12984
+ skillId,
12985
+ name: skill.name,
12986
+ category: skill.category,
12987
+ successRate: updatedMetrics.successRate,
12988
+ executionCount: updatedMetrics.executionCount
12989
+ });
12990
+ if (maybePromise instanceof Promise) {
12991
+ maybePromise.catch((error) => {
12992
+ this.logger.debug("Skill promotion rejected", {
12993
+ skillId,
12994
+ error: error instanceof Error ? error.message : String(error)
12995
+ });
12996
+ });
12997
+ }
12998
+ } catch (error) {
12999
+ this.logger.debug("Skill promotion threw", {
13000
+ skillId,
13001
+ error: error instanceof Error ? error.message : String(error)
13002
+ });
13003
+ }
12952
13004
  }
12953
13005
  /**
12954
13006
  * Evaluates whether a skill should be retained.
@@ -26617,9 +26669,32 @@ async function runSinglePrecondition(config, ctx, options) {
26617
26669
  var logger15 = createLogger({ component: "GraphExecutor" });
26618
26670
  var DEFAULT_MAX_STEPS = GRAPH_TIMEOUTS.maxSteps;
26619
26671
  var DEFAULT_TIMEOUT_MS3 = GRAPH_TIMEOUTS.defaultMs;
26672
+ var GRAPH_UNIFIED_CONTEXT_KEY = "__unifiedContext";
26673
+ async function populateUnifiedContextOnState(state) {
26674
+ try {
26675
+ const taskCandidate = state["task"];
26676
+ if (typeof taskCandidate !== "string" || taskCandidate === "") return;
26677
+ const { getContextForTask: getContextForTask2, inferTaskCategory: inferTaskCategory2 } = await import("./context-retriever-MB3D7KS6.js");
26678
+ const ctx = await getContextForTask2({
26679
+ task: taskCandidate,
26680
+ category: inferTaskCategory2(taskCandidate),
26681
+ logger: logger15
26682
+ });
26683
+ state[GRAPH_UNIFIED_CONTEXT_KEY] = ctx;
26684
+ logger15.debug("Graph start: unified memory context stashed", {
26685
+ beliefs: ctx.beliefs.length,
26686
+ similarMemories: ctx.similarMemories.length,
26687
+ experiencePatterns: ctx.experiencePatterns.length,
26688
+ outcomesTotal: ctx.outcomes?.totalTasks ?? 0
26689
+ });
26690
+ } catch (error) {
26691
+ logger15.debug("Graph start: context retrieval failed", { error: getErrorMessage(error) });
26692
+ }
26693
+ }
26620
26694
  async function executeGraph(graph, initialInputs, options) {
26621
26695
  const startTime = getTimeProvider().now();
26622
26696
  const initialState = initializeState(graph, initialInputs);
26697
+ await populateUnifiedContextOnState(initialState);
26623
26698
  const ctx = {
26624
26699
  state: initialState,
26625
26700
  allResults: [],
@@ -33509,6 +33584,7 @@ async function runOrchestratePipeline(params) {
33509
33584
  const startMs = getTimeProvider().now();
33510
33585
  const v2Config = resolveV2Config();
33511
33586
  if (v2Config.orchestrateEnabled) instrumentV2Orchestrate(input, logger51);
33587
+ await injectMemoryContextForOrchestrate(input, logger51);
33512
33588
  const agentPlan = v2Config.aorchestraEnabled ? computeAgentPlan(input.task, logger51) : void 0;
33513
33589
  const workerDispatchResult = await tryWorkerDispatch(
33514
33590
  agentPlan,
@@ -33532,6 +33608,30 @@ async function runOrchestratePipeline(params) {
33532
33608
  });
33533
33609
  return assembleOrchestrateOutput(result.value, agentPlan, workerDispatchResult);
33534
33610
  }
33611
+ async function injectMemoryContextForOrchestrate(input, logger51) {
33612
+ try {
33613
+ const ctx = await getContextForTask({
33614
+ task: input.task,
33615
+ category: inferTaskCategory(input.task),
33616
+ logger: logger51
33617
+ });
33618
+ const summary = summarizeContextForPrompt(ctx);
33619
+ logger51.debug("orchestrate: unified memory context", {
33620
+ beliefs: ctx.beliefs.length,
33621
+ similarMemories: ctx.similarMemories.length,
33622
+ recentLearnings: ctx.recentLearnings.length,
33623
+ experiencePatterns: ctx.experiencePatterns.length,
33624
+ outcomesTotal: ctx.outcomes?.totalTasks ?? 0,
33625
+ summaryChars: summary.length
33626
+ });
33627
+ if (process.env["NEXUS_CONTEXT_RETRIEVER_INJECT"] === "1" && summary !== "") {
33628
+ const mutable = input;
33629
+ mutable.context = { ...mutable.context ?? {}, priorMemorySummary: summary };
33630
+ }
33631
+ } catch (error) {
33632
+ logger51.debug("orchestrate: context retrieval failed", { error: getErrorMessage(error) });
33633
+ }
33634
+ }
33535
33635
  function createOrchestrateHandler(deps) {
33536
33636
  const notifier = deps.notifier ?? NOOP_NOTIFIER;
33537
33637
  return async (args, ctx) => {
@@ -33799,10 +33899,17 @@ var REASON_MAP = [
33799
33899
  ["needsMcp", "MCP tool support required"],
33800
33900
  ["needsExploration", "exploration/research task benefits from large context"]
33801
33901
  ];
33802
- function buildReasons(requirements, pref, billingMode = "api", specialization = null) {
33902
+ function buildReasons(requirements, pref, billingMode = "api", specialization = null, chosenCli) {
33803
33903
  const reasons = REASON_MAP.filter(([key]) => requirements[key] === true).map(([, desc]) => desc);
33804
- if (specialization !== null)
33805
- reasons.push(`${specialization.category} task (prefer ${specialization.primaryCli})`);
33904
+ if (specialization !== null) {
33905
+ if (chosenCli !== void 0 && specialization.primaryCli !== chosenCli) {
33906
+ reasons.push(
33907
+ `${specialization.category} task (preferred ${specialization.primaryCli}, selected ${chosenCli} after filtering)`
33908
+ );
33909
+ } else {
33910
+ reasons.push(`${specialization.category} task (preferred ${specialization.primaryCli})`);
33911
+ }
33912
+ }
33806
33913
  if (pref !== void 0 && pref !== "") reasons.push(`preferred: ${pref}`);
33807
33914
  if (billingMode === "plan") reasons.push("plan billing (cost ignored)");
33808
33915
  return reasons;
@@ -33886,7 +33993,8 @@ function selectModel(input, requirements, billingMode = "api") {
33886
33993
  requirements,
33887
33994
  input.preferred_capability,
33888
33995
  billingMode,
33889
- specialization
33996
+ specialization,
33997
+ getCliForModel(best.name)
33890
33998
  );
33891
33999
  const reasoning = reasons.length > 0 ? `Selected ${best.name} (score: ${best.score.toFixed(1)}) because: ${reasons.join(", ")}` : `Selected ${best.name} as the best overall match (score: ${best.score.toFixed(1)})`;
33892
34000
  const alternatives = scored.slice(1, 4).map((alt) => ({
@@ -36320,8 +36428,15 @@ function extractEntryXml(xml) {
36320
36428
  const entryMatch = xml.match(/<entry>([\s\S]*?)<\/entry>/);
36321
36429
  return entryMatch?.[1] ?? null;
36322
36430
  }
36431
+ var XML_ENTITIES = {
36432
+ "&amp;": "&",
36433
+ "&lt;": "<",
36434
+ "&gt;": ">",
36435
+ "&quot;": '"',
36436
+ "&apos;": "'"
36437
+ };
36323
36438
  function decodeXmlEntities(s) {
36324
- return s.replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&apos;/g, "'");
36439
+ return s.replace(/&(?:amp|lt|gt|quot|apos);/g, (m) => XML_ENTITIES[m] ?? m);
36325
36440
  }
36326
36441
  function parseArxivXml(arxivId, xml) {
36327
36442
  const entryXml = extractEntryXml(xml);
@@ -39678,7 +39793,8 @@ async function collectMemoryStats(input, logger51) {
39678
39793
  mobimem: toolMemory.isMobiMemAvailable(),
39679
39794
  decay: toolMemory.isDecayManagerAvailable()
39680
39795
  };
39681
- logger51.debug("Memory stats collected", { backends });
39796
+ const registry = await collectRegistryStats(logger51);
39797
+ logger51.debug("Memory stats collected", { backends, registryDomains: registry.length });
39682
39798
  return {
39683
39799
  backends,
39684
39800
  session: sessionStats,
@@ -39686,9 +39802,27 @@ async function collectMemoryStats(input, logger51) {
39686
39802
  typed: typedStats !== void 0 ? typedStats : null,
39687
39803
  mobimem: mobimemStats !== void 0 ? mobimemStats : null,
39688
39804
  decay: decayStats,
39805
+ registry,
39689
39806
  collectedAt: (/* @__PURE__ */ new Date()).toISOString()
39690
39807
  };
39691
39808
  }
39809
+ async function collectRegistryStats(logger51) {
39810
+ const registry = getMemoryRegistry();
39811
+ const rows = [];
39812
+ for (const domain of registry.domains()) {
39813
+ const backend = registry.get(domain);
39814
+ if (backend === void 0) continue;
39815
+ try {
39816
+ const s = await backend.stats();
39817
+ rows.push({ domain, count: s.count, error: null });
39818
+ } catch (error) {
39819
+ const message = error instanceof Error ? error.message : String(error);
39820
+ logger51.debug("Registry domain stats failed", { domain, error: message });
39821
+ rows.push({ domain, count: null, error: message });
39822
+ }
39823
+ }
39824
+ return rows;
39825
+ }
39692
39826
  async function memoryStatsHandler(args, ctx) {
39693
39827
  const validationResult = MemoryStatsInputSchema.safeParse(args);
39694
39828
  if (!validationResult.success) {
@@ -39722,6 +39856,7 @@ function registerMemoryStatsTool(server, deps) {
39722
39856
  typed: z73.unknown().optional(),
39723
39857
  mobimem: z73.unknown().optional(),
39724
39858
  decay: z73.unknown().optional(),
39859
+ registry: z73.array(z73.unknown()).optional(),
39725
39860
  collectedAt: z73.string().optional()
39726
39861
  };
39727
39862
  server.registerTool(
@@ -41763,7 +41898,7 @@ async function tryIssueTriage(task) {
41763
41898
  try {
41764
41899
  const issueMatch = task.match(/github\.com\/([^/]+\/[^/]+)\/issues\/(\d+)/);
41765
41900
  if (issueMatch === null) return null;
41766
- const { createIssueTriage } = await import("./issue-triage-6XD6CVPB.js");
41901
+ const { createIssueTriage } = await import("./issue-triage-RMXPDZ2K.js");
41767
41902
  const triage = createIssueTriage();
41768
41903
  const owner = issueMatch[1] ?? "";
41769
41904
  const num = issueMatch[2] ?? "";
@@ -41791,7 +41926,7 @@ var VALID_TEMPLATES = /* @__PURE__ */ new Set([
41791
41926
  ]);
41792
41927
  async function classifyWithLLM(task) {
41793
41928
  try {
41794
- const { executeExpert: executeExpert2 } = await import("./expert-bridge-ZPNVLJVN.js");
41929
+ const { executeExpert: executeExpert2 } = await import("./expert-bridge-JKLC57IC.js");
41795
41930
  const prompt = [
41796
41931
  "Classify this task into exactly one pipeline template.",
41797
41932
  "Templates: dev (implementation/bug fix/refactor), research (investigate/evaluate/compare),",
@@ -42583,8 +42718,8 @@ var memoryInitPromise = null;
42583
42718
  async function initPipelineMemory() {
42584
42719
  if (cachedMemory !== null) return cachedMemory;
42585
42720
  try {
42586
- const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-7XBV6BMY.js");
42587
- const { getLearningDir } = await import("./learning-persistence-N6ILD2HX.js");
42721
+ const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-L7EQIY2O.js");
42722
+ const { getLearningDir } = await import("./learning-persistence-Q3HTOGTU.js");
42588
42723
  const mem = createSessionMemory2(getLearningDir());
42589
42724
  mem.startSession(`pipeline-${String(Date.now())}`);
42590
42725
  cachedMemory = {
@@ -42628,19 +42763,6 @@ function recordMemoryError(error, solution) {
42628
42763
  }
42629
42764
  function flushPipelineMemory() {
42630
42765
  void getPipelineMemoryAsync().then((m) => m?.flush());
42631
- void persistMobiMemState();
42632
- }
42633
- async function persistMobiMemState() {
42634
- try {
42635
- const { isPersistenceEnabled } = await import("./learning-persistence-N6ILD2HX.js");
42636
- if (!isPersistenceEnabled()) return;
42637
- const { nexusDataPath: nexusDataPath2 } = await import("./nexus-data-dir-77UO7N6J.js");
42638
- const { createMobiMem } = await import("./mobimem-CG2MNS7V.js");
42639
- const mobimem = createMobiMem();
42640
- const savePath = nexusDataPath2("memory", "mobimem-state.json");
42641
- await mobimem.save(savePath);
42642
- } catch {
42643
- }
42644
42766
  }
42645
42767
  var routingMemoryCache = null;
42646
42768
  function recordRoutingExperience(category, success, durationMs) {
@@ -42652,7 +42774,7 @@ function recordRoutingExperience(category, success, durationMs) {
42652
42774
  callRecord(routingMemoryCache);
42653
42775
  return;
42654
42776
  }
42655
- void import("./routing-memory-5VTX7LQX.js").then(({ createRoutingMemory }) => {
42777
+ void import("./routing-memory-3B6DDZ76.js").then(({ createRoutingMemory }) => {
42656
42778
  routingMemoryCache = createRoutingMemory();
42657
42779
  callRecord(routingMemoryCache);
42658
42780
  }).catch((error) => {
@@ -42681,7 +42803,7 @@ ${text}` : "";
42681
42803
  }
42682
42804
  async function getWeatherContext() {
42683
42805
  try {
42684
- const { generateWeatherReport: generateWeatherReport2 } = await import("./weather-report-YJMVKJGA.js");
42806
+ const { generateWeatherReport: generateWeatherReport2 } = await import("./weather-report-ER3WUZ7S.js");
42685
42807
  const report = generateWeatherReport2({ includeAdaptive: true });
42686
42808
  const mappings = "recommendedMappings" in report ? report.recommendedMappings : [];
42687
42809
  if (!Array.isArray(mappings) || mappings.length === 0) return "";
@@ -42699,8 +42821,8 @@ ${lines}
42699
42821
  }
42700
42822
  async function getMemoryContext(task) {
42701
42823
  try {
42702
- const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-7XBV6BMY.js");
42703
- const { getLearningDir } = await import("./learning-persistence-N6ILD2HX.js");
42824
+ const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-L7EQIY2O.js");
42825
+ const { getLearningDir } = await import("./learning-persistence-Q3HTOGTU.js");
42704
42826
  const memory = createSessionMemory2(getLearningDir(), { maxLearningsInContext: 10 });
42705
42827
  const learnings = memory.searchLearnings(task.slice(0, 200));
42706
42828
  if (learnings.length === 0) return "";
@@ -42792,7 +42914,7 @@ ${contextBlock}`;
42792
42914
  const strategy = config.votingStrategy ?? "higher_order";
42793
42915
  await postProgress(config, "Vote", `Running consensus with ${strategy} strategy...`);
42794
42916
  try {
42795
- const { executeVoting } = await import("./consensus-vote-MUQ4HPIF.js");
42917
+ const { executeVoting } = await import("./consensus-vote-ESFPGEJE.js");
42796
42918
  const votingResult = await executeVoting(
42797
42919
  {
42798
42920
  proposal: plan.slice(0, 4e3),
@@ -43458,15 +43580,8 @@ function createResearchStageWrapper(stages) {
43458
43580
  async execute(ctx) {
43459
43581
  const start = getTimeProvider().now();
43460
43582
  try {
43461
- const priorContext = await retrieveAdaptiveMemory(ctx.task);
43462
43583
  const codeContext = await searchCodebaseForTask(ctx.task);
43463
43584
  let enrichedTask = ctx.task;
43464
- if (priorContext !== null) {
43465
- enrichedTask = `${enrichedTask}
43466
-
43467
- ## Prior Context (Adaptive Memory)
43468
- ${priorContext}`;
43469
- }
43470
43585
  if (codeContext !== null && codeContext !== "") {
43471
43586
  enrichedTask = `${enrichedTask}
43472
43587
 
@@ -43655,28 +43770,9 @@ async function extractSymbolsForTask(task) {
43655
43770
  return null;
43656
43771
  }
43657
43772
  }
43658
- async function retrieveAdaptiveMemory(task) {
43659
- try {
43660
- const { AdaptiveMemoryBackend } = await import("./adaptive-memory-EI564K4C.js");
43661
- const path14 = await import("path");
43662
- const { nexusDataPath: nexusDataPath2 } = await import("./nexus-data-dir-77UO7N6J.js");
43663
- const baseDir = nexusDataPath2("memory");
43664
- const memory = new AdaptiveMemoryBackend({
43665
- dbPath: path14.join(baseDir, "adaptive.db"),
43666
- markdownDir: path14.join(baseDir, "adaptive-md")
43667
- });
43668
- const key = task.slice(0, 50).replace(/\s+/g, "-").toLowerCase();
43669
- const result = await memory.retrieve(key);
43670
- if (!result.ok) return null;
43671
- const value = result.value;
43672
- return typeof value === "string" && value.length > 0 ? value : null;
43673
- } catch {
43674
- return null;
43675
- }
43676
- }
43677
43773
  async function queryResearchRegistry(task) {
43678
43774
  try {
43679
- const { synthesizeResearch: synthesizeResearch2 } = await import("./research-helpers-synthesize-36TUTUUA.js");
43775
+ const { synthesizeResearch: synthesizeResearch2 } = await import("./research-helpers-synthesize-K2UCJQQG.js");
43680
43776
  const topic = task.split(/[.!?\n]/).filter((s) => s.trim().length > 10)[0]?.trim();
43681
43777
  if (topic === void 0) return null;
43682
43778
  const result = await synthesizeResearch2(topic.slice(0, 50));
@@ -43761,7 +43857,7 @@ function createScanStageWrapper() {
43761
43857
  try {
43762
43858
  const slug = ctx.task.match(/([a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+)/)?.[1];
43763
43859
  if (slug !== void 0) {
43764
- const { generateSecurityPlan: generateSecurityPlan2 } = await import("./repo-security-plan-7ZCDVH5O.js");
43860
+ const { generateSecurityPlan: generateSecurityPlan2 } = await import("./repo-security-plan-AGRU72DL.js");
43765
43861
  const plan = await generateSecurityPlan2({ repo: slug, maxScanners: 10 });
43766
43862
  const recs = plan.recommendations.slice(0, 5).map((r) => `${r.priority}: ${r.displayName} (${r.category})`).join("; ");
43767
43863
  ctx.sharedMemory.write("scan", "decision", { recommendations: recs });
@@ -49328,7 +49424,7 @@ var GitHubTaskTracker = class {
49328
49424
  cachedProvider = null;
49329
49425
  async getProvider() {
49330
49426
  if (this.cachedProvider !== null) return this.cachedProvider;
49331
- const { createScmProvider } = await import("./factory-A7DTCCUY.js");
49427
+ const { createScmProvider } = await import("./factory-BUUXNGIB.js");
49332
49428
  const result = await createScmProvider({ repo: this.config.repo ?? "" });
49333
49429
  if (!result.ok) throw new Error(`SCM provider error: ${result.error.message}`);
49334
49430
  this.cachedProvider = result.value;
@@ -50033,4 +50129,4 @@ export {
50033
50129
  detectBackend,
50034
50130
  createTaskTracker
50035
50131
  };
50036
- //# sourceMappingURL=chunk-2IAWMNNB.js.map
50132
+ //# sourceMappingURL=chunk-6WBTNZAY.js.map