@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
@@ -1,37 +1,46 @@
1
1
  import { z } from "zod";
2
2
  import type { WorldRoot } from "../world.js";
3
3
  import { type Soul } from "./heart/facts.js";
4
- export declare const akumaCallerSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
4
+ export declare const retainedCallerSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
5
5
  kind: z.ZodLiteral<"akuma">;
6
- world: z.ZodCustom<WorldRoot, WorldRoot>;
7
- akuId: z.ZodPipe<z.ZodString, z.ZodTransform<import("./identity.js").AkuId, string>>;
6
+ world: z.ZodPipe<z.ZodString, z.ZodCustom<WorldRoot, WorldRoot>>;
7
+ akumaId: z.ZodPipe<z.ZodString, z.ZodTransform<import("./identity.js").AkumaId, string>>;
8
8
  }, z.core.$strict>, z.ZodObject<{
9
9
  kind: z.ZodLiteral<"external">;
10
10
  integration: z.ZodString;
11
11
  id: z.ZodString;
12
12
  }, z.core.$strict>], "kind">;
13
- export type AkumaCaller = z.infer<typeof akumaCallerSchema>;
14
- export declare const akumaBirthSchema: z.ZodObject<{
15
- origin: z.ZodDiscriminatedUnion<[z.ZodObject<{
13
+ export declare const akumaCallerSchema: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
14
+ kind: z.ZodLiteral<"akuma">;
15
+ world: z.ZodPipe<z.ZodString, z.ZodCustom<WorldRoot, WorldRoot>>;
16
+ akumaId: z.ZodPipe<z.ZodString, z.ZodTransform<import("./identity.js").AkumaId, string>>;
17
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
18
+ kind: z.ZodLiteral<"external">;
19
+ integration: z.ZodString;
20
+ id: z.ZodString;
21
+ }, z.core.$strict>>]>;
22
+ export type AkumaCaller = z.output<typeof retainedCallerSchema>;
23
+ export declare const akumaBirthSchema: z.ZodReadonly<z.ZodObject<{
24
+ origin: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
16
25
  kind: z.ZodLiteral<"direct">;
17
- }, z.core.$strip>, z.ZodObject<{
26
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
18
27
  kind: z.ZodLiteral<"fork">;
19
- parent: z.ZodPipe<z.ZodString, z.ZodTransform<import("./identity.js").AkuId, string>>;
28
+ parent: z.ZodPipe<z.ZodString, z.ZodTransform<import("./identity.js").AkumaId, string>>;
20
29
  at: z.ZodString;
21
- }, z.core.$strip>], "kind">;
22
- caller: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
30
+ }, z.core.$strict>>]>;
31
+ caller: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
23
32
  kind: z.ZodLiteral<"akuma">;
24
- world: z.ZodCustom<WorldRoot, WorldRoot>;
25
- akuId: z.ZodPipe<z.ZodString, z.ZodTransform<import("./identity.js").AkuId, string>>;
26
- }, z.core.$strict>, z.ZodObject<{
33
+ world: z.ZodPipe<z.ZodString, z.ZodCustom<WorldRoot, WorldRoot>>;
34
+ akumaId: z.ZodPipe<z.ZodString, z.ZodTransform<import("./identity.js").AkumaId, string>>;
35
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
27
36
  kind: z.ZodLiteral<"external">;
28
37
  integration: z.ZodString;
29
38
  id: z.ZodString;
30
- }, z.core.$strict>], "kind">, z.ZodObject<{
39
+ }, z.core.$strict>>]>, z.ZodReadonly<z.ZodObject<{
31
40
  kind: z.ZodLiteral<"unknown">;
32
- }, z.core.$strict>]>;
33
- }, z.core.$strict>;
34
- export declare function projectAkumaBirth(soul: Soul): z.infer<typeof akumaBirthSchema>;
41
+ }, z.core.$strict>>]>;
42
+ }, z.core.$strict>>;
43
+ export declare function projectAkumaBirth(soul: Soul): z.output<typeof akumaBirthSchema>;
35
44
  export declare function decodeAkumaCaller(value: unknown): AkumaCaller | undefined;
36
45
  /** One stable comparison coordinate for stored and queried caller attribution. */
37
46
  export declare function akumaCallerKey(caller: AkumaCaller): string;
@@ -1,11 +1,13 @@
1
1
  import { isAbsolute, resolve } from "node:path";
2
2
  import { z } from "zod";
3
3
  import { akumaIdSchema } from "./identity.js";
4
- import { akumaOriginSchema } from "./heart/facts.js";
4
+ import { akumaOriginWireSchema } from "./heart/facts.js";
5
5
  // Stored attribution is a coordinate, not a live World capability or lookup.
6
- const callerWorldSchema = z.custom((value) => typeof value === "string" && isAbsolute(value) && resolve(value) === value, "caller world must be an absolute normalized path");
7
- export const akumaCallerSchema = z.discriminatedUnion("kind", [
8
- z.object({ kind: z.literal("akuma"), world: callerWorldSchema, akuId: akumaIdSchema }).strict(),
6
+ const callerWorldSchema = z
7
+ .string()
8
+ .pipe(z.custom((value) => typeof value === "string" && isAbsolute(value) && resolve(value) === value, "caller world must be an absolute normalized path"));
9
+ export const retainedCallerSchema = z.discriminatedUnion("kind", [
10
+ z.object({ kind: z.literal("akuma"), world: callerWorldSchema, akumaId: akumaIdSchema }).strict(),
9
11
  z
10
12
  .object({
11
13
  kind: z.literal("external"),
@@ -17,19 +19,30 @@ export const akumaCallerSchema = z.discriminatedUnion("kind", [
17
19
  })
18
20
  .strict(),
19
21
  ]);
22
+ export const akumaCallerSchema = z.union([
23
+ retainedCallerSchema.options[0].readonly(),
24
+ retainedCallerSchema.options[1].readonly(),
25
+ ]);
20
26
  export const akumaBirthSchema = z
21
27
  .object({
22
- origin: akumaOriginSchema,
23
- caller: z.union([akumaCallerSchema, z.object({ kind: z.literal("unknown") }).strict()]),
28
+ origin: akumaOriginWireSchema,
29
+ caller: z.union([
30
+ akumaCallerSchema,
31
+ z
32
+ .object({ kind: z.literal("unknown") })
33
+ .strict()
34
+ .readonly(),
35
+ ]),
24
36
  })
25
- .strict();
37
+ .strict()
38
+ .readonly();
26
39
  export function projectAkumaBirth(soul) {
27
40
  return { origin: soul.origin, caller: soul.caller ?? { kind: "unknown" } };
28
41
  }
29
42
  export function decodeAkumaCaller(value) {
30
43
  if (value === undefined)
31
44
  return undefined;
32
- const parsed = akumaCallerSchema.safeParse(value);
45
+ const parsed = retainedCallerSchema.safeParse(value);
33
46
  if (!parsed.success)
34
47
  throw new TypeError(`Invalid Akuma caller: ${parsed.error.message}`);
35
48
  return parsed.data;
@@ -37,6 +50,6 @@ export function decodeAkumaCaller(value) {
37
50
  /** One stable comparison coordinate for stored and queried caller attribution. */
38
51
  export function akumaCallerKey(caller) {
39
52
  return caller.kind === "akuma"
40
- ? `akuma\u0000${caller.world}\u0000${caller.akuId}`
53
+ ? `akuma\u0000${caller.world}\u0000${caller.akumaId}`
41
54
  : `external\u0000${caller.integration}\u0000${caller.id}`;
42
55
  }
@@ -15,5 +15,14 @@ export declare const resumeCoordinateSchema: z.ZodUnion<readonly [z.ZodPipe<z.Zo
15
15
  sessionId: z.ZodString;
16
16
  }, z.core.$strict>]>;
17
17
  export type ResumeCoordinate = z.infer<typeof resumeCoordinateSchema>;
18
+ export declare const publicSessionCoordinateSchema: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
19
+ kind: z.ZodLiteral<"file">;
20
+ sessionFile: z.ZodString;
21
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
22
+ kind: z.ZodLiteral<"session">;
23
+ sessionId: z.ZodString;
24
+ }, z.core.$strict>>]>;
25
+ export type PublicSessionCoordinate = z.output<typeof publicSessionCoordinateSchema>;
18
26
  export declare function decodeResumeCoordinate(value: unknown): ResumeCoordinate | null;
27
+ export declare function publicSessionCoordinate(coordinate: ResumeCoordinate): PublicSessionCoordinate;
19
28
  export declare function encodeResumeCoordinate(coordinate: ResumeCoordinate): unknown;
@@ -8,10 +8,23 @@ export const resumeCoordinateSchema = z.union([
8
8
  .transform(({ sessionFile, sessionId }) => sessionId === undefined ? { sessionFile } : { sessionFile, sessionId }),
9
9
  z.object({ sessionId: coordinateText }).strict(),
10
10
  ]);
11
+ // The published form names which coordinate is usable instead of dispatching on field presence.
12
+ export const publicSessionCoordinateSchema = z.union([
13
+ z.strictObject({ kind: z.literal("file"), sessionFile: coordinateText }).readonly(),
14
+ z.strictObject({ kind: z.literal("session"), sessionId: coordinateText }).readonly(),
15
+ ]);
11
16
  export function decodeResumeCoordinate(value) {
12
17
  const result = resumeCoordinateSchema.safeParse(value);
13
18
  return result.success ? result.data : null;
14
19
  }
20
+ export function publicSessionCoordinate(coordinate) {
21
+ return "sessionFile" in coordinate
22
+ ? {
23
+ kind: "file",
24
+ sessionFile: coordinate.sessionFile,
25
+ }
26
+ : { kind: "session", sessionId: coordinate.sessionId };
27
+ }
15
28
  export function encodeResumeCoordinate(coordinate) {
16
29
  return "sessionFile" in coordinate
17
30
  ? {
@@ -47,7 +47,7 @@ async function diagnoseSpawnEnoent(input, cause) {
47
47
  remedies.push("a missing execution directory likely means its Contract was accepted and the worktree cleaned up, with deliverables already in Git");
48
48
  if (noExecutable)
49
49
  remedies.push("a missing executable likely means the host removed the running process binary: re-enter with a fresh CLI process and retry");
50
- const remedy = `kill this Akuma and call a fresh one; ${remedies.join("; ")}`;
50
+ const remedy = `kill this Akuma and spawn a fresh one; ${remedies.join("; ")}`;
51
51
  const error = new Error(`Body spawn failed: ${missing.join(" and ")}; ${remedy}`, { cause });
52
52
  error.code = "ENOENT";
53
53
  return error;
@@ -77,7 +77,7 @@ export async function spawnAkumaBody(launch) {
77
77
  const completed = owned.exited.then((exit) => ({
78
78
  diagnostic: exit.code === null ? `pre-admission signal ${exit.signal ?? "unknown"}` : `pre-admission exit ${exit.code}`,
79
79
  held: exit.code === LEASH_HELD_EXIT,
80
- child: { code: exit.code, signal: exit.signal, log: exit.log },
80
+ child: { log: { path: exit.log.path } },
81
81
  }));
82
82
  void completed.catch(() => undefined);
83
83
  return {
@@ -1,12 +1,12 @@
1
1
  import { z } from "zod";
2
- export declare const dispatchAssociationSchema: z.ZodUnion<readonly [z.ZodObject<{
2
+ export declare const dispatchAssociationSchema: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
3
3
  kind: z.ZodLiteral<"none">;
4
- }, z.core.$strict>, z.ZodObject<{
4
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
5
5
  kind: z.ZodLiteral<"associated">;
6
6
  contractId: z.ZodPipe<z.ZodString, z.ZodTransform<import("../index.js").ContractId, string>>;
7
- }, z.core.$strict>, z.ZodObject<{
7
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
8
8
  kind: z.ZodLiteral<"failed">;
9
9
  diagnostic: z.ZodString;
10
- }, z.core.$strict>]>;
10
+ }, z.core.$strict>>]>;
11
11
  export type DispatchAssociation = z.infer<typeof dispatchAssociationSchema>;
12
12
  export declare const NO_DISPATCH_ASSOCIATION: DispatchAssociation;
@@ -1,8 +1,17 @@
1
1
  import { contractIdSchema } from "../git/identity.js";
2
2
  import { z } from "zod";
3
3
  export const dispatchAssociationSchema = z.union([
4
- z.object({ kind: z.literal("none") }).strict(),
5
- z.object({ kind: z.literal("associated"), contractId: contractIdSchema }).strict(),
6
- z.object({ kind: z.literal("failed"), diagnostic: z.string() }).strict(),
4
+ z
5
+ .object({ kind: z.literal("none") })
6
+ .strict()
7
+ .readonly(),
8
+ z
9
+ .object({ kind: z.literal("associated"), contractId: contractIdSchema })
10
+ .strict()
11
+ .readonly(),
12
+ z
13
+ .object({ kind: z.literal("failed"), diagnostic: z.string() })
14
+ .strict()
15
+ .readonly(),
7
16
  ]);
8
17
  export const NO_DISPATCH_ASSOCIATION = { kind: "none" };
@@ -8,8 +8,8 @@ export function keiyakuExecutionInstructions(soul, association) {
8
8
  return [
9
9
  "<keiyaku>",
10
10
  "This context supersedes any earlier Keiyaku execution context.",
11
- `Akuma: ${soul.id}`,
12
- `Archetype: ${soul.archetype}`,
11
+ `Akuma ID: ${soul.id}`,
12
+ `Akuma name: ${soul.akumaName}`,
13
13
  ...(association === undefined ? [] : [`Contract context (not a Dispatch receipt): ${association.contractId}`]),
14
14
  'Use `keiyaku report "..."` to share updates without stopping your work.',
15
15
  "</keiyaku>",
@@ -1,6 +1,6 @@
1
1
  import type { AkumaCaller } from "../caller.js";
2
2
  import { z } from "zod";
3
- import { type AkuId } from "../identity.js";
3
+ import { type AkumaId } from "../identity.js";
4
4
  import type { ResumeCoordinate } from "../coordinate.js";
5
5
  import type { ProviderExecution, ProviderOptions } from "../provider-recipe.js";
6
6
  export type { ResumeCoordinate } from "../coordinate.js";
@@ -11,13 +11,20 @@ export declare const akumaOriginSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
11
11
  kind: z.ZodLiteral<"direct">;
12
12
  }, z.core.$strip>, z.ZodObject<{
13
13
  kind: z.ZodLiteral<"fork">;
14
- parent: z.ZodPipe<z.ZodString, z.ZodTransform<AkuId, string>>;
14
+ parent: z.ZodPipe<z.ZodString, z.ZodTransform<AkumaId, string>>;
15
15
  at: z.ZodString;
16
16
  }, z.core.$strip>], "kind">;
17
17
  export type AkumaOrigin = z.infer<typeof akumaOriginSchema>;
18
+ export declare const akumaOriginWireSchema: z.ZodUnion<readonly [z.ZodReadonly<z.ZodObject<{
19
+ kind: z.ZodLiteral<"direct">;
20
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
21
+ kind: z.ZodLiteral<"fork">;
22
+ parent: z.ZodPipe<z.ZodString, z.ZodTransform<AkumaId, string>>;
23
+ at: z.ZodString;
24
+ }, z.core.$strict>>]>;
18
25
  export type Soul = Readonly<{
19
- id: AkuId;
20
- archetype: string;
26
+ id: AkumaId;
27
+ akumaName: string;
21
28
  description?: string;
22
29
  provider: ProviderExecution;
23
30
  options: ProviderOptions;
@@ -93,13 +100,21 @@ export declare const reportFactSchema: z.ZodObject<{
93
100
  at: z.ZodString;
94
101
  }, z.core.$strict>;
95
102
  export type ReportFact = z.infer<typeof reportFactSchema>;
103
+ export declare const reportFactWireSchema: z.ZodReadonly<z.ZodObject<{
104
+ kind: z.ZodLiteral<"report">;
105
+ sequence: z.ZodNumber;
106
+ bodySequence: z.ZodNumber;
107
+ turnSequence: z.ZodNumber;
108
+ text: z.ZodString;
109
+ at: z.ZodString;
110
+ }, z.core.$strict>>;
96
111
  export type ReportAdmission = Readonly<{
97
112
  kind: "recorded";
98
113
  report: ReportFact;
99
114
  initiator?: string;
100
115
  }> | Readonly<{
101
116
  kind: "refused";
102
- reason: "not-born" | "not-current-execution";
117
+ reason: "not-born" | "not-executing";
103
118
  }>;
104
119
  export type CallFact = Readonly<{
105
120
  kind: "call";
@@ -166,7 +181,15 @@ export type TellReceiptInput = Readonly<{
166
181
  turnSequence: number;
167
182
  fence: string;
168
183
  }>);
169
- export type KillEvidence = "killed" | "already-killed" | "already-stopped" | "hung" | "untidy" | "unavailable";
184
+ export declare const killEvidenceSchema: z.ZodEnum<{
185
+ killed: "killed";
186
+ hung: "hung";
187
+ unavailable: "unavailable";
188
+ untidy: "untidy";
189
+ "already-killed": "already-killed";
190
+ "already-stopped": "already-stopped";
191
+ }>;
192
+ export type KillEvidence = z.output<typeof killEvidenceSchema>;
170
193
  export type KillFact = Readonly<{
171
194
  sequence: number;
172
195
  bodySequence: number;
@@ -186,7 +209,6 @@ export type InterruptCompletion = Readonly<{
186
209
  kind: "clear";
187
210
  }> | Readonly<{
188
211
  kind: "completed";
189
- body: BodyFact;
190
212
  }> | Readonly<{
191
213
  kind: "unavailable";
192
214
  evidence: "hung" | "untidy";
@@ -11,6 +11,10 @@ export const akumaOriginSchema = z.discriminatedUnion("kind", [
11
11
  z.object({ kind: z.literal("direct") }),
12
12
  z.object({ kind: z.literal("fork"), parent: akumaIdSchema, at: originText }),
13
13
  ]);
14
+ export const akumaOriginWireSchema = z.union([
15
+ akumaOriginSchema.options[0].strict().readonly(),
16
+ akumaOriginSchema.options[1].strict().readonly(),
17
+ ]);
14
18
  export const reportFactSchema = z
15
19
  .object({
16
20
  kind: z.literal("report"),
@@ -21,6 +25,7 @@ export const reportFactSchema = z
21
25
  at: z.string().refine((value) => Number.isFinite(Date.parse(value)), "expected report timestamp"),
22
26
  })
23
27
  .strict();
28
+ export const reportFactWireSchema = reportFactSchema.readonly();
24
29
  export function projectTell(fact) {
25
30
  return {
26
31
  kind: "tell",
@@ -39,6 +44,14 @@ export class AkumaBusyError extends Error {
39
44
  this.name = "AkumaBusyError";
40
45
  }
41
46
  }
47
+ export const killEvidenceSchema = z.enum([
48
+ "killed",
49
+ "already-killed",
50
+ "already-stopped",
51
+ "hung",
52
+ "untidy",
53
+ "unavailable",
54
+ ]);
42
55
  export class BodyControlledError extends Error {
43
56
  constructor() {
44
57
  super("Akuma Body admission is fenced by durable control");
@@ -93,7 +93,6 @@ export type InterruptTellAdmission = Readonly<{
93
93
  }> | Readonly<{
94
94
  kind: "recorded";
95
95
  tell: TellFact;
96
- predecessorWasRunning: boolean;
97
96
  barrier?: PauseFact;
98
97
  }>;
99
98
  type TellAdmission = Readonly<{
@@ -112,8 +111,6 @@ export declare function recordTell(paths: AkumaPaths, tell: TellInput, options?:
112
111
  signal?: AbortSignal;
113
112
  }>): Promise<TellAdmission>;
114
113
  export declare function recordReport(paths: AkumaPaths, input: Readonly<{
115
- bodySequence: number;
116
- turnSequence: number;
117
114
  text: string;
118
115
  at: string;
119
116
  }>, signal?: AbortSignal): Promise<ReportAdmission>;
@@ -190,7 +190,6 @@ function judgeExistingTell(inputs, existing) {
190
190
  return {
191
191
  kind: "recorded",
192
192
  tell: existing,
193
- predecessorWasRunning: body !== null && body.end === undefined,
194
193
  ...(barrier === undefined ? {} : { barrier }),
195
194
  };
196
195
  }
@@ -210,7 +209,7 @@ function judgeNewTell(inputs) {
210
209
  tellId: tell.id,
211
210
  at: tell.recordedAt,
212
211
  });
213
- return { ...admitted, predecessorWasRunning: body.end === undefined, barrier };
212
+ return { ...admitted, barrier };
214
213
  }
215
214
  const running = body !== null && body.end === undefined && body.hung === undefined;
216
215
  if (tell.schemaJson !== undefined && running)
@@ -237,14 +236,12 @@ export async function recordReport(paths, input, signal) {
237
236
  const body = latestBodyFact(heart);
238
237
  const turn = body === null ? null : latestTurnFactForBody(heart, body.sequence);
239
238
  if (body === null ||
240
- body.sequence !== input.bodySequence ||
241
239
  body.end !== undefined ||
242
240
  body.hung !== undefined ||
243
241
  turn === null ||
244
- turn.sequence !== input.turnSequence ||
245
242
  turn.end !== undefined)
246
- return { kind: "refused", reason: "not-current-execution" };
247
- const report = insertReportFact(heart, input);
243
+ return { kind: "refused", reason: "not-executing" };
244
+ const report = insertReportFact(heart, { ...input, bodySequence: body.sequence, turnSequence: turn.sequence });
248
245
  pruneActivityFacts(heart, ACTIVITY_LIMIT);
249
246
  return {
250
247
  kind: "recorded",
@@ -203,14 +203,14 @@ export function completeInterruptBarrier(database, expected, consume = true) {
203
203
  if (latest.end === undefined || !consume)
204
204
  return { kind: "unavailable", evidence: "untidy" };
205
205
  deletePauseControl(database);
206
- return { kind: "completed", body: latest };
206
+ return { kind: "completed" };
207
207
  }
208
208
  function settledPreviousBarrier(database, expected) {
209
209
  const previous = bodyFact(database, expected.bodySequence);
210
210
  if (previous?.hung !== undefined)
211
211
  return { kind: "unavailable", evidence: "hung" };
212
212
  if (previous?.end !== undefined)
213
- return { kind: "completed", body: previous };
213
+ return { kind: "completed" };
214
214
  return { kind: "unavailable", evidence: "untidy" };
215
215
  }
216
216
  function samePause(left, right) {
@@ -1,5 +1,5 @@
1
1
  import { decodeAkumaCaller } from "../caller.js";
2
- import { parseAkuId } from "../identity.js";
2
+ import { parseAkumaId } from "../identity.js";
3
3
  import { decodeProviderOptions, decodeProviderRecipe } from "../provider-recipe.js";
4
4
  import { akumaOriginSchema } from "./facts.js";
5
5
  function record(value) {
@@ -15,7 +15,7 @@ function nonblank(value, what) {
15
15
  }
16
16
  function soulAkuIdentity(value, what) {
17
17
  try {
18
- return parseAkuId(nonblank(value, what));
18
+ return parseAkumaId(nonblank(value, what));
19
19
  }
20
20
  catch (error) {
21
21
  throw new Error(`Akuma soul ${what} is not an Akuma identity coordinate`, { cause: error });
@@ -27,8 +27,8 @@ export function decodeSoulSeed(value) {
27
27
  throw new Error("Akuma soul must be an object");
28
28
  const identity = soulAkuIdentity(soul.id, "id");
29
29
  const id = identity.id;
30
- const archetype = nonblank(soul.archetype, "name");
31
- if (identity.archetype !== archetype)
30
+ const akumaName = nonblank(soul.akumaName, "name");
31
+ if (identity.akumaName !== akumaName)
32
32
  throw new Error("Akuma soul id and name must agree");
33
33
  const description = soul.description === undefined ? undefined : nonblank(soul.description, "description");
34
34
  const provider = decodeProviderRecipe(soul.provider);
@@ -39,7 +39,7 @@ export function decodeSoulSeed(value) {
39
39
  }
40
40
  return {
41
41
  id,
42
- archetype,
42
+ akumaName,
43
43
  ...(description === undefined ? {} : { description }),
44
44
  provider,
45
45
  options,
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  declare const AKU_ID: unique symbol;
3
- export type AkuId = string & {
3
+ export type AkumaId = string & {
4
4
  readonly [AKU_ID]: true;
5
5
  };
6
6
  export declare function parsePublicHistoryId(value: string): number | null;
@@ -8,6 +8,7 @@ export declare function parseExactHistorySelector(value: string): Readonly<{
8
8
  kind: "turn" | "report";
9
9
  sequence: number;
10
10
  }> | null;
11
+ export declare const turnHistoryIdSchema: z.ZodTemplateLiteral<`turn/${number}`>;
11
12
  export declare const akumaPathsSchema: z.ZodObject<{
12
13
  directory: z.ZodString;
13
14
  heart: z.ZodString;
@@ -16,38 +17,38 @@ export declare const akumaPathsSchema: z.ZodObject<{
16
17
  }, z.core.$strict>;
17
18
  export type AkumaPaths = z.infer<typeof akumaPathsSchema>;
18
19
  export type AllocatedAkuma = Readonly<{
19
- id: AkuId;
20
- archetype: string;
20
+ id: AkumaId;
21
+ akumaName: string;
21
22
  suffix: string;
22
23
  paths: AkumaPaths;
23
24
  }>;
24
- export declare function akuId(input: Readonly<{
25
- archetype: string;
25
+ export declare function akumaId(input: Readonly<{
26
+ akumaName: string;
26
27
  suffix: string;
27
- }>): AkuId;
28
- export declare function parseAkuId(value: string): Readonly<{
29
- id: AkuId;
30
- archetype: string;
28
+ }>): AkumaId;
29
+ export declare function parseAkumaId(value: string): Readonly<{
30
+ id: AkumaId;
31
+ akumaName: string;
31
32
  suffix: string;
32
33
  }>;
33
- export declare const akumaIdSchema: z.ZodPipe<z.ZodString, z.ZodTransform<AkuId, string>>;
34
+ export declare const akumaIdSchema: z.ZodPipe<z.ZodString, z.ZodTransform<AkumaId, string>>;
34
35
  export declare function akumaRunRoot(worldRoot: string): string;
35
36
  export declare function akumaPaths(input: Readonly<{
36
37
  runRoot: string;
37
- archetype: string;
38
+ akumaName: string;
38
39
  suffix: string;
39
40
  }>): AkumaPaths;
40
- export declare function akuIdFromDirectoryName(name: string): Readonly<{
41
- id: AkuId;
42
- archetype: string;
41
+ export declare function akumaIdFromDirectoryName(name: string): Readonly<{
42
+ id: AkumaId;
43
+ akumaName: string;
43
44
  suffix: string;
44
45
  }>;
45
46
  export declare function ensureAkumaRunRoot(worldRoot: string): Promise<string>;
46
47
  export declare function allocateAkumaDirectory(input: Readonly<{
47
48
  worldRoot: string;
48
- archetype: string;
49
+ akumaName: string;
49
50
  draw?: () => string;
50
51
  }>): Promise<AllocatedAkuma>;
51
- export declare function pathsForAkuId(worldRoot: string, id: AkuId): AkumaPaths;
52
+ export declare function pathsForAkumaId(worldRoot: string, id: AkumaId): AkumaPaths;
52
53
  export declare function worldRootForAkumaPaths(paths: AkumaPaths): string;
53
54
  export {};
@@ -19,6 +19,7 @@ export function parseExactHistorySelector(value) {
19
19
  const sequence = Number(match[2]);
20
20
  return Number.isSafeInteger(sequence) ? { kind: match[1], sequence } : null;
21
21
  }
22
+ export const turnHistoryIdSchema = z.templateLiteral(["turn/", z.number().int().positive().safe()]);
22
23
  const pathText = z.string().refine((value) => value.trim() !== "");
23
24
  export const akumaPathsSchema = z
24
25
  .object({
@@ -33,32 +34,32 @@ function suffixSegment(value) {
33
34
  throw new TypeError("Akuma suffix must be lower hex8");
34
35
  return value;
35
36
  }
36
- export function akuId(input) {
37
+ export function akumaId(input) {
37
38
  return identityCoordinate({
38
39
  family: "aku",
39
- segments: [validateAkumaName(input.archetype), suffixSegment(input.suffix)],
40
+ segments: [validateAkumaName(input.akumaName), suffixSegment(input.suffix)],
40
41
  });
41
42
  }
42
- export function parseAkuId(value) {
43
+ export function parseAkumaId(value) {
43
44
  const segments = identitySegments({ family: "aku", value });
44
45
  if (segments.length !== 2)
45
46
  throw new TypeError("Akuma identity must be aku/<akuma>/<hex8>");
46
- const archetype = segments[0];
47
+ const akumaName = segments[0];
47
48
  // Existing identities remain addressable after new births gain a name limit.
48
- if (!isCanonicalAkumaName(archetype))
49
+ if (!isCanonicalAkumaName(akumaName))
49
50
  throw new TypeError("Akuma name must be one normalized human identity segment");
50
51
  const suffix = suffixSegment(segments[1]);
51
- return { id: value, archetype, suffix };
52
+ return { id: value, akumaName, suffix };
52
53
  }
53
54
  export const akumaIdSchema = z.string().transform((value, context) => {
54
55
  try {
55
- const id = parseAkuId(value).id;
56
+ const id = parseAkumaId(value).id;
56
57
  if (id !== value)
57
58
  throw new Error("not canonical");
58
59
  return id;
59
60
  }
60
61
  catch {
61
- context.addIssue({ code: "custom", message: "expected canonical AkuId" });
62
+ context.addIssue({ code: "custom", message: "expected canonical AkumaId" });
62
63
  return z.NEVER;
63
64
  }
64
65
  });
@@ -66,9 +67,9 @@ export function akumaRunRoot(worldRoot) {
66
67
  return join(worldRoot, ".keiyaku", "akuma", "run");
67
68
  }
68
69
  export function akumaPaths(input) {
69
- if (!isCanonicalAkumaName(input.archetype))
70
+ if (!isCanonicalAkumaName(input.akumaName))
70
71
  throw new TypeError("Akuma name must be one normalized human identity segment");
71
- const directory = join(input.runRoot, `${input.archetype}-${suffixSegment(input.suffix)}`);
72
+ const directory = join(input.runRoot, `${input.akumaName}-${suffixSegment(input.suffix)}`);
72
73
  return {
73
74
  directory,
74
75
  heart: join(directory, "heart.db"),
@@ -76,12 +77,12 @@ export function akumaPaths(input) {
76
77
  log: join(directory, "stdio.log"),
77
78
  };
78
79
  }
79
- export function akuIdFromDirectoryName(name) {
80
+ export function akumaIdFromDirectoryName(name) {
80
81
  if (name.length < 10 || name.at(-9) !== "-")
81
82
  throw new Error(`invalid Akuma run directory ${name}`);
82
- const archetype = name.slice(0, -9);
83
+ const akumaName = name.slice(0, -9);
83
84
  const suffix = name.slice(-8);
84
- return parseAkuId(`aku/${archetype}/${suffix}`);
85
+ return parseAkumaId(`aku/${akumaName}/${suffix}`);
85
86
  }
86
87
  export async function ensureAkumaRunRoot(worldRoot) {
87
88
  const runRoot = akumaRunRoot(worldRoot);
@@ -96,14 +97,14 @@ export async function ensureAkumaRunRoot(worldRoot) {
96
97
  return runRoot;
97
98
  }
98
99
  export async function allocateAkumaDirectory(input) {
99
- const archetype = validateAkumaName(input.archetype);
100
+ const akumaName = validateAkumaName(input.akumaName);
100
101
  const runRoot = await ensureAkumaRunRoot(input.worldRoot);
101
102
  for (;;) {
102
103
  const suffix = suffixSegment(input.draw?.() ?? randomBytes(4).toString("hex"));
103
- const paths = akumaPaths({ runRoot, archetype, suffix });
104
+ const paths = akumaPaths({ runRoot, akumaName, suffix });
104
105
  try {
105
106
  await mkdir(paths.directory);
106
- return { id: akuId({ archetype, suffix }), archetype, suffix, paths };
107
+ return { id: akumaId({ akumaName, suffix }), akumaName, suffix, paths };
107
108
  }
108
109
  catch (error) {
109
110
  if (error.code !== "EEXIST")
@@ -111,9 +112,9 @@ export async function allocateAkumaDirectory(input) {
111
112
  }
112
113
  }
113
114
  }
114
- export function pathsForAkuId(worldRoot, id) {
115
- const parsed = parseAkuId(id);
116
- return akumaPaths({ runRoot: akumaRunRoot(worldRoot), archetype: parsed.archetype, suffix: parsed.suffix });
115
+ export function pathsForAkumaId(worldRoot, id) {
116
+ const parsed = parseAkumaId(id);
117
+ return akumaPaths({ runRoot: akumaRunRoot(worldRoot), akumaName: parsed.akumaName, suffix: parsed.suffix });
117
118
  }
118
119
  export function worldRootForAkumaPaths(paths) {
119
120
  const runRoot = dirname(paths.directory);
@@ -6,10 +6,9 @@ export { AkumaBusyError, AkumaDecodeError, AkumaNotBornError, AkumaProviderError
6
6
  export { Akuma } from "./akuma-instance.js";
7
7
  export type { AkumaAskOptions, AkumaBirthInput, AkumaHistoryOptions, AkumaHostOptions, AkumaIdleOptions, AkumaIdleResult, AkumaReportOptions, AkumaReportResult, AkumaSignalOptions, AkumaTellOptions, } from "./akuma-instance.js";
8
8
  export type { AkumaStreamSnapshot } from "./akuma-stream.js";
9
- export type { InterruptReceipt } from "./akuma-owner.js";
10
9
  export type { AkumaStatus } from "./akuma.js";
11
10
  export type { KillEvidence } from "./heart/index.js";
12
- export type { AkuId } from "./identity.js";
11
+ export type { AkumaId } from "./identity.js";
13
12
  export type { ActivityHistory, ActivityRow } from "./projection.js";
14
13
  export { Schema } from "./schema.js";
15
14
  export type { JsonSchema, JsonSchemaDocument, SchemaLike, StandardSchemaV1 } from "./schema.js";