@kaitranntt/ccs 8.0.0 → 8.1.0-dev.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/dist/channels/official-channels-runtime.js +1 -1
  2. package/dist/channels/official-channels-runtime.js.map +1 -1
  3. package/dist/cliproxy/ai-providers/codex-reasoning-proxy.d.ts.map +1 -1
  4. package/dist/cliproxy/ai-providers/codex-reasoning-proxy.js +88 -11
  5. package/dist/cliproxy/ai-providers/codex-reasoning-proxy.js.map +1 -1
  6. package/dist/cliproxy/auth/auth-types.d.ts +2 -0
  7. package/dist/cliproxy/auth/auth-types.d.ts.map +1 -1
  8. package/dist/cliproxy/auth/oauth-handler.d.ts.map +1 -1
  9. package/dist/cliproxy/auth/oauth-handler.js +12 -6
  10. package/dist/cliproxy/auth/oauth-handler.js.map +1 -1
  11. package/dist/cliproxy/auth/oauth-trace/redactor.d.ts.map +1 -1
  12. package/dist/cliproxy/auth/oauth-trace/redactor.js +1 -0
  13. package/dist/cliproxy/auth/oauth-trace/redactor.js.map +1 -1
  14. package/dist/cliproxy/executor/claude-launcher.d.ts.map +1 -1
  15. package/dist/cliproxy/executor/claude-launcher.js +1 -3
  16. package/dist/cliproxy/executor/claude-launcher.js.map +1 -1
  17. package/dist/cliproxy/executor/session-bridge.d.ts +1 -16
  18. package/dist/cliproxy/executor/session-bridge.d.ts.map +1 -1
  19. package/dist/cliproxy/executor/session-bridge.js +2 -67
  20. package/dist/cliproxy/executor/session-bridge.js.map +1 -1
  21. package/dist/cliproxy/proxy/proxy-config-resolver.d.ts.map +1 -1
  22. package/dist/cliproxy/proxy/proxy-config-resolver.js +11 -1
  23. package/dist/cliproxy/proxy/proxy-config-resolver.js.map +1 -1
  24. package/dist/cliproxy/proxy/tool-sanitization-proxy.d.ts.map +1 -1
  25. package/dist/cliproxy/proxy/tool-sanitization-proxy.js +64 -8
  26. package/dist/cliproxy/proxy/tool-sanitization-proxy.js.map +1 -1
  27. package/dist/cliproxy/proxy/upstream-response-timeout.d.ts +14 -0
  28. package/dist/cliproxy/proxy/upstream-response-timeout.d.ts.map +1 -0
  29. package/dist/cliproxy/proxy/upstream-response-timeout.js +72 -0
  30. package/dist/cliproxy/proxy/upstream-response-timeout.js.map +1 -0
  31. package/dist/cliproxy/quota/quota-fetcher-codex.d.ts.map +1 -1
  32. package/dist/cliproxy/quota/quota-fetcher-codex.js +4 -1
  33. package/dist/cliproxy/quota/quota-fetcher-codex.js.map +1 -1
  34. package/dist/codex-auth/codex-config-symlink.js +21 -4
  35. package/dist/codex-auth/codex-config-symlink.js.map +1 -1
  36. package/dist/codex-auth/shell-detect.d.ts.map +1 -1
  37. package/dist/codex-auth/shell-detect.js +1 -39
  38. package/dist/codex-auth/shell-detect.js.map +1 -1
  39. package/dist/commands/config-channels-command.d.ts +1 -4
  40. package/dist/commands/config-channels-command.d.ts.map +1 -1
  41. package/dist/commands/config-channels-command.js +20 -24
  42. package/dist/commands/config-channels-command.js.map +1 -1
  43. package/dist/cursor/cursor-daemon-auth.d.ts +2 -0
  44. package/dist/cursor/cursor-daemon-auth.d.ts.map +1 -0
  45. package/dist/cursor/cursor-daemon-auth.js +49 -0
  46. package/dist/cursor/cursor-daemon-auth.js.map +1 -0
  47. package/dist/cursor/cursor-daemon-entry.d.ts.map +1 -1
  48. package/dist/cursor/cursor-daemon-entry.js +44 -0
  49. package/dist/cursor/cursor-daemon-entry.js.map +1 -1
  50. package/dist/cursor/cursor-daemon.d.ts +2 -1
  51. package/dist/cursor/cursor-daemon.d.ts.map +1 -1
  52. package/dist/cursor/cursor-daemon.js +21 -5
  53. package/dist/cursor/cursor-daemon.js.map +1 -1
  54. package/dist/cursor/cursor-models.d.ts.map +1 -1
  55. package/dist/cursor/cursor-models.js +2 -1
  56. package/dist/cursor/cursor-models.js.map +1 -1
  57. package/dist/cursor/cursor-profile-executor.d.ts +1 -1
  58. package/dist/cursor/cursor-profile-executor.d.ts.map +1 -1
  59. package/dist/cursor/cursor-profile-executor.js +7 -4
  60. package/dist/cursor/cursor-profile-executor.js.map +1 -1
  61. package/dist/cursor/cursor-runtime-probe.d.ts.map +1 -1
  62. package/dist/cursor/cursor-runtime-probe.js +4 -2
  63. package/dist/cursor/cursor-runtime-probe.js.map +1 -1
  64. package/dist/cursor/types.d.ts +1 -0
  65. package/dist/cursor/types.d.ts.map +1 -1
  66. package/dist/docker/docker-key-rotation.d.ts +2 -0
  67. package/dist/docker/docker-key-rotation.d.ts.map +1 -1
  68. package/dist/docker/docker-key-rotation.js +9 -1
  69. package/dist/docker/docker-key-rotation.js.map +1 -1
  70. package/dist/glmt/sse-parser.d.ts +1 -0
  71. package/dist/glmt/sse-parser.d.ts.map +1 -1
  72. package/dist/glmt/sse-parser.js +13 -1
  73. package/dist/glmt/sse-parser.js.map +1 -1
  74. package/dist/shared/claude-extension-setup.d.ts.map +1 -1
  75. package/dist/shared/claude-extension-setup.js +2 -1
  76. package/dist/shared/claude-extension-setup.js.map +1 -1
  77. package/dist/targets/codex-adapter.js +1 -1
  78. package/dist/targets/codex-adapter.js.map +1 -1
  79. package/dist/ui/assets/{Trans-dEd8UC39.js → Trans-BIQ-yfAc.js} +1 -1
  80. package/dist/ui/assets/accounts-bN7DnjXo.js +1 -0
  81. package/dist/ui/assets/{alert-dialog-Vurq1xzV.js → alert-dialog-D0yey0YJ.js} +1 -1
  82. package/dist/ui/assets/api-CEtMc2bM.js +4 -0
  83. package/dist/ui/assets/{auth-section-iGkrMaT4.js → auth-section-BHZUn2Hv.js} +1 -1
  84. package/dist/ui/assets/{backups-section-DUGG_4KP.js → backups-section-BNVlJSV3.js} +1 -1
  85. package/dist/ui/assets/{channels-CimlCc2d.js → channels-BOB1P4Kt.js} +1 -1
  86. package/dist/ui/assets/{checkbox-HiMHasEB.js → checkbox-Bt-F3GmI.js} +1 -1
  87. package/dist/ui/assets/claude-extension-AzKgsH0H.js +1 -0
  88. package/dist/ui/assets/cliproxy-C1liaQi8.js +4 -0
  89. package/dist/ui/assets/{cliproxy-ai-providers-2lI5jSHb.js → cliproxy-ai-providers-CzyaYfYI.js} +6 -6
  90. package/dist/ui/assets/cliproxy-control-panel-DmkEW68l.js +1 -0
  91. package/dist/ui/assets/codex-B2FLnjZI.js +30 -0
  92. package/dist/ui/assets/{confirm-dialog-B_6SrSxL.js → confirm-dialog-CYvBJC0z.js} +1 -1
  93. package/dist/ui/assets/{copilot-BgG5x_X6.js → copilot-Csab21fh.js} +2 -2
  94. package/dist/ui/assets/{cursor-DF63lFcy.js → cursor-fOpftodW.js} +1 -1
  95. package/dist/ui/assets/{droid-CqlQmFtN.js → droid-FIcjtOf-.js} +1 -1
  96. package/dist/ui/assets/{globalenv-section-CYNmD12i.js → globalenv-section-CpIAk36Y.js} +1 -1
  97. package/dist/ui/assets/{health-7ZO5PEm9.js → health-D0HvHNud.js} +1 -1
  98. package/dist/ui/assets/{index-D3kxCuJ7.js → index-BTPa3KEN.js} +1 -1
  99. package/dist/ui/assets/{index-BC5ssPfF.js → index-Cr4G276q.js} +1 -1
  100. package/dist/ui/assets/{index-CFu0saCM.js → index-D0VoBTF3.js} +1 -1
  101. package/dist/ui/assets/{index-Bgcd4FYK.js → index-D5G9mVmP.js} +1 -1
  102. package/dist/ui/assets/{index-hHb9o079.js → index-Dm_QojrJ.js} +1 -1
  103. package/dist/ui/assets/index-G3mgTfgR.css +1 -0
  104. package/dist/ui/assets/index-N35Xkk8N.js +1 -0
  105. package/dist/ui/assets/{index-DmV9wJET.js → index-sIfjKy42.js} +18 -18
  106. package/dist/ui/assets/{logs-Dy-yZhIK.js → logs-B33n-VaM.js} +1 -1
  107. package/dist/ui/assets/{masked-input-BSLeznEs.js → masked-input-BrUE6z_f.js} +1 -1
  108. package/dist/ui/assets/proxy-status-widget-Dm2ziI5D.js +1 -0
  109. package/dist/ui/assets/{raw-json-settings-editor-panel-Bs83yILR.js → raw-json-settings-editor-panel-DZRtQXbD.js} +1 -1
  110. package/dist/ui/assets/{searchable-select-pXUC_0Ih.js → searchable-select-D2smFEI5.js} +1 -1
  111. package/dist/ui/assets/{separator-FZR_61I9.js → separator-BvoSJCHW.js} +1 -1
  112. package/dist/ui/assets/{shared-BiIwM7--.js → shared-qKNFwLmT.js} +2 -2
  113. package/dist/ui/assets/{table-_9IusQ8G.js → table-DYyc1gJc.js} +1 -1
  114. package/dist/ui/assets/updates-XXi3TQNZ.js +1 -0
  115. package/dist/ui/assets/{use-accounts-BdtI0lBv.js → use-accounts-BR64_yUk.js} +1 -1
  116. package/dist/ui/index.html +2 -2
  117. package/dist/utils/browser/browser-settings.d.ts.map +1 -1
  118. package/dist/utils/browser/browser-settings.js +13 -3
  119. package/dist/utils/browser/browser-settings.js.map +1 -1
  120. package/dist/utils/claude-subcommand-detector.d.ts +5 -3
  121. package/dist/utils/claude-subcommand-detector.d.ts.map +1 -1
  122. package/dist/utils/claude-subcommand-detector.js +7 -3
  123. package/dist/utils/claude-subcommand-detector.js.map +1 -1
  124. package/dist/utils/glmt-deprecation.d.ts.map +1 -1
  125. package/dist/utils/glmt-deprecation.js +1 -3
  126. package/dist/utils/glmt-deprecation.js.map +1 -1
  127. package/dist/web-server/index.d.ts.map +1 -1
  128. package/dist/web-server/index.js +0 -9
  129. package/dist/web-server/index.js.map +1 -1
  130. package/dist/web-server/middleware/auth-middleware.d.ts.map +1 -1
  131. package/dist/web-server/middleware/auth-middleware.js +26 -4
  132. package/dist/web-server/middleware/auth-middleware.js.map +1 -1
  133. package/dist/web-server/models-dev/pricing-resolver.d.ts.map +1 -1
  134. package/dist/web-server/models-dev/pricing-resolver.js +7 -0
  135. package/dist/web-server/models-dev/pricing-resolver.js.map +1 -1
  136. package/dist/web-server/models-dev/registry-cache.d.ts.map +1 -1
  137. package/dist/web-server/models-dev/registry-cache.js +14 -4
  138. package/dist/web-server/models-dev/registry-cache.js.map +1 -1
  139. package/dist/web-server/routes/cliproxy-auth-routes.d.ts +10 -0
  140. package/dist/web-server/routes/cliproxy-auth-routes.d.ts.map +1 -1
  141. package/dist/web-server/routes/cliproxy-auth-routes.js +45 -13
  142. package/dist/web-server/routes/cliproxy-auth-routes.js.map +1 -1
  143. package/dist/web-server/routes/cliproxy-local-proxy.d.ts.map +1 -1
  144. package/dist/web-server/routes/cliproxy-local-proxy.js +25 -8
  145. package/dist/web-server/routes/cliproxy-local-proxy.js.map +1 -1
  146. package/dist/web-server/routes/cursor-routes.d.ts.map +1 -1
  147. package/dist/web-server/routes/cursor-routes.js +6 -1
  148. package/dist/web-server/routes/cursor-routes.js.map +1 -1
  149. package/dist/web-server/routes/image-analysis-routes.d.ts.map +1 -1
  150. package/dist/web-server/routes/image-analysis-routes.js +7 -0
  151. package/dist/web-server/routes/image-analysis-routes.js.map +1 -1
  152. package/dist/web-server/routes/proxy-routes.d.ts.map +1 -1
  153. package/dist/web-server/routes/proxy-routes.js +1 -1
  154. package/dist/web-server/routes/proxy-routes.js.map +1 -1
  155. package/dist/web-server/routes/settings-routes.d.ts.map +1 -1
  156. package/dist/web-server/routes/settings-routes.js +10 -1
  157. package/dist/web-server/routes/settings-routes.js.map +1 -1
  158. package/dist/web-server/services/claude-extension-settings-service.d.ts.map +1 -1
  159. package/dist/web-server/services/claude-extension-settings-service.js +5 -1
  160. package/dist/web-server/services/claude-extension-settings-service.js.map +1 -1
  161. package/dist/web-server/usage/sqlite-cli.d.ts +25 -1
  162. package/dist/web-server/usage/sqlite-cli.d.ts.map +1 -1
  163. package/dist/web-server/usage/sqlite-cli.js +127 -3
  164. package/dist/web-server/usage/sqlite-cli.js.map +1 -1
  165. package/lib/mcp/ccs-browser-server.cjs +24 -13
  166. package/package.json +1 -1
  167. package/scripts/github/stable-release-issue-cleanup-lib.mjs +113 -0
  168. package/scripts/github/stable-release-issue-cleanup.mjs +134 -0
  169. package/dist/ui/assets/accounts-B2THsSu_.js +0 -1
  170. package/dist/ui/assets/api-CjLfG9mL.js +0 -4
  171. package/dist/ui/assets/claude-extension-B2v9bsN9.js +0 -1
  172. package/dist/ui/assets/cliproxy-control-panel-63gDI-e5.js +0 -1
  173. package/dist/ui/assets/cliproxy-fai69Vyd.js +0 -4
  174. package/dist/ui/assets/codex-i_hfI4Tv.js +0 -30
  175. package/dist/ui/assets/index-BMoGhs28.css +0 -1
  176. package/dist/ui/assets/index-CqsmdQoA.js +0 -1
  177. package/dist/ui/assets/proxy-status-widget-hRH1agF9.js +0 -1
  178. package/dist/ui/assets/updates-ButNfJqt.js +0 -1
@@ -1,30 +0,0 @@
1
- import{j as e}from"./radix-ui-nu4wz29m.js";import{r as N}from"./react-vendor-Bjx91N7w.js";import{t as U}from"./notifications-B4_o8bcr.js";import{bf as ne,a as T,B as y,aM as ns,T as as,w as os,e as C,x as ls,C as I,p as F,q as K,b as W,aI as ee,j as E,k as D,l as O,m as L,n as b,I as _,t as we,X as S,bg as Ae,c as Me,bm as is,bn as Ce,bo as cs,R as ds,U as xs,V as oe,W as le,bh as Se}from"./index-DmV9wJET.js";import{T as Re,a as Ie,b as ce,c as B,d as Fe,e as V}from"./table-_9IusQ8G.js";import{u as je,a as us,b as _e}from"./tanstack-bhJxV1h8.js";import{L as G,aa as ms,aS as hs,at as de,n as ps,aT as fs,aU as js,aC as gs,w as vs,a7 as bs,aV as ws,aW as Ns,aX as ys,ai as ge,p as Te,$ as Cs,m as Ss,o as _s,_ as Ts,S as ks,aN as ke,aY as Ps,x as Es,I as Ds,T as Os,N as Ls}from"./icons-DzKUh8vG.js";import{T as te}from"./Trans-dEd8UC39.js";import{S as ie}from"./separator-FZR_61I9.js";import{R as As}from"./raw-json-settings-editor-panel-Bs83yILR.js";import"./utils-CzKF5WmX.js";import"./form-utils-CuHzLhJZ.js";import"./charts-eIPy2oG6.js";async function Ms(){const s=await fetch(ne("/codex/profiles"));if(!s.ok)throw new Error("Failed to fetch Codex auth profiles");return s.json()}function Rs(){return je({queryKey:["codex-auth-profiles"],queryFn:Ms,refetchInterval:15e3})}function re({children:s}){return e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[0.85em] text-foreground",children:s})}function Is(s){if(!s)return"never";try{const t=new Date(s),r=Date.now()-t.getTime(),a=Math.floor(r/6e4);if(a<2)return"just now";if(a<60)return`${a} min ago`;const o=Math.floor(a/60);if(o<24)return`${o}h ago`;const n=Math.floor(o/24);return n===1?"yesterday":`${n}d ago`}catch{return s}}function Ke(s,t){switch(s){case"default":return t("codex.auth.sourceDefault");case"env":return t("codex.auth.sourceEnv");case"explicit-codex-home":return t("codex.auth.sourceExplicitCodexHome")}}function Pe({label:s}){return e.jsx(ns,{children:e.jsxs(as,{children:[e.jsx(os,{asChild:!0,children:e.jsx("span",{tabIndex:0,className:"inline-block",children:e.jsx(C,{variant:"outline",size:"sm",disabled:!0,className:"pointer-events-none",children:s})})}),e.jsx(ls,{children:e.jsx(te,{i18nKey:"codex.auth.terminalOnlyTooltipRich",components:{code:e.jsx(re,{})}})})]})})}function Fs({entry:s,isActive:t,activeSource:r}){const{t:a}=T();return e.jsxs(ce,{className:t?"bg-muted/40":void 0,children:[e.jsx(V,{className:"font-medium",children:e.jsxs("span",{className:"flex items-center gap-2",children:[s.name,t&&r&&e.jsx(y,{variant:"secondary",className:"text-xs",children:a("codex.auth.activeSourceBadge",{source:Ke(r,a)})})]})}),e.jsx(V,{children:s.email??"—"}),e.jsx(V,{children:s.plan??"—"}),e.jsx(V,{children:Is(s.lastUsed)}),e.jsx(V,{children:s.authValid?e.jsx(y,{variant:"secondary",className:"text-xs text-green-700 dark:text-green-400",children:a("codex.auth.statusOk")}):e.jsx(y,{variant:"destructive",className:"text-xs",children:a("codex.auth.statusInvalid")})}),e.jsx(V,{children:e.jsxs("span",{className:"flex gap-1",children:[e.jsx(Pe,{label:a("codex.auth.switchAction")}),e.jsx(Pe,{label:a("codex.auth.removeAction")})]})})]})}function Ks(){const{t:s}=T(),{data:t,isLoading:r,error:a}=Rs();return r?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground p-4",children:[e.jsx(G,{className:"h-4 w-4 animate-spin"}),s("codex.auth.loading")]}):a||!t?e.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:s("codex.auth.loadError")}):t.profiles.length===0?e.jsxs("div",{className:"rounded-md border bg-muted/30 px-4 py-3 text-sm text-muted-foreground space-y-1",children:[e.jsx("p",{children:e.jsx(te,{i18nKey:"codex.auth.emptyRegistryRich",components:{code:e.jsx(re,{})}})}),e.jsx("p",{children:e.jsx(te,{i18nKey:"codex.auth.legacyCodexHomeRich",components:{code:e.jsx(re,{})}})})]}):t.active?t.active.source==="explicit-codex-home"&&t.active.name===null?e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"rounded-md border bg-muted/30 px-4 py-3 text-sm text-muted-foreground",children:e.jsx(te,{i18nKey:"codex.auth.externalCodexHomeRich",values:{path:t.active.codexHome},components:{code:e.jsx(re,{})}})}),e.jsx(ue,{data:t})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsx(Ws,{name:t.active.name,source:t.active.source,profiles:t.profiles}),e.jsx(ue,{data:t})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"rounded-md border bg-muted/30 px-4 py-3 text-sm text-muted-foreground",children:e.jsx(te,{i18nKey:"codex.auth.legacyModeRich",components:{code:e.jsx(re,{})}})}),e.jsx(ue,{data:t})]})}function Ws({name:s,source:t,profiles:r}){const{t:a}=T(),o=r.find(n=>n.name===s);return e.jsxs("div",{className:"rounded-md border bg-muted/20 px-4 py-3 text-sm space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2 font-medium",children:[a("codex.auth.activeProfile"),e.jsx("span",{children:s??a("codex.auth.unknownProfile")}),e.jsx(y,{variant:"secondary",className:"text-xs",children:Ke(t,a)})]}),o&&e.jsxs("div",{className:"text-muted-foreground text-xs space-x-3",children:[o.email&&e.jsx("span",{children:o.email}),o.plan&&e.jsxs("span",{children:[a("codex.auth.planLabel")," ",e.jsx("strong",{children:o.plan})]}),!o.authValid&&e.jsx("span",{className:"text-destructive",children:a("codex.auth.statusInvalid")})]})]})}function ue({data:s}){const{t}=T();return e.jsx("div",{className:"rounded-md border overflow-auto",children:e.jsxs(Re,{children:[e.jsx(Ie,{children:e.jsxs(ce,{children:[e.jsx(B,{children:t("codex.auth.col.name")}),e.jsx(B,{children:t("codex.auth.col.email")}),e.jsx(B,{children:t("codex.auth.col.plan")}),e.jsx(B,{children:t("codex.auth.col.lastUsed")}),e.jsx(B,{children:t("codex.auth.col.status")}),e.jsx(B,{children:t("codex.auth.col.actions")})]})}),e.jsx(Fe,{children:s.profiles.map(r=>e.jsx(Fs,{entry:r,isActive:s.active?.name===r.name,activeSource:s.active?.name===r.name?s.active.source:void 0},r.name))})]})})}function se({title:s,icon:t,badge:r,description:a,disabledReason:o,children:n}){return e.jsxs(I,{children:[e.jsxs(F,{className:"pb-2",children:[e.jsxs(K,{className:"flex items-center gap-2 text-base",children:[t,s,r?e.jsx(y,{variant:"outline",className:"text-[10px] font-normal",children:r}):null]}),a?e.jsx("p",{className:"text-xs text-muted-foreground",children:a}):null]}),e.jsxs(W,{className:"space-y-3",children:[o?e.jsx("p",{className:"text-xs text-amber-600",children:o}):null,n]})]})}function qs({catalog:s,state:t,disabled:r=!1,disabledReason:a,onToggle:o}){const{t:n}=T(),l=new Set(s.map(i=>i.name)),c=Object.entries(t).filter(([i])=>!l.has(i)).sort(([i],[d])=>i.localeCompare(d));return e.jsxs(se,{title:n("codex.features"),badge:"features",icon:e.jsx(ms,{className:"h-4 w-4"}),description:n("codex.featuresDesc"),disabledReason:a,children:[e.jsx("div",{className:"space-y-2",children:s.map(i=>{const d=t[i.name]??null;return e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md border px-3 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm font-medium",children:i.label}),e.jsx(y,{variant:"outline",className:"font-mono text-[10px]",children:i.name})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:i.description})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[d!==null?e.jsx(C,{variant:"outline",size:"sm",onClick:()=>o(i.name,null),disabled:r,children:n("codex.useDefault")}):null,e.jsx(ee,{checked:d===!0,onCheckedChange:m=>o(i.name,m),disabled:r})]})]},i.name)})}),c.length>0?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:n("codex.configOnlyFlags")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n("codex.configOnlyFlagsDesc")})]}),c.map(([i,d])=>e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md border border-dashed px-3 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm font-medium",children:i}),e.jsx(y,{variant:"secondary",className:"text-[10px]",children:n("codex.existing")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n(d===null?"codex.nonBooleanForm":"codex.discoveredFromFile")})]}),d===null?e.jsx(y,{variant:"outline",children:n("codex.rawOnly")}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>o(i,null),disabled:r,children:n("codex.useDefault")}),e.jsx(ee,{checked:d===!0,onCheckedChange:m=>o(i,m),disabled:r})]})]},i))]}):null]})}const Us={name:"",transport:"stdio",command:null,args:[],url:null,enabled:!0,required:!1,startupTimeoutSec:null,toolTimeoutSec:null,enabledTools:[],disabledTools:[],isCcsManaged:!1,managementSurface:null};function me(s){return s.join(", ")}function he(s){return s.split(",").map(t=>t.trim()).filter(Boolean)}function Bs({initialDraft:s,isNew:t,disabled:r,saving:a,canDelete:o,onSave:n,onDelete:l}){const{t:c}=T(),[i,d]=N.useState(s),m=t&&i.name.trim()==="ccs_browser";return e.jsxs(e.Fragment,{children:[m?e.jsxs("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-900 dark:text-amber-200",children:[e.jsx("strong",{children:"ccs_browser"})," is reserved for the CCS-managed browser tooling path. Configure it from ",e.jsx("code",{children:"Settings > Browser"})," instead of creating it here."]}):null,e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(_,{value:i.name,onChange:h=>d(x=>({...x,name:h.target.value})),placeholder:"playwright",disabled:r||!t}),e.jsxs(E,{value:i.transport,onValueChange:h=>d(x=>({...x,transport:h})),disabled:r,children:[e.jsx(D,{children:e.jsx(O,{})}),e.jsxs(L,{children:[e.jsx(b,{value:"stdio",children:c("codex.stdio")}),e.jsx(b,{value:"streamable-http",children:c("codex.streamableHttp")})]})]}),i.transport==="stdio"?e.jsxs(e.Fragment,{children:[e.jsx(_,{value:i.command??"",onChange:h=>d(x=>({...x,command:h.target.value||null})),placeholder:"npx",disabled:r}),e.jsx(_,{value:me(i.args),onChange:h=>d(x=>({...x,args:he(h.target.value)})),placeholder:"@playwright/mcp@latest, --flag",disabled:r})]}):e.jsx(_,{className:"sm:col-span-2",value:i.url??"",onChange:h=>d(x=>({...x,url:h.target.value||null})),placeholder:"https://example.test/mcp",disabled:r}),e.jsx(_,{type:"number",min:1,value:i.startupTimeoutSec??"",onChange:h=>d(x=>({...x,startupTimeoutSec:h.target.value?Number(h.target.value):null})),placeholder:"Startup timeout (sec)",disabled:r}),e.jsx(_,{type:"number",min:1,value:i.toolTimeoutSec??"",onChange:h=>d(x=>({...x,toolTimeoutSec:h.target.value?Number(h.target.value):null})),placeholder:"Tool timeout (sec)",disabled:r}),e.jsx(_,{value:me(i.enabledTools),onChange:h=>d(x=>({...x,enabledTools:he(h.target.value)})),placeholder:"enabled_tools",disabled:r}),e.jsx(_,{value:me(i.disabledTools),onChange:h=>d(x=>({...x,disabledTools:he(h.target.value)})),placeholder:"disabled_tools",disabled:r})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("label",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-sm",children:["Enabled",e.jsx(ee,{checked:i.enabled,onCheckedChange:h=>d(x=>({...x,enabled:h})),disabled:r})]}),e.jsxs("label",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-sm",children:["Required",e.jsx(ee,{checked:i.required,onCheckedChange:h=>d(x=>({...x,required:h})),disabled:r})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs(C,{variant:"outline",onClick:l,disabled:r||a||!o,children:[e.jsx(de,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsxs(C,{onClick:()=>n(i.name,{transport:i.transport,command:i.command,args:i.args,url:i.url,enabled:i.enabled,required:i.required,startupTimeoutSec:i.startupTimeoutSec,toolTimeoutSec:i.toolTimeoutSec,enabledTools:i.enabledTools,disabledTools:i.disabledTools}),disabled:r||a||i.name.trim().length===0||m,children:[a?e.jsx(G,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save MCP server"]})]})]})}function Vs({entries:s,disabled:t=!1,disabledReason:r,saving:a=!1,onSave:o,onDelete:n}){const{t:l}=T(),[c,i]=N.useState("new"),d=N.useMemo(()=>s.find(g=>g.name===c)??null,[s,c]),m=d??Us,h=JSON.stringify(m),x=d?.isCcsManaged&&d.managementSurface==="browser-settings";return e.jsxs(se,{title:"MCP servers",badge:"mcp_servers",icon:e.jsx(hs,{className:"h-4 w-4"}),description:"Manage the safe MCP transport fields. Keep auth headers and bearer tokens in raw TOML.",disabledReason:r,children:[x?e.jsxs("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-900 dark:text-amber-200",children:[e.jsx("strong",{children:d?.name})," is CCS-managed. Configure browser tooling from"," ",e.jsx("code",{children:"Settings > Browser"}),"; the generic MCP editor is read-only for this entry."]}):null,e.jsxs(E,{value:c,onValueChange:i,disabled:t,children:[e.jsx(D,{children:e.jsx(O,{placeholder:"Select MCP server"})}),e.jsxs(L,{children:[e.jsx(b,{value:"new",children:l("codex.createNewMcpServer")}),s.map(g=>e.jsx(b,{value:g.name,children:g.isCcsManaged?`${g.name} (CCS managed)`:g.name},g.name))]})]}),e.jsx(Bs,{initialDraft:m,isNew:c==="new",disabled:t||!!x,saving:a,canDelete:d!==null&&!x,onDelete:async()=>{d&&(await n(d.name),i("new"))},onSave:async(g,p)=>{await o(g,p),i(g)}},h)]})}const $s={name:"",displayName:null,baseUrl:null,envKey:null,wireApi:"responses",requiresOpenaiAuth:!1,supportsWebsockets:!1},zs={name:"cliproxy",displayName:"CLIProxy Codex",baseUrl:"http://127.0.0.1:8317/api/provider/codex",envKey:"CLIPROXY_API_KEY",wireApi:"responses",requiresOpenaiAuth:!1,supportsWebsockets:!1};function Gs({initialDraft:s,isNew:t,disabled:r,saving:a,canDelete:o,onSave:n,onDelete:l}){const{t:c}=T(),[i,d]=N.useState(s);return e.jsxs(e.Fragment,{children:[t&&e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 rounded-md border border-dashed px-3 py-2 text-xs text-muted-foreground",children:[e.jsxs("p",{children:["Quick start: apply the CLIProxy Codex preset here, then set"," ",e.jsx("strong",{children:c("codex.defaultProvider")})," to ",e.jsx("code",{children:"cliproxy"})," in Top-level settings."]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>d(zs),disabled:r,children:"Use CLIProxy Codex preset"})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(_,{value:i.name,onChange:m=>d(h=>({...h,name:m.target.value})),placeholder:"Provider id",disabled:r||!t}),e.jsx(_,{value:i.displayName??"",onChange:m=>d(h=>({...h,displayName:m.target.value||null})),placeholder:"Display name",disabled:r}),e.jsx(_,{value:i.baseUrl??"",onChange:m=>d(h=>({...h,baseUrl:m.target.value||null})),placeholder:"http://127.0.0.1:8317/api/provider/codex",disabled:r}),e.jsx(_,{value:i.envKey??"",onChange:m=>d(h=>({...h,envKey:m.target.value||null})),placeholder:"CLIPROXY_API_KEY",disabled:r})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[e.jsxs(E,{value:i.wireApi??"responses",onValueChange:m=>d(h=>({...h,wireApi:m})),disabled:r,children:[e.jsx(D,{children:e.jsx(O,{})}),e.jsx(L,{children:e.jsx(b,{value:"responses",children:c("codex.responses")})})]}),e.jsxs("label",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-sm",children:["Requires OpenAI auth",e.jsx(ee,{checked:i.requiresOpenaiAuth,onCheckedChange:m=>d(h=>({...h,requiresOpenaiAuth:m})),disabled:r})]}),e.jsxs("label",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-sm",children:["Supports websockets",e.jsx(ee,{checked:i.supportsWebsockets,onCheckedChange:m=>d(h=>({...h,supportsWebsockets:m})),disabled:r})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs(C,{variant:"outline",onClick:l,disabled:r||a||!o,children:[e.jsx(de,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsxs(C,{onClick:()=>n(i.name,{displayName:i.displayName,baseUrl:i.baseUrl,envKey:i.envKey,wireApi:i.wireApi,requiresOpenaiAuth:i.requiresOpenaiAuth,supportsWebsockets:i.supportsWebsockets}),disabled:r||a||i.name.trim().length===0,children:[a?e.jsx(G,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save provider"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["If you want plain native ",e.jsx("code",{children:"codex"})," to default to CLIProxy, save a provider named"," ",e.jsx("code",{children:"cliproxy"})," with ",e.jsx("code",{children:"CLIPROXY_API_KEY"})," here, then pick"," ",e.jsx("code",{children:"cliproxy"})," in the ",e.jsx("strong",{children:c("codex.defaultProvider")})," control above."]})]})}function Xs({entries:s,disabled:t=!1,disabledReason:r,saving:a=!1,onSave:o,onDelete:n}){const{t:l}=T(),[c,i]=N.useState("new"),d=N.useMemo(()=>s.find(x=>x.name===c)??null,[s,c]),m=d??$s,h=JSON.stringify(m);return e.jsxs(se,{title:"Model providers",badge:"model_providers",icon:e.jsx(ps,{className:"h-4 w-4"}),description:"Edit the common provider fields CCS can support safely. Keep secret migration and inline bearer tokens in raw TOML.",disabledReason:r,children:[e.jsxs(E,{value:c,onValueChange:i,disabled:t,children:[e.jsx(D,{children:e.jsx(O,{placeholder:"Select provider"})}),e.jsxs(L,{children:[e.jsx(b,{value:"new",children:l("codex.createNewProvider")}),s.map(x=>e.jsx(b,{value:x.name,children:x.name},x.name))]})]}),e.jsx(Gs,{initialDraft:m,isNew:c==="new",disabled:t,saving:a,canDelete:d!==null,onDelete:async()=>{d&&(await n(d.name),i("new"))},onSave:async(x,g)=>{await o(x,g),i(x)}},h)]})}function Hs({initialName:s,initialModel:t,initialProvider:r,initialEffort:a,providerNames:o,activeProfile:n,selectedEntryName:l,disabled:c,saving:i,onSave:d,onDelete:m,onSetActive:h}){const{t:x}=T(),[g,p]=N.useState(s),[w,M]=N.useState(t),[q,u]=N.useState(r),[v,X]=N.useState(a);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(_,{value:g,onChange:j=>p(j.target.value),placeholder:"deep-review",disabled:c||l!==null}),e.jsx(_,{value:w??"",onChange:j=>M(j.target.value||null),placeholder:"gpt-5.4",disabled:c}),e.jsxs(E,{value:q??"__unset__",onValueChange:j=>u(j==="__unset__"?null:j),disabled:c,children:[e.jsx(D,{children:e.jsx(O,{placeholder:x("codex.useGlobalProvider")})}),e.jsxs(L,{children:[e.jsx(b,{value:"__unset__",children:x("codex.useGlobalProvider")}),o.map(j=>e.jsx(b,{value:j,children:j},j))]})]}),e.jsxs(E,{value:v??"__unset__",onValueChange:j=>X(j==="__unset__"?null:j),disabled:c,children:[e.jsx(D,{children:e.jsx(O,{placeholder:x("codex.useGlobalEffort")})}),e.jsxs(L,{children:[e.jsx(b,{value:"__unset__",children:x("codex.useGlobalEffort")}),["minimal","low","medium","high","xhigh"].map(j=>e.jsx(b,{value:j,children:j},j))]})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(C,{variant:"outline",onClick:m,disabled:c||i||!l,children:[e.jsx(de,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsx(C,{variant:"outline",onClick:h,disabled:c||i||!l||l===n,children:"Set active"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(C,{variant:"outline",onClick:()=>d(g,{model:w,modelProvider:q,modelReasoningEffort:v},!1),disabled:c||i||g.trim().length===0,children:[i?e.jsx(G,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save profile"]}),e.jsxs(C,{onClick:()=>d(g,{model:w,modelProvider:q,modelReasoningEffort:v},!0),disabled:c||i||g.trim().length===0,children:[i?e.jsx(G,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save + activate"]})]})]})]})}function Ys({activeProfile:s,entries:t,providerNames:r,disabled:a=!1,disabledReason:o,saving:n=!1,onSave:l,onDelete:c,onSetActive:i}){const{t:d}=T(),[m,h]=N.useState("new"),x=N.useMemo(()=>t.find(p=>p.name===m)??null,[t,m]),g=JSON.stringify(x??{name:"",values:{}});return e.jsxs(se,{title:d("codex.profiles"),badge:"profiles",icon:e.jsx(fs,{className:"h-4 w-4"}),description:"Create reusable Codex overlays and set the active default profile.",disabledReason:o,children:[e.jsxs(E,{value:m,onValueChange:h,disabled:a,children:[e.jsx(D,{children:e.jsx(O,{placeholder:"Select profile"})}),e.jsxs(L,{children:[e.jsx(b,{value:"new",children:d("codex.createNewProfile")}),t.map(p=>e.jsxs(b,{value:p.name,children:[p.name,p.name===s?" (active)":""]},p.name))]})]}),e.jsx(Hs,{initialName:x?.name??"",initialModel:x?.values.model??null,initialProvider:x?.values.modelProvider??null,initialEffort:x?.values.modelReasoningEffort??null,providerNames:r,activeProfile:s,selectedEntryName:x?.name??null,disabled:a,saving:n,onDelete:async()=>{x&&(await c(x.name),h("new"))},onSetActive:async()=>{x&&await i(x.name)},onSave:async(p,w,M)=>{await l(p,w,M),h(p)}},g)]})}function Qs({workspacePath:s,disabled:t,saving:r,onSave:a}){const{t:o}=T(),[n,l]=N.useState(s),[c,i]=N.useState("trusted");return e.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_160px_auto]",children:[e.jsx(_,{value:n,onChange:d=>l(d.target.value),placeholder:"~/repo or /absolute/path",disabled:t}),e.jsxs(E,{value:c,onValueChange:i,disabled:t,children:[e.jsx(D,{children:e.jsx(O,{})}),e.jsxs(L,{children:[e.jsx(b,{value:"trusted",children:o("codex.trusted")}),e.jsx(b,{value:"untrusted",children:o("codex.untrusted")})]})]}),e.jsxs(C,{onClick:()=>a(n,c),disabled:t||r,children:[r?e.jsx(G,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save trust"]})]})}function Js({workspacePath:s,entries:t,disabled:r=!1,disabledReason:a,saving:o=!1,onSave:n}){const{t:l}=T();return e.jsxs(se,{title:"Project trust",badge:"projects",icon:e.jsx(js,{className:"h-4 w-4"}),description:"Trust current workspaces or remove stale trust entries without opening raw TOML.",disabledReason:a,children:[e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Paths must be absolute or start with ",e.jsx("code",{children:"~/"}),". Relative paths are rejected so CCS does not trust the wrong folder."]}),e.jsx(Qs,{workspacePath:s,disabled:r,saving:o,onSave:n},s),e.jsx(C,{variant:"outline",className:"w-full justify-start",onClick:()=>n(s,"trusted"),disabled:r||o,children:"Trust current workspace"}),e.jsx("div",{className:"space-y-2",children:t.length===0?e.jsx("p",{className:"text-xs text-muted-foreground",children:l("codex.noProjectTrustEntries")}):t.map(c=>e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border px-3 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:c.path}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["trust_level = ",c.trustLevel]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"ghost",size:"sm",onClick:()=>n(c.path,c.trustLevel==="trusted"?"untrusted":"trusted"),disabled:r||o,children:"Toggle"}),e.jsx(C,{variant:"ghost",size:"icon",onClick:()=>n(c.path,null),disabled:r||o,children:e.jsx(de,{className:"h-4 w-4"})})]})]},c.path))})]})}const A="__unset__",Zs=105e4,et=272e3,Ee=8e5,De=7e5,st=new Intl.NumberFormat("en-US");function Y(s){return s??A}function Q(s,t){return t&&!s.includes(t)?[t,...s]:s}function pe(s){return st.format(s)}function tt(s){return s?.trim().toLowerCase().startsWith("gpt-5.4")??!1}function rt(s,t){const r={};return t.model!==s.model&&(r.model=t.model),t.modelReasoningEffort!==s.modelReasoningEffort&&(r.modelReasoningEffort=t.modelReasoningEffort),t.modelContextWindow!==s.modelContextWindow&&(r.modelContextWindow=t.modelContextWindow),t.modelAutoCompactTokenLimit!==s.modelAutoCompactTokenLimit&&(r.modelAutoCompactTokenLimit=t.modelAutoCompactTokenLimit),t.modelProvider!==s.modelProvider&&(r.modelProvider=t.modelProvider),t.approvalPolicy!==s.approvalPolicy&&(r.approvalPolicy=t.approvalPolicy),t.sandboxMode!==s.sandboxMode&&(r.sandboxMode=t.sandboxMode),t.webSearch!==s.webSearch&&(r.webSearch=t.webSearch),t.toolOutputTokenLimit!==s.toolOutputTokenLimit&&(r.toolOutputTokenLimit=t.toolOutputTokenLimit),t.personality!==s.personality&&(r.personality=t.personality),r}function nt({initialValues:s,providerNames:t,disabled:r,saving:a,onSave:o}){const{t:n}=T(),[l,c]=N.useState(s),i=Q(["minimal","low","medium","high","xhigh"],l.modelReasoningEffort),d=Q(t,l.modelProvider),m=Q(["on-request","never","untrusted"],l.approvalPolicy),h=Q(["read-only","workspace-write","danger-full-access"],l.sandboxMode),x=Q(["cached","live","disabled"],l.webSearch),g=Q(["none","friendly","pragmatic"],l.personality),p=rt(s,l),w=Object.keys(p).length>0,M=tt(l.model),q=u=>{const v=u.trim();return v.length>0?Number(v):null};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.model")}),e.jsx(_,{value:l.model??"",onChange:u=>c(v=>({...v,model:u.target.value||null})),placeholder:"gpt-5.5",disabled:r})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.reasoningEffort")}),e.jsxs(E,{value:Y(l.modelReasoningEffort),onValueChange:u=>c(v=>({...v,modelReasoningEffort:u===A?null:u})),disabled:r,children:[e.jsx(D,{children:e.jsx(O,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useDefault")}),i.map(u=>e.jsx(b,{value:u,children:u},u))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.defaultProvider")}),e.jsxs(E,{value:Y(l.modelProvider),onValueChange:u=>c(v=>({...v,modelProvider:u===A?null:u})),disabled:r,children:[e.jsx(D,{children:e.jsx(O,{placeholder:n("codex.useCodexDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useCodexDefault")}),d.map(u=>e.jsx(b,{value:u,children:u},u))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.approvalPolicy")}),e.jsxs(E,{value:Y(l.approvalPolicy),onValueChange:u=>c(v=>({...v,approvalPolicy:u===A?null:u})),disabled:r,children:[e.jsx(D,{children:e.jsx(O,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useDefault")}),m.map(u=>e.jsx(b,{value:u,children:u},u))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.sandboxMode")}),e.jsxs(E,{value:Y(l.sandboxMode),onValueChange:u=>c(v=>({...v,sandboxMode:u===A?null:u})),disabled:r,children:[e.jsx(D,{children:e.jsx(O,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useDefault")}),h.map(u=>e.jsx(b,{value:u,children:u},u))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.webSearch")}),e.jsxs(E,{value:Y(l.webSearch),onValueChange:u=>c(v=>({...v,webSearch:u===A?null:u})),disabled:r,children:[e.jsx(D,{children:e.jsx(O,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useDefault")}),x.map(u=>e.jsx(b,{value:u,children:u},u))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.toolOutputTokenLimit")}),e.jsx(_,{type:"number",min:1,value:l.toolOutputTokenLimit??"",onChange:u=>c(v=>({...v,toolOutputTokenLimit:u.target.value?Number(u.target.value):null})),placeholder:"25000",disabled:r})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.personality")}),e.jsxs(E,{value:Y(l.personality),onValueChange:u=>c(v=>({...v,personality:u===A?null:u})),disabled:r,children:[e.jsx(D,{children:e.jsx(O,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useDefault")}),g.map(u=>e.jsx(b,{value:u,children:u},u))]})]})]})]}),e.jsxs("div",{className:"space-y-4 rounded-xl border border-amber-500/30 bg-amber-500/5 p-4 shadow-sm dark:bg-amber-400/5",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(vs,{className:"h-4 w-4 text-amber-600 dark:text-amber-300"}),e.jsx("p",{className:"text-sm font-semibold",children:n("codex.longContextOverride")}),e.jsx(y,{variant:"outline",className:"border-amber-500/40 bg-background/80 text-[10px] uppercase tracking-[0.16em] text-amber-700 dark:text-amber-300",children:"Manual opt-in only"}),e.jsx(y,{variant:"secondary",className:"text-[10px] uppercase tracking-[0.16em] text-muted-foreground",children:M?"GPT-5.4 long-context selected":"GPT-5.4 long-context reference"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Draft values only. Nothing applies until Save."})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(C,{type:"button",variant:"outline",size:"sm",disabled:r,onClick:()=>c(u=>({...u,modelContextWindow:Ee,modelAutoCompactTokenLimit:De})),children:"Fill cautious pair"}),e.jsx(C,{type:"button",variant:"outline",size:"sm",disabled:r,onClick:()=>c(u=>({...u,modelContextWindow:Zs})),children:"Set official max window"}),e.jsx(C,{type:"button",variant:"ghost",size:"sm",disabled:r,onClick:()=>c(u=>({...u,modelContextWindow:null,modelAutoCompactTokenLimit:null})),children:"Clear"})]})]}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-3",children:[e.jsxs("div",{className:"rounded-lg border bg-background/85 px-3 py-3 shadow-sm shadow-black/5",children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:"Official max"}),e.jsx("p",{className:"mt-1 font-mono text-base font-semibold text-foreground",children:"1.05M / 1M"}),e.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:n("codex.gptContextCap")})]}),e.jsxs("div",{className:"rounded-lg border bg-background/85 px-3 py-3 shadow-sm shadow-black/5",children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:"Standard window"}),e.jsx("p",{className:"mt-1 font-mono text-base font-semibold text-foreground",children:pe(et)}),e.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:n("codex.normalUsageWindow")})]}),e.jsxs("div",{className:"rounded-lg border bg-background/85 px-3 py-3 shadow-sm shadow-black/5",children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:"Above 272K"}),e.jsx("p",{className:"mt-1 font-mono text-base font-semibold text-foreground",children:n("codex.counts2x")}),e.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:n("codex.usageLimitCost")})]})]}),e.jsxs("div",{className:"space-y-3 rounded-lg border bg-background/75 px-3 py-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:"One cautious pair"}),e.jsxs("div",{className:"rounded-full border bg-background px-2.5 py-1 font-mono text-[11px] font-medium",children:["Context ",pe(Ee)]}),e.jsxs("div",{className:"rounded-full border bg-background px-2.5 py-1 font-mono text-[11px] font-medium",children:["Auto-compact ",pe(De)]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx(y,{variant:"outline",className:"border-border/70 bg-background/80 text-[10px] uppercase tracking-[0.14em] text-muted-foreground",children:"Not official"}),e.jsx(y,{variant:"outline",className:"border-border/70 bg-background/80 text-[10px] uppercase tracking-[0.14em] text-muted-foreground",children:"Draft only"})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] text-muted-foreground",children:[e.jsx("span",{children:n("codex.quickFillWarning")}),!M&&l.model?e.jsxs("span",{children:[e.jsx("code",{children:l.model})," should be checked separately."]}):null]})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.modelContextWindow")}),e.jsx(_,{"aria-label":n("codex.modelContextWindow"),type:"number",min:1,value:l.modelContextWindow??"",onChange:u=>c(v=>({...v,modelContextWindow:q(u.target.value)})),placeholder:"Unset",disabled:r}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Writes ",e.jsx("code",{children:"model_context_window"}),". Leave unset to keep Codex defaults."]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.autoCompactTokenLimit")}),e.jsx(_,{"aria-label":n("codex.autoCompactTokenLimit"),type:"number",min:1,value:l.modelAutoCompactTokenLimit??"",onChange:u=>c(v=>({...v,modelAutoCompactTokenLimit:q(u.target.value)})),placeholder:"Unset",disabled:r}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Writes ",e.jsx("code",{children:"model_auto_compact_token_limit"}),". Leave unset to keep model defaults."]})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] text-muted-foreground",children:[e.jsx("span",{className:"text-[10px] uppercase tracking-[0.14em]",children:"Docs"}),e.jsx("a",{href:"https://platform.openai.com/docs/models",target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:"GPT-5 model guide"}),e.jsx("a",{href:"https://openai.com/index/introducing-gpt-5-5/",target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:"Release notes"}),e.jsx("a",{href:"https://developers.openai.com/codex/config-reference",target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:"Config reference"})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs(C,{onClick:()=>o(p),disabled:r||a||!w,children:[a?e.jsx(G,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save top-level settings"]})})]})}function at({values:s,providerNames:t,disabled:r=!1,disabledReason:a,saving:o=!1,onSave:n}){return e.jsx(se,{title:"Top-level controls",badge:"config.toml",icon:e.jsx(gs,{className:"h-4 w-4"}),description:"Structured controls for the stable top-level Codex settings users touch most often. Unsupported upstream shapes stay untouched and should be edited in raw TOML.",disabledReason:a,children:e.jsx(nt,{initialValues:s,providerNames:t,disabled:r,saving:o,onSave:n},JSON.stringify(s))})}function ot({workspacePath:s,activeProfile:t,topLevelSettings:r,projectTrustEntries:a,profileEntries:o,modelProviderEntries:n,mcpServerEntries:l,featureCatalog:c,featureState:i,disabled:d,disabledReason:m,saving:h,onPatch:x}){const{t:g}=T();return e.jsx(we,{className:"h-full",children:e.jsxs("div",{className:"space-y-6 pr-1 pb-6",children:[e.jsxs("div",{className:"group relative overflow-hidden rounded-xl border border-border/80 bg-background/50 p-5 shadow-sm transition-all hover:bg-background hover:shadow-md dark:border-border/60",children:[e.jsx("div",{className:"absolute inset-x-0 -top-px h-px bg-gradient-to-r from-transparent via-foreground/15 to-transparent transition-opacity group-hover:via-foreground/30"}),e.jsxs("div",{className:"flex flex-col gap-6 lg:flex-row lg:items-start lg:justify-between",children:[e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg border border-primary/20 bg-primary/10 text-primary transition-colors group-hover:border-primary/30",children:e.jsx(bs,{className:"h-4 w-4"})}),e.jsx("div",{children:e.jsx("h2",{className:"text-base font-semibold tracking-tight text-foreground",children:g("codex.controlCenter")})})]}),e.jsxs("ul",{className:"grid gap-3 sm:grid-cols-2 text-sm text-muted-foreground",children:[e.jsxs("li",{className:"flex items-start gap-2.5",children:[e.jsx(ws,{className:"h-4 w-4 shrink-0 text-muted-foreground/60 mt-0.5"}),e.jsxs("span",{className:"leading-relaxed",children:["Writes exclusively to user-layer"," ",e.jsx("code",{className:"text-[11px] bg-muted/70 px-1.5 py-0.5 rounded border border-border/50",children:"config.toml"})]})]}),e.jsxs("li",{className:"flex items-start gap-2.5",children:[e.jsx(Ns,{className:"h-4 w-4 shrink-0 text-muted-foreground/60 mt-0.5"}),e.jsx("span",{className:"leading-relaxed",children:"Does not reflect repo trust layers or CLI overrides"})]})]})]}),e.jsx("div",{className:"shrink-0 lg:w-[280px]",children:e.jsx("div",{className:"relative overflow-hidden rounded-lg border border-amber-500/20 bg-amber-500/5 p-4 transition-colors group-hover:border-amber-500/30 group-hover:bg-amber-500/10 dark:border-amber-400/10 dark:bg-amber-400/5",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ys,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-600 dark:text-amber-400"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[11px] font-bold text-amber-700 dark:text-amber-300 uppercase tracking-wider",children:"Formatting Note"}),e.jsx("p",{className:"text-[13px] leading-relaxed text-amber-800/80 dark:text-amber-200/70",children:"Saves normalize TOML formatting and strip comments. Switch to the raw editor if exact layout matters."})]})]})})})]})]}),e.jsx(at,{values:r,providerNames:n.map(p=>p.name),disabled:d,disabledReason:m,saving:h,onSave:p=>x({kind:"top-level",values:p},g("toasts.codexSaved"))}),e.jsx(Js,{workspacePath:s,entries:a,disabled:d,disabledReason:m,saving:h,onSave:(p,w)=>x({kind:"project-trust",path:p,trustLevel:w},w?"Saved project trust entry.":"Removed project trust entry.")}),e.jsx(Ys,{activeProfile:t,entries:o,providerNames:n.map(p=>p.name),disabled:d,disabledReason:m,saving:h,onSave:(p,w,M)=>x({kind:"profile",action:"upsert",name:p,values:w,setAsActive:M},"Saved profile."),onDelete:p=>x({kind:"profile",action:"delete",name:p},"Deleted profile."),onSetActive:p=>x({kind:"profile",action:"set-active",name:p},"Set active profile.")}),e.jsx(Xs,{entries:n,disabled:d,disabledReason:m,saving:h,onSave:(p,w)=>x({kind:"model-provider",action:"upsert",name:p,values:w},"Saved model provider."),onDelete:p=>x({kind:"model-provider",action:"delete",name:p},"Deleted model provider.")}),e.jsx(Vs,{entries:l,disabled:d,disabledReason:m,saving:h,onSave:(p,w)=>x({kind:"mcp-server",action:"upsert",name:p,values:w},"Saved MCP server."),onDelete:p=>x({kind:"mcp-server",action:"delete",name:p},"Deleted MCP server.")}),e.jsx(qs,{catalog:c,state:i,disabled:d,disabledReason:m,onToggle:(p,w)=>x({kind:"feature",feature:p,enabled:w},"Saved feature toggle.")})]})})}const We=`model_provider = "cliproxy"
2
-
3
- [model_providers.cliproxy]
4
- name = "CLIProxy Codex"
5
- base_url = "http://127.0.0.1:8317/api/provider/codex"
6
- env_key = "CLIPROXY_API_KEY"
7
- wire_api = "responses"
8
- requires_openai_auth = false
9
- supports_websockets = false`,lt=["multi_agent","unified_exec","shell_snapshot","apply_patch_freeform","js_repl","runtime_metrics","prevent_idle_sleep","fast_mode","apps","smart_approvals"];function it(){return[{name:"multi_agent",label:S.t("codex.featureMultiAgentLabel"),description:S.t("codex.featureMultiAgentDesc")},{name:"unified_exec",label:S.t("codex.featureUnifiedExecLabel"),description:S.t("codex.featureUnifiedExecDesc")},{name:"shell_snapshot",label:S.t("codex.featureShellSnapshotLabel"),description:S.t("codex.featureShellSnapshotDesc")},{name:"apply_patch_freeform",label:S.t("codex.featureApplyPatchLabel"),description:S.t("codex.featureApplyPatchDesc")},{name:"js_repl",label:S.t("codex.featureJsReplLabel"),description:S.t("codex.featureJsReplDesc")},{name:"runtime_metrics",label:S.t("codex.featureRuntimeMetricsLabel"),description:S.t("codex.featureRuntimeMetricsDesc")},{name:"prevent_idle_sleep",label:S.t("codex.featurePreventIdleSleepLabel"),description:S.t("codex.featurePreventIdleSleepDesc")},{name:"fast_mode",label:S.t("codex.featureFastModeLabel"),description:S.t("codex.featureFastModeDesc")},{name:"apps",label:S.t("codex.featureAppsLabel"),description:S.t("codex.featureAppsDesc")},{name:"smart_approvals",label:S.t("codex.featureSmartApprovalsLabel"),description:S.t("codex.featureSmartApprovalsDesc")}]}function z(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)?s:null}function P(s){return typeof s=="string"&&s.trim().length>0?s.trim():null}function Z(s){return typeof s=="number"&&Number.isFinite(s)?s:null}function fe(s){return Array.isArray(s)?s.filter(t=>typeof t=="string").map(t=>t.trim()):[]}function qe(s){return{model:P(s?.model),modelReasoningEffort:P(s?.model_reasoning_effort),modelContextWindow:Z(s?.model_context_window),modelAutoCompactTokenLimit:Z(s?.model_auto_compact_token_limit),modelProvider:P(s?.model_provider),approvalPolicy:P(s?.approval_policy),sandboxMode:P(s?.sandbox_mode),webSearch:P(s?.web_search),toolOutputTokenLimit:Z(s?.tool_output_token_limit),personality:P(s?.personality)}}function ct(s){const t=z(s?.projects);return t?Object.entries(t).map(([r,a])=>{const o=P(z(a)?.trust_level);return o?{path:r,trustLevel:o}:null}).filter(r=>r!==null).sort((r,a)=>r.path.localeCompare(a.path)):[]}function dt(s){const t=z(s?.profiles);return t?Object.entries(t).map(([r,a])=>({name:r,values:qe(z(a))})).sort((r,a)=>r.name.localeCompare(a.name)):[]}function xt(s){const t=z(s?.model_providers);return t?Object.entries(t).map(([r,a])=>{const o=z(a);return o?{name:r,displayName:P(o.name),baseUrl:P(o.base_url),envKey:P(o.env_key),wireApi:P(o.wire_api),requiresOpenaiAuth:o.requires_openai_auth===!0,supportsWebsockets:o.supports_websockets===!0}:null}).filter(r=>r!==null).sort((r,a)=>r.name.localeCompare(a.name)):[]}function ut(s){const t=z(s?.mcp_servers);return t?Object.entries(t).map(([r,a])=>{const o=z(a);if(!o)return null;const n=P(o.command)?"stdio":"streamable-http",l=Z(o.startup_timeout_ms);return{name:r,transport:n,command:P(o.command),args:fe(o.args),url:P(o.url),enabled:o.enabled!==!1,required:o.required===!0,startupTimeoutSec:Z(o.startup_timeout_sec)??(l!==null?l/1e3:null),toolTimeoutSec:Z(o.tool_timeout_sec),enabledTools:fe(o.enabled_tools),disabledTools:fe(o.disabled_tools),isCcsManaged:r==="ccs_browser",managementSurface:r==="ccs_browser"?"browser-settings":null}}).filter(r=>r!==null).sort((r,a)=>r.name.localeCompare(a.name)):[]}function mt(s){const t=z(s?.features),r={};for(const a of lt){const o=t?.[a];r[a]=typeof o=="boolean"?o:null}if(t)for(const[a,o]of Object.entries(t))a in r||(r[a]=typeof o=="boolean"?o:null);return r}const ht=[{id:"codex-config-basic",label:"Codex Config Basics",url:"https://developers.openai.com/codex/config-basic",description:"Official user-layer setup, config location, and baseline configuration behavior."},{id:"codex-config-advanced",label:"Codex Config Advanced",url:"https://developers.openai.com/codex/config-advanced",description:"Layering, trust, profiles, and advanced config behavior."},{id:"codex-config-reference",label:"Codex Config Reference",url:"https://developers.openai.com/codex/config-reference",description:"Canonical upstream config surface for providers, MCP, features, and trust."},{id:"codex-releases",label:"Codex GitHub Releases",url:"https://github.com/openai/codex/releases",description:"Track upstream release notes and fast-moving CLI changes."}],pt=[{provider:"openai",label:"OpenAI Responses API",apiFormat:"Responses API",url:"https://platform.openai.com/docs/api-reference/responses"}];function ft(s){const t=/https?:\/\/[^\s)]+/g,r=[];let a=0,o;for(;(o=t.exec(s))!==null;){const[n]=o,l=o.index;l>a&&r.push(s.slice(a,l)),r.push(e.jsx("a",{href:n,target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:n},`${n}-${l}`)),a=l+n.length}return a<s.length&&r.push(s.slice(a)),r.length>0?r:[s]}function jt({diagnostics:s}){const{t}=T(),r=s.docsReference??{notes:[],links:[],providerDocs:[],providerValues:[],settingsHierarchy:[]},a=r.links.length>0?r.links:ht,o=r.providerDocs.length>0?r.providerDocs:pt;return e.jsx(we,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 pr-1",children:[e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(K,{className:"flex items-center gap-2 text-base",children:[e.jsx(ge,{className:"h-4 w-4"}),"CCS bridge recipe"]})}),e.jsxs(W,{className:"space-y-3 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("p",{children:[e.jsx("strong",{children:t("codex.builtInLabel")})," ",t("codex.builtInCcsxpDesc")]}),e.jsxs("p",{children:[e.jsx("strong",{children:t("codex.nativeRecipeLabel")})," ",t("codex.nativeRecipeDesc")]}),e.jsxs("p",{children:[e.jsx("strong",{children:t("codex.managedBridgeLabel")})," ",t("codex.managedBridgeDesc")]})]}),e.jsx("pre",{className:"overflow-x-auto rounded-md border bg-muted/20 p-3 text-xs text-foreground",children:We}),e.jsxs("ol",{className:"ml-4 list-decimal space-y-1.5 [&>li]:pl-1",children:[e.jsxs("li",{children:["Save the ",e.jsx("code",{children:"cliproxy"})," provider in your user config."]}),e.jsxs("li",{children:["Set top-level ",e.jsx("code",{children:"model_provider"})," to ",e.jsx("code",{children:"cliproxy"}),"."]}),e.jsxs("li",{children:["Export ",e.jsx("code",{children:"CLIPROXY_API_KEY"})," before launching native Codex."]})]}),e.jsxs("p",{children:["CCS-managed browser tooling belongs to ",e.jsx("code",{children:"Settings > Browser"}),". Do not edit the ",e.jsx("code",{children:"ccs_browser"})," entry from the generic MCP card unless you are intentionally overriding the managed path in raw TOML."]})]})]}),e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(K,{className:"flex items-center gap-2 text-base",children:[e.jsx(ge,{className:"h-4 w-4"}),"Upstream notes"]})}),e.jsxs(W,{className:"space-y-2 text-sm",children:[r.notes.length>0&&e.jsx("ul",{className:"ml-4 list-disc space-y-1.5 text-muted-foreground [&>li]:pl-1",children:r.notes.map((n,l)=>e.jsx("li",{children:ft(n)},`${l}-${n}`))}),e.jsx(ie,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:t("codex.codexDocs")}),e.jsx("div",{className:"space-y-1.5",children:a.map(n=>e.jsxs("a",{href:n.url,target:"_blank",rel:"noreferrer",className:"block rounded-md border px-2.5 py-2 transition-colors hover:bg-muted/50",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-xs font-medium",children:n.label}),e.jsx(Te,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),e.jsx("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:n.description}),e.jsx("p",{className:"mt-1 break-all font-mono text-[11px] text-muted-foreground/90 underline underline-offset-2",children:n.url})]},n.id))})]}),e.jsx(ie,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:"Provider / bridge reference"}),e.jsx("div",{className:"space-y-1.5",children:o.map(n=>e.jsxs("a",{href:n.url,target:"_blank",rel:"noreferrer",className:"block rounded-md border px-2.5 py-2 transition-colors hover:bg-muted/50",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-xs font-medium",children:n.label}),e.jsx(Te,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),e.jsxs("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:["provider: ",n.provider," | format: ",n.apiFormat]}),e.jsx("p",{className:"mt-1 break-all font-mono text-[11px] text-muted-foreground/90 underline underline-offset-2",children:n.url})]},`${n.provider}-${n.url}`))})]}),r.providerValues.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(ie,{}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Provider values: ",r.providerValues.join(", ")]})]}),r.settingsHierarchy.length>0&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Settings hierarchy: ",r.settingsHierarchy.join(" -> ")]})]})]})]})})}function gt(s,t){let r=s.slice(0,t).split(/\r\n|\n|\r/g);return[r.length,r.pop().length+1]}function vt(s,t,r){let a=s.split(/\r\n|\n|\r/g),o="",n=(Math.log10(t+1)|0)+1;for(let l=t-1;l<=t+1;l++){let c=a[l-1];c&&(o+=l.toString().padEnd(n," "),o+=": ",o+=c,o+=`
10
- `,l===t&&(o+=" ".repeat(n+r+2),o+=`^
11
- `))}return o}class f extends Error{line;column;codeblock;constructor(t,r){const[a,o]=gt(r.toml,r.ptr),n=vt(r.toml,a,o);super(`Invalid TOML document: ${t}
12
-
13
- ${n}`,r),this.line=a,this.column=o,this.codeblock=n}}function bt(s,t){let r=0;for(;s[t-++r]==="\\";);return--r&&r%2}function ve(s,t=0,r=s.length){let a=s.indexOf(`
14
- `,t);return s[a-1]==="\r"&&a--,a<=r?a:-1}function xe(s,t){for(let r=t;r<s.length;r++){let a=s[r];if(a===`
15
- `)return r;if(a==="\r"&&s[r+1]===`
16
- `)return r+1;if(a<" "&&a!==" "||a==="")throw new f("control characters are not allowed in comments",{toml:s,ptr:t})}return s.length}function $(s,t,r,a){let o;for(;;){for(;(o=s[t])===" "||o===" "||!r&&(o===`
17
- `||o==="\r"&&s[t+1]===`
18
- `);)t++;if(a||o!=="#")break;t=xe(s,t)}return t}function wt(s,t,r,a,o=!1){if(!a)return t=ve(s,t),t<0?s.length:t;for(let n=t;n<s.length;n++){let l=s[n];if(l==="#")n=ve(s,n);else{if(l===r)return n+1;if(l===a||o&&(l===`
19
- `||l==="\r"&&s[n+1]===`
20
- `))return n}}throw new f("cannot find end of structure",{toml:s,ptr:t})}function Ue(s,t){let r=s[t],a=r===s[t+1]&&s[t+1]===s[t+2]?s.slice(t,t+3):r;t+=a.length-1;do t=s.indexOf(a,++t);while(t>-1&&r!=="'"&&bt(s,t));return t>-1&&(t+=a.length,a.length>1&&(s[t]===r&&t++,s[t]===r&&t++)),t}let Nt=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;class J extends Date{#s=!1;#t=!1;#e=null;constructor(t){let r=!0,a=!0,o="Z";if(typeof t=="string"){let n=t.match(Nt);n?(n[1]||(r=!1,t=`0000-01-01T${t}`),a=!!n[2],a&&t[10]===" "&&(t=t.replace(" ","T")),n[2]&&+n[2]>23?t="":(o=n[3]||null,t=t.toUpperCase(),!o&&a&&(t+="Z"))):t=""}super(t),isNaN(this.getTime())||(this.#s=r,this.#t=a,this.#e=o)}isDateTime(){return this.#s&&this.#t}isLocal(){return!this.#s||!this.#t||!this.#e}isDate(){return this.#s&&!this.#t}isTime(){return this.#t&&!this.#s}isValid(){return this.#s||this.#t}toISOString(){let t=super.toISOString();if(this.isDate())return t.slice(0,10);if(this.isTime())return t.slice(11,23);if(this.#e===null)return t.slice(0,-1);if(this.#e==="Z")return t;let r=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return r=this.#e[0]==="-"?r:-r,new Date(this.getTime()-r*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(t,r="Z"){let a=new J(t);return a.#e=r,a}static wrapAsLocalDateTime(t){let r=new J(t);return r.#e=null,r}static wrapAsLocalDate(t){let r=new J(t);return r.#t=!1,r.#e=null,r}static wrapAsLocalTime(t){let r=new J(t);return r.#s=!1,r.#e=null,r}}let yt=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,Ct=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,St=/^[+-]?0[0-9_]/,_t=/^[0-9a-f]{2,8}$/i,Oe={b:"\b",t:" ",n:`
21
- `,f:"\f",r:"\r",e:"\x1B",'"':'"',"\\":"\\"};function Be(s,t=0,r=s.length){let a=s[t]==="'",o=s[t++]===s[t]&&s[t]===s[t+1];o&&(r-=2,s[t+=2]==="\r"&&t++,s[t]===`
22
- `&&t++);let n=0,l,c="",i=t;for(;t<r-1;){let d=s[t++];if(d===`
23
- `||d==="\r"&&s[t]===`
24
- `){if(!o)throw new f("newlines are not allowed in strings",{toml:s,ptr:t-1})}else if(d<" "&&d!==" "||d==="")throw new f("control characters are not allowed in strings",{toml:s,ptr:t-1});if(l){if(l=!1,d==="x"||d==="u"||d==="U"){let m=s.slice(t,t+=d==="x"?2:d==="u"?4:8);if(!_t.test(m))throw new f("invalid unicode escape",{toml:s,ptr:n});try{c+=String.fromCodePoint(parseInt(m,16))}catch{throw new f("invalid unicode escape",{toml:s,ptr:n})}}else if(o&&(d===`
25
- `||d===" "||d===" "||d==="\r")){if(t=$(s,t-1,!0),s[t]!==`
26
- `&&s[t]!=="\r")throw new f("invalid escape: only line-ending whitespace may be escaped",{toml:s,ptr:n});t=$(s,t)}else if(d in Oe)c+=Oe[d];else throw new f("unrecognized escape sequence",{toml:s,ptr:n});i=t}else!a&&d==="\\"&&(n=t-1,l=!0,c+=s.slice(i,n))}return c+s.slice(i,r-1)}function Tt(s,t,r,a){if(s==="true")return!0;if(s==="false")return!1;if(s==="-inf")return-1/0;if(s==="inf"||s==="+inf")return 1/0;if(s==="nan"||s==="+nan"||s==="-nan")return NaN;if(s==="-0")return a?0n:0;let o=yt.test(s);if(o||Ct.test(s)){if(St.test(s))throw new f("leading zeroes are not allowed",{toml:t,ptr:r});s=s.replace(/_/g,"");let l=+s;if(isNaN(l))throw new f("invalid number",{toml:t,ptr:r});if(o){if((o=!Number.isSafeInteger(l))&&!a)throw new f("integer value cannot be represented losslessly",{toml:t,ptr:r});(o||a===!0)&&(l=BigInt(s))}return l}const n=new J(s);if(!n.isValid())throw new f("invalid value",{toml:t,ptr:r});return n}function kt(s,t,r){let a=s.slice(t,r),o=a.indexOf("#");return o>-1&&(xe(s,o),a=a.slice(0,o)),[a.trimEnd(),o]}function Ne(s,t,r,a,o){if(a===0)throw new f("document contains excessively nested structures. aborting.",{toml:s,ptr:t});let n=s[t];if(n==="["||n==="{"){let[i,d]=n==="["?Dt(s,t,a,o):Et(s,t,a,o);if(r){if(d=$(s,d),s[d]===",")d++;else if(s[d]!==r)throw new f("expected comma or end of structure",{toml:s,ptr:d})}return[i,d]}let l;if(n==='"'||n==="'"){l=Ue(s,t);let i=Be(s,t,l);if(r){if(l=$(s,l),s[l]&&s[l]!==","&&s[l]!==r&&s[l]!==`
27
- `&&s[l]!=="\r")throw new f("unexpected character encountered",{toml:s,ptr:l});l+=+(s[l]===",")}return[i,l]}l=wt(s,t,",",r);let c=kt(s,t,l-+(s[l-1]===","));if(!c[0])throw new f("incomplete key-value declaration: no value specified",{toml:s,ptr:t});return r&&c[1]>-1&&(l=$(s,t+c[1]),l+=+(s[l]===",")),[Tt(c[0],s,t,o),l]}let Pt=/^[a-zA-Z0-9-_]+[ \t]*$/;function be(s,t,r="="){let a=t-1,o=[],n=s.indexOf(r,t);if(n<0)throw new f("incomplete key-value: cannot find end of key",{toml:s,ptr:t});do{let l=s[t=++a];if(l!==" "&&l!==" ")if(l==='"'||l==="'"){if(l===s[t+1]&&l===s[t+2])throw new f("multiline strings are not allowed in keys",{toml:s,ptr:t});let c=Ue(s,t);if(c<0)throw new f("unfinished string encountered",{toml:s,ptr:t});a=s.indexOf(".",c);let i=s.slice(c,a<0||a>n?n:a),d=ve(i);if(d>-1)throw new f("newlines are not allowed in keys",{toml:s,ptr:t+a+d});if(i.trimStart())throw new f("found extra tokens after the string part",{toml:s,ptr:c});if(n<c&&(n=s.indexOf(r,c),n<0))throw new f("incomplete key-value: cannot find end of key",{toml:s,ptr:t});o.push(Be(s,t,c))}else{a=s.indexOf(".",t);let c=s.slice(t,a<0||a>n?n:a);if(!Pt.test(c))throw new f("only letter, numbers, dashes and underscores are allowed in keys",{toml:s,ptr:t});o.push(c.trimEnd())}}while(a+1&&a<n);return[o,$(s,n+1,!0,!0)]}function Et(s,t,r,a){let o={},n=new Set,l;for(t++;(l=s[t++])!=="}"&&l;){if(l===",")throw new f("expected value, found comma",{toml:s,ptr:t-1});if(l==="#")t=xe(s,t);else if(l!==" "&&l!==" "&&l!==`
28
- `&&l!=="\r"){let c,i=o,d=!1,[m,h]=be(s,t-1);for(let p=0;p<m.length;p++){if(p&&(i=d?i[c]:i[c]={}),c=m[p],(d=Object.hasOwn(i,c))&&(typeof i[c]!="object"||n.has(i[c])))throw new f("trying to redefine an already defined value",{toml:s,ptr:t});!d&&c==="__proto__"&&Object.defineProperty(i,c,{enumerable:!0,configurable:!0,writable:!0})}if(d)throw new f("trying to redefine an already defined value",{toml:s,ptr:t});let[x,g]=Ne(s,h,"}",r-1,a);n.add(x),i[c]=x,t=g}}if(!l)throw new f("unfinished table encountered",{toml:s,ptr:t});return[o,t]}function Dt(s,t,r,a){let o=[],n;for(t++;(n=s[t++])!=="]"&&n;){if(n===",")throw new f("expected value, found comma",{toml:s,ptr:t-1});if(n==="#")t=xe(s,t);else if(n!==" "&&n!==" "&&n!==`
29
- `&&n!=="\r"){let l=Ne(s,t-1,"]",r-1,a);o.push(l[0]),t=l[1]}}if(!n)throw new f("unfinished array encountered",{toml:s,ptr:t});return[o,t]}function Le(s,t,r,a){let o=t,n=r,l,c=!1,i;for(let d=0;d<s.length;d++){if(d){if(o=c?o[l]:o[l]={},n=(i=n[l]).c,a===0&&(i.t===1||i.t===2))return null;if(i.t===2){let m=o.length-1;o=o[m],n=n[m].c}}if(l=s[d],(c=Object.hasOwn(o,l))&&n[l]?.t===0&&n[l]?.d)return null;c||(l==="__proto__"&&(Object.defineProperty(o,l,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(n,l,{enumerable:!0,configurable:!0,writable:!0})),n[l]={t:d<s.length-1&&a===2?3:a,d:!1,i:0,c:{}})}if(i=n[l],i.t!==a&&!(a===1&&i.t===3)||(a===2&&(i.d||(i.d=!0,o[l]=[]),o[l].push(o={}),i.c[i.i++]=i={t:1,d:!1,i:0,c:{}}),i.d))return null;if(i.d=!0,a===1)o=c?o[l]:o[l]={};else if(a===0&&c)return null;return[l,o,i.c]}function Ot(s,{maxDepth:t=1e3,integersAsBigInt:r}={}){let a={},o={},n=a,l=o;for(let c=$(s,0);c<s.length;){if(s[c]==="["){let i=s[++c]==="[",d=be(s,c+=+i,"]");if(i){if(s[d[1]-1]!=="]")throw new f("expected end of table declaration",{toml:s,ptr:d[1]-1});d[1]++}let m=Le(d[0],a,o,i?2:1);if(!m)throw new f("trying to redefine an already defined table or value",{toml:s,ptr:c});l=m[2],n=m[1],c=d[1]}else{let i=be(s,c),d=Le(i[0],n,l,0);if(!d)throw new f("trying to redefine an already defined table or value",{toml:s,ptr:c});let m=Ne(s,i[1],void 0,t,r);d[1][d[0]]=m[0],c=m[1]}if(c=$(s,c,!0),s[c]&&s[c]!==`
30
- `&&s[c]!=="\r")throw new f("each key-value declaration must be followed by an end-of-line",{toml:s,ptr:c});c=$(s,c)}return a}function Lt(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)}function At(s){return s.charCodeAt(0)===65279?s.slice(1):s}function Mt(s){const t=At(s);if(!t.trim())return{};const a=Ot(t);if(!Lt(a))throw new Error("TOML root must be a table.");return a}function Ve(s){try{return{config:Mt(s),parseError:null}}catch(t){return{config:null,parseError:t.message}}}async function Rt(){const s=await fetch(ne("/codex/diagnostics"));if(!s.ok)throw new Error("Failed to fetch Codex diagnostics");return s.json()}async function It(){const s=await fetch(ne("/codex/config/raw"));if(!s.ok)throw new Error("Failed to fetch Codex raw config");return s.json()}async function Ft(s){const t=await fetch(ne("/codex/config/raw"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(t.status===409)throw new Ae("Codex raw config changed externally");if(!t.ok){const r=await t.json().catch(()=>null);throw new Error(r?.error||"Failed to save Codex raw config")}return t.json()}async function Kt(s){const t=await fetch(ne("/codex/config/patch"),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(t.status===409)throw new Ae("Codex config changed externally");if(!t.ok){const r=await t.json().catch(()=>null);throw new Error(r?.error||"Failed to patch Codex config")}return t.json()}function Wt(){const s=us(),t=je({queryKey:["codex-diagnostics"],queryFn:Rt,refetchInterval:1e4}),r=je({queryKey:["codex-raw-config"],queryFn:It}),a=_e({mutationFn:Ft,onSuccess:(n,l)=>{s.setQueryData(["codex-raw-config"],c=>{const i=c?.path??"$CODEX_HOME/config.toml",d=c?.resolvedPath??i,m=Ve(l.rawText);return{path:i,resolvedPath:d,exists:!0,mtime:n.mtime,rawText:l.rawText,config:m.config,parseError:m.parseError,readError:null}}),s.invalidateQueries({queryKey:["codex-diagnostics"]})}}),o=_e({mutationFn:Kt,onSuccess:n=>{s.setQueryData(["codex-raw-config"],n),s.invalidateQueries({queryKey:["codex-diagnostics"]})}});return N.useMemo(()=>({diagnostics:t.data,diagnosticsLoading:t.isLoading,diagnosticsError:t.error,refetchDiagnostics:t.refetch,rawConfig:r.data,rawConfigLoading:r.isLoading,rawConfigError:r.error,refetchRawConfig:r.refetch,saveRawConfig:a.mutate,saveRawConfigAsync:a.mutateAsync,isSavingRawConfig:a.isPending,patchConfig:o.mutate,patchConfigAsync:o.mutateAsync,isPatchingConfig:o.isPending}),[t.data,t.isLoading,t.error,t.refetch,r.data,r.isLoading,r.error,r.refetch,a.mutate,a.mutateAsync,a.isPending,o.mutate,o.mutateAsync,o.isPending])}const qt=[{label:"Start Default",command:"ccs",description:"Launch Claude with default profile"},{label:"GLM Profile",command:"ccs glm",description:"Switch to GLM model"},{label:"Health Check",command:"ccs doctor",description:"Run system diagnostics"},{label:"Delegate Task",command:'ccs glm -p "your task"',description:"Delegate to GLM profile"}];function Ut({snippets:s=qt}){const[t,r]=N.useState(null),{t:a}=T(),o=async(n,l)=>{await navigator.clipboard.writeText(n),r(l),setTimeout(()=>r(null),2e3)};return e.jsxs(I,{children:[e.jsx(F,{className:"pb-3",children:e.jsxs(K,{className:"text-lg flex items-center gap-2",children:[e.jsx(Cs,{className:"w-5 h-5 text-muted-foreground"}),a("quickCommands.title")]})}),e.jsx(W,{children:e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:s.map((n,l)=>e.jsxs("div",{className:Me("group flex items-center justify-between gap-2 px-3 py-2","rounded-lg border bg-muted/30 hover:bg-muted/50 transition-colors"),children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:n.label}),e.jsx("code",{className:"text-sm font-mono font-medium truncate block",children:n.command})]}),e.jsx(C,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>o(n.command,l),title:n.description,children:t===l?e.jsx(Ss,{className:"h-4 w-4 text-green-600"}):e.jsx(_s,{className:"h-4 w-4"})})]},l))})})]})}function Bt(s){return!s||!Number.isFinite(s)?"N/A":new Date(s).toLocaleString()}function Vt(s){return!s||s<=0?"0 B":s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(2)} MB`}function k({label:s,value:t,mono:r=!1}){return e.jsxs("div",{className:"flex items-start justify-between gap-3 text-sm",children:[e.jsx("span",{className:"text-muted-foreground shrink-0",children:s}),e.jsx("span",{className:Me("text-right break-all",r&&"font-mono text-xs"),children:t})]})}function $t({diagnostics:s}){const{t}=T(),r=s.config.activeProfile?`codex --profile ${s.config.activeProfile}`:"codex",a=s.binary.supportsConfigOverrides;return e.jsx(we,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 pr-1",children:[e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(K,{className:"flex items-center gap-2 text-base",children:[e.jsx(Ts,{className:"h-4 w-4"}),t("codex.howCodexWorks")]})}),e.jsx(W,{className:"text-sm text-muted-foreground",children:e.jsxs("ul",{className:"ml-4 list-disc space-y-1.5 [&>li]:pl-1",children:[e.jsx("li",{children:t("codex.nativeDesc")}),e.jsxs("li",{children:[e.jsx("strong",{children:t("codex.nativeConfigLabel")})," ",t("codex.nativeConfigDesc")]}),e.jsxs("li",{children:[e.jsx("strong",{children:t("codex.transientOverridesLabel")})," ",t("codex.transientOverridesDesc")]}),e.jsxs("li",{children:[e.jsx("strong",{children:t("codex.cliproxyDefaultLabel")})," ",t("codex.cliproxyDefaultDesc")]}),e.jsx("li",{children:t("codex.apiProfilesDefault")})]})})]}),e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(K,{className:"flex items-center gap-2 text-base",children:[e.jsx(ks,{className:"h-4 w-4"}),t("codex.runtimeInstall")]})}),e.jsxs(W,{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:t("codex.status")}),e.jsx(y,{variant:s.binary.installed?"default":"secondary",children:s.binary.installed?t("codex.detected"):t("codex.notFound")})]}),e.jsx(k,{label:t("codex.detectionSource"),value:s.binary.source,mono:!0}),e.jsx(k,{label:t("codex.binaryPath"),value:s.binary.path||t("codex.notFound"),mono:!0}),e.jsx(k,{label:t("codex.installDirectory"),value:s.binary.installDir||"N/A",mono:!0}),e.jsx(k,{label:t("codex.versionLabel"),value:s.binary.version||"Unknown",mono:!0}),e.jsx(k,{label:t("codex.nativeAliases"),value:"ccs-codex, ccsx",mono:!0}),e.jsx(k,{label:t("codex.ccsProviderShortcut"),value:"ccsxp",mono:!0}),e.jsxs("div",{className:"flex items-center justify-between rounded-md border px-3 py-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:t("codex.configOverrideSupport")}),e.jsx(y,{variant:s.binary.supportsConfigOverrides?"default":"secondary",children:s.binary.supportsConfigOverrides?t("codex.available"):t("codex.missing")})]})]})]}),e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(K,{className:"flex items-center gap-2 text-base",children:[e.jsx(ke,{className:"h-4 w-4"}),t("codex.cliproxyNativeCodex")]})}),e.jsx(W,{className:"space-y-3 text-sm text-muted-foreground",children:a?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{children:e.jsx("strong",{children:t("codex.twoSupportedPaths")})}),e.jsxs("ul",{className:"ml-4 list-disc space-y-1 [&>li]:pl-1",children:[e.jsxs("li",{children:[e.jsx("strong",{children:t("codex.builtInLabel")})," ",t("codex.builtInCcsxpDesc")]}),e.jsxs("li",{children:[e.jsx("strong",{children:t("codex.nativeRecipeLabel")})," ",t("codex.nativeRecipeDesc")]})]})]}),e.jsxs("div",{className:"rounded-md border bg-muted/20 p-3",children:[e.jsx("p",{className:"font-medium text-foreground",children:t("codex.codexNativeRecipe")}),e.jsx("pre",{className:"mt-2 overflow-x-auto rounded-md bg-background p-3 text-xs text-foreground",children:We})]}),e.jsxs("ol",{className:"ml-4 list-decimal space-y-1.5 [&>li]:pl-1",children:[e.jsx("li",{children:t("codex.saveProviderNamedCliproxy")}),e.jsx("li",{children:t("codex.inTopLevelSetDefault")}),e.jsx("li",{children:t("codex.exportCliproxyApiKey")})]})]}):e.jsx("p",{children:t("codex.noConfigOverrides")})})]}),e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(K,{className:"flex items-center gap-2 text-base",children:[e.jsx(Ps,{className:"h-4 w-4"}),t("codex.configFile")]})}),e.jsx(W,{className:"space-y-3",children:e.jsxs("div",{className:"rounded-md border p-3 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"font-medium text-sm",children:t("codex.userConfig")}),s.file.exists?e.jsx(Es,{className:"h-4 w-4 text-green-600"}):e.jsx(Ds,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(k,{label:t("codex.path"),value:s.file.path,mono:!0}),e.jsx(k,{label:t("codex.resolved"),value:s.file.resolvedPath,mono:!0}),e.jsx(k,{label:t("codex.size"),value:Vt(s.file.sizeBytes)}),e.jsx(k,{label:t("codex.lastModified"),value:Bt(s.file.mtimeMs)}),s.file.parseError&&e.jsxs("p",{className:"text-xs text-amber-600",children:[t("codex.tomlWarning"),": ",s.file.parseError]}),s.file.readError&&e.jsxs("p",{className:"text-xs text-destructive",children:[t("codex.readWarning"),": ",s.file.readError]})]})})]}),e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(K,{className:"flex items-center gap-2 text-base",children:[e.jsx(ge,{className:"h-4 w-4"}),t("codex.currentUserLayerSummary")]})}),e.jsxs(W,{className:"space-y-3",children:[e.jsx(k,{label:t("codex.model"),value:s.config.model||t("codex.notSet"),mono:!0}),e.jsx(k,{label:t("codex.defaultProvider"),value:s.config.modelProvider||t("codex.notSet"),mono:!0}),e.jsx(k,{label:t("codex.activeProfile"),value:s.config.activeProfile||t("codex.notSet"),mono:!0}),e.jsx(k,{label:t("codex.approvalPolicy"),value:s.config.approvalPolicy||t("codex.notSet"),mono:!0}),e.jsx(k,{label:t("codex.sandboxMode"),value:s.config.sandboxMode||t("codex.notSet"),mono:!0}),e.jsx(k,{label:t("codex.webSearch"),value:s.config.webSearch||t("codex.notSet"),mono:!0}),e.jsx(ie,{}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsx(y,{variant:"outline",className:"justify-center",children:t("codex.providersCount",{count:s.config.modelProviderCount})}),e.jsx(y,{variant:"outline",className:"justify-center",children:t("codex.profilesCount",{count:s.config.profileCount})}),e.jsx(y,{variant:"outline",className:"justify-center",children:t("codex.enabledFeaturesCount",{count:s.config.enabledFeatures.length})}),e.jsx(y,{variant:"outline",className:"justify-center",children:t("codex.mcpServersCount",{count:s.config.mcpServerCount})})]}),s.config.topLevelKeys.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:t("codex.userLayerKeysPresent")}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.config.topLevelKeys.map(o=>e.jsx(y,{variant:"secondary",className:"font-mono text-[10px]",children:o},o))})]})]})]}),e.jsx(Ut,{snippets:[{label:t("codex.nativeShortAlias"),command:"ccsx",description:"Launch the short native Codex runtime alias."},{label:t("codex.ccsCodexShortcut"),command:'ccsxp "your prompt"',description:a?t("codex.runBuiltInCodex"):"Requires a Codex build that exposes --config overrides."},{label:t("codex.explicitProviderRoute"),command:'ccs codex --target codex "your prompt"',description:a?t("codex.runBuiltInCodexExplicit"):"Requires a Codex build that exposes --config overrides."},{label:s.config.activeProfile?"Inspect active profile":t("codex.openNativeCodex"),command:r,description:s.config.activeProfile?"Inspect the active named profile directly in native Codex.":"Open native Codex without forcing a named profile overlay."}]}),e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(K,{className:"flex items-center gap-2 text-base",children:[e.jsx(ke,{className:"h-4 w-4"}),t("codex.runtimeVsProvider")]})}),e.jsxs(W,{className:"grid gap-3 md:grid-cols-2",children:[e.jsxs("div",{className:"flex flex-col rounded-md border p-3 text-sm",children:[e.jsx("p",{className:"font-medium text-foreground",children:t("codex.nativeCodexRuntime")}),e.jsxs("ul",{className:"mt-2 flex-grow list-disc space-y-1.5 pl-4 text-muted-foreground [&>li]:pl-1",children:[e.jsx("li",{children:e.jsx("code",{children:"ccs-codex"})}),e.jsx("li",{children:e.jsx("code",{children:"ccsx"})}),e.jsx("li",{children:e.jsx("code",{children:"--target codex"})})]}),e.jsx(y,{variant:"secondary",className:"mt-4 w-fit justify-center font-normal",children:t("codex.honorsSavedNativeConfig")})]}),e.jsxs("div",{className:"flex flex-col rounded-md border p-3 text-sm",children:[e.jsx("p",{className:"font-medium text-foreground",children:t("codex.ccsCodexProvider")}),a?e.jsxs(e.Fragment,{children:[e.jsxs("ul",{className:"mt-2 flex-grow list-disc space-y-1.5 pl-4 text-muted-foreground [&>li]:pl-1",children:[e.jsx("li",{children:e.jsx("code",{children:"ccsxp"})}),e.jsx("li",{children:e.jsx("code",{children:"ccs codex --target codex"})})]}),e.jsx("p",{className:"mt-4 text-muted-foreground",children:t("codex.transientOverridesDesc")})]}):e.jsx("p",{className:"mt-2 text-muted-foreground",children:t("codex.unavailableNoConfig")})]})]})]}),e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsx(K,{className:"text-base",children:t("codex.supportedFlows")})}),e.jsx(W,{children:e.jsxs(Re,{children:[e.jsx(Ie,{children:e.jsxs(ce,{children:[e.jsx(B,{children:t("codex.flow")}),e.jsx(B,{children:t("codex.status")}),e.jsx(B,{children:t("codex.notes")})]})}),e.jsx(Fe,{children:s.supportMatrix.map(o=>e.jsxs(ce,{children:[e.jsx(V,{className:"font-mono text-xs",children:o.label}),e.jsx(V,{children:e.jsx(y,{variant:o.supported?"default":"secondary",children:o.supported?t("codex.yes"):t("codex.no")})}),e.jsx(V,{className:"text-xs text-muted-foreground",children:o.notes})]},o.id))})]})})]}),s.warnings.length>0&&e.jsxs(I,{className:"border-amber-200 bg-amber-50/50 dark:bg-amber-950/20",children:[e.jsx(F,{className:"pb-2",children:e.jsxs(K,{className:"flex items-center gap-2 text-base",children:[e.jsx(Os,{className:"h-4 w-4 text-amber-600"}),t("codex.warningsTitle")]})}),e.jsx(W,{className:"space-y-1.5",children:s.warnings.map(o=>e.jsxs("p",{className:"text-sm text-amber-800 dark:text-amber-300",children:["- ",o]},o))})]})]})})}function ar(){const{t:s}=T(),t=it(),{diagnostics:r,diagnosticsLoading:a,diagnosticsError:o,refetchDiagnostics:n,rawConfig:l,rawConfigLoading:c,rawConfigError:i,refetchRawConfig:d,saveRawConfigAsync:m,isSavingRawConfig:h,patchConfigAsync:x,isPatchingConfig:g}=Wt(),[p,w]=N.useState(null),M=l?.rawText??"",q=p??M,u=p!==null&&p!==M,v=Ve(q),X=v.parseError?{valid:!1,error:v.parseError}:{valid:!0},j=l?.config??null,$e=c||!l||u||l?.parseError!==null||l?.readError!==null,ze=i?"Structured controls unavailable: failed to load the current config.toml.":l?.readError?`Structured controls unavailable: ${l.readError}`:u?X.valid?"Save or discard raw TOML edits before using structured controls.":"Fix or discard raw TOML edits before using structured controls.":l?.parseError?`Structured controls disabled: ${l.parseError}`:null,Ge=N.useMemo(()=>qe(j),[j]),Xe=N.useMemo(()=>ct(j),[j]),He=N.useMemo(()=>dt(j),[j]),Ye=N.useMemo(()=>xt(j),[j]),Qe=N.useMemo(()=>ut(j),[j]),Je=N.useMemo(()=>mt(j),[j]),Ze=R=>{if(R===M){w(null);return}w(R)},es=async()=>{try{if((await Promise.all([n(),d()])).some(H=>!H||H.status==="error"||H.isError||H.error)){U.error(s("toasts.codexRefreshFailed"));return}w(null)}catch(R){U.error(R.message||s("toasts.codexRefreshError"))}},ss=async()=>{if(!X.valid){U.error(s("toasts.codexFixToml"));return}try{await m({rawText:q,expectedMtime:l?.exists?l.mtime:void 0}),w(null),U.success(s("toasts.codexSaved")),await n()}catch(R){Se(R)?U.error(s("toasts.codexChangedExternally")):U.error(R.message||s("toasts.codexSaveFailed"))}},ts=async(R,ye)=>{try{await x({...R,expectedMtime:l?.exists?l.mtime:void 0}),w(null),U.success(ye)}catch(H){Se(H)?U.error(s("toasts.codexChangedExternally")):U.error(H.message||s("toasts.codexUpdateFailed"))}},ae="mt-0 h-full border-0 p-0 data-[state=inactive]:hidden",rs=()=>a?e.jsxs("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:[e.jsx(G,{className:"mr-2 h-5 w-5 animate-spin"}),"Loading Codex diagnostics..."]}):o||!r?e.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-destructive",children:"Failed to load Codex diagnostics."}):e.jsxs(ds,{defaultValue:"overview",className:"flex h-full flex-col",children:[e.jsx("div",{className:"shrink-0 px-4 pt-4",children:e.jsxs(xs,{className:"grid w-full grid-cols-4",children:[e.jsx(oe,{value:"overview",children:s("codexPage.overview")}),e.jsx(oe,{value:"controls",children:s("codexPage.controlCenter")}),e.jsx(oe,{value:"docs",children:s("codexPage.docs")}),e.jsx(oe,{value:"auth-profiles",children:s("codexPage.authProfiles")})]})}),e.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden px-4 pb-4 pt-3",children:[e.jsx(le,{value:"overview",className:ae,children:e.jsx($t,{diagnostics:r})}),e.jsx(le,{value:"controls",className:ae,children:e.jsx(ot,{workspacePath:r.workspacePath,activeProfile:r.config.activeProfile,topLevelSettings:Ge,projectTrustEntries:Xe,profileEntries:He,modelProviderEntries:Ye,mcpServerEntries:Qe,featureCatalog:t,featureState:Je,disabled:$e,disabledReason:ze,saving:g,onPatch:ts})}),e.jsx(le,{value:"docs",className:ae,children:e.jsx(jt,{diagnostics:r})}),e.jsx(le,{value:"auth-profiles",className:ae,children:e.jsx("div",{className:"h-full overflow-auto p-1",children:e.jsx(Ks,{})})})]})]});return e.jsx("div",{className:"h-full min-h-0 overflow-hidden",children:e.jsxs(is,{direction:"horizontal",className:"h-full",children:[e.jsx(Ce,{defaultSize:45,minSize:35,children:e.jsx("div",{className:"h-full border-r bg-muted/20",children:rs()})}),e.jsx(cs,{className:"group flex w-2 cursor-col-resize items-center justify-center bg-border transition-colors hover:bg-primary/20",children:e.jsx(Ls,{className:"h-3 w-3 text-muted-foreground group-hover:text-primary"})}),e.jsx(Ce,{defaultSize:55,minSize:35,children:e.jsx(As,{title:"Codex config.toml",pathLabel:l?.path||r?.file.path||"$CODEX_HOME/config.toml",loading:c,parseWarning:X.valid?l?.parseError:X.error,readWarning:l?.readError,value:q,dirty:u,readOnly:!!l?.readError,saving:h,saveDisabled:!u||h||c||!X.valid||!!l?.readError,onChange:R=>{Ze(R)},onSave:ss,onRefresh:es,onDiscard:()=>w(null),language:"toml",exactText:!0,loadingLabel:"Loading config.toml...",parseWarningLabel:"TOML warning",ownershipNotice:e.jsxs("div",{className:"rounded-md border border-amber-200 bg-amber-50/60 px-3 py-2 text-sm text-amber-900 dark:bg-amber-950/20 dark:text-amber-300",children:[e.jsx("p",{className:"font-medium",children:"This file is upstream-owned by Codex CLI."}),e.jsxs("p",{children:["CCS does not keep ",e.jsx("code",{children:"~/.codex/config.toml"})," in sync for you."]}),e.jsxs("p",{children:["CCS-backed Codex launches may apply transient ",e.jsx("code",{children:"-c"})," overrides and",e.jsx("code",{children:" CCS_CODEX_API_KEY"}),"; those effective values may not appear here."]})]})})})]})})}export{ar as CodexPage};