@abelxiaoxing/cadence 1.3.0 → 1.4.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/README.md +115 -10
- package/package.json +5 -3
- package/prompts/abel-design.md +71 -17
- package/prompts/abel-diagnose.md +10 -1
- package/prompts/abel-implement.md +118 -20
- package/prompts/abel-init.md +9 -2
- package/src/apply-transaction.ts +16 -14
- package/src/artifact-store.ts +17 -0
- package/src/candidate-patch.ts +2 -1
- package/src/canonical.ts +16 -0
- package/src/change-contract.ts +268 -0
- package/src/child-session.ts +4 -3
- package/src/contracts.ts +141 -33
- package/src/control-contracts.ts +51 -1
- package/src/delivery-compiler.ts +148 -31
- package/src/design-control.ts +69 -11
- package/src/design-journal.ts +216 -72
- package/src/durable-workflow.ts +4385 -0
- package/src/implement-graph.ts +11 -16
- package/src/index.ts +380 -981
- package/src/isolation-backend.ts +84 -23
- package/src/package-delivery.ts +486 -0
- package/src/package-verification.ts +509 -0
- package/src/route-policy.ts +1 -11
- package/src/run-state.ts +4 -16
- package/src/run-store.ts +5 -144
- package/src/scoped-grep-worker.mjs +23 -0
- package/src/scoped-tools.ts +312 -116
- package/src/sqlite-schema.ts +171 -0
- package/src/storage-schema.ts +352 -0
- package/src/subagent-activity.ts +14 -1
- package/src/submit-tool.ts +20 -2
- package/src/task-ledger.ts +14 -55
- package/src/verification-capability.ts +298 -102
- package/src/verification-environment.ts +213 -0
- package/src/verification-identity.ts +77 -0
- package/src/worker-broker.ts +97 -34
- package/src/workflow-engine.ts +28 -8285
- package/src/workflow-policy.ts +1427 -0
- package/src/workflow-state-machine.ts +4478 -0
- package/src/workspace-io-entry.mjs +58 -0
- package/src/workspace-io-worker.mjs +984 -0
- package/src/workspace-io.ts +84 -0
- package/src/workspace-store.ts +125 -19
- package/skills/abel-workflow/SKILL.md +0 -205
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { parentPort, workerData } from "node:worker_threads";
|
|
2
|
+
import { ArtifactStore } from "./artifact-store.ts";
|
|
3
|
+
import { verificationEnvironmentDigest } from "./verification-identity.ts";
|
|
4
|
+
import { WorkspaceStore } from "./workspace-store.ts";
|
|
5
|
+
|
|
6
|
+
const controller = new AbortController();
|
|
7
|
+
const flag = new Int32Array(workerData.cancelled);
|
|
8
|
+
parentPort.on("message", () => controller.abort(new Error("cancelled")));
|
|
9
|
+
const checkCancelled = () => {
|
|
10
|
+
if (Atomics.load(flag, 0)) throw new Error("cancelled");
|
|
11
|
+
};
|
|
12
|
+
try {
|
|
13
|
+
if (workerData.operation === "verificationIdentity") {
|
|
14
|
+
const result = verificationEnvironmentDigest(
|
|
15
|
+
workerData.args[0],
|
|
16
|
+
checkCancelled,
|
|
17
|
+
);
|
|
18
|
+
parentPort.postMessage({ ok: true, result, files: 0, bytes: 0 });
|
|
19
|
+
} else {
|
|
20
|
+
const artifacts = new ArtifactStore(workerData.artifactRoot);
|
|
21
|
+
const store = new WorkspaceStore(workerData.root, artifacts, {
|
|
22
|
+
checkCancelled,
|
|
23
|
+
});
|
|
24
|
+
let result;
|
|
25
|
+
let revision;
|
|
26
|
+
checkCancelled();
|
|
27
|
+
if (workerData.operation === "captureBaseline") {
|
|
28
|
+
revision = await store.captureBaselineWithGit(
|
|
29
|
+
workerData.args[0],
|
|
30
|
+
controller.signal,
|
|
31
|
+
);
|
|
32
|
+
result = revision;
|
|
33
|
+
} else if (workerData.operation === "materialize") {
|
|
34
|
+
revision = store.getRevision(workerData.args[0]);
|
|
35
|
+
store.materialize(workerData.args[0], workerData.args[1]);
|
|
36
|
+
} else {
|
|
37
|
+
throw new Error("workspace-io-operation-invalid");
|
|
38
|
+
}
|
|
39
|
+
const files = Object.values(revision.entries).filter(
|
|
40
|
+
(entry) => entry.kind === "file",
|
|
41
|
+
);
|
|
42
|
+
parentPort.postMessage({
|
|
43
|
+
ok: true,
|
|
44
|
+
result,
|
|
45
|
+
files: files.length,
|
|
46
|
+
bytes: files.reduce((sum, entry) => sum + entry.bytes, 0),
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
} catch (error) {
|
|
50
|
+
parentPort.postMessage({
|
|
51
|
+
ok: false,
|
|
52
|
+
error: error instanceof Error ? error.message : "workspace-io-failed",
|
|
53
|
+
files: 0,
|
|
54
|
+
bytes: 0,
|
|
55
|
+
});
|
|
56
|
+
} finally {
|
|
57
|
+
parentPort.close();
|
|
58
|
+
}
|