ex-workflow 1.2.0 → 1.4.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 (157) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +147 -13
  3. package/dist/adapters/index.cjs +1 -1
  4. package/dist/adapters/index.d.cts +1 -1
  5. package/dist/adapters/index.d.ts +1 -1
  6. package/dist/adapters/index.mjs +1 -1
  7. package/dist/{budget-Gckmqj74.d.ts → budget-BuQ9GWsg.d.ts} +1 -1
  8. package/dist/{budget-Bm839Qw0.d.cts → budget-DDqQQIgp.d.cts} +1 -1
  9. package/dist/{chunk-LIATP6LY.mjs → chunk-3QUIRAXO.mjs} +2 -2
  10. package/dist/{chunk-LIATP6LY.mjs.map → chunk-3QUIRAXO.mjs.map} +1 -1
  11. package/dist/chunk-3RJ4RNPG.cjs +2 -0
  12. package/dist/chunk-3RJ4RNPG.cjs.map +1 -0
  13. package/dist/chunk-66BO7JFR.cjs +2 -0
  14. package/dist/chunk-66BO7JFR.cjs.map +1 -0
  15. package/dist/chunk-6PFJYRM7.cjs +2 -0
  16. package/dist/chunk-6PFJYRM7.cjs.map +1 -0
  17. package/dist/chunk-76ITDJDM.cjs +2 -0
  18. package/dist/{chunk-QAENYYU6.cjs.map → chunk-76ITDJDM.cjs.map} +1 -1
  19. package/dist/chunk-AWFR3Q4M.mjs +2 -0
  20. package/dist/{chunk-32NVJV5C.mjs.map → chunk-AWFR3Q4M.mjs.map} +1 -1
  21. package/dist/chunk-BD665RYK.mjs +2 -0
  22. package/dist/chunk-BD665RYK.mjs.map +1 -0
  23. package/dist/chunk-BGKXIRGS.mjs +2 -0
  24. package/dist/chunk-BGKXIRGS.mjs.map +1 -0
  25. package/dist/chunk-BNKKOAMP.mjs +2 -0
  26. package/dist/{chunk-OZAYOPLB.mjs.map → chunk-BNKKOAMP.mjs.map} +1 -1
  27. package/dist/{chunk-IIEKK2S3.cjs → chunk-CPM2SPDX.cjs} +2 -2
  28. package/dist/{chunk-IIEKK2S3.cjs.map → chunk-CPM2SPDX.cjs.map} +1 -1
  29. package/dist/chunk-DVFTTBCT.cjs +3 -0
  30. package/dist/chunk-DVFTTBCT.cjs.map +1 -0
  31. package/dist/{chunk-U3RU5LOF.cjs → chunk-G6QELJRL.cjs} +2 -2
  32. package/dist/{chunk-U3RU5LOF.cjs.map → chunk-G6QELJRL.cjs.map} +1 -1
  33. package/dist/{chunk-6D6FL3XK.mjs → chunk-HXEJP6KF.mjs} +2 -2
  34. package/dist/{chunk-6D6FL3XK.mjs.map → chunk-HXEJP6KF.mjs.map} +1 -1
  35. package/dist/chunk-ILNSTPPV.mjs +2 -0
  36. package/dist/chunk-ILNSTPPV.mjs.map +1 -0
  37. package/dist/{chunk-RXY434DX.cjs → chunk-KA6DVHO5.cjs} +4 -4
  38. package/dist/{chunk-RXY434DX.cjs.map → chunk-KA6DVHO5.cjs.map} +1 -1
  39. package/dist/chunk-KLOSFZFK.cjs +2 -0
  40. package/dist/chunk-KLOSFZFK.cjs.map +1 -0
  41. package/dist/chunk-LQJPLXFR.cjs +2 -0
  42. package/dist/chunk-LQJPLXFR.cjs.map +1 -0
  43. package/dist/chunk-MUQ4FKVH.mjs +2 -0
  44. package/dist/chunk-MUQ4FKVH.mjs.map +1 -0
  45. package/dist/chunk-N2NANHRW.mjs +2 -0
  46. package/dist/{chunk-4HG6A3SF.mjs.map → chunk-N2NANHRW.mjs.map} +1 -1
  47. package/dist/chunk-NNQ3RHDP.mjs +2 -0
  48. package/dist/chunk-NNQ3RHDP.mjs.map +1 -0
  49. package/dist/chunk-OAJ4KV4F.mjs +2 -0
  50. package/dist/{chunk-BYPFTO7P.mjs.map → chunk-OAJ4KV4F.mjs.map} +1 -1
  51. package/dist/chunk-OFFQTZEY.cjs +2 -0
  52. package/dist/chunk-OFFQTZEY.cjs.map +1 -0
  53. package/dist/{chunk-3GKYL6VB.mjs → chunk-ONVAUZOD.mjs} +3 -3
  54. package/dist/{chunk-3GKYL6VB.mjs.map → chunk-ONVAUZOD.mjs.map} +1 -1
  55. package/dist/chunk-QJMOCISZ.mjs +3 -0
  56. package/dist/chunk-QJMOCISZ.mjs.map +1 -0
  57. package/dist/chunk-QKW26EV2.mjs +2 -0
  58. package/dist/chunk-QKW26EV2.mjs.map +1 -0
  59. package/dist/{chunk-W2P27645.cjs → chunk-RMXEQ5HN.cjs} +2 -2
  60. package/dist/{chunk-W2P27645.cjs.map → chunk-RMXEQ5HN.cjs.map} +1 -1
  61. package/dist/chunk-TBLIZIWH.cjs +2 -0
  62. package/dist/chunk-TBLIZIWH.cjs.map +1 -0
  63. package/dist/chunk-U23IRPFF.cjs +2 -0
  64. package/dist/{chunk-SFYUJQYW.cjs.map → chunk-U23IRPFF.cjs.map} +1 -1
  65. package/dist/chunk-WM3JM3H7.mjs +2 -0
  66. package/dist/chunk-WM3JM3H7.mjs.map +1 -0
  67. package/dist/chunk-WU5JELOM.mjs +2 -0
  68. package/dist/chunk-WU5JELOM.mjs.map +1 -0
  69. package/dist/chunk-YNYIHJOC.mjs +2 -0
  70. package/dist/chunk-YNYIHJOC.mjs.map +1 -0
  71. package/dist/chunk-YRXFEM3F.cjs +2 -0
  72. package/dist/chunk-YRXFEM3F.cjs.map +1 -0
  73. package/dist/{chunk-K4VSMIJZ.cjs → chunk-ZDT2BZGU.cjs} +2 -2
  74. package/dist/{chunk-K4VSMIJZ.cjs.map → chunk-ZDT2BZGU.cjs.map} +1 -1
  75. package/dist/{chunk-OVR5CK3R.cjs → chunk-ZK3V66NC.cjs} +2 -2
  76. package/dist/{chunk-OVR5CK3R.cjs.map → chunk-ZK3V66NC.cjs.map} +1 -1
  77. package/dist/cli/bin.cjs +1 -1
  78. package/dist/cli/bin.cjs.map +1 -1
  79. package/dist/cli/bin.mjs +1 -1
  80. package/dist/cli/bin.mjs.map +1 -1
  81. package/dist/cli/index.cjs +1 -1
  82. package/dist/cli/index.mjs +1 -1
  83. package/dist/experimentation/index.cjs +1 -1
  84. package/dist/experimentation/index.d.cts +2 -2
  85. package/dist/experimentation/index.d.ts +2 -2
  86. package/dist/experimentation/index.mjs +1 -1
  87. package/dist/index.cjs +1 -1
  88. package/dist/index.cjs.map +1 -1
  89. package/dist/index.d.cts +15 -12
  90. package/dist/index.d.ts +15 -12
  91. package/dist/index.mjs +1 -1
  92. package/dist/index.mjs.map +1 -1
  93. package/dist/investigation/index.cjs +1 -1
  94. package/dist/investigation/index.d.cts +2 -2
  95. package/dist/investigation/index.d.ts +2 -2
  96. package/dist/investigation/index.mjs +1 -1
  97. package/dist/kanban/index.cjs +1 -1
  98. package/dist/kanban/index.d.cts +1 -1
  99. package/dist/kanban/index.d.ts +1 -1
  100. package/dist/kanban/index.mjs +1 -1
  101. package/dist/policies/index.cjs +2 -0
  102. package/dist/policies/index.cjs.map +1 -0
  103. package/dist/policies/index.d.cts +202 -0
  104. package/dist/policies/index.d.ts +202 -0
  105. package/dist/policies/index.mjs +2 -0
  106. package/dist/policies/index.mjs.map +1 -0
  107. package/dist/registry/index.cjs +1 -1
  108. package/dist/registry/index.d.cts +1 -1
  109. package/dist/registry/index.d.ts +1 -1
  110. package/dist/registry/index.mjs +1 -1
  111. package/dist/schema/index.cjs +1 -1
  112. package/dist/schema/index.mjs +1 -1
  113. package/dist/scrum/index.cjs +1 -1
  114. package/dist/scrum/index.d.cts +3 -3
  115. package/dist/scrum/index.d.ts +3 -3
  116. package/dist/scrum/index.mjs +1 -1
  117. package/dist/{types-DjePDfms.d.cts → types-DLOtndDY.d.cts} +61 -1
  118. package/dist/{types-DjePDfms.d.ts → types-DLOtndDY.d.ts} +61 -1
  119. package/dist/types.d.cts +1 -1
  120. package/dist/types.d.ts +1 -1
  121. package/dist/waterfall/index.cjs +1 -1
  122. package/dist/waterfall/index.d.cts +1 -1
  123. package/dist/waterfall/index.d.ts +1 -1
  124. package/dist/waterfall/index.mjs +1 -1
  125. package/package.json +14 -1
  126. package/dist/chunk-32NVJV5C.mjs +0 -2
  127. package/dist/chunk-3O5MPAJT.cjs +0 -2
  128. package/dist/chunk-3O5MPAJT.cjs.map +0 -1
  129. package/dist/chunk-43GLYYA2.cjs +0 -3
  130. package/dist/chunk-43GLYYA2.cjs.map +0 -1
  131. package/dist/chunk-4HG6A3SF.mjs +0 -2
  132. package/dist/chunk-7EF47R2J.mjs +0 -2
  133. package/dist/chunk-7EF47R2J.mjs.map +0 -1
  134. package/dist/chunk-BD76VFI4.mjs +0 -3
  135. package/dist/chunk-BD76VFI4.mjs.map +0 -1
  136. package/dist/chunk-BHAEPYRJ.cjs +0 -2
  137. package/dist/chunk-BHAEPYRJ.cjs.map +0 -1
  138. package/dist/chunk-BYPFTO7P.mjs +0 -2
  139. package/dist/chunk-FDZB73PH.mjs +0 -2
  140. package/dist/chunk-FDZB73PH.mjs.map +0 -1
  141. package/dist/chunk-JNLWI4JM.mjs +0 -2
  142. package/dist/chunk-JNLWI4JM.mjs.map +0 -1
  143. package/dist/chunk-LCN4UNYK.cjs +0 -2
  144. package/dist/chunk-LCN4UNYK.cjs.map +0 -1
  145. package/dist/chunk-MB465DI4.mjs +0 -2
  146. package/dist/chunk-MB465DI4.mjs.map +0 -1
  147. package/dist/chunk-OZAYOPLB.mjs +0 -2
  148. package/dist/chunk-QAENYYU6.cjs +0 -2
  149. package/dist/chunk-SFYUJQYW.cjs +0 -2
  150. package/dist/chunk-UUWDQVIJ.mjs +0 -2
  151. package/dist/chunk-UUWDQVIJ.mjs.map +0 -1
  152. package/dist/chunk-VXOZIP77.cjs +0 -2
  153. package/dist/chunk-VXOZIP77.cjs.map +0 -1
  154. package/dist/chunk-WPVL27G4.mjs +0 -2
  155. package/dist/chunk-WPVL27G4.mjs.map +0 -1
  156. package/dist/chunk-Z43GUETW.cjs +0 -2
  157. package/dist/chunk-Z43GUETW.cjs.map +0 -1
@@ -1,5 +1,5 @@
1
- import { f as Ceremony, a as Budget, W as WorkflowState, R as Role, g as Rule, S as Stage, M as Methodology } from '../types-DjePDfms.js';
2
- export { h as ExperimentCandidate, i as ExperimentationState } from '../types-DjePDfms.js';
1
+ import { f as Ceremony, a as Budget, W as WorkflowState, R as Role, g as Rule, S as Stage, M as Methodology } from '../types-DLOtndDY.js';
2
+ export { h as ExperimentCandidate, i as ExperimentationState } from '../types-DLOtndDY.js';
3
3
 
4
4
  declare function experimentationCeremonies(): Record<string, Ceremony>;
5
5
 
@@ -1,2 +1,2 @@
1
- export{h as experimentation,b as experimentationCeremonies,c as experimentationMetrics,d as experimentationReport,e as experimentationRoles,f as experimentationRules,g as experimentationStages,a as validateExperimentationConfig}from'../chunk-OZAYOPLB.mjs';import'../chunk-FDZB73PH.mjs';import'../chunk-TQR3VFZU.mjs';import'../chunk-UUWDQVIJ.mjs';import'../chunk-YS6CXERQ.mjs';//# sourceMappingURL=index.mjs.map
1
+ export{h as experimentation,b as experimentationCeremonies,c as experimentationMetrics,d as experimentationReport,e as experimentationRoles,f as experimentationRules,g as experimentationStages,a as validateExperimentationConfig}from'../chunk-BNKKOAMP.mjs';import'../chunk-BD665RYK.mjs';import'../chunk-WU5JELOM.mjs';import'../chunk-TQR3VFZU.mjs';import'../chunk-NNQ3RHDP.mjs';import'../chunk-YS6CXERQ.mjs';//# sourceMappingURL=index.mjs.map
2
2
  //# sourceMappingURL=index.mjs.map
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkLCN4UNYK_cjs=require('./chunk-LCN4UNYK.cjs');require('./chunk-PNWRA4JU.cjs');var chunkOVR5CK3R_cjs=require('./chunk-OVR5CK3R.cjs'),chunkBHAEPYRJ_cjs=require('./chunk-BHAEPYRJ.cjs'),chunkBBI7AKJK_cjs=require('./chunk-BBI7AKJK.cjs'),chunkZ43GUETW_cjs=require('./chunk-Z43GUETW.cjs'),chunkOSHBJIYD_cjs=require('./chunk-OSHBJIYD.cjs');var ae="1.2.0";Object.defineProperty(exports,"complete",{enumerable:true,get:function(){return chunkLCN4UNYK_cjs.f}});Object.defineProperty(exports,"correctAccounting",{enumerable:true,get:function(){return chunkLCN4UNYK_cjs.g}});Object.defineProperty(exports,"next",{enumerable:true,get:function(){return chunkLCN4UNYK_cjs.e}});Object.defineProperty(exports,"openQuestions",{enumerable:true,get:function(){return chunkLCN4UNYK_cjs.d}});Object.defineProperty(exports,"registerRole",{enumerable:true,get:function(){return chunkLCN4UNYK_cjs.a}});Object.defineProperty(exports,"retireRole",{enumerable:true,get:function(){return chunkLCN4UNYK_cjs.b}});Object.defineProperty(exports,"synthesizeBrief",{enumerable:true,get:function(){return chunkLCN4UNYK_cjs.c}});Object.defineProperty(exports,"applyAgreement",{enumerable:true,get:function(){return chunkOVR5CK3R_cjs.a}});Object.defineProperty(exports,"retireAgreement",{enumerable:true,get:function(){return chunkOVR5CK3R_cjs.b}});Object.defineProperty(exports,"frozenChanges",{enumerable:true,get:function(){return chunkBHAEPYRJ_cjs.b}});Object.defineProperty(exports,"independenceConflicts",{enumerable:true,get:function(){return chunkBHAEPYRJ_cjs.a}});Object.defineProperty(exports,"readExt",{enumerable:true,get:function(){return chunkBBI7AKJK_cjs.a}});Object.defineProperty(exports,"writeExt",{enumerable:true,get:function(){return chunkBBI7AKJK_cjs.b}});Object.defineProperty(exports,"ZERO_SPENT",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.I}});Object.defineProperty(exports,"addEvidence",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.y}});Object.defineProperty(exports,"addItem",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.s}});Object.defineProperty(exports,"addSpent",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.J}});Object.defineProperty(exports,"appendEvent",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.c}});Object.defineProperty(exports,"applyAction",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.U}});Object.defineProperty(exports,"approversFor",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.i}});Object.defineProperty(exports,"assertPolicies",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.C}});Object.defineProperty(exports,"assignRole",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.O}});Object.defineProperty(exports,"authorOf",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.E}});Object.defineProperty(exports,"canDo",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.l}});Object.defineProperty(exports,"changeConfig",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.W}});Object.defineProperty(exports,"checkGate",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.F}});Object.defineProperty(exports,"clearBlocker",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.A}});Object.defineProperty(exports,"coreRulesFor",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.S}});Object.defineProperty(exports,"createState",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.b}});Object.defineProperty(exports,"decide",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.H}});Object.defineProperty(exports,"editItem",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.t}});Object.defineProperty(exports,"estimateTokens",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.M}});Object.defineProperty(exports,"evaluatePolicies",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.B}});Object.defineProperty(exports,"getItem",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.r}});Object.defineProperty(exports,"hasCapability",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.f}});Object.defineProperty(exports,"init",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.V}});Object.defineProperty(exports,"isExhausted",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.L}});Object.defineProperty(exports,"isTerminalStage",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.p}});Object.defineProperty(exports,"lastDispatchBefore",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.D}});Object.defineProperty(exports,"lastEvent",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.d}});Object.defineProperty(exports,"moveItem",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.u}});Object.defineProperty(exports,"nextStageOf",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.o}});Object.defineProperty(exports,"nowOf",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.a}});Object.defineProperty(exports,"openIteration",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.N}});Object.defineProperty(exports,"plan",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.R}});Object.defineProperty(exports,"raiseBlocker",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.z}});Object.defineProperty(exports,"raisePending",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.G}});Object.defineProperty(exports,"remaining",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.K}});Object.defineProperty(exports,"requireCap",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.m}});Object.defineProperty(exports,"requireCapabilities",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.j}});Object.defineProperty(exports,"resourceCapsFor",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.P}});Object.defineProperty(exports,"rolesWith",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.g}});Object.defineProperty(exports,"separationLost",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.k}});Object.defineProperty(exports,"stageOf",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.n}});Object.defineProperty(exports,"toExNodes",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.Q}});Object.defineProperty(exports,"validateAction",{enumerable:true,get:function(){return chunkZ43GUETW_cjs.T}});Object.defineProperty(exports,"WorkflowError",{enumerable:true,get:function(){return chunkOSHBJIYD_cjs.a}});Object.defineProperty(exports,"assertId",{enumerable:true,get:function(){return chunkOSHBJIYD_cjs.c}});Object.defineProperty(exports,"fail",{enumerable:true,get:function(){return chunkOSHBJIYD_cjs.b}});exports.VERSION=ae;//# sourceMappingURL=index.cjs.map
1
+ 'use strict';var chunkLQJPLXFR_cjs=require('./chunk-LQJPLXFR.cjs');require('./chunk-PNWRA4JU.cjs');var chunkYRXFEM3F_cjs=require('./chunk-YRXFEM3F.cjs'),chunkZK3V66NC_cjs=require('./chunk-ZK3V66NC.cjs'),chunkKLOSFZFK_cjs=require('./chunk-KLOSFZFK.cjs'),chunk6PFJYRM7_cjs=require('./chunk-6PFJYRM7.cjs'),chunkBBI7AKJK_cjs=require('./chunk-BBI7AKJK.cjs'),chunkTBLIZIWH_cjs=require('./chunk-TBLIZIWH.cjs'),chunkOSHBJIYD_cjs=require('./chunk-OSHBJIYD.cjs');var ae="1.4.0";Object.defineProperty(exports,"complete",{enumerable:true,get:function(){return chunkLQJPLXFR_cjs.f}});Object.defineProperty(exports,"correctAccounting",{enumerable:true,get:function(){return chunkLQJPLXFR_cjs.g}});Object.defineProperty(exports,"next",{enumerable:true,get:function(){return chunkLQJPLXFR_cjs.e}});Object.defineProperty(exports,"openQuestions",{enumerable:true,get:function(){return chunkLQJPLXFR_cjs.d}});Object.defineProperty(exports,"registerRole",{enumerable:true,get:function(){return chunkLQJPLXFR_cjs.a}});Object.defineProperty(exports,"retireRole",{enumerable:true,get:function(){return chunkLQJPLXFR_cjs.b}});Object.defineProperty(exports,"synthesizeBrief",{enumerable:true,get:function(){return chunkLQJPLXFR_cjs.c}});Object.defineProperty(exports,"checkGate",{enumerable:true,get:function(){return chunkYRXFEM3F_cjs.d}});Object.defineProperty(exports,"clearBlocker",{enumerable:true,get:function(){return chunkYRXFEM3F_cjs.b}});Object.defineProperty(exports,"decide",{enumerable:true,get:function(){return chunkYRXFEM3F_cjs.f}});Object.defineProperty(exports,"raiseBlocker",{enumerable:true,get:function(){return chunkYRXFEM3F_cjs.a}});Object.defineProperty(exports,"raisePending",{enumerable:true,get:function(){return chunkYRXFEM3F_cjs.e}});Object.defineProperty(exports,"applyAgreement",{enumerable:true,get:function(){return chunkZK3V66NC_cjs.a}});Object.defineProperty(exports,"retireAgreement",{enumerable:true,get:function(){return chunkZK3V66NC_cjs.b}});Object.defineProperty(exports,"frozenChanges",{enumerable:true,get:function(){return chunkKLOSFZFK_cjs.a}});Object.defineProperty(exports,"independenceConflicts",{enumerable:true,get:function(){return chunk6PFJYRM7_cjs.a}});Object.defineProperty(exports,"readExt",{enumerable:true,get:function(){return chunkBBI7AKJK_cjs.a}});Object.defineProperty(exports,"writeExt",{enumerable:true,get:function(){return chunkBBI7AKJK_cjs.b}});Object.defineProperty(exports,"ZERO_SPENT",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.J}});Object.defineProperty(exports,"addEvidence",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.A}});Object.defineProperty(exports,"addItem",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.t}});Object.defineProperty(exports,"addSpent",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.K}});Object.defineProperty(exports,"appendEvent",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.c}});Object.defineProperty(exports,"applyAction",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.V}});Object.defineProperty(exports,"approversFor",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.i}});Object.defineProperty(exports,"assertPolicies",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.C}});Object.defineProperty(exports,"assignRole",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.P}});Object.defineProperty(exports,"authorOf",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.H}});Object.defineProperty(exports,"canDo",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.l}});Object.defineProperty(exports,"changeConfig",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.X}});Object.defineProperty(exports,"coreRulesFor",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.T}});Object.defineProperty(exports,"createState",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.b}});Object.defineProperty(exports,"editItem",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.u}});Object.defineProperty(exports,"estimateTokens",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.N}});Object.defineProperty(exports,"evaluatePolicies",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.B}});Object.defineProperty(exports,"getItem",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.s}});Object.defineProperty(exports,"hasCapability",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.f}});Object.defineProperty(exports,"init",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.W}});Object.defineProperty(exports,"isExhausted",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.M}});Object.defineProperty(exports,"isTerminalStage",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.p}});Object.defineProperty(exports,"lastDispatchBefore",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.G}});Object.defineProperty(exports,"lastEvent",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.d}});Object.defineProperty(exports,"moveItem",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.v}});Object.defineProperty(exports,"nextStageOf",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.o}});Object.defineProperty(exports,"nowOf",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.a}});Object.defineProperty(exports,"openIteration",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.O}});Object.defineProperty(exports,"plan",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.S}});Object.defineProperty(exports,"remaining",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.L}});Object.defineProperty(exports,"requireCap",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.m}});Object.defineProperty(exports,"requireCapabilities",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.j}});Object.defineProperty(exports,"resourceCapsFor",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.Q}});Object.defineProperty(exports,"rolesWith",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.g}});Object.defineProperty(exports,"separationLost",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.k}});Object.defineProperty(exports,"stageOf",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.n}});Object.defineProperty(exports,"toExNodes",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.R}});Object.defineProperty(exports,"validateAction",{enumerable:true,get:function(){return chunkTBLIZIWH_cjs.U}});Object.defineProperty(exports,"WorkflowError",{enumerable:true,get:function(){return chunkOSHBJIYD_cjs.a}});Object.defineProperty(exports,"assertId",{enumerable:true,get:function(){return chunkOSHBJIYD_cjs.c}});Object.defineProperty(exports,"fail",{enumerable:true,get:function(){return chunkOSHBJIYD_cjs.b}});exports.VERSION=ae;//# sourceMappingURL=index.cjs.map
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":["VERSION"],"mappings":"iWAAO,IAAMA,EAAAA,CAAU","file":"index.cjs","sourcesContent":["export const VERSION = \"1.2.0\";\nexport * from \"./core/types.ts\";\nexport { WorkflowError, fail } from \"./core/errors.ts\";\nexport { createState, appendEvent, lastEvent, nowOf } from \"./core/state.ts\";\nexport { registerRole, retireRole } from \"./core/roles/registry.ts\";\nexport { hasCapability, rolesWith, approversFor } from \"./core/roles/lookup.ts\";\nexport { requireCapabilities, separationLost, canDo, requireCap } from \"./core/roles/guards.ts\";\nexport { assertId } from \"./core/errors.ts\";\nexport { stageOf, nextStageOf, isTerminalStage } from \"./core/items/stage.ts\";\nexport { getItem, addItem, editItem } from \"./core/items/record.ts\";\nexport { moveItem } from \"./core/items/move.ts\";\nexport { addEvidence } from \"./core/items/evidence.ts\";\nexport { raiseBlocker, clearBlocker } from \"./core/items/blockers.ts\";\nexport type { ItemPatch } from \"./core/types.ts\";\nexport { applyAgreement, retireAgreement } from \"./core/agreements.ts\";\nexport { evaluatePolicies, assertPolicies } from \"./core/policies.ts\";\nexport { checkGate, authorOf, lastDispatchBefore, raisePending, decide } from \"./core/gates.ts\";\nexport type { GateResult } from \"./core/gates.ts\";\nexport { ZERO_SPENT, addSpent, remaining, isExhausted, estimateTokens } from \"./core/budget.ts\";\nexport type { EstimateMode } from \"./core/budget.ts\";\nexport { plan, toExNodes, assignRole, resourceCapsFor, openIteration } from \"./core/planner.ts\";\nexport type { PlanOptions, PlanReason, PlanResult, Skipped } from \"./core/planner.ts\";\nexport { synthesizeBrief, next, openQuestions } from \"./core/brief.ts\";\nexport type { NextResult } from \"./core/brief.ts\";\nexport { complete } from \"./core/complete.ts\";\nexport { correctAccounting } from \"./core/accounting.ts\";\nexport type { AccountingPatch } from \"./core/accounting.ts\";\nexport { coreRulesFor } from \"./core/rules.ts\";\nexport { applyAction, validateAction, init, changeConfig } from \"./core/methodology.ts\";\nexport type { InitInput } from \"./core/methodology.ts\";\nexport { readExt, writeExt } from \"./interface/ext.ts\";\nexport type { LegacyExtRecords } from \"./interface/ext.ts\";\nexport { independenceConflicts } from \"./common/independence.ts\";\nexport { frozenChanges } from \"./common/frozen.ts\";\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":["VERSION"],"mappings":"qcAAO,IAAMA,EAAAA,CAAU","file":"index.cjs","sourcesContent":["export const VERSION = \"1.4.0\";\nexport * from \"./core/types.ts\";\nexport { WorkflowError, fail } from \"./core/errors.ts\";\nexport { createState, appendEvent, lastEvent, nowOf } from \"./core/state.ts\";\nexport { registerRole, retireRole } from \"./core/roles/registry.ts\";\nexport { hasCapability, rolesWith, approversFor } from \"./core/roles/lookup.ts\";\nexport { requireCapabilities, separationLost, canDo, requireCap } from \"./core/roles/guards.ts\";\nexport { assertId } from \"./core/errors.ts\";\nexport { stageOf, nextStageOf, isTerminalStage } from \"./core/items/stage.ts\";\nexport { getItem, addItem, editItem } from \"./core/items/record.ts\";\nexport { moveItem } from \"./core/items/move.ts\";\nexport { addEvidence } from \"./core/items/evidence.ts\";\nexport { raiseBlocker, clearBlocker } from \"./core/items/blockers.ts\";\nexport type { ItemPatch } from \"./core/types.ts\";\nexport { applyAgreement, retireAgreement } from \"./core/agreements.ts\";\nexport { evaluatePolicies, assertPolicies } from \"./core/policies.ts\";\nexport { checkGate, raisePending, decide } from \"./core/gates.ts\";\nexport { authorOf, lastDispatchBefore } from \"./core/authors.ts\";\nexport type { GateResult } from \"./core/gates.ts\";\nexport { ZERO_SPENT, addSpent, remaining, isExhausted, estimateTokens } from \"./core/budget.ts\";\nexport type { EstimateMode } from \"./core/budget.ts\";\nexport { plan, toExNodes, assignRole, resourceCapsFor, openIteration } from \"./core/planner.ts\";\nexport type { PlanOptions, PlanReason, PlanResult, Skipped } from \"./core/planner.ts\";\nexport { synthesizeBrief, next, openQuestions } from \"./core/brief.ts\";\nexport type { NextResult } from \"./core/brief.ts\";\nexport { complete } from \"./core/complete.ts\";\nexport { correctAccounting } from \"./core/accounting.ts\";\nexport type { AccountingPatch } from \"./core/accounting.ts\";\nexport { coreRulesFor } from \"./core/rules.ts\";\nexport { applyAction, validateAction, init, changeConfig } from \"./core/methodology.ts\";\nexport type { InitInput } from \"./core/methodology.ts\";\nexport { readExt, writeExt } from \"./interface/ext.ts\";\nexport type { LegacyExtRecords } from \"./interface/ext.ts\";\nexport { independenceConflicts } from \"./common/independence.ts\";\nexport { frozenChanges } from \"./common/frozen.ts\";\n"]}
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { s as ErrorCode, W as WorkflowState, t as MethodologyName, S as Stage, R as Role, o as Event, C as Capability, N as NewItem, u as ItemPatch, l as WorkItem, j as ItemStatus, v as Evidence, P as Policy, V as Violation, G as Gate, M as Methodology, T as Transition, r as PendingHuman, w as Iteration, B as Brief, H as Handoff, A as Accounting, x as ApplyResult, g as Rule, y as Action, e as InvestigationState, i as ExperimentationState } from './types-DjePDfms.cjs';
2
- export { z as Baseline, D as Blocker, a as Budget, f as Ceremony, n as CeremonyInput, m as ClassOfService, k as CoreTerm, p as GateRequirement, F as ImpactAnalysis, J as ItemType, L as Lesson, K as LessonChange, Q as ModelTier, q as Phase, U as PlannerOptions, X as Produced, Y as Spent, Z as Verdict, _ as WorkflowExt } from './types-DjePDfms.cjs';
3
- export { E as EstimateMode, Z as ZERO_SPENT, a as addSpent, c as canDo, e as estimateTokens, i as isExhausted, r as remaining, b as requireCap, d as requireCapabilities, s as separationLost } from './budget-Bm839Qw0.cjs';
1
+ import { w as ErrorCode, W as WorkflowState, x as MethodologyName, S as Stage, R as Role, t as Event, C as Capability, N as NewItem, y as ItemPatch, l as WorkItem, j as ItemStatus, z as Evidence, P as Policy, M as Methodology, V as Violation, m as Gate, v as PendingHuman, T as Transition, D as Iteration, B as Brief, H as Handoff, A as Accounting, o as ApplyResult, g as Rule, F as Action, e as InvestigationState, i as ExperimentationState } from './types-DLOtndDY.cjs';
2
+ export { J as Baseline, K as Blocker, q as BriefContext, a as Budget, f as Ceremony, s as CeremonyInput, r as ClassOfService, p as ContextAssumption, L as ContextSnapshotData, k as CoreTerm, n as GateEscalation, G as GateRequirement, Q as ImpactAnalysis, U as ItemType, X as Lesson, Y as LessonChange, Z as ModelTier, u as Phase, _ as PlannerOptions, $ as Produced, a0 as Spent, a1 as Verdict, a2 as WorkflowExt } from './types-DLOtndDY.cjs';
3
+ export { E as EstimateMode, Z as ZERO_SPENT, a as addSpent, c as canDo, e as estimateTokens, i as isExhausted, r as remaining, b as requireCap, d as requireCapabilities, s as separationLost } from './budget-DDqQQIgp.cjs';
4
4
  import { ExNode } from 'ex-flow';
5
5
 
6
6
  interface WorkflowErrorExtra {
@@ -99,9 +99,11 @@ declare function applyAgreement(state: WorkflowState, change: {
99
99
  declare function retireAgreement<N extends string>(state: WorkflowState<N>, text: string, by: string, now: string): WorkflowState<N>;
100
100
  declare function retireAgreement(state: WorkflowState, text: string, by: string, now: string): WorkflowState;
101
101
 
102
- declare function evaluatePolicies(state: WorkflowState<string>, item: WorkItem, policies: Policy[]): Violation[];
102
+ /** The part of a methodology policy evaluation reads: its `customPolicy` hook (spec 27, #36). */
103
+ type PolicyHook<N extends string> = Pick<Methodology<unknown, N>, "customPolicy">;
104
+ declare function evaluatePolicies<N extends string>(state: WorkflowState<N>, item: WorkItem, policies: Policy[], methodology?: PolicyHook<N>): Violation[];
103
105
  declare function evaluatePolicies(state: WorkflowState, item: WorkItem, policies: Policy[]): Violation[];
104
- declare function assertPolicies(state: WorkflowState<string>, item: WorkItem, policies: Policy[], context: string): void;
106
+ declare function assertPolicies<N extends string>(state: WorkflowState<N>, item: WorkItem, policies: Policy[], context: string, methodology?: PolicyHook<N>): void;
105
107
  declare function assertPolicies(state: WorkflowState, item: WorkItem, policies: Policy[], context: string): void;
106
108
 
107
109
  type GateResult = {
@@ -112,12 +114,6 @@ type GateResult = {
112
114
  outcome: "fail";
113
115
  violations: Violation[];
114
116
  };
115
- /** Last in_progress dispatch made from a stage that comes STRICTLY BEFORE the item's current stage in `state.stages` order (unknown stage ids count as not-before). */
116
- declare function lastDispatchBefore(state: WorkflowState<string>, item: WorkItem): Transition | undefined;
117
- declare function lastDispatchBefore(state: WorkflowState, item: WorkItem): Transition | undefined;
118
- /** Role that did the work the gate guards: the last dispatch made from a stage strictly before the current one (so a reviewer dispatched into the gated stage is not its author); else the last dispatch of any stage; undefined if never dispatched. */
119
- declare function authorOf(state: WorkflowState<string>, item: WorkItem): string | undefined;
120
- declare function authorOf(state: WorkflowState, item: WorkItem): string | undefined;
121
117
  declare function checkGate(state: WorkflowState<string>, item: WorkItem, gate: Gate, by: string): GateResult;
122
118
  declare function checkGate(state: WorkflowState, item: WorkItem, gate: Gate, by: string): GateResult;
123
119
  declare function raisePending<N extends string>(state: WorkflowState<N>, pending: Omit<PendingHuman, "id" | "raisedAt">, now?: string): WorkflowState<N>;
@@ -125,6 +121,13 @@ declare function raisePending(state: WorkflowState, pending: Omit<PendingHuman,
125
121
  declare function decide<N extends string>(state: WorkflowState<N>, pendingId: string, decision: "approve" | "reject", by: string, note: string, now?: string, methodology?: Methodology<unknown, N>): WorkflowState<N>;
126
122
  declare function decide(state: WorkflowState, pendingId: string, decision: "approve" | "reject", by: string, note: string, now?: string, methodology?: Methodology): WorkflowState;
127
123
 
124
+ /** Last in_progress dispatch made from a stage that comes STRICTLY BEFORE the item's current stage in `state.stages` order (unknown stage ids count as not-before). */
125
+ declare function lastDispatchBefore(state: WorkflowState<string>, item: WorkItem): Transition | undefined;
126
+ declare function lastDispatchBefore(state: WorkflowState, item: WorkItem): Transition | undefined;
127
+ /** Role that did the work the gate guards: the last dispatch made from a stage strictly before the current one (so a reviewer dispatched into the gated stage is not its author); else the last dispatch of any stage; undefined if never dispatched. */
128
+ declare function authorOf(state: WorkflowState<string>, item: WorkItem): string | undefined;
129
+ declare function authorOf(state: WorkflowState, item: WorkItem): string | undefined;
130
+
128
131
  type NodeData = {
129
132
  id: string;
130
133
  };
@@ -280,6 +283,6 @@ declare function frozenChanges<K extends string>(frozen: {
280
283
  readonly [P in K]?: unknown;
281
284
  }, supplied: object | undefined, keys?: readonly K[]): K[];
282
285
 
283
- declare const VERSION = "1.2.0";
286
+ declare const VERSION = "1.4.0";
284
287
 
285
288
  export { Accounting, type AccountingPatch, Action, ApplyResult, Brief, Capability, ErrorCode, Event, Evidence, Gate, type GateResult, Handoff, type InitInput, ItemPatch, ItemStatus, Iteration, type LegacyExtRecords, Methodology, MethodologyName, NewItem, type NextResult, PendingHuman, type PlanOptions, type PlanReason, type PlanResult, Policy, Role, Rule, type Skipped, Stage, Transition, VERSION, Violation, WorkItem, WorkflowError, WorkflowState, addEvidence, addItem, appendEvent, applyAction, applyAgreement, approversFor, assertId, assertPolicies, assignRole, authorOf, changeConfig, checkGate, clearBlocker, complete, coreRulesFor, correctAccounting, createState, decide, editItem, evaluatePolicies, fail, frozenChanges, getItem, hasCapability, independenceConflicts, init, isTerminalStage, lastDispatchBefore, lastEvent, moveItem, next, nextStageOf, nowOf, openIteration, openQuestions, plan, raiseBlocker, raisePending, readExt, registerRole, resourceCapsFor, retireAgreement, retireRole, rolesWith, stageOf, synthesizeBrief, toExNodes, validateAction, writeExt };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { s as ErrorCode, W as WorkflowState, t as MethodologyName, S as Stage, R as Role, o as Event, C as Capability, N as NewItem, u as ItemPatch, l as WorkItem, j as ItemStatus, v as Evidence, P as Policy, V as Violation, G as Gate, M as Methodology, T as Transition, r as PendingHuman, w as Iteration, B as Brief, H as Handoff, A as Accounting, x as ApplyResult, g as Rule, y as Action, e as InvestigationState, i as ExperimentationState } from './types-DjePDfms.js';
2
- export { z as Baseline, D as Blocker, a as Budget, f as Ceremony, n as CeremonyInput, m as ClassOfService, k as CoreTerm, p as GateRequirement, F as ImpactAnalysis, J as ItemType, L as Lesson, K as LessonChange, Q as ModelTier, q as Phase, U as PlannerOptions, X as Produced, Y as Spent, Z as Verdict, _ as WorkflowExt } from './types-DjePDfms.js';
3
- export { E as EstimateMode, Z as ZERO_SPENT, a as addSpent, c as canDo, e as estimateTokens, i as isExhausted, r as remaining, b as requireCap, d as requireCapabilities, s as separationLost } from './budget-Gckmqj74.js';
1
+ import { w as ErrorCode, W as WorkflowState, x as MethodologyName, S as Stage, R as Role, t as Event, C as Capability, N as NewItem, y as ItemPatch, l as WorkItem, j as ItemStatus, z as Evidence, P as Policy, M as Methodology, V as Violation, m as Gate, v as PendingHuman, T as Transition, D as Iteration, B as Brief, H as Handoff, A as Accounting, o as ApplyResult, g as Rule, F as Action, e as InvestigationState, i as ExperimentationState } from './types-DLOtndDY.js';
2
+ export { J as Baseline, K as Blocker, q as BriefContext, a as Budget, f as Ceremony, s as CeremonyInput, r as ClassOfService, p as ContextAssumption, L as ContextSnapshotData, k as CoreTerm, n as GateEscalation, G as GateRequirement, Q as ImpactAnalysis, U as ItemType, X as Lesson, Y as LessonChange, Z as ModelTier, u as Phase, _ as PlannerOptions, $ as Produced, a0 as Spent, a1 as Verdict, a2 as WorkflowExt } from './types-DLOtndDY.js';
3
+ export { E as EstimateMode, Z as ZERO_SPENT, a as addSpent, c as canDo, e as estimateTokens, i as isExhausted, r as remaining, b as requireCap, d as requireCapabilities, s as separationLost } from './budget-BuQ9GWsg.js';
4
4
  import { ExNode } from 'ex-flow';
5
5
 
6
6
  interface WorkflowErrorExtra {
@@ -99,9 +99,11 @@ declare function applyAgreement(state: WorkflowState, change: {
99
99
  declare function retireAgreement<N extends string>(state: WorkflowState<N>, text: string, by: string, now: string): WorkflowState<N>;
100
100
  declare function retireAgreement(state: WorkflowState, text: string, by: string, now: string): WorkflowState;
101
101
 
102
- declare function evaluatePolicies(state: WorkflowState<string>, item: WorkItem, policies: Policy[]): Violation[];
102
+ /** The part of a methodology policy evaluation reads: its `customPolicy` hook (spec 27, #36). */
103
+ type PolicyHook<N extends string> = Pick<Methodology<unknown, N>, "customPolicy">;
104
+ declare function evaluatePolicies<N extends string>(state: WorkflowState<N>, item: WorkItem, policies: Policy[], methodology?: PolicyHook<N>): Violation[];
103
105
  declare function evaluatePolicies(state: WorkflowState, item: WorkItem, policies: Policy[]): Violation[];
104
- declare function assertPolicies(state: WorkflowState<string>, item: WorkItem, policies: Policy[], context: string): void;
106
+ declare function assertPolicies<N extends string>(state: WorkflowState<N>, item: WorkItem, policies: Policy[], context: string, methodology?: PolicyHook<N>): void;
105
107
  declare function assertPolicies(state: WorkflowState, item: WorkItem, policies: Policy[], context: string): void;
106
108
 
107
109
  type GateResult = {
@@ -112,12 +114,6 @@ type GateResult = {
112
114
  outcome: "fail";
113
115
  violations: Violation[];
114
116
  };
115
- /** Last in_progress dispatch made from a stage that comes STRICTLY BEFORE the item's current stage in `state.stages` order (unknown stage ids count as not-before). */
116
- declare function lastDispatchBefore(state: WorkflowState<string>, item: WorkItem): Transition | undefined;
117
- declare function lastDispatchBefore(state: WorkflowState, item: WorkItem): Transition | undefined;
118
- /** Role that did the work the gate guards: the last dispatch made from a stage strictly before the current one (so a reviewer dispatched into the gated stage is not its author); else the last dispatch of any stage; undefined if never dispatched. */
119
- declare function authorOf(state: WorkflowState<string>, item: WorkItem): string | undefined;
120
- declare function authorOf(state: WorkflowState, item: WorkItem): string | undefined;
121
117
  declare function checkGate(state: WorkflowState<string>, item: WorkItem, gate: Gate, by: string): GateResult;
122
118
  declare function checkGate(state: WorkflowState, item: WorkItem, gate: Gate, by: string): GateResult;
123
119
  declare function raisePending<N extends string>(state: WorkflowState<N>, pending: Omit<PendingHuman, "id" | "raisedAt">, now?: string): WorkflowState<N>;
@@ -125,6 +121,13 @@ declare function raisePending(state: WorkflowState, pending: Omit<PendingHuman,
125
121
  declare function decide<N extends string>(state: WorkflowState<N>, pendingId: string, decision: "approve" | "reject", by: string, note: string, now?: string, methodology?: Methodology<unknown, N>): WorkflowState<N>;
126
122
  declare function decide(state: WorkflowState, pendingId: string, decision: "approve" | "reject", by: string, note: string, now?: string, methodology?: Methodology): WorkflowState;
127
123
 
124
+ /** Last in_progress dispatch made from a stage that comes STRICTLY BEFORE the item's current stage in `state.stages` order (unknown stage ids count as not-before). */
125
+ declare function lastDispatchBefore(state: WorkflowState<string>, item: WorkItem): Transition | undefined;
126
+ declare function lastDispatchBefore(state: WorkflowState, item: WorkItem): Transition | undefined;
127
+ /** Role that did the work the gate guards: the last dispatch made from a stage strictly before the current one (so a reviewer dispatched into the gated stage is not its author); else the last dispatch of any stage; undefined if never dispatched. */
128
+ declare function authorOf(state: WorkflowState<string>, item: WorkItem): string | undefined;
129
+ declare function authorOf(state: WorkflowState, item: WorkItem): string | undefined;
130
+
128
131
  type NodeData = {
129
132
  id: string;
130
133
  };
@@ -280,6 +283,6 @@ declare function frozenChanges<K extends string>(frozen: {
280
283
  readonly [P in K]?: unknown;
281
284
  }, supplied: object | undefined, keys?: readonly K[]): K[];
282
285
 
283
- declare const VERSION = "1.2.0";
286
+ declare const VERSION = "1.4.0";
284
287
 
285
288
  export { Accounting, type AccountingPatch, Action, ApplyResult, Brief, Capability, ErrorCode, Event, Evidence, Gate, type GateResult, Handoff, type InitInput, ItemPatch, ItemStatus, Iteration, type LegacyExtRecords, Methodology, MethodologyName, NewItem, type NextResult, PendingHuman, type PlanOptions, type PlanReason, type PlanResult, Policy, Role, Rule, type Skipped, Stage, Transition, VERSION, Violation, WorkItem, WorkflowError, WorkflowState, addEvidence, addItem, appendEvent, applyAction, applyAgreement, approversFor, assertId, assertPolicies, assignRole, authorOf, changeConfig, checkGate, clearBlocker, complete, coreRulesFor, correctAccounting, createState, decide, editItem, evaluatePolicies, fail, frozenChanges, getItem, hasCapability, independenceConflicts, init, isTerminalStage, lastDispatchBefore, lastEvent, moveItem, next, nextStageOf, nowOf, openIteration, openQuestions, plan, raiseBlocker, raisePending, readExt, registerRole, resourceCapsFor, retireAgreement, retireRole, rolesWith, stageOf, synthesizeBrief, toExNodes, validateAction, writeExt };
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export{f as complete,g as correctAccounting,e as next,d as openQuestions,a as registerRole,b as retireRole,c as synthesizeBrief}from'./chunk-MB465DI4.mjs';import'./chunk-IDZ435YZ.mjs';export{a as applyAgreement,b as retireAgreement}from'./chunk-LIATP6LY.mjs';export{b as frozenChanges,a as independenceConflicts}from'./chunk-FDZB73PH.mjs';export{a as readExt,b as writeExt}from'./chunk-TQR3VFZU.mjs';export{I as ZERO_SPENT,y as addEvidence,s as addItem,J as addSpent,c as appendEvent,U as applyAction,i as approversFor,C as assertPolicies,O as assignRole,E as authorOf,l as canDo,W as changeConfig,F as checkGate,A as clearBlocker,S as coreRulesFor,b as createState,H as decide,t as editItem,M as estimateTokens,B as evaluatePolicies,r as getItem,f as hasCapability,V as init,L as isExhausted,p as isTerminalStage,D as lastDispatchBefore,d as lastEvent,u as moveItem,o as nextStageOf,a as nowOf,N as openIteration,R as plan,z as raiseBlocker,G as raisePending,K as remaining,m as requireCap,j as requireCapabilities,P as resourceCapsFor,g as rolesWith,k as separationLost,n as stageOf,Q as toExNodes,T as validateAction}from'./chunk-UUWDQVIJ.mjs';export{a as WorkflowError,c as assertId,b as fail}from'./chunk-YS6CXERQ.mjs';var ae="1.2.0";export{ae as VERSION};//# sourceMappingURL=index.mjs.map
1
+ export{f as complete,g as correctAccounting,e as next,d as openQuestions,a as registerRole,b as retireRole,c as synthesizeBrief}from'./chunk-YNYIHJOC.mjs';import'./chunk-IDZ435YZ.mjs';export{d as checkGate,b as clearBlocker,f as decide,a as raiseBlocker,e as raisePending}from'./chunk-MUQ4FKVH.mjs';export{a as applyAgreement,b as retireAgreement}from'./chunk-3QUIRAXO.mjs';export{a as frozenChanges}from'./chunk-BD665RYK.mjs';export{a as independenceConflicts}from'./chunk-WU5JELOM.mjs';export{a as readExt,b as writeExt}from'./chunk-TQR3VFZU.mjs';export{J as ZERO_SPENT,A as addEvidence,t as addItem,K as addSpent,c as appendEvent,V as applyAction,i as approversFor,C as assertPolicies,P as assignRole,H as authorOf,l as canDo,X as changeConfig,T as coreRulesFor,b as createState,u as editItem,N as estimateTokens,B as evaluatePolicies,s as getItem,f as hasCapability,W as init,M as isExhausted,p as isTerminalStage,G as lastDispatchBefore,d as lastEvent,v as moveItem,o as nextStageOf,a as nowOf,O as openIteration,S as plan,L as remaining,m as requireCap,j as requireCapabilities,Q as resourceCapsFor,g as rolesWith,k as separationLost,n as stageOf,R as toExNodes,U as validateAction}from'./chunk-NNQ3RHDP.mjs';export{a as WorkflowError,c as assertId,b as fail}from'./chunk-YS6CXERQ.mjs';var ae="1.4.0";export{ae as VERSION};//# sourceMappingURL=index.mjs.map
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":["VERSION"],"mappings":"wsCAAO,IAAMA,EAAAA,CAAU","file":"index.mjs","sourcesContent":["export const VERSION = \"1.2.0\";\nexport * from \"./core/types.ts\";\nexport { WorkflowError, fail } from \"./core/errors.ts\";\nexport { createState, appendEvent, lastEvent, nowOf } from \"./core/state.ts\";\nexport { registerRole, retireRole } from \"./core/roles/registry.ts\";\nexport { hasCapability, rolesWith, approversFor } from \"./core/roles/lookup.ts\";\nexport { requireCapabilities, separationLost, canDo, requireCap } from \"./core/roles/guards.ts\";\nexport { assertId } from \"./core/errors.ts\";\nexport { stageOf, nextStageOf, isTerminalStage } from \"./core/items/stage.ts\";\nexport { getItem, addItem, editItem } from \"./core/items/record.ts\";\nexport { moveItem } from \"./core/items/move.ts\";\nexport { addEvidence } from \"./core/items/evidence.ts\";\nexport { raiseBlocker, clearBlocker } from \"./core/items/blockers.ts\";\nexport type { ItemPatch } from \"./core/types.ts\";\nexport { applyAgreement, retireAgreement } from \"./core/agreements.ts\";\nexport { evaluatePolicies, assertPolicies } from \"./core/policies.ts\";\nexport { checkGate, authorOf, lastDispatchBefore, raisePending, decide } from \"./core/gates.ts\";\nexport type { GateResult } from \"./core/gates.ts\";\nexport { ZERO_SPENT, addSpent, remaining, isExhausted, estimateTokens } from \"./core/budget.ts\";\nexport type { EstimateMode } from \"./core/budget.ts\";\nexport { plan, toExNodes, assignRole, resourceCapsFor, openIteration } from \"./core/planner.ts\";\nexport type { PlanOptions, PlanReason, PlanResult, Skipped } from \"./core/planner.ts\";\nexport { synthesizeBrief, next, openQuestions } from \"./core/brief.ts\";\nexport type { NextResult } from \"./core/brief.ts\";\nexport { complete } from \"./core/complete.ts\";\nexport { correctAccounting } from \"./core/accounting.ts\";\nexport type { AccountingPatch } from \"./core/accounting.ts\";\nexport { coreRulesFor } from \"./core/rules.ts\";\nexport { applyAction, validateAction, init, changeConfig } from \"./core/methodology.ts\";\nexport type { InitInput } from \"./core/methodology.ts\";\nexport { readExt, writeExt } from \"./interface/ext.ts\";\nexport type { LegacyExtRecords } from \"./interface/ext.ts\";\nexport { independenceConflicts } from \"./common/independence.ts\";\nexport { frozenChanges } from \"./common/frozen.ts\";\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":["VERSION"],"mappings":"4wCAAO,IAAMA,EAAAA,CAAU","file":"index.mjs","sourcesContent":["export const VERSION = \"1.4.0\";\nexport * from \"./core/types.ts\";\nexport { WorkflowError, fail } from \"./core/errors.ts\";\nexport { createState, appendEvent, lastEvent, nowOf } from \"./core/state.ts\";\nexport { registerRole, retireRole } from \"./core/roles/registry.ts\";\nexport { hasCapability, rolesWith, approversFor } from \"./core/roles/lookup.ts\";\nexport { requireCapabilities, separationLost, canDo, requireCap } from \"./core/roles/guards.ts\";\nexport { assertId } from \"./core/errors.ts\";\nexport { stageOf, nextStageOf, isTerminalStage } from \"./core/items/stage.ts\";\nexport { getItem, addItem, editItem } from \"./core/items/record.ts\";\nexport { moveItem } from \"./core/items/move.ts\";\nexport { addEvidence } from \"./core/items/evidence.ts\";\nexport { raiseBlocker, clearBlocker } from \"./core/items/blockers.ts\";\nexport type { ItemPatch } from \"./core/types.ts\";\nexport { applyAgreement, retireAgreement } from \"./core/agreements.ts\";\nexport { evaluatePolicies, assertPolicies } from \"./core/policies.ts\";\nexport { checkGate, raisePending, decide } from \"./core/gates.ts\";\nexport { authorOf, lastDispatchBefore } from \"./core/authors.ts\";\nexport type { GateResult } from \"./core/gates.ts\";\nexport { ZERO_SPENT, addSpent, remaining, isExhausted, estimateTokens } from \"./core/budget.ts\";\nexport type { EstimateMode } from \"./core/budget.ts\";\nexport { plan, toExNodes, assignRole, resourceCapsFor, openIteration } from \"./core/planner.ts\";\nexport type { PlanOptions, PlanReason, PlanResult, Skipped } from \"./core/planner.ts\";\nexport { synthesizeBrief, next, openQuestions } from \"./core/brief.ts\";\nexport type { NextResult } from \"./core/brief.ts\";\nexport { complete } from \"./core/complete.ts\";\nexport { correctAccounting } from \"./core/accounting.ts\";\nexport type { AccountingPatch } from \"./core/accounting.ts\";\nexport { coreRulesFor } from \"./core/rules.ts\";\nexport { applyAction, validateAction, init, changeConfig } from \"./core/methodology.ts\";\nexport type { InitInput } from \"./core/methodology.ts\";\nexport { readExt, writeExt } from \"./interface/ext.ts\";\nexport type { LegacyExtRecords } from \"./interface/ext.ts\";\nexport { independenceConflicts } from \"./common/independence.ts\";\nexport { frozenChanges } from \"./common/frozen.ts\";\n"]}
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkQAENYYU6_cjs=require('../chunk-QAENYYU6.cjs');require('../chunk-BHAEPYRJ.cjs'),require('../chunk-BBI7AKJK.cjs'),require('../chunk-Z43GUETW.cjs'),require('../chunk-OSHBJIYD.cjs');Object.defineProperty(exports,"investigation",{enumerable:true,get:function(){return chunkQAENYYU6_cjs.b}});Object.defineProperty(exports,"validateInvestigationConfig",{enumerable:true,get:function(){return chunkQAENYYU6_cjs.a}});//# sourceMappingURL=index.cjs.map
1
+ 'use strict';var chunk76ITDJDM_cjs=require('../chunk-76ITDJDM.cjs');require('../chunk-KLOSFZFK.cjs'),require('../chunk-6PFJYRM7.cjs'),require('../chunk-BBI7AKJK.cjs'),require('../chunk-TBLIZIWH.cjs'),require('../chunk-OSHBJIYD.cjs');Object.defineProperty(exports,"investigation",{enumerable:true,get:function(){return chunk76ITDJDM_cjs.b}});Object.defineProperty(exports,"validateInvestigationConfig",{enumerable:true,get:function(){return chunk76ITDJDM_cjs.a}});//# sourceMappingURL=index.cjs.map
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,5 +1,5 @@
1
- import { a as Budget, M as Methodology } from '../types-DjePDfms.cjs';
2
- export { b as BeliefUpdate, E as Experiment, c as Hypothesis, I as InvestigationConclusion, d as InvestigationRound, e as InvestigationState, O as Observation } from '../types-DjePDfms.cjs';
1
+ import { a as Budget, M as Methodology } from '../types-DLOtndDY.cjs';
2
+ export { b as BeliefUpdate, E as Experiment, c as Hypothesis, I as InvestigationConclusion, d as InvestigationRound, e as InvestigationState, O as Observation } from '../types-DLOtndDY.cjs';
3
3
 
4
4
  interface InvestigationConfig {
5
5
  question: string;
@@ -1,5 +1,5 @@
1
- import { a as Budget, M as Methodology } from '../types-DjePDfms.js';
2
- export { b as BeliefUpdate, E as Experiment, c as Hypothesis, I as InvestigationConclusion, d as InvestigationRound, e as InvestigationState, O as Observation } from '../types-DjePDfms.js';
1
+ import { a as Budget, M as Methodology } from '../types-DLOtndDY.js';
2
+ export { b as BeliefUpdate, E as Experiment, c as Hypothesis, I as InvestigationConclusion, d as InvestigationRound, e as InvestigationState, O as Observation } from '../types-DLOtndDY.js';
3
3
 
4
4
  interface InvestigationConfig {
5
5
  question: string;
@@ -1,2 +1,2 @@
1
- export{b as investigation,a as validateInvestigationConfig}from'../chunk-7EF47R2J.mjs';import'../chunk-FDZB73PH.mjs';import'../chunk-TQR3VFZU.mjs';import'../chunk-UUWDQVIJ.mjs';import'../chunk-YS6CXERQ.mjs';//# sourceMappingURL=index.mjs.map
1
+ export{b as investigation,a as validateInvestigationConfig}from'../chunk-ILNSTPPV.mjs';import'../chunk-BD665RYK.mjs';import'../chunk-WU5JELOM.mjs';import'../chunk-TQR3VFZU.mjs';import'../chunk-NNQ3RHDP.mjs';import'../chunk-YS6CXERQ.mjs';//# sourceMappingURL=index.mjs.map
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkIIEKK2S3_cjs=require('../chunk-IIEKK2S3.cjs');require('../chunk-GKN5M4B7.cjs'),require('../chunk-W2P27645.cjs'),require('../chunk-OVR5CK3R.cjs'),require('../chunk-Z43GUETW.cjs'),require('../chunk-OSHBJIYD.cjs');Object.defineProperty(exports,"ACTIVE",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.a}});Object.defineProperty(exports,"CADENCE_EVENT",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.s}});Object.defineProperty(exports,"CLASSES",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.k}});Object.defineProperty(exports,"DAY_MS",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.l}});Object.defineProperty(exports,"DEFAULT_COLUMNS",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.n}});Object.defineProperty(exports,"KANBAN_CADENCES",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.j}});Object.defineProperty(exports,"KANBAN_VOCABULARY",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.F}});Object.defineProperty(exports,"OPEN",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.b}});Object.defineProperty(exports,"activeExpedites",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.h}});Object.defineProperty(exports,"addedAt",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.p}});Object.defineProperty(exports,"board",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.r}});Object.defineProperty(exports,"byClassThenAge",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.H}});Object.defineProperty(exports,"cadencesDue",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.t}});Object.defineProperty(exports,"cardAge",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.q}});Object.defineProperty(exports,"columnIndex",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.f}});Object.defineProperty(exports,"columnStays",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.w}});Object.defineProperty(exports,"commitmentColumn",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.d}});Object.defineProperty(exports,"configOf",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.m}});Object.defineProperty(exports,"deliveryColumn",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.e}});Object.defineProperty(exports,"enteredStageAt",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.i}});Object.defineProperty(exports,"kanban",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.I}});Object.defineProperty(exports,"kanbanCeremonies",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.B}});Object.defineProperty(exports,"kanbanMetrics",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.x}});Object.defineProperty(exports,"kanbanRoles",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.C}});Object.defineProperty(exports,"kanbanRules",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.D}});Object.defineProperty(exports,"kanbanStages",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.E}});Object.defineProperty(exports,"onBoard",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.g}});Object.defineProperty(exports,"opsReport",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.y}});Object.defineProperty(exports,"optionsColumn",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.c}});Object.defineProperty(exports,"percentile",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.v}});Object.defineProperty(exports,"priorityByClass",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.G}});Object.defineProperty(exports,"replay",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.u}});Object.defineProperty(exports,"riskReport",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.z}});Object.defineProperty(exports,"validateKanbanConfig",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.o}});Object.defineProperty(exports,"wantItems",{enumerable:true,get:function(){return chunkIIEKK2S3_cjs.A}});//# sourceMappingURL=index.cjs.map
1
+ 'use strict';var chunkCPM2SPDX_cjs=require('../chunk-CPM2SPDX.cjs');require('../chunk-GKN5M4B7.cjs'),require('../chunk-RMXEQ5HN.cjs'),require('../chunk-ZK3V66NC.cjs'),require('../chunk-TBLIZIWH.cjs'),require('../chunk-OSHBJIYD.cjs');Object.defineProperty(exports,"ACTIVE",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.a}});Object.defineProperty(exports,"CADENCE_EVENT",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.s}});Object.defineProperty(exports,"CLASSES",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.k}});Object.defineProperty(exports,"DAY_MS",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.l}});Object.defineProperty(exports,"DEFAULT_COLUMNS",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.n}});Object.defineProperty(exports,"KANBAN_CADENCES",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.j}});Object.defineProperty(exports,"KANBAN_VOCABULARY",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.F}});Object.defineProperty(exports,"OPEN",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.b}});Object.defineProperty(exports,"activeExpedites",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.h}});Object.defineProperty(exports,"addedAt",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.p}});Object.defineProperty(exports,"board",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.r}});Object.defineProperty(exports,"byClassThenAge",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.H}});Object.defineProperty(exports,"cadencesDue",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.t}});Object.defineProperty(exports,"cardAge",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.q}});Object.defineProperty(exports,"columnIndex",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.f}});Object.defineProperty(exports,"columnStays",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.w}});Object.defineProperty(exports,"commitmentColumn",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.d}});Object.defineProperty(exports,"configOf",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.m}});Object.defineProperty(exports,"deliveryColumn",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.e}});Object.defineProperty(exports,"enteredStageAt",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.i}});Object.defineProperty(exports,"kanban",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.I}});Object.defineProperty(exports,"kanbanCeremonies",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.B}});Object.defineProperty(exports,"kanbanMetrics",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.x}});Object.defineProperty(exports,"kanbanRoles",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.C}});Object.defineProperty(exports,"kanbanRules",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.D}});Object.defineProperty(exports,"kanbanStages",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.E}});Object.defineProperty(exports,"onBoard",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.g}});Object.defineProperty(exports,"opsReport",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.y}});Object.defineProperty(exports,"optionsColumn",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.c}});Object.defineProperty(exports,"percentile",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.v}});Object.defineProperty(exports,"priorityByClass",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.G}});Object.defineProperty(exports,"replay",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.u}});Object.defineProperty(exports,"riskReport",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.z}});Object.defineProperty(exports,"validateKanbanConfig",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.o}});Object.defineProperty(exports,"wantItems",{enumerable:true,get:function(){return chunkCPM2SPDX_cjs.A}});//# sourceMappingURL=index.cjs.map
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,4 +1,4 @@
1
- import { m as ClassOfService, P as Policy, W as WorkflowState, R as Role, S as Stage, g as Rule, M as Methodology, f as Ceremony, n as CeremonyInput, j as ItemStatus, l as WorkItem, o as Event, k as CoreTerm } from '../types-DjePDfms.cjs';
1
+ import { r as ClassOfService, P as Policy, W as WorkflowState, R as Role, S as Stage, g as Rule, M as Methodology, f as Ceremony, s as CeremonyInput, j as ItemStatus, l as WorkItem, t as Event, k as CoreTerm } from '../types-DLOtndDY.cjs';
2
2
 
3
3
  type KanbanCadence = "replenishment" | "delivery-planning" | "service-delivery-review" | "operations-review" | "risk-review" | "strategy-review";
4
4
  declare const KANBAN_CADENCES: readonly KanbanCadence[];
@@ -1,4 +1,4 @@
1
- import { m as ClassOfService, P as Policy, W as WorkflowState, R as Role, S as Stage, g as Rule, M as Methodology, f as Ceremony, n as CeremonyInput, j as ItemStatus, l as WorkItem, o as Event, k as CoreTerm } from '../types-DjePDfms.js';
1
+ import { r as ClassOfService, P as Policy, W as WorkflowState, R as Role, S as Stage, g as Rule, M as Methodology, f as Ceremony, s as CeremonyInput, j as ItemStatus, l as WorkItem, t as Event, k as CoreTerm } from '../types-DLOtndDY.js';
2
2
 
3
3
  type KanbanCadence = "replenishment" | "delivery-planning" | "service-delivery-review" | "operations-review" | "risk-review" | "strategy-review";
4
4
  declare const KANBAN_CADENCES: readonly KanbanCadence[];
@@ -1,2 +1,2 @@
1
- export{a as ACTIVE,s as CADENCE_EVENT,k as CLASSES,l as DAY_MS,n as DEFAULT_COLUMNS,j as KANBAN_CADENCES,F as KANBAN_VOCABULARY,b as OPEN,h as activeExpedites,p as addedAt,r as board,H as byClassThenAge,t as cadencesDue,q as cardAge,f as columnIndex,w as columnStays,d as commitmentColumn,m as configOf,e as deliveryColumn,i as enteredStageAt,I as kanban,B as kanbanCeremonies,x as kanbanMetrics,C as kanbanRoles,D as kanbanRules,E as kanbanStages,g as onBoard,y as opsReport,c as optionsColumn,v as percentile,G as priorityByClass,u as replay,z as riskReport,o as validateKanbanConfig,A as wantItems}from'../chunk-BYPFTO7P.mjs';import'../chunk-C4ISBUZR.mjs';import'../chunk-4HG6A3SF.mjs';import'../chunk-LIATP6LY.mjs';import'../chunk-UUWDQVIJ.mjs';import'../chunk-YS6CXERQ.mjs';//# sourceMappingURL=index.mjs.map
1
+ export{a as ACTIVE,s as CADENCE_EVENT,k as CLASSES,l as DAY_MS,n as DEFAULT_COLUMNS,j as KANBAN_CADENCES,F as KANBAN_VOCABULARY,b as OPEN,h as activeExpedites,p as addedAt,r as board,H as byClassThenAge,t as cadencesDue,q as cardAge,f as columnIndex,w as columnStays,d as commitmentColumn,m as configOf,e as deliveryColumn,i as enteredStageAt,I as kanban,B as kanbanCeremonies,x as kanbanMetrics,C as kanbanRoles,D as kanbanRules,E as kanbanStages,g as onBoard,y as opsReport,c as optionsColumn,v as percentile,G as priorityByClass,u as replay,z as riskReport,o as validateKanbanConfig,A as wantItems}from'../chunk-OAJ4KV4F.mjs';import'../chunk-C4ISBUZR.mjs';import'../chunk-N2NANHRW.mjs';import'../chunk-3QUIRAXO.mjs';import'../chunk-NNQ3RHDP.mjs';import'../chunk-YS6CXERQ.mjs';//# sourceMappingURL=index.mjs.map
2
2
  //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunk66BO7JFR_cjs=require('../chunk-66BO7JFR.cjs');require('../chunk-GKN5M4B7.cjs'),require('../chunk-6PFJYRM7.cjs');var chunkTBLIZIWH_cjs=require('../chunk-TBLIZIWH.cjs'),chunkOSHBJIYD_cjs=require('../chunk-OSHBJIYD.cjs');var L=["item","level","factors","ref","subject","by","now"],w=(s,e)=>chunkOSHBJIYD_cjs.b("invalid-input",`risk assessment: ${s}`,e);function os(s,e,a){(typeof a!="object"||a===null||Array.isArray(a))&&w("input must be an object",`pass { ${L.join(", ")} }`);for(let f of Object.keys(a))L.includes(f)||w(`unknown key "${f}"`,`use only: ${L.join(", ")}`);let{item:o,level:m,factors:i,ref:t,subject:l,by:r,now:d}=a;typeof o!="string"&&w("item must be an item id",'e.g. "item": "CART-12"');let p=chunkTBLIZIWH_cjs.s(s,o);chunk66BO7JFR_cjs.a.includes(m)||w(`unknown level ${JSON.stringify(m)}`,`use one of: ${chunk66BO7JFR_cjs.a.join(", ")}`),(!Array.isArray(i)||!i.every(f=>typeof f=="string"))&&w("factors must be an array of strings",'e.g. "factors": ["ci-cd", "secrets"]'),(typeof t!="string"||t.trim()==="")&&w("ref must be a non-empty string",'name the assessment artifact, e.g. "risk/CART-12.md"'),l!==void 0&&typeof l!="string"&&w("subject must be a string","pass the assessed SHA or ref, or omit it"),d!==void 0&&typeof d!="string"&&w("now must be an ISO timestamp string","omit now to use the clock"),(typeof r!="string"||r==="")&&w("by must name the assessor",'e.g. "by": "human"');let h=chunk66BO7JFR_cjs.c(s,p,r);h==="invalid"&&w(`"${r}" may not assess risk (needs capability "verify")`,`assess as human or one of: ${chunkTBLIZIWH_cjs.g(s,"verify").map(f=>f.id).join(", ")||"(no role has verify; register one)"}`),h&&w(`"${r}" did the work on "${o}" and may not assess its risk`,"assess as human or an independent role with capability verify");let g={level:m,factors:[...i]};return l!==void 0&&(g.subject=l),chunkTBLIZIWH_cjs.V(s,e,{type:"risk.assess",by:r,payload:{item:o,ref:t,...g}},f=>chunkTBLIZIWH_cjs.A(f,o,{kind:"risk-assessment",ref:t,by:r,data:g},d))}var W=["revision","paths","by","now"],rs=["in_progress","review","awaiting_human"],S=(s,e)=>chunkOSHBJIYD_cjs.b("invalid-input",`repo change: ${s}`,e);function as(s,e,a){(typeof a!="object"||a===null||Array.isArray(a))&&S("input must be an object",`pass { ${W.join(", ")} }`);for(let p of Object.keys(a))W.includes(p)||S(`unknown key "${p}"`,`use only: ${W.join(", ")}`);let{revision:o,paths:m,by:i,now:t}=a;(typeof o!="string"||o.trim()==="")&&S("revision must be a non-empty string",'e.g. "revision": "4f2c1e0"'),(!Array.isArray(m)||m.length===0)&&S("paths must be a non-empty array of paths",'e.g. "paths": ["src/cart.ts"]'),m.forEach((p,h)=>{let g=chunk66BO7JFR_cjs.e(p);g&&S(`paths[${h}] ${g}`,'send paths as `git diff --name-only -z` lists them (NUL-separated, unquoted; or with `-c core.quotePath=false`), e.g. "src/cart.ts"');}),(typeof i!="string"||i==="")&&S("by must name the reporter",'e.g. "by": "ci"'),t!==void 0&&typeof t!="string"&&S("now must be an ISO timestamp string","omit now to use the clock");let l=[...new Set(m)],r=chunkTBLIZIWH_cjs.V(s,e,{type:"repo.change",by:i,payload:{revision:o,paths:l}},p=>chunkTBLIZIWH_cjs.c(p,"repo.changed",i,{revision:o,paths:l},chunkTBLIZIWH_cjs.a(t))),d=[];for(let p of Object.values(r.state.items)){if(!rs.includes(p.status))continue;let h=chunk66BO7JFR_cjs.f(s,p);if(!h)continue;let g=new Set(h.assumptions.map(R=>R.source?.path)),f=new Set(h.stale),v=l.filter(R=>g.has(R)&&!f.has(R));v.length&&d.push({rule:"context-stale",severity:"warning",item:p.id,message:`context snapshot "${h.snapshot}" of "${p.id}" is stale: ${v.join(", ")} changed at ${o}`,fix:`re-verify and record a fresh snapshot of "${p.id}" with recordContextSnapshot`});}return {state:r.state,warnings:[...r.warnings,...d]}}var z=["baseline","mustPass","passTolerance","costTolerance"],is=["tokens","durationMs","turns","humanInterventions","reworks","escalations","itemsDone"],u=(s,e)=>chunkOSHBJIYD_cjs.b("invalid-input",`compareRuns: ${s}`,e),b=s=>typeof s=="string"?JSON.stringify(s):typeof s=="object"&&s!==null?Array.isArray(s)?"an array":"an object":typeof s=="function"||typeof s=="symbol"?typeof s:String(s),j=s=>typeof s=="object"&&s!==null&&!Array.isArray(s),y=(s,e)=>Object.hasOwn(s,e)?s[e]:void 0,D=(s,e)=>Number.isFinite(s)?s:u(`${e} is not finite (${s})`,"pass the host's measured usage figures"),T=(s,e)=>(typeof s!="string"&&u(`${e} is ${b(s)}, not an id`,'pass a string id such as "V0"'),chunkOSHBJIYD_cjs.c(s,e),s),B=(s,e)=>s===void 0?0:((typeof s!="number"||!Number.isFinite(s)||s<0||s>1)&&u(`${e} is ${b(s)}, not a fraction in [0, 1]`,`pass e.g. "${e}": 0.05`),s);function cs(s,e){if(!j(s))return u(`${e}.state is ${b(s)}, not a workflow state`,"pass the finished state.json");let[a,o,m]=["events","accounting","items"].map(t=>y(s,t));if(!Array.isArray(a)||!Array.isArray(o))return u(`${e}.state has no events and accounting arrays`,"pass a WorkflowState as loaded by loadState");if(!j(m))return u(`${e}.state.items is ${b(m)}, not an object`,"pass a WorkflowState as loaded by loadState");let i={tokens:0,durationMs:0,turns:o.length,humanInterventions:0,reworks:0,escalations:0,itemsDone:0};o.forEach((t,l)=>{if(!j(t))return u(`${e}.state.accounting[${l}] is ${b(t)}`,"pass accounting lines as recorded by complete");for(let r of ["tokensIn","tokensOut","durationMs"]){let d=y(t,r);(typeof d!="number"||!Number.isFinite(d)||d<0)&&u(`${e}.state.accounting[${l}].${r} is ${b(d)}, not a finite non-negative number`,"pass the host's measured usage figures");}i.tokens+=t.tokensIn+t.tokensOut,i.durationMs+=t.durationMs;}),D(i.tokens,`${e}.state token total`),D(i.durationMs,`${e}.state duration total`),a.forEach((t,l)=>{if(!j(t)||typeof y(t,"type")!="string")return u(`${e}.state.events[${l}] is ${b(t)}, not an event`,"pass events as recorded by the engine");let r=t.type;r==="pending.raised"||r==="blocker.cleared"?i.humanInterventions++:r==="item.rework"?i.reworks++:r==="item.escalated"&&i.escalations++;});for(let t of Object.values(m))j(t)&&y(t,"status")==="done"&&i.itemsDone++;return i}var Q=s=>s.sort((e,a)=>e-a).reduce((e,a)=>e+a,0)/s.length,_=(s,e)=>s<e?-1:s>e?1:0;function us(s,e){if(Array.isArray(s)||u(`runs is ${b(s)}, not an array`,"pass an array of { variant, scenario, state, passed }"),s.length===0&&u("no runs to compare","pass at least the baseline's finished runs"),!j(e))return u(`options is ${b(e)}, not an object`,'pass { baseline: "V0" }');for(let n of Object.keys(e))z.includes(n)||u(`unknown option "${n}"`,`use only: ${z.join(", ")}`);let a=e,o=T(y(a,"baseline"),"baseline"),m=y(a,"mustPass");m!==void 0&&!Array.isArray(m)&&u(`mustPass is ${b(m)}, not an array`,'pass e.g. "mustPass": ["s1"]');let i=[...new Set((m??[]).map(n=>T(n,"mustPass scenario")))],t=B(y(a,"passTolerance"),"passTolerance"),l=B(y(a,"costTolerance"),"costTolerance"),r=new Map,d=new Set;s.forEach((n,c)=>{let A=`runs[${c}]`;if(!j(n))return u(`${A} is ${b(n)}, not a run record`,"pass { variant, scenario, state, passed }");let M=T(y(n,"variant"),`${A}.variant`),x=T(y(n,"scenario"),`${A}.scenario`),I=y(n,"passed");typeof I!="boolean"&&u(`${A}.passed is ${b(I)}, not a boolean`,"pass the scorer's verdict as true or false");let k=cs(y(n,"state"),A),$=r.get(M);$||r.set(M,$={metrics:[],passed:0,ran:new Map,failed:new Set}),$.metrics.push(k);let E=$.ran.get(x)??[0,0];$.ran.set(x,E),E[1]++,d.add(x),I?($.passed++,E[0]++):$.failed.add(x);});let p=r.get(o);p||u(`baseline "${o}" has no run`,"name a variant that appears in runs");for(let n of i)d.has(n)||u(`mustPass scenario "${n}" has no run`,"name a scenario that appears in runs");let h=[...new Set([...p.ran.keys(),...i])].sort(_),g=[...r].map(([n,c])=>{let A=c.metrics.length,M={};for(let k of is)M[k]=D(Q(c.metrics.map($=>$[k])),`variant ${n} mean ${k}`);let x=i.filter(k=>c.failed.has(k)).sort(_),I=h.filter(k=>!c.ran.has(k));return {variant:n,runs:A,passed:c.passed,passRate:Q([...c.ran.values()].map(([k,$])=>k/$)),mean:M,regressions:x,missing:I,eligible:x.length===0&&I.length===0}});g.sort((n,c)=>Number(c.eligible)-Number(n.eligible)||c.passRate-n.passRate||n.mean.tokens-c.mean.tokens||n.mean.durationMs-c.mean.durationMs||n.mean.humanInterventions-c.mean.humanInterventions||_(n.variant,c.variant));let f=g.find(n=>n.variant===o),v=g.find(n=>n.variant!==o&&n.eligible&&n.passRate>=f.passRate-t&&(n.passRate>f.passRate+t||n.mean.tokens<f.mean.tokens*(1-l)));if(v)return {baseline:o,variants:g,winner:v.variant,reason:`${v.variant} beats baseline ${o}: pass rate ${v.passRate} vs ${f.passRate}, mean tokens ${v.mean.tokens} vs ${f.mean.tokens}`};let R=g.filter(n=>n.variant!==o),C;if(R.length===0)C=`no variant to compare with baseline ${o}`;else if(R.some(n=>n.eligible))C=`within noise: no eligible variant beats baseline ${o} beyond the tolerances`;else {let n=R.map(c=>`${c.variant} (${(c.regressions.length?c.regressions:c.missing).join(", ")})`).join("; ");C=`${R.some(c=>c.regressions.length)?"must-pass regression":"no eligible variant, missing runs"}: ${n}`;}return {baseline:o,variants:g,winner:null,reason:C}}Object.defineProperty(exports,"DEFAULT_RISK_TABLE",{enumerable:true,get:function(){return chunk66BO7JFR_cjs.b}});Object.defineProperty(exports,"contextGroundedViolations",{enumerable:true,get:function(){return chunk66BO7JFR_cjs.h}});Object.defineProperty(exports,"contextOf",{enumerable:true,get:function(){return chunk66BO7JFR_cjs.f}});Object.defineProperty(exports,"recordContextSnapshot",{enumerable:true,get:function(){return chunk66BO7JFR_cjs.g}});Object.defineProperty(exports,"riskEscalation",{enumerable:true,get:function(){return chunk66BO7JFR_cjs.d}});Object.defineProperty(exports,"withContextGrounding",{enumerable:true,get:function(){return chunk66BO7JFR_cjs.j}});Object.defineProperty(exports,"withRiskGate",{enumerable:true,get:function(){return chunk66BO7JFR_cjs.i}});exports.compareRuns=us;exports.recordRepoChange=as;exports.recordRiskAssessment=os;//# sourceMappingURL=index.cjs.map
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/common/risk/assessment.ts","../../src/common/context/repo-change.ts","../../src/common/compare-runs.ts"],"names":["KEYS","bad","what","fix","fail","recordRiskAssessment","state","methodology","input","k","id","level","factors","ref","subject","by","now","item","getItem","RISK_LEVELS","issue","assessorIssue","rolesWith","r","data","applyAction","s","addEvidence","IN_FLIGHT","recordRepoChange","revision","paths","i","repoPathIssue","changed","res","appendEvent","nowOf","warnings","ctx","contextOf","cited","a","was","hit","p","OPTION_KEYS","METRICS","show","v","isObject","own","o","finite","idOf","assertId","tolerance","key","metricsOf","where","events","accounting","items","m","line","ev","t","it","meanOf","xs","b","x","byId","compareRuns","runs","options","baseline","must","mustPass","passTol","costTol","groups","named","variant","scenario","passed","metrics","g","tally","base","required","results","n","mean","regressions","missing","win","others","reason","why"],"mappings":"gPAsBA,IAAMA,CAAAA,CAAO,CAAC,MAAA,CAAQ,OAAA,CAAS,UAAW,KAAA,CAAO,SAAA,CAAW,KAAM,KAAK,CAAA,CACjEC,EAAM,CAACC,CAAAA,CAAcC,IACzBC,mBAAAA,CAAK,eAAA,CAAiB,oBAAoBF,CAAI,CAAA,CAAA,CAAIC,CAAG,CAAA,CAShD,SAASE,EAAAA,CACdC,EACAC,CAAAA,CACAC,CAAAA,CACgB,EACZ,OAAOA,CAAAA,EAAU,UAAYA,CAAAA,GAAU,IAAA,EAAQ,MAAM,OAAA,CAAQA,CAAK,IACpEP,CAAAA,CAAI,yBAAA,CAA2B,UAAUD,CAAAA,CAAK,IAAA,CAAK,IAAI,CAAC,CAAA,EAAA,CAAI,CAAA,CAC9D,IAAA,IAAWS,CAAAA,IAAK,MAAA,CAAO,KAAKD,CAAK,CAAA,CAC1BR,EAAK,QAAA,CAASS,CAAC,GAAGR,CAAAA,CAAI,CAAA,aAAA,EAAgBQ,CAAC,CAAA,CAAA,CAAA,CAAK,CAAA,UAAA,EAAaT,E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AA,CAAMhD,GAAMA,CAAAA,CAAE,WAAA,CAAY,MAAM,CAAA,CAAI,sBAAA,CAAyB,mCAAmC,CAAA,EAAA,EAAKkD,CAAG,CAAA,EAC7H,CACA,OAAO,CAAE,SAAAvB,CAAAA,CAAU,QAAA,CAAUe,EAAS,MAAA,CAAQ,IAAA,CAAM,MAAA,CAAAO,CAAO,CAC7D","file":"index.cjs","sourcesContent":["import { fail } from \"../../core/errors.ts\";\nimport { addEvidence } from \"../../core/items/evidence.ts\";\nimport { getItem } from \"../../core/items/record.ts\";\nimport { applyAction } from \"../../core/methodology.ts\";\nimport { rolesWith } from \"../../core/roles/lookup.ts\";\nimport type { ApplyResult, Methodology, WorkflowState } from \"../../core/types.ts\";\nimport { assessorIssue, type RiskLevel } from \"./escalation.ts\";\nimport { RISK_LEVELS } from \"./options.ts\";\n\nexport interface RiskAssessmentInput {\n item: string;\n level: RiskLevel;\n factors: string[];\n /** The host's assessment artifact. */\n ref: string;\n /** The item SHA or ref that was assessed. */\n subject?: string;\n /** The assessor: `human` or a role with capability `verify` that did not do the work. */\n by: string;\n now?: string;\n}\n\nconst KEYS = [\"item\", \"level\", \"factors\", \"ref\", \"subject\", \"by\", \"now\"];\nconst bad = (what: string, fix: string): never =>\n fail(\"invalid-input\", `risk assessment: ${what}`, fix);\n\n/**\n * Records a risk assessment of an item as evidence `risk-assessment` with `data: { level, factors,\n * subject? }` (design spec section 27, #35), through `applyAction` (action `risk.assess`) so the\n * methodology's rules see it. Refuses `invalid-input` for an unknown key, an unknown level, a\n * non-string factor, an empty ref, an assessor that is neither `human` nor a role with `verify`, and\n * an assessor that is the item's author or assigned role.\n */\nexport function recordRiskAssessment<N extends string>(\n state: WorkflowState<N>,\n methodology: Methodology<unknown, N>,\n input: RiskAssessmentInput,\n): ApplyResult<N> {\n if (typeof input !== \"object\" || input === null || Array.isArray(input))\n bad(\"input must be an object\", `pass { ${KEYS.join(\", \")} }`);\n for (const k of Object.keys(input))\n if (!KEYS.includes(k)) bad(`unknown key \"${k}\"`, `use only: ${KEYS.join(\", \")}`);\n const { item: id, level, factors, ref, subject, by, now } = input;\n if (typeof id !== \"string\") bad(\"item must be an item id\", 'e.g. \"item\": \"CART-12\"');\n const item = getItem(state, id);\n if (!RISK_LEVELS.includes(level))\n bad(`unknown level ${JSON.stringify(level)}`, `use one of: ${RISK_LEVELS.join(\", \")}`);\n if (!Array.isArray(factors) || !factors.every((f) => typeof f === \"string\"))\n bad(\"factors must be an array of strings\", 'e.g. \"factors\": [\"ci-cd\", \"secrets\"]');\n if (typeof ref !== \"string\" || ref.trim() === \"\")\n bad(\"ref must be a non-empty string\", 'name the assessment artifact, e.g. \"risk/CART-12.md\"');\n if (subject !== undefined && typeof subject !== \"string\")\n bad(\"subject must be a string\", \"pass the assessed SHA or ref, or omit it\");\n if (now !== undefined && typeof now !== \"string\")\n bad(\"now must be an ISO timestamp string\", \"omit now to use the clock\");\n if (typeof by !== \"string\" || by === \"\") bad(\"by must name the assessor\", 'e.g. \"by\": \"human\"');\n const issue = assessorIssue(state, item, by);\n if (issue === \"invalid\")\n bad(\n `\"${by}\" may not assess risk (needs capability \"verify\")`,\n `assess as human or one of: ${\n rolesWith(state, \"verify\")\n .map((r) => r.id)\n .join(\", \") || \"(no role has verify; register one)\"\n }`,\n );\n if (issue)\n bad(\n `\"${by}\" did the work on \"${id}\" and may not assess its risk`,\n \"assess as human or an independent role with capability verify\",\n );\n const data: Record<string, unknown> = { level, factors: [...factors] };\n if (subject !== undefined) data[\"subject\"] = subject;\n return applyAction(\n state,\n methodology,\n { type: \"risk.assess\", by, payload: { item: id, ref, ...data } },\n (s) => addEvidence(s, id, { kind: \"risk-assessment\", ref, by, data }, now),\n );\n}\n","// `repo.changed` (design spec section 27, #36): the host reports which repository paths a new\n// revision changed; context snapshots citing one of them go stale (see contextOf).\nimport { fail } from \"../../core/errors.ts\";\nimport { applyAction } from \"../../core/methodology.ts\";\nimport { appendEvent, nowOf } from \"../../core/state.ts\";\nimport type { ApplyResult, Methodology, Violation, WorkflowState } from \"../../core/types.ts\";\nimport { contextOf, repoPathIssue } from \"./snapshot.ts\";\n\nexport interface RepoChangeInput {\n /** The new repository revision. */\n revision: string;\n /** Repository-relative POSIX paths the revision changed, as Git lists them. */\n paths: string[];\n by: string;\n now?: string;\n}\n\nconst KEYS = [\"revision\", \"paths\", \"by\", \"now\"];\nconst IN_FLIGHT = [\"in_progress\", \"review\", \"awaiting_human\"];\nconst bad = (what: string, fix: string): never =>\n fail(\"invalid-input\", `repo change: ${what}`, fix);\n\n/**\n * Records that `revision` changed `paths` (design spec section 27, #36): action `repo.change`\n * through `applyAction`, event `repo.changed { revision, paths }` with the paths deduplicated in\n * input order. No item status changes; `warnings` carries one `context-stale` warning per item in\n * `in_progress`, `review` or `awaiting_human` whose context snapshot this change made stale (a\n * cited path it changed that was not stale already). Refuses `invalid-input` for an unknown key,\n * an empty revision, and paths that are not a non-empty array of repository-relative POSIX paths.\n */\nexport function recordRepoChange<N extends string>(\n state: WorkflowState<N>,\n methodology: Methodology<unknown, N>,\n input: RepoChangeInput,\n): ApplyResult<N> {\n if (typeof input !== \"object\" || input === null || Array.isArray(input))\n bad(\"input must be an object\", `pass { ${KEYS.join(\", \")} }`);\n for (const k of Object.keys(input))\n if (!KEYS.includes(k)) bad(`unknown key \"${k}\"`, `use only: ${KEYS.join(\", \")}`);\n const { revision, paths, by, now } = input;\n if (typeof revision !== \"string\" || revision.trim() === \"\")\n bad(\"revision must be a non-empty string\", 'e.g. \"revision\": \"4f2c1e0\"');\n if (!Array.isArray(paths) || paths.length === 0)\n bad(\"paths must be a non-empty array of paths\", 'e.g. \"paths\": [\"src/cart.ts\"]');\n paths.forEach((p, i) => {\n const issue = repoPathIssue(p);\n if (issue)\n bad(\n `paths[${i}] ${issue}`,\n 'send paths as `git diff --name-only -z` lists them (NUL-separated, unquoted; or with `-c core.quotePath=false`), e.g. \"src/cart.ts\"',\n );\n });\n if (typeof by !== \"string\" || by === \"\") bad(\"by must name the reporter\", 'e.g. \"by\": \"ci\"');\n if (now !== undefined && typeof now !== \"string\")\n bad(\"now must be an ISO timestamp string\", \"omit now to use the clock\");\n const changed = [...new Set(paths)];\n const res = applyAction(\n state,\n methodology,\n { type: \"repo.change\", by, payload: { revision, paths: changed } },\n (s) => appendEvent(s, \"repo.changed\", by, { revision, paths: changed }, nowOf(now)),\n );\n const warnings: Violation[] = [];\n for (const item of Object.values(res.state.items)) {\n if (!IN_FLIGHT.includes(item.status)) continue;\n // the new event is the last one, so the paths it made stale are the cited changed paths that\n // were not stale before it, in its order: one indexed read of the earlier log per item\n const ctx = contextOf(state, item);\n if (!ctx) continue;\n const cited = new Set(ctx.assumptions.map((a) => a.source?.path));\n const was = new Set(ctx.stale);\n const hit = changed.filter((p) => cited.has(p) && !was.has(p));\n if (hit.length)\n warnings.push({\n rule: \"context-stale\",\n severity: \"warning\",\n item: item.id,\n message: `context snapshot \"${ctx.snapshot}\" of \"${item.id}\" is stale: ${hit.join(\", \")} changed at ${revision}`,\n fix: `re-verify and record a fresh snapshot of \"${item.id}\" with recordContextSnapshot`,\n });\n }\n return { state: res.state, warnings: [...res.warnings, ...warnings] };\n}\n","// `compareRuns` (design spec section 27, #34): a pure comparison of finished runs, one metric\n// vector per variant, a deterministic ranking and a winner or no winner. Scoring, the scenario\n// suite and running the variants stay with the host.\nimport { assertId, fail } from \"../core/errors.ts\";\nimport type { WorkflowState } from \"../core/types.ts\";\n\n/** One finished run of one variant on one scenario. */\nexport interface RunRecord {\n variant: string;\n scenario: string;\n state: WorkflowState<string>;\n /** The host scorer's verdict for this scenario run. */\n passed: boolean;\n}\n\nexport interface CompareRunsOptions {\n /** The variant every other one is compared with. */\n baseline: string;\n /** Scenarios any failing run of which makes a variant ineligible. */\n mustPass?: string[];\n /** Pass-rate noise, a fraction in `[0, 1]` (default `0`). */\n passTolerance?: number;\n /** Token-cost noise, a fraction in `[0, 1]` (default `0`). */\n costTolerance?: number;\n}\n\nexport interface RunMetrics {\n tokens: number;\n durationMs: number;\n turns: number;\n humanInterventions: number;\n reworks: number;\n escalations: number;\n itemsDone: number;\n}\n\nexport interface VariantResult {\n variant: string;\n runs: number;\n passed: number;\n passRate: number;\n mean: RunMetrics;\n /** Must-pass scenarios with at least one failing run. */\n regressions: string[];\n /** Baseline or must-pass scenarios the variant never ran. */\n missing: string[];\n eligible: boolean;\n}\n\nexport interface RunComparison {\n baseline: string;\n /** Ranked: eligible first, then pass rate, tokens, duration, interventions, id. */\n variants: VariantResult[];\n winner: string | null;\n reason: string;\n}\n\nconst OPTION_KEYS = [\"baseline\", \"mustPass\", \"passTolerance\", \"costTolerance\"];\nconst METRICS = [\n \"tokens\",\n \"durationMs\",\n \"turns\",\n \"humanInterventions\",\n \"reworks\",\n \"escalations\",\n \"itemsDone\",\n] as const;\n\nconst bad = (what: string, fix: string): never =>\n fail(\"invalid-input\", `compareRuns: ${what}`, fix);\nconst show = (v: unknown): string =>\n typeof v === \"string\"\n ? JSON.stringify(v)\n : typeof v === \"object\" && v !== null\n ? Array.isArray(v)\n ? \"an array\"\n : \"an object\"\n : typeof v === \"function\" || typeof v === \"symbol\"\n ? typeof v\n : String(v);\nconst isObject = (v: unknown): v is Record<string, unknown> =>\n typeof v === \"object\" && v !== null && !Array.isArray(v);\n/** `o[k]` when `o` has it as an own property: inherited values (a `{ __proto__: … }` literal) are not read. */\nconst own = (o: Record<string, unknown>, k: string): unknown =>\n Object.hasOwn(o, k) ? o[k] : undefined;\nconst finite = (v: number, what: string): number =>\n Number.isFinite(v)\n ? v\n : bad(`${what} is not finite (${v})`, \"pass the host's measured usage figures\");\nconst idOf = (v: unknown, what: string): string => {\n if (typeof v !== \"string\")\n bad(`${what} is ${show(v)}, not an id`, `pass a string id such as \"V0\"`);\n assertId(v, what);\n return v as string;\n};\nconst tolerance = (v: unknown, key: string): number => {\n if (v === undefined) return 0;\n if (typeof v !== \"number\" || !Number.isFinite(v) || v < 0 || v > 1)\n bad(`${key} is ${show(v)}, not a fraction in [0, 1]`, `pass e.g. \"${key}\": 0.05`);\n return v as number;\n};\n\nfunction metricsOf(state: unknown, where: string): RunMetrics {\n if (!isObject(state))\n return bad(\n `${where}.state is ${show(state)}, not a workflow state`,\n \"pass the finished state.json\",\n );\n const [events, accounting, items] = [\"events\", \"accounting\", \"items\"].map((k) => own(state, k));\n if (!Array.isArray(events) || !Array.isArray(accounting))\n return bad(\n `${where}.state has no events and accounting arrays`,\n \"pass a WorkflowState as loaded by loadState\",\n );\n if (!isObject(items))\n return bad(\n `${where}.state.items is ${show(items)}, not an object`,\n \"pass a WorkflowState as loaded by loadState\",\n );\n const m: RunMetrics = {\n tokens: 0,\n durationMs: 0,\n turns: accounting.length,\n humanInterventions: 0,\n reworks: 0,\n escalations: 0,\n itemsDone: 0,\n };\n accounting.forEach((line: unknown, i) => {\n if (!isObject(line))\n return bad(\n `${where}.state.accounting[${i}] is ${show(line)}`,\n \"pass accounting lines as recorded by complete\",\n );\n for (const k of [\"tokensIn\", \"tokensOut\", \"durationMs\"]) {\n const v = own(line, k);\n if (typeof v !== \"number\" || !Number.isFinite(v) || v < 0)\n bad(\n `${where}.state.accounting[${i}].${k} is ${show(v)}, not a finite non-negative number`,\n \"pass the host's measured usage figures\",\n );\n }\n m.tokens += (line[\"tokensIn\"] as number) + (line[\"tokensOut\"] as number);\n m.durationMs += line[\"durationMs\"] as number;\n });\n // finite figures can still sum to Infinity (G2-7)\n finite(m.tokens, `${where}.state token total`);\n finite(m.durationMs, `${where}.state duration total`);\n events.forEach((ev: unknown, i) => {\n if (!isObject(ev) || typeof own(ev, \"type\") !== \"string\")\n return bad(\n `${where}.state.events[${i}] is ${show(ev)}, not an event`,\n \"pass events as recorded by the engine\",\n );\n const t = ev[\"type\"];\n if (t === \"pending.raised\" || t === \"blocker.cleared\") m.humanInterventions++;\n else if (t === \"item.rework\") m.reworks++;\n else if (t === \"item.escalated\") m.escalations++;\n });\n for (const it of Object.values(items))\n if (isObject(it) && own(it, \"status\") === \"done\") m.itemsDone++;\n return m;\n}\n\n// summed in ascending order so the order of `runs` never changes a float result\nconst meanOf = (xs: number[]): number =>\n xs.sort((a, b) => a - b).reduce((s, x) => s + x, 0) / xs.length;\nconst byId = (a: string, b: string): number => (a < b ? -1 : a > b ? 1 : 0);\n\n/**\n * Compares finished runs (design spec section 27, #34). Pure: reads only its arguments and\n * returns fresh objects. Each variant gets a metric vector (the mean over its runs of tokens,\n * duration, turns, human interventions, reworks, escalations and done items), a pass rate (the\n * mean over its scenarios of each scenario's passing share, so every scenario weighs the same) and an\n * eligibility (no must-pass regression, nothing missing). The winner is the first ranked eligible\n * non-baseline variant that is not worse than the baseline on pass rate and better on pass rate\n * or tokens, beyond the tolerances; otherwise `null` with the reason. Refuses `invalid-input`\n * naming the offending value for malformed input, never a `TypeError`.\n */\nexport function compareRuns(\n runs: readonly RunRecord[],\n options: CompareRunsOptions,\n): RunComparison {\n if (!Array.isArray(runs))\n bad(\n `runs is ${show(runs)}, not an array`,\n \"pass an array of { variant, scenario, state, passed }\",\n );\n if (runs.length === 0) bad(\"no runs to compare\", \"pass at least the baseline's finished runs\");\n if (!isObject(options))\n return bad(`options is ${show(options)}, not an object`, 'pass { baseline: \"V0\" }');\n for (const k of Object.keys(options))\n if (!OPTION_KEYS.includes(k))\n bad(`unknown option \"${k}\"`, `use only: ${OPTION_KEYS.join(\", \")}`);\n const o = options as unknown as Record<string, unknown>;\n const baseline = idOf(own(o, \"baseline\"), \"baseline\");\n const must = own(o, \"mustPass\");\n if (must !== undefined && !Array.isArray(must))\n bad(`mustPass is ${show(must)}, not an array`, 'pass e.g. \"mustPass\": [\"s1\"]');\n const mustPass = [\n ...new Set(((must ?? []) as unknown[]).map((s) => idOf(s, \"mustPass scenario\"))),\n ];\n const passTol = tolerance(own(o, \"passTolerance\"), \"passTolerance\");\n const costTol = tolerance(own(o, \"costTolerance\"), \"costTolerance\");\n\n interface Acc {\n metrics: RunMetrics[];\n passed: number;\n /** scenario -> [passing runs, runs] */\n ran: Map<string, [number, number]>;\n failed: Set<string>;\n }\n const groups = new Map<string, Acc>();\n const named = new Set<string>();\n runs.forEach((r: unknown, i) => {\n const where = `runs[${i}]`;\n if (!isObject(r))\n return bad(\n `${where} is ${show(r)}, not a run record`,\n \"pass { variant, scenario, state, passed }\",\n );\n const variant = idOf(own(r, \"variant\"), `${where}.variant`);\n const scenario = idOf(own(r, \"scenario\"), `${where}.scenario`);\n const passed = own(r, \"passed\");\n if (typeof passed !== \"boolean\")\n bad(\n `${where}.passed is ${show(passed)}, not a boolean`,\n \"pass the scorer's verdict as true or false\",\n );\n const metrics = metricsOf(own(r, \"state\"), where);\n let g = groups.get(variant);\n if (!g)\n groups.set(variant, (g = { metrics: [], passed: 0, ran: new Map(), failed: new Set() }));\n g.metrics.push(metrics);\n const tally = g.ran.get(scenario) ?? [0, 0];\n g.ran.set(scenario, tally);\n tally[1]++;\n named.add(scenario);\n if (passed) {\n g.passed++;\n tally[0]++;\n } else g.failed.add(scenario);\n });\n const base = groups.get(baseline);\n if (!base) bad(`baseline \"${baseline}\" has no run`, \"name a variant that appears in runs\");\n for (const s of mustPass)\n if (!named.has(s))\n bad(`mustPass scenario \"${s}\" has no run`, \"name a scenario that appears in runs\");\n const required = [...new Set([...base!.ran.keys(), ...mustPass])].sort(byId);\n\n const results: VariantResult[] = [...groups].map(([variant, g]) => {\n const n = g.metrics.length;\n const mean = {} as RunMetrics;\n for (const k of METRICS)\n mean[k] = finite(meanOf(g.metrics.map((m) => m[k])), `variant ${variant} mean ${k}`);\n const regressions = mustPass.filter((s) => g.failed.has(s)).sort(byId);\n const missing = required.filter((s) => !g.ran.has(s));\n return {\n variant,\n runs: n,\n passed: g.passed,\n // scenario-weighted: each scenario counts once, whatever its number of runs (G1-3)\n passRate: meanOf([...g.ran.values()].map(([p, k]) => p / k)),\n mean,\n regressions,\n missing,\n eligible: regressions.length === 0 && missing.length === 0,\n };\n });\n results.sort(\n (a, b) =>\n Number(b.eligible) - Number(a.eligible) ||\n b.passRate - a.passRate ||\n a.mean.tokens - b.mean.tokens ||\n a.mean.durationMs - b.mean.durationMs ||\n a.mean.humanInterventions - b.mean.humanInterventions ||\n byId(a.variant, b.variant),\n );\n\n const ref = results.find((v) => v.variant === baseline)!;\n const win = results.find(\n (v) =>\n v.variant !== baseline &&\n v.eligible &&\n v.passRate >= ref.passRate - passTol &&\n (v.passRate > ref.passRate + passTol || v.mean.tokens < ref.mean.tokens * (1 - costTol)),\n );\n if (win)\n return {\n baseline,\n variants: results,\n winner: win.variant,\n reason: `${win.variant} beats baseline ${baseline}: pass rate ${win.passRate} vs ${ref.passRate}, mean tokens ${win.mean.tokens} vs ${ref.mean.tokens}`,\n };\n const others = results.filter((v) => v.variant !== baseline);\n let reason: string;\n if (others.length === 0) reason = `no variant to compare with baseline ${baseline}`;\n else if (others.some((v) => v.eligible))\n reason = `within noise: no eligible variant beats baseline ${baseline} beyond the tolerances`;\n else {\n const why = others\n .map((v) => `${v.variant} (${(v.regressions.length ? v.regressions : v.missing).join(\", \")})`)\n .join(\"; \");\n reason = `${others.some((v) => v.regressions.length) ? \"must-pass regression\" : \"no eligible variant, missing runs\"}: ${why}`;\n }\n return { baseline, variants: results, winner: null, reason };\n}\n"]}