cool-workflow 0.1.98 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (306) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.codex-plugin/plugin.json +1 -1
  3. package/README.md +11 -2
  4. package/apps/architecture-review/app.json +1 -1
  5. package/apps/architecture-review-fast/app.json +1 -1
  6. package/apps/end-to-end-golden-path/app.json +1 -1
  7. package/apps/pr-review-fix-ci/app.json +1 -1
  8. package/apps/release-cut/app.json +1 -1
  9. package/apps/research-synthesis/app.json +1 -1
  10. package/dist/cli/dispatch.js +236 -0
  11. package/dist/cli/entry.js +120 -0
  12. package/dist/cli/io.js +21 -4
  13. package/dist/cli/parseargv.js +157 -0
  14. package/dist/cli.js +6 -33
  15. package/dist/core/capability-table.js +3534 -0
  16. package/dist/core/format/help.js +314 -0
  17. package/dist/{state-explosion/format.js → core/format/state-explosion-text.js} +10 -1
  18. package/dist/core/hash.js +137 -0
  19. package/dist/core/multi-agent/candidate-scoring.js +219 -0
  20. package/dist/core/multi-agent/collaboration.js +481 -0
  21. package/dist/core/multi-agent/coordinator.js +515 -0
  22. package/dist/core/multi-agent/eval-replay.js +306 -0
  23. package/dist/core/multi-agent/runtime.js +929 -0
  24. package/dist/core/multi-agent/topology.js +298 -0
  25. package/dist/core/multi-agent/trust-policy.js +197 -0
  26. package/dist/core/pipeline/commit-gate.js +320 -0
  27. package/dist/{pipeline-contract.js → core/pipeline/contract.js} +24 -37
  28. package/dist/core/pipeline/dispatch.js +103 -0
  29. package/dist/core/pipeline/drive-decide.js +227 -0
  30. package/dist/core/pipeline/error-feedback.js +161 -0
  31. package/dist/core/pipeline/loop-expansion.js +124 -0
  32. package/dist/{result-normalize.js → core/pipeline/result-normalize.js} +14 -37
  33. package/dist/core/pipeline/runner.js +230 -0
  34. package/dist/{contract-migration.js → core/state/contract-migration.js} +68 -92
  35. package/dist/{state-migrations.js → core/state/migrations.js} +103 -96
  36. package/dist/core/state/node-projection.js +95 -0
  37. package/dist/core/state/node-snapshot.js +230 -0
  38. package/dist/core/state/run-paths.js +93 -0
  39. package/dist/{schema-validate.js → core/state/schema-validate.js} +35 -28
  40. package/dist/core/state/schema.js +50 -0
  41. package/dist/core/state/state-explosion/digest.js +243 -0
  42. package/dist/core/state/state-explosion/graph.js +527 -0
  43. package/dist/{state-explosion → core/state/state-explosion}/helpers.js +34 -3
  44. package/dist/core/state/state-explosion/report.js +187 -0
  45. package/dist/{state-explosion → core/state/state-explosion}/size.js +25 -7
  46. package/dist/{state-node.js → core/state/state-node.js} +90 -113
  47. package/dist/core/state/types.js +19 -0
  48. package/dist/{validation.js → core/state/validation.js} +64 -131
  49. package/dist/core/trust/evidence-grounding.js +134 -0
  50. package/dist/core/trust/ledger.js +199 -0
  51. package/dist/{telemetry-attestation.js → core/trust/telemetry-attestation.js} +94 -68
  52. package/dist/core/trust/telemetry-ledger.js +127 -0
  53. package/dist/core/types.js +20 -0
  54. package/dist/core/version.js +16 -0
  55. package/dist/{workflow-app-framework.js → core/workflow-apps/app-schema.js} +337 -426
  56. package/dist/mcp/dispatch.js +104 -0
  57. package/dist/mcp/server.js +144 -0
  58. package/dist/mcp-server.js +6 -84
  59. package/dist/{agent-config.js → shell/agent-config.js} +118 -71
  60. package/dist/shell/app-run-cli.js +88 -0
  61. package/dist/shell/audit-cli.js +259 -0
  62. package/dist/shell/audit-provenance.js +83 -0
  63. package/dist/shell/candidate-scoring-io.js +459 -0
  64. package/dist/shell/collaboration-io.js +264 -0
  65. package/dist/shell/commit-summary.js +104 -0
  66. package/dist/shell/commit.js +290 -0
  67. package/dist/shell/coordinator-io.js +476 -0
  68. package/dist/shell/demo-cli.js +19 -0
  69. package/dist/shell/dispatch.js +162 -0
  70. package/dist/{doctor.js → shell/doctor.js} +123 -56
  71. package/dist/shell/drive.js +873 -0
  72. package/dist/shell/error-feedback-io.js +305 -0
  73. package/dist/shell/eval-io.js +473 -0
  74. package/dist/{multi-agent-eval/format.js → shell/eval-text.js} +78 -49
  75. package/dist/{evidence-reasoning.js → shell/evidence-reasoning.js} +124 -255
  76. package/dist/shell/exec-backend-cli.js +88 -0
  77. package/dist/shell/execution-backend/agent.js +475 -0
  78. package/dist/shell/execution-backend/ci.js +15 -0
  79. package/dist/shell/execution-backend/container.js +69 -0
  80. package/dist/shell/execution-backend/envelopes.js +55 -0
  81. package/dist/shell/execution-backend/local.js +113 -0
  82. package/dist/shell/execution-backend/probes.js +175 -0
  83. package/dist/shell/execution-backend/registry.js +402 -0
  84. package/dist/shell/execution-backend/remote.js +128 -0
  85. package/dist/shell/execution-backend/types.js +11 -0
  86. package/dist/shell/feedback-cli.js +81 -0
  87. package/dist/shell/feedback-operations.js +48 -0
  88. package/dist/shell/fs-atomic.js +276 -0
  89. package/dist/shell/harness.js +98 -0
  90. package/dist/shell/ledger-cli.js +212 -0
  91. package/dist/shell/ledger-io.js +169 -0
  92. package/dist/shell/man-cli.js +89 -0
  93. package/dist/shell/metrics-cli.js +98 -0
  94. package/dist/shell/multi-agent-cli.js +1002 -0
  95. package/dist/shell/multi-agent-host.js +563 -0
  96. package/dist/shell/multi-agent-io.js +387 -0
  97. package/dist/{multi-agent-operator-ux.js → shell/multi-agent-operator-ux.js} +234 -191
  98. package/dist/shell/node-store.js +124 -0
  99. package/dist/{observability/format.js → shell/observability-format.js} +7 -1
  100. package/dist/{observability/intake.js → shell/observability-intake.js} +79 -56
  101. package/dist/{observability.js → shell/observability.js} +159 -332
  102. package/dist/{onramp.js → shell/onramp.js} +11 -0
  103. package/dist/{operator-ux/format.js → shell/operator-ux-text.js} +250 -239
  104. package/dist/shell/operator-ux.js +431 -0
  105. package/dist/shell/orchestrator.js +231 -0
  106. package/dist/shell/pipeline-cli.js +667 -0
  107. package/dist/shell/pipeline.js +217 -0
  108. package/dist/shell/reclamation-io.js +1366 -0
  109. package/dist/shell/registry-cli.js +329 -0
  110. package/dist/{remote-source.js → shell/remote-source.js} +2 -2
  111. package/dist/shell/report-cli.js +101 -0
  112. package/dist/shell/report-view-cli.js +117 -0
  113. package/dist/{orchestrator → shell}/report.js +289 -282
  114. package/dist/shell/reporter.js +62 -0
  115. package/dist/shell/run-export-cli.js +106 -0
  116. package/dist/shell/run-export.js +680 -0
  117. package/dist/shell/run-registry-io.js +1014 -0
  118. package/dist/shell/run-store.js +164 -0
  119. package/dist/{sandbox-profile.js → shell/sandbox-profile.js} +134 -95
  120. package/dist/{scheduler.js → shell/scheduler-io.js} +248 -48
  121. package/dist/shell/scheduling-io.js +311 -0
  122. package/dist/shell/state-cli.js +181 -0
  123. package/dist/shell/state-explosion-cli.js +197 -0
  124. package/dist/shell/telemetry-cli.js +85 -0
  125. package/dist/{telemetry-demo.js → shell/telemetry-demo.js} +149 -119
  126. package/dist/shell/telemetry-ledger-io.js +132 -0
  127. package/dist/{term.js → shell/term.js} +36 -46
  128. package/dist/shell/topology-io.js +361 -0
  129. package/dist/shell/trust-audit.js +471 -0
  130. package/dist/{multi-agent-trust.js → shell/trust-policy-io.js} +67 -205
  131. package/dist/shell/verifier.js +48 -0
  132. package/dist/shell/workbench-host.js +250 -0
  133. package/dist/shell/workbench-text.js +18 -0
  134. package/dist/shell/workbench.js +175 -0
  135. package/dist/shell/worker-cli.js +124 -0
  136. package/dist/shell/worker-isolation.js +852 -0
  137. package/dist/shell/workflow-app-loader.js +650 -0
  138. package/docs/agent-delegation-drive.7.md +2 -0
  139. package/docs/cli-mcp-parity.7.md +280 -219
  140. package/docs/contract-migration-tooling.7.md +2 -0
  141. package/docs/control-plane-scheduling.7.md +2 -0
  142. package/docs/durable-state-and-locking.7.md +2 -0
  143. package/docs/evidence-adoption-reasoning-chain.7.md +2 -0
  144. package/docs/execution-backends.7.md +2 -0
  145. package/docs/multi-agent-cli-mcp-surface.7.md +2 -0
  146. package/docs/multi-agent-eval-replay-harness.7.md +2 -0
  147. package/docs/multi-agent-operator-ux.7.md +2 -0
  148. package/docs/node-snapshot-diff-replay.7.md +2 -0
  149. package/docs/observability-cost-accounting.7.md +2 -0
  150. package/docs/project-index.md +132 -71
  151. package/docs/real-execution-backends.7.md +2 -0
  152. package/docs/release-and-migration.7.md +2 -0
  153. package/docs/release-tooling.7.md +2 -0
  154. package/docs/run-registry-control-plane.7.md +2 -0
  155. package/docs/run-retention-reclamation.7.md +23 -0
  156. package/docs/state-explosion-management.7.md +2 -0
  157. package/docs/team-collaboration.7.md +2 -0
  158. package/docs/web-desktop-workbench.7.md +2 -0
  159. package/manifest/plugin.manifest.json +1 -1
  160. package/manifest/source-context-profiles.json +9 -13
  161. package/package.json +1 -1
  162. package/scripts/agents/cw-attest-wrap.js +2 -2
  163. package/scripts/bump-version.js +4 -3
  164. package/scripts/canonical-apps.js +4 -4
  165. package/scripts/dogfood-architecture-review.js +2 -3
  166. package/scripts/dogfood-release.js +3 -3
  167. package/scripts/gen-parity-doc.js +15 -2
  168. package/scripts/golden-path.js +4 -4
  169. package/scripts/onramp-check.js +1 -1
  170. package/scripts/parity-check.js +38 -21
  171. package/scripts/release-flow.js +2 -2
  172. package/scripts/sync-project-index.js +51 -27
  173. package/scripts/validate-run-state-schema.js +2 -2
  174. package/scripts/version-sync-check.js +30 -30
  175. package/dist/candidate-scoring.js +0 -729
  176. package/dist/capability-core.js +0 -1189
  177. package/dist/capability-registry.js +0 -885
  178. package/dist/cli/command-surface.js +0 -494
  179. package/dist/cli/format.js +0 -56
  180. package/dist/cli/handlers/audit.js +0 -82
  181. package/dist/cli/handlers/blackboard.js +0 -81
  182. package/dist/cli/handlers/candidate.js +0 -40
  183. package/dist/cli/handlers/clones.js +0 -34
  184. package/dist/cli/handlers/collaboration.js +0 -61
  185. package/dist/cli/handlers/eval.js +0 -40
  186. package/dist/cli/handlers/ledger.js +0 -169
  187. package/dist/cli/handlers/maintenance.js +0 -107
  188. package/dist/cli/handlers/multi-agent.js +0 -165
  189. package/dist/cli/handlers/node.js +0 -41
  190. package/dist/cli/handlers/operational.js +0 -155
  191. package/dist/cli/handlers/operator.js +0 -146
  192. package/dist/cli/handlers/registry.js +0 -68
  193. package/dist/cli/handlers/run.js +0 -153
  194. package/dist/cli/handlers/scheduling.js +0 -132
  195. package/dist/cli/handlers/workbench.js +0 -41
  196. package/dist/cli/handlers/worker.js +0 -45
  197. package/dist/cli/run-summary.js +0 -45
  198. package/dist/clones.js +0 -162
  199. package/dist/collaboration.js +0 -726
  200. package/dist/commit.js +0 -592
  201. package/dist/compare.js +0 -18
  202. package/dist/coordinator/classify.js +0 -45
  203. package/dist/coordinator/paths.js +0 -42
  204. package/dist/coordinator/util.js +0 -126
  205. package/dist/coordinator.js +0 -990
  206. package/dist/daemon.js +0 -44
  207. package/dist/dispatch.js +0 -250
  208. package/dist/drive.js +0 -864
  209. package/dist/error-feedback.js +0 -419
  210. package/dist/evidence-grounding.js +0 -184
  211. package/dist/execution-backend/agent.js +0 -354
  212. package/dist/execution-backend/probes.js +0 -112
  213. package/dist/execution-backend/util.js +0 -47
  214. package/dist/execution-backend.js +0 -961
  215. package/dist/gates.js +0 -48
  216. package/dist/harness.js +0 -61
  217. package/dist/ledger.js +0 -313
  218. package/dist/loop-expansion.js +0 -60
  219. package/dist/mcp/tool-call.js +0 -470
  220. package/dist/mcp/tool-definitions.js +0 -1066
  221. package/dist/mcp-surface.js +0 -30
  222. package/dist/multi-agent/graph.js +0 -84
  223. package/dist/multi-agent/helpers.js +0 -141
  224. package/dist/multi-agent/ids.js +0 -20
  225. package/dist/multi-agent/paths.js +0 -22
  226. package/dist/multi-agent-eval/normalize.js +0 -51
  227. package/dist/multi-agent-eval.js +0 -678
  228. package/dist/multi-agent-host.js +0 -777
  229. package/dist/multi-agent.js +0 -984
  230. package/dist/node-projection.js +0 -59
  231. package/dist/node-snapshot.js +0 -260
  232. package/dist/operator-ux.js +0 -631
  233. package/dist/orchestrator/app-operations.js +0 -211
  234. package/dist/orchestrator/audit-operations.js +0 -182
  235. package/dist/orchestrator/candidate-operations.js +0 -117
  236. package/dist/orchestrator/cli-options.js +0 -294
  237. package/dist/orchestrator/collaboration-operations.js +0 -86
  238. package/dist/orchestrator/feedback-operations.js +0 -81
  239. package/dist/orchestrator/host-operations.js +0 -78
  240. package/dist/orchestrator/lifecycle-operations.js +0 -650
  241. package/dist/orchestrator/migration-operations.js +0 -44
  242. package/dist/orchestrator/multi-agent-operations.js +0 -362
  243. package/dist/orchestrator/topology-operations.js +0 -84
  244. package/dist/orchestrator.js +0 -925
  245. package/dist/pipeline-runner.js +0 -285
  246. package/dist/reclamation/hash.js +0 -72
  247. package/dist/reclamation.js +0 -812
  248. package/dist/reporter.js +0 -67
  249. package/dist/run-export.js +0 -815
  250. package/dist/run-registry/derive.js +0 -175
  251. package/dist/run-registry/format.js +0 -124
  252. package/dist/run-registry/gc.js +0 -251
  253. package/dist/run-registry/policy.js +0 -16
  254. package/dist/run-registry/queue.js +0 -115
  255. package/dist/run-registry.js +0 -850
  256. package/dist/run-state-schema.js +0 -68
  257. package/dist/scheduling.js +0 -184
  258. package/dist/state-explosion.js +0 -1014
  259. package/dist/state.js +0 -367
  260. package/dist/telemetry-ledger.js +0 -196
  261. package/dist/topology.js +0 -565
  262. package/dist/triggers.js +0 -184
  263. package/dist/trust-audit.js +0 -644
  264. package/dist/types/blackboard.js +0 -2
  265. package/dist/types/candidate.js +0 -2
  266. package/dist/types/collaboration.js +0 -2
  267. package/dist/types/core.js +0 -2
  268. package/dist/types/drive.js +0 -10
  269. package/dist/types/error-feedback.js +0 -2
  270. package/dist/types/evidence-reasoning.js +0 -2
  271. package/dist/types/execution-backend.js +0 -2
  272. package/dist/types/multi-agent.js +0 -2
  273. package/dist/types/observability.js +0 -2
  274. package/dist/types/pipeline.js +0 -2
  275. package/dist/types/reclamation.js +0 -8
  276. package/dist/types/report-bundle.js +0 -6
  277. package/dist/types/result.js +0 -2
  278. package/dist/types/run-registry.js +0 -2
  279. package/dist/types/run.js +0 -2
  280. package/dist/types/sandbox.js +0 -2
  281. package/dist/types/schedule.js +0 -2
  282. package/dist/types/state-node.js +0 -2
  283. package/dist/types/topology.js +0 -2
  284. package/dist/types/trust.js +0 -2
  285. package/dist/types/workbench.js +0 -2
  286. package/dist/types/worker.js +0 -2
  287. package/dist/types/workflow-app.js +0 -2
  288. package/dist/types.js +0 -44
  289. package/dist/util/fingerprint.js +0 -19
  290. package/dist/util/fingerprint.test.js +0 -27
  291. package/dist/verifier.js +0 -78
  292. package/dist/version.js +0 -8
  293. package/dist/workbench-host.js +0 -192
  294. package/dist/workbench.js +0 -192
  295. package/dist/worker-accept/acceptance.js +0 -114
  296. package/dist/worker-accept/blackboard-fanout.js +0 -80
  297. package/dist/worker-accept/blackboard-linkage.js +0 -19
  298. package/dist/worker-accept/context.js +0 -2
  299. package/dist/worker-accept/telemetry-ledger.js +0 -126
  300. package/dist/worker-accept/validation.js +0 -77
  301. package/dist/worker-accept/verifier-completion.js +0 -73
  302. package/dist/worker-isolation/helpers.js +0 -51
  303. package/dist/worker-isolation/paths.js +0 -46
  304. package/dist/worker-isolation.js +0 -656
  305. package/dist/workflow-api.js +0 -131
  306. /package/dist/{types → core/types}/boundary.js +0 -0
package/dist/commit.js DELETED
@@ -1,592 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.CommitGateError = void 0;
7
- exports.commitState = commitState;
8
- const node_fs_1 = __importDefault(require("node:fs"));
9
- const node_path_1 = __importDefault(require("node:path"));
10
- const node_child_process_1 = require("node:child_process");
11
- const state_1 = require("./state");
12
- const pipeline_contract_1 = require("./pipeline-contract");
13
- const state_node_1 = require("./state-node");
14
- const pipeline_runner_1 = require("./pipeline-runner");
15
- const error_feedback_1 = require("./error-feedback");
16
- const trust_audit_1 = require("./trust-audit");
17
- const collaboration_1 = require("./collaboration");
18
- const evidence_grounding_1 = require("./evidence-grounding");
19
- const verifier_1 = require("./verifier");
20
- const compare_1 = require("./compare");
21
- const gates_1 = require("./gates");
22
- class CommitGateError extends Error {
23
- structured;
24
- feedbackId;
25
- stateNodeId;
26
- constructor(error, options = {}) {
27
- super(error.message);
28
- this.name = "CommitGateError";
29
- this.structured = error;
30
- this.feedbackId = options.feedbackId;
31
- this.stateNodeId = options.stateNodeId;
32
- }
33
- }
34
- exports.CommitGateError = CommitGateError;
35
- function commitState(run, input) {
36
- const options = normalizeCommitOptions(input);
37
- const gate = resolveCommitGate(run, options);
38
- if (gate.errors.length) {
39
- throw recordCommitGateFailure(run, options, gate);
40
- }
41
- node_fs_1.default.mkdirSync(run.paths.commitsDir, { recursive: true });
42
- const id = createCommitId(run);
43
- const snapshotPath = node_path_1.default.join(run.paths.commitsDir, `${id}.json`);
44
- const audit = gate.verifierGated
45
- ? (0, trust_audit_1.recordTrustAuditEvent)(run, {
46
- kind: "commit.gate",
47
- decision: "accepted",
48
- source: "cw-validated",
49
- workerId: gate.rationale?.workerId,
50
- nodeId: gate.verifierNodeId,
51
- candidateId: gate.candidateId,
52
- selectionId: gate.selectionId,
53
- commitId: id,
54
- sandboxProfileId: gate.rationale?.sandboxProfileId,
55
- evidence: gate.evidence,
56
- metadata: gate.rationale
57
- })
58
- : undefined;
59
- const evidence = (0, trust_audit_1.normalizeEvidence)(run, gate.evidence, {
60
- source: gate.verifierGated ? "cw-validated" : "runtime-derived",
61
- workerId: gate.rationale?.workerId,
62
- verifierNodeId: gate.verifierNodeId,
63
- candidateId: gate.candidateId,
64
- selectionId: gate.selectionId,
65
- commitId: id,
66
- auditEventIds: audit ? [audit.id] : []
67
- });
68
- const commit = {
69
- id,
70
- createdAt: new Date().toISOString(),
71
- reason: options.reason,
72
- loopStage: run.loopStage,
73
- statePath: run.paths.state,
74
- reportPath: run.paths.report,
75
- snapshotPath,
76
- gitHead: readGitHead(run.cwd),
77
- verifierGated: gate.verifierGated,
78
- checkpoint: !gate.verifierGated,
79
- verifierNodeId: gate.verifierNodeId,
80
- candidateId: gate.candidateId,
81
- selectionId: gate.selectionId,
82
- evidence,
83
- acceptanceRationale: gate.rationale
84
- ? {
85
- ...gate.rationale,
86
- commitGateResult: gate.verifierGated ? "passed" : "checkpoint",
87
- auditEventIds: audit ? [...(gate.rationale.auditEventIds || []), audit.id] : gate.rationale.auditEventIds
88
- }
89
- : undefined,
90
- review: gate.review,
91
- metadata: {
92
- ...(options.metadata || {}),
93
- ...gate.metadata
94
- }
95
- };
96
- const commitNodeId = recordCommitNode(run, commit, options, gate);
97
- if (commitNodeId)
98
- commit.stateNodeId = commitNodeId;
99
- (0, state_1.writeJson)(snapshotPath, {
100
- commit,
101
- run
102
- });
103
- run.commits.push(commit);
104
- return commit;
105
- }
106
- /** A verifier node is held to the grounded-evidence bar when its backing task
107
- * requires evidence, or when it backs an explicit candidate/selection commit
108
- * (no 1:1 task — these are the higher-stakes commits the gate exists for). */
109
- function verifierNodeRequiresEvidence(run, verifierNode) {
110
- const marker = ":verifier:";
111
- const idx = verifierNode.id.indexOf(marker);
112
- const taskId = idx >= 0 ? verifierNode.id.slice(idx + marker.length) : undefined;
113
- const task = taskId ? run.tasks.find((candidate) => candidate.id === taskId) : undefined;
114
- if (task)
115
- return (0, verifier_1.taskRequiresEvidence)(task);
116
- return true; // candidate/selection verifier with no 1:1 task — enforce grounding.
117
- }
118
- function evidenceLocatorString(entry) {
119
- const ref = entry.locator || entry.path || entry.summary || entry.id;
120
- return ref ? String(ref) : undefined;
121
- }
122
- /** Base dirs used to resolve file-style evidence locators in strict mode. */
123
- function commitEvidenceBaseDirs(run) {
124
- return Array.from(new Set([run.cwd, process.cwd(), run.paths.runDir].filter(Boolean)));
125
- }
126
- function normalizeCommitOptions(input) {
127
- if (typeof input === "string")
128
- return { reason: input || "manual", source: "runtime" };
129
- return {
130
- ...input,
131
- reason: input.reason || "manual",
132
- source: input.source || "runtime"
133
- };
134
- }
135
- function resolveCommitGate(run, options) {
136
- const metadata = {
137
- verifierGated: false,
138
- checkpoint: true
139
- };
140
- const errors = [];
141
- const taskVerifierNodeId = taskVerifierFromReason(run, options.reason);
142
- const explicitGate = Boolean(options.verifierNodeId || options.candidateId || options.selectionId || options.verifierGated);
143
- const verifierGated = explicitGate || Boolean(taskVerifierNodeId);
144
- if (!verifierGated) {
145
- return {
146
- verifierGated: false,
147
- evidence: [],
148
- errors,
149
- metadata
150
- };
151
- }
152
- metadata.verifierGated = true;
153
- metadata.checkpoint = false;
154
- const resolution = {
155
- verifierNodeId: options.verifierNodeId || taskVerifierNodeId,
156
- candidateId: options.candidateId,
157
- selectionId: options.selectionId,
158
- selectionNodeId: undefined,
159
- errors
160
- };
161
- resolveSelectionForCommit(run, resolution);
162
- resolveCandidateForCommit(run, resolution);
163
- if (!resolution.verifierNodeId) {
164
- errors.push(error("commit-verifier-required", "Verifier-gated commit requires --verifier, --candidate, or --selection", {
165
- details: {
166
- hint: "Use --allow-unverified-checkpoint to write a non-gated checkpoint."
167
- }
168
- }));
169
- }
170
- const verifierNode = resolution.verifierNodeId ? findNode(run, resolution.verifierNodeId) : undefined;
171
- if (resolution.verifierNodeId && !verifierNode) {
172
- errors.push(error("commit-verifier-not-found", `Verifier node not found: ${resolution.verifierNodeId}`, {
173
- details: { verifierNodeId: resolution.verifierNodeId }
174
- }));
175
- }
176
- if (verifierNode) {
177
- groundVerifierEvidence(run, verifierNode, errors);
178
- }
179
- const rationale = buildCommitRationale(run, resolution, verifierNode);
180
- const review = layerCommitReviewGate(run, resolution, errors);
181
- return {
182
- verifierGated: true,
183
- verifierNodeId: resolution.verifierNodeId,
184
- candidateId: resolution.candidateId,
185
- selectionId: resolution.selectionId,
186
- selectionNodeId: resolution.selectionNodeId,
187
- evidence: verifierNode?.evidence || [],
188
- errors,
189
- rationale,
190
- review,
191
- metadata: {
192
- ...metadata,
193
- verifierNodeId: resolution.verifierNodeId,
194
- candidateId: resolution.candidateId,
195
- selectionId: resolution.selectionId,
196
- selectionNodeId: resolution.selectionNodeId
197
- }
198
- };
199
- }
200
- /** Selection pass: when a selectionId is supplied, resolve the candidate it
201
- * carries, the linked verifier, and its state node — pushing the SAME errors as
202
- * the inline block did, in the same order. No-op when no selectionId is set. */
203
- function resolveSelectionForCommit(run, resolution) {
204
- const { selectionId, errors } = resolution;
205
- if (!selectionId)
206
- return;
207
- const selection = findSelection(run, selectionId);
208
- if (!selection) {
209
- errors.push(error("commit-selection-not-found", `Commit selection not found: ${selectionId}`, { details: { selectionId } }));
210
- return;
211
- }
212
- resolution.candidateId = resolution.candidateId || selection.candidateId;
213
- resolution.verifierNodeId = resolveLinkedVerifier(resolution.verifierNodeId, selection.verifierNodeId, errors, "selection", selection.id);
214
- const selectionNode = findSelectionNode(run, selection.id);
215
- resolution.selectionNodeId = selectionNode?.id;
216
- if (!selectionNode) {
217
- errors.push(error("commit-selection-node-missing", `Selection ${selection.id} has no state node`, {
218
- details: { selectionId: selection.id, candidateId: selection.candidateId }
219
- }));
220
- }
221
- else if (selectionNode.kind !== "candidate" || selectionNode.status !== "verified") {
222
- errors.push(error("commit-selection-not-verified", `Selection ${selection.id} is not a verified candidate selection`, {
223
- nodeId: selectionNode.id,
224
- details: { selectionId: selection.id, status: selectionNode.status, kind: selectionNode.kind }
225
- }));
226
- }
227
- if (!selection.scoreId) {
228
- errors.push(error("commit-candidate-unscored", `Selection ${selection.id} has no score evidence`, {
229
- details: { selectionId: selection.id, candidateId: selection.candidateId }
230
- }));
231
- }
232
- }
233
- /** Candidate pass: when a candidateId is resolved, enforce its status/score bar
234
- * and bind it to a verified selection (the supplied one, else the latest). Same
235
- * errors, same order, same mutations as the inline block. No-op without one. */
236
- function resolveCandidateForCommit(run, resolution) {
237
- const { candidateId, errors } = resolution;
238
- if (!candidateId)
239
- return;
240
- const candidate = findCandidate(run, candidateId);
241
- if (!candidate) {
242
- errors.push(error("commit-candidate-not-found", `Commit candidate not found: ${candidateId}`, { details: { candidateId } }));
243
- return;
244
- }
245
- if (candidate.status === "rejected" || candidate.status === "failed") {
246
- errors.push(error("commit-candidate-not-selectable", `Candidate ${candidateId} is ${candidate.status}`, {
247
- details: { candidateId, status: candidate.status }
248
- }));
249
- }
250
- if (!candidate.scores.length) {
251
- errors.push(error("commit-candidate-unscored", `Candidate ${candidateId} has no score evidence`, {
252
- details: { candidateId }
253
- }));
254
- }
255
- if (candidate.status !== "verified") {
256
- errors.push(error("commit-candidate-not-verified", `Candidate ${candidateId} is not verifier-gated`, {
257
- details: { candidateId, status: candidate.status }
258
- }));
259
- }
260
- const selection = resolution.selectionId ? findSelection(run, resolution.selectionId) : latestSelectionForCandidate(run, candidateId);
261
- if (!selection) {
262
- errors.push(error("commit-candidate-selection-missing", `Candidate ${candidateId} has no verified selection`, {
263
- details: { candidateId }
264
- }));
265
- return;
266
- }
267
- resolution.selectionId = selection.id;
268
- resolution.verifierNodeId = resolveLinkedVerifier(resolution.verifierNodeId, selection.verifierNodeId || candidate.verifierNodeId, errors, "candidate", candidateId);
269
- const selectionNode = findSelectionNode(run, selection.id);
270
- resolution.selectionNodeId = selectionNode?.id;
271
- if (!selectionNode || selectionNode.status !== "verified") {
272
- errors.push(error("commit-selection-not-verified", `Candidate ${candidateId} selection ${selection.id} is not verified`, {
273
- nodeId: selectionNode?.id,
274
- details: { candidateId, selectionId: selection.id, status: selectionNode?.status || "missing" }
275
- }));
276
- }
277
- if (!selection.scoreId) {
278
- errors.push(error("commit-candidate-unscored", `Candidate ${candidateId} selection ${selection.id} has no score evidence`, {
279
- details: { candidateId, selectionId: selection.id }
280
- }));
281
- }
282
- }
283
- /** Verifier-node grounding pass: kind/status checks plus the HARD no-false-green
284
- * gate (empty-capture) and the grounded-evidence gate. These remain EXACTLY as
285
- * strict — same predicates, same error codes, same order — only lifted out of
286
- * the monolith. */
287
- function groundVerifierEvidence(run, verifierNode, errors) {
288
- if (verifierNode.kind !== "verifier") {
289
- errors.push(error("commit-verifier-wrong-kind", `Node ${verifierNode.id} is not a verifier node`, {
290
- nodeId: verifierNode.id,
291
- details: { verifierNodeId: verifierNode.id, kind: verifierNode.kind }
292
- }));
293
- }
294
- if (verifierNode.status !== "verified") {
295
- errors.push(error("commit-verifier-not-verified", `Verifier node ${verifierNode.id} is ${verifierNode.status}`, {
296
- nodeId: verifierNode.id,
297
- details: { verifierNodeId: verifierNode.id, status: verifierNode.status }
298
- }));
299
- }
300
- // HARD no-false-green gate (v0.1.43): if the backing result was an
301
- // empty-capture (no findings AND no evidence even after robust
302
- // normalization), the verifier node only carries a non-grounded summary
303
- // fallback. That can otherwise pass the length-only path for
304
- // optional-evidence tasks and present a 0-real-evidence review as
305
- // clean/green. Block it BEFORE the rationale is built so the commit fails
306
- // visibly (commit-gate-failed node + feedback) instead of silently passing.
307
- const captureWarning = (0, gates_1.emptyCaptureWarning)(run, verifierNode);
308
- if (captureWarning) {
309
- errors.push(error("commit-rationale-empty-capture", `Verifier node ${verifierNode.id} cannot back a commit: ${captureWarning}`, {
310
- nodeId: verifierNode.id,
311
- details: { verifierNodeId: verifierNode.id, reason: captureWarning }
312
- }));
313
- }
314
- if (!verifierNode.evidence.length) {
315
- errors.push(error("commit-verifier-missing-evidence", `Verifier node ${verifierNode.id} has no evidence`, {
316
- nodeId: verifierNode.id,
317
- details: { verifierNodeId: verifierNode.id }
318
- }));
319
- }
320
- else if (verifierNodeRequiresEvidence(run, verifierNode)) {
321
- // Evidence grounding (v0.1.40 self-audit P1/P2): for verifier nodes whose
322
- // task REQUIRES evidence (verify/verdict/requiresEvidence, and explicit
323
- // candidate/selection commits), the gate must not accept unverifiable free
324
- // text. Require at least one GROUNDED locator (path-like / URL /
325
- // namespace:value), and — when the operator opts in via
326
- // CW_REQUIRE_RESOLVABLE_EVIDENCE — that file-style locators actually resolve
327
- // on disk. Closes the "presence != existence" gap. Optional-evidence tasks
328
- // (e.g. map/assess) keep the length-only check so the gate is never stricter
329
- // than result acceptance was.
330
- const locators = verifierNode.evidence.map(evidenceLocatorString).filter(Boolean);
331
- if (!(0, evidence_grounding_1.hasGroundedEvidence)(locators)) {
332
- errors.push(error("commit-verifier-evidence-ungrounded", `Verifier node ${verifierNode.id} evidence is not grounded (needs a path-like locator, URL, or namespace:value token)`, {
333
- nodeId: verifierNode.id,
334
- details: { verifierNodeId: verifierNode.id, evidence: locators }
335
- }));
336
- }
337
- if ((0, evidence_grounding_1.requireResolvableEvidence)()) {
338
- const unresolved = (0, evidence_grounding_1.unresolvedFileEvidence)(locators, commitEvidenceBaseDirs(run));
339
- if (unresolved.length) {
340
- errors.push(error("commit-verifier-evidence-unresolvable", `Verifier node ${verifierNode.id} cites file evidence that does not resolve on disk: ${unresolved.join(", ")}`, {
341
- nodeId: verifierNode.id,
342
- details: { verifierNodeId: verifierNode.id, unresolved }
343
- }));
344
- }
345
- }
346
- }
347
- }
348
- /** Rationale pass: when candidate + selection are both resolved, reuse the
349
- * selection's acceptance rationale or rebuild it, then push completeness errors.
350
- * Returns the rationale (or undefined). Identical to the inline block. */
351
- function buildCommitRationale(run, resolution, verifierNode) {
352
- const { candidateId, selectionId, verifierNodeId, errors } = resolution;
353
- if (!candidateId || !selectionId)
354
- return undefined;
355
- const candidate = findCandidate(run, candidateId);
356
- const selection = findSelection(run, selectionId);
357
- const score = selection?.scoreId ? findScore(run, candidateId, selection.scoreId) : undefined;
358
- const rationale = selection?.acceptanceRationale || (0, trust_audit_1.buildAcceptanceRationale)({
359
- selectedCandidateId: candidateId,
360
- scoreId: selection?.scoreId,
361
- scoreCriteria: score?.criteria,
362
- verifierNodeId,
363
- evidenceCount: verifierNode?.evidence.length || 0,
364
- sandboxProfileId: (0, gates_1.sandboxProfileForCandidate)(run, candidate),
365
- workerId: candidate?.workerId,
366
- commitGateResult: "passed"
367
- });
368
- for (const failure of (0, trust_audit_1.validateAcceptanceRationale)(rationale)) {
369
- errors.push(error("commit-rationale-incomplete", `Verifier-gated commit cannot explain acceptance: ${failure}`, {
370
- details: { candidateId, selectionId, verifierNodeId }
371
- }));
372
- }
373
- return rationale;
374
- }
375
- /** Review-gate pass — POLICY layered ON TOP of the verifier MECHANISM. These
376
- * errors can only ADD constraints (required approvals from authorized roles);
377
- * they never relax verifier acceptance. Empty unless a policy applies to
378
- * commits. Fail closed: a commit lacking its required approvals is BLOCKED here,
379
- * and provenance is only emitted when NO errors remain. */
380
- function layerCommitReviewGate(run, resolution, errors) {
381
- const { candidateId, selectionId } = resolution;
382
- const reviewErrors = (0, collaboration_1.reviewGateErrors)(run, {
383
- targetKind: "commit",
384
- candidateId,
385
- selectionId,
386
- selfActorIds: (0, collaboration_1.selfActorIdsForCandidate)(run, candidateId, selectionId)
387
- });
388
- errors.push(...reviewErrors);
389
- return errors.length
390
- ? undefined
391
- : (0, collaboration_1.commitReviewProvenance)(run, {
392
- targetKind: "commit",
393
- candidateId,
394
- selectionId,
395
- selfActorIds: (0, collaboration_1.selfActorIdsForCandidate)(run, candidateId, selectionId)
396
- });
397
- }
398
- function recordCommitNode(run, commit, options, gate) {
399
- const contract = (0, state_node_1.upsertRunContract)(run, (0, pipeline_contract_1.createDefaultPipelineContract)());
400
- const verifierNode = gate.verifierNodeId ? findNode(run, gate.verifierNodeId) : undefined;
401
- if (commit.verifierGated && verifierNode) {
402
- const commitResult = (0, pipeline_runner_1.createPipelineRunner)({ contractId: contract.id, persist: false }).runPipelineStage(run, "commit", verifierNode.id, {
403
- outputNodeId: `${run.id}:commit:${commit.id}`,
404
- outputStatus: "committed",
405
- loopStage: "checkpoint",
406
- outputs: {
407
- snapshotPath: commit.snapshotPath,
408
- gitHead: commit.gitHead,
409
- verifierGated: true,
410
- verifierNodeId: verifierNode.id,
411
- candidateId: gate.candidateId,
412
- selectionId: gate.selectionId
413
- },
414
- artifacts: [{ id: "snapshot", kind: "json", path: commit.snapshotPath }],
415
- evidence: commit.evidence || verifierNode.evidence,
416
- metadata: {
417
- ...(options.metadata || {}),
418
- reason: options.reason,
419
- commitId: commit.id,
420
- verifierGated: true,
421
- checkpoint: false,
422
- verifierNodeId: verifierNode.id,
423
- candidateId: gate.candidateId,
424
- selectionId: gate.selectionId,
425
- selectionNodeId: gate.selectionNodeId,
426
- acceptanceRationale: commit.acceptanceRationale
427
- }
428
- });
429
- if (gate.selectionNodeId && commitResult.outputNodeId) {
430
- linkAdditionalParent(run, gate.selectionNodeId, commitResult.outputNodeId);
431
- }
432
- return commitResult.outputNodeId;
433
- }
434
- const checkpointNode = (0, state_node_1.createStateNode)({
435
- id: `${run.id}:checkpoint:${commit.id}`,
436
- kind: "commit",
437
- status: "completed",
438
- loopStage: "checkpoint",
439
- inputs: { reason: options.reason, commitId: commit.id },
440
- outputs: { snapshotPath: commit.snapshotPath, gitHead: commit.gitHead, verifierGated: false, checkpoint: true },
441
- artifacts: [{ id: "snapshot", kind: "json", path: commit.snapshotPath }],
442
- contractId: pipeline_contract_1.DEFAULT_PIPELINE_CONTRACT_ID,
443
- metadata: {
444
- ...(options.metadata || {}),
445
- verifierGated: false,
446
- checkpoint: true
447
- }
448
- });
449
- (0, state_node_1.appendRunNode)(run, checkpointNode);
450
- return checkpointNode.id;
451
- }
452
- function recordCommitGateFailure(run, options, gate) {
453
- const first = gate.errors[0] || error("commit-gate-blocked", "Verifier-gated commit blocked");
454
- const node = (0, state_node_1.recordNodeError)((0, state_node_1.createStateNode)({
455
- id: `${run.id}:commit-gate-failed:${gateFailureSeq(run)}`,
456
- kind: "error",
457
- status: "pending",
458
- loopStage: "checkpoint",
459
- inputs: {
460
- reason: options.reason,
461
- verifierNodeId: gate.verifierNodeId,
462
- candidateId: gate.candidateId,
463
- selectionId: gate.selectionId
464
- },
465
- evidence: gate.evidence,
466
- contractId: pipeline_contract_1.DEFAULT_PIPELINE_CONTRACT_ID,
467
- metadata: {
468
- ...(options.metadata || {}),
469
- verifierGated: true,
470
- checkpoint: false,
471
- failureCount: gate.errors.length,
472
- failures: gate.errors.map((entry) => ({ code: entry.code, message: entry.message, nodeId: entry.nodeId })),
473
- gate: gate.metadata
474
- }
475
- }), first);
476
- const persisted = (0, state_node_1.appendRunNode)(run, node);
477
- for (const parentId of [gate.selectionNodeId, gate.verifierNodeId].filter(Boolean)) {
478
- linkAdditionalParent(run, parentId, persisted.id);
479
- }
480
- const feedback = (0, error_feedback_1.recordFeedback)(run, {
481
- source: options.source === "cli" ? "cli" : "verifier",
482
- error: first,
483
- nodeId: persisted.id,
484
- stageId: "commit",
485
- contractId: pipeline_contract_1.DEFAULT_PIPELINE_CONTRACT_ID,
486
- retryable: false,
487
- evidence: gate.evidence,
488
- artifacts: [],
489
- metadata: {
490
- reason: options.reason,
491
- verifierNodeId: gate.verifierNodeId,
492
- candidateId: gate.candidateId,
493
- selectionId: gate.selectionId,
494
- failures: gate.errors.map((entry) => ({ code: entry.code, message: entry.message, nodeId: entry.nodeId }))
495
- }
496
- }, { persist: false });
497
- return new CommitGateError(first, { feedbackId: feedback.id, stateNodeId: persisted.id });
498
- }
499
- function linkAdditionalParent(run, parentId, childId) {
500
- const parent = findNode(run, parentId);
501
- const child = findNode(run, childId);
502
- if (!parent || !child)
503
- return;
504
- const [linkedParent, linkedChild] = (0, state_node_1.linkStateNodes)(parent, child);
505
- (0, state_node_1.appendRunNode)(run, linkedParent);
506
- (0, state_node_1.appendRunNode)(run, linkedChild);
507
- }
508
- function taskVerifierFromReason(run, reason) {
509
- const taskId = reason.startsWith("result:") ? reason.slice("result:".length) : "";
510
- if (!taskId)
511
- return undefined;
512
- return run.tasks.find((task) => task.id === taskId)?.verifierNodeId;
513
- }
514
- function resolveLinkedVerifier(requested, linked, errors, ownerKind, ownerId) {
515
- if (requested && linked && requested !== linked) {
516
- errors.push(error("commit-verifier-linkage-mismatch", `Requested verifier ${requested} is not linked to ${ownerKind} ${ownerId}`, {
517
- details: { requestedVerifierNodeId: requested, linkedVerifierNodeId: linked, ownerKind, ownerId }
518
- }));
519
- return requested;
520
- }
521
- return requested || linked;
522
- }
523
- function latestSelectionForCandidate(run, candidateId) {
524
- return [...(run.candidateSelections || [])]
525
- .filter((selection) => selection.candidateId === candidateId)
526
- .sort((left, right) => (0, compare_1.compareBytes)(right.selectedAt, left.selectedAt))[0];
527
- }
528
- function findSelection(run, selectionId) {
529
- return (run.candidateSelections || []).find((selection) => selection.id === selectionId);
530
- }
531
- function findSelectionNode(run, selectionId) {
532
- return (run.nodes || []).find((node) => node.kind === "candidate" && node.metadata?.selectionId === selectionId);
533
- }
534
- function findCandidate(run, candidateId) {
535
- return (run.candidates || []).find((candidate) => candidate.id === candidateId);
536
- }
537
- function findScore(run, candidateId, scoreId) {
538
- const file = node_path_1.default.join(run.paths.candidatesDir || node_path_1.default.join(run.paths.runDir, "candidates"), (0, state_1.safeFileName)(candidateId), "scores", `${(0, state_1.safeFileName)(scoreId)}.json`);
539
- if (!node_fs_1.default.existsSync(file))
540
- return undefined;
541
- try {
542
- return JSON.parse(node_fs_1.default.readFileSync(file, "utf8"));
543
- }
544
- catch {
545
- return undefined;
546
- }
547
- }
548
- function findNode(run, nodeId) {
549
- return (run.nodes || []).find((node) => node.id === nodeId);
550
- }
551
- function error(code, message, options = {}) {
552
- return {
553
- code,
554
- message,
555
- at: new Date().toISOString(),
556
- retryable: false,
557
- ...options
558
- };
559
- }
560
- // Deterministic commit id (FreeBSD-audit L12/L13): the commit's POSITION in the
561
- // run's append-only commit log, not a wall-clock stamp + PRNG suffix. Re-running
562
- // the same workflow mints byte-identical commit ids, so snapshot/replay digests
563
- // match. The sequence is unique within a run (commits only ever append), and the
564
- // commitState caller writes the snapshot under this id before pushing the commit.
565
- function createCommitId(run) {
566
- const seq = (run.commits || []).length + 1;
567
- return `state-${String(seq).padStart(4, "0")}`;
568
- }
569
- // Deterministic suffix for a blocked-commit node id. Counts the commit-gate-failed
570
- // nodes already recorded on the run and returns the next position, so repeated
571
- // gate failures in one run stay collision-free and replay-stable.
572
- function gateFailureSeq(run) {
573
- const marker = ":commit-gate-failed:";
574
- const seq = (run.nodes || []).filter((node) => node.id.includes(marker)).length + 1;
575
- return String(seq).padStart(4, "0");
576
- }
577
- function readGitHead(cwd) {
578
- try {
579
- return (0, node_child_process_1.execFileSync)("git", ["rev-parse", "HEAD"], {
580
- cwd,
581
- encoding: "utf8",
582
- stdio: ["ignore", "pipe", "ignore"],
583
- // Bound the call: a hung filesystem, a held .git/index.lock, or a
584
- // credential-helper prompt must not block the commit path forever. A
585
- // timeout throws, which the catch below maps to "no git head".
586
- timeout: 5000
587
- }).trim();
588
- }
589
- catch {
590
- return undefined;
591
- }
592
- }
package/dist/compare.js DELETED
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.compareBytes = compareBytes;
4
- // Locale-INDEPENDENT total order for strings (FreeBSD-audit L12 determinism).
5
- //
6
- // `String.localeCompare` is host/locale-sensitive: two hosts can order the same
7
- // byte-identical strings differently. That is fine for human-facing display, but
8
- // FATAL when the sorted order feeds a sha256 digest, a tombstone/hash chain, or a
9
- // stable-persisted projection (index.json, messages.jsonl, an export manifest):
10
- // the same content would then serialize/hash differently across hosts, breaking
11
- // CW's cross-host reproducibility and replay-determinism guarantees.
12
- //
13
- // Use compareBytes() for any ordering that flows into a hash, an export, a
14
- // persisted projection, or a commit/replay-bearing decision. Pure display sorts
15
- // may keep localeCompare.
16
- function compareBytes(a, b) {
17
- return a < b ? -1 : a > b ? 1 : 0;
18
- }
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.statusToNodeStatus = statusToNodeStatus;
4
- exports.decisionStatus = decisionStatus;
5
- exports.auditDecision = auditDecision;
6
- exports.sourceForAuthor = sourceForAuthor;
7
- function statusToNodeStatus(status) {
8
- switch (status) {
9
- case "active":
10
- case "open":
11
- return "running";
12
- case "resolved":
13
- case "superseded":
14
- return "completed";
15
- case "conflicting":
16
- return "blocked";
17
- case "rejected":
18
- return "rejected";
19
- default:
20
- return "completed";
21
- }
22
- }
23
- function decisionStatus(outcome) {
24
- if (outcome === "conflicting" || outcome === "blocked")
25
- return "conflicting";
26
- if (outcome === "rejected")
27
- return "rejected";
28
- if (outcome === "superseded")
29
- return "superseded";
30
- return "active";
31
- }
32
- function auditDecision(outcome) {
33
- if (outcome === "rejected")
34
- return "rejected";
35
- if (outcome === "blocked" || outcome === "conflicting")
36
- return "failed";
37
- return "accepted";
38
- }
39
- function sourceForAuthor(author) {
40
- if (author.kind === "runtime" || author.kind === "coordinator")
41
- return "runtime-derived";
42
- if (author.kind === "worker" || author.kind === "verifier")
43
- return "cw-validated";
44
- return "operator-recorded";
45
- }