omk-protocol 0.98.3 → 0.98.5
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 +18 -0
- package/README.md +44 -0
- package/dist/claims/claim-blocking-cut.d.ts +8 -15
- package/dist/claims/claim-blocking-cut.d.ts.map +1 -1
- package/dist/claims/claim-blocking-cut.js +161 -41
- package/dist/claims/claim-blocking-cut.js.map +1 -1
- package/dist/claims/claim-closure.d.ts.map +1 -1
- package/dist/claims/claim-closure.js +27 -6
- package/dist/claims/claim-closure.js.map +1 -1
- package/dist/claims/claim-types.d.ts +20 -2
- package/dist/claims/claim-types.d.ts.map +1 -1
- package/dist/claims/claim-types.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/run-contract.d.ts +58 -0
- package/dist/run-contract.d.ts.map +1 -0
- package/dist/run-contract.js +112 -0
- package/dist/run-contract.js.map +1 -0
- package/dist/run-dag.d.ts +18 -0
- package/dist/run-dag.d.ts.map +1 -0
- package/dist/run-dag.js +76 -0
- package/dist/run-dag.js.map +1 -0
- package/dist/run-parsing.d.ts +13 -0
- package/dist/run-parsing.d.ts.map +1 -0
- package/dist/run-parsing.js +81 -0
- package/dist/run-parsing.js.map +1 -0
- package/dist/run-resume.d.ts +15 -0
- package/dist/run-resume.d.ts.map +1 -0
- package/dist/run-resume.js +28 -0
- package/dist/run-resume.js.map +1 -0
- package/dist/run-task-retry.d.ts +8 -0
- package/dist/run-task-retry.d.ts.map +1 -0
- package/dist/run-task-retry.js +25 -0
- package/dist/run-task-retry.js.map +1 -0
- package/dist/run-writer-restart.d.ts +14 -0
- package/dist/run-writer-restart.d.ts.map +1 -0
- package/dist/run-writer-restart.js +27 -0
- package/dist/run-writer-restart.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claim-closure.js","sour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C;IAChG,MAAM,aAAa,GAAG,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC;SAC7C,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAA2B,CAAC;SACpE,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,KAAK,UAAU,CAAC,CAAC;IAC7D,MAAM,aAAa,GAAG,aAAa;SACjC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,iBAAiB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;SAC7D,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAC1C,MAAM,gBAAgB,GAAG,oBAAoB,CAAC,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,CAAC,CAAC;IAC9F,OAAO,MAAM,CAAC,MAAM,CAAC;QACpB,OAAO,EAAE,aAAa,CAAC,aAAa,EAAE,KAAK,CAAC;QAC5C,gBAAgB,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;QACxC,gBAAgB,EAAE,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC;QACjD,kBAAkB,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC;QAC9F,mBAAmB,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,mBAAmB,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACzF,qBAAqB,EAAE,KAAK,CAAC,qBAAqB;KAClD,CAAC,CAAC;AAAA,CACH","sourcesContent":["/**\n * Proof closure evaluation over a claim graph (plan §5.5).\n *\n * Order of operations, each step pure and deterministic:\n *\n * 1. Drop observations bound to another source root or environment.\n * 2. Classify expired observations and observations missing one of a claim's\n * invalidation keys as stale for that claim.\n * 3. A qualified counterexample decides `violated` before any witness counts.\n * 4. Leaf witnesses below the claim's trust floor never count; distinct\n * independence groups must reach `requiredWitnesses`.\n * 5. Composite claims fold their *required* children (`all` = worst child,\n * `any` = best child) in topological order, so a parent is never read\n * before its inputs. Advisory children are reported but never fold into a\n * parent, and a composite with no required children is witnessed like a leaf.\n * 6. A scope-sensitive claim is blocked while the workspace witness is not\n * complete; an unresolved effect blocks the whole closure.\n * 7. A waiver removes an unclosed claim from the required set. It never\n * removes a violated one: a counterexample beats a waiver.\n *\n * The public verdict is decided by the required *roots* (claims nobody lists\n * as an input): `verified` only when every required root is closed, no effect\n * is unresolved, and the workspace witness is complete. A required leaf under\n * an `any` parent therefore blocks nothing once a sibling branch closes — that\n * is what `any` means — while `blockingClaimIds` still lists every required\n * claim on a blocking path so the cause is explainable.\n */\n\nimport { isBlockingVerdict, minimalBlockingCut } from \"./claim-blocking-cut.ts\";\nimport { ClaimGraphError, rootClaimIds, topologicalClaimOrder, validateClaimGraph } from \"./claim-graph.ts\";\nimport {\n\tCLAIM_VERDICT_PRECEDENCE,\n\ttype ClaimClosureEvaluation,\n\ttype ClaimNode,\n\ttype ClaimReasonCode,\n\ttype ClaimVerdict,\n\tOBSERVATION_TRUST_RANK,\n\ttype ObservationNode,\n\ttype ProofClosureInput,\n\ttype ProofClosureResult,\n\ttype VerificationVerdict,\n\ttype WaiverNode,\n} from \"./claim-types.ts\";\n\nconst ISO_TIMESTAMP = /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$/;\n\ninterface Witnesses {\n\treadonly supporting: ObservationNode[];\n\treadonly violating: ObservationNode[];\n\treadonly stale: ObservationNode[];\n}\n\nfunction compareCodeUnits(left: string, right: string): number {\n\tif (left === right) return 0;\n\treturn left < right ? -1 : 1;\n}\n\nfunction requireTimestamp(value: string, label: string): string {\n\tif (!ISO_TIMESTAMP.test(value))\n\t\tthrow new ClaimGraphError(\"invalid_input\", `${label} must be an ISO-8601 UTC instant`);\n\treturn value;\n}\n\nfunction reasonFor(verdict: ClaimVerdict): ClaimReasonCode {\n\treturn `claim.${verdict}` as ClaimReasonCode;\n}\n\nfunction worst(verdicts: readonly ClaimVerdict[]): ClaimVerdict {\n\treturn [...verdicts].sort((a, b) => CLAIM_VERDICT_PRECEDENCE.indexOf(a) - CLAIM_VERDICT_PRECEDENCE.indexOf(b))[0];\n}\n\nfunction best(verdicts: readonly ClaimVerdict[]): ClaimVerdict {\n\treturn [...verdicts].sort((a, b) => CLAIM_VERDICT_PRECEDENCE.indexOf(b) - CLAIM_VERDICT_PRECEDENCE.indexOf(a))[0];\n}\n\n/** Steps 1–2: bind observations to claims, dropping foreign ones and marking stale ones. */\nfunction indexWitnesses(input: ProofClosureInput, claims: ReadonlyMap<string, ClaimNode>): Map<string, Witnesses> {\n\tconst index = new Map<string, Witnesses>();\n\tfor (const claim of claims.values()) index.set(claim.claimId, { supporting: [], violating: [], stale: [] });\n\tfor (const observation of input.observations) {\n\t\tif (observation.sourceRoot !== input.sourceRoot || observation.environmentDigest !== input.environmentDigest)\n\t\t\tcontinue;\n\t\tconst expired =\n\t\t\tobservation.validUntil !== undefined && requireTimestamp(observation.validUntil, \"validUntil\") <= input.now;\n\t\tconst attested = observation.invalidationKeys ?? [];\n\t\tfor (const claimId of observation.claimIds) {\n\t\t\tconst claim = claims.get(claimId);\n\t\t\tconst witnesses = index.get(claimId);\n\t\t\tif (claim === undefined || witnesses === undefined) continue;\n\t\t\tconst missingKey = claim.invalidationKeys.some((key) => !attested.includes(key));\n\t\t\tif (expired || missingKey) witnesses.stale.push(observation);\n\t\t\telse if (observation.polarity === \"violates\") witnesses.violating.push(observation);\n\t\t\telse witnesses.supporting.push(observation);\n\t\t}\n\t}\n\treturn index;\n}\n\nfunction ids(observations: readonly ObservationNode[]): readonly string[] {\n\treturn observations.map((observation) => observation.observationId).sort(compareCodeUnits);\n}\n\n/** Steps 3–4 for a leaf claim. */\nfunction evaluateLeaf(\n\tclaim: ClaimNode,\n\twitnesses: Witnesses,\n): { verdict: ClaimVerdict; observationIds: readonly string[] } {\n\tif (witnesses.violating.length > 0) return { verdict: \"violated\", observationIds: ids(witnesses.violating) };\n\tconst floor = OBSERVATION_TRUST_RANK[claim.trustFloor];\n\tconst trusted = witnesses.supporting.filter((observation) => OBSERVATION_TRUST_RANK[observation.source] >= floor);\n\tconst groups = new Set(trusted.map((observation) => observation.independenceGroup ?? observation.observationId));\n\tif (groups.size >= (claim.requiredWitnesses ?? 1)) return { verdict: \"satisfied\", observationIds: ids(trusted) };\n\tif (trusted.length > 0) return { verdict: \"missing\", observationIds: ids(trusted) };\n\tif (witnesses.supporting.length > 0)\n\t\treturn { verdict: \"insufficient_trust\", observationIds: ids(witnesses.supporting) };\n\tif (witnesses.stale.length > 0) return { verdict: \"stale\", observationIds: ids(witnesses.stale) };\n\treturn { verdict: \"missing\", observationIds: [] };\n}\n\n/** Inputs that take part in a parent's fold: advisory children are informational only. */\nfunction requiredInputs(claim: ClaimNode, claims: ReadonlyMap<string, ClaimNode>): readonly string[] {\n\treturn claim.satisfaction.inputs.filter((input) => claims.get(input)?.severity === \"required\");\n}\n\nfunction isClosed(verdict: ClaimVerdict): boolean {\n\treturn verdict === \"satisfied\" || verdict === \"waived\";\n}\n\n/** Step 5 for a composite claim; its required children are already evaluated. */\nfunction evaluateComposite(\n\tclaim: ClaimNode,\n\tinputs: readonly string[],\n\twitnesses: Witnesses,\n\tevaluations: ReadonlyMap<string, ClaimClosureEvaluation>,\n): { verdict: ClaimVerdict; observationIds: readonly string[] } {\n\tif (witnesses.violating.length > 0) return { verdict: \"violated\", observationIds: ids(witnesses.violating) };\n\tconst childVerdicts = inputs.map((input) => evaluations.get(input)?.verdict ?? \"missing\");\n\tif (claim.satisfaction.rule === \"all\") {\n\t\tconst open = childVerdicts.filter((verdict) => !isClosed(verdict));\n\t\treturn { verdict: open.length === 0 ? \"satisfied\" : worst(open), observationIds: [] };\n\t}\n\tif (childVerdicts.some(isClosed)) return { verdict: \"satisfied\", observationIds: [] };\n\treturn { verdict: best(childVerdicts), observationIds: [] };\n}\n\n/** Step 7: the lexically first valid waiver for a claim, or none. */\nfunction indexWaivers(input: ProofClosureInput, claims: ReadonlyMap<string, ClaimNode>): Map<string, WaiverNode> {\n\tconst byClaim = new Map<string, WaiverNode>();\n\tfor (const waiver of [...input.waivers].sort((a, b) => compareCodeUnits(a.waiverId, b.waiverId))) {\n\t\tif (!claims.has(waiver.claimId))\n\t\t\tthrow new ClaimGraphError(\"unknown_input\", `${waiver.waiverId} waives unknown ${waiver.claimId}`);\n\t\tif (waiver.sourceRoot !== input.sourceRoot) continue;\n\t\tif (requireTimestamp(waiver.expiresAt, \"expiresAt\") <= input.now) continue;\n\t\tif (!byClaim.has(waiver.claimId)) byClaim.set(waiver.claimId, waiver);\n\t}\n\treturn byClaim;\n}\n\n/** Required claims on a blocking path from a blocking required root, in graph order. */\nfunction blockingPathClaimIds(\n\tclaims: ReadonlyMap<string, ClaimNode>,\n\tevaluations: ReadonlyMap<string, ClaimClosureEvaluation>,\n\tblockingRoots: readonly string[],\n\tgraphOrder: readonly string[],\n): readonly string[] {\n\tconst onPath = new Set<string>();\n\tconst visit = (claimId: string): void => {\n\t\tif (onPath.has(claimId)) return;\n\t\tconst claim = claims.get(claimId);\n\t\tconst verdict = evaluations.get(claimId)?.verdict;\n\t\tif (claim === undefined || verdict === undefined || !isBlockingVerdict(verdict)) return;\n\t\tonPath.add(claimId);\n\t\tfor (const input of requiredInputs(claim, claims)) visit(input);\n\t};\n\tfor (const root of blockingRoots) visit(root);\n\treturn graphOrder.filter((claimId) => onPath.has(claimId));\n}\n\nfunction globalVerdict(\n\trequiredRoots: readonly ClaimClosureEvaluation[],\n\tinput: ProofClosureInput,\n): VerificationVerdict {\n\tif (requiredRoots.length === 0) return \"unverified\";\n\tif (requiredRoots.some((root) => root.verdict === \"violated\")) return \"violated\";\n\tconst closure =\n\t\trequiredRoots.every((root) => isClosed(root.verdict)) &&\n\t\tinput.unresolvedEffectIds.length === 0 &&\n\t\tinput.workspaceCompleteness === \"complete\";\n\treturn closure ? \"verified\" : \"inconclusive\";\n}\n\nexport function evaluateProofClosure(input: ProofClosureInput): ProofClosureResult {\n\tconst claims = validateClaimGraph(input.graph);\n\trequireTimestamp(input.now, \"now\");\n\tconst witnesses = indexWitnesses(input, claims);\n\tconst waivers = indexWaivers(input, claims);\n\tconst evaluations = new Map<string, ClaimClosureEvaluation>();\n\tfor (const claim of topologicalClaimOrder(input.graph, claims)) {\n\t\tconst claimWitnesses = witnesses.get(claim.claimId) as Witnesses;\n\t\tconst inputs = requiredInputs(claim, claims);\n\t\tconst local =\n\t\t\tinputs.length === 0\n\t\t\t\t? evaluateLeaf(claim, claimWitnesses)\n\t\t\t\t: evaluateComposite(claim, inputs, claimWitnesses, evaluations);\n\t\tlet verdict = local.verdict;\n\t\tif (verdict !== \"violated\" && claim.scopeSensitive === true && input.workspaceCompleteness !== \"complete\") {\n\t\t\tverdict = \"incomplete_scope\";\n\t\t}\n\t\tconst waiver = waivers.get(claim.claimId);\n\t\tconst waived = waiver !== undefined && verdict !== \"violated\" && verdict !== \"satisfied\";\n\t\tif (waived) verdict = \"waived\";\n\t\tevaluations.set(\n\t\t\tclaim.claimId,\n\t\t\tObject.freeze({\n\t\t\t\tclaimId: claim.claimId,\n\t\t\t\tseverity: claim.severity,\n\t\t\t\tverdict,\n\t\t\t\treasonCode: reasonFor(verdict),\n\t\t\t\tobservationIds: Object.freeze([...local.observationIds]),\n\t\t\t\t...(waived ? { waiverId: waiver.waiverId } : {}),\n\t\t\t}),\n\t\t);\n\t}\n\tconst graphOrder = input.graph.claims.map((claim) => claim.claimId);\n\tconst ordered = graphOrder.map((claimId) => evaluations.get(claimId) as ClaimClosureEvaluation);\n\tconst requiredRoots = rootClaimIds(input.graph)\n\t\t.map((claimId) => evaluations.get(claimId) as ClaimClosureEvaluation)\n\t\t.filter((evaluation) => evaluation.severity === \"required\");\n\tconst blockingRoots = requiredRoots\n\t\t.filter((evaluation) => isBlockingVerdict(evaluation.verdict))\n\t\t.map((evaluation) => evaluation.claimId);\n\tconst blockingClaimIds = blockingPathClaimIds(claims, evaluations, blockingRoots, graphOrder);\n\treturn Object.freeze({\n\t\tverdict: globalVerdict(requiredRoots, input),\n\t\tclaimEvaluations: Object.freeze(ordered),\n\t\tblockingClaimIds: Object.freeze(blockingClaimIds),\n\t\tminimalBlockingCut: Object.freeze([...minimalBlockingCut(claims, evaluations, blockingRoots)]),\n\t\tunresolvedEffectIds: Object.freeze([...input.unresolvedEffectIds].sort(compareCodeUnits)),\n\t\tworkspaceCompleteness: input.workspaceCompleteness,\n\t});\n}\n"]}
|
|
1
|
+
{"version":3,"file":"claim-closure.js","sourceRoot":"","sources":["../../src/claims/claim-closure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC5G,OAAO,EACN,wBAAwB,EAKxB,sBAAsB,GAOtB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,aAAa,GAAG,+CAA+C,CAAC;AAQtE,SAAS,gBAAgB,CAAC,IAAY,EAAE,KAAa,EAAU;IAC9D,IAAI,IAAI,KAAK,KAAK;QAAE,OAAO,CAAC,CAAC;IAC7B,OAAO,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAAA,CAC7B;AAED,SAAS,gBAAgB,CAAC,KAAa,EAAE,KAAa,EAAU;IAC/D,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC;QAC7B,MAAM,IAAI,eAAe,CAAC,eAAe,EAAE,GAAG,KAAK,kCAAkC,CAAC,CAAC;IACxF,OAAO,KAAK,CAAC;AAAA,CACb;AAED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CAAC;AAAA,CACH","sourcesContent":["/**\n * Proof closure evaluation over a claim graph (plan §5.5).\n *\n * Order of operations, each step pure and deterministic:\n *\n * 1. Drop observations bound to another source root or environment.\n * 2. Classify expired observations and observations missing one of a claim's\n * invalidation keys as stale for that claim.\n * 3. A qualified counterexample decides `violated` before any witness counts.\n * 4. Leaf witnesses below the claim's trust floor never count; distinct\n * independence groups must reach `requiredWitnesses`.\n * 5. Composite claims fold their *required* children (`all` = worst child,\n * `any` = best child) in topological order, so a parent is never read\n * before its inputs. Advisory children are reported but never fold into a\n * parent, and a composite with no required children is witnessed like a leaf.\n * 6. A scope-sensitive claim is blocked while the workspace witness is not\n * complete; an unresolved effect blocks the whole closure.\n * 7. A waiver removes an unclosed claim from the required set. It never\n * removes a violated one: a counterexample beats a waiver.\n *\n * The public verdict is decided by the required *roots* (claims nobody lists\n * as an input): `verified` only when every required root is closed, no effect\n * is unresolved, and the workspace witness is complete. A required leaf under\n * an `any` parent therefore blocks nothing once a sibling branch closes — that\n * is what `any` means — while `blockingClaimIds` still lists every required\n * claim on a blocking path so the cause is explainable.\n */\n\nimport { explainBlockingCut, isBlockingVerdict } from \"./claim-blocking-cut.ts\";\nimport { ClaimGraphError, rootClaimIds, topologicalClaimOrder, validateClaimGraph } from \"./claim-graph.ts\";\nimport {\n\tCLAIM_VERDICT_PRECEDENCE,\n\ttype ClaimClosureEvaluation,\n\ttype ClaimNode,\n\ttype ClaimReasonCode,\n\ttype ClaimVerdict,\n\tOBSERVATION_TRUST_RANK,\n\ttype ObservationNode,\n\ttype ProofClosureInput,\n\ttype ProofClosureResult,\n\ttype VerificationVerdict,\n\ttype WaiverNode,\n\ttype WitnessIndependencePolicy,\n} from \"./claim-types.ts\";\n\nconst ISO_TIMESTAMP = /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$/;\n\ninterface Witnesses {\n\treadonly supporting: ObservationNode[];\n\treadonly violating: ObservationNode[];\n\treadonly stale: ObservationNode[];\n}\n\nfunction compareCodeUnits(left: string, right: string): number {\n\tif (left === right) return 0;\n\treturn left < right ? -1 : 1;\n}\n\nfunction requireTimestamp(value: string, label: string): string {\n\tif (!ISO_TIMESTAMP.test(value))\n\t\tthrow new ClaimGraphError(\"invalid_input\", `${label} must be an ISO-8601 UTC instant`);\n\treturn value;\n}\n\nfunction reasonFor(verdict: ClaimVerdict): ClaimReasonCode {\n\treturn `claim.${verdict}` as ClaimReasonCode;\n}\n\nfunction worst(verdicts: readonly ClaimVerdict[]): ClaimVerdict {\n\treturn [...verdicts].sort((a, b) => CLAIM_VERDICT_PRECEDENCE.indexOf(a) - CLAIM_VERDICT_PRECEDENCE.indexOf(b))[0];\n}\n\nfunction best(verdicts: readonly ClaimVerdict[]): ClaimVerdict {\n\treturn [...verdicts].sort((a, b) => CLAIM_VERDICT_PRECEDENCE.indexOf(b) - CLAIM_VERDICT_PRECEDENCE.indexOf(a))[0];\n}\n\n/** Steps 1–2: bind observations to claims, dropping foreign ones and marking stale ones. */\nfunction indexWitnesses(input: ProofClosureInput, claims: ReadonlyMap<string, ClaimNode>): Map<string, Witnesses> {\n\tconst index = new Map<string, Witnesses>();\n\tfor (const claim of claims.values()) index.set(claim.claimId, { supporting: [], violating: [], stale: [] });\n\tfor (const observation of input.observations) {\n\t\tif (observation.sourceRoot !== input.sourceRoot || observation.environmentDigest !== input.environmentDigest)\n\t\t\tcontinue;\n\t\tconst expired =\n\t\t\tobservation.validUntil !== undefined && requireTimestamp(observation.validUntil, \"validUntil\") <= input.now;\n\t\tconst attested = observation.invalidationKeys ?? [];\n\t\tfor (const claimId of observation.claimIds) {\n\t\t\tconst claim = claims.get(claimId);\n\t\t\tconst witnesses = index.get(claimId);\n\t\t\tif (claim === undefined || witnesses === undefined) continue;\n\t\t\tconst missingKey = claim.invalidationKeys.some((key) => !attested.includes(key));\n\t\t\tif (expired || missingKey) witnesses.stale.push(observation);\n\t\t\telse if (observation.polarity === \"violates\") witnesses.violating.push(observation);\n\t\t\telse witnesses.supporting.push(observation);\n\t\t}\n\t}\n\treturn index;\n}\n\nfunction ids(observations: readonly ObservationNode[]): readonly string[] {\n\treturn observations.map((observation) => observation.observationId).sort(compareCodeUnits);\n}\n\n/** Steps 3–4 for a leaf claim. */\nfunction evaluateLeaf(\n\tclaim: ClaimNode,\n\twitnesses: Witnesses,\n\tindependence: WitnessIndependencePolicy,\n): { verdict: ClaimVerdict; observationIds: readonly string[] } {\n\tif (witnesses.violating.length > 0) return { verdict: \"violated\", observationIds: ids(witnesses.violating) };\n\tconst floor = OBSERVATION_TRUST_RANK[claim.trustFloor];\n\tconst trusted = witnesses.supporting.filter((observation) => OBSERVATION_TRUST_RANK[observation.source] >= floor);\n\tconst requiredWitnesses = claim.requiredWitnesses ?? 1;\n\tconst attributable = trusted.filter(\n\t\t(observation) =>\n\t\t\tindependence === \"legacy-observation-id\" ||\n\t\t\trequiredWitnesses === 1 ||\n\t\t\tBoolean(observation.independenceGroup?.trim()),\n\t);\n\tconst groups = new Set(\n\t\tattributable.map(\n\t\t\t(observation) =>\n\t\t\t\tobservation.independenceGroup ??\n\t\t\t\t(independence === \"legacy-observation-id\" ? observation.observationId : undefined),\n\t\t),\n\t);\n\tif (groups.size >= requiredWitnesses) return { verdict: \"satisfied\", observationIds: ids(trusted) };\n\tif (trusted.length > 0) return { verdict: \"missing\", observationIds: ids(trusted) };\n\tif (witnesses.supporting.length > 0)\n\t\treturn { verdict: \"insufficient_trust\", observationIds: ids(witnesses.supporting) };\n\tif (witnesses.stale.length > 0) return { verdict: \"stale\", observationIds: ids(witnesses.stale) };\n\treturn { verdict: \"missing\", observationIds: [] };\n}\n\n/** Inputs that take part in a parent's fold: advisory children are informational only. */\nfunction requiredInputs(claim: ClaimNode, claims: ReadonlyMap<string, ClaimNode>): readonly string[] {\n\treturn claim.satisfaction.inputs.filter((input) => claims.get(input)?.severity === \"required\");\n}\n\nfunction isClosed(verdict: ClaimVerdict): boolean {\n\treturn verdict === \"satisfied\" || verdict === \"waived\";\n}\n\n/** Step 5 for a composite claim; its required children are already evaluated. */\nfunction evaluateComposite(\n\tclaim: ClaimNode,\n\tinputs: readonly string[],\n\twitnesses: Witnesses,\n\tevaluations: ReadonlyMap<string, ClaimClosureEvaluation>,\n): { verdict: ClaimVerdict; observationIds: readonly string[] } {\n\tif (witnesses.violating.length > 0) return { verdict: \"violated\", observationIds: ids(witnesses.violating) };\n\tconst childVerdicts = inputs.map((input) => evaluations.get(input)?.verdict ?? \"missing\");\n\tif (claim.satisfaction.rule === \"all\") {\n\t\tconst open = childVerdicts.filter((verdict) => !isClosed(verdict));\n\t\treturn { verdict: open.length === 0 ? \"satisfied\" : worst(open), observationIds: [] };\n\t}\n\tif (childVerdicts.some(isClosed)) return { verdict: \"satisfied\", observationIds: [] };\n\treturn { verdict: best(childVerdicts), observationIds: [] };\n}\n\n/** Step 7: the lexically first valid waiver for a claim, or none. */\nfunction indexWaivers(input: ProofClosureInput, claims: ReadonlyMap<string, ClaimNode>): Map<string, WaiverNode> {\n\tconst byClaim = new Map<string, WaiverNode>();\n\tfor (const waiver of [...input.waivers].sort((a, b) => compareCodeUnits(a.waiverId, b.waiverId))) {\n\t\tif (!claims.has(waiver.claimId))\n\t\t\tthrow new ClaimGraphError(\"unknown_input\", `${waiver.waiverId} waives unknown ${waiver.claimId}`);\n\t\tif (waiver.sourceRoot !== input.sourceRoot) continue;\n\t\tif (requireTimestamp(waiver.expiresAt, \"expiresAt\") <= input.now) continue;\n\t\tif (!byClaim.has(waiver.claimId)) byClaim.set(waiver.claimId, waiver);\n\t}\n\treturn byClaim;\n}\n\n/** Required claims on a blocking path from a blocking required root, in graph order. */\nfunction blockingPathClaimIds(\n\tclaims: ReadonlyMap<string, ClaimNode>,\n\tevaluations: ReadonlyMap<string, ClaimClosureEvaluation>,\n\tblockingRoots: readonly string[],\n\tgraphOrder: readonly string[],\n): readonly string[] {\n\tconst onPath = new Set<string>();\n\tconst visit = (claimId: string): void => {\n\t\tif (onPath.has(claimId)) return;\n\t\tconst claim = claims.get(claimId);\n\t\tconst verdict = evaluations.get(claimId)?.verdict;\n\t\tif (claim === undefined || verdict === undefined || !isBlockingVerdict(verdict)) return;\n\t\tonPath.add(claimId);\n\t\tfor (const input of requiredInputs(claim, claims)) visit(input);\n\t};\n\tfor (const root of blockingRoots) visit(root);\n\treturn graphOrder.filter((claimId) => onPath.has(claimId));\n}\n\nfunction globalVerdict(\n\trequiredRoots: readonly ClaimClosureEvaluation[],\n\tinput: ProofClosureInput,\n): VerificationVerdict {\n\tif (requiredRoots.length === 0) return \"unverified\";\n\tif (requiredRoots.some((root) => root.verdict === \"violated\")) return \"violated\";\n\tconst closure =\n\t\trequiredRoots.every((root) => isClosed(root.verdict)) &&\n\t\tinput.unresolvedEffectIds.length === 0 &&\n\t\tinput.workspaceCompleteness === \"complete\";\n\treturn closure ? \"verified\" : \"inconclusive\";\n}\n\nexport function evaluateProofClosure(input: ProofClosureInput): ProofClosureResult {\n\tconst claims = validateClaimGraph(input.graph);\n\tconst witnessIndependence =\n\t\tinput.witnessIndependence === undefined ? \"legacy-observation-id\" : input.witnessIndependence;\n\tif (witnessIndependence !== \"legacy-observation-id\" && witnessIndependence !== \"explicit-groups\") {\n\t\tthrow new ClaimGraphError(\"invalid_input\", \"Unknown witness independence policy\");\n\t}\n\trequireTimestamp(input.now, \"now\");\n\tconst witnesses = indexWitnesses(input, claims);\n\tconst waivers = indexWaivers(input, claims);\n\tconst evaluations = new Map<string, ClaimClosureEvaluation>();\n\tfor (const claim of topologicalClaimOrder(input.graph, claims)) {\n\t\tconst claimWitnesses = witnesses.get(claim.claimId) as Witnesses;\n\t\tconst inputs = requiredInputs(claim, claims);\n\t\tconst local =\n\t\t\tinputs.length === 0\n\t\t\t\t? evaluateLeaf(claim, claimWitnesses, witnessIndependence)\n\t\t\t\t: evaluateComposite(claim, inputs, claimWitnesses, evaluations);\n\t\tlet verdict = local.verdict;\n\t\tif (verdict !== \"violated\" && claim.scopeSensitive === true && input.workspaceCompleteness !== \"complete\") {\n\t\t\tverdict = \"incomplete_scope\";\n\t\t}\n\t\tconst waiver = waivers.get(claim.claimId);\n\t\tconst waived = waiver !== undefined && verdict !== \"violated\" && verdict !== \"satisfied\";\n\t\tif (waived) verdict = \"waived\";\n\t\tevaluations.set(\n\t\t\tclaim.claimId,\n\t\t\tObject.freeze({\n\t\t\t\tclaimId: claim.claimId,\n\t\t\t\tseverity: claim.severity,\n\t\t\t\tverdict,\n\t\t\t\treasonCode: reasonFor(verdict),\n\t\t\t\tobservationIds: Object.freeze([...local.observationIds]),\n\t\t\t\t...(waived ? { waiverId: waiver.waiverId } : {}),\n\t\t\t\t...(isBlockingVerdict(verdict)\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tblockingOrigin:\n\t\t\t\t\t\t\t\tinputs.length === 0 ||\n\t\t\t\t\t\t\t\tclaimWitnesses.violating.length > 0 ||\n\t\t\t\t\t\t\t\t(claim.scopeSensitive === true && input.workspaceCompleteness !== \"complete\")\n\t\t\t\t\t\t\t\t\t? (\"local\" as const)\n\t\t\t\t\t\t\t\t\t: (\"children\" as const),\n\t\t\t\t\t\t}\n\t\t\t\t\t: {}),\n\t\t\t}),\n\t\t);\n\t}\n\tconst graphOrder = input.graph.claims.map((claim) => claim.claimId);\n\tconst ordered = graphOrder.map((claimId) => evaluations.get(claimId) as ClaimClosureEvaluation);\n\tconst requiredRoots = rootClaimIds(input.graph)\n\t\t.map((claimId) => evaluations.get(claimId) as ClaimClosureEvaluation)\n\t\t.filter((evaluation) => evaluation.severity === \"required\");\n\tconst blockingRoots = requiredRoots\n\t\t.filter((evaluation) => isBlockingVerdict(evaluation.verdict))\n\t\t.map((evaluation) => evaluation.claimId);\n\tconst blockingClaimIds = blockingPathClaimIds(claims, evaluations, blockingRoots, graphOrder);\n\tconst blockingCut = explainBlockingCut(claims, evaluations, blockingRoots);\n\treturn Object.freeze({\n\t\tverdict: globalVerdict(requiredRoots, input),\n\t\twitnessIndependence,\n\t\tclaimEvaluations: Object.freeze(ordered),\n\t\tblockingClaimIds: Object.freeze(blockingClaimIds),\n\t\tminimalBlockingCut: blockingCut.claimIds,\n\t\tblockingCut,\n\t\tunresolvedEffectIds: Object.freeze([...input.unresolvedEffectIds].sort(compareCodeUnits)),\n\t\tworkspaceCompleteness: input.workspaceCompleteness,\n\t});\n}\n"]}
|
|
@@ -53,7 +53,7 @@ export interface ObservationNode {
|
|
|
53
53
|
/** ISO-8601 instant after which the observation no longer qualifies. */
|
|
54
54
|
readonly validUntil?: string;
|
|
55
55
|
readonly invalidationKeys?: readonly string[];
|
|
56
|
-
/** Witnesses sharing a group count once
|
|
56
|
+
/** Witnesses sharing a group count once. The explicit-groups policy requires this for multi-witness claims. */
|
|
57
57
|
readonly independenceGroup?: string;
|
|
58
58
|
}
|
|
59
59
|
export interface WaiverNode {
|
|
@@ -68,9 +68,12 @@ export interface ClaimGraph {
|
|
|
68
68
|
readonly schemaVersion: typeof CLAIM_GRAPH_SCHEMA_VERSION;
|
|
69
69
|
readonly claims: readonly ClaimNode[];
|
|
70
70
|
}
|
|
71
|
+
export type WitnessIndependencePolicy = "legacy-observation-id" | "explicit-groups";
|
|
71
72
|
export interface ProofClosureInput {
|
|
72
73
|
readonly graph: ClaimGraph;
|
|
73
74
|
readonly observations: readonly ObservationNode[];
|
|
75
|
+
/** Compatibility default: legacy-observation-id. Strong profiles must opt into explicit-groups. */
|
|
76
|
+
readonly witnessIndependence?: WitnessIndependencePolicy;
|
|
74
77
|
readonly waivers: readonly WaiverNode[];
|
|
75
78
|
readonly sourceRoot: string;
|
|
76
79
|
readonly environmentDigest: string;
|
|
@@ -88,14 +91,29 @@ export interface ClaimClosureEvaluation {
|
|
|
88
91
|
/** Qualified observations that decided the verdict (violations, or counted witnesses). */
|
|
89
92
|
readonly observationIds: readonly string[];
|
|
90
93
|
readonly waiverId?: string;
|
|
94
|
+
/** Distinguish local obligations from a verdict derived only from children. */
|
|
95
|
+
readonly blockingOrigin?: "local" | "children";
|
|
96
|
+
}
|
|
97
|
+
export interface BlockingCutExplanation {
|
|
98
|
+
readonly claimIds: readonly string[];
|
|
99
|
+
readonly algorithm: "exact-antichain" | "greedy";
|
|
100
|
+
/** Minimum cardinality in this repair model only; fallback has no minimality guarantee. */
|
|
101
|
+
readonly optimality: "minimum" | "not-proven";
|
|
102
|
+
readonly truncated: boolean;
|
|
103
|
+
readonly exploredStates: number;
|
|
104
|
+
/** Selected composite-local obligations that child repairs alone cannot resolve. */
|
|
105
|
+
readonly localClaimIds: readonly string[];
|
|
91
106
|
}
|
|
92
107
|
export interface ProofClosureResult {
|
|
93
108
|
readonly verdict: VerificationVerdict;
|
|
109
|
+
readonly witnessIndependence?: WitnessIndependencePolicy;
|
|
94
110
|
readonly claimEvaluations: readonly ClaimClosureEvaluation[];
|
|
95
111
|
/** Required claims that are not closed, in evaluation order. */
|
|
96
112
|
readonly blockingClaimIds: readonly string[];
|
|
97
|
-
/**
|
|
113
|
+
/** Compatibility projection; consult blockingCut for bounded-search optimality and local causes. */
|
|
98
114
|
readonly minimalBlockingCut: readonly string[];
|
|
115
|
+
/** Explanation only; never overrides the closure verdict or unresolved global effects. */
|
|
116
|
+
readonly blockingCut?: BlockingCutExplanation;
|
|
99
117
|
readonly unresolvedEffectIds: readonly string[];
|
|
100
118
|
readonly workspaceCompleteness: WorkspaceCompleteness;
|
|
101
119
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claim-types.d.ts","sourceRoot":"","sources":["../../src/claims/claim-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,0BAA0B,sBAAgC,CAAC;AAExE,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAAC;AACvG,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,UAAU,CAAC;AACpD,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,KAAK,CAAC;A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AAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;IACtD,QAAQ,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAC;IAChD,+EAA+E;IAC/E,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,eAAe,GACxB,iBAAiB,GACjB,gBAAgB,GAChB,eAAe,GACf,aAAa,GACb,wBAAwB,GACxB,0BAA0B,GAC1B,cAAc,CAAC;AAElB,MAAM,WAAW,sBAAsB;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAC;IACrC,0FAA0F;IAC1F,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;IACtC,QAAQ,CAAC,gBAAgB,EAAE,SAAS,sBAAsB,EAAE,CAAC;IAC7D,gEAAgE;IAChE,QAAQ,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7C,iFAAiF;IACjF,QAAQ,CAAC,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/C,QAAQ,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAC;IAChD,QAAQ,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;CACtD","sourcesContent":["/**\n * Claim Closure Graph V1 vocabulary.\n *\n * The flat `TaskSpec.claims` model answers \"did this attempt satisfy its\n * predicates?\". The closure graph answers the stricter question a verified\n * verdict needs: are all required claims closed by *qualified* witnesses —\n * bound to this source root and environment, not expired, from a source the\n * claim's policy trusts, independent enough to count separately — with no\n * counterexample, no unresolved side effect, and a complete workspace scope?\n *\n * Pure vocabulary: no behaviour, no I/O, no clock. Evaluation lives in\n * `claim-closure.ts`, structure checks in `claim-graph.ts`.\n */\n\nexport const CLAIM_GRAPH_SCHEMA_VERSION = \"omk.claim-graph.v1\" as const;\n\nexport type ClaimNodeKind = \"requirement\" | \"safety\" | \"scope\" | \"quality\" | \"performance\" | \"release\";\nexport type ClaimSeverity = \"required\" | \"advisory\";\nexport type ClaimRule = \"all\" | \"any\";\n\n/** Trust lattice, highest first. A claim's `trustFloor` names the weakest source that may witness it. */\nexport type ObservationSource =\n\t| \"deterministic_validator\"\n\t| \"trusted_attestation\"\n\t| \"workspace_witness\"\n\t| \"effect_reconciliation\"\n\t| \"independent_review\"\n\t| \"self_review\"\n\t| \"model_narrative\";\n\nexport const OBSERVATION_TRUST_RANK: Readonly<Record<ObservationSource, number>> = {\n\tdeterministic_validator: 6,\n\ttrusted_attestation: 5,\n\tworkspace_witness: 4,\n\teffect_reconciliation: 4,\n\tindependent_review: 3,\n\tself_review: 2,\n\tmodel_narrative: 1,\n};\n\nexport type ObservationPolarity = \"supports\" | \"violates\";\n\nexport type ClaimVerdict =\n\t| \"satisfied\"\n\t| \"violated\"\n\t| \"missing\"\n\t| \"stale\"\n\t| \"incomplete_scope\"\n\t| \"insufficient_trust\"\n\t| \"waived\";\n\n/** Precedence when several verdicts compete; lower index wins. */\nexport const CLAIM_VERDICT_PRECEDENCE: readonly ClaimVerdict[] = [\n\t\"violated\",\n\t\"stale\",\n\t\"incomplete_scope\",\n\t\"insufficient_trust\",\n\t\"missing\",\n\t\"waived\",\n\t\"satisfied\",\n];\n\nexport type WorkspaceCompleteness = \"complete\" | \"partial_excluded\" | \"partial_truncated\" | \"unknown\";\n\nexport type VerificationVerdict = \"verified\" | \"unverified\" | \"inconclusive\" | \"violated\";\n\nexport interface ClaimNode {\n\treadonly claimId: string;\n\treadonly kind: ClaimNodeKind;\n\treadonly statement: string;\n\treadonly severity: ClaimSeverity;\n\t/** `inputs` are child claim ids. An empty list makes this a leaf witnessed by observations. */\n\treadonly satisfaction: { readonly rule: ClaimRule; readonly inputs: readonly string[] };\n\treadonly trustFloor: ObservationSource;\n\t/** Distinct independence groups a leaf needs among its qualified supporting witnesses. Default 1. */\n\treadonly requiredWitnesses?: number;\n\t/** Blocked with `incomplete_scope` whenever the workspace witness is not complete. */\n\treadonly scopeSensitive?: boolean;\n\t/** Keys a witness must have attested to; any missing key makes the witness stale for this claim. */\n\treadonly invalidationKeys: readonly string[];\n}\n\nexport interface ObservationNode {\n\treadonly observationId: string;\n\treadonly claimIds: readonly string[];\n\treadonly polarity: ObservationPolarity;\n\treadonly source: ObservationSource;\n\treadonly receiptId?: string;\n\treadonly sourceRoot: string;\n\treadonly environmentDigest: string;\n\t/** ISO-8601 instant after which the observation no longer qualifies. */\n\treadonly validUntil?: string;\n\treadonly invalidationKeys?: readonly string[];\n\t/** Witnesses sharing a group count once; defaults to the observation id. */\n\treadonly independenceGroup?: string;\n}\n\nexport interface WaiverNode {\n\treadonly waiverId: string;\n\treadonly claimId: string;\n\treadonly issuer: string;\n\treadonly reason: string;\n\treadonly sourceRoot: string;\n\treadonly expiresAt: string;\n}\n\nexport interface ClaimGraph {\n\treadonly schemaVersion: typeof CLAIM_GRAPH_SCHEMA_VERSION;\n\treadonly claims: readonly ClaimNode[];\n}\n\nexport interface ProofClosureInput {\n\treadonly graph: ClaimGraph;\n\treadonly observations: readonly ObservationNode[];\n\treadonly waivers: readonly WaiverNode[];\n\treadonly sourceRoot: string;\n\treadonly environmentDigest: string;\n\treadonly workspaceCompleteness: WorkspaceCompleteness;\n\treadonly unresolvedEffectIds: readonly string[];\n\t/** ISO-8601 evaluation instant; injected so evaluation never reads a clock. */\n\treadonly now: string;\n}\n\nexport type ClaimReasonCode =\n\t| \"claim.satisfied\"\n\t| \"claim.violated\"\n\t| \"claim.missing\"\n\t| \"claim.stale\"\n\t| \"claim.incomplete_scope\"\n\t| \"claim.insufficient_trust\"\n\t| \"claim.waived\";\n\nexport interface ClaimClosureEvaluation {\n\treadonly claimId: string;\n\treadonly severity: ClaimSeverity;\n\treadonly verdict: ClaimVerdict;\n\treadonly reasonCode: ClaimReasonCode;\n\t/** Qualified observations that decided the verdict (violations, or counted witnesses). */\n\treadonly observationIds: readonly string[];\n\treadonly waiverId?: string;\n}\n\nexport interface ProofClosureResult {\n\treadonly verdict: VerificationVerdict;\n\treadonly claimEvaluations: readonly ClaimClosureEvaluation[];\n\t/** Required claims that are not closed, in evaluation order. */\n\treadonly blockingClaimIds: readonly string[];\n\t/** Smallest leaf set whose closure would unblock every blocking root; sorted. */\n\treadonly minimalBlockingCut: readonly string[];\n\treadonly unresolvedEffectIds: readonly string[];\n\treadonly workspaceCompleteness: WorkspaceCompleteness;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"claim-types.d.ts","sourceRoot":"","sources":["../../src/claims/claim-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,0BAA0B,sBAAgC,CAAC;AAExE,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAAC;AACvG,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,UAAU,CAAC;AACpD,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,KAAK,CAAC;AAEtC,yGAAyG;AACzG,MAAM,MAAM,iBAAiB,GAC1B,yBAAyB,GACzB,qBAAqB,GACrB,mBAAmB,GACnB,uBAAuB,GACvB,oBAAoB,GACpB,aAAa,GACb,iBAAiB,CAAC;AAErB,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAQ9E,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,UAAU,CAAC;AAE1D,MAAM,MAAM,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,oGAAoG;IACpG,QAAQ,CAAC,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/C,0FAA0F;IAC1F,QAAQ,CAAC,WAAW,CAAC,EAAE,sBAAsB,CAAC;IAC9C,QAAQ,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAC;IAChD,QAAQ,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;CACtD","sourcesContent":["/**\n * Claim Closure Graph V1 vocabulary.\n *\n * The flat `TaskSpec.claims` model answers \"did this attempt satisfy its\n * predicates?\". The closure graph answers the stricter question a verified\n * verdict needs: are all required claims closed by *qualified* witnesses —\n * bound to this source root and environment, not expired, from a source the\n * claim's policy trusts, independent enough to count separately — with no\n * counterexample, no unresolved side effect, and a complete workspace scope?\n *\n * Pure vocabulary: no behaviour, no I/O, no clock. Evaluation lives in\n * `claim-closure.ts`, structure checks in `claim-graph.ts`.\n */\n\nexport const CLAIM_GRAPH_SCHEMA_VERSION = \"omk.claim-graph.v1\" as const;\n\nexport type ClaimNodeKind = \"requirement\" | \"safety\" | \"scope\" | \"quality\" | \"performance\" | \"release\";\nexport type ClaimSeverity = \"required\" | \"advisory\";\nexport type ClaimRule = \"all\" | \"any\";\n\n/** Trust lattice, highest first. A claim's `trustFloor` names the weakest source that may witness it. */\nexport type ObservationSource =\n\t| \"deterministic_validator\"\n\t| \"trusted_attestation\"\n\t| \"workspace_witness\"\n\t| \"effect_reconciliation\"\n\t| \"independent_review\"\n\t| \"self_review\"\n\t| \"model_narrative\";\n\nexport const OBSERVATION_TRUST_RANK: Readonly<Record<ObservationSource, number>> = {\n\tdeterministic_validator: 6,\n\ttrusted_attestation: 5,\n\tworkspace_witness: 4,\n\teffect_reconciliation: 4,\n\tindependent_review: 3,\n\tself_review: 2,\n\tmodel_narrative: 1,\n};\n\nexport type ObservationPolarity = \"supports\" | \"violates\";\n\nexport type ClaimVerdict =\n\t| \"satisfied\"\n\t| \"violated\"\n\t| \"missing\"\n\t| \"stale\"\n\t| \"incomplete_scope\"\n\t| \"insufficient_trust\"\n\t| \"waived\";\n\n/** Precedence when several verdicts compete; lower index wins. */\nexport const CLAIM_VERDICT_PRECEDENCE: readonly ClaimVerdict[] = [\n\t\"violated\",\n\t\"stale\",\n\t\"incomplete_scope\",\n\t\"insufficient_trust\",\n\t\"missing\",\n\t\"waived\",\n\t\"satisfied\",\n];\n\nexport type WorkspaceCompleteness = \"complete\" | \"partial_excluded\" | \"partial_truncated\" | \"unknown\";\n\nexport type VerificationVerdict = \"verified\" | \"unverified\" | \"inconclusive\" | \"violated\";\n\nexport interface ClaimNode {\n\treadonly claimId: string;\n\treadonly kind: ClaimNodeKind;\n\treadonly statement: string;\n\treadonly severity: ClaimSeverity;\n\t/** `inputs` are child claim ids. An empty list makes this a leaf witnessed by observations. */\n\treadonly satisfaction: { readonly rule: ClaimRule; readonly inputs: readonly string[] };\n\treadonly trustFloor: ObservationSource;\n\t/** Distinct independence groups a leaf needs among its qualified supporting witnesses. Default 1. */\n\treadonly requiredWitnesses?: number;\n\t/** Blocked with `incomplete_scope` whenever the workspace witness is not complete. */\n\treadonly scopeSensitive?: boolean;\n\t/** Keys a witness must have attested to; any missing key makes the witness stale for this claim. */\n\treadonly invalidationKeys: readonly string[];\n}\n\nexport interface ObservationNode {\n\treadonly observationId: string;\n\treadonly claimIds: readonly string[];\n\treadonly polarity: ObservationPolarity;\n\treadonly source: ObservationSource;\n\treadonly receiptId?: string;\n\treadonly sourceRoot: string;\n\treadonly environmentDigest: string;\n\t/** ISO-8601 instant after which the observation no longer qualifies. */\n\treadonly validUntil?: string;\n\treadonly invalidationKeys?: readonly string[];\n\t/** Witnesses sharing a group count once. The explicit-groups policy requires this for multi-witness claims. */\n\treadonly independenceGroup?: string;\n}\n\nexport interface WaiverNode {\n\treadonly waiverId: string;\n\treadonly claimId: string;\n\treadonly issuer: string;\n\treadonly reason: string;\n\treadonly sourceRoot: string;\n\treadonly expiresAt: string;\n}\n\nexport interface ClaimGraph {\n\treadonly schemaVersion: typeof CLAIM_GRAPH_SCHEMA_VERSION;\n\treadonly claims: readonly ClaimNode[];\n}\n\nexport type WitnessIndependencePolicy = \"legacy-observation-id\" | \"explicit-groups\";\n\nexport interface ProofClosureInput {\n\treadonly graph: ClaimGraph;\n\treadonly observations: readonly ObservationNode[];\n\t/** Compatibility default: legacy-observation-id. Strong profiles must opt into explicit-groups. */\n\treadonly witnessIndependence?: WitnessIndependencePolicy;\n\treadonly waivers: readonly WaiverNode[];\n\treadonly sourceRoot: string;\n\treadonly environmentDigest: string;\n\treadonly workspaceCompleteness: WorkspaceCompleteness;\n\treadonly unresolvedEffectIds: readonly string[];\n\t/** ISO-8601 evaluation instant; injected so evaluation never reads a clock. */\n\treadonly now: string;\n}\n\nexport type ClaimReasonCode =\n\t| \"claim.satisfied\"\n\t| \"claim.violated\"\n\t| \"claim.missing\"\n\t| \"claim.stale\"\n\t| \"claim.incomplete_scope\"\n\t| \"claim.insufficient_trust\"\n\t| \"claim.waived\";\n\nexport interface ClaimClosureEvaluation {\n\treadonly claimId: string;\n\treadonly severity: ClaimSeverity;\n\treadonly verdict: ClaimVerdict;\n\treadonly reasonCode: ClaimReasonCode;\n\t/** Qualified observations that decided the verdict (violations, or counted witnesses). */\n\treadonly observationIds: readonly string[];\n\treadonly waiverId?: string;\n\t/** Distinguish local obligations from a verdict derived only from children. */\n\treadonly blockingOrigin?: \"local\" | \"children\";\n}\n\nexport interface BlockingCutExplanation {\n\treadonly claimIds: readonly string[];\n\treadonly algorithm: \"exact-antichain\" | \"greedy\";\n\t/** Minimum cardinality in this repair model only; fallback has no minimality guarantee. */\n\treadonly optimality: \"minimum\" | \"not-proven\";\n\treadonly truncated: boolean;\n\treadonly exploredStates: number;\n\t/** Selected composite-local obligations that child repairs alone cannot resolve. */\n\treadonly localClaimIds: readonly string[];\n}\n\nexport interface ProofClosureResult {\n\treadonly verdict: VerificationVerdict;\n\treadonly witnessIndependence?: WitnessIndependencePolicy;\n\treadonly claimEvaluations: readonly ClaimClosureEvaluation[];\n\t/** Required claims that are not closed, in evaluation order. */\n\treadonly blockingClaimIds: readonly string[];\n\t/** Compatibility projection; consult blockingCut for bounded-search optimality and local causes. */\n\treadonly minimalBlockingCut: readonly string[];\n\t/** Explanation only; never overrides the closure verdict or unresolved global effects. */\n\treadonly blockingCut?: BlockingCutExplanation;\n\treadonly unresolvedEffectIds: readonly string[];\n\treadonly workspaceCompleteness: WorkspaceCompleteness;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claim-types.js","sourceRoot":"","sources":["../../src/claims/claim-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAG,oBAA6B,CAAC;AAgBxE,MAAM,CAAC,MAAM,sBAAsB,GAAgD;IAClF,uBAAuB,EAAE,CAAC;IAC1B,mBAAmB,EAAE,CAAC;IACtB,iBAAiB,EAAE,CAAC;IACpB,qBAAqB,EAAE,CAAC;IACxB,kBAAkB,EAAE,CAAC;IACrB,WAAW,EAAE,CAAC;IACd,eAAe,EAAE,CAAC;CAClB,CAAC;AAaF,kEAAkE;AAClE,MAAM,CAAC,MAAM,wBAAwB,GAA4B;IAChE,UAAU;IACV,OAAO;IACP,kBAAkB;IAClB,oBAAoB;IACpB,SAAS;IACT,QAAQ;IACR,WAAW;CACX,CAAC","sourcesContent":["/**\n * Claim Closure Graph V1 vocabulary.\n *\n * The flat `TaskSpec.claims` model answers \"did this attempt satisfy its\n * predicates?\". The closure graph answers the stricter question a verified\n * verdict needs: are all required claims closed by *qualified* witnesses —\n * bound to this source root and environment, not expired, from a source the\n * claim's policy trusts, independent enough to count separately — with no\n * counterexample, no unresolved side effect, and a complete workspace scope?\n *\n * Pure vocabulary: no behaviour, no I/O, no clock. Evaluation lives in\n * `claim-closure.ts`, structure checks in `claim-graph.ts`.\n */\n\nexport const CLAIM_GRAPH_SCHEMA_VERSION = \"omk.claim-graph.v1\" as const;\n\nexport type ClaimNodeKind = \"requirement\" | \"safety\" | \"scope\" | \"quality\" | \"performance\" | \"release\";\nexport type ClaimSeverity = \"required\" | \"advisory\";\nexport type ClaimRule = \"all\" | \"any\";\n\n/** Trust lattice, highest first. A claim's `trustFloor` names the weakest source that may witness it. */\nexport type ObservationSource =\n\t| \"deterministic_validator\"\n\t| \"trusted_attestation\"\n\t| \"workspace_witness\"\n\t| \"effect_reconciliation\"\n\t| \"independent_review\"\n\t| \"self_review\"\n\t| \"model_narrative\";\n\nexport const OBSERVATION_TRUST_RANK: Readonly<Record<ObservationSource, number>> = {\n\tdeterministic_validator: 6,\n\ttrusted_attestation: 5,\n\tworkspace_witness: 4,\n\teffect_reconciliation: 4,\n\tindependent_review: 3,\n\tself_review: 2,\n\tmodel_narrative: 1,\n};\n\nexport type ObservationPolarity = \"supports\" | \"violates\";\n\nexport type ClaimVerdict =\n\t| \"satisfied\"\n\t| \"violated\"\n\t| \"missing\"\n\t| \"stale\"\n\t| \"incomplete_scope\"\n\t| \"insufficient_trust\"\n\t| \"waived\";\n\n/** Precedence when several verdicts compete; lower index wins. */\nexport const CLAIM_VERDICT_PRECEDENCE: readonly ClaimVerdict[] = [\n\t\"violated\",\n\t\"stale\",\n\t\"incomplete_scope\",\n\t\"insufficient_trust\",\n\t\"missing\",\n\t\"waived\",\n\t\"satisfied\",\n];\n\nexport type WorkspaceCompleteness = \"complete\" | \"partial_excluded\" | \"partial_truncated\" | \"unknown\";\n\nexport type VerificationVerdict = \"verified\" | \"unverified\" | \"inconclusive\" | \"violated\";\n\nexport interface ClaimNode {\n\treadonly claimId: string;\n\treadonly kind: ClaimNodeKind;\n\treadonly statement: string;\n\treadonly severity: ClaimSeverity;\n\t/** `inputs` are child claim ids. An empty list makes this a leaf witnessed by observations. */\n\treadonly satisfaction: { readonly rule: ClaimRule; readonly inputs: readonly string[] };\n\treadonly trustFloor: ObservationSource;\n\t/** Distinct independence groups a leaf needs among its qualified supporting witnesses. Default 1. */\n\treadonly requiredWitnesses?: number;\n\t/** Blocked with `incomplete_scope` whenever the workspace witness is not complete. */\n\treadonly scopeSensitive?: boolean;\n\t/** Keys a witness must have attested to; any missing key makes the witness stale for this claim. */\n\treadonly invalidationKeys: readonly string[];\n}\n\nexport interface ObservationNode {\n\treadonly observationId: string;\n\treadonly claimIds: readonly string[];\n\treadonly polarity: ObservationPolarity;\n\treadonly source: ObservationSource;\n\treadonly receiptId?: string;\n\treadonly sourceRoot: string;\n\treadonly environmentDigest: string;\n\t/** ISO-8601 instant after which the observation no longer qualifies. */\n\treadonly validUntil?: string;\n\treadonly invalidationKeys?: readonly string[];\n\t/** Witnesses sharing a group count once
|
|
1
|
+
{"version":3,"file":"claim-types.js","sourceRoot":"","sources":["../../src/claims/claim-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAG,oBAA6B,CAAC;AAgBxE,MAAM,CAAC,MAAM,sBAAsB,GAAgD;IAClF,uBAAuB,EAAE,CAAC;IAC1B,mBAAmB,EAAE,CAAC;IACtB,iBAAiB,EAAE,CAAC;IACpB,qBAAqB,EAAE,CAAC;IACxB,kBAAkB,EAAE,CAAC;IACrB,WAAW,EAAE,CAAC;IACd,eAAe,EAAE,CAAC;CAClB,CAAC;AAaF,kEAAkE;AAClE,MAAM,CAAC,MAAM,wBAAwB,GAA4B;IAChE,UAAU;IACV,OAAO;IACP,kBAAkB;IAClB,oBAAoB;IACpB,SAAS;IACT,QAAQ;IACR,WAAW;CACX,CAAC","sourcesContent":["/**\n * Claim Closure Graph V1 vocabulary.\n *\n * The flat `TaskSpec.claims` model answers \"did this attempt satisfy its\n * predicates?\". The closure graph answers the stricter question a verified\n * verdict needs: are all required claims closed by *qualified* witnesses —\n * bound to this source root and environment, not expired, from a source the\n * claim's policy trusts, independent enough to count separately — with no\n * counterexample, no unresolved side effect, and a complete workspace scope?\n *\n * Pure vocabulary: no behaviour, no I/O, no clock. Evaluation lives in\n * `claim-closure.ts`, structure checks in `claim-graph.ts`.\n */\n\nexport const CLAIM_GRAPH_SCHEMA_VERSION = \"omk.claim-graph.v1\" as const;\n\nexport type ClaimNodeKind = \"requirement\" | \"safety\" | \"scope\" | \"quality\" | \"performance\" | \"release\";\nexport type ClaimSeverity = \"required\" | \"advisory\";\nexport type ClaimRule = \"all\" | \"any\";\n\n/** Trust lattice, highest first. A claim's `trustFloor` names the weakest source that may witness it. */\nexport type ObservationSource =\n\t| \"deterministic_validator\"\n\t| \"trusted_attestation\"\n\t| \"workspace_witness\"\n\t| \"effect_reconciliation\"\n\t| \"independent_review\"\n\t| \"self_review\"\n\t| \"model_narrative\";\n\nexport const OBSERVATION_TRUST_RANK: Readonly<Record<ObservationSource, number>> = {\n\tdeterministic_validator: 6,\n\ttrusted_attestation: 5,\n\tworkspace_witness: 4,\n\teffect_reconciliation: 4,\n\tindependent_review: 3,\n\tself_review: 2,\n\tmodel_narrative: 1,\n};\n\nexport type ObservationPolarity = \"supports\" | \"violates\";\n\nexport type ClaimVerdict =\n\t| \"satisfied\"\n\t| \"violated\"\n\t| \"missing\"\n\t| \"stale\"\n\t| \"incomplete_scope\"\n\t| \"insufficient_trust\"\n\t| \"waived\";\n\n/** Precedence when several verdicts compete; lower index wins. */\nexport const CLAIM_VERDICT_PRECEDENCE: readonly ClaimVerdict[] = [\n\t\"violated\",\n\t\"stale\",\n\t\"incomplete_scope\",\n\t\"insufficient_trust\",\n\t\"missing\",\n\t\"waived\",\n\t\"satisfied\",\n];\n\nexport type WorkspaceCompleteness = \"complete\" | \"partial_excluded\" | \"partial_truncated\" | \"unknown\";\n\nexport type VerificationVerdict = \"verified\" | \"unverified\" | \"inconclusive\" | \"violated\";\n\nexport interface ClaimNode {\n\treadonly claimId: string;\n\treadonly kind: ClaimNodeKind;\n\treadonly statement: string;\n\treadonly severity: ClaimSeverity;\n\t/** `inputs` are child claim ids. An empty list makes this a leaf witnessed by observations. */\n\treadonly satisfaction: { readonly rule: ClaimRule; readonly inputs: readonly string[] };\n\treadonly trustFloor: ObservationSource;\n\t/** Distinct independence groups a leaf needs among its qualified supporting witnesses. Default 1. */\n\treadonly requiredWitnesses?: number;\n\t/** Blocked with `incomplete_scope` whenever the workspace witness is not complete. */\n\treadonly scopeSensitive?: boolean;\n\t/** Keys a witness must have attested to; any missing key makes the witness stale for this claim. */\n\treadonly invalidationKeys: readonly string[];\n}\n\nexport interface ObservationNode {\n\treadonly observationId: string;\n\treadonly claimIds: readonly string[];\n\treadonly polarity: ObservationPolarity;\n\treadonly source: ObservationSource;\n\treadonly receiptId?: string;\n\treadonly sourceRoot: string;\n\treadonly environmentDigest: string;\n\t/** ISO-8601 instant after which the observation no longer qualifies. */\n\treadonly validUntil?: string;\n\treadonly invalidationKeys?: readonly string[];\n\t/** Witnesses sharing a group count once. The explicit-groups policy requires this for multi-witness claims. */\n\treadonly independenceGroup?: string;\n}\n\nexport interface WaiverNode {\n\treadonly waiverId: string;\n\treadonly claimId: string;\n\treadonly issuer: string;\n\treadonly reason: string;\n\treadonly sourceRoot: string;\n\treadonly expiresAt: string;\n}\n\nexport interface ClaimGraph {\n\treadonly schemaVersion: typeof CLAIM_GRAPH_SCHEMA_VERSION;\n\treadonly claims: readonly ClaimNode[];\n}\n\nexport type WitnessIndependencePolicy = \"legacy-observation-id\" | \"explicit-groups\";\n\nexport interface ProofClosureInput {\n\treadonly graph: ClaimGraph;\n\treadonly observations: readonly ObservationNode[];\n\t/** Compatibility default: legacy-observation-id. Strong profiles must opt into explicit-groups. */\n\treadonly witnessIndependence?: WitnessIndependencePolicy;\n\treadonly waivers: readonly WaiverNode[];\n\treadonly sourceRoot: string;\n\treadonly environmentDigest: string;\n\treadonly workspaceCompleteness: WorkspaceCompleteness;\n\treadonly unresolvedEffectIds: readonly string[];\n\t/** ISO-8601 evaluation instant; injected so evaluation never reads a clock. */\n\treadonly now: string;\n}\n\nexport type ClaimReasonCode =\n\t| \"claim.satisfied\"\n\t| \"claim.violated\"\n\t| \"claim.missing\"\n\t| \"claim.stale\"\n\t| \"claim.incomplete_scope\"\n\t| \"claim.insufficient_trust\"\n\t| \"claim.waived\";\n\nexport interface ClaimClosureEvaluation {\n\treadonly claimId: string;\n\treadonly severity: ClaimSeverity;\n\treadonly verdict: ClaimVerdict;\n\treadonly reasonCode: ClaimReasonCode;\n\t/** Qualified observations that decided the verdict (violations, or counted witnesses). */\n\treadonly observationIds: readonly string[];\n\treadonly waiverId?: string;\n\t/** Distinguish local obligations from a verdict derived only from children. */\n\treadonly blockingOrigin?: \"local\" | \"children\";\n}\n\nexport interface BlockingCutExplanation {\n\treadonly claimIds: readonly string[];\n\treadonly algorithm: \"exact-antichain\" | \"greedy\";\n\t/** Minimum cardinality in this repair model only; fallback has no minimality guarantee. */\n\treadonly optimality: \"minimum\" | \"not-proven\";\n\treadonly truncated: boolean;\n\treadonly exploredStates: number;\n\t/** Selected composite-local obligations that child repairs alone cannot resolve. */\n\treadonly localClaimIds: readonly string[];\n}\n\nexport interface ProofClosureResult {\n\treadonly verdict: VerificationVerdict;\n\treadonly witnessIndependence?: WitnessIndependencePolicy;\n\treadonly claimEvaluations: readonly ClaimClosureEvaluation[];\n\t/** Required claims that are not closed, in evaluation order. */\n\treadonly blockingClaimIds: readonly string[];\n\t/** Compatibility projection; consult blockingCut for bounded-search optimality and local causes. */\n\treadonly minimalBlockingCut: readonly string[];\n\t/** Explanation only; never overrides the closure verdict or unresolved global effects. */\n\treadonly blockingCut?: BlockingCutExplanation;\n\treadonly unresolvedEffectIds: readonly string[];\n\treadonly workspaceCompleteness: WorkspaceCompleteness;\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
export { isBlockingVerdict, minimalBlockingCut } from "./claims/claim-blocking-cut.ts";
|
|
1
|
+
export { explainBlockingCut, isBlockingVerdict, MAX_BLOCKING_CUT_CANDIDATES, minimalBlockingCut, } from "./claims/claim-blocking-cut.ts";
|
|
2
2
|
export { evaluateProofClosure } from "./claims/claim-closure.ts";
|
|
3
3
|
export { ClaimGraphError, canonicalClaimGraph, rootClaimIds, topologicalClaimOrder, validateClaimGraph, } from "./claims/claim-graph.ts";
|
|
4
|
-
export { CLAIM_GRAPH_SCHEMA_VERSION, CLAIM_VERDICT_PRECEDENCE, type ClaimClosureEvaluation, type ClaimGraph, type ClaimNode, type ClaimNodeKind, type ClaimRule, type ClaimSeverity, type ClaimVerdict, OBSERVATION_TRUST_RANK, type ObservationNode, type ObservationPolarity, type ObservationSource, type ProofClosureInput, type ProofClosureResult, type VerificationVerdict, type WaiverNode, type WorkspaceCompleteness, } from "./claims/claim-types.ts";
|
|
4
|
+
export { type BlockingCutExplanation, CLAIM_GRAPH_SCHEMA_VERSION, CLAIM_VERDICT_PRECEDENCE, type ClaimClosureEvaluation, type ClaimGraph, type ClaimNode, type ClaimNodeKind, type ClaimRule, type ClaimSeverity, type ClaimVerdict, OBSERVATION_TRUST_RANK, type ObservationNode, type ObservationPolarity, type ObservationSource, type ProofClosureInput, type ProofClosureResult, type VerificationVerdict, type WaiverNode, type WitnessIndependencePolicy, type WorkspaceCompleteness, } from "./claims/claim-types.ts";
|
|
5
5
|
export { reduceRuntimeDecision } from "./decision.ts";
|
|
6
6
|
export { evaluateTask, ProtocolInvariantError } from "./evaluation.ts";
|
|
7
|
+
export { parseRunContract, parseRunStartCommand, type RunCheck, type RunContract, RunContractError, type RunPhaseBudget, type RunScriptedWriter, type RunStartCommand, VERIFIED_COMMAND_VERSION, VERIFIED_RUN_VERSION, } from "./run-contract.ts";
|
|
8
|
+
export { MAX_RUN_DAG_TASKS, MAX_RUN_TASK_ATTEMPTS, orderRunDag, type RunDagTask, type RunDagWriter, runDagAncestors, } from "./run-dag.ts";
|
|
9
|
+
export { MAX_VERIFIED_RUN_GENERATIONS, parseRunResumeCommand, type RunResumeCommand } from "./run-resume.ts";
|
|
10
|
+
export { parseRunTaskRetryCommand, type RunTaskRetryCommand } from "./run-task-retry.ts";
|
|
11
|
+
export { parseRunWriterRestartCommand, type RunWriterRestartCommand } from "./run-writer-restart.ts";
|
|
7
12
|
export type { AllCondition, AnyCondition, AttemptExecutor, AttemptOutcome, AttemptTrigger, ClaimCondition, ClaimEvaluation, ClaimPredicate, ClaimReasonCode, ClaimResult, EvaluationInput, EvaluationResult, ExecutionAttempt, JsonObject, JsonPrimitive, JsonValue, NotCondition, Observation, ObservationCondition, ProtocolVersion, RequirementLevel, RuntimeAction, RuntimeDecision, RuntimeDecisionInput, RuntimeDecisionPolicy, RuntimeDecisionReason, SemanticVerdict, TaskSpec, WaiverRecord, } from "./types.ts";
|
|
8
13
|
export { PROTOCOL_VERSION } from "./types.ts";
|
|
9
14
|
export { ProtocolValidationError, parseEvaluationResult, parseExecutionAttempt, parseObservation, parseRuntimeDecision, parseTaskSpec, parseWaiverRecord, } from "./validation.ts";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,kBAAkB,EAClB,iBAAiB,EACjB,2BAA2B,EAC3B,kBAAkB,GAClB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EACN,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,qBAAqB,EACrB,kBAAkB,GAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,KAAK,sBAAsB,EAC3B,0BAA0B,EAC1B,wBAAwB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,sBAAsB,EACtB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KA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,YAAY,CAAC;AAC9C,OAAO,EACN,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,iBAAiB,GACjB,MAAM,iBAAiB,CAAC","sourcesContent":["export {\n\texplainBlockingCut,\n\tisBlockingVerdict,\n\tMAX_BLOCKING_CUT_CANDIDATES,\n\tminimalBlockingCut,\n} from \"./claims/claim-blocking-cut.ts\";\nexport { evaluateProofClosure } from \"./claims/claim-closure.ts\";\nexport {\n\tClaimGraphError,\n\tcanonicalClaimGraph,\n\trootClaimIds,\n\ttopologicalClaimOrder,\n\tvalidateClaimGraph,\n} from \"./claims/claim-graph.ts\";\nexport {\n\ttype BlockingCutExplanation,\n\tCLAIM_GRAPH_SCHEMA_VERSION,\n\tCLAIM_VERDICT_PRECEDENCE,\n\ttype ClaimClosureEvaluation,\n\ttype ClaimGraph,\n\ttype ClaimNode,\n\ttype ClaimNodeKind,\n\ttype ClaimRule,\n\ttype ClaimSeverity,\n\ttype ClaimVerdict,\n\tOBSERVATION_TRUST_RANK,\n\ttype ObservationNode,\n\ttype ObservationPolarity,\n\ttype ObservationSource,\n\ttype ProofClosureInput,\n\ttype ProofClosureResult,\n\ttype VerificationVerdict,\n\ttype WaiverNode,\n\ttype WitnessIndependencePolicy,\n\ttype WorkspaceCompleteness,\n} from \"./claims/claim-types.ts\";\nexport { reduceRuntimeDecision } from \"./decision.ts\";\nexport { evaluateTask, ProtocolInvariantError } from \"./evaluation.ts\";\nexport {\n\tparseRunContract,\n\tparseRunStartCommand,\n\ttype RunCheck,\n\ttype RunContract,\n\tRunContractError,\n\ttype RunPhaseBudget,\n\ttype RunScriptedWriter,\n\ttype RunStartCommand,\n\tVERIFIED_COMMAND_VERSION,\n\tVERIFIED_RUN_VERSION,\n} from \"./run-contract.ts\";\nexport {\n\tMAX_RUN_DAG_TASKS,\n\tMAX_RUN_TASK_ATTEMPTS,\n\torderRunDag,\n\ttype RunDagTask,\n\ttype RunDagWriter,\n\trunDagAncestors,\n} from \"./run-dag.ts\";\nexport { MAX_VERIFIED_RUN_GENERATIONS, parseRunResumeCommand, type RunResumeCommand } from \"./run-resume.ts\";\nexport { parseRunTaskRetryCommand, type RunTaskRetryCommand } from \"./run-task-retry.ts\";\nexport { parseRunWriterRestartCommand, type RunWriterRestartCommand } from \"./run-writer-restart.ts\";\nexport type {\n\tAllCondition,\n\tAnyCondition,\n\tAttemptExecutor,\n\tAttemptOutcome,\n\tAttemptTrigger,\n\tClaimCondition,\n\tClaimEvaluation,\n\tClaimPredicate,\n\tClaimReasonCode,\n\tClaimResult,\n\tEvaluationInput,\n\tEvaluationResult,\n\tExecutionAttempt,\n\tJsonObject,\n\tJsonPrimitive,\n\tJsonValue,\n\tNotCondition,\n\tObservation,\n\tObservationCondition,\n\tProtocolVersion,\n\tRequirementLevel,\n\tRuntimeAction,\n\tRuntimeDecision,\n\tRuntimeDecisionInput,\n\tRuntimeDecisionPolicy,\n\tRuntimeDecisionReason,\n\tSemanticVerdict,\n\tTaskSpec,\n\tWaiverRecord,\n} from \"./types.ts\";\nexport { PROTOCOL_VERSION } from \"./types.ts\";\nexport {\n\tProtocolValidationError,\n\tparseEvaluationResult,\n\tparseExecutionAttempt,\n\tparseObservation,\n\tparseRuntimeDecision,\n\tparseTaskSpec,\n\tparseWaiverRecord,\n} from \"./validation.ts\";\n"]}
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
export { isBlockingVerdict, minimalBlockingCut } from "./claims/claim-blocking-cut.js";
|
|
1
|
+
export { explainBlockingCut, isBlockingVerdict, MAX_BLOCKING_CUT_CANDIDATES, minimalBlockingCut, } from "./claims/claim-blocking-cut.js";
|
|
2
2
|
export { evaluateProofClosure } from "./claims/claim-closure.js";
|
|
3
3
|
export { ClaimGraphError, canonicalClaimGraph, rootClaimIds, topologicalClaimOrder, validateClaimGraph, } from "./claims/claim-graph.js";
|
|
4
4
|
export { CLAIM_GRAPH_SCHEMA_VERSION, CLAIM_VERDICT_PRECEDENCE, OBSERVATION_TRUST_RANK, } from "./claims/claim-types.js";
|
|
5
5
|
export { reduceRuntimeDecision } from "./decision.js";
|
|
6
6
|
export { evaluateTask, ProtocolInvariantError } from "./evaluation.js";
|
|
7
|
+
export { parseRunContract, parseRunStartCommand, RunContractError, VERIFIED_COMMAND_VERSION, VERIFIED_RUN_VERSION, } from "./run-contract.js";
|
|
8
|
+
export { MAX_RUN_DAG_TASKS, MAX_RUN_TASK_ATTEMPTS, orderRunDag, runDagAncestors, } from "./run-dag.js";
|
|
9
|
+
export { MAX_VERIFIED_RUN_GENERATIONS, parseRunResumeCommand } from "./run-resume.js";
|
|
10
|
+
export { parseRunTaskRetryCommand } from "./run-task-retry.js";
|
|
11
|
+
export { parseRunWriterRestartCommand } from "./run-writer-restart.js";
|
|
7
12
|
export { PROTOCOL_VERSION } from "./types.js";
|
|
8
13
|
export { ProtocolValidationError, parseEvaluationResult, parseExecutionAttempt, parseObservation, parseRuntimeDecision, parseTaskSpec, parseWaiverRecord, } from "./validation.js";
|
|
9
14
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,kBAAkB,EAClB,iBAAiB,EACjB,2BAA2B,EAC3B,kBAAkB,GAClB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EACN,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,qBAAqB,EACrB,kBAAkB,GAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEN,0BAA0B,EAC1B,wBAAwB,EAQxB,sBAAsB,GAUtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EACN,gBAAgB,EAChB,oBAAoB,EAGpB,gBAAgB,EAIhB,wBAAwB,EACxB,oBAAoB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,iBAAiB,EACjB,qBAAqB,EACrB,WAAW,EAGX,eAAe,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,4BAA4B,EAAE,qBAAqB,EAAyB,MAAM,iBAAiB,CAAC;AAC7G,OAAO,EAAE,wBAAwB,EAA4B,MAAM,qBAAqB,CAAC;AACzF,OAAO,EAAE,4BAA4B,EAAgC,MAAM,yBAAyB,CAAC;AAgCrG,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EACN,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,iBAAiB,GACjB,MAAM,iBAAiB,CAAC","sourcesContent":["export {\n\texplainBlockingCut,\n\tisBlockingVerdict,\n\tMAX_BLOCKING_CUT_CANDIDATES,\n\tminimalBlockingCut,\n} from \"./claims/claim-blocking-cut.ts\";\nexport { evaluateProofClosure } from \"./claims/claim-closure.ts\";\nexport {\n\tClaimGraphError,\n\tcanonicalClaimGraph,\n\trootClaimIds,\n\ttopologicalClaimOrder,\n\tvalidateClaimGraph,\n} from \"./claims/claim-graph.ts\";\nexport {\n\ttype BlockingCutExplanation,\n\tCLAIM_GRAPH_SCHEMA_VERSION,\n\tCLAIM_VERDICT_PRECEDENCE,\n\ttype ClaimClosureEvaluation,\n\ttype ClaimGraph,\n\ttype ClaimNode,\n\ttype ClaimNodeKind,\n\ttype ClaimRule,\n\ttype ClaimSeverity,\n\ttype ClaimVerdict,\n\tOBSERVATION_TRUST_RANK,\n\ttype ObservationNode,\n\ttype ObservationPolarity,\n\ttype ObservationSource,\n\ttype ProofClosureInput,\n\ttype ProofClosureResult,\n\ttype VerificationVerdict,\n\ttype WaiverNode,\n\ttype WitnessIndependencePolicy,\n\ttype WorkspaceCompleteness,\n} from \"./claims/claim-types.ts\";\nexport { reduceRuntimeDecision } from \"./decision.ts\";\nexport { evaluateTask, ProtocolInvariantError } from \"./evaluation.ts\";\nexport {\n\tparseRunContract,\n\tparseRunStartCommand,\n\ttype RunCheck,\n\ttype RunContract,\n\tRunContractError,\n\ttype RunPhaseBudget,\n\ttype RunScriptedWriter,\n\ttype RunStartCommand,\n\tVERIFIED_COMMAND_VERSION,\n\tVERIFIED_RUN_VERSION,\n} from \"./run-contract.ts\";\nexport {\n\tMAX_RUN_DAG_TASKS,\n\tMAX_RUN_TASK_ATTEMPTS,\n\torderRunDag,\n\ttype RunDagTask,\n\ttype RunDagWriter,\n\trunDagAncestors,\n} from \"./run-dag.ts\";\nexport { MAX_VERIFIED_RUN_GENERATIONS, parseRunResumeCommand, type RunResumeCommand } from \"./run-resume.ts\";\nexport { parseRunTaskRetryCommand, type RunTaskRetryCommand } from \"./run-task-retry.ts\";\nexport { parseRunWriterRestartCommand, type RunWriterRestartCommand } from \"./run-writer-restart.ts\";\nexport type {\n\tAllCondition,\n\tAnyCondition,\n\tAttemptExecutor,\n\tAttemptOutcome,\n\tAttemptTrigger,\n\tClaimCondition,\n\tClaimEvaluation,\n\tClaimPredicate,\n\tClaimReasonCode,\n\tClaimResult,\n\tEvaluationInput,\n\tEvaluationResult,\n\tExecutionAttempt,\n\tJsonObject,\n\tJsonPrimitive,\n\tJsonValue,\n\tNotCondition,\n\tObservation,\n\tObservationCondition,\n\tProtocolVersion,\n\tRequirementLevel,\n\tRuntimeAction,\n\tRuntimeDecision,\n\tRuntimeDecisionInput,\n\tRuntimeDecisionPolicy,\n\tRuntimeDecisionReason,\n\tSemanticVerdict,\n\tTaskSpec,\n\tWaiverRecord,\n} from \"./types.ts\";\nexport { PROTOCOL_VERSION } from \"./types.ts\";\nexport {\n\tProtocolValidationError,\n\tparseEvaluationResult,\n\tparseExecutionAttempt,\n\tparseObservation,\n\tparseRuntimeDecision,\n\tparseTaskSpec,\n\tparseWaiverRecord,\n} from \"./validation.ts\";\n"]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type RunDagWriter } from "./run-dag.ts";
|
|
2
|
+
export { RunContractError } from "./run-parsing.ts";
|
|
3
|
+
export declare const VERIFIED_RUN_VERSION: "omk.verified-run.v1";
|
|
4
|
+
export declare const VERIFIED_COMMAND_VERSION: "omk.verified-command.v1";
|
|
5
|
+
interface RunContractFields {
|
|
6
|
+
readonly schemaVersion: typeof VERIFIED_RUN_VERSION;
|
|
7
|
+
readonly runId: string;
|
|
8
|
+
readonly goal: string;
|
|
9
|
+
readonly workspace: {
|
|
10
|
+
readonly root: string;
|
|
11
|
+
readonly baseDigest: string;
|
|
12
|
+
};
|
|
13
|
+
readonly writablePaths: readonly string[];
|
|
14
|
+
readonly checks: readonly RunCheck[];
|
|
15
|
+
readonly budget: RunPhaseBudget;
|
|
16
|
+
readonly apply: "artifact-only";
|
|
17
|
+
}
|
|
18
|
+
export interface RunScriptedWriter {
|
|
19
|
+
readonly kind: "scripted-agent";
|
|
20
|
+
readonly steps: readonly (readonly string[])[];
|
|
21
|
+
readonly maxRequests: number;
|
|
22
|
+
}
|
|
23
|
+
export type RunContract = RunContractFields & ({
|
|
24
|
+
readonly profile: "linux-command-v1";
|
|
25
|
+
readonly writer: readonly string[];
|
|
26
|
+
} | {
|
|
27
|
+
readonly profile: "linux-scripted-agent-v1";
|
|
28
|
+
readonly writer: RunScriptedWriter;
|
|
29
|
+
} | {
|
|
30
|
+
readonly profile: "linux-command-dag-v1";
|
|
31
|
+
readonly writer: RunDagWriter;
|
|
32
|
+
});
|
|
33
|
+
export interface RunCheck {
|
|
34
|
+
readonly claimId: string;
|
|
35
|
+
readonly argv: readonly string[];
|
|
36
|
+
readonly stdout: string;
|
|
37
|
+
}
|
|
38
|
+
export interface RunPhaseBudget {
|
|
39
|
+
readonly workMs: number;
|
|
40
|
+
readonly verifyMs: number;
|
|
41
|
+
readonly cleanupMs: number;
|
|
42
|
+
readonly maxOutputBytes: number;
|
|
43
|
+
readonly maxFiles: number;
|
|
44
|
+
readonly maxBytes: number;
|
|
45
|
+
}
|
|
46
|
+
export interface RunStartCommand {
|
|
47
|
+
readonly schemaVersion: typeof VERIFIED_COMMAND_VERSION;
|
|
48
|
+
readonly kind: "start";
|
|
49
|
+
readonly runId: string;
|
|
50
|
+
readonly commandId: string;
|
|
51
|
+
readonly expectedRevision: 0;
|
|
52
|
+
readonly expectedGeneration: 0;
|
|
53
|
+
readonly contractDigest: string;
|
|
54
|
+
}
|
|
55
|
+
export declare function parseRunContract(value: unknown): RunContract;
|
|
56
|
+
/** Parsing is not approval. The coordinator requires approval via its trusted host call. */
|
|
57
|
+
export declare function parseRunStartCommand(value: unknown): RunStartCommand;
|
|
58
|
+
//# sourceMappingURL=run-contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-contract.d.ts","sourceRoot":"","sources":["../src/run-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAcpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,eAAO,MAAM,oBAAoB,uBAAiC,CAAC;AACnE,eAAO,MAAM,wBAAwB,2BAAqC,CAAC;AAE3E,UAAU,iBAAiB;IAC1B,QAAQ,CAAC,aAAa,EAAE,OAAO,oBAAoB,CAAC;IACpD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3E,QAAQ,CAAC,aAAa,EAAE,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,WAAW,eAAe;IAC/B,QAAQ,CAAC,aAAa,EAAE,OAAO,wBAAwB,CAAC;IACxD,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC7B,QAAQ,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAC/B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CAChC;AAQD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,CAuE5D;AAED,4FAA4F;AAC5F,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CA0BpE","sourcesContent":["import { parseRunDagWriter, type RunDagWriter } from \"./run-dag.ts\";\nimport {\n\tRunContractError,\n\trunAbsolutePath,\n\trunArgv,\n\trunArray,\n\trunDigest,\n\trunId,\n\trunLimit,\n\trunObject,\n\trunRelativePath,\n\trunText,\n} from \"./run-parsing.ts\";\n\nexport { RunContractError } from \"./run-parsing.ts\";\nexport const VERIFIED_RUN_VERSION = \"omk.verified-run.v1\" as const;\nexport const VERIFIED_COMMAND_VERSION = \"omk.verified-command.v1\" as const;\n\ninterface RunContractFields {\n\treadonly schemaVersion: typeof VERIFIED_RUN_VERSION;\n\treadonly runId: string;\n\treadonly goal: string;\n\treadonly workspace: { readonly root: string; readonly baseDigest: string };\n\treadonly writablePaths: readonly string[];\n\treadonly checks: readonly RunCheck[];\n\treadonly budget: RunPhaseBudget;\n\treadonly apply: \"artifact-only\";\n}\nexport interface RunScriptedWriter {\n\treadonly kind: \"scripted-agent\";\n\treadonly steps: readonly (readonly string[])[];\n\treadonly maxRequests: number;\n}\nexport type RunContract = RunContractFields &\n\t(\n\t\t| { readonly profile: \"linux-command-v1\"; readonly writer: readonly string[] }\n\t\t| { readonly profile: \"linux-scripted-agent-v1\"; readonly writer: RunScriptedWriter }\n\t\t| { readonly profile: \"linux-command-dag-v1\"; readonly writer: RunDagWriter }\n\t);\nexport interface RunCheck {\n\treadonly claimId: string;\n\treadonly argv: readonly string[];\n\treadonly stdout: string;\n}\nexport interface RunPhaseBudget {\n\treadonly workMs: number;\n\treadonly verifyMs: number;\n\treadonly cleanupMs: number;\n\treadonly maxOutputBytes: number;\n\treadonly maxFiles: number;\n\treadonly maxBytes: number;\n}\nexport interface RunStartCommand {\n\treadonly schemaVersion: typeof VERIFIED_COMMAND_VERSION;\n\treadonly kind: \"start\";\n\treadonly runId: string;\n\treadonly commandId: string;\n\treadonly expectedRevision: 0;\n\treadonly expectedGeneration: 0;\n\treadonly contractDigest: string;\n}\n\nfunction check(value: unknown): RunCheck {\n\tconst input = runObject(value, [\"claimId\", \"argv\", \"stdout\"]);\n\tif (typeof input.stdout !== \"string\" || input.stdout.length > 65536) throw new RunContractError(\"stdout\");\n\treturn Object.freeze({ claimId: runId(input.claimId), argv: runArgv(input.argv), stdout: input.stdout });\n}\n\nexport function parseRunContract(value: unknown): RunContract {\n\tconst input = runObject(value, [\n\t\t\"schemaVersion\",\n\t\t\"profile\",\n\t\t\"runId\",\n\t\t\"goal\",\n\t\t\"workspace\",\n\t\t\"writablePaths\",\n\t\t\"writer\",\n\t\t\"checks\",\n\t\t\"budget\",\n\t\t\"apply\",\n\t]);\n\tif (input.schemaVersion !== VERIFIED_RUN_VERSION || input.apply !== \"artifact-only\")\n\t\tthrow new RunContractError(\"version/profile/apply\");\n\tconst workspace = runObject(input.workspace, [\"root\", \"baseDigest\"]);\n\tconst budget = runObject(input.budget, [\n\t\t\"workMs\",\n\t\t\"verifyMs\",\n\t\t\"cleanupMs\",\n\t\t\"maxOutputBytes\",\n\t\t\"maxFiles\",\n\t\t\"maxBytes\",\n\t]);\n\tconst checks = runArray(input.checks, check, 32);\n\tif (new Set(checks.map((item) => item.claimId)).size !== checks.length)\n\t\tthrow new RunContractError(\"duplicate claim\");\n\tconst writablePaths = runArray(input.writablePaths, runRelativePath, 128);\n\tif (new Set(writablePaths).size !== writablePaths.length) throw new RunContractError(\"duplicate path\");\n\tconst fields: RunContractFields = {\n\t\tschemaVersion: VERIFIED_RUN_VERSION,\n\t\trunId: runId(input.runId),\n\t\tgoal: runText(input.goal, \"goal\", 16384),\n\t\tworkspace: Object.freeze({ root: runAbsolutePath(workspace.root), baseDigest: runDigest(workspace.baseDigest) }),\n\t\twritablePaths,\n\t\tchecks,\n\t\tapply: \"artifact-only\",\n\t\tbudget: Object.freeze({\n\t\t\tworkMs: runLimit(budget.workMs, \"workMs\"),\n\t\t\tverifyMs: runLimit(budget.verifyMs, \"verifyMs\"),\n\t\t\tcleanupMs: runLimit(budget.cleanupMs, \"cleanupMs\"),\n\t\t\tmaxOutputBytes: runLimit(budget.maxOutputBytes, \"maxOutputBytes\", 1048576),\n\t\t\tmaxFiles: runLimit(budget.maxFiles, \"maxFiles\", 10000),\n\t\t\tmaxBytes: runLimit(budget.maxBytes, \"maxBytes\", 104857600),\n\t\t}),\n\t};\n\tswitch (input.profile) {\n\t\tcase \"linux-command-v1\":\n\t\t\treturn Object.freeze({ ...fields, profile: input.profile, writer: runArgv(input.writer) });\n\t\tcase \"linux-command-dag-v1\":\n\t\t\treturn Object.freeze({\n\t\t\t\t...fields,\n\t\t\t\tprofile: input.profile,\n\t\t\t\twriter: parseRunDagWriter(input.writer, writablePaths),\n\t\t\t});\n\t\tcase \"linux-scripted-agent-v1\": {\n\t\t\tconst writer = runObject(input.writer, [\"kind\", \"steps\", \"maxRequests\"]);\n\t\t\tif (writer.kind !== \"scripted-agent\") throw new RunContractError(\"writer.kind\");\n\t\t\treturn Object.freeze({\n\t\t\t\t...fields,\n\t\t\t\tprofile: input.profile,\n\t\t\t\twriter: Object.freeze({\n\t\t\t\t\tkind: writer.kind,\n\t\t\t\t\tsteps: runArray(writer.steps, runArgv, 16),\n\t\t\t\t\tmaxRequests: runLimit(writer.maxRequests, \"maxRequests\", 32),\n\t\t\t\t}),\n\t\t\t});\n\t\t}\n\t\tdefault:\n\t\t\tthrow new RunContractError(\"version/profile/apply\");\n\t}\n}\n\n/** Parsing is not approval. The coordinator requires approval via its trusted host call. */\nexport function parseRunStartCommand(value: unknown): RunStartCommand {\n\tconst input = runObject(value, [\n\t\t\"schemaVersion\",\n\t\t\"kind\",\n\t\t\"runId\",\n\t\t\"commandId\",\n\t\t\"expectedRevision\",\n\t\t\"expectedGeneration\",\n\t\t\"contractDigest\",\n\t]);\n\tif (\n\t\tinput.schemaVersion !== VERIFIED_COMMAND_VERSION ||\n\t\tinput.kind !== \"start\" ||\n\t\tinput.expectedRevision !== 0 ||\n\t\tinput.expectedGeneration !== 0\n\t)\n\t\tthrow new RunContractError(\"command version/kind/precondition\");\n\treturn Object.freeze({\n\t\tschemaVersion: VERIFIED_COMMAND_VERSION,\n\t\tkind: \"start\",\n\t\trunId: runId(input.runId),\n\t\tcommandId: runId(input.commandId),\n\t\texpectedRevision: 0,\n\t\texpectedGeneration: 0,\n\t\tcontractDigest: runDigest(input.contractDigest),\n\t});\n}\n"]}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { parseRunDagWriter } from "./run-dag.js";
|
|
2
|
+
import { RunContractError, runAbsolutePath, runArgv, runArray, runDigest, runId, runLimit, runObject, runRelativePath, runText, } from "./run-parsing.js";
|
|
3
|
+
export { RunContractError } from "./run-parsing.js";
|
|
4
|
+
export const VERIFIED_RUN_VERSION = "omk.verified-run.v1";
|
|
5
|
+
export const VERIFIED_COMMAND_VERSION = "omk.verified-command.v1";
|
|
6
|
+
function check(value) {
|
|
7
|
+
const input = runObject(value, ["claimId", "argv", "stdout"]);
|
|
8
|
+
if (typeof input.stdout !== "string" || input.stdout.length > 65536)
|
|
9
|
+
throw new RunContractError("stdout");
|
|
10
|
+
return Object.freeze({ claimId: runId(input.claimId), argv: runArgv(input.argv), stdout: input.stdout });
|
|
11
|
+
}
|
|
12
|
+
export function parseRunContract(value) {
|
|
13
|
+
const input = runObject(value, [
|
|
14
|
+
"schemaVersion",
|
|
15
|
+
"profile",
|
|
16
|
+
"runId",
|
|
17
|
+
"goal",
|
|
18
|
+
"workspace",
|
|
19
|
+
"writablePaths",
|
|
20
|
+
"writer",
|
|
21
|
+
"checks",
|
|
22
|
+
"budget",
|
|
23
|
+
"apply",
|
|
24
|
+
]);
|
|
25
|
+
if (input.schemaVersion !== VERIFIED_RUN_VERSION || input.apply !== "artifact-only")
|
|
26
|
+
throw new RunContractError("version/profile/apply");
|
|
27
|
+
const workspace = runObject(input.workspace, ["root", "baseDigest"]);
|
|
28
|
+
const budget = runObject(input.budget, [
|
|
29
|
+
"workMs",
|
|
30
|
+
"verifyMs",
|
|
31
|
+
"cleanupMs",
|
|
32
|
+
"maxOutputBytes",
|
|
33
|
+
"maxFiles",
|
|
34
|
+
"maxBytes",
|
|
35
|
+
]);
|
|
36
|
+
const checks = runArray(input.checks, check, 32);
|
|
37
|
+
if (new Set(checks.map((item) => item.claimId)).size !== checks.length)
|
|
38
|
+
throw new RunContractError("duplicate claim");
|
|
39
|
+
const writablePaths = runArray(input.writablePaths, runRelativePath, 128);
|
|
40
|
+
if (new Set(writablePaths).size !== writablePaths.length)
|
|
41
|
+
throw new RunContractError("duplicate path");
|
|
42
|
+
const fields = {
|
|
43
|
+
schemaVersion: VERIFIED_RUN_VERSION,
|
|
44
|
+
runId: runId(input.runId),
|
|
45
|
+
goal: runText(input.goal, "goal", 16384),
|
|
46
|
+
workspace: Object.freeze({ root: runAbsolutePath(workspace.root), baseDigest: runDigest(workspace.baseDigest) }),
|
|
47
|
+
writablePaths,
|
|
48
|
+
checks,
|
|
49
|
+
apply: "artifact-only",
|
|
50
|
+
budget: Object.freeze({
|
|
51
|
+
workMs: runLimit(budget.workMs, "workMs"),
|
|
52
|
+
verifyMs: runLimit(budget.verifyMs, "verifyMs"),
|
|
53
|
+
cleanupMs: runLimit(budget.cleanupMs, "cleanupMs"),
|
|
54
|
+
maxOutputBytes: runLimit(budget.maxOutputBytes, "maxOutputBytes", 1048576),
|
|
55
|
+
maxFiles: runLimit(budget.maxFiles, "maxFiles", 10000),
|
|
56
|
+
maxBytes: runLimit(budget.maxBytes, "maxBytes", 104857600),
|
|
57
|
+
}),
|
|
58
|
+
};
|
|
59
|
+
switch (input.profile) {
|
|
60
|
+
case "linux-command-v1":
|
|
61
|
+
return Object.freeze({ ...fields, profile: input.profile, writer: runArgv(input.writer) });
|
|
62
|
+
case "linux-command-dag-v1":
|
|
63
|
+
return Object.freeze({
|
|
64
|
+
...fields,
|
|
65
|
+
profile: input.profile,
|
|
66
|
+
writer: parseRunDagWriter(input.writer, writablePaths),
|
|
67
|
+
});
|
|
68
|
+
case "linux-scripted-agent-v1": {
|
|
69
|
+
const writer = runObject(input.writer, ["kind", "steps", "maxRequests"]);
|
|
70
|
+
if (writer.kind !== "scripted-agent")
|
|
71
|
+
throw new RunContractError("writer.kind");
|
|
72
|
+
return Object.freeze({
|
|
73
|
+
...fields,
|
|
74
|
+
profile: input.profile,
|
|
75
|
+
writer: Object.freeze({
|
|
76
|
+
kind: writer.kind,
|
|
77
|
+
steps: runArray(writer.steps, runArgv, 16),
|
|
78
|
+
maxRequests: runLimit(writer.maxRequests, "maxRequests", 32),
|
|
79
|
+
}),
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
default:
|
|
83
|
+
throw new RunContractError("version/profile/apply");
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/** Parsing is not approval. The coordinator requires approval via its trusted host call. */
|
|
87
|
+
export function parseRunStartCommand(value) {
|
|
88
|
+
const input = runObject(value, [
|
|
89
|
+
"schemaVersion",
|
|
90
|
+
"kind",
|
|
91
|
+
"runId",
|
|
92
|
+
"commandId",
|
|
93
|
+
"expectedRevision",
|
|
94
|
+
"expectedGeneration",
|
|
95
|
+
"contractDigest",
|
|
96
|
+
]);
|
|
97
|
+
if (input.schemaVersion !== VERIFIED_COMMAND_VERSION ||
|
|
98
|
+
input.kind !== "start" ||
|
|
99
|
+
input.expectedRevision !== 0 ||
|
|
100
|
+
input.expectedGeneration !== 0)
|
|
101
|
+
throw new RunContractError("command version/kind/precondition");
|
|
102
|
+
return Object.freeze({
|
|
103
|
+
schemaVersion: VERIFIED_COMMAND_VERSION,
|
|
104
|
+
kind: "start",
|
|
105
|
+
runId: runId(input.runId),
|
|
106
|
+
commandId: runId(input.commandId),
|
|
107
|
+
expectedRevision: 0,
|
|
108
|
+
expectedGeneration: 0,
|
|
109
|
+
contractDigest: runDigest(input.contractDigest),
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=run-contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-contract.js","sourceRoot":"","sources":["../src/run-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAqB,MAAM,cAAc,CAAC;AACpE,OAAO,EACN,gBAAgB,EAChB,eAAe,EACf,OAAO,EACP,QAAQ,EACR,SAAS,EACT,KAAK,EACL,QAAQ,EACR,SAAS,EACT,eAAe,EACf,OAAO,GACP,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,MAAM,CAAC,MAAM,oBAAoB,GAAG,qBAA8B,CAAC;AACnE,MAAM,CAAC,MAAM,wBAAwB,GAAG,yBAAkC,CAAC;AA8C3E,SAAS,KAAK,CAAC,KAAc,EAAY;IACxC,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC9D,IAAI,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,KAAK;QAAE,MAAM,IAAI,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAC1G,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO,CAA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mC,CAAC,CAAC;IACjE,OAAO,MAAM,CAAC,MAAM,CAAC;QACpB,aAAa,EAAE,wBAAwB;QACvC,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;QACzB,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC;QACjC,gBAAgB,EAAE,CAAC;QACnB,kBAAkB,EAAE,CAAC;QACrB,cAAc,EAAE,SAAS,CAAC,KAAK,CAAC,cAAc,CAAC;KAC/C,CAAC,CAAC;AAAA,CACH","sourcesContent":["import { parseRunDagWriter, type RunDagWriter } from \"./run-dag.ts\";\nimport {\n\tRunContractError,\n\trunAbsolutePath,\n\trunArgv,\n\trunArray,\n\trunDigest,\n\trunId,\n\trunLimit,\n\trunObject,\n\trunRelativePath,\n\trunText,\n} from \"./run-parsing.ts\";\n\nexport { RunContractError } from \"./run-parsing.ts\";\nexport const VERIFIED_RUN_VERSION = \"omk.verified-run.v1\" as const;\nexport const VERIFIED_COMMAND_VERSION = \"omk.verified-command.v1\" as const;\n\ninterface RunContractFields {\n\treadonly schemaVersion: typeof VERIFIED_RUN_VERSION;\n\treadonly runId: string;\n\treadonly goal: string;\n\treadonly workspace: { readonly root: string; readonly baseDigest: string };\n\treadonly writablePaths: readonly string[];\n\treadonly checks: readonly RunCheck[];\n\treadonly budget: RunPhaseBudget;\n\treadonly apply: \"artifact-only\";\n}\nexport interface RunScriptedWriter {\n\treadonly kind: \"scripted-agent\";\n\treadonly steps: readonly (readonly string[])[];\n\treadonly maxRequests: number;\n}\nexport type RunContract = RunContractFields &\n\t(\n\t\t| { readonly profile: \"linux-command-v1\"; readonly writer: readonly string[] }\n\t\t| { readonly profile: \"linux-scripted-agent-v1\"; readonly writer: RunScriptedWriter }\n\t\t| { readonly profile: \"linux-command-dag-v1\"; readonly writer: RunDagWriter }\n\t);\nexport interface RunCheck {\n\treadonly claimId: string;\n\treadonly argv: readonly string[];\n\treadonly stdout: string;\n}\nexport interface RunPhaseBudget {\n\treadonly workMs: number;\n\treadonly verifyMs: number;\n\treadonly cleanupMs: number;\n\treadonly maxOutputBytes: number;\n\treadonly maxFiles: number;\n\treadonly maxBytes: number;\n}\nexport interface RunStartCommand {\n\treadonly schemaVersion: typeof VERIFIED_COMMAND_VERSION;\n\treadonly kind: \"start\";\n\treadonly runId: string;\n\treadonly commandId: string;\n\treadonly expectedRevision: 0;\n\treadonly expectedGeneration: 0;\n\treadonly contractDigest: string;\n}\n\nfunction check(value: unknown): RunCheck {\n\tconst input = runObject(value, [\"claimId\", \"argv\", \"stdout\"]);\n\tif (typeof input.stdout !== \"string\" || input.stdout.length > 65536) throw new RunContractError(\"stdout\");\n\treturn Object.freeze({ claimId: runId(input.claimId), argv: runArgv(input.argv), stdout: input.stdout });\n}\n\nexport function parseRunContract(value: unknown): RunContract {\n\tconst input = runObject(value, [\n\t\t\"schemaVersion\",\n\t\t\"profile\",\n\t\t\"runId\",\n\t\t\"goal\",\n\t\t\"workspace\",\n\t\t\"writablePaths\",\n\t\t\"writer\",\n\t\t\"checks\",\n\t\t\"budget\",\n\t\t\"apply\",\n\t]);\n\tif (input.schemaVersion !== VERIFIED_RUN_VERSION || input.apply !== \"artifact-only\")\n\t\tthrow new RunContractError(\"version/profile/apply\");\n\tconst workspace = runObject(input.workspace, [\"root\", \"baseDigest\"]);\n\tconst budget = runObject(input.budget, [\n\t\t\"workMs\",\n\t\t\"verifyMs\",\n\t\t\"cleanupMs\",\n\t\t\"maxOutputBytes\",\n\t\t\"maxFiles\",\n\t\t\"maxBytes\",\n\t]);\n\tconst checks = runArray(input.checks, check, 32);\n\tif (new Set(checks.map((item) => item.claimId)).size !== checks.length)\n\t\tthrow new RunContractError(\"duplicate claim\");\n\tconst writablePaths = runArray(input.writablePaths, runRelativePath, 128);\n\tif (new Set(writablePaths).size !== writablePaths.length) throw new RunContractError(\"duplicate path\");\n\tconst fields: RunContractFields = {\n\t\tschemaVersion: VERIFIED_RUN_VERSION,\n\t\trunId: runId(input.runId),\n\t\tgoal: runText(input.goal, \"goal\", 16384),\n\t\tworkspace: Object.freeze({ root: runAbsolutePath(workspace.root), baseDigest: runDigest(workspace.baseDigest) }),\n\t\twritablePaths,\n\t\tchecks,\n\t\tapply: \"artifact-only\",\n\t\tbudget: Object.freeze({\n\t\t\tworkMs: runLimit(budget.workMs, \"workMs\"),\n\t\t\tverifyMs: runLimit(budget.verifyMs, \"verifyMs\"),\n\t\t\tcleanupMs: runLimit(budget.cleanupMs, \"cleanupMs\"),\n\t\t\tmaxOutputBytes: runLimit(budget.maxOutputBytes, \"maxOutputBytes\", 1048576),\n\t\t\tmaxFiles: runLimit(budget.maxFiles, \"maxFiles\", 10000),\n\t\t\tmaxBytes: runLimit(budget.maxBytes, \"maxBytes\", 104857600),\n\t\t}),\n\t};\n\tswitch (input.profile) {\n\t\tcase \"linux-command-v1\":\n\t\t\treturn Object.freeze({ ...fields, profile: input.profile, writer: runArgv(input.writer) });\n\t\tcase \"linux-command-dag-v1\":\n\t\t\treturn Object.freeze({\n\t\t\t\t...fields,\n\t\t\t\tprofile: input.profile,\n\t\t\t\twriter: parseRunDagWriter(input.writer, writablePaths),\n\t\t\t});\n\t\tcase \"linux-scripted-agent-v1\": {\n\t\t\tconst writer = runObject(input.writer, [\"kind\", \"steps\", \"maxRequests\"]);\n\t\t\tif (writer.kind !== \"scripted-agent\") throw new RunContractError(\"writer.kind\");\n\t\t\treturn Object.freeze({\n\t\t\t\t...fields,\n\t\t\t\tprofile: input.profile,\n\t\t\t\twriter: Object.freeze({\n\t\t\t\t\tkind: writer.kind,\n\t\t\t\t\tsteps: runArray(writer.steps, runArgv, 16),\n\t\t\t\t\tmaxRequests: runLimit(writer.maxRequests, \"maxRequests\", 32),\n\t\t\t\t}),\n\t\t\t});\n\t\t}\n\t\tdefault:\n\t\t\tthrow new RunContractError(\"version/profile/apply\");\n\t}\n}\n\n/** Parsing is not approval. The coordinator requires approval via its trusted host call. */\nexport function parseRunStartCommand(value: unknown): RunStartCommand {\n\tconst input = runObject(value, [\n\t\t\"schemaVersion\",\n\t\t\"kind\",\n\t\t\"runId\",\n\t\t\"commandId\",\n\t\t\"expectedRevision\",\n\t\t\"expectedGeneration\",\n\t\t\"contractDigest\",\n\t]);\n\tif (\n\t\tinput.schemaVersion !== VERIFIED_COMMAND_VERSION ||\n\t\tinput.kind !== \"start\" ||\n\t\tinput.expectedRevision !== 0 ||\n\t\tinput.expectedGeneration !== 0\n\t)\n\t\tthrow new RunContractError(\"command version/kind/precondition\");\n\treturn Object.freeze({\n\t\tschemaVersion: VERIFIED_COMMAND_VERSION,\n\t\tkind: \"start\",\n\t\trunId: runId(input.runId),\n\t\tcommandId: runId(input.commandId),\n\t\texpectedRevision: 0,\n\t\texpectedGeneration: 0,\n\t\tcontractDigest: runDigest(input.contractDigest),\n\t});\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const MAX_RUN_DAG_TASKS = 16;
|
|
2
|
+
export declare const MAX_RUN_TASK_ATTEMPTS = 2;
|
|
3
|
+
export interface RunDagTask {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly dependsOn: readonly string[];
|
|
6
|
+
readonly writablePaths: readonly string[];
|
|
7
|
+
readonly attempts: readonly (readonly string[])[];
|
|
8
|
+
}
|
|
9
|
+
export interface RunDagWriter {
|
|
10
|
+
readonly kind: "command-dag";
|
|
11
|
+
readonly tasks: readonly RunDagTask[];
|
|
12
|
+
}
|
|
13
|
+
/** Deterministic FIFO Kahn ordering. This orders artifacts, not tool resource-conflict claims. */
|
|
14
|
+
export declare function orderRunDag(tasks: readonly RunDagTask[]): readonly RunDagTask[];
|
|
15
|
+
/** Every ancestor material is an input; unrelated successful branches are deliberately excluded. */
|
|
16
|
+
export declare function runDagAncestors(tasks: readonly RunDagTask[], taskId: string): readonly RunDagTask[];
|
|
17
|
+
export declare function parseRunDagWriter(value: unknown, writable: readonly string[]): RunDagWriter;
|
|
18
|
+
//# sourceMappingURL=run-dag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-dag.d.ts","sourceRoot":"","sources":["../src/run-dag.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC,MAAM,WAAW,UAAU;IAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC;CAClD;AACD,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,CAAC;CACtC;AAED,kGAAkG;AAClG,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,GAAG,SAAS,UAAU,EAAE,CAiB/E;AAED,oGAAoG;AACpG,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,UAAU,EAAE,CAQnG;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,YAAY,CAoC3F","sourcesContent":["import { RunContractError, runArgv, runArray, runId, runObject, runRelativePath } from \"./run-parsing.ts\";\n\nexport const MAX_RUN_DAG_TASKS = 16;\nexport const MAX_RUN_TASK_ATTEMPTS = 2;\n\nexport interface RunDagTask {\n\treadonly id: string;\n\treadonly dependsOn: readonly string[];\n\treadonly writablePaths: readonly string[];\n\treadonly attempts: readonly (readonly string[])[];\n}\nexport interface RunDagWriter {\n\treadonly kind: \"command-dag\";\n\treadonly tasks: readonly RunDagTask[];\n}\n\n/** Deterministic FIFO Kahn ordering. This orders artifacts, not tool resource-conflict claims. */\nexport function orderRunDag(tasks: readonly RunDagTask[]): readonly RunDagTask[] {\n\tconst pending = new Map(tasks.map((task) => [task.id, task.dependsOn.length]));\n\tconst ready = tasks.filter((task) => task.dependsOn.length === 0);\n\tconst ordered: RunDagTask[] = [];\n\tfor (let index = 0; index < ready.length; index++) {\n\t\tconst next = ready[index];\n\t\tordered.push(next);\n\t\tfor (const task of tasks) {\n\t\t\tif (!task.dependsOn.includes(next.id)) continue;\n\t\t\tconst count = pending.get(task.id);\n\t\t\tif (count === undefined) throw new RunContractError(\"dependency\");\n\t\t\tpending.set(task.id, count - 1);\n\t\t\tif (count === 1) ready.push(task);\n\t\t}\n\t}\n\tif (ordered.length !== tasks.length) throw new RunContractError(\"cyclic dependency\");\n\treturn Object.freeze(ordered);\n}\n\n/** Every ancestor material is an input; unrelated successful branches are deliberately excluded. */\nexport function runDagAncestors(tasks: readonly RunDagTask[], taskId: string): readonly RunDagTask[] {\n\tif (!tasks.some((task) => task.id === taskId)) throw new RunContractError(\"taskId\");\n\tconst order = orderRunDag(tasks);\n\tconst included = new Set([taskId]);\n\tfor (const task of [...order].reverse()) {\n\t\tif (included.has(task.id)) for (const id of task.dependsOn) included.add(id);\n\t}\n\treturn Object.freeze(order.filter((task) => task.id !== taskId && included.has(task.id)));\n}\n\nexport function parseRunDagWriter(value: unknown, writable: readonly string[]): RunDagWriter {\n\tconst raw = runObject(value, [\"kind\", \"tasks\"]);\n\tif (raw.kind !== \"command-dag\") throw new RunContractError(\"writer.kind\");\n\tconst tasks = runArray(\n\t\traw.tasks,\n\t\t(value): RunDagTask => {\n\t\t\tconst task = runObject(value, [\"id\", \"dependsOn\", \"writablePaths\", \"attempts\"]);\n\t\t\tconst dependsOn =\n\t\t\t\tArray.isArray(task.dependsOn) && task.dependsOn.length === 0\n\t\t\t\t\t? Object.freeze([])\n\t\t\t\t\t: runArray(task.dependsOn, runId, MAX_RUN_DAG_TASKS);\n\t\t\tif (new Set(dependsOn).size !== dependsOn.length) throw new RunContractError(\"duplicate dependency\");\n\t\t\treturn Object.freeze({\n\t\t\t\tid: runId(task.id),\n\t\t\t\tdependsOn,\n\t\t\t\twritablePaths: runArray(task.writablePaths, runRelativePath, 128),\n\t\t\t\tattempts: runArray(task.attempts, runArgv, MAX_RUN_TASK_ATTEMPTS),\n\t\t\t});\n\t\t},\n\t\tMAX_RUN_DAG_TASKS,\n\t);\n\tconst ids = new Set(tasks.map((task) => task.id));\n\tif (ids.size !== tasks.length) throw new RunContractError(\"duplicate task\");\n\tconst scopes: string[] = [];\n\tfor (const task of tasks) {\n\t\tif (task.dependsOn.some((id) => id === task.id || !ids.has(id))) throw new RunContractError(\"dependency\");\n\t\tfor (const path of task.writablePaths) {\n\t\t\tif (!writable.some((scope) => path === scope || path.startsWith(`${scope}/`)))\n\t\t\t\tthrow new RunContractError(\"task scope\");\n\t\t\tif (scopes.some((scope) => path === scope || path.startsWith(`${scope}/`) || scope.startsWith(`${path}/`)))\n\t\t\t\tthrow new RunContractError(\"overlapping task scope\");\n\t\t\tscopes.push(path);\n\t\t}\n\t}\n\torderRunDag(tasks);\n\treturn Object.freeze({ kind: \"command-dag\", tasks });\n}\n"]}
|