@astrosheep/keiyaku 4.6.10 → 4.6.12

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 (135) hide show
  1. package/build/plugins/claude/skills/keiyaku/SKILL.md +3 -1
  2. package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +1 -1
  3. package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +3 -2
  4. package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +9 -8
  5. package/build/plugins/codex/skills/keiyaku/SKILL.md +3 -1
  6. package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +1 -1
  7. package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +3 -2
  8. package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +9 -8
  9. package/build/plugins/opencode/skills/keiyaku/SKILL.md +3 -1
  10. package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +1 -1
  11. package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +3 -2
  12. package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +9 -8
  13. package/build/skills/keiyaku/SKILL.md +3 -1
  14. package/build/skills/keiyaku-babysit/SKILL.md +1 -1
  15. package/build/skills/keiyaku-bind/SKILL.md +3 -2
  16. package/build/skills/keiyaku-workflow/SKILL.md +9 -8
  17. package/build/src/akuma/akuma-errors.d.ts +5 -0
  18. package/build/src/akuma/akuma-errors.js +9 -0
  19. package/build/src/akuma/akuma-owner.d.ts +14 -19
  20. package/build/src/akuma/akuma-owner.js +56 -54
  21. package/build/src/akuma/akuma-selection-execution.d.ts +5 -4
  22. package/build/src/akuma/akuma-selection-execution.js +59 -17
  23. package/build/src/akuma/akuma.d.ts +1 -2
  24. package/build/src/akuma/allowed.d.ts +2 -3
  25. package/build/src/akuma/allowed.js +1 -3
  26. package/build/src/akuma/body.js +17 -7
  27. package/build/src/akuma/call-initial-tell.d.ts +18 -0
  28. package/build/src/akuma/call-initial-tell.js +18 -0
  29. package/build/src/akuma/call-request.d.ts +20 -4
  30. package/build/src/akuma/heart/facts.d.ts +13 -0
  31. package/build/src/akuma/heart/facts.js +6 -0
  32. package/build/src/akuma/heart/index.d.ts +29 -14
  33. package/build/src/akuma/heart/index.js +75 -29
  34. package/build/src/akuma/heart/rows.d.ts +9 -2
  35. package/build/src/akuma/heart/rows.js +72 -11
  36. package/build/src/akuma/heart/storage.d.ts +2 -8
  37. package/build/src/akuma/heart/storage.js +13 -13
  38. package/build/src/akuma/heart/tells.d.ts +3 -1
  39. package/build/src/akuma/heart/tells.js +18 -2
  40. package/build/src/akuma/provider.d.ts +2 -4
  41. package/build/src/akuma/provider.js +29 -6
  42. package/build/src/akuma/providers/acp/core.js +23 -21
  43. package/build/src/akuma/providers/claude/index.js +0 -8
  44. package/build/src/akuma/providers/codex-app-server/index.js +9 -8
  45. package/build/src/akuma/providers/execution-environment.d.ts +1 -1
  46. package/build/src/akuma/providers/execution-environment.js +1 -0
  47. package/build/src/akuma/providers/opencode-sdk/events.js +111 -81
  48. package/build/src/akuma/providers/opencode-sdk/index.js +179 -150
  49. package/build/src/akuma/providers/opencode-sdk/native-http.js +7 -3
  50. package/build/src/akuma/providers/opencode-sdk/session.d.ts +5 -3
  51. package/build/src/akuma/providers/opencode-sdk/session.js +32 -27
  52. package/build/src/akuma/providers/paseo/index.js +0 -2
  53. package/build/src/akuma/providers/pi/index.js +13 -17
  54. package/build/src/akuma/selection-observation.d.ts +78 -9
  55. package/build/src/akuma/selection-owner-port.d.ts +2 -1
  56. package/build/src/akuma/selection-owner-port.js +6 -1
  57. package/build/src/akuma/selection-request.d.ts +1 -1
  58. package/build/src/akuma/selection-request.js +8 -3
  59. package/build/src/akuma/turn-drive.js +79 -48
  60. package/build/src/akuma-body.js +5 -3
  61. package/build/src/cli/commands/akuma-grammar.js +2 -2
  62. package/build/src/cli/commands/akuma.js +24 -16
  63. package/build/src/cli/commands/contract-grammar.d.ts +3 -7
  64. package/build/src/cli/commands/contract-grammar.js +12 -10
  65. package/build/src/cli/commands/contract-help.d.ts +3 -13
  66. package/build/src/cli/commands/contract-help.js +7 -16
  67. package/build/src/cli/commands/contract.js +19 -35
  68. package/build/src/cli/commands/debt.js +30 -29
  69. package/build/src/cli/parse.js +0 -1
  70. package/build/src/cli/render/akuma-activity.d.ts +35 -8
  71. package/build/src/cli/render/akuma-activity.js +132 -52
  72. package/build/src/cli/render/akuma.d.ts +6 -0
  73. package/build/src/cli/render/akuma.js +67 -24
  74. package/build/src/cli/render/contract-observation.d.ts +16 -3
  75. package/build/src/cli/render/contract-observation.js +3 -0
  76. package/build/src/cli/render/contract.d.ts +2 -2
  77. package/build/src/cli/render/contract.js +4 -4
  78. package/build/src/cli/render/delivery-preview.d.ts +7 -0
  79. package/build/src/cli/render/{audit.js → delivery-preview.js} +29 -27
  80. package/build/src/cli/render/kanshi-akuma.d.ts +3 -1
  81. package/build/src/cli/render/kanshi-akuma.js +23 -8
  82. package/build/src/cli/render/kanshi.js +4 -0
  83. package/build/src/cli/render/receipt.js +3 -3
  84. package/build/src/cli/render/refusal.js +2 -2
  85. package/build/src/cli/square-identity.d.ts +15 -0
  86. package/build/src/cli/square-identity.js +180 -0
  87. package/build/src/contract-worktree.js +1 -1
  88. package/build/src/core/verbs/placement.d.ts +2 -1
  89. package/build/src/core/verbs/placement.js +1 -1
  90. package/build/src/debt/context.d.ts +0 -5
  91. package/build/src/debt/context.js +32 -44
  92. package/build/src/git/process.d.ts +1 -0
  93. package/build/src/git/process.js +18 -1
  94. package/build/src/git/read-observation.js +2 -1
  95. package/build/src/git/scratch.d.ts +5 -1
  96. package/build/src/git/scratch.js +41 -12
  97. package/build/src/git/target-placement.d.ts +22 -4
  98. package/build/src/git/target-placement.js +44 -20
  99. package/build/src/index.d.ts +2 -2
  100. package/build/src/kanshi/read.js +187 -105
  101. package/build/src/kanshi/report.d.ts +5 -0
  102. package/build/src/library/address.d.ts +18 -4
  103. package/build/src/library/address.js +27 -6
  104. package/build/src/library/contract-address.d.ts +6 -0
  105. package/build/src/library/contract-address.js +12 -1
  106. package/build/src/library/contract-execution.d.ts +2 -2
  107. package/build/src/library/contract-execution.js +13 -17
  108. package/build/src/library/contract-operations.d.ts +59 -94
  109. package/build/src/library/contract-operations.js +23 -19
  110. package/build/src/library/contract-outcomes.d.ts +3 -3
  111. package/build/src/library/contract-settings.d.ts +1 -0
  112. package/build/src/library/contract-settings.js +1 -1
  113. package/build/src/library/invocation.d.ts +2 -2
  114. package/build/src/library/invocation.js +1 -1
  115. package/build/src/library/keiyaku.d.ts +2 -2
  116. package/build/src/library/keiyaku.js +2 -2
  117. package/build/src/library/outcome.d.ts +148 -268
  118. package/build/src/library/outcome.js +4 -8
  119. package/build/src/library/refusal.d.ts +2 -2
  120. package/build/src/library/refusal.js +2 -2
  121. package/build/src/plugin/runtime.js +16 -21
  122. package/build/src/protocol/{audit.d.ts → delivery-preview.d.ts} +62 -97
  123. package/build/src/protocol/delivery-preview.js +167 -0
  124. package/build/src/protocol/progress.d.ts +1 -1
  125. package/build/src/runtime/proc/run.js +22 -4
  126. package/build/src/runtime/proc/windows-launch.exe +0 -0
  127. package/build/src/verification/execution.d.ts +1 -1
  128. package/build/src/verification/execution.js +5 -3
  129. package/package.json +4 -2
  130. package/skills/keiyaku/SKILL.md +3 -1
  131. package/skills/keiyaku-babysit/SKILL.md +1 -1
  132. package/skills/keiyaku-bind/SKILL.md +3 -2
  133. package/skills/keiyaku-workflow/SKILL.md +9 -8
  134. package/build/src/cli/render/audit.d.ts +0 -7
  135. package/build/src/protocol/audit.js +0 -203
@@ -36,7 +36,9 @@ selects the Contract repository; it never retargets that World. `call
36
36
  cwd). Without it, the call uses the invocation cwd; `--contract` associates a
37
37
  Contract without selecting an execution directory.
38
38
 
39
- `deliver`, `review`, and `audit` may take time after their leading admission.
39
+ `deliver` and `review` may take time after their leading admission.
40
+ `deliver --dry-run` only observes the prospective candidate, standing evidence,
41
+ and target followability; it never runs Verification or hooks or admits work.
40
42
  Their witnessed progress is ephemeral stderr output; stdout remains one final
41
43
  text or JSON result. Ctrl-C asks the owned operation to stop and waits for its
42
44
  truthful final receipt, so it is not evidence that an already admitted action
@@ -54,7 +54,7 @@ does not move without you.
54
54
  | Silent wedge: initial answer empty and worktree clean | Inspect status and history, then send one steering `tell`. If the worker remains unresponsive, `kill` and call a new Akuma; an empty answer alone is not proof the Contract failed. |
55
55
  | Verdict record refused with `not-allowed` | Read the worker's analysis in history. Record the verdict yourself if you did not deliver the candidate, or call a new Reviewer with the grant from `keiyaku-workflow` and have it inspect current work and record a fresh verdict. The refused request wrote no Contract testimony. |
56
56
  | Review stale after changed candidate tender | Normal content-currentness result. Give the same Reviewer the changed diff and current terms with `tell`; have it re-examine and record current testimony. A target move alone does not stale review. |
57
- | Target moved under the appointed worktree | Have the Deliverer inspect target movement and merge the target branch (main when selected) in that worktree when required; resolve conflicts there, then audit again. Do not resolve against a stale integration preview. |
57
+ | Target moved under the appointed worktree | Have the Deliverer inspect target movement and merge the target branch (main when selected) in that worktree when required; resolve conflicts there, then run `deliver --dry-run` again. Do not resolve against a stale integration preview. |
58
58
  | Typed refusal names its rule | Fix the named input or physical condition, then retry from a fresh observation. Do not repeat the same request blindly. |
59
59
 
60
60
  ## What Babysitting Never Owns
@@ -157,8 +157,9 @@ commands; `5m` is the normal baseline.
157
157
  Verification runs only when the Contract selects the `verified` gate, against
158
158
  the exact integration snapshot in a clean disposable worktree for that attempt.
159
159
  `deliver` reuses current satisfied evidence or runs the declarations; unsatisfied
160
- results and runtime stops prevent placement. `audit` runs declarations for a
161
- prospective candidate. Without `verified`, no verb runs Verification and the
160
+ results and runtime stops prevent placement. `deliver --dry-run` only observes
161
+ standing evidence for a prospective candidate; it never executes declarations.
162
+ Without `verified`, no verb runs Verification and the
162
163
  section is inert document text. `reviewed` independently requires review
163
164
  evidence. Selected gates are checked at placement.
164
165
 
@@ -69,12 +69,13 @@ Each act changes a different part of the world:
69
69
  `reconcile` retries workspace realization.
70
70
  - **Work:** Changes and commits belong in the appointed worktree. Another
71
71
  lane's claim can move the target beneath it. Check target movement before
72
- audit; when it matters, merge the target branch (main when selected) in the
73
- worktree and resolve conflicts there before auditing.
74
- - **Audit:** Previews the candidate and target without tendering or claiming.
75
- With `verified` selected, Verification runs for the captured subject and can
76
- record an attestation. Without that gate, the section is inert text and no
77
- verb runs Verification. A stopped run records no new verdict.
72
+ delivery preview; when it matters, merge the target branch (main when selected)
73
+ in the worktree and resolve conflicts there before previewing again.
74
+ - **Delivery preview:** Use `deliver --dry-run` to observe the candidate, existing
75
+ Verification evidence and target followability without tendering or claiming.
76
+ It never runs Verification or hooks, admits testimony, or reconciles. Missing
77
+ or stale evidence means Verification is still required; an existing failure
78
+ remains unsatisfied. Preparation is not a promise of successful delivery.
78
79
  - **Deliver:** Captures a tender and integration against the observed target;
79
80
  journal gains a delivered candidate. Ready prerequisites and gates trigger
80
81
  placement and claim in this invocation; otherwise the candidate waits.
@@ -88,7 +89,7 @@ Each act changes a different part of the world:
88
89
  and abandoned Contracts cannot be reopened.
89
90
 
90
91
  Placement judges declared gates, not the producer's identity. Review does not
91
- replace Verification; audit never requests placement. Read the final receipt
92
+ replace Verification; delivery preview never requests placement. Read the final receipt
92
93
  for stops and reconciliation lag after an admitted act.
93
94
 
94
95
  ## 5. Handing A Role To An Akuma
@@ -101,7 +102,7 @@ authority.
101
102
  | Role | Grant at birth | Return |
102
103
  | --- | --- | --- |
103
104
  | Holder | The actions the delegated loop will perform; include `contract.review` when this holder will review. Commission with the `kei`, current Arc when one exists, appointed worktree, and holder duties. | Acceptance or abandonment, with receipts. |
104
- | Deliverer | The ordinary baseline: every Debt mutation, Contract audit and delivery, and Akuma management. `keiyaku -C <repo> call worker --alias @deliverer --contract <kei/...> --workdir <appointed-path> -` | The delivery receipt. |
105
+ | Deliverer | The ordinary baseline: every Debt mutation, Contract delivery, and Akuma management. Preview is unkeyed. `keiyaku -C <repo> call worker --alias @deliverer --contract <kei/...> --workdir <appointed-path> -` | The delivery receipt. |
105
106
  | Reviewer | `--allowed contract.review`: `keiyaku -C <repo> call review-akuma --alias @reviewer --contract <kei/...> --workdir <appointed-path> --allowed contract.review -` | The verdict receipt. Without the grant, `not-allowed` refuses and no verdict is recorded. |
106
107
 
107
108
  An Archetype's explicit allowed set replaces the ordinary baseline; check
@@ -36,7 +36,9 @@ selects the Contract repository; it never retargets that World. `call
36
36
  cwd). Without it, the call uses the invocation cwd; `--contract` associates a
37
37
  Contract without selecting an execution directory.
38
38
 
39
- `deliver`, `review`, and `audit` may take time after their leading admission.
39
+ `deliver` and `review` may take time after their leading admission.
40
+ `deliver --dry-run` only observes the prospective candidate, standing evidence,
41
+ and target followability; it never runs Verification or hooks or admits work.
40
42
  Their witnessed progress is ephemeral stderr output; stdout remains one final
41
43
  text or JSON result. Ctrl-C asks the owned operation to stop and waits for its
42
44
  truthful final receipt, so it is not evidence that an already admitted action
@@ -54,7 +54,7 @@ does not move without you.
54
54
  | Silent wedge: initial answer empty and worktree clean | Inspect status and history, then send one steering `tell`. If the worker remains unresponsive, `kill` and call a new Akuma; an empty answer alone is not proof the Contract failed. |
55
55
  | Verdict record refused with `not-allowed` | Read the worker's analysis in history. Record the verdict yourself if you did not deliver the candidate, or call a new Reviewer with the grant from `keiyaku-workflow` and have it inspect current work and record a fresh verdict. The refused request wrote no Contract testimony. |
56
56
  | Review stale after changed candidate tender | Normal content-currentness result. Give the same Reviewer the changed diff and current terms with `tell`; have it re-examine and record current testimony. A target move alone does not stale review. |
57
- | Target moved under the appointed worktree | Have the Deliverer inspect target movement and merge the target branch (main when selected) in that worktree when required; resolve conflicts there, then audit again. Do not resolve against a stale integration preview. |
57
+ | Target moved under the appointed worktree | Have the Deliverer inspect target movement and merge the target branch (main when selected) in that worktree when required; resolve conflicts there, then run `deliver --dry-run` again. Do not resolve against a stale integration preview. |
58
58
  | Typed refusal names its rule | Fix the named input or physical condition, then retry from a fresh observation. Do not repeat the same request blindly. |
59
59
 
60
60
  ## What Babysitting Never Owns
@@ -157,8 +157,9 @@ commands; `5m` is the normal baseline.
157
157
  Verification runs only when the Contract selects the `verified` gate, against
158
158
  the exact integration snapshot in a clean disposable worktree for that attempt.
159
159
  `deliver` reuses current satisfied evidence or runs the declarations; unsatisfied
160
- results and runtime stops prevent placement. `audit` runs declarations for a
161
- prospective candidate. Without `verified`, no verb runs Verification and the
160
+ results and runtime stops prevent placement. `deliver --dry-run` only observes
161
+ standing evidence for a prospective candidate; it never executes declarations.
162
+ Without `verified`, no verb runs Verification and the
162
163
  section is inert document text. `reviewed` independently requires review
163
164
  evidence. Selected gates are checked at placement.
164
165
 
@@ -69,12 +69,13 @@ Each act changes a different part of the world:
69
69
  `reconcile` retries workspace realization.
70
70
  - **Work:** Changes and commits belong in the appointed worktree. Another
71
71
  lane's claim can move the target beneath it. Check target movement before
72
- audit; when it matters, merge the target branch (main when selected) in the
73
- worktree and resolve conflicts there before auditing.
74
- - **Audit:** Previews the candidate and target without tendering or claiming.
75
- With `verified` selected, Verification runs for the captured subject and can
76
- record an attestation. Without that gate, the section is inert text and no
77
- verb runs Verification. A stopped run records no new verdict.
72
+ delivery preview; when it matters, merge the target branch (main when selected)
73
+ in the worktree and resolve conflicts there before previewing again.
74
+ - **Delivery preview:** Use `deliver --dry-run` to observe the candidate, existing
75
+ Verification evidence and target followability without tendering or claiming.
76
+ It never runs Verification or hooks, admits testimony, or reconciles. Missing
77
+ or stale evidence means Verification is still required; an existing failure
78
+ remains unsatisfied. Preparation is not a promise of successful delivery.
78
79
  - **Deliver:** Captures a tender and integration against the observed target;
79
80
  journal gains a delivered candidate. Ready prerequisites and gates trigger
80
81
  placement and claim in this invocation; otherwise the candidate waits.
@@ -88,7 +89,7 @@ Each act changes a different part of the world:
88
89
  and abandoned Contracts cannot be reopened.
89
90
 
90
91
  Placement judges declared gates, not the producer's identity. Review does not
91
- replace Verification; audit never requests placement. Read the final receipt
92
+ replace Verification; delivery preview never requests placement. Read the final receipt
92
93
  for stops and reconciliation lag after an admitted act.
93
94
 
94
95
  ## 5. Handing A Role To An Akuma
@@ -101,7 +102,7 @@ authority.
101
102
  | Role | Grant at birth | Return |
102
103
  | --- | --- | --- |
103
104
  | Holder | The actions the delegated loop will perform; include `contract.review` when this holder will review. Commission with the `kei`, current Arc when one exists, appointed worktree, and holder duties. | Acceptance or abandonment, with receipts. |
104
- | Deliverer | The ordinary baseline: every Debt mutation, Contract audit and delivery, and Akuma management. `keiyaku -C <repo> call worker --alias @deliverer --contract <kei/...> --workdir <appointed-path> -` | The delivery receipt. |
105
+ | Deliverer | The ordinary baseline: every Debt mutation, Contract delivery, and Akuma management. Preview is unkeyed. `keiyaku -C <repo> call worker --alias @deliverer --contract <kei/...> --workdir <appointed-path> -` | The delivery receipt. |
105
106
  | Reviewer | `--allowed contract.review`: `keiyaku -C <repo> call review-akuma --alias @reviewer --contract <kei/...> --workdir <appointed-path> --allowed contract.review -` | The verdict receipt. Without the grant, `not-allowed` refuses and no verdict is recorded. |
106
107
 
107
108
  An Archetype's explicit allowed set replaces the ordinary baseline; check
@@ -36,7 +36,9 @@ selects the Contract repository; it never retargets that World. `call
36
36
  cwd). Without it, the call uses the invocation cwd; `--contract` associates a
37
37
  Contract without selecting an execution directory.
38
38
 
39
- `deliver`, `review`, and `audit` may take time after their leading admission.
39
+ `deliver` and `review` may take time after their leading admission.
40
+ `deliver --dry-run` only observes the prospective candidate, standing evidence,
41
+ and target followability; it never runs Verification or hooks or admits work.
40
42
  Their witnessed progress is ephemeral stderr output; stdout remains one final
41
43
  text or JSON result. Ctrl-C asks the owned operation to stop and waits for its
42
44
  truthful final receipt, so it is not evidence that an already admitted action
@@ -54,7 +54,7 @@ does not move without you.
54
54
  | Silent wedge: initial answer empty and worktree clean | Inspect status and history, then send one steering `tell`. If the worker remains unresponsive, `kill` and call a new Akuma; an empty answer alone is not proof the Contract failed. |
55
55
  | Verdict record refused with `not-allowed` | Read the worker's analysis in history. Record the verdict yourself if you did not deliver the candidate, or call a new Reviewer with the grant from `keiyaku-workflow` and have it inspect current work and record a fresh verdict. The refused request wrote no Contract testimony. |
56
56
  | Review stale after changed candidate tender | Normal content-currentness result. Give the same Reviewer the changed diff and current terms with `tell`; have it re-examine and record current testimony. A target move alone does not stale review. |
57
- | Target moved under the appointed worktree | Have the Deliverer inspect target movement and merge the target branch (main when selected) in that worktree when required; resolve conflicts there, then audit again. Do not resolve against a stale integration preview. |
57
+ | Target moved under the appointed worktree | Have the Deliverer inspect target movement and merge the target branch (main when selected) in that worktree when required; resolve conflicts there, then run `deliver --dry-run` again. Do not resolve against a stale integration preview. |
58
58
  | Typed refusal names its rule | Fix the named input or physical condition, then retry from a fresh observation. Do not repeat the same request blindly. |
59
59
 
60
60
  ## What Babysitting Never Owns
@@ -157,8 +157,9 @@ commands; `5m` is the normal baseline.
157
157
  Verification runs only when the Contract selects the `verified` gate, against
158
158
  the exact integration snapshot in a clean disposable worktree for that attempt.
159
159
  `deliver` reuses current satisfied evidence or runs the declarations; unsatisfied
160
- results and runtime stops prevent placement. `audit` runs declarations for a
161
- prospective candidate. Without `verified`, no verb runs Verification and the
160
+ results and runtime stops prevent placement. `deliver --dry-run` only observes
161
+ standing evidence for a prospective candidate; it never executes declarations.
162
+ Without `verified`, no verb runs Verification and the
162
163
  section is inert document text. `reviewed` independently requires review
163
164
  evidence. Selected gates are checked at placement.
164
165
 
@@ -69,12 +69,13 @@ Each act changes a different part of the world:
69
69
  `reconcile` retries workspace realization.
70
70
  - **Work:** Changes and commits belong in the appointed worktree. Another
71
71
  lane's claim can move the target beneath it. Check target movement before
72
- audit; when it matters, merge the target branch (main when selected) in the
73
- worktree and resolve conflicts there before auditing.
74
- - **Audit:** Previews the candidate and target without tendering or claiming.
75
- With `verified` selected, Verification runs for the captured subject and can
76
- record an attestation. Without that gate, the section is inert text and no
77
- verb runs Verification. A stopped run records no new verdict.
72
+ delivery preview; when it matters, merge the target branch (main when selected)
73
+ in the worktree and resolve conflicts there before previewing again.
74
+ - **Delivery preview:** Use `deliver --dry-run` to observe the candidate, existing
75
+ Verification evidence and target followability without tendering or claiming.
76
+ It never runs Verification or hooks, admits testimony, or reconciles. Missing
77
+ or stale evidence means Verification is still required; an existing failure
78
+ remains unsatisfied. Preparation is not a promise of successful delivery.
78
79
  - **Deliver:** Captures a tender and integration against the observed target;
79
80
  journal gains a delivered candidate. Ready prerequisites and gates trigger
80
81
  placement and claim in this invocation; otherwise the candidate waits.
@@ -88,7 +89,7 @@ Each act changes a different part of the world:
88
89
  and abandoned Contracts cannot be reopened.
89
90
 
90
91
  Placement judges declared gates, not the producer's identity. Review does not
91
- replace Verification; audit never requests placement. Read the final receipt
92
+ replace Verification; delivery preview never requests placement. Read the final receipt
92
93
  for stops and reconciliation lag after an admitted act.
93
94
 
94
95
  ## 5. Handing A Role To An Akuma
@@ -101,7 +102,7 @@ authority.
101
102
  | Role | Grant at birth | Return |
102
103
  | --- | --- | --- |
103
104
  | Holder | The actions the delegated loop will perform; include `contract.review` when this holder will review. Commission with the `kei`, current Arc when one exists, appointed worktree, and holder duties. | Acceptance or abandonment, with receipts. |
104
- | Deliverer | The ordinary baseline: every Debt mutation, Contract audit and delivery, and Akuma management. `keiyaku -C <repo> call worker --alias @deliverer --contract <kei/...> --workdir <appointed-path> -` | The delivery receipt. |
105
+ | Deliverer | The ordinary baseline: every Debt mutation, Contract delivery, and Akuma management. Preview is unkeyed. `keiyaku -C <repo> call worker --alias @deliverer --contract <kei/...> --workdir <appointed-path> -` | The delivery receipt. |
105
106
  | Reviewer | `--allowed contract.review`: `keiyaku -C <repo> call review-akuma --alias @reviewer --contract <kei/...> --workdir <appointed-path> --allowed contract.review -` | The verdict receipt. Without the grant, `not-allowed` refuses and no verdict is recorded. |
106
107
 
107
108
  An Archetype's explicit allowed set replaces the ordinary baseline; check
@@ -36,7 +36,9 @@ selects the Contract repository; it never retargets that World. `call
36
36
  cwd). Without it, the call uses the invocation cwd; `--contract` associates a
37
37
  Contract without selecting an execution directory.
38
38
 
39
- `deliver`, `review`, and `audit` may take time after their leading admission.
39
+ `deliver` and `review` may take time after their leading admission.
40
+ `deliver --dry-run` only observes the prospective candidate, standing evidence,
41
+ and target followability; it never runs Verification or hooks or admits work.
40
42
  Their witnessed progress is ephemeral stderr output; stdout remains one final
41
43
  text or JSON result. Ctrl-C asks the owned operation to stop and waits for its
42
44
  truthful final receipt, so it is not evidence that an already admitted action
@@ -54,7 +54,7 @@ does not move without you.
54
54
  | Silent wedge: initial answer empty and worktree clean | Inspect status and history, then send one steering `tell`. If the worker remains unresponsive, `kill` and call a new Akuma; an empty answer alone is not proof the Contract failed. |
55
55
  | Verdict record refused with `not-allowed` | Read the worker's analysis in history. Record the verdict yourself if you did not deliver the candidate, or call a new Reviewer with the grant from `keiyaku-workflow` and have it inspect current work and record a fresh verdict. The refused request wrote no Contract testimony. |
56
56
  | Review stale after changed candidate tender | Normal content-currentness result. Give the same Reviewer the changed diff and current terms with `tell`; have it re-examine and record current testimony. A target move alone does not stale review. |
57
- | Target moved under the appointed worktree | Have the Deliverer inspect target movement and merge the target branch (main when selected) in that worktree when required; resolve conflicts there, then audit again. Do not resolve against a stale integration preview. |
57
+ | Target moved under the appointed worktree | Have the Deliverer inspect target movement and merge the target branch (main when selected) in that worktree when required; resolve conflicts there, then run `deliver --dry-run` again. Do not resolve against a stale integration preview. |
58
58
  | Typed refusal names its rule | Fix the named input or physical condition, then retry from a fresh observation. Do not repeat the same request blindly. |
59
59
 
60
60
  ## What Babysitting Never Owns
@@ -157,8 +157,9 @@ commands; `5m` is the normal baseline.
157
157
  Verification runs only when the Contract selects the `verified` gate, against
158
158
  the exact integration snapshot in a clean disposable worktree for that attempt.
159
159
  `deliver` reuses current satisfied evidence or runs the declarations; unsatisfied
160
- results and runtime stops prevent placement. `audit` runs declarations for a
161
- prospective candidate. Without `verified`, no verb runs Verification and the
160
+ results and runtime stops prevent placement. `deliver --dry-run` only observes
161
+ standing evidence for a prospective candidate; it never executes declarations.
162
+ Without `verified`, no verb runs Verification and the
162
163
  section is inert document text. `reviewed` independently requires review
163
164
  evidence. Selected gates are checked at placement.
164
165
 
@@ -69,12 +69,13 @@ Each act changes a different part of the world:
69
69
  `reconcile` retries workspace realization.
70
70
  - **Work:** Changes and commits belong in the appointed worktree. Another
71
71
  lane's claim can move the target beneath it. Check target movement before
72
- audit; when it matters, merge the target branch (main when selected) in the
73
- worktree and resolve conflicts there before auditing.
74
- - **Audit:** Previews the candidate and target without tendering or claiming.
75
- With `verified` selected, Verification runs for the captured subject and can
76
- record an attestation. Without that gate, the section is inert text and no
77
- verb runs Verification. A stopped run records no new verdict.
72
+ delivery preview; when it matters, merge the target branch (main when selected)
73
+ in the worktree and resolve conflicts there before previewing again.
74
+ - **Delivery preview:** Use `deliver --dry-run` to observe the candidate, existing
75
+ Verification evidence and target followability without tendering or claiming.
76
+ It never runs Verification or hooks, admits testimony, or reconciles. Missing
77
+ or stale evidence means Verification is still required; an existing failure
78
+ remains unsatisfied. Preparation is not a promise of successful delivery.
78
79
  - **Deliver:** Captures a tender and integration against the observed target;
79
80
  journal gains a delivered candidate. Ready prerequisites and gates trigger
80
81
  placement and claim in this invocation; otherwise the candidate waits.
@@ -88,7 +89,7 @@ Each act changes a different part of the world:
88
89
  and abandoned Contracts cannot be reopened.
89
90
 
90
91
  Placement judges declared gates, not the producer's identity. Review does not
91
- replace Verification; audit never requests placement. Read the final receipt
92
+ replace Verification; delivery preview never requests placement. Read the final receipt
92
93
  for stops and reconciliation lag after an admitted act.
93
94
 
94
95
  ## 5. Handing A Role To An Akuma
@@ -101,7 +102,7 @@ authority.
101
102
  | Role | Grant at birth | Return |
102
103
  | --- | --- | --- |
103
104
  | Holder | The actions the delegated loop will perform; include `contract.review` when this holder will review. Commission with the `kei`, current Arc when one exists, appointed worktree, and holder duties. | Acceptance or abandonment, with receipts. |
104
- | Deliverer | The ordinary baseline: every Debt mutation, Contract audit and delivery, and Akuma management. `keiyaku -C <repo> call worker --alias @deliverer --contract <kei/...> --workdir <appointed-path> -` | The delivery receipt. |
105
+ | Deliverer | The ordinary baseline: every Debt mutation, Contract delivery, and Akuma management. Preview is unkeyed. `keiyaku -C <repo> call worker --alias @deliverer --contract <kei/...> --workdir <appointed-path> -` | The delivery receipt. |
105
106
  | Reviewer | `--allowed contract.review`: `keiyaku -C <repo> call review-akuma --alias @reviewer --contract <kei/...> --workdir <appointed-path> --allowed contract.review -` | The verdict receipt. Without the grant, `not-allowed` refuses and no verdict is recorded. |
106
107
 
107
108
  An Archetype's explicit allowed set replaces the ordinary baseline; check
@@ -17,6 +17,11 @@ export declare class AkumaDecodeError extends Error {
17
17
  readonly kind = "akuma-decode";
18
18
  constructor(diagnostic: string, answer?: string | undefined);
19
19
  }
20
+ export declare class AkumaSelfInterruptError extends Error {
21
+ readonly id: AkuId;
22
+ readonly kind = "akuma-self-interrupt";
23
+ constructor(id: AkuId);
24
+ }
20
25
  export declare class AkumaProviderError extends Error {
21
26
  readonly diagnostic: string;
22
27
  readonly kind = "akuma-provider";
@@ -30,6 +30,15 @@ export class AkumaDecodeError extends Error {
30
30
  this.name = "AkumaDecodeError";
31
31
  }
32
32
  }
33
+ export class AkumaSelfInterruptError extends Error {
34
+ id;
35
+ kind = "akuma-self-interrupt";
36
+ constructor(id) {
37
+ super(`Akuma ${id} cannot interrupt its serving Body`);
38
+ this.id = id;
39
+ this.name = "AkumaSelfInterruptError";
40
+ }
41
+ }
33
42
  export class AkumaProviderError extends Error {
34
43
  diagnostic;
35
44
  kind = "akuma-provider";
@@ -5,16 +5,11 @@ import { type AkumaStreamSnapshot } from "./akuma-stream.js";
5
5
  import type { AkumaStatus } from "./akuma.js";
6
6
  import { type TellResult, type TellWakeRuntime } from "./body.js";
7
7
  import { type CallInitialTell, type CallInitialTellAdmission } from "./call-initial-tell.js";
8
- import { HeldAkumaLeash, type KillEvidence, type ResumeCoordinate, type TellFact, type TurnOutcome } from "./heart/index.js";
8
+ import { HeldAkumaLeash, type InterruptTellAdmission, type KillEvidence, type ResumeCoordinate, type TellFact, type TurnOutcome } from "./heart/index.js";
9
9
  import { type AkuId, type AkumaPaths } from "./identity.js";
10
10
  import type { ActivityHistory, ExactHistory } from "./projection.js";
11
- export type InterruptReceipt = Readonly<{
11
+ export type InterruptReceipt = TellResult | Extract<InterruptTellAdmission, {
12
12
  kind: "unavailable";
13
- evidence: "hung" | "untidy" | "unavailable";
14
- }> | Readonly<{
15
- kind: "interrupted";
16
- putDown: "was-idle" | "self-aborted";
17
- tell: TellResult;
18
13
  }>;
19
14
  export type ForkReceipt = Readonly<{
20
15
  kind: "forked";
@@ -47,15 +42,13 @@ type TellAdmission = Readonly<{
47
42
  wake: Promise<TellResult>;
48
43
  }>;
49
44
  type InitialTellAdmission = CallInitialTellAdmission;
50
- type InterruptAdmission = Readonly<{
45
+ type InterruptAdmission = Extract<InterruptTellAdmission, {
51
46
  kind: "unavailable";
52
- evidence: "hung" | "untidy" | "unavailable";
53
- }> | Readonly<{
47
+ }> | (Omit<Extract<InterruptTellAdmission, {
48
+ kind: "recorded";
49
+ }>, "kind"> & Readonly<{
54
50
  kind: "admitted";
55
- tell: TellFact;
56
- putDown: "was-idle" | "self-aborted";
57
- wake: Promise<TellResult>;
58
- }>;
51
+ }>);
59
52
  export declare function settleAkumaKill(paths: AkumaPaths, signal?: AbortSignal, retainLeash?: boolean): Promise<Readonly<{
60
53
  evidence: KillEvidence;
61
54
  leash?: HeldAkumaLeash;
@@ -139,22 +132,24 @@ export declare class AkumaOwner {
139
132
  }>>;
140
133
  interrupt(body: string, options?: Readonly<{
141
134
  tellId?: string;
135
+ recordedAt?: string;
142
136
  schemaJson?: string;
143
137
  initiator?: string;
144
138
  signal?: AbortSignal;
145
139
  runtime?: TellWakeRuntime;
146
140
  }>): Promise<InterruptReceipt>;
147
- /**
148
- * Settle the predecessor and record the interrupt Tell, returning at the
149
- * admission boundary so a bounded caller owns the wake wait.
150
- */
141
+ /** Atomic Tell-plus-barrier admission; no leash wait or completion observation occurs here. */
151
142
  admitInterrupt(body: string, options?: Readonly<{
152
143
  tellId?: string;
144
+ recordedAt?: string;
153
145
  schemaJson?: string;
154
146
  initiator?: string;
155
147
  signal?: AbortSignal;
156
- runtime?: TellWakeRuntime;
157
148
  }>): Promise<InterruptAdmission>;
149
+ /** Complete only the exact admitted predecessor barrier, then wake the stable Tell. */
150
+ completeInterruptAdmission(admission: Extract<InterruptAdmission, {
151
+ kind: "admitted";
152
+ }>, runtime?: TellWakeRuntime, signal?: AbortSignal): Promise<TellResult>;
158
153
  fork(input: Readonly<{
159
154
  at: string;
160
155
  caller?: AkumaCaller;
@@ -7,18 +7,34 @@ import { createAkumaStream } from "./akuma-stream.js";
7
7
  import { handoffPendingTells, spawnAkumaBody, wakeRecordedTell, } from "./body.js";
8
8
  import { admitCallInitialTell } from "./call-initial-tell.js";
9
9
  import { acquireLeash } from "./control.js";
10
- import { HeldAkumaLeash, activitySlice, projectTell, readForkPoint, readHeart, readKill, readLastAnsweredTurn, readSoul, readTell, recordTell, requestPause, requestStop, } from "./heart/index.js";
10
+ import { activitySlice, projectTell, readForkPoint, readHeart, readInterruptCompletion, readKill, readLastAnsweredTurn, readSoul, readTell, recordTell, requestStop, } from "./heart/index.js";
11
11
  import { parsePublicHistoryId, pathsForAkuId } from "./identity.js";
12
12
  import { projectTurns, selectExactHistory, selectHistory } from "./projection.js";
13
13
  import { resolveProviderExecution } from "./providers/index.js";
14
14
  import { publishAkuma } from "./publication.js";
15
+ async function awaitInterruptCompletion(paths, barrier, signal) {
16
+ const leash = await acquireLeash(paths, {
17
+ bodySequence: barrier.bodySequence,
18
+ ...(signal === undefined ? { deadline: Number.POSITIVE_INFINITY } : { signal }),
19
+ });
20
+ if (leash === null)
21
+ return await readInterruptCompletion(paths, barrier);
22
+ try {
23
+ const result = await leash.completeInterruptBarrier(paths, barrier);
24
+ if (result.kind === "completed" || result.kind === "unavailable")
25
+ return result;
26
+ return { kind: "unavailable", evidence: "untidy" };
27
+ }
28
+ finally {
29
+ leash.release();
30
+ }
31
+ }
15
32
  function diagnostic(error) {
16
33
  return error instanceof Error ? error.message : String(error);
17
34
  }
18
- async function takeLeashUntilSignal(paths, bodySequence, signal, unbounded = false) {
35
+ async function takeLeashUntilSignal(paths, bodySequence, signal) {
19
36
  const leash = await acquireLeash(paths, {
20
37
  bodySequence,
21
- ...(signal === undefined && unbounded ? { deadline: Number.POSITIVE_INFINITY } : {}),
22
38
  ...(signal === undefined ? {} : { signal }),
23
39
  });
24
40
  if (leash !== null)
@@ -271,62 +287,48 @@ export class AkumaOwner {
271
287
  const admitted = await this.admitInterrupt(body, options);
272
288
  if (admitted.kind === "unavailable")
273
289
  return admitted;
274
- return { kind: "interrupted", putDown: admitted.putDown, tell: await admitted.wake };
290
+ return await this.completeInterruptAdmission(admitted, options.runtime, options.signal);
275
291
  }
276
- /**
277
- * Settle the predecessor and record the interrupt Tell, returning at the
278
- * admission boundary so a bounded caller owns the wake wait.
279
- */
292
+ /** Atomic Tell-plus-barrier admission; no leash wait or completion observation occurs here. */
280
293
  async admitInterrupt(body, options = {}) {
281
- const request = await requestPause(this.paths, new Date().toISOString(), options.signal);
282
- if (request.kind === "not-born") {
294
+ const admitted = await recordTell(this.paths, {
295
+ kind: "tell",
296
+ id: options.tellId ?? randomUUID(),
297
+ body,
298
+ recordedAt: options.recordedAt ?? new Date().toISOString(),
299
+ ...(options.initiator === undefined ? {} : { initiator: options.initiator }),
300
+ ...(options.schemaJson === undefined ? {} : { schemaJson: options.schemaJson }),
301
+ }, { interrupt: true, ...(options.signal === undefined ? {} : { signal: options.signal }) });
302
+ if (admitted.kind === "not-born")
283
303
  throw new AkumaNotBornError(this.id);
304
+ if (admitted.kind === "unavailable")
305
+ return admitted;
306
+ return { ...admitted, kind: "admitted" };
307
+ }
308
+ /** Complete only the exact admitted predecessor barrier, then wake the stable Tell. */
309
+ async completeInterruptAdmission(admission, runtime, signal) {
310
+ if (admission.barrier === undefined)
311
+ return await wakeRecordedTell(this.paths, admission.tell.id, runtime, signal);
312
+ const completion = await awaitInterruptCompletion(this.paths, admission.barrier, signal);
313
+ if (completion.kind === "unavailable") {
314
+ const receipt = await this.admittedReceipt(admission.tell.id);
315
+ return {
316
+ ...receipt,
317
+ interruption: {
318
+ kind: "unavailable",
319
+ bodySequence: admission.barrier.bodySequence,
320
+ evidence: completion.evidence,
321
+ },
322
+ };
284
323
  }
285
- let putDown = "was-idle";
286
- let leash = await HeldAkumaLeash.try(this.paths);
287
- if (leash === null) {
288
- const waited = await takeLeashUntilSignal(this.paths, request.body.sequence, options.signal, true);
289
- if ("kind" in waited)
290
- return waited;
291
- leash = waited;
292
- putDown = "self-aborted";
293
- }
294
- let recorded;
295
- try {
296
- options.signal?.throwIfAborted();
297
- const settledBody = (await readHeart(this.paths)).latestBody;
298
- if (settledBody?.sequence === request.body.sequence && settledBody.hung !== undefined) {
299
- await leash.clearPause(this.paths);
300
- return { kind: "unavailable", evidence: "hung" };
301
- }
302
- if (settledBody?.sequence !== request.body.sequence || settledBody.end === undefined) {
303
- await leash.clearPause(this.paths);
304
- return { kind: "unavailable", evidence: "untidy" };
305
- }
306
- if (request.body.end !== undefined || settledBody.end !== "put-down")
307
- putDown = "was-idle";
308
- options.signal?.throwIfAborted();
309
- const id = randomUUID();
310
- const admitted = await leash.recordInterruptTell(this.paths, {
311
- kind: "tell",
312
- id: options.tellId ?? id,
313
- body,
314
- recordedAt: new Date().toISOString(),
315
- ...(options.initiator === undefined ? {} : { initiator: options.initiator }),
316
- ...(options.schemaJson === undefined ? {} : { schemaJson: options.schemaJson }),
317
- });
318
- if (admitted.kind === "not-born")
319
- throw new AkumaNotBornError(this.id);
320
- recorded = admitted.tell;
321
- }
322
- finally {
323
- leash.release();
324
- }
324
+ const receipt = await wakeRecordedTell(this.paths, admission.tell.id, runtime, signal);
325
325
  return {
326
- kind: "admitted",
327
- tell: recorded,
328
- putDown,
329
- wake: wakeRecordedTell(this.paths, recorded.id, options.runtime, options.signal),
326
+ ...receipt,
327
+ interruption: {
328
+ kind: "completed",
329
+ bodySequence: admission.barrier.bodySequence,
330
+ putDown: admission.predecessorWasRunning && completion.body.end === "put-down" ? "self-aborted" : "was-idle",
331
+ },
330
332
  };
331
333
  }
332
334
  async fork(input) {
@@ -20,6 +20,10 @@ type TellExecutionInput = Readonly<{
20
20
  onObserve?: AskObserver;
21
21
  outcomeObserved?: OutcomeObserver;
22
22
  }>;
23
+ type AskExecutionInput = TellExecutionInput & Readonly<{
24
+ timeoutMs?: number;
25
+ schemaJson?: string;
26
+ }>;
23
27
  export declare function executeTellAkuma(input: TellExecutionInput): Promise<AkumaTellResult>;
24
28
  export declare function decodeAskObservation<T>(observation: AkumaAskObservation, schema: Schema<T>): AkumaAskObservation<T>;
25
29
  export declare function observeAdmittedAskAkuma(input: Readonly<{
@@ -40,10 +44,7 @@ export declare function observeAdmittedAskAkuma(input: Readonly<{
40
44
  onObserve?: AskObserver;
41
45
  outcomeObserved?: OutcomeObserver;
42
46
  }>): Promise<AkumaAskResult>;
43
- export declare function executeAskAkuma(input: TellExecutionInput & Readonly<{
44
- timeoutMs?: number;
45
- schemaJson?: string;
46
- }>): Promise<AkumaAskResult>;
47
+ export declare function executeAskAkuma(input: AskExecutionInput): Promise<AkumaAskResult>;
47
48
  type KillExecutionInput = Readonly<{
48
49
  path: WorldRoot;
49
50
  ids: readonly AkumaStatus["id"][];