@wjarka/cezarion 0.15.1 → 0.16.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 (462) hide show
  1. package/README.md +167 -46
  2. package/dist/agent-config/catalog.d.ts +6 -2
  3. package/dist/agent-config/catalog.js +78 -3
  4. package/dist/agent-config/catalog.js.map +1 -1
  5. package/dist/agent-config/model-settings/shared.js +6 -3
  6. package/dist/agent-config/model-settings/shared.js.map +1 -1
  7. package/dist/agent-config/models.js +4 -0
  8. package/dist/agent-config/models.js.map +1 -1
  9. package/dist/agent-config/validate.js +6 -0
  10. package/dist/agent-config/validate.js.map +1 -1
  11. package/dist/artifacts/cli.js +10 -2
  12. package/dist/artifacts/cli.js.map +1 -1
  13. package/dist/automations/coordinator.d.ts +7 -0
  14. package/dist/automations/coordinator.js +22 -2
  15. package/dist/automations/coordinator.js.map +1 -1
  16. package/dist/automations/github-poller.d.ts +4 -4
  17. package/dist/automations/github-poller.js.map +1 -1
  18. package/dist/automations/schedule-runner.d.ts +130 -0
  19. package/dist/automations/schedule-runner.js +326 -0
  20. package/dist/automations/schedule-runner.js.map +1 -0
  21. package/dist/automations/scheduler.d.ts +38 -7
  22. package/dist/automations/scheduler.js +90 -22
  23. package/dist/automations/scheduler.js.map +1 -1
  24. package/dist/automations/store.d.ts +80 -3
  25. package/dist/automations/store.js +208 -16
  26. package/dist/automations/store.js.map +1 -1
  27. package/dist/automations/task-template.d.ts +42 -6
  28. package/dist/automations/task-template.js +152 -24
  29. package/dist/automations/task-template.js.map +1 -1
  30. package/dist/automations/types.d.ts +142 -6
  31. package/dist/automations/types.js +64 -6
  32. package/dist/automations/types.js.map +1 -1
  33. package/dist/autosave-holders.js +8 -12
  34. package/dist/autosave-holders.js.map +1 -1
  35. package/dist/ci-wait/client.d.ts +8 -1
  36. package/dist/ci-wait/client.js +43 -1
  37. package/dist/ci-wait/client.js.map +1 -1
  38. package/dist/ci-wait/controller.d.ts +83 -4
  39. package/dist/ci-wait/controller.js +76 -11
  40. package/dist/ci-wait/controller.js.map +1 -1
  41. package/dist/ci-wait/errors.d.ts +7 -1
  42. package/dist/ci-wait/errors.js +36 -0
  43. package/dist/ci-wait/errors.js.map +1 -1
  44. package/dist/ci-wait/github.d.ts +2 -0
  45. package/dist/ci-wait/github.js +3 -1
  46. package/dist/ci-wait/github.js.map +1 -1
  47. package/dist/ci-wait/mcp.d.ts +2 -98
  48. package/dist/ci-wait/mcp.js +11 -25
  49. package/dist/ci-wait/mcp.js.map +1 -1
  50. package/dist/ci-wait/supervisor.d.ts +2 -1
  51. package/dist/ci-wait/supervisor.js +2 -1
  52. package/dist/ci-wait/supervisor.js.map +1 -1
  53. package/dist/ci-wait/tools.d.ts +307 -0
  54. package/dist/ci-wait/tools.js +63 -0
  55. package/dist/ci-wait/tools.js.map +1 -0
  56. package/dist/config.d.ts +3 -0
  57. package/dist/config.js +7 -0
  58. package/dist/config.js.map +1 -1
  59. package/dist/contract/agent-config.d.ts +5 -0
  60. package/dist/contract/agent-profiles.d.ts +15 -0
  61. package/dist/contract/automation-schedule.d.ts +60 -0
  62. package/dist/contract/automations.d.ts +208 -36
  63. package/dist/contract/delegation.d.ts +96 -0
  64. package/dist/contract/discovery.d.ts +7 -0
  65. package/dist/contract/github.d.ts +1 -0
  66. package/dist/contract/health.d.ts +6 -0
  67. package/dist/contract/index.d.ts +3 -0
  68. package/dist/contract/index.js +1445 -745
  69. package/dist/contract/preview.d.ts +508 -0
  70. package/dist/contract/runs.d.ts +716 -15
  71. package/dist/contract/skills.d.ts +39 -0
  72. package/dist/contract/workflows.d.ts +6 -0
  73. package/dist/contract/workspace.d.ts +65 -0
  74. package/dist/contract/zoned-time.d.ts +35 -0
  75. package/dist/core/agent-env.d.ts +11 -0
  76. package/dist/core/agent-env.js +27 -5
  77. package/dist/core/agent-env.js.map +1 -1
  78. package/dist/core/agent-profiles.js +7 -0
  79. package/dist/core/agent-profiles.js.map +1 -1
  80. package/dist/core/agent-runner.d.ts +49 -1
  81. package/dist/core/agent-runner.js +2 -1
  82. package/dist/core/agent-runner.js.map +1 -1
  83. package/dist/core/backend-detect.d.ts +3 -2
  84. package/dist/core/backend-detect.js +27 -1
  85. package/dist/core/backend-detect.js.map +1 -1
  86. package/dist/core/claude-cli-runner.d.ts +1 -0
  87. package/dist/core/claude-cli-runner.js +69 -19
  88. package/dist/core/claude-cli-runner.js.map +1 -1
  89. package/dist/core/codex-app-server-runner.d.ts +1 -0
  90. package/dist/core/codex-app-server-runner.js +200 -25
  91. package/dist/core/codex-app-server-runner.js.map +1 -1
  92. package/dist/core/codex-app-server-transport.d.ts +7 -3
  93. package/dist/core/codex-app-server-transport.js +11 -9
  94. package/dist/core/codex-app-server-transport.js.map +1 -1
  95. package/dist/core/cursor-acp-runner.d.ts +1 -0
  96. package/dist/core/cursor-acp-runner.js +24 -9
  97. package/dist/core/cursor-acp-runner.js.map +1 -1
  98. package/dist/core/host-model-catalog.js +2 -0
  99. package/dist/core/host-model-catalog.js.map +1 -1
  100. package/dist/core/managed-session.js +2 -0
  101. package/dist/core/managed-session.js.map +1 -1
  102. package/dist/core/model-identity.js +2 -0
  103. package/dist/core/model-identity.js.map +1 -1
  104. package/dist/core/model-presets.js +3 -0
  105. package/dist/core/model-presets.js.map +1 -1
  106. package/dist/core/omp-model-catalog.d.ts +43 -0
  107. package/dist/core/omp-model-catalog.js +205 -0
  108. package/dist/core/omp-model-catalog.js.map +1 -0
  109. package/dist/core/omp-runner.d.ts +73 -0
  110. package/dist/core/omp-runner.js +990 -0
  111. package/dist/core/omp-runner.js.map +1 -0
  112. package/dist/core/omp-ui-mapper.d.ts +106 -0
  113. package/dist/core/omp-ui-mapper.js +882 -0
  114. package/dist/core/omp-ui-mapper.js.map +1 -0
  115. package/dist/core/opencode-server-runner.d.ts +18 -4
  116. package/dist/core/opencode-server-runner.js +337 -96
  117. package/dist/core/opencode-server-runner.js.map +1 -1
  118. package/dist/core/opencode-session-error.d.ts +11 -0
  119. package/dist/core/opencode-session-error.js +26 -0
  120. package/dist/core/opencode-session-error.js.map +1 -0
  121. package/dist/core/opencode-ui-mapper.js +4 -36
  122. package/dist/core/opencode-ui-mapper.js.map +1 -1
  123. package/dist/core/pi-runner.d.ts +1 -0
  124. package/dist/core/pi-runner.js +75 -12
  125. package/dist/core/pi-runner.js.map +1 -1
  126. package/dist/core/provider-auth.d.ts +9 -2
  127. package/dist/core/provider-auth.js +43 -6
  128. package/dist/core/provider-auth.js.map +1 -1
  129. package/dist/core/runner-factory.js +3 -0
  130. package/dist/core/runner-factory.js.map +1 -1
  131. package/dist/core/runner-model-catalog.js +1 -0
  132. package/dist/core/runner-model-catalog.js.map +1 -1
  133. package/dist/core/runner-stderr.d.ts +2 -0
  134. package/dist/core/runner-stderr.js +20 -0
  135. package/dist/core/runner-stderr.js.map +1 -0
  136. package/dist/core/session-process.d.ts +22 -0
  137. package/dist/core/session-process.js +202 -0
  138. package/dist/core/session-process.js.map +1 -0
  139. package/dist/core/ui-events.d.ts +1 -1
  140. package/dist/core/usage-limit.js +3 -60
  141. package/dist/core/usage-limit.js.map +1 -1
  142. package/dist/data-gitignore.d.ts +6 -0
  143. package/dist/data-gitignore.js +57 -0
  144. package/dist/data-gitignore.js.map +1 -0
  145. package/dist/delegation/capacity.d.ts +19 -0
  146. package/dist/delegation/capacity.js +34 -0
  147. package/dist/delegation/capacity.js.map +1 -0
  148. package/dist/delegation/cli.js +13 -4
  149. package/dist/delegation/cli.js.map +1 -1
  150. package/dist/delegation/conversations.d.ts +4 -2
  151. package/dist/delegation/conversations.js +8 -12
  152. package/dist/delegation/conversations.js.map +1 -1
  153. package/dist/delegation/credentials.d.ts +2 -0
  154. package/dist/delegation/credentials.js +10 -0
  155. package/dist/delegation/credentials.js.map +1 -1
  156. package/dist/delegation/destroy-observation.d.ts +42 -0
  157. package/dist/delegation/destroy-observation.js +115 -0
  158. package/dist/delegation/destroy-observation.js.map +1 -0
  159. package/dist/delegation/execution-identity.d.ts +6 -0
  160. package/dist/delegation/execution-identity.js +1 -1
  161. package/dist/delegation/execution-identity.js.map +1 -1
  162. package/dist/delegation/policy.d.ts +3 -2
  163. package/dist/delegation/policy.js +7 -5
  164. package/dist/delegation/policy.js.map +1 -1
  165. package/dist/delegation/process-liveness.d.ts +57 -20
  166. package/dist/delegation/process-liveness.js +114 -92
  167. package/dist/delegation/process-liveness.js.map +1 -1
  168. package/dist/delegation/provision.js +6 -6
  169. package/dist/delegation/provision.js.map +1 -1
  170. package/dist/delegation/results.js +4 -2
  171. package/dist/delegation/results.js.map +1 -1
  172. package/dist/delegation/retry-backoff.d.ts +23 -0
  173. package/dist/delegation/retry-backoff.js +18 -0
  174. package/dist/delegation/retry-backoff.js.map +1 -0
  175. package/dist/delegation/routes.d.ts +64 -58
  176. package/dist/delegation/scratch-cleanup.d.ts +29 -0
  177. package/dist/delegation/scratch-cleanup.js +143 -0
  178. package/dist/delegation/scratch-cleanup.js.map +1 -0
  179. package/dist/delegation/service.d.ts +20 -1
  180. package/dist/delegation/service.js +233 -70
  181. package/dist/delegation/service.js.map +1 -1
  182. package/dist/delegation/transport.d.ts +12 -6
  183. package/dist/delegation/workspace.d.ts +23 -4
  184. package/dist/delegation/workspace.js +147 -31
  185. package/dist/delegation/workspace.js.map +1 -1
  186. package/dist/git-worktree-lock-helper.js +8 -3
  187. package/dist/git-worktree-lock-helper.js.map +1 -1
  188. package/dist/git-worktree-lock.d.ts +6 -1
  189. package/dist/git-worktree-lock.js +10 -4
  190. package/dist/git-worktree-lock.js.map +1 -1
  191. package/dist/git-worktree-release.d.ts +20 -0
  192. package/dist/git-worktree-release.js +27 -0
  193. package/dist/git-worktree-release.js.map +1 -0
  194. package/dist/git-worktree.d.ts +8 -2
  195. package/dist/git-worktree.js +19 -2
  196. package/dist/git-worktree.js.map +1 -1
  197. package/dist/handoff.d.ts +2 -2
  198. package/dist/handoff.js +1 -1
  199. package/dist/index.js +109 -76
  200. package/dist/index.js.map +1 -1
  201. package/dist/paths.d.ts +1 -1
  202. package/dist/paths.js +5 -1
  203. package/dist/paths.js.map +1 -1
  204. package/dist/preview/cdp.d.ts +13 -0
  205. package/dist/preview/cdp.js +69 -0
  206. package/dist/preview/cdp.js.map +1 -0
  207. package/dist/preview/chromium.d.ts +75 -0
  208. package/dist/preview/chromium.js +394 -0
  209. package/dist/preview/chromium.js.map +1 -0
  210. package/dist/preview/dev-server.d.ts +68 -0
  211. package/dist/preview/dev-server.js +341 -0
  212. package/dist/preview/dev-server.js.map +1 -0
  213. package/dist/preview/host.d.ts +154 -0
  214. package/dist/preview/host.js +681 -0
  215. package/dist/preview/host.js.map +1 -0
  216. package/dist/preview/registration.d.ts +63 -0
  217. package/dist/preview/registration.js +109 -0
  218. package/dist/preview/registration.js.map +1 -0
  219. package/dist/preview/session.d.ts +73 -0
  220. package/dist/preview/session.js +347 -0
  221. package/dist/preview/session.js.map +1 -0
  222. package/dist/preview/url.d.ts +6 -0
  223. package/dist/preview/url.js +17 -0
  224. package/dist/preview/url.js.map +1 -0
  225. package/dist/runs/agent-tmpdir-removal.d.ts +15 -0
  226. package/dist/runs/agent-tmpdir-removal.js +60 -0
  227. package/dist/runs/agent-tmpdir-removal.js.map +1 -0
  228. package/dist/runs/agent-tmpdir.d.ts +12 -1
  229. package/dist/runs/agent-tmpdir.js +123 -34
  230. package/dist/runs/agent-tmpdir.js.map +1 -1
  231. package/dist/runs/delegation-state.d.ts +5 -1
  232. package/dist/runs/delegation-state.js +9 -0
  233. package/dist/runs/delegation-state.js.map +1 -1
  234. package/dist/runs/event-history.d.ts +4 -4
  235. package/dist/runs/event-history.js +97 -117
  236. package/dist/runs/event-history.js.map +1 -1
  237. package/dist/runs/history-compressor.d.ts +29 -0
  238. package/dist/runs/history-compressor.js +116 -0
  239. package/dist/runs/history-compressor.js.map +1 -0
  240. package/dist/runs/history-file.d.ts +36 -0
  241. package/dist/runs/history-file.js +463 -0
  242. package/dist/runs/history-file.js.map +1 -0
  243. package/dist/runs/human-ask-summary.js +18 -13
  244. package/dist/runs/human-ask-summary.js.map +1 -1
  245. package/dist/runs/legacy-index.d.ts +62 -0
  246. package/dist/runs/legacy-index.js +168 -0
  247. package/dist/runs/legacy-index.js.map +1 -0
  248. package/dist/runs/raw-record.d.ts +52 -0
  249. package/dist/runs/raw-record.js +145 -0
  250. package/dist/runs/raw-record.js.map +1 -0
  251. package/dist/runs/retention.d.ts +13 -6
  252. package/dist/runs/retention.js +42 -13
  253. package/dist/runs/retention.js.map +1 -1
  254. package/dist/runs/run-claims.d.ts +23 -0
  255. package/dist/runs/run-claims.js +24 -0
  256. package/dist/runs/run-claims.js.map +1 -0
  257. package/dist/runs/run-database.d.ts +385 -0
  258. package/dist/runs/run-database.js +930 -0
  259. package/dist/runs/run-database.js.map +1 -0
  260. package/dist/runs/run-index.d.ts +35 -9
  261. package/dist/runs/run-index.js +200 -25
  262. package/dist/runs/run-index.js.map +1 -1
  263. package/dist/runs/run-row.d.ts +44 -0
  264. package/dist/runs/run-row.js +84 -0
  265. package/dist/runs/run-row.js.map +1 -0
  266. package/dist/runs/run-search.d.ts +29 -0
  267. package/dist/runs/run-search.js +63 -0
  268. package/dist/runs/run-search.js.map +1 -0
  269. package/dist/runs/store-open-error.d.ts +24 -0
  270. package/dist/runs/store-open-error.js +61 -0
  271. package/dist/runs/store-open-error.js.map +1 -0
  272. package/dist/runs/store.d.ts +667 -32
  273. package/dist/runs/store.js +2153 -324
  274. package/dist/runs/store.js.map +1 -1
  275. package/dist/runs/transcript-facts.d.ts +77 -0
  276. package/dist/runs/transcript-facts.js +302 -0
  277. package/dist/runs/transcript-facts.js.map +1 -0
  278. package/dist/runs/webhook.js +5 -4
  279. package/dist/runs/webhook.js.map +1 -1
  280. package/dist/runs/worker-execution.d.ts +22 -0
  281. package/dist/runs/worker-execution.js +30 -0
  282. package/dist/runs/worker-execution.js.map +1 -0
  283. package/dist/server/capabilities.d.ts +1 -0
  284. package/dist/server/capabilities.js +2 -0
  285. package/dist/server/capabilities.js.map +1 -1
  286. package/dist/server/cockpit-ownership.d.ts +8 -0
  287. package/dist/server/cockpit-ownership.js +19 -0
  288. package/dist/server/cockpit-ownership.js.map +1 -1
  289. package/dist/server/forge/github.d.ts +1 -4
  290. package/dist/server/forge/github.js +47 -23
  291. package/dist/server/forge/github.js.map +1 -1
  292. package/dist/server/git.js +1 -1
  293. package/dist/server/git.js.map +1 -1
  294. package/dist/server/open-in-app.js +1 -0
  295. package/dist/server/open-in-app.js.map +1 -1
  296. package/dist/server/preview-socket.d.ts +36 -0
  297. package/dist/server/preview-socket.js +126 -0
  298. package/dist/server/preview-socket.js.map +1 -0
  299. package/dist/server/project-context.d.ts +31 -4
  300. package/dist/server/project-context.js +73 -9
  301. package/dist/server/project-context.js.map +1 -1
  302. package/dist/server/provider-action-gate.js +1 -0
  303. package/dist/server/provider-action-gate.js.map +1 -1
  304. package/dist/server/repo-branches.d.ts +4 -3
  305. package/dist/server/repo-branches.js +5 -4
  306. package/dist/server/repo-branches.js.map +1 -1
  307. package/dist/server/server.d.ts +4500 -2727
  308. package/dist/server/server.js +651 -202
  309. package/dist/server/server.js.map +1 -1
  310. package/dist/server/upgrade-router.d.ts +23 -0
  311. package/dist/server/upgrade-router.js +53 -0
  312. package/dist/server/upgrade-router.js.map +1 -0
  313. package/dist/server/validators.d.ts +6 -1
  314. package/dist/server/validators.js +4 -4
  315. package/dist/server/validators.js.map +1 -1
  316. package/dist/server/ws.d.ts +16 -16
  317. package/dist/server/ws.js +56 -54
  318. package/dist/server/ws.js.map +1 -1
  319. package/dist/skills-remote.d.ts +14 -0
  320. package/dist/skills-remote.js +91 -15
  321. package/dist/skills-remote.js.map +1 -1
  322. package/dist/task-cli/cli.js +40 -16
  323. package/dist/task-cli/cli.js.map +1 -1
  324. package/dist/task-cli/discovery.d.ts +4 -3
  325. package/dist/task-cli/discovery.js +4 -3
  326. package/dist/task-cli/discovery.js.map +1 -1
  327. package/dist/task-cli/http.d.ts +2 -0
  328. package/dist/task-cli/http.js +10 -4
  329. package/dist/task-cli/http.js.map +1 -1
  330. package/dist/task-cli/projections.d.ts +5 -2
  331. package/dist/task-cli/projections.js +13 -0
  332. package/dist/task-cli/projections.js.map +1 -1
  333. package/dist/task-cli/watch.d.ts +15 -2
  334. package/dist/task-cli/watch.js +31 -9
  335. package/dist/task-cli/watch.js.map +1 -1
  336. package/dist/ui-state.d.ts +4 -3
  337. package/dist/ui-state.js +8 -3
  338. package/dist/ui-state.js.map +1 -1
  339. package/dist/workflows/grouped-command.d.ts +31 -0
  340. package/dist/workflows/grouped-command.js +143 -0
  341. package/dist/workflows/grouped-command.js.map +1 -0
  342. package/dist/workflows/run.d.ts +223 -42
  343. package/dist/workflows/run.js +1316 -398
  344. package/dist/workflows/run.js.map +1 -1
  345. package/dist/workflows/types.d.ts +12 -0
  346. package/dist/workflows/types.js +20 -0
  347. package/dist/workflows/types.js.map +1 -1
  348. package/dist/workspace/agent-accounts.d.ts +5 -1
  349. package/dist/workspace/agent-accounts.js +1 -0
  350. package/dist/workspace/agent-accounts.js.map +1 -1
  351. package/dist/workspace/agent-profiles.js +1 -1
  352. package/dist/workspace/agent-profiles.js.map +1 -1
  353. package/dist/workspace/config.d.ts +3 -1
  354. package/dist/workspace/config.js +1 -0
  355. package/dist/workspace/config.js.map +1 -1
  356. package/dist/worktree-setup.d.ts +85 -0
  357. package/dist/worktree-setup.js +164 -0
  358. package/dist/worktree-setup.js.map +1 -0
  359. package/package.json +7 -5
  360. package/scripts/benchmark-run-store-fixture.ts +428 -0
  361. package/scripts/benchmark-run-store.ts +743 -0
  362. package/scripts/benchmark-stuck-destroys.ts +143 -0
  363. package/scripts/mock-autonomous.mjs +11 -0
  364. package/scripts/mock-ci-tool.mjs +20 -5
  365. package/scripts/mock-claude.mjs +110 -1
  366. package/scripts/mock-codex-app-server.mjs +117 -2
  367. package/scripts/mock-codex-coalesce-steer.mjs +59 -0
  368. package/scripts/mock-codex-reverse-steer.mjs +130 -0
  369. package/scripts/mock-cursor-acp.mjs +75 -1
  370. package/scripts/mock-omp-rpc.mjs +605 -0
  371. package/scripts/mock-opencode-serve.mjs +312 -22
  372. package/scripts/mock-pi-rpc.mjs +109 -3
  373. package/scripts/mock-runner-crash.mjs +42 -0
  374. package/scripts/mock-silent-tail.mjs +78 -0
  375. package/scripts/mock-turn-messages.mjs +5 -0
  376. package/scripts/omp-ci-wait.mjs +29 -0
  377. package/scripts/omp-restrict-delegation.yml +4 -0
  378. package/scripts/pi-ci-wait.mjs +12 -9
  379. package/scripts/seed-archive-profile.ts +3 -3
  380. package/web/dist/assets/agent-accounts-CFOBMVHc.js +1 -0
  381. package/web/dist/assets/alert-dialog-BrpNUwMt.js +1 -0
  382. package/web/dist/assets/app-window-CSHwDX9N.js +1 -0
  383. package/web/dist/assets/button-C_rd7CPp.js +43 -0
  384. package/web/dist/assets/compare-variants-D6WXhvXA.js +1 -0
  385. package/web/dist/assets/diff-DrEARXTV.js +3 -0
  386. package/web/dist/assets/diff-controls-B1-j7nFg.js +1 -0
  387. package/web/dist/assets/{diff-view-DPn6bQ5W.js → diff-view-DvGLjdTk.js} +3 -3
  388. package/web/dist/assets/dropdown-menu-BegOZFrj.js +1 -0
  389. package/web/dist/assets/format-DpNe3S0A.js +1 -0
  390. package/web/dist/assets/git-toolbar-Cw4ljmhB.js +1 -0
  391. package/web/dist/assets/github-CfV5sqL0.js +1 -0
  392. package/web/dist/assets/{image-preview-DJ8cgb1Z.js → image-preview-FOEfqpZP.js} +1 -1
  393. package/web/dist/assets/index-DgWWlOLy.js +13 -0
  394. package/web/dist/assets/index-fBFnuvxu.css +1 -0
  395. package/web/dist/assets/{nav-row-styles-3j64kH5s.js → nav-row-styles-vp2JbhuJ.js} +1 -1
  396. package/web/dist/assets/play-CmVAj_fu.js +1 -0
  397. package/web/dist/assets/popover-BohP6WTx.js +1 -0
  398. package/web/dist/assets/preview-pane-connected-qTA5KNoJ.js +3 -0
  399. package/web/dist/assets/preview-state-vuMviq6q.js +1 -0
  400. package/web/dist/assets/prompt-templates-Cubdut_C.js +15 -0
  401. package/web/dist/assets/repo-git-Cf4t5PD0.js +1 -0
  402. package/web/dist/assets/{run-diff-5-RRdcVz.js → run-diff-BpkUW37Z.js} +3 -3
  403. package/web/dist/assets/run-header-68WHf9wV.js +1 -0
  404. package/web/dist/assets/skills-DiVIgKeU.js +1 -0
  405. package/web/dist/assets/square-terminal-B6RYYieR.js +1 -0
  406. package/web/dist/assets/status-dot-CqTJHSP9.js +1 -0
  407. package/web/dist/assets/{tab-link-K0hjzEXR.js → tab-link-B07Hu4QX.js} +1 -1
  408. package/web/dist/assets/task-changes--lQF6EYf.js +1 -0
  409. package/web/dist/assets/task-commits-Cx0qy4DN.js +1 -0
  410. package/web/dist/assets/task-files-D50s-gKW.js +2 -0
  411. package/web/dist/assets/task-github-item-DaqmSwYT.js +1 -0
  412. package/web/dist/assets/task-thread-BPQ64lui.js +7 -0
  413. package/web/dist/assets/{task-thread-Bw_nQuTx.css → task-thread-zNE2Q9E-.css} +1 -1
  414. package/web/dist/assets/textarea-D20O4Pw0.js +1 -0
  415. package/web/dist/assets/thread-state-DWcFMrvb.js +4 -0
  416. package/web/dist/assets/use-hand-to-agent-state-BLIGmwbd.css +1 -0
  417. package/web/dist/assets/use-hand-to-agent-state-Cy9eyyfL.js +1 -0
  418. package/web/dist/assets/{utils-fzNfbPzA.js → utils-JsL3ZsJf.js} +1 -1
  419. package/web/dist/assets/workflows-jwG7uxqi.js +11 -0
  420. package/web/dist/assets/{zoomable-image-CDmZ_Rtl.js → zoomable-image-BJJ64KGc.js} +1 -1
  421. package/web/dist/cezarion-lockup-dark.svg +1 -13
  422. package/web/dist/cezarion-lockup-light.svg +1 -13
  423. package/web/dist/cezarion-mark-dark.svg +1 -12
  424. package/web/dist/cezarion-mark-light.svg +1 -12
  425. package/web/dist/index.html +16 -21
  426. package/web/dist/assets/agent-accounts-CU2ZDv24.js +0 -1
  427. package/web/dist/assets/alert-dialog-C-xYE_dg.js +0 -43
  428. package/web/dist/assets/chevron-right-BENZ-1ZN.js +0 -1
  429. package/web/dist/assets/collapsible-DD9J91Iv.js +0 -1
  430. package/web/dist/assets/compare-variants-5FmqpFSN.js +0 -1
  431. package/web/dist/assets/diff-controls-Bj0YrioE.js +0 -1
  432. package/web/dist/assets/diff-rE8rm75J2.js +0 -3
  433. package/web/dist/assets/diff-stat-BKDCSVfJ.js +0 -1
  434. package/web/dist/assets/dropdown-menu-Ch5BYQh_.js +0 -1
  435. package/web/dist/assets/format-dBiNDNVe.js +0 -1
  436. package/web/dist/assets/git-toolbar-ClVvf5iF.js +0 -1
  437. package/web/dist/assets/github-BkNOyour.css +0 -1
  438. package/web/dist/assets/github-DeZMeMwJ.js +0 -1
  439. package/web/dist/assets/github-item-detail-W5F6GVjF.js +0 -1
  440. package/web/dist/assets/github-sidebar-model-DcMu-IK2.js +0 -1
  441. package/web/dist/assets/highlighter-CdHqIwFr.js +0 -3
  442. package/web/dist/assets/index-CatemBEL.js +0 -8
  443. package/web/dist/assets/index-MvfD8bZJ.css +0 -1
  444. package/web/dist/assets/markdown-zdKeLIYA.js +0 -2
  445. package/web/dist/assets/mobile-run-bar-BCfmFi8V.js +0 -1
  446. package/web/dist/assets/prompt-templates-CBPp39IU.js +0 -15
  447. package/web/dist/assets/reference-chip-D6owncJT.js +0 -1
  448. package/web/dist/assets/repo-git-CtdkZFey.js +0 -1
  449. package/web/dist/assets/run-header-BcjoDi0W.js +0 -1
  450. package/web/dist/assets/sheet-ChnYVrp1.js +0 -1
  451. package/web/dist/assets/skills-C8YKp2vr.js +0 -1
  452. package/web/dist/assets/task-changes-BW8YdWG8.js +0 -1
  453. package/web/dist/assets/task-commits-q2kB2y6L.js +0 -1
  454. package/web/dist/assets/task-files-pPL6_3Cr.js +0 -2
  455. package/web/dist/assets/task-github-item-BXF5R52U.js +0 -1
  456. package/web/dist/assets/task-thread-DtkFL3EC.js +0 -10
  457. package/web/dist/assets/textarea-DxlkE-Yd.js +0 -1
  458. package/web/dist/assets/token-metrics-DIAjrPlM.js +0 -1
  459. package/web/dist/assets/use-desktop-CrDny2uG.js +0 -1
  460. package/web/dist/assets/use-submit-shortcut-KWJsC906.js +0 -1
  461. package/web/dist/assets/workflows-TmcPEj2K.js +0 -11
  462. /package/web/dist/assets/{lib-BQXq3kEf2.js → lib-BQXq3kEf.js} +0 -0
@@ -1,9 +1,13 @@
1
1
  import { EventEmitter } from 'node:events';
2
+ import { type WorkerExecution } from './worker-execution.ts';
2
3
  import { z } from 'zod';
3
- import type { CiWait, ConversationState, AgentInput, InboxClaim, DelegationState, WorkerCollectedResult } from '../contract/index.js';
4
+ import type { ArchiveFinishedScope, ArchivedRunsResponse, CiWait, ConversationState, AgentInput, InboxClaim, DelegationState, RunSummary, WorkerCollectedResult, WorkerDestroyRetry } from '../contract/index.js';
5
+ import { type TranscriptFacts } from './transcript-facts.ts';
4
6
  import { type WorkerExecutionIdentity } from '../delegation/execution-identity.ts';
5
- import { type WorkerProcessRecord } from '../delegation/process-liveness.ts';
7
+ import { type CwdSource, type WorkerProcessRecord } from '../delegation/process-liveness.ts';
6
8
  import { workflowDefSchema } from '../workflows/types.ts';
9
+ import { type RawExtras } from './raw-record.ts';
10
+ import { RunStoreOpenError } from './store-open-error.ts';
7
11
  import type { RunnerId } from '../core/agent-runner.ts';
8
12
  export type RunStatus = 'queued' | 'running' | 'waiting' | 'review' | 'done' | 'failed' | 'cancelled';
9
13
  /**
@@ -51,9 +55,10 @@ declare const stepStateSchema: z.ZodObject<{
51
55
  "claude-cli": "claude-cli";
52
56
  codex: "codex";
53
57
  cursor: "cursor";
58
+ omp: "omp";
54
59
  opencode: "opencode";
55
60
  pi: "pi";
56
- }>, z.ZodTransform<"claude" | "codex" | "cursor" | "opencode" | "pi", "claude" | "claude-cli" | "codex" | "cursor" | "opencode" | "pi">>>;
61
+ }>, z.ZodTransform<"claude" | "codex" | "cursor" | "omp" | "opencode" | "pi", "claude" | "claude-cli" | "codex" | "cursor" | "omp" | "opencode" | "pi">>>;
57
62
  profileId: z.ZodOptional<z.ZodString>;
58
63
  costUsd: z.ZodOptional<z.ZodNumber>;
59
64
  synthetic: z.ZodOptional<z.ZodLiteral<"continuation">>;
@@ -68,8 +73,8 @@ declare const queuedMessageSchema: z.ZodObject<{
68
73
  images: z.ZodOptional<z.ZodArray<z.ZodString>>;
69
74
  createdAt: z.ZodString;
70
75
  }, z.core.$strip>;
71
- /** Exported for `./run-index.ts`, the read-only reader of the same file. Nothing else should
72
- * parse `runs.json` — see `reconcileLoadedRun` for why a second parser is a correctness risk. */
76
+ /** Exported for `./run-index.ts`, the read-only reader of the same records. Nothing else should
77
+ * parse a stored run — see `reconcileLoadedRun` for why a second parser is a correctness risk. */
73
78
  export declare const runRecordSchema: z.ZodObject<{
74
79
  id: z.ZodString;
75
80
  title: z.ZodString;
@@ -603,6 +608,15 @@ export declare const runRecordSchema: z.ZodObject<{
603
608
  deliveredAt: z.ZodOptional<z.ZodISODateTime>;
604
609
  }, z.core.$strict>>;
605
610
  lastCiWaitError: z.ZodOptional<z.ZodString>;
611
+ previewServers: z.ZodOptional<z.ZodArray<z.ZodObject<{
612
+ port: z.ZodNumber;
613
+ command: z.ZodString;
614
+ cwd: z.ZodOptional<z.ZodString>;
615
+ label: z.ZodString;
616
+ path: z.ZodOptional<z.ZodString>;
617
+ registeredAt: z.ZodISODateTime;
618
+ answeredAtRegistration: z.ZodBoolean;
619
+ }, z.core.$strip>>>;
606
620
  taskImages: z.ZodOptional<z.ZodArray<z.ZodString>>;
607
621
  model: z.ZodOptional<z.ZodString>;
608
622
  effort: z.ZodOptional<z.ZodString>;
@@ -612,9 +626,10 @@ export declare const runRecordSchema: z.ZodObject<{
612
626
  "claude-cli": "claude-cli";
613
627
  codex: "codex";
614
628
  cursor: "cursor";
629
+ omp: "omp";
615
630
  opencode: "opencode";
616
631
  pi: "pi";
617
- }>, z.ZodTransform<"claude" | "codex" | "cursor" | "opencode" | "pi", "claude" | "claude-cli" | "codex" | "cursor" | "opencode" | "pi">>>;
632
+ }>, z.ZodTransform<"claude" | "codex" | "cursor" | "omp" | "opencode" | "pi", "claude" | "claude-cli" | "codex" | "cursor" | "omp" | "opencode" | "pi">>>;
618
633
  agentProfile: z.ZodOptional<z.ZodString>;
619
634
  systemPrompt: z.ZodOptional<z.ZodString>;
620
635
  generateFollowups: z.ZodOptional<z.ZodBoolean>;
@@ -631,6 +646,22 @@ export declare const runRecordSchema: z.ZodObject<{
631
646
  event: z.ZodString;
632
647
  githubUrl: z.ZodString;
633
648
  }, z.core.$strip>>;
649
+ automationTrigger: z.ZodOptional<z.ZodObject<{
650
+ automationId: z.ZodString;
651
+ automationRevision: z.ZodNumber;
652
+ receiptId: z.ZodString;
653
+ trigger: z.ZodEnum<{
654
+ "catch-up": "catch-up";
655
+ manual: "manual";
656
+ schedule: "schedule";
657
+ }>;
658
+ occurrenceAt: z.ZodString;
659
+ }, z.core.$strip>>;
660
+ destroyRetry: z.ZodCatch<z.ZodOptional<z.ZodObject<{
661
+ attempts: z.ZodNumber;
662
+ nextAt: z.ZodISODateTime;
663
+ needsAttention: z.ZodOptional<z.ZodLiteral<true>>;
664
+ }, z.core.$strict>>>;
634
665
  status: z.ZodEnum<{
635
666
  cancelled: "cancelled";
636
667
  done: "done";
@@ -678,6 +709,17 @@ export declare const runRecordSchema: z.ZodObject<{
678
709
  branch: z.ZodOptional<z.ZodString>;
679
710
  baseBranch: z.ZodOptional<z.ZodString>;
680
711
  worktreeReclaimedAt: z.ZodOptional<z.ZodString>;
712
+ worktreeSetup: z.ZodCatch<z.ZodOptional<z.ZodObject<{
713
+ status: z.ZodEnum<{
714
+ done: "done";
715
+ failed: "failed";
716
+ running: "running";
717
+ }>;
718
+ startedAt: z.ZodString;
719
+ finishedAt: z.ZodOptional<z.ZodString>;
720
+ durationMs: z.ZodOptional<z.ZodNumber>;
721
+ error: z.ZodOptional<z.ZodString>;
722
+ }, z.core.$strip>>>;
681
723
  groupId: z.ZodOptional<z.ZodString>;
682
724
  variant: z.ZodOptional<z.ZodString>;
683
725
  clientRequestId: z.ZodOptional<z.ZodString>;
@@ -727,9 +769,10 @@ export declare const runRecordSchema: z.ZodObject<{
727
769
  "claude-cli": "claude-cli";
728
770
  codex: "codex";
729
771
  cursor: "cursor";
772
+ omp: "omp";
730
773
  opencode: "opencode";
731
774
  pi: "pi";
732
- }>, z.ZodTransform<"claude" | "codex" | "cursor" | "opencode" | "pi", "claude" | "claude-cli" | "codex" | "cursor" | "opencode" | "pi">>>;
775
+ }>, z.ZodTransform<"claude" | "codex" | "cursor" | "omp" | "opencode" | "pi", "claude" | "claude-cli" | "codex" | "cursor" | "omp" | "opencode" | "pi">>>;
733
776
  profileId: z.ZodOptional<z.ZodString>;
734
777
  costUsd: z.ZodOptional<z.ZodNumber>;
735
778
  synthetic: z.ZodOptional<z.ZodLiteral<"continuation">>;
@@ -749,6 +792,7 @@ export declare const runRecordSchema: z.ZodObject<{
749
792
  claude: "claude";
750
793
  codex: "codex";
751
794
  cursor: "cursor";
795
+ omp: "omp";
752
796
  opencode: "opencode";
753
797
  pi: "pi";
754
798
  }>>;
@@ -1090,11 +1134,20 @@ export declare function parseRunRecords(raw: unknown): z.ZodSafeParseResult<{
1090
1134
  deliveredAt?: string | undefined;
1091
1135
  } | undefined;
1092
1136
  lastCiWaitError?: string | undefined;
1137
+ previewServers?: {
1138
+ port: number;
1139
+ command: string;
1140
+ cwd?: string | undefined;
1141
+ label: string;
1142
+ path?: string | undefined;
1143
+ registeredAt: string;
1144
+ answeredAtRegistration: boolean;
1145
+ }[] | undefined;
1093
1146
  taskImages?: string[] | undefined;
1094
1147
  model?: string | undefined;
1095
1148
  effort?: string | undefined;
1096
1149
  modelIdentity?: string | undefined;
1097
- runner?: "claude" | "codex" | "cursor" | "opencode" | "pi" | undefined;
1150
+ runner?: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi" | undefined;
1098
1151
  agentProfile?: string | undefined;
1099
1152
  systemPrompt?: string | undefined;
1100
1153
  generateFollowups?: boolean | undefined;
@@ -1111,6 +1164,18 @@ export declare function parseRunRecords(raw: unknown): z.ZodSafeParseResult<{
1111
1164
  event: string;
1112
1165
  githubUrl: string;
1113
1166
  } | undefined;
1167
+ automationTrigger?: {
1168
+ automationId: string;
1169
+ automationRevision: number;
1170
+ receiptId: string;
1171
+ trigger: "catch-up" | "manual" | "schedule";
1172
+ occurrenceAt: string;
1173
+ } | undefined;
1174
+ destroyRetry?: {
1175
+ attempts: number;
1176
+ nextAt: string;
1177
+ needsAttention?: true | undefined;
1178
+ } | undefined;
1114
1179
  status: "cancelled" | "done" | "failed" | "queued" | "review" | "running" | "waiting";
1115
1180
  stopping?: boolean | undefined;
1116
1181
  activity?: "monitoring" | undefined;
@@ -1144,6 +1209,13 @@ export declare function parseRunRecords(raw: unknown): z.ZodSafeParseResult<{
1144
1209
  branch?: string | undefined;
1145
1210
  baseBranch?: string | undefined;
1146
1211
  worktreeReclaimedAt?: string | undefined;
1212
+ worktreeSetup?: {
1213
+ status: "done" | "failed" | "running";
1214
+ startedAt: string;
1215
+ finishedAt?: string | undefined;
1216
+ durationMs?: number | undefined;
1217
+ error?: string | undefined;
1218
+ } | undefined;
1147
1219
  groupId?: string | undefined;
1148
1220
  variant?: string | undefined;
1149
1221
  clientRequestId?: string | undefined;
@@ -1176,7 +1248,7 @@ export declare function parseRunRecords(raw: unknown): z.ZodSafeParseResult<{
1176
1248
  finishedAt?: string | undefined;
1177
1249
  error?: string | undefined;
1178
1250
  sessionId?: string | undefined;
1179
- backend?: "claude" | "codex" | "cursor" | "opencode" | "pi" | undefined;
1251
+ backend?: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi" | undefined;
1180
1252
  profileId?: string | undefined;
1181
1253
  costUsd?: number | undefined;
1182
1254
  synthetic?: "continuation" | undefined;
@@ -1192,7 +1264,7 @@ export declare function parseRunRecords(raw: unknown): z.ZodSafeParseResult<{
1192
1264
  model?: string | undefined;
1193
1265
  effort?: string | undefined;
1194
1266
  timeoutMs?: number | undefined;
1195
- runner?: "claude" | "codex" | "cursor" | "opencode" | "pi" | undefined;
1267
+ runner?: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi" | undefined;
1196
1268
  agentProfile?: string | undefined;
1197
1269
  allowedTools?: string[] | undefined;
1198
1270
  bashAllowlist?: string[] | undefined;
@@ -1206,6 +1278,18 @@ export declare function parseRunRecords(raw: unknown): z.ZodSafeParseResult<{
1206
1278
  path?: string | undefined;
1207
1279
  } | undefined;
1208
1280
  }[]>;
1281
+ /** One stored record and what its JSON holds beyond the runtime schema (raw-record.ts), which
1282
+ * the next write of its row puts back. */
1283
+ export interface DecodedRun {
1284
+ run: RunRecord;
1285
+ extras: RawExtras | undefined;
1286
+ }
1287
+ /** One database row's `data` back into a record and its extras. Undefined when it does not parse:
1288
+ * one unreadable row costs that row only. */
1289
+ export declare function decodeRunRow(data: string): DecodedRun | undefined;
1290
+ /** One database row's `data` back into a record, for a reader that never writes it back. */
1291
+ export declare function decodeRunRecord(data: string): RunRecord | undefined;
1292
+ export { LEGACY_INDEX_BACKUP_FILE, LEGACY_INDEX_FILE } from './legacy-index.ts';
1209
1293
  export type StepState = z.infer<typeof stepStateSchema>;
1210
1294
  export type QueuedMessage = z.infer<typeof queuedMessageSchema>;
1211
1295
  export type RunRecord = z.infer<typeof runRecordSchema>;
@@ -1217,6 +1301,10 @@ export interface RunEvent {
1217
1301
  type: string;
1218
1302
  [key: string]: unknown;
1219
1303
  }
1304
+ /** How many archived root runs the run lists carry per project (#864): `GET /run-summaries?archived=recent`
1305
+ * and `GET /workspace/runs-index`. Unarchived runs are never cut; older archived runs page in
1306
+ * through `GET /run-summaries/archived` and the workspace search. */
1307
+ export declare const ARCHIVED_WINDOW = 200;
1220
1308
  /** The repository a project IS, as `resolveRepoHandle` reports it. `null`/absent means "unknown",
1221
1309
  * which is a real and common state (no `gh`, no remote, a non-git root) — never an error. */
1222
1310
  export type RepoHandle = {
@@ -1239,6 +1327,18 @@ export type RepoHandle = {
1239
1327
  export declare function reconcileLoadedRun(run: RunRecord, opts?: {
1240
1328
  keepLive?: boolean;
1241
1329
  }): RunRecord;
1330
+ /**
1331
+ * Settle a live run whose owning process died, when a control adopts it (#779, plan step 3), so
1332
+ * that adopting never starts agent work: only Continue may, with the user's own input. A run that
1333
+ * never started is cancelled before it began, which Continue restarts as it would after a Stop (the
1334
+ * same "untouched" test as `isUntouchedCancelledRun`); any other live run is interrupted, exactly as
1335
+ * an open that does not recover settles it, and Continue resumes its last session. With `stop`
1336
+ * (the control is Stop, and this is its run) a live run is cancelled instead, as an accepted Stop
1337
+ * always reads. Mutates `run`.
1338
+ */
1339
+ export declare function settleOrphanedRun(run: RunRecord, opts?: {
1340
+ stop?: boolean;
1341
+ }): RunRecord;
1242
1342
  /**
1243
1343
  * Drop this run's referenced PR/issue if the project's handle proves it foreign and the prompt
1244
1344
  * does not corroborate it (#945). Returns whether anything changed.
@@ -1248,25 +1348,314 @@ export declare function reconcileLoadedRun(run: RunRecord, opts?: {
1248
1348
  * format is untouched and whose cleared fields were already optional.
1249
1349
  */
1250
1350
  export declare function rescopeRun(run: RunRecord, handle?: RepoHandle | null): boolean;
1351
+ export declare function __setLegacyImportHookForTests(hook?: {
1352
+ beforeTransaction?: () => void;
1353
+ beforeCommit?: () => void;
1354
+ }): void;
1355
+ /** What branch cleanup and git-log attribution read about a run (`RunStore.listBranchOwners`). */
1356
+ export interface BranchOwner {
1357
+ id: string;
1358
+ title: string;
1359
+ status: RunStatus;
1360
+ archived: boolean;
1361
+ createdAt: string;
1362
+ /** The branch the run owns (see `encodeRunRow`); absent for a run listed for its PR alone. */
1363
+ branch?: string;
1364
+ baseBranch?: string;
1365
+ pullRequestUrl?: string;
1366
+ }
1367
+ /** A record as a branch owner, or undefined when it owns no branch and created no PR: the
1368
+ * projection `listBranchOwners` reads off a row's summary and columns, computed from memory. */
1369
+ export declare function branchOwnerOf(run: RunRecord): BranchOwner | undefined;
1370
+ /** Who may hold a run in memory besides its own record (see `RunStore.pin`). `maintenance` is the
1371
+ * RunManager's publish, worktree-reclaim and branch-cleanup claims, held across their async work. */
1372
+ export type RunPinHolder = 'active' | 'continue' | 'cleanup' | 'maintenance';
1373
+ /**
1374
+ * Who may change a run, as this store sees it (#779, plan step 3; `RunStore.runOwnership`):
1375
+ * - `held`: this store claims its delegation family;
1376
+ * - `free`: no live process claims it and nothing in its family is live; a write takes it. A
1377
+ * proven-dead owner's claim on such a family counts for nothing: there is nothing to recover;
1378
+ * - `orphaned`: nobody alive owns a family that still has a live run (its owner died, or nobody
1379
+ * claimed it): taking it means adopting it first (`RunStore.adoptFamily` settles it, then the
1380
+ * manager recovers the family);
1381
+ * - `foreign`: another process that is alive (or cannot be proven dead) holds it: read-only here;
1382
+ * - `quarantined`: a write found it changed under this store; refused until cezar restarts.
1383
+ */
1384
+ export type RunOwnership = 'held' | 'free' | 'orphaned' | 'foreign' | 'quarantined';
1385
+ /** The one answer every control gives for a run another cezar process owns (`409 { error }`). */
1386
+ export declare const RUN_IN_USE_ELSEWHERE = "run is in use by another cezar process";
1387
+ /** The answer for a run this process stopped writing after a conflicting write. */
1388
+ export declare const RUN_QUARANTINED = "run changed under this cezar process \u2014 restart cezar to reload it";
1389
+ /** A write this store must not make: another process owns the run, its owner died with work
1390
+ * still live (adopt it first), or a conflict quarantined it. Nothing was changed. */
1391
+ export declare class RunWriteRefusedError extends Error {
1392
+ readonly runId: string;
1393
+ readonly ownership: Exclude<RunOwnership, 'held' | 'free'>;
1394
+ constructor(runId: string, ownership: Exclude<RunOwnership, 'held' | 'free'>);
1395
+ }
1396
+ /** Newest first, runs created in the same millisecond in insertion order: the order `runs.db`
1397
+ * lists in, and the order every list had while it was a stable sort of the in-memory map. */
1398
+ /** Why a `run` event fired, when a delegation checkpoint caused it (in-process only). */
1399
+ export type CommitSource = 'delegation-checkpoint' | 'delegation-destroy-progress';
1400
+ /**
1401
+ * A stored summary, or undefined when the row holds none (a row seeded without one, or text that
1402
+ * is not a summary): the caller then projects the record instead. The column is written only by
1403
+ * `encodeRunRow`, from a record the schema accepted, so this checks the shape a list row cannot
1404
+ * do without rather than running the full contract schema — on a cockpit's thousand rows that
1405
+ * schema costs more than reading them. The cold reader (`run-index.ts`), which reads other
1406
+ * projects' databases, still validates in full.
1407
+ */
1408
+ export declare function parseStoredSummary(text: string): RunSummary | undefined;
1409
+ /** The bulk-archive sweep's one predicate (#780): finished, not archived, not scheduled (a
1410
+ * `failed` run waiting out a usage limit), not an owned worker (those leave with their parent),
1411
+ * then filtered by pin state. Mirrored clause for clause by `isSweepable` in the cockpit's
1412
+ * `lib/tasks-table.ts`. */
1413
+ export declare function isSweepable(run: Pick<RunRecord, 'archived' | 'status' | 'autoResumeAt' | 'pinned'> & {
1414
+ delegation?: {
1415
+ role: string;
1416
+ };
1417
+ }, scope?: ArchiveFinishedScope): boolean;
1251
1418
  /**
1252
- * File-backed run store: `runs.json` index (atomic tmp+rename writes, the
1253
- * pattern from @cezar/core's IssueStore) plus one append-only NDJSON event
1254
- * file per run. Also the in-process event bus the SSE endpoints subscribe to:
1255
- * emits `('run', RunRecord)` and `('event', { runId, event: RunEvent })`.
1419
+ * File-backed run store: one row per run in `runs.db` (#779, `./run-database.ts`) plus one
1420
+ * append-only NDJSON event file per run. Also the in-process event bus the SSE endpoints
1421
+ * subscribe to: emits `('run', RunRecord)` and `('event', { runId, event: RunEvent })`.
1422
+ *
1423
+ * Only the held set lives in memory (#779, Amendment 2): live runs, the runs a RunManager pins,
1424
+ * their delegation families, and runs whose latest write has not settled yet (see `isHeld`).
1425
+ * `getRun` answers a held run with the held object, so `commitIndex` still installs into the
1426
+ * record a caller holds; any other run is read from `runs.db` as a fresh copy every time (frozen
1427
+ * under vitest, so an in-place write throws instead of being lost). Writes to a finished run go
1428
+ * through the methods here, which load it, change it and persist the row like any other.
1429
+ *
1430
+ * Two write paths, both through `writeIndex`:
1431
+ * - optimistic: a method changes the held record, marks it dirty and schedules the debounced
1432
+ * save, which writes the dirty rows and deletions only;
1433
+ * - durable (`commitIndex`): one transaction with the changed rows AND everything a debounced
1434
+ * save still owes. Only once it commits do the records change in memory, and only then do
1435
+ * subscribers hear about it.
1436
+ *
1437
+ * Several processes may open one project (`serve` and a headless `cez run`), so a store writes
1438
+ * only the delegation families it claims in `run_claims` (#779, plan step 3; `run-claims.ts`).
1439
+ * Everything it holds is claimed: open claims the live rows nobody alive owns and leaves the rest
1440
+ * alone, and a write to a run not in memory claims its family first, or refuses it while another
1441
+ * live process owns it. Claims are released once a family leaves memory, and all of them on
1442
+ * `close()`; a crashed owner's are taken over only once it is proven dead. Every write is fenced
1443
+ * in its transaction: if a row is not as this store last saw it, or its claim is gone, nothing is
1444
+ * written, the evidence goes to `run_conflicts` and this store stops writing that row
1445
+ * (`handleConflicts`).
1256
1446
  */
1257
1447
  export declare class RunStore extends EventEmitter {
1258
1448
  private readonly dataDir;
1259
- private runs;
1449
+ /** The held set: every record this store keeps in memory, by id. */
1450
+ private readonly held;
1451
+ /** Who holds a run beyond its record, by holder, so one holder's unpin never releases another. */
1452
+ private readonly pins;
1453
+ /** Staged ids while a durable commit installs and announces them: never evicted mid-commit. */
1454
+ private readonly committing;
1260
1455
  private saveTimer;
1456
+ /** `null` once the store is closed, and in a `RunStore.unavailable` store (nothing is written,
1457
+ * nothing is evicted). */
1458
+ private db;
1459
+ /** Why `open` failed, in a `RunStore.unavailable` store. */
1460
+ private openFailure;
1461
+ /** Runs whose held record is ahead of its row; the next save or commit writes them. */
1462
+ private readonly dirty;
1463
+ /** Runs gone from memory whose rows the next save or commit deletes. */
1464
+ private readonly deleted;
1465
+ /** Deleted runs whose history files (events, handoff, images, artifacts) go once the delete of
1466
+ * their row commits: until then a conflict can undo the delete and bring the row back. */
1467
+ private readonly historyOwed;
1261
1468
  /** The repository this project IS (#945), armed after `open()` by `setRepoHandle`. Undefined
1262
1469
  * until it arrives and `null` when it cannot be known — both mean "unscoped", which is
1263
1470
  * exactly the pre-#945 behavior. */
1264
1471
  private repoHandle;
1472
+ /** `open()`'s `keepLive`, which a run read later from `runs.db` is reconciled with too. */
1473
+ private keepLive;
1474
+ /** This store's identity in `run_claims`; undefined without a database. */
1475
+ private owner;
1476
+ /** The families this store claims, with the generation each acquisition got. */
1477
+ private readonly claimed;
1478
+ /** Families judged free whose claim a busy database kept this store from taking: the next write
1479
+ * of their rows takes it in its own transaction, if it is still as judged (null: absent). */
1480
+ private readonly pendingClaims;
1481
+ /** The revision and `data` of each held row (and pending deletion) as this store last read or
1482
+ * wrote it: what a write is fenced against, and a conflict's "original". No entry: this store
1483
+ * created the row and has not written it yet. `extras` is what that `data` holds beyond the
1484
+ * schema, which the next write of the row puts back (raw-record.ts). */
1485
+ private readonly base;
1486
+ /** Rows read cold in the current synchronous turn, so a commit staged from one is fenced against
1487
+ * the version it was computed from. `owned`: its family was already this store's when read.
1488
+ * Cleared at the next microtask: no commit spans a turn. */
1489
+ private readonly coldBase;
1490
+ /** The family of each pending deletion, whose claim the deleting write is fenced against. */
1491
+ private readonly deletedFamilies;
1492
+ /** Rows a conflicting write excluded: this store refuses to write them until it is reopened. */
1493
+ private readonly quarantined;
1494
+ /** Rows whose `data` this store tried to decode and could not: left in the database untouched,
1495
+ * and left out of the list rows from then on, as the cold reader leaves them out (run-index.ts). */
1496
+ private readonly unreadable;
1497
+ /** Background one-at-a-time compressor for archived transcripts (#818). */
1498
+ private readonly compressor;
1499
+ /** Transcript facts the delegation paths ask about, so they never re-read a transcript (#880). */
1500
+ private readonly facts;
1265
1501
  private constructor();
1266
- /** See `reconcileLoadedRun` for what `keepLive` (#367) decides about live-looking rows. */
1502
+ /**
1503
+ * Open the project's run store. See `reconcileLoadedRun` for what `keepLive` (#367) decides
1504
+ * about live-looking rows.
1505
+ *
1506
+ * Reads `runs.db` once its import is complete. Before that, `runs.json` is imported into it in
1507
+ * one transaction (`importLegacyIndex`) and left exactly as it was, for older cezars to read.
1508
+ * Either way only the held set is decoded: the live rows (by the indexed `live` column), the
1509
+ * few finished rows a normalization still repairs, and the delegation families of the live
1510
+ * ones.
1511
+ *
1512
+ * A store that cannot be opened is never an empty one (#779, plan step 4): `open` throws a
1513
+ * `RunStoreOpenError` naming the cause, and nothing is reset, restored or deleted. `retryBusy`
1514
+ * waits out a busy database (and a cockpit that may still be importing) with growing pauses,
1515
+ * about 3.5 s in all, before it gives up. Open is synchronous, so the wait blocks this thread:
1516
+ * only a boot passes it, while nothing else runs yet. Without it a busy database fails after
1517
+ * one busy timeout.
1518
+ */
1267
1519
  static open(dataDir: string, opts?: {
1268
1520
  keepLive?: boolean;
1521
+ retryBusy?: boolean;
1269
1522
  }): RunStore;
1523
+ private static openOnce;
1524
+ /**
1525
+ * The store `serve` keeps for its boot project when `open` failed: no database, nothing held,
1526
+ * and every attempt to create or save a run refused with `failure`. The cockpit answers every
1527
+ * route of that project with `failure`'s message, and boot skips everything that would read
1528
+ * its empty run list as "no runs" (orphan pruning, retention, recovery, scratch sweeps). The
1529
+ * way out is a restart once the cause is gone.
1530
+ */
1531
+ static unavailable(dataDir: string, failure: RunStoreOpenError): RunStore;
1532
+ /** Why this store has no database, when it is `RunStore.unavailable`'s: its runs are unknown,
1533
+ * not absent. */
1534
+ get unavailable(): RunStoreOpenError | undefined;
1535
+ /**
1536
+ * Open-time load: the live rows, the finished rows a load normalization repairs, then the
1537
+ * delegation families of the live ones. A row that does not parse is skipped and left in the
1538
+ * database untouched; one warning says how many.
1539
+ *
1540
+ * Only rows this store can claim are loaded (#779, plan step 3). A live row whose family another
1541
+ * live process claims — `serve`'s parked run, seen by a headless `cez run` — is that process's:
1542
+ * it is not loaded, normalized or recovered here, and stays readable through `getRun` and the
1543
+ * list rows. A live row nobody alive claims is taken over, as before: this open recovers it
1544
+ * (`keepLive`) or settles it as interrupted.
1545
+ */
1546
+ private loadHeldRows;
1547
+ /** Normalize a record just read from `row` (see `reconcileLoadedRun`) and hold it. Marks the row
1548
+ * dirty only when normalization changed it, so the next save persists exactly the runs open()
1549
+ * rewrote. The caller has claimed the row's family. */
1550
+ private adoptLoadedRun;
1551
+ /**
1552
+ * Hold one delegation family: its root and the root's direct workers, read through the
1553
+ * `parent_run_id` index. No recursion: workers cannot delegate, so a worker's own id never
1554
+ * names a family. The caller has claimed it. `settle` settles its live rows instead of keeping
1555
+ * them for recovery (`settleOrphanedRun`); `stopId` is the run a Stop settles as cancelled.
1556
+ */
1557
+ private holdFamily;
1558
+ /**
1559
+ * Make sure this store claims each of `families`, taking every one no live process holds, and
1560
+ * return the ones it now holds. Liveness is judged here (`claimOwnerLive`), outside the write
1561
+ * transaction; `takeClaims` then takes a claim only if it is still exactly what was judged.
1562
+ *
1563
+ * `allowLive` also takes a family that still has a live row although no live process owns it.
1564
+ * Open and `adoptFamily` pass it, because recovery follows both, and so does a write moving a
1565
+ * run this store holds into a new family (a worker quarantined to `invalid` becomes its own):
1566
+ * an ordinary write must not quietly inherit a dead process's live run and leave it unrecovered.
1567
+ * `wait` retries a busy database instead of leaving the claim to the next write: recovery
1568
+ * cannot start without it.
1569
+ */
1570
+ private claimFamilies;
1571
+ /** `takeClaims`, retried while another connection holds the write lock (each try waits out the
1572
+ * busy timeout), then the busy error. */
1573
+ private takeClaims;
1574
+ /** Release the claim of every family with nothing left in memory, once nothing is pending: a
1575
+ * failed save keeps its families claimed until it succeeds. A failed release retries at the
1576
+ * next sweep; `close()` releases the rest. */
1577
+ private releaseUnheldClaims;
1578
+ /**
1579
+ * Who may change this run right now (see `RunOwnership`), or undefined when there is no such
1580
+ * run. Read-only: nothing is claimed. Controls ask this first, so a run another process owns is
1581
+ * refused with `RUN_IN_USE_ELSEWHERE` and a dead process's run is adopted before it is changed.
1582
+ */
1583
+ runOwnership(id: string): RunOwnership | undefined;
1584
+ /** Why a control on this run must be refused here, or undefined when this store may change it. */
1585
+ writeRefusal(id: string): string | undefined;
1586
+ /**
1587
+ * Take over the delegation family of an `orphaned` run for a control: claim it from its dead
1588
+ * owner (or from nobody), then load it and settle its live rows (`settleOrphanedRun`) — never
1589
+ * keep them for recovery to resume, since only Continue may start agent work. With `stop` the
1590
+ * control is Stop: `id` itself is settled as cancelled rather than interrupted. Returns the
1591
+ * family's root id, or undefined when a live owner holds it after all or it is gone. The caller
1592
+ * runs recovery for that family next (`RunManager.adoptOrphanedRun`), which then repairs it.
1593
+ */
1594
+ adoptFamily(id: string, opts?: {
1595
+ stop?: boolean;
1596
+ }): string | undefined;
1597
+ /** Every run whose family another process owns — alive, or dead with a live run left to
1598
+ * recover (cleanup keeps their scratch: it is theirs, or recovery's once someone adopts them).
1599
+ * A dead owner's claim on a family with nothing live is no claim (see `runOwnership`). */
1600
+ listForeignClaimedRunIds(): string[];
1601
+ /**
1602
+ * Whether a held run anchors itself (and its family) in memory. Anything else held is a family
1603
+ * member or a settled write, and leaves at the next sweep (`evictSettled`).
1604
+ *
1605
+ * The held set is: every run that is live (`isLiveRecord`), pinned by a RunManager (`pin`),
1606
+ * dirty, or inside a durable commit; plus the whole delegation family (root and direct
1607
+ * workers) of any such run. Families are held because the RunManager reads a live run's family
1608
+ * on every run event — `GET /runs/:id/relationships`, the global `reconcileWorkerWaits` pass
1609
+ * (about twenty call sites), completion blockers and conversations — and decoding a cold
1610
+ * record costs about 200 µs (JSON.parse plus the schema). Measured on a copy of a real
1611
+ * cockpit's `runs.json` (958 runs, 957 of them delegated): a running root with 26 workers
1612
+ * paid about 5 ms per family read, and the live families together about 10 ms per global
1613
+ * pass, all on the event loop. Holding them costs memory in proportion to active work, not to
1614
+ * history.
1615
+ */
1616
+ private isAnchor;
1617
+ /** The family roots with an anchoring member in memory. */
1618
+ private anchoredFamilies;
1619
+ /** Drop every held run that is neither an anchor nor in an anchored family. A store without a
1620
+ * database keeps everything: memory is the only copy it has. */
1621
+ private evictSettled;
1622
+ /** A run read from `runs.db`, normalized like a loaded one (`reconcileLoadedRun`, then the
1623
+ * repository scope) but held by nobody. Undefined when absent, deleted or unreadable. */
1624
+ private loadCold;
1625
+ private decodeCold;
1626
+ /** Hold a run just decoded from its row: the object every later read and write shares. */
1627
+ private holdDecoded;
1628
+ /**
1629
+ * Bring a run into memory and return the held object: the record a write changes in place.
1630
+ * It leaves again at the first sweep after its write settles, unless something anchors it.
1631
+ * Its family is claimed first, then the row is read, so the version held is the claimed one;
1632
+ * undefined while another process owns it (see `claimFamilies`).
1633
+ */
1634
+ private hold;
1635
+ /** The record a store write changes in place: held, or loaded to be. Undefined for a run this
1636
+ * store may not write (another process's, or quarantined), so the write changes nothing. */
1637
+ private record;
1638
+ /** The current record for reading: the held object, the held copy of a run whose family is in
1639
+ * memory, or else a fresh copy nobody holds. */
1640
+ private peek;
1641
+ /**
1642
+ * A run just read off its row, as reads answer it: held when its family is in memory (a live
1643
+ * family's members are read on every run event), else a copy nobody holds — frozen under
1644
+ * vitest when it leaves the store (`freeze`).
1645
+ */
1646
+ private answerCold;
1647
+ /** `getRun` for a row a query already read: the held object, else decoded from `row`. */
1648
+ private fromRow;
1649
+ /** Whether the run exists, held or not, without decoding it. */
1650
+ private hasRun;
1651
+ /**
1652
+ * Keep a run in memory for `holder` until `unpin(id, holder)`: a RunManager pins the runs it is
1653
+ * executing (`active`) and the run a Continue is admitting (`continue`). A finished run is
1654
+ * loaded. Pins are per holder, so releasing one never releases another. Returns the held record.
1655
+ */
1656
+ pin(id: string, holder: RunPinHolder): RunRecord | undefined;
1657
+ /** Release `holder`'s pin. The run leaves memory at the next sweep once nothing else holds it. */
1658
+ unpin(id: string, holder: RunPinHolder): void;
1270
1659
  /**
1271
1660
  * Tell the store which repository this project IS (#945), so the referenced tier stops adopting
1272
1661
  * another repo's PR/issue as the task's subject. See `isRepoScopedRef` for the rule.
@@ -1279,21 +1668,136 @@ export declare class RunStore extends EventEmitter {
1279
1668
  * Arming also HEALS records already poisoned by the un-scoped rule, on the `reconcileLoadedRun`
1280
1669
  * precedent: the evidence is all still on the record (`referenced*Candidates`), only the
1281
1670
  * conclusion drawn from it was wrong, so re-deciding beats asking for a migration. It rewrites
1282
- * values, never the format, and is one-directional by construction — see `rescopeRun`.
1671
+ * values, never the format, and is one-directional by construction — see `rescopeRun`. Held
1672
+ * runs are re-checked in memory; of the rest, only rows whose stored summary references another
1673
+ * repository are decoded, and the healed ones are written, so their summaries heal too.
1283
1674
  */
1284
1675
  setRepoHandle(handle: RepoHandle | null): void;
1676
+ /** Whether the stored summary still names a reference the scoped record no longer has. */
1677
+ private storedScopeDiffers;
1678
+ /**
1679
+ * The live set, newest first: runs whose record is live (`isLiveRecord`) or that a RunManager
1680
+ * pins. Finished runs are not here — read one by id (`getRun`), by an indexed query
1681
+ * (`listWorkersOf`, `findRunByClientRequestId`, `listGroupRuns`, `listRunsWithWorktree`,
1682
+ * `listBranchOwners`), or as list rows (`listRunSummaries`).
1683
+ */
1285
1684
  listRuns(): RunRecord[];
1685
+ /** Where a held run lists: its row's insertion order, or after every row while this store has
1686
+ * not written it yet. The held set keeps such runs in creation order, and so does every list
1687
+ * that sorts them in held-set order (`sortNewestFirst` is stable). */
1688
+ private listOrder;
1689
+ /**
1690
+ * EVERY run as a full record, newest first — decoded row by row. Only the legacy `GET /runs`
1691
+ * (older clients; the cockpit reads `GET /run-summaries`) may call this: it is exactly the
1692
+ * whole-history parse #779 exists to remove from everything else.
1693
+ */
1694
+ listAllRunsForLegacyRoute(): RunRecord[];
1695
+ /**
1696
+ * Every run as its list row, newest first: the stored `summary` column, with each held run's
1697
+ * own projection laid over it — a debounced save keeps memory up to 300 ms ahead of the row,
1698
+ * and a run created since the last save has no row yet. `usage` is the caller's to attach.
1699
+ *
1700
+ * With `archivedWindow` (#864), the window the cockpit's lists read: every unarchived run, plus
1701
+ * the newest `archivedWindow` archived ROOT runs, and whether older archived roots were left
1702
+ * out. Archived workers are never in it (see `RunDatabase.listWindowSummaries`); with `roots`,
1703
+ * no worker is — the runs index, whose readers list no workers. A held run
1704
+ * lists by its record, so one archived or unarchived since the last save is ranked as it is now.
1705
+ *
1706
+ * A row this store found unreadable is left out, as the cold reader leaves out a row it had to
1707
+ * decode and could not. A finished row nobody has decoded is served from its summary by both,
1708
+ * which decodes nothing; reading it is what finds out (`isUnreadable`).
1709
+ */
1710
+ listRunSummaries(options?: {
1711
+ archivedWindow?: number;
1712
+ roots?: boolean;
1713
+ }): {
1714
+ runs: RunSummary[];
1715
+ truncated: boolean;
1716
+ };
1717
+ /**
1718
+ * One page of archived ROOT runs, newest first (#864): `GET /run-summaries/archived`, the
1719
+ * archived runs past the window. Held runs list by their record, as in `listRunSummaries`.
1720
+ * `before` is the previous page's `nextCursor`; with `q`, only runs `matchesRunQuery` keeps, and
1721
+ * `total` counts those. A cursor this store did not write answers `{ error }`.
1722
+ *
1723
+ * Ranking reads every archived root's key (id, created_at, seq: no record, no summary), so the
1724
+ * page and `total` agree with the held overlay; only the page's own rows are read in full.
1725
+ */
1726
+ listArchivedRuns(options: {
1727
+ before?: string;
1728
+ limit: number;
1729
+ q?: string;
1730
+ }): ArchivedRunsResponse | {
1731
+ error: string;
1732
+ };
1733
+ /**
1734
+ * The ROOT runs, archived or not, that match `query` (`matchesRunQuery`), newest first: at most
1735
+ * `limit`, and whether more matched. The owned half of the workspace search (#864); held runs
1736
+ * match by their record.
1737
+ */
1738
+ searchRunSummaries(query: string, limit: number): {
1739
+ runs: RunSummary[];
1740
+ truncated: boolean;
1741
+ };
1742
+ /** A row whose stored summary does not fit the contract any more, projected from its record. */
1743
+ private coldSummary;
1744
+ /**
1745
+ * The run, or undefined. A held run is the held object (writes install into it). Any other run
1746
+ * is a fresh copy of its row each call, normalized like a loaded record — frozen under vitest —
1747
+ * so changing it means a store method, never an assignment.
1748
+ */
1286
1749
  getRun(id: string): RunRecord | undefined;
1750
+ /** Whether the run's row is in `runs.db` but its record could not be read here: what tells a
1751
+ * run that cannot open from one that does not exist. Known once something tried to read it. */
1752
+ isUnreadable(id: string): boolean;
1753
+ /** The ids in memory right now: the held set, for diagnostics and the benchmark's heap pass. */
1754
+ heldIds(): string[];
1287
1755
  /**
1288
1756
  * The workers a root run owns, newest first, read off its own `receipts` (#659). Every
1289
1757
  * `createOwnedRun` writes the receipt and the worker record in one transaction, and the
1290
- * receipt list is capped at 32, so this is a bounded lookup rather than a walk of the whole
1758
+ * receipt list is capped at 1,024 creations (#816), so this is a bounded lookup rather than a walk of the whole
1291
1759
  * project index. An ordinary or worker run owns nothing and costs one map read; a receipt
1292
1760
  * whose record has been deleted is skipped, never invented. A parent quarantined to
1293
1761
  * `invalid` has no readable receipts and reports none, which is also what the cockpit
1294
1762
  * assumes for that role.
1295
1763
  */
1296
1764
  listOwnedWorkers(parentId: string): RunRecord[];
1765
+ /** Every worker filed under `parentId` (the `parent_run_id` index plus memory), newest first:
1766
+ * receipts or not, which is what the reconcile and deletion checks ask. */
1767
+ listWorkersOf(parentId: string): RunRecord[];
1768
+ /** The id of every worker, held or stored, without decoding any (recovery's worker passes). */
1769
+ listWorkerIds(): string[];
1770
+ /** The id of every run whose delegation is quarantined (`invalid`), held or stored: its stored
1771
+ * summary says so, so nothing is decoded (scratch cleanup). */
1772
+ listQuarantinedRunIds(): string[];
1773
+ /**
1774
+ * The runs automation receipts launched, by receipt id (`automation.receiptId` or
1775
+ * `automationTrigger.receiptId`). Memory answers first; a receipt it does not know costs one
1776
+ * pass over `runs.db` that reads the records' JSON in SQLite — only a crash leftover (a
1777
+ * receipt still `reserved` at startup) ever asks.
1778
+ */
1779
+ findRunIdsByAutomationReceipt(receiptIds: readonly string[]): Map<string, string>;
1780
+ /** The id of every root whose delegation carries a conversation, held or stored: recovery's
1781
+ * full reconcile pass (#661). The stored summary names the role, so only roots' records are
1782
+ * read, in SQLite. */
1783
+ listConversationRootIds(): string[];
1784
+ /** The id of every run, held or stored, without decoding any (orphan-worktree sweeps). */
1785
+ listRunIds(): string[];
1786
+ /** The members of one parallel-variant group (spec 010), in no particular order. */
1787
+ listGroupRuns(groupId: string): RunRecord[];
1788
+ /** Runs with a materialized worktree directory (`worktreePath`, not reclaimed), most recently
1789
+ * finished first, then newest first: worktree retention and the worktrees panel. */
1790
+ listRunsWithWorktree(): RunRecord[];
1791
+ /**
1792
+ * Every run that owns a branch or names the PR it created, as the few fields branch cleanup and
1793
+ * git-log attribution read (issue 08 §B3, §B5; a squash commit is attributed by its PR number):
1794
+ * the stored summary plus the `branch` and `base_branch` columns, so a Git-tab request decodes
1795
+ * no record. Held runs answer from memory.
1796
+ */
1797
+ listBranchOwners(): BranchOwner[];
1798
+ /** The rows a column query returned, as records, with memory laid over them: a held run
1799
+ * answers from memory (matching `matches` there, not on its maybe-older row). */
1800
+ private queryRuns;
1297
1801
  /** The run an idempotent start already created (#504), archived or not. A deleted run is gone
1298
1802
  * with its record, so a retry after deletion honestly creates a fresh one. */
1299
1803
  findRunByClientRequestId(clientRequestId: string): RunRecord | undefined;
@@ -1369,6 +1873,10 @@ export declare class RunStore extends EventEmitter {
1369
1873
  id: string;
1370
1874
  delegation: DelegationState;
1371
1875
  }>): void;
1876
+ /** A pending destroy's automatic retry state, or its removal (hearsay-tools/cezarion#879). Kept on
1877
+ * the record beside the strict delegation, so an older cezar strips it rather than quarantining the
1878
+ * worker. Destroy progress: nothing the family reconcile reads changes. */
1879
+ commitDestroyRetry(id: string, retry: WorkerDestroyRetry | undefined): void;
1372
1880
  /** Accepted execution revision is public lifecycle identity, separate from process generations. */
1373
1881
  commitWorkerContinuation(id: string, patch: Partial<Omit<RunRecord, 'id' | 'steps' | 'delegation'>>, step?: Pick<StepState, 'id' | 'name' | 'kind' | 'synthetic'>, conversation?: {
1374
1882
  rootId: string;
@@ -1380,16 +1888,39 @@ export declare class RunStore extends EventEmitter {
1380
1888
  private readWorkerResultFile;
1381
1889
  readWorkerResult(parentId: string, workerId: string): WorkerCollectedResult | undefined;
1382
1890
  readWorkerResultDiff(parentId: string, workerId: string): string | undefined;
1383
- /** Publish a pointer only after its redacted immutable snapshot reaches disk. Failed index writes retain the old evidence. */
1384
- commitWorkerResult(parentId: string, value: WorkerCollectedResult, diffSnapshot?: string): WorkerCollectedResult;
1891
+ /** Publish a pointer only after its redacted immutable snapshot reaches disk. Failed index writes retain the old evidence.
1892
+ * A result whose evidence is already stored returns the stored one and writes nothing; `ignoreCleanup` is for a
1893
+ * caller that only needs the payload durable, whatever cleanup phase the stored copy names. */
1894
+ commitWorkerResult(parentId: string, value: WorkerCollectedResult, diffSnapshot?: string, opts?: {
1895
+ ignoreCleanup?: boolean;
1896
+ }): WorkerCollectedResult;
1385
1897
  /**
1386
1898
  * requestHash is supplied only by the trusted service: hash the ORIGINAL normalized request,
1387
1899
  * before resolving refs. A retry keeps the original worker and pinned SHA even if HEAD moved.
1388
1900
  * workspace.ownerRunId is the trusted service's preallocated worker UUID.
1389
1901
  */
1390
1902
  createOwnedRun(input: Parameters<RunStore['createRun']>[0], parentId: string, requestId: string, worker: DelegationState, requestHash: string, executionIdentity?: WorkerExecutionIdentity): RunRecord;
1391
- /** Atomic file replacement is the durability boundary; flush() is deliberately best-effort. */
1903
+ /**
1904
+ * The durable write: `staged` holds the records this operation replaces (`null` deletes one),
1905
+ * in the order subscribers hear about them. The transaction is the durability boundary;
1906
+ * flush() is deliberately best-effort.
1907
+ *
1908
+ * One transaction carries the staged rows and every row a debounced save still owes, so the
1909
+ * database never holds a commit without the optimistic writes made before it. If it fails,
1910
+ * nothing changed anywhere: the held records, the database, the pending dirty rows and the
1911
+ * subscribers all see the store as it was.
1912
+ */
1392
1913
  private commitIndex;
1914
+ /**
1915
+ * Refuse (throwing, with nothing changed) a commit that stages a quarantined run, or a run whose
1916
+ * family this store does not claim and cannot take: another process owns it, or a dead process
1917
+ * left it live and it has not been adopted.
1918
+ */
1919
+ private assertWritable;
1920
+ /** The family of a run this store knows: held, else its row; a run nowhere is its own. */
1921
+ private familyOf;
1922
+ /** Schedule the sweep that lets any of `ids` leave memory, when one of them now can. */
1923
+ private sweepIfSettled;
1393
1924
  updateRun(id: string, patch: Partial<Omit<RunRecord, 'id' | 'steps'>>): RunRecord | undefined;
1394
1925
  /** Prompt edits can both revoke and restore a reference. Resolve the retained working sets
1395
1926
  * before notifying readers, using the same ambiguity, marker and repository rules as events. */
@@ -1424,6 +1955,20 @@ export declare class RunStore extends EventEmitter {
1424
1955
  /** Parent + owned workers; returns how many records flipped `archived`. */
1425
1956
  private applyArchivedCascade;
1426
1957
  private applyArchived;
1958
+ /** Transcript form follows `archived`: enqueue compression, or restore the plain file now. */
1959
+ private syncTranscriptForm;
1960
+ /**
1961
+ * Whether this store may compress `id`'s transcript: the run exists, is archived, is not in a
1962
+ * live status (queued/running/waiting), and this process holds the family's claim in `claimed`
1963
+ * (not merely `pendingClaims`). Two processes never both write a run (#779, #818 B1).
1964
+ */
1965
+ private isHistoryCompressEligible;
1966
+ /** Take the family claim if free and require it to be in `this.claimed`, not only pending. */
1967
+ private holdsCompressClaim;
1968
+ /** Startup sweep: enqueue every archived non-live run that still has a plain transcript. */
1969
+ compressArchivedHistory(): void;
1970
+ /** Resolves when the transcript compressor is idle (tests, shutdown). */
1971
+ historyIdle(): Promise<void>;
1427
1972
  /** Pin one run to the top of this project's task list, or unpin it (#935). Mirrors
1428
1973
  * `setArchived`: sets the fields, then persists + broadcasts via `touch`, so the updated
1429
1974
  * record rides the existing `run` SSE with no new event. Idempotent — re-pinning a pinned
@@ -1432,8 +1977,14 @@ export declare class RunStore extends EventEmitter {
1432
1977
  * Every active status is pinnable. Archived requests clear stale metadata instead, so a
1433
1978
  * late click racing archive cannot leave a hidden pin that reappears on unarchive. */
1434
1979
  setPinned(id: string, pinned: boolean): RunRecord | undefined;
1435
- /** Bulk-archive every finished run; returns how many records flipped to archived. */
1436
- archiveFinished(): number;
1980
+ /** Bulk-archive finished runs (#780). `isSweepable` decides which; `archived` counts every
1981
+ * record that flipped (cascaded workers included), `ids` lists the top-level runs picked and
1982
+ * `pinnedIds` the subset that carried a pin before `clearPin` dropped it. */
1983
+ archiveFinished(scope?: ArchiveFinishedScope): {
1984
+ archived: number;
1985
+ ids: string[];
1986
+ pinnedIds: string[];
1987
+ };
1437
1988
  /** Mark one run as read (#unread-done-items): stamp the read receipt now. Mirrors
1438
1989
  * `setArchived` — sets the field then persists + broadcasts via `touch`, so the
1439
1990
  * updated record rides the existing `run` SSE with no new event. Idempotent by
@@ -1542,18 +2093,43 @@ export declare class RunStore extends EventEmitter {
1542
2093
  * the `CEZ_REDACT_SECRETS=0` opt-out itself so every caller inherits it. */
1543
2094
  redactText(text: string): string;
1544
2095
  private hostSecrets;
2096
+ /** The run's indexed transcript facts (#880): a read-only view, never a transcript read once
2097
+ * the run's index is loaded. An unreadable transcript answers as empty, as readEvents does. */
2098
+ transcriptFacts(runId: string): Readonly<TranscriptFacts>;
2099
+ hasProjection(runId: string, projectionId: string): boolean;
2100
+ private factsWarming;
2101
+ /** After open, build the indexes the delegation reconcile will ask for first, off the request
2102
+ * path: every member of every family with a conversation (#880). */
2103
+ private warmTranscriptFacts;
2104
+ /** Resolves when the open-time warm-up is done (tests). */
2105
+ factsWarmIdle(): Promise<void>;
2106
+ /** `readEvents` off the event loop (async read and async brotli), for collection paths. */
2107
+ readEventsAsync(runId: string): Promise<RunEvent[]>;
2108
+ /** The owned store's `refreshHumanAskSummary`, from the index, on the same rules: no history
2109
+ * (legacy runs) keeps the summary, an unreadable one requests attention. True when it changed. */
2110
+ private syncHumanAskSummary;
1545
2111
  readEvents(runId: string): RunEvent[];
1546
2112
  /** Private process-generation evidence; never part of run JSON or SSE. */
1547
2113
  private identityPath;
1548
2114
  readWorkerIdentity(id: string): WorkerExecutionIdentity | undefined;
1549
2115
  private writeWorkerIdentity;
1550
2116
  private executionPath;
1551
- readWorkerExecution(id: string): {
1552
- generation: string;
1553
- phase: 'queued' | 'starting' | 'complete';
1554
- neverMaterialized?: true;
1555
- } | undefined;
2117
+ readWorkerExecution(id: string): WorkerExecution | undefined;
1556
2118
  private writeWorkerExecution;
2119
+ /** Complete execution is not permission to reuse/delete persistent resources (#738).
2120
+ * Synchronous, fresh and generation/resource fenced; callers hold admission off across awaits. */
2121
+ workerResourcesSafe(id: string, generation: string, resourceId: string, admittingQueued?: boolean): boolean;
2122
+ /** `workerResourcesSafe` with the refusal's live PIDs (empty when no PID explains it). */
2123
+ workerResourceHolders(id: string, generation: string, resourceId: string, opts?: {
2124
+ admittingQueued?: boolean;
2125
+ cwds?: CwdSource;
2126
+ }): 'safe' | number[];
2127
+ /** Upgrade a legacy completed checkpoint while terminal task ownership is still known.
2128
+ * No holder scan here: settlement and scheduling must never wait on cleanup proof. */
2129
+ retainWorkerScratchCleanup(id: string): void;
2130
+ /** Cleanup can outlive its index row, but never its generation or terminal task intent.
2131
+ * `cwds` is the scratch reprobe tick's shared `/proc` snapshot (hearsay-tools/cezarion#879). */
2132
+ workerScratchResourcesSafe(id: string, generation: string, resourceId: string, cwds?: CwdSource): boolean;
1557
2133
  commitWorkerExecutionStart(id: string): string;
1558
2134
  /** Private process record (#469): which processes a generation spawned, never part of run JSON or SSE. */
1559
2135
  private processesPath;
@@ -1563,7 +2139,7 @@ export declare class RunStore extends EventEmitter {
1563
2139
  private writeWorkerProcesses;
1564
2140
  /** Bound to the current generation. Past the cap the record never drops an entry: the
1565
2141
  * working-directory scan is the remaining evidence. */
1566
- appendWorkerProcess(id: string, generation: string, pid: number): boolean;
2142
+ appendWorkerProcess(id: string, generation: string, pid: number, pgid?: number): boolean;
1567
2143
  commitWorkerExecutionComplete(id: string, generation: string): boolean;
1568
2144
  /** Cancellation must hit disk before queued no-start evidence authorizes cleanup. */
1569
2145
  commitWorkerCancellation(id: string): void;
@@ -1576,7 +2152,7 @@ export declare class RunStore extends EventEmitter {
1576
2152
  private deleteDelegatedRun;
1577
2153
  private removeRunHistoryBytes;
1578
2154
  deleteRun(id: string): boolean;
1579
- /** Write the index out now (used on shutdown). */
2155
+ /** Write the pending rows out now (used on shutdown). */
1580
2156
  flush(): void;
1581
2157
  private seqs;
1582
2158
  private nextSeq;
@@ -1593,10 +2169,69 @@ export declare class RunStore extends EventEmitter {
1593
2169
  /** Agent screenshots persisted by the run manager (see persistImage). */
1594
2170
  private imagesDir;
1595
2171
  private touch;
2172
+ /** Form follows archived: a terminal archived run with a plain transcript is queued again. */
2173
+ private maybeEnqueueHistoryCompress;
2174
+ /** The held record is gone; the next save or commit deletes its row, fenced by `family`'s claim
2175
+ * and by the revision this store last saw (kept in `base` until the delete is written). */
2176
+ private markDeleted;
2177
+ /** A deleted run's history files, once the delete of its row has committed. Best effort, as
2178
+ * deletion always was. */
2179
+ private removeOwedHistory;
2180
+ /**
2181
+ * Count-based history retention: of the runs past the newest `MAX_RUNS_KEPT` unarchived ones,
2182
+ * archive each finished run without delegation that is not pinned and whose family this store
2183
+ * can claim. Ranked over the row keys (the `created_at` index, no record decoded) with memory
2184
+ * laid over them, since a run created or archived since the last save has no row yet; the rows
2185
+ * past the cut are then filtered in `runs.db`, so only real candidates decode. Archived runs
2186
+ * are never deleted by retention — only an explicit delete, worker destruction, or history
2187
+ * deletion removes a run.
2188
+ */
1596
2189
  private pruneOldRuns;
1597
- /** Debounced so token-usage updates don't rewrite the index per event. */
2190
+ /** Debounced so token-usage updates don't rewrite a row per event. Nothing to schedule without
2191
+ * a database: a `RunStore.unavailable` store, or a closed one, writes nothing. */
1598
2192
  private scheduleSave;
2193
+ /** The single database write, so a test can fail it the way a full disk would. */
1599
2194
  private writeIndex;
2195
+ /**
2196
+ * Write `staged` plus everything still pending — dirty rows from memory, deletions — in one
2197
+ * transaction, then clear the pending marks. Throws with nothing cleared when it fails.
2198
+ * Never copies or sorts the whole store: the cost is the rows that changed.
2199
+ *
2200
+ * Fenced (#779, plan step 3): the transaction commits only if every family it writes still
2201
+ * carries this store's claim and every row is at the revision this store last saw. Otherwise
2202
+ * nothing is written and `handleConflicts` deals with the rows that changed under it.
2203
+ */
2204
+ private persist;
2205
+ /** What a write of these rows (id → family) must still find: this store's claims, at the
2206
+ * generations it took them, and each row at the revision it last saw (none for a new row). */
2207
+ private fence;
2208
+ /**
2209
+ * A fenced write found rows that changed under this store (#779, plan step 3); the write itself
2210
+ * has already failed with nothing changed, and its caller sees that error.
2211
+ *
2212
+ * A conflict is UNEXPECTED when this store owned the row's family when it last read or wrote it:
2213
+ * a held or pending row, or one read inside a family it claimed. Another writer then broke the
2214
+ * claim. For each such row the original (what this store last saw), local (what it meant to
2215
+ * write, or that it meant to delete it) and current versions go to `run_conflicts` first. Only
2216
+ * once that evidence is stored does the row leave the pending set, so no retry rewrites it; this
2217
+ * store then refuses to write it again, and its held copy is replaced by the current row (or
2218
+ * dropped when deleted) and announced. That refusal lasts as long as this store: the explicit
2219
+ * recovery is a restart, which reads the row as it now stands, and the evidence row stays for a
2220
+ * person to compare. Other pending rows stay pending and the next save writes them.
2221
+ *
2222
+ * If the evidence cannot be stored, nothing changes: the rows stay pending, and the next write
2223
+ * meets the same conflict and tries again. A row read before its family was claimed may simply
2224
+ * have been finished by its previous owner in between: a stale read, not a conflict, so only the
2225
+ * write fails.
2226
+ */
2227
+ private handleConflicts;
2228
+ /** Write what is pending, then (unless closing) let every run whose write settled leave memory. */
1600
2229
  private saveNow;
2230
+ /**
2231
+ * Write what is pending and release the database (store disposal, process shutdown).
2232
+ * Idempotent. A closed store keeps answering reads for what it holds — the final save evicts
2233
+ * nothing — but cannot read `runs.db` any more, so a run that had already left memory reads as
2234
+ * absent. It saves nothing more, and a durable commit on it throws.
2235
+ */
2236
+ close(): void;
1601
2237
  }
1602
- export {};