@astrosheep/keiyaku 4.6.29 → 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 (400) 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 +24 -24
  4. package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +44 -168
  5. package/build/plugins/claude/skills/keiyaku-akuma/references/automation.md +61 -231
  6. package/build/plugins/claude/skills/keiyaku-babysit/SKILL.md +47 -58
  7. package/build/plugins/claude/skills/keiyaku-bind/SKILL.md +44 -185
  8. package/build/plugins/claude/skills/keiyaku-debt/SKILL.md +40 -89
  9. package/build/plugins/claude/skills/keiyaku-workflow/SKILL.md +56 -116
  10. package/build/plugins/codex/.codex-plugin/plugin.json +1 -1
  11. package/build/plugins/codex/skills/keiyaku/SKILL.md +24 -24
  12. package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +44 -168
  13. package/build/plugins/codex/skills/keiyaku-akuma/references/automation.md +61 -231
  14. package/build/plugins/codex/skills/keiyaku-babysit/SKILL.md +47 -58
  15. package/build/plugins/codex/skills/keiyaku-bind/SKILL.md +44 -185
  16. package/build/plugins/codex/skills/keiyaku-debt/SKILL.md +40 -89
  17. package/build/plugins/codex/skills/keiyaku-workflow/SKILL.md +56 -116
  18. package/build/plugins/opencode/package.json +1 -1
  19. package/build/plugins/opencode/skills/keiyaku/SKILL.md +24 -24
  20. package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +44 -168
  21. package/build/plugins/opencode/skills/keiyaku-akuma/references/automation.md +61 -231
  22. package/build/plugins/opencode/skills/keiyaku-babysit/SKILL.md +47 -58
  23. package/build/plugins/opencode/skills/keiyaku-bind/SKILL.md +44 -185
  24. package/build/plugins/opencode/skills/keiyaku-debt/SKILL.md +40 -89
  25. package/build/plugins/opencode/skills/keiyaku-workflow/SKILL.md +56 -116
  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 +24 -24
  29. package/build/skills/keiyaku-akuma/SKILL.md +44 -168
  30. package/build/skills/keiyaku-akuma/references/automation.md +61 -231
  31. package/build/skills/keiyaku-babysit/SKILL.md +47 -58
  32. package/build/skills/keiyaku-bind/SKILL.md +44 -185
  33. package/build/skills/keiyaku-debt/SKILL.md +40 -89
  34. package/build/skills/keiyaku-workflow/SKILL.md +56 -116
  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 +162 -122
  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 +5 -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 -207
  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 +35 -36
  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/observe.d.ts +2 -1
  213. package/build/src/git/observe.js +29 -20
  214. package/build/src/git/private-state-seat.d.ts +2 -2
  215. package/build/src/git/private-state-seat.js +2 -1
  216. package/build/src/git/reconcile.d.ts +17 -79
  217. package/build/src/git/reconcile.js +37 -52
  218. package/build/src/git/scratch.d.ts +3 -3
  219. package/build/src/git/scratch.js +4 -1
  220. package/build/src/git/target-placement.d.ts +23 -31
  221. package/build/src/git/target-placement.js +42 -27
  222. package/build/src/git/target.d.ts +2 -2
  223. package/build/src/git/target.js +2 -1
  224. package/build/src/git/tender.d.ts +7 -39
  225. package/build/src/git/tender.js +21 -54
  226. package/build/src/git/terminal-reconcile.js +15 -18
  227. package/build/src/git/terminal-seal.d.ts +2 -4
  228. package/build/src/git/terminal-seal.js +7 -33
  229. package/build/src/git/workspace.d.ts +65 -41
  230. package/build/src/git/workspace.js +45 -14
  231. package/build/src/identity/selector.d.ts +2 -0
  232. package/build/src/identity/selector.js +13 -3
  233. package/build/src/index.d.ts +48 -54
  234. package/build/src/index.js +31 -43
  235. package/build/src/kanshi/counts.d.ts +42 -8
  236. package/build/src/kanshi/counts.js +13 -2
  237. package/build/src/kanshi/index.d.ts +5 -5
  238. package/build/src/kanshi/index.js +4 -3
  239. package/build/src/kanshi/read.d.ts +489 -6
  240. package/build/src/kanshi/read.js +334 -483
  241. package/build/src/kanshi/report.d.ts +2504 -103
  242. package/build/src/kanshi/report.js +165 -1
  243. package/build/src/kanshi/select.d.ts +0 -8
  244. package/build/src/kanshi/select.js +20 -59
  245. package/build/src/library/address.d.ts +8 -8
  246. package/build/src/library/address.js +7 -7
  247. package/build/src/library/akuma-creation.d.ts +690 -84
  248. package/build/src/library/akuma-creation.js +202 -142
  249. package/build/src/library/akuma-retention.d.ts +2 -2
  250. package/build/src/library/akuma-retention.js +2 -2
  251. package/build/src/library/akumas.d.ts +10 -6
  252. package/build/src/library/akumas.js +24 -7
  253. package/build/src/library/bind.d.ts +28 -54
  254. package/build/src/library/bind.js +6 -4
  255. package/build/src/library/continuation.d.ts +197 -479
  256. package/build/src/library/continuation.js +40 -23
  257. package/build/src/library/contract-address.d.ts +6 -5
  258. package/build/src/library/contract-address.js +5 -7
  259. package/build/src/library/contract-composition.d.ts +18 -12
  260. package/build/src/library/contract-composition.js +55 -47
  261. package/build/src/library/contract-creation.d.ts +3 -2
  262. package/build/src/library/contract-creation.js +38 -32
  263. package/build/src/library/contract-execution.js +77 -38
  264. package/build/src/library/contract-outcomes.d.ts +1877 -27
  265. package/build/src/library/contract-outcomes.js +93 -10
  266. package/build/src/library/contract-settings.d.ts +2 -2
  267. package/build/src/library/contract-settings.js +18 -14
  268. package/build/src/library/contract-types.d.ts +238 -61
  269. package/build/src/library/contract-types.js +131 -1
  270. package/build/src/library/contract-wait.d.ts +38 -17
  271. package/build/src/library/contract-wait.js +40 -10
  272. package/build/src/library/delivery.d.ts +588 -36
  273. package/build/src/library/delivery.js +35 -27
  274. package/build/src/library/input.d.ts +1 -1
  275. package/build/src/library/input.js +1 -2
  276. package/build/src/library/invocation.d.ts +11 -7
  277. package/build/src/library/invocation.js +42 -51
  278. package/build/src/library/kei.d.ts +48 -0
  279. package/build/src/library/kei.js +256 -0
  280. package/build/src/library/keiyaku-attribution.d.ts +11 -0
  281. package/build/src/{cli/delivery-identity.js → library/keiyaku-attribution.js} +12 -1
  282. package/build/src/library/keiyaku-classify.d.ts +11 -0
  283. package/build/src/library/keiyaku-classify.js +146 -0
  284. package/build/src/library/keiyaku-coordinates.d.ts +31 -0
  285. package/build/src/library/keiyaku-coordinates.js +103 -0
  286. package/build/src/library/keiyaku-debt.d.ts +142 -0
  287. package/build/src/library/keiyaku-debt.js +188 -0
  288. package/build/src/library/keiyaku-identity.d.ts +58 -0
  289. package/build/src/library/keiyaku-identity.js +176 -0
  290. package/build/src/library/keiyaku-policy.d.ts +27 -0
  291. package/build/src/library/keiyaku-policy.js +44 -0
  292. package/build/src/library/keiyaku-status.d.ts +1487 -0
  293. package/build/src/library/keiyaku-status.js +92 -0
  294. package/build/src/library/keiyaku-verbs.d.ts +6774 -0
  295. package/build/src/library/keiyaku-verbs.js +458 -0
  296. package/build/src/library/keiyaku.d.ts +871 -38
  297. package/build/src/library/keiyaku.js +677 -127
  298. package/build/src/library/nuke.d.ts +22 -0
  299. package/build/src/library/nuke.js +4 -1
  300. package/build/src/library/outcome.d.ts +706 -692
  301. package/build/src/library/outcome.js +582 -167
  302. package/build/src/library/reconcile.d.ts +464 -116
  303. package/build/src/library/reconcile.js +174 -102
  304. package/build/src/library/refusal.d.ts +113 -577
  305. package/build/src/library/refusal.js +64 -51
  306. package/build/src/library/region.d.ts +5 -24
  307. package/build/src/library/region.js +6 -21
  308. package/build/src/library/selection.d.ts +181 -32
  309. package/build/src/library/selection.js +99 -64
  310. package/build/src/mcp/adapter.d.ts +11 -0
  311. package/build/src/mcp/adapter.js +106 -0
  312. package/build/src/mcp/help.d.ts +1 -0
  313. package/build/src/mcp/help.js +26 -0
  314. package/build/src/mcp/index.d.ts +2 -0
  315. package/build/src/mcp/index.js +37 -0
  316. package/build/src/plugin/public.d.ts +1 -1
  317. package/build/src/plugin/runtime.js +17 -14
  318. package/build/src/protocol/arc.d.ts +4 -1
  319. package/build/src/protocol/arc.js +7 -1
  320. package/build/src/protocol/attempt.d.ts +2 -3
  321. package/build/src/protocol/attempt.js +1 -10
  322. package/build/src/protocol/bind.d.ts +6 -7
  323. package/build/src/protocol/bind.js +9 -5
  324. package/build/src/protocol/completion.d.ts +448 -12
  325. package/build/src/protocol/completion.js +164 -26
  326. package/build/src/protocol/deliver.d.ts +26 -24
  327. package/build/src/protocol/deliver.js +24 -52
  328. package/build/src/protocol/delivery-preview.d.ts +97 -247
  329. package/build/src/protocol/delivery-preview.js +132 -128
  330. package/build/src/protocol/execution-observation.d.ts +146 -123
  331. package/build/src/protocol/execution-observation.js +9 -6
  332. package/build/src/protocol/intent.d.ts +9 -48
  333. package/build/src/protocol/intent.js +32 -46
  334. package/build/src/protocol/operations.d.ts +207 -505
  335. package/build/src/protocol/operations.js +81 -134
  336. package/build/src/protocol/placement.d.ts +0 -1
  337. package/build/src/protocol/placement.js +5 -2
  338. package/build/src/protocol/progress.d.ts +7 -97
  339. package/build/src/protocol/progress.js +7 -55
  340. package/build/src/protocol/read/observation.d.ts +13 -6
  341. package/build/src/protocol/read/observation.js +10 -9
  342. package/build/src/protocol/read/status.d.ts +466 -95
  343. package/build/src/protocol/read/status.js +380 -91
  344. package/build/src/protocol/reconcile.d.ts +2 -0
  345. package/build/src/protocol/reconcile.js +12 -11
  346. package/build/src/protocol/reintegrate.d.ts +0 -1
  347. package/build/src/protocol/reintegrate.js +4 -4
  348. package/build/src/protocol/result-leaves.d.ts +528 -0
  349. package/build/src/protocol/result-leaves.js +195 -0
  350. package/build/src/protocol/result-reasons.d.ts +129 -0
  351. package/build/src/protocol/result-reasons.js +87 -0
  352. package/build/src/protocol/review.d.ts +14 -11
  353. package/build/src/protocol/review.js +30 -14
  354. package/build/src/protocol/run.d.ts +4 -4
  355. package/build/src/protocol/run.js +4 -1
  356. package/build/src/protocol/verify.d.ts +359 -30
  357. package/build/src/protocol/verify.js +118 -28
  358. package/build/src/region.d.ts +26 -0
  359. package/build/src/region.js +28 -0
  360. package/build/src/runtime/proc/diagnostic.d.ts +11 -0
  361. package/build/src/runtime/proc/diagnostic.js +20 -0
  362. package/build/src/runtime/proc/windows-launch.exe +0 -0
  363. package/build/src/settings.d.ts +126 -32
  364. package/build/src/settings.js +107 -34
  365. package/build/src/settlement/settle.d.ts +29 -12
  366. package/build/src/settlement/settle.js +22 -15
  367. package/build/src/verification/declaration.d.ts +1 -3
  368. package/build/src/verification/declaration.js +2 -5
  369. package/build/src/verification/execution.d.ts +7 -19
  370. package/build/src/verification/execution.js +37 -16
  371. package/build/src/verification/observation.d.ts +13 -13
  372. package/build/src/verification/observation.js +9 -7
  373. package/build/src/world.d.ts +8 -0
  374. package/build/src/world.js +7 -0
  375. package/package.json +6 -5
  376. package/plugins/paseo/plugin/server/keiyaku.ts +13 -46
  377. package/plugins/paseo/plugin/server/message.ts +8 -30
  378. package/plugins/paseo/plugin/server/mirror.ts +16 -20
  379. package/plugins/paseo/plugin/server/provider.ts +1 -1
  380. package/plugins/paseo/plugin/server/sdk.ts +14 -6
  381. package/plugins/pi/README.md +5 -5
  382. package/plugins/pi/akuma-tools.ts +17 -23
  383. package/skills/keiyaku/SKILL.md +24 -24
  384. package/skills/keiyaku-akuma/SKILL.md +44 -168
  385. package/skills/keiyaku-akuma/references/automation.md +61 -231
  386. package/skills/keiyaku-babysit/SKILL.md +47 -58
  387. package/skills/keiyaku-bind/SKILL.md +44 -185
  388. package/skills/keiyaku-debt/SKILL.md +40 -89
  389. package/skills/keiyaku-workflow/SKILL.md +56 -116
  390. package/build/src/cli/actor.d.ts +0 -10
  391. package/build/src/cli/actor.js +0 -24
  392. package/build/src/cli/akuma-caller.d.ts +0 -3
  393. package/build/src/cli/akuma-caller.js +0 -31
  394. package/build/src/cli/delivery-identity.d.ts +0 -3
  395. package/build/src/cli/render/effects.d.ts +0 -26
  396. package/build/src/cli/render/effects.js +0 -41
  397. package/build/src/cli/selectors.d.ts +0 -10
  398. package/build/src/cli/selectors.js +0 -42
  399. package/build/src/markdown/diff.d.ts +0 -1
  400. package/build/src/markdown/diff.js +0 -4
@@ -1,10 +1,175 @@
1
- import { observeActiveContractWorld, observeContractsForAdmissionInObservationAt, observeDeliveryTargetAt, withContractReadObservationAt, } from "../../git/observe.js";
1
+ import { z } from "zod";
2
+ import { contractIdSchema, snapshotIdSchema } from "../../git/identity.js";
3
+ import { gateSchema } from "../result-leaves.js";
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,28 +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
- return await Promise.all(selected.map(async ({ state, bindAt, lastJournalAt, workspace }) => await rowFor({
416
+ const observeTarget = deliveryTargetObserver(observation);
417
+ return await Promise.all(selected.map(async ({ state, bindAt, workspace }) => await rowFor({
149
418
  repository: observation.repository,
150
419
  state,
151
420
  bindAt,
152
- lastJournalAt,
153
- targetObservation: await observeDeliveryTargetAt(observation, state),
421
+ targetObservation: await observeTarget(state),
154
422
  workspace,
155
- handoff: handoffs.get(state.id),
156
423
  after: afterEdges(state, endpoints),
157
424
  dependents: reverseDependents(state.id, dependentStates),
425
+ physicalIssue,
158
426
  })));
159
427
  }
160
- /** Build the Contract board from one immutable git observation. */
161
- export async function readContractBoard(observation, include) {
162
- const observedAt = new Date().toISOString();
428
+ /** Build the complete board by default; a selected detail read retains complete dependency evidence. */
429
+ export async function readContractBoard(observation, include, detail = "board") {
163
430
  const observed = await observeActiveContractWorld(observation);
164
431
  const contracts = new Map(observed.contracts);
165
432
  let endpoints = new Map(observed.eligibility);
@@ -174,14 +441,10 @@ export async function readContractBoard(observation, include) {
174
441
  endpoints = new Map(await afterEndpointMap(observation, endpoints, record.state.terms.after));
175
442
  }
176
443
  }
177
- const selected = selectedContractStates(contracts);
178
- const rows = await hydrateRows(observation, selected, endpoints, selected);
179
- return {
180
- root: observation.repository.primaryWorktree,
181
- state: observed.snapshot,
182
- observedAt,
183
- rows,
184
- };
444
+ const states = selectedContractStates(contracts);
445
+ const selected = detail === "selected" ? states.filter(({ state }) => state.id === include) : states;
446
+ const rows = await hydrateRows(observation, selected, endpoints, states);
447
+ return { rows };
185
448
  }
186
449
  function compareRecentContracts(left, right) {
187
450
  return (right.lastJournalAt.localeCompare(left.lastJournalAt) ||
@@ -198,21 +461,28 @@ function selectedContractStates(contracts) {
198
461
  },
199
462
  ]);
200
463
  }
201
- /** 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
+ */
202
468
  export async function readContractCatalogue(observation, limit) {
203
469
  const observedAt = new Date().toISOString();
204
470
  const observed = await observeActiveContractWorld(observation);
205
- const active = selectedContractStates(observed.contracts).filter(({ state }) => state.terminal === null);
206
- const selected = projectBoundedList([...active].sort(compareRecentContracts), limit);
207
- const afterIds = selected.rows.flatMap(({ state }) => state.terms.after);
208
- const endpoints = await afterEndpointMap(observation, new Map(observed.eligibility), afterIds);
209
- 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
+ }));
210
482
  return {
211
- root: observation.repository.primaryWorktree,
212
- state: observed.snapshot,
213
483
  observedAt,
214
- rows,
215
- hasMore: selected.hasMore,
484
+ ...(rows.length === 0 ? {} : { rows }),
485
+ ...(selected.hasMore ? { more: true } : {}),
216
486
  };
217
487
  }
218
488
  /**
@@ -236,11 +506,30 @@ export async function readContractObservation(observation, id) {
236
506
  if (state === null)
237
507
  return { kind: "missing", id };
238
508
  const endpoints = await afterEndpointMap(observation, new Map([[id, state]]), state.terms.after);
239
- const rows = await hydrateRows(observation, selectedContractStates(observed.journals), endpoints);
240
- return {
241
- kind: "present",
242
- row: rows[0],
243
- };
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
+ }
244
533
  }
245
534
  /** Observe one Contract and its target from one fresh ref epoch. */
246
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<{