cloving 0.3.20 → 1.1.0

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 (515) hide show
  1. package/{LICENSE.md → LICENSE} +1 -1
  2. package/README.md +606 -182
  3. package/dist/src/authority/budgets.d.ts +12 -0
  4. package/dist/src/authority/budgets.js +42 -0
  5. package/dist/src/authority/commands.d.ts +7 -0
  6. package/dist/src/authority/commands.js +271 -0
  7. package/dist/src/authority/details.d.ts +28 -0
  8. package/dist/src/authority/details.js +33 -0
  9. package/dist/src/authority/dispatch-decision.d.ts +40 -0
  10. package/dist/src/authority/dispatch-decision.js +47 -0
  11. package/dist/src/authority/effect-requests.d.ts +2 -0
  12. package/dist/src/authority/effect-requests.js +139 -0
  13. package/dist/src/authority/effect-results.d.ts +4 -0
  14. package/dist/src/authority/effect-results.js +236 -0
  15. package/dist/src/authority/events.d.ts +2 -0
  16. package/dist/src/authority/events.js +45 -0
  17. package/dist/src/authority/gate-reduction.d.ts +8 -0
  18. package/dist/src/authority/gate-reduction.js +109 -0
  19. package/dist/src/authority/gates.d.ts +48 -0
  20. package/dist/src/authority/gates.js +77 -0
  21. package/dist/src/authority/history-state.d.ts +15 -0
  22. package/dist/src/authority/history-state.js +61 -0
  23. package/dist/src/authority/history.d.ts +13 -0
  24. package/dist/src/authority/history.js +37 -0
  25. package/dist/src/authority/instants.d.ts +3 -0
  26. package/dist/src/authority/instants.js +38 -0
  27. package/dist/src/authority/leases.d.ts +15 -0
  28. package/dist/src/authority/leases.js +113 -0
  29. package/dist/src/authority/operations.d.ts +101 -0
  30. package/dist/src/authority/operations.js +75 -0
  31. package/dist/src/authority/reconciliation.d.ts +29 -0
  32. package/dist/src/authority/reconciliation.js +156 -0
  33. package/dist/src/authority/reducer.d.ts +41 -0
  34. package/dist/src/authority/reducer.js +139 -0
  35. package/dist/src/authority/reduction-state.d.ts +36 -0
  36. package/dist/src/authority/reduction-state.js +68 -0
  37. package/dist/src/authority/reduction.d.ts +6 -0
  38. package/dist/src/authority/reduction.js +160 -0
  39. package/dist/src/authority/status-closure.d.ts +4 -0
  40. package/dist/src/authority/status-closure.js +57 -0
  41. package/dist/src/authority/status-effects.d.ts +17 -0
  42. package/dist/src/authority/status-effects.js +43 -0
  43. package/dist/src/authority/status-input.d.ts +45 -0
  44. package/dist/src/authority/status-input.js +9 -0
  45. package/dist/src/authority/status.d.ts +32 -0
  46. package/dist/src/authority/status.js +256 -0
  47. package/dist/src/authority/stop-sequence.d.ts +37 -0
  48. package/dist/src/authority/stop-sequence.js +91 -0
  49. package/dist/src/authority/transitions.d.ts +63 -0
  50. package/dist/src/authority/transitions.js +124 -0
  51. package/dist/src/broker/actor/adapter-calls.d.ts +13 -0
  52. package/dist/src/broker/actor/adapter-calls.js +34 -0
  53. package/dist/src/broker/actor/adapter-outcomes.d.ts +28 -0
  54. package/dist/src/broker/actor/adapter-outcomes.js +80 -0
  55. package/dist/src/broker/actor/authority-actor.d.ts +25 -0
  56. package/dist/src/broker/actor/authority-actor.js +169 -0
  57. package/dist/src/broker/actor/authority-changes.d.ts +31 -0
  58. package/dist/src/broker/actor/authority-changes.js +46 -0
  59. package/dist/src/broker/actor/authority-connection.d.ts +15 -0
  60. package/dist/src/broker/actor/authority-connection.js +44 -0
  61. package/dist/src/broker/actor/authority-conversion.d.ts +10 -0
  62. package/dist/src/broker/actor/authority-conversion.js +72 -0
  63. package/dist/src/broker/actor/authority-delivery.d.ts +13 -0
  64. package/dist/src/broker/actor/authority-delivery.js +162 -0
  65. package/dist/src/broker/actor/authority-logger.d.ts +2 -0
  66. package/dist/src/broker/actor/authority-logger.js +19 -0
  67. package/dist/src/broker/actor/authority-policy.d.ts +9 -0
  68. package/dist/src/broker/actor/authority-policy.js +11 -0
  69. package/dist/src/broker/actor/authority-queries.d.ts +45 -0
  70. package/dist/src/broker/actor/authority-queries.js +85 -0
  71. package/dist/src/broker/actor/authority-receipts.d.ts +28 -0
  72. package/dist/src/broker/actor/authority-receipts.js +84 -0
  73. package/dist/src/broker/actor/authority-release.d.ts +13 -0
  74. package/dist/src/broker/actor/authority-release.js +69 -0
  75. package/dist/src/broker/actor/authority-runtime.d.ts +60 -0
  76. package/dist/src/broker/actor/authority-runtime.js +204 -0
  77. package/dist/src/broker/actor/authority-session.d.ts +67 -0
  78. package/dist/src/broker/actor/authority-session.js +251 -0
  79. package/dist/src/broker/actor/authority-settings.d.ts +33 -0
  80. package/dist/src/broker/actor/authority-settings.js +63 -0
  81. package/dist/src/broker/actor/authority-upgrades.d.ts +16 -0
  82. package/dist/src/broker/actor/authority-upgrades.js +12 -0
  83. package/dist/src/broker/actor/authority-watchdog.d.ts +14 -0
  84. package/dist/src/broker/actor/authority-watchdog.js +41 -0
  85. package/dist/src/broker/actor/authority.d.ts +14 -0
  86. package/dist/src/broker/actor/authority.js +115 -0
  87. package/dist/src/broker/actor/delivery-intents.d.ts +68 -0
  88. package/dist/src/broker/actor/delivery-intents.js +77 -0
  89. package/dist/src/broker/actor/delivery-plan.d.ts +2 -0
  90. package/dist/src/broker/actor/delivery-plan.js +109 -0
  91. package/dist/src/broker/actor/delivery-results.d.ts +11 -0
  92. package/dist/src/broker/actor/delivery-results.js +63 -0
  93. package/dist/src/broker/actor/effect-delivery.d.ts +19 -0
  94. package/dist/src/broker/actor/effect-delivery.js +118 -0
  95. package/dist/src/broker/actor/effect-plan.d.ts +41 -0
  96. package/dist/src/broker/actor/effect-plan.js +173 -0
  97. package/dist/src/broker/actor/effect-queries.d.ts +27 -0
  98. package/dist/src/broker/actor/effect-queries.js +80 -0
  99. package/dist/src/broker/actor/effect-turn.d.ts +25 -0
  100. package/dist/src/broker/actor/effect-turn.js +84 -0
  101. package/dist/src/broker/actor/pin-check.d.ts +6 -0
  102. package/dist/src/broker/actor/pin-check.js +12 -0
  103. package/dist/src/broker/actor/runtime-parts.d.ts +23 -0
  104. package/dist/src/broker/actor/runtime-parts.js +34 -0
  105. package/dist/src/broker/actor/stop-plan.d.ts +20 -0
  106. package/dist/src/broker/actor/stop-plan.js +46 -0
  107. package/dist/src/broker/actor/stop-turn.d.ts +17 -0
  108. package/dist/src/broker/actor/stop-turn.js +42 -0
  109. package/dist/src/broker/actor/turn-draft.d.ts +31 -0
  110. package/dist/src/broker/actor/turn-draft.js +138 -0
  111. package/dist/src/broker/actor/turn-plan.d.ts +17 -0
  112. package/dist/src/broker/actor/turn-plan.js +136 -0
  113. package/dist/src/broker/actor/turn-refusals.d.ts +8 -0
  114. package/dist/src/broker/actor/turn-refusals.js +35 -0
  115. package/dist/src/broker/actor/turn-staging.d.ts +78 -0
  116. package/dist/src/broker/actor/turn-staging.js +34 -0
  117. package/dist/src/broker/actor/turn-state.d.ts +34 -0
  118. package/dist/src/broker/actor/turn-state.js +208 -0
  119. package/dist/src/broker/authority-admission.d.ts +21 -0
  120. package/dist/src/broker/authority-admission.js +70 -0
  121. package/dist/src/broker/authority-restore.d.ts +30 -0
  122. package/dist/src/broker/authority-restore.js +165 -0
  123. package/dist/src/broker/decision-restore.d.ts +16 -0
  124. package/dist/src/broker/decision-restore.js +158 -0
  125. package/dist/src/broker/decision-upgrade.d.ts +3 -0
  126. package/dist/src/broker/decision-upgrade.js +12 -0
  127. package/dist/src/broker/effect-restore.d.ts +20 -0
  128. package/dist/src/broker/effect-restore.js +111 -0
  129. package/dist/src/broker/effect-upgrade.d.ts +3 -0
  130. package/dist/src/broker/effect-upgrade.js +9 -0
  131. package/dist/src/broker/operation-digest.d.ts +1 -0
  132. package/dist/src/broker/operation-digest.js +4 -0
  133. package/dist/src/broker/socket-address.d.ts +9 -0
  134. package/dist/src/broker/socket-address.js +14 -0
  135. package/dist/src/broker/workflow-pin.d.ts +2 -0
  136. package/dist/src/broker/workflow-pin.js +5 -0
  137. package/dist/src/chats/analysis-batches.d.ts +24 -0
  138. package/dist/src/chats/analysis-batches.js +83 -0
  139. package/dist/src/chats/analysis-contract.d.ts +80 -0
  140. package/dist/src/chats/analysis-contract.js +16 -0
  141. package/dist/src/chats/analysis-data.d.ts +3 -0
  142. package/dist/src/chats/analysis-data.js +85 -0
  143. package/dist/src/chats/analysis-input.d.ts +12 -0
  144. package/dist/src/chats/analysis-input.js +83 -0
  145. package/dist/src/chats/analysis-links.d.ts +2 -0
  146. package/dist/src/chats/analysis-links.js +25 -0
  147. package/dist/src/chats/analysis-prompt.d.ts +10 -0
  148. package/dist/src/chats/analysis-prompt.js +16 -0
  149. package/dist/src/chats/analysis-proposal.d.ts +2 -0
  150. package/dist/src/chats/analysis-proposal.js +32 -0
  151. package/dist/src/chats/analysis-provenance.d.ts +4 -0
  152. package/dist/src/chats/analysis-provenance.js +99 -0
  153. package/dist/src/chats/analysis-shape.d.ts +3 -0
  154. package/dist/src/chats/analysis-shape.js +228 -0
  155. package/dist/src/chats/analysis.d.ts +3 -0
  156. package/dist/src/chats/analysis.js +42 -0
  157. package/dist/src/chats/corpus-input.d.ts +5 -0
  158. package/dist/src/chats/corpus-input.js +288 -0
  159. package/dist/src/chats/destination.d.ts +4 -0
  160. package/dist/src/chats/destination.js +96 -0
  161. package/dist/src/chats/import.d.ts +15 -0
  162. package/dist/src/chats/import.js +243 -0
  163. package/dist/src/chats/input-file.d.ts +3 -0
  164. package/dist/src/chats/input-file.js +32 -0
  165. package/dist/src/chats/normalize.d.ts +29 -0
  166. package/dist/src/chats/normalize.js +155 -0
  167. package/dist/src/chats/previous-import.d.ts +5 -0
  168. package/dist/src/chats/previous-import.js +34 -0
  169. package/dist/src/chats/reader.d.ts +21 -0
  170. package/dist/src/chats/reader.js +118 -0
  171. package/dist/src/chats/redact-import.d.ts +14 -0
  172. package/dist/src/chats/redact-import.js +141 -0
  173. package/dist/src/chats/redaction.d.ts +41 -0
  174. package/dist/src/chats/redaction.js +161 -0
  175. package/dist/src/chats/revision-input.d.ts +3 -0
  176. package/dist/src/chats/revision-input.js +180 -0
  177. package/dist/src/chats/revision.d.ts +48 -0
  178. package/dist/src/chats/revision.js +94 -0
  179. package/dist/src/chats/selection.d.ts +25 -0
  180. package/dist/src/chats/selection.js +109 -0
  181. package/dist/src/chats/source.d.ts +23 -0
  182. package/dist/src/chats/source.js +135 -0
  183. package/dist/src/chats/structure.d.ts +57 -0
  184. package/dist/src/chats/structure.js +216 -0
  185. package/dist/src/cli/arguments.d.ts +31 -0
  186. package/dist/src/cli/arguments.js +235 -0
  187. package/dist/src/cli/client.d.ts +16 -0
  188. package/dist/src/cli/client.js +159 -0
  189. package/dist/src/cli/commands.d.ts +17 -0
  190. package/dist/src/cli/commands.js +271 -0
  191. package/dist/src/cli/main.d.ts +2 -0
  192. package/dist/src/cli/main.js +127 -0
  193. package/dist/src/cli/render.d.ts +10 -0
  194. package/dist/src/cli/render.js +254 -0
  195. package/dist/src/cli/runtime-arguments.d.ts +73 -0
  196. package/dist/src/cli/runtime-arguments.js +248 -0
  197. package/dist/src/cli/runtime-directory.d.ts +4 -0
  198. package/dist/src/cli/runtime-directory.js +25 -0
  199. package/dist/src/cli/toolchain.d.ts +3 -0
  200. package/dist/src/cli/toolchain.js +74 -0
  201. package/dist/src/cli/usage-render.d.ts +3 -0
  202. package/dist/src/cli/usage-render.js +28 -0
  203. package/dist/src/cli/usage.d.ts +5 -0
  204. package/dist/src/cli/usage.js +156 -0
  205. package/dist/src/cli/validate.d.ts +38 -0
  206. package/dist/src/cli/validate.js +116 -0
  207. package/dist/src/cli/watch-actions.d.ts +10 -0
  208. package/dist/src/cli/watch-actions.js +58 -0
  209. package/dist/src/cli/watch-board-view.d.ts +54 -0
  210. package/dist/src/cli/watch-board-view.js +201 -0
  211. package/dist/src/cli/watch-board.d.ts +15 -0
  212. package/dist/src/cli/watch-board.js +179 -0
  213. package/dist/src/cli/watch-card-client.d.ts +1 -0
  214. package/dist/src/cli/watch-card-client.js +44 -0
  215. package/dist/src/cli/watch-card-forms.d.ts +2 -0
  216. package/dist/src/cli/watch-card-forms.js +33 -0
  217. package/dist/src/cli/watch-card-reply.d.ts +5 -0
  218. package/dist/src/cli/watch-card-reply.js +34 -0
  219. package/dist/src/cli/watch-card-view.d.ts +40 -0
  220. package/dist/src/cli/watch-card-view.js +86 -0
  221. package/dist/src/cli/watch-client.d.ts +1 -0
  222. package/dist/src/cli/watch-client.js +118 -0
  223. package/dist/src/cli/watch-element.d.ts +11 -0
  224. package/dist/src/cli/watch-element.js +6 -0
  225. package/dist/src/cli/watch-model.d.ts +29 -0
  226. package/dist/src/cli/watch-model.js +278 -0
  227. package/dist/src/cli/watch-navigation.d.ts +9 -0
  228. package/dist/src/cli/watch-navigation.js +40 -0
  229. package/dist/src/cli/watch-page.d.ts +1 -0
  230. package/dist/src/cli/watch-page.js +258 -0
  231. package/dist/src/cli/watch-paths.d.ts +2 -0
  232. package/dist/src/cli/watch-paths.js +52 -0
  233. package/dist/src/cli/watch-phases.d.ts +7 -0
  234. package/dist/src/cli/watch-phases.js +148 -0
  235. package/dist/src/cli/watch-pr-board.d.ts +3 -0
  236. package/dist/src/cli/watch-pr-board.js +26 -0
  237. package/dist/src/cli/watch-pr-command.d.ts +15 -0
  238. package/dist/src/cli/watch-pr-command.js +37 -0
  239. package/dist/src/cli/watch-pr-identity.d.ts +20 -0
  240. package/dist/src/cli/watch-pr-identity.js +62 -0
  241. package/dist/src/cli/watch-pr-observer.d.ts +19 -0
  242. package/dist/src/cli/watch-pr-observer.js +108 -0
  243. package/dist/src/cli/watch-pr-settings.d.ts +8 -0
  244. package/dist/src/cli/watch-pr-settings.js +47 -0
  245. package/dist/src/cli/watch-reads.d.ts +28 -0
  246. package/dist/src/cli/watch-reads.js +248 -0
  247. package/dist/src/cli/watch-render.d.ts +153 -0
  248. package/dist/src/cli/watch-render.js +102 -0
  249. package/dist/src/cli/watch-run-input.d.ts +14 -0
  250. package/dist/src/cli/watch-run-input.js +49 -0
  251. package/dist/src/cli/watch-server.d.ts +13 -0
  252. package/dist/src/cli/watch-server.js +214 -0
  253. package/dist/src/cli/watch-start-view.d.ts +18 -0
  254. package/dist/src/cli/watch-start-view.js +77 -0
  255. package/dist/src/cli/watch-stream.d.ts +11 -0
  256. package/dist/src/cli/watch-stream.js +128 -0
  257. package/dist/src/cli/watch-turn.d.ts +30 -0
  258. package/dist/src/cli/watch-turn.js +135 -0
  259. package/dist/src/cli/watch-usage.d.ts +6 -0
  260. package/dist/src/cli/watch-usage.js +65 -0
  261. package/dist/src/cli/watch-view.d.ts +54 -0
  262. package/dist/src/cli/watch-view.js +267 -0
  263. package/dist/src/cli.d.ts +2 -0
  264. package/dist/src/cli.js +104 -0
  265. package/dist/src/daemon/analysis-launch.d.ts +5 -0
  266. package/dist/src/daemon/analysis-launch.js +81 -0
  267. package/dist/src/daemon/analysis-token.d.ts +6 -0
  268. package/dist/src/daemon/analysis-token.js +88 -0
  269. package/dist/src/daemon/analysis-worker.d.ts +22 -0
  270. package/dist/src/daemon/analysis-worker.js +219 -0
  271. package/dist/src/daemon/chats-files.d.ts +15 -0
  272. package/dist/src/daemon/chats-files.js +113 -0
  273. package/dist/src/daemon/chats-worker.d.ts +12 -0
  274. package/dist/src/daemon/chats-worker.js +200 -0
  275. package/dist/src/daemon/claude-turn.d.ts +38 -0
  276. package/dist/src/daemon/claude-turn.js +216 -0
  277. package/dist/src/daemon/claude-worker.d.ts +29 -0
  278. package/dist/src/daemon/claude-worker.js +276 -0
  279. package/dist/src/daemon/codex-stream.d.ts +4 -0
  280. package/dist/src/daemon/codex-stream.js +129 -0
  281. package/dist/src/daemon/daemon.d.ts +49 -0
  282. package/dist/src/daemon/daemon.js +195 -0
  283. package/dist/src/daemon/delivery-router.d.ts +10 -0
  284. package/dist/src/daemon/delivery-router.js +34 -0
  285. package/dist/src/daemon/github-calls.d.ts +29 -0
  286. package/dist/src/daemon/github-calls.js +127 -0
  287. package/dist/src/daemon/github-issue-methods.d.ts +3 -0
  288. package/dist/src/daemon/github-issue-methods.js +99 -0
  289. package/dist/src/daemon/github-issue-privacy.d.ts +6 -0
  290. package/dist/src/daemon/github-issue-privacy.js +131 -0
  291. package/dist/src/daemon/github-merge.d.ts +18 -0
  292. package/dist/src/daemon/github-merge.js +259 -0
  293. package/dist/src/daemon/github-methods.d.ts +5 -0
  294. package/dist/src/daemon/github-methods.js +202 -0
  295. package/dist/src/daemon/github-operation.d.ts +38 -0
  296. package/dist/src/daemon/github-operation.js +57 -0
  297. package/dist/src/daemon/github-ticket-status.d.ts +3 -0
  298. package/dist/src/daemon/github-ticket-status.js +268 -0
  299. package/dist/src/daemon/github-worker.d.ts +17 -0
  300. package/dist/src/daemon/github-worker.js +281 -0
  301. package/dist/src/daemon/host-environment.d.ts +8 -0
  302. package/dist/src/daemon/host-environment.js +14 -0
  303. package/dist/src/daemon/issue-queue.d.ts +10 -0
  304. package/dist/src/daemon/issue-queue.js +254 -0
  305. package/dist/src/daemon/notify-message.d.ts +14 -0
  306. package/dist/src/daemon/notify-message.js +48 -0
  307. package/dist/src/daemon/notify.d.ts +12 -0
  308. package/dist/src/daemon/notify.js +161 -0
  309. package/dist/src/daemon/operation-journal.d.ts +43 -0
  310. package/dist/src/daemon/operation-journal.js +55 -0
  311. package/dist/src/daemon/retrying-turn.d.ts +9 -0
  312. package/dist/src/daemon/retrying-turn.js +185 -0
  313. package/dist/src/daemon/ticket-registration.d.ts +33 -0
  314. package/dist/src/daemon/ticket-registration.js +177 -0
  315. package/dist/src/daemon/ticket-source.d.ts +17 -0
  316. package/dist/src/daemon/ticket-source.js +36 -0
  317. package/dist/src/daemon/work-tree.d.ts +26 -0
  318. package/dist/src/daemon/work-tree.js +206 -0
  319. package/dist/src/effect-authorization.d.ts +21 -0
  320. package/dist/src/effect-authorization.js +14 -0
  321. package/dist/src/execution-pin.d.ts +4 -0
  322. package/dist/src/execution-pin.js +68 -0
  323. package/dist/src/host/start-delivery.d.ts +41 -0
  324. package/dist/src/host/start-delivery.js +68 -0
  325. package/dist/src/host/step-bridge-host.d.ts +79 -0
  326. package/dist/src/host/step-bridge-host.js +205 -0
  327. package/dist/src/host/step-claims.d.ts +31 -0
  328. package/dist/src/host/step-claims.js +85 -0
  329. package/dist/src/host/world-host.d.ts +21 -0
  330. package/dist/src/host/world-host.js +51 -0
  331. package/dist/src/host/world-reconciliation.d.ts +39 -0
  332. package/dist/src/host/world-reconciliation.js +81 -0
  333. package/dist/src/host/world-runs.d.ts +14 -0
  334. package/dist/src/host/world-runs.js +69 -0
  335. package/dist/src/operation-identity.d.ts +7 -0
  336. package/dist/src/operation-identity.js +59 -0
  337. package/dist/src/protocol.d.ts +35 -0
  338. package/dist/src/protocol.js +64 -0
  339. package/dist/src/resource-files.d.ts +1 -0
  340. package/dist/src/resource-files.js +29 -0
  341. package/dist/src/service/changes.d.ts +11 -0
  342. package/dist/src/service/changes.js +32 -0
  343. package/dist/src/service/decision-handler.d.ts +9 -0
  344. package/dist/src/service/decision-handler.js +233 -0
  345. package/dist/src/service/event-handler.d.ts +10 -0
  346. package/dist/src/service/event-handler.js +70 -0
  347. package/dist/src/service/expiry.d.ts +13 -0
  348. package/dist/src/service/expiry.js +53 -0
  349. package/dist/src/service/gateway.d.ts +21 -0
  350. package/dist/src/service/gateway.js +120 -0
  351. package/dist/src/service/registry.d.ts +40 -0
  352. package/dist/src/service/registry.js +13 -0
  353. package/dist/src/service/replies.d.ts +26 -0
  354. package/dist/src/service/replies.js +56 -0
  355. package/dist/src/service/run-handlers.d.ts +4 -0
  356. package/dist/src/service/run-handlers.js +263 -0
  357. package/dist/src/service/service.d.ts +58 -0
  358. package/dist/src/service/service.js +212 -0
  359. package/dist/src/service/submission-handler.d.ts +4 -0
  360. package/dist/src/service/submission-handler.js +206 -0
  361. package/dist/src/service/transport.d.ts +16 -0
  362. package/dist/src/service/transport.js +141 -0
  363. package/dist/src/service/worker-port.d.ts +85 -0
  364. package/dist/src/service/worker-port.js +126 -0
  365. package/dist/src/service/worker-totals.d.ts +3 -0
  366. package/dist/src/service/worker-totals.js +28 -0
  367. package/dist/src/step-bridge.d.ts +57 -0
  368. package/dist/src/step-bridge.js +4 -0
  369. package/dist/src/steps/decision-gate.d.ts +2 -0
  370. package/dist/src/steps/decision-gate.js +8 -0
  371. package/dist/src/steps/load-cycle.d.ts +10 -0
  372. package/dist/src/steps/load-cycle.js +11 -0
  373. package/dist/src/steps/protected-effect.d.ts +2 -0
  374. package/dist/src/steps/protected-effect.js +8 -0
  375. package/dist/src/storage/decision-rows.d.ts +54 -0
  376. package/dist/src/storage/decision-rows.js +72 -0
  377. package/dist/src/storage/decision-snapshots.d.ts +17 -0
  378. package/dist/src/storage/decision-snapshots.js +25 -0
  379. package/dist/src/storage/domain-changes.d.ts +48 -0
  380. package/dist/src/storage/domain-changes.js +213 -0
  381. package/dist/src/storage/domain-rows.d.ts +85 -0
  382. package/dist/src/storage/domain-rows.js +129 -0
  383. package/dist/src/storage/domain-schema.d.ts +32 -0
  384. package/dist/src/storage/domain-schema.js +193 -0
  385. package/dist/src/storage/effect-changes.d.ts +5 -0
  386. package/dist/src/storage/effect-changes.js +105 -0
  387. package/dist/src/storage/effect-rows.d.ts +67 -0
  388. package/dist/src/storage/effect-rows.js +74 -0
  389. package/dist/src/storage/effect-schema.d.ts +1 -0
  390. package/dist/src/storage/effect-schema.js +59 -0
  391. package/dist/src/storage/statements.d.ts +9 -0
  392. package/dist/src/storage/statements.js +8 -0
  393. package/dist/src/submission.d.ts +42 -0
  394. package/dist/src/submission.js +71 -0
  395. package/dist/src/ticket-status.d.ts +8 -0
  396. package/dist/src/ticket-status.js +45 -0
  397. package/dist/src/token-prices.d.ts +19 -0
  398. package/dist/src/token-prices.js +76 -0
  399. package/dist/src/turn-profile.d.ts +13 -0
  400. package/dist/src/turn-profile.js +100 -0
  401. package/dist/src/worker-usage.d.ts +22 -0
  402. package/dist/src/worker-usage.js +44 -0
  403. package/dist/src/workflow-admission.d.ts +45 -0
  404. package/dist/src/workflow-admission.js +151 -0
  405. package/dist/src/workflow-candidate.d.ts +29 -0
  406. package/dist/src/workflow-candidate.js +59 -0
  407. package/dist/src/workflow-contracts.d.ts +29 -0
  408. package/dist/src/workflow-contracts.js +110 -0
  409. package/dist/src/workflow-declaration.d.ts +11 -0
  410. package/dist/src/workflow-declaration.js +59 -0
  411. package/dist/src/workflow-resources.d.ts +8 -0
  412. package/dist/src/workflow-resources.js +14 -0
  413. package/dist/src/workflows.d.ts +6 -0
  414. package/dist/src/workflows.js +4 -0
  415. package/dist/tools/compile-workflows.d.ts +1 -0
  416. package/dist/tools/compile-workflows.js +33 -0
  417. package/dist/tools/self-host-processes.d.ts +10 -0
  418. package/dist/tools/self-host-processes.js +156 -0
  419. package/dist/tools/self-host-workflows.d.ts +15 -0
  420. package/dist/tools/self-host-workflows.js +78 -0
  421. package/dist/tools/self-host.d.ts +1 -0
  422. package/dist/tools/self-host.js +261 -0
  423. package/dist/tools/self-update-host.d.ts +13 -0
  424. package/dist/tools/self-update-host.js +88 -0
  425. package/dist/tools/self-update.d.ts +11 -0
  426. package/dist/tools/self-update.js +177 -0
  427. package/dist/tools/workflow-manifest.d.ts +3 -0
  428. package/dist/tools/workflow-manifest.js +34 -0
  429. package/dist/workflows/analyze-chats.d.ts +10 -0
  430. package/dist/workflows/analyze-chats.declaration.json +9 -0
  431. package/dist/workflows/analyze-chats.js +73 -0
  432. package/dist/workflows/develop-prd.d.ts +7 -0
  433. package/dist/workflows/develop-prd.js +97 -0
  434. package/dist/workflows/develop-ticket.d.ts +9 -0
  435. package/dist/workflows/develop-ticket.js +202 -0
  436. package/dist/workflows/issue-labels.d.ts +16 -0
  437. package/dist/workflows/issue-labels.js +70 -0
  438. package/dist/workflows/ticket-prompts.d.ts +35 -0
  439. package/dist/workflows/ticket-prompts.js +133 -0
  440. package/package.json +84 -75
  441. package/dist/abstract_gpt/index.js +0 -55
  442. package/dist/cloving_gpt/adapters/Adapter.js +0 -2
  443. package/dist/cloving_gpt/adapters/azureopenai.js +0 -69
  444. package/dist/cloving_gpt/adapters/claude.js +0 -128
  445. package/dist/cloving_gpt/adapters/gemini.js +0 -135
  446. package/dist/cloving_gpt/adapters/gpt4all.js +0 -29
  447. package/dist/cloving_gpt/adapters/index.js +0 -2
  448. package/dist/cloving_gpt/adapters/mistral.js +0 -128
  449. package/dist/cloving_gpt/adapters/ollama.js +0 -128
  450. package/dist/cloving_gpt/adapters/openai.js +0 -100
  451. package/dist/cloving_gpt/index.js +0 -192
  452. package/dist/commands/analyze.js +0 -47
  453. package/dist/commands/chat.js +0 -14
  454. package/dist/commands/check.js +0 -7
  455. package/dist/commands/commit.js +0 -44
  456. package/dist/commands/config.js +0 -167
  457. package/dist/commands/describe.js +0 -235
  458. package/dist/commands/generate/code.js +0 -21
  459. package/dist/commands/generate/commit.js +0 -11
  460. package/dist/commands/generate/context.js +0 -82
  461. package/dist/commands/generate/docs.js +0 -11
  462. package/dist/commands/generate/documentation.js +0 -11
  463. package/dist/commands/generate/fizzbuzz.js +0 -35
  464. package/dist/commands/generate/init.js +0 -15
  465. package/dist/commands/generate/review.js +0 -11
  466. package/dist/commands/generate/sh.js +0 -95
  467. package/dist/commands/generate/shell.js +0 -11
  468. package/dist/commands/generate/unit_tests.js +0 -11
  469. package/dist/commands/init.js +0 -13
  470. package/dist/commands/models.js +0 -22
  471. package/dist/commands/project/build.js +0 -88
  472. package/dist/commands/project/complete.js +0 -12
  473. package/dist/commands/project/init.js +0 -82
  474. package/dist/commands/project/plan.js +0 -108
  475. package/dist/commands/proxy.js +0 -11
  476. package/dist/commands/review.js +0 -50
  477. package/dist/commands/tokens.js +0 -75
  478. package/dist/commands/unit_tests.js +0 -150
  479. package/dist/commands/update.js +0 -7
  480. package/dist/file2.js +0 -4
  481. package/dist/index.js +0 -136
  482. package/dist/managers/BlockManager.js +0 -120
  483. package/dist/managers/ChatManager.js +0 -653
  484. package/dist/managers/ChunkManager.js +0 -32
  485. package/dist/managers/CodeManager.js +0 -185
  486. package/dist/managers/CommitManager.js +0 -78
  487. package/dist/managers/DocsManager.js +0 -88
  488. package/dist/managers/DocumentationManager.js +0 -114
  489. package/dist/managers/InitManager.js +0 -230
  490. package/dist/managers/ProxyManager.js +0 -210
  491. package/dist/managers/ReviewManager.js +0 -131
  492. package/dist/managers/ShellManager.js +0 -163
  493. package/dist/managers/StreamManager.js +0 -308
  494. package/dist/managers/UnitTestManager.js +0 -243
  495. package/dist/managers/src/managers/ProxyManager.js +0 -1
  496. package/dist/newfile.js +0 -2
  497. package/dist/package.json +0 -86
  498. package/dist/utils/command_utils.js +0 -384
  499. package/dist/utils/config_utils.js +0 -249
  500. package/dist/utils/gitUtils.js +0 -42
  501. package/dist/utils/git_utils.js +0 -217
  502. package/dist/utils/modelUtils.js +0 -7
  503. package/dist/utils/model_utils.js +0 -7
  504. package/dist/utils/prompt_utils.js +0 -333
  505. package/dist/utils/prompts/CODEGEN_COULDNT_APPLY.md +0 -5
  506. package/dist/utils/prompts/CODEGEN_EXAMPLES.md +0 -82
  507. package/dist/utils/prompts/CODEGEN_INSTRUCTIONS.md +0 -43
  508. package/dist/utils/prompts/DOCS_INSTRUCTIONS.md +0 -9
  509. package/dist/utils/prompts/INIT_INSTRUCTIONS.md +0 -132
  510. package/dist/utils/prompts/REVIEW_INSTRUCTIONS.md +0 -49
  511. package/dist/utils/prompts/SHELL_INSTRUCTIONS.md +0 -15
  512. package/dist/utils/prompts/SPECIAL_FILES.md +0 -66
  513. package/dist/utils/prompts/index.js +0 -27
  514. package/dist/utils/string_utils.js +0 -505
  515. package/dist/utils/types.js +0 -2
@@ -0,0 +1,135 @@
1
+ import { priceText, usageText } from "./usage-render.js";
2
+ import { component, element } from "./watch-element.js";
3
+ import { clockTime, counted, groupActivity, turnTime, } from "./watch-render.js";
4
+ export function Item(props) {
5
+ const { kind, text } = props.item;
6
+ const title = kind === "tool" ? text : undefined;
7
+ return element("div", { class: `item ${kind}`, title, children: text });
8
+ }
9
+ export function Group(props) {
10
+ const { items, open } = props;
11
+ const lines = items.map((item) => component(Item, { item }));
12
+ if (items.length < 2)
13
+ return lines;
14
+ const errors = items.filter((item) => item.kind === "error").length;
15
+ const failed = element("span", {
16
+ class: "bad",
17
+ children: counted(errors, "error"),
18
+ });
19
+ const summary = [
20
+ counted(items.length - errors, "tool call"),
21
+ errors === 0 ? null : [" · ", failed],
22
+ element("span", { class: "last", children: items.at(-1)?.text }),
23
+ ];
24
+ return element("details", {
25
+ class: "tools",
26
+ open,
27
+ children: [element("summary", { children: summary }), lines],
28
+ });
29
+ }
30
+ export function Turn(props) {
31
+ const { turn, now } = props;
32
+ const groups = groupActivity(turn.activity);
33
+ const working = turn.outcome === "in work";
34
+ const cost = priceText(turn.costUsd, turn.estimatedCostUsd);
35
+ const heading = ["Claude turn", turn.outcome, turnTime(turn, now), cost];
36
+ const place = `Branch ${turn.branch} · work tree ${turn.worktree}`;
37
+ const activity = groups.map((items, index) => component(Group, { items, open: working && index === groups.length - 1 }));
38
+ return element("section", {
39
+ class: "turn code-window",
40
+ children: [
41
+ element("h3", {
42
+ class: "code-head",
43
+ children: heading.filter((part) => part !== "").join(" · "),
44
+ }),
45
+ element("p", { class: "meta", children: place }),
46
+ element("p", {
47
+ class: "turn-usage",
48
+ children: usageText(turn.usage),
49
+ }),
50
+ element("div", { class: "activity", children: activity }),
51
+ ],
52
+ });
53
+ }
54
+ export function Work(props) {
55
+ const { turn } = props;
56
+ const loose = turn.uncommitted.length;
57
+ const block = (lines) => element("pre", { children: lines.join("\n") });
58
+ const text = (tone, children) => element("p", { class: tone, children });
59
+ const branch = [
60
+ "Branch ",
61
+ element("code", { children: turn.branch }),
62
+ ` · ${counted(turn.commits.length, "commit")}`,
63
+ ];
64
+ const commits = turn.commits.length === 0
65
+ ? text("bad", "The worker made no commit.")
66
+ : [text("fact", branch), block(turn.commits), block(turn.files)];
67
+ const left = `${counted(loose, "file")} ${loose === 1 ? "is" : "are"} not committed:`;
68
+ const state = loose === 0
69
+ ? text("good", "All the work is committed.")
70
+ : [text("bad", left), block(turn.uncommitted)];
71
+ const report = element("details", {
72
+ open: true,
73
+ children: [
74
+ element("summary", { children: "Report of the worker" }),
75
+ element("div", { class: "report", children: turn.summary }),
76
+ ],
77
+ });
78
+ return [commits, state, report];
79
+ }
80
+ export function Command(props) {
81
+ const { label, command, copying } = props;
82
+ const onClick = () => {
83
+ copying.onCopy(command);
84
+ };
85
+ const shown = copying.command === command ? copying.label : (props.copyLabel ?? "Copy");
86
+ return element("div", {
87
+ class: "command code-window",
88
+ children: [
89
+ element("span", { class: "label code-head", children: label }),
90
+ element("code", { children: command }),
91
+ element("button", { type: "button", onClick, children: shown }),
92
+ ],
93
+ });
94
+ }
95
+ export function Decision(props) {
96
+ const { decision, turn, copying } = props;
97
+ const request = element("details", {
98
+ open: turn === undefined,
99
+ children: [
100
+ element("summary", { children: "Full text of the request" }),
101
+ element("pre", { children: decision.prompt }),
102
+ ],
103
+ });
104
+ return element("section", {
105
+ class: "decision",
106
+ children: [
107
+ element("h3", { children: `Your decision · ${decision.type}` }),
108
+ turn === undefined ? null : component(Work, { turn }),
109
+ request,
110
+ component(Command, {
111
+ label: "Approve",
112
+ command: decision.approve,
113
+ copying,
114
+ }),
115
+ component(Command, { label: "Deny", command: decision.deny, copying }),
116
+ ],
117
+ });
118
+ }
119
+ export function Events(props) {
120
+ const { events } = props;
121
+ const rows = events.map((event) => element("div", {
122
+ class: "event",
123
+ children: `${clockTime(event.recordedAt)} ${event.type}`,
124
+ }));
125
+ return element("details", {
126
+ class: "events code-window",
127
+ children: [
128
+ element("summary", {
129
+ class: "code-head",
130
+ children: `All events (${String(events.length)})`,
131
+ }),
132
+ rows,
133
+ ],
134
+ });
135
+ }
@@ -0,0 +1,6 @@
1
+ import { type Fields } from "../protocol.ts";
2
+ import type { WatchTurn } from "./watch-render.ts";
3
+ export declare function priceFields(value: unknown): {
4
+ readonly costUsd?: number;
5
+ };
6
+ export declare function statusTurns(turns: readonly WatchTurn[], status: Fields): readonly WatchTurn[];
@@ -0,0 +1,65 @@
1
+ import { record } from "../protocol.js";
2
+ import { priceOf, usageOf } from "../worker-usage.js";
3
+ function text(value) {
4
+ return typeof value === "string" ? value : "";
5
+ }
6
+ function emptyTurn(operationId, runId) {
7
+ return {
8
+ operationId,
9
+ runId,
10
+ key: operationId,
11
+ usage: usageOf(null),
12
+ costUsd: null,
13
+ estimatedCostUsd: null,
14
+ target: "",
15
+ branch: "",
16
+ worktree: "",
17
+ startedAt: "",
18
+ endedAt: null,
19
+ activeAt: null,
20
+ outcome: "ended",
21
+ activity: [],
22
+ commits: [],
23
+ files: [],
24
+ uncommitted: [],
25
+ summary: "",
26
+ };
27
+ }
28
+ export function priceFields(value) {
29
+ const cost = priceOf(value);
30
+ return cost === null ? {} : { costUsd: cost };
31
+ }
32
+ export function statusTurns(turns, status) {
33
+ const runId = text(status["runId"]);
34
+ const journal = turns.filter((turn) => turn.runId === runId);
35
+ if (!Array.isArray(status["workerTurns"]))
36
+ return journal;
37
+ const ended = status["workerTurns"].map((value) => {
38
+ const fields = record(value) ?? {};
39
+ const operationId = text(fields["operationId"]);
40
+ const known = journal.find((turn) => turn.operationId === operationId) ??
41
+ emptyTurn(operationId, runId);
42
+ return {
43
+ ...known,
44
+ runId,
45
+ operationId,
46
+ outcome: known.outcome === "in work" ? "ended" : known.outcome,
47
+ activeAt: null,
48
+ usage: usageOf(fields["usage"]),
49
+ costUsd: priceOf(fields["costUsd"]),
50
+ estimatedCostUsd: priceOf(fields["estimatedCostUsd"]),
51
+ activity: known.activity.map((item) => item.kind === "result"
52
+ ? {
53
+ kind: item.kind,
54
+ text: item.text,
55
+ ...priceFields(fields["costUsd"]),
56
+ }
57
+ : item),
58
+ };
59
+ });
60
+ return [
61
+ ...ended,
62
+ ...journal.filter((turn) => turn.outcome === "in work" &&
63
+ !ended.some((item) => item.operationId === turn.operationId)),
64
+ ];
65
+ }
@@ -0,0 +1,54 @@
1
+ import type { CardControls } from "./watch-card-view.ts";
2
+ import { type Shown } from "./watch-element.ts";
3
+ import { type Copying, type WatchModel, type WatchPhase, type WatchRun } from "./watch-render.ts";
4
+ import { type ColumnControls } from "./watch-board-view.ts";
5
+ interface Timed {
6
+ readonly run: WatchRun;
7
+ readonly now: string;
8
+ }
9
+ export declare const clove: {
10
+ viewBox: string;
11
+ paths: string[];
12
+ };
13
+ export declare function BannerDetail(props: Timed): Shown;
14
+ export declare function Banner(props: Timed): Shown;
15
+ export declare function Phases(props: {
16
+ readonly phases: readonly WatchPhase[];
17
+ readonly now: string;
18
+ }): Shown;
19
+ export declare function Review(props: {
20
+ readonly run: WatchRun;
21
+ readonly round: number;
22
+ }): Shown;
23
+ export declare function PullRequest(props: {
24
+ readonly run: WatchRun;
25
+ }): Shown;
26
+ export declare function Run(props: Timed & {
27
+ readonly copying: Copying;
28
+ }): Shown;
29
+ export interface StartControls {
30
+ readonly shown: boolean;
31
+ readonly onToggle: () => void;
32
+ }
33
+ export declare function Header(props: {
34
+ readonly model: WatchModel | null;
35
+ readonly stale: boolean;
36
+ readonly start?: StartControls;
37
+ }): Shown;
38
+ export interface PageProps {
39
+ readonly cards?: CardControls;
40
+ readonly model: WatchModel | null;
41
+ readonly selected: string;
42
+ readonly now: string;
43
+ readonly stale: boolean;
44
+ readonly copying: Copying;
45
+ readonly columns?: ColumnControls;
46
+ readonly start?: StartControls;
47
+ }
48
+ export declare function Page(props: PageProps): Shown;
49
+ export declare function BoardPage(props: PageProps & {
50
+ readonly model: WatchModel;
51
+ readonly workflowId: string | null;
52
+ readonly down: Shown;
53
+ }): Shown;
54
+ export {};
@@ -0,0 +1,267 @@
1
+ import { priceText, usageText, totalsSuffix } from "./usage-render.js";
2
+ import { component, element } from "./watch-element.js";
3
+ import { clockTime, completedDetail, counted, elapsed, phaseTime, runName, runTone, waitingDetail, } from "./watch-render.js";
4
+ import { Board, WorkflowList, } from "./watch-board-view.js";
5
+ import { boardWorkflow, watchHash, watchLocation } from "./watch-navigation.js";
6
+ import { Decision, Events, Turn } from "./watch-turn.js";
7
+ import { StartRun } from "./watch-start-view.js";
8
+ export const clove = {
9
+ viewBox: "0.6625858545303345 0.6630800366401672 46.674827575683594 46.673831939697266",
10
+ paths: [
11
+ "M41.47315,11.48535c-1.20117-0.12305-2.16211-1.08398-2.28418-2.28516c-0.17676-1.7334-1.01758-3.29492-2.36865-4.39648s-3.05078-1.61719-4.7832-1.43359c-3.34277,0.34082-5.86377,3.13086-5.86377,6.49121v14.13867c0,0.27637,0.22363,0.5,0.5,0.5H40.8125c3.59766,0,6.52441-2.92676,6.52441-6.52441C47.33692,14.61523,44.81592,11.82422,41.47315,11.48535z M35.56543,15.81543l-5.85791,5.85742c-0.09766,0.09766-0.22559,0.14648-0.35352,0.14648s-0.25586-0.04883-0.35352-0.14648c-0.19531-0.19531-0.19531-0.51172,0-0.70703l5.85791-5.85742c0.19531-0.19531,0.51172-0.19531,0.70703,0C35.76073,15.30372,35.76074,15.62011,35.56543,15.81543z",
12
+ "M15.30225,0.66308c-3.36035,0-6.15088,2.52051-6.49121,5.86328C8.68897,7.72852,7.72852,8.68945,6.52686,8.81152c-1.7334,0.17578-3.29492,1.01758-4.396,2.36816s-1.61035,3.0498-1.43408,4.7832c0.34033,3.34277,3.13086,5.86328,6.49121,5.86328h14.13867c0.27637,0,0.5-0.22363,0.5-0.5V7.18751C21.82666,3.58984,18.8999,0.66308,15.30225,0.66308z M18.99951,19.00001c-0.09766,0.09766-0.22559,0.14648-0.35352,0.14648s-0.25586-0.04883-0.35352-0.14648l-5.85742-5.8584c-0.19531-0.19531-0.19531-0.51172,0-0.70703c0.19531-0.19531,0.51172-0.19531,0.70703,0l5.85742,5.8584C19.19482,18.48829,19.19482,18.80469,18.99951,19.00001z",
13
+ "M24,26.17383H9.86133c-3.59766,0-6.52441,2.92676-6.52441,6.52441c0,3.35938,2.52051,6.14941,5.86377,6.49023c1.20117,0.12207,2.16211,1.08301,2.28418,2.28418c0.17676,1.7334,1.01758,3.29492,2.36865,4.39648c1.17529,0.95801,2.61377,1.46777,4.11035,1.46777c0.22314,0,0.44775-0.01074,0.67285-0.03418C21.97949,46.96189,24.5,44.17186,24.5,40.81248V26.67383C24.5,26.39746,24.27637,26.17383,24,26.17383z M21.67334,29.70704l-5.85791,5.8584c-0.09766,0.09766-0.22559,0.14648-0.35352,0.14648s-0.25586-0.04883-0.35352-0.14648c-0.19531-0.19531-0.19531-0.51172,0-0.70703L20.9663,29c0.19531-0.19531,0.51172-0.19531,0.70703,0S21.86865,29.51172,21.67334,29.70704z",
14
+ "M47.30322,32.03711c-0.34033-3.34277-3.13086-5.86328-6.49072-5.86328H26.67334c-0.27637,0-0.5,0.22363-0.5,0.5V40.8125c0,3.59766,2.92676,6.52441,6.52442,6.52441c3.36035,0,6.15088-2.52148,6.49121-5.86426c0.12207-1.20117,1.08301-2.16211,2.28418-2.28418c1.7334-0.17578,3.29492-1.01758,4.396-2.36816S47.47949,33.7705,47.30322,32.03711z M35.56543,35.56543c-0.09766,0.09766-0.22559,0.14648-0.35352,0.14648s-0.25586-0.04883-0.35352-0.14648l-5.85791-5.8584c-0.19531-0.19531-0.19531-0.51172,0-0.70703s0.51172-0.19531,0.70703,0l5.85791,5.8584C35.76074,35.05371,35.76074,35.37011,35.56543,35.56543z",
15
+ ],
16
+ };
17
+ export function BannerDetail(props) {
18
+ const { run, now } = props;
19
+ const turn = run.turns.at(-1);
20
+ if (run.state === "waiting_gate")
21
+ return waitingDetail(run, now);
22
+ if (run.state === "completed")
23
+ return completedDetail(run);
24
+ if (run.state !== "running" || turn?.outcome !== "in work")
25
+ return `${run.code}: ${run.detail}`;
26
+ const calls = turn.activity.filter((item) => item.kind === "tool").length;
27
+ const quiet = turn.activeAt === null
28
+ ? ""
29
+ : ` · last output ${elapsed(turn.activeAt, now)} ago`;
30
+ const last = turn.activity.at(-1)?.text ?? "The worker starts.";
31
+ return [
32
+ `Claude works for ${elapsed(turn.startedAt, now)} · ${counted(calls, "tool call")}${quiet}`,
33
+ element("span", { class: "now", children: last }),
34
+ ];
35
+ }
36
+ export function Banner(props) {
37
+ const { run, now } = props;
38
+ const { tone, icon, label } = runTone(run);
39
+ const name = element("span", { class: "name", children: runName(run) });
40
+ const words = [
41
+ element("h2", { children: [label, " ", name] }),
42
+ element("p", { children: component(BannerDetail, { run, now }) }),
43
+ ];
44
+ return element("section", {
45
+ class: `banner ${tone}`,
46
+ children: [
47
+ element("span", { class: "icon", children: icon }),
48
+ element("div", { children: words }),
49
+ ],
50
+ });
51
+ }
52
+ export function Phases(props) {
53
+ const marks = {
54
+ done: "✓",
55
+ active: "●",
56
+ failed: "✕",
57
+ };
58
+ const steps = props.phases.map((phase) => element("li", {
59
+ class: `phase ${phase.state}`,
60
+ children: [
61
+ element("span", { class: "mark", children: marks[phase.state] ?? "○" }),
62
+ element("span", { class: "name", children: phase.name }),
63
+ element("span", {
64
+ class: "time",
65
+ children: phaseTime(phase, props.now),
66
+ }),
67
+ ],
68
+ }));
69
+ return element("ol", { class: "phases", children: steps });
70
+ }
71
+ export function Review(props) {
72
+ const { run, round } = props;
73
+ const decisionId = `${run.runId}/review-${String(round)}`;
74
+ const denied = run.feedback.find((item) => item.decisionId === decisionId);
75
+ if (denied !== undefined)
76
+ return element("section", {
77
+ class: "review denied",
78
+ children: [
79
+ element("h3", { children: `Review ${String(round)} · denied` }),
80
+ element("p", { children: denied.text }),
81
+ ],
82
+ });
83
+ if (!run.decisions.some((item) => item.decisionId === decisionId))
84
+ return null;
85
+ return element("section", {
86
+ class: "review pending",
87
+ children: element("h3", {
88
+ children: `Review ${String(round)} · waits for your decision`,
89
+ }),
90
+ });
91
+ }
92
+ export function PullRequest(props) {
93
+ const { pullRequest, reviews, mergeCommit } = props.run;
94
+ if (pullRequest === null)
95
+ return null;
96
+ const link = element("a", {
97
+ href: pullRequest.url,
98
+ children: `#${String(pullRequest.number)}`,
99
+ });
100
+ const scores = reviews.map((review) => element("li", {
101
+ children: `Round ${String(review.round)} · Greptile ${String(review.score)}/5 · commit ${review.commit.slice(0, 7)}`,
102
+ }));
103
+ const merge = mergeCommit === null
104
+ ? null
105
+ : element("p", {
106
+ class: "meta",
107
+ children: [
108
+ "Merge commit ",
109
+ element("code", { children: mergeCommit }),
110
+ ],
111
+ });
112
+ return element("section", {
113
+ class: "pull",
114
+ children: [
115
+ element("h3", { children: ["Pull request ", link] }),
116
+ element("ul", { class: "reviews", children: scores }),
117
+ merge,
118
+ ],
119
+ });
120
+ }
121
+ export function Run(props) {
122
+ const { run, now, copying } = props;
123
+ const turn = run.turns.at(-1);
124
+ const budget = run.spent === null || run.limit === null
125
+ ? ""
126
+ : ` · ${String(run.spent)} of ${String(run.limit)} effect units`;
127
+ const none = "No Claude turn for this run.";
128
+ const turns = run.turns.length === 0
129
+ ? element("p", { class: "meta", children: none })
130
+ : run.turns.map((item, index) => [
131
+ component(Turn, { key: item.key, turn: item, now }),
132
+ component(Review, {
133
+ key: `review-${item.key}`,
134
+ run,
135
+ round: index + 1,
136
+ }),
137
+ ]);
138
+ const foot = [
139
+ `${run.workflowId} · ${run.runId}${budget}`,
140
+ element("br", {}),
141
+ `${run.code}: ${run.detail}`,
142
+ ];
143
+ return [
144
+ component(Banner, { run, now }),
145
+ element("section", {
146
+ class: "run-usage",
147
+ children: [
148
+ element("h3", { children: `Run totals${totalsSuffix(run.state)}` }),
149
+ element("p", { children: usageText(run.usage) }),
150
+ element("p", {
151
+ children: priceText(run.claudeCostUsd, run.estimatedCostUsd),
152
+ }),
153
+ ],
154
+ }),
155
+ component(Phases, { phases: run.phases, now }),
156
+ component(PullRequest, { run }),
157
+ run.decisions.map((decision) => component(Decision, { decision, turn, copying })),
158
+ turns,
159
+ component(Events, { events: run.events }),
160
+ element("p", { class: "meta foot", children: foot }),
161
+ ];
162
+ }
163
+ export function Header(props) {
164
+ const { model, stale } = props;
165
+ const updated = model === null ? "" : `updated ${clockTime(model.updatedAt)}`;
166
+ const stamp = stale
167
+ ? element("span", {
168
+ class: "bad",
169
+ children: "The watch tool does not answer.",
170
+ })
171
+ : element("span", { children: updated });
172
+ return element("header", {
173
+ children: [
174
+ element("strong", {
175
+ class: "brand",
176
+ children: [
177
+ element("svg", {
178
+ xmlns: "http://www.w3.org/2000/svg",
179
+ "aria-hidden": "true",
180
+ focusable: "false",
181
+ viewBox: clove.viewBox,
182
+ children: clove.paths.map((d) => element("path", { fill: "currentColor", d })),
183
+ }),
184
+ "cloving",
185
+ ],
186
+ }),
187
+ stamp,
188
+ props.start === undefined
189
+ ? null
190
+ : element("button", {
191
+ type: "button",
192
+ class: "start-toggle",
193
+ "aria-controls": "start-run",
194
+ "aria-expanded": String(props.start.shown),
195
+ onClick: props.start.onToggle,
196
+ children: "Start a run",
197
+ }),
198
+ ],
199
+ });
200
+ }
201
+ export function Page(props) {
202
+ const { model, selected, now, stale, copying } = props;
203
+ const head = component(Header, { model, stale });
204
+ const text = (tone, children) => element("p", { class: tone, children });
205
+ const waits = "The page waits for the first data of the watch tool.";
206
+ if (model === null)
207
+ return [head, text("meta", waits)];
208
+ const lost = "The Cloving service does not answer. The page shows the last known records.";
209
+ const down = model.service === "up" ? null : text("down", lost);
210
+ const location = watchLocation(selected);
211
+ const workflowId = boardWorkflow(model, location.workflowId);
212
+ if (location.runId !== null) {
213
+ const run = model.runs.find((item) => item.runId === location.runId);
214
+ const back = run?.workflowId ?? location.workflowId ?? model.startWorkflowId;
215
+ return [
216
+ head,
217
+ down,
218
+ element("a", {
219
+ class: "back",
220
+ href: watchHash({ workflowId: back, runId: null }),
221
+ children: `← Back to ${back ?? "workflows"}`,
222
+ }),
223
+ run === undefined
224
+ ? text("meta", "This run is not available.")
225
+ : component(Run, { key: run.runId, run, now, copying }),
226
+ ];
227
+ }
228
+ return component(BoardPage, { ...props, model, workflowId, down });
229
+ }
230
+ export function BoardPage(props) {
231
+ const { model, workflowId, down, now, stale, copying } = props;
232
+ const workflow = model.workflows.find((item) => item.workflowId === workflowId);
233
+ const start = props.start ?? { shown: false, onToggle: () => undefined };
234
+ return element("div", {
235
+ class: "board-page",
236
+ children: [
237
+ component(Header, { model, stale, start }),
238
+ down,
239
+ component(StartRun, {
240
+ workflows: model.workflows,
241
+ copying,
242
+ shown: start.shown,
243
+ }),
244
+ component(WorkflowList, {
245
+ workflows: model.workflows,
246
+ selected: workflowId,
247
+ }),
248
+ element("div", {
249
+ class: "workspace",
250
+ children: [
251
+ workflow === undefined
252
+ ? element("p", {
253
+ class: "meta",
254
+ children: "No workflows registered.",
255
+ })
256
+ : component(Board, {
257
+ workflow,
258
+ now,
259
+ controls: props.columns,
260
+ cardForm: model.cardForms?.find((form) => form.workflowId === workflowId),
261
+ cards: props.cards,
262
+ }),
263
+ ],
264
+ }),
265
+ ],
266
+ });
267
+ }
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,104 @@
1
+ #!/usr/bin/env node
2
+ import { addAbortListener } from "node:events";
3
+ import { execFile, spawn } from "node:child_process";
4
+ import { delimiter, dirname, extname, join } from "node:path";
5
+ import { main } from "./cli/main.js";
6
+ import { clientCommand, runtimeDirectory } from "./cli/runtime-directory.js";
7
+ import { commandUsage } from "./cli/usage.js";
8
+ const [command, ...options] = process.argv.slice(2);
9
+ const watchCommand = async (request) => {
10
+ const [command = "", ...argumentsList] = request.command;
11
+ const completed = Promise.withResolvers();
12
+ const stderr = { text: "" };
13
+ const execution = execFile(command, argumentsList, {
14
+ cwd: request.directory,
15
+ signal: request.signal,
16
+ killSignal: "SIGKILL",
17
+ maxBuffer: 1024 * 1024,
18
+ encoding: "utf8",
19
+ }, (error, stdout) => {
20
+ const code = error === null ? 0 : error.code;
21
+ completed.resolve({
22
+ stdout,
23
+ stderr: stderr.text,
24
+ status: typeof code === "number" ? code : null,
25
+ errorCode: typeof code === "string" ? code : null,
26
+ });
27
+ });
28
+ execution.stderr?.on("data", (chunk) => {
29
+ stderr.text += chunk.toString();
30
+ });
31
+ const closed = new Promise((resolve) => execution.once("close", () => {
32
+ resolve();
33
+ }));
34
+ const listener = addAbortListener(request.signal, () => {
35
+ execution.kill("SIGKILL");
36
+ });
37
+ try {
38
+ await closed;
39
+ return await completed.promise;
40
+ }
41
+ finally {
42
+ listener[Symbol.dispose]();
43
+ }
44
+ };
45
+ function started(runtime, argumentsList) {
46
+ const program = join(import.meta.dirname, "..", "tools", `self-host${extname(import.meta.filename)}`);
47
+ const located = [
48
+ "--runtime",
49
+ runtime,
50
+ "--repository",
51
+ process.cwd(),
52
+ "--client",
53
+ clientCommand(process.env),
54
+ ];
55
+ const child = spawn(process.execPath, [program, ...located, ...argumentsList], {
56
+ stdio: "inherit",
57
+ env: {
58
+ ...process.env,
59
+ PATH: [dirname(process.execPath), process.env["PATH"]].join(delimiter),
60
+ },
61
+ });
62
+ let stopping = false;
63
+ const interrupt = () => {
64
+ stopping = true;
65
+ child.kill("SIGINT");
66
+ };
67
+ const terminate = () => {
68
+ stopping = true;
69
+ child.kill("SIGTERM");
70
+ };
71
+ process.on("SIGINT", interrupt);
72
+ process.on("SIGTERM", terminate);
73
+ return new Promise((settle) => {
74
+ child.once("close", (status) => {
75
+ process.off("SIGINT", interrupt);
76
+ process.off("SIGTERM", terminate);
77
+ settle(stopping && status === 75 ? 0 : (status ?? 1));
78
+ });
79
+ });
80
+ }
81
+ async function start() {
82
+ if (options.includes("--help")) {
83
+ process.stdout.write(String(commandUsage["start"]));
84
+ return 0;
85
+ }
86
+ const runtime = runtimeDirectory(process.env);
87
+ if (runtime !== undefined) {
88
+ let status = await started(runtime, options);
89
+ const restarting = options.filter((option) => option !== "--reset-queue");
90
+ while (status === 75)
91
+ status = await started(runtime, restarting);
92
+ return status === 0 ? 0 : 1;
93
+ }
94
+ process.stderr.write("runtime-directory-unknown: Set CLOVING_RUNTIME_DIR to the runtime directory of the service.\n");
95
+ return 1;
96
+ }
97
+ if (command === "start")
98
+ process.exitCode = await start();
99
+ else
100
+ await main(process.argv.slice(2), {
101
+ repository: process.env["CLOVING_WATCH_REPOSITORY"],
102
+ githubCommand: process.env["CLOVING_GH_COMMAND"],
103
+ execute: watchCommand,
104
+ });
@@ -0,0 +1,5 @@
1
+ export { analysisInstruction } from "../chats/analysis-prompt.ts";
2
+ export declare const analysisMethod = "run-turn:analyze-chats";
3
+ export declare function analysisCommand(): readonly string[];
4
+ export declare function analysisEnvironment(folder: string): NodeJS.ProcessEnv;
5
+ export declare function analysisAvailable(folder: string): Promise<boolean>;