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,369 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Report rendering for workflow runs — extracted from orchestrator.ts.
|
|
3
|
+
//
|
|
4
|
+
// Pure projection of a WorkflowRun into the human-readable run report and the
|
|
5
|
+
// RunSummary view model. No orchestration state, no I/O beyond writing the
|
|
6
|
+
// report file. The orchestrator re-imports the two public entry points
|
|
7
|
+
// (writeReport, summarizeRun); every render*/format* helper here is private.
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.writeReport = writeReport;
|
|
13
|
+
exports.summarizeRun = summarizeRun;
|
|
14
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
15
|
+
const dispatch_1 = require("../dispatch");
|
|
16
|
+
const worker_isolation_1 = require("../worker-isolation");
|
|
17
|
+
const candidate_scoring_1 = require("../candidate-scoring");
|
|
18
|
+
const error_feedback_1 = require("../error-feedback");
|
|
19
|
+
const multi_agent_1 = require("../multi-agent");
|
|
20
|
+
const coordinator_1 = require("../coordinator");
|
|
21
|
+
const trust_audit_1 = require("../trust-audit");
|
|
22
|
+
const telemetry_ledger_1 = require("../telemetry-ledger");
|
|
23
|
+
const state_explosion_1 = require("../state-explosion");
|
|
24
|
+
function writeReport(run) {
|
|
25
|
+
(0, dispatch_1.updatePhaseStatuses)(run);
|
|
26
|
+
const workerSummary = (0, worker_isolation_1.summarizeWorkers)(run);
|
|
27
|
+
const candidateSummary = (0, candidate_scoring_1.summarizeCandidates)(run);
|
|
28
|
+
const report = [
|
|
29
|
+
`# ${run.workflow.title}`,
|
|
30
|
+
"",
|
|
31
|
+
`- Run: ${run.id}`,
|
|
32
|
+
`- Workflow: ${run.workflow.id}`,
|
|
33
|
+
...(run.workflow.app
|
|
34
|
+
? [
|
|
35
|
+
`- Workflow App: ${run.workflow.app.id}@${run.workflow.app.version}`,
|
|
36
|
+
`- Workflow App Source: ${run.workflow.app.source?.manifestPath || run.workflow.app.source?.entrypointPath || run.workflow.app.source?.path || ""}`
|
|
37
|
+
]
|
|
38
|
+
: []),
|
|
39
|
+
`- Created: ${run.createdAt}`,
|
|
40
|
+
`- Updated: ${run.updatedAt}`,
|
|
41
|
+
`- Repository: ${String(run.inputs.repo || run.cwd)}`,
|
|
42
|
+
`- Question: ${String(run.inputs.question || "")}`,
|
|
43
|
+
`- Invariants: ${formatInputList(run.inputs.invariant)}`,
|
|
44
|
+
`- Loop Stage: ${run.loopStage}`,
|
|
45
|
+
"",
|
|
46
|
+
"## Phase Status",
|
|
47
|
+
"",
|
|
48
|
+
"| Phase | Status | Completed | Total |",
|
|
49
|
+
"| --- | --- | ---: | ---: |",
|
|
50
|
+
...run.phases.map((phase) => {
|
|
51
|
+
const phaseTasks = run.tasks.filter((task) => phase.taskIds.includes(task.id));
|
|
52
|
+
const completed = phaseTasks.filter((task) => task.status === "completed").length;
|
|
53
|
+
return `| ${phase.name} | ${phase.status} | ${completed} | ${phaseTasks.length} |`;
|
|
54
|
+
}),
|
|
55
|
+
"",
|
|
56
|
+
"## State Commits",
|
|
57
|
+
"",
|
|
58
|
+
...renderCommits(run),
|
|
59
|
+
"",
|
|
60
|
+
"## Error Feedback",
|
|
61
|
+
"",
|
|
62
|
+
...renderFeedback(run),
|
|
63
|
+
"",
|
|
64
|
+
"## Workers",
|
|
65
|
+
"",
|
|
66
|
+
...renderWorkers(workerSummary),
|
|
67
|
+
"",
|
|
68
|
+
"## State Size & Compaction",
|
|
69
|
+
"",
|
|
70
|
+
...renderStateSize(run),
|
|
71
|
+
"",
|
|
72
|
+
"## Multi-Agent Runtime",
|
|
73
|
+
"",
|
|
74
|
+
...renderMultiAgent(run),
|
|
75
|
+
"",
|
|
76
|
+
"## Blackboard / Coordinator",
|
|
77
|
+
"",
|
|
78
|
+
...renderBlackboard(run),
|
|
79
|
+
"",
|
|
80
|
+
"## Sandbox Profiles",
|
|
81
|
+
"",
|
|
82
|
+
...renderSandboxProfiles(run),
|
|
83
|
+
"",
|
|
84
|
+
"## Trust Audit",
|
|
85
|
+
"",
|
|
86
|
+
...renderTrustAudit(run),
|
|
87
|
+
"",
|
|
88
|
+
"## Acceptance Rationale",
|
|
89
|
+
"",
|
|
90
|
+
...renderAcceptanceRationale(run),
|
|
91
|
+
"",
|
|
92
|
+
"## Candidates",
|
|
93
|
+
"",
|
|
94
|
+
...renderCandidates(candidateSummary),
|
|
95
|
+
"",
|
|
96
|
+
"## Pending Tasks",
|
|
97
|
+
"",
|
|
98
|
+
...renderPendingTasks(run),
|
|
99
|
+
"",
|
|
100
|
+
"## Results",
|
|
101
|
+
"",
|
|
102
|
+
...renderResults(run)
|
|
103
|
+
].join("\n");
|
|
104
|
+
node_fs_1.default.writeFileSync(run.paths.report, report, "utf8");
|
|
105
|
+
return run.paths.report;
|
|
106
|
+
}
|
|
107
|
+
function summarizeRun(run) {
|
|
108
|
+
(0, dispatch_1.updatePhaseStatuses)(run);
|
|
109
|
+
const workerSummary = (0, worker_isolation_1.summarizeWorkers)(run);
|
|
110
|
+
const createdAtMs = Date.parse(run.createdAt);
|
|
111
|
+
const updatedAtMs = Date.parse(run.updatedAt);
|
|
112
|
+
const durationMs = Number.isFinite(createdAtMs) && Number.isFinite(updatedAtMs) ? Math.max(0, updatedAtMs - createdAtMs) : undefined;
|
|
113
|
+
return {
|
|
114
|
+
runId: run.id,
|
|
115
|
+
workflowId: run.workflow.id,
|
|
116
|
+
app: run.workflow.app,
|
|
117
|
+
phases: run.phases,
|
|
118
|
+
tasks: {
|
|
119
|
+
total: run.tasks.length,
|
|
120
|
+
pending: run.tasks.filter((task) => task.status === "pending").length,
|
|
121
|
+
running: run.tasks.filter((task) => task.status === "running").length,
|
|
122
|
+
failed: run.tasks.filter((task) => task.status === "failed").length,
|
|
123
|
+
completed: run.tasks.filter((task) => task.status === "completed").length
|
|
124
|
+
},
|
|
125
|
+
loopStage: run.loopStage,
|
|
126
|
+
durationMs,
|
|
127
|
+
progressPercent: run.tasks.length ? Math.round((run.tasks.filter((t) => t.status === "completed").length / run.tasks.length) * 100) : 0,
|
|
128
|
+
next: (0, dispatch_1.firstRunnablePhase)(run)?.name || null,
|
|
129
|
+
reportPath: run.paths.report,
|
|
130
|
+
commits: run.commits,
|
|
131
|
+
workers: {
|
|
132
|
+
total: workerSummary.total,
|
|
133
|
+
byStatus: workerSummary.byStatus
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function renderPendingTasks(run) {
|
|
138
|
+
const pending = run.tasks.filter((task) => task.status === "pending" || task.status === "running");
|
|
139
|
+
if (!pending.length)
|
|
140
|
+
return ["No pending tasks."];
|
|
141
|
+
return pending.map((task) => `- ${task.id} (${task.phase}, ${task.status}): ${task.taskPath}`);
|
|
142
|
+
}
|
|
143
|
+
function renderResults(run) {
|
|
144
|
+
const completed = run.tasks.filter((task) => task.status === "completed");
|
|
145
|
+
if (!completed.length)
|
|
146
|
+
return ["No completed results yet."];
|
|
147
|
+
const lines = [];
|
|
148
|
+
for (const task of completed) {
|
|
149
|
+
lines.push(`### ${task.id}`, "", `Result: ${task.resultPath}`, "");
|
|
150
|
+
if (task.resultPath && node_fs_1.default.existsSync(task.resultPath)) {
|
|
151
|
+
lines.push(node_fs_1.default.readFileSync(task.resultPath, "utf8").trim(), "");
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
lines.push("_Result file is not present on this host; state metadata remains inspectable._", "");
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return lines;
|
|
158
|
+
}
|
|
159
|
+
function renderCommits(run) {
|
|
160
|
+
if (!run.commits.length)
|
|
161
|
+
return ["No state commits yet."];
|
|
162
|
+
return run.commits.map((commit) => {
|
|
163
|
+
const kind = commit.verifierGated ? "verifier-gated commit" : "checkpoint";
|
|
164
|
+
const gate = commit.verifierGated ? formatCommitGate(commit) : "verifierGated=false";
|
|
165
|
+
return `- ${commit.id}: ${commit.reason} [${commit.loopStage}; ${kind}; ${gate}] (${commit.snapshotPath})`;
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
function renderFeedback(run) {
|
|
169
|
+
const summary = (0, error_feedback_1.summarizeFeedback)(run);
|
|
170
|
+
if (!summary.total)
|
|
171
|
+
return ["No feedback records."];
|
|
172
|
+
return [
|
|
173
|
+
`- Total: ${summary.total}`,
|
|
174
|
+
`- By status: ${formatCounts(summary.byStatus)}`,
|
|
175
|
+
`- By severity: ${formatCounts(summary.bySeverity)}`,
|
|
176
|
+
`- By classification: ${formatCounts(summary.byClassification)}`,
|
|
177
|
+
"",
|
|
178
|
+
...summary.artifacts.map((artifact) => `- ${artifact}`)
|
|
179
|
+
];
|
|
180
|
+
}
|
|
181
|
+
function renderWorkers(summary) {
|
|
182
|
+
if (!summary.total)
|
|
183
|
+
return ["No worker scopes yet."];
|
|
184
|
+
const lines = [
|
|
185
|
+
`- Total: ${summary.total}`,
|
|
186
|
+
`- By status: ${formatCounts(summary.byStatus)}`,
|
|
187
|
+
"",
|
|
188
|
+
...summary.manifestPaths.map((artifact) => `- ${artifact}`)
|
|
189
|
+
];
|
|
190
|
+
if (summary.failed.length) {
|
|
191
|
+
lines.push("", "Failed or rejected:");
|
|
192
|
+
for (const worker of summary.failed) {
|
|
193
|
+
lines.push(`- ${worker.id} (${worker.status}) feedback=${worker.feedbackIds.join(",") || "none"}`);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return lines;
|
|
197
|
+
}
|
|
198
|
+
function renderStateSize(run) {
|
|
199
|
+
const index = (0, state_explosion_1.loadStateExplosionSummaryIndex)(run);
|
|
200
|
+
const report = (0, state_explosion_1.buildStateExplosionReport)(run, { index });
|
|
201
|
+
return (0, state_explosion_1.stateExplosionReportLines)(report);
|
|
202
|
+
}
|
|
203
|
+
function renderMultiAgent(run) {
|
|
204
|
+
const summary = (0, multi_agent_1.summarizeMultiAgent)(run);
|
|
205
|
+
if (!summary.totalRuns)
|
|
206
|
+
return ["No multi-agent runtime records yet."];
|
|
207
|
+
const lines = [
|
|
208
|
+
`- Runs: ${summary.totalRuns} (${formatCounts(summary.runsByStatus)})`,
|
|
209
|
+
`- Roles: ${summary.roles}`,
|
|
210
|
+
`- Groups: ${summary.groups} (${formatCounts(summary.groupsByStatus)})`,
|
|
211
|
+
`- Memberships: ${summary.memberships} (${formatCounts(summary.membershipsByStatus)})`,
|
|
212
|
+
`- Fanouts: ${summary.fanouts}`,
|
|
213
|
+
`- Fanins: ${summary.fanins} (${formatCounts(summary.faninsByStatus)})`
|
|
214
|
+
];
|
|
215
|
+
if (summary.blockedReasons.length) {
|
|
216
|
+
lines.push("", "Blocked:");
|
|
217
|
+
for (const reason of summary.blockedReasons.slice(0, 8))
|
|
218
|
+
lines.push(`- ${reason}`);
|
|
219
|
+
}
|
|
220
|
+
for (const group of summary.groupsDetail.slice(0, 8)) {
|
|
221
|
+
lines.push("", `Group ${group.id}: status=${group.status}, phase=${group.phase || "none"}, run=${group.multiAgentRunId}`);
|
|
222
|
+
for (const role of group.roles) {
|
|
223
|
+
lines.push(`- role=${role.roleId}, memberships=${role.memberships}, reported=${role.reported}, missing=${role.missing}, requiredEvidence=${role.requiredEvidence}`);
|
|
224
|
+
}
|
|
225
|
+
lines.push(`- fanouts=${group.fanouts.join(", ") || "none"}`);
|
|
226
|
+
lines.push(`- fanins=${group.fanins.join(", ") || "none"}`);
|
|
227
|
+
}
|
|
228
|
+
if (summary.nextAction)
|
|
229
|
+
lines.push("", `Next multi-agent action: ${summary.nextAction}`);
|
|
230
|
+
return lines;
|
|
231
|
+
}
|
|
232
|
+
function renderBlackboard(run) {
|
|
233
|
+
const summary = (0, coordinator_1.summarizeBlackboard)(run);
|
|
234
|
+
if (!summary.blackboardId)
|
|
235
|
+
return ["No blackboard records yet."];
|
|
236
|
+
const lines = [
|
|
237
|
+
`- Blackboard: ${summary.blackboardId}`,
|
|
238
|
+
`- Topics: ${summary.topics}`,
|
|
239
|
+
`- Messages: ${summary.messages}`,
|
|
240
|
+
`- Contexts: ${summary.contexts}`,
|
|
241
|
+
`- Artifacts: ${summary.artifacts}`,
|
|
242
|
+
`- Snapshots: ${summary.snapshots}`,
|
|
243
|
+
`- Decisions: ${summary.decisions}`,
|
|
244
|
+
`- Ready for fanin: ${summary.readyForFanin ? "yes" : "no"}`,
|
|
245
|
+
`- Index: ${summary.indexPath || "none"}`,
|
|
246
|
+
`- Latest snapshot: ${summary.latestSnapshotPath || "none"}`
|
|
247
|
+
];
|
|
248
|
+
if (summary.openQuestions.length) {
|
|
249
|
+
lines.push("", "Open questions:");
|
|
250
|
+
for (const question of summary.openQuestions.slice(0, 8))
|
|
251
|
+
lines.push(`- ${question.id}: ${question.key}=${question.value}`);
|
|
252
|
+
}
|
|
253
|
+
if (summary.conflicts.length) {
|
|
254
|
+
lines.push("", "Conflicts:");
|
|
255
|
+
for (const conflict of summary.conflicts.slice(0, 8)) {
|
|
256
|
+
lines.push(`- ${conflict.id}: ${conflict.key} conflicts with ${conflict.conflictingContextIds.join(", ") || "unknown"}`);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
if (summary.missingEvidence.length) {
|
|
260
|
+
lines.push("", "Missing evidence:");
|
|
261
|
+
for (const item of summary.missingEvidence.slice(0, 8))
|
|
262
|
+
lines.push(`- ${item}`);
|
|
263
|
+
}
|
|
264
|
+
if (summary.nextAction)
|
|
265
|
+
lines.push("", `Next coordinator action: ${summary.nextAction}`);
|
|
266
|
+
return lines;
|
|
267
|
+
}
|
|
268
|
+
function renderSandboxProfiles(run) {
|
|
269
|
+
const profiles = run.sandboxProfiles || [];
|
|
270
|
+
if (!profiles.length)
|
|
271
|
+
return ["No sandbox profiles selected yet."];
|
|
272
|
+
return profiles.map((profile) => [
|
|
273
|
+
`- ${profile.id}: read=${profile.readPaths.length}, write=${profile.writePaths.length}, execute=${profile.execute.mode}, network=${profile.network.mode}`,
|
|
274
|
+
` enforcedByCW=${profile.enforcement.enforcedByCW.join("; ")}`,
|
|
275
|
+
` hostRequired=${profile.enforcement.hostRequired.join("; ")}`
|
|
276
|
+
].join("\n"));
|
|
277
|
+
}
|
|
278
|
+
function renderCandidates(summary) {
|
|
279
|
+
if (!summary.total)
|
|
280
|
+
return ["No candidates yet."];
|
|
281
|
+
return [
|
|
282
|
+
`- Total: ${summary.total}`,
|
|
283
|
+
`- By status: ${formatCounts(summary.byStatus)}`,
|
|
284
|
+
`- By kind: ${formatCounts(summary.byKind)}`,
|
|
285
|
+
`- Selections: ${summary.selections}`,
|
|
286
|
+
`- Index: ${summary.indexPath}`,
|
|
287
|
+
`- Ranking: ${summary.rankingPath}`
|
|
288
|
+
];
|
|
289
|
+
}
|
|
290
|
+
function renderTrustAudit(run) {
|
|
291
|
+
const summary = (0, trust_audit_1.summarizeTrustAudit)(run);
|
|
292
|
+
return [
|
|
293
|
+
`- Events: ${summary.eventCount}`,
|
|
294
|
+
`- Decisions: ${formatCounts(summary.byDecision)}`,
|
|
295
|
+
`- Sources: ${formatCounts(summary.bySource)}`,
|
|
296
|
+
`- Sandbox profiles: ${formatCounts(summary.bySandboxProfile)}`,
|
|
297
|
+
`- Event log: ${summary.eventLogPath}`,
|
|
298
|
+
`- Summary: ${summary.summaryPath}`,
|
|
299
|
+
`- Index: ${summary.indexPath}`,
|
|
300
|
+
...renderTelemetryAttestation(run)
|
|
301
|
+
];
|
|
302
|
+
}
|
|
303
|
+
/** Track 1: telemetry attestation coverage + a LOUD list of any `unattested`
|
|
304
|
+
* usage. An auditable control-plane never lets unverified telemetry pass
|
|
305
|
+
* silently — every reported-but-unverified usage is named here with its reason. */
|
|
306
|
+
function renderTelemetryAttestation(run) {
|
|
307
|
+
const delegations = (0, trust_audit_1.listTrustAuditEvents)(run).filter((event) => event.kind === "worker.agent-delegation" && event.metadata && event.metadata.telemetryAttestation);
|
|
308
|
+
if (!delegations.length)
|
|
309
|
+
return [];
|
|
310
|
+
const statusOf = (event) => String(event.metadata.telemetryAttestation);
|
|
311
|
+
const attested = delegations.filter((event) => statusOf(event) === "attested").length;
|
|
312
|
+
const unattested = delegations.filter((event) => statusOf(event) === "unattested");
|
|
313
|
+
const absent = delegations.filter((event) => statusOf(event) === "absent").length;
|
|
314
|
+
const lines = [
|
|
315
|
+
`- Telemetry attestation: ${attested}/${delegations.length} attested` +
|
|
316
|
+
(unattested.length ? `, ${unattested.length} UNATTESTED` : "") +
|
|
317
|
+
(absent ? `, ${absent} absent` : "")
|
|
318
|
+
];
|
|
319
|
+
for (const event of unattested) {
|
|
320
|
+
const reason = event.metadata.telemetryAttestationReason;
|
|
321
|
+
lines.push(` - ⚠️ UNATTESTED usage — worker=${event.workerId || "?"} task=${event.taskId || "?"}: ${reason || "signature unverified"}`);
|
|
322
|
+
}
|
|
323
|
+
// Tamper-evidence: re-prove the hash-chained ledger. A broken chain means a
|
|
324
|
+
// recorded verdict/usage was edited after the fact — surfaced LOUDLY.
|
|
325
|
+
const ledger = (0, telemetry_ledger_1.verifyTelemetryLedger)(run);
|
|
326
|
+
if (ledger.present) {
|
|
327
|
+
lines.push(ledger.verified
|
|
328
|
+
? `- Attestation ledger: ${ledger.records.length} records, chain verified (tamper-evident)`
|
|
329
|
+
: ` - ⚠️ ATTESTATION LEDGER CHAIN BROKEN — a recorded verdict/usage was edited after the fact (${ledger.checks.filter((c) => !c.pass).map((c) => c.name).join(", ")})`);
|
|
330
|
+
}
|
|
331
|
+
return lines;
|
|
332
|
+
}
|
|
333
|
+
function renderAcceptanceRationale(run) {
|
|
334
|
+
const lines = [];
|
|
335
|
+
for (const selection of run.candidateSelections || []) {
|
|
336
|
+
const rationale = selection.acceptanceRationale;
|
|
337
|
+
if (!rationale)
|
|
338
|
+
continue;
|
|
339
|
+
lines.push(`- Selection ${selection.id}: candidate=${rationale.selectedCandidateId || selection.candidateId}, score=${rationale.scoreId || "none"}, verifier=${rationale.verifierNodeId || "none"}, evidence=${rationale.evidenceCount}, sandbox=${rationale.sandboxProfileId || "none"}, worker=${rationale.workerId || "none"}`);
|
|
340
|
+
}
|
|
341
|
+
for (const commit of run.commits || []) {
|
|
342
|
+
if (!commit.acceptanceRationale)
|
|
343
|
+
continue;
|
|
344
|
+
const rationale = commit.acceptanceRationale;
|
|
345
|
+
lines.push(`- Commit ${commit.id}: gate=${rationale.commitGateResult || "unknown"}, candidate=${rationale.selectedCandidateId || commit.candidateId || "none"}, score=${rationale.scoreId || "none"}, verifier=${rationale.verifierNodeId || commit.verifierNodeId || "none"}, evidence=${rationale.evidenceCount}, sandbox=${rationale.sandboxProfileId || "none"}, worker=${rationale.workerId || "none"}`);
|
|
346
|
+
}
|
|
347
|
+
return lines.length ? lines : ["No accepted candidate or verifier-gated commit rationale yet."];
|
|
348
|
+
}
|
|
349
|
+
function formatCommitGate(commit) {
|
|
350
|
+
return [
|
|
351
|
+
`verifier=${commit.verifierNodeId || "unknown"}`,
|
|
352
|
+
commit.candidateId ? `candidate=${commit.candidateId}` : "",
|
|
353
|
+
commit.selectionId ? `selection=${commit.selectionId}` : "",
|
|
354
|
+
`evidence=${commit.evidence?.length || 0}`
|
|
355
|
+
]
|
|
356
|
+
.filter(Boolean)
|
|
357
|
+
.join(", ");
|
|
358
|
+
}
|
|
359
|
+
function formatCounts(counts) {
|
|
360
|
+
const entries = Object.entries(counts).sort(([left], [right]) => left.localeCompare(right));
|
|
361
|
+
if (!entries.length)
|
|
362
|
+
return "none";
|
|
363
|
+
return entries.map(([key, value]) => `${key}=${value}`).join(", ");
|
|
364
|
+
}
|
|
365
|
+
function formatInputList(value) {
|
|
366
|
+
if (Array.isArray(value))
|
|
367
|
+
return value.join("; ");
|
|
368
|
+
return value ? String(value) : "";
|
|
369
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.listTopologies = listTopologies;
|
|
37
|
+
exports.showTopology = showTopology;
|
|
38
|
+
exports.validateTopology = validateTopology;
|
|
39
|
+
exports.applyTopology = applyTopology;
|
|
40
|
+
exports.showTopologyRun = showTopologyRun;
|
|
41
|
+
exports.topologySummary = topologySummary;
|
|
42
|
+
exports.topologyGraph = topologyGraph;
|
|
43
|
+
const state_1 = require("../state");
|
|
44
|
+
const report_1 = require("./report");
|
|
45
|
+
const cli_options_1 = require("./cli-options");
|
|
46
|
+
const topo = __importStar(require("../topology"));
|
|
47
|
+
function listTopologies() {
|
|
48
|
+
return topo.listTopologyDefinitions();
|
|
49
|
+
}
|
|
50
|
+
function showTopology(topologyId) {
|
|
51
|
+
const definition = topo.getTopologyDefinition(topologyId);
|
|
52
|
+
if (!definition)
|
|
53
|
+
throw new Error(`Unknown topology id: ${topologyId}`);
|
|
54
|
+
return definition;
|
|
55
|
+
}
|
|
56
|
+
function validateTopology(topologyId) {
|
|
57
|
+
return topo.validateTopologyDefinition(topologyId);
|
|
58
|
+
}
|
|
59
|
+
function applyTopology(run, topologyId, options = {}) {
|
|
60
|
+
const record = topo.applyTopology(run, topologyId, {
|
|
61
|
+
id: (0, cli_options_1.stringOption)(options.id),
|
|
62
|
+
title: (0, cli_options_1.stringOption)(options.title),
|
|
63
|
+
multiAgentRunId: (0, cli_options_1.stringOption)(options.multiAgentRun || options.multiAgentRunId || options["multi-agent-run"]),
|
|
64
|
+
blackboardId: (0, cli_options_1.stringOption)(options.blackboard || options.blackboardId),
|
|
65
|
+
taskIds: (0, cli_options_1.arrayOption)(options.task || options.taskId || options.tasks).map(String),
|
|
66
|
+
mapperCount: (0, cli_options_1.numberOption)(options.mapperCount || options["mapper-count"] || options.mappers || options.mapper),
|
|
67
|
+
judgeCount: (0, cli_options_1.numberOption)(options.judgeCount || options["judge-count"] || options.judges || options.judge),
|
|
68
|
+
debateRounds: (0, cli_options_1.numberOption)(options.debateRounds || options["debate-rounds"] || options.rounds),
|
|
69
|
+
collectInitialFanin: Boolean(options.collectInitialFanin || options["collect-initial-fanin"]),
|
|
70
|
+
metadata: (0, cli_options_1.metadataOption)(options)
|
|
71
|
+
});
|
|
72
|
+
(0, report_1.writeReport)(run);
|
|
73
|
+
(0, state_1.saveCheckpoint)(run);
|
|
74
|
+
return record;
|
|
75
|
+
}
|
|
76
|
+
function showTopologyRun(run, topologyRunId) {
|
|
77
|
+
return topo.showTopologyRun(run, topologyRunId);
|
|
78
|
+
}
|
|
79
|
+
function topologySummary(run) {
|
|
80
|
+
return topo.summarizeTopologies(run);
|
|
81
|
+
}
|
|
82
|
+
function topologyGraph(run) {
|
|
83
|
+
return topo.buildTopologyGraph(run);
|
|
84
|
+
}
|