nexus-agents 12.6.0 → 12.7.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 (135) hide show
  1. package/dist/{ast-rule-runner-XEQ5VAVV.js → ast-rule-runner-Y24PBTT2.js} +5 -5
  2. package/dist/{child-mcp-config-I2OAUNME.js → child-mcp-config-E7OJHDGM.js} +4 -4
  3. package/dist/{chunk-WMEV4263.js → chunk-32F2JIQ7.js} +371 -177
  4. package/dist/{chunk-WMEV4263.js.map → chunk-32F2JIQ7.js.map} +1 -1
  5. package/dist/{chunk-SGHPOXYZ.js → chunk-3NJ2VOIA.js} +2 -2
  6. package/dist/{chunk-7DTZMHL7.js → chunk-644XVF2Z.js} +4 -3
  7. package/dist/chunk-644XVF2Z.js.map +1 -0
  8. package/dist/{chunk-LUQ5DQZF.js → chunk-7OWPKZVJ.js} +2 -2
  9. package/dist/{chunk-SET4R6QZ.js → chunk-APCAAKLU.js} +4 -4
  10. package/dist/{chunk-VVPF6HHD.js → chunk-B7XCGPEQ.js} +4 -4
  11. package/dist/{chunk-NMIAGVWS.js → chunk-DBIF43Y5.js} +2 -2
  12. package/dist/{chunk-R7Y7BBG5.js → chunk-DEJZBJ3X.js} +3 -3
  13. package/dist/{chunk-PPGUFPJQ.js → chunk-DHDG5AZH.js} +5 -5
  14. package/dist/{chunk-UJKT5T3J.js → chunk-DKYP4FGN.js} +2 -2
  15. package/dist/{chunk-L2YUWHLO.js → chunk-E36PFEF6.js} +11 -10
  16. package/dist/{chunk-L2YUWHLO.js.map → chunk-E36PFEF6.js.map} +1 -1
  17. package/dist/{chunk-OZ4MJ37G.js → chunk-E6UCTQDW.js} +3 -3
  18. package/dist/{chunk-GIQWYFPY.js → chunk-EQYDFNEI.js} +4 -4
  19. package/dist/{chunk-2MF4NNPO.js → chunk-EYT2XPU5.js} +8 -8
  20. package/dist/{chunk-ZWWPRNNJ.js → chunk-FRLQV7PA.js} +2 -2
  21. package/dist/{chunk-I3J4CPNU.js → chunk-FZKKE56L.js} +4 -4
  22. package/dist/{chunk-YTXSARQ3.js → chunk-JDXI3PAE.js} +2 -2
  23. package/dist/{chunk-KW5INM6Y.js → chunk-KEDV6ANF.js} +2 -2
  24. package/dist/{chunk-MTW6GDCJ.js → chunk-LN72XW24.js} +4 -4
  25. package/dist/{chunk-6WWR6LYI.js → chunk-NRP3RECB.js} +3 -3
  26. package/dist/{chunk-3BSLRRPJ.js → chunk-PQKMJL5R.js} +334 -120
  27. package/dist/chunk-PQKMJL5R.js.map +1 -0
  28. package/dist/{chunk-L73EN5BY.js → chunk-QEKDQK2X.js} +7 -7
  29. package/dist/{chunk-J72TWH3S.js → chunk-QT3EBFLT.js} +2 -2
  30. package/dist/{chunk-BI7LI47F.js → chunk-RDMHUTID.js} +5 -5
  31. package/dist/{chunk-JRWSE2MH.js → chunk-RONWR5FX.js} +2 -2
  32. package/dist/{chunk-IIU4MHGC.js → chunk-SYMR2UOV.js} +11 -11
  33. package/dist/{chunk-PE42IZWH.js → chunk-TKRXEBFT.js} +5 -5
  34. package/dist/{chunk-KSJ43GHQ.js → chunk-TQMMWFNV.js} +2 -2
  35. package/dist/{chunk-CQX276YP.js → chunk-TRPJOMT6.js} +4 -4
  36. package/dist/{chunk-LLYA4RZQ.js → chunk-UPBZUIUK.js} +2 -2
  37. package/dist/{chunk-WDOWAWVR.js → chunk-W7S2425L.js} +4 -4
  38. package/dist/{chunk-OOJD457B.js → chunk-XUBLXLIX.js} +2 -2
  39. package/dist/{chunk-R432XO4C.js → chunk-Y27UGO7B.js} +2 -2
  40. package/dist/{cli-circuit-breaker-AH7J5ASH.js → cli-circuit-breaker-XJ2TJDBM.js} +5 -5
  41. package/dist/{cli-readiness-4XOIA7HB.js → cli-readiness-3TTVQ5XP.js} +9 -9
  42. package/dist/{cli-server-gateway-CZKAGL44.js → cli-server-gateway-DRSLCYY4.js} +14 -14
  43. package/dist/cli.js +45 -45
  44. package/dist/{composite-router-OJIITGKG.js → composite-router-OJ6EVVHQ.js} +4 -4
  45. package/dist/{consensus-vote-MNPLBGXT.js → consensus-vote-AFHPZ643.js} +17 -17
  46. package/dist/{context-retriever-P4WAQWKW.js → context-retriever-TJY4PZDE.js} +10 -10
  47. package/dist/{doctor-deep-WZXW4DLJ.js → doctor-deep-G7ZBVSDY.js} +5 -5
  48. package/dist/{doctor-gateway-report-IF2LA3UW.js → doctor-gateway-report-M4IU4TGU.js} +7 -7
  49. package/dist/{doctor-live-BKDDUXO7.js → doctor-live-LYQ36L3R.js} +14 -14
  50. package/dist/{expert-bridge-OW4PM4ZT.js → expert-bridge-VRMBEB25.js} +6 -6
  51. package/dist/{factory-6YIROBGX.js → factory-B5KLEQKU.js} +7 -7
  52. package/dist/{factory-JJIJMMSM.js → factory-KFLVCHVV.js} +13 -13
  53. package/dist/{gemini-adapter-QOKHQPOE.js → gemini-adapter-BJRHVQAF.js} +8 -8
  54. package/dist/{improvement-review-6NRVWYAE.js → improvement-review-L3WUAAEV.js} +6 -6
  55. package/dist/index.d.ts +32 -0
  56. package/dist/index.js +27 -27
  57. package/dist/index.js.map +1 -1
  58. package/dist/{init-opencode-LJ7257CE.js → init-opencode-G25FGBP7.js} +6 -6
  59. package/dist/{issue-triage-OKLIMR7X.js → issue-triage-WJQZC3WH.js} +7 -7
  60. package/dist/{model-config-helpers-76F52NYN.js → model-config-helpers-C5DOOYDZ.js} +3 -3
  61. package/dist/{openai-compat-adapter-V76U3PUN.js → openai-compat-adapter-3H3JSNGP.js} +6 -6
  62. package/dist/{pr-reviewer-helpers-IOPD6IFE.js → pr-reviewer-helpers-RSV4RCVN.js} +5 -5
  63. package/dist/{registry-command-BIA6EFOS.js → registry-command-KAFGFMJH.js} +2 -2
  64. package/dist/{repo-security-plan-O6V5DZXV.js → repo-security-plan-5VPJP4HN.js} +4 -4
  65. package/dist/{research-helpers-synthesize-3PT4X3BX.js → research-helpers-synthesize-Q5EU3I3D.js} +6 -6
  66. package/dist/{routing-memory-A6HRDTWW.js → routing-memory-PFBPOTQO.js} +4 -4
  67. package/dist/{session-memory-WPVNRUJX.js → session-memory-AGLSO5V6.js} +5 -5
  68. package/dist/{setup-config-74NQ2KYK.js → setup-config-PWY5SNVF.js} +5 -5
  69. package/dist/{setup-custom-api-22PDSWHY.js → setup-custom-api-66W2TBGK.js} +5 -5
  70. package/dist/{tool-memory-G2Z5TEOY.js → tool-memory-F3W5QQ3I.js} +7 -7
  71. package/dist/{unified-registry-BQXEZKHW.js → unified-registry-RSXTD5CV.js} +13 -13
  72. package/dist/{weather-report-DROJA42L.js → weather-report-EM6ZPAZ2.js} +4 -4
  73. package/package.json +1 -1
  74. package/dist/chunk-3BSLRRPJ.js.map +0 -1
  75. package/dist/chunk-7DTZMHL7.js.map +0 -1
  76. /package/dist/{ast-rule-runner-XEQ5VAVV.js.map → ast-rule-runner-Y24PBTT2.js.map} +0 -0
  77. /package/dist/{child-mcp-config-I2OAUNME.js.map → child-mcp-config-E7OJHDGM.js.map} +0 -0
  78. /package/dist/{chunk-SGHPOXYZ.js.map → chunk-3NJ2VOIA.js.map} +0 -0
  79. /package/dist/{chunk-LUQ5DQZF.js.map → chunk-7OWPKZVJ.js.map} +0 -0
  80. /package/dist/{chunk-SET4R6QZ.js.map → chunk-APCAAKLU.js.map} +0 -0
  81. /package/dist/{chunk-VVPF6HHD.js.map → chunk-B7XCGPEQ.js.map} +0 -0
  82. /package/dist/{chunk-NMIAGVWS.js.map → chunk-DBIF43Y5.js.map} +0 -0
  83. /package/dist/{chunk-R7Y7BBG5.js.map → chunk-DEJZBJ3X.js.map} +0 -0
  84. /package/dist/{chunk-PPGUFPJQ.js.map → chunk-DHDG5AZH.js.map} +0 -0
  85. /package/dist/{chunk-UJKT5T3J.js.map → chunk-DKYP4FGN.js.map} +0 -0
  86. /package/dist/{chunk-OZ4MJ37G.js.map → chunk-E6UCTQDW.js.map} +0 -0
  87. /package/dist/{chunk-GIQWYFPY.js.map → chunk-EQYDFNEI.js.map} +0 -0
  88. /package/dist/{chunk-2MF4NNPO.js.map → chunk-EYT2XPU5.js.map} +0 -0
  89. /package/dist/{chunk-ZWWPRNNJ.js.map → chunk-FRLQV7PA.js.map} +0 -0
  90. /package/dist/{chunk-I3J4CPNU.js.map → chunk-FZKKE56L.js.map} +0 -0
  91. /package/dist/{chunk-YTXSARQ3.js.map → chunk-JDXI3PAE.js.map} +0 -0
  92. /package/dist/{chunk-KW5INM6Y.js.map → chunk-KEDV6ANF.js.map} +0 -0
  93. /package/dist/{chunk-MTW6GDCJ.js.map → chunk-LN72XW24.js.map} +0 -0
  94. /package/dist/{chunk-6WWR6LYI.js.map → chunk-NRP3RECB.js.map} +0 -0
  95. /package/dist/{chunk-L73EN5BY.js.map → chunk-QEKDQK2X.js.map} +0 -0
  96. /package/dist/{chunk-J72TWH3S.js.map → chunk-QT3EBFLT.js.map} +0 -0
  97. /package/dist/{chunk-BI7LI47F.js.map → chunk-RDMHUTID.js.map} +0 -0
  98. /package/dist/{chunk-JRWSE2MH.js.map → chunk-RONWR5FX.js.map} +0 -0
  99. /package/dist/{chunk-IIU4MHGC.js.map → chunk-SYMR2UOV.js.map} +0 -0
  100. /package/dist/{chunk-PE42IZWH.js.map → chunk-TKRXEBFT.js.map} +0 -0
  101. /package/dist/{chunk-KSJ43GHQ.js.map → chunk-TQMMWFNV.js.map} +0 -0
  102. /package/dist/{chunk-CQX276YP.js.map → chunk-TRPJOMT6.js.map} +0 -0
  103. /package/dist/{chunk-LLYA4RZQ.js.map → chunk-UPBZUIUK.js.map} +0 -0
  104. /package/dist/{chunk-WDOWAWVR.js.map → chunk-W7S2425L.js.map} +0 -0
  105. /package/dist/{chunk-OOJD457B.js.map → chunk-XUBLXLIX.js.map} +0 -0
  106. /package/dist/{chunk-R432XO4C.js.map → chunk-Y27UGO7B.js.map} +0 -0
  107. /package/dist/{cli-circuit-breaker-AH7J5ASH.js.map → cli-circuit-breaker-XJ2TJDBM.js.map} +0 -0
  108. /package/dist/{cli-readiness-4XOIA7HB.js.map → cli-readiness-3TTVQ5XP.js.map} +0 -0
  109. /package/dist/{cli-server-gateway-CZKAGL44.js.map → cli-server-gateway-DRSLCYY4.js.map} +0 -0
  110. /package/dist/{composite-router-OJIITGKG.js.map → composite-router-OJ6EVVHQ.js.map} +0 -0
  111. /package/dist/{consensus-vote-MNPLBGXT.js.map → consensus-vote-AFHPZ643.js.map} +0 -0
  112. /package/dist/{context-retriever-P4WAQWKW.js.map → context-retriever-TJY4PZDE.js.map} +0 -0
  113. /package/dist/{doctor-deep-WZXW4DLJ.js.map → doctor-deep-G7ZBVSDY.js.map} +0 -0
  114. /package/dist/{doctor-gateway-report-IF2LA3UW.js.map → doctor-gateway-report-M4IU4TGU.js.map} +0 -0
  115. /package/dist/{doctor-live-BKDDUXO7.js.map → doctor-live-LYQ36L3R.js.map} +0 -0
  116. /package/dist/{expert-bridge-OW4PM4ZT.js.map → expert-bridge-VRMBEB25.js.map} +0 -0
  117. /package/dist/{factory-6YIROBGX.js.map → factory-B5KLEQKU.js.map} +0 -0
  118. /package/dist/{factory-JJIJMMSM.js.map → factory-KFLVCHVV.js.map} +0 -0
  119. /package/dist/{gemini-adapter-QOKHQPOE.js.map → gemini-adapter-BJRHVQAF.js.map} +0 -0
  120. /package/dist/{improvement-review-6NRVWYAE.js.map → improvement-review-L3WUAAEV.js.map} +0 -0
  121. /package/dist/{init-opencode-LJ7257CE.js.map → init-opencode-G25FGBP7.js.map} +0 -0
  122. /package/dist/{issue-triage-OKLIMR7X.js.map → issue-triage-WJQZC3WH.js.map} +0 -0
  123. /package/dist/{model-config-helpers-76F52NYN.js.map → model-config-helpers-C5DOOYDZ.js.map} +0 -0
  124. /package/dist/{openai-compat-adapter-V76U3PUN.js.map → openai-compat-adapter-3H3JSNGP.js.map} +0 -0
  125. /package/dist/{pr-reviewer-helpers-IOPD6IFE.js.map → pr-reviewer-helpers-RSV4RCVN.js.map} +0 -0
  126. /package/dist/{registry-command-BIA6EFOS.js.map → registry-command-KAFGFMJH.js.map} +0 -0
  127. /package/dist/{repo-security-plan-O6V5DZXV.js.map → repo-security-plan-5VPJP4HN.js.map} +0 -0
  128. /package/dist/{research-helpers-synthesize-3PT4X3BX.js.map → research-helpers-synthesize-Q5EU3I3D.js.map} +0 -0
  129. /package/dist/{routing-memory-A6HRDTWW.js.map → routing-memory-PFBPOTQO.js.map} +0 -0
  130. /package/dist/{session-memory-WPVNRUJX.js.map → session-memory-AGLSO5V6.js.map} +0 -0
  131. /package/dist/{setup-config-74NQ2KYK.js.map → setup-config-PWY5SNVF.js.map} +0 -0
  132. /package/dist/{setup-custom-api-22PDSWHY.js.map → setup-custom-api-66W2TBGK.js.map} +0 -0
  133. /package/dist/{tool-memory-G2Z5TEOY.js.map → tool-memory-F3W5QQ3I.js.map} +0 -0
  134. /package/dist/{unified-registry-BQXEZKHW.js.map → unified-registry-RSXTD5CV.js.map} +0 -0
  135. /package/dist/{weather-report-DROJA42L.js.map → weather-report-EM6ZPAZ2.js.map} +0 -0
@@ -62,7 +62,7 @@ import {
62
62
  updateStage,
63
63
  withFileLock,
64
64
  writeJobCancelled
65
- } from "./chunk-L2YUWHLO.js";
65
+ } from "./chunk-E36PFEF6.js";
66
66
  import {
67
67
  allOf,
68
68
  anyOf
@@ -70,7 +70,7 @@ import {
70
70
  import {
71
71
  normalizeTopicToCanonical,
72
72
  synthesizeResearch
73
- } from "./chunk-OZ4MJ37G.js";
73
+ } from "./chunk-E6UCTQDW.js";
74
74
  import {
75
75
  IssueTriage,
76
76
  createAuditTrail,
@@ -79,13 +79,13 @@ import {
79
79
  createGraphAuditBridge,
80
80
  emitPipelinePolicyEvent,
81
81
  readActionRefusal
82
- } from "./chunk-MTW6GDCJ.js";
82
+ } from "./chunk-LN72XW24.js";
83
83
  import {
84
84
  sanitizeInput
85
85
  } from "./chunk-RYDTFPVI.js";
86
86
  import {
87
87
  withPrerequisite
88
- } from "./chunk-7DTZMHL7.js";
88
+ } from "./chunk-644XVF2Z.js";
89
89
  import {
90
90
  NOOP_NOTIFIER,
91
91
  RateLimiter,
@@ -117,7 +117,7 @@ import {
117
117
  toolSuccess,
118
118
  withProgressHeartbeat,
119
119
  wrapToolWithTimeout
120
- } from "./chunk-R7Y7BBG5.js";
120
+ } from "./chunk-DEJZBJ3X.js";
121
121
  import {
122
122
  generateSecurityPlan
123
123
  } from "./chunk-KMGKOF5P.js";
@@ -163,7 +163,7 @@ import {
163
163
  parseRegistry,
164
164
  sourceExistsInRegistry,
165
165
  summarizeContextForPrompt
166
- } from "./chunk-PPGUFPJQ.js";
166
+ } from "./chunk-DHDG5AZH.js";
167
167
  import {
168
168
  REGISTRY_PATH,
169
169
  computeSourceQualityScore,
@@ -171,11 +171,11 @@ import {
171
171
  loadPapersRegistry,
172
172
  loadTechniquesRegistry,
173
173
  resolveRegistryRoot
174
- } from "./chunk-UJKT5T3J.js";
174
+ } from "./chunk-DKYP4FGN.js";
175
175
  import {
176
176
  getTokenEnvVars,
177
177
  resolveToken
178
- } from "./chunk-LLYA4RZQ.js";
178
+ } from "./chunk-UPBZUIUK.js";
179
179
  import {
180
180
  DEFAULT_RELEVANCE_CONFIG,
181
181
  MemoryImportance,
@@ -183,7 +183,7 @@ import {
183
183
  calculateTextJaccardSimilarity,
184
184
  getToolMemory,
185
185
  memoryTrustTierTag
186
- } from "./chunk-CQX276YP.js";
186
+ } from "./chunk-TRPJOMT6.js";
187
187
  import {
188
188
  EXTERNAL_CONTENT_TRUST_TIER,
189
189
  resolveContentTrustProvenance,
@@ -192,7 +192,7 @@ import {
192
192
  } from "./chunk-RGB5OTRZ.js";
193
193
  import {
194
194
  createSessionMemory
195
- } from "./chunk-J72TWH3S.js";
195
+ } from "./chunk-QT3EBFLT.js";
196
196
  import {
197
197
  TrustTierSchema
198
198
  } from "./chunk-BFO2NZPO.js";
@@ -207,7 +207,7 @@ import {
207
207
  } from "./chunk-MZWHXERV.js";
208
208
  import {
209
209
  executeExpert
210
- } from "./chunk-2MF4NNPO.js";
210
+ } from "./chunk-EYT2XPU5.js";
211
211
  import {
212
212
  CliDetectionCache,
213
213
  EventTopics,
@@ -218,7 +218,7 @@ import {
218
218
  getAvailableClis,
219
219
  getGlobalEventBus,
220
220
  getGlobalRegistry
221
- } from "./chunk-IIU4MHGC.js";
221
+ } from "./chunk-SYMR2UOV.js";
222
222
  import {
223
223
  DEFAULTS
224
224
  } from "./chunk-L47UF7ET.js";
@@ -235,7 +235,7 @@ import {
235
235
  getAvailabilityCache,
236
236
  getCliForModelId,
237
237
  resolveFallback
238
- } from "./chunk-I3J4CPNU.js";
238
+ } from "./chunk-FZKKE56L.js";
239
239
  import {
240
240
  BaseAdapter,
241
241
  createStream,
@@ -243,11 +243,11 @@ import {
243
243
  parseGatewayExtraHeaders,
244
244
  requireApiKey,
245
245
  validateApiKeyPresence
246
- } from "./chunk-PE42IZWH.js";
246
+ } from "./chunk-TKRXEBFT.js";
247
247
  import {
248
248
  BWRAP_READ_ONLY_ARGS,
249
249
  createBwrapPreflight
250
- } from "./chunk-WDOWAWVR.js";
250
+ } from "./chunk-W7S2425L.js";
251
251
  import {
252
252
  getMemoryRegistry
253
253
  } from "./chunk-ROYGBFVE.js";
@@ -255,14 +255,14 @@ import {
255
255
  SIGKILL_GRACE_MS,
256
256
  terminateProcessTree,
257
257
  trackProcessTree
258
- } from "./chunk-GIQWYFPY.js";
258
+ } from "./chunk-EQYDFNEI.js";
259
259
  import {
260
260
  generateHyphenId,
261
261
  generateUUID
262
- } from "./chunk-OOJD457B.js";
262
+ } from "./chunk-XUBLXLIX.js";
263
263
  import {
264
264
  getDefaultCliCircuitBreakerRegistry
265
- } from "./chunk-KSJ43GHQ.js";
265
+ } from "./chunk-TQMMWFNV.js";
266
266
  import {
267
267
  sanitizeErrorDetails,
268
268
  sanitizeOutput
@@ -282,6 +282,7 @@ import {
282
282
  DecisionGateSchema,
283
283
  ErrorCode,
284
284
  LinUCBBandit,
285
+ MAX_TRACE_ATTRIBUTION_BYTES,
285
286
  MODELSDEV_CATALOGUE_CAVEATS,
286
287
  ModelCapability,
287
288
  ModelError,
@@ -299,7 +300,11 @@ import {
299
300
  SharedTaskAnalyzer,
300
301
  StrategyNameSchema,
301
302
  TOOL_MANIFEST,
303
+ TRACE_ATTRIBUTION_FILE,
302
304
  TimeoutError,
305
+ TraceAttributionSnapshotSchema,
306
+ TraceOriginSchema,
307
+ TraceRunOriginSchema,
303
308
  UNRESOLVED_MODEL_ID,
304
309
  ValidationError,
305
310
  WeatherReportInputSchema,
@@ -317,6 +322,7 @@ import {
317
322
  classifyStallTick,
318
323
  computeTokenCost,
319
324
  createSharedTaskAnalyzer,
325
+ decodeTraceBytes,
320
326
  deriveResearchMaturity,
321
327
  detectCapabilityGaps,
322
328
  detectTrend,
@@ -359,8 +365,10 @@ import {
359
365
  queryModelAccessMode,
360
366
  raceAbort,
361
367
  rankStrategiesByManifest,
368
+ readTraceSnapshot,
362
369
  recordRoutingGaps,
363
370
  recordToolRefusal,
371
+ relationCounts,
364
372
  researchContextFromText,
365
373
  resolveInsideRoot,
366
374
  runInHeartbeatSession,
@@ -370,11 +378,13 @@ import {
370
378
  throwIfAborted,
371
379
  toError,
372
380
  toExpertTaskAnalysisResult,
381
+ traceDigest,
382
+ traceRelation,
373
383
  truncateText,
374
384
  truncateWithInfo,
375
385
  withStep,
376
386
  withTimeout
377
- } from "./chunk-3BSLRRPJ.js";
387
+ } from "./chunk-PQKMJL5R.js";
378
388
  import {
379
389
  SUPPORTED_EXTENSIONS
380
390
  } from "./chunk-XBEKMUTO.js";
@@ -389,13 +399,13 @@ import {
389
399
  lookupInTreeCapability,
390
400
  modelSupportsAll,
391
401
  resolveOwnerCli
392
- } from "./chunk-NMIAGVWS.js";
402
+ } from "./chunk-DBIF43Y5.js";
393
403
  import {
394
404
  deriveEntry,
395
405
  getDefaultRegistry,
396
406
  resolveModelIdentity,
397
407
  resolveModelIdentitySync
398
- } from "./chunk-ZWWPRNNJ.js";
408
+ } from "./chunk-FRLQV7PA.js";
399
409
  import {
400
410
  ensureLearningDir,
401
411
  getMetaOutcomesFile,
@@ -2494,7 +2504,7 @@ var RateLimiter2 = class {
2494
2504
  * Sleeps for the specified duration.
2495
2505
  */
2496
2506
  sleep(ms) {
2497
- return new Promise((resolve17) => setTimeout(resolve17, ms));
2507
+ return new Promise((resolve18) => setTimeout(resolve18, ms));
2498
2508
  }
2499
2509
  /**
2500
2510
  * Returns the current number of available tokens.
@@ -2717,14 +2727,14 @@ function notifyRetry(onRetry, info) {
2717
2727
  function sleepUnlessAborted(ms, signal) {
2718
2728
  if (signal === void 0) return sleep(ms).then(() => true);
2719
2729
  if (signal.aborted) return Promise.resolve(false);
2720
- return new Promise((resolve17) => {
2730
+ return new Promise((resolve18) => {
2721
2731
  const onAbort = () => {
2722
2732
  clearTimeout(timer);
2723
- resolve17(false);
2733
+ resolve18(false);
2724
2734
  };
2725
2735
  const timer = setTimeout(() => {
2726
2736
  signal.removeEventListener("abort", onAbort);
2727
- resolve17(true);
2737
+ resolve18(true);
2728
2738
  }, ms);
2729
2739
  signal.addEventListener("abort", onAbort, { once: true });
2730
2740
  });
@@ -5723,13 +5733,13 @@ function makeCancelError(taskId) {
5723
5733
  }
5724
5734
  function executeWithTimeout(params) {
5725
5735
  const { task, maxDurationMs, executeTask, transformError, signal } = params;
5726
- return new Promise((resolve17) => {
5736
+ return new Promise((resolve18) => {
5727
5737
  let settled = false;
5728
5738
  const settle = (result) => {
5729
5739
  if (settled) return;
5730
5740
  settled = true;
5731
5741
  clearTimeout(timeoutId);
5732
- resolve17(result);
5742
+ resolve18(result);
5733
5743
  };
5734
5744
  const timeoutId = setTimeout(() => {
5735
5745
  settle(
@@ -11482,13 +11492,13 @@ var WaveScheduler = class {
11482
11492
  }
11483
11493
  async withTimeout(promise, timeoutMs, taskId) {
11484
11494
  if (timeoutMs <= 0) return promise;
11485
- return new Promise((resolve17, reject) => {
11495
+ return new Promise((resolve18, reject) => {
11486
11496
  const timer = setTimeout(() => {
11487
11497
  reject(new Error(`Task ${taskId} timed out after ${String(timeoutMs)}ms`));
11488
11498
  }, timeoutMs);
11489
11499
  promise.then((result) => {
11490
11500
  clearTimeout(timer);
11491
- resolve17(result);
11501
+ resolve18(result);
11492
11502
  }).catch((error) => {
11493
11503
  clearTimeout(timer);
11494
11504
  reject(error instanceof Error ? error : new Error(String(error)));
@@ -19134,8 +19144,8 @@ var Semaphore = class {
19134
19144
  this.available -= 1;
19135
19145
  return Promise.resolve();
19136
19146
  }
19137
- return new Promise((resolve17) => {
19138
- this.waiters.push(resolve17);
19147
+ return new Promise((resolve18) => {
19148
+ this.waiters.push(resolve18);
19139
19149
  });
19140
19150
  }
19141
19151
  release() {
@@ -22554,9 +22564,9 @@ var ExpertPool = class {
22554
22564
  if (this.active < this.capacity) {
22555
22565
  return this.issuePermit();
22556
22566
  }
22557
- return new Promise((resolve17, reject) => {
22567
+ return new Promise((resolve18, reject) => {
22558
22568
  const timer = setTimeout(() => {
22559
- const idx = this.queue.findIndex((e) => e.resolve === resolve17);
22569
+ const idx = this.queue.findIndex((e) => e.resolve === resolve18);
22560
22570
  if (idx !== -1) {
22561
22571
  this.queue.splice(idx, 1);
22562
22572
  }
@@ -22566,7 +22576,7 @@ var ExpertPool = class {
22566
22576
  )
22567
22577
  );
22568
22578
  }, this.acquireTimeoutMs);
22569
- this.queue.push({ resolve: resolve17, reject, timer });
22579
+ this.queue.push({ resolve: resolve18, reject, timer });
22570
22580
  });
22571
22581
  }
22572
22582
  /** Release a permit back to the pool. */
@@ -23161,8 +23171,8 @@ var TaskQueue = class {
23161
23171
  if (this.cancelled) {
23162
23172
  return Promise.reject(new Error("Queue has been cancelled"));
23163
23173
  }
23164
- return new Promise((resolve17, reject) => {
23165
- this.queue.push({ task, resolve: resolve17, reject });
23174
+ return new Promise((resolve18, reject) => {
23175
+ this.queue.push({ task, resolve: resolve18, reject });
23166
23176
  this.processNext();
23167
23177
  });
23168
23178
  }
@@ -23438,16 +23448,16 @@ async function executeStepWithTimeout(step, context, stepExecutor, signal) {
23438
23448
  return executeWithTimeout2(step, stepContext, stepExecutor, stepTimeout, startTime);
23439
23449
  }
23440
23450
  function executeWithTimeout2(step, context, executor, timeout, startTime) {
23441
- return new Promise((resolve17) => {
23451
+ return new Promise((resolve18) => {
23442
23452
  const timeoutId = setTimeout(() => {
23443
- resolve17(createTimeoutResult(step.id, getTimeProvider().now() - startTime, timeout));
23453
+ resolve18(createTimeoutResult(step.id, getTimeProvider().now() - startTime, timeout));
23444
23454
  }, timeout);
23445
23455
  executor(step, context).then((result) => {
23446
23456
  clearTimeout(timeoutId);
23447
- resolve17(result);
23457
+ resolve18(result);
23448
23458
  }).catch((error) => {
23449
23459
  clearTimeout(timeoutId);
23450
- resolve17(createErrorResult(step.id, getTimeProvider().now() - startTime, error));
23460
+ resolve18(createErrorResult(step.id, getTimeProvider().now() - startTime, error));
23451
23461
  });
23452
23462
  });
23453
23463
  }
@@ -26288,8 +26298,8 @@ function resolveCwdProjectRoot(logger62) {
26288
26298
  function beginWorkspaceRootResolution(logger62) {
26289
26299
  if (resolution?.timer !== void 0) clearTimeout(resolution.timer);
26290
26300
  let resolveReady;
26291
- workspaceRootReady = new Promise((resolve17) => {
26292
- resolveReady = resolve17;
26301
+ workspaceRootReady = new Promise((resolve18) => {
26302
+ resolveReady = resolve18;
26293
26303
  });
26294
26304
  const root = resolveNexusProjectRoot(logger62) ?? resolveClaudeProjectRoot(logger62) ?? resolveCwdProjectRoot(logger62);
26295
26305
  if (root === null) {
@@ -29096,6 +29106,7 @@ function emitSwarmUnhealthySignals(metrics, bus, logger62 = defaultLogger) {
29096
29106
  emittedSlots.add(slot);
29097
29107
  bus.emit({
29098
29108
  type: "signal.swarm_unhealthy",
29109
+ origin: { kind: "global", producer: "swarm-health" },
29099
29110
  timestamp: Date.parse(metrics.calculatedAt),
29100
29111
  agentId: slot,
29101
29112
  reason: `bottleneck: ${String(bottleneck.queuedMessages)} queued, ${String(bottleneck.blockedAgents)} blocked (severity ${bottleneck.severity})`
@@ -29160,6 +29171,7 @@ function startFailoverSignals(options) {
29160
29171
  lastEmitByCli.set(unhealthy.cli, now);
29161
29172
  pipelineBus.emit({
29162
29173
  type: "signal.swarm_unhealthy",
29174
+ origin: { kind: "global", producer: "failover" },
29163
29175
  timestamp: now,
29164
29176
  agentId: unhealthy.cli,
29165
29177
  reason: unhealthy.reason
@@ -30629,8 +30641,8 @@ function budgetHaltFailure(context) {
30629
30641
  import { randomUUID as randomUUID8 } from "node:crypto";
30630
30642
  function resolveExecutionEngineOrError(deps, workflowName) {
30631
30643
  try {
30632
- const resolve17 = deps.resolveExecutionEngine ?? (() => deps.workflowEngine);
30633
- return { ok: true, value: resolve17() };
30644
+ const resolve18 = deps.resolveExecutionEngine ?? (() => deps.workflowEngine);
30645
+ return { ok: true, value: resolve18() };
30634
30646
  } catch (error) {
30635
30647
  const message = error instanceof Error ? error.message : String(error);
30636
30648
  deps.logger?.error(
@@ -31314,7 +31326,7 @@ function execIdFields(executionId) {
31314
31326
  async function populateUnifiedContextOnState(state, options) {
31315
31327
  const taskCandidate = state["task"];
31316
31328
  if (typeof taskCandidate !== "string" || taskCandidate === "") return;
31317
- const { getContextForTask: getContextForTask2, inferTaskCategory: inferTaskCategory2 } = await import("./context-retriever-P4WAQWKW.js");
31329
+ const { getContextForTask: getContextForTask2, inferTaskCategory: inferTaskCategory2 } = await import("./context-retriever-TJY4PZDE.js");
31318
31330
  const category = inferTaskCategory2(taskCandidate);
31319
31331
  const executionId = options?.executionId;
31320
31332
  const execFields = execIdFields(executionId);
@@ -31835,13 +31847,13 @@ function dedupe(ids) {
31835
31847
  return [...new Set(ids)];
31836
31848
  }
31837
31849
  async function withTimeout3(promise, ms) {
31838
- return new Promise((resolve17, reject) => {
31850
+ return new Promise((resolve18, reject) => {
31839
31851
  const timer = setTimeout(() => {
31840
31852
  reject(new Error(`Node timed out after ${String(ms)}ms`));
31841
31853
  }, ms);
31842
31854
  promise.then((result) => {
31843
31855
  clearTimeout(timer);
31844
- resolve17(result);
31856
+ resolve18(result);
31845
31857
  }).catch((error) => {
31846
31858
  clearTimeout(timer);
31847
31859
  reject(error instanceof Error ? error : new Error(String(error)));
@@ -32945,22 +32957,37 @@ function emitPipelineStageEvent(prefix, stage, status, details) {
32945
32957
  import { createHash as createHash4 } from "node:crypto";
32946
32958
 
32947
32959
  // src/pipeline/trace-writer.ts
32960
+ import { randomUUID as randomUUID9 } from "node:crypto";
32948
32961
  import { mkdir, writeFile, rename, unlink } from "node:fs/promises";
32949
- import { join as join5 } from "node:path";
32962
+ import { join as join5, resolve as resolve6 } from "node:path";
32950
32963
  var logger23 = createLogger({ component: "TraceWriter" });
32951
32964
  var MAX_BUFFER_SIZE = 5e4;
32952
32965
  var TraceWriter = class {
32953
32966
  constructor(bus, options) {
32954
32967
  this.options = options;
32955
- this.runDir = join5(options.runsDir, options.runId);
32968
+ const origin = options.origin === void 0 ? void 0 : TraceRunOriginSchema.parse(options.origin);
32969
+ if (origin !== void 0 && origin.runId !== options.runId)
32970
+ throw new Error("Trace capture run mismatch");
32971
+ this.options = { ...options, ...origin === void 0 ? {} : { origin } };
32972
+ this.runDir = resolve6(options.runsDir, options.runId);
32956
32973
  this.maxBuffer = options.maxBufferSize ?? MAX_BUFFER_SIZE;
32974
+ if (!Number.isSafeInteger(this.maxBuffer) || this.maxBuffer < 1)
32975
+ throw new Error("Invalid trace buffer size");
32957
32976
  this.unsubscribe = bus.subscribe({}, (event) => {
32958
- if (!this.stopped) {
32959
- if (this.buffer.length >= this.maxBuffer) {
32960
- this.buffer.shift();
32961
- }
32962
- this.buffer.push(this.eventToTrace(event));
32977
+ if (this.stopped) return;
32978
+ this.countsOverflow ||= this.observed === Number.MAX_SAFE_INTEGER;
32979
+ if (this.countsOverflow) return;
32980
+ this.observed++;
32981
+ const entry = this.eventToTrace(event);
32982
+ if (entry === null) {
32983
+ this.foreignDropped++;
32984
+ return;
32963
32985
  }
32986
+ if (this.buffer.length >= this.maxBuffer) {
32987
+ this.buffer.shift();
32988
+ this.evicted++;
32989
+ }
32990
+ this.buffer.push(entry);
32964
32991
  });
32965
32992
  }
32966
32993
  options;
@@ -32969,40 +32996,69 @@ var TraceWriter = class {
32969
32996
  runDir;
32970
32997
  maxBuffer;
32971
32998
  stopped = false;
32972
- /** Flush buffered events to disk. Throws on write failure. */
32973
- async flush() {
32974
- if (this.buffer.length === 0) return;
32975
- await mkdir(this.runDir, { recursive: true });
32976
- const lines = this.buffer.map((e) => JSON.stringify(e)).join("\n");
32977
- const tracePath = join5(this.runDir, "trace.jsonl");
32978
- const traceTmp = `${tracePath}.tmp.${String(process.pid)}`;
32979
- try {
32980
- await writeFile(traceTmp, lines + "\n", "utf-8");
32981
- await rename(traceTmp, tracePath);
32982
- } catch (err2) {
32983
- await unlink(traceTmp).catch((unlinkErr) => {
32984
- const msg = unlinkErr instanceof Error ? unlinkErr.message : String(unlinkErr);
32985
- logger23.warn("Failed to clean up trace temp file", { path: traceTmp, error: msg });
32986
- });
32987
- throw err2;
32988
- }
32989
- const indexContent = this.buildIndex();
32990
- const indexPath = join5(this.runDir, "index.md");
32991
- const indexTmp = `${indexPath}.tmp.${String(process.pid)}`;
32992
- try {
32993
- await writeFile(indexTmp, indexContent, "utf-8");
32994
- await rename(indexTmp, indexPath);
32995
- } catch (err2) {
32996
- await unlink(indexTmp).catch((unlinkErr) => {
32997
- const msg = unlinkErr instanceof Error ? unlinkErr.message : String(unlinkErr);
32998
- logger23.warn("Failed to clean up index temp file", { path: indexTmp, error: msg });
32999
+ observed = 0;
33000
+ foreignDropped = 0;
33001
+ evicted = 0;
33002
+ countsOverflow = false;
33003
+ pendingFlush;
33004
+ flushAgain = false;
33005
+ /**
33006
+ * Serializes/coalesces bounded pending work. Each snapshot freezes rows and counters
33007
+ * before its first await. Files rename individually; readers verify their digest binding.
33008
+ */
33009
+ flush() {
33010
+ if (this.pendingFlush !== void 0) {
33011
+ this.flushAgain = true;
33012
+ return this.pendingFlush;
33013
+ }
33014
+ this.pendingFlush = this.flushSnapshots().finally(() => {
33015
+ this.pendingFlush = void 0;
33016
+ });
33017
+ return this.pendingFlush;
33018
+ }
33019
+ async flushSnapshots() {
33020
+ do {
33021
+ this.flushAgain = false;
33022
+ if (this.countsOverflow) throw new Error("Trace observation counter overflow");
33023
+ const entries = [...this.buffer];
33024
+ const content = entries.length === 0 ? "" : entries.map((e) => JSON.stringify(e)).join("\n") + "\n";
33025
+ const snapshot = TraceAttributionSnapshotSchema.parse({
33026
+ attributionVersion: 1,
33027
+ runId: this.options.runId,
33028
+ ...this.options.origin === void 0 ? {} : { captureOrigin: this.options.origin },
33029
+ traceSha256: traceDigest(content),
33030
+ traceBytes: Buffer.byteLength(content),
33031
+ writerObserved: {
33032
+ observed: this.observed,
33033
+ foreignDropped: this.foreignDropped,
33034
+ evicted: this.evicted
33035
+ },
33036
+ retained: relationCounts(entries)
32999
33037
  });
33000
- throw err2;
33001
- }
33002
- logger23.info("Trace flushed", {
33003
- runId: this.options.runId,
33004
- events: this.buffer.length
33005
- });
33038
+ const metadata = JSON.stringify(snapshot) + "\n";
33039
+ if (Buffer.byteLength(metadata) > MAX_TRACE_ATTRIBUTION_BYTES)
33040
+ throw new Error("Trace metadata exceeds read cap");
33041
+ const runDir = this.containedRunDirectory();
33042
+ const index = this.buildIndex(entries);
33043
+ await mkdir(runDir, { recursive: true });
33044
+ await writeAtomic(join5(runDir, "trace.jsonl"), content);
33045
+ await writeAtomic(join5(runDir, TRACE_ATTRIBUTION_FILE), metadata);
33046
+ await writeAtomic(join5(runDir, "index.md"), index);
33047
+ logger23.info("Trace flushed", { runId: this.options.runId, events: entries.length });
33048
+ } while (this.needsAnotherFlush());
33049
+ }
33050
+ /** Refuse unsafe output during optional diagnostic flush, not task admission. */
33051
+ containedRunDirectory() {
33052
+ const root = resolve6(this.options.runsDir);
33053
+ const directory = resolveInsideRoot(this.runDir, root);
33054
+ const canonicalRoot = resolveInsideRoot(root, root);
33055
+ if (canonicalRoot === null || directory === null || directory === canonicalRoot)
33056
+ throw new Error("Trace output must be a contained descendant of runsDir");
33057
+ return directory;
33058
+ }
33059
+ /** Read through a call: another request can set this flag across awaits. */
33060
+ needsAnotherFlush() {
33061
+ return this.flushAgain;
33006
33062
  }
33007
33063
  /** Stop subscribing to events. */
33008
33064
  stop() {
@@ -33011,14 +33067,30 @@ var TraceWriter = class {
33011
33067
  }
33012
33068
  /** Convert a PipelineEvent to an ExecutionTraceEntry. */
33013
33069
  eventToTrace(event) {
33070
+ const parsed = TraceOriginSchema.safeParse(event.origin);
33071
+ const origin = parsed.success ? parsed.data : void 0;
33072
+ const captureRelation = traceRelation(
33073
+ event.type,
33074
+ origin,
33075
+ this.options.origin,
33076
+ this.options.runId
33077
+ );
33078
+ if (captureRelation === "foreign") return null;
33014
33079
  const base = {
33080
+ attributionVersion: 1,
33081
+ captureRelation,
33082
+ ...origin === void 0 ? {} : { origin },
33083
+ ...this.options.origin === void 0 ? {} : { captureOrigin: { ...this.options.origin } },
33084
+ ...event.origin !== void 0 && !parsed.success ? { attributionIssue: "invalid_origin" } : {},
33015
33085
  timestamp: event.timestamp,
33016
33086
  runId: this.options.runId,
33017
33087
  eventType: event.type
33018
33088
  };
33019
33089
  return {
33020
33090
  ...base,
33021
- ...this.extractAttribution(event)
33091
+ ...this.extractAttribution(event),
33092
+ ...extractIdentity(event),
33093
+ ...extractSignal(event)
33022
33094
  };
33023
33095
  }
33024
33096
  /** Extract attribution fields from typed events. */
@@ -33043,18 +33115,18 @@ var TraceWriter = class {
33043
33115
  }
33044
33116
  }
33045
33117
  /** Build a markdown index summary for this run. */
33046
- buildIndex() {
33118
+ buildIndex(entries) {
33047
33119
  const lines = [
33048
33120
  `# Run: ${this.options.runId}`,
33049
33121
  "",
33050
33122
  `**Generated:** ${(/* @__PURE__ */ new Date()).toISOString()}`,
33051
- `**Events:** ${String(this.buffer.length)}`,
33123
+ `**Events:** ${String(entries.length)}`,
33052
33124
  "",
33053
33125
  "## Event Summary",
33054
33126
  ""
33055
33127
  ];
33056
33128
  const counts = /* @__PURE__ */ new Map();
33057
- for (const entry of this.buffer) {
33129
+ for (const entry of entries) {
33058
33130
  const prev = counts.get(entry.eventType) ?? 0;
33059
33131
  counts.set(entry.eventType, prev + 1);
33060
33132
  }
@@ -33117,6 +33189,74 @@ function extractWaveAttribution(event) {
33117
33189
  }
33118
33190
  return { ...base, durationMs: event.durationMs, workerCount: event.successes + event.errors };
33119
33191
  }
33192
+ async function writeAtomic(path9, content) {
33193
+ const temporary = `${path9}.tmp.${randomUUID9()}`;
33194
+ try {
33195
+ await writeFile(temporary, content, { encoding: "utf8", flag: "wx" });
33196
+ await rename(temporary, path9);
33197
+ } catch (cause) {
33198
+ await unlink(temporary).catch((cleanup) => {
33199
+ const error = cleanup instanceof Error ? cleanup.message : String(cleanup);
33200
+ logger23.warn("Failed to clean up trace temporary file", { path: temporary, error });
33201
+ });
33202
+ throw cause;
33203
+ }
33204
+ }
33205
+ function taskIdentity(event) {
33206
+ switch (event.type) {
33207
+ case "task.created":
33208
+ case "task.status_changed":
33209
+ case "task.completed":
33210
+ case "task.failed":
33211
+ case "pipeline.started":
33212
+ return event.taskId;
33213
+ default:
33214
+ return void 0;
33215
+ }
33216
+ }
33217
+ function extractIdentity(event) {
33218
+ const result = {};
33219
+ const identities = {
33220
+ intentId: event.intentId,
33221
+ attemptId: event.attemptId,
33222
+ // CompositeRouter uses routing.taskId for a task-content prefix, not an ID.
33223
+ taskId: taskIdentity(event),
33224
+ ...event.type === "tool.invoked" || event.type === "tool.completed" ? { invocationId: event.invocationId } : {}
33225
+ };
33226
+ for (const key2 of ["taskId", "attemptId", "intentId", "invocationId"]) {
33227
+ const value = Reflect.get(identities, key2);
33228
+ if (typeof value !== "string") continue;
33229
+ if (value.length === 0 || value.length > 256) {
33230
+ result.provenanceTruncated = true;
33231
+ continue;
33232
+ }
33233
+ result[key2] = value;
33234
+ }
33235
+ return result;
33236
+ }
33237
+ function extractSignal(event) {
33238
+ const result = {};
33239
+ const bounded = (value, limit = 256) => {
33240
+ if (value.length > limit) result.provenanceTruncated = true;
33241
+ return value.slice(0, limit);
33242
+ };
33243
+ if (event.type === "signal.vote_rejected") {
33244
+ result.proposalId = bounded(event.proposalId);
33245
+ result.approvalPercentage = event.approvalPercentage;
33246
+ if (event.rejectionRules !== void 0) {
33247
+ if (event.rejectionRules.length > 20) result.provenanceTruncated = true;
33248
+ result.rejectionRules = event.rejectionRules.slice(0, 20).map((rule) => bounded(rule));
33249
+ }
33250
+ } else if (event.type === "signal.fitness_declined") {
33251
+ result.score = event.score;
33252
+ result.floor = event.floor;
33253
+ if (event.dimension !== void 0) result.dimension = bounded(event.dimension);
33254
+ } else if (event.type === "signal.swarm_unhealthy") {
33255
+ result.agentId = bounded(event.agentId);
33256
+ result.reason = bounded(event.reason, 1024);
33257
+ }
33258
+ return result;
33259
+ }
33120
33260
 
33121
33261
  // src/pipeline/pipeline-callback-tracker.ts
33122
33262
  var PipelineCallbackTracker = class {
@@ -34256,17 +34396,17 @@ async function runBoundedProbe(req, config, probeOptions, effectiveTimeoutMs) {
34256
34396
  };
34257
34397
  config.signal?.addEventListener("abort", onAbort, { once: true });
34258
34398
  let timer;
34259
- const timeoutRace = new Promise((resolve17) => {
34399
+ const timeoutRace = new Promise((resolve18) => {
34260
34400
  timer = setTimeout(() => {
34261
34401
  controller.abort();
34262
34402
  const message = `Worker probe for "${req.id}" timed out after ${String(effectiveTimeoutMs)}ms`;
34263
- resolve17({ ok: false, errorClass: "ProbeTimeoutError", message });
34403
+ resolve18({ ok: false, errorClass: "ProbeTimeoutError", message });
34264
34404
  }, effectiveTimeoutMs);
34265
34405
  });
34266
- const abortRace = new Promise((resolve17) => {
34406
+ const abortRace = new Promise((resolve18) => {
34267
34407
  const onSig = () => {
34268
34408
  const message = `Worker probe for "${req.id}" aborted during execution`;
34269
- resolve17({ ok: false, errorClass: "ProbeAbortedError", message });
34409
+ resolve18({ ok: false, errorClass: "ProbeAbortedError", message });
34270
34410
  };
34271
34411
  config.signal?.addEventListener("abort", onSig, { once: true });
34272
34412
  });
@@ -34627,7 +34767,7 @@ function emitStageEvent(bus, executionId, result) {
34627
34767
 
34628
34768
  // src/pipeline/authoritative-decision-persistence.ts
34629
34769
  import { chmodSync, closeSync, mkdirSync as mkdirSync3, openSync, statSync as statSync3 } from "node:fs";
34630
- import { join as join6, resolve as resolve6 } from "node:path";
34770
+ import { join as join6, resolve as resolve7 } from "node:path";
34631
34771
  import { z as z67 } from "zod";
34632
34772
 
34633
34773
  // src/pipeline/authoritative-decision-types.ts
@@ -34821,13 +34961,13 @@ function databasePath(config) {
34821
34961
  throw new Error("InvalidStorageDirectoryError: storageDir must be nonempty");
34822
34962
  }
34823
34963
  return join6(
34824
- config.storageDir === void 0 ? nexusDataPath("pipeline") : resolve6(config.storageDir),
34964
+ config.storageDir === void 0 ? nexusDataPath("pipeline") : resolve7(config.storageDir),
34825
34965
  "decisions.db"
34826
34966
  );
34827
34967
  }
34828
34968
  function openDecisionDatabase(config) {
34829
34969
  const filePath = databasePath(config);
34830
- const storageDir = resolve6(filePath, "..");
34970
+ const storageDir = resolve7(filePath, "..");
34831
34971
  mkdirSync3(storageDir, { recursive: true, mode: 448 });
34832
34972
  closeSync(openSync(filePath, "a", 384));
34833
34973
  chmodSync(filePath, 384);
@@ -35259,7 +35399,7 @@ function createDefaultPolicyEngine() {
35259
35399
  }
35260
35400
 
35261
35401
  // src/pipeline/task-contract-builders.ts
35262
- import { randomUUID as randomUUID9 } from "node:crypto";
35402
+ import { randomUUID as randomUUID10 } from "node:crypto";
35263
35403
  var sharedAnalyzer;
35264
35404
  function analyzeTask(task) {
35265
35405
  sharedAnalyzer ??= createSharedTaskAnalyzer();
@@ -35270,7 +35410,7 @@ function buildBaseTaskContract(input) {
35270
35410
  const report = detectCapabilityGaps(analysis.requiredCapabilities);
35271
35411
  const now = Date.now();
35272
35412
  return {
35273
- id: `${input.idPrefix}-${randomUUID9().slice(0, 8)}`,
35413
+ id: `${input.idPrefix}-${randomUUID10().slice(0, 8)}`,
35274
35414
  description: input.task,
35275
35415
  status: "approved",
35276
35416
  analysis: input.analysis ?? {
@@ -35461,7 +35601,7 @@ async function executeOrchestratePipeline(task) {
35461
35601
  }
35462
35602
 
35463
35603
  // src/orchestration/orchestrator-factory.ts
35464
- import { randomUUID as randomUUID10 } from "node:crypto";
35604
+ import { randomUUID as randomUUID11 } from "node:crypto";
35465
35605
 
35466
35606
  // src/orchestration/orchestrator-adapters.ts
35467
35607
  function generateId2(prefix) {
@@ -35676,7 +35816,7 @@ var WorkflowOrchestratorAdapter = class {
35676
35816
  executions = /* @__PURE__ */ new Map();
35677
35817
  history = [];
35678
35818
  constructor(engine, logger62) {
35679
- this.id = `workflow-${randomUUID10().slice(0, 8)}`;
35819
+ this.id = `workflow-${randomUUID11().slice(0, 8)}`;
35680
35820
  this.engine = engine;
35681
35821
  this.logger = logger62 ?? createLogger({ component: "WorkflowOrchestratorAdapter" });
35682
35822
  }
@@ -35689,7 +35829,7 @@ var WorkflowOrchestratorAdapter = class {
35689
35829
  )
35690
35830
  );
35691
35831
  }
35692
- const executionId = randomUUID10();
35832
+ const executionId = randomUUID11();
35693
35833
  const startTime = getTimeProvider().now();
35694
35834
  this.setRunning(executionId);
35695
35835
  try {
@@ -36335,11 +36475,11 @@ function createMockOrchestrator() {
36335
36475
  async function raceAgainstDeadline(promise, deadlineMs, onTimeout) {
36336
36476
  const startedAt = Date.now();
36337
36477
  let timer;
36338
- const timeoutP = new Promise((resolve17, reject) => {
36478
+ const timeoutP = new Promise((resolve18, reject) => {
36339
36479
  timer = setTimeout(
36340
36480
  () => {
36341
36481
  try {
36342
- resolve17(onTimeout(Date.now() - startedAt));
36482
+ resolve18(onTimeout(Date.now() - startedAt));
36343
36483
  } catch (err2) {
36344
36484
  reject(err2 instanceof Error ? err2 : new Error(String(err2)));
36345
36485
  }
@@ -37526,11 +37666,11 @@ function createWorkerTask(entry, taskIndex, waveNumber, opts) {
37526
37666
  const staggerSlot = taskIndex % opts.maxConcurrency;
37527
37667
  const staggerMs = staggerSlot * opts.staggerDelayMs;
37528
37668
  if (staggerMs > 0) {
37529
- await new Promise((resolve17) => setTimeout(resolve17, staggerMs));
37669
+ await new Promise((resolve18) => setTimeout(resolve18, staggerMs));
37530
37670
  }
37531
37671
  const spacingDelay = opts.failureTracker.getSpacingDelay(entry.role);
37532
37672
  if (spacingDelay > 0) {
37533
- await new Promise((resolve17) => setTimeout(resolve17, spacingDelay));
37673
+ await new Promise((resolve18) => setTimeout(resolve18, spacingDelay));
37534
37674
  }
37535
37675
  const timeoutMs = opts.options.workerTimeoutMs ?? getExpertTaskTimeout(entry.subTask);
37536
37676
  const result = await executeSafe({
@@ -37583,7 +37723,7 @@ async function maybeDelayForRateLimit(results, waveIdx, totalWaves) {
37583
37723
  );
37584
37724
  if (hasRateLimit) {
37585
37725
  logger31.warn("Rate-limit detected \u2014 delaying next wave", { delayMs: RATE_LIMIT_WAVE_DELAY_MS });
37586
- await new Promise((resolve17) => setTimeout(resolve17, RATE_LIMIT_WAVE_DELAY_MS));
37726
+ await new Promise((resolve18) => setTimeout(resolve18, RATE_LIMIT_WAVE_DELAY_MS));
37587
37727
  }
37588
37728
  }
37589
37729
  function emitWaveStarted(ctx, workerCount, roles) {
@@ -37690,7 +37830,7 @@ async function maybeRetryAfterTriage(opts) {
37690
37830
  }
37691
37831
  const useAltCli = triage.action === "retry_different_cli" && altExecuteWorker !== void 0;
37692
37832
  if (triage.action === "retry_different_cli") {
37693
- await new Promise((resolve17) => setTimeout(resolve17, RATE_LIMIT_SPACING_MS));
37833
+ await new Promise((resolve18) => setTimeout(resolve18, RATE_LIMIT_SPACING_MS));
37694
37834
  }
37695
37835
  if (isCancelled2(opts.signal)) return { ...failedResult2, triageAction: triage.action };
37696
37836
  const retryTimeout = triage.action === "extend_timeout" ? Math.min(timeoutMs * TIMEOUT_EXTENSION_FACTOR, MAX_WORKER_TIMEOUT_MS) : timeoutMs;
@@ -44392,7 +44532,7 @@ function recordTriageOutcome(success, durationMs, errorMsg) {
44392
44532
 
44393
44533
  // src/mcp/tools/run-graph-workflow.ts
44394
44534
  import { z as z85 } from "zod";
44395
- import { randomUUID as randomUUID11 } from "node:crypto";
44535
+ import { randomUUID as randomUUID12 } from "node:crypto";
44396
44536
 
44397
44537
  // src/mcp/tools/run-graph-workflow-events.ts
44398
44538
  function isHookEvent(event) {
@@ -44599,7 +44739,7 @@ function createGraphWorkflowHandler(logger62, notifier, auditLogger) {
44599
44739
  return runAsJob({
44600
44740
  toolName: "run_graph_workflow",
44601
44741
  input,
44602
- freshJobId: () => `gw-${randomUUID11()}`,
44742
+ freshJobId: () => `gw-${randomUUID12()}`,
44603
44743
  // #5393: arity 4 — signal + #6162 progress. `runAsJob` derives
44604
44744
  // `signalAccepted` from `run.length`. The signal reaches `executeGraph`,
44605
44745
  // which gates every super-step on it; `progress` fires per graph event.
@@ -45192,7 +45332,7 @@ function suggestImprovement(criterion) {
45192
45332
 
45193
45333
  // src/mcp/tools/execute-spec-tool.ts
45194
45334
  import { z as z86 } from "zod";
45195
- import { randomUUID as randomUUID12 } from "node:crypto";
45335
+ import { randomUUID as randomUUID13 } from "node:crypto";
45196
45336
  var ExecuteSpecInputSchema = z86.object({
45197
45337
  spec: z86.string().min(1).max(5e4).describe("Markdown specification to execute"),
45198
45338
  dryRun: z86.boolean().optional().default(false).describe("Parse and decompose only"),
@@ -45285,7 +45425,7 @@ function createExecuteSpecHandler(logger62) {
45285
45425
  return runAsJob({
45286
45426
  toolName: "execute_spec",
45287
45427
  input,
45288
- freshJobId: () => `es-${randomUUID12()}`,
45428
+ freshJobId: () => `es-${randomUUID13()}`,
45289
45429
  // #5393 / #6305: arity 3 — `executeSpec` checks the signal at every step
45290
45430
  // boundary. #6162: heartbeats by jobId on every graph event.
45291
45431
  run: (jobId, _input, signal) => createFullResponse(input, logger62, {
@@ -47058,7 +47198,12 @@ function parseJsonlLines(content) {
47058
47198
  let skippedLines = 0;
47059
47199
  for (const line of content.trim().split("\n").filter(Boolean)) {
47060
47200
  try {
47061
- events.push(JSON.parse(line));
47201
+ const parsed = JSON.parse(line);
47202
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
47203
+ skippedLines++;
47204
+ continue;
47205
+ }
47206
+ events.push(parsed);
47062
47207
  } catch {
47063
47208
  skippedLines++;
47064
47209
  }
@@ -47082,11 +47227,13 @@ function overSizeResponse(runId, sizeBytes) {
47082
47227
  errorMessage: `Trace for runId '${runId}' is ${String(sizeBytes)} bytes, over the ${String(MAX_TRACE_FILE_BYTES)}-byte read cap; no events were read`
47083
47228
  };
47084
47229
  }
47085
- function readTraceResponse(input, read) {
47230
+ function readTraceResponse(input, read, reading) {
47086
47231
  const limit = input.limit ?? 100;
47087
- const parsed = input.eventType !== void 0 ? read.events.filter((e) => e["eventType"] === input.eventType) : read.events;
47232
+ const events = reading.status === "measured" ? reading.entries.map((entry) => ({ ...entry })) : read.events.map(withoutCertifiedAttribution);
47233
+ const parsed = input.eventType !== void 0 ? events.filter((e) => e["eventType"] === input.eventType) : events;
47088
47234
  return {
47089
47235
  runId: input.runId,
47236
+ attribution: attributionReport(reading, input.eventType, limit),
47090
47237
  events: parsed.slice(0, limit),
47091
47238
  totalEvents: parsed.length,
47092
47239
  truncated: parsed.length > limit,
@@ -47098,6 +47245,34 @@ function readTraceResponse(input, read) {
47098
47245
  } : {}
47099
47246
  };
47100
47247
  }
47248
+ function withoutCertifiedAttribution(entry) {
47249
+ const {
47250
+ attributionVersion: _version,
47251
+ captureRelation: _relation,
47252
+ captureOrigin: _capture,
47253
+ origin: _origin,
47254
+ ...legacy
47255
+ } = entry;
47256
+ return legacy;
47257
+ }
47258
+ function attributionReport(reading, eventType, limit) {
47259
+ if (reading.status === "unmeasured")
47260
+ return {
47261
+ ...reading,
47262
+ writerObserved: null,
47263
+ retained: null,
47264
+ filtered: null,
47265
+ returned: null
47266
+ };
47267
+ const filtered = eventType === void 0 ? reading.entries : reading.entries.filter((e) => e.eventType === eventType);
47268
+ return {
47269
+ status: "measured",
47270
+ writerObserved: reading.snapshot.writerObserved,
47271
+ retained: reading.snapshot.retained,
47272
+ filtered: relationCounts(filtered),
47273
+ returned: relationCounts(filtered.slice(0, limit))
47274
+ };
47275
+ }
47101
47276
  async function queryTraceFromDisk(input, runsDir) {
47102
47277
  if (runsDir !== void 0) return readTraceFromDirectory(input, runsDir);
47103
47278
  const primary = await readTraceFromDirectory(input, getDefaultRunsDir());
@@ -47117,8 +47292,27 @@ async function readTraceFromDirectory(input, dir) {
47117
47292
  if (fileStat.size > MAX_TRACE_FILE_BYTES) {
47118
47293
  return overSizeResponse(input.runId, fileStat.size);
47119
47294
  }
47120
- const content = await readFile4(tracePath, "utf-8");
47121
- return readTraceResponse(input, parseJsonlLines(content));
47295
+ const content = await readFile4(tracePath);
47296
+ const decoded = decodeTraceBytes(content);
47297
+ if (decoded === null) {
47298
+ return {
47299
+ ...readTraceResponse(
47300
+ input,
47301
+ { events: [], skippedLines: 0 },
47302
+ {
47303
+ status: "unmeasured",
47304
+ reason: "invalid_encoding"
47305
+ }
47306
+ ),
47307
+ errorCategory: "parse_error",
47308
+ errorMessage: "Trace is not valid UTF-8; no events were read"
47309
+ };
47310
+ }
47311
+ return readTraceResponse(
47312
+ input,
47313
+ parseJsonlLines(decoded),
47314
+ readTraceSnapshot(tracePath, dir, content, input.runId)
47315
+ );
47122
47316
  } catch (err2) {
47123
47317
  const category = classifyTraceError(err2);
47124
47318
  const message = userFacingTraceError(err2, input.runId);
@@ -47161,7 +47355,7 @@ function registerQueryTraceTool(server, deps) {
47161
47355
  eventType: z101.string().max(100).regex(/^[a-zA-Z0-9._-]+$/).optional().describe("Filter by event type (e.g., model.called)"),
47162
47356
  limit: z101.number().min(1).max(500).optional().describe("Max events to return (default: 100)")
47163
47357
  };
47164
- const description = "Query execution traces by run ID. Returns agent and model attribution for pipeline runs including decision paths, error taxonomy, and timing data.";
47358
+ const description = "Query execution traces by run ID. Returns agent and model attribution for pipeline runs including decision paths, error taxonomy, timing and snapshot-bound attribution counts. run_related is logical session participation only: reused/concurrent invocations are indistinguishable; no attempt, worker or settlement proof.";
47165
47359
  const secureHandler = createSecureHandler(queryTraceHandler, {
47166
47360
  toolName: "query_trace",
47167
47361
  rateLimiter: deps.rateLimiter,
@@ -48116,12 +48310,12 @@ var FileAuditStorage = class _FileAuditStorage {
48116
48310
  const data = this.writeBuffer.join("");
48117
48311
  this.writeBuffer = [];
48118
48312
  const stream = this.writeStream;
48119
- return new Promise((resolve17, reject) => {
48313
+ return new Promise((resolve18, reject) => {
48120
48314
  stream.write(data, (err2) => {
48121
48315
  if (err2 !== void 0 && err2 !== null) {
48122
48316
  reject(new AuditError("Failed to flush audit log", { cause: err2 }));
48123
48317
  } else {
48124
- resolve17();
48318
+ resolve18();
48125
48319
  }
48126
48320
  });
48127
48321
  });
@@ -48182,15 +48376,15 @@ var FileAuditStorage = class _FileAuditStorage {
48182
48376
  }
48183
48377
  async close() {
48184
48378
  await this.flush();
48185
- return new Promise((resolve17) => {
48379
+ return new Promise((resolve18) => {
48186
48380
  if (this.writeStream === null) {
48187
- resolve17();
48381
+ resolve18();
48188
48382
  return;
48189
48383
  }
48190
48384
  this.writeStream.end(() => {
48191
48385
  this.writeStream = null;
48192
48386
  this.logger.info("Audit storage closed");
48193
- resolve17();
48387
+ resolve18();
48194
48388
  });
48195
48389
  });
48196
48390
  }
@@ -49140,7 +49334,7 @@ function computePrReviewRecordHash(payload) {
49140
49334
 
49141
49335
  // src/audit/pr-review-record-store.ts
49142
49336
  import { appendFileSync as appendFileSync3, existsSync as existsSync8, mkdirSync as mkdirSync6, readFileSync as readFileSync7 } from "node:fs";
49143
- import { dirname as dirname3, isAbsolute as isAbsolute4, join as join12, resolve as resolve8 } from "node:path";
49337
+ import { dirname as dirname3, isAbsolute as isAbsolute4, join as join12, resolve as resolve9 } from "node:path";
49144
49338
  var PR_REVIEW_RECORDS_REL_PATH = "governance/pr-review-records.jsonl";
49145
49339
  var PR_REVIEW_RECORDS_PATH_ENV = "NEXUS_PR_REVIEW_RECORDS_PATH";
49146
49340
  var MAX_SUMMARY_RECORD_CHARS = 500;
@@ -49178,7 +49372,7 @@ function buildPrReviewRecord(input) {
49178
49372
  function resolvePrReviewRecordsPath(repoPathOverride) {
49179
49373
  const envPath = process.env[PR_REVIEW_RECORDS_PATH_ENV];
49180
49374
  if (envPath !== void 0 && envPath.trim() !== "") {
49181
- return isAbsolute4(envPath) ? envPath : resolve8(envPath);
49375
+ return isAbsolute4(envPath) ? envPath : resolve9(envPath);
49182
49376
  }
49183
49377
  if (repoPathOverride !== void 0 && repoPathOverride.trim() !== "") {
49184
49378
  const overrideRoot = findRepoRoot(repoPathOverride);
@@ -49829,7 +50023,7 @@ async function tryIssueTriage(task) {
49829
50023
  try {
49830
50024
  const issueMatch = task.match(/github\.com\/([^/]+\/[^/]+)\/issues\/(\d+)/);
49831
50025
  if (issueMatch === null) return null;
49832
- const { createIssueTriage } = await import("./issue-triage-OKLIMR7X.js");
50026
+ const { createIssueTriage } = await import("./issue-triage-WJQZC3WH.js");
49833
50027
  const triage = createIssueTriage();
49834
50028
  const owner = issueMatch[1] ?? "";
49835
50029
  const num2 = issueMatch[2] ?? "";
@@ -49857,7 +50051,7 @@ var VALID_TEMPLATES = /* @__PURE__ */ new Set([
49857
50051
  ]);
49858
50052
  async function classifyWithLLM(task) {
49859
50053
  try {
49860
- const { executeExpert: executeExpert2 } = await import("./expert-bridge-OW4PM4ZT.js");
50054
+ const { executeExpert: executeExpert2 } = await import("./expert-bridge-VRMBEB25.js");
49861
50055
  const prompt = [
49862
50056
  "Classify this task into exactly one pipeline template.",
49863
50057
  "Templates: dev (implementation/bug fix/refactor), research (investigate/evaluate/compare),",
@@ -50226,7 +50420,7 @@ function buildVotingInput(plan, config) {
50226
50420
  }
50227
50421
  async function executeSingleVote(plan, config, log) {
50228
50422
  try {
50229
- const { executeVoting } = await import("./consensus-vote-MNPLBGXT.js");
50423
+ const { executeVoting } = await import("./consensus-vote-AFHPZ643.js");
50230
50424
  const input = buildVotingInput(plan, config);
50231
50425
  const result = await executeVoting(input, log);
50232
50426
  return parseVotingResult(result);
@@ -50550,8 +50744,8 @@ function hermeticGitEnv(base = process.env) {
50550
50744
  }
50551
50745
 
50552
50746
  // src/cli/vote-scratch-checkout.ts
50553
- import { randomUUID as randomUUID13 } from "node:crypto";
50554
- import { basename as basename3, join as join14, resolve as resolve9 } from "node:path";
50747
+ import { randomUUID as randomUUID14 } from "node:crypto";
50748
+ import { basename as basename3, join as join14, resolve as resolve10 } from "node:path";
50555
50749
  var GIT_TIMEOUT_MS = 3e4;
50556
50750
  var SHA_PREFIX_LENGTH = 12;
50557
50751
  var ScratchCheckoutError = class extends NexusError {
@@ -50659,9 +50853,9 @@ function createScratchCheckout(options) {
50659
50853
  toError(error)
50660
50854
  );
50661
50855
  }
50662
- const path9 = resolve9(
50856
+ const path9 = resolve10(
50663
50857
  options.tmpRoot ?? getNexusTmpDir(),
50664
- `vote-${sha.slice(0, SHA_PREFIX_LENGTH)}-${randomUUID13()}`
50858
+ `vote-${sha.slice(0, SHA_PREFIX_LENGTH)}-${randomUUID14()}`
50665
50859
  );
50666
50860
  const paths = scratchPaths(options, path9);
50667
50861
  let gitMetadataUnchanged;
@@ -50735,7 +50929,7 @@ function execFileTree(command, args, options) {
50735
50929
  return Promise.reject(new AbortError(`${command} aborted before it started`));
50736
50930
  }
50737
50931
  const graceMs = options.graceMs ?? SIGKILL_GRACE_MS;
50738
- return new Promise((resolve17, reject) => {
50932
+ return new Promise((resolve18, reject) => {
50739
50933
  const run = {
50740
50934
  settled: false,
50741
50935
  child: void 0
@@ -50763,7 +50957,7 @@ function execFileTree(command, args, options) {
50763
50957
  signal?.addEventListener("abort", onAbort, { once: true });
50764
50958
  run.child = spawnTracked(command, args, options, (error, stdout, stderr) => {
50765
50959
  finish(() => {
50766
- if (error === null) resolve17({ stdout, stderr });
50960
+ if (error === null) resolve18({ stdout, stderr });
50767
50961
  else reject(Object.assign(error, { stdout, stderr }));
50768
50962
  });
50769
50963
  });
@@ -50954,7 +51148,7 @@ async function createScratchSandbox(scratch, source) {
50954
51148
  // src/pipeline/pipeline-scratch-root.ts
50955
51149
  import { existsSync as existsSync12, realpathSync as realpathSync5 } from "node:fs";
50956
51150
  import { tmpdir } from "node:os";
50957
- import { isAbsolute as isAbsolute6, relative as relative4, resolve as resolve10, sep as sep4 } from "node:path";
51151
+ import { isAbsolute as isAbsolute6, relative as relative4, resolve as resolve11, sep as sep4 } from "node:path";
50958
51152
  function contains(parent, child) {
50959
51153
  const path9 = relative4(parent, child);
50960
51154
  return path9 === "" || path9 !== ".." && !path9.startsWith(`..${sep4}`) && !isAbsolute6(path9);
@@ -50963,7 +51157,7 @@ function overlaps(a, b) {
50963
51157
  return contains(a, b) || contains(b, a);
50964
51158
  }
50965
51159
  function pipelineScratchRoot(protectedPaths) {
50966
- const canonical = (path9) => existsSync12(path9) ? realpathSync5(path9) : resolve10(path9);
51160
+ const canonical = (path9) => existsSync12(path9) ? realpathSync5(path9) : resolve11(path9);
50967
51161
  const occupied = protectedPaths.map(canonical);
50968
51162
  const preferred = canonical(getNexusTmpDir());
50969
51163
  if (!occupied.some((path9) => overlaps(preferred, path9))) return preferred;
@@ -52070,7 +52264,7 @@ var memoryInitPromise = null;
52070
52264
  async function initPipelineMemory() {
52071
52265
  if (cachedMemory !== null) return cachedMemory;
52072
52266
  try {
52073
- const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-WPVNRUJX.js");
52267
+ const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-AGLSO5V6.js");
52074
52268
  const { getLearningDir } = await import("./learning-persistence-NW5AE222.js");
52075
52269
  const mem = createSessionMemory2(getLearningDir());
52076
52270
  mem.startSession(`pipeline-${String(getTimeProvider().now())}`);
@@ -52132,7 +52326,7 @@ function recordRoutingExperience(category, success, durationMs, tokensUsed = 0,
52132
52326
  callRecord(routingMemoryCache);
52133
52327
  return;
52134
52328
  }
52135
- routingMemoryInitPromise ??= import("./routing-memory-A6HRDTWW.js").then(({ createRoutingMemory }) => {
52329
+ routingMemoryInitPromise ??= import("./routing-memory-PFBPOTQO.js").then(({ createRoutingMemory }) => {
52136
52330
  routingMemoryCache ??= createRoutingMemory();
52137
52331
  return routingMemoryCache;
52138
52332
  }).catch((error) => {
@@ -52702,7 +52896,7 @@ async function prepareCompletePlanVote(plan, research, config, signal) {
52702
52896
  return { proposal, roleAdapters: panel.seats };
52703
52897
  }
52704
52898
  async function executePlanVote(plan, research, config, strategy, signal) {
52705
- const { executeVoting } = await import("./consensus-vote-MNPLBGXT.js");
52899
+ const { executeVoting } = await import("./consensus-vote-AFHPZ643.js");
52706
52900
  const { proposal, roleAdapters } = await prepareCompletePlanVote(plan, research, config, signal);
52707
52901
  const votingResult = await executeVoting(
52708
52902
  {
@@ -53258,7 +53452,7 @@ function resolveConfidence(rule) {
53258
53452
  // src/mcp/tools/security-scan.ts
53259
53453
  import { access, constants as constants2 } from "node:fs/promises";
53260
53454
  import { readFile as readFile5, realpath as realpath2, writeFile as writeFile2 } from "node:fs/promises";
53261
- import { delimiter as delimiter2, isAbsolute as isAbsolute8, join as join17, parse as parse5, resolve as resolve11 } from "node:path";
53455
+ import { delimiter as delimiter2, isAbsolute as isAbsolute8, join as join17, parse as parse5, resolve as resolve12 } from "node:path";
53262
53456
  var logger50 = createLogger({ component: "security-scan" });
53263
53457
  var SCAN_TIMEOUT_MS = 3e5;
53264
53458
  async function probeSemgrepVersion(signal, env, wrapper, binary = "semgrep", cwd) {
@@ -53285,7 +53479,7 @@ async function probeSemgrepVersion(signal, env, wrapper, binary = "semgrep", cwd
53285
53479
  function probeExecutableCandidates(binary, env, cwd) {
53286
53480
  const root = cwd ?? process.cwd();
53287
53481
  const searchPath = (env ?? process.env)["PATH"];
53288
- return isAbsolute8(binary) || /[/\\]/.test(binary) ? [resolve11(root, binary)] : process.platform === "win32" ? void 0 : searchPath?.split(delimiter2).map((directory) => resolve11(root, directory, binary));
53482
+ return isAbsolute8(binary) || /[/\\]/.test(binary) ? [resolve12(root, binary)] : process.platform === "win32" ? void 0 : searchPath?.split(delimiter2).map((directory) => resolve12(root, directory, binary));
53289
53483
  }
53290
53484
  async function isSemgrepExecutableMissing(binary, env, cwd) {
53291
53485
  const candidates = probeExecutableCandidates(binary, env, cwd);
@@ -53304,7 +53498,7 @@ async function runSemgrep(targetDir, rulesets, signal, env, options) {
53304
53498
  const prepared = options.preparedScan;
53305
53499
  const flags = prepared?.flags ?? (options.completeResults === true ? COMPLETE_SCAN_FLAGS : []);
53306
53500
  const configs = prepared?.rulesets ?? rulesets.map(
53307
- (ruleset) => /^(?:[pr]\/|https?:\/\/|auto$)/.test(ruleset) ? ruleset : resolve11(ruleset)
53501
+ (ruleset) => /^(?:[pr]\/|https?:\/\/|auto$)/.test(ruleset) ? ruleset : resolve12(ruleset)
53308
53502
  );
53309
53503
  const args = [
53310
53504
  "--sarif",
@@ -53380,7 +53574,7 @@ async function resolveSemgrep(env) {
53380
53574
  }
53381
53575
  async function readRuleset(ruleset, signal) {
53382
53576
  const url = /^[pr]\//.test(ruleset) ? `https://semgrep.dev/c/${ruleset}` : ruleset;
53383
- if (!/^https?:\/\//.test(url)) return await readFile5(resolve11(ruleset), "utf8");
53577
+ if (!/^https?:\/\//.test(url)) return await readFile5(resolve12(ruleset), "utf8");
53384
53578
  const timeout = AbortSignal.timeout(3e4);
53385
53579
  const response = await fetch(url, {
53386
53580
  headers: { Accept: "application/json" },
@@ -53430,7 +53624,7 @@ async function prepareSecurityScan(rulesets, options) {
53430
53624
  options.env,
53431
53625
  options.wrapper,
53432
53626
  binary,
53433
- parse5(resolve11(options.directory)).root
53627
+ parse5(resolve12(options.directory)).root
53434
53628
  );
53435
53629
  if (typeof version !== "string") throw new Error(version.error);
53436
53630
  const configs = [];
@@ -53556,7 +53750,7 @@ function isScannerNoise(line) {
53556
53750
  }
53557
53751
 
53558
53752
  // src/pipeline/dependency-gate.ts
53559
- import { join as join18, resolve as resolve12 } from "node:path";
53753
+ import { join as join18, resolve as resolve13 } from "node:path";
53560
53754
  import { existsSync as existsSync14, lstatSync as lstatSync2, readFileSync as readFileSync11 } from "node:fs";
53561
53755
  import { z as z112 } from "zod";
53562
53756
 
@@ -53735,12 +53929,12 @@ function lookupFailure(label) {
53735
53929
  };
53736
53930
  }
53737
53931
  function dependencyManifestScope(targetDir, captureRoot, changed) {
53738
- const workingDirManifest = resolve12(targetDir, "package.json");
53932
+ const workingDirManifest = resolve13(targetDir, "package.json");
53739
53933
  const scope = /* @__PURE__ */ new Map([
53740
53934
  [workingDirManifest, { path: workingDirManifest, label: workingDirManifest, required: false }]
53741
53935
  ]);
53742
53936
  for (const manifest of changed) {
53743
- const path9 = resolve12(captureRoot, manifest);
53937
+ const path9 = resolve13(captureRoot, manifest);
53744
53938
  scope.set(path9, { path: path9, label: manifest, required: true });
53745
53939
  }
53746
53940
  return [...scope.values()];
@@ -54513,7 +54707,7 @@ ${text}` : "";
54513
54707
  }
54514
54708
  async function getWeatherContext() {
54515
54709
  try {
54516
- const { generateWeatherReport: generateWeatherReport2 } = await import("./weather-report-DROJA42L.js");
54710
+ const { generateWeatherReport: generateWeatherReport2 } = await import("./weather-report-EM6ZPAZ2.js");
54517
54711
  const report = generateWeatherReport2({ includeAdaptive: true });
54518
54712
  const mappings = "recommendedMappings" in report ? report.recommendedMappings : [];
54519
54713
  if (!Array.isArray(mappings) || mappings.length === 0) return "";
@@ -54531,7 +54725,7 @@ ${lines}
54531
54725
  }
54532
54726
  async function getMemoryContext(task) {
54533
54727
  try {
54534
- const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-WPVNRUJX.js");
54728
+ const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-AGLSO5V6.js");
54535
54729
  const { getLearningDir } = await import("./learning-persistence-NW5AE222.js");
54536
54730
  const memory = createSessionMemory2(getLearningDir(), { maxLearningsInContext: 10 });
54537
54731
  const learnings = memory.searchLearnings(task.slice(0, 200));
@@ -55290,7 +55484,7 @@ async function searchCodebaseForTask(task) {
55290
55484
  }
55291
55485
  async function queryResearchRegistry(task) {
55292
55486
  try {
55293
- const { synthesizeResearch: synthesizeResearch2 } = await import("./research-helpers-synthesize-3PT4X3BX.js");
55487
+ const { synthesizeResearch: synthesizeResearch2 } = await import("./research-helpers-synthesize-Q5EU3I3D.js");
55294
55488
  const topic = task.split(/[.!?\n]/).filter((s) => s.trim().length > 10)[0]?.trim();
55295
55489
  if (topic === void 0) return null;
55296
55490
  const result = await synthesizeResearch2(topic.slice(0, 50));
@@ -55409,7 +55603,7 @@ function createScanStageWrapper() {
55409
55603
  try {
55410
55604
  const repo = await selectAuditRepository(ctx.task);
55411
55605
  if (!repo.ok) return failOutput(PIPELINE_STATE_KEYS.FINDINGS, repo.error, getTimeProvider().now() - start);
55412
- const { generateSecurityPlan: generateSecurityPlan2 } = await import("./repo-security-plan-O6V5DZXV.js");
55606
+ const { generateSecurityPlan: generateSecurityPlan2 } = await import("./repo-security-plan-5VPJP4HN.js");
55413
55607
  const plan = await generateSecurityPlan2({ repo: repo.value, maxScanners: 10 });
55414
55608
  const recs = plan.recommendations.slice(0, 5).map((r) => `${r.priority}: ${r.displayName} (${r.category})`).join("; ");
55415
55609
  return output(PIPELINE_STATE_KEYS.FINDINGS, recs, getTimeProvider().now() - start, true);
@@ -55462,7 +55656,7 @@ function createAuditStageRegistry() {
55462
55656
 
55463
55657
  // src/mcp/tools/pr-review-tool.ts
55464
55658
  import { z as z113 } from "zod";
55465
- import { randomUUID as randomUUID14 } from "node:crypto";
55659
+ import { randomUUID as randomUUID15 } from "node:crypto";
55466
55660
 
55467
55661
  // src/mcp/tools/pr-review-record-producer.ts
55468
55662
  function bytes(n) {
@@ -55769,7 +55963,7 @@ function resolveAggregate(reviews, input, absent, coverage, logger62) {
55769
55963
  function rollUpDecisionCost(voteResults, logger62, jobId) {
55770
55964
  try {
55771
55965
  return recordDecisionCost({
55772
- decisionId: `pr-${randomUUID14().slice(0, 8)}`,
55966
+ decisionId: `pr-${randomUUID15().slice(0, 8)}`,
55773
55967
  gate: "pr_review",
55774
55968
  ...jobId !== void 0 ? { jobId } : {},
55775
55969
  votes: voteResults
@@ -55857,7 +56051,7 @@ function makePrReviewHandler(gatewayAdapters) {
55857
56051
  return runAsJob({
55858
56052
  toolName: "pr_review",
55859
56053
  input,
55860
- freshJobId: () => `pr-${randomUUID14()}`,
56054
+ freshJobId: () => `pr-${randomUUID15()}`,
55861
56055
  // #6750: on a cancel the body throws VoteCancelledError; the seats it
55862
56056
  // had collected are attached to the `cancelled` record, with no verdict.
55863
56057
  // #5393: arity 4 — signal + #6162 progress (heartbeat per settled
@@ -57445,9 +57639,9 @@ var RESEARCH_BUDGET_MS = 2e4;
57445
57639
  var RESEARCH_TIMED_OUT = /* @__PURE__ */ Symbol("research-budget-exceeded");
57446
57640
  async function withResearchBudget(p, ms) {
57447
57641
  let timer;
57448
- const budget = new Promise((resolve17) => {
57642
+ const budget = new Promise((resolve18) => {
57449
57643
  timer = setTimeout(() => {
57450
- resolve17(RESEARCH_TIMED_OUT);
57644
+ resolve18(RESEARCH_TIMED_OUT);
57451
57645
  }, ms);
57452
57646
  });
57453
57647
  try {
@@ -57549,7 +57743,7 @@ function registerSuggestResearchTasksTool(server, deps) {
57549
57743
 
57550
57744
  // src/mcp/tools/run-tool.ts
57551
57745
  import { z as z127 } from "zod";
57552
- import { randomUUID as randomUUID19 } from "node:crypto";
57746
+ import { randomUUID as randomUUID20 } from "node:crypto";
57553
57747
 
57554
57748
  // src/orchestration/consensus-enforcement-mode.ts
57555
57749
  function resolveConsensusEnforcementMode(raw) {
@@ -57559,7 +57753,7 @@ function resolveConsensusEnforcementMode(raw) {
57559
57753
  }
57560
57754
 
57561
57755
  // src/mcp/tools/run-tool-consensus.ts
57562
- import { randomUUID as randomUUID15 } from "node:crypto";
57756
+ import { randomUUID as randomUUID16 } from "node:crypto";
57563
57757
  function getConsensusEnforcement(result) {
57564
57758
  if (typeof result !== "object" || result === null) return void 0;
57565
57759
  return result.enforcement;
@@ -57635,7 +57829,7 @@ async function runConsensusWithEnforcement(goal, options) {
57635
57829
  const retryable = /* @__PURE__ */ new Set(["no_quorum", "not_outage_invariant"]);
57636
57830
  if (options.mode === "enforce" && retryable.has(result.enforcement.reason)) {
57637
57831
  recordVoteDecisionCost({
57638
- decisionId: `consensus-${randomUUID15()}`,
57832
+ decisionId: `consensus-${randomUUID16()}`,
57639
57833
  gate: "consensus_vote",
57640
57834
  votes: result.votes,
57641
57835
  proposal: goal,
@@ -57994,7 +58188,7 @@ function assertExecutePolicy(strategy, input, logger62, requestContext) {
57994
58188
  }
57995
58189
 
57996
58190
  // src/orchestration/meta-orchestrator.ts
57997
- import { randomUUID as randomUUID16 } from "node:crypto";
58191
+ import { randomUUID as randomUUID17 } from "node:crypto";
57998
58192
 
57999
58193
  // src/orchestration/meta-orchestrator-routing.ts
58000
58194
  function reasoningFor(selection, routing) {
@@ -58146,7 +58340,7 @@ function createMetaOrchestrator(options) {
58146
58340
  const classification = classifyTask(input.goal);
58147
58341
  const forced = input.forceStrategy !== void 0;
58148
58342
  const base = input.forceStrategy !== void 0 ? buildForcedDecision(input.forceStrategy, routing, classification) : buildSelectedDecision(routing, classification);
58149
- const decision = { ...base, decisionId: randomUUID16() };
58343
+ const decision = { ...base, decisionId: randomUUID17() };
58150
58344
  if (input.requiredAuthority !== void 0) {
58151
58345
  guardAuthority(decision.strategy, input.requiredAuthority);
58152
58346
  }
@@ -58666,7 +58860,7 @@ function evaluateMetaStrategyReadiness(result, config = DEFAULT_META_STRATEGY_RE
58666
58860
  // src/mcp/tools/dev-pipeline-tool.ts
58667
58861
  import { z as z125 } from "zod";
58668
58862
  import * as fs10 from "node:fs";
58669
- import { randomUUID as randomUUID17 } from "node:crypto";
58863
+ import { randomUUID as randomUUID18 } from "node:crypto";
58670
58864
 
58671
58865
  // src/mcp/tools/dev-pipeline-output.ts
58672
58866
  function buildStructuredOutput(result, simulated) {
@@ -58737,7 +58931,7 @@ function planVoteVerdictFields(result) {
58737
58931
  }
58738
58932
 
58739
58933
  // src/mcp/tools/dev-pipeline-tool.ts
58740
- import { resolve as resolve15 } from "node:path";
58934
+ import { resolve as resolve16 } from "node:path";
58741
58935
 
58742
58936
  // src/mcp/tools/dev-pipeline-options.ts
58743
58937
  function buildPipelineOptions(input, trustTier, auditLogger) {
@@ -58782,7 +58976,7 @@ var GitHubTaskTracker = class {
58782
58976
  cachedProvider = null;
58783
58977
  async getProvider() {
58784
58978
  if (this.cachedProvider !== null) return this.cachedProvider;
58785
- const { createScmProvider } = await import("./factory-6YIROBGX.js");
58979
+ const { createScmProvider } = await import("./factory-B5KLEQKU.js");
58786
58980
  const result = await createScmProvider({ repo: this.config.repo ?? "" });
58787
58981
  if (!result.ok) throw new Error(`SCM provider error: ${result.error.message}`);
58788
58982
  this.cachedProvider = result.value;
@@ -59028,7 +59222,7 @@ function containWorkingDir(workingDir) {
59028
59222
  const roots = [process.cwd()];
59029
59223
  const workspaceRoot = getActiveWorkspaceRoot();
59030
59224
  if (workspaceRoot !== void 0) roots.push(workspaceRoot);
59031
- const absolute = resolve15(workingDir);
59225
+ const absolute = resolve16(workingDir);
59032
59226
  for (const root of roots) {
59033
59227
  const contained = resolveInsideRoot(absolute, root);
59034
59228
  if (contained !== null) return contained;
@@ -59198,7 +59392,7 @@ function dispatchAsyncDevPipeline(input, run, logger62) {
59198
59392
  return runAsJob({
59199
59393
  toolName: "run_dev_pipeline",
59200
59394
  input,
59201
- freshJobId: () => `dp-${randomUUID17()}`,
59395
+ freshJobId: () => `dp-${randomUUID18()}`,
59202
59396
  // #5393 / #6305: arity 3 — `runDevPipeline` checks the signal before every stage.
59203
59397
  run: (_jobId, _input, signal) => run(signal),
59204
59398
  logger: logger62
@@ -59256,7 +59450,7 @@ function registerDevPipelineTool(server, deps) {
59256
59450
  // src/mcp/tools/pipeline-tool.ts
59257
59451
  import { z as z126 } from "zod";
59258
59452
  import * as fs11 from "node:fs";
59259
- import { randomUUID as randomUUID18 } from "node:crypto";
59453
+ import { randomUUID as randomUUID19 } from "node:crypto";
59260
59454
  var PIPELINE_ASYNC_HINT = "A full run_pipeline run can exceed the synchronous MCP request timeout. Retry with `dispatch: 'async'` to get a jobId immediately, then poll get_job_result({ jobId }) for the result.";
59261
59455
  var PipelineInputSchema = z126.object({
59262
59456
  /** The task to execute. */
@@ -59466,7 +59660,7 @@ async function runPipelineHandler(args, logger62, callerTrustTier, sanitization)
59466
59660
  return runAsJob({
59467
59661
  toolName: "run_pipeline",
59468
59662
  input,
59469
- freshJobId: () => `rp-${randomUUID18()}`,
59663
+ freshJobId: () => `rp-${randomUUID19()}`,
59470
59664
  // #5393 / #6305: arity 3 — the graph executor checks the signal before every
59471
59665
  // super-step, so a cancel stops the run at the next stage boundary.
59472
59666
  run: (_jobId, _input, signal) => executePipelineBody(task, stages, { ...body, signal }),
@@ -59786,7 +59980,7 @@ async function runHandler(args, logger62, trustTier, gatewayAdapters, requestCon
59786
59980
  return runAsJob({
59787
59981
  toolName: "run",
59788
59982
  input,
59789
- freshJobId: () => `rn-${randomUUID19()}`,
59983
+ freshJobId: () => `rn-${randomUUID20()}`,
59790
59984
  // #5393 / #6305: arity 3 — every wired strategy executor hands the
59791
59985
  // signal to its engine. #6162: heartbeats by jobId.
59792
59986
  run: (jobId, _input, signal) => executeRunBodyOrThrow(input, logger62, {
@@ -59901,7 +60095,7 @@ function withCatalogueCaveat(report) {
59901
60095
  var GATEWAY_TRANSPORT = "gateway";
59902
60096
  var GATEWAY_API_ARM = "api:custom-openai";
59903
60097
  async function gatewaySource(apiArm) {
59904
- const { discoverModels, readOpenAICompatEnv } = await import("./openai-compat-adapter-V76U3PUN.js");
60098
+ const { discoverModels, readOpenAICompatEnv } = await import("./openai-compat-adapter-3H3JSNGP.js");
59905
60099
  const config = readOpenAICompatEnv();
59906
60100
  if (config !== null) {
59907
60101
  return {
@@ -59920,7 +60114,7 @@ async function gatewaySource(apiArm) {
59920
60114
  }
59921
60115
  async function defaultSources(includeOpenRouter, adaptersFactory) {
59922
60116
  const adapters = new Map(
59923
- adaptersFactory !== void 0 ? adaptersFactory() : (await import("./factory-JJIJMMSM.js")).createAllAdapters()
60117
+ adaptersFactory !== void 0 ? adaptersFactory() : (await import("./factory-KFLVCHVV.js")).createAllAdapters()
59924
60118
  );
59925
60119
  const apiArm = adapters.get(GATEWAY_API_ARM);
59926
60120
  adapters.delete(GATEWAY_API_ARM);
@@ -60051,7 +60245,7 @@ var VoterEvalVerdictQuerySchema = z129.object({
60051
60245
 
60052
60246
  // src/mcp/tools/supply-chain-tradeoff-panel.ts
60053
60247
  import { z as z130 } from "zod";
60054
- import { randomUUID as randomUUID20 } from "node:crypto";
60248
+ import { randomUUID as randomUUID21 } from "node:crypto";
60055
60249
  var DEFAULT_AXES = [
60056
60250
  "build_time_determinism",
60057
60251
  "supply_chain_risk",
@@ -60322,7 +60516,7 @@ async function tradeoffPanelHandler(args, ctx) {
60322
60516
  return runAsJob({
60323
60517
  toolName: "supply_chain_tradeoff_panel",
60324
60518
  input,
60325
- freshJobId: () => `sc-${randomUUID20()}`,
60519
+ freshJobId: () => `sc-${randomUUID21()}`,
60326
60520
  // #5393: arity 4 — signal + #6162 progress. `runAsJob` derives
60327
60521
  // `signalAccepted` from `run.length`. The signal reaches `collectRealVotes`,
60328
60522
  // so a cancel stops the un-launched seats; `progress` heartbeats per seat.
@@ -62219,7 +62413,7 @@ function getPolicy(id) {
62219
62413
  // src/security/sandbox/sandbox-executor.ts
62220
62414
  import { execFile as execFile2 } from "node:child_process";
62221
62415
  import { promisify } from "node:util";
62222
- import { resolve as resolve16 } from "node:path";
62416
+ import { resolve as resolve17 } from "node:path";
62223
62417
  var execFileAsync = promisify(execFile2);
62224
62418
  var logger59 = createLogger({ component: "sandbox-executor" });
62225
62419
  function parseExecError(error) {
@@ -62311,7 +62505,7 @@ var PolicySandboxExecutor = class {
62311
62505
  * following symlinks, else `null`. No rules means no allowed directory.
62312
62506
  */
62313
62507
  resolveAllowedCwd(cwd, policy) {
62314
- const absolute = resolve16(cwd);
62508
+ const absolute = resolve17(cwd);
62315
62509
  for (const rule of policy.pathRules) {
62316
62510
  if (rule.access === "none") continue;
62317
62511
  const contained = resolveInsideRoot(absolute, rule.path);
@@ -63192,4 +63386,4 @@ export {
63192
63386
  initializeSandbox,
63193
63387
  getSandboxMode
63194
63388
  };
63195
- //# sourceMappingURL=chunk-WMEV4263.js.map
63389
+ //# sourceMappingURL=chunk-32F2JIQ7.js.map