cool-workflow 0.1.80 → 0.1.82
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 +42 -2
- package/apps/architecture-review/app.json +1 -1
- package/apps/architecture-review-fast/app.json +1 -1
- package/apps/end-to-end-golden-path/app.json +1 -1
- package/apps/pr-review-fix-ci/app.json +1 -1
- package/apps/release-cut/app.json +1 -1
- package/apps/research-synthesis/app.json +1 -1
- package/dist/agent-config.js +21 -7
- package/dist/candidate-scoring.js +62 -48
- package/dist/capability-core.js +152 -96
- package/dist/capability-registry.js +160 -174
- package/dist/cli.js +90 -100
- package/dist/collaboration.js +5 -6
- package/dist/commit.js +232 -209
- package/dist/compare.js +18 -0
- package/dist/coordinator/classify.js +45 -0
- package/dist/coordinator/paths.js +42 -0
- package/dist/coordinator/util.js +126 -0
- package/dist/coordinator.js +127 -300
- package/dist/dispatch.js +46 -3
- package/dist/drive.js +7 -7
- package/dist/error-feedback.js +8 -4
- package/dist/evidence-reasoning.js +5 -2
- package/dist/execution-backend/agent.js +294 -0
- package/dist/execution-backend/probes.js +96 -0
- package/dist/execution-backend/util.js +47 -0
- package/dist/execution-backend.js +77 -450
- package/dist/gates.js +48 -0
- package/dist/mcp-server.js +34 -173
- package/dist/multi-agent/graph.js +84 -0
- package/dist/multi-agent/helpers.js +141 -0
- package/dist/multi-agent/ids.js +20 -0
- package/dist/multi-agent/paths.js +22 -0
- package/dist/multi-agent-eval/format.js +194 -0
- package/dist/multi-agent-eval/normalize.js +51 -0
- package/dist/multi-agent-eval.js +63 -242
- package/dist/multi-agent-host.js +53 -40
- package/dist/multi-agent-operator-ux.js +2 -1
- package/dist/multi-agent-trust.js +5 -5
- package/dist/multi-agent.js +125 -314
- package/dist/node-projection.js +59 -0
- package/dist/node-snapshot.js +11 -21
- package/dist/observability/format.js +61 -0
- package/dist/observability/intake.js +98 -0
- package/dist/observability.js +14 -160
- package/dist/operator-ux/format.js +364 -0
- package/dist/operator-ux.js +22 -363
- package/dist/orchestrator/lifecycle-operations.js +22 -1
- package/dist/orchestrator/report.js +8 -0
- package/dist/orchestrator.js +41 -10
- package/dist/reclamation.js +32 -55
- package/dist/run-export.js +138 -14
- package/dist/run-registry/derive.js +172 -0
- package/dist/run-registry/format.js +124 -0
- package/dist/run-registry/gc.js +251 -0
- package/dist/run-registry/policy.js +16 -0
- package/dist/run-registry/queue.js +116 -0
- package/dist/run-registry.js +78 -593
- package/dist/run-state-schema.js +1 -0
- package/dist/sandbox-profile.js +43 -2
- package/dist/scheduler.js +34 -4
- package/dist/state-explosion/format.js +159 -0
- package/dist/state-explosion/helpers.js +82 -0
- package/dist/state-explosion.js +65 -283
- package/dist/state-node.js +19 -4
- package/dist/telemetry-attestation.js +55 -0
- package/dist/telemetry-demo.js +15 -3
- package/dist/telemetry-ledger.js +60 -15
- package/dist/topology.js +50 -12
- package/dist/triggers.js +33 -14
- package/dist/trust-audit.js +215 -71
- package/dist/validation.js +328 -0
- package/dist/version.js +1 -1
- package/dist/worker-isolation/helpers.js +51 -0
- package/dist/worker-isolation/paths.js +46 -0
- package/dist/worker-isolation.js +182 -173
- package/docs/agent-delegation-drive.7.md +14 -0
- package/docs/cli-mcp-parity.7.md +5 -0
- package/docs/contract-migration-tooling.7.md +3 -0
- package/docs/control-plane-scheduling.7.md +3 -0
- package/docs/dogfood/resume-drive-real-agent-2026-06-14.md +40 -0
- package/docs/durable-state-and-locking.7.md +5 -0
- package/docs/evidence-adoption-reasoning-chain.7.md +3 -0
- package/docs/execution-backends.7.md +3 -0
- package/docs/index.md +1 -0
- package/docs/launch/launch-kit.md +46 -23
- package/docs/launch/pre-launch-checklist.md +14 -14
- package/docs/multi-agent-cli-mcp-surface.7.md +5 -0
- package/docs/multi-agent-eval-replay-harness.7.md +3 -0
- package/docs/multi-agent-operator-ux.7.md +3 -0
- package/docs/multi-agent-trust-policy-audit.7.md +27 -0
- package/docs/node-snapshot-diff-replay.7.md +3 -0
- package/docs/observability-cost-accounting.7.md +3 -0
- package/docs/project-index.md +23 -6
- package/docs/real-execution-backends.7.md +3 -0
- package/docs/release-and-migration.7.md +5 -0
- package/docs/release-tooling.7.md +35 -2
- package/docs/run-registry-control-plane.7.md +55 -8
- package/docs/run-retention-reclamation.7.md +5 -0
- package/docs/state-explosion-management.7.md +3 -0
- package/docs/team-collaboration.7.md +3 -0
- package/docs/trust-model.md +267 -0
- package/docs/vendor-manifest-loadability.7.md +43 -0
- package/docs/web-desktop-workbench.7.md +3 -0
- package/manifest/plugin.manifest.json +1 -1
- package/manifest/source-context-profiles.json +1 -1
- package/package.json +4 -2
- package/scripts/agents/builtin-templates.json +7 -0
- package/scripts/bump-version.js +5 -11
- package/scripts/canonical-apps-list.js +64 -0
- package/scripts/canonical-apps.js +19 -4
- package/scripts/children/batch-delegate-child.js +58 -0
- package/scripts/children/http-delegate-child.js +39 -0
- package/scripts/dogfood-release.js +1 -1
- package/scripts/golden-path.js +4 -4
- package/scripts/parity-check.js +5 -0
- package/scripts/release-check.js +5 -1
- package/scripts/release-flow.js +181 -5
- package/scripts/version-sync-check.js +5 -8
- package/dist/capability-dispatcher.js +0 -86
package/dist/gates.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Shared, drift-proof gate primitives (F4). These two helpers were previously
|
|
3
|
+
// duplicated "in sync by comment" in commit.ts and candidate-scoring.ts — the
|
|
4
|
+
// no-false-green gate and the sandbox-profile lookup. A by-comment sync is a
|
|
5
|
+
// structural drift hazard: nothing prevents one copy from changing without the
|
|
6
|
+
// other, and the two gates MUST agree (selection + commit must reach the same
|
|
7
|
+
// empty-capture verdict). Extracting ONE implementation each, imported by both
|
|
8
|
+
// call sites, makes that drift impossible.
|
|
9
|
+
//
|
|
10
|
+
// Pure functions over PERSISTED state only — no clock, no randomness, no fs —
|
|
11
|
+
// so both selection and commit replays reach the same gate decision. Keep them
|
|
12
|
+
// fail-closed: when in doubt the caller must BLOCK, never silently pass.
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.emptyCaptureWarning = emptyCaptureWarning;
|
|
15
|
+
exports.sandboxProfileForCandidate = sandboxProfileForCandidate;
|
|
16
|
+
/** The HARD no-false-green gate (DIRECTION.md "ambiguity is a visible state").
|
|
17
|
+
* A verifier node is built FROM a result node; when that result captured no
|
|
18
|
+
* structured signal at all the result node carries a `metadata.captureWarning`
|
|
19
|
+
* marker (set in worker-isolation / lifecycle ingest via isEmptyCapture). The
|
|
20
|
+
* worker output is still ACCEPTED (a recorded warning, never a silent pass), but
|
|
21
|
+
* a verifier-GATED commit — and candidate SELECTION — must NOT be able to
|
|
22
|
+
* present that zero-evidence result as clean/green. We detect it here, reading
|
|
23
|
+
* ONLY persisted state (the source result node's metadata) — purely functional,
|
|
24
|
+
* no clock/ordering — so snapshot replay reaches the same gate decision.
|
|
25
|
+
* Returns the marker string, or undefined.
|
|
26
|
+
*
|
|
27
|
+
* Resolution trail: verifier node -> its input/parent result node. We look at
|
|
28
|
+
* `inputs.inputNodeId` (set by runPipelineStage) first, then fall back to the
|
|
29
|
+
* first parent, so it works regardless of which ingest path produced the node. */
|
|
30
|
+
function emptyCaptureWarning(run, verifierNode) {
|
|
31
|
+
const resultNodeId = (typeof verifierNode.inputs?.inputNodeId === "string" ? verifierNode.inputs.inputNodeId : undefined) ||
|
|
32
|
+
verifierNode.parents[0];
|
|
33
|
+
const resultNode = resultNodeId ? (run.nodes || []).find((node) => node.id === resultNodeId) : undefined;
|
|
34
|
+
const warning = resultNode?.metadata?.captureWarning;
|
|
35
|
+
return typeof warning === "string" && warning ? warning : undefined;
|
|
36
|
+
}
|
|
37
|
+
/** Resolve the sandbox profile that backed a candidate's acceptance: the
|
|
38
|
+
* worker's profile if the candidate has a worker, else the originating task's.
|
|
39
|
+
* Read by both the commit gate's acceptance rationale and selection. Accepts an
|
|
40
|
+
* optional candidate so the commit-side caller (which may not have resolved a
|
|
41
|
+
* candidate) can share the same lookup. Pure over persisted run state. */
|
|
42
|
+
function sandboxProfileForCandidate(run, candidate) {
|
|
43
|
+
const worker = candidate?.workerId ? (run.workers || []).find((entry) => entry.id === candidate.workerId) : undefined;
|
|
44
|
+
if (worker?.sandboxProfileId)
|
|
45
|
+
return worker.sandboxProfileId;
|
|
46
|
+
const task = candidate?.taskId ? (run.tasks || []).find((entry) => entry.id === candidate.taskId) : undefined;
|
|
47
|
+
return task?.sandboxProfileId;
|
|
48
|
+
}
|
package/dist/mcp-server.js
CHANGED
|
@@ -65,6 +65,19 @@ function handleLine(line) {
|
|
|
65
65
|
sendError(message.id, -32000, messageOf(error));
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
+
// This is an EXPLICIT switch by design, NOT a descriptor-driven generic dispatcher
|
|
69
|
+
// (FreeBSD-audit R1, assessed & closed as won't-do). A data-routing rewrite is
|
|
70
|
+
// ACTIVELY DANGEROUS here, not just risky: (1) `descriptor.entry` does NOT reliably
|
|
71
|
+
// name the function an arm calls (e.g. cw_app_run entry="validateApp" actually calls
|
|
72
|
+
// appRun; cw_commit entry="commit" calls commitEnvelope), so `runner[entry](args)`
|
|
73
|
+
// would silently call the WRONG method; (2) the parity gate is token-set-only +
|
|
74
|
+
// payload-probes ~30 read-only runId caps, so ~150 multi-positional/write arms are
|
|
75
|
+
// UNPROBED — a mis-marshalling generic dispatcher would pass BOTH gates green = the
|
|
76
|
+
// existential public false-green (a CW red line — see DIRECTION.md). The arms
|
|
77
|
+
// work and parity guards the surface; the real defect the audit flagged (a DEAD
|
|
78
|
+
// dispatcher) was already removed (#131). Cheap safe hardening, if ever wanted:
|
|
79
|
+
// broaden parity-check payload probes to cover multi-positional/write arms, and
|
|
80
|
+
// correct the wrong `entry` metadata — NOT a dispatch rewrite.
|
|
68
81
|
function callTool(name, args) {
|
|
69
82
|
const previousCwd = process.cwd();
|
|
70
83
|
if (args.cwd)
|
|
@@ -237,6 +250,8 @@ function callTool(name, args) {
|
|
|
237
250
|
return runner.recordCoordinatorDecision(String(args.runId || ""), args);
|
|
238
251
|
case "cw_audit_summary":
|
|
239
252
|
return runner.auditSummary(String(args.runId || ""));
|
|
253
|
+
case "cw_audit_verify":
|
|
254
|
+
return (0, capability_core_1.auditVerify)(runner, args);
|
|
240
255
|
case "cw_audit_worker":
|
|
241
256
|
return runner.workerAudit(String(args.runId || ""), String(args.workerId || ""));
|
|
242
257
|
case "cw_audit_provenance":
|
|
@@ -386,7 +401,7 @@ function callTool(name, args) {
|
|
|
386
401
|
case "cw_run_show":
|
|
387
402
|
return (0, capability_core_1.runShow)((0, capability_core_1.runRegistryFor)(args, runner), String(args.runId || ""), args);
|
|
388
403
|
case "cw_run_resume":
|
|
389
|
-
return (0, capability_core_1.runResume)((0, capability_core_1.runRegistryFor)(args, runner), String(args.runId || ""), args);
|
|
404
|
+
return (0, capability_core_1.runResume)((0, capability_core_1.runRegistryFor)(args, runner), runner, String(args.runId || ""), args);
|
|
390
405
|
case "cw_run_archive":
|
|
391
406
|
return (0, capability_core_1.runArchive)((0, capability_core_1.runRegistryFor)(args, runner), (0, capability_core_1.optionalString)(args.runId), args);
|
|
392
407
|
case "cw_run_rerun":
|
|
@@ -397,6 +412,8 @@ function callTool(name, args) {
|
|
|
397
412
|
return (0, capability_core_1.runImportArchive)(runner, args);
|
|
398
413
|
case "cw_run_verify_import":
|
|
399
414
|
return (0, capability_core_1.runVerifyImport)(runner, String(args.runId || ""), args);
|
|
415
|
+
case "cw_run_inspect_archive":
|
|
416
|
+
return (0, capability_core_1.runInspectArchive)(runner, args);
|
|
400
417
|
case "cw_run_drive":
|
|
401
418
|
return (0, capability_core_1.runDrivePreview)(runner, args);
|
|
402
419
|
case "cw_run_drive_step":
|
|
@@ -442,22 +459,8 @@ function callTool(name, args) {
|
|
|
442
459
|
// (identical to `cw workbench serve --json`). The CLI default additionally
|
|
443
460
|
// starts the localhost host — declared divergence (see capability-registry).
|
|
444
461
|
return (0, workbench_1.buildWorkbenchServeDescriptor)(runner, { ...args, once: true });
|
|
445
|
-
default:
|
|
446
|
-
// ---- Dynamic capability dispatch fallback (v0.1.53) ---------------
|
|
447
|
-
// Mechanism: try the capability registry before failing. Policy: which
|
|
448
|
-
// tools exist is declared via registerCapabilityHandler at load time.
|
|
449
|
-
const capabilityId = (0, capability_registry_1.resolveMcpTool)(name);
|
|
450
|
-
if (capabilityId) {
|
|
451
|
-
const handler = (0, capability_registry_1.getCapabilityHandler)(capabilityId);
|
|
452
|
-
if (handler) {
|
|
453
|
-
return (0, capability_registry_1.dispatchCapability)(capabilityId, args, {
|
|
454
|
-
runner,
|
|
455
|
-
cwd: process.cwd()
|
|
456
|
-
});
|
|
457
|
-
}
|
|
458
|
-
}
|
|
462
|
+
default:
|
|
459
463
|
throw new Error(`Unknown tool: ${name}`);
|
|
460
|
-
}
|
|
461
464
|
}
|
|
462
465
|
}
|
|
463
466
|
finally {
|
|
@@ -484,161 +487,11 @@ function requiredToolArguments(name, value) {
|
|
|
484
487
|
return args;
|
|
485
488
|
}
|
|
486
489
|
function requiredArgsForTool(name) {
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
return ["runId", "nodeId"];
|
|
493
|
-
if (name === "cw_eval_replay")
|
|
494
|
-
return ["snapshot|snapshotId|path"];
|
|
495
|
-
if (name === "cw_eval_compare")
|
|
496
|
-
return ["baseline|baselinePath", "replay|replayPath"];
|
|
497
|
-
if (name === "cw_eval_score" || name === "cw_eval_report")
|
|
498
|
-
return ["replay|replayPath|path"];
|
|
499
|
-
if (name === "cw_eval_gate")
|
|
500
|
-
return ["suite|suiteId|path"];
|
|
501
|
-
if (name === "cw_topology_show" || name === "cw_topology_validate")
|
|
502
|
-
return ["topologyId|id"];
|
|
503
|
-
if (name === "cw_topology_apply")
|
|
504
|
-
return ["runId", "topologyId|id"];
|
|
505
|
-
if (name === "cw_sandbox_show")
|
|
506
|
-
return ["profileId"];
|
|
507
|
-
if (name === "cw_sandbox_validate")
|
|
508
|
-
return ["profileFile"];
|
|
509
|
-
if (name === "cw_schedule_delete" || name === "cw_schedule_complete" || name === "cw_schedule_pause" || name === "cw_schedule_resume" || name === "cw_schedule_run_now")
|
|
510
|
-
return ["id"];
|
|
511
|
-
if (name === "cw_routine_delete")
|
|
512
|
-
return ["id"];
|
|
513
|
-
if (name === "cw_routine_fire")
|
|
514
|
-
return ["kind"];
|
|
515
|
-
if (name === "cw_approve" || name === "cw_reject")
|
|
516
|
-
return ["runId", "targetKind|kind", "targetId|target"];
|
|
517
|
-
if (name === "cw_comment_add")
|
|
518
|
-
return ["runId", "targetKind|kind", "targetId|target", "body|message|text"];
|
|
519
|
-
if (name === "cw_handoff")
|
|
520
|
-
return ["runId", "targetKind|kind", "targetId|target", "to|toActor"];
|
|
521
|
-
if (name === "cw_run_show" || name === "cw_run_resume" || name === "cw_run_rerun" || name === "cw_run_export" || name === "cw_run_verify_import")
|
|
522
|
-
return ["runId"];
|
|
523
|
-
if (name === "cw_run_import")
|
|
524
|
-
return ["archive|path|file"];
|
|
525
|
-
if (name === "cw_run_archive")
|
|
526
|
-
return ["runId|olderThanDays"];
|
|
527
|
-
if (name === "cw_gc_verify")
|
|
528
|
-
return ["runId"];
|
|
529
|
-
if (name === "cw_telemetry_verify")
|
|
530
|
-
return ["runId"];
|
|
531
|
-
if (name === "cw_queue_show")
|
|
532
|
-
return ["id"];
|
|
533
|
-
if (name.endsWith("_show")) {
|
|
534
|
-
if (name.includes("_role_"))
|
|
535
|
-
return ["runId", "roleId"];
|
|
536
|
-
if (name.includes("_group_"))
|
|
537
|
-
return ["runId", "groupId"];
|
|
538
|
-
if (name.includes("_membership_"))
|
|
539
|
-
return ["runId", "membershipId"];
|
|
540
|
-
if (name.includes("_fanout_"))
|
|
541
|
-
return ["runId", "fanoutId"];
|
|
542
|
-
if (name.includes("_fanin_"))
|
|
543
|
-
return ["runId", "faninId"];
|
|
544
|
-
if (name.includes("_candidate_"))
|
|
545
|
-
return ["runId", "candidateId"];
|
|
546
|
-
if (name.includes("_feedback_"))
|
|
547
|
-
return ["runId", "feedbackId"];
|
|
548
|
-
if (name.includes("_worker_"))
|
|
549
|
-
return ["runId", "workerId"];
|
|
550
|
-
}
|
|
551
|
-
if (name.startsWith("cw_") && [
|
|
552
|
-
"cw_status",
|
|
553
|
-
"cw_next",
|
|
554
|
-
"cw_state_check",
|
|
555
|
-
"cw_contract_show",
|
|
556
|
-
"cw_node_list",
|
|
557
|
-
"cw_node_graph",
|
|
558
|
-
"cw_operator_status",
|
|
559
|
-
"cw_operator_graph",
|
|
560
|
-
"cw_operator_report",
|
|
561
|
-
"cw_worker_summary",
|
|
562
|
-
"cw_workbench_view",
|
|
563
|
-
"cw_candidate_summary",
|
|
564
|
-
"cw_feedback_summary",
|
|
565
|
-
"cw_commit_summary",
|
|
566
|
-
"cw_multi_agent_summary",
|
|
567
|
-
"cw_multi_agent_graph",
|
|
568
|
-
"cw_multi_agent_dependencies",
|
|
569
|
-
"cw_multi_agent_failures",
|
|
570
|
-
"cw_multi_agent_evidence",
|
|
571
|
-
"cw_evidence_reasoning",
|
|
572
|
-
"cw_evidence_reasoning_refresh",
|
|
573
|
-
"cw_summary_refresh",
|
|
574
|
-
"cw_summary_show",
|
|
575
|
-
"cw_metrics_show",
|
|
576
|
-
"cw_blackboard_summarize",
|
|
577
|
-
"cw_multi_agent_summarize",
|
|
578
|
-
"cw_multi_agent_graph_compact",
|
|
579
|
-
"cw_multi_agent_status",
|
|
580
|
-
"cw_multi_agent_step",
|
|
581
|
-
"cw_multi_agent_blackboard",
|
|
582
|
-
"cw_multi_agent_score",
|
|
583
|
-
"cw_multi_agent_select",
|
|
584
|
-
"cw_eval_snapshot",
|
|
585
|
-
"cw_multi_agent_run_create",
|
|
586
|
-
"cw_multi_agent_run_transition",
|
|
587
|
-
"cw_multi_agent_run_show",
|
|
588
|
-
"cw_multi_agent_role_create",
|
|
589
|
-
"cw_multi_agent_group_create",
|
|
590
|
-
"cw_multi_agent_membership_create",
|
|
591
|
-
"cw_multi_agent_fanout_create",
|
|
592
|
-
"cw_multi_agent_fanin_collect",
|
|
593
|
-
"cw_topology_summary",
|
|
594
|
-
"cw_topology_graph",
|
|
595
|
-
"cw_blackboard_summary",
|
|
596
|
-
"cw_blackboard_graph",
|
|
597
|
-
"cw_blackboard_resolve",
|
|
598
|
-
"cw_blackboard_topic_create",
|
|
599
|
-
"cw_blackboard_message_post",
|
|
600
|
-
"cw_blackboard_message_list",
|
|
601
|
-
"cw_blackboard_context_put",
|
|
602
|
-
"cw_blackboard_artifact_add",
|
|
603
|
-
"cw_blackboard_artifact_list",
|
|
604
|
-
"cw_blackboard_snapshot",
|
|
605
|
-
"cw_coordinator_summary",
|
|
606
|
-
"cw_coordinator_decision",
|
|
607
|
-
"cw_audit_summary",
|
|
608
|
-
"cw_audit_worker",
|
|
609
|
-
"cw_audit_provenance",
|
|
610
|
-
"cw_audit_multi_agent",
|
|
611
|
-
"cw_audit_policy",
|
|
612
|
-
"cw_audit_role",
|
|
613
|
-
"cw_audit_blackboard",
|
|
614
|
-
"cw_audit_judge",
|
|
615
|
-
"cw_audit_attest",
|
|
616
|
-
"cw_audit_decision",
|
|
617
|
-
"cw_dispatch",
|
|
618
|
-
"cw_result",
|
|
619
|
-
"cw_commit",
|
|
620
|
-
"cw_report",
|
|
621
|
-
"cw_worker_list",
|
|
622
|
-
"cw_worker_manifest",
|
|
623
|
-
"cw_worker_output",
|
|
624
|
-
"cw_worker_fail",
|
|
625
|
-
"cw_worker_validate",
|
|
626
|
-
"cw_candidate_list",
|
|
627
|
-
"cw_candidate_register",
|
|
628
|
-
"cw_candidate_score",
|
|
629
|
-
"cw_candidate_rank",
|
|
630
|
-
"cw_candidate_select",
|
|
631
|
-
"cw_candidate_reject",
|
|
632
|
-
"cw_review_status",
|
|
633
|
-
"cw_review_policy",
|
|
634
|
-
"cw_comment_list",
|
|
635
|
-
"cw_feedback_list",
|
|
636
|
-
"cw_feedback_collect",
|
|
637
|
-
"cw_feedback_task",
|
|
638
|
-
"cw_feedback_resolve"
|
|
639
|
-
].includes(name))
|
|
640
|
-
return ["runId"];
|
|
641
|
-
return [];
|
|
490
|
+
// Required args are declared once per capability as data on the mcp binding
|
|
491
|
+
// (McpBinding.requiredArgs). This is a pure data read of the parity-gated
|
|
492
|
+
// registry — no string-pattern ladder.
|
|
493
|
+
const descriptor = capability_registry_1.CAPABILITY_REGISTRY.find((capability) => capability.mcp?.tool === name);
|
|
494
|
+
return descriptor?.mcp?.requiredArgs ?? [];
|
|
642
495
|
}
|
|
643
496
|
function toolDefinitions() {
|
|
644
497
|
return [
|
|
@@ -1036,6 +889,7 @@ function toolDefinitions() {
|
|
|
1036
889
|
message: arraySchema("Blackboard message ids")
|
|
1037
890
|
}),
|
|
1038
891
|
tool("cw_audit_summary", "Read durable trust/audit summary for a run.", runIdSchema()),
|
|
892
|
+
tool("cw_audit_verify", "Re-prove a run's trust-audit hash chain offline: recompute every event hash from genesis + check chain linkage; a forged, edited, truncated, or unchained-injected event fails it. Peer of `cw audit verify`; fail-closed.", runIdSchema()),
|
|
1039
893
|
tool("cw_audit_worker", "Read trust/audit events for one worker.", workerIdSchema()),
|
|
1040
894
|
tool("cw_audit_provenance", "Inspect evidence provenance for a run, worker, candidate, or commit.", {
|
|
1041
895
|
...runIdSchema(),
|
|
@@ -1466,6 +1320,12 @@ function toolDefinitions() {
|
|
|
1466
1320
|
runId: stringSchema("Imported run id to verify"),
|
|
1467
1321
|
cwd: stringSchema("Restored repo workspace")
|
|
1468
1322
|
}),
|
|
1323
|
+
tool("cw_run_inspect_archive", "Read-only integrity inspection of a portable run archive without importing it: re-proves every file digest/size, the manifest digest + file count, and the whole-archive sha256, naming any offending file. Writes nothing.", {
|
|
1324
|
+
archive: stringSchema("Archive path"),
|
|
1325
|
+
path: stringSchema("Alias for archive"),
|
|
1326
|
+
file: stringSchema("Alias for archive"),
|
|
1327
|
+
cwd: stringSchema("Invocation workspace")
|
|
1328
|
+
}),
|
|
1469
1329
|
tool("cw_run_drive", "Preview the next agent-delegation drive step for a run (read-only, deterministic). Counts come from state; no spawn, no mutation.", {
|
|
1470
1330
|
runId: stringSchema("Run id to preview"),
|
|
1471
1331
|
cwd: stringSchema("Run workspace")
|
|
@@ -1561,9 +1421,10 @@ function toolDefinitions() {
|
|
|
1561
1421
|
scope: stringSchema("home (default, cross-repo) or repo"),
|
|
1562
1422
|
runId: stringSchema("Run id to verify")
|
|
1563
1423
|
}),
|
|
1564
|
-
tool("cw_telemetry_verify", "Re-prove a run's telemetry attestation ledger offline: prevHash chain linkage + independent per-record hash recompute (never trusts the stored hash). A forged or edited record fails it. Peer of `cw telemetry verify`.", {
|
|
1424
|
+
tool("cw_telemetry_verify", "Re-prove a run's telemetry attestation ledger offline: prevHash chain linkage + independent per-record hash recompute (never trusts the stored hash), and optionally re-run ed25519 checks with a public key. A forged or edited record fails it. Peer of `cw telemetry verify`.", {
|
|
1565
1425
|
cwd: stringSchema("Repo workspace"),
|
|
1566
|
-
runId: stringSchema("Run id to verify")
|
|
1426
|
+
runId: stringSchema("Run id to verify"),
|
|
1427
|
+
pubkey: stringSchema("Optional inline PEM or path to a public key for re-checking attested signatures")
|
|
1567
1428
|
}),
|
|
1568
1429
|
tool("cw_history", "Read a cross-repo unified run timeline (newest first), deterministic and paginated, with provenance links.", {
|
|
1569
1430
|
cwd: stringSchema("Repo workspace"),
|
|
@@ -0,0 +1,84 @@
|
|
|
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.buildMultiAgentGraphFromState = buildMultiAgentGraphFromState;
|
|
7
|
+
// Multi-agent provenance-graph builder (god-module carve, FreeBSD router pattern
|
|
8
|
+
// — cf. orchestrator/topology-operations.ts and run-registry/derive.ts). This is
|
|
9
|
+
// the largest cohesive renderer in the module: it walks the resolved
|
|
10
|
+
// MultiAgentState and emits the nodes/edges that the operator-UX and orchestrator
|
|
11
|
+
// graph surfaces consume. BEHAVIOR-PRESERVING — pure code movement, zero logic
|
|
12
|
+
// change. multi-agent.ts keeps the public buildMultiAgentGraph(run) entry point
|
|
13
|
+
// as a thin delegator (it resolves the state via ensureMultiAgentState, then
|
|
14
|
+
// calls buildMultiAgentGraphFromState) so the state is still ensured exactly
|
|
15
|
+
// once, in the same order, with the same side effects.
|
|
16
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
17
|
+
const paths_1 = require("./paths");
|
|
18
|
+
const helpers_1 = require("./helpers");
|
|
19
|
+
function buildMultiAgentGraphFromState(run, state) {
|
|
20
|
+
const root = (0, paths_1.multiAgentRoot)(run);
|
|
21
|
+
const nodes = [];
|
|
22
|
+
const edges = [];
|
|
23
|
+
for (const record of state.runs) {
|
|
24
|
+
nodes.push({ id: `${run.id}:multi-agent:${record.id}`, kind: "multi-agent-run", status: record.status, label: record.title || record.id, path: (0, paths_1.recordPath)(run, "runs", record.id) });
|
|
25
|
+
edges.push({ from: `${run.id}:run`, to: `${run.id}:multi-agent:${record.id}` });
|
|
26
|
+
if (record.blackboardId)
|
|
27
|
+
edges.push({ from: `${run.id}:multi-agent:${record.id}`, to: `${run.id}:blackboard:${record.blackboardId}`, label: "blackboard" });
|
|
28
|
+
if (record.parentMultiAgentRunId)
|
|
29
|
+
edges.push({ from: `${run.id}:multi-agent:${record.parentMultiAgentRunId}`, to: `${run.id}:multi-agent:${record.id}`, label: "child" });
|
|
30
|
+
}
|
|
31
|
+
for (const record of state.roles) {
|
|
32
|
+
nodes.push({ id: `${run.id}:multi-agent:role:${record.id}`, kind: "agent-role", status: record.status, label: record.title, path: (0, paths_1.recordPath)(run, "roles", record.id) });
|
|
33
|
+
edges.push({ from: `${run.id}:multi-agent:${record.multiAgentRunId}`, to: `${run.id}:multi-agent:role:${record.id}` });
|
|
34
|
+
if (record.blackboardId)
|
|
35
|
+
edges.push({ from: `${run.id}:multi-agent:role:${record.id}`, to: `${run.id}:blackboard:${record.blackboardId}`, label: "blackboard" });
|
|
36
|
+
}
|
|
37
|
+
for (const record of state.groups) {
|
|
38
|
+
nodes.push({ id: `${run.id}:multi-agent:group:${record.id}`, kind: "agent-group", status: record.status, label: record.title || record.id, path: (0, paths_1.recordPath)(run, "groups", record.id) });
|
|
39
|
+
edges.push({ from: `${run.id}:multi-agent:${record.multiAgentRunId}`, to: `${run.id}:multi-agent:group:${record.id}` });
|
|
40
|
+
if (record.blackboardId)
|
|
41
|
+
edges.push({ from: `${run.id}:multi-agent:group:${record.id}`, to: `${run.id}:blackboard:${record.blackboardId}`, label: "blackboard" });
|
|
42
|
+
for (const taskId of record.taskIds)
|
|
43
|
+
edges.push({ from: `${run.id}:multi-agent:group:${record.id}`, to: `${run.id}:task:${taskId}`, label: "task" });
|
|
44
|
+
}
|
|
45
|
+
for (const record of state.fanouts) {
|
|
46
|
+
nodes.push({ id: `${run.id}:multi-agent:fanout:${record.id}`, kind: "agent-fanout", status: record.status, label: record.reason, path: (0, paths_1.recordPath)(run, "fanouts", record.id) });
|
|
47
|
+
edges.push({ from: `${run.id}:multi-agent:group:${record.groupId}`, to: `${run.id}:multi-agent:fanout:${record.id}` });
|
|
48
|
+
for (const dispatchId of record.dispatchIds)
|
|
49
|
+
edges.push({ from: `${run.id}:multi-agent:fanout:${record.id}`, to: `${run.id}:dispatch:${dispatchId}`, label: "dispatch" });
|
|
50
|
+
}
|
|
51
|
+
for (const record of state.memberships) {
|
|
52
|
+
nodes.push({ id: `${run.id}:multi-agent:membership:${record.id}`, kind: "agent-membership", status: record.status, label: `${record.roleId}/${record.taskId}`, path: (0, paths_1.recordPath)(run, "memberships", record.id) });
|
|
53
|
+
edges.push({ from: `${run.id}:multi-agent:group:${record.groupId}`, to: `${run.id}:multi-agent:membership:${record.id}` });
|
|
54
|
+
edges.push({ from: `${run.id}:multi-agent:role:${record.roleId}`, to: `${run.id}:multi-agent:membership:${record.id}` });
|
|
55
|
+
edges.push({ from: `${run.id}:multi-agent:membership:${record.id}`, to: `${run.id}:task:${record.taskId}`, label: "task" });
|
|
56
|
+
if (record.workerId)
|
|
57
|
+
edges.push({ from: `${run.id}:multi-agent:membership:${record.id}`, to: `${run.id}:worker:${record.workerId}`, label: "worker" });
|
|
58
|
+
if (record.resultNodeId)
|
|
59
|
+
edges.push({ from: `${run.id}:multi-agent:membership:${record.id}`, to: record.resultNodeId, label: "result" });
|
|
60
|
+
if (record.verifierNodeId)
|
|
61
|
+
edges.push({ from: `${run.id}:multi-agent:membership:${record.id}`, to: record.verifierNodeId, label: "verifier" });
|
|
62
|
+
if (record.blackboardId)
|
|
63
|
+
edges.push({ from: `${run.id}:multi-agent:membership:${record.id}`, to: `${run.id}:blackboard:${record.blackboardId}`, label: "blackboard" });
|
|
64
|
+
for (const artifactId of record.blackboardArtifactRefIds || [])
|
|
65
|
+
edges.push({ from: `${run.id}:multi-agent:membership:${record.id}`, to: `${run.id}:blackboard:artifact:${artifactId}`, label: "evidence" });
|
|
66
|
+
for (const messageId of record.blackboardMessageIds || [])
|
|
67
|
+
edges.push({ from: `${run.id}:multi-agent:membership:${record.id}`, to: `${run.id}:blackboard:message:${messageId}`, label: "message" });
|
|
68
|
+
}
|
|
69
|
+
for (const record of state.fanins) {
|
|
70
|
+
nodes.push({ id: `${run.id}:multi-agent:fanin:${record.id}`, kind: "agent-fanin", status: record.status, label: record.strategy, path: (0, paths_1.recordPath)(run, "fanins", record.id) });
|
|
71
|
+
edges.push({ from: `${run.id}:multi-agent:group:${record.groupId}`, to: `${run.id}:multi-agent:fanin:${record.id}` });
|
|
72
|
+
if (record.fanoutId)
|
|
73
|
+
edges.push({ from: `${run.id}:multi-agent:fanout:${record.fanoutId}`, to: `${run.id}:multi-agent:fanin:${record.id}` });
|
|
74
|
+
for (const membershipId of record.reportedMembershipIds)
|
|
75
|
+
edges.push({ from: `${run.id}:multi-agent:membership:${membershipId}`, to: `${run.id}:multi-agent:fanin:${record.id}`, label: "reported" });
|
|
76
|
+
for (const membershipId of record.missingMembershipIds)
|
|
77
|
+
edges.push({ from: `${run.id}:multi-agent:membership:${membershipId}`, to: `${run.id}:multi-agent:fanin:${record.id}`, label: "missing" });
|
|
78
|
+
if (record.blackboardId)
|
|
79
|
+
edges.push({ from: `${run.id}:multi-agent:fanin:${record.id}`, to: `${run.id}:blackboard:${record.blackboardId}`, label: "blackboard" });
|
|
80
|
+
}
|
|
81
|
+
if (!node_fs_1.default.existsSync(root))
|
|
82
|
+
node_fs_1.default.mkdirSync(root, { recursive: true });
|
|
83
|
+
return { nodes, edges: (0, helpers_1.uniqueEdges)(edges) };
|
|
84
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createId = exports.MULTI_AGENT_SCHEMA_VERSION = void 0;
|
|
4
|
+
exports.indexRow = indexRow;
|
|
5
|
+
exports.assertNoRecordPathCollisions = assertNoRecordPathCollisions;
|
|
6
|
+
exports.pluralKind = pluralKind;
|
|
7
|
+
exports.statusToNodeStatus = statusToNodeStatus;
|
|
8
|
+
exports.assertLifecycleTransition = assertLifecycleTransition;
|
|
9
|
+
exports.lifecycleEvent = lifecycleEvent;
|
|
10
|
+
exports.isMembershipReported = isMembershipReported;
|
|
11
|
+
exports.touch = touch;
|
|
12
|
+
exports.compact = compact;
|
|
13
|
+
exports.unique = unique;
|
|
14
|
+
exports.countBy = countBy;
|
|
15
|
+
exports.uniqueEdges = uniqueEdges;
|
|
16
|
+
const state_1 = require("../state");
|
|
17
|
+
exports.MULTI_AGENT_SCHEMA_VERSION = 1;
|
|
18
|
+
function indexRow(record) {
|
|
19
|
+
return { id: record.id, status: record.status, updatedAt: record.updatedAt };
|
|
20
|
+
}
|
|
21
|
+
function assertNoRecordPathCollisions(label, records) {
|
|
22
|
+
const seen = new Map();
|
|
23
|
+
for (const record of records) {
|
|
24
|
+
const safe = (0, state_1.safeFileName)(record.id);
|
|
25
|
+
const existing = seen.get(safe);
|
|
26
|
+
if (existing && existing !== record.id) {
|
|
27
|
+
throw new Error(`${label} ids ${existing} and ${record.id} collide on safe file name ${safe}`);
|
|
28
|
+
}
|
|
29
|
+
seen.set(safe, record.id);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function pluralKind(kind) {
|
|
33
|
+
switch (kind) {
|
|
34
|
+
case "multi-agent-run":
|
|
35
|
+
return "runs";
|
|
36
|
+
case "agent-role":
|
|
37
|
+
return "roles";
|
|
38
|
+
case "agent-group":
|
|
39
|
+
return "groups";
|
|
40
|
+
case "agent-membership":
|
|
41
|
+
return "memberships";
|
|
42
|
+
case "agent-fanout":
|
|
43
|
+
return "fanouts";
|
|
44
|
+
case "agent-fanin":
|
|
45
|
+
return "fanins";
|
|
46
|
+
default:
|
|
47
|
+
return `${kind}s`;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function statusToNodeStatus(status) {
|
|
51
|
+
switch (status) {
|
|
52
|
+
case "completed":
|
|
53
|
+
case "reported":
|
|
54
|
+
case "ready":
|
|
55
|
+
return "completed";
|
|
56
|
+
case "running":
|
|
57
|
+
case "forming":
|
|
58
|
+
case "collecting":
|
|
59
|
+
case "verifying":
|
|
60
|
+
case "assigned":
|
|
61
|
+
case "active":
|
|
62
|
+
case "dispatched":
|
|
63
|
+
return "running";
|
|
64
|
+
case "blocked":
|
|
65
|
+
return "blocked";
|
|
66
|
+
case "failed":
|
|
67
|
+
return "failed";
|
|
68
|
+
case "cancelled":
|
|
69
|
+
case "rejected":
|
|
70
|
+
return "rejected";
|
|
71
|
+
default:
|
|
72
|
+
return "pending";
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function assertLifecycleTransition(from, to) {
|
|
76
|
+
const allowed = {
|
|
77
|
+
planned: ["forming", "running", "failed", "cancelled"],
|
|
78
|
+
forming: ["running", "failed", "cancelled"],
|
|
79
|
+
running: ["collecting", "completed", "failed", "cancelled"],
|
|
80
|
+
collecting: ["verifying", "completed", "failed", "cancelled"],
|
|
81
|
+
verifying: ["completed", "failed", "cancelled"],
|
|
82
|
+
completed: [],
|
|
83
|
+
failed: [],
|
|
84
|
+
cancelled: []
|
|
85
|
+
};
|
|
86
|
+
if (from === to)
|
|
87
|
+
return;
|
|
88
|
+
if (!allowed[from].includes(to))
|
|
89
|
+
throw new Error(`Invalid MultiAgentRun lifecycle transition: ${from} -> ${to}`);
|
|
90
|
+
}
|
|
91
|
+
function lifecycleEvent(from, to, reason, actor = "cw", metadata) {
|
|
92
|
+
return {
|
|
93
|
+
at: new Date().toISOString(),
|
|
94
|
+
from,
|
|
95
|
+
to,
|
|
96
|
+
actor,
|
|
97
|
+
reason,
|
|
98
|
+
metadata: compact(metadata)
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function isMembershipReported(membership) {
|
|
102
|
+
return (membership.status === "reported" || membership.status === "verified") && membership.evidenceRefs.length > 0;
|
|
103
|
+
}
|
|
104
|
+
function touch(record) {
|
|
105
|
+
record.updatedAt = new Date().toISOString();
|
|
106
|
+
return record;
|
|
107
|
+
}
|
|
108
|
+
// Deterministic record id — single source of truth in ./ids. Re-exported here so
|
|
109
|
+
// multi-agent.ts importers stay byte-unchanged (F10 dedup: the coordinator layer
|
|
110
|
+
// shares the exact same helper).
|
|
111
|
+
var ids_1 = require("./ids");
|
|
112
|
+
Object.defineProperty(exports, "createId", { enumerable: true, get: function () { return ids_1.createId; } });
|
|
113
|
+
function compact(value) {
|
|
114
|
+
if (!value)
|
|
115
|
+
return undefined;
|
|
116
|
+
const entries = Object.entries(value).filter(([, entry]) => entry !== undefined);
|
|
117
|
+
return entries.length ? Object.fromEntries(entries) : undefined;
|
|
118
|
+
}
|
|
119
|
+
function unique(values) {
|
|
120
|
+
return Array.from(new Set(values.filter(Boolean))).sort();
|
|
121
|
+
}
|
|
122
|
+
function countBy(items, key) {
|
|
123
|
+
const counts = {};
|
|
124
|
+
for (const item of items) {
|
|
125
|
+
const value = key(item);
|
|
126
|
+
counts[value] = (counts[value] || 0) + 1;
|
|
127
|
+
}
|
|
128
|
+
return counts;
|
|
129
|
+
}
|
|
130
|
+
function uniqueEdges(edges) {
|
|
131
|
+
const seen = new Set();
|
|
132
|
+
const result = [];
|
|
133
|
+
for (const edge of edges) {
|
|
134
|
+
const key = `${edge.from}\0${edge.to}\0${edge.label || ""}`;
|
|
135
|
+
if (seen.has(key))
|
|
136
|
+
continue;
|
|
137
|
+
seen.add(key);
|
|
138
|
+
result.push(edge);
|
|
139
|
+
}
|
|
140
|
+
return result;
|
|
141
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createId = createId;
|
|
4
|
+
// Single source of truth for the deterministic record id scheme shared by the
|
|
5
|
+
// multi-agent kernel (multi-agent/helpers.ts) and the coordinator/blackboard
|
|
6
|
+
// layer (coordinator/util.ts). Both previously copy-pasted byte-identical
|
|
7
|
+
// zero-padded-seq logic; this dedup (F10) collapses them onto one helper.
|
|
8
|
+
//
|
|
9
|
+
// Deterministic record id (FreeBSD-audit L12/L13): the record's POSITION in its
|
|
10
|
+
// per-run collection, threaded from the call site. No wall-clock stamp, no PRNG
|
|
11
|
+
// suffix — re-running the same multi-agent topology / coordination mints
|
|
12
|
+
// byte-identical ids, so snapshot/replay digests match. Each call site already
|
|
13
|
+
// asserts the minted id is unique within its collection, and these collections
|
|
14
|
+
// only ever append.
|
|
15
|
+
//
|
|
16
|
+
// REPLAY DETERMINISM: pure function of its arguments — no Date, no random.
|
|
17
|
+
// The output MUST stay byte-identical: `${prefix}-${4-digit-zero-padded-seq}`.
|
|
18
|
+
function createId(prefix, seq) {
|
|
19
|
+
return `${prefix}-${String(seq).padStart(4, "0")}`;
|
|
20
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
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.multiAgentRoot = multiAgentRoot;
|
|
7
|
+
exports.recordPath = recordPath;
|
|
8
|
+
// Filesystem path resolution for multi-agent records (god-module carve, FreeBSD
|
|
9
|
+
// router pattern). BEHAVIOR-PRESERVING — pure code movement, zero logic change.
|
|
10
|
+
// These two free functions derive paths from run.paths only; they are shared by
|
|
11
|
+
// the persistence, node-append, and graph clusters, so they live in their own
|
|
12
|
+
// leaf module to keep those clusters free of a circular import back to
|
|
13
|
+
// multi-agent.ts. Re-exported there is unnecessary (both are private), but the
|
|
14
|
+
// derivation is byte-identical to the originals.
|
|
15
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
16
|
+
const state_1 = require("../state");
|
|
17
|
+
function multiAgentRoot(run) {
|
|
18
|
+
return run.paths.multiAgentDir || node_path_1.default.join(run.paths.runDir, "multi-agent");
|
|
19
|
+
}
|
|
20
|
+
function recordPath(run, kind, id) {
|
|
21
|
+
return node_path_1.default.join(multiAgentRoot(run), kind, `${(0, state_1.safeFileName)(id)}.json`);
|
|
22
|
+
}
|