ex-workflow 0.1.0-stage → 0.3.0-stage

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 (79) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +63 -11
  3. package/dist/chunk-23P7C25E.cjs +2 -0
  4. package/dist/chunk-23P7C25E.cjs.map +1 -0
  5. package/dist/chunk-2IKIBB73.cjs +2 -0
  6. package/dist/chunk-2IKIBB73.cjs.map +1 -0
  7. package/dist/chunk-4A4TD4MH.cjs +2 -0
  8. package/dist/chunk-4A4TD4MH.cjs.map +1 -0
  9. package/dist/chunk-7HZXZF3L.cjs +2 -0
  10. package/dist/chunk-7HZXZF3L.cjs.map +1 -0
  11. package/dist/chunk-AUZIQPFT.cjs +2 -0
  12. package/dist/chunk-AUZIQPFT.cjs.map +1 -0
  13. package/dist/chunk-BJEOTG6P.mjs +2 -0
  14. package/dist/chunk-BJEOTG6P.mjs.map +1 -0
  15. package/dist/chunk-FLCYD2QF.mjs +2 -0
  16. package/dist/chunk-FLCYD2QF.mjs.map +1 -0
  17. package/dist/chunk-NN3XJUHP.cjs +2 -0
  18. package/dist/chunk-NN3XJUHP.cjs.map +1 -0
  19. package/dist/chunk-P4P4JTE5.mjs +2 -0
  20. package/dist/chunk-P4P4JTE5.mjs.map +1 -0
  21. package/dist/chunk-R27STIER.mjs +2 -0
  22. package/dist/chunk-R27STIER.mjs.map +1 -0
  23. package/dist/chunk-TMKCALFT.cjs +2 -0
  24. package/dist/chunk-TMKCALFT.cjs.map +1 -0
  25. package/dist/chunk-UOGNVWVO.mjs +2 -0
  26. package/dist/chunk-UOGNVWVO.mjs.map +1 -0
  27. package/dist/chunk-WOKNWJKU.mjs +2 -0
  28. package/dist/chunk-WOKNWJKU.mjs.map +1 -0
  29. package/dist/chunk-ZX4DAMTG.mjs +2 -0
  30. package/dist/chunk-ZX4DAMTG.mjs.map +1 -0
  31. package/dist/cli/bin.cjs +1 -1
  32. package/dist/cli/bin.cjs.map +1 -1
  33. package/dist/cli/bin.mjs +1 -1
  34. package/dist/cli/bin.mjs.map +1 -1
  35. package/dist/cli/index.cjs +1 -1
  36. package/dist/cli/index.mjs +1 -1
  37. package/dist/index.cjs +1 -1
  38. package/dist/index.cjs.map +1 -1
  39. package/dist/index.d.cts +17 -16
  40. package/dist/index.d.ts +17 -16
  41. package/dist/index.mjs +1 -1
  42. package/dist/index.mjs.map +1 -1
  43. package/dist/kanban/index.cjs +2 -0
  44. package/dist/kanban/index.cjs.map +1 -0
  45. package/dist/kanban/index.d.cts +225 -0
  46. package/dist/kanban/index.d.ts +225 -0
  47. package/dist/kanban/index.mjs +2 -0
  48. package/dist/kanban/index.mjs.map +1 -0
  49. package/dist/roles-BLBRKhUZ.d.ts +14 -0
  50. package/dist/roles-aneKYJ3Z.d.cts +14 -0
  51. package/dist/scrum/index.cjs +1 -1
  52. package/dist/scrum/index.d.cts +3 -3
  53. package/dist/scrum/index.d.ts +3 -3
  54. package/dist/scrum/index.mjs +1 -1
  55. package/dist/types.d.cts +42 -3
  56. package/dist/types.d.ts +42 -3
  57. package/dist/waterfall/index.cjs +2 -0
  58. package/dist/waterfall/index.cjs.map +1 -0
  59. package/dist/waterfall/index.d.cts +148 -0
  60. package/dist/waterfall/index.d.ts +148 -0
  61. package/dist/waterfall/index.mjs +2 -0
  62. package/dist/waterfall/index.mjs.map +1 -0
  63. package/package.json +27 -1
  64. package/dist/chunk-5XAKW64K.cjs +0 -2
  65. package/dist/chunk-5XAKW64K.cjs.map +0 -1
  66. package/dist/chunk-B7MP6Y3W.mjs +0 -2
  67. package/dist/chunk-B7MP6Y3W.mjs.map +0 -1
  68. package/dist/chunk-CPGDAHAU.cjs +0 -2
  69. package/dist/chunk-CPGDAHAU.cjs.map +0 -1
  70. package/dist/chunk-D7U3ES2L.mjs +0 -2
  71. package/dist/chunk-D7U3ES2L.mjs.map +0 -1
  72. package/dist/chunk-DZ7AN6H5.mjs +0 -2
  73. package/dist/chunk-DZ7AN6H5.mjs.map +0 -1
  74. package/dist/chunk-LPQSNYYT.cjs +0 -2
  75. package/dist/chunk-LPQSNYYT.cjs.map +0 -1
  76. package/dist/chunk-ROH3RYBI.mjs +0 -2
  77. package/dist/chunk-ROH3RYBI.mjs.map +0 -1
  78. package/dist/chunk-WAMNJUQ4.cjs +0 -2
  79. package/dist/chunk-WAMNJUQ4.cjs.map +0 -1
package/dist/index.d.cts CHANGED
@@ -1,5 +1,6 @@
1
- import { ErrorCode, WorkflowState, MethodologyName, Stage, Role, Event, Capability, WorkItem, Evidence, NewItem, ItemStatus, Policy, Violation, Gate, Transition, PendingHuman, Budget, Accounting, Iteration, Methodology, Brief, Handoff, ApplyResult, Rule, Action } from './types.cjs';
2
- export { Baseline, Blocker, Ceremony, CeremonyInput, ClassOfService, CoreTerm, GateRequirement, ItemType, Lesson, LessonChange, ModelTier, Phase, PlannerOptions, Verdict } from './types.cjs';
1
+ import { ErrorCode, WorkflowState, MethodologyName, Stage, Role, Event, WorkItem, Evidence, NewItem, ItemStatus, Policy, Violation, Gate, Methodology, Transition, PendingHuman, Budget, Accounting, Iteration, Brief, Handoff, ApplyResult, Rule, Action } from './types.cjs';
2
+ export { Baseline, Blocker, Capability, Ceremony, CeremonyInput, ClassOfService, CoreTerm, GateRequirement, ImpactAnalysis, ItemType, Lesson, LessonChange, ModelTier, Phase, PlannerOptions, Produced, Verdict } from './types.cjs';
3
+ export { a as approversFor, c as canDo, h as hasCapability, r as registerRole, b as requireCap, d as requireCapabilities, e as retireRole, f as rolesWith, s as separationLost } from './roles-aneKYJ3Z.cjs';
3
4
  import { ExNode } from 'ex-flow';
4
5
 
5
6
  interface WorkflowErrorExtra {
@@ -36,14 +37,6 @@ declare function createState(input: CreateStateInput): WorkflowState;
36
37
  declare function appendEvent(state: WorkflowState, type: string, by: string, payload: unknown, now?: string): WorkflowState;
37
38
  declare function lastEvent(state: WorkflowState, type?: string): Event | undefined;
38
39
 
39
- declare function registerRole(state: WorkflowState, role: Role, by: string, now?: string): WorkflowState;
40
- declare function retireRole(state: WorkflowState, roleId: string, by: string, now?: string): WorkflowState;
41
- declare function hasCapability(role: Role, cap: Capability): boolean;
42
- declare function rolesWith(state: WorkflowState, cap: Capability): Role[];
43
- declare function approversFor(state: WorkflowState, gateId: string): Role[];
44
- declare function requireCapabilities(state: WorkflowState, required: Capability[], exclusive: Capability[]): void;
45
- declare function separationLost(state: WorkflowState, required: Capability[]): Role[];
46
-
47
40
  declare function stageOf(state: WorkflowState, stageId: string): Stage;
48
41
  declare function nextStageOf(state: WorkflowState, stageId: string): Stage | undefined;
49
42
  declare function isTerminalStage(state: WorkflowState, stageId: string): boolean;
@@ -76,7 +69,7 @@ declare function lastDispatchBefore(state: WorkflowState, item: WorkItem): Trans
76
69
  declare function authorOf(state: WorkflowState, item: WorkItem): string | undefined;
77
70
  declare function checkGate(state: WorkflowState, item: WorkItem, gate: Gate, by: string): GateResult;
78
71
  declare function raisePending(state: WorkflowState, pending: Omit<PendingHuman, "id" | "raisedAt">, now?: string): WorkflowState;
79
- declare function decide(state: WorkflowState, pendingId: string, decision: "approve" | "reject", by: string, note: string, now?: string): WorkflowState;
72
+ declare function decide(state: WorkflowState, pendingId: string, decision: "approve" | "reject", by: string, note: string, now?: string, methodology?: Methodology): WorkflowState;
80
73
 
81
74
  declare const ZERO_SPENT: Required<Budget>;
82
75
  declare function addSpent(spent: Required<Budget>, acc: Accounting): Required<Budget>;
@@ -88,18 +81,25 @@ type NodeData = {
88
81
  id: string;
89
82
  };
90
83
  declare function openIteration(state: WorkflowState): Iteration | undefined;
91
- declare function assignRole(state: WorkflowState, item: WorkItem): Role;
84
+ declare function assignRole(state: WorkflowState, item: WorkItem, roleFor?: (item: WorkItem) => string | undefined): Role;
92
85
  declare function resourceCapsFor(state: WorkflowState): Record<string, number>;
93
- declare function toExNodes(items: WorkItem[], state: WorkflowState): ExNode<NodeData>[];
86
+ declare function toExNodes(items: WorkItem[], state: WorkflowState, priorityOf?: (item: WorkItem) => number | undefined, roleFor?: (item: WorkItem) => string | undefined): ExNode<NodeData>[];
94
87
  interface PlanOptions {
95
88
  max?: number;
96
89
  now?: string;
97
90
  fallbackTokensPerWeight?: number;
98
91
  }
99
- type PlanReason = "no-candidates" | "budget-exhausted" | "wip-full";
92
+ type PlanReason = "no-candidates" | "budget-exhausted" | "wip-full" | "policy-blocked";
93
+ /** A ready item the planner did not pull, and why. */
94
+ interface Skipped {
95
+ id: string;
96
+ reason: "entry-policy" | "wip" | "resource-cap" | "budget";
97
+ detail: string;
98
+ }
100
99
  interface PlanResult {
101
100
  state: WorkflowState;
102
101
  dispatched: WorkItem[];
102
+ skipped: Skipped[];
103
103
  reason?: PlanReason;
104
104
  }
105
105
  declare function plan(state: WorkflowState, methodology: Methodology, opts?: PlanOptions): PlanResult;
@@ -108,6 +108,7 @@ declare function synthesizeBrief(state: WorkflowState, methodology: Methodology,
108
108
  interface NextResult {
109
109
  state: WorkflowState;
110
110
  briefs: Brief[];
111
+ skipped: Skipped[];
111
112
  reason?: PlanReason;
112
113
  }
113
114
  declare function next(state: WorkflowState, methodology: Methodology, opts?: PlanOptions): NextResult;
@@ -128,6 +129,6 @@ interface InitInput<C> {
128
129
  }
129
130
  declare function init<C>(input: InitInput<C>): ApplyResult;
130
131
 
131
- declare const VERSION = "0.1.0-stage";
132
+ declare const VERSION = "0.3.0-stage";
132
133
 
133
- export { Accounting, Action, ApplyResult, Brief, Budget, Capability, ErrorCode, Event, Evidence, Gate, type GateResult, Handoff, type InitInput, type ItemPatch, ItemStatus, Iteration, Methodology, MethodologyName, NewItem, type NextResult, PendingHuman, type PlanOptions, type PlanReason, type PlanResult, Policy, Role, Rule, Stage, Transition, VERSION, Violation, WorkItem, WorkflowError, WorkflowState, ZERO_SPENT, addEvidence, addItem, addSpent, appendEvent, applyAction, approversFor, assertId, assertPolicies, assignRole, authorOf, checkGate, clearBlocker, complete, coreRulesFor, createState, decide, editItem, estimateTokens, evaluatePolicies, fail, getItem, hasCapability, init, isExhausted, isTerminalStage, lastDispatchBefore, lastEvent, moveItem, next, nextStageOf, nowOf, openIteration, plan, raiseBlocker, raisePending, registerRole, remaining, requireCapabilities, resourceCapsFor, retireRole, rolesWith, separationLost, stageOf, synthesizeBrief, toExNodes, validateAction };
134
+ export { Accounting, Action, ApplyResult, Brief, Budget, ErrorCode, Event, Evidence, Gate, type GateResult, Handoff, type InitInput, type ItemPatch, ItemStatus, Iteration, Methodology, MethodologyName, NewItem, type NextResult, PendingHuman, type PlanOptions, type PlanReason, type PlanResult, Policy, Role, Rule, type Skipped, Stage, Transition, VERSION, Violation, WorkItem, WorkflowError, WorkflowState, ZERO_SPENT, addEvidence, addItem, addSpent, appendEvent, applyAction, assertId, assertPolicies, assignRole, authorOf, checkGate, clearBlocker, complete, coreRulesFor, createState, decide, editItem, estimateTokens, evaluatePolicies, fail, getItem, init, isExhausted, isTerminalStage, lastDispatchBefore, lastEvent, moveItem, next, nextStageOf, nowOf, openIteration, plan, raiseBlocker, raisePending, remaining, resourceCapsFor, stageOf, synthesizeBrief, toExNodes, validateAction };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { ErrorCode, WorkflowState, MethodologyName, Stage, Role, Event, Capability, WorkItem, Evidence, NewItem, ItemStatus, Policy, Violation, Gate, Transition, PendingHuman, Budget, Accounting, Iteration, Methodology, Brief, Handoff, ApplyResult, Rule, Action } from './types.js';
2
- export { Baseline, Blocker, Ceremony, CeremonyInput, ClassOfService, CoreTerm, GateRequirement, ItemType, Lesson, LessonChange, ModelTier, Phase, PlannerOptions, Verdict } from './types.js';
1
+ import { ErrorCode, WorkflowState, MethodologyName, Stage, Role, Event, WorkItem, Evidence, NewItem, ItemStatus, Policy, Violation, Gate, Methodology, Transition, PendingHuman, Budget, Accounting, Iteration, Brief, Handoff, ApplyResult, Rule, Action } from './types.js';
2
+ export { Baseline, Blocker, Capability, Ceremony, CeremonyInput, ClassOfService, CoreTerm, GateRequirement, ImpactAnalysis, ItemType, Lesson, LessonChange, ModelTier, Phase, PlannerOptions, Produced, Verdict } from './types.js';
3
+ export { a as approversFor, c as canDo, h as hasCapability, r as registerRole, b as requireCap, d as requireCapabilities, e as retireRole, f as rolesWith, s as separationLost } from './roles-BLBRKhUZ.js';
3
4
  import { ExNode } from 'ex-flow';
4
5
 
5
6
  interface WorkflowErrorExtra {
@@ -36,14 +37,6 @@ declare function createState(input: CreateStateInput): WorkflowState;
36
37
  declare function appendEvent(state: WorkflowState, type: string, by: string, payload: unknown, now?: string): WorkflowState;
37
38
  declare function lastEvent(state: WorkflowState, type?: string): Event | undefined;
38
39
 
39
- declare function registerRole(state: WorkflowState, role: Role, by: string, now?: string): WorkflowState;
40
- declare function retireRole(state: WorkflowState, roleId: string, by: string, now?: string): WorkflowState;
41
- declare function hasCapability(role: Role, cap: Capability): boolean;
42
- declare function rolesWith(state: WorkflowState, cap: Capability): Role[];
43
- declare function approversFor(state: WorkflowState, gateId: string): Role[];
44
- declare function requireCapabilities(state: WorkflowState, required: Capability[], exclusive: Capability[]): void;
45
- declare function separationLost(state: WorkflowState, required: Capability[]): Role[];
46
-
47
40
  declare function stageOf(state: WorkflowState, stageId: string): Stage;
48
41
  declare function nextStageOf(state: WorkflowState, stageId: string): Stage | undefined;
49
42
  declare function isTerminalStage(state: WorkflowState, stageId: string): boolean;
@@ -76,7 +69,7 @@ declare function lastDispatchBefore(state: WorkflowState, item: WorkItem): Trans
76
69
  declare function authorOf(state: WorkflowState, item: WorkItem): string | undefined;
77
70
  declare function checkGate(state: WorkflowState, item: WorkItem, gate: Gate, by: string): GateResult;
78
71
  declare function raisePending(state: WorkflowState, pending: Omit<PendingHuman, "id" | "raisedAt">, now?: string): WorkflowState;
79
- declare function decide(state: WorkflowState, pendingId: string, decision: "approve" | "reject", by: string, note: string, now?: string): WorkflowState;
72
+ declare function decide(state: WorkflowState, pendingId: string, decision: "approve" | "reject", by: string, note: string, now?: string, methodology?: Methodology): WorkflowState;
80
73
 
81
74
  declare const ZERO_SPENT: Required<Budget>;
82
75
  declare function addSpent(spent: Required<Budget>, acc: Accounting): Required<Budget>;
@@ -88,18 +81,25 @@ type NodeData = {
88
81
  id: string;
89
82
  };
90
83
  declare function openIteration(state: WorkflowState): Iteration | undefined;
91
- declare function assignRole(state: WorkflowState, item: WorkItem): Role;
84
+ declare function assignRole(state: WorkflowState, item: WorkItem, roleFor?: (item: WorkItem) => string | undefined): Role;
92
85
  declare function resourceCapsFor(state: WorkflowState): Record<string, number>;
93
- declare function toExNodes(items: WorkItem[], state: WorkflowState): ExNode<NodeData>[];
86
+ declare function toExNodes(items: WorkItem[], state: WorkflowState, priorityOf?: (item: WorkItem) => number | undefined, roleFor?: (item: WorkItem) => string | undefined): ExNode<NodeData>[];
94
87
  interface PlanOptions {
95
88
  max?: number;
96
89
  now?: string;
97
90
  fallbackTokensPerWeight?: number;
98
91
  }
99
- type PlanReason = "no-candidates" | "budget-exhausted" | "wip-full";
92
+ type PlanReason = "no-candidates" | "budget-exhausted" | "wip-full" | "policy-blocked";
93
+ /** A ready item the planner did not pull, and why. */
94
+ interface Skipped {
95
+ id: string;
96
+ reason: "entry-policy" | "wip" | "resource-cap" | "budget";
97
+ detail: string;
98
+ }
100
99
  interface PlanResult {
101
100
  state: WorkflowState;
102
101
  dispatched: WorkItem[];
102
+ skipped: Skipped[];
103
103
  reason?: PlanReason;
104
104
  }
105
105
  declare function plan(state: WorkflowState, methodology: Methodology, opts?: PlanOptions): PlanResult;
@@ -108,6 +108,7 @@ declare function synthesizeBrief(state: WorkflowState, methodology: Methodology,
108
108
  interface NextResult {
109
109
  state: WorkflowState;
110
110
  briefs: Brief[];
111
+ skipped: Skipped[];
111
112
  reason?: PlanReason;
112
113
  }
113
114
  declare function next(state: WorkflowState, methodology: Methodology, opts?: PlanOptions): NextResult;
@@ -128,6 +129,6 @@ interface InitInput<C> {
128
129
  }
129
130
  declare function init<C>(input: InitInput<C>): ApplyResult;
130
131
 
131
- declare const VERSION = "0.1.0-stage";
132
+ declare const VERSION = "0.3.0-stage";
132
133
 
133
- export { Accounting, Action, ApplyResult, Brief, Budget, Capability, ErrorCode, Event, Evidence, Gate, type GateResult, Handoff, type InitInput, type ItemPatch, ItemStatus, Iteration, Methodology, MethodologyName, NewItem, type NextResult, PendingHuman, type PlanOptions, type PlanReason, type PlanResult, Policy, Role, Rule, Stage, Transition, VERSION, Violation, WorkItem, WorkflowError, WorkflowState, ZERO_SPENT, addEvidence, addItem, addSpent, appendEvent, applyAction, approversFor, assertId, assertPolicies, assignRole, authorOf, checkGate, clearBlocker, complete, coreRulesFor, createState, decide, editItem, estimateTokens, evaluatePolicies, fail, getItem, hasCapability, init, isExhausted, isTerminalStage, lastDispatchBefore, lastEvent, moveItem, next, nextStageOf, nowOf, openIteration, plan, raiseBlocker, raisePending, registerRole, remaining, requireCapabilities, resourceCapsFor, retireRole, rolesWith, separationLost, stageOf, synthesizeBrief, toExNodes, validateAction };
134
+ export { Accounting, Action, ApplyResult, Brief, Budget, ErrorCode, Event, Evidence, Gate, type GateResult, Handoff, type InitInput, type ItemPatch, ItemStatus, Iteration, Methodology, MethodologyName, NewItem, type NextResult, PendingHuman, type PlanOptions, type PlanReason, type PlanResult, Policy, Role, Rule, type Skipped, Stage, Transition, VERSION, Violation, WorkItem, WorkflowError, WorkflowState, ZERO_SPENT, addEvidence, addItem, addSpent, appendEvent, applyAction, assertId, assertPolicies, assignRole, authorOf, checkGate, clearBlocker, complete, coreRulesFor, createState, decide, editItem, estimateTokens, evaluatePolicies, fail, getItem, init, isExhausted, isTerminalStage, lastDispatchBefore, lastEvent, moveItem, next, nextStageOf, nowOf, openIteration, plan, raiseBlocker, raisePending, remaining, resourceCapsFor, stageOf, synthesizeBrief, toExNodes, validateAction };
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import'./chunk-KIQOUUEZ.mjs';export{c as complete,b as next,a as synthesizeBrief}from'./chunk-B7MP6Y3W.mjs';export{I as ZERO_SPENT,w as addEvidence,t as addItem,J as addSpent,c as appendEvent,U as applyAction,k as approversFor,C as assertPolicies,O as assignRole,E as authorOf,F as checkGate,y as clearBlocker,S as coreRulesFor,b as createState,H as decide,u as editItem,M as estimateTokens,B as evaluatePolicies,s as getItem,h as hasCapability,V as init,L as isExhausted,p as isTerminalStage,D as lastDispatchBefore,d as lastEvent,v as moveItem,o as nextStageOf,a as nowOf,N as openIteration,R as plan,x as raiseBlocker,G as raisePending,f as registerRole,K as remaining,l as requireCapabilities,P as resourceCapsFor,g as retireRole,i as rolesWith,m as separationLost,n as stageOf,Q as toExNodes,T as validateAction}from'./chunk-D7U3ES2L.mjs';export{a as WorkflowError,c as assertId,b as fail}from'./chunk-2FRRD6A3.mjs';var M="0.1.0-stage";export{M as VERSION};//# sourceMappingURL=index.mjs.map
1
+ import'./chunk-KIQOUUEZ.mjs';export{c as complete,b as next,a as synthesizeBrief}from'./chunk-WOKNWJKU.mjs';export{a as ZERO_SPENT,b as addSpent,g as assignRole,e as estimateTokens,d as isExhausted,f as openIteration,j as plan,c as remaining,h as resourceCapsFor,i as toExNodes}from'./chunk-ZX4DAMTG.mjs';export{y as addEvidence,v as addItem,c as appendEvent,M as applyAction,k as approversFor,E as assertPolicies,G as authorOf,n as canDo,H as checkGate,A as clearBlocker,K as coreRulesFor,b as createState,J as decide,w as editItem,D as evaluatePolicies,u as getItem,h as hasCapability,N as init,r as isTerminalStage,F as lastDispatchBefore,d as lastEvent,x as moveItem,q as nextStageOf,a as nowOf,z as raiseBlocker,I as raisePending,f as registerRole,o as requireCap,l as requireCapabilities,g as retireRole,i as rolesWith,m as separationLost,p as stageOf,L as validateAction}from'./chunk-FLCYD2QF.mjs';export{a as WorkflowError,c as assertId,b as fail}from'./chunk-2FRRD6A3.mjs';var U="0.3.0-stage";export{U as VERSION};//# sourceMappingURL=index.mjs.map
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":["VERSION"],"mappings":"y5BAAO,IAAMA,CAAAA,CAAU","file":"index.mjs","sourcesContent":["export const VERSION = \"0.1.0-stage\";\nexport * from \"./types.ts\";\nexport { WorkflowError, fail } from \"./errors.ts\";\nexport { createState, appendEvent, lastEvent, nowOf } from \"./state.ts\";\nexport {\n registerRole,\n retireRole,\n hasCapability,\n rolesWith,\n approversFor,\n requireCapabilities,\n separationLost,\n} from \"./roles.ts\";\nexport {\n assertId,\n stageOf,\n nextStageOf,\n isTerminalStage,\n getItem,\n addItem,\n editItem,\n moveItem,\n addEvidence,\n raiseBlocker,\n clearBlocker,\n} from \"./items.ts\";\nexport type { ItemPatch } from \"./items.ts\";\nexport { evaluatePolicies, assertPolicies } from \"./policies.ts\";\nexport { checkGate, authorOf, lastDispatchBefore, raisePending, decide } from \"./gates.ts\";\nexport type { GateResult } from \"./gates.ts\";\nexport { ZERO_SPENT, addSpent, remaining, isExhausted, estimateTokens } from \"./budget.ts\";\nexport { plan, toExNodes, assignRole, resourceCapsFor, openIteration } from \"./planner.ts\";\nexport type { PlanOptions, PlanReason, PlanResult } from \"./planner.ts\";\nexport { synthesizeBrief, next } from \"./brief.ts\";\nexport type { NextResult } from \"./brief.ts\";\nexport { complete } from \"./complete.ts\";\nexport { coreRulesFor } from \"./rules.ts\";\nexport { applyAction, validateAction, init } from \"./methodology.ts\";\nexport type { InitInput } from \"./methodology.ts\";\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":["VERSION"],"mappings":"s9BAAO,IAAMA,CAAAA,CAAU","file":"index.mjs","sourcesContent":["export const VERSION = \"0.3.0-stage\";\nexport * from \"./types.ts\";\nexport { WorkflowError, fail } from \"./errors.ts\";\nexport { createState, appendEvent, lastEvent, nowOf } from \"./state.ts\";\nexport {\n registerRole,\n retireRole,\n hasCapability,\n rolesWith,\n approversFor,\n requireCapabilities,\n separationLost,\n canDo,\n requireCap,\n} from \"./roles.ts\";\nexport {\n assertId,\n stageOf,\n nextStageOf,\n isTerminalStage,\n getItem,\n addItem,\n editItem,\n moveItem,\n addEvidence,\n raiseBlocker,\n clearBlocker,\n} from \"./items.ts\";\nexport type { ItemPatch } from \"./items.ts\";\nexport { evaluatePolicies, assertPolicies } from \"./policies.ts\";\nexport { checkGate, authorOf, lastDispatchBefore, raisePending, decide } from \"./gates.ts\";\nexport type { GateResult } from \"./gates.ts\";\nexport { ZERO_SPENT, addSpent, remaining, isExhausted, estimateTokens } from \"./budget.ts\";\nexport { plan, toExNodes, assignRole, resourceCapsFor, openIteration } from \"./planner.ts\";\nexport type { PlanOptions, PlanReason, PlanResult, Skipped } from \"./planner.ts\";\nexport { synthesizeBrief, next } from \"./brief.ts\";\nexport type { NextResult } from \"./brief.ts\";\nexport { complete } from \"./complete.ts\";\nexport { coreRulesFor } from \"./rules.ts\";\nexport { applyAction, validateAction, init } from \"./methodology.ts\";\nexport type { InitInput } from \"./methodology.ts\";\n"]}
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunk7HZXZF3L_cjs=require('../chunk-7HZXZF3L.cjs');require('../chunk-23P7C25E.cjs'),require('../chunk-S3BXVHO7.cjs');Object.defineProperty(exports,"ACTIVE",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.a}});Object.defineProperty(exports,"CADENCE_EVENT",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.s}});Object.defineProperty(exports,"CLASSES",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.k}});Object.defineProperty(exports,"DAY_MS",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.l}});Object.defineProperty(exports,"DEFAULT_COLUMNS",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.n}});Object.defineProperty(exports,"KANBAN_CADENCES",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.j}});Object.defineProperty(exports,"KANBAN_VOCABULARY",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.F}});Object.defineProperty(exports,"OPEN",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.b}});Object.defineProperty(exports,"activeExpedites",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.h}});Object.defineProperty(exports,"addedAt",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.p}});Object.defineProperty(exports,"board",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.r}});Object.defineProperty(exports,"byClassThenAge",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.H}});Object.defineProperty(exports,"cadencesDue",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.t}});Object.defineProperty(exports,"cardAge",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.q}});Object.defineProperty(exports,"columnIndex",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.f}});Object.defineProperty(exports,"columnStays",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.w}});Object.defineProperty(exports,"commitmentColumn",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.d}});Object.defineProperty(exports,"configOf",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.m}});Object.defineProperty(exports,"deliveryColumn",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.e}});Object.defineProperty(exports,"enteredStageAt",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.i}});Object.defineProperty(exports,"kanban",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.I}});Object.defineProperty(exports,"kanbanCeremonies",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.B}});Object.defineProperty(exports,"kanbanMetrics",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.x}});Object.defineProperty(exports,"kanbanRoles",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.C}});Object.defineProperty(exports,"kanbanRules",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.D}});Object.defineProperty(exports,"kanbanStages",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.E}});Object.defineProperty(exports,"onBoard",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.g}});Object.defineProperty(exports,"opsReport",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.y}});Object.defineProperty(exports,"optionsColumn",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.c}});Object.defineProperty(exports,"percentile",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.v}});Object.defineProperty(exports,"priorityByClass",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.G}});Object.defineProperty(exports,"replay",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.u}});Object.defineProperty(exports,"riskReport",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.z}});Object.defineProperty(exports,"validateKanbanConfig",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.o}});Object.defineProperty(exports,"wantItems",{enumerable:true,get:function(){return chunk7HZXZF3L_cjs.A}});//# sourceMappingURL=index.cjs.map
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
@@ -0,0 +1,225 @@
1
+ import { ClassOfService, Policy, WorkflowState, Role, Stage, Rule, Methodology, Ceremony, CeremonyInput, ItemStatus, WorkItem, Event, CoreTerm } from '../types.cjs';
2
+
3
+ type KanbanCadence = "replenishment" | "delivery-planning" | "service-delivery-review" | "operations-review" | "risk-review" | "strategy-review";
4
+ declare const KANBAN_CADENCES: readonly KanbanCadence[];
5
+ declare const CLASSES: readonly ClassOfService[];
6
+ declare const DAY_MS = 86400000;
7
+ interface KanbanColumn {
8
+ id: string;
9
+ name: string;
10
+ wipLimit?: number;
11
+ /** Explicit policies a card must satisfy before it LEAVES the column (checked by complete()). */
12
+ policies: Policy[];
13
+ commitmentPoint?: boolean;
14
+ deliveryPoint?: boolean;
15
+ /** Cards entering this column wait for a reviewer (status "review"). */
16
+ review?: boolean;
17
+ }
18
+ interface ServiceLevel {
19
+ percentile: number;
20
+ targetMs: number;
21
+ }
22
+ interface ClassConfig {
23
+ wipBypass?: number;
24
+ sle?: ServiceLevel;
25
+ }
26
+ interface KanbanConfig {
27
+ columns: KanbanColumn[];
28
+ classesOfService: Partial<Record<ClassOfService, ClassConfig>>;
29
+ fairness: {
30
+ aging: boolean;
31
+ maxDeferralRounds: number;
32
+ };
33
+ cadences: Partial<Record<KanbanCadence, {
34
+ everyTurns?: number;
35
+ }>>;
36
+ throughputWindowMs: number;
37
+ maxExpedite: number;
38
+ }
39
+ declare function configOf(state: WorkflowState): KanbanConfig;
40
+ declare const DEFAULT_COLUMNS: KanbanColumn[];
41
+ declare function validateKanbanConfig(raw: unknown): KanbanConfig;
42
+
43
+ declare function kanbanRoles(): Role[];
44
+
45
+ declare function kanbanStages(config: KanbanConfig): Stage[];
46
+
47
+ declare function kanbanRules(): Rule[];
48
+
49
+ /** input.items as a non-empty, duplicate-free string[] of existing item ids. */
50
+ declare function wantItems(state: WorkflowState, input: CeremonyInput, cadence: string): string[];
51
+ declare function kanbanCeremonies(methodology: () => Methodology): Record<string, Ceremony>;
52
+
53
+ /** Statuses that hold a WIP slot. */
54
+ declare const ACTIVE: ReadonlySet<ItemStatus>;
55
+ /** Every status but done and dropped: the cards on the board. */
56
+ declare const OPEN: ReadonlySet<ItemStatus>;
57
+ declare function optionsColumn(state: WorkflowState): Stage;
58
+ declare function commitmentColumn(state: WorkflowState): Stage;
59
+ declare function deliveryColumn(state: WorkflowState): Stage;
60
+ declare function columnIndex(state: WorkflowState, stageId: string): number;
61
+ /** Committed and not yet delivered: column index in [commitment, delivery). */
62
+ declare function onBoard(state: WorkflowState, item: WorkItem): boolean;
63
+ declare function activeExpedites(state: WorkflowState): string[];
64
+ /** ISO time the item last entered its current column; undefined when it was added there and never moved. */
65
+ declare function enteredStageAt(item: WorkItem): string | undefined;
66
+
67
+ interface BoardCard {
68
+ id: string;
69
+ title: string;
70
+ type: string;
71
+ status: ItemStatus;
72
+ classOfService: string;
73
+ role: string | null;
74
+ ageMs: number;
75
+ blocked: boolean;
76
+ deadline: string | null;
77
+ }
78
+ interface BoardColumn {
79
+ id: string;
80
+ name: string;
81
+ wipLimit: number | null;
82
+ active: number;
83
+ queued: number;
84
+ overLimit: boolean;
85
+ commitmentPoint: boolean;
86
+ deliveryPoint: boolean;
87
+ cards: BoardCard[];
88
+ }
89
+ /** Time the item was added (its item.added event), else the first event's time. */
90
+ declare function addedAt(state: WorkflowState, id: string): string;
91
+ declare function cardAge(state: WorkflowState, item: WorkItem, now: string): number;
92
+ declare function board(state: WorkflowState, now: string): BoardColumn[];
93
+ declare const CADENCE_EVENT: (c: KanbanCadence) => string;
94
+ interface CadenceStatus {
95
+ cadence: KanbanCadence;
96
+ everyTurns: number | null;
97
+ lastAt: string | null;
98
+ turnsSince: number;
99
+ due: boolean;
100
+ }
101
+ declare function cadencesDue(state: WorkflowState): CadenceStatus[];
102
+
103
+ interface OpsReport {
104
+ blockers: Array<{
105
+ item: string;
106
+ blocker: string;
107
+ owner: string;
108
+ reason: string;
109
+ ageMs: number;
110
+ }>;
111
+ agingWip: Array<{
112
+ item: string;
113
+ column: string;
114
+ status: string;
115
+ ageMs: number;
116
+ p85Ms: number | null;
117
+ overP85: boolean;
118
+ }>;
119
+ queued: Record<string, number>;
120
+ active: Record<string, number>;
121
+ }
122
+ declare function opsReport(state: WorkflowState, now: string): OpsReport;
123
+ interface RiskReport {
124
+ fixedDate: Array<{
125
+ item: string;
126
+ deadline: string;
127
+ timeLeftMs: number;
128
+ projectedRemainingMs: number | null;
129
+ atRisk: boolean;
130
+ }>;
131
+ staleBlockers: Array<{
132
+ item: string;
133
+ blocker: string;
134
+ owner: string;
135
+ ageMs: number;
136
+ }>;
137
+ expediteActive: string[];
138
+ }
139
+ declare function riskReport(state: WorkflowState, now: string, staleAfterMs: number): RiskReport;
140
+
141
+ interface Stay {
142
+ stage: string;
143
+ enteredAt: string;
144
+ leftAt?: string;
145
+ }
146
+ interface ReplayedItem {
147
+ id: string;
148
+ /** item type from item.added; "question" items are escalations, not deliveries */
149
+ type: string;
150
+ stage: string;
151
+ status: ItemStatus;
152
+ /** one entry per contiguous visit to a column; status changes inside a column do not end a stay */
153
+ stays: Stay[];
154
+ /** first entry into the commitment column */
155
+ committedAt?: string;
156
+ /** first entry into the delivery column */
157
+ deliveredAt?: string;
158
+ /** from the replenishment payload; "standard" when never replenished */
159
+ classOfService: ClassOfService;
160
+ deadline?: string;
161
+ /** closed in_progress intervals */
162
+ activeMs: number;
163
+ /** closed blocked intervals */
164
+ blockedMs: number;
165
+ /** the open status interval */
166
+ since: {
167
+ status: ItemStatus;
168
+ at: string;
169
+ };
170
+ }
171
+ interface ReplayedBlocker {
172
+ item: string;
173
+ blocker: string;
174
+ raisedAt: string;
175
+ clearedAt?: string;
176
+ }
177
+ interface Replay {
178
+ items: Map<string, ReplayedItem>;
179
+ blockers: ReplayedBlocker[];
180
+ /** time of the last event: the clock every "still open" measurement uses */
181
+ lastAt: string;
182
+ }
183
+ declare function replay(events: Event[], commitment: string, delivery: string): Replay;
184
+
185
+ interface KanbanMetrics {
186
+ leadTimeMs: number[];
187
+ leadTimeP50: number;
188
+ leadTimeP85: number;
189
+ cycleTimeMsByColumn: Record<string, number>;
190
+ throughput: number[];
191
+ wipByColumn: Record<string, number>;
192
+ flowEfficiency: number;
193
+ agingWipMs: Record<string, number>;
194
+ cumulativeFlow: Record<string, number>;
195
+ sleCompliance: Record<string, number>;
196
+ blockerTimeMs: number;
197
+ meanBlockerTimeMs: number;
198
+ }
199
+ /** Nearest-rank percentile; 0 for an empty list. */
200
+ declare function percentile(values: number[], p: number): number;
201
+ /** Completed stay durations per column. */
202
+ declare function columnStays(state: WorkflowState): Record<string, number[]>;
203
+ declare function kanbanMetrics(state: WorkflowState): KanbanMetrics;
204
+
205
+ declare const KANBAN_VOCABULARY: Record<CoreTerm, string>;
206
+
207
+ /** What the priority function needs besides the card: how long it has been passed over, and the fairness config. */
208
+ interface PriorityContext {
209
+ /** next() rounds that resolved since the card entered its column */
210
+ deferrals: number;
211
+ aging: boolean;
212
+ maxDeferralRounds: number;
213
+ }
214
+ /**
215
+ * Class band x 1e15 + an in-band offset. Bands: question 5, expedite 4, fixed-date 3, standard 2,
216
+ * intangible 1. Fixed-date: earlier deadline = larger offset. Others: own priority (clamped to +-1e9)
217
+ * plus, with aging, 4e9 per full window of maxDeferralRounds deferrals (priority decides within a window). An intangible card deferred that many
218
+ * times is scored in the standard band, so it overtakes fresh standard cards.
219
+ */
220
+ declare function priorityByClass(item: WorkItem, ctx: PriorityContext): number;
221
+ /** Class rank, then the card that has waited longest in its column, then id (FIFO by aging). */
222
+ declare function byClassThenAge(a: WorkItem, b: WorkItem): number;
223
+ declare function kanban(): Methodology<KanbanConfig>;
224
+
225
+ export { ACTIVE, type BoardCard, type BoardColumn, CADENCE_EVENT, CLASSES, type CadenceStatus, type ClassConfig, DAY_MS, DEFAULT_COLUMNS, KANBAN_CADENCES, KANBAN_VOCABULARY, type KanbanCadence, type KanbanColumn, type KanbanConfig, type KanbanMetrics, OPEN, type OpsReport, type PriorityContext, type Replay, type ReplayedBlocker, type ReplayedItem, type RiskReport, type ServiceLevel, type Stay, activeExpedites, addedAt, board, byClassThenAge, cadencesDue, cardAge, columnIndex, columnStays, commitmentColumn, configOf, deliveryColumn, enteredStageAt, kanban, kanbanCeremonies, kanbanMetrics, kanbanRoles, kanbanRules, kanbanStages, onBoard, opsReport, optionsColumn, percentile, priorityByClass, replay, riskReport, validateKanbanConfig, wantItems };
@@ -0,0 +1,225 @@
1
+ import { ClassOfService, Policy, WorkflowState, Role, Stage, Rule, Methodology, Ceremony, CeremonyInput, ItemStatus, WorkItem, Event, CoreTerm } from '../types.js';
2
+
3
+ type KanbanCadence = "replenishment" | "delivery-planning" | "service-delivery-review" | "operations-review" | "risk-review" | "strategy-review";
4
+ declare const KANBAN_CADENCES: readonly KanbanCadence[];
5
+ declare const CLASSES: readonly ClassOfService[];
6
+ declare const DAY_MS = 86400000;
7
+ interface KanbanColumn {
8
+ id: string;
9
+ name: string;
10
+ wipLimit?: number;
11
+ /** Explicit policies a card must satisfy before it LEAVES the column (checked by complete()). */
12
+ policies: Policy[];
13
+ commitmentPoint?: boolean;
14
+ deliveryPoint?: boolean;
15
+ /** Cards entering this column wait for a reviewer (status "review"). */
16
+ review?: boolean;
17
+ }
18
+ interface ServiceLevel {
19
+ percentile: number;
20
+ targetMs: number;
21
+ }
22
+ interface ClassConfig {
23
+ wipBypass?: number;
24
+ sle?: ServiceLevel;
25
+ }
26
+ interface KanbanConfig {
27
+ columns: KanbanColumn[];
28
+ classesOfService: Partial<Record<ClassOfService, ClassConfig>>;
29
+ fairness: {
30
+ aging: boolean;
31
+ maxDeferralRounds: number;
32
+ };
33
+ cadences: Partial<Record<KanbanCadence, {
34
+ everyTurns?: number;
35
+ }>>;
36
+ throughputWindowMs: number;
37
+ maxExpedite: number;
38
+ }
39
+ declare function configOf(state: WorkflowState): KanbanConfig;
40
+ declare const DEFAULT_COLUMNS: KanbanColumn[];
41
+ declare function validateKanbanConfig(raw: unknown): KanbanConfig;
42
+
43
+ declare function kanbanRoles(): Role[];
44
+
45
+ declare function kanbanStages(config: KanbanConfig): Stage[];
46
+
47
+ declare function kanbanRules(): Rule[];
48
+
49
+ /** input.items as a non-empty, duplicate-free string[] of existing item ids. */
50
+ declare function wantItems(state: WorkflowState, input: CeremonyInput, cadence: string): string[];
51
+ declare function kanbanCeremonies(methodology: () => Methodology): Record<string, Ceremony>;
52
+
53
+ /** Statuses that hold a WIP slot. */
54
+ declare const ACTIVE: ReadonlySet<ItemStatus>;
55
+ /** Every status but done and dropped: the cards on the board. */
56
+ declare const OPEN: ReadonlySet<ItemStatus>;
57
+ declare function optionsColumn(state: WorkflowState): Stage;
58
+ declare function commitmentColumn(state: WorkflowState): Stage;
59
+ declare function deliveryColumn(state: WorkflowState): Stage;
60
+ declare function columnIndex(state: WorkflowState, stageId: string): number;
61
+ /** Committed and not yet delivered: column index in [commitment, delivery). */
62
+ declare function onBoard(state: WorkflowState, item: WorkItem): boolean;
63
+ declare function activeExpedites(state: WorkflowState): string[];
64
+ /** ISO time the item last entered its current column; undefined when it was added there and never moved. */
65
+ declare function enteredStageAt(item: WorkItem): string | undefined;
66
+
67
+ interface BoardCard {
68
+ id: string;
69
+ title: string;
70
+ type: string;
71
+ status: ItemStatus;
72
+ classOfService: string;
73
+ role: string | null;
74
+ ageMs: number;
75
+ blocked: boolean;
76
+ deadline: string | null;
77
+ }
78
+ interface BoardColumn {
79
+ id: string;
80
+ name: string;
81
+ wipLimit: number | null;
82
+ active: number;
83
+ queued: number;
84
+ overLimit: boolean;
85
+ commitmentPoint: boolean;
86
+ deliveryPoint: boolean;
87
+ cards: BoardCard[];
88
+ }
89
+ /** Time the item was added (its item.added event), else the first event's time. */
90
+ declare function addedAt(state: WorkflowState, id: string): string;
91
+ declare function cardAge(state: WorkflowState, item: WorkItem, now: string): number;
92
+ declare function board(state: WorkflowState, now: string): BoardColumn[];
93
+ declare const CADENCE_EVENT: (c: KanbanCadence) => string;
94
+ interface CadenceStatus {
95
+ cadence: KanbanCadence;
96
+ everyTurns: number | null;
97
+ lastAt: string | null;
98
+ turnsSince: number;
99
+ due: boolean;
100
+ }
101
+ declare function cadencesDue(state: WorkflowState): CadenceStatus[];
102
+
103
+ interface OpsReport {
104
+ blockers: Array<{
105
+ item: string;
106
+ blocker: string;
107
+ owner: string;
108
+ reason: string;
109
+ ageMs: number;
110
+ }>;
111
+ agingWip: Array<{
112
+ item: string;
113
+ column: string;
114
+ status: string;
115
+ ageMs: number;
116
+ p85Ms: number | null;
117
+ overP85: boolean;
118
+ }>;
119
+ queued: Record<string, number>;
120
+ active: Record<string, number>;
121
+ }
122
+ declare function opsReport(state: WorkflowState, now: string): OpsReport;
123
+ interface RiskReport {
124
+ fixedDate: Array<{
125
+ item: string;
126
+ deadline: string;
127
+ timeLeftMs: number;
128
+ projectedRemainingMs: number | null;
129
+ atRisk: boolean;
130
+ }>;
131
+ staleBlockers: Array<{
132
+ item: string;
133
+ blocker: string;
134
+ owner: string;
135
+ ageMs: number;
136
+ }>;
137
+ expediteActive: string[];
138
+ }
139
+ declare function riskReport(state: WorkflowState, now: string, staleAfterMs: number): RiskReport;
140
+
141
+ interface Stay {
142
+ stage: string;
143
+ enteredAt: string;
144
+ leftAt?: string;
145
+ }
146
+ interface ReplayedItem {
147
+ id: string;
148
+ /** item type from item.added; "question" items are escalations, not deliveries */
149
+ type: string;
150
+ stage: string;
151
+ status: ItemStatus;
152
+ /** one entry per contiguous visit to a column; status changes inside a column do not end a stay */
153
+ stays: Stay[];
154
+ /** first entry into the commitment column */
155
+ committedAt?: string;
156
+ /** first entry into the delivery column */
157
+ deliveredAt?: string;
158
+ /** from the replenishment payload; "standard" when never replenished */
159
+ classOfService: ClassOfService;
160
+ deadline?: string;
161
+ /** closed in_progress intervals */
162
+ activeMs: number;
163
+ /** closed blocked intervals */
164
+ blockedMs: number;
165
+ /** the open status interval */
166
+ since: {
167
+ status: ItemStatus;
168
+ at: string;
169
+ };
170
+ }
171
+ interface ReplayedBlocker {
172
+ item: string;
173
+ blocker: string;
174
+ raisedAt: string;
175
+ clearedAt?: string;
176
+ }
177
+ interface Replay {
178
+ items: Map<string, ReplayedItem>;
179
+ blockers: ReplayedBlocker[];
180
+ /** time of the last event: the clock every "still open" measurement uses */
181
+ lastAt: string;
182
+ }
183
+ declare function replay(events: Event[], commitment: string, delivery: string): Replay;
184
+
185
+ interface KanbanMetrics {
186
+ leadTimeMs: number[];
187
+ leadTimeP50: number;
188
+ leadTimeP85: number;
189
+ cycleTimeMsByColumn: Record<string, number>;
190
+ throughput: number[];
191
+ wipByColumn: Record<string, number>;
192
+ flowEfficiency: number;
193
+ agingWipMs: Record<string, number>;
194
+ cumulativeFlow: Record<string, number>;
195
+ sleCompliance: Record<string, number>;
196
+ blockerTimeMs: number;
197
+ meanBlockerTimeMs: number;
198
+ }
199
+ /** Nearest-rank percentile; 0 for an empty list. */
200
+ declare function percentile(values: number[], p: number): number;
201
+ /** Completed stay durations per column. */
202
+ declare function columnStays(state: WorkflowState): Record<string, number[]>;
203
+ declare function kanbanMetrics(state: WorkflowState): KanbanMetrics;
204
+
205
+ declare const KANBAN_VOCABULARY: Record<CoreTerm, string>;
206
+
207
+ /** What the priority function needs besides the card: how long it has been passed over, and the fairness config. */
208
+ interface PriorityContext {
209
+ /** next() rounds that resolved since the card entered its column */
210
+ deferrals: number;
211
+ aging: boolean;
212
+ maxDeferralRounds: number;
213
+ }
214
+ /**
215
+ * Class band x 1e15 + an in-band offset. Bands: question 5, expedite 4, fixed-date 3, standard 2,
216
+ * intangible 1. Fixed-date: earlier deadline = larger offset. Others: own priority (clamped to +-1e9)
217
+ * plus, with aging, 4e9 per full window of maxDeferralRounds deferrals (priority decides within a window). An intangible card deferred that many
218
+ * times is scored in the standard band, so it overtakes fresh standard cards.
219
+ */
220
+ declare function priorityByClass(item: WorkItem, ctx: PriorityContext): number;
221
+ /** Class rank, then the card that has waited longest in its column, then id (FIFO by aging). */
222
+ declare function byClassThenAge(a: WorkItem, b: WorkItem): number;
223
+ declare function kanban(): Methodology<KanbanConfig>;
224
+
225
+ export { ACTIVE, type BoardCard, type BoardColumn, CADENCE_EVENT, CLASSES, type CadenceStatus, type ClassConfig, DAY_MS, DEFAULT_COLUMNS, KANBAN_CADENCES, KANBAN_VOCABULARY, type KanbanCadence, type KanbanColumn, type KanbanConfig, type KanbanMetrics, OPEN, type OpsReport, type PriorityContext, type Replay, type ReplayedBlocker, type ReplayedItem, type RiskReport, type ServiceLevel, type Stay, activeExpedites, addedAt, board, byClassThenAge, cadencesDue, cardAge, columnIndex, columnStays, commitmentColumn, configOf, deliveryColumn, enteredStageAt, kanban, kanbanCeremonies, kanbanMetrics, kanbanRoles, kanbanRules, kanbanStages, onBoard, opsReport, optionsColumn, percentile, priorityByClass, replay, riskReport, validateKanbanConfig, wantItems };
@@ -0,0 +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-UOGNVWVO.mjs';import'../chunk-FLCYD2QF.mjs';import'../chunk-2FRRD6A3.mjs';//# sourceMappingURL=index.mjs.map
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs"}