cool-workflow 0.1.92 → 0.1.94
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 +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/README.md +104 -129
- package/apps/architecture-review/app.json +1 -1
- package/apps/architecture-review-fast/app.json +1 -1
- package/apps/architecture-review-fast/workflow.js +15 -2
- package/apps/end-to-end-golden-path/app.json +1 -1
- package/apps/pr-review-fix-ci/app.json +1 -1
- package/apps/release-cut/app.json +1 -1
- package/apps/research-synthesis/app.json +1 -1
- package/dist/capability-core.js +47 -0
- package/dist/capability-registry.js +2 -0
- package/dist/cli/command-surface.js +165 -1352
- package/dist/cli/format.js +56 -0
- package/dist/cli/handlers/audit.js +82 -0
- package/dist/cli/handlers/blackboard.js +81 -0
- package/dist/cli/handlers/candidate.js +40 -0
- package/dist/cli/handlers/clones.js +34 -0
- package/dist/cli/handlers/collaboration.js +61 -0
- package/dist/cli/handlers/eval.js +40 -0
- package/dist/cli/handlers/maintenance.js +107 -0
- package/dist/cli/handlers/multi-agent.js +165 -0
- package/dist/cli/handlers/node.js +41 -0
- package/dist/cli/handlers/operational.js +155 -0
- package/dist/cli/handlers/operator.js +146 -0
- package/dist/cli/handlers/registry.js +68 -0
- package/dist/cli/handlers/run.js +153 -0
- package/dist/cli/handlers/scheduling.js +126 -0
- package/dist/cli/handlers/workbench.js +41 -0
- package/dist/cli/handlers/worker.js +45 -0
- package/dist/cli/io.js +27 -0
- package/dist/cli/run-summary.js +45 -0
- package/dist/commit.js +0 -5
- package/dist/execution-backend.js +0 -11
- package/dist/mcp/tool-call.js +2 -0
- package/dist/mcp/tool-definitions.js +8 -0
- package/dist/orchestrator/app-operations.js +205 -0
- package/dist/orchestrator.js +41 -153
- package/dist/state-explosion.js +0 -7
- package/dist/term.js +0 -18
- package/dist/validation.js +0 -21
- package/dist/version.js +1 -1
- package/docs/agent-delegation-drive.7.md +13 -7
- package/docs/cli-mcp-parity.7.md +19 -2
- package/docs/contract-migration-tooling.7.md +3 -1
- package/docs/control-plane-scheduling.7.md +3 -1
- package/docs/durable-state-and-locking.7.md +3 -1
- package/docs/evidence-adoption-reasoning-chain.7.md +3 -1
- package/docs/execution-backends.7.md +3 -1
- package/docs/mcp-app-surface.7.md +12 -0
- package/docs/multi-agent-cli-mcp-surface.7.md +3 -1
- package/docs/multi-agent-eval-replay-harness.7.md +3 -1
- package/docs/multi-agent-operator-ux.7.md +3 -1
- package/docs/node-snapshot-diff-replay.7.md +3 -1
- package/docs/observability-cost-accounting.7.md +3 -1
- package/docs/project-index.md +16 -3
- package/docs/real-execution-backends.7.md +3 -1
- package/docs/release-and-migration.7.md +3 -1
- package/docs/release-tooling.7.md +3 -1
- package/docs/run-registry-control-plane.7.md +27 -3
- package/docs/run-retention-reclamation.7.md +3 -1
- package/docs/state-explosion-management.7.md +3 -1
- package/docs/team-collaboration.7.md +3 -1
- package/docs/web-desktop-workbench.7.md +3 -1
- package/manifest/plugin.manifest.json +1 -1
- package/package.json +1 -1
- package/scripts/agents/builtin-templates.json +3 -2
- package/scripts/agents/claude-p-agent.js +6 -6
- package/scripts/agents/codex-agent.js +17 -3
- package/scripts/agents/deepseek-agent.js +23 -0
- package/scripts/agents/gemini-opencode-agent.js +25 -0
- package/scripts/agents/opencode-agent.js +57 -8
- package/scripts/architecture-review-fast.js +19 -5
- package/scripts/bump-version.js +16 -0
- package/scripts/canonical-apps.js +4 -4
- package/scripts/dogfood-release.js +1 -1
- package/scripts/golden-path.js +4 -4
- package/scripts/parity-check.js +9 -1
- package/scripts/release-flow.js +35 -0
- package/scripts/vendor-preflight.js +127 -0
- package/scripts/version-sync-check.js +5 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.humanBytes = humanBytes;
|
|
4
|
+
exports.formatClonesList = formatClonesList;
|
|
5
|
+
exports.formatClonesGc = formatClonesGc;
|
|
6
|
+
exports.formatWorkbenchView = formatWorkbenchView;
|
|
7
|
+
function humanBytes(n) {
|
|
8
|
+
if (n < 1024)
|
|
9
|
+
return `${n}B`;
|
|
10
|
+
const units = ["KiB", "MiB", "GiB"];
|
|
11
|
+
let v = n / 1024;
|
|
12
|
+
let i = 0;
|
|
13
|
+
while (v >= 1024 && i < units.length - 1) {
|
|
14
|
+
v /= 1024;
|
|
15
|
+
i += 1;
|
|
16
|
+
}
|
|
17
|
+
return `${v.toFixed(1)}${units[i]}`;
|
|
18
|
+
}
|
|
19
|
+
function formatClonesList(result) {
|
|
20
|
+
if (result.count === 0)
|
|
21
|
+
return `No cached remote checkouts in ${result.clonesDir}.`;
|
|
22
|
+
const rows = result.entries.map((e) => {
|
|
23
|
+
const when = e.fetchedAt ? e.fetchedAt.replace("T", " ").replace(/\..*$/, "Z") : "unknown";
|
|
24
|
+
return ` ${e.kind.padEnd(7)} ${humanBytes(e.bytes).padStart(8)} ${when} ${e.url}${e.ref ? `@${e.ref}` : ""}`;
|
|
25
|
+
});
|
|
26
|
+
return [
|
|
27
|
+
`${result.count} cached checkout${result.count === 1 ? "" : "s"} — ${humanBytes(result.totalBytes)} in ${result.clonesDir}`,
|
|
28
|
+
" KIND SIZE FETCHED SOURCE",
|
|
29
|
+
...rows,
|
|
30
|
+
`\nReclaim with: cw clones gc --older-than-days 30 (or --all)`
|
|
31
|
+
].join("\n");
|
|
32
|
+
}
|
|
33
|
+
function formatClonesGc(result) {
|
|
34
|
+
const scope = result.all ? "all entries" : `entries older than ${result.olderThanDays} day(s)`;
|
|
35
|
+
if (result.removed.length === 0)
|
|
36
|
+
return `Nothing to reclaim (${scope}); ${result.keptCount} kept in ${result.clonesDir}.`;
|
|
37
|
+
const rows = result.removed.map((r) => ` ${humanBytes(r.bytes).padStart(8)} ${r.url}`);
|
|
38
|
+
return [
|
|
39
|
+
`Reclaimed ${result.removed.length} checkout${result.removed.length === 1 ? "" : "s"} (${scope}) — freed ${humanBytes(result.freedBytes)}; ${result.keptCount} kept`,
|
|
40
|
+
...rows
|
|
41
|
+
].join("\n");
|
|
42
|
+
}
|
|
43
|
+
function formatWorkbenchView(view) {
|
|
44
|
+
const lines = [
|
|
45
|
+
`Workbench view ${view.runId} (${view.resolved ? "resolved" : "UNRESOLVED"})`,
|
|
46
|
+
view.error ? ` error: ${view.error}` : ""
|
|
47
|
+
].filter(Boolean);
|
|
48
|
+
for (const [group, panels] of Object.entries(view.panels)) {
|
|
49
|
+
lines.push(` ${group}:`);
|
|
50
|
+
for (const [name, panel] of Object.entries(panels)) {
|
|
51
|
+
const note = panel.status === "present" ? panel.capability : `absent (${panel.error || "unreadable"})`;
|
|
52
|
+
lines.push(` ${name}: ${panel.status} — ${note}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return lines.join("\n");
|
|
56
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleAudit = handleAudit;
|
|
4
|
+
const capability_core_1 = require("../../capability-core");
|
|
5
|
+
const operator_ux_1 = require("../../operator-ux");
|
|
6
|
+
const io_1 = require("../io");
|
|
7
|
+
/** `cw audit summary|verify|worker|provenance|multi-agent|policy|role|blackboard|judge|attest|decision <run-id> [worker-id|role-id]`. */
|
|
8
|
+
function handleAudit(args, runner) {
|
|
9
|
+
const [subcommand, runId, id] = args.positionals;
|
|
10
|
+
switch (subcommand) {
|
|
11
|
+
case "summary":
|
|
12
|
+
(0, io_1.printJson)(runner.auditSummary((0, io_1.required)(runId, "run id")));
|
|
13
|
+
return;
|
|
14
|
+
case "verify": {
|
|
15
|
+
const result = (0, capability_core_1.auditVerify)(runner, { ...args.options, runId: (0, io_1.required)(runId, "run id") });
|
|
16
|
+
(0, io_1.printJson)(result);
|
|
17
|
+
// Fail-closed: any unverified chain exits non-zero so `cw audit verify
|
|
18
|
+
// <run> && deploy` stops — mirrors the telemetry-verify guard. verifyTrustAudit
|
|
19
|
+
// returns verified:true for a truly absent/empty chain (nothing to prove),
|
|
20
|
+
// so this stays exit 0 there; a FULLY-corrupt log reports present:false but
|
|
21
|
+
// verified:false (corruptLines>0) and must NOT be conflated with absent — the
|
|
22
|
+
// earlier `present && ...` guard let that severe tamper escape (exit 0).
|
|
23
|
+
if (!result.verified)
|
|
24
|
+
process.exitCode = 1;
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
case "worker":
|
|
28
|
+
(0, io_1.printJson)(runner.workerAudit((0, io_1.required)(runId, "run id"), (0, io_1.required)(id, "worker id")));
|
|
29
|
+
return;
|
|
30
|
+
case "provenance":
|
|
31
|
+
(0, io_1.printJson)(runner.evidenceProvenance((0, io_1.required)(runId, "run id"), args.options));
|
|
32
|
+
return;
|
|
33
|
+
case "multi-agent": {
|
|
34
|
+
const view = runner.auditMultiAgent((0, io_1.required)(runId, "run id"));
|
|
35
|
+
if ((0, io_1.wantsJson)(args.options))
|
|
36
|
+
(0, io_1.printJson)(view);
|
|
37
|
+
else
|
|
38
|
+
process.stdout.write(`${(0, operator_ux_1.formatMultiAgentTrustAudit)(view)}\n`);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
case "policy": {
|
|
42
|
+
const view = runner.auditPolicy((0, io_1.required)(runId, "run id"));
|
|
43
|
+
if ((0, io_1.wantsJson)(args.options))
|
|
44
|
+
(0, io_1.printJson)(view);
|
|
45
|
+
else
|
|
46
|
+
process.stdout.write(`${(0, operator_ux_1.formatMultiAgentTrustAudit)(view)}\n`);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
case "role": {
|
|
50
|
+
const view = runner.auditRole((0, io_1.required)(runId, "run id"), (0, io_1.required)(id, "role id"));
|
|
51
|
+
if ((0, io_1.wantsJson)(args.options))
|
|
52
|
+
(0, io_1.printJson)(view);
|
|
53
|
+
else
|
|
54
|
+
process.stdout.write(`${(0, operator_ux_1.formatMultiAgentTrustAudit)(view)}\n`);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
case "blackboard": {
|
|
58
|
+
const view = runner.auditBlackboard((0, io_1.required)(runId, "run id"));
|
|
59
|
+
if ((0, io_1.wantsJson)(args.options))
|
|
60
|
+
(0, io_1.printJson)(view);
|
|
61
|
+
else
|
|
62
|
+
process.stdout.write(`${(0, operator_ux_1.formatMultiAgentTrustAudit)(view)}\n`);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
case "judge": {
|
|
66
|
+
const view = runner.auditJudge((0, io_1.required)(runId, "run id"));
|
|
67
|
+
if ((0, io_1.wantsJson)(args.options))
|
|
68
|
+
(0, io_1.printJson)(view);
|
|
69
|
+
else
|
|
70
|
+
process.stdout.write(`${(0, operator_ux_1.formatMultiAgentTrustAudit)(view)}\n`);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
case "attest":
|
|
74
|
+
(0, io_1.printJson)(runner.recordAuditAttestation((0, io_1.required)(runId, "run id"), args.options));
|
|
75
|
+
return;
|
|
76
|
+
case "decision":
|
|
77
|
+
(0, io_1.printJson)(runner.recordAuditDecision((0, io_1.required)(runId, "run id"), (0, io_1.required)(id, "worker id"), args.options));
|
|
78
|
+
return;
|
|
79
|
+
default:
|
|
80
|
+
throw new Error("Usage: cw.js audit summary|worker|provenance|multi-agent|policy|role|blackboard|judge|attest|decision <run-id> [worker-id|role-id]");
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleBlackboard = handleBlackboard;
|
|
4
|
+
exports.handleCoordinator = handleCoordinator;
|
|
5
|
+
const state_explosion_1 = require("../../state-explosion");
|
|
6
|
+
const io_1 = require("../io");
|
|
7
|
+
/** `cw blackboard <verb> <run-id> …` — shared-blackboard read/write family. */
|
|
8
|
+
function handleBlackboard(args, runner) {
|
|
9
|
+
const [subcommand, action, runId] = args.positionals;
|
|
10
|
+
switch (subcommand) {
|
|
11
|
+
case "summary":
|
|
12
|
+
(0, io_1.printJson)(runner.blackboardSummary((0, io_1.required)(action, "run id"), args.options));
|
|
13
|
+
return;
|
|
14
|
+
case "summarize": {
|
|
15
|
+
const digest = runner.blackboardSummarize((0, io_1.required)(action, "run id"), args.options);
|
|
16
|
+
if ((0, io_1.wantsJson)(args.options))
|
|
17
|
+
(0, io_1.printJson)(digest);
|
|
18
|
+
else
|
|
19
|
+
process.stdout.write(`${(0, state_explosion_1.formatBlackboardDigest)(digest)}\n`);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
case "graph":
|
|
23
|
+
(0, io_1.printJson)(runner.blackboardGraph((0, io_1.required)(action, "run id")));
|
|
24
|
+
return;
|
|
25
|
+
case "resolve":
|
|
26
|
+
(0, io_1.printJson)(runner.resolveRunBlackboard((0, io_1.required)(action, "run id"), args.options));
|
|
27
|
+
return;
|
|
28
|
+
case "topic":
|
|
29
|
+
if (action === "create") {
|
|
30
|
+
(0, io_1.printJson)(runner.createBlackboardTopic((0, io_1.required)(runId, "run id"), args.options));
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
break;
|
|
34
|
+
case "message":
|
|
35
|
+
if (action === "post") {
|
|
36
|
+
(0, io_1.printJson)(runner.postBlackboardMessage((0, io_1.required)(runId, "run id"), args.options));
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (action === "list") {
|
|
40
|
+
(0, io_1.printJson)(runner.listBlackboardMessages((0, io_1.required)(runId, "run id"), args.options));
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
break;
|
|
44
|
+
case "context":
|
|
45
|
+
if (action === "put") {
|
|
46
|
+
(0, io_1.printJson)(runner.putBlackboardContext((0, io_1.required)(runId, "run id"), args.options));
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
break;
|
|
50
|
+
case "artifact":
|
|
51
|
+
if (action === "add") {
|
|
52
|
+
(0, io_1.printJson)(runner.addBlackboardArtifact((0, io_1.required)(runId, "run id"), args.options));
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (action === "list") {
|
|
56
|
+
(0, io_1.printJson)(runner.listBlackboardArtifacts((0, io_1.required)(runId, "run id"), args.options));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
break;
|
|
60
|
+
case "snapshot":
|
|
61
|
+
(0, io_1.printJson)(runner.snapshotBlackboard((0, io_1.required)(action, "run id"), args.options));
|
|
62
|
+
return;
|
|
63
|
+
default:
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
throw new Error("Usage: cw.js blackboard summary|summarize|graph|resolve <run-id> | topic create <run-id> | message post|list <run-id> | context put <run-id> | artifact add|list <run-id> | snapshot <run-id>");
|
|
67
|
+
}
|
|
68
|
+
/** `cw coordinator summary|decision <run-id> …` — coordinator decision ledger. */
|
|
69
|
+
function handleCoordinator(args, runner) {
|
|
70
|
+
const [subcommand, runId] = args.positionals;
|
|
71
|
+
switch (subcommand) {
|
|
72
|
+
case "summary":
|
|
73
|
+
(0, io_1.printJson)(runner.coordinatorSummary((0, io_1.required)(runId, "run id"), args.options));
|
|
74
|
+
return;
|
|
75
|
+
case "decision":
|
|
76
|
+
(0, io_1.printJson)(runner.recordCoordinatorDecision((0, io_1.required)(runId, "run id"), args.options));
|
|
77
|
+
return;
|
|
78
|
+
default:
|
|
79
|
+
throw new Error("Usage: cw.js coordinator summary <run-id> | coordinator decision <run-id> --kind <kind> --outcome <outcome> --reason TEXT");
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleCandidate = handleCandidate;
|
|
4
|
+
const operator_ux_1 = require("../../operator-ux");
|
|
5
|
+
const io_1 = require("../io");
|
|
6
|
+
/** `cw candidate list|show|register|score|rank|select|reject|summary <run-id> [candidate-id]`. */
|
|
7
|
+
function handleCandidate(args, runner) {
|
|
8
|
+
const [subcommand, runId, candidateId, reason] = args.positionals;
|
|
9
|
+
switch (subcommand) {
|
|
10
|
+
case "list":
|
|
11
|
+
(0, io_1.printJson)(runner.listCandidates((0, io_1.required)(runId, "run id"), args.options));
|
|
12
|
+
return;
|
|
13
|
+
case "show":
|
|
14
|
+
(0, io_1.printJson)(runner.showCandidate((0, io_1.required)(runId, "run id"), (0, io_1.required)(candidateId, "candidate id")));
|
|
15
|
+
return;
|
|
16
|
+
case "register":
|
|
17
|
+
(0, io_1.printJson)(runner.registerCandidate((0, io_1.required)(runId, "run id"), args.options));
|
|
18
|
+
return;
|
|
19
|
+
case "score":
|
|
20
|
+
(0, io_1.printJson)(runner.scoreCandidate((0, io_1.required)(runId, "run id"), (0, io_1.required)(candidateId, "candidate id"), args.options));
|
|
21
|
+
return;
|
|
22
|
+
case "rank":
|
|
23
|
+
(0, io_1.printJson)(runner.rankCandidates((0, io_1.required)(runId, "run id"), args.options));
|
|
24
|
+
return;
|
|
25
|
+
case "select":
|
|
26
|
+
(0, io_1.printJson)(runner.selectCandidate((0, io_1.required)(runId, "run id"), (0, io_1.required)(candidateId, "candidate id"), args.options));
|
|
27
|
+
return;
|
|
28
|
+
case "reject":
|
|
29
|
+
(0, io_1.printJson)(runner.rejectCandidate((0, io_1.required)(runId, "run id"), (0, io_1.required)(candidateId, "candidate id"), String(args.options.reason || args.options.message || reason || "rejected")));
|
|
30
|
+
return;
|
|
31
|
+
case "summary":
|
|
32
|
+
if ((0, io_1.wantsJson)(args.options))
|
|
33
|
+
(0, io_1.printJson)(runner.summarizeCandidateOperatorRecords((0, io_1.required)(runId, "run id")));
|
|
34
|
+
else
|
|
35
|
+
process.stdout.write(`${(0, operator_ux_1.formatCandidateSummary)(runner.summarizeCandidateOperatorRecords((0, io_1.required)(runId, "run id")))}\n`);
|
|
36
|
+
return;
|
|
37
|
+
default:
|
|
38
|
+
throw new Error("Usage: cw.js candidate list|show|register|score|rank|select|reject|summary <run-id> [candidate-id]");
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleClones = handleClones;
|
|
4
|
+
// `cw clones` handler — carved out of the command-surface god-dispatch. The
|
|
5
|
+
// remote-source clone cache (v0.1.91): `list` inspects the cached checkouts that
|
|
6
|
+
// `--link`/URL reviews populate; `gc` reclaims them (TTL sweep, or --all). Pure
|
|
7
|
+
// filesystem work — no network, no run registry, no runner needed.
|
|
8
|
+
const capability_core_1 = require("../../capability-core");
|
|
9
|
+
const format_1 = require("../format");
|
|
10
|
+
const io_1 = require("../io");
|
|
11
|
+
/** `cw clones list [--json] | clones gc [--older-than-days N] [--all] [--json]`. */
|
|
12
|
+
function handleClones(args) {
|
|
13
|
+
const [subcommand] = args.positionals;
|
|
14
|
+
switch (subcommand) {
|
|
15
|
+
case "list": {
|
|
16
|
+
const result = (0, capability_core_1.listClones)(args.options);
|
|
17
|
+
if ((0, io_1.wantsJson)(args.options))
|
|
18
|
+
(0, io_1.printJson)(result);
|
|
19
|
+
else
|
|
20
|
+
process.stdout.write(`${(0, format_1.formatClonesList)(result)}\n`);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
case "gc": {
|
|
24
|
+
const result = (0, capability_core_1.gcClones)(args.options);
|
|
25
|
+
if ((0, io_1.wantsJson)(args.options))
|
|
26
|
+
(0, io_1.printJson)(result);
|
|
27
|
+
else
|
|
28
|
+
process.stdout.write(`${(0, format_1.formatClonesGc)(result)}\n`);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
default:
|
|
32
|
+
throw new Error("Usage: cw.js clones list [--json] | clones gc [--older-than-days N] [--all] [--json]");
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleApprove = handleApprove;
|
|
4
|
+
exports.handleReject = handleReject;
|
|
5
|
+
exports.handleComment = handleComment;
|
|
6
|
+
exports.handleHandoff = handleHandoff;
|
|
7
|
+
exports.handleReview = handleReview;
|
|
8
|
+
const io_1 = require("../io");
|
|
9
|
+
/** `cw approve <kind> <run-id> <target-id>` — record an approval on a target. */
|
|
10
|
+
function handleApprove(args, runner) {
|
|
11
|
+
const [targetKind, runId, targetId] = args.positionals;
|
|
12
|
+
(0, io_1.printJson)(runner.collaborationApprove((0, io_1.required)(runId, "run id"), (0, io_1.required)(targetKind, "target kind (candidate|commit|selection|run|task|node)"), (0, io_1.required)(targetId, "target id"), args.options));
|
|
13
|
+
}
|
|
14
|
+
/** `cw reject <kind> <run-id> <target-id>` — record a rejection on a target. */
|
|
15
|
+
function handleReject(args, runner) {
|
|
16
|
+
const [targetKind, runId, targetId] = args.positionals;
|
|
17
|
+
(0, io_1.printJson)(runner.collaborationReject((0, io_1.required)(runId, "run id"), (0, io_1.required)(targetKind, "target kind (candidate|commit|selection|run|task|node)"), (0, io_1.required)(targetId, "target id"), args.options));
|
|
18
|
+
}
|
|
19
|
+
/** `cw comment add <kind> <run-id> <target-id> | comment list <run-id>` — leave or list comments. */
|
|
20
|
+
function handleComment(args, runner) {
|
|
21
|
+
const [subcommand, ...rest] = args.positionals;
|
|
22
|
+
if (subcommand === "add") {
|
|
23
|
+
const [targetKind, runId, targetId] = rest;
|
|
24
|
+
(0, io_1.printJson)(runner.collaborationComment((0, io_1.required)(runId, "run id"), (0, io_1.required)(targetKind, "target kind"), (0, io_1.required)(targetId, "target id"), args.options));
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (subcommand === "list") {
|
|
28
|
+
const result = runner.collaborationCommentList((0, io_1.required)(rest[0], "run id"), args.options);
|
|
29
|
+
if ((0, io_1.wantsJson)(args.options))
|
|
30
|
+
(0, io_1.printJson)(result);
|
|
31
|
+
else
|
|
32
|
+
process.stdout.write(`${runner.formatCommentList(result.comments)}\n`);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
throw new Error("Usage: cw.js comment add <kind> <run-id> <target-id> --body <text> | comment list <run-id> [--json]");
|
|
36
|
+
}
|
|
37
|
+
/** `cw handoff <kind> <run-id> [target-id]` — hand a target off to the next owner. */
|
|
38
|
+
function handleHandoff(args, runner) {
|
|
39
|
+
const [targetKind, runId, targetIdRaw] = args.positionals;
|
|
40
|
+
const kind = (0, io_1.required)(targetKind, "target kind (run|task|candidate|commit|node)");
|
|
41
|
+
const rid = (0, io_1.required)(runId, "run id");
|
|
42
|
+
const targetId = targetIdRaw || (kind === "run" ? rid : undefined);
|
|
43
|
+
(0, io_1.printJson)(runner.collaborationHandoff(rid, kind, (0, io_1.required)(targetId, "target id"), args.options));
|
|
44
|
+
}
|
|
45
|
+
/** `cw review status <run-id> | review policy <run-id> …` — read or set review state/policy. */
|
|
46
|
+
function handleReview(args, runner) {
|
|
47
|
+
const [subcommand, runId] = args.positionals;
|
|
48
|
+
if (subcommand === "status") {
|
|
49
|
+
const report = runner.reviewStatus((0, io_1.required)(runId, "run id"), args.options);
|
|
50
|
+
if ((0, io_1.wantsJson)(args.options))
|
|
51
|
+
(0, io_1.printJson)(report);
|
|
52
|
+
else
|
|
53
|
+
process.stdout.write(`${runner.formatReviewStatus(report)}\n`);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (subcommand === "policy") {
|
|
57
|
+
(0, io_1.printJson)(runner.reviewPolicy((0, io_1.required)(runId, "run id"), args.options));
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
throw new Error("Usage: cw.js review status <run-id> [--json] | review policy <run-id> --required-approvals N --authorized-roles a,b --applies-to commit,selection");
|
|
61
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleEval = handleEval;
|
|
4
|
+
const multi_agent_eval_1 = require("../../multi-agent-eval");
|
|
5
|
+
const io_1 = require("../io");
|
|
6
|
+
/** `cw eval snapshot|replay|compare|score|gate|report …` — multi-agent eval. */
|
|
7
|
+
function handleEval(args, runner) {
|
|
8
|
+
const [subcommand, first, second] = args.positionals;
|
|
9
|
+
let result;
|
|
10
|
+
switch (subcommand) {
|
|
11
|
+
case "snapshot":
|
|
12
|
+
result = runner.evalSnapshot((0, io_1.required)(first, "run id"), args.options);
|
|
13
|
+
break;
|
|
14
|
+
case "replay":
|
|
15
|
+
result = runner.evalReplay((0, io_1.required)(first, "snapshot id or path"), args.options);
|
|
16
|
+
break;
|
|
17
|
+
case "compare":
|
|
18
|
+
result = runner.evalCompare((0, io_1.required)(first, "baseline id or path"), (0, io_1.required)(second, "replay id or path"));
|
|
19
|
+
break;
|
|
20
|
+
case "score":
|
|
21
|
+
result = runner.evalScore((0, io_1.required)(first, "replay id or path"));
|
|
22
|
+
break;
|
|
23
|
+
case "gate":
|
|
24
|
+
result = runner.evalGate((0, io_1.required)(first, "suite id or path"));
|
|
25
|
+
if (!(0, io_1.wantsJson)(args.options) && result.status === "fail")
|
|
26
|
+
process.exitCode = 1;
|
|
27
|
+
break;
|
|
28
|
+
case "report":
|
|
29
|
+
result = runner.evalReport((0, io_1.required)(first, "replay id or path"));
|
|
30
|
+
break;
|
|
31
|
+
default:
|
|
32
|
+
throw new Error("Usage: cw.js eval snapshot <run-id> --id <snapshot-id> | replay <snapshot-id-or-path> | compare <baseline-id-or-path> <replay-id-or-path> | score <replay-id-or-path> | gate <suite-id-or-path> | report <replay-id-or-path>");
|
|
33
|
+
}
|
|
34
|
+
if ((0, io_1.wantsJson)(args.options))
|
|
35
|
+
(0, io_1.printJson)(result);
|
|
36
|
+
else
|
|
37
|
+
process.stdout.write(`${(0, multi_agent_eval_1.formatMultiAgentEval)(result)}\n`);
|
|
38
|
+
if (subcommand === "gate" && result.status === "fail")
|
|
39
|
+
process.exitCode = 1;
|
|
40
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleGc = handleGc;
|
|
4
|
+
exports.handleTelemetry = handleTelemetry;
|
|
5
|
+
exports.handleDemo = handleDemo;
|
|
6
|
+
const capability_core_1 = require("../../capability-core");
|
|
7
|
+
const run_registry_1 = require("../../run-registry");
|
|
8
|
+
const telemetry_demo_1 = require("../../telemetry-demo");
|
|
9
|
+
const io_1 = require("../io");
|
|
10
|
+
/** `cw gc plan|run|verify [run-id] …` — run retention & provable reclamation. */
|
|
11
|
+
function handleGc(args, runner) {
|
|
12
|
+
// Run Retention & Provable Reclamation (v0.1.39). `plan` is a pure dry-run
|
|
13
|
+
// (frees nothing); `run` executes the write-ahead reclamation transaction;
|
|
14
|
+
// `verify` re-proves a reclaimed run. CW never reclaims by default.
|
|
15
|
+
const registry = (0, capability_core_1.runRegistryFor)(args.options, runner);
|
|
16
|
+
const [subcommand, id] = args.positionals;
|
|
17
|
+
switch (subcommand) {
|
|
18
|
+
case "plan": {
|
|
19
|
+
const result = (0, capability_core_1.gcPlan)(registry, id, args.options);
|
|
20
|
+
if ((0, io_1.wantsJson)(args.options))
|
|
21
|
+
(0, io_1.printJson)(result);
|
|
22
|
+
else
|
|
23
|
+
process.stdout.write(`${(0, run_registry_1.formatGcPlan)(result)}\n`);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
case "run": {
|
|
27
|
+
const result = (0, capability_core_1.gcRun)(registry, id, args.options);
|
|
28
|
+
if ((0, io_1.wantsJson)(args.options))
|
|
29
|
+
(0, io_1.printJson)(result);
|
|
30
|
+
else
|
|
31
|
+
process.stdout.write(`${(0, run_registry_1.formatGcRun)(result)}\n`);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
case "verify": {
|
|
35
|
+
const result = (0, capability_core_1.gcVerify)(registry, (0, io_1.required)(id, "run id"), args.options);
|
|
36
|
+
if ((0, io_1.wantsJson)(args.options))
|
|
37
|
+
(0, io_1.printJson)(result);
|
|
38
|
+
else
|
|
39
|
+
process.stdout.write(`${(0, run_registry_1.formatGcVerify)(result)}\n`);
|
|
40
|
+
// Fail closed ONLY on a real integrity failure: a run that WAS reclaimed
|
|
41
|
+
// but no longer re-proves. A not-reclaimed run has nothing to verify
|
|
42
|
+
// (reclaimed:false/verified:false) and must not be treated as a failure.
|
|
43
|
+
// LIMIT (honest): a DELETED reclaimed.json reads as reclaimed:false, so
|
|
44
|
+
// proof-deletion is indistinguishable from never-reclaimed here without
|
|
45
|
+
// an independent witness (e.g. a trust-audit reclamation event) — a
|
|
46
|
+
// follow-up. This guard is still strictly better than the prior exit-0.
|
|
47
|
+
if (result.reclaimed && !result.verified)
|
|
48
|
+
process.exitCode = 1;
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
default:
|
|
52
|
+
throw new Error("Usage: cw.js gc plan|run|verify [run-id] [--reclaimAfterArchiveDays N] [--keep-scratch] [--keep-snapshots] [--limit N] [--json]");
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/** `cw telemetry verify <run-id> …` — verify the signed telemetry ledger. */
|
|
56
|
+
function handleTelemetry(args, runner) {
|
|
57
|
+
const [subcommand, id] = args.positionals;
|
|
58
|
+
switch (subcommand) {
|
|
59
|
+
case "verify": {
|
|
60
|
+
const result = (0, capability_core_1.telemetryVerify)(runner, { ...args.options, runId: id || args.options.runId || args.options.run });
|
|
61
|
+
if ((0, io_1.wantsJson)(args.options))
|
|
62
|
+
(0, io_1.printJson)(result);
|
|
63
|
+
else
|
|
64
|
+
process.stdout.write(`${(0, telemetry_demo_1.formatTelemetryVerify)(result)}\n`);
|
|
65
|
+
// Fail closed: a forged/edited/corrupt ledger verifies false — report it
|
|
66
|
+
// through the exit code so `cw telemetry verify <run> && deploy` cannot
|
|
67
|
+
// pass on a lie. (Absent ledger = present:false/verified:true -> exit 0.)
|
|
68
|
+
if (!result.verified)
|
|
69
|
+
process.exitCode = 1;
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
default:
|
|
73
|
+
throw new Error("Usage: cw.js telemetry verify <run-id> [--pubkey <pem-or-path>] [--json]");
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/** `cw demo tamper|bundle [--json]` — the tamper/bundle integrity demos. */
|
|
77
|
+
function handleDemo(args, runner) {
|
|
78
|
+
const [subcommand] = args.positionals;
|
|
79
|
+
switch (subcommand) {
|
|
80
|
+
case "tamper": {
|
|
81
|
+
const result = (0, capability_core_1.demoTamper)(runner, args.options);
|
|
82
|
+
if ((0, io_1.wantsJson)(args.options))
|
|
83
|
+
(0, io_1.printJson)(result);
|
|
84
|
+
else
|
|
85
|
+
process.stdout.write(`${(0, telemetry_demo_1.formatTamperDemo)(result)}\n`);
|
|
86
|
+
// Fail closed: if the proof did not hold (a tamper went undetected),
|
|
87
|
+
// exit nonzero so the demo can never green a broken guarantee.
|
|
88
|
+
if (!result.proven)
|
|
89
|
+
process.exitCode = 1;
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
case "bundle": {
|
|
93
|
+
const result = (0, capability_core_1.demoBundle)(runner, args.options);
|
|
94
|
+
if ((0, io_1.wantsJson)(args.options))
|
|
95
|
+
(0, io_1.printJson)(result);
|
|
96
|
+
else
|
|
97
|
+
process.stdout.write(`${(0, telemetry_demo_1.formatBundleDemo)(result)}\n`);
|
|
98
|
+
// Fail closed: a forged bundle that verified would be a regression in the
|
|
99
|
+
// bundle guarantee — exit nonzero so the demo can never green it.
|
|
100
|
+
if (!result.proven)
|
|
101
|
+
process.exitCode = 1;
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
default:
|
|
105
|
+
throw new Error("Usage: cw.js demo tamper|bundle [--json]");
|
|
106
|
+
}
|
|
107
|
+
}
|