@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.
Files changed (45) hide show
  1. package/README.md +115 -10
  2. package/package.json +5 -3
  3. package/prompts/abel-design.md +71 -17
  4. package/prompts/abel-diagnose.md +10 -1
  5. package/prompts/abel-implement.md +118 -20
  6. package/prompts/abel-init.md +9 -2
  7. package/src/apply-transaction.ts +16 -14
  8. package/src/artifact-store.ts +17 -0
  9. package/src/candidate-patch.ts +2 -1
  10. package/src/canonical.ts +16 -0
  11. package/src/change-contract.ts +268 -0
  12. package/src/child-session.ts +4 -3
  13. package/src/contracts.ts +141 -33
  14. package/src/control-contracts.ts +51 -1
  15. package/src/delivery-compiler.ts +148 -31
  16. package/src/design-control.ts +69 -11
  17. package/src/design-journal.ts +216 -72
  18. package/src/durable-workflow.ts +4385 -0
  19. package/src/implement-graph.ts +11 -16
  20. package/src/index.ts +380 -981
  21. package/src/isolation-backend.ts +84 -23
  22. package/src/package-delivery.ts +486 -0
  23. package/src/package-verification.ts +509 -0
  24. package/src/route-policy.ts +1 -11
  25. package/src/run-state.ts +4 -16
  26. package/src/run-store.ts +5 -144
  27. package/src/scoped-grep-worker.mjs +23 -0
  28. package/src/scoped-tools.ts +312 -116
  29. package/src/sqlite-schema.ts +171 -0
  30. package/src/storage-schema.ts +352 -0
  31. package/src/subagent-activity.ts +14 -1
  32. package/src/submit-tool.ts +20 -2
  33. package/src/task-ledger.ts +14 -55
  34. package/src/verification-capability.ts +298 -102
  35. package/src/verification-environment.ts +213 -0
  36. package/src/verification-identity.ts +77 -0
  37. package/src/worker-broker.ts +97 -34
  38. package/src/workflow-engine.ts +28 -8285
  39. package/src/workflow-policy.ts +1427 -0
  40. package/src/workflow-state-machine.ts +4478 -0
  41. package/src/workspace-io-entry.mjs +58 -0
  42. package/src/workspace-io-worker.mjs +984 -0
  43. package/src/workspace-io.ts +84 -0
  44. package/src/workspace-store.ts +125 -19
  45. package/skills/abel-workflow/SKILL.md +0 -205
@@ -1,4 +1,5 @@
1
1
  import { createHash } from "node:crypto";
2
+ import { canonicalJson } from "./canonical.ts";
2
3
  import {
3
4
  type ImplementationPhase,
4
5
  type ImplementGraphBoundary,
@@ -16,21 +17,6 @@ import {
16
17
  validateVerificationAdapterCapability,
17
18
  } from "./verification-capability.ts";
18
19
 
19
- export function canonicalJson(value: unknown): string {
20
- if (Array.isArray(value)) {
21
- return `[${value.map(canonicalJson).join(",")}]`;
22
- }
23
- if (value && typeof value === "object") {
24
- const entries = Object.entries(value as Record<string, unknown>)
25
- .filter(([, entry]) => entry !== undefined)
26
- .sort(([left], [right]) => left.localeCompare(right));
27
- return `{${entries
28
- .map(([key, entry]) => `${JSON.stringify(key)}:${canonicalJson(entry)}`)
29
- .join(",")}}`;
30
- }
31
- return JSON.stringify(value) ?? "null";
32
- }
33
-
34
20
  export function hashCanonicalValue(value: unknown): string {
35
21
  return createHash("sha256").update(canonicalJson(value)).digest("hex");
36
22
  }
@@ -92,7 +78,14 @@ function taskPhases(
92
78
  task: ImplementTaskBoundary,
93
79
  ): Array<[ImplementationPhase, ImplementTaskBoundary["phases"]["red"]]> {
94
80
  return [
95
- ["red", task.phases.red],
81
+ ...(!task.verificationMode || task.verificationMode === "behavior"
82
+ ? [
83
+ ["red", task.phases.red] as [
84
+ ImplementationPhase,
85
+ ImplementTaskBoundary["phases"]["red"],
86
+ ],
87
+ ]
88
+ : []),
96
89
  ["green", task.phases.green],
97
90
  ...(task.phases.refactor
98
91
  ? ([["refactor", task.phases.refactor]] as Array<
@@ -576,3 +569,5 @@ export function assessImplementGraphReadiness(
576
569
 
577
570
  return { closure, phases, outputs: outputReadiness };
578
571
  }
572
+
573
+ export { canonicalJson } from "./canonical.ts";