@astrosheep/keiyaku 4.0.1 → 4.0.3

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 (246) hide show
  1. package/README.md +137 -5
  2. package/build/integrations/marketplace/plugins/keiyaku/.claude-plugin/plugin.json +1 -1
  3. package/build/integrations/marketplace/plugins/keiyaku/.codex-plugin/plugin.json +1 -1
  4. package/build/integrations/marketplace/plugins/keiyaku/package.json +1 -1
  5. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku/SKILL.md +3 -3
  6. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-akuma/SKILL.md +91 -35
  7. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-bind/SKILL.md +89 -58
  8. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-workflow/SKILL.md +146 -53
  9. package/build/src/akuma/abort.d.ts +2 -0
  10. package/build/src/akuma/abort.js +50 -0
  11. package/build/src/akuma/akuma.d.ts +23 -14
  12. package/build/src/akuma/akuma.js +120 -104
  13. package/build/src/akuma/archetype.d.ts +7 -6
  14. package/build/src/akuma/archetype.js +68 -41
  15. package/build/src/akuma/body.d.ts +3 -5
  16. package/build/src/akuma/body.js +417 -214
  17. package/build/src/akuma/heart/facts.d.ts +25 -34
  18. package/build/src/akuma/heart/facts.js +18 -7
  19. package/build/src/akuma/heart/index.d.ts +39 -42
  20. package/build/src/akuma/heart/index.js +134 -93
  21. package/build/src/akuma/heart/rows.d.ts +9 -31
  22. package/build/src/akuma/heart/rows.js +26 -44
  23. package/build/src/akuma/heart/schema.d.ts +1 -1
  24. package/build/src/akuma/heart/schema.js +7 -15
  25. package/build/src/akuma/heart/soul.d.ts +8 -0
  26. package/build/src/akuma/heart/soul.js +136 -0
  27. package/build/src/akuma/heart/storage.d.ts +29 -14
  28. package/build/src/akuma/heart/storage.js +91 -26
  29. package/build/src/akuma/identity.d.ts +2 -2
  30. package/build/src/akuma/identity.js +9 -9
  31. package/build/src/akuma/index.d.ts +6 -1
  32. package/build/src/akuma/index.js +6 -0
  33. package/build/src/akuma/projection.d.ts +117 -38
  34. package/build/src/akuma/projection.js +208 -97
  35. package/build/src/akuma/provider-recipe.d.ts +24 -0
  36. package/build/src/akuma/provider-recipe.js +100 -0
  37. package/build/src/akuma/provider.d.ts +12 -4
  38. package/build/src/akuma/provider.js +117 -70
  39. package/build/src/akuma/providers/acp/core.d.ts +19 -0
  40. package/build/src/akuma/providers/acp/core.js +159 -0
  41. package/build/src/akuma/providers/acp/events.d.ts +20 -0
  42. package/build/src/akuma/providers/acp/events.js +73 -0
  43. package/build/src/akuma/providers/acp/index.d.ts +12 -0
  44. package/build/src/akuma/providers/acp/index.js +94 -0
  45. package/build/src/akuma/providers/claude/events.js +66 -13
  46. package/build/src/akuma/providers/claude/index.d.ts +2 -1
  47. package/build/src/akuma/providers/claude/index.js +35 -21
  48. package/build/src/akuma/providers/codex-app-server/events.js +4 -1
  49. package/build/src/akuma/providers/codex-app-server/index.d.ts +3 -3
  50. package/build/src/akuma/providers/codex-app-server/index.js +24 -31
  51. package/build/src/akuma/providers/grok-build/index.d.ts +4 -0
  52. package/build/src/akuma/providers/grok-build/index.js +70 -0
  53. package/build/src/akuma/providers/index.d.ts +5 -3
  54. package/build/src/akuma/providers/index.js +24 -59
  55. package/build/src/akuma/providers/opencode-sdk/events.d.ts +40 -34
  56. package/build/src/akuma/providers/opencode-sdk/events.js +220 -101
  57. package/build/src/akuma/providers/opencode-sdk/index.d.ts +3 -2
  58. package/build/src/akuma/providers/opencode-sdk/index.js +233 -128
  59. package/build/src/akuma/providers/opencode-sdk/session.d.ts +11 -26
  60. package/build/src/akuma/providers/opencode-sdk/session.js +10 -9
  61. package/build/src/akuma/providers/pi/events.js +49 -11
  62. package/build/src/akuma/providers/pi/index.d.ts +1 -1
  63. package/build/src/akuma/providers/pi/index.js +50 -21
  64. package/build/src/akuma/publication.d.ts +3 -3
  65. package/build/src/akuma/publication.js +61 -44
  66. package/build/src/akuma/requests.d.ts +9 -7
  67. package/build/src/akuma/requests.js +92 -65
  68. package/build/src/alias/index.d.ts +2 -2
  69. package/build/src/alias/index.js +10 -10
  70. package/build/src/body/decode.js +7 -1
  71. package/build/src/body/region.d.ts +2 -0
  72. package/build/src/body/region.js +77 -7
  73. package/build/src/cli/accepted.d.ts +17 -13
  74. package/build/src/cli/accepted.js +72 -34
  75. package/build/src/cli/actor.js +3 -3
  76. package/build/src/cli/commands/akuma-invoke.d.ts +4 -3
  77. package/build/src/cli/commands/akuma-invoke.js +14 -9
  78. package/build/src/cli/commands/akuma.d.ts +13 -3
  79. package/build/src/cli/commands/akuma.js +67 -34
  80. package/build/src/cli/commands/contract.d.ts +18 -5
  81. package/build/src/cli/commands/contract.js +9 -3
  82. package/build/src/cli/commands/install.js +2 -2
  83. package/build/src/cli/commands/task-invoke.d.ts +17 -4
  84. package/build/src/cli/commands/task-invoke.js +43 -20
  85. package/build/src/cli/commands/task-query.d.ts +5 -0
  86. package/build/src/cli/commands/task-query.js +247 -0
  87. package/build/src/cli/commands/task.d.ts +3 -1
  88. package/build/src/cli/commands/task.js +54 -16
  89. package/build/src/cli/coordinates.d.ts +18 -0
  90. package/build/src/cli/coordinates.js +120 -0
  91. package/build/src/cli/draft.d.ts +8 -0
  92. package/build/src/cli/draft.js +96 -0
  93. package/build/src/cli/invoke.d.ts +4 -3
  94. package/build/src/cli/invoke.js +160 -179
  95. package/build/src/cli/main.js +34 -6
  96. package/build/src/cli/parse.d.ts +9 -2
  97. package/build/src/cli/parse.js +31 -9
  98. package/build/src/cli/render/akuma-tool-command.d.ts +6 -0
  99. package/build/src/cli/render/akuma-tool-command.js +144 -0
  100. package/build/src/cli/render/akuma-tool.d.ts +2 -2
  101. package/build/src/cli/render/akuma-tool.js +30 -4
  102. package/build/src/cli/render/akuma.d.ts +1 -0
  103. package/build/src/cli/render/akuma.js +211 -116
  104. package/build/src/cli/render/audit.d.ts +3 -0
  105. package/build/src/cli/render/audit.js +104 -0
  106. package/build/src/cli/render/contract.d.ts +3 -3
  107. package/build/src/cli/render/contract.js +192 -79
  108. package/build/src/cli/render/kanshi.js +263 -168
  109. package/build/src/cli/render/receipt.d.ts +19 -0
  110. package/build/src/cli/render/receipt.js +106 -0
  111. package/build/src/cli/render/refusal.d.ts +16 -2
  112. package/build/src/cli/render/refusal.js +88 -20
  113. package/build/src/cli/render/region.d.ts +2 -0
  114. package/build/src/cli/render/region.js +17 -0
  115. package/build/src/cli/render/task.d.ts +2 -1
  116. package/build/src/cli/render/task.js +223 -60
  117. package/build/src/cli/render/terminal.d.ts +7 -0
  118. package/build/src/cli/render/terminal.js +46 -0
  119. package/build/src/cli/render/text.js +6 -3
  120. package/build/src/cli/result.d.ts +115 -20
  121. package/build/src/cli/usage.d.ts +3 -0
  122. package/build/src/cli/usage.js +7 -0
  123. package/build/src/contract-worktree.d.ts +6 -5
  124. package/build/src/contract-worktree.js +95 -57
  125. package/build/src/coordination/durable-file.d.ts +4 -3
  126. package/build/src/coordination/durable-file.js +29 -25
  127. package/build/src/coordination/sqlite-transaction-lock.d.ts +4 -0
  128. package/build/src/coordination/sqlite-transaction-lock.js +22 -5
  129. package/build/src/core/facts/fold.js +1 -6
  130. package/build/src/core/facts/gate.d.ts +1 -0
  131. package/build/src/core/facts/gate.js +1 -0
  132. package/build/src/core/verbs/amend.d.ts +1 -1
  133. package/build/src/core/verbs/amend.js +0 -11
  134. package/build/src/core/verbs/deliver.d.ts +1 -1
  135. package/build/src/core/verbs/deliver.js +1 -7
  136. package/build/src/core/verbs/placement.d.ts +1 -1
  137. package/build/src/core/verbs/placement.js +4 -1
  138. package/build/src/dispatch/index.d.ts +2 -2
  139. package/build/src/dispatch/index.js +17 -17
  140. package/build/src/git/admission.d.ts +1 -1
  141. package/build/src/git/admission.js +11 -11
  142. package/build/src/git/hooks.js +13 -13
  143. package/build/src/git/integration.d.ts +14 -15
  144. package/build/src/git/integration.js +80 -44
  145. package/build/src/git/observe.d.ts +5 -3
  146. package/build/src/git/observe.js +18 -12
  147. package/build/src/git/read-observation.js +10 -9
  148. package/build/src/git/reconcile.d.ts +2 -0
  149. package/build/src/git/reconcile.js +138 -95
  150. package/build/src/git/repository.d.ts +27 -19
  151. package/build/src/git/repository.js +155 -83
  152. package/build/src/git/scratch.d.ts +7 -3
  153. package/build/src/git/scratch.js +44 -37
  154. package/build/src/git/target-placement.d.ts +40 -4
  155. package/build/src/git/target-placement.js +221 -101
  156. package/build/src/git/tender.d.ts +6 -5
  157. package/build/src/git/tender.js +24 -43
  158. package/build/src/git/terminal-seal.d.ts +1 -1
  159. package/build/src/git/terminal-seal.js +7 -5
  160. package/build/src/git/workspace.d.ts +36 -4
  161. package/build/src/git/workspace.js +53 -18
  162. package/build/src/identity/selector.js +1 -1
  163. package/build/src/index.d.ts +3 -3
  164. package/build/src/index.js +1 -1
  165. package/build/src/kanshi/index.d.ts +2 -2
  166. package/build/src/kanshi/index.js +1 -1
  167. package/build/src/kanshi/read.d.ts +2 -1
  168. package/build/src/kanshi/read.js +118 -27
  169. package/build/src/kanshi/report.d.ts +50 -0
  170. package/build/src/kanshi/select.d.ts +5 -0
  171. package/build/src/kanshi/select.js +32 -0
  172. package/build/src/library/address.d.ts +12 -3
  173. package/build/src/library/address.js +77 -46
  174. package/build/src/library/akuma-creation.d.ts +6 -1
  175. package/build/src/library/akuma-creation.js +86 -13
  176. package/build/src/library/audit.d.ts +18 -0
  177. package/build/src/library/audit.js +44 -0
  178. package/build/src/library/bind.js +4 -4
  179. package/build/src/library/catalog.d.ts +1 -1
  180. package/build/src/library/catalog.js +5 -8
  181. package/build/src/library/contract.d.ts +5 -6
  182. package/build/src/library/contract.js +11 -35
  183. package/build/src/library/delivery.d.ts +2 -1
  184. package/build/src/library/fleet.d.ts +2 -2
  185. package/build/src/library/fleet.js +35 -71
  186. package/build/src/library/keiyaku.d.ts +3 -2
  187. package/build/src/library/keiyaku.js +1 -0
  188. package/build/src/library/mutation.d.ts +7 -6
  189. package/build/src/library/mutation.js +23 -25
  190. package/build/src/library/reconcile.d.ts +29 -0
  191. package/build/src/library/reconcile.js +179 -0
  192. package/build/src/library/region.d.ts +12 -0
  193. package/build/src/library/region.js +15 -1
  194. package/build/src/library/repo.d.ts +4 -16
  195. package/build/src/library/repo.js +13 -38
  196. package/build/src/protocol/attempt.js +6 -6
  197. package/build/src/protocol/bind.js +4 -4
  198. package/build/src/protocol/intent.d.ts +15 -2
  199. package/build/src/protocol/intent.js +21 -6
  200. package/build/src/protocol/operations.d.ts +73 -22
  201. package/build/src/protocol/operations.js +292 -88
  202. package/build/src/protocol/outcome.d.ts +9 -3
  203. package/build/src/protocol/outcome.js +3 -1
  204. package/build/src/protocol/placement.d.ts +15 -4
  205. package/build/src/protocol/placement.js +58 -25
  206. package/build/src/protocol/read/status.d.ts +8 -1
  207. package/build/src/protocol/read/status.js +61 -14
  208. package/build/src/runtime/proc/line-rpc.d.ts +3 -8
  209. package/build/src/runtime/proc/line-rpc.js +16 -43
  210. package/build/src/runtime/proc/run.d.ts +15 -29
  211. package/build/src/runtime/proc/run.js +113 -105
  212. package/build/src/runtime/proc/stdio.d.ts +18 -0
  213. package/build/src/runtime/proc/stdio.js +58 -0
  214. package/build/src/settings.d.ts +2 -2
  215. package/build/src/settings.js +8 -8
  216. package/build/src/settlement/fence.d.ts +0 -4
  217. package/build/src/settlement/fence.js +0 -9
  218. package/build/src/settlement/holder.d.ts +11 -1
  219. package/build/src/settlement/holder.js +25 -0
  220. package/build/src/settlement/settle.d.ts +1 -1
  221. package/build/src/settlement/settle.js +52 -89
  222. package/build/src/task/board.d.ts +3 -3
  223. package/build/src/task/board.js +6 -9
  224. package/build/src/task/compose.d.ts +1 -1
  225. package/build/src/task/compose.js +18 -10
  226. package/build/src/task/context.d.ts +3 -3
  227. package/build/src/task/context.js +14 -14
  228. package/build/src/task/document.d.ts +2 -1
  229. package/build/src/task/document.js +15 -5
  230. package/build/src/task/index.d.ts +19 -7
  231. package/build/src/task/index.js +42 -23
  232. package/build/src/task/operations.d.ts +15 -9
  233. package/build/src/task/operations.js +78 -48
  234. package/build/src/task/query.d.ts +67 -0
  235. package/build/src/task/query.js +279 -0
  236. package/build/src/task/store.d.ts +2 -2
  237. package/build/src/task/store.js +40 -25
  238. package/build/src/verification/execution.d.ts +4 -2
  239. package/build/src/verification/execution.js +9 -5
  240. package/build/src/workspace-place.d.ts +41 -0
  241. package/build/src/workspace-place.js +386 -0
  242. package/build/src/world.d.ts +13 -2
  243. package/build/src/world.js +81 -48
  244. package/package.json +3 -2
  245. package/build/src/protocol/read/audit.d.ts +0 -31
  246. package/build/src/protocol/read/audit.js +0 -55
@@ -1,28 +1,35 @@
1
1
  ---
2
2
  name: keiyaku-workflow
3
- description: Use when authoring, binding, delivering, reviewing, amending, auditing, or abandoning a Keiyaku v4 Contract.
3
+ description: Use when authoring, binding, auditing, delivering, reviewing, amending, or abandoning a Keiyaku v4 Contract.
4
4
  ---
5
5
 
6
6
  # Keiyaku Workflow
7
7
 
8
- A Contract turns one bounded delivery into acceptable terms: write what done
9
- means, bind it, work in the worktree the receipt names, and deliver. When
10
- every declared gate is current, the result lands on the target ref. This is
11
- the whole trip from current work to `claimed`.
8
+ A Contract turns one bounded delivery into acceptable terms: bind it, work in
9
+ the appointed worktree, audit the Contract, deliver, then review. When every
10
+ declared gate is current, the result lands on the target ref.
12
11
 
13
12
  ## How The Delivery Moves
14
13
 
15
14
  ```text
16
- contract document -> bind -> work in the Contract worktree -> deliver
17
- -> review gates -> placement -> claimed
18
- \-> abandoned
15
+ contract document -> bind -> work -> audit -> deliver -> review gates
16
+ -> placement -> claimed
17
+ \-> abandoned
19
18
  ```
20
19
 
21
20
  The lifecycle is `waiting -> bound -> pending-delivery -> claimed | abandoned`;
22
- the last two are terminal. `--after` prerequisites hold a Contract at
23
- `waiting`; it becomes `bound` automatically once they are satisfied. You never
24
- push it through states by hand: `deliver` and satisfied reviews request
25
- placement, and placement claims when the gates allow it.
21
+ the last two are terminal. Reserve `--after` for true logical ordering: one
22
+ Contract's result must ultimately build on another's settled outcome, or their
23
+ intended work has a large or irreconcilable interaction that should be
24
+ sequenced. Ordinary Region overlap is not enough. Small overlaps may proceed
25
+ under Git's optimistic write model and be resolved manually or by a delegated
26
+ worker. At runtime prerequisites are placement obligations, not a delivery
27
+ admission gate: a Contract may record `bound` and deliver before they claim,
28
+ while placement waits for the current prerequisites and declared gates. Active
29
+ terms may amend `--after` after `bound` or `deliver`; terminal Contracts remain
30
+ immutable. You never push it through states by hand: `deliver` and satisfied
31
+ reviews request placement, and placement claims when every prerequisite and
32
+ gate allows it.
26
33
 
27
34
  ## Bind
28
35
 
@@ -34,15 +41,31 @@ bind inputs, and read the receipt. Continue here from that receipt.
34
41
  Change and test code in the worktree the bind receipt names. `deliver` accepts
35
42
  a clean worktree by default. You may commit first, or explicitly include all
36
43
  non-ignored staged, unstaged, and untracked final bytes with
37
- `deliver --include-dirty`. Check where you are at any point:
44
+ `deliver --include-dirty`.
45
+
46
+ ## Regain The Picture
47
+
48
+ Rebuild state from reads, not memory — after a compact, a handoff, or any
49
+ surprising receipt, read before acting:
38
50
 
39
51
  ```bash
40
- keiyaku status [<contract>|@<contract>]
52
+ keiyaku status # the whole board
53
+ keiyaku status <contract> # lifecycle, candidate, one mark per gate
54
+ keiyaku show <contract> # the exact current Contract terms
55
+ keiyaku region # every active Contract's declared surfaces
56
+ keiyaku region <contract> # one Contract's declared intent
57
+ keiyaku region --overlap # which declared intents intersect
58
+ keiyaku region --path <path> # which active Contracts declare this path
41
59
  ```
42
60
 
43
- `status` shows the lifecycle state, the candidate, and one mark per gate: `✓`
44
- current satisfied, `!` current unsatisfied, `?` stale because the patch or
45
- document changed after the evidence, and `○` missing.
61
+ `status` marks each gate: `✓` current satisfied, `!` current unsatisfied, `?`
62
+ stale because the patch or document changed after the evidence, `○` missing.
63
+ A Region is a Contract's declared write intent — not ownership, not a gate,
64
+ and not a Git conflict. Read the world before decomposing or commissioning
65
+ into an occupied repository; read `--overlap` before choosing a landing order
66
+ or an `--after` edge; read `--path` before touching a file that may belong to
67
+ another lane. Regions are declarations only, a coarse planning signal: actual
68
+ touched paths and conflicts remain Git's.
46
69
 
47
70
  ## Commission A Contract
48
71
 
@@ -71,25 +94,54 @@ frontmatter names `Contract`, then reads the listed owner documents and source
71
94
  files before acting. Do not substitute a generic repository tour for the files
72
95
  that actually govern the assignment.
73
96
 
74
- A `Deliverer` implements and verifies the terms, keeps all work in `Worktree`,
75
- and reports the candidate, checks run, and unmet terms. A `Reviewer` reads the
76
- same worktree and Contract, judges the current candidate with direct evidence,
77
- and does not modify it. If `Seat`, `Worktree`, or the required reading list is
78
- missing or contradictory, the worker stops and asks the caller instead of
79
- guessing.
97
+ A `Deliverer` implements and verifies the terms in `Worktree`. Commission a
98
+ `Reviewer` after delivery. The reviewer inspects the complete current Contract
99
+ worktree snapshot, not a worker report or named candidate commit, and does not
100
+ modify it. Missing or contradictory seat, worktree, or reading list means stop
101
+ and ask.
102
+
103
+ Observe commissioned workers through their Contract association instead of
104
+ collecting Aku ids by hand:
105
+
106
+ ```bash
107
+ keiyaku wait kei/<contract> --all --timeout 5m
108
+ keiyaku wait kei/<first> kei/<second> --any --timeout 5m
109
+ ```
110
+
111
+ A Contract selector snapshots its dispatched workers when the command starts.
112
+ Use `--all` to wait for every selected worker or `--any` to return when one
113
+ finishes; an expanded set with more than one worker requires an explicit mode.
114
+
115
+ ## Decompose Complex Work
80
116
 
81
- ## Arcs For Large Deliveries
117
+ Complex Keiyaku should be divided along independently acceptable delivery
118
+ boundaries. Use judgment to find those boundaries from the work's objectives,
119
+ dependencies, Regions, and acceptance criteria; raw size or file count is not
120
+ the test. Give each resulting Contract coherent terms. Connect them with
121
+ `--after` only when one must proceed from another's settled result or their
122
+ intended work is unsafe to run concurrently.
82
123
 
83
- When one Contract carries several coherent chunks, record each chunk as an arc
84
- before moving to the next:
124
+ When one acceptance boundary still spans several coherent chapters,
125
+ organize them as arcs. An arc is a chapter of the delivery's
126
+ story, not a task list: its title names the chapter, Objective is the
127
+ chapter's aim, Brief opens the next chapter. When an Arc is active, stay
128
+ within that current chapter. `.keiyaku/KEIYAKU.md` renders the current Arc.
129
+ Record the next chapter before entering it:
85
130
 
86
131
  ```bash
87
- keiyaku arc <contract> -
132
+ keiyaku arc <contract> - <<'KEIYAKU'
133
+ # <chapter title>
134
+
135
+ ## Objective
136
+ <nonblank objective>
137
+
138
+ ## Brief
139
+ <nonblank dispatch brief>
140
+ KEIYAKU
88
141
  ```
89
142
 
90
- The stdin body is the arc's Markdown; see `arc --help` for its shape. Arcs
91
- narrate one delivery; they do not split acceptance. Work that needs its own
92
- independent acceptance is a new Contract, not an arc.
143
+ All chapters live inside that Contract's single delivery and acceptance
144
+ boundary. The document grammar authority is `docs/document.md`.
93
145
 
94
146
  ## Amend Or Start Over
95
147
 
@@ -105,14 +157,35 @@ See `amend --help` for the operation grammar. If the objective or boundary
105
157
  itself changed, `abandon` with a note and bind a new Contract; do not steer an
106
158
  old Contract onto a different delivery.
107
159
 
160
+ ## Audit Before Delivery
161
+
162
+ Audit is how you see a delivery before it exists:
163
+
164
+ ```bash
165
+ keiyaku audit <contract> --diff
166
+ ```
167
+
168
+ Audit answers three already-adjudicated questions: candidate, Verification,
169
+ and target. It uses the same candidate preparation as deliver, shows the
170
+ prospective identity and optional requested diff, and runs declared
171
+ Verification against that candidate. A terminal run records ordinary
172
+ subject-bound `verified` testimony; it does not record a delivery or request
173
+ placement. Read those three answers instead of trusting a worker's completion
174
+ report.
175
+
108
176
  ## Deliver
109
177
 
178
+ Deliver when the worktree content is the candidate you intend to land:
179
+
110
180
  ```bash
111
181
  keiyaku deliver <contract>
112
182
  ```
113
183
 
114
- `deliver` tenders the clean `HEAD`, runs the declared `Verification`, records
115
- the candidate, and requests placement. If the workspace is dirty, the refusal
184
+ `deliver` freshly tenders the clean `HEAD`, records the candidate, and requests
185
+ placement. When a current audit attestation names the identical integration
186
+ snapshot and Verification segment, deliver reuses it; otherwise it runs the
187
+ declarations. Worktree, target, policy, document, Verification, or
188
+ snapshot-producing option changes prevent reuse. If the workspace is dirty, the refusal
116
189
  lists staged, unstaged, and untracked paths, a short statistic, and the
117
190
  `--include-dirty` option. Use that option only when the complete current
118
191
  workspace is the intended delivery; dirty submodule internals cannot be
@@ -123,10 +196,9 @@ included. Read the receipt:
123
196
  - When a gate is not current, the receipt shows the recorded candidate and the
124
197
  placement stop. This is not a failed delivery. The Contract stays
125
198
  `pending-delivery` while you complete the gates.
126
-
127
- Verification declarations may set an individual timeout in the fence info
128
- string, using an explicit duration unit such as `bash timeout=5m`. Omit the
129
- attribute for an unbounded declaration; there is no Verification-wide timeout.
199
+ - A lag row reports an accepted physical effect that has not finished. The
200
+ delivery stands; `reconcile` completes the effect later. It never changes
201
+ the verdict.
130
202
 
131
203
  ## Review Gates
132
204
 
@@ -137,17 +209,40 @@ keiyaku review <contract> --satisfied --summary "<conclusion>"
137
209
  keiyaku review <contract> --unsatisfied --summary "<finding>"
138
210
  ```
139
211
 
140
- Have an independent reviewer read the exact Contract worktree first; the
141
- `review` command records the gate-visible verdict. `--satisfied` requests
142
- placement. If the same patch is already delivered and the other gates are
143
- current, the receipt shows `claimed`. Review works before or after deliver.
144
- When the reviewed projection includes ordinary dirty workspace bytes, the
145
- review receipt discloses those paths and stats; delivery still needs
146
- `deliver --include-dirty` before those bytes become the candidate.
147
-
148
- Fixing findings changes the patch, which turns earlier evidence stale (`?` in
149
- `status`): review the current patch again. Record `--unsatisfied` only when the
150
- negative judgment should remain in Contract history.
212
+ Have an independent reviewer inspect the delivered Contract worktree snapshot.
213
+ The `review` command records the verdict. `--satisfied` requests placement; if
214
+ the other gates are current, the receipt shows `claimed`.
215
+
216
+ Fixing findings changes the patch and makes earlier evidence stale (`?` in
217
+ `status`). Audit the rework, deliver it, then review again. Record
218
+ `--unsatisfied` only when the negative judgment should remain in Contract
219
+ history.
220
+
221
+ ## When Multiple Contracts Overlap On One Target
222
+
223
+ When active Contracts write a shared surface, landing order is a coordinator
224
+ judgment, not Contract state. Keep the decision in the workflow skill; do not
225
+ persist a train or add a second placement authority.
226
+
227
+ - `audit` and a reviewer's report are preliminary. `review --satisfied` is
228
+ authoritative gate testimony: it requests placement and claims when
229
+ delivery, prerequisites, and all gates are current. Record it only when the
230
+ reviewed bytes are intended to land now.
231
+ - Before recording a satisfied review, or delivering a Contract with no
232
+ declared gates, ask whether the exact patch will survive until placement. A
233
+ pure rebase whose `ChangeId` is unchanged keeps the existing review current;
234
+ do not re-review content addressing kept alive. Conflict resolution that
235
+ changes the `ChangeId` makes earlier testimony stale and requires a fresh
236
+ review against the resolved candidate.
237
+ - For Contracts known to overlap, resolve the current-target integration before
238
+ the authoritative review. Preliminary feedback may happen earlier, but it
239
+ is not a satisfied gate until its reviewed patch is the candidate intended
240
+ for placement. Land overlapping Contracts one at a time; let independent,
241
+ non-overlapping Contracts proceed without ceremony. Treat overlap as a
242
+ planning signal, not a correctness verdict.
243
+ - After target movement, a changed candidate, or a placement refusal, read the
244
+ current Contract facts again. Recompute the next landing judgment from those
245
+ facts; do not rely on a remembered queue or promise exactly one rebase.
151
246
 
152
247
  ## Target Placement
153
248
 
@@ -168,18 +263,16 @@ Placement follows the Git mental model you already have:
168
263
  After a refusal, handle the listed paths, then `deliver` again or record a
169
264
  satisfied review; either command requests placement again.
170
265
 
171
- ## Observe, Recover, Or End
266
+ ## Recover Or End
172
267
 
173
268
  ```bash
174
- keiyaku audit <contract> [--show-diff-body] # report only; never places
175
269
  keiyaku reconcile <contract> # finish accepted lagging effects
176
270
  keiyaku abandon <contract> --note "<why>" # terminal; target untouched
177
271
  ```
178
272
 
179
- `audit` is one aggregate read of the document, candidate diff, Verification,
180
- gates, and target status. `reconcile` completes physical effects of already
181
- accepted placements; it does not retry an ordinary placement refusal.
182
- `abandon` ends the Contract and never touches the target.
273
+ `reconcile` completes physical effects of already accepted placements; it does
274
+ not retry an ordinary placement refusal. `abandon` ends the Contract and never
275
+ touches the target.
183
276
 
184
277
  ## Routine Output
185
278
 
@@ -0,0 +1,2 @@
1
+ export declare function abortable<T>(operation: Promise<T>, signal: AbortSignal, disposeLate?: (value: T) => Promise<void> | void): Promise<T>;
2
+ export declare function abortableDelay(milliseconds: number, signal?: AbortSignal): Promise<void>;
@@ -0,0 +1,50 @@
1
+ export function abortable(operation, signal, disposeLate) {
2
+ signal.throwIfAborted();
3
+ return new Promise((resolve, reject) => {
4
+ let aborted = false;
5
+ const abort = () => {
6
+ aborted = true;
7
+ if (disposeLate === undefined)
8
+ reject(signal.reason);
9
+ };
10
+ signal.addEventListener("abort", abort, { once: true });
11
+ if (signal.aborted)
12
+ abort();
13
+ void operation.then(async (value) => {
14
+ signal.removeEventListener("abort", abort);
15
+ if (!aborted) {
16
+ resolve(value);
17
+ return;
18
+ }
19
+ try {
20
+ await disposeLate?.(value);
21
+ }
22
+ catch (error) {
23
+ reject(error);
24
+ return;
25
+ }
26
+ reject(signal.reason);
27
+ }, (error) => {
28
+ signal.removeEventListener("abort", abort);
29
+ reject(aborted ? signal.reason : error);
30
+ });
31
+ });
32
+ }
33
+ export function abortableDelay(milliseconds, signal) {
34
+ if (signal === undefined)
35
+ return new Promise((resolve) => setTimeout(resolve, milliseconds));
36
+ signal.throwIfAborted();
37
+ return new Promise((resolve, reject) => {
38
+ const timeout = setTimeout(() => {
39
+ signal.removeEventListener("abort", abort);
40
+ resolve();
41
+ }, milliseconds);
42
+ const abort = () => {
43
+ clearTimeout(timeout);
44
+ reject(signal.reason);
45
+ };
46
+ signal.addEventListener("abort", abort, { once: true });
47
+ if (signal.aborted)
48
+ abort();
49
+ });
50
+ }
@@ -1,4 +1,4 @@
1
- import { type AkumaLife, type CollarProbe, type KillEvidence, type ResumeCoordinate, type Soul } from "./heart/index.js";
1
+ import { type AkumaLife, type KillEvidence, type ResumeCoordinate, type Soul } from "./heart/index.js";
2
2
  import { type AkuId } from "./identity.js";
3
3
  import { type ActivityHistory, type ActivitySnapshot } from "./projection.js";
4
4
  import { type Settings } from "../settings.js";
@@ -8,18 +8,19 @@ export type AkumaListRow = Readonly<{
8
8
  archetype: string;
9
9
  description?: string;
10
10
  life: AkumaLife;
11
- collar: CollarProbe;
11
+ lifeAt: string | null;
12
12
  confinement: Soul["confinement"];
13
13
  pending: readonly string[];
14
14
  }>;
15
15
  export type AkumaStatus = Readonly<{
16
16
  id: AkuId;
17
17
  life: AkumaLife;
18
- collar: CollarProbe;
18
+ readonly?: Soul["readonly"];
19
19
  timeline: ActivitySnapshot;
20
20
  strandedReason?: "resume-unsupported";
21
21
  }>;
22
- export type { ActivityHistory, ActivityRow, ActivitySnapshot, ActivitySnapshotEntry } from "./projection.js";
22
+ export type { ReadonlyRestraint } from "./provider-recipe.js";
23
+ export type * from "./projection.js";
23
24
  export type UnbornAkumaListRow = Readonly<{
24
25
  id: AkuId;
25
26
  life: "unborn" | "stillborn";
@@ -46,11 +47,11 @@ export type TellResult = Readonly<{
46
47
  }>;
47
48
  }>;
48
49
  export type InterruptReceipt = Readonly<{
49
- kind: "unstoppable";
50
- evidence: "no-collar" | "collar-unverifiable" | "unavailable" | "alive-after-sigkill" | "leash-held-after-put-down";
50
+ kind: "unavailable";
51
+ evidence: "hung" | "untidy" | "unavailable";
51
52
  }> | Readonly<{
52
53
  kind: "interrupted";
53
- putDown: "was-idle" | "self-aborted" | "collar";
54
+ putDown: "was-idle" | "self-aborted";
54
55
  tell: TellResult;
55
56
  }>;
56
57
  export type ForkReceipt = Readonly<{
@@ -75,19 +76,27 @@ export declare class AkumaNotBornError extends Error {
75
76
  readonly kind = "akuma-not-born";
76
77
  constructor(id: AkuId);
77
78
  }
78
- /** Package-internal compact observation for action feedback. */
79
- export declare function readActionFeedbackStatus(worldPath: WorldRoot, id: AkuId): AkumaStatus;
79
+ /** Package-internal action observation; it uses the same snapshot selector as status. */
80
+ export declare function readActionFeedbackStatus(worldPath: WorldRoot, id: AkuId): Promise<AkumaStatus>;
81
+ export type BudgetedStatusObservation = Readonly<{
82
+ status: AkumaStatus;
83
+ ordinarySelected: number;
84
+ }>;
85
+ /** Package-internal budgeted observation; Fleet allocates, Akuma still selects. */
86
+ export declare function readBudgetedStatus(worldPath: WorldRoot, id: AkuId, input: Readonly<{
87
+ ordinaryBudget: number;
88
+ }>): Promise<BudgetedStatusObservation>;
80
89
  export declare class AkumaHandle {
81
90
  readonly id: AkuId;
82
91
  private readonly worldPath;
83
92
  constructor(id: AkuId, worldPath: WorldRoot);
84
93
  private get paths();
85
- status(): AkumaStatus;
94
+ status(): Promise<AkumaStatus>;
86
95
  history(input?: Readonly<{
87
96
  before?: number;
88
97
  since?: number;
89
98
  limit?: number;
90
- }>): ActivityHistory;
99
+ }>): Promise<ActivityHistory>;
91
100
  wait(predicate?: (status: AkumaStatus) => boolean, options?: Readonly<{
92
101
  timeoutMs?: number;
93
102
  }>): Promise<AkumaStatus>;
@@ -97,7 +106,7 @@ export declare class AkumaHandle {
97
106
  at: string;
98
107
  }>): Promise<ForkReceipt>;
99
108
  kill(): Promise<KillEvidence>;
100
- lastAnswer(): LastAnswer;
109
+ lastAnswer(): Promise<LastAnswer>;
101
110
  }
102
111
  export type LastAnswer = Readonly<{
103
112
  kind: "answer";
@@ -114,11 +123,11 @@ export declare class Akuma {
114
123
  of(input: Readonly<{
115
124
  id: string;
116
125
  }>): AkumaHandle;
117
- listArchetypes(): readonly string[];
126
+ listArchetypes(): Promise<readonly string[]>;
118
127
  call(input: Readonly<{
119
128
  archetype: string;
120
129
  body: string;
121
130
  cwd?: string;
122
131
  }>): Promise<AkumaHandle>;
123
- list(input?: AkumaListInput): AkumaList;
132
+ list(input?: AkumaListInput): Promise<AkumaList>;
124
133
  }