@songsid/agend 2.3.4-beta.9 → 2.3.5-alpha.10

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 (1494) hide show
  1. package/README.md +2 -0
  2. package/README.zh-TW.md +2 -0
  3. package/THIRD_PARTY_NOTICES.md +67 -0
  4. package/dist/accounts-profiles.d.ts +102 -0
  5. package/dist/accounts-profiles.js +194 -0
  6. package/dist/accounts-profiles.js.map +1 -0
  7. package/dist/accounts-signout.d.ts +59 -0
  8. package/dist/accounts-signout.js +181 -0
  9. package/dist/accounts-signout.js.map +1 -0
  10. package/dist/accounts-view.d.ts +168 -0
  11. package/dist/accounts-view.js +188 -0
  12. package/dist/accounts-view.js.map +1 -0
  13. package/dist/agent-cli-instructions.md +1 -1
  14. package/dist/agent-cli.js +5 -2
  15. package/dist/agent-cli.js.map +1 -1
  16. package/dist/agent-endpoint.d.ts +5 -1
  17. package/dist/agent-endpoint.js +12 -2
  18. package/dist/agent-endpoint.js.map +1 -1
  19. package/dist/agent-file-read.js +1 -1
  20. package/dist/agent-file-read.js.map +1 -1
  21. package/dist/agent-runtime-api.d.ts +4 -0
  22. package/dist/agent-runtime-api.js +59 -0
  23. package/dist/agent-runtime-api.js.map +1 -0
  24. package/dist/agent-runtime-change.d.ts +76 -0
  25. package/dist/agent-runtime-change.js +114 -0
  26. package/dist/agent-runtime-change.js.map +1 -0
  27. package/dist/agent-whats-new.js +5 -0
  28. package/dist/agent-whats-new.js.map +1 -1
  29. package/dist/agent-workspace.d.ts +104 -0
  30. package/dist/agent-workspace.js +381 -0
  31. package/dist/agent-workspace.js.map +1 -0
  32. package/dist/apply-job.d.ts +5 -0
  33. package/dist/apply-job.js +10 -3
  34. package/dist/apply-job.js.map +1 -1
  35. package/dist/auth-api.d.ts +49 -1
  36. package/dist/auth-api.js +299 -10
  37. package/dist/auth-api.js.map +1 -1
  38. package/dist/authority/company-join.d.ts +16 -0
  39. package/dist/authority/company-join.js +37 -0
  40. package/dist/authority/company-join.js.map +1 -0
  41. package/dist/authority/hub-initialization.d.ts +13 -0
  42. package/dist/authority/hub-initialization.js +30 -0
  43. package/dist/authority/hub-initialization.js.map +1 -0
  44. package/dist/authority/session-authorizations.d.ts +2 -0
  45. package/dist/authority/session-authorizations.js +7 -1
  46. package/dist/authority/session-authorizations.js.map +1 -1
  47. package/dist/authority/web-authority.d.ts +25 -2
  48. package/dist/authority/web-authority.js +37 -4
  49. package/dist/authority/web-authority.js.map +1 -1
  50. package/dist/backend/claude-code.d.ts +16 -12
  51. package/dist/backend/claude-code.js +212 -142
  52. package/dist/backend/claude-code.js.map +1 -1
  53. package/dist/backend/codex-footer-hints.d.ts +3 -0
  54. package/dist/backend/codex-footer-hints.js +14 -0
  55. package/dist/backend/codex-footer-hints.js.map +1 -1
  56. package/dist/backend/codex-metadata.d.ts +14 -0
  57. package/dist/backend/codex-metadata.js +45 -0
  58. package/dist/backend/codex-metadata.js.map +1 -1
  59. package/dist/backend/codex-package.d.ts +5 -2
  60. package/dist/backend/codex-package.js +1 -5
  61. package/dist/backend/codex-package.js.map +1 -1
  62. package/dist/backend/codex-quota-history.d.ts +7 -0
  63. package/dist/backend/codex-quota-history.js +57 -0
  64. package/dist/backend/codex-quota-history.js.map +1 -0
  65. package/dist/backend/codex-session-lookup.d.ts +6 -0
  66. package/dist/backend/codex-session-lookup.js +1 -1
  67. package/dist/backend/codex-session-lookup.js.map +1 -1
  68. package/dist/backend/codex-speed.d.ts +14 -0
  69. package/dist/backend/codex-speed.js +35 -0
  70. package/dist/backend/codex-speed.js.map +1 -0
  71. package/dist/backend/codex.d.ts +143 -113
  72. package/dist/backend/codex.js +1352 -1233
  73. package/dist/backend/codex.js.map +1 -1
  74. package/dist/backend/credential-profile.js +2 -1
  75. package/dist/backend/credential-profile.js.map +1 -1
  76. package/dist/backend/grok-model-cache.d.ts +7 -0
  77. package/dist/backend/grok-model-cache.js +65 -0
  78. package/dist/backend/grok-model-cache.js.map +1 -0
  79. package/dist/backend/grok-weekly-reset.d.ts +24 -0
  80. package/dist/backend/grok-weekly-reset.js +95 -0
  81. package/dist/backend/grok-weekly-reset.js.map +1 -0
  82. package/dist/backend/grok.d.ts +32 -1
  83. package/dist/backend/grok.js +323 -54
  84. package/dist/backend/grok.js.map +1 -1
  85. package/dist/backend/kiro.js +12 -2
  86. package/dist/backend/kiro.js.map +1 -1
  87. package/dist/backend/native-pane.d.ts +11 -0
  88. package/dist/backend/native-pane.js +59 -0
  89. package/dist/backend/native-pane.js.map +1 -0
  90. package/dist/backend/types.d.ts +20 -0
  91. package/dist/backend/types.js.map +1 -1
  92. package/dist/backend-signin-pending.d.ts +8 -2
  93. package/dist/backend-signin-pending.js +6 -2
  94. package/dist/backend-signin-pending.js.map +1 -1
  95. package/dist/browser-backend-signins.d.ts +2 -1
  96. package/dist/browser-backend-signins.js +1 -1
  97. package/dist/browser-backend-signins.js.map +1 -1
  98. package/dist/build-provenance-cli.d.ts +3 -0
  99. package/dist/build-provenance-cli.js +11 -0
  100. package/dist/build-provenance-cli.js.map +1 -0
  101. package/dist/build-provenance.d.ts +20 -0
  102. package/dist/build-provenance.js +67 -0
  103. package/dist/build-provenance.js.map +1 -0
  104. package/dist/build-provenance.json +1 -0
  105. package/dist/bundled-tmux-guard.d.ts +19 -0
  106. package/dist/bundled-tmux-guard.js +83 -0
  107. package/dist/bundled-tmux-guard.js.map +1 -0
  108. package/dist/cache-ledger.d.ts +10 -0
  109. package/dist/cache-ledger.js +49 -12
  110. package/dist/cache-ledger.js.map +1 -1
  111. package/dist/cache-service.d.ts +6 -0
  112. package/dist/cache-service.js +105 -0
  113. package/dist/cache-service.js.map +1 -1
  114. package/dist/channel/access-manager.d.ts +1 -6
  115. package/dist/channel/access-manager.js +4 -94
  116. package/dist/channel/access-manager.js.map +1 -1
  117. package/dist/channel/adapters/discord.d.ts +0 -2
  118. package/dist/channel/adapters/discord.js +0 -8
  119. package/dist/channel/adapters/discord.js.map +1 -1
  120. package/dist/channel/adapters/telegram.d.ts +51 -3
  121. package/dist/channel/adapters/telegram.js +232 -44
  122. package/dist/channel/adapters/telegram.js.map +1 -1
  123. package/dist/channel/ipc-bridge.d.ts +2 -0
  124. package/dist/channel/mcp-tools.js +7 -7
  125. package/dist/channel/mcp-tools.js.map +1 -1
  126. package/dist/channel/types.d.ts +2 -2
  127. package/dist/classic-bindings.d.ts +13 -0
  128. package/dist/classic-bindings.js +28 -2
  129. package/dist/classic-bindings.js.map +1 -1
  130. package/dist/classic-channel-manager.d.ts +2 -0
  131. package/dist/classic-channel-manager.js +5 -1
  132. package/dist/classic-channel-manager.js.map +1 -1
  133. package/dist/claude-auth-status.d.ts +48 -0
  134. package/dist/claude-auth-status.js +149 -0
  135. package/dist/claude-auth-status.js.map +1 -0
  136. package/dist/claude-model-minimum.d.ts +7 -0
  137. package/dist/claude-model-minimum.js +16 -0
  138. package/dist/claude-model-minimum.js.map +1 -0
  139. package/dist/cli-capability.d.ts +186 -0
  140. package/dist/cli-capability.js +55 -0
  141. package/dist/cli-capability.js.map +1 -0
  142. package/dist/cli-caps-module.d.ts +29 -0
  143. package/dist/cli-caps-module.js +43 -0
  144. package/dist/cli-caps-module.js.map +1 -0
  145. package/dist/cli-registry-check.d.ts +28 -0
  146. package/dist/cli-registry-check.js +223 -0
  147. package/dist/cli-registry-check.js.map +1 -0
  148. package/dist/cli-registry.d.ts +526 -0
  149. package/dist/cli-registry.js +83 -0
  150. package/dist/cli-registry.js.map +1 -0
  151. package/dist/cli-spec-antigravity.d.ts +60 -0
  152. package/dist/cli-spec-antigravity.js +35 -0
  153. package/dist/cli-spec-antigravity.js.map +1 -0
  154. package/dist/cli-spec-claude-code.d.ts +84 -0
  155. package/dist/cli-spec-claude-code.js +35 -0
  156. package/dist/cli-spec-claude-code.js.map +1 -0
  157. package/dist/cli-spec-codex.d.ts +78 -0
  158. package/dist/cli-spec-codex.js +38 -0
  159. package/dist/cli-spec-codex.js.map +1 -0
  160. package/dist/cli-spec-grok.d.ts +59 -0
  161. package/dist/cli-spec-grok.js +35 -0
  162. package/dist/cli-spec-grok.js.map +1 -0
  163. package/dist/cli-spec-kiro-cli.d.ts +73 -0
  164. package/dist/cli-spec-kiro-cli.js +36 -0
  165. package/dist/cli-spec-kiro-cli.js.map +1 -0
  166. package/dist/cli-spec-muse.d.ts +52 -0
  167. package/dist/cli-spec-muse.js +38 -0
  168. package/dist/cli-spec-muse.js.map +1 -0
  169. package/dist/cli-spec-opencode.d.ts +50 -0
  170. package/dist/cli-spec-opencode.js +37 -0
  171. package/dist/cli-spec-opencode.js.map +1 -0
  172. package/dist/cli.js +258 -67
  173. package/dist/cli.js.map +1 -1
  174. package/dist/config-validator.js +104 -2
  175. package/dist/config-validator.js.map +1 -1
  176. package/dist/config.js +19 -1
  177. package/dist/config.js.map +1 -1
  178. package/dist/daemon.d.ts +162 -7
  179. package/dist/daemon.js +1290 -305
  180. package/dist/daemon.js.map +1 -1
  181. package/dist/dashboard-permissions.d.ts +8 -0
  182. package/dist/dashboard-permissions.js +16 -0
  183. package/dist/dashboard-permissions.js.map +1 -1
  184. package/dist/decision-list.d.ts +2 -0
  185. package/dist/decision-list.js +1 -1
  186. package/dist/decision-list.js.map +1 -1
  187. package/dist/delivery-consumed-watch.d.ts +15 -3
  188. package/dist/delivery-consumed-watch.js +23 -1
  189. package/dist/delivery-consumed-watch.js.map +1 -1
  190. package/dist/delivery-outbox.d.ts +5 -0
  191. package/dist/delivery-outbox.js +32 -4
  192. package/dist/delivery-outbox.js.map +1 -1
  193. package/dist/delivery-reconciliation.d.ts +2 -42
  194. package/dist/delivery-reconciliation.js +2 -164
  195. package/dist/delivery-reconciliation.js.map +1 -1
  196. package/dist/doctor.js +19 -9
  197. package/dist/doctor.js.map +1 -1
  198. package/dist/e2e-isolation.js +5 -2
  199. package/dist/e2e-isolation.js.map +1 -1
  200. package/dist/fleet-context.d.ts +2 -2
  201. package/dist/fleet-control-audit.d.ts +1 -1
  202. package/dist/fleet-level-config.d.ts +1 -1
  203. package/dist/fleet-level-config.js +2 -0
  204. package/dist/fleet-level-config.js.map +1 -1
  205. package/dist/fleet-manager.d.ts +831 -7
  206. package/dist/fleet-manager.js +4894 -433
  207. package/dist/fleet-manager.js.map +1 -1
  208. package/dist/fleet-windows-runtime.d.ts +98 -0
  209. package/dist/fleet-windows-runtime.js +467 -0
  210. package/dist/fleet-windows-runtime.js.map +1 -0
  211. package/dist/general-binding.d.ts +85 -0
  212. package/dist/general-binding.js +298 -0
  213. package/dist/general-binding.js.map +1 -0
  214. package/dist/general-host-owner.d.ts +8 -0
  215. package/dist/general-host-owner.js +26 -0
  216. package/dist/general-host-owner.js.map +1 -0
  217. package/dist/general-instance.d.ts +7 -0
  218. package/dist/general-instance.js +20 -3
  219. package/dist/general-instance.js.map +1 -1
  220. package/dist/general-knowledge/skills/concepts/SKILL.md +97 -39
  221. package/dist/general-knowledge/skills/credential-profiles/SKILL.md +15 -2
  222. package/dist/general-knowledge/skills/delegation-playbook/SKILL.md +4 -1
  223. package/dist/general-knowledge/skills/fleet-config/SKILL.md +12 -0
  224. package/dist/general-knowledge/skills/fleet-health/SKILL.md +3 -3
  225. package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +4 -0
  226. package/dist/general-knowledge/skills/session-management/SKILL.md +1 -1
  227. package/dist/general-knowledge/skills/tui-effort/SKILL.md +10 -10
  228. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +31 -15
  229. package/dist/general-knowledge/steering/core-rules.md +7 -5
  230. package/dist/general-role.d.ts +5 -0
  231. package/dist/general-role.js +27 -0
  232. package/dist/general-role.js.map +1 -0
  233. package/dist/hub/admission.d.ts +28 -0
  234. package/dist/hub/admission.js +62 -0
  235. package/dist/hub/admission.js.map +1 -0
  236. package/dist/hub/attachments/limits.d.ts +20 -0
  237. package/dist/hub/attachments/limits.js +48 -0
  238. package/dist/hub/attachments/limits.js.map +1 -0
  239. package/dist/hub/attachments/store.d.ts +116 -0
  240. package/dist/hub/attachments/store.js +246 -0
  241. package/dist/hub/attachments/store.js.map +1 -0
  242. package/dist/hub/audit/index.d.ts +62 -0
  243. package/dist/hub/audit/index.js +344 -0
  244. package/dist/hub/audit/index.js.map +1 -0
  245. package/dist/hub/browser-certificate.d.ts +38 -0
  246. package/dist/hub/browser-certificate.js +247 -0
  247. package/dist/hub/browser-certificate.js.map +1 -0
  248. package/dist/hub/buttons-model.d.ts +9 -0
  249. package/dist/hub/buttons-model.js +42 -0
  250. package/dist/hub/buttons-model.js.map +1 -0
  251. package/dist/hub/buttons.d.ts +54 -0
  252. package/dist/hub/buttons.js +348 -0
  253. package/dist/hub/buttons.js.map +1 -0
  254. package/dist/hub/catalog.d.ts +74 -0
  255. package/dist/hub/catalog.js +380 -0
  256. package/dist/hub/catalog.js.map +1 -0
  257. package/dist/hub/client.d.ts +69 -0
  258. package/dist/hub/client.js +304 -0
  259. package/dist/hub/client.js.map +1 -0
  260. package/dist/hub/compose/member.d.ts +145 -0
  261. package/dist/hub/compose/member.js +458 -0
  262. package/dist/hub/compose/member.js.map +1 -0
  263. package/dist/hub/compose/server.d.ts +167 -0
  264. package/dist/hub/compose/server.js +477 -0
  265. package/dist/hub/compose/server.js.map +1 -0
  266. package/dist/hub/compose/storage.d.ts +5 -0
  267. package/dist/hub/compose/storage.js +28 -0
  268. package/dist/hub/compose/storage.js.map +1 -0
  269. package/dist/hub/compose/views.d.ts +12 -0
  270. package/dist/hub/compose/views.js +4 -0
  271. package/dist/hub/compose/views.js.map +1 -0
  272. package/dist/hub/db.d.ts +58 -0
  273. package/dist/hub/db.js +215 -0
  274. package/dist/hub/db.js.map +1 -0
  275. package/dist/hub/directory/config.d.ts +39 -0
  276. package/dist/hub/directory/config.js +108 -0
  277. package/dist/hub/directory/config.js.map +1 -0
  278. package/dist/hub/directory/directory.d.ts +25 -0
  279. package/dist/hub/directory/directory.js +526 -0
  280. package/dist/hub/directory/directory.js.map +1 -0
  281. package/dist/hub/directory/groups.d.ts +41 -0
  282. package/dist/hub/directory/groups.js +30 -0
  283. package/dist/hub/directory/groups.js.map +1 -0
  284. package/dist/hub/directory/index.d.ts +8 -0
  285. package/dist/hub/directory/index.js +4 -0
  286. package/dist/hub/directory/index.js.map +1 -0
  287. package/dist/hub/directory/profiles.d.ts +41 -0
  288. package/dist/hub/directory/profiles.js +90 -0
  289. package/dist/hub/directory/profiles.js.map +1 -0
  290. package/dist/hub/directory/types.d.ts +83 -0
  291. package/dist/hub/directory/types.js +14 -0
  292. package/dist/hub/directory/types.js.map +1 -0
  293. package/dist/hub/directory-response-owner.d.ts +38 -0
  294. package/dist/hub/directory-response-owner.js +191 -0
  295. package/dist/hub/directory-response-owner.js.map +1 -0
  296. package/dist/hub/enrollment-budget.d.ts +6 -0
  297. package/dist/hub/enrollment-budget.js +24 -0
  298. package/dist/hub/enrollment-budget.js.map +1 -0
  299. package/dist/hub/execution/cli-provider.d.ts +23 -0
  300. package/dist/hub/execution/cli-provider.js +341 -0
  301. package/dist/hub/execution/cli-provider.js.map +1 -0
  302. package/dist/hub/execution/index.d.ts +13 -0
  303. package/dist/hub/execution/index.js +8 -0
  304. package/dist/hub/execution/index.js.map +1 -0
  305. package/dist/hub/execution/model-broker.d.ts +24 -0
  306. package/dist/hub/execution/model-broker.js +208 -0
  307. package/dist/hub/execution/model-broker.js.map +1 -0
  308. package/dist/hub/execution/provider-setup.d.ts +11 -0
  309. package/dist/hub/execution/provider-setup.js +21 -0
  310. package/dist/hub/execution/provider-setup.js.map +1 -0
  311. package/dist/hub/execution/sandbox-runner.d.ts +1 -0
  312. package/dist/hub/execution/sandbox-runner.js +221 -0
  313. package/dist/hub/execution/sandbox-runner.js.map +1 -0
  314. package/dist/hub/execution/service.d.ts +136 -0
  315. package/dist/hub/execution/service.js +459 -0
  316. package/dist/hub/execution/service.js.map +1 -0
  317. package/dist/hub/execution/store.d.ts +61 -0
  318. package/dist/hub/execution/store.js +182 -0
  319. package/dist/hub/execution/store.js.map +1 -0
  320. package/dist/hub/execution/views.d.ts +20 -0
  321. package/dist/hub/execution/views.js +48 -0
  322. package/dist/hub/execution/views.js.map +1 -0
  323. package/dist/hub/group-policy/admin-api.d.ts +30 -0
  324. package/dist/hub/group-policy/admin-api.js +83 -0
  325. package/dist/hub/group-policy/admin-api.js.map +1 -0
  326. package/dist/hub/group-policy/admin-context.d.ts +23 -0
  327. package/dist/hub/group-policy/admin-context.js +52 -0
  328. package/dist/hub/group-policy/admin-context.js.map +1 -0
  329. package/dist/hub/group-policy/admin-control.d.ts +34 -0
  330. package/dist/hub/group-policy/admin-control.js +258 -0
  331. package/dist/hub/group-policy/admin-control.js.map +1 -0
  332. package/dist/hub/group-policy/admin-dto.d.ts +249 -0
  333. package/dist/hub/group-policy/admin-dto.js +55 -0
  334. package/dist/hub/group-policy/admin-dto.js.map +1 -0
  335. package/dist/hub/group-policy/admin-facts.d.ts +17 -0
  336. package/dist/hub/group-policy/admin-facts.js +33 -0
  337. package/dist/hub/group-policy/admin-facts.js.map +1 -0
  338. package/dist/hub/group-policy/admin-impact.d.ts +51 -0
  339. package/dist/hub/group-policy/admin-impact.js +88 -0
  340. package/dist/hub/group-policy/admin-impact.js.map +1 -0
  341. package/dist/hub/group-policy/admin-inventory.d.ts +24 -0
  342. package/dist/hub/group-policy/admin-inventory.js +72 -0
  343. package/dist/hub/group-policy/admin-inventory.js.map +1 -0
  344. package/dist/hub/group-policy/admin-read.d.ts +21 -0
  345. package/dist/hub/group-policy/admin-read.js +95 -0
  346. package/dist/hub/group-policy/admin-read.js.map +1 -0
  347. package/dist/hub/group-policy/authorization.d.ts +65 -0
  348. package/dist/hub/group-policy/authorization.js +315 -0
  349. package/dist/hub/group-policy/authorization.js.map +1 -0
  350. package/dist/hub/group-policy/impact-inventory.d.ts +21 -0
  351. package/dist/hub/group-policy/impact-inventory.js +75 -0
  352. package/dist/hub/group-policy/impact-inventory.js.map +1 -0
  353. package/dist/hub/group-policy/model.d.ts +56 -0
  354. package/dist/hub/group-policy/model.js +46 -0
  355. package/dist/hub/group-policy/model.js.map +1 -0
  356. package/dist/hub/group-policy/resources.d.ts +72 -0
  357. package/dist/hub/group-policy/resources.js +260 -0
  358. package/dist/hub/group-policy/resources.js.map +1 -0
  359. package/dist/hub/group-policy/store.d.ts +69 -0
  360. package/dist/hub/group-policy/store.js +210 -0
  361. package/dist/hub/group-policy/store.js.map +1 -0
  362. package/dist/hub/group-policy/welcome.d.ts +36 -0
  363. package/dist/hub/group-policy/welcome.js +55 -0
  364. package/dist/hub/group-policy/welcome.js.map +1 -0
  365. package/dist/hub/http/compose.d.ts +24 -0
  366. package/dist/hub/http/compose.js +739 -0
  367. package/dist/hub/http/compose.js.map +1 -0
  368. package/dist/hub/http/core.d.ts +71 -0
  369. package/dist/hub/http/core.js +266 -0
  370. package/dist/hub/http/core.js.map +1 -0
  371. package/dist/hub/http/deps.d.ts +79 -0
  372. package/dist/hub/http/deps.js +2 -0
  373. package/dist/hub/http/deps.js.map +1 -0
  374. package/dist/hub/http/schema.d.ts +14 -0
  375. package/dist/hub/http/schema.js +84 -0
  376. package/dist/hub/http/schema.js.map +1 -0
  377. package/dist/hub/identity.d.ts +32 -0
  378. package/dist/hub/identity.js +80 -0
  379. package/dist/hub/identity.js.map +1 -0
  380. package/dist/hub/init/browser-certificate.d.ts +14 -0
  381. package/dist/hub/init/browser-certificate.js +99 -0
  382. package/dist/hub/init/browser-certificate.js.map +1 -0
  383. package/dist/hub/init/browser-tls.d.ts +18 -0
  384. package/dist/hub/init/browser-tls.js +62 -0
  385. package/dist/hub/init/browser-tls.js.map +1 -0
  386. package/dist/hub/init/cli.d.ts +3 -0
  387. package/dist/hub/init/cli.js +83 -0
  388. package/dist/hub/init/cli.js.map +1 -0
  389. package/dist/hub/init/directory-certificate.d.ts +24 -0
  390. package/dist/hub/init/directory-certificate.js +229 -0
  391. package/dist/hub/init/directory-certificate.js.map +1 -0
  392. package/dist/hub/init/existing-fleet.d.ts +6 -0
  393. package/dist/hub/init/existing-fleet.js +58 -0
  394. package/dist/hub/init/existing-fleet.js.map +1 -0
  395. package/dist/hub/init/handoff.d.ts +8 -0
  396. package/dist/hub/init/handoff.js +36 -0
  397. package/dist/hub/init/handoff.js.map +1 -0
  398. package/dist/hub/init/identity.d.ts +5 -0
  399. package/dist/hub/init/identity.js +24 -0
  400. package/dist/hub/init/identity.js.map +1 -0
  401. package/dist/hub/init/initializer.d.ts +34 -0
  402. package/dist/hub/init/initializer.js +504 -0
  403. package/dist/hub/init/initializer.js.map +1 -0
  404. package/dist/hub/init/inventory.d.ts +17 -0
  405. package/dist/hub/init/inventory.js +33 -0
  406. package/dist/hub/init/inventory.js.map +1 -0
  407. package/dist/hub/init/layout.d.ts +32 -0
  408. package/dist/hub/init/layout.js +53 -0
  409. package/dist/hub/init/layout.js.map +1 -0
  410. package/dist/hub/init/network.d.ts +18 -0
  411. package/dist/hub/init/network.js +104 -0
  412. package/dist/hub/init/network.js.map +1 -0
  413. package/dist/hub/init/plan-digest.d.ts +5 -0
  414. package/dist/hub/init/plan-digest.js +47 -0
  415. package/dist/hub/init/plan-digest.js.map +1 -0
  416. package/dist/hub/init/prompt.d.ts +26 -0
  417. package/dist/hub/init/prompt.js +110 -0
  418. package/dist/hub/init/prompt.js.map +1 -0
  419. package/dist/hub/init/secret-file.d.ts +1 -0
  420. package/dist/hub/init/secret-file.js +59 -0
  421. package/dist/hub/init/secret-file.js.map +1 -0
  422. package/dist/hub/init/text.d.ts +127 -0
  423. package/dist/hub/init/text.js +247 -0
  424. package/dist/hub/init/text.js.map +1 -0
  425. package/dist/hub/init/types.d.ts +142 -0
  426. package/dist/hub/init/types.js +9 -0
  427. package/dist/hub/init/types.js.map +1 -0
  428. package/dist/hub/init/web-audit-import.d.ts +12 -0
  429. package/dist/hub/init/web-audit-import.js +39 -0
  430. package/dist/hub/init/web-audit-import.js.map +1 -0
  431. package/dist/hub/init/web-audit.d.ts +30 -0
  432. package/dist/hub/init/web-audit.js +42 -0
  433. package/dist/hub/init/web-audit.js.map +1 -0
  434. package/dist/hub/init/web-error.d.ts +6 -0
  435. package/dist/hub/init/web-error.js +8 -0
  436. package/dist/hub/init/web-error.js.map +1 -0
  437. package/dist/hub/init/web-http.d.ts +9 -0
  438. package/dist/hub/init/web-http.js +103 -0
  439. package/dist/hub/init/web-http.js.map +1 -0
  440. package/dist/hub/init/web.d.ts +118 -0
  441. package/dist/hub/init/web.js +428 -0
  442. package/dist/hub/init/web.js.map +1 -0
  443. package/dist/hub/init/wizard.d.ts +34 -0
  444. package/dist/hub/init/wizard.js +552 -0
  445. package/dist/hub/init/wizard.js.map +1 -0
  446. package/dist/hub/initialization.d.ts +23 -0
  447. package/dist/hub/initialization.js +28 -0
  448. package/dist/hub/initialization.js.map +1 -0
  449. package/dist/hub/join/client.d.ts +35 -0
  450. package/dist/hub/join/client.js +112 -0
  451. package/dist/hub/join/client.js.map +1 -0
  452. package/dist/hub/join/descriptor.d.ts +45 -0
  453. package/dist/hub/join/descriptor.js +52 -0
  454. package/dist/hub/join/descriptor.js.map +1 -0
  455. package/dist/hub/join/fleet-authority.d.ts +2 -0
  456. package/dist/hub/join/fleet-authority.js +3 -0
  457. package/dist/hub/join/fleet-authority.js.map +1 -0
  458. package/dist/hub/join/http.d.ts +8 -0
  459. package/dist/hub/join/http.js +112 -0
  460. package/dist/hub/join/http.js.map +1 -0
  461. package/dist/hub/join/invitation.d.ts +28 -0
  462. package/dist/hub/join/invitation.js +28 -0
  463. package/dist/hub/join/invitation.js.map +1 -0
  464. package/dist/hub/join/local-journal.d.ts +84 -0
  465. package/dist/hub/join/local-journal.js +65 -0
  466. package/dist/hub/join/local-journal.js.map +1 -0
  467. package/dist/hub/join/local.d.ts +116 -0
  468. package/dist/hub/join/local.js +419 -0
  469. package/dist/hub/join/local.js.map +1 -0
  470. package/dist/hub/join/private.d.ts +3 -0
  471. package/dist/hub/join/private.js +46 -0
  472. package/dist/hub/join/private.js.map +1 -0
  473. package/dist/hub/join/protocol.d.ts +69 -0
  474. package/dist/hub/join/protocol.js +96 -0
  475. package/dist/hub/join/protocol.js.map +1 -0
  476. package/dist/hub/join/receipt.d.ts +42 -0
  477. package/dist/hub/join/receipt.js +75 -0
  478. package/dist/hub/join/receipt.js.map +1 -0
  479. package/dist/hub/join/service.d.ts +177 -0
  480. package/dist/hub/join/service.js +564 -0
  481. package/dist/hub/join/service.js.map +1 -0
  482. package/dist/hub/join/store.d.ts +97 -0
  483. package/dist/hub/join/store.js +87 -0
  484. package/dist/hub/join/store.js.map +1 -0
  485. package/dist/hub/join/trust.d.ts +13 -0
  486. package/dist/hub/join/trust.js +68 -0
  487. package/dist/hub/join/trust.js.map +1 -0
  488. package/dist/hub/member/agent-mode.d.ts +6 -0
  489. package/dist/hub/member/agent-mode.js +23 -0
  490. package/dist/hub/member/agent-mode.js.map +1 -0
  491. package/dist/hub/member/attachments.d.ts +29 -0
  492. package/dist/hub/member/attachments.js +107 -0
  493. package/dist/hub/member/attachments.js.map +1 -0
  494. package/dist/hub/member/exposure-api.d.ts +87 -0
  495. package/dist/hub/member/exposure-api.js +64 -0
  496. package/dist/hub/member/exposure-api.js.map +1 -0
  497. package/dist/hub/member/exposures.d.ts +123 -0
  498. package/dist/hub/member/exposures.js +282 -0
  499. package/dist/hub/member/exposures.js.map +1 -0
  500. package/dist/hub/member/pairing-api.d.ts +87 -0
  501. package/dist/hub/member/pairing-api.js +391 -0
  502. package/dist/hub/member/pairing-api.js.map +1 -0
  503. package/dist/hub/member/pairing-notices.d.ts +18 -0
  504. package/dist/hub/member/pairing-notices.js +60 -0
  505. package/dist/hub/member/pairing-notices.js.map +1 -0
  506. package/dist/hub/member/quota.d.ts +20 -0
  507. package/dist/hub/member/quota.js +98 -0
  508. package/dist/hub/member/quota.js.map +1 -0
  509. package/dist/hub/member-journal.d.ts +104 -0
  510. package/dist/hub/member-journal.js +336 -0
  511. package/dist/hub/member-journal.js.map +1 -0
  512. package/dist/hub/member-reconciliation.d.ts +14 -0
  513. package/dist/hub/member-reconciliation.js +97 -0
  514. package/dist/hub/member-reconciliation.js.map +1 -0
  515. package/dist/hub/mount.d.ts +48 -0
  516. package/dist/hub/mount.js +146 -0
  517. package/dist/hub/mount.js.map +1 -0
  518. package/dist/hub/pairing-client.d.ts +17 -0
  519. package/dist/hub/pairing-client.js +108 -0
  520. package/dist/hub/pairing-client.js.map +1 -0
  521. package/dist/hub/pairing-notices.d.ts +47 -0
  522. package/dist/hub/pairing-notices.js +246 -0
  523. package/dist/hub/pairing-notices.js.map +1 -0
  524. package/dist/hub/pairing.d.ts +105 -0
  525. package/dist/hub/pairing.js +514 -0
  526. package/dist/hub/pairing.js.map +1 -0
  527. package/dist/hub/policy.d.ts +65 -0
  528. package/dist/hub/policy.js +154 -0
  529. package/dist/hub/policy.js.map +1 -0
  530. package/dist/hub/preview.d.ts +32 -0
  531. package/dist/hub/preview.js +64 -0
  532. package/dist/hub/preview.js.map +1 -0
  533. package/dist/hub/private-files.d.ts +5 -0
  534. package/dist/hub/private-files.js +44 -0
  535. package/dist/hub/private-files.js.map +1 -0
  536. package/dist/hub/profile.d.ts +59 -0
  537. package/dist/hub/profile.js +73 -0
  538. package/dist/hub/profile.js.map +1 -0
  539. package/dist/hub/protocol.d.ts +840 -0
  540. package/dist/hub/protocol.js +100 -0
  541. package/dist/hub/protocol.js.map +1 -0
  542. package/dist/hub/quota.d.ts +24 -0
  543. package/dist/hub/quota.js +112 -0
  544. package/dist/hub/quota.js.map +1 -0
  545. package/dist/hub/representative.d.ts +141 -0
  546. package/dist/hub/representative.js +528 -0
  547. package/dist/hub/representative.js.map +1 -0
  548. package/dist/hub/retention.d.ts +17 -0
  549. package/dist/hub/retention.js +45 -0
  550. package/dist/hub/retention.js.map +1 -0
  551. package/dist/hub/room-read-pacer.d.ts +14 -0
  552. package/dist/hub/room-read-pacer.js +51 -0
  553. package/dist/hub/room-read-pacer.js.map +1 -0
  554. package/dist/hub/rooms.d.ts +127 -0
  555. package/dist/hub/rooms.js +597 -0
  556. package/dist/hub/rooms.js.map +1 -0
  557. package/dist/hub/runtime.d.ts +155 -0
  558. package/dist/hub/runtime.js +651 -0
  559. package/dist/hub/runtime.js.map +1 -0
  560. package/dist/hub/server.d.ts +61 -0
  561. package/dist/hub/server.js +235 -0
  562. package/dist/hub/server.js.map +1 -0
  563. package/dist/hub/service-start.d.ts +17 -0
  564. package/dist/hub/service-start.js +109 -0
  565. package/dist/hub/service-start.js.map +1 -0
  566. package/dist/hub/session-directory-transition.d.ts +48 -0
  567. package/dist/hub/session-directory-transition.js +118 -0
  568. package/dist/hub/session-directory-transition.js.map +1 -0
  569. package/dist/hub/session-epoch.d.ts +16 -0
  570. package/dist/hub/session-epoch.js +50 -0
  571. package/dist/hub/session-epoch.js.map +1 -0
  572. package/dist/hub/sessions.d.ts +66 -0
  573. package/dist/hub/sessions.js +217 -0
  574. package/dist/hub/sessions.js.map +1 -0
  575. package/dist/hub/settings-api.d.ts +50 -0
  576. package/dist/hub/settings-api.js +92 -0
  577. package/dist/hub/settings-api.js.map +1 -0
  578. package/dist/hub/settings-commit.d.ts +102 -0
  579. package/dist/hub/settings-commit.js +522 -0
  580. package/dist/hub/settings-commit.js.map +1 -0
  581. package/dist/hub/settings-directory-ca.d.ts +31 -0
  582. package/dist/hub/settings-directory-ca.js +115 -0
  583. package/dist/hub/settings-directory-ca.js.map +1 -0
  584. package/dist/hub/settings-directory-control.d.ts +58 -0
  585. package/dist/hub/settings-directory-control.js +117 -0
  586. package/dist/hub/settings-directory-control.js.map +1 -0
  587. package/dist/hub/settings-directory-decision.d.ts +465 -0
  588. package/dist/hub/settings-directory-decision.js +322 -0
  589. package/dist/hub/settings-directory-decision.js.map +1 -0
  590. package/dist/hub/settings-directory-host-http.d.ts +9 -0
  591. package/dist/hub/settings-directory-host-http.js +75 -0
  592. package/dist/hub/settings-directory-host-http.js.map +1 -0
  593. package/dist/hub/settings-directory-host-notice-http.d.ts +9 -0
  594. package/dist/hub/settings-directory-host-notice-http.js +78 -0
  595. package/dist/hub/settings-directory-host-notice-http.js.map +1 -0
  596. package/dist/hub/settings-directory-host-notices.d.ts +11 -0
  597. package/dist/hub/settings-directory-host-notices.js +39 -0
  598. package/dist/hub/settings-directory-host-notices.js.map +1 -0
  599. package/dist/hub/settings-directory-http.d.ts +33 -0
  600. package/dist/hub/settings-directory-http.js +109 -0
  601. package/dist/hub/settings-directory-http.js.map +1 -0
  602. package/dist/hub/settings-directory-mount.d.ts +24 -0
  603. package/dist/hub/settings-directory-mount.js +77 -0
  604. package/dist/hub/settings-directory-mount.js.map +1 -0
  605. package/dist/hub/settings-directory-notices.d.ts +61 -0
  606. package/dist/hub/settings-directory-notices.js +132 -0
  607. package/dist/hub/settings-directory-notices.js.map +1 -0
  608. package/dist/hub/settings-directory-proof.d.ts +77 -0
  609. package/dist/hub/settings-directory-proof.js +313 -0
  610. package/dist/hub/settings-directory-proof.js.map +1 -0
  611. package/dist/hub/settings-directory-recovery-intent.d.ts +13 -0
  612. package/dist/hub/settings-directory-recovery-intent.js +29 -0
  613. package/dist/hub/settings-directory-recovery-intent.js.map +1 -0
  614. package/dist/hub/settings-directory-recovery.d.ts +37 -0
  615. package/dist/hub/settings-directory-recovery.js +173 -0
  616. package/dist/hub/settings-directory-recovery.js.map +1 -0
  617. package/dist/hub/settings-directory-runtime.d.ts +17 -0
  618. package/dist/hub/settings-directory-runtime.js +2 -0
  619. package/dist/hub/settings-directory-runtime.js.map +1 -0
  620. package/dist/hub/settings-directory-save.d.ts +37 -0
  621. package/dist/hub/settings-directory-save.js +175 -0
  622. package/dist/hub/settings-directory-save.js.map +1 -0
  623. package/dist/hub/socket.d.ts +24 -0
  624. package/dist/hub/socket.js +79 -0
  625. package/dist/hub/socket.js.map +1 -0
  626. package/dist/hub/store.d.ts +87 -0
  627. package/dist/hub/store.js +92 -0
  628. package/dist/hub/store.js.map +1 -0
  629. package/dist/hub/tls.d.ts +31 -0
  630. package/dist/hub/tls.js +135 -0
  631. package/dist/hub/tls.js.map +1 -0
  632. package/dist/hub/types.d.ts +416 -0
  633. package/dist/hub/types.js +2 -0
  634. package/dist/hub/types.js.map +1 -0
  635. package/dist/hub/validation.d.ts +33 -0
  636. package/dist/hub/validation.js +136 -0
  637. package/dist/hub/validation.js.map +1 -0
  638. package/dist/hub/version-floor.d.ts +10 -0
  639. package/dist/hub/version-floor.js +45 -0
  640. package/dist/hub/version-floor.js.map +1 -0
  641. package/dist/hub-browser-certificate-policy.d.ts +31 -0
  642. package/dist/hub-browser-certificate-policy.js +25 -0
  643. package/dist/hub-browser-certificate-policy.js.map +1 -0
  644. package/dist/hub-host-settings.d.ts +48 -0
  645. package/dist/hub-host-settings.js +85 -0
  646. package/dist/hub-host-settings.js.map +1 -0
  647. package/dist/hub-membership-settings.d.ts +6 -0
  648. package/dist/hub-membership-settings.js +21 -0
  649. package/dist/hub-membership-settings.js.map +1 -0
  650. package/dist/hub-mode.d.ts +15 -0
  651. package/dist/hub-mode.js +17 -0
  652. package/dist/hub-mode.js.map +1 -0
  653. package/dist/hub-pairing-summary.d.ts +48 -0
  654. package/dist/hub-pairing-summary.js +36 -0
  655. package/dist/hub-pairing-summary.js.map +1 -0
  656. package/dist/hub-report-target.d.ts +32 -0
  657. package/dist/hub-report-target.js +33 -0
  658. package/dist/hub-report-target.js.map +1 -0
  659. package/dist/hub-retention-policy.d.ts +14 -0
  660. package/dist/hub-retention-policy.js +15 -0
  661. package/dist/hub-retention-policy.js.map +1 -0
  662. package/dist/instance-config-impact.js +11 -3
  663. package/dist/instance-config-impact.js.map +1 -1
  664. package/dist/instance-lifecycle.d.ts +52 -5
  665. package/dist/instance-lifecycle.js +489 -198
  666. package/dist/instance-lifecycle.js.map +1 -1
  667. package/dist/instructions.d.ts +2 -0
  668. package/dist/instructions.js +6 -0
  669. package/dist/instructions.js.map +1 -1
  670. package/dist/kiro-history-scan.d.ts +26 -0
  671. package/dist/kiro-history-scan.js +141 -0
  672. package/dist/kiro-history-scan.js.map +1 -0
  673. package/dist/kiro-history-worker.d.ts +1 -0
  674. package/dist/kiro-history-worker.js +9 -0
  675. package/dist/kiro-history-worker.js.map +1 -0
  676. package/dist/kiro-history.d.ts +20 -0
  677. package/dist/kiro-history.js +96 -0
  678. package/dist/kiro-history.js.map +1 -0
  679. package/dist/kiro-usage-run.d.ts +2 -0
  680. package/dist/kiro-usage-run.js +4 -1
  681. package/dist/kiro-usage-run.js.map +1 -1
  682. package/dist/launchd-service-domain.d.ts +5 -0
  683. package/dist/launchd-service-domain.js +21 -0
  684. package/dist/launchd-service-domain.js.map +1 -0
  685. package/dist/local-pane-endpoint.d.ts +46 -0
  686. package/dist/local-pane-endpoint.js +189 -0
  687. package/dist/local-pane-endpoint.js.map +1 -0
  688. package/dist/local-pane-launcher.d.ts +2 -0
  689. package/dist/local-pane-launcher.js +38 -0
  690. package/dist/local-pane-launcher.js.map +1 -0
  691. package/dist/local-pane-stage.ps1 +101 -0
  692. package/dist/locale.js +246 -34
  693. package/dist/locale.js.map +1 -1
  694. package/dist/log-service.d.ts +28 -0
  695. package/dist/log-service.js +29 -0
  696. package/dist/log-service.js.map +1 -1
  697. package/dist/logger.d.ts +16 -2
  698. package/dist/logger.js +346 -66
  699. package/dist/logger.js.map +1 -1
  700. package/dist/login-controller.d.ts +14 -1
  701. package/dist/login-controller.js +31 -1
  702. package/dist/login-controller.js.map +1 -1
  703. package/dist/login-flows.d.ts +21 -8
  704. package/dist/login-flows.js +40 -18
  705. package/dist/login-flows.js.map +1 -1
  706. package/dist/login-manager.js +25 -4
  707. package/dist/login-manager.js.map +1 -1
  708. package/dist/login-window-lock.d.ts +2 -1
  709. package/dist/login-window-lock.js.map +1 -1
  710. package/dist/ls-rows.d.ts +1 -1
  711. package/dist/ls-rows.js +3 -4
  712. package/dist/ls-rows.js.map +1 -1
  713. package/dist/machine-accounts.d.ts +110 -0
  714. package/dist/machine-accounts.js +229 -0
  715. package/dist/machine-accounts.js.map +1 -0
  716. package/dist/machine-signins.d.ts +89 -0
  717. package/dist/machine-signins.js +182 -0
  718. package/dist/machine-signins.js.map +1 -0
  719. package/dist/missed-offline.d.ts +25 -0
  720. package/dist/missed-offline.js +79 -0
  721. package/dist/missed-offline.js.map +1 -0
  722. package/dist/model-catalog-defaults.d.ts +14 -0
  723. package/dist/model-catalog-defaults.js +20 -0
  724. package/dist/model-catalog-defaults.js.map +1 -0
  725. package/dist/muse-usage-relay.d.ts +2 -0
  726. package/dist/muse-usage-relay.js +5 -3
  727. package/dist/muse-usage-relay.js.map +1 -1
  728. package/dist/native-agent-admission.d.ts +7 -0
  729. package/dist/native-agent-admission.js +26 -0
  730. package/dist/native-agent-admission.js.map +1 -0
  731. package/dist/native-daemon-client.d.ts +13 -0
  732. package/dist/native-daemon-client.js +28 -0
  733. package/dist/native-daemon-client.js.map +1 -0
  734. package/dist/native-instance-api.d.ts +13 -0
  735. package/dist/native-instance-api.js +217 -0
  736. package/dist/native-instance-api.js.map +1 -0
  737. package/dist/native-instance-input.d.ts +87 -0
  738. package/dist/native-instance-input.js +59 -0
  739. package/dist/native-instance-input.js.map +1 -0
  740. package/dist/native-instance-registry.d.ts +38 -0
  741. package/dist/native-instance-registry.js +129 -0
  742. package/dist/native-instance-registry.js.map +1 -0
  743. package/dist/native-mcp.d.ts +43 -0
  744. package/dist/native-mcp.js +291 -0
  745. package/dist/native-mcp.js.map +1 -0
  746. package/dist/native-model-catalog.d.ts +5 -0
  747. package/dist/native-model-catalog.js +76 -0
  748. package/dist/native-model-catalog.js.map +1 -0
  749. package/dist/native-pane-crash-budget.d.ts +20 -0
  750. package/dist/native-pane-crash-budget.js +60 -0
  751. package/dist/native-pane-crash-budget.js.map +1 -0
  752. package/dist/native-pane-create.d.ts +26 -0
  753. package/dist/native-pane-create.js +53 -0
  754. package/dist/native-pane-create.js.map +1 -0
  755. package/dist/native-pane-lifecycle.d.ts +73 -0
  756. package/dist/native-pane-lifecycle.js +239 -0
  757. package/dist/native-pane-lifecycle.js.map +1 -0
  758. package/dist/native-pane-manager.d.ts +59 -0
  759. package/dist/native-pane-manager.js +592 -0
  760. package/dist/native-pane-manager.js.map +1 -0
  761. package/dist/native-pane-output-log.d.ts +15 -0
  762. package/dist/native-pane-output-log.js +108 -0
  763. package/dist/native-pane-output-log.js.map +1 -0
  764. package/dist/native-pane-reconciliation.d.ts +4 -0
  765. package/dist/native-pane-reconciliation.js +40 -0
  766. package/dist/native-pane-reconciliation.js.map +1 -0
  767. package/dist/native-pane-recovery.d.ts +12 -0
  768. package/dist/native-pane-recovery.js +10 -0
  769. package/dist/native-pane-recovery.js.map +1 -0
  770. package/dist/native-pane-tools.d.ts +2 -0
  771. package/dist/native-pane-tools.js +14 -0
  772. package/dist/native-pane-tools.js.map +1 -0
  773. package/dist/needs-you-hub.d.ts +14 -1
  774. package/dist/needs-you-hub.js +57 -8
  775. package/dist/needs-you-hub.js.map +1 -1
  776. package/dist/needs-you.d.ts +92 -2
  777. package/dist/needs-you.js +54 -3
  778. package/dist/needs-you.js.map +1 -1
  779. package/dist/office-levels.d.ts +4 -3
  780. package/dist/office-levels.js +3 -3
  781. package/dist/office-levels.js.map +1 -1
  782. package/dist/office-share-page.js +3 -3
  783. package/dist/office-share-page.js.map +1 -1
  784. package/dist/office-share.d.ts +11 -0
  785. package/dist/office-share.js +14 -0
  786. package/dist/office-share.js.map +1 -1
  787. package/dist/office-talk.d.ts +26 -0
  788. package/dist/office-talk.js +50 -0
  789. package/dist/office-talk.js.map +1 -0
  790. package/dist/outbound-handlers.d.ts +30 -2
  791. package/dist/outbound-handlers.js +156 -18
  792. package/dist/outbound-handlers.js.map +1 -1
  793. package/dist/outbound-schemas.d.ts +94 -1
  794. package/dist/outbound-schemas.js +44 -16
  795. package/dist/outbound-schemas.js.map +1 -1
  796. package/dist/pane-port.d.ts +118 -0
  797. package/dist/pane-port.js +2 -0
  798. package/dist/pane-port.js.map +1 -0
  799. package/dist/pane-quota-history.d.ts +9 -0
  800. package/dist/pane-quota-history.js +67 -0
  801. package/dist/pane-quota-history.js.map +1 -0
  802. package/dist/pause-marker.d.ts +1 -1
  803. package/dist/pause-marker.js +1 -1
  804. package/dist/pause-marker.js.map +1 -1
  805. package/dist/platform-general.d.ts +46 -0
  806. package/dist/platform-general.js +91 -0
  807. package/dist/platform-general.js.map +1 -0
  808. package/dist/profile-signins.d.ts +107 -0
  809. package/dist/profile-signins.js +249 -0
  810. package/dist/profile-signins.js.map +1 -0
  811. package/dist/public-web-gateway.js +16 -0
  812. package/dist/public-web-gateway.js.map +1 -1
  813. package/dist/public-web-link.d.ts +11 -0
  814. package/dist/public-web-link.js +13 -0
  815. package/dist/public-web-link.js.map +1 -1
  816. package/dist/quickstart-api.js +11 -7
  817. package/dist/quickstart-api.js.map +1 -1
  818. package/dist/quickstart.d.ts +14 -0
  819. package/dist/quickstart.js +72 -4
  820. package/dist/quickstart.js.map +1 -1
  821. package/dist/quiet-run.d.ts +31 -0
  822. package/dist/quiet-run.js +50 -0
  823. package/dist/quiet-run.js.map +1 -0
  824. package/dist/quota-notice-config.d.ts +22 -0
  825. package/dist/quota-notice-config.js +41 -0
  826. package/dist/quota-notice-config.js.map +1 -0
  827. package/dist/quota-notice.d.ts +7 -0
  828. package/dist/quota-notice.js +40 -0
  829. package/dist/quota-notice.js.map +1 -1
  830. package/dist/reply-buttons-controller.d.ts +5 -1
  831. package/dist/reply-buttons-controller.js +18 -10
  832. package/dist/reply-buttons-controller.js.map +1 -1
  833. package/dist/reply-buttons.d.ts +6 -2
  834. package/dist/reply-buttons.js +7 -3
  835. package/dist/reply-buttons.js.map +1 -1
  836. package/dist/reply-polls.d.ts +2 -2
  837. package/dist/reply-polls.js +3 -3
  838. package/dist/reply-polls.js.map +1 -1
  839. package/dist/runtime-api.d.ts +23 -0
  840. package/dist/runtime-api.js +321 -0
  841. package/dist/runtime-api.js.map +1 -0
  842. package/dist/runtime-assets/@xterm/addon-serialize/LICENSE +21 -0
  843. package/dist/runtime-assets/@xterm/addon-serialize/lib/addon-serialize.js +2 -0
  844. package/dist/runtime-assets/@xterm/addon-serialize/lib/addon-serialize.mjs +19 -0
  845. package/dist/runtime-assets/@xterm/addon-serialize/package.json +29 -0
  846. package/dist/runtime-assets/@xterm/headless/LICENSE +21 -0
  847. package/dist/runtime-assets/@xterm/headless/lib-headless/xterm-headless.js +2 -0
  848. package/dist/runtime-assets/@xterm/headless/lib-headless/xterm-headless.mjs +46 -0
  849. package/dist/runtime-assets/@xterm/headless/package.json +29 -0
  850. package/dist/runtime-assets/node-pty/CONPTY-LICENSE +21 -0
  851. package/dist/runtime-assets/node-pty/CONPTY-NOTICE.md +503 -0
  852. package/dist/runtime-assets/node-pty/LICENSE +69 -0
  853. package/dist/runtime-assets/node-pty/lib/conpty_console_list_agent.js +16 -0
  854. package/dist/runtime-assets/node-pty/lib/eventEmitter2.js +47 -0
  855. package/dist/runtime-assets/node-pty/lib/index.js +52 -0
  856. package/dist/runtime-assets/node-pty/lib/interfaces.js +7 -0
  857. package/dist/runtime-assets/node-pty/lib/shared/conout.js +11 -0
  858. package/dist/runtime-assets/node-pty/lib/terminal.js +190 -0
  859. package/dist/runtime-assets/node-pty/lib/types.js +7 -0
  860. package/dist/runtime-assets/node-pty/lib/unixTerminal.js +346 -0
  861. package/dist/runtime-assets/node-pty/lib/utils.js +39 -0
  862. package/dist/runtime-assets/node-pty/lib/windowsConoutConnection.js +125 -0
  863. package/dist/runtime-assets/node-pty/lib/windowsPtyAgent.js +320 -0
  864. package/dist/runtime-assets/node-pty/lib/windowsTerminal.js +199 -0
  865. package/dist/runtime-assets/node-pty/lib/worker/conoutSocketWorker.js +22 -0
  866. package/dist/runtime-assets/node-pty/package.json +64 -0
  867. package/dist/runtime-assets/node-pty/prebuilds/win32-arm64/conpty/OpenConsole.exe +0 -0
  868. package/dist/runtime-assets/node-pty/prebuilds/win32-arm64/conpty/conpty.dll +0 -0
  869. package/dist/runtime-assets/node-pty/prebuilds/win32-arm64/conpty.node +0 -0
  870. package/dist/runtime-assets/node-pty/prebuilds/win32-arm64/conpty_console_list.node +0 -0
  871. package/dist/runtime-assets/node-pty/prebuilds/win32-x64/conpty/OpenConsole.exe +0 -0
  872. package/dist/runtime-assets/node-pty/prebuilds/win32-x64/conpty/conpty.dll +0 -0
  873. package/dist/runtime-assets/node-pty/prebuilds/win32-x64/conpty.node +0 -0
  874. package/dist/runtime-assets/node-pty/prebuilds/win32-x64/conpty_console_list.node +0 -0
  875. package/dist/runtime-build-info.d.ts +10 -0
  876. package/dist/runtime-build-info.js +64 -0
  877. package/dist/runtime-build-info.js.map +1 -0
  878. package/dist/runtime-bundle.d.ts +22 -0
  879. package/dist/runtime-bundle.js +158 -0
  880. package/dist/runtime-bundle.js.map +1 -0
  881. package/dist/runtime-cli-install.d.ts +155 -0
  882. package/dist/runtime-cli-install.js +675 -0
  883. package/dist/runtime-cli-install.js.map +1 -0
  884. package/dist/runtime-cli.d.ts +14 -0
  885. package/dist/runtime-cli.js +416 -0
  886. package/dist/runtime-cli.js.map +1 -0
  887. package/dist/runtime-client-store.d.ts +75 -0
  888. package/dist/runtime-client-store.js +372 -0
  889. package/dist/runtime-client-store.js.map +1 -0
  890. package/dist/runtime-client.d.ts +236 -0
  891. package/dist/runtime-client.js +1267 -0
  892. package/dist/runtime-client.js.map +1 -0
  893. package/dist/runtime-connection.d.ts +22 -0
  894. package/dist/runtime-connection.js +93 -0
  895. package/dist/runtime-connection.js.map +1 -0
  896. package/dist/runtime-coordinator.d.ts +107 -0
  897. package/dist/runtime-coordinator.js +1180 -0
  898. package/dist/runtime-coordinator.js.map +1 -0
  899. package/dist/runtime-credential-profiles.d.ts +89 -0
  900. package/dist/runtime-credential-profiles.js +304 -0
  901. package/dist/runtime-credential-profiles.js.map +1 -0
  902. package/dist/runtime-general-protocol.d.ts +22 -0
  903. package/dist/runtime-general-protocol.js +57 -0
  904. package/dist/runtime-general-protocol.js.map +1 -0
  905. package/dist/runtime-general-workspace.d.ts +17 -0
  906. package/dist/runtime-general-workspace.js +213 -0
  907. package/dist/runtime-general-workspace.js.map +1 -0
  908. package/dist/runtime-install.d.ts +50 -0
  909. package/dist/runtime-install.js +189 -0
  910. package/dist/runtime-install.js.map +1 -0
  911. package/dist/runtime-pane-assets.d.ts +17 -0
  912. package/dist/runtime-pane-assets.js +23 -0
  913. package/dist/runtime-pane-assets.js.map +1 -0
  914. package/dist/runtime-pane-boot.d.ts +9 -0
  915. package/dist/runtime-pane-boot.js +47 -0
  916. package/dist/runtime-pane-boot.js.map +1 -0
  917. package/dist/runtime-pane-codex-index.d.ts +10 -0
  918. package/dist/runtime-pane-codex-index.js +151 -0
  919. package/dist/runtime-pane-codex-index.js.map +1 -0
  920. package/dist/runtime-pane-config.d.ts +16 -0
  921. package/dist/runtime-pane-config.js +54 -0
  922. package/dist/runtime-pane-config.js.map +1 -0
  923. package/dist/runtime-pane-host.d.ts +63 -0
  924. package/dist/runtime-pane-host.js +467 -0
  925. package/dist/runtime-pane-host.js.map +1 -0
  926. package/dist/runtime-pane-job-owner.d.ts +1 -0
  927. package/dist/runtime-pane-job-owner.js +29 -0
  928. package/dist/runtime-pane-job-owner.js.map +1 -0
  929. package/dist/runtime-pane-job.ps1 +116 -0
  930. package/dist/runtime-pane-link.d.ts +47 -0
  931. package/dist/runtime-pane-link.js +338 -0
  932. package/dist/runtime-pane-link.js.map +1 -0
  933. package/dist/runtime-pane-mcp-protocol.d.ts +32 -0
  934. package/dist/runtime-pane-mcp-protocol.js +39 -0
  935. package/dist/runtime-pane-mcp-protocol.js.map +1 -0
  936. package/dist/runtime-pane-mcp-relay.d.ts +18 -0
  937. package/dist/runtime-pane-mcp-relay.js +80 -0
  938. package/dist/runtime-pane-mcp-relay.js.map +1 -0
  939. package/dist/runtime-pane-mcp.d.ts +55 -0
  940. package/dist/runtime-pane-mcp.js +153 -0
  941. package/dist/runtime-pane-mcp.js.map +1 -0
  942. package/dist/runtime-pane-native.d.ts +75 -0
  943. package/dist/runtime-pane-native.js +114 -0
  944. package/dist/runtime-pane-native.js.map +1 -0
  945. package/dist/runtime-pane-output.d.ts +19 -0
  946. package/dist/runtime-pane-output.js +53 -0
  947. package/dist/runtime-pane-output.js.map +1 -0
  948. package/dist/runtime-pane-port.d.ts +144 -0
  949. package/dist/runtime-pane-port.js +574 -0
  950. package/dist/runtime-pane-port.js.map +1 -0
  951. package/dist/runtime-pane-private.d.ts +14 -0
  952. package/dist/runtime-pane-private.js +51 -0
  953. package/dist/runtime-pane-private.js.map +1 -0
  954. package/dist/runtime-pane-private.ps1 +14 -0
  955. package/dist/runtime-pane-process.d.ts +4 -0
  956. package/dist/runtime-pane-process.js +117 -0
  957. package/dist/runtime-pane-process.js.map +1 -0
  958. package/dist/runtime-pane-protocol.d.ts +182 -0
  959. package/dist/runtime-pane-protocol.js +217 -0
  960. package/dist/runtime-pane-protocol.js.map +1 -0
  961. package/dist/runtime-pane-quota-history.d.ts +6 -0
  962. package/dist/runtime-pane-quota-history.js +44 -0
  963. package/dist/runtime-pane-quota-history.js.map +1 -0
  964. package/dist/runtime-pane-screen.d.ts +19 -0
  965. package/dist/runtime-pane-screen.js +76 -0
  966. package/dist/runtime-pane-screen.js.map +1 -0
  967. package/dist/runtime-pane-service.d.ts +16 -0
  968. package/dist/runtime-pane-service.js +256 -0
  969. package/dist/runtime-pane-service.js.map +1 -0
  970. package/dist/runtime-pane-stdio-protocol.d.ts +54 -0
  971. package/dist/runtime-pane-stdio-protocol.js +94 -0
  972. package/dist/runtime-pane-stdio-protocol.js.map +1 -0
  973. package/dist/runtime-pane-stdio.d.ts +3 -0
  974. package/dist/runtime-pane-stdio.js +123 -0
  975. package/dist/runtime-pane-stdio.js.map +1 -0
  976. package/dist/runtime-pane-store.d.ts +43 -0
  977. package/dist/runtime-pane-store.js +176 -0
  978. package/dist/runtime-pane-store.js.map +1 -0
  979. package/dist/runtime-pane-transcript-protocol.d.ts +43 -0
  980. package/dist/runtime-pane-transcript-protocol.js +58 -0
  981. package/dist/runtime-pane-transcript-protocol.js.map +1 -0
  982. package/dist/runtime-pane-transcript.d.ts +50 -0
  983. package/dist/runtime-pane-transcript.js +666 -0
  984. package/dist/runtime-pane-transcript.js.map +1 -0
  985. package/dist/runtime-pane-worker.d.ts +1 -0
  986. package/dist/runtime-pane-worker.js +167 -0
  987. package/dist/runtime-pane-worker.js.map +1 -0
  988. package/dist/runtime-profile-ownership.d.ts +66 -0
  989. package/dist/runtime-profile-ownership.js +391 -0
  990. package/dist/runtime-profile-ownership.js.map +1 -0
  991. package/dist/runtime-protocol.d.ts +263 -0
  992. package/dist/runtime-protocol.js +89 -0
  993. package/dist/runtime-protocol.js.map +1 -0
  994. package/dist/runtime-remote-accounts.d.ts +197 -0
  995. package/dist/runtime-remote-accounts.js +663 -0
  996. package/dist/runtime-remote-accounts.js.map +1 -0
  997. package/dist/runtime-remote-setup.d.ts +105 -0
  998. package/dist/runtime-remote-setup.js +529 -0
  999. package/dist/runtime-remote-setup.js.map +1 -0
  1000. package/dist/runtime-signin-transport.d.ts +39 -0
  1001. package/dist/runtime-signin-transport.js +111 -0
  1002. package/dist/runtime-signin-transport.js.map +1 -0
  1003. package/dist/runtime-signin.d.ts +132 -0
  1004. package/dist/runtime-signin.js +290 -0
  1005. package/dist/runtime-signin.js.map +1 -0
  1006. package/dist/runtime-switches.d.ts +79 -0
  1007. package/dist/runtime-switches.js +90 -0
  1008. package/dist/runtime-switches.js.map +1 -0
  1009. package/dist/runtime-transcript-delta-reader.d.ts +23 -0
  1010. package/dist/runtime-transcript-delta-reader.js +74 -0
  1011. package/dist/runtime-transcript-delta-reader.js.map +1 -0
  1012. package/dist/runtime-transcript-source.d.ts +36 -0
  1013. package/dist/runtime-transcript-source.js +189 -0
  1014. package/dist/runtime-transcript-source.js.map +1 -0
  1015. package/dist/runtime-update-activity.d.ts +21 -0
  1016. package/dist/runtime-update-activity.js +51 -0
  1017. package/dist/runtime-update-activity.js.map +1 -0
  1018. package/dist/runtime-update-artifact.d.ts +31 -0
  1019. package/dist/runtime-update-artifact.js +252 -0
  1020. package/dist/runtime-update-artifact.js.map +1 -0
  1021. package/dist/runtime-update-attention.d.ts +4 -0
  1022. package/dist/runtime-update-attention.js +11 -0
  1023. package/dist/runtime-update-attention.js.map +1 -0
  1024. package/dist/runtime-update-controller.d.ts +75 -0
  1025. package/dist/runtime-update-controller.js +691 -0
  1026. package/dist/runtime-update-controller.js.map +1 -0
  1027. package/dist/runtime-update-install.d.ts +31 -0
  1028. package/dist/runtime-update-install.js +205 -0
  1029. package/dist/runtime-update-install.js.map +1 -0
  1030. package/dist/runtime-update-ipc.d.ts +42 -0
  1031. package/dist/runtime-update-ipc.js +144 -0
  1032. package/dist/runtime-update-ipc.js.map +1 -0
  1033. package/dist/runtime-update-journal.d.ts +49 -0
  1034. package/dist/runtime-update-journal.js +128 -0
  1035. package/dist/runtime-update-journal.js.map +1 -0
  1036. package/dist/runtime-update-lock.d.ts +48 -0
  1037. package/dist/runtime-update-lock.js +232 -0
  1038. package/dist/runtime-update-lock.js.map +1 -0
  1039. package/dist/runtime-update-owners.d.ts +29 -0
  1040. package/dist/runtime-update-owners.js +240 -0
  1041. package/dist/runtime-update-owners.js.map +1 -0
  1042. package/dist/runtime-update-protocol.d.ts +15 -0
  1043. package/dist/runtime-update-protocol.js +13 -0
  1044. package/dist/runtime-update-protocol.js.map +1 -0
  1045. package/dist/runtime-update-status.d.ts +30 -0
  1046. package/dist/runtime-update-status.js +31 -0
  1047. package/dist/runtime-update-status.js.map +1 -0
  1048. package/dist/runtime-windows-bridge.d.ts +42 -0
  1049. package/dist/runtime-windows-bridge.js +167 -0
  1050. package/dist/runtime-windows-bridge.js.map +1 -0
  1051. package/dist/scheduler/db.d.ts +10 -0
  1052. package/dist/scheduler/db.js +38 -11
  1053. package/dist/scheduler/db.js.map +1 -1
  1054. package/dist/scheduler/task-board-text.js +1 -1
  1055. package/dist/scheduler/task-board-text.js.map +1 -1
  1056. package/dist/scheduler/task-board.d.ts +13 -0
  1057. package/dist/scheduler/task-board.js +28 -3
  1058. package/dist/scheduler/task-board.js.map +1 -1
  1059. package/dist/scheduler/types.d.ts +6 -1
  1060. package/dist/service-drain.d.ts +19 -0
  1061. package/dist/service-drain.js +64 -0
  1062. package/dist/service-drain.js.map +1 -0
  1063. package/dist/service-installer.d.ts +7 -2
  1064. package/dist/service-installer.js +13 -10
  1065. package/dist/service-installer.js.map +1 -1
  1066. package/dist/settings-api.d.ts +23 -1
  1067. package/dist/settings-api.js +705 -6
  1068. package/dist/settings-api.js.map +1 -1
  1069. package/dist/settings-baseline.d.ts +7 -0
  1070. package/dist/settings-baseline.js +3 -1
  1071. package/dist/settings-baseline.js.map +1 -1
  1072. package/dist/settings-change.d.ts +10 -0
  1073. package/dist/settings-change.js +76 -1
  1074. package/dist/settings-change.js.map +1 -1
  1075. package/dist/settings-confirmation.d.ts +42 -3
  1076. package/dist/settings-confirmation.js +58 -12
  1077. package/dist/settings-confirmation.js.map +1 -1
  1078. package/dist/settings-effect.d.ts +17 -0
  1079. package/dist/settings-effect.js +226 -2
  1080. package/dist/settings-effect.js.map +1 -1
  1081. package/dist/settings-http-confirmation.d.ts +28 -0
  1082. package/dist/settings-http-confirmation.js +123 -9
  1083. package/dist/settings-http-confirmation.js.map +1 -1
  1084. package/dist/settings-instance-patch.js +28 -1
  1085. package/dist/settings-instance-patch.js.map +1 -1
  1086. package/dist/settings-request-capability.d.ts +7 -0
  1087. package/dist/settings-request-capability.js +10 -1
  1088. package/dist/settings-request-capability.js.map +1 -1
  1089. package/dist/settings-route-lifetime.d.ts +14 -0
  1090. package/dist/settings-route-lifetime.js +48 -0
  1091. package/dist/settings-route-lifetime.js.map +1 -0
  1092. package/dist/settings-transaction.d.ts +4 -0
  1093. package/dist/settings-transaction.js +9 -0
  1094. package/dist/settings-transaction.js.map +1 -1
  1095. package/dist/setup-form.js +6 -3
  1096. package/dist/setup-form.js.map +1 -1
  1097. package/dist/setup-host.js +1 -1
  1098. package/dist/setup-host.js.map +1 -1
  1099. package/dist/setup-i18n.js +3 -0
  1100. package/dist/setup-i18n.js.map +1 -1
  1101. package/dist/setup-wizard.js +4 -2
  1102. package/dist/setup-wizard.js.map +1 -1
  1103. package/dist/signin-keepalive.d.ts +207 -0
  1104. package/dist/signin-keepalive.js +682 -0
  1105. package/dist/signin-keepalive.js.map +1 -0
  1106. package/dist/structured-signin-transport.d.ts +20 -2
  1107. package/dist/structured-signin-transport.js +57 -2
  1108. package/dist/structured-signin-transport.js.map +1 -1
  1109. package/dist/structured-signin.d.ts +11 -2
  1110. package/dist/structured-signin.js +8 -8
  1111. package/dist/structured-signin.js.map +1 -1
  1112. package/dist/task-board-tool.d.ts +13 -1
  1113. package/dist/task-board-tool.js +104 -4
  1114. package/dist/task-board-tool.js.map +1 -1
  1115. package/dist/task-board-waker.d.ts +6 -0
  1116. package/dist/task-board-waker.js +4 -0
  1117. package/dist/task-board-waker.js.map +1 -1
  1118. package/dist/team-membership.d.ts +7 -0
  1119. package/dist/team-membership.js +10 -0
  1120. package/dist/team-membership.js.map +1 -0
  1121. package/dist/tips.js +4 -4
  1122. package/dist/tips.js.map +1 -1
  1123. package/dist/tmux-binary.d.ts +59 -0
  1124. package/dist/tmux-binary.js +189 -0
  1125. package/dist/tmux-binary.js.map +1 -0
  1126. package/dist/tmux-control.d.ts +2 -1
  1127. package/dist/tmux-control.js +4 -4
  1128. package/dist/tmux-control.js.map +1 -1
  1129. package/dist/tmux-exec-helper.js +32 -1
  1130. package/dist/tmux-exec-helper.js.map +1 -1
  1131. package/dist/tmux-legacy.d.ts +94 -0
  1132. package/dist/tmux-legacy.js +309 -0
  1133. package/dist/tmux-legacy.js.map +1 -0
  1134. package/dist/tmux-manager.d.ts +10 -3
  1135. package/dist/tmux-manager.js +60 -38
  1136. package/dist/tmux-manager.js.map +1 -1
  1137. package/dist/tmux-pane-host.d.ts +26 -0
  1138. package/dist/tmux-pane-host.js +25 -0
  1139. package/dist/tmux-pane-host.js.map +1 -0
  1140. package/dist/tmux-read.js +4 -3
  1141. package/dist/tmux-read.js.map +1 -1
  1142. package/dist/tmux-rollback.d.ts +31 -0
  1143. package/dist/tmux-rollback.js +72 -0
  1144. package/dist/tmux-rollback.js.map +1 -0
  1145. package/dist/tmux-server.d.ts +102 -0
  1146. package/dist/tmux-server.js +248 -0
  1147. package/dist/tmux-server.js.map +1 -0
  1148. package/dist/tool-permissions.d.ts +2 -3
  1149. package/dist/tool-permissions.js +5 -4
  1150. package/dist/tool-permissions.js.map +1 -1
  1151. package/dist/topic-commands.js +10 -6
  1152. package/dist/topic-commands.js.map +1 -1
  1153. package/dist/transcript-delta-reader.d.ts +1 -1
  1154. package/dist/transcript-delta-reader.js +1 -1
  1155. package/dist/transcript-delta-reader.js.map +1 -1
  1156. package/dist/transcript-monitor.d.ts +23 -0
  1157. package/dist/transcript-monitor.js +107 -49
  1158. package/dist/transcript-monitor.js.map +1 -1
  1159. package/dist/transcript-needles.d.ts +42 -0
  1160. package/dist/transcript-needles.js +166 -0
  1161. package/dist/transcript-needles.js.map +1 -0
  1162. package/dist/transcript-records.d.ts +22 -0
  1163. package/dist/transcript-records.js +144 -0
  1164. package/dist/transcript-records.js.map +1 -0
  1165. package/dist/transcript-sources.d.ts +5 -0
  1166. package/dist/transcript-sources.js +11 -79
  1167. package/dist/transcript-sources.js.map +1 -1
  1168. package/dist/types.d.ts +34 -0
  1169. package/dist/types.js.map +1 -1
  1170. package/dist/ui/account-identity.js +27 -0
  1171. package/dist/ui/accounts-keepalive.js +118 -0
  1172. package/dist/ui/accounts-manage.js +256 -0
  1173. package/dist/ui/accounts-view.js +418 -0
  1174. package/dist/ui/agent-proposals.js +90 -0
  1175. package/dist/ui/agent-runtime-settings.js +69 -0
  1176. package/dist/ui/agent-runtime.js +124 -0
  1177. package/dist/ui/app.html +8 -1
  1178. package/dist/ui/backend-signin.js +108 -36
  1179. package/dist/ui/chat-ambient.js +1 -1
  1180. package/dist/ui/chat-commands.js +7 -0
  1181. package/dist/ui/chat-md-strings.js +3 -0
  1182. package/dist/ui/chat-render.js +3 -670
  1183. package/dist/ui/chat-store.js +14 -3
  1184. package/dist/ui/chat-strings.js +3 -285
  1185. package/dist/ui/chat-thread.js +3 -919
  1186. package/dist/ui/chat-time.js +3 -80
  1187. package/dist/ui/chat-tour.js +1 -1
  1188. package/dist/ui/cli-caps.js +15 -0
  1189. package/dist/ui/cli-picker.js +42 -0
  1190. package/dist/ui/credential-profile-select.js +54 -0
  1191. package/dist/ui/fleet-cache.js +3 -3
  1192. package/dist/ui/fleet-canvas.js +2 -2
  1193. package/dist/ui/fleet-office-dialogue.d.ts +30 -0
  1194. package/dist/ui/fleet-office-dialogue.js +382 -0
  1195. package/dist/ui/fleet-office-editor.js +1 -1
  1196. package/dist/ui/fleet-office-pack.d.ts +9 -0
  1197. package/dist/ui/fleet-office-pack.js +76 -4
  1198. package/dist/ui/fleet-office-skin.js +23 -5
  1199. package/dist/ui/fleet-office-store.js +5 -0
  1200. package/dist/ui/fleet-office.js +174 -7
  1201. package/dist/ui/fleet-org.js +2 -2
  1202. package/dist/ui/fleet-task-card.js +11 -7
  1203. package/dist/ui/fleet-task-common.js +18 -8
  1204. package/dist/ui/fleet-task-menu.js +188 -0
  1205. package/dist/ui/fleet-task-stats.js +124 -0
  1206. package/dist/ui/fleet-task-view.js +340 -0
  1207. package/dist/ui/fleet-tasks.js +131 -43
  1208. package/dist/ui/general-location.js +85 -0
  1209. package/dist/ui/html-attachment.js +3 -40
  1210. package/dist/ui/hub-agent-copy.js +23 -0
  1211. package/dist/ui/hub-attachments.js +90 -0
  1212. package/dist/ui/hub-button-actions.js +65 -0
  1213. package/dist/ui/hub-chat-store.js +168 -0
  1214. package/dist/ui/hub-chat-strings.js +79 -0
  1215. package/dist/ui/hub-client.js +410 -0
  1216. package/dist/ui/hub-company-join-strings.js +74 -0
  1217. package/dist/ui/hub-company-join.js +119 -0
  1218. package/dist/ui/hub-directory-editor-strings.js +56 -0
  1219. package/dist/ui/hub-directory-editor.js +163 -0
  1220. package/dist/ui/hub-directory-notice-strings.js +28 -0
  1221. package/dist/ui/hub-directory-notices.js +66 -0
  1222. package/dist/ui/hub-grant-strings.js +13 -0
  1223. package/dist/ui/hub-group-policy.js +183 -0
  1224. package/dist/ui/hub-group-strings.js +110 -0
  1225. package/dist/ui/hub-host-security-notices.js +28 -0
  1226. package/dist/ui/hub-owner-strings.js +55 -0
  1227. package/dist/ui/hub-pairing-progress-strings.js +15 -0
  1228. package/dist/ui/hub-preview.js +101 -0
  1229. package/dist/ui/hub-provider-guidance.js +31 -0
  1230. package/dist/ui/hub-quick-pairing.js +209 -0
  1231. package/dist/ui/hub-quick-strings.js +43 -0
  1232. package/dist/ui/hub-quota.js +85 -0
  1233. package/dist/ui/hub-read-strings.js +7 -0
  1234. package/dist/ui/hub-strings.js +164 -0
  1235. package/dist/ui/hub-switcher.js +27 -0
  1236. package/dist/ui/hub-this-hub.js +113 -0
  1237. package/dist/ui/hub-welcome.js +102 -0
  1238. package/dist/ui/machine-signin.js +56 -0
  1239. package/dist/ui/native-instance-settings.js +44 -0
  1240. package/dist/ui/native-pane-recovery.js +45 -0
  1241. package/dist/ui/office-share-page.js +4 -2
  1242. package/dist/ui/panel-chat.js +98 -77
  1243. package/dist/ui/panel-details.js +3 -2
  1244. package/dist/ui/panel-fleet.js +183 -32
  1245. package/dist/ui/panel-hub.js +970 -0
  1246. package/dist/ui/panel-log.js +4 -4
  1247. package/dist/ui/panel-needs.js +189 -15
  1248. package/dist/ui/panel-notices.js +4 -3
  1249. package/dist/ui/panel-runtimes.js +446 -0
  1250. package/dist/ui/panel-settings.js +292 -201
  1251. package/dist/ui/panel-windows-agent.js +87 -0
  1252. package/dist/ui/panel-windows-cli.js +189 -0
  1253. package/dist/ui/preview-pages.js +3 -41
  1254. package/dist/ui/preview-panel-actions.js +3 -161
  1255. package/dist/ui/preview-panel.js +11 -472
  1256. package/dist/ui/preview-versions.js +3 -155
  1257. package/dist/ui/preview.js +3 -476
  1258. package/dist/ui/provider-marks.js +83 -0
  1259. package/dist/ui/runtime-catalog.js +55 -0
  1260. package/dist/ui/runtime-cli-install.js +135 -0
  1261. package/dist/ui/runtime-commands.d.ts +4 -0
  1262. package/dist/ui/runtime-commands.js +59 -0
  1263. package/dist/ui/runtime-update-commands.d.ts +2 -0
  1264. package/dist/ui/runtime-update-commands.js +11 -0
  1265. package/dist/ui/runtime-update-status.js +53 -0
  1266. package/dist/ui/search-dialog.js +5 -2
  1267. package/dist/ui/settings-access-strings.js +42 -0
  1268. package/dist/ui/settings-agent-filters.js +94 -0
  1269. package/dist/ui/settings-appearance.js +122 -23
  1270. package/dist/ui/settings-apply.js +12 -5
  1271. package/dist/ui/settings-build-version.js +35 -0
  1272. package/dist/ui/settings-catalog.js +39 -11
  1273. package/dist/ui/settings-codex-copy.js +19 -0
  1274. package/dist/ui/settings-confirm.js +108 -10
  1275. package/dist/ui/settings-devices.js +249 -0
  1276. package/dist/ui/settings-dialogs.js +78 -25
  1277. package/dist/ui/settings-guests.js +28 -13
  1278. package/dist/ui/settings-hub-browser-certificate.js +76 -0
  1279. package/dist/ui/settings-hub-company-join.js +162 -0
  1280. package/dist/ui/settings-hub-directory.js +29 -0
  1281. package/dist/ui/settings-hub-membership.js +93 -0
  1282. package/dist/ui/settings-hub-preview.js +74 -0
  1283. package/dist/ui/settings-hub-retention.js +54 -0
  1284. package/dist/ui/settings-hub-run.js +62 -0
  1285. package/dist/ui/settings-hub-section.js +66 -0
  1286. package/dist/ui/settings-hub-setup-strings.js +70 -0
  1287. package/dist/ui/settings-hub-setup.js +195 -0
  1288. package/dist/ui/settings-hub.js +261 -0
  1289. package/dist/ui/settings-layout.js +246 -0
  1290. package/dist/ui/settings-model.js +26 -3
  1291. package/dist/ui/settings-named-test.js +2 -2
  1292. package/dist/ui/settings-outside.js +242 -0
  1293. package/dist/ui/settings-quota-notice.js +102 -0
  1294. package/dist/ui/settings-registry.js +24 -5
  1295. package/dist/ui/settings-restart-strings.js +17 -0
  1296. package/dist/ui/settings-shared-strings.js +143 -0
  1297. package/dist/ui/settings-shared.js +345 -0
  1298. package/dist/ui/settings-shortcuts.js +65 -0
  1299. package/dist/ui/settings-strings.js +127 -52
  1300. package/dist/ui/settings-update.js +69 -0
  1301. package/dist/ui/settings-web-authority.js +19 -12
  1302. package/dist/ui/shared/accounts-keepalive.css +12 -0
  1303. package/dist/ui/shared/accounts.css +78 -0
  1304. package/dist/ui/shared/app-i18n.js +18 -9
  1305. package/dist/ui/shared/app-route.js +12 -3
  1306. package/dist/ui/shared/app-session.js +6 -2
  1307. package/dist/ui/shared/app-shell.js +312 -40
  1308. package/dist/ui/shared/app-store.js +3 -2
  1309. package/dist/ui/shared/app-stream.js +3 -1
  1310. package/dist/ui/shared/app-update.js +215 -0
  1311. package/dist/ui/shared/app.css +1511 -6
  1312. package/dist/ui/shared/app.js +18 -4
  1313. package/dist/ui/shared/chat-composer.js +68 -0
  1314. package/dist/ui/shared/chat-md-strings.js +9 -0
  1315. package/dist/ui/shared/chat-render.js +682 -0
  1316. package/dist/ui/shared/chat-strings.js +333 -0
  1317. package/dist/ui/shared/chat-thread.js +969 -0
  1318. package/dist/ui/shared/chat-time.js +80 -0
  1319. package/dist/ui/shared/header-tools.js +9 -9
  1320. package/dist/ui/shared/html-attachment.js +42 -0
  1321. package/dist/ui/shared/hub-chat.css +98 -0
  1322. package/dist/ui/shared/hub-groups.css +28 -0
  1323. package/dist/ui/shared/hub-owner.css +51 -0
  1324. package/dist/ui/shared/hub-quota.css +8 -0
  1325. package/dist/ui/shared/hub-signin.css +24 -0
  1326. package/dist/ui/shared/hub.css +78 -0
  1327. package/dist/ui/shared/instance-nav.js +35 -8
  1328. package/dist/ui/shared/instance-switch.js +4 -3
  1329. package/dist/ui/shared/loading.css +37 -0
  1330. package/dist/ui/shared/machine-name.js +13 -0
  1331. package/dist/ui/shared/page-head.js +8 -0
  1332. package/dist/ui/shared/panel-view.js +77 -4
  1333. package/dist/ui/shared/preview-pages.js +41 -0
  1334. package/dist/ui/shared/preview-panel-actions.js +168 -0
  1335. package/dist/ui/shared/preview-panel.js +565 -0
  1336. package/dist/ui/shared/preview-versions.js +155 -0
  1337. package/dist/ui/shared/preview.js +476 -0
  1338. package/dist/ui/shared/qrcode.module.js +2237 -0
  1339. package/dist/ui/shared/runtime-install.css +30 -0
  1340. package/dist/ui/shared/settings-width.js +31 -0
  1341. package/dist/ui/shared/setup-host-text.js +4 -1
  1342. package/dist/ui/shared/side-rail.js +15 -0
  1343. package/dist/ui/shared/signin.js +280 -10
  1344. package/dist/ui/shared/task-board.css +95 -0
  1345. package/dist/ui/shared/tokens.css +1 -0
  1346. package/dist/ui/shared/ui-dialog.js +2 -2
  1347. package/dist/ui/shared/ui-menu.js +30 -10
  1348. package/dist/ui/shared/ui-states.js +14 -3
  1349. package/dist/ui/shared/usage-dialog.js +3 -72
  1350. package/dist/ui/shared/usage-meter.js +84 -0
  1351. package/dist/ui/shared/vendor/qrcode-generator.LICENSE +27 -0
  1352. package/dist/ui/shared/vendor/vendor.json +19 -2
  1353. package/dist/ui/shared/view-history.css +17 -0
  1354. package/dist/ui/shared/view-history.js +438 -0
  1355. package/dist/ui/shared/view-strings.js +23 -15
  1356. package/dist/ui/shared/web-authorize.js +4 -4
  1357. package/dist/ui/shared/workspace-follow.css +19 -0
  1358. package/dist/ui/shared/workspace.css +20 -0
  1359. package/dist/ui/signin.html +27 -2
  1360. package/dist/ui/structured-signin.js +65 -15
  1361. package/dist/ui/windows-agents-nav.js +2 -0
  1362. package/dist/ui/windows-cli-catalog.js +108 -0
  1363. package/dist/ui/workspace-follow-strings.js +28 -0
  1364. package/dist/ui/workspace-panel.js +378 -0
  1365. package/dist/ui/workspace-strings.js +35 -0
  1366. package/dist/unattended-install.d.ts +11 -2
  1367. package/dist/unattended-install.js +41 -6
  1368. package/dist/unattended-install.js.map +1 -1
  1369. package/dist/update-dispatch.d.ts +32 -4
  1370. package/dist/update-dispatch.js +146 -16
  1371. package/dist/update-dispatch.js.map +1 -1
  1372. package/dist/update-install.d.ts +7 -0
  1373. package/dist/update-install.js +23 -0
  1374. package/dist/update-install.js.map +1 -1
  1375. package/dist/update-launch.d.ts +1 -1
  1376. package/dist/update-launch.js +2 -2
  1377. package/dist/update-launch.js.map +1 -1
  1378. package/dist/update-marker.d.ts +4 -2
  1379. package/dist/update-marker.js +4 -3
  1380. package/dist/update-marker.js.map +1 -1
  1381. package/dist/usage/providers.d.ts +8 -0
  1382. package/dist/usage/providers.js +36 -26
  1383. package/dist/usage/providers.js.map +1 -1
  1384. package/dist/usage/quota-notices.d.ts +38 -0
  1385. package/dist/usage/quota-notices.js +160 -0
  1386. package/dist/usage/quota-notices.js.map +1 -0
  1387. package/dist/usage/usage-api.d.ts +2 -1
  1388. package/dist/usage/usage-api.js +19 -10
  1389. package/dist/usage/usage-api.js.map +1 -1
  1390. package/dist/usage-rollup.d.ts +5 -0
  1391. package/dist/usage-rollup.js +11 -6
  1392. package/dist/usage-rollup.js.map +1 -1
  1393. package/dist/view-api.d.ts +18 -8
  1394. package/dist/view-api.js +108 -32
  1395. package/dist/view-api.js.map +1 -1
  1396. package/dist/view-history.d.ts +84 -0
  1397. package/dist/view-history.js +116 -0
  1398. package/dist/view-history.js.map +1 -0
  1399. package/dist/web-api.d.ts +133 -2
  1400. package/dist/web-api.js +1091 -26
  1401. package/dist/web-api.js.map +1 -1
  1402. package/dist/web-auth.js +2 -1
  1403. package/dist/web-auth.js.map +1 -1
  1404. package/dist/web-backend-login.d.ts +39 -3
  1405. package/dist/web-backend-login.js +25 -17
  1406. package/dist/web-backend-login.js.map +1 -1
  1407. package/dist/web-chat-history.d.ts +19 -2
  1408. package/dist/web-chat-history.js +72 -3
  1409. package/dist/web-chat-history.js.map +1 -1
  1410. package/dist/web-device-login.d.ts +153 -0
  1411. package/dist/web-device-login.js +278 -0
  1412. package/dist/web-device-login.js.map +1 -0
  1413. package/dist/web-login.d.ts +35 -1
  1414. package/dist/web-login.js +51 -5
  1415. package/dist/web-login.js.map +1 -1
  1416. package/dist/web-notices.d.ts +9 -0
  1417. package/dist/web-notices.js +19 -0
  1418. package/dist/web-notices.js.map +1 -1
  1419. package/dist/web-office-skins.d.ts +9 -0
  1420. package/dist/web-office-skins.js +16 -1
  1421. package/dist/web-office-skins.js.map +1 -1
  1422. package/dist/web-only-fleet.d.ts +20 -0
  1423. package/dist/web-only-fleet.js +21 -0
  1424. package/dist/web-only-fleet.js.map +1 -1
  1425. package/dist/web-remote-access.d.ts +158 -0
  1426. package/dist/web-remote-access.js +377 -0
  1427. package/dist/web-remote-access.js.map +1 -0
  1428. package/dist/web-session.d.ts +53 -0
  1429. package/dist/web-session.js +47 -1
  1430. package/dist/web-session.js.map +1 -1
  1431. package/dist/web-settings-patch.d.ts +3 -1
  1432. package/dist/web-settings-patch.js +4 -1
  1433. package/dist/web-settings-patch.js.map +1 -1
  1434. package/dist/web-shell-routes.d.ts +10 -1
  1435. package/dist/web-shell-routes.js +14 -2
  1436. package/dist/web-shell-routes.js.map +1 -1
  1437. package/dist/web-signin-link.d.ts +42 -0
  1438. package/dist/web-signin-link.js +110 -0
  1439. package/dist/web-signin-link.js.map +1 -0
  1440. package/dist/web-terminal.d.ts +11 -30
  1441. package/dist/web-terminal.js +23 -8
  1442. package/dist/web-terminal.js.map +1 -1
  1443. package/dist/web-update.d.ts +78 -0
  1444. package/dist/web-update.js +104 -0
  1445. package/dist/web-update.js.map +1 -0
  1446. package/dist/windows-agents.d.ts +127 -0
  1447. package/dist/windows-agents.js +491 -0
  1448. package/dist/windows-agents.js.map +1 -0
  1449. package/dist/windows-cli-api.d.ts +48 -0
  1450. package/dist/windows-cli-api.js +206 -0
  1451. package/dist/windows-cli-api.js.map +1 -0
  1452. package/dist/windows-cli-providers.d.ts +109 -0
  1453. package/dist/windows-cli-providers.js +396 -0
  1454. package/dist/windows-cli-providers.js.map +1 -0
  1455. package/dist/windows-cli-worker.d.ts +85 -0
  1456. package/dist/windows-cli-worker.js +585 -0
  1457. package/dist/windows-cli-worker.js.map +1 -0
  1458. package/dist/windows-cli.d.ts +126 -0
  1459. package/dist/windows-cli.js +416 -0
  1460. package/dist/windows-cli.js.map +1 -0
  1461. package/dist/windows-native-mcp.d.ts +19 -0
  1462. package/dist/windows-native-mcp.js +143 -0
  1463. package/dist/windows-native-mcp.js.map +1 -0
  1464. package/dist/windows-pane-mcp.d.ts +26 -0
  1465. package/dist/windows-pane-mcp.js +187 -0
  1466. package/dist/windows-pane-mcp.js.map +1 -0
  1467. package/dist/workspace-follow-parse.d.ts +36 -0
  1468. package/dist/workspace-follow-parse.js +208 -0
  1469. package/dist/workspace-follow-parse.js.map +1 -0
  1470. package/dist/workspace-follow-records.d.ts +17 -0
  1471. package/dist/workspace-follow-records.js +88 -0
  1472. package/dist/workspace-follow-records.js.map +1 -0
  1473. package/dist/workspace-follow.d.ts +41 -0
  1474. package/dist/workspace-follow.js +143 -0
  1475. package/dist/workspace-follow.js.map +1 -0
  1476. package/dist/wsl-detect.d.ts +1 -0
  1477. package/dist/wsl-detect.js +20 -0
  1478. package/dist/wsl-detect.js.map +1 -0
  1479. package/dist/yaml-shared-nodes.js +8 -3
  1480. package/dist/yaml-shared-nodes.js.map +1 -1
  1481. package/launcher/agend-install.cjs +8 -1
  1482. package/launcher/launchd-session-type.cjs +14 -0
  1483. package/launcher/postinstall.cjs +27 -2
  1484. package/launcher/private-home.cjs +1 -1
  1485. package/launcher/tmux-bundle.cjs +263 -0
  1486. package/package.json +16 -4
  1487. package/templates/launchd.plist.ejs +3 -1
  1488. package/templates/runtime-assets/conpty-LICENSE +21 -0
  1489. package/templates/runtime-assets/conpty-NOTICE.md +503 -0
  1490. package/templates/runtime-assets/local-pane-stage.ps1 +101 -0
  1491. package/templates/runtime-assets/runtime-pane-job.ps1 +116 -0
  1492. package/templates/runtime-assets/runtime-pane-private.ps1 +14 -0
  1493. package/templates/runtime-assets/xterm-LICENSE +21 -0
  1494. package/templates/runtime-install/install.ps1 +411 -0
@@ -4,17 +4,21 @@ import { execFileSync } from "node:child_process";
4
4
  import { execFile } from "../child-process.js";
5
5
  import { promisify } from "node:util";
6
6
  import { basename, dirname, join, resolve } from "node:path";
7
- import { stripCodexPassiveHintRow, withCodexPassiveHintTail } from "./codex-footer-hints.js";
7
+ import { stripCodexPassiveHintRow, withCodexPassiveHintTail, CODEX_EMPTY_PASSIVE_COMPOSER, isCodexStatusAutocompleteComposer } from "./codex-footer-hints.js";
8
8
  import { codexPackageWarning } from "./codex-package.js";
9
9
  import { probeCliVersion, resolveBinary, shellQuote, validateModel, validateProvider, warnIfModelMismatch } from "./types.js";
10
10
  import { credentialHomeSpec, credentialProfileHome, prepareCredentialProfileHome, resolveCredentialProfile, } from "./credential-profile.js";
11
11
  import { getAgendHome } from "../paths.js";
12
- import { CODEX_MODELS_CACHE_MAX_BYTES, codexShortHomeFor, readCodexEffortLevels, readCodexModelEffortLevels, resolveCodexLaunchModel } from "./codex-metadata.js";
12
+ import { selectedGeneralHostSession } from "../general-binding.js";
13
+ import { ResumeBlockedError } from "./types.js";
14
+ import { CODEX_MODELS_CACHE_MAX_BYTES, codexShortHomeFor, readCodexEffortLevels, readCodexModelEffortLevels, readCodexModelServiceTiers, resolveCodexLaunchModel } from "./codex-metadata.js";
13
15
  import { EFFORT_CAPABILITIES } from "./effort-metadata.js";
14
16
  import { codexEffort } from "./launch-effort.js";
17
+ import { codexSpeed } from "./codex-speed.js";
15
18
  import { appendWithMarker, removeMarker } from "./marker-utils.js";
16
19
  import { checkResumeId, codexSiblingState, codexStateDbAbsent, codexThreadRowExists, cwdRolloutsProvenAbsent, findExactCwdCodexSession, planCodexResume, newestResumableRollout } from "./codex-session-lookup.js";
17
20
  import { t } from "../locale.js";
21
+ import { snapshotCodexQuotaHistory, snapshotCodexSessionQuotaHistory } from "./codex-quota-history.js";
18
22
  import { quotaLine, quotaLowLine, quotaPausedLine } from "../quota-notice.js";
19
23
  import { parse as parseToml } from "smol-toml";
20
24
  import { selectionCard } from "../selection-card.js";
@@ -303,6 +307,11 @@ function setProjectTrusted(content, root) {
303
307
  throw new Error("Codex project trust is not effective");
304
308
  return updated;
305
309
  }
310
+ /** A folder-trust prompt's cancel option, and the footer that must come with it. */
311
+ const CODEX_TRUST_CANCEL_FOOTER = {
312
+ "Quit": /^\s*enter continue\s*·\s*esc quit\s*$/i,
313
+ "Back to Agent Command Center": /^\s*enter continue\s*·\s*esc back\s*$/i,
314
+ };
306
315
  /** Only the bottom, live Codex 0.156 folder-access screen can own stdin. */
307
316
  function codexTrustPromptState(pane) {
308
317
  const noPrompt = { active: false, folder: null, root: null, rootNote: "absent", safeChoice: false, trustCursor: false };
@@ -346,21 +355,26 @@ function codexTrustPromptState(pane) {
346
355
  });
347
356
  // Unknown option orders, a moved cursor, a third option, or any different
348
357
  // footer are held for a human. Never guess where Enter would land.
358
+ // The cancel option and the footer come as a pair: "Quit" / "esc quit" (onboarding, and every codex before 0.167), or
359
+ // "Back to Agent Command Center" / "esc back" (0.167's startup trust screen, where Esc returns to the command center).
360
+ // Exactly one cancel option, and the footer that belongs to it.
361
+ const cancels = choices.filter(choice => Object.prototype.hasOwnProperty.call(CODEX_TRUST_CANCEL_FOOTER, choice.text));
362
+ const footerFits = cancels.length === 1 && CODEX_TRUST_CANCEL_FOOTER[cancels[0].text].test(rows[last]);
349
363
  const safeChoice = choices.length === 2
350
364
  && choices[0].row + 1 === choices[1].row
351
365
  && rows.slice(choices[1].row + 1, last).every(row => row.trim() === "")
352
366
  && choices[0].cursor === "›" && choices[0].number === "1" && choices[0].text === "Trust and continue"
353
- && choices[1].cursor === "" && choices[1].number === "2" && choices[1].text === "Quit"
354
- && /^\s*enter continue\s*·\s*esc quit\s*$/i.test(rows[last]);
355
- const known = new Set(["Trust and continue", "Open restricted", "Quit"]);
356
- // Exactly one selection marker, whichever form (› ❯ >), and it is on Trust; the footer is the one both 0.160 and 0.166
357
- // show. Two markers, another footer mapping or an unknown option is held — never a guess where Enter lands (#2896 review).
367
+ && choices[1].cursor === "" && choices[1].number === "2" && cancels[0] === choices[1]
368
+ && footerFits;
369
+ const known = new Set(["Trust and continue", "Open restricted", ...Object.keys(CODEX_TRUST_CANCEL_FOOTER)]);
370
+ // Exactly one selection marker, whichever form (› ❯ >), and it is on Trust; the footer is the one its cancel option
371
+ // pairs with. Two markers, another footer mapping or an unknown option is held — never a guess where Enter lands (#2896 review).
358
372
  const atCursor = choices.filter(choice => choice.cursor !== "");
359
373
  const trustCursor = choices.length >= 2 && choices.every(choice => known.has(choice.text))
360
374
  && choices.every((choice, index) => index === 0 || choice.row === choices[index - 1].row + 1)
361
375
  && rows.slice(choices[choices.length - 1].row + 1, last).every(row => row.trim() === "")
362
376
  && atCursor.length === 1 && atCursor[0].cursor === "›" && atCursor[0].text === "Trust and continue"
363
- && /^\s*enter continue\s*·\s*esc quit\s*$/i.test(rows[last]);
377
+ && footerFits;
364
378
  return { active: true, folder, root, rootNote, safeChoice, trustCursor };
365
379
  }
366
380
  /** Unknown/older trust layouts are still input-blocking, never auto-answered. */
@@ -605,6 +619,20 @@ function codexWorkspaceLimitPromptVisible(pane) {
605
619
  }
606
620
  return false;
607
621
  }
622
+ /**
623
+ * The composer's own `›` row above the footer, or -1. Walking up from the footer, only blank rows and indented rows (the
624
+ * composer's wrapped text, however many lines a long paste takes) may come before it. The first column-zero row decides:
625
+ * a `›` there is the composer; a numbered `›` row is a selection card; any other column-zero row (`•`/`■`/`⚠` output, a
626
+ * status line) means a `›` above it is transcript history, never the composer.
627
+ */
628
+ function ownedComposerRow(rows) {
629
+ for (let i = rows.length - 1; i >= 0; i--) {
630
+ if (!rows[i].trim() || /^[ \t]/.test(rows[i]))
631
+ continue;
632
+ return /^[>›][ \t]+\S/.test(rows[i]) && !/^[>›][ \t]+\d+\./.test(rows[i]) ? i : -1;
633
+ }
634
+ return -1;
635
+ }
608
636
  /** Unknown pickers own stdin too; never type or press Enter into one. */
609
637
  function codexUnknownSelectionVisible(pane) {
610
638
  const rows = pane.replace(/\r/g, "").split("\n");
@@ -984,8 +1012,15 @@ export const CODEX_RESUME_ATTEMPT_FILE = "codex-resume-attempt.json";
984
1012
  export const CODEX_RESUME_FAILED_FILE = "codex-resume-failed.json";
985
1013
  /** Above this, a resumed rollout carries a note that codex may compact it first. */
986
1014
  export const CODEX_RESUME_LARGE_BYTES = 20 * 1024 * 1024;
987
- export class CodexBackend {
988
- instanceDir;
1015
+ /** Pane-only detectors: construction performs no provider, config or session discovery. */
1016
+ export class CodexPaneDetectors {
1017
+ paneDetectorContext;
1018
+ constructor(paneDetectorContext) {
1019
+ this.paneDetectorContext = paneDetectorContext;
1020
+ }
1021
+ readConfiguredStatusLineItems() { return this.paneDetectorContext?.statusLineItems()?.slice() ?? null; }
1022
+ trustPaneFields(pane) { const state = codexTrustPromptState(pane); return { promptFolder: state.folder, promptRoot: state.root, rootNote: state.rootNote }; }
1023
+ trustHoldReason(pane) { return { ...this.trustPaneFields(pane), reason: "Folder permission needs confirmation on this execution machine" }; }
989
1024
  /**
990
1025
  * #1510: the reply-completion guard covers codex, its turn end read from the rollout (task_complete /
991
1026
  * turn_aborted, recorded on 0.162.0 in tests/fixtures/reply-guard-1510): the pane alone stays busy through a tool
@@ -994,121 +1029,10 @@ export class CodexBackend {
994
1029
  replyCompletionGuard = true;
995
1030
  turnEndFromTranscript = true;
996
1031
  binaryName = "codex";
997
- binaryPath;
998
- sharedCodexHome;
999
- isolatedCodexHome;
1000
- /** Which subscription this instance runs on, or null for the shared login. */
1001
- credentialProfile = null;
1002
- /** Set only after preTrust wrote and read back this instance's private config. */
1003
- authorizedTrust = null;
1004
1032
  configuredStatusLineItems;
1005
1033
  configuredStatusLinePattern;
1006
- /** Set by buildCommand when the resume plan fell back; read once by the daemon. */
1007
- launchWarning = null;
1008
1034
  /** Whether the last buildCommand launched a resume (`resume <id>` or `--last`). */
1009
1035
  lastLaunchResumes = true;
1010
- /** Set by writeConfig when the status_line could not be made verifiable (#931). */
1011
- statusLineWarning = null;
1012
- /** #2357: set by buildCommand when the codex being launched lacks a package companion (codex-code-mode-host). */
1013
- packageWarning = null;
1014
- constructor(instanceDir) {
1015
- this.instanceDir = instanceDir;
1016
- this.binaryPath = resolveBinary("codex");
1017
- this.sharedCodexHome = resolve(process.env.CODEX_HOME?.trim() || join(homedir(), ".codex"));
1018
- this.isolatedCodexHome = CodexBackend.resolveShortHome(instanceDir);
1019
- }
1020
- /**
1021
- * Compute and (on first call for an existing instance) migrate to a SHORT
1022
- * persistent CODEX_HOME under `~/.agend/cx/<8-char-hash>/`.
1023
- *
1024
- * Background (#953): codex 0.157.0 added `app-server-control.sock` under
1025
- * CODEX_HOME. For instances with long `-t<topic_id>` suffixes the full path
1026
- * exceeds the Unix socket SUN_LEN (~107 chars). codex canonicalises the path
1027
- * before binding the socket, so a symlink workaround does not help — the real
1028
- * path must be short.
1029
- *
1030
- * Migration steps (each is idempotent; half-completed states self-heal):
1031
- * 1. If shortHome does not exist AND legacyHome is a real directory (not a
1032
- * symlink) → atomic renameSync. On EXDEV or any other error, fall back
1033
- * safely: keep using the legacy long path (instance can still start, just
1034
- * without the short-path fix).
1035
- * 2. If shortHome exists but legacyHome is missing → recreate the backward-
1036
- * compat symlink (self-heal for rename-succeeded-but-symlink-failed crash).
1037
- * 3. If both shortHome and legacyHome (as symlink) exist → nothing to do.
1038
- * 4. New instance (no legacyHome) → create shortHome directly.
1039
- *
1040
- * Fail-safe guarantee: migration failure must never make the instance worse.
1041
- * The caller always receives a valid path it can use as CODEX_HOME.
1042
- */
1043
- /** Exposed for fleet-manager to delete the short home on instance removal. */
1044
- static shortHomeFor(instanceDir) {
1045
- return codexShortHomeFor(instanceDir);
1046
- }
1047
- static resolveShortHome(instanceDir) {
1048
- const shortHome = CodexBackend.shortHomeFor(instanceDir);
1049
- const shortBase = join(getAgendHome(), "cx");
1050
- const canonical = resolve(instanceDir);
1051
- const legacyHome = resolve(instanceDir, "codex-home");
1052
- // Only migrate/create when the instance directory itself exists.
1053
- // Constructing CodexBackend for a non-existent dir (cli-env probes, test
1054
- // backends that never ran) must not litter ~/.agend/cx/ with orphan dirs.
1055
- if (!existsSync(canonical))
1056
- return shortHome;
1057
- const legacyExists = existsSync(legacyHome);
1058
- const legacyIsRealDir = legacyExists && !lstatSync(legacyHome).isSymbolicLink();
1059
- const shortExists = existsSync(shortHome);
1060
- if (!shortExists) {
1061
- mkdirSync(shortBase, { recursive: true, mode: 0o700 });
1062
- if (legacyIsRealDir) {
1063
- // Attempt atomic rename. Requires same device; fails with EXDEV otherwise.
1064
- try {
1065
- renameSync(legacyHome, shortHome);
1066
- // Log the one-time migration for observability.
1067
- try {
1068
- const logPath = join(shortBase, `${shortHome.split("/").at(-1)}.migrated`);
1069
- writeFileSync(logPath, `${new Date().toISOString()} migrated from ${legacyHome}\n`);
1070
- }
1071
- catch { /* log failure is non-fatal */ }
1072
- }
1073
- catch (err) {
1074
- // EXDEV (cross-device) or any other rename failure → fail-safe:
1075
- // fall back to the legacy long path so the instance still works.
1076
- // The socket-length bug persists for this instance but no data is lost.
1077
- const code = err.code ?? "unknown";
1078
- try {
1079
- const warnPath = join(shortBase, `${shortHome.split("/").at(-1)}.migration-failed`);
1080
- writeFileSync(warnPath, `${new Date().toISOString()} rename failed (${code}): ${err.message}\n`
1081
- + `legacy path remains in use: ${legacyHome}\n`);
1082
- }
1083
- catch { /* warn log failure is also non-fatal */ }
1084
- // Return legacy long path so the instance starts (socket may still fail
1085
- // on 0.157.0 for long names, but no data is lost or corrupted).
1086
- return legacyHome;
1087
- }
1088
- }
1089
- else if (!legacyExists) {
1090
- // New instance — no data to migrate.
1091
- mkdirSync(shortHome, { recursive: true, mode: 0o700 });
1092
- }
1093
- // If legacyExists but is already a symlink: shortHome was deleted externally
1094
- // while the symlink still points to it. Re-create shortHome as a fresh dir.
1095
- if (!existsSync(shortHome)) {
1096
- mkdirSync(shortHome, { recursive: true, mode: 0o700 });
1097
- }
1098
- }
1099
- // Backward-compat symlink: instanceDir/codex-home → shortHome.
1100
- // Also serves as self-heal: if a previous run renamed successfully but
1101
- // crashed before creating the symlink, we recreate it here.
1102
- if (!legacyExists || legacyIsRealDir) {
1103
- // legacyIsRealDir means rename just happened (now shortHome exists, legacyHome gone).
1104
- // !legacyExists means new instance or symlink was deleted — create it.
1105
- try {
1106
- symlinkSync(shortHome, legacyHome);
1107
- }
1108
- catch { /* race or already exists */ }
1109
- }
1110
- return shortHome;
1111
- }
1112
1036
  supportsQueuedInput() {
1113
1037
  return true;
1114
1038
  }
@@ -1133,25 +1057,12 @@ export class CodexBackend {
1133
1057
  }
1134
1058
  /** Observed on real Codex 0.156.0: the live input row precedes its footer. */
1135
1059
  isDeliveryInputReadyPane(pane) {
1136
- // A composer with no app-server behind it accepts text and never submits it (#1099).
1137
- if (codexAppServerDisconnected(pane))
1138
- return false;
1139
- const rows = pane.replace(/\r/g, "").split("\n");
1140
- while (rows.length && !rows[rows.length - 1].trim())
1141
- rows.pop();
1142
- stripCodexPassiveHintRow(rows);
1143
- const footer = rows.pop() ?? "";
1144
- // Codex preserves other configured status-line items after the context
1145
- // meter (observed on 0.156.0: "Context 100% left · GPT-6-Astra"). They
1146
- // are footer chrome, not evidence that the input row is unavailable.
1147
- const contextFooter = this.isAnyContextFooter(footer);
1148
- // A deliberately configured status_line may omit Context entirely. In
1149
- // that case require a recognized value from the actual configured item
1150
- // list after Codex's exact empty live-composer row. An arbitrary non-empty
1151
- // footer or a recent transcript echo is not a readiness signal; that was
1152
- // the false-ready hole in the old Layer 2 deny-list attempt (#931/#947).
1153
- if (!contextFooter && !this.isConfiguredStatusLineFooter(footer))
1060
+ if (this.nativeContextlessEmpty(pane))
1061
+ return true;
1062
+ const frame = this.composerFrame(pane);
1063
+ if (!frame)
1154
1064
  return false;
1065
+ const { rows, contextFooter } = frame;
1155
1066
  if (!contextFooter) {
1156
1067
  if (this.getBusyPattern().test(pane))
1157
1068
  return false;
@@ -1172,6 +1083,75 @@ export class CodexBackend {
1172
1083
  }
1173
1084
  return false;
1174
1085
  }
1086
+ /**
1087
+ * Complete ownership of a long pasted envelope: the `›` composer row and every wrapped row down to a context footer are
1088
+ * proven by ownedComposerRow, however many rows they take. The Enter gate accepts this as well as isDeliveryInputReadyPane,
1089
+ * never instead of the dialog, busy and expected-seq checks.
1090
+ */
1091
+ ownsComposerRows(pane) {
1092
+ const frame = this.composerFrame(pane);
1093
+ if (frame?.contextFooter)
1094
+ return ownedComposerRow(frame.rows) >= 0;
1095
+ // A paste owns its wrapped rows, not a new-paste readiness verdict. The native caller still proves its
1096
+ // exact payload/operation and current sequence before Enter; a passive footer alone never grants input.
1097
+ const rows = this.nativeContextlessRows(pane);
1098
+ return rows !== null && ownedComposerRow(rows) >= 0;
1099
+ }
1100
+ // Codex 0.165 can restore a limit-only session before any Context value exists. This is the known native
1101
+ // empty-composer/passive-footer layout, only for a resumed launch with our context-only status configuration.
1102
+ // Other layouts retain their existing guard; this is not native's unknown-layout stability fallback.
1103
+ nativeContextlessPattern() {
1104
+ if (!this.paneDetectorContext?.windowsConpty || this.paneDetectorContext.contextlessResume !== true)
1105
+ return null;
1106
+ const items = this.readConfiguredStatusLineItems();
1107
+ return items?.length === 1 && items[0] === "context-remaining" ? CODEX_EMPTY_PASSIVE_COMPOSER : null;
1108
+ }
1109
+ nativeContextlessEmpty(pane) {
1110
+ return !!this.nativeContextlessPattern()?.test(pane) && !codexAppServerDisconnected(pane) && !this.getBusyPattern().test(pane)
1111
+ && ![...this.getStartupDialogs(), ...this.getRuntimeDialogs()].some(dialog => dialog.pattern.test(pane) && (!dialog.isActive || dialog.isActive(pane)));
1112
+ }
1113
+ nativeContextlessRows(pane) {
1114
+ if (!this.nativeContextlessPattern() || codexAppServerDisconnected(pane))
1115
+ return null;
1116
+ const rows = pane.replace(/\r/g, "").split("\n");
1117
+ while (rows.length && !rows.at(-1).trim())
1118
+ rows.pop();
1119
+ if (isCodexStatusAutocompleteComposer(pane))
1120
+ return rows;
1121
+ const before = rows.length;
1122
+ stripCodexPassiveHintRow(rows);
1123
+ if (rows.length === before)
1124
+ return null;
1125
+ const remaining = [...rows];
1126
+ stripCodexPassiveHintRow(remaining);
1127
+ return remaining.length === rows.length ? rows : null;
1128
+ }
1129
+ /**
1130
+ * The screen above Codex's footer, shared by both readers: null when the footer is not a Codex footer at all or the
1131
+ * app server behind the composer is gone (#1099). `rows` excludes the footer.
1132
+ */
1133
+ composerFrame(pane) {
1134
+ // A composer with no app-server behind it accepts text and never submits it (#1099).
1135
+ if (codexAppServerDisconnected(pane))
1136
+ return null;
1137
+ const rows = pane.replace(/\r/g, "").split("\n");
1138
+ while (rows.length && !rows[rows.length - 1].trim())
1139
+ rows.pop();
1140
+ stripCodexPassiveHintRow(rows);
1141
+ const footer = rows.pop() ?? "";
1142
+ // Codex preserves other configured status-line items after the context
1143
+ // meter (observed on 0.156.0: "Context 100% left · GPT-6-Astra"). They
1144
+ // are footer chrome, not evidence that the input row is unavailable.
1145
+ const contextFooter = this.isAnyContextFooter(footer);
1146
+ // A deliberately configured status_line may omit Context entirely. In
1147
+ // that case require a recognized value from the actual configured item
1148
+ // list after Codex's exact empty live-composer row. An arbitrary non-empty
1149
+ // footer or a recent transcript echo is not a readiness signal; that was
1150
+ // the false-ready hole in the old Layer 2 deny-list attempt (#931/#947).
1151
+ if (!contextFooter && !this.isConfiguredStatusLineFooter(footer))
1152
+ return null;
1153
+ return { rows, contextFooter };
1154
+ }
1175
1155
  /**
1176
1156
  * Live status chrome that must veto the broad prompt/context ready match.
1177
1157
  *
@@ -1206,6 +1186,8 @@ export class CodexBackend {
1206
1186
  isPeriodicRedrawIdlePane(pane) {
1207
1187
  if (codexAppServerDisconnected(pane))
1208
1188
  return false;
1189
+ if (this.nativeContextlessEmpty(pane))
1190
+ return true;
1209
1191
  // Astra's 0.154 theme animates U+22C6 star points across otherwise-stable
1210
1192
  // idle chrome. Remove only that observed decorative glyph; broader
1211
1193
  // punctuation stripping could turn real tool output into a false prompt.
@@ -1241,990 +1223,1274 @@ export class CodexBackend {
1241
1223
  return false;
1242
1224
  return true;
1243
1225
  }
1226
+ getReadyPattern() {
1227
+ // Header and context text persist in inline scrollback and even while the
1228
+ // CLI is loading or a modal owns stdin. Require the live prompt followed
1229
+ // by the Context footer at the *end* of the capture. A valid custom
1230
+ // status_line without Context gets a separate configured-item pattern;
1231
+ // unknown footer values still fail closed. getBusyPattern vetoes a working
1232
+ // turn whose empty composer remains visible.
1233
+ // U+22C6 is Codex's observed cosmetic starfield; it can be drawn in the
1234
+ // prompt, between prompt/footer, and below the footer. A drafted composer
1235
+ // is also idle once this same bottom footer proves it owns the screen.
1236
+ const contextReady = withCodexPassiveHintTail(/(?:^|\n)[>›][ \t⋆]+(?!\d+\.)\S[^\r\n]*\r?\n(?:[ \t⋆]*\r?\n){0,3}[ \t⋆]+(?:[0-9a-f-]{36}[ \t]+·[ \t]+)?Context[ \t]+(?:\d+%[ \t]+(?:left|used)|\d+…|…)[^\r\n]*(?:\r?\n[ \t⋆]*)*$/i);
1237
+ const footerPattern = this.configuredStatusLineFooterPattern();
1238
+ if (!footerPattern)
1239
+ return contextReady;
1240
+ // The no-Context alternative requires the exact empty composer followed by
1241
+ // a recognized configured Codex status_line value. If run-state is
1242
+ // configured, that value must specifically be Ready. This is positive
1243
+ // structural proof, never a deny-list of known dialogs.
1244
+ const footerSource = footerPattern.source.slice(1, -1);
1245
+ const noContextReady = withCodexPassiveHintTail(new RegExp(String.raw `(?:^|\n)[>›][ \t⋆]*Ask Codex to do anything[ \t⋆]*\r?\n(?:[ \t⋆]*\r?\n){0,3}${footerSource}(?:\r?\n[ \t⋆]*)*$`, "iu"));
1246
+ // #978: a configured footer that carries a Context item in any position
1247
+ // is the Context footer: same drafted-composer rule as Context-first. The
1248
+ // whole row must match the configured item grammar, so an arbitrary
1249
+ // indented line that merely contains `Context N% left` cannot pass.
1250
+ const configuredContextReady = this.configuredHasContextItem()
1251
+ ? withCodexPassiveHintTail(new RegExp(String.raw `(?:^|\n)[>›][ \t⋆]+(?!\d+\.)\S[^\r\n]*\r?\n(?:[ \t⋆]*\r?\n){0,3}(?=[^\r\n]*${CODEX_CONTEXT_ITEM})${footerSource}(?:\r?\n[ \t⋆]*)*$`, "iu"))
1252
+ : null;
1253
+ return new RegExp([contextReady.source, noContextReady.source, configuredContextReady?.source, this.nativeContextlessPattern()?.source]
1254
+ .filter((source) => !!source)
1255
+ .map(source => `(?:${source})`)
1256
+ .join("|"), "iu");
1257
+ }
1258
+ configuredStatusLineFooterPattern() {
1259
+ if (this.configuredStatusLinePattern !== undefined)
1260
+ return this.configuredStatusLinePattern;
1261
+ const items = this.readConfiguredStatusLineItems();
1262
+ if (!items?.length)
1263
+ return this.configuredStatusLinePattern = null;
1264
+ const configuredPatterns = items
1265
+ .map(item => CODEX_STATUS_LINE_VALUE_PATTERNS[item])
1266
+ .filter((pattern) => pattern !== undefined);
1267
+ if (!configuredPatterns.length)
1268
+ return this.configuredStatusLinePattern = null;
1269
+ const segment = `(?:${configuredPatterns.join("|")})`;
1270
+ const separator = String.raw `[ \t]+·[ \t]+`;
1271
+ const hasRunState = items.some(item => CODEX_RUN_STATE_STATUS_ITEMS.has(item));
1272
+ // Ready must occupy its own status-line segment. Other configured items
1273
+ // may precede/follow it, as Codex joins visible values with ` · `.
1274
+ const line = hasRunState
1275
+ ? `(?:${segment}${separator})*Ready(?:${separator}${segment})*`
1276
+ : `${segment}(?:${separator}${segment})*`;
1277
+ // The configured items, then (optionally) the CLI's own native fields — the same rule as the Context-first footer, so a
1278
+ // `model · Context 46% left Goal achieved (1h 6m)` row is the footer too, and the readiness regex built from this
1279
+ // source (footerSource) says the same.
1280
+ this.configuredStatusLinePattern = new RegExp(`^[ \t⋆]*${line}(?:${CODEX_NATIVE_FOOTER_FIELDS})?[ \t⋆]*$`, "iu");
1281
+ return this.configuredStatusLinePattern;
1282
+ }
1283
+ isConfiguredStatusLineFooter(row) {
1284
+ const pattern = this.configuredStatusLineFooterPattern();
1285
+ if (!pattern)
1286
+ return false;
1287
+ pattern.lastIndex = 0;
1288
+ return pattern.test(row);
1289
+ }
1290
+ configuredHasContextItem() {
1291
+ return (this.readConfiguredStatusLineItems() ?? []).some(item => CODEX_CONTEXT_STATUS_ITEMS.has(item));
1292
+ }
1244
1293
  /**
1245
- * The row codex paints for input it has taken into its own queue instead of
1246
- * submitting: `↳ <message>` under "Messages to be submitted after next tool
1247
- * call (press esc to interrupt and send immediately)".
1294
+ * #978: a Context item in ANY position, accepted only as part of a footer
1295
+ * whose every segment matches the configured status_line items. Codex keeps
1296
+ * the user's order (`gpt-5.6-sol medium · Context 46% left · ~/x`); an
1297
+ * arbitrary indented transcript line that happens to contain the item does
1298
+ * not match that grammar. A stale config fails closed, and the daemon's
1299
+ * stable-composer escape hatch then keeps the instance from latching.
1248
1300
  */
1249
- getQueuedInputMarker() {
1250
- return /↳/;
1301
+ // The configured grammar already makes Context a whole segment, so the item
1302
+ // test only has to establish that one is present.
1303
+ isConfiguredContextFooter(row) {
1304
+ return this.configuredHasContextItem()
1305
+ && new RegExp(CODEX_CONTEXT_ITEM, "iu").test(row)
1306
+ && this.isConfiguredStatusLineFooter(row);
1251
1307
  }
1252
- /** #1811: what the last launch left out and why — the Log tab and daemon.log, never a channel. */
1253
- quietLaunchNotes = [];
1254
- consumeQuietLaunchNotes() { const notes = this.quietLaunchNotes; this.quietLaunchNotes = []; return notes; }
1255
- buildCommand(config) {
1256
- this.lastKnownModel = config.model?.trim() || null;
1257
- this.credentialProfile = this.readProfile(config);
1258
- // #2886: `--full-auto` is gone from codex (no supported version, 0.155 on, accepts it: the instance never started);
1259
- // spelled out, it was a workspace-write sandbox that asks for approval on request.
1260
- const approvalFlag = config.skipPermissions !== false
1261
- ? "--dangerously-bypass-approvals-and-sandbox"
1262
- : "--sandbox workspace-write --ask-for-approval on-request";
1263
- // #984: never trust `codex resume --last` to pick this instance's session.
1264
- // Codex 0.157 scopes it to the git REPOSITORY, so in a worktree it resumes
1265
- // the newest session of any sibling worktree (a lock screen while that
1266
- // instance lives, a silent hijack otherwise), and a new instance in a
1267
- // shared repo does not start fresh. Resume the exact-cwd thread from the
1268
- // shared state DB instead; `--last` is only the fallback for an unreadable
1269
- // DB when no other Codex instance shares the repository.
1270
- let cmd;
1271
- this.launchWarning = null;
1272
- this.lastLaunchResumes = false;
1273
- // #2357: read-only (codex is never run here); a launch is not held for it — the operator is told once per launch.
1274
- this.packageWarning = codexPackageWarning(this.binaryPath);
1275
- if (config.skipResume) {
1276
- cmd = `${this.binaryPath} ${approvalFlag}`;
1277
- }
1278
- else {
1279
- const resumeBy = (id, why, bytes) => {
1280
- this.lastLaunchResumes = true;
1281
- this.writeResumeAttempt(id);
1282
- const large = bytes !== null && bytes > CODEX_RESUME_LARGE_BYTES ? ` ${t("codex.resume_large", String(Math.round(bytes / (1024 * 1024))))}` : "";
1283
- this.launchWarning = why + large;
1284
- return `${this.binaryPath} resume ${shellQuote(id)} ${approvalFlag}`;
1285
- };
1286
- const sessionsDir = join(this.isolatedCodexHome, "sessions");
1287
- // M-2266: the previous launch was told to resume a conversation by id. Codex records a thread as it opens it,
1288
- // so a resume that did not take (codex exited with "No saved session found…") left no row: this launch starts
1289
- // fresh, once, and says so. A database that cannot be read proves nothing, and planning goes on as usual.
1290
- // A new one-shot ask comes first: it is the person's explicit choice for this launch.
1291
- const oneShot = this.takeResumeNext();
1292
- const attempt = this.takeResumeAttempt();
1293
- const failed = !oneShot && attempt !== null && codexThreadRowExists(this.stateDbPath(), attempt) === false;
1294
- if (failed) {
1295
- // Remembered, so the auto-resume never picks this conversation again on a later launch.
1296
- this.rememberFailedResume(attempt);
1297
- cmd = `${this.binaryPath} ${approvalFlag}`;
1298
- this.launchWarning = t("codex.resume_failed", config.workingDirectory, attempt);
1299
- }
1300
- else if (oneShot) {
1301
- // M-2266: validated when it was asked for (restart_instance); checked again now, as the rollout may have moved.
1302
- const check = checkResumeId(sessionsDir, config.workingDirectory, oneShot);
1303
- if (check.ok)
1304
- cmd = resumeBy(check.rollout.id, t("codex.resume_oneshot", config.workingDirectory, check.rollout.id), check.rollout.bytes);
1305
- else {
1306
- cmd = this.plannedCommand(config, approvalFlag, sessionsDir, resumeBy);
1307
- this.launchWarning = [t("codex.resume_oneshot_invalid", config.workingDirectory, oneShot, check.reason), this.launchWarning].filter(Boolean).join("\n");
1308
- }
1309
- }
1310
- else {
1311
- cmd = this.plannedCommand(config, approvalFlag, sessionsDir, resumeBy);
1312
- }
1313
- }
1314
- if (config.model) {
1315
- const model = validateModel(config.model);
1316
- warnIfModelMismatch("codex", model);
1317
- cmd += ` -c ${shellQuote(`model="${model}"`)}`;
1318
- }
1319
- if (config.backendOptions?.provider) {
1320
- const provider = validateProvider(String(config.backendOptions.provider));
1321
- cmd += ` -c ${shellQuote(`model_provider="${provider}"`)}`;
1322
- }
1323
- // #1811: the configured effort, when the catalog entry of the model that will run lists it (launch-effort.ts); else
1324
- // a quiet note. That model is proven from the command line or the config files codex reads (#1813 review).
1325
- const runs = resolveCodexLaunchModel({
1326
- isolatedHome: this.isolatedCodexHome, sharedHome: this.sharedCodexHome,
1327
- model: config.model, workingDirectory: config.workingDirectory,
1328
- });
1329
- const effort = codexEffort(config.effort, runs.proven
1330
- ? readCodexModelEffortLevels({ isolatedHome: this.isolatedCodexHome, sharedHome: this.sharedCodexHome, model: runs.model })
1331
- : { model: runs.model, levels: null, unproven: true });
1332
- if (effort.arg)
1333
- cmd += effort.arg;
1334
- this.quietLaunchNotes = effort.note ? [effort.note] : [];
1335
- // AgEnD instances are unattended processes: an interactive self-update
1336
- // picker blocks delivery and must never be enabled by a copied global or
1337
- // managed config layer. Keep this last so the CLI override is authoritative.
1338
- // Both observed Codex 0.155.0 and 0.156.1 support this launch flag. Pin
1339
- // the initial layout so a user/global fullscreen preference cannot make a
1340
- // header-only pane look ready. A later unknown layout still fails closed.
1341
- cmd += " -c check_for_update_on_startup=false --no-alt-screen";
1342
- // codex 0.159's opt-in `instant_interrupt` makes new input steer the
1343
- // running response instead of queueing behind it, which AgEnD's delivery
1344
- // and queued-input (↳) handling assume. Keep it off whatever a user or
1345
- // global config says. Codex before 0.159 ignores the key with a startup
1346
- // warning ("`features.instant_interrupt` is ignored"); nothing else.
1347
- cmd += " -c features.instant_interrupt=false";
1348
- // CODEX_HOME is the only Codex-supported way to isolate the complete base
1349
- // config. A profile only layers over the shared config and would therefore
1350
- // still load every globally registered AgEnD MCP server.
1351
- return `CODEX_HOME=${shellQuote(this.isolatedCodexHome)} ${cmd}`;
1352
- }
1353
- writeConfig(config) {
1354
- this.authorizedTrust = null;
1355
- // Set before the home is prepared: which login this instance gets is a
1356
- // property of the home, and the home is built here.
1357
- this.credentialProfile = this.readProfile(config);
1358
- this.prepareIsolatedHome();
1359
- this.cleanSharedConfig();
1360
- // Copy all user settings but no AgEnD MCP entries into a private base
1361
- // config, then append only this instance's server(s). Each instance writes
1362
- // a distinct file, eliminating the old concurrent global-config race.
1363
- let content = "";
1364
- try {
1365
- content = stripAgendMcpTables(readFileSync(join(this.sharedCodexHome, "config.toml"), "utf-8"));
1366
- }
1367
- catch { /* a first-time Codex user may have no global config */ }
1368
- if (content && !content.endsWith("\n"))
1369
- content += "\n";
1370
- for (const [name, entry] of Object.entries(config.mcpServers)) {
1371
- content += `\n${renderMcpServer(name, entry, config.instanceName)}`;
1372
- }
1373
- atomicWritePrivate(join(this.isolatedCodexHome, "config.toml"), content);
1374
- this.enableContextStatusLine();
1375
- this.disableStartupUpdateCheck();
1376
- this.hideRateLimitModelNudge();
1377
- // Write fleet instructions into AGENTS.md (additive via marker block)
1378
- if (config.instructions) {
1379
- try {
1380
- const agentsMd = join(config.workingDirectory, "AGENTS.md");
1381
- appendWithMarker(agentsMd, config.instanceName, config.instructions);
1382
- // Warn if file exceeds Codex's project_doc_max_bytes limit
1383
- try {
1384
- const size = statSync(agentsMd).size;
1385
- if (size > CODEX_PROJECT_DOC_MAX_BYTES) {
1386
- console.warn(`[agend] AGENTS.md is ${size} bytes, exceeds Codex limit of ${CODEX_PROJECT_DOC_MAX_BYTES} — instructions may be truncated`);
1387
- }
1388
- }
1389
- catch { /* stat failed — skip size check */ }
1390
- }
1391
- catch { /* best effort */ }
1392
- }
1308
+ /** Any footer that proves the Context meter owns the bottom row. */
1309
+ isAnyContextFooter(row) {
1310
+ return isCodexContextFooter(row) || this.isConfiguredContextFooter(row);
1393
1311
  }
1394
1312
  /**
1395
- * Stop Codex opening its "Update available!" picker when an instance starts.
1396
- *
1397
- * That dialog owns the input loop until someone answers it, so after a fleet
1398
- * restart every Codex instance sat waiting on a keypress nobody was going to
1399
- * send. AgEnD then reported it as a stuck pane, which is true but unhelpful.
1400
- *
1401
- * `check_for_update_on_startup = false` is Codex's own config key (verified in
1402
- * the binary), so this prevents the prompt rather than racing to dismiss it.
1403
- * There is no CLI flag for it — `codex update` is a subcommand, not a switch.
1404
- *
1405
- * Placement matters: this is a TOP-LEVEL key, so it has to go above the first
1406
- * `[section]` header or TOML would read it as belonging to that section. And a
1407
- * AgEnD's isolated home is unattended, so an inherited `true` is replaced
1408
- * rather than preserved. TOML rejects duplicate keys, so replace in place.
1313
+ * #978 escape hatch: the live, EMPTY Codex composer within the last few
1314
+ * non-blank rows, no busy marker, and none of the known selection screens.
1315
+ * Deliberately says nothing about the footer, which is what is unknown.
1409
1316
  */
1410
- disableStartupUpdateCheck() {
1411
- const configPath = join(this.isolatedCodexHome, "config.toml");
1412
- let content = "";
1413
- try {
1414
- content = readFileSync(configPath, "utf-8");
1415
- }
1416
- catch {
1417
- return;
1418
- }
1419
- const existing = /^\s*check_for_update_on_startup\s*=\s*(?:true|false)\s*(?:#.*)?$/m;
1420
- if (existing.test(content)) {
1421
- const updated = content.replace(existing, "check_for_update_on_startup = false");
1422
- if (updated !== content) {
1423
- try {
1424
- atomicWritePrivate(configPath, updated);
1425
- }
1426
- catch { /* best effort */ }
1427
- }
1428
- return;
1429
- }
1430
- const LINE = "check_for_update_on_startup = false\n";
1431
- const firstSection = content.search(/^\s*\[/m);
1432
- const updated = firstSection === -1
1433
- ? (content.length && !content.endsWith("\n") ? `${content}\n${LINE}` : `${content}${LINE}`)
1434
- : `${content.slice(0, firstSection)}${LINE}${content.slice(firstSection)}`;
1435
- try {
1436
- atomicWritePrivate(configPath, updated);
1437
- }
1438
- catch { /* best effort */ }
1317
+ isStableUnknownLayoutIdlePane(pane) {
1318
+ if (this.getBusyPattern().test(pane))
1319
+ return false;
1320
+ // The composer is live-looking and the footer is unknown — exactly this
1321
+ // proof's blind spot — but there is no server behind it (#1099).
1322
+ if (codexAppServerDisconnected(pane))
1323
+ return false;
1324
+ // (No second, wider "esc to interrupt" match here: getBusyPattern() above already reads a live status row of ANY
1325
+ // title — #964 — and anchors it to the whole row at column zero, so a reply that quotes the phrase, indented or
1326
+ // in prose, cannot pin the escape hatch shut (#991).)
1327
+ // A retained queued message (`↳ …` under "Messages to be submitted after
1328
+ // next tool call") means work is pending, whatever the composer shows.
1329
+ if (/↳|Messages to be submitted/i.test(pane))
1330
+ return false;
1331
+ if (codexUsageLimitMenuVisible(pane) || codexRateSwitchVisible(pane)
1332
+ || codexUnknownSelectionVisible(pane) || codexUpdatePickerVisible(pane))
1333
+ return false;
1334
+ const rows = pane.replace(/\r/g, "").split("\n").filter(row => row.trim() !== "");
1335
+ return rows.slice(-6).some(row => /^[>›][ \t⋆]*Ask Codex to do anything[ \t⋆]*$/.test(row));
1439
1336
  }
1440
- /**
1441
- * Suppress Codex's rate-limit model-switch reminder for unattended instances.
1442
- * Codex documents this as `notice.hide_rate_limit_model_nudge` (a boolean in
1443
- * the `[notice]` table). This changes only the per-instance config; the
1444
- * runtime holdOnly dialog remains as defense-in-depth for older or changed
1445
- * CLI behavior. No model option is selected automatically.
1446
- */
1447
- hideRateLimitModelNudge() {
1448
- const configPath = join(this.isolatedCodexHome, "config.toml");
1449
- let content = "";
1450
- try {
1451
- content = readFileSync(configPath, "utf-8");
1452
- }
1453
- catch {
1454
- return;
1455
- }
1456
- const updated = setTomlTableBoolean(content, "notice", "hide_rate_limit_model_nudge");
1457
- if (updated !== content) {
1458
- try {
1459
- atomicWritePrivate(configPath, updated);
1460
- }
1461
- catch { /* best effort */ }
1462
- }
1337
+ isCodexIdleFooter(row) {
1338
+ return isCodexContextFooter(row) || this.isConfiguredStatusLineFooter(row);
1463
1339
  }
1464
- /**
1465
- * Ensure Codex's TUI status line shows context usage: the Context item is
1466
- * both what /ctx scrapes and the footer AgEnD's readiness proofs rely on.
1467
- * Rules (never drops or reorders the user's items):
1468
- * 1. the effective `tui.status_line` already has a context item
1469
- * (context-remaining / -usage / -used) → leave the config untouched.
1470
- * 2. no context item:
1471
- * - no status_line at all → write status_line = ["context-remaining"]
1472
- * - status_line exists → prepend "context-remaining" to it
1473
- * Best-effort string edit (no TOML writer), but every candidate edit is
1474
- * parsed back and kept only if the effective `tui.status_line` becomes
1475
- * `["context-remaining", ...the user's items]`. A `status_line` key in some
1476
- * other table is not the TUI's and must not be the one edited (#931). If no
1477
- * edit can be verified, the launch warns the operator instead of leaving the
1478
- * pane silently unready.
1479
- */
1480
- enableContextStatusLine() {
1481
- this.configuredStatusLineItems = undefined;
1482
- this.configuredStatusLinePattern = undefined;
1483
- this.statusLineWarning = null;
1484
- const configPath = join(this.isolatedCodexHome, "config.toml");
1485
- // The private copy is rebuilt from the shared one at every launch, so the
1486
- // operator must be pointed at the file their status_line actually lives in.
1487
- const sharedConfigPath = join(this.sharedCodexHome, "config.toml");
1488
- let content = "";
1489
- try {
1490
- content = readFileSync(configPath, "utf-8");
1491
- }
1492
- catch { /* no file yet */ }
1493
- const ITEM = "context-remaining";
1494
- const current = effectiveTuiStatusLine(content);
1495
- if (current === "invalid") {
1496
- this.statusLineWarning = t("codex.status_line_unverifiable", "tui.status_line is not a list of item names, or config.toml does not parse", sharedConfigPath);
1497
- return;
1498
- }
1499
- // Rule 1: the TUI already shows a context item → don't touch anything.
1500
- if (current?.some(item => CODEX_CONTEXT_STATUS_ITEM_RE.test(item)))
1501
- return;
1502
- // TOML allows quoted keys: `"status_line" = [...]`, `"tui"."status_line"`,
1503
- // `['tui']`. Every textual candidate is tried; parsing decides.
1504
- const candidates = [];
1505
- if (current) {
1506
- // Rule 2b: prepend our item to the user's existing array (don't overwrite).
1507
- // First position keeps "Context N% left" at the far left of the footer so a
1508
- // long cwd/other items can't push it past 80 cols and truncate it.
1509
- for (const m of content.matchAll(/["']?status_line["']?\s*=\s*\[([^\]]*)\]/g)) {
1510
- const inner = m[1].trim().replace(/^,\s*/, "").replace(/,\s*$/, "");
1511
- const newInner = inner.length ? `"${ITEM}", ${inner}` : `"${ITEM}"`;
1512
- candidates.push(`${content.slice(0, m.index)}status_line = [${newInner}]${content.slice(m.index + m[0].length)}`);
1513
- }
1514
- }
1515
- else {
1516
- // Rule 2a: no status_line at all → add a minimal one.
1517
- const base = content.length && !content.endsWith("\n") ? `${content}\n` : content;
1518
- // Also recognise quoted section headers: `["tui"]` and `['tui']`.
1519
- if (/^\[["']?tui["']?\][^\n]*\n/m.test(base)) {
1520
- candidates.push(base.replace(/^\[["']?tui["']?\][^\n]*\n/m, h => `${h}status_line = ["${ITEM}"]\n`));
1521
- }
1522
- candidates.push(`${base}\n[tui]\nstatus_line = ["${ITEM}"]\n`);
1523
- // A config that defines tui with dotted keys cannot take a [tui] table.
1524
- candidates.push(`tui.status_line = ["${ITEM}"]\n${base}`);
1525
- // Nor can an inline `tui = { … }` table: the item goes inside it.
1526
- candidates.push(base.replace(/^([ \t]*["']?tui["']?[ \t]*=[ \t]*\{)[ \t]*\}/m, `$1 status_line = ["${ITEM}"] }`));
1527
- candidates.push(base.replace(/^([ \t]*["']?tui["']?[ \t]*=[ \t]*\{)/m, `$1 status_line = ["${ITEM}"],`));
1528
- }
1529
- const wanted = [ITEM, ...(current ?? [])];
1530
- const fixed = candidates.find(candidate => {
1531
- const items = effectiveTuiStatusLine(candidate);
1532
- return Array.isArray(items) && items.length === wanted.length && items.every((item, i) => item === wanted[i]);
1533
- });
1534
- if (!fixed) {
1535
- this.statusLineWarning = t("codex.status_line_unverifiable", "no edit of tui.status_line could be verified", sharedConfigPath);
1536
- return;
1537
- }
1538
- try {
1539
- atomicWritePrivate(configPath, fixed);
1540
- }
1541
- catch (err) {
1542
- // Never block launch on statusline config — but a verified edit that
1543
- // could not be written leaves the pane as unready as an unfixable one.
1544
- const reason = `the verified edit could not be written: ${err.code ?? "write failed"}`;
1545
- this.statusLineWarning = t("codex.status_line_unverifiable", reason, sharedConfigPath);
1546
- }
1340
+ /** A proxy reply filters chrome per line; whole-pane readiness is separate. */
1341
+ isProxyReplyChromeLine(line) {
1342
+ return /^\s*[›>]\s+Ask Codex to do anything\s*$/.test(line)
1343
+ || this.isAnyContextFooter(line);
1547
1344
  }
1548
- /** Null when the instance did not ask for a profile — today's behaviour. */
1549
- readProfile(config) {
1550
- try {
1551
- return resolveCredentialProfile(config.backendOptions);
1552
- }
1553
- catch {
1554
- // A malformed name is refused where it is written; launching is not the
1555
- // place to discover it, and falling back to the shared login is the
1556
- // behaviour every instance had before profiles existed.
1557
- return null;
1558
- }
1345
+ getErrorPatterns() {
1346
+ return [
1347
+ // Specific quota codes must precede the generic HTTP 429 classifier:
1348
+ // OpenAI returns insufficient_quota with status 429, but switching models
1349
+ // cannot repair an exhausted account and would only start a failover loop.
1350
+ {
1351
+ pattern: new RegExp(String.raw `^\s*(?:${CODEX_STATUS_GLYPH}|Error:|API Error:)\s*[\s\S]{0,240}?\b(?:insufficient_quota|billing_hard_limit_reached|exceeded\s+your\s+current\s+quota)\b|^(?:${CODEX_STATUS_GLYPH}) Quota exceeded\. Check your plan and billing details\.\r?$`, "im"),
1352
+ type: "quota",
1353
+ action: "pause",
1354
+ message: "OpenAI quota exceeded",
1355
+ notice: () => quotaPausedLine("OpenAI", "api_quota"),
1356
+ },
1357
+ {
1358
+ // Codex already exhausted HTTP retries and returned to its composer.
1359
+ // The existing conditional continuation preserves context without
1360
+ // replaying earlier tool effects. Quota remains a preceding pause.
1361
+ pattern: new RegExp(`^${CODEX_EXHAUSTED_429_ROW}$`, "im"),
1362
+ type: "rate_limit",
1363
+ action: "nudge_continue",
1364
+ message: t("inst.codex_rate_retry_stopped"),
1365
+ skipCooldown: true,
1366
+ skipRecoveryWait: true,
1367
+ },
1368
+ {
1369
+ // Pane history contains the agent's own prose, source code and search
1370
+ // results. Bare `rate limit` used to fail over an otherwise healthy
1371
+ // Codex merely for discussing this regex. Match machine-readable API
1372
+ // forms or an error-decorated terminal line instead.
1373
+ pattern: new RegExp(String.raw `^\s*unexpected\s+status\s+429\b|^(?![\s\S]{0,240}?${CODEX_EXHAUSTED_429_ROW})[ \t]*(?:${CODEX_STATUS_GLYPH}|Error:|API Error:)\s*[\s\S]{0,240}?(?:["'](?:status|code)["']\s*:\s*429\b|\b(?:rate_limit_exceeded|too_many_requests)\b|\brate limit(?:ed| exceeded| reached)?\b|\btoo many requests\b)`, "im"),
1374
+ type: "rate_limit",
1375
+ action: "failover",
1376
+ message: "OpenAI rate limit reached",
1377
+ },
1378
+ {
1379
+ // Same false-positive boundary as rate limits: `authentication` is a
1380
+ // normal English/code word. Require a structured 401/code or a
1381
+ // decorated CLI error line before pausing every instance on the shared
1382
+ // credential.
1383
+ pattern: new RegExp(String.raw `^\s*unexpected\s+status\s+401\b|^\s*(?:${CODEX_STATUS_GLYPH}|Error:|API Error:)\s*[\s\S]{0,240}?(?:["'](?:status|code)["']\s*:\s*401\b|\b(?:invalid_api_key|authentication_error)\b|\b401\s+Unauthorized\b|\bauthentication (?:failed|error)\b|\binvalid api key\b)`, "im"),
1384
+ type: "auth_error",
1385
+ action: "pause",
1386
+ message: "OpenAI authentication error",
1387
+ },
1388
+ // Codex writes the apostrophe as U+2019 ("You’ve hit your usage limit.") since
1389
+ // 0.156 and as ASCII before (0.153.4): both must match, or no usage limit
1390
+ // ever pauses the instance (#1098).
1391
+ { pattern: /you['’]ve hit your usage limit/i, type: "quota", action: "pause", message: "Codex usage limit reached — upgrade plan required",
1392
+ notice: () => quotaPausedLine("Codex", "usage") },
1393
+ {
1394
+ // The terminal stage of a lost app-server (#1099): Codex has given up
1395
+ // reconnecting and says so, with a counter that never stops. Nothing
1396
+ // recovers from here without a relaunch, and every message sent in the
1397
+ // meantime waits for an idle that cannot come. Only the LIVE row counts:
1398
+ // directly above the LAST composer with no later transcript item or composer
1399
+ // (the same test as codexAppServerDisconnected, as a lookahead), so text that
1400
+ // merely quotes it does not raise this.
1401
+ pattern: new RegExp(String.raw `^[ \t]*•[ \t]+Reconnect failed[ \t]+—[ \t]+check the endpoint, then relaunch[ \t]+\(\d+[hms](?:[ \t]+\d+[hms])*\)[ \t]*$`
1402
+ + String.raw `(?=\n(?:[ \t]*\n)*[›>][^\n]*(?:\n(?![•■⚠›>])[^\n]*)*(?![\s\S]))`, "mu"),
1403
+ type: "network",
1404
+ action: "notify",
1405
+ message: "Codex lost its app-server connection and could not reconnect — restart the instance (messages cannot be delivered until then)",
1406
+ },
1407
+ {
1408
+ // Codex reports an unknown model either as a TUI metadata fallback or
1409
+ // as a ChatGPT-account API rejection. Use whitespace-aware phrases so
1410
+ // capture-pane hard wraps do not hide either form.
1411
+ // Codex quotes the slug with BACKTICKS ("Model metadata for `x` not found.",
1412
+ // verified live on 0.160.0 and in the 0.153.4–0.160.0 binaries). The old
1413
+ // pattern only took ASCII quotes, so it could never match a real line.
1414
+ pattern: /model\s+metadata\s+for\s+['"`‘’“”][^'"`‘’“”]+['"`‘’“”]\s+not\s+found\.\s+defaulting\s+to\s+fallback\s+metadata|model\s+is\s+not\s+supported\s+when\s+using\s+codex\s+with\s+a\s+chatgpt\s+account/i,
1415
+ type: "model_error",
1416
+ action: "notify",
1417
+ message: "Codex model unavailable — use /model to switch",
1418
+ },
1419
+ {
1420
+ // A capacity rejection is a completed failed turn: Codex returns to its
1421
+ // prompt without an answer, with its context intact. Keep this anchored to
1422
+ // the exact decorated TUI line so ordinary prose about model capacity
1423
+ // cannot trigger anything on an otherwise healthy instance. The status
1424
+ // glyph is decoration that changes between Codex versions and error classes
1425
+ // (`■` U+25A0 on 0.159.2 and 0.160.0, `⚠` U+26A0 before), so any one
1426
+ // "Other Symbol" glyph (optionally with its emoji selector) opens the line —
1427
+ // never a bullet, dash, quote marker or number, which prose and the model's
1428
+ // own transcript items use (`•`, `-`, `>`). The sentence must fill the line,
1429
+ // from column 0. Box drawing and block elements (U+2500–U+259F) are
1430
+ // excluded up front: they are `So` too, but a left-border popup or
1431
+ // table row (`│ …`) is chrome, not a status line. The CLI is
1432
+ // already back at the prompt, so skipRecoveryWait avoids an extra wait.
1433
+ // action "nudge_continue": tell the user, then about a minute later tell
1434
+ // the agent to keep going (the lifecycle bounds this to 3 per 30 minutes,
1435
+ // then pauses; see #905). No restart — nothing would re-send the turn — and
1436
+ // no model switch. skipCooldown: each NEW capacity line is a new episode,
1437
+ // including a second one right after the nudge.
1438
+ pattern: /^(?![─-▟])\p{So}\uFE0F? Selected model is at capacity\. Please try a different model\.\r?$/mu,
1439
+ type: "model_error",
1440
+ action: "nudge_continue",
1441
+ message: t("inst.codex_model_capacity"),
1442
+ skipCooldown: true,
1443
+ skipRecoveryWait: true,
1444
+ },
1445
+ // Workspace (business) accounts report exhaustion differently from personal
1446
+ // ones, with codex's own rows (codex-rs/protocol error.rs and tui
1447
+ // turn_runtime.rs, unchanged 0.160.0–0.165.0):
1448
+ // member: "■ Your workspace is out of credits. Ask your workspace owner to refill in order to continue."
1449
+ // "■ You hit your spend cap set by the owner of your workspace. Ask an owner to increase your spend cap to continue."
1450
+ // owner: "■ You're out of credits. Your workspace is out of credits. Add credits to continue using Codex."
1451
+ // "■ Your workspace is out of credits. Add credits to continue."
1452
+ // "■ You hit your spend cap set in your workspace. Increase your spend cap to continue."
1453
+ // "■ Usage limit reached. You've reached your usage limit. Increase your limits to continue using codex."
1454
+ // Neither `insufficient_quota|billing` nor `you've hit your usage limit`
1455
+ // matches them.
1456
+ //
1457
+ // pause, not notify: nothing works until someone refills or raises the cap.
1458
+ // Anchored to the status glyph in COLUMN 0, because these skip the
1459
+ // usage-window check (a workspace limit is not one of those windows, so the
1460
+ // check would call it "available"): codex draws its own error cells there,
1461
+ // while an agent's message, quote or code block is indented under its `•`
1462
+ // (captured live, tests/fixtures/codex-0165-workspace-quoted.pane.txt).
1463
+ // `\s+` at each word gap: capture-pane runs without -J, so tmux's hard wrap
1464
+ // can land a newline anywhere in the sentence. A resumed transcript reprints
1465
+ // these rows, and the first live composer of a spawn takes them as history.
1466
+ {
1467
+ pattern: new RegExp(String.raw `^(?:${CODEX_STATUS_GLYPH})[ \t]+(?:You['’]re\s+out\s+of\s+credits\.\s+)?Your\s+workspace\s+is\s+out\s+of\s+credits\.`, "m"),
1468
+ type: "quota",
1469
+ action: "pause",
1470
+ message: "Codex workspace credits exhausted — workspace owner must refill",
1471
+ notice: () => quotaPausedLine("Codex", "workspace_credits"),
1472
+ skipUsageVerify: true,
1473
+ historyUntilLiveComposer: true,
1474
+ },
1475
+ {
1476
+ pattern: new RegExp(String.raw `^(?:${CODEX_STATUS_GLYPH})[ \t]+You\s+hit\s+your\s+spend\s+cap\s+set\s+(?:by\s+the\s+owner\s+of|in)\s+your\s+workspace\.`, "m"),
1477
+ type: "quota",
1478
+ action: "pause",
1479
+ message: "Codex workspace spend cap reached — workspace owner must raise it",
1480
+ notice: () => t("inst.quota_spend_cap"),
1481
+ skipUsageVerify: true,
1482
+ historyUntilLiveComposer: true,
1483
+ },
1484
+ {
1485
+ pattern: new RegExp(String.raw `^(?:${CODEX_STATUS_GLYPH})[ \t]+Usage\s+limit\s+reached\.\s+You['’]ve\s+reached\s+your\s+usage\s+limit\.\s+Increase\s+your\s+limits`, "m"),
1486
+ type: "quota",
1487
+ action: "pause",
1488
+ message: "Codex workspace usage limit reached — increase the workspace limits to continue",
1489
+ notice: () => quotaPausedLine("Codex", "workspace_usage"),
1490
+ skipUsageVerify: true,
1491
+ historyUntilLiveComposer: true,
1492
+ },
1493
+ // Codex warns at 10% and 5% remaining, and scopes the limit by period —
1494
+ // "weekly" alone missed every `monthly limit` warning.
1495
+ //
1496
+ // `\s+` at EVERY word gap (not literal spaces) because capture-pane runs without -J,
1497
+ // so tmux's hard wrap can land a newline (plus continuation-line padding)
1498
+ // at any of these word gaps. The trailing "Run /status for a breakdown."
1499
+ // is deliberately NOT part of the pattern — that tail is what actually
1500
+ // wrapped in the reported case.
1501
+ //
1502
+ // `of your <period> limit` is load-bearing: it's what keeps the pattern
1503
+ // off the agent's own prose about percentages.
1504
+ {
1505
+ pattern: /less\s+than\s+(\d+)\s*%\s+of\s+your\s+(hourly|daily|weekly|monthly)\s+limit/i,
1506
+ type: "quota",
1507
+ action: "notify",
1508
+ message: "Codex usage limit running low",
1509
+ quotaAdvisory: true,
1510
+ formatMessage: (m) => `Codex ${m[2].toLowerCase()} limit: less than ${m[1]}% left`,
1511
+ notice: (m) => (m ? quotaLowLine(m[2], m[1]) : quotaLine("Codex", "usage")),
1512
+ },
1513
+ ];
1514
+ }
1515
+ getStartupDialogs() {
1516
+ const trustHold = this.trustHoldDialog();
1517
+ return [
1518
+ this.autoTrustDialog(),
1519
+ trustHold,
1520
+ this.updatePickerDialog(),
1521
+ this.rateSwitchPickerDialog(),
1522
+ ...this.sessionHoldDialogs(),
1523
+ this.unknownSelectionHoldDialog(),
1524
+ ];
1559
1525
  }
1560
1526
  /**
1561
- * Where this instance's `auth.json` comes from.
1562
- *
1563
- * The shared home unless a profile says otherwise. A profile owns the file
1564
- * itself — not a copy, not a link — so codex refreshing the token writes
1565
- * into that subscription and no other.
1527
+ * #984: session-selection screens only a human may answer. Held (never
1528
+ * keyed) so the delivery gate keeps messages queued and dialog_parked tells
1529
+ * the operator; listed before the generic selection hold for a clear notice.
1566
1530
  */
1567
- authSourceDir() {
1568
- if (!this.credentialProfile)
1569
- return this.sharedCodexHome;
1570
- const spec = credentialHomeSpec(this.binaryName);
1571
- if (!spec)
1572
- return this.sharedCodexHome;
1573
- const home = credentialProfileHome(getAgendHome(), this.binaryName, this.credentialProfile);
1574
- prepareCredentialProfileHome(spec, home);
1575
- return home;
1576
- }
1577
- preTrust(workDir) {
1578
- this.authorizedTrust = null;
1579
- const paths = codexTrustPaths(workDir);
1580
- const configPath = join(this.isolatedCodexHome, "config.toml");
1581
- let content = "";
1582
- try {
1583
- content = readFileSync(configPath, "utf-8");
1584
- }
1585
- catch { }
1586
- const updated = setProjectTrusted(content, paths.root);
1587
- if (updated !== content)
1588
- atomicWritePrivate(configPath, updated);
1589
- // Do not authorize an automatic Enter merely because the write returned:
1590
- // a stale/untrusted section in the effective isolated config must fail shut.
1591
- const onDisk = readFileSync(configPath, "utf-8");
1592
- if (effectiveProjectTrust(onDisk, paths.root) !== "trusted")
1593
- throw new Error("Codex project trust did not persist");
1594
- this.authorizedTrust = paths;
1531
+ sessionHoldDialogs() {
1532
+ return [
1533
+ {
1534
+ pattern: /This conversation is open in another app/,
1535
+ keys: [],
1536
+ description: "Codex session is open in another process (thread lock) — close the other one and press r, or fork manually",
1537
+ holdOnly: true,
1538
+ blocksDelivery: true,
1539
+ inputBlocked: true,
1540
+ remoteCard: codexSelectionCard,
1541
+ isActive: codexSessionLockVisible,
1542
+ },
1543
+ {
1544
+ pattern: /Working directory · resume/,
1545
+ keys: [],
1546
+ description: "Codex resume selected a session from another directory (sibling git worktree) — needs a human choice",
1547
+ holdOnly: true,
1548
+ blocksDelivery: true,
1549
+ inputBlocked: true,
1550
+ remoteCard: codexSelectionCard,
1551
+ isActive: codexResumeCwdPickerVisible,
1552
+ },
1553
+ ];
1595
1554
  }
1596
1555
  /**
1597
- * Preserve Codex login/session/cache sharing while isolating config.toml
1598
- * and the CODEX_HOME-scoped app-server daemon/control runtime directories.
1556
+ * The user's decision (hmsg-53600a2c): codex's folder-trust prompt in an AgEnD session is always answered Trust — the
1557
+ * workspace is the agent's own, whatever preTrust covered (preTrust stays, so the prompt rarely shows at all). Enter,
1558
+ * only with the cursor on "Trust and continue" among the known options (trustCursor); any other layout or row is
1559
+ * held (trustHoldDialog). It trusts the folder only: per-action approvals are separate dialogs and are not touched.
1599
1560
  */
1600
- /** Session dirs every instance must share with the terminal CLI (#506). */
1601
- static SHARED_SESSION_DIRS = ["sessions", "archived_sessions"];
1602
- static PRIVATE_RUNTIME_DIRS = new Set(["app-server-daemon", "app-server-control"]);
1603
- prepareIsolatedHome() {
1604
- mkdirSync(this.isolatedCodexHome, { recursive: true, mode: 0o700 });
1605
- chmodSync(this.isolatedCodexHome, 0o700);
1606
- if (this.sharedCodexHome === this.isolatedCodexHome)
1607
- return;
1608
- // #1034: Codex's private socket directory check rejects directory symlinks.
1609
- // Detach only the exact shared-home links the old mirror pass created,
1610
- // including dangling links. Leave private directories and other links
1611
- // alone; Codex will create its own real runtime directories on launch.
1612
- for (const name of CodexBackend.PRIVATE_RUNTIME_DIRS) {
1613
- const target = join(this.isolatedCodexHome, name);
1614
- try {
1615
- if (lstatSync(target).isSymbolicLink()
1616
- && readlinkSync(target) === join(this.sharedCodexHome, name)) {
1617
- unlinkSync(target);
1618
- }
1619
- }
1620
- catch { /* absent, or another startup already detached the link */ }
1621
- }
1622
- // The session dirs must exist in the SHARED home before the symlink pass:
1623
- // on a fresh install they don't yet, so no link was created, and the first
1624
- // archive made Codex create a REAL dir in the instance-private home — a
1625
- // permanent fork the terminal CLI could never see (#506). mkdir -p is
1626
- // EEXIST-safe under concurrent instance startup.
1627
- for (const dir of CodexBackend.SHARED_SESSION_DIRS) {
1628
- try {
1629
- mkdirSync(join(this.sharedCodexHome, dir), { recursive: true, mode: 0o700 });
1630
- }
1631
- catch { /* best effort */ }
1632
- }
1633
- // Heal homes that already forked: merge the private real dir back into the
1634
- // shared one (never overwriting), then replace it with the symlink.
1635
- for (const dir of CodexBackend.SHARED_SESSION_DIRS) {
1636
- this.migrateDivergedSessionDir(dir);
1637
- }
1638
- // Older versions linked SQLite's WAL/SHM files independently of their
1639
- // base database. If the base file had already been created privately,
1640
- // that split one SQLite database across two homes and caused CANTOPEN (or
1641
- // worse, cross-database journal recovery). Remove only links AgEnD made to
1642
- // the matching shared-home path; real private sidecars remain untouched.
1643
- const healedSidecars = [];
1644
- for (const name of readdirSync(this.isolatedCodexHome)) {
1645
- if (!SQLITE_SIDECAR_RE.test(name))
1646
- continue;
1647
- const target = join(this.isolatedCodexHome, name);
1648
- try {
1649
- if (!lstatSync(target).isSymbolicLink())
1650
- continue;
1651
- const linkTarget = resolve(dirname(target), readlinkSync(target));
1652
- if (linkTarget !== join(this.sharedCodexHome, name))
1653
- continue;
1654
- unlinkSync(target);
1655
- healedSidecars.push(name);
1656
- }
1657
- catch {
1658
- // A concurrent process may remove an ephemeral sidecar/link first.
1659
- }
1660
- }
1661
- if (healedSidecars.length > 0) {
1662
- console.warn(`[agend] removed unsafe Codex SQLite sidecar links: ${healedSidecars.join(", ")}`);
1663
- }
1664
- // One file, possibly from somewhere else. Everything below is unchanged:
1665
- // sessions, the thread/state/memory databases and every cache still come
1666
- // from the shared home, which is why switching subscription does not throw
1667
- // the conversation away.
1668
- this.linkAuthFile();
1669
- for (const name of readdirSync(this.sharedCodexHome)) {
1670
- if (CodexBackend.PRIVATE_RUNTIME_DIRS.has(name))
1671
- continue;
1672
- if (name === "config.toml" || name === AGEND_MCP_CLEANUP_LOCK || name.startsWith(".config.toml."))
1673
- continue;
1674
- if (name === CODEX_AUTH_FILE)
1675
- continue; // handled above, possibly from a profile
1676
- // SQLite resolves a symlinked base DB to the shared path and creates its
1677
- // own adjacent sidecars there. Linking sidecars separately is redundant
1678
- // for shared bases and corrupts the file set for private bases.
1679
- if (SQLITE_SIDECAR_RE.test(name))
1680
- continue;
1681
- const source = join(this.sharedCodexHome, name);
1682
- const target = join(this.isolatedCodexHome, name);
1683
- if (existsSync(target))
1684
- continue;
1685
- try {
1686
- const type = lstatSync(source).isDirectory() ? "dir" : "file";
1687
- symlinkSync(source, target, type);
1688
- }
1689
- catch {
1690
- // State/cache links are compatibility aids; config isolation must not
1691
- // fail merely because a concurrently-created cache entry disappeared.
1692
- }
1693
- }
1561
+ autoTrustDialog() {
1562
+ return {
1563
+ pattern: /^\s*Trust this folder\?/m,
1564
+ keys: ["Enter"],
1565
+ description: "Codex folder trust — trusting the agent's own folder",
1566
+ blocksDelivery: true,
1567
+ inputBlocked: true,
1568
+ autoResolutionKey: "codex-folder-auto-trust",
1569
+ // One Enter per prompt (claimed, then checked): a prompt still up after it is held, never pressed again (#2896 review).
1570
+ verifyAfterKeys: true,
1571
+ isActive: pane => codexTrustPromptState(pane).trustCursor,
1572
+ answerDetail: pane => ({ autoTrusted: true, ...this.trustPaneFields(pane) }),
1573
+ };
1574
+ }
1575
+ trustHoldDialog() {
1576
+ return {
1577
+ pattern: /^\s*(?:Folder access|Trust this folder\?|Do you trust the files in this folder\?)/im,
1578
+ keys: [],
1579
+ description: "Codex folder trust needs human confirmation",
1580
+ holdOnly: true,
1581
+ blocksDelivery: true,
1582
+ inputBlocked: true,
1583
+ isActive: codexTrustVariantActive,
1584
+ remoteCard: codexSelectionCard,
1585
+ heldReason: pane => this.trustHoldReason(pane),
1586
+ };
1694
1587
  }
1695
1588
  /**
1696
- * Point this home's `auth.json` at whichever login it should use.
1589
+ * #1008: the rate-limit model-switch picker parked unattended instances (it
1590
+ * waits forever and its default option changes the model). Prevention is
1591
+ * `notice.hide_rate_limit_model_nudge` (hideRateLimitModelNudge — real and
1592
+ * effective on 0.157.1 and 0.159.2, verified live); this is the answer for a
1593
+ * picker that appears anyway (config not applied, a CLI that moved the key).
1697
1594
  *
1698
- * Codex refreshes the token by writing through the link rather than replacing
1699
- * it — observed across every instance home on a machine that has been running
1700
- * this arrangement for months, with the shared file's mtime moving. That is
1701
- * behaviour, though, not a contract: a release that starts renaming over the
1702
- * file would leave a real file here and quietly fork the login, with refreshes
1703
- * landing somewhere the profile never sees. So a real file where a link
1704
- * belongs is treated as exactly that — reported, and put back.
1595
+ * Escape, not a navigated Enter: it selects nothing, so it can never take
1596
+ * option 1 (switch model) or option 3 (writes "never show again" into the
1597
+ * config). Deliberately not one-shot: if the picker swallowed the key it is
1598
+ * simply sent again on the next poll, and a repeated Escape is harmless.
1705
1599
  */
1706
- linkAuthFile() {
1707
- const source = join(this.authSourceDir(), CODEX_AUTH_FILE);
1708
- const target = join(this.isolatedCodexHome, CODEX_AUTH_FILE);
1709
- let existing = null;
1710
- try {
1711
- existing = lstatSync(target);
1712
- }
1713
- catch { /* absent */ }
1714
- if (existing?.isSymbolicLink()) {
1715
- let current = "";
1716
- try {
1717
- current = resolve(dirname(target), readlinkSync(target));
1718
- }
1719
- catch { /* unreadable */ }
1720
- if (current === source)
1721
- return;
1722
- try {
1723
- unlinkSync(target);
1724
- }
1725
- catch { /* raced */ }
1726
- }
1727
- else if (existing) {
1728
- // Not a link: codex replaced it, or an older AgEnD copied it. Either way
1729
- // the refreshes it has been collecting are stranded in this instance's
1730
- // home, so say so rather than deleting them silently.
1731
- const stranded = `${target}.replaced-${Date.now()}`;
1732
- try {
1733
- renameSync(target, stranded);
1734
- console.warn(`[agend] codex replaced ${CODEX_AUTH_FILE} in ${this.isolatedCodexHome} with a real file — `
1735
- + `its login was no longer shared. Kept a copy at ${stranded} and re-linked to ${source}.`);
1736
- }
1737
- catch {
1738
- return; // cannot move it; leave the instance working on what it has
1739
- }
1740
- }
1741
- if (!existsSync(source))
1742
- return; // not logged in yet; codex will create it
1743
- try {
1744
- symlinkSync(source, target, "file");
1745
- }
1746
- catch {
1747
- // EEXIST from a concurrent start is the ordinary case and means the link
1748
- // is already there.
1749
- }
1600
+ rateSwitchPickerDialog() {
1601
+ return {
1602
+ // Documentation only: Daemon.dialogMatches uses isActive INSTEAD of this
1603
+ // pattern, so it filters nothing here — the structural check below is the
1604
+ // whole decision, and ordinary prose about the picker fails it. The words
1605
+ // are the picker's own, kept so a reader can find the screen from the log.
1606
+ pattern: /Keep current model \(never show again\)/,
1607
+ keys: ["Escape"],
1608
+ description: "Codex rate-limit model-switch picker — Escape keeps the current model",
1609
+ blocksDelivery: true,
1610
+ inputBlocked: true,
1611
+ isActive: codexRateSwitchPickerVisible,
1612
+ };
1750
1613
  }
1751
- /**
1752
- * One-time heal for an instance whose isolated home grew a REAL session dir
1753
- * (#506): merge it into the shared home without overwriting anything, and
1754
- * only after both the copy and the removal succeed put the symlink in its
1755
- * place. Any failure keeps the private dir — sessions are never the thing
1756
- * sacrificed for tidiness — and logs what happened.
1757
- */
1758
- migrateDivergedSessionDir(name) {
1759
- const target = join(this.isolatedCodexHome, name);
1760
- let st;
1761
- try {
1762
- st = lstatSync(target);
1763
- }
1764
- catch {
1765
- return; // absent — the symlink pass below will create the link
1766
- }
1767
- if (st.isSymbolicLink())
1768
- return; // already correct
1769
- if (!st.isDirectory()) {
1770
- console.warn(`[agend] codex-home/${name} is neither a symlink nor a directory — leaving it untouched`);
1771
- return;
1772
- }
1773
- const shared = join(this.sharedCodexHome, name);
1774
- try {
1775
- mkdirSync(shared, { recursive: true, mode: 0o700 });
1776
- // cp -rn semantics: collisions keep the shared copy. Session rollout
1777
- // filenames are timestamp+uuid, so a genuine collision means the same
1778
- // file — skipping is lossless either way.
1779
- cpSync(target, shared, { recursive: true, force: false, errorOnExist: false });
1780
- rmSync(target, { recursive: true });
1781
- symlinkSync(shared, target, "dir");
1782
- console.warn(`[agend] migrated diverged codex ${name} into shared home: ${shared}`);
1783
- }
1784
- catch (err) {
1785
- // Keep whatever is left of the private dir. The copy never overwrites, so
1786
- // a retry on next start is safe; worst case is duplicated files in the
1787
- // shared home, never lost ones.
1788
- console.warn(`[agend] codex ${name} migration failed — keeping the instance-private dir (${err.message})`);
1789
- }
1790
- }
1791
- /**
1792
- * One-time migration for installations polluted by the old global `codex
1793
- * mcp add` path. The lock protects separate fleet processes/upgrades, and
1794
- * atomic rename prevents readers from observing a truncated config.
1795
- */
1796
- cleanSharedConfig() {
1797
- if (this.sharedCodexHome === this.isolatedCodexHome)
1798
- return;
1799
- mkdirSync(this.sharedCodexHome, { recursive: true, mode: 0o700 });
1800
- const lockPath = join(this.sharedCodexHome, AGEND_MCP_CLEANUP_LOCK);
1801
- let lockFd;
1802
- const acquire = () => {
1803
- try {
1804
- lockFd = openSync(lockPath, "wx", 0o600);
1805
- return true;
1806
- }
1807
- catch {
1808
- return false;
1809
- }
1614
+ updatePickerDialog() {
1615
+ return {
1616
+ // Defense in depth for config written by older AgEnD versions or a Codex
1617
+ // regression. Match the release URL as well as the banner so ordinary
1618
+ // agent prose cannot trigger a keypress.
1619
+ pattern: /Update available![\s\S]{0,200}Release notes: https:\/\/github\.com\/openai\/codex\/releases/m,
1620
+ keys: ["Escape"],
1621
+ description: "Codex startup update-available picker",
1622
+ // A delivery must never land on this screen. Its selected option is
1623
+ // `› 1. Update now (runs … curl … | sh)` — the same `›` the input row
1624
+ // uses — so an Enter here runs an installer instead of sending a message.
1625
+ // The runtime dismisser presses Escape, but it only polls every few
1626
+ // seconds and a delivery can arrive first (hit live on codex-cli 0.153.4,
1627
+ // which parks on this picker for as long as nobody answers it).
1628
+ blocksDelivery: true,
1629
+ // Daemon.dialogMatches uses isActive INSTEAD OF pattern when present.
1630
+ // Check the complete current picker here; a different Enter-only menu
1631
+ // must never receive this automatic Escape key.
1632
+ isActive: codexUpdatePickerVisible,
1810
1633
  };
1811
- if (!acquire()) {
1812
- try {
1813
- if (Date.now() - statSync(lockPath).mtimeMs > AGEND_MCP_CLEANUP_LOCK_STALE_MS) {
1814
- unlinkSync(lockPath);
1815
- if (!acquire())
1816
- return;
1817
- }
1818
- else {
1819
- return;
1820
- }
1821
- }
1822
- catch {
1823
- return;
1824
- }
1825
- }
1826
- try {
1827
- const configPath = join(this.sharedCodexHome, "config.toml");
1828
- let content;
1829
- try {
1830
- content = readFileSync(configPath, "utf-8");
1831
- }
1832
- catch {
1833
- return;
1834
- }
1835
- const cleaned = stripAgendMcpTables(content);
1836
- if (cleaned !== content)
1837
- atomicWritePrivate(configPath, cleaned);
1838
- }
1839
- finally {
1840
- if (lockFd !== undefined) {
1841
- try {
1842
- closeSync(lockFd);
1843
- }
1844
- catch { }
1845
- }
1846
- try {
1847
- unlinkSync(lockPath);
1848
- }
1849
- catch { }
1850
- }
1851
- }
1852
- getReadyPattern() {
1853
- // Header and context text persist in inline scrollback and even while the
1854
- // CLI is loading or a modal owns stdin. Require the live prompt followed
1855
- // by the Context footer at the *end* of the capture. A valid custom
1856
- // status_line without Context gets a separate configured-item pattern;
1857
- // unknown footer values still fail closed. getBusyPattern vetoes a working
1858
- // turn whose empty composer remains visible.
1859
- // U+22C6 is Codex's observed cosmetic starfield; it can be drawn in the
1860
- // prompt, between prompt/footer, and below the footer. A drafted composer
1861
- // is also idle once this same bottom footer proves it owns the screen.
1862
- const contextReady = withCodexPassiveHintTail(/(?:^|\n)[>›][ \t⋆]+(?!\d+\.)\S[^\r\n]*\r?\n(?:[ \t⋆]*\r?\n){0,3}[ \t⋆]+(?:[0-9a-f-]{36}[ \t]+·[ \t]+)?Context[ \t]+(?:\d+%[ \t]+(?:left|used)|\d+…|…)[^\r\n]*(?:\r?\n[ \t⋆]*)*$/i);
1863
- const footerPattern = this.configuredStatusLineFooterPattern();
1864
- if (!footerPattern)
1865
- return contextReady;
1866
- // The no-Context alternative requires the exact empty composer followed by
1867
- // a recognized configured Codex status_line value. If run-state is
1868
- // configured, that value must specifically be Ready. This is positive
1869
- // structural proof, never a deny-list of known dialogs.
1870
- const footerSource = footerPattern.source.slice(1, -1);
1871
- const noContextReady = withCodexPassiveHintTail(new RegExp(String.raw `(?:^|\n)[>›][ \t⋆]*Ask Codex to do anything[ \t⋆]*\r?\n(?:[ \t⋆]*\r?\n){0,3}${footerSource}(?:\r?\n[ \t⋆]*)*$`, "iu"));
1872
- // #978: a configured footer that carries a Context item in any position
1873
- // is the Context footer: same drafted-composer rule as Context-first. The
1874
- // whole row must match the configured item grammar, so an arbitrary
1875
- // indented line that merely contains `Context N% left` cannot pass.
1876
- const configuredContextReady = this.configuredHasContextItem()
1877
- ? withCodexPassiveHintTail(new RegExp(String.raw `(?:^|\n)[>›][ \t⋆]+(?!\d+\.)\S[^\r\n]*\r?\n(?:[ \t⋆]*\r?\n){0,3}(?=[^\r\n]*${CODEX_CONTEXT_ITEM})${footerSource}(?:\r?\n[ \t⋆]*)*$`, "iu"))
1878
- : null;
1879
- return new RegExp([contextReady.source, noContextReady.source, configuredContextReady?.source]
1880
- .filter((source) => !!source)
1881
- .map(source => `(?:${source})`)
1882
- .join("|"), "iu");
1883
- }
1884
- readConfiguredStatusLineItems() {
1885
- if (this.configuredStatusLineItems !== undefined)
1886
- return this.configuredStatusLineItems;
1887
- try {
1888
- const config = tomlTable(parseToml(readFileSync(join(this.isolatedCodexHome, "config.toml"), "utf-8")));
1889
- const tui = tomlTable(config?.tui);
1890
- const items = tui?.status_line;
1891
- this.configuredStatusLineItems = Array.isArray(items) && items.every(item => typeof item === "string")
1892
- ? items
1893
- : null;
1894
- }
1895
- catch {
1896
- this.configuredStatusLineItems = null;
1897
- }
1898
- return this.configuredStatusLineItems;
1899
1634
  }
1900
- configuredStatusLineFooterPattern() {
1901
- if (this.configuredStatusLinePattern !== undefined)
1902
- return this.configuredStatusLinePattern;
1903
- const items = this.readConfiguredStatusLineItems();
1904
- if (!items?.length)
1905
- return this.configuredStatusLinePattern = null;
1906
- const configuredPatterns = items
1907
- .map(item => CODEX_STATUS_LINE_VALUE_PATTERNS[item])
1908
- .filter((pattern) => pattern !== undefined);
1909
- if (!configuredPatterns.length)
1910
- return this.configuredStatusLinePattern = null;
1911
- const segment = `(?:${configuredPatterns.join("|")})`;
1912
- const separator = String.raw `[ \t]+·[ \t]+`;
1913
- const hasRunState = items.some(item => CODEX_RUN_STATE_STATUS_ITEMS.has(item));
1914
- // Ready must occupy its own status-line segment. Other configured items
1915
- // may precede/follow it, as Codex joins visible values with ` · `.
1916
- const line = hasRunState
1917
- ? `(?:${segment}${separator})*Ready(?:${separator}${segment})*`
1918
- : `${segment}(?:${separator}${segment})*`;
1919
- // The configured items, then (optionally) the CLI's own native fields — the same rule as the Context-first footer, so a
1920
- // `model · Context 46% left Goal achieved (1h 6m)` row is the footer too, and the readiness regex built from this
1921
- // source (footerSource) says the same.
1922
- this.configuredStatusLinePattern = new RegExp(`^[ \t⋆]*${line}(?:${CODEX_NATIVE_FOOTER_FIELDS})?[ \t⋆]*$`, "iu");
1923
- return this.configuredStatusLinePattern;
1635
+ usageLimitLunaReserveDialog() {
1636
+ // The real codex usage-limit dialog states codex has ALREADY switched to
1637
+ // Luna Reserve and labels Escape as "continue working". Pressing Escape via
1638
+ // sendSpecialKey is the ONLY safe key:
1639
+ //
1640
+ // • Escape is sent via sendSpecialKey — never via pasteText (which adds
1641
+ // an implicit bracketed-paste Enter that could confirm the highlighted
1642
+ // server action: Upgrade, Reset usage, Add Credits, …).
1643
+ // • A digit selects its row at once, and pasted its implicit Enter would
1644
+ // confirm whatever it landed on. This path is explicitly NOT used.
1645
+ //
1646
+ // verifyAfterKeys: true — confirm the menu is gone after Escape.
1647
+ // No confirmBeforeEnter / keysAfterConfirm: Escape needs no confirm gate.
1648
+ return {
1649
+ pattern: /Press enter to confirm or esc to continue working/i,
1650
+ keys: ["Escape"],
1651
+ description: "Codex usage limit — pressing Escape to continue with Luna Reserve",
1652
+ blocksDelivery: true,
1653
+ inputBlocked: true,
1654
+ isActive: codexUsageLimitMenuVisible,
1655
+ verifyAfterKeys: true,
1656
+ autoResolutionKey: "codex-usage-limit-luna-reserve",
1657
+ postDismissNotice: {
1658
+ text: t("inst.codex_usage_limit_luna_reserve", ""), // instance name injected by daemon
1659
+ label: "codex-usage-limit-selected",
1660
+ },
1661
+ };
1924
1662
  }
1925
- isConfiguredStatusLineFooter(row) {
1926
- const pattern = this.configuredStatusLineFooterPattern();
1927
- if (!pattern)
1928
- return false;
1929
- pattern.lastIndex = 0;
1930
- return pattern.test(row);
1663
+ workspaceLimitPromptDialog() {
1664
+ // Escape via sendSpecialKey, the same as the Luna Reserve menu: never a paste
1665
+ // (its implicit Enter would confirm the cursor's row) and never "y". The error
1666
+ // row codex printed above the prompt stays, and the quota pause takes it from
1667
+ // there: one notice, no parked dialog.
1668
+ return {
1669
+ pattern: /^\s*enter select\s*[·•]\s*esc back\s*$/im,
1670
+ keys: ["Escape"],
1671
+ description: "Codex workspace limit prompt — pressing Escape (never asking the owner)",
1672
+ blocksDelivery: true,
1673
+ inputBlocked: true,
1674
+ isActive: codexWorkspaceLimitPromptVisible,
1675
+ verifyAfterKeys: true,
1676
+ autoResolutionKey: "codex-workspace-limit-prompt",
1677
+ answeredByAgend: true,
1678
+ marksLiveIncident: true,
1679
+ };
1931
1680
  }
1932
- configuredHasContextItem() {
1933
- return (this.readConfiguredStatusLineItems() ?? []).some(item => CODEX_CONTEXT_STATUS_ITEMS.has(item));
1681
+ unknownSelectionHoldDialog() {
1682
+ return {
1683
+ pattern: /^\s*[›❯>]\s+\S/m,
1684
+ keys: [],
1685
+ description: "Codex interactive selection needs human input",
1686
+ holdOnly: true,
1687
+ blocksDelivery: true,
1688
+ inputBlocked: true,
1689
+ remoteCard: codexSelectionCard,
1690
+ isActive: codexUnknownSelectionVisible,
1691
+ };
1934
1692
  }
1935
- /**
1936
- * #978: a Context item in ANY position, accepted only as part of a footer
1937
- * whose every segment matches the configured status_line items. Codex keeps
1938
- * the user's order (`gpt-5.6-sol medium · Context 46% left · ~/x`); an
1939
- * arbitrary indented transcript line that happens to contain the item does
1940
- * not match that grammar. A stale config fails closed, and the daemon's
1941
- * stable-composer escape hatch then keeps the instance from latching.
1942
- */
1943
- // The configured grammar already makes Context a whole segment, so the item
1944
- // test only has to establish that one is present.
1945
- isConfiguredContextFooter(row) {
1946
- return this.configuredHasContextItem()
1947
- && new RegExp(CODEX_CONTEXT_ITEM, "iu").test(row)
1948
- && this.isConfiguredStatusLineFooter(row);
1693
+ getRuntimeDialogs() {
1694
+ return [
1695
+ this.autoTrustDialog(),
1696
+ this.trustHoldDialog(),
1697
+ this.rateSwitchPickerDialog(),
1698
+ {
1699
+ // Codex 0.156 may change the wording/order of this credit-cost choice.
1700
+ // Never navigate it by position: a moved option could switch to a
1701
+ // more expensive model. A live picker holds delivery and notifies a
1702
+ // human; old transcript mentions are excluded by the tail matcher.
1703
+ pattern: /(?:Approaching rate limits|Switch to [^\r\n]{1,120} for lower credit usage\?)/i,
1704
+ keys: [],
1705
+ description: "Codex rate limit model switch dialog needs human choice",
1706
+ holdOnly: true,
1707
+ blocksDelivery: true,
1708
+ inputBlocked: true,
1709
+ remoteCard: codexSelectionCard,
1710
+ isActive: codexRateSwitchVisible,
1711
+ },
1712
+ this.updatePickerDialog(),
1713
+ this.usageLimitLunaReserveDialog(),
1714
+ this.workspaceLimitPromptDialog(),
1715
+ ...this.sessionHoldDialogs(),
1716
+ this.unknownSelectionHoldDialog(),
1717
+ ];
1949
1718
  }
1950
- /** Any footer that proves the Context meter owns the bottom row. */
1951
- isAnyContextFooter(row) {
1952
- return isCodexContextFooter(row) || this.isConfiguredContextFooter(row);
1719
+ getInputUnavailableTransients() {
1720
+ return [{
1721
+ pattern: /(?:^|\n)\s*Resuming session…\s*(?:\n|$)/,
1722
+ description: "Codex session resume in progress",
1723
+ isActive: (pane) => {
1724
+ const rows = pane.split(/\r?\n/);
1725
+ return codexBoxedResumeLoading(rows) || codexUnboxedResumeLoading(rows);
1726
+ },
1727
+ }];
1728
+ }
1729
+ /** Only a resume paints "Resuming session…"; a fresh launch never does. */
1730
+ launchMayShowInputTransient() {
1731
+ return this.paneDetectorContext?.launchMayResume() ?? this.lastLaunchResumes;
1732
+ }
1733
+ getQuitCommand() { return "/quit"; }
1734
+ getCompactCommand() { return "/compact"; }
1735
+ getClearCommand() { return "/clear"; }
1736
+ getCancelKey() { return "Escape"; }
1737
+ }
1738
+ export class CodexBackend extends CodexPaneDetectors {
1739
+ instanceDir;
1740
+ binaryPath;
1741
+ sharedCodexHome;
1742
+ isolatedCodexHome;
1743
+ /** Which subscription this instance runs on, or null for the shared login. */
1744
+ credentialProfile = null;
1745
+ /** Set only after preTrust wrote and read back this instance's private config. */
1746
+ authorizedTrust = null;
1747
+ /** Set by buildCommand when the resume plan fell back; read once by the daemon. */
1748
+ launchWarning = null;
1749
+ quotaReplay = null;
1750
+ quotaReplayHistory() { return this.quotaReplay; }
1751
+ /** Set by writeConfig when the status_line could not be made verifiable (#931). */
1752
+ statusLineWarning = null;
1753
+ /** #2357: set by buildCommand when the codex being launched lacks a package companion (codex-code-mode-host). */
1754
+ packageWarning = null;
1755
+ constructor(instanceDir) {
1756
+ super();
1757
+ this.instanceDir = instanceDir;
1758
+ this.binaryPath = resolveBinary("codex");
1759
+ this.sharedCodexHome = resolve(process.env.CODEX_HOME?.trim() || join(homedir(), ".codex"));
1760
+ this.isolatedCodexHome = CodexBackend.resolveShortHome(instanceDir);
1953
1761
  }
1954
1762
  /**
1955
- * #978 escape hatch: the live, EMPTY Codex composer within the last few
1956
- * non-blank rows, no busy marker, and none of the known selection screens.
1957
- * Deliberately says nothing about the footer, which is what is unknown.
1763
+ * Compute and (on first call for an existing instance) migrate to a SHORT
1764
+ * persistent CODEX_HOME under `~/.agend/cx/<8-char-hash>/`.
1765
+ *
1766
+ * Background (#953): codex 0.157.0 added `app-server-control.sock` under
1767
+ * CODEX_HOME. For instances with long `-t<topic_id>` suffixes the full path
1768
+ * exceeds the Unix socket SUN_LEN (~107 chars). codex canonicalises the path
1769
+ * before binding the socket, so a symlink workaround does not help — the real
1770
+ * path must be short.
1771
+ *
1772
+ * Migration steps (each is idempotent; half-completed states self-heal):
1773
+ * 1. If shortHome does not exist AND legacyHome is a real directory (not a
1774
+ * symlink) → atomic renameSync. On EXDEV or any other error, fall back
1775
+ * safely: keep using the legacy long path (instance can still start, just
1776
+ * without the short-path fix).
1777
+ * 2. If shortHome exists but legacyHome is missing → recreate the backward-
1778
+ * compat symlink (self-heal for rename-succeeded-but-symlink-failed crash).
1779
+ * 3. If both shortHome and legacyHome (as symlink) exist → nothing to do.
1780
+ * 4. New instance (no legacyHome) → create shortHome directly.
1781
+ *
1782
+ * Fail-safe guarantee: migration failure must never make the instance worse.
1783
+ * The caller always receives a valid path it can use as CODEX_HOME.
1958
1784
  */
1959
- isStableUnknownLayoutIdlePane(pane) {
1960
- if (this.getBusyPattern().test(pane))
1961
- return false;
1962
- // The composer is live-looking and the footer is unknown — exactly this
1963
- // proof's blind spot — but there is no server behind it (#1099).
1964
- if (codexAppServerDisconnected(pane))
1965
- return false;
1966
- // (No second, wider "esc to interrupt" match here: getBusyPattern() above already reads a live status row of ANY
1967
- // title — #964 — and anchors it to the whole row at column zero, so a reply that quotes the phrase, indented or
1968
- // in prose, cannot pin the escape hatch shut (#991).)
1969
- // A retained queued message (`↳ …` under "Messages to be submitted after
1970
- // next tool call") means work is pending, whatever the composer shows.
1971
- if (/↳|Messages to be submitted/i.test(pane))
1972
- return false;
1973
- if (codexUsageLimitMenuVisible(pane) || codexRateSwitchVisible(pane)
1974
- || codexUnknownSelectionVisible(pane) || codexUpdatePickerVisible(pane))
1975
- return false;
1976
- const rows = pane.replace(/\r/g, "").split("\n").filter(row => row.trim() !== "");
1977
- return rows.slice(-6).some(row => /^[>›][ \t⋆]*Ask Codex to do anything[ \t⋆]*$/.test(row));
1785
+ /** Exposed for fleet-manager to delete the short home on instance removal. */
1786
+ static shortHomeFor(instanceDir) {
1787
+ return codexShortHomeFor(instanceDir);
1978
1788
  }
1979
- isCodexIdleFooter(row) {
1980
- return isCodexContextFooter(row) || this.isConfiguredStatusLineFooter(row);
1789
+ static resolveShortHome(instanceDir) {
1790
+ const shortHome = CodexBackend.shortHomeFor(instanceDir);
1791
+ const shortBase = join(getAgendHome(), "cx");
1792
+ const canonical = resolve(instanceDir);
1793
+ const legacyHome = resolve(instanceDir, "codex-home");
1794
+ // Only migrate/create when the instance directory itself exists.
1795
+ // Constructing CodexBackend for a non-existent dir (cli-env probes, test
1796
+ // backends that never ran) must not litter ~/.agend/cx/ with orphan dirs.
1797
+ if (!existsSync(canonical))
1798
+ return shortHome;
1799
+ const legacyExists = existsSync(legacyHome);
1800
+ const legacyIsRealDir = legacyExists && !lstatSync(legacyHome).isSymbolicLink();
1801
+ const shortExists = existsSync(shortHome);
1802
+ if (!shortExists) {
1803
+ mkdirSync(shortBase, { recursive: true, mode: 0o700 });
1804
+ if (legacyIsRealDir) {
1805
+ // Attempt atomic rename. Requires same device; fails with EXDEV otherwise.
1806
+ try {
1807
+ renameSync(legacyHome, shortHome);
1808
+ // Log the one-time migration for observability.
1809
+ try {
1810
+ const logPath = join(shortBase, `${shortHome.split("/").at(-1)}.migrated`);
1811
+ writeFileSync(logPath, `${new Date().toISOString()} migrated from ${legacyHome}\n`);
1812
+ }
1813
+ catch { /* log failure is non-fatal */ }
1814
+ }
1815
+ catch (err) {
1816
+ // EXDEV (cross-device) or any other rename failure → fail-safe:
1817
+ // fall back to the legacy long path so the instance still works.
1818
+ // The socket-length bug persists for this instance but no data is lost.
1819
+ const code = err.code ?? "unknown";
1820
+ try {
1821
+ const warnPath = join(shortBase, `${shortHome.split("/").at(-1)}.migration-failed`);
1822
+ writeFileSync(warnPath, `${new Date().toISOString()} rename failed (${code}): ${err.message}\n`
1823
+ + `legacy path remains in use: ${legacyHome}\n`);
1824
+ }
1825
+ catch { /* warn log failure is also non-fatal */ }
1826
+ // Return legacy long path so the instance starts (socket may still fail
1827
+ // on 0.157.0 for long names, but no data is lost or corrupted).
1828
+ return legacyHome;
1829
+ }
1830
+ }
1831
+ else if (!legacyExists) {
1832
+ // New instance — no data to migrate.
1833
+ mkdirSync(shortHome, { recursive: true, mode: 0o700 });
1834
+ }
1835
+ // If legacyExists but is already a symlink: shortHome was deleted externally
1836
+ // while the symlink still points to it. Re-create shortHome as a fresh dir.
1837
+ if (!existsSync(shortHome)) {
1838
+ mkdirSync(shortHome, { recursive: true, mode: 0o700 });
1839
+ }
1840
+ }
1841
+ // Backward-compat symlink: instanceDir/codex-home → shortHome.
1842
+ // Also serves as self-heal: if a previous run renamed successfully but
1843
+ // crashed before creating the symlink, we recreate it here.
1844
+ if (!legacyExists || legacyIsRealDir) {
1845
+ // legacyIsRealDir means rename just happened (now shortHome exists, legacyHome gone).
1846
+ // !legacyExists means new instance or symlink was deleted — create it.
1847
+ try {
1848
+ symlinkSync(shortHome, legacyHome);
1849
+ }
1850
+ catch { /* race or already exists */ }
1851
+ }
1852
+ return shortHome;
1981
1853
  }
1982
- /** A proxy reply filters chrome per line; whole-pane readiness is separate. */
1983
- isProxyReplyChromeLine(line) {
1984
- return /^\s*[›>]\s+Ask Codex to do anything\s*$/.test(line)
1985
- || this.isAnyContextFooter(line);
1854
+ /**
1855
+ * The row codex paints for input it has taken into its own queue instead of
1856
+ * submitting: `↳ <message>` under "Messages to be submitted after next tool
1857
+ * call (press esc to interrupt and send immediately)".
1858
+ */
1859
+ getQueuedInputMarker() {
1860
+ return /↳/;
1986
1861
  }
1987
- getErrorPatterns() {
1988
- return [
1989
- // Specific quota codes must precede the generic HTTP 429 classifier:
1990
- // OpenAI returns insufficient_quota with status 429, but switching models
1991
- // cannot repair an exhausted account and would only start a failover loop.
1992
- {
1993
- pattern: new RegExp(String.raw `^\s*(?:${CODEX_STATUS_GLYPH}|Error:|API Error:)\s*[\s\S]{0,240}?\b(?:insufficient_quota|billing_hard_limit_reached|exceeded\s+your\s+current\s+quota)\b|^(?:${CODEX_STATUS_GLYPH}) Quota exceeded\. Check your plan and billing details\.\r?$`, "im"),
1994
- type: "quota",
1995
- action: "pause",
1996
- message: "OpenAI quota exceeded",
1997
- notice: () => quotaPausedLine("OpenAI", "api_quota"),
1998
- },
1999
- {
2000
- // Codex already exhausted HTTP retries and returned to its composer.
2001
- // The existing conditional continuation preserves context without
2002
- // replaying earlier tool effects. Quota remains a preceding pause.
2003
- pattern: new RegExp(`^${CODEX_EXHAUSTED_429_ROW}$`, "im"),
2004
- type: "rate_limit",
2005
- action: "nudge_continue",
2006
- message: t("inst.codex_rate_retry_stopped"),
2007
- skipCooldown: true,
2008
- skipRecoveryWait: true,
2009
- },
2010
- {
2011
- // Pane history contains the agent's own prose, source code and search
2012
- // results. Bare `rate limit` used to fail over an otherwise healthy
2013
- // Codex merely for discussing this regex. Match machine-readable API
2014
- // forms or an error-decorated terminal line instead.
2015
- pattern: new RegExp(String.raw `^\s*unexpected\s+status\s+429\b|^(?![\s\S]{0,240}?${CODEX_EXHAUSTED_429_ROW})[ \t]*(?:${CODEX_STATUS_GLYPH}|Error:|API Error:)\s*[\s\S]{0,240}?(?:["'](?:status|code)["']\s*:\s*429\b|\b(?:rate_limit_exceeded|too_many_requests)\b|\brate limit(?:ed| exceeded| reached)?\b|\btoo many requests\b)`, "im"),
2016
- type: "rate_limit",
2017
- action: "failover",
2018
- message: "OpenAI rate limit reached",
2019
- },
2020
- {
2021
- // Same false-positive boundary as rate limits: `authentication` is a
2022
- // normal English/code word. Require a structured 401/code or a
2023
- // decorated CLI error line before pausing every instance on the shared
2024
- // credential.
2025
- pattern: new RegExp(String.raw `^\s*unexpected\s+status\s+401\b|^\s*(?:${CODEX_STATUS_GLYPH}|Error:|API Error:)\s*[\s\S]{0,240}?(?:["'](?:status|code)["']\s*:\s*401\b|\b(?:invalid_api_key|authentication_error)\b|\b401\s+Unauthorized\b|\bauthentication (?:failed|error)\b|\binvalid api key\b)`, "im"),
2026
- type: "auth_error",
2027
- action: "pause",
2028
- message: "OpenAI authentication error",
2029
- },
2030
- // Codex writes the apostrophe as U+2019 ("You’ve hit your usage limit.") since
2031
- // 0.156 and as ASCII before (0.153.4): both must match, or no usage limit
2032
- // ever pauses the instance (#1098).
2033
- { pattern: /you['’]ve hit your usage limit/i, type: "quota", action: "pause", message: "Codex usage limit reached — upgrade plan required",
2034
- notice: () => quotaPausedLine("Codex", "usage") },
2035
- {
2036
- // The terminal stage of a lost app-server (#1099): Codex has given up
2037
- // reconnecting and says so, with a counter that never stops. Nothing
2038
- // recovers from here without a relaunch, and every message sent in the
2039
- // meantime waits for an idle that cannot come. Only the LIVE row counts:
2040
- // directly above the LAST composer with no later transcript item or composer
2041
- // (the same test as codexAppServerDisconnected, as a lookahead), so text that
2042
- // merely quotes it does not raise this.
2043
- pattern: new RegExp(String.raw `^[ \t]*•[ \t]+Reconnect failed[ \t]+—[ \t]+check the endpoint, then relaunch[ \t]+\(\d+[hms](?:[ \t]+\d+[hms])*\)[ \t]*$`
2044
- + String.raw `(?=\n(?:[ \t]*\n)*[›>][^\n]*(?:\n(?![•■⚠›>])[^\n]*)*(?![\s\S]))`, "mu"),
2045
- type: "network",
2046
- action: "notify",
2047
- message: "Codex lost its app-server connection and could not reconnect — restart the instance (messages cannot be delivered until then)",
2048
- },
2049
- {
2050
- // Codex reports an unknown model either as a TUI metadata fallback or
2051
- // as a ChatGPT-account API rejection. Use whitespace-aware phrases so
2052
- // capture-pane hard wraps do not hide either form.
2053
- // Codex quotes the slug with BACKTICKS ("Model metadata for `x` not found.",
2054
- // verified live on 0.160.0 and in the 0.153.4–0.160.0 binaries). The old
2055
- // pattern only took ASCII quotes, so it could never match a real line.
2056
- pattern: /model\s+metadata\s+for\s+['"`‘’“”][^'"`‘’“”]+['"`‘’“”]\s+not\s+found\.\s+defaulting\s+to\s+fallback\s+metadata|model\s+is\s+not\s+supported\s+when\s+using\s+codex\s+with\s+a\s+chatgpt\s+account/i,
2057
- type: "model_error",
2058
- action: "notify",
2059
- message: "Codex model unavailable — use /model to switch",
2060
- },
2061
- {
2062
- // A capacity rejection is a completed failed turn: Codex returns to its
2063
- // prompt without an answer, with its context intact. Keep this anchored to
2064
- // the exact decorated TUI line so ordinary prose about model capacity
2065
- // cannot trigger anything on an otherwise healthy instance. The status
2066
- // glyph is decoration that changes between Codex versions and error classes
2067
- // (`■` U+25A0 on 0.159.2 and 0.160.0, `⚠` U+26A0 before), so any one
2068
- // "Other Symbol" glyph (optionally with its emoji selector) opens the line —
2069
- // never a bullet, dash, quote marker or number, which prose and the model's
2070
- // own transcript items use (`•`, `-`, `>`). The sentence must fill the line,
2071
- // from column 0. Box drawing and block elements (U+2500–U+259F) are
2072
- // excluded up front: they are `So` too, but a left-border popup or
2073
- // table row (`│ …`) is chrome, not a status line. The CLI is
2074
- // already back at the prompt, so skipRecoveryWait avoids an extra wait.
2075
- // action "nudge_continue": tell the user, then about a minute later tell
2076
- // the agent to keep going (the lifecycle bounds this to 3 per 30 minutes,
2077
- // then pauses; see #905). No restart — nothing would re-send the turn — and
2078
- // no model switch. skipCooldown: each NEW capacity line is a new episode,
2079
- // including a second one right after the nudge.
2080
- pattern: /^(?![─-▟])\p{So}\uFE0F? Selected model is at capacity\. Please try a different model\.\r?$/mu,
2081
- type: "model_error",
2082
- action: "nudge_continue",
2083
- message: t("inst.codex_model_capacity"),
2084
- skipCooldown: true,
2085
- skipRecoveryWait: true,
2086
- },
2087
- // Workspace (business) accounts report exhaustion differently from personal
2088
- // ones, with codex's own rows (codex-rs/protocol error.rs and tui
2089
- // turn_runtime.rs, unchanged 0.160.0–0.165.0):
2090
- // member: "■ Your workspace is out of credits. Ask your workspace owner to refill in order to continue."
2091
- // "■ You hit your spend cap set by the owner of your workspace. Ask an owner to increase your spend cap to continue."
2092
- // owner: "■ You're out of credits. Your workspace is out of credits. Add credits to continue using Codex."
2093
- // "■ Your workspace is out of credits. Add credits to continue."
2094
- // "■ You hit your spend cap set in your workspace. Increase your spend cap to continue."
2095
- // "■ Usage limit reached. You've reached your usage limit. Increase your limits to continue using codex."
2096
- // Neither `insufficient_quota|billing` nor `you've hit your usage limit`
2097
- // matches them.
2098
- //
2099
- // pause, not notify: nothing works until someone refills or raises the cap.
2100
- // Anchored to the status glyph in COLUMN 0, because these skip the
2101
- // usage-window check (a workspace limit is not one of those windows, so the
2102
- // check would call it "available"): codex draws its own error cells there,
2103
- // while an agent's message, quote or code block is indented under its `•`
2104
- // (captured live, tests/fixtures/codex-0165-workspace-quoted.pane.txt).
2105
- // `\s+` at each word gap: capture-pane runs without -J, so tmux's hard wrap
2106
- // can land a newline anywhere in the sentence. A resumed transcript reprints
2107
- // these rows, and the first live composer of a spawn takes them as history.
2108
- {
2109
- pattern: new RegExp(String.raw `^(?:${CODEX_STATUS_GLYPH})[ \t]+(?:You['’]re\s+out\s+of\s+credits\.\s+)?Your\s+workspace\s+is\s+out\s+of\s+credits\.`, "m"),
2110
- type: "quota",
2111
- action: "pause",
2112
- message: "Codex workspace credits exhausted — workspace owner must refill",
2113
- notice: () => quotaPausedLine("Codex", "workspace_credits"),
2114
- skipUsageVerify: true,
2115
- historyUntilLiveComposer: true,
2116
- },
2117
- {
2118
- pattern: new RegExp(String.raw `^(?:${CODEX_STATUS_GLYPH})[ \t]+You\s+hit\s+your\s+spend\s+cap\s+set\s+(?:by\s+the\s+owner\s+of|in)\s+your\s+workspace\.`, "m"),
2119
- type: "quota",
2120
- action: "pause",
2121
- message: "Codex workspace spend cap reached — workspace owner must raise it",
2122
- notice: () => t("inst.quota_spend_cap"),
2123
- skipUsageVerify: true,
2124
- historyUntilLiveComposer: true,
2125
- },
2126
- {
2127
- pattern: new RegExp(String.raw `^(?:${CODEX_STATUS_GLYPH})[ \t]+Usage\s+limit\s+reached\.\s+You['’]ve\s+reached\s+your\s+usage\s+limit\.\s+Increase\s+your\s+limits`, "m"),
2128
- type: "quota",
2129
- action: "pause",
2130
- message: "Codex workspace usage limit reached — increase the workspace limits to continue",
2131
- notice: () => quotaPausedLine("Codex", "workspace_usage"),
2132
- skipUsageVerify: true,
2133
- historyUntilLiveComposer: true,
2134
- },
2135
- // Codex warns at 10% and 5% remaining, and scopes the limit by period —
2136
- // "weekly" alone missed every `monthly limit` warning.
2137
- //
2138
- // `\s+` at EVERY word gap (not literal spaces) because capture-pane runs without -J,
2139
- // so tmux's hard wrap can land a newline (plus continuation-line padding)
2140
- // at any of these word gaps. The trailing "Run /status for a breakdown."
2141
- // is deliberately NOT part of the pattern — that tail is what actually
2142
- // wrapped in the reported case.
2143
- //
2144
- // `of your <period> limit` is load-bearing: it's what keeps the pattern
2145
- // off the agent's own prose about percentages.
2146
- {
2147
- pattern: /less\s+than\s+(\d+)\s*%\s+of\s+your\s+(hourly|daily|weekly|monthly)\s+limit/i,
2148
- type: "quota",
2149
- action: "notify",
2150
- message: "Codex usage limit running low",
2151
- formatMessage: (m) => `Codex ${m[2].toLowerCase()} limit: less than ${m[1]}% left`,
2152
- notice: (m) => (m ? quotaLowLine(m[2], m[1]) : quotaLine("Codex", "usage")),
2153
- },
2154
- ];
1862
+ /** #1811: what the last launch left out and why — the Log tab and daemon.log, never a channel. */
1863
+ quietLaunchNotes = [];
1864
+ consumeQuietLaunchNotes() { const notes = this.quietLaunchNotes; this.quietLaunchNotes = []; return notes; }
1865
+ buildCommand(config) {
1866
+ this.lastKnownModel = config.model?.trim() || null;
1867
+ this.credentialProfile = this.readProfile(config);
1868
+ // #2886: `--full-auto` is gone from codex (no supported version, 0.155 on, accepts it: the instance never started);
1869
+ // spelled out, it was a workspace-write sandbox that asks for approval on request.
1870
+ const approvalFlag = config.skipPermissions !== false
1871
+ ? "--dangerously-bypass-approvals-and-sandbox"
1872
+ : "--sandbox workspace-write --ask-for-approval on-request";
1873
+ // #984: never trust `codex resume --last` to pick this instance's session.
1874
+ // Codex 0.157 scopes it to the git REPOSITORY, so in a worktree it resumes
1875
+ // the newest session of any sibling worktree (a lock screen while that
1876
+ // instance lives, a silent hijack otherwise), and a new instance in a
1877
+ // shared repo does not start fresh. Resume the exact-cwd thread from the
1878
+ // shared state DB instead; `--last` is only the fallback for an unreadable
1879
+ // DB when no other Codex instance shares the repository.
1880
+ let cmd;
1881
+ this.launchWarning = null;
1882
+ this.lastLaunchResumes = false;
1883
+ this.quotaReplay = null;
1884
+ // #2357: read-only (codex is never run here); a launch is not held for it — the operator is told once per launch.
1885
+ this.packageWarning = codexPackageWarning(this.binaryPath);
1886
+ const retainedGeneral = selectedGeneralHostSession(this.instanceDir, config.instanceName, "codex", config.workingDirectory);
1887
+ if (retainedGeneral) {
1888
+ const check = checkResumeId(join(this.isolatedCodexHome, "sessions"), config.workingDirectory, retainedGeneral);
1889
+ if (!check.ok)
1890
+ throw new ResumeBlockedError(t("general_location.start_failed"), t("general_location.start_failed"));
1891
+ this.lastLaunchResumes = true;
1892
+ this.quotaReplay = snapshotCodexQuotaHistory(check.rollout.path);
1893
+ cmd = `${this.binaryPath} resume ${shellQuote(retainedGeneral)} ${approvalFlag}`;
1894
+ }
1895
+ else if (config.skipResume) {
1896
+ cmd = `${this.binaryPath} ${approvalFlag}`;
1897
+ }
1898
+ else {
1899
+ const resumeBy = (id, why, bytes, path) => {
1900
+ this.lastLaunchResumes = true;
1901
+ this.quotaReplay = snapshotCodexQuotaHistory(path);
1902
+ this.writeResumeAttempt(id);
1903
+ const large = bytes !== null && bytes > CODEX_RESUME_LARGE_BYTES ? ` ${t("codex.resume_large", String(Math.round(bytes / (1024 * 1024))))}` : "";
1904
+ this.launchWarning = why + large;
1905
+ return `${this.binaryPath} resume ${shellQuote(id)} ${approvalFlag}`;
1906
+ };
1907
+ const sessionsDir = join(this.isolatedCodexHome, "sessions");
1908
+ // M-2266: the previous launch was told to resume a conversation by id. Codex records a thread as it opens it,
1909
+ // so a resume that did not take (codex exited with "No saved session found…") left no row: this launch starts
1910
+ // fresh, once, and says so. A database that cannot be read proves nothing, and planning goes on as usual.
1911
+ // A new one-shot ask comes first: it is the person's explicit choice for this launch.
1912
+ const oneShot = this.takeResumeNext();
1913
+ const attempt = this.takeResumeAttempt();
1914
+ const failed = !oneShot && attempt !== null && codexThreadRowExists(this.stateDbPath(), attempt) === false;
1915
+ if (failed) {
1916
+ // Remembered, so the auto-resume never picks this conversation again on a later launch.
1917
+ this.rememberFailedResume(attempt);
1918
+ cmd = `${this.binaryPath} ${approvalFlag}`;
1919
+ this.launchWarning = t("codex.resume_failed", config.workingDirectory, attempt);
1920
+ }
1921
+ else if (oneShot) {
1922
+ // M-2266: validated when it was asked for (restart_instance); checked again now, as the rollout may have moved.
1923
+ const check = checkResumeId(sessionsDir, config.workingDirectory, oneShot);
1924
+ if (check.ok)
1925
+ cmd = resumeBy(check.rollout.id, t("codex.resume_oneshot", config.workingDirectory, check.rollout.id), check.rollout.bytes, check.rollout.path);
1926
+ else {
1927
+ cmd = this.plannedCommand(config, approvalFlag, sessionsDir, resumeBy);
1928
+ this.launchWarning = [t("codex.resume_oneshot_invalid", config.workingDirectory, oneShot, check.reason), this.launchWarning].filter(Boolean).join("\n");
1929
+ }
1930
+ }
1931
+ else {
1932
+ cmd = this.plannedCommand(config, approvalFlag, sessionsDir, resumeBy);
1933
+ }
1934
+ }
1935
+ if (config.model) {
1936
+ const model = validateModel(config.model);
1937
+ warnIfModelMismatch("codex", model);
1938
+ cmd += ` -c ${shellQuote(`model="${model}"`)}`;
1939
+ }
1940
+ if (config.backendOptions?.provider) {
1941
+ const provider = validateProvider(String(config.backendOptions.provider));
1942
+ cmd += ` -c ${shellQuote(`model_provider="${provider}"`)}`;
1943
+ }
1944
+ // #1811: the configured effort, when the catalog entry of the model that will run lists it (launch-effort.ts); else
1945
+ // a quiet note. That model is proven from the command line or the config files codex reads (#1813 review).
1946
+ const runs = resolveCodexLaunchModel({
1947
+ isolatedHome: this.isolatedCodexHome, sharedHome: this.sharedCodexHome,
1948
+ model: config.model, workingDirectory: config.workingDirectory,
1949
+ });
1950
+ const effort = codexEffort(config.effort, runs.proven
1951
+ ? readCodexModelEffortLevels({ isolatedHome: this.isolatedCodexHome, sharedHome: this.sharedCodexHome, model: runs.model })
1952
+ : { model: runs.model, levels: null, unproven: true });
1953
+ if (effort.arg)
1954
+ cmd += effort.arg;
1955
+ // M-2446: the per-agent speed (codex-speed.ts) — Fast only where the running model's catalog entry offers it.
1956
+ const speed = codexSpeed(config.backendOptions?.speed, runs.proven
1957
+ ? readCodexModelServiceTiers({ isolatedHome: this.isolatedCodexHome, sharedHome: this.sharedCodexHome, model: runs.model })
1958
+ : { model: runs.model, tiers: null, unproven: true });
1959
+ if (speed.arg)
1960
+ cmd += speed.arg;
1961
+ this.quietLaunchNotes = [effort.note, speed.note].filter((n) => !!n);
1962
+ // AgEnD instances are unattended processes: an interactive self-update
1963
+ // picker blocks delivery and must never be enabled by a copied global or
1964
+ // managed config layer. Keep this last so the CLI override is authoritative.
1965
+ // Both observed Codex 0.155.0 and 0.156.1 support this launch flag. Pin
1966
+ // the initial layout so a user/global fullscreen preference cannot make a
1967
+ // header-only pane look ready. A later unknown layout still fails closed.
1968
+ cmd += " -c check_for_update_on_startup=false --no-alt-screen";
1969
+ // codex 0.159's opt-in `instant_interrupt` makes new input steer the
1970
+ // running response instead of queueing behind it, which AgEnD's delivery
1971
+ // and queued-input (↳) handling assume. Keep it off whatever a user or
1972
+ // global config says. Codex before 0.159 ignores the key with a startup
1973
+ // warning ("`features.instant_interrupt` is ignored"); nothing else.
1974
+ cmd += " -c features.instant_interrupt=false";
1975
+ // CODEX_HOME is the only Codex-supported way to isolate the complete base
1976
+ // config. A profile only layers over the shared config and would therefore
1977
+ // still load every globally registered AgEnD MCP server.
1978
+ return `CODEX_HOME=${shellQuote(this.isolatedCodexHome)} ${cmd}`;
1979
+ }
1980
+ writeConfig(config) {
1981
+ this.authorizedTrust = null;
1982
+ // Set before the home is prepared: which login this instance gets is a
1983
+ // property of the home, and the home is built here.
1984
+ this.credentialProfile = this.readProfile(config);
1985
+ this.prepareIsolatedHome();
1986
+ this.cleanSharedConfig();
1987
+ // Copy all user settings but no AgEnD MCP entries into a private base
1988
+ // config, then append only this instance's server(s). Each instance writes
1989
+ // a distinct file, eliminating the old concurrent global-config race.
1990
+ let content = "";
1991
+ try {
1992
+ content = stripAgendMcpTables(readFileSync(join(this.sharedCodexHome, "config.toml"), "utf-8"));
1993
+ }
1994
+ catch { /* a first-time Codex user may have no global config */ }
1995
+ if (content && !content.endsWith("\n"))
1996
+ content += "\n";
1997
+ for (const [name, entry] of Object.entries(config.mcpServers)) {
1998
+ content += `\n${renderMcpServer(name, entry, config.instanceName)}`;
1999
+ }
2000
+ atomicWritePrivate(join(this.isolatedCodexHome, "config.toml"), content);
2001
+ this.enableContextStatusLine();
2002
+ this.disableStartupUpdateCheck();
2003
+ this.hideRateLimitModelNudge();
2004
+ // Write fleet instructions into AGENTS.md (additive via marker block)
2005
+ if (config.instructions) {
2006
+ try {
2007
+ const agentsMd = join(config.workingDirectory, "AGENTS.md");
2008
+ appendWithMarker(agentsMd, config.instanceName, config.instructions);
2009
+ // Warn if file exceeds Codex's project_doc_max_bytes limit
2010
+ try {
2011
+ const size = statSync(agentsMd).size;
2012
+ if (size > CODEX_PROJECT_DOC_MAX_BYTES) {
2013
+ console.warn(`[agend] AGENTS.md is ${size} bytes, exceeds Codex limit of ${CODEX_PROJECT_DOC_MAX_BYTES} — instructions may be truncated`);
2014
+ }
2015
+ }
2016
+ catch { /* stat failed — skip size check */ }
2017
+ }
2018
+ catch { /* best effort */ }
2019
+ }
2020
+ }
2021
+ /**
2022
+ * Stop Codex opening its "Update available!" picker when an instance starts.
2023
+ *
2024
+ * That dialog owns the input loop until someone answers it, so after a fleet
2025
+ * restart every Codex instance sat waiting on a keypress nobody was going to
2026
+ * send. AgEnD then reported it as a stuck pane, which is true but unhelpful.
2027
+ *
2028
+ * `check_for_update_on_startup = false` is Codex's own config key (verified in
2029
+ * the binary), so this prevents the prompt rather than racing to dismiss it.
2030
+ * There is no CLI flag for it — `codex update` is a subcommand, not a switch.
2031
+ *
2032
+ * Placement matters: this is a TOP-LEVEL key, so it has to go above the first
2033
+ * `[section]` header or TOML would read it as belonging to that section. And a
2034
+ * AgEnD's isolated home is unattended, so an inherited `true` is replaced
2035
+ * rather than preserved. TOML rejects duplicate keys, so replace in place.
2036
+ */
2037
+ disableStartupUpdateCheck() {
2038
+ const configPath = join(this.isolatedCodexHome, "config.toml");
2039
+ let content = "";
2040
+ try {
2041
+ content = readFileSync(configPath, "utf-8");
2042
+ }
2043
+ catch {
2044
+ return;
2045
+ }
2046
+ const existing = /^\s*check_for_update_on_startup\s*=\s*(?:true|false)\s*(?:#.*)?$/m;
2047
+ if (existing.test(content)) {
2048
+ const updated = content.replace(existing, "check_for_update_on_startup = false");
2049
+ if (updated !== content) {
2050
+ try {
2051
+ atomicWritePrivate(configPath, updated);
2052
+ }
2053
+ catch { /* best effort */ }
2054
+ }
2055
+ return;
2056
+ }
2057
+ const LINE = "check_for_update_on_startup = false\n";
2058
+ const firstSection = content.search(/^\s*\[/m);
2059
+ const updated = firstSection === -1
2060
+ ? (content.length && !content.endsWith("\n") ? `${content}\n${LINE}` : `${content}${LINE}`)
2061
+ : `${content.slice(0, firstSection)}${LINE}${content.slice(firstSection)}`;
2062
+ try {
2063
+ atomicWritePrivate(configPath, updated);
2064
+ }
2065
+ catch { /* best effort */ }
2066
+ }
2067
+ /**
2068
+ * Suppress Codex's rate-limit model-switch reminder for unattended instances.
2069
+ * Codex documents this as `notice.hide_rate_limit_model_nudge` (a boolean in
2070
+ * the `[notice]` table). This changes only the per-instance config; the
2071
+ * runtime holdOnly dialog remains as defense-in-depth for older or changed
2072
+ * CLI behavior. No model option is selected automatically.
2073
+ */
2074
+ hideRateLimitModelNudge() {
2075
+ const configPath = join(this.isolatedCodexHome, "config.toml");
2076
+ let content = "";
2077
+ try {
2078
+ content = readFileSync(configPath, "utf-8");
2079
+ }
2080
+ catch {
2081
+ return;
2082
+ }
2083
+ const updated = setTomlTableBoolean(content, "notice", "hide_rate_limit_model_nudge");
2084
+ if (updated !== content) {
2085
+ try {
2086
+ atomicWritePrivate(configPath, updated);
2087
+ }
2088
+ catch { /* best effort */ }
2089
+ }
2090
+ }
2091
+ /**
2092
+ * Ensure Codex's TUI status line shows context usage: the Context item is
2093
+ * both what /ctx scrapes and the footer AgEnD's readiness proofs rely on.
2094
+ * Rules (never drops or reorders the user's items):
2095
+ * 1. the effective `tui.status_line` already has a context item
2096
+ * (context-remaining / -usage / -used) → leave the config untouched.
2097
+ * 2. no context item:
2098
+ * - no status_line at all → write status_line = ["context-remaining"]
2099
+ * - status_line exists → prepend "context-remaining" to it
2100
+ * Best-effort string edit (no TOML writer), but every candidate edit is
2101
+ * parsed back and kept only if the effective `tui.status_line` becomes
2102
+ * `["context-remaining", ...the user's items]`. A `status_line` key in some
2103
+ * other table is not the TUI's and must not be the one edited (#931). If no
2104
+ * edit can be verified, the launch warns the operator instead of leaving the
2105
+ * pane silently unready.
2106
+ */
2107
+ enableContextStatusLine() {
2108
+ this.configuredStatusLineItems = undefined;
2109
+ this.configuredStatusLinePattern = undefined;
2110
+ this.statusLineWarning = null;
2111
+ const configPath = join(this.isolatedCodexHome, "config.toml");
2112
+ // The private copy is rebuilt from the shared one at every launch, so the
2113
+ // operator must be pointed at the file their status_line actually lives in.
2114
+ const sharedConfigPath = join(this.sharedCodexHome, "config.toml");
2115
+ let content = "";
2116
+ try {
2117
+ content = readFileSync(configPath, "utf-8");
2118
+ }
2119
+ catch { /* no file yet */ }
2120
+ const ITEM = "context-remaining";
2121
+ const current = effectiveTuiStatusLine(content);
2122
+ if (current === "invalid") {
2123
+ this.statusLineWarning = t("codex.status_line_unverifiable", "tui.status_line is not a list of item names, or config.toml does not parse", sharedConfigPath);
2124
+ return;
2125
+ }
2126
+ // Rule 1: the TUI already shows a context item → don't touch anything.
2127
+ if (current?.some(item => CODEX_CONTEXT_STATUS_ITEM_RE.test(item)))
2128
+ return;
2129
+ // TOML allows quoted keys: `"status_line" = [...]`, `"tui"."status_line"`,
2130
+ // `['tui']`. Every textual candidate is tried; parsing decides.
2131
+ const candidates = [];
2132
+ if (current) {
2133
+ // Rule 2b: prepend our item to the user's existing array (don't overwrite).
2134
+ // First position keeps "Context N% left" at the far left of the footer so a
2135
+ // long cwd/other items can't push it past 80 cols and truncate it.
2136
+ for (const m of content.matchAll(/["']?status_line["']?\s*=\s*\[([^\]]*)\]/g)) {
2137
+ const inner = m[1].trim().replace(/^,\s*/, "").replace(/,\s*$/, "");
2138
+ const newInner = inner.length ? `"${ITEM}", ${inner}` : `"${ITEM}"`;
2139
+ candidates.push(`${content.slice(0, m.index)}status_line = [${newInner}]${content.slice(m.index + m[0].length)}`);
2140
+ }
2141
+ }
2142
+ else {
2143
+ // Rule 2a: no status_line at all → add a minimal one.
2144
+ const base = content.length && !content.endsWith("\n") ? `${content}\n` : content;
2145
+ // Also recognise quoted section headers: `["tui"]` and `['tui']`.
2146
+ if (/^\[["']?tui["']?\][^\n]*\n/m.test(base)) {
2147
+ candidates.push(base.replace(/^\[["']?tui["']?\][^\n]*\n/m, h => `${h}status_line = ["${ITEM}"]\n`));
2148
+ }
2149
+ candidates.push(`${base}\n[tui]\nstatus_line = ["${ITEM}"]\n`);
2150
+ // A config that defines tui with dotted keys cannot take a [tui] table.
2151
+ candidates.push(`tui.status_line = ["${ITEM}"]\n${base}`);
2152
+ // Nor can an inline `tui = { … }` table: the item goes inside it.
2153
+ candidates.push(base.replace(/^([ \t]*["']?tui["']?[ \t]*=[ \t]*\{)[ \t]*\}/m, `$1 status_line = ["${ITEM}"] }`));
2154
+ candidates.push(base.replace(/^([ \t]*["']?tui["']?[ \t]*=[ \t]*\{)/m, `$1 status_line = ["${ITEM}"],`));
2155
+ }
2156
+ const wanted = [ITEM, ...(current ?? [])];
2157
+ const fixed = candidates.find(candidate => {
2158
+ const items = effectiveTuiStatusLine(candidate);
2159
+ return Array.isArray(items) && items.length === wanted.length && items.every((item, i) => item === wanted[i]);
2160
+ });
2161
+ if (!fixed) {
2162
+ this.statusLineWarning = t("codex.status_line_unverifiable", "no edit of tui.status_line could be verified", sharedConfigPath);
2163
+ return;
2164
+ }
2165
+ try {
2166
+ atomicWritePrivate(configPath, fixed);
2167
+ }
2168
+ catch (err) {
2169
+ // Never block launch on statusline config — but a verified edit that
2170
+ // could not be written leaves the pane as unready as an unfixable one.
2171
+ const reason = `the verified edit could not be written: ${err.code ?? "write failed"}`;
2172
+ this.statusLineWarning = t("codex.status_line_unverifiable", reason, sharedConfigPath);
2173
+ }
2174
+ }
2175
+ /** Null when the instance did not ask for a profile — today's behaviour. */
2176
+ readProfile(config) {
2177
+ try {
2178
+ return resolveCredentialProfile(config.backendOptions);
2179
+ }
2180
+ catch {
2181
+ // A malformed name is refused where it is written; launching is not the
2182
+ // place to discover it, and falling back to the shared login is the
2183
+ // behaviour every instance had before profiles existed.
2184
+ return null;
2185
+ }
2155
2186
  }
2156
- getStartupDialogs() {
2157
- const trustHold = this.trustHoldDialog();
2158
- return [
2159
- this.autoTrustDialog(),
2160
- trustHold,
2161
- this.updatePickerDialog(),
2162
- this.rateSwitchPickerDialog(),
2163
- ...this.sessionHoldDialogs(),
2164
- this.unknownSelectionHoldDialog(),
2165
- ];
2187
+ /**
2188
+ * Where this instance's `auth.json` comes from.
2189
+ *
2190
+ * The shared home unless a profile says otherwise. A profile owns the file
2191
+ * itself — not a copy, not a link — so codex refreshing the token writes
2192
+ * into that subscription and no other.
2193
+ */
2194
+ authSourceDir() {
2195
+ if (!this.credentialProfile)
2196
+ return this.sharedCodexHome;
2197
+ const spec = credentialHomeSpec(this.binaryName);
2198
+ if (!spec)
2199
+ return this.sharedCodexHome;
2200
+ const home = credentialProfileHome(getAgendHome(), this.binaryName, this.credentialProfile);
2201
+ prepareCredentialProfileHome(spec, home);
2202
+ return home;
2203
+ }
2204
+ preTrust(workDir) {
2205
+ this.authorizedTrust = null;
2206
+ const paths = codexTrustPaths(workDir);
2207
+ const configPath = join(this.isolatedCodexHome, "config.toml");
2208
+ let content = "";
2209
+ try {
2210
+ content = readFileSync(configPath, "utf-8");
2211
+ }
2212
+ catch { }
2213
+ const updated = setProjectTrusted(content, paths.root);
2214
+ if (updated !== content)
2215
+ atomicWritePrivate(configPath, updated);
2216
+ // Do not authorize an automatic Enter merely because the write returned:
2217
+ // a stale/untrusted section in the effective isolated config must fail shut.
2218
+ const onDisk = readFileSync(configPath, "utf-8");
2219
+ if (effectiveProjectTrust(onDisk, paths.root) !== "trusted")
2220
+ throw new Error("Codex project trust did not persist");
2221
+ this.authorizedTrust = paths;
2166
2222
  }
2167
2223
  /**
2168
- * #984: session-selection screens only a human may answer. Held (never
2169
- * keyed) so the delivery gate keeps messages queued and dialog_parked tells
2170
- * the operator; listed before the generic selection hold for a clear notice.
2224
+ * Preserve Codex login/session/cache sharing while isolating config.toml
2225
+ * and the CODEX_HOME-scoped app-server daemon/control runtime directories.
2171
2226
  */
2172
- sessionHoldDialogs() {
2173
- return [
2174
- {
2175
- pattern: /This conversation is open in another app/,
2176
- keys: [],
2177
- description: "Codex session is open in another process (thread lock) — close the other one and press r, or fork manually",
2178
- holdOnly: true,
2179
- blocksDelivery: true,
2180
- inputBlocked: true,
2181
- remoteCard: codexSelectionCard,
2182
- isActive: codexSessionLockVisible,
2183
- },
2184
- {
2185
- pattern: /Working directory · resume/,
2186
- keys: [],
2187
- description: "Codex resume selected a session from another directory (sibling git worktree) — needs a human choice",
2188
- holdOnly: true,
2189
- blocksDelivery: true,
2190
- inputBlocked: true,
2191
- remoteCard: codexSelectionCard,
2192
- isActive: codexResumeCwdPickerVisible,
2193
- },
2194
- ];
2227
+ /** Session dirs every instance must share with the terminal CLI (#506). */
2228
+ static SHARED_SESSION_DIRS = ["sessions", "archived_sessions"];
2229
+ static PRIVATE_RUNTIME_DIRS = new Set(["app-server-daemon", "app-server-control"]);
2230
+ prepareIsolatedHome() {
2231
+ mkdirSync(this.isolatedCodexHome, { recursive: true, mode: 0o700 });
2232
+ chmodSync(this.isolatedCodexHome, 0o700);
2233
+ if (this.sharedCodexHome === this.isolatedCodexHome)
2234
+ return;
2235
+ // #1034: Codex's private socket directory check rejects directory symlinks.
2236
+ // Detach only the exact shared-home links the old mirror pass created,
2237
+ // including dangling links. Leave private directories and other links
2238
+ // alone; Codex will create its own real runtime directories on launch.
2239
+ for (const name of CodexBackend.PRIVATE_RUNTIME_DIRS) {
2240
+ const target = join(this.isolatedCodexHome, name);
2241
+ try {
2242
+ if (lstatSync(target).isSymbolicLink()
2243
+ && readlinkSync(target) === join(this.sharedCodexHome, name)) {
2244
+ unlinkSync(target);
2245
+ }
2246
+ }
2247
+ catch { /* absent, or another startup already detached the link */ }
2248
+ }
2249
+ // The session dirs must exist in the SHARED home before the symlink pass:
2250
+ // on a fresh install they don't yet, so no link was created, and the first
2251
+ // archive made Codex create a REAL dir in the instance-private home — a
2252
+ // permanent fork the terminal CLI could never see (#506). mkdir -p is
2253
+ // EEXIST-safe under concurrent instance startup.
2254
+ for (const dir of CodexBackend.SHARED_SESSION_DIRS) {
2255
+ try {
2256
+ mkdirSync(join(this.sharedCodexHome, dir), { recursive: true, mode: 0o700 });
2257
+ }
2258
+ catch { /* best effort */ }
2259
+ }
2260
+ // Heal homes that already forked: merge the private real dir back into the
2261
+ // shared one (never overwriting), then replace it with the symlink.
2262
+ for (const dir of CodexBackend.SHARED_SESSION_DIRS) {
2263
+ this.migrateDivergedSessionDir(dir);
2264
+ }
2265
+ // Older versions linked SQLite's WAL/SHM files independently of their
2266
+ // base database. If the base file had already been created privately,
2267
+ // that split one SQLite database across two homes and caused CANTOPEN (or
2268
+ // worse, cross-database journal recovery). Remove only links AgEnD made to
2269
+ // the matching shared-home path; real private sidecars remain untouched.
2270
+ const healedSidecars = [];
2271
+ for (const name of readdirSync(this.isolatedCodexHome)) {
2272
+ if (!SQLITE_SIDECAR_RE.test(name))
2273
+ continue;
2274
+ const target = join(this.isolatedCodexHome, name);
2275
+ try {
2276
+ if (!lstatSync(target).isSymbolicLink())
2277
+ continue;
2278
+ const linkTarget = resolve(dirname(target), readlinkSync(target));
2279
+ if (linkTarget !== join(this.sharedCodexHome, name))
2280
+ continue;
2281
+ unlinkSync(target);
2282
+ healedSidecars.push(name);
2283
+ }
2284
+ catch {
2285
+ // A concurrent process may remove an ephemeral sidecar/link first.
2286
+ }
2287
+ }
2288
+ if (healedSidecars.length > 0) {
2289
+ console.warn(`[agend] removed unsafe Codex SQLite sidecar links: ${healedSidecars.join(", ")}`);
2290
+ }
2291
+ // One file, possibly from somewhere else. Everything below is unchanged:
2292
+ // sessions, the thread/state/memory databases and every cache still come
2293
+ // from the shared home, which is why switching subscription does not throw
2294
+ // the conversation away.
2295
+ this.linkAuthFile();
2296
+ for (const name of readdirSync(this.sharedCodexHome)) {
2297
+ if (CodexBackend.PRIVATE_RUNTIME_DIRS.has(name))
2298
+ continue;
2299
+ if (name === "config.toml" || name === AGEND_MCP_CLEANUP_LOCK || name.startsWith(".config.toml."))
2300
+ continue;
2301
+ if (name === CODEX_AUTH_FILE)
2302
+ continue; // handled above, possibly from a profile
2303
+ // SQLite resolves a symlinked base DB to the shared path and creates its
2304
+ // own adjacent sidecars there. Linking sidecars separately is redundant
2305
+ // for shared bases and corrupts the file set for private bases.
2306
+ if (SQLITE_SIDECAR_RE.test(name))
2307
+ continue;
2308
+ const source = join(this.sharedCodexHome, name);
2309
+ const target = join(this.isolatedCodexHome, name);
2310
+ if (existsSync(target))
2311
+ continue;
2312
+ try {
2313
+ const type = lstatSync(source).isDirectory() ? "dir" : "file";
2314
+ symlinkSync(source, target, type);
2315
+ }
2316
+ catch {
2317
+ // State/cache links are compatibility aids; config isolation must not
2318
+ // fail merely because a concurrently-created cache entry disappeared.
2319
+ }
2320
+ }
2321
+ }
2322
+ /**
2323
+ * Point this home's `auth.json` at whichever login it should use.
2324
+ *
2325
+ * Codex refreshes the token by writing through the link rather than replacing
2326
+ * it — observed across every instance home on a machine that has been running
2327
+ * this arrangement for months, with the shared file's mtime moving. That is
2328
+ * behaviour, though, not a contract: a release that starts renaming over the
2329
+ * file would leave a real file here and quietly fork the login, with refreshes
2330
+ * landing somewhere the profile never sees. So a real file where a link
2331
+ * belongs is treated as exactly that — reported, and put back.
2332
+ */
2333
+ linkAuthFile() {
2334
+ const source = join(this.authSourceDir(), CODEX_AUTH_FILE);
2335
+ const target = join(this.isolatedCodexHome, CODEX_AUTH_FILE);
2336
+ let existing = null;
2337
+ try {
2338
+ existing = lstatSync(target);
2339
+ }
2340
+ catch { /* absent */ }
2341
+ if (existing?.isSymbolicLink()) {
2342
+ let current = "";
2343
+ try {
2344
+ current = resolve(dirname(target), readlinkSync(target));
2345
+ }
2346
+ catch { /* unreadable */ }
2347
+ if (current === source)
2348
+ return;
2349
+ try {
2350
+ unlinkSync(target);
2351
+ }
2352
+ catch { /* raced */ }
2353
+ }
2354
+ else if (existing) {
2355
+ // Not a link: codex replaced it, or an older AgEnD copied it. Either way
2356
+ // the refreshes it has been collecting are stranded in this instance's
2357
+ // home, so say so rather than deleting them silently.
2358
+ const stranded = `${target}.replaced-${Date.now()}`;
2359
+ try {
2360
+ renameSync(target, stranded);
2361
+ console.warn(`[agend] codex replaced ${CODEX_AUTH_FILE} in ${this.isolatedCodexHome} with a real file — `
2362
+ + `its login was no longer shared. Kept a copy at ${stranded} and re-linked to ${source}.`);
2363
+ }
2364
+ catch {
2365
+ return; // cannot move it; leave the instance working on what it has
2366
+ }
2367
+ }
2368
+ if (!existsSync(source))
2369
+ return; // not logged in yet; codex will create it
2370
+ try {
2371
+ symlinkSync(source, target, "file");
2372
+ }
2373
+ catch {
2374
+ // EEXIST from a concurrent start is the ordinary case and means the link
2375
+ // is already there.
2376
+ }
2377
+ }
2378
+ /**
2379
+ * One-time heal for an instance whose isolated home grew a REAL session dir
2380
+ * (#506): merge it into the shared home without overwriting anything, and
2381
+ * only after both the copy and the removal succeed put the symlink in its
2382
+ * place. Any failure keeps the private dir — sessions are never the thing
2383
+ * sacrificed for tidiness — and logs what happened.
2384
+ */
2385
+ migrateDivergedSessionDir(name) {
2386
+ const target = join(this.isolatedCodexHome, name);
2387
+ let st;
2388
+ try {
2389
+ st = lstatSync(target);
2390
+ }
2391
+ catch {
2392
+ return; // absent — the symlink pass below will create the link
2393
+ }
2394
+ if (st.isSymbolicLink())
2395
+ return; // already correct
2396
+ if (!st.isDirectory()) {
2397
+ console.warn(`[agend] codex-home/${name} is neither a symlink nor a directory — leaving it untouched`);
2398
+ return;
2399
+ }
2400
+ const shared = join(this.sharedCodexHome, name);
2401
+ try {
2402
+ mkdirSync(shared, { recursive: true, mode: 0o700 });
2403
+ // cp -rn semantics: collisions keep the shared copy. Session rollout
2404
+ // filenames are timestamp+uuid, so a genuine collision means the same
2405
+ // file — skipping is lossless either way.
2406
+ cpSync(target, shared, { recursive: true, force: false, errorOnExist: false });
2407
+ rmSync(target, { recursive: true });
2408
+ symlinkSync(shared, target, "dir");
2409
+ console.warn(`[agend] migrated diverged codex ${name} into shared home: ${shared}`);
2410
+ }
2411
+ catch (err) {
2412
+ // Keep whatever is left of the private dir. The copy never overwrites, so
2413
+ // a retry on next start is safe; worst case is duplicated files in the
2414
+ // shared home, never lost ones.
2415
+ console.warn(`[agend] codex ${name} migration failed — keeping the instance-private dir (${err.message})`);
2416
+ }
2195
2417
  }
2196
2418
  /**
2197
- * The user's decision (hmsg-53600a2c): codex's folder-trust prompt in an AgEnD session is always answered Trust — the
2198
- * workspace is the agent's own, whatever preTrust covered (preTrust stays, so the prompt rarely shows at all). Enter,
2199
- * only with the cursor on "Trust and continue" among the known options (trustCursor); any other layout or row is
2200
- * held (trustHoldDialog). It trusts the folder only: per-action approvals are separate dialogs and are not touched.
2419
+ * One-time migration for installations polluted by the old global `codex
2420
+ * mcp add` path. The lock protects separate fleet processes/upgrades, and
2421
+ * atomic rename prevents readers from observing a truncated config.
2201
2422
  */
2202
- autoTrustDialog() {
2203
- return {
2204
- pattern: /^\s*Trust this folder\?/m,
2205
- keys: ["Enter"],
2206
- description: "Codex folder trust — trusting the agent's own folder",
2207
- blocksDelivery: true,
2208
- inputBlocked: true,
2209
- autoResolutionKey: "codex-folder-auto-trust",
2210
- // One Enter per prompt (claimed, then checked): a prompt still up after it is held, never pressed again (#2896 review).
2211
- verifyAfterKeys: true,
2212
- isActive: pane => codexTrustPromptState(pane).trustCursor,
2213
- answerDetail: pane => ({ autoTrusted: true, ...this.trustPaneFields(pane) }),
2423
+ cleanSharedConfig() {
2424
+ if (this.sharedCodexHome === this.isolatedCodexHome)
2425
+ return;
2426
+ mkdirSync(this.sharedCodexHome, { recursive: true, mode: 0o700 });
2427
+ const lockPath = join(this.sharedCodexHome, AGEND_MCP_CLEANUP_LOCK);
2428
+ let lockFd;
2429
+ const acquire = () => {
2430
+ try {
2431
+ lockFd = openSync(lockPath, "wx", 0o600);
2432
+ return true;
2433
+ }
2434
+ catch {
2435
+ return false;
2436
+ }
2214
2437
  };
2438
+ if (!acquire()) {
2439
+ try {
2440
+ if (Date.now() - statSync(lockPath).mtimeMs > AGEND_MCP_CLEANUP_LOCK_STALE_MS) {
2441
+ unlinkSync(lockPath);
2442
+ if (!acquire())
2443
+ return;
2444
+ }
2445
+ else {
2446
+ return;
2447
+ }
2448
+ }
2449
+ catch {
2450
+ return;
2451
+ }
2452
+ }
2453
+ try {
2454
+ const configPath = join(this.sharedCodexHome, "config.toml");
2455
+ let content;
2456
+ try {
2457
+ content = readFileSync(configPath, "utf-8");
2458
+ }
2459
+ catch {
2460
+ return;
2461
+ }
2462
+ const cleaned = stripAgendMcpTables(content);
2463
+ if (cleaned !== content)
2464
+ atomicWritePrivate(configPath, cleaned);
2465
+ }
2466
+ finally {
2467
+ if (lockFd !== undefined) {
2468
+ try {
2469
+ closeSync(lockFd);
2470
+ }
2471
+ catch { }
2472
+ }
2473
+ try {
2474
+ unlinkSync(lockPath);
2475
+ }
2476
+ catch { }
2477
+ }
2215
2478
  }
2216
- trustHoldDialog() {
2217
- return {
2218
- pattern: /^\s*(?:Folder access|Trust this folder\?|Do you trust the files in this folder\?)/im,
2219
- keys: [],
2220
- description: "Codex folder trust needs human confirmation",
2221
- holdOnly: true,
2222
- blocksDelivery: true,
2223
- inputBlocked: true,
2224
- isActive: codexTrustVariantActive,
2225
- remoteCard: codexSelectionCard,
2226
- heldReason: pane => this.trustHoldReason(pane),
2227
- };
2479
+ readConfiguredStatusLineItems() {
2480
+ if (this.configuredStatusLineItems !== undefined)
2481
+ return this.configuredStatusLineItems;
2482
+ try {
2483
+ const config = tomlTable(parseToml(readFileSync(join(this.isolatedCodexHome, "config.toml"), "utf-8")));
2484
+ const tui = tomlTable(config?.tui);
2485
+ const items = tui?.status_line;
2486
+ this.configuredStatusLineItems = Array.isArray(items) && items.every(item => typeof item === "string")
2487
+ ? items
2488
+ : null;
2489
+ }
2490
+ catch {
2491
+ this.configuredStatusLineItems = null;
2492
+ }
2493
+ return this.configuredStatusLineItems;
2228
2494
  }
2229
2495
  /**
2230
2496
  * #2893: why the authorized folder-trust answer did not take this prompt (log only): what the pane shows against what
@@ -2259,147 +2525,6 @@ export class CodexBackend {
2259
2525
  authorizedCwd: authorized?.cwd ?? null, authorizedRoot: authorized?.root ?? null,
2260
2526
  configPath: join(this.isolatedCodexHome, "config.toml") };
2261
2527
  }
2262
- /**
2263
- * #1008: the rate-limit model-switch picker parked unattended instances (it
2264
- * waits forever and its default option changes the model). Prevention is
2265
- * `notice.hide_rate_limit_model_nudge` (hideRateLimitModelNudge — real and
2266
- * effective on 0.157.1 and 0.159.2, verified live); this is the answer for a
2267
- * picker that appears anyway (config not applied, a CLI that moved the key).
2268
- *
2269
- * Escape, not a navigated Enter: it selects nothing, so it can never take
2270
- * option 1 (switch model) or option 3 (writes "never show again" into the
2271
- * config). Deliberately not one-shot: if the picker swallowed the key it is
2272
- * simply sent again on the next poll, and a repeated Escape is harmless.
2273
- */
2274
- rateSwitchPickerDialog() {
2275
- return {
2276
- // Documentation only: Daemon.dialogMatches uses isActive INSTEAD of this
2277
- // pattern, so it filters nothing here — the structural check below is the
2278
- // whole decision, and ordinary prose about the picker fails it. The words
2279
- // are the picker's own, kept so a reader can find the screen from the log.
2280
- pattern: /Keep current model \(never show again\)/,
2281
- keys: ["Escape"],
2282
- description: "Codex rate-limit model-switch picker — Escape keeps the current model",
2283
- blocksDelivery: true,
2284
- inputBlocked: true,
2285
- isActive: codexRateSwitchPickerVisible,
2286
- };
2287
- }
2288
- updatePickerDialog() {
2289
- return {
2290
- // Defense in depth for config written by older AgEnD versions or a Codex
2291
- // regression. Match the release URL as well as the banner so ordinary
2292
- // agent prose cannot trigger a keypress.
2293
- pattern: /Update available![\s\S]{0,200}Release notes: https:\/\/github\.com\/openai\/codex\/releases/m,
2294
- keys: ["Escape"],
2295
- description: "Codex startup update-available picker",
2296
- // A delivery must never land on this screen. Its selected option is
2297
- // `› 1. Update now (runs … curl … | sh)` — the same `›` the input row
2298
- // uses — so an Enter here runs an installer instead of sending a message.
2299
- // The runtime dismisser presses Escape, but it only polls every few
2300
- // seconds and a delivery can arrive first (hit live on codex-cli 0.153.4,
2301
- // which parks on this picker for as long as nobody answers it).
2302
- blocksDelivery: true,
2303
- // Daemon.dialogMatches uses isActive INSTEAD OF pattern when present.
2304
- // Check the complete current picker here; a different Enter-only menu
2305
- // must never receive this automatic Escape key.
2306
- isActive: codexUpdatePickerVisible,
2307
- };
2308
- }
2309
- usageLimitLunaReserveDialog() {
2310
- // The real codex usage-limit dialog states codex has ALREADY switched to
2311
- // Luna Reserve and labels Escape as "continue working". Pressing Escape via
2312
- // sendSpecialKey is the ONLY safe key:
2313
- //
2314
- // • Escape is sent via sendSpecialKey — never via pasteText (which adds
2315
- // an implicit bracketed-paste Enter that could confirm the highlighted
2316
- // server action: Upgrade, Reset usage, Add Credits, …).
2317
- // • A digit selects its row at once, and pasted its implicit Enter would
2318
- // confirm whatever it landed on. This path is explicitly NOT used.
2319
- //
2320
- // verifyAfterKeys: true — confirm the menu is gone after Escape.
2321
- // No confirmBeforeEnter / keysAfterConfirm: Escape needs no confirm gate.
2322
- return {
2323
- pattern: /Press enter to confirm or esc to continue working/i,
2324
- keys: ["Escape"],
2325
- description: "Codex usage limit — pressing Escape to continue with Luna Reserve",
2326
- blocksDelivery: true,
2327
- inputBlocked: true,
2328
- isActive: codexUsageLimitMenuVisible,
2329
- verifyAfterKeys: true,
2330
- autoResolutionKey: "codex-usage-limit-luna-reserve",
2331
- postDismissNotice: {
2332
- text: t("inst.codex_usage_limit_luna_reserve", ""), // instance name injected by daemon
2333
- label: "codex-usage-limit-selected",
2334
- },
2335
- };
2336
- }
2337
- workspaceLimitPromptDialog() {
2338
- // Escape via sendSpecialKey, the same as the Luna Reserve menu: never a paste
2339
- // (its implicit Enter would confirm the cursor's row) and never "y". The error
2340
- // row codex printed above the prompt stays, and the quota pause takes it from
2341
- // there: one notice, no parked dialog.
2342
- return {
2343
- pattern: /^\s*enter select\s*[·•]\s*esc back\s*$/im,
2344
- keys: ["Escape"],
2345
- description: "Codex workspace limit prompt — pressing Escape (never asking the owner)",
2346
- blocksDelivery: true,
2347
- inputBlocked: true,
2348
- isActive: codexWorkspaceLimitPromptVisible,
2349
- verifyAfterKeys: true,
2350
- autoResolutionKey: "codex-workspace-limit-prompt",
2351
- answeredByAgend: true,
2352
- marksLiveIncident: true,
2353
- };
2354
- }
2355
- unknownSelectionHoldDialog() {
2356
- return {
2357
- pattern: /^\s*[›❯>]\s+\S/m,
2358
- keys: [],
2359
- description: "Codex interactive selection needs human input",
2360
- holdOnly: true,
2361
- blocksDelivery: true,
2362
- inputBlocked: true,
2363
- remoteCard: codexSelectionCard,
2364
- isActive: codexUnknownSelectionVisible,
2365
- };
2366
- }
2367
- getRuntimeDialogs() {
2368
- return [
2369
- this.autoTrustDialog(),
2370
- this.trustHoldDialog(),
2371
- this.rateSwitchPickerDialog(),
2372
- {
2373
- // Codex 0.156 may change the wording/order of this credit-cost choice.
2374
- // Never navigate it by position: a moved option could switch to a
2375
- // more expensive model. A live picker holds delivery and notifies a
2376
- // human; old transcript mentions are excluded by the tail matcher.
2377
- pattern: /(?:Approaching rate limits|Switch to [^\r\n]{1,120} for lower credit usage\?)/i,
2378
- keys: [],
2379
- description: "Codex rate limit model switch dialog needs human choice",
2380
- holdOnly: true,
2381
- blocksDelivery: true,
2382
- inputBlocked: true,
2383
- remoteCard: codexSelectionCard,
2384
- isActive: codexRateSwitchVisible,
2385
- },
2386
- this.updatePickerDialog(),
2387
- this.usageLimitLunaReserveDialog(),
2388
- this.workspaceLimitPromptDialog(),
2389
- ...this.sessionHoldDialogs(),
2390
- this.unknownSelectionHoldDialog(),
2391
- ];
2392
- }
2393
- getInputUnavailableTransients() {
2394
- return [{
2395
- pattern: /(?:^|\n)\s*Resuming session…\s*(?:\n|$)/,
2396
- description: "Codex session resume in progress",
2397
- isActive: (pane) => {
2398
- const rows = pane.split(/\r?\n/);
2399
- return codexBoxedResumeLoading(rows) || codexUnboxedResumeLoading(rows);
2400
- },
2401
- }];
2402
- }
2403
2528
  getContextUsage() {
2404
2529
  return null;
2405
2530
  }
@@ -2412,8 +2537,10 @@ export class CodexBackend {
2412
2537
  plannedCommand(config, approvalFlag, sessionsDir, resumeBy) {
2413
2538
  const plan = this.planResume(config);
2414
2539
  this.lastLaunchResumes = plan.mode === "resume" || plan.mode === "last";
2415
- if (plan.mode === "resume")
2540
+ if (plan.mode === "resume") {
2541
+ this.quotaReplay = snapshotCodexSessionQuotaHistory(this.stateDbPath(), config.workingDirectory, plan.id);
2416
2542
  return `${this.binaryPath} resume ${shellQuote(plan.id)} ${approvalFlag}`;
2543
+ }
2417
2544
  if (plan.mode === "last") {
2418
2545
  this.launchWarning = t("codex.resume_db_unreadable_last", plan.cause);
2419
2546
  return `${this.binaryPath} resume --last ${approvalFlag}`;
@@ -2427,7 +2554,7 @@ export class CodexBackend {
2427
2554
  // there — `codex resume <id>` reads it.
2428
2555
  const found = newestResumableRollout(sessionsDir, config.workingDirectory, undefined, this.failedResumes());
2429
2556
  if (found)
2430
- return resumeBy(found.id, t("codex.resume_auto", config.workingDirectory, found.id), found.bytes);
2557
+ return resumeBy(found.id, t("codex.resume_auto", config.workingDirectory, found.id), found.bytes, found.path);
2431
2558
  return `${this.binaryPath} ${approvalFlag}`;
2432
2559
  }
2433
2560
  /** The database this instance's codex writes (see planResume). */
@@ -2512,10 +2639,6 @@ export class CodexBackend {
2512
2639
  return peers ? codexSiblingState(config.workingDirectory, peers) : "siblings";
2513
2640
  });
2514
2641
  }
2515
- /** Only a resume paints "Resuming session…"; a fresh launch never does. */
2516
- launchMayShowInputTransient() {
2517
- return this.lastLaunchResumes;
2518
- }
2519
2642
  consumeLaunchWarning() {
2520
2643
  const warnings = [this.packageWarning, this.statusLineWarning, this.launchWarning].filter((w) => !!w);
2521
2644
  this.packageWarning = null;
@@ -2523,10 +2646,6 @@ export class CodexBackend {
2523
2646
  this.launchWarning = null;
2524
2647
  return warnings.length ? warnings.join("\n") : null;
2525
2648
  }
2526
- getQuitCommand() { return "/quit"; }
2527
- getCompactCommand() { return "/compact"; }
2528
- getClearCommand() { return "/clear"; }
2529
- getCancelKey() { return "Escape"; }
2530
2649
  // Codex has no `/effort`; reasoning effort is the `model_reasoning_effort`
2531
2650
  // config key (settable per launch with `-c`). The TUI reads it at startup, so
2532
2651
  // a change needs a respawn — restart, not runtime.