cool-workflow 0.1.98 → 0.2.1
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 +18 -7
- package/apps/architecture-review/app.json +2 -2
- package/apps/architecture-review/workflow.js +12 -12
- 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 +3518 -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/shell/doctor.js +292 -0
- package/dist/shell/drive.js +885 -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 +507 -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 +100 -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 +344 -0
- package/dist/{remote-source.js → shell/remote-source.js} +2 -2
- 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} +257 -48
- package/dist/shell/scheduling-io.js +321 -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 +472 -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 +258 -0
- package/dist/shell/workbench-text.js +18 -0
- package/dist/shell/workbench.js +170 -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 +282 -219
- package/docs/contract-migration-tooling.7.md +4 -0
- package/docs/control-plane-scheduling.7.md +4 -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/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 +6 -1
- package/docs/project-index.md +137 -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/remote-source-review.7.md +4 -4
- package/docs/report-verifiable-bundle.7.md +1 -1
- package/docs/run-registry-control-plane.7.md +4 -0
- package/docs/run-retention-reclamation.7.md +25 -0
- package/docs/security-trust-hardening.7.md +3 -1
- package/docs/state-explosion-management.7.md +4 -0
- package/docs/team-collaboration.7.md +4 -0
- package/docs/web-desktop-workbench.7.md +15 -1
- package/manifest/plugin.manifest.json +1 -1
- package/manifest/source-context-profiles.json +9 -13
- package/package.json +1 -1
- package/scripts/agents/agent-adapter-core.js +22 -2
- package/scripts/agents/claude-p-agent.js +8 -3
- package/scripts/agents/cw-attest-wrap.js +2 -2
- package/scripts/agents/gemini-agent.js +5 -1
- package/scripts/agents/opencode-agent.js +5 -1
- package/scripts/bump-version.js +4 -3
- package/scripts/canonical-apps.js +4 -4
- 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 +2 -2
- 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 -1189
- package/dist/capability-registry.js +0 -885
- package/dist/cli/command-surface.js +0 -494
- 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/ledger.js +0 -169
- 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/doctor.js +0 -212
- package/dist/drive.js +0 -864
- package/dist/error-feedback.js +0 -419
- package/dist/evidence-grounding.js +0 -184
- package/dist/execution-backend/agent.js +0 -354
- 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/ledger.js +0 -313
- package/dist/loop-expansion.js +0 -60
- package/dist/mcp/tool-call.js +0 -470
- package/dist/mcp/tool-definitions.js +0 -1066
- 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 -650
- 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 -925
- 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 -815
- 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 -192
- 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
package/dist/operator-ux.js
DELETED
|
@@ -1,631 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.formatMultiAgentTrustAudit = exports.formatTopologySummary = exports.formatMultiAgentSummary = exports.formatCommitSummary = exports.formatFeedbackSummary = exports.formatCandidateSummary = exports.formatWorkerSummary = exports.formatOperatorGraph = exports.formatOperatorReport = exports.formatOperatorSummary = exports.formatOperatorStatus = void 0;
|
|
7
|
-
exports.summarizeOperatorRun = summarizeOperatorRun;
|
|
8
|
-
exports.adviseNoRun = adviseNoRun;
|
|
9
|
-
exports.summarizeOperatorWorkers = summarizeOperatorWorkers;
|
|
10
|
-
exports.summarizeOperatorCandidates = summarizeOperatorCandidates;
|
|
11
|
-
exports.summarizeOperatorFeedback = summarizeOperatorFeedback;
|
|
12
|
-
exports.summarizeOperatorCommits = summarizeOperatorCommits;
|
|
13
|
-
exports.buildOperatorGraph = buildOperatorGraph;
|
|
14
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
15
|
-
const trust_audit_1 = require("./trust-audit");
|
|
16
|
-
const multi_agent_trust_1 = require("./multi-agent-trust");
|
|
17
|
-
const multi_agent_1 = require("./multi-agent");
|
|
18
|
-
const coordinator_1 = require("./coordinator");
|
|
19
|
-
const topology_1 = require("./topology");
|
|
20
|
-
const multi_agent_operator_ux_1 = require("./multi-agent-operator-ux");
|
|
21
|
-
function summarizeOperatorRun(run) {
|
|
22
|
-
const tasks = summarizeTasks(run.tasks || []);
|
|
23
|
-
const phases = summarizePhases(run);
|
|
24
|
-
const workers = summarizeOperatorWorkers(run);
|
|
25
|
-
const candidates = summarizeOperatorCandidates(run);
|
|
26
|
-
const feedback = summarizeOperatorFeedback(run);
|
|
27
|
-
const commits = summarizeOperatorCommits(run);
|
|
28
|
-
const topologies = (0, topology_1.summarizeTopologies)(run);
|
|
29
|
-
const multiAgent = (0, multi_agent_1.summarizeMultiAgent)(run);
|
|
30
|
-
const multiAgentOperator = (0, multi_agent_operator_ux_1.summarizeMultiAgentOperator)(run);
|
|
31
|
-
const blackboard = (0, coordinator_1.summarizeBlackboard)(run);
|
|
32
|
-
const trust = (0, trust_audit_1.summarizeTrustAudit)(run);
|
|
33
|
-
const multiAgentTrust = (0, multi_agent_trust_1.summarizeMultiAgentTrust)(run);
|
|
34
|
-
const activePhase = phases.find((phase) => phase.status === "running") || phases.find((phase) => phase.status === "pending");
|
|
35
|
-
const blockedReasons = blockedReasonsFor(run, feedback, workers, candidates, topologies, multiAgent, blackboard);
|
|
36
|
-
return {
|
|
37
|
-
runId: run.id,
|
|
38
|
-
workflowId: run.workflow.id,
|
|
39
|
-
workflowTitle: run.workflow.title,
|
|
40
|
-
appId: run.workflow.app?.id,
|
|
41
|
-
appVersion: run.workflow.app?.version,
|
|
42
|
-
loopStage: run.loopStage,
|
|
43
|
-
activePhase: activePhase?.name,
|
|
44
|
-
blocked: blockedReasons.length > 0,
|
|
45
|
-
blockedReasons,
|
|
46
|
-
phases,
|
|
47
|
-
tasks,
|
|
48
|
-
workers,
|
|
49
|
-
candidates,
|
|
50
|
-
feedback,
|
|
51
|
-
commits,
|
|
52
|
-
topologies,
|
|
53
|
-
multiAgent,
|
|
54
|
-
multiAgentOperator,
|
|
55
|
-
blackboard,
|
|
56
|
-
trust,
|
|
57
|
-
multiAgentTrust,
|
|
58
|
-
reportPath: run.paths.report,
|
|
59
|
-
evidencePaths: evidencePathsFor(run),
|
|
60
|
-
nextActions: adviseNextSteps(run, { tasks, workers, candidates, feedback, commits, topologies, blackboard })
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
function adviseNoRun() {
|
|
64
|
-
return [
|
|
65
|
-
{
|
|
66
|
-
command: "node scripts/cw.js plan <workflow-id> --repo <path>",
|
|
67
|
-
reason: "No run id is available yet; create a workflow run before dispatching or recording evidence.",
|
|
68
|
-
priority: "high"
|
|
69
|
-
}
|
|
70
|
-
];
|
|
71
|
-
}
|
|
72
|
-
function summarizeOperatorWorkers(run) {
|
|
73
|
-
const workers = sortedWorkers(run.workers || []);
|
|
74
|
-
return {
|
|
75
|
-
total: workers.length,
|
|
76
|
-
byStatus: countByKnown(workers, (worker) => worker.status, ["allocated", "running", "completed", "failed", "rejected", "verified"]),
|
|
77
|
-
bySandboxProfile: countBy(workers, (worker) => worker.sandboxProfileId || "none"),
|
|
78
|
-
byBackend: countBy(workers, (worker) => worker.backendId || "none"),
|
|
79
|
-
manifestPaths: workers.map(workerManifestPath),
|
|
80
|
-
resultPaths: workers.map((worker) => worker.output?.resultPath || worker.resultPath).filter(Boolean),
|
|
81
|
-
failed: workers
|
|
82
|
-
.filter((worker) => worker.status === "failed" || worker.status === "rejected")
|
|
83
|
-
.map((worker) => ({
|
|
84
|
-
id: worker.id,
|
|
85
|
-
status: worker.status,
|
|
86
|
-
taskId: worker.taskId,
|
|
87
|
-
feedbackIds: worker.feedbackIds || [],
|
|
88
|
-
errors: (worker.errors || []).map((error) => error.message)
|
|
89
|
-
})),
|
|
90
|
-
workers: workers.map((worker) => ({
|
|
91
|
-
id: worker.id,
|
|
92
|
-
taskId: worker.taskId,
|
|
93
|
-
status: worker.status,
|
|
94
|
-
sandboxProfileId: worker.sandboxProfileId,
|
|
95
|
-
backendId: worker.backendId,
|
|
96
|
-
backendAttestationStatus: worker.backendAttestation?.status,
|
|
97
|
-
manifestPath: workerManifestPath(worker),
|
|
98
|
-
resultPath: worker.output?.resultPath || worker.resultPath,
|
|
99
|
-
feedbackIds: worker.feedbackIds || []
|
|
100
|
-
}))
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
function summarizeOperatorCandidates(run) {
|
|
104
|
-
const candidates = [...(run.candidates || [])].sort((left, right) => left.id.localeCompare(right.id));
|
|
105
|
-
const selections = [...(run.candidateSelections || [])].sort((left, right) => left.id.localeCompare(right.id));
|
|
106
|
-
const selectedIds = new Set(selections.map((selection) => selection.candidateId));
|
|
107
|
-
const latestRankingPath = run.paths.candidatesDir ? node_path_1.default.join(run.paths.candidatesDir, "ranking.json") : undefined;
|
|
108
|
-
const readyForCommit = selections
|
|
109
|
-
.filter((selection) => {
|
|
110
|
-
const candidate = candidates.find((item) => item.id === selection.candidateId);
|
|
111
|
-
if (!candidate || candidate.status !== "verified" || !selection.scoreId)
|
|
112
|
-
return false;
|
|
113
|
-
return !(run.commits || []).some((commit) => commit.verifierGated && commit.selectionId === selection.id);
|
|
114
|
-
})
|
|
115
|
-
.map((selection) => ({
|
|
116
|
-
candidateId: selection.candidateId,
|
|
117
|
-
selectionId: selection.id,
|
|
118
|
-
scoreId: selection.scoreId,
|
|
119
|
-
verifierNodeId: selection.verifierNodeId
|
|
120
|
-
}));
|
|
121
|
-
return {
|
|
122
|
-
total: candidates.length,
|
|
123
|
-
byStatus: countBy(candidates, (candidate) => candidate.status),
|
|
124
|
-
byKind: countBy(candidates, (candidate) => candidate.kind),
|
|
125
|
-
latestRankingPath,
|
|
126
|
-
selected: selections.map((selection) => ({
|
|
127
|
-
selectionId: selection.id,
|
|
128
|
-
candidateId: selection.candidateId,
|
|
129
|
-
scoreId: selection.scoreId,
|
|
130
|
-
verifierNodeId: selection.verifierNodeId
|
|
131
|
-
})),
|
|
132
|
-
readyForCommit,
|
|
133
|
-
problems: candidateProblems(candidates, selections),
|
|
134
|
-
candidates: candidates.map((candidate) => ({
|
|
135
|
-
id: candidate.id,
|
|
136
|
-
kind: candidate.kind,
|
|
137
|
-
status: candidate.status,
|
|
138
|
-
scoreCount: candidate.scores.length,
|
|
139
|
-
selected: selectedIds.has(candidate.id),
|
|
140
|
-
feedbackIds: candidate.feedbackIds || [],
|
|
141
|
-
resultPath: candidate.resultPath
|
|
142
|
-
}))
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
function summarizeOperatorFeedback(run) {
|
|
146
|
-
const feedback = [...(run.feedback || [])].sort((left, right) => left.id.localeCompare(right.id));
|
|
147
|
-
const open = feedback.filter((record) => record.status === "open" || record.status === "tasked");
|
|
148
|
-
return {
|
|
149
|
-
total: feedback.length,
|
|
150
|
-
byStatus: countByKnown(feedback, (record) => record.status, ["open", "tasked", "resolved", "rejected"]),
|
|
151
|
-
bySeverity: countByKnown(feedback, (record) => record.severity, ["critical", "high", "medium", "low", "info"]),
|
|
152
|
-
byClassification: countByKnown(feedback, (record) => record.classification, [
|
|
153
|
-
"contract-violation",
|
|
154
|
-
"verifier-failure",
|
|
155
|
-
"state-transition",
|
|
156
|
-
"missing-artifact",
|
|
157
|
-
"missing-evidence",
|
|
158
|
-
"parse-error",
|
|
159
|
-
"pipeline-failure",
|
|
160
|
-
"sandbox-policy",
|
|
161
|
-
"runtime-error",
|
|
162
|
-
"unknown"
|
|
163
|
-
]),
|
|
164
|
-
retryable: feedback.filter((record) => record.retryable).length,
|
|
165
|
-
nonRetryable: feedback.filter((record) => !record.retryable).length,
|
|
166
|
-
open: open.map((record) => ({
|
|
167
|
-
id: record.id,
|
|
168
|
-
severity: record.severity,
|
|
169
|
-
classification: record.classification,
|
|
170
|
-
retryable: record.retryable,
|
|
171
|
-
message: record.message,
|
|
172
|
-
taskId: record.taskId,
|
|
173
|
-
nodeId: record.nodeId
|
|
174
|
-
}))
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
function summarizeOperatorCommits(run) {
|
|
178
|
-
const commits = [...(run.commits || [])].sort((left, right) => left.createdAt.localeCompare(right.createdAt) || left.id.localeCompare(right.id));
|
|
179
|
-
const rows = commits.map(formatCommitRow);
|
|
180
|
-
return {
|
|
181
|
-
total: rows.length,
|
|
182
|
-
verifierGated: rows.filter((commit) => commit.kind === "verifier-gated").length,
|
|
183
|
-
checkpoints: rows.filter((commit) => commit.kind === "checkpoint").length,
|
|
184
|
-
latest: rows.at(-1),
|
|
185
|
-
commits: rows
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
function buildOperatorGraph(run) {
|
|
189
|
-
const nodes = new Map();
|
|
190
|
-
const edges = [];
|
|
191
|
-
const addNode = (id, kind, status, label, pathValue) => {
|
|
192
|
-
nodes.set(id, { id, kind, status, label, path: pathValue });
|
|
193
|
-
};
|
|
194
|
-
const addEdge = (from, to, label) => {
|
|
195
|
-
if (!from || !to)
|
|
196
|
-
return;
|
|
197
|
-
edges.push({ from, to, label });
|
|
198
|
-
};
|
|
199
|
-
addNode(`${run.id}:run`, "run", run.loopStage, run.id, run.paths.state);
|
|
200
|
-
for (const phase of run.phases || []) {
|
|
201
|
-
const status = phaseStatusFromTasks(run, phase.taskIds);
|
|
202
|
-
const phaseId = `${run.id}:phase:${safeId(phase.id)}`;
|
|
203
|
-
addNode(phaseId, "phase", status, phase.name);
|
|
204
|
-
addEdge(`${run.id}:run`, phaseId);
|
|
205
|
-
for (const taskId of phase.taskIds)
|
|
206
|
-
addEdge(phaseId, `${run.id}:task:${taskId}`);
|
|
207
|
-
}
|
|
208
|
-
for (const task of run.tasks || []) {
|
|
209
|
-
addNode(`${run.id}:task:${task.id}`, "task", task.status, task.id, task.taskPath);
|
|
210
|
-
addEdge(`${run.id}:task:${task.id}`, task.dispatchId ? `${run.id}:dispatch:${task.dispatchId}` : undefined);
|
|
211
|
-
addEdge(`${run.id}:task:${task.id}`, task.resultNodeId);
|
|
212
|
-
addEdge(`${run.id}:task:${task.id}`, task.verifierNodeId);
|
|
213
|
-
}
|
|
214
|
-
for (const dispatch of run.dispatches || []) {
|
|
215
|
-
addNode(`${run.id}:dispatch:${dispatch.id}`, "dispatch", "completed", dispatch.id, dispatch.manifestPath);
|
|
216
|
-
for (const workerId of dispatch.workerIds || [])
|
|
217
|
-
addEdge(`${run.id}:dispatch:${dispatch.id}`, `${run.id}:worker:${workerId}`);
|
|
218
|
-
}
|
|
219
|
-
for (const worker of run.workers || []) {
|
|
220
|
-
addNode(`${run.id}:worker:${worker.id}`, "worker", worker.status, worker.id, workerManifestPath(worker));
|
|
221
|
-
addEdge(`${run.id}:worker:${worker.id}`, worker.resultNodeId);
|
|
222
|
-
for (const feedbackId of worker.feedbackIds || [])
|
|
223
|
-
addEdge(`${run.id}:worker:${worker.id}`, `${run.id}:feedback:${feedbackId}`);
|
|
224
|
-
}
|
|
225
|
-
for (const node of run.nodes || []) {
|
|
226
|
-
addNode(node.id, node.kind, operatorNodeStatus(run, node), shortNodeLabel(node), node.artifacts[0]?.path);
|
|
227
|
-
for (const parent of node.parents || [])
|
|
228
|
-
addEdge(parent, node.id);
|
|
229
|
-
}
|
|
230
|
-
for (const candidate of run.candidates || []) {
|
|
231
|
-
addNode(`${run.id}:candidate:${candidate.id}`, "candidate", candidate.status, candidate.id, candidate.resultPath);
|
|
232
|
-
addEdge(candidate.resultNodeId, `${run.id}:candidate:${candidate.id}`);
|
|
233
|
-
addEdge(candidate.verifierNodeId, `${run.id}:candidate:${candidate.id}`, "gate");
|
|
234
|
-
for (const feedbackId of candidate.feedbackIds || [])
|
|
235
|
-
addEdge(`${run.id}:candidate:${candidate.id}`, `${run.id}:feedback:${feedbackId}`);
|
|
236
|
-
}
|
|
237
|
-
for (const selection of run.candidateSelections || []) {
|
|
238
|
-
addNode(`${run.id}:selection:${selection.id}`, "selection", "verified", selection.id, selection.rankingPath);
|
|
239
|
-
addEdge(`${run.id}:candidate:${selection.candidateId}`, `${run.id}:selection:${selection.id}`);
|
|
240
|
-
addEdge(selection.verifierNodeId, `${run.id}:selection:${selection.id}`, "verifier");
|
|
241
|
-
}
|
|
242
|
-
for (const commit of run.commits || []) {
|
|
243
|
-
const commitNodeId = commit.stateNodeId || `${run.id}:commit:${commit.id}`;
|
|
244
|
-
addNode(commitNodeId, "commit", commit.verifierGated ? "committed" : "completed", commit.id, commit.snapshotPath);
|
|
245
|
-
addEdge(commit.verifierNodeId, commitNodeId, "verifier");
|
|
246
|
-
addEdge(commit.selectionId ? `${run.id}:selection:${commit.selectionId}` : undefined, commitNodeId, "selection");
|
|
247
|
-
}
|
|
248
|
-
for (const feedback of run.feedback || []) {
|
|
249
|
-
addNode(`${run.id}:feedback:${feedback.id}`, "feedback", feedback.status, `${feedback.severity} ${feedback.classification}`);
|
|
250
|
-
addEdge(feedback.nodeId, `${run.id}:feedback:${feedback.id}`);
|
|
251
|
-
addEdge(feedback.taskId ? `${run.id}:task:${feedback.taskId}` : undefined, `${run.id}:feedback:${feedback.id}`);
|
|
252
|
-
}
|
|
253
|
-
const multiAgentGraph = (0, multi_agent_1.buildMultiAgentGraph)(run);
|
|
254
|
-
for (const node of multiAgentGraph.nodes)
|
|
255
|
-
addNode(node.id, node.kind, node.status, node.label, node.path);
|
|
256
|
-
for (const edge of multiAgentGraph.edges)
|
|
257
|
-
addEdge(edge.from, edge.to, edge.label);
|
|
258
|
-
const topologyGraph = (0, topology_1.buildTopologyGraph)(run);
|
|
259
|
-
for (const node of topologyGraph.nodes)
|
|
260
|
-
addNode(node.id, node.kind, node.status, node.label, node.path);
|
|
261
|
-
for (const edge of topologyGraph.edges)
|
|
262
|
-
addEdge(edge.from, edge.to, edge.label);
|
|
263
|
-
const blackboardGraph = (0, coordinator_1.buildBlackboardGraph)(run);
|
|
264
|
-
for (const node of blackboardGraph.nodes)
|
|
265
|
-
addNode(node.id, node.kind, node.status, node.label, node.path);
|
|
266
|
-
for (const edge of blackboardGraph.edges)
|
|
267
|
-
addEdge(edge.from, edge.to, edge.label);
|
|
268
|
-
return {
|
|
269
|
-
runId: run.id,
|
|
270
|
-
nodes: [...nodes.values()].sort(compareGraphNodes),
|
|
271
|
-
edges: uniqueEdges(edges).sort(compareEdges)
|
|
272
|
-
};
|
|
273
|
-
}
|
|
274
|
-
// Human formatting (CLI-only) for the operator status / report / graph surfaces
|
|
275
|
-
// plus the worker/candidate/feedback/commit/trust/topology/multi-agent panels now
|
|
276
|
-
// lives in ./operator-ux/format.ts (FreeBSD-audit R-series, run-registry/format.ts
|
|
277
|
-
// template). Re-exported below so importers of "./operator-ux" see an unchanged
|
|
278
|
-
// surface. The pure data summarizers and the run-graph builder stay here.
|
|
279
|
-
function adviseNextSteps(run, summary) {
|
|
280
|
-
const actions = [];
|
|
281
|
-
if (summary.feedback.open.length) {
|
|
282
|
-
const feedback = summary.feedback.open[0];
|
|
283
|
-
actions.push({
|
|
284
|
-
command: `node scripts/cw.js feedback show ${run.id} ${feedback.id}`,
|
|
285
|
-
reason: `Open ${feedback.severity} ${feedback.classification} feedback should be inspected before more dispatch.`,
|
|
286
|
-
priority: "high"
|
|
287
|
-
});
|
|
288
|
-
actions.push({
|
|
289
|
-
command: `node scripts/cw.js feedback task ${run.id} ${feedback.id}`,
|
|
290
|
-
reason: "Create a correction task if the feedback is actionable.",
|
|
291
|
-
priority: "normal"
|
|
292
|
-
});
|
|
293
|
-
return actions;
|
|
294
|
-
}
|
|
295
|
-
const failedWorker = summary.workers.failed[0];
|
|
296
|
-
if (failedWorker) {
|
|
297
|
-
actions.push({
|
|
298
|
-
command: `node scripts/cw.js feedback list ${run.id}`,
|
|
299
|
-
reason: `Worker ${failedWorker.id} is ${failedWorker.status}; inspect linked feedback before retrying.`,
|
|
300
|
-
priority: "high"
|
|
301
|
-
});
|
|
302
|
-
return actions;
|
|
303
|
-
}
|
|
304
|
-
if (summary.tasks.running.length) {
|
|
305
|
-
const worker = summary.workers.workers.find((item) => item.status === "running" || item.status === "allocated");
|
|
306
|
-
actions.push({
|
|
307
|
-
command: worker ? `node scripts/cw.js worker manifest ${run.id} ${worker.id}` : `node scripts/cw.js worker list ${run.id}`,
|
|
308
|
-
reason: "Running workers need their manifests inspected and final output recorded.",
|
|
309
|
-
priority: "high"
|
|
310
|
-
});
|
|
311
|
-
if (worker) {
|
|
312
|
-
actions.push({
|
|
313
|
-
command: `node scripts/cw.js worker output ${run.id} ${worker.id} ${worker.resultPath}`,
|
|
314
|
-
reason: "Record the worker result after its result.md is ready.",
|
|
315
|
-
priority: "normal"
|
|
316
|
-
});
|
|
317
|
-
}
|
|
318
|
-
return actions;
|
|
319
|
-
}
|
|
320
|
-
const activeTopology = summary.topologies.active[0];
|
|
321
|
-
if (activeTopology && activeTopology.status !== "completed" && activeTopology.status !== "failed") {
|
|
322
|
-
actions.push({
|
|
323
|
-
command: `node scripts/cw.js multi-agent status ${run.id}`,
|
|
324
|
-
reason: "Use the high-level multi-agent host surface for topology-backed work.",
|
|
325
|
-
priority: "high"
|
|
326
|
-
});
|
|
327
|
-
actions.push({
|
|
328
|
-
command: `node scripts/cw.js multi-agent step ${run.id}`,
|
|
329
|
-
reason: "Perform the next safe host step without spawning agents implicitly.",
|
|
330
|
-
priority: "normal"
|
|
331
|
-
});
|
|
332
|
-
return actions;
|
|
333
|
-
}
|
|
334
|
-
if (summary.tasks.pending.length) {
|
|
335
|
-
const limit = Math.min(summary.tasks.pending.length, run.workflow.limits.maxConcurrentAgents || 4);
|
|
336
|
-
actions.push({
|
|
337
|
-
command: `node scripts/cw.js dispatch ${run.id} --limit ${limit}`,
|
|
338
|
-
reason: `${summary.tasks.pending.length} pending task(s) are ready for the active phase.`,
|
|
339
|
-
priority: "high"
|
|
340
|
-
});
|
|
341
|
-
return actions;
|
|
342
|
-
}
|
|
343
|
-
if (summary.blackboard.blackboardId && summary.blackboard.nextAction && !summary.blackboard.readyForFanin) {
|
|
344
|
-
actions.push({
|
|
345
|
-
command: summary.blackboard.nextAction,
|
|
346
|
-
reason: "Blackboard shared context is not ready for fanin yet.",
|
|
347
|
-
priority: "high"
|
|
348
|
-
});
|
|
349
|
-
return actions;
|
|
350
|
-
}
|
|
351
|
-
const topologyAction = summary.topologies.active.find((topology) => topology.nextActions.length)?.nextActions[0];
|
|
352
|
-
if (topologyAction) {
|
|
353
|
-
actions.push({
|
|
354
|
-
command: topologyAction,
|
|
355
|
-
reason: "An active topology has a deterministic next action.",
|
|
356
|
-
priority: "high"
|
|
357
|
-
});
|
|
358
|
-
return actions;
|
|
359
|
-
}
|
|
360
|
-
if (summary.tasks.total > 0 && summary.tasks.completed.length === summary.tasks.total && summary.commits.verifierGated > 0) {
|
|
361
|
-
actions.push({
|
|
362
|
-
command: `node scripts/cw.js report ${run.id} --show`,
|
|
363
|
-
reason: "All tracked phases are complete and verifier-gated committed state exists.",
|
|
364
|
-
priority: "normal"
|
|
365
|
-
});
|
|
366
|
-
return actions;
|
|
367
|
-
}
|
|
368
|
-
const completedWithoutCandidate = (run.tasks || []).find((task) => task.status === "completed" && task.workerId && !(run.candidates || []).some((candidate) => candidate.workerId === task.workerId));
|
|
369
|
-
if (completedWithoutCandidate?.workerId) {
|
|
370
|
-
actions.push({
|
|
371
|
-
command: `node scripts/cw.js candidate register ${run.id} --worker ${completedWithoutCandidate.workerId}`,
|
|
372
|
-
reason: "A completed worker result is available but has not been registered as a candidate.",
|
|
373
|
-
priority: "high"
|
|
374
|
-
});
|
|
375
|
-
return actions;
|
|
376
|
-
}
|
|
377
|
-
const unscored = (run.candidates || []).find((candidate) => candidate.status === "registered" && !candidate.scores.length);
|
|
378
|
-
if (unscored) {
|
|
379
|
-
actions.push({
|
|
380
|
-
command: `node scripts/cw.js candidate score ${run.id} ${unscored.id} --criterion correctness=1 --evidence <path-or-locator>`,
|
|
381
|
-
reason: "Registered candidates need score evidence before ranking or selection.",
|
|
382
|
-
priority: "high"
|
|
383
|
-
});
|
|
384
|
-
return actions;
|
|
385
|
-
}
|
|
386
|
-
const scoredWithoutSelection = (run.candidates || []).find((candidate) => candidate.status === "scored" && !(run.candidateSelections || []).some((selection) => selection.candidateId === candidate.id));
|
|
387
|
-
if (scoredWithoutSelection) {
|
|
388
|
-
actions.push({
|
|
389
|
-
command: `node scripts/cw.js candidate rank ${run.id}`,
|
|
390
|
-
reason: "Scored candidates can be ranked before selection.",
|
|
391
|
-
priority: "high"
|
|
392
|
-
});
|
|
393
|
-
actions.push({
|
|
394
|
-
command: `node scripts/cw.js candidate select ${run.id} ${scoredWithoutSelection.id}`,
|
|
395
|
-
reason: "Select the candidate once the ranking supports it.",
|
|
396
|
-
priority: "normal"
|
|
397
|
-
});
|
|
398
|
-
return actions;
|
|
399
|
-
}
|
|
400
|
-
if (summary.candidates.readyForCommit.length) {
|
|
401
|
-
const ready = summary.candidates.readyForCommit[0];
|
|
402
|
-
actions.push({
|
|
403
|
-
command: `node scripts/cw.js commit ${run.id} --selection ${ready.selectionId}`,
|
|
404
|
-
reason: "A verified selected candidate is ready for a verifier-gated commit.",
|
|
405
|
-
priority: "high"
|
|
406
|
-
});
|
|
407
|
-
return actions;
|
|
408
|
-
}
|
|
409
|
-
actions.push({
|
|
410
|
-
command: `node scripts/cw.js report ${run.id} --show`,
|
|
411
|
-
reason: "All tracked phases are complete or no further operator action is currently available.",
|
|
412
|
-
priority: "normal"
|
|
413
|
-
});
|
|
414
|
-
return actions;
|
|
415
|
-
}
|
|
416
|
-
function summarizeTasks(tasks) {
|
|
417
|
-
const byStatus = countByKnown(tasks, (task) => task.status, ["pending", "running", "completed", "failed"]);
|
|
418
|
-
return {
|
|
419
|
-
total: tasks.length,
|
|
420
|
-
byStatus,
|
|
421
|
-
pending: tasks.filter((task) => task.status === "pending").map((task) => task.id).sort(),
|
|
422
|
-
running: tasks.filter((task) => task.status === "running").map((task) => task.id).sort(),
|
|
423
|
-
failed: tasks.filter((task) => task.status === "failed").map((task) => task.id).sort(),
|
|
424
|
-
completed: tasks.filter((task) => task.status === "completed").map((task) => task.id).sort()
|
|
425
|
-
};
|
|
426
|
-
}
|
|
427
|
-
function summarizePhases(run) {
|
|
428
|
-
return (run.phases || []).map((phase) => {
|
|
429
|
-
const tasks = run.tasks.filter((task) => phase.taskIds.includes(task.id));
|
|
430
|
-
return {
|
|
431
|
-
id: phase.id,
|
|
432
|
-
name: phase.name,
|
|
433
|
-
status: phaseStatusFromTasks(run, phase.taskIds),
|
|
434
|
-
tasks: {
|
|
435
|
-
total: tasks.length,
|
|
436
|
-
...countByKnown(tasks, (task) => task.status, ["pending", "running", "completed", "failed"])
|
|
437
|
-
}
|
|
438
|
-
};
|
|
439
|
-
});
|
|
440
|
-
}
|
|
441
|
-
function phaseStatusFromTasks(run, taskIds) {
|
|
442
|
-
const tasks = run.tasks.filter((task) => taskIds.includes(task.id));
|
|
443
|
-
if (!tasks.length)
|
|
444
|
-
return "pending";
|
|
445
|
-
if (tasks.every((task) => task.status === "completed"))
|
|
446
|
-
return "completed";
|
|
447
|
-
if (tasks.some((task) => task.status === "running" || task.status === "completed"))
|
|
448
|
-
return "running";
|
|
449
|
-
if (tasks.some((task) => task.status === "failed"))
|
|
450
|
-
return "blocked";
|
|
451
|
-
return "pending";
|
|
452
|
-
}
|
|
453
|
-
function blockedReasonsFor(run, feedback, workers, candidates, topologies, multiAgent, blackboard) {
|
|
454
|
-
const reasons = [];
|
|
455
|
-
if (feedback.open.length)
|
|
456
|
-
reasons.push(`${feedback.open.length} open/tasked feedback record(s)`);
|
|
457
|
-
if (workers.failed.length)
|
|
458
|
-
reasons.push(`${workers.failed.length} failed/rejected worker(s)`);
|
|
459
|
-
if (run.tasks.some((task) => task.status === "failed"))
|
|
460
|
-
reasons.push("failed task(s)");
|
|
461
|
-
if (candidates.problems.length)
|
|
462
|
-
reasons.push(...candidates.problems.slice(0, 2));
|
|
463
|
-
for (const topology of topologies.active) {
|
|
464
|
-
if (topology.status === "blocked")
|
|
465
|
-
reasons.push(`topology ${topology.id} blocked: ${topology.missingEvidence[0] || "missing evidence"}`);
|
|
466
|
-
}
|
|
467
|
-
if (multiAgent.blockedReasons.length)
|
|
468
|
-
reasons.push(...multiAgent.blockedReasons.slice(0, 2));
|
|
469
|
-
if (blackboard.conflicts.length)
|
|
470
|
-
reasons.push(`${blackboard.conflicts.length} blackboard conflict(s)`);
|
|
471
|
-
if (blackboard.missingEvidence.length)
|
|
472
|
-
reasons.push(...blackboard.missingEvidence.slice(0, 2));
|
|
473
|
-
return reasons;
|
|
474
|
-
}
|
|
475
|
-
function candidateProblems(candidates, selections) {
|
|
476
|
-
const problems = [];
|
|
477
|
-
for (const candidate of candidates) {
|
|
478
|
-
if ((candidate.status === "registered" || candidate.status === "scored") && !candidate.evidence.length) {
|
|
479
|
-
problems.push(`candidate ${candidate.id} has no evidence`);
|
|
480
|
-
}
|
|
481
|
-
if (candidate.status === "registered" && !candidate.scores.length) {
|
|
482
|
-
problems.push(`candidate ${candidate.id} has not been scored`);
|
|
483
|
-
}
|
|
484
|
-
if ((candidate.status === "selected" || candidate.status === "verified") && !selections.some((selection) => selection.candidateId === candidate.id)) {
|
|
485
|
-
problems.push(`candidate ${candidate.id} status is ${candidate.status} but no selection record exists`);
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
return problems.sort();
|
|
489
|
-
}
|
|
490
|
-
function evidencePathsFor(run) {
|
|
491
|
-
const values = new Set();
|
|
492
|
-
for (const task of run.tasks || []) {
|
|
493
|
-
if (task.taskPath)
|
|
494
|
-
values.add(task.taskPath);
|
|
495
|
-
if (task.resultPath)
|
|
496
|
-
values.add(task.resultPath);
|
|
497
|
-
if (task.workerManifestPath)
|
|
498
|
-
values.add(task.workerManifestPath);
|
|
499
|
-
}
|
|
500
|
-
for (const dispatch of run.dispatches || [])
|
|
501
|
-
if (dispatch.manifestPath)
|
|
502
|
-
values.add(dispatch.manifestPath);
|
|
503
|
-
for (const worker of run.workers || []) {
|
|
504
|
-
values.add(workerManifestPath(worker));
|
|
505
|
-
if (worker.output?.resultPath)
|
|
506
|
-
values.add(worker.output.resultPath);
|
|
507
|
-
}
|
|
508
|
-
for (const candidate of run.candidates || []) {
|
|
509
|
-
if (candidate.resultPath)
|
|
510
|
-
values.add(candidate.resultPath);
|
|
511
|
-
for (const artifact of candidate.artifacts || [])
|
|
512
|
-
if (artifact.path)
|
|
513
|
-
values.add(artifact.path);
|
|
514
|
-
}
|
|
515
|
-
for (const commit of run.commits || [])
|
|
516
|
-
values.add(commit.snapshotPath);
|
|
517
|
-
for (const node of run.nodes || []) {
|
|
518
|
-
for (const artifact of node.artifacts || [])
|
|
519
|
-
if (artifact.path)
|
|
520
|
-
values.add(artifact.path);
|
|
521
|
-
for (const evidence of node.evidence || []) {
|
|
522
|
-
if (evidence.path)
|
|
523
|
-
values.add(evidence.path);
|
|
524
|
-
if (evidence.locator)
|
|
525
|
-
values.add(evidence.locator);
|
|
526
|
-
if (!evidence.path && !evidence.locator && evidence.summary)
|
|
527
|
-
values.add(evidence.summary);
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
if (run.paths.report)
|
|
531
|
-
values.add(run.paths.report);
|
|
532
|
-
return [...values].sort();
|
|
533
|
-
}
|
|
534
|
-
function formatCommitRow(commit) {
|
|
535
|
-
return {
|
|
536
|
-
id: commit.id,
|
|
537
|
-
kind: commit.verifierGated ? "verifier-gated" : "checkpoint",
|
|
538
|
-
reason: commit.reason,
|
|
539
|
-
createdAt: commit.createdAt,
|
|
540
|
-
snapshotPath: commit.snapshotPath,
|
|
541
|
-
stateNodeId: commit.stateNodeId,
|
|
542
|
-
verifierNodeId: commit.verifierNodeId,
|
|
543
|
-
candidateId: commit.candidateId,
|
|
544
|
-
selectionId: commit.selectionId,
|
|
545
|
-
evidenceCount: commit.evidence?.length || 0
|
|
546
|
-
};
|
|
547
|
-
}
|
|
548
|
-
function sortedWorkers(workers) {
|
|
549
|
-
return [...workers].sort((left, right) => left.id.localeCompare(right.id));
|
|
550
|
-
}
|
|
551
|
-
function workerManifestPath(worker) {
|
|
552
|
-
return node_path_1.default.join(worker.workerDir, "manifest.json");
|
|
553
|
-
}
|
|
554
|
-
function shortNodeLabel(node) {
|
|
555
|
-
const taskId = typeof node.metadata?.taskId === "string" ? node.metadata.taskId : undefined;
|
|
556
|
-
return taskId || node.id;
|
|
557
|
-
}
|
|
558
|
-
function operatorNodeStatus(run, node) {
|
|
559
|
-
if (node.kind !== "task")
|
|
560
|
-
return node.status;
|
|
561
|
-
const taskId = typeof node.metadata?.taskId === "string" ? node.metadata.taskId : taskIdFromNodeId(node.id);
|
|
562
|
-
return run.tasks.find((task) => task.id === taskId)?.status || node.status;
|
|
563
|
-
}
|
|
564
|
-
function taskIdFromNodeId(nodeId) {
|
|
565
|
-
const marker = ":task:";
|
|
566
|
-
const index = nodeId.indexOf(marker);
|
|
567
|
-
return index >= 0 ? nodeId.slice(index + marker.length) : undefined;
|
|
568
|
-
}
|
|
569
|
-
function compareGraphNodes(left, right) {
|
|
570
|
-
const byKind = left.kind.localeCompare(right.kind);
|
|
571
|
-
if (byKind)
|
|
572
|
-
return byKind;
|
|
573
|
-
return left.id.localeCompare(right.id);
|
|
574
|
-
}
|
|
575
|
-
function compareEdges(left, right) {
|
|
576
|
-
const byFrom = left.from.localeCompare(right.from);
|
|
577
|
-
if (byFrom)
|
|
578
|
-
return byFrom;
|
|
579
|
-
const byTo = left.to.localeCompare(right.to);
|
|
580
|
-
if (byTo)
|
|
581
|
-
return byTo;
|
|
582
|
-
return (left.label || "").localeCompare(right.label || "");
|
|
583
|
-
}
|
|
584
|
-
function uniqueEdges(edges) {
|
|
585
|
-
const seen = new Set();
|
|
586
|
-
const unique = [];
|
|
587
|
-
for (const edge of edges) {
|
|
588
|
-
const key = `${edge.from}\u001f${edge.to}\u001f${edge.label || ""}`;
|
|
589
|
-
if (seen.has(key))
|
|
590
|
-
continue;
|
|
591
|
-
seen.add(key);
|
|
592
|
-
unique.push(edge);
|
|
593
|
-
}
|
|
594
|
-
return unique;
|
|
595
|
-
}
|
|
596
|
-
function countBy(items, getKey) {
|
|
597
|
-
const counts = {};
|
|
598
|
-
for (const item of items) {
|
|
599
|
-
const key = getKey(item);
|
|
600
|
-
counts[key] = (counts[key] || 0) + 1;
|
|
601
|
-
}
|
|
602
|
-
return sortRecord(counts);
|
|
603
|
-
}
|
|
604
|
-
function countByKnown(items, getKey, keys) {
|
|
605
|
-
const counts = Object.fromEntries(keys.map((key) => [key, 0]));
|
|
606
|
-
for (const item of items)
|
|
607
|
-
counts[getKey(item)] += 1;
|
|
608
|
-
return counts;
|
|
609
|
-
}
|
|
610
|
-
function sortRecord(record) {
|
|
611
|
-
return Object.fromEntries(Object.entries(record).sort(([left], [right]) => left.localeCompare(right)));
|
|
612
|
-
}
|
|
613
|
-
function safeId(value) {
|
|
614
|
-
return String(value).replace(/[^a-zA-Z0-9_.:-]+/g, "_");
|
|
615
|
-
}
|
|
616
|
-
// Human formatting (CLI-only) now lives in ./operator-ux/format.ts (FreeBSD-audit
|
|
617
|
-
// R-series: rendering carved out of the operator module, run-registry/format.ts
|
|
618
|
-
// template). Re-exported so that importers of "./operator-ux" see an unchanged
|
|
619
|
-
// surface.
|
|
620
|
-
var format_1 = require("./operator-ux/format");
|
|
621
|
-
Object.defineProperty(exports, "formatOperatorStatus", { enumerable: true, get: function () { return format_1.formatOperatorStatus; } });
|
|
622
|
-
Object.defineProperty(exports, "formatOperatorSummary", { enumerable: true, get: function () { return format_1.formatOperatorSummary; } });
|
|
623
|
-
Object.defineProperty(exports, "formatOperatorReport", { enumerable: true, get: function () { return format_1.formatOperatorReport; } });
|
|
624
|
-
Object.defineProperty(exports, "formatOperatorGraph", { enumerable: true, get: function () { return format_1.formatOperatorGraph; } });
|
|
625
|
-
Object.defineProperty(exports, "formatWorkerSummary", { enumerable: true, get: function () { return format_1.formatWorkerSummary; } });
|
|
626
|
-
Object.defineProperty(exports, "formatCandidateSummary", { enumerable: true, get: function () { return format_1.formatCandidateSummary; } });
|
|
627
|
-
Object.defineProperty(exports, "formatFeedbackSummary", { enumerable: true, get: function () { return format_1.formatFeedbackSummary; } });
|
|
628
|
-
Object.defineProperty(exports, "formatCommitSummary", { enumerable: true, get: function () { return format_1.formatCommitSummary; } });
|
|
629
|
-
Object.defineProperty(exports, "formatMultiAgentSummary", { enumerable: true, get: function () { return format_1.formatMultiAgentSummary; } });
|
|
630
|
-
Object.defineProperty(exports, "formatTopologySummary", { enumerable: true, get: function () { return format_1.formatTopologySummary; } });
|
|
631
|
-
Object.defineProperty(exports, "formatMultiAgentTrustAudit", { enumerable: true, get: function () { return format_1.formatMultiAgentTrustAudit; } });
|