cool-workflow 0.1.78
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/.claude-plugin/plugin.json +20 -0
- package/.codex-plugin/mcp.json +10 -0
- package/.codex-plugin/plugin.json +38 -0
- package/.mcp.json +10 -0
- package/LICENSE +24 -0
- package/README.md +638 -0
- package/apps/architecture-review/app.json +51 -0
- package/apps/architecture-review/workflow.js +116 -0
- package/apps/end-to-end-golden-path/app.json +30 -0
- package/apps/end-to-end-golden-path/workflow.js +33 -0
- package/apps/pr-review-fix-ci/app.json +59 -0
- package/apps/pr-review-fix-ci/workflow.js +90 -0
- package/apps/release-cut/app.json +54 -0
- package/apps/release-cut/workflow.js +82 -0
- package/apps/research-synthesis/app.json +50 -0
- package/apps/research-synthesis/workflow.js +76 -0
- package/apps/workflow-app-framework-demo/app.json +29 -0
- package/apps/workflow-app-framework-demo/workflow.js +44 -0
- package/dist/agent-config.js +223 -0
- package/dist/candidate-scoring.js +715 -0
- package/dist/capability-core.js +630 -0
- package/dist/capability-dispatcher.js +86 -0
- package/dist/capability-registry.js +523 -0
- package/dist/cli.js +1276 -0
- package/dist/collaboration.js +727 -0
- package/dist/commit.js +570 -0
- package/dist/contract-migration.js +234 -0
- package/dist/coordinator.js +1163 -0
- package/dist/daemon.js +44 -0
- package/dist/dispatch.js +201 -0
- package/dist/drive.js +503 -0
- package/dist/error-feedback.js +415 -0
- package/dist/evidence-grounding.js +179 -0
- package/dist/evidence-reasoning.js +733 -0
- package/dist/execution-backend.js +1279 -0
- package/dist/harness.js +61 -0
- package/dist/mcp-server.js +1615 -0
- package/dist/multi-agent-eval.js +857 -0
- package/dist/multi-agent-host.js +764 -0
- package/dist/multi-agent-operator-ux.js +537 -0
- package/dist/multi-agent-trust.js +366 -0
- package/dist/multi-agent.js +1173 -0
- package/dist/node-snapshot.js +270 -0
- package/dist/observability.js +922 -0
- package/dist/operator-ux.js +971 -0
- package/dist/orchestrator/audit-operations.js +182 -0
- package/dist/orchestrator/candidate-operations.js +117 -0
- package/dist/orchestrator/cli-options.js +288 -0
- package/dist/orchestrator/collaboration-operations.js +86 -0
- package/dist/orchestrator/feedback-operations.js +81 -0
- package/dist/orchestrator/host-operations.js +78 -0
- package/dist/orchestrator/lifecycle-operations.js +462 -0
- package/dist/orchestrator/migration-operations.js +44 -0
- package/dist/orchestrator/multi-agent-operations.js +362 -0
- package/dist/orchestrator/report.js +369 -0
- package/dist/orchestrator/topology-operations.js +84 -0
- package/dist/orchestrator.js +874 -0
- package/dist/pipeline-contract.js +92 -0
- package/dist/pipeline-runner.js +285 -0
- package/dist/reclamation.js +882 -0
- package/dist/result-normalize.js +194 -0
- package/dist/run-export.js +64 -0
- package/dist/run-registry.js +1347 -0
- package/dist/run-state-schema.js +67 -0
- package/dist/sandbox-profile.js +471 -0
- package/dist/scheduler.js +266 -0
- package/dist/scheduling.js +184 -0
- package/dist/schema-validate.js +98 -0
- package/dist/state-explosion.js +1213 -0
- package/dist/state-migrations.js +463 -0
- package/dist/state-node.js +301 -0
- package/dist/state.js +308 -0
- package/dist/telemetry-attestation.js +156 -0
- package/dist/telemetry-ledger.js +145 -0
- package/dist/topology.js +527 -0
- package/dist/triggers.js +159 -0
- package/dist/trust-audit.js +475 -0
- package/dist/types/blackboard.js +2 -0
- package/dist/types/boundary.js +29 -0
- package/dist/types/candidate.js +2 -0
- package/dist/types/collaboration.js +2 -0
- package/dist/types/core.js +2 -0
- package/dist/types/drive.js +10 -0
- package/dist/types/error-feedback.js +2 -0
- package/dist/types/evidence-reasoning.js +2 -0
- package/dist/types/execution-backend.js +2 -0
- package/dist/types/multi-agent.js +2 -0
- package/dist/types/observability.js +2 -0
- package/dist/types/pipeline.js +2 -0
- package/dist/types/reclamation.js +8 -0
- package/dist/types/result.js +2 -0
- package/dist/types/run-registry.js +2 -0
- package/dist/types/run.js +2 -0
- package/dist/types/sandbox.js +2 -0
- package/dist/types/schedule.js +2 -0
- package/dist/types/state-node.js +2 -0
- package/dist/types/topology.js +2 -0
- package/dist/types/trust.js +2 -0
- package/dist/types/workbench.js +2 -0
- package/dist/types/worker.js +2 -0
- package/dist/types/workflow-app.js +2 -0
- package/dist/types.js +43 -0
- package/dist/verifier-registry.js +46 -0
- package/dist/verifier.js +78 -0
- package/dist/version.js +8 -0
- package/dist/workbench-host.js +172 -0
- package/dist/workbench.js +190 -0
- package/dist/worker-isolation.js +1028 -0
- package/dist/workflow-api.js +98 -0
- package/dist/workflow-app-framework.js +626 -0
- package/docs/agent-delegation-drive.7.md +190 -0
- package/docs/agent-framework.md +176 -0
- package/docs/candidate-scoring.7.md +106 -0
- package/docs/canonical-workflow-apps.7.md +137 -0
- package/docs/capability-topology-registry.7.md +168 -0
- package/docs/cli-mcp-parity.7.md +373 -0
- package/docs/contract-migration-tooling.7.md +123 -0
- package/docs/control-plane-scheduling.7.md +110 -0
- package/docs/coordinator-blackboard.7.md +183 -0
- package/docs/dogfood/architecture-review-cool-workflow.md +16 -0
- package/docs/dogfood-one-real-repo.7.md +168 -0
- package/docs/durable-state-and-locking.7.md +107 -0
- package/docs/end-to-end-golden-path.7.md +117 -0
- package/docs/error-feedback.7.md +153 -0
- package/docs/evidence-adoption-reasoning-chain.7.md +270 -0
- package/docs/execution-backends.7.md +300 -0
- package/docs/getting-started.md +99 -0
- package/docs/index.md +41 -0
- package/docs/mcp-app-surface.7.md +235 -0
- package/docs/multi-agent-cli-mcp-surface.7.md +265 -0
- package/docs/multi-agent-eval-replay-harness.7.md +302 -0
- package/docs/multi-agent-operator-ux.7.md +314 -0
- package/docs/multi-agent-runtime-core.7.md +231 -0
- package/docs/multi-agent-topologies.7.md +103 -0
- package/docs/multi-agent-trust-policy-audit.7.md +154 -0
- package/docs/node-snapshot-diff-replay.7.md +135 -0
- package/docs/observability-cost-accounting.7.md +194 -0
- package/docs/operator-ux.7.md +180 -0
- package/docs/pipeline-runner.7.md +136 -0
- package/docs/project-index.md +261 -0
- package/docs/real-execution-backends.7.md +142 -0
- package/docs/release-and-migration.7.md +280 -0
- package/docs/release-tooling.7.md +159 -0
- package/docs/routines.md +48 -0
- package/docs/run-registry-control-plane.7.md +312 -0
- package/docs/run-retention-reclamation.7.md +191 -0
- package/docs/sandbox-profiles.7.md +137 -0
- package/docs/scheduled-tasks.md +80 -0
- package/docs/security-trust-hardening.7.md +117 -0
- package/docs/state-explosion-management.7.md +264 -0
- package/docs/state-node.7.md +96 -0
- package/docs/team-collaboration.7.md +207 -0
- package/docs/unix-principles.md +192 -0
- package/docs/verifier-gated-commit.7.md +140 -0
- package/docs/web-desktop-workbench.7.md +215 -0
- package/docs/worker-isolation.7.md +167 -0
- package/docs/workflow-app-framework.7.md +274 -0
- package/manifest/README.md +43 -0
- package/manifest/plugin.manifest.json +316 -0
- package/manifest/pricing.policy.json +14 -0
- package/package.json +79 -0
- package/scripts/agents/claude-p-agent.js +104 -0
- package/scripts/agents/claude-p-agent.sh +9 -0
- package/scripts/agents/cw-attest-keygen.js +55 -0
- package/scripts/agents/cw-attest-wrap.js +143 -0
- package/scripts/block-unapproved-tag.sh +39 -0
- package/scripts/bump-version.js +249 -0
- package/scripts/canonical-apps.js +171 -0
- package/scripts/cw.js +4 -0
- package/scripts/dist-drift-check.js +79 -0
- package/scripts/dogfood-architecture-review.js +237 -0
- package/scripts/dogfood-release.js +624 -0
- package/scripts/forward-ref-docs.js +73 -0
- package/scripts/gen-manifests.js +232 -0
- package/scripts/golden-path.js +300 -0
- package/scripts/mcp-server.js +4 -0
- package/scripts/new-feature.js +121 -0
- package/scripts/parity-check.js +213 -0
- package/scripts/release-check.js +118 -0
- package/scripts/release-flow.js +272 -0
- package/scripts/release-gate.sh +85 -0
- package/scripts/sync-project-index.js +387 -0
- package/scripts/validate-run-state-schema.js +126 -0
- package/scripts/verify-container-selfref.js +64 -0
- package/scripts/version-sync-check.js +237 -0
- package/skills/cool-workflow/SKILL.md +162 -0
- package/skills/cool-workflow/references/commands.md +282 -0
- package/tsconfig.json +16 -0
- package/ui/workbench/app.css +76 -0
- package/ui/workbench/app.js +159 -0
- package/ui/workbench/index.html +32 -0
- package/workflows/architecture-review.workflow.js +84 -0
- package/workflows/research-synthesis.workflow.js +47 -0
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Contract Migration Tooling (v0.1.36) — a first-class, declared migration
|
|
3
|
+
// subsystem over the existing run-state migration pipeline, extended to the
|
|
4
|
+
// workflow-app schema.
|
|
5
|
+
//
|
|
6
|
+
// BSD discipline:
|
|
7
|
+
// - MECHANISM, not policy: a declared registry of edges per contract is the
|
|
8
|
+
// single source for "what versions exist and how to advance them". The caller
|
|
9
|
+
// names the contract + snapshot; nothing guesses.
|
|
10
|
+
// - FAIL CLOSED ON REACHABILITY [load-bearing]: before transforming, resolve the
|
|
11
|
+
// full chain detected -> CURRENT. Below minimum, above current, or no chained
|
|
12
|
+
// path REFUSES with a named unsupported verdict and NO write — never a
|
|
13
|
+
// best-effort partial migration.
|
|
14
|
+
// - REUSE, don't fork: run-state edges ARE RUN_STATE_MIGRATIONS; the chain runner
|
|
15
|
+
// wraps the existing migrateRunState. No transform logic is duplicated.
|
|
16
|
+
// - APPEND-ONLY / NON-DESTRUCTIVE: the prover proves every source key survives,
|
|
17
|
+
// the result validates at CURRENT, re-running is idempotent, and the source
|
|
18
|
+
// snapshot is byte-immutable (hash-before == hash-after).
|
|
19
|
+
// - DETERMINISTIC: proofs are sha256-fingerprinted; no wall-clock in the payload.
|
|
20
|
+
//
|
|
21
|
+
// See docs/contract-migration-tooling.7.md.
|
|
22
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.CONTRACT_MIGRATION_SCHEMA_VERSION = void 0;
|
|
27
|
+
exports.listMigrationContracts = listMigrationContracts;
|
|
28
|
+
exports.resolveChain = resolveChain;
|
|
29
|
+
exports.checkMigration = checkMigration;
|
|
30
|
+
exports.proveMigration = proveMigration;
|
|
31
|
+
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
32
|
+
const version_1 = require("./version");
|
|
33
|
+
const state_migrations_1 = require("./state-migrations");
|
|
34
|
+
exports.CONTRACT_MIGRATION_SCHEMA_VERSION = 1;
|
|
35
|
+
function isRecord(value) {
|
|
36
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
37
|
+
}
|
|
38
|
+
/** Deterministic, key-sorted, EXACT content hash (not normalized — used to prove
|
|
39
|
+
* the source snapshot was not mutated). */
|
|
40
|
+
function stableHash(value) {
|
|
41
|
+
const sort = (v) => Array.isArray(v)
|
|
42
|
+
? v.map(sort)
|
|
43
|
+
: isRecord(v)
|
|
44
|
+
? Object.keys(v)
|
|
45
|
+
.sort()
|
|
46
|
+
.reduce((out, key) => {
|
|
47
|
+
out[key] = sort(v[key]);
|
|
48
|
+
return out;
|
|
49
|
+
}, {})
|
|
50
|
+
: v;
|
|
51
|
+
return `sha256:${node_crypto_1.default.createHash("sha256").update(JSON.stringify(sort(value))).digest("hex")}`;
|
|
52
|
+
}
|
|
53
|
+
// ---------------------------------------------------------------------------
|
|
54
|
+
// The declared registry. run-state edges ARE RUN_STATE_MIGRATIONS (no fork). The
|
|
55
|
+
// workflow-app contract is declared with its current version; it has no edges yet
|
|
56
|
+
// (only schema 1 exists) — an older app fails closed with a precise reason rather
|
|
57
|
+
// than being silently accepted or flatly rejected.
|
|
58
|
+
// ---------------------------------------------------------------------------
|
|
59
|
+
const RUN_STATE_EDGES = state_migrations_1.RUN_STATE_MIGRATIONS.map((step) => ({
|
|
60
|
+
contract: "run-state",
|
|
61
|
+
from: step.from,
|
|
62
|
+
to: step.to,
|
|
63
|
+
description: step.description,
|
|
64
|
+
proof: {
|
|
65
|
+
invariant: `run-state ${step.from} -> ${step.to}: adds defaults only, drops no existing key`,
|
|
66
|
+
addsDefaulted: ["schemaVersion"],
|
|
67
|
+
dropsNothing: true
|
|
68
|
+
}
|
|
69
|
+
}));
|
|
70
|
+
function listMigrationContracts() {
|
|
71
|
+
return [
|
|
72
|
+
{
|
|
73
|
+
contract: "run-state",
|
|
74
|
+
currentVersion: version_1.CURRENT_RUN_STATE_SCHEMA_VERSION,
|
|
75
|
+
minVersion: version_1.MIN_SUPPORTED_RUN_STATE_SCHEMA_VERSION,
|
|
76
|
+
edges: RUN_STATE_EDGES
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
contract: "workflow-app",
|
|
80
|
+
currentVersion: version_1.WORKFLOW_APP_SCHEMA_VERSION,
|
|
81
|
+
minVersion: version_1.WORKFLOW_APP_SCHEMA_VERSION,
|
|
82
|
+
edges: []
|
|
83
|
+
}
|
|
84
|
+
];
|
|
85
|
+
}
|
|
86
|
+
function getContract(contractId) {
|
|
87
|
+
const contract = listMigrationContracts().find((entry) => entry.contract === contractId);
|
|
88
|
+
if (!contract)
|
|
89
|
+
throw new Error(`Unknown migration contract: ${contractId}`);
|
|
90
|
+
return contract;
|
|
91
|
+
}
|
|
92
|
+
function detectVersion(contractId, snapshot) {
|
|
93
|
+
const declared = isRecord(snapshot) && typeof snapshot.schemaVersion === "number" ? snapshot.schemaVersion : undefined;
|
|
94
|
+
if (typeof declared === "number")
|
|
95
|
+
return declared;
|
|
96
|
+
return contractId === "run-state" ? version_1.LEGACY_RUN_STATE_SCHEMA_VERSION : 0;
|
|
97
|
+
}
|
|
98
|
+
/** Fail-closed reachability: detected -> current using the DAG path resolver. */
|
|
99
|
+
function resolveChain(contract, detected) {
|
|
100
|
+
if (detected < contract.minVersion) {
|
|
101
|
+
return { reachable: false, chain: [], error: `${contract.contract} schemaVersion ${detected} is below the minimum supported ${contract.minVersion}` };
|
|
102
|
+
}
|
|
103
|
+
if (detected > contract.currentVersion) {
|
|
104
|
+
return { reachable: false, chain: [], error: `${contract.contract} schemaVersion ${detected} is newer than this runtime (${contract.currentVersion})` };
|
|
105
|
+
}
|
|
106
|
+
// Use the run-state migration DAG path resolver when applicable
|
|
107
|
+
if (contract.contract === "run-state") {
|
|
108
|
+
const resolved = (0, state_migrations_1.findMigrationPath)(state_migrations_1.RUN_STATE_MIGRATIONS, detected, contract.currentVersion);
|
|
109
|
+
if (!resolved.reachable)
|
|
110
|
+
return { reachable: false, chain: [], error: resolved.error };
|
|
111
|
+
// Derive the version chain from the path
|
|
112
|
+
const chain = [detected];
|
|
113
|
+
let v = detected;
|
|
114
|
+
for (const step of resolved.path) {
|
|
115
|
+
v = step.reverse ? step.edge.from : step.edge.to;
|
|
116
|
+
chain.push(v);
|
|
117
|
+
}
|
|
118
|
+
return { reachable: true, chain };
|
|
119
|
+
}
|
|
120
|
+
// workflow-app: no edges yet, simple check
|
|
121
|
+
if (contract.edges.length === 0) {
|
|
122
|
+
if (detected === contract.currentVersion)
|
|
123
|
+
return { reachable: true, chain: [detected] };
|
|
124
|
+
return { reachable: false, chain: [], error: `${contract.contract} schemaVersion ${detected} is not current (${contract.currentVersion}) and no migration edges exist` };
|
|
125
|
+
}
|
|
126
|
+
// Generic edge-based chain resolution
|
|
127
|
+
const chain = [detected];
|
|
128
|
+
let version = detected;
|
|
129
|
+
while (version < contract.currentVersion) {
|
|
130
|
+
const edge = contract.edges.find((candidate) => candidate.from === version);
|
|
131
|
+
if (!edge) {
|
|
132
|
+
return { reachable: false, chain, error: `no migration edge from ${contract.contract} schemaVersion ${version}` };
|
|
133
|
+
}
|
|
134
|
+
version = edge.to;
|
|
135
|
+
chain.push(version);
|
|
136
|
+
}
|
|
137
|
+
return { reachable: true, chain };
|
|
138
|
+
}
|
|
139
|
+
/** Dry-run verdict: detect, resolve, and (run-state) run the migration to report. */
|
|
140
|
+
function checkMigration(contractId, snapshot) {
|
|
141
|
+
const contract = getContract(contractId);
|
|
142
|
+
const detectedVersion = detectVersion(contractId, snapshot);
|
|
143
|
+
const resolved = resolveChain(contract, detectedVersion);
|
|
144
|
+
const base = {
|
|
145
|
+
schemaVersion: 1,
|
|
146
|
+
contract: contractId,
|
|
147
|
+
detectedVersion,
|
|
148
|
+
currentVersion: contract.currentVersion,
|
|
149
|
+
reachable: resolved.reachable,
|
|
150
|
+
chain: resolved.chain
|
|
151
|
+
};
|
|
152
|
+
if (!resolved.reachable) {
|
|
153
|
+
return { ...base, status: "unsupported", changes: 0, errors: [resolved.error || "unreachable"] };
|
|
154
|
+
}
|
|
155
|
+
if (contractId === "run-state") {
|
|
156
|
+
const { report } = (0, state_migrations_1.migrateRunState)(snapshot, { dryRun: true });
|
|
157
|
+
return { ...base, status: report.status, changes: report.changes.length, errors: report.errors };
|
|
158
|
+
}
|
|
159
|
+
// workflow-app: reachable + no edges => detected === current.
|
|
160
|
+
return { ...base, status: "current", changes: 0, errors: [] };
|
|
161
|
+
}
|
|
162
|
+
/** Round-trip / non-destruction prover. Fail-closed: an unsupported verdict never
|
|
163
|
+
* transforms and never claims a positive proof. */
|
|
164
|
+
function proveMigration(contractId, snapshot) {
|
|
165
|
+
const verdict = checkMigration(contractId, snapshot);
|
|
166
|
+
const sourceHash = stableHash(snapshot);
|
|
167
|
+
const errors = [...verdict.errors];
|
|
168
|
+
let validatesAtCurrent = false;
|
|
169
|
+
let appendOnly = false;
|
|
170
|
+
let idempotent = false;
|
|
171
|
+
let result = snapshot;
|
|
172
|
+
if (verdict.status !== "unsupported") {
|
|
173
|
+
if (contractId === "run-state") {
|
|
174
|
+
const migrated = (0, state_migrations_1.migrateRunState)(snapshot);
|
|
175
|
+
result = migrated.run;
|
|
176
|
+
validatesAtCurrent =
|
|
177
|
+
migrated.report.status !== "unsupported" &&
|
|
178
|
+
isRecord(result) &&
|
|
179
|
+
result.schemaVersion === version_1.CURRENT_RUN_STATE_SCHEMA_VERSION;
|
|
180
|
+
appendOnly = keysSurvive(snapshot, result);
|
|
181
|
+
const reRun = (0, state_migrations_1.migrateRunState)(result, { dryRun: true });
|
|
182
|
+
idempotent = reRun.report.changes.length === 0 && reRun.report.status === "current";
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
// workflow-app at current: pass-through, nothing to transform.
|
|
186
|
+
validatesAtCurrent = verdict.status === "current";
|
|
187
|
+
appendOnly = true;
|
|
188
|
+
idempotent = true;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
const sourceImmutable = stableHash(snapshot) === sourceHash;
|
|
192
|
+
const resultHash = stableHash(result);
|
|
193
|
+
const pass = validatesAtCurrent && appendOnly && idempotent && sourceImmutable && errors.length === 0;
|
|
194
|
+
const fingerprint = stableHash({
|
|
195
|
+
contract: contractId,
|
|
196
|
+
detectedVersion: verdict.detectedVersion,
|
|
197
|
+
chain: verdict.chain,
|
|
198
|
+
status: verdict.status,
|
|
199
|
+
validatesAtCurrent,
|
|
200
|
+
appendOnly,
|
|
201
|
+
idempotent,
|
|
202
|
+
sourceImmutable,
|
|
203
|
+
sourceHash,
|
|
204
|
+
resultHash
|
|
205
|
+
});
|
|
206
|
+
return {
|
|
207
|
+
schemaVersion: 1,
|
|
208
|
+
contract: contractId,
|
|
209
|
+
verdict,
|
|
210
|
+
validatesAtCurrent,
|
|
211
|
+
appendOnly,
|
|
212
|
+
idempotent,
|
|
213
|
+
sourceImmutable,
|
|
214
|
+
pass,
|
|
215
|
+
sourceHash,
|
|
216
|
+
resultHash,
|
|
217
|
+
fingerprint,
|
|
218
|
+
errors
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
/** Append-only proof: every key in the source survives into the output (recursive). */
|
|
222
|
+
function keysSurvive(source, output) {
|
|
223
|
+
if (!isRecord(source))
|
|
224
|
+
return true;
|
|
225
|
+
if (!isRecord(output))
|
|
226
|
+
return false;
|
|
227
|
+
for (const key of Object.keys(source)) {
|
|
228
|
+
if (!(key in output))
|
|
229
|
+
return false;
|
|
230
|
+
if (!keysSurvive(source[key], output[key]))
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
return true;
|
|
234
|
+
}
|