@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,520 @@
1
+ #!/usr/bin/env node
2
+ // Mock `claude` binary for CEZ_DRY_RUN=1 — emits a plausible stream-json
3
+ // session so the engine / store / GUI can be exercised without tokens.
4
+ // Mirrors the real CLI's contract in SESSION mode: keeps reading {type:user}
5
+ // NDJSON lines from stdin, answers each with a scripted turn (assistant
6
+ // events + a terminal `result`), and exits when stdin closes (EOF).
7
+
8
+ import { createInterface } from 'node:readline';
9
+ import { appendFileSync, readFileSync, writeFileSync } from 'node:fs';
10
+
11
+ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
12
+ const emit = (obj) => process.stdout.write(`${JSON.stringify(obj)}\n`);
13
+
14
+ // Testability hook: CEZ_MOCK_ARGS_FILE=<path> appends the argv this mock was
15
+ // spawned with (one JSON array per line), so tests and dry-run proofs can
16
+ // assert exactly what reached the CLI (e.g. `--append-system-prompt …`).
17
+ if (process.env.CEZ_MOCK_ARGS_FILE) {
18
+ try {
19
+ appendFileSync(process.env.CEZ_MOCK_ARGS_FILE, `${JSON.stringify(process.argv.slice(2))}\n`);
20
+ } catch {
21
+ // best effort — never break the mock over the hook
22
+ }
23
+ }
24
+
25
+ emit({ type: 'system', subtype: 'init' });
26
+
27
+ let turn = 0;
28
+
29
+ // A tiny generated PNG (320x200) standing in for a browser screenshot.
30
+ const MOCK_SCREENSHOT_B64 =
31
+ 'iVBORw0KGgoAAAANSUhEUgAAAUAAAADICAIAAAAWZq/8AAACMklEQVR42u3csQnAIBRFUQdJY+b4tfvP4AhCLKyyghAMMRw4Ezz/bU0RBdhUMgEIGBAwIGAQMCBgQMCAgEHAgIABAYOAAQEDAgYEDAIGBAwsCLhfDdiUgEHAgIABAYOAAQEDAgYEDAIGBAwIGAT8vlEr/ImAQcACBgELGAQsYAQsYBCwgEHAAgYBe3IELGAQsIBBwAJGwAIGAQsYBCxgELCAEbCAQcACBgELGAQMAhYwCFjAIGABI2D/QgMCBgEDAgYEDAgYBAwIGBAwCBgQMCBgQMAgYEDAgIBBwCYAAQMCBgQMAgYEDAgYEDAIGBAwIGAQMCBgQMCAgEHAgIABAQMCBgEDAgYEDAIGBAwIGBAwCBgQMCBgQMAgYEDAgIBBwICAAQEDAgYBAwIGBAwCtgIIGBAwIGAQMCBgQMCAgEHAgIABAYOAeejMB/McjIAFLGABW0HAAhYwmhSwgAUsYAQsYAELGAELWMACRsACFrCAEbCABSxgBCxgAQtYwAhYwAIWMAIWsIAFjIAFLGABI2ABC1jACFjAAhYwAhawgAWMgAUsYAEjYAELWMACRsACFrCAEbCABSxgBCxgAQsYAQtYwAJGwAIWMCBgQMAgYEDAgIBBwICAAQEDAgYBAwIGBAwCBgQMCBgQMAgYEDAgYEDAIGBAwICAQcCAgAEBAwIGAQMCBgQMCBgEDAgYEDAIGBAwIGBAwCBgQMCAgAEBg4ABAQMCBgEDAgYEDAgYBAx8xQ1bxBr9kelHqgAAAABJRU5ErkJggg==';
32
+
33
+
34
+ // Spec 007: behave like an agent that read the handoff/todos instructions —
35
+ // append a progress line to CEZ_HANDOFF_FILE and a follow-up entry to
36
+ // CEZ_TODOS_FILE, so the inbox loop is testable without tokens.
37
+ function writeHandoffAndTodo() {
38
+ try {
39
+ const handoff = process.env.CEZ_HANDOFF_FILE;
40
+ if (handoff) {
41
+ const text = readFileSync(handoff, 'utf8');
42
+ const line = `- ${new Date().toISOString()} — mock: implemented the change (dry run)\n`;
43
+ const marker = '## Progress log\n';
44
+ const idx = text.indexOf(marker);
45
+ const next =
46
+ idx >= 0
47
+ ? text.slice(0, idx + marker.length) + '\n' + line + text.slice(idx + marker.length).replace(/^\n+/, '')
48
+ : text + line;
49
+ writeFileSync(handoff, next, 'utf8');
50
+ }
51
+ } catch {
52
+ // best effort — the mock still answers without a handoff file
53
+ }
54
+ try {
55
+ const todosFile = process.env.CEZ_TODOS_FILE;
56
+ if (todosFile) {
57
+ let items = [];
58
+ try {
59
+ items = JSON.parse(readFileSync(todosFile, 'utf8'));
60
+ } catch {
61
+ items = []; // missing or broken file — start fresh, append-only
62
+ }
63
+ if (!Array.isArray(items)) items = [];
64
+ items.push({
65
+ ts: new Date().toISOString(),
66
+ taskId: process.env.CEZ_TASK_ID,
67
+ summary: 'Follow up: verify the mock change',
68
+ suggestedPrompt: 'Verify the change from the previous task',
69
+ });
70
+ writeFileSync(todosFile, JSON.stringify(items, null, 2), 'utf8');
71
+ }
72
+ } catch {
73
+ // best effort
74
+ }
75
+ }
76
+
77
+ async function respond(userText, imageCount) {
78
+ turn += 1;
79
+ await sleep(250);
80
+ // `mock:done` anywhere in the message → the reply ends with the CEZ:DONE
81
+ // completion marker (#347), so the auto-close path is testable dry.
82
+ const doneMarker = userText.includes('mock:done') ? '\n\nCEZ:DONE' : '';
83
+ // `mock:monitoring` → the reply ends with CEZ:MONITORING, the "still working
84
+ // on downstream work" marker (#490), so the monitoring-status path is testable dry.
85
+ const monitoringMarker = userText.includes('mock:monitoring') ? '\n\nCEZ:MONITORING' : '';
86
+ // `mock:ask` → the reply ends with a valid CEZ:ASK marker (#473), so the
87
+ // AskUser card path (park `waiting` + emit `ask.requested`) is testable dry.
88
+ // `mock:ask-bad` → a MALFORMED marker (invalid JSON), to prove graceful
89
+ // degradation: the run still parks `waiting`, no ask card, prose preserved.
90
+ // `mock:ask-invalid` → syntactically valid JSON that FAILS the ask schema
91
+ // (empty questions) — the shape behind the blank-question bug: no card will
92
+ // ever render it, so the marker must survive in the v1 text.
93
+ // `mock:ask-near` → bounded presentation drift: harmless extra keys plus
94
+ // an overlong header/description. It should normalize into exactly one card.
95
+ const askMarker = userText.includes('mock:ask-bad')
96
+ ? '\n\nCEZ:ASK {not valid json'
97
+ : userText.includes('mock:ask-invalid')
98
+ ? '\n\nCEZ:ASK {"questions":[]}'
99
+ : userText.includes('mock:ask-near')
100
+ ? '\n\nCEZ:ASK ' +
101
+ JSON.stringify({
102
+ transportHint: 'render as chips',
103
+ questions: [
104
+ {
105
+ header: 'Implementation path',
106
+ question: 'Which implementation should I use?',
107
+ presentation: 'compact',
108
+ options: [
109
+ { label: 'Minimal', description: 'd'.repeat(300), recommended: true },
110
+ { label: 'Expanded', description: 'Touch the wider surface' },
111
+ ],
112
+ },
113
+ ],
114
+ })
115
+ : userText.includes('mock:ask')
116
+ ? '\n\nCEZ:ASK ' +
117
+ JSON.stringify({
118
+ questions: [
119
+ {
120
+ header: 'Library',
121
+ question: 'Which date library should I standardize on?',
122
+ options: [
123
+ { label: 'date-fns', description: 'Tree-shakeable, functional' },
124
+ { label: 'Luxon', description: 'Immutable, tz-aware' },
125
+ ],
126
+ },
127
+ ],
128
+ })
129
+ : '';
130
+ // `mock:refs` → the reply carries the in-band task-reference markers
131
+ // (spec 2026-07-18-task-ref-markers), so the declaration path is testable dry.
132
+ const refsMarkers = userText.includes('mock:refs')
133
+ ? '\nCEZ:PR=4242\nCEZ:ISSUE=17\nCEZ:TITLE=implementing marker refs'
134
+ : '';
135
+
136
+ // `mock:slow` → hold the turn for ~25 s so queue states are observable.
137
+ if (userText.includes('mock:slow')) await sleep(25_000);
138
+
139
+ // Mirrors the real Claude Code 2.1.148 revoked-token envelope: the CLI puts
140
+ // the credential failure in an `is_error` result even though its subtype is
141
+ // `success`, rather than emitting a dedicated error frame.
142
+ if (userText.includes('mock:auth-error')) {
143
+ emit({
144
+ type: 'result',
145
+ subtype: 'success',
146
+ is_error: true,
147
+ result: 'Failed to authenticate. API Error: 401 OAuth access token has been revoked.',
148
+ usage: { input_tokens: 0, output_tokens: 0 },
149
+ total_cost_usd: 0,
150
+ });
151
+ return;
152
+ }
153
+
154
+ // `mock:limit` → the envelope Claude Code emits when the subscription window is
155
+ // exhausted: an `is_error` result whose text is the machine-readable
156
+ // `Claude AI usage limit reached|<epoch seconds>` marker. Makes the auto-resume path
157
+ // (spec 2026-08-03-auto-resume-after-usage-limit) reachable under CEZ_DRY_RUN=1 for QA and
158
+ // the e2e smoke. `CEZ_MOCK_LIMIT_RESET_SECONDS` moves the reset instant (default 60 s out),
159
+ // so a dry run can actually watch the resume fire instead of reading about it.
160
+ if (userText.includes('mock:limit')) {
161
+ const configured = Number(process.env.CEZ_MOCK_LIMIT_RESET_SECONDS ?? '60');
162
+ const seconds = Number.isFinite(configured) ? configured : 60;
163
+ emit({
164
+ type: 'result',
165
+ subtype: 'success',
166
+ is_error: true,
167
+ result: `Claude AI usage limit reached|${Math.floor(Date.now() / 1000) + seconds}`,
168
+ usage: { input_tokens: 0, output_tokens: 0 },
169
+ total_cost_usd: 0,
170
+ });
171
+ return;
172
+ }
173
+
174
+ // `mock:md` → answer with a markdown-rich reply (#346 QA: tables, nested
175
+ // lists, emphasis, fences, quotes) instead of the scripted turn.
176
+ if (userText.includes('mock:md')) {
177
+ const md = [
178
+ '## Markdown fixture',
179
+ 'This paragraph is soft-wrapped\nacross two source lines.',
180
+ '',
181
+ '| Column | Align | Result |',
182
+ '|:-------|:-----:|-------:|',
183
+ '| left `code` | *center* | **42** |',
184
+ '| ~~old~~ new | mid | $1.50 |',
185
+ '',
186
+ '- top item with *emphasis*',
187
+ ' - nested child with `code`',
188
+ ' - [x] deep done task',
189
+ ' - [ ] nested todo',
190
+ '- second top',
191
+ '',
192
+ '> quoted intro',
193
+ '> - quoted list item',
194
+ '',
195
+ '```ts',
196
+ 'const answer: number = 42;',
197
+ '```',
198
+ 'Literal guards: snake_case_name, 2*3 and <script>alert(1)</script>.',
199
+ ].join('\n');
200
+ emit({
201
+ type: 'assistant',
202
+ message: { role: 'assistant', content: [{ type: 'text', text: md }], usage: { input_tokens: 100, output_tokens: 200 } },
203
+ });
204
+ await sleep(100);
205
+ emit({ type: 'result', subtype: 'success', result: md, usage: { input_tokens: 100, output_tokens: 200 }, total_cost_usd: 0.001 });
206
+ return;
207
+ }
208
+
209
+ // `mock:subagents` → a parallel fan-out: two `Task` spawns whose child items
210
+ // carry `parent_tool_use_id`, interleaved the way a real fan-out interleaves,
211
+ // then their results. Makes the Agents dock and its drill-down sheet reachable
212
+ // under CEZ_DRY_RUN=1 for QA, screenshots and the e2e smoke (spec
213
+ // `.ai/specs/2026-07-20-grouped-subagent-display.md` §"Testability hook", #474).
214
+ // Derived from the `subagent-task.ndjson` golden fixture's wire shape.
215
+ if (userText.includes('mock:subagents')) {
216
+ const agents = [
217
+ {
218
+ id: `toolu_task_a_${turn}`,
219
+ description: 'Audit the auth flow',
220
+ subagent_type: 'general-purpose',
221
+ steps: [
222
+ { text: 'Scanning the auth middleware.' },
223
+ { tool: 'Grep', id: `toolu_sub_a1_${turn}`, input: { pattern: 'session', path: 'src' }, result: 'src/middleware.ts:12: clearSession()' },
224
+ { tool: 'Read', id: `toolu_sub_a2_${turn}`, input: { file_path: 'src/middleware.ts' }, result: 'export function middleware() { clearSession() }' },
225
+ ],
226
+ result: 'The session cookie is dropped in src/middleware.ts:12 (clearSession on every redirect).',
227
+ },
228
+ {
229
+ id: `toolu_task_b_${turn}`,
230
+ description: 'Review the store layer',
231
+ subagent_type: 'code-reviewer',
232
+ steps: [
233
+ { text: 'Reading the runs store.' },
234
+ { tool: 'Bash', id: `toolu_sub_b1_${turn}`, input: { command: 'npm test -- runs/store' }, result: '12 passed' },
235
+ ],
236
+ result: 'Store layer looks correct; one debounce edge case worth a follow-up.',
237
+ },
238
+ ];
239
+
240
+ // Both spawns first — that is what makes it a FAN-OUT rather than two
241
+ // sequential agents, and what the dock's "N/M" odometer counts.
242
+ for (const agent of agents) {
243
+ emit({
244
+ type: 'assistant',
245
+ message: {
246
+ role: 'assistant',
247
+ content: [
248
+ {
249
+ type: 'tool_use',
250
+ id: agent.id,
251
+ name: 'Task',
252
+ input: { description: agent.description, prompt: `${agent.description}.`, subagent_type: agent.subagent_type },
253
+ },
254
+ ],
255
+ usage: { input_tokens: 900, output_tokens: 95 },
256
+ },
257
+ parent_tool_use_id: null,
258
+ });
259
+ await sleep(200);
260
+ }
261
+
262
+ // Children, interleaved across agents so the activity lines visibly race.
263
+ const maxSteps = Math.max(...agents.map((agent) => agent.steps.length));
264
+ for (let i = 0; i < maxSteps; i += 1) {
265
+ for (const agent of agents) {
266
+ const step = agent.steps[i];
267
+ if (!step) continue;
268
+ if (step.text !== undefined) {
269
+ emit({
270
+ type: 'assistant',
271
+ message: { role: 'assistant', content: [{ type: 'text', text: step.text }], usage: { input_tokens: 300, output_tokens: 25 } },
272
+ parent_tool_use_id: agent.id,
273
+ });
274
+ } else {
275
+ emit({
276
+ type: 'assistant',
277
+ message: {
278
+ role: 'assistant',
279
+ content: [{ type: 'tool_use', id: step.id, name: step.tool, input: step.input }],
280
+ usage: { input_tokens: 40, output_tokens: 50 },
281
+ },
282
+ parent_tool_use_id: agent.id,
283
+ });
284
+ await sleep(250);
285
+ emit({
286
+ type: 'user',
287
+ message: { role: 'user', content: [{ type: 'tool_result', tool_use_id: step.id, content: step.result }] },
288
+ parent_tool_use_id: agent.id,
289
+ });
290
+ }
291
+ await sleep(250);
292
+ }
293
+ }
294
+
295
+ // The spawns settle — `parent_tool_use_id: null`, they belong to the main turn.
296
+ for (const agent of agents) {
297
+ emit({
298
+ type: 'user',
299
+ message: { role: 'user', content: [{ type: 'tool_result', tool_use_id: agent.id, content: agent.result }] },
300
+ parent_tool_use_id: null,
301
+ });
302
+ await sleep(200);
303
+ }
304
+
305
+ const summary = 'Both sub-agents reported back: the redirect drops the cookie in src/middleware.ts:12, and the store layer is clean. (dry-run mock)';
306
+ emit({
307
+ type: 'assistant',
308
+ message: { role: 'assistant', content: [{ type: 'text', text: summary }], usage: { input_tokens: 400, output_tokens: 60 } },
309
+ parent_tool_use_id: null,
310
+ });
311
+ await sleep(150);
312
+ emit({
313
+ type: 'result',
314
+ subtype: 'success',
315
+ result: summary,
316
+ usage: { input_tokens: 2100, output_tokens: 380 },
317
+ total_cost_usd: 0.0512,
318
+ });
319
+ return;
320
+ }
321
+
322
+ // Task auto-naming spec: a naming call (marked `[cez-namer]`) answers a
323
+ // deterministic short title + a PR classification of the sample number so
324
+ // dry-run tests can assert the full apply pipeline.
325
+ if (userText.includes('[cez-namer]')) {
326
+ const numbered = /(?:^|\D)(\d{1,7})(?:\D|$)/.exec(userText);
327
+ const name = JSON.stringify({
328
+ title: 'implementing cr fixes',
329
+ ...(numbered ? { pr: Number(numbered[1]) } : {}),
330
+ });
331
+ emit({
332
+ type: 'assistant',
333
+ message: {
334
+ role: 'assistant',
335
+ content: [{ type: 'text', text: name }],
336
+ usage: { input_tokens: 200, output_tokens: 30 },
337
+ },
338
+ });
339
+ await sleep(50);
340
+ emit({
341
+ type: 'result',
342
+ subtype: 'success',
343
+ result: name,
344
+ usage: { input_tokens: 200, output_tokens: 30 },
345
+ total_cost_usd: 0.0002,
346
+ });
347
+ return;
348
+ }
349
+
350
+ // Spec 008: a planning call (marked `[cez-planner]` in the user prompt)
351
+ // gets a canned chain plan. The `code-review` skill is deliberately made up:
352
+ // the planner's sanitizer strips unknown skills, and the step survives on
353
+ // its prompt — which is exactly the path worth exercising in dry runs.
354
+ if (userText.includes('[cez-planner]')) {
355
+ const plan = JSON.stringify({
356
+ title: 'implement-verify-review',
357
+ steps: [
358
+ { name: 'Implement', prompt: '{{task}}' },
359
+ { name: 'Verify', command: 'npm test' },
360
+ { name: 'Review', skill: 'code-review', prompt: 'Review the changes for {{task}}' },
361
+ ],
362
+ rationale: 'Implement, verify with tests, then review.',
363
+ });
364
+ emit({
365
+ type: 'assistant',
366
+ message: {
367
+ role: 'assistant',
368
+ content: [{ type: 'text', text: plan }],
369
+ usage: { input_tokens: 500, output_tokens: 120 },
370
+ },
371
+ });
372
+ await sleep(100);
373
+ emit({
374
+ type: 'result',
375
+ subtype: 'success',
376
+ result: plan,
377
+ usage: { input_tokens: 500, output_tokens: 120 },
378
+ total_cost_usd: 0.0011,
379
+ });
380
+ return;
381
+ }
382
+
383
+ if (turn === 1) {
384
+ // Leave a visible trace in the cwd (the task worktree under spec 006) so
385
+ // the Diff view has something real to show in dry runs. Exactly one line
386
+ // per spawned session: tests read this file back as a per-step trace, so
387
+ // a multi-line prompt must not become multiple lines here.
388
+ try {
389
+ const head = userText.replace(/\s+/g, ' ').trim().slice(0, 400);
390
+ appendFileSync('notes.md', `mock notes — ${new Date().toISOString()}: ${head}\n`);
391
+ } catch {
392
+ // read-only cwd — the mock still works, just without a diff
393
+ }
394
+ writeHandoffAndTodo();
395
+ emit({
396
+ type: 'assistant',
397
+ message: {
398
+ role: 'assistant',
399
+ content: [{ type: 'text', text: `Okay — looking into: ${userText.slice(0, 120)}` }],
400
+ usage: { input_tokens: 850, output_tokens: 40 },
401
+ },
402
+ });
403
+ await sleep(300);
404
+ emit({
405
+ type: 'assistant',
406
+ message: {
407
+ role: 'assistant',
408
+ content: [{ type: 'tool_use', id: `toolu_mock_${turn}`, name: 'Bash', input: { command: 'git status --short' } }],
409
+ usage: { input_tokens: 120, output_tokens: 55 },
410
+ },
411
+ });
412
+ await sleep(300);
413
+ emit({
414
+ type: 'user',
415
+ message: {
416
+ role: 'user',
417
+ content: [{ type: 'tool_result', tool_use_id: `toolu_mock_${turn}`, content: ' M src/example.ts' }],
418
+ },
419
+ });
420
+ await sleep(200);
421
+ // Agent screenshot in a tool result — exercises the image pipeline
422
+ // (persist to <id>-images/, serve via /api/runs/:id/images/, zoomable
423
+ // card + lightbox in the transcript).
424
+ emit({
425
+ type: 'assistant',
426
+ message: {
427
+ role: 'assistant',
428
+ content: [{ type: 'tool_use', id: `toolu_mock_shot_${turn}`, name: 'Screenshot', input: { name: 'repro-login-redirect.png' } }],
429
+ usage: { input_tokens: 80, output_tokens: 30 },
430
+ },
431
+ });
432
+ await sleep(200);
433
+ emit({
434
+ type: 'user',
435
+ message: {
436
+ role: 'user',
437
+ content: [
438
+ {
439
+ type: 'tool_result',
440
+ tool_use_id: `toolu_mock_shot_${turn}`,
441
+ content: [
442
+ { type: 'text', text: 'Repro captured: after reload the session toast appears and you are back on /login.' },
443
+ { type: 'image', source: { type: 'base64', media_type: 'image/png', data: MOCK_SCREENSHOT_B64 } },
444
+ ],
445
+ },
446
+ ],
447
+ },
448
+ });
449
+ await sleep(300);
450
+ emit({
451
+ type: 'assistant',
452
+ message: {
453
+ role: 'assistant',
454
+ content: [{ type: 'text', text: `Done with the first pass — opened a draft PR: https://github.com/open-mercato/demo/pull/123. Anything to adjust? (dry-run mock)${refsMarkers}${doneMarker}${monitoringMarker}${askMarker}` }],
455
+ usage: { input_tokens: 300, output_tokens: 90 },
456
+ },
457
+ });
458
+ await sleep(150);
459
+ emit({
460
+ type: 'result',
461
+ subtype: 'success',
462
+ result: 'Done with the first pass (dry run).',
463
+ usage: { input_tokens: 1270, output_tokens: 185 },
464
+ total_cost_usd: 0.0342,
465
+ });
466
+ return;
467
+ }
468
+
469
+ const imgNote = imageCount > 0 ? ` I can see ${imageCount} image(s) you attached.` : '';
470
+ emit({
471
+ type: 'assistant',
472
+ message: {
473
+ role: 'assistant',
474
+ content: [{ type: 'text', text: `Follow-up #${turn - 1} received: "${userText.slice(0, 100)}".${imgNote} Applied (dry run).${refsMarkers}${doneMarker}${monitoringMarker}${askMarker}` }],
475
+ usage: { input_tokens: 200, output_tokens: 60 },
476
+ },
477
+ });
478
+ await sleep(150);
479
+ emit({
480
+ type: 'result',
481
+ subtype: 'success',
482
+ result: `Follow-up #${turn - 1} handled (dry run).`,
483
+ usage: { input_tokens: 200, output_tokens: 60 },
484
+ total_cost_usd: 0.0051,
485
+ });
486
+ }
487
+
488
+ const rl = createInterface({ input: process.stdin });
489
+ let queue = Promise.resolve();
490
+ rl.on('line', (line) => {
491
+ const trimmed = line.trim();
492
+ if (!trimmed) return;
493
+ let userText = '(unparseable message)';
494
+ let imageCount = 0;
495
+ try {
496
+ const msg = JSON.parse(trimmed);
497
+ const blocks = msg?.message?.content ?? [];
498
+ userText = blocks.filter((b) => b.type === 'text').map((b) => b.text).join('\n') || '(no text)';
499
+ imageCount = blocks.filter((b) => b.type === 'image').length;
500
+ } catch {
501
+ // keep placeholders
502
+ }
503
+ // Testability hook: CEZ_MOCK_STDIN_FILE=<path> appends the FULL inbound
504
+ // text + image count (one JSON object per line) — the scripted replies
505
+ // below only echo a truncated slice, so tests asserting exact wiring (e.g.
506
+ // #357's pasted-attachment path note in the prompt) need the untruncated
507
+ // text this hook captures.
508
+ if (process.env.CEZ_MOCK_STDIN_FILE) {
509
+ try {
510
+ appendFileSync(process.env.CEZ_MOCK_STDIN_FILE, `${JSON.stringify({ userText, imageCount })}\n`);
511
+ } catch {
512
+ // best effort — never break the mock over the hook
513
+ }
514
+ }
515
+ queue = queue.then(() => respond(userText, imageCount));
516
+ });
517
+ rl.on('close', () => {
518
+ // EOF = session over; finish any in-flight turn then exit cleanly.
519
+ queue.then(() => process.exit(0));
520
+ });
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env node
2
+ import readline from 'node:readline';
3
+
4
+ const sessionId = '00000000-0000-4000-8000-0000000000pi';
5
+ const send = (value) => process.stdout.write(`${JSON.stringify(value)}\n`);
6
+
7
+ for await (const line of readline.createInterface({ input: process.stdin })) {
8
+ const command = JSON.parse(line);
9
+ if (command.type === 'get_state') {
10
+ send({
11
+ id: command.id,
12
+ type: 'response',
13
+ command: 'get_state',
14
+ success: true,
15
+ data: {
16
+ sessionId,
17
+ thinkingLevel: 'medium',
18
+ isStreaming: false,
19
+ isCompacting: false,
20
+ steeringMode: 'all',
21
+ followUpMode: 'one-at-a-time',
22
+ autoCompactionEnabled: true,
23
+ messageCount: 0,
24
+ pendingMessageCount: 0,
25
+ },
26
+ });
27
+ } else if (command.type === 'prompt') {
28
+ send({ type: 'response', command: 'prompt', success: true });
29
+ send({ type: 'agent_start' });
30
+ send({ type: 'turn_start' });
31
+ send({
32
+ type: 'message_update',
33
+ message: {},
34
+ assistantMessageEvent: { type: 'text_start', contentIndex: 0, partial: {} },
35
+ });
36
+ send({
37
+ type: 'message_update',
38
+ message: {},
39
+ assistantMessageEvent: {
40
+ type: 'text_delta',
41
+ contentIndex: 0,
42
+ delta: `Investigating: ${command.message}`,
43
+ partial: {},
44
+ },
45
+ });
46
+ send({
47
+ type: 'message_update',
48
+ message: {},
49
+ assistantMessageEvent: {
50
+ type: 'text_end',
51
+ contentIndex: 0,
52
+ content: `Investigating: ${command.message}`,
53
+ partial: {},
54
+ },
55
+ });
56
+ send({ type: 'tool_execution_start', toolCallId: 'tool-1', toolName: 'read', args: { path: 'README.md' } });
57
+ send({
58
+ type: 'tool_execution_end',
59
+ toolCallId: 'tool-1',
60
+ toolName: 'read',
61
+ result: { content: [{ type: 'text', text: 'mock file' }] },
62
+ isError: false,
63
+ });
64
+ send({
65
+ type: 'message_end',
66
+ message: {
67
+ role: 'assistant',
68
+ usage: {
69
+ input: 10,
70
+ output: 5,
71
+ cacheRead: 0,
72
+ cacheWrite: 0,
73
+ cost: { total: 0.001 },
74
+ },
75
+ },
76
+ });
77
+ send({ type: 'turn_end', message: {}, toolResults: [] });
78
+ send({ type: 'agent_end', messages: [], willRetry: false });
79
+ send({ type: 'agent_settled' });
80
+ } else if (command.type === 'abort') {
81
+ send({ type: 'response', command: 'abort', success: true });
82
+ }
83
+ }
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+ // Copy the repo's README into this package before it is built/packed.
3
+ //
4
+ // There is exactly one README (the repo root's): it is the project's GitHub front page AND the
5
+ // npm page for `@wjarka/cezarion`, and those must not be allowed to drift into two documents
6
+ // saying different things about the same tool. `files` can only reference paths inside the
7
+ // package, so the one source is copied in rather than referenced out — the copy is gitignored,
8
+ // regenerated by every build, and never edited by hand.
9
+ //
10
+ // Runs as `prebuild`, so `npm run build` (and the release pipeline, which builds first) always
11
+ // packs a current copy. `check:pack` is the gate that notices if this ever stops happening.
12
+
13
+ import { copyFileSync } from 'node:fs';
14
+ import path from 'node:path';
15
+ import { fileURLToPath } from 'node:url';
16
+
17
+ const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
18
+ const repoRoot = path.resolve(packageRoot, '../..');
19
+
20
+ copyFileSync(path.join(repoRoot, 'README.md'), path.join(packageRoot, 'README.md'));
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env node
2
+ // Unit check for the pure half of src/core/process-usage.ts (#348): ps-output
3
+ // parsing + process-tree aggregation against canned `ps -axo pid=,ppid=,rss=,%cpu=`
4
+ // output. Dependency-free; needs `npm run build` first (imports from dist/).
5
+ // node scripts/test-process-usage.mjs
6
+
7
+ import assert from 'node:assert/strict';
8
+ import { aggregateTreeUsage, parsePsOutput } from '../dist/core/process-usage.js';
9
+
10
+ // Canned snapshot: two registered roots (100, 200) plus unrelated noise.
11
+ // Root 100 owns a 3-level tree: 100 → 110 → 111, and 100 → 120.
12
+ const PS_OUTPUT = `
13
+ 1 0 1200 0.1
14
+ 100 1 50000 10.0
15
+ 110 100 20000 5.5
16
+ 111 110 8000 0.0
17
+ 120 100 4000 2.5
18
+ 200 1 30000 50.0
19
+ 210 200 10000 25.0
20
+ 999 1 70000 99.0
21
+ garbage line that ps should never emit
22
+ 300 1
23
+ `;
24
+
25
+ const procs = parsePsOutput(PS_OUTPUT);
26
+ assert.equal(procs.length, 8, 'parses 8 well-formed rows, skips malformed ones');
27
+ assert.deepEqual(procs[1], { pid: 100, ppid: 1, rssKb: 50000, cpuPct: 10 });
28
+
29
+ // Root 100: 4 processes across 3 levels; rss in KB × 1024 → bytes.
30
+ const a = aggregateTreeUsage(procs, 100);
31
+ assert.deepEqual(a, {
32
+ cpuPct: 18,
33
+ rssBytes: (50000 + 20000 + 8000 + 4000) * 1024,
34
+ procCount: 4,
35
+ });
36
+
37
+ // Root 200: 2 processes; the other tree's processes never leak in.
38
+ const b = aggregateTreeUsage(procs, 200);
39
+ assert.deepEqual(b, { cpuPct: 75, rssBytes: (30000 + 10000) * 1024, procCount: 2 });
40
+
41
+ // A root missing from the snapshot (process exited) → null, not zeros.
42
+ assert.equal(aggregateTreeUsage(procs, 12345), null);
43
+
44
+ // A leaf works as a root of its own single-node tree.
45
+ assert.deepEqual(aggregateTreeUsage(procs, 111), { cpuPct: 0, rssBytes: 8000 * 1024, procCount: 1 });
46
+
47
+ console.log('process-usage: all assertions passed');