cool-workflow 0.1.83 → 0.1.85
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 +6 -0
- 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/capability-core.js +89 -2
- package/dist/capability-registry.js +269 -2
- package/dist/cli/command-surface.js +1362 -0
- package/dist/cli.js +2 -1318
- package/dist/mcp-server.js +5 -1452
- package/dist/mcp-surface.js +1467 -0
- package/dist/run-export.js +139 -1
- package/dist/telemetry-demo.js +119 -0
- package/dist/types/report-bundle.js +6 -0
- package/dist/types.js +1 -0
- package/dist/version.js +1 -1
- package/dist/worker-accept/acceptance.js +114 -0
- package/dist/worker-accept/blackboard-fanout.js +80 -0
- package/dist/worker-accept/blackboard-linkage.js +19 -0
- package/dist/worker-accept/context.js +2 -0
- package/dist/worker-accept/telemetry-ledger.js +116 -0
- package/dist/worker-accept/validation.js +77 -0
- package/dist/worker-accept/verifier-completion.js +73 -0
- package/dist/worker-isolation.js +19 -444
- package/docs/agent-delegation-drive.7.md +6 -0
- package/docs/cli-mcp-parity.7.md +13 -3
- package/docs/contract-migration-tooling.7.md +6 -0
- package/docs/control-plane-scheduling.7.md +6 -0
- package/docs/durable-state-and-locking.7.md +6 -0
- package/docs/evidence-adoption-reasoning-chain.7.md +6 -0
- package/docs/execution-backends.7.md +6 -0
- package/docs/index.md +1 -0
- package/docs/multi-agent-cli-mcp-surface.7.md +6 -0
- package/docs/multi-agent-eval-replay-harness.7.md +6 -0
- package/docs/multi-agent-operator-ux.7.md +6 -0
- package/docs/node-snapshot-diff-replay.7.md +6 -0
- package/docs/observability-cost-accounting.7.md +6 -0
- package/docs/project-index.md +17 -6
- package/docs/real-execution-backends.7.md +6 -0
- package/docs/release-and-migration.7.md +6 -0
- package/docs/release-tooling.7.md +16 -1
- package/docs/report-verifiable-bundle.7.md +123 -0
- package/docs/run-registry-control-plane.7.md +6 -0
- package/docs/run-retention-reclamation.7.md +6 -0
- package/docs/state-explosion-management.7.md +6 -0
- package/docs/team-collaboration.7.md +6 -0
- package/docs/web-desktop-workbench.7.md +6 -0
- package/manifest/plugin.manifest.json +1 -1
- package/package.json +1 -1
- package/scripts/bump-version.js +9 -1
- package/scripts/canonical-apps.js +4 -4
- package/scripts/dogfood-release.js +1 -1
- package/scripts/golden-path.js +4 -4
- package/scripts/parity-check.js +27 -57
- package/scripts/release-flow.js +7 -6
- package/scripts/sync-project-index.js +1 -1
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.attestWorkerDelegation = attestWorkerDelegation;
|
|
4
|
+
exports.recordWorkerDelegationLedger = recordWorkerDelegationLedger;
|
|
5
|
+
const execution_backend_1 = require("../execution-backend");
|
|
6
|
+
const telemetry_attestation_1 = require("../telemetry-attestation");
|
|
7
|
+
const telemetry_ledger_1 = require("../telemetry-ledger");
|
|
8
|
+
const trust_audit_1 = require("../trust-audit");
|
|
9
|
+
const helpers_1 = require("../worker-isolation/helpers");
|
|
10
|
+
/** Step 2 — attestSandbox/attestDelegation: verify the agent's signed telemetry
|
|
11
|
+
* BEFORE recording it, enforce the opt-in require-attested-telemetry gate (still
|
|
12
|
+
* fail-closed, pre-mutation), and build the agent-hop provenance. Non-agent hops
|
|
13
|
+
* return an empty delegation. */
|
|
14
|
+
function attestWorkerDelegation(accept, deps) {
|
|
15
|
+
const { run, workerId, options, task, absoluteResultPath, rawResult } = accept;
|
|
16
|
+
// Agent Delegation Drive (v0.1.38): if this worker's result.md was produced by an
|
|
17
|
+
// EXTERNAL agent, record the agent-hop attestation AS PROVENANCE — the agent
|
|
18
|
+
// (kind:process) handle, the agent-REPORTED model (never CW_AGENT_MODEL), the
|
|
19
|
+
// prompt digest, the secret-stripped args, and the result digest computed HERE
|
|
20
|
+
// from the accepted result.md. These live in the result node's metadata (covered
|
|
21
|
+
// by the v0.1.35 snapshot body) + a trust-audit event, NEVER in `evidence`.
|
|
22
|
+
// Track 1: verify the agent's signed telemetry BEFORE recording it. CW holds
|
|
23
|
+
// only the operator's PUBLIC key — it verifies attribution, never measures
|
|
24
|
+
// usage. Absent/invalid signature => `unattested`/`absent`, surfaced loudly,
|
|
25
|
+
// NEVER silently recorded as trusted.
|
|
26
|
+
const telemetry = options.agentDelegation
|
|
27
|
+
? (0, telemetry_attestation_1.verifyTelemetryAttestation)(options.agentDelegation.reportedUsage, options.agentDelegation.usageSignature, (0, telemetry_attestation_1.resolveTrustPublicKey)(options.agentDelegation.usageTrustPublicKey), { runId: run.id, taskId: task.id, promptDigest: options.agentDelegation.promptDigest })
|
|
28
|
+
: undefined;
|
|
29
|
+
// Track 1 fail-closed (Decision 2 — OPT-IN, off by default). When the operator
|
|
30
|
+
// requires attested telemetry, a delegated hop whose verdict is not `attested`
|
|
31
|
+
// is REJECTED here — BEFORE any accept-side state mutation — so the drive parks
|
|
32
|
+
// it instead of recording unverifiable usage. Default behavior is unchanged
|
|
33
|
+
// (flag-and-surface). Non-agent hops carry no verdict and are never blocked.
|
|
34
|
+
if (options.requireAttestedTelemetry && telemetry && telemetry.status !== "attested") {
|
|
35
|
+
const error = (0, helpers_1.structuredError)("telemetry-unattested-blocked", `Worker ${workerId} telemetry is ${telemetry.status} (${telemetry.reason || "unverified"}) and require-attested-telemetry is enabled — refusing to accept a hop whose usage cannot be cryptographically verified`, { path: absoluteResultPath, retryable: false });
|
|
36
|
+
deps.recordWorkerFailure(run, workerId, error, { ...options, persist: options.persist });
|
|
37
|
+
throw new Error(error.message);
|
|
38
|
+
}
|
|
39
|
+
const agentDelegation = options.agentDelegation
|
|
40
|
+
? {
|
|
41
|
+
schemaVersion: 1,
|
|
42
|
+
backendId: "agent",
|
|
43
|
+
handle: options.agentDelegation.handle,
|
|
44
|
+
model: options.agentDelegation.model,
|
|
45
|
+
promptDigest: options.agentDelegation.promptDigest,
|
|
46
|
+
resultDigest: (0, execution_backend_1.sha256)(rawResult),
|
|
47
|
+
command: options.agentDelegation.command,
|
|
48
|
+
args: options.agentDelegation.args,
|
|
49
|
+
exitCode: options.agentDelegation.exitCode,
|
|
50
|
+
...(options.agentDelegation.reportedUsage ? { reportedUsage: options.agentDelegation.reportedUsage } : {}),
|
|
51
|
+
...(options.agentDelegation.usageSignature ? { usageSignature: options.agentDelegation.usageSignature } : {}),
|
|
52
|
+
...(telemetry ? { usageAttestation: telemetry.status, usageAttestationReason: telemetry.reason } : {})
|
|
53
|
+
}
|
|
54
|
+
: undefined;
|
|
55
|
+
return { agentDelegation, telemetry };
|
|
56
|
+
}
|
|
57
|
+
/** Step 4 — recordTelemetryLedger: the agent-hop attestation. Binds the telemetry
|
|
58
|
+
* verdict into the append-only hash-chained ledger BEFORE the audit event (so the
|
|
59
|
+
* event can cross-link the record hash), then emits the worker.agent-delegation
|
|
60
|
+
* audit event. No-op for non-agent hops. */
|
|
61
|
+
function recordWorkerDelegationLedger(accept, delegation) {
|
|
62
|
+
const { agentDelegation } = delegation;
|
|
63
|
+
// The agent-hop attestation event — hung off worker.output, alongside
|
|
64
|
+
// worker.backend. Recorded in trust-audit/provenance, NEVER in node evidence.
|
|
65
|
+
if (!agentDelegation)
|
|
66
|
+
return;
|
|
67
|
+
const { run, workerId, scope, task, resultNode, acceptedAuditId } = accept;
|
|
68
|
+
// Track 1 (tamper-evidence): bind this verdict into the append-only,
|
|
69
|
+
// hash-chained telemetry ledger BEFORE the audit event, so the event can
|
|
70
|
+
// cross-link the record hash. Editing the recorded verdict/usage later breaks
|
|
71
|
+
// the chain (verifyTelemetryLedger). Only when a verdict was computed.
|
|
72
|
+
const ledgerRecord = agentDelegation.usageAttestation
|
|
73
|
+
? (0, telemetry_ledger_1.appendTelemetryAttestation)(run, {
|
|
74
|
+
workerId,
|
|
75
|
+
taskId: task.id,
|
|
76
|
+
promptDigest: agentDelegation.promptDigest,
|
|
77
|
+
reportedUsage: agentDelegation.reportedUsage,
|
|
78
|
+
usageSignature: agentDelegation.usageSignature,
|
|
79
|
+
attestation: agentDelegation.usageAttestation,
|
|
80
|
+
attestationReason: agentDelegation.usageAttestationReason
|
|
81
|
+
})
|
|
82
|
+
: undefined;
|
|
83
|
+
(0, trust_audit_1.recordTrustAuditEvent)(run, {
|
|
84
|
+
kind: "worker.agent-delegation",
|
|
85
|
+
decision: "recorded",
|
|
86
|
+
source: "host-attested",
|
|
87
|
+
workerId,
|
|
88
|
+
taskId: task.id,
|
|
89
|
+
nodeId: resultNode.id,
|
|
90
|
+
sandboxProfileId: scope.sandboxProfileId,
|
|
91
|
+
policySnapshot: scope.sandboxPolicy,
|
|
92
|
+
parentEventIds: [acceptedAuditId],
|
|
93
|
+
metadata: {
|
|
94
|
+
backendId: agentDelegation.backendId,
|
|
95
|
+
handleKind: agentDelegation.handle.kind,
|
|
96
|
+
handleRef: agentDelegation.handle.ref,
|
|
97
|
+
model: agentDelegation.model,
|
|
98
|
+
promptDigest: agentDelegation.promptDigest,
|
|
99
|
+
resultDigest: agentDelegation.resultDigest,
|
|
100
|
+
command: agentDelegation.command,
|
|
101
|
+
args: agentDelegation.args,
|
|
102
|
+
exitCode: agentDelegation.exitCode,
|
|
103
|
+
// Track 1: the telemetry verdict travels with the agent-hop event so the
|
|
104
|
+
// audit report can surface `unattested` usage loudly. Absent => no usage.
|
|
105
|
+
...(agentDelegation.usageAttestation
|
|
106
|
+
? {
|
|
107
|
+
telemetryAttestation: agentDelegation.usageAttestation,
|
|
108
|
+
...(agentDelegation.usageAttestationReason ? { telemetryAttestationReason: agentDelegation.usageAttestationReason } : {}),
|
|
109
|
+
...(agentDelegation.reportedUsage ? { reportedUsage: agentDelegation.reportedUsage } : {}),
|
|
110
|
+
// Cross-link to the hash-chained ledger entry (tamper-evidence).
|
|
111
|
+
...(ledgerRecord ? { telemetryRecordId: ledgerRecord.recordId, telemetryRecordHash: ledgerRecord.recordHash, telemetryPrevHash: ledgerRecord.prevHash } : {})
|
|
112
|
+
}
|
|
113
|
+
: {})
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
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.validateWorkerResult = validateWorkerResult;
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const verifier_1 = require("../verifier");
|
|
10
|
+
const evidence_grounding_1 = require("../evidence-grounding");
|
|
11
|
+
const trust_audit_1 = require("../trust-audit");
|
|
12
|
+
const helpers_1 = require("../worker-isolation/helpers");
|
|
13
|
+
/** Step 1 — validateResult: resolve scope/task, enforce the sandbox boundary, the
|
|
14
|
+
* result-file existence, the envelope contract, and (opt-in) resolvable evidence.
|
|
15
|
+
* Fail-closed: any guard records a worker failure and throws BEFORE accept-side
|
|
16
|
+
* state mutation. Returns the partially-filled accept context on success. */
|
|
17
|
+
function validateWorkerResult(run, workerId, resultPath, options, deps) {
|
|
18
|
+
const scope = deps.requireWorkerScope(run, workerId);
|
|
19
|
+
const task = deps.requireWorkerTask(run, scope);
|
|
20
|
+
const absoluteResultPath = node_path_1.default.resolve(resultPath);
|
|
21
|
+
const violation = deps.validateWorkerBoundary(run, workerId, { ...options, policy: options.policy, path: absoluteResultPath });
|
|
22
|
+
if (violation) {
|
|
23
|
+
(0, trust_audit_1.recordSandboxPathDecision)(run, {
|
|
24
|
+
workerId,
|
|
25
|
+
taskId: task.id,
|
|
26
|
+
sandboxProfileId: scope.sandboxProfileId,
|
|
27
|
+
policySnapshot: scope.sandboxPolicy,
|
|
28
|
+
target: absoluteResultPath,
|
|
29
|
+
decision: "denied",
|
|
30
|
+
metadata: { code: violation.code, allowedPaths: violation.allowedPaths }
|
|
31
|
+
});
|
|
32
|
+
deps.recordWorkerFailure(run, workerId, violation, { ...options, path: absoluteResultPath, code: violation.code, retryable: false });
|
|
33
|
+
throw new Error(violation.message);
|
|
34
|
+
}
|
|
35
|
+
if (!node_fs_1.default.existsSync(absoluteResultPath)) {
|
|
36
|
+
const error = (0, helpers_1.structuredError)("worker-result-missing", `Worker result file does not exist: ${absoluteResultPath}`, {
|
|
37
|
+
path: absoluteResultPath,
|
|
38
|
+
retryable: true
|
|
39
|
+
});
|
|
40
|
+
deps.recordWorkerFailure(run, workerId, error, { ...options, persist: options.persist });
|
|
41
|
+
throw new Error(error.message);
|
|
42
|
+
}
|
|
43
|
+
const rawResult = node_fs_1.default.readFileSync(absoluteResultPath, "utf8");
|
|
44
|
+
const parsedResult = (0, verifier_1.parseResultEnvelope)(rawResult);
|
|
45
|
+
(0, verifier_1.validateResultEnvelope)(task, parsedResult);
|
|
46
|
+
// Strict evidence resolution (v0.1.40 self-audit P1, opt-in via
|
|
47
|
+
// CW_REQUIRE_RESOLVABLE_EVIDENCE): fail closed if the result cites file-style
|
|
48
|
+
// evidence that does not resolve on disk, so a worker cannot land a result
|
|
49
|
+
// whose evidence locators point nowhere. Off by default — the default gate is
|
|
50
|
+
// the deterministic grounding check in validateResultEnvelope.
|
|
51
|
+
if ((0, evidence_grounding_1.requireResolvableEvidence)()) {
|
|
52
|
+
const baseDirs = Array.from(new Set([run.cwd, process.cwd(), scope.workerDir, run.paths.runDir].filter(Boolean)));
|
|
53
|
+
const unresolved = (0, evidence_grounding_1.unresolvedFileEvidence)(parsedResult.evidence, baseDirs);
|
|
54
|
+
if (unresolved.length) {
|
|
55
|
+
const error = (0, helpers_1.structuredError)("worker-evidence-unresolvable", `Worker ${workerId} result cites file evidence that does not resolve on disk: ${unresolved.join(", ")}`, { path: absoluteResultPath, retryable: false });
|
|
56
|
+
deps.recordWorkerFailure(run, workerId, error, { ...options, persist: options.persist });
|
|
57
|
+
throw new Error(error.message);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
run,
|
|
62
|
+
workerId,
|
|
63
|
+
options,
|
|
64
|
+
scope,
|
|
65
|
+
task,
|
|
66
|
+
absoluteResultPath,
|
|
67
|
+
rawResult,
|
|
68
|
+
parsedResult,
|
|
69
|
+
destination: "",
|
|
70
|
+
pathAuditId: "",
|
|
71
|
+
acceptedAuditId: "",
|
|
72
|
+
resultNode: undefined,
|
|
73
|
+
verifierNodeId: "",
|
|
74
|
+
verifierStatus: "",
|
|
75
|
+
output: undefined
|
|
76
|
+
};
|
|
77
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runWorkerVerify = runWorkerVerify;
|
|
4
|
+
exports.recordWorkerCompletion = recordWorkerCompletion;
|
|
5
|
+
const pipeline_runner_1 = require("../pipeline-runner");
|
|
6
|
+
const telemetry_attestation_1 = require("../telemetry-attestation");
|
|
7
|
+
const execution_backend_1 = require("../execution-backend");
|
|
8
|
+
/** Step 5 — runVerify: drive the verify pipeline stage off the accepted result node
|
|
9
|
+
* and record the verifier node id on the task + accept context. */
|
|
10
|
+
function runWorkerVerify(accept) {
|
|
11
|
+
const { run, workerId, scope, task, parsedResult, destination, resultNode } = accept;
|
|
12
|
+
const verifierResult = (0, pipeline_runner_1.createPipelineRunner)({ persist: false }).runPipelineStage(run, "verify", resultNode.id, {
|
|
13
|
+
outputNodeId: `${run.id}:verifier:${task.id}`,
|
|
14
|
+
outputStatus: "verified",
|
|
15
|
+
loopStage: "adjust",
|
|
16
|
+
outputs: { accepted: true, workerId },
|
|
17
|
+
artifacts: [{ id: "result", kind: "markdown", path: destination }],
|
|
18
|
+
evidence: resultNode.evidence.length
|
|
19
|
+
? resultNode.evidence
|
|
20
|
+
: [{ id: "result:summary", source: "summary", summary: parsedResult.summary }],
|
|
21
|
+
metadata: { taskId: task.id, workerId, resultNodeId: resultNode.id, sandboxProfileId: scope.sandboxProfileId }
|
|
22
|
+
});
|
|
23
|
+
task.verifierNodeId = verifierResult.outputNodeId;
|
|
24
|
+
accept.verifierNodeId = verifierResult.outputNodeId;
|
|
25
|
+
// Carry the verify verdict for the scope-status transition in recordWorkerCompletion.
|
|
26
|
+
accept.verifierStatus = verifierResult.status;
|
|
27
|
+
}
|
|
28
|
+
/** Step 6 — recordStateNode (worker record): assemble the worker output record +
|
|
29
|
+
* host-attested usage record, then persist the worker scope with the verify-derived
|
|
30
|
+
* status, output digest/size, and (when present) usage. */
|
|
31
|
+
function recordWorkerCompletion(accept, delegation, deps) {
|
|
32
|
+
const { run, workerId, scope, task, absoluteResultPath, rawResult, resultNode, verifierNodeId, verifierStatus, pathAuditId, acceptedAuditId } = accept;
|
|
33
|
+
const { agentDelegation, telemetry } = delegation;
|
|
34
|
+
const output = {
|
|
35
|
+
workerId,
|
|
36
|
+
taskId: task.id,
|
|
37
|
+
resultPath: absoluteResultPath,
|
|
38
|
+
recordedAt: new Date().toISOString(),
|
|
39
|
+
stateNodeId: resultNode.id,
|
|
40
|
+
verifierNodeId,
|
|
41
|
+
auditEventIds: [pathAuditId, acceptedAuditId]
|
|
42
|
+
};
|
|
43
|
+
// Host-attested usage rides on the worker record. Recorded when the agent
|
|
44
|
+
// REPORTED a model OR token usage — `unreported`/absent stays ABSENT (never
|
|
45
|
+
// backfilled from the operator-chosen CW_AGENT_MODEL, never synthesized).
|
|
46
|
+
// Track 1: the attestation verdict (`attested`/`unattested`/`absent`) and its
|
|
47
|
+
// reason ride along, and the token buckets come from the (verified-or-not)
|
|
48
|
+
// reported usage — CW still never measures them, it records + labels them.
|
|
49
|
+
const reportedModel = agentDelegation && agentDelegation.model && agentDelegation.model !== "unreported" ? agentDelegation.model : undefined;
|
|
50
|
+
const usageRecord = agentDelegation && (reportedModel || agentDelegation.reportedUsage)
|
|
51
|
+
? {
|
|
52
|
+
schemaVersion: 1,
|
|
53
|
+
source: "host-attested",
|
|
54
|
+
...(reportedModel ? { model: reportedModel } : {}),
|
|
55
|
+
...(0, telemetry_attestation_1.normalizeReportedUsage)(agentDelegation.reportedUsage),
|
|
56
|
+
attestedAt: new Date().toISOString(),
|
|
57
|
+
...(telemetry ? { attestation: telemetry.status, ...(telemetry.reason ? { attestationReason: telemetry.reason } : {}) } : {}),
|
|
58
|
+
note: "agent-delegation host-attested usage"
|
|
59
|
+
}
|
|
60
|
+
: undefined;
|
|
61
|
+
deps.updateWorkerScope(run, {
|
|
62
|
+
...scope,
|
|
63
|
+
updatedAt: new Date().toISOString(),
|
|
64
|
+
status: verifierStatus === "advanced" ? "verified" : "completed",
|
|
65
|
+
resultNodeId: resultNode.id,
|
|
66
|
+
output,
|
|
67
|
+
// Output integrity (v0.1.63): SHA256 digest + file size
|
|
68
|
+
outputDigest: (0, execution_backend_1.sha256)(rawResult),
|
|
69
|
+
outputSizeBytes: Buffer.byteLength(rawResult, "utf8"),
|
|
70
|
+
...(usageRecord ? { usage: usageRecord } : {})
|
|
71
|
+
});
|
|
72
|
+
accept.output = output;
|
|
73
|
+
}
|