@wjarka/cezarion 0.10.0-pr30.54

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 (478) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +838 -0
  3. package/dist/agent-config/account-identity.d.ts +44 -0
  4. package/dist/agent-config/account-identity.js +128 -0
  5. package/dist/agent-config/account-identity.js.map +1 -0
  6. package/dist/agent-config/catalog.d.ts +72 -0
  7. package/dist/agent-config/catalog.js +223 -0
  8. package/dist/agent-config/catalog.js.map +1 -0
  9. package/dist/agent-config/files.d.ts +46 -0
  10. package/dist/agent-config/files.js +119 -0
  11. package/dist/agent-config/files.js.map +1 -0
  12. package/dist/agent-config/model-settings/claude.d.ts +2 -0
  13. package/dist/agent-config/model-settings/claude.js +11 -0
  14. package/dist/agent-config/model-settings/claude.js.map +1 -0
  15. package/dist/agent-config/model-settings/codex.d.ts +2 -0
  16. package/dist/agent-config/model-settings/codex.js +16 -0
  17. package/dist/agent-config/model-settings/codex.js.map +1 -0
  18. package/dist/agent-config/model-settings/opencode.d.ts +2 -0
  19. package/dist/agent-config/model-settings/opencode.js +8 -0
  20. package/dist/agent-config/model-settings/opencode.js.map +1 -0
  21. package/dist/agent-config/model-settings/pi.d.ts +12 -0
  22. package/dist/agent-config/model-settings/pi.js +18 -0
  23. package/dist/agent-config/model-settings/pi.js.map +1 -0
  24. package/dist/agent-config/model-settings/shared.d.ts +9 -0
  25. package/dist/agent-config/model-settings/shared.js +93 -0
  26. package/dist/agent-config/model-settings/shared.js.map +1 -0
  27. package/dist/agent-config/model-settings/types.d.ts +9 -0
  28. package/dist/agent-config/model-settings/types.js +2 -0
  29. package/dist/agent-config/model-settings/types.js.map +1 -0
  30. package/dist/agent-config/models.d.ts +9 -0
  31. package/dist/agent-config/models.js +32 -0
  32. package/dist/agent-config/models.js.map +1 -0
  33. package/dist/agent-config/seed.d.ts +7 -0
  34. package/dist/agent-config/seed.js +90 -0
  35. package/dist/agent-config/seed.js.map +1 -0
  36. package/dist/agent-config/service.d.ts +44 -0
  37. package/dist/agent-config/service.js +71 -0
  38. package/dist/agent-config/service.js.map +1 -0
  39. package/dist/agent-config/validate.d.ts +21 -0
  40. package/dist/agent-config/validate.js +76 -0
  41. package/dist/agent-config/validate.js.map +1 -0
  42. package/dist/automations/coordinator.d.ts +26 -0
  43. package/dist/automations/coordinator.js +66 -0
  44. package/dist/automations/coordinator.js.map +1 -0
  45. package/dist/automations/github-poller.d.ts +74 -0
  46. package/dist/automations/github-poller.js +234 -0
  47. package/dist/automations/github-poller.js.map +1 -0
  48. package/dist/automations/scheduler.d.ts +42 -0
  49. package/dist/automations/scheduler.js +192 -0
  50. package/dist/automations/scheduler.js.map +1 -0
  51. package/dist/automations/store.d.ts +65 -0
  52. package/dist/automations/store.js +298 -0
  53. package/dist/automations/store.js.map +1 -0
  54. package/dist/automations/task-template.d.ts +18 -0
  55. package/dist/automations/task-template.js +95 -0
  56. package/dist/automations/task-template.js.map +1 -0
  57. package/dist/automations/types.d.ts +255 -0
  58. package/dist/automations/types.js +159 -0
  59. package/dist/automations/types.js.map +1 -0
  60. package/dist/config.d.ts +77 -0
  61. package/dist/config.js +242 -0
  62. package/dist/config.js.map +1 -0
  63. package/dist/contract/agent-config.d.ts +153 -0
  64. package/dist/contract/agent-profiles.d.ts +347 -0
  65. package/dist/contract/automations.d.ts +935 -0
  66. package/dist/contract/events.d.ts +104 -0
  67. package/dist/contract/github.d.ts +556 -0
  68. package/dist/contract/health.d.ts +102 -0
  69. package/dist/contract/index.d.ts +16 -0
  70. package/dist/contract/index.js +1895 -0
  71. package/dist/contract/projects.d.ts +210 -0
  72. package/dist/contract/repo.d.ts +234 -0
  73. package/dist/contract/runs.d.ts +1473 -0
  74. package/dist/contract/skills.d.ts +232 -0
  75. package/dist/contract/workflows.d.ts +218 -0
  76. package/dist/contract/workspace.d.ts +579 -0
  77. package/dist/core/agent-env.d.ts +31 -0
  78. package/dist/core/agent-env.js +371 -0
  79. package/dist/core/agent-env.js.map +1 -0
  80. package/dist/core/agent-model-policy.d.ts +10 -0
  81. package/dist/core/agent-model-policy.js +36 -0
  82. package/dist/core/agent-model-policy.js.map +1 -0
  83. package/dist/core/agent-profiles.d.ts +62 -0
  84. package/dist/core/agent-profiles.js +90 -0
  85. package/dist/core/agent-profiles.js.map +1 -0
  86. package/dist/core/agent-runner.d.ts +211 -0
  87. package/dist/core/agent-runner.js +68 -0
  88. package/dist/core/agent-runner.js.map +1 -0
  89. package/dist/core/ask.d.ts +105 -0
  90. package/dist/core/ask.js +187 -0
  91. package/dist/core/ask.js.map +1 -0
  92. package/dist/core/backend-detect.d.ts +16 -0
  93. package/dist/core/backend-detect.js +155 -0
  94. package/dist/core/backend-detect.js.map +1 -0
  95. package/dist/core/claude-cli-runner.d.ts +59 -0
  96. package/dist/core/claude-cli-runner.js +483 -0
  97. package/dist/core/claude-cli-runner.js.map +1 -0
  98. package/dist/core/claude-ui-mapper.d.ts +80 -0
  99. package/dist/core/claude-ui-mapper.js +598 -0
  100. package/dist/core/claude-ui-mapper.js.map +1 -0
  101. package/dist/core/codex-app-server-runner.d.ts +41 -0
  102. package/dist/core/codex-app-server-runner.js +584 -0
  103. package/dist/core/codex-app-server-runner.js.map +1 -0
  104. package/dist/core/codex-app-server-transport.d.ts +35 -0
  105. package/dist/core/codex-app-server-transport.js +150 -0
  106. package/dist/core/codex-app-server-transport.js.map +1 -0
  107. package/dist/core/codex-model-catalog.d.ts +10 -0
  108. package/dist/core/codex-model-catalog.js +110 -0
  109. package/dist/core/codex-model-catalog.js.map +1 -0
  110. package/dist/core/codex-ui-mapper.d.ts +112 -0
  111. package/dist/core/codex-ui-mapper.js +766 -0
  112. package/dist/core/codex-ui-mapper.js.map +1 -0
  113. package/dist/core/model-identity.d.ts +125 -0
  114. package/dist/core/model-identity.js +132 -0
  115. package/dist/core/model-identity.js.map +1 -0
  116. package/dist/core/model-presets.d.ts +21 -0
  117. package/dist/core/model-presets.js +81 -0
  118. package/dist/core/model-presets.js.map +1 -0
  119. package/dist/core/ndjson.d.ts +6 -0
  120. package/dist/core/ndjson.js +23 -0
  121. package/dist/core/ndjson.js.map +1 -0
  122. package/dist/core/opencode-model-catalog.d.ts +32 -0
  123. package/dist/core/opencode-model-catalog.js +153 -0
  124. package/dist/core/opencode-model-catalog.js.map +1 -0
  125. package/dist/core/opencode-server-runner.d.ts +32 -0
  126. package/dist/core/opencode-server-runner.js +882 -0
  127. package/dist/core/opencode-server-runner.js.map +1 -0
  128. package/dist/core/opencode-ui-mapper.d.ts +137 -0
  129. package/dist/core/opencode-ui-mapper.js +800 -0
  130. package/dist/core/opencode-ui-mapper.js.map +1 -0
  131. package/dist/core/pi-model-catalog.d.ts +31 -0
  132. package/dist/core/pi-model-catalog.js +152 -0
  133. package/dist/core/pi-model-catalog.js.map +1 -0
  134. package/dist/core/pi-runner.d.ts +24 -0
  135. package/dist/core/pi-runner.js +403 -0
  136. package/dist/core/pi-runner.js.map +1 -0
  137. package/dist/core/pi-ui-mapper.d.ts +36 -0
  138. package/dist/core/pi-ui-mapper.js +304 -0
  139. package/dist/core/pi-ui-mapper.js.map +1 -0
  140. package/dist/core/process-usage.d.ts +66 -0
  141. package/dist/core/process-usage.js +193 -0
  142. package/dist/core/process-usage.js.map +1 -0
  143. package/dist/core/provider-auth.d.ts +154 -0
  144. package/dist/core/provider-auth.js +509 -0
  145. package/dist/core/provider-auth.js.map +1 -0
  146. package/dist/core/provider-availability.d.ts +3 -0
  147. package/dist/core/provider-availability.js +14 -0
  148. package/dist/core/provider-availability.js.map +1 -0
  149. package/dist/core/runner-factory.d.ts +8 -0
  150. package/dist/core/runner-factory.js +25 -0
  151. package/dist/core/runner-factory.js.map +1 -0
  152. package/dist/core/runner-model-catalog.d.ts +29 -0
  153. package/dist/core/runner-model-catalog.js +78 -0
  154. package/dist/core/runner-model-catalog.js.map +1 -0
  155. package/dist/core/secret-redaction.d.ts +37 -0
  156. package/dist/core/secret-redaction.js +115 -0
  157. package/dist/core/secret-redaction.js.map +1 -0
  158. package/dist/core/shell-env.d.ts +28 -0
  159. package/dist/core/shell-env.js +56 -0
  160. package/dist/core/shell-env.js.map +1 -0
  161. package/dist/core/tool-display.d.ts +31 -0
  162. package/dist/core/tool-display.js +179 -0
  163. package/dist/core/tool-display.js.map +1 -0
  164. package/dist/core/ui-events.d.ts +335 -0
  165. package/dist/core/ui-events.js +25 -0
  166. package/dist/core/ui-events.js.map +1 -0
  167. package/dist/core/usage-limit.d.ts +42 -0
  168. package/dist/core/usage-limit.js +209 -0
  169. package/dist/core/usage-limit.js.map +1 -0
  170. package/dist/core/usage.d.ts +11 -0
  171. package/dist/core/usage.js +15 -0
  172. package/dist/core/usage.js.map +1 -0
  173. package/dist/core/v1-text-coalescer.d.ts +36 -0
  174. package/dist/core/v1-text-coalescer.js +72 -0
  175. package/dist/core/v1-text-coalescer.js.map +1 -0
  176. package/dist/git-diff-base.d.ts +85 -0
  177. package/dist/git-diff-base.js +180 -0
  178. package/dist/git-diff-base.js.map +1 -0
  179. package/dist/git-refs.d.ts +11 -0
  180. package/dist/git-refs.js +14 -0
  181. package/dist/git-refs.js.map +1 -0
  182. package/dist/git-worktree.d.ts +161 -0
  183. package/dist/git-worktree.js +508 -0
  184. package/dist/git-worktree.js.map +1 -0
  185. package/dist/handoff.d.ts +62 -0
  186. package/dist/handoff.js +154 -0
  187. package/dist/handoff.js.map +1 -0
  188. package/dist/index.d.ts +2 -0
  189. package/dist/index.js +680 -0
  190. package/dist/index.js.map +1 -0
  191. package/dist/install-as-command.d.ts +40 -0
  192. package/dist/install-as-command.js +52 -0
  193. package/dist/install-as-command.js.map +1 -0
  194. package/dist/pack-check.d.ts +17 -0
  195. package/dist/pack-check.js +27 -0
  196. package/dist/pack-check.js.map +1 -0
  197. package/dist/paths.d.ts +140 -0
  198. package/dist/paths.js +192 -0
  199. package/dist/paths.js.map +1 -0
  200. package/dist/planner.d.ts +27 -0
  201. package/dist/planner.js +268 -0
  202. package/dist/planner.js.map +1 -0
  203. package/dist/release/manifests.d.ts +81 -0
  204. package/dist/release/manifests.js +74 -0
  205. package/dist/release/manifests.js.map +1 -0
  206. package/dist/release/snapshot.d.ts +67 -0
  207. package/dist/release/snapshot.js +97 -0
  208. package/dist/release/snapshot.js.map +1 -0
  209. package/dist/release/stable.d.ts +38 -0
  210. package/dist/release/stable.js +55 -0
  211. package/dist/release/stable.js.map +1 -0
  212. package/dist/runs/agent-tmpdir.d.ts +41 -0
  213. package/dist/runs/agent-tmpdir.js +183 -0
  214. package/dist/runs/agent-tmpdir.js.map +1 -0
  215. package/dist/runs/auto-name.d.ts +75 -0
  216. package/dist/runs/auto-name.js +179 -0
  217. package/dist/runs/auto-name.js.map +1 -0
  218. package/dist/runs/event-history.d.ts +50 -0
  219. package/dist/runs/event-history.js +613 -0
  220. package/dist/runs/event-history.js.map +1 -0
  221. package/dist/runs/retention.d.ts +60 -0
  222. package/dist/runs/retention.js +86 -0
  223. package/dist/runs/retention.js.map +1 -0
  224. package/dist/runs/review-gate.d.ts +18 -0
  225. package/dist/runs/review-gate.js +21 -0
  226. package/dist/runs/review-gate.js.map +1 -0
  227. package/dist/runs/run-index.d.ts +19 -0
  228. package/dist/runs/run-index.js +43 -0
  229. package/dist/runs/run-index.js.map +1 -0
  230. package/dist/runs/store.d.ts +446 -0
  231. package/dist/runs/store.js +1118 -0
  232. package/dist/runs/store.js.map +1 -0
  233. package/dist/runs/task-markers.d.ts +28 -0
  234. package/dist/runs/task-markers.js +74 -0
  235. package/dist/runs/task-markers.js.map +1 -0
  236. package/dist/runs/task-refs.d.ts +25 -0
  237. package/dist/runs/task-refs.js +74 -0
  238. package/dist/runs/task-refs.js.map +1 -0
  239. package/dist/runs/ui-event-sink.d.ts +81 -0
  240. package/dist/runs/ui-event-sink.js +210 -0
  241. package/dist/runs/ui-event-sink.js.map +1 -0
  242. package/dist/server/app-type.d.ts +21 -0
  243. package/dist/server/app-type.js +2 -0
  244. package/dist/server/app-type.js.map +1 -0
  245. package/dist/server/capabilities.d.ts +70 -0
  246. package/dist/server/capabilities.js +152 -0
  247. package/dist/server/capabilities.js.map +1 -0
  248. package/dist/server/checkout.d.ts +128 -0
  249. package/dist/server/checkout.js +296 -0
  250. package/dist/server/checkout.js.map +1 -0
  251. package/dist/server/forge/github.d.ts +513 -0
  252. package/dist/server/forge/github.js +2364 -0
  253. package/dist/server/forge/github.js.map +1 -0
  254. package/dist/server/forge/index.d.ts +40 -0
  255. package/dist/server/forge/index.js +72 -0
  256. package/dist/server/forge/index.js.map +1 -0
  257. package/dist/server/forge/types.d.ts +242 -0
  258. package/dist/server/forge/types.js +2 -0
  259. package/dist/server/forge/types.js.map +1 -0
  260. package/dist/server/fs-browse.d.ts +105 -0
  261. package/dist/server/fs-browse.js +182 -0
  262. package/dist/server/fs-browse.js.map +1 -0
  263. package/dist/server/git-changes.d.ts +213 -0
  264. package/dist/server/git-changes.js +555 -0
  265. package/dist/server/git-changes.js.map +1 -0
  266. package/dist/server/git.d.ts +28 -0
  267. package/dist/server/git.js +112 -0
  268. package/dist/server/git.js.map +1 -0
  269. package/dist/server/github.d.ts +9 -0
  270. package/dist/server/github.js +8 -0
  271. package/dist/server/github.js.map +1 -0
  272. package/dist/server/launch-key.d.ts +7 -0
  273. package/dist/server/launch-key.js +33 -0
  274. package/dist/server/launch-key.js.map +1 -0
  275. package/dist/server/open-in-app.d.ts +66 -0
  276. package/dist/server/open-in-app.js +211 -0
  277. package/dist/server/open-in-app.js.map +1 -0
  278. package/dist/server/open-in-terminal.d.ts +70 -0
  279. package/dist/server/open-in-terminal.js +179 -0
  280. package/dist/server/open-in-terminal.js.map +1 -0
  281. package/dist/server/pr.d.ts +7 -0
  282. package/dist/server/pr.js +7 -0
  283. package/dist/server/pr.js.map +1 -0
  284. package/dist/server/project-context.d.ts +120 -0
  285. package/dist/server/project-context.js +182 -0
  286. package/dist/server/project-context.js.map +1 -0
  287. package/dist/server/provider-action-gate.d.ts +8 -0
  288. package/dist/server/provider-action-gate.js +56 -0
  289. package/dist/server/provider-action-gate.js.map +1 -0
  290. package/dist/server/provider-auth-runtime.d.ts +21 -0
  291. package/dist/server/provider-auth-runtime.js +66 -0
  292. package/dist/server/provider-auth-runtime.js.map +1 -0
  293. package/dist/server/server.d.ts +13138 -0
  294. package/dist/server/server.js +5263 -0
  295. package/dist/server/server.js.map +1 -0
  296. package/dist/server/static-ui.d.ts +49 -0
  297. package/dist/server/static-ui.js +92 -0
  298. package/dist/server/static-ui.js.map +1 -0
  299. package/dist/server/validators.d.ts +97 -0
  300. package/dist/server/validators.js +86 -0
  301. package/dist/server/validators.js.map +1 -0
  302. package/dist/server/ws.d.ts +85 -0
  303. package/dist/server/ws.js +218 -0
  304. package/dist/server/ws.js.map +1 -0
  305. package/dist/server/wsl.d.ts +25 -0
  306. package/dist/server/wsl.js +92 -0
  307. package/dist/server/wsl.js.map +1 -0
  308. package/dist/server-install/engine.d.ts +50 -0
  309. package/dist/server-install/engine.js +324 -0
  310. package/dist/server-install/engine.js.map +1 -0
  311. package/dist/server-install/platforms/macosx-ngrok.d.ts +6 -0
  312. package/dist/server-install/platforms/macosx-ngrok.js +345 -0
  313. package/dist/server-install/platforms/macosx-ngrok.js.map +1 -0
  314. package/dist/server-install/platforms/ubuntu-vps.d.ts +78 -0
  315. package/dist/server-install/platforms/ubuntu-vps.js +1016 -0
  316. package/dist/server-install/platforms/ubuntu-vps.js.map +1 -0
  317. package/dist/server-install/state.d.ts +52 -0
  318. package/dist/server-install/state.js +182 -0
  319. package/dist/server-install/state.js.map +1 -0
  320. package/dist/server-install/steps.d.ts +109 -0
  321. package/dist/server-install/steps.js +334 -0
  322. package/dist/server-install/steps.js.map +1 -0
  323. package/dist/server-install/strategies.d.ts +4 -0
  324. package/dist/server-install/strategies.js +20 -0
  325. package/dist/server-install/strategies.js.map +1 -0
  326. package/dist/server-install/types.d.ts +287 -0
  327. package/dist/server-install/types.js +121 -0
  328. package/dist/server-install/types.js.map +1 -0
  329. package/dist/server-install/ui.d.ts +42 -0
  330. package/dist/server-install/ui.js +130 -0
  331. package/dist/server-install/ui.js.map +1 -0
  332. package/dist/skills-banner.d.ts +22 -0
  333. package/dist/skills-banner.js +41 -0
  334. package/dist/skills-banner.js.map +1 -0
  335. package/dist/skills-remote.d.ts +84 -0
  336. package/dist/skills-remote.js +468 -0
  337. package/dist/skills-remote.js.map +1 -0
  338. package/dist/skills-update.d.ts +88 -0
  339. package/dist/skills-update.js +392 -0
  340. package/dist/skills-update.js.map +1 -0
  341. package/dist/skills.d.ts +82 -0
  342. package/dist/skills.js +251 -0
  343. package/dist/skills.js.map +1 -0
  344. package/dist/todos.d.ts +48 -0
  345. package/dist/todos.js +201 -0
  346. package/dist/todos.js.map +1 -0
  347. package/dist/ui-state.d.ts +26 -0
  348. package/dist/ui-state.js +38 -0
  349. package/dist/ui-state.js.map +1 -0
  350. package/dist/update-check.d.ts +12 -0
  351. package/dist/update-check.js +41 -0
  352. package/dist/update-check.js.map +1 -0
  353. package/dist/workflows/load.d.ts +15 -0
  354. package/dist/workflows/load.js +56 -0
  355. package/dist/workflows/load.js.map +1 -0
  356. package/dist/workflows/run.d.ts +758 -0
  357. package/dist/workflows/run.js +3389 -0
  358. package/dist/workflows/run.js.map +1 -0
  359. package/dist/workflows/types.d.ts +153 -0
  360. package/dist/workflows/types.js +212 -0
  361. package/dist/workflows/types.js.map +1 -0
  362. package/dist/workspace/agent-accounts.d.ts +153 -0
  363. package/dist/workspace/agent-accounts.js +304 -0
  364. package/dist/workspace/agent-accounts.js.map +1 -0
  365. package/dist/workspace/agent-profiles.d.ts +78 -0
  366. package/dist/workspace/agent-profiles.js +115 -0
  367. package/dist/workspace/agent-profiles.js.map +1 -0
  368. package/dist/workspace/config.d.ts +169 -0
  369. package/dist/workspace/config.js +379 -0
  370. package/dist/workspace/config.js.map +1 -0
  371. package/dist/workspace/migrations.d.ts +45 -0
  372. package/dist/workspace/migrations.js +147 -0
  373. package/dist/workspace/migrations.js.map +1 -0
  374. package/dist/workspace/projects-cli.d.ts +25 -0
  375. package/dist/workspace/projects-cli.js +172 -0
  376. package/dist/workspace/projects-cli.js.map +1 -0
  377. package/dist/workspace/projects.d.ts +109 -0
  378. package/dist/workspace/projects.js +250 -0
  379. package/dist/workspace/projects.js.map +1 -0
  380. package/dist/workspace/semaphore.d.ts +179 -0
  381. package/dist/workspace/semaphore.js +195 -0
  382. package/dist/workspace/semaphore.js.map +1 -0
  383. package/dist/workspace/ui-state.d.ts +34 -0
  384. package/dist/workspace/ui-state.js +53 -0
  385. package/dist/workspace/ui-state.js.map +1 -0
  386. package/package.json +70 -0
  387. package/scripts/check-pack.mjs +46 -0
  388. package/scripts/inline-contract.mjs +112 -0
  389. package/scripts/install-as-command.mjs +120 -0
  390. package/scripts/mock-claude.mjs +520 -0
  391. package/scripts/mock-pi-rpc.mjs +83 -0
  392. package/scripts/sync-readme.mjs +20 -0
  393. package/scripts/test-process-usage.mjs +47 -0
  394. package/web/dist/assets/alert-dialog-B4Ofsgv7.js +1 -0
  395. package/web/dist/assets/arrow-down-Dy8dup7j.js +1 -0
  396. package/web/dist/assets/arrow-left-BJaucbhn.js +1 -0
  397. package/web/dist/assets/bundle-mjs-BT31bpU6.js +1 -0
  398. package/web/dist/assets/centered-state-duPW0phQ.js +43 -0
  399. package/web/dist/assets/chevron-right-Be4A5TCS.js +1 -0
  400. package/web/dist/assets/chunk-BO2N2NFS-DE6qKn3r.js +131 -0
  401. package/web/dist/assets/collapsible-DdcNBdSk.js +1 -0
  402. package/web/dist/assets/commit-list-CgvN9vec.js +1 -0
  403. package/web/dist/assets/compare-variants-CQA2nd65.js +1 -0
  404. package/web/dist/assets/core-BCsw8oQw.js +12 -0
  405. package/web/dist/assets/css-BsVw1vtW.js +1 -0
  406. package/web/dist/assets/diff-B6Agp5Hl.js +3 -0
  407. package/web/dist/assets/diff-stat-BoXuGkgq.js +1 -0
  408. package/web/dist/assets/diff-view-CD8XI-fj.js +6 -0
  409. package/web/dist/assets/diff-woXpYk--.js +1 -0
  410. package/web/dist/assets/dropdown-menu-B3SYw-k5.js +1 -0
  411. package/web/dist/assets/editable-title-B-hjp5wl.js +1 -0
  412. package/web/dist/assets/ellipsis-vertical-BYwzw0xl.js +1 -0
  413. package/web/dist/assets/engine-javascript-FQvzRocB.js +141 -0
  414. package/web/dist/assets/file-BRj5eISx.js +1 -0
  415. package/web/dist/assets/folder-z4oT5981.js +1 -0
  416. package/web/dist/assets/git-toolbar-owSEkYld.js +1 -0
  417. package/web/dist/assets/github-Bz2VgRX3.js +1 -0
  418. package/web/dist/assets/go-rLFTqkRN.js +1 -0
  419. package/web/dist/assets/highlighted-body-OFNGDK62-BL-MfFgl.js +1 -0
  420. package/web/dist/assets/highlighter-CdHqIwFr.js +3 -0
  421. package/web/dist/assets/html-BY76lXLH.js +1 -0
  422. package/web/dist/assets/image-preview-h3WFluuy.js +1 -0
  423. package/web/dist/assets/index-BbcQNT92.css +2 -0
  424. package/web/dist/assets/index-EtQQQ6Kj.js +7 -0
  425. package/web/dist/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
  426. package/web/dist/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
  427. package/web/dist/assets/javascript-BgS3c2Ky.js +1 -0
  428. package/web/dist/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  429. package/web/dist/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  430. package/web/dist/assets/json-qhed-kSA.js +1 -0
  431. package/web/dist/assets/jsonc-CYpm1nAK.js +1 -0
  432. package/web/dist/assets/jsx-Bz0zcwM4.js +1 -0
  433. package/web/dist/assets/lib-BQXq3kEf.js +1 -0
  434. package/web/dist/assets/lib-BxQXEXDF.js +1 -0
  435. package/web/dist/assets/markdown-BYOwaDjH.js +1 -0
  436. package/web/dist/assets/markdown-DqBKYPiB.js +2 -0
  437. package/web/dist/assets/mermaid-GHXKKRXX-C4jxqUUb.js +1 -0
  438. package/web/dist/assets/new-task-form-BdJKRBJX.js +1 -0
  439. package/web/dist/assets/pill-BQfmfpYp.js +1 -0
  440. package/web/dist/assets/project-router-DxgFZY1l.js +1 -0
  441. package/web/dist/assets/prompt-templates-B6m16gq-.js +15 -0
  442. package/web/dist/assets/python-gzcpVVnB.js +1 -0
  443. package/web/dist/assets/react-runtime-CCIEwYL0.js +9 -0
  444. package/web/dist/assets/refresh-cw-mhSpxf2a.js +1 -0
  445. package/web/dist/assets/repo-git-CUNRxR3_.js +1 -0
  446. package/web/dist/assets/rolldown-runtime-QTnfLwEv.js +1 -0
  447. package/web/dist/assets/run-diff-DsmmDVfx.js +3 -0
  448. package/web/dist/assets/run-header-BkhrseLJ.js +1 -0
  449. package/web/dist/assets/rust-Cfkwpbl8.js +1 -0
  450. package/web/dist/assets/search-x-BqDMB2g8.js +1 -0
  451. package/web/dist/assets/shellscript-CLZ0U2zV.js +1 -0
  452. package/web/dist/assets/skill-empty-hint-BWEvTggc.js +1 -0
  453. package/web/dist/assets/skills-9oR_oHse.js +1 -0
  454. package/web/dist/assets/skills-DwIxnnWO.js +1 -0
  455. package/web/dist/assets/sparkles-DIoTQpyx.js +1 -0
  456. package/web/dist/assets/sql-BsFa4tDR.js +1 -0
  457. package/web/dist/assets/square-terminal-Cc7CuQxc.js +1 -0
  458. package/web/dist/assets/tab-link-D1fQgpmO.js +1 -0
  459. package/web/dist/assets/task-changes-BKeLlDpK.js +1 -0
  460. package/web/dist/assets/task-commits-gcEFZIa5.js +1 -0
  461. package/web/dist/assets/task-files-BGAqoXTW.js +2 -0
  462. package/web/dist/assets/task-thread-DT8aUYTS.js +9 -0
  463. package/web/dist/assets/textarea-BOVbfy5C.js +1 -0
  464. package/web/dist/assets/thread-loading-CypW73KD.js +1 -0
  465. package/web/dist/assets/toml-CcmNWLt0.js +1 -0
  466. package/web/dist/assets/trash-2-CJq6LHWn.js +1 -0
  467. package/web/dist/assets/triangle-alert-CjDFvU27.js +1 -0
  468. package/web/dist/assets/tsx-udAQXfEw.js +1 -0
  469. package/web/dist/assets/typescript-bsJCZSQ-.js +1 -0
  470. package/web/dist/assets/upload-CPDZlJeK.js +1 -0
  471. package/web/dist/assets/use-desktop-5JsLmi0a.js +1 -0
  472. package/web/dist/assets/use-submit-shortcut-CHVFevty.js +1 -0
  473. package/web/dist/assets/utils-DiO6zyJd.js +64 -0
  474. package/web/dist/assets/workflows-rQDFzWRt.js +11 -0
  475. package/web/dist/assets/yaml-rwi0_p6S.js +1 -0
  476. package/web/dist/assets/zoomable-image-COWqb11v.js +1 -0
  477. package/web/dist/index.html +80 -0
  478. package/web/dist/open-mercato.svg +11 -0
@@ -0,0 +1,508 @@
1
+ import { execFile } from 'node:child_process';
2
+ import { existsSync, realpathSync } from 'node:fs';
3
+ import { readdir, readFile, rm, stat } from 'node:fs/promises';
4
+ import { basename, join, resolve } from 'node:path';
5
+ import { resolveTaskDiffBase } from './git-diff-base.js';
6
+ import { isSafeGitRef } from './git-refs.js';
7
+ /**
8
+ * Git worktree per task (spec 006). Each run gets its own branch
9
+ * `cez/<id8>` checked out into `.ai/cezar/worktrees/<runId>` so agents never
10
+ * touch the user's working tree. Pattern ported from github-janitor's
11
+ * `git.ts` (createWorktree / autosaveCommit), minus the bare clone — we're
12
+ * already inside a working copy. Everything degrades: helpers never throw
13
+ * except `createWorktree`, whose failure the caller turns into a note.
14
+ */
15
+ /** Repo-relative home of all task worktrees (gitignored via .ai/cezar/.gitignore). */
16
+ export const WORKTREES_DIR = '.ai/cezar/worktrees';
17
+ const DIFF_CAP = 400_000;
18
+ /** Run git, never throw — degradation is the caller's policy. */
19
+ function git(cwd, args) {
20
+ return new Promise((resolve) => {
21
+ execFile('git', args, { cwd, maxBuffer: 32 * 1024 * 1024, encoding: 'utf8' }, (err, stdout, stderr) => resolve({ ok: !err, stdout: stdout ?? '', stderr: stderr ?? '' }));
22
+ });
23
+ }
24
+ export function branchFor(runId) {
25
+ return `cez/${runId.slice(0, 8)}`;
26
+ }
27
+ /**
28
+ * Resolve the configured base branch to something `git worktree add` can
29
+ * fork from: the local branch, its remote-tracking ref, or null — the caller
30
+ * falls back to the current branch with a note. Never throws.
31
+ *
32
+ * When BOTH the local branch and `origin/<base>` exist, prefer whichever is up
33
+ * to date. A stale LOCAL base (behind origin, because nothing fetched it into
34
+ * this worktree's repo) is the classic inflated-diff trap: the merge-base every
35
+ * diff is measured from collapses onto the stale tip, so all of the history
36
+ * merged into origin since then counts as the task's own changes — the phantom
37
+ * 142k-line diff. `origin/<base>` is the source of truth for a review base, so
38
+ * only keep the local ref when it is equal to or ahead of origin (unpushed base
39
+ * commits); otherwise use origin.
40
+ *
41
+ * This answers the question once, when the worktree is forked. The local ref
42
+ * goes stale AFTERWARDS too — agents fetch, they never pull — so every diff
43
+ * re-applies the same rule at read time through `freshestBaseRef`
44
+ * (`git-diff-base.ts`). Keep the two in agreement.
45
+ */
46
+ export async function resolveBaseRef(repoRoot, base) {
47
+ if (!isSafeGitRef(base))
48
+ return null;
49
+ const verify = (ref) => git(repoRoot, ['rev-parse', '--verify', '--quiet', `${ref}^{commit}`]).then((r) => r.ok);
50
+ const [hasLocal, hasRemote] = await Promise.all([verify(base), verify(`origin/${base}`)]);
51
+ if (hasLocal && hasRemote) {
52
+ // `--is-ancestor origin/<base> <base>` succeeds iff local is equal-or-ahead.
53
+ const localCurrent = await git(repoRoot, ['merge-base', '--is-ancestor', `origin/${base}`, base]);
54
+ return localCurrent.ok ? base : `origin/${base}`;
55
+ }
56
+ if (hasLocal)
57
+ return base;
58
+ if (hasRemote)
59
+ return `origin/${base}`;
60
+ return null;
61
+ }
62
+ export function worktreePathFor(repoRoot, runId) {
63
+ return join(repoRoot, WORKTREES_DIR, runId);
64
+ }
65
+ /** Parse `git worktree list --porcelain` without assuming paths contain no spaces. */
66
+ async function registeredWorktrees(repoRoot) {
67
+ const res = await git(repoRoot, ['worktree', 'list', '--porcelain']);
68
+ if (!res.ok)
69
+ return [];
70
+ const worktrees = [];
71
+ let current;
72
+ for (const line of res.stdout.split('\n')) {
73
+ if (line.startsWith('worktree ')) {
74
+ if (current)
75
+ worktrees.push(current);
76
+ current = { path: line.slice('worktree '.length) };
77
+ }
78
+ else if (current && line.startsWith('branch ')) {
79
+ current.branch = line.slice('branch '.length);
80
+ }
81
+ else if (!line && current) {
82
+ worktrees.push(current);
83
+ current = undefined;
84
+ }
85
+ }
86
+ if (current)
87
+ worktrees.push(current);
88
+ return worktrees;
89
+ }
90
+ function worktreeInfo(path, branch, baseBranch) {
91
+ return { path, branch, baseBranch };
92
+ }
93
+ /** Git canonicalizes symlinked path prefixes (macOS `/var` → `/private/var`). */
94
+ function canonicalPath(path) {
95
+ try {
96
+ return realpathSync(path);
97
+ }
98
+ catch {
99
+ return resolve(path);
100
+ }
101
+ }
102
+ /**
103
+ * Establish the task worktree idempotently. Besides the fresh
104
+ * `git worktree add -b` path, recover the two normal restart/deletion cases:
105
+ * reuse an already-registered task worktree, or reattach a surviving task
106
+ * branch after its directory/registration was removed. Existing non-empty
107
+ * unregistered paths are never deleted because they may hold recoverable
108
+ * uncommitted work.
109
+ */
110
+ export async function createWorktree(repoRoot, runId, baseBranch) {
111
+ let base = baseBranch;
112
+ if (!base || base === 'HEAD') {
113
+ // Detached HEAD — pin the base to the current commit so the record and
114
+ // later diffs stay meaningful.
115
+ const head = await git(repoRoot, ['rev-parse', 'HEAD']);
116
+ if (!head.ok)
117
+ throw new Error(`git rev-parse HEAD failed: ${head.stderr.trim()}`);
118
+ base = head.stdout.trim();
119
+ }
120
+ // Dash-guard (#431): `base` is spliced in as a positional git operand; an
121
+ // option-like value would be argument injection.
122
+ if (!isSafeGitRef(base))
123
+ throw new Error(`refusing option-like base ref: ${base}`);
124
+ const branch = branchFor(runId);
125
+ const absolutePath = join(canonicalPath(repoRoot), WORKTREES_DIR, runId);
126
+ const branchRef = `refs/heads/${branch}`;
127
+ // A missing directory can leave stale administrative metadata behind.
128
+ // Prune first so the checks below describe the filesystem as it exists now.
129
+ await git(repoRoot, ['worktree', 'prune']);
130
+ const canonicalTarget = canonicalPath(absolutePath);
131
+ let registered = await registeredWorktrees(repoRoot);
132
+ let atPath = registered.find((item) => canonicalPath(item.path) === canonicalTarget);
133
+ if (atPath) {
134
+ if (atPath.branch !== branchRef) {
135
+ throw new Error(`managed worktree path is registered to ${atPath.branch ?? 'a detached HEAD'}, expected ${branchRef}`);
136
+ }
137
+ return worktreeInfo(atPath.path, branch, base);
138
+ }
139
+ // If the directory survived but its administrative entry did not, let Git
140
+ // repair it. This is non-destructive; an unrepairable non-empty directory is
141
+ // preserved and reported instead of being recursively removed.
142
+ if (existsSync(absolutePath)) {
143
+ await git(repoRoot, ['worktree', 'repair', absolutePath]);
144
+ registered = await registeredWorktrees(repoRoot);
145
+ atPath = registered.find((item) => canonicalPath(item.path) === canonicalTarget);
146
+ if (atPath) {
147
+ if (atPath.branch !== branchRef) {
148
+ throw new Error(`managed worktree path is registered to ${atPath.branch ?? 'a detached HEAD'}, expected ${branchRef}`);
149
+ }
150
+ return worktreeInfo(atPath.path, branch, base);
151
+ }
152
+ const entries = await readdir(absolutePath).catch(() => ['unreadable']);
153
+ if (entries.length > 0) {
154
+ throw new Error(`managed worktree path already exists and could not be repaired: ${absolutePath}`);
155
+ }
156
+ }
157
+ const branchExists = await git(repoRoot, ['show-ref', '--verify', '--quiet', branchRef]);
158
+ if (branchExists.ok) {
159
+ // The task branch may still be checked out after its directory was moved.
160
+ // Reuse only a path whose basename is the full run id; a same-prefix UUID
161
+ // collision must fail rather than point two tasks at one worktree.
162
+ const byBranch = registered.find((item) => item.branch === branchRef);
163
+ if (byBranch) {
164
+ if (basename(byBranch.path) !== runId) {
165
+ throw new Error(`task branch ${branch} is already checked out at ${byBranch.path}`);
166
+ }
167
+ return worktreeInfo(byBranch.path, branch, base);
168
+ }
169
+ const attach = await git(repoRoot, ['worktree', 'add', absolutePath, branch]);
170
+ if (!attach.ok) {
171
+ throw new Error(`git worktree reattach failed: ${attach.stderr.trim() || attach.stdout.trim()}`);
172
+ }
173
+ return worktreeInfo(absolutePath, branch, base);
174
+ }
175
+ const create = await git(repoRoot, ['worktree', 'add', '-b', branch, absolutePath, base]);
176
+ if (!create.ok) {
177
+ throw new Error(`git worktree add failed: ${create.stderr.trim() || create.stdout.trim()}`);
178
+ }
179
+ return worktreeInfo(absolutePath, branch, base);
180
+ }
181
+ /**
182
+ * Best-effort on-disk size of a worktree directory in bytes, via POSIX
183
+ * `du -sk` (kibibytes → bytes). Returns `null` when `du` is unavailable —
184
+ * including all of Windows, where `du` is not a command — or on any error.
185
+ * Never throws and never blocks: worktree retention is count-based, so a null
186
+ * size only blanks the panel's size column, it does not affect reclamation.
187
+ */
188
+ export function worktreeSizeBytes(path) {
189
+ return new Promise((resolve) => {
190
+ execFile('du', ['-sk', path], { encoding: 'utf8' }, (err, stdout) => {
191
+ if (err) {
192
+ resolve(null);
193
+ return;
194
+ }
195
+ const kib = Number.parseInt(stdout.trim().split(/\s+/)[0] ?? '', 10);
196
+ resolve(Number.isFinite(kib) ? kib * 1024 : null);
197
+ });
198
+ });
199
+ }
200
+ /** Remove a task worktree and its branch. Best effort — never throws. */
201
+ export async function removeWorktree(repoRoot, worktreePath, branch) {
202
+ await git(repoRoot, ['worktree', 'remove', '--force', worktreePath]);
203
+ await rm(worktreePath, { recursive: true, force: true }).catch(() => undefined);
204
+ await git(repoRoot, ['worktree', 'prune']);
205
+ if (branch)
206
+ await git(repoRoot, ['branch', '-D', branch]);
207
+ }
208
+ /**
209
+ * Leftover merge-conflict markers, anchored at line start as git writes them.
210
+ * All three must appear *in order*: a bare `=======` line is ordinary Markdown
211
+ * (a setext heading underline), and any of the three alone — or the pair
212
+ * `<<<<<<<`/`>>>>>>>` in either order — occurs legitimately in checked-in
213
+ * patch fixtures and in docs that demonstrate conflict markers. Requiring the
214
+ * full ordered triple is what separates a real conflict from a file that
215
+ * merely talks about one.
216
+ */
217
+ const CONFLICT_START = /^<{7}(?:\s|$)/;
218
+ const CONFLICT_MID = /^={7}(?:\s|$)/;
219
+ const CONFLICT_END = /^>{7}(?:\s|$)/;
220
+ /**
221
+ * Largest file the marker scan will read. Autosave runs as often as every 90 s,
222
+ * and decoding a large tracked file into a JS string each time is a real memory
223
+ * cost for a check that only ever looks at a few marker lines. Oversized files
224
+ * are skipped, which fails *open* — consistent with the rest of this guard,
225
+ * where a false negative costs noise and a false positive costs the recovery
226
+ * point.
227
+ */
228
+ const MARKER_SCAN_MAX_BYTES = 2_000_000;
229
+ /** Does this file carry a complete, ordered conflict hunk? */
230
+ function hasConflictMarkers(text) {
231
+ let want = 0; // 0: `<<<<<<<`, 1: `=======`, 2: `>>>>>>>`
232
+ for (const line of text.split('\n')) {
233
+ if (want === 0) {
234
+ if (CONFLICT_START.test(line))
235
+ want = 1;
236
+ }
237
+ else if (want === 1) {
238
+ if (CONFLICT_MID.test(line))
239
+ want = 2;
240
+ }
241
+ else if (CONFLICT_END.test(line)) {
242
+ return true;
243
+ }
244
+ }
245
+ return false;
246
+ }
247
+ /**
248
+ * Stage and commit everything in the worktree as a "cezar autosave" commit
249
+ * (janitor pattern) — the agent's progress is always recoverable from the
250
+ * `cez/<id8>` branch history. Quietly a no-op when nothing changed.
251
+ *
252
+ * The message carries `reason` so the opt-in periodic timer and the always-on
253
+ * flushes are distinguishable in `git log`; the `cezar autosave` prefix is kept
254
+ * so existing log greps still match.
255
+ *
256
+ * Refuses to commit a worktree that is mid-merge or still carries conflict
257
+ * markers: the incident behind #471 was an autosave capturing a half-resolved
258
+ * merge, and a blind `git add -A` would do it again.
259
+ */
260
+ export async function autosaveCommit(dir, reason) {
261
+ const status = await git(dir, ['status', '--porcelain']);
262
+ if (!status.ok || !status.stdout.trim())
263
+ return 'nothing-to-do';
264
+ const unresolved = await unresolvedConflicts(dir, status.stdout);
265
+ if (unresolved) {
266
+ // Losing one recovery point beats poisoning the branch with a commit that
267
+ // does not build. For the periodic and turn-end flushes the next one picks
268
+ // the work up once the merge resolves; the pre-PR flush has no next one,
269
+ // which is why callers get `refused` rather than a bare `false`.
270
+ console.warn(`[cezar] skipping ${reason} autosave in ${dir}: ${unresolved}`);
271
+ return 'refused';
272
+ }
273
+ await git(dir, ['add', '-A']);
274
+ // Commit as the CURRENT git user, so the branch's commits (and any PR opened from it) are
275
+ // attributed to the real author and pass CLA / attribution checks. The old hardcoded
276
+ // `cezar <cezar@local>` identity made every autosave look like a non-GitHub user. Fall back to
277
+ // that identity ONLY when the machine has no git identity configured — otherwise `git commit`
278
+ // would fail and the autosave (the run's recovery point) would be lost.
279
+ const identityArgs = (await gitHasIdentity(dir))
280
+ ? []
281
+ : ['-c', 'user.name=cezar', '-c', 'user.email=cezar@local'];
282
+ const commit = await git(dir, [
283
+ ...identityArgs,
284
+ 'commit',
285
+ '--no-verify',
286
+ '-m',
287
+ `cezar autosave (${reason})`,
288
+ ]);
289
+ return commit.ok ? 'committed' : 'failed';
290
+ }
291
+ /**
292
+ * Is the worktree mid-merge or still carrying conflict markers? Returns a
293
+ * human-readable reason, or `null` when it is safe to autosave.
294
+ *
295
+ * Two independent checks, because they catch different failures: porcelain `U`
296
+ * codes catch an *unresolved* merge, while the marker scan catches the worse
297
+ * case — someone ran `git add` on a file they had not finished resolving, which
298
+ * clears the `U` code but leaves `<<<<<<<` in the text.
299
+ */
300
+ async function unresolvedConflicts(dir, porcelain) {
301
+ const entries = porcelain.split('\n').filter(Boolean);
302
+ const unmerged = entries.filter((line) => {
303
+ const xy = line.slice(0, 2);
304
+ // Unmerged per `git status` docs: any side U, plus the AA / DD collisions.
305
+ return xy.includes('U') || xy === 'AA' || xy === 'DD';
306
+ });
307
+ const firstUnmerged = unmerged[0];
308
+ if (firstUnmerged) {
309
+ return `${unmerged.length} unmerged path(s), e.g. ${firstUnmerged.slice(3)}`;
310
+ }
311
+ // Deleted paths have no content to scan. Untracked (`??`) ones are skipped
312
+ // even though `git add -A` will commit them: a conflict always lands in a
313
+ // tracked file, whereas an untracked fixture or doc that legitimately
314
+ // contains marker-shaped lines would otherwise wedge every autosave. False
315
+ // negatives here cost noise; false positives would cost the recovery point.
316
+ const candidates = entries
317
+ .filter((line) => !line.startsWith('D ') && !line.startsWith(' D') && !line.startsWith('??'))
318
+ .map((line) => {
319
+ // A rename reads `old -> new`; the new path is what gets committed.
320
+ const raw = line.slice(3).trim();
321
+ const path = raw.includes(' -> ') ? (raw.split(' -> ')[1] ?? raw) : raw;
322
+ return unquotePath(path);
323
+ });
324
+ for (const path of candidates) {
325
+ // Read the working tree, not the index: this runs before `git add -A`, so
326
+ // the on-disk copy is what would be committed. Binary files decode to
327
+ // mojibake rather than throwing, but cannot match the anchored marker
328
+ // pattern; unreadable paths (races, symlinks) are skipped, not fatal.
329
+ let text;
330
+ try {
331
+ const full = join(dir, path);
332
+ if ((await stat(full)).size > MARKER_SCAN_MAX_BYTES)
333
+ continue;
334
+ text = await readFile(full, 'utf8');
335
+ }
336
+ catch {
337
+ continue;
338
+ }
339
+ if (hasConflictMarkers(text)) {
340
+ return `leftover conflict markers in ${path}`;
341
+ }
342
+ }
343
+ return null;
344
+ }
345
+ /**
346
+ * Undo `git status --porcelain` path quoting. Git quotes a path containing a
347
+ * space or a non-ASCII byte, escaping the latter as octal — `café.txt` reads
348
+ * back as `"caf\303\251.txt"`. Stripping the quotes alone leaves those escapes
349
+ * literal, so the file would not open and a real conflict in it would go
350
+ * unnoticed. Decoding the octal bytes as UTF-8 restores the actual name.
351
+ */
352
+ function unquotePath(path) {
353
+ if (!path.startsWith('"') || !path.endsWith('"'))
354
+ return path;
355
+ const inner = path.slice(1, -1);
356
+ const bytes = [];
357
+ for (let i = 0; i < inner.length; i += 1) {
358
+ if (inner[i] !== '\\') {
359
+ bytes.push(...Buffer.from(inner[i], 'utf8'));
360
+ continue;
361
+ }
362
+ const next = inner[i + 1];
363
+ if (next === undefined)
364
+ break;
365
+ const octal = inner.slice(i + 1, i + 4);
366
+ if (/^[0-7]{3}$/.test(octal)) {
367
+ bytes.push(parseInt(octal, 8));
368
+ i += 3;
369
+ continue;
370
+ }
371
+ // C-style single-character escapes git also emits.
372
+ const simple = { n: 10, t: 9, r: 13, '"': 34, '\\': 92 };
373
+ const escaped = simple[next];
374
+ if (escaped === undefined)
375
+ bytes.push(...Buffer.from(next, 'utf8'));
376
+ else
377
+ bytes.push(escaped);
378
+ i += 1;
379
+ }
380
+ return Buffer.from(bytes).toString('utf8');
381
+ }
382
+ /** Does this repo/worktree resolve a git author identity (name + email)? Ambient config wins so
383
+ * autosave commits carry the user's own identity — see autosaveCommit. */
384
+ async function gitHasIdentity(dir) {
385
+ const [name, email] = await Promise.all([
386
+ git(dir, ['config', 'user.name']),
387
+ git(dir, ['config', 'user.email']),
388
+ ]);
389
+ return name.ok && name.stdout.trim() !== '' && email.ok && email.stdout.trim() !== '';
390
+ }
391
+ /**
392
+ * "What did this task change": diff of the worktree (committed + uncommitted
393
+ * + untracked, via `add -N`) against the merge-base with its base branch —
394
+ * so the diff stays *this task's* changes even after the base moves on.
395
+ *
396
+ * Deliberately does NOT take the repointed-HEAD guard that `collectChanges`
397
+ * (#591) and `worktreeShortstat` (#751) resolve through
398
+ * `resolveTaskDiffBase` — this is the whole-branch anchor on purpose, for two
399
+ * reasons. Its text output is `GET /api/v1/runs/:id/diff`, a protected surface
400
+ * (BACKWARD_COMPATIBILITY.md §2), so narrowing it would silently change what
401
+ * every existing consumer reads. And its other caller, `settleSuccess`, asks
402
+ * only "is there anything here to review at all" — over-answering that parks a
403
+ * run at the review gate, which is recoverable, while under-answering would
404
+ * settle a run to `done` with work still in the tree. If a future change wants
405
+ * the narrow answer here, take it from `resolveTaskDiffBase` rather than
406
+ * re-deriving the rule a fourth time.
407
+ */
408
+ export async function worktreeDiff(worktreePath, baseBranch, cap = DIFF_CAP) {
409
+ if (!isSafeGitRef(baseBranch))
410
+ return '(diff failed: refusing option-like base ref)';
411
+ await git(worktreePath, ['add', '-N', '.']); // intent-to-add: untracked files show up
412
+ const mergeBase = await git(worktreePath, ['merge-base', baseBranch, 'HEAD']);
413
+ const base = mergeBase.ok && mergeBase.stdout.trim() ? mergeBase.stdout.trim() : baseBranch;
414
+ const res = await git(worktreePath, ['diff', base]);
415
+ if (!res.ok)
416
+ return `(diff failed: ${res.stderr.trim() || 'unknown git error'})`;
417
+ if (res.stdout.length > cap)
418
+ return `${res.stdout.slice(0, cap)}\n… (diff truncated)`;
419
+ return res.stdout;
420
+ }
421
+ /**
422
+ * `git diff --stat` version of `worktreeDiff` (spec 010 — the variant
423
+ * comparison columns). Same merge-base anchoring, and it stays whole-branch
424
+ * for a reason of its own: variants are sibling cezar worktrees, each on its
425
+ * own `cez/*` branch, and the column exists to compare their *committed* work
426
+ * against one another. Narrowing one variant to its uncommitted tree would
427
+ * make the comparison meaningless rather than more honest. Returns '' on any
428
+ * failure. (The task-diff rule the other surfaces follow: `git-diff-base.ts`.)
429
+ */
430
+ export async function worktreeDiffStat(worktreePath, baseBranch) {
431
+ if (!isSafeGitRef(baseBranch))
432
+ return '';
433
+ await git(worktreePath, ['add', '-N', '.']); // intent-to-add: untracked files show up
434
+ const mergeBase = await git(worktreePath, ['merge-base', baseBranch, 'HEAD']);
435
+ const base = mergeBase.ok && mergeBase.stdout.trim() ? mergeBase.stdout.trim() : baseBranch;
436
+ const res = await git(worktreePath, ['diff', '--stat', base]);
437
+ return res.ok ? res.stdout.trim() : '';
438
+ }
439
+ /**
440
+ * Parse `git diff --shortstat` output — " 3 files changed, 10 insertions(+),
441
+ * 2 deletions(-)". Every part is optional: insertions-only and deletions-only
442
+ * diffs omit the other counter, and an empty diff prints nothing at all
443
+ * (→ all zeros). The wording is stable porcelain English — git does not
444
+ * localize `--shortstat` — so matching the words is safe.
445
+ */
446
+ export function parseShortstat(s) {
447
+ const files = /(\d+) files? changed/.exec(s);
448
+ const adds = /(\d+) insertions?\(\+\)/.exec(s);
449
+ const dels = /(\d+) deletions?\(-\)/.exec(s);
450
+ return {
451
+ files: files ? Number(files[1]) : 0,
452
+ adds: adds ? Number(adds[1]) : 0,
453
+ dels: dels ? Number(dels[1]) : 0,
454
+ };
455
+ }
456
+ /**
457
+ * `git diff --shortstat` of the worktree vs its base (#389) — the numbers
458
+ * behind `RunRecord.diffStat`, which is what the sidebar quick list and the
459
+ * Tasks table show. Same intent-to-add as `worktreeDiff`, but the anchor comes
460
+ * from the shared `resolveTaskDiffBase` rule (`git-diff-base.ts`): pass the
461
+ * run's own `taskBranch` and `runStartedAt`, and a worktree whose HEAD was
462
+ * repointed onto another branch reports what this run did to that branch
463
+ * instead of claiming the branch's whole diff as this task's (#751 — the #591
464
+ * guard, on this surface). The same rule re-resolves a stale local base ref,
465
+ * so the number never counts upstream history the task merely forked from.
466
+ *
467
+ * `repointed: true` rides along on the returned stat exactly when that
468
+ * narrowing happened, so the UI can say why the number is what it is. Null on
469
+ * git failure (the caller notes it, never fails the run); an empty diff is a
470
+ * valid all-zero stat.
471
+ */
472
+ export async function worktreeShortstat(worktreePath, baseBranch, opts = {}) {
473
+ if (!isSafeGitRef(baseBranch))
474
+ return null;
475
+ await git(worktreePath, ['add', '-N', '.']); // intent-to-add: untracked files show up
476
+ const { base, repointedHead } = await resolveTaskDiffBase((args) => git(worktreePath, args), baseBranch, opts);
477
+ const res = await git(worktreePath, ['diff', '--shortstat', base]);
478
+ if (!res.ok)
479
+ return null;
480
+ // The key stays ABSENT (not `false`) on a normal run: `diffStat` is persisted in
481
+ // `runs.json` and served on the runs API, so the un-narrowed shape must keep
482
+ // round-tripping byte-identically.
483
+ return { ...parseShortstat(res.stdout), ...(repointedHead ? { repointed: true } : {}) };
484
+ }
485
+ /**
486
+ * Startup reconcile: `git worktree prune` + remove every directory under
487
+ * `.ai/cezar/worktrees/` whose run id is no longer in the store (and its
488
+ * branch). Returns the removed run ids for the boot log. Never throws.
489
+ */
490
+ export async function pruneOrphans(repoRoot, validIds) {
491
+ await git(repoRoot, ['worktree', 'prune']);
492
+ let entries;
493
+ try {
494
+ entries = await readdir(join(repoRoot, WORKTREES_DIR), { withFileTypes: true });
495
+ }
496
+ catch {
497
+ return []; // no worktrees dir yet
498
+ }
499
+ const removed = [];
500
+ for (const entry of entries) {
501
+ if (!entry.isDirectory() || validIds.has(entry.name))
502
+ continue;
503
+ await removeWorktree(repoRoot, worktreePathFor(repoRoot, entry.name), branchFor(entry.name));
504
+ removed.push(entry.name);
505
+ }
506
+ return removed;
507
+ }
508
+ //# sourceMappingURL=git-worktree.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-worktree.js","sourceRoot":"","sources":["../src/git-worktree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAe,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C;;;;;;;GAOG;AAEH,sFAAsF;AACtF,MAAM,CAAC,MAAM,aAAa,GAAG,qBAAqB,CAAC;AAEnD,MAAM,QAAQ,GAAG,OAAO,CAAC;AAazB,iEAAiE;AACjE,SAAS,GAAG,CAAC,GAAW,EAAE,IAAc;IACtC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,QAAQ,CACN,KAAK,EACL,IAAI,EACJ,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,EACtD,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,IAAI,EAAE,EAAE,C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ACpC,CAAC;IACD,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,IAAI,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;YAAE,SAAS;QAC/D,MAAM,cAAc,CAAC,QAAQ,EAAE,eAAe,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QAC7F,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Per-task handoff journal (spec 007): `.ai/cezar/runs/<runId>.handoff.md`,
3
+ * next to the run's NDJSON events and outside the task worktree — it survives
4
+ * worktree removal. Cez seeds the skeleton and appends heartbeats; the agent
5
+ * (told via CEZ_HANDOFF_FILE + the system-prompt fragment below) keeps the
6
+ * "Progress log" and "Resume notes" sections up to date. Everything here is
7
+ * best-effort: the handoff is a journal, never a reason to fail a run.
8
+ */
9
+ export declare function handoffPath(dataDir: string, runId: string): string;
10
+ export interface HandoffSeed {
11
+ id: string;
12
+ title: string;
13
+ workflow: string;
14
+ task: string;
15
+ branch?: string;
16
+ worktreePath?: string;
17
+ }
18
+ /** Create the handoff skeleton. Idempotent — an existing file (resume,
19
+ * continuation) is never overwritten. Returns the file path. */
20
+ export declare function seedHandoffFile(dataDir: string, run: HandoffSeed): string;
21
+ /**
22
+ * Cez's own heartbeat (the janitor pattern): insert `- <ISO ts> — <note>`
23
+ * right under the `## Progress log` header (newest at the top), so the file
24
+ * stays current even when the agent forgets to write. Missing header →
25
+ * append at the end of the file; missing file → no-op.
26
+ */
27
+ export declare function appendHandoffHeartbeat(dataDir: string, runId: string, note: string): void;
28
+ /** Full handoff markdown, or '' when the file doesn't exist (yet). */
29
+ export declare function readHandoff(dataDir: string, runId: string): string;
30
+ /**
31
+ * First few non-empty lines under "## Progress log" (spec 010 — the variant
32
+ * comparison columns). Stops at the next `## ` header; '' when there's no
33
+ * Progress log section or it's empty.
34
+ */
35
+ export declare function handoffProgressExcerpt(text: string, maxLines?: number): string;
36
+ export declare function deleteHandoff(dataDir: string, runId: string): void;
37
+ /**
38
+ * Is the global follow-up inbox on? (#471)
39
+ *
40
+ * Opt-in, off by default: agents kept hanging on stale, pre-saved follow-ups,
41
+ * which made skill behavior unpredictable. This is the single source of truth —
42
+ * `resolveCapabilities` reports it to the UI and `RunManager` enforces it on
43
+ * every run, so the HTTP route, the `cezar run` CLI and the inbox's own "▶ Run"
44
+ * cannot drift apart. The per-task handoff journal is a separate feature and is
45
+ * never gated by this.
46
+ *
47
+ * An exact `'1'` opts in — the house spelling (`AGENTS.md`: "opt-in behind a
48
+ * `CEZ_*` flag, off by default").
49
+ */
50
+ export declare function followupsEnabled(env?: NodeJS.ProcessEnv): boolean;
51
+ /**
52
+ * Appended to every agent step's `--append-system-prompt` (spec 007). The
53
+ * matching handoff/task env vars are set on every agent process;
54
+ * CEZ_TODOS_FILE carries a usable path only when follow-up generation is
55
+ * enabled (#444, #471) — opted-out runs get it empty, never absent, so an
56
+ * inherited value from a parent cezar cannot shine through
57
+ * (`RunManager.agentEnv`).
58
+ */
59
+ export declare const HANDOFF_ONLY_INSTRUCTIONS = "## Handoff (cezar)\n\nCEZ_HANDOFF_FILE (env) is the absolute path to this task's rolling handoff file. Treat it like a HANDOFF.md:\n1. At the start of work, read it \u2014 \"Resume notes\" left by a previous session is your starting context.\n2. After every meaningful milestone (passing tests, a commit, a PR, a scope decision), append one terse timestamped line under \"## Progress log\", newest at the top.\n3. Before finishing or pausing, update \"## Resume notes\" with what's done, what's next and any blockers. Leave it empty only when the task is truly complete.\n\nTask completion marker: when the task's goal is fully achieved and you have no question for the user, end your final message with a line containing exactly CEZ:DONE \u2014 cez then closes the session and marks the task finished. If you are waiting on the user (a question, a decision, missing input), just end your message normally; the session stays open for their reply. Never emit CEZ:DONE while anything is unfinished or unverified.\n\nStill-working marker: if you end a turn while still working on your OWN downstream work \u2014 a sub-agent you dispatched, or a long-running command you're monitoring \u2014 and are NOT waiting on the user for anything, end your final message with a line containing exactly CEZ:MONITORING. cez then shows the task as \"monitoring\" (still working) instead of asking for your attention. Use CEZ:MONITORING only for that in-progress case; use CEZ:DONE when the goal is done; end plainly (no marker) only when you are genuinely waiting on the user. Never combine CEZ:MONITORING with CEZ:DONE.\n\nStructured question marker: when you are blocked on a decision that is genuinely the user's to make \u2014 one you cannot resolve from the request, the code, or sensible defaults \u2014 and it comes down to a few concrete choices, end your turn with a single line CEZ:ASK <json> instead of asking in prose. cez renders it as clickable option chips in the cockpit so the user can answer in one tap. The <json> is ONE object on ONE line, the last thing in your message: {\"questions\":[{\"header\":\"\u226412-char label\",\"question\":\"a clear question ending in ?\",\"multiSelect\":false,\"options\":[{\"label\":\"short choice\",\"description\":\"what it means / the trade-off\"}]}]} \u2014 use only those keys (plus an optional non-empty \"id\" up to 64 characters), with 1\u20134 questions, 2\u20134 options per question, unique question text and option labels, header 1\u201312 characters, question 1\u2013400, option label 1\u201360, and description at most 280. The user can always type a free-form reply, so never add an \"Other\" option. Prefer sensible defaults over asking; use CEZ:ASK only when the choice is truly the user's. Never combine CEZ:ASK with CEZ:DONE or CEZ:MONITORING.\n\nTask reference markers: as soon as you know which GitHub pull request or issue this task is ABOUT (it was named in the task, or you just opened it), declare it by emitting, on its own line in your message text: CEZ:PR=<number> and/or CEZ:ISSUE=<number>. Re-emit with the new number if the subject changes (e.g. you open a PR later in the task). Declare only the task's own subject \u2014 never a PR/issue you merely mention, list, or compare against. You may also emit CEZ:TITLE=<terse gerund phrase, max 40 chars, e.g. \"implementing comment threads\"> once the work has a clearer shape than its current title; cez uses these instead of guessing from the transcript. Put markers in plain message text, never inside a code fence.\n\n## Pasted attachments\nUser-pasted screenshots/files are saved as real files; their absolute paths are listed in the message that carries them. Use those paths when a task needs the file itself (saving, uploading, attaching to issues/PRs); the inline image is for viewing only.";
60
+ export declare const FOLLOWUP_INSTRUCTIONS = "## Follow-ups (cezar)\n\nCEZ_TODOS_FILE (env) is the absolute path to the user's follow-up inbox \u2014 a JSON array. Only append an entry when a genuinely actionable follow-up remains: something concrete a human or the next agent still needs to decide or do (a review nit worth a dedicated pass, a manual step you cannot take yourself, a decision blocked on the user, a known next task). Do NOT append filler \u2014 a restated summary of what you just finished, a congratulatory note, or \"no further action needed\" is not a follow-up; when the task is simply done, skip this file entirely. When (and only when) a real follow-up exists, read the file (treat a missing file as []), append ONE object and write the whole array back:\n{ \"ts\": \"<ISO 8601>\", \"taskId\": \"<value of CEZ_TASK_ID>\", \"summary\": \"<one sentence: the concrete next action, not a status report>\", \"action\": \"<imperative user action, optional>\", \"prUrl\": \"<optional>\", \"suggestedSkill\": \"<optional skill name for the follow-up>\", \"suggestedArgs\": \"<optional>\", \"suggestedPrompt\": \"<optional freeform prompt for the follow-up task>\", \"runnable\": <true when an agent can execute this follow-up, false when it is a note> }\nSet \"runnable\": false for anything a human must do or merely read \u2014 manual QA, \"remember to\u2026\", informational notes \u2014 and leave out suggestedSkill/suggestedPrompt for those; the inbox then offers \"Acknowledge\" instead of \"Run\". Set \"runnable\": true only when suggestedSkill or suggestedPrompt says what to actually execute.\nNever modify or remove existing entries \u2014 append only.";
61
+ /** Default-on combined contract retained for old callers and runs. */
62
+ export declare const HANDOFF_INSTRUCTIONS = "## Handoff (cezar)\n\nCEZ_HANDOFF_FILE (env) is the absolute path to this task's rolling handoff file. Treat it like a HANDOFF.md:\n1. At the start of work, read it \u2014 \"Resume notes\" left by a previous session is your starting context.\n2. After every meaningful milestone (passing tests, a commit, a PR, a scope decision), append one terse timestamped line under \"## Progress log\", newest at the top.\n3. Before finishing or pausing, update \"## Resume notes\" with what's done, what's next and any blockers. Leave it empty only when the task is truly complete.\n\nTask completion marker: when the task's goal is fully achieved and you have no question for the user, end your final message with a line containing exactly CEZ:DONE \u2014 cez then closes the session and marks the task finished. If you are waiting on the user (a question, a decision, missing input), just end your message normally; the session stays open for their reply. Never emit CEZ:DONE while anything is unfinished or unverified.\n\nStill-working marker: if you end a turn while still working on your OWN downstream work \u2014 a sub-agent you dispatched, or a long-running command you're monitoring \u2014 and are NOT waiting on the user for anything, end your final message with a line containing exactly CEZ:MONITORING. cez then shows the task as \"monitoring\" (still working) instead of asking for your attention. Use CEZ:MONITORING only for that in-progress case; use CEZ:DONE when the goal is done; end plainly (no marker) only when you are genuinely waiting on the user. Never combine CEZ:MONITORING with CEZ:DONE.\n\nStructured question marker: when you are blocked on a decision that is genuinely the user's to make \u2014 one you cannot resolve from the request, the code, or sensible defaults \u2014 and it comes down to a few concrete choices, end your turn with a single line CEZ:ASK <json> instead of asking in prose. cez renders it as clickable option chips in the cockpit so the user can answer in one tap. The <json> is ONE object on ONE line, the last thing in your message: {\"questions\":[{\"header\":\"\u226412-char label\",\"question\":\"a clear question ending in ?\",\"multiSelect\":false,\"options\":[{\"label\":\"short choice\",\"description\":\"what it means / the trade-off\"}]}]} \u2014 use only those keys (plus an optional non-empty \"id\" up to 64 characters), with 1\u20134 questions, 2\u20134 options per question, unique question text and option labels, header 1\u201312 characters, question 1\u2013400, option label 1\u201360, and description at most 280. The user can always type a free-form reply, so never add an \"Other\" option. Prefer sensible defaults over asking; use CEZ:ASK only when the choice is truly the user's. Never combine CEZ:ASK with CEZ:DONE or CEZ:MONITORING.\n\nTask reference markers: as soon as you know which GitHub pull request or issue this task is ABOUT (it was named in the task, or you just opened it), declare it by emitting, on its own line in your message text: CEZ:PR=<number> and/or CEZ:ISSUE=<number>. Re-emit with the new number if the subject changes (e.g. you open a PR later in the task). Declare only the task's own subject \u2014 never a PR/issue you merely mention, list, or compare against. You may also emit CEZ:TITLE=<terse gerund phrase, max 40 chars, e.g. \"implementing comment threads\"> once the work has a clearer shape than its current title; cez uses these instead of guessing from the transcript. Put markers in plain message text, never inside a code fence.\n\n## Pasted attachments\nUser-pasted screenshots/files are saved as real files; their absolute paths are listed in the message that carries them. Use those paths when a task needs the file itself (saving, uploading, attaching to issues/PRs); the inline image is for viewing only.\n\n## Follow-ups (cezar)\n\nCEZ_TODOS_FILE (env) is the absolute path to the user's follow-up inbox \u2014 a JSON array. Only append an entry when a genuinely actionable follow-up remains: something concrete a human or the next agent still needs to decide or do (a review nit worth a dedicated pass, a manual step you cannot take yourself, a decision blocked on the user, a known next task). Do NOT append filler \u2014 a restated summary of what you just finished, a congratulatory note, or \"no further action needed\" is not a follow-up; when the task is simply done, skip this file entirely. When (and only when) a real follow-up exists, read the file (treat a missing file as []), append ONE object and write the whole array back:\n{ \"ts\": \"<ISO 8601>\", \"taskId\": \"<value of CEZ_TASK_ID>\", \"summary\": \"<one sentence: the concrete next action, not a status report>\", \"action\": \"<imperative user action, optional>\", \"prUrl\": \"<optional>\", \"suggestedSkill\": \"<optional skill name for the follow-up>\", \"suggestedArgs\": \"<optional>\", \"suggestedPrompt\": \"<optional freeform prompt for the follow-up task>\", \"runnable\": <true when an agent can execute this follow-up, false when it is a note> }\nSet \"runnable\": false for anything a human must do or merely read \u2014 manual QA, \"remember to\u2026\", informational notes \u2014 and leave out suggestedSkill/suggestedPrompt for those; the inbox then offers \"Acknowledge\" instead of \"Run\". Set \"runnable\": true only when suggestedSkill or suggestedPrompt says what to actually execute.\nNever modify or remove existing entries \u2014 append only.";