@songsid/agend 2.3.5 → 2.4.0-alpha.2

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