/*
effects.module — registers the effect.classify, effect.compensation.verify, and effect.compensation.execute kernel commands with the registry (RFC-1037).
- Does not implement classification logic — that lives in effect-classifier.ts.
- Does not implement probe execution — that lives in compensation-verifier.ts.
- Does not register non-effect commands.
- RFC-1037: initial implementation — registers 3 effect.* commands.
- RFC-1097: sweep — werkstatt-engine clean
Sweep batch 4: 73 Compass headers on headerless engine files (certification, component-runtime, isolation, evolution, testing), real KEY_DECISIONS on 75 files (kernel, cache, dht, swim, gitmesh, runtime), ~80 purpose expansions (CONTRACT-02/PURPOSE-02), non-goals on 13 CONTRACT-03 files, CS-07 history literal fix repo-wide (253 files). Policy: .template.ts/.template.astro excludedPaths. werkstatt-engine now 0 diagnostics.
*/
import type { ModuleExport } from "@warpgogol/werkstatt-shared/kernel";
export async function createEffectsModule(): Promise {
const { runEffectClassify, runEffectCompensationVerify, runEffectCompensationInspect } =
await import("./effect-commands.ts");
const modulePath = "packages/werkstatt-engine/src/component-runtime/effects.module.ts";
return {
name: "effects",
version: "0.1.0",
declarations: [],
commands: [
{
name: "effect.classify",
coverage: "operator" as const,
modulePath,
description:
"RFC-1037: Classify an operation into one of four effect classes (revertible, " +
"transactional, compensatable, irreversible-emission) before execution. " +
"Returns { operation, effectClass } as JSON. Required flags: --operation.",
execute: runEffectClassify,
scope: "workspace",
mutatesState: false,
cacheable: false,
requiresNetwork: false,
flags: {
operation: {
kind: "string",
required: true,
description: "Operation identifier to classify.",
},
},
reads: ["effect-registry"],
writes: [],
generates: [],
},
{
name: "effect.compensation.verify",
coverage: "operator" as const,
modulePath,
description:
"RFC-1037: Verify that a compensating action restored the system to an equivalent " +
"state. Runs all verification probes in parallel, stores the result in the " +
"compensation evidence store (SQLite), and returns CompensationResult as JSON. " +
"Exit code 0 if verified, 1 if verification failed. " +
"Required flags: --operation-hash, --compensation-hash, --operation.",
execute: runEffectCompensationVerify,
scope: "workspace",
mutatesState: true,
cacheable: false,
requiresNetwork: true,
flags: {
"operation-hash": {
kind: "string",
required: true,
description: "sha256:... digest of the compensated operation.",
},
"compensation-hash": {
kind: "string",
required: true,
description: "sha256:... digest of the compensation action.",
},
operation: {
kind: "string",
required: true,
description: "Operation identifier used to resolve the compensation action.",
},
"mission-id": { kind: "string", description: "Mission id for store scoping." },
"missions-dir": {
kind: "string",
description: "Missions directory override (default: /missions).",
},
},
reads: ["effect-registry", "compensation-evidence"],
writes: ["compensation-evidence", "file-system"],
generates: [],
},
{
name: "effect.compensation.inspect",
coverage: "operator" as const,
modulePath,
description:
"RFC-1037: Inspect stored compensation evidence for a given operation hash. " +
"Returns CompensationResult or null if no evidence exists. " +
"Required flags: --operation-hash.",
execute: runEffectCompensationInspect,
scope: "workspace",
mutatesState: false,
cacheable: false,
requiresNetwork: false,
flags: {
"operation-hash": {
kind: "string",
required: true,
description: "sha256:... digest of the compensated operation.",
},
"mission-id": { kind: "string", description: "Mission id for store scoping." },
"missions-dir": {
kind: "string",
description: "Missions directory override (default: /missions).",
},
},
reads: ["compensation-evidence"],
writes: [],
generates: [],
},
],
pipelines: [],
};
}