@kaitranntt/ccs 7.67.0 → 7.68.0-dev.1

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 (154) hide show
  1. package/dist/api/services/index.d.ts +1 -0
  2. package/dist/api/services/index.d.ts.map +1 -1
  3. package/dist/api/services/index.js +3 -1
  4. package/dist/api/services/index.js.map +1 -1
  5. package/dist/api/services/local-runtime-readiness.d.ts +14 -0
  6. package/dist/api/services/local-runtime-readiness.d.ts.map +1 -0
  7. package/dist/api/services/local-runtime-readiness.js +89 -0
  8. package/dist/api/services/local-runtime-readiness.js.map +1 -0
  9. package/dist/cliproxy/accounts/types.d.ts +1 -1
  10. package/dist/cliproxy/accounts/types.d.ts.map +1 -1
  11. package/dist/cliproxy/auth-utils.d.ts +2 -1
  12. package/dist/cliproxy/auth-utils.d.ts.map +1 -1
  13. package/dist/cliproxy/auth-utils.js +32 -7
  14. package/dist/cliproxy/auth-utils.js.map +1 -1
  15. package/dist/cliproxy/catalog-routing.d.ts +12 -0
  16. package/dist/cliproxy/catalog-routing.d.ts.map +1 -0
  17. package/dist/cliproxy/catalog-routing.js +19 -0
  18. package/dist/cliproxy/catalog-routing.js.map +1 -0
  19. package/dist/cliproxy/gemini-cli-quota-normalizer.js +1 -1
  20. package/dist/cliproxy/gemini-cli-quota-normalizer.js.map +1 -1
  21. package/dist/cliproxy/managed-model-prefixes.d.ts +7 -0
  22. package/dist/cliproxy/managed-model-prefixes.d.ts.map +1 -0
  23. package/dist/cliproxy/managed-model-prefixes.js +116 -0
  24. package/dist/cliproxy/managed-model-prefixes.js.map +1 -0
  25. package/dist/cliproxy/model-catalog.d.ts.map +1 -1
  26. package/dist/cliproxy/model-catalog.js +19 -4
  27. package/dist/cliproxy/model-catalog.js.map +1 -1
  28. package/dist/cliproxy/provider-entitlement-evidence.d.ts +17 -0
  29. package/dist/cliproxy/provider-entitlement-evidence.d.ts.map +1 -0
  30. package/dist/cliproxy/provider-entitlement-evidence.js +55 -0
  31. package/dist/cliproxy/provider-entitlement-evidence.js.map +1 -0
  32. package/dist/cliproxy/provider-entitlement-types.d.ts +16 -0
  33. package/dist/cliproxy/provider-entitlement-types.d.ts.map +1 -0
  34. package/dist/cliproxy/provider-entitlement-types.js +3 -0
  35. package/dist/cliproxy/provider-entitlement-types.js.map +1 -0
  36. package/dist/cliproxy/quota-fetcher-gemini-cli.d.ts.map +1 -1
  37. package/dist/cliproxy/quota-fetcher-gemini-cli.js +64 -19
  38. package/dist/cliproxy/quota-fetcher-gemini-cli.js.map +1 -1
  39. package/dist/cliproxy/quota-fetcher.d.ts +10 -0
  40. package/dist/cliproxy/quota-fetcher.d.ts.map +1 -1
  41. package/dist/cliproxy/quota-fetcher.js +116 -21
  42. package/dist/cliproxy/quota-fetcher.js.map +1 -1
  43. package/dist/cliproxy/quota-types.d.ts +3 -0
  44. package/dist/cliproxy/quota-types.d.ts.map +1 -1
  45. package/dist/commands/api-command/create-command.d.ts +3 -0
  46. package/dist/commands/api-command/create-command.d.ts.map +1 -1
  47. package/dist/commands/api-command/create-command.js +20 -6
  48. package/dist/commands/api-command/create-command.js.map +1 -1
  49. package/dist/commands/api-command/help.d.ts.map +1 -1
  50. package/dist/commands/api-command/help.js +1 -0
  51. package/dist/commands/api-command/help.js.map +1 -1
  52. package/dist/commands/cliproxy/catalog-subcommand.d.ts.map +1 -1
  53. package/dist/commands/cliproxy/catalog-subcommand.js +60 -6
  54. package/dist/commands/cliproxy/catalog-subcommand.js.map +1 -1
  55. package/dist/commands/cliproxy/help-subcommand.d.ts.map +1 -1
  56. package/dist/commands/cliproxy/help-subcommand.js +3 -2
  57. package/dist/commands/cliproxy/help-subcommand.js.map +1 -1
  58. package/dist/commands/cliproxy/quota-subcommand.d.ts +2 -0
  59. package/dist/commands/cliproxy/quota-subcommand.d.ts.map +1 -1
  60. package/dist/commands/cliproxy/quota-subcommand.js +8 -1
  61. package/dist/commands/cliproxy/quota-subcommand.js.map +1 -1
  62. package/dist/commands/cliproxy/variant-subcommand.d.ts.map +1 -1
  63. package/dist/commands/cliproxy/variant-subcommand.js +44 -3
  64. package/dist/commands/cliproxy/variant-subcommand.js.map +1 -1
  65. package/dist/commands/update-command.d.ts +20 -5
  66. package/dist/commands/update-command.d.ts.map +1 -1
  67. package/dist/commands/update-command.js +169 -119
  68. package/dist/commands/update-command.js.map +1 -1
  69. package/dist/docker/supervisord-lifecycle.d.ts +17 -0
  70. package/dist/docker/supervisord-lifecycle.d.ts.map +1 -0
  71. package/dist/docker/supervisord-lifecycle.js +58 -0
  72. package/dist/docker/supervisord-lifecycle.js.map +1 -0
  73. package/dist/shared/agy-gemini-pro-compatibility.d.ts +15 -0
  74. package/dist/shared/agy-gemini-pro-compatibility.d.ts.map +1 -0
  75. package/dist/shared/agy-gemini-pro-compatibility.js +18 -0
  76. package/dist/shared/agy-gemini-pro-compatibility.js.map +1 -0
  77. package/dist/shared/cliproxy-model-routing.d.ts +45 -0
  78. package/dist/shared/cliproxy-model-routing.d.ts.map +1 -0
  79. package/dist/shared/cliproxy-model-routing.js +144 -0
  80. package/dist/shared/cliproxy-model-routing.js.map +1 -0
  81. package/dist/shared/provider-preset-catalog.d.ts +3 -1
  82. package/dist/shared/provider-preset-catalog.d.ts.map +1 -1
  83. package/dist/shared/provider-preset-catalog.js +16 -0
  84. package/dist/shared/provider-preset-catalog.js.map +1 -1
  85. package/dist/ui/assets/{accounts-DeuJFkg9.js → accounts-DjL3iVZW.js} +1 -1
  86. package/dist/ui/assets/{alert-dialog-CIh7avyK.js → alert-dialog-Tc_D1a_B.js} +1 -1
  87. package/dist/ui/assets/api-CUtkvXmX.js +4 -0
  88. package/dist/ui/assets/{auth-section-Byn3WNlt.js → auth-section-CuKWQHC7.js} +1 -1
  89. package/dist/ui/assets/{backups-section-Cjxu2uP0.js → backups-section-BKW2pbb9.js} +1 -1
  90. package/dist/ui/assets/{channels-m4LEUo20.js → channels-DvWJMdaq.js} +1 -1
  91. package/dist/ui/assets/{checkbox-BTiURiLD.js → checkbox-B0hZxMK5.js} +1 -1
  92. package/dist/ui/assets/{claude-extension-HVw0lW0B.js → claude-extension-Dfqu-rev.js} +1 -1
  93. package/dist/ui/assets/cliproxy-C9RxW-I8.js +3 -0
  94. package/dist/ui/assets/cliproxy-ai-providers-BXLuuxNf.js +15 -0
  95. package/dist/ui/assets/{cliproxy-control-panel-Bk9j_L8D.js → cliproxy-control-panel-aQ7cCc2U.js} +1 -1
  96. package/dist/ui/assets/{codex-DwZ2fgSg.js → codex-aq4RI6_n.js} +9 -9
  97. package/dist/ui/assets/{confirm-dialog-DEH0IxeO.js → confirm-dialog-CpDk6eu4.js} +1 -1
  98. package/dist/ui/assets/{copilot-CvVEiVk4.js → copilot-CQRpGXvY.js} +2 -2
  99. package/dist/ui/assets/{cursor-bUhF-L0e.js → cursor-BpXPf6qi.js} +1 -1
  100. package/dist/ui/assets/{droid-DclUJQm-.js → droid-Cgx-yLjy.js} +2 -2
  101. package/dist/ui/assets/{globalenv-section-CHrVYu4k.js → globalenv-section-DsNqG1yB.js} +1 -1
  102. package/dist/ui/assets/{health-DPxgprcp.js → health-BY-O-JcA.js} +1 -1
  103. package/dist/ui/assets/icons-KVCk4_U8.js +1 -0
  104. package/dist/ui/assets/index-BmSzf0T9.js +72 -0
  105. package/dist/ui/assets/{index-M221tenZ.js → index-CLGiPB3A.js} +1 -1
  106. package/dist/ui/assets/{index-CH9d--NX.js → index-Cet36v1V.js} +1 -1
  107. package/dist/ui/assets/{index-9Wrepw_v.js → index-DH6L6ybH.js} +1 -1
  108. package/dist/ui/assets/{index-Dqu-oUnM.js → index-DsCjnpco.js} +1 -1
  109. package/dist/ui/assets/{index-CKV57-q1.js → index-TQFuDZdB.js} +1 -1
  110. package/dist/ui/assets/index-teLjoh2T.css +1 -0
  111. package/dist/ui/assets/{logs-BLqOqsjV.js → logs-D5ro-pc7.js} +1 -1
  112. package/dist/ui/assets/{masked-input-CkL1uaIV.js → masked-input-h0XkMSwB.js} +1 -1
  113. package/dist/ui/assets/{proxy-status-widget-vDbXAa_g.js → proxy-status-widget-yBdrFeb7.js} +1 -1
  114. package/dist/ui/assets/{raw-json-settings-editor-panel-DnWe1yut.js → raw-json-settings-editor-panel-Cb7ZInQV.js} +1 -1
  115. package/dist/ui/assets/{searchable-select-Cxn-MaXd.js → searchable-select-D4xr5xKS.js} +1 -1
  116. package/dist/ui/assets/{separator-D8AC7pKi.js → separator-gw5BjIpP.js} +1 -1
  117. package/dist/ui/assets/{shared-BICn93Rc.js → shared-C-VeA1Z9.js} +1 -1
  118. package/dist/ui/assets/{table-ClzIn68q.js → table-Bd4isC18.js} +1 -1
  119. package/dist/ui/assets/{updates-2-RYxjjV.js → updates-DiK8I67C.js} +1 -1
  120. package/dist/ui/index.html +3 -3
  121. package/dist/utils/hooks/image-analysis-runtime-status.d.ts.map +1 -1
  122. package/dist/utils/hooks/image-analysis-runtime-status.js +5 -1
  123. package/dist/utils/hooks/image-analysis-runtime-status.js.map +1 -1
  124. package/dist/utils/package-manager-detector.d.ts +30 -4
  125. package/dist/utils/package-manager-detector.d.ts.map +1 -1
  126. package/dist/utils/package-manager-detector.js +247 -60
  127. package/dist/utils/package-manager-detector.js.map +1 -1
  128. package/dist/utils/update-checker.d.ts +1 -1
  129. package/dist/utils/update-checker.d.ts.map +1 -1
  130. package/dist/web-server/index.d.ts.map +1 -1
  131. package/dist/web-server/index.js +9 -0
  132. package/dist/web-server/index.js.map +1 -1
  133. package/dist/web-server/routes/catalog-routes.d.ts.map +1 -1
  134. package/dist/web-server/routes/catalog-routes.js +3 -2
  135. package/dist/web-server/routes/catalog-routes.js.map +1 -1
  136. package/dist/web-server/routes/cliproxy-auth-routes.d.ts.map +1 -1
  137. package/dist/web-server/routes/cliproxy-auth-routes.js +23 -2
  138. package/dist/web-server/routes/cliproxy-auth-routes.js.map +1 -1
  139. package/dist/web-server/routes/cliproxy-stats-routes.d.ts.map +1 -1
  140. package/dist/web-server/routes/cliproxy-stats-routes.js +8 -1
  141. package/dist/web-server/routes/cliproxy-stats-routes.js.map +1 -1
  142. package/dist/web-server/routes/profile-routes.d.ts.map +1 -1
  143. package/dist/web-server/routes/profile-routes.js +8 -0
  144. package/dist/web-server/routes/profile-routes.js.map +1 -1
  145. package/dist/web-server/services/cliproxy-dashboard-install-service.d.ts.map +1 -1
  146. package/dist/web-server/services/cliproxy-dashboard-install-service.js +14 -0
  147. package/dist/web-server/services/cliproxy-dashboard-install-service.js.map +1 -1
  148. package/package.json +1 -1
  149. package/dist/ui/assets/api-C12eUocD.js +0 -4
  150. package/dist/ui/assets/cliproxy-N6hlFUnC.js +0 -3
  151. package/dist/ui/assets/cliproxy-ai-providers-Dx1wGLH_.js +0 -21
  152. package/dist/ui/assets/icons-C4EMu2PL.js +0 -1
  153. package/dist/ui/assets/index-Cmt79H00.js +0 -69
  154. package/dist/ui/assets/index-XjzGg2Bk.css +0 -1
@@ -1 +1 @@
1
- import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as s}from"./react-vendor-CNOkPC89.js";import{u as R}from"./tanstack-CrmUhA7Z.js";import{b7 as g,Y as I}from"./index-Cmt79H00.js";import{C as S}from"./default-ports-1QQSffYX.js";import{G as z,R as _,w as D}from"./icons-C4EMu2PL.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";const k="cli-proxy-auth",T="isLoggedIn",O="apiBase",U="apiUrl",K="managementKey";function $(a){return a.startsWith("/")?new URL(a.replace(/\/$/,""),window.location.origin).href:a.replace(/\/$/,"")}function Q(a,c){window.localStorage.removeItem(k),window.localStorage.setItem(O,a),window.localStorage.setItem(U,a),window.localStorage.setItem(K,c),window.localStorage.setItem(T,"true")}function A(){window.localStorage.removeItem(k),window.localStorage.removeItem(O),window.localStorage.removeItem(U),window.localStorage.removeItem(K),window.localStorage.removeItem(T)}function X({port:a=S}){const c=s.useRef(null),[F,C]=s.useState(null),[M,B]=s.useState(0),[L,N]=s.useState(null),[Y,v]=s.useState(!1),{data:l,error:p}=R({queryKey:["cliproxy-server-config"],queryFn:()=>I.cliproxyServer.get(),staleTime:3e4});s.useEffect(()=>{p&&console.warn("[ControlPanelEmbed] Config fetch failed, using local mode:",p)},[p]);const E=!!(l?.remote?.enabled&&l?.remote?.host),{data:w,error:f}=R({queryKey:["auth-tokens-raw",E?"remote":"local"],enabled:l!==void 0&&!E,queryFn:async()=>{try{const t=await fetch(g("/settings/auth/tokens/raw"));if(!t.ok)throw new Error("Failed to fetch auth tokens");const n=await t.json(),o=n.managementSecret.value.trim();if(!o)throw new Error("Management secret missing");return Q($(g("/cliproxy-local/")),o),n}catch(t){throw A(),t}},staleTime:3e4}),{managementUrl:P,checkUrl:x,authToken:y,isRemote:i,displayHost:m}=s.useMemo(()=>{const t=l?.remote,n=l?.local?.port??a;if(t?.enabled&&t?.host){const o=t.protocol||"http",d=t.port||(o==="https"?443:S),h=o==="https"&&d===443||o==="http"&&d===80?"":`:${d}`,r=`${o}://${t.host}${h}`;return{managementUrl:`${r}/management.html`,checkUrl:`${r}/`,authToken:t.auth_token||void 0,isRemote:!0,displayHost:`${t.host}${h}`}}return{managementUrl:g("/cliproxy-local/management.html"),checkUrl:g("/cliproxy-local/"),authToken:w?.managementSecret?.value||void 0,isRemote:!1,displayHost:`localhost:${n}`}},[l,w,a]),b=`${P}:${i?"remote":"local"}:${x}:${y??"missing"}:${M}`,j=l!==void 0&&(i||!!w||!!f);s.useEffect(()=>{f&&console.warn("[ControlPanelEmbed] Failed to preload local control panel session, falling back to manual login:",f)},[f]),s.useEffect(()=>{if(!i)return()=>{A()}},[i]);const G=!j||!(F===b),q=()=>{if(!(!i||!c.current?.contentWindow||!y))try{const t=$(x),n=new URL(`${t}/`).origin;if(new URL(c.current.src,window.location.origin).origin!==n){console.warn("[ControlPanelEmbed] Remote iframe origin mismatch, skipping postMessage");return}c.current.contentWindow.postMessage({type:"ccs-auto-login",apiBase:t,managementKey:y},n)}catch(t){console.debug("[ControlPanelEmbed] Remote postMessage bootstrap failed:",t)}};s.useEffect(()=>{const t=new AbortController;let n=!1;const o=(r,u)=>{n||(v(r),N(u))},d=async()=>{try{if(i){const r=l?.remote,u=await I.cliproxyServer.test({host:r?.host??"",port:r?.port,protocol:r?.protocol??"http",authToken:r?.auth_token});u?.reachable?o(!0,null):o(!1,u?.error?`Remote CLIProxy at ${m}: ${u.error}`:`Remote CLIProxy at ${m} returned an error`)}else(await fetch(x,{signal:t.signal})).ok?o(!0,null):o(!1,"CLIProxy returned an error")}catch(r){if(r instanceof Error&&r.name==="AbortError")return;o(!1,i?`Remote CLIProxy at ${m} is not reachable`:"CLIProxy is not running")}},h=setTimeout(()=>t.abort(),2e3);return d().finally(()=>clearTimeout(h)),()=>{n=!0,t.abort()}},[x,i,m,l]);const H=()=>{C(b),q()},W=()=>{C(null),B(t=>t+1),N(null),v(!1)};return!Y&&L?e.jsxs("div",{className:"flex-1 flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z,{className:"w-5 h-5 text-primary"}),e.jsx("h2",{className:"font-semibold",children:"CLIProxy Control Panel"})]}),e.jsxs("button",{className:"inline-flex items-center gap-2 px-3 py-1.5 text-sm border rounded-md hover:bg-muted",onClick:W,children:[e.jsx(_,{className:"w-4 h-4"}),"Retry"]})]}),e.jsx("div",{className:"flex-1 flex items-center justify-center bg-muted/20",children:e.jsxs("div",{className:"text-center max-w-md px-8",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-destructive/10 flex items-center justify-center mx-auto mb-6",children:e.jsx(D,{className:"w-8 h-8 text-destructive"})}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"CLIProxy Not Available"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:L}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Start a CLIProxy session with"," ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"ccs gemini"})," or run"," ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"ccs config"})," which auto-starts it."]})]})})]}):e.jsx("div",{className:"flex-1 flex flex-col",children:e.jsxs("div",{className:"flex-1 flex flex-col relative",children:[G&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/80 z-10",children:e.jsxs("div",{className:"text-center",children:[e.jsx(_,{className:"w-8 h-8 animate-spin text-primary mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i?`Loading Control Panel from ${m}...`:"Loading Control Panel..."})]})}),j?e.jsx("iframe",{ref:c,src:P,className:"flex-1 w-full border-0",title:"CLIProxy Management Panel",onLoad:H},b):null]})})}function ie(){return e.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:e.jsx(X,{})})}export{ie as CliproxyControlPanelPage};
1
+ import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as s}from"./react-vendor-CNOkPC89.js";import{u as R}from"./tanstack-CrmUhA7Z.js";import{bb as g,Y as I}from"./index-BmSzf0T9.js";import{C as S}from"./default-ports-1QQSffYX.js";import{G as z,R as _,w as D}from"./icons-KVCk4_U8.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";const k="cli-proxy-auth",T="isLoggedIn",O="apiBase",U="apiUrl",K="managementKey";function $(a){return a.startsWith("/")?new URL(a.replace(/\/$/,""),window.location.origin).href:a.replace(/\/$/,"")}function Q(a,c){window.localStorage.removeItem(k),window.localStorage.setItem(O,a),window.localStorage.setItem(U,a),window.localStorage.setItem(K,c),window.localStorage.setItem(T,"true")}function A(){window.localStorage.removeItem(k),window.localStorage.removeItem(O),window.localStorage.removeItem(U),window.localStorage.removeItem(K),window.localStorage.removeItem(T)}function X({port:a=S}){const c=s.useRef(null),[F,C]=s.useState(null),[M,B]=s.useState(0),[L,N]=s.useState(null),[Y,v]=s.useState(!1),{data:l,error:p}=R({queryKey:["cliproxy-server-config"],queryFn:()=>I.cliproxyServer.get(),staleTime:3e4});s.useEffect(()=>{p&&console.warn("[ControlPanelEmbed] Config fetch failed, using local mode:",p)},[p]);const E=!!(l?.remote?.enabled&&l?.remote?.host),{data:w,error:f}=R({queryKey:["auth-tokens-raw",E?"remote":"local"],enabled:l!==void 0&&!E,queryFn:async()=>{try{const t=await fetch(g("/settings/auth/tokens/raw"));if(!t.ok)throw new Error("Failed to fetch auth tokens");const n=await t.json(),o=n.managementSecret.value.trim();if(!o)throw new Error("Management secret missing");return Q($(g("/cliproxy-local/")),o),n}catch(t){throw A(),t}},staleTime:3e4}),{managementUrl:P,checkUrl:x,authToken:y,isRemote:i,displayHost:m}=s.useMemo(()=>{const t=l?.remote,n=l?.local?.port??a;if(t?.enabled&&t?.host){const o=t.protocol||"http",d=t.port||(o==="https"?443:S),h=o==="https"&&d===443||o==="http"&&d===80?"":`:${d}`,r=`${o}://${t.host}${h}`;return{managementUrl:`${r}/management.html`,checkUrl:`${r}/`,authToken:t.auth_token||void 0,isRemote:!0,displayHost:`${t.host}${h}`}}return{managementUrl:g("/cliproxy-local/management.html"),checkUrl:g("/cliproxy-local/"),authToken:w?.managementSecret?.value||void 0,isRemote:!1,displayHost:`localhost:${n}`}},[l,w,a]),b=`${P}:${i?"remote":"local"}:${x}:${y??"missing"}:${M}`,j=l!==void 0&&(i||!!w||!!f);s.useEffect(()=>{f&&console.warn("[ControlPanelEmbed] Failed to preload local control panel session, falling back to manual login:",f)},[f]),s.useEffect(()=>{if(!i)return()=>{A()}},[i]);const G=!j||!(F===b),q=()=>{if(!(!i||!c.current?.contentWindow||!y))try{const t=$(x),n=new URL(`${t}/`).origin;if(new URL(c.current.src,window.location.origin).origin!==n){console.warn("[ControlPanelEmbed] Remote iframe origin mismatch, skipping postMessage");return}c.current.contentWindow.postMessage({type:"ccs-auto-login",apiBase:t,managementKey:y},n)}catch(t){console.debug("[ControlPanelEmbed] Remote postMessage bootstrap failed:",t)}};s.useEffect(()=>{const t=new AbortController;let n=!1;const o=(r,u)=>{n||(v(r),N(u))},d=async()=>{try{if(i){const r=l?.remote,u=await I.cliproxyServer.test({host:r?.host??"",port:r?.port,protocol:r?.protocol??"http",authToken:r?.auth_token});u?.reachable?o(!0,null):o(!1,u?.error?`Remote CLIProxy at ${m}: ${u.error}`:`Remote CLIProxy at ${m} returned an error`)}else(await fetch(x,{signal:t.signal})).ok?o(!0,null):o(!1,"CLIProxy returned an error")}catch(r){if(r instanceof Error&&r.name==="AbortError")return;o(!1,i?`Remote CLIProxy at ${m} is not reachable`:"CLIProxy is not running")}},h=setTimeout(()=>t.abort(),2e3);return d().finally(()=>clearTimeout(h)),()=>{n=!0,t.abort()}},[x,i,m,l]);const H=()=>{C(b),q()},W=()=>{C(null),B(t=>t+1),N(null),v(!1)};return!Y&&L?e.jsxs("div",{className:"flex-1 flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z,{className:"w-5 h-5 text-primary"}),e.jsx("h2",{className:"font-semibold",children:"CLIProxy Control Panel"})]}),e.jsxs("button",{className:"inline-flex items-center gap-2 px-3 py-1.5 text-sm border rounded-md hover:bg-muted",onClick:W,children:[e.jsx(_,{className:"w-4 h-4"}),"Retry"]})]}),e.jsx("div",{className:"flex-1 flex items-center justify-center bg-muted/20",children:e.jsxs("div",{className:"text-center max-w-md px-8",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-destructive/10 flex items-center justify-center mx-auto mb-6",children:e.jsx(D,{className:"w-8 h-8 text-destructive"})}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"CLIProxy Not Available"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:L}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Start a CLIProxy session with"," ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"ccs gemini"})," or run"," ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"ccs config"})," which auto-starts it."]})]})})]}):e.jsx("div",{className:"flex-1 flex flex-col",children:e.jsxs("div",{className:"flex-1 flex flex-col relative",children:[G&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/80 z-10",children:e.jsxs("div",{className:"text-center",children:[e.jsx(_,{className:"w-8 h-8 animate-spin text-primary mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i?`Loading Control Panel from ${m}...`:"Loading Control Panel..."})]})}),j?e.jsx("iframe",{ref:c,src:P,className:"flex-1 w-full border-0",title:"CLIProxy Management Panel",onLoad:H},b):null]})})}function ie(){return e.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:e.jsx(X,{})})}export{ie as CliproxyControlPanelPage};
@@ -1,27 +1,27 @@
1
- import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as b}from"./react-vendor-CNOkPC89.js";import{t as K}from"./notifications-B2HqRBj7.js";import{C as D,j as M,k as I,B as y,b as F,d as w,aF as B,r as _,s as E,t as P,v as O,w as v,I as C,n as xe,b7 as J,b8 as Te,c as _e,be as $e,bf as fe,bg as Ye,Q as Be,R as He,U as re,V as te,b9 as je}from"./index-Cmt79H00.js";import{a9 as Qe,aO as Je,ar as Z,L as z,n as Ze,aP as es,aQ as ss,aw as rs,w as ts,a6 as ns,aR as as,aS as ls,aT as os,ag as de,p as ge,_ as is,m as cs,o as ds,Y as us,S as ms,aJ as ve,aU as xs,x as hs,I as ps,T as fs,N as js}from"./icons-C4EMu2PL.js";import{S as Q}from"./separator-D8AC7pKi.js";import{a as gs,u as be,b as we}from"./tanstack-CrmUhA7Z.js";import"./code-highlight-BRUf_pqB.js";import{T as vs,a as bs,b as Ne,c as ne,d as ws,e as ae}from"./table-ClzIn68q.js";import{R as Ns}from"./raw-json-settings-editor-panel-DnWe1yut.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";function H({title:s,icon:r,badge:t,description:a,disabledReason:n,children:l}){return e.jsxs(D,{children:[e.jsxs(M,{className:"pb-2",children:[e.jsxs(I,{className:"flex items-center gap-2 text-base",children:[r,s,t?e.jsx(y,{variant:"outline",className:"text-[10px] font-normal",children:t}):null]}),a?e.jsx("p",{className:"text-xs text-muted-foreground",children:a}):null]}),e.jsxs(F,{className:"space-y-3",children:[n?e.jsx("p",{className:"text-xs text-amber-600",children:n}):null,l]})]})}function Cs({catalog:s,state:r,disabled:t=!1,disabledReason:a,onToggle:n}){const l=new Set(s.map(o=>o.name)),i=Object.entries(r).filter(([o])=>!l.has(o)).sort(([o],[d])=>o.localeCompare(d));return e.jsxs(H,{title:"Features",badge:"features",icon:e.jsx(Qe,{className:"h-4 w-4"}),description:"Toggle the supported Codex feature flags CCS can safely manage.",disabledReason:a,children:[e.jsx("div",{className:"space-y-2",children:s.map(o=>{const d=r[o.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:o.label}),e.jsx(y,{variant:"outline",className:"font-mono text-[10px]",children:o.name})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:o.description})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[d!==null?e.jsx(w,{variant:"outline",size:"sm",onClick:()=>n(o.name,null),disabled:t,children:"Use default"}):null,e.jsx(B,{checked:d===!0,onCheckedChange:c=>n(o.name,c),disabled:t})]})]},o.name)})}),i.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:"Existing config-only flags"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"These feature keys already exist in your `config.toml`, so CCS can surface them without claiming full catalog coverage."})]}),i.map(([o,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:o}),e.jsx(y,{variant:"secondary",className:"text-[10px]",children:"existing"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:d===null?"Stored in a non-boolean form. Use raw TOML if you need to edit it.":"Discovered from the current file instead of CCS's built-in catalog."})]}),d===null?e.jsx(y,{variant:"outline",children:"Raw only"}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(w,{variant:"outline",size:"sm",onClick:()=>n(o,null),disabled:t,children:"Use default"}),e.jsx(B,{checked:d===!0,onCheckedChange:c=>n(o,c),disabled:t})]})]},o))]}):null]})}const ys={name:"",transport:"stdio",command:null,args:[],url:null,enabled:!0,required:!1,startupTimeoutSec:null,toolTimeoutSec:null,enabledTools:[],disabledTools:[]};function le(s){return s.join(", ")}function oe(s){return s.split(",").map(r=>r.trim()).filter(Boolean)}function Ss({initialDraft:s,isNew:r,disabled:t,saving:a,canDelete:n,onSave:l,onDelete:i}){const[o,d]=b.useState(s);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(C,{value:o.name,onChange:c=>d(u=>({...u,name:c.target.value})),placeholder:"playwright",disabled:t||!r}),e.jsxs(_,{value:o.transport,onValueChange:c=>d(u=>({...u,transport:c})),disabled:t,children:[e.jsx(E,{children:e.jsx(P,{})}),e.jsxs(O,{children:[e.jsx(v,{value:"stdio",children:"stdio"}),e.jsx(v,{value:"streamable-http",children:"streamable-http"})]})]}),o.transport==="stdio"?e.jsxs(e.Fragment,{children:[e.jsx(C,{value:o.command??"",onChange:c=>d(u=>({...u,command:c.target.value||null})),placeholder:"npx",disabled:t}),e.jsx(C,{value:le(o.args),onChange:c=>d(u=>({...u,args:oe(c.target.value)})),placeholder:"@playwright/mcp@latest, --flag",disabled:t})]}):e.jsx(C,{className:"sm:col-span-2",value:o.url??"",onChange:c=>d(u=>({...u,url:c.target.value||null})),placeholder:"https://example.test/mcp",disabled:t}),e.jsx(C,{type:"number",min:1,value:o.startupTimeoutSec??"",onChange:c=>d(u=>({...u,startupTimeoutSec:c.target.value?Number(c.target.value):null})),placeholder:"Startup timeout (sec)",disabled:t}),e.jsx(C,{type:"number",min:1,value:o.toolTimeoutSec??"",onChange:c=>d(u=>({...u,toolTimeoutSec:c.target.value?Number(c.target.value):null})),placeholder:"Tool timeout (sec)",disabled:t}),e.jsx(C,{value:le(o.enabledTools),onChange:c=>d(u=>({...u,enabledTools:oe(c.target.value)})),placeholder:"enabled_tools",disabled:t}),e.jsx(C,{value:le(o.disabledTools),onChange:c=>d(u=>({...u,disabledTools:oe(c.target.value)})),placeholder:"disabled_tools",disabled:t})]}),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(B,{checked:o.enabled,onCheckedChange:c=>d(u=>({...u,enabled:c})),disabled:t})]}),e.jsxs("label",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-sm",children:["Required",e.jsx(B,{checked:o.required,onCheckedChange:c=>d(u=>({...u,required:c})),disabled:t})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs(w,{variant:"outline",onClick:i,disabled:t||a||!n,children:[e.jsx(Z,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsxs(w,{onClick:()=>l(o.name,{transport:o.transport,command:o.command,args:o.args,url:o.url,enabled:o.enabled,required:o.required,startupTimeoutSec:o.startupTimeoutSec,toolTimeoutSec:o.toolTimeoutSec,enabledTools:o.enabledTools,disabledTools:o.disabledTools}),disabled:t||a||o.name.trim().length===0,children:[a?e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save MCP server"]})]})]})}function ks({entries:s,disabled:r=!1,disabledReason:t,saving:a=!1,onSave:n,onDelete:l}){const[i,o]=b.useState("new"),d=b.useMemo(()=>s.find(h=>h.name===i)??null,[s,i]),c=d??ys,u=JSON.stringify(c);return e.jsxs(H,{title:"MCP servers",badge:"mcp_servers",icon:e.jsx(Je,{className:"h-4 w-4"}),description:"Manage the safe MCP transport fields. Keep auth headers and bearer tokens in raw TOML.",disabledReason:t,children:[e.jsxs(_,{value:i,onValueChange:o,disabled:r,children:[e.jsx(E,{children:e.jsx(P,{placeholder:"Select MCP server"})}),e.jsxs(O,{children:[e.jsx(v,{value:"new",children:"Create new MCP server"}),s.map(h=>e.jsx(v,{value:h.name,children:h.name},h.name))]})]}),e.jsx(Ss,{initialDraft:c,isNew:i==="new",disabled:r,saving:a,canDelete:d!==null,onDelete:async()=>{d&&(await l(d.name),o("new"))},onSave:async(h,j)=>{await n(h,j),o(h)}},u)]})}const Ts={name:"",displayName:null,baseUrl:null,envKey:null,wireApi:"responses",requiresOpenaiAuth:!1,supportsWebsockets:!1},_s={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 Es({initialDraft:s,isNew:r,disabled:t,saving:a,canDelete:n,onSave:l,onDelete:i}){const[o,d]=b.useState(s);return e.jsxs(e.Fragment,{children:[r&&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:"Default provider"})," to ",e.jsx("code",{children:"cliproxy"})," in Top-level settings."]}),e.jsx(w,{variant:"outline",size:"sm",onClick:()=>d(_s),disabled:t,children:"Use CLIProxy Codex preset"})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(C,{value:o.name,onChange:c=>d(u=>({...u,name:c.target.value})),placeholder:"Provider id",disabled:t||!r}),e.jsx(C,{value:o.displayName??"",onChange:c=>d(u=>({...u,displayName:c.target.value||null})),placeholder:"Display name",disabled:t}),e.jsx(C,{value:o.baseUrl??"",onChange:c=>d(u=>({...u,baseUrl:c.target.value||null})),placeholder:"http://127.0.0.1:8317/api/provider/codex",disabled:t}),e.jsx(C,{value:o.envKey??"",onChange:c=>d(u=>({...u,envKey:c.target.value||null})),placeholder:"CLIPROXY_API_KEY",disabled:t})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[e.jsxs(_,{value:o.wireApi??"responses",onValueChange:c=>d(u=>({...u,wireApi:c})),disabled:t,children:[e.jsx(E,{children:e.jsx(P,{})}),e.jsx(O,{children:e.jsx(v,{value:"responses",children:"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(B,{checked:o.requiresOpenaiAuth,onCheckedChange:c=>d(u=>({...u,requiresOpenaiAuth:c})),disabled:t})]}),e.jsxs("label",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-sm",children:["Supports websockets",e.jsx(B,{checked:o.supportsWebsockets,onCheckedChange:c=>d(u=>({...u,supportsWebsockets:c})),disabled:t})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs(w,{variant:"outline",onClick:i,disabled:t||a||!n,children:[e.jsx(Z,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsxs(w,{onClick:()=>l(o.name,{displayName:o.displayName,baseUrl:o.baseUrl,envKey:o.envKey,wireApi:o.wireApi,requiresOpenaiAuth:o.requiresOpenaiAuth,supportsWebsockets:o.supportsWebsockets}),disabled:t||a||o.name.trim().length===0,children:[a?e.jsx(z,{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:"Default provider"})," control above."]})]})}function Ps({entries:s,disabled:r=!1,disabledReason:t,saving:a=!1,onSave:n,onDelete:l}){const[i,o]=b.useState("new"),d=b.useMemo(()=>s.find(h=>h.name===i)??null,[s,i]),c=d??Ts,u=JSON.stringify(c);return e.jsxs(H,{title:"Model providers",badge:"model_providers",icon:e.jsx(Ze,{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:t,children:[e.jsxs(_,{value:i,onValueChange:o,disabled:r,children:[e.jsx(E,{children:e.jsx(P,{placeholder:"Select provider"})}),e.jsxs(O,{children:[e.jsx(v,{value:"new",children:"Create new provider"}),s.map(h=>e.jsx(v,{value:h.name,children:h.name},h.name))]})]}),e.jsx(Es,{initialDraft:c,isNew:i==="new",disabled:r,saving:a,canDelete:d!==null,onDelete:async()=>{d&&(await l(d.name),o("new"))},onSave:async(h,j)=>{await n(h,j),o(h)}},u)]})}function Os({initialName:s,initialModel:r,initialProvider:t,initialEffort:a,providerNames:n,activeProfile:l,selectedEntryName:i,disabled:o,saving:d,onSave:c,onDelete:u,onSetActive:h}){const[j,x]=b.useState(s),[g,A]=b.useState(r),[U,m]=b.useState(t),[f,T]=b.useState(a);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(C,{value:j,onChange:N=>x(N.target.value),placeholder:"deep-review",disabled:o||i!==null}),e.jsx(C,{value:g??"",onChange:N=>A(N.target.value||null),placeholder:"gpt-5.4",disabled:o}),e.jsxs(_,{value:U??"__unset__",onValueChange:N=>m(N==="__unset__"?null:N),disabled:o,children:[e.jsx(E,{children:e.jsx(P,{placeholder:"Use global provider"})}),e.jsxs(O,{children:[e.jsx(v,{value:"__unset__",children:"Use global provider"}),n.map(N=>e.jsx(v,{value:N,children:N},N))]})]}),e.jsxs(_,{value:f??"__unset__",onValueChange:N=>T(N==="__unset__"?null:N),disabled:o,children:[e.jsx(E,{children:e.jsx(P,{placeholder:"Use global effort"})}),e.jsxs(O,{children:[e.jsx(v,{value:"__unset__",children:"Use global effort"}),["minimal","low","medium","high","xhigh"].map(N=>e.jsx(v,{value:N,children:N},N))]})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(w,{variant:"outline",onClick:u,disabled:o||d||!i,children:[e.jsx(Z,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsx(w,{variant:"outline",onClick:h,disabled:o||d||!i||i===l,children:"Set active"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(w,{variant:"outline",onClick:()=>c(j,{model:g,modelProvider:U,modelReasoningEffort:f},!1),disabled:o||d||j.trim().length===0,children:[d?e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save profile"]}),e.jsxs(w,{onClick:()=>c(j,{model:g,modelProvider:U,modelReasoningEffort:f},!0),disabled:o||d||j.trim().length===0,children:[d?e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save + activate"]})]})]})]})}function Ls({activeProfile:s,entries:r,providerNames:t,disabled:a=!1,disabledReason:n,saving:l=!1,onSave:i,onDelete:o,onSetActive:d}){const[c,u]=b.useState("new"),h=b.useMemo(()=>r.find(x=>x.name===c)??null,[r,c]),j=JSON.stringify(h??{name:"",values:{}});return e.jsxs(H,{title:"Profiles",badge:"profiles",icon:e.jsx(es,{className:"h-4 w-4"}),description:"Create reusable Codex overlays and set the active default profile.",disabledReason:n,children:[e.jsxs(_,{value:c,onValueChange:u,disabled:a,children:[e.jsx(E,{children:e.jsx(P,{placeholder:"Select profile"})}),e.jsxs(O,{children:[e.jsx(v,{value:"new",children:"Create new profile"}),r.map(x=>e.jsxs(v,{value:x.name,children:[x.name,x.name===s?" (active)":""]},x.name))]})]}),e.jsx(Os,{initialName:h?.name??"",initialModel:h?.values.model??null,initialProvider:h?.values.modelProvider??null,initialEffort:h?.values.modelReasoningEffort??null,providerNames:t,activeProfile:s,selectedEntryName:h?.name??null,disabled:a,saving:l,onDelete:async()=>{h&&(await o(h.name),u("new"))},onSetActive:async()=>{h&&await d(h.name)},onSave:async(x,g,A)=>{await i(x,g,A),u(x)}},j)]})}function As({workspacePath:s,disabled:r,saving:t,onSave:a}){const[n,l]=b.useState(s),[i,o]=b.useState("trusted");return e.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_160px_auto]",children:[e.jsx(C,{value:n,onChange:d=>l(d.target.value),placeholder:"~/repo or /absolute/path",disabled:r}),e.jsxs(_,{value:i,onValueChange:o,disabled:r,children:[e.jsx(E,{children:e.jsx(P,{})}),e.jsxs(O,{children:[e.jsx(v,{value:"trusted",children:"trusted"}),e.jsx(v,{value:"untrusted",children:"untrusted"})]})]}),e.jsxs(w,{onClick:()=>a(n,i),disabled:r||t,children:[t?e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save trust"]})]})}function Rs({workspacePath:s,entries:r,disabled:t=!1,disabledReason:a,saving:n=!1,onSave:l}){return e.jsxs(H,{title:"Project trust",badge:"projects",icon:e.jsx(ss,{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(As,{workspacePath:s,disabled:t,saving:n,onSave:l},s),e.jsx(w,{variant:"outline",className:"w-full justify-start",onClick:()=>l(s,"trusted"),disabled:t||n,children:"Trust current workspace"}),e.jsx("div",{className:"space-y-2",children:r.length===0?e.jsx("p",{className:"text-xs text-muted-foreground",children:"No explicit project trust entries saved."}):r.map(i=>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:i.path}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["trust_level = ",i.trustLevel]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(w,{variant:"ghost",size:"sm",onClick:()=>l(i.path,i.trustLevel==="trusted"?"untrusted":"trusted"),disabled:t||n,children:"Toggle"}),e.jsx(w,{variant:"ghost",size:"icon",onClick:()=>l(i.path,null),disabled:t||n,children:e.jsx(Z,{className:"h-4 w-4"})})]})]},i.path))})]})}const L="__unset__",Ds=105e4,Ms=272e3,Ce=8e5,ye=7e5,Is=new Intl.NumberFormat("en-US");function X(s){return s??L}function G(s,r){return r&&!s.includes(r)?[r,...s]:s}function ie(s){return Is.format(s)}function Fs(s){return s?.trim().toLowerCase().startsWith("gpt-5.4")??!1}function Us(s,r){const t={};return r.model!==s.model&&(t.model=r.model),r.modelReasoningEffort!==s.modelReasoningEffort&&(t.modelReasoningEffort=r.modelReasoningEffort),r.modelContextWindow!==s.modelContextWindow&&(t.modelContextWindow=r.modelContextWindow),r.modelAutoCompactTokenLimit!==s.modelAutoCompactTokenLimit&&(t.modelAutoCompactTokenLimit=r.modelAutoCompactTokenLimit),r.modelProvider!==s.modelProvider&&(t.modelProvider=r.modelProvider),r.approvalPolicy!==s.approvalPolicy&&(t.approvalPolicy=r.approvalPolicy),r.sandboxMode!==s.sandboxMode&&(t.sandboxMode=r.sandboxMode),r.webSearch!==s.webSearch&&(t.webSearch=r.webSearch),r.toolOutputTokenLimit!==s.toolOutputTokenLimit&&(t.toolOutputTokenLimit=r.toolOutputTokenLimit),r.personality!==s.personality&&(t.personality=r.personality),t}function Ks({initialValues:s,providerNames:r,disabled:t,saving:a,onSave:n}){const[l,i]=b.useState(s),o=G(["minimal","low","medium","high","xhigh"],l.modelReasoningEffort),d=G(r,l.modelProvider),c=G(["on-request","never","untrusted"],l.approvalPolicy),u=G(["read-only","workspace-write","danger-full-access"],l.sandboxMode),h=G(["cached","live","disabled"],l.webSearch),j=G(["none","friendly","pragmatic"],l.personality),x=Us(s,l),g=Object.keys(x).length>0,A=Fs(l.model),U=m=>{const f=m.trim();return f.length>0?Number(f):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:"Model"}),e.jsx(C,{value:l.model??"",onChange:m=>i(f=>({...f,model:m.target.value||null})),placeholder:"gpt-5.4",disabled:t})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Reasoning effort"}),e.jsxs(_,{value:X(l.modelReasoningEffort),onValueChange:m=>i(f=>({...f,modelReasoningEffort:m===L?null:m})),disabled:t,children:[e.jsx(E,{children:e.jsx(P,{placeholder:"Use default"})}),e.jsxs(O,{children:[e.jsx(v,{value:L,children:"Use default"}),o.map(m=>e.jsx(v,{value:m,children:m},m))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Default provider"}),e.jsxs(_,{value:X(l.modelProvider),onValueChange:m=>i(f=>({...f,modelProvider:m===L?null:m})),disabled:t,children:[e.jsx(E,{children:e.jsx(P,{placeholder:"Use Codex default"})}),e.jsxs(O,{children:[e.jsx(v,{value:L,children:"Use Codex default"}),d.map(m=>e.jsx(v,{value:m,children:m},m))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Approval policy"}),e.jsxs(_,{value:X(l.approvalPolicy),onValueChange:m=>i(f=>({...f,approvalPolicy:m===L?null:m})),disabled:t,children:[e.jsx(E,{children:e.jsx(P,{placeholder:"Use default"})}),e.jsxs(O,{children:[e.jsx(v,{value:L,children:"Use default"}),c.map(m=>e.jsx(v,{value:m,children:m},m))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Sandbox mode"}),e.jsxs(_,{value:X(l.sandboxMode),onValueChange:m=>i(f=>({...f,sandboxMode:m===L?null:m})),disabled:t,children:[e.jsx(E,{children:e.jsx(P,{placeholder:"Use default"})}),e.jsxs(O,{children:[e.jsx(v,{value:L,children:"Use default"}),u.map(m=>e.jsx(v,{value:m,children:m},m))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Web search"}),e.jsxs(_,{value:X(l.webSearch),onValueChange:m=>i(f=>({...f,webSearch:m===L?null:m})),disabled:t,children:[e.jsx(E,{children:e.jsx(P,{placeholder:"Use default"})}),e.jsxs(O,{children:[e.jsx(v,{value:L,children:"Use default"}),h.map(m=>e.jsx(v,{value:m,children:m},m))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Tool output token limit"}),e.jsx(C,{type:"number",min:1,value:l.toolOutputTokenLimit??"",onChange:m=>i(f=>({...f,toolOutputTokenLimit:m.target.value?Number(m.target.value):null})),placeholder:"25000",disabled:t})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Personality"}),e.jsxs(_,{value:X(l.personality),onValueChange:m=>i(f=>({...f,personality:m===L?null:m})),disabled:t,children:[e.jsx(E,{children:e.jsx(P,{placeholder:"Use default"})}),e.jsxs(O,{children:[e.jsx(v,{value:L,children:"Use default"}),j.map(m=>e.jsx(v,{value:m,children:m},m))]})]})]})]}),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(ts,{className:"h-4 w-4 text-amber-600 dark:text-amber-300"}),e.jsx("p",{className:"text-sm font-semibold",children:"Long context override"}),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:A?"GPT-5.4 selected":"GPT-5.4 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(w,{type:"button",variant:"outline",size:"sm",disabled:t,onClick:()=>i(m=>({...m,modelContextWindow:Ce,modelAutoCompactTokenLimit:ye})),children:"Fill cautious pair"}),e.jsx(w,{type:"button",variant:"outline",size:"sm",disabled:t,onClick:()=>i(m=>({...m,modelContextWindow:Ds})),children:"Set official max window"}),e.jsx(w,{type:"button",variant:"ghost",size:"sm",disabled:t,onClick:()=>i(m=>({...m,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:"GPT-5.4 context cap"})]}),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:ie(Ms)}),e.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:"Normal usage window"})]}),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:"Counts 2x"}),e.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:"Usage-limit cost above 272K"})]})]}),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 ",ie(Ce)]}),e.jsxs("div",{className:"rounded-full border bg-background px-2.5 py-1 font-mono text-[11px] font-medium",children:["Auto-compact ",ie(ye)]})]}),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:"Quick-fill only. Review before saving."}),!A&&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:"Model context window"}),e.jsx(C,{"aria-label":"Model context window",type:"number",min:1,value:l.modelContextWindow??"",onChange:m=>i(f=>({...f,modelContextWindow:U(m.target.value)})),placeholder:"Unset",disabled:t}),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:"Auto-compact token limit"}),e.jsx(C,{"aria-label":"Auto-compact token limit",type:"number",min:1,value:l.modelAutoCompactTokenLimit??"",onChange:m=>i(f=>({...f,modelAutoCompactTokenLimit:U(m.target.value)})),placeholder:"Unset",disabled:t}),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://developers.openai.com/api/docs/models/gpt-5.4",target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:"GPT-5.4 model page"}),e.jsx("a",{href:"https://openai.com/index/introducing-gpt-5-4/",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(w,{onClick:()=>n(x),disabled:t||a||!g,children:[a?e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save top-level settings"]})})]})}function Ws({values:s,providerNames:r,disabled:t=!1,disabledReason:a,saving:n=!1,onSave:l}){return e.jsx(H,{title:"Top-level controls",badge:"config.toml",icon:e.jsx(rs,{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(Ks,{initialValues:s,providerNames:r,disabled:t,saving:n,onSave:l},JSON.stringify(s))})}function qs({workspacePath:s,activeProfile:r,topLevelSettings:t,projectTrustEntries:a,profileEntries:n,modelProviderEntries:l,mcpServerEntries:i,featureCatalog:o,featureState:d,disabled:c,disabledReason:u,saving:h,onPatch:j}){return e.jsx(xe,{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(ns,{className:"h-4 w-4"})}),e.jsx("div",{children:e.jsx("h2",{className:"text-base font-semibold tracking-tight text-foreground",children:"Structured controls boundary"})})]}),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(as,{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(ls,{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(os,{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(Ws,{values:t,providerNames:l.map(x=>x.name),disabled:c,disabledReason:u,saving:h,onSave:x=>j({kind:"top-level",values:x},"Saved top-level Codex settings.")}),e.jsx(Rs,{workspacePath:s,entries:a,disabled:c,disabledReason:u,saving:h,onSave:(x,g)=>j({kind:"project-trust",path:x,trustLevel:g},g?"Saved project trust entry.":"Removed project trust entry.")}),e.jsx(Ls,{activeProfile:r,entries:n,providerNames:l.map(x=>x.name),disabled:c,disabledReason:u,saving:h,onSave:(x,g,A)=>j({kind:"profile",action:"upsert",name:x,values:g,setAsActive:A},"Saved profile."),onDelete:x=>j({kind:"profile",action:"delete",name:x},"Deleted profile."),onSetActive:x=>j({kind:"profile",action:"set-active",name:x},"Set active profile.")}),e.jsx(Ps,{entries:l,disabled:c,disabledReason:u,saving:h,onSave:(x,g)=>j({kind:"model-provider",action:"upsert",name:x,values:g},"Saved model provider."),onDelete:x=>j({kind:"model-provider",action:"delete",name:x},"Deleted model provider.")}),e.jsx(ks,{entries:i,disabled:c,disabledReason:u,saving:h,onSave:(x,g)=>j({kind:"mcp-server",action:"upsert",name:x,values:g},"Saved MCP server."),onDelete:x=>j({kind:"mcp-server",action:"delete",name:x},"Deleted MCP server.")}),e.jsx(Cs,{catalog:o,state:d,disabled:c,disabledReason:u,onToggle:(x,g)=>j({kind:"feature",feature:x,enabled:g},"Saved feature toggle.")})]})})}const Ee=`model_provider = "cliproxy"
1
+ import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as b}from"./react-vendor-CNOkPC89.js";import{t as W}from"./notifications-B2HqRBj7.js";import{C as D,j as M,k as I,B as y,b as F,d as w,aF as B,r as _,s as E,t as P,v as O,w as v,I as C,n as xe,bb as J,bc as Te,c as _e,bi as Ge,bj as fe,bk as Ye,Q as Be,R as He,U as re,V as te,bd as je}from"./index-BmSzf0T9.js";import{aa as Qe,aR as Je,as as Z,L as X,n as Ze,aS as es,aT as ss,aB as rs,w as ts,a7 as ns,aU as as,aV as ls,aW as os,ah as de,p as ge,$ as is,m as cs,o as ds,_ as us,S as ms,aM as ve,aX as xs,x as hs,I as ps,T as fs,N as js}from"./icons-KVCk4_U8.js";import{S as Q}from"./separator-gw5BjIpP.js";import{a as gs,u as be,b as we}from"./tanstack-CrmUhA7Z.js";import"./code-highlight-BRUf_pqB.js";import{T as vs,a as bs,b as Ne,c as ne,d as ws,e as ae}from"./table-Bd4isC18.js";import{R as Ns}from"./raw-json-settings-editor-panel-Cb7ZInQV.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";function H({title:s,icon:r,badge:t,description:a,disabledReason:n,children:l}){return e.jsxs(D,{children:[e.jsxs(M,{className:"pb-2",children:[e.jsxs(I,{className:"flex items-center gap-2 text-base",children:[r,s,t?e.jsx(y,{variant:"outline",className:"text-[10px] font-normal",children:t}):null]}),a?e.jsx("p",{className:"text-xs text-muted-foreground",children:a}):null]}),e.jsxs(F,{className:"space-y-3",children:[n?e.jsx("p",{className:"text-xs text-amber-600",children:n}):null,l]})]})}function Cs({catalog:s,state:r,disabled:t=!1,disabledReason:a,onToggle:n}){const l=new Set(s.map(o=>o.name)),i=Object.entries(r).filter(([o])=>!l.has(o)).sort(([o],[d])=>o.localeCompare(d));return e.jsxs(H,{title:"Features",badge:"features",icon:e.jsx(Qe,{className:"h-4 w-4"}),description:"Toggle the supported Codex feature flags CCS can safely manage.",disabledReason:a,children:[e.jsx("div",{className:"space-y-2",children:s.map(o=>{const d=r[o.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:o.label}),e.jsx(y,{variant:"outline",className:"font-mono text-[10px]",children:o.name})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:o.description})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[d!==null?e.jsx(w,{variant:"outline",size:"sm",onClick:()=>n(o.name,null),disabled:t,children:"Use default"}):null,e.jsx(B,{checked:d===!0,onCheckedChange:c=>n(o.name,c),disabled:t})]})]},o.name)})}),i.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:"Existing config-only flags"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"These feature keys already exist in your `config.toml`, so CCS can surface them without claiming full catalog coverage."})]}),i.map(([o,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:o}),e.jsx(y,{variant:"secondary",className:"text-[10px]",children:"existing"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:d===null?"Stored in a non-boolean form. Use raw TOML if you need to edit it.":"Discovered from the current file instead of CCS's built-in catalog."})]}),d===null?e.jsx(y,{variant:"outline",children:"Raw only"}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(w,{variant:"outline",size:"sm",onClick:()=>n(o,null),disabled:t,children:"Use default"}),e.jsx(B,{checked:d===!0,onCheckedChange:c=>n(o,c),disabled:t})]})]},o))]}):null]})}const ys={name:"",transport:"stdio",command:null,args:[],url:null,enabled:!0,required:!1,startupTimeoutSec:null,toolTimeoutSec:null,enabledTools:[],disabledTools:[]};function le(s){return s.join(", ")}function oe(s){return s.split(",").map(r=>r.trim()).filter(Boolean)}function Ss({initialDraft:s,isNew:r,disabled:t,saving:a,canDelete:n,onSave:l,onDelete:i}){const[o,d]=b.useState(s);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(C,{value:o.name,onChange:c=>d(u=>({...u,name:c.target.value})),placeholder:"playwright",disabled:t||!r}),e.jsxs(_,{value:o.transport,onValueChange:c=>d(u=>({...u,transport:c})),disabled:t,children:[e.jsx(E,{children:e.jsx(P,{})}),e.jsxs(O,{children:[e.jsx(v,{value:"stdio",children:"stdio"}),e.jsx(v,{value:"streamable-http",children:"streamable-http"})]})]}),o.transport==="stdio"?e.jsxs(e.Fragment,{children:[e.jsx(C,{value:o.command??"",onChange:c=>d(u=>({...u,command:c.target.value||null})),placeholder:"npx",disabled:t}),e.jsx(C,{value:le(o.args),onChange:c=>d(u=>({...u,args:oe(c.target.value)})),placeholder:"@playwright/mcp@latest, --flag",disabled:t})]}):e.jsx(C,{className:"sm:col-span-2",value:o.url??"",onChange:c=>d(u=>({...u,url:c.target.value||null})),placeholder:"https://example.test/mcp",disabled:t}),e.jsx(C,{type:"number",min:1,value:o.startupTimeoutSec??"",onChange:c=>d(u=>({...u,startupTimeoutSec:c.target.value?Number(c.target.value):null})),placeholder:"Startup timeout (sec)",disabled:t}),e.jsx(C,{type:"number",min:1,value:o.toolTimeoutSec??"",onChange:c=>d(u=>({...u,toolTimeoutSec:c.target.value?Number(c.target.value):null})),placeholder:"Tool timeout (sec)",disabled:t}),e.jsx(C,{value:le(o.enabledTools),onChange:c=>d(u=>({...u,enabledTools:oe(c.target.value)})),placeholder:"enabled_tools",disabled:t}),e.jsx(C,{value:le(o.disabledTools),onChange:c=>d(u=>({...u,disabledTools:oe(c.target.value)})),placeholder:"disabled_tools",disabled:t})]}),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(B,{checked:o.enabled,onCheckedChange:c=>d(u=>({...u,enabled:c})),disabled:t})]}),e.jsxs("label",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-sm",children:["Required",e.jsx(B,{checked:o.required,onCheckedChange:c=>d(u=>({...u,required:c})),disabled:t})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs(w,{variant:"outline",onClick:i,disabled:t||a||!n,children:[e.jsx(Z,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsxs(w,{onClick:()=>l(o.name,{transport:o.transport,command:o.command,args:o.args,url:o.url,enabled:o.enabled,required:o.required,startupTimeoutSec:o.startupTimeoutSec,toolTimeoutSec:o.toolTimeoutSec,enabledTools:o.enabledTools,disabledTools:o.disabledTools}),disabled:t||a||o.name.trim().length===0,children:[a?e.jsx(X,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save MCP server"]})]})]})}function ks({entries:s,disabled:r=!1,disabledReason:t,saving:a=!1,onSave:n,onDelete:l}){const[i,o]=b.useState("new"),d=b.useMemo(()=>s.find(h=>h.name===i)??null,[s,i]),c=d??ys,u=JSON.stringify(c);return e.jsxs(H,{title:"MCP servers",badge:"mcp_servers",icon:e.jsx(Je,{className:"h-4 w-4"}),description:"Manage the safe MCP transport fields. Keep auth headers and bearer tokens in raw TOML.",disabledReason:t,children:[e.jsxs(_,{value:i,onValueChange:o,disabled:r,children:[e.jsx(E,{children:e.jsx(P,{placeholder:"Select MCP server"})}),e.jsxs(O,{children:[e.jsx(v,{value:"new",children:"Create new MCP server"}),s.map(h=>e.jsx(v,{value:h.name,children:h.name},h.name))]})]}),e.jsx(Ss,{initialDraft:c,isNew:i==="new",disabled:r,saving:a,canDelete:d!==null,onDelete:async()=>{d&&(await l(d.name),o("new"))},onSave:async(h,j)=>{await n(h,j),o(h)}},u)]})}const Ts={name:"",displayName:null,baseUrl:null,envKey:null,wireApi:"responses",requiresOpenaiAuth:!1,supportsWebsockets:!1},_s={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 Es({initialDraft:s,isNew:r,disabled:t,saving:a,canDelete:n,onSave:l,onDelete:i}){const[o,d]=b.useState(s);return e.jsxs(e.Fragment,{children:[r&&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:"Default provider"})," to ",e.jsx("code",{children:"cliproxy"})," in Top-level settings."]}),e.jsx(w,{variant:"outline",size:"sm",onClick:()=>d(_s),disabled:t,children:"Use CLIProxy Codex preset"})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(C,{value:o.name,onChange:c=>d(u=>({...u,name:c.target.value})),placeholder:"Provider id",disabled:t||!r}),e.jsx(C,{value:o.displayName??"",onChange:c=>d(u=>({...u,displayName:c.target.value||null})),placeholder:"Display name",disabled:t}),e.jsx(C,{value:o.baseUrl??"",onChange:c=>d(u=>({...u,baseUrl:c.target.value||null})),placeholder:"http://127.0.0.1:8317/api/provider/codex",disabled:t}),e.jsx(C,{value:o.envKey??"",onChange:c=>d(u=>({...u,envKey:c.target.value||null})),placeholder:"CLIPROXY_API_KEY",disabled:t})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[e.jsxs(_,{value:o.wireApi??"responses",onValueChange:c=>d(u=>({...u,wireApi:c})),disabled:t,children:[e.jsx(E,{children:e.jsx(P,{})}),e.jsx(O,{children:e.jsx(v,{value:"responses",children:"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(B,{checked:o.requiresOpenaiAuth,onCheckedChange:c=>d(u=>({...u,requiresOpenaiAuth:c})),disabled:t})]}),e.jsxs("label",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-sm",children:["Supports websockets",e.jsx(B,{checked:o.supportsWebsockets,onCheckedChange:c=>d(u=>({...u,supportsWebsockets:c})),disabled:t})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs(w,{variant:"outline",onClick:i,disabled:t||a||!n,children:[e.jsx(Z,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsxs(w,{onClick:()=>l(o.name,{displayName:o.displayName,baseUrl:o.baseUrl,envKey:o.envKey,wireApi:o.wireApi,requiresOpenaiAuth:o.requiresOpenaiAuth,supportsWebsockets:o.supportsWebsockets}),disabled:t||a||o.name.trim().length===0,children:[a?e.jsx(X,{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:"Default provider"})," control above."]})]})}function Ps({entries:s,disabled:r=!1,disabledReason:t,saving:a=!1,onSave:n,onDelete:l}){const[i,o]=b.useState("new"),d=b.useMemo(()=>s.find(h=>h.name===i)??null,[s,i]),c=d??Ts,u=JSON.stringify(c);return e.jsxs(H,{title:"Model providers",badge:"model_providers",icon:e.jsx(Ze,{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:t,children:[e.jsxs(_,{value:i,onValueChange:o,disabled:r,children:[e.jsx(E,{children:e.jsx(P,{placeholder:"Select provider"})}),e.jsxs(O,{children:[e.jsx(v,{value:"new",children:"Create new provider"}),s.map(h=>e.jsx(v,{value:h.name,children:h.name},h.name))]})]}),e.jsx(Es,{initialDraft:c,isNew:i==="new",disabled:r,saving:a,canDelete:d!==null,onDelete:async()=>{d&&(await l(d.name),o("new"))},onSave:async(h,j)=>{await n(h,j),o(h)}},u)]})}function Os({initialName:s,initialModel:r,initialProvider:t,initialEffort:a,providerNames:n,activeProfile:l,selectedEntryName:i,disabled:o,saving:d,onSave:c,onDelete:u,onSetActive:h}){const[j,x]=b.useState(s),[g,A]=b.useState(r),[U,m]=b.useState(t),[f,T]=b.useState(a);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(C,{value:j,onChange:N=>x(N.target.value),placeholder:"deep-review",disabled:o||i!==null}),e.jsx(C,{value:g??"",onChange:N=>A(N.target.value||null),placeholder:"gpt-5.4",disabled:o}),e.jsxs(_,{value:U??"__unset__",onValueChange:N=>m(N==="__unset__"?null:N),disabled:o,children:[e.jsx(E,{children:e.jsx(P,{placeholder:"Use global provider"})}),e.jsxs(O,{children:[e.jsx(v,{value:"__unset__",children:"Use global provider"}),n.map(N=>e.jsx(v,{value:N,children:N},N))]})]}),e.jsxs(_,{value:f??"__unset__",onValueChange:N=>T(N==="__unset__"?null:N),disabled:o,children:[e.jsx(E,{children:e.jsx(P,{placeholder:"Use global effort"})}),e.jsxs(O,{children:[e.jsx(v,{value:"__unset__",children:"Use global effort"}),["minimal","low","medium","high","xhigh"].map(N=>e.jsx(v,{value:N,children:N},N))]})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(w,{variant:"outline",onClick:u,disabled:o||d||!i,children:[e.jsx(Z,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsx(w,{variant:"outline",onClick:h,disabled:o||d||!i||i===l,children:"Set active"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(w,{variant:"outline",onClick:()=>c(j,{model:g,modelProvider:U,modelReasoningEffort:f},!1),disabled:o||d||j.trim().length===0,children:[d?e.jsx(X,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save profile"]}),e.jsxs(w,{onClick:()=>c(j,{model:g,modelProvider:U,modelReasoningEffort:f},!0),disabled:o||d||j.trim().length===0,children:[d?e.jsx(X,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save + activate"]})]})]})]})}function Ls({activeProfile:s,entries:r,providerNames:t,disabled:a=!1,disabledReason:n,saving:l=!1,onSave:i,onDelete:o,onSetActive:d}){const[c,u]=b.useState("new"),h=b.useMemo(()=>r.find(x=>x.name===c)??null,[r,c]),j=JSON.stringify(h??{name:"",values:{}});return e.jsxs(H,{title:"Profiles",badge:"profiles",icon:e.jsx(es,{className:"h-4 w-4"}),description:"Create reusable Codex overlays and set the active default profile.",disabledReason:n,children:[e.jsxs(_,{value:c,onValueChange:u,disabled:a,children:[e.jsx(E,{children:e.jsx(P,{placeholder:"Select profile"})}),e.jsxs(O,{children:[e.jsx(v,{value:"new",children:"Create new profile"}),r.map(x=>e.jsxs(v,{value:x.name,children:[x.name,x.name===s?" (active)":""]},x.name))]})]}),e.jsx(Os,{initialName:h?.name??"",initialModel:h?.values.model??null,initialProvider:h?.values.modelProvider??null,initialEffort:h?.values.modelReasoningEffort??null,providerNames:t,activeProfile:s,selectedEntryName:h?.name??null,disabled:a,saving:l,onDelete:async()=>{h&&(await o(h.name),u("new"))},onSetActive:async()=>{h&&await d(h.name)},onSave:async(x,g,A)=>{await i(x,g,A),u(x)}},j)]})}function As({workspacePath:s,disabled:r,saving:t,onSave:a}){const[n,l]=b.useState(s),[i,o]=b.useState("trusted");return e.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_160px_auto]",children:[e.jsx(C,{value:n,onChange:d=>l(d.target.value),placeholder:"~/repo or /absolute/path",disabled:r}),e.jsxs(_,{value:i,onValueChange:o,disabled:r,children:[e.jsx(E,{children:e.jsx(P,{})}),e.jsxs(O,{children:[e.jsx(v,{value:"trusted",children:"trusted"}),e.jsx(v,{value:"untrusted",children:"untrusted"})]})]}),e.jsxs(w,{onClick:()=>a(n,i),disabled:r||t,children:[t?e.jsx(X,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save trust"]})]})}function Rs({workspacePath:s,entries:r,disabled:t=!1,disabledReason:a,saving:n=!1,onSave:l}){return e.jsxs(H,{title:"Project trust",badge:"projects",icon:e.jsx(ss,{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(As,{workspacePath:s,disabled:t,saving:n,onSave:l},s),e.jsx(w,{variant:"outline",className:"w-full justify-start",onClick:()=>l(s,"trusted"),disabled:t||n,children:"Trust current workspace"}),e.jsx("div",{className:"space-y-2",children:r.length===0?e.jsx("p",{className:"text-xs text-muted-foreground",children:"No explicit project trust entries saved."}):r.map(i=>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:i.path}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["trust_level = ",i.trustLevel]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(w,{variant:"ghost",size:"sm",onClick:()=>l(i.path,i.trustLevel==="trusted"?"untrusted":"trusted"),disabled:t||n,children:"Toggle"}),e.jsx(w,{variant:"ghost",size:"icon",onClick:()=>l(i.path,null),disabled:t||n,children:e.jsx(Z,{className:"h-4 w-4"})})]})]},i.path))})]})}const L="__unset__",Ds=105e4,Ms=272e3,Ce=8e5,ye=7e5,Is=new Intl.NumberFormat("en-US");function z(s){return s??L}function $(s,r){return r&&!s.includes(r)?[r,...s]:s}function ie(s){return Is.format(s)}function Fs(s){return s?.trim().toLowerCase().startsWith("gpt-5.4")??!1}function Us(s,r){const t={};return r.model!==s.model&&(t.model=r.model),r.modelReasoningEffort!==s.modelReasoningEffort&&(t.modelReasoningEffort=r.modelReasoningEffort),r.modelContextWindow!==s.modelContextWindow&&(t.modelContextWindow=r.modelContextWindow),r.modelAutoCompactTokenLimit!==s.modelAutoCompactTokenLimit&&(t.modelAutoCompactTokenLimit=r.modelAutoCompactTokenLimit),r.modelProvider!==s.modelProvider&&(t.modelProvider=r.modelProvider),r.approvalPolicy!==s.approvalPolicy&&(t.approvalPolicy=r.approvalPolicy),r.sandboxMode!==s.sandboxMode&&(t.sandboxMode=r.sandboxMode),r.webSearch!==s.webSearch&&(t.webSearch=r.webSearch),r.toolOutputTokenLimit!==s.toolOutputTokenLimit&&(t.toolOutputTokenLimit=r.toolOutputTokenLimit),r.personality!==s.personality&&(t.personality=r.personality),t}function Ws({initialValues:s,providerNames:r,disabled:t,saving:a,onSave:n}){const[l,i]=b.useState(s),o=$(["minimal","low","medium","high","xhigh"],l.modelReasoningEffort),d=$(r,l.modelProvider),c=$(["on-request","never","untrusted"],l.approvalPolicy),u=$(["read-only","workspace-write","danger-full-access"],l.sandboxMode),h=$(["cached","live","disabled"],l.webSearch),j=$(["none","friendly","pragmatic"],l.personality),x=Us(s,l),g=Object.keys(x).length>0,A=Fs(l.model),U=m=>{const f=m.trim();return f.length>0?Number(f):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:"Model"}),e.jsx(C,{value:l.model??"",onChange:m=>i(f=>({...f,model:m.target.value||null})),placeholder:"gpt-5.4",disabled:t})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Reasoning effort"}),e.jsxs(_,{value:z(l.modelReasoningEffort),onValueChange:m=>i(f=>({...f,modelReasoningEffort:m===L?null:m})),disabled:t,children:[e.jsx(E,{children:e.jsx(P,{placeholder:"Use default"})}),e.jsxs(O,{children:[e.jsx(v,{value:L,children:"Use default"}),o.map(m=>e.jsx(v,{value:m,children:m},m))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Default provider"}),e.jsxs(_,{value:z(l.modelProvider),onValueChange:m=>i(f=>({...f,modelProvider:m===L?null:m})),disabled:t,children:[e.jsx(E,{children:e.jsx(P,{placeholder:"Use Codex default"})}),e.jsxs(O,{children:[e.jsx(v,{value:L,children:"Use Codex default"}),d.map(m=>e.jsx(v,{value:m,children:m},m))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Approval policy"}),e.jsxs(_,{value:z(l.approvalPolicy),onValueChange:m=>i(f=>({...f,approvalPolicy:m===L?null:m})),disabled:t,children:[e.jsx(E,{children:e.jsx(P,{placeholder:"Use default"})}),e.jsxs(O,{children:[e.jsx(v,{value:L,children:"Use default"}),c.map(m=>e.jsx(v,{value:m,children:m},m))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Sandbox mode"}),e.jsxs(_,{value:z(l.sandboxMode),onValueChange:m=>i(f=>({...f,sandboxMode:m===L?null:m})),disabled:t,children:[e.jsx(E,{children:e.jsx(P,{placeholder:"Use default"})}),e.jsxs(O,{children:[e.jsx(v,{value:L,children:"Use default"}),u.map(m=>e.jsx(v,{value:m,children:m},m))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Web search"}),e.jsxs(_,{value:z(l.webSearch),onValueChange:m=>i(f=>({...f,webSearch:m===L?null:m})),disabled:t,children:[e.jsx(E,{children:e.jsx(P,{placeholder:"Use default"})}),e.jsxs(O,{children:[e.jsx(v,{value:L,children:"Use default"}),h.map(m=>e.jsx(v,{value:m,children:m},m))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Tool output token limit"}),e.jsx(C,{type:"number",min:1,value:l.toolOutputTokenLimit??"",onChange:m=>i(f=>({...f,toolOutputTokenLimit:m.target.value?Number(m.target.value):null})),placeholder:"25000",disabled:t})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Personality"}),e.jsxs(_,{value:z(l.personality),onValueChange:m=>i(f=>({...f,personality:m===L?null:m})),disabled:t,children:[e.jsx(E,{children:e.jsx(P,{placeholder:"Use default"})}),e.jsxs(O,{children:[e.jsx(v,{value:L,children:"Use default"}),j.map(m=>e.jsx(v,{value:m,children:m},m))]})]})]})]}),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(ts,{className:"h-4 w-4 text-amber-600 dark:text-amber-300"}),e.jsx("p",{className:"text-sm font-semibold",children:"Long context override"}),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:A?"GPT-5.4 selected":"GPT-5.4 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(w,{type:"button",variant:"outline",size:"sm",disabled:t,onClick:()=>i(m=>({...m,modelContextWindow:Ce,modelAutoCompactTokenLimit:ye})),children:"Fill cautious pair"}),e.jsx(w,{type:"button",variant:"outline",size:"sm",disabled:t,onClick:()=>i(m=>({...m,modelContextWindow:Ds})),children:"Set official max window"}),e.jsx(w,{type:"button",variant:"ghost",size:"sm",disabled:t,onClick:()=>i(m=>({...m,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:"GPT-5.4 context cap"})]}),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:ie(Ms)}),e.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:"Normal usage window"})]}),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:"Counts 2x"}),e.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:"Usage-limit cost above 272K"})]})]}),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 ",ie(Ce)]}),e.jsxs("div",{className:"rounded-full border bg-background px-2.5 py-1 font-mono text-[11px] font-medium",children:["Auto-compact ",ie(ye)]})]}),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:"Quick-fill only. Review before saving."}),!A&&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:"Model context window"}),e.jsx(C,{"aria-label":"Model context window",type:"number",min:1,value:l.modelContextWindow??"",onChange:m=>i(f=>({...f,modelContextWindow:U(m.target.value)})),placeholder:"Unset",disabled:t}),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:"Auto-compact token limit"}),e.jsx(C,{"aria-label":"Auto-compact token limit",type:"number",min:1,value:l.modelAutoCompactTokenLimit??"",onChange:m=>i(f=>({...f,modelAutoCompactTokenLimit:U(m.target.value)})),placeholder:"Unset",disabled:t}),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://developers.openai.com/api/docs/models/gpt-5.4",target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:"GPT-5.4 model page"}),e.jsx("a",{href:"https://openai.com/index/introducing-gpt-5-4/",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(w,{onClick:()=>n(x),disabled:t||a||!g,children:[a?e.jsx(X,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save top-level settings"]})})]})}function Ks({values:s,providerNames:r,disabled:t=!1,disabledReason:a,saving:n=!1,onSave:l}){return e.jsx(H,{title:"Top-level controls",badge:"config.toml",icon:e.jsx(rs,{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(Ws,{initialValues:s,providerNames:r,disabled:t,saving:n,onSave:l},JSON.stringify(s))})}function qs({workspacePath:s,activeProfile:r,topLevelSettings:t,projectTrustEntries:a,profileEntries:n,modelProviderEntries:l,mcpServerEntries:i,featureCatalog:o,featureState:d,disabled:c,disabledReason:u,saving:h,onPatch:j}){return e.jsx(xe,{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(ns,{className:"h-4 w-4"})}),e.jsx("div",{children:e.jsx("h2",{className:"text-base font-semibold tracking-tight text-foreground",children:"Structured controls boundary"})})]}),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(as,{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(ls,{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(os,{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(Ks,{values:t,providerNames:l.map(x=>x.name),disabled:c,disabledReason:u,saving:h,onSave:x=>j({kind:"top-level",values:x},"Saved top-level Codex settings.")}),e.jsx(Rs,{workspacePath:s,entries:a,disabled:c,disabledReason:u,saving:h,onSave:(x,g)=>j({kind:"project-trust",path:x,trustLevel:g},g?"Saved project trust entry.":"Removed project trust entry.")}),e.jsx(Ls,{activeProfile:r,entries:n,providerNames:l.map(x=>x.name),disabled:c,disabledReason:u,saving:h,onSave:(x,g,A)=>j({kind:"profile",action:"upsert",name:x,values:g,setAsActive:A},"Saved profile."),onDelete:x=>j({kind:"profile",action:"delete",name:x},"Deleted profile."),onSetActive:x=>j({kind:"profile",action:"set-active",name:x},"Set active profile.")}),e.jsx(Ps,{entries:l,disabled:c,disabledReason:u,saving:h,onSave:(x,g)=>j({kind:"model-provider",action:"upsert",name:x,values:g},"Saved model provider."),onDelete:x=>j({kind:"model-provider",action:"delete",name:x},"Deleted model provider.")}),e.jsx(ks,{entries:i,disabled:c,disabledReason:u,saving:h,onSave:(x,g)=>j({kind:"mcp-server",action:"upsert",name:x,values:g},"Saved MCP server."),onDelete:x=>j({kind:"mcp-server",action:"delete",name:x},"Deleted MCP server.")}),e.jsx(Cs,{catalog:o,state:d,disabled:c,disabledReason:u,onToggle:(x,g)=>j({kind:"feature",feature:x,enabled:g},"Saved feature toggle.")})]})})}const Ee=`model_provider = "cliproxy"
2
2
 
3
3
  [model_providers.cliproxy]
4
4
  base_url = "http://127.0.0.1:8317/api/provider/codex"
5
5
  env_key = "CLIPROXY_API_KEY"
6
- wire_api = "responses"`,Pe=[{name:"multi_agent",label:"Multi-agent",description:"Enable subagent collaboration tools."},{name:"unified_exec",label:"Unified exec",description:"Use the PTY-backed unified exec tool."},{name:"shell_snapshot",label:"Shell snapshot",description:"Reuse shell environment snapshots."},{name:"apply_patch_freeform",label:"Apply patch",description:"Enable freeform apply_patch edits."},{name:"js_repl",label:"JS REPL",description:"Enable the Node-backed JavaScript REPL."},{name:"runtime_metrics",label:"Runtime metrics",description:"Collect Codex runtime metrics."},{name:"prevent_idle_sleep",label:"Prevent idle sleep",description:"Keep the machine awake while active."},{name:"fast_mode",label:"Fast mode",description:"Allow the fast service tier path."},{name:"apps",label:"Apps",description:"Enable ChatGPT Apps and connectors support."},{name:"smart_approvals",label:"Smart approvals",description:"Route eligible approvals through the guardian flow."}];function q(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)?s:null}function k(s){return typeof s=="string"&&s.trim().length>0?s.trim():null}function Y(s){return typeof s=="number"&&Number.isFinite(s)?s:null}function ce(s){return Array.isArray(s)?s.filter(r=>typeof r=="string").map(r=>r.trim()):[]}function Oe(s){return{model:k(s?.model),modelReasoningEffort:k(s?.model_reasoning_effort),modelContextWindow:Y(s?.model_context_window),modelAutoCompactTokenLimit:Y(s?.model_auto_compact_token_limit),modelProvider:k(s?.model_provider),approvalPolicy:k(s?.approval_policy),sandboxMode:k(s?.sandbox_mode),webSearch:k(s?.web_search),toolOutputTokenLimit:Y(s?.tool_output_token_limit),personality:k(s?.personality)}}function Vs(s){const r=q(s?.projects);return r?Object.entries(r).map(([t,a])=>{const n=k(q(a)?.trust_level);return n?{path:t,trustLevel:n}:null}).filter(t=>t!==null).sort((t,a)=>t.path.localeCompare(a.path)):[]}function zs(s){const r=q(s?.profiles);return r?Object.entries(r).map(([t,a])=>({name:t,values:Oe(q(a))})).sort((t,a)=>t.name.localeCompare(a.name)):[]}function Xs(s){const r=q(s?.model_providers);return r?Object.entries(r).map(([t,a])=>{const n=q(a);return n?{name:t,displayName:k(n.name),baseUrl:k(n.base_url),envKey:k(n.env_key),wireApi:k(n.wire_api),requiresOpenaiAuth:n.requires_openai_auth===!0,supportsWebsockets:n.supports_websockets===!0}:null}).filter(t=>t!==null).sort((t,a)=>t.name.localeCompare(a.name)):[]}function Gs(s){const r=q(s?.mcp_servers);return r?Object.entries(r).map(([t,a])=>{const n=q(a);if(!n)return null;const l=k(n.command)?"stdio":"streamable-http",i=Y(n.startup_timeout_ms);return{name:t,transport:l,command:k(n.command),args:ce(n.args),url:k(n.url),enabled:n.enabled!==!1,required:n.required===!0,startupTimeoutSec:Y(n.startup_timeout_sec)??(i!==null?i/1e3:null),toolTimeoutSec:Y(n.tool_timeout_sec),enabledTools:ce(n.enabled_tools),disabledTools:ce(n.disabled_tools)}}).filter(t=>t!==null).sort((t,a)=>t.name.localeCompare(a.name)):[]}function $s(s){const r=q(s?.features),t={};for(const a of Pe){const n=r?.[a.name];t[a.name]=typeof n=="boolean"?n:null}if(r)for(const[a,n]of Object.entries(r))a in t||(t[a]=typeof n=="boolean"?n:null);return t}const Ys=[{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."}],Bs=[{provider:"openai",label:"OpenAI Responses API",apiFormat:"Responses API",url:"https://platform.openai.com/docs/api-reference/responses"}];function Hs(s){const r=/https?:\/\/[^\s)]+/g,t=[];let a=0,n;for(;(n=r.exec(s))!==null;){const[l]=n,i=n.index;i>a&&t.push(s.slice(a,i)),t.push(e.jsx("a",{href:l,target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:l},`${l}-${i}`)),a=i+l.length}return a<s.length&&t.push(s.slice(a)),t.length>0?t:[s]}function Qs({diagnostics:s}){const r=s.docsReference??{notes:[],links:[],providerDocs:[],providerValues:[],settingsHierarchy:[]},t=r.links.length>0?r.links:Ys,a=r.providerDocs.length>0?r.providerDocs:Bs;return e.jsx(xe,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 pr-1",children:[e.jsxs(D,{children:[e.jsx(M,{className:"pb-2",children:e.jsxs(I,{className:"flex items-center gap-2 text-base",children:[e.jsx(de,{className:"h-4 w-4"}),"CCS bridge recipe"]})}),e.jsxs(F,{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:"Built-in:"})," Use ",e.jsx("code",{children:"ccsxp"})," for the CCS provider shortcut."]}),e.jsxs("p",{children:[e.jsx("strong",{children:"Native:"})," Configure the recipe below to use CLIProxy directly with"," ",e.jsx("code",{children:"codex"}),"."]})]}),e.jsx("pre",{className:"overflow-x-auto rounded-md border bg-muted/20 p-3 text-xs text-foreground",children:Ee}),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(D,{children:[e.jsx(M,{className:"pb-2",children:e.jsxs(I,{className:"flex items-center gap-2 text-base",children:[e.jsx(de,{className:"h-4 w-4"}),"Upstream notes"]})}),e.jsxs(F,{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:Hs(n)},`${l}-${n}`))}),e.jsx(Q,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:"Codex docs"}),e.jsx("div",{className:"space-y-1.5",children:t.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(ge,{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(Q,{}),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: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(ge,{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(Q,{}),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 Js(s,r){let t=s.slice(0,r).split(/\r\n|\n|\r/g);return[t.length,t.pop().length+1]}function Zs(s,r,t){let a=s.split(/\r\n|\n|\r/g),n="",l=(Math.log10(r+1)|0)+1;for(let i=r-1;i<=r+1;i++){let o=a[i-1];o&&(n+=i.toString().padEnd(l," "),n+=": ",n+=o,n+=`
6
+ wire_api = "responses"`,Pe=[{name:"multi_agent",label:"Multi-agent",description:"Enable subagent collaboration tools."},{name:"unified_exec",label:"Unified exec",description:"Use the PTY-backed unified exec tool."},{name:"shell_snapshot",label:"Shell snapshot",description:"Reuse shell environment snapshots."},{name:"apply_patch_freeform",label:"Apply patch",description:"Enable freeform apply_patch edits."},{name:"js_repl",label:"JS REPL",description:"Enable the Node-backed JavaScript REPL."},{name:"runtime_metrics",label:"Runtime metrics",description:"Collect Codex runtime metrics."},{name:"prevent_idle_sleep",label:"Prevent idle sleep",description:"Keep the machine awake while active."},{name:"fast_mode",label:"Fast mode",description:"Allow the fast service tier path."},{name:"apps",label:"Apps",description:"Enable ChatGPT Apps and connectors support."},{name:"smart_approvals",label:"Smart approvals",description:"Route eligible approvals through the guardian flow."}];function q(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)?s:null}function k(s){return typeof s=="string"&&s.trim().length>0?s.trim():null}function Y(s){return typeof s=="number"&&Number.isFinite(s)?s:null}function ce(s){return Array.isArray(s)?s.filter(r=>typeof r=="string").map(r=>r.trim()):[]}function Oe(s){return{model:k(s?.model),modelReasoningEffort:k(s?.model_reasoning_effort),modelContextWindow:Y(s?.model_context_window),modelAutoCompactTokenLimit:Y(s?.model_auto_compact_token_limit),modelProvider:k(s?.model_provider),approvalPolicy:k(s?.approval_policy),sandboxMode:k(s?.sandbox_mode),webSearch:k(s?.web_search),toolOutputTokenLimit:Y(s?.tool_output_token_limit),personality:k(s?.personality)}}function Vs(s){const r=q(s?.projects);return r?Object.entries(r).map(([t,a])=>{const n=k(q(a)?.trust_level);return n?{path:t,trustLevel:n}:null}).filter(t=>t!==null).sort((t,a)=>t.path.localeCompare(a.path)):[]}function Xs(s){const r=q(s?.profiles);return r?Object.entries(r).map(([t,a])=>({name:t,values:Oe(q(a))})).sort((t,a)=>t.name.localeCompare(a.name)):[]}function zs(s){const r=q(s?.model_providers);return r?Object.entries(r).map(([t,a])=>{const n=q(a);return n?{name:t,displayName:k(n.name),baseUrl:k(n.base_url),envKey:k(n.env_key),wireApi:k(n.wire_api),requiresOpenaiAuth:n.requires_openai_auth===!0,supportsWebsockets:n.supports_websockets===!0}:null}).filter(t=>t!==null).sort((t,a)=>t.name.localeCompare(a.name)):[]}function $s(s){const r=q(s?.mcp_servers);return r?Object.entries(r).map(([t,a])=>{const n=q(a);if(!n)return null;const l=k(n.command)?"stdio":"streamable-http",i=Y(n.startup_timeout_ms);return{name:t,transport:l,command:k(n.command),args:ce(n.args),url:k(n.url),enabled:n.enabled!==!1,required:n.required===!0,startupTimeoutSec:Y(n.startup_timeout_sec)??(i!==null?i/1e3:null),toolTimeoutSec:Y(n.tool_timeout_sec),enabledTools:ce(n.enabled_tools),disabledTools:ce(n.disabled_tools)}}).filter(t=>t!==null).sort((t,a)=>t.name.localeCompare(a.name)):[]}function Gs(s){const r=q(s?.features),t={};for(const a of Pe){const n=r?.[a.name];t[a.name]=typeof n=="boolean"?n:null}if(r)for(const[a,n]of Object.entries(r))a in t||(t[a]=typeof n=="boolean"?n:null);return t}const Ys=[{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."}],Bs=[{provider:"openai",label:"OpenAI Responses API",apiFormat:"Responses API",url:"https://platform.openai.com/docs/api-reference/responses"}];function Hs(s){const r=/https?:\/\/[^\s)]+/g,t=[];let a=0,n;for(;(n=r.exec(s))!==null;){const[l]=n,i=n.index;i>a&&t.push(s.slice(a,i)),t.push(e.jsx("a",{href:l,target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:l},`${l}-${i}`)),a=i+l.length}return a<s.length&&t.push(s.slice(a)),t.length>0?t:[s]}function Qs({diagnostics:s}){const r=s.docsReference??{notes:[],links:[],providerDocs:[],providerValues:[],settingsHierarchy:[]},t=r.links.length>0?r.links:Ys,a=r.providerDocs.length>0?r.providerDocs:Bs;return e.jsx(xe,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 pr-1",children:[e.jsxs(D,{children:[e.jsx(M,{className:"pb-2",children:e.jsxs(I,{className:"flex items-center gap-2 text-base",children:[e.jsx(de,{className:"h-4 w-4"}),"CCS bridge recipe"]})}),e.jsxs(F,{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:"Built-in:"})," Use ",e.jsx("code",{children:"ccsxp"})," for the CCS provider shortcut."]}),e.jsxs("p",{children:[e.jsx("strong",{children:"Native:"})," Configure the recipe below to use CLIProxy directly with"," ",e.jsx("code",{children:"codex"}),"."]})]}),e.jsx("pre",{className:"overflow-x-auto rounded-md border bg-muted/20 p-3 text-xs text-foreground",children:Ee}),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(D,{children:[e.jsx(M,{className:"pb-2",children:e.jsxs(I,{className:"flex items-center gap-2 text-base",children:[e.jsx(de,{className:"h-4 w-4"}),"Upstream notes"]})}),e.jsxs(F,{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:Hs(n)},`${l}-${n}`))}),e.jsx(Q,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:"Codex docs"}),e.jsx("div",{className:"space-y-1.5",children:t.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(ge,{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(Q,{}),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: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(ge,{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(Q,{}),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 Js(s,r){let t=s.slice(0,r).split(/\r\n|\n|\r/g);return[t.length,t.pop().length+1]}function Zs(s,r,t){let a=s.split(/\r\n|\n|\r/g),n="",l=(Math.log10(r+1)|0)+1;for(let i=r-1;i<=r+1;i++){let o=a[i-1];o&&(n+=i.toString().padEnd(l," "),n+=": ",n+=o,n+=`
7
7
  `,i===r&&(n+=" ".repeat(l+t+2),n+=`^
8
8
  `))}return n}class p extends Error{line;column;codeblock;constructor(r,t){const[a,n]=Js(t.toml,t.ptr),l=Zs(t.toml,a,n);super(`Invalid TOML document: ${r}
9
9
 
10
10
  ${l}`,t),this.line=a,this.column=n,this.codeblock=l}}function er(s,r){let t=0;for(;s[r-++t]==="\\";);return--t&&t%2}function ue(s,r=0,t=s.length){let a=s.indexOf(`
11
11
  `,r);return s[a-1]==="\r"&&a--,a<=t?a:-1}function ee(s,r){for(let t=r;t<s.length;t++){let a=s[t];if(a===`
12
12
  `)return t;if(a==="\r"&&s[t+1]===`
13
- `)return t+1;if(a<" "&&a!==" "||a==="")throw new p("control characters are not allowed in comments",{toml:s,ptr:r})}return s.length}function W(s,r,t,a){let n;for(;;){for(;(n=s[r])===" "||n===" "||!t&&(n===`
13
+ `)return t+1;if(a<" "&&a!==" "||a==="")throw new p("control characters are not allowed in comments",{toml:s,ptr:r})}return s.length}function K(s,r,t,a){let n;for(;;){for(;(n=s[r])===" "||n===" "||!t&&(n===`
14
14
  `||n==="\r"&&s[r+1]===`
15
15
  `);)r++;if(a||n!=="#")break;r=ee(s,r)}return r}function sr(s,r,t,a,n=!1){if(!a)return r=ue(s,r),r<0?s.length:r;for(let l=r;l<s.length;l++){let i=s[l];if(i==="#")l=ue(s,l);else{if(i===t)return l+1;if(i===a||n&&(i===`
16
16
  `||i==="\r"&&s[l+1]===`
17
- `))return l}}throw new p("cannot find end of structure",{toml:s,ptr:r})}function Le(s,r){let t=s[r],a=t===s[r+1]&&s[r+1]===s[r+2]?s.slice(r,r+3):t;r+=a.length-1;do r=s.indexOf(a,++r);while(r>-1&&t!=="'"&&er(s,r));return r>-1&&(r+=a.length,a.length>1&&(s[r]===t&&r++,s[r]===t&&r++)),r}let rr=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;class $ extends Date{#s=!1;#r=!1;#e=null;constructor(r){let t=!0,a=!0,n="Z";if(typeof r=="string"){let l=r.match(rr);l?(l[1]||(t=!1,r=`0000-01-01T${r}`),a=!!l[2],a&&r[10]===" "&&(r=r.replace(" ","T")),l[2]&&+l[2]>23?r="":(n=l[3]||null,r=r.toUpperCase(),!n&&a&&(r+="Z"))):r=""}super(r),isNaN(this.getTime())||(this.#s=t,this.#r=a,this.#e=n)}isDateTime(){return this.#s&&this.#r}isLocal(){return!this.#s||!this.#r||!this.#e}isDate(){return this.#s&&!this.#r}isTime(){return this.#r&&!this.#s}isValid(){return this.#s||this.#r}toISOString(){let r=super.toISOString();if(this.isDate())return r.slice(0,10);if(this.isTime())return r.slice(11,23);if(this.#e===null)return r.slice(0,-1);if(this.#e==="Z")return r;let t=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return t=this.#e[0]==="-"?t:-t,new Date(this.getTime()-t*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(r,t="Z"){let a=new $(r);return a.#e=t,a}static wrapAsLocalDateTime(r){let t=new $(r);return t.#e=null,t}static wrapAsLocalDate(r){let t=new $(r);return t.#r=!1,t.#e=null,t}static wrapAsLocalTime(r){let t=new $(r);return t.#s=!1,t.#e=null,t}}let tr=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,nr=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,ar=/^[+-]?0[0-9_]/,lr=/^[0-9a-f]{2,8}$/i,Se={b:"\b",t:" ",n:`
17
+ `))return l}}throw new p("cannot find end of structure",{toml:s,ptr:r})}function Le(s,r){let t=s[r],a=t===s[r+1]&&s[r+1]===s[r+2]?s.slice(r,r+3):t;r+=a.length-1;do r=s.indexOf(a,++r);while(r>-1&&t!=="'"&&er(s,r));return r>-1&&(r+=a.length,a.length>1&&(s[r]===t&&r++,s[r]===t&&r++)),r}let rr=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;class G extends Date{#s=!1;#r=!1;#e=null;constructor(r){let t=!0,a=!0,n="Z";if(typeof r=="string"){let l=r.match(rr);l?(l[1]||(t=!1,r=`0000-01-01T${r}`),a=!!l[2],a&&r[10]===" "&&(r=r.replace(" ","T")),l[2]&&+l[2]>23?r="":(n=l[3]||null,r=r.toUpperCase(),!n&&a&&(r+="Z"))):r=""}super(r),isNaN(this.getTime())||(this.#s=t,this.#r=a,this.#e=n)}isDateTime(){return this.#s&&this.#r}isLocal(){return!this.#s||!this.#r||!this.#e}isDate(){return this.#s&&!this.#r}isTime(){return this.#r&&!this.#s}isValid(){return this.#s||this.#r}toISOString(){let r=super.toISOString();if(this.isDate())return r.slice(0,10);if(this.isTime())return r.slice(11,23);if(this.#e===null)return r.slice(0,-1);if(this.#e==="Z")return r;let t=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return t=this.#e[0]==="-"?t:-t,new Date(this.getTime()-t*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(r,t="Z"){let a=new G(r);return a.#e=t,a}static wrapAsLocalDateTime(r){let t=new G(r);return t.#e=null,t}static wrapAsLocalDate(r){let t=new G(r);return t.#r=!1,t.#e=null,t}static wrapAsLocalTime(r){let t=new G(r);return t.#s=!1,t.#e=null,t}}let tr=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,nr=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,ar=/^[+-]?0[0-9_]/,lr=/^[0-9a-f]{2,8}$/i,Se={b:"\b",t:" ",n:`
18
18
  `,f:"\f",r:"\r",e:"\x1B",'"':'"',"\\":"\\"};function Ae(s,r=0,t=s.length){let a=s[r]==="'",n=s[r++]===s[r]&&s[r]===s[r+1];n&&(t-=2,s[r+=2]==="\r"&&r++,s[r]===`
19
19
  `&&r++);let l=0,i,o="",d=r;for(;r<t-1;){let c=s[r++];if(c===`
20
20
  `||c==="\r"&&s[r]===`
21
21
  `){if(!n)throw new p("newlines are not allowed in strings",{toml:s,ptr:r-1})}else if(c<" "&&c!==" "||c==="")throw new p("control characters are not allowed in strings",{toml:s,ptr:r-1});if(i){if(i=!1,c==="x"||c==="u"||c==="U"){let u=s.slice(r,r+=c==="x"?2:c==="u"?4:8);if(!lr.test(u))throw new p("invalid unicode escape",{toml:s,ptr:l});try{o+=String.fromCodePoint(parseInt(u,16))}catch{throw new p("invalid unicode escape",{toml:s,ptr:l})}}else if(n&&(c===`
22
- `||c===" "||c===" "||c==="\r")){if(r=W(s,r-1,!0),s[r]!==`
23
- `&&s[r]!=="\r")throw new p("invalid escape: only line-ending whitespace may be escaped",{toml:s,ptr:l});r=W(s,r)}else if(c in Se)o+=Se[c];else throw new p("unrecognized escape sequence",{toml:s,ptr:l});d=r}else!a&&c==="\\"&&(l=r-1,i=!0,o+=s.slice(d,l))}return o+s.slice(d,t-1)}function or(s,r,t,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 n=tr.test(s);if(n||nr.test(s)){if(ar.test(s))throw new p("leading zeroes are not allowed",{toml:r,ptr:t});s=s.replace(/_/g,"");let i=+s;if(isNaN(i))throw new p("invalid number",{toml:r,ptr:t});if(n){if((n=!Number.isSafeInteger(i))&&!a)throw new p("integer value cannot be represented losslessly",{toml:r,ptr:t});(n||a===!0)&&(i=BigInt(s))}return i}const l=new $(s);if(!l.isValid())throw new p("invalid value",{toml:r,ptr:t});return l}function ir(s,r,t){let a=s.slice(r,t),n=a.indexOf("#");return n>-1&&(ee(s,n),a=a.slice(0,n)),[a.trimEnd(),n]}function he(s,r,t,a,n){if(a===0)throw new p("document contains excessively nested structures. aborting.",{toml:s,ptr:r});let l=s[r];if(l==="["||l==="{"){let[d,c]=l==="["?ur(s,r,a,n):dr(s,r,a,n);if(t){if(c=W(s,c),s[c]===",")c++;else if(s[c]!==t)throw new p("expected comma or end of structure",{toml:s,ptr:c})}return[d,c]}let i;if(l==='"'||l==="'"){i=Le(s,r);let d=Ae(s,r,i);if(t){if(i=W(s,i),s[i]&&s[i]!==","&&s[i]!==t&&s[i]!==`
24
- `&&s[i]!=="\r")throw new p("unexpected character encountered",{toml:s,ptr:i});i+=+(s[i]===",")}return[d,i]}i=sr(s,r,",",t);let o=ir(s,r,i-+(s[i-1]===","));if(!o[0])throw new p("incomplete key-value declaration: no value specified",{toml:s,ptr:r});return t&&o[1]>-1&&(i=W(s,r+o[1]),i+=+(s[i]===",")),[or(o[0],s,r,n),i]}let cr=/^[a-zA-Z0-9-_]+[ \t]*$/;function me(s,r,t="="){let a=r-1,n=[],l=s.indexOf(t,r);if(l<0)throw new p("incomplete key-value: cannot find end of key",{toml:s,ptr:r});do{let i=s[r=++a];if(i!==" "&&i!==" ")if(i==='"'||i==="'"){if(i===s[r+1]&&i===s[r+2])throw new p("multiline strings are not allowed in keys",{toml:s,ptr:r});let o=Le(s,r);if(o<0)throw new p("unfinished string encountered",{toml:s,ptr:r});a=s.indexOf(".",o);let d=s.slice(o,a<0||a>l?l:a),c=ue(d);if(c>-1)throw new p("newlines are not allowed in keys",{toml:s,ptr:r+a+c});if(d.trimStart())throw new p("found extra tokens after the string part",{toml:s,ptr:o});if(l<o&&(l=s.indexOf(t,o),l<0))throw new p("incomplete key-value: cannot find end of key",{toml:s,ptr:r});n.push(Ae(s,r,o))}else{a=s.indexOf(".",r);let o=s.slice(r,a<0||a>l?l:a);if(!cr.test(o))throw new p("only letter, numbers, dashes and underscores are allowed in keys",{toml:s,ptr:r});n.push(o.trimEnd())}}while(a+1&&a<l);return[n,W(s,l+1,!0,!0)]}function dr(s,r,t,a){let n={},l=new Set,i;for(r++;(i=s[r++])!=="}"&&i;){if(i===",")throw new p("expected value, found comma",{toml:s,ptr:r-1});if(i==="#")r=ee(s,r);else if(i!==" "&&i!==" "&&i!==`
22
+ `||c===" "||c===" "||c==="\r")){if(r=K(s,r-1,!0),s[r]!==`
23
+ `&&s[r]!=="\r")throw new p("invalid escape: only line-ending whitespace may be escaped",{toml:s,ptr:l});r=K(s,r)}else if(c in Se)o+=Se[c];else throw new p("unrecognized escape sequence",{toml:s,ptr:l});d=r}else!a&&c==="\\"&&(l=r-1,i=!0,o+=s.slice(d,l))}return o+s.slice(d,t-1)}function or(s,r,t,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 n=tr.test(s);if(n||nr.test(s)){if(ar.test(s))throw new p("leading zeroes are not allowed",{toml:r,ptr:t});s=s.replace(/_/g,"");let i=+s;if(isNaN(i))throw new p("invalid number",{toml:r,ptr:t});if(n){if((n=!Number.isSafeInteger(i))&&!a)throw new p("integer value cannot be represented losslessly",{toml:r,ptr:t});(n||a===!0)&&(i=BigInt(s))}return i}const l=new G(s);if(!l.isValid())throw new p("invalid value",{toml:r,ptr:t});return l}function ir(s,r,t){let a=s.slice(r,t),n=a.indexOf("#");return n>-1&&(ee(s,n),a=a.slice(0,n)),[a.trimEnd(),n]}function he(s,r,t,a,n){if(a===0)throw new p("document contains excessively nested structures. aborting.",{toml:s,ptr:r});let l=s[r];if(l==="["||l==="{"){let[d,c]=l==="["?ur(s,r,a,n):dr(s,r,a,n);if(t){if(c=K(s,c),s[c]===",")c++;else if(s[c]!==t)throw new p("expected comma or end of structure",{toml:s,ptr:c})}return[d,c]}let i;if(l==='"'||l==="'"){i=Le(s,r);let d=Ae(s,r,i);if(t){if(i=K(s,i),s[i]&&s[i]!==","&&s[i]!==t&&s[i]!==`
24
+ `&&s[i]!=="\r")throw new p("unexpected character encountered",{toml:s,ptr:i});i+=+(s[i]===",")}return[d,i]}i=sr(s,r,",",t);let o=ir(s,r,i-+(s[i-1]===","));if(!o[0])throw new p("incomplete key-value declaration: no value specified",{toml:s,ptr:r});return t&&o[1]>-1&&(i=K(s,r+o[1]),i+=+(s[i]===",")),[or(o[0],s,r,n),i]}let cr=/^[a-zA-Z0-9-_]+[ \t]*$/;function me(s,r,t="="){let a=r-1,n=[],l=s.indexOf(t,r);if(l<0)throw new p("incomplete key-value: cannot find end of key",{toml:s,ptr:r});do{let i=s[r=++a];if(i!==" "&&i!==" ")if(i==='"'||i==="'"){if(i===s[r+1]&&i===s[r+2])throw new p("multiline strings are not allowed in keys",{toml:s,ptr:r});let o=Le(s,r);if(o<0)throw new p("unfinished string encountered",{toml:s,ptr:r});a=s.indexOf(".",o);let d=s.slice(o,a<0||a>l?l:a),c=ue(d);if(c>-1)throw new p("newlines are not allowed in keys",{toml:s,ptr:r+a+c});if(d.trimStart())throw new p("found extra tokens after the string part",{toml:s,ptr:o});if(l<o&&(l=s.indexOf(t,o),l<0))throw new p("incomplete key-value: cannot find end of key",{toml:s,ptr:r});n.push(Ae(s,r,o))}else{a=s.indexOf(".",r);let o=s.slice(r,a<0||a>l?l:a);if(!cr.test(o))throw new p("only letter, numbers, dashes and underscores are allowed in keys",{toml:s,ptr:r});n.push(o.trimEnd())}}while(a+1&&a<l);return[n,K(s,l+1,!0,!0)]}function dr(s,r,t,a){let n={},l=new Set,i;for(r++;(i=s[r++])!=="}"&&i;){if(i===",")throw new p("expected value, found comma",{toml:s,ptr:r-1});if(i==="#")r=ee(s,r);else if(i!==" "&&i!==" "&&i!==`
25
25
  `&&i!=="\r"){let o,d=n,c=!1,[u,h]=me(s,r-1);for(let g=0;g<u.length;g++){if(g&&(d=c?d[o]:d[o]={}),o=u[g],(c=Object.hasOwn(d,o))&&(typeof d[o]!="object"||l.has(d[o])))throw new p("trying to redefine an already defined value",{toml:s,ptr:r});!c&&o==="__proto__"&&Object.defineProperty(d,o,{enumerable:!0,configurable:!0,writable:!0})}if(c)throw new p("trying to redefine an already defined value",{toml:s,ptr:r});let[j,x]=he(s,h,"}",t-1,a);l.add(j),d[o]=j,r=x}}if(!i)throw new p("unfinished table encountered",{toml:s,ptr:r});return[n,r]}function ur(s,r,t,a){let n=[],l;for(r++;(l=s[r++])!=="]"&&l;){if(l===",")throw new p("expected value, found comma",{toml:s,ptr:r-1});if(l==="#")r=ee(s,r);else if(l!==" "&&l!==" "&&l!==`
26
- `&&l!=="\r"){let i=he(s,r-1,"]",t-1,a);n.push(i[0]),r=i[1]}}if(!l)throw new p("unfinished array encountered",{toml:s,ptr:r});return[n,r]}function ke(s,r,t,a){let n=r,l=t,i,o=!1,d;for(let c=0;c<s.length;c++){if(c){if(n=o?n[i]:n[i]={},l=(d=l[i]).c,a===0&&(d.t===1||d.t===2))return null;if(d.t===2){let u=n.length-1;n=n[u],l=l[u].c}}if(i=s[c],(o=Object.hasOwn(n,i))&&l[i]?.t===0&&l[i]?.d)return null;o||(i==="__proto__"&&(Object.defineProperty(n,i,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(l,i,{enumerable:!0,configurable:!0,writable:!0})),l[i]={t:c<s.length-1&&a===2?3:a,d:!1,i:0,c:{}})}if(d=l[i],d.t!==a&&!(a===1&&d.t===3)||(a===2&&(d.d||(d.d=!0,n[i]=[]),n[i].push(n={}),d.c[d.i++]=d={t:1,d:!1,i:0,c:{}}),d.d))return null;if(d.d=!0,a===1)n=o?n[i]:n[i]={};else if(a===0&&o)return null;return[i,n,d.c]}function mr(s,{maxDepth:r=1e3,integersAsBigInt:t}={}){let a={},n={},l=a,i=n;for(let o=W(s,0);o<s.length;){if(s[o]==="["){let d=s[++o]==="[",c=me(s,o+=+d,"]");if(d){if(s[c[1]-1]!=="]")throw new p("expected end of table declaration",{toml:s,ptr:c[1]-1});c[1]++}let u=ke(c[0],a,n,d?2:1);if(!u)throw new p("trying to redefine an already defined table or value",{toml:s,ptr:o});i=u[2],l=u[1],o=c[1]}else{let d=me(s,o),c=ke(d[0],l,i,0);if(!c)throw new p("trying to redefine an already defined table or value",{toml:s,ptr:o});let u=he(s,d[1],void 0,r,t);c[1][c[0]]=u[0],o=u[1]}if(o=W(s,o,!0),s[o]&&s[o]!==`
27
- `&&s[o]!=="\r")throw new p("each key-value declaration must be followed by an end-of-line",{toml:s,ptr:o});o=W(s,o)}return a}function xr(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)}function hr(s){if(!s.trim())return{};const t=mr(s);if(!xr(t))throw new Error("TOML root must be a table.");return t}function Re(s){try{return{config:hr(s),parseError:null}}catch(r){return{config:null,parseError:r.message}}}async function pr(){const s=await fetch(J("/codex/diagnostics"));if(!s.ok)throw new Error("Failed to fetch Codex diagnostics");return s.json()}async function fr(){const s=await fetch(J("/codex/config/raw"));if(!s.ok)throw new Error("Failed to fetch Codex raw config");return s.json()}async function jr(s){const r=await fetch(J("/codex/config/raw"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(r.status===409)throw new Te("Codex raw config changed externally");if(!r.ok){const t=await r.json().catch(()=>null);throw new Error(t?.error||"Failed to save Codex raw config")}return r.json()}async function gr(s){const r=await fetch(J("/codex/config/patch"),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(r.status===409)throw new Te("Codex config changed externally");if(!r.ok){const t=await r.json().catch(()=>null);throw new Error(t?.error||"Failed to patch Codex config")}return r.json()}function vr(){const s=gs(),r=be({queryKey:["codex-diagnostics"],queryFn:pr,refetchInterval:1e4}),t=be({queryKey:["codex-raw-config"],queryFn:fr}),a=we({mutationFn:jr,onSuccess:(l,i)=>{s.setQueryData(["codex-raw-config"],o=>{const d=o?.path??"$CODEX_HOME/config.toml",c=o?.resolvedPath??d,u=Re(i.rawText);return{path:d,resolvedPath:c,exists:!0,mtime:l.mtime,rawText:i.rawText,config:u.config,parseError:u.parseError,readError:null}}),s.invalidateQueries({queryKey:["codex-diagnostics"]})}}),n=we({mutationFn:gr,onSuccess:l=>{s.setQueryData(["codex-raw-config"],l),s.invalidateQueries({queryKey:["codex-diagnostics"]})}});return b.useMemo(()=>({diagnostics:r.data,diagnosticsLoading:r.isLoading,diagnosticsError:r.error,refetchDiagnostics:r.refetch,rawConfig:t.data,rawConfigLoading:t.isLoading,rawConfigError:t.error,refetchRawConfig:t.refetch,saveRawConfig:a.mutate,saveRawConfigAsync:a.mutateAsync,isSavingRawConfig:a.isPending,patchConfig:n.mutate,patchConfigAsync:n.mutateAsync,isPatchingConfig:n.isPending}),[r.data,r.isLoading,r.error,r.refetch,t.data,t.isLoading,t.error,t.refetch,a.mutate,a.mutateAsync,a.isPending,n.mutate,n.mutateAsync,n.isPending])}const br=[{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 wr({snippets:s=br}){const[r,t]=b.useState(null),a=async(n,l)=>{await navigator.clipboard.writeText(n),t(l),setTimeout(()=>t(null),2e3)};return e.jsxs(D,{children:[e.jsx(M,{className:"pb-3",children:e.jsxs(I,{className:"text-lg flex items-center gap-2",children:[e.jsx(is,{className:"w-5 h-5 text-muted-foreground"}),"Quick Commands"]})}),e.jsx(F,{children:e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:s.map((n,l)=>e.jsxs("div",{className:_e("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(w,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>a(n.command,l),title:n.description,children:r===l?e.jsx(cs,{className:"h-4 w-4 text-green-600"}):e.jsx(ds,{className:"h-4 w-4"})})]},l))})})]})}function Nr(s){return!s||!Number.isFinite(s)?"N/A":new Date(s).toLocaleString()}function Cr(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 S({label:s,value:r,mono:t=!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:_e("text-right break-all",t&&"font-mono text-xs"),children:r})]})}function yr({diagnostics:s}){const r=s.config.activeProfile?`codex --profile ${s.config.activeProfile}`:"codex",t=s.binary.supportsConfigOverrides;return e.jsx(xe,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 pr-1",children:[e.jsxs(D,{children:[e.jsx(M,{className:"pb-2",children:e.jsxs(I,{className:"flex items-center gap-2 text-base",children:[e.jsx(us,{className:"h-4 w-4"}),"How Codex works in CCS"]})}),e.jsx(F,{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:"Codex is a first-class, runtime-only target in CCS v1."}),e.jsxs("li",{children:[e.jsx("strong",{children:"Native config:"})," ",e.jsx("code",{children:"ccs-codex"})," and ",e.jsx("code",{children:"ccsx"})," launch native Codex using your saved defaults."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Transient overrides:"})," ",e.jsx("code",{children:"ccsxp"})," (or"," ",e.jsx("code",{children:"ccs codex --target codex"}),") uses the CCS provider shortcut."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"CLIProxy default:"})," To make plain ",e.jsx("code",{children:"codex"})," use CLIProxy, set ",e.jsx("code",{children:'model_provider = "cliproxy"'})," and add the recipe below."]}),e.jsx("li",{children:"API profiles continue to default to Claude or Droid."})]})})]}),e.jsxs(D,{children:[e.jsx(M,{className:"pb-2",children:e.jsxs(I,{className:"flex items-center gap-2 text-base",children:[e.jsx(ms,{className:"h-4 w-4"}),"Runtime install"]})}),e.jsxs(F,{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:"Status"}),e.jsx(y,{variant:s.binary.installed?"default":"secondary",children:s.binary.installed?"Detected":"Not found"})]}),e.jsx(S,{label:"Detection source",value:s.binary.source,mono:!0}),e.jsx(S,{label:"Binary path",value:s.binary.path||"Not found",mono:!0}),e.jsx(S,{label:"Install directory",value:s.binary.installDir||"N/A",mono:!0}),e.jsx(S,{label:"Version",value:s.binary.version||"Unknown",mono:!0}),e.jsx(S,{label:"Native aliases",value:"ccs-codex, ccsx",mono:!0}),e.jsx(S,{label:"CCS provider shortcut",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:"--config override support"}),e.jsx(y,{variant:s.binary.supportsConfigOverrides?"default":"secondary",children:s.binary.supportsConfigOverrides?"Available":"Missing"})]})]})]}),e.jsxs(D,{children:[e.jsx(M,{className:"pb-2",children:e.jsxs(I,{className:"flex items-center gap-2 text-base",children:[e.jsx(ve,{className:"h-4 w-4"}),"CLIProxy-backed native Codex"]})}),e.jsx(F,{className:"space-y-3 text-sm text-muted-foreground",children:t?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{children:e.jsx("strong",{children:"Two supported paths:"})}),e.jsxs("ul",{className:"ml-4 list-disc space-y-1 [&>li]:pl-1",children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Built-in:"})," Use ",e.jsx("code",{children:"ccsxp"})," for the CCS provider shortcut."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Native:"})," Configure the recipe below to use CLIProxy directly with ",e.jsx("code",{children:"codex"}),"."]})]})]}),e.jsxs("div",{className:"rounded-md border bg-muted/20 p-3",children:[e.jsx("p",{className:"font-medium text-foreground",children:"Saved native Codex recipe"}),e.jsx("pre",{className:"mt-2 overflow-x-auto rounded-md bg-background p-3 text-xs text-foreground",children:Ee})]}),e.jsxs("ol",{className:"ml-4 list-decimal space-y-1.5 [&>li]:pl-1",children:[e.jsxs("li",{children:["Save a provider named ",e.jsx("code",{children:"cliproxy"})," with the base URL and env key above."]}),e.jsxs("li",{children:["In ",e.jsx("strong",{children:"Top-level settings"}),", set ",e.jsx("strong",{children:"Default provider"})," to"," ",e.jsx("code",{children:"cliproxy"}),"."]}),e.jsxs("li",{children:["Export ",e.jsx("code",{children:"CLIPROXY_API_KEY"})," in your shell before launching native Codex."]})]})]}):e.jsxs("p",{children:["This Codex build can still use the native path, but CCS-backed Codex routing via"," ",e.jsx("code",{children:"ccsxp"})," or ",e.jsx("code",{children:"ccs codex --target codex"})," stays unavailable until the detected Codex binary exposes ",e.jsx("code",{children:"--config"})," overrides."]})})]}),e.jsxs(D,{children:[e.jsx(M,{className:"pb-2",children:e.jsxs(I,{className:"flex items-center gap-2 text-base",children:[e.jsx(xs,{className:"h-4 w-4"}),"Config file"]})}),e.jsx(F,{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:"User config"}),s.file.exists?e.jsx(hs,{className:"h-4 w-4 text-green-600"}):e.jsx(ps,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(S,{label:"Path",value:s.file.path,mono:!0}),e.jsx(S,{label:"Resolved",value:s.file.resolvedPath,mono:!0}),e.jsx(S,{label:"Size",value:Cr(s.file.sizeBytes)}),e.jsx(S,{label:"Last modified",value:Nr(s.file.mtimeMs)}),s.file.parseError&&e.jsxs("p",{className:"text-xs text-amber-600",children:["TOML warning: ",s.file.parseError]}),s.file.readError&&e.jsxs("p",{className:"text-xs text-destructive",children:["Read warning: ",s.file.readError]})]})})]}),e.jsxs(D,{children:[e.jsx(M,{className:"pb-2",children:e.jsxs(I,{className:"flex items-center gap-2 text-base",children:[e.jsx(de,{className:"h-4 w-4"}),"Current user-layer summary"]})}),e.jsxs(F,{className:"space-y-3",children:[e.jsx(S,{label:"Model",value:s.config.model||"Not set",mono:!0}),e.jsx(S,{label:"Model provider",value:s.config.modelProvider||"Not set",mono:!0}),e.jsx(S,{label:"Active profile",value:s.config.activeProfile||"Not set",mono:!0}),e.jsx(S,{label:"Approval policy",value:s.config.approvalPolicy||"Not set",mono:!0}),e.jsx(S,{label:"Sandbox mode",value:s.config.sandboxMode||"Not set",mono:!0}),e.jsx(S,{label:"Web search",value:s.config.webSearch||"Not set",mono:!0}),e.jsx(Q,{}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs(y,{variant:"outline",className:"justify-center",children:["providers: ",s.config.modelProviderCount]}),e.jsxs(y,{variant:"outline",className:"justify-center",children:["profiles: ",s.config.profileCount]}),e.jsxs(y,{variant:"outline",className:"justify-center",children:["enabled features: ",s.config.enabledFeatures.length]}),e.jsxs(y,{variant:"outline",className:"justify-center",children:["MCP servers: ",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:"User-layer keys present"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.config.topLevelKeys.map(a=>e.jsx(y,{variant:"secondary",className:"font-mono text-[10px]",children:a},a))})]})]})]}),e.jsx(wr,{snippets:[{label:"Native short alias",command:"ccsx",description:"Launch the short native Codex runtime alias."},{label:"CCS Codex shortcut",command:'ccsxp "your prompt"',description:t?"Run the built-in CCS Codex provider on native Codex.":"Requires a Codex build that exposes --config overrides."},{label:"Explicit provider route",command:'ccs codex --target codex "your prompt"',description:t?"Use the explicit built-in Codex provider route.":"Requires a Codex build that exposes --config overrides."},{label:s.config.activeProfile?"Inspect active profile":"Open native Codex",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(D,{children:[e.jsx(M,{className:"pb-2",children:e.jsxs(I,{className:"flex items-center gap-2 text-base",children:[e.jsx(ve,{className:"h-4 w-4"}),"Runtime vs provider"]})}),e.jsxs(F,{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:"Native Codex runtime"}),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:"Honors saved native user config"})]}),e.jsxs("div",{className:"flex flex-col rounded-md border p-3 text-sm",children:[e.jsx("p",{className:"font-medium text-foreground",children:"CCS Codex provider / bridge"}),t?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(y,{variant:"secondary",className:"mt-4 w-fit justify-center font-normal",children:"Uses transient overrides"})]}):e.jsxs("p",{className:"mt-2 text-muted-foreground",children:["Unavailable (Codex build lacks ",e.jsx("code",{children:"--config"})," support)."]})]})]})]}),e.jsxs(D,{children:[e.jsx(M,{className:"pb-2",children:e.jsx(I,{className:"text-base",children:"Supported flows"})}),e.jsx(F,{children:e.jsxs(vs,{children:[e.jsx(bs,{children:e.jsxs(Ne,{children:[e.jsx(ne,{children:"Flow"}),e.jsx(ne,{children:"Status"}),e.jsx(ne,{children:"Notes"})]})}),e.jsx(ws,{children:s.supportMatrix.map(a=>e.jsxs(Ne,{children:[e.jsx(ae,{className:"font-mono text-xs",children:a.label}),e.jsx(ae,{children:e.jsx(y,{variant:a.supported?"default":"secondary",children:a.supported?"Yes":"No"})}),e.jsx(ae,{className:"text-xs text-muted-foreground",children:a.notes})]},a.id))})]})})]}),s.warnings.length>0&&e.jsxs(D,{className:"border-amber-200 bg-amber-50/50 dark:bg-amber-950/20",children:[e.jsx(M,{className:"pb-2",children:e.jsxs(I,{className:"flex items-center gap-2 text-base",children:[e.jsx(fs,{className:"h-4 w-4 text-amber-600"}),"Warnings"]})}),e.jsx(F,{className:"space-y-1.5",children:s.warnings.map(a=>e.jsxs("p",{className:"text-sm text-amber-800 dark:text-amber-300",children:["- ",a]},a))})]})]})})}function Ir(){const{diagnostics:s,diagnosticsLoading:r,diagnosticsError:t,refetchDiagnostics:a,rawConfig:n,rawConfigLoading:l,rawConfigError:i,refetchRawConfig:o,saveRawConfigAsync:d,isSavingRawConfig:c,patchConfigAsync:u,isPatchingConfig:h}=vr(),[j,x]=b.useState(null),g=n?.rawText??"",A=j??g,U=j!==null&&j!==g,m=Re(A),f=m.parseError?{valid:!1,error:m.parseError}:{valid:!0},T=n?.config??null,N=l||!n||U||n?.parseError!==null||n?.readError!==null,De=i?"Structured controls unavailable: failed to load the current config.toml.":n?.readError?`Structured controls unavailable: ${n.readError}`:U?f.valid?"Save or discard raw TOML edits before using structured controls.":"Fix or discard raw TOML edits before using structured controls.":n?.parseError?`Structured controls disabled: ${n.parseError}`:null,Me=b.useMemo(()=>Oe(T),[T]),Ie=b.useMemo(()=>Vs(T),[T]),Fe=b.useMemo(()=>zs(T),[T]),Ue=b.useMemo(()=>Xs(T),[T]),Ke=b.useMemo(()=>Gs(T),[T]),We=b.useMemo(()=>$s(T),[T]),qe=R=>{if(R===g){x(null);return}x(R)},Ve=async()=>{try{if((await Promise.all([a(),o()])).some(V=>!V||V.status==="error"||V.isError||V.error)){K.error("Failed to refresh Codex snapshot. Raw edits were kept.");return}x(null)}catch(R){K.error(R.message||"Failed to refresh Codex snapshot.")}},ze=async()=>{if(!f.valid){K.error("Fix TOML before saving.");return}try{await d({rawText:A,expectedMtime:n?.exists?n.mtime:void 0}),x(null),K.success("Saved Codex config.toml."),await a()}catch(R){je(R)?K.error("config.toml changed externally. Refresh and retry."):K.error(R.message||"Failed to save Codex config.toml.")}},Xe=async(R,pe)=>{try{await u({...R,expectedMtime:n?.exists?n.mtime:void 0}),x(null),K.success(pe)}catch(V){je(V)?K.error("config.toml changed externally. Refresh and retry."):K.error(V.message||"Failed to update Codex config.")}},se="mt-0 h-full border-0 p-0 data-[state=inactive]:hidden",Ge=()=>r?e.jsxs("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:[e.jsx(z,{className:"mr-2 h-5 w-5 animate-spin"}),"Loading Codex diagnostics..."]}):t||!s?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(Be,{defaultValue:"overview",className:"flex h-full flex-col",children:[e.jsx("div",{className:"shrink-0 px-4 pt-4",children:e.jsxs(He,{className:"grid w-full grid-cols-3",children:[e.jsx(re,{value:"overview",children:"Overview"}),e.jsx(re,{value:"controls",children:"Control Center"}),e.jsx(re,{value:"docs",children:"Docs"})]})}),e.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden px-4 pb-4 pt-3",children:[e.jsx(te,{value:"overview",className:se,children:e.jsx(yr,{diagnostics:s})}),e.jsx(te,{value:"controls",className:se,children:e.jsx(qs,{workspacePath:s.workspacePath,activeProfile:s.config.activeProfile,topLevelSettings:Me,projectTrustEntries:Ie,profileEntries:Fe,modelProviderEntries:Ue,mcpServerEntries:Ke,featureCatalog:Pe,featureState:We,disabled:N,disabledReason:De,saving:h,onPatch:Xe})}),e.jsx(te,{value:"docs",className:se,children:e.jsx(Qs,{diagnostics:s})})]})]});return e.jsx("div",{className:"h-full min-h-0 overflow-hidden",children:e.jsxs($e,{direction:"horizontal",className:"h-full",children:[e.jsx(fe,{defaultSize:45,minSize:35,children:e.jsx("div",{className:"h-full border-r bg-muted/20",children:Ge()})}),e.jsx(Ye,{className:"group flex w-2 cursor-col-resize items-center justify-center bg-border transition-colors hover:bg-primary/20",children:e.jsx(js,{className:"h-3 w-3 text-muted-foreground group-hover:text-primary"})}),e.jsx(fe,{defaultSize:55,minSize:35,children:e.jsx(Ns,{title:"Codex config.toml",pathLabel:n?.path||s?.file.path||"$CODEX_HOME/config.toml",loading:l,parseWarning:f.valid?n?.parseError:f.error,readWarning:n?.readError,value:A,dirty:U,readOnly:!!n?.readError,saving:c,saveDisabled:!U||c||l||!f.valid||!!n?.readError,onChange:R=>{qe(R)},onSave:ze,onRefresh:Ve,onDiscard:()=>x(null),language:"toml",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{Ir as CodexPage};
26
+ `&&l!=="\r"){let i=he(s,r-1,"]",t-1,a);n.push(i[0]),r=i[1]}}if(!l)throw new p("unfinished array encountered",{toml:s,ptr:r});return[n,r]}function ke(s,r,t,a){let n=r,l=t,i,o=!1,d;for(let c=0;c<s.length;c++){if(c){if(n=o?n[i]:n[i]={},l=(d=l[i]).c,a===0&&(d.t===1||d.t===2))return null;if(d.t===2){let u=n.length-1;n=n[u],l=l[u].c}}if(i=s[c],(o=Object.hasOwn(n,i))&&l[i]?.t===0&&l[i]?.d)return null;o||(i==="__proto__"&&(Object.defineProperty(n,i,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(l,i,{enumerable:!0,configurable:!0,writable:!0})),l[i]={t:c<s.length-1&&a===2?3:a,d:!1,i:0,c:{}})}if(d=l[i],d.t!==a&&!(a===1&&d.t===3)||(a===2&&(d.d||(d.d=!0,n[i]=[]),n[i].push(n={}),d.c[d.i++]=d={t:1,d:!1,i:0,c:{}}),d.d))return null;if(d.d=!0,a===1)n=o?n[i]:n[i]={};else if(a===0&&o)return null;return[i,n,d.c]}function mr(s,{maxDepth:r=1e3,integersAsBigInt:t}={}){let a={},n={},l=a,i=n;for(let o=K(s,0);o<s.length;){if(s[o]==="["){let d=s[++o]==="[",c=me(s,o+=+d,"]");if(d){if(s[c[1]-1]!=="]")throw new p("expected end of table declaration",{toml:s,ptr:c[1]-1});c[1]++}let u=ke(c[0],a,n,d?2:1);if(!u)throw new p("trying to redefine an already defined table or value",{toml:s,ptr:o});i=u[2],l=u[1],o=c[1]}else{let d=me(s,o),c=ke(d[0],l,i,0);if(!c)throw new p("trying to redefine an already defined table or value",{toml:s,ptr:o});let u=he(s,d[1],void 0,r,t);c[1][c[0]]=u[0],o=u[1]}if(o=K(s,o,!0),s[o]&&s[o]!==`
27
+ `&&s[o]!=="\r")throw new p("each key-value declaration must be followed by an end-of-line",{toml:s,ptr:o});o=K(s,o)}return a}function xr(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)}function hr(s){if(!s.trim())return{};const t=mr(s);if(!xr(t))throw new Error("TOML root must be a table.");return t}function Re(s){try{return{config:hr(s),parseError:null}}catch(r){return{config:null,parseError:r.message}}}async function pr(){const s=await fetch(J("/codex/diagnostics"));if(!s.ok)throw new Error("Failed to fetch Codex diagnostics");return s.json()}async function fr(){const s=await fetch(J("/codex/config/raw"));if(!s.ok)throw new Error("Failed to fetch Codex raw config");return s.json()}async function jr(s){const r=await fetch(J("/codex/config/raw"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(r.status===409)throw new Te("Codex raw config changed externally");if(!r.ok){const t=await r.json().catch(()=>null);throw new Error(t?.error||"Failed to save Codex raw config")}return r.json()}async function gr(s){const r=await fetch(J("/codex/config/patch"),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(r.status===409)throw new Te("Codex config changed externally");if(!r.ok){const t=await r.json().catch(()=>null);throw new Error(t?.error||"Failed to patch Codex config")}return r.json()}function vr(){const s=gs(),r=be({queryKey:["codex-diagnostics"],queryFn:pr,refetchInterval:1e4}),t=be({queryKey:["codex-raw-config"],queryFn:fr}),a=we({mutationFn:jr,onSuccess:(l,i)=>{s.setQueryData(["codex-raw-config"],o=>{const d=o?.path??"$CODEX_HOME/config.toml",c=o?.resolvedPath??d,u=Re(i.rawText);return{path:d,resolvedPath:c,exists:!0,mtime:l.mtime,rawText:i.rawText,config:u.config,parseError:u.parseError,readError:null}}),s.invalidateQueries({queryKey:["codex-diagnostics"]})}}),n=we({mutationFn:gr,onSuccess:l=>{s.setQueryData(["codex-raw-config"],l),s.invalidateQueries({queryKey:["codex-diagnostics"]})}});return b.useMemo(()=>({diagnostics:r.data,diagnosticsLoading:r.isLoading,diagnosticsError:r.error,refetchDiagnostics:r.refetch,rawConfig:t.data,rawConfigLoading:t.isLoading,rawConfigError:t.error,refetchRawConfig:t.refetch,saveRawConfig:a.mutate,saveRawConfigAsync:a.mutateAsync,isSavingRawConfig:a.isPending,patchConfig:n.mutate,patchConfigAsync:n.mutateAsync,isPatchingConfig:n.isPending}),[r.data,r.isLoading,r.error,r.refetch,t.data,t.isLoading,t.error,t.refetch,a.mutate,a.mutateAsync,a.isPending,n.mutate,n.mutateAsync,n.isPending])}const br=[{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 wr({snippets:s=br}){const[r,t]=b.useState(null),a=async(n,l)=>{await navigator.clipboard.writeText(n),t(l),setTimeout(()=>t(null),2e3)};return e.jsxs(D,{children:[e.jsx(M,{className:"pb-3",children:e.jsxs(I,{className:"text-lg flex items-center gap-2",children:[e.jsx(is,{className:"w-5 h-5 text-muted-foreground"}),"Quick Commands"]})}),e.jsx(F,{children:e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:s.map((n,l)=>e.jsxs("div",{className:_e("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(w,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>a(n.command,l),title:n.description,children:r===l?e.jsx(cs,{className:"h-4 w-4 text-green-600"}):e.jsx(ds,{className:"h-4 w-4"})})]},l))})})]})}function Nr(s){return!s||!Number.isFinite(s)?"N/A":new Date(s).toLocaleString()}function Cr(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 S({label:s,value:r,mono:t=!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:_e("text-right break-all",t&&"font-mono text-xs"),children:r})]})}function yr({diagnostics:s}){const r=s.config.activeProfile?`codex --profile ${s.config.activeProfile}`:"codex",t=s.binary.supportsConfigOverrides;return e.jsx(xe,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 pr-1",children:[e.jsxs(D,{children:[e.jsx(M,{className:"pb-2",children:e.jsxs(I,{className:"flex items-center gap-2 text-base",children:[e.jsx(us,{className:"h-4 w-4"}),"How Codex works in CCS"]})}),e.jsx(F,{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:"Codex is a first-class, runtime-only target in CCS v1."}),e.jsxs("li",{children:[e.jsx("strong",{children:"Native config:"})," ",e.jsx("code",{children:"ccs-codex"})," and ",e.jsx("code",{children:"ccsx"})," launch native Codex using your saved defaults."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Transient overrides:"})," ",e.jsx("code",{children:"ccsxp"})," (or"," ",e.jsx("code",{children:"ccs codex --target codex"}),") uses the CCS provider shortcut."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"CLIProxy default:"})," To make plain ",e.jsx("code",{children:"codex"})," use CLIProxy, set ",e.jsx("code",{children:'model_provider = "cliproxy"'})," and add the recipe below."]}),e.jsx("li",{children:"API profiles continue to default to Claude or Droid."})]})})]}),e.jsxs(D,{children:[e.jsx(M,{className:"pb-2",children:e.jsxs(I,{className:"flex items-center gap-2 text-base",children:[e.jsx(ms,{className:"h-4 w-4"}),"Runtime install"]})}),e.jsxs(F,{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:"Status"}),e.jsx(y,{variant:s.binary.installed?"default":"secondary",children:s.binary.installed?"Detected":"Not found"})]}),e.jsx(S,{label:"Detection source",value:s.binary.source,mono:!0}),e.jsx(S,{label:"Binary path",value:s.binary.path||"Not found",mono:!0}),e.jsx(S,{label:"Install directory",value:s.binary.installDir||"N/A",mono:!0}),e.jsx(S,{label:"Version",value:s.binary.version||"Unknown",mono:!0}),e.jsx(S,{label:"Native aliases",value:"ccs-codex, ccsx",mono:!0}),e.jsx(S,{label:"CCS provider shortcut",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:"--config override support"}),e.jsx(y,{variant:s.binary.supportsConfigOverrides?"default":"secondary",children:s.binary.supportsConfigOverrides?"Available":"Missing"})]})]})]}),e.jsxs(D,{children:[e.jsx(M,{className:"pb-2",children:e.jsxs(I,{className:"flex items-center gap-2 text-base",children:[e.jsx(ve,{className:"h-4 w-4"}),"CLIProxy-backed native Codex"]})}),e.jsx(F,{className:"space-y-3 text-sm text-muted-foreground",children:t?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{children:e.jsx("strong",{children:"Two supported paths:"})}),e.jsxs("ul",{className:"ml-4 list-disc space-y-1 [&>li]:pl-1",children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Built-in:"})," Use ",e.jsx("code",{children:"ccsxp"})," for the CCS provider shortcut."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Native:"})," Configure the recipe below to use CLIProxy directly with ",e.jsx("code",{children:"codex"}),"."]})]})]}),e.jsxs("div",{className:"rounded-md border bg-muted/20 p-3",children:[e.jsx("p",{className:"font-medium text-foreground",children:"Saved native Codex recipe"}),e.jsx("pre",{className:"mt-2 overflow-x-auto rounded-md bg-background p-3 text-xs text-foreground",children:Ee})]}),e.jsxs("ol",{className:"ml-4 list-decimal space-y-1.5 [&>li]:pl-1",children:[e.jsxs("li",{children:["Save a provider named ",e.jsx("code",{children:"cliproxy"})," with the base URL and env key above."]}),e.jsxs("li",{children:["In ",e.jsx("strong",{children:"Top-level settings"}),", set ",e.jsx("strong",{children:"Default provider"})," to"," ",e.jsx("code",{children:"cliproxy"}),"."]}),e.jsxs("li",{children:["Export ",e.jsx("code",{children:"CLIPROXY_API_KEY"})," in your shell before launching native Codex."]})]})]}):e.jsxs("p",{children:["This Codex build can still use the native path, but CCS-backed Codex routing via"," ",e.jsx("code",{children:"ccsxp"})," or ",e.jsx("code",{children:"ccs codex --target codex"})," stays unavailable until the detected Codex binary exposes ",e.jsx("code",{children:"--config"})," overrides."]})})]}),e.jsxs(D,{children:[e.jsx(M,{className:"pb-2",children:e.jsxs(I,{className:"flex items-center gap-2 text-base",children:[e.jsx(xs,{className:"h-4 w-4"}),"Config file"]})}),e.jsx(F,{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:"User config"}),s.file.exists?e.jsx(hs,{className:"h-4 w-4 text-green-600"}):e.jsx(ps,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(S,{label:"Path",value:s.file.path,mono:!0}),e.jsx(S,{label:"Resolved",value:s.file.resolvedPath,mono:!0}),e.jsx(S,{label:"Size",value:Cr(s.file.sizeBytes)}),e.jsx(S,{label:"Last modified",value:Nr(s.file.mtimeMs)}),s.file.parseError&&e.jsxs("p",{className:"text-xs text-amber-600",children:["TOML warning: ",s.file.parseError]}),s.file.readError&&e.jsxs("p",{className:"text-xs text-destructive",children:["Read warning: ",s.file.readError]})]})})]}),e.jsxs(D,{children:[e.jsx(M,{className:"pb-2",children:e.jsxs(I,{className:"flex items-center gap-2 text-base",children:[e.jsx(de,{className:"h-4 w-4"}),"Current user-layer summary"]})}),e.jsxs(F,{className:"space-y-3",children:[e.jsx(S,{label:"Model",value:s.config.model||"Not set",mono:!0}),e.jsx(S,{label:"Model provider",value:s.config.modelProvider||"Not set",mono:!0}),e.jsx(S,{label:"Active profile",value:s.config.activeProfile||"Not set",mono:!0}),e.jsx(S,{label:"Approval policy",value:s.config.approvalPolicy||"Not set",mono:!0}),e.jsx(S,{label:"Sandbox mode",value:s.config.sandboxMode||"Not set",mono:!0}),e.jsx(S,{label:"Web search",value:s.config.webSearch||"Not set",mono:!0}),e.jsx(Q,{}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs(y,{variant:"outline",className:"justify-center",children:["providers: ",s.config.modelProviderCount]}),e.jsxs(y,{variant:"outline",className:"justify-center",children:["profiles: ",s.config.profileCount]}),e.jsxs(y,{variant:"outline",className:"justify-center",children:["enabled features: ",s.config.enabledFeatures.length]}),e.jsxs(y,{variant:"outline",className:"justify-center",children:["MCP servers: ",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:"User-layer keys present"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.config.topLevelKeys.map(a=>e.jsx(y,{variant:"secondary",className:"font-mono text-[10px]",children:a},a))})]})]})]}),e.jsx(wr,{snippets:[{label:"Native short alias",command:"ccsx",description:"Launch the short native Codex runtime alias."},{label:"CCS Codex shortcut",command:'ccsxp "your prompt"',description:t?"Run the built-in CCS Codex provider on native Codex.":"Requires a Codex build that exposes --config overrides."},{label:"Explicit provider route",command:'ccs codex --target codex "your prompt"',description:t?"Use the explicit built-in Codex provider route.":"Requires a Codex build that exposes --config overrides."},{label:s.config.activeProfile?"Inspect active profile":"Open native Codex",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(D,{children:[e.jsx(M,{className:"pb-2",children:e.jsxs(I,{className:"flex items-center gap-2 text-base",children:[e.jsx(ve,{className:"h-4 w-4"}),"Runtime vs provider"]})}),e.jsxs(F,{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:"Native Codex runtime"}),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:"Honors saved native user config"})]}),e.jsxs("div",{className:"flex flex-col rounded-md border p-3 text-sm",children:[e.jsx("p",{className:"font-medium text-foreground",children:"CCS Codex provider / bridge"}),t?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(y,{variant:"secondary",className:"mt-4 w-fit justify-center font-normal",children:"Uses transient overrides"})]}):e.jsxs("p",{className:"mt-2 text-muted-foreground",children:["Unavailable (Codex build lacks ",e.jsx("code",{children:"--config"})," support)."]})]})]})]}),e.jsxs(D,{children:[e.jsx(M,{className:"pb-2",children:e.jsx(I,{className:"text-base",children:"Supported flows"})}),e.jsx(F,{children:e.jsxs(vs,{children:[e.jsx(bs,{children:e.jsxs(Ne,{children:[e.jsx(ne,{children:"Flow"}),e.jsx(ne,{children:"Status"}),e.jsx(ne,{children:"Notes"})]})}),e.jsx(ws,{children:s.supportMatrix.map(a=>e.jsxs(Ne,{children:[e.jsx(ae,{className:"font-mono text-xs",children:a.label}),e.jsx(ae,{children:e.jsx(y,{variant:a.supported?"default":"secondary",children:a.supported?"Yes":"No"})}),e.jsx(ae,{className:"text-xs text-muted-foreground",children:a.notes})]},a.id))})]})})]}),s.warnings.length>0&&e.jsxs(D,{className:"border-amber-200 bg-amber-50/50 dark:bg-amber-950/20",children:[e.jsx(M,{className:"pb-2",children:e.jsxs(I,{className:"flex items-center gap-2 text-base",children:[e.jsx(fs,{className:"h-4 w-4 text-amber-600"}),"Warnings"]})}),e.jsx(F,{className:"space-y-1.5",children:s.warnings.map(a=>e.jsxs("p",{className:"text-sm text-amber-800 dark:text-amber-300",children:["- ",a]},a))})]})]})})}function Ir(){const{diagnostics:s,diagnosticsLoading:r,diagnosticsError:t,refetchDiagnostics:a,rawConfig:n,rawConfigLoading:l,rawConfigError:i,refetchRawConfig:o,saveRawConfigAsync:d,isSavingRawConfig:c,patchConfigAsync:u,isPatchingConfig:h}=vr(),[j,x]=b.useState(null),g=n?.rawText??"",A=j??g,U=j!==null&&j!==g,m=Re(A),f=m.parseError?{valid:!1,error:m.parseError}:{valid:!0},T=n?.config??null,N=l||!n||U||n?.parseError!==null||n?.readError!==null,De=i?"Structured controls unavailable: failed to load the current config.toml.":n?.readError?`Structured controls unavailable: ${n.readError}`:U?f.valid?"Save or discard raw TOML edits before using structured controls.":"Fix or discard raw TOML edits before using structured controls.":n?.parseError?`Structured controls disabled: ${n.parseError}`:null,Me=b.useMemo(()=>Oe(T),[T]),Ie=b.useMemo(()=>Vs(T),[T]),Fe=b.useMemo(()=>Xs(T),[T]),Ue=b.useMemo(()=>zs(T),[T]),We=b.useMemo(()=>$s(T),[T]),Ke=b.useMemo(()=>Gs(T),[T]),qe=R=>{if(R===g){x(null);return}x(R)},Ve=async()=>{try{if((await Promise.all([a(),o()])).some(V=>!V||V.status==="error"||V.isError||V.error)){W.error("Failed to refresh Codex snapshot. Raw edits were kept.");return}x(null)}catch(R){W.error(R.message||"Failed to refresh Codex snapshot.")}},Xe=async()=>{if(!f.valid){W.error("Fix TOML before saving.");return}try{await d({rawText:A,expectedMtime:n?.exists?n.mtime:void 0}),x(null),W.success("Saved Codex config.toml."),await a()}catch(R){je(R)?W.error("config.toml changed externally. Refresh and retry."):W.error(R.message||"Failed to save Codex config.toml.")}},ze=async(R,pe)=>{try{await u({...R,expectedMtime:n?.exists?n.mtime:void 0}),x(null),W.success(pe)}catch(V){je(V)?W.error("config.toml changed externally. Refresh and retry."):W.error(V.message||"Failed to update Codex config.")}},se="mt-0 h-full border-0 p-0 data-[state=inactive]:hidden",$e=()=>r?e.jsxs("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:[e.jsx(X,{className:"mr-2 h-5 w-5 animate-spin"}),"Loading Codex diagnostics..."]}):t||!s?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(Be,{defaultValue:"overview",className:"flex h-full flex-col",children:[e.jsx("div",{className:"shrink-0 px-4 pt-4",children:e.jsxs(He,{className:"grid w-full grid-cols-3",children:[e.jsx(re,{value:"overview",children:"Overview"}),e.jsx(re,{value:"controls",children:"Control Center"}),e.jsx(re,{value:"docs",children:"Docs"})]})}),e.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden px-4 pb-4 pt-3",children:[e.jsx(te,{value:"overview",className:se,children:e.jsx(yr,{diagnostics:s})}),e.jsx(te,{value:"controls",className:se,children:e.jsx(qs,{workspacePath:s.workspacePath,activeProfile:s.config.activeProfile,topLevelSettings:Me,projectTrustEntries:Ie,profileEntries:Fe,modelProviderEntries:Ue,mcpServerEntries:We,featureCatalog:Pe,featureState:Ke,disabled:N,disabledReason:De,saving:h,onPatch:ze})}),e.jsx(te,{value:"docs",className:se,children:e.jsx(Qs,{diagnostics:s})})]})]});return e.jsx("div",{className:"h-full min-h-0 overflow-hidden",children:e.jsxs(Ge,{direction:"horizontal",className:"h-full",children:[e.jsx(fe,{defaultSize:45,minSize:35,children:e.jsx("div",{className:"h-full border-r bg-muted/20",children:$e()})}),e.jsx(Ye,{className:"group flex w-2 cursor-col-resize items-center justify-center bg-border transition-colors hover:bg-primary/20",children:e.jsx(js,{className:"h-3 w-3 text-muted-foreground group-hover:text-primary"})}),e.jsx(fe,{defaultSize:55,minSize:35,children:e.jsx(Ns,{title:"Codex config.toml",pathLabel:n?.path||s?.file.path||"$CODEX_HOME/config.toml",loading:l,parseWarning:f.valid?n?.parseError:f.error,readWarning:n?.readError,value:A,dirty:U,readOnly:!!n?.readError,saving:c,saveDisabled:!U||c||l||!f.valid||!!n?.readError,onChange:R=>{qe(R)},onSave:Xe,onRefresh:Ve,onDiscard:()=>x(null),language:"toml",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{Ir as CodexPage};
@@ -1 +1 @@
1
- import{j as e}from"./radix-ui-Zb8sVEtn.js";import{A as c,a as d,b as g,c as x,d as h,e as j,f as A,g as D}from"./alert-dialog-CIh7avyK.js";function f({open:i,onConfirm:l,onCancel:r,title:s,description:t,confirmText:a="Confirm",variant:o="default"}){return e.jsx(c,{open:i,onOpenChange:n=>!n&&r(),children:e.jsxs(d,{children:[e.jsxs(g,{children:[e.jsx(x,{children:s}),e.jsx(h,{children:t})]}),e.jsxs(j,{children:[e.jsx(A,{onClick:r,children:"Cancel"}),e.jsx(D,{onClick:l,className:o==="destructive"?"bg-red-600 hover:bg-red-700 text-white":"",children:a})]})]})})}export{f as C};
1
+ import{j as e}from"./radix-ui-Zb8sVEtn.js";import{A as c,a as d,b as g,c as x,d as h,e as j,f as A,g as D}from"./alert-dialog-Tc_D1a_B.js";function f({open:i,onConfirm:l,onCancel:r,title:s,description:t,confirmText:a="Confirm",variant:o="default"}){return e.jsx(c,{open:i,onOpenChange:n=>!n&&r(),children:e.jsxs(d,{children:[e.jsxs(g,{children:[e.jsx(x,{children:s}),e.jsx(h,{children:t})]}),e.jsxs(j,{children:[e.jsx(A,{onClick:r,children:"Cancel"}),e.jsx(D,{onClick:l,className:o==="destructive"?"bg-red-600 hover:bg-red-700 text-white":"",children:a})]})]})})}export{f as C};