@bitkyc08/opencodex 2.96.0 → 2.98.0-preview.20261107

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 (465) hide show
  1. package/bin/ocx.mjs +215 -20
  2. package/gui/dist/assets/App-6TFtZsUF.css +1 -0
  3. package/gui/dist/assets/App-B8_sOxoz.js +59 -0
  4. package/gui/dist/assets/Tray-DpWEp6ee.js +1 -0
  5. package/gui/dist/assets/WantedSansVariable.split.0-Dwvb1WRx.woff2 +0 -0
  6. package/gui/dist/assets/WantedSansVariable.split.1-1wKD2RxI.woff2 +0 -0
  7. package/gui/dist/assets/WantedSansVariable.split.10-CAKA6LIP.woff2 +0 -0
  8. package/gui/dist/assets/WantedSansVariable.split.11-k5H85R4b.woff2 +0 -0
  9. package/gui/dist/assets/WantedSansVariable.split.12-BHboLsUv.woff2 +0 -0
  10. package/gui/dist/assets/WantedSansVariable.split.13-9GV377ix.woff2 +0 -0
  11. package/gui/dist/assets/WantedSansVariable.split.14-DovDXnrj.woff2 +0 -0
  12. package/gui/dist/assets/WantedSansVariable.split.15-DTdykCig.woff2 +0 -0
  13. package/gui/dist/assets/WantedSansVariable.split.16-CKz2ccgK.woff2 +0 -0
  14. package/gui/dist/assets/WantedSansVariable.split.17-Z2RD_KRZ.woff2 +0 -0
  15. package/gui/dist/assets/WantedSansVariable.split.18-BcKtfonJ.woff2 +0 -0
  16. package/gui/dist/assets/WantedSansVariable.split.19-DEQPOSZn.woff2 +0 -0
  17. package/gui/dist/assets/WantedSansVariable.split.2-DryboyuA.woff2 +0 -0
  18. package/gui/dist/assets/WantedSansVariable.split.20-Bia5JMls.woff2 +0 -0
  19. package/gui/dist/assets/WantedSansVariable.split.21-Cr4jFw-E.woff2 +0 -0
  20. package/gui/dist/assets/WantedSansVariable.split.22-DjjB69TZ.woff2 +0 -0
  21. package/gui/dist/assets/WantedSansVariable.split.23-CvUzJskt.woff2 +0 -0
  22. package/gui/dist/assets/WantedSansVariable.split.24-i_eMg5ox.woff2 +0 -0
  23. package/gui/dist/assets/WantedSansVariable.split.25-2aKHwPX-.woff2 +0 -0
  24. package/gui/dist/assets/WantedSansVariable.split.26-B6wXoCEL.woff2 +0 -0
  25. package/gui/dist/assets/WantedSansVariable.split.27-D4h1WfGM.woff2 +0 -0
  26. package/gui/dist/assets/WantedSansVariable.split.28-kvRPCStd.woff2 +0 -0
  27. package/gui/dist/assets/WantedSansVariable.split.29-DHAiwleD.woff2 +0 -0
  28. package/gui/dist/assets/WantedSansVariable.split.3-7H--eyZi.woff2 +0 -0
  29. package/gui/dist/assets/WantedSansVariable.split.30-C66cfAY2.woff2 +0 -0
  30. package/gui/dist/assets/WantedSansVariable.split.31-FDmtiNim.woff2 +0 -0
  31. package/gui/dist/assets/WantedSansVariable.split.32-DouHt2Dd.woff2 +0 -0
  32. package/gui/dist/assets/WantedSansVariable.split.33-B8HVvkJX.woff2 +0 -0
  33. package/gui/dist/assets/WantedSansVariable.split.34-BtkRu1FN.woff2 +0 -0
  34. package/gui/dist/assets/WantedSansVariable.split.35-DBylQbtk.woff2 +0 -0
  35. package/gui/dist/assets/WantedSansVariable.split.36-Sg089Kgh.woff2 +0 -0
  36. package/gui/dist/assets/WantedSansVariable.split.37-CYtvbriS.woff2 +0 -0
  37. package/gui/dist/assets/WantedSansVariable.split.38-DKkSLf8Z.woff2 +0 -0
  38. package/gui/dist/assets/WantedSansVariable.split.39-CecotKZD.woff2 +0 -0
  39. package/gui/dist/assets/WantedSansVariable.split.4-Bv8O3ZMb.woff2 +0 -0
  40. package/gui/dist/assets/WantedSansVariable.split.40-DdCvkmOU.woff2 +0 -0
  41. package/gui/dist/assets/WantedSansVariable.split.41-ESn674Hc.woff2 +0 -0
  42. package/gui/dist/assets/WantedSansVariable.split.42-DL9V7NNV.woff2 +0 -0
  43. package/gui/dist/assets/WantedSansVariable.split.43-yipO0cyk.woff2 +0 -0
  44. package/gui/dist/assets/WantedSansVariable.split.44-6rTmLZhm.woff2 +0 -0
  45. package/gui/dist/assets/WantedSansVariable.split.45-BJAj8lrm.woff2 +0 -0
  46. package/gui/dist/assets/WantedSansVariable.split.46-BDTzMn2c.woff2 +0 -0
  47. package/gui/dist/assets/WantedSansVariable.split.47-Bxd4wGgi.woff2 +0 -0
  48. package/gui/dist/assets/WantedSansVariable.split.48-DxnFBLnH.woff2 +0 -0
  49. package/gui/dist/assets/WantedSansVariable.split.49-DnVD0aOD.woff2 +0 -0
  50. package/gui/dist/assets/WantedSansVariable.split.5-B1wI2pp5.woff2 +0 -0
  51. package/gui/dist/assets/WantedSansVariable.split.50-D9JlkZd6.woff2 +0 -0
  52. package/gui/dist/assets/WantedSansVariable.split.51-D9Vw6Bu3.woff2 +0 -0
  53. package/gui/dist/assets/WantedSansVariable.split.52-ClEJk4kn.woff2 +0 -0
  54. package/gui/dist/assets/WantedSansVariable.split.53-BSXU0vh-.woff2 +0 -0
  55. package/gui/dist/assets/WantedSansVariable.split.54-EcuxkR9v.woff2 +0 -0
  56. package/gui/dist/assets/WantedSansVariable.split.55-CYiFhQX8.woff2 +0 -0
  57. package/gui/dist/assets/WantedSansVariable.split.56--Gk9g8BK.woff2 +0 -0
  58. package/gui/dist/assets/WantedSansVariable.split.57-DnkOPZcy.woff2 +0 -0
  59. package/gui/dist/assets/WantedSansVariable.split.58-9MB8504z.woff2 +0 -0
  60. package/gui/dist/assets/WantedSansVariable.split.59-ByxIsN72.woff2 +0 -0
  61. package/gui/dist/assets/WantedSansVariable.split.6-Bmk0dRVw.woff2 +0 -0
  62. package/gui/dist/assets/WantedSansVariable.split.60-Bxwx_aWQ.woff2 +0 -0
  63. package/gui/dist/assets/WantedSansVariable.split.61-DA2z5sm7.woff2 +0 -0
  64. package/gui/dist/assets/WantedSansVariable.split.62-C5iJPJZn.woff2 +0 -0
  65. package/gui/dist/assets/WantedSansVariable.split.63-DAqrmaEc.woff2 +0 -0
  66. package/gui/dist/assets/WantedSansVariable.split.64-BgXFsljb.woff2 +0 -0
  67. package/gui/dist/assets/WantedSansVariable.split.65-DKiWujvu.woff2 +0 -0
  68. package/gui/dist/assets/WantedSansVariable.split.66-8po4vUZ4.woff2 +0 -0
  69. package/gui/dist/assets/WantedSansVariable.split.67-Cy5qyI9O.woff2 +0 -0
  70. package/gui/dist/assets/WantedSansVariable.split.68-BKny7Fy3.woff2 +0 -0
  71. package/gui/dist/assets/WantedSansVariable.split.69-B4VU4u_b.woff2 +0 -0
  72. package/gui/dist/assets/WantedSansVariable.split.7-BuqwNpgA.woff2 +0 -0
  73. package/gui/dist/assets/WantedSansVariable.split.70-BCd4n346.woff2 +0 -0
  74. package/gui/dist/assets/WantedSansVariable.split.71-CkQppaWn.woff2 +0 -0
  75. package/gui/dist/assets/WantedSansVariable.split.72-Db7vaoFs.woff2 +0 -0
  76. package/gui/dist/assets/WantedSansVariable.split.73-DI80TYWl.woff2 +0 -0
  77. package/gui/dist/assets/WantedSansVariable.split.74-tMCtDAHB.woff2 +0 -0
  78. package/gui/dist/assets/WantedSansVariable.split.75-Ciw0D5WG.woff2 +0 -0
  79. package/gui/dist/assets/WantedSansVariable.split.76-DoLjFgp-.woff2 +0 -0
  80. package/gui/dist/assets/WantedSansVariable.split.77-CpT2uvMy.woff2 +0 -0
  81. package/gui/dist/assets/WantedSansVariable.split.78-CkcJ4iZ1.woff2 +0 -0
  82. package/gui/dist/assets/WantedSansVariable.split.79-DsOUJjEM.woff2 +0 -0
  83. package/gui/dist/assets/WantedSansVariable.split.8-DsjypPd6.woff2 +0 -0
  84. package/gui/dist/assets/WantedSansVariable.split.80-C0VwHTte.woff2 +0 -0
  85. package/gui/dist/assets/WantedSansVariable.split.81-DTelu57i.woff2 +0 -0
  86. package/gui/dist/assets/WantedSansVariable.split.82-BiMndGN1.woff2 +0 -0
  87. package/gui/dist/assets/WantedSansVariable.split.83-CVcC6eDG.woff2 +0 -0
  88. package/gui/dist/assets/WantedSansVariable.split.84-DlhZVt_O.woff2 +0 -0
  89. package/gui/dist/assets/WantedSansVariable.split.85-S8I2D3pA.woff2 +0 -0
  90. package/gui/dist/assets/WantedSansVariable.split.86-DozXXpH5.woff2 +0 -0
  91. package/gui/dist/assets/WantedSansVariable.split.87-Dsn0Vuuo.woff2 +0 -0
  92. package/gui/dist/assets/WantedSansVariable.split.88-iNwxxDCr.woff2 +0 -0
  93. package/gui/dist/assets/WantedSansVariable.split.89-B63u_9CZ.woff2 +0 -0
  94. package/gui/dist/assets/WantedSansVariable.split.9-Bi3IzpMI.woff2 +0 -0
  95. package/gui/dist/assets/WantedSansVariable.split.90-ByeH1Pqf.woff2 +0 -0
  96. package/gui/dist/assets/WantedSansVariable.split.91-UQLlagpm.woff2 +0 -0
  97. package/gui/dist/assets/brand-mark-VPhzz-WE.js +1 -0
  98. package/gui/dist/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  99. package/gui/dist/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  100. package/gui/dist/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  101. package/gui/dist/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  102. package/gui/dist/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2 +0 -0
  103. package/gui/dist/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2 +0 -0
  104. package/gui/dist/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2 +0 -0
  105. package/gui/dist/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2 +0 -0
  106. package/gui/dist/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2 +0 -0
  107. package/gui/dist/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2 +0 -0
  108. package/gui/dist/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  109. package/gui/dist/assets/index-5REODpG3.css +2 -0
  110. package/gui/dist/assets/index-BWKBeK77.js +94 -0
  111. package/gui/dist/assets/segment-thumb-features-BQYzrze9.js +1 -0
  112. package/gui/dist/classic/assets/App-Bz65x1J6.js +58 -0
  113. package/gui/dist/{assets/Tray-BOPQyDbH.js → classic/assets/Tray-kk7mdO6I.js} +1 -1
  114. package/gui/dist/classic/assets/index-Dp2j8bSc.js +94 -0
  115. package/gui/dist/classic/assets/quota-summary-CvamtHjB.js +1 -0
  116. package/gui/dist/classic/index.html +47 -0
  117. package/gui/dist/favicon.png +0 -0
  118. package/gui/dist/favicon.svg +14 -0
  119. package/gui/dist/index.html +15 -2
  120. package/package.json +1 -1
  121. package/src/adapters/anthropic.ts +17 -8
  122. package/src/adapters/command-code.ts +15 -16
  123. package/src/adapters/cursor/transport-retry.ts +2 -2
  124. package/src/adapters/devin/cloud-direct/chat.ts +15 -6
  125. package/src/adapters/google.ts +7 -7
  126. package/src/adapters/kiro/adapter.ts +18 -3
  127. package/src/adapters/kiro/conversation.ts +8 -8
  128. package/src/adapters/kiro/payload.ts +45 -12
  129. package/src/adapters/kiro/stream.ts +230 -14
  130. package/src/adapters/kiro/structured-output-json.ts +191 -0
  131. package/src/adapters/kiro/structured-output-schema.ts +542 -0
  132. package/src/adapters/kiro/structured-output.ts +367 -0
  133. package/src/adapters/kiro-constants.ts +24 -1
  134. package/src/adapters/kiro-events.ts +31 -1
  135. package/src/adapters/kiro-retry.ts +3 -3
  136. package/src/adapters/kiro-tools.ts +14 -9
  137. package/src/adapters/kiro-wire.ts +9 -5
  138. package/src/adapters/ollama-native.ts +11 -1
  139. package/src/adapters/openai-chat/messages.ts +58 -5
  140. package/src/adapters/openai-chat/mistral-image-limit.ts +50 -0
  141. package/src/adapters/openai-chat/passthrough.ts +5 -3
  142. package/src/adapters/openai-chat/tool-schema.ts +83 -13
  143. package/src/adapters/openai-responses/empty-assistant.ts +15 -3
  144. package/src/adapters/openai-responses/opengateway-input.ts +18 -6
  145. package/src/adapters/openai-responses/passthrough.ts +5 -4
  146. package/src/adapters/openai-responses/reasoning.ts +9 -4
  147. package/src/adapters/openai-responses/request-strips.ts +1 -1
  148. package/src/adapters/openai-responses/tool-output-recovery.ts +79 -0
  149. package/src/adapters/physical-send.ts +3 -3
  150. package/src/adapters/qoder/live-models.ts +115 -1
  151. package/src/adapters/zed-openai-stream.ts +2 -1
  152. package/src/bridge/errors.ts +11 -2
  153. package/src/bridge/response-json.ts +2 -1
  154. package/src/bridge/sse.ts +14 -6
  155. package/src/chat/failure-verdict.ts +21 -0
  156. package/src/chat/outbound.ts +139 -21
  157. package/src/claude/failure-verdict.ts +21 -0
  158. package/src/claude/inbound-content-options.ts +15 -2
  159. package/src/claude/inbound-model-options.ts +2 -1
  160. package/src/claude/inbound-records.ts +2 -0
  161. package/src/claude/inbound.ts +17 -11
  162. package/src/claude/outbound.ts +98 -22
  163. package/src/cli/capabilities-access-remote.ts +13 -0
  164. package/src/cli/capabilities-base.ts +26 -3
  165. package/src/cli/capabilities-command.ts +12 -3
  166. package/src/cli/capabilities-provider-models.ts +3 -3
  167. package/src/cli/capability-contracts.ts +2 -0
  168. package/src/cli/codex-launch-auth.ts +30 -1
  169. package/src/cli/codex-launcher.ts +12 -5
  170. package/src/cli/codex-shim-autorestore.ts +12 -4
  171. package/src/cli/config-command.ts +11 -2
  172. package/src/cli/connect.ts +17 -2
  173. package/src/cli/dispatch.ts +14 -177
  174. package/src/cli/doctor.ts +95 -7
  175. package/src/cli/help.ts +2 -2
  176. package/src/cli/index.ts +17 -8
  177. package/src/cli/link-apply-restart.ts +9 -2
  178. package/src/cli/link.ts +1 -1
  179. package/src/cli/models.ts +124 -38
  180. package/src/cli/registry.ts +12 -4
  181. package/src/cli/restart-failure.ts +17 -0
  182. package/src/cli/root.ts +8 -0
  183. package/src/cli/stop-approval.ts +2 -2
  184. package/src/cli/sync-command.ts +243 -0
  185. package/src/cli/sync-fanout-process.ts +92 -0
  186. package/src/cli/sync-fanout.ts +161 -0
  187. package/src/cli/sync-flags.ts +10 -0
  188. package/src/cli/sync-link-status.ts +39 -0
  189. package/src/cli/sync-update-guard.ts +18 -0
  190. package/src/cli/system-restart-client.ts +5 -0
  191. package/src/cli/uninstall-client-state.ts +12 -1
  192. package/src/cli/update-restart-child.ts +13 -3
  193. package/src/cli/update-restart-home.ts +6 -3
  194. package/src/cli/update-restart.ts +36 -19
  195. package/src/client/connect.ts +35 -15
  196. package/src/client/hub-client.ts +5 -0
  197. package/src/client/link-home.ts +3 -2
  198. package/src/client/link-management-relay.ts +39 -2
  199. package/src/client/link-readiness.ts +3 -1
  200. package/src/client/machine-api.ts +2 -1
  201. package/src/client/machine-listener.ts +10 -0
  202. package/src/client/orphan-token-recovery.ts +322 -0
  203. package/src/client/restore-ownership.ts +19 -1
  204. package/src/client/runtime-restart.ts +12 -4
  205. package/src/client/runtime.ts +40 -11
  206. package/src/client/stop-routing.ts +62 -0
  207. package/src/client/sync-runtime.ts +65 -0
  208. package/src/clients/config-export.ts +32 -3
  209. package/src/codex/auth-context.ts +49 -103
  210. package/src/codex/catalog/antigravity-discovery.ts +16 -5
  211. package/src/codex/catalog/provider-models.ts +18 -12
  212. package/src/codex/forward-transport-headers.ts +35 -6
  213. package/src/codex/inject/config-toml.ts +88 -0
  214. package/src/codex/inject/multi-agent-v2.ts +30 -4
  215. package/src/codex/inject/plan.ts +34 -7
  216. package/src/codex/inject-coordination.ts +11 -0
  217. package/src/codex/inject.ts +18 -7
  218. package/src/codex/lineage.ts +13 -7
  219. package/src/codex/native-profile-api.ts +27 -1
  220. package/src/codex/quota.ts +22 -6
  221. package/src/codex/request-owned-affinity-key.ts +11 -0
  222. package/src/codex/request-owned-affinity.ts +118 -0
  223. package/src/codex/request-owned-main-pin.ts +86 -0
  224. package/src/codex/role-capability.ts +52 -41
  225. package/src/codex/routing/active-account.ts +13 -5
  226. package/src/codex/routing/selection.ts +40 -1
  227. package/src/codex/routing/thread-affinity-store.ts +916 -0
  228. package/src/codex/routing/thread-affinity.ts +90 -12
  229. package/src/codex/shim-diagnostics.ts +7 -0
  230. package/src/codex/shim-legacy-record.ts +290 -0
  231. package/src/codex/shim-windows-refresh.ts +9 -2
  232. package/src/codex/shim-wrapper-write.ts +7 -0
  233. package/src/codex/shim.ts +80 -21
  234. package/src/codex/toml-source-lines.ts +72 -13
  235. package/src/combos/failover.ts +6 -109
  236. package/src/combos/request.ts +2 -2
  237. package/src/combos/resolve.ts +29 -11
  238. package/src/config/diagnostics.ts +9 -9
  239. package/src/config/load-degrade.ts +27 -27
  240. package/src/config/process-state.ts +5 -0
  241. package/src/config/provider-validation.ts +9 -2
  242. package/src/config/removed-opencode-free-backup.ts +6 -3
  243. package/src/config/schema/leaf-validators.ts +1 -0
  244. package/src/config/tracked-runtime-inspection.ts +3 -3
  245. package/src/generated/compatibility-version.json +595 -255
  246. package/src/images/loop.ts +4 -3
  247. package/src/lib/client-error-body.ts +215 -0
  248. package/src/lib/client-retry-after.ts +66 -0
  249. package/src/lib/config-ownership-removal.ts +422 -0
  250. package/src/lib/config-ownership.ts +650 -81
  251. package/src/lib/context-overflow-verdict.ts +113 -0
  252. package/src/lib/crash-guard.ts +4 -2
  253. package/src/lib/desktop-cli-handoff.d.mts +4 -5
  254. package/src/lib/desktop-cli-handoff.mjs +18 -17
  255. package/src/lib/empty-tool-catalog.ts +25 -3
  256. package/src/lib/error-destination.ts +47 -0
  257. package/src/lib/errors.ts +1 -0
  258. package/src/lib/failure-detail.ts +66 -0
  259. package/src/lib/local-management-capability.ts +3 -1
  260. package/src/lib/messages-error-body.ts +162 -0
  261. package/src/lib/messages-sse-error-presentation.ts +93 -0
  262. package/src/lib/model-identity.ts +44 -0
  263. package/src/lib/passive-read.ts +9 -4
  264. package/src/lib/private-sqlite-path.ts +124 -0
  265. package/src/lib/response-service-tier.ts +17 -0
  266. package/src/lib/retry-after.ts +3 -0
  267. package/src/lib/socks5-fetch.ts +21 -9
  268. package/src/lib/spend-ledger-owner.ts +43 -4
  269. package/src/lib/upstream-condition.ts +142 -0
  270. package/src/lib/upstream-retry.ts +95 -12
  271. package/src/lib/windows-owner-acl.ts +22 -9
  272. package/src/lib/winsw.ts +5 -5
  273. package/src/lib/workflow-budget.ts +3 -1
  274. package/src/link/remote-platform.ts +14 -0
  275. package/src/link/remote-windows.ts +51 -9
  276. package/src/link/ssh-argv.ts +63 -10
  277. package/src/oauth/generic-account-failover.ts +13 -11
  278. package/src/oauth/index.ts +42 -73
  279. package/src/oauth/oauth-errors.ts +67 -0
  280. package/src/oauth/store.ts +21 -11
  281. package/src/protocols/codecs/messages-ir.ts +15 -9
  282. package/src/protocols/codecs/ollama.ts +197 -0
  283. package/src/protocols/encoders/adapter-events.ts +30 -7
  284. package/src/protocols/encoders/chat.ts +18 -10
  285. package/src/protocols/encoders/messages.ts +72 -28
  286. package/src/protocols/trace.ts +18 -0
  287. package/src/providers/antigravity-models.ts +45 -12
  288. package/src/providers/fastwire.ts +3 -2
  289. package/src/providers/free-directory.ts +2 -2
  290. package/src/providers/quota/anthropic-usage-windows.ts +13 -3
  291. package/src/providers/quota/vendor-probes-key.ts +60 -24
  292. package/src/providers/reasoning-metadata.ts +2 -1
  293. package/src/providers/registry/entries-extended.ts +9 -0
  294. package/src/providers/request-pacing.ts +3 -2
  295. package/src/reasoning-effort.ts +7 -2
  296. package/src/remote/hub-usage.ts +3 -0
  297. package/src/responses/apply-patch-envelope.ts +45 -19
  298. package/src/responses/compaction-history-framing.ts +5 -1
  299. package/src/responses/freeform-wrapper-scan.ts +5 -3
  300. package/src/responses/progressive-freeform-input.ts +354 -45
  301. package/src/routing/fallback-policy.ts +3 -1
  302. package/src/server/admission-model-scope.ts +17 -6
  303. package/src/server/admitted-http-turn.ts +57 -0
  304. package/src/server/anthropic-rate-limit-headers.ts +75 -3
  305. package/src/server/auth-cors.ts +5 -0
  306. package/src/server/chat-completions.ts +45 -20
  307. package/src/server/chat-native-sse.ts +52 -7
  308. package/src/server/chat-native.ts +60 -35
  309. package/src/server/claude-bridge-pool-session.ts +59 -0
  310. package/src/server/claude-messages.ts +174 -84
  311. package/src/server/context-history.ts +5 -1
  312. package/src/server/gui-static.ts +4 -1
  313. package/src/server/hub-usage.ts +7 -2
  314. package/src/server/inbound-body-admission.ts +11 -4
  315. package/src/server/index/link-management.ts +8 -0
  316. package/src/server/index/ollama-routes.ts +91 -0
  317. package/src/server/index/serve-options.ts +44 -24
  318. package/src/server/index/startup-warnings.ts +5 -12
  319. package/src/server/index/websocket-handler.ts +5 -2
  320. package/src/server/index.ts +6 -36
  321. package/src/server/inference/client-encoder-delivery.ts +9 -3
  322. package/src/server/json-serialized-bytes.ts +44 -0
  323. package/src/server/management/agent-settings-routes.ts +24 -21
  324. package/src/server/management/codex-cli-update-routes.ts +2 -1
  325. package/src/server/management/logs-usage-routes.ts +89 -4
  326. package/src/server/management/provider-routes.ts +2 -22
  327. package/src/server/management/qoder-provider-probe.ts +105 -0
  328. package/src/server/management/route-registry.ts +4 -1
  329. package/src/server/management/usage-aggregate-cache.ts +15 -5
  330. package/src/server/management/usage-source-facets.ts +38 -0
  331. package/src/server/messages-native-scope.ts +2 -1
  332. package/src/server/messages-native-tool-guard.ts +12 -4
  333. package/src/server/messages-native.ts +123 -47
  334. package/src/server/messages-response-headers.ts +25 -11
  335. package/src/server/messages-shared.ts +99 -65
  336. package/src/server/messages-sse-error-filter.ts +199 -0
  337. package/src/server/native-final-log.ts +93 -0
  338. package/src/server/ollama-inbound.ts +349 -0
  339. package/src/server/ollama-native-paths.ts +21 -0
  340. package/src/server/ollama-route-policy.ts +73 -0
  341. package/src/server/relay.ts +22 -3
  342. package/src/server/request-decompress.ts +4 -2
  343. package/src/server/request-log-failure-attribution.ts +22 -0
  344. package/src/server/request-log-failure-detail.ts +80 -0
  345. package/src/server/request-log-terminal-status.ts +4 -2
  346. package/src/server/request-log.ts +91 -42
  347. package/src/server/response-log-body.ts +6 -1
  348. package/src/server/responses/account-change-state.ts +17 -6
  349. package/src/server/responses/adapter-continuation.ts +17 -6
  350. package/src/server/responses/adapter-delivery.ts +17 -10
  351. package/src/server/responses/adapter-dispatch.ts +32 -31
  352. package/src/server/responses/anthropic-thinking-recovery.ts +3 -0
  353. package/src/server/responses/codex-auth-error.ts +24 -19
  354. package/src/server/responses/codex-ws-exchange.ts +11 -8
  355. package/src/server/responses/codex-ws-metadata.ts +94 -21
  356. package/src/server/responses/codex-ws-request.ts +3 -1
  357. package/src/server/responses/codex-ws-wire.ts +19 -3
  358. package/src/server/responses/compact.ts +57 -24
  359. package/src/server/responses/compaction-recovery.ts +4 -2
  360. package/src/server/responses/compaction-routing.ts +9 -4
  361. package/src/server/responses/core-auth.ts +32 -14
  362. package/src/server/responses/core-codex-account.ts +17 -6
  363. package/src/server/responses/core-combo-failure.ts +7 -1
  364. package/src/server/responses/core-combo-native.ts +2 -1
  365. package/src/server/responses/core-combo.ts +43 -27
  366. package/src/server/responses/core-errors.ts +24 -21
  367. package/src/server/responses/core-lifetime.ts +6 -3
  368. package/src/server/responses/core-normalize.ts +1 -0
  369. package/src/server/responses/core-options.ts +9 -0
  370. package/src/server/responses/core-pipeline.ts +4 -3
  371. package/src/server/responses/empty-completion-guard.ts +4 -1
  372. package/src/server/responses/fetch-helpers.ts +7 -1
  373. package/src/server/responses/input-admission.ts +28 -2
  374. package/src/server/responses/native-injection.ts +1 -1
  375. package/src/server/responses/native-response-json.ts +13 -4
  376. package/src/server/responses/native-response-output.ts +1 -2
  377. package/src/server/responses/non-replayable-error.ts +2 -1
  378. package/src/server/responses/pacing-overload.ts +3 -2
  379. package/src/server/responses/passthrough-delivery.ts +55 -14
  380. package/src/server/responses/passthrough-dispatch.ts +20 -18
  381. package/src/server/responses/passthrough-error.ts +9 -9
  382. package/src/server/responses/policy-fallback.ts +2 -1
  383. package/src/server/responses/request-prepare.ts +69 -48
  384. package/src/server/responses/request-transport.ts +36 -31
  385. package/src/server/responses/response-effects.ts +3 -2
  386. package/src/server/responses/run-turn-execution.ts +6 -6
  387. package/src/server/responses/sidecar-execution.ts +16 -12
  388. package/src/server/responses/spend-storage-error.ts +2 -1
  389. package/src/server/responses/terminal-guard.ts +30 -0
  390. package/src/server/responses/ws-upstream.ts +9 -0
  391. package/src/server/responses-custom-tool-repair.ts +14 -3
  392. package/src/server/responses-terminal-repair.ts +5 -2
  393. package/src/server/responses-undeclared-tool-guard.ts +39 -16
  394. package/src/server/restart-replacement.ts +3 -1
  395. package/src/server/safe-response-headers.ts +162 -13
  396. package/src/server/sse-payload-rewrite.ts +23 -11
  397. package/src/server/turn-state-handles.ts +164 -0
  398. package/src/server/workflow-refusal.ts +2 -1
  399. package/src/server/ws-bridge.ts +4 -0
  400. package/src/service/definition.ts +36 -4
  401. package/src/service/launchd.ts +89 -32
  402. package/src/service/logging.ts +34 -7
  403. package/src/service/ownership-mutation-lease.d.mts +11 -2
  404. package/src/service/ownership-mutation-lease.mjs +53 -11
  405. package/src/service/plist-xml.ts +59 -0
  406. package/src/service/state.ts +8 -0
  407. package/src/service/systemd-env.ts +2 -0
  408. package/src/service/systemd.ts +31 -7
  409. package/src/service/windows-taskxml.ts +16 -7
  410. package/src/service-manager-probe.ts +4 -10
  411. package/src/types/config.ts +2 -0
  412. package/src/types/provider.ts +2 -0
  413. package/src/types/request.ts +13 -1
  414. package/src/update/config-preflight.ts +48 -0
  415. package/src/update/index.ts +148 -26
  416. package/src/update/npm-install.d.mts +8 -0
  417. package/src/update/npm-install.mjs +20 -1
  418. package/src/update/orchestrated-admission.d.mts +4 -0
  419. package/src/update/orchestrated-admission.mjs +12 -0
  420. package/src/update/orchestrated-arguments.d.mts +12 -0
  421. package/src/update/orchestrated-arguments.mjs +64 -0
  422. package/src/update/orchestrated-child.d.mts +12 -0
  423. package/src/update/orchestrated-child.mjs +70 -0
  424. package/src/update/orchestrated-entry.ts +234 -0
  425. package/src/update/orchestrated-identity-probe-entry.ts +20 -0
  426. package/src/update/orchestrated-identity.ts +53 -0
  427. package/src/update/orchestrated-live-identity.ts +48 -0
  428. package/src/update/orchestrated-node-driver.mjs +99 -0
  429. package/src/update/orchestrated-outcome.d.mts +21 -0
  430. package/src/update/orchestrated-outcome.mjs +40 -0
  431. package/src/update/orchestrated-plan.ts +49 -0
  432. package/src/update/orchestrated-pnpm.d.mts +8 -0
  433. package/src/update/orchestrated-pnpm.mjs +33 -0
  434. package/src/update/orchestrated-session.d.mts +37 -0
  435. package/src/update/orchestrated-session.mjs +264 -0
  436. package/src/update/orchestrated-token.d.mts +10 -0
  437. package/src/update/orchestrated-token.mjs +21 -0
  438. package/src/update/orchestrated-token.ts +3 -0
  439. package/src/update/orchestrated-tree.d.mts +1 -0
  440. package/src/update/orchestrated-tree.mjs +14 -0
  441. package/src/update/pnpm-global-install.d.mts +6 -0
  442. package/src/update/pnpm-global-install.mjs +9 -2
  443. package/src/update/posix-install-supervisor-entry.mjs +6 -0
  444. package/src/update/posix-install-supervisor.d.mts +10 -0
  445. package/src/update/posix-install-supervisor.mjs +88 -0
  446. package/src/update/sync-update-mutex.d.mts +10 -0
  447. package/src/update/sync-update-mutex.mjs +164 -0
  448. package/src/update/sync-update-mutex.ts +1 -0
  449. package/src/update/test-home-guard.mjs +33 -0
  450. package/src/update/transactional-install.mjs +2 -2
  451. package/src/usage/client.ts +43 -0
  452. package/src/usage/error-detail.ts +225 -0
  453. package/src/usage/log.ts +64 -27
  454. package/src/usage/source-facets.ts +51 -0
  455. package/src/usage/source-filter.ts +65 -0
  456. package/src/usage/summary.ts +50 -8
  457. package/src/web-search/anthropic-executor.ts +105 -24
  458. package/src/web-search/executor.ts +5 -3
  459. package/src/web-search/loop.ts +33 -6
  460. package/src/web-search/progress-stream.ts +64 -5
  461. package/gui/dist/assets/App-bwugJRKn.js +0 -58
  462. package/gui/dist/assets/index-ebuVUtB7.js +0 -94
  463. package/gui/dist/assets/quota-summary-6HsrHQAy.js +0 -1
  464. /package/gui/dist/{assets → classic/assets}/App-B4j-Txmb.css +0 -0
  465. /package/gui/dist/{assets → classic/assets}/index-CHWwDo9L.css +0 -0
package/bin/ocx.mjs CHANGED
@@ -12,6 +12,7 @@ import { guardedRun, guardedSpawn, guardedSpawnSync, guardedExit, probeProcessAl
12
12
  import { probeSpawn, probeSpawnSync } from "../src/update/mutation-guard.mjs";
13
13
  import { createSupervisionLatch, inspectDesktopSupervision } from "../src/service/desktop-supervision.mjs";
14
14
  import { planDesktopCliHandoff, runDesktopCliHandoff } from "../src/lib/desktop-cli-handoff.mjs";
15
+ import { acquireSyncGuard } from "../src/update/sync-update-mutex.mjs";
15
16
  import { desktopCliRecordPath } from "../src/lib/desktop-cli-record.mjs";
16
17
  import { STOP_HISTORY_INCOMPLETE_EXIT_CODE } from "../src/update/stop-contract.mjs";
17
18
  import { probeProxyLiveness } from "../src/update/proxy-liveness-probe.mjs";
@@ -43,9 +44,14 @@ import { isRealBunBinary } from "../src/lib/bun-binary-validator.mjs";
43
44
  import { scopeTranspilerCacheToRuntime } from "../src/lib/bun-transpiler-cache-scope.mjs";
44
45
  import { findDesktopCli, findPathBun } from "../src/lib/bun-path-runtime.mjs";
45
46
  import { npmInvocation } from "../src/update/npm-invocation.mjs";
46
- import { runNpmInstall } from "../src/update/npm-install.mjs";
47
+ import { runNpmInstall, runWindowsInstallerSync } from "../src/update/npm-install.mjs";
48
+ import { runPosixInstallerSync } from "../src/update/posix-install-supervisor.mjs";
47
49
  import { pnpmInvocationForPath, resolvePnpmCommands } from "../src/update/pnpm-invocation.mjs";
48
50
  import { detectInstallOwnershipFromPath } from "../src/update/install-detection.mjs";
51
+ import { isOrchestratedUpdateArgv, parseOrchestratedUpdateArgs, parseOrchestratedChildArgs } from "../src/update/orchestrated-arguments.mjs";
52
+ import { createLegacyUpdateSession, createOrchestratedChildSession, decodeOrchestratedExpect } from "../src/update/orchestrated-session.mjs";
53
+ import { createUpdatePlanToken } from "../src/update/orchestrated-token.mjs";
54
+ import { applyNodeOrchestratedUpdate } from "../src/update/orchestrated-node-driver.mjs";
49
55
  import {
50
56
  pnpmOwnerInvocation,
51
57
  resolvePnpmGlobalOwner,
@@ -232,7 +238,48 @@ function runningPnpmShimPath() {
232
238
  return resolve(invoked);
233
239
  }
234
240
 
235
- async function runPackageManagerSelfUpdate(manager) {
241
+ async function runPackageManagerSelfUpdate(manager, child) {
242
+ let session, enteredMutation = false;
243
+ let childOutcome = { phase: "failed", rollbackPerformed: false };
244
+ if (child) {
245
+ try {
246
+ const expected = decodeOrchestratedExpect(child.expect);
247
+ session = createOrchestratedChildSession({ home: configDir(), resultPath: child.resultPath, resultCapability: child.resultCapability, expect: expected,
248
+ notAfter: child.notAfter, verifyIdentity: () => {
249
+ const bun = resolveBun({ allowInstall: false, allowMissing: true });
250
+ if (!bun) return false;
251
+ const probe = probeSpawnSync(bun.path, ["--no-env-file", join(here, "../src/update/orchestrated-identity-probe-entry.ts"), "__update-orchestrated-identity"], {
252
+ encoding: "utf8", timeout: 8000, maxBuffer: 8192, windowsHide: true, stdio: ["ignore", "pipe", "ignore"],
253
+ env: { ...updateHomeProbeEnvironment(process.env, { codexHome: process.env.CODEX_HOME ?? "", opencodexHome: configDir() }),
254
+ OCX_IDENTITY_CLI_ROOT: resolve(here, ".."), OCX_IDENTITY_INSTALLER: manager, OCX_IDENTITY_TARGET: child.version },
255
+ });
256
+ if (probe.status !== 0 || probe.error || probe.signal || typeof probe.stdout !== "string") return false;
257
+ const observed = JSON.parse(probe.stdout);
258
+ return observed.permits === true && observed.cliRoot === expected.cliRoot && observed.planToken === expected.planToken
259
+ && (observed.kind === "absent" ? expected.servingRoot === null && expected.runtimePid === null
260
+ : observed.kind === "live" && observed.servingRoot === expected.servingRoot && observed.runtime?.pid === expected.runtimePid);
261
+ } });
262
+ if (!session.start().ok) process.exit(10);
263
+ // The parent may forward a signal while a synchronous installer is running. Keep the
264
+ // owner alive through its transaction and recovery so the mutex cannot outlive us.
265
+ for (const signal of ["SIGINT", "SIGTERM", ...(process.platform === "win32" ? [] : ["SIGHUP"])]) process.on(signal, () => {});
266
+ process.once("exit", () => {
267
+ try { if (enteredMutation) session.finish(childOutcome); else session.finishPreflight(); }
268
+ catch (error) { console.error(`Orchestrated outcome write failed: ${error?.message ?? error}`); process.exitCode = 1; }
269
+ });
270
+ } catch (error) {
271
+ console.error(`Orchestrated update preflight failed: ${error?.message ?? error}`);
272
+ process.exit(1);
273
+ }
274
+ } else {
275
+ session = createLegacyUpdateSession({ home: configDir() });
276
+ const started = session.start();
277
+ if (!started.ok) { console.error(`opencodex: ${started.error}`); process.exit(1); }
278
+ process.once("exit", () => {
279
+ try { if (enteredMutation) session.finish(childOutcome); else session.finishPreflight(); }
280
+ catch (error) { console.error(`Update outcome write failed: ${error?.message ?? error}`); process.exitCode = 1; }
281
+ });
282
+ }
236
283
  const current = currentPackageVersion();
237
284
  const tag = updateTag(current);
238
285
  let owner;
@@ -279,17 +326,18 @@ async function runPackageManagerSelfUpdate(manager) {
279
326
  : invocation.env ? { env: invocation.env } : {}),
280
327
  ...invocation.options,
281
328
  });
282
- const latestInvocation = managerInvocation(["view", `${PKG}@${tag}`, "version"]);
329
+ const selector = child?.version ?? tag;
330
+ const latestInvocation = managerInvocation(["view", `${PKG}@${selector}`, "version"]);
283
331
  const installArgs = manager === "pnpm"
284
- ? ["add", "-g", "--allow-build=bun", `${PKG}@${tag}`]
285
- : ["install", "-g", `${PKG}@${tag}`];
332
+ ? ["add", "-g", "--allow-build=bun", `${PKG}@${selector}`]
333
+ : ["install", "-g", `${PKG}@${selector}`];
286
334
  const installInvocation = managerInvocation(installArgs);
287
335
  if (!latestInvocation || !installInvocation) {
288
336
  console.error(`opencodex: could not resolve ${manager} from a trusted absolute PATH entry; aborting before stopping the proxy.`);
289
337
  process.exit(1);
290
338
  }
291
339
  const latestResult = probeSpawnSync(latestInvocation.file, latestInvocation.args, readProbeOptions(latestInvocation));
292
- const latest = latestResult.status === 0 && typeof latestResult.stdout === "string" ? latestResult.stdout.trim() : "";
340
+ const latest = child?.version ?? (latestResult.status === 0 && typeof latestResult.stdout === "string" ? latestResult.stdout.trim() : "");
293
341
 
294
342
  console.log(`opencodex v${current} (installed via ${manager}, tag ${tag})`);
295
343
  if (latest && latest === current) {
@@ -752,6 +800,12 @@ async function runPackageManagerSelfUpdate(manager) {
752
800
  runtimePlan = lockedPlan;
753
801
  const stoppedOwnershipIdentity = ownershipIdentity(lockedOwnership);
754
802
 
803
+ if (session) {
804
+ const entered = await session.enterMutation();
805
+ if (!entered.ok) { releaseUpdateLease(); process.exit(10); }
806
+ enteredMutation = true;
807
+ }
808
+
755
809
  // Never replace package files under a live proxy — stop it first (full `ocx stop`
756
810
  // semantics: graceful drain, service stop, native Codex restore). Gate on the service
757
811
  // and the runtime-port record too: a service-managed or orphaned proxy can be live
@@ -940,7 +994,7 @@ async function runPackageManagerSelfUpdate(manager) {
940
994
  try {
941
995
  if (manager === "npm") {
942
996
  const packageDir = resolve(here, "..");
943
- const transactionalNpmUpdate = process.platform === "win32" ? transactionalNpmUpdateAsync : transactionalNpmUpdateSync;
997
+ const transactionalNpmUpdate = session ? transactionalNpmUpdateAsync : transactionalNpmUpdateSync;
944
998
  if (!homePolicy.authorizeMutation("package")) throw new Error("Automatic package update refused.");
945
999
  const tx = await transactionalNpmUpdate({
946
1000
  packageDir,
@@ -958,12 +1012,31 @@ async function runPackageManagerSelfUpdate(manager) {
958
1012
  runNpm: (args) => {
959
1013
  const invocation = npmInvocation(args);
960
1014
  if (!homePolicy.authorizeMutation("package")) return { status: 1 };
961
- if (process.platform === "win32") return runNpmInstall(invocation, {
962
- authorizeMutation: homePolicy.authorizeMutation,
963
- env: unprivilegedOwnershipMutationEnvironment(invocation?.options?.env ?? process.env),
964
- });
1015
+ if (process.platform === "win32") {
1016
+ if (session) session.noteUntrackedInstaller();
1017
+ return runNpmInstall(invocation, {
1018
+ authorizeMutation: homePolicy.authorizeMutation,
1019
+ env: unprivilegedOwnershipMutationEnvironment(invocation?.options?.env ?? process.env),
1020
+ }).then(result => {
1021
+ if (session && result.processTreeExited === true && Number.isInteger(result.status)) session.confirmInstallerExit();
1022
+ else if (session) { session.retainInstallerFence(); return { ...result, processTreeExited: false }; }
1023
+ return result;
1024
+ });
1025
+ }
965
1026
  if (!invocation) return { status: 1 };
966
1027
  if (!homePolicy.authorizeMutation("package")) return { status: 1 };
1028
+ if (session) {
1029
+ try {
1030
+ const result = runPosixInstallerSync({ file: invocation.file, args: invocation.args,
1031
+ markerPath: join(configDir(), "update-orchestrated.json"), authorizeMutation: homePolicy.authorizeMutation,
1032
+ env: unprivilegedOwnershipMutationEnvironment(invocation.options?.env ?? process.env) });
1033
+ if (!Number.isInteger(result.status) || result.signal || !result.groupExited || result.groupKilled !== false || result.processTreeExited === false) {
1034
+ session.retainInstallerFence();
1035
+ return { ...result, processTreeExited: false };
1036
+ }
1037
+ return { ...result, processTreeExited: true };
1038
+ } catch (error) { session.retainInstallerFence(); throw error; }
1039
+ }
967
1040
  return guardedSpawnSync(homePolicy.authorizeMutation, "package", invocation.file, invocation.args, {
968
1041
  ...invocation.options,
969
1042
  stdio: "inherit",
@@ -974,6 +1047,9 @@ async function runPackageManagerSelfUpdate(manager) {
974
1047
  },
975
1048
  log: (line) => console.log(line),
976
1049
  });
1050
+ if (session) childOutcome = tx.ok ? { phase: "installed", activeRoot: packageDir }
1051
+ : { phase: "failed", rollbackPerformed: tx.rolledBack === true,
1052
+ ...(tx.processTreeExited === false ? { error: "installer-termination-unconfirmed", terminationConfirmed: false } : {}) };
977
1053
  postUpdateLauncherUsable = launcherUsableAfterNpmUpdate(tx);
978
1054
  if (!tx.ok) npmFailure = tx;
979
1055
  if (tx.ok) {
@@ -998,6 +1074,25 @@ async function runPackageManagerSelfUpdate(manager) {
998
1074
  runPnpm: (args, capture = false) => {
999
1075
  const invocation = pnpmOwnerInvocation(owner, args);
1000
1076
  if (!invocation) return { status: 1 };
1077
+ if (session && !capture) return withPnpmCommandCwd(args, cwd => {
1078
+ const env = pnpmReadEnvironment(unprivilegedOwnershipMutationEnvironment(invocation.env ?? process.env));
1079
+ if (process.platform === "win32") {
1080
+ session.noteUntrackedInstaller();
1081
+ const result = runWindowsInstallerSync(invocation, { cwd, env, authorizeMutation: homePolicy.authorizeMutation });
1082
+ if (result.processTreeExited === true && Number.isInteger(result.status)) session.confirmInstallerExit();
1083
+ else { session.retainInstallerFence(); return { ...result, processTreeExited: false }; }
1084
+ return result;
1085
+ }
1086
+ try {
1087
+ const result = runPosixInstallerSync({ file: invocation.file, args: invocation.args, cwd, markerPath: join(configDir(), "update-orchestrated.json"),
1088
+ authorizeMutation: homePolicy.authorizeMutation, env });
1089
+ if (!Number.isInteger(result.status) || result.signal || !result.groupExited || result.groupKilled !== false || result.processTreeExited === false) {
1090
+ session.retainInstallerFence();
1091
+ return { ...result, processTreeExited: false };
1092
+ }
1093
+ return { ...result, processTreeExited: true };
1094
+ } catch (error) { session.retainInstallerFence(); throw error; }
1095
+ });
1001
1096
  return withPnpmCommandCwd(args, cwd => homePolicy.authorizeMutation("package") ? guardedSpawnSync(homePolicy.authorizeMutation, "package", invocation.file, invocation.args, {
1002
1097
  ...invocation.options,
1003
1098
  stdio: capture ? "pipe" : "inherit",
@@ -1012,6 +1107,9 @@ async function runPackageManagerSelfUpdate(manager) {
1012
1107
  },
1013
1108
  log: line => console.log(line),
1014
1109
  });
1110
+ if (session) childOutcome = update.ok ? { phase: "installed", activeRoot: update.path }
1111
+ : { phase: "failed", rollbackPerformed: update.rollbackPerformed === true,
1112
+ ...(update.processTreeExited === false ? { error: "installer-termination-unconfirmed", terminationConfirmed: false } : {}) };
1015
1113
  if (update.ok) {
1016
1114
  // pnpm switches the active global group and updates its shim. Continue recovery
1017
1115
  // through that fresh package tree, not the old group whose launcher is still
@@ -1037,12 +1135,13 @@ async function runPackageManagerSelfUpdate(manager) {
1037
1135
  `Run 'ocx update' again or follow the manual recovery steps below.`);
1038
1136
  res = { status: 1 };
1039
1137
  }
1040
- if (res.status !== 0) recoverStoppedRuntimeAfterFailure("update failed");
1138
+ if (res.status !== 0 && childOutcome.error !== "installer-termination-unconfirmed") recoverStoppedRuntimeAfterFailure("update failed");
1041
1139
  } finally {
1042
1140
  // Expected aborts release before process.exit(); this covers every thrown or newly-added
1043
1141
  // path and keeps token restoration coupled to the lease itself.
1044
1142
  releaseUpdateLease();
1045
1143
  }
1144
+ if (childOutcome.error === "installer-termination-unconfirmed") process.exit(1);
1046
1145
  const postInstallPlan = planUpdateRuntimeHandling({ ...readOwnership(), serviceInstalled: serviceWasInstalled, supervision: observeSupervision() });
1047
1146
  if (res.status === 0) {
1048
1147
  authorityLauncher = postUpdateLauncher;
@@ -1218,10 +1317,10 @@ function resolveBun({ allowInstall = true, launcherPath, allowMissing = false }
1218
1317
  // intercepts `update` before the Bun CLI starts, so the help short-circuit must live
1219
1318
  // here too — otherwise --help runs the real self-update, stops the proxy, and drops
1220
1319
  // in-flight routed streams (issue #168).
1221
- const updateHelpRequested = process.argv[2] === "update" &&
1320
+ const updateHelpRequested = process.argv[2] === "update" && !isOrchestratedUpdateArgv(process.argv.slice(3)) &&
1222
1321
  process.argv.slice(3).some(a => a === "--help" || a === "-h" || a === "help");
1223
1322
  if (updateHelpRequested) {
1224
- console.log("Usage: ocx update [--tag latest|preview]\n\nUpdate opencodex. Preview installs stay on the preview tag unless overridden.");
1323
+ console.log("Usage: ocx update [--tag latest|preview]\n ocx update --plan --json [--tag latest|preview | --version <version>]\n ocx update --yes --json [--tag latest|preview | --version <version>] [--expect-plan <token>] [--not-after <unix-ms>]\n\nPreview with --plan; apply with --yes. --expect-plan binds apply to the planToken; --not-after sets a Unix millisecond mutation deadline.\nOrchestrated exit codes: 0 verified or up-to-date; 10 refused; 11 failed with previous version verified; 12 unverified or still running; 64 invalid usage.\nPreview installs stay on the preview tag unless overridden.");
1225
1324
  process.exit(0);
1226
1325
  }
1227
1326
 
@@ -1237,7 +1336,59 @@ if (process.argv[2] === "__update-home-probe") {
1237
1336
  console.log(JSON.stringify({ schemaVersion: 1, ...readNodeUpdateHome(fileURLToPath(import.meta.url)), launcherProtocolVersion: UPDATE_HOME_LAUNCHER_PROTOCOL }));
1238
1337
  process.exit(0);
1239
1338
  }
1339
+ if (process.argv[2] === "__update-orchestrated-identity") {
1340
+ if (process.argv.length !== 3) process.exit(1);
1341
+ const bun = resolveBun({ allowInstall: false, allowMissing: true });
1342
+ if (!bun) process.exit(1);
1343
+ const result = probeSpawnSync(bun.path, ["--no-env-file", join(here, "../src/update/orchestrated-identity-probe-entry.ts"), process.argv[2]], {
1344
+ stdio: "inherit", timeout: 8000, windowsHide: true, env: { ...process.env, OCX_IDENTITY_CLI_ROOT: resolve(here, ".."), OCX_IDENTITY_INSTALLER: "", OCX_IDENTITY_TARGET: "" },
1345
+ });
1346
+ process.exit(result.status ?? 1);
1347
+ }
1240
1348
 
1349
+ const orchestratedUpdate = process.argv[2] === "update" && isOrchestratedUpdateArgv(process.argv.slice(3));
1350
+ const childArgs = orchestratedUpdate && process.env.OCX_UPDATE_ORCHESTRATED_CHILD === "1"
1351
+ ? parseOrchestratedChildArgs(process.argv.slice(3), process.env) : null;
1352
+ const orchestratedArgs = orchestratedUpdate && !childArgs?.ok ? parseOrchestratedUpdateArgs(process.argv.slice(3)) : null;
1353
+ if (orchestratedArgs && !orchestratedArgs.ok) {
1354
+ console.log(JSON.stringify({ error: "usage" }));
1355
+ console.error("Usage: ocx update (--plan | --yes) --json [--tag latest|preview | --version <version>]");
1356
+ process.exit(64);
1357
+ }
1358
+ if (childArgs?.ok && isNodeModulesInstall() && !isBunGlobalInstall() && (installMethod === "npm" || installMethod === "pnpm")) {
1359
+ await runPackageManagerSelfUpdate(installMethod, childArgs);
1360
+ }
1361
+ if (orchestratedArgs?.ok && orchestratedArgs.mode === "apply" && process.env.OCX_UPDATE_ORCHESTRATED_CHILD !== "1"
1362
+ && isNodeModulesInstall() && !isBunGlobalInstall() && (installMethod === "npm" || installMethod === "pnpm")) {
1363
+ const result = await applyNodeOrchestratedUpdate(orchestratedArgs, {
1364
+ installer: installMethod, currentVersion: String(currentPackageVersion()), cliRoot: resolve(here, ".."),
1365
+ home: configDir(), launcher: fileURLToPath(import.meta.url), resolveBun: () => resolveBun({ allowInstall: false, allowMissing: true }),
1366
+ plan: (bun, version, tag) => probeSpawnSync(bun.path, ["--no-env-file", cliPath, "update", "--plan", "--json",
1367
+ ...(version ? ["--version", version] : tag ? ["--tag", tag] : [])], { encoding: "utf8", maxBuffer: 65536, timeout: 60000, windowsHide: true,
1368
+ stdio: ["ignore", "pipe", 2], env: process.env }),
1369
+ identity: bun => {
1370
+ const probe = probeSpawnSync(bun.path, ["--no-env-file", join(here, "../src/update/orchestrated-identity-probe-entry.ts"), "__update-orchestrated-identity"], {
1371
+ encoding: "utf8", maxBuffer: 8192, timeout: 8000, windowsHide: true, stdio: ["ignore", "pipe", 2],
1372
+ env: { ...updateHomeProbeEnvironment(process.env, { codexHome: process.env.CODEX_HOME ?? "", opencodexHome: configDir() }),
1373
+ OCX_IDENTITY_CLI_ROOT: resolve(here, ".."), OCX_IDENTITY_INSTALLER: "", OCX_IDENTITY_TARGET: "" },
1374
+ });
1375
+ if (probe.status !== 0 || probe.error || probe.signal) throw Error("identity unavailable");
1376
+ return JSON.parse(probe.stdout);
1377
+ },
1378
+ pnpmCommands: resolvePnpmCommands(), runningShimPath: runningPnpmShimPath(),
1379
+ runPnpm: (commandPath, args, capture = false) => {
1380
+ const invocation = pnpmInvocationForPath(commandPath, args);
1381
+ if (!invocation) return { status: 1 };
1382
+ return probeSpawnSync(invocation.file, invocation.args, { stdio: capture ? "pipe" : "ignore", encoding: "utf8",
1383
+ timeout: 20000, windowsHide: true, cwd: PNPM_READ_CWD,
1384
+ env: pnpmReadEnvironment(unprivilegedOwnershipMutationEnvironment(process.env)), ...invocation.options });
1385
+ },
1386
+ spawn: probeSpawn,
1387
+ });
1388
+ await new Promise(resolveOutput => process.stdout.write(`${JSON.stringify(result.result)}\n`, resolveOutput));
1389
+ process.exit(result.exitCode);
1390
+ }
1391
+ const passiveCapabilities = process.argv[2] === "capabilities";
1241
1392
  const codexCliUpdateInspection = isCodexCliUpdateInspectionArgv(process.argv);
1242
1393
  // Windows inspection currently refuses before candidate I/O, so a long-lived
1243
1394
  // Windows server does not duplicate PATH into its inherited environment block.
@@ -1249,6 +1400,9 @@ if (codexCliUpdateInspection && typeof process.versions.bun === "string") {
1249
1400
  }
1250
1401
 
1251
1402
  const { launchProof, launchContext, inheritedEnv } = createNodeLaunchContext();
1403
+ delete inheritedEnv.OCX_SYNC_MUTEX_HELD_BY;
1404
+ // The parsed child capability was removed from process.env; only the Bun CLI handoff of this same child receives it.
1405
+ if (childArgs?.ok) inheritedEnv.OCX_UPDATE_RESULT_CAPABILITY = childArgs.resultCapability;
1252
1406
  const desktopPlan = planDesktopCliHandoff({ selfPaths: [fileURLToPath(import.meta.url), process.execPath] });
1253
1407
  if (desktopPlan.kind === "error") {
1254
1408
  if (desktopPlan.issue.startsWith("record-")) {
@@ -1258,15 +1412,30 @@ if (desktopPlan.kind === "error") {
1258
1412
  }
1259
1413
  process.exit(1);
1260
1414
  }
1415
+ let releaseSyncLease = () => {};
1416
+ let addSyncDelegate = () => {};
1417
+ if (process.argv[2] === "sync") {
1418
+ const syncLease = acquireSyncGuard(configDir(), process.argv.slice(2));
1419
+ if (syncLease.kind === "refused") process.exit(syncLease.exit);
1420
+ addSyncDelegate = pid => syncLease.addDelegate(pid);
1421
+ inheritedEnv.OCX_SYNC_MUTEX_HELD_BY = String(process.pid);
1422
+ let released = false;
1423
+ releaseSyncLease = () => {
1424
+ if (released) return;
1425
+ try { syncLease.release(); released = true; } catch (error) { console.error(`opencodex: sync mutex release failed: ${error.message}`); }
1426
+ };
1427
+ process.once("exit", releaseSyncLease);
1428
+ }
1261
1429
  if (desktopPlan.kind === "handoff") {
1262
1430
  const result = await runDesktopCliHandoff(desktopPlan, {
1263
- argv: process.argv.slice(2), env: inheritedEnv, proof: launchProof, context: launchContext,
1431
+ argv: process.argv.slice(2), env: inheritedEnv, proof: launchProof, context: launchContext, onSpawn: addSyncDelegate,
1264
1432
  });
1265
1433
  if (result.kind === "error") {
1266
1434
  console.error(`opencodex: Desktop CLI handoff failed (${result.issue}). Repair the terminal command in OpenCodex Desktop, or run with OCX_NO_DESKTOP_HANDOFF=1.`);
1267
1435
  process.exit(127);
1268
1436
  }
1269
1437
  if (result.kind === "exit") {
1438
+ releaseSyncLease();
1270
1439
  if (result.signal) {
1271
1440
  relayOwnSignal(result.signal);
1272
1441
  } else {
@@ -1275,10 +1444,10 @@ if (desktopPlan.kind === "handoff") {
1275
1444
  // Signal delivery is asynchronous; never resume package repair or Bun lookup.
1276
1445
  await new Promise(() => {});
1277
1446
  }
1278
- // Only confirmed target ENOENT reaches the ordinary package path below.
1447
+ // A selected Desktop never falls back to the package after a launch failure.
1279
1448
  }
1280
1449
 
1281
- if (process.argv[2] === "update" && installMethod === "mise") {
1450
+ if (!orchestratedUpdate && process.argv[2] === "update" && installMethod === "mise") {
1282
1451
  if (installOwnership.owner) {
1283
1452
  console.error(
1284
1453
  `opencodex: this installation is externally managed by mise; update it with: mise upgrade ${installOwnership.owner.tool}`,
@@ -1291,7 +1460,7 @@ if (process.argv[2] === "update" && installMethod === "mise") {
1291
1460
  process.exit(1);
1292
1461
  }
1293
1462
 
1294
- if (process.argv[2] === "update" && isNodeModulesInstall() && !isBunGlobalInstall()) {
1463
+ if (!orchestratedUpdate && process.argv[2] === "update" && isNodeModulesInstall() && !isBunGlobalInstall()) {
1295
1464
  if (installMethod === "npm") await runNpmSelfUpdate();
1296
1465
  if (installMethod === "pnpm") await runPnpmSelfUpdate();
1297
1466
  }
@@ -1299,7 +1468,7 @@ if (process.argv[2] === "update" && isNodeModulesInstall() && !isBunGlobalInstal
1299
1468
  // #1849 boot probe: a prior update that lost power (or double-faulted) mid-swap leaves a
1300
1469
  // backup sibling and a broken live tree. Restore before anything tries to run from the
1301
1470
  // broken tree; reap stale backups once the live tree verifies healthy.
1302
- if (!codexCliUpdateInspection && installMethod === "npm" && isNodeModulesInstall() && !isBunGlobalInstall()) {
1471
+ if (process.argv[2] !== "sync" && !orchestratedUpdate && !passiveCapabilities && !codexCliUpdateInspection && installMethod === "npm" && isNodeModulesInstall() && !isBunGlobalInstall()) {
1303
1472
  try {
1304
1473
  const probe = bootRestoreProbe(resolve(here, ".."));
1305
1474
  if (probe.action === "restored") {
@@ -1310,7 +1479,22 @@ if (!codexCliUpdateInspection && installMethod === "npm" && isNodeModulesInstall
1310
1479
  } catch { /* the probe must never block launch */ }
1311
1480
  }
1312
1481
 
1313
- const bunRuntime = resolveBun({ allowInstall: !codexCliUpdateInspection });
1482
+ const passiveSync = process.argv[2] === "sync";
1483
+ const bunRuntime = resolveBun({ allowInstall: !passiveSync && !orchestratedUpdate && !passiveCapabilities && !codexCliUpdateInspection, allowMissing: orchestratedUpdate || passiveSync });
1484
+ if (!bunRuntime && passiveSync) fail("Bun is unavailable; install Bun before running sync.");
1485
+ if (!bunRuntime && orchestratedArgs?.ok) {
1486
+ const currentVersion = String(currentPackageVersion()), cliRoot = resolve(here, "..");
1487
+ if (orchestratedArgs.mode === "plan") {
1488
+ const identity = { currentVersion, targetVersion: null, installer: installMethod, cliRoot, servingRoot: null, runtimeOwner: "unknown", runtime: null };
1489
+ console.log(JSON.stringify({ schema: "ocx.update.plan/1", currentVersion, targetVersion: null, installer: installMethod,
1490
+ runtimeOwner: "unknown", servingPath: null, cliPath: cliRoot, canApply: false, reason: "plan-unavailable", restartRequired: false,
1491
+ planToken: createUpdatePlanToken(identity), updateInFlight: true, mutationBoundMs: 900000 }));
1492
+ process.exit(0);
1493
+ }
1494
+ console.log(JSON.stringify({ schema: "ocx.update.result/1", applied: false, fromVersion: currentVersion, toVersion: null,
1495
+ installer: installMethod, restarted: false, healthy: false, rolledBack: false, error: "plan-unavailable" }));
1496
+ process.exit(10);
1497
+ }
1314
1498
  const bun = bunRuntime.path;
1315
1499
 
1316
1500
  // Run the Bun child asynchronously and FORWARD termination signals to it, then wait
@@ -1438,6 +1622,15 @@ const child = probeSpawn(bun, [cliPath, `${NODE_LAUNCH_PROOF_PREFIX}${launchProo
1438
1622
  [BUN_RUNTIME_PATH_ENV]: bunRuntime.path,
1439
1623
  },
1440
1624
  });
1625
+ let delegateError = false;
1626
+ if (child.pid) {
1627
+ try { addSyncDelegate(child.pid); }
1628
+ catch (error) {
1629
+ delegateError = true;
1630
+ console.error(`opencodex: sync mutex delegate publication failed: ${error.message}`);
1631
+ try { child.kill(); } catch (killError) { console.error(`opencodex: failed to stop sync child: ${killError.message}`); }
1632
+ }
1633
+ }
1441
1634
 
1442
1635
  // Windows has no real POSIX signals (no SIGHUP); forwarding is best-effort there.
1443
1636
  const FORWARDED = process.platform === "win32" ? ["SIGINT", "SIGTERM"] : ["SIGINT", "SIGTERM", "SIGHUP"];
@@ -1464,6 +1657,8 @@ child.on("error", err => {
1464
1657
 
1465
1658
  child.on("exit", (code, signal) => {
1466
1659
  clearHandlers();
1660
+ releaseSyncLease();
1661
+ if (delegateError) process.exit(1);
1467
1662
  // Mirror the child's terminating signal/exit code so this launcher's status matches.
1468
1663
  if (signal) {
1469
1664
  relayOwnSignal(signal);
@@ -0,0 +1 @@
1
+ @layer legacy{.fallback-panel{gap:var(--space-2);flex-direction:column;display:flex}.fallback-panel .card-sub{margin:0;padding:2px 0 0}.fallback-panel h3{margin:0}.fallback-switch-row{justify-content:space-between;align-items:center;gap:var(--space-3);display:flex}.fallback-overrides ul{gap:var(--space-1);flex-direction:column;margin:0;padding:0;list-style:none;display:flex}.fallback-overrides li{align-items:center;gap:var(--space-2);flex-wrap:wrap;display:flex}.fallback-overrides li>button{margin-left:auto}.fallback-devices{border-collapse:collapse;width:100%}.fallback-devices th,.fallback-devices td{text-align:left;padding:var(--space-1) var(--space-3) var(--space-1) 0;vertical-align:middle}.fallback-devices th:not(:first-child),.fallback-devices td:not(:first-child){width:7rem}.fallback-device-head th{color:var(--muted);font-size:var(--text-label);font-weight:inherit}.fallback-device-id{margin-left:var(--space-2);color:var(--muted)}.fallback-last p{margin:0}.pws-detail-id{font-size:var(--text-caption);color:var(--muted);margin-left:var(--space-2);font-weight:500}.pws-first-response{gap:var(--space-1);margin-top:var(--space-3);padding-top:var(--space-3);border-top:1px solid var(--border);font-size:var(--text-label);display:grid}.pws-first-response-row{align-items:baseline;gap:var(--space-2);flex-wrap:wrap;display:flex}.pws-first-response-label{min-width:7.5rem;color:var(--muted);font-weight:500}.pws-completion-test{align-items:start;gap:var(--space-2);margin-top:var(--space-4);grid-template-columns:minmax(0,1fr) auto;display:grid}.pws-completion-test>h4,.pws-completion-bulk,.pws-completion-result{grid-column:1/-1}.pws-completion-test>.custom-select{min-width:0}.pws-completion-result{overflow-wrap:anywhere}.pws-completion-bulk-actions{gap:var(--space-2)}.pws-completion-table{border-collapse:collapse;width:100%;margin:var(--space-2) 0}.pws-completion-table td{padding:var(--space-1) var(--space-2) var(--space-1) 0;vertical-align:top}.pws-completion-recovery{align-items:baseline;gap:var(--space-2);margin-top:var(--space-2);font-size:var(--text-label);flex-wrap:wrap;display:flex}@media (width<=640px){.pws-completion-test{grid-template-columns:minmax(0,1fr)}}.codex-account-controls{flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:12px;min-width:0;display:flex}.codex-account-auto-switch{flex:none;align-items:center;gap:7px;min-width:0;display:flex}.codex-account-auto-switch-label{font-size:var(--text-label);color:var(--muted);font-weight:var(--weight-medium);white-space:nowrap}.codex-account-auto-switch-input-wrap{align-items:stretch;display:inline-flex;position:relative}.codex-account-auto-switch-input{width:76px;height:30px;font-size:var(--text-label);text-align:right;padding:4px 38px 4px 8px}.codex-account-auto-switch-unit{color:var(--muted);font-size:var(--text-label);pointer-events:none;position:absolute;top:50%;right:25px;transform:translateY(-50%)}.codex-account-auto-switch-input-wrap .ocx-stepper{width:22px}.codex-account-auto-switch-toggle{transform-origin:50%;margin-inline:-3px;transform:scale(.8)}.quota-row--codex-credits .quota-val{white-space:nowrap}.quota-compact:has(>.quota-row--codex-credits){grid-template-columns:minmax(34px,max-content) max-content minmax(34px,max-content) minmax(38px,max-content) minmax(58px,1fr) minmax(30px,max-content);column-gap:8px}.quota-compact:has(>.quota-row--codex-credits)>*{grid-column:1/-1}.quota-compact:has(>.quota-row--codex-credits)>.quota-row:not(.quota-row--credits){grid-template-columns:subgrid}.codex-auth-credits-toggle{align-items:center;gap:var(--space-2);white-space:nowrap;display:inline-flex}.codex-auth-credits-toggle__label{font-size:var(--text-label);color:var(--muted)}.codex-credit-spend{align-items:center;gap:var(--space-2);white-space:nowrap;display:inline-flex}.codex-credit-spend .toggle[aria-pressed=mixed] .toggle-knob{transform:translate(8px,-50%)}.codex-account-credits{align-items:center;gap:7px;display:inline-flex}.codex-account-credits__label{font-size:var(--text-label);color:var(--muted);font-weight:var(--weight-medium);white-space:nowrap}.codex-account-credits__toggle{transform-origin:50%;margin-inline:-3px;transform:scale(.8)}.anthropic-pool-card__native-messages{align-items:flex-start;gap:var(--space-2);margin-top:var(--space-3);cursor:pointer;display:flex}.anthropic-pool-card__native-messages>input{margin:var(--space-0-5) 0 0;accent-color:var(--accent)}.anthropic-pool-card__native-messages>input:focus-visible{outline:var(--space-0-5) solid var(--accent);outline-offset:var(--space-0-5)}.anthropic-pool-card__native-messages-copy{gap:var(--space-1);max-width:var(--prose-measure);display:grid}.anthropic-pool-card__native-messages:has(input:disabled){cursor:default}.anthropic-pool-card__save-warning{margin:var(--space-2) var(--space-4);color:var(--amber);font-size:var(--text-label);line-height:var(--leading-body)}.kiro-device-dialog{max-width:var(--prose-measure);border:1px solid var(--border);border-radius:var(--radius-lg);background:var(--surface);width:100%;color:var(--text);padding:var(--space-6)}.kiro-device-dialog::backdrop{background:var(--glass-rail)}.kiro-login-choices{gap:var(--space-2);margin-block:var(--space-4);display:grid}.kiro-login-choices .btn{min-height:var(--control-touch);justify-content:flex-start}.kiro-device-code{align-items:center;gap:var(--space-3);margin-block:var(--space-4);flex-wrap:wrap;display:flex}.kiro-device-code-value{font-family:var(--font-code);font-size:var(--text-title);font-weight:var(--weight-semibold);letter-spacing:var(--tracking-wide)}.kiro-device-destination{overflow-wrap:anywhere;-webkit-user-select:all;user-select:all}.kiro-device-actions{justify-content:flex-end;gap:var(--space-2);margin-top:var(--space-4);display:flex}.kiro-iam-form{gap:var(--space-2);margin-block:var(--space-4);display:grid}.kiro-iam-form label{margin-top:var(--space-2);font-weight:var(--weight-medium)}.kiro-iam-form input,.kiro-iam-form select{width:100%;min-height:var(--control-touch)}.model-price-dialog{flex-direction:column;max-height:calc(100dvh - 16vh);display:flex}.model-price-dialog>.modal-head,.model-price-dialog>.modal-actions{flex:none}.model-price-body{overscroll-behavior:contain;flex:auto;min-height:0;padding:2px;overflow-y:auto}.model-price-body .input{margin-bottom:6px}.model-price-body>.small{text-wrap:balance}.model-price-rates-grid{gap:var(--space-1-5) var(--space-3);grid-template-columns:repeat(2,minmax(0,1fr));display:grid}.model-price-rate-field{min-width:0}.model-price-rate-field .field-label{margin-bottom:var(--space-1)}.model-price-rate-field .input{margin-bottom:0}.model-price-mode{border:0;min-width:0;margin:12px 0 0;padding:0}.model-price-mode>legend{margin-bottom:5px;padding:0}.model-price-mode-option{cursor:pointer;align-items:flex-start;gap:8px;padding:6px 0;display:flex}.model-price-mode-option input{accent-color:var(--accent);margin-top:3px}.model-price-mode-option>span{gap:2px;min-width:0;display:grid}.model-price-band{border-top:1px solid var(--border);margin-top:12px;padding-top:12px}.model-price-band-title{font-weight:var(--weight-medium);margin-bottom:2px}.model-price-custom-controls{gap:var(--space-2);grid-template-columns:minmax(0,1fr) minmax(0,1fr);display:grid}.model-price-custom-controls .field-label{min-height:2.5em}.model-price-dialog .model-display-name-error{margin-top:8px}@media (width<=760px){.model-price-mode-option{min-height:44px}}@media (width<=560px){.model-price-rates-grid{grid-template-columns:1fr}.model-price-custom-controls{grid-template-columns:1fr;gap:4px}.model-price-custom-controls .field-label{min-height:0}}.advisor-consent-check{accent-color:var(--ocx-accent)}.advisor-model-row #advisor-model-hint{margin:6px 0 0;font-size:12px;line-height:16px}.advisor-activity-table th,.advisor-activity-table td{white-space:nowrap}.logs-stack-end.logs-decode-rate{white-space:normal;display:flex}.logs-decode-rate>span:first-child{white-space:nowrap}.logs-decode-rate .text-caption{font-family:var(--font-ui);overflow-wrap:break-word}.log-detail-grid.log-detail-performance-grid{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}.log-detail-performance-grid>span{overflow-wrap:break-word;min-width:0}.logs-decode-basis-hint{grid-column:1/-1}.main-inner:has(.claude-page .claudecode-workspace-shell){max-width:980px}.claude-panel-lead{color:var(--muted);font-size:var(--text-label);line-height:var(--leading-body);max-width:var(--prose-measure);margin:0}.claudecode-connection-card{margin-bottom:var(--space-4)}.claudecode-workspace-shell .setting-controls>.custom-select{text-align:right}.claude-page .claude-status-bar{z-index:8;box-shadow:var(--shadow-sm);flex-wrap:wrap;padding:6px 8px 6px 14px;position:sticky;top:12px}.claude-page .claude-status-bar>.claude-status-health{margin-left:0}.claude-status-actions{align-items:center;gap:var(--space-3);margin-left:auto;display:flex}.claude-desktop-roles{margin-bottom:var(--space-4);overflow:hidden}.claude-desktop-section-title{font-size:var(--text-control);font-weight:var(--weight-semibold);line-height:var(--leading-ui);color:var(--text);align-items:baseline;gap:8px;margin:0;display:flex}.claude-desktop-section-title .count{color:var(--muted);font-weight:var(--weight-medium);font-family:var(--font-code);font-size:var(--text-label)}.claude-desktop-roles>.claude-desktop-section-title{padding:12px 16px 4px}.claude-desktop-roles-scope{color:var(--muted);font-size:var(--text-label);margin:0;padding:0 16px 8px}.claude-desktop-roles .setting-controls>.custom-select{text-align:right}.claude-desktop-roles .setting-label{flex:12rem}.claude-desktop-roles .setting-controls{flex:0 auto;min-width:0;max-width:min(60%,28rem)}.claude-desktop-roles .setting-controls>.custom-select,.claude-desktop-roles .select-trigger{max-width:100%}.claude-desktop-roles .select-trigger>span:first-child{text-overflow:ellipsis;min-width:0;overflow:hidden}.claude-desktop-roles .select-trigger>svg{flex:none}.claude-role-option{vertical-align:bottom;min-width:0;max-width:100%;display:inline-flex}.claude-role-option__route{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.claude-role-option__status{white-space:pre;color:var(--muted);flex:none}@media (width<=760px){.claude-desktop-roles .setting-controls{max-width:100%}.claude-desktop-roles .setting-controls>.custom-select,.claude-desktop-roles .select-trigger{width:100%}.claude-desktop-roles .select-trigger{justify-content:space-between}}.claude-desktop-list{gap:var(--space-2);margin-bottom:var(--space-4);flex-direction:column;display:flex}.claude-desktop-list-head{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px;display:flex}.claude-desktop-list-hint{color:var(--muted);font-size:var(--text-label);margin:0}.claude-desktop-list-rows{margin:0;padding:0;list-style:none;overflow:hidden}.claude-desktop-list-row{border-top:1px solid var(--border-soft,var(--border));align-items:center;gap:10px;min-width:0;padding:8px 14px;display:flex}.claude-desktop-list-row:first-child{border-top:none}.claude-desktop-list-names{flex:1;align-items:baseline;gap:8px;min-width:0;display:flex}.claude-desktop-list-names strong,.claude-desktop-list-names code{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.claude-desktop-list-names strong{font-weight:var(--weight-medium)}.claude-desktop-list-names code{color:var(--muted);font-size:11px}.claude-row-quick{color:var(--accent)}.claude-desktop-advanced{margin-bottom:var(--space-4);border:1px solid var(--border);border-radius:var(--radius);background:var(--surface)}.claude-desktop-advanced>summary{cursor:pointer;flex-direction:column;gap:8px;padding:12px 14px;list-style:none;display:flex}.claude-desktop-advanced>summary::-webkit-details-marker{display:none}.claude-desktop-advanced-title{font-weight:var(--weight-semibold);color:var(--text);align-items:center;gap:6px;display:flex}.claude-desktop-advanced-chips{flex-wrap:wrap;gap:6px;display:flex}.claude-desktop-advanced-chip{border-radius:var(--radius-pill);background:var(--raised);max-width:100%;color:var(--muted);font-size:var(--text-label);align-items:baseline;gap:6px;padding:2px 10px;display:inline-flex}.claude-desktop-advanced-chip b{color:var(--text);font-weight:var(--weight-medium)}.claude-desktop-advanced-chip code{text-overflow:ellipsis;white-space:nowrap;max-width:220px;font-size:11px;overflow:hidden}.claude-desktop-advanced-count{font-family:var(--font-code);color:var(--faint);font-size:11px}.claude-desktop-advanced-desc{color:var(--muted);font-size:var(--text-label);margin:0;padding:0 14px 10px}.claude-desktop-advanced>.ocx-group-stack{padding:0 10px 10px}.claude-visibility{gap:var(--space-2);flex-direction:column;display:flex}.claude-visibility-counts,.claude-visibility-filters,.claude-visibility-preview{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.claude-visibility-count{font-size:var(--text-label);font-weight:var(--weight-medium)}.claude-visibility-count.muted,.claude-visibility-preview{color:var(--muted);font-size:var(--text-label)}.claude-visibility-filters .input[type=search]{flex:1;min-width:160px}.claude-visibility-policy{font-size:var(--text-label);border:none;flex-wrap:wrap;align-items:center;gap:12px;margin:0;padding:0;display:flex}.claude-visibility-policy legend{float:left;font-weight:var(--weight-medium);margin-right:4px}.claude-visibility-policy label{align-items:center;gap:4px;display:inline-flex}.claude-desktop-list-row.hidden-row .claude-desktop-list-names{opacity:.55}.claude-visibility-preview-title{font-weight:var(--weight-medium);color:var(--text)}.remote-link-switch{cursor:pointer}.remote-link-switch:after{content:"";border-radius:50%;transition:transform .15s;display:block}.remote-link-sheet input[type=checkbox]{accent-color:var(--ocx-fg);width:15px;height:15px;margin:0}@media (prefers-reduced-motion:reduce){.remote-link-page *,.remote-link-page :before,.remote-link-page :after{scroll-behavior:auto!important;transition:none!important;animation:none!important}}.quota-summary-bar{z-index:var(--z-sticky);border-bottom:1px solid var(--border);background:var(--bg);min-height:34px;font-size:var(--text-label);align-items:center;gap:12px;padding:4px 16px;display:flex;position:sticky;top:0}.quota-summary-scroller{flex:1;align-items:center;gap:2px;min-width:0;display:flex}.quota-summary-list{overscroll-behavior-x:contain;scrollbar-width:none;flex-wrap:nowrap;flex:auto;align-items:center;gap:4px;min-width:0;margin:0;padding:3px;list-style:none;display:flex;overflow:auto hidden}.quota-summary-list::-webkit-scrollbar{display:none}.quota-summary-item{flex:none}.quota-summary-scroll{border:1px solid var(--border);background:var(--surface);width:22px;height:22px;color:var(--text);font:inherit;cursor:pointer;border-radius:999px;flex:none;place-items:center;padding:0;font-weight:600;line-height:1;display:inline-grid}.quota-summary-scroll:hover:not([aria-disabled=true]){background:var(--bg)}.quota-summary-scroll[aria-disabled=true]{color:var(--muted);opacity:.45;cursor:default}.quota-summary-scroll:focus-visible{outline:2px solid var(--text);outline-offset:1px}.quota-summary-chip{color:var(--text);font:inherit;white-space:nowrap;cursor:pointer;background:0 0;border:1px solid #0000;border-radius:999px;align-items:center;gap:6px;padding:3px 8px;text-decoration:none;display:inline-flex}.quota-summary-chip:hover,.quota-summary-chip--open{border-color:var(--border)}.quota-summary-chip:focus-visible{outline:2px solid var(--text);outline-offset:1px}.quota-summary-name{color:var(--muted)}.quota-summary-pct{font-variant-numeric:tabular-nums;font-weight:600}.quota-summary-flag{width:14px;height:14px;color:var(--bg);font-size:var(--text-micro);border-radius:50%;place-items:center;font-weight:700;display:inline-grid}.quota-summary-item--warn .quota-summary-chip{background:var(--amber-soft)}.quota-summary-item--warn .quota-summary-pct{color:var(--amber)}.quota-summary-item--warn .quota-summary-flag{background:var(--amber)}.quota-summary-item--critical .quota-summary-chip{border-color:var(--red);background:var(--red-soft)}.quota-summary-item--critical .quota-summary-pct{color:var(--red)}.quota-summary-item--critical .quota-summary-flag{background:var(--red)}.quota-summary-popover{top:calc(var(--qs-pop-top,0) * 1px);left:calc(var(--qs-pop-left,0) * 1px);z-index:var(--z-popover);border:1px solid var(--border);background:var(--surface);border-radius:8px;min-width:260px;max-width:calc(100% - 16px);padding:10px 12px;position:fixed;box-shadow:0 8px 24px #00000024}.quota-summary-popover:before{content:"";left:calc(var(--qs-bridge-left,0) * 1px - 1px);right:calc(var(--qs-bridge-right,0) * 1px - 1px);height:calc((var(--qs-pop-gap,4) + 1) * 1px);position:absolute;bottom:100%}.quota-summary-popover-head{justify-content:space-between;align-items:center;gap:12px;margin-bottom:6px;display:flex}.quota-summary-badge{font-size:var(--text-caption);border-radius:999px;padding:1px 6px}.quota-summary-badge--warn{color:var(--amber);background:var(--amber-soft)}.quota-summary-badge--critical{color:var(--red);background:var(--red-soft)}.quota-summary-table{border-collapse:collapse;width:100%}.quota-summary-table th,.quota-summary-table td{text-align:left;white-space:nowrap;padding:3px 0;font-weight:400}.quota-summary-table td.quota-summary-row-pct{font-variant-numeric:tabular-nums;text-align:right;white-space:nowrap;padding:3px 12px;font-weight:600}.quota-summary-row-reset{color:var(--muted);white-space:nowrap}.quota-summary-table th[scope=row]{white-space:normal;overflow-wrap:anywhere}.quota-summary-row--warn .quota-summary-row-pct{color:var(--amber)}.quota-summary-row--critical .quota-summary-row-pct{color:var(--red)}.quota-summary-popover-foot{color:var(--muted);font-size:var(--text-caption);flex-wrap:wrap;justify-content:space-between;gap:4px 12px;margin-top:6px;display:flex}.quota-summary-updated{color:var(--muted);font-size:var(--text-caption);white-space:nowrap;flex-shrink:0}.quota-summary-popover-link{color:var(--text);text-underline-offset:2px;text-decoration:underline}.quota-summary-popover-link:focus-visible{outline:2px solid var(--text);outline-offset:1px}.quota-summary-updated--stale{color:var(--amber)}.main:has(>.quota-summary-bar):has(>.main-inner--combos .combos-workspace-shell){flex-direction:column;height:100dvh;display:flex}.main:has(>.quota-summary-bar)>.main-inner.main-inner--combos:has(.combos-workspace-shell){flex:auto;height:auto;min-height:0}@media (width<=760px){.quota-summary-bar{padding:4px 10px;position:static}.quota-summary-popover{top:calc(var(--qs-pop-top,0) * 1px);min-width:0;left:8px;right:8px}.main:has(>.quota-summary-bar):has(>.main-inner--combos .combos-workspace-shell){height:100%;min-height:0}}.section-switcher{border:1px solid var(--border);border-radius:var(--radius-pill);background:var(--surface);flex-wrap:wrap;gap:2px;max-width:100%;margin:0 0 16px;padding:2px;display:inline-flex}.section-switcher-btn{appearance:none;color:var(--muted);border-radius:var(--radius-pill);cursor:pointer;font:inherit;font-size:var(--text-control);white-space:nowrap;background:0 0;border:none;align-items:center;padding:5px 14px;display:inline-flex}.section-switcher-btn:hover{color:var(--text)}.section-switcher-btn[aria-current=page]{background:var(--raised);color:var(--text);font-weight:var(--weight-semibold)}.section-switcher-btn:focus-visible{outline:2px solid var(--accent-ring);outline-offset:1px}@media (width<=760px){.section-switcher{display:flex}.section-switcher-btn{min-height:var(--control-touch);flex:auto;justify-content:center}}.app{--titlebar-h:40px;--tl-inset:80px;--chrome-clear:52px}.app--macos{--chrome-clear:124px;--sidebar-column:max(232px, calc(var(--tl-inset) + 52px))}.sidebar-top{z-index:calc(var(--z-overlay,30) + 1);width:232px;height:var(--titlebar-h,40px);border-bottom:1px solid var(--border);background:var(--glass-rail);-webkit-backdrop-filter:var(--glass-blur);-webkit-user-select:none;user-select:none;align-items:center;padding:0 10px 0 14px;display:flex;position:fixed;top:0;left:0}.app--macos .sidebar-top{width:var(--sidebar-column);padding-left:var(--tl-inset,80px)}.sidebar{padding-top:calc(var(--titlebar-h,40px) + 18px)}.sidebar-collapse{border-radius:var(--radius-sm);width:28px;height:28px;color:var(--muted);cursor:pointer;transition:background var(--motion-fast), color var(--motion-fast);background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.sidebar-collapse:hover{background:var(--accent-soft);color:var(--text)}.sidebar-collapse:focus-visible{outline:2px solid var(--accent-ring);outline-offset:2px}.sidebar-collapse svg{width:18px;height:18px}.main-top{z-index:var(--z-sticky);height:var(--titlebar-h,40px);background:var(--bg);border-bottom:1px solid var(--border);-webkit-user-select:none;user-select:none;align-items:stretch;display:flex;position:sticky;top:0}.main-top>.quota-summary-bar{border-bottom:none;flex:auto;min-width:0;min-height:0;padding:0 16px;position:static}.main:has(>.main-top):has(>.main-inner--combos .combos-workspace-shell){flex-direction:column;height:100dvh;display:flex}.main:has(>.main-top)>.main-inner.main-inner--combos:has(.combos-workspace-shell){flex:auto;height:auto;min-height:0}@media (width>=761px){.app{transition:grid-template-columns .16s}.app--macos.app--reduced-zoom{transition:none}.app--macos:not(.app--nav-collapsed){grid-template-columns:var(--sidebar-column) minmax(0, 1fr)}.app.app--nav-collapsed{grid-template-columns:0 1fr}.app--nav-collapsed .sidebar{display:none}.app--nav-collapsed .main{grid-column:2}.app--nav-collapsed .sidebar-top{-webkit-backdrop-filter:none;background:0 0;border-bottom:none;width:auto;margin:0;padding:0 12px}.app--macos.app--nav-collapsed .sidebar-top{padding-left:var(--tl-inset,80px)}.app--nav-collapsed .main-top,.app--nav-collapsed .main>.quota-summary-bar{padding-left:var(--chrome-clear,52px)}}@media (width<=760px){.sidebar-top{display:none}.main-top{z-index:auto;position:static}.main:has(>.main-top):has(>.main-inner--combos .combos-workspace-shell){height:100%;min-height:0}.app--macos .mobile-topbar{padding-left:var(--tl-inset,80px)}.app--macos .sidebar.open{padding-top:calc(var(--titlebar-h,40px) + 18px)}}@media (width<=320px){.app--macos .mobile-topbar{flex-wrap:wrap}.app--macos .mobile-topbar-actions{width:calc(100% + var(--tl-inset,80px));margin-left:calc(-1 * var(--tl-inset,80px));justify-content:flex-end}}}