@open-mercato/cezar 0.9.2 → 0.10.0-pr892.1298

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 (269) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +169 -38
  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 +8 -0
  7. package/dist/agent-config/catalog.js +18 -0
  8. package/dist/agent-config/catalog.js.map +1 -1
  9. package/dist/agent-config/model-settings/claude.d.ts +2 -0
  10. package/dist/agent-config/model-settings/claude.js +11 -0
  11. package/dist/agent-config/model-settings/claude.js.map +1 -0
  12. package/dist/agent-config/model-settings/codex.d.ts +2 -0
  13. package/dist/agent-config/model-settings/codex.js +16 -0
  14. package/dist/agent-config/model-settings/codex.js.map +1 -0
  15. package/dist/agent-config/model-settings/opencode.d.ts +2 -0
  16. package/dist/agent-config/model-settings/opencode.js +8 -0
  17. package/dist/agent-config/model-settings/opencode.js.map +1 -0
  18. package/dist/agent-config/model-settings/pi.d.ts +12 -0
  19. package/dist/agent-config/model-settings/pi.js +18 -0
  20. package/dist/agent-config/model-settings/pi.js.map +1 -0
  21. package/dist/agent-config/model-settings/shared.d.ts +9 -0
  22. package/dist/agent-config/model-settings/shared.js +93 -0
  23. package/dist/agent-config/model-settings/shared.js.map +1 -0
  24. package/dist/agent-config/model-settings/types.d.ts +9 -0
  25. package/dist/agent-config/model-settings/types.js +2 -0
  26. package/dist/agent-config/model-settings/types.js.map +1 -0
  27. package/dist/agent-config/models.d.ts +9 -0
  28. package/dist/agent-config/models.js +32 -0
  29. package/dist/agent-config/models.js.map +1 -0
  30. package/dist/agent-config/service.js +4 -4
  31. package/dist/agent-config/service.js.map +1 -1
  32. package/dist/automations/types.d.ts +4 -0
  33. package/dist/automations/types.js +2 -1
  34. package/dist/automations/types.js.map +1 -1
  35. package/dist/config.d.ts +10 -1
  36. package/dist/config.js +48 -5
  37. package/dist/config.js.map +1 -1
  38. package/dist/contract/agent-config.d.ts +2 -0
  39. package/dist/contract/agent-profiles.d.ts +347 -0
  40. package/dist/contract/automations.d.ts +24 -0
  41. package/dist/contract/events.d.ts +59 -0
  42. package/dist/contract/github.d.ts +88 -0
  43. package/dist/contract/health.d.ts +7 -1
  44. package/dist/contract/index.d.ts +1 -0
  45. package/dist/contract/index.js +1005 -555
  46. package/dist/contract/projects.d.ts +33 -5
  47. package/dist/contract/runs.d.ts +247 -0
  48. package/dist/contract/skills.d.ts +7 -0
  49. package/dist/contract/workflows.d.ts +6 -0
  50. package/dist/contract/workspace.d.ts +137 -2
  51. package/dist/core/agent-env.js +41 -16
  52. package/dist/core/agent-env.js.map +1 -1
  53. package/dist/core/agent-model-policy.d.ts +10 -0
  54. package/dist/core/agent-model-policy.js +36 -0
  55. package/dist/core/agent-model-policy.js.map +1 -0
  56. package/dist/core/agent-profiles.d.ts +62 -0
  57. package/dist/core/agent-profiles.js +90 -0
  58. package/dist/core/agent-profiles.js.map +1 -0
  59. package/dist/core/agent-runner.d.ts +37 -6
  60. package/dist/core/agent-runner.js +35 -3
  61. package/dist/core/agent-runner.js.map +1 -1
  62. package/dist/core/backend-detect.d.ts +5 -5
  63. package/dist/core/backend-detect.js +44 -7
  64. package/dist/core/backend-detect.js.map +1 -1
  65. package/dist/core/claude-cli-runner.js +10 -5
  66. package/dist/core/claude-cli-runner.js.map +1 -1
  67. package/dist/core/codex-app-server-runner.js +13 -3
  68. package/dist/core/codex-app-server-runner.js.map +1 -1
  69. package/dist/core/codex-app-server-transport.js +7 -2
  70. package/dist/core/codex-app-server-transport.js.map +1 -1
  71. package/dist/core/model-identity.d.ts +23 -11
  72. package/dist/core/model-identity.js +41 -24
  73. package/dist/core/model-identity.js.map +1 -1
  74. package/dist/core/model-presets.d.ts +8 -2
  75. package/dist/core/model-presets.js +51 -8
  76. package/dist/core/model-presets.js.map +1 -1
  77. package/dist/core/opencode-model-catalog.d.ts +32 -0
  78. package/dist/core/opencode-model-catalog.js +153 -0
  79. package/dist/core/opencode-model-catalog.js.map +1 -0
  80. package/dist/core/opencode-server-runner.d.ts +2 -0
  81. package/dist/core/opencode-server-runner.js +42 -11
  82. package/dist/core/opencode-server-runner.js.map +1 -1
  83. package/dist/core/pi-runner.d.ts +24 -0
  84. package/dist/core/pi-runner.js +349 -0
  85. package/dist/core/pi-runner.js.map +1 -0
  86. package/dist/core/pi-ui-mapper.d.ts +34 -0
  87. package/dist/core/pi-ui-mapper.js +270 -0
  88. package/dist/core/pi-ui-mapper.js.map +1 -0
  89. package/dist/core/provider-auth.d.ts +95 -3
  90. package/dist/core/provider-auth.js +234 -15
  91. package/dist/core/provider-auth.js.map +1 -1
  92. package/dist/core/provider-availability.d.ts +1 -1
  93. package/dist/core/provider-availability.js +2 -1
  94. package/dist/core/provider-availability.js.map +1 -1
  95. package/dist/core/runner-factory.js +3 -0
  96. package/dist/core/runner-factory.js.map +1 -1
  97. package/dist/core/shell-env.d.ts +28 -0
  98. package/dist/core/shell-env.js +56 -0
  99. package/dist/core/shell-env.js.map +1 -0
  100. package/dist/core/ui-events.d.ts +1 -1
  101. package/dist/core/usage-limit.d.ts +42 -0
  102. package/dist/core/usage-limit.js +209 -0
  103. package/dist/core/usage-limit.js.map +1 -0
  104. package/dist/git-diff-base.d.ts +51 -26
  105. package/dist/git-diff-base.js +163 -37
  106. package/dist/git-diff-base.js.map +1 -1
  107. package/dist/git-worktree.d.ts +15 -6
  108. package/dist/git-worktree.js +10 -3
  109. package/dist/git-worktree.js.map +1 -1
  110. package/dist/index.js +3 -2
  111. package/dist/index.js.map +1 -1
  112. package/dist/paths.d.ts +53 -5
  113. package/dist/paths.js +63 -9
  114. package/dist/paths.js.map +1 -1
  115. package/dist/planner.js +6 -0
  116. package/dist/planner.js.map +1 -1
  117. package/dist/release/snapshot.d.ts +13 -2
  118. package/dist/release/snapshot.js +25 -1
  119. package/dist/release/snapshot.js.map +1 -1
  120. package/dist/runs/agent-tmpdir.d.ts +41 -0
  121. package/dist/runs/agent-tmpdir.js +183 -0
  122. package/dist/runs/agent-tmpdir.js.map +1 -0
  123. package/dist/runs/auto-name.js +6 -1
  124. package/dist/runs/auto-name.js.map +1 -1
  125. package/dist/runs/event-history.d.ts +50 -0
  126. package/dist/runs/event-history.js +613 -0
  127. package/dist/runs/event-history.js.map +1 -0
  128. package/dist/runs/run-index.d.ts +19 -0
  129. package/dist/runs/run-index.js +43 -0
  130. package/dist/runs/run-index.js.map +1 -0
  131. package/dist/runs/store.d.ts +78 -19
  132. package/dist/runs/store.js +175 -43
  133. package/dist/runs/store.js.map +1 -1
  134. package/dist/server/capabilities.d.ts +15 -1
  135. package/dist/server/capabilities.js +16 -1
  136. package/dist/server/capabilities.js.map +1 -1
  137. package/dist/server/forge/github.d.ts +169 -0
  138. package/dist/server/forge/github.js +511 -0
  139. package/dist/server/forge/github.js.map +1 -1
  140. package/dist/server/forge/index.d.ts +9 -0
  141. package/dist/server/forge/index.js +14 -0
  142. package/dist/server/forge/index.js.map +1 -1
  143. package/dist/server/git-changes.d.ts +7 -5
  144. package/dist/server/git-changes.js +15 -10
  145. package/dist/server/git-changes.js.map +1 -1
  146. package/dist/server/github.d.ts +2 -2
  147. package/dist/server/github.js +1 -1
  148. package/dist/server/github.js.map +1 -1
  149. package/dist/server/open-in-app.d.ts +2 -1
  150. package/dist/server/open-in-app.js +3 -1
  151. package/dist/server/open-in-app.js.map +1 -1
  152. package/dist/server/open-in-terminal.d.ts +46 -1
  153. package/dist/server/open-in-terminal.js +72 -13
  154. package/dist/server/open-in-terminal.js.map +1 -1
  155. package/dist/server/provider-action-gate.js +3 -1
  156. package/dist/server/provider-action-gate.js.map +1 -1
  157. package/dist/server/server.d.ts +2206 -434
  158. package/dist/server/server.js +1219 -136
  159. package/dist/server/server.js.map +1 -1
  160. package/dist/server-install/engine.js +5 -18
  161. package/dist/server-install/engine.js.map +1 -1
  162. package/dist/server-install/steps.js +6 -2
  163. package/dist/server-install/steps.js.map +1 -1
  164. package/dist/skills.js +4 -0
  165. package/dist/skills.js.map +1 -1
  166. package/dist/workflows/run.d.ts +229 -9
  167. package/dist/workflows/run.js +877 -147
  168. package/dist/workflows/run.js.map +1 -1
  169. package/dist/workflows/types.d.ts +3 -0
  170. package/dist/workflows/types.js +11 -2
  171. package/dist/workflows/types.js.map +1 -1
  172. package/dist/workspace/agent-accounts.d.ts +153 -0
  173. package/dist/workspace/agent-accounts.js +304 -0
  174. package/dist/workspace/agent-accounts.js.map +1 -0
  175. package/dist/workspace/agent-profiles.d.ts +78 -0
  176. package/dist/workspace/agent-profiles.js +115 -0
  177. package/dist/workspace/agent-profiles.js.map +1 -0
  178. package/dist/workspace/config.d.ts +27 -1
  179. package/dist/workspace/config.js +83 -2
  180. package/dist/workspace/config.js.map +1 -1
  181. package/dist/workspace/projects-cli.js +54 -4
  182. package/dist/workspace/projects-cli.js.map +1 -1
  183. package/dist/workspace/projects.d.ts +19 -1
  184. package/dist/workspace/projects.js +34 -1
  185. package/dist/workspace/projects.js.map +1 -1
  186. package/dist/workspace/semaphore.d.ts +46 -1
  187. package/dist/workspace/semaphore.js +41 -4
  188. package/dist/workspace/semaphore.js.map +1 -1
  189. package/dist/workspace/ui-state.d.ts +3 -2
  190. package/dist/workspace/ui-state.js +3 -2
  191. package/dist/workspace/ui-state.js.map +1 -1
  192. package/package.json +3 -3
  193. package/scripts/mock-claude.mjs +20 -0
  194. package/scripts/mock-pi-rpc.mjs +83 -0
  195. package/web/dist/assets/{alert-dialog-ghffK6g9.js → alert-dialog-Byp42_IG.js} +1 -1
  196. package/web/dist/assets/arrow-down-CGDbDYKD.js +1 -0
  197. package/web/dist/assets/arrow-left-ESCjr1Hq.js +1 -0
  198. package/web/dist/assets/centered-state-LfAW-igm.js +43 -0
  199. package/web/dist/assets/chevron-right-Du-P1IUd.js +1 -0
  200. package/web/dist/assets/{collapsible-B0JVzd0B.js → collapsible-CBiiqDJM.js} +1 -1
  201. package/web/dist/assets/{commit-list-wm6DPHNs.js → commit-list-6PPve7PE.js} +1 -1
  202. package/web/dist/assets/{compare-variants-DbdP4Y5T.js → compare-variants-BDnp6mXJ.js} +1 -1
  203. package/web/dist/assets/{diff-Bizc96qe.js → diff-_jK0OWpF.js} +2 -2
  204. package/web/dist/assets/{diff-stat-Dyfg3ltF.js → diff-stat-CIrTu4Ym.js} +1 -1
  205. package/web/dist/assets/{diff-view-CG8ek6tC.js → diff-view-COA_5IyY.js} +1 -1
  206. package/web/dist/assets/dropdown-menu-BofYpFFw.js +1 -0
  207. package/web/dist/assets/editable-title-_J0zFDl-.js +1 -0
  208. package/web/dist/assets/{ellipsis-vertical-DpGTRqC2.js → ellipsis-vertical-BeMR-l62.js} +1 -1
  209. package/web/dist/assets/{file-DlUGpUlb.js → file-DY996Pee.js} +1 -1
  210. package/web/dist/assets/{folder-BAY6Vddy.js → folder-NO3Ec-TY.js} +1 -1
  211. package/web/dist/assets/git-toolbar-BqJeUWcD.js +1 -0
  212. package/web/dist/assets/github-C96HPV9E.js +1 -0
  213. package/web/dist/assets/{image-preview-BWGk5fPX.js → image-preview-D9cCDfKQ.js} +1 -1
  214. package/web/dist/assets/index-Bx-grqa9.css +2 -0
  215. package/web/dist/assets/index-DoVvGDfW.js +7 -0
  216. package/web/dist/assets/{markdown-BGBOGCA_.js → markdown-DDzk11zj.js} +1 -1
  217. package/web/dist/assets/new-task-form-BNLLgC6P.js +1 -0
  218. package/web/dist/assets/pill-CVM1EmV4.js +1 -0
  219. package/web/dist/assets/{project-router-Cx8NPoqn.js → project-router-LRCtP48W.js} +1 -1
  220. package/web/dist/assets/prompt-templates-DFOvYgtW.js +15 -0
  221. package/web/dist/assets/{refresh-cw-BoGdAykg.js → refresh-cw-D1ys6QY2.js} +1 -1
  222. package/web/dist/assets/repo-git-CzUnsgWY.js +1 -0
  223. package/web/dist/assets/{run-diff-EcOkf3ti.js → run-diff-BlnqwfSS.js} +2 -2
  224. package/web/dist/assets/run-header-Bn7cN0Z1.js +1 -0
  225. package/web/dist/assets/{search-x-X3EpVhgs.js → search-x-D6FSpxId.js} +1 -1
  226. package/web/dist/assets/{skill-empty-hint-CZLALx6l.js → skill-empty-hint-iwpCcqgI.js} +1 -1
  227. package/web/dist/assets/skills-CezbOaol.js +1 -0
  228. package/web/dist/assets/{sparkles-Dt4q7pbG.js → sparkles-MrQrgCI9.js} +1 -1
  229. package/web/dist/assets/{square-terminal-hwBL8XsC.js → square-terminal-TTH64lO7.js} +1 -1
  230. package/web/dist/assets/tab-link-FYksz037.js +1 -0
  231. package/web/dist/assets/task-changes-ClWlnzBL.js +1 -0
  232. package/web/dist/assets/{task-commits-BTTA5k5T.js → task-commits-Crbrl86b.js} +1 -1
  233. package/web/dist/assets/{task-files-Da8_4C9g.js → task-files-uSCWyD0-.js} +2 -2
  234. package/web/dist/assets/task-thread-DPmamBA1.js +9 -0
  235. package/web/dist/assets/{textarea-CUdokhkv.js → textarea-B9Ahj4E4.js} +1 -1
  236. package/web/dist/assets/thread-loading-BH_ypQoy.js +1 -0
  237. package/web/dist/assets/{trash-2-DhVIdWv8.js → trash-2-D8S3V3fu.js} +1 -1
  238. package/web/dist/assets/{triangle-alert-XYT0DGCI.js → triangle-alert-bB7p9n5E.js} +1 -1
  239. package/web/dist/assets/{upload-BKjN59-1.js → upload-Bd5oRLPV.js} +1 -1
  240. package/web/dist/assets/{use-desktop-Bf5LS_P4.js → use-desktop-BNvbRBeZ.js} +1 -1
  241. package/web/dist/assets/{use-submit-shortcut-CzVyoAMd.js → use-submit-shortcut-B-xhu4Bf.js} +1 -1
  242. package/web/dist/assets/utils-BhpbVMwN.js +64 -0
  243. package/web/dist/assets/{workflows-o2QU_pvU.js → workflows-RmfbM9Vy.js} +3 -3
  244. package/web/dist/assets/{zoomable-image-7WyUiaVD.js → zoomable-image-BCW6ZBV0.js} +1 -1
  245. package/web/dist/index.html +24 -23
  246. package/web/dist/assets/arrow-down-Cz8qb71e.js +0 -1
  247. package/web/dist/assets/arrow-left-wcYKQXI_.js +0 -1
  248. package/web/dist/assets/centered-state-ZtnFHA-n.js +0 -43
  249. package/web/dist/assets/chevron-right-G4caF2QV.js +0 -1
  250. package/web/dist/assets/circle-check--KvBxXWp.js +0 -1
  251. package/web/dist/assets/circle-x-C3EFZ3xf.js +0 -1
  252. package/web/dist/assets/dropdown-menu-C1Dlf35P.js +0 -1
  253. package/web/dist/assets/editable-title-5rC_QRBZ.js +0 -1
  254. package/web/dist/assets/git-pull-request-agOG0iGM.js +0 -1
  255. package/web/dist/assets/git-toolbar-DGiNMmtY.js +0 -1
  256. package/web/dist/assets/github-Vp7lxYGQ.js +0 -1
  257. package/web/dist/assets/index-DSxyJpuK.css +0 -2
  258. package/web/dist/assets/index-DiawI6RX.js +0 -6
  259. package/web/dist/assets/new-task-form-BpAw_Dks.js +0 -1
  260. package/web/dist/assets/pill-Dvs-P0xy.js +0 -1
  261. package/web/dist/assets/prompt-templates-CSBYBR1I.js +0 -15
  262. package/web/dist/assets/repo-git-PmX-BNMo.js +0 -1
  263. package/web/dist/assets/run-header-BGiv6_qX.js +0 -1
  264. package/web/dist/assets/skills-CC91ouGH.js +0 -1
  265. package/web/dist/assets/tab-link-DIlR5T07.js +0 -1
  266. package/web/dist/assets/task-changes-XkHDxzQA.js +0 -1
  267. package/web/dist/assets/task-thread-DoNXUsHr.js +0 -9
  268. package/web/dist/assets/thread-loading-B8q8ukXJ.js +0 -1
  269. package/web/dist/assets/utils-DsLuRXwV.js +0 -64
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Patryk Lewczuk
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -5,8 +5,8 @@
5
5
  **Parallel coding agents orchestrator** — a local cockpit for running and
6
6
  tracking AI coding-agent tasks in your repo.
7
7
 
8
- Type a task, pick a workflow and an agent — **Claude Code, Codex or OpenCode
9
- (experimental), or a mix of them per step** — and watch it work live: steps, tool calls,
8
+ Type a task, pick a workflow and an agent — **Claude Code, Codex, OpenCode or pi
9
+ (the latter two experimental), or a mix of them per step** — and watch it work live: steps, tool calls,
10
10
  tokens, diffs, in a browser cockpit that runs entirely on your machine.
11
11
  Your CLI logins, your `gh`, your files. No accounts, no database, no cloud.
12
12
 
@@ -19,7 +19,7 @@ your phone, working your backlog while you're away.
19
19
 
20
20
  [A look inside](#a-look-inside) · [What cezar does best](#what-cezar-does-best) · [What it solves](#what-it-solves) · [Who it's for](#who-its-for) · [Quick start](#quick-start) · [How it works](#how-it-works) · [Core concepts](#core-concepts) · [Cockpit tour](#cockpit-tour) · [Agent backends](#coding-agent-backends) · [Remote access](#remote-access-host-cezar-on-a-server)
21
21
 
22
- [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](#license)
22
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
23
23
  ![Node 20+](https://img.shields.io/badge/Node-20%2B-339933)
24
24
  ![TypeScript 7.x](https://img.shields.io/badge/TypeScript-7.x-3178c6)
25
25
  ![Zero config](https://img.shields.io/badge/config-zero-success)
@@ -60,7 +60,7 @@ it does better than any of them:
60
60
 
61
61
  - 🪶 **Genuinely zero config.** `npx cezar-cli` in your repo and you're running —
62
62
  no wizard, no API keys, no env vars, no schema, no database. It rides the
63
- `claude` / `codex` / `opencode` logins and the `gh` you already have, and every
63
+ `claude` / `codex` / `opencode` / `pi` logins and the `gh` you already have, and every
64
64
  missing piece degrades gracefully instead of blocking you.
65
65
  - 🖥️ **Built for a server (VPS mode).** cezar is made to live on a **VPS, cloud,
66
66
  or dedicated box** as an always-on janitor for your repo — headless-first, with
@@ -169,22 +169,47 @@ CLIs you are already logged into, `claude` by default.
169
169
  > instead of the real CLI — the whole cockpit works with no `claude` login, so
170
170
  > you can explore runs, diffs, variants and the review gate offline.
171
171
 
172
+ ### Nightly builds — help us shape cezar 🌙
173
+
174
+ Every night we publish the trunk to npm, so the features landing in the next
175
+ release are one command away:
176
+
177
+ ```bash
178
+ npx cezar-cli@nightly # everything merged as of last night
179
+ ```
180
+
181
+ **Come build this with us.** cezar is shaped by the people who run it on real
182
+ repos: if you try a nightly and something feels wrong — a workflow that stalls, a
183
+ diff that reads badly, a runner that should exist — [open an
184
+ issue](https://github.com/open-mercato/cezar/issues) and tell us. That feedback,
185
+ early, is worth more than a bug report six weeks after a release, and it is how
186
+ most of the features here got their final shape.
187
+
188
+ **Know what you're installing.** A nightly is verified (typecheck, unit suites,
189
+ packaged-CLI e2e — the same gate a release runs) but it is *not* a release: it
190
+ can be rough, a flag or a screen may change under you, and something occasionally
191
+ breaks in a way no test caught. Nothing is at risk beyond your patience — every
192
+ task runs in its own git worktree and cezar never auto-merges — but if you need a
193
+ boring day, stay on the stable release. Pin a nightly you liked with its exact
194
+ version (`npx cezar-cli@0.9.2-nightly.20260813.126` — the cockpit prints the
195
+ version it booted, and the date in it tells you how old the build is), and drop
196
+ back to stable any time with a plain `npx cezar-cli`.
197
+
172
198
  ### Preview builds
173
199
 
174
- Every green CI run publishes an installable npm snapshot
175
- ([how it works](docs/publishing.md)), so you can try unreleased code without
176
- cloning anything:
200
+ Every green CI run also publishes an installable npm snapshot
201
+ ([how it works](docs/publishing.md)), so you can try code that has not even
202
+ merged yet:
177
203
 
178
204
  ```bash
179
205
  npx cezar-cli@develop # current develop head
180
- npx cezar-cli@main # current main head (ahead of the latest stable release)
181
206
  ```
182
207
 
183
208
  Every pull request gets its own preview too — the CI bot posts a sticky comment
184
209
  on the PR with the exact pinned version to copy-paste
185
- (`npx cezar-cli@<version>-pr<N>.<run>`). Previews are prerelease versions under
186
- their own dist-tags; a plain `npx cezar-cli` always resolves to the latest
187
- stable release.
210
+ (`npx cezar-cli@<version>-pr<N>.<run>`). Nightlies and previews are all
211
+ prerelease versions under their own dist-tags; a plain `npx cezar-cli` always
212
+ resolves to the latest stable release.
188
213
 
189
214
  ---
190
215
 
@@ -207,7 +232,7 @@ event live and parks the run at a review gate when there's a diff to inspect.
207
232
 
208
233
  ┌──────────────────────────────┐ ┌───────────────────────────────┐
209
234
  │ git worktree per task │ │ agent CLI (your login) │
210
- │ (isolated branch, parallel) │◄───►│ claude · codex · opencode
235
+ │ (isolated branch, parallel) │◄───►│ claude · codex · opencode · pi
211
236
  └──────────────────────────────┘ │ Bash open · no prompts │
212
237
  │ └───────────────────────────────┘
213
238
  │ agent text · tool calls · tool results · tokens · cost
@@ -285,11 +310,12 @@ Five moves that make the cockpit worth the browser tab:
285
310
 
286
311
  ## Cockpit tour
287
312
 
288
- Seven views, one browser window, all live over Server-Sent Events (six until you opt into the Inbox):
313
+ Eight views, one browser window, all live over Server-Sent Events (seven until you opt into the Inbox):
289
314
 
290
315
  | View | What's in it |
291
316
  |---|---|
292
317
  | **Tasks** | Every task with its status, live event stream (agent text · tool calls · tool results · pasted/generated screenshots), tokens and cost. Continue, cancel, open in terminal (`claude --resume`), review the diff, or push a draft PR. |
318
+ | **All tasks** | Every *registered project's* tasks in one table, filtered and grouped by tag, project, status or workflow — see [Grouping connected repositories](#grouping-connected-repositories-tags-and-the-all-tasks-page). Appears once a second project is registered. |
293
319
  | **Inbox** | **Opt-in** (`CEZ_FOLLOWUPS=1`; hidden by default). Follow-ups an agent left behind (`todos.json`) — one click turns a suggestion into the next task, pre-wired to its suggested skill. Off, agents are never asked to leave follow-ups; each task's own **Notes** handoff journal is unaffected. |
294
320
  | **Git** | Branch, working-tree status, diff vs HEAD, recent commits (click one for its inline patch + GitHub link), and the configurable base branch that worktrees fork from and PRs target. |
295
321
  | **GitHub** | Open issues and PRs of the repo's origin, read through your logged-in `gh`. Hand an issue straight to the agent — pick a workflow and skills, one click runs it. |
@@ -342,19 +368,79 @@ re-registers itself at the next start.
342
368
  **From the terminal** — the same registry, no cockpit required (handy over ssh):
343
369
 
344
370
  ```bash
345
- cezar projects # list: id, branch or status, path
371
+ cezar projects # list: id, branch or status, path, tags
346
372
  cezar projects add ~/code/api # register a folder (defaults to the current repo)
347
373
  cezar projects remove api # drop the registry entry; the repo is untouched
374
+ cezar projects tag api storefront backend # set the grouping tags (no tags clears them)
348
375
  ```
349
376
 
350
377
  These read and write `~/.cezar/config.json` directly, so they work with the
351
378
  server stopped, and `CEZ_HOME` selects which workspace they operate on.
352
379
 
353
- Settings split along the same line: **Agents**, **Worktrees**, **Bookmarklets**,
354
- **Prompt templates** and **MCP** describe one repo and live under
355
- `/p/<projectId>/settings`; **Appearance**, **Notifications**, **Resources**,
356
- **Projects** and **Keyboard** are yours or the machine's and live at
357
- `/settings/global`.
380
+ Settings split along the same line: **General** (the project's folder, its
381
+ registry facts, its parallel-task ceiling, and Remove), **Agents**,
382
+ **Worktrees**, **Bookmarklets**, **Prompt templates** and **MCP** describe one
383
+ repo and live under `/p/<projectId>/settings`; **Appearance**,
384
+ **Notifications**, **Resources**, **Projects** and **Keyboard** are yours or the
385
+ machine's and live at `/settings/global`.
386
+
387
+ ### Grouping connected repositories: tags and the All tasks page
388
+
389
+ Work rarely stops at a repo boundary. A storefront is an API, a web app and a
390
+ design system; a platform is a handful of services plus the infra that runs
391
+ them. **Tags** are how you say so, and **All tasks** is where saying so pays off.
392
+
393
+ **Tag a repo** in **Settings → Projects**: type into the *Tags* cell on its row
394
+ and press Enter (comma works too; the × on a chip, or Backspace in an empty
395
+ field, removes one). The field **autocompletes from the tags already used in the
396
+ workspace** — click the field to see them all, arrow keys and Enter to pick —
397
+ which is what keeps the second repo landing on the first one's spelling instead
398
+ of inventing `store-front` next to `storefront`. Anything not on the list is
399
+ just typed. A tag is a free-form label — `storefront`, `infra`, `client-acme` —
400
+ and a project can carry several, because a repo can belong to more than one
401
+ piece of work. Tags are trimmed, deduplicated case-insensitively (`API` and
402
+ `api` are one tag) and stored in `~/.cezar/config.json` beside the rest of the
403
+ registry, so they are yours and this machine's, never something added to the
404
+ repo.
405
+
406
+ **All tasks** — the top item in the sidebar, `/tasks`, or `⌘K → All tasks` —
407
+ then shows every registered project's work in one table:
408
+
409
+ - **Filter** by tag, status and workflow. Tags are one-click chips; status and
410
+ workflow are searchable multi-selects. Every facet ORs inside itself and ANDs
411
+ across, so *"anything running or waiting in storefront or infra"* is one set
412
+ of clicks. Each option carries how many tasks it would leave, so a filter that
413
+ would empty the table says so before you click it. The search box matches
414
+ title, project, workflow, branch and tags.
415
+ - **Group by** tag, project, status or workflow — click the pressed one again to
416
+ ungroup. Grouping by tag is the reason tags exist: three repos tagged
417
+ `storefront` become one section, and a repo tagged twice appears under both —
418
+ it genuinely belongs to both.
419
+
420
+ The filters, the grouping and the Active/Archived tab live in the **URL**, so a
421
+ filtered view survives a refresh, pastes into a chat, and sits in a bookmark —
422
+ `/tasks?tag=storefront&status=running&group=tag` is a link to exactly what you
423
+ were looking at. Only what you changed shows up: Active is the default, so the
424
+ Archived view is `?archived=1` and a normal link carries no key for it.
425
+
426
+ Each row shows **every** PR and issue it references — a task opened on an issue
427
+ that landed a PR shows both — plus its cost and live CPU/memory, and can be
428
+ marked **read/unread** (the eye) or **archived** (or restored) right there. Every task title, project name and project group heading links into that
429
+ project, so the thread, its diff and its worktree are one click away and stay
430
+ exactly where they were.
431
+
432
+ There is deliberately **no project filter**: narrowing this page to one project
433
+ is that project's own Tasks page, which is a better version of the same answer
434
+ (live updates, the full column set, the composer). So picking a project *leaves*
435
+ for it rather than turning the global view into a worse local one.
436
+
437
+ Nothing else in cezar reads tags, on purpose: a tag is a lens, not a permission,
438
+ a queue or a routing rule. Removing one changes what you see and nothing else.
439
+
440
+ > The page reads a workspace-wide index capped at the newest 200 tasks per
441
+ > project — it says so, and names the projects it capped, rather than showing a
442
+ > short list as if it were complete. Older tasks are always in that project's own
443
+ > Tasks page.
358
444
 
359
445
  **Old page URLs keep working.** Every unprefixed page path — `/`, `/tasks/<id>`,
360
446
  `/settings` — still answers, bound to the project cezar was started in; the
@@ -383,7 +469,7 @@ steps:
383
469
  prompt: "{{task}}"
384
470
  skill: project-conventions # optional — from .ai/skills or .ai/cezar/skills
385
471
  # model: opus # optional per-step model override
386
- # runner: codex # optional per-step backend: claude · codex · opencode
472
+ # runner: codex # optional per-step backend: claude · codex · opencode · pi
387
473
  # allowedTools: [Read, Edit, Write, Grep, Glob, Bash]
388
474
  - id: verify
389
475
  name: Verify
@@ -427,17 +513,22 @@ Useful environment variables:
427
513
  | Var | Effect |
428
514
  |---|---|
429
515
  | `CEZ_DRY_RUN=1` | Use the bundled mock instead of the real `claude` CLI — the entire cockpit works offline, for demos and development. |
516
+ | `CEZ_AGENT_MODELS_LOCKED=1` | Globally lock each runner to the model configured in its native Claude/Codex/OpenCode settings while keeping runner selection available. Exact `1` also delegates authentication and provider enablement to those native agents, so Cezar skips its credential probes and provider-disable preferences. Existing Cezar presets are preserved but ignored, and an environment change requires a restart. The config-file equivalent is `"modelsLocked": true` in global `~/.cezar/config.json` or one repository's `.ai/cezar/config.json`; config-file locks do not disable provider checks. |
430
517
  | `CEZ_APPROVAL_GATE=1` | Opt into Claude's interactive approval UI; by default, unapproved tools are denied without interrupting the run. |
431
518
  | `CEZ_FOLLOWUPS=1` | Turn on the global follow-up **Inbox**: agents are asked to leave follow-ups in `todos.json` when they finish, and the Inbox view appears. Off by default — each task's own **Notes** handoff journal runs either way. |
519
+ | `CEZ_AUTOMATIONS=1` | Turn on **GitHub automations**: the Automations view appears and cezar polls GitHub on each enabled automation's interval, launching tasks from what it finds. Off by default, and only the exact value `1` enables it — without it nothing polls GitHub, the automations endpoints answer `409`, and the nav item is absent. Read at boot, so restart after changing it; definitions, receipts and high-watermarks are retained, so unsetting it and restarting restores the feature without migration or data loss. |
432
520
  | `CEZ_AUTOSAVE=1` | Re-enable the periodic (90 s) autosave commit in task worktrees. Off by default (#471) — turn-end and pre-PR flushes always run, so branches still end complete. Every autosave names its trigger in the commit subject (`cezar autosave (periodic)` vs `(turn end)` / `(run finalize)` / `(pre-PR)`), so the flushes you keep are distinguishable from the timer you disabled. |
433
521
  | `CEZ_CLAUDE_BIN=/path/to/claude` | Override which `claude` binary is used. |
434
522
  | `CEZ_CODEX_BIN=/path/to/codex` | Override which `codex` binary is used. |
435
523
  | `CEZ_OPENCODE_BIN=/path/to/opencode` | Override which `opencode` binary is used. |
524
+ | `CEZ_PI_BIN=/path/to/pi` | Override which `pi` binary is used. |
525
+ | `CLAUDE_CONFIG_DIR`, `CODEX_HOME` | The agents' **own** variables, honoured where the vendor documents one. Setting one moves that agent's **default account** — the config folder cezar discovers. A *second* login of the same CLI is deliberately not an environment setting, since one process-wide value cannot differ per project: add it under **Settings → Agent accounts** and pick it per project. |
436
526
  | `CEZ_BROWSE_ROOT=~/` | Default root for **Add project → Open local folder…**. The picker cannot navigate above it; a saved workspace value overrides the environment default and must name an existing folder. |
437
527
  | `CEZ_PROJECTS_DIR=~/cezar/projects` | Default destination for **Clone from GitHub**. Saved workspace settings override it, and missing directories are created recursively. |
438
528
  | `CEZ_SKILLS_AUTO_UPDATE=0` | Disable automatic checks and updates for upstream-CLI-tracked Open Mercato skill installations. On by default; a saved global Skills setting overrides this environment default. Checks are delayed, bounded, cached, and non-blocking. |
439
529
  | `CEZ_AUTONOMOUS_DEFAULT=0` | Seed the New Task Autonomous default (`0` or `1`). Without a seed, skills default on and workflows off; a saved global Resources setting overrides it. |
440
530
  | `CEZ_WORKTREE_DEFAULT=1` | Seed the New Task Worktree default (`0` or `1`). Without a seed, eligible runs default on; a saved global Resources setting overrides it. |
531
+ | `CEZ_DISABLE_REPO_LOCK=1` | **Dangerous escape hatch:** allow any run executing in the repository root — an explicit `worktree=false` run, non-Git degradation, or a continuation whose worktree cannot be restored — to proceed without Cezar’s repository-root lease. Agents can overwrite each other’s files or Git state; isolated worktree runs are unaffected. Off by default; only the exact value `1` enables it. |
441
532
  | `CEZ_SINGLE_PROJECT=1` | Opt into a launch-project-only cockpit: only the exact value `1` enables it. Project add, edit, checkout, folder browsing, and removal are refused and only the launch project is shown. Off by default; stored registry rows are retained, so unsetting it and restarting restores the full multi-project workspace without migration or data loss. |
442
533
  | `CEZ_HIDE_TOKEN_USAGE=1` | Hide raw input/output token counts throughout the browser cockpit while leaving backend-reported cost visible. Only the exact value `1` enables it; telemetry and API payloads are unchanged, and a restart is required after changing it. |
443
534
  | `CEZ_HIDE_COST=1` | Hide backend-reported monetary cost throughout the browser cockpit while leaving raw input/output token counts visible. Only the exact value `1` enables it; telemetry and API payloads are unchanged, and a restart is required after changing it. |
@@ -445,6 +536,7 @@ Useful environment variables:
445
536
  | `GITHUB_TOKEN` | Fallback for GitHub reads/PRs when `gh` isn't authenticated. |
446
537
  | `CEZ_ENV_PASSTHROUGH=A,B` | Forward these extra host env vars to spawned agents. By default agents get a least-privilege env (safe shell/toolchain vars + the backend's own auth + `GITHUB_TOKEN` + `CEZ_*`), not your full environment — use this to add a var an agent needs. |
447
538
  | `CEZ_AGENT_ENV_FULL=1` | Escape hatch: give spawned agents the full host environment (pre-hardening behavior). Off by default; only set it if you understand that this hands every host secret to the agent process. |
539
+ | `CEZ_AGENT_TMPDIR=0` | Stop giving each task its own temp directory and hand agents the host `TMPDIR` again (pre-#785 behavior). On by default: every run gets `TMPDIR`/`TEMP`/`TMP` pointing at `.ai/cezar/tmp/<task-id>`, created and write-probed before the agent spawns and reaped when the run ends, so concurrent tasks stop sharing one directory and a task refuses to start rather than run against a temp directory that silently swallows its shell output (see Troubleshooting below). Only an exact `0` disables it, and it disables the whole thing — the pre-spawn check included, so this stays an escape hatch you can actually take. |
448
540
  | `CEZ_REDACT_SECRETS=0` | Disable scrubbing of credential values/token shapes from the on-disk state (the NDJSON transcript and the free-text fields of `runs.json`). On by default; leave it on. Best-effort defense-in-depth, not a guarantee: it catches known token shapes and the values of your own secret-named env vars, so a credential in neither category can still get through. |
449
541
  | `CEZ_TITLE_UPDATES=0` | Turn off the live task-title refresh (namer re-runs on each turn end). The Settings → Agents toggle overrides this default. |
450
542
  | `CEZ_AUTONAME=0` | Disable ALL LLM task naming (creation + live) — titles stay heuristic (`437: /om-auto-review-pr`). Under `CEZ_DRY_RUN=1` naming is already off unless forced with `CEZ_AUTONAME=1`. |
@@ -452,25 +544,56 @@ Useful environment variables:
452
544
  | `CEZ_NO_BANNER=1` | Skip the `open-mercato/skills` banner on `cezar serve` startup. (The cockpit no longer shows a banner — its skills now live on the Skills page's Manage panel — so this env var is the terminal banner's only switch.) |
453
545
  | `VITE_CEZ_API_BASE=http://localhost:4321` | **Build time only**, and only when the cockpit bundle is deployed apart from the service it talks to. Empty (the default) means "the origin that served this page", which is right for both normal cases: the CLI serves the bundle itself, and `npm run dev` proxies `/api` to the local service. A deployment that must be configured without a rebuild can put `<meta name="cez-api-base" content="…">` in the served HTML instead, which wins over this. |
454
546
 
547
+ ### Troubleshooting: the agent's shell returns nothing
548
+
549
+ **Symptom.** A task on the Claude backend keeps working, but every shell command
550
+ comes back with no output and a spurious non-zero exit status — `echo hello`
551
+ included. Redirecting into a file inside the worktree still produces the right
552
+ content, so the commands genuinely run; only the *capture* is lost. Codex tasks
553
+ on the same machine are unaffected, because that backend streams over stdio
554
+ pipes instead of round-tripping a command's output through a temp file.
555
+
556
+ **Diagnosis.** The temp directory the agent was given is out of space or out of
557
+ quota. One line tells you:
558
+
559
+ ```bash
560
+ echo probe > "${TMPDIR:-/tmp}/probe" # "Disk quota exceeded" / "No space left on device"
561
+ df -i "${TMPDIR:-/tmp}" # a tmpfs can exhaust inodes long before bytes
562
+ ```
563
+
564
+ Under quota the file is *created* and the write then fails, so the backend reads
565
+ back a zero-byte capture file and hands the agent an empty result.
566
+
567
+ **Fix.** Since #785 cezar gives each task its own `TMPDIR` under
568
+ `.ai/cezar/tmp/<task-id>` and write-probes it before spawning, so a broken temp
569
+ directory fails the task with `agent temp directory is not writable: …` on the
570
+ task thread instead of corrupting its work. If you see that error, free space on
571
+ the disk holding the repo. `CEZ_AGENT_TMPDIR=0` turns the whole mechanism off —
572
+ per-task directory and pre-spawn check alike — and hands agents the host
573
+ `TMPDIR` again, which is the way out if the check itself is wrong on your
574
+ platform.
575
+
455
576
  ---
456
577
 
457
578
  ## Coding agent backends
458
579
 
459
580
  cezar is not married to one vendor. Every agent step runs through a single
460
- `AgentRunner` seam with three built-in backends:
581
+ `AgentRunner` seam with four built-in backends:
461
582
 
462
583
  | Backend | CLI | How cezar drives it | Tool access |
463
584
  |---|---|---|---|
464
585
  | **Claude Code** (default) | [`claude`](https://github.com/anthropics/claude-code) | Headless `stream-json` mode. | Per-tool `--allowedTools` (`bashAllowlist` scopes `Bash`); `dontAsk` denies unapproved tools without prompting (`CEZ_APPROVAL_GATE=1` → `acceptEdits` + approval UI). |
465
586
  | **Codex** | [`codex`](https://github.com/openai/codex) | `codex app-server` — JSON-RPC over stdio, the same transport the Codex IDE extensions use. | Ignores `allowedTools`; the default auto mode uses `danger-full-access` with `approvalPolicy: never` (`CEZ_CODEX_NETWORK=0` opts into the network-blocked `workspace-write` sandbox). |
466
587
  | **OpenCode** _(experimental)_ | [`opencode`](https://opencode.ai) | `opencode serve` — a local HTTP server with an SSE event stream. | Ignores `allowedTools` entirely; every permission is auto-approved. |
588
+ | **pi** _(experimental)_ | [`pi`](https://github.com/badlogic/pi-mono) | Persistent `--mode rpc` over JSONL; models are picked with the `provider/model` convention. | Maps `allowedTools` onto pi's `--tools` allowlist; a configured `bashAllowlist` disables Bash because pi cannot express command-prefix rules. |
467
589
 
468
- > ⚠️ **OpenCode support is experimental.** The runner works but is less battle-tested
469
- > than the Claude Code and Codex backends, and OpenCode auto-approves every permission
470
- > (it ignores `allowedTools`). Treat it as a preview and expect rough edges.
590
+ > ⚠️ **OpenCode and pi support are experimental.** Both runners work but are less
591
+ > battle-tested than the Claude Code and Codex backends, and OpenCode auto-approves
592
+ > every permission (it ignores `allowedTools`). Treat them as previews and expect
593
+ > rough edges.
471
594
 
472
595
  On startup cezar probes which CLIs are installed and the cockpit only offers
473
- the backends it found — install any one of the three and you're operational.
596
+ the backends it found — install any one of the four and you're operational.
474
597
 
475
598
  **Pick a backend at three levels** (most specific wins):
476
599
 
@@ -501,6 +624,17 @@ steps:
501
624
  Parallel variants (×2/×3) of one task share that task's backend — mixing
502
625
  happens per task and per step, not inside a variant group.
503
626
 
627
+ **Models come from your own machine.** For Codex and OpenCode, the model picker
628
+ is not a list cezar ships — it asks the installed CLI what it can actually run
629
+ (`codex app-server`'s `model/list`, and `opencode models`), caches the answer in
630
+ memory for five minutes, and shows it. A model your provider rolled out
631
+ yesterday is selectable without a cezar release, and one it retired stops being
632
+ offered. Claude Code has no equivalent local catalog, so it keeps a short list
633
+ of tier aliases and pinned versions. `auto` (let the agent decide) is always
634
+ available, including when the CLI is missing, logged out, or slow — discovery
635
+ never blocks the cockpit, and a model you pinned yourself stays selectable even
636
+ if it is absent from the discovered list.
637
+
504
638
  The seam is deliberately small: a backend is one class implementing the
505
639
  `AgentRunner` interface (`packages/cezar/src/core/agent-runner.ts`) that turns a prompt into
506
640
  a stream of normalized events. Other CLIs — pi, aider, whatever ships next —
@@ -570,12 +704,20 @@ never blocks startup):
570
704
  // the source against a moving branch head — cezar verifies it resolves to
571
705
  // exactly that commit, and reports it as `team.commit`.
572
706
  "worktreeRetention": 10, // keep the last N finished worktrees on disk; 0 = unlimited (branch always kept)
573
- "defaultRunner": "claude", // agent backend: "claude" (default) · "codex" · "opencode"
707
+ "defaultRunner": "claude", // agent backend: "claude" (default) · "codex" · "opencode" · "pi"
708
+ "modelsLocked": true, // optional: native per-runner model is fixed/read-only; runner stays selectable
574
709
  "plannerModel": "sonnet", // model the "Plan first" button uses to draft chains
575
710
  "baseBranch": "develop" // branch worktrees fork from + PRs target (also settable in the Git tab)
576
711
  }
577
712
  ```
578
713
 
714
+ Put the same `"modelsLocked": true` key in `~/.cezar/config.json` to apply it
715
+ to every registered project. When the key is absent or `false` in both config
716
+ files (and `CEZ_AGENT_MODELS_LOCKED` is not `1`), each runner's normal model
717
+ selector uses that runner's discovered model list. While locked, the model is
718
+ shown read-only and follows the selected runner's native settings; the runner
719
+ itself remains selectable.
720
+
579
721
  Run data (`runs.json`, NDJSON event logs, worktrees, `todos.json`) is
580
722
  git-ignored automatically; your workflows and skills stay committable.
581
723
 
@@ -689,17 +831,6 @@ Every module is meant to be read in one sitting.
689
831
 
690
832
  ---
691
833
 
692
- ## Relationship to cezar (the SaaS)
693
-
694
- cez is the radically-simple, single-user sibling of
695
- [**cezar**](https://github.com/comerito/cezar) — the team SaaS cockpit for
696
- running agents across the whole GitHub issue lifecycle (auto-triage, webhooks,
697
- Supabase, multi-repo). Same core ideas — agent runner, skills, declarative
698
- workflows, a live run cockpit — with none of the accounts, database or cloud.
699
- Start here; graduate to cezar when a team needs shared visibility.
700
-
701
- ---
702
-
703
834
  ## License
704
835
 
705
- **MIT** © Patryk Lewczuk
836
+ **MIT** © Patryk Lewczuk — full text in [LICENSE](LICENSE).
@@ -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,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAwClD,iGAAiG;AACjG,MAAM,QAAQ,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAEjC,MAAM,aAAa,GAAG,kDAAkD,CAAC;AACzE,MAAM,UAAU,GAAG,wCAAwC,CAAC;AAE5D,6FAA6F;AAC7F,KAAK,UAAU,cAAc,CAAC,IAAY;IACxC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACzC,IAAI,GAAG,CAAC,MAAM,GAAG,QAAQ;YAAE,OAAO,IAAI,CAAC;QACvC,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACxC,OAAO,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC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AAC;IACjD,IAAI,CAAC;QACH,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;QACxF,OAAO,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAE,MAAkC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC3F,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,QAAoB,EACpB,SAAiB;IAEjB,IAAI,QAAQ,KAAK,QAAQ;QAAE,OAAO,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAChE,IAAI,QAAQ,KAAK,OAAO;QAAE,OAAO,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAC9D,OAAO;QACL,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE,8EAA8E;QACtF,MAAM,EAAE,EAAE;KACX,CAAC;AACJ,CAAC"}
@@ -47,6 +47,14 @@ export interface ConfigFileDef {
47
47
  seeded?: boolean;
48
48
  /** True when this file holds MCP server definitions (drives the MCP section's filter). */
49
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;
50
58
  /** VERBATIM from the vendor docs. Never computed, never generic. */
51
59
  precedence: string;
52
60
  /** Documented mid-run reload behaviour, or undefined when the vendor is silent. */
@@ -21,6 +21,9 @@ export const CONFIG_FILES = [
21
21
  label: '~/.claude/settings.json',
22
22
  format: 'json',
23
23
  tracked: 'outside-repo',
24
+ modelKey: 'model',
25
+ modelKeys: ['env.ANTHROPIC_MODEL', 'model'],
26
+ modelPriority: 1,
24
27
  precedence: 'Lowest priority. Project and local settings override it key by key — except permission rules, which merge across all scopes.',
25
28
  hotReload: 'Edits to most keys — including permissions and hooks — apply to a running session without a restart.',
26
29
  docsUrl: CLAUDE_SETTINGS_DOCS,
@@ -34,6 +37,9 @@ export const CONFIG_FILES = [
34
37
  label: '.claude/settings.json',
35
38
  format: 'json',
36
39
  tracked: 'tracked',
40
+ modelKey: 'model',
41
+ modelKeys: ['env.ANTHROPIC_MODEL', 'model'],
42
+ modelPriority: 2,
37
43
  precedence: 'Overrides user settings key by key (permission rules merge). Local settings override this.',
38
44
  hotReload: 'Edits to most keys — including permissions and hooks — apply to a running session without a restart.',
39
45
  docsUrl: CLAUDE_SETTINGS_DOCS,
@@ -48,6 +54,9 @@ export const CONFIG_FILES = [
48
54
  format: 'json',
49
55
  tracked: 'gitignored',
50
56
  seeded: true,
57
+ modelKey: 'model',
58
+ modelKeys: ['env.ANTHROPIC_MODEL', 'model'],
59
+ modelPriority: 3,
51
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.',
52
61
  hotReload: 'Edits to most keys — including permissions and hooks — apply to a running session without a restart.',
53
62
  docsUrl: CLAUDE_SETTINGS_DOCS,
@@ -113,6 +122,9 @@ export const CONFIG_FILES = [
113
122
  format: 'toml',
114
123
  tracked: 'outside-repo',
115
124
  holdsMcp: true,
125
+ modelKey: 'model',
126
+ modelProviderKey: 'model_provider',
127
+ modelPriority: 1,
116
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>].',
117
129
  docsUrl: CODEX_CONFIG_DOCS,
118
130
  },
@@ -125,6 +137,8 @@ export const CONFIG_FILES = [
125
137
  label: '.codex/config.toml',
126
138
  format: 'toml',
127
139
  tracked: 'tracked',
140
+ modelKey: 'model',
141
+ modelPriority: 2,
128
142
  holdsMcp: true,
129
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.',
130
144
  docsUrl: CODEX_CONFIG_DOCS,
@@ -152,6 +166,8 @@ export const CONFIG_FILES = [
152
166
  format: 'jsonc',
153
167
  tracked: 'outside-repo',
154
168
  holdsMcp: true,
169
+ modelKey: 'model',
170
+ modelPriority: 1,
155
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.',
156
172
  docsUrl: OPENCODE_CONFIG_DOCS,
157
173
  },
@@ -165,6 +181,8 @@ export const CONFIG_FILES = [
165
181
  format: 'jsonc',
166
182
  tracked: 'tracked',
167
183
  holdsMcp: true,
184
+ modelKey: 'model',
185
+ modelPriority: 2,
168
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.',
169
187
  docsUrl: OPENCODE_CONFIG_DOCS,
170
188
  },