@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,371 @@
1
+ /**
2
+ * Least-privilege environment for spawned agent backends (#427).
3
+ *
4
+ * Every backend used to inherit the FULL parent environment
5
+ * (`{ ...process.env, ...spec.env }`), handing `GITHUB_TOKEN`,
6
+ * `ANTHROPIC_API_KEY`, `AWS_*` and any other host secret to a process an
7
+ * attacker-controlled prompt can drive. Instead we build an explicit,
8
+ * curated child env: a base allowlist of the non-secret vars a shell / dev
9
+ * toolchain genuinely needs, plus the specific auth vars the chosen backend
10
+ * requires, plus cezar's own `CEZ_*` namespace and the per-run `spec.env`.
11
+ * Everything else — notably arbitrary secrets — is dropped by default.
12
+ *
13
+ * Zero-config: the safe env is the default and needs no configuration. Two
14
+ * opt-in escape hatches (both read from the host env, both off by default):
15
+ * - `CEZ_ENV_PASSTHROUGH=A,B,C` forwards those extra named vars;
16
+ * - `CEZ_AGENT_ENV_FULL=1` restores the legacy full-`process.env` behavior.
17
+ */
18
+ import { SECRET_NAME_RE } from './secret-redaction.js';
19
+ /**
20
+ * Env var names are matched case-INSENSITIVELY (#427 review). Windows spells
21
+ * the essentials `Path`, `SystemRoot`, `ComSpec`, `windir` — an exact-case
22
+ * `Set.has('PATH')` matched none of them, so every child env on win32 came out
23
+ * with no PATH and the backend binary could not even be resolved. The child env
24
+ * still carries each var under the parent's ORIGINAL spelling: Windows tooling
25
+ * expects `Path`, and normalizing the key would break it just as badly.
26
+ */
27
+ function upperSet(names) {
28
+ return new Set(names.map((n) => n.toUpperCase()));
29
+ }
30
+ /** Exact var names always forwarded — non-secret, needed by shells/tools. */
31
+ const BASE_ALLOW_NAMES = upperSet([
32
+ // Core shell / process identity
33
+ 'PATH',
34
+ 'HOME',
35
+ 'SHELL',
36
+ 'USER',
37
+ 'LOGNAME',
38
+ 'LNAME',
39
+ 'PWD',
40
+ 'OLDPWD',
41
+ 'SHLVL',
42
+ 'HOSTNAME',
43
+ 'HOST',
44
+ 'HOSTTYPE',
45
+ 'MACHTYPE',
46
+ 'OSTYPE',
47
+ 'TMPDIR',
48
+ 'TEMP',
49
+ 'TMP',
50
+ 'TZ',
51
+ // Locale
52
+ 'LANG',
53
+ 'LANGUAGE',
54
+ // Terminal / display
55
+ 'TERM',
56
+ 'TERMINFO',
57
+ 'COLORTERM',
58
+ 'COLUMNS',
59
+ 'LINES',
60
+ 'CLICOLOR',
61
+ 'FORCE_COLOR',
62
+ 'NO_COLOR',
63
+ 'DISPLAY',
64
+ 'WAYLAND_DISPLAY',
65
+ 'XAUTHORITY',
66
+ // ssh agent socket/pid — a path + pid, not a credential (git over ssh)
67
+ 'SSH_AUTH_SOCK',
68
+ 'SSH_AGENT_PID',
69
+ // Editors / pagers
70
+ 'EDITOR',
71
+ 'VISUAL',
72
+ 'PAGER',
73
+ 'LESS',
74
+ 'MANPATH',
75
+ 'INFOPATH',
76
+ // Git plumbing that is not a secret
77
+ 'GIT_PAGER',
78
+ 'GIT_EDITOR',
79
+ 'GIT_TERMINAL_PROMPT',
80
+ 'GIT_SSH',
81
+ 'GIT_SSH_COMMAND',
82
+ 'GIT_EXEC_PATH',
83
+ // Proxies (matching is case-insensitive, so `http_proxy` is covered too)
84
+ 'HTTP_PROXY',
85
+ 'HTTPS_PROXY',
86
+ 'FTP_PROXY',
87
+ 'ALL_PROXY',
88
+ 'NO_PROXY',
89
+ // Windows equivalents of the above. Without these `nodeSpawn('claude', …)`
90
+ // cannot resolve or launch the binary at all on win32 — the platform is
91
+ // supported (open-in-terminal.ts, open-in-app.ts, process-usage.ts) and
92
+ // package.json carries no `os` restriction. `HOME` is normally unset there;
93
+ // `USERPROFILE` is its counterpart.
94
+ 'SYSTEMROOT',
95
+ 'SYSTEMDRIVE',
96
+ 'WINDIR',
97
+ 'COMSPEC',
98
+ 'PATHEXT',
99
+ 'USERPROFILE',
100
+ 'HOMEDRIVE',
101
+ 'HOMEPATH',
102
+ 'APPDATA',
103
+ 'LOCALAPPDATA',
104
+ 'PROGRAMDATA',
105
+ 'ALLUSERSPROFILE',
106
+ 'PUBLIC',
107
+ 'PROGRAMFILES',
108
+ 'PROGRAMFILES(X86)',
109
+ 'PROGRAMW6432',
110
+ 'COMMONPROGRAMFILES',
111
+ 'COMMONPROGRAMFILES(X86)',
112
+ 'COMMONPROGRAMW6432',
113
+ 'PSMODULEPATH',
114
+ 'USERNAME',
115
+ 'USERDOMAIN',
116
+ 'COMPUTERNAME',
117
+ 'LOGONSERVER',
118
+ 'SESSIONNAME',
119
+ 'OS',
120
+ 'NUMBER_OF_PROCESSORS',
121
+ 'PROCESSOR_ARCHITECTURE',
122
+ 'PROCESSOR_IDENTIFIER',
123
+ 'PROCESSOR_LEVEL',
124
+ 'PROCESSOR_REVISION',
125
+ ]);
126
+ /** Safe prefix families — dev toolchains that agents drive (node, python,
127
+ * rust, go, java, …). A name here still drops if it matches a secret
128
+ * pattern (e.g. `NODE_AUTH_TOKEN`, `CARGO_REGISTRY_TOKEN`). */
129
+ const BASE_ALLOW_PREFIXES = [
130
+ 'LC_',
131
+ 'XDG_',
132
+ 'LESS_',
133
+ // Node / JS
134
+ 'NODE_',
135
+ 'NPM_CONFIG_',
136
+ 'NVM_',
137
+ 'PNPM_',
138
+ 'YARN_',
139
+ 'BUN_',
140
+ 'DENO_',
141
+ 'VOLTA_',
142
+ 'FNM_',
143
+ 'COREPACK_',
144
+ // Python
145
+ 'PYENV',
146
+ 'PYTHON',
147
+ 'PIP_',
148
+ 'PIPENV_',
149
+ 'POETRY_',
150
+ 'VIRTUAL_ENV',
151
+ 'CONDA_',
152
+ 'UV_',
153
+ // Ruby
154
+ 'RBENV',
155
+ 'RUBY',
156
+ 'GEM_',
157
+ 'BUNDLE_',
158
+ // Rust
159
+ 'RUSTUP_',
160
+ 'CARGO_',
161
+ 'RUST_',
162
+ // Go
163
+ 'GOPATH',
164
+ 'GOROOT',
165
+ 'GOBIN',
166
+ 'GOCACHE',
167
+ 'GOMODCACHE',
168
+ 'GOFLAGS',
169
+ 'GOPROXY',
170
+ 'GOPRIVATE',
171
+ 'GOTOOLCHAIN',
172
+ 'GOOS',
173
+ 'GOARCH',
174
+ 'GOENV',
175
+ 'GOWORK',
176
+ 'GO111MODULE',
177
+ // JVM / Android / Kotlin
178
+ 'JAVA',
179
+ 'JDK_',
180
+ 'MAVEN_',
181
+ 'GRADLE_',
182
+ 'KOTLIN_',
183
+ 'ANDROID_',
184
+ 'SDKMAN_',
185
+ // .NET / other
186
+ 'DOTNET_',
187
+ 'NUGET_',
188
+ 'SWIFT',
189
+ 'XCODE',
190
+ 'HOMEBREW_',
191
+ 'ASDF_',
192
+ 'MISE_',
193
+ 'COMPOSER_',
194
+ ];
195
+ /** The provider credentials a backend that selects models as `provider/model` may need — it can
196
+ * be pointed at any of them, so none can be pruned without breaking a legitimate model id. */
197
+ const MULTI_PROVIDER_PREFIXES = [
198
+ 'OPENAI_',
199
+ 'ANTHROPIC_',
200
+ 'AZURE_OPENAI_',
201
+ 'OPENROUTER_',
202
+ 'GROQ_',
203
+ 'MISTRAL_',
204
+ 'GEMINI_',
205
+ 'GOOGLE_GENERATIVE_AI_',
206
+ 'DEEPSEEK_',
207
+ 'XAI_',
208
+ 'PERPLEXITY_',
209
+ 'TOGETHER_',
210
+ 'FIREWORKS_',
211
+ ];
212
+ /** Per-backend auth/config the runner genuinely needs, by prefix. */
213
+ const BACKEND_ALLOW_PREFIXES = {
214
+ claude: ['ANTHROPIC_', 'CLAUDE_'],
215
+ 'claude-cli': ['ANTHROPIC_', 'CLAUDE_'],
216
+ codex: ['OPENAI_', 'CODEX_', 'AZURE_OPENAI_'],
217
+ opencode: MULTI_PROVIDER_PREFIXES,
218
+ // pi selects models as `provider/model` (#387), so it needs both its own config and any
219
+ // provider a configured model id can name — the same set OpenCode gets, for the same reason.
220
+ // Deliberately NOT `CLAUDE_`: pi is not Claude Code and reads none of its variables, and the
221
+ // prefix is load-bearing below — it is what unlocks the Bedrock/Vertex cloud credentials, so
222
+ // granting it here handed pi the whole `AWS_*` / `GOOGLE_CLOUD_*` family on any host that had
223
+ // set `CLAUDE_CODE_USE_BEDROCK=1` for Claude Code, plus Claude's own config dir.
224
+ pi: ['PI_', ...MULTI_PROVIDER_PREFIXES],
225
+ };
226
+ /** `gh` handoff (draft PRs) works in every backend — the one credential the
227
+ * project deliberately keeps in the environment (AGENTS.md "No secrets in
228
+ * state files": GITHUB_TOKEN stays in env, never on disk). */
229
+ const GH_ALLOW_NAMES = upperSet([
230
+ 'GITHUB_TOKEN',
231
+ 'GH_TOKEN',
232
+ 'GH_HOST',
233
+ 'GH_ENTERPRISE_TOKEN',
234
+ 'GH_CONFIG_DIR',
235
+ ]);
236
+ /**
237
+ * Claude Code can be pointed at Bedrock or Vertex instead of the Anthropic API
238
+ * by `CLAUDE_CODE_USE_BEDROCK=1` / `CLAUDE_CODE_USE_VERTEX=1`. Those toggles
239
+ * ride in on the `CLAUDE_` prefix — but the cloud credentials they switch the
240
+ * SDK over to did not, so hardening the env forwarded the *instruction* to use
241
+ * Bedrock while dropping the *means*, turning a working setup into a hard auth
242
+ * failure with no hint (#427 review). Each toggle therefore unlocks exactly the
243
+ * credentials its own path needs, and only while it is on: with no toggle set
244
+ * (the default, direct-API posture) `AWS_*` / `GOOGLE_*` stay dropped, which is
245
+ * the least-privilege behavior #427 asked for in the first place.
246
+ */
247
+ const BEDROCK_TOGGLE = 'CLAUDE_CODE_USE_BEDROCK';
248
+ const VERTEX_TOGGLE = 'CLAUDE_CODE_USE_VERTEX';
249
+ /** The whole `AWS_` family: the SDK's credential chain reads far more than the
250
+ * static keys (SSO/profile/container/web-identity all have their own vars). */
251
+ const BEDROCK_ALLOW_PREFIXES = ['AWS_'];
252
+ const VERTEX_ALLOW_NAMES = upperSet([
253
+ 'GOOGLE_APPLICATION_CREDENTIALS',
254
+ 'CLOUD_ML_REGION',
255
+ // ANTHROPIC_VERTEX_PROJECT_ID already rides in on the `ANTHROPIC_` prefix.
256
+ ]);
257
+ const VERTEX_ALLOW_PREFIXES = ['GOOGLE_CLOUD_'];
258
+ export function looksSecret(name) {
259
+ return SECRET_NAME_RE.test(name);
260
+ }
261
+ /** Prefixes are authored uppercase; `name` must already be normalized. */
262
+ function matchesPrefix(name, prefixes) {
263
+ return prefixes.some((p) => name.startsWith(p));
264
+ }
265
+ /** Case-insensitive read of `source` — a win32 fixture may spell it `Path`. */
266
+ function readVar(source, name) {
267
+ const direct = source[name];
268
+ if (direct !== undefined)
269
+ return direct;
270
+ const upper = name.toUpperCase();
271
+ for (const [k, v] of Object.entries(source)) {
272
+ if (k.toUpperCase() === upper)
273
+ return v;
274
+ }
275
+ return undefined;
276
+ }
277
+ /** An opt-in toggle is on unless it is absent/empty/`0`/`false`. */
278
+ function isTruthy(value) {
279
+ if (value === undefined)
280
+ return false;
281
+ const v = value.trim().toLowerCase();
282
+ return v !== '' && v !== '0' && v !== 'false';
283
+ }
284
+ /**
285
+ * Build the curated child environment for a spawned backend. `extraEnv`
286
+ * (the runner's `spec.env`) is applied last so per-run vars always win.
287
+ */
288
+ export function buildChildEnv(opts) {
289
+ const source = opts.source ?? process.env;
290
+ const extra = opts.extraEnv ?? {};
291
+ // Names `extra` is about to define, normalized. The host copy of a var the
292
+ // per-run env overrides must be DROPPED, not merely shadowed: env names are
293
+ // matched case-insensitively here (and by Windows itself), so a host `Temp`
294
+ // and a per-run `TEMP` are the same variable spelled two ways — leaving both
295
+ // in the child env hands the backend the host value under one of them. That
296
+ // is exactly the temp-directory bug #785 fixes, so the override has to be
297
+ // total. `extra` is cezar's own, never a host secret, and always wins.
298
+ const overridden = upperSet(Object.keys(extra));
299
+ // Escape hatch: restore legacy full-inheritance (opt-in, off by default).
300
+ // Parsed with the same `isTruthy` the Bedrock/Vertex toggles use (#456
301
+ // review) — an exact `=== '1'` made `CEZ_AGENT_ENV_FULL=true` silently do
302
+ // nothing, which is a confusing way to fail open-vs-closed.
303
+ if (isTruthy(readVar(source, 'CEZ_AGENT_ENV_FULL'))) {
304
+ const full = {};
305
+ for (const [name, value] of Object.entries(source)) {
306
+ if (!overridden.has(name.toUpperCase()))
307
+ full[name] = value;
308
+ }
309
+ return { ...full, ...extra };
310
+ }
311
+ const backendPrefixes = BACKEND_ALLOW_PREFIXES[opts.backend] ?? BACKEND_ALLOW_PREFIXES.claude;
312
+ const passthrough = upperSet((readVar(source, 'CEZ_ENV_PASSTHROUGH') ?? '')
313
+ .split(',')
314
+ .map((s) => s.trim())
315
+ .filter(Boolean));
316
+ // Cloud auth is unlocked only by the toggle that needs it, and only for a
317
+ // backend that is actually given the toggle (`CLAUDE_` prefix) to read.
318
+ const claudeCloud = backendPrefixes.includes('CLAUDE_');
319
+ const cloudPrefixes = [];
320
+ const cloudNames = new Set();
321
+ if (claudeCloud && isTruthy(readVar(source, BEDROCK_TOGGLE))) {
322
+ cloudPrefixes.push(...BEDROCK_ALLOW_PREFIXES);
323
+ }
324
+ if (claudeCloud && isTruthy(readVar(source, VERTEX_TOGGLE))) {
325
+ cloudPrefixes.push(...VERTEX_ALLOW_PREFIXES);
326
+ for (const n of VERTEX_ALLOW_NAMES)
327
+ cloudNames.add(n);
328
+ }
329
+ const out = {};
330
+ for (const [name, value] of Object.entries(source)) {
331
+ if (value === undefined)
332
+ continue;
333
+ if (overridden.has(name.toUpperCase()))
334
+ continue; // the per-run value replaces it, whatever the spelling
335
+ if (allow(name))
336
+ out[name] = value;
337
+ }
338
+ // Per-run env last — it is cezar's own, never a host secret, and must win.
339
+ for (const [name, value] of Object.entries(extra))
340
+ out[name] = value;
341
+ return out;
342
+ /** `name` is matched normalized; the caller keeps the original spelling. */
343
+ function allow(name) {
344
+ const key = name.toUpperCase();
345
+ // cezar's own namespace (CEZ_DRY_RUN plumbing, mock hooks, run wiring).
346
+ if (key.startsWith('CEZ_'))
347
+ return true;
348
+ // Backend auth + gh handoff + the cloud creds an active Bedrock/Vertex
349
+ // toggle needs: forwarded even though they are secrets — the backend cannot
350
+ // authenticate without them. They are still redacted before anything
351
+ // reaches the on-disk NDJSON (see secret-redaction.ts).
352
+ if (GH_ALLOW_NAMES.has(key))
353
+ return true;
354
+ if (matchesPrefix(key, backendPrefixes))
355
+ return true;
356
+ if (cloudNames.has(key) || matchesPrefix(key, cloudPrefixes))
357
+ return true;
358
+ // Explicit opt-in passthrough.
359
+ if (passthrough.has(key))
360
+ return true;
361
+ // Base allowlist — exact names always, prefix families only when the name
362
+ // is not itself credential-shaped (`NODE_AUTH_TOKEN` never rides in on
363
+ // `NODE_`, in either spelling — looksSecret sees the normalized name).
364
+ if (BASE_ALLOW_NAMES.has(key))
365
+ return true;
366
+ if (matchesPrefix(key, BASE_ALLOW_PREFIXES) && !looksSecret(key))
367
+ return true;
368
+ return false;
369
+ }
370
+ }
371
+ //# sourceMappingURL=agent-env.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-env.js","sourceRoot":"","sources":["../../src/core/agent-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD;;;;;;;GAOG;AACH,SAAS,QAAQ,CAAC,KAAwB;IACxC,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;AACpD,CAAC;AAED,6EAA6E;AAC7E,MAAM,gBAAgB,GAAwB,QAAQ,CAAC;IACrD,gCAAgC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AAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;IACrE,OAAO,GAAG,CAAC;IAEX,4EAA4E;IAC5E,SAAS,KAAK,CAAC,IAAY;QACzB,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QAC/B,wEAAwE;QACxE,IAAI,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC;YAAE,OAAO,IAAI,CAAC;QACxC,uEAAuE;QACvE,4EAA4E;QAC5E,qEAAqE;QACrE,wDAAwD;QACxD,IAAI,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QACzC,IAAI,aAAa,CAAC,GAAG,EAAE,eAAe,CAAC;YAAE,OAAO,IAAI,CAAC;QACrD,IAAI,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,aAAa,CAAC,GAAG,EAAE,aAAa,CAAC;YAAE,OAAO,IAAI,CAAC;QAC1E,+BAA+B;QAC/B,IAAI,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QACtC,0EAA0E;QAC1E,uEAAuE;QACvE,uEAAuE;QACvE,IAAI,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QAC3C,IAAI,aAAa,CAAC,GAAG,EAAE,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QAC9E,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -0,0 +1,10 @@
1
+ /** The server-side switch that makes native agent settings authoritative. */
2
+ export declare const AGENT_MODELS_LOCKED_ENV = "CEZ_AGENT_MODELS_LOCKED";
3
+ /**
4
+ * Only the exact environment value `1` enables the process-wide lock. The
5
+ * global workspace config or one repository may additionally opt in with
6
+ * `"modelsLocked": true`; missing, unreadable, malformed, and false values
7
+ * preserve ordinary model selection unless another source enables the lock.
8
+ */
9
+ export declare function agentModelsLocked(repoRoot?: string, env?: NodeJS.ProcessEnv): boolean;
10
+ export declare const AGENT_MODELS_LOCKED_ERROR = "agent models are locked \u2014 configure the model in the native coding-agent settings";
@@ -0,0 +1,36 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { z } from 'zod';
4
+ import { workspaceConfigPath } from '../paths.js';
5
+ /** The server-side switch that makes native agent settings authoritative. */
6
+ export const AGENT_MODELS_LOCKED_ENV = 'CEZ_AGENT_MODELS_LOCKED';
7
+ const modelPolicyConfigSchema = z.object({
8
+ modelsLocked: z.boolean().optional(),
9
+ }).passthrough();
10
+ /**
11
+ * Only the exact environment value `1` enables the process-wide lock. The
12
+ * global workspace config or one repository may additionally opt in with
13
+ * `"modelsLocked": true`; missing, unreadable, malformed, and false values
14
+ * preserve ordinary model selection unless another source enables the lock.
15
+ */
16
+ export function agentModelsLocked(repoRoot, env = process.env) {
17
+ if (env[AGENT_MODELS_LOCKED_ENV] === '1')
18
+ return true;
19
+ const paths = [
20
+ workspaceConfigPath(env),
21
+ ...(repoRoot ? [join(repoRoot, '.ai', 'cezar', 'config.json')] : []),
22
+ ];
23
+ for (const path of paths) {
24
+ try {
25
+ const parsed = modelPolicyConfigSchema.safeParse(JSON.parse(readFileSync(path, 'utf8')));
26
+ if (parsed.success && parsed.data.modelsLocked === true)
27
+ return true;
28
+ }
29
+ catch {
30
+ // Each source is optional and independently degradable.
31
+ }
32
+ }
33
+ return false;
34
+ }
35
+ export const AGENT_MODELS_LOCKED_ERROR = 'agent models are locked — configure the model in the native coding-agent settings';
36
+ //# sourceMappingURL=agent-model-policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-model-policy.js","sourceRoot":"","sources":["../../src/core/agent-model-policy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,W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profiles — a second (third, …) login of the SAME agent CLI.
4
+ *
5
+ * The binary never changes; only the environment does. `CLAUDE_CONFIG_DIR=~/.claude-klaudiusz claude`
6
+ * is the same Claude Code talking to a different account, because that one variable relocates the
7
+ * agent's ENTIRE per-user home: credentials, settings, projects and — the part that bites —
8
+ * `sessions/`, so a session id only means something inside the dir it was created in.
9
+ *
10
+ * This module is the single maintenance surface for that vendor knowledge, and it is deliberately
11
+ * the SIBLING of `src/agent-config/catalog.ts` rather than part of it: the catalog owns config
12
+ * *file* knowledge (paths, formats, verbatim precedence strings), this owns the *home-relocation*
13
+ * variable. Splitting them also keeps the layering honest — `agent-config/` may import `paths.ts`,
14
+ * while this is imported BY the runners, provider auth and the terminal handoff.
15
+ *
16
+ * Pure by construction: no filesystem, no `process.env`, nothing to stub. Resolution against the
17
+ * workspace config lives in `src/workspace/agent-profiles.ts`.
18
+ *
19
+ * Facts verified against the shipped CLIs on 2026-07-29.
20
+ */
21
+ /**
22
+ * Which env var relocates each agent's whole per-user home.
23
+ *
24
+ * `null` means the agent has no such variable and therefore cannot carry profiles:
25
+ *
26
+ * - **claude** → `CLAUDE_CONFIG_DIR`. Documented; moves credentials, settings, projects, sessions.
27
+ * - **codex** → `CODEX_HOME`. Documented; `auth.json` lives inside it, so identity moves too.
28
+ * - **opencode** → nothing usable. `OPENCODE_CONFIG_DIR`/`OPENCODE_CONFIG` move CONFIG ONLY;
29
+ * credentials live in `~/.local/share/opencode/opencode.db`, behind a separate `OPENCODE_DB`.
30
+ * A config-dir-only profile would swap settings while still billing the other account — the UI
31
+ * would say "Work" and the run would not be — so OpenCode is unsupported until it documents a
32
+ * single home variable. `XDG_CONFIG_HOME` is rejected regardless: it is machine-wide and would
33
+ * relocate every other XDG-aware tool the agent's own Bash calls touch.
34
+ * - **pi** → nothing documented. pi ships no per-user home variable of its own, so — exactly like
35
+ * OpenCode — a second account cannot be carried without silently billing the wrong one. `null`
36
+ * until pi documents a single home variable that moves credentials as well as config.
37
+ */
38
+ export declare const PROFILE_ENV_VAR: Record<ProviderId, string | null>;
39
+ /** Providers that can carry more than one account — what the UI offers "Add account" for. */
40
+ export declare const PROFILE_CAPABLE_PROVIDERS: readonly ProviderId[];
41
+ export declare function supportsProfiles(provider: ProviderId): boolean;
42
+ /**
43
+ * The env a spawned agent needs to run under `configDir`, or `{}` for the default profile.
44
+ *
45
+ * `{}` is load-bearing, not a convenience: `buildChildEnv` applies `extraEnv` AFTER its allowlist
46
+ * and so bypasses it entirely, which makes this function the only thing standing between a
47
+ * profile and the child environment. Returning nothing for the zero-config case means the
48
+ * overwhelmingly common path adds literally no variable — the same environment cezar has always
49
+ * spawned. It also means this can never emit one provider's variable for another provider's
50
+ * process: the name comes from `PROFILE_ENV_VAR[provider]` and nowhere else.
51
+ */
52
+ export declare function profileEnv(provider: ProviderId, configDir: string | null | undefined): Record<string, string>;
53
+ /**
54
+ * Does `entries` look like a config dir this provider actually wrote?
55
+ *
56
+ * ADVISORY, never a gate. The honest first-run flow for a second account is *add the profile →
57
+ * Connect → the CLI creates the dir on login*, so refusing an unrecognized directory would break
58
+ * the very case the feature exists for. The answer drives a warning line in the UI, nothing more.
59
+ *
60
+ * Takes the directory listing rather than a path so it stays pure; the caller reads the dir.
61
+ */
62
+ export declare function looksLikeProfileDir(provider: ProviderId, entries: readonly string[]): boolean;
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Agent profiles — a second (third, …) login of the SAME agent CLI.
3
+ *
4
+ * The binary never changes; only the environment does. `CLAUDE_CONFIG_DIR=~/.claude-klaudiusz claude`
5
+ * is the same Claude Code talking to a different account, because that one variable relocates the
6
+ * agent's ENTIRE per-user home: credentials, settings, projects and — the part that bites —
7
+ * `sessions/`, so a session id only means something inside the dir it was created in.
8
+ *
9
+ * This module is the single maintenance surface for that vendor knowledge, and it is deliberately
10
+ * the SIBLING of `src/agent-config/catalog.ts` rather than part of it: the catalog owns config
11
+ * *file* knowledge (paths, formats, verbatim precedence strings), this owns the *home-relocation*
12
+ * variable. Splitting them also keeps the layering honest — `agent-config/` may import `paths.ts`,
13
+ * while this is imported BY the runners, provider auth and the terminal handoff.
14
+ *
15
+ * Pure by construction: no filesystem, no `process.env`, nothing to stub. Resolution against the
16
+ * workspace config lives in `src/workspace/agent-profiles.ts`.
17
+ *
18
+ * Facts verified against the shipped CLIs on 2026-07-29.
19
+ */
20
+ /**
21
+ * Which env var relocates each agent's whole per-user home.
22
+ *
23
+ * `null` means the agent has no such variable and therefore cannot carry profiles:
24
+ *
25
+ * - **claude** → `CLAUDE_CONFIG_DIR`. Documented; moves credentials, settings, projects, sessions.
26
+ * - **codex** → `CODEX_HOME`. Documented; `auth.json` lives inside it, so identity moves too.
27
+ * - **opencode** → nothing usable. `OPENCODE_CONFIG_DIR`/`OPENCODE_CONFIG` move CONFIG ONLY;
28
+ * credentials live in `~/.local/share/opencode/opencode.db`, behind a separate `OPENCODE_DB`.
29
+ * A config-dir-only profile would swap settings while still billing the other account — the UI
30
+ * would say "Work" and the run would not be — so OpenCode is unsupported until it documents a
31
+ * single home variable. `XDG_CONFIG_HOME` is rejected regardless: it is machine-wide and would
32
+ * relocate every other XDG-aware tool the agent's own Bash calls touch.
33
+ * - **pi** → nothing documented. pi ships no per-user home variable of its own, so — exactly like
34
+ * OpenCode — a second account cannot be carried without silently billing the wrong one. `null`
35
+ * until pi documents a single home variable that moves credentials as well as config.
36
+ */
37
+ export const PROFILE_ENV_VAR = {
38
+ claude: 'CLAUDE_CONFIG_DIR',
39
+ codex: 'CODEX_HOME',
40
+ opencode: null,
41
+ pi: null,
42
+ };
43
+ /** Providers that can carry more than one account — what the UI offers "Add account" for. */
44
+ export const PROFILE_CAPABLE_PROVIDERS = Object.keys(PROFILE_ENV_VAR).filter((provider) => PROFILE_ENV_VAR[provider] !== null);
45
+ export function supportsProfiles(provider) {
46
+ return PROFILE_ENV_VAR[provider] !== null;
47
+ }
48
+ /**
49
+ * The env a spawned agent needs to run under `configDir`, or `{}` for the default profile.
50
+ *
51
+ * `{}` is load-bearing, not a convenience: `buildChildEnv` applies `extraEnv` AFTER its allowlist
52
+ * and so bypasses it entirely, which makes this function the only thing standing between a
53
+ * profile and the child environment. Returning nothing for the zero-config case means the
54
+ * overwhelmingly common path adds literally no variable — the same environment cezar has always
55
+ * spawned. It also means this can never emit one provider's variable for another provider's
56
+ * process: the name comes from `PROFILE_ENV_VAR[provider]` and nowhere else.
57
+ */
58
+ export function profileEnv(provider, configDir) {
59
+ const name = PROFILE_ENV_VAR[provider];
60
+ const dir = configDir?.trim();
61
+ if (name === null || !dir)
62
+ return {};
63
+ return { [name]: dir };
64
+ }
65
+ /**
66
+ * Does `entries` look like a config dir this provider actually wrote?
67
+ *
68
+ * ADVISORY, never a gate. The honest first-run flow for a second account is *add the profile →
69
+ * Connect → the CLI creates the dir on login*, so refusing an unrecognized directory would break
70
+ * the very case the feature exists for. The answer drives a warning line in the UI, nothing more.
71
+ *
72
+ * Takes the directory listing rather than a path so it stays pure; the caller reads the dir.
73
+ */
74
+ export function looksLikeProfileDir(provider, entries) {
75
+ const present = new Set(entries);
76
+ const markers = PROFILE_DIR_MARKERS[provider];
77
+ return markers.some((marker) => present.has(marker));
78
+ }
79
+ /** What each agent drops into its home on first login. Any one is enough. */
80
+ const PROFILE_DIR_MARKERS = {
81
+ // `.claude.json` sits INSIDE the dir once it is overridden (see `claudeStateFilePath`), which
82
+ // is exactly the case being probed here.
83
+ claude: ['.claude.json', 'settings.json', 'projects', 'sessions'],
84
+ codex: ['auth.json', 'config.toml'],
85
+ opencode: [],
86
+ // pi cannot carry profiles (`PROFILE_ENV_VAR.pi === null`), so nothing ever probes a pi
87
+ // profile dir; the entry exists to keep this table exhaustive over `ProviderId`.
88
+ pi: [],
89
+ };
90
+ //# sourceMappingURL=agent-profiles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-profiles.js","sourceRoot":"","sources":["../../src/core/agent-profiles.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;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