cool-workflow 0.1.97 → 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.
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/README.md +11 -2
- package/apps/architecture-review/app.json +1 -1
- package/apps/architecture-review-fast/app.json +1 -1
- 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/cli/dispatch.js +236 -0
- package/dist/cli/entry.js +120 -0
- package/dist/cli/io.js +21 -4
- package/dist/cli/parseargv.js +157 -0
- package/dist/cli.js +6 -33
- package/dist/core/capability-table.js +3534 -0
- package/dist/core/format/help.js +314 -0
- package/dist/{state-explosion/format.js → core/format/state-explosion-text.js} +10 -1
- package/dist/core/hash.js +137 -0
- package/dist/core/multi-agent/candidate-scoring.js +219 -0
- package/dist/core/multi-agent/collaboration.js +481 -0
- package/dist/core/multi-agent/coordinator.js +515 -0
- package/dist/core/multi-agent/eval-replay.js +306 -0
- package/dist/core/multi-agent/runtime.js +929 -0
- package/dist/core/multi-agent/topology.js +298 -0
- package/dist/core/multi-agent/trust-policy.js +197 -0
- package/dist/core/pipeline/commit-gate.js +320 -0
- package/dist/{pipeline-contract.js → core/pipeline/contract.js} +24 -37
- package/dist/core/pipeline/dispatch.js +103 -0
- package/dist/core/pipeline/drive-decide.js +227 -0
- package/dist/core/pipeline/error-feedback.js +161 -0
- package/dist/core/pipeline/loop-expansion.js +124 -0
- package/dist/{result-normalize.js → core/pipeline/result-normalize.js} +14 -37
- package/dist/core/pipeline/runner.js +230 -0
- package/dist/{contract-migration.js → core/state/contract-migration.js} +68 -92
- package/dist/{state-migrations.js → core/state/migrations.js} +103 -96
- package/dist/core/state/node-projection.js +95 -0
- package/dist/core/state/node-snapshot.js +230 -0
- package/dist/core/state/run-paths.js +93 -0
- package/dist/{schema-validate.js → core/state/schema-validate.js} +35 -28
- package/dist/core/state/schema.js +50 -0
- package/dist/core/state/state-explosion/digest.js +243 -0
- package/dist/core/state/state-explosion/graph.js +527 -0
- package/dist/{state-explosion → core/state/state-explosion}/helpers.js +34 -3
- package/dist/core/state/state-explosion/report.js +187 -0
- package/dist/{state-explosion → core/state/state-explosion}/size.js +25 -7
- package/dist/{state-node.js → core/state/state-node.js} +90 -113
- package/dist/core/state/types.js +19 -0
- package/dist/{validation.js → core/state/validation.js} +64 -131
- package/dist/core/trust/evidence-grounding.js +134 -0
- package/dist/core/trust/ledger.js +199 -0
- package/dist/{telemetry-attestation.js → core/trust/telemetry-attestation.js} +94 -68
- package/dist/core/trust/telemetry-ledger.js +127 -0
- package/dist/core/types.js +20 -0
- package/dist/core/version.js +16 -0
- package/dist/{workflow-app-framework.js → core/workflow-apps/app-schema.js} +337 -426
- package/dist/mcp/dispatch.js +104 -0
- package/dist/mcp/server.js +144 -0
- package/dist/mcp-server.js +6 -84
- package/dist/{agent-config.js → shell/agent-config.js} +118 -71
- package/dist/shell/app-run-cli.js +88 -0
- package/dist/shell/audit-cli.js +259 -0
- package/dist/shell/audit-provenance.js +83 -0
- package/dist/shell/candidate-scoring-io.js +459 -0
- package/dist/shell/collaboration-io.js +264 -0
- package/dist/shell/commit-summary.js +104 -0
- package/dist/shell/commit.js +290 -0
- package/dist/shell/coordinator-io.js +476 -0
- package/dist/shell/demo-cli.js +19 -0
- package/dist/shell/dispatch.js +162 -0
- package/dist/{doctor.js → shell/doctor.js} +123 -56
- package/dist/shell/drive.js +873 -0
- package/dist/shell/error-feedback-io.js +305 -0
- package/dist/shell/eval-io.js +473 -0
- package/dist/{multi-agent-eval/format.js → shell/eval-text.js} +78 -49
- package/dist/{evidence-reasoning.js → shell/evidence-reasoning.js} +124 -255
- package/dist/shell/exec-backend-cli.js +88 -0
- package/dist/shell/execution-backend/agent.js +475 -0
- package/dist/shell/execution-backend/ci.js +15 -0
- package/dist/shell/execution-backend/container.js +69 -0
- package/dist/shell/execution-backend/envelopes.js +55 -0
- package/dist/shell/execution-backend/local.js +113 -0
- package/dist/shell/execution-backend/probes.js +175 -0
- package/dist/shell/execution-backend/registry.js +402 -0
- package/dist/shell/execution-backend/remote.js +128 -0
- package/dist/shell/execution-backend/types.js +11 -0
- package/dist/shell/feedback-cli.js +81 -0
- package/dist/shell/feedback-operations.js +48 -0
- package/dist/shell/fs-atomic.js +276 -0
- package/dist/shell/harness.js +98 -0
- package/dist/shell/ledger-cli.js +212 -0
- package/dist/shell/ledger-io.js +169 -0
- package/dist/shell/man-cli.js +89 -0
- package/dist/shell/metrics-cli.js +98 -0
- package/dist/shell/multi-agent-cli.js +1002 -0
- package/dist/shell/multi-agent-host.js +563 -0
- package/dist/shell/multi-agent-io.js +387 -0
- package/dist/{multi-agent-operator-ux.js → shell/multi-agent-operator-ux.js} +234 -191
- package/dist/shell/node-store.js +124 -0
- package/dist/{observability/format.js → shell/observability-format.js} +7 -1
- package/dist/{observability/intake.js → shell/observability-intake.js} +79 -56
- package/dist/{observability.js → shell/observability.js} +159 -332
- package/dist/{onramp.js → shell/onramp.js} +11 -0
- package/dist/{operator-ux/format.js → shell/operator-ux-text.js} +250 -239
- package/dist/shell/operator-ux.js +431 -0
- package/dist/shell/orchestrator.js +231 -0
- package/dist/shell/pipeline-cli.js +667 -0
- package/dist/shell/pipeline.js +217 -0
- package/dist/shell/reclamation-io.js +1366 -0
- package/dist/shell/registry-cli.js +329 -0
- package/dist/{remote-source.js → shell/remote-source.js} +12 -5
- package/dist/shell/report-cli.js +101 -0
- package/dist/shell/report-view-cli.js +117 -0
- package/dist/{orchestrator → shell}/report.js +289 -282
- package/dist/shell/reporter.js +62 -0
- package/dist/shell/run-export-cli.js +106 -0
- package/dist/shell/run-export.js +680 -0
- package/dist/shell/run-registry-io.js +1014 -0
- package/dist/shell/run-store.js +164 -0
- package/dist/{sandbox-profile.js → shell/sandbox-profile.js} +134 -95
- package/dist/{scheduler.js → shell/scheduler-io.js} +248 -48
- package/dist/shell/scheduling-io.js +311 -0
- package/dist/shell/state-cli.js +181 -0
- package/dist/shell/state-explosion-cli.js +197 -0
- package/dist/shell/telemetry-cli.js +85 -0
- package/dist/{telemetry-demo.js → shell/telemetry-demo.js} +149 -119
- package/dist/shell/telemetry-ledger-io.js +132 -0
- package/dist/{term.js → shell/term.js} +36 -46
- package/dist/shell/topology-io.js +361 -0
- package/dist/shell/trust-audit.js +471 -0
- package/dist/{multi-agent-trust.js → shell/trust-policy-io.js} +67 -205
- package/dist/shell/verifier.js +48 -0
- package/dist/shell/workbench-host.js +250 -0
- package/dist/shell/workbench-text.js +18 -0
- package/dist/shell/workbench.js +175 -0
- package/dist/shell/worker-cli.js +124 -0
- package/dist/shell/worker-isolation.js +852 -0
- package/dist/shell/workflow-app-loader.js +650 -0
- package/docs/agent-delegation-drive.7.md +4 -0
- package/docs/cli-mcp-parity.7.md +284 -211
- package/docs/contract-migration-tooling.7.md +4 -0
- package/docs/control-plane-scheduling.7.md +4 -0
- package/docs/cross-agent-ledger.7.md +217 -0
- package/docs/designs/handoff-ledger.md +145 -0
- package/docs/durable-state-and-locking.7.md +4 -0
- package/docs/evidence-adoption-reasoning-chain.7.md +4 -0
- package/docs/execution-backends.7.md +4 -0
- package/docs/handoff-setup.md +120 -0
- package/docs/multi-agent-cli-mcp-surface.7.md +4 -0
- package/docs/multi-agent-eval-replay-harness.7.md +4 -0
- package/docs/multi-agent-operator-ux.7.md +4 -0
- package/docs/node-snapshot-diff-replay.7.md +4 -0
- package/docs/observability-cost-accounting.7.md +4 -0
- package/docs/project-index.md +143 -71
- package/docs/real-execution-backends.7.md +4 -0
- package/docs/release-and-migration.7.md +4 -0
- package/docs/release-tooling.7.md +4 -0
- package/docs/run-registry-control-plane.7.md +4 -0
- package/docs/run-retention-reclamation.7.md +25 -0
- package/docs/state-explosion-management.7.md +4 -0
- package/docs/team-collaboration.7.md +4 -0
- package/docs/web-desktop-workbench.7.md +4 -0
- package/manifest/plugin.manifest.json +1 -1
- package/manifest/source-context-profiles.json +9 -13
- package/package.json +1 -1
- package/scripts/agents/codex-agent.js +34 -4
- package/scripts/agents/cw-attest-wrap.js +2 -2
- package/scripts/bump-version.js +4 -3
- package/scripts/canonical-apps.js +4 -4
- package/scripts/children/batch-delegate-child.js +30 -10
- package/scripts/dogfood-architecture-review.js +2 -3
- package/scripts/dogfood-release.js +3 -3
- package/scripts/gen-parity-doc.js +15 -2
- package/scripts/golden-path.js +4 -4
- package/scripts/onramp-check.js +1 -1
- package/scripts/parity-check.js +38 -21
- package/scripts/release-flow.js +9 -3
- package/scripts/sync-project-index.js +51 -27
- package/scripts/validate-run-state-schema.js +2 -2
- package/scripts/version-sync-check.js +30 -30
- package/dist/candidate-scoring.js +0 -729
- package/dist/capability-core.js +0 -1186
- package/dist/capability-registry.js +0 -879
- package/dist/cli/command-surface.js +0 -490
- package/dist/cli/format.js +0 -56
- package/dist/cli/handlers/audit.js +0 -82
- package/dist/cli/handlers/blackboard.js +0 -81
- package/dist/cli/handlers/candidate.js +0 -40
- package/dist/cli/handlers/clones.js +0 -34
- package/dist/cli/handlers/collaboration.js +0 -61
- package/dist/cli/handlers/eval.js +0 -40
- package/dist/cli/handlers/maintenance.js +0 -107
- package/dist/cli/handlers/multi-agent.js +0 -165
- package/dist/cli/handlers/node.js +0 -41
- package/dist/cli/handlers/operational.js +0 -155
- package/dist/cli/handlers/operator.js +0 -146
- package/dist/cli/handlers/registry.js +0 -68
- package/dist/cli/handlers/run.js +0 -153
- package/dist/cli/handlers/scheduling.js +0 -132
- package/dist/cli/handlers/workbench.js +0 -41
- package/dist/cli/handlers/worker.js +0 -45
- package/dist/cli/run-summary.js +0 -45
- package/dist/clones.js +0 -162
- package/dist/collaboration.js +0 -726
- package/dist/commit.js +0 -592
- package/dist/compare.js +0 -18
- package/dist/coordinator/classify.js +0 -45
- package/dist/coordinator/paths.js +0 -42
- package/dist/coordinator/util.js +0 -126
- package/dist/coordinator.js +0 -990
- package/dist/daemon.js +0 -44
- package/dist/dispatch.js +0 -250
- package/dist/drive.js +0 -827
- package/dist/error-feedback.js +0 -419
- package/dist/evidence-grounding.js +0 -184
- package/dist/execution-backend/agent.js +0 -294
- package/dist/execution-backend/probes.js +0 -112
- package/dist/execution-backend/util.js +0 -47
- package/dist/execution-backend.js +0 -961
- package/dist/gates.js +0 -48
- package/dist/harness.js +0 -61
- package/dist/loop-expansion.js +0 -60
- package/dist/mcp/tool-call.js +0 -434
- package/dist/mcp/tool-definitions.js +0 -1040
- package/dist/mcp-surface.js +0 -30
- package/dist/multi-agent/graph.js +0 -84
- package/dist/multi-agent/helpers.js +0 -141
- package/dist/multi-agent/ids.js +0 -20
- package/dist/multi-agent/paths.js +0 -22
- package/dist/multi-agent-eval/normalize.js +0 -51
- package/dist/multi-agent-eval.js +0 -678
- package/dist/multi-agent-host.js +0 -777
- package/dist/multi-agent.js +0 -984
- package/dist/node-projection.js +0 -59
- package/dist/node-snapshot.js +0 -260
- package/dist/operator-ux.js +0 -631
- package/dist/orchestrator/app-operations.js +0 -211
- package/dist/orchestrator/audit-operations.js +0 -182
- package/dist/orchestrator/candidate-operations.js +0 -117
- package/dist/orchestrator/cli-options.js +0 -294
- package/dist/orchestrator/collaboration-operations.js +0 -86
- package/dist/orchestrator/feedback-operations.js +0 -81
- package/dist/orchestrator/host-operations.js +0 -78
- package/dist/orchestrator/lifecycle-operations.js +0 -626
- package/dist/orchestrator/migration-operations.js +0 -44
- package/dist/orchestrator/multi-agent-operations.js +0 -362
- package/dist/orchestrator/topology-operations.js +0 -84
- package/dist/orchestrator.js +0 -917
- package/dist/pipeline-runner.js +0 -285
- package/dist/reclamation/hash.js +0 -72
- package/dist/reclamation.js +0 -812
- package/dist/reporter.js +0 -67
- package/dist/run-export.js +0 -784
- package/dist/run-registry/derive.js +0 -175
- package/dist/run-registry/format.js +0 -124
- package/dist/run-registry/gc.js +0 -251
- package/dist/run-registry/policy.js +0 -16
- package/dist/run-registry/queue.js +0 -115
- package/dist/run-registry.js +0 -850
- package/dist/run-state-schema.js +0 -68
- package/dist/scheduling.js +0 -184
- package/dist/state-explosion.js +0 -1014
- package/dist/state.js +0 -367
- package/dist/telemetry-ledger.js +0 -196
- package/dist/topology.js +0 -565
- package/dist/triggers.js +0 -184
- package/dist/trust-audit.js +0 -644
- package/dist/types/blackboard.js +0 -2
- package/dist/types/candidate.js +0 -2
- package/dist/types/collaboration.js +0 -2
- package/dist/types/core.js +0 -2
- package/dist/types/drive.js +0 -10
- package/dist/types/error-feedback.js +0 -2
- package/dist/types/evidence-reasoning.js +0 -2
- package/dist/types/execution-backend.js +0 -2
- package/dist/types/multi-agent.js +0 -2
- package/dist/types/observability.js +0 -2
- package/dist/types/pipeline.js +0 -2
- package/dist/types/reclamation.js +0 -8
- package/dist/types/report-bundle.js +0 -6
- package/dist/types/result.js +0 -2
- package/dist/types/run-registry.js +0 -2
- package/dist/types/run.js +0 -2
- package/dist/types/sandbox.js +0 -2
- package/dist/types/schedule.js +0 -2
- package/dist/types/state-node.js +0 -2
- package/dist/types/topology.js +0 -2
- package/dist/types/trust.js +0 -2
- package/dist/types/workbench.js +0 -2
- package/dist/types/worker.js +0 -2
- package/dist/types/workflow-app.js +0 -2
- package/dist/types.js +0 -44
- package/dist/util/fingerprint.js +0 -19
- package/dist/util/fingerprint.test.js +0 -27
- package/dist/verifier.js +0 -78
- package/dist/version.js +0 -8
- package/dist/workbench-host.js +0 -182
- package/dist/workbench.js +0 -192
- package/dist/worker-accept/acceptance.js +0 -114
- package/dist/worker-accept/blackboard-fanout.js +0 -80
- package/dist/worker-accept/blackboard-linkage.js +0 -19
- package/dist/worker-accept/context.js +0 -2
- package/dist/worker-accept/telemetry-ledger.js +0 -126
- package/dist/worker-accept/validation.js +0 -77
- package/dist/worker-accept/verifier-completion.js +0 -73
- package/dist/worker-isolation/helpers.js +0 -51
- package/dist/worker-isolation/paths.js +0 -46
- package/dist/worker-isolation.js +0 -656
- package/dist/workflow-api.js +0 -131
- /package/dist/{types → core/types}/boundary.js +0 -0
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// shell/registry-cli.ts — CLI/MCP-reachable bodies for the milestone-10
|
|
3
|
+
// capability rows: schedule.*, routine.*, registry.*, run.search|list|
|
|
4
|
+
// show|resume|archive|rerun, queue.*, sched.*, gc.*, orphans.*, clones.*,
|
|
5
|
+
// history.
|
|
6
|
+
//
|
|
7
|
+
// MILESTONE 10. Byte-exact port of the old build's
|
|
8
|
+
// src/cli/handlers/{scheduling,registry,maintenance,orphans,clones}.ts +
|
|
9
|
+
// the run-registry-owned slice of src/capability-core.ts. Impure (fs) —
|
|
10
|
+
// this is the shell layer the capability-table's CLI/MCP handlers
|
|
11
|
+
// delegate to.
|
|
12
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
15
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
16
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
17
|
+
}
|
|
18
|
+
Object.defineProperty(o, k2, desc);
|
|
19
|
+
}) : (function(o, m, k, k2) {
|
|
20
|
+
if (k2 === undefined) k2 = k;
|
|
21
|
+
o[k2] = m[k];
|
|
22
|
+
}));
|
|
23
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
24
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
25
|
+
}) : function(o, v) {
|
|
26
|
+
o["default"] = v;
|
|
27
|
+
});
|
|
28
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
29
|
+
var ownKeys = function(o) {
|
|
30
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
31
|
+
var ar = [];
|
|
32
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
33
|
+
return ar;
|
|
34
|
+
};
|
|
35
|
+
return ownKeys(o);
|
|
36
|
+
};
|
|
37
|
+
return function (mod) {
|
|
38
|
+
if (mod && mod.__esModule) return mod;
|
|
39
|
+
var result = {};
|
|
40
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
41
|
+
__setModuleDefault(result, mod);
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
44
|
+
})();
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.scheduleCreateCli = scheduleCreateCli;
|
|
47
|
+
exports.scheduleListCli = scheduleListCli;
|
|
48
|
+
exports.scheduleDeleteCli = scheduleDeleteCli;
|
|
49
|
+
exports.scheduleDueCli = scheduleDueCli;
|
|
50
|
+
exports.scheduleCompleteCli = scheduleCompleteCli;
|
|
51
|
+
exports.schedulePauseCli = schedulePauseCli;
|
|
52
|
+
exports.scheduleResumeCli = scheduleResumeCli;
|
|
53
|
+
exports.scheduleRunNowCli = scheduleRunNowCli;
|
|
54
|
+
exports.scheduleHistoryCli = scheduleHistoryCli;
|
|
55
|
+
exports.scheduleDaemonTickCli = scheduleDaemonTickCli;
|
|
56
|
+
exports.scheduleDaemonRunForever = scheduleDaemonRunForever;
|
|
57
|
+
exports.routineCreateCli = routineCreateCli;
|
|
58
|
+
exports.routineListCli = routineListCli;
|
|
59
|
+
exports.routineDeleteCli = routineDeleteCli;
|
|
60
|
+
exports.routineFireCli = routineFireCli;
|
|
61
|
+
exports.routineEventsCli = routineEventsCli;
|
|
62
|
+
exports.registryRefreshCli = registryRefreshCli;
|
|
63
|
+
exports.registryShowCli = registryShowCli;
|
|
64
|
+
exports.runSearchCli = runSearchCli;
|
|
65
|
+
exports.runListCli = runListCli;
|
|
66
|
+
exports.runShowCli = runShowCli;
|
|
67
|
+
exports.runResumeCli = runResumeCli;
|
|
68
|
+
exports.runArchiveCli = runArchiveCli;
|
|
69
|
+
exports.runRerunCli = runRerunCli;
|
|
70
|
+
exports.historyCli = historyCli;
|
|
71
|
+
exports.queueAddCli = queueAddCli;
|
|
72
|
+
exports.queueListCli = queueListCli;
|
|
73
|
+
exports.queueShowCli = queueShowCli;
|
|
74
|
+
exports.queueDrainCli = queueDrainCli;
|
|
75
|
+
exports.gcPlanCli = gcPlanCli;
|
|
76
|
+
exports.gcRunCli = gcRunCli;
|
|
77
|
+
exports.gcVerifyCli = gcVerifyCli;
|
|
78
|
+
exports.orphansListCli = orphansListCli;
|
|
79
|
+
exports.orphansGcCli = orphansGcCli;
|
|
80
|
+
exports.clonesListCli = clonesListCli;
|
|
81
|
+
exports.clonesGcCli = clonesGcCli;
|
|
82
|
+
const path = __importStar(require("node:path"));
|
|
83
|
+
const run_registry_io_1 = require("./run-registry-io");
|
|
84
|
+
const pipeline_1 = require("./pipeline");
|
|
85
|
+
const workflow_app_loader_1 = require("./workflow-app-loader");
|
|
86
|
+
const scheduler_io_1 = require("./scheduler-io");
|
|
87
|
+
const reclamation_io_1 = require("./reclamation-io");
|
|
88
|
+
const pipeline_cli_1 = require("./pipeline-cli");
|
|
89
|
+
function resolveCwd(options) {
|
|
90
|
+
return path.resolve(String(options.cwd || process.cwd()));
|
|
91
|
+
}
|
|
92
|
+
function optionalString(value) {
|
|
93
|
+
return typeof value === "string" && value.trim() ? value.trim() : undefined;
|
|
94
|
+
}
|
|
95
|
+
function scopeOf(options, fallback) {
|
|
96
|
+
return options.scope === "repo" || options.scope === "home" ? options.scope : fallback;
|
|
97
|
+
}
|
|
98
|
+
// ---------------------------------------------------------------------
|
|
99
|
+
// schedule.* / cw loop
|
|
100
|
+
// ---------------------------------------------------------------------
|
|
101
|
+
function scheduleCreateCli(options = {}) {
|
|
102
|
+
return new scheduler_io_1.Scheduler(resolveCwd(options)).create(options);
|
|
103
|
+
}
|
|
104
|
+
function scheduleListCli(options = {}) {
|
|
105
|
+
return new scheduler_io_1.Scheduler(resolveCwd(options)).list(optionalString(options.status));
|
|
106
|
+
}
|
|
107
|
+
function scheduleDeleteCli(id, options = {}) {
|
|
108
|
+
return new scheduler_io_1.Scheduler(resolveCwd(options)).delete(id);
|
|
109
|
+
}
|
|
110
|
+
function scheduleDueCli(options = {}) {
|
|
111
|
+
return new scheduler_io_1.Scheduler(resolveCwd(options)).due();
|
|
112
|
+
}
|
|
113
|
+
function scheduleCompleteCli(id, options = {}) {
|
|
114
|
+
return new scheduler_io_1.Scheduler(resolveCwd(options)).complete(id, options);
|
|
115
|
+
}
|
|
116
|
+
function schedulePauseCli(id, options = {}) {
|
|
117
|
+
return new scheduler_io_1.Scheduler(resolveCwd(options)).pause(id);
|
|
118
|
+
}
|
|
119
|
+
function scheduleResumeCli(id, options = {}) {
|
|
120
|
+
return new scheduler_io_1.Scheduler(resolveCwd(options)).resume(id);
|
|
121
|
+
}
|
|
122
|
+
function scheduleRunNowCli(id, options = {}) {
|
|
123
|
+
return new scheduler_io_1.Scheduler(resolveCwd(options)).runNow(id);
|
|
124
|
+
}
|
|
125
|
+
function scheduleHistoryCli(id, options = {}) {
|
|
126
|
+
return new scheduler_io_1.Scheduler(resolveCwd(options)).history(id);
|
|
127
|
+
}
|
|
128
|
+
function scheduleDaemonTickCli(options = {}) {
|
|
129
|
+
return new scheduler_io_1.DesktopSchedulerDaemon({ cwd: resolveCwd(options), intervalSeconds: options.intervalSeconds ? Number(options.intervalSeconds) : options.interval ? Number(options.interval) : undefined }).tick();
|
|
130
|
+
}
|
|
131
|
+
function scheduleDaemonRunForever(options = {}) {
|
|
132
|
+
return new scheduler_io_1.DesktopSchedulerDaemon({
|
|
133
|
+
cwd: resolveCwd(options),
|
|
134
|
+
intervalSeconds: options.intervalSeconds ? Number(options.intervalSeconds) : options.interval ? Number(options.interval) : undefined,
|
|
135
|
+
}).run();
|
|
136
|
+
}
|
|
137
|
+
// ---------------------------------------------------------------------
|
|
138
|
+
// routine.*
|
|
139
|
+
// ---------------------------------------------------------------------
|
|
140
|
+
function routineCreateCli(options = {}) {
|
|
141
|
+
return new scheduler_io_1.RoutineTriggerBridge(resolveCwd(options)).create(options);
|
|
142
|
+
}
|
|
143
|
+
function routineListCli(options = {}) {
|
|
144
|
+
return new scheduler_io_1.RoutineTriggerBridge(resolveCwd(options)).list(optionalString(options.kind));
|
|
145
|
+
}
|
|
146
|
+
function routineDeleteCli(id, options = {}) {
|
|
147
|
+
return new scheduler_io_1.RoutineTriggerBridge(resolveCwd(options)).delete(id);
|
|
148
|
+
}
|
|
149
|
+
function routineFireCli(kind, payload, options = {}) {
|
|
150
|
+
return new scheduler_io_1.RoutineTriggerBridge(resolveCwd(options)).fire(kind, payload);
|
|
151
|
+
}
|
|
152
|
+
function routineEventsCli(id, options = {}) {
|
|
153
|
+
return new scheduler_io_1.RoutineTriggerBridge(resolveCwd(options)).events(id);
|
|
154
|
+
}
|
|
155
|
+
// ---------------------------------------------------------------------
|
|
156
|
+
// registry.* / run.* / queue.* / history
|
|
157
|
+
// ---------------------------------------------------------------------
|
|
158
|
+
function registryRefreshCli(options = {}) {
|
|
159
|
+
return new run_registry_io_1.RunRegistry(resolveCwd(options)).refresh({ scope: scopeOf(options, "repo") });
|
|
160
|
+
}
|
|
161
|
+
function registryShowCli(options = {}) {
|
|
162
|
+
return new run_registry_io_1.RunRegistry(resolveCwd(options)).show({ scope: scopeOf(options, "repo") });
|
|
163
|
+
}
|
|
164
|
+
function runSearchCli(options = {}) {
|
|
165
|
+
return new run_registry_io_1.RunRegistry(resolveCwd(options)).search({
|
|
166
|
+
scope: scopeOf(options, "home"),
|
|
167
|
+
text: optionalString(options.text),
|
|
168
|
+
app: optionalString(options.app),
|
|
169
|
+
status: optionalString(options.status),
|
|
170
|
+
repo: optionalString(options.repo),
|
|
171
|
+
since: optionalString(options.since),
|
|
172
|
+
until: optionalString(options.until),
|
|
173
|
+
includeArchived: options.includeArchived === undefined ? undefined : Boolean(options.includeArchived),
|
|
174
|
+
limit: options.limit === undefined ? undefined : Number(options.limit),
|
|
175
|
+
offset: options.offset === undefined ? undefined : Number(options.offset),
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
function runListCli(options = {}) {
|
|
179
|
+
return new run_registry_io_1.RunRegistry(resolveCwd(options)).list({
|
|
180
|
+
scope: scopeOf(options, "home"),
|
|
181
|
+
includeArchived: options.includeArchived === undefined ? undefined : Boolean(options.includeArchived),
|
|
182
|
+
limit: options.limit === undefined ? undefined : Number(options.limit),
|
|
183
|
+
offset: options.offset === undefined ? undefined : Number(options.offset),
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
function runShowCli(runId, options = {}) {
|
|
187
|
+
return new run_registry_io_1.RunRegistry(resolveCwd(options)).showRun(runId, { scope: scopeOf(options, "home") });
|
|
188
|
+
}
|
|
189
|
+
/** `run resume <run-id> [--drive|--once]` — SPEC/pipeline-run.md: default
|
|
190
|
+
* is read-only and byte-identical to the registry resume payload; with
|
|
191
|
+
* `--drive`/`--once` the SAME run (nothing re-planned) is handed to the
|
|
192
|
+
* real drive loop and the payload gains a `drive: DriveResult` field. */
|
|
193
|
+
function runResumeCli(runId, options = {}) {
|
|
194
|
+
const base = new run_registry_io_1.RunRegistry(resolveCwd(options)).resume(runId, {
|
|
195
|
+
scope: scopeOf(options, "home"),
|
|
196
|
+
limit: options.limit === undefined ? undefined : Number(options.limit),
|
|
197
|
+
});
|
|
198
|
+
if (!options.drive && !options.once)
|
|
199
|
+
return base;
|
|
200
|
+
const drive = (0, pipeline_cli_1.runDriveStep)({ ...options, runId: base.runId, repo: base.repo, once: Boolean(options.once) });
|
|
201
|
+
return { ...base, drive };
|
|
202
|
+
}
|
|
203
|
+
function runArchiveCli(runId, options = {}) {
|
|
204
|
+
const registry = new run_registry_io_1.RunRegistry(resolveCwd(options));
|
|
205
|
+
if (!runId) {
|
|
206
|
+
const olderThanDays = Number(options.olderThanDays ?? options["older-than-days"]);
|
|
207
|
+
if (!Number.isFinite(olderThanDays))
|
|
208
|
+
throw new Error("Missing run id (or --older-than-days N for the retention policy path).");
|
|
209
|
+
const states = Array.isArray(options.state) ? options.state : options.state ? [options.state] : undefined;
|
|
210
|
+
return registry.archiveByPolicy({
|
|
211
|
+
schemaVersion: 1,
|
|
212
|
+
archiveOlderThanDays: olderThanDays,
|
|
213
|
+
archiveStates: states || ["completed", "failed"],
|
|
214
|
+
defaultQueuePriority: 100,
|
|
215
|
+
}, { scope: scopeOf(options, "home") });
|
|
216
|
+
}
|
|
217
|
+
return registry.archive(runId, {
|
|
218
|
+
reason: optionalString(options.reason),
|
|
219
|
+
scope: scopeOf(options, "home"),
|
|
220
|
+
unarchive: Boolean(options.unarchive),
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
/** The CLI/MCP-path run planner: the old build injected the CoolWorkflowRunner
|
|
224
|
+
* (its `.plan(appId, inputs)`) as RunRegistry's planner so `cw run rerun` /
|
|
225
|
+
* `cw_run_rerun` could plan the new linked run. v2 dismantled that facade, so
|
|
226
|
+
* we rebuild the same `.plan(appId, inputs)` surface from the two pieces that
|
|
227
|
+
* replaced it: resolve the app object with loadWorkflowApp, then hand it to the
|
|
228
|
+
* pure pipeline plan(). Without this, RunRegistry.rerun throws
|
|
229
|
+
* "rerun requires a run planner (CoolWorkflowRunner)". */
|
|
230
|
+
function cliRunPlanner() {
|
|
231
|
+
return { plan: (appId, inputs) => (0, pipeline_1.plan)((0, workflow_app_loader_1.loadWorkflowApp)(appId), inputs) };
|
|
232
|
+
}
|
|
233
|
+
function runRerunCli(runId, options = {}) {
|
|
234
|
+
return new run_registry_io_1.RunRegistry(resolveCwd(options), cliRunPlanner()).rerun(runId, { reason: optionalString(options.reason), scope: scopeOf(options, "home") });
|
|
235
|
+
}
|
|
236
|
+
function historyCli(options = {}) {
|
|
237
|
+
return new run_registry_io_1.RunRegistry(resolveCwd(options)).history({
|
|
238
|
+
scope: scopeOf(options, "home"),
|
|
239
|
+
app: optionalString(options.app),
|
|
240
|
+
status: optionalString(options.status),
|
|
241
|
+
limit: options.limit === undefined ? undefined : Number(options.limit),
|
|
242
|
+
offset: options.offset === undefined ? undefined : Number(options.offset),
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
function queueAddCli(options = {}) {
|
|
246
|
+
return new run_registry_io_1.RunRegistry(resolveCwd(options)).queueAdd({
|
|
247
|
+
runId: optionalString(options.runId),
|
|
248
|
+
appId: optionalString(options.app || options.appId),
|
|
249
|
+
workflowId: optionalString(options.workflow || options.workflowId),
|
|
250
|
+
repo: optionalString(options.repo),
|
|
251
|
+
priority: options.priority === undefined ? undefined : Number(options.priority),
|
|
252
|
+
note: optionalString(options.note),
|
|
253
|
+
id: optionalString(options.id),
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
function queueListCli(options = {}) {
|
|
257
|
+
return new run_registry_io_1.RunRegistry(resolveCwd(options)).queueList({ status: optionalString(options.status), repo: optionalString(options.repo) });
|
|
258
|
+
}
|
|
259
|
+
function queueShowCli(id, options = {}) {
|
|
260
|
+
return new run_registry_io_1.RunRegistry(resolveCwd(options)).queueShow(id);
|
|
261
|
+
}
|
|
262
|
+
function queueDrainCli(options = {}) {
|
|
263
|
+
return new run_registry_io_1.RunRegistry(resolveCwd(options)).queueDrain({
|
|
264
|
+
limit: options.limit === undefined ? undefined : Number(options.limit),
|
|
265
|
+
repo: optionalString(options.repo),
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
// ---------------------------------------------------------------------
|
|
269
|
+
// gc.* / orphans.* / clones.*
|
|
270
|
+
// ---------------------------------------------------------------------
|
|
271
|
+
function gcPolicyOverridesFrom(options) {
|
|
272
|
+
const overrides = {};
|
|
273
|
+
if (options.reclaimAfterArchiveDays !== undefined)
|
|
274
|
+
overrides.reclaimAfterArchiveDays = Number(options.reclaimAfterArchiveDays);
|
|
275
|
+
if (options.keepScratch !== undefined)
|
|
276
|
+
overrides.keepScratch = Boolean(options.keepScratch);
|
|
277
|
+
if (options["keep-scratch"] !== undefined)
|
|
278
|
+
overrides.keepScratch = Boolean(options["keep-scratch"]);
|
|
279
|
+
if (options.keepSnapshots !== undefined)
|
|
280
|
+
overrides.keepSnapshots = Boolean(options.keepSnapshots);
|
|
281
|
+
if (options["keep-snapshots"] !== undefined)
|
|
282
|
+
overrides.keepSnapshots = Boolean(options["keep-snapshots"]);
|
|
283
|
+
if (options.state !== undefined)
|
|
284
|
+
overrides.reclaimStates = Array.isArray(options.state) ? options.state : [options.state];
|
|
285
|
+
return overrides;
|
|
286
|
+
}
|
|
287
|
+
function gcPlanCli(runId, options = {}) {
|
|
288
|
+
const registry = new run_registry_io_1.RunRegistry(resolveCwd(options));
|
|
289
|
+
return (0, reclamation_io_1.gcPlan)(registry, {
|
|
290
|
+
scope: scopeOf(options, "home"),
|
|
291
|
+
runId,
|
|
292
|
+
policy: gcPolicyOverridesFrom(options),
|
|
293
|
+
now: optionalString(options.now),
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
function gcRunCli(runId, options = {}) {
|
|
297
|
+
const registry = new run_registry_io_1.RunRegistry(resolveCwd(options));
|
|
298
|
+
return (0, reclamation_io_1.gcRun)(registry, {
|
|
299
|
+
scope: scopeOf(options, "home"),
|
|
300
|
+
runId,
|
|
301
|
+
policy: gcPolicyOverridesFrom(options),
|
|
302
|
+
now: optionalString(options.now),
|
|
303
|
+
actor: optionalString(options.actor),
|
|
304
|
+
limit: options.limit === undefined ? undefined : Number(options.limit),
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
function gcVerifyCli(runId, options = {}) {
|
|
308
|
+
const registry = new run_registry_io_1.RunRegistry(resolveCwd(options));
|
|
309
|
+
return (0, reclamation_io_1.gcVerify)(registry, runId, { scope: scopeOf(options, "home") });
|
|
310
|
+
}
|
|
311
|
+
function orphansListCli(options = {}) {
|
|
312
|
+
const registry = new run_registry_io_1.RunRegistry(resolveCwd(options));
|
|
313
|
+
return (0, reclamation_io_1.listOrphanRuns)(registry, { scope: scopeOf(options, "home"), now: optionalString(options.now) });
|
|
314
|
+
}
|
|
315
|
+
function orphansGcCli(options = {}) {
|
|
316
|
+
const registry = new run_registry_io_1.RunRegistry(resolveCwd(options));
|
|
317
|
+
return (0, reclamation_io_1.gcOrphanRuns)(registry, {
|
|
318
|
+
scope: scopeOf(options, "home"),
|
|
319
|
+
minAgeMinutes: options.minAgeMinutes !== undefined ? Number(options.minAgeMinutes) : options["min-age-minutes"] !== undefined ? Number(options["min-age-minutes"]) : undefined,
|
|
320
|
+
all: Boolean(options.all),
|
|
321
|
+
now: optionalString(options.now),
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
function clonesListCli() {
|
|
325
|
+
return (0, reclamation_io_1.listClones)(process.env);
|
|
326
|
+
}
|
|
327
|
+
function clonesGcCli(options = {}) {
|
|
328
|
+
return (0, reclamation_io_1.gcClones)({ olderThanDays: options.olderThanDays ?? options["older-than-days"], all: options.all, now: options.now }, process.env);
|
|
329
|
+
}
|
|
@@ -27,7 +27,7 @@ const node_crypto_1 = require("node:crypto");
|
|
|
27
27
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
28
28
|
const node_path_1 = __importDefault(require("node:path"));
|
|
29
29
|
const node_url_1 = require("node:url");
|
|
30
|
-
const
|
|
30
|
+
const agent_config_1 = require("./agent-config");
|
|
31
31
|
/** Upper bound on a downloaded archive (200 MiB) — a review target should be source, not a
|
|
32
32
|
* binary blob; a giant download fails closed rather than exhausting disk/memory. */
|
|
33
33
|
const MAX_ARCHIVE_BYTES = 200 * 1024 * 1024;
|
|
@@ -126,7 +126,7 @@ function safePathname(value) {
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
function cacheRoot(opts) {
|
|
129
|
-
return node_path_1.default.join(opts.home || (0,
|
|
129
|
+
return node_path_1.default.join(opts.home || (0, agent_config_1.resolveCwHome)(opts.env), "clones");
|
|
130
130
|
}
|
|
131
131
|
function cacheDirFor(root, sanitizedUrl, ref) {
|
|
132
132
|
const key = (0, node_crypto_1.createHash)("sha256").update(`${sanitizedUrl}\0${ref || ""}`).digest("hex").slice(0, 24);
|
|
@@ -287,9 +287,13 @@ function fetchArchiveBytes(rawUrl, sanitizedUrl, dest, opts) {
|
|
|
287
287
|
"if(!r.ok){process.stderr.write('HTTP '+r.status+' '+r.statusText);process.exit(2);}",
|
|
288
288
|
"const len=Number(r.headers.get('content-length')||0);",
|
|
289
289
|
"if(cap&&len>cap){process.stderr.write('archive too large');process.exit(3);}",
|
|
290
|
-
"
|
|
291
|
-
"
|
|
292
|
-
"
|
|
290
|
+
"if(!r.body||!r.body.getReader){process.stderr.write('response body is not streamable');process.exit(4);}",
|
|
291
|
+
"const fd=fs.openSync(out,'w');let total=0;",
|
|
292
|
+
"try{const reader=r.body.getReader();for(;;){const x=await reader.read();if(x.done)break;",
|
|
293
|
+
"const chunk=Buffer.from(x.value);total+=chunk.length;",
|
|
294
|
+
"if(cap&&total>cap){try{await reader.cancel();}catch{};fs.closeSync(fd);fs.rmSync(out,{force:true});process.stderr.write('archive too large');process.exit(3);}",
|
|
295
|
+
"fs.writeSync(fd,chunk,0,chunk.length);}fs.closeSync(fd);return;}",
|
|
296
|
+
"catch(e){try{fs.closeSync(fd);}catch{};fs.rmSync(out,{force:true});throw e;}}",
|
|
293
297
|
"process.stderr.write('too many redirects');process.exit(6);",
|
|
294
298
|
"})().catch(e=>{process.stderr.write(String((e&&e.message)||e));process.exit(4);});"
|
|
295
299
|
].join("");
|
|
@@ -315,6 +319,9 @@ function listArchive(file, isZip) {
|
|
|
315
319
|
if (isZip && result.error?.code === "ENOENT") {
|
|
316
320
|
throw new Error("unzip is required to review a .zip link but was not found on PATH (use a .tar.gz or a git URL)");
|
|
317
321
|
}
|
|
322
|
+
if (!isZip && result.error?.code === "ENOENT") {
|
|
323
|
+
throw new Error("tar is required to review a .tar/.tgz link but was not found on PATH");
|
|
324
|
+
}
|
|
318
325
|
throw new Error(`could not read archive: ${String(result.stderr || "").trim() || `exit ${result.status}`}`);
|
|
319
326
|
}
|
|
320
327
|
return String(result.stdout || "").split(/\r?\n/).filter(Boolean);
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// shell/report-cli.ts — CLI/MCP-reachable bodies for `cw report bundle`
|
|
3
|
+
// and `cw report verify-bundle`.
|
|
4
|
+
//
|
|
5
|
+
// MILESTONE 8. Byte-exact port of the old build's capability-core.ts's
|
|
6
|
+
// `reportBundle`/`runVerifyReportBundle` argv shapes.
|
|
7
|
+
//
|
|
8
|
+
// Evidence: SPEC/ledger-trust.md "CLI: `cw report verify-bundle` and `cw
|
|
9
|
+
// report bundle`"; plugins/cool-workflow/src/capability-core.ts:396-433.
|
|
10
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
13
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
14
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
15
|
+
}
|
|
16
|
+
Object.defineProperty(o, k2, desc);
|
|
17
|
+
}) : (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
o[k2] = m[k];
|
|
20
|
+
}));
|
|
21
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
22
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
23
|
+
}) : function(o, v) {
|
|
24
|
+
o["default"] = v;
|
|
25
|
+
});
|
|
26
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
27
|
+
var ownKeys = function(o) {
|
|
28
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
29
|
+
var ar = [];
|
|
30
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
31
|
+
return ar;
|
|
32
|
+
};
|
|
33
|
+
return ownKeys(o);
|
|
34
|
+
};
|
|
35
|
+
return function (mod) {
|
|
36
|
+
if (mod && mod.__esModule) return mod;
|
|
37
|
+
var result = {};
|
|
38
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
39
|
+
__setModuleDefault(result, mod);
|
|
40
|
+
return result;
|
|
41
|
+
};
|
|
42
|
+
})();
|
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
exports.reportBundleCli = reportBundleCli;
|
|
45
|
+
exports.reportVerifyBundleCli = reportVerifyBundleCli;
|
|
46
|
+
const path = __importStar(require("node:path"));
|
|
47
|
+
const run_export_1 = require("./run-export");
|
|
48
|
+
const run_store_1 = require("./run-store");
|
|
49
|
+
function optionalString(value) {
|
|
50
|
+
return typeof value === "string" && value.trim() ? value.trim() : undefined;
|
|
51
|
+
}
|
|
52
|
+
function invocationCwd(args) {
|
|
53
|
+
return typeof args.cwd === "string" && args.cwd.trim() ? path.resolve(args.cwd) : process.cwd();
|
|
54
|
+
}
|
|
55
|
+
const SYSTEM_DIRS = /^\/(etc|bin|sbin|usr|Library|System|Applications|boot|dev|proc|sys|root|var\/log|var\/run)\//;
|
|
56
|
+
function reportBundleCli(runId, args) {
|
|
57
|
+
if (!runId)
|
|
58
|
+
throw new Error("report bundle requires a run id (cw report bundle <run-id>)");
|
|
59
|
+
const base = invocationCwd(args);
|
|
60
|
+
const run = (0, run_store_1.loadRunFromCwd)(runId, base);
|
|
61
|
+
const output = optionalString(args.output || args.path || args.archive) || `${runId}.cwrun.json`;
|
|
62
|
+
const outputPath = path.resolve(base, output);
|
|
63
|
+
if (SYSTEM_DIRS.test(outputPath)) {
|
|
64
|
+
throw new Error(`Refusing to write archive to a system directory: ${output}`);
|
|
65
|
+
}
|
|
66
|
+
// Optionally seal in the operator's PUBLIC trust key so the bundle
|
|
67
|
+
// re-verifies offline. Default falls back to the same env the verify
|
|
68
|
+
// gate reads, so a single configured key both attests at record-time
|
|
69
|
+
// and travels with the export.
|
|
70
|
+
const trustKeyArg = optionalString(args["with-trust-key"] || args.withTrustKey || args.trustKey || args.pubkey) || process.env.CW_AGENT_ATTEST_PUBKEY;
|
|
71
|
+
const exported = (0, run_export_1.exportRun)(run, outputPath, { trustPublicKey: trustKeyArg });
|
|
72
|
+
const extractReportTo = optionalString(args["extract-report"] || args.extractReport || args.extractReportTo);
|
|
73
|
+
const verification = (0, run_export_1.verifyReportBundle)(exported.path, {
|
|
74
|
+
pubkey: optionalString(args.pubkey || args.pubKey || args.publicKey),
|
|
75
|
+
extractReportTo: extractReportTo ? path.resolve(base, extractReportTo) : undefined,
|
|
76
|
+
strictSignatures: Boolean(args["strict-signatures"] || args.strictSignatures || args.strictSigs),
|
|
77
|
+
requireSignatures: Boolean(args["require-signatures"] || args.requireSignatures || args.requireSigs),
|
|
78
|
+
});
|
|
79
|
+
return {
|
|
80
|
+
schemaVersion: 1,
|
|
81
|
+
runId,
|
|
82
|
+
archivePath: exported.path,
|
|
83
|
+
trustKeyEmbedded: exported.trustKeyEmbedded,
|
|
84
|
+
reportExtractedTo: verification.reportExtractedTo,
|
|
85
|
+
verification,
|
|
86
|
+
ok: verification.ok,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function reportVerifyBundleCli(args) {
|
|
90
|
+
const base = invocationCwd(args);
|
|
91
|
+
const archive = optionalString(args.archive || args.path || args.file || args.bundle);
|
|
92
|
+
if (!archive)
|
|
93
|
+
throw new Error("report verify-bundle requires a bundle path (positional, --archive, --path, --file, or --bundle)");
|
|
94
|
+
const extractReportTo = optionalString(args["extract-report"] || args.extractReport || args.extractReportTo);
|
|
95
|
+
return (0, run_export_1.verifyReportBundle)(path.resolve(base, archive), {
|
|
96
|
+
pubkey: optionalString(args.pubkey || args.pubKey || args.publicKey),
|
|
97
|
+
extractReportTo: extractReportTo ? path.resolve(base, extractReportTo) : undefined,
|
|
98
|
+
strictSignatures: Boolean(args["strict-signatures"] || args.strictSignatures || args.strictSigs),
|
|
99
|
+
requireSignatures: Boolean(args["require-signatures"] || args.requireSignatures || args.requireSigs),
|
|
100
|
+
});
|
|
101
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// shell/report-view-cli.ts — CLI/MCP-facing entry points for `cw report
|
|
3
|
+
// <run-id>`, `cw status`, `cw graph`, `cw operator status|report|graph`.
|
|
4
|
+
//
|
|
5
|
+
// MILESTONE 11 (reporting/observability). Wires shell/operator-ux.ts +
|
|
6
|
+
// shell/report.ts + shell/operator-ux-text.ts into the shapes
|
|
7
|
+
// core/capability-table.ts's CLI/MCP bindings call, matching shell/
|
|
8
|
+
// pipeline-cli.ts's pattern.
|
|
9
|
+
//
|
|
10
|
+
// Evidence: SPEC/reporting-ux.md "CLI commands" (`cw report`, `cw
|
|
11
|
+
// status`, `cw operator status|report`, `cw graph`).
|
|
12
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
15
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
16
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
17
|
+
}
|
|
18
|
+
Object.defineProperty(o, k2, desc);
|
|
19
|
+
}) : (function(o, m, k, k2) {
|
|
20
|
+
if (k2 === undefined) k2 = k;
|
|
21
|
+
o[k2] = m[k];
|
|
22
|
+
}));
|
|
23
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
24
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
25
|
+
}) : function(o, v) {
|
|
26
|
+
o["default"] = v;
|
|
27
|
+
});
|
|
28
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
29
|
+
var ownKeys = function(o) {
|
|
30
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
31
|
+
var ar = [];
|
|
32
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
33
|
+
return ar;
|
|
34
|
+
};
|
|
35
|
+
return ownKeys(o);
|
|
36
|
+
};
|
|
37
|
+
return function (mod) {
|
|
38
|
+
if (mod && mod.__esModule) return mod;
|
|
39
|
+
var result = {};
|
|
40
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
41
|
+
__setModuleDefault(result, mod);
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
44
|
+
})();
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.reportWriteCli = reportWriteCli;
|
|
47
|
+
exports.statusCli = statusCli;
|
|
48
|
+
exports.statusSummaryText = statusSummaryText;
|
|
49
|
+
exports.statusFullText = statusFullText;
|
|
50
|
+
exports.operatorStatusCli = operatorStatusCli;
|
|
51
|
+
exports.operatorReportCli = operatorReportCli;
|
|
52
|
+
exports.operatorReportText = operatorReportText;
|
|
53
|
+
exports.graphCli = graphCli;
|
|
54
|
+
exports.graphText = graphText;
|
|
55
|
+
exports.optionalString = optionalString;
|
|
56
|
+
const path = __importStar(require("node:path"));
|
|
57
|
+
const run_store_1 = require("./run-store");
|
|
58
|
+
const report_1 = require("./report");
|
|
59
|
+
const operator_ux_1 = require("./operator-ux");
|
|
60
|
+
const operator_ux_text_1 = require("./operator-ux-text");
|
|
61
|
+
function invocationCwd(args) {
|
|
62
|
+
return typeof args.cwd === "string" && args.cwd.trim() ? path.resolve(args.cwd) : process.cwd();
|
|
63
|
+
}
|
|
64
|
+
function optionalString(value) {
|
|
65
|
+
return typeof value === "string" && value.trim() ? value.trim() : undefined;
|
|
66
|
+
}
|
|
67
|
+
/** `cw report <run-id>` — writes report.md fresh and returns just its
|
|
68
|
+
* path (the CLI binding prints ONLY this path + "\n" to stdout; `--json`
|
|
69
|
+
* prints `{path}`). */
|
|
70
|
+
function reportWriteCli(runId, args) {
|
|
71
|
+
const run = (0, run_store_1.loadRunFromCwd)(runId, invocationCwd(args));
|
|
72
|
+
return { path: (0, report_1.writeReport)(run) };
|
|
73
|
+
}
|
|
74
|
+
/** `cw status [<run-id>]` / `cw_status` — no id: the fixed advice shape;
|
|
75
|
+
* with an id: `summarizeRun`'s payload. */
|
|
76
|
+
function statusCli(runId, args) {
|
|
77
|
+
if (!runId)
|
|
78
|
+
return { runId: null, nextActions: (0, operator_ux_1.adviseNoRun)() };
|
|
79
|
+
const run = (0, run_store_1.loadRunFromCwd)(runId, invocationCwd(args));
|
|
80
|
+
return (0, operator_ux_1.summarizeRun)(run);
|
|
81
|
+
}
|
|
82
|
+
/** `cw status <id> --summary`/`--brief` human text. */
|
|
83
|
+
function statusSummaryText(runId, args) {
|
|
84
|
+
const run = (0, run_store_1.loadRunFromCwd)(runId, invocationCwd(args));
|
|
85
|
+
return (0, operator_ux_text_1.formatOperatorSummary)((0, operator_ux_1.summarizeOperatorRun)(run));
|
|
86
|
+
}
|
|
87
|
+
/** The full `cw status <id>` human text. */
|
|
88
|
+
function statusFullText(runId, args) {
|
|
89
|
+
const run = (0, run_store_1.loadRunFromCwd)(runId, invocationCwd(args));
|
|
90
|
+
return (0, operator_ux_text_1.formatOperatorStatus)((0, operator_ux_1.summarizeOperatorRun)(run));
|
|
91
|
+
}
|
|
92
|
+
/** `cw operator status <id> [--json]`. */
|
|
93
|
+
function operatorStatusCli(runId, args) {
|
|
94
|
+
const run = (0, run_store_1.loadRunFromCwd)(runId, invocationCwd(args));
|
|
95
|
+
return (0, operator_ux_1.summarizeOperatorRun)(run);
|
|
96
|
+
}
|
|
97
|
+
/** `cw operator report <id> [--json]` — also re-writes report.md as a
|
|
98
|
+
* side effect (byte-exact to the old build's operator report verb). */
|
|
99
|
+
function operatorReportCli(runId, args) {
|
|
100
|
+
const run = (0, run_store_1.loadRunFromCwd)(runId, invocationCwd(args));
|
|
101
|
+
(0, report_1.writeReport)(run);
|
|
102
|
+
return (0, operator_ux_1.summarizeOperatorRun)(run);
|
|
103
|
+
}
|
|
104
|
+
function operatorReportText(runId, args) {
|
|
105
|
+
const run = (0, run_store_1.loadRunFromCwd)(runId, invocationCwd(args));
|
|
106
|
+
(0, report_1.writeReport)(run);
|
|
107
|
+
return (0, operator_ux_text_1.formatOperatorReport)((0, operator_ux_1.summarizeOperatorRun)(run), []);
|
|
108
|
+
}
|
|
109
|
+
/** `cw graph <id> [--json]` / `cw operator graph`. */
|
|
110
|
+
function graphCli(runId, args) {
|
|
111
|
+
const run = (0, run_store_1.loadRunFromCwd)(runId, invocationCwd(args));
|
|
112
|
+
return (0, operator_ux_1.buildOperatorGraph)(run);
|
|
113
|
+
}
|
|
114
|
+
function graphText(runId, args) {
|
|
115
|
+
const run = (0, run_store_1.loadRunFromCwd)(runId, invocationCwd(args));
|
|
116
|
+
return (0, operator_ux_text_1.formatOperatorGraph)((0, operator_ux_1.buildOperatorGraph)(run));
|
|
117
|
+
}
|