@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,10 +1,175 @@
1
+ import { z } from "zod";
2
+ import { contractIdSchema, snapshotIdSchema } from "../../git/identity.js";
3
+ import { gateSchema } from "../result-leaves.js";
1
4
  import { observeActiveContractWorld, observeContractsForAdmissionInObservationAt, deliveryTargetObserver, withContractReadObservationAt, } from "../../git/observe.js";
2
5
  import { decodeContractDocument } from "../../body/decode.js";
3
- import { observeTargetLag, observeWorkspace, readConflictHandoffs, conflictRecovery, worktreePath, } from "../../git/workspace.js";
6
+ import { observeTargetLag, observeWorkspace, worktreePath } from "../../git/workspace.js";
4
7
  import { appointmentFor, readPlaceRegister } from "../../workspace-place.js";
5
8
  import { gateReports } from "../../core/facts/gate.js";
6
9
  import { verificationRequirement } from "../../verification/declaration.js";
7
10
  import { projectBoundedList } from "../../bounded-list.js";
11
+ import { observeCurrentPhysicalIssue } from "./observation.js";
12
+ const phaseSchema = z.enum(["bound", "claimed", "abandoned"]);
13
+ const summaryGateSchema = z
14
+ .strictObject({
15
+ name: gateSchema,
16
+ verdict: z.enum(["missing", "stale", "satisfied", "unsatisfied"]),
17
+ })
18
+ .readonly();
19
+ export const contractSummaryAssociationSchema = z.union([
20
+ z.strictObject({ kind: z.literal("debt"), debtId: z.string().min(1) }).readonly(),
21
+ z
22
+ .strictObject({
23
+ kind: z.literal("akuma"),
24
+ akumaId: z.string().min(1),
25
+ aliases: z.array(z.string().min(1)).min(1).readonly().exactOptional(),
26
+ aliasesUnavailable: z.literal(true).exactOptional(),
27
+ })
28
+ .readonly(),
29
+ z
30
+ .strictObject({
31
+ kind: z.literal("unavailable"),
32
+ source: z.enum(["holder", "roster"]),
33
+ diagnostic: z.string(),
34
+ })
35
+ .readonly(),
36
+ ]);
37
+ export const contractAttentionSchema = z.union([
38
+ z.strictObject({ kind: z.literal("workspace-unavailable"), path: z.string().min(1) }).readonly(),
39
+ z.strictObject({ kind: z.literal("workspace-unappointed") }).readonly(),
40
+ z.strictObject({ kind: z.literal("workspace-failed"), path: z.string().min(1), diagnostic: z.string() }).readonly(),
41
+ z
42
+ .strictObject({
43
+ kind: z.literal("merge-in-progress"),
44
+ path: z.string().min(1),
45
+ conflicts: z.number().int().positive().exactOptional(),
46
+ })
47
+ .readonly(),
48
+ z
49
+ .strictObject({
50
+ kind: z.literal("target-behind"),
51
+ behind: z.number().int().positive(),
52
+ subject: z.string().min(1).exactOptional(),
53
+ })
54
+ .readonly(),
55
+ z.strictObject({ kind: z.literal("target-unknown"), subject: z.string().min(1).exactOptional() }).readonly(),
56
+ ]);
57
+ export const contractSummarySchema = z
58
+ .strictObject({
59
+ id: contractIdSchema,
60
+ title: z.string().min(1).exactOptional(),
61
+ phaseAt: z.string(),
62
+ delivered: z.literal(true).exactOptional(),
63
+ gates: z.array(summaryGateSchema).min(1).readonly().exactOptional(),
64
+ attention: z.array(contractAttentionSchema).min(1).readonly().exactOptional(),
65
+ })
66
+ .readonly();
67
+ export const contractCatalogueSchema = z
68
+ .strictObject({
69
+ observedAt: z.string(),
70
+ rows: z.array(contractSummarySchema).min(1).readonly().exactOptional(),
71
+ more: z.literal(true).exactOptional(),
72
+ })
73
+ .readonly();
74
+ const detailCurrentSchema = z.union([
75
+ z.strictObject({ kind: z.literal("missing") }).readonly(),
76
+ z.strictObject({ kind: z.literal("stale") }).readonly(),
77
+ z
78
+ .strictObject({
79
+ kind: z.literal("attested"),
80
+ verdict: z.enum(["satisfied", "unsatisfied"]),
81
+ summary: z.string().exactOptional(),
82
+ })
83
+ .readonly(),
84
+ ]);
85
+ const rowRequirementSchema = z
86
+ .strictObject({
87
+ requirement: z.string().exactOptional(),
88
+ current: detailCurrentSchema,
89
+ index: z.number().int().positive().exactOptional(),
90
+ })
91
+ .readonly();
92
+ const rowGateSchema = z
93
+ .strictObject({
94
+ gate: z.string(),
95
+ requirements: z.array(rowRequirementSchema).readonly(),
96
+ })
97
+ .readonly();
98
+ const workspaceCountsSchema = z
99
+ .strictObject({
100
+ staged: z.number().int().positive().exactOptional(),
101
+ unstaged: z.number().int().positive().exactOptional(),
102
+ untracked: z.number().int().positive().exactOptional(),
103
+ submodules: z.number().int().positive().exactOptional(),
104
+ })
105
+ .readonly();
106
+ export const contractDetailWorkspaceSchema = z.union([
107
+ z
108
+ .strictObject({
109
+ kind: z.literal("present"),
110
+ path: z.string().min(1),
111
+ counts: workspaceCountsSchema.exactOptional(),
112
+ merge: z.array(z.string()).readonly().exactOptional(),
113
+ })
114
+ .readonly(),
115
+ z.strictObject({ kind: z.literal("unavailable"), path: z.string().min(1) }).readonly(),
116
+ z.strictObject({ kind: z.literal("unappointed") }).readonly(),
117
+ ]);
118
+ export const contractDetailTargetLagSchema = z.union([
119
+ z
120
+ .strictObject({
121
+ kind: z.literal("counted"),
122
+ behind: z.number().int().positive().exactOptional(),
123
+ })
124
+ .readonly(),
125
+ z.strictObject({ kind: z.literal("unknown") }).readonly(),
126
+ ]);
127
+ export const contractDetailTargetObservationSchema = z.union([
128
+ z.strictObject({ kind: z.literal("moved"), before: snapshotIdSchema, after: snapshotIdSchema }).readonly(),
129
+ z.strictObject({ kind: z.literal("unknown") }).readonly(),
130
+ ]);
131
+ export const contractDetailSchema = z
132
+ .strictObject({
133
+ id: contractIdSchema,
134
+ title: z.string().min(1).exactOptional(),
135
+ phase: phaseSchema,
136
+ workspace: contractDetailWorkspaceSchema,
137
+ target: z.string().exactOptional(),
138
+ targetLag: contractDetailTargetLagSchema.exactOptional(),
139
+ delivery: z.strictObject({ candidate: snapshotIdSchema, integration: snapshotIdSchema }).readonly().exactOptional(),
140
+ targetObservation: contractDetailTargetObservationSchema.exactOptional(),
141
+ gates: z.array(rowGateSchema).min(1).readonly().exactOptional(),
142
+ after: z
143
+ .array(z.strictObject({ contractId: contractIdSchema, state: z.enum(["active", "abandoned", "missing"]) }).readonly())
144
+ .min(1)
145
+ .readonly()
146
+ .exactOptional(),
147
+ issue: z
148
+ .union([
149
+ z.strictObject({ kind: z.literal("target-checkout-retained") }).readonly(),
150
+ z.strictObject({ kind: z.literal("unavailable"), diagnostic: z.string() }).readonly(),
151
+ ])
152
+ .exactOptional(),
153
+ abandonNote: z.string().exactOptional(),
154
+ })
155
+ .readonly();
156
+ const dependentSchema = z.strictObject({ contractId: contractIdSchema, phase: phaseSchema }).readonly();
157
+ export const contractBoardSchema = z
158
+ .strictObject({
159
+ rows: z
160
+ .array(contractDetailSchema
161
+ .unwrap()
162
+ .extend({
163
+ dependents: z.array(dependentSchema).min(1).readonly().exactOptional(),
164
+ })
165
+ .readonly())
166
+ .readonly(),
167
+ })
168
+ .readonly();
169
+ export const contractObservationSchema = z.union([
170
+ z.strictObject({ kind: z.literal("missing"), id: contractIdSchema }).readonly(),
171
+ z.strictObject({ kind: z.literal("present"), row: contractDetailSchema }).readonly(),
172
+ ]);
8
173
  function documentFor(state) {
9
174
  try {
10
175
  return decodeContractDocument(state.terms.document.bytes);
@@ -16,7 +181,8 @@ function documentFor(state) {
16
181
  }
17
182
  }
18
183
  function titleFor(document) {
19
- return document?.title ?? null;
184
+ const title = document?.title;
185
+ return title === undefined || title.trim() === "" ? undefined : title;
20
186
  }
21
187
  function phaseFor(state) {
22
188
  if (state.terminal?.kind === "claimed")
@@ -25,26 +191,94 @@ function phaseFor(state) {
25
191
  return "abandoned";
26
192
  return "bound";
27
193
  }
28
- export function phaseAtFor(state, bindAt) {
194
+ function phaseAtFor(state, bindAt) {
29
195
  return state.terminal?.at ?? state.delivery?.at ?? bindAt;
30
196
  }
31
- export function lastJournalAtFor(entries) {
197
+ function lastJournalAtFor(entries) {
32
198
  const last = entries.at(-1);
33
199
  if (last === undefined)
34
200
  throw new Error("present Contract journal is empty");
35
201
  return last.at;
36
202
  }
203
+ function summaryVerdict(current) {
204
+ if (current.kind === "missing")
205
+ return "missing";
206
+ if (current.kind === "stale")
207
+ return "stale";
208
+ return current.verdict;
209
+ }
210
+ function summaryFor({ state, bindAt }) {
211
+ const document = documentFor(state);
212
+ const title = titleFor(document);
213
+ const gates = gateReports(state).reports.map((report) => ({
214
+ name: report.gate,
215
+ verdict: summaryVerdict(report.current),
216
+ }));
217
+ return {
218
+ id: state.id,
219
+ ...(title === undefined ? {} : { title }),
220
+ phaseAt: phaseAtFor(state, bindAt),
221
+ ...(state.delivery === null ? {} : { delivered: true }),
222
+ ...(gates.length === 0 ? {} : { gates }),
223
+ };
224
+ }
37
225
  function appointedWorkspace(repository, register, state) {
38
226
  const appointed = appointmentFor(register, state.id);
39
227
  return appointed === undefined
40
228
  ? undefined
41
229
  : { contractId: state.id, place: appointed.place, workspace: worktreePath(repository, appointed.place) };
42
230
  }
43
- async function managedWorkspaceFacts(repository, state, appointed, targetObservation, handoff) {
231
+ function detailCounts(counts) {
232
+ return {
233
+ ...(counts.staged === 0 ? {} : { staged: counts.staged }),
234
+ ...(counts.unstaged === 0 ? {} : { unstaged: counts.unstaged }),
235
+ ...(counts.untracked === 0 ? {} : { untracked: counts.untracked }),
236
+ ...(counts.submodules === 0 ? {} : { submodules: counts.submodules }),
237
+ };
238
+ }
239
+ function detailWorkspace(path, observed) {
240
+ switch (observed.kind) {
241
+ case "clean":
242
+ case "dirty": {
243
+ const counts = detailCounts(observed.counts);
244
+ return {
245
+ kind: "present",
246
+ path,
247
+ ...(Object.keys(counts).length === 0 ? {} : { counts }),
248
+ ...(observed.merge === null ? {} : { merge: observed.merge.unmergedPaths }),
249
+ };
250
+ }
251
+ case "unavailable":
252
+ return { kind: "unavailable", path };
253
+ case "unappointed":
254
+ return { kind: "unappointed" };
255
+ case "failed":
256
+ throw new Error(observed.diagnostic);
257
+ }
258
+ }
259
+ function detailTargetLag(lag) {
260
+ if (lag.kind === "none")
261
+ return undefined;
262
+ return lag.kind === "counted"
263
+ ? { kind: "counted", ...(lag.behind === 0 ? {} : { behind: lag.behind }) }
264
+ : { kind: "unknown" };
265
+ }
266
+ function detailTargetObservation(observed, state) {
267
+ if (observed === null)
268
+ return undefined;
269
+ if (observed.head === null)
270
+ return { kind: "unknown" };
271
+ const integration = state.currentIntegration;
272
+ const expected = state.terminal?.kind === "claimed" ? integration?.snapshot : integration?.predecessor;
273
+ return observed.drift && expected !== undefined
274
+ ? { kind: "moved", before: expected, after: observed.head }
275
+ : undefined;
276
+ }
277
+ async function managedWorkspaceFacts(repository, state, appointed, targetObservation) {
44
278
  if (appointed === undefined) {
45
279
  return {
46
- workspaceObservation: { kind: "unappointed" },
47
- targetLag: state.coordinates.target === undefined ? { kind: "none" } : { kind: "unknown" },
280
+ workspace: { kind: "unappointed" },
281
+ targetLag: state.coordinates.target === undefined ? undefined : { kind: "unknown" },
48
282
  };
49
283
  }
50
284
  const path = appointed.workspace;
@@ -52,34 +286,49 @@ async function managedWorkspaceFacts(repository, state, appointed, targetObserva
52
286
  observeWorkspace(repository, { kind: "worktree", path }, path),
53
287
  observeTargetLag(repository, path, targetObservation?.head),
54
288
  ]);
55
- const projectedWorkspaceObservation = handoff !== undefined &&
56
- (workspaceObservation.kind === "clean" || workspaceObservation.kind === "dirty") &&
57
- workspaceObservation.merge !== null
58
- ? {
59
- ...workspaceObservation,
60
- merge: {
61
- ...workspaceObservation.merge,
62
- handoffBase: handoff.base,
63
- recovery: conflictRecovery,
64
- },
65
- }
66
- : workspaceObservation;
67
- return { workspaceObservation: projectedWorkspaceObservation, targetLag };
289
+ return {
290
+ workspace: detailWorkspace(path, workspaceObservation),
291
+ targetLag: detailTargetLag(targetLag),
292
+ ...(targetLag.kind === "none" || targetLag.subject === undefined ? {} : { lagSubject: targetLag.subject.path }),
293
+ };
294
+ }
295
+ function summaryAttention({ workspace, targetLag, lagSubject, }) {
296
+ const attention = [];
297
+ switch (workspace.kind) {
298
+ case "unavailable":
299
+ attention.push({ kind: "workspace-unavailable", path: workspace.path });
300
+ break;
301
+ case "unappointed":
302
+ attention.push({ kind: "workspace-unappointed" });
303
+ break;
304
+ case "present":
305
+ if (workspace.merge !== undefined) {
306
+ const conflicts = workspace.merge.length;
307
+ attention.push({ kind: "merge-in-progress", path: workspace.path, ...(conflicts === 0 ? {} : { conflicts }) });
308
+ }
309
+ }
310
+ if (targetLag?.kind === "unknown")
311
+ attention.push({ kind: "target-unknown", ...(lagSubject === undefined ? {} : { subject: lagSubject }) });
312
+ else if (targetLag?.behind !== undefined)
313
+ attention.push({
314
+ kind: "target-behind",
315
+ behind: targetLag.behind,
316
+ ...(lagSubject === undefined ? {} : { subject: lagSubject }),
317
+ });
318
+ return attention;
68
319
  }
69
320
  function afterEndpoint(state) {
70
321
  if (state === undefined || state === null)
71
- return { kind: "missing" };
322
+ return "missing";
72
323
  if (state.terminal?.kind === "claimed")
73
- return { kind: "claimed" };
74
- if (state.terminal?.kind === "abandoned")
75
- return { kind: "abandoned" };
76
- return { kind: "active", phase: phaseFor(state) };
324
+ return undefined;
325
+ return state.terminal?.kind === "abandoned" ? "abandoned" : "active";
77
326
  }
78
327
  function afterEdges(state, endpoints) {
79
- return state.terms.after.map((contractId) => ({
80
- contractId,
81
- endpoint: afterEndpoint(endpoints.get(contractId)),
82
- }));
328
+ return state.terms.after.flatMap((contractId) => {
329
+ const endpoint = afterEndpoint(endpoints.get(contractId));
330
+ return endpoint === undefined ? [] : [{ contractId, state: endpoint }];
331
+ });
83
332
  }
84
333
  function reverseDependents(id, states) {
85
334
  return states
@@ -88,8 +337,7 @@ function reverseDependents(id, states) {
88
337
  .sort((left, right) => left.contractId.localeCompare(right.contractId));
89
338
  }
90
339
  async function rowFor(input) {
91
- const { repository, state, bindAt, lastJournalAt, targetObservation, workspace, handoff, after, dependents } = input;
92
- const gates = gateReports(state);
340
+ const { repository, state, targetObservation: rawTargetObservation, workspace, after, dependents } = input;
93
341
  const document = documentFor(state);
94
342
  const indexes = new Map();
95
343
  document?.verification.forEach((declaration, index) => {
@@ -97,39 +345,60 @@ async function rowFor(input) {
97
345
  if (!indexes.has(requirement))
98
346
  indexes.set(requirement, index + 1);
99
347
  });
100
- const facts = await managedWorkspaceFacts(repository, state, workspace, targetObservation, handoff);
101
- return {
348
+ const facts = await managedWorkspaceFacts(repository, state, workspace, rawTargetObservation);
349
+ const gates = gateReports(state).reports.map((report) => ({
350
+ gate: report.gate,
351
+ requirements: report.requirements.map((requirement) => {
352
+ const index = report.gate === "verified" ? indexes.get(requirement.requirement) : undefined;
353
+ const current = requirement.current;
354
+ return {
355
+ ...(index !== undefined
356
+ ? { index }
357
+ : requirement.requirement === `gate:${report.gate}`
358
+ ? {}
359
+ : { requirement: requirement.requirement }),
360
+ current: current.kind === "attested"
361
+ ? {
362
+ kind: "attested",
363
+ verdict: current.verdict,
364
+ ...(current.summary === undefined ? {} : { summary: current.summary }),
365
+ }
366
+ : { kind: current.kind },
367
+ };
368
+ }),
369
+ }));
370
+ const title = titleFor(document);
371
+ const targetObservation = detailTargetObservation(rawTargetObservation, state);
372
+ const row = {
102
373
  id: state.id,
103
- title: titleFor(document),
374
+ ...(title === undefined ? {} : { title }),
104
375
  phase: phaseFor(state),
105
- phaseAt: phaseAtFor(state, bindAt),
106
- lastJournalAt,
107
- disposition: state.terminal === null ? "active" : "terminal",
108
- workspace: state.coordinates.workspace,
109
- worktreePath: workspace?.workspace ?? null,
110
- workspaceObservation: facts.workspaceObservation,
111
- target: state.coordinates.target ?? null,
112
- targetLag: facts.targetLag,
113
- delivery: state.delivery === null || state.currentIntegration === null
114
- ? null
115
- : { ...state.delivery.data, integration: state.currentIntegration },
376
+ workspace: facts.workspace,
377
+ ...(state.coordinates.target === undefined
378
+ ? {}
379
+ : {
380
+ target: typeof state.coordinates.target === "string"
381
+ ? state.coordinates.target
382
+ : state.coordinates.target.contractId,
383
+ }),
384
+ ...(facts.targetLag === undefined ? {} : { targetLag: facts.targetLag }),
385
+ ...(state.delivery === null
386
+ ? {}
387
+ : {
388
+ delivery: {
389
+ candidate: state.delivery.data.tenderSnapshot,
390
+ integration: (state.currentIntegration ?? state.delivery.data.integration).snapshot,
391
+ },
392
+ }),
393
+ ...(targetObservation === undefined ? {} : { targetObservation }),
394
+ ...(gates.length === 0 ? {} : { gates }),
395
+ ...(after.length === 0 ? {} : { after }),
396
+ ...(dependents.length === 0 ? {} : { dependents }),
116
397
  ...(state.terminal?.kind === "abandoned" && state.terminal.data.note !== undefined
117
398
  ? { abandonNote: state.terminal.data.note }
118
399
  : {}),
119
- targetObservation,
120
- gates: {
121
- reports: gates.reports.map((report) => ({
122
- ...report,
123
- requirements: report.requirements.map((requirement) => {
124
- const index = report.gate === "verified" ? indexes.get(requirement.requirement) : undefined;
125
- return { ...requirement, ...(index === undefined ? {} : { index }) };
126
- }),
127
- })),
128
- satisfied: gates.satisfied,
129
- },
130
- after,
131
- dependents,
132
400
  };
401
+ return input.physicalIssue ? await selectedDetailWithIssue(repository, state, row, rawTargetObservation) : row;
133
402
  }
134
403
  async function afterEndpointMap(observation, known, ids) {
135
404
  const missing = ids.filter((id) => !known.has(id));
@@ -138,29 +407,26 @@ async function afterEndpointMap(observation, known, ids) {
138
407
  const extra = await observeContractsForAdmissionInObservationAt(observation, missing);
139
408
  return new Map([...known, ...[...extra.journals].map(([id, record]) => [id, record.state])]);
140
409
  }
141
- async function hydrateRows(observation, states, endpoints, dependentStates = []) {
410
+ async function hydrateRows(observation, states, endpoints, dependentStates = [], physicalIssue = false) {
142
411
  const register = await readPlaceRegister(observation.repository);
143
412
  const selected = states.map((value) => ({
144
413
  ...value,
145
414
  workspace: appointedWorkspace(observation.repository, register, value.state),
146
415
  }));
147
- const handoffs = await readConflictHandoffs(observation.repository, observation.readBlobs, selected.flatMap(({ workspace }) => (workspace === undefined ? [] : [workspace])));
148
416
  const observeTarget = deliveryTargetObserver(observation);
149
- return await Promise.all(selected.map(async ({ state, bindAt, lastJournalAt, workspace }) => await rowFor({
417
+ return await Promise.all(selected.map(async ({ state, bindAt, workspace }) => await rowFor({
150
418
  repository: observation.repository,
151
419
  state,
152
420
  bindAt,
153
- lastJournalAt,
154
421
  targetObservation: await observeTarget(state),
155
422
  workspace,
156
- handoff: handoffs.get(state.id),
157
423
  after: afterEdges(state, endpoints),
158
424
  dependents: reverseDependents(state.id, dependentStates),
425
+ physicalIssue,
159
426
  })));
160
427
  }
161
428
  /** Build the complete board by default; a selected detail read retains complete dependency evidence. */
162
429
  export async function readContractBoard(observation, include, detail = "board") {
163
- const observedAt = new Date().toISOString();
164
430
  const observed = await observeActiveContractWorld(observation);
165
431
  const contracts = new Map(observed.contracts);
166
432
  let endpoints = new Map(observed.eligibility);
@@ -178,12 +444,7 @@ export async function readContractBoard(observation, include, detail = "board")
178
444
  const states = selectedContractStates(contracts);
179
445
  const selected = detail === "selected" ? states.filter(({ state }) => state.id === include) : states;
180
446
  const rows = await hydrateRows(observation, selected, endpoints, states);
181
- return {
182
- root: observation.repository.primaryWorktree,
183
- state: observed.snapshot,
184
- observedAt,
185
- rows,
186
- };
447
+ return { rows };
187
448
  }
188
449
  function compareRecentContracts(left, right) {
189
450
  return (right.lastJournalAt.localeCompare(left.lastJournalAt) ||
@@ -200,21 +461,28 @@ function selectedContractStates(contracts) {
200
461
  },
201
462
  ]);
202
463
  }
203
- /** Observe a bounded recent active Contract catalogue from one immutable git observation. */
464
+ /**
465
+ * Observe a bounded recent active Contract catalogue, or its complete active set
466
+ * when no bound is selected, from one immutable Git observation.
467
+ */
204
468
  export async function readContractCatalogue(observation, limit) {
205
469
  const observedAt = new Date().toISOString();
206
470
  const observed = await observeActiveContractWorld(observation);
207
- const active = selectedContractStates(observed.contracts).filter(({ state }) => state.terminal === null);
208
- const selected = projectBoundedList([...active].sort(compareRecentContracts), limit);
209
- const afterIds = selected.rows.flatMap(({ state }) => state.terms.after);
210
- const endpoints = await afterEndpointMap(observation, new Map(observed.eligibility), afterIds);
211
- const rows = await hydrateRows(observation, selected.rows, endpoints, active);
471
+ const active = selectedContractStates(observed.contracts)
472
+ .filter(({ state }) => state.terminal === null)
473
+ .sort(compareRecentContracts);
474
+ const selected = limit === undefined ? { rows: active, hasMore: false } : projectBoundedList(active, limit);
475
+ const register = await readPlaceRegister(observation.repository);
476
+ const observeTarget = deliveryTargetObserver(observation);
477
+ const rows = await Promise.all(selected.rows.map(async (selected) => {
478
+ const { state } = selected;
479
+ const attention = summaryAttention(await managedWorkspaceFacts(observation.repository, state, appointedWorkspace(observation.repository, register, state), await observeTarget(state)));
480
+ return { ...summaryFor(selected), ...(attention.length === 0 ? {} : { attention }) };
481
+ }));
212
482
  return {
213
- root: observation.repository.primaryWorktree,
214
- state: observed.snapshot,
215
483
  observedAt,
216
- rows,
217
- hasMore: selected.hasMore,
484
+ ...(rows.length === 0 ? {} : { rows }),
485
+ ...(selected.hasMore ? { more: true } : {}),
218
486
  };
219
487
  }
220
488
  /**
@@ -238,11 +506,30 @@ export async function readContractObservation(observation, id) {
238
506
  if (state === null)
239
507
  return { kind: "missing", id };
240
508
  const endpoints = await afterEndpointMap(observation, new Map([[id, state]]), state.terms.after);
241
- const rows = await hydrateRows(observation, selectedContractStates(observed.journals), endpoints);
242
- return {
243
- kind: "present",
244
- row: rows[0],
245
- };
509
+ const rows = await hydrateRows(observation, selectedContractStates(observed.journals), endpoints, [], true);
510
+ return { kind: "present", row: rows[0] };
511
+ }
512
+ /** The exact selected read carries its physical issue; only that physical read can turn unavailable. */
513
+ async function selectedDetailWithIssue(repository, state, row, targetObservation) {
514
+ const delivery = state.delivery;
515
+ if (delivery === null)
516
+ return row;
517
+ const integration = state.currentIntegration ?? delivery.data.integration;
518
+ try {
519
+ const issue = await observeCurrentPhysicalIssue(repository, {
520
+ phase: row.phase,
521
+ target: state.coordinates.target,
522
+ delivery: row.delivery,
523
+ observedHead: targetObservation?.head ?? null,
524
+ }, integration.predecessor);
525
+ return issue === undefined ? row : { ...row, issue };
526
+ }
527
+ catch (error) {
528
+ return {
529
+ ...row,
530
+ issue: { kind: "unavailable", diagnostic: error instanceof Error ? error.message : String(error) },
531
+ };
532
+ }
246
533
  }
247
534
  /** Observe one Contract and its target from one fresh ref epoch. */
248
535
  export async function readContractObservationAt(repository, channel, id) {
@@ -1,4 +1,5 @@
1
1
  import { type ReconcileResult } from "../git/reconcile.js";
2
+ import type { ProtocolProgress } from "./progress.js";
2
3
  import type { ContractId, ContractState } from "../core/facts/types.js";
3
4
  import type { WorktreeHooks } from "../git/hooks.js";
4
5
  import type { GitDecodeChannel } from "../git/read-observation.js";
@@ -32,5 +33,6 @@ export declare function reconcileAllOperation(input: Readonly<{
32
33
  scope: RepositoryScope;
33
34
  channel: GitDecodeChannel;
34
35
  states: readonly ContractState[];
36
+ progress?: ProtocolProgress;
35
37
  }> & ReconcileOptions): Promise<RepoReconcileReport>;
36
38
  export {};
@@ -1,4 +1,4 @@
1
- import { reconcile, reconcileBatch, reconcileObservationFailure } from "../git/reconcile.js";
1
+ import { reconcile, reconcileObservationFailure } from "../git/reconcile.js";
2
2
  import { observeContractWorld } from "../git/observe.js";
3
3
  import { withGitReadObservation } from "../git/read-observation.js";
4
4
  import { AuthorityCorruptionError } from "../core/facts/errors.js";
@@ -30,15 +30,16 @@ export async function worldContractStates(input) {
30
30
  return [...observation.contracts.values()].flatMap((value) => (value.state === null ? [] : [value.state]));
31
31
  }
32
32
  export async function reconcileAllOperation(input) {
33
- const contracts = (await reconcileBatch(input.scope, input.channel, input.states.map((state) => state.id), {
34
- hooks: input.hooks,
35
- retryHooks: input.retryHooks,
36
- retainTerminalWorktree: input.retainTerminalWorktree ?? false,
37
- ...(input.places === undefined ? {} : { places: input.places }),
38
- })).map((item) => ({
39
- contractId: item.contract,
40
- state: item.state,
41
- report: item.result,
42
- }));
33
+ const contracts = [];
34
+ for (const state of input.states) {
35
+ const place = input.places?.get(state.id);
36
+ const observed = await reconcileOperation({
37
+ ...input,
38
+ contractId: state.id,
39
+ retainTerminalWorktree: input.retainTerminalWorktree ?? false,
40
+ ...(place === undefined ? {} : { place }),
41
+ });
42
+ contracts.push({ contractId: state.id, ...observed });
43
+ }
43
44
  return { contracts };
44
45
  }
@@ -10,7 +10,6 @@ import { type ProtocolTerminal } from "./run.js";
10
10
  import { type PlacementExecutionFailure } from "./placement.js";
11
11
  type TargetMissing = Readonly<{
12
12
  kind: "target-missing";
13
- contractId: ContractId;
14
13
  }>;
15
14
  type ReintegrationRefusal = ReintegrateRefusal | TargetMissing | IntegrationPreparationRefusal | TargetWorkspaceRefusal;
16
15
  export type ReintegrationResult = (AcceptedAdmission & Readonly<{
@@ -17,7 +17,7 @@ async function prepareExternalReintegration(input) {
17
17
  async function planReintegrationArtifacts(input, state, recordedIntegrations) {
18
18
  if (state.delivery === null || state.currentIntegration === null)
19
19
  return { kind: "defer" };
20
- const planned = await planIntegration(input.repository, { contractId: input.contractId, coordinates: state.coordinates }, await persistedTender(input.repository, state.delivery.data.tenderSnapshot), state.delivery.data.policy.requireBranchesToBeUpToDate);
20
+ const planned = await planIntegration(input.repository, { coordinates: state.coordinates }, await persistedTender(input.repository, state.delivery.data.tenderSnapshot), state.delivery.data.policy.requireBranchesToBeUpToDate);
21
21
  if (planned.kind === "refused")
22
22
  return { kind: "refused", refusal: planned.refusal };
23
23
  const snapshot = (await reusableIntegrationSnapshot(input.repository, planned.data.tree, planned.data.predecessor, recordedIntegrations)) ??
@@ -33,7 +33,7 @@ function assembleReintegrationAttempt(input, observation, external) {
33
33
  const state = contractState(observation.decision, input.contractId);
34
34
  if (state === null) {
35
35
  return external.kind === "unavailable"
36
- ? { kind: "unavailable", refusal: { kind: "contract-missing", contractId: input.contractId } }
36
+ ? { kind: "unavailable", refusal: { kind: "contract-missing" } }
37
37
  : STALE_PRIVATE_STATE_PREPARATION;
38
38
  }
39
39
  if (external.kind === "unavailable")
@@ -41,7 +41,7 @@ function assembleReintegrationAttempt(input, observation, external) {
41
41
  if (external.witness.head !== state.head)
42
42
  return STALE_PRIVATE_STATE_PREPARATION;
43
43
  if (state.delivery === null || state.currentIntegration === null) {
44
- return { kind: "unavailable", refusal: { kind: "delivery-missing", contractId: input.contractId } };
44
+ return { kind: "unavailable", refusal: { kind: "delivery-missing" } };
45
45
  }
46
46
  return external.artifacts.kind === "defer" ? STALE_PRIVATE_STATE_PREPARATION : external.artifacts;
47
47
  }
@@ -57,7 +57,7 @@ async function runReintegration(input) {
57
57
  return assembled;
58
58
  const state = contractState(observation.decision, input.contractId);
59
59
  if (state !== null) {
60
- const refusal = targetContractRefusal(observation.decision, state.id, state.coordinates.target);
60
+ const refusal = targetContractRefusal(observation.decision, state.coordinates.target);
61
61
  if (refusal !== undefined)
62
62
  return { kind: "refused", refusal };
63
63
  }