cool-workflow 0.1.97 → 0.2.0
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 +11 -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/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 +3534 -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/{doctor.js → shell/doctor.js} +123 -56
- package/dist/shell/drive.js +873 -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 +475 -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 +98 -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 +329 -0
- package/dist/{remote-source.js → shell/remote-source.js} +12 -5
- 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} +248 -48
- package/dist/shell/scheduling-io.js +311 -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 +471 -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 +250 -0
- package/dist/shell/workbench-text.js +18 -0
- package/dist/shell/workbench.js +175 -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 +284 -211
- package/docs/contract-migration-tooling.7.md +4 -0
- package/docs/control-plane-scheduling.7.md +4 -0
- package/docs/cross-agent-ledger.7.md +217 -0
- package/docs/designs/handoff-ledger.md +145 -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/handoff-setup.md +120 -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 +4 -0
- package/docs/project-index.md +143 -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/run-registry-control-plane.7.md +4 -0
- package/docs/run-retention-reclamation.7.md +25 -0
- package/docs/state-explosion-management.7.md +4 -0
- package/docs/team-collaboration.7.md +4 -0
- package/docs/web-desktop-workbench.7.md +4 -0
- package/manifest/plugin.manifest.json +1 -1
- package/manifest/source-context-profiles.json +9 -13
- package/package.json +1 -1
- package/scripts/agents/codex-agent.js +34 -4
- package/scripts/agents/cw-attest-wrap.js +2 -2
- package/scripts/bump-version.js +4 -3
- package/scripts/canonical-apps.js +4 -4
- package/scripts/children/batch-delegate-child.js +30 -10
- 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 +9 -3
- 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 -1186
- package/dist/capability-registry.js +0 -879
- package/dist/cli/command-surface.js +0 -490
- 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/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/drive.js +0 -827
- package/dist/error-feedback.js +0 -419
- package/dist/evidence-grounding.js +0 -184
- package/dist/execution-backend/agent.js +0 -294
- 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/loop-expansion.js +0 -60
- package/dist/mcp/tool-call.js +0 -434
- package/dist/mcp/tool-definitions.js +0 -1040
- 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 -626
- 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 -917
- 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 -784
- 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 -182
- 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
|
@@ -1,211 +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.loadWorkflowFiles = loadWorkflowFiles;
|
|
7
|
-
exports.loadAppManifestFiles = loadAppManifestFiles;
|
|
8
|
-
exports.loadWorkflowApps = loadWorkflowApps;
|
|
9
|
-
exports.loadWorkflowAppById = loadWorkflowAppById;
|
|
10
|
-
exports.loadWorkflowAppTarget = loadWorkflowAppTarget;
|
|
11
|
-
exports.listWorkflows = listWorkflows;
|
|
12
|
-
exports.listApps = listApps;
|
|
13
|
-
exports.showApp = showApp;
|
|
14
|
-
exports.validateApp = validateApp;
|
|
15
|
-
exports.initApp = initApp;
|
|
16
|
-
exports.packageApp = packageApp;
|
|
17
|
-
// Workflow-app management domain operations (v0.1.40 self-audit router pattern).
|
|
18
|
-
// Carved out of CoolWorkflowRunner; pure functions (no instance state). Behavior
|
|
19
|
-
// is identical to the inline versions — the runner-owned calls (resolveFromBase,
|
|
20
|
-
// validateApp) are passed as callbacks so the bodies stay byte-identical.
|
|
21
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
22
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
23
|
-
const workflow_api_1 = require("../workflow-api");
|
|
24
|
-
const state_1 = require("../state");
|
|
25
|
-
const workflow_app_framework_1 = require("../workflow-app-framework");
|
|
26
|
-
const cli_options_1 = require("./cli-options");
|
|
27
|
-
function loadWorkflowFiles(workflowsDir) {
|
|
28
|
-
if (!node_fs_1.default.existsSync(workflowsDir))
|
|
29
|
-
return [];
|
|
30
|
-
return node_fs_1.default
|
|
31
|
-
.readdirSync(workflowsDir)
|
|
32
|
-
.filter((file) => file.endsWith(".workflow.js"))
|
|
33
|
-
.sort()
|
|
34
|
-
.map((file) => node_path_1.default.join(workflowsDir, file));
|
|
35
|
-
}
|
|
36
|
-
function loadAppManifestFiles(appsDir) {
|
|
37
|
-
if (!node_fs_1.default.existsSync(appsDir))
|
|
38
|
-
return [];
|
|
39
|
-
return node_fs_1.default
|
|
40
|
-
.readdirSync(appsDir, { withFileTypes: true })
|
|
41
|
-
.filter((entry) => entry.isDirectory())
|
|
42
|
-
.map((entry) => node_path_1.default.join(appsDir, entry.name, "app.json"))
|
|
43
|
-
.filter((file) => node_fs_1.default.existsSync(file))
|
|
44
|
-
.sort();
|
|
45
|
-
}
|
|
46
|
-
function loadWorkflowApps(workflowsDir, appsDir) {
|
|
47
|
-
const records = [
|
|
48
|
-
...loadWorkflowFiles(workflowsDir).map((file) => (0, workflow_app_framework_1.loadWorkflowAppFromEntrypoint)(file)),
|
|
49
|
-
...loadAppManifestFiles(appsDir).map((file) => (0, workflow_app_framework_1.loadWorkflowAppFromManifest)(file))
|
|
50
|
-
].sort((left, right) => {
|
|
51
|
-
const byId = left.app.id.localeCompare(right.app.id);
|
|
52
|
-
if (byId)
|
|
53
|
-
return byId;
|
|
54
|
-
return (left.source.manifestPath || left.source.entrypointPath || left.source.path)
|
|
55
|
-
.localeCompare(right.source.manifestPath || right.source.entrypointPath || right.source.path);
|
|
56
|
-
});
|
|
57
|
-
const seen = new Map();
|
|
58
|
-
for (const record of records) {
|
|
59
|
-
const previous = seen.get(record.app.id);
|
|
60
|
-
if (previous) {
|
|
61
|
-
throw new Error(`Duplicate workflow app id ${record.app.id}: ${previous.source.manifestPath || previous.source.entrypointPath || previous.source.path} and ${record.source.manifestPath || record.source.entrypointPath || record.source.path}`);
|
|
62
|
-
}
|
|
63
|
-
seen.set(record.app.id, record);
|
|
64
|
-
}
|
|
65
|
-
return records;
|
|
66
|
-
}
|
|
67
|
-
function loadWorkflowAppById(workflowsDir, appsDir, appId) {
|
|
68
|
-
const record = loadWorkflowApps(workflowsDir, appsDir).find((candidate) => candidate.app.id === appId);
|
|
69
|
-
if (!record)
|
|
70
|
-
throw new Error(`Workflow app not found: ${appId}`);
|
|
71
|
-
return record;
|
|
72
|
-
}
|
|
73
|
-
// The runner pre-resolves `target` via resolveFromBase and passes the resolved
|
|
74
|
-
// path; the original `target` is still used for the id-fallback lookup.
|
|
75
|
-
function loadWorkflowAppTarget(workflowsDir, appsDir, resolved, target) {
|
|
76
|
-
if (!target)
|
|
77
|
-
throw new Error("Missing workflow app path or id");
|
|
78
|
-
if (node_fs_1.default.existsSync(resolved)) {
|
|
79
|
-
const stat = node_fs_1.default.statSync(resolved);
|
|
80
|
-
if (stat.isDirectory())
|
|
81
|
-
return (0, workflow_app_framework_1.loadWorkflowAppFromManifest)(node_path_1.default.join(resolved, "app.json"));
|
|
82
|
-
if (node_path_1.default.basename(resolved) === "app.json" || resolved.endsWith(".json"))
|
|
83
|
-
return (0, workflow_app_framework_1.loadWorkflowAppFromManifest)(resolved);
|
|
84
|
-
return (0, workflow_app_framework_1.loadWorkflowAppFromEntrypoint)(resolved);
|
|
85
|
-
}
|
|
86
|
-
return loadWorkflowAppById(workflowsDir, appsDir, target);
|
|
87
|
-
}
|
|
88
|
-
function listWorkflows(workflowsDir, appsDir) {
|
|
89
|
-
return loadWorkflowApps(workflowsDir, appsDir).map((record) => {
|
|
90
|
-
const summary = (0, workflow_app_framework_1.summarizeWorkflowApp)(record);
|
|
91
|
-
return {
|
|
92
|
-
id: summary.id,
|
|
93
|
-
title: summary.title,
|
|
94
|
-
summary: summary.summary,
|
|
95
|
-
file: summary.file
|
|
96
|
-
};
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
function listApps(workflowsDir, appsDir) {
|
|
100
|
-
return loadWorkflowApps(workflowsDir, appsDir).map((record) => (0, workflow_app_framework_1.summarizeWorkflowApp)(record));
|
|
101
|
-
}
|
|
102
|
-
function showApp(workflowsDir, appsDir, appId) {
|
|
103
|
-
const record = loadWorkflowAppById(workflowsDir, appsDir, appId);
|
|
104
|
-
const summary = (0, workflow_app_framework_1.summarizeWorkflowApp)(record);
|
|
105
|
-
return {
|
|
106
|
-
...summary,
|
|
107
|
-
source: record.source,
|
|
108
|
-
app: {
|
|
109
|
-
schemaVersion: record.app.schemaVersion,
|
|
110
|
-
id: record.app.id,
|
|
111
|
-
title: record.app.title,
|
|
112
|
-
summary: record.app.summary || "",
|
|
113
|
-
version: record.app.version,
|
|
114
|
-
author: record.app.author,
|
|
115
|
-
inputs: record.app.inputs || record.app.workflow.inputs,
|
|
116
|
-
sandboxProfiles: record.app.sandboxProfiles || record.app.workflow.sandboxProfiles || [],
|
|
117
|
-
compatibility: record.app.compatibility,
|
|
118
|
-
metadata: record.app.metadata || {}
|
|
119
|
-
},
|
|
120
|
-
workflow: {
|
|
121
|
-
id: record.app.workflow.id,
|
|
122
|
-
title: record.app.workflow.title,
|
|
123
|
-
summary: record.app.workflow.summary || "",
|
|
124
|
-
limits: record.app.workflow.limits,
|
|
125
|
-
inputs: record.app.workflow.inputs,
|
|
126
|
-
sandboxProfiles: record.app.workflow.sandboxProfiles || [],
|
|
127
|
-
phases: record.app.workflow.phases.map((phase) => ({
|
|
128
|
-
id: phase.id,
|
|
129
|
-
name: phase.name,
|
|
130
|
-
status: phase.status,
|
|
131
|
-
tasks: phase.tasks.map((task) => ({
|
|
132
|
-
id: task.id,
|
|
133
|
-
kind: task.kind,
|
|
134
|
-
requiresEvidence: Boolean(task.requiresEvidence),
|
|
135
|
-
sandboxProfileId: task.sandboxProfileId
|
|
136
|
-
}))
|
|
137
|
-
}))
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
// The runner pre-resolves `target` via resolveFromBase and passes the resolved
|
|
142
|
-
// path; both the try-loader and the catch-branch appPath use resolvedTarget.
|
|
143
|
-
function validateApp(workflowsDir, appsDir, target, resolvedTarget) {
|
|
144
|
-
try {
|
|
145
|
-
const record = loadWorkflowAppTarget(workflowsDir, appsDir, resolvedTarget, target);
|
|
146
|
-
const result = (0, workflow_app_framework_1.validateWorkflowApp)(record.app, {
|
|
147
|
-
appPath: record.source.manifestPath || record.source.entrypointPath || record.source.path
|
|
148
|
-
});
|
|
149
|
-
return {
|
|
150
|
-
...result,
|
|
151
|
-
summary: (0, workflow_app_framework_1.summarizeWorkflowApp)(record)
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
catch (error) {
|
|
155
|
-
const issues = (0, cli_options_1.validationIssuesFromError)(error);
|
|
156
|
-
return {
|
|
157
|
-
valid: false,
|
|
158
|
-
appId: target,
|
|
159
|
-
appPath: resolvedTarget,
|
|
160
|
-
issues
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
// resolveFromBase and validateApp are passed as callbacks so the body stays
|
|
165
|
-
// byte-identical to the runner method (resolveFromBase(...) and validateApp(manifestPath)).
|
|
166
|
-
function initApp(appsDir, appId, options, resolveFromBase, validateApp) {
|
|
167
|
-
const id = (0, workflow_api_1.slugify)(appId);
|
|
168
|
-
if (!id)
|
|
169
|
-
throw new Error("App id must include at least one letter or digit");
|
|
170
|
-
const title = String(options.title || titleize(id));
|
|
171
|
-
const destinationDir = resolveFromBase(String(options.directory || options.output || node_path_1.default.join(appsDir, id)));
|
|
172
|
-
// Reject writes to system-owned directories. The operator may provide any
|
|
173
|
-
// output path, but writing to /etc, /bin, /usr etc. is never valid.
|
|
174
|
-
const sysDirs = /^\/(etc|bin|sbin|usr|Library|System|Applications|boot|dev|proc|sys|root|var\/log|var\/run)\//;
|
|
175
|
-
if (sysDirs.test(node_path_1.default.resolve(destinationDir))) {
|
|
176
|
-
throw new Error(`Refusing to create app in a system directory: ${destinationDir}`);
|
|
177
|
-
}
|
|
178
|
-
const manifestPath = node_path_1.default.join(destinationDir, "app.json");
|
|
179
|
-
const entrypointPath = node_path_1.default.join(destinationDir, "workflow.js");
|
|
180
|
-
if (!options.force && (node_fs_1.default.existsSync(manifestPath) || node_fs_1.default.existsSync(entrypointPath))) {
|
|
181
|
-
throw new Error(`Refusing to overwrite existing workflow app: ${destinationDir}`);
|
|
182
|
-
}
|
|
183
|
-
node_fs_1.default.mkdirSync(destinationDir, { recursive: true });
|
|
184
|
-
node_fs_1.default.writeFileSync(manifestPath, (0, workflow_app_framework_1.renderWorkflowAppManifestTemplate)(id, title), "utf8");
|
|
185
|
-
node_fs_1.default.writeFileSync(entrypointPath, (0, workflow_app_framework_1.renderWorkflowAppEntrypointTemplate)(id, title), "utf8");
|
|
186
|
-
const validation = validateApp(manifestPath);
|
|
187
|
-
if (!validation.valid) {
|
|
188
|
-
throw new workflow_app_framework_1.WorkflowAppValidationError("Generated workflow app is invalid", validation.issues);
|
|
189
|
-
}
|
|
190
|
-
return { id, manifestPath, entrypointPath };
|
|
191
|
-
}
|
|
192
|
-
// resolveFromBase is passed as a callback so the body stays byte-identical.
|
|
193
|
-
function packageApp(workflowsDir, appsDir, appId, options, resolveFromBase) {
|
|
194
|
-
const record = loadWorkflowAppById(workflowsDir, appsDir, appId);
|
|
195
|
-
const destination = resolveFromBase(String(options.output || node_path_1.default.join(".cw", "packages", `${record.app.id}-${record.app.version}.cwapp.json`)));
|
|
196
|
-
node_fs_1.default.mkdirSync(node_path_1.default.dirname(destination), { recursive: true });
|
|
197
|
-
(0, state_1.writeJson)(destination, {
|
|
198
|
-
schemaVersion: 1,
|
|
199
|
-
app: (0, workflow_app_framework_1.workflowAppRunMetadata)(record),
|
|
200
|
-
workflow: record.app.workflow,
|
|
201
|
-
packagedAt: new Date().toISOString()
|
|
202
|
-
});
|
|
203
|
-
return { id: record.app.id, version: record.app.version, path: destination };
|
|
204
|
-
}
|
|
205
|
-
function titleize(value) {
|
|
206
|
-
return value
|
|
207
|
-
.split("-")
|
|
208
|
-
.filter(Boolean)
|
|
209
|
-
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
210
|
-
.join(" ");
|
|
211
|
-
}
|
|
@@ -1,182 +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.auditSummary = auditSummary;
|
|
7
|
-
exports.auditMultiAgent = auditMultiAgent;
|
|
8
|
-
exports.auditPolicy = auditPolicy;
|
|
9
|
-
exports.auditRole = auditRole;
|
|
10
|
-
exports.auditBlackboard = auditBlackboard;
|
|
11
|
-
exports.auditJudge = auditJudge;
|
|
12
|
-
exports.workerAudit = workerAudit;
|
|
13
|
-
exports.auditEvidenceProvenance = auditEvidenceProvenance;
|
|
14
|
-
exports.recordAuditAttestation = recordAuditAttestation;
|
|
15
|
-
exports.recordAuditDecision = recordAuditDecision;
|
|
16
|
-
// Audit domain operations (v0.1.40 self-audit P3 maintainability).
|
|
17
|
-
//
|
|
18
|
-
// Carved out of the CoolWorkflowRunner god-object as the first domain in the
|
|
19
|
-
// router pattern: every function here takes an already-loaded WorkflowRun and
|
|
20
|
-
// returns a value (mutating ops persist via the run), so the runner method is a
|
|
21
|
-
// thin `loadRun -> delegate` wrapper. Behavior is identical to the inline
|
|
22
|
-
// implementations these replaced; only the location changed.
|
|
23
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
24
|
-
const state_1 = require("../state");
|
|
25
|
-
const report_1 = require("./report");
|
|
26
|
-
const cli_options_1 = require("./cli-options");
|
|
27
|
-
const worker_isolation_1 = require("../worker-isolation");
|
|
28
|
-
const sandbox_profile_1 = require("../sandbox-profile");
|
|
29
|
-
const trust_audit_1 = require("../trust-audit");
|
|
30
|
-
const multi_agent_trust_1 = require("../multi-agent-trust");
|
|
31
|
-
function auditSummary(run) {
|
|
32
|
-
return (0, trust_audit_1.summarizeTrustAudit)(run);
|
|
33
|
-
}
|
|
34
|
-
function auditMultiAgent(run) {
|
|
35
|
-
return (0, multi_agent_trust_1.summarizeMultiAgentTrust)(run);
|
|
36
|
-
}
|
|
37
|
-
function auditPolicy(run) {
|
|
38
|
-
const summary = (0, multi_agent_trust_1.summarizeMultiAgentTrust)(run);
|
|
39
|
-
return {
|
|
40
|
-
schemaVersion: 1,
|
|
41
|
-
runId: run.id,
|
|
42
|
-
rolePolicies: summary.rolePolicies,
|
|
43
|
-
permissionDecisions: summary.permissionDecisions,
|
|
44
|
-
policyViolations: summary.policyViolations,
|
|
45
|
-
nextAction: summary.nextAction
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
function auditRole(run, roleId) {
|
|
49
|
-
const summary = (0, multi_agent_trust_1.summarizeMultiAgentTrust)(run);
|
|
50
|
-
const events = (0, trust_audit_1.listTrustAuditEvents)(run).filter((event) => event.agentRoleId === roleId);
|
|
51
|
-
return {
|
|
52
|
-
schemaVersion: 1,
|
|
53
|
-
runId: run.id,
|
|
54
|
-
roleId,
|
|
55
|
-
role: run.multiAgent?.roles.find((entry) => entry.id === roleId),
|
|
56
|
-
rolePolicies: summary.rolePolicies.filter((entry) => entry.subjectId === roleId),
|
|
57
|
-
permissionDecisions: events.filter((event) => event.kind === "multi-agent.permission"),
|
|
58
|
-
blackboardWrites: events.filter((event) => event.kind === "blackboard.write"),
|
|
59
|
-
messageProvenance: events.filter((event) => event.kind === "blackboard.message-provenance"),
|
|
60
|
-
judgeRationales: events.filter((event) => event.kind === "judge.rationale"),
|
|
61
|
-
panelDecisions: events.filter((event) => event.kind === "judge.panel-decision"),
|
|
62
|
-
policyViolations: events.filter((event) => event.kind === "policy.violation"),
|
|
63
|
-
events,
|
|
64
|
-
nextAction: `node scripts/cw.js audit multi-agent ${run.id} --json`
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
function auditBlackboard(run) {
|
|
68
|
-
const summary = (0, multi_agent_trust_1.summarizeMultiAgentTrust)(run);
|
|
69
|
-
return {
|
|
70
|
-
schemaVersion: 1,
|
|
71
|
-
runId: run.id,
|
|
72
|
-
blackboardWrites: summary.blackboardWrites,
|
|
73
|
-
messageProvenance: summary.messageProvenance,
|
|
74
|
-
policyViolations: summary.policyViolations.filter((event) => event.blackboardId),
|
|
75
|
-
nextAction: summary.nextAction
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
function auditJudge(run) {
|
|
79
|
-
const summary = (0, multi_agent_trust_1.summarizeMultiAgentTrust)(run);
|
|
80
|
-
return {
|
|
81
|
-
schemaVersion: 1,
|
|
82
|
-
runId: run.id,
|
|
83
|
-
judgeRationales: summary.judgeRationales,
|
|
84
|
-
panelDecisions: summary.panelDecisions,
|
|
85
|
-
permissionDecisions: summary.permissionDecisions.filter((event) => String(event.metadata?.operation || "").startsWith("judge.")),
|
|
86
|
-
policyViolations: summary.policyViolations.filter((event) => String(event.metadata?.operation || "").startsWith("judge.")),
|
|
87
|
-
nextAction: summary.nextAction
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
function workerAudit(run, workerId) {
|
|
91
|
-
return (0, trust_audit_1.workerTrustAudit)(run, workerId);
|
|
92
|
-
}
|
|
93
|
-
function auditEvidenceProvenance(run, options = {}) {
|
|
94
|
-
return (0, trust_audit_1.evidenceProvenance)(run, {
|
|
95
|
-
workerId: (0, cli_options_1.stringOption)(options.worker || options.workerId),
|
|
96
|
-
candidateId: (0, cli_options_1.stringOption)(options.candidate || options.candidateId),
|
|
97
|
-
commitId: (0, cli_options_1.stringOption)(options.commit || options.commitId)
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
function recordAuditAttestation(run, options = {}) {
|
|
101
|
-
const workerId = (0, cli_options_1.stringOption)(options.worker || options.workerId);
|
|
102
|
-
const worker = workerId ? (0, worker_isolation_1.getWorkerScope)(run, workerId) : undefined;
|
|
103
|
-
const event = (0, trust_audit_1.recordHostAttestation)(run, {
|
|
104
|
-
actor: (0, cli_options_1.stringOption)(options.actor) || "host",
|
|
105
|
-
workerId,
|
|
106
|
-
taskId: worker?.taskId || (0, cli_options_1.stringOption)(options.task || options.taskId),
|
|
107
|
-
sandboxProfileId: worker?.sandboxProfileId || (0, cli_options_1.stringOption)(options.sandboxProfileId),
|
|
108
|
-
policySnapshot: worker?.sandboxPolicy,
|
|
109
|
-
command: (0, cli_options_1.stringOption)(options.command),
|
|
110
|
-
networkTarget: (0, cli_options_1.stringOption)(options.network || options.networkTarget),
|
|
111
|
-
envVars: (0, cli_options_1.valuesOption)(options.env || options.envVar || options.envVars),
|
|
112
|
-
metadata: {
|
|
113
|
-
note: (0, cli_options_1.stringOption)(options.note || options.message),
|
|
114
|
-
hostEnforced: options.hostEnforced === undefined ? undefined : Boolean(options.hostEnforced)
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
(0, state_1.saveCheckpoint)(run);
|
|
118
|
-
return event;
|
|
119
|
-
}
|
|
120
|
-
function recordAuditDecision(run, workerId, options = {}) {
|
|
121
|
-
const worker = (0, worker_isolation_1.getWorkerScope)(run, workerId);
|
|
122
|
-
if (!worker)
|
|
123
|
-
throw new Error(`Unknown worker id for run ${run.id}: ${workerId}`);
|
|
124
|
-
const kind = (0, cli_options_1.stringOption)(options.kind) || (0, cli_options_1.inferAuditDecisionKind)(options);
|
|
125
|
-
const target = (0, cli_options_1.stringOption)(options.path || options.command || options.network || options.networkTarget || options.env || options.envVar);
|
|
126
|
-
if (!target)
|
|
127
|
-
throw new Error("Missing audit decision target: provide --path, --command, --network, or --env");
|
|
128
|
-
const policy = worker.sandboxPolicy;
|
|
129
|
-
let denied = null;
|
|
130
|
-
if (kind === "sandbox.command") {
|
|
131
|
-
denied = policy ? (0, sandbox_profile_1.validateSandboxCommand)(policy, target, workerId) : null;
|
|
132
|
-
}
|
|
133
|
-
else if (kind === "sandbox.network") {
|
|
134
|
-
denied = policy ? (0, sandbox_profile_1.validateSandboxNetwork)(policy, target, workerId) : null;
|
|
135
|
-
}
|
|
136
|
-
else if (kind === "sandbox.env") {
|
|
137
|
-
const name = target.includes("=") ? target.split("=")[0] : target;
|
|
138
|
-
const allowed = Boolean(policy?.env.inherit || policy?.env.expose.includes(name));
|
|
139
|
-
denied = allowed ? null : { code: "sandbox-env-denied", message: `Worker ${workerId} env var is outside sandbox profile ${policy?.id || "unknown"}: ${name}` };
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
denied = (0, worker_isolation_1.validateWorkerBoundary)(run, workerId, { path: target });
|
|
143
|
-
}
|
|
144
|
-
const feedbackIds = [];
|
|
145
|
-
if (denied) {
|
|
146
|
-
const failure = (0, worker_isolation_1.recordWorkerFailure)(run, workerId, {
|
|
147
|
-
code: denied.code,
|
|
148
|
-
message: denied.message,
|
|
149
|
-
at: new Date().toISOString(),
|
|
150
|
-
path: denied.path || (kind === "sandbox.path" ? node_path_1.default.resolve(target) : undefined),
|
|
151
|
-
retryable: false
|
|
152
|
-
}, { persist: false });
|
|
153
|
-
feedbackIds.push(...(failure.feedbackIds || []));
|
|
154
|
-
}
|
|
155
|
-
const event = kind === "sandbox.path"
|
|
156
|
-
? (0, trust_audit_1.recordSandboxPathDecision)(run, {
|
|
157
|
-
workerId,
|
|
158
|
-
taskId: worker.taskId,
|
|
159
|
-
sandboxProfileId: worker.sandboxProfileId,
|
|
160
|
-
policySnapshot: policy,
|
|
161
|
-
target,
|
|
162
|
-
decision: denied ? "denied" : "allowed",
|
|
163
|
-
feedbackIds,
|
|
164
|
-
metadata: { code: denied?.code }
|
|
165
|
-
})
|
|
166
|
-
: (0, trust_audit_1.recordSandboxPolicyDecision)(run, {
|
|
167
|
-
kind,
|
|
168
|
-
decision: denied ? "denied" : "allowed",
|
|
169
|
-
workerId,
|
|
170
|
-
taskId: worker.taskId,
|
|
171
|
-
sandboxProfileId: worker.sandboxProfileId,
|
|
172
|
-
policySnapshot: policy,
|
|
173
|
-
command: kind === "sandbox.command" ? target : undefined,
|
|
174
|
-
networkTarget: kind === "sandbox.network" ? target : undefined,
|
|
175
|
-
envVars: kind === "sandbox.env" ? [target.includes("=") ? target.split("=")[0] : target] : undefined,
|
|
176
|
-
feedbackIds,
|
|
177
|
-
metadata: { code: denied?.code }
|
|
178
|
-
});
|
|
179
|
-
(0, report_1.writeReport)(run);
|
|
180
|
-
(0, state_1.saveCheckpoint)(run);
|
|
181
|
-
return event;
|
|
182
|
-
}
|
|
@@ -1,117 +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.listCandidates = listCandidates;
|
|
7
|
-
exports.showCandidate = showCandidate;
|
|
8
|
-
exports.registerCandidate = registerCandidate;
|
|
9
|
-
exports.scoreCandidate = scoreCandidate;
|
|
10
|
-
exports.rankCandidates = rankCandidates;
|
|
11
|
-
exports.selectCandidate = selectCandidate;
|
|
12
|
-
exports.rejectCandidate = rejectCandidate;
|
|
13
|
-
// Candidate domain operations (v0.1.40 self-audit P3 router pattern).
|
|
14
|
-
// Carved out of CoolWorkflowRunner; each function takes a loaded run. Behavior is
|
|
15
|
-
// identical to the inline implementations — only the location changed.
|
|
16
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
17
|
-
const state_1 = require("../state");
|
|
18
|
-
const report_1 = require("./report");
|
|
19
|
-
const cli_options_1 = require("./cli-options");
|
|
20
|
-
const worker_isolation_1 = require("../worker-isolation");
|
|
21
|
-
const candidate_scoring_1 = require("../candidate-scoring");
|
|
22
|
-
function listCandidates(run, options = {}) {
|
|
23
|
-
return (0, candidate_scoring_1.listCandidates)(run, {
|
|
24
|
-
status: options.status ? String(options.status) : undefined,
|
|
25
|
-
kind: options.kind ? String(options.kind) : undefined
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
function showCandidate(run, candidateId) {
|
|
29
|
-
const candidate = (0, candidate_scoring_1.getCandidate)(run, candidateId);
|
|
30
|
-
if (!candidate)
|
|
31
|
-
throw new Error(`Unknown candidate id for run ${run.id}: ${candidateId}`);
|
|
32
|
-
return candidate;
|
|
33
|
-
}
|
|
34
|
-
function registerCandidate(run, options = {}) {
|
|
35
|
-
const workerId = options.worker ? String(options.worker) : undefined;
|
|
36
|
-
const worker = workerId ? (0, worker_isolation_1.getWorkerScope)(run, workerId) : undefined;
|
|
37
|
-
if (workerId && !worker)
|
|
38
|
-
throw new Error(`Unknown worker id for run ${run.id}: ${workerId}`);
|
|
39
|
-
const task = worker ? run.tasks.find((candidate) => candidate.id === worker.taskId) : undefined;
|
|
40
|
-
const resultNodeId = (0, cli_options_1.stringOption)(options.resultNode) || worker?.resultNodeId || task?.resultNodeId;
|
|
41
|
-
const verifierNodeId = (0, cli_options_1.stringOption)(options.verifierNode) || worker?.output?.verifierNodeId || task?.verifierNodeId;
|
|
42
|
-
const resultPath = (0, cli_options_1.stringOption)(options.resultPath) || worker?.output?.resultPath || task?.resultPath;
|
|
43
|
-
const resultNode = resultNodeId ? run.nodes?.find((node) => node.id === resultNodeId) : undefined;
|
|
44
|
-
const verifierNode = verifierNodeId ? run.nodes?.find((node) => node.id === verifierNodeId) : undefined;
|
|
45
|
-
const candidate = (0, candidate_scoring_1.registerCandidate)(run, {
|
|
46
|
-
id: (0, cli_options_1.stringOption)(options.id),
|
|
47
|
-
kind: (0, cli_options_1.stringOption)(options.kind),
|
|
48
|
-
workerId,
|
|
49
|
-
taskId: (0, cli_options_1.stringOption)(options.task) || worker?.taskId,
|
|
50
|
-
resultNodeId,
|
|
51
|
-
verifierNodeId,
|
|
52
|
-
resultPath,
|
|
53
|
-
artifacts: [
|
|
54
|
-
...(resultPath ? [{ id: "result", kind: "markdown", path: node_path_1.default.resolve(resultPath) }] : []),
|
|
55
|
-
...(worker ? [{ id: "worker", kind: "json", path: node_path_1.default.join(worker.workerDir, "worker.json") }] : [])
|
|
56
|
-
],
|
|
57
|
-
evidence: (0, cli_options_1.mergeEvidence)(resultNode?.evidence || [], verifierNode?.evidence || []),
|
|
58
|
-
metadata: {
|
|
59
|
-
source: worker ? "worker" : "manual",
|
|
60
|
-
workerDir: worker?.workerDir
|
|
61
|
-
}
|
|
62
|
-
}, { persist: false });
|
|
63
|
-
(0, report_1.writeReport)(run);
|
|
64
|
-
(0, state_1.saveCheckpoint)(run);
|
|
65
|
-
return candidate;
|
|
66
|
-
}
|
|
67
|
-
function scoreCandidate(run, candidateId, options = {}) {
|
|
68
|
-
const score = (0, candidate_scoring_1.scoreCandidate)(run, candidateId, {
|
|
69
|
-
id: (0, cli_options_1.stringOption)(options.id),
|
|
70
|
-
scorer: (0, cli_options_1.stringOption)(options.scorer),
|
|
71
|
-
criteria: (0, cli_options_1.parseCriteria)(options),
|
|
72
|
-
maxTotal: (0, cli_options_1.numberOption)(options.maxTotal || options.max),
|
|
73
|
-
verdict: (0, cli_options_1.stringOption)(options.verdict),
|
|
74
|
-
evidence: (0, cli_options_1.parseEvidence)(options.evidence),
|
|
75
|
-
notes: (0, cli_options_1.stringOption)(options.notes)
|
|
76
|
-
}, { persist: false });
|
|
77
|
-
(0, report_1.writeReport)(run);
|
|
78
|
-
(0, state_1.saveCheckpoint)(run);
|
|
79
|
-
return score;
|
|
80
|
-
}
|
|
81
|
-
function rankCandidates(run, options = {}) {
|
|
82
|
-
const ranking = (0, candidate_scoring_1.rankCandidates)(run, {
|
|
83
|
-
includeRejected: Boolean(options.includeRejected),
|
|
84
|
-
policy: {
|
|
85
|
-
minNormalized: (0, cli_options_1.numberOption)(options.minNormalized),
|
|
86
|
-
requireEvidence: options.requireEvidence === undefined ? undefined : Boolean(options.requireEvidence),
|
|
87
|
-
requireVerifierGate: options.requireVerifierGate === undefined ? undefined : Boolean(options.requireVerifierGate),
|
|
88
|
-
tieBreaker: (0, cli_options_1.stringOption)(options.tieBreaker)
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
(0, report_1.writeReport)(run);
|
|
92
|
-
(0, state_1.saveCheckpoint)(run);
|
|
93
|
-
return ranking;
|
|
94
|
-
}
|
|
95
|
-
function selectCandidate(run, candidateId, options = {}) {
|
|
96
|
-
const selection = (0, candidate_scoring_1.selectCandidate)(run, candidateId, {
|
|
97
|
-
selectedBy: (0, cli_options_1.stringOption)(options.by) || (0, cli_options_1.stringOption)(options.selectedBy),
|
|
98
|
-
reason: (0, cli_options_1.stringOption)(options.reason),
|
|
99
|
-
scoreId: (0, cli_options_1.stringOption)(options.score),
|
|
100
|
-
allowUnverified: Boolean(options.allowUnverified)
|
|
101
|
-
}, {
|
|
102
|
-
persist: false,
|
|
103
|
-
policy: {
|
|
104
|
-
minNormalized: (0, cli_options_1.numberOption)(options.minNormalized),
|
|
105
|
-
requireVerifierGate: options.requireVerifierGate === undefined ? undefined : Boolean(options.requireVerifierGate)
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
(0, report_1.writeReport)(run);
|
|
109
|
-
(0, state_1.saveCheckpoint)(run);
|
|
110
|
-
return selection;
|
|
111
|
-
}
|
|
112
|
-
function rejectCandidate(run, candidateId, reason) {
|
|
113
|
-
const candidate = (0, candidate_scoring_1.rejectCandidate)(run, candidateId, reason, { persist: false });
|
|
114
|
-
(0, report_1.writeReport)(run);
|
|
115
|
-
(0, state_1.saveCheckpoint)(run);
|
|
116
|
-
return candidate;
|
|
117
|
-
}
|