ex-workflow 1.0.1 → 1.1.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 +4 -0
- package/README.md +78 -19
- 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-Cx63FX2K.d.ts → budget-Bd8KpGIr.d.ts} +1 -1
- package/dist/{budget-JyNKxP5N.d.cts → budget-CezCinPF.d.cts} +1 -1
- package/dist/chunk-6P3OKXSK.mjs +2 -0
- package/dist/chunk-6P3OKXSK.mjs.map +1 -0
- package/dist/{chunk-5PHK72VM.cjs → chunk-7FS6KWTG.cjs} +2 -2
- package/dist/{chunk-5PHK72VM.cjs.map → chunk-7FS6KWTG.cjs.map} +1 -1
- package/dist/chunk-APKA5FOU.cjs +2 -0
- package/dist/chunk-APKA5FOU.cjs.map +1 -0
- package/dist/chunk-ATCJ4IHP.mjs +2 -0
- package/dist/{chunk-Z2G7DGDF.mjs.map → chunk-ATCJ4IHP.mjs.map} +1 -1
- package/dist/chunk-C2IYMWE6.cjs +3 -0
- package/dist/chunk-C2IYMWE6.cjs.map +1 -0
- package/dist/chunk-EACZBAP3.cjs +2 -0
- package/dist/chunk-EACZBAP3.cjs.map +1 -0
- package/dist/chunk-EHBQBXWA.cjs +2 -0
- package/dist/{chunk-VXH2FAKV.cjs.map → chunk-EHBQBXWA.cjs.map} +1 -1
- package/dist/chunk-FQW2LETC.cjs +2 -0
- package/dist/chunk-FQW2LETC.cjs.map +1 -0
- package/dist/chunk-FTS75UIU.mjs +2 -0
- package/dist/{chunk-U3OXAO67.mjs.map → chunk-FTS75UIU.mjs.map} +1 -1
- package/dist/chunk-HCRVWMG4.cjs +2 -0
- package/dist/chunk-HCRVWMG4.cjs.map +1 -0
- package/dist/chunk-KLWZEXZU.mjs +3 -0
- package/dist/chunk-KLWZEXZU.mjs.map +1 -0
- package/dist/chunk-MW4HR7HC.mjs +2 -0
- package/dist/chunk-MW4HR7HC.mjs.map +1 -0
- package/dist/chunk-NDCQTRIV.mjs +2 -0
- package/dist/chunk-NDCQTRIV.mjs.map +1 -0
- package/dist/{chunk-7IG6EQI4.mjs → chunk-QZ6HD6DE.mjs} +3 -3
- package/dist/{chunk-7IG6EQI4.mjs.map → chunk-QZ6HD6DE.mjs.map} +1 -1
- package/dist/{chunk-HIHMBMB5.cjs → chunk-RL27372B.cjs} +2 -2
- package/dist/{chunk-HIHMBMB5.cjs.map → chunk-RL27372B.cjs.map} +1 -1
- package/dist/chunk-SP5MC7RR.mjs +2 -0
- package/dist/{chunk-QDMEM62U.mjs.map → chunk-SP5MC7RR.mjs.map} +1 -1
- package/dist/chunk-SYLO7FUL.mjs +2 -0
- package/dist/{chunk-3KFQPSRX.mjs.map → chunk-SYLO7FUL.mjs.map} +1 -1
- package/dist/chunk-T3V5UE34.mjs +2 -0
- package/dist/{chunk-UZQV73X7.mjs.map → chunk-T3V5UE34.mjs.map} +1 -1
- package/dist/{chunk-FKTCGQYB.cjs → chunk-TS66RAJR.cjs} +2 -2
- package/dist/{chunk-FKTCGQYB.cjs.map → chunk-TS66RAJR.cjs.map} +1 -1
- package/dist/{chunk-YRATJT7P.cjs → chunk-U23FUYPD.cjs} +4 -4
- package/dist/{chunk-YRATJT7P.cjs.map → chunk-U23FUYPD.cjs.map} +1 -1
- package/dist/{chunk-CYXVGHQM.cjs → chunk-YJQ5YJ7S.cjs} +2 -2
- package/dist/{chunk-CYXVGHQM.cjs.map → chunk-YJQ5YJ7S.cjs.map} +1 -1
- package/dist/chunk-YOS77GL3.mjs +2 -0
- package/dist/chunk-YOS77GL3.mjs.map +1 -0
- package/dist/chunk-YTG2MOD7.cjs +2 -0
- package/dist/chunk-YTG2MOD7.cjs.map +1 -0
- package/dist/chunk-YZJ6WFH4.mjs +2 -0
- package/dist/chunk-YZJ6WFH4.mjs.map +1 -0
- 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 +2 -0
- package/dist/experimentation/index.cjs.map +1 -0
- package/dist/experimentation/index.d.cts +28 -0
- package/dist/experimentation/index.d.ts +28 -0
- package/dist/experimentation/index.mjs +2 -0
- package/dist/experimentation/index.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/investigation/index.cjs +2 -0
- package/dist/investigation/index.cjs.map +1 -0
- package/dist/investigation/index.d.cts +13 -0
- package/dist/investigation/index.d.ts +13 -0
- package/dist/investigation/index.mjs +2 -0
- package/dist/investigation/index.mjs.map +1 -0
- 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/schema/index.cjs +1 -1
- package/dist/schema/index.d.cts +3 -1
- package/dist/schema/index.d.ts +3 -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-BScHXlRx.d.cts +509 -0
- package/dist/types-BScHXlRx.d.ts +509 -0
- package/dist/types.d.cts +1 -388
- package/dist/types.d.ts +1 -388
- 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 +43 -20
- package/dist/chunk-3KFQPSRX.mjs +0 -2
- package/dist/chunk-5TXYMLBF.mjs +0 -3
- package/dist/chunk-5TXYMLBF.mjs.map +0 -1
- package/dist/chunk-MQWMQ4PD.mjs +0 -2
- package/dist/chunk-MQWMQ4PD.mjs.map +0 -1
- package/dist/chunk-QDMEM62U.mjs +0 -2
- package/dist/chunk-U3OXAO67.mjs +0 -2
- package/dist/chunk-UZQV73X7.mjs +0 -2
- package/dist/chunk-VXH2FAKV.cjs +0 -2
- package/dist/chunk-WOGK54HB.cjs +0 -3
- package/dist/chunk-WOGK54HB.cjs.map +0 -1
- package/dist/chunk-XMO2RCXB.cjs +0 -2
- package/dist/chunk-XMO2RCXB.cjs.map +0 -1
- package/dist/chunk-YBHHICTZ.mjs +0 -2
- package/dist/chunk-YBHHICTZ.mjs.map +0 -1
- package/dist/chunk-YJN4JEJU.cjs +0 -2
- package/dist/chunk-YJN4JEJU.cjs.map +0 -1
- package/dist/chunk-Z2G7DGDF.mjs +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/brief.ts","../src/complete.ts","../src/accounting.ts"],"names":["completions","state","itemId","out","ev","lastCompletion","all","synthesizeBrief","methodology","item","fail","role","roleOf","upstream","doNot","sources","dep","p","d","priorHandoffs","touched","relatedBugs","b","a","it","openIteration","gate","stageOf","brief","remaining","openQuestions","last","next","opts","res","plan","briefs","VERDICTS","LESSON_SCOPES","isObj","x","str","validate","handoff","acc","getItem","bad","what","fix","verdict","lessons","l","followUps","f","k","pulledFromStage","i","t","reworkStage","lastDispatchBefore","complete","now","result","ruled","applyAction","completeBody","at","nowOf","id","s","addEvidence","addSpent","lid","appendEvent","n","first","_drop","rest","addItem","warnings","clearRole","moveItem","lastStageId","stage","assertPolicies","checkGate","v","raisePending","advanceItem","raiseBlocker","thinker","rolesWith","qid","parent","pulledFrom","q","patchItem","NUMERIC","pick","correctAccounting","patch","by","line","indexes","idx","before","flag","after","delta","owner"],"mappings":"gJAiBA,SAASA,CAAAA,CACPC,CAAAA,CACAC,CAAAA,CAC0C,CAC1C,IAAMC,CAAAA,CAAgD,EAAC,CACvD,IAAA,IAAWC,CA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,CAAAA,GAAMgD,CAAAA,CAAMG,CAAAA,CAAQnE,CAAE,CACpE,CAAA,CACA,OAAIqE,GAAAA,GACFxC,CAAAA,CAAI,CACF,GAAGA,CAAAA,CACH,UAAA,CAAYA,CAAAA,CAAE,UAAA,CAAW,GAAA,CAAK7C,CAAAA,EAC5BA,CAAAA,CAAG,EAAA,GAAOqF,GAAAA,CAAM,EAAA,CACZ,CACE,GAAGrF,CAAAA,CACH,KAAA,CAAO,CACL,GAAGA,CAAAA,CAAG,KAAA,CACN,MAAA,CAAQ,IAAA,CAAK,GAAA,CAAI,CAAA,CAAGA,CAAAA,CAAG,KAAA,CAAM,MAAA,CAASoF,CAAAA,CAAM,MAAM,CAAA,CAClD,WAAA,CAAa,IAAA,CAAK,GAAA,CAAI,EAAGpF,CAAAA,CAAG,KAAA,CAAM,WAAA,CAAcoF,CAAAA,CAAM,UAAU,CAClE,CACF,CAAA,CACApF,CACN,CACF,CAAA,CAAA,CACKiD,CAAAA,CACLJ,CAAAA,CACA,sBAAA,CACAgC,CAAAA,CACA,CACE,KAAMnG,CAAAA,CACN,IAAA,CAAMwE,CAAAA,CACN,SAAA,CAAWmC,GAAAA,EAAO,EAAA,EAAM,IAAA,CACxB,MAAA,CAAQvF,CAAAA,CACR,KAAA,CAAOC,CAAAA,CACP,KAAA,CAAAqF,CACF,CAAA,CACAzC,CAAAA,CAAMN,CAAG,CACX,CACF","file":"chunk-Z2G7DGDF.mjs","sourcesContent":["import { remaining } from \"./budget.ts\";\nimport { fail } from \"./errors.ts\";\nimport { stageOf } from \"./items.ts\";\nimport { openIteration, plan, type PlanOptions, type PlanReason, type Skipped } from \"./planner.ts\";\nimport { roleOf } from \"./roles.ts\";\nimport type { Brief, Handoff, Methodology, Verdict, WorkItem, WorkflowState } from \"./types.ts\";\n\ninterface CompletedPayload {\n id: string;\n role: string;\n verdict: Verdict;\n produced: Handoff[\"produced\"];\n notes: string;\n do_not: string[];\n open_questions?: string[];\n}\n\nfunction completions(\n state: WorkflowState,\n itemId: string,\n): Array<CompletedPayload & { at: string }> {\n const out: Array<CompletedPayload & { at: string }> = [];\n for (const ev of state.events) {\n if (ev.type === \"item.completed\" && (ev.payload as CompletedPayload).id === itemId)\n out.push({ ...(ev.payload as CompletedPayload), at: ev.at });\n }\n return out;\n}\n\nfunction lastCompletion(state: WorkflowState, itemId: string): CompletedPayload | undefined {\n const all = completions(state, itemId);\n return all[all.length - 1];\n}\n\nexport function synthesizeBrief(\n state: WorkflowState,\n methodology: Methodology,\n item: WorkItem,\n): Brief {\n if (!item.role)\n fail(\n \"unknown-role\",\n `item \"${item.id}\" has no role assigned`,\n \"dispatch it with next() or set item.role\",\n { items: [item.id] },\n );\n const role = roleOf(state, item.role);\n if (!role)\n fail(\n \"unknown-role\",\n `role \"${item.role}\" does not exist`,\n `registered roles: ${Object.keys(state.roles).join(\", \")}`,\n );\n const upstream: Brief[\"upstream\"] = [];\n const doNot = [...role.do_not];\n const sources = [\n ...item.dependsOn,\n ...(item.type === \"bug\" || item.type === \"change-request\" ? (item.affects ?? []) : []),\n ];\n for (const dep of sources) {\n const p = lastCompletion(state, dep);\n if (!p) continue;\n upstream.push({ item: dep, produced: p.produced, notes: p.notes });\n for (const d of p.do_not) if (!doNot.includes(d)) doNot.push(d);\n }\n const priorHandoffs: Brief[\"priorHandoffs\"] = completions(state, item.id).map((p) => ({\n role: p.role,\n verdict: p.verdict,\n notes: p.notes,\n produced: p.produced,\n at: p.at,\n }));\n const touched = new Set([item.id, ...item.dependsOn]);\n const relatedBugs: Brief[\"relatedBugs\"] = Object.values(state.items)\n .filter(\n (b) =>\n (b.type === \"bug\" || b.type === \"change-request\") &&\n b.id !== item.id &&\n b.status !== \"done\" &&\n b.status !== \"dropped\" &&\n (b.affects ?? []).some((a) => touched.has(a)),\n )\n .map((b) => ({ id: b.id, title: b.title, affects: b.affects ?? [] }));\n const it = openIteration(state);\n const gate = stageOf(state, item.stage).gate;\n const brief: Brief = {\n item,\n role,\n modelTier: role.modelTier,\n invariants: [...methodology.invariants(state, item), ...state.agreements],\n do_not: doNot,\n acceptance: item.acceptance,\n upstream,\n priorHandoffs,\n relatedBugs,\n budgetRemaining: it ? remaining(it.budget, it.spent) : {},\n };\n if (gate) brief.gateAhead = gate;\n if (item.type === \"question\" && item.parent) {\n const p = lastCompletion(state, item.parent);\n if (p) {\n brief.parent = {\n item: item.parent,\n role: p.role,\n notes: p.notes,\n produced: p.produced,\n open_questions: p.open_questions ?? [],\n do_not: p.do_not,\n };\n for (const d of p.do_not) if (!doNot.includes(d)) doNot.push(d);\n }\n }\n return brief;\n}\n\n/** Open questions of finished items: the last completion per item, verdict done/needs-review, with open_questions left unanswered. */\nexport function openQuestions(\n state: WorkflowState,\n): Array<{ item: string; role: string; questions: string[]; at: string }> {\n const last = new Map<string, CompletedPayload & { at: string }>();\n for (const ev of state.events) {\n if (ev.type !== \"item.completed\") continue;\n const p = ev.payload as CompletedPayload;\n last.delete(p.id);\n last.set(p.id, { ...p, at: ev.at });\n }\n return [...last.values()]\n .filter(\n (p) =>\n (p.verdict === \"done\" || p.verdict === \"needs-review\") &&\n (p.open_questions ?? []).length > 0,\n )\n .map((p) => ({ item: p.id, role: p.role, questions: p.open_questions ?? [], at: p.at }));\n}\n\nexport interface NextResult {\n state: WorkflowState;\n briefs: Brief[];\n skipped: Skipped[];\n reason?: PlanReason;\n}\n\nexport function next(\n state: WorkflowState,\n methodology: Methodology,\n opts: PlanOptions = {},\n): NextResult {\n const res = plan(state, methodology, opts);\n const briefs = res.dispatched.map((d) =>\n synthesizeBrief(res.state, methodology, res.state.items[d.id]!),\n );\n return res.reason\n ? { state: res.state, briefs, skipped: res.skipped, reason: res.reason }\n : { state: res.state, briefs, skipped: res.skipped };\n}\n","import { addSpent } from \"./budget.ts\";\nimport { fail } from \"./errors.ts\";\nimport { checkGate, lastDispatchBefore, raisePending } from \"./gates.ts\";\nimport {\n addEvidence,\n addItem,\n advanceItem,\n clearRole,\n getItem,\n moveItem,\n patchItem,\n raiseBlocker,\n stageOf,\n} from \"./items.ts\";\nimport { applyAction } from \"./methodology.ts\";\nimport { assertPolicies } from \"./policies.ts\";\nimport { openIteration } from \"./planner.ts\";\nimport { rolesWith } from \"./roles.ts\";\nimport { appendEvent, nowOf } from \"./state.ts\";\nimport type {\n Accounting,\n ApplyResult,\n Handoff,\n Methodology,\n NewItem,\n Violation,\n WorkItem,\n WorkflowState,\n} from \"./types.ts\";\n\nconst VERDICTS: readonly string[] = [\"done\", \"needs-review\", \"rework\", \"blocked\", \"escalate\"];\nconst LESSON_SCOPES: readonly string[] = [\"policy\", \"skill\", \"memory\", \"spec\", \"review\"];\n\nconst isObj = (x: unknown): x is Record<string, unknown> =>\n typeof x === \"object\" && x !== null && !Array.isArray(x);\nconst str = (x: unknown) => typeof x === \"string\";\n\nfunction validate(state: WorkflowState, handoff: Handoff, acc: Accounting): void {\n const item = getItem(state, handoff.item);\n if (item.status !== \"in_progress\")\n fail(\n \"invalid-transition\",\n `item \"${item.id}\" is ${item.status}, not in_progress`,\n \"only dispatched items can be completed; call next() first\",\n { items: [item.id] },\n );\n if (!Array.isArray(handoff.do_not))\n fail(\n \"handoff-invalid\",\n `handoff for \"${item.id}\" has no do_not array`,\n \"set handoff.do_not to [] when there is nothing to forbid\",\n { items: [item.id] },\n );\n if (!Array.isArray(handoff.produced) || !Array.isArray(handoff.open_questions))\n fail(\n \"handoff-invalid\",\n `handoff for \"${item.id}\" needs produced[] and open_questions[]`,\n \"pass empty arrays when there is nothing\",\n { items: [item.id] },\n );\n const bad = (what: string, fix: string) =>\n fail(\"handoff-invalid\", `handoff for \"${item.id}\": ${what}`, fix, { items: [item.id] });\n const verdict = handoff.verdict ?? \"done\";\n if (!VERDICTS.includes(verdict))\n bad(`unknown verdict ${JSON.stringify(verdict)}`, `use one of: ${VERDICTS.join(\", \")}`);\n if (!handoff.produced.every((p) => isObj(p) && str(p.kind) && str(p.ref)))\n bad(\"produced[] entries need string kind and ref\", 'use { \"kind\": \"code\", \"ref\": \"src/a.ts\" }');\n const lessons: unknown = handoff.lessons ?? [];\n if (\n !Array.isArray(lessons) ||\n !lessons.every((l) => isObj(l) && str(l.text) && LESSON_SCOPES.includes(l.scope as string))\n )\n bad(\n \"lessons[] entries need a text and a scope\",\n `scope is one of: ${LESSON_SCOPES.join(\", \")}`,\n );\n const followUps: unknown = handoff.follow_ups ?? [];\n if (!Array.isArray(followUps) || !followUps.every((f) => isObj(f) && str(f.id) && str(f.title)))\n bad(\"follow_ups[] entries need a string id and title\", \"describe each follow-up as a new item\");\n if (handoff.role !== item.role)\n fail(\n \"handoff-invalid\",\n `handoff role \"${handoff.role}\" differs from the dispatched role \"${item.role}\"`,\n `complete as \"${item.role}\" or re-dispatch`,\n { items: [item.id] },\n );\n if (!acc.model || acc.model.trim() === \"\")\n fail(\n \"accounting-invalid\",\n `accounting for \"${item.id}\" has no model`,\n \"record the model id that actually ran the work\",\n { items: [item.id] },\n );\n for (const k of [\"tokensIn\", \"tokensOut\", \"durationMs\"] as const) {\n if (!Number.isFinite(acc[k]) || acc[k] < 0)\n fail(\n \"accounting-invalid\",\n `accounting.${k} must be a non-negative number`,\n `measure ${k} from the host's usage report`,\n { items: [item.id] },\n );\n }\n if (acc.tokensIn + acc.tokensOut === 0 && acc.estimate !== true)\n fail(\n \"accounting-invalid\",\n `accounting for \"${item.id}\" records 0 tokens`,\n \"pass the host's usage figures, or set estimate: true (CLI --estimate) to record a placeholder and correct it later with correctAccounting / exwf account\",\n { items: [item.id] },\n );\n}\n\n/** Stage the item was pulled from: the `from.stage` of its last transition into in_progress, else its current stage. */\nfunction pulledFromStage(item: WorkItem): string {\n for (let i = item.transitions.length - 1; i >= 0; i--) {\n const t = item.transitions[i]!;\n if (t.to.status === \"in_progress\") return t.from.stage;\n }\n return item.stage;\n}\n\n/** Stage a reworked item returns to: the from.stage of the last dispatch made from a stage strictly before the current one (so a reviewer's rework lands where the work was pulled from), else the plain pulled-from stage. */\nfunction reworkStage(state: WorkflowState, item: WorkItem): string {\n return lastDispatchBefore(state, item)?.from.stage ?? pulledFromStage(item);\n}\n\nexport function complete(\n state: WorkflowState,\n methodology: Methodology,\n handoff: Handoff,\n acc: Accounting,\n now?: string,\n): ApplyResult {\n validate(state, handoff, acc);\n // the methodology's rules see the completion (applyAction validates, appends nothing, then reduces)\n let result: ApplyResult | undefined;\n const ruled = applyAction(\n state,\n methodology,\n { type: \"item.complete\", by: handoff.role, payload: { item: handoff.item, handoff } },\n () => {\n result = completeBody(state, methodology, handoff, acc, now);\n return result.state;\n },\n );\n return { state: ruled.state, warnings: [...ruled.warnings, ...result!.warnings] };\n}\n\nfunction completeBody(\n state: WorkflowState,\n methodology: Methodology,\n handoff: Handoff,\n acc: Accounting,\n now?: string,\n): ApplyResult {\n const at = nowOf(now);\n const id = handoff.item;\n const role = handoff.role;\n let s: WorkflowState = { ...state, accounting: [...state.accounting, acc] };\n for (const p of handoff.produced)\n s = addEvidence(s, id, { kind: p.kind, ref: p.ref, by: role }, at);\n const it = openIteration(s);\n if (it && (it.committed.includes(id) || getItem(s, id).iteration === it.id)) {\n s = {\n ...s,\n iterations: s.iterations.map((x) =>\n x.id === it.id ? { ...x, spent: addSpent(x.spent, acc) } : x,\n ),\n };\n }\n\n for (const l of handoff.lessons ?? []) {\n const lid = `L${s.lessons.length + 1}`;\n s = {\n ...s,\n lessons: [\n ...s.lessons,\n { id: lid, at, text: l.text, scope: l.scope, status: \"raised\", from: role, item: id },\n ],\n };\n s = appendEvent(\n s,\n \"lesson.raised\",\n role,\n { id: lid, from: role, item: id, scope: l.scope },\n at,\n );\n }\n\n const followUps: string[] = [];\n for (const n of handoff.follow_ups ?? []) {\n const first = s.stages[0]!;\n const { iteration: _drop, ...rest } = n;\n s = addItem(\n s,\n { ...rest, stage: first.id, parent: id, tags: [...(n.tags ?? []), \"follow-up\"] },\n role,\n at,\n );\n followUps.push(n.id);\n }\n\n const verdict = handoff.verdict ?? \"done\";\n const warnings: Violation[] = [];\n if ((verdict === \"done\" || verdict === \"needs-review\") && handoff.open_questions.length > 0)\n warnings.push({\n rule: \"open-questions-ignored\",\n severity: \"warning\",\n item: id,\n message: `\"${id}\" finished with ${handoff.open_questions.length} open question(s) nobody will see: ${handoff.open_questions.join(\" | \")}`,\n fix: 'use verdict \"escalate\" to route them to a role with capability escalate, or answer them in the next brief',\n });\n if (verdict === \"rework\") {\n if (!handoff.notes || handoff.notes.trim() === \"\")\n fail(\n \"handoff-invalid\",\n `rework on \"${id}\" needs notes`,\n \"say what must change in handoff.notes\",\n { items: [id] },\n );\n const item = getItem(s, id);\n s = clearRole(moveItem(s, id, { stage: reworkStage(s, item), status: \"todo\" }, role, at), id);\n s = appendEvent(s, \"item.rework\", role, { id, by: role, notes: handoff.notes }, at);\n } else if (\n (verdict === \"done\" || verdict === \"needs-review\") &&\n getItem(s, id).type === \"question\"\n ) {\n // a question is answered, not delivered: it skips exit policies and gates\n const lastStageId = s.stages[s.stages.length - 1]!.id;\n s = moveItem(s, id, { stage: lastStageId, status: \"done\" }, role, at);\n } else if (verdict === \"done\" || verdict === \"needs-review\") {\n const item = getItem(s, id);\n const stage = stageOf(s, item.stage);\n assertPolicies(s, item, stage.exitPolicy, `leave \"${stage.id}\"`);\n if (stage.gate) {\n const res = checkGate(s, item, stage.gate, role);\n if (res.outcome === \"fail\")\n fail(\n \"gate-unmet\",\n `gate \"${stage.gate.id}\" blocks \"${id}\": ${res.violations.map((v) => v.message).join(\"; \")}`,\n res.violations.map((v) => v.fix).join(\"; \"),\n { items: [id], rule: res.violations[0]!.rule },\n );\n if (res.outcome === \"human\") {\n s = raisePending(\n s,\n {\n kind: \"gate\",\n item: id,\n gate: stage.gate.id,\n question: `Approve gate \"${stage.gate.id}\" for \"${item.title}\" (${id})?`,\n },\n at,\n );\n } else {\n s = appendEvent(\n advanceItem(s, id, role, verdict === \"needs-review\", at),\n \"gate.passed\",\n role,\n { item: id, gate: stage.gate.id },\n at,\n );\n }\n } else {\n s = advanceItem(s, id, role, verdict === \"needs-review\", at);\n }\n } else if (verdict === \"blocked\") {\n s = raiseBlocker(s, id, handoff.notes || \"blocked by worker\", role, role, at);\n } else if (verdict === \"escalate\") {\n const thinker = rolesWith(s, \"escalate\")[0];\n if (!thinker)\n fail(\n \"missing-capability\",\n `no role has capability \"escalate\" to receive the question from \"${id}\"`,\n \"register a role with capability escalate\",\n { items: [id] },\n );\n const n = Object.keys(s.items).filter((k) => k.startsWith(`${id}-q`)).length + 1;\n const qid = `${id}-q${n}`;\n const parent = getItem(s, id);\n const pulledFrom = pulledFromStage(parent);\n const q: NewItem = {\n id: qid,\n type: \"question\",\n title: handoff.open_questions.join(\" | \") || handoff.notes || `question from ${id}`,\n parent: id,\n role: thinker.id,\n priority: Number.MAX_SAFE_INTEGER,\n stage: pulledFrom,\n };\n if (parent.iteration !== undefined) q.iteration = parent.iteration;\n s = addItem(s, q, role, at);\n s = moveItem(s, id, { stage: pulledFrom, status: \"todo\" }, role, at);\n s = patchItem(s, id, (x) => ({ ...x, dependsOn: [...x.dependsOn, qid] }));\n s = appendEvent(s, \"item.escalated\", role, { id, question: qid, to: thinker.id }, at);\n }\n\n s = appendEvent(\n s,\n \"item.completed\",\n role,\n {\n id,\n role,\n verdict,\n produced: handoff.produced,\n notes: handoff.notes,\n do_not: handoff.do_not,\n open_questions: handoff.open_questions,\n followUps,\n tokens: acc.tokensIn + acc.tokensOut,\n durationMs: acc.durationMs,\n model: acc.model,\n },\n at,\n );\n if (methodology.afterComplete) s = methodology.afterComplete(s, id, at);\n return { state: s, warnings };\n}\n","import { fail } from \"./errors.ts\";\nimport { getItem } from \"./items.ts\";\nimport { appendEvent, nowOf } from \"./state.ts\";\nimport type { Accounting, Iteration, WorkflowState } from \"./types.ts\";\n\nexport interface AccountingPatch {\n tokensIn?: number;\n tokensOut?: number;\n durationMs?: number;\n model?: string;\n}\n\nconst NUMERIC = [\n [\"tokensIn\", \"tokens-in\"],\n [\"tokensOut\", \"tokens-out\"],\n [\"durationMs\", \"duration-ms\"],\n] as const;\n\nconst pick = (a: Accounting) => ({\n tokensIn: a.tokensIn,\n tokensOut: a.tokensOut,\n durationMs: a.durationMs,\n model: a.model,\n});\n\n/**\n * Rewrite one accounting line of an item (`line` is 1-based among the item's lines, default the last).\n * The owning iteration's spent follows the delta, open or closed; the event records before/after.\n */\nexport function correctAccounting(\n state: WorkflowState,\n itemId: string,\n patch: AccountingPatch,\n by: string,\n now?: string,\n line?: number,\n): WorkflowState {\n getItem(state, itemId);\n const indexes: number[] = [];\n state.accounting.forEach((a, i) => {\n if (a.item === itemId) indexes.push(i);\n });\n if (indexes.length === 0)\n fail(\n \"invalid-input\",\n `item \"${itemId}\" has no accounting line to correct`,\n `complete \"${itemId}\" first (exwf complete), then exwf account`,\n { items: [itemId] },\n );\n const n = line ?? indexes.length;\n if (!Number.isInteger(n) || n < 1 || n > indexes.length)\n fail(\n \"invalid-input\",\n `item \"${itemId}\" has ${indexes.length} accounting line(s), not line ${String(line)}`,\n `pass --line 1..${indexes.length}`,\n { items: [itemId] },\n );\n const idx = indexes[n - 1]!;\n const before = state.accounting[idx]!;\n for (const [k, flag] of NUMERIC) {\n const v = patch[k];\n if (v !== undefined && (!Number.isFinite(v) || v < 0))\n fail(\n \"accounting-invalid\",\n `${k} must be a non-negative number`,\n `pass --${flag} <n> with a measured figure`,\n { items: [itemId] },\n );\n }\n if (patch.model !== undefined && patch.model.trim() === \"\")\n fail(\n \"accounting-invalid\",\n \"model must not be empty\",\n \"pass --model with the model id that ran the work\",\n { items: [itemId] },\n );\n const { estimate: _drop, ...rest } = before;\n const after: Accounting = {\n ...rest,\n tokensIn: patch.tokensIn ?? before.tokensIn,\n tokensOut: patch.tokensOut ?? before.tokensOut,\n durationMs: patch.durationMs ?? before.durationMs,\n model: patch.model ?? before.model,\n };\n if (after.tokensIn + after.tokensOut === 0)\n fail(\n \"accounting-invalid\",\n `the correction leaves \"${itemId}\" at 0 tokens`,\n \"pass the host's usage figures with --tokens-in / --tokens-out\",\n { items: [itemId] },\n );\n const b = pick(before);\n const a = pick(after);\n const unchanged =\n b.tokensIn === a.tokensIn &&\n b.tokensOut === a.tokensOut &&\n b.durationMs === a.durationMs &&\n b.model === a.model;\n // replacing a placeholder with the same figures still settles it, so it is not a no-op\n if (unchanged && before.estimate !== true)\n fail(\n \"no-op\",\n `accounting for \"${itemId}\" line ${n} already has these figures`,\n \"pass at least one different value to exwf account\",\n { items: [itemId] },\n );\n const delta = {\n tokens: a.tokensIn + a.tokensOut - (b.tokensIn + b.tokensOut),\n durationMs: a.durationMs - b.durationMs,\n };\n const item = state.items[itemId]!;\n let owner: Iteration | undefined;\n for (const it of state.iterations) {\n // the last iteration that was open when the line was recorded and carried the item\n if (\n (it.committed.includes(itemId) || item.iteration === it.id) &&\n it.startedAt <= before.endedAt &&\n (it.endedAt === undefined || before.endedAt <= it.endedAt)\n )\n owner = it;\n }\n let s: WorkflowState = {\n ...state,\n accounting: state.accounting.map((x, i) => (i === idx ? after : x)),\n };\n if (owner)\n s = {\n ...s,\n iterations: s.iterations.map((it) =>\n it.id === owner.id\n ? {\n ...it,\n spent: {\n ...it.spent,\n tokens: Math.max(0, it.spent.tokens + delta.tokens),\n wallclockMs: Math.max(0, it.spent.wallclockMs + delta.durationMs),\n },\n }\n : it,\n ),\n };\n return appendEvent(\n s,\n \"accounting.corrected\",\n by,\n {\n item: itemId,\n line: n,\n iteration: owner?.id ?? null,\n before: b,\n after: a,\n delta,\n },\n nowOf(now),\n );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/brief.ts","../src/complete.ts","../src/accounting.ts"],"names":["completions","state","itemId","out","ev","lastCompletion","all","synthesizeBrief","methodology","item","fail","role","roleOf","upstream","doNot","sources","dep","p","d","priorHandoffs","touched","relatedBugs","b","a","it","openIteration","gate","stageOf","brief","remaining","openQuestions","last","next","opts","res","plan","briefs","VERDICTS","LESSON_SCOPES","isObj","x","str","validate","handoff","acc","getItem","bad","what","fix","verdict","lessons","l","followUps","f","k","pulledFromStage","i","t","reworkStage","lastDispatchBefore","complete","now","result","ruled","applyAction","completeBody","at","nowOf","id","s","addEvidence","addSpent","lid","appendEvent","n","first","_drop","rest","addItem","warnings","clearRole","moveItem","lastStageId","stage","assertPolicies","checkGate","v","raisePending","advanceItem","raiseBlocker","thinker","rolesWith","qid","parent","pulledFrom","q","patchItem","NUMERIC","pick","correctAccounting","patch","by","line","indexes","idx","before","flag","after","delta","owner"],"mappings":"2HAiBA,SAASA,CAAAA,CACPC,CAAAA,CACAC,CAAAA,CAC0C,CAC1C,IAAMC,CAAAA,CAAgD,EAAC,CACvD,IAAA,IAAWC,CAAAA,IAAMH,CAAAA,CAAM,MAAA,CACjBG,CAAAA,CAAG,IAAA,GAAS,gBAAA,EAAqBA,CAAAA,CAAG,OAAA,CAA6B,EAAA,GAAOF,CAAAA,EAC1EC,CAAAA,CAAI,IAAA,CAAK,CAAE,GAAIC,CAAAA,CAAG,OAAA,CAA8B,EAAA,CAAIA,CAAAA,CAAG,EAAG,CAAC,CAAA,CAE/D,OAAOD,CACT,CAEA,SAASE,CAAAA,CAAeJ,CAAAA,CAAsBC,CAAAA,CAA8C,CAC1F,IAAMI,CAAAA,CAAMN,CAAAA,CAAYC,CAAAA,CAAOC,CAAM,CAAA,CACrC,OAAOI,CAAAA,CAAIA,CAAAA,CAAI,MAAA,CAAS,CAAC,CAC3B,CAEO,SAASC,EAAAA,CACdN,CAAAA,CACAO,CAAAA,CACAC,GAAAA,CACO,CACFA,GAAAA,CAAK,IAAA,EACRC,CAAAA,CACE,cAAA,CACA,SAASD,GAAAA,CAAK,EAAE,CAAA,sBAAA,CAAA,CAChB,0CAAA,CACA,CAAE,KAAA,CAAO,CAACA,GAAAA,CAAK,EAAE,CAAE,CACrB,CAAA,CACF,IAAME,CAAAA,CAAOC,CAAAA,CAAOX,CAAAA,CAAOQ,GAAAA,CAAK,IAAI,CAAA,CAC/BE,CAAAA,EACHD,CAAAA,CACE,cAAA,CACA,CAAA,MAAA,EAASD,GAAAA,CAAK,IAAI,CAA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,CACF","file":"chunk-ATCJ4IHP.mjs","sourcesContent":["import { remaining } from \"./budget.ts\";\nimport { fail } from \"./errors.ts\";\nimport { stageOf } from \"./items.ts\";\nimport { openIteration, plan, type PlanOptions, type PlanReason, type Skipped } from \"./planner.ts\";\nimport { roleOf } from \"./roles.ts\";\nimport type { Brief, Handoff, Methodology, Verdict, WorkItem, WorkflowState } from \"./types.ts\";\n\ninterface CompletedPayload {\n id: string;\n role: string;\n verdict: Verdict;\n produced: Handoff[\"produced\"];\n notes: string;\n do_not: string[];\n open_questions?: string[];\n}\n\nfunction completions(\n state: WorkflowState,\n itemId: string,\n): Array<CompletedPayload & { at: string }> {\n const out: Array<CompletedPayload & { at: string }> = [];\n for (const ev of state.events) {\n if (ev.type === \"item.completed\" && (ev.payload as CompletedPayload).id === itemId)\n out.push({ ...(ev.payload as CompletedPayload), at: ev.at });\n }\n return out;\n}\n\nfunction lastCompletion(state: WorkflowState, itemId: string): CompletedPayload | undefined {\n const all = completions(state, itemId);\n return all[all.length - 1];\n}\n\nexport function synthesizeBrief(\n state: WorkflowState,\n methodology: Methodology,\n item: WorkItem,\n): Brief {\n if (!item.role)\n fail(\n \"unknown-role\",\n `item \"${item.id}\" has no role assigned`,\n \"dispatch it with next() or set item.role\",\n { items: [item.id] },\n );\n const role = roleOf(state, item.role);\n if (!role)\n fail(\n \"unknown-role\",\n `role \"${item.role}\" does not exist`,\n `registered roles: ${Object.keys(state.roles).join(\", \")}`,\n );\n const upstream: Brief[\"upstream\"] = [];\n const doNot = [...role.do_not];\n const sources = [\n ...item.dependsOn,\n ...(item.type === \"bug\" || item.type === \"change-request\" ? (item.affects ?? []) : []),\n ];\n for (const dep of sources) {\n const p = lastCompletion(state, dep);\n if (!p) continue;\n upstream.push({ item: dep, produced: p.produced, notes: p.notes });\n for (const d of p.do_not) if (!doNot.includes(d)) doNot.push(d);\n }\n const priorHandoffs: Brief[\"priorHandoffs\"] = completions(state, item.id).map((p) => ({\n role: p.role,\n verdict: p.verdict,\n notes: p.notes,\n produced: p.produced,\n at: p.at,\n }));\n const touched = new Set([item.id, ...item.dependsOn]);\n const relatedBugs: Brief[\"relatedBugs\"] = Object.values(state.items)\n .filter(\n (b) =>\n (b.type === \"bug\" || b.type === \"change-request\") &&\n b.id !== item.id &&\n b.status !== \"done\" &&\n b.status !== \"dropped\" &&\n (b.affects ?? []).some((a) => touched.has(a)),\n )\n .map((b) => ({ id: b.id, title: b.title, affects: b.affects ?? [] }));\n const it = openIteration(state);\n const gate = stageOf(state, item.stage).gate;\n const brief: Brief = {\n item,\n role,\n modelTier: role.modelTier,\n invariants: [...methodology.invariants(state, item), ...state.agreements],\n do_not: doNot,\n acceptance: item.acceptance,\n upstream,\n priorHandoffs,\n relatedBugs,\n budgetRemaining: it ? remaining(it.budget, it.spent) : {},\n };\n if (gate) brief.gateAhead = gate;\n if (item.type === \"question\" && item.parent) {\n const p = lastCompletion(state, item.parent);\n if (p) {\n brief.parent = {\n item: item.parent,\n role: p.role,\n notes: p.notes,\n produced: p.produced,\n open_questions: p.open_questions ?? [],\n do_not: p.do_not,\n };\n for (const d of p.do_not) if (!doNot.includes(d)) doNot.push(d);\n }\n }\n return brief;\n}\n\n/** Open questions of finished items: the last completion per item, verdict done/needs-review, with open_questions left unanswered. */\nexport function openQuestions(\n state: WorkflowState,\n): Array<{ item: string; role: string; questions: string[]; at: string }> {\n const last = new Map<string, CompletedPayload & { at: string }>();\n for (const ev of state.events) {\n if (ev.type !== \"item.completed\") continue;\n const p = ev.payload as CompletedPayload;\n last.delete(p.id);\n last.set(p.id, { ...p, at: ev.at });\n }\n return [...last.values()]\n .filter(\n (p) =>\n (p.verdict === \"done\" || p.verdict === \"needs-review\") &&\n (p.open_questions ?? []).length > 0,\n )\n .map((p) => ({ item: p.id, role: p.role, questions: p.open_questions ?? [], at: p.at }));\n}\n\nexport interface NextResult {\n state: WorkflowState;\n briefs: Brief[];\n skipped: Skipped[];\n reason?: PlanReason;\n}\n\nexport function next(\n state: WorkflowState,\n methodology: Methodology,\n opts: PlanOptions = {},\n): NextResult {\n const res = plan(state, methodology, opts);\n const briefs = res.dispatched.map((d) =>\n synthesizeBrief(res.state, methodology, res.state.items[d.id]!),\n );\n return res.reason\n ? { state: res.state, briefs, skipped: res.skipped, reason: res.reason }\n : { state: res.state, briefs, skipped: res.skipped };\n}\n","import { addSpent } from \"./budget.ts\";\nimport { fail } from \"./errors.ts\";\nimport { checkGate, lastDispatchBefore, raisePending } from \"./gates.ts\";\nimport {\n addEvidence,\n addItem,\n advanceItem,\n clearRole,\n getItem,\n moveItem,\n patchItem,\n raiseBlocker,\n stageOf,\n} from \"./items.ts\";\nimport { applyAction } from \"./methodology.ts\";\nimport { assertPolicies } from \"./policies.ts\";\nimport { openIteration } from \"./planner.ts\";\nimport { rolesWith } from \"./roles.ts\";\nimport { appendEvent, nowOf } from \"./state.ts\";\nimport type {\n Accounting,\n ApplyResult,\n Handoff,\n Methodology,\n NewItem,\n Violation,\n WorkItem,\n WorkflowState,\n} from \"./types.ts\";\n\nconst VERDICTS: readonly string[] = [\"done\", \"needs-review\", \"rework\", \"blocked\", \"escalate\"];\nconst LESSON_SCOPES: readonly string[] = [\"policy\", \"skill\", \"memory\", \"spec\", \"review\"];\n\nconst isObj = (x: unknown): x is Record<string, unknown> =>\n typeof x === \"object\" && x !== null && !Array.isArray(x);\nconst str = (x: unknown) => typeof x === \"string\";\n\nfunction validate(state: WorkflowState, handoff: Handoff, acc: Accounting): void {\n const item = getItem(state, handoff.item);\n if (item.status !== \"in_progress\")\n fail(\n \"invalid-transition\",\n `item \"${item.id}\" is ${item.status}, not in_progress`,\n \"only dispatched items can be completed; call next() first\",\n { items: [item.id] },\n );\n if (!Array.isArray(handoff.do_not))\n fail(\n \"handoff-invalid\",\n `handoff for \"${item.id}\" has no do_not array`,\n \"set handoff.do_not to [] when there is nothing to forbid\",\n { items: [item.id] },\n );\n if (!Array.isArray(handoff.produced) || !Array.isArray(handoff.open_questions))\n fail(\n \"handoff-invalid\",\n `handoff for \"${item.id}\" needs produced[] and open_questions[]`,\n \"pass empty arrays when there is nothing\",\n { items: [item.id] },\n );\n const bad = (what: string, fix: string) =>\n fail(\"handoff-invalid\", `handoff for \"${item.id}\": ${what}`, fix, { items: [item.id] });\n const verdict = handoff.verdict ?? \"done\";\n if (!VERDICTS.includes(verdict))\n bad(`unknown verdict ${JSON.stringify(verdict)}`, `use one of: ${VERDICTS.join(\", \")}`);\n if (!handoff.produced.every((p) => isObj(p) && str(p.kind) && str(p.ref)))\n bad(\"produced[] entries need string kind and ref\", 'use { \"kind\": \"code\", \"ref\": \"src/a.ts\" }');\n const lessons: unknown = handoff.lessons ?? [];\n if (\n !Array.isArray(lessons) ||\n !lessons.every((l) => isObj(l) && str(l.text) && LESSON_SCOPES.includes(l.scope as string))\n )\n bad(\n \"lessons[] entries need a text and a scope\",\n `scope is one of: ${LESSON_SCOPES.join(\", \")}`,\n );\n const followUps: unknown = handoff.follow_ups ?? [];\n if (!Array.isArray(followUps) || !followUps.every((f) => isObj(f) && str(f.id) && str(f.title)))\n bad(\"follow_ups[] entries need a string id and title\", \"describe each follow-up as a new item\");\n if (handoff.role !== item.role)\n fail(\n \"handoff-invalid\",\n `handoff role \"${handoff.role}\" differs from the dispatched role \"${item.role}\"`,\n `complete as \"${item.role}\" or re-dispatch`,\n { items: [item.id] },\n );\n if (!acc.model || acc.model.trim() === \"\")\n fail(\n \"accounting-invalid\",\n `accounting for \"${item.id}\" has no model`,\n \"record the model id that actually ran the work\",\n { items: [item.id] },\n );\n for (const k of [\"tokensIn\", \"tokensOut\", \"durationMs\"] as const) {\n if (!Number.isFinite(acc[k]) || acc[k] < 0)\n fail(\n \"accounting-invalid\",\n `accounting.${k} must be a non-negative number`,\n `measure ${k} from the host's usage report`,\n { items: [item.id] },\n );\n }\n if (acc.tokensIn + acc.tokensOut === 0 && acc.estimate !== true)\n fail(\n \"accounting-invalid\",\n `accounting for \"${item.id}\" records 0 tokens`,\n \"pass the host's usage figures, or set estimate: true (CLI --estimate) to record a placeholder and correct it later with correctAccounting / exwf account\",\n { items: [item.id] },\n );\n}\n\n/** Stage the item was pulled from: the `from.stage` of its last transition into in_progress, else its current stage. */\nfunction pulledFromStage(item: WorkItem): string {\n for (let i = item.transitions.length - 1; i >= 0; i--) {\n const t = item.transitions[i]!;\n if (t.to.status === \"in_progress\") return t.from.stage;\n }\n return item.stage;\n}\n\n/** Stage a reworked item returns to: the from.stage of the last dispatch made from a stage strictly before the current one (so a reviewer's rework lands where the work was pulled from), else the plain pulled-from stage. */\nfunction reworkStage(state: WorkflowState, item: WorkItem): string {\n return lastDispatchBefore(state, item)?.from.stage ?? pulledFromStage(item);\n}\n\nexport function complete(\n state: WorkflowState,\n methodology: Methodology,\n handoff: Handoff,\n acc: Accounting,\n now?: string,\n): ApplyResult {\n validate(state, handoff, acc);\n // the methodology's rules see the completion (applyAction validates, appends nothing, then reduces)\n let result: ApplyResult | undefined;\n const ruled = applyAction(\n state,\n methodology,\n { type: \"item.complete\", by: handoff.role, payload: { item: handoff.item, handoff } },\n () => {\n result = completeBody(state, methodology, handoff, acc, now);\n return result.state;\n },\n );\n return { state: ruled.state, warnings: [...ruled.warnings, ...result!.warnings] };\n}\n\nfunction completeBody(\n state: WorkflowState,\n methodology: Methodology,\n handoff: Handoff,\n acc: Accounting,\n now?: string,\n): ApplyResult {\n const at = nowOf(now);\n const id = handoff.item;\n const role = handoff.role;\n let s: WorkflowState = { ...state, accounting: [...state.accounting, acc] };\n for (const p of handoff.produced)\n s = addEvidence(s, id, { kind: p.kind, ref: p.ref, by: role }, at);\n const it = openIteration(s);\n if (it && (it.committed.includes(id) || getItem(s, id).iteration === it.id)) {\n s = {\n ...s,\n iterations: s.iterations.map((x) =>\n x.id === it.id ? { ...x, spent: addSpent(x.spent, acc) } : x,\n ),\n };\n }\n\n for (const l of handoff.lessons ?? []) {\n const lid = `L${s.lessons.length + 1}`;\n s = {\n ...s,\n lessons: [\n ...s.lessons,\n { id: lid, at, text: l.text, scope: l.scope, status: \"raised\", from: role, item: id },\n ],\n };\n s = appendEvent(\n s,\n \"lesson.raised\",\n role,\n { id: lid, from: role, item: id, scope: l.scope },\n at,\n );\n }\n\n const followUps: string[] = [];\n for (const n of handoff.follow_ups ?? []) {\n const first = s.stages[0]!;\n const { iteration: _drop, ...rest } = n;\n s = addItem(\n s,\n { ...rest, stage: first.id, parent: id, tags: [...(n.tags ?? []), \"follow-up\"] },\n role,\n at,\n );\n followUps.push(n.id);\n }\n\n const verdict = handoff.verdict ?? \"done\";\n const warnings: Violation[] = [];\n if ((verdict === \"done\" || verdict === \"needs-review\") && handoff.open_questions.length > 0)\n warnings.push({\n rule: \"open-questions-ignored\",\n severity: \"warning\",\n item: id,\n message: `\"${id}\" finished with ${handoff.open_questions.length} open question(s) nobody will see: ${handoff.open_questions.join(\" | \")}`,\n fix: 'use verdict \"escalate\" to route them to a role with capability escalate, or answer them in the next brief',\n });\n if (verdict === \"rework\") {\n if (!handoff.notes || handoff.notes.trim() === \"\")\n fail(\n \"handoff-invalid\",\n `rework on \"${id}\" needs notes`,\n \"say what must change in handoff.notes\",\n { items: [id] },\n );\n const item = getItem(s, id);\n s = clearRole(moveItem(s, id, { stage: reworkStage(s, item), status: \"todo\" }, role, at), id);\n s = appendEvent(s, \"item.rework\", role, { id, by: role, notes: handoff.notes }, at);\n } else if (\n (verdict === \"done\" || verdict === \"needs-review\") &&\n getItem(s, id).type === \"question\"\n ) {\n // a question is answered, not delivered: it skips exit policies and gates\n const lastStageId = s.stages[s.stages.length - 1]!.id;\n s = moveItem(s, id, { stage: lastStageId, status: \"done\" }, role, at);\n } else if (verdict === \"done\" || verdict === \"needs-review\") {\n const item = getItem(s, id);\n const stage = stageOf(s, item.stage);\n assertPolicies(s, item, stage.exitPolicy, `leave \"${stage.id}\"`);\n if (stage.gate) {\n const res = checkGate(s, item, stage.gate, role);\n if (res.outcome === \"fail\")\n fail(\n \"gate-unmet\",\n `gate \"${stage.gate.id}\" blocks \"${id}\": ${res.violations.map((v) => v.message).join(\"; \")}`,\n res.violations.map((v) => v.fix).join(\"; \"),\n { items: [id], rule: res.violations[0]!.rule },\n );\n if (res.outcome === \"human\") {\n s = raisePending(\n s,\n {\n kind: \"gate\",\n item: id,\n gate: stage.gate.id,\n question: `Approve gate \"${stage.gate.id}\" for \"${item.title}\" (${id})?`,\n },\n at,\n );\n } else {\n s = appendEvent(\n advanceItem(s, id, role, verdict === \"needs-review\", at),\n \"gate.passed\",\n role,\n { item: id, gate: stage.gate.id },\n at,\n );\n }\n } else {\n s = advanceItem(s, id, role, verdict === \"needs-review\", at);\n }\n } else if (verdict === \"blocked\") {\n s = raiseBlocker(s, id, handoff.notes || \"blocked by worker\", role, role, at);\n } else if (verdict === \"escalate\") {\n const thinker = rolesWith(s, \"escalate\")[0];\n if (!thinker)\n fail(\n \"missing-capability\",\n `no role has capability \"escalate\" to receive the question from \"${id}\"`,\n \"register a role with capability escalate\",\n { items: [id] },\n );\n const n = Object.keys(s.items).filter((k) => k.startsWith(`${id}-q`)).length + 1;\n const qid = `${id}-q${n}`;\n const parent = getItem(s, id);\n const pulledFrom = pulledFromStage(parent);\n const q: NewItem = {\n id: qid,\n type: \"question\",\n title: handoff.open_questions.join(\" | \") || handoff.notes || `question from ${id}`,\n parent: id,\n role: thinker.id,\n priority: Number.MAX_SAFE_INTEGER,\n stage: pulledFrom,\n };\n if (parent.iteration !== undefined) q.iteration = parent.iteration;\n s = addItem(s, q, role, at);\n s = moveItem(s, id, { stage: pulledFrom, status: \"todo\" }, role, at);\n s = patchItem(s, id, (x) => ({ ...x, dependsOn: [...x.dependsOn, qid] }));\n s = appendEvent(s, \"item.escalated\", role, { id, question: qid, to: thinker.id }, at);\n }\n\n s = appendEvent(\n s,\n \"item.completed\",\n role,\n {\n id,\n role,\n verdict,\n produced: handoff.produced,\n notes: handoff.notes,\n do_not: handoff.do_not,\n open_questions: handoff.open_questions,\n followUps,\n tokens: acc.tokensIn + acc.tokensOut,\n durationMs: acc.durationMs,\n model: acc.model,\n },\n at,\n );\n if (methodology.afterComplete) s = methodology.afterComplete(s, id, at);\n return { state: s, warnings };\n}\n","import { fail } from \"./errors.ts\";\nimport { getItem } from \"./items.ts\";\nimport { appendEvent, nowOf } from \"./state.ts\";\nimport type { Accounting, Iteration, WorkflowState } from \"./types.ts\";\n\nexport interface AccountingPatch {\n tokensIn?: number;\n tokensOut?: number;\n durationMs?: number;\n model?: string;\n}\n\nconst NUMERIC = [\n [\"tokensIn\", \"tokens-in\"],\n [\"tokensOut\", \"tokens-out\"],\n [\"durationMs\", \"duration-ms\"],\n] as const;\n\nconst pick = (a: Accounting) => ({\n tokensIn: a.tokensIn,\n tokensOut: a.tokensOut,\n durationMs: a.durationMs,\n model: a.model,\n});\n\n/**\n * Rewrite one accounting line of an item (`line` is 1-based among the item's lines, default the last).\n * The owning iteration's spent follows the delta, open or closed; the event records before/after.\n */\nexport function correctAccounting(\n state: WorkflowState,\n itemId: string,\n patch: AccountingPatch,\n by: string,\n now?: string,\n line?: number,\n): WorkflowState {\n getItem(state, itemId);\n const indexes: number[] = [];\n state.accounting.forEach((a, i) => {\n if (a.item === itemId) indexes.push(i);\n });\n if (indexes.length === 0)\n fail(\n \"invalid-input\",\n `item \"${itemId}\" has no accounting line to correct`,\n `complete \"${itemId}\" first (exwf complete), then exwf account`,\n { items: [itemId] },\n );\n const n = line ?? indexes.length;\n if (!Number.isInteger(n) || n < 1 || n > indexes.length)\n fail(\n \"invalid-input\",\n `item \"${itemId}\" has ${indexes.length} accounting line(s), not line ${String(line)}`,\n `pass --line 1..${indexes.length}`,\n { items: [itemId] },\n );\n const idx = indexes[n - 1]!;\n const before = state.accounting[idx]!;\n for (const [k, flag] of NUMERIC) {\n const v = patch[k];\n if (v !== undefined && (!Number.isFinite(v) || v < 0))\n fail(\n \"accounting-invalid\",\n `${k} must be a non-negative number`,\n `pass --${flag} <n> with a measured figure`,\n { items: [itemId] },\n );\n }\n if (patch.model !== undefined && patch.model.trim() === \"\")\n fail(\n \"accounting-invalid\",\n \"model must not be empty\",\n \"pass --model with the model id that ran the work\",\n { items: [itemId] },\n );\n const { estimate: _drop, ...rest } = before;\n const after: Accounting = {\n ...rest,\n tokensIn: patch.tokensIn ?? before.tokensIn,\n tokensOut: patch.tokensOut ?? before.tokensOut,\n durationMs: patch.durationMs ?? before.durationMs,\n model: patch.model ?? before.model,\n };\n if (after.tokensIn + after.tokensOut === 0)\n fail(\n \"accounting-invalid\",\n `the correction leaves \"${itemId}\" at 0 tokens`,\n \"pass the host's usage figures with --tokens-in / --tokens-out\",\n { items: [itemId] },\n );\n const b = pick(before);\n const a = pick(after);\n const unchanged =\n b.tokensIn === a.tokensIn &&\n b.tokensOut === a.tokensOut &&\n b.durationMs === a.durationMs &&\n b.model === a.model;\n // replacing a placeholder with the same figures still settles it, so it is not a no-op\n if (unchanged && before.estimate !== true)\n fail(\n \"no-op\",\n `accounting for \"${itemId}\" line ${n} already has these figures`,\n \"pass at least one different value to exwf account\",\n { items: [itemId] },\n );\n const delta = {\n tokens: a.tokensIn + a.tokensOut - (b.tokensIn + b.tokensOut),\n durationMs: a.durationMs - b.durationMs,\n };\n const item = state.items[itemId]!;\n let owner: Iteration | undefined;\n for (const it of state.iterations) {\n // the last iteration that was open when the line was recorded and carried the item\n if (\n (it.committed.includes(itemId) || item.iteration === it.id) &&\n it.startedAt <= before.endedAt &&\n (it.endedAt === undefined || before.endedAt <= it.endedAt)\n )\n owner = it;\n }\n let s: WorkflowState = {\n ...state,\n accounting: state.accounting.map((x, i) => (i === idx ? after : x)),\n };\n if (owner)\n s = {\n ...s,\n iterations: s.iterations.map((it) =>\n it.id === owner.id\n ? {\n ...it,\n spent: {\n ...it.spent,\n tokens: Math.max(0, it.spent.tokens + delta.tokens),\n wallclockMs: Math.max(0, it.spent.wallclockMs + delta.durationMs),\n },\n }\n : it,\n ),\n };\n return appendEvent(\n s,\n \"accounting.corrected\",\n by,\n {\n item: itemId,\n line: n,\n iteration: owner?.id ?? null,\n before: b,\n after: a,\n delta,\n },\n nowOf(now),\n );\n}\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
'use strict';var chunkS3BXVHO7_cjs=require('./chunk-S3BXVHO7.cjs');var l={Accounting:{type:"object",properties:{item:{type:"string"},role:{type:"string"},model:{type:"string"},tokensIn:{type:"number"},tokensOut:{type:"number"},durationMs:{type:"number"},startedAt:{type:"string"},endedAt:{type:"string"},estimate:{type:"boolean"}},required:["item","role","model","tokensIn","tokensOut","durationMs","startedAt","endedAt"],additionalProperties:false},Baseline:{type:"object",properties:{phase:{type:"string"},version:{type:"number"},at:{type:"string"},approvedBy:{type:"array",items:{type:"string"}},itemSnapshot:{type:"object",additionalProperties:{$ref:"#/definitions/WorkItem"}}},required:["phase","version","at","approvedBy","itemSnapshot"],additionalProperties:false},BeliefUpdate:{type:"object",properties:{result:{type:"string"},assessments:{type:"array",items:{type:"object",properties:{hypothesis:{type:"string"},assessment:{type:"string",enum:["supported","refuted","uncertain"]},reason:{type:"string"}},required:["hypothesis","assessment","reason"],additionalProperties:false}}},required:["result","assessments"],additionalProperties:false},Blocker:{type:"object",properties:{id:{type:"string"},reason:{type:"string"},owner:{type:"string"},raisedAt:{type:"string"},clearedAt:{type:"string"}},required:["id","reason","owner","raisedAt"],additionalProperties:false},Budget:{type:"object",properties:{tokens:{type:"number"},turns:{type:"number"},wallclockMs:{type:"number"}},additionalProperties:false},Capability:{type:"string",enum:["order-backlog","define-acceptance","facilitate","deliver","review","verify","approve-gate","manage-flow","control-change","escalate"]},ClassOfService:{type:"string",enum:["expedite","fixed-date","standard","intangible"]},Event:{type:"object",properties:{seq:{type:"number"},at:{type:"string"},type:{type:"string"},by:{type:"string"},payload:{}},required:["seq","at","type","by","payload"],additionalProperties:false},Evidence:{type:"object",properties:{kind:{type:"string"},ref:{type:"string"},by:{type:"string"},at:{type:"string"}},required:["kind","ref","by","at"],additionalProperties:false},Experiment:{type:"object",properties:{id:{type:"string"},procedureRef:{type:"string"},predictions:{type:"array",items:{type:"object",properties:{hypothesis:{type:"string"},prediction:{type:"string"}},required:["hypothesis","prediction"],additionalProperties:false}},replayOf:{type:"string"}},required:["id","procedureRef","predictions"],additionalProperties:false},ExperimentCandidate:{type:"object",properties:{id:{type:"string"},item:{type:"string"},author:{type:"string"},status:{type:"string",enum:["pending","ready","running","submitted","validated","failed","timed-out","cancelled"]},workspace:{type:"string"},sha:{type:"string"},score:{type:"number"},spent:{$ref:"#/definitions/Spent"},validation:{type:"object",properties:{sha:{type:"string"},harness:{type:"string"},by:{type:"string"},passed:{type:"boolean"},reproducible:{type:"boolean"},evidence:{type:"string"}},required:["sha","harness","by","passed","reproducible","evidence"],additionalProperties:false},reason:{type:"string"},command:{type:"string"},log:{type:"string"},terminalLog:{type:"string"}},required:["id","item","author","status","spent"],additionalProperties:false},ExperimentationState:{type:"object",properties:{status:{type:"string",enum:["running","selected","integrating","integrated","stopped"]},baseSha:{type:"string"},harness:{type:"string"},candidates:{type:"object",additionalProperties:{$ref:"#/definitions/ExperimentCandidate"}},selected:{type:"string"},reason:{type:"string"},integration:{type:"object",properties:{selectedSha:{type:"string"},targetSha:{type:"string"},sha:{type:"string"},by:{type:"string"},validation:{type:"object",properties:{by:{type:"string"},sha:{type:"string"},harness:{type:"string"},evidence:{type:"string"},passed:{type:"boolean"}},required:["by","sha","harness","evidence","passed"],additionalProperties:false}},required:["selectedSha","targetSha","sha","by"],additionalProperties:false},released:{type:"array",items:{type:"string"}},overhead:{$ref:"#/definitions/Spent"}},required:["status","baseSha","harness","candidates","released","overhead"],additionalProperties:false},Gate:{type:"object",properties:{id:{type:"string"},requires:{type:"array",items:{$ref:"#/definitions/GateRequirement"}},evidence:{type:"array",items:{type:"string"}},onFail:{anyOf:[{type:"object",properties:{action:{type:"string",const:"block"}},required:["action"],additionalProperties:false},{type:"object",properties:{action:{type:"string",const:"return-to"},stage:{type:"string"}},required:["action","stage"],additionalProperties:false}]}},required:["id","requires","evidence","onFail"],additionalProperties:false},GateRequirement:{anyOf:[{type:"string",const:"human"},{type:"object",properties:{capability:{type:"string"}},required:["capability"],additionalProperties:false}]},Handoff:{type:"object",properties:{item:{type:"string"},role:{type:"string"},produced:{type:"array",items:{type:"object",properties:{kind:{type:"string"},ref:{type:"string"}},required:["kind","ref"],additionalProperties:false}},notes:{type:"string"},do_not:{type:"array",items:{type:"string"}},open_questions:{type:"array",items:{type:"string"}},verdict:{$ref:"#/definitions/Verdict"},follow_ups:{type:"array",items:{$ref:"#/definitions/NewItem"}},lessons:{type:"array",items:{type:"object",properties:{text:{type:"string"},scope:{type:"string",enum:["policy","skill","memory","spec","review"]}},required:["text","scope"],additionalProperties:false}}},required:["item","role","produced","notes","do_not","open_questions"],additionalProperties:false},Hypothesis:{type:"object",properties:{id:{type:"string"},claim:{type:"string"},falsifiedBy:{type:"string"}},required:["id","claim","falsifiedBy"],additionalProperties:false},ImpactAnalysis:{type:"object",properties:{summary:{type:"string"},reopen:{type:"array",items:{type:"string"}},weight:{type:"number"}},required:["summary","reopen","weight"],additionalProperties:false},InvestigationConclusion:{type:"object",properties:{outcome:{type:"string",enum:["resolved","inconclusive"]},summary:{type:"string"},supportedHypothesis:{type:"string"},evidenceRefs:{type:"array",items:{type:"string"}},by:{type:"string"}},required:["outcome","summary","evidenceRefs","by"],additionalProperties:false},InvestigationRound:{type:"object",properties:{hypotheses:{type:"array",items:{$ref:"#/definitions/Hypothesis"}},experiment:{$ref:"#/definitions/Experiment"},item:{type:"string"},by:{type:"string"},result:{$ref:"#/definitions/Observation"},update:{$ref:"#/definitions/BeliefUpdate"}},required:["hypotheses","experiment","item","by"],additionalProperties:false},InvestigationState:{type:"object",properties:{item:{type:"string"},phase:{type:"string",enum:["hypotheses","preregister","observe","update-belief","conclusion","review","closed"]},hypotheses:{type:"array",items:{$ref:"#/definitions/Hypothesis"}},singleHypothesisRationale:{type:"string"},rounds:{type:"array",items:{$ref:"#/definitions/InvestigationRound"}},conclusion:{$ref:"#/definitions/InvestigationConclusion"},outcome:{type:"string",enum:["resolved","inconclusive","stopped"]},stopReason:{type:"string"},contributors:{type:"array",items:{type:"string"}},reviewHistory:{type:"array",items:{type:"object",properties:{by:{type:"string"},reason:{type:"string"},approve:{type:"boolean"},next:{type:"string",enum:["round","conclusion"]},replayRefs:{type:"array",items:{type:"string"}}},required:["by","reason","approve","replayRefs"],additionalProperties:false}},review:{type:"object",properties:{by:{type:"string"},reason:{type:"string"},replayRefs:{type:"array",items:{type:"string"}}},required:["by","reason","replayRefs"],additionalProperties:false}},required:["item","phase","hypotheses","rounds","contributors"],additionalProperties:false},ItemPatch:{type:"object",properties:{type:{$ref:"#/definitions/ItemType"},title:{type:"string"},description:{type:"string"},dependsOn:{type:"array",items:{type:"string"}},priority:{type:"number"},weight:{type:"number"},deadline:{type:"string"},classOfService:{$ref:"#/definitions/ClassOfService"},role:{type:"string"},parent:{type:"string"},acceptance:{type:"array",items:{type:"string"}},iteration:{type:"string"},traces:{type:"array",items:{type:"string"}},tags:{type:"array",items:{type:"string"}},affects:{type:"array",items:{type:"string"}},phase:{type:"string"},impactAnalysis:{$ref:"#/definitions/ImpactAnalysis"}},additionalProperties:false},ItemStatus:{type:"string",enum:["todo","in_progress","blocked","review","awaiting_human","done","dropped"]},ItemType:{type:"string",enum:["epic","story","task","bug","change-request","deliverable","question"]},Iteration:{type:"object",properties:{id:{type:"string"},goal:{type:"string"},budget:{$ref:"#/definitions/Budget"},spent:{$ref:"#/definitions/Spent"},startedAt:{type:"string"},endedAt:{type:"string"},committed:{type:"array",items:{type:"string"}},carryover:{type:"array",items:{type:"string"}},outcome:{type:"string",enum:["completed","cancelled"]},closing:{type:"boolean"}},required:["id","goal","budget","spent","startedAt","committed","carryover"],additionalProperties:false},Lesson:{type:"object",properties:{id:{type:"string"},at:{type:"string"},text:{type:"string"},scope:{type:"string",enum:["policy","skill","memory","spec","review"]},status:{type:"string",enum:["raised","adopted","dismissed"]},from:{type:"string"},item:{type:"string"},suggestedChange:{$ref:"#/definitions/LessonChange"}},required:["id","at","text","scope","status"],additionalProperties:false},LessonChange:{anyOf:[{type:"object",properties:{kind:{type:"string",const:"agreement"},text:{type:"string"},replaces:{type:"string"}},required:["kind","text"],additionalProperties:false},{type:"object",properties:{kind:{type:"string",const:"dod"},policy:{$ref:"#/definitions/Policy"}},required:["kind","policy"],additionalProperties:false},{type:"object",properties:{kind:{type:"string",const:"backlog"},item:{$ref:"#/definitions/NewItem"}},required:["kind","item"],additionalProperties:false},{type:"object",properties:{kind:{type:"string",const:"skill"},note:{type:"string"}},required:["kind","note"],additionalProperties:false}]},MethodologyName:{type:"string",enum:["scrum","kanban","waterfall","investigation","experimentation"]},ModelTier:{type:"string",enum:["small","medium","large"]},NewItem:{type:"object",additionalProperties:false,properties:{stage:{type:"string"},type:{$ref:"#/definitions/ItemType"},description:{type:"string"},dependsOn:{type:"array",items:{type:"string"}},priority:{type:"number"},weight:{type:"number"},deadline:{type:"string"},classOfService:{$ref:"#/definitions/ClassOfService"},role:{type:"string"},parent:{type:"string"},acceptance:{type:"array",items:{type:"string"}},iteration:{type:"string"},traces:{type:"array",items:{type:"string"}},tags:{type:"array",items:{type:"string"}},affects:{type:"array",items:{type:"string"}},phase:{type:"string"},impactAnalysis:{$ref:"#/definitions/ImpactAnalysis"},id:{type:"string"},title:{type:"string"}},required:["id","title"]},Observation:{type:"object",properties:{id:{type:"string"},valid:{type:"boolean"},summary:{type:"string"},provenanceRefs:{type:"array",items:{type:"string"}}},required:["id","valid","summary","provenanceRefs"],additionalProperties:false},PendingHuman:{type:"object",properties:{id:{type:"string"},kind:{type:"string",enum:["gate","decision"]},item:{type:"string"},gate:{type:"string"},question:{type:"string"},raisedAt:{type:"string"}},required:["id","kind","question","raisedAt"],additionalProperties:false},Phase:{type:"object",properties:{id:{type:"string"},name:{type:"string"},deliverables:{type:"array",items:{type:"string"}},gate:{$ref:"#/definitions/Gate"},status:{type:"string",enum:["pending","open","baselined","reopened"]},budget:{$ref:"#/definitions/Budget"},produced:{type:"array",items:{$ref:"#/definitions/Produced"}}},required:["id","name","deliverables","gate","status"],additionalProperties:false},Policy:{anyOf:[{type:"object",properties:{kind:{type:"string",const:"evidence"},evidenceKind:{type:"string"}},required:["kind","evidenceKind"],additionalProperties:false},{type:"object",properties:{kind:{type:"string",const:"acceptance-written"}},required:["kind"],additionalProperties:false},{type:"object",properties:{kind:{type:"string",const:"estimate-present"}},required:["kind"],additionalProperties:false},{type:"object",properties:{kind:{type:"string",const:"no-open-blockers"}},required:["kind"],additionalProperties:false},{type:"object",properties:{kind:{type:"string",const:"dependencies-done"}},required:["kind"],additionalProperties:false},{type:"object",properties:{kind:{type:"string",const:"custom"},id:{type:"string"},description:{type:"string"}},required:["kind","id","description"],additionalProperties:false}]},Produced:{type:"object",properties:{kind:{type:"string"},ref:{type:"string"},by:{type:"string"},at:{type:"string"}},required:["kind","ref","by","at"],additionalProperties:false},Role:{type:"object",properties:{id:{type:"string"},name:{type:"string"},modelTier:{$ref:"#/definitions/ModelTier"},resourceClass:{type:"string"},maxConcurrent:{type:"number"},capabilities:{type:"array",items:{$ref:"#/definitions/Capability"}},canApprove:{type:"array",items:{type:"string"}},inputs:{type:"array",items:{type:"string"}},outputs:{type:"array",items:{type:"string"}},do_not:{type:"array",items:{type:"string"}},constraints:{type:"array",items:{type:"string"}}},required:["id","name","modelTier","capabilities","canApprove","inputs","outputs","do_not"],additionalProperties:false},Spent:{type:"object",properties:{tokens:{type:"number"},turns:{type:"number"},wallclockMs:{type:"number"}},required:["tokens","turns","wallclockMs"],additionalProperties:false},Stage:{type:"object",properties:{id:{type:"string"},name:{type:"string"},wipLimit:{type:"number"},entryPolicy:{type:"array",items:{$ref:"#/definitions/Policy"}},exitPolicy:{type:"array",items:{$ref:"#/definitions/Policy"}},gate:{$ref:"#/definitions/Gate"},commitmentPoint:{type:"boolean"},deliveryPoint:{type:"boolean"},review:{type:"boolean"}},required:["id","name","entryPolicy","exitPolicy"],additionalProperties:false},Transition:{type:"object",properties:{from:{type:"object",properties:{stage:{type:"string"},status:{$ref:"#/definitions/ItemStatus"}},required:["stage","status"],additionalProperties:false},to:{type:"object",properties:{stage:{type:"string"},status:{$ref:"#/definitions/ItemStatus"}},required:["stage","status"],additionalProperties:false},at:{type:"string"},by:{type:"string"}},required:["from","to","at","by"],additionalProperties:false},Verdict:{type:"string",enum:["done","blocked","needs-review","rework","escalate"]},WorkItem:{type:"object",properties:{id:{type:"string"},type:{$ref:"#/definitions/ItemType"},title:{type:"string"},description:{type:"string"},dependsOn:{type:"array",items:{type:"string"}},priority:{type:"number"},weight:{type:"number"},deadline:{type:"string"},classOfService:{$ref:"#/definitions/ClassOfService"},stage:{type:"string"},status:{$ref:"#/definitions/ItemStatus"},role:{type:"string"},parent:{type:"string"},acceptance:{type:"array",items:{type:"string"}},evidence:{type:"array",items:{$ref:"#/definitions/Evidence"}},blockers:{type:"array",items:{$ref:"#/definitions/Blocker"}},transitions:{type:"array",items:{$ref:"#/definitions/Transition"}},iteration:{type:"string"},traces:{type:"array",items:{type:"string"}},tags:{type:"array",items:{type:"string"}},affects:{type:"array",items:{type:"string"}},phase:{type:"string"},impactAnalysis:{$ref:"#/definitions/ImpactAnalysis"}},required:["id","type","title","dependsOn","stage","status","acceptance","evidence","blockers","transitions"],additionalProperties:false},WorkflowState:{type:"object",properties:{version:{type:"number",const:1},methodology:{$ref:"#/definitions/MethodologyName"},config:{},investigation:{$ref:"#/definitions/InvestigationState"},experimentation:{$ref:"#/definitions/ExperimentationState"},items:{type:"object",additionalProperties:{$ref:"#/definitions/WorkItem"}},stages:{type:"array",items:{$ref:"#/definitions/Stage"}},roles:{type:"object",additionalProperties:{$ref:"#/definitions/Role"}},iterations:{type:"array",items:{$ref:"#/definitions/Iteration"}},phases:{type:"array",items:{$ref:"#/definitions/Phase"}},baseline:{$ref:"#/definitions/Baseline"},baselines:{type:"array",items:{$ref:"#/definitions/Baseline"}},events:{type:"array",items:{$ref:"#/definitions/Event"}},accounting:{type:"array",items:{$ref:"#/definitions/Accounting"}},pending:{type:"array",items:{$ref:"#/definitions/PendingHuman"}},lessons:{type:"array",items:{$ref:"#/definitions/Lesson"}},agreements:{type:"array",items:{type:"string"}}},required:["version","methodology","config","items","stages","roles","iterations","events","accounting","pending","lessons","agreements"],additionalProperties:false}},h={Budget:{type:"object",properties:{tokens:{type:"number"},turns:{type:"number"},wallclockMs:{type:"number"}},additionalProperties:false},EstimateMode:{type:"string",enum:["per-weight","per-call"]},Policy:{anyOf:[{type:"object",properties:{kind:{type:"string",const:"evidence"},evidenceKind:{type:"string"}},required:["kind","evidenceKind"],additionalProperties:false},{type:"object",properties:{kind:{type:"string",const:"acceptance-written"}},required:["kind"],additionalProperties:false},{type:"object",properties:{kind:{type:"string",const:"estimate-present"}},required:["kind"],additionalProperties:false},{type:"object",properties:{kind:{type:"string",const:"no-open-blockers"}},required:["kind"],additionalProperties:false},{type:"object",properties:{kind:{type:"string",const:"dependencies-done"}},required:["kind"],additionalProperties:false},{type:"object",properties:{kind:{type:"string",const:"custom"},id:{type:"string"},description:{type:"string"}},required:["kind","id","description"],additionalProperties:false}]},ScrumConfig:{type:"object",properties:{sprintBudget:{$ref:"#/definitions/Budget"},productGoal:{type:"string"},definitionOfDone:{type:"array",items:{$ref:"#/definitions/Policy"}},refinementSharePct:{type:"number"},allowMidSprintAdd:{type:"string",enum:["never","po-only","any"]},inProgressWipLimit:{type:"number"},autoClose:{type:"boolean"},estimateMode:{$ref:"#/definitions/EstimateMode"},fallbackTokensPerWeight:{type:"number"}},required:["sprintBudget","productGoal","definitionOfDone","refinementSharePct","allowMidSprintAdd"],additionalProperties:false}},P={ClassConfig:{type:"object",properties:{wipBypass:{type:"number"},sle:{$ref:"#/definitions/ServiceLevel"}},additionalProperties:false},KanbanColumn:{type:"object",properties:{id:{type:"string"},name:{type:"string"},wipLimit:{type:"number"},policies:{type:"array",items:{$ref:"#/definitions/Policy"}},commitmentPoint:{type:"boolean"},deliveryPoint:{type:"boolean"},review:{type:"boolean"}},required:["id","name","policies"],additionalProperties:false},KanbanConfig:{type:"object",properties:{columns:{type:"array",items:{$ref:"#/definitions/KanbanColumn"}},classesOfService:{type:"object",properties:{expedite:{$ref:"#/definitions/ClassConfig"},"fixed-date":{$ref:"#/definitions/ClassConfig"},standard:{$ref:"#/definitions/ClassConfig"},intangible:{$ref:"#/definitions/ClassConfig"}},additionalProperties:false},fairness:{type:"object",properties:{aging:{type:"boolean"},maxDeferralRounds:{type:"number"}},required:["aging","maxDeferralRounds"],additionalProperties:false},cadences:{type:"object",properties:{replenishment:{type:"object",properties:{everyTurns:{type:"number"}},additionalProperties:false},"delivery-planning":{type:"object",properties:{everyTurns:{type:"number"}},additionalProperties:false},"service-delivery-review":{type:"object",properties:{everyTurns:{type:"number"}},additionalProperties:false},"operations-review":{type:"object",properties:{everyTurns:{type:"number"}},additionalProperties:false},"risk-review":{type:"object",properties:{everyTurns:{type:"number"}},additionalProperties:false},"strategy-review":{type:"object",properties:{everyTurns:{type:"number"}},additionalProperties:false}},additionalProperties:false},throughputWindowMs:{type:"number"},maxExpedite:{type:"number"}},required:["columns","classesOfService","fairness","cadences","throughputWindowMs","maxExpedite"],additionalProperties:false},Policy:{anyOf:[{type:"object",properties:{kind:{type:"string",const:"evidence"},evidenceKind:{type:"string"}},required:["kind","evidenceKind"],additionalProperties:false},{type:"object",properties:{kind:{type:"string",const:"acceptance-written"}},required:["kind"],additionalProperties:false},{type:"object",properties:{kind:{type:"string",const:"estimate-present"}},required:["kind"],additionalProperties:false},{type:"object",properties:{kind:{type:"string",const:"no-open-blockers"}},required:["kind"],additionalProperties:false},{type:"object",properties:{kind:{type:"string",const:"dependencies-done"}},required:["kind"],additionalProperties:false},{type:"object",properties:{kind:{type:"string",const:"custom"},id:{type:"string"},description:{type:"string"}},required:["kind","id","description"],additionalProperties:false}]},ServiceLevel:{type:"object",properties:{percentile:{type:"number"},targetMs:{type:"number"}},required:["percentile","targetMs"],additionalProperties:false}},k={Budget:{type:"object",properties:{tokens:{type:"number"},turns:{type:"number"},wallclockMs:{type:"number"}},additionalProperties:false},Gate:{type:"object",properties:{id:{type:"string"},requires:{type:"array",items:{$ref:"#/definitions/GateRequirement"}},evidence:{type:"array",items:{type:"string"}},onFail:{anyOf:[{type:"object",properties:{action:{type:"string",const:"block"}},required:["action"],additionalProperties:false},{type:"object",properties:{action:{type:"string",const:"return-to"},stage:{type:"string"}},required:["action","stage"],additionalProperties:false}]}},required:["id","requires","evidence","onFail"],additionalProperties:false},GateRequirement:{anyOf:[{type:"string",const:"human"},{type:"object",properties:{capability:{type:"string"}},required:["capability"],additionalProperties:false}]},WaterfallConfig:{type:"object",properties:{phases:{type:"array",items:{$ref:"#/definitions/WaterfallPhaseConfig"}},changeControl:{type:"object",properties:{requiresImpactAnalysis:{type:"boolean"},approvers:{type:"array",items:{$ref:"#/definitions/GateRequirement"}}},required:["requiresImpactAnalysis","approvers"],additionalProperties:false},traceability:{type:"object",properties:{from:{type:"string"},to:{type:"array",items:{type:"string"}}},required:["from","to"],additionalProperties:false},humanGates:{anyOf:[{type:"string",const:"all"},{type:"array",items:{type:"string"}}]},fallbackTokensPerWeight:{type:"number"}},required:["phases","changeControl","traceability","humanGates"],additionalProperties:false},WaterfallPhaseConfig:{type:"object",properties:{id:{type:"string"},name:{type:"string"},deliverables:{type:"array",items:{type:"string"}},gate:{$ref:"#/definitions/Gate"},budget:{$ref:"#/definitions/Budget"},deliverBy:{type:"string"}},required:["id","name","deliverables","gate"],additionalProperties:false}},$={Budget:{type:"object",properties:{tokens:{type:"number"},turns:{type:"number"},wallclockMs:{type:"number"}},additionalProperties:false},InvestigationConfig:{type:"object",properties:{question:{type:"string"},maxRounds:{type:"number"},budget:{$ref:"#/definitions/Budget"}},required:["question","maxRounds","budget"],additionalProperties:false}},j={Budget:{type:"object",properties:{tokens:{type:"number"},turns:{type:"number"},wallclockMs:{type:"number"}},additionalProperties:false},ExperimentationConfig:{type:"object",properties:{objective:{type:"string"},direction:{type:"string",enum:["minimize","maximize"]},tieBreak:{type:"string",const:"candidate-id"},concurrencyCap:{type:"number"},maxCandidates:{type:"number"},candidateBudget:{$ref:"#/definitions/Budget"},totalBudget:{$ref:"#/definitions/Budget"}},required:["objective","direction","tieBreak","concurrencyCap","maxCandidates","candidateBudget","totalBudget"],additionalProperties:false}};var S="#/definitions/";function m(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function x(e,t){return e==="integer"?typeof t=="number"&&Number.isInteger(t):m(t)===e}function p(e){let t=JSON.stringify(e);return t===void 0?String(e):t.length>60?`${t.slice(0,57)}...`:t}function q(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function v(e,t){return JSON.stringify(e)===JSON.stringify(t)}function d(e,t,s,n,i){return {path:e===""?"/":e,keyword:t,message:s,expected:n,found:i}}function O(e,t){e.startsWith(S)||chunkS3BXVHO7_cjs.b("invalid-input",`schema $ref ${JSON.stringify(e)} is not #/definitions/<name>`,"regenerate the schema with pnpm schema:gen");let s=e.slice(S.length),n=t.definitions&&Object.hasOwn(t.definitions,s)?t.definitions[s]:void 0;return n||chunkS3BXVHO7_cjs.b("invalid-input",`schema $ref ${JSON.stringify(e)} names no definition`,"regenerate the schema with pnpm schema:gen"),n}function I(e,t){let s=t===""?"/":t;return e.reduce((n,i)=>n+(i.keyword==="type"&&i.path===s?1e3:i.keyword==="const"?100:1),0)}function C(e){let t=e[0]?.filter(s=>s.keyword==="const")??[];for(let s of t){let n=e.map(r=>r.find(o=>o.keyword==="const"&&o.path===s.path));if(n.some(r=>r===void 0))continue;let i=[...new Set(n.map(r=>r?.expected))].join(" | ");return {path:s.path,keyword:"enum",message:`expected one of ${i}`,expected:i,found:s.found}}}function w(e,t){return f(e,t,e,"")}function f(e,t,s,n){if(e.$ref!==void 0)return f(O(e.$ref,s),t,s,n);let i=[];if(e.type!==void 0){let r=Array.isArray(e.type)?e.type:[e.type];if(!r.some(o=>x(o,t))){let o=r.join(" | ");return [d(n,"type",`expected ${o}, got ${m(t)}`,o,p(t))]}}if(e.const!==void 0&&!v(t,e.const)&&i.push(d(n,"const",`expected ${p(e.const)}`,p(e.const),p(t))),e.enum!==void 0&&!e.enum.some(r=>v(r,t))){let r=e.enum.map(p).join(" | ");i.push(d(n,"enum",`expected one of ${r}`,r,p(t)));}if(typeof t=="number"&&(e.minimum!==void 0&&t<e.minimum&&i.push(d(n,"minimum",`expected >= ${e.minimum}`,`>= ${e.minimum}`,p(t))),e.maximum!==void 0&&t>e.maximum&&i.push(d(n,"maximum",`expected <= ${e.maximum}`,`<= ${e.maximum}`,p(t)))),typeof t=="string"&&(e.minLength!==void 0&&t.length<e.minLength&&i.push(d(n,"minLength",`expected at least ${e.minLength} characters`,`length >= ${e.minLength}`,p(t))),e.pattern!==void 0&&!new RegExp(e.pattern,"u").test(t)&&i.push(d(n,"pattern",`expected to match /${e.pattern}/`,`/${e.pattern}/`,p(t)))),Array.isArray(t)&&e.items!==void 0){let r=e.items;t.forEach((o,c)=>i.push(...f(r,o,s,`${n}/${c}`)));}if(m(t)==="object"){let r=t;for(let[o,c]of Object.entries(r)){let g=e.properties&&Object.hasOwn(e.properties,o)?e.properties[o]:void 0,y=`${n}/${q(o)}`;if(g)i.push(...f(g,c,s,y));else if(e.additionalProperties===false){let b=Object.keys(e.properties??{}).join(", ");i.push(d(y,"additionalProperties",`unknown property ${JSON.stringify(o)}`,b?`one of ${b}`:"no properties",o));}else typeof e.additionalProperties=="object"&&i.push(...f(e.additionalProperties,c,s,y));}for(let o of e.required??[])Object.hasOwn(r,o)||i.push(d(`${n}/${q(o)}`,"required",`missing required property ${JSON.stringify(o)}`,"present","absent"));}if(e.anyOf!==void 0){let r,o=[];for(let g of e.anyOf){let y=f(g,t,s,n);if(y.length===0){r=[];break}o.push(y),(r===void 0||I(y,n)<I(r,n))&&(r=y);}let c=r&&r.length>0?C(o):void 0;c?i.push(c):r&&i.push(...r);}return i}function E(e,t,s){let n=w(e,t),i=n[0];if(!i)return;let r=n.length>1?` (+${n.length-1} more)`:"";chunkS3BXVHO7_cjs.b("invalid-input",`${s} does not match its schema: ${i.path} ${i.message}${r}`,`fix ${s} at ${i.path}: expected ${i.expected}, found ${i.found}`);}var N="http://json-schema.org/draft-07/schema#";function a(e,t){return {$schema:N,$ref:`#/definitions/${e}`,definitions:t}}var J=a("WorkflowState",l),M=a("Role",l),_=a("NewItem",l),D=a("ItemPatch",l),F=a("Handoff",l),L=a("ScrumConfig",h),W=a("KanbanConfig",P),G=a("WaterfallConfig",k),K=a("InvestigationConfig",$),H=a("ExperimentationConfig",j);
|
|
2
|
+
exports.a=w;exports.b=E;exports.c=N;exports.d=J;exports.e=M;exports.f=_;exports.g=D;exports.h=F;exports.i=L;exports.j=W;exports.k=G;exports.l=K;exports.m=H;//# sourceMappingURL=chunk-C2IYMWE6.cjs.map
|
|
3
|
+
//# sourceMappingURL=chunk-C2IYMWE6.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/schema/generated.ts","../src/schema/validate.ts","../src/schema/index.ts"],"names":["CORE_DEFINITIONS","SCRUM_DEFINITIONS","KANBAN_DEFINITIONS","WATERFALL_DEFINITIONS","INVESTIGATION_DEFINITIONS","EXPERIMENTATION_DEFINITIONS","DEFS","kindOf","v","isType","t","show","s","esc","key","same","a","b","err","path","keyword","message","expected","found","resolve","ref","root","fail","name","def","rank","errors","branchPath","own","e","collapse","branches","first","candidate","consts","c","validate","schema","value","walk","out","types","items","i","obj","prop","at","known","best","failed","branch","merged","assertValid","what","more","DRAFT_07","document","definitions","workflowStateSchema","roleSchema","newItemSchema","itemPatchSchema","handoffSchema","scrumConfigSchema","kanbanConfigSchema","waterfallConfigSchema","investigationConfigSchema","experimentationConfigSchema"],"mappings":"mEAIO,IAAMA,CAAAA,CAA+C,CAC1D,UAAA,CAAY,CACV,KAAM,QAAA,CACN,UAAA,CAAY,CACV,IAAA,CAAM,CACJ,IAAA,CAAM,QACR,CAAA,CACA,IAAA,CAAM,CACJ,IAAA,CAAM,QACR,CAAA,CACA,KAAA,CAAO,CACL,IAAA,CAA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iB7D,CAAgB,CAAA,CAEhEgE,CAAAA,CAAaH,CAAAA,CAAS,OAAQ7D,CAAgB,CAAA,CAE9CiE,CAAAA,CAAgBJ,CAAAA,CAAS,UAAW7D,CAAgB,CAAA,CAEpDkE,CAAAA,CAAkBL,CAAAA,CAAS,YAAa7D,CAAgB,CAAA,CAExDmE,CAAAA,CAAgBN,CAAAA,CAAS,UAAW7D,CAAgB,CAAA,CAEpDoE,CAAAA,CAAoBP,CAAAA,CAAS,cAAe5D,CAAiB,CAAA,CAC7DoE,CAAAA,CAAqBR,CAAAA,CAAS,eAAgB3D,CAAkB,CAAA,CAChEoE,CAAAA,CAAwBT,CAAAA,CAAS,kBAAmB1D,CAAqB,CAAA,CACzEoE,CAAAA,CAA4BV,CAAAA,CAAS,sBAAuBzD,CAAyB,CAAA,CACrFoE,CAAAA,CAA8BX,CAAAA,CACzC,wBACAxD,CACF","file":"chunk-C2IYMWE6.cjs","sourcesContent":["// GENERATED by scripts/gen-schema.mjs from src/types.ts and methodology config.ts files.\n// Do not edit. Run `pnpm schema:gen`; `pnpm schema:check` fails the build when this file is stale.\nimport type { JsonSchema } from \"./types.ts\";\n\nexport const CORE_DEFINITIONS: Record<string, JsonSchema> = {\n Accounting: {\n type: \"object\",\n properties: {\n item: {\n type: \"string\",\n },\n role: {\n type: \"string\",\n },\n model: {\n type: \"string\",\n },\n tokensIn: {\n type: \"number\",\n },\n tokensOut: {\n type: \"number\",\n },\n durationMs: {\n type: \"number\",\n },\n startedAt: {\n type: \"string\",\n },\n endedAt: {\n type: \"string\",\n },\n estimate: {\n type: \"boolean\",\n },\n },\n required: [\n \"item\",\n \"role\",\n \"model\",\n \"tokensIn\",\n \"tokensOut\",\n \"durationMs\",\n \"startedAt\",\n \"endedAt\",\n ],\n additionalProperties: false,\n },\n Baseline: {\n type: \"object\",\n properties: {\n phase: {\n type: \"string\",\n },\n version: {\n type: \"number\",\n },\n at: {\n type: \"string\",\n },\n approvedBy: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n itemSnapshot: {\n type: \"object\",\n additionalProperties: {\n $ref: \"#/definitions/WorkItem\",\n },\n },\n },\n required: [\"phase\", \"version\", \"at\", \"approvedBy\", \"itemSnapshot\"],\n additionalProperties: false,\n },\n BeliefUpdate: {\n type: \"object\",\n properties: {\n result: {\n type: \"string\",\n },\n assessments: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n hypothesis: {\n type: \"string\",\n },\n assessment: {\n type: \"string\",\n enum: [\"supported\", \"refuted\", \"uncertain\"],\n },\n reason: {\n type: \"string\",\n },\n },\n required: [\"hypothesis\", \"assessment\", \"reason\"],\n additionalProperties: false,\n },\n },\n },\n required: [\"result\", \"assessments\"],\n additionalProperties: false,\n },\n Blocker: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n },\n reason: {\n type: \"string\",\n },\n owner: {\n type: \"string\",\n },\n raisedAt: {\n type: \"string\",\n },\n clearedAt: {\n type: \"string\",\n },\n },\n required: [\"id\", \"reason\", \"owner\", \"raisedAt\"],\n additionalProperties: false,\n },\n Budget: {\n type: \"object\",\n properties: {\n tokens: {\n type: \"number\",\n },\n turns: {\n type: \"number\",\n },\n wallclockMs: {\n type: \"number\",\n },\n },\n additionalProperties: false,\n },\n Capability: {\n type: \"string\",\n enum: [\n \"order-backlog\",\n \"define-acceptance\",\n \"facilitate\",\n \"deliver\",\n \"review\",\n \"verify\",\n \"approve-gate\",\n \"manage-flow\",\n \"control-change\",\n \"escalate\",\n ],\n },\n ClassOfService: {\n type: \"string\",\n enum: [\"expedite\", \"fixed-date\", \"standard\", \"intangible\"],\n },\n Event: {\n type: \"object\",\n properties: {\n seq: {\n type: \"number\",\n },\n at: {\n type: \"string\",\n },\n type: {\n type: \"string\",\n },\n by: {\n type: \"string\",\n },\n payload: {},\n },\n required: [\"seq\", \"at\", \"type\", \"by\", \"payload\"],\n additionalProperties: false,\n },\n Evidence: {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n },\n ref: {\n type: \"string\",\n },\n by: {\n type: \"string\",\n },\n at: {\n type: \"string\",\n },\n },\n required: [\"kind\", \"ref\", \"by\", \"at\"],\n additionalProperties: false,\n },\n Experiment: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n },\n procedureRef: {\n type: \"string\",\n },\n predictions: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n hypothesis: {\n type: \"string\",\n },\n prediction: {\n type: \"string\",\n },\n },\n required: [\"hypothesis\", \"prediction\"],\n additionalProperties: false,\n },\n },\n replayOf: {\n type: \"string\",\n },\n },\n required: [\"id\", \"procedureRef\", \"predictions\"],\n additionalProperties: false,\n },\n ExperimentCandidate: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n },\n item: {\n type: \"string\",\n },\n author: {\n type: \"string\",\n },\n status: {\n type: \"string\",\n enum: [\n \"pending\",\n \"ready\",\n \"running\",\n \"submitted\",\n \"validated\",\n \"failed\",\n \"timed-out\",\n \"cancelled\",\n ],\n },\n workspace: {\n type: \"string\",\n },\n sha: {\n type: \"string\",\n },\n score: {\n type: \"number\",\n },\n spent: {\n $ref: \"#/definitions/Spent\",\n },\n validation: {\n type: \"object\",\n properties: {\n sha: {\n type: \"string\",\n },\n harness: {\n type: \"string\",\n },\n by: {\n type: \"string\",\n },\n passed: {\n type: \"boolean\",\n },\n reproducible: {\n type: \"boolean\",\n },\n evidence: {\n type: \"string\",\n },\n },\n required: [\"sha\", \"harness\", \"by\", \"passed\", \"reproducible\", \"evidence\"],\n additionalProperties: false,\n },\n reason: {\n type: \"string\",\n },\n command: {\n type: \"string\",\n },\n log: {\n type: \"string\",\n },\n terminalLog: {\n type: \"string\",\n },\n },\n required: [\"id\", \"item\", \"author\", \"status\", \"spent\"],\n additionalProperties: false,\n },\n ExperimentationState: {\n type: \"object\",\n properties: {\n status: {\n type: \"string\",\n enum: [\"running\", \"selected\", \"integrating\", \"integrated\", \"stopped\"],\n },\n baseSha: {\n type: \"string\",\n },\n harness: {\n type: \"string\",\n },\n candidates: {\n type: \"object\",\n additionalProperties: {\n $ref: \"#/definitions/ExperimentCandidate\",\n },\n },\n selected: {\n type: \"string\",\n },\n reason: {\n type: \"string\",\n },\n integration: {\n type: \"object\",\n properties: {\n selectedSha: {\n type: \"string\",\n },\n targetSha: {\n type: \"string\",\n },\n sha: {\n type: \"string\",\n },\n by: {\n type: \"string\",\n },\n validation: {\n type: \"object\",\n properties: {\n by: {\n type: \"string\",\n },\n sha: {\n type: \"string\",\n },\n harness: {\n type: \"string\",\n },\n evidence: {\n type: \"string\",\n },\n passed: {\n type: \"boolean\",\n },\n },\n required: [\"by\", \"sha\", \"harness\", \"evidence\", \"passed\"],\n additionalProperties: false,\n },\n },\n required: [\"selectedSha\", \"targetSha\", \"sha\", \"by\"],\n additionalProperties: false,\n },\n released: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n overhead: {\n $ref: \"#/definitions/Spent\",\n },\n },\n required: [\"status\", \"baseSha\", \"harness\", \"candidates\", \"released\", \"overhead\"],\n additionalProperties: false,\n },\n Gate: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n },\n requires: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/GateRequirement\",\n },\n },\n evidence: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n onFail: {\n anyOf: [\n {\n type: \"object\",\n properties: {\n action: {\n type: \"string\",\n const: \"block\",\n },\n },\n required: [\"action\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n action: {\n type: \"string\",\n const: \"return-to\",\n },\n stage: {\n type: \"string\",\n },\n },\n required: [\"action\", \"stage\"],\n additionalProperties: false,\n },\n ],\n },\n },\n required: [\"id\", \"requires\", \"evidence\", \"onFail\"],\n additionalProperties: false,\n },\n GateRequirement: {\n anyOf: [\n {\n type: \"string\",\n const: \"human\",\n },\n {\n type: \"object\",\n properties: {\n capability: {\n type: \"string\",\n },\n },\n required: [\"capability\"],\n additionalProperties: false,\n },\n ],\n },\n Handoff: {\n type: \"object\",\n properties: {\n item: {\n type: \"string\",\n },\n role: {\n type: \"string\",\n },\n produced: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n },\n ref: {\n type: \"string\",\n },\n },\n required: [\"kind\", \"ref\"],\n additionalProperties: false,\n },\n },\n notes: {\n type: \"string\",\n },\n do_not: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n open_questions: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n verdict: {\n $ref: \"#/definitions/Verdict\",\n },\n follow_ups: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/NewItem\",\n },\n },\n lessons: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n text: {\n type: \"string\",\n },\n scope: {\n type: \"string\",\n enum: [\"policy\", \"skill\", \"memory\", \"spec\", \"review\"],\n },\n },\n required: [\"text\", \"scope\"],\n additionalProperties: false,\n },\n },\n },\n required: [\"item\", \"role\", \"produced\", \"notes\", \"do_not\", \"open_questions\"],\n additionalProperties: false,\n },\n Hypothesis: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n },\n claim: {\n type: \"string\",\n },\n falsifiedBy: {\n type: \"string\",\n },\n },\n required: [\"id\", \"claim\", \"falsifiedBy\"],\n additionalProperties: false,\n },\n ImpactAnalysis: {\n type: \"object\",\n properties: {\n summary: {\n type: \"string\",\n },\n reopen: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n weight: {\n type: \"number\",\n },\n },\n required: [\"summary\", \"reopen\", \"weight\"],\n additionalProperties: false,\n },\n InvestigationConclusion: {\n type: \"object\",\n properties: {\n outcome: {\n type: \"string\",\n enum: [\"resolved\", \"inconclusive\"],\n },\n summary: {\n type: \"string\",\n },\n supportedHypothesis: {\n type: \"string\",\n },\n evidenceRefs: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n by: {\n type: \"string\",\n },\n },\n required: [\"outcome\", \"summary\", \"evidenceRefs\", \"by\"],\n additionalProperties: false,\n },\n InvestigationRound: {\n type: \"object\",\n properties: {\n hypotheses: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Hypothesis\",\n },\n },\n experiment: {\n $ref: \"#/definitions/Experiment\",\n },\n item: {\n type: \"string\",\n },\n by: {\n type: \"string\",\n },\n result: {\n $ref: \"#/definitions/Observation\",\n },\n update: {\n $ref: \"#/definitions/BeliefUpdate\",\n },\n },\n required: [\"hypotheses\", \"experiment\", \"item\", \"by\"],\n additionalProperties: false,\n },\n InvestigationState: {\n type: \"object\",\n properties: {\n item: {\n type: \"string\",\n },\n phase: {\n type: \"string\",\n enum: [\n \"hypotheses\",\n \"preregister\",\n \"observe\",\n \"update-belief\",\n \"conclusion\",\n \"review\",\n \"closed\",\n ],\n },\n hypotheses: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Hypothesis\",\n },\n },\n singleHypothesisRationale: {\n type: \"string\",\n },\n rounds: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/InvestigationRound\",\n },\n },\n conclusion: {\n $ref: \"#/definitions/InvestigationConclusion\",\n },\n outcome: {\n type: \"string\",\n enum: [\"resolved\", \"inconclusive\", \"stopped\"],\n },\n stopReason: {\n type: \"string\",\n },\n contributors: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n reviewHistory: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n by: {\n type: \"string\",\n },\n reason: {\n type: \"string\",\n },\n approve: {\n type: \"boolean\",\n },\n next: {\n type: \"string\",\n enum: [\"round\", \"conclusion\"],\n },\n replayRefs: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n },\n required: [\"by\", \"reason\", \"approve\", \"replayRefs\"],\n additionalProperties: false,\n },\n },\n review: {\n type: \"object\",\n properties: {\n by: {\n type: \"string\",\n },\n reason: {\n type: \"string\",\n },\n replayRefs: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n },\n required: [\"by\", \"reason\", \"replayRefs\"],\n additionalProperties: false,\n },\n },\n required: [\"item\", \"phase\", \"hypotheses\", \"rounds\", \"contributors\"],\n additionalProperties: false,\n },\n ItemPatch: {\n type: \"object\",\n properties: {\n type: {\n $ref: \"#/definitions/ItemType\",\n },\n title: {\n type: \"string\",\n },\n description: {\n type: \"string\",\n },\n dependsOn: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n priority: {\n type: \"number\",\n },\n weight: {\n type: \"number\",\n },\n deadline: {\n type: \"string\",\n },\n classOfService: {\n $ref: \"#/definitions/ClassOfService\",\n },\n role: {\n type: \"string\",\n },\n parent: {\n type: \"string\",\n },\n acceptance: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n iteration: {\n type: \"string\",\n },\n traces: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n tags: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n affects: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n phase: {\n type: \"string\",\n },\n impactAnalysis: {\n $ref: \"#/definitions/ImpactAnalysis\",\n },\n },\n additionalProperties: false,\n },\n ItemStatus: {\n type: \"string\",\n enum: [\"todo\", \"in_progress\", \"blocked\", \"review\", \"awaiting_human\", \"done\", \"dropped\"],\n },\n ItemType: {\n type: \"string\",\n enum: [\"epic\", \"story\", \"task\", \"bug\", \"change-request\", \"deliverable\", \"question\"],\n },\n Iteration: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n },\n goal: {\n type: \"string\",\n },\n budget: {\n $ref: \"#/definitions/Budget\",\n },\n spent: {\n $ref: \"#/definitions/Spent\",\n },\n startedAt: {\n type: \"string\",\n },\n endedAt: {\n type: \"string\",\n },\n committed: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n carryover: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n outcome: {\n type: \"string\",\n enum: [\"completed\", \"cancelled\"],\n },\n closing: {\n type: \"boolean\",\n },\n },\n required: [\"id\", \"goal\", \"budget\", \"spent\", \"startedAt\", \"committed\", \"carryover\"],\n additionalProperties: false,\n },\n Lesson: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n },\n at: {\n type: \"string\",\n },\n text: {\n type: \"string\",\n },\n scope: {\n type: \"string\",\n enum: [\"policy\", \"skill\", \"memory\", \"spec\", \"review\"],\n },\n status: {\n type: \"string\",\n enum: [\"raised\", \"adopted\", \"dismissed\"],\n },\n from: {\n type: \"string\",\n },\n item: {\n type: \"string\",\n },\n suggestedChange: {\n $ref: \"#/definitions/LessonChange\",\n },\n },\n required: [\"id\", \"at\", \"text\", \"scope\", \"status\"],\n additionalProperties: false,\n },\n LessonChange: {\n anyOf: [\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"agreement\",\n },\n text: {\n type: \"string\",\n },\n replaces: {\n type: \"string\",\n },\n },\n required: [\"kind\", \"text\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"dod\",\n },\n policy: {\n $ref: \"#/definitions/Policy\",\n },\n },\n required: [\"kind\", \"policy\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"backlog\",\n },\n item: {\n $ref: \"#/definitions/NewItem\",\n },\n },\n required: [\"kind\", \"item\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"skill\",\n },\n note: {\n type: \"string\",\n },\n },\n required: [\"kind\", \"note\"],\n additionalProperties: false,\n },\n ],\n },\n MethodologyName: {\n type: \"string\",\n enum: [\"scrum\", \"kanban\", \"waterfall\", \"investigation\", \"experimentation\"],\n },\n ModelTier: {\n type: \"string\",\n enum: [\"small\", \"medium\", \"large\"],\n },\n NewItem: {\n type: \"object\",\n additionalProperties: false,\n properties: {\n stage: {\n type: \"string\",\n },\n type: {\n $ref: \"#/definitions/ItemType\",\n },\n description: {\n type: \"string\",\n },\n dependsOn: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n priority: {\n type: \"number\",\n },\n weight: {\n type: \"number\",\n },\n deadline: {\n type: \"string\",\n },\n classOfService: {\n $ref: \"#/definitions/ClassOfService\",\n },\n role: {\n type: \"string\",\n },\n parent: {\n type: \"string\",\n },\n acceptance: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n iteration: {\n type: \"string\",\n },\n traces: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n tags: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n affects: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n phase: {\n type: \"string\",\n },\n impactAnalysis: {\n $ref: \"#/definitions/ImpactAnalysis\",\n },\n id: {\n type: \"string\",\n },\n title: {\n type: \"string\",\n },\n },\n required: [\"id\", \"title\"],\n },\n Observation: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n },\n valid: {\n type: \"boolean\",\n },\n summary: {\n type: \"string\",\n },\n provenanceRefs: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n },\n required: [\"id\", \"valid\", \"summary\", \"provenanceRefs\"],\n additionalProperties: false,\n },\n PendingHuman: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n },\n kind: {\n type: \"string\",\n enum: [\"gate\", \"decision\"],\n },\n item: {\n type: \"string\",\n },\n gate: {\n type: \"string\",\n },\n question: {\n type: \"string\",\n },\n raisedAt: {\n type: \"string\",\n },\n },\n required: [\"id\", \"kind\", \"question\", \"raisedAt\"],\n additionalProperties: false,\n },\n Phase: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n },\n name: {\n type: \"string\",\n },\n deliverables: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n gate: {\n $ref: \"#/definitions/Gate\",\n },\n status: {\n type: \"string\",\n enum: [\"pending\", \"open\", \"baselined\", \"reopened\"],\n },\n budget: {\n $ref: \"#/definitions/Budget\",\n },\n produced: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Produced\",\n },\n },\n },\n required: [\"id\", \"name\", \"deliverables\", \"gate\", \"status\"],\n additionalProperties: false,\n },\n Policy: {\n anyOf: [\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"evidence\",\n },\n evidenceKind: {\n type: \"string\",\n },\n },\n required: [\"kind\", \"evidenceKind\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"acceptance-written\",\n },\n },\n required: [\"kind\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"estimate-present\",\n },\n },\n required: [\"kind\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"no-open-blockers\",\n },\n },\n required: [\"kind\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"dependencies-done\",\n },\n },\n required: [\"kind\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"custom\",\n },\n id: {\n type: \"string\",\n },\n description: {\n type: \"string\",\n },\n },\n required: [\"kind\", \"id\", \"description\"],\n additionalProperties: false,\n },\n ],\n },\n Produced: {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n },\n ref: {\n type: \"string\",\n },\n by: {\n type: \"string\",\n },\n at: {\n type: \"string\",\n },\n },\n required: [\"kind\", \"ref\", \"by\", \"at\"],\n additionalProperties: false,\n },\n Role: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n },\n name: {\n type: \"string\",\n },\n modelTier: {\n $ref: \"#/definitions/ModelTier\",\n },\n resourceClass: {\n type: \"string\",\n },\n maxConcurrent: {\n type: \"number\",\n },\n capabilities: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Capability\",\n },\n },\n canApprove: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n inputs: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n outputs: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n do_not: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n constraints: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n },\n required: [\n \"id\",\n \"name\",\n \"modelTier\",\n \"capabilities\",\n \"canApprove\",\n \"inputs\",\n \"outputs\",\n \"do_not\",\n ],\n additionalProperties: false,\n },\n Spent: {\n type: \"object\",\n properties: {\n tokens: {\n type: \"number\",\n },\n turns: {\n type: \"number\",\n },\n wallclockMs: {\n type: \"number\",\n },\n },\n required: [\"tokens\", \"turns\", \"wallclockMs\"],\n additionalProperties: false,\n },\n Stage: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n },\n name: {\n type: \"string\",\n },\n wipLimit: {\n type: \"number\",\n },\n entryPolicy: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Policy\",\n },\n },\n exitPolicy: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Policy\",\n },\n },\n gate: {\n $ref: \"#/definitions/Gate\",\n },\n commitmentPoint: {\n type: \"boolean\",\n },\n deliveryPoint: {\n type: \"boolean\",\n },\n review: {\n type: \"boolean\",\n },\n },\n required: [\"id\", \"name\", \"entryPolicy\", \"exitPolicy\"],\n additionalProperties: false,\n },\n Transition: {\n type: \"object\",\n properties: {\n from: {\n type: \"object\",\n properties: {\n stage: {\n type: \"string\",\n },\n status: {\n $ref: \"#/definitions/ItemStatus\",\n },\n },\n required: [\"stage\", \"status\"],\n additionalProperties: false,\n },\n to: {\n type: \"object\",\n properties: {\n stage: {\n type: \"string\",\n },\n status: {\n $ref: \"#/definitions/ItemStatus\",\n },\n },\n required: [\"stage\", \"status\"],\n additionalProperties: false,\n },\n at: {\n type: \"string\",\n },\n by: {\n type: \"string\",\n },\n },\n required: [\"from\", \"to\", \"at\", \"by\"],\n additionalProperties: false,\n },\n Verdict: {\n type: \"string\",\n enum: [\"done\", \"blocked\", \"needs-review\", \"rework\", \"escalate\"],\n },\n WorkItem: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n },\n type: {\n $ref: \"#/definitions/ItemType\",\n },\n title: {\n type: \"string\",\n },\n description: {\n type: \"string\",\n },\n dependsOn: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n priority: {\n type: \"number\",\n },\n weight: {\n type: \"number\",\n },\n deadline: {\n type: \"string\",\n },\n classOfService: {\n $ref: \"#/definitions/ClassOfService\",\n },\n stage: {\n type: \"string\",\n },\n status: {\n $ref: \"#/definitions/ItemStatus\",\n },\n role: {\n type: \"string\",\n },\n parent: {\n type: \"string\",\n },\n acceptance: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n evidence: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Evidence\",\n },\n },\n blockers: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Blocker\",\n },\n },\n transitions: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Transition\",\n },\n },\n iteration: {\n type: \"string\",\n },\n traces: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n tags: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n affects: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n phase: {\n type: \"string\",\n },\n impactAnalysis: {\n $ref: \"#/definitions/ImpactAnalysis\",\n },\n },\n required: [\n \"id\",\n \"type\",\n \"title\",\n \"dependsOn\",\n \"stage\",\n \"status\",\n \"acceptance\",\n \"evidence\",\n \"blockers\",\n \"transitions\",\n ],\n additionalProperties: false,\n },\n WorkflowState: {\n type: \"object\",\n properties: {\n version: {\n type: \"number\",\n const: 1,\n },\n methodology: {\n $ref: \"#/definitions/MethodologyName\",\n },\n config: {},\n investigation: {\n $ref: \"#/definitions/InvestigationState\",\n },\n experimentation: {\n $ref: \"#/definitions/ExperimentationState\",\n },\n items: {\n type: \"object\",\n additionalProperties: {\n $ref: \"#/definitions/WorkItem\",\n },\n },\n stages: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Stage\",\n },\n },\n roles: {\n type: \"object\",\n additionalProperties: {\n $ref: \"#/definitions/Role\",\n },\n },\n iterations: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Iteration\",\n },\n },\n phases: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Phase\",\n },\n },\n baseline: {\n $ref: \"#/definitions/Baseline\",\n },\n baselines: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Baseline\",\n },\n },\n events: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Event\",\n },\n },\n accounting: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Accounting\",\n },\n },\n pending: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/PendingHuman\",\n },\n },\n lessons: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Lesson\",\n },\n },\n agreements: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n },\n required: [\n \"version\",\n \"methodology\",\n \"config\",\n \"items\",\n \"stages\",\n \"roles\",\n \"iterations\",\n \"events\",\n \"accounting\",\n \"pending\",\n \"lessons\",\n \"agreements\",\n ],\n additionalProperties: false,\n },\n};\n\nexport const SCRUM_DEFINITIONS: Record<string, JsonSchema> = {\n Budget: {\n type: \"object\",\n properties: {\n tokens: {\n type: \"number\",\n },\n turns: {\n type: \"number\",\n },\n wallclockMs: {\n type: \"number\",\n },\n },\n additionalProperties: false,\n },\n EstimateMode: {\n type: \"string\",\n enum: [\"per-weight\", \"per-call\"],\n },\n Policy: {\n anyOf: [\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"evidence\",\n },\n evidenceKind: {\n type: \"string\",\n },\n },\n required: [\"kind\", \"evidenceKind\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"acceptance-written\",\n },\n },\n required: [\"kind\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"estimate-present\",\n },\n },\n required: [\"kind\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"no-open-blockers\",\n },\n },\n required: [\"kind\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"dependencies-done\",\n },\n },\n required: [\"kind\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"custom\",\n },\n id: {\n type: \"string\",\n },\n description: {\n type: \"string\",\n },\n },\n required: [\"kind\", \"id\", \"description\"],\n additionalProperties: false,\n },\n ],\n },\n ScrumConfig: {\n type: \"object\",\n properties: {\n sprintBudget: {\n $ref: \"#/definitions/Budget\",\n },\n productGoal: {\n type: \"string\",\n },\n definitionOfDone: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Policy\",\n },\n },\n refinementSharePct: {\n type: \"number\",\n },\n allowMidSprintAdd: {\n type: \"string\",\n enum: [\"never\", \"po-only\", \"any\"],\n },\n inProgressWipLimit: {\n type: \"number\",\n },\n autoClose: {\n type: \"boolean\",\n },\n estimateMode: {\n $ref: \"#/definitions/EstimateMode\",\n },\n fallbackTokensPerWeight: {\n type: \"number\",\n },\n },\n required: [\n \"sprintBudget\",\n \"productGoal\",\n \"definitionOfDone\",\n \"refinementSharePct\",\n \"allowMidSprintAdd\",\n ],\n additionalProperties: false,\n },\n};\n\nexport const KANBAN_DEFINITIONS: Record<string, JsonSchema> = {\n ClassConfig: {\n type: \"object\",\n properties: {\n wipBypass: {\n type: \"number\",\n },\n sle: {\n $ref: \"#/definitions/ServiceLevel\",\n },\n },\n additionalProperties: false,\n },\n KanbanColumn: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n },\n name: {\n type: \"string\",\n },\n wipLimit: {\n type: \"number\",\n },\n policies: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Policy\",\n },\n },\n commitmentPoint: {\n type: \"boolean\",\n },\n deliveryPoint: {\n type: \"boolean\",\n },\n review: {\n type: \"boolean\",\n },\n },\n required: [\"id\", \"name\", \"policies\"],\n additionalProperties: false,\n },\n KanbanConfig: {\n type: \"object\",\n properties: {\n columns: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/KanbanColumn\",\n },\n },\n classesOfService: {\n type: \"object\",\n properties: {\n expedite: {\n $ref: \"#/definitions/ClassConfig\",\n },\n \"fixed-date\": {\n $ref: \"#/definitions/ClassConfig\",\n },\n standard: {\n $ref: \"#/definitions/ClassConfig\",\n },\n intangible: {\n $ref: \"#/definitions/ClassConfig\",\n },\n },\n additionalProperties: false,\n },\n fairness: {\n type: \"object\",\n properties: {\n aging: {\n type: \"boolean\",\n },\n maxDeferralRounds: {\n type: \"number\",\n },\n },\n required: [\"aging\", \"maxDeferralRounds\"],\n additionalProperties: false,\n },\n cadences: {\n type: \"object\",\n properties: {\n replenishment: {\n type: \"object\",\n properties: {\n everyTurns: {\n type: \"number\",\n },\n },\n additionalProperties: false,\n },\n \"delivery-planning\": {\n type: \"object\",\n properties: {\n everyTurns: {\n type: \"number\",\n },\n },\n additionalProperties: false,\n },\n \"service-delivery-review\": {\n type: \"object\",\n properties: {\n everyTurns: {\n type: \"number\",\n },\n },\n additionalProperties: false,\n },\n \"operations-review\": {\n type: \"object\",\n properties: {\n everyTurns: {\n type: \"number\",\n },\n },\n additionalProperties: false,\n },\n \"risk-review\": {\n type: \"object\",\n properties: {\n everyTurns: {\n type: \"number\",\n },\n },\n additionalProperties: false,\n },\n \"strategy-review\": {\n type: \"object\",\n properties: {\n everyTurns: {\n type: \"number\",\n },\n },\n additionalProperties: false,\n },\n },\n additionalProperties: false,\n },\n throughputWindowMs: {\n type: \"number\",\n },\n maxExpedite: {\n type: \"number\",\n },\n },\n required: [\n \"columns\",\n \"classesOfService\",\n \"fairness\",\n \"cadences\",\n \"throughputWindowMs\",\n \"maxExpedite\",\n ],\n additionalProperties: false,\n },\n Policy: {\n anyOf: [\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"evidence\",\n },\n evidenceKind: {\n type: \"string\",\n },\n },\n required: [\"kind\", \"evidenceKind\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"acceptance-written\",\n },\n },\n required: [\"kind\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"estimate-present\",\n },\n },\n required: [\"kind\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"no-open-blockers\",\n },\n },\n required: [\"kind\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"dependencies-done\",\n },\n },\n required: [\"kind\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"custom\",\n },\n id: {\n type: \"string\",\n },\n description: {\n type: \"string\",\n },\n },\n required: [\"kind\", \"id\", \"description\"],\n additionalProperties: false,\n },\n ],\n },\n ServiceLevel: {\n type: \"object\",\n properties: {\n percentile: {\n type: \"number\",\n },\n targetMs: {\n type: \"number\",\n },\n },\n required: [\"percentile\", \"targetMs\"],\n additionalProperties: false,\n },\n};\n\nexport const WATERFALL_DEFINITIONS: Record<string, JsonSchema> = {\n Budget: {\n type: \"object\",\n properties: {\n tokens: {\n type: \"number\",\n },\n turns: {\n type: \"number\",\n },\n wallclockMs: {\n type: \"number\",\n },\n },\n additionalProperties: false,\n },\n Gate: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n },\n requires: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/GateRequirement\",\n },\n },\n evidence: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n onFail: {\n anyOf: [\n {\n type: \"object\",\n properties: {\n action: {\n type: \"string\",\n const: \"block\",\n },\n },\n required: [\"action\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n action: {\n type: \"string\",\n const: \"return-to\",\n },\n stage: {\n type: \"string\",\n },\n },\n required: [\"action\", \"stage\"],\n additionalProperties: false,\n },\n ],\n },\n },\n required: [\"id\", \"requires\", \"evidence\", \"onFail\"],\n additionalProperties: false,\n },\n GateRequirement: {\n anyOf: [\n {\n type: \"string\",\n const: \"human\",\n },\n {\n type: \"object\",\n properties: {\n capability: {\n type: \"string\",\n },\n },\n required: [\"capability\"],\n additionalProperties: false,\n },\n ],\n },\n WaterfallConfig: {\n type: \"object\",\n properties: {\n phases: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/WaterfallPhaseConfig\",\n },\n },\n changeControl: {\n type: \"object\",\n properties: {\n requiresImpactAnalysis: {\n type: \"boolean\",\n },\n approvers: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/GateRequirement\",\n },\n },\n },\n required: [\"requiresImpactAnalysis\", \"approvers\"],\n additionalProperties: false,\n },\n traceability: {\n type: \"object\",\n properties: {\n from: {\n type: \"string\",\n },\n to: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n },\n required: [\"from\", \"to\"],\n additionalProperties: false,\n },\n humanGates: {\n anyOf: [\n {\n type: \"string\",\n const: \"all\",\n },\n {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n ],\n },\n fallbackTokensPerWeight: {\n type: \"number\",\n },\n },\n required: [\"phases\", \"changeControl\", \"traceability\", \"humanGates\"],\n additionalProperties: false,\n },\n WaterfallPhaseConfig: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n },\n name: {\n type: \"string\",\n },\n deliverables: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n gate: {\n $ref: \"#/definitions/Gate\",\n },\n budget: {\n $ref: \"#/definitions/Budget\",\n },\n deliverBy: {\n type: \"string\",\n },\n },\n required: [\"id\", \"name\", \"deliverables\", \"gate\"],\n additionalProperties: false,\n },\n};\n\nexport const INVESTIGATION_DEFINITIONS: Record<string, JsonSchema> = {\n Budget: {\n type: \"object\",\n properties: {\n tokens: {\n type: \"number\",\n },\n turns: {\n type: \"number\",\n },\n wallclockMs: {\n type: \"number\",\n },\n },\n additionalProperties: false,\n },\n InvestigationConfig: {\n type: \"object\",\n properties: {\n question: {\n type: \"string\",\n },\n maxRounds: {\n type: \"number\",\n },\n budget: {\n $ref: \"#/definitions/Budget\",\n },\n },\n required: [\"question\", \"maxRounds\", \"budget\"],\n additionalProperties: false,\n },\n};\n\nexport const EXPERIMENTATION_DEFINITIONS: Record<string, JsonSchema> = {\n Budget: {\n type: \"object\",\n properties: {\n tokens: {\n type: \"number\",\n },\n turns: {\n type: \"number\",\n },\n wallclockMs: {\n type: \"number\",\n },\n },\n additionalProperties: false,\n },\n ExperimentationConfig: {\n type: \"object\",\n properties: {\n objective: {\n type: \"string\",\n },\n direction: {\n type: \"string\",\n enum: [\"minimize\", \"maximize\"],\n },\n tieBreak: {\n type: \"string\",\n const: \"candidate-id\",\n },\n concurrencyCap: {\n type: \"number\",\n },\n maxCandidates: {\n type: \"number\",\n },\n candidateBudget: {\n $ref: \"#/definitions/Budget\",\n },\n totalBudget: {\n $ref: \"#/definitions/Budget\",\n },\n },\n required: [\n \"objective\",\n \"direction\",\n \"tieBreak\",\n \"concurrencyCap\",\n \"maxCandidates\",\n \"candidateBudget\",\n \"totalBudget\",\n ],\n additionalProperties: false,\n },\n};\n","import { fail } from \"../errors.ts\";\nimport type { JsonSchema, SchemaError } from \"./types.ts\";\n\nconst DEFS = \"#/definitions/\";\n\nfunction kindOf(v: unknown): string {\n if (v === null) return \"null\";\n if (Array.isArray(v)) return \"array\";\n return typeof v;\n}\nfunction isType(t: string, v: unknown): boolean {\n if (t === \"integer\") return typeof v === \"number\" && Number.isInteger(v);\n return kindOf(v) === t;\n}\nfunction show(v: unknown): string {\n const s = JSON.stringify(v);\n if (s === undefined) return String(v);\n return s.length > 60 ? `${s.slice(0, 57)}...` : s;\n}\n/** JSON-pointer escaping for one key. */\nfunction esc(key: string): string {\n return key.replace(/~/g, \"~0\").replace(/\\//g, \"~1\");\n}\nfunction same(a: unknown, b: unknown): boolean {\n return JSON.stringify(a) === JSON.stringify(b);\n}\nfunction err(\n path: string,\n keyword: string,\n message: string,\n expected: string,\n found: string,\n): SchemaError {\n return { path: path === \"\" ? \"/\" : path, keyword, message, expected, found };\n}\n\nfunction resolve(ref: string, root: JsonSchema): JsonSchema {\n if (!ref.startsWith(DEFS))\n fail(\n \"invalid-input\",\n `schema $ref ${JSON.stringify(ref)} is not #/definitions/<name>`,\n \"regenerate the schema with pnpm schema:gen\",\n );\n const name = ref.slice(DEFS.length);\n const def =\n root.definitions && Object.hasOwn(root.definitions, name) ? root.definitions[name] : undefined;\n if (!def)\n fail(\n \"invalid-input\",\n `schema $ref ${JSON.stringify(ref)} names no definition`,\n \"regenerate the schema with pnpm schema:gen\",\n );\n return def;\n}\n\n/**\n * Misfit of one anyOf branch (lower is a better fit): a `type` error at the branch's own path (the value is the\n * wrong kind entirely) weighs 1000, a `const` mismatch (a discriminator) 100, anything else 1.\n */\nfunction rank(errors: SchemaError[], branchPath: string): number {\n const own = branchPath === \"\" ? \"/\" : branchPath;\n return errors.reduce(\n (n, e) => n + (e.keyword === \"type\" && e.path === own ? 1000 : e.keyword === \"const\" ? 100 : 1),\n 0,\n );\n}\n\n/** When every failed branch has a `const` error at one pointer (the discriminator), report that once as an enum. */\nfunction collapse(branches: SchemaError[][]): SchemaError | undefined {\n const first = branches[0]?.filter((e) => e.keyword === \"const\") ?? [];\n for (const candidate of first) {\n const consts = branches.map((b) =>\n b.find((e) => e.keyword === \"const\" && e.path === candidate.path),\n );\n if (consts.some((c) => c === undefined)) continue;\n const expected = [...new Set(consts.map((c) => c?.expected))].join(\" | \");\n return {\n path: candidate.path,\n keyword: \"enum\",\n message: `expected one of ${expected}`,\n expected,\n found: candidate.found,\n };\n }\n return undefined;\n}\n\n/** Validate `value` against `schema` (a document: `$ref`s resolve against its `definitions`). Returns every error found. */\nexport function validate(schema: JsonSchema, value: unknown): SchemaError[] {\n return walk(schema, value, schema, \"\");\n}\n\nfunction walk(schema: JsonSchema, value: unknown, root: JsonSchema, path: string): SchemaError[] {\n if (schema.$ref !== undefined) return walk(resolve(schema.$ref, root), value, root, path);\n const out: SchemaError[] = [];\n if (schema.type !== undefined) {\n const types = Array.isArray(schema.type) ? schema.type : [schema.type];\n if (!types.some((t) => isType(t, value))) {\n const expected = types.join(\" | \");\n return [\n err(path, \"type\", `expected ${expected}, got ${kindOf(value)}`, expected, show(value)),\n ];\n }\n }\n if (schema.const !== undefined && !same(value, schema.const))\n out.push(err(path, \"const\", `expected ${show(schema.const)}`, show(schema.const), show(value)));\n if (schema.enum !== undefined && !schema.enum.some((e) => same(e, value))) {\n const expected = schema.enum.map(show).join(\" | \");\n out.push(err(path, \"enum\", `expected one of ${expected}`, expected, show(value)));\n }\n if (typeof value === \"number\") {\n if (schema.minimum !== undefined && value < schema.minimum)\n out.push(\n err(path, \"minimum\", `expected >= ${schema.minimum}`, `>= ${schema.minimum}`, show(value)),\n );\n if (schema.maximum !== undefined && value > schema.maximum)\n out.push(\n err(path, \"maximum\", `expected <= ${schema.maximum}`, `<= ${schema.maximum}`, show(value)),\n );\n }\n if (typeof value === \"string\") {\n if (schema.minLength !== undefined && value.length < schema.minLength)\n out.push(\n err(\n path,\n \"minLength\",\n `expected at least ${schema.minLength} characters`,\n `length >= ${schema.minLength}`,\n show(value),\n ),\n );\n if (schema.pattern !== undefined && !new RegExp(schema.pattern, \"u\").test(value))\n out.push(\n err(\n path,\n \"pattern\",\n `expected to match /${schema.pattern}/`,\n `/${schema.pattern}/`,\n show(value),\n ),\n );\n }\n if (Array.isArray(value) && schema.items !== undefined) {\n const items = schema.items;\n value.forEach((v, i) => out.push(...walk(items, v, root, `${path}/${i}`)));\n }\n if (kindOf(value) === \"object\") {\n const obj = value as Record<string, unknown>;\n for (const [key, v] of Object.entries(obj)) {\n const prop =\n schema.properties && Object.hasOwn(schema.properties, key)\n ? schema.properties[key]\n : undefined;\n const at = `${path}/${esc(key)}`;\n if (prop) out.push(...walk(prop, v, root, at));\n else if (schema.additionalProperties === false) {\n const known = Object.keys(schema.properties ?? {}).join(\", \");\n out.push(\n err(\n at,\n \"additionalProperties\",\n `unknown property ${JSON.stringify(key)}`,\n known ? `one of ${known}` : \"no properties\",\n key,\n ),\n );\n } else if (typeof schema.additionalProperties === \"object\")\n out.push(...walk(schema.additionalProperties, v, root, at));\n }\n for (const key of schema.required ?? [])\n if (!Object.hasOwn(obj, key))\n out.push(\n err(\n `${path}/${esc(key)}`,\n \"required\",\n `missing required property ${JSON.stringify(key)}`,\n \"present\",\n \"absent\",\n ),\n );\n }\n if (schema.anyOf !== undefined) {\n let best: SchemaError[] | undefined;\n const failed: SchemaError[][] = [];\n for (const branch of schema.anyOf) {\n const errors = walk(branch, value, root, path);\n if (errors.length === 0) {\n best = [];\n break;\n }\n failed.push(errors);\n if (best === undefined || rank(errors, path) < rank(best, path)) best = errors;\n }\n const merged = best && best.length > 0 ? collapse(failed) : undefined;\n if (merged) out.push(merged);\n else if (best) out.push(...best);\n }\n return out;\n}\n\n/** Throw WorkflowError(\"invalid-input\") describing the first problem when `value` does not match `schema`. */\nexport function assertValid(schema: JsonSchema, value: unknown, what: string): void {\n const errors = validate(schema, value);\n const first = errors[0];\n if (!first) return;\n const more = errors.length > 1 ? ` (+${errors.length - 1} more)` : \"\";\n fail(\n \"invalid-input\",\n `${what} does not match its schema: ${first.path} ${first.message}${more}`,\n `fix ${what} at ${first.path}: expected ${first.expected}, found ${first.found}`,\n );\n}\n","import {\n CORE_DEFINITIONS,\n KANBAN_DEFINITIONS,\n SCRUM_DEFINITIONS,\n WATERFALL_DEFINITIONS,\n INVESTIGATION_DEFINITIONS,\n EXPERIMENTATION_DEFINITIONS,\n} from \"./generated.ts\";\nimport type { JsonSchema, JsonSchemaDocument } from \"./types.ts\";\n\nexport const DRAFT_07 = \"http://json-schema.org/draft-07/schema#\";\n\nfunction document(name: string, definitions: Record<string, JsonSchema>): JsonSchemaDocument {\n return { $schema: DRAFT_07, $ref: `#/definitions/${name}`, definitions };\n}\n\n/** `.workflow/state.json` */\nexport const workflowStateSchema = document(\"WorkflowState\", CORE_DEFINITIONS);\n/** a role manifest (`.workflow/roles/*.json`, `exwf role add`) */\nexport const roleSchema = document(\"Role\", CORE_DEFINITIONS);\n/** `exwf add <item.json>` */\nexport const newItemSchema = document(\"NewItem\", CORE_DEFINITIONS);\n/** `exwf edit <id> <patch.json>` */\nexport const itemPatchSchema = document(\"ItemPatch\", CORE_DEFINITIONS);\n/** `exwf complete <id> <handoff.json>` */\nexport const handoffSchema = document(\"Handoff\", CORE_DEFINITIONS);\n/** `exwf init scrum --config` / the scrum-master policy.json */\nexport const scrumConfigSchema = document(\"ScrumConfig\", SCRUM_DEFINITIONS);\nexport const kanbanConfigSchema = document(\"KanbanConfig\", KANBAN_DEFINITIONS);\nexport const waterfallConfigSchema = document(\"WaterfallConfig\", WATERFALL_DEFINITIONS);\nexport const investigationConfigSchema = document(\"InvestigationConfig\", INVESTIGATION_DEFINITIONS);\nexport const experimentationConfigSchema = document(\n \"ExperimentationConfig\",\n EXPERIMENTATION_DEFINITIONS,\n);\n\nexport { validate, assertValid } from \"./validate.ts\";\nexport type { JsonSchema, JsonSchemaDocument, SchemaError } from \"./types.ts\";\n"]}
|