nexus-agents 2.131.0 → 2.132.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 (158) hide show
  1. package/README.md +1 -1
  2. package/dist/{child-mcp-config-M7WR4XBB.js → child-mcp-config-R67B2KM6.js} +4 -4
  3. package/dist/{chunk-5GQMP7QN.js → chunk-27DRQWON.js} +7 -123
  4. package/dist/chunk-27DRQWON.js.map +1 -0
  5. package/dist/{chunk-VTTPYENR.js → chunk-2CLFX73Y.js} +2 -2
  6. package/dist/{chunk-RPT5WZAT.js → chunk-2JZ55G3X.js} +616 -336
  7. package/dist/chunk-2JZ55G3X.js.map +1 -0
  8. package/dist/{chunk-ACARS7NG.js → chunk-4CLBJ2NA.js} +3 -3
  9. package/dist/{chunk-ULIAUMQD.js → chunk-4DLHM6LI.js} +6 -2
  10. package/dist/{chunk-ULIAUMQD.js.map → chunk-4DLHM6LI.js.map} +1 -1
  11. package/dist/{chunk-2Z4V5THE.js → chunk-7BONPRR2.js} +2 -2
  12. package/dist/{chunk-AVRE45DO.js → chunk-CI5KGCX5.js} +3 -3
  13. package/dist/{chunk-E4LAXVQE.js → chunk-E4IYX7LD.js} +2 -2
  14. package/dist/{chunk-A4MPCXZ7.js → chunk-ECDJM6UB.js} +2 -2
  15. package/dist/{chunk-7IMI64LW.js → chunk-EFDXX5MC.js} +3 -3
  16. package/dist/{chunk-ZM3S6PTN.js → chunk-FKTLAPXJ.js} +3 -3
  17. package/dist/{chunk-3XLDANPJ.js → chunk-FRHC77VK.js} +8 -8
  18. package/dist/{chunk-3N7TSFKQ.js → chunk-GET2MTLW.js} +2 -2
  19. package/dist/{chunk-PM4MZHQK.js → chunk-GYDO2WOR.js} +13 -5
  20. package/dist/{chunk-PM4MZHQK.js.map → chunk-GYDO2WOR.js.map} +1 -1
  21. package/dist/{chunk-ZQ5K3PG4.js → chunk-I2SW34K6.js} +403 -84
  22. package/dist/chunk-I2SW34K6.js.map +1 -0
  23. package/dist/{chunk-EYD6O5TQ.js → chunk-J435FU54.js} +6 -4
  24. package/dist/{chunk-EYD6O5TQ.js.map → chunk-J435FU54.js.map} +1 -1
  25. package/dist/{chunk-OGOE3NW5.js → chunk-K5WBFAR4.js} +4 -4
  26. package/dist/{chunk-5CADWTFO.js → chunk-MHIJSCPR.js} +446 -162
  27. package/dist/chunk-MHIJSCPR.js.map +1 -0
  28. package/dist/{chunk-FDY6YOFG.js → chunk-NZGNOXXW.js} +3 -2
  29. package/dist/{chunk-FDY6YOFG.js.map → chunk-NZGNOXXW.js.map} +1 -1
  30. package/dist/{chunk-CMRQR57K.js → chunk-PM63X3QG.js} +3 -3
  31. package/dist/{chunk-VY5WEC2D.js → chunk-QJIHSQZX.js} +791 -28
  32. package/dist/chunk-QJIHSQZX.js.map +1 -0
  33. package/dist/{chunk-FFJEERPZ.js → chunk-QLRH6KOT.js} +2 -2
  34. package/dist/{chunk-3UXCVSLJ.js → chunk-QMCHVYZB.js} +2 -2
  35. package/dist/{chunk-YXFQ3L56.js → chunk-RAWF4JOT.js} +8 -8
  36. package/dist/{chunk-TGDWL7FG.js → chunk-RLYXX3FQ.js} +2 -2
  37. package/dist/{chunk-KY2QMH3C.js → chunk-RR7Q2HFH.js} +6 -6
  38. package/dist/{chunk-ZGLIHPGJ.js → chunk-RUSP5PJR.js} +9 -1
  39. package/dist/chunk-RUSP5PJR.js.map +1 -0
  40. package/dist/{chunk-YEK3ZHO6.js → chunk-S4U3Z6ZS.js} +9 -6
  41. package/dist/{chunk-YEK3ZHO6.js.map → chunk-S4U3Z6ZS.js.map} +1 -1
  42. package/dist/chunk-TGGR6ST5.js +126 -0
  43. package/dist/chunk-TGGR6ST5.js.map +1 -0
  44. package/dist/{chunk-IZO437XR.js → chunk-VZCQRLXT.js} +7 -7
  45. package/dist/{chunk-4A6MSCNJ.js → chunk-WHZD2W6Q.js} +2 -2
  46. package/dist/{chunk-TA5HYM3H.js → chunk-XIFOAZ5B.js} +4 -4
  47. package/dist/{chunk-PR4QN5HX.js → chunk-ZPWHCABL.js} +6 -2
  48. package/dist/{chunk-YHBVFTRG.js → chunk-ZQEQVCIU.js} +2 -2
  49. package/dist/{chunk-ADIJIYFA.js → chunk-ZTRBMKXK.js} +5 -2
  50. package/dist/{chunk-ADIJIYFA.js.map → chunk-ZTRBMKXK.js.map} +1 -1
  51. package/dist/cli-circuit-breaker-J6UFONNE.js +13 -0
  52. package/dist/cli.d.ts +1 -1
  53. package/dist/cli.js +258 -150
  54. package/dist/cli.js.map +1 -1
  55. package/dist/{codebase-search-ZFJUVMVR.js → codebase-search-PWMWLU7O.js} +2 -2
  56. package/dist/{composite-router-V36PBE7B.js → composite-router-HQUSCJO4.js} +4 -4
  57. package/dist/consensus-vote-E2WJFEIJ.js +37 -0
  58. package/dist/{consensus-vote-types-DdruG9-X.d.ts → consensus-vote-types-CYBHW8vY.d.ts} +99 -2
  59. package/dist/{context-retriever-KCSSXI6X.js → context-retriever-5OVRAWNZ.js} +10 -10
  60. package/dist/{dist-QZLOLGIK.js → dist-A5STUO26.js} +792 -622
  61. package/dist/dist-A5STUO26.js.map +1 -0
  62. package/dist/{dist-OFXI4GYH.js → dist-C4457XNQ.js} +2 -2
  63. package/dist/doctor-deep-HJ3NQ365.js +12 -0
  64. package/dist/expert-bridge-MINXBC73.js +17 -0
  65. package/dist/{expert-config-OIIUMJFB.js → expert-config-53EBA7DT.js} +2 -2
  66. package/dist/factory-KC7BYHAP.js +21 -0
  67. package/dist/factory-ZG2FZYVA.js +14 -0
  68. package/dist/{improvement-review-AMVJW3SI.js → improvement-review-TDC4QH5P.js} +6 -6
  69. package/dist/index.d.ts +731 -339
  70. package/dist/index.js +31 -30
  71. package/dist/index.js.map +1 -1
  72. package/dist/{init-opencode-3UPZL2UQ.js → init-opencode-L3NT524E.js} +8 -7
  73. package/dist/{init-opencode-3UPZL2UQ.js.map → init-opencode-L3NT524E.js.map} +1 -1
  74. package/dist/issue-triage-CZPFNGB7.js +16 -0
  75. package/dist/{learning-persistence-C737Q6EP.js → learning-persistence-QFCQ5POD.js} +7 -3
  76. package/dist/{outcome-store-adapter-D3UDQFNQ.js → outcome-store-adapter-K4L3RUJE.js} +2 -2
  77. package/dist/{pr-reviewer-helpers-2WBM5GL7.js → pr-reviewer-helpers-PLKDVWYF.js} +6 -6
  78. package/dist/{registry-command-AXNA2H35.js → registry-command-HPKNLYUL.js} +4 -4
  79. package/dist/{repo-analyze-JZEMBE6R.js → repo-analyze-UJOWFGNM.js} +2 -2
  80. package/dist/{repo-security-plan-P2KJ4FDT.js → repo-security-plan-HSYGGVEJ.js} +5 -5
  81. package/dist/research-helpers-synthesize-IQHDU27S.js +14 -0
  82. package/dist/{routing-memory-7RNR6A45.js → routing-memory-OGUOL7UF.js} +4 -4
  83. package/dist/{session-memory-2J2UBZJA.js → session-memory-HQWAXH3C.js} +5 -5
  84. package/dist/{setup-command-UF7EQKAL.js → setup-command-CNYIKBY7.js} +13 -13
  85. package/dist/setup-config-HYX3BRSE.js +10 -0
  86. package/dist/{setup-custom-api-AZMHKIHE.js → setup-custom-api-W7EDVKWR.js} +5 -5
  87. package/dist/{tool-memory-MIZVB4ZT.js → tool-memory-Z2B7CAH7.js} +7 -7
  88. package/dist/unified-registry-UFNSWKZA.js +24 -0
  89. package/dist/{weather-report-WZKEEAC7.js → weather-report-GX7OIUL2.js} +4 -4
  90. package/package.json +12 -12
  91. package/dist/chunk-5CADWTFO.js.map +0 -1
  92. package/dist/chunk-5GQMP7QN.js.map +0 -1
  93. package/dist/chunk-RPT5WZAT.js.map +0 -1
  94. package/dist/chunk-VY5WEC2D.js.map +0 -1
  95. package/dist/chunk-ZGLIHPGJ.js.map +0 -1
  96. package/dist/chunk-ZQ5K3PG4.js.map +0 -1
  97. package/dist/cli-circuit-breaker-XRXLO2V6.js +0 -13
  98. package/dist/consensus-vote-3REPKLK4.js +0 -36
  99. package/dist/dist-QZLOLGIK.js.map +0 -1
  100. package/dist/doctor-deep-WID6FQ2F.js +0 -12
  101. package/dist/expert-bridge-F4UMZFWS.js +0 -17
  102. package/dist/factory-B3SPS47O.js +0 -21
  103. package/dist/factory-YVHULPTE.js +0 -14
  104. package/dist/issue-triage-U3VC5TKV.js +0 -16
  105. package/dist/research-helpers-synthesize-UHWT62F2.js +0 -14
  106. package/dist/setup-config-Y3S2L4RD.js +0 -10
  107. package/dist/unified-registry-V4AZ6UYA.js +0 -24
  108. /package/dist/{child-mcp-config-M7WR4XBB.js.map → child-mcp-config-R67B2KM6.js.map} +0 -0
  109. /package/dist/{chunk-VTTPYENR.js.map → chunk-2CLFX73Y.js.map} +0 -0
  110. /package/dist/{chunk-ACARS7NG.js.map → chunk-4CLBJ2NA.js.map} +0 -0
  111. /package/dist/{chunk-2Z4V5THE.js.map → chunk-7BONPRR2.js.map} +0 -0
  112. /package/dist/{chunk-AVRE45DO.js.map → chunk-CI5KGCX5.js.map} +0 -0
  113. /package/dist/{chunk-E4LAXVQE.js.map → chunk-E4IYX7LD.js.map} +0 -0
  114. /package/dist/{chunk-A4MPCXZ7.js.map → chunk-ECDJM6UB.js.map} +0 -0
  115. /package/dist/{chunk-7IMI64LW.js.map → chunk-EFDXX5MC.js.map} +0 -0
  116. /package/dist/{chunk-ZM3S6PTN.js.map → chunk-FKTLAPXJ.js.map} +0 -0
  117. /package/dist/{chunk-3XLDANPJ.js.map → chunk-FRHC77VK.js.map} +0 -0
  118. /package/dist/{chunk-3N7TSFKQ.js.map → chunk-GET2MTLW.js.map} +0 -0
  119. /package/dist/{chunk-OGOE3NW5.js.map → chunk-K5WBFAR4.js.map} +0 -0
  120. /package/dist/{chunk-CMRQR57K.js.map → chunk-PM63X3QG.js.map} +0 -0
  121. /package/dist/{chunk-FFJEERPZ.js.map → chunk-QLRH6KOT.js.map} +0 -0
  122. /package/dist/{chunk-3UXCVSLJ.js.map → chunk-QMCHVYZB.js.map} +0 -0
  123. /package/dist/{chunk-YXFQ3L56.js.map → chunk-RAWF4JOT.js.map} +0 -0
  124. /package/dist/{chunk-TGDWL7FG.js.map → chunk-RLYXX3FQ.js.map} +0 -0
  125. /package/dist/{chunk-KY2QMH3C.js.map → chunk-RR7Q2HFH.js.map} +0 -0
  126. /package/dist/{chunk-IZO437XR.js.map → chunk-VZCQRLXT.js.map} +0 -0
  127. /package/dist/{chunk-4A6MSCNJ.js.map → chunk-WHZD2W6Q.js.map} +0 -0
  128. /package/dist/{chunk-TA5HYM3H.js.map → chunk-XIFOAZ5B.js.map} +0 -0
  129. /package/dist/{chunk-PR4QN5HX.js.map → chunk-ZPWHCABL.js.map} +0 -0
  130. /package/dist/{chunk-YHBVFTRG.js.map → chunk-ZQEQVCIU.js.map} +0 -0
  131. /package/dist/{cli-circuit-breaker-XRXLO2V6.js.map → cli-circuit-breaker-J6UFONNE.js.map} +0 -0
  132. /package/dist/{codebase-search-ZFJUVMVR.js.map → codebase-search-PWMWLU7O.js.map} +0 -0
  133. /package/dist/{composite-router-V36PBE7B.js.map → composite-router-HQUSCJO4.js.map} +0 -0
  134. /package/dist/{consensus-vote-3REPKLK4.js.map → consensus-vote-E2WJFEIJ.js.map} +0 -0
  135. /package/dist/{context-retriever-KCSSXI6X.js.map → context-retriever-5OVRAWNZ.js.map} +0 -0
  136. /package/dist/{dist-OFXI4GYH.js.map → dist-C4457XNQ.js.map} +0 -0
  137. /package/dist/{doctor-deep-WID6FQ2F.js.map → doctor-deep-HJ3NQ365.js.map} +0 -0
  138. /package/dist/{expert-bridge-F4UMZFWS.js.map → expert-bridge-MINXBC73.js.map} +0 -0
  139. /package/dist/{expert-config-OIIUMJFB.js.map → expert-config-53EBA7DT.js.map} +0 -0
  140. /package/dist/{factory-B3SPS47O.js.map → factory-KC7BYHAP.js.map} +0 -0
  141. /package/dist/{factory-YVHULPTE.js.map → factory-ZG2FZYVA.js.map} +0 -0
  142. /package/dist/{improvement-review-AMVJW3SI.js.map → improvement-review-TDC4QH5P.js.map} +0 -0
  143. /package/dist/{issue-triage-U3VC5TKV.js.map → issue-triage-CZPFNGB7.js.map} +0 -0
  144. /package/dist/{learning-persistence-C737Q6EP.js.map → learning-persistence-QFCQ5POD.js.map} +0 -0
  145. /package/dist/{outcome-store-adapter-D3UDQFNQ.js.map → outcome-store-adapter-K4L3RUJE.js.map} +0 -0
  146. /package/dist/{pr-reviewer-helpers-2WBM5GL7.js.map → pr-reviewer-helpers-PLKDVWYF.js.map} +0 -0
  147. /package/dist/{registry-command-AXNA2H35.js.map → registry-command-HPKNLYUL.js.map} +0 -0
  148. /package/dist/{repo-analyze-JZEMBE6R.js.map → repo-analyze-UJOWFGNM.js.map} +0 -0
  149. /package/dist/{repo-security-plan-P2KJ4FDT.js.map → repo-security-plan-HSYGGVEJ.js.map} +0 -0
  150. /package/dist/{research-helpers-synthesize-UHWT62F2.js.map → research-helpers-synthesize-IQHDU27S.js.map} +0 -0
  151. /package/dist/{routing-memory-7RNR6A45.js.map → routing-memory-OGUOL7UF.js.map} +0 -0
  152. /package/dist/{session-memory-2J2UBZJA.js.map → session-memory-HQWAXH3C.js.map} +0 -0
  153. /package/dist/{setup-command-UF7EQKAL.js.map → setup-command-CNYIKBY7.js.map} +0 -0
  154. /package/dist/{setup-config-Y3S2L4RD.js.map → setup-config-HYX3BRSE.js.map} +0 -0
  155. /package/dist/{setup-custom-api-AZMHKIHE.js.map → setup-custom-api-W7EDVKWR.js.map} +0 -0
  156. /package/dist/{tool-memory-MIZVB4ZT.js.map → tool-memory-Z2B7CAH7.js.map} +0 -0
  157. /package/dist/{unified-registry-V4AZ6UYA.js.map → unified-registry-UFNSWKZA.js.map} +0 -0
  158. /package/dist/{weather-report-WZKEEAC7.js.map → weather-report-GX7OIUL2.js.map} +0 -0
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ZodError, z, ZodType, ZodSafeParseResult } from 'zod';
2
- import { C as CliNameLiteral, I as InputModality, O as OutputModality, T as ToolCapability, S as SpecialFeature, P as Pricing, Q as QualityScores, M as ModelId, V as VotingStrategy } from './consensus-vote-types-DdruG9-X.js';
3
- export { A as AgentVoteSummary, a as ConsensusVoteInput, b as ConsensusVoteInputSchema, c as ConsensusVoteResponse, d as VoteDecisionStatus } from './consensus-vote-types-DdruG9-X.js';
2
+ import { C as CliNameLiteral, I as InputModality, O as OutputModality, T as ToolCapability, S as SpecialFeature, P as Pricing, Q as QualityScores, M as ModelId, D as DecisionCostSummary, V as VotingStrategy } from './consensus-vote-types-CYBHW8vY.js';
3
+ export { A as AgentVoteSummary, a as ConsensusVoteInput, b as ConsensusVoteInputSchema, c as ConsensusVoteResponse, d as VoteDecisionStatus } from './consensus-vote-types-CYBHW8vY.js';
4
4
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
5
  import { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
6
6
 
@@ -12111,9 +12111,9 @@ declare const BuiltInExpertTypeSchema: z.ZodEnum<{
12111
12111
  testing: "testing";
12112
12112
  devops: "devops";
12113
12113
  infrastructure: "infrastructure";
12114
+ qa: "qa";
12114
12115
  pm: "pm";
12115
12116
  ux: "ux";
12116
- qa: "qa";
12117
12117
  "data-visualization": "data-visualization";
12118
12118
  }>;
12119
12119
  /**
@@ -14208,8 +14208,8 @@ declare const SkillLoaderConfigSchema: z.ZodObject<{
14208
14208
  "code-generation": "code-generation";
14209
14209
  observability: "observability";
14210
14210
  database: "database";
14211
- refactoring: "refactoring";
14212
14211
  deployment: "deployment";
14212
+ refactoring: "refactoring";
14213
14213
  "file-operations": "file-operations";
14214
14214
  "code-analysis": "code-analysis";
14215
14215
  "coding-standards": "coding-standards";
@@ -14228,8 +14228,8 @@ declare const SkillLoaderConfigSchema: z.ZodObject<{
14228
14228
  "code-generation": "code-generation";
14229
14229
  observability: "observability";
14230
14230
  database: "database";
14231
- refactoring: "refactoring";
14232
14231
  deployment: "deployment";
14232
+ refactoring: "refactoring";
14233
14233
  "file-operations": "file-operations";
14234
14234
  "code-analysis": "code-analysis";
14235
14235
  "coding-standards": "coding-standards";
@@ -15521,11 +15521,11 @@ type ExplorationEventType = 'tree_created' | 'node_created' | 'node_activated' |
15521
15521
  * Schema for ExplorationEventType validation.
15522
15522
  */
15523
15523
  declare const ExplorationEventTypeSchema: z.ZodEnum<{
15524
+ node_completed: "node_completed";
15524
15525
  tree_created: "tree_created";
15525
15526
  node_created: "node_created";
15526
15527
  node_activated: "node_activated";
15527
15528
  node_deactivated: "node_deactivated";
15528
- node_completed: "node_completed";
15529
15529
  node_pruned: "node_pruned";
15530
15530
  path_scored: "path_scored";
15531
15531
  cross_tree_share: "cross_tree_share";
@@ -15555,11 +15555,11 @@ interface ExplorationEvent {
15555
15555
  declare const ExplorationEventSchema: z.ZodObject<{
15556
15556
  timestamp: z.ZodNumber;
15557
15557
  eventType: z.ZodEnum<{
15558
+ node_completed: "node_completed";
15558
15559
  tree_created: "tree_created";
15559
15560
  node_created: "node_created";
15560
15561
  node_activated: "node_activated";
15561
15562
  node_deactivated: "node_deactivated";
15562
- node_completed: "node_completed";
15563
15563
  node_pruned: "node_pruned";
15564
15564
  path_scored: "path_scored";
15565
15565
  cross_tree_share: "cross_tree_share";
@@ -15697,11 +15697,11 @@ declare const ForestResultSchema: z.ZodObject<{
15697
15697
  explorationHistory: z.ZodOptional<z.ZodArray<z.ZodObject<{
15698
15698
  timestamp: z.ZodNumber;
15699
15699
  eventType: z.ZodEnum<{
15700
+ node_completed: "node_completed";
15700
15701
  tree_created: "tree_created";
15701
15702
  node_created: "node_created";
15702
15703
  node_activated: "node_activated";
15703
15704
  node_deactivated: "node_deactivated";
15704
- node_completed: "node_completed";
15705
15705
  node_pruned: "node_pruned";
15706
15706
  path_scored: "path_scored";
15707
15707
  cross_tree_share: "cross_tree_share";
@@ -18346,8 +18346,52 @@ declare const AuditCategorySchema: z.ZodEnum<{
18346
18346
  tool_invocation: "tool_invocation";
18347
18347
  data_access: "data_access";
18348
18348
  data_modification: "data_modification";
18349
+ governance: "governance";
18349
18350
  }>;
18350
18351
  type AuditCategory = z.infer<typeof AuditCategorySchema>;
18352
+ /**
18353
+ * The two directions a loop can move on the authority ladder (ADR-0017
18354
+ * §"Transition Rules"). A `promotion` moves UP a tier and is invalid without a
18355
+ * linked ratification vote; a `demotion` moves DOWN and is automatic (needs no
18356
+ * vote). The ratification gate (`scripts/check-authority-tier-drift.ts`) keys
18357
+ * off this kind: a `promotion` event lacking `ratificationVoteRef` FAILS the
18358
+ * gate, a `demotion` does not.
18359
+ */
18360
+ declare const TierTransitionKindSchema: z.ZodEnum<{
18361
+ promotion: "promotion";
18362
+ demotion: "demotion";
18363
+ }>;
18364
+ type TierTransitionKind = z.infer<typeof TierTransitionKindSchema>;
18365
+ /**
18366
+ * The authority tier vocabulary, mirrored from
18367
+ * `orchestration/strategy-manifest.ts` `AuthorityTierSchema`. Declared here so
18368
+ * the audit module has no dependency on the orchestration layer (the audit log
18369
+ * is the lower layer). A drift between the two enums is caught by the audit
18370
+ * tier-transition tests, which round-trip every tier through the emitter.
18371
+ */
18372
+ declare const TierTransitionTierSchema: z.ZodEnum<{
18373
+ enforce: "enforce";
18374
+ observe: "observe";
18375
+ suggest: "suggest";
18376
+ advisory: "advisory";
18377
+ }>;
18378
+ type TierTransitionTier = z.infer<typeof TierTransitionTierSchema>;
18379
+ /**
18380
+ * Options for {@link IAuditLogger.logTierTransition}. The `actor` defaults to the
18381
+ * system actor at the emission site when omitted (a tier change recorded by the
18382
+ * evidence ledger is a system event).
18383
+ */
18384
+ interface TierTransitionAuditOpts {
18385
+ kind: TierTransitionKind;
18386
+ subject: string;
18387
+ fromTier: TierTransitionTier;
18388
+ toTier: TierTransitionTier;
18389
+ evidenceRef: string;
18390
+ ratificationVoteRef?: string | undefined;
18391
+ actor?: AuditActor | undefined;
18392
+ requestId?: string | undefined;
18393
+ metadata?: Record<string, unknown> | undefined;
18394
+ }
18351
18395
  declare const AuditSeveritySchema: z.ZodEnum<{
18352
18396
  info: "info";
18353
18397
  warning: "warning";
@@ -18395,6 +18439,7 @@ declare const AuditEventSchema: z.ZodObject<{
18395
18439
  tool_invocation: "tool_invocation";
18396
18440
  data_access: "data_access";
18397
18441
  data_modification: "data_modification";
18442
+ governance: "governance";
18398
18443
  }>;
18399
18444
  severity: z.ZodEnum<{
18400
18445
  info: "info";
@@ -18438,6 +18483,7 @@ declare const AuditEventSchema: z.ZodObject<{
18438
18483
  violationType: z.ZodOptional<z.ZodString>;
18439
18484
  previousHash: z.ZodOptional<z.ZodString>;
18440
18485
  hash: z.ZodOptional<z.ZodString>;
18486
+ hashVersion: z.ZodOptional<z.ZodNumber>;
18441
18487
  }, z.core.$strip>;
18442
18488
  type AuditEvent$1 = z.infer<typeof AuditEventSchema>;
18443
18489
  declare const AuditEventInputSchema: z.ZodObject<{
@@ -18450,6 +18496,7 @@ declare const AuditEventInputSchema: z.ZodObject<{
18450
18496
  tool_invocation: "tool_invocation";
18451
18497
  data_access: "data_access";
18452
18498
  data_modification: "data_modification";
18499
+ governance: "governance";
18453
18500
  }>;
18454
18501
  severity: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
18455
18502
  info: "info";
@@ -18516,6 +18563,7 @@ declare const AuditLogConfigSchema: z.ZodObject<{
18516
18563
  tool_invocation: "tool_invocation";
18517
18564
  data_access: "data_access";
18518
18565
  data_modification: "data_modification";
18566
+ governance: "governance";
18519
18567
  }>>>;
18520
18568
  }, z.core.$strip>;
18521
18569
  type AuditLogConfig = z.infer<typeof AuditLogConfigSchema>;
@@ -18541,6 +18589,7 @@ declare const AuditQueryCriteriaSchema: z.ZodObject<{
18541
18589
  tool_invocation: "tool_invocation";
18542
18590
  data_access: "data_access";
18543
18591
  data_modification: "data_modification";
18592
+ governance: "governance";
18544
18593
  }>>>;
18545
18594
  severities: z.ZodOptional<z.ZodArray<z.ZodEnum<{
18546
18595
  info: "info";
@@ -18572,6 +18621,8 @@ interface IAuditLogger {
18572
18621
  logSecurityEvent(opts: SecurityEventAuditOpts): void;
18573
18622
  /** Log a rate limit violation */
18574
18623
  logRateLimitViolation(opts: RateLimitAuditOpts): void;
18624
+ /** Log an authority-tier transition (promotion/demotion) — Epic D, #3842. */
18625
+ logTierTransition(opts: TierTransitionAuditOpts): void;
18575
18626
  /** Flush pending events */
18576
18627
  flush(): Promise<void>;
18577
18628
  /** Close the logger */
@@ -19471,6 +19522,138 @@ interface IEventBus {
19471
19522
  readonly bufferSize: number;
19472
19523
  }
19473
19524
 
19525
+ /**
19526
+ * decision-cost-store — durable per-decision cost rollups.
19527
+ *
19528
+ * Source: Issue #3855 (epic #3854 child, M4).
19529
+ *
19530
+ * Persists one {@link DecisionCostRecord} per governed decision (a
19531
+ * `consensus_vote` / `pr_review` run) so the question "what did this decision
19532
+ * cost?" can be answered from recorded data later — feeding Epic G's
19533
+ * weather_report / manifest cost profiles (#3856) and the governed-decision
19534
+ * cost doc (#3857).
19535
+ *
19536
+ * Mirrors the established persistence idiom: it reuses the shared
19537
+ * {@link JsonlStore} primitive ({@link module:config/jsonl-store}, #3762) rather
19538
+ * than re-forking the hydrate/append/rotate fs plumbing, and writes under the
19539
+ * shared learning dir like {@link module:orchestration/outcomes/outcome-store}.
19540
+ * Record + measure ONLY — no routing or weighting change (#3855 acceptance).
19541
+ *
19542
+ * @module observability/decision-cost-store
19543
+ */
19544
+
19545
+ /** Decision surface that incurred the cost — the gate type (#3854). */
19546
+ declare const DecisionGateSchema: z.ZodEnum<{
19547
+ consensus_vote: "consensus_vote";
19548
+ pr_review: "pr_review";
19549
+ }>;
19550
+ type DecisionGate = z.infer<typeof DecisionGateSchema>;
19551
+ /** One persisted per-decision cost rollup. */
19552
+ declare const DecisionCostRecordSchema: z.ZodObject<{
19553
+ decisionId: z.ZodString;
19554
+ gate: z.ZodEnum<{
19555
+ consensus_vote: "consensus_vote";
19556
+ pr_review: "pr_review";
19557
+ }>;
19558
+ timestamp: z.ZodString;
19559
+ summary: z.ZodObject<{
19560
+ billingMode: z.ZodEnum<{
19561
+ plan: "plan";
19562
+ api: "api";
19563
+ }>;
19564
+ voterCount: z.ZodNumber;
19565
+ measuredVoters: z.ZodNumber;
19566
+ unmeasuredVoters: z.ZodNumber;
19567
+ totalInputTokens: z.ZodNumber;
19568
+ totalOutputTokens: z.ZodNumber;
19569
+ totalTokens: z.ZodNumber;
19570
+ totalCostUsd: z.ZodNumber;
19571
+ perVoter: z.ZodReadonly<z.ZodArray<z.ZodObject<{
19572
+ role: z.ZodString;
19573
+ model: z.ZodString;
19574
+ inputTokens: z.ZodNumber;
19575
+ outputTokens: z.ZodNumber;
19576
+ totalTokens: z.ZodNumber;
19577
+ costUsd: z.ZodNumber;
19578
+ unmeasured: z.ZodBoolean;
19579
+ }, z.core.$strip>>>;
19580
+ perModel: z.ZodReadonly<z.ZodArray<z.ZodObject<{
19581
+ model: z.ZodString;
19582
+ voterCount: z.ZodNumber;
19583
+ inputTokens: z.ZodNumber;
19584
+ outputTokens: z.ZodNumber;
19585
+ totalTokens: z.ZodNumber;
19586
+ costUsd: z.ZodNumber;
19587
+ }, z.core.$strip>>>;
19588
+ }, z.core.$strip>;
19589
+ }, z.core.$strip>;
19590
+ type DecisionCostRecord = z.infer<typeof DecisionCostRecordSchema>;
19591
+
19592
+ /**
19593
+ * decision-cost-aggregate — windowed CROSS-decision cost rollups by gate type.
19594
+ *
19595
+ * Source: Issue #3856 (epic #3854 child, M4).
19596
+ *
19597
+ * Where {@link module:observability/decision-cost} rolls N voters UP into one
19598
+ * per-decision summary, this module rolls N *decisions* up into one per-GATE
19599
+ * answer: "across the recent window, what does a `consensus_vote` / `pr_review`
19600
+ * decision cost on average?". It is the aggregation `weather_report` surfaces
19601
+ * (#3856) so an operator sees what governed decisions are costing without a new
19602
+ * MCP tool — the report reads the {@link DecisionCostStore}'s persisted records
19603
+ * and folds them through this PURE function.
19604
+ *
19605
+ * Pure and deterministic: no I/O, no clock, no env reads. The caller supplies
19606
+ * the records (already windowed/queried) and this returns the per-gate averages.
19607
+ * Averages are reported alongside the decision count and the measured/unmeasured
19608
+ * voter split so a reader knows the confidence — a per-gate average is a FLOOR
19609
+ * when unmeasured voters contributed (their unknown real cost counts as 0), the
19610
+ * same honesty {@link module:observability/decision-cost} keeps per-decision.
19611
+ *
19612
+ * @module observability/decision-cost-aggregate
19613
+ */
19614
+
19615
+ /** Per-gate windowed cost aggregate surfaced in the weather report (#3856). */
19616
+ interface GateCostAggregate {
19617
+ /** Which gate type these decisions came from. */
19618
+ readonly gate: DecisionGate;
19619
+ /** Number of decisions folded in. */
19620
+ readonly decisionCount: number;
19621
+ /** Mean total cost (USD) per decision over the window. */
19622
+ readonly avgCostUsd: number;
19623
+ /** Mean total tokens per decision over the window. */
19624
+ readonly avgTokens: number;
19625
+ /** Mean number of voters per decision. */
19626
+ readonly avgVoters: number;
19627
+ /** Sum of cost (USD) across all decisions in the window. */
19628
+ readonly totalCostUsd: number;
19629
+ /** Sum of tokens across all decisions in the window. */
19630
+ readonly totalTokens: number;
19631
+ /**
19632
+ * Total voters that reported usage across the window. With `unmeasuredVoters`
19633
+ * this is the confidence signal: the averages are a FLOOR when
19634
+ * `unmeasuredVoters > 0` (unmeasured voters contribute 0, not their real cost).
19635
+ */
19636
+ readonly measuredVoters: number;
19637
+ /** Total voters that reported no usage across the window. */
19638
+ readonly unmeasuredVoters: number;
19639
+ /**
19640
+ * True when `unmeasuredVoters > 0` — the averages understate true spend
19641
+ * because some voter calls reported no usage and were folded in as 0.
19642
+ */
19643
+ readonly costIsFloor: boolean;
19644
+ }
19645
+ /** The decision-cost section of the weather report (#3856). */
19646
+ interface DecisionCostReport {
19647
+ /** Lookback window the records were drawn from, in ms (0 ⇒ all history). */
19648
+ readonly windowMs: number;
19649
+ /** Per-gate-type aggregates, sorted by total cost desc then gate name. */
19650
+ readonly byGate: readonly GateCostAggregate[];
19651
+ /** Total decisions across all gates in the window. */
19652
+ readonly totalDecisions: number;
19653
+ /** Total cost (USD) across all gates in the window. */
19654
+ readonly totalCostUsd: number;
19655
+ }
19656
+
19474
19657
  /**
19475
19658
  * nexus-agents/observability - Dashboard Types
19476
19659
  *
@@ -21806,12 +21989,12 @@ declare function selectModel(input: DelegateInput, requirements: TaskRequirement
21806
21989
  * - higher_order: alias for opinion_wise (Issue #514)
21807
21990
  */
21808
21991
  declare const ConsensusAlgorithmSchema: z.ZodEnum<{
21992
+ higher_order: "higher_order";
21809
21993
  simple_majority: "simple_majority";
21810
21994
  supermajority: "supermajority";
21811
21995
  unanimous: "unanimous";
21812
21996
  proof_of_learning: "proof_of_learning";
21813
21997
  opinion_wise: "opinion_wise";
21814
- higher_order: "higher_order";
21815
21998
  }>;
21816
21999
  type ConsensusAlgorithm = z.infer<typeof ConsensusAlgorithmSchema>;
21817
22000
  /**
@@ -21914,12 +22097,12 @@ declare const ProposalSchema: z.ZodObject<{
21914
22097
  title: z.ZodString;
21915
22098
  description: z.ZodString;
21916
22099
  algorithm: z.ZodEnum<{
22100
+ higher_order: "higher_order";
21917
22101
  simple_majority: "simple_majority";
21918
22102
  supermajority: "supermajority";
21919
22103
  unanimous: "unanimous";
21920
22104
  proof_of_learning: "proof_of_learning";
21921
22105
  opinion_wise: "opinion_wise";
21922
- higher_order: "higher_order";
21923
22106
  }>;
21924
22107
  timeout: z.ZodOptional<z.ZodNumber>;
21925
22108
  requiredVoters: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -21975,12 +22158,12 @@ declare const ConsensusResultSchema: z.ZodObject<{
21975
22158
  title: z.ZodString;
21976
22159
  description: z.ZodString;
21977
22160
  algorithm: z.ZodEnum<{
22161
+ higher_order: "higher_order";
21978
22162
  simple_majority: "simple_majority";
21979
22163
  supermajority: "supermajority";
21980
22164
  unanimous: "unanimous";
21981
22165
  proof_of_learning: "proof_of_learning";
21982
22166
  opinion_wise: "opinion_wise";
21983
- higher_order: "higher_order";
21984
22167
  }>;
21985
22168
  timeout: z.ZodOptional<z.ZodNumber>;
21986
22169
  requiredVoters: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -22195,12 +22378,12 @@ declare const ConsensusMetricsSchema: z.ZodObject<{
22195
22378
  averageDurationMs: z.ZodNumber;
22196
22379
  averageVotesPerProposal: z.ZodNumber;
22197
22380
  algorithmUsage: z.ZodRecord<z.ZodEnum<{
22381
+ higher_order: "higher_order";
22198
22382
  simple_majority: "simple_majority";
22199
22383
  supermajority: "supermajority";
22200
22384
  unanimous: "unanimous";
22201
22385
  proof_of_learning: "proof_of_learning";
22202
22386
  opinion_wise: "opinion_wise";
22203
- higher_order: "higher_order";
22204
22387
  }>, z.ZodNumber>;
22205
22388
  }, z.core.$strip>;
22206
22389
 
@@ -22547,6 +22730,25 @@ interface AgentVoteResult {
22547
22730
  readonly source: 'llm' | 'simulation' | 'error';
22548
22731
  /** CLI that executed this vote (for adaptive routing feedback). */
22549
22732
  readonly cli?: string | undefined;
22733
+ /**
22734
+ * Model id that executed this vote, when known (e.g. 'claude-sonnet'). Carried
22735
+ * so per-decision cost aggregation can attribute spend per model (#3855). Absent
22736
+ * for error/simulation votes that never reached a model.
22737
+ */
22738
+ readonly model?: string | undefined;
22739
+ /**
22740
+ * Input tokens the adapter reported for this voter's LLM call, when known
22741
+ * (#3910). Propagated from `CompletionResponse.usage` so per-decision cost
22742
+ * aggregation resolves from `unmeasured` to MEASURED. Absent for
22743
+ * error/simulation votes that never reached a model, or for adapters that do
22744
+ * not report usage (CLI subscriptions) — those stay honestly `unmeasured`.
22745
+ */
22746
+ readonly inputTokens?: number | undefined;
22747
+ /**
22748
+ * Output tokens the adapter reported for this voter's LLM call, when known
22749
+ * (#3910). See {@link AgentVoteResult.inputTokens}.
22750
+ */
22751
+ readonly outputTokens?: number | undefined;
22550
22752
  /** Error message if vote fell back to simulation or encountered an error */
22551
22753
  readonly error?: string;
22552
22754
  }
@@ -24776,7 +24978,7 @@ declare const ImprovementReviewInputSchema: z.ZodObject<{
24776
24978
  selfEvalReportPath: z.ZodOptional<z.ZodString>;
24777
24979
  }, z.core.$strip>;
24778
24980
  type ImprovementReviewInput = z.infer<typeof ImprovementReviewInputSchema>;
24779
- type SignalCategory = 'routing' | 'tech-debt' | 'bug' | 'security' | 'consensus';
24981
+ type SignalCategory = 'routing' | 'tech-debt' | 'bug' | 'security' | 'consensus' | 'tool-fitness';
24780
24982
  interface ImprovementSignal {
24781
24983
  readonly category: SignalCategory;
24782
24984
  /** Stable key used for dedup against existing issues. */
@@ -24828,102 +25030,461 @@ declare function registerImprovementReviewTool(server: McpServer, deps: Improvem
24828
25030
  * (Source: Issue #865 — Weather report with adaptive routing)
24829
25031
  */
24830
25032
 
24831
- type WeatherReportDeps = BaseMcpToolDeps;
25033
+ type WeatherReportDeps$1 = BaseMcpToolDeps;
24832
25034
  /** @category MCP */
24833
- declare function registerWeatherReportTool(server: McpServer, deps: WeatherReportDeps): void;
25035
+ declare function registerWeatherReportTool(server: McpServer, deps: WeatherReportDeps$1): void;
24834
25036
 
24835
25037
  /**
24836
- * Type definitions for the Weather Report MCP tool.
25038
+ * nexus-agents/orchestration - Strategy Manifest schema + loader.
24837
25039
  *
24838
- * Surfaces observed model performance as a living "weather report"
24839
- * and computes adaptive routing bonuses from outcome data.
25040
+ * The strategy-manifest registry (`governance/strategy-manifests.yaml`) is the
25041
+ * single source of truth describing each routable execution strategy: which
25042
+ * engine fronts it, whether it has a wired executor, when to force it, and the
25043
+ * forward-compat governance (authority tier — Epic D) and cost (Epic G) fields.
25044
+ * The MetaOrchestrator routes purely over manifest data — adding a capability
25045
+ * becomes "register a manifest", not "edit the router" (Epic C, #3833).
24840
25046
  *
24841
- * @module mcp/tools/weather-report-types
24842
- * (Source: Issue #865 Weather report with adaptive routing)
25047
+ * This module owns ONLY the schema + loader/validator (child #3834). It MIRRORS
25048
+ * the claims-registry pattern (versioned YAML + Zod schema + loader + Vitest) so
25049
+ * a reviewer reasons about both with the same mental model.
25050
+ *
25051
+ * Explicitly deferred to siblings:
25052
+ * - #3835: migrating the 8 live strategies (`STRATEGY_ENTRYPOINT_TOOL`,
25053
+ * run-tool.ts) to registered manifests + the behaviour-parity golden test.
25054
+ * - #3836: the router refactor that consumes these manifests instead of the
25055
+ * hardcoded `decideStrategy` rules.
25056
+ * - #3837: drift-gating the registry under `governance:check`.
25057
+ *
25058
+ * @module orchestration/strategy-manifest
25059
+ * (Source: Issue #3833, #3834)
24843
25060
  */
24844
25061
 
24845
- declare const WeatherReportInputSchema: z.ZodObject<{
24846
- cli: z.ZodOptional<z.ZodEnum<{
24847
- claude: "claude";
24848
- gemini: "gemini";
24849
- codex: "codex";
24850
- opencode: "opencode";
24851
- }>>;
24852
- category: z.ZodOptional<z.ZodEnum<{
24853
- planning: "planning";
24854
- architecture: "architecture";
24855
- code_generation: "code_generation";
24856
- code_review: "code_review";
24857
- research: "research";
24858
- security_review: "security_review";
24859
- documentation: "documentation";
24860
- testing: "testing";
24861
- devops: "devops";
24862
- exploration: "exploration";
24863
- }>>;
24864
- includeAdaptive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
24865
- }, z.core.$strip>;
24866
- /** Options for generateWeatherReport (all fields optional). */
24867
- interface WeatherReportOptions {
24868
- readonly cli?: CliNameLiteral;
24869
- readonly category?: string;
24870
- readonly includeAdaptive?: boolean;
24871
- }
24872
- /** Adapter attempt stats separating infra failures from model-quality failures (#1982). */
24873
- interface AdapterAttemptStats {
24874
- /**
24875
- * Success rate excluding adapter_unavailable failures. Represents model-quality
24876
- * success when the adapter could actually attempt the task. Rounded to 3 decimals.
24877
- */
24878
- readonly adapterAttemptSuccessRate: number;
24879
- /** Count of adapter_unavailable failures in the sample. */
24880
- readonly adapterUnavailableCount: number;
25062
+ /**
25063
+ * Cost profile (Epic G, #3856). A coarse cost hint scaled by a strategy's
25064
+ * fan-out: `low` (one model call), `medium` (templated multi-stage gate), `high`
25065
+ * (N-voter panel / multi-agent orchestration / greenfield build), `variable`
25066
+ * (spend scales with input size — graph topology, research breadth). Populated
25067
+ * for the live 8 manifests by #3856 and surfaced in the weather_report cost
25068
+ * section alongside the measured per-decision aggregates (#3855). Stays optional
25069
+ * on the schema so a future manifest can register before grading its profile.
25070
+ */
25071
+ declare const CostProfileSchema: z.ZodEnum<{
25072
+ high: "high";
25073
+ low: "low";
25074
+ medium: "medium";
25075
+ variable: "variable";
25076
+ }>;
25077
+ type CostProfile = z.infer<typeof CostProfileSchema>;
25078
+
25079
+ /**
25080
+ * Pipeline Stage Types — Shared interfaces for graph-backed pipelines (#1735, Phase 2)
25081
+ *
25082
+ * Defines the IPipelineStage interface that all pipeline stages implement.
25083
+ * Stages are wrapped as GraphBuilder NodeHandlers for execution.
25084
+ *
25085
+ * @module pipeline/stage-types
25086
+ */
25087
+ /** Read-only pipeline context passed to every stage. */
25088
+ interface PipelineContext {
25089
+ /** Unique pipeline execution ID. */
25090
+ readonly executionId: string;
25091
+ /** The original task/prompt that started the pipeline. */
25092
+ readonly task: string;
25093
+ /** Pipeline template being executed. */
25094
+ readonly templateId: string;
24881
25095
  /**
24882
- * Fraction of total attempts that failed due to adapter_unavailable. Rounded
24883
- * to 3 decimals. Useful for comparing infra availability across CLIs/categories.
25096
+ * Accumulated state from prior stages. The only cross-stage handoff
25097
+ * channel `sharedMemory` (the #1764 SharedMemoryStore) was removed
25098
+ * in #2937 after being write-only since introduction. If you need
25099
+ * structured cross-stage data, add a well-known key to
25100
+ * `PIPELINE_STATE_KEYS` and write/read through `state`.
24884
25101
  */
24885
- readonly adapterUnavailableRate: number;
25102
+ readonly state: Readonly<Record<string, unknown>>;
24886
25103
  }
24887
- /** Per-CLI performance stats in the weather report. */
24888
- interface CliWeather extends AdapterAttemptStats {
24889
- readonly cli: string;
24890
- readonly totalTasks: number;
24891
- readonly successRate: number;
24892
- readonly avgDurationMs: number;
24893
- readonly byCategory: ReadonlyMap<string, GroupStats>;
25104
+ /** Result of executing a single pipeline stage. */
25105
+ interface StageOutput {
25106
+ /** The key to store this stage's output under in pipeline state. */
25107
+ readonly stateKey: string;
25108
+ /** The output value (stored in GraphState). */
25109
+ readonly value: unknown;
25110
+ /** Duration in milliseconds. */
25111
+ readonly durationMs: number;
25112
+ /** Whether the stage succeeded. */
25113
+ readonly success: boolean;
25114
+ /** Error message if failed. */
25115
+ readonly error?: string | undefined;
24894
25116
  }
24895
- /** Adaptive bonus for a CLI+category pair. */
24896
- interface AdaptiveBonus {
24897
- readonly cli: string;
24898
- readonly category: TaskCategory;
24899
- readonly staticBonus: number;
24900
- readonly adaptiveBonus: number;
24901
- readonly sampleCount: number;
24902
- readonly sufficient: boolean;
25117
+ /** A pipeline stage that can be compiled into a graph node. */
25118
+ interface IPipelineStage {
25119
+ /** Unique stage identifier (used as graph node ID). */
25120
+ readonly id: string;
25121
+ /** Human-readable stage name. */
25122
+ readonly name: string;
25123
+ /** Execute the stage. */
25124
+ execute(context: PipelineContext): Promise<StageOutput>;
24903
25125
  }
24904
- /** Tier recommendation surfaced in the weather report (#895). */
24905
- interface TierRecommendationEntry {
24906
- readonly category: string;
24907
- readonly direction: 'promote' | 'demote';
24908
- readonly currentTier: number;
24909
- readonly recommendedTier: number;
24910
- readonly successRate: number;
24911
- readonly sampleCount: number;
24912
- readonly reason: string;
25126
+ /** Edge definition in a pipeline template. */
25127
+ type PipelineEdge = {
25128
+ readonly type: 'fixed';
25129
+ readonly from: string;
25130
+ readonly to: string;
25131
+ } | {
25132
+ readonly type: 'conditional';
25133
+ readonly from: string;
25134
+ readonly routerKey: string;
25135
+ readonly targets: readonly string[];
25136
+ };
25137
+ /** A declarative pipeline template defining stages and their connections. */
25138
+ interface PipelineTemplate {
25139
+ /** Unique template identifier. */
25140
+ readonly id: string;
25141
+ /** Human-readable name. */
25142
+ readonly name: string;
25143
+ /** Ordered stage IDs (for simple linear pipelines). */
25144
+ readonly stages: readonly string[];
25145
+ /** Edge overrides (for non-linear flows like vote→plan feedback loops). */
25146
+ readonly edges?: readonly PipelineEdge[] | undefined;
25147
+ /** Stage IDs that can be skipped via dryRun. */
25148
+ readonly dryRunStopAfter?: string | undefined;
24913
25149
  }
24914
- /** Learning insight for a CLI+category pair (Issue #901, Phase 4). */
24915
- interface LearningInsight {
24916
- readonly cli: string;
24917
- readonly category: TaskCategory;
24918
- readonly trend: 'improving' | 'declining' | 'stable';
24919
- readonly confidence: number;
24920
- readonly adjustedBaseline: number;
24921
- readonly sampleCount: number;
25150
+ /** Standard state keys used across pipeline templates. */
25151
+ declare const PIPELINE_STATE_KEYS: {
25152
+ readonly TASK: "task";
25153
+ readonly RESEARCH: "research";
25154
+ readonly PLAN: "plan";
25155
+ readonly VOTE_RESULT: "voteResult";
25156
+ readonly VOTE_FEEDBACK: "voteFeedback";
25157
+ readonly VOTE_ITERATIONS: "voteIterations";
25158
+ readonly TASKS: "tasks";
25159
+ readonly IMPLEMENTATIONS: "implementations";
25160
+ readonly QA_ITERATIONS: "qaIterations";
25161
+ readonly SECURITY_PASSED: "securityPassed";
25162
+ readonly FINDINGS: "findings";
25163
+ readonly PARSED_SPEC: "parsedSpec";
25164
+ readonly SCAFFOLD_OUTPUT: "scaffoldOutput";
25165
+ readonly COMPLETED: "completed";
25166
+ };
25167
+
25168
+ /**
25169
+ * Pipeline Graph Compiler — Build executable graphs from templates (#1735, Phase 2)
25170
+ *
25171
+ * Compiles a PipelineTemplate + IPipelineStage implementations into a
25172
+ * CompiledGraph that can be executed by the GraphExecutor.
25173
+ *
25174
+ * @module pipeline/pipeline-graph
25175
+ */
25176
+
25177
+ /** Result of compiling a pipeline template into a graph. */
25178
+ interface PipelineGraphResult {
25179
+ readonly ok: boolean;
25180
+ readonly graph?: CompiledGraph | undefined;
25181
+ readonly error?: string | undefined;
24922
25182
  }
24923
- /** Recommended CLI→category mapping for LinUCB cold-start (Epic #952, Phase 6). */
24924
- interface RecommendedMapping {
24925
- readonly category: TaskCategory;
24926
- readonly recommendedCli: string;
25183
+ /** Map of stage ID stage implementation. */
25184
+ type StageRegistry = ReadonlyMap<string, IPipelineStage>;
25185
+ /**
25186
+ * Compile a pipeline template + stages into an executable graph.
25187
+ *
25188
+ * Each IPipelineStage is wrapped as a GraphBuilder node handler.
25189
+ * Linear edges are auto-generated from template.stages order.
25190
+ * Custom edges override the linear flow for feedback loops.
25191
+ */
25192
+ declare function compilePipelineGraph(template: PipelineTemplate, stages: StageRegistry): PipelineGraphResult;
25193
+
25194
+ /**
25195
+ * Graph Pipeline Runner — Execute pipelines via GraphBuilder (#1735, Phase 2)
25196
+ *
25197
+ * Provides a runGraphPipeline() function that compiles a PipelineTemplate
25198
+ * + stage registry into an executable graph and runs it through the
25199
+ * graph executor with checkpoint/resume support.
25200
+ *
25201
+ * @module pipeline/graph-pipeline-runner
25202
+ */
25203
+
25204
+ /** Options for graph-based pipeline execution. */
25205
+ interface GraphPipelineOptions {
25206
+ /** When true, stop after the dryRunStopAfter stage. */
25207
+ readonly dryRun?: boolean | undefined;
25208
+ /** Maximum graph execution steps (default: 20). */
25209
+ readonly maxSteps?: number | undefined;
25210
+ }
25211
+ /** Result of a graph-based pipeline execution. */
25212
+ interface GraphPipelineResult {
25213
+ readonly success: boolean;
25214
+ readonly templateId: string;
25215
+ readonly stepsExecuted: number;
25216
+ readonly durationMs: number;
25217
+ readonly finalState: Readonly<Record<string, unknown>>;
25218
+ readonly error?: string | undefined;
25219
+ }
25220
+ /**
25221
+ * Run a pipeline using graph-based execution.
25222
+ *
25223
+ * Compiles the template + stages into a graph, then executes via
25224
+ * the graph executor (super-step BSP model).
25225
+ */
25226
+ declare function runGraphPipeline(task: string, template: PipelineTemplate, stages: StageRegistry, options?: GraphPipelineOptions): Promise<GraphPipelineResult>;
25227
+ /** Extract a value from the final pipeline state. */
25228
+ declare function extractStateValue(state: Readonly<Record<string, unknown>>, key: string): unknown;
25229
+
25230
+ /**
25231
+ * Adaptive Orchestrator — Task-driven pipeline selection (#1736, Phase 3)
25232
+ *
25233
+ * Analyzes incoming tasks, selects the appropriate pipeline template,
25234
+ * and executes via the graph pipeline runner. Single entry point
25235
+ * for all pipeline types.
25236
+ *
25237
+ * Design pattern: deterministic state machine backbone + selective
25238
+ * LLM invocation at decision nodes only (per CrewAI Flows / Temporal).
25239
+ *
25240
+ * @module pipeline/adaptive-orchestrator
25241
+ */
25242
+
25243
+ /** Options for the adaptive orchestrator. */
25244
+ interface AdaptiveOrchestratorOptions extends GraphPipelineOptions {
25245
+ /** Force a specific template (skip auto-detection). */
25246
+ readonly templateId?: string | undefined;
25247
+ /** Stage registry to use. If omitted, stages must be provided per-template. */
25248
+ readonly stages: StageRegistry;
25249
+ }
25250
+ /** Result of adaptive orchestration — extends GraphPipelineResult with metadata. */
25251
+ interface AdaptiveOrchestratorResult extends GraphPipelineResult {
25252
+ /** How the template was selected. */
25253
+ readonly selectionMethod: 'explicit' | 'auto-detected';
25254
+ /** Task classification used for selection. */
25255
+ readonly taskClassification: TaskClassification;
25256
+ }
25257
+ /** Classification of a task for template routing. */
25258
+ interface TaskClassification {
25259
+ readonly pipelineType: PipelineType;
25260
+ readonly complexity: 'simple' | 'moderate' | 'complex';
25261
+ readonly confidence: number;
25262
+ readonly keywords: readonly string[];
25263
+ }
25264
+ /** Pipeline type derived from task analysis. */
25265
+ type PipelineType = 'dev' | 'research' | 'audit' | 'greenfield' | 'general';
25266
+ /** Classify a task for pipeline routing. */
25267
+ declare function classifyTask(task: string): TaskClassification;
25268
+ /**
25269
+ * Run the adaptive orchestrator — classify task, select template, execute.
25270
+ *
25271
+ * This is the single entry point for all pipeline execution.
25272
+ */
25273
+ declare function runAdaptiveOrchestrator(task: string, options: AdaptiveOrchestratorOptions): Promise<AdaptiveOrchestratorResult>;
25274
+
25275
+ /**
25276
+ * nexus-agents/orchestration - Workflow Pattern Router
25277
+ *
25278
+ * Intelligent orchestration pattern selection based on task characteristics.
25279
+ * Uses SharedTaskAnalyzer signals + caller hints to select the optimal
25280
+ * workflow pattern (sequential, wave, graph, consensus, aflow, puppeteer).
25281
+ *
25282
+ * v1: Rule-based only (per consensus vote — no ML/RL yet).
25283
+ *
25284
+ * @module orchestration/workflow-router
25285
+ * (Source: Issue #844 — Intelligent Workflow Pattern Router)
25286
+ */
25287
+
25288
+ /**
25289
+ * Creates a workflow pattern router.
25290
+ *
25291
+ * Analyzes task characteristics and selects the optimal orchestration
25292
+ * pattern using a rule-based classification system.
25293
+ *
25294
+ * Scope of `recordOutcome` / `getMetrics` (#2824): the recorded
25295
+ * `PatternOutcome`s live in a buffer owned by this router instance.
25296
+ * `route()` is a deterministic, rule-based classifier — it does NOT
25297
+ * consume recorded outcomes, so there is no per-instance learning to
25298
+ * "lose", and nothing to aggregate across processes. The pair is an
25299
+ * observability surface only. If cross-process pattern metrics are
25300
+ * ever needed, add a dedicated consumer that writes to a shared
25301
+ * `OutcomeStore` rather than widening this router's responsibility.
25302
+ */
25303
+ declare function createWorkflowRouter(options?: {
25304
+ readonly logger?: ILogger | undefined;
25305
+ readonly analyzer?: ISharedTaskAnalyzer | undefined;
25306
+ }): IWorkflowRouter;
25307
+ /** Public interface for the workflow router. */
25308
+ interface IWorkflowRouter {
25309
+ /** Routes a task to the optimal workflow pattern. */
25310
+ route(signals: TaskSignals, options?: WorkflowRouterOptions): RoutingDecision$1;
25311
+ /**
25312
+ * Records an execution outcome into this router instance's buffer.
25313
+ * Observability only — `route()` never reads it back (#2824).
25314
+ */
25315
+ recordOutcome(outcome: PatternOutcome): void;
25316
+ /** Aggregates this instance's recorded outcomes, optionally filtered by pattern. */
25317
+ getMetrics(pattern?: WorkflowPattern): readonly PatternMetrics[];
25318
+ }
25319
+
25320
+ /**
25321
+ * nexus-agents/orchestration - MetaOrchestrator (adaptive selection tier)
25322
+ *
25323
+ * One adaptive entry point that, given a goal, SELECTS the right execution
25324
+ * strategy among the existing specialized pipelines — it routes once per task,
25325
+ * it does NOT switch patterns mid-flight and it does NOT execute anything
25326
+ * itself. This is the "routing" pattern (Anthropic, Building Effective Agents):
25327
+ * classify → dispatch to a specialized pipeline, rather than a generalist
25328
+ * mega-pipeline.
25329
+ *
25330
+ * Step 1 (#3549) is a pure, deterministic selection function. It reuses the
25331
+ * existing selection brains — `SharedTaskAnalyzer` (signals), `WorkflowRouter`
25332
+ * (execution pattern), and `classifyTask` (pipeline template) — and maps their
25333
+ * combined output to a single {@link ExecutionStrategy}. Dispatch wiring,
25334
+ * decision logging, and learned selection are later steps of epic #3548.
25335
+ *
25336
+ * @module orchestration/meta-orchestrator
25337
+ * (Source: Issue #3549 — MetaOrchestrator step 1)
25338
+ */
25339
+
25340
+ /**
25341
+ * Execution strategies the MetaOrchestrator can select. Each maps to an
25342
+ * existing entry point / engine — the MetaOrchestrator does not introduce a
25343
+ * new execution path, it chooses among the ones that already exist.
25344
+ */
25345
+ type ExecutionStrategy =
25346
+ /** Trivial single-step task → `delegate_to_model`. */
25347
+ 'single-shot'
25348
+ /** Code change with the dev gate (test/lint/typecheck) → `run_dev_pipeline`. */
25349
+ | 'dev-pipeline'
25350
+ /** Multi-stage templated work (audit/general) → `run_pipeline`. */
25351
+ | 'pipeline'
25352
+ /** DAG / conditional-edge workflow → `run_graph_workflow`. */
25353
+ | 'graph-workflow'
25354
+ /** Pattern-based multi-agent orchestration (wave/aflow/puppeteer) → `orchestrate`. */
25355
+ | 'orchestrate'
25356
+ /** Multi-perspective decision → `consensus_vote`. */
25357
+ | 'consensus'
25358
+ /** Greenfield project from a spec → `execute_spec`. */
25359
+ | 'spec'
25360
+ /** Research-heavy work → the research pipeline. */
25361
+ | 'research';
25362
+
25363
+ /**
25364
+ * nexus-agents/orchestration - Strategy manifest registry (the live 8 manifests).
25365
+ *
25366
+ * The runtime source of truth for the eight routable execution strategies. This
25367
+ * REPLACES the former hardcoded `STRATEGY_ENTRYPOINT_TOOL` map in run-tool.ts
25368
+ * (#3835): the entrypoint-tool and executor-availability lookups the run path
25369
+ * needs are now DATA, read from a validated manifest registry rather than a
25370
+ * literal map embedded in the tool layer.
25371
+ *
25372
+ * The manifests are embedded here as a typed constant (no disk I/O on the MCP
25373
+ * hot path) and validated through {@link parseStrategyManifestRegistry} AT MODULE
25374
+ * LOAD — a malformed registry fails closed at import time, exactly as the
25375
+ * disk-loaded path would. The companion `governance/strategy-manifests.yaml` is
25376
+ * the human-facing / docs source of truth (#3838) and the drift-gate target
25377
+ * (#3837); `strategy-manifest-registry.test.ts` asserts the two are equal so
25378
+ * they cannot diverge.
25379
+ *
25380
+ * Out of scope (deferred): the selection-logic refactor that routes PURELY over
25381
+ * this data — `decideStrategy` in meta-orchestrator.ts — is #3836. This module
25382
+ * only relocates the entrypoint/executor lookups off the hardcoded map.
25383
+ *
25384
+ * @module orchestration/strategy-manifest-registry
25385
+ * (Source: Issue #3833, #3835 — schema landed via #3834)
25386
+ */
25387
+
25388
+ /** One strategy's declared cost profile, for the weather_report cost section (#3856). */
25389
+ interface StrategyCostProfileEntry {
25390
+ readonly strategy: ExecutionStrategy;
25391
+ readonly entrypointTool: string;
25392
+ /** The declared coarse cost hint; undefined for any manifest not yet populated. */
25393
+ readonly costProfile: CostProfile | undefined;
25394
+ }
25395
+
25396
+ /**
25397
+ * Type definitions for the Weather Report MCP tool.
25398
+ *
25399
+ * Surfaces observed model performance as a living "weather report"
25400
+ * and computes adaptive routing bonuses from outcome data.
25401
+ *
25402
+ * @module mcp/tools/weather-report-types
25403
+ * (Source: Issue #865 — Weather report with adaptive routing)
25404
+ */
25405
+
25406
+ declare const WeatherReportInputSchema: z.ZodObject<{
25407
+ cli: z.ZodOptional<z.ZodEnum<{
25408
+ claude: "claude";
25409
+ gemini: "gemini";
25410
+ codex: "codex";
25411
+ opencode: "opencode";
25412
+ }>>;
25413
+ category: z.ZodOptional<z.ZodEnum<{
25414
+ planning: "planning";
25415
+ architecture: "architecture";
25416
+ code_generation: "code_generation";
25417
+ code_review: "code_review";
25418
+ research: "research";
25419
+ security_review: "security_review";
25420
+ documentation: "documentation";
25421
+ testing: "testing";
25422
+ devops: "devops";
25423
+ exploration: "exploration";
25424
+ }>>;
25425
+ includeAdaptive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
25426
+ }, z.core.$strip>;
25427
+ /** Options for generateWeatherReport (all fields optional). */
25428
+ interface WeatherReportOptions {
25429
+ readonly cli?: CliNameLiteral;
25430
+ readonly category?: string;
25431
+ readonly includeAdaptive?: boolean;
25432
+ }
25433
+ /** Adapter attempt stats separating infra failures from model-quality failures (#1982). */
25434
+ interface AdapterAttemptStats {
25435
+ /**
25436
+ * Success rate excluding adapter_unavailable failures. Represents model-quality
25437
+ * success when the adapter could actually attempt the task. Rounded to 3 decimals.
25438
+ */
25439
+ readonly adapterAttemptSuccessRate: number;
25440
+ /** Count of adapter_unavailable failures in the sample. */
25441
+ readonly adapterUnavailableCount: number;
25442
+ /**
25443
+ * Fraction of total attempts that failed due to adapter_unavailable. Rounded
25444
+ * to 3 decimals. Useful for comparing infra availability across CLIs/categories.
25445
+ */
25446
+ readonly adapterUnavailableRate: number;
25447
+ }
25448
+ /** Per-CLI performance stats in the weather report. */
25449
+ interface CliWeather extends AdapterAttemptStats {
25450
+ readonly cli: string;
25451
+ readonly totalTasks: number;
25452
+ readonly successRate: number;
25453
+ readonly avgDurationMs: number;
25454
+ readonly byCategory: ReadonlyMap<string, GroupStats>;
25455
+ }
25456
+ /** Adaptive bonus for a CLI+category pair. */
25457
+ interface AdaptiveBonus {
25458
+ readonly cli: string;
25459
+ readonly category: TaskCategory;
25460
+ readonly staticBonus: number;
25461
+ readonly adaptiveBonus: number;
25462
+ readonly sampleCount: number;
25463
+ readonly sufficient: boolean;
25464
+ }
25465
+ /** Tier recommendation surfaced in the weather report (#895). */
25466
+ interface TierRecommendationEntry {
25467
+ readonly category: string;
25468
+ readonly direction: 'promote' | 'demote';
25469
+ readonly currentTier: number;
25470
+ readonly recommendedTier: number;
25471
+ readonly successRate: number;
25472
+ readonly sampleCount: number;
25473
+ readonly reason: string;
25474
+ }
25475
+ /** Learning insight for a CLI+category pair (Issue #901, Phase 4). */
25476
+ interface LearningInsight {
25477
+ readonly cli: string;
25478
+ readonly category: TaskCategory;
25479
+ readonly trend: 'improving' | 'declining' | 'stable';
25480
+ readonly confidence: number;
25481
+ readonly adjustedBaseline: number;
25482
+ readonly sampleCount: number;
25483
+ }
25484
+ /** Recommended CLI→category mapping for LinUCB cold-start (Epic #952, Phase 6). */
25485
+ interface RecommendedMapping {
25486
+ readonly category: TaskCategory;
25487
+ readonly recommendedCli: string;
24927
25488
  readonly successRate: number;
24928
25489
  readonly sampleCount: number;
24929
25490
  readonly confidence: 'high' | 'medium' | 'low';
@@ -25007,6 +25568,19 @@ interface TriageStats {
25007
25568
  readonly count: number;
25008
25569
  }[];
25009
25570
  }
25571
+ /**
25572
+ * Cost section of the weather report (Epic G, #3856). Answers "what do governed
25573
+ * decisions cost?" by surfacing the MEASURED per-decision cost aggregates
25574
+ * (DecisionCostStore, #3855) windowed by gate type, alongside each strategy's
25575
+ * coarse declared `costProfile` from the manifest registry. Both ride existing
25576
+ * surfaces — no new MCP tool.
25577
+ */
25578
+ interface CostSection {
25579
+ /** Measured per-gate-type cost aggregates over the lookback window (#3855/#3856). */
25580
+ readonly decisionCosts: DecisionCostReport;
25581
+ /** Each strategy's declared coarse cost profile from the manifest registry. */
25582
+ readonly strategyCostProfiles: readonly StrategyCostProfileEntry[];
25583
+ }
25010
25584
  /** Full weather report response. */
25011
25585
  interface WeatherReportResponse {
25012
25586
  readonly overall: AdapterAttemptStats & {
@@ -25036,6 +25610,8 @@ interface WeatherReportResponse {
25036
25610
  readonly swarmHealth?: SwarmHealthMetrics;
25037
25611
  /** Worker failure triage statistics (#1506). */
25038
25612
  readonly triageStats?: TriageStats;
25613
+ /** Cost section: per-gate decision-cost aggregates + strategy cost profiles (Epic G, #3856). */
25614
+ readonly costSection?: CostSection;
25039
25615
  /** Recent performance within the lookback window (#1401). */
25040
25616
  readonly recentWindow?: {
25041
25617
  readonly windowMs: number;
@@ -25066,10 +25642,24 @@ type WeatherReportConfig = z.infer<typeof WeatherReportConfigSchema>;
25066
25642
  * (Source: Issue #865 — Weather report with adaptive routing)
25067
25643
  */
25068
25644
 
25645
+ /**
25646
+ * Optional injectable dependencies for {@link generateWeatherReport} (#3856).
25647
+ * The cost section reads persisted per-decision cost records; tests inject a
25648
+ * deterministic set via {@link WeatherReportDeps.decisionCostRecords} rather than
25649
+ * touching the durable {@link DecisionCostStore}.
25650
+ */
25651
+ interface WeatherReportDeps {
25652
+ /**
25653
+ * Pre-resolved decision-cost records to aggregate for the cost section. When
25654
+ * omitted, the records are read from the durable {@link DecisionCostStore} iff
25655
+ * persistence is enabled (no store is constructed when it is off).
25656
+ */
25657
+ readonly decisionCostRecords?: readonly DecisionCostRecord[];
25658
+ }
25069
25659
  /**
25070
25660
  * Generates the weather report from current outcome data.
25071
25661
  */
25072
- declare function generateWeatherReport(input: WeatherReportOptions, config?: Partial<WeatherReportConfig>): WeatherReportResponse;
25662
+ declare function generateWeatherReport(input: WeatherReportOptions, config?: Partial<WeatherReportConfig>, deps?: WeatherReportDeps): WeatherReportResponse;
25073
25663
 
25074
25664
  /**
25075
25665
  * nexus-agents/mcp - Registry Import MCP Tool
@@ -25676,8 +26266,28 @@ declare class AuditLogger implements IAuditLogger {
25676
26266
  private closed;
25677
26267
  private inFlightFlush;
25678
26268
  private droppedEventCount;
25679
- constructor(config: AuditLogConfig, storage?: IAuditStorage, logger?: ILogger);
26269
+ private persistFailureCount;
26270
+ private readonly onPersistFailure;
26271
+ constructor(config: AuditLogConfig, storage?: IAuditStorage, logger?: ILogger, onPersistFailure?: (error: Error) => void);
25680
26272
  private startFlushTimer;
26273
+ /**
26274
+ * Fail-loud handler for an audit-persist failure (#3916). A dropped/failed
26275
+ * audit write undermines the tamper-evident hash chain (ADR-0017 /
26276
+ * docs/security/audit-hash-chain-threat-model.md), so unlike the best-effort
26277
+ * cost path this is NOT swallowed: it logs prominently at error level,
26278
+ * increments a process-lifetime counter (exposed via
26279
+ * {@link getPersistFailureCount}), and invokes the optional `onPersistFailure`
26280
+ * hook so a governance consumer can escalate (e.g. raise/alert). Callers on the
26281
+ * awaited flush()/close() path additionally receive the thrown error directly.
26282
+ */
26283
+ private recordPersistFailure;
26284
+ /**
26285
+ * Process-lifetime count of audit flushes that FAILED to persist (#3916). A
26286
+ * non-zero value means at least one audit event was not durably written — the
26287
+ * hash chain may have a gap. Surfaced so the failure is observable rather than
26288
+ * silent.
26289
+ */
26290
+ getPersistFailureCount(): number;
25681
26291
  private shouldLog;
25682
26292
  private createEvent;
25683
26293
  log(input: AuditEventInput): void;
@@ -25685,6 +26295,22 @@ declare class AuditLogger implements IAuditLogger {
25685
26295
  logPolicyDecision(opts: PolicyDecisionAuditOpts): void;
25686
26296
  logSecurityEvent(opts: SecurityEventAuditOpts): void;
25687
26297
  logRateLimitViolation(opts: RateLimitAuditOpts): void;
26298
+ /**
26299
+ * Log an authority-tier transition (Epic D / ADR-0017, #3842). A promotion or
26300
+ * demotion of a loop's authority tier is recorded as a hash-chained
26301
+ * `governance`-category event whose `metadata.tierTransition` carries the
26302
+ * structured {@link TierTransitionPayload} ({subject, fromTier, toTier,
26303
+ * evidenceRef, ratificationVoteRef?}).
26304
+ *
26305
+ * The emitter does NOT itself enforce the ratification invariant (a promotion
26306
+ * with no `ratificationVoteRef` is still chained — tampering with the log to
26307
+ * remove the field must not erase the event). The invariant is enforced by the
26308
+ * ratification gate (`scripts/check-authority-tier-drift.ts`), which reads the
26309
+ * chained events back and FAILS a `promotion` lacking a vote ref. A promotion
26310
+ * is emitted at `warning` severity (it grants authority) so it surfaces above
26311
+ * the default info floor; a demotion is `info` (it is the safe direction).
26312
+ */
26313
+ logTierTransition(opts: TierTransitionAuditOpts): void;
25688
26314
  /** Log system startup event */
25689
26315
  logSystemStartup(metadata?: Record<string, unknown>): void;
25690
26316
  /** Log system shutdown event */
@@ -25701,248 +26327,7 @@ declare class AuditLogger implements IAuditLogger {
25701
26327
  flush(): Promise<void>;
25702
26328
  close(): Promise<void>;
25703
26329
  }
25704
- declare function createAuditLogger(config: AuditLogConfig, storage?: IAuditStorage, logger?: ILogger): AuditLogger;
25705
-
25706
- /**
25707
- * Pipeline Stage Types — Shared interfaces for graph-backed pipelines (#1735, Phase 2)
25708
- *
25709
- * Defines the IPipelineStage interface that all pipeline stages implement.
25710
- * Stages are wrapped as GraphBuilder NodeHandlers for execution.
25711
- *
25712
- * @module pipeline/stage-types
25713
- */
25714
- /** Read-only pipeline context passed to every stage. */
25715
- interface PipelineContext {
25716
- /** Unique pipeline execution ID. */
25717
- readonly executionId: string;
25718
- /** The original task/prompt that started the pipeline. */
25719
- readonly task: string;
25720
- /** Pipeline template being executed. */
25721
- readonly templateId: string;
25722
- /**
25723
- * Accumulated state from prior stages. The only cross-stage handoff
25724
- * channel — `sharedMemory` (the #1764 SharedMemoryStore) was removed
25725
- * in #2937 after being write-only since introduction. If you need
25726
- * structured cross-stage data, add a well-known key to
25727
- * `PIPELINE_STATE_KEYS` and write/read through `state`.
25728
- */
25729
- readonly state: Readonly<Record<string, unknown>>;
25730
- }
25731
- /** Result of executing a single pipeline stage. */
25732
- interface StageOutput {
25733
- /** The key to store this stage's output under in pipeline state. */
25734
- readonly stateKey: string;
25735
- /** The output value (stored in GraphState). */
25736
- readonly value: unknown;
25737
- /** Duration in milliseconds. */
25738
- readonly durationMs: number;
25739
- /** Whether the stage succeeded. */
25740
- readonly success: boolean;
25741
- /** Error message if failed. */
25742
- readonly error?: string | undefined;
25743
- }
25744
- /** A pipeline stage that can be compiled into a graph node. */
25745
- interface IPipelineStage {
25746
- /** Unique stage identifier (used as graph node ID). */
25747
- readonly id: string;
25748
- /** Human-readable stage name. */
25749
- readonly name: string;
25750
- /** Execute the stage. */
25751
- execute(context: PipelineContext): Promise<StageOutput>;
25752
- }
25753
- /** Edge definition in a pipeline template. */
25754
- type PipelineEdge = {
25755
- readonly type: 'fixed';
25756
- readonly from: string;
25757
- readonly to: string;
25758
- } | {
25759
- readonly type: 'conditional';
25760
- readonly from: string;
25761
- readonly routerKey: string;
25762
- readonly targets: readonly string[];
25763
- };
25764
- /** A declarative pipeline template defining stages and their connections. */
25765
- interface PipelineTemplate {
25766
- /** Unique template identifier. */
25767
- readonly id: string;
25768
- /** Human-readable name. */
25769
- readonly name: string;
25770
- /** Ordered stage IDs (for simple linear pipelines). */
25771
- readonly stages: readonly string[];
25772
- /** Edge overrides (for non-linear flows like vote→plan feedback loops). */
25773
- readonly edges?: readonly PipelineEdge[] | undefined;
25774
- /** Stage IDs that can be skipped via dryRun. */
25775
- readonly dryRunStopAfter?: string | undefined;
25776
- }
25777
- /** Standard state keys used across pipeline templates. */
25778
- declare const PIPELINE_STATE_KEYS: {
25779
- readonly TASK: "task";
25780
- readonly RESEARCH: "research";
25781
- readonly PLAN: "plan";
25782
- readonly VOTE_RESULT: "voteResult";
25783
- readonly VOTE_FEEDBACK: "voteFeedback";
25784
- readonly VOTE_ITERATIONS: "voteIterations";
25785
- readonly TASKS: "tasks";
25786
- readonly IMPLEMENTATIONS: "implementations";
25787
- readonly QA_ITERATIONS: "qaIterations";
25788
- readonly SECURITY_PASSED: "securityPassed";
25789
- readonly FINDINGS: "findings";
25790
- readonly PARSED_SPEC: "parsedSpec";
25791
- readonly SCAFFOLD_OUTPUT: "scaffoldOutput";
25792
- readonly COMPLETED: "completed";
25793
- };
25794
-
25795
- /**
25796
- * Pipeline Graph Compiler — Build executable graphs from templates (#1735, Phase 2)
25797
- *
25798
- * Compiles a PipelineTemplate + IPipelineStage implementations into a
25799
- * CompiledGraph that can be executed by the GraphExecutor.
25800
- *
25801
- * @module pipeline/pipeline-graph
25802
- */
25803
-
25804
- /** Result of compiling a pipeline template into a graph. */
25805
- interface PipelineGraphResult {
25806
- readonly ok: boolean;
25807
- readonly graph?: CompiledGraph | undefined;
25808
- readonly error?: string | undefined;
25809
- }
25810
- /** Map of stage ID → stage implementation. */
25811
- type StageRegistry = ReadonlyMap<string, IPipelineStage>;
25812
- /**
25813
- * Compile a pipeline template + stages into an executable graph.
25814
- *
25815
- * Each IPipelineStage is wrapped as a GraphBuilder node handler.
25816
- * Linear edges are auto-generated from template.stages order.
25817
- * Custom edges override the linear flow for feedback loops.
25818
- */
25819
- declare function compilePipelineGraph(template: PipelineTemplate, stages: StageRegistry): PipelineGraphResult;
25820
-
25821
- /**
25822
- * Graph Pipeline Runner — Execute pipelines via GraphBuilder (#1735, Phase 2)
25823
- *
25824
- * Provides a runGraphPipeline() function that compiles a PipelineTemplate
25825
- * + stage registry into an executable graph and runs it through the
25826
- * graph executor with checkpoint/resume support.
25827
- *
25828
- * @module pipeline/graph-pipeline-runner
25829
- */
25830
-
25831
- /** Options for graph-based pipeline execution. */
25832
- interface GraphPipelineOptions {
25833
- /** When true, stop after the dryRunStopAfter stage. */
25834
- readonly dryRun?: boolean | undefined;
25835
- /** Maximum graph execution steps (default: 20). */
25836
- readonly maxSteps?: number | undefined;
25837
- }
25838
- /** Result of a graph-based pipeline execution. */
25839
- interface GraphPipelineResult {
25840
- readonly success: boolean;
25841
- readonly templateId: string;
25842
- readonly stepsExecuted: number;
25843
- readonly durationMs: number;
25844
- readonly finalState: Readonly<Record<string, unknown>>;
25845
- readonly error?: string | undefined;
25846
- }
25847
- /**
25848
- * Run a pipeline using graph-based execution.
25849
- *
25850
- * Compiles the template + stages into a graph, then executes via
25851
- * the graph executor (super-step BSP model).
25852
- */
25853
- declare function runGraphPipeline(task: string, template: PipelineTemplate, stages: StageRegistry, options?: GraphPipelineOptions): Promise<GraphPipelineResult>;
25854
- /** Extract a value from the final pipeline state. */
25855
- declare function extractStateValue(state: Readonly<Record<string, unknown>>, key: string): unknown;
25856
-
25857
- /**
25858
- * Adaptive Orchestrator — Task-driven pipeline selection (#1736, Phase 3)
25859
- *
25860
- * Analyzes incoming tasks, selects the appropriate pipeline template,
25861
- * and executes via the graph pipeline runner. Single entry point
25862
- * for all pipeline types.
25863
- *
25864
- * Design pattern: deterministic state machine backbone + selective
25865
- * LLM invocation at decision nodes only (per CrewAI Flows / Temporal).
25866
- *
25867
- * @module pipeline/adaptive-orchestrator
25868
- */
25869
-
25870
- /** Options for the adaptive orchestrator. */
25871
- interface AdaptiveOrchestratorOptions extends GraphPipelineOptions {
25872
- /** Force a specific template (skip auto-detection). */
25873
- readonly templateId?: string | undefined;
25874
- /** Stage registry to use. If omitted, stages must be provided per-template. */
25875
- readonly stages: StageRegistry;
25876
- }
25877
- /** Result of adaptive orchestration — extends GraphPipelineResult with metadata. */
25878
- interface AdaptiveOrchestratorResult extends GraphPipelineResult {
25879
- /** How the template was selected. */
25880
- readonly selectionMethod: 'explicit' | 'auto-detected';
25881
- /** Task classification used for selection. */
25882
- readonly taskClassification: TaskClassification;
25883
- }
25884
- /** Classification of a task for template routing. */
25885
- interface TaskClassification {
25886
- readonly pipelineType: PipelineType;
25887
- readonly complexity: 'simple' | 'moderate' | 'complex';
25888
- readonly confidence: number;
25889
- readonly keywords: readonly string[];
25890
- }
25891
- /** Pipeline type derived from task analysis. */
25892
- type PipelineType = 'dev' | 'research' | 'audit' | 'greenfield' | 'general';
25893
- /** Classify a task for pipeline routing. */
25894
- declare function classifyTask(task: string): TaskClassification;
25895
- /**
25896
- * Run the adaptive orchestrator — classify task, select template, execute.
25897
- *
25898
- * This is the single entry point for all pipeline execution.
25899
- */
25900
- declare function runAdaptiveOrchestrator(task: string, options: AdaptiveOrchestratorOptions): Promise<AdaptiveOrchestratorResult>;
25901
-
25902
- /**
25903
- * nexus-agents/orchestration - Workflow Pattern Router
25904
- *
25905
- * Intelligent orchestration pattern selection based on task characteristics.
25906
- * Uses SharedTaskAnalyzer signals + caller hints to select the optimal
25907
- * workflow pattern (sequential, wave, graph, consensus, aflow, puppeteer).
25908
- *
25909
- * v1: Rule-based only (per consensus vote — no ML/RL yet).
25910
- *
25911
- * @module orchestration/workflow-router
25912
- * (Source: Issue #844 — Intelligent Workflow Pattern Router)
25913
- */
25914
-
25915
- /**
25916
- * Creates a workflow pattern router.
25917
- *
25918
- * Analyzes task characteristics and selects the optimal orchestration
25919
- * pattern using a rule-based classification system.
25920
- *
25921
- * Scope of `recordOutcome` / `getMetrics` (#2824): the recorded
25922
- * `PatternOutcome`s live in a buffer owned by this router instance.
25923
- * `route()` is a deterministic, rule-based classifier — it does NOT
25924
- * consume recorded outcomes, so there is no per-instance learning to
25925
- * "lose", and nothing to aggregate across processes. The pair is an
25926
- * observability surface only. If cross-process pattern metrics are
25927
- * ever needed, add a dedicated consumer that writes to a shared
25928
- * `OutcomeStore` rather than widening this router's responsibility.
25929
- */
25930
- declare function createWorkflowRouter(options?: {
25931
- readonly logger?: ILogger | undefined;
25932
- readonly analyzer?: ISharedTaskAnalyzer | undefined;
25933
- }): IWorkflowRouter;
25934
- /** Public interface for the workflow router. */
25935
- interface IWorkflowRouter {
25936
- /** Routes a task to the optimal workflow pattern. */
25937
- route(signals: TaskSignals, options?: WorkflowRouterOptions): RoutingDecision$1;
25938
- /**
25939
- * Records an execution outcome into this router instance's buffer.
25940
- * Observability only — `route()` never reads it back (#2824).
25941
- */
25942
- recordOutcome(outcome: PatternOutcome): void;
25943
- /** Aggregates this instance's recorded outcomes, optionally filtered by pattern. */
25944
- getMetrics(pattern?: WorkflowPattern): readonly PatternMetrics[];
25945
- }
26330
+ declare function createAuditLogger(config: AuditLogConfig, storage?: IAuditStorage, logger?: ILogger, onPersistFailure?: (error: Error) => void): AuditLogger;
25946
26331
 
25947
26332
  /**
25948
26333
  * PR Review Findings — typed verification gate per #2225 + #2233 Child 3
@@ -26076,6 +26461,13 @@ interface PrReviewResponse {
26076
26461
  readonly errorCount: number;
26077
26462
  readonly reviews: readonly PrReviewVote[];
26078
26463
  readonly totalDurationMs: number;
26464
+ /**
26465
+ * Per-decision cost rollup (#3855): per-voter / per-model token + USD totals
26466
+ * for this governed review. Rides the existing response — no new MCP tool.
26467
+ * Totals are a floor when `costSummary.unmeasuredVoters > 0` (voters whose
26468
+ * adapter reported no usage are counted as unmeasured, not a measured $0).
26469
+ */
26470
+ readonly costSummary?: DecisionCostSummary;
26079
26471
  }
26080
26472
  type PrReviewDeps = BaseMcpToolDeps;
26081
26473
  /** Maps a voter's approve/reject/abstain to PR review semantics. */