nexus-agents 2.92.5 → 2.94.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 (119) hide show
  1. package/dist/{child-mcp-config-PIDVHWJ7.js → child-mcp-config-PPFHJZSO.js} +2 -2
  2. package/dist/{chunk-MBK6P4VV.js → chunk-24WC4XO2.js} +2 -2
  3. package/dist/{chunk-G55LVPNH.js → chunk-2YMRRZRM.js} +9 -12
  4. package/dist/chunk-2YMRRZRM.js.map +1 -0
  5. package/dist/{chunk-PIDABDFE.js → chunk-43UDRX3N.js} +9 -127
  6. package/dist/chunk-43UDRX3N.js.map +1 -0
  7. package/dist/{chunk-DNSBKQ7I.js → chunk-4QESFYGV.js} +4 -4
  8. package/dist/{chunk-QQMYKFG7.js → chunk-5B4VLSMP.js} +3 -3
  9. package/dist/{chunk-3TU3RJNK.js → chunk-5ZB3MTA7.js} +3 -3
  10. package/dist/{chunk-FL3AXIUL.js → chunk-63OGXDHS.js} +4 -4
  11. package/dist/{chunk-BG4WK4UP.js → chunk-76535ZNP.js} +15 -6
  12. package/dist/chunk-76535ZNP.js.map +1 -0
  13. package/dist/{chunk-QXGLZETS.js → chunk-77JUKFTG.js} +7 -7
  14. package/dist/{chunk-GKFFRRS4.js → chunk-ADRTAUJA.js} +4 -4
  15. package/dist/{chunk-VBIAMMZZ.js → chunk-EB43BGAR.js} +2 -2
  16. package/dist/{chunk-EI2E43HI.js → chunk-EDPDH5YT.js} +3 -3
  17. package/dist/{chunk-YQAS2EGR.js → chunk-EJR6U67L.js} +2 -2
  18. package/dist/{chunk-2QJJYCPD.js → chunk-FUGPKYEJ.js} +2 -2
  19. package/dist/{chunk-P646QQYW.js → chunk-G5EBHQ2L.js} +5 -5
  20. package/dist/chunk-G5EBHQ2L.js.map +1 -0
  21. package/dist/{chunk-YJUHVQSG.js → chunk-GMZDRTVJ.js} +20 -3
  22. package/dist/chunk-GMZDRTVJ.js.map +1 -0
  23. package/dist/{chunk-U4RLBLNO.js → chunk-KSJPDQSG.js} +2 -2
  24. package/dist/{chunk-DSERRMPX.js → chunk-L7I55FAN.js} +2 -2
  25. package/dist/{chunk-OXLXVSN3.js → chunk-LCLVSNST.js} +2 -2
  26. package/dist/{chunk-VU54VB6K.js → chunk-OKGHHCS5.js} +3 -3
  27. package/dist/{chunk-DQEREDUW.js → chunk-OSSGG7KW.js} +2 -2
  28. package/dist/{chunk-L5BXCSMP.js → chunk-OT6V5ROA.js} +406 -16
  29. package/dist/chunk-OT6V5ROA.js.map +1 -0
  30. package/dist/{chunk-TOQJ3UN5.js → chunk-Q3NUA7CW.js} +3 -3
  31. package/dist/{chunk-QADQ4LN4.js → chunk-R2NKJPUX.js} +2 -2
  32. package/dist/{chunk-WXEMTPML.js → chunk-ROAANOOB.js} +2 -2
  33. package/dist/{chunk-NYWZI46K.js → chunk-TNBWHOPY.js} +52 -132
  34. package/dist/chunk-TNBWHOPY.js.map +1 -0
  35. package/dist/{chunk-KTJUMU2A.js → chunk-UC3PVIN4.js} +179 -48
  36. package/dist/chunk-UC3PVIN4.js.map +1 -0
  37. package/dist/{chunk-ZYYU26YH.js → chunk-XBPFVWA2.js} +2 -2
  38. package/dist/{chunk-SIICMKBA.js → chunk-YDXGYKZJ.js} +2 -2
  39. package/dist/chunk-YDXGYKZJ.js.map +1 -0
  40. package/dist/{chunk-3XC5LFWH.js → chunk-ZY2EMD72.js} +5 -5
  41. package/dist/{cli-circuit-breaker-HFSOBCPK.js → cli-circuit-breaker-BAERQZ3H.js} +4 -4
  42. package/dist/cli.js +135 -38
  43. package/dist/cli.js.map +1 -1
  44. package/dist/{composite-router-T2XYCQOU.js → composite-router-EONKFRDD.js} +2 -2
  45. package/dist/{consensus-vote-IDHQVKX2.js → consensus-vote-TO5575P3.js} +12 -12
  46. package/dist/{context-retriever-5BJYPAX7.js → context-retriever-JM564MOV.js} +6 -6
  47. package/dist/{doctor-deep-OVGRBG3Z.js → doctor-deep-VFBQ7TY4.js} +3 -3
  48. package/dist/{expert-bridge-JPTHFWPW.js → expert-bridge-OXME7FES.js} +4 -4
  49. package/dist/{factory-734UWF4C.js → factory-FVZLVIYH.js} +5 -5
  50. package/dist/{factory-NE7SNW7V.js → factory-MDT5CFA5.js} +5 -5
  51. package/dist/index.d.ts +240 -189
  52. package/dist/index.js +198 -55
  53. package/dist/index.js.map +1 -1
  54. package/dist/{init-opencode-2ZBDJILW.js → init-opencode-Y6XKR6WS.js} +5 -5
  55. package/dist/{issue-triage-AGGTH767.js → issue-triage-2XVD4JQ7.js} +5 -5
  56. package/dist/{pr-reviewer-helpers-WGPLUXPU.js → pr-reviewer-helpers-JLWEQIN6.js} +4 -4
  57. package/dist/{registry-command-CZZM5SF2.js → registry-command-FYVOMCBG.js} +2 -2
  58. package/dist/{repo-security-plan-X42KXHT2.js → repo-security-plan-JRDHWI2R.js} +3 -3
  59. package/dist/{research-helpers-synthesize-C7YGRQI6.js → research-helpers-synthesize-F7L7M7FJ.js} +3 -3
  60. package/dist/{routing-memory-2FYZDQUC.js → routing-memory-JAV2ICXR.js} +2 -2
  61. package/dist/{session-memory-53NZRZB6.js → session-memory-2XAGY3PX.js} +3 -3
  62. package/dist/{setup-command-ZV6VZLP4.js → setup-command-6WVEOE4Q.js} +11 -11
  63. package/dist/{setup-config-CYRK4UFF.js → setup-config-KUZU2GFI.js} +3 -3
  64. package/dist/{setup-custom-api-GXHPYLDR.js → setup-custom-api-3M7CU3TF.js} +4 -4
  65. package/dist/{tool-memory-AX5G67J6.js → tool-memory-YWX4FTIQ.js} +5 -5
  66. package/dist/{weather-report-AUMNGHYZ.js → weather-report-ZZM5EU7N.js} +2 -2
  67. package/package.json +1 -1
  68. package/dist/chunk-BG4WK4UP.js.map +0 -1
  69. package/dist/chunk-G55LVPNH.js.map +0 -1
  70. package/dist/chunk-KTJUMU2A.js.map +0 -1
  71. package/dist/chunk-L5BXCSMP.js.map +0 -1
  72. package/dist/chunk-NYWZI46K.js.map +0 -1
  73. package/dist/chunk-P646QQYW.js.map +0 -1
  74. package/dist/chunk-PIDABDFE.js.map +0 -1
  75. package/dist/chunk-SIICMKBA.js.map +0 -1
  76. package/dist/chunk-YJUHVQSG.js.map +0 -1
  77. /package/dist/{child-mcp-config-PIDVHWJ7.js.map → child-mcp-config-PPFHJZSO.js.map} +0 -0
  78. /package/dist/{chunk-MBK6P4VV.js.map → chunk-24WC4XO2.js.map} +0 -0
  79. /package/dist/{chunk-DNSBKQ7I.js.map → chunk-4QESFYGV.js.map} +0 -0
  80. /package/dist/{chunk-QQMYKFG7.js.map → chunk-5B4VLSMP.js.map} +0 -0
  81. /package/dist/{chunk-3TU3RJNK.js.map → chunk-5ZB3MTA7.js.map} +0 -0
  82. /package/dist/{chunk-FL3AXIUL.js.map → chunk-63OGXDHS.js.map} +0 -0
  83. /package/dist/{chunk-QXGLZETS.js.map → chunk-77JUKFTG.js.map} +0 -0
  84. /package/dist/{chunk-GKFFRRS4.js.map → chunk-ADRTAUJA.js.map} +0 -0
  85. /package/dist/{chunk-VBIAMMZZ.js.map → chunk-EB43BGAR.js.map} +0 -0
  86. /package/dist/{chunk-EI2E43HI.js.map → chunk-EDPDH5YT.js.map} +0 -0
  87. /package/dist/{chunk-YQAS2EGR.js.map → chunk-EJR6U67L.js.map} +0 -0
  88. /package/dist/{chunk-2QJJYCPD.js.map → chunk-FUGPKYEJ.js.map} +0 -0
  89. /package/dist/{chunk-U4RLBLNO.js.map → chunk-KSJPDQSG.js.map} +0 -0
  90. /package/dist/{chunk-DSERRMPX.js.map → chunk-L7I55FAN.js.map} +0 -0
  91. /package/dist/{chunk-OXLXVSN3.js.map → chunk-LCLVSNST.js.map} +0 -0
  92. /package/dist/{chunk-VU54VB6K.js.map → chunk-OKGHHCS5.js.map} +0 -0
  93. /package/dist/{chunk-DQEREDUW.js.map → chunk-OSSGG7KW.js.map} +0 -0
  94. /package/dist/{chunk-TOQJ3UN5.js.map → chunk-Q3NUA7CW.js.map} +0 -0
  95. /package/dist/{chunk-QADQ4LN4.js.map → chunk-R2NKJPUX.js.map} +0 -0
  96. /package/dist/{chunk-WXEMTPML.js.map → chunk-ROAANOOB.js.map} +0 -0
  97. /package/dist/{chunk-ZYYU26YH.js.map → chunk-XBPFVWA2.js.map} +0 -0
  98. /package/dist/{chunk-3XC5LFWH.js.map → chunk-ZY2EMD72.js.map} +0 -0
  99. /package/dist/{cli-circuit-breaker-HFSOBCPK.js.map → cli-circuit-breaker-BAERQZ3H.js.map} +0 -0
  100. /package/dist/{composite-router-T2XYCQOU.js.map → composite-router-EONKFRDD.js.map} +0 -0
  101. /package/dist/{consensus-vote-IDHQVKX2.js.map → consensus-vote-TO5575P3.js.map} +0 -0
  102. /package/dist/{context-retriever-5BJYPAX7.js.map → context-retriever-JM564MOV.js.map} +0 -0
  103. /package/dist/{doctor-deep-OVGRBG3Z.js.map → doctor-deep-VFBQ7TY4.js.map} +0 -0
  104. /package/dist/{expert-bridge-JPTHFWPW.js.map → expert-bridge-OXME7FES.js.map} +0 -0
  105. /package/dist/{factory-734UWF4C.js.map → factory-FVZLVIYH.js.map} +0 -0
  106. /package/dist/{factory-NE7SNW7V.js.map → factory-MDT5CFA5.js.map} +0 -0
  107. /package/dist/{init-opencode-2ZBDJILW.js.map → init-opencode-Y6XKR6WS.js.map} +0 -0
  108. /package/dist/{issue-triage-AGGTH767.js.map → issue-triage-2XVD4JQ7.js.map} +0 -0
  109. /package/dist/{pr-reviewer-helpers-WGPLUXPU.js.map → pr-reviewer-helpers-JLWEQIN6.js.map} +0 -0
  110. /package/dist/{registry-command-CZZM5SF2.js.map → registry-command-FYVOMCBG.js.map} +0 -0
  111. /package/dist/{repo-security-plan-X42KXHT2.js.map → repo-security-plan-JRDHWI2R.js.map} +0 -0
  112. /package/dist/{research-helpers-synthesize-C7YGRQI6.js.map → research-helpers-synthesize-F7L7M7FJ.js.map} +0 -0
  113. /package/dist/{routing-memory-2FYZDQUC.js.map → routing-memory-JAV2ICXR.js.map} +0 -0
  114. /package/dist/{session-memory-53NZRZB6.js.map → session-memory-2XAGY3PX.js.map} +0 -0
  115. /package/dist/{setup-command-ZV6VZLP4.js.map → setup-command-6WVEOE4Q.js.map} +0 -0
  116. /package/dist/{setup-config-CYRK4UFF.js.map → setup-config-KUZU2GFI.js.map} +0 -0
  117. /package/dist/{setup-custom-api-GXHPYLDR.js.map → setup-custom-api-3M7CU3TF.js.map} +0 -0
  118. /package/dist/{tool-memory-AX5G67J6.js.map → tool-memory-YWX4FTIQ.js.map} +0 -0
  119. /package/dist/{weather-report-AUMNGHYZ.js.map → weather-report-ZZM5EU7N.js.map} +0 -0
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  getTokenEnvVars,
3
3
  resolveToken
4
- } from "./chunk-DQEREDUW.js";
4
+ } from "./chunk-OSSGG7KW.js";
5
5
  import {
6
6
  executeExpert
7
- } from "./chunk-G55LVPNH.js";
7
+ } from "./chunk-2YMRRZRM.js";
8
8
  import {
9
9
  EventTopics,
10
10
  JobStatusSchema,
@@ -42,7 +42,7 @@ import {
42
42
  writeJobComplete,
43
43
  writeJobFailed,
44
44
  writeJobPending
45
- } from "./chunk-NYWZI46K.js";
45
+ } from "./chunk-TNBWHOPY.js";
46
46
  import {
47
47
  REGISTRY_PATH,
48
48
  getProjectRoot,
@@ -51,19 +51,19 @@ import {
51
51
  normalizeTopicToCanonical,
52
52
  savePapersRegistry,
53
53
  synthesizeResearch
54
- } from "./chunk-P646QQYW.js";
54
+ } from "./chunk-G5EBHQ2L.js";
55
55
  import {
56
56
  IssueTriage,
57
57
  createAuditTrail,
58
58
  createGraphAuditBridge
59
- } from "./chunk-BG4WK4UP.js";
59
+ } from "./chunk-76535ZNP.js";
60
60
  import {
61
61
  resolveEnvMode,
62
62
  sanitizeInput
63
- } from "./chunk-VBIAMMZZ.js";
63
+ } from "./chunk-EB43BGAR.js";
64
64
  import {
65
65
  generateSecurityPlan
66
- } from "./chunk-2QJJYCPD.js";
66
+ } from "./chunk-FUGPKYEJ.js";
67
67
  import {
68
68
  analyzeGitHubRepo
69
69
  } from "./chunk-HFOQKCD2.js";
@@ -76,25 +76,26 @@ import {
76
76
  getContextForTask,
77
77
  inferTaskCategory,
78
78
  summarizeContextForPrompt
79
- } from "./chunk-VU54VB6K.js";
79
+ } from "./chunk-OKGHHCS5.js";
80
80
  import {
81
81
  DEFAULT_RELEVANCE_CONFIG,
82
82
  MemoryImportance,
83
83
  calculateTextJaccardSimilarity,
84
84
  getToolMemory
85
- } from "./chunk-FL3AXIUL.js";
85
+ } from "./chunk-63OGXDHS.js";
86
86
  import {
87
87
  DEFAULT_TASK_TTL_MS,
88
88
  DEFAULT_TOOL_RATE_LIMITS,
89
89
  clampTaskTtl
90
- } from "./chunk-QXGLZETS.js";
90
+ } from "./chunk-77JUKFTG.js";
91
91
  import {
92
92
  getAvailabilityCache,
93
+ getCliForModelId,
93
94
  resolveFallback
94
- } from "./chunk-YJUHVQSG.js";
95
+ } from "./chunk-GMZDRTVJ.js";
95
96
  import {
96
97
  DEFAULTS
97
- } from "./chunk-PIDABDFE.js";
98
+ } from "./chunk-43UDRX3N.js";
98
99
  import {
99
100
  resolveInsideRoot
100
101
  } from "./chunk-NUBSJGQZ.js";
@@ -110,11 +111,11 @@ import {
110
111
  getAvailableClis,
111
112
  sleep,
112
113
  withTimeout
113
- } from "./chunk-DNSBKQ7I.js";
114
+ } from "./chunk-4QESFYGV.js";
114
115
  import {
115
116
  generateHyphenId,
116
117
  generateUUID
117
- } from "./chunk-ZYYU26YH.js";
118
+ } from "./chunk-XBPFVWA2.js";
118
119
  import {
119
120
  BUILT_IN_EXPERTS,
120
121
  BuiltInExpertTypeSchema,
@@ -126,12 +127,13 @@ import {
126
127
  } from "./chunk-PQHVC4BD.js";
127
128
  import {
128
129
  createSessionMemory
129
- } from "./chunk-OXLXVSN3.js";
130
+ } from "./chunk-LCLVSNST.js";
130
131
  import {
131
132
  AGENT_ROUTER_TIMEOUTS,
132
133
  API_TIMEOUTS,
133
134
  ARCHITECTURE_KEYWORDS,
134
135
  AgentError,
136
+ BoundedLRUCache,
135
137
  CLI_NAMES,
136
138
  CLI_SUBPROCESS_TIMEOUTS,
137
139
  DEFAULT_CLI,
@@ -197,7 +199,7 @@ import {
197
199
  resolveModelIdentitySync,
198
200
  toExpertTaskAnalysisResult,
199
201
  withStep
200
- } from "./chunk-L5BXCSMP.js";
202
+ } from "./chunk-OT6V5ROA.js";
201
203
  import {
202
204
  getNexusDataDir,
203
205
  nexusDataPath,
@@ -24193,6 +24195,114 @@ function createValidationDashboard() {
24193
24195
  return new ValidationDashboard();
24194
24196
  }
24195
24197
 
24198
+ // src/observability/swarm-health-signals.ts
24199
+ var defaultLogger = createLogger({ component: "SwarmHealthSignals" });
24200
+ var SEVERE_BOTTLENECK = /* @__PURE__ */ new Set(["high", "critical"]);
24201
+ var DEFAULT_HEALTH_SIGNAL_INTERVAL_MS = 6e4;
24202
+ var CLI_NAME_SET = new Set(CLI_NAMES);
24203
+ function confidentCliSlot(agentId) {
24204
+ if (CLI_NAME_SET.has(agentId)) return agentId;
24205
+ return getCliForModelId(agentId);
24206
+ }
24207
+ function emitSwarmUnhealthySignals(metrics, bus, logger55 = defaultLogger) {
24208
+ const emittedSlots = /* @__PURE__ */ new Set();
24209
+ try {
24210
+ for (const bottleneck of metrics.bottlenecks) {
24211
+ if (!SEVERE_BOTTLENECK.has(bottleneck.severity)) continue;
24212
+ const slot = confidentCliSlot(bottleneck.agentId);
24213
+ if (slot === void 0) {
24214
+ logger55.debug("Skipping non-CLI-attributable bottleneck", {
24215
+ agentId: bottleneck.agentId,
24216
+ severity: bottleneck.severity
24217
+ });
24218
+ continue;
24219
+ }
24220
+ if (emittedSlots.has(slot)) continue;
24221
+ emittedSlots.add(slot);
24222
+ bus.emit({
24223
+ type: "signal.swarm_unhealthy",
24224
+ timestamp: Date.parse(metrics.calculatedAt),
24225
+ agentId: slot,
24226
+ reason: `bottleneck: ${String(bottleneck.queuedMessages)} queued, ${String(bottleneck.blockedAgents)} blocked (severity ${bottleneck.severity})`
24227
+ });
24228
+ }
24229
+ } catch (error) {
24230
+ logger55.warn("Failed to emit signal.swarm_unhealthy", { error: getErrorMessage(error) });
24231
+ }
24232
+ return emittedSlots.size;
24233
+ }
24234
+ var healthSignalTimer;
24235
+ function startSwarmHealthSignals(observer, bus, options) {
24236
+ if (healthSignalTimer !== void 0) return;
24237
+ const logger55 = options?.logger ?? defaultLogger;
24238
+ const intervalMs = options?.intervalMs ?? DEFAULT_HEALTH_SIGNAL_INTERVAL_MS;
24239
+ healthSignalTimer = setInterval(() => {
24240
+ try {
24241
+ emitSwarmUnhealthySignals(observer.getHealthMetrics(), bus, logger55);
24242
+ } catch (error) {
24243
+ logger55.debug("Swarm health poll failed", { error: getErrorMessage(error) });
24244
+ }
24245
+ }, intervalMs);
24246
+ healthSignalTimer.unref();
24247
+ }
24248
+ function shutdownSwarmHealthSignals() {
24249
+ if (healthSignalTimer !== void 0) {
24250
+ clearInterval(healthSignalTimer);
24251
+ healthSignalTimer = void 0;
24252
+ }
24253
+ }
24254
+
24255
+ // src/observability/failover-signals.ts
24256
+ var defaultLogger2 = createLogger({ component: "FailoverSignals" });
24257
+ var UNHEALTHY_STATES = /* @__PURE__ */ new Set(["degraded", "unavailable"]);
24258
+ var FAILOVER_SIGNAL_COOLDOWN_MS = 3e4;
24259
+ var CLI_NAME_SET2 = new Set(CLI_NAMES);
24260
+ function unhealthyCliFrom(payload) {
24261
+ if (payload === null || typeof payload !== "object") return void 0;
24262
+ const info = payload;
24263
+ if (typeof info.source !== "string" || !CLI_NAME_SET2.has(info.source)) return void 0;
24264
+ if (typeof info.state !== "string" || !UNHEALTHY_STATES.has(info.state)) return void 0;
24265
+ const lastError = typeof info.lastError === "string" ? info.lastError : void 0;
24266
+ const count = typeof info.failoverCount === "number" ? info.failoverCount : 0;
24267
+ const reason = `adapter ${info.state} (failovers: ${String(count)})${lastError !== void 0 ? `: ${lastError}` : ""}`;
24268
+ return { cli: info.source, reason };
24269
+ }
24270
+ var failoverSubscription;
24271
+ function startFailoverSignals(options) {
24272
+ if (failoverSubscription !== void 0) return;
24273
+ const logger55 = options?.logger ?? defaultLogger2;
24274
+ const sourceBus = options?.sourceBus ?? getGlobalEventBus();
24275
+ const pipelineBus = options?.pipelineBus ?? getPipelineEventBus();
24276
+ const cooldownMs = options?.cooldownMs ?? FAILOVER_SIGNAL_COOLDOWN_MS;
24277
+ const lastEmitByCli = /* @__PURE__ */ new Map();
24278
+ failoverSubscription = sourceBus.subscribe("adapter.failover", (event) => {
24279
+ try {
24280
+ const unhealthy = unhealthyCliFrom(event.payload);
24281
+ if (unhealthy === void 0) return;
24282
+ const now = getTimeProvider().now();
24283
+ const last = lastEmitByCli.get(unhealthy.cli);
24284
+ if (last !== void 0 && now - last < cooldownMs) return;
24285
+ lastEmitByCli.set(unhealthy.cli, now);
24286
+ pipelineBus.emit({
24287
+ type: "signal.swarm_unhealthy",
24288
+ timestamp: now,
24289
+ agentId: unhealthy.cli,
24290
+ reason: unhealthy.reason
24291
+ });
24292
+ } catch (error) {
24293
+ logger55.warn("Failed to emit signal.swarm_unhealthy from failover", {
24294
+ error: getErrorMessage(error)
24295
+ });
24296
+ }
24297
+ });
24298
+ }
24299
+ function shutdownFailoverSignals() {
24300
+ if (failoverSubscription !== void 0) {
24301
+ failoverSubscription.unsubscribe();
24302
+ failoverSubscription = void 0;
24303
+ }
24304
+ }
24305
+
24196
24306
  // src/mcp/eventbus-bridge-helpers.ts
24197
24307
  var TASK_STARTED_KEYWORDS = ["started", "created"];
24198
24308
  var TASK_COMPLETED_KEYWORDS = ["completed", "finalized", "reached"];
@@ -26891,7 +27001,7 @@ async function populateUnifiedContextOnState(state) {
26891
27001
  try {
26892
27002
  const taskCandidate = state["task"];
26893
27003
  if (typeof taskCandidate !== "string" || taskCandidate === "") return;
26894
- const { getContextForTask: getContextForTask2, inferTaskCategory: inferTaskCategory2 } = await import("./context-retriever-5BJYPAX7.js");
27004
+ const { getContextForTask: getContextForTask2, inferTaskCategory: inferTaskCategory2 } = await import("./context-retriever-JM564MOV.js");
26895
27005
  const ctx = await getContextForTask2({
26896
27006
  task: taskCandidate,
26897
27007
  category: inferTaskCategory2(taskCandidate),
@@ -28502,7 +28612,7 @@ var logger21 = createLogger({ component: "PolicyEvaluator" });
28502
28612
  function getPolicyMode() {
28503
28613
  return resolveV2Config().policyMode;
28504
28614
  }
28505
- function evaluatePolicy2(options, context) {
28615
+ function evaluatePipelinePolicy(options, context) {
28506
28616
  const mode = options.mode ?? getPolicyMode();
28507
28617
  if (mode === "off") {
28508
28618
  return { allowed: true, violations: [], mode };
@@ -28664,7 +28774,7 @@ function checkPipelinePolicy(task, stageType) {
28664
28774
  // forces an explicit producer wire-up at this single chokepoint.
28665
28775
  pipelineState: toPipelineStateSnapshot(task.metadata)
28666
28776
  };
28667
- const result = evaluatePolicy2({ engine, mode }, context);
28777
+ const result = evaluatePipelinePolicy({ engine, mode }, context);
28668
28778
  if (!result.allowed) {
28669
28779
  logger22.warn("Pipeline blocked by policy", {
28670
28780
  taskId: task.id,
@@ -32561,34 +32671,24 @@ import { createHash as createHash2 } from "crypto";
32561
32671
  // src/security/access-constraint-deriver/cache.ts
32562
32672
  var DEFAULT_MAX_ENTRIES = 256;
32563
32673
  var PolicyCache = class {
32674
+ cache;
32564
32675
  constructor(maxEntries = DEFAULT_MAX_ENTRIES) {
32565
- this.maxEntries = maxEntries;
32676
+ this.cache = new BoundedLRUCache(maxEntries);
32566
32677
  }
32567
- entries = /* @__PURE__ */ new Map();
32568
32678
  /** Gets a cached policy or undefined. Side effect: bumps LRU position. */
32569
32679
  get(objectiveHash) {
32570
- const entry = this.entries.get(objectiveHash);
32571
- if (entry === void 0) return void 0;
32572
- this.entries.delete(objectiveHash);
32573
- this.entries.set(objectiveHash, entry);
32574
- return entry.policy;
32680
+ return this.cache.get(objectiveHash);
32575
32681
  }
32576
- /** Stores a policy. Evicts the oldest entry if at capacity. */
32682
+ /** Stores a policy. Evicts the least-recently-used entry if at capacity. */
32577
32683
  set(objectiveHash, policy) {
32578
- if (this.entries.has(objectiveHash)) {
32579
- this.entries.delete(objectiveHash);
32580
- } else if (this.entries.size >= this.maxEntries) {
32581
- const oldest = this.entries.keys().next().value;
32582
- if (oldest !== void 0) this.entries.delete(oldest);
32583
- }
32584
- this.entries.set(objectiveHash, { policy, insertedAt: getTimeProvider().now() });
32684
+ this.cache.set(objectiveHash, policy);
32585
32685
  }
32586
32686
  /** Clears all entries. Useful for tests. */
32587
32687
  clear() {
32588
- this.entries.clear();
32688
+ this.cache.clear();
32589
32689
  }
32590
32690
  get size() {
32591
- return this.entries.size;
32691
+ return this.cache.size;
32592
32692
  }
32593
32693
  };
32594
32694
  var instance;
@@ -42385,7 +42485,7 @@ async function tryIssueTriage(task) {
42385
42485
  try {
42386
42486
  const issueMatch = task.match(/github\.com\/([^/]+\/[^/]+)\/issues\/(\d+)/);
42387
42487
  if (issueMatch === null) return null;
42388
- const { createIssueTriage } = await import("./issue-triage-AGGTH767.js");
42488
+ const { createIssueTriage } = await import("./issue-triage-2XVD4JQ7.js");
42389
42489
  const triage = createIssueTriage();
42390
42490
  const owner = issueMatch[1] ?? "";
42391
42491
  const num = issueMatch[2] ?? "";
@@ -42413,7 +42513,7 @@ var VALID_TEMPLATES = /* @__PURE__ */ new Set([
42413
42513
  ]);
42414
42514
  async function classifyWithLLM(task) {
42415
42515
  try {
42416
- const { executeExpert: executeExpert2 } = await import("./expert-bridge-JPTHFWPW.js");
42516
+ const { executeExpert: executeExpert2 } = await import("./expert-bridge-OXME7FES.js");
42417
42517
  const prompt = [
42418
42518
  "Classify this task into exactly one pipeline template.",
42419
42519
  "Templates: dev (implementation/bug fix/refactor), research (investigate/evaluate/compare),",
@@ -43195,7 +43295,7 @@ var memoryInitPromise = null;
43195
43295
  async function initPipelineMemory() {
43196
43296
  if (cachedMemory !== null) return cachedMemory;
43197
43297
  try {
43198
- const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-53NZRZB6.js");
43298
+ const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-2XAGY3PX.js");
43199
43299
  const { getLearningDir } = await import("./learning-persistence-UKPO7RYK.js");
43200
43300
  const mem = createSessionMemory2(getLearningDir());
43201
43301
  mem.startSession(`pipeline-${String(getTimeProvider().now())}`);
@@ -43252,7 +43352,7 @@ function recordRoutingExperience(category, success, durationMs) {
43252
43352
  callRecord(routingMemoryCache);
43253
43353
  return;
43254
43354
  }
43255
- routingMemoryInitPromise ??= import("./routing-memory-2FYZDQUC.js").then(({ createRoutingMemory }) => {
43355
+ routingMemoryInitPromise ??= import("./routing-memory-JAV2ICXR.js").then(({ createRoutingMemory }) => {
43256
43356
  routingMemoryCache ??= createRoutingMemory();
43257
43357
  return routingMemoryCache;
43258
43358
  }).catch((error) => {
@@ -43286,7 +43386,7 @@ ${text}` : "";
43286
43386
  }
43287
43387
  async function getWeatherContext() {
43288
43388
  try {
43289
- const { generateWeatherReport: generateWeatherReport2 } = await import("./weather-report-AUMNGHYZ.js");
43389
+ const { generateWeatherReport: generateWeatherReport2 } = await import("./weather-report-ZZM5EU7N.js");
43290
43390
  const report = generateWeatherReport2({ includeAdaptive: true });
43291
43391
  const mappings = "recommendedMappings" in report ? report.recommendedMappings : [];
43292
43392
  if (!Array.isArray(mappings) || mappings.length === 0) return "";
@@ -43304,7 +43404,7 @@ ${lines}
43304
43404
  }
43305
43405
  async function getMemoryContext(task) {
43306
43406
  try {
43307
- const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-53NZRZB6.js");
43407
+ const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-2XAGY3PX.js");
43308
43408
  const { getLearningDir } = await import("./learning-persistence-UKPO7RYK.js");
43309
43409
  const memory = createSessionMemory2(getLearningDir(), { maxLearningsInContext: 10 });
43310
43410
  const learnings = memory.searchLearnings(task.slice(0, 200));
@@ -43410,7 +43510,7 @@ ${contextBlock}`;
43410
43510
  const strategy = config.votingStrategy ?? "higher_order";
43411
43511
  await postProgress(config, "Vote", `Running consensus with ${strategy} strategy...`);
43412
43512
  try {
43413
- const { executeVoting } = await import("./consensus-vote-IDHQVKX2.js");
43513
+ const { executeVoting } = await import("./consensus-vote-TO5575P3.js");
43414
43514
  const votingResult = await executeVoting(
43415
43515
  {
43416
43516
  proposal: plan.slice(0, 4e3),
@@ -44337,7 +44437,7 @@ async function searchCodebaseForTask(task) {
44337
44437
  }
44338
44438
  async function queryResearchRegistry(task) {
44339
44439
  try {
44340
- const { synthesizeResearch: synthesizeResearch2 } = await import("./research-helpers-synthesize-C7YGRQI6.js");
44440
+ const { synthesizeResearch: synthesizeResearch2 } = await import("./research-helpers-synthesize-F7L7M7FJ.js");
44341
44441
  const topic = task.split(/[.!?\n]/).filter((s) => s.trim().length > 10)[0]?.trim();
44342
44442
  if (topic === void 0) return null;
44343
44443
  const result = await synthesizeResearch2(topic.slice(0, 50));
@@ -44408,7 +44508,7 @@ function createScanStageWrapper() {
44408
44508
  try {
44409
44509
  const slug = ctx.task.match(/([a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+)/)?.[1];
44410
44510
  if (slug !== void 0) {
44411
- const { generateSecurityPlan: generateSecurityPlan2 } = await import("./repo-security-plan-X42KXHT2.js");
44511
+ const { generateSecurityPlan: generateSecurityPlan2 } = await import("./repo-security-plan-JRDHWI2R.js");
44412
44512
  const plan = await generateSecurityPlan2({ repo: slug, maxScanners: 10 });
44413
44513
  const recs = plan.recommendations.slice(0, 5).map((r) => `${r.priority}: ${r.displayName} (${r.category})`).join("; ");
44414
44514
  return output(PIPELINE_STATE_KEYS.FINDINGS, recs, getTimeProvider().now() - start, true);
@@ -45858,6 +45958,32 @@ function calculateFitnessScore(version) {
45858
45958
  return calculator.audit(version);
45859
45959
  }
45860
45960
 
45961
+ // src/mcp/tools/improvement-review-signals.ts
45962
+ function worstDimension(audit) {
45963
+ let worst;
45964
+ for (const finding of audit.findings) {
45965
+ if (worst === void 0 || finding.pointsDeducted > worst.pointsDeducted) {
45966
+ worst = { dimension: finding.dimension, pointsDeducted: finding.pointsDeducted };
45967
+ }
45968
+ }
45969
+ return worst?.dimension;
45970
+ }
45971
+ function emitFitnessDeclinedSignal(audit, fitnessFloor, bus, logger55) {
45972
+ if (audit.score >= fitnessFloor) return;
45973
+ try {
45974
+ const dimension = worstDimension(audit);
45975
+ bus.emit({
45976
+ type: "signal.fitness_declined",
45977
+ timestamp: getTimeProvider().now(),
45978
+ score: audit.score,
45979
+ floor: fitnessFloor,
45980
+ ...dimension !== void 0 ? { dimension } : {}
45981
+ });
45982
+ } catch (error) {
45983
+ logger55.warn("Failed to emit signal.fitness_declined", { error: getErrorMessage(error) });
45984
+ }
45985
+ }
45986
+
45861
45987
  // src/mcp/tools/improvement-review.ts
45862
45988
  var execFileAsync3 = promisify3(execFile3);
45863
45989
  var ImprovementReviewInputSchema = z95.object({
@@ -46112,6 +46238,7 @@ async function runImprovementReview(input, deps = {}) {
46112
46238
  ...detectFitnessSignals(audit, fitnessFloor)
46113
46239
  ];
46114
46240
  signals.sort((a, b) => SEVERITY_ORDER3[a.severity] - SEVERITY_ORDER3[b.severity]);
46241
+ emitFitnessDeclinedSignal(audit, fitnessFloor, getPipelineEventBus(), logger55);
46115
46242
  const { issuesFiled, issuesSkipped } = fileIssues ? await fileSignalsAsIssues(signals, { logger: logger55 }) : { issuesFiled: [], issuesSkipped: [] };
46116
46243
  return {
46117
46244
  window: windowLabel,
@@ -51024,7 +51151,7 @@ var GitHubTaskTracker = class {
51024
51151
  cachedProvider = null;
51025
51152
  async getProvider() {
51026
51153
  if (this.cachedProvider !== null) return this.cachedProvider;
51027
- const { createScmProvider } = await import("./factory-NE7SNW7V.js");
51154
+ const { createScmProvider } = await import("./factory-MDT5CFA5.js");
51028
51155
  const result = await createScmProvider({ repo: this.config.repo ?? "" });
51029
51156
  if (!result.ok) throw new Error(`SCM provider error: ${result.error.message}`);
51030
51157
  this.cachedProvider = result.value;
@@ -51444,6 +51571,10 @@ export {
51444
51571
  createSwarmObserver,
51445
51572
  getSwarmObserver,
51446
51573
  setSwarmObserver,
51574
+ startSwarmHealthSignals,
51575
+ shutdownSwarmHealthSignals,
51576
+ startFailoverSignals,
51577
+ shutdownFailoverSignals,
51447
51578
  DEFAULT_DASHBOARD_CONFIG,
51448
51579
  DashboardConfigSchema,
51449
51580
  TextDashboardRenderer,
@@ -51532,7 +51663,7 @@ export {
51532
51663
  createDefaultPolicyEngine,
51533
51664
  resolveV2Config,
51534
51665
  getPolicyMode,
51535
- evaluatePolicy2 as evaluatePolicy,
51666
+ evaluatePipelinePolicy,
51536
51667
  createDelegatePipeline,
51537
51668
  delegateInputToTaskContract,
51538
51669
  executeDelegatePipeline,
@@ -51728,4 +51859,4 @@ export {
51728
51859
  detectBackend,
51729
51860
  createTaskTracker
51730
51861
  };
51731
- //# sourceMappingURL=chunk-KTJUMU2A.js.map
51862
+ //# sourceMappingURL=chunk-UC3PVIN4.js.map