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,874 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.CoolWorkflowRunner = void 0;
|
|
40
|
+
exports.parseArgv = parseArgv;
|
|
41
|
+
exports.formatHelp = formatHelp;
|
|
42
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
43
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
44
|
+
const workflow_api_1 = require("./workflow-api");
|
|
45
|
+
const workflow_app_framework_1 = require("./workflow-app-framework");
|
|
46
|
+
const dispatch_1 = require("./dispatch");
|
|
47
|
+
const state_1 = require("./state");
|
|
48
|
+
const observability_1 = require("./observability");
|
|
49
|
+
const pipeline_runner_1 = require("./pipeline-runner");
|
|
50
|
+
const worker_isolation_1 = require("./worker-isolation");
|
|
51
|
+
const candidate_scoring_1 = require("./candidate-scoring");
|
|
52
|
+
const sandbox_profile_1 = require("./sandbox-profile");
|
|
53
|
+
const execution_backend_1 = require("./execution-backend");
|
|
54
|
+
const operator_ux_1 = require("./operator-ux");
|
|
55
|
+
const multi_agent_1 = require("./multi-agent");
|
|
56
|
+
const multi_agent_operator_ux_1 = require("./multi-agent-operator-ux");
|
|
57
|
+
const multi_agent_eval_1 = require("./multi-agent-eval");
|
|
58
|
+
const node_snapshot_1 = require("./node-snapshot");
|
|
59
|
+
const state_explosion_1 = require("./state-explosion");
|
|
60
|
+
const evidence_reasoning_1 = require("./evidence-reasoning");
|
|
61
|
+
const report_1 = require("./orchestrator/report");
|
|
62
|
+
const cli_options_1 = require("./orchestrator/cli-options");
|
|
63
|
+
const auditOps = __importStar(require("./orchestrator/audit-operations"));
|
|
64
|
+
const candidateOps = __importStar(require("./orchestrator/candidate-operations"));
|
|
65
|
+
const collaborationOps = __importStar(require("./orchestrator/collaboration-operations"));
|
|
66
|
+
const maOps = __importStar(require("./orchestrator/multi-agent-operations"));
|
|
67
|
+
const hostOps = __importStar(require("./orchestrator/host-operations"));
|
|
68
|
+
const feedbackOps = __importStar(require("./orchestrator/feedback-operations"));
|
|
69
|
+
const topologyOps = __importStar(require("./orchestrator/topology-operations"));
|
|
70
|
+
const lifecycleOps = __importStar(require("./orchestrator/lifecycle-operations"));
|
|
71
|
+
const migrationOps = __importStar(require("./orchestrator/migration-operations"));
|
|
72
|
+
class CoolWorkflowRunner {
|
|
73
|
+
pluginRoot;
|
|
74
|
+
workflowsDir;
|
|
75
|
+
appsDir;
|
|
76
|
+
constructor({ pluginRoot }) {
|
|
77
|
+
this.pluginRoot = resolvePluginRoot(pluginRoot);
|
|
78
|
+
this.workflowsDir = node_path_1.default.join(this.pluginRoot, "workflows");
|
|
79
|
+
this.appsDir = node_path_1.default.join(this.pluginRoot, "apps");
|
|
80
|
+
}
|
|
81
|
+
listWorkflows() {
|
|
82
|
+
return this.loadWorkflowApps().map((record) => {
|
|
83
|
+
const summary = (0, workflow_app_framework_1.summarizeWorkflowApp)(record);
|
|
84
|
+
return {
|
|
85
|
+
id: summary.id,
|
|
86
|
+
title: summary.title,
|
|
87
|
+
summary: summary.summary,
|
|
88
|
+
file: summary.file
|
|
89
|
+
};
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
listApps() {
|
|
93
|
+
return this.loadWorkflowApps().map((record) => (0, workflow_app_framework_1.summarizeWorkflowApp)(record));
|
|
94
|
+
}
|
|
95
|
+
showApp(appId) {
|
|
96
|
+
const record = this.loadWorkflowAppById(appId);
|
|
97
|
+
const summary = (0, workflow_app_framework_1.summarizeWorkflowApp)(record);
|
|
98
|
+
return {
|
|
99
|
+
...summary,
|
|
100
|
+
source: record.source,
|
|
101
|
+
app: {
|
|
102
|
+
schemaVersion: record.app.schemaVersion,
|
|
103
|
+
id: record.app.id,
|
|
104
|
+
title: record.app.title,
|
|
105
|
+
summary: record.app.summary || "",
|
|
106
|
+
version: record.app.version,
|
|
107
|
+
author: record.app.author,
|
|
108
|
+
inputs: record.app.inputs || record.app.workflow.inputs,
|
|
109
|
+
sandboxProfiles: record.app.sandboxProfiles || record.app.workflow.sandboxProfiles || [],
|
|
110
|
+
compatibility: record.app.compatibility,
|
|
111
|
+
metadata: record.app.metadata || {}
|
|
112
|
+
},
|
|
113
|
+
workflow: {
|
|
114
|
+
id: record.app.workflow.id,
|
|
115
|
+
title: record.app.workflow.title,
|
|
116
|
+
summary: record.app.workflow.summary || "",
|
|
117
|
+
limits: record.app.workflow.limits,
|
|
118
|
+
inputs: record.app.workflow.inputs,
|
|
119
|
+
sandboxProfiles: record.app.workflow.sandboxProfiles || [],
|
|
120
|
+
phases: record.app.workflow.phases.map((phase) => ({
|
|
121
|
+
id: phase.id,
|
|
122
|
+
name: phase.name,
|
|
123
|
+
status: phase.status,
|
|
124
|
+
tasks: phase.tasks.map((task) => ({
|
|
125
|
+
id: task.id,
|
|
126
|
+
kind: task.kind,
|
|
127
|
+
requiresEvidence: Boolean(task.requiresEvidence),
|
|
128
|
+
sandboxProfileId: task.sandboxProfileId
|
|
129
|
+
}))
|
|
130
|
+
}))
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
validateApp(target) {
|
|
135
|
+
try {
|
|
136
|
+
const record = this.loadWorkflowAppTarget(target);
|
|
137
|
+
const result = (0, workflow_app_framework_1.validateWorkflowApp)(record.app, {
|
|
138
|
+
appPath: record.source.manifestPath || record.source.entrypointPath || record.source.path
|
|
139
|
+
});
|
|
140
|
+
return {
|
|
141
|
+
...result,
|
|
142
|
+
summary: (0, workflow_app_framework_1.summarizeWorkflowApp)(record)
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
const issues = (0, cli_options_1.validationIssuesFromError)(error);
|
|
147
|
+
return {
|
|
148
|
+
valid: false,
|
|
149
|
+
appId: target,
|
|
150
|
+
appPath: node_path_1.default.resolve(target),
|
|
151
|
+
issues
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
initApp(appId, options) {
|
|
156
|
+
const id = (0, workflow_api_1.slugify)(appId);
|
|
157
|
+
if (!id)
|
|
158
|
+
throw new Error("App id must include at least one letter or digit");
|
|
159
|
+
const title = String(options.title || titleize(id));
|
|
160
|
+
const destinationDir = node_path_1.default.resolve(String(options.directory || options.output || node_path_1.default.join(this.appsDir, id)));
|
|
161
|
+
const manifestPath = node_path_1.default.join(destinationDir, "app.json");
|
|
162
|
+
const entrypointPath = node_path_1.default.join(destinationDir, "workflow.js");
|
|
163
|
+
if (!options.force && (node_fs_1.default.existsSync(manifestPath) || node_fs_1.default.existsSync(entrypointPath))) {
|
|
164
|
+
throw new Error(`Refusing to overwrite existing workflow app: ${destinationDir}`);
|
|
165
|
+
}
|
|
166
|
+
node_fs_1.default.mkdirSync(destinationDir, { recursive: true });
|
|
167
|
+
node_fs_1.default.writeFileSync(manifestPath, (0, workflow_app_framework_1.renderWorkflowAppManifestTemplate)(id, title), "utf8");
|
|
168
|
+
node_fs_1.default.writeFileSync(entrypointPath, (0, workflow_app_framework_1.renderWorkflowAppEntrypointTemplate)(id, title), "utf8");
|
|
169
|
+
const validation = this.validateApp(manifestPath);
|
|
170
|
+
if (!validation.valid) {
|
|
171
|
+
throw new workflow_app_framework_1.WorkflowAppValidationError("Generated workflow app is invalid", validation.issues);
|
|
172
|
+
}
|
|
173
|
+
return { id, manifestPath, entrypointPath };
|
|
174
|
+
}
|
|
175
|
+
packageApp(appId, options = {}) {
|
|
176
|
+
const record = this.loadWorkflowAppById(appId);
|
|
177
|
+
const destination = node_path_1.default.resolve(String(options.output ||
|
|
178
|
+
node_path_1.default.join(process.cwd(), ".cw", "packages", `${record.app.id}-${record.app.version}.cwapp.json`)));
|
|
179
|
+
node_fs_1.default.mkdirSync(node_path_1.default.dirname(destination), { recursive: true });
|
|
180
|
+
(0, state_1.writeJson)(destination, {
|
|
181
|
+
schemaVersion: 1,
|
|
182
|
+
app: (0, workflow_app_framework_1.workflowAppRunMetadata)(record),
|
|
183
|
+
workflow: record.app.workflow,
|
|
184
|
+
packagedAt: new Date().toISOString()
|
|
185
|
+
});
|
|
186
|
+
return { id: record.app.id, version: record.app.version, path: destination };
|
|
187
|
+
}
|
|
188
|
+
init(workflowId, options) {
|
|
189
|
+
const id = (0, workflow_api_1.slugify)(workflowId);
|
|
190
|
+
if (!id)
|
|
191
|
+
throw new Error("Workflow id must include at least one letter or digit");
|
|
192
|
+
const title = String(options.title || titleize(id));
|
|
193
|
+
const destination = node_path_1.default.resolve(String(options.output || node_path_1.default.join(this.workflowsDir, `${id}.workflow.js`)));
|
|
194
|
+
if (node_fs_1.default.existsSync(destination) && !options.force) {
|
|
195
|
+
throw new Error(`Refusing to overwrite existing workflow: ${destination}`);
|
|
196
|
+
}
|
|
197
|
+
node_fs_1.default.mkdirSync(node_path_1.default.dirname(destination), { recursive: true });
|
|
198
|
+
node_fs_1.default.writeFileSync(destination, (0, workflow_app_framework_1.renderWorkflowAppTemplate)(id, title), "utf8");
|
|
199
|
+
return { id, path: destination };
|
|
200
|
+
}
|
|
201
|
+
// Core run lifecycle — delegated to ./orchestrator/lifecycle-operations. The
|
|
202
|
+
// runner resolves the workflow app record (instance-stateful) then hands the
|
|
203
|
+
// engine work to the module; the runner is now a pure router.
|
|
204
|
+
plan(workflowId, options) {
|
|
205
|
+
return lifecycleOps.plan(this.loadWorkflowAppById(workflowId), options);
|
|
206
|
+
}
|
|
207
|
+
status(runId) {
|
|
208
|
+
return (0, report_1.summarizeRun)(this.loadRun(runId));
|
|
209
|
+
}
|
|
210
|
+
operatorStatus(runId) {
|
|
211
|
+
return (0, operator_ux_1.summarizeOperatorRun)(this.loadRun(runId));
|
|
212
|
+
}
|
|
213
|
+
next(runId, options) {
|
|
214
|
+
return (0, dispatch_1.nextDispatchTasks)(this.loadRun(runId), (0, cli_options_1.numberOption)(options.limit));
|
|
215
|
+
}
|
|
216
|
+
dispatch(runId, options) {
|
|
217
|
+
return lifecycleOps.dispatch(this.loadRun(runId), options);
|
|
218
|
+
}
|
|
219
|
+
recordResult(runId, taskId, resultPath, options = {}) {
|
|
220
|
+
return lifecycleOps.recordResult(this.loadRun(runId), taskId, resultPath, options);
|
|
221
|
+
}
|
|
222
|
+
listWorkers(runId, options = {}) {
|
|
223
|
+
return (0, worker_isolation_1.listWorkerScopes)(this.loadRun(runId), {
|
|
224
|
+
status: options.status ? String(options.status) : undefined
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
showWorker(runId, workerId) {
|
|
228
|
+
const worker = (0, worker_isolation_1.getWorkerScope)(this.loadRun(runId), workerId);
|
|
229
|
+
if (!worker)
|
|
230
|
+
throw new Error(`Unknown worker id for run ${runId}: ${workerId}`);
|
|
231
|
+
return worker;
|
|
232
|
+
}
|
|
233
|
+
reclaimOrphans(runId, now) {
|
|
234
|
+
return (0, worker_isolation_1.reclaimOrphans)(this.loadRun(runId), now);
|
|
235
|
+
}
|
|
236
|
+
showWorkerManifest(runId, workerId) {
|
|
237
|
+
const run = this.loadRun(runId);
|
|
238
|
+
const worker = (0, worker_isolation_1.getWorkerScope)(run, workerId);
|
|
239
|
+
if (!worker)
|
|
240
|
+
throw new Error(`Unknown worker id for run ${runId}: ${workerId}`);
|
|
241
|
+
return (0, worker_isolation_1.writeWorkerManifest)(run, worker);
|
|
242
|
+
}
|
|
243
|
+
recordWorkerOutput(runId, workerId, resultPath, options = {}) {
|
|
244
|
+
return lifecycleOps.recordWorkerOutput(this.loadRun(runId), workerId, resultPath, options);
|
|
245
|
+
}
|
|
246
|
+
recordWorkerFailure(runId, workerId, message, options = {}) {
|
|
247
|
+
return lifecycleOps.recordWorkerFailure(this.loadRun(runId), workerId, message, options);
|
|
248
|
+
}
|
|
249
|
+
validateWorker(runId, workerId, targetPath) {
|
|
250
|
+
return (0, worker_isolation_1.validateWorkerBoundary)(this.loadRun(runId), workerId, targetPath ? { path: targetPath } : {});
|
|
251
|
+
}
|
|
252
|
+
// Audit domain — delegated to ./orchestrator/audit-operations (v0.1.40 P3
|
|
253
|
+
// router pattern). The runner stays the routing surface; the logic lives in the
|
|
254
|
+
// domain module. Public signatures are unchanged.
|
|
255
|
+
auditSummary(runId) {
|
|
256
|
+
return auditOps.auditSummary(this.loadRun(runId));
|
|
257
|
+
}
|
|
258
|
+
auditMultiAgent(runId) {
|
|
259
|
+
return auditOps.auditMultiAgent(this.loadRun(runId));
|
|
260
|
+
}
|
|
261
|
+
auditPolicy(runId) {
|
|
262
|
+
return auditOps.auditPolicy(this.loadRun(runId));
|
|
263
|
+
}
|
|
264
|
+
auditRole(runId, roleId) {
|
|
265
|
+
return auditOps.auditRole(this.loadRun(runId), roleId);
|
|
266
|
+
}
|
|
267
|
+
auditBlackboard(runId) {
|
|
268
|
+
return auditOps.auditBlackboard(this.loadRun(runId));
|
|
269
|
+
}
|
|
270
|
+
auditJudge(runId) {
|
|
271
|
+
return auditOps.auditJudge(this.loadRun(runId));
|
|
272
|
+
}
|
|
273
|
+
workerAudit(runId, workerId) {
|
|
274
|
+
return auditOps.workerAudit(this.loadRun(runId), workerId);
|
|
275
|
+
}
|
|
276
|
+
evidenceProvenance(runId, options = {}) {
|
|
277
|
+
return auditOps.auditEvidenceProvenance(this.loadRun(runId), options);
|
|
278
|
+
}
|
|
279
|
+
recordAuditAttestation(runId, options = {}) {
|
|
280
|
+
return auditOps.recordAuditAttestation(this.loadRun(runId), options);
|
|
281
|
+
}
|
|
282
|
+
recordAuditDecision(runId, workerId, options = {}) {
|
|
283
|
+
return auditOps.recordAuditDecision(this.loadRun(runId), workerId, options);
|
|
284
|
+
}
|
|
285
|
+
listSandboxProfiles(options = {}) {
|
|
286
|
+
return (0, sandbox_profile_1.listBundledSandboxProfiles)((0, sandbox_profile_1.sandboxContextForValidation)(String(options.cwd || process.cwd())));
|
|
287
|
+
}
|
|
288
|
+
showSandboxProfile(profileId, options = {}) {
|
|
289
|
+
return (0, sandbox_profile_1.showBundledSandboxProfile)(profileId, (0, sandbox_profile_1.sandboxContextForValidation)(String(options.cwd || process.cwd())));
|
|
290
|
+
}
|
|
291
|
+
validateSandboxProfile(profileFile, options = {}) {
|
|
292
|
+
return (0, sandbox_profile_1.validateSandboxProfileFile)(profileFile, (0, sandbox_profile_1.sandboxContextForValidation)(String(options.cwd || process.cwd())));
|
|
293
|
+
}
|
|
294
|
+
listBackends(options = {}) {
|
|
295
|
+
void options;
|
|
296
|
+
return (0, execution_backend_1.backendListPayload)();
|
|
297
|
+
}
|
|
298
|
+
showBackend(backendId, options = {}) {
|
|
299
|
+
void options;
|
|
300
|
+
return (0, execution_backend_1.backendShowPayload)(backendId);
|
|
301
|
+
}
|
|
302
|
+
probeBackend(backendId, options = {}) {
|
|
303
|
+
return (0, execution_backend_1.backendProbePayload)(backendId, { cwd: String(options.cwd || process.cwd()) });
|
|
304
|
+
}
|
|
305
|
+
// Candidate domain — delegated to ./orchestrator/candidate-operations.
|
|
306
|
+
listCandidates(runId, options = {}) {
|
|
307
|
+
return candidateOps.listCandidates(this.loadRun(runId), options);
|
|
308
|
+
}
|
|
309
|
+
showCandidate(runId, candidateId) {
|
|
310
|
+
return candidateOps.showCandidate(this.loadRun(runId), candidateId);
|
|
311
|
+
}
|
|
312
|
+
registerCandidate(runId, options = {}) {
|
|
313
|
+
return candidateOps.registerCandidate(this.loadRun(runId), options);
|
|
314
|
+
}
|
|
315
|
+
scoreCandidate(runId, candidateId, options = {}) {
|
|
316
|
+
return candidateOps.scoreCandidate(this.loadRun(runId), candidateId, options);
|
|
317
|
+
}
|
|
318
|
+
rankCandidates(runId, options = {}) {
|
|
319
|
+
return candidateOps.rankCandidates(this.loadRun(runId), options);
|
|
320
|
+
}
|
|
321
|
+
selectCandidate(runId, candidateId, options = {}) {
|
|
322
|
+
return candidateOps.selectCandidate(this.loadRun(runId), candidateId, options);
|
|
323
|
+
}
|
|
324
|
+
rejectCandidate(runId, candidateId, reason) {
|
|
325
|
+
return candidateOps.rejectCandidate(this.loadRun(runId), candidateId, reason);
|
|
326
|
+
}
|
|
327
|
+
// ---- Team Collaboration (v0.1.32) — delegated to ./orchestrator/collaboration-operations.
|
|
328
|
+
// Append-only, host-attested (never authenticated) approvals/comments/handoffs
|
|
329
|
+
// + a derived review state. Both CLI and MCP route through these methods, so
|
|
330
|
+
// `cw <cmd> --json` is identical to `cw_<tool>` (the parity gate).
|
|
331
|
+
collaborationApprove(runId, targetKind, targetId, options = {}, decision = "approve") {
|
|
332
|
+
return collaborationOps.collaborationApprove(this.loadRun(runId), targetKind, targetId, options, decision);
|
|
333
|
+
}
|
|
334
|
+
collaborationReject(runId, targetKind, targetId, options = {}) {
|
|
335
|
+
return this.collaborationApprove(runId, targetKind, targetId, options, "reject");
|
|
336
|
+
}
|
|
337
|
+
collaborationComment(runId, targetKind, targetId, options = {}) {
|
|
338
|
+
return collaborationOps.collaborationComment(this.loadRun(runId), targetKind, targetId, options);
|
|
339
|
+
}
|
|
340
|
+
collaborationCommentList(runId, options = {}) {
|
|
341
|
+
return collaborationOps.collaborationCommentList(this.loadRun(runId), options);
|
|
342
|
+
}
|
|
343
|
+
collaborationHandoff(runId, targetKind, targetId, options = {}) {
|
|
344
|
+
return collaborationOps.collaborationHandoff(this.loadRun(runId), targetKind, targetId, options);
|
|
345
|
+
}
|
|
346
|
+
reviewStatus(runId, options = {}) {
|
|
347
|
+
return collaborationOps.reviewStatus(this.loadRun(runId), options);
|
|
348
|
+
}
|
|
349
|
+
reviewPolicy(runId, options = {}) {
|
|
350
|
+
return collaborationOps.reviewPolicy(this.loadRun(runId), options);
|
|
351
|
+
}
|
|
352
|
+
formatReviewStatus(report) {
|
|
353
|
+
return collaborationOps.formatReviewStatus(report);
|
|
354
|
+
}
|
|
355
|
+
formatCommentList(comments) {
|
|
356
|
+
return collaborationOps.formatCommentList(comments);
|
|
357
|
+
}
|
|
358
|
+
summarizeCandidateRecords(runId) {
|
|
359
|
+
return (0, candidate_scoring_1.summarizeCandidates)(this.loadRun(runId));
|
|
360
|
+
}
|
|
361
|
+
summarizeWorkerRecords(runId) {
|
|
362
|
+
return (0, operator_ux_1.summarizeOperatorWorkers)(this.loadRun(runId));
|
|
363
|
+
}
|
|
364
|
+
summarizeCandidateOperatorRecords(runId) {
|
|
365
|
+
return (0, operator_ux_1.summarizeOperatorCandidates)(this.loadRun(runId));
|
|
366
|
+
}
|
|
367
|
+
summarizeFeedbackRecords(runId) {
|
|
368
|
+
return (0, operator_ux_1.summarizeOperatorFeedback)(this.loadRun(runId));
|
|
369
|
+
}
|
|
370
|
+
summarizeCommitRecords(runId) {
|
|
371
|
+
return (0, operator_ux_1.summarizeOperatorCommits)(this.loadRun(runId));
|
|
372
|
+
}
|
|
373
|
+
report(runId) {
|
|
374
|
+
const run = this.loadRun(runId);
|
|
375
|
+
return { path: (0, report_1.writeReport)(run) };
|
|
376
|
+
}
|
|
377
|
+
operatorReport(runId) {
|
|
378
|
+
const run = this.loadRun(runId);
|
|
379
|
+
(0, report_1.writeReport)(run);
|
|
380
|
+
return (0, operator_ux_1.summarizeOperatorRun)(run);
|
|
381
|
+
}
|
|
382
|
+
showContract(runId, contractId) {
|
|
383
|
+
const run = this.loadRun(runId);
|
|
384
|
+
return (0, pipeline_runner_1.createPipelineRunner)().getRunContract(run, contractId);
|
|
385
|
+
}
|
|
386
|
+
listNodes(runId) {
|
|
387
|
+
return this.loadRun(runId).nodes || [];
|
|
388
|
+
}
|
|
389
|
+
showNode(runId, nodeId) {
|
|
390
|
+
return (0, pipeline_runner_1.createPipelineRunner)().getRunNode(this.loadRun(runId), nodeId);
|
|
391
|
+
}
|
|
392
|
+
graphNodes(runId) {
|
|
393
|
+
return (this.loadRun(runId).nodes || []).map((node) => ({
|
|
394
|
+
id: node.id,
|
|
395
|
+
kind: node.kind,
|
|
396
|
+
status: node.status,
|
|
397
|
+
parents: node.parents,
|
|
398
|
+
children: node.children
|
|
399
|
+
}));
|
|
400
|
+
}
|
|
401
|
+
operatorGraph(runId) {
|
|
402
|
+
return (0, operator_ux_1.buildOperatorGraph)(this.loadRun(runId));
|
|
403
|
+
}
|
|
404
|
+
multiAgentSummary(runId) {
|
|
405
|
+
return (0, multi_agent_1.summarizeMultiAgent)(this.loadRun(runId));
|
|
406
|
+
}
|
|
407
|
+
multiAgentGraph(runId) {
|
|
408
|
+
return (0, multi_agent_1.buildMultiAgentGraph)(this.loadRun(runId));
|
|
409
|
+
}
|
|
410
|
+
multiAgentOperatorStatus(runId) {
|
|
411
|
+
return (0, multi_agent_operator_ux_1.summarizeMultiAgentOperator)(this.loadRun(runId));
|
|
412
|
+
}
|
|
413
|
+
multiAgentOperatorGraph(runId) {
|
|
414
|
+
return (0, multi_agent_operator_ux_1.buildMultiAgentOperatorGraph)(this.loadRun(runId));
|
|
415
|
+
}
|
|
416
|
+
multiAgentDependencies(runId) {
|
|
417
|
+
return (0, multi_agent_operator_ux_1.summarizeMultiAgentOperator)(this.loadRun(runId)).dependencies;
|
|
418
|
+
}
|
|
419
|
+
multiAgentFailures(runId) {
|
|
420
|
+
return (0, multi_agent_operator_ux_1.summarizeMultiAgentOperator)(this.loadRun(runId)).failures;
|
|
421
|
+
}
|
|
422
|
+
multiAgentEvidence(runId) {
|
|
423
|
+
const run = this.loadRun(runId);
|
|
424
|
+
const rows = (0, multi_agent_operator_ux_1.summarizeMultiAgentOperator)(run).evidence;
|
|
425
|
+
// Additive enrichment: attach the derived rationale status so `multi-agent
|
|
426
|
+
// evidence` answers WHAT + whether the WHY is recorded, without changing the
|
|
427
|
+
// existing row shape (POLA: old consumers ignore the new optional field).
|
|
428
|
+
const report = (0, evidence_reasoning_1.buildEvidenceReasoningReport)(run, { index: (0, evidence_reasoning_1.loadEvidenceReasoningIndex)(run) });
|
|
429
|
+
const byId = new Map(report.chains.map((chain) => [chain.id, chain.rationaleStatus]));
|
|
430
|
+
for (const row of rows)
|
|
431
|
+
row.rationaleStatus = byId.get(row.id);
|
|
432
|
+
return rows;
|
|
433
|
+
}
|
|
434
|
+
multiAgentReasoning(runId, options = {}) {
|
|
435
|
+
const run = this.loadRun(runId);
|
|
436
|
+
if (options.refresh) {
|
|
437
|
+
(0, evidence_reasoning_1.refreshEvidenceReasoning)(run);
|
|
438
|
+
(0, state_1.saveCheckpoint)(run);
|
|
439
|
+
}
|
|
440
|
+
return (0, evidence_reasoning_1.showEvidenceReasoning)(run, { evidenceId: (0, cli_options_1.stringOption)(options.evidence || options.evidenceId || options.id) });
|
|
441
|
+
}
|
|
442
|
+
multiAgentReasoningRefresh(runId) {
|
|
443
|
+
const run = this.loadRun(runId);
|
|
444
|
+
const index = (0, evidence_reasoning_1.refreshEvidenceReasoning)(run);
|
|
445
|
+
(0, state_1.saveCheckpoint)(run);
|
|
446
|
+
return index;
|
|
447
|
+
}
|
|
448
|
+
summaryRefresh(runId, options = {}) {
|
|
449
|
+
const run = this.loadRun(runId);
|
|
450
|
+
const index = (0, state_explosion_1.refreshStateExplosionSummaries)(run, { views: (0, cli_options_1.graphViewsOption)(options) });
|
|
451
|
+
(0, report_1.writeReport)(run);
|
|
452
|
+
(0, state_1.saveCheckpoint)(run);
|
|
453
|
+
return index;
|
|
454
|
+
}
|
|
455
|
+
summaryShow(runId) {
|
|
456
|
+
const run = this.loadRun(runId);
|
|
457
|
+
const report = (0, state_explosion_1.showStateExplosionSummary)(run);
|
|
458
|
+
(0, state_1.saveCheckpoint)(run);
|
|
459
|
+
return report;
|
|
460
|
+
}
|
|
461
|
+
/** Observability + cost report for ONE run (v0.1.31). DERIVED from durable
|
|
462
|
+
* state; persists a fingerprinted snapshot under `metrics/` but NEVER mutates
|
|
463
|
+
* the run's own state.json (no saveCheckpoint), so the source — and therefore
|
|
464
|
+
* the report — is stable across repeated reads. `now` is injectable via
|
|
465
|
+
* `args.now` for eval/replay determinism; pricing is POLICY via `--pricing`. */
|
|
466
|
+
metricsShow(runId, args = {}) {
|
|
467
|
+
const run = this.loadRun(runId);
|
|
468
|
+
const policy = (0, observability_1.loadCostPolicy)(args, this.pluginRoot);
|
|
469
|
+
const now = typeof args.now === "string" && args.now ? args.now : new Date().toISOString();
|
|
470
|
+
return (0, observability_1.showMetricsReport)(run, { now, policy });
|
|
471
|
+
}
|
|
472
|
+
blackboardSummarize(runId, options = {}) {
|
|
473
|
+
return (0, state_explosion_1.summarizeBlackboardDigest)(this.loadRun(runId), (0, cli_options_1.stringOption)(options.blackboard || options.blackboardId));
|
|
474
|
+
}
|
|
475
|
+
multiAgentSummarize(runId) {
|
|
476
|
+
const run = this.loadRun(runId);
|
|
477
|
+
const index = (0, state_explosion_1.loadStateExplosionSummaryIndex)(run);
|
|
478
|
+
return (0, state_explosion_1.buildStateExplosionReport)(run, { index });
|
|
479
|
+
}
|
|
480
|
+
multiAgentGraphView(runId, options = {}) {
|
|
481
|
+
const view = (0, cli_options_1.graphViewOption)(options.view);
|
|
482
|
+
return (0, state_explosion_1.buildCompactGraph)(this.loadRun(runId), view, {
|
|
483
|
+
focus: (0, cli_options_1.stringOption)(options.focus),
|
|
484
|
+
depth: (0, cli_options_1.numberOption)(options.depth)
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
stateExplosionReport(runId) {
|
|
488
|
+
const run = this.loadRun(runId);
|
|
489
|
+
const index = (0, state_explosion_1.loadStateExplosionSummaryIndex)(run);
|
|
490
|
+
return (0, state_explosion_1.buildStateExplosionReport)(run, { index });
|
|
491
|
+
}
|
|
492
|
+
// Host multi-agent — delegated to ./orchestrator/host-operations. The runner
|
|
493
|
+
// keeps the load-or-plan policy here because it owns plan().
|
|
494
|
+
hostMultiAgentRun(runId, options = {}) {
|
|
495
|
+
const workflowId = (0, cli_options_1.stringOption)(options.app || options.appId || options.workflow || options.workflowId);
|
|
496
|
+
const run = runId
|
|
497
|
+
? this.loadRun(runId)
|
|
498
|
+
: workflowId
|
|
499
|
+
? this.plan(workflowId, (0, cli_options_1.withoutHostRunKeys)(options))
|
|
500
|
+
: undefined;
|
|
501
|
+
if (!run)
|
|
502
|
+
throw new Error("multi-agent run requires <run-id> or --app <app-id>");
|
|
503
|
+
return hostOps.hostMultiAgentRun(run, options);
|
|
504
|
+
}
|
|
505
|
+
hostMultiAgentStatus(runId) {
|
|
506
|
+
return hostOps.hostMultiAgentStatus(this.loadRun(runId));
|
|
507
|
+
}
|
|
508
|
+
hostMultiAgentStep(runId, options = {}) {
|
|
509
|
+
return hostOps.hostMultiAgentStep(this.loadRun(runId), options);
|
|
510
|
+
}
|
|
511
|
+
hostMultiAgentBlackboard(runId, action, options = {}) {
|
|
512
|
+
return hostOps.hostMultiAgentBlackboard(this.loadRun(runId), action, options);
|
|
513
|
+
}
|
|
514
|
+
hostMultiAgentScore(runId, options = {}) {
|
|
515
|
+
return hostOps.hostMultiAgentScore(this.loadRun(runId), options);
|
|
516
|
+
}
|
|
517
|
+
hostMultiAgentSelect(runId, options = {}) {
|
|
518
|
+
return hostOps.hostMultiAgentSelect(this.loadRun(runId), options);
|
|
519
|
+
}
|
|
520
|
+
evalSnapshot(runId, options = {}) {
|
|
521
|
+
return (0, multi_agent_eval_1.createMultiAgentReplaySnapshot)(this.loadRun(runId), options);
|
|
522
|
+
}
|
|
523
|
+
evalReplay(target, options = {}) {
|
|
524
|
+
return (0, multi_agent_eval_1.replayMultiAgentSnapshot)(target, options);
|
|
525
|
+
}
|
|
526
|
+
evalCompare(baseline, replay) {
|
|
527
|
+
return (0, multi_agent_eval_1.compareMultiAgentReplay)(baseline, replay);
|
|
528
|
+
}
|
|
529
|
+
evalScore(target) {
|
|
530
|
+
return (0, multi_agent_eval_1.scoreMultiAgentReplay)(target);
|
|
531
|
+
}
|
|
532
|
+
evalGate(target) {
|
|
533
|
+
return (0, multi_agent_eval_1.gateMultiAgentEval)(target);
|
|
534
|
+
}
|
|
535
|
+
evalReport(target) {
|
|
536
|
+
return (0, multi_agent_eval_1.reportMultiAgentEval)(target);
|
|
537
|
+
}
|
|
538
|
+
// ---- node snapshot / diff / replay (v0.1.35) ----------------------------
|
|
539
|
+
nodeSnapshot(runId, nodeId, options = {}) {
|
|
540
|
+
return (0, node_snapshot_1.snapshotNode)(this.loadRun(runId), nodeId, options);
|
|
541
|
+
}
|
|
542
|
+
nodeDiff(runId, baselineSnapshotId, candidateSnapshotId) {
|
|
543
|
+
const run = this.loadRun(runId);
|
|
544
|
+
return (0, node_snapshot_1.diffNodeSnapshots)((0, node_snapshot_1.readNodeSnapshot)(run, baselineSnapshotId), (0, node_snapshot_1.readNodeSnapshot)(run, candidateSnapshotId));
|
|
545
|
+
}
|
|
546
|
+
nodeReplay(runId, snapshotId, options = {}) {
|
|
547
|
+
const run = this.loadRun(runId);
|
|
548
|
+
return (0, node_snapshot_1.replayNodeSnapshot)(run, (0, node_snapshot_1.readNodeSnapshot)(run, snapshotId), options);
|
|
549
|
+
}
|
|
550
|
+
nodeReplayVerify(runId, replayId, options = {}) {
|
|
551
|
+
const run = this.loadRun(runId);
|
|
552
|
+
return (0, node_snapshot_1.verifyNodeReplay)(run, (0, node_snapshot_1.readNodeReplay)(run, replayId), options);
|
|
553
|
+
}
|
|
554
|
+
// ---- contract migration (v0.1.36) ---------------------------------------
|
|
555
|
+
// Contract migration — delegated to ./orchestrator/migration-operations.
|
|
556
|
+
migrationList() {
|
|
557
|
+
return migrationOps.migrationList();
|
|
558
|
+
}
|
|
559
|
+
migrationCheck(target, options = {}) {
|
|
560
|
+
return migrationOps.migrationCheck(target, options);
|
|
561
|
+
}
|
|
562
|
+
migrationProve(target, options = {}) {
|
|
563
|
+
return migrationOps.migrationProve(target, options);
|
|
564
|
+
}
|
|
565
|
+
loadMigrationSnapshot(target, options) {
|
|
566
|
+
return migrationOps.loadMigrationSnapshot(target, options);
|
|
567
|
+
}
|
|
568
|
+
// Topology — delegated to ./orchestrator/topology-operations.
|
|
569
|
+
listTopologies() {
|
|
570
|
+
return topologyOps.listTopologies();
|
|
571
|
+
}
|
|
572
|
+
showTopology(topologyId) {
|
|
573
|
+
return topologyOps.showTopology(topologyId);
|
|
574
|
+
}
|
|
575
|
+
validateTopology(topologyId) {
|
|
576
|
+
return topologyOps.validateTopology(topologyId);
|
|
577
|
+
}
|
|
578
|
+
applyTopology(runId, topologyId, options = {}) {
|
|
579
|
+
return topologyOps.applyTopology(this.loadRun(runId), topologyId, options);
|
|
580
|
+
}
|
|
581
|
+
showTopologyRun(runId, topologyRunId) {
|
|
582
|
+
return topologyOps.showTopologyRun(this.loadRun(runId), topologyRunId);
|
|
583
|
+
}
|
|
584
|
+
topologySummary(runId) {
|
|
585
|
+
return topologyOps.topologySummary(this.loadRun(runId));
|
|
586
|
+
}
|
|
587
|
+
topologyGraph(runId) {
|
|
588
|
+
return topologyOps.topologyGraph(this.loadRun(runId));
|
|
589
|
+
}
|
|
590
|
+
// Multi-agent lifecycle + blackboard — delegated to ./orchestrator/multi-agent-operations.
|
|
591
|
+
createMultiAgentRun(runId, options = {}) {
|
|
592
|
+
return maOps.createMultiAgentRun(this.loadRun(runId), options);
|
|
593
|
+
}
|
|
594
|
+
transitionMultiAgentRun(runId, multiAgentRunId, options = {}) {
|
|
595
|
+
return maOps.transitionMultiAgentRun(this.loadRun(runId), multiAgentRunId, options);
|
|
596
|
+
}
|
|
597
|
+
createAgentRole(runId, options = {}) {
|
|
598
|
+
return maOps.createAgentRole(this.loadRun(runId), options);
|
|
599
|
+
}
|
|
600
|
+
createAgentGroup(runId, options = {}) {
|
|
601
|
+
return maOps.createAgentGroup(this.loadRun(runId), options);
|
|
602
|
+
}
|
|
603
|
+
assignAgentMembership(runId, options = {}) {
|
|
604
|
+
return maOps.assignAgentMembership(this.loadRun(runId), options);
|
|
605
|
+
}
|
|
606
|
+
createAgentFanout(runId, options = {}) {
|
|
607
|
+
return maOps.createAgentFanout(this.loadRun(runId), options);
|
|
608
|
+
}
|
|
609
|
+
collectAgentFanin(runId, options = {}) {
|
|
610
|
+
return maOps.collectAgentFanin(this.loadRun(runId), options);
|
|
611
|
+
}
|
|
612
|
+
showMultiAgentRun(runId, multiAgentRunId) {
|
|
613
|
+
return maOps.showMultiAgentRun(this.loadRun(runId), multiAgentRunId);
|
|
614
|
+
}
|
|
615
|
+
showAgentRole(runId, roleId) {
|
|
616
|
+
return maOps.showAgentRole(this.loadRun(runId), roleId);
|
|
617
|
+
}
|
|
618
|
+
showAgentGroup(runId, groupId) {
|
|
619
|
+
return maOps.showAgentGroup(this.loadRun(runId), groupId);
|
|
620
|
+
}
|
|
621
|
+
showAgentMembership(runId, membershipId) {
|
|
622
|
+
return maOps.showAgentMembership(this.loadRun(runId), membershipId);
|
|
623
|
+
}
|
|
624
|
+
showAgentFanout(runId, fanoutId) {
|
|
625
|
+
return maOps.showAgentFanout(this.loadRun(runId), fanoutId);
|
|
626
|
+
}
|
|
627
|
+
showAgentFanin(runId, faninId) {
|
|
628
|
+
return maOps.showAgentFanin(this.loadRun(runId), faninId);
|
|
629
|
+
}
|
|
630
|
+
blackboardSummary(runId, options = {}) {
|
|
631
|
+
return maOps.blackboardSummary(this.loadRun(runId), options);
|
|
632
|
+
}
|
|
633
|
+
coordinatorSummary(runId, options = {}) {
|
|
634
|
+
return maOps.blackboardSummary(this.loadRun(runId), options);
|
|
635
|
+
}
|
|
636
|
+
blackboardGraph(runId) {
|
|
637
|
+
return maOps.blackboardGraph(this.loadRun(runId));
|
|
638
|
+
}
|
|
639
|
+
resolveRunBlackboard(runId, options = {}) {
|
|
640
|
+
return maOps.resolveRunBlackboard(this.loadRun(runId), options);
|
|
641
|
+
}
|
|
642
|
+
createBlackboardTopic(runId, options = {}) {
|
|
643
|
+
return maOps.createBlackboardTopic(this.loadRun(runId), options);
|
|
644
|
+
}
|
|
645
|
+
postBlackboardMessage(runId, options = {}) {
|
|
646
|
+
return maOps.postBlackboardMessage(this.loadRun(runId), options);
|
|
647
|
+
}
|
|
648
|
+
listBlackboardMessages(runId, options = {}) {
|
|
649
|
+
return maOps.listBlackboardMessages(this.loadRun(runId), options);
|
|
650
|
+
}
|
|
651
|
+
putBlackboardContext(runId, options = {}) {
|
|
652
|
+
return maOps.putBlackboardContext(this.loadRun(runId), options);
|
|
653
|
+
}
|
|
654
|
+
addBlackboardArtifact(runId, options = {}) {
|
|
655
|
+
return maOps.addBlackboardArtifact(this.loadRun(runId), options);
|
|
656
|
+
}
|
|
657
|
+
listBlackboardArtifacts(runId, options = {}) {
|
|
658
|
+
return maOps.listBlackboardArtifacts(this.loadRun(runId), options);
|
|
659
|
+
}
|
|
660
|
+
snapshotBlackboard(runId, options = {}) {
|
|
661
|
+
return maOps.snapshotBlackboard(this.loadRun(runId), options);
|
|
662
|
+
}
|
|
663
|
+
recordCoordinatorDecision(runId, options = {}) {
|
|
664
|
+
return maOps.recordCoordinatorDecision(this.loadRun(runId), options);
|
|
665
|
+
}
|
|
666
|
+
checkState(runId, options = {}) {
|
|
667
|
+
return lifecycleOps.checkState(runId, options);
|
|
668
|
+
}
|
|
669
|
+
commit(runId, input = {}) {
|
|
670
|
+
return lifecycleOps.commit(this.loadRun(runId), input);
|
|
671
|
+
}
|
|
672
|
+
// Feedback — delegated to ./orchestrator/feedback-operations.
|
|
673
|
+
collectFeedback(runId) {
|
|
674
|
+
return feedbackOps.collectFeedback(this.loadRun(runId));
|
|
675
|
+
}
|
|
676
|
+
listFeedback(runId, options = {}) {
|
|
677
|
+
return feedbackOps.listFeedback(this.loadRun(runId), options);
|
|
678
|
+
}
|
|
679
|
+
showFeedback(runId, feedbackId) {
|
|
680
|
+
return feedbackOps.showFeedback(this.loadRun(runId), feedbackId);
|
|
681
|
+
}
|
|
682
|
+
createFeedbackTask(runId, feedbackId, options = {}) {
|
|
683
|
+
return feedbackOps.createFeedbackTask(this.loadRun(runId), feedbackId, options);
|
|
684
|
+
}
|
|
685
|
+
resolveFeedback(runId, feedbackId, options = {}) {
|
|
686
|
+
return feedbackOps.resolveFeedback(this.loadRun(runId), feedbackId, options);
|
|
687
|
+
}
|
|
688
|
+
loadRun(runId) {
|
|
689
|
+
return (0, state_1.loadRunFromCwd)(runId);
|
|
690
|
+
}
|
|
691
|
+
loadWorkflowById(workflowId) {
|
|
692
|
+
return this.loadWorkflowAppById(workflowId).app.workflow;
|
|
693
|
+
}
|
|
694
|
+
loadWorkflowAppById(appId) {
|
|
695
|
+
const record = this.loadWorkflowApps().find((candidate) => candidate.app.id === appId);
|
|
696
|
+
if (!record)
|
|
697
|
+
throw new Error(`Workflow app not found: ${appId}`);
|
|
698
|
+
return record;
|
|
699
|
+
}
|
|
700
|
+
loadWorkflowAppTarget(target) {
|
|
701
|
+
if (!target)
|
|
702
|
+
throw new Error("Missing workflow app path or id");
|
|
703
|
+
const resolved = node_path_1.default.resolve(target);
|
|
704
|
+
if (node_fs_1.default.existsSync(resolved)) {
|
|
705
|
+
const stat = node_fs_1.default.statSync(resolved);
|
|
706
|
+
if (stat.isDirectory())
|
|
707
|
+
return (0, workflow_app_framework_1.loadWorkflowAppFromManifest)(node_path_1.default.join(resolved, "app.json"));
|
|
708
|
+
if (node_path_1.default.basename(resolved) === "app.json" || resolved.endsWith(".json"))
|
|
709
|
+
return (0, workflow_app_framework_1.loadWorkflowAppFromManifest)(resolved);
|
|
710
|
+
return (0, workflow_app_framework_1.loadWorkflowAppFromEntrypoint)(resolved);
|
|
711
|
+
}
|
|
712
|
+
return this.loadWorkflowAppById(target);
|
|
713
|
+
}
|
|
714
|
+
loadWorkflowApps() {
|
|
715
|
+
const records = [
|
|
716
|
+
...this.loadWorkflowFiles().map((file) => (0, workflow_app_framework_1.loadWorkflowAppFromEntrypoint)(file)),
|
|
717
|
+
...this.loadAppManifestFiles().map((file) => (0, workflow_app_framework_1.loadWorkflowAppFromManifest)(file))
|
|
718
|
+
].sort((left, right) => {
|
|
719
|
+
const byId = left.app.id.localeCompare(right.app.id);
|
|
720
|
+
if (byId)
|
|
721
|
+
return byId;
|
|
722
|
+
return (left.source.manifestPath || left.source.entrypointPath || left.source.path)
|
|
723
|
+
.localeCompare(right.source.manifestPath || right.source.entrypointPath || right.source.path);
|
|
724
|
+
});
|
|
725
|
+
const seen = new Map();
|
|
726
|
+
for (const record of records) {
|
|
727
|
+
const previous = seen.get(record.app.id);
|
|
728
|
+
if (previous) {
|
|
729
|
+
throw new Error(`Duplicate workflow app id ${record.app.id}: ${previous.source.manifestPath || previous.source.entrypointPath || previous.source.path} and ${record.source.manifestPath || record.source.entrypointPath || record.source.path}`);
|
|
730
|
+
}
|
|
731
|
+
seen.set(record.app.id, record);
|
|
732
|
+
}
|
|
733
|
+
return records;
|
|
734
|
+
}
|
|
735
|
+
loadWorkflowFiles() {
|
|
736
|
+
if (!node_fs_1.default.existsSync(this.workflowsDir))
|
|
737
|
+
return [];
|
|
738
|
+
return node_fs_1.default
|
|
739
|
+
.readdirSync(this.workflowsDir)
|
|
740
|
+
.filter((file) => file.endsWith(".workflow.js"))
|
|
741
|
+
.sort()
|
|
742
|
+
.map((file) => node_path_1.default.join(this.workflowsDir, file));
|
|
743
|
+
}
|
|
744
|
+
loadAppManifestFiles() {
|
|
745
|
+
if (!node_fs_1.default.existsSync(this.appsDir))
|
|
746
|
+
return [];
|
|
747
|
+
return node_fs_1.default
|
|
748
|
+
.readdirSync(this.appsDir, { withFileTypes: true })
|
|
749
|
+
.filter((entry) => entry.isDirectory())
|
|
750
|
+
.map((entry) => node_path_1.default.join(this.appsDir, entry.name, "app.json"))
|
|
751
|
+
.filter((file) => node_fs_1.default.existsSync(file))
|
|
752
|
+
.sort();
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
exports.CoolWorkflowRunner = CoolWorkflowRunner;
|
|
756
|
+
function parseArgv(argv) {
|
|
757
|
+
const [command, ...rest] = argv;
|
|
758
|
+
const options = {};
|
|
759
|
+
const positionals = [];
|
|
760
|
+
for (let index = 0; index < rest.length; index += 1) {
|
|
761
|
+
const token = rest[index];
|
|
762
|
+
if (!token.startsWith("--")) {
|
|
763
|
+
positionals.push(token);
|
|
764
|
+
continue;
|
|
765
|
+
}
|
|
766
|
+
const withoutPrefix = token.slice(2);
|
|
767
|
+
const equalsIndex = withoutPrefix.indexOf("=");
|
|
768
|
+
let key;
|
|
769
|
+
let value;
|
|
770
|
+
if (equalsIndex >= 0) {
|
|
771
|
+
key = withoutPrefix.slice(0, equalsIndex);
|
|
772
|
+
value = withoutPrefix.slice(equalsIndex + 1);
|
|
773
|
+
}
|
|
774
|
+
else {
|
|
775
|
+
key = withoutPrefix;
|
|
776
|
+
value = rest[index + 1] && !rest[index + 1].startsWith("--") ? rest[++index] : true;
|
|
777
|
+
}
|
|
778
|
+
appendOption(options, key, value);
|
|
779
|
+
}
|
|
780
|
+
return { command, positionals, options };
|
|
781
|
+
}
|
|
782
|
+
function formatHelp() {
|
|
783
|
+
return [
|
|
784
|
+
"Cool Workflow",
|
|
785
|
+
"",
|
|
786
|
+
"Quick start (ONE command — plan -> drive -> report):",
|
|
787
|
+
" quickstart [architecture-review] --repo PATH --question TEXT --agent-command \"claude -p\"",
|
|
788
|
+
" (delegates each worker to YOUR configured agent backend; --preview for a dry run)",
|
|
789
|
+
"",
|
|
790
|
+
"Commands:",
|
|
791
|
+
" list",
|
|
792
|
+
" init <workflow-id> [--title TEXT] [--output PATH]",
|
|
793
|
+
" quickstart [app-id] [--repo PATH] [--question TEXT] [--agent-command CMD] [--once] [--preview]",
|
|
794
|
+
" plan <workflow-id> [--repo PATH] [--question TEXT] [--invariant TEXT]",
|
|
795
|
+
" status <run-id> [--json|--format json]",
|
|
796
|
+
" next <run-id> [--limit N]",
|
|
797
|
+
" graph <run-id> [--json]",
|
|
798
|
+
" dispatch <run-id> [--limit N] [--sandbox PROFILE] [--backend node|bun|shell|container|remote|ci]",
|
|
799
|
+
" result <run-id> <task-id> <result-file>",
|
|
800
|
+
" state check <run-id> [--state PATH] [--write]",
|
|
801
|
+
" commit <run-id> --verifier <node-id> [--reason TEXT]",
|
|
802
|
+
" commit <run-id> --candidate <candidate-id> [--reason TEXT]",
|
|
803
|
+
" commit <run-id> --selection <selection-id> [--reason TEXT]",
|
|
804
|
+
" commit <run-id> --allow-unverified-checkpoint [--reason TEXT]",
|
|
805
|
+
" commit summary <run-id> [--json]",
|
|
806
|
+
" report <run-id> [--show|--summary]",
|
|
807
|
+
" app list|show|validate|init|package",
|
|
808
|
+
" sandbox list|show|validate",
|
|
809
|
+
" backend list|show|probe [backend-id]",
|
|
810
|
+
" contract show <run-id> [contract-id]",
|
|
811
|
+
" node list|show|graph <run-id>",
|
|
812
|
+
" feedback list|summary|show|collect|task|resolve <run-id>",
|
|
813
|
+
" worker list|summary|show|manifest|output|fail|validate <run-id>",
|
|
814
|
+
" audit summary <run-id>",
|
|
815
|
+
" audit worker <run-id> <worker-id>",
|
|
816
|
+
" audit provenance <run-id> [--worker ID|--candidate ID|--commit ID]",
|
|
817
|
+
" audit multi-agent <run-id> [--json]",
|
|
818
|
+
" audit policy <run-id> [--json]",
|
|
819
|
+
" audit role <run-id> <role-id> [--json]",
|
|
820
|
+
" audit blackboard <run-id> [--json]",
|
|
821
|
+
" audit judge <run-id> [--json]",
|
|
822
|
+
" audit attest <run-id> [--worker ID] [--hostEnforced true] [--env NAME]",
|
|
823
|
+
" audit decision <run-id> <worker-id> [--path PATH|--command CMD|--network TARGET|--env NAME]",
|
|
824
|
+
" candidate list|summary|register|score|rank|select|reject <run-id>",
|
|
825
|
+
" eval snapshot|replay|compare|score|gate|report",
|
|
826
|
+
" summary refresh|show <run-id> [--json]",
|
|
827
|
+
" blackboard summary|summarize|graph|resolve <run-id>",
|
|
828
|
+
" blackboard topic create <run-id> --id <topic-id> --title TEXT",
|
|
829
|
+
" blackboard message post|list <run-id>",
|
|
830
|
+
" blackboard context put <run-id>",
|
|
831
|
+
" blackboard artifact add|list <run-id>",
|
|
832
|
+
" blackboard snapshot <run-id>",
|
|
833
|
+
" coordinator summary <run-id>",
|
|
834
|
+
" coordinator decision <run-id> --kind KIND --outcome OUTCOME --reason TEXT",
|
|
835
|
+
" multi-agent run|status|step|blackboard|score|select|summary|summarize|graph|dependencies|failures|evidence <run-id>",
|
|
836
|
+
" multi-agent graph <run-id> --view full|compact|critical-path|failures|evidence|trust|topology|blackboard|candidate|commit-gate [--focus ID] [--depth N]",
|
|
837
|
+
" topology list|show|validate|apply|summary|graph",
|
|
838
|
+
" schedule create|list|due|complete|pause|resume|run-now|history|daemon|delete",
|
|
839
|
+
" routine create|fire|list|events|delete",
|
|
840
|
+
" registry refresh|show [--scope repo|home] [--json]",
|
|
841
|
+
" run search|list|show|resume|archive|rerun [run-id] [--scope repo|home] [--json]",
|
|
842
|
+
" queue add|list|drain|show [queue-id] [--repo PATH] [--priority N]",
|
|
843
|
+
" history [--scope repo|home] [--app ID] [--status STATE] [--json]",
|
|
844
|
+
" workbench view <run-id> [--json]",
|
|
845
|
+
" workbench serve [--port N] [--scope repo|home] [--once|--json]",
|
|
846
|
+
""
|
|
847
|
+
].join("\n");
|
|
848
|
+
return `Cool Workflow\n\nCommands:\n list\n init <workflow-id> [--title TEXT] [--output PATH]\n plan <workflow-id> [--repo PATH] [--question TEXT] [--invariant TEXT]\n status <run-id> [--json|--format json]\n next <run-id> [--limit N]\n graph <run-id> [--json]\n dispatch <run-id> [--limit N] [--sandbox PROFILE]\n result <run-id> <task-id> <result-file>\n state check <run-id> [--state PATH] [--write]\n commit <run-id> --verifier <node-id> [--reason TEXT]\n commit <run-id> --candidate <candidate-id> [--reason TEXT]\n commit <run-id> --selection <selection-id> [--reason TEXT]\n commit <run-id> --allow-unverified-checkpoint [--reason TEXT]\n commit summary <run-id> [--json]\n report <run-id> [--show|--summary]\n app list\n app show <app-id>\n app validate <path-or-app-id>\n app init <app-id> --title TEXT\n app package <app-id> [--output PATH]\n sandbox list\n sandbox show <profile-id>\n sandbox validate <profile-file>\n contract show <run-id> [contract-id]\n node list <run-id>\n node show <run-id> <node-id>\n node graph <run-id> [--json]\n feedback list <run-id> [--status open]\n feedback summary <run-id> [--json]\n feedback show <run-id> <feedback-id>\n feedback collect <run-id>\n feedback task <run-id> <feedback-id> [--verify CMD]\n feedback resolve <run-id> <feedback-id> --node <node-id>\n worker list <run-id> [--status running]\n worker summary <run-id> [--json]\n worker show <run-id> <worker-id>\n worker manifest <run-id> <worker-id>\n worker output <run-id> <worker-id> <result-file>\n worker fail <run-id> <worker-id> --message TEXT\n worker validate <run-id> <worker-id> [path]\n audit summary <run-id>\n audit worker <run-id> <worker-id>\n audit provenance <run-id> [--worker ID|--candidate ID|--commit ID]\n audit attest <run-id> [--worker ID] [--hostEnforced true] [--env NAME]\n audit decision <run-id> <worker-id> [--path PATH|--command CMD|--network TARGET|--env NAME]\n candidate list <run-id> [--status scored]\n candidate summary <run-id> [--json]\n candidate register <run-id> --worker <worker-id>\n candidate score <run-id> <candidate-id> --criterion name=value --evidence PATH\n candidate rank <run-id>\n candidate select <run-id> <candidate-id> [--reason TEXT]\n candidate reject <run-id> <candidate-id> --reason TEXT\n blackboard summary <run-id>\n blackboard graph <run-id>\n blackboard topic create <run-id> --id <topic-id> --title TEXT\n blackboard message post <run-id> --topic <topic-id> --body TEXT\n blackboard message list <run-id> [--topic <topic-id>]\n blackboard context put <run-id> --topic <topic-id> --kind fact|constraint|assumption|question|decision --value TEXT\n blackboard artifact add <run-id> --path PATH --kind KIND\n blackboard artifact list <run-id>\n blackboard snapshot <run-id>\n coordinator summary <run-id>\n coordinator decision <run-id> --kind KIND --outcome OUTCOME --reason TEXT\n loop --intervalMinutes 30 --prompt TEXT\n schedule create --kind loop --intervalMinutes 30 --prompt TEXT\n schedule list [--status active]\n schedule due\n schedule complete <schedule-id>\n schedule pause <schedule-id>\n schedule resume <schedule-id>\n schedule run-now <schedule-id>\n schedule history [schedule-id]\n schedule daemon [--once] [--intervalSeconds 60]\n schedule delete <schedule-id>\n routine create --kind api|github --prompt TEXT [--match JSON]\n routine fire api|github [payload.json]\n routine list\n routine events [trigger-id]\n routine delete <trigger-id>\n\n`;
|
|
849
|
+
}
|
|
850
|
+
function appendOption(options, key, value) {
|
|
851
|
+
if (Object.prototype.hasOwnProperty.call(options, key)) {
|
|
852
|
+
const current = options[key];
|
|
853
|
+
options[key] = Array.isArray(current) ? [...current, value] : [current, value];
|
|
854
|
+
return;
|
|
855
|
+
}
|
|
856
|
+
options[key] = value;
|
|
857
|
+
}
|
|
858
|
+
function resolvePluginRoot(candidate) {
|
|
859
|
+
let current = node_path_1.default.resolve(candidate);
|
|
860
|
+
for (let depth = 0; depth < 5; depth += 1) {
|
|
861
|
+
if (node_fs_1.default.existsSync(node_path_1.default.join(current, "workflows")) && node_fs_1.default.existsSync(node_path_1.default.join(current, "package.json"))) {
|
|
862
|
+
return current;
|
|
863
|
+
}
|
|
864
|
+
current = node_path_1.default.dirname(current);
|
|
865
|
+
}
|
|
866
|
+
throw new Error("Run cw.js from the cool-workflow plugin directory");
|
|
867
|
+
}
|
|
868
|
+
function titleize(value) {
|
|
869
|
+
return value
|
|
870
|
+
.split("-")
|
|
871
|
+
.filter(Boolean)
|
|
872
|
+
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
873
|
+
.join(" ");
|
|
874
|
+
}
|