nexus-agents 3.13.0 → 3.13.3

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 (123) hide show
  1. package/dist/{child-mcp-config-5SWBEZPD.js → child-mcp-config-7BVXTRAK.js} +2 -2
  2. package/dist/{chunk-AV3NVATT.js → chunk-272J6LG3.js} +3 -3
  3. package/dist/{chunk-JJAEGFPS.js → chunk-273B3NXK.js} +2 -2
  4. package/dist/{chunk-EQDV4YIW.js → chunk-2M32S75Y.js} +6 -6
  5. package/dist/{chunk-5HGMO3W3.js → chunk-3P6BF4ZZ.js} +5 -5
  6. package/dist/{chunk-5TE3ORD5.js → chunk-4EADBYQR.js} +2 -2
  7. package/dist/{chunk-LI5RF3H7.js → chunk-6VNJ5URR.js} +2 -2
  8. package/dist/{chunk-KTYTESEV.js → chunk-7T5F2DMR.js} +3 -3
  9. package/dist/chunk-7T5F2DMR.js.map +1 -0
  10. package/dist/{chunk-6BTRY45Y.js → chunk-AFN5LNPK.js} +99 -49
  11. package/dist/{chunk-6BTRY45Y.js.map → chunk-AFN5LNPK.js.map} +1 -1
  12. package/dist/{chunk-JHL7JLRJ.js → chunk-ANX5OL3K.js} +2 -2
  13. package/dist/{chunk-KHYSK52P.js → chunk-BQD3LH3W.js} +2 -2
  14. package/dist/{chunk-2ZVGB7AJ.js → chunk-BRUW6PDK.js} +2 -2
  15. package/dist/{chunk-5XTQIBA3.js → chunk-CTWF6AWK.js} +5 -5
  16. package/dist/{chunk-3W7ST3AB.js → chunk-EJOQKFG4.js} +2 -2
  17. package/dist/{chunk-OJPYOK4V.js → chunk-EROFMYLI.js} +3 -3
  18. package/dist/{chunk-PAJXMEHU.js → chunk-GSHTJLSW.js} +2 -2
  19. package/dist/{chunk-TPU5DT74.js → chunk-HYF37E3C.js} +7 -7
  20. package/dist/{chunk-ERHCCLT7.js → chunk-IU2O6F35.js} +8 -8
  21. package/dist/{chunk-BMLBXCC3.js → chunk-KP6S27ET.js} +2 -2
  22. package/dist/{chunk-VJ2LZ2ZM.js → chunk-KPLDOIT6.js} +2 -2
  23. package/dist/{chunk-CDWKQ5FV.js → chunk-MBDXGD5M.js} +2 -2
  24. package/dist/{chunk-C4BSQH3A.js → chunk-MJJEDOQO.js} +4 -4
  25. package/dist/{chunk-FWBR5P72.js → chunk-NYLND7NB.js} +2 -2
  26. package/dist/{chunk-HVFUWGGB.js → chunk-P7UJ4IC5.js} +3 -3
  27. package/dist/{chunk-J75ZZ3HI.js → chunk-RK5ZXR46.js} +5 -5
  28. package/dist/{chunk-7WIBQZR6.js → chunk-S6FP56Q5.js} +3 -3
  29. package/dist/{chunk-D34SUVBO.js → chunk-UKRC2VKZ.js} +4 -4
  30. package/dist/{chunk-NGQC5KIB.js → chunk-UN343DQX.js} +8 -8
  31. package/dist/{chunk-XXOE3OHH.js → chunk-UYU5F4AP.js} +2 -2
  32. package/dist/{chunk-GSRW2H3C.js → chunk-VLHCE5W2.js} +2 -2
  33. package/dist/{chunk-RGR22IN6.js → chunk-VRZUMXK5.js} +4 -4
  34. package/dist/{chunk-CODRIZMT.js → chunk-YEDOUAWT.js} +2 -2
  35. package/dist/{chunk-ABU3SZXU.js → chunk-YP2J6PEB.js} +8 -8
  36. package/dist/chunk-YP2J6PEB.js.map +1 -0
  37. package/dist/{chunk-6GKG5U5Y.js → chunk-YTXNIVCI.js} +2 -2
  38. package/dist/{cli-circuit-breaker-WKUYRX5M.js → cli-circuit-breaker-T3HALZLW.js} +3 -3
  39. package/dist/cli.js +41 -41
  40. package/dist/{composite-router-SKXMG4DA.js → composite-router-HCZI2IRJ.js} +2 -2
  41. package/dist/{consensus-vote-FGB637PZ.js → consensus-vote-4Y5XZ3FE.js} +16 -16
  42. package/dist/{context-retriever-NK6O77TT.js → context-retriever-4IQTH3QJ.js} +8 -8
  43. package/dist/{doctor-deep-EJAW6SI5.js → doctor-deep-X4Y5TR3J.js} +3 -3
  44. package/dist/{doctor-live-26YJA5Z4.js → doctor-live-VO3TS52X.js} +9 -9
  45. package/dist/{expert-bridge-PNXWIDQV.js → expert-bridge-2GOWBBVP.js} +4 -4
  46. package/dist/{factory-KVIEFTAC.js → factory-2BTUL2LI.js} +5 -5
  47. package/dist/{factory-MXWNULXD.js → factory-3OKL3F4G.js} +9 -9
  48. package/dist/{improvement-review-HKJNXMZM.js → improvement-review-3GY77IOS.js} +5 -5
  49. package/dist/index.d.ts +9 -3
  50. package/dist/index.js +30 -30
  51. package/dist/{init-opencode-7IU4SWTC.js → init-opencode-32HGTO3Z.js} +6 -6
  52. package/dist/issue-triage-I5XOPQ3Y.js +17 -0
  53. package/dist/{pr-reviewer-helpers-SUMMYYF7.js → pr-reviewer-helpers-AXTU345T.js} +4 -4
  54. package/dist/{registry-command-XFH3M634.js → registry-command-GMYKWA6P.js} +2 -2
  55. package/dist/{repo-security-plan-RCYKT5GS.js → repo-security-plan-OGGXIUYZ.js} +3 -3
  56. package/dist/{research-helpers-synthesize-BVJB4HW5.js → research-helpers-synthesize-JAECA6EC.js} +4 -4
  57. package/dist/{routing-memory-AR4YR2RL.js → routing-memory-FBZMNOKG.js} +2 -2
  58. package/dist/{session-memory-UYJU63EG.js → session-memory-SPBLB72Z.js} +3 -3
  59. package/dist/{setup-command-GCDDJMCC.js → setup-command-PJ54ZXPD.js} +14 -14
  60. package/dist/{setup-config-XZMHAOMR.js → setup-config-NPUDZ5FP.js} +3 -3
  61. package/dist/{setup-custom-api-BWX47BKD.js → setup-custom-api-SU45OZ7V.js} +4 -4
  62. package/dist/{tool-memory-DB3YDR5W.js → tool-memory-EAAL47XK.js} +5 -5
  63. package/dist/{unified-registry-XSY5XAIZ.js → unified-registry-42RRNTZS.js} +10 -10
  64. package/dist/{weather-report-C2P6NHTX.js → weather-report-5LB2V7NS.js} +2 -2
  65. package/package.json +1 -1
  66. package/dist/chunk-ABU3SZXU.js.map +0 -1
  67. package/dist/chunk-KTYTESEV.js.map +0 -1
  68. package/dist/issue-triage-EKFJQZFJ.js +0 -17
  69. /package/dist/{child-mcp-config-5SWBEZPD.js.map → child-mcp-config-7BVXTRAK.js.map} +0 -0
  70. /package/dist/{chunk-AV3NVATT.js.map → chunk-272J6LG3.js.map} +0 -0
  71. /package/dist/{chunk-JJAEGFPS.js.map → chunk-273B3NXK.js.map} +0 -0
  72. /package/dist/{chunk-EQDV4YIW.js.map → chunk-2M32S75Y.js.map} +0 -0
  73. /package/dist/{chunk-5HGMO3W3.js.map → chunk-3P6BF4ZZ.js.map} +0 -0
  74. /package/dist/{chunk-5TE3ORD5.js.map → chunk-4EADBYQR.js.map} +0 -0
  75. /package/dist/{chunk-LI5RF3H7.js.map → chunk-6VNJ5URR.js.map} +0 -0
  76. /package/dist/{chunk-JHL7JLRJ.js.map → chunk-ANX5OL3K.js.map} +0 -0
  77. /package/dist/{chunk-KHYSK52P.js.map → chunk-BQD3LH3W.js.map} +0 -0
  78. /package/dist/{chunk-2ZVGB7AJ.js.map → chunk-BRUW6PDK.js.map} +0 -0
  79. /package/dist/{chunk-5XTQIBA3.js.map → chunk-CTWF6AWK.js.map} +0 -0
  80. /package/dist/{chunk-3W7ST3AB.js.map → chunk-EJOQKFG4.js.map} +0 -0
  81. /package/dist/{chunk-OJPYOK4V.js.map → chunk-EROFMYLI.js.map} +0 -0
  82. /package/dist/{chunk-PAJXMEHU.js.map → chunk-GSHTJLSW.js.map} +0 -0
  83. /package/dist/{chunk-TPU5DT74.js.map → chunk-HYF37E3C.js.map} +0 -0
  84. /package/dist/{chunk-ERHCCLT7.js.map → chunk-IU2O6F35.js.map} +0 -0
  85. /package/dist/{chunk-BMLBXCC3.js.map → chunk-KP6S27ET.js.map} +0 -0
  86. /package/dist/{chunk-VJ2LZ2ZM.js.map → chunk-KPLDOIT6.js.map} +0 -0
  87. /package/dist/{chunk-CDWKQ5FV.js.map → chunk-MBDXGD5M.js.map} +0 -0
  88. /package/dist/{chunk-C4BSQH3A.js.map → chunk-MJJEDOQO.js.map} +0 -0
  89. /package/dist/{chunk-FWBR5P72.js.map → chunk-NYLND7NB.js.map} +0 -0
  90. /package/dist/{chunk-HVFUWGGB.js.map → chunk-P7UJ4IC5.js.map} +0 -0
  91. /package/dist/{chunk-J75ZZ3HI.js.map → chunk-RK5ZXR46.js.map} +0 -0
  92. /package/dist/{chunk-7WIBQZR6.js.map → chunk-S6FP56Q5.js.map} +0 -0
  93. /package/dist/{chunk-D34SUVBO.js.map → chunk-UKRC2VKZ.js.map} +0 -0
  94. /package/dist/{chunk-NGQC5KIB.js.map → chunk-UN343DQX.js.map} +0 -0
  95. /package/dist/{chunk-XXOE3OHH.js.map → chunk-UYU5F4AP.js.map} +0 -0
  96. /package/dist/{chunk-GSRW2H3C.js.map → chunk-VLHCE5W2.js.map} +0 -0
  97. /package/dist/{chunk-RGR22IN6.js.map → chunk-VRZUMXK5.js.map} +0 -0
  98. /package/dist/{chunk-CODRIZMT.js.map → chunk-YEDOUAWT.js.map} +0 -0
  99. /package/dist/{chunk-6GKG5U5Y.js.map → chunk-YTXNIVCI.js.map} +0 -0
  100. /package/dist/{cli-circuit-breaker-WKUYRX5M.js.map → cli-circuit-breaker-T3HALZLW.js.map} +0 -0
  101. /package/dist/{composite-router-SKXMG4DA.js.map → composite-router-HCZI2IRJ.js.map} +0 -0
  102. /package/dist/{consensus-vote-FGB637PZ.js.map → consensus-vote-4Y5XZ3FE.js.map} +0 -0
  103. /package/dist/{context-retriever-NK6O77TT.js.map → context-retriever-4IQTH3QJ.js.map} +0 -0
  104. /package/dist/{doctor-deep-EJAW6SI5.js.map → doctor-deep-X4Y5TR3J.js.map} +0 -0
  105. /package/dist/{doctor-live-26YJA5Z4.js.map → doctor-live-VO3TS52X.js.map} +0 -0
  106. /package/dist/{expert-bridge-PNXWIDQV.js.map → expert-bridge-2GOWBBVP.js.map} +0 -0
  107. /package/dist/{factory-KVIEFTAC.js.map → factory-2BTUL2LI.js.map} +0 -0
  108. /package/dist/{factory-MXWNULXD.js.map → factory-3OKL3F4G.js.map} +0 -0
  109. /package/dist/{improvement-review-HKJNXMZM.js.map → improvement-review-3GY77IOS.js.map} +0 -0
  110. /package/dist/{init-opencode-7IU4SWTC.js.map → init-opencode-32HGTO3Z.js.map} +0 -0
  111. /package/dist/{issue-triage-EKFJQZFJ.js.map → issue-triage-I5XOPQ3Y.js.map} +0 -0
  112. /package/dist/{pr-reviewer-helpers-SUMMYYF7.js.map → pr-reviewer-helpers-AXTU345T.js.map} +0 -0
  113. /package/dist/{registry-command-XFH3M634.js.map → registry-command-GMYKWA6P.js.map} +0 -0
  114. /package/dist/{repo-security-plan-RCYKT5GS.js.map → repo-security-plan-OGGXIUYZ.js.map} +0 -0
  115. /package/dist/{research-helpers-synthesize-BVJB4HW5.js.map → research-helpers-synthesize-JAECA6EC.js.map} +0 -0
  116. /package/dist/{routing-memory-AR4YR2RL.js.map → routing-memory-FBZMNOKG.js.map} +0 -0
  117. /package/dist/{session-memory-UYJU63EG.js.map → session-memory-SPBLB72Z.js.map} +0 -0
  118. /package/dist/{setup-command-GCDDJMCC.js.map → setup-command-PJ54ZXPD.js.map} +0 -0
  119. /package/dist/{setup-config-XZMHAOMR.js.map → setup-config-NPUDZ5FP.js.map} +0 -0
  120. /package/dist/{setup-custom-api-BWX47BKD.js.map → setup-custom-api-SU45OZ7V.js.map} +0 -0
  121. /package/dist/{tool-memory-DB3YDR5W.js.map → tool-memory-EAAL47XK.js.map} +0 -0
  122. /package/dist/{unified-registry-XSY5XAIZ.js.map → unified-registry-42RRNTZS.js.map} +0 -0
  123. /package/dist/{weather-report-C2P6NHTX.js.map → weather-report-5LB2V7NS.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  generateSecurityPlan
3
- } from "./chunk-CDWKQ5FV.js";
3
+ } from "./chunk-MBDXGD5M.js";
4
4
  import {
5
5
  analyzeGitHubRepo
6
6
  } from "./chunk-HFOQKCD2.js";
@@ -22,10 +22,10 @@ import {
22
22
  DEFAULT_TASK_TTL_MS,
23
23
  DEFAULT_TOOL_RATE_LIMITS,
24
24
  clampTaskTtl
25
- } from "./chunk-ERHCCLT7.js";
25
+ } from "./chunk-IU2O6F35.js";
26
26
  import {
27
27
  executeExpert
28
- } from "./chunk-TPU5DT74.js";
28
+ } from "./chunk-HYF37E3C.js";
29
29
  import {
30
30
  JobStatusSchema,
31
31
  abortJob,
@@ -46,24 +46,24 @@ import {
46
46
  simulationDeniedResult,
47
47
  toJobSummary,
48
48
  writeJobCancelled
49
- } from "./chunk-ABU3SZXU.js";
49
+ } from "./chunk-YP2J6PEB.js";
50
50
  import {
51
51
  allOf
52
52
  } from "./chunk-OQB3XC5O.js";
53
53
  import {
54
54
  normalizeTopicToCanonical,
55
55
  synthesizeResearch
56
- } from "./chunk-AV3NVATT.js";
56
+ } from "./chunk-272J6LG3.js";
57
57
  import {
58
58
  IssueTriage
59
- } from "./chunk-EQDV4YIW.js";
59
+ } from "./chunk-2M32S75Y.js";
60
60
  import {
61
61
  resolveEnvMode,
62
62
  sanitizeInput
63
- } from "./chunk-CODRIZMT.js";
63
+ } from "./chunk-YEDOUAWT.js";
64
64
  import {
65
65
  withPrerequisite
66
- } from "./chunk-HVFUWGGB.js";
66
+ } from "./chunk-P7UJ4IC5.js";
67
67
  import {
68
68
  NOOP_NOTIFIER,
69
69
  RateLimiter,
@@ -86,18 +86,18 @@ import {
86
86
  withAuditTrail,
87
87
  withProgressHeartbeat,
88
88
  wrapToolWithTimeout
89
- } from "./chunk-7WIBQZR6.js";
89
+ } from "./chunk-S6FP56Q5.js";
90
90
  import {
91
91
  createAuditTrail,
92
92
  createGraphAuditBridge,
93
93
  emitPipelinePolicyEvent
94
- } from "./chunk-BMLBXCC3.js";
94
+ } from "./chunk-KP6S27ET.js";
95
95
  import {
96
96
  EventTopics,
97
97
  createEvent,
98
98
  getGlobalEventBus,
99
99
  getGlobalRegistry
100
- } from "./chunk-RGR22IN6.js";
100
+ } from "./chunk-VRZUMXK5.js";
101
101
  import {
102
102
  IDENTIFIER_RE,
103
103
  LANG_VALUES,
@@ -130,31 +130,31 @@ import {
130
130
  parseRegistry,
131
131
  sourceExistsInRegistry,
132
132
  summarizeContextForPrompt
133
- } from "./chunk-5XTQIBA3.js";
133
+ } from "./chunk-CTWF6AWK.js";
134
134
  import {
135
135
  loadPapersRegistry,
136
136
  loadTechniquesRegistry
137
- } from "./chunk-KHYSK52P.js";
137
+ } from "./chunk-BQD3LH3W.js";
138
138
  import {
139
139
  resolveInsideRoot
140
140
  } from "./chunk-NUBSJGQZ.js";
141
141
  import {
142
142
  getTokenEnvVars,
143
143
  resolveToken
144
- } from "./chunk-LI5RF3H7.js";
144
+ } from "./chunk-6VNJ5URR.js";
145
145
  import {
146
146
  DEFAULT_RELEVANCE_CONFIG,
147
147
  MemoryImportance,
148
148
  calculateTextJaccardSimilarity,
149
149
  getToolMemory
150
- } from "./chunk-C4BSQH3A.js";
150
+ } from "./chunk-MJJEDOQO.js";
151
151
  import {
152
152
  STOPWORDS,
153
153
  truncateWithInfo
154
154
  } from "./chunk-6T3EPABN.js";
155
155
  import {
156
156
  createSessionMemory
157
- } from "./chunk-JHL7JLRJ.js";
157
+ } from "./chunk-ANX5OL3K.js";
158
158
  import {
159
159
  BUILT_IN_EXPERTS,
160
160
  BuiltInExpertTypeSchema,
@@ -172,25 +172,25 @@ import {
172
172
  getAvailableClis,
173
173
  sleep,
174
174
  withTimeout
175
- } from "./chunk-NGQC5KIB.js";
175
+ } from "./chunk-UN343DQX.js";
176
176
  import {
177
177
  BaseAdapter,
178
178
  createStream,
179
179
  requireApiKey,
180
180
  validateApiKeyPresence
181
- } from "./chunk-5TE3ORD5.js";
181
+ } from "./chunk-4EADBYQR.js";
182
182
  import {
183
183
  DEFAULTS
184
- } from "./chunk-FWBR5P72.js";
184
+ } from "./chunk-NYLND7NB.js";
185
185
  import {
186
186
  getAvailabilityCache,
187
187
  getCliForModelId,
188
188
  resolveFallback
189
- } from "./chunk-XXOE3OHH.js";
189
+ } from "./chunk-UYU5F4AP.js";
190
190
  import {
191
191
  generateHyphenId,
192
192
  generateUUID
193
- } from "./chunk-6GKG5U5Y.js";
193
+ } from "./chunk-YTXNIVCI.js";
194
194
  import {
195
195
  AGENT_ROUTER_TIMEOUTS,
196
196
  API_TIMEOUTS,
@@ -289,7 +289,7 @@ import {
289
289
  selectStrategyByManifest,
290
290
  toExpertTaskAnalysisResult,
291
291
  withStep
292
- } from "./chunk-KTYTESEV.js";
292
+ } from "./chunk-7T5F2DMR.js";
293
293
  import {
294
294
  ensureLearningDir,
295
295
  getMetaOutcomesFile,
@@ -22474,11 +22474,22 @@ function extractErrorMessage2(error) {
22474
22474
  }
22475
22475
  return error.message;
22476
22476
  }
22477
- function isNonRetryableError(error) {
22477
+ var NON_RETRYABLE_CODES = /* @__PURE__ */ new Set([
22478
+ ErrorCode.VALIDATION_ERROR,
22479
+ ErrorCode.WORKFLOW_PARSE_ERROR,
22480
+ ErrorCode.INVALID_INPUT
22481
+ ]);
22482
+ function isNonRetryableSelf(error) {
22478
22483
  if (error.name === "ValidationError") return true;
22479
- if (error instanceof WorkflowError) {
22480
- const code = error.code;
22481
- return code === ErrorCode.VALIDATION_ERROR || code === ErrorCode.WORKFLOW_PARSE_ERROR || code === ErrorCode.INVALID_INPUT;
22484
+ return error instanceof NexusError && NON_RETRYABLE_CODES.has(error.code);
22485
+ }
22486
+ function isNonRetryableError(error) {
22487
+ const seen = /* @__PURE__ */ new Set();
22488
+ let current = error;
22489
+ while (current instanceof Error && !seen.has(current)) {
22490
+ seen.add(current);
22491
+ if (isNonRetryableSelf(current)) return true;
22492
+ current = current.cause;
22482
22493
  }
22483
22494
  return false;
22484
22495
  }
@@ -22645,11 +22656,13 @@ var StepExecutor = class {
22645
22656
  })
22646
22657
  );
22647
22658
  }
22659
+ const tokensUsed = taskResult.value.metadata.tokensUsed;
22648
22660
  return ok({
22649
22661
  stepId: step.id,
22650
22662
  output: taskResult.value.output,
22651
22663
  durationMs: getTimeProvider().now() - startTime,
22652
- status: "success"
22664
+ status: "success",
22665
+ ...typeof tokensUsed === "number" ? { tokensUsed } : {}
22653
22666
  });
22654
22667
  } catch (error) {
22655
22668
  return this.handleExecutionError(error, step, timeoutMs);
@@ -23233,12 +23246,22 @@ function enforceStepBudgets(options) {
23233
23246
  return ok(void 0);
23234
23247
  }
23235
23248
  function recordPhaseUsage(results, context) {
23236
- if (context.budgetCircuitBreaker === void 0) return;
23237
- const estimatedTokensPerMs = 0.5;
23249
+ if (context.budgetCircuitBreaker === void 0) {
23250
+ return { recordedSteps: 0, unmeasuredSteps: 0, tokensRecorded: 0 };
23251
+ }
23252
+ let unmeasuredSteps = 0;
23253
+ let recordedSteps = 0;
23254
+ let tokensRecorded = 0;
23238
23255
  for (const result of results) {
23239
- const estimatedTokens = Math.round(result.durationMs * estimatedTokensPerMs);
23240
- context.budgetCircuitBreaker.recordUsage(estimatedTokens);
23256
+ if (typeof result.tokensUsed !== "number") {
23257
+ unmeasuredSteps += 1;
23258
+ continue;
23259
+ }
23260
+ context.budgetCircuitBreaker.recordUsage(result.tokensUsed);
23261
+ recordedSteps += 1;
23262
+ tokensRecorded += result.tokensUsed;
23241
23263
  }
23264
+ return { recordedSteps, unmeasuredSteps, tokensRecorded };
23242
23265
  }
23243
23266
 
23244
23267
  // src/workflows/workflow-engine.ts
@@ -23409,6 +23432,23 @@ var WorkflowEngine = class {
23409
23432
  }
23410
23433
  return ok(void 0);
23411
23434
  }
23435
+ /**
23436
+ * Surface incomplete budget accounting (#4673).
23437
+ *
23438
+ * `recordPhaseUsage` returns which steps it could actually account for. A
23439
+ * ledger containing unmeasured steps is a LOWER BOUND on spend, and that is
23440
+ * precisely what anyone enabling enforcement needs to know before trusting
23441
+ * the cap — so it is reported rather than dropped.
23442
+ */
23443
+ reportUsageCoverage(usage, workflowName) {
23444
+ if (usage.unmeasuredSteps === 0) return;
23445
+ this.logger.warn("Budget ledger is incomplete \u2014 recorded spend is a lower bound", {
23446
+ workflow: workflowName,
23447
+ unmeasuredSteps: usage.unmeasuredSteps,
23448
+ recordedSteps: usage.recordedSteps,
23449
+ tokensRecorded: usage.tokensRecorded
23450
+ });
23451
+ }
23412
23452
  async executePhases(plan, context, workflow, phaseTimeoutMs) {
23413
23453
  const allResults = [];
23414
23454
  const totalSteps = plan.phases.reduce((sum, p) => sum + p.steps.length, 0);
@@ -23441,7 +23481,7 @@ var WorkflowEngine = class {
23441
23481
  };
23442
23482
  const phaseResult = await this.deps.executePhase(phase.steps, context, options);
23443
23483
  if (!phaseResult.ok) return phaseResult;
23444
- recordPhaseUsage(phaseResult.value, context);
23484
+ this.reportUsageCoverage(recordPhaseUsage(phaseResult.value, context), workflow.name);
23445
23485
  for (const result of phaseResult.value) {
23446
23486
  context.stepResults.set(result.stepId, result);
23447
23487
  allResults.push(result);
@@ -28371,7 +28411,7 @@ function execIdFields(executionId) {
28371
28411
  async function populateUnifiedContextOnState(state, options) {
28372
28412
  const taskCandidate = state["task"];
28373
28413
  if (typeof taskCandidate !== "string" || taskCandidate === "") return;
28374
- const { getContextForTask: getContextForTask2, inferTaskCategory: inferTaskCategory2 } = await import("./context-retriever-NK6O77TT.js");
28414
+ const { getContextForTask: getContextForTask2, inferTaskCategory: inferTaskCategory2 } = await import("./context-retriever-4IQTH3QJ.js");
28375
28415
  const category = inferTaskCategory2(taskCandidate);
28376
28416
  const executionId = options?.executionId;
28377
28417
  const execFields = execIdFields(executionId);
@@ -44029,7 +44069,7 @@ async function tryIssueTriage(task) {
44029
44069
  try {
44030
44070
  const issueMatch = task.match(/github\.com\/([^/]+\/[^/]+)\/issues\/(\d+)/);
44031
44071
  if (issueMatch === null) return null;
44032
- const { createIssueTriage } = await import("./issue-triage-EKFJQZFJ.js");
44072
+ const { createIssueTriage } = await import("./issue-triage-I5XOPQ3Y.js");
44033
44073
  const triage = createIssueTriage();
44034
44074
  const owner = issueMatch[1] ?? "";
44035
44075
  const num = issueMatch[2] ?? "";
@@ -44057,7 +44097,7 @@ var VALID_TEMPLATES = /* @__PURE__ */ new Set([
44057
44097
  ]);
44058
44098
  async function classifyWithLLM(task) {
44059
44099
  try {
44060
- const { executeExpert: executeExpert2 } = await import("./expert-bridge-PNXWIDQV.js");
44100
+ const { executeExpert: executeExpert2 } = await import("./expert-bridge-2GOWBBVP.js");
44061
44101
  const prompt = [
44062
44102
  "Classify this task into exactly one pipeline template.",
44063
44103
  "Templates: dev (implementation/bug fix/refactor), research (investigate/evaluate/compare),",
@@ -45784,7 +45824,7 @@ var memoryInitPromise = null;
45784
45824
  async function initPipelineMemory() {
45785
45825
  if (cachedMemory !== null) return cachedMemory;
45786
45826
  try {
45787
- const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-UYJU63EG.js");
45827
+ const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-SPBLB72Z.js");
45788
45828
  const { getLearningDir } = await import("./learning-persistence-EGY4VKKO.js");
45789
45829
  const mem = createSessionMemory2(getLearningDir());
45790
45830
  mem.startSession(`pipeline-${String(getTimeProvider().now())}`);
@@ -45846,7 +45886,7 @@ function recordRoutingExperience(category, success, durationMs, tokensUsed = 0,
45846
45886
  callRecord(routingMemoryCache);
45847
45887
  return;
45848
45888
  }
45849
- routingMemoryInitPromise ??= import("./routing-memory-AR4YR2RL.js").then(({ createRoutingMemory }) => {
45889
+ routingMemoryInitPromise ??= import("./routing-memory-FBZMNOKG.js").then(({ createRoutingMemory }) => {
45850
45890
  routingMemoryCache ??= createRoutingMemory();
45851
45891
  return routingMemoryCache;
45852
45892
  }).catch((error) => {
@@ -45880,7 +45920,7 @@ ${text}` : "";
45880
45920
  }
45881
45921
  async function getWeatherContext() {
45882
45922
  try {
45883
- const { generateWeatherReport: generateWeatherReport2 } = await import("./weather-report-C2P6NHTX.js");
45923
+ const { generateWeatherReport: generateWeatherReport2 } = await import("./weather-report-5LB2V7NS.js");
45884
45924
  const report = generateWeatherReport2({ includeAdaptive: true });
45885
45925
  const mappings = "recommendedMappings" in report ? report.recommendedMappings : [];
45886
45926
  if (!Array.isArray(mappings) || mappings.length === 0) return "";
@@ -45898,7 +45938,7 @@ ${lines}
45898
45938
  }
45899
45939
  async function getMemoryContext(task) {
45900
45940
  try {
45901
- const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-UYJU63EG.js");
45941
+ const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-SPBLB72Z.js");
45902
45942
  const { getLearningDir } = await import("./learning-persistence-EGY4VKKO.js");
45903
45943
  const memory = createSessionMemory2(getLearningDir(), { maxLearningsInContext: 10 });
45904
45944
  const learnings = memory.searchLearnings(task.slice(0, 200));
@@ -46017,7 +46057,7 @@ ${contextBlock}`;
46017
46057
  const strategy = config.votingStrategy ?? "higher_order";
46018
46058
  await postProgress(config, "Vote", `Running consensus with ${strategy} strategy...`);
46019
46059
  try {
46020
- const { executeVoting } = await import("./consensus-vote-FGB637PZ.js");
46060
+ const { executeVoting } = await import("./consensus-vote-4Y5XZ3FE.js");
46021
46061
  const votingResult = await executeVoting(
46022
46062
  {
46023
46063
  proposal: buildVoteProposal(plan, research),
@@ -46456,7 +46496,7 @@ async function searchCodebaseForTask(task) {
46456
46496
  }
46457
46497
  async function queryResearchRegistry(task) {
46458
46498
  try {
46459
- const { synthesizeResearch: synthesizeResearch2 } = await import("./research-helpers-synthesize-BVJB4HW5.js");
46499
+ const { synthesizeResearch: synthesizeResearch2 } = await import("./research-helpers-synthesize-JAECA6EC.js");
46460
46500
  const topic = task.split(/[.!?\n]/).filter((s) => s.trim().length > 10)[0]?.trim();
46461
46501
  if (topic === void 0) return null;
46462
46502
  const result = await synthesizeResearch2(topic.slice(0, 50));
@@ -46527,7 +46567,7 @@ function createScanStageWrapper() {
46527
46567
  try {
46528
46568
  const slug = ctx.task.match(/([a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+)/)?.[1];
46529
46569
  if (slug !== void 0) {
46530
- const { generateSecurityPlan: generateSecurityPlan2 } = await import("./repo-security-plan-RCYKT5GS.js");
46570
+ const { generateSecurityPlan: generateSecurityPlan2 } = await import("./repo-security-plan-OGGXIUYZ.js");
46531
46571
  const plan = await generateSecurityPlan2({ repo: slug, maxScanners: 10 });
46532
46572
  const recs = plan.recommendations.slice(0, 5).map((r) => `${r.priority}: ${r.displayName} (${r.category})`).join("; ");
46533
46573
  return output(PIPELINE_STATE_KEYS.FINDINGS, recs, getTimeProvider().now() - start, true);
@@ -49616,7 +49656,7 @@ var GitHubTaskTracker = class {
49616
49656
  cachedProvider = null;
49617
49657
  async getProvider() {
49618
49658
  if (this.cachedProvider !== null) return this.cachedProvider;
49619
- const { createScmProvider } = await import("./factory-KVIEFTAC.js");
49659
+ const { createScmProvider } = await import("./factory-2BTUL2LI.js");
49620
49660
  const result = await createScmProvider({ repo: this.config.repo ?? "" });
49621
49661
  if (!result.ok) throw new Error(`SCM provider error: ${result.error.message}`);
49622
49662
  this.cachedProvider = result.value;
@@ -50466,7 +50506,7 @@ async function probeSource(source, includeModelIds) {
50466
50506
  }
50467
50507
  }
50468
50508
  async function defaultSources(includeOpenRouter) {
50469
- const { createAllAdapters: createAllAdapters2 } = await import("./factory-MXWNULXD.js");
50509
+ const { createAllAdapters: createAllAdapters2 } = await import("./factory-3OKL3F4G.js");
50470
50510
  const adapters = createAllAdapters2();
50471
50511
  return buildDefaultModelSources(adapters, { includeOpenRouter });
50472
50512
  }
@@ -52469,6 +52509,10 @@ function createTaskOutcome(params) {
52469
52509
 
52470
52510
  // src/learning/outcome-feedback.ts
52471
52511
  var logger53 = createLogger({ component: "OutcomeFeedback" });
52512
+ function ratioBonus(target, actual, weight) {
52513
+ if (!Number.isFinite(actual) || actual <= 0) return 0;
52514
+ return Math.min(1, target / actual) * weight;
52515
+ }
52472
52516
  var OutcomeFeedbackCollector = class {
52473
52517
  config;
52474
52518
  pendingDecisions = /* @__PURE__ */ new Map();
@@ -52566,10 +52610,16 @@ var OutcomeFeedbackCollector = class {
52566
52610
  baseReward = signals.completionRatio;
52567
52611
  }
52568
52612
  const qualityBonus = outcome.qualityScore * this.config.qualityWeight;
52569
- const speedRatio = Math.min(1, this.config.targetDurationMs / outcome.durationMs);
52570
- const speedBonus = speedRatio * this.config.speedWeight;
52571
- const efficiencyRatio = Math.min(1, this.config.targetTokenUsage / outcome.tokenUsage);
52572
- const efficiencyBonus = efficiencyRatio * this.config.efficiencyWeight;
52613
+ const speedBonus = ratioBonus(
52614
+ this.config.targetDurationMs,
52615
+ outcome.durationMs,
52616
+ this.config.speedWeight
52617
+ );
52618
+ const efficiencyBonus = ratioBonus(
52619
+ this.config.targetTokenUsage,
52620
+ outcome.tokenUsage,
52621
+ this.config.efficiencyWeight
52622
+ );
52573
52623
  const retryPenalty = signals.retryCount * this.config.retryPenalty;
52574
52624
  const rawReward = baseReward + qualityBonus + speedBonus + efficiencyBonus - retryPenalty;
52575
52625
  const reward = clamp01(rawReward);
@@ -54498,4 +54548,4 @@ export {
54498
54548
  shutdownFeedbackSubscriber,
54499
54549
  createEventBusBridge
54500
54550
  };
54501
- //# sourceMappingURL=chunk-6BTRY45Y.js.map
54551
+ //# sourceMappingURL=chunk-AFN5LNPK.js.map