@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,44 @@
1
+ import type { ProviderId } from '../core/provider-auth.ts';
2
+ /**
3
+ * Who an agent account is logged in AS — the "Show details" read (spec
4
+ * `2026-07-29-agent-profiles.md`).
5
+ *
6
+ * This is the second place vendor knowledge lives about an agent's home, beside
7
+ * `catalog.ts` (which config FILES exist) and `core/agent-profiles.ts` (which env var relocates
8
+ * the home). This one knows where each agent writes its own identity. Facts verified against the
9
+ * files on disk 2026-07-29; re-verify before changing them.
10
+ *
11
+ * ## Two rules that are not negotiable
12
+ *
13
+ * 1. **Named fields only, never pass-through.** `~/.codex/auth.json` holds `OPENAI_API_KEY`,
14
+ * `access_token` and `refresh_token` right beside the identity claims. Every reader below picks
15
+ * fields by name and builds a fresh object; nothing here spreads, forwards or stringifies a
16
+ * parsed vendor object, so a key the vendor adds tomorrow cannot leak through. The JWT is read
17
+ * for its CLAIMS and its signature is never a credential we hold onto.
18
+ * 2. **Read on demand, answered to exactly one route.** This never joins the accounts listing,
19
+ * never enters `runs.json` or the NDJSON, and is never logged. `provider-auth.ts` keeps account
20
+ * identity out of its own boundary on purpose; this is the deliberate, opt-in exception —
21
+ * localHandoff-gated, and only when the user asks for it — not a widening of that rule.
22
+ */
23
+ /** One labelled row, as the pane renders it. Deliberately not a fixed per-provider shape: what an
24
+ * agent knows about its own login differs, and inventing an empty "Organization" for one that has
25
+ * no concept of it would be a worse answer than omitting the row. */
26
+ export interface AccountIdentityField {
27
+ label: string;
28
+ value: string;
29
+ }
30
+ export interface AccountIdentity {
31
+ /** False when there is nothing to show — not signed in, no file, or a file we cannot parse. */
32
+ available: boolean;
33
+ /** Why, in the user's terms, when `available` is false. */
34
+ reason?: string;
35
+ fields: AccountIdentityField[];
36
+ }
37
+ /**
38
+ * What this account is logged in as, or an honest reason there is nothing to show.
39
+ *
40
+ * Never throws. OpenCode answers "unsupported": its credentials live in a SQLite DB outside the
41
+ * config dir (see `core/agent-profiles.ts`), so there is nothing in a config folder to read — and
42
+ * guessing from the default login would attribute one account's identity to another.
43
+ */
44
+ export declare function readAccountIdentity(provider: ProviderId, configDir: string): Promise<AccountIdentity>;
@@ -0,0 +1,128 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { join } from 'node:path';
3
+ import { claudeStateFilePath } from '../paths.js';
4
+ /** `.claude.json` can carry per-project history; cap the read like `readUserMcpServers` does. */
5
+ const READ_CAP = 2 * 1024 * 1024;
6
+ const NOT_SIGNED_IN = 'Not signed in on this account yet — use Connect.';
7
+ const UNREADABLE = 'Could not read this account’s details.';
8
+ /** Read a JSON file under the cap. `null` for absent, unreadable, oversized or malformed. */
9
+ async function readJsonCapped(path) {
10
+ try {
11
+ const raw = await readFile(path, 'utf8');
12
+ if (raw.length > READ_CAP)
13
+ return null;
14
+ const parsed = JSON.parse(raw);
15
+ return parsed && typeof parsed === 'object' ? parsed : null;
16
+ }
17
+ catch {
18
+ return null;
19
+ }
20
+ }
21
+ /** A non-empty display string, or undefined — so a blank vendor value never renders as an empty row. */
22
+ function text(value) {
23
+ if (typeof value === 'string' && value.trim() !== '')
24
+ return value.trim();
25
+ if (typeof value === 'number' && Number.isFinite(value))
26
+ return String(value);
27
+ return undefined;
28
+ }
29
+ /** Push a row only when the value is really there. */
30
+ function push(fields, label, value) {
31
+ const shown = text(value);
32
+ if (shown !== undefined)
33
+ fields.push({ label, value: shown });
34
+ }
35
+ /**
36
+ * Claude Code keeps its login in `.claude.json`'s `oauthAccount` — a *sibling* of `~/.claude` by
37
+ * default, but INSIDE an overridden config dir (`claudeStateFilePath` owns that rule, and getting
38
+ * it wrong is how one account reports another's email).
39
+ */
40
+ async function readClaudeIdentity(configDir) {
41
+ const state = await readJsonCapped(claudeStateFilePath(configDir));
42
+ if (state === null)
43
+ return { available: false, reason: NOT_SIGNED_IN, fields: [] };
44
+ const account = state.oauthAccount;
45
+ if (!account || typeof account !== 'object') {
46
+ return { available: false, reason: NOT_SIGNED_IN, fields: [] };
47
+ }
48
+ const a = account;
49
+ const fields = [];
50
+ push(fields, 'Email', a.emailAddress);
51
+ push(fields, 'Name', a.displayName);
52
+ push(fields, 'Organization', a.organizationName);
53
+ push(fields, 'Role', a.organizationRole);
54
+ // `seatTier`/`billingType` are the closest thing to a plan the file states; neither is
55
+ // documented, so they are shown under a label that promises no more than they are.
56
+ push(fields, 'Seat', a.seatTier);
57
+ push(fields, 'Billing', a.billingType);
58
+ return fields.length > 0
59
+ ? { available: true, fields }
60
+ : { available: false, reason: UNREADABLE, fields: [] };
61
+ }
62
+ /**
63
+ * Codex keeps its login in `auth.json`'s `id_token` — a JWT whose payload carries the identity
64
+ * claims. Read for its claims only: the same file holds `OPENAI_API_KEY`, `access_token` and
65
+ * `refresh_token`, none of which this function so much as names.
66
+ *
67
+ * The signature is NOT verified, and that is correct here: this is a local file the user's own CLI
68
+ * wrote, read to display who they are — not a token cezar is accepting as proof of anything.
69
+ */
70
+ async function readCodexIdentity(configDir) {
71
+ const auth = await readJsonCapped(join(configDir, 'auth.json'));
72
+ if (auth === null)
73
+ return { available: false, reason: NOT_SIGNED_IN, fields: [] };
74
+ const tokens = auth.tokens;
75
+ const idToken = tokens && typeof tokens === 'object'
76
+ ? tokens.id_token
77
+ : undefined;
78
+ const fields = [];
79
+ const claims = typeof idToken === 'string' ? decodeJwtClaims(idToken) : null;
80
+ if (claims !== null) {
81
+ push(fields, 'Email', claims.email);
82
+ push(fields, 'Name', claims.name);
83
+ const openai = claims['https://api.openai.com/auth'];
84
+ if (openai && typeof openai === 'object') {
85
+ push(fields, 'Plan', openai.chatgpt_plan_type);
86
+ }
87
+ }
88
+ // An API-key login has no id_token at all — say which kind of login this is rather than
89
+ // reporting "not signed in" for an account that is perfectly usable.
90
+ if (fields.length === 0 && typeof auth.OPENAI_API_KEY === 'string' && auth.OPENAI_API_KEY !== '') {
91
+ return { available: true, fields: [{ label: 'Login', value: 'API key' }] };
92
+ }
93
+ return fields.length > 0
94
+ ? { available: true, fields }
95
+ : { available: false, reason: NOT_SIGNED_IN, fields: [] };
96
+ }
97
+ /** A JWT's payload claims, or null when it is not a readable three-part token. */
98
+ function decodeJwtClaims(token) {
99
+ const parts = token.split('.');
100
+ if (parts.length !== 3 || !parts[1])
101
+ return null;
102
+ try {
103
+ const parsed = JSON.parse(Buffer.from(parts[1], 'base64url').toString('utf8'));
104
+ return parsed && typeof parsed === 'object' ? parsed : null;
105
+ }
106
+ catch {
107
+ return null;
108
+ }
109
+ }
110
+ /**
111
+ * What this account is logged in as, or an honest reason there is nothing to show.
112
+ *
113
+ * Never throws. OpenCode answers "unsupported": its credentials live in a SQLite DB outside the
114
+ * config dir (see `core/agent-profiles.ts`), so there is nothing in a config folder to read — and
115
+ * guessing from the default login would attribute one account's identity to another.
116
+ */
117
+ export async function readAccountIdentity(provider, configDir) {
118
+ if (provider === 'claude')
119
+ return readClaudeIdentity(configDir);
120
+ if (provider === 'codex')
121
+ return readCodexIdentity(configDir);
122
+ return {
123
+ available: false,
124
+ reason: 'OpenCode keeps its login outside its config folder, so cezar cannot read it.',
125
+ fields: [],
126
+ };
127
+ }
128
+ //# sourceMappingURL=account-identity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account-identity.js","sourceRoot":"","sources":["../../src/agent-config/account-identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MA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E,EAAE;KACX,CAAC;AACJ,CAAC"}
@@ -0,0 +1,72 @@
1
+ import type { RunnerId } from '../core/agent-runner.ts';
2
+ /**
3
+ * The catalog of coding-agent config files cezar can surface and edit (spec
4
+ * `.ai/specs/2026-07-16-agent-config-files.md`). This file is the ONLY place
5
+ * vendor knowledge lives: where each agent keeps its files, at which scope, in
6
+ * what format, and — the load-bearing part — the vendor's OWN documented
7
+ * precedence, quoted so a UI label never claims a merge cezar does not perform.
8
+ *
9
+ * Hardcoding is the design. cezar's value here is knowing where the files are
10
+ * and what the docs say; an unknown file is not shown rather than guessed at.
11
+ * A raw editor cannot drift on a vendor's *schema*; it can drift on *paths and
12
+ * precedence strings*, so every entry carries a `docsUrl` and this table is the
13
+ * single maintenance surface. Facts verified against primary docs 2026-07-16.
14
+ */
15
+ export type ConfigFormat = 'json' | 'jsonc' | 'toml' | 'markdown';
16
+ export type ConfigScope = 'user' | 'project' | 'local';
17
+ /** `settings` = behavior knobs; `memory` = instruction/markdown; `mcp` = a dedicated MCP file. */
18
+ export type ConfigKind = 'settings' | 'memory' | 'mcp';
19
+ /**
20
+ * Git status *by convention* — it drives the honest label, it is not read from
21
+ * git. The seed path re-checks with `git check-ignore` before trusting it.
22
+ */
23
+ export type ConfigTracked = 'tracked' | 'gitignored' | 'outside-repo';
24
+ /** Resolved home directories per agent, injected so the catalog stays pure and testable. */
25
+ export interface AgentHomePaths {
26
+ /** `~/.claude` */
27
+ claude: string;
28
+ /** `$CODEX_HOME` or `~/.codex` */
29
+ codex: string;
30
+ /** `$XDG_CONFIG_HOME/opencode` or `~/.config/opencode` */
31
+ opencodeConfig: string;
32
+ }
33
+ export interface ConfigFileDef {
34
+ /** Stable, opaque, URL-safe. The ONLY thing a client may name (traversal-proof). */
35
+ id: string;
36
+ /** Every runner that reads this file. `<repo>/AGENTS.md` is one file, two readers. */
37
+ runners: RunnerId[];
38
+ kind: ConfigKind;
39
+ scope: ConfigScope;
40
+ /** Absolute path, resolved per request so `$CODEX_HOME`/`$XDG_CONFIG_HOME` are honoured. */
41
+ resolve: (repoRoot: string, home: AgentHomePaths) => string;
42
+ /** What the user sees, e.g. `~/.claude/settings.json`, `.claude/settings.local.json`. */
43
+ label: string;
44
+ format: ConfigFormat;
45
+ tracked: ConfigTracked;
46
+ /** True only for Claude's gitignored personal layer — the files seeded into a run's worktree. */
47
+ seeded?: boolean;
48
+ /** True when this file holds MCP server definitions (drives the MCP section's filter). */
49
+ holdsMcp?: boolean;
50
+ /** Top-level native setting that supplies the agent's new-session model, when present. */
51
+ modelKey?: string;
52
+ /** Native model keys checked in precedence order, including nested `env.*` settings. */
53
+ modelKeys?: readonly string[];
54
+ /** Native provider key paired with the model, when the vendor separates the two. */
55
+ modelProviderKey?: string;
56
+ /** Higher values win when resolving a native default model across config scopes. */
57
+ modelPriority?: number;
58
+ /** VERBATIM from the vendor docs. Never computed, never generic. */
59
+ precedence: string;
60
+ /** Documented mid-run reload behaviour, or undefined when the vendor is silent. */
61
+ hotReload?: string;
62
+ docsUrl: string;
63
+ }
64
+ /**
65
+ * The table. Order is presentation order: per runner, then user → project →
66
+ * local so each scope ladder reads top (broad) to bottom (specific).
67
+ */
68
+ export declare const CONFIG_FILES: ConfigFileDef[];
69
+ /** The whole catalog. */
70
+ export declare function listConfigFiles(): ConfigFileDef[];
71
+ /** Look up one entry by its stable id, or undefined when the id is unknown. */
72
+ export declare function findConfigFile(id: string): ConfigFileDef | undefined;
@@ -0,0 +1,223 @@
1
+ import { join } from 'node:path';
2
+ const CLAUDE_SETTINGS_DOCS = 'https://code.claude.com/docs/en/settings';
3
+ const CLAUDE_MEMORY_DOCS = 'https://code.claude.com/docs/en/memory';
4
+ const CLAUDE_MCP_DOCS = 'https://code.claude.com/docs/en/mcp';
5
+ const CODEX_CONFIG_DOCS = 'https://developers.openai.com/codex/config-reference';
6
+ const CODEX_AGENTS_DOCS = 'https://developers.openai.com/codex/guides/agents-md';
7
+ const OPENCODE_CONFIG_DOCS = 'https://opencode.ai/docs/config/';
8
+ const OPENCODE_RULES_DOCS = 'https://opencode.ai/docs/rules/';
9
+ /**
10
+ * The table. Order is presentation order: per runner, then user → project →
11
+ * local so each scope ladder reads top (broad) to bottom (specific).
12
+ */
13
+ export const CONFIG_FILES = [
14
+ // ---- Claude Code ----
15
+ {
16
+ id: 'claude.user.settings',
17
+ runners: ['claude'],
18
+ kind: 'settings',
19
+ scope: 'user',
20
+ resolve: (_repo, home) => join(home.claude, 'settings.json'),
21
+ label: '~/.claude/settings.json',
22
+ format: 'json',
23
+ tracked: 'outside-repo',
24
+ modelKey: 'model',
25
+ modelKeys: ['env.ANTHROPIC_MODEL', 'model'],
26
+ modelPriority: 1,
27
+ precedence: 'Lowest priority. Project and local settings override it key by key — except permission rules, which merge across all scopes.',
28
+ hotReload: 'Edits to most keys — including permissions and hooks — apply to a running session without a restart.',
29
+ docsUrl: CLAUDE_SETTINGS_DOCS,
30
+ },
31
+ {
32
+ id: 'claude.project.settings',
33
+ runners: ['claude'],
34
+ kind: 'settings',
35
+ scope: 'project',
36
+ resolve: (repo) => join(repo, '.claude', 'settings.json'),
37
+ label: '.claude/settings.json',
38
+ format: 'json',
39
+ tracked: 'tracked',
40
+ modelKey: 'model',
41
+ modelKeys: ['env.ANTHROPIC_MODEL', 'model'],
42
+ modelPriority: 2,
43
+ precedence: 'Overrides user settings key by key (permission rules merge). Local settings override this.',
44
+ hotReload: 'Edits to most keys — including permissions and hooks — apply to a running session without a restart.',
45
+ docsUrl: CLAUDE_SETTINGS_DOCS,
46
+ },
47
+ {
48
+ id: 'claude.local.settings',
49
+ runners: ['claude'],
50
+ kind: 'settings',
51
+ scope: 'local',
52
+ resolve: (repo) => join(repo, '.claude', 'settings.local.json'),
53
+ label: '.claude/settings.local.json',
54
+ format: 'json',
55
+ tracked: 'gitignored',
56
+ seeded: true,
57
+ modelKey: 'model',
58
+ modelKeys: ['env.ANTHROPIC_MODEL', 'model'],
59
+ modelPriority: 3,
60
+ precedence: 'Highest of the file scopes — overrides project and user (permission rules merge). Git-ignored; copied into each run’s worktree so it takes effect immediately.',
61
+ hotReload: 'Edits to most keys — including permissions and hooks — apply to a running session without a restart.',
62
+ docsUrl: CLAUDE_SETTINGS_DOCS,
63
+ },
64
+ {
65
+ id: 'claude.project.mcp',
66
+ runners: ['claude'],
67
+ kind: 'mcp',
68
+ scope: 'project',
69
+ resolve: (repo) => join(repo, '.mcp.json'),
70
+ label: '.mcp.json',
71
+ format: 'json',
72
+ tracked: 'tracked',
73
+ holdsMcp: true,
74
+ precedence: 'Project-scoped MCP servers (key: mcpServers), shared via version control. Each requires approval before use; user- and local-scoped servers live in ~/.claude.json, which cezar does not edit.',
75
+ docsUrl: CLAUDE_MCP_DOCS,
76
+ },
77
+ {
78
+ id: 'claude.user.memory',
79
+ runners: ['claude'],
80
+ kind: 'memory',
81
+ scope: 'user',
82
+ resolve: (_repo, home) => join(home.claude, 'CLAUDE.md'),
83
+ label: '~/.claude/CLAUDE.md',
84
+ format: 'markdown',
85
+ tracked: 'outside-repo',
86
+ precedence: 'Not overridden — every CLAUDE.md that loads is concatenated, this user file first.',
87
+ docsUrl: CLAUDE_MEMORY_DOCS,
88
+ },
89
+ {
90
+ id: 'claude.project.memory',
91
+ runners: ['claude'],
92
+ kind: 'memory',
93
+ scope: 'project',
94
+ resolve: (repo) => join(repo, 'CLAUDE.md'),
95
+ label: 'CLAUDE.md',
96
+ format: 'markdown',
97
+ tracked: 'tracked',
98
+ precedence: 'Concatenated after the user file, not replacing it. Claude does not read AGENTS.md — import it here with @AGENTS.md. Runs read the committed copy.',
99
+ docsUrl: CLAUDE_MEMORY_DOCS,
100
+ },
101
+ {
102
+ id: 'claude.local.memory',
103
+ runners: ['claude'],
104
+ kind: 'memory',
105
+ scope: 'local',
106
+ resolve: (repo) => join(repo, 'CLAUDE.local.md'),
107
+ label: 'CLAUDE.local.md',
108
+ format: 'markdown',
109
+ tracked: 'gitignored',
110
+ seeded: true,
111
+ precedence: 'Loads alongside CLAUDE.md, concatenated last. Git-ignored; copied into each run’s worktree so it takes effect immediately.',
112
+ docsUrl: CLAUDE_MEMORY_DOCS,
113
+ },
114
+ // ---- Codex ----
115
+ {
116
+ id: 'codex.user.config',
117
+ runners: ['codex'],
118
+ kind: 'settings',
119
+ scope: 'user',
120
+ resolve: (_repo, home) => join(home.codex, 'config.toml'),
121
+ label: '~/.codex/config.toml',
122
+ format: 'toml',
123
+ tracked: 'outside-repo',
124
+ holdsMcp: true,
125
+ modelKey: 'model',
126
+ modelProviderKey: 'model_provider',
127
+ modelPriority: 1,
128
+ precedence: 'User-level defaults. A trusted project’s .codex/config.toml overrides these; some keys (provider, auth, telemetry) cannot be overridden at project scope. MCP servers live here under [mcp_servers.<id>].',
129
+ docsUrl: CODEX_CONFIG_DOCS,
130
+ },
131
+ {
132
+ id: 'codex.project.config',
133
+ runners: ['codex'],
134
+ kind: 'settings',
135
+ scope: 'project',
136
+ resolve: (repo) => join(repo, '.codex', 'config.toml'),
137
+ label: '.codex/config.toml',
138
+ format: 'toml',
139
+ tracked: 'tracked',
140
+ modelKey: 'model',
141
+ modelPriority: 2,
142
+ holdsMcp: true,
143
+ precedence: 'Applies only in projects you have trusted. Some keys (provider, auth, telemetry) cannot be overridden here. MCP servers go under [mcp_servers.<id>]. Runs read the committed copy.',
144
+ docsUrl: CODEX_CONFIG_DOCS,
145
+ },
146
+ {
147
+ id: 'codex.user.memory',
148
+ runners: ['codex'],
149
+ kind: 'memory',
150
+ scope: 'user',
151
+ resolve: (_repo, home) => join(home.codex, 'AGENTS.md'),
152
+ label: '~/.codex/AGENTS.md',
153
+ format: 'markdown',
154
+ tracked: 'outside-repo',
155
+ precedence: 'Global instructions, read first (an AGENTS.override.md beside it wins if present). Project AGENTS.md files are concatenated after and override it.',
156
+ docsUrl: CODEX_AGENTS_DOCS,
157
+ },
158
+ // ---- OpenCode ----
159
+ {
160
+ id: 'opencode.user.config',
161
+ runners: ['opencode'],
162
+ kind: 'settings',
163
+ scope: 'user',
164
+ resolve: (_repo, home) => join(home.opencodeConfig, 'opencode.json'),
165
+ label: '~/.config/opencode/opencode.json',
166
+ format: 'jsonc',
167
+ tracked: 'outside-repo',
168
+ holdsMcp: true,
169
+ modelKey: 'model',
170
+ modelPriority: 1,
171
+ precedence: 'Global config. Merged with the project config, not replaced — later configs override earlier ones only for conflicting keys. MCP servers live under the "mcp" key.',
172
+ docsUrl: OPENCODE_CONFIG_DOCS,
173
+ },
174
+ {
175
+ id: 'opencode.project.config',
176
+ runners: ['opencode'],
177
+ kind: 'settings',
178
+ scope: 'project',
179
+ resolve: (repo) => join(repo, 'opencode.json'),
180
+ label: 'opencode.json',
181
+ format: 'jsonc',
182
+ tracked: 'tracked',
183
+ holdsMcp: true,
184
+ modelKey: 'model',
185
+ modelPriority: 2,
186
+ precedence: 'Merged over the global config per conflicting key (not a wholesale replace). MCP servers live under the "mcp" key. Runs read the committed copy.',
187
+ docsUrl: OPENCODE_CONFIG_DOCS,
188
+ },
189
+ {
190
+ id: 'opencode.user.memory',
191
+ runners: ['opencode'],
192
+ kind: 'memory',
193
+ scope: 'user',
194
+ resolve: (_repo, home) => join(home.opencodeConfig, 'AGENTS.md'),
195
+ label: '~/.config/opencode/AGENTS.md',
196
+ format: 'markdown',
197
+ tracked: 'outside-repo',
198
+ precedence: 'Global rules. First match wins across scopes: if a project AGENTS.md exists, this global file is not read at all.',
199
+ docsUrl: OPENCODE_RULES_DOCS,
200
+ },
201
+ // ---- Shared: <repo>/AGENTS.md is read by BOTH Codex and OpenCode ----
202
+ {
203
+ id: 'project.agents',
204
+ runners: ['codex', 'opencode'],
205
+ kind: 'memory',
206
+ scope: 'project',
207
+ resolve: (repo) => join(repo, 'AGENTS.md'),
208
+ label: 'AGENTS.md',
209
+ format: 'markdown',
210
+ tracked: 'tracked',
211
+ precedence: 'Read by Codex and OpenCode (Claude ignores it). Codex concatenates it root-down; OpenCode uses the first match and prefers it over CLAUDE.md. Runs read the committed copy.',
212
+ docsUrl: OPENCODE_RULES_DOCS,
213
+ },
214
+ ];
215
+ /** The whole catalog. */
216
+ export function listConfigFiles() {
217
+ return CONFIG_FILES;
218
+ }
219
+ /** Look up one entry by its stable id, or undefined when the id is unknown. */
220
+ export function findConfigFile(id) {
221
+ return CONFIG_FILES.find((f) => f.id === id);
222
+ }
223
+ //# sourceMappingURL=catalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../src/agent-config/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAqEjC,MAAM,oBAAoB,GAAG,0CAA0C,CAAC;AACxE,MAAM,kBAAkB,GAAG,wCAAwC,CAAC;AACpE,MAAM,eAAe,GAAG,qCAAqC,CAAC;AAC9D,MAAM,iBAAiB,GAAG,sDAAsD,CAAC;AACjF,MAAM,iBAAiB,GAAG,sDAAsD,CAAC;AACjF,MAAM,oBAAoB,GAAG,kCAAkC,CAAC;AAChE,MAAM,mBAAmB,GAAG,iCAAiC,CAAC;AAE9D;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAoB;IAC3C,wBAAwB;IACxB;QACE,EAAE,EAAE,sBAAsB;QAC1B,OAAO,EAAE,CAAC,QAAQ,CAAC;QACnB,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,MAAM;QACb,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,eAAe,CAAC;QAC5D,KAAK,EAAE,yBAAyB;QAChC,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,cAAc;QACvB,QAAQ,EAAE,OAAO;QACjB,SAAS,EAAE,CAAC,qBAAqB,EAAE,OAAO,CAAC;QAC3C,aAAa,EAAE,CAAC;QAChB,UAAU,EACR,8HAA8H;QAChI,SAAS,EAAE,sGAAsG;QACjH,OAAO,EAAE,oBAAoB;KAC9B;IACD;QACE,EAAE,EAAE,yBAAyB;QAC7B,OAAO,EAAE,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QAChB,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC;QAC1C,KAAK,EAAE,WAAW;QAClB,MAAM,EAAE,UAAU;QAClB,OAAO,EAAE,SAAS;QAClB,UAAU,EACR,6KAA6K;QAC/K,OAAO,EAAE,mBAAmB;KAC7B;CACF,CAAC;AAEF,yBAAyB;AACzB,MAAM,UAAU,eAAe;IAC7B,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,cAAc,CAAC,EAAU;IACvC,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,46 @@
1
+ import { type ConfigFileDef } from './catalog.ts';
2
+ /**
3
+ * Read and write the coding agents' own config files, addressed by catalog id
4
+ * (never by a client-supplied path, so traversal is impossible by
5
+ * construction). Every function degrades — a missing file is "absent", an
6
+ * unreadable one is an honest error — and none throw. Writes validate first,
7
+ * refuse a stale overwrite via a content hash, write atomically through
8
+ * symlinks, and never touch a byte the user did not type.
9
+ */
10
+ /** sha256 of the exact file bytes. mtime is coarse and lies across filesystems. */
11
+ declare function hashBytes(content: string): string;
12
+ export interface ReadResult {
13
+ id: string;
14
+ path: string;
15
+ exists: boolean;
16
+ content: string;
17
+ /** sha256 of the bytes, or null when the file does not exist. */
18
+ version: string | null;
19
+ }
20
+ export type WriteOutcome = {
21
+ ok: true;
22
+ read: ReadResult;
23
+ } | {
24
+ ok: false;
25
+ status: 400 | 409 | 500;
26
+ error: string;
27
+ };
28
+ declare function resolvePath(def: ConfigFileDef, repoRoot: string, env: NodeJS.ProcessEnv): string;
29
+ /** Read a config file by id. Unknown id → null; absent file → exists:false; unreadable → thrown-free error string via `error`. */
30
+ export declare function readConfigFile(id: string, repoRoot: string, env?: NodeJS.ProcessEnv): Promise<ReadResult | {
31
+ error: string;
32
+ } | null>;
33
+ /**
34
+ * Write a config file by id. Validates the content against the file's format,
35
+ * refuses when `version` does not match what is on disk (stale / lost-update),
36
+ * creates the parent dir on demand, and writes atomically through any symlink
37
+ * rather than replacing the link. `version: null` means "I expect no file to
38
+ * exist yet" — the create path.
39
+ */
40
+ export declare function writeConfigFile(id: string, content: string, version: string | null, repoRoot: string, env?: NodeJS.ProcessEnv): Promise<WriteOutcome | null>;
41
+ /** Whether a path currently exists (used by the listing to report `exists`/`size`). */
42
+ export declare function statConfigPath(path: string): Promise<{
43
+ exists: boolean;
44
+ size: number;
45
+ }>;
46
+ export { resolvePath, hashBytes };
@@ -0,0 +1,119 @@
1
+ import { createHash, randomUUID } from 'node:crypto';
2
+ import { mkdir, readFile, realpath, rename, stat, writeFile } from 'node:fs/promises';
3
+ import { dirname } from 'node:path';
4
+ import { agentHomePaths } from '../paths.js';
5
+ import { findConfigFile } from './catalog.js';
6
+ import { validateConfig } from './validate.js';
7
+ /**
8
+ * Read and write the coding agents' own config files, addressed by catalog id
9
+ * (never by a client-supplied path, so traversal is impossible by
10
+ * construction). Every function degrades — a missing file is "absent", an
11
+ * unreadable one is an honest error — and none throw. Writes validate first,
12
+ * refuse a stale overwrite via a content hash, write atomically through
13
+ * symlinks, and never touch a byte the user did not type.
14
+ */
15
+ /** sha256 of the exact file bytes. mtime is coarse and lies across filesystems. */
16
+ function hashBytes(content) {
17
+ return createHash('sha256').update(content, 'utf8').digest('hex');
18
+ }
19
+ function resolvePath(def, repoRoot, env) {
20
+ return def.resolve(repoRoot, agentHomePaths(env));
21
+ }
22
+ /** Read a config file by id. Unknown id → null; absent file → exists:false; unreadable → thrown-free error string via `error`. */
23
+ export async function readConfigFile(id, repoRoot, env = process.env) {
24
+ const def = findConfigFile(id);
25
+ if (!def)
26
+ return null;
27
+ const path = resolvePath(def, repoRoot, env);
28
+ try {
29
+ const content = await readFile(path, 'utf8');
30
+ return { id, path, exists: true, content, version: hashBytes(content) };
31
+ }
32
+ catch (err) {
33
+ const e = err;
34
+ if (e.code === 'ENOENT')
35
+ return { id, path, exists: false, content: '', version: null };
36
+ return { error: e.message };
37
+ }
38
+ }
39
+ /**
40
+ * Write a config file by id. Validates the content against the file's format,
41
+ * refuses when `version` does not match what is on disk (stale / lost-update),
42
+ * creates the parent dir on demand, and writes atomically through any symlink
43
+ * rather than replacing the link. `version: null` means "I expect no file to
44
+ * exist yet" — the create path.
45
+ */
46
+ export async function writeConfigFile(id, content, version, repoRoot, env = process.env) {
47
+ const def = findConfigFile(id);
48
+ if (!def)
49
+ return null;
50
+ const check = validateConfig(content, def.format);
51
+ if (!check.ok)
52
+ return { ok: false, status: 400, error: `Invalid ${def.format}: ${check.error}` };
53
+ const path = resolvePath(def, repoRoot, env);
54
+ // Stale-write guard: the version the caller read must still match disk.
55
+ let current = null;
56
+ try {
57
+ current = await readFile(path, 'utf8');
58
+ }
59
+ catch (err) {
60
+ if (err.code !== 'ENOENT') {
61
+ return { ok: false, status: 500, error: err.message };
62
+ }
63
+ }
64
+ // Footgun guard: emptying a populated file passes format validation (empty is
65
+ // valid TOML/markdown, and JSON just errors) but silently wipes real config —
66
+ // unrecoverable for the gitignored/home files that aren't in git. Refuse it;
67
+ // deleting a config file is a deliberate act, not a stray select-all-delete.
68
+ if (content.trim() === '' && current !== null && current.trim() !== '') {
69
+ return {
70
+ ok: false,
71
+ status: 400,
72
+ error: 'refusing to overwrite a non-empty config file with empty content — delete the file manually if you mean to remove it',
73
+ };
74
+ }
75
+ const currentVersion = current === null ? null : hashBytes(current);
76
+ if (currentVersion !== version) {
77
+ return {
78
+ ok: false,
79
+ status: 409,
80
+ error: currentVersion === null
81
+ ? 'the file no longer exists on disk — reload before saving'
82
+ : 'the file changed on disk since you opened it — reload before saving',
83
+ };
84
+ }
85
+ try {
86
+ // Resolve the real target so an atomic rename writes THROUGH a symlink
87
+ // (e.g. ~/.claude → a dotfiles repo) instead of replacing the link itself.
88
+ let target = path;
89
+ try {
90
+ target = await realpath(path);
91
+ }
92
+ catch {
93
+ // file/link absent — target stays as the resolved path (the create case)
94
+ }
95
+ await mkdir(dirname(target), { recursive: true });
96
+ // Unique per write (not just per process) so two concurrent saves of the same
97
+ // file can't rename the same tmp path over each other and tear the bytes.
98
+ const tmp = `${target}.cez-tmp-${process.pid}-${randomUUID()}`;
99
+ await writeFile(tmp, content, 'utf8');
100
+ await rename(tmp, target);
101
+ const written = await readFile(target, 'utf8');
102
+ return { ok: true, read: { id, path, exists: true, content: written, version: hashBytes(written) } };
103
+ }
104
+ catch (err) {
105
+ return { ok: false, status: 500, error: err.message };
106
+ }
107
+ }
108
+ /** Whether a path currently exists (used by the listing to report `exists`/`size`). */
109
+ export async function statConfigPath(path) {
110
+ try {
111
+ const s = await stat(path);
112
+ return { exists: true, size: s.size };
113
+ }
114
+ catch {
115
+ return { exists: false, size: 0 };
116
+ }
117
+ }
118
+ export { resolvePath, hashBytes };
119
+ //# sourceMappingURL=files.js.map