@astrosheep/keiyaku 4.6.30 → 4.6.31

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 (398) hide show
  1. package/README.md +5 -5
  2. package/build/plugins/claude/.claude-plugin/plugin.json +1 -1
  3. package/build/plugins/claude/skills/keiyaku/SKILL.md +12 -12
  4. package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +16 -16
  5. package/build/plugins/claude/skills/keiyaku-akuma/references/automation.md +14 -14
  6. package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +10 -10
  7. package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +15 -15
  8. package/build/plugins/claude/skills/keiyaku-debt/SKILL.md +16 -16
  9. package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +21 -21
  10. package/build/plugins/codex/.codex-plugin/plugin.json +1 -1
  11. package/build/plugins/codex/skills/keiyaku/SKILL.md +12 -12
  12. package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +16 -16
  13. package/build/plugins/codex/skills/keiyaku-akuma/references/automation.md +14 -14
  14. package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +10 -10
  15. package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +15 -15
  16. package/build/plugins/codex/skills/keiyaku-debt/SKILL.md +16 -16
  17. package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +21 -21
  18. package/build/plugins/opencode/package.json +1 -1
  19. package/build/plugins/opencode/skills/keiyaku/SKILL.md +12 -12
  20. package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +16 -16
  21. package/build/plugins/opencode/skills/keiyaku-akuma/references/automation.md +14 -14
  22. package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +10 -10
  23. package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +15 -15
  24. package/build/plugins/opencode/skills/keiyaku-debt/SKILL.md +16 -16
  25. package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +21 -21
  26. package/build/plugins/pi/README.md +5 -5
  27. package/build/plugins/pi/akuma-tools.ts +17 -23
  28. package/build/skills/keiyaku/SKILL.md +12 -12
  29. package/build/skills/keiyaku-akuma/SKILL.md +16 -16
  30. package/build/skills/keiyaku-akuma/references/automation.md +14 -14
  31. package/build/skills/keiyaku-babysit/SKILL.md +10 -10
  32. package/build/skills/keiyaku-bind/SKILL.md +15 -15
  33. package/build/skills/keiyaku-debt/SKILL.md +16 -16
  34. package/build/skills/keiyaku-workflow/SKILL.md +21 -21
  35. package/build/src/akuma/akuma-call.d.ts +1 -1
  36. package/build/src/akuma/akuma-call.js +9 -9
  37. package/build/src/akuma/akuma-errors.d.ts +5 -5
  38. package/build/src/akuma/akuma-instance.d.ts +355 -12
  39. package/build/src/akuma/akuma-instance.js +20 -20
  40. package/build/src/akuma/akuma-observe.d.ts +11 -12
  41. package/build/src/akuma/akuma-observe.js +34 -26
  42. package/build/src/akuma/akuma-owner.d.ts +32 -11
  43. package/build/src/akuma/akuma-owner.js +35 -16
  44. package/build/src/akuma/akuma-probe.d.ts +3 -3
  45. package/build/src/akuma/akuma-probe.js +2 -2
  46. package/build/src/akuma/akuma-selection-execution.d.ts +985 -1
  47. package/build/src/akuma/akuma-selection-execution.js +42 -18
  48. package/build/src/akuma/akuma-stream.d.ts +2 -2
  49. package/build/src/akuma/akuma-stream.js +1 -1
  50. package/build/src/akuma/akuma-wait.d.ts +5 -5
  51. package/build/src/akuma/akuma-wait.js +52 -14
  52. package/build/src/akuma/akuma.d.ts +245 -271
  53. package/build/src/akuma/akuma.js +98 -46
  54. package/build/src/akuma/archetype.d.ts +19 -6
  55. package/build/src/akuma/archetype.js +25 -9
  56. package/build/src/akuma/body-launch.d.ts +2 -2
  57. package/build/src/akuma/body.js +4 -4
  58. package/build/src/akuma/call-initial-tell.d.ts +60 -44
  59. package/build/src/akuma/call-initial-tell.js +41 -2
  60. package/build/src/akuma/caller.d.ts +26 -17
  61. package/build/src/akuma/caller.js +22 -9
  62. package/build/src/akuma/coordinate.d.ts +9 -0
  63. package/build/src/akuma/coordinate.js +13 -0
  64. package/build/src/akuma/detached-body.js +2 -2
  65. package/build/src/akuma/dispatch-association.d.ts +4 -4
  66. package/build/src/akuma/dispatch-association.js +12 -3
  67. package/build/src/akuma/execution-instructions.js +2 -2
  68. package/build/src/akuma/heart/facts.d.ts +29 -7
  69. package/build/src/akuma/heart/facts.js +13 -0
  70. package/build/src/akuma/heart/index.d.ts +0 -3
  71. package/build/src/akuma/heart/index.js +3 -6
  72. package/build/src/akuma/heart/rows.js +2 -2
  73. package/build/src/akuma/heart/soul.js +5 -5
  74. package/build/src/akuma/identity.d.ts +17 -16
  75. package/build/src/akuma/identity.js +20 -19
  76. package/build/src/akuma/index.d.ts +1 -2
  77. package/build/src/akuma/lineage-cache.d.ts +4 -4
  78. package/build/src/akuma/lineage-cache.js +10 -10
  79. package/build/src/akuma/projection-read.d.ts +2 -5
  80. package/build/src/akuma/projection-read.js +34 -47
  81. package/build/src/akuma/projection.d.ts +659 -569
  82. package/build/src/akuma/projection.js +203 -94
  83. package/build/src/akuma/providers/acp/index.js +1 -1
  84. package/build/src/akuma/providers/execution-environment.d.ts +1 -3
  85. package/build/src/akuma/providers/execution-environment.js +0 -4
  86. package/build/src/akuma/publication.d.ts +2 -2
  87. package/build/src/akuma/publication.js +3 -3
  88. package/build/src/akuma/retention.js +2 -2
  89. package/build/src/akuma/selection-observation.d.ts +507 -43
  90. package/build/src/akuma/selection-observation.js +153 -1
  91. package/build/src/akuma/status-projection.d.ts +288 -0
  92. package/build/src/akuma/status-projection.js +154 -0
  93. package/build/src/akuma/turn-drive.js +0 -3
  94. package/build/src/alias/index.d.ts +9 -4
  95. package/build/src/alias/index.js +11 -9
  96. package/build/src/bounded-list.d.ts +8 -0
  97. package/build/src/bounded-list.js +9 -0
  98. package/build/src/cli/commands/akuma-grammar.d.ts +2 -2
  99. package/build/src/cli/commands/akuma-grammar.js +21 -21
  100. package/build/src/cli/commands/akuma.d.ts +1 -2
  101. package/build/src/cli/commands/akuma.js +115 -251
  102. package/build/src/cli/commands/contract-grammar.d.ts +4 -3
  103. package/build/src/cli/commands/contract-grammar.js +39 -22
  104. package/build/src/cli/commands/contract-help.d.ts +3 -1
  105. package/build/src/cli/commands/contract-help.js +4 -3
  106. package/build/src/cli/commands/contract.d.ts +6 -3
  107. package/build/src/cli/commands/contract.js +203 -434
  108. package/build/src/cli/commands/debt.d.ts +2 -3
  109. package/build/src/cli/commands/debt.js +101 -317
  110. package/build/src/cli/commands/report.js +11 -28
  111. package/build/src/cli/commands/whoami.d.ts +3 -43
  112. package/build/src/cli/commands/whoami.js +8 -121
  113. package/build/src/cli/coordinates.d.ts +4 -35
  114. package/build/src/cli/coordinates.js +13 -129
  115. package/build/src/cli/parse.d.ts +0 -6
  116. package/build/src/cli/parse.js +5 -48
  117. package/build/src/cli/render/akuma-activity.d.ts +31 -16
  118. package/build/src/cli/render/akuma-activity.js +157 -149
  119. package/build/src/cli/render/akuma-tool.d.ts +3 -6
  120. package/build/src/cli/render/akuma-tool.js +20 -14
  121. package/build/src/cli/render/akuma.d.ts +25 -26
  122. package/build/src/cli/render/akuma.js +100 -129
  123. package/build/src/cli/render/catalog.d.ts +4 -7
  124. package/build/src/cli/render/catalog.js +52 -99
  125. package/build/src/cli/render/contract-history.d.ts +3 -1
  126. package/build/src/cli/render/contract-history.js +140 -215
  127. package/build/src/cli/render/contract-observation.d.ts +43 -30
  128. package/build/src/cli/render/contract-observation.js +64 -31
  129. package/build/src/cli/render/contract-wait.js +6 -6
  130. package/build/src/cli/render/contract.d.ts +41 -6
  131. package/build/src/cli/render/contract.js +274 -370
  132. package/build/src/cli/render/debt.d.ts +9 -19
  133. package/build/src/cli/render/debt.js +120 -185
  134. package/build/src/cli/render/delivery-preview.d.ts +4 -3
  135. package/build/src/cli/render/delivery-preview.js +68 -96
  136. package/build/src/cli/render/kanshi-akuma.d.ts +4 -4
  137. package/build/src/cli/render/kanshi-akuma.js +70 -59
  138. package/build/src/cli/render/kanshi.d.ts +4 -4
  139. package/build/src/cli/render/kanshi.js +205 -221
  140. package/build/src/cli/render/marks.d.ts +11 -2
  141. package/build/src/cli/render/marks.js +13 -3
  142. package/build/src/cli/render/nuke.d.ts +3 -3
  143. package/build/src/cli/render/nuke.js +13 -16
  144. package/build/src/cli/render/receipt.d.ts +37 -43
  145. package/build/src/cli/render/receipt.js +313 -236
  146. package/build/src/cli/render/reconcile.d.ts +6 -4
  147. package/build/src/cli/render/reconcile.js +53 -137
  148. package/build/src/cli/render/refusal.d.ts +3 -2
  149. package/build/src/cli/render/refusal.js +73 -54
  150. package/build/src/cli/render/region.d.ts +11 -2
  151. package/build/src/cli/render/region.js +17 -23
  152. package/build/src/cli/render/settings.d.ts +0 -1
  153. package/build/src/cli/render/settings.js +8 -17
  154. package/build/src/cli/render/terminal.d.ts +2 -0
  155. package/build/src/cli/render/verbs.d.ts +4 -0
  156. package/build/src/cli/render/verbs.js +312 -0
  157. package/build/src/cli/render/whoami.d.ts +1 -1
  158. package/build/src/cli/render/whoami.js +24 -31
  159. package/build/src/cli/runtime.d.ts +3 -11
  160. package/build/src/cli/runtime.js +96 -79
  161. package/build/src/cli/scan.d.ts +1 -1
  162. package/build/src/cli/streams.js +1 -0
  163. package/build/src/contract-guidance.js +2 -2
  164. package/build/src/contract-worktree.d.ts +2 -15
  165. package/build/src/contract-worktree.js +19 -35
  166. package/build/src/core/facts/observation.d.ts +4 -5
  167. package/build/src/core/facts/observation.js +7 -9
  168. package/build/src/core/verbs/amend.d.ts +0 -1
  169. package/build/src/core/verbs/amend.js +3 -3
  170. package/build/src/core/verbs/bind.d.ts +0 -1
  171. package/build/src/core/verbs/bind.js +5 -5
  172. package/build/src/core/verbs/deliver.d.ts +3 -2
  173. package/build/src/core/verbs/deliver.js +2 -2
  174. package/build/src/core/verbs/placement.d.ts +0 -5
  175. package/build/src/core/verbs/placement.js +4 -6
  176. package/build/src/core/verbs/reintegrate.d.ts +0 -1
  177. package/build/src/core/verbs/reintegrate.js +2 -2
  178. package/build/src/debt/board.d.ts +132 -116
  179. package/build/src/debt/board.js +138 -94
  180. package/build/src/debt/catalog.d.ts +4 -4
  181. package/build/src/debt/catalog.js +2 -18
  182. package/build/src/debt/context.d.ts +15 -3
  183. package/build/src/debt/context.js +12 -1
  184. package/build/src/debt/created-observation.d.ts +5 -17
  185. package/build/src/debt/created-observation.js +14 -6
  186. package/build/src/debt/document.d.ts +20 -15
  187. package/build/src/debt/document.js +18 -1
  188. package/build/src/debt/index.d.ts +346 -23
  189. package/build/src/debt/index.js +68 -22
  190. package/build/src/debt/input.d.ts +2 -1
  191. package/build/src/debt/input.js +14 -0
  192. package/build/src/debt/lifecycle-operations.d.ts +2 -2
  193. package/build/src/debt/lifecycle-operations.js +14 -22
  194. package/build/src/debt/operation-types.d.ts +188 -66
  195. package/build/src/debt/operation-types.js +113 -1
  196. package/build/src/debt/operations.d.ts +11 -10
  197. package/build/src/debt/operations.js +46 -71
  198. package/build/src/debt/query.d.ts +14 -10
  199. package/build/src/debt/query.js +3 -12
  200. package/build/src/debt/store.d.ts +4 -2
  201. package/build/src/debt/store.js +8 -8
  202. package/build/src/debt/view.d.ts +0 -3
  203. package/build/src/debt/view.js +0 -4
  204. package/build/src/dispatch/index.d.ts +22 -5
  205. package/build/src/dispatch/index.js +46 -37
  206. package/build/src/git/admission.d.ts +2 -2
  207. package/build/src/git/admission.js +2 -1
  208. package/build/src/git/hooks.d.ts +14 -35
  209. package/build/src/git/hooks.js +45 -25
  210. package/build/src/git/integration.d.ts +6 -24
  211. package/build/src/git/integration.js +10 -16
  212. package/build/src/git/private-state-seat.d.ts +2 -2
  213. package/build/src/git/private-state-seat.js +2 -1
  214. package/build/src/git/reconcile.d.ts +17 -79
  215. package/build/src/git/reconcile.js +37 -52
  216. package/build/src/git/scratch.d.ts +3 -3
  217. package/build/src/git/scratch.js +4 -1
  218. package/build/src/git/target-placement.d.ts +23 -31
  219. package/build/src/git/target-placement.js +42 -27
  220. package/build/src/git/target.d.ts +2 -2
  221. package/build/src/git/target.js +2 -1
  222. package/build/src/git/tender.d.ts +7 -39
  223. package/build/src/git/tender.js +21 -54
  224. package/build/src/git/terminal-reconcile.js +15 -18
  225. package/build/src/git/terminal-seal.d.ts +2 -4
  226. package/build/src/git/terminal-seal.js +7 -33
  227. package/build/src/git/workspace.d.ts +65 -41
  228. package/build/src/git/workspace.js +45 -14
  229. package/build/src/identity/selector.d.ts +2 -0
  230. package/build/src/identity/selector.js +13 -3
  231. package/build/src/index.d.ts +48 -54
  232. package/build/src/index.js +31 -43
  233. package/build/src/kanshi/counts.d.ts +42 -8
  234. package/build/src/kanshi/counts.js +13 -2
  235. package/build/src/kanshi/index.d.ts +5 -5
  236. package/build/src/kanshi/index.js +4 -3
  237. package/build/src/kanshi/read.d.ts +489 -6
  238. package/build/src/kanshi/read.js +334 -483
  239. package/build/src/kanshi/report.d.ts +2504 -103
  240. package/build/src/kanshi/report.js +165 -1
  241. package/build/src/kanshi/select.d.ts +0 -8
  242. package/build/src/kanshi/select.js +20 -59
  243. package/build/src/library/address.d.ts +8 -8
  244. package/build/src/library/address.js +7 -7
  245. package/build/src/library/akuma-creation.d.ts +690 -84
  246. package/build/src/library/akuma-creation.js +202 -142
  247. package/build/src/library/akuma-retention.d.ts +2 -2
  248. package/build/src/library/akuma-retention.js +2 -2
  249. package/build/src/library/akumas.d.ts +10 -6
  250. package/build/src/library/akumas.js +24 -7
  251. package/build/src/library/bind.d.ts +28 -54
  252. package/build/src/library/bind.js +6 -4
  253. package/build/src/library/continuation.d.ts +197 -479
  254. package/build/src/library/continuation.js +40 -23
  255. package/build/src/library/contract-address.d.ts +6 -5
  256. package/build/src/library/contract-address.js +5 -7
  257. package/build/src/library/contract-composition.d.ts +18 -12
  258. package/build/src/library/contract-composition.js +55 -47
  259. package/build/src/library/contract-creation.d.ts +3 -2
  260. package/build/src/library/contract-creation.js +38 -32
  261. package/build/src/library/contract-execution.js +77 -38
  262. package/build/src/library/contract-outcomes.d.ts +1877 -27
  263. package/build/src/library/contract-outcomes.js +93 -10
  264. package/build/src/library/contract-settings.d.ts +2 -2
  265. package/build/src/library/contract-settings.js +18 -14
  266. package/build/src/library/contract-types.d.ts +238 -61
  267. package/build/src/library/contract-types.js +131 -1
  268. package/build/src/library/contract-wait.d.ts +38 -17
  269. package/build/src/library/contract-wait.js +40 -10
  270. package/build/src/library/delivery.d.ts +588 -36
  271. package/build/src/library/delivery.js +35 -27
  272. package/build/src/library/input.d.ts +1 -1
  273. package/build/src/library/input.js +1 -2
  274. package/build/src/library/invocation.d.ts +11 -7
  275. package/build/src/library/invocation.js +42 -51
  276. package/build/src/library/kei.d.ts +48 -0
  277. package/build/src/library/kei.js +256 -0
  278. package/build/src/library/keiyaku-attribution.d.ts +11 -0
  279. package/build/src/{cli/delivery-identity.js → library/keiyaku-attribution.js} +12 -1
  280. package/build/src/library/keiyaku-classify.d.ts +11 -0
  281. package/build/src/library/keiyaku-classify.js +146 -0
  282. package/build/src/library/keiyaku-coordinates.d.ts +31 -0
  283. package/build/src/library/keiyaku-coordinates.js +103 -0
  284. package/build/src/library/keiyaku-debt.d.ts +142 -0
  285. package/build/src/library/keiyaku-debt.js +188 -0
  286. package/build/src/library/keiyaku-identity.d.ts +58 -0
  287. package/build/src/library/keiyaku-identity.js +176 -0
  288. package/build/src/library/keiyaku-policy.d.ts +27 -0
  289. package/build/src/library/keiyaku-policy.js +44 -0
  290. package/build/src/library/keiyaku-status.d.ts +1487 -0
  291. package/build/src/library/keiyaku-status.js +92 -0
  292. package/build/src/library/keiyaku-verbs.d.ts +6774 -0
  293. package/build/src/library/keiyaku-verbs.js +458 -0
  294. package/build/src/library/keiyaku.d.ts +871 -38
  295. package/build/src/library/keiyaku.js +677 -127
  296. package/build/src/library/nuke.d.ts +22 -0
  297. package/build/src/library/nuke.js +4 -1
  298. package/build/src/library/outcome.d.ts +706 -692
  299. package/build/src/library/outcome.js +582 -167
  300. package/build/src/library/reconcile.d.ts +464 -116
  301. package/build/src/library/reconcile.js +174 -102
  302. package/build/src/library/refusal.d.ts +113 -577
  303. package/build/src/library/refusal.js +64 -51
  304. package/build/src/library/region.d.ts +5 -24
  305. package/build/src/library/region.js +6 -21
  306. package/build/src/library/selection.d.ts +181 -32
  307. package/build/src/library/selection.js +99 -64
  308. package/build/src/mcp/adapter.d.ts +11 -0
  309. package/build/src/mcp/adapter.js +106 -0
  310. package/build/src/mcp/help.d.ts +1 -0
  311. package/build/src/mcp/help.js +26 -0
  312. package/build/src/mcp/index.d.ts +2 -0
  313. package/build/src/mcp/index.js +37 -0
  314. package/build/src/plugin/public.d.ts +1 -1
  315. package/build/src/plugin/runtime.js +17 -14
  316. package/build/src/protocol/arc.d.ts +4 -1
  317. package/build/src/protocol/arc.js +7 -1
  318. package/build/src/protocol/attempt.d.ts +2 -3
  319. package/build/src/protocol/attempt.js +1 -10
  320. package/build/src/protocol/bind.d.ts +6 -7
  321. package/build/src/protocol/bind.js +9 -5
  322. package/build/src/protocol/completion.d.ts +448 -12
  323. package/build/src/protocol/completion.js +164 -26
  324. package/build/src/protocol/deliver.d.ts +26 -24
  325. package/build/src/protocol/deliver.js +24 -52
  326. package/build/src/protocol/delivery-preview.d.ts +97 -247
  327. package/build/src/protocol/delivery-preview.js +132 -128
  328. package/build/src/protocol/execution-observation.d.ts +146 -123
  329. package/build/src/protocol/execution-observation.js +9 -6
  330. package/build/src/protocol/intent.d.ts +9 -48
  331. package/build/src/protocol/intent.js +32 -46
  332. package/build/src/protocol/operations.d.ts +207 -505
  333. package/build/src/protocol/operations.js +81 -134
  334. package/build/src/protocol/placement.d.ts +0 -1
  335. package/build/src/protocol/placement.js +5 -2
  336. package/build/src/protocol/progress.d.ts +7 -97
  337. package/build/src/protocol/progress.js +7 -55
  338. package/build/src/protocol/read/observation.d.ts +13 -6
  339. package/build/src/protocol/read/observation.js +10 -9
  340. package/build/src/protocol/read/status.d.ts +464 -93
  341. package/build/src/protocol/read/status.js +372 -85
  342. package/build/src/protocol/reconcile.d.ts +2 -0
  343. package/build/src/protocol/reconcile.js +12 -11
  344. package/build/src/protocol/reintegrate.d.ts +0 -1
  345. package/build/src/protocol/reintegrate.js +4 -4
  346. package/build/src/protocol/result-leaves.d.ts +528 -0
  347. package/build/src/protocol/result-leaves.js +195 -0
  348. package/build/src/protocol/result-reasons.d.ts +129 -0
  349. package/build/src/protocol/result-reasons.js +87 -0
  350. package/build/src/protocol/review.d.ts +14 -11
  351. package/build/src/protocol/review.js +30 -14
  352. package/build/src/protocol/run.d.ts +4 -4
  353. package/build/src/protocol/run.js +4 -1
  354. package/build/src/protocol/verify.d.ts +359 -30
  355. package/build/src/protocol/verify.js +118 -28
  356. package/build/src/region.d.ts +26 -0
  357. package/build/src/region.js +28 -0
  358. package/build/src/runtime/proc/diagnostic.d.ts +11 -0
  359. package/build/src/runtime/proc/diagnostic.js +20 -0
  360. package/build/src/runtime/proc/windows-launch.exe +0 -0
  361. package/build/src/settings.d.ts +126 -32
  362. package/build/src/settings.js +107 -34
  363. package/build/src/settlement/settle.d.ts +29 -12
  364. package/build/src/settlement/settle.js +22 -15
  365. package/build/src/verification/declaration.d.ts +1 -3
  366. package/build/src/verification/declaration.js +2 -5
  367. package/build/src/verification/execution.d.ts +7 -19
  368. package/build/src/verification/execution.js +37 -16
  369. package/build/src/verification/observation.d.ts +13 -13
  370. package/build/src/verification/observation.js +9 -7
  371. package/build/src/world.d.ts +8 -0
  372. package/build/src/world.js +7 -0
  373. package/package.json +6 -5
  374. package/plugins/paseo/plugin/server/keiyaku.ts +13 -46
  375. package/plugins/paseo/plugin/server/message.ts +8 -30
  376. package/plugins/paseo/plugin/server/mirror.ts +16 -20
  377. package/plugins/paseo/plugin/server/provider.ts +1 -1
  378. package/plugins/paseo/plugin/server/sdk.ts +14 -6
  379. package/plugins/pi/README.md +5 -5
  380. package/plugins/pi/akuma-tools.ts +17 -23
  381. package/skills/keiyaku/SKILL.md +12 -12
  382. package/skills/keiyaku-akuma/SKILL.md +16 -16
  383. package/skills/keiyaku-akuma/references/automation.md +14 -14
  384. package/skills/keiyaku-babysit/SKILL.md +10 -10
  385. package/skills/keiyaku-bind/SKILL.md +15 -15
  386. package/skills/keiyaku-debt/SKILL.md +16 -16
  387. package/skills/keiyaku-workflow/SKILL.md +21 -21
  388. package/build/src/cli/actor.d.ts +0 -10
  389. package/build/src/cli/actor.js +0 -24
  390. package/build/src/cli/akuma-caller.d.ts +0 -3
  391. package/build/src/cli/akuma-caller.js +0 -31
  392. package/build/src/cli/delivery-identity.d.ts +0 -3
  393. package/build/src/cli/render/effects.d.ts +0 -26
  394. package/build/src/cli/render/effects.js +0 -41
  395. package/build/src/cli/selectors.d.ts +0 -10
  396. package/build/src/cli/selectors.js +0 -42
  397. package/build/src/markdown/diff.d.ts +0 -1
  398. package/build/src/markdown/diff.js +0 -4
@@ -2,34 +2,83 @@ import { akumaBirthSchema, akumaCallerKey, decodeAkumaCaller } from "./caller.js
2
2
  import { readdir, stat } from "node:fs/promises";
3
3
  import { z } from "zod";
4
4
  import { boundedListLimit, projectBoundedList } from "../bounded-list.js";
5
+ import { akumaAliasSchema } from "../identity/selector.js";
5
6
  import { rosterListRow } from "./akuma-observe.js";
6
7
  import { AkumaOwner } from "./akuma-owner.js";
7
8
  import { readSoul } from "./heart/index.js";
8
- import { akuIdFromDirectoryName, akumaIdSchema, akumaPaths, akumaRunRoot, parseAkuId, pathsForAkuId, } from "./identity.js";
9
+ import { akumaIdFromDirectoryName, akumaIdSchema, akumaPaths, akumaRunRoot, parseAkumaId, pathsForAkumaId, } from "./identity.js";
9
10
  import { validateAkumaName } from "../identity/normalize.js";
10
11
  import { readAkumaLineage, readDirectAkumaLineage, invalidateAkumaLineage, rebuildAkumaLineage, } from "./lineage-cache.js";
11
12
  import { activitySnapshotSchema } from "./projection.js";
12
13
  import { PAGE_POOL_SIZE, boundedMap } from "./read-pool.js";
14
+ const bornLifeSchema = z.enum(["running", "asleep", "stranded", "hung", "untidy", "killed"]);
15
+ export const listedBornAkumaSchema = z
16
+ .strictObject({
17
+ id: akumaIdSchema,
18
+ life: bornLifeSchema,
19
+ lifeAt: z.string().exactOptional(),
20
+ lastActivityAt: z.string().exactOptional(),
21
+ pending: z.number().int().positive().exactOptional(),
22
+ aliases: z.array(akumaAliasSchema).nonempty().readonly().exactOptional(),
23
+ parentAkumaId: akumaIdSchema.exactOptional(),
24
+ })
25
+ .readonly();
26
+ export const listedUnbornAkumaSchema = z
27
+ .strictObject({
28
+ id: akumaIdSchema,
29
+ life: z.enum(["unborn", "stillborn"]),
30
+ aliases: z.array(akumaAliasSchema).nonempty().readonly().exactOptional(),
31
+ diagnostic: z.string().exactOptional(),
32
+ })
33
+ .readonly();
34
+ export const listedAkumaSchema = z.union([listedBornAkumaSchema, listedUnbornAkumaSchema]);
35
+ export const akumaListSchema = z
36
+ .strictObject({
37
+ observedAt: z.string(),
38
+ rows: z.array(listedAkumaSchema).nonempty().readonly().exactOptional(),
39
+ more: z.literal(true).exactOptional(),
40
+ })
41
+ .readonly();
42
+ function listedAkuma(row) {
43
+ if (row.kind === "unborn")
44
+ return {
45
+ id: row.id,
46
+ life: row.life,
47
+ ...(row.diagnostic === undefined ? {} : { diagnostic: row.diagnostic }),
48
+ };
49
+ return {
50
+ id: row.id,
51
+ life: row.life,
52
+ ...(row.lifeAt === undefined ? {} : { lifeAt: row.lifeAt }),
53
+ ...(row.lastActivityAt === undefined ? {} : { lastActivityAt: row.lastActivityAt }),
54
+ ...(row.pending === undefined ? {} : { pending: row.pending }),
55
+ ...(row.caller?.kind === "akuma" ? { parentAkumaId: row.caller.akumaId } : {}),
56
+ };
57
+ }
13
58
  export const akumaStatusSchema = z
14
59
  .object({
15
60
  id: akumaIdSchema,
16
61
  birth: akumaBirthSchema,
17
62
  life: z.enum(["running", "asleep", "stranded", "hung", "untidy", "killed"]),
18
- cwd: z.string().optional(),
19
- provider: z.string().optional(),
20
- model: z.string().optional(),
63
+ cwd: z.string().exactOptional(),
64
+ provider: z.string().exactOptional(),
65
+ model: z.string().exactOptional(),
66
+ lastActivityAt: z.string().exactOptional(),
21
67
  timeline: activitySnapshotSchema,
22
- strandedReason: z.literal("resume-unsupported").optional(),
68
+ strandedReason: z.literal("resume-unsupported").exactOptional(),
23
69
  })
24
- .strict();
70
+ .strict()
71
+ .readonly();
25
72
  function activityAt(row) {
26
- if (!("lifeAt" in row))
73
+ if (row.kind === "unborn")
27
74
  return null;
28
- if (row.lifeAt === null)
29
- return row.lastActivityAt;
30
- if (row.lastActivityAt === null)
31
- return row.lifeAt;
32
- return row.lifeAt > row.lastActivityAt ? row.lifeAt : row.lastActivityAt;
75
+ const lifeAt = row.lifeAt ?? null;
76
+ const lastActivityAt = row.lastActivityAt ?? null;
77
+ if (lifeAt === null)
78
+ return lastActivityAt;
79
+ if (lastActivityAt === null)
80
+ return lifeAt;
81
+ return lifeAt > lastActivityAt ? lifeAt : lastActivityAt;
33
82
  }
34
83
  function compareActivity(left, right) {
35
84
  if (left === right)
@@ -76,17 +125,17 @@ export async function knownAkuma(path, selected) {
76
125
  for (const name of names) {
77
126
  let physical;
78
127
  try {
79
- physical = akuIdFromDirectoryName(name);
128
+ physical = akumaIdFromDirectoryName(name);
80
129
  }
81
130
  catch {
82
131
  // The run root can contain bytes not produced by Keiyaku. Preserve them.
83
132
  continue;
84
133
  }
85
- if (selected !== undefined && physical.archetype !== selected)
134
+ if (selected !== undefined && physical.akumaName !== selected)
86
135
  continue;
87
136
  rows.push({
88
137
  id: physical.id,
89
- paths: akumaPaths({ runRoot, archetype: physical.archetype, suffix: physical.suffix }),
138
+ paths: akumaPaths({ runRoot, akumaName: physical.akumaName, suffix: physical.suffix }),
90
139
  });
91
140
  }
92
141
  return { runRoot, rows };
@@ -123,13 +172,13 @@ export async function countRunningAkuma(path) {
123
172
  function rosterInput(input, allowLimit) {
124
173
  if (typeof input !== "object" || input === null || Array.isArray(input))
125
174
  throw new TypeError("Akuma list input must be an object");
126
- const allowed = allowLimit ? ["archetype", "caller", "limit"] : ["archetype", "caller"];
175
+ const allowed = allowLimit ? ["akumaName", "caller", "limit"] : ["akumaName", "caller"];
127
176
  const unknown = Object.keys(input).find((key) => !allowed.includes(key));
128
177
  if (unknown !== undefined)
129
178
  throw new TypeError(`Akuma list input has unknown field: ${unknown}`);
130
179
  const caller = decodeAkumaCaller(input.caller);
131
180
  return {
132
- ...(input.archetype === undefined ? {} : { archetype: validateAkumaName(input.archetype) }),
181
+ ...(input.akumaName === undefined ? {} : { akumaName: validateAkumaName(input.akumaName) }),
133
182
  ...(caller === undefined ? {} : { caller }),
134
183
  };
135
184
  }
@@ -142,15 +191,15 @@ function callerClosure(lineage, root, world) {
142
191
  if (root.kind === "akuma" && root.world !== world)
143
192
  return new Set();
144
193
  const children = new Map();
145
- for (const [akuId, caller] of lineage) {
194
+ for (const [akumaId, caller] of lineage) {
146
195
  if (caller === null)
147
196
  continue;
148
197
  const key = akumaCallerKey(caller);
149
198
  const siblings = children.get(key);
150
199
  if (siblings === undefined)
151
- children.set(key, [akuId]);
200
+ children.set(key, [akumaId]);
152
201
  else
153
- siblings.push(akuId);
202
+ siblings.push(akumaId);
154
203
  }
155
204
  const included = new Set();
156
205
  const visited = new Set();
@@ -161,11 +210,11 @@ function callerClosure(lineage, root, world) {
161
210
  if (visited.has(key))
162
211
  continue;
163
212
  visited.add(key);
164
- for (const akuId of children.get(key) ?? []) {
165
- if (included.has(akuId))
213
+ for (const akumaId of children.get(key) ?? []) {
214
+ if (included.has(akumaId))
166
215
  continue;
167
- included.add(akuId);
168
- queue.push({ kind: "akuma", world, akuId });
216
+ included.add(akumaId);
217
+ queue.push({ kind: "akuma", world, akumaId });
169
218
  }
170
219
  }
171
220
  return included;
@@ -175,21 +224,21 @@ function sameCallerEvidence(left, right) {
175
224
  return left === right;
176
225
  return akumaCallerKey(left) === akumaCallerKey(right);
177
226
  }
178
- async function readCallerSoul(world, akuId) {
227
+ async function readCallerSoul(world, akumaId) {
179
228
  try {
180
- const soul = await readSoul(pathsForAkuId(world, akuId));
229
+ const soul = await readSoul(pathsForAkumaId(world, akumaId));
181
230
  return soul === null ? { kind: "absent" } : { kind: "born", caller: soul.caller ?? null };
182
231
  }
183
232
  catch {
184
233
  return { kind: "unreadable" };
185
234
  }
186
235
  }
187
- async function soulEdgeFor(verification, akuId) {
188
- const observed = verification.souls.get(akuId);
236
+ async function soulEdgeFor(verification, akumaId) {
237
+ const observed = verification.souls.get(akumaId);
189
238
  if (observed !== undefined)
190
239
  return await observed;
191
- const pending = readCallerSoul(verification.world, akuId);
192
- verification.souls.set(akuId, pending);
240
+ const pending = readCallerSoul(verification.world, akumaId);
241
+ verification.souls.set(akumaId, pending);
193
242
  return await pending;
194
243
  }
195
244
  /**
@@ -222,7 +271,7 @@ async function verifyCallerMember(verification, id, observedCaller) {
222
271
  return "excluded";
223
272
  if (current.world !== verification.world)
224
273
  return "excluded";
225
- const parentId = current.akuId;
274
+ const parentId = current.akumaId;
226
275
  const parentCached = lineage.get(parentId);
227
276
  const edge = await soulEdgeFor(verification, parentId);
228
277
  if (edge.kind === "unreadable")
@@ -282,7 +331,7 @@ async function pageCallerRows(candidates, limit, admit) {
282
331
  */
283
332
  async function callerCandidates(rows, lineage, root, world, selected) {
284
333
  const closure = callerClosure(lineage, root, world);
285
- return await freshnessOrdered(rows.filter((row) => closure.has(row.id) && (selected === undefined || parseAkuId(row.id).archetype === selected)));
334
+ return await freshnessOrdered(rows.filter((row) => closure.has(row.id) && (selected === undefined || parseAkumaId(row.id).akumaName === selected)));
286
335
  }
287
336
  /**
288
337
  * One caller-scoped page. The World-local record only proposes members: each is
@@ -295,7 +344,7 @@ async function readCallerPage(path, limit, selected, caller) {
295
344
  const verification = { world: path, root: caller, lineage: cached, souls: new Map() };
296
345
  const attempted = await pageCallerRows(await callerCandidates(known.rows, cached, caller, path, selected), limit,
297
346
  // A cache-proposed identity without a born Soul cannot justify inclusion.
298
- async (row) => ("lifeAt" in row ? await verifyCallerMember(verification, row.id, row.caller) : "invalid-cache"));
347
+ async (row) => (row.kind === "born" ? await verifyCallerMember(verification, row.id, row.caller) : "invalid-cache"));
299
348
  if (!attempted.invalid)
300
349
  return attempted;
301
350
  // One wrong edge makes the whole disposable record untrustworthy.
@@ -305,11 +354,19 @@ async function readCallerPage(path, limit, selected, caller) {
305
354
  await rebuildAkumaLineage(path, direct);
306
355
  return repaired;
307
356
  }
357
+ /** One roster answer: empty rows and known completeness are both omissions. */
358
+ function rosterResult(observedAt, rows, more) {
359
+ return {
360
+ observedAt,
361
+ ...(rows.length === 0 ? {} : { rows: rows.map(listedAkuma) }),
362
+ ...(more ? { more: true } : {}),
363
+ };
364
+ }
308
365
  /** The bounded recent-activity roster input: native membership and observed extent. */
309
366
  export async function readAkumaRoster(path, input = {}) {
310
367
  const selection = rosterInput(input, true);
311
368
  const limit = boundedListLimit(input.limit);
312
- return observeAkumaRoster(path, limit, selection.archetype, selection.caller);
369
+ return observeAkumaRoster(path, limit, selection.akumaName, selection.caller);
313
370
  }
314
371
  /**
315
372
  * The bounded recent-activity roster: native membership, semantic order and
@@ -321,31 +378,26 @@ export async function observeAkumaRoster(path, limit, selected, caller) {
321
378
  if (caller !== undefined) {
322
379
  const page = await readCallerPage(path, limit, selected, caller);
323
380
  const bounded = projectBoundedList(page.rows, limit);
324
- return {
325
- observedAt,
326
- // A skipped or unprovable candidate leaves the extent unknowable, never empty.
327
- hasMore: bounded.hasMore || page.skipped > 0,
328
- rows: bounded.rows,
329
- searched: [akumaRunRoot(path)],
330
- };
381
+ return rosterResult(observedAt, bounded.rows, bounded.hasMore || page.skipped > 0);
331
382
  }
332
383
  const known = await knownAkuma(path, selected);
333
384
  const ranked = await pageCallerRows(await freshnessOrdered(known.rows), limit);
334
- return { observedAt, searched: [known.runRoot], ...projectBoundedList(ranked.rows, limit) };
385
+ const bounded = projectBoundedList(ranked.rows, limit);
386
+ return rosterResult(observedAt, bounded.rows, bounded.hasMore);
335
387
  }
336
388
  /** The complete native roster for callers whose semantics require a frozen set. */
337
389
  export async function readAkumaCompleteRoster(path, input = {}) {
338
390
  const selection = rosterInput(input, false);
339
391
  const observedAt = new Date().toISOString();
340
392
  if (selection.caller !== undefined) {
341
- const page = await readCallerPage(path, Number.POSITIVE_INFINITY, selection.archetype, selection.caller);
342
- return { observedAt, rows: page.rows, searched: [akumaRunRoot(path)] };
393
+ const page = await readCallerPage(path, Number.POSITIVE_INFINITY, selection.akumaName, selection.caller);
394
+ return { kind: "akumas", observedAt, rows: page.rows };
343
395
  }
344
- const known = await knownAkuma(path, selection.archetype);
396
+ const known = await knownAkuma(path, selection.akumaName);
345
397
  return {
398
+ kind: "akumas",
346
399
  observedAt,
347
400
  rows: [...(await readableRows(known.rows)).rows].sort(compareRows),
348
- searched: [known.runRoot],
349
401
  };
350
402
  }
351
403
  /** Internal timeline observation for composition owners. */
@@ -1,4 +1,4 @@
1
- import { type BoundedList } from "../bounded-list.js";
1
+ import { z } from "zod";
2
2
  import type { Settings } from "../settings.js";
3
3
  import { type ProviderExecution, type ProviderOptions } from "./provider-recipe.js";
4
4
  type DecodedArchetype = Readonly<{
@@ -9,28 +9,41 @@ type DecodedArchetype = Readonly<{
9
9
  hidden?: boolean;
10
10
  options: ProviderOptions;
11
11
  }>;
12
+ export declare const archetypeCatalogRowSchema: z.ZodReadonly<z.ZodObject<{
13
+ name: z.ZodString;
14
+ model: z.ZodExactOptional<z.ZodString>;
15
+ description: z.ZodExactOptional<z.ZodString>;
16
+ }, z.core.$strict>>;
17
+ export declare const archetypeCatalogSchema: z.ZodReadonly<z.ZodObject<{
18
+ rows: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
19
+ name: z.ZodString;
20
+ model: z.ZodExactOptional<z.ZodString>;
21
+ description: z.ZodExactOptional<z.ZodString>;
22
+ }, z.core.$strict>>>>>;
23
+ more: z.ZodExactOptional<z.ZodLiteral<true>>;
24
+ }, z.core.$strict>>;
12
25
  export type ArchetypeCatalogRow = Readonly<{
13
26
  name: string;
14
27
  model?: string;
15
28
  description?: string;
16
29
  }>;
17
- export type ArchetypeCatalog = BoundedList<ArchetypeCatalogRow>;
30
+ export type ArchetypeCatalog = z.output<typeof archetypeCatalogSchema>;
18
31
  /** One closed catalogue request: omitted project means no project scope, never ambient discovery. */
19
32
  export type ArchetypeCatalogInput = Readonly<{
20
33
  project?: string;
21
34
  home?: string;
22
35
  limit?: number;
23
36
  }>;
24
- /** One loaded archetype whose provider owner has decoded its execution but not yet admitted its options. */
37
+ /** One loaded akumaName whose provider owner has decoded its execution but not yet admitted its options. */
25
38
  type PreparedArchetype = Omit<DecodedArchetype, "provider"> & Readonly<{
26
39
  provider: ProviderExecution;
27
40
  }>;
28
41
  export declare class AkumaArchetypeError extends Error {
29
- readonly archetype: string;
42
+ readonly akumaName: string;
30
43
  readonly searched: readonly string[];
31
44
  readonly reason: string;
32
45
  readonly kind = "akuma-archetype";
33
- constructor(archetype: string, searched: readonly string[], reason: string, guidance?: string);
46
+ constructor(akumaName: string, searched: readonly string[], reason: string, guidance?: string);
34
47
  }
35
48
  type ArchetypeCoordinates = Readonly<{
36
49
  project?: string;
@@ -38,7 +51,7 @@ type ArchetypeCoordinates = Readonly<{
38
51
  }>;
39
52
  export declare function listArchetypes(input?: ArchetypeCoordinates): Promise<readonly string[]>;
40
53
  export declare function listArchetypeDefinitions(input?: ArchetypeCatalogInput): Promise<ArchetypeCatalog>;
41
- /** Resolve one archetype and decode its provider execution, leaving option admission to the caller. */
54
+ /** Resolve one akumaName and decode its provider execution, leaving option admission to the caller. */
42
55
  export declare function loadPreparedArchetype(input: Readonly<{
43
56
  name: string;
44
57
  project?: string;
@@ -1,3 +1,4 @@
1
+ import { z } from "zod";
1
2
  import { readFile, readdir } from "node:fs/promises";
2
3
  import { homedir } from "node:os";
3
4
  import { isAbsolute, join } from "node:path";
@@ -5,14 +6,23 @@ import { parseDocument } from "yaml";
5
6
  import { boundedListLimit } from "../bounded-list.js";
6
7
  import { validateAkumaName } from "../identity/normalize.js";
7
8
  import { decodeProviderOptions, decodeProviderRecipe, } from "./provider-recipe.js";
9
+ export const archetypeCatalogRowSchema = z
10
+ .strictObject({ name: z.string(), model: z.string().exactOptional(), description: z.string().exactOptional() })
11
+ .readonly();
12
+ export const archetypeCatalogSchema = z
13
+ .strictObject({
14
+ rows: z.array(archetypeCatalogRowSchema).nonempty().readonly().exactOptional(),
15
+ more: z.literal(true).exactOptional(),
16
+ })
17
+ .readonly();
8
18
  export class AkumaArchetypeError extends Error {
9
- archetype;
19
+ akumaName;
10
20
  searched;
11
21
  reason;
12
22
  kind = "akuma-archetype";
13
- constructor(archetype, searched, reason, guidance) {
14
- super([`\`${archetype}\` ${reason}`, ...(guidance === undefined ? [] : [guidance])].join("\n"));
15
- this.archetype = archetype;
23
+ constructor(akumaName, searched, reason, guidance) {
24
+ super([`\`${akumaName}\` ${reason}`, ...(guidance === undefined ? [] : [guidance])].join("\n"));
25
+ this.akumaName = akumaName;
16
26
  this.searched = searched;
17
27
  this.reason = reason;
18
28
  this.name = "AkumaArchetypeError";
@@ -283,9 +293,10 @@ export async function listArchetypeDefinitions(input = {}) {
283
293
  ...(definition.options.model === undefined ? {} : { model: definition.options.model }),
284
294
  ...(definition.description === undefined ? {} : { description: definition.description }),
285
295
  }));
296
+ const rows = limit === undefined ? visible : visible.slice(0, limit);
286
297
  return {
287
- rows: limit === undefined ? visible : visible.slice(0, limit),
288
- hasMore: limit === undefined ? false : visible.length > limit,
298
+ ...(rows.length === 0 ? {} : { rows }),
299
+ ...(limit !== undefined && visible.length > limit ? { more: true } : {}),
289
300
  };
290
301
  }
291
302
  function record(value) {
@@ -337,8 +348,13 @@ const BUILTIN_EXECUTIONS = {
337
348
  function providerExecution(settings, name) {
338
349
  const view = settings.namespace("providers");
339
350
  if (view.kind === "failed")
340
- throw new TypeError(view.failures.map((failure) => `${failure.scope}: ${failure.diagnostic}`).join("; "));
341
- const selected = view.entries.find((entry) => entry.name === name)?.value;
351
+ throw new TypeError(view.failures
352
+ .map((failure) => {
353
+ const scope = settings.scopes[failure.scope];
354
+ return `${failure.scope}: ${failure.diagnostic ?? (scope.kind === "failed" ? scope.diagnostic : "providers unavailable")}`;
355
+ })
356
+ .join("; "));
357
+ const selected = view.entries?.[name]?.value;
342
358
  if (selected !== undefined)
343
359
  return configuredProvider(name, selected);
344
360
  const builtin = BUILTIN_EXECUTIONS[name];
@@ -346,7 +362,7 @@ function providerExecution(settings, name) {
346
362
  return decodeProviderRecipe({ name, ...builtin });
347
363
  throw new TypeError(`unknown provider ${name}`);
348
364
  }
349
- /** Resolve one archetype and decode its provider execution, leaving option admission to the caller. */
365
+ /** Resolve one akumaName and decode its provider execution, leaving option admission to the caller. */
350
366
  export async function loadPreparedArchetype(input) {
351
367
  const name = validateAkumaName(input.name);
352
368
  const definition = await resolveArchetype(name, input, undefined);
@@ -10,8 +10,8 @@ export declare const bodyLaunchSchema: z.ZodObject<{
10
10
  log: z.ZodString;
11
11
  }, z.core.$strict>;
12
12
  seed: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<Omit<Readonly<{
13
- id: import("./identity.js").AkuId;
14
- archetype: string;
13
+ id: import("./identity.js").AkumaId;
14
+ akumaName: string;
15
15
  description?: string;
16
16
  provider: import("./provider-recipe.js").ProviderExecution;
17
17
  options: import("./provider-recipe.js").ProviderOptions;
@@ -3,7 +3,7 @@ import { appendFile } from "node:fs/promises";
3
3
  import { abortableDelay } from "./abort.js";
4
4
  import { BodySupervisor } from "./body-supervisor.js";
5
5
  import { driveTurn } from "./turn-drive.js";
6
- import { HeldAkumaLeash, BodyControlledError, breakBody, cancelBodyTurns, decidePendingTellDisposition, drainPendingTells, endTurn, failOpenBoundTurns, finishBodyIfIdle, heartExists, isHeartAbsent, probeLeash, projectTell, readHeart, readLatestTurnForBody, readOpenBoundTurns, readOpenPendingTellDisposition, readTell, readTurn, readTurnParticipants, resolvePendingTellDisposition, } from "./heart/index.js";
6
+ import { HeldAkumaLeash, BodyControlledError, breakBody, cancelBodyTurns, decidePendingTellDisposition, drainPendingTells, endTurn, failOpenBoundTurns, finishBodyIfIdle, heartExists, isHeartAbsent, probeLeash, readHeart, readLatestTurnForBody, readOpenBoundTurns, readOpenPendingTellDisposition, readTell, readTurn, readTurnParticipants, resolvePendingTellDisposition, } from "./heart/index.js";
7
7
  import { worldRootForAkumaPaths } from "./identity.js";
8
8
  import { recordAkumaLineage } from "./lineage-cache.js";
9
9
  import { emitPluginSignal } from "../plugin/akuma-signals.js";
@@ -501,7 +501,7 @@ async function settledWake(paths, tellId, after) {
501
501
  if (tellId !== undefined && !heart.pending.some((tell) => tell.id === tellId))
502
502
  return { kind: "told" };
503
503
  if (heart.latestBody !== null && heart.latestBody.sequence > after) {
504
- return { kind: "pursuing", bodySequence: heart.latestBody.sequence };
504
+ return { kind: "pursuing" };
505
505
  }
506
506
  return null;
507
507
  }
@@ -546,8 +546,8 @@ export async function wakeRecordedTell(paths, tellId, runtime, signal) {
546
546
  if (tell === null)
547
547
  throw new Error(`recorded Tell ${tellId} is missing from Heart`);
548
548
  return {
549
- admission: { tellId, fact: "recorded" },
550
- row: projectTell(tell),
549
+ admission: { tellId },
550
+ row: { sequence: tell.sequence, at: tell.recordedAt, text: tell.body },
551
551
  wake,
552
552
  };
553
553
  }
@@ -1,7 +1,7 @@
1
+ import { z } from "zod";
1
2
  import type { WorldRoot } from "../world.js";
2
3
  import { type TellFact } from "./heart/index.js";
3
- import { type AkuId } from "./identity.js";
4
- import type { TellRow } from "./heart/facts.js";
4
+ import { type AkumaId } from "./identity.js";
5
5
  export type CallInitialTell = Readonly<{
6
6
  tellId: string;
7
7
  body: string;
@@ -9,51 +9,67 @@ export type CallInitialTell = Readonly<{
9
9
  initiator?: string;
10
10
  }>;
11
11
  export type InitialTellAdmissionInput = Readonly<{
12
- id: AkuId;
12
+ id: AkumaId;
13
13
  initialTell: CallInitialTell;
14
- contractId?: string;
15
14
  signal?: AbortSignal;
16
15
  }>;
17
- export type TellWake = Readonly<{
18
- kind: "told";
19
- }> | Readonly<{
20
- kind: "held";
21
- }> | Readonly<{
22
- kind: "pursuing";
23
- bodySequence: number;
24
- }> | Readonly<{
25
- kind: "failed";
26
- diagnostic: string;
27
- child?: Readonly<{
28
- code: number | null;
29
- signal: string | null;
30
- log: Readonly<{
31
- path: string;
32
- from: number;
33
- to: number;
16
+ export declare const tellWakeSchema: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
17
+ kind: z.ZodLiteral<"told">;
18
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
19
+ kind: z.ZodLiteral<"held">;
20
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
21
+ kind: z.ZodLiteral<"pursuing">;
22
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
23
+ kind: z.ZodLiteral<"failed">;
24
+ diagnostic: z.ZodString;
25
+ child: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
26
+ log: z.ZodReadonly<z.ZodObject<{
27
+ path: z.ZodString;
28
+ }, z.core.$strict>>;
29
+ }, z.core.$strict>>>;
30
+ }, z.core.$strict>>]>;
31
+ export declare const tellResultSchema: z.ZodReadonly<z.ZodObject<{
32
+ admission: z.ZodReadonly<z.ZodObject<{
33
+ tellId: z.ZodString;
34
+ }, z.core.$strict>>;
35
+ row: z.ZodReadonly<z.ZodObject<{
36
+ at: z.ZodString;
37
+ sequence: z.ZodNumber;
38
+ text: z.ZodString;
39
+ }, z.core.$strict>>;
40
+ wake: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
41
+ kind: z.ZodLiteral<"told">;
42
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
43
+ kind: z.ZodLiteral<"held">;
44
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
45
+ kind: z.ZodLiteral<"pursuing">;
46
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
47
+ kind: z.ZodLiteral<"failed">;
48
+ diagnostic: z.ZodString;
49
+ child: z.ZodExactOptional<z.ZodReadonly<z.ZodObject<{
50
+ log: z.ZodReadonly<z.ZodObject<{
51
+ path: z.ZodString;
52
+ }, z.core.$strict>>;
53
+ }, z.core.$strict>>>;
54
+ }, z.core.$strict>>]>;
55
+ interruption: z.ZodExactOptional<z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
56
+ kind: z.ZodLiteral<"completed">;
57
+ bodySequence: z.ZodNumber;
58
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
59
+ kind: z.ZodLiteral<"pending">;
60
+ bodySequence: z.ZodNumber;
61
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
62
+ kind: z.ZodLiteral<"unavailable">;
63
+ bodySequence: z.ZodNumber;
64
+ evidence: z.ZodEnum<{
65
+ hung: "hung";
66
+ untidy: "untidy";
34
67
  }>;
35
- }>;
36
- }>;
37
- export type TellResult = Readonly<{
38
- admission: Readonly<{
39
- fact: "recorded";
40
- tellId: string;
41
- }>;
42
- row: TellRow;
43
- wake: TellWake;
44
- interruption?: Readonly<{
45
- kind: "completed";
46
- bodySequence: number;
47
- putDown: "was-idle" | "self-aborted";
48
- }> | Readonly<{
49
- kind: "pending";
50
- bodySequence: number;
51
- }> | Readonly<{
52
- kind: "unavailable";
53
- bodySequence: number;
54
- evidence: "hung" | "untidy";
55
- }>;
56
- }>;
68
+ }, z.core.$strict>>]>>;
69
+ }, z.core.$strict>>;
70
+ export type TellWake = z.output<typeof tellWakeSchema>;
71
+ /** The progress receipt carries only the Tell coordinates progress needs; Heart keeps the native row. */
72
+ export type TellResult = z.output<typeof tellResultSchema>;
57
73
  export type CallInitialTellAdmission = Readonly<{
58
74
  kind: "admitted";
59
75
  tell: TellFact;
@@ -66,7 +82,7 @@ export type CallInitialTellAdmission = Readonly<{
66
82
  }>;
67
83
  export declare function admitCallInitialTell(input: Readonly<{
68
84
  world: WorldRoot;
69
- id: AkuId;
85
+ id: AkumaId;
70
86
  initialTell: CallInitialTell;
71
87
  signal?: AbortSignal;
72
88
  now?: () => string;
@@ -1,9 +1,48 @@
1
+ import { z } from "zod";
2
+ import { tellRowSchema } from "./projection.js";
1
3
  import { bornStatus, defaultWaitComplete, readWaitComplete, waitForObservation } from "./akuma-observe.js";
2
4
  import { recordTell } from "./heart/index.js";
3
- import { pathsForAkuId } from "./identity.js";
5
+ import { pathsForAkumaId } from "./identity.js";
4
6
  import { BIRTH_TIMEOUT_MS } from "./publication.js";
7
+ export const tellWakeSchema = z.union([
8
+ z.strictObject({ kind: z.literal("told") }).readonly(),
9
+ z.strictObject({ kind: z.literal("held") }).readonly(),
10
+ z.strictObject({ kind: z.literal("pursuing") }).readonly(),
11
+ z
12
+ .strictObject({
13
+ kind: z.literal("failed"),
14
+ diagnostic: z.string(),
15
+ child: z
16
+ .strictObject({
17
+ log: z.strictObject({ path: z.string() }).readonly(),
18
+ })
19
+ .readonly()
20
+ .exactOptional(),
21
+ })
22
+ .readonly(),
23
+ ]);
24
+ export const tellResultSchema = z
25
+ .strictObject({
26
+ admission: z.strictObject({ tellId: z.string() }).readonly(),
27
+ row: tellRowSchema.unwrap().pick({ sequence: true, at: true, text: true }).strict().readonly(),
28
+ wake: tellWakeSchema,
29
+ interruption: z
30
+ .union([
31
+ z.strictObject({ kind: z.literal("completed"), bodySequence: z.number() }).readonly(),
32
+ z.strictObject({ kind: z.literal("pending"), bodySequence: z.number() }).readonly(),
33
+ z
34
+ .strictObject({
35
+ kind: z.literal("unavailable"),
36
+ bodySequence: z.number(),
37
+ evidence: z.enum(["hung", "untidy"]),
38
+ })
39
+ .readonly(),
40
+ ])
41
+ .exactOptional(),
42
+ })
43
+ .readonly();
5
44
  export async function admitCallInitialTell(input) {
6
- const paths = pathsForAkuId(input.world, input.id);
45
+ const paths = pathsForAkumaId(input.world, input.id);
7
46
  const birth = await waitForObservation({
8
47
  timeoutMs: BIRTH_TIMEOUT_MS,
9
48
  ...(input.signal === undefined ? {} : { signal: input.signal }),