@open-mercato/cezar 0.9.1 → 0.9.2

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 (300) hide show
  1. package/README.md +19 -11
  2. package/dist/agent-config/catalog.d.ts +1 -1
  3. package/dist/agent-config/files.d.ts +1 -1
  4. package/dist/agent-config/service.d.ts +1 -1
  5. package/dist/agent-config/validate.d.ts +1 -1
  6. package/dist/automations/coordinator.d.ts +26 -0
  7. package/dist/automations/coordinator.js +66 -0
  8. package/dist/automations/coordinator.js.map +1 -0
  9. package/dist/automations/github-poller.d.ts +74 -0
  10. package/dist/automations/github-poller.js +234 -0
  11. package/dist/automations/github-poller.js.map +1 -0
  12. package/dist/automations/scheduler.d.ts +42 -0
  13. package/dist/automations/scheduler.js +192 -0
  14. package/dist/automations/scheduler.js.map +1 -0
  15. package/dist/automations/store.d.ts +65 -0
  16. package/dist/automations/store.js +298 -0
  17. package/dist/automations/store.js.map +1 -0
  18. package/dist/automations/task-template.d.ts +18 -0
  19. package/dist/automations/task-template.js +95 -0
  20. package/dist/automations/task-template.js.map +1 -0
  21. package/dist/automations/types.d.ts +251 -0
  22. package/dist/automations/types.js +158 -0
  23. package/dist/automations/types.js.map +1 -0
  24. package/dist/config.d.ts +9 -111
  25. package/dist/contract/agent-config.d.ts +151 -0
  26. package/dist/contract/automations.d.ts +911 -0
  27. package/dist/contract/events.d.ts +45 -0
  28. package/dist/contract/github.d.ts +467 -0
  29. package/dist/contract/health.d.ts +96 -0
  30. package/dist/contract/index.d.ts +15 -0
  31. package/dist/contract/index.js +1421 -0
  32. package/dist/contract/projects.d.ts +182 -0
  33. package/dist/contract/repo.d.ts +234 -0
  34. package/dist/contract/runs.d.ts +1226 -0
  35. package/dist/contract/skills.d.ts +225 -0
  36. package/dist/contract/workflows.d.ts +212 -0
  37. package/dist/contract/workspace.d.ts +442 -0
  38. package/dist/core/agent-env.d.ts +1 -1
  39. package/dist/core/agent-runner.d.ts +12 -1
  40. package/dist/core/agent-runner.js +13 -0
  41. package/dist/core/agent-runner.js.map +1 -1
  42. package/dist/core/ask.d.ts +45 -124
  43. package/dist/core/ask.js +103 -13
  44. package/dist/core/ask.js.map +1 -1
  45. package/dist/core/claude-cli-runner.d.ts +2 -2
  46. package/dist/core/claude-cli-runner.js +52 -9
  47. package/dist/core/claude-cli-runner.js.map +1 -1
  48. package/dist/core/claude-ui-mapper.d.ts +1 -1
  49. package/dist/core/codex-app-server-runner.d.ts +1 -1
  50. package/dist/core/codex-app-server-runner.js +55 -3
  51. package/dist/core/codex-app-server-runner.js.map +1 -1
  52. package/dist/core/codex-app-server-transport.d.ts +6 -1
  53. package/dist/core/codex-app-server-transport.js +12 -3
  54. package/dist/core/codex-app-server-transport.js.map +1 -1
  55. package/dist/core/codex-model-catalog.d.ts +1 -1
  56. package/dist/core/codex-ui-mapper.d.ts +5 -1
  57. package/dist/core/codex-ui-mapper.js +74 -17
  58. package/dist/core/codex-ui-mapper.js.map +1 -1
  59. package/dist/core/model-identity.d.ts +1 -1
  60. package/dist/core/model-presets.d.ts +2 -2
  61. package/dist/core/model-presets.js +1 -1
  62. package/dist/core/opencode-server-runner.d.ts +2 -2
  63. package/dist/core/opencode-ui-mapper.d.ts +4 -1
  64. package/dist/core/opencode-ui-mapper.js +45 -7
  65. package/dist/core/opencode-ui-mapper.js.map +1 -1
  66. package/dist/core/provider-auth.d.ts +62 -0
  67. package/dist/core/provider-auth.js +290 -0
  68. package/dist/core/provider-auth.js.map +1 -0
  69. package/dist/core/provider-availability.d.ts +3 -0
  70. package/dist/core/provider-availability.js +13 -0
  71. package/dist/core/provider-availability.js.map +1 -0
  72. package/dist/core/runner-factory.d.ts +1 -1
  73. package/dist/core/runner-model-catalog.d.ts +1 -1
  74. package/dist/core/tool-display.d.ts +1 -1
  75. package/dist/core/ui-events.d.ts +1 -1
  76. package/dist/core/ui-events.js +1 -1
  77. package/dist/git-diff-base.d.ts +60 -0
  78. package/dist/git-diff-base.js +54 -0
  79. package/dist/git-diff-base.js.map +1 -0
  80. package/dist/git-worktree.d.ts +37 -6
  81. package/dist/git-worktree.js +39 -9
  82. package/dist/git-worktree.js.map +1 -1
  83. package/dist/handoff.d.ts +2 -2
  84. package/dist/handoff.js +1 -1
  85. package/dist/index.js +65 -8
  86. package/dist/index.js.map +1 -1
  87. package/dist/paths.d.ts +16 -1
  88. package/dist/paths.js +24 -1
  89. package/dist/paths.js.map +1 -1
  90. package/dist/planner.d.ts +2 -2
  91. package/dist/planner.js +1 -1
  92. package/dist/planner.js.map +1 -1
  93. package/dist/release/manifests.d.ts +81 -0
  94. package/dist/release/manifests.js +74 -0
  95. package/dist/release/manifests.js.map +1 -0
  96. package/dist/release/snapshot.d.ts +9 -23
  97. package/dist/release/snapshot.js +9 -22
  98. package/dist/release/snapshot.js.map +1 -1
  99. package/dist/release/stable.d.ts +15 -29
  100. package/dist/release/stable.js +14 -27
  101. package/dist/release/stable.js.map +1 -1
  102. package/dist/runs/auto-name.d.ts +1 -1
  103. package/dist/runs/retention.d.ts +1 -1
  104. package/dist/runs/store.d.ts +142 -336
  105. package/dist/runs/store.js +136 -9
  106. package/dist/runs/store.js.map +1 -1
  107. package/dist/runs/ui-event-sink.d.ts +1 -1
  108. package/dist/server/app-type.d.ts +21 -0
  109. package/dist/server/app-type.js +2 -0
  110. package/dist/server/app-type.js.map +1 -0
  111. package/dist/server/capabilities.d.ts +6 -5
  112. package/dist/server/capabilities.js +11 -0
  113. package/dist/server/capabilities.js.map +1 -1
  114. package/dist/server/forge/github.d.ts +58 -151
  115. package/dist/server/forge/github.js +530 -6
  116. package/dist/server/forge/github.js.map +1 -1
  117. package/dist/server/forge/index.d.ts +10 -3
  118. package/dist/server/forge/index.js +14 -1
  119. package/dist/server/forge/index.js.map +1 -1
  120. package/dist/server/forge/types.d.ts +86 -1
  121. package/dist/server/git-changes.d.ts +8 -8
  122. package/dist/server/git-changes.js +14 -17
  123. package/dist/server/git-changes.js.map +1 -1
  124. package/dist/server/git.d.ts +2 -0
  125. package/dist/server/git.js +9 -0
  126. package/dist/server/git.js.map +1 -1
  127. package/dist/server/github.d.ts +3 -3
  128. package/dist/server/github.js +1 -1
  129. package/dist/server/github.js.map +1 -1
  130. package/dist/server/pr.d.ts +2 -2
  131. package/dist/server/project-context.d.ts +20 -3
  132. package/dist/server/project-context.js +30 -1
  133. package/dist/server/project-context.js.map +1 -1
  134. package/dist/server/provider-action-gate.d.ts +8 -0
  135. package/dist/server/provider-action-gate.js +54 -0
  136. package/dist/server/provider-action-gate.js.map +1 -0
  137. package/dist/server/provider-auth-runtime.d.ts +21 -0
  138. package/dist/server/provider-auth-runtime.js +66 -0
  139. package/dist/server/provider-auth-runtime.js.map +1 -0
  140. package/dist/server/server.d.ts +11142 -47
  141. package/dist/server/server.js +1714 -806
  142. package/dist/server/server.js.map +1 -1
  143. package/dist/server/validators.d.ts +97 -0
  144. package/dist/server/validators.js +86 -0
  145. package/dist/server/validators.js.map +1 -0
  146. package/dist/server/ws.d.ts +2 -2
  147. package/dist/server/ws.js +2 -2
  148. package/dist/server/ws.js.map +1 -1
  149. package/dist/server-install/engine.d.ts +1 -1
  150. package/dist/server-install/platforms/macosx-ngrok.d.ts +1 -1
  151. package/dist/server-install/platforms/ubuntu-vps.d.ts +16 -1
  152. package/dist/server-install/platforms/ubuntu-vps.js +83 -1
  153. package/dist/server-install/platforms/ubuntu-vps.js.map +1 -1
  154. package/dist/server-install/state.d.ts +1 -1
  155. package/dist/server-install/steps.d.ts +2 -2
  156. package/dist/server-install/strategies.d.ts +1 -1
  157. package/dist/server-install/types.d.ts +38 -424
  158. package/dist/server-install/ui.d.ts +1 -1
  159. package/dist/skills-banner.d.ts +7 -6
  160. package/dist/skills-banner.js +7 -6
  161. package/dist/skills-banner.js.map +1 -1
  162. package/dist/skills-remote.d.ts +2 -2
  163. package/dist/skills-update.d.ts +88 -0
  164. package/dist/skills-update.js +392 -0
  165. package/dist/skills-update.js.map +1 -0
  166. package/dist/skills.d.ts +2 -0
  167. package/dist/skills.js +3 -2
  168. package/dist/skills.js.map +1 -1
  169. package/dist/todos.d.ts +2 -28
  170. package/dist/todos.js +1 -1
  171. package/dist/ui-state.d.ts +16 -2
  172. package/dist/ui-state.js +14 -1
  173. package/dist/ui-state.js.map +1 -1
  174. package/dist/workflows/load.d.ts +1 -1
  175. package/dist/workflows/run.d.ts +53 -12
  176. package/dist/workflows/run.js +436 -64
  177. package/dist/workflows/run.js.map +1 -1
  178. package/dist/workflows/types.d.ts +59 -224
  179. package/dist/workflows/types.js +14 -0
  180. package/dist/workflows/types.js.map +1 -1
  181. package/dist/workspace/config.d.ts +68 -206
  182. package/dist/workspace/config.js +145 -14
  183. package/dist/workspace/config.js.map +1 -1
  184. package/dist/workspace/migrations.d.ts +1 -1
  185. package/dist/workspace/migrations.js +19 -4
  186. package/dist/workspace/migrations.js.map +1 -1
  187. package/dist/workspace/projects.d.ts +8 -2
  188. package/dist/workspace/projects.js +9 -3
  189. package/dist/workspace/projects.js.map +1 -1
  190. package/dist/workspace/semaphore.d.ts +6 -0
  191. package/dist/workspace/semaphore.js +14 -1
  192. package/dist/workspace/semaphore.js.map +1 -1
  193. package/dist/workspace/ui-state.d.ts +13 -3
  194. package/dist/workspace/ui-state.js +15 -5
  195. package/dist/workspace/ui-state.js.map +1 -1
  196. package/package.json +17 -39
  197. package/scripts/inline-contract.mjs +112 -0
  198. package/scripts/mock-claude.mjs +39 -1
  199. package/scripts/sync-readme.mjs +20 -0
  200. package/web/dist/assets/alert-dialog-ghffK6g9.js +1 -0
  201. package/web/dist/assets/arrow-down-Cz8qb71e.js +1 -0
  202. package/web/dist/assets/arrow-left-wcYKQXI_.js +1 -0
  203. package/web/dist/assets/bundle-mjs-BT31bpU6.js +1 -0
  204. package/web/dist/assets/centered-state-ZtnFHA-n.js +43 -0
  205. package/web/dist/assets/chevron-right-G4caF2QV.js +1 -0
  206. package/web/dist/assets/{chunk-BO2N2NFS-DtrdTCWa.js → chunk-BO2N2NFS-DE6qKn3r.js} +8 -8
  207. package/web/dist/assets/circle-check--KvBxXWp.js +1 -0
  208. package/web/dist/assets/circle-x-C3EFZ3xf.js +1 -0
  209. package/web/dist/assets/collapsible-B0JVzd0B.js +1 -0
  210. package/web/dist/assets/commit-list-wm6DPHNs.js +1 -0
  211. package/web/dist/assets/compare-variants-DbdP4Y5T.js +1 -0
  212. package/web/dist/assets/{core-DePtBHcl.js → core-BCsw8oQw.js} +1 -1
  213. package/web/dist/assets/diff-Bizc96qe.js +3 -0
  214. package/web/dist/assets/diff-stat-Dyfg3ltF.js +1 -0
  215. package/web/dist/assets/{diff-view-DCeSegKk.js → diff-view-CG8ek6tC.js} +4 -4
  216. package/web/dist/assets/dropdown-menu-C1Dlf35P.js +1 -0
  217. package/web/dist/assets/editable-title-5rC_QRBZ.js +1 -0
  218. package/web/dist/assets/{ellipsis-vertical-CNnSLn5a.js → ellipsis-vertical-DpGTRqC2.js} +1 -1
  219. package/web/dist/assets/{file-D4GBh1ao.js → file-DlUGpUlb.js} +1 -1
  220. package/web/dist/assets/folder-BAY6Vddy.js +1 -0
  221. package/web/dist/assets/{git-pull-request-DnR8Xh4_.js → git-pull-request-agOG0iGM.js} +1 -1
  222. package/web/dist/assets/git-toolbar-DGiNMmtY.js +1 -0
  223. package/web/dist/assets/github-Vp7lxYGQ.js +1 -0
  224. package/web/dist/assets/highlighted-body-OFNGDK62-BL-MfFgl.js +1 -0
  225. package/web/dist/assets/highlighter-CdHqIwFr.js +3 -0
  226. package/web/dist/assets/image-preview-BWGk5fPX.js +1 -0
  227. package/web/dist/assets/index-DSxyJpuK.css +2 -0
  228. package/web/dist/assets/index-DiawI6RX.js +6 -0
  229. package/web/dist/assets/lib-BQXq3kEf.js +1 -0
  230. package/web/dist/assets/lib-BxQXEXDF.js +1 -0
  231. package/web/dist/assets/markdown-BGBOGCA_.js +2 -0
  232. package/web/dist/assets/mermaid-GHXKKRXX-C4jxqUUb.js +1 -0
  233. package/web/dist/assets/new-task-form-BpAw_Dks.js +1 -0
  234. package/web/dist/assets/pill-Dvs-P0xy.js +1 -0
  235. package/web/dist/assets/project-router-Cx8NPoqn.js +1 -0
  236. package/web/dist/assets/prompt-templates-CSBYBR1I.js +15 -0
  237. package/web/dist/assets/react-runtime-CCIEwYL0.js +9 -0
  238. package/web/dist/assets/{refresh-cw-BT8E96Tm.js → refresh-cw-BoGdAykg.js} +1 -1
  239. package/web/dist/assets/repo-git-PmX-BNMo.js +1 -0
  240. package/web/dist/assets/rolldown-runtime-QTnfLwEv.js +1 -0
  241. package/web/dist/assets/run-diff-EcOkf3ti.js +3 -0
  242. package/web/dist/assets/run-header-BGiv6_qX.js +1 -0
  243. package/web/dist/assets/{search-x-BDjaMrzG.js → search-x-X3EpVhgs.js} +1 -1
  244. package/web/dist/assets/skill-empty-hint-CZLALx6l.js +1 -0
  245. package/web/dist/assets/skills-BiWfHmCR.js +1 -0
  246. package/web/dist/assets/skills-CC91ouGH.js +1 -0
  247. package/web/dist/assets/sparkles-Dt4q7pbG.js +1 -0
  248. package/web/dist/assets/{square-terminal-Ckjjn0vb.js → square-terminal-hwBL8XsC.js} +1 -1
  249. package/web/dist/assets/tab-link-DIlR5T07.js +1 -0
  250. package/web/dist/assets/task-changes-XkHDxzQA.js +1 -0
  251. package/web/dist/assets/task-commits-BTTA5k5T.js +1 -0
  252. package/web/dist/assets/task-files-Da8_4C9g.js +2 -0
  253. package/web/dist/assets/task-thread-DoNXUsHr.js +9 -0
  254. package/web/dist/assets/textarea-CUdokhkv.js +1 -0
  255. package/web/dist/assets/thread-loading-B8q8ukXJ.js +1 -0
  256. package/web/dist/assets/{trash-2-DAyZ0VSi.js → trash-2-DhVIdWv8.js} +1 -1
  257. package/web/dist/assets/{triangle-alert-Uy8rokUh.js → triangle-alert-XYT0DGCI.js} +1 -1
  258. package/web/dist/assets/{upload-CDdyPPo_.js → upload-BKjN59-1.js} +1 -1
  259. package/web/dist/assets/use-desktop-Bf5LS_P4.js +1 -0
  260. package/web/dist/assets/use-submit-shortcut-CzVyoAMd.js +1 -0
  261. package/web/dist/assets/utils-DsLuRXwV.js +64 -0
  262. package/web/dist/assets/workflows-o2QU_pvU.js +11 -0
  263. package/web/dist/assets/zoomable-image-7WyUiaVD.js +1 -0
  264. package/web/dist/index.html +32 -13
  265. package/scripts/dev.mjs +0 -74
  266. package/scripts/release-snapshot.mjs +0 -130
  267. package/scripts/release.mjs +0 -119
  268. package/web/dist/assets/arrow-left-CnSdp92h.js +0 -1
  269. package/web/dist/assets/bundle-mjs-BegPhL5c.js +0 -1
  270. package/web/dist/assets/centered-state-DOsTcJZF.js +0 -43
  271. package/web/dist/assets/commit-list-BrxBEzRK.js +0 -1
  272. package/web/dist/assets/compare-variants-Bv2c9ORF.js +0 -1
  273. package/web/dist/assets/dist-B6XQOhgM.js +0 -1
  274. package/web/dist/assets/git-toolbar-pIC1ubPM.js +0 -1
  275. package/web/dist/assets/github-DTTSG0ht.js +0 -1
  276. package/web/dist/assets/highlighted-body-OFNGDK62-BuFJwunK.js +0 -1
  277. package/web/dist/assets/image-preview-DEhW0TFz.js +0 -1
  278. package/web/dist/assets/index-Cijmlz7q.js +0 -30
  279. package/web/dist/assets/index-DzroxqBG.css +0 -2
  280. package/web/dist/assets/lib-DPEZDBUN.js +0 -1
  281. package/web/dist/assets/lib-uHpeUPzK.js +0 -1
  282. package/web/dist/assets/mermaid-GHXKKRXX-CN2zQue0.js +0 -1
  283. package/web/dist/assets/open-mercato-toBr6SOa.svg +0 -11
  284. package/web/dist/assets/project-router-BMx4e8m-.js +0 -1
  285. package/web/dist/assets/repo-git-BusYfa3t.js +0 -1
  286. package/web/dist/assets/run-diff-wOJ3odA-.js +0 -3
  287. package/web/dist/assets/run-header-Cg5incil.js +0 -1
  288. package/web/dist/assets/skill-empty-hint-DTUSp6Vl.js +0 -1
  289. package/web/dist/assets/skills-PpP2owbM.js +0 -1
  290. package/web/dist/assets/tab-link-F3uQrdm2.js +0 -1
  291. package/web/dist/assets/task-changes-iD9kS79I.js +0 -1
  292. package/web/dist/assets/task-commits-COkLaUri.js +0 -1
  293. package/web/dist/assets/task-files-Ckttz7XH.js +0 -2
  294. package/web/dist/assets/task-thread-CQD91VPt.js +0 -9
  295. package/web/dist/assets/textarea-Bj_LCreg.js +0 -1
  296. package/web/dist/assets/use-desktop-DUh0STzq.js +0 -3
  297. package/web/dist/assets/utils-B8s5qIcK.js +0 -1
  298. package/web/dist/assets/workflows-BFk8C0co.js +0 -11
  299. package/web/dist/assets/zoomable-image-PEDOqyLQ.js +0 -1
  300. /package/web/{open-mercato.svg → dist/open-mercato.svg} +0 -0
package/README.md CHANGED
@@ -356,11 +356,12 @@ Settings split along the same line: **Agents**, **Worktrees**, **Bookmarklets**,
356
356
  **Projects** and **Keyboard** are yours or the machine's and live at
357
357
  `/settings/global`.
358
358
 
359
- **Old URLs keep working.** Every unprefixed path — `/`, `/tasks/<id>`,
360
- `/settings`, and the whole `/api/…` surface still answers exactly as before,
361
- bound to the project cezar was started in; the cockpit redirects flat paths to
362
- their `/p/<boot>/…` twin. Existing bookmarks, bookmarklets and scripts need no
363
- change.
359
+ **Old page URLs keep working.** Every unprefixed page path — `/`, `/tasks/<id>`,
360
+ `/settings` still answers, bound to the project cezar was started in; the
361
+ cockpit redirects flat paths to their `/p/<boot>/…` twin, so existing bookmarks
362
+ and bookmarklets need no change. The HTTP API is the exception: it moved to
363
+ `/api/v1/…` (see the CHANGELOG), so a script that calls it needs the extra
364
+ segment.
364
365
 
365
366
  > **Hosted cockpit?** The folder picker is confined to the independent browse
366
367
  > root. Set `CEZ_BROWSE_ROOT` narrowly before first boot (or save it in
@@ -434,7 +435,13 @@ Useful environment variables:
434
435
  | `CEZ_OPENCODE_BIN=/path/to/opencode` | Override which `opencode` binary is used. |
435
436
  | `CEZ_BROWSE_ROOT=~/` | Default root for **Add project → Open local folder…**. The picker cannot navigate above it; a saved workspace value overrides the environment default and must name an existing folder. |
436
437
  | `CEZ_PROJECTS_DIR=~/cezar/projects` | Default destination for **Clone from GitHub**. Saved workspace settings override it, and missing directories are created recursively. |
438
+ | `CEZ_SKILLS_AUTO_UPDATE=0` | Disable automatic checks and updates for upstream-CLI-tracked Open Mercato skill installations. On by default; a saved global Skills setting overrides this environment default. Checks are delayed, bounded, cached, and non-blocking. |
439
+ | `CEZ_AUTONOMOUS_DEFAULT=0` | Seed the New Task Autonomous default (`0` or `1`). Without a seed, skills default on and workflows off; a saved global Resources setting overrides it. |
440
+ | `CEZ_WORKTREE_DEFAULT=1` | Seed the New Task Worktree default (`0` or `1`). Without a seed, eligible runs default on; a saved global Resources setting overrides it. |
437
441
  | `CEZ_SINGLE_PROJECT=1` | Opt into a launch-project-only cockpit: only the exact value `1` enables it. Project add, edit, checkout, folder browsing, and removal are refused and only the launch project is shown. Off by default; stored registry rows are retained, so unsetting it and restarting restores the full multi-project workspace without migration or data loss. |
442
+ | `CEZ_HIDE_TOKEN_USAGE=1` | Hide raw input/output token counts throughout the browser cockpit while leaving backend-reported cost visible. Only the exact value `1` enables it; telemetry and API payloads are unchanged, and a restart is required after changing it. |
443
+ | `CEZ_HIDE_COST=1` | Hide backend-reported monetary cost throughout the browser cockpit while leaving raw input/output token counts visible. Only the exact value `1` enables it; telemetry and API payloads are unchanged, and a restart is required after changing it. |
444
+ | `CEZ_HIDE_TOKEN_METRICS=1` | Legacy master switch that hides both token usage and cost. It takes precedence over the two independent flags; only the exact value `1` enables it, payloads are unchanged, and a restart is required. |
438
445
  | `GITHUB_TOKEN` | Fallback for GitHub reads/PRs when `gh` isn't authenticated. |
439
446
  | `CEZ_ENV_PASSTHROUGH=A,B` | Forward these extra host env vars to spawned agents. By default agents get a least-privilege env (safe shell/toolchain vars + the backend's own auth + `GITHUB_TOKEN` + `CEZ_*`), not your full environment — use this to add a var an agent needs. |
440
447
  | `CEZ_AGENT_ENV_FULL=1` | Escape hatch: give spawned agents the full host environment (pre-hardening behavior). Off by default; only set it if you understand that this hands every host secret to the agent process. |
@@ -443,6 +450,7 @@ Useful environment variables:
443
450
  | `CEZ_AUTONAME=0` | Disable ALL LLM task naming (creation + live) — titles stay heuristic (`437: /om-auto-review-pr`). Under `CEZ_DRY_RUN=1` naming is already off unless forced with `CEZ_AUTONAME=1`. |
444
451
  | `CEZ_REVIEW_GATE=1` | Turn ON the optional diff-first review gate (#489): a successful, non-autonomous run with changes parks at `review` (Accept / Send back / Draft PR) instead of finishing. Off by default — changed runs settle to `done` with the diff left in the worktree. Only `1` enables. The Settings → Agents toggle overrides this; autonomous runs always skip it. |
445
452
  | `CEZ_NO_BANNER=1` | Skip the `open-mercato/skills` banner on `cezar serve` startup. (The cockpit no longer shows a banner — its skills now live on the Skills page's Manage panel — so this env var is the terminal banner's only switch.) |
453
+ | `VITE_CEZ_API_BASE=http://localhost:4321` | **Build time only**, and only when the cockpit bundle is deployed apart from the service it talks to. Empty (the default) means "the origin that served this page", which is right for both normal cases: the CLI serves the bundle itself, and `npm run dev` proxies `/api` to the local service. A deployment that must be configured without a rebuild can put `<meta name="cez-api-base" content="…">` in the served HTML instead, which wins over this. |
446
454
 
447
455
  ---
448
456
 
@@ -494,7 +502,7 @@ Parallel variants (×2/×3) of one task share that task's backend — mixing
494
502
  happens per task and per step, not inside a variant group.
495
503
 
496
504
  The seam is deliberately small: a backend is one class implementing the
497
- `AgentRunner` interface (`src/core/agent-runner.ts`) that turns a prompt into
505
+ `AgentRunner` interface (`packages/cezar/src/core/agent-runner.ts`) that turns a prompt into
498
506
  a stream of normalized events. Other CLIs — pi, aider, whatever ships next —
499
507
  can slot in the same way.
500
508
 
@@ -610,8 +618,8 @@ cd cezar
610
618
  npm install
611
619
  ```
612
620
 
613
- **3. Build** — compiles the server (`tsc → dist/`) and the cockpit
614
- (`vite build → web/dist/`), then runs the pack gate:
621
+ **3. Build** — compiles the api-client and the server (`tsc → packages/cezar/dist/`) and the cockpit
622
+ (`vite build → packages/cezar/web/dist/`), then runs the pack gate:
615
623
 
616
624
  ```bash
617
625
  npm run build
@@ -663,9 +671,9 @@ npm run uninstall-as-command # removes cezar / cez / cezar-cli (either flavor
663
671
 
664
672
  ```bash
665
673
  npm run dev # server (API :4321) + Vite dev server, opens the cockpit in the browser
666
- npm run dev:server # tsx src/index.ts — the API server alone
674
+ npm run dev:server # tsx packages/cezar/src/index.ts — the API server alone
667
675
  npm run dev:web # Vite dev server alone (proxies /api to :4321)
668
- npm run build # tsc → dist/, vite build → web/dist/, then the pack gate
676
+ npm run build # tsc → packages/cezar/dist/, vite build → packages/cezar/web/dist/, then the pack gate
669
677
  npm run typecheck # server + web (tsc --noEmit)
670
678
  npm test # vitest — server + cockpit unit suites
671
679
  npm run test:unit # node:test — fast core-module tests
@@ -675,7 +683,7 @@ npm run test:e2e # real-browser cockpit suite (agent-browser)
675
683
 
676
684
  The stack is deliberately small: **TypeScript** (strict, ESM), **Hono** + SSE for
677
685
  the server, **Zod** at every boundary, **YAML** for workflows, and a **React 19 +
678
- Vite + Tailwind v4 + shadcn/ui** cockpit shipped pre-built in `web/dist/` — the
686
+ Vite + Tailwind v4 + shadcn/ui** cockpit shipped pre-built in `packages/cezar/web/dist/` — the
679
687
  published package carries the built app, so `npx` users never run a bundler.
680
688
  Every module is meant to be read in one sitting.
681
689
 
@@ -1,4 +1,4 @@
1
- import type { RunnerId } from '../core/agent-runner.js';
1
+ import type { RunnerId } from '../core/agent-runner.ts';
2
2
  /**
3
3
  * The catalog of coding-agent config files cezar can surface and edit (spec
4
4
  * `.ai/specs/2026-07-16-agent-config-files.md`). This file is the ONLY place
@@ -1,4 +1,4 @@
1
- import { type ConfigFileDef } from './catalog.js';
1
+ import { type ConfigFileDef } from './catalog.ts';
2
2
  /**
3
3
  * Read and write the coding agents' own config files, addressed by catalog id
4
4
  * (never by a client-supplied path, so traversal is impossible by
@@ -1,4 +1,4 @@
1
- import { type ConfigFileDef } from './catalog.js';
1
+ import { type ConfigFileDef } from './catalog.ts';
2
2
  /**
3
3
  * Assembles the `GET /api/agent-config` payload: every catalog file's current
4
4
  * on-disk state plus, locally, a read-only listing of the MCP servers Claude
@@ -1,4 +1,4 @@
1
- import type { ConfigFormat } from './catalog.js';
1
+ import type { ConfigFormat } from './catalog.ts';
2
2
  /**
3
3
  * On save, cezar proves a config file PARSES in its own format — refusing to
4
4
  * write bytes that would break the user's agent — but it never checks the
@@ -0,0 +1,26 @@
1
+ import { AutomationStore } from './store.ts';
2
+ export interface AutomationProjectSource {
3
+ id: string;
4
+ root: string;
5
+ status: 'ok' | 'missing' | 'not-git';
6
+ }
7
+ export interface AutomationCoordinatorOptions {
8
+ listProjects: () => Promise<readonly AutomationProjectSource[]>;
9
+ warn?: (message: string) => void;
10
+ }
11
+ /**
12
+ * Lightweight workspace index for project automation state. Discovery checks
13
+ * only the optional definitions file and never materializes a RunManager or a
14
+ * full ProjectContext. Schedulers attach to these handles in Phase 4.
15
+ */
16
+ export declare class AutomationCoordinator {
17
+ private readonly options;
18
+ private readonly stores;
19
+ private readonly roots;
20
+ constructor(options: AutomationCoordinatorOptions);
21
+ refresh(): Promise<void>;
22
+ store(projectId: string, root?: string): AutomationStore | undefined;
23
+ enabledProjectIds(): string[];
24
+ remove(projectId: string): void;
25
+ ids(): string[];
26
+ }
@@ -0,0 +1,66 @@
1
+ import { existsSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { AutomationStore } from './store.js';
4
+ /**
5
+ * Lightweight workspace index for project automation state. Discovery checks
6
+ * only the optional definitions file and never materializes a RunManager or a
7
+ * full ProjectContext. Schedulers attach to these handles in Phase 4.
8
+ */
9
+ export class AutomationCoordinator {
10
+ options;
11
+ stores = new Map();
12
+ roots = new Map();
13
+ constructor(options) {
14
+ this.options = options;
15
+ }
16
+ async refresh() {
17
+ let projects;
18
+ try {
19
+ projects = await this.options.listProjects();
20
+ }
21
+ catch (error) {
22
+ this.options.warn?.(`Unable to refresh GitHub automations: ${error instanceof Error ? error.message : String(error)}`);
23
+ return;
24
+ }
25
+ const present = new Set(projects.map((project) => project.id));
26
+ for (const id of this.stores.keys()) {
27
+ if (!present.has(id))
28
+ this.remove(id);
29
+ }
30
+ for (const project of projects) {
31
+ if (project.status === 'missing') {
32
+ this.remove(project.id);
33
+ continue;
34
+ }
35
+ this.roots.set(project.id, project.root);
36
+ const definitions = join(project.root, '.ai/cezar/automations.json');
37
+ if (existsSync(definitions))
38
+ this.store(project.id, project.root);
39
+ }
40
+ }
41
+ store(projectId, root) {
42
+ const existing = this.stores.get(projectId);
43
+ if (existing)
44
+ return existing;
45
+ const projectRoot = root ?? this.roots.get(projectId);
46
+ if (!projectRoot)
47
+ return undefined;
48
+ const store = AutomationStore.open(join(projectRoot, '.ai/cezar'), { warn: this.options.warn });
49
+ this.stores.set(projectId, store);
50
+ this.roots.set(projectId, projectRoot);
51
+ return store;
52
+ }
53
+ enabledProjectIds() {
54
+ return [...this.stores.entries()]
55
+ .filter(([, store]) => store.list().some((definition) => definition.enabled))
56
+ .map(([id]) => id);
57
+ }
58
+ remove(projectId) {
59
+ this.stores.delete(projectId);
60
+ this.roots.delete(projectId);
61
+ }
62
+ ids() {
63
+ return [...this.stores.keys()];
64
+ }
65
+ }
66
+ //# sourceMappingURL=coordinator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinator.js","sourceRoot":"","sources":["../../src/automations/coordinator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAa7C;;;;GAIG;AACH,MAAM,OAAO,qBAAqB;IAIH,OAAO;IAHnB,MAAM,GAAG,IAAI,GAAG,EAA2B,CAAC;IAC5C,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;IAEnD,YAA6B,OAAqC;uBAArC,OAAO;IAAiC,CAAC;IAEtE,KAAK,CAAC,OAAO;QACX,IAAI,QAA4C,CAAC;QACjD,IAAI,CAAC;YACH,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO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;YAAE,OAAO,QAAQ,CAAC;QAC9B,MAAM,WAAW,GAAG,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACtD,IAAI,CAAC,WAAW;YAAE,OAAO,SAAS,CAAC;QACnC,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QAChG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QAClC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QACvC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,iBAAiB;QACf,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;aAC9B,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;aAC5E,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;IACvB,CAAC;IAED,MAAM,CAAC,SAAiB;QACtB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAC9B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC/B,CAAC;IAED,GAAG;QACD,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IACjC,CAAC;CACF"}
@@ -0,0 +1,74 @@
1
+ import { z } from 'zod';
2
+ import type { AutomationDefinition, AutomationEvent } from './types.ts';
3
+ declare const githubItemSchema: z.ZodObject<{
4
+ id: z.ZodOptional<z.ZodNumber>;
5
+ node_id: z.ZodString;
6
+ number: z.ZodNumber;
7
+ title: z.ZodString;
8
+ html_url: z.ZodString;
9
+ created_at: z.ZodString;
10
+ updated_at: z.ZodOptional<z.ZodString>;
11
+ user: z.ZodObject<{
12
+ login: z.ZodString;
13
+ }, z.core.$strip>;
14
+ assignees: z.ZodDefault<z.ZodArray<z.ZodObject<{
15
+ login: z.ZodString;
16
+ }, z.core.$strip>>>;
17
+ labels: z.ZodDefault<z.ZodArray<z.ZodObject<{
18
+ name: z.ZodString;
19
+ }, z.core.$strip>>>;
20
+ repository_url: z.ZodString;
21
+ pull_request: z.ZodOptional<z.ZodUnknown>;
22
+ }, z.core.$strip>;
23
+ declare const timelineEventSchema: z.ZodObject<{
24
+ id: z.ZodOptional<z.ZodNumber>;
25
+ node_id: z.ZodOptional<z.ZodString>;
26
+ event: z.ZodEnum<{
27
+ labeled: "labeled";
28
+ unlabeled: "unlabeled";
29
+ }>;
30
+ created_at: z.ZodString;
31
+ label: z.ZodObject<{
32
+ name: z.ZodString;
33
+ }, z.core.$strip>;
34
+ }, z.core.$strip>;
35
+ export interface GithubCandidate {
36
+ eventId: string;
37
+ event: AutomationEvent;
38
+ timestamp: string;
39
+ tieBreaker: string;
40
+ repo: string;
41
+ nodeId: string;
42
+ number: number;
43
+ title: string;
44
+ url: string;
45
+ author: string;
46
+ assignees: string[];
47
+ labels: string[];
48
+ changedLabel?: string;
49
+ }
50
+ export interface GithubPollResult {
51
+ candidates: GithubCandidate[];
52
+ truncated: boolean;
53
+ pages: number;
54
+ cursor?: {
55
+ timestamp: string;
56
+ tieBreaker: string;
57
+ };
58
+ }
59
+ export interface GithubPollerOptions {
60
+ run?: (executable: string, args: readonly string[]) => Promise<string>;
61
+ }
62
+ export interface GithubPollOptions {
63
+ since?: string;
64
+ }
65
+ export declare class GithubPoller {
66
+ private readonly run;
67
+ constructor(options?: GithubPollerOptions);
68
+ poll(owner: string, repo: string, definition: AutomationDefinition, options?: GithubPollOptions): Promise<GithubPollResult>;
69
+ private timeline;
70
+ }
71
+ export declare function buildSearchQuery(owner: string, repo: string, definition: AutomationDefinition, family?: 'issues' | 'prs' | 'mixed', activity?: 'created' | 'updated', since?: string): string;
72
+ export declare function reconstructLabelEvents(owner: string, repo: string, item: z.infer<typeof githubItemSchema>, timeline: z.infer<typeof timelineEventSchema>[]): GithubCandidate[];
73
+ export declare function matchesFilters(candidate: GithubCandidate, definition: AutomationDefinition): boolean;
74
+ export {};
@@ -0,0 +1,234 @@
1
+ import { execFile } from 'node:child_process';
2
+ import { promisify } from 'node:util';
3
+ import { z } from 'zod';
4
+ const execFileAsync = promisify(execFile);
5
+ const HARD_CANDIDATE_CAP = 100;
6
+ const GITHUB_COMMAND_TIMEOUT_MS = 30_000;
7
+ const githubItemSchema = z.object({
8
+ id: z.number().int().positive().optional(),
9
+ node_id: z.string().min(1),
10
+ number: z.number().int().positive(),
11
+ title: z.string(),
12
+ html_url: z.string().url(),
13
+ created_at: z.string().datetime(),
14
+ updated_at: z.string().datetime().optional(),
15
+ user: z.object({ login: z.string() }),
16
+ assignees: z.array(z.object({ login: z.string() })).default([]),
17
+ labels: z.array(z.object({ name: z.string() })).default([]),
18
+ repository_url: z.string().url(),
19
+ pull_request: z.unknown().optional(),
20
+ });
21
+ const searchResponseSchema = z.object({ items: z.array(githubItemSchema) });
22
+ const timelineEventSchema = z.object({
23
+ id: z.number().int().positive().optional(),
24
+ node_id: z.string().optional(),
25
+ event: z.enum(['labeled', 'unlabeled']),
26
+ created_at: z.string().datetime(),
27
+ label: z.object({ name: z.string() }),
28
+ });
29
+ export class GithubPoller {
30
+ run;
31
+ constructor(options = {}) {
32
+ this.run = options.run ?? (async (executable, args) => (await execFileAsync(executable, [...args], {
33
+ maxBuffer: 4 * 1024 * 1024,
34
+ timeout: GITHUB_COMMAND_TIMEOUT_MS,
35
+ })).stdout);
36
+ }
37
+ async poll(owner, repo, definition, options = {}) {
38
+ const openedEvents = definition.events.filter((event) => event === 'pull_request.opened' || event === 'issue.opened');
39
+ const labelEvents = definition.events.filter((event) => event === 'issue.labeled' || event === 'issue.unlabeled');
40
+ const sources = [];
41
+ if (openedEvents.length) {
42
+ sources.push({
43
+ family: openedEvents.every((event) => event === 'pull_request.opened')
44
+ ? 'prs'
45
+ : openedEvents.every((event) => event === 'issue.opened') ? 'issues' : 'mixed',
46
+ activity: 'created',
47
+ opened: true,
48
+ labels: false,
49
+ });
50
+ }
51
+ if (labelEvents.length) {
52
+ sources.push({ family: 'issues', activity: 'updated', opened: false, labels: true });
53
+ }
54
+ const perPage = Math.min(definition.filters.maxRecords, HARD_CANDIDATE_CAP);
55
+ const expectedRepoUrl = `https://api.github.com/repos/${owner}/${repo}`.toLowerCase();
56
+ const observations = [];
57
+ let truncated = false;
58
+ for (const source of sources) {
59
+ const query = buildSearchQuery(owner, repo, definition, source.family, source.activity, options.since);
60
+ const args = [
61
+ 'api', '--method', 'GET', '/search/issues',
62
+ '-f', `q=${query}`,
63
+ '-f', `per_page=${perPage}`,
64
+ '-f', `sort=${source.activity}`,
65
+ '-f', 'order=asc',
66
+ ];
67
+ const raw = await this.run('gh', args);
68
+ const response = searchResponseSchema.parse(JSON.parse(raw));
69
+ const sourceObservations = [];
70
+ truncated ||= response.items.length >= perPage;
71
+ for (const item of response.items.slice(0, HARD_CANDIDATE_CAP)) {
72
+ if (item.repository_url.toLowerCase() !== expectedRepoUrl)
73
+ continue;
74
+ if (source.opened && item.pull_request && definition.events.includes('pull_request.opened')) {
75
+ const candidate = normalizeOpened(owner, repo, item, 'pull_request.opened');
76
+ if (atOrAfter(candidate.timestamp, options.since)) {
77
+ sourceObservations.push({
78
+ timestamp: candidate.timestamp,
79
+ tieBreaker: candidate.tieBreaker,
80
+ candidate: matchesFilters(candidate, definition) ? candidate : undefined,
81
+ });
82
+ }
83
+ }
84
+ else if (source.opened && !item.pull_request && definition.events.includes('issue.opened')) {
85
+ const candidate = normalizeOpened(owner, repo, item, 'issue.opened');
86
+ if (atOrAfter(candidate.timestamp, options.since)) {
87
+ sourceObservations.push({
88
+ timestamp: candidate.timestamp,
89
+ tieBreaker: candidate.tieBreaker,
90
+ candidate: matchesFilters(candidate, definition) ? candidate : undefined,
91
+ });
92
+ }
93
+ }
94
+ if (source.labels && !item.pull_request) {
95
+ const timeline = await this.timeline(owner, repo, item.number);
96
+ const events = reconstructLabelEvents(owner, repo, item, timeline);
97
+ for (const event of events) {
98
+ if (!atOrAfter(event.timestamp, options.since))
99
+ continue;
100
+ sourceObservations.push({
101
+ timestamp: event.timestamp,
102
+ tieBreaker: event.tieBreaker,
103
+ candidate: definition.events.includes(event.event) && matchesFilters(event, definition)
104
+ ? event
105
+ : undefined,
106
+ });
107
+ if (sourceObservations.length >= perPage)
108
+ break;
109
+ }
110
+ const lastEventAt = events.at(-1)?.timestamp;
111
+ if (sourceObservations.length < perPage
112
+ && item.updated_at
113
+ && atOrAfter(item.updated_at, options.since)
114
+ && (!lastEventAt || item.updated_at > lastEventAt)) {
115
+ sourceObservations.push({
116
+ timestamp: item.updated_at,
117
+ tieBreaker: `activity:${item.node_id}`,
118
+ });
119
+ }
120
+ }
121
+ if (sourceObservations.length >= perPage)
122
+ break;
123
+ }
124
+ sourceObservations.sort(compareObservation);
125
+ truncated ||= sourceObservations.length >= perPage;
126
+ observations.push(...sourceObservations.slice(0, perPage));
127
+ }
128
+ observations.sort(compareObservation);
129
+ const evaluated = observations.slice(0, definition.filters.maxRecords);
130
+ const cursor = evaluated.at(-1);
131
+ return {
132
+ candidates: evaluated.flatMap((observation) => observation.candidate ? [observation.candidate] : []),
133
+ truncated: truncated || observations.length > definition.filters.maxRecords,
134
+ pages: sources.length,
135
+ cursor: cursor ? { timestamp: cursor.timestamp, tieBreaker: cursor.tieBreaker } : undefined,
136
+ };
137
+ }
138
+ async timeline(owner, repo, number) {
139
+ const raw = await this.run('gh', [
140
+ 'api', '--method', 'GET', `repos/${owner}/${repo}/issues/${number}/timeline`,
141
+ '-H', 'Accept: application/vnd.github+json', '-f', 'per_page=100',
142
+ ]);
143
+ return z.array(timelineEventSchema).parse(JSON.parse(raw));
144
+ }
145
+ }
146
+ export function buildSearchQuery(owner, repo, definition, family = 'mixed', activity = 'created', since) {
147
+ const start = since
148
+ ?? new Date(Date.now() - definition.filters.lookbackDays * 86_400_000).toISOString().slice(0, 10);
149
+ const terms = [
150
+ `repo:${owner}/${repo}`,
151
+ family === 'prs' ? 'is:pr' : family === 'issues' ? 'is:issue' : '',
152
+ `${activity}:>=${start}`,
153
+ ];
154
+ for (const author of definition.filters.authors ?? [])
155
+ terms.push(`author:${safeQualifier(author)}`);
156
+ for (const assignee of definition.filters.assignees ?? [])
157
+ terms.push(`assignee:${safeQualifier(assignee)}`);
158
+ for (const label of definition.filters.allLabels ?? [])
159
+ terms.push(`label:${JSON.stringify(label)}`);
160
+ return terms.filter(Boolean).join(' ');
161
+ }
162
+ function safeQualifier(value) {
163
+ return value.replace(/[^A-Za-z0-9_.-]/g, '');
164
+ }
165
+ function normalizeOpened(owner, repo, item, event) {
166
+ const eventId = `${owner}/${repo}:${item.node_id}:${event}:${item.created_at}`;
167
+ return {
168
+ eventId,
169
+ event,
170
+ timestamp: item.created_at,
171
+ tieBreaker: item.node_id,
172
+ repo: `${owner}/${repo}`,
173
+ nodeId: item.node_id,
174
+ number: item.number,
175
+ title: sanitize(item.title, 500),
176
+ url: item.html_url,
177
+ author: item.user.login,
178
+ assignees: item.assignees.map((assignee) => assignee.login),
179
+ labels: item.labels.map((label) => label.name),
180
+ };
181
+ }
182
+ export function reconstructLabelEvents(owner, repo, item, timeline) {
183
+ const current = new Set(item.labels.map((label) => label.name));
184
+ const ordered = [...timeline].sort((a, b) => b.created_at.localeCompare(a.created_at));
185
+ const rows = [];
186
+ for (const entry of ordered) {
187
+ const postLabels = [...current];
188
+ if (entry.event === 'labeled')
189
+ current.delete(entry.label.name);
190
+ else
191
+ current.add(entry.label.name);
192
+ const labels = entry.event === 'labeled' ? postLabels : [...current];
193
+ const kind = entry.event === 'labeled' ? 'issue.labeled' : 'issue.unlabeled';
194
+ const stable = entry.node_id ?? String(entry.id ?? `${entry.created_at}:${entry.label.name.toLowerCase()}`);
195
+ rows.push({
196
+ ...normalizeOpened(owner, repo, item, 'issue.opened'),
197
+ event: kind,
198
+ eventId: `${owner}/${repo}:${item.node_id}:${kind}:${stable}`,
199
+ timestamp: entry.created_at,
200
+ tieBreaker: stable,
201
+ labels,
202
+ changedLabel: entry.label.name,
203
+ });
204
+ }
205
+ return rows.sort((a, b) => a.timestamp.localeCompare(b.timestamp) || a.tieBreaker.localeCompare(b.tieBreaker));
206
+ }
207
+ export function matchesFilters(candidate, definition) {
208
+ const lower = (values) => new Set(values.map((value) => value.toLowerCase()));
209
+ const labels = lower(candidate.labels);
210
+ const filters = definition.filters;
211
+ if (filters.authors?.length && !lower(filters.authors).has(candidate.author.toLowerCase()))
212
+ return false;
213
+ if (filters.assignees?.length && !candidate.assignees.some((value) => lower(filters.assignees).has(value.toLowerCase())))
214
+ return false;
215
+ if (filters.allLabels?.some((value) => !labels.has(value.toLowerCase())))
216
+ return false;
217
+ if (filters.anyLabels?.length && !filters.anyLabels.some((value) => labels.has(value.toLowerCase())))
218
+ return false;
219
+ if (filters.excludeLabels?.some((value) => labels.has(value.toLowerCase())))
220
+ return false;
221
+ if (candidate.changedLabel && filters.changedLabels?.length && !lower(filters.changedLabels).has(candidate.changedLabel.toLowerCase()))
222
+ return false;
223
+ return true;
224
+ }
225
+ function sanitize(value, max) {
226
+ return value.replace(/[\u0000-\u001f\u007f]/g, ' ').slice(0, max);
227
+ }
228
+ function compareObservation(a, b) {
229
+ return a.timestamp.localeCompare(b.timestamp) || a.tieBreaker.localeCompare(b.tieBreaker);
230
+ }
231
+ function atOrAfter(timestamp, since) {
232
+ return !since || timestamp >= since;
233
+ }
234
+ //# sourceMappingURL=github-poller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-poller.js","sourceRoot":"","sources":["../../src/automations/github-poller.ts"],"names":[],"mappings":"AAAA,OA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AAC,aAAa,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;QAAE,OAAO,KAAK,CAAC;IACrJ,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,QAAQ,CAAC,KAAa,EAAE,GAAW;IAC1C,OAAO,KAAK,CAAC,OAAO,CAAC,wBAAwB,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACpE,CAAC;AAED,SAAS,kBAAkB,CACzB,CAA4C,EAC5C,CAA4C;IAE5C,OAAO,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;AAC5F,CAAC;AAED,SAAS,SAAS,CAAC,SAAiB,EAAE,KAAyB;IAC7D,OAAO,CAAC,KAAK,IAAI,SAAS,IAAI,KAAK,CAAC;AACtC,CAAC"}
@@ -0,0 +1,42 @@
1
+ import type { AutomationCoordinator } from './coordinator.ts';
2
+ import type { GithubCandidate, GithubPoller, GithubPollResult } from './github-poller.ts';
3
+ import type { AutomationStore } from './store.ts';
4
+ import type { AutomationDefinition } from './types.ts';
5
+ export interface AutomationLaunchResult {
6
+ runId: string;
7
+ }
8
+ export type AutomationLauncher = (definition: AutomationDefinition, candidate: GithubCandidate, receiptId: string) => Promise<AutomationLaunchResult>;
9
+ export interface ProjectAutomationHandle {
10
+ projectId: string;
11
+ owner: string;
12
+ repo: string;
13
+ store: AutomationStore;
14
+ poller: GithubPoller;
15
+ launch?: AutomationLauncher;
16
+ onChange?: (automationId: string, revision: number) => void;
17
+ }
18
+ export declare class ProjectAutomationScheduler {
19
+ private readonly handle;
20
+ constructor(handle: ProjectAutomationHandle);
21
+ check(definition: AutomationDefinition, mode?: 'preview' | 'execute'): Promise<GithubPollResult>;
22
+ private launch;
23
+ private recordFailure;
24
+ }
25
+ export interface WorkspaceAutomationSchedulerOptions {
26
+ coordinator: AutomationCoordinator;
27
+ handle: (projectId: string, store: AutomationStore) => ProjectAutomationHandle | undefined;
28
+ now?: () => number;
29
+ }
30
+ /** One workspace timer, created only while at least one enabled definition exists. */
31
+ export declare class WorkspaceAutomationScheduler {
32
+ private readonly options;
33
+ private timer?;
34
+ private stopped;
35
+ private scheduleGeneration;
36
+ constructor(options: WorkspaceAutomationSchedulerOptions);
37
+ start(): Promise<void>;
38
+ reschedule(): Promise<void>;
39
+ stop(): void;
40
+ hasTimer(): boolean;
41
+ private schedule;
42
+ }