ex-workflow 1.2.0 → 1.3.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.
- package/CHANGELOG.md +25 -0
- package/README.md +145 -13
- package/dist/adapters/index.cjs +1 -1
- package/dist/adapters/index.d.cts +1 -1
- package/dist/adapters/index.d.ts +1 -1
- package/dist/adapters/index.mjs +1 -1
- package/dist/{budget-Gckmqj74.d.ts → budget-BuQ9GWsg.d.ts} +1 -1
- package/dist/{budget-Bm839Qw0.d.cts → budget-DDqQQIgp.d.cts} +1 -1
- package/dist/{chunk-VXOZIP77.cjs → chunk-2FBA7RBS.cjs} +2 -2
- package/dist/{chunk-VXOZIP77.cjs.map → chunk-2FBA7RBS.cjs.map} +1 -1
- package/dist/chunk-3S7F5QXK.mjs +2 -0
- package/dist/{chunk-BYPFTO7P.mjs.map → chunk-3S7F5QXK.mjs.map} +1 -1
- package/dist/{chunk-K4VSMIJZ.cjs → chunk-3ZUBCA7Q.cjs} +2 -2
- package/dist/{chunk-K4VSMIJZ.cjs.map → chunk-3ZUBCA7Q.cjs.map} +1 -1
- package/dist/chunk-4F5HZLKD.cjs +2 -0
- package/dist/{chunk-SFYUJQYW.cjs.map → chunk-4F5HZLKD.cjs.map} +1 -1
- package/dist/{chunk-4HG6A3SF.mjs → chunk-5DCOXGRW.mjs} +2 -2
- package/dist/{chunk-4HG6A3SF.mjs.map → chunk-5DCOXGRW.mjs.map} +1 -1
- package/dist/chunk-5GXB6GMX.mjs +2 -0
- package/dist/chunk-5GXB6GMX.mjs.map +1 -0
- package/dist/chunk-5ZGNEY2I.mjs +2 -0
- package/dist/{chunk-32NVJV5C.mjs.map → chunk-5ZGNEY2I.mjs.map} +1 -1
- package/dist/chunk-6PFJYRM7.cjs +2 -0
- package/dist/chunk-6PFJYRM7.cjs.map +1 -0
- package/dist/{chunk-W2P27645.cjs → chunk-BANKVCYY.cjs} +2 -2
- package/dist/{chunk-W2P27645.cjs.map → chunk-BANKVCYY.cjs.map} +1 -1
- package/dist/chunk-BD665RYK.mjs +2 -0
- package/dist/chunk-BD665RYK.mjs.map +1 -0
- package/dist/chunk-COPYGMHE.mjs +2 -0
- package/dist/chunk-COPYGMHE.mjs.map +1 -0
- package/dist/{chunk-3O5MPAJT.cjs → chunk-CVGEIXW6.cjs} +2 -2
- package/dist/{chunk-3O5MPAJT.cjs.map → chunk-CVGEIXW6.cjs.map} +1 -1
- package/dist/chunk-CX2E7ZTQ.mjs +2 -0
- package/dist/{chunk-JNLWI4JM.mjs.map → chunk-CX2E7ZTQ.mjs.map} +1 -1
- package/dist/chunk-DVFTTBCT.cjs +3 -0
- package/dist/chunk-DVFTTBCT.cjs.map +1 -0
- package/dist/{chunk-U3RU5LOF.cjs → chunk-EQXYFHHD.cjs} +2 -2
- package/dist/{chunk-U3RU5LOF.cjs.map → chunk-EQXYFHHD.cjs.map} +1 -1
- package/dist/{chunk-OVR5CK3R.cjs → chunk-H26KXQ3I.cjs} +2 -2
- package/dist/{chunk-OVR5CK3R.cjs.map → chunk-H26KXQ3I.cjs.map} +1 -1
- package/dist/chunk-ILDXZWEL.mjs +2 -0
- package/dist/{chunk-OZAYOPLB.mjs.map → chunk-ILDXZWEL.mjs.map} +1 -1
- package/dist/{chunk-RXY434DX.cjs → chunk-KA6DVHO5.cjs} +4 -4
- package/dist/{chunk-RXY434DX.cjs.map → chunk-KA6DVHO5.cjs.map} +1 -1
- package/dist/chunk-KLOSFZFK.cjs +2 -0
- package/dist/chunk-KLOSFZFK.cjs.map +1 -0
- package/dist/{chunk-WPVL27G4.mjs → chunk-LG23WXAP.mjs} +2 -2
- package/dist/{chunk-WPVL27G4.mjs.map → chunk-LG23WXAP.mjs.map} +1 -1
- package/dist/chunk-MU26QW32.cjs +2 -0
- package/dist/chunk-MU26QW32.cjs.map +1 -0
- package/dist/chunk-OEHVWRJG.mjs +2 -0
- package/dist/{chunk-7EF47R2J.mjs.map → chunk-OEHVWRJG.mjs.map} +1 -1
- package/dist/{chunk-3GKYL6VB.mjs → chunk-ONVAUZOD.mjs} +3 -3
- package/dist/{chunk-3GKYL6VB.mjs.map → chunk-ONVAUZOD.mjs.map} +1 -1
- package/dist/{chunk-LIATP6LY.mjs → chunk-PFHVB2WT.mjs} +2 -2
- package/dist/{chunk-LIATP6LY.mjs.map → chunk-PFHVB2WT.mjs.map} +1 -1
- package/dist/chunk-QJMOCISZ.mjs +3 -0
- package/dist/chunk-QJMOCISZ.mjs.map +1 -0
- package/dist/chunk-RGHM3JJM.cjs +2 -0
- package/dist/chunk-RGHM3JJM.cjs.map +1 -0
- package/dist/chunk-UMG3WOD7.cjs +2 -0
- package/dist/{chunk-QAENYYU6.cjs.map → chunk-UMG3WOD7.cjs.map} +1 -1
- package/dist/{chunk-6D6FL3XK.mjs → chunk-UT7QV6CE.mjs} +2 -2
- package/dist/{chunk-6D6FL3XK.mjs.map → chunk-UT7QV6CE.mjs.map} +1 -1
- package/dist/chunk-WU5JELOM.mjs +2 -0
- package/dist/chunk-WU5JELOM.mjs.map +1 -0
- package/dist/{chunk-IIEKK2S3.cjs → chunk-YGCNLXPJ.cjs} +2 -2
- package/dist/{chunk-IIEKK2S3.cjs.map → chunk-YGCNLXPJ.cjs.map} +1 -1
- package/dist/cli/bin.cjs +1 -1
- package/dist/cli/bin.cjs.map +1 -1
- package/dist/cli/bin.mjs +1 -1
- package/dist/cli/bin.mjs.map +1 -1
- package/dist/cli/index.cjs +1 -1
- package/dist/cli/index.mjs +1 -1
- package/dist/experimentation/index.cjs +1 -1
- package/dist/experimentation/index.d.cts +2 -2
- package/dist/experimentation/index.d.ts +2 -2
- package/dist/experimentation/index.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -6
- package/dist/index.d.ts +8 -6
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/investigation/index.cjs +1 -1
- package/dist/investigation/index.d.cts +2 -2
- package/dist/investigation/index.d.ts +2 -2
- package/dist/investigation/index.mjs +1 -1
- package/dist/kanban/index.cjs +1 -1
- package/dist/kanban/index.d.cts +1 -1
- package/dist/kanban/index.d.ts +1 -1
- package/dist/kanban/index.mjs +1 -1
- package/dist/policies/index.cjs +2 -0
- package/dist/policies/index.cjs.map +1 -0
- package/dist/policies/index.d.cts +199 -0
- package/dist/policies/index.d.ts +199 -0
- package/dist/policies/index.mjs +2 -0
- package/dist/policies/index.mjs.map +1 -0
- package/dist/registry/index.cjs +1 -1
- package/dist/registry/index.d.cts +1 -1
- package/dist/registry/index.d.ts +1 -1
- package/dist/registry/index.mjs +1 -1
- package/dist/schema/index.cjs +1 -1
- package/dist/schema/index.mjs +1 -1
- package/dist/scrum/index.cjs +1 -1
- package/dist/scrum/index.d.cts +3 -3
- package/dist/scrum/index.d.ts +3 -3
- package/dist/scrum/index.mjs +1 -1
- package/dist/{types-DjePDfms.d.cts → types-DLOtndDY.d.cts} +61 -1
- package/dist/{types-DjePDfms.d.ts → types-DLOtndDY.d.ts} +61 -1
- package/dist/types.d.cts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/waterfall/index.cjs +1 -1
- package/dist/waterfall/index.d.cts +1 -1
- package/dist/waterfall/index.d.ts +1 -1
- package/dist/waterfall/index.mjs +1 -1
- package/package.json +14 -1
- package/dist/chunk-32NVJV5C.mjs +0 -2
- package/dist/chunk-43GLYYA2.cjs +0 -3
- package/dist/chunk-43GLYYA2.cjs.map +0 -1
- package/dist/chunk-7EF47R2J.mjs +0 -2
- package/dist/chunk-BD76VFI4.mjs +0 -3
- package/dist/chunk-BD76VFI4.mjs.map +0 -1
- package/dist/chunk-BHAEPYRJ.cjs +0 -2
- package/dist/chunk-BHAEPYRJ.cjs.map +0 -1
- package/dist/chunk-BYPFTO7P.mjs +0 -2
- package/dist/chunk-FDZB73PH.mjs +0 -2
- package/dist/chunk-FDZB73PH.mjs.map +0 -1
- package/dist/chunk-JNLWI4JM.mjs +0 -2
- package/dist/chunk-LCN4UNYK.cjs +0 -2
- package/dist/chunk-LCN4UNYK.cjs.map +0 -1
- package/dist/chunk-MB465DI4.mjs +0 -2
- package/dist/chunk-MB465DI4.mjs.map +0 -1
- package/dist/chunk-OZAYOPLB.mjs +0 -2
- package/dist/chunk-QAENYYU6.cjs +0 -2
- package/dist/chunk-SFYUJQYW.cjs +0 -2
- package/dist/chunk-UUWDQVIJ.mjs +0 -2
- package/dist/chunk-UUWDQVIJ.mjs.map +0 -1
- package/dist/chunk-Z43GUETW.cjs +0 -2
- package/dist/chunk-Z43GUETW.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/methodologies/investigation/record.ts","../src/methodologies/investigation/execution.ts","../src/methodologies/investigation/invariants.ts","../src/methodologies/investigation/config.ts","../src/methodologies/investigation/ceremonies.ts","../src/methodologies/investigation/rules.ts","../src/methodologies/investigation/roles.ts","../src/methodologies/investigation/stages.ts","../src/methodologies/investigation/index.ts"],"names":["readInvestigation","s","readExt","writeInvestigation","x","writeExt","executionActors","state","item","event","transition","freshOutputRefs","completion","index","output","brokenInvestigation","what","fail","lastRound","investigationIteration","it","validateInvestigationConfig","raw","c","k","v","reject","name","message","fix","sameHypothesis","a","b","frozenChanges","text","refs","extraKey","keys","extraKeyIn","list","authorize","by","cap","roleOf","save","i","appendEvent","nowOf","closeInvestigation","outcome","reason","at","n","candidate","r","moveItem","investigationCeremonies","factory","built","methodology","make","phase","fn","applyAction","bad","addItem","h","extra","isExhausted","e","extraExperiment","p","prior","id","iteration","o","ref","entry","conclusion","independenceConflicts","target","replayRefs","investigationRules","round","investigationRoles","investigationStages","investigation","excluded","roles","selected","role","now"],"mappings":"yNAKO,IAAMA,EAAqBC,CAAAA,EAChCC,mBAAAA,CAAQD,EAAG,eAAe,CAAA,CAGfE,EAAqB,CAACF,CAAAA,CAAkBG,CAAAA,GACnDC,mBAAAA,CAASJ,EAAG,eAAA,CAAiBG,CAAC,ECDzB,SAASE,CAAAA,CAAgBC,EAAsB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ACkE,CAAAA,EACD,CAACN,oBAAYM,CAAAA,CAAU,MAAA,CAAQA,EAAU,KAAK,CAAA,CAEvCnE,EACFyC,CAAAA,CACLzC,CAAAA,CACAH,EACA,CAAE,EAAA,CAAI,gBAAiB,GAAA,CAAAuF,CAAI,EAC3B,SAAA,CACA,CAAA,yCAAA,EAA4CnF,CAAI,CAAA,6DAAA,CAClD,CACF,CAAA,CACA,UAAA,CAAaP,GAAM,CACjB,CAAA,UAAA,EAAcA,EAAE,MAAA,CAA+B,QAAQ,GACvD,mGACF,CAAA,CACA,KAAA,CAAOiF,CAAAA,GACP,OAAA,CAAUjF,CAAAA,GAAO,CACf,MAAA,CAAQD,CAAAA,CAAkBC,CAAC,CAAA,EAAG,MAAA,CAAO,MAAA,EAAU,CAAA,CAC/C,UAAWD,CAAAA,CAAkBC,CAAC,GAAG,MAAA,CAAO,MAAA,CAAQqD,GAAMA,CAAAA,CAAE,MAAA,EAAQ,KAAK,CAAA,CAAE,MAAA,EAAU,EACjF,WAAA,CACEtD,CAAAA,CAAkBC,CAAC,CAAA,EAAG,MAAA,CAAO,OAAQqD,CAAAA,EAAMA,CAAAA,CAAE,MAAA,EAAU,CAACA,EAAE,MAAA,CAAO,KAAK,EAAE,MAAA,EAAU,CACtF,GACA,MAAA,CAASrD,CAAAA,GAAO,CACd,KAAA,CAAOD,CAAAA,CAAkBC,CAAC,CAAA,EAAG,KAAA,EAAS,SACtC,OAAA,CAASD,CAAAA,CAAkBC,CAAC,CAAA,EAAG,OAAA,EAAW,IAAA,CAC1C,MAAA,CAAQD,EAAkBC,CAAC,CAAA,EAAG,OAAO,MAAA,EAAU,CAAA,CAC/C,WAAYD,CAAAA,CAAkBC,CAAC,GAAG,UAAA,EAAc,IAAA,CAChD,WAAYD,CAAAA,CAAkBC,CAAC,GAAG,UAAA,EAAc,IAClD,EACF,CACF","file":"chunk-QAENYYU6.cjs","sourcesContent":["import { readExt, writeExt } from \"../../interface/ext.ts\";\nimport type { WorkflowState } from \"../../core/types.ts\";\nimport type { InvestigationState } from \"./state.ts\";\n\n/** The investigation record: `ext.investigation`, or the legacy field of a state written before 1.2. */\nexport const readInvestigation = (s: WorkflowState): InvestigationState | undefined =>\n readExt(s, \"investigation\");\n\n/** Stores the investigation record in `ext.investigation` and its deprecated legacy mirror (spec 26). */\nexport const writeInvestigation = (s: WorkflowState, x: InvestigationState): WorkflowState =>\n writeExt(s, \"investigation\", x);\n","import type { Handoff, Verdict, WorkflowState } from \"../../core/types.ts\";\n\ninterface Completion {\n id: string;\n verdict: Verdict;\n produced: Handoff[\"produced\"];\n}\n\n/** Completion actors come from validated handoffs, never caller-supplied accounting identity. */\nexport function executionActors(state: WorkflowState, item: string): string[] {\n return [\n ...new Set([\n ...state.events\n .filter(\n (event) => event.type === \"item.completed\" && (event.payload as Completion).id === item,\n )\n .map((event) => event.by),\n ...(state.items[item]?.transitions ?? [])\n .filter((transition) => transition.to.status === \"in_progress\")\n .map((transition) => transition.by),\n ]),\n ];\n}\n\n/** Only outputs of the latest successful completion can establish observation provenance. */\nexport function freshOutputRefs(state: WorkflowState, item: string): string[] {\n let completion: Completion | undefined;\n for (let index = state.events.length - 1; index >= 0; index--) {\n const event = state.events[index]!;\n if (event.type === \"item.completed\" && (event.payload as Completion).id === item) {\n completion = event.payload as Completion;\n break;\n }\n }\n return completion && [\"done\", \"needs-review\"].includes(completion.verdict)\n ? completion.produced\n .filter((output) => output.kind === \"experiment-output\")\n .map((output) => output.ref)\n : [];\n}\n","import { fail } from \"../../core/errors.ts\";\nimport type { Iteration, WorkflowState } from \"../../core/types.ts\";\nimport type { InvestigationState } from \"./state.ts\";\n\n/** A loaded state that breaks an invariant the ceremonies keep (a hand-edited or damaged file). */\nexport function brokenInvestigation(what: string): never {\n return fail(\n \"invalid-input\",\n `the investigation state is inconsistent: ${what}`,\n \"restore .workflow/state.json from git, or start a new investigation\",\n );\n}\n\n/** The latest round; the phases after preregister always have one. */\nexport function lastRound(x: InvestigationState): InvestigationState[\"rounds\"][number] {\n return x.rounds.at(-1) ?? brokenInvestigation(`phase ${x.phase} has no round`);\n}\n\n/** The `investigation` iteration intake opens; its budget bounds every round. */\nexport function investigationIteration(s: WorkflowState<string>): Iteration {\n return (\n s.iterations.find((it) => it.id === \"investigation\") ??\n brokenInvestigation('there is no \"investigation\" iteration')\n );\n}\n","import { fail } from \"../../core/errors.ts\";\nimport type { Budget } from \"../../core/types.ts\";\nexport interface InvestigationConfig {\n question: string;\n maxRounds: number;\n budget: Budget;\n}\nexport function validateInvestigationConfig(raw: unknown): InvestigationConfig {\n const c = raw as InvestigationConfig;\n if (\n !c ||\n typeof c !== \"object\" ||\n Array.isArray(c) ||\n typeof c.question !== \"string\" ||\n !c.question.trim() ||\n !Number.isSafeInteger(c.maxRounds) ||\n c.maxRounds < 1 ||\n !c.budget ||\n typeof c.budget !== \"object\" ||\n Array.isArray(c.budget) ||\n !Object.keys(c.budget).length ||\n Object.entries(c.budget).some(\n ([k, v]) =>\n ![\"tokens\", \"turns\", \"wallclockMs\"].includes(k) ||\n typeof v !== \"number\" ||\n !Number.isFinite(v) ||\n v <= 0,\n )\n )\n fail(\n \"config-invalid\",\n \"investigation requires question, positive maxRounds and a finite positive budget\",\n \"provide bounded investigation config\",\n );\n return { question: c.question, maxRounds: c.maxRounds, budget: { ...c.budget } };\n}\n","import { readInvestigation, writeInvestigation } from \"./record.ts\";\nimport { executionActors, freshOutputRefs } from \"./execution.ts\";\nimport { independenceConflicts } from \"../../common/independence.ts\";\nimport { frozenChanges } from \"../../common/frozen.ts\";\nimport { fail } from \"../../core/errors.ts\";\nimport { brokenInvestigation, investigationIteration, lastRound } from \"./invariants.ts\";\nimport { roleOf } from \"../../core/roles/lookup.ts\";\nimport { addItem } from \"../../core/items/record.ts\";\nimport { moveItem } from \"../../core/items/move.ts\";\nimport { applyAction } from \"../../core/methodology.ts\";\nimport { appendEvent, nowOf } from \"../../core/state.ts\";\nimport { isExhausted } from \"../../core/budget.ts\";\nimport type {\n Capability,\n Ceremony,\n CeremonyInput,\n Methodology,\n WorkflowState,\n} from \"../../core/types.ts\";\nimport { validateInvestigationConfig, type InvestigationConfig } from \"./config.ts\";\nimport type {\n BeliefUpdate,\n Experiment,\n Hypothesis,\n InvestigationConclusion,\n InvestigationState,\n Observation,\n} from \"./state.ts\";\nfunction reject(s: WorkflowState, name: string, message: string, fix: string): never {\n const x = readInvestigation(s);\n return fail(\"invalid-input\", `${name} (phase ${x?.phase ?? \"intake\"}): ${message}`, fix, {\n items: x ? [x.item, ...(x.rounds.at(-1) ? [x.rounds.at(-1)!.item] : [])] : [],\n });\n}\nconst sameHypothesis = (a: Hypothesis | undefined, b: Hypothesis | undefined) =>\n !!a && !!b && !frozenChanges(a, b, [\"id\", \"claim\", \"falsifiedBy\"]).length;\nconst text = (v: unknown): v is string => typeof v === \"string\" && v.trim().length > 0;\nconst refs = (v: unknown): v is string[] =>\n Array.isArray(v) && v.length > 0 && v.every(text) && new Set(v).size === v.length;\n/** First key of a caller record outside its contract; stored records are closed objects (state schema). */\nconst extraKey = (v: unknown, keys: readonly string[]): string | undefined =>\n v && typeof v === \"object\" && !Array.isArray(v)\n ? Object.keys(v).find((k) => !keys.includes(k))\n : undefined;\nconst extraKeyIn = (list: unknown, keys: readonly string[]): string | undefined =>\n Array.isArray(list) ? list.map((v) => extraKey(v, keys)).find(Boolean) : undefined;\nfunction authorize(s: WorkflowState, by: string, cap: Capability) {\n if (!roleOf(s, by)?.capabilities.includes(cap))\n fail(\n \"missing-capability\",\n `${by} needs ${cap}`,\n \"use a registered role with the required capability\",\n );\n}\nfunction save(s: WorkflowState, x: InvestigationState, i: CeremonyInput, name: string) {\n return appendEvent(\n writeInvestigation(s, x),\n `investigation.${name}`,\n i.by,\n { ...x },\n nowOf(i.now),\n );\n}\nexport function closeInvestigation(\n s: WorkflowState,\n x: InvestigationState,\n i: CeremonyInput,\n outcome: \"stopped\" | \"resolved\" | \"inconclusive\",\n reason?: string,\n) {\n const at = nowOf(i.now);\n let n = save(\n s,\n { ...x, phase: \"closed\", outcome, ...(reason ? { stopReason: reason } : {}) },\n i,\n outcome,\n );\n n = {\n ...n,\n iterations: n.iterations.map((it) =>\n it.id === \"investigation\"\n ? { ...it, endedAt: at, outcome: outcome === \"stopped\" ? \"cancelled\" : \"completed\" }\n : it,\n ),\n };\n for (const item of Object.values(n.items).filter(\n (candidate) => candidate.id === x.item || x.rounds.some((r) => r.item === candidate.id),\n ))\n if (item.status !== \"done\" && item.status !== \"dropped\")\n n = moveItem(\n n,\n item.id,\n { status: outcome === \"resolved\" && item.id === x.item ? \"done\" : \"dropped\" },\n i.by,\n at,\n );\n return n;\n}\nexport function investigationCeremonies(\n factory: () => Methodology<InvestigationConfig>,\n): Record<string, Ceremony> {\n let built: Methodology<InvestigationConfig> | undefined;\n const methodology = () => (built ??= factory());\n const make =\n (\n name: string,\n cap: Capability,\n phase: string | undefined,\n fn: (\n s: WorkflowState,\n x: InvestigationState,\n i: CeremonyInput,\n bad: (message: string, fix: string) => never,\n ) => WorkflowState,\n ): Ceremony =>\n (s, i) => {\n authorize(s, i.by, cap);\n const x = readInvestigation(s);\n if (!x || x.phase === \"closed\")\n reject(s, name, \"no active investigation\", \"start a new investigation with intake {item}\");\n if (phase && x.phase !== phase && !(name === \"hypotheses\" && x.phase === \"preregister\"))\n reject(\n s,\n name,\n `expected ${phase}, got ${x.phase}`,\n `finish phase ${x.phase} before calling ${name}; ${name} requires phase ${phase}`,\n );\n return applyAction(s, methodology(), { type: `ceremony.${name}`, by: i.by, payload: i }, () =>\n fn(s, x, i, (message, fix) => reject(s, name, message, fix)),\n );\n };\n return {\n intake(s, i) {\n authorize(s, i.by, \"facilitate\");\n const bad = (message: string, fix: string) => reject(s, \"intake\", message, fix);\n if (s.methodology !== \"investigation\")\n bad(\n `workflow methodology is ${s.methodology}, not investigation`,\n \"init a workflow with the investigation methodology before intake\",\n );\n if (readInvestigation(s))\n bad(\n \"investigation already started\",\n \"use the existing investigation or initialize a new workflow\",\n );\n if (!text(i.item))\n bad(\"item is required\", \"set intake.item to a unique investigation item ID\");\n const c = validateInvestigationConfig(s.config);\n return applyAction(\n s,\n methodology(),\n { type: \"ceremony.intake\", by: i.by, payload: i },\n () => {\n let n = addItem(\n s,\n {\n id: i.item as string,\n title: c.question,\n acceptance: [\"Independent evidence-based conclusion\"],\n stage: \"intake\",\n },\n i.by,\n i.now,\n );\n n = {\n ...n,\n iterations: [\n ...n.iterations,\n {\n id: \"investigation\",\n goal: c.question,\n budget: { ...c.budget },\n spent: { tokens: 0, turns: 0, wallclockMs: 0 },\n startedAt: nowOf(i.now),\n committed: [],\n carryover: [],\n },\n ],\n };\n return save(\n n,\n {\n item: i.item as string,\n phase: \"hypotheses\",\n hypotheses: [],\n rounds: [],\n contributors: [i.by],\n },\n i,\n \"intake\",\n );\n },\n );\n },\n hypotheses: make(\"hypotheses\", \"define-acceptance\", \"hypotheses\", (s, x, i, bad) => {\n const h = i.hypotheses as Hypothesis[];\n const extra = extraKeyIn(h, [\"id\", \"claim\", \"falsifiedBy\"]);\n if (extra)\n bad(\n `unknown key \"${extra}\" in a hypotheses entry`,\n \"use only id, claim and falsifiedBy in each hypotheses entry\",\n );\n if (\n !Array.isArray(h) ||\n !h.length ||\n h.some((v) => !v || !text(v.id) || !text(v.claim) || !text(v.falsifiedBy)) ||\n new Set(h.map((v) => v.id)).size !== h.length ||\n (h.length < 2 && !text(i.singleHypothesisRationale))\n )\n bad(\n \"provide competing falsifiable hypotheses or single-testable rationale\",\n \"set hypotheses to unique {id, claim, falsifiedBy} entries; supply singleHypothesisRationale when there is only one\",\n );\n return save(\n s,\n {\n ...x,\n hypotheses: h.map((v) => ({ id: v.id, claim: v.claim, falsifiedBy: v.falsifiedBy })),\n ...(text(i.singleHypothesisRationale)\n ? { singleHypothesisRationale: i.singleHypothesisRationale }\n : {}),\n contributors: [...new Set([...x.contributors, i.by])],\n phase: \"preregister\",\n },\n i,\n \"hypotheses\",\n );\n }),\n preregister: make(\"preregister\", \"define-acceptance\", \"preregister\", (s, x, i, bad) => {\n const c = validateInvestigationConfig(s.config),\n it = s.iterations.find((v) => v.id === \"investigation\");\n if (x.rounds.length >= c.maxRounds || !it || isExhausted(c.budget, it.spent))\n bad(\n `round limit or budget exhausted (${x.rounds.length} of ${c.maxRounds} rounds used)`,\n \"call stop {reason} to close this investigation, or start a new one with a larger maxRounds or budget\",\n );\n const e = i.experiment as Experiment;\n const extraExperiment =\n extraKey(e, [\"id\", \"procedureRef\", \"predictions\", \"replayOf\"]) ??\n extraKeyIn(e?.predictions, [\"hypothesis\", \"prediction\"]);\n if (extraExperiment)\n bad(\n `unknown key \"${extraExperiment}\" in experiment`,\n \"use only id, procedureRef, predictions [{hypothesis, prediction}] and replayOf in experiment\",\n );\n if (\n !e ||\n !text(e.id) ||\n !text(e.procedureRef) ||\n x.rounds.some((r) => r.experiment.id === e.id) ||\n !Array.isArray(e.predictions) ||\n e.predictions.length !== x.hypotheses.length ||\n x.hypotheses.some(\n (h) =>\n e.predictions.filter((p) => p?.hypothesis === h.id && text(p.prediction)).length !== 1,\n ) ||\n new Set(e.predictions.map((p) => p.prediction)).size !== e.predictions.length\n )\n bad(\n \"preregister unique experiment with differing predictions for every hypothesis\",\n \"set experiment.id to a new ID, experiment.procedureRef, and one distinct experiment.predictions entry per hypothesis\",\n );\n if (e.replayOf) {\n const prior = x.rounds.find((r) => r.experiment.id === e.replayOf && r.result?.valid);\n if (\n !prior ||\n frozenChanges(prior.experiment, e, [\"procedureRef\"]).length ||\n prior.hypotheses.length !== x.hypotheses.length ||\n x.hypotheses.some(\n (h) =>\n !sameHypothesis(\n h,\n prior.hypotheses.find((p) => p.id === h.id),\n ),\n ) ||\n e.predictions.some(\n (p) =>\n !prior.experiment.predictions.some(\n (q) => !frozenChanges(q, p, [\"hypothesis\", \"prediction\"]).length,\n ),\n )\n )\n bad(\n \"replay must repeat the procedure, predictions and hypotheses of a prior valid experiment\",\n \"set experiment.replayOf to a valid prior experiment with identical procedureRef, predictions and hypothesis definitions\",\n );\n }\n const id = `${x.item}-run-${x.rounds.length + 1}`;\n let n = addItem(\n s,\n {\n id,\n title: `Experiment ${e.id}`,\n stage: \"execute\",\n acceptance: [e.procedureRef],\n iteration: \"investigation\",\n },\n i.by,\n i.now,\n );\n n = {\n ...n,\n iterations: n.iterations.map((iteration) =>\n iteration.id === \"investigation\"\n ? { ...iteration, committed: [...iteration.committed, id] }\n : iteration,\n ),\n };\n return save(\n n,\n {\n ...x,\n phase: \"observe\",\n rounds: [\n ...x.rounds,\n {\n experiment: {\n id: e.id,\n procedureRef: e.procedureRef,\n predictions: e.predictions.map((p) => ({\n hypothesis: p.hypothesis,\n prediction: p.prediction,\n })),\n ...(e.replayOf ? { replayOf: e.replayOf } : {}),\n },\n hypotheses: x.hypotheses.map((v) => ({ ...v })),\n item: id,\n by: i.by,\n },\n ],\n contributors: [...new Set([...x.contributors, i.by])],\n },\n i,\n \"preregister\",\n );\n }),\n observe: make(\"observe\", \"verify\", \"observe\", (s, x, i, bad) => {\n const r = lastRound(x),\n o = i.result as Observation;\n const extra = extraKey(o, [\"id\", \"valid\", \"summary\", \"provenanceRefs\"]);\n if (extra)\n bad(\n `unknown key \"${extra}\" in result`,\n \"use only id, valid, summary and provenanceRefs in result\",\n );\n if (\n i.experiment !== r.experiment.id ||\n !o ||\n !text(o.id) ||\n typeof o.valid !== \"boolean\" ||\n !text(o.summary) ||\n !refs(o.provenanceRefs) ||\n x.rounds.some((prior) => prior.result?.id === o.id)\n )\n bad(\n \"observation needs current experiment, unique result and provenance\",\n \"set experiment to the active experiment ID and result to {id, valid, summary, provenanceRefs} with a new result.id\",\n );\n if (s.items[r.item]?.status !== \"done\")\n bad(\n \"complete experiment execution before recording observations\",\n \"dispatch and complete the active experiment item before calling observe\",\n );\n if (!freshOutputRefs(s, r.item).some((ref) => o.provenanceRefs.includes(ref)))\n bad(\n \"observation must link fresh experiment-output evidence from the latest completion\",\n `include an experiment-output ref produced by the latest successful completion of item \"${r.item}\" in result.provenanceRefs`,\n );\n return save(\n s,\n {\n ...x,\n phase: \"update-belief\",\n rounds: x.rounds.map((v) =>\n v === r\n ? {\n ...v,\n result: {\n id: o.id,\n valid: o.valid,\n summary: o.summary,\n provenanceRefs: [...o.provenanceRefs],\n },\n }\n : v,\n ),\n contributors: [...new Set([...x.contributors, i.by, ...executionActors(s, r.item)])],\n },\n i,\n \"observe\",\n );\n }),\n \"update-belief\": make(\"update-belief\", \"define-acceptance\", \"update-belief\", (s, x, i, bad) => {\n const r = lastRound(x),\n a = i.assessments as BeliefUpdate[\"assessments\"];\n const extra = extraKeyIn(a, [\"hypothesis\", \"assessment\", \"reason\"]);\n if (extra)\n bad(\n `unknown key \"${extra}\" in an assessments entry`,\n \"use only hypothesis, assessment and reason in each assessments entry\",\n );\n if (\n i.result !== r.result?.id ||\n !Array.isArray(a) ||\n a.length !== x.hypotheses.length ||\n x.hypotheses.some(\n (h) =>\n a.filter(\n (v) =>\n v?.hypothesis === h.id &&\n [\"supported\", \"refuted\", \"uncertain\"].includes(v.assessment) &&\n text(v.reason),\n ).length !== 1,\n ) ||\n ![\"round\", \"conclusion\"].includes(i.next as string)\n )\n bad(\n \"belief update must assess every hypothesis against current result\",\n \"set result to the latest result ID, assessments to one {hypothesis, assessment, reason} per hypothesis, and next to round or conclusion\",\n );\n const result = r.result ?? brokenInvestigation(`round ${r.experiment.id} has no result`);\n if (!result.valid && a.some((v) => v.assessment !== \"uncertain\"))\n bad(\n \"invalid experiments cannot support beliefs\",\n \"set every assessment to uncertain for an invalid experiment result\",\n );\n let n = save(\n s,\n {\n ...x,\n phase: i.next === \"round\" ? \"preregister\" : \"conclusion\",\n rounds: x.rounds.map((v) =>\n v === r\n ? {\n ...v,\n update: {\n result: i.result as string,\n assessments: a.map((entry) => ({\n hypothesis: entry.hypothesis,\n assessment: entry.assessment,\n reason: entry.reason,\n })),\n },\n }\n : v,\n ),\n contributors: [...new Set([...x.contributors, i.by])],\n },\n i,\n \"belief-updated\",\n );\n const it = investigationIteration(n);\n if (\n i.next === \"round\" &&\n (x.rounds.length >= validateInvestigationConfig(s.config).maxRounds ||\n isExhausted(it.budget, it.spent))\n )\n n = closeInvestigation(\n n,\n readInvestigation(n)!,\n i,\n \"stopped\",\n \"budget or round limit exhausted\",\n );\n return n;\n }),\n conclude: make(\"conclude\", \"define-acceptance\", \"conclusion\", (s, x, i, bad) => {\n const c = i as unknown as InvestigationConclusion;\n if (\n ![\"resolved\", \"inconclusive\"].includes(c.outcome) ||\n !text(c.summary) ||\n !refs(c.evidenceRefs) ||\n c.evidenceRefs.some((ref) => !x.rounds.some((r) => r.result?.provenanceRefs.includes(ref)))\n )\n bad(\n \"conclusion needs observed evidence references\",\n \"set outcome, summary and evidenceRefs to references preserved in recorded observations\",\n );\n if (\n c.outcome === \"resolved\" &&\n (!text(c.supportedHypothesis) ||\n !x.rounds\n .slice(-1)\n .some(\n (r) =>\n r.result?.valid &&\n r.update?.assessments.some(\n (a) => a.hypothesis === c.supportedHypothesis && a.assessment === \"supported\",\n ),\n ))\n )\n bad(\n \"resolved conclusion needs a supported hypothesis\",\n \"set supportedHypothesis to a hypothesis supported by the latest valid round, or choose outcome inconclusive\",\n );\n return save(\n s,\n {\n ...x,\n phase: \"review\",\n conclusion: {\n outcome: c.outcome,\n summary: c.summary,\n evidenceRefs: [...c.evidenceRefs],\n ...(c.supportedHypothesis ? { supportedHypothesis: c.supportedHypothesis } : {}),\n by: i.by,\n },\n contributors: [...new Set([...x.contributors, i.by])],\n },\n i,\n \"conclusion\",\n );\n }),\n \"review-conclusion\": make(\"review-conclusion\", \"review\", \"review\", (s, x, i, bad) => {\n const conclusion = x.conclusion ?? brokenInvestigation(\"phase review has no conclusion\");\n if (independenceConflicts(i.by, x.contributors).length)\n bad(\n \"conclusion reviewer must be independent of investigation contributors\",\n \"use a review-capable role that did not contribute to or execute this investigation\",\n );\n if (typeof i.approve !== \"boolean\" || !text(i.reason))\n bad(\n \"review needs approval and reason\",\n \"set approve to a boolean and reason to a nonempty review explanation\",\n );\n if (!i.approve) {\n const target = i.next ?? \"conclusion\";\n if (target !== \"round\" && target !== \"conclusion\")\n bad(\n \"review rejection next must be round or conclusion\",\n \"set next to round for more evidence or conclusion for a revised conclusion\",\n );\n const n = save(\n s,\n {\n ...x,\n phase: target === \"round\" ? \"preregister\" : \"conclusion\",\n reviewHistory: [\n ...(x.reviewHistory ?? []),\n {\n by: i.by,\n reason: i.reason as string,\n approve: false,\n next: target as \"round\" | \"conclusion\",\n replayRefs: [],\n },\n ],\n },\n i,\n \"review-rejected\",\n );\n const iteration = investigationIteration(s);\n if (\n target === \"round\" &&\n (x.rounds.length >= validateInvestigationConfig(s.config).maxRounds ||\n isExhausted(iteration.budget, iteration.spent))\n )\n return closeInvestigation(\n n,\n readInvestigation(n)!,\n i,\n \"stopped\",\n \"budget or round limit exhausted after review requested another round\",\n );\n return n;\n }\n const replayRefs = Array.isArray(i.replayRefs) ? i.replayRefs : [];\n if (\n conclusion.outcome === \"resolved\" &&\n (!refs(replayRefs) ||\n !x.rounds.some(\n (r) =>\n r.experiment.replayOf &&\n !independenceConflicts(\n executionActors(s, r.item),\n executionActors(\n s,\n (\n x.rounds.find((p) => p.experiment.id === r.experiment.replayOf) ??\n brokenInvestigation(\n `round ${r.experiment.id} replays the unknown experiment ${r.experiment.replayOf}`,\n )\n ).item,\n ),\n ).length &&\n sameHypothesis(\n r.hypotheses.find((h) => h.id === conclusion.supportedHypothesis),\n lastRound(x).hypotheses.find((h) => h.id === conclusion.supportedHypothesis),\n ) &&\n r.result?.valid &&\n replayRefs.includes(r.result.id) &&\n r.update?.assessments.some(\n (a) =>\n a.hypothesis === conclusion.supportedHypothesis && a.assessment === \"supported\",\n ),\n ))\n )\n bad(\n \"resolved conclusion requires valid replay result and supporting belief update\",\n \"set replayRefs to a valid independent replay result supporting the latest supported hypothesis definition, or reject with next round\",\n );\n return closeInvestigation(\n s,\n {\n ...x,\n review: { by: i.by, reason: i.reason as string, replayRefs: replayRefs as string[] },\n reviewHistory: [\n ...(x.reviewHistory ?? []),\n {\n by: i.by,\n reason: i.reason as string,\n approve: true,\n replayRefs: replayRefs as string[],\n },\n ],\n },\n i,\n conclusion.outcome,\n );\n }),\n stop: make(\"stop\", \"facilitate\", undefined, (s, x, i, bad) => {\n if (!text(i.reason))\n bad(\n \"stop needs reason\",\n \"set reason to a nonempty explanation for stopping this investigation\",\n );\n return closeInvestigation(s, x, i, \"stopped\", i.reason as string);\n }),\n };\n}\n","import { readInvestigation } from \"./record.ts\";\nimport { executionActors } from \"./execution.ts\";\nimport { independenceConflicts } from \"../../common/independence.ts\";\nimport type { Rule } from \"../../core/types.ts\";\nexport function investigationRules(): Rule[] {\n return [\n {\n id: \"independent-replay\",\n severity: \"error\",\n check(s, a) {\n if (a.type !== \"item.complete\") return [];\n const round = readInvestigation(s)?.rounds.find(\n (r) => r.item === (a.payload as { item?: string })?.item,\n );\n const prior = readInvestigation(s)?.rounds.find(\n (r) => r.experiment.id === round?.experiment.replayOf,\n );\n return prior && independenceConflicts(a.by, executionActors(s, prior.item)).length\n ? [\n {\n rule: \"independent-replay\",\n item: round!.item,\n severity: \"error\",\n message: \"Replay executor also executed the original experiment\",\n fix: \"assign a different deliver-capable role\",\n },\n ]\n : [];\n },\n },\n {\n id: \"investigation-execution-only\",\n severity: \"error\",\n check(s, a) {\n if (a.type !== \"item.complete\") return [];\n const p = a.payload as { item: string };\n const x = readInvestigation(s);\n return x?.phase === \"observe\" && x.rounds.at(-1)?.item === p.item\n ? []\n : [\n {\n rule: \"investigation-execution-only\",\n item: p.item,\n severity: \"error\",\n message: \"Only the active preregistered experiment can complete\",\n fix: `complete only the active experiment item in phase observe; current phase is ${x?.phase ?? \"intake\"}`,\n },\n ];\n },\n },\n ];\n}\n","import type { Role } from \"../../core/types.ts\";\nexport function investigationRoles(): Role[] {\n return [\n {\n id: \"replay-worker\",\n name: \"Independent replay worker\",\n modelTier: \"small\",\n capabilities: [\"deliver\", \"verify\"],\n canApprove: [],\n inputs: [\"preregistered-experiment\"],\n outputs: [\"experiment-output\"],\n do_not: [\"Do not change the replay procedure\"],\n },\n {\n id: \"investigator\",\n name: \"Investigator\",\n modelTier: \"large\",\n capabilities: [\"facilitate\", \"define-acceptance\", \"deliver\", \"verify\"],\n canApprove: [],\n inputs: [\"question\", \"prior-results\"],\n outputs: [\"hypotheses\", \"preregistered-experiment\", \"belief-update\"],\n do_not: [\"Do not revise predictions after execution\", \"Do not approve your own conclusions\"],\n },\n {\n id: \"conclusion-reviewer\",\n name: \"Independent conclusion reviewer\",\n modelTier: \"large\",\n capabilities: [\"review\"],\n canApprove: [\"investigation-conclusion\"],\n inputs: [\"evidence\", \"replay\", \"conclusion\"],\n outputs: [\"conclusion-review\"],\n do_not: [\"Do not approve unsupported conclusions\"],\n },\n ];\n}\n","import type { Stage } from \"../../core/types.ts\";\nexport function investigationStages(): Stage[] {\n return [\n {\n id: \"intake\",\n name: \"Intake\",\n entryPolicy: [],\n exitPolicy: [{ kind: \"acceptance-written\" }],\n },\n {\n id: \"execute\",\n name: \"Execute preregistered experiment\",\n entryPolicy: [{ kind: \"acceptance-written\" }, { kind: \"no-open-blockers\" }],\n exitPolicy: [{ kind: \"evidence\", evidenceKind: \"experiment-output\" }],\n },\n { id: \"observed\", name: \"Execution recorded\", entryPolicy: [], exitPolicy: [] },\n ];\n}\n","import { readInvestigation } from \"./record.ts\";\nimport { fail } from \"../../core/errors.ts\";\nimport { executionActors } from \"./execution.ts\";\nimport { independenceConflicts } from \"../../common/independence.ts\";\nimport { closeInvestigation, investigationCeremonies } from \"./ceremonies.ts\";\nimport { investigationIteration } from \"./invariants.ts\";\nimport { investigationRules } from \"./rules.ts\";\nimport { investigationRoles } from \"./roles.ts\";\nimport { investigationStages } from \"./stages.ts\";\nimport { isExhausted } from \"../../core/budget.ts\";\nimport type { Methodology } from \"../../core/types.ts\";\nimport { validateInvestigationConfig, type InvestigationConfig } from \"./config.ts\";\nexport { validateInvestigationConfig };\nexport type { InvestigationConfig };\nexport type * from \"./state.ts\";\nexport function investigation(): Methodology<InvestigationConfig> {\n return {\n name: \"investigation\",\n validateConfig: validateInvestigationConfig,\n lockedConfigKeys: [\"question\", \"maxRounds\", \"budget\"],\n vocabulary: {\n backlog: \"Questions\",\n item: \"Investigation artifact\",\n stage: \"Investigation phase\",\n iteration: \"Investigation budget\",\n increment: \"Conclusion\",\n ceremony: \"Investigation ceremony\",\n gate: \"Independent conclusion review\",\n },\n defaultStages: investigationStages,\n defaultRoles: investigationRoles,\n requiredCapabilities: [\"facilitate\", \"define-acceptance\", \"deliver\", \"verify\", \"review\"],\n exclusiveCapabilities: [],\n humanDefaults: { gates: \"none\" },\n ceremonies: investigationCeremonies(investigation),\n plannerOptions: (state) => ({\n schedulerMode: \"level\",\n concurrencyCap: 1,\n roleFor: (item) => {\n const r = readInvestigation(state)?.rounds.find((candidate) => candidate.item === item.id);\n const prior = readInvestigation(state)?.rounds.find(\n (p) => p.experiment.id === r?.experiment.replayOf,\n );\n const excluded = prior ? executionActors(state, prior.item) : [];\n const roles = Object.values(state.roles);\n const selected =\n (!prior\n ? roles.find(\n (role) =>\n role.capabilities.includes(\"deliver\") &&\n role.capabilities.includes(\"define-acceptance\"),\n )\n : undefined) ??\n roles.find(\n (role) =>\n role.capabilities.includes(\"deliver\") &&\n !independenceConflicts(role.id, excluded).length,\n );\n if (!selected)\n fail(\n \"missing-capability\",\n `No eligible executor for experiment item \"${item.id}\"`,\n prior\n ? `register an independent deliver-capable role that did not execute \"${prior.item}\"`\n : \"register a role with deliver capability\",\n { items: [item.id] },\n );\n return selected.id;\n },\n estimateMode: \"per-call\",\n fallbackTokensPerWeight: 1,\n }),\n candidates: (s) => {\n // read the record once, not once per item (U10 F2)\n const x = readInvestigation(s);\n const round = x?.rounds.at(-1)?.item;\n return x?.phase === \"observe\" &&\n !isExhausted((s.config as InvestigationConfig).budget, investigationIteration(s).spent)\n ? Object.values(s.items).filter(\n (i) => i.id === round && i.stage === \"execute\" && i.status === \"todo\",\n )\n : [];\n },\n afterComplete: (state, item, now) => {\n const x = readInvestigation(state);\n const iteration = state.iterations.find((it) => it.id === \"investigation\");\n if (\n x?.phase !== \"observe\" ||\n x.rounds.at(-1)?.item !== item ||\n state.items[item]?.status === \"done\" ||\n !iteration ||\n !isExhausted(iteration.budget, iteration.spent)\n )\n return state;\n return closeInvestigation(\n state,\n x,\n { by: \"investigation\", now },\n \"stopped\",\n `budget exhausted before experiment item \"${item}\" completed; start a new investigation with sufficient budget`,\n );\n },\n invariants: (s) => [\n `Question: ${(s.config as InvestigationConfig).question}`,\n \"Execute only the preregistered procedure; retain raw observation provenance; report invalid runs.\",\n ],\n rules: investigationRules(),\n metrics: (s) => ({\n rounds: readInvestigation(s)?.rounds.length ?? 0,\n validRuns: readInvestigation(s)?.rounds.filter((r) => r.result?.valid).length ?? 0,\n invalidRuns:\n readInvestigation(s)?.rounds.filter((r) => r.result && !r.result.valid).length ?? 0,\n }),\n report: (s) => ({\n phase: readInvestigation(s)?.phase ?? \"intake\",\n outcome: readInvestigation(s)?.outcome ?? null,\n rounds: readInvestigation(s)?.rounds.length ?? 0,\n conclusion: readInvestigation(s)?.conclusion ?? null,\n stopReason: readInvestigation(s)?.stopReason ?? null,\n }),\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/methodologies/investigation/record.ts","../src/methodologies/investigation/execution.ts","../src/methodologies/investigation/invariants.ts","../src/methodologies/investigation/config.ts","../src/methodologies/investigation/ceremonies.ts","../src/methodologies/investigation/rules.ts","../src/methodologies/investigation/roles.ts","../src/methodologies/investigation/stages.ts","../src/methodologies/investigation/index.ts"],"names":["readInvestigation","s","readExt","writeInvestigation","x","writeExt","executionActors","state","item","event","transition","freshOutputRefs","completion","index","output","brokenInvestigation","what","fail","lastRound","investigationIteration","it","validateInvestigationConfig","raw","c","k","v","reject","name","message","fix","sameHypothesis","a","b","frozenChanges","text","refs","extraKey","keys","extraKeyIn","list","authorize","by","cap","roleOf","save","i","appendEvent","nowOf","closeInvestigation","outcome","reason","at","n","candidate","r","moveItem","investigationCeremonies","factory","built","methodology","make","phase","fn","applyAction","bad","addItem","h","extra","isExhausted","e","extraExperiment","p","prior","id","iteration","o","ref","entry","conclusion","independenceConflicts","target","replayRefs","investigationRules","round","investigationRoles","investigationStages","investigation","excluded","roles","selected","role","now"],"mappings":"2QAKO,IAAMA,EAAqBC,CAAAA,EAChCC,mBAAAA,CAAQD,EAAG,eAAe,CAAA,CAGfE,EAAqB,CAACF,CAAAA,CAAkBG,CAAAA,GACnDC,mBAAAA,CAASJ,EAAG,eAAA,CAAiBG,CAAC,ECDzB,SAASE,CAAAA,CAAgBC,EAAsBC,CAAAA,CAAwB,CAC5E,OAAO,CACL,GAAG,IAAI,GAAA,CAAI,CACT,GAAGD,CAAAA,CAAM,OACN,MAAA,CACEE,CAAAA,EAAUA,EAAM,IAAA,GAAS,gBAAA,EAAqBA,EAAM,OAAA,CAAuB,EAAA,GAAOD,CACrF,CAAA,CACC,GAAA,CAAKC,GAAUA,CAAAA,CAAM,EAAE,CAAA,CAC1B,GAAA,CAAIF,EAAM,KAAA,CAAMC,CAAI,GAAG,WAAA,EAAe,IACnC,MAAA,CAAQE,CAAAA,EAAeA,EAAW,EAAA,CAAG,MAAA,GAAW,aAAa,CAAA,CAC7D,GAAA,CAAKA,GAAeA,CAAAA,CAAW,EAAE,CACtC,CAAC,CACH,CACF,CAGO,SAASC,CAAAA,CAAgBJ,CAAAA,CAAsBC,EAAwB,CAC5E,IAAII,EACJ,IAAA,IAASC,CAAAA,CAAQN,EAAM,MAAA,CAAO,MAAA,CAAS,EAAGM,CAAAA,EAAS,CAAA,CAAGA,IAAS,CAC7D,IAAMJ,EAAQF,CAAAA,CAAM,MAAA,CAAOM,CAAK,CAAA,CAChC,GAAIJ,CAAAA,CAAM,IAAA,GAAS,kBAAqBA,CAAAA,CAAM,OAAA,CAAuB,KAAOD,CAAAA,CAAM,CAChFI,CAAAA,CAAaH,CAAAA,CAAM,QACnB,KACF,CACF,CACA,O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AAAA,CAAkBC,CAAC,CAAA,EAAG,KAAA,EAAS,SACtC,OAAA,CAASD,CAAAA,CAAkBC,CAAC,CAAA,EAAG,OAAA,EAAW,IAAA,CAC1C,MAAA,CAAQD,EAAkBC,CAAC,CAAA,EAAG,OAAO,MAAA,EAAU,CAAA,CAC/C,WAAYD,CAAAA,CAAkBC,CAAC,GAAG,UAAA,EAAc,IAAA,CAChD,WAAYD,CAAAA,CAAkBC,CAAC,GAAG,UAAA,EAAc,IAClD,EACF,CACF","file":"chunk-UMG3WOD7.cjs","sourcesContent":["import { readExt, writeExt } from \"../../interface/ext.ts\";\nimport type { WorkflowState } from \"../../core/types.ts\";\nimport type { InvestigationState } from \"./state.ts\";\n\n/** The investigation record: `ext.investigation`, or the legacy field of a state written before 1.2. */\nexport const readInvestigation = (s: WorkflowState): InvestigationState | undefined =>\n readExt(s, \"investigation\");\n\n/** Stores the investigation record in `ext.investigation` and its deprecated legacy mirror (spec 26). */\nexport const writeInvestigation = (s: WorkflowState, x: InvestigationState): WorkflowState =>\n writeExt(s, \"investigation\", x);\n","import type { Handoff, Verdict, WorkflowState } from \"../../core/types.ts\";\n\ninterface Completion {\n id: string;\n verdict: Verdict;\n produced: Handoff[\"produced\"];\n}\n\n/** Completion actors come from validated handoffs, never caller-supplied accounting identity. */\nexport function executionActors(state: WorkflowState, item: string): string[] {\n return [\n ...new Set([\n ...state.events\n .filter(\n (event) => event.type === \"item.completed\" && (event.payload as Completion).id === item,\n )\n .map((event) => event.by),\n ...(state.items[item]?.transitions ?? [])\n .filter((transition) => transition.to.status === \"in_progress\")\n .map((transition) => transition.by),\n ]),\n ];\n}\n\n/** Only outputs of the latest successful completion can establish observation provenance. */\nexport function freshOutputRefs(state: WorkflowState, item: string): string[] {\n let completion: Completion | undefined;\n for (let index = state.events.length - 1; index >= 0; index--) {\n const event = state.events[index]!;\n if (event.type === \"item.completed\" && (event.payload as Completion).id === item) {\n completion = event.payload as Completion;\n break;\n }\n }\n return completion && [\"done\", \"needs-review\"].includes(completion.verdict)\n ? completion.produced\n .filter((output) => output.kind === \"experiment-output\")\n .map((output) => output.ref)\n : [];\n}\n","import { fail } from \"../../core/errors.ts\";\nimport type { Iteration, WorkflowState } from \"../../core/types.ts\";\nimport type { InvestigationState } from \"./state.ts\";\n\n/** A loaded state that breaks an invariant the ceremonies keep (a hand-edited or damaged file). */\nexport function brokenInvestigation(what: string): never {\n return fail(\n \"invalid-input\",\n `the investigation state is inconsistent: ${what}`,\n \"restore .workflow/state.json from git, or start a new investigation\",\n );\n}\n\n/** The latest round; the phases after preregister always have one. */\nexport function lastRound(x: InvestigationState): InvestigationState[\"rounds\"][number] {\n return x.rounds.at(-1) ?? brokenInvestigation(`phase ${x.phase} has no round`);\n}\n\n/** The `investigation` iteration intake opens; its budget bounds every round. */\nexport function investigationIteration(s: WorkflowState<string>): Iteration {\n return (\n s.iterations.find((it) => it.id === \"investigation\") ??\n brokenInvestigation('there is no \"investigation\" iteration')\n );\n}\n","import { fail } from \"../../core/errors.ts\";\nimport type { Budget } from \"../../core/types.ts\";\nexport interface InvestigationConfig {\n question: string;\n maxRounds: number;\n budget: Budget;\n}\nexport function validateInvestigationConfig(raw: unknown): InvestigationConfig {\n const c = raw as InvestigationConfig;\n if (\n !c ||\n typeof c !== \"object\" ||\n Array.isArray(c) ||\n typeof c.question !== \"string\" ||\n !c.question.trim() ||\n !Number.isSafeInteger(c.maxRounds) ||\n c.maxRounds < 1 ||\n !c.budget ||\n typeof c.budget !== \"object\" ||\n Array.isArray(c.budget) ||\n !Object.keys(c.budget).length ||\n Object.entries(c.budget).some(\n ([k, v]) =>\n ![\"tokens\", \"turns\", \"wallclockMs\"].includes(k) ||\n typeof v !== \"number\" ||\n !Number.isFinite(v) ||\n v <= 0,\n )\n )\n fail(\n \"config-invalid\",\n \"investigation requires question, positive maxRounds and a finite positive budget\",\n \"provide bounded investigation config\",\n );\n return { question: c.question, maxRounds: c.maxRounds, budget: { ...c.budget } };\n}\n","import { readInvestigation, writeInvestigation } from \"./record.ts\";\nimport { executionActors, freshOutputRefs } from \"./execution.ts\";\nimport { independenceConflicts } from \"../../common/independence.ts\";\nimport { frozenChanges } from \"../../common/frozen.ts\";\nimport { fail } from \"../../core/errors.ts\";\nimport { brokenInvestigation, investigationIteration, lastRound } from \"./invariants.ts\";\nimport { roleOf } from \"../../core/roles/lookup.ts\";\nimport { addItem } from \"../../core/items/record.ts\";\nimport { moveItem } from \"../../core/items/move.ts\";\nimport { applyAction } from \"../../core/methodology.ts\";\nimport { appendEvent, nowOf } from \"../../core/state.ts\";\nimport { isExhausted } from \"../../core/budget.ts\";\nimport type {\n Capability,\n Ceremony,\n CeremonyInput,\n Methodology,\n WorkflowState,\n} from \"../../core/types.ts\";\nimport { validateInvestigationConfig, type InvestigationConfig } from \"./config.ts\";\nimport type {\n BeliefUpdate,\n Experiment,\n Hypothesis,\n InvestigationConclusion,\n InvestigationState,\n Observation,\n} from \"./state.ts\";\nfunction reject(s: WorkflowState, name: string, message: string, fix: string): never {\n const x = readInvestigation(s);\n return fail(\"invalid-input\", `${name} (phase ${x?.phase ?? \"intake\"}): ${message}`, fix, {\n items: x ? [x.item, ...(x.rounds.at(-1) ? [x.rounds.at(-1)!.item] : [])] : [],\n });\n}\nconst sameHypothesis = (a: Hypothesis | undefined, b: Hypothesis | undefined) =>\n !!a && !!b && !frozenChanges(a, b, [\"id\", \"claim\", \"falsifiedBy\"]).length;\nconst text = (v: unknown): v is string => typeof v === \"string\" && v.trim().length > 0;\nconst refs = (v: unknown): v is string[] =>\n Array.isArray(v) && v.length > 0 && v.every(text) && new Set(v).size === v.length;\n/** First key of a caller record outside its contract; stored records are closed objects (state schema). */\nconst extraKey = (v: unknown, keys: readonly string[]): string | undefined =>\n v && typeof v === \"object\" && !Array.isArray(v)\n ? Object.keys(v).find((k) => !keys.includes(k))\n : undefined;\nconst extraKeyIn = (list: unknown, keys: readonly string[]): string | undefined =>\n Array.isArray(list) ? list.map((v) => extraKey(v, keys)).find(Boolean) : undefined;\nfunction authorize(s: WorkflowState, by: string, cap: Capability) {\n if (!roleOf(s, by)?.capabilities.includes(cap))\n fail(\n \"missing-capability\",\n `${by} needs ${cap}`,\n \"use a registered role with the required capability\",\n );\n}\nfunction save(s: WorkflowState, x: InvestigationState, i: CeremonyInput, name: string) {\n return appendEvent(\n writeInvestigation(s, x),\n `investigation.${name}`,\n i.by,\n { ...x },\n nowOf(i.now),\n );\n}\nexport function closeInvestigation(\n s: WorkflowState,\n x: InvestigationState,\n i: CeremonyInput,\n outcome: \"stopped\" | \"resolved\" | \"inconclusive\",\n reason?: string,\n) {\n const at = nowOf(i.now);\n let n = save(\n s,\n { ...x, phase: \"closed\", outcome, ...(reason ? { stopReason: reason } : {}) },\n i,\n outcome,\n );\n n = {\n ...n,\n iterations: n.iterations.map((it) =>\n it.id === \"investigation\"\n ? { ...it, endedAt: at, outcome: outcome === \"stopped\" ? \"cancelled\" : \"completed\" }\n : it,\n ),\n };\n for (const item of Object.values(n.items).filter(\n (candidate) => candidate.id === x.item || x.rounds.some((r) => r.item === candidate.id),\n ))\n if (item.status !== \"done\" && item.status !== \"dropped\")\n n = moveItem(\n n,\n item.id,\n { status: outcome === \"resolved\" && item.id === x.item ? \"done\" : \"dropped\" },\n i.by,\n at,\n );\n return n;\n}\nexport function investigationCeremonies(\n factory: () => Methodology<InvestigationConfig>,\n): Record<string, Ceremony> {\n let built: Methodology<InvestigationConfig> | undefined;\n const methodology = () => (built ??= factory());\n const make =\n (\n name: string,\n cap: Capability,\n phase: string | undefined,\n fn: (\n s: WorkflowState,\n x: InvestigationState,\n i: CeremonyInput,\n bad: (message: string, fix: string) => never,\n ) => WorkflowState,\n ): Ceremony =>\n (s, i) => {\n authorize(s, i.by, cap);\n const x = readInvestigation(s);\n if (!x || x.phase === \"closed\")\n reject(s, name, \"no active investigation\", \"start a new investigation with intake {item}\");\n if (phase && x.phase !== phase && !(name === \"hypotheses\" && x.phase === \"preregister\"))\n reject(\n s,\n name,\n `expected ${phase}, got ${x.phase}`,\n `finish phase ${x.phase} before calling ${name}; ${name} requires phase ${phase}`,\n );\n return applyAction(s, methodology(), { type: `ceremony.${name}`, by: i.by, payload: i }, () =>\n fn(s, x, i, (message, fix) => reject(s, name, message, fix)),\n );\n };\n return {\n intake(s, i) {\n authorize(s, i.by, \"facilitate\");\n const bad = (message: string, fix: string) => reject(s, \"intake\", message, fix);\n if (s.methodology !== \"investigation\")\n bad(\n `workflow methodology is ${s.methodology}, not investigation`,\n \"init a workflow with the investigation methodology before intake\",\n );\n if (readInvestigation(s))\n bad(\n \"investigation already started\",\n \"use the existing investigation or initialize a new workflow\",\n );\n if (!text(i.item))\n bad(\"item is required\", \"set intake.item to a unique investigation item ID\");\n const c = validateInvestigationConfig(s.config);\n return applyAction(\n s,\n methodology(),\n { type: \"ceremony.intake\", by: i.by, payload: i },\n () => {\n let n = addItem(\n s,\n {\n id: i.item as string,\n title: c.question,\n acceptance: [\"Independent evidence-based conclusion\"],\n stage: \"intake\",\n },\n i.by,\n i.now,\n );\n n = {\n ...n,\n iterations: [\n ...n.iterations,\n {\n id: \"investigation\",\n goal: c.question,\n budget: { ...c.budget },\n spent: { tokens: 0, turns: 0, wallclockMs: 0 },\n startedAt: nowOf(i.now),\n committed: [],\n carryover: [],\n },\n ],\n };\n return save(\n n,\n {\n item: i.item as string,\n phase: \"hypotheses\",\n hypotheses: [],\n rounds: [],\n contributors: [i.by],\n },\n i,\n \"intake\",\n );\n },\n );\n },\n hypotheses: make(\"hypotheses\", \"define-acceptance\", \"hypotheses\", (s, x, i, bad) => {\n const h = i.hypotheses as Hypothesis[];\n const extra = extraKeyIn(h, [\"id\", \"claim\", \"falsifiedBy\"]);\n if (extra)\n bad(\n `unknown key \"${extra}\" in a hypotheses entry`,\n \"use only id, claim and falsifiedBy in each hypotheses entry\",\n );\n if (\n !Array.isArray(h) ||\n !h.length ||\n h.some((v) => !v || !text(v.id) || !text(v.claim) || !text(v.falsifiedBy)) ||\n new Set(h.map((v) => v.id)).size !== h.length ||\n (h.length < 2 && !text(i.singleHypothesisRationale))\n )\n bad(\n \"provide competing falsifiable hypotheses or single-testable rationale\",\n \"set hypotheses to unique {id, claim, falsifiedBy} entries; supply singleHypothesisRationale when there is only one\",\n );\n return save(\n s,\n {\n ...x,\n hypotheses: h.map((v) => ({ id: v.id, claim: v.claim, falsifiedBy: v.falsifiedBy })),\n ...(text(i.singleHypothesisRationale)\n ? { singleHypothesisRationale: i.singleHypothesisRationale }\n : {}),\n contributors: [...new Set([...x.contributors, i.by])],\n phase: \"preregister\",\n },\n i,\n \"hypotheses\",\n );\n }),\n preregister: make(\"preregister\", \"define-acceptance\", \"preregister\", (s, x, i, bad) => {\n const c = validateInvestigationConfig(s.config),\n it = s.iterations.find((v) => v.id === \"investigation\");\n if (x.rounds.length >= c.maxRounds || !it || isExhausted(c.budget, it.spent))\n bad(\n `round limit or budget exhausted (${x.rounds.length} of ${c.maxRounds} rounds used)`,\n \"call stop {reason} to close this investigation, or start a new one with a larger maxRounds or budget\",\n );\n const e = i.experiment as Experiment;\n const extraExperiment =\n extraKey(e, [\"id\", \"procedureRef\", \"predictions\", \"replayOf\"]) ??\n extraKeyIn(e?.predictions, [\"hypothesis\", \"prediction\"]);\n if (extraExperiment)\n bad(\n `unknown key \"${extraExperiment}\" in experiment`,\n \"use only id, procedureRef, predictions [{hypothesis, prediction}] and replayOf in experiment\",\n );\n if (\n !e ||\n !text(e.id) ||\n !text(e.procedureRef) ||\n x.rounds.some((r) => r.experiment.id === e.id) ||\n !Array.isArray(e.predictions) ||\n e.predictions.length !== x.hypotheses.length ||\n x.hypotheses.some(\n (h) =>\n e.predictions.filter((p) => p?.hypothesis === h.id && text(p.prediction)).length !== 1,\n ) ||\n new Set(e.predictions.map((p) => p.prediction)).size !== e.predictions.length\n )\n bad(\n \"preregister unique experiment with differing predictions for every hypothesis\",\n \"set experiment.id to a new ID, experiment.procedureRef, and one distinct experiment.predictions entry per hypothesis\",\n );\n if (e.replayOf) {\n const prior = x.rounds.find((r) => r.experiment.id === e.replayOf && r.result?.valid);\n if (\n !prior ||\n frozenChanges(prior.experiment, e, [\"procedureRef\"]).length ||\n prior.hypotheses.length !== x.hypotheses.length ||\n x.hypotheses.some(\n (h) =>\n !sameHypothesis(\n h,\n prior.hypotheses.find((p) => p.id === h.id),\n ),\n ) ||\n e.predictions.some(\n (p) =>\n !prior.experiment.predictions.some(\n (q) => !frozenChanges(q, p, [\"hypothesis\", \"prediction\"]).length,\n ),\n )\n )\n bad(\n \"replay must repeat the procedure, predictions and hypotheses of a prior valid experiment\",\n \"set experiment.replayOf to a valid prior experiment with identical procedureRef, predictions and hypothesis definitions\",\n );\n }\n const id = `${x.item}-run-${x.rounds.length + 1}`;\n let n = addItem(\n s,\n {\n id,\n title: `Experiment ${e.id}`,\n stage: \"execute\",\n acceptance: [e.procedureRef],\n iteration: \"investigation\",\n },\n i.by,\n i.now,\n );\n n = {\n ...n,\n iterations: n.iterations.map((iteration) =>\n iteration.id === \"investigation\"\n ? { ...iteration, committed: [...iteration.committed, id] }\n : iteration,\n ),\n };\n return save(\n n,\n {\n ...x,\n phase: \"observe\",\n rounds: [\n ...x.rounds,\n {\n experiment: {\n id: e.id,\n procedureRef: e.procedureRef,\n predictions: e.predictions.map((p) => ({\n hypothesis: p.hypothesis,\n prediction: p.prediction,\n })),\n ...(e.replayOf ? { replayOf: e.replayOf } : {}),\n },\n hypotheses: x.hypotheses.map((v) => ({ ...v })),\n item: id,\n by: i.by,\n },\n ],\n contributors: [...new Set([...x.contributors, i.by])],\n },\n i,\n \"preregister\",\n );\n }),\n observe: make(\"observe\", \"verify\", \"observe\", (s, x, i, bad) => {\n const r = lastRound(x),\n o = i.result as Observation;\n const extra = extraKey(o, [\"id\", \"valid\", \"summary\", \"provenanceRefs\"]);\n if (extra)\n bad(\n `unknown key \"${extra}\" in result`,\n \"use only id, valid, summary and provenanceRefs in result\",\n );\n if (\n i.experiment !== r.experiment.id ||\n !o ||\n !text(o.id) ||\n typeof o.valid !== \"boolean\" ||\n !text(o.summary) ||\n !refs(o.provenanceRefs) ||\n x.rounds.some((prior) => prior.result?.id === o.id)\n )\n bad(\n \"observation needs current experiment, unique result and provenance\",\n \"set experiment to the active experiment ID and result to {id, valid, summary, provenanceRefs} with a new result.id\",\n );\n if (s.items[r.item]?.status !== \"done\")\n bad(\n \"complete experiment execution before recording observations\",\n \"dispatch and complete the active experiment item before calling observe\",\n );\n if (!freshOutputRefs(s, r.item).some((ref) => o.provenanceRefs.includes(ref)))\n bad(\n \"observation must link fresh experiment-output evidence from the latest completion\",\n `include an experiment-output ref produced by the latest successful completion of item \"${r.item}\" in result.provenanceRefs`,\n );\n return save(\n s,\n {\n ...x,\n phase: \"update-belief\",\n rounds: x.rounds.map((v) =>\n v === r\n ? {\n ...v,\n result: {\n id: o.id,\n valid: o.valid,\n summary: o.summary,\n provenanceRefs: [...o.provenanceRefs],\n },\n }\n : v,\n ),\n contributors: [...new Set([...x.contributors, i.by, ...executionActors(s, r.item)])],\n },\n i,\n \"observe\",\n );\n }),\n \"update-belief\": make(\"update-belief\", \"define-acceptance\", \"update-belief\", (s, x, i, bad) => {\n const r = lastRound(x),\n a = i.assessments as BeliefUpdate[\"assessments\"];\n const extra = extraKeyIn(a, [\"hypothesis\", \"assessment\", \"reason\"]);\n if (extra)\n bad(\n `unknown key \"${extra}\" in an assessments entry`,\n \"use only hypothesis, assessment and reason in each assessments entry\",\n );\n if (\n i.result !== r.result?.id ||\n !Array.isArray(a) ||\n a.length !== x.hypotheses.length ||\n x.hypotheses.some(\n (h) =>\n a.filter(\n (v) =>\n v?.hypothesis === h.id &&\n [\"supported\", \"refuted\", \"uncertain\"].includes(v.assessment) &&\n text(v.reason),\n ).length !== 1,\n ) ||\n ![\"round\", \"conclusion\"].includes(i.next as string)\n )\n bad(\n \"belief update must assess every hypothesis against current result\",\n \"set result to the latest result ID, assessments to one {hypothesis, assessment, reason} per hypothesis, and next to round or conclusion\",\n );\n const result = r.result ?? brokenInvestigation(`round ${r.experiment.id} has no result`);\n if (!result.valid && a.some((v) => v.assessment !== \"uncertain\"))\n bad(\n \"invalid experiments cannot support beliefs\",\n \"set every assessment to uncertain for an invalid experiment result\",\n );\n let n = save(\n s,\n {\n ...x,\n phase: i.next === \"round\" ? \"preregister\" : \"conclusion\",\n rounds: x.rounds.map((v) =>\n v === r\n ? {\n ...v,\n update: {\n result: i.result as string,\n assessments: a.map((entry) => ({\n hypothesis: entry.hypothesis,\n assessment: entry.assessment,\n reason: entry.reason,\n })),\n },\n }\n : v,\n ),\n contributors: [...new Set([...x.contributors, i.by])],\n },\n i,\n \"belief-updated\",\n );\n const it = investigationIteration(n);\n if (\n i.next === \"round\" &&\n (x.rounds.length >= validateInvestigationConfig(s.config).maxRounds ||\n isExhausted(it.budget, it.spent))\n )\n n = closeInvestigation(\n n,\n readInvestigation(n)!,\n i,\n \"stopped\",\n \"budget or round limit exhausted\",\n );\n return n;\n }),\n conclude: make(\"conclude\", \"define-acceptance\", \"conclusion\", (s, x, i, bad) => {\n const c = i as unknown as InvestigationConclusion;\n if (\n ![\"resolved\", \"inconclusive\"].includes(c.outcome) ||\n !text(c.summary) ||\n !refs(c.evidenceRefs) ||\n c.evidenceRefs.some((ref) => !x.rounds.some((r) => r.result?.provenanceRefs.includes(ref)))\n )\n bad(\n \"conclusion needs observed evidence references\",\n \"set outcome, summary and evidenceRefs to references preserved in recorded observations\",\n );\n if (\n c.outcome === \"resolved\" &&\n (!text(c.supportedHypothesis) ||\n !x.rounds\n .slice(-1)\n .some(\n (r) =>\n r.result?.valid &&\n r.update?.assessments.some(\n (a) => a.hypothesis === c.supportedHypothesis && a.assessment === \"supported\",\n ),\n ))\n )\n bad(\n \"resolved conclusion needs a supported hypothesis\",\n \"set supportedHypothesis to a hypothesis supported by the latest valid round, or choose outcome inconclusive\",\n );\n return save(\n s,\n {\n ...x,\n phase: \"review\",\n conclusion: {\n outcome: c.outcome,\n summary: c.summary,\n evidenceRefs: [...c.evidenceRefs],\n ...(c.supportedHypothesis ? { supportedHypothesis: c.supportedHypothesis } : {}),\n by: i.by,\n },\n contributors: [...new Set([...x.contributors, i.by])],\n },\n i,\n \"conclusion\",\n );\n }),\n \"review-conclusion\": make(\"review-conclusion\", \"review\", \"review\", (s, x, i, bad) => {\n const conclusion = x.conclusion ?? brokenInvestigation(\"phase review has no conclusion\");\n if (independenceConflicts(i.by, x.contributors).length)\n bad(\n \"conclusion reviewer must be independent of investigation contributors\",\n \"use a review-capable role that did not contribute to or execute this investigation\",\n );\n if (typeof i.approve !== \"boolean\" || !text(i.reason))\n bad(\n \"review needs approval and reason\",\n \"set approve to a boolean and reason to a nonempty review explanation\",\n );\n if (!i.approve) {\n const target = i.next ?? \"conclusion\";\n if (target !== \"round\" && target !== \"conclusion\")\n bad(\n \"review rejection next must be round or conclusion\",\n \"set next to round for more evidence or conclusion for a revised conclusion\",\n );\n const n = save(\n s,\n {\n ...x,\n phase: target === \"round\" ? \"preregister\" : \"conclusion\",\n reviewHistory: [\n ...(x.reviewHistory ?? []),\n {\n by: i.by,\n reason: i.reason as string,\n approve: false,\n next: target as \"round\" | \"conclusion\",\n replayRefs: [],\n },\n ],\n },\n i,\n \"review-rejected\",\n );\n const iteration = investigationIteration(s);\n if (\n target === \"round\" &&\n (x.rounds.length >= validateInvestigationConfig(s.config).maxRounds ||\n isExhausted(iteration.budget, iteration.spent))\n )\n return closeInvestigation(\n n,\n readInvestigation(n)!,\n i,\n \"stopped\",\n \"budget or round limit exhausted after review requested another round\",\n );\n return n;\n }\n const replayRefs = Array.isArray(i.replayRefs) ? i.replayRefs : [];\n if (\n conclusion.outcome === \"resolved\" &&\n (!refs(replayRefs) ||\n !x.rounds.some(\n (r) =>\n r.experiment.replayOf &&\n !independenceConflicts(\n executionActors(s, r.item),\n executionActors(\n s,\n (\n x.rounds.find((p) => p.experiment.id === r.experiment.replayOf) ??\n brokenInvestigation(\n `round ${r.experiment.id} replays the unknown experiment ${r.experiment.replayOf}`,\n )\n ).item,\n ),\n ).length &&\n sameHypothesis(\n r.hypotheses.find((h) => h.id === conclusion.supportedHypothesis),\n lastRound(x).hypotheses.find((h) => h.id === conclusion.supportedHypothesis),\n ) &&\n r.result?.valid &&\n replayRefs.includes(r.result.id) &&\n r.update?.assessments.some(\n (a) =>\n a.hypothesis === conclusion.supportedHypothesis && a.assessment === \"supported\",\n ),\n ))\n )\n bad(\n \"resolved conclusion requires valid replay result and supporting belief update\",\n \"set replayRefs to a valid independent replay result supporting the latest supported hypothesis definition, or reject with next round\",\n );\n return closeInvestigation(\n s,\n {\n ...x,\n review: { by: i.by, reason: i.reason as string, replayRefs: replayRefs as string[] },\n reviewHistory: [\n ...(x.reviewHistory ?? []),\n {\n by: i.by,\n reason: i.reason as string,\n approve: true,\n replayRefs: replayRefs as string[],\n },\n ],\n },\n i,\n conclusion.outcome,\n );\n }),\n stop: make(\"stop\", \"facilitate\", undefined, (s, x, i, bad) => {\n if (!text(i.reason))\n bad(\n \"stop needs reason\",\n \"set reason to a nonempty explanation for stopping this investigation\",\n );\n return closeInvestigation(s, x, i, \"stopped\", i.reason as string);\n }),\n };\n}\n","import { readInvestigation } from \"./record.ts\";\nimport { executionActors } from \"./execution.ts\";\nimport { independenceConflicts } from \"../../common/independence.ts\";\nimport type { Rule } from \"../../core/types.ts\";\nexport function investigationRules(): Rule[] {\n return [\n {\n id: \"independent-replay\",\n severity: \"error\",\n check(s, a) {\n if (a.type !== \"item.complete\") return [];\n const round = readInvestigation(s)?.rounds.find(\n (r) => r.item === (a.payload as { item?: string })?.item,\n );\n const prior = readInvestigation(s)?.rounds.find(\n (r) => r.experiment.id === round?.experiment.replayOf,\n );\n return prior && independenceConflicts(a.by, executionActors(s, prior.item)).length\n ? [\n {\n rule: \"independent-replay\",\n item: round!.item,\n severity: \"error\",\n message: \"Replay executor also executed the original experiment\",\n fix: \"assign a different deliver-capable role\",\n },\n ]\n : [];\n },\n },\n {\n id: \"investigation-execution-only\",\n severity: \"error\",\n check(s, a) {\n if (a.type !== \"item.complete\") return [];\n const p = a.payload as { item: string };\n const x = readInvestigation(s);\n return x?.phase === \"observe\" && x.rounds.at(-1)?.item === p.item\n ? []\n : [\n {\n rule: \"investigation-execution-only\",\n item: p.item,\n severity: \"error\",\n message: \"Only the active preregistered experiment can complete\",\n fix: `complete only the active experiment item in phase observe; current phase is ${x?.phase ?? \"intake\"}`,\n },\n ];\n },\n },\n ];\n}\n","import type { Role } from \"../../core/types.ts\";\nexport function investigationRoles(): Role[] {\n return [\n {\n id: \"replay-worker\",\n name: \"Independent replay worker\",\n modelTier: \"small\",\n capabilities: [\"deliver\", \"verify\"],\n canApprove: [],\n inputs: [\"preregistered-experiment\"],\n outputs: [\"experiment-output\"],\n do_not: [\"Do not change the replay procedure\"],\n },\n {\n id: \"investigator\",\n name: \"Investigator\",\n modelTier: \"large\",\n capabilities: [\"facilitate\", \"define-acceptance\", \"deliver\", \"verify\"],\n canApprove: [],\n inputs: [\"question\", \"prior-results\"],\n outputs: [\"hypotheses\", \"preregistered-experiment\", \"belief-update\"],\n do_not: [\"Do not revise predictions after execution\", \"Do not approve your own conclusions\"],\n },\n {\n id: \"conclusion-reviewer\",\n name: \"Independent conclusion reviewer\",\n modelTier: \"large\",\n capabilities: [\"review\"],\n canApprove: [\"investigation-conclusion\"],\n inputs: [\"evidence\", \"replay\", \"conclusion\"],\n outputs: [\"conclusion-review\"],\n do_not: [\"Do not approve unsupported conclusions\"],\n },\n ];\n}\n","import type { Stage } from \"../../core/types.ts\";\nexport function investigationStages(): Stage[] {\n return [\n {\n id: \"intake\",\n name: \"Intake\",\n entryPolicy: [],\n exitPolicy: [{ kind: \"acceptance-written\" }],\n },\n {\n id: \"execute\",\n name: \"Execute preregistered experiment\",\n entryPolicy: [{ kind: \"acceptance-written\" }, { kind: \"no-open-blockers\" }],\n exitPolicy: [{ kind: \"evidence\", evidenceKind: \"experiment-output\" }],\n },\n { id: \"observed\", name: \"Execution recorded\", entryPolicy: [], exitPolicy: [] },\n ];\n}\n","import { readInvestigation } from \"./record.ts\";\nimport { fail } from \"../../core/errors.ts\";\nimport { executionActors } from \"./execution.ts\";\nimport { independenceConflicts } from \"../../common/independence.ts\";\nimport { closeInvestigation, investigationCeremonies } from \"./ceremonies.ts\";\nimport { investigationIteration } from \"./invariants.ts\";\nimport { investigationRules } from \"./rules.ts\";\nimport { investigationRoles } from \"./roles.ts\";\nimport { investigationStages } from \"./stages.ts\";\nimport { isExhausted } from \"../../core/budget.ts\";\nimport type { Methodology } from \"../../core/types.ts\";\nimport { validateInvestigationConfig, type InvestigationConfig } from \"./config.ts\";\nexport { validateInvestigationConfig };\nexport type { InvestigationConfig };\nexport type * from \"./state.ts\";\nexport function investigation(): Methodology<InvestigationConfig> {\n return {\n name: \"investigation\",\n validateConfig: validateInvestigationConfig,\n lockedConfigKeys: [\"question\", \"maxRounds\", \"budget\"],\n vocabulary: {\n backlog: \"Questions\",\n item: \"Investigation artifact\",\n stage: \"Investigation phase\",\n iteration: \"Investigation budget\",\n increment: \"Conclusion\",\n ceremony: \"Investigation ceremony\",\n gate: \"Independent conclusion review\",\n },\n defaultStages: investigationStages,\n defaultRoles: investigationRoles,\n requiredCapabilities: [\"facilitate\", \"define-acceptance\", \"deliver\", \"verify\", \"review\"],\n exclusiveCapabilities: [],\n humanDefaults: { gates: \"none\" },\n ceremonies: investigationCeremonies(investigation),\n plannerOptions: (state) => ({\n schedulerMode: \"level\",\n concurrencyCap: 1,\n roleFor: (item) => {\n const r = readInvestigation(state)?.rounds.find((candidate) => candidate.item === item.id);\n const prior = readInvestigation(state)?.rounds.find(\n (p) => p.experiment.id === r?.experiment.replayOf,\n );\n const excluded = prior ? executionActors(state, prior.item) : [];\n const roles = Object.values(state.roles);\n const selected =\n (!prior\n ? roles.find(\n (role) =>\n role.capabilities.includes(\"deliver\") &&\n role.capabilities.includes(\"define-acceptance\"),\n )\n : undefined) ??\n roles.find(\n (role) =>\n role.capabilities.includes(\"deliver\") &&\n !independenceConflicts(role.id, excluded).length,\n );\n if (!selected)\n fail(\n \"missing-capability\",\n `No eligible executor for experiment item \"${item.id}\"`,\n prior\n ? `register an independent deliver-capable role that did not execute \"${prior.item}\"`\n : \"register a role with deliver capability\",\n { items: [item.id] },\n );\n return selected.id;\n },\n estimateMode: \"per-call\",\n fallbackTokensPerWeight: 1,\n }),\n candidates: (s) => {\n // read the record once, not once per item (U10 F2)\n const x = readInvestigation(s);\n const round = x?.rounds.at(-1)?.item;\n return x?.phase === \"observe\" &&\n !isExhausted((s.config as InvestigationConfig).budget, investigationIteration(s).spent)\n ? Object.values(s.items).filter(\n (i) => i.id === round && i.stage === \"execute\" && i.status === \"todo\",\n )\n : [];\n },\n afterComplete: (state, item, now) => {\n const x = readInvestigation(state);\n const iteration = state.iterations.find((it) => it.id === \"investigation\");\n if (\n x?.phase !== \"observe\" ||\n x.rounds.at(-1)?.item !== item ||\n state.items[item]?.status === \"done\" ||\n !iteration ||\n !isExhausted(iteration.budget, iteration.spent)\n )\n return state;\n return closeInvestigation(\n state,\n x,\n { by: \"investigation\", now },\n \"stopped\",\n `budget exhausted before experiment item \"${item}\" completed; start a new investigation with sufficient budget`,\n );\n },\n invariants: (s) => [\n `Question: ${(s.config as InvestigationConfig).question}`,\n \"Execute only the preregistered procedure; retain raw observation provenance; report invalid runs.\",\n ],\n rules: investigationRules(),\n metrics: (s) => ({\n rounds: readInvestigation(s)?.rounds.length ?? 0,\n validRuns: readInvestigation(s)?.rounds.filter((r) => r.result?.valid).length ?? 0,\n invalidRuns:\n readInvestigation(s)?.rounds.filter((r) => r.result && !r.result.valid).length ?? 0,\n }),\n report: (s) => ({\n phase: readInvestigation(s)?.phase ?? \"intake\",\n outcome: readInvestigation(s)?.outcome ?? null,\n rounds: readInvestigation(s)?.rounds.length ?? 0,\n conclusion: readInvestigation(s)?.conclusion ?? null,\n stopReason: readInvestigation(s)?.stopReason ?? null,\n }),\n };\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {l}from'./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import {l}from'./chunk-5ZGNEY2I.mjs';import {I}from'./chunk-3S7F5QXK.mjs';import {N as N$1}from'./chunk-CX2E7ZTQ.mjs';import {b as b$2}from'./chunk-OEHVWRJG.mjs';import {h}from'./chunk-ILDXZWEL.mjs';import {c,b as b$1,a}from'./chunk-YS6CXERQ.mjs';var N=[["vocabulary","object"],["validateConfig","function"],["defaultStages","function"],["defaultRoles","function"],["requiredCapabilities","array"],["exclusiveCapabilities","array"],["plannerOptions","function"],["candidates","function"],["invariants","function"],["ceremonies","object"],["rules","array"],["metrics","function"],["humanDefaults","object"]],b=r=>{try{return String(r)}catch{return "a non-Error value"}};function M(r){let e=new Map,l=(o,t,w=false)=>{if(c(o,"methodology name"),typeof t!="function"&&b$1("invalid-input",`methodology "${o}" factory must be a function`,'pass the factory itself, e.g. registerMethodology("triage", triage)'),e.has(o)&&b$1("invalid-input",`methodology "${o}" is already registered`,`pick a name that is not one of: ${[...e.keys()].join(", ")}`),!w){let n;try{n=t();}catch(i){if(i instanceof a)throw i;b$1("invalid-input",`methodology "${o}" factory threw: ${b(i)}`,"fix the factory: registration calls it once");}let y=typeof n!="object"||n===null?"an object":n.name!==o?`name "${o}"`:N.find(([i,d])=>d==="array"?!Array.isArray(n[i]):typeof n[i]!==d||!n[i])?.[0];y&&b$1("invalid-input",`methodology "${o}" factory must return a Methodology; it lacks ${y}`,"return the full Methodology object (name, vocabulary, validateConfig, defaultStages, defaultRoles, capabilities, plannerOptions, candidates, invariants, ceremonies, rules, metrics, humanDefaults)");}e.set(o,t);};for(let[o,t]of Object.entries(r))l(o,t,true);return {registerMethodology:(o,t)=>l(o,t),methodologyFactory(o){c(o,"methodology name");let t=e.get(o);return t||b$1("invalid-input",`unknown methodology "${o}"`,`known methodologies: ${[...e.keys()].join(", ")||"(none)"}; register a custom one with registerMethodology`),t},registeredMethodologies:()=>[...e.keys()]}}var v,g=()=>v??=M({scrum:l,kanban:I,waterfall:N$1,investigation:b$2,experimentation:h});function S(r,e){g().registerMethodology(r,e);}function O(r){return g().methodologyFactory(r)}function A(){return g().registeredMethodologies()}export{S as a,O as b,A as c};//# sourceMappingURL=chunk-UT7QV6CE.mjs.map
|
|
2
|
+
//# sourceMappingURL=chunk-UT7QV6CE.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/interface/registry.ts","../src/registry.ts"],"names":["MEMBERS","thrown","e","createMethodologyRegistry","initial","table","register","name","factory","builtIn","assertId","fail","m","WorkflowError","missing","key","kind","registry","builtins","scrum","kanban","waterfall","investigation","experimentation","registerMethodology","methodologyFactory","registeredMethodologies"],"mappings":"uPAoBA,IAAMA,EAAU,CACd,CAAC,YAAA,CAAc,QAAQ,EACvB,CAAC,gBAAA,CAAkB,UAAU,CAAA,CAC7B,CAAC,eAAA,CAAiB,UAAU,CAAA,CAC5B,CAAC,eAAgB,UAAU,CAAA,CAC3B,CAAC,sBAAA,CAAwB,OAAO,CAAA,CAChC,CAAC,uBAAA,CAAyB,OAAO,EACjC,CAAC,gBAAA,CAAkB,UAAU,CAAA,CAC7B,CAAC,YAAA,CAAc,UAAU,EACzB,CAAC,YAAA,CAAc,UAAU,CAAA,CACzB,CAAC,YAAA,CAAc,QAAQ,EACvB,CAAC,OAAA,CAAS,OAAO,CAAA,CACjB,CAAC,SAAA,CAAW,UAAU,CAAA,CACtB,CAAC,gBAAiB,QAAQ,CAC5B,EAOMC,CAAAA,CAAUC,CAAAA,EAAuB,CACrC,GAAI,CACF,OAAO,MAAA,CAAOA,CAAC,CACjB,CAAA,KAAQ,CACN,OAAO,mBACT,CACF,CAAA,CAEO,SAASC,CAAAA,CAGdC,EACqB,CACrB,IAAMC,EAAQ,IAAI,GAAA,CACZC,EAAW,CAACC,CAAAA,CAAcC,CAAAA,CAAkBC,CAAAA,CAAU,QAAU,CAepE,GAdAC,CAAAA,CAASH,CAAAA,CAAM,kBAAkB,CAAA,CAC7B,OAAOC,CAAAA,EAAY,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CAAO,CAAA,GAAK,MAAA,CAAO,OAAA,CAAQJ,CAAO,CAAA,CAAGE,CAAAA,CAASC,EAAMC,CAAAA,CAAS,IAAI,EACnF,OAAO,CACL,mBAAA,CAAqB,CAACD,EAAMC,CAAAA,GAAYF,CAAAA,CAASC,CAAAA,CAAMC,CAAO,EAC9D,kBAAA,CAAqCD,CAAAA,CAAgC,CACnEG,CAAAA,CAASH,EAAM,kBAAkB,CAAA,CACjC,IAAMC,CAAAA,CAAUH,CAAAA,CAAM,IAAIE,CAAI,CAAA,CAC9B,OAAKC,CAAAA,EACHG,IACE,eAAA,CACA,CAAA,qBAAA,EAAwBJ,CAAI,CAAA,CAAA,CAAA,CAC5B,wBAAwB,CAAC,GAAGF,CAAAA,CAAM,IAAA,EAAM,CAAA,CAAE,IAAA,CAAK,IAAI,CAAA,EAAK,QAAQ,CAAA,gDAAA,CAClE,CAAA,CACKG,CACT,CAAA,CACA,wBAAyB,IAAM,CAAC,GAAGH,CAAAA,CAAM,MAAM,CACjD,CACF,CCjGA,IAAIY,CAAAA,CACEC,CAAAA,CAAW,IACdD,CAAAA,GAAad,CAAAA,CAA0B,CACtC,KAAA,CAAAgB,CAAAA,CACA,MAAA,CAAAC,CAAAA,CACA,UAAAC,GAAAA,CACA,aAAA,CAAAC,GAAAA,CACA,eAAA,CAAAC,CACF,CAAC,CAAA,CAGI,SAASC,CAAAA,CACdjB,EACAC,CAAAA,CACM,CACNU,GAAS,CAAE,mBAAA,CAAoBX,EAAMC,CAAO,EAC9C,CAGO,SAASiB,EAA8ClB,CAAAA,CAAgC,CAC5F,OAAOW,CAAAA,GAAW,kBAAA,CAAmBX,CAAI,CAC3C,CAGO,SAASmB,CAAAA,EAAoC,CAClD,OAAOR,CAAAA,EAAS,CAAE,yBACpB","file":"chunk-6D6FL3XK.mjs","sourcesContent":["import { WorkflowError, assertId, fail } from \"../core/errors.ts\";\nimport type { Methodology } from \"../core/types.ts\";\n\n/** A methodology factory, as the built-in entries export them (`scrum`, `kanban`, ...). */\nexport type MethodologyFactory<N extends string = string> = () => Methodology<unknown, N>;\n\n/** Name -> factory lookup: what `exwf init <name>` and a state's `methodology` resolve through. */\nexport interface MethodologyRegistry {\n /**\n * Adds `name`; a name already registered (a built-in included) fails `invalid-input`. The\n * factory is called once to check that it returns a Methodology named `name`.\n */\n registerMethodology<C, N extends string>(name: N, factory: () => Methodology<C, N>): void;\n /** The factory registered under `name`; an unknown name fails `invalid-input` listing the known ones. */\n methodologyFactory<N extends string = string>(name: N): MethodologyFactory<N>;\n /** Registered names, pre-registered ones first, then in registration order. */\n registeredMethodologies(): string[];\n}\n\n// the required members of a Methodology (src/core/types.ts) and their runtime kinds\nconst MEMBERS = [\n [\"vocabulary\", \"object\"],\n [\"validateConfig\", \"function\"],\n [\"defaultStages\", \"function\"],\n [\"defaultRoles\", \"function\"],\n [\"requiredCapabilities\", \"array\"],\n [\"exclusiveCapabilities\", \"array\"],\n [\"plannerOptions\", \"function\"],\n [\"candidates\", \"function\"],\n [\"invariants\", \"function\"],\n [\"ceremonies\", \"object\"],\n [\"rules\", \"array\"],\n [\"metrics\", \"function\"],\n [\"humanDefaults\", \"object\"],\n] as const;\n\n/**\n * A registry pre-registered with `initial`. The interface layer cannot import the methodologies,\n * so the outer ring passes the five built-ins in (design spec section 26, \"Registry placement\").\n */\n// String() throws on a null-prototype value; for an Error it reads `Name: message`\nconst thrown = (e: unknown): string => {\n try {\n return String(e);\n } catch {\n return \"a non-Error value\";\n }\n};\n\nexport function createMethodologyRegistry(\n // factories of different names share no sound common type (a ceremony is contravariant in\n // its state's name), so the table stores them untyped and lookup restores the name\n initial: Record<string, () => unknown>,\n): MethodologyRegistry {\n const table = new Map<string, () => unknown>();\n const register = (name: string, factory: unknown, builtIn = false) => {\n assertId(name, \"methodology name\");\n if (typeof factory !== \"function\")\n fail(\n \"invalid-input\",\n `methodology \"${name}\" factory must be a function`,\n 'pass the factory itself, e.g. registerMethodology(\"triage\", triage)',\n );\n if (table.has(name))\n fail(\n \"invalid-input\",\n `methodology \"${name}\" is already registered`,\n `pick a name that is not one of: ${[...table.keys()].join(\", \")}`,\n );\n // a custom factory runs once here, so a wrong result fails at registration, not at init\n if (!builtIn) {\n let m: Record<string, unknown> | null;\n try {\n m = (factory as () => unknown)() as Record<string, unknown> | null;\n } catch (e) {\n if (e instanceof WorkflowError) throw e;\n fail(\n \"invalid-input\",\n `methodology \"${name}\" factory threw: ${thrown(e)}`,\n \"fix the factory: registration calls it once\",\n );\n }\n const missing =\n typeof m !== \"object\" || m === null\n ? \"an object\"\n : m[\"name\"] !== name\n ? `name \"${name}\"`\n : MEMBERS.find(([key, kind]) =>\n kind === \"array\" ? !Array.isArray(m[key]) : typeof m[key] !== kind || !m[key],\n )?.[0];\n if (missing)\n fail(\n \"invalid-input\",\n `methodology \"${name}\" factory must return a Methodology; it lacks ${missing}`,\n \"return the full Methodology object (name, vocabulary, validateConfig, defaultStages, defaultRoles, capabilities, plannerOptions, candidates, invariants, ceremonies, rules, metrics, humanDefaults)\",\n );\n }\n table.set(name, factory as () => unknown);\n };\n for (const [name, factory] of Object.entries(initial)) register(name, factory, true);\n return {\n registerMethodology: (name, factory) => register(name, factory),\n methodologyFactory<N extends string>(name: N): MethodologyFactory<N> {\n assertId(name, \"methodology name\");\n const factory = table.get(name);\n if (!factory)\n fail(\n \"invalid-input\",\n `unknown methodology \"${name}\"`,\n `known methodologies: ${[...table.keys()].join(\", \") || \"(none)\"}; register a custom one with registerMethodology`,\n );\n return factory as MethodologyFactory<N>;\n },\n registeredMethodologies: () => [...table.keys()],\n };\n}\n","// The `ex-workflow/registry` entry: the methodology registry with the five built-ins\n// pre-registered (design spec section 26, \"Registry placement\"). Outer ring: src/interface/ may\n// not import src/methodologies/, so the built-in table lives here; the CLI resolves through it. The registry is created on first use, so a bundle that never\n// calls these functions does not keep the built-in factories.\nimport { experimentation } from \"./methodologies/experimentation/index.ts\";\nimport { investigation } from \"./methodologies/investigation/index.ts\";\nimport { kanban } from \"./methodologies/kanban/index.ts\";\nimport { scrum } from \"./methodologies/scrum/index.ts\";\nimport { waterfall } from \"./methodologies/waterfall/index.ts\";\nimport {\n createMethodologyRegistry,\n type MethodologyFactory,\n type MethodologyRegistry,\n} from \"./interface/registry.ts\";\nimport type { Methodology } from \"./core/types.ts\";\n\nexport type { MethodologyFactory, MethodologyRegistry };\n\nlet registry: MethodologyRegistry | undefined;\nconst builtins = (): MethodologyRegistry =>\n (registry ??= createMethodologyRegistry({\n scrum,\n kanban,\n waterfall,\n investigation,\n experimentation,\n }));\n\n/** Registers a custom methodology (SDK only in 1.2); a taken name, a built-in included, fails `invalid-input`. */\nexport function registerMethodology<C, N extends string>(\n name: N,\n factory: () => Methodology<C, N>,\n): void {\n builtins().registerMethodology(name, factory);\n}\n\n/** The factory registered under `name`; an unknown name fails `invalid-input` listing the known ones. */\nexport function methodologyFactory<N extends string = string>(name: N): MethodologyFactory<N> {\n return builtins().methodologyFactory(name);\n}\n\n/** The registered names: the five built-ins, then custom ones in registration order. */\nexport function registeredMethodologies(): string[] {\n return builtins().registeredMethodologies();\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/interface/registry.ts","../src/registry.ts"],"names":["MEMBERS","thrown","e","createMethodologyRegistry","initial","table","register","name","factory","builtIn","assertId","fail","m","WorkflowError","missing","key","kind","registry","builtins","scrum","kanban","waterfall","investigation","experimentation","registerMethodology","methodologyFactory","registeredMethodologies"],"mappings":"uPAoBA,IAAMA,EAAU,CACd,CAAC,YAAA,CAAc,QAAQ,EACvB,CAAC,gBAAA,CAAkB,UAAU,CAAA,CAC7B,CAAC,eAAA,CAAiB,UAAU,CAAA,CAC5B,CAAC,eAAgB,UAAU,CAAA,CAC3B,CAAC,sBAAA,CAAwB,OAAO,CAAA,CAChC,CAAC,uBAAA,CAAyB,OAAO,EACjC,CAAC,gBAAA,CAAkB,UAAU,CAAA,CAC7B,CAAC,YAAA,CAAc,UAAU,EACzB,CAAC,YAAA,CAAc,UAAU,CAAA,CACzB,CA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A,UAAAC,GAAAA,CACA,aAAA,CAAAC,GAAAA,CACA,eAAA,CAAAC,CACF,CAAC,CAAA,CAGI,SAASC,CAAAA,CACdjB,EACAC,CAAAA,CACM,CACNU,GAAS,CAAE,mBAAA,CAAoBX,EAAMC,CAAO,EAC9C,CAGO,SAASiB,EAA8ClB,CAAAA,CAAgC,CAC5F,OAAOW,CAAAA,GAAW,kBAAA,CAAmBX,CAAI,CAC3C,CAGO,SAASmB,CAAAA,EAAoC,CAClD,OAAOR,CAAAA,EAAS,CAAE,yBACpB","file":"chunk-UT7QV6CE.mjs","sourcesContent":["import { WorkflowError, assertId, fail } from \"../core/errors.ts\";\nimport type { Methodology } from \"../core/types.ts\";\n\n/** A methodology factory, as the built-in entries export them (`scrum`, `kanban`, ...). */\nexport type MethodologyFactory<N extends string = string> = () => Methodology<unknown, N>;\n\n/** Name -> factory lookup: what `exwf init <name>` and a state's `methodology` resolve through. */\nexport interface MethodologyRegistry {\n /**\n * Adds `name`; a name already registered (a built-in included) fails `invalid-input`. The\n * factory is called once to check that it returns a Methodology named `name`.\n */\n registerMethodology<C, N extends string>(name: N, factory: () => Methodology<C, N>): void;\n /** The factory registered under `name`; an unknown name fails `invalid-input` listing the known ones. */\n methodologyFactory<N extends string = string>(name: N): MethodologyFactory<N>;\n /** Registered names, pre-registered ones first, then in registration order. */\n registeredMethodologies(): string[];\n}\n\n// the required members of a Methodology (src/core/types.ts) and their runtime kinds\nconst MEMBERS = [\n [\"vocabulary\", \"object\"],\n [\"validateConfig\", \"function\"],\n [\"defaultStages\", \"function\"],\n [\"defaultRoles\", \"function\"],\n [\"requiredCapabilities\", \"array\"],\n [\"exclusiveCapabilities\", \"array\"],\n [\"plannerOptions\", \"function\"],\n [\"candidates\", \"function\"],\n [\"invariants\", \"function\"],\n [\"ceremonies\", \"object\"],\n [\"rules\", \"array\"],\n [\"metrics\", \"function\"],\n [\"humanDefaults\", \"object\"],\n] as const;\n\n/**\n * A registry pre-registered with `initial`. The interface layer cannot import the methodologies,\n * so the outer ring passes the five built-ins in (design spec section 26, \"Registry placement\").\n */\n// String() throws on a null-prototype value; for an Error it reads `Name: message`\nconst thrown = (e: unknown): string => {\n try {\n return String(e);\n } catch {\n return \"a non-Error value\";\n }\n};\n\nexport function createMethodologyRegistry(\n // factories of different names share no sound common type (a ceremony is contravariant in\n // its state's name), so the table stores them untyped and lookup restores the name\n initial: Record<string, () => unknown>,\n): MethodologyRegistry {\n const table = new Map<string, () => unknown>();\n const register = (name: string, factory: unknown, builtIn = false) => {\n assertId(name, \"methodology name\");\n if (typeof factory !== \"function\")\n fail(\n \"invalid-input\",\n `methodology \"${name}\" factory must be a function`,\n 'pass the factory itself, e.g. registerMethodology(\"triage\", triage)',\n );\n if (table.has(name))\n fail(\n \"invalid-input\",\n `methodology \"${name}\" is already registered`,\n `pick a name that is not one of: ${[...table.keys()].join(\", \")}`,\n );\n // a custom factory runs once here, so a wrong result fails at registration, not at init\n if (!builtIn) {\n let m: Record<string, unknown> | null;\n try {\n m = (factory as () => unknown)() as Record<string, unknown> | null;\n } catch (e) {\n if (e instanceof WorkflowError) throw e;\n fail(\n \"invalid-input\",\n `methodology \"${name}\" factory threw: ${thrown(e)}`,\n \"fix the factory: registration calls it once\",\n );\n }\n const missing =\n typeof m !== \"object\" || m === null\n ? \"an object\"\n : m[\"name\"] !== name\n ? `name \"${name}\"`\n : MEMBERS.find(([key, kind]) =>\n kind === \"array\" ? !Array.isArray(m[key]) : typeof m[key] !== kind || !m[key],\n )?.[0];\n if (missing)\n fail(\n \"invalid-input\",\n `methodology \"${name}\" factory must return a Methodology; it lacks ${missing}`,\n \"return the full Methodology object (name, vocabulary, validateConfig, defaultStages, defaultRoles, capabilities, plannerOptions, candidates, invariants, ceremonies, rules, metrics, humanDefaults)\",\n );\n }\n table.set(name, factory as () => unknown);\n };\n for (const [name, factory] of Object.entries(initial)) register(name, factory, true);\n return {\n registerMethodology: (name, factory) => register(name, factory),\n methodologyFactory<N extends string>(name: N): MethodologyFactory<N> {\n assertId(name, \"methodology name\");\n const factory = table.get(name);\n if (!factory)\n fail(\n \"invalid-input\",\n `unknown methodology \"${name}\"`,\n `known methodologies: ${[...table.keys()].join(\", \") || \"(none)\"}; register a custom one with registerMethodology`,\n );\n return factory as MethodologyFactory<N>;\n },\n registeredMethodologies: () => [...table.keys()],\n };\n}\n","// The `ex-workflow/registry` entry: the methodology registry with the five built-ins\n// pre-registered (design spec section 26, \"Registry placement\"). Outer ring: src/interface/ may\n// not import src/methodologies/, so the built-in table lives here; the CLI resolves through it. The registry is created on first use, so a bundle that never\n// calls these functions does not keep the built-in factories.\nimport { experimentation } from \"./methodologies/experimentation/index.ts\";\nimport { investigation } from \"./methodologies/investigation/index.ts\";\nimport { kanban } from \"./methodologies/kanban/index.ts\";\nimport { scrum } from \"./methodologies/scrum/index.ts\";\nimport { waterfall } from \"./methodologies/waterfall/index.ts\";\nimport {\n createMethodologyRegistry,\n type MethodologyFactory,\n type MethodologyRegistry,\n} from \"./interface/registry.ts\";\nimport type { Methodology } from \"./core/types.ts\";\n\nexport type { MethodologyFactory, MethodologyRegistry };\n\nlet registry: MethodologyRegistry | undefined;\nconst builtins = (): MethodologyRegistry =>\n (registry ??= createMethodologyRegistry({\n scrum,\n kanban,\n waterfall,\n investigation,\n experimentation,\n }));\n\n/** Registers a custom methodology (SDK only in 1.2); a taken name, a built-in included, fails `invalid-input`. */\nexport function registerMethodology<C, N extends string>(\n name: N,\n factory: () => Methodology<C, N>,\n): void {\n builtins().registerMethodology(name, factory);\n}\n\n/** The factory registered under `name`; an unknown name fails `invalid-input` listing the known ones. */\nexport function methodologyFactory<N extends string = string>(name: N): MethodologyFactory<N> {\n return builtins().methodologyFactory(name);\n}\n\n/** The registered names: the five built-ins, then custom ones in registration order. */\nexport function registeredMethodologies(): string[] {\n return builtins().registeredMethodologies();\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/common/independence.ts"],"names":["independenceConflicts","verifiers","workers","id"],"mappings":"AAYO,SAASA,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACU,CACV,OAAO,CAAC,GAAG,IAAI,GAAA,CAAI,OAAOD,CAAAA,EAAc,QAAA,CAAW,CAACA,CAAS,CAAA,CAAIA,CAAS,CAAC,CAAA,CAAE,MAAA,CAAQE,GACnFD,CAAAA,CAAQ,QAAA,CAASC,CAAE,CACrB,CACF","file":"chunk-WU5JELOM.mjs","sourcesContent":["/**\n * Independence check: a verifying role must not be one that did the work.\n *\n * Returns the ids in `verifiers` that also appear in `workers`, each once, in verifier order;\n * an empty array means the verification is independent. Ids are compared exactly. The caller\n * decides how a conflict fails (a rule violation, a refused ceremony, a skipped role), so the\n * check carries no message of its own.\n *\n * @example\n * // a validator may not validate a candidate it built or integrated\n * if (independenceConflicts(by, [candidate.author, integration.by]).length) refuse();\n */\nexport function independenceConflicts(\n verifiers: string | readonly string[],\n workers: readonly string[],\n): string[] {\n return [...new Set(typeof verifiers === \"string\" ? [verifiers] : verifiers)].filter((id) =>\n workers.includes(id),\n );\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var chunkGKN5M4B7_cjs=require('./chunk-GKN5M4B7.cjs'),chunkW2P27645_cjs=require('./chunk-W2P27645.cjs'),chunkZ43GUETW_cjs=require('./chunk-Z43GUETW.cjs'),chunkOSHBJIYD_cjs=require('./chunk-OSHBJIYD.cjs'),exsorted=require('exsorted');var P=new Set(["in_progress","blocked","awaiting_human"]),E=new Set(["todo","in_progress","blocked","review","awaiting_human"]);function ae(e){let t=e.stages[0];return t||chunkOSHBJIYD_cjs.b("config-invalid","kanban board has no columns","init with at least options, a commitment column and a delivery column"),t}function T(e){let t=e.stages.find(a=>a.commitmentPoint);return t||chunkOSHBJIYD_cjs.b("config-invalid","no column is the commitment point","set commitmentPoint: true on exactly one column"),t}function te(e){let t=e.stages.find(a=>a.deliveryPoint);return t||chunkOSHBJIYD_cjs.b("config-invalid","no column is the delivery point","set deliveryPoint: true on the last column"),t}function ee(e,t){return chunkZ43GUETW_cjs.n(e,t),e.stages.findIndex(a=>a.id===t)}function D(e,t){let a=ee(e,t.stage);return a>=ee(e,T(e).id)&&a<ee(e,te(e).id)}function U(e){return Object.values(e.items).filter(t=>t.classOfService==="expedite"&&P.has(t.status)&&D(e,t)).map(t=>t.id)}function _(e){for(let t=e.transitions.length-1;t>=0;t--){let a=e.transitions[t];if(a.to.stage===e.stage&&a.from.stage!==e.stage)return a.at}}var Y=chunkGKN5M4B7_cjs.a(["replenishment","delivery-planning","service-delivery-review","operations-review","risk-review","strategy-review"]),I=chunkGKN5M4B7_cjs.a(["expedite","fixed-date","standard","intangible"]),ne=864e5;function h(e){return e.config}var De=chunkGKN5M4B7_cjs.a([{id:"options",name:"Options",policies:[{kind:"acceptance-written"}]},{id:"ready",name:"Ready",wipLimit:4,commitmentPoint:true,policies:[{kind:"dependencies-done"}]},{id:"dev",name:"Development",wipLimit:3,policies:[{kind:"evidence",evidenceKind:"test-output"}]},{id:"review",name:"Review",wipLimit:2,review:true,policies:[{kind:"no-open-blockers"}]},{id:"done",name:"Done",deliveryPoint:true,policies:[]}]),K=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function q(e,t,a,s=1){if(e!==void 0)return (typeof e!="number"||!Number.isFinite(e)||e<s)&&chunkOSHBJIYD_cjs.b("config-invalid",`kanban config.${t} must be a number >= ${s} (got ${JSON.stringify(e)})`,a),e}var Ee=["acceptance-written","estimate-present","no-open-blockers","dependencies-done"],ce=e=>typeof e=="string"&&e.trim()!=="";function le(e,t){Array.isArray(e)||chunkOSHBJIYD_cjs.b("config-invalid",`kanban config.${t} must be an array of Policy objects`,'e.g. [{ "kind": "evidence", "evidenceKind": "test-output" }]');let a=[];return e.forEach((s,m)=>{let f=`kanban config.${t}[${m}]`;K(s)&&(s.kind==="evidence"?ce(s.evidenceKind):s.kind==="custom"?ce(s.id)&&ce(s.description):typeof s.kind=="string"&&Ee.includes(s.kind))||chunkOSHBJIYD_cjs.b("config-invalid",`${f} must be a Policy`,`use a Policy such as { "kind": "evidence", "evidenceKind": "test-output" }, { "kind": "custom", "id": "x", "description": "..." } or one of: ${Ee.join(", ")}`),a.push(s);}),a}function qe(e,t){K(e)||chunkOSHBJIYD_cjs.b("config-invalid",`kanban config.columns[${t}] must be an object`,'e.g. { "id": "dev", "policies": [] }'),chunkOSHBJIYD_cjs.c(e.id,`kanban config.columns[${t}].id`);let a=e.id;Array.isArray(e.policies)||chunkOSHBJIYD_cjs.b("config-invalid",`kanban config.columns[${t}] ("${a}") needs policies: Policy[]`,'every column states its policies explicitly, e.g. [{ "kind": "acceptance-written" }]');let s={id:a,name:typeof e.name=="string"&&e.name.trim()!==""?e.name:a,policies:le(e.policies,`columns[${t}].policies`)},m=q(e.wipLimit,`columns[${t}].wipLimit`,"omit wipLimit for no limit");m!==void 0&&(s.wipLimit=m);for(let f of ["commitmentPoint","deliveryPoint","review"])e[f]!==void 0&&(typeof e[f]!="boolean"&&chunkOSHBJIYD_cjs.b("config-invalid",`kanban config.columns[${t}].${f} must be a boolean`,`set ${f}: true or omit it`),e[f]&&(s[f]=true));return s}function z(e){let t=e??{};t.columns!==void 0&&!Array.isArray(t.columns)&&chunkOSHBJIYD_cjs.b("config-invalid","kanban config.columns must be an array of columns","omit columns for the default board (options, ready, dev, review, done)");let a=t.columns===void 0?structuredClone(De):t.columns.map(qe),s=new Set;for(let o of a)s.has(o.id)&&chunkOSHBJIYD_cjs.b("config-invalid",`duplicate column id "${o.id}"`,"give every column a unique id"),s.add(o.id);let m={},f=t.classesOfService??{};K(f)||chunkOSHBJIYD_cjs.b("config-invalid","kanban config.classesOfService must be an object keyed by class",'e.g. { "expedite": { "wipBypass": 1 } }');for(let[o,c]of Object.entries(f)){I.includes(o)||chunkOSHBJIYD_cjs.b("config-invalid",`kanban config.classesOfService.${o} is not a class of service`,`use one of: ${I.join(", ")}`),K(c)||chunkOSHBJIYD_cjs.b("config-invalid",`kanban config.classesOfService.${o} must be an object`,'e.g. { "wipBypass": 1, "sle": { "percentile": 85, "targetMs": 604800000 } }');let d={},p=q(c.wipBypass,`classesOfService.${o}.wipBypass`,"omit it for the default 1",0);if(p!==void 0&&(d.wipBypass=p),c.sle!==void 0){let g=c.sle;(!K(g)||typeof g.percentile!="number"||g.percentile<0||g.percentile>100)&&chunkOSHBJIYD_cjs.b("config-invalid",`kanban config.classesOfService.${o}.sle.percentile must be 0..100`,'e.g. { "percentile": 85, "targetMs": 604800000 }');let k=q(g.targetMs,`classesOfService.${o}.sle.targetMs`,"state the service level target in milliseconds");k===void 0&&chunkOSHBJIYD_cjs.b("config-invalid",`kanban config.classesOfService.${o}.sle.targetMs is required`,"state the service level target in milliseconds"),d.sle={percentile:g.percentile,targetMs:k};}m[o]=d;}let y=t.fairness??{};(!K(y)||y.aging!==void 0&&typeof y.aging!="boolean")&&chunkOSHBJIYD_cjs.b("config-invalid","kanban config.fairness must be { aging: boolean, maxDeferralRounds?: number }","omit it for aging on");let l=q(y.maxDeferralRounds,"fairness.maxDeferralRounds","omit it for 5 rounds"),i={aging:y.aging===void 0?true:y.aging,maxDeferralRounds:l??5},r={},n=t.cadences??{};K(n)||chunkOSHBJIYD_cjs.b("config-invalid","kanban config.cadences must be an object keyed by cadence",'e.g. { "replenishment": { "everyTurns": 10 } }');for(let[o,c]of Object.entries(n)){Y.includes(o)||chunkOSHBJIYD_cjs.b("config-invalid",`kanban config.cadences.${o} is not a cadence`,`use one of: ${Y.join(", ")}`),K(c)||chunkOSHBJIYD_cjs.b("config-invalid",`kanban config.cadences.${o} must be an object`,'e.g. { "everyTurns": 10 }');let d=q(c.everyTurns,`cadences.${o}.everyTurns`,"omit it when the cadence is run by hand");r[o]=d===void 0?{}:{everyTurns:d};}return {columns:a,classesOfService:m,fairness:i,cadences:r,throughputWindowMs:q(t.throughputWindowMs,"throughputWindowMs","omit it for one week")??7*ne,maxExpedite:q(t.maxExpedite,"maxExpedite","omit it for 1")??1}}function ie(e,t){return e.events.find(s=>s.type==="item.added"&&s.payload.id===t)?.at??e.events[0].at}function re(e,t,a){return Date.parse(a)-Date.parse(_(t)??ie(e,t.id))}function Fe(e,t){return e.stages.map(a=>{let s=Object.values(e.items).filter(l=>l.stage===a.id&&l.status!=="dropped"),m=exsorted.timSort(s.map(l=>({id:l.id,title:l.title,type:l.type,status:l.status,classOfService:l.classOfService??"standard",role:l.role??null,ageMs:re(e,l,t),blocked:l.blockers.some(i=>!i.clearedAt),deadline:l.deadline??null})),(l,i)=>i.ageMs-l.ageMs||(l.id<i.id?-1:1)),f=m.filter(l=>P.has(l.status)).length,y=m.filter(l=>l.status==="todo"||l.status==="review").length;return {id:a.id,name:a.name,wipLimit:a.wipLimit??null,active:f,queued:y,overLimit:a.wipLimit!==void 0&&f>a.wipLimit,commitmentPoint:a.commitmentPoint===true,deliveryPoint:a.deliveryPoint===true,cards:m}})}var Ie=e=>`cadence.${e}`;function de(e){let t=h(e);return Y.map(a=>{let s=0,m=null;for(let l of e.events)l.type===Ie(a)&&(s=l.seq,m=l.at);let f=e.events.filter(l=>l.type==="item.completed"&&l.seq>s).length,y=t.cadences[a]?.everyTurns??null;return {cadence:a,everyTurns:y,lastAt:m,turnsSince:f,due:y!==null&&f>=y}})}var je=(e,t)=>Date.parse(t)-Date.parse(e),We=e=>e.transition??null;function oe(e,t,a){let s=new Map,m=[],f=e[0]?.at??"1970-01-01T00:00:00.000Z",y=(i,r,n)=>{r===t&&i.committedAt===void 0&&(i.committedAt=n),r===a&&i.deliveredAt===void 0&&(i.deliveredAt=n);},l=(i,r,n)=>{i.since.status==="in_progress"&&(i.activeMs+=je(i.since.at,n)),i.since.status==="blocked"&&(i.blockedMs+=je(i.since.at,n)),i.since={status:r.status,at:n},r.stage!==i.stage&&(i.stays[i.stays.length-1].leftAt=n,i.stays.push({stage:r.stage,enteredAt:n}),y(i,r.stage,n)),i.stage=r.stage,i.status=r.status;};for(let i of e){f=i.at;let r=i.payload??{};switch(i.type){case "item.added":{let n=r.id,o=r.stage,c={id:n,type:typeof r.type=="string"?r.type:"task",stage:o,status:"todo",stays:[{stage:o,enteredAt:i.at}],classOfService:"standard",activeMs:0,blockedMs:0,since:{status:"todo",at:i.at}};y(c,o,i.at),s.set(n,c);break}case "item.transition":{let n=s.get(r.id);if(!n)break;l(n,r.to,i.at);break}case "cadence.replenishment":{let n=r.items??[];for(let o of n){let c=s.get(o.id);c&&(c.classOfService=o.classOfService,o.deadline?c.deadline=o.deadline:delete c.deadline);}break}case "blocker.raised":{m.push({item:r.id,blocker:r.blocker,raisedAt:i.at});let n=s.get(r.id),o=We(r);n&&o&&l(n,o.to,i.at);break}case "blocker.cleared":{let n=m.find(d=>d.item===r.id&&d.blocker===r.blocker&&d.clearedAt===void 0);n&&(n.clearedAt=i.at);let o=s.get(r.id),c=We(r);o&&c&&l(o,c.to,i.at);break}}}return {items:s,blockers:m,lastAt:f}}function V(e,t){if(e.length===0)return 0;let a=exsorted.timSort([...e],(m,f)=>m-f),s=Math.min(a.length,Math.max(1,Math.ceil(t/100*a.length)));return a[s-1]}var H=(e,t)=>Date.parse(t)-Date.parse(e),Le=(e,t)=>t===0?0:e/t;function Te(e){let t=e.stages.find(s=>s.commitmentPoint)?.id??"",a=e.stages.find(s=>s.deliveryPoint)?.id??"";return {commitment:t,delivery:a,ci:e.stages.findIndex(s=>s.id===t),di:e.stages.findIndex(s=>s.id===a)}}function Ke(e){let t={};for(let a of e.items.values())for(let s of a.stays)s.leftAt!==void 0&&(Object.hasOwn(t,s.stage)?t[s.stage]:t[s.stage]=[]).push(H(s.enteredAt,s.leftAt));return t}function fe(e){let t=Te(e);return Ke(oe(e.events,t.commitment,t.delivery))}function G(e){let t=h(e),a=Te(e),s=oe(e.events,a.commitment,a.delivery),m=[...s.items.values()],f=e.stages.map(u=>u.id),y=new Map(f.map((u,b)=>[u,b])),l=exsorted.timSort(m.filter(u=>u.type!=="question"&&u.committedAt!==void 0&&u.deliveredAt!==void 0),(u,b)=>Date.parse(u.deliveredAt)-Date.parse(b.deliveredAt)),i=l.map(u=>H(u.committedAt,u.deliveredAt)),r={};for(let[u,b]of Object.entries(Ke(s)))r[u]=b.reduce((w,x)=>w+x,0)/b.length;let n=m.filter(u=>u.type!=="question"&&u.committedAt!==void 0).map(u=>Date.parse(u.committedAt)),o=[];if(n.length>0){let u=n.reduce((w,x)=>x<w?x:w,n[0]),b=Math.floor((Date.parse(s.lastAt)-u)/t.throughputWindowMs)+1;o=Array.from({length:b},()=>0);for(let w of l){let x=Math.floor((Date.parse(w.deliveredAt)-u)/t.throughputWindowMs);x>=0&&x<b&&(o[x]+=1);}}let c=Object.fromEntries(f.map(u=>[u,0])),d={};for(let u of m){if(!E.has(u.status))continue;Object.hasOwn(c,u.stage)&&(c[u.stage]+=1);let b=y.get(u.stage);b!==void 0&&b>=a.ci&&b<a.di&&(d[u.id]=H(u.stays[u.stays.length-1].enteredAt,s.lastAt));}let p=new Map;for(let u of m)for(let b of u.stays){let w=p.get(b.stage)??new Map;w.has(u.id)||w.set(u.id,b.enteredAt),p.set(b.stage,w);}let g=exsorted.timSort([...new Set(e.events.map(u=>u.at.slice(0,10)))],(u,b)=>u<b?-1:u>b?1:0),k={};for(let u of g)for(let b of f)k[`${u}:${b}`]=[...p.get(b)?.values()??[]].filter(w=>w.slice(0,10)<=u).length;let M={};for(let[u,b]of Object.entries(t.classesOfService)){if(!b?.sle)continue;let w=l.filter(x=>x.classOfService===u);w.length!==0&&(M[u]=w.filter(x=>H(x.committedAt,x.deliveredAt)<=b.sle.targetMs).length/w.length);}let A=s.blockers.reduce((u,b)=>u+H(b.raisedAt,b.clearedAt??s.lastAt),0);return {leadTimeMs:i,leadTimeP50:V(i,50),leadTimeP85:V(i,85),cycleTimeMsByColumn:r,throughput:o,wipByColumn:c,flowEfficiency:Le(l.reduce((u,b)=>u+b.activeMs,0),i.reduce((u,b)=>u+b,0)),agingWipMs:d,cumulativeFlow:k,sleCompliance:M,blockerTimeMs:A,meanBlockerTimeMs:Le(A,s.blockers.length)}}var ue=(e,t,a)=>Object.hasOwn(e,t)?e[t]:a;function pe(e,t){let a=Date.parse(t),s=fe(e),m=[],f=[],y=Object.fromEntries(e.stages.map(i=>[i.id,0])),l=Object.fromEntries(e.stages.map(i=>[i.id,0]));for(let i of Object.values(e.items)){for(let r of i.blockers)r.clearedAt||m.push({item:i.id,blocker:r.id,owner:r.owner,reason:r.reason,ageMs:a-Date.parse(r.raisedAt)});if(P.has(i.status)?l[i.stage]=ue(l,i.stage,0)+1:(i.status==="todo"||i.status==="review")&&(y[i.stage]=ue(y,i.stage,0)+1),E.has(i.status)&&D(e,i)){let r=ue(s,i.stage,[]),n=r.length?V(r,85):null,o=re(e,i,t);f.push({item:i.id,column:i.stage,status:i.status,ageMs:o,p85Ms:n,overP85:n!==null&&o>n});}}return {blockers:m,agingWip:exsorted.timSort(f,(i,r)=>r.ageMs-i.ageMs||(i.item<r.item?-1:1)),queued:y,active:l}}function Ue(e,t){let a=T(e).id;return e.items[t].transitions.find(f=>f.to.stage===a&&f.from.stage!==a)?.at??ie(e,t)}function ge(e,t,a){let s=Date.parse(t),m=h(e),f=G(e).leadTimeMs,y=m.classesOfService["fixed-date"]?.sle?.percentile??85,l=f.length?V(f,y):null,i=[],r=[];for(let n of Object.values(e.items)){for(let p of n.blockers){let g=p.clearedAt?0:s-Date.parse(p.raisedAt);!p.clearedAt&&g>a&&r.push({item:n.id,blocker:p.id,owner:p.owner,ageMs:g});}if(n.classOfService!=="fixed-date"||!n.deadline||!E.has(n.status)||!D(e,n))continue;let o=s-Date.parse(Ue(e,n.id)),c=l===null?null:Math.max(0,l-o),d=Date.parse(n.deadline)-s;i.push({item:n.id,deadline:n.deadline,timeLeftMs:d,projectedRemainingMs:c,atRisk:d<0||c!==null&&c>d});}return {fixedDate:i,staleBlockers:r,expediteActive:U(e)}}var F=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function ye(e,t,a){let s=t.items;(!Array.isArray(s)||s.length===0||!s.every(f=>typeof f=="string"))&&chunkOSHBJIYD_cjs.b("invalid-input",`${a} needs items: string[]`,'pass ["A", "B"]');let m=s.find((f,y)=>s.indexOf(f)!==y);m!==void 0&&chunkOSHBJIYD_cjs.b("invalid-input",`item "${m}" appears twice in items[]`,"list each item once",{items:[m]});for(let f of s)chunkZ43GUETW_cjs.r(e,f);return s}function Ye(e){return F(e)&&typeof e.percentile=="number"&&e.percentile>=0&&e.percentile<=100&&typeof e.targetMs=="number"&&Number.isFinite(e.targetMs)&&e.targetMs>0}function Be(e,t){let{wipLimit:a,...s}=e;return t===null?s:{...s,wipLimit:t}}function be(e){let t=(i,r,n,o)=>chunkZ43GUETW_cjs.U(i,e(),{type:r,by:n.by,payload:n},c=>o(c,chunkZ43GUETW_cjs.a(n.now)));return {replenishment:(i,r)=>{chunkZ43GUETW_cjs.m(i,r.by,"order-backlog","manage-flow");let n=ye(i,r,"replenishment"),o=T(i),c=ae(i);for(let d of n)chunkZ43GUETW_cjs.C(i,chunkZ43GUETW_cjs.r(i,d),c.exitPolicy,`leave "${c.id}"`);return t(i,"ceremony.replenishment",r,(d,p)=>{for(let g of n)d=chunkZ43GUETW_cjs.u(d,g,{stage:o.id,status:"todo"},r.by,p);return chunkZ43GUETW_cjs.c(d,"cadence.replenishment",r.by,{column:o.id,items:n.map(g=>{let k=chunkZ43GUETW_cjs.r(d,g);return {id:g,classOfService:k.classOfService??"standard",deadline:k.deadline??null}})},p)})},"delivery-planning":(i,r)=>{chunkZ43GUETW_cjs.m(i,r.by,"facilitate","manage-flow");let n=ye(i,r,"delivery-planning"),o=te(i),c=i.stages[i.stages.findIndex(d=>d.id===o.id)-1];for(let d of n){let p=chunkZ43GUETW_cjs.r(i,d);p.stage!==c.id&&p.stage!==o.id&&chunkOSHBJIYD_cjs.b("invalid-input",`item "${d}" is in "${p.stage}", not ready for delivery`,`only cards in "${c.id}" or "${o.id}" can be planned for delivery`,{items:[d]});}return t(i,"ceremony.delivery-planning",r,(d,p)=>chunkZ43GUETW_cjs.c(d,"cadence.delivery-planning",r.by,{items:n,window:typeof r.window=="string"?r.window:null,delivered:n.filter(g=>chunkZ43GUETW_cjs.r(d,g).status==="done")},p))},"service-delivery-review":(i,r)=>{chunkZ43GUETW_cjs.m(i,r.by,"manage-flow");let n=r.wip??{},o=r.policies??{},c=r.sle??{};(!F(n)||!F(o)||!F(c))&&chunkOSHBJIYD_cjs.b("invalid-input","service-delivery-review takes wip, policies and sle objects keyed by column or class",'e.g. { "wip": { "dev": 2 }, "policies": { "dev": [{ "kind": "no-open-blockers" }] }, "sle": { "standard": { "percentile": 85, "targetMs": 604800000 } } }');for(let[g,k]of Object.entries(n))chunkZ43GUETW_cjs.n(i,g),k!==null&&(typeof k!="number"||!Number.isFinite(k)||k<1)&&chunkOSHBJIYD_cjs.b("invalid-input",`wip.${g} must be a positive number or null`,"null removes the limit");let d={};for(let[g,k]of Object.entries(o))chunkZ43GUETW_cjs.n(i,g),d[g]=le(k,`policies.${g}`);for(let[g,k]of Object.entries(c))I.includes(g)||chunkOSHBJIYD_cjs.b("invalid-input",`sle.${g} is not a class of service`,`use one of: ${I.join(", ")}`),k!==null&&!Ye(k)&&chunkOSHBJIYD_cjs.b("invalid-input",`sle.${g} must be { percentile: 0..100, targetMs: > 0 } or null`,"null removes the service level");let p=chunkW2P27645_cjs.a(i,r,"service-delivery-review");return t(i,"ceremony.service-delivery-review",r,(g,k)=>{let M=h(g),A=g.stages,u=M.columns,b={...M.classesOfService},w=[],x=[],xe=[];for(let[S,O]of Object.entries(n)){let j=A.find(R=>R.id===S).wipLimit??null;j!==O&&(w.push({column:S,before:j,after:O}),A=A.map(R=>R.id===S?Be(R,O):R),u=u.map(R=>R.id===S?Be(R,O):R));}for(let[S,O]of Object.entries(d)){let j=A.find($=>$.id===S).exitPolicy;if(JSON.stringify(j)===JSON.stringify(O))continue;x.push({column:S,before:j,after:O});let R=A.findIndex($=>$.id===S),Q=A[R].commitmentPoint?A[R+1]?.id:void 0;A=A.map($=>$.id===S?{...$,exitPolicy:O}:$.id===Q?{...$,entryPolicy:O}:$),u=u.map($=>$.id===S?{...$,policies:O}:$);}for(let[S,O]of Object.entries(c)){let j=b[S]?.sle??null;if(JSON.stringify(j)===JSON.stringify(O))continue;xe.push({classOfService:S,before:j,after:O});let{sle:R,...Q}=b[S]??{};b={...b,[S]:O===null?Q:{...Q,sle:O}};}g={...g,stages:A,config:{...M,columns:u,classesOfService:b}};let B=chunkW2P27645_cjs.b(g,p,r.by,k);return chunkZ43GUETW_cjs.c(B.state,"cadence.service-delivery-review",r.by,{wip:w,policies:x,sle:xe,lessons:B.created,adopted:B.adopted.slice(B.created.length),dismissed:B.dismissed,agreements:B.agreements,retired:B.retired},k)})},"operations-review":(i,r)=>{chunkZ43GUETW_cjs.m(i,r.by,"facilitate","manage-flow");let n=r.assign??[];(!Array.isArray(n)||!n.every(o=>F(o)&&typeof o.item=="string"&&typeof o.blocker=="string"))&&chunkOSHBJIYD_cjs.b("invalid-input","operations-review.assign must be [{ item, blocker, owner }]",'e.g. { "assign": [{ "item": "A", "blocker": "A-b1", "owner": "service-delivery-manager" }] }');for(let o of n){let c=chunkZ43GUETW_cjs.r(i,o.item);c.blockers.some(d=>d.id===o.blocker&&!d.clearedAt)||chunkOSHBJIYD_cjs.b("invalid-input",`item "${o.item}" has no open blocker "${o.blocker}"`,`open blockers: ${c.blockers.filter(d=>!d.clearedAt).map(d=>d.id).join(", ")||"(none)"}`,{items:[o.item]});}return t(i,"ceremony.operations-review",r,(o,c)=>{for(let d of n){let p=chunkZ43GUETW_cjs.r(o,d.item).blockers.find(g=>g.id===d.blocker).owner;o=chunkZ43GUETW_cjs.q(o,d.item,g=>({...g,blockers:g.blockers.map(k=>k.id===d.blocker?{...k,owner:d.owner}:k)})),o=chunkZ43GUETW_cjs.c(o,"blocker.reassigned",r.by,{id:d.item,blocker:d.blocker,from:p,to:d.owner},c);}return chunkZ43GUETW_cjs.c(o,"cadence.operations-review",r.by,pe(o,c),c)})},"risk-review":(i,r)=>{chunkZ43GUETW_cjs.m(i,r.by,"facilitate","manage-flow");let n=r.staleAfterMs??7*ne;return (typeof n!="number"||!Number.isFinite(n)||n<0)&&chunkOSHBJIYD_cjs.b("invalid-input","risk-review.staleAfterMs must be a non-negative number of milliseconds","omit it for one week"),t(i,"ceremony.risk-review",r,(o,c)=>chunkZ43GUETW_cjs.c(o,"cadence.risk-review",r.by,ge(o,c,n),c))},"strategy-review":(i,r)=>{chunkZ43GUETW_cjs.m(i,r.by,"manage-flow");let n=h(i),o=r.classesOfService??{};F(o)||chunkOSHBJIYD_cjs.b("invalid-input","strategy-review.classesOfService must be an object keyed by class",'e.g. { "expedite": { "wipBypass": 2 }, "intangible": null }');let c={...n.classesOfService};for(let[p,g]of Object.entries(o))I.includes(p)||chunkOSHBJIYD_cjs.b("invalid-input",`classesOfService.${p} is not a class of service`,`use one of: ${I.join(", ")}`),g===null?delete c[p]:c[p]=g;let d=z({...n,classesOfService:c,maxExpedite:r.maxExpedite??n.maxExpedite});return t(i,"ceremony.strategy-review",r,(p,g)=>{let k=Object.fromEntries(I.map(M=>[M,0]));for(let M of Object.values(p.items))E.has(M.status)&&D(p,M)&&(k[M.classOfService??"standard"]+=1);return p={...p,config:{...h(p),classesOfService:d.classesOfService,maxExpedite:d.maxExpedite}},chunkZ43GUETW_cjs.c(p,"cadence.strategy-review",r.by,{mix:k,before:{classesOfService:n.classesOfService,maxExpedite:n.maxExpedite},after:{classesOfService:d.classesOfService,maxExpedite:d.maxExpedite}},g)})}}}function ve(){return [{id:"service-request-manager",name:"Service Request Manager",modelTier:"large",capabilities:["order-backlog","define-acceptance","manage-flow","escalate"],canApprove:[],inputs:["stakeholder-requests","options"],outputs:["ordered-options","acceptance-criteria","classes-of-service"],do_not:["do not implement items yourself","do not push work past the commitment point outside replenishment"]},{id:"service-delivery-manager",name:"Service Delivery Manager",modelTier:"large",capabilities:["facilitate","manage-flow","escalate"],canApprove:[],inputs:["board","flow-metrics","blockers"],outputs:["cadence-records","wip-and-policy-changes","lessons"],do_not:["do not reorder the options","do not assign work; the planner pulls"]},{id:"worker",name:"Worker",modelTier:"small",capabilities:["deliver","review","verify"],canApprove:[],inputs:["brief"],outputs:["code","test-output"],do_not:["do not change acceptance criteria","do not pull more work while your card is open"]}]}var C=(e,t,a,s,m)=>m?{rule:e,severity:t,item:m,message:a,fix:s}:{rule:e,severity:t,message:a,fix:s},Z=e=>e.payload??{},se=e=>{let t=Z(e).items;return Array.isArray(t)?t:[]},ze=(e,t)=>Object.values(e.items).filter(a=>a.stage===t&&P.has(a.status)).length;function ke(){return [{id:"policy-explicit",severity:"error",check(l,i){let r=l.stages.find(n=>n.deliveryPoint)?.id;if(i.type==="init")return l.stages.filter(n=>n.id!==r&&n.exitPolicy.length===0).map(n=>C("policy-explicit","error",`column "${n.id}" has no explicit policy`,`give column "${n.id}" at least one policy, e.g. { "kind": "acceptance-written" }`));if(i.type==="ceremony.service-delivery-review"){let n=Z(i).policies??{};return Object.entries(n).filter(([o,c])=>o!==r&&Array.isArray(c)&&c.length===0).map(([o])=>C("policy-explicit","error",`column "${o}" would be left without a policy`,"keep at least one policy per column; Kanban policies are explicit"))}return []}},{id:"commitment-point-once",severity:"error",check(l,i){if(i.type!=="init")return [];let r=[],n=l.stages.filter(c=>c.commitmentPoint),o=l.stages.filter(c=>c.deliveryPoint);if(n.length!==1&&r.push(C("commitment-point-once","error",`${n.length} columns are marked commitmentPoint (${n.map(c=>c.id).join(", ")||"none"})`,"mark exactly one column commitmentPoint: true")),o.length!==1&&r.push(C("commitment-point-once","error",`${o.length} columns are marked deliveryPoint (${o.map(c=>c.id).join(", ")||"none"})`,"mark exactly one column deliveryPoint: true")),n.length===1&&o.length===1){let c=l.stages.indexOf(n[0]),d=l.stages.indexOf(o[0]);d!==l.stages.length-1&&r.push(C("commitment-point-once","error",`delivery column "${o[0].id}" is not the last column`,"move the delivery column to the end; finished cards leave the board there")),c===0?r.push(C("commitment-point-once","error",`commitment column "${n[0].id}" is the first column`,"keep an Options column before the commitment point; replenishment pulls from it")):c>=d&&r.push(C("commitment-point-once","error",`commitment column "${n[0].id}" comes after the delivery column`,"order columns options \u2192 commitment \u2192 \u2026 \u2192 delivery"));}return r}},{id:"wip-respected",severity:"error",check(l,i){if(i.type==="ceremony.replenishment"){let r=l.stages.find(p=>p.commitmentPoint);if(!r||r.wipLimit===void 0)return [];let n=se(i),o=Object.values(l.items).filter(p=>p.stage===r.id&&E.has(p.status)).length,c=n.some(p=>l.items[p]?.classOfService==="expedite")?h(l).classesOfService.expedite?.wipBypass??1:0,d=r.wipLimit+c;return o+n.length<=d?[]:[C("wip-respected","error",`column "${r.id}" holds ${o} card(s); pulling ${n.length} more exceeds its WIP limit of ${r.wipLimit}${c?` (+${c} expedite bypass)`:""}`,`pull at most ${Math.max(0,d-o)} card(s) now, or raise the limit in a service-delivery-review`)]}if(i.type==="ceremony.service-delivery-review"){let r=Z(i).wip??{},n=[];for(let[o,c]of Object.entries(r)){if(typeof c!="number")continue;let d=ze(l,o);d>c&&n.push(C("wip-respected","warning",`column "${o}" has ${d} active card(s), above the new limit of ${c}`,"nothing new is pulled into it until it drains; finish or move cards"));}return n}return []}},{id:"pull-not-push",severity:"error",check(l,i){if(i.type!=="ceremony.replenishment")return [];let r=l.stages[0],n=l.stages.find(d=>d.commitmentPoint);if(!r||!n)return [];let o=[],c=Z(i).column;c!==void 0&&c!==n.id&&o.push(C("pull-not-push","error",`replenishment may only pull into the commitment column "${n.id}", not "${String(c)}"`,"drop column or set it to the commitment column; later columns are pulled by the planner"));for(let d of se(i)){let p=Object.hasOwn(l.items,d)?l.items[d]:void 0;p&&(p.stage!==r.id||p.status!=="todo")&&o.push(C("pull-not-push","error",`item "${d}" is ${p.status} in "${p.stage}", not an option`,`only todo cards in "${r.id}" can be pulled; cards already on the board flow by pull`,d));}return o}},{id:"blocker-has-owner",severity:"error",check(l,i){if(!i.type.startsWith("ceremony."))return [];let r=[];if(i.type==="ceremony.operations-review"){let n=Z(i).assign??[];for(let o of n)(typeof o.owner!="string"||o.owner.trim()==="")&&r.push(C("blocker-has-owner","error",`blocker "${o.blocker}" on "${o.item}" would have no owner`,"name the role or person who clears it",o.item));}for(let n of Object.values(l.items))for(let o of n.blockers)!o.clearedAt&&o.owner.trim()===""&&r.push(C("blocker-has-owner","warning",`blocker "${o.id}" on "${n.id}" has no owner`,`assign one in operations-review: { "assign": [{ "item": "${n.id}", "blocker": "${o.id}", "owner": "<who>" }] }`,n.id));return r}},{id:"one-expedite",severity:"error",check(l,i){if(i.type!=="ceremony.replenishment")return [];let r=se(i).filter(c=>l.items[c]?.classOfService==="expedite");if(r.length===0)return [];let n=Object.values(l.items).filter(c=>c.classOfService==="expedite"&&E.has(c.status)&&D(l,c)).map(c=>c.id),o=h(l).maxExpedite;return n.length+r.length<=o?[]:[C("one-expedite","error",`${n.length} expedite card(s) already on the board (${n.join(", ")||"none"}); pulling ${r.join(", ")} exceeds maxExpedite ${o}`,"deliver the current expedite first, reclassify the new card, or raise maxExpedite in a strategy-review")]}},{id:"fixed-date-needs-deadline",severity:"error",check(l,i){return i.type!=="ceremony.replenishment"?[]:se(i).filter(r=>{let n=l.items[r];return n?.classOfService==="fixed-date"&&!(n.deadline&&Number.isFinite(Date.parse(n.deadline)))}).map(r=>C("fixed-date-needs-deadline","error",`fixed-date item "${r}" has no deadline`,`editItem("${r}", { deadline: "<ISO date>" }) before pulling it`,r))}}]}function we(e){let t=e.columns.map(m=>{let f={id:m.id,name:m.name,entryPolicy:[],exitPolicy:m.policies};return m.wipLimit!==void 0&&(f.wipLimit=m.wipLimit),m.commitmentPoint&&(f.commitmentPoint=true),m.deliveryPoint&&(f.deliveryPoint=true),m.review&&(f.review=true),f}),a=t.findIndex(m=>m.commitmentPoint),s=a>=0?t[a+1]:void 0;return s&&(s.entryPolicy=t[a].exitPolicy),t}var Ge=Object.freeze({backlog:"Options",item:"Work Item",stage:"Column",iteration:"Cadence",increment:"Delivery",ceremony:"Cadence",gate:"Policy"}),Ze={expedite:0,"fixed-date":1,standard:2,intangible:3},Ne=e=>Ze[e.classOfService??"standard"]??2,he=1e15,Qe=4e9,Xe=(e,t,a)=>Math.min(a,Math.max(t,e));function et(e,t){let a=e.classOfService??"standard";if(e.type==="question")return 5*he;if(a==="fixed-date"&&e.deadline!==void 0){let l=Date.parse(e.deadline);if(Number.isFinite(l))return 3*he+1e10-Math.floor(l/1e3)}let s=t.aging?Math.floor(t.deferrals/t.maxDeferralRounds):0,m=Xe(e.priority??0,-1e9,1e9)+s*Qe,f=t.aging&&t.deferrals>=t.maxDeferralRounds;return (a==="expedite"?4:a==="fixed-date"?3:a==="intangible"&&!f?1:2)*he+m}function _e(e,t){let a=Ne(e)-Ne(t);if(a!==0)return a;let s=_(e),m=_(t),f=s===void 0?0:Date.parse(s),y=m===void 0?0:Date.parse(m);return f!==y?f-y:e.id<t.id?-1:e.id>t.id?1:0}function tt(e){return e.map(t=>t.kind==="evidence"?`evidence ${t.evidenceKind}`:t.kind==="custom"?`${t.id}: ${t.description}`:t.kind).join(", ")||"(none)"}function nt(){return {name:"kanban",vocabulary:Ge,validateConfig:z,defaultStages:we,defaultRoles:ve,requiredCapabilities:["manage-flow","deliver"],exclusiveCapabilities:[],plannerOptions(e){let t=h(e),a=T(e),s=e.stages[e.stages.findIndex(n=>n.id===a.id)+1],m=t.classesOfService.expedite?.wipBypass??1,f=[],y=[0],l=new Map;for(let n of e.events)f.push(Date.parse(n.at)),y.push(y[y.length-1]+(n.type==="planner.resolved"?1:0)),n.type==="item.added"&&l.set(n.payload.id,n.at);let i=n=>{let o=0,c=f.length;for(;o<c;){let d=o+c>>1;f[d]<=n?o=d+1:c=d;}return y[f.length]-y[o]},r={schedulerMode:"throughput",fairnessPolicy:t.fairness.aging?"aging":"none",deadlineStrategy:"earliest-first",dispatchStage:n=>n.stage===a.id&&s?s.id:void 0,priorityOf:n=>{let o=Date.parse(_(n)??l.get(n.id)??"");return et(n,{deferrals:i(Number.isFinite(o)?o:0),aging:t.fairness.aging,maxDeferralRounds:t.fairness.maxDeferralRounds})},tieBreaker:_e,wipCounts:[...P],wipLimitOf:(n,o)=>n.wipLimit===void 0?void 0:o.classOfService==="expedite"?n.wipLimit+m:n.wipLimit};return r.maxDeferralRounds=t.fairness.maxDeferralRounds,r},candidates(e){let t=Math.max(0,h(e).maxExpedite-U(e).length),a=Object.values(e.items).filter(m=>(m.status==="todo"||m.status==="review")&&D(e,m)),s=exsorted.timSort(a.filter(m=>m.classOfService==="expedite"),_e).slice(0,t);return a.filter(m=>m.classOfService!=="expedite"||s.includes(m))},invariants(e,t){let a=h(e),s=e.stages.find(l=>l.id===t.stage),m=t.classOfService??"standard",f=a.classesOfService[m]?.sle,y=Object.values(e.items).filter(l=>l.stage===s.id&&P.has(l.status)).length;return [`Column "${s.name}" exit policies: ${tt(s.exitPolicy)}`,`Class of service: ${m}${t.deadline?`; deadline ${t.deadline}`:""}${f?`; service level p${f.percentile} <= ${f.targetMs} ms`:""}`,`WIP limit of "${s.name}": ${s.wipLimit??"none"} (active now: ${y}); finish this card before pulling another`,`Do not change the scope of "${t.id}" or its acceptance criteria; raise open_questions instead`]},ceremonies:be(nt),rules:ke(),metrics:e=>({...G(e)}),humanDefaults:{gates:"none"},lockedConfigKeys:["columns","classesOfService"],report:e=>({cadencesDue:de(e)})}}exports.A=ye;exports.B=be;exports.C=ve;exports.D=ke;exports.E=we;exports.F=Ge;exports.G=et;exports.H=_e;exports.I=nt;exports.a=P;exports.b=E;exports.c=ae;exports.d=T;exports.e=te;exports.f=ee;exports.g=D;exports.h=U;exports.i=_;exports.j=Y;exports.k=I;exports.l=ne;exports.m=h;exports.n=De;exports.o=z;exports.p=ie;exports.q=re;exports.r=Fe;exports.s=Ie;exports.t=de;exports.u=oe;exports.v=V;exports.w=fe;exports.x=G;exports.y=pe;exports.z=ge;//# sourceMappingURL=chunk-IIEKK2S3.cjs.map
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
'use strict';var chunkGKN5M4B7_cjs=require('./chunk-GKN5M4B7.cjs'),chunkBANKVCYY_cjs=require('./chunk-BANKVCYY.cjs'),chunkMU26QW32_cjs=require('./chunk-MU26QW32.cjs'),chunkOSHBJIYD_cjs=require('./chunk-OSHBJIYD.cjs'),exsorted=require('exsorted');var P=new Set(["in_progress","blocked","awaiting_human"]),E=new Set(["todo","in_progress","blocked","review","awaiting_human"]);function ae(e){let t=e.stages[0];return t||chunkOSHBJIYD_cjs.b("config-invalid","kanban board has no columns","init with at least options, a commitment column and a delivery column"),t}function T(e){let t=e.stages.find(a=>a.commitmentPoint);return t||chunkOSHBJIYD_cjs.b("config-invalid","no column is the commitment point","set commitmentPoint: true on exactly one column"),t}function te(e){let t=e.stages.find(a=>a.deliveryPoint);return t||chunkOSHBJIYD_cjs.b("config-invalid","no column is the delivery point","set deliveryPoint: true on the last column"),t}function ee(e,t){return chunkMU26QW32_cjs.n(e,t),e.stages.findIndex(a=>a.id===t)}function D(e,t){let a=ee(e,t.stage);return a>=ee(e,T(e).id)&&a<ee(e,te(e).id)}function U(e){return Object.values(e.items).filter(t=>t.classOfService==="expedite"&&P.has(t.status)&&D(e,t)).map(t=>t.id)}function _(e){for(let t=e.transitions.length-1;t>=0;t--){let a=e.transitions[t];if(a.to.stage===e.stage&&a.from.stage!==e.stage)return a.at}}var Y=chunkGKN5M4B7_cjs.a(["replenishment","delivery-planning","service-delivery-review","operations-review","risk-review","strategy-review"]),I=chunkGKN5M4B7_cjs.a(["expedite","fixed-date","standard","intangible"]),ne=864e5;function h(e){return e.config}var De=chunkGKN5M4B7_cjs.a([{id:"options",name:"Options",policies:[{kind:"acceptance-written"}]},{id:"ready",name:"Ready",wipLimit:4,commitmentPoint:true,policies:[{kind:"dependencies-done"}]},{id:"dev",name:"Development",wipLimit:3,policies:[{kind:"evidence",evidenceKind:"test-output"}]},{id:"review",name:"Review",wipLimit:2,review:true,policies:[{kind:"no-open-blockers"}]},{id:"done",name:"Done",deliveryPoint:true,policies:[]}]),K=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function q(e,t,a,s=1){if(e!==void 0)return (typeof e!="number"||!Number.isFinite(e)||e<s)&&chunkOSHBJIYD_cjs.b("config-invalid",`kanban config.${t} must be a number >= ${s} (got ${JSON.stringify(e)})`,a),e}var Ee=["acceptance-written","estimate-present","no-open-blockers","dependencies-done"],ce=e=>typeof e=="string"&&e.trim()!=="";function le(e,t){Array.isArray(e)||chunkOSHBJIYD_cjs.b("config-invalid",`kanban config.${t} must be an array of Policy objects`,'e.g. [{ "kind": "evidence", "evidenceKind": "test-output" }]');let a=[];return e.forEach((s,m)=>{let f=`kanban config.${t}[${m}]`;K(s)&&(s.kind==="evidence"?ce(s.evidenceKind):s.kind==="custom"?ce(s.id)&&ce(s.description):typeof s.kind=="string"&&Ee.includes(s.kind))||chunkOSHBJIYD_cjs.b("config-invalid",`${f} must be a Policy`,`use a Policy such as { "kind": "evidence", "evidenceKind": "test-output" }, { "kind": "custom", "id": "x", "description": "..." } or one of: ${Ee.join(", ")}`),a.push(s);}),a}function qe(e,t){K(e)||chunkOSHBJIYD_cjs.b("config-invalid",`kanban config.columns[${t}] must be an object`,'e.g. { "id": "dev", "policies": [] }'),chunkOSHBJIYD_cjs.c(e.id,`kanban config.columns[${t}].id`);let a=e.id;Array.isArray(e.policies)||chunkOSHBJIYD_cjs.b("config-invalid",`kanban config.columns[${t}] ("${a}") needs policies: Policy[]`,'every column states its policies explicitly, e.g. [{ "kind": "acceptance-written" }]');let s={id:a,name:typeof e.name=="string"&&e.name.trim()!==""?e.name:a,policies:le(e.policies,`columns[${t}].policies`)},m=q(e.wipLimit,`columns[${t}].wipLimit`,"omit wipLimit for no limit");m!==void 0&&(s.wipLimit=m);for(let f of ["commitmentPoint","deliveryPoint","review"])e[f]!==void 0&&(typeof e[f]!="boolean"&&chunkOSHBJIYD_cjs.b("config-invalid",`kanban config.columns[${t}].${f} must be a boolean`,`set ${f}: true or omit it`),e[f]&&(s[f]=true));return s}function z(e){let t=e??{};t.columns!==void 0&&!Array.isArray(t.columns)&&chunkOSHBJIYD_cjs.b("config-invalid","kanban config.columns must be an array of columns","omit columns for the default board (options, ready, dev, review, done)");let a=t.columns===void 0?structuredClone(De):t.columns.map(qe),s=new Set;for(let o of a)s.has(o.id)&&chunkOSHBJIYD_cjs.b("config-invalid",`duplicate column id "${o.id}"`,"give every column a unique id"),s.add(o.id);let m={},f=t.classesOfService??{};K(f)||chunkOSHBJIYD_cjs.b("config-invalid","kanban config.classesOfService must be an object keyed by class",'e.g. { "expedite": { "wipBypass": 1 } }');for(let[o,c]of Object.entries(f)){I.includes(o)||chunkOSHBJIYD_cjs.b("config-invalid",`kanban config.classesOfService.${o} is not a class of service`,`use one of: ${I.join(", ")}`),K(c)||chunkOSHBJIYD_cjs.b("config-invalid",`kanban config.classesOfService.${o} must be an object`,'e.g. { "wipBypass": 1, "sle": { "percentile": 85, "targetMs": 604800000 } }');let d={},p=q(c.wipBypass,`classesOfService.${o}.wipBypass`,"omit it for the default 1",0);if(p!==void 0&&(d.wipBypass=p),c.sle!==void 0){let g=c.sle;(!K(g)||typeof g.percentile!="number"||g.percentile<0||g.percentile>100)&&chunkOSHBJIYD_cjs.b("config-invalid",`kanban config.classesOfService.${o}.sle.percentile must be 0..100`,'e.g. { "percentile": 85, "targetMs": 604800000 }');let k=q(g.targetMs,`classesOfService.${o}.sle.targetMs`,"state the service level target in milliseconds");k===void 0&&chunkOSHBJIYD_cjs.b("config-invalid",`kanban config.classesOfService.${o}.sle.targetMs is required`,"state the service level target in milliseconds"),d.sle={percentile:g.percentile,targetMs:k};}m[o]=d;}let y=t.fairness??{};(!K(y)||y.aging!==void 0&&typeof y.aging!="boolean")&&chunkOSHBJIYD_cjs.b("config-invalid","kanban config.fairness must be { aging: boolean, maxDeferralRounds?: number }","omit it for aging on");let l=q(y.maxDeferralRounds,"fairness.maxDeferralRounds","omit it for 5 rounds"),i={aging:y.aging===void 0?true:y.aging,maxDeferralRounds:l??5},r={},n=t.cadences??{};K(n)||chunkOSHBJIYD_cjs.b("config-invalid","kanban config.cadences must be an object keyed by cadence",'e.g. { "replenishment": { "everyTurns": 10 } }');for(let[o,c]of Object.entries(n)){Y.includes(o)||chunkOSHBJIYD_cjs.b("config-invalid",`kanban config.cadences.${o} is not a cadence`,`use one of: ${Y.join(", ")}`),K(c)||chunkOSHBJIYD_cjs.b("config-invalid",`kanban config.cadences.${o} must be an object`,'e.g. { "everyTurns": 10 }');let d=q(c.everyTurns,`cadences.${o}.everyTurns`,"omit it when the cadence is run by hand");r[o]=d===void 0?{}:{everyTurns:d};}return {columns:a,classesOfService:m,fairness:i,cadences:r,throughputWindowMs:q(t.throughputWindowMs,"throughputWindowMs","omit it for one week")??7*ne,maxExpedite:q(t.maxExpedite,"maxExpedite","omit it for 1")??1}}function ie(e,t){return e.events.find(s=>s.type==="item.added"&&s.payload.id===t)?.at??e.events[0].at}function re(e,t,a){return Date.parse(a)-Date.parse(_(t)??ie(e,t.id))}function Fe(e,t){return e.stages.map(a=>{let s=Object.values(e.items).filter(l=>l.stage===a.id&&l.status!=="dropped"),m=exsorted.timSort(s.map(l=>({id:l.id,title:l.title,type:l.type,status:l.status,classOfService:l.classOfService??"standard",role:l.role??null,ageMs:re(e,l,t),blocked:l.blockers.some(i=>!i.clearedAt),deadline:l.deadline??null})),(l,i)=>i.ageMs-l.ageMs||(l.id<i.id?-1:1)),f=m.filter(l=>P.has(l.status)).length,y=m.filter(l=>l.status==="todo"||l.status==="review").length;return {id:a.id,name:a.name,wipLimit:a.wipLimit??null,active:f,queued:y,overLimit:a.wipLimit!==void 0&&f>a.wipLimit,commitmentPoint:a.commitmentPoint===true,deliveryPoint:a.deliveryPoint===true,cards:m}})}var Ie=e=>`cadence.${e}`;function de(e){let t=h(e);return Y.map(a=>{let s=0,m=null;for(let l of e.events)l.type===Ie(a)&&(s=l.seq,m=l.at);let f=e.events.filter(l=>l.type==="item.completed"&&l.seq>s).length,y=t.cadences[a]?.everyTurns??null;return {cadence:a,everyTurns:y,lastAt:m,turnsSince:f,due:y!==null&&f>=y}})}var je=(e,t)=>Date.parse(t)-Date.parse(e),We=e=>e.transition??null;function oe(e,t,a){let s=new Map,m=[],f=e[0]?.at??"1970-01-01T00:00:00.000Z",y=(i,r,n)=>{r===t&&i.committedAt===void 0&&(i.committedAt=n),r===a&&i.deliveredAt===void 0&&(i.deliveredAt=n);},l=(i,r,n)=>{i.since.status==="in_progress"&&(i.activeMs+=je(i.since.at,n)),i.since.status==="blocked"&&(i.blockedMs+=je(i.since.at,n)),i.since={status:r.status,at:n},r.stage!==i.stage&&(i.stays[i.stays.length-1].leftAt=n,i.stays.push({stage:r.stage,enteredAt:n}),y(i,r.stage,n)),i.stage=r.stage,i.status=r.status;};for(let i of e){f=i.at;let r=i.payload??{};switch(i.type){case "item.added":{let n=r.id,o=r.stage,c={id:n,type:typeof r.type=="string"?r.type:"task",stage:o,status:"todo",stays:[{stage:o,enteredAt:i.at}],classOfService:"standard",activeMs:0,blockedMs:0,since:{status:"todo",at:i.at}};y(c,o,i.at),s.set(n,c);break}case "item.transition":{let n=s.get(r.id);if(!n)break;l(n,r.to,i.at);break}case "cadence.replenishment":{let n=r.items??[];for(let o of n){let c=s.get(o.id);c&&(c.classOfService=o.classOfService,o.deadline?c.deadline=o.deadline:delete c.deadline);}break}case "blocker.raised":{m.push({item:r.id,blocker:r.blocker,raisedAt:i.at});let n=s.get(r.id),o=We(r);n&&o&&l(n,o.to,i.at);break}case "blocker.cleared":{let n=m.find(d=>d.item===r.id&&d.blocker===r.blocker&&d.clearedAt===void 0);n&&(n.clearedAt=i.at);let o=s.get(r.id),c=We(r);o&&c&&l(o,c.to,i.at);break}}}return {items:s,blockers:m,lastAt:f}}function V(e,t){if(e.length===0)return 0;let a=exsorted.timSort([...e],(m,f)=>m-f),s=Math.min(a.length,Math.max(1,Math.ceil(t/100*a.length)));return a[s-1]}var H=(e,t)=>Date.parse(t)-Date.parse(e),Le=(e,t)=>t===0?0:e/t;function Te(e){let t=e.stages.find(s=>s.commitmentPoint)?.id??"",a=e.stages.find(s=>s.deliveryPoint)?.id??"";return {commitment:t,delivery:a,ci:e.stages.findIndex(s=>s.id===t),di:e.stages.findIndex(s=>s.id===a)}}function Ke(e){let t={};for(let a of e.items.values())for(let s of a.stays)s.leftAt!==void 0&&(Object.hasOwn(t,s.stage)?t[s.stage]:t[s.stage]=[]).push(H(s.enteredAt,s.leftAt));return t}function fe(e){let t=Te(e);return Ke(oe(e.events,t.commitment,t.delivery))}function G(e){let t=h(e),a=Te(e),s=oe(e.events,a.commitment,a.delivery),m=[...s.items.values()],f=e.stages.map(u=>u.id),y=new Map(f.map((u,b)=>[u,b])),l=exsorted.timSort(m.filter(u=>u.type!=="question"&&u.committedAt!==void 0&&u.deliveredAt!==void 0),(u,b)=>Date.parse(u.deliveredAt)-Date.parse(b.deliveredAt)),i=l.map(u=>H(u.committedAt,u.deliveredAt)),r={};for(let[u,b]of Object.entries(Ke(s)))r[u]=b.reduce((w,x)=>w+x,0)/b.length;let n=m.filter(u=>u.type!=="question"&&u.committedAt!==void 0).map(u=>Date.parse(u.committedAt)),o=[];if(n.length>0){let u=n.reduce((w,x)=>x<w?x:w,n[0]),b=Math.floor((Date.parse(s.lastAt)-u)/t.throughputWindowMs)+1;o=Array.from({length:b},()=>0);for(let w of l){let x=Math.floor((Date.parse(w.deliveredAt)-u)/t.throughputWindowMs);x>=0&&x<b&&(o[x]+=1);}}let c=Object.fromEntries(f.map(u=>[u,0])),d={};for(let u of m){if(!E.has(u.status))continue;Object.hasOwn(c,u.stage)&&(c[u.stage]+=1);let b=y.get(u.stage);b!==void 0&&b>=a.ci&&b<a.di&&(d[u.id]=H(u.stays[u.stays.length-1].enteredAt,s.lastAt));}let p=new Map;for(let u of m)for(let b of u.stays){let w=p.get(b.stage)??new Map;w.has(u.id)||w.set(u.id,b.enteredAt),p.set(b.stage,w);}let g=exsorted.timSort([...new Set(e.events.map(u=>u.at.slice(0,10)))],(u,b)=>u<b?-1:u>b?1:0),k={};for(let u of g)for(let b of f)k[`${u}:${b}`]=[...p.get(b)?.values()??[]].filter(w=>w.slice(0,10)<=u).length;let M={};for(let[u,b]of Object.entries(t.classesOfService)){if(!b?.sle)continue;let w=l.filter(x=>x.classOfService===u);w.length!==0&&(M[u]=w.filter(x=>H(x.committedAt,x.deliveredAt)<=b.sle.targetMs).length/w.length);}let A=s.blockers.reduce((u,b)=>u+H(b.raisedAt,b.clearedAt??s.lastAt),0);return {leadTimeMs:i,leadTimeP50:V(i,50),leadTimeP85:V(i,85),cycleTimeMsByColumn:r,throughput:o,wipByColumn:c,flowEfficiency:Le(l.reduce((u,b)=>u+b.activeMs,0),i.reduce((u,b)=>u+b,0)),agingWipMs:d,cumulativeFlow:k,sleCompliance:M,blockerTimeMs:A,meanBlockerTimeMs:Le(A,s.blockers.length)}}var ue=(e,t,a)=>Object.hasOwn(e,t)?e[t]:a;function pe(e,t){let a=Date.parse(t),s=fe(e),m=[],f=[],y=Object.fromEntries(e.stages.map(i=>[i.id,0])),l=Object.fromEntries(e.stages.map(i=>[i.id,0]));for(let i of Object.values(e.items)){for(let r of i.blockers)r.clearedAt||m.push({item:i.id,blocker:r.id,owner:r.owner,reason:r.reason,ageMs:a-Date.parse(r.raisedAt)});if(P.has(i.status)?l[i.stage]=ue(l,i.stage,0)+1:(i.status==="todo"||i.status==="review")&&(y[i.stage]=ue(y,i.stage,0)+1),E.has(i.status)&&D(e,i)){let r=ue(s,i.stage,[]),n=r.length?V(r,85):null,o=re(e,i,t);f.push({item:i.id,column:i.stage,status:i.status,ageMs:o,p85Ms:n,overP85:n!==null&&o>n});}}return {blockers:m,agingWip:exsorted.timSort(f,(i,r)=>r.ageMs-i.ageMs||(i.item<r.item?-1:1)),queued:y,active:l}}function Ue(e,t){let a=T(e).id;return e.items[t].transitions.find(f=>f.to.stage===a&&f.from.stage!==a)?.at??ie(e,t)}function ge(e,t,a){let s=Date.parse(t),m=h(e),f=G(e).leadTimeMs,y=m.classesOfService["fixed-date"]?.sle?.percentile??85,l=f.length?V(f,y):null,i=[],r=[];for(let n of Object.values(e.items)){for(let p of n.blockers){let g=p.clearedAt?0:s-Date.parse(p.raisedAt);!p.clearedAt&&g>a&&r.push({item:n.id,blocker:p.id,owner:p.owner,ageMs:g});}if(n.classOfService!=="fixed-date"||!n.deadline||!E.has(n.status)||!D(e,n))continue;let o=s-Date.parse(Ue(e,n.id)),c=l===null?null:Math.max(0,l-o),d=Date.parse(n.deadline)-s;i.push({item:n.id,deadline:n.deadline,timeLeftMs:d,projectedRemainingMs:c,atRisk:d<0||c!==null&&c>d});}return {fixedDate:i,staleBlockers:r,expediteActive:U(e)}}var F=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function ye(e,t,a){let s=t.items;(!Array.isArray(s)||s.length===0||!s.every(f=>typeof f=="string"))&&chunkOSHBJIYD_cjs.b("invalid-input",`${a} needs items: string[]`,'pass ["A", "B"]');let m=s.find((f,y)=>s.indexOf(f)!==y);m!==void 0&&chunkOSHBJIYD_cjs.b("invalid-input",`item "${m}" appears twice in items[]`,"list each item once",{items:[m]});for(let f of s)chunkMU26QW32_cjs.r(e,f);return s}function Ye(e){return F(e)&&typeof e.percentile=="number"&&e.percentile>=0&&e.percentile<=100&&typeof e.targetMs=="number"&&Number.isFinite(e.targetMs)&&e.targetMs>0}function Be(e,t){let{wipLimit:a,...s}=e;return t===null?s:{...s,wipLimit:t}}function be(e){let t=(i,r,n,o)=>chunkMU26QW32_cjs.W(i,e(),{type:r,by:n.by,payload:n},c=>o(c,chunkMU26QW32_cjs.a(n.now)));return {replenishment:(i,r)=>{chunkMU26QW32_cjs.m(i,r.by,"order-backlog","manage-flow");let n=ye(i,r,"replenishment"),o=T(i),c=ae(i);for(let d of n)chunkMU26QW32_cjs.D(i,chunkMU26QW32_cjs.r(i,d),c.exitPolicy,`leave "${c.id}"`);return t(i,"ceremony.replenishment",r,(d,p)=>{for(let g of n)d=chunkMU26QW32_cjs.u(d,g,{stage:o.id,status:"todo"},r.by,p);return chunkMU26QW32_cjs.c(d,"cadence.replenishment",r.by,{column:o.id,items:n.map(g=>{let k=chunkMU26QW32_cjs.r(d,g);return {id:g,classOfService:k.classOfService??"standard",deadline:k.deadline??null}})},p)})},"delivery-planning":(i,r)=>{chunkMU26QW32_cjs.m(i,r.by,"facilitate","manage-flow");let n=ye(i,r,"delivery-planning"),o=te(i),c=i.stages[i.stages.findIndex(d=>d.id===o.id)-1];for(let d of n){let p=chunkMU26QW32_cjs.r(i,d);p.stage!==c.id&&p.stage!==o.id&&chunkOSHBJIYD_cjs.b("invalid-input",`item "${d}" is in "${p.stage}", not ready for delivery`,`only cards in "${c.id}" or "${o.id}" can be planned for delivery`,{items:[d]});}return t(i,"ceremony.delivery-planning",r,(d,p)=>chunkMU26QW32_cjs.c(d,"cadence.delivery-planning",r.by,{items:n,window:typeof r.window=="string"?r.window:null,delivered:n.filter(g=>chunkMU26QW32_cjs.r(d,g).status==="done")},p))},"service-delivery-review":(i,r)=>{chunkMU26QW32_cjs.m(i,r.by,"manage-flow");let n=r.wip??{},o=r.policies??{},c=r.sle??{};(!F(n)||!F(o)||!F(c))&&chunkOSHBJIYD_cjs.b("invalid-input","service-delivery-review takes wip, policies and sle objects keyed by column or class",'e.g. { "wip": { "dev": 2 }, "policies": { "dev": [{ "kind": "no-open-blockers" }] }, "sle": { "standard": { "percentile": 85, "targetMs": 604800000 } } }');for(let[g,k]of Object.entries(n))chunkMU26QW32_cjs.n(i,g),k!==null&&(typeof k!="number"||!Number.isFinite(k)||k<1)&&chunkOSHBJIYD_cjs.b("invalid-input",`wip.${g} must be a positive number or null`,"null removes the limit");let d={};for(let[g,k]of Object.entries(o))chunkMU26QW32_cjs.n(i,g),d[g]=le(k,`policies.${g}`);for(let[g,k]of Object.entries(c))I.includes(g)||chunkOSHBJIYD_cjs.b("invalid-input",`sle.${g} is not a class of service`,`use one of: ${I.join(", ")}`),k!==null&&!Ye(k)&&chunkOSHBJIYD_cjs.b("invalid-input",`sle.${g} must be { percentile: 0..100, targetMs: > 0 } or null`,"null removes the service level");let p=chunkBANKVCYY_cjs.a(i,r,"service-delivery-review");return t(i,"ceremony.service-delivery-review",r,(g,k)=>{let M=h(g),A=g.stages,u=M.columns,b={...M.classesOfService},w=[],x=[],xe=[];for(let[S,O]of Object.entries(n)){let j=A.find(R=>R.id===S).wipLimit??null;j!==O&&(w.push({column:S,before:j,after:O}),A=A.map(R=>R.id===S?Be(R,O):R),u=u.map(R=>R.id===S?Be(R,O):R));}for(let[S,O]of Object.entries(d)){let j=A.find($=>$.id===S).exitPolicy;if(JSON.stringify(j)===JSON.stringify(O))continue;x.push({column:S,before:j,after:O});let R=A.findIndex($=>$.id===S),Q=A[R].commitmentPoint?A[R+1]?.id:void 0;A=A.map($=>$.id===S?{...$,exitPolicy:O}:$.id===Q?{...$,entryPolicy:O}:$),u=u.map($=>$.id===S?{...$,policies:O}:$);}for(let[S,O]of Object.entries(c)){let j=b[S]?.sle??null;if(JSON.stringify(j)===JSON.stringify(O))continue;xe.push({classOfService:S,before:j,after:O});let{sle:R,...Q}=b[S]??{};b={...b,[S]:O===null?Q:{...Q,sle:O}};}g={...g,stages:A,config:{...M,columns:u,classesOfService:b}};let B=chunkBANKVCYY_cjs.b(g,p,r.by,k);return chunkMU26QW32_cjs.c(B.state,"cadence.service-delivery-review",r.by,{wip:w,policies:x,sle:xe,lessons:B.created,adopted:B.adopted.slice(B.created.length),dismissed:B.dismissed,agreements:B.agreements,retired:B.retired},k)})},"operations-review":(i,r)=>{chunkMU26QW32_cjs.m(i,r.by,"facilitate","manage-flow");let n=r.assign??[];(!Array.isArray(n)||!n.every(o=>F(o)&&typeof o.item=="string"&&typeof o.blocker=="string"))&&chunkOSHBJIYD_cjs.b("invalid-input","operations-review.assign must be [{ item, blocker, owner }]",'e.g. { "assign": [{ "item": "A", "blocker": "A-b1", "owner": "service-delivery-manager" }] }');for(let o of n){let c=chunkMU26QW32_cjs.r(i,o.item);c.blockers.some(d=>d.id===o.blocker&&!d.clearedAt)||chunkOSHBJIYD_cjs.b("invalid-input",`item "${o.item}" has no open blocker "${o.blocker}"`,`open blockers: ${c.blockers.filter(d=>!d.clearedAt).map(d=>d.id).join(", ")||"(none)"}`,{items:[o.item]});}return t(i,"ceremony.operations-review",r,(o,c)=>{for(let d of n){let p=chunkMU26QW32_cjs.r(o,d.item).blockers.find(g=>g.id===d.blocker).owner;o=chunkMU26QW32_cjs.q(o,d.item,g=>({...g,blockers:g.blockers.map(k=>k.id===d.blocker?{...k,owner:d.owner}:k)})),o=chunkMU26QW32_cjs.c(o,"blocker.reassigned",r.by,{id:d.item,blocker:d.blocker,from:p,to:d.owner},c);}return chunkMU26QW32_cjs.c(o,"cadence.operations-review",r.by,pe(o,c),c)})},"risk-review":(i,r)=>{chunkMU26QW32_cjs.m(i,r.by,"facilitate","manage-flow");let n=r.staleAfterMs??7*ne;return (typeof n!="number"||!Number.isFinite(n)||n<0)&&chunkOSHBJIYD_cjs.b("invalid-input","risk-review.staleAfterMs must be a non-negative number of milliseconds","omit it for one week"),t(i,"ceremony.risk-review",r,(o,c)=>chunkMU26QW32_cjs.c(o,"cadence.risk-review",r.by,ge(o,c,n),c))},"strategy-review":(i,r)=>{chunkMU26QW32_cjs.m(i,r.by,"manage-flow");let n=h(i),o=r.classesOfService??{};F(o)||chunkOSHBJIYD_cjs.b("invalid-input","strategy-review.classesOfService must be an object keyed by class",'e.g. { "expedite": { "wipBypass": 2 }, "intangible": null }');let c={...n.classesOfService};for(let[p,g]of Object.entries(o))I.includes(p)||chunkOSHBJIYD_cjs.b("invalid-input",`classesOfService.${p} is not a class of service`,`use one of: ${I.join(", ")}`),g===null?delete c[p]:c[p]=g;let d=z({...n,classesOfService:c,maxExpedite:r.maxExpedite??n.maxExpedite});return t(i,"ceremony.strategy-review",r,(p,g)=>{let k=Object.fromEntries(I.map(M=>[M,0]));for(let M of Object.values(p.items))E.has(M.status)&&D(p,M)&&(k[M.classOfService??"standard"]+=1);return p={...p,config:{...h(p),classesOfService:d.classesOfService,maxExpedite:d.maxExpedite}},chunkMU26QW32_cjs.c(p,"cadence.strategy-review",r.by,{mix:k,before:{classesOfService:n.classesOfService,maxExpedite:n.maxExpedite},after:{classesOfService:d.classesOfService,maxExpedite:d.maxExpedite}},g)})}}}function ve(){return [{id:"service-request-manager",name:"Service Request Manager",modelTier:"large",capabilities:["order-backlog","define-acceptance","manage-flow","escalate"],canApprove:[],inputs:["stakeholder-requests","options"],outputs:["ordered-options","acceptance-criteria","classes-of-service"],do_not:["do not implement items yourself","do not push work past the commitment point outside replenishment"]},{id:"service-delivery-manager",name:"Service Delivery Manager",modelTier:"large",capabilities:["facilitate","manage-flow","escalate"],canApprove:[],inputs:["board","flow-metrics","blockers"],outputs:["cadence-records","wip-and-policy-changes","lessons"],do_not:["do not reorder the options","do not assign work; the planner pulls"]},{id:"worker",name:"Worker",modelTier:"small",capabilities:["deliver","review","verify"],canApprove:[],inputs:["brief"],outputs:["code","test-output"],do_not:["do not change acceptance criteria","do not pull more work while your card is open"]}]}var C=(e,t,a,s,m)=>m?{rule:e,severity:t,item:m,message:a,fix:s}:{rule:e,severity:t,message:a,fix:s},Z=e=>e.payload??{},se=e=>{let t=Z(e).items;return Array.isArray(t)?t:[]},ze=(e,t)=>Object.values(e.items).filter(a=>a.stage===t&&P.has(a.status)).length;function ke(){return [{id:"policy-explicit",severity:"error",check(l,i){let r=l.stages.find(n=>n.deliveryPoint)?.id;if(i.type==="init")return l.stages.filter(n=>n.id!==r&&n.exitPolicy.length===0).map(n=>C("policy-explicit","error",`column "${n.id}" has no explicit policy`,`give column "${n.id}" at least one policy, e.g. { "kind": "acceptance-written" }`));if(i.type==="ceremony.service-delivery-review"){let n=Z(i).policies??{};return Object.entries(n).filter(([o,c])=>o!==r&&Array.isArray(c)&&c.length===0).map(([o])=>C("policy-explicit","error",`column "${o}" would be left without a policy`,"keep at least one policy per column; Kanban policies are explicit"))}return []}},{id:"commitment-point-once",severity:"error",check(l,i){if(i.type!=="init")return [];let r=[],n=l.stages.filter(c=>c.commitmentPoint),o=l.stages.filter(c=>c.deliveryPoint);if(n.length!==1&&r.push(C("commitment-point-once","error",`${n.length} columns are marked commitmentPoint (${n.map(c=>c.id).join(", ")||"none"})`,"mark exactly one column commitmentPoint: true")),o.length!==1&&r.push(C("commitment-point-once","error",`${o.length} columns are marked deliveryPoint (${o.map(c=>c.id).join(", ")||"none"})`,"mark exactly one column deliveryPoint: true")),n.length===1&&o.length===1){let c=l.stages.indexOf(n[0]),d=l.stages.indexOf(o[0]);d!==l.stages.length-1&&r.push(C("commitment-point-once","error",`delivery column "${o[0].id}" is not the last column`,"move the delivery column to the end; finished cards leave the board there")),c===0?r.push(C("commitment-point-once","error",`commitment column "${n[0].id}" is the first column`,"keep an Options column before the commitment point; replenishment pulls from it")):c>=d&&r.push(C("commitment-point-once","error",`commitment column "${n[0].id}" comes after the delivery column`,"order columns options \u2192 commitment \u2192 \u2026 \u2192 delivery"));}return r}},{id:"wip-respected",severity:"error",check(l,i){if(i.type==="ceremony.replenishment"){let r=l.stages.find(p=>p.commitmentPoint);if(!r||r.wipLimit===void 0)return [];let n=se(i),o=Object.values(l.items).filter(p=>p.stage===r.id&&E.has(p.status)).length,c=n.some(p=>l.items[p]?.classOfService==="expedite")?h(l).classesOfService.expedite?.wipBypass??1:0,d=r.wipLimit+c;return o+n.length<=d?[]:[C("wip-respected","error",`column "${r.id}" holds ${o} card(s); pulling ${n.length} more exceeds its WIP limit of ${r.wipLimit}${c?` (+${c} expedite bypass)`:""}`,`pull at most ${Math.max(0,d-o)} card(s) now, or raise the limit in a service-delivery-review`)]}if(i.type==="ceremony.service-delivery-review"){let r=Z(i).wip??{},n=[];for(let[o,c]of Object.entries(r)){if(typeof c!="number")continue;let d=ze(l,o);d>c&&n.push(C("wip-respected","warning",`column "${o}" has ${d} active card(s), above the new limit of ${c}`,"nothing new is pulled into it until it drains; finish or move cards"));}return n}return []}},{id:"pull-not-push",severity:"error",check(l,i){if(i.type!=="ceremony.replenishment")return [];let r=l.stages[0],n=l.stages.find(d=>d.commitmentPoint);if(!r||!n)return [];let o=[],c=Z(i).column;c!==void 0&&c!==n.id&&o.push(C("pull-not-push","error",`replenishment may only pull into the commitment column "${n.id}", not "${String(c)}"`,"drop column or set it to the commitment column; later columns are pulled by the planner"));for(let d of se(i)){let p=Object.hasOwn(l.items,d)?l.items[d]:void 0;p&&(p.stage!==r.id||p.status!=="todo")&&o.push(C("pull-not-push","error",`item "${d}" is ${p.status} in "${p.stage}", not an option`,`only todo cards in "${r.id}" can be pulled; cards already on the board flow by pull`,d));}return o}},{id:"blocker-has-owner",severity:"error",check(l,i){if(!i.type.startsWith("ceremony."))return [];let r=[];if(i.type==="ceremony.operations-review"){let n=Z(i).assign??[];for(let o of n)(typeof o.owner!="string"||o.owner.trim()==="")&&r.push(C("blocker-has-owner","error",`blocker "${o.blocker}" on "${o.item}" would have no owner`,"name the role or person who clears it",o.item));}for(let n of Object.values(l.items))for(let o of n.blockers)!o.clearedAt&&o.owner.trim()===""&&r.push(C("blocker-has-owner","warning",`blocker "${o.id}" on "${n.id}" has no owner`,`assign one in operations-review: { "assign": [{ "item": "${n.id}", "blocker": "${o.id}", "owner": "<who>" }] }`,n.id));return r}},{id:"one-expedite",severity:"error",check(l,i){if(i.type!=="ceremony.replenishment")return [];let r=se(i).filter(c=>l.items[c]?.classOfService==="expedite");if(r.length===0)return [];let n=Object.values(l.items).filter(c=>c.classOfService==="expedite"&&E.has(c.status)&&D(l,c)).map(c=>c.id),o=h(l).maxExpedite;return n.length+r.length<=o?[]:[C("one-expedite","error",`${n.length} expedite card(s) already on the board (${n.join(", ")||"none"}); pulling ${r.join(", ")} exceeds maxExpedite ${o}`,"deliver the current expedite first, reclassify the new card, or raise maxExpedite in a strategy-review")]}},{id:"fixed-date-needs-deadline",severity:"error",check(l,i){return i.type!=="ceremony.replenishment"?[]:se(i).filter(r=>{let n=l.items[r];return n?.classOfService==="fixed-date"&&!(n.deadline&&Number.isFinite(Date.parse(n.deadline)))}).map(r=>C("fixed-date-needs-deadline","error",`fixed-date item "${r}" has no deadline`,`editItem("${r}", { deadline: "<ISO date>" }) before pulling it`,r))}}]}function we(e){let t=e.columns.map(m=>{let f={id:m.id,name:m.name,entryPolicy:[],exitPolicy:m.policies};return m.wipLimit!==void 0&&(f.wipLimit=m.wipLimit),m.commitmentPoint&&(f.commitmentPoint=true),m.deliveryPoint&&(f.deliveryPoint=true),m.review&&(f.review=true),f}),a=t.findIndex(m=>m.commitmentPoint),s=a>=0?t[a+1]:void 0;return s&&(s.entryPolicy=t[a].exitPolicy),t}var Ge=Object.freeze({backlog:"Options",item:"Work Item",stage:"Column",iteration:"Cadence",increment:"Delivery",ceremony:"Cadence",gate:"Policy"}),Ze={expedite:0,"fixed-date":1,standard:2,intangible:3},Ne=e=>Ze[e.classOfService??"standard"]??2,he=1e15,Qe=4e9,Xe=(e,t,a)=>Math.min(a,Math.max(t,e));function et(e,t){let a=e.classOfService??"standard";if(e.type==="question")return 5*he;if(a==="fixed-date"&&e.deadline!==void 0){let l=Date.parse(e.deadline);if(Number.isFinite(l))return 3*he+1e10-Math.floor(l/1e3)}let s=t.aging?Math.floor(t.deferrals/t.maxDeferralRounds):0,m=Xe(e.priority??0,-1e9,1e9)+s*Qe,f=t.aging&&t.deferrals>=t.maxDeferralRounds;return (a==="expedite"?4:a==="fixed-date"?3:a==="intangible"&&!f?1:2)*he+m}function _e(e,t){let a=Ne(e)-Ne(t);if(a!==0)return a;let s=_(e),m=_(t),f=s===void 0?0:Date.parse(s),y=m===void 0?0:Date.parse(m);return f!==y?f-y:e.id<t.id?-1:e.id>t.id?1:0}function tt(e){return e.map(t=>t.kind==="evidence"?`evidence ${t.evidenceKind}`:t.kind==="custom"?`${t.id}: ${t.description}`:t.kind).join(", ")||"(none)"}function nt(){return {name:"kanban",vocabulary:Ge,validateConfig:z,defaultStages:we,defaultRoles:ve,requiredCapabilities:["manage-flow","deliver"],exclusiveCapabilities:[],plannerOptions(e){let t=h(e),a=T(e),s=e.stages[e.stages.findIndex(n=>n.id===a.id)+1],m=t.classesOfService.expedite?.wipBypass??1,f=[],y=[0],l=new Map;for(let n of e.events)f.push(Date.parse(n.at)),y.push(y[y.length-1]+(n.type==="planner.resolved"?1:0)),n.type==="item.added"&&l.set(n.payload.id,n.at);let i=n=>{let o=0,c=f.length;for(;o<c;){let d=o+c>>1;f[d]<=n?o=d+1:c=d;}return y[f.length]-y[o]},r={schedulerMode:"throughput",fairnessPolicy:t.fairness.aging?"aging":"none",deadlineStrategy:"earliest-first",dispatchStage:n=>n.stage===a.id&&s?s.id:void 0,priorityOf:n=>{let o=Date.parse(_(n)??l.get(n.id)??"");return et(n,{deferrals:i(Number.isFinite(o)?o:0),aging:t.fairness.aging,maxDeferralRounds:t.fairness.maxDeferralRounds})},tieBreaker:_e,wipCounts:[...P],wipLimitOf:(n,o)=>n.wipLimit===void 0?void 0:o.classOfService==="expedite"?n.wipLimit+m:n.wipLimit};return r.maxDeferralRounds=t.fairness.maxDeferralRounds,r},candidates(e){let t=Math.max(0,h(e).maxExpedite-U(e).length),a=Object.values(e.items).filter(m=>(m.status==="todo"||m.status==="review")&&D(e,m)),s=exsorted.timSort(a.filter(m=>m.classOfService==="expedite"),_e).slice(0,t);return a.filter(m=>m.classOfService!=="expedite"||s.includes(m))},invariants(e,t){let a=h(e),s=e.stages.find(l=>l.id===t.stage),m=t.classOfService??"standard",f=a.classesOfService[m]?.sle,y=Object.values(e.items).filter(l=>l.stage===s.id&&P.has(l.status)).length;return [`Column "${s.name}" exit policies: ${tt(s.exitPolicy)}`,`Class of service: ${m}${t.deadline?`; deadline ${t.deadline}`:""}${f?`; service level p${f.percentile} <= ${f.targetMs} ms`:""}`,`WIP limit of "${s.name}": ${s.wipLimit??"none"} (active now: ${y}); finish this card before pulling another`,`Do not change the scope of "${t.id}" or its acceptance criteria; raise open_questions instead`]},ceremonies:be(nt),rules:ke(),metrics:e=>({...G(e)}),humanDefaults:{gates:"none"},lockedConfigKeys:["columns","classesOfService"],report:e=>({cadencesDue:de(e)})}}exports.A=ye;exports.B=be;exports.C=ve;exports.D=ke;exports.E=we;exports.F=Ge;exports.G=et;exports.H=_e;exports.I=nt;exports.a=P;exports.b=E;exports.c=ae;exports.d=T;exports.e=te;exports.f=ee;exports.g=D;exports.h=U;exports.i=_;exports.j=Y;exports.k=I;exports.l=ne;exports.m=h;exports.n=De;exports.o=z;exports.p=ie;exports.q=re;exports.r=Fe;exports.s=Ie;exports.t=de;exports.u=oe;exports.v=V;exports.w=fe;exports.x=G;exports.y=pe;exports.z=ge;//# sourceMappingURL=chunk-YGCNLXPJ.cjs.map
|
|
2
|
+
//# sourceMappingURL=chunk-YGCNLXPJ.cjs.map
|