@kaitranntt/ccs 7.69.1-dev.3 → 7.69.1-dev.5

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 (54) hide show
  1. package/dist/cliproxy/binary/version-cache.d.ts +10 -0
  2. package/dist/cliproxy/binary/version-cache.d.ts.map +1 -1
  3. package/dist/cliproxy/binary/version-cache.js +29 -7
  4. package/dist/cliproxy/binary/version-cache.js.map +1 -1
  5. package/dist/cliproxy/binary/version-checker.d.ts +14 -3
  6. package/dist/cliproxy/binary/version-checker.d.ts.map +1 -1
  7. package/dist/cliproxy/binary/version-checker.js +65 -36
  8. package/dist/cliproxy/binary/version-checker.js.map +1 -1
  9. package/dist/ui/assets/accounts-DamxGxu1.js +1 -0
  10. package/dist/ui/assets/{alert-dialog-BA39vaYL.js → alert-dialog-sars2LJq.js} +1 -1
  11. package/dist/ui/assets/{api-D2cjf1H4.js → api-DHF10LeP.js} +1 -1
  12. package/dist/ui/assets/{auth-section-BNX8_9MJ.js → auth-section-BNmbrWhd.js} +1 -1
  13. package/dist/ui/assets/{backups-section-Bt0FA5zl.js → backups-section-DGURGm2o.js} +1 -1
  14. package/dist/ui/assets/channels-B0j9pbpo.js +1 -0
  15. package/dist/ui/assets/{checkbox-DHF-UBrH.js → checkbox-DQIFU7Wu.js} +1 -1
  16. package/dist/ui/assets/claude-extension-qxiVTjYL.js +1 -0
  17. package/dist/ui/assets/{cliproxy-CD7z-_q8.js → cliproxy-CdvU0y2i.js} +1 -1
  18. package/dist/ui/assets/{cliproxy-ai-providers-QSOOqh8F.js → cliproxy-ai-providers-zgUBcUcJ.js} +1 -1
  19. package/dist/ui/assets/{cliproxy-control-panel-D9dLU28p.js → cliproxy-control-panel-S6FdJjgh.js} +1 -1
  20. package/dist/ui/assets/codex-B79sHpGl.js +27 -0
  21. package/dist/ui/assets/{confirm-dialog-BICDz_zm.js → confirm-dialog-DwrX5gr_.js} +1 -1
  22. package/dist/ui/assets/{copilot-BnQrRCuJ.js → copilot-CgE4vyvS.js} +1 -1
  23. package/dist/ui/assets/{cursor-CXopLKfC.js → cursor-rYsOav5G.js} +1 -1
  24. package/dist/ui/assets/{droid-CLFg9ELE.js → droid-CQlRU59Q.js} +1 -1
  25. package/dist/ui/assets/{globalenv-section-NPjCcYBN.js → globalenv-section-DSQ3m4Ei.js} +1 -1
  26. package/dist/ui/assets/{health-B_3JpCrY.js → health-DE-wdzdl.js} +1 -1
  27. package/dist/ui/assets/{index-B5Egq7qY.js → index-BcJqrfhu.js} +1 -1
  28. package/dist/ui/assets/{index-BgGHTjTd.js → index-BwtPYSbP.js} +1 -1
  29. package/dist/ui/assets/{index-BY2j-o67.js → index-C5VFMOG4.js} +1 -1
  30. package/dist/ui/assets/index-CqJW-L_1.js +1 -0
  31. package/dist/ui/assets/{index-BcUkpsGj.js → index-D1jFmelj.js} +1 -1
  32. package/dist/ui/assets/index-g2g1k0QS.js +72 -0
  33. package/dist/ui/assets/{logs-Bb1OVYeK.js → logs-CDpci_AI.js} +1 -1
  34. package/dist/ui/assets/{masked-input-b4-lEKNq.js → masked-input-DXzbXJrE.js} +1 -1
  35. package/dist/ui/assets/{proxy-status-widget-s89zaj3X.js → proxy-status-widget-DCQBVSBP.js} +1 -1
  36. package/dist/ui/assets/{raw-json-settings-editor-panel-Dr_BNQwQ.js → raw-json-settings-editor-panel-Db_WTo0f.js} +1 -1
  37. package/dist/ui/assets/{searchable-select-FJPe_YWv.js → searchable-select-CHzzY0Km.js} +1 -1
  38. package/dist/ui/assets/{separator-DJ0ku_ak.js → separator-Bd4OFZm5.js} +1 -1
  39. package/dist/ui/assets/{shared-DyQlJnbj.js → shared-B8K097LC.js} +1 -1
  40. package/dist/ui/assets/{table-6Yg65ZZH.js → table-7IypCMku.js} +1 -1
  41. package/dist/ui/assets/updates-4X5hHhUg.js +1 -0
  42. package/dist/ui/index.html +1 -1
  43. package/dist/web-server/routes/cliproxy-stats-routes.d.ts +37 -0
  44. package/dist/web-server/routes/cliproxy-stats-routes.d.ts.map +1 -1
  45. package/dist/web-server/routes/cliproxy-stats-routes.js +56 -10
  46. package/dist/web-server/routes/cliproxy-stats-routes.js.map +1 -1
  47. package/package.json +1 -1
  48. package/dist/ui/assets/accounts-DN0lP-yj.js +0 -1
  49. package/dist/ui/assets/channels-FaDUjf3Y.js +0 -1
  50. package/dist/ui/assets/claude-extension-D-skBToQ.js +0 -1
  51. package/dist/ui/assets/codex-CHO5_hku.js +0 -27
  52. package/dist/ui/assets/index-DNmWbKbN.js +0 -72
  53. package/dist/ui/assets/index-DZddoGfE.js +0 -1
  54. package/dist/ui/assets/updates-DSCXb6Au.js +0 -1
@@ -1,27 +0,0 @@
1
- import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as v}from"./react-vendor-CNOkPC89.js";import{t as q}from"./notifications-B2HqRBj7.js";import{C as I,j as F,k as W,B as k,b as U,a as _,d as N,aF as Q,r as P,s as O,t as L,v as D,w as g,I as y,n as pe,bb as ee,bc as Ee,c as Pe,bi as Ye,bj as ge,bk as He,Q as Qe,R as Je,U as ne,V as ae,bd as ve}from"./index-DNmWbKbN.js";import{aa as Ze,aR as es,as as se,L as z,n as ss,aS as rs,aT as ts,aB as ns,w as as,a7 as ls,aU as os,aV as is,aW as cs,ah as xe,p as be,$ as ds,m as us,o as xs,_ as ms,S as hs,aM as we,aX as ps,x as fs,I as js,T as gs,N as vs}from"./icons-KVCk4_U8.js";import{S as Z}from"./separator-DJ0ku_ak.js";import{a as bs,u as Ne,b as Ce}from"./tanstack-CrmUhA7Z.js";import"./code-highlight-BRUf_pqB.js";import{T as ws,a as Ns,b as ye,c as le,d as Cs,e as oe}from"./table-6Yg65ZZH.js";import{R as ys}from"./raw-json-settings-editor-panel-Dr_BNQwQ.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";function J({title:s,icon:r,badge:t,description:l,disabledReason:a,children:n}){return e.jsxs(I,{children:[e.jsxs(F,{className:"pb-2",children:[e.jsxs(W,{className:"flex items-center gap-2 text-base",children:[r,s,t?e.jsx(k,{variant:"outline",className:"text-[10px] font-normal",children:t}):null]}),l?e.jsx("p",{className:"text-xs text-muted-foreground",children:l}):null]}),e.jsxs(U,{className:"space-y-3",children:[a?e.jsx("p",{className:"text-xs text-amber-600",children:a}):null,n]})]})}function ks({catalog:s,state:r,disabled:t=!1,disabledReason:l,onToggle:a}){const{t:n}=_(),o=new Set(s.map(i=>i.name)),c=Object.entries(r).filter(([i])=>!o.has(i)).sort(([i],[d])=>i.localeCompare(d));return e.jsxs(J,{title:"Features",badge:"features",icon:e.jsx(Ze,{className:"h-4 w-4"}),description:"Toggle the supported Codex feature flags CCS can safely manage.",disabledReason:l,children:[e.jsx("div",{className:"space-y-2",children:s.map(i=>{const d=r[i.name]??null;return e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md border px-3 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm font-medium",children:i.label}),e.jsx(k,{variant:"outline",className:"font-mono text-[10px]",children:i.name})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:i.description})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[d!==null?e.jsx(N,{variant:"outline",size:"sm",onClick:()=>a(i.name,null),disabled:t,children:n("codex.useDefault")}):null,e.jsx(Q,{checked:d===!0,onCheckedChange:u=>a(i.name,u),disabled:t})]})]},i.name)})}),c.length>0?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"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."})]}),c.map(([i,d])=>e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md border border-dashed px-3 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm font-medium",children:i}),e.jsx(k,{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(k,{variant:"outline",children:n("codex.rawOnly")}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(N,{variant:"outline",size:"sm",onClick:()=>a(i,null),disabled:t,children:n("codex.useDefault")}),e.jsx(Q,{checked:d===!0,onCheckedChange:u=>a(i,u),disabled:t})]})]},i))]}):null]})}const Ss={name:"",transport:"stdio",command:null,args:[],url:null,enabled:!0,required:!1,startupTimeoutSec:null,toolTimeoutSec:null,enabledTools:[],disabledTools:[]};function ie(s){return s.join(", ")}function ce(s){return s.split(",").map(r=>r.trim()).filter(Boolean)}function Ts({initialDraft:s,isNew:r,disabled:t,saving:l,canDelete:a,onSave:n,onDelete:o}){const{t:c}=_(),[i,d]=v.useState(s);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(y,{value:i.name,onChange:u=>d(m=>({...m,name:u.target.value})),placeholder:"playwright",disabled:t||!r}),e.jsxs(P,{value:i.transport,onValueChange:u=>d(m=>({...m,transport:u})),disabled:t,children:[e.jsx(O,{children:e.jsx(L,{})}),e.jsxs(D,{children:[e.jsx(g,{value:"stdio",children:c("codex.stdio")}),e.jsx(g,{value:"streamable-http",children:c("codex.streamableHttp")})]})]}),i.transport==="stdio"?e.jsxs(e.Fragment,{children:[e.jsx(y,{value:i.command??"",onChange:u=>d(m=>({...m,command:u.target.value||null})),placeholder:"npx",disabled:t}),e.jsx(y,{value:ie(i.args),onChange:u=>d(m=>({...m,args:ce(u.target.value)})),placeholder:"@playwright/mcp@latest, --flag",disabled:t})]}):e.jsx(y,{className:"sm:col-span-2",value:i.url??"",onChange:u=>d(m=>({...m,url:u.target.value||null})),placeholder:"https://example.test/mcp",disabled:t}),e.jsx(y,{type:"number",min:1,value:i.startupTimeoutSec??"",onChange:u=>d(m=>({...m,startupTimeoutSec:u.target.value?Number(u.target.value):null})),placeholder:"Startup timeout (sec)",disabled:t}),e.jsx(y,{type:"number",min:1,value:i.toolTimeoutSec??"",onChange:u=>d(m=>({...m,toolTimeoutSec:u.target.value?Number(u.target.value):null})),placeholder:"Tool timeout (sec)",disabled:t}),e.jsx(y,{value:ie(i.enabledTools),onChange:u=>d(m=>({...m,enabledTools:ce(u.target.value)})),placeholder:"enabled_tools",disabled:t}),e.jsx(y,{value:ie(i.disabledTools),onChange:u=>d(m=>({...m,disabledTools:ce(u.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(Q,{checked:i.enabled,onCheckedChange:u=>d(m=>({...m,enabled:u})),disabled:t})]}),e.jsxs("label",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-sm",children:["Required",e.jsx(Q,{checked:i.required,onCheckedChange:u=>d(m=>({...m,required:u})),disabled:t})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs(N,{variant:"outline",onClick:o,disabled:t||l||!a,children:[e.jsx(se,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsxs(N,{onClick:()=>n(i.name,{transport:i.transport,command:i.command,args:i.args,url:i.url,enabled:i.enabled,required:i.required,startupTimeoutSec:i.startupTimeoutSec,toolTimeoutSec:i.toolTimeoutSec,enabledTools:i.enabledTools,disabledTools:i.disabledTools}),disabled:t||l||i.name.trim().length===0,children:[l?e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save MCP server"]})]})]})}function _s({entries:s,disabled:r=!1,disabledReason:t,saving:l=!1,onSave:a,onDelete:n}){const{t:o}=_(),[c,i]=v.useState("new"),d=v.useMemo(()=>s.find(h=>h.name===c)??null,[s,c]),u=d??Ss,m=JSON.stringify(u);return e.jsxs(J,{title:"MCP servers",badge:"mcp_servers",icon:e.jsx(es,{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(P,{value:c,onValueChange:i,disabled:r,children:[e.jsx(O,{children:e.jsx(L,{placeholder:"Select MCP server"})}),e.jsxs(D,{children:[e.jsx(g,{value:"new",children:o("codex.createNewMcpServer")}),s.map(h=>e.jsx(g,{value:h.name,children:h.name},h.name))]})]}),e.jsx(Ts,{initialDraft:u,isNew:c==="new",disabled:r,saving:l,canDelete:d!==null,onDelete:async()=>{d&&(await n(d.name),i("new"))},onSave:async(h,b)=>{await a(h,b),i(h)}},m)]})}const Es={name:"",displayName:null,baseUrl:null,envKey:null,wireApi:"responses",requiresOpenaiAuth:!1,supportsWebsockets:!1},Ps={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 Os({initialDraft:s,isNew:r,disabled:t,saving:l,canDelete:a,onSave:n,onDelete:o}){const{t:c}=_(),[i,d]=v.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:c("codex.defaultProvider")})," to ",e.jsx("code",{children:"cliproxy"})," in Top-level settings."]}),e.jsx(N,{variant:"outline",size:"sm",onClick:()=>d(Ps),disabled:t,children:"Use CLIProxy Codex preset"})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(y,{value:i.name,onChange:u=>d(m=>({...m,name:u.target.value})),placeholder:"Provider id",disabled:t||!r}),e.jsx(y,{value:i.displayName??"",onChange:u=>d(m=>({...m,displayName:u.target.value||null})),placeholder:"Display name",disabled:t}),e.jsx(y,{value:i.baseUrl??"",onChange:u=>d(m=>({...m,baseUrl:u.target.value||null})),placeholder:"http://127.0.0.1:8317/api/provider/codex",disabled:t}),e.jsx(y,{value:i.envKey??"",onChange:u=>d(m=>({...m,envKey:u.target.value||null})),placeholder:"CLIPROXY_API_KEY",disabled:t})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[e.jsxs(P,{value:i.wireApi??"responses",onValueChange:u=>d(m=>({...m,wireApi:u})),disabled:t,children:[e.jsx(O,{children:e.jsx(L,{})}),e.jsx(D,{children:e.jsx(g,{value:"responses",children:c("codex.responses")})})]}),e.jsxs("label",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-sm",children:["Requires OpenAI auth",e.jsx(Q,{checked:i.requiresOpenaiAuth,onCheckedChange:u=>d(m=>({...m,requiresOpenaiAuth:u})),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(Q,{checked:i.supportsWebsockets,onCheckedChange:u=>d(m=>({...m,supportsWebsockets:u})),disabled:t})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs(N,{variant:"outline",onClick:o,disabled:t||l||!a,children:[e.jsx(se,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsxs(N,{onClick:()=>n(i.name,{displayName:i.displayName,baseUrl:i.baseUrl,envKey:i.envKey,wireApi:i.wireApi,requiresOpenaiAuth:i.requiresOpenaiAuth,supportsWebsockets:i.supportsWebsockets}),disabled:t||l||i.name.trim().length===0,children:[l?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:c("codex.defaultProvider")})," control above."]})]})}function Ls({entries:s,disabled:r=!1,disabledReason:t,saving:l=!1,onSave:a,onDelete:n}){const{t:o}=_(),[c,i]=v.useState("new"),d=v.useMemo(()=>s.find(h=>h.name===c)??null,[s,c]),u=d??Es,m=JSON.stringify(u);return e.jsxs(J,{title:"Model providers",badge:"model_providers",icon:e.jsx(ss,{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(P,{value:c,onValueChange:i,disabled:r,children:[e.jsx(O,{children:e.jsx(L,{placeholder:"Select provider"})}),e.jsxs(D,{children:[e.jsx(g,{value:"new",children:o("codex.createNewProvider")}),s.map(h=>e.jsx(g,{value:h.name,children:h.name},h.name))]})]}),e.jsx(Os,{initialDraft:u,isNew:c==="new",disabled:r,saving:l,canDelete:d!==null,onDelete:async()=>{d&&(await n(d.name),i("new"))},onSave:async(h,b)=>{await a(h,b),i(h)}},m)]})}function Ds({initialName:s,initialModel:r,initialProvider:t,initialEffort:l,providerNames:a,activeProfile:n,selectedEntryName:o,disabled:c,saving:i,onSave:d,onDelete:u,onSetActive:m}){const{t:h}=_(),[b,p]=v.useState(s),[w,R]=v.useState(r),[K,x]=v.useState(t),[j,E]=v.useState(l);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(y,{value:b,onChange:C=>p(C.target.value),placeholder:"deep-review",disabled:c||o!==null}),e.jsx(y,{value:w??"",onChange:C=>R(C.target.value||null),placeholder:"gpt-5.4",disabled:c}),e.jsxs(P,{value:K??"__unset__",onValueChange:C=>x(C==="__unset__"?null:C),disabled:c,children:[e.jsx(O,{children:e.jsx(L,{placeholder:h("codex.useGlobalProvider")})}),e.jsxs(D,{children:[e.jsx(g,{value:"__unset__",children:h("codex.useGlobalProvider")}),a.map(C=>e.jsx(g,{value:C,children:C},C))]})]}),e.jsxs(P,{value:j??"__unset__",onValueChange:C=>E(C==="__unset__"?null:C),disabled:c,children:[e.jsx(O,{children:e.jsx(L,{placeholder:h("codex.useGlobalEffort")})}),e.jsxs(D,{children:[e.jsx(g,{value:"__unset__",children:h("codex.useGlobalEffort")}),["minimal","low","medium","high","xhigh"].map(C=>e.jsx(g,{value:C,children:C},C))]})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(N,{variant:"outline",onClick:u,disabled:c||i||!o,children:[e.jsx(se,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsx(N,{variant:"outline",onClick:m,disabled:c||i||!o||o===n,children:"Set active"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(N,{variant:"outline",onClick:()=>d(b,{model:w,modelProvider:K,modelReasoningEffort:j},!1),disabled:c||i||b.trim().length===0,children:[i?e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save profile"]}),e.jsxs(N,{onClick:()=>d(b,{model:w,modelProvider:K,modelReasoningEffort:j},!0),disabled:c||i||b.trim().length===0,children:[i?e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save + activate"]})]})]})]})}function As({activeProfile:s,entries:r,providerNames:t,disabled:l=!1,disabledReason:a,saving:n=!1,onSave:o,onDelete:c,onSetActive:i}){const{t:d}=_(),[u,m]=v.useState("new"),h=v.useMemo(()=>r.find(p=>p.name===u)??null,[r,u]),b=JSON.stringify(h??{name:"",values:{}});return e.jsxs(J,{title:d("codex.profiles"),badge:"profiles",icon:e.jsx(rs,{className:"h-4 w-4"}),description:"Create reusable Codex overlays and set the active default profile.",disabledReason:a,children:[e.jsxs(P,{value:u,onValueChange:m,disabled:l,children:[e.jsx(O,{children:e.jsx(L,{placeholder:"Select profile"})}),e.jsxs(D,{children:[e.jsx(g,{value:"new",children:d("codex.createNewProfile")}),r.map(p=>e.jsxs(g,{value:p.name,children:[p.name,p.name===s?" (active)":""]},p.name))]})]}),e.jsx(Ds,{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:l,saving:n,onDelete:async()=>{h&&(await c(h.name),m("new"))},onSetActive:async()=>{h&&await i(h.name)},onSave:async(p,w,R)=>{await o(p,w,R),m(p)}},b)]})}function Rs({workspacePath:s,disabled:r,saving:t,onSave:l}){const{t:a}=_(),[n,o]=v.useState(s),[c,i]=v.useState("trusted");return e.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_160px_auto]",children:[e.jsx(y,{value:n,onChange:d=>o(d.target.value),placeholder:"~/repo or /absolute/path",disabled:r}),e.jsxs(P,{value:c,onValueChange:i,disabled:r,children:[e.jsx(O,{children:e.jsx(L,{})}),e.jsxs(D,{children:[e.jsx(g,{value:"trusted",children:a("codex.trusted")}),e.jsx(g,{value:"untrusted",children:a("codex.untrusted")})]})]}),e.jsxs(N,{onClick:()=>l(n,c),disabled:r||t,children:[t?e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save trust"]})]})}function Ms({workspacePath:s,entries:r,disabled:t=!1,disabledReason:l,saving:a=!1,onSave:n}){const{t:o}=_();return e.jsxs(J,{title:"Project trust",badge:"projects",icon:e.jsx(ts,{className:"h-4 w-4"}),description:"Trust current workspaces or remove stale trust entries without opening raw TOML.",disabledReason:l,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(Rs,{workspacePath:s,disabled:t,saving:a,onSave:n},s),e.jsx(N,{variant:"outline",className:"w-full justify-start",onClick:()=>n(s,"trusted"),disabled:t||a,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:o("codex.noProjectTrustEntries")}):r.map(c=>e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border px-3 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:c.path}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["trust_level = ",c.trustLevel]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>n(c.path,c.trustLevel==="trusted"?"untrusted":"trusted"),disabled:t||a,children:"Toggle"}),e.jsx(N,{variant:"ghost",size:"icon",onClick:()=>n(c.path,null),disabled:t||a,children:e.jsx(se,{className:"h-4 w-4"})})]})]},c.path))})]})}const A="__unset__",Is=105e4,Fs=272e3,ke=8e5,Se=7e5,Ws=new Intl.NumberFormat("en-US");function $(s){return s??A}function B(s,r){return r&&!s.includes(r)?[r,...s]:s}function de(s){return Ws.format(s)}function Us(s){return s?.trim().toLowerCase().startsWith("gpt-5.4")??!1}function Ks(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 qs({initialValues:s,providerNames:r,disabled:t,saving:l,onSave:a}){const{t:n}=_(),[o,c]=v.useState(s),i=B(["minimal","low","medium","high","xhigh"],o.modelReasoningEffort),d=B(r,o.modelProvider),u=B(["on-request","never","untrusted"],o.approvalPolicy),m=B(["read-only","workspace-write","danger-full-access"],o.sandboxMode),h=B(["cached","live","disabled"],o.webSearch),b=B(["none","friendly","pragmatic"],o.personality),p=Ks(s,o),w=Object.keys(p).length>0,R=Us(o.model),K=x=>{const j=x.trim();return j.length>0?Number(j):null};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.model")}),e.jsx(y,{value:o.model??"",onChange:x=>c(j=>({...j,model:x.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:n("codex.reasoningEffort")}),e.jsxs(P,{value:$(o.modelReasoningEffort),onValueChange:x=>c(j=>({...j,modelReasoningEffort:x===A?null:x})),disabled:t,children:[e.jsx(O,{children:e.jsx(L,{placeholder:n("codex.useDefault")})}),e.jsxs(D,{children:[e.jsx(g,{value:A,children:n("codex.useDefault")}),i.map(x=>e.jsx(g,{value:x,children:x},x))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.defaultProvider")}),e.jsxs(P,{value:$(o.modelProvider),onValueChange:x=>c(j=>({...j,modelProvider:x===A?null:x})),disabled:t,children:[e.jsx(O,{children:e.jsx(L,{placeholder:n("codex.useCodexDefault")})}),e.jsxs(D,{children:[e.jsx(g,{value:A,children:n("codex.useCodexDefault")}),d.map(x=>e.jsx(g,{value:x,children:x},x))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.approvalPolicy")}),e.jsxs(P,{value:$(o.approvalPolicy),onValueChange:x=>c(j=>({...j,approvalPolicy:x===A?null:x})),disabled:t,children:[e.jsx(O,{children:e.jsx(L,{placeholder:n("codex.useDefault")})}),e.jsxs(D,{children:[e.jsx(g,{value:A,children:n("codex.useDefault")}),u.map(x=>e.jsx(g,{value:x,children:x},x))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.sandboxMode")}),e.jsxs(P,{value:$(o.sandboxMode),onValueChange:x=>c(j=>({...j,sandboxMode:x===A?null:x})),disabled:t,children:[e.jsx(O,{children:e.jsx(L,{placeholder:n("codex.useDefault")})}),e.jsxs(D,{children:[e.jsx(g,{value:A,children:n("codex.useDefault")}),m.map(x=>e.jsx(g,{value:x,children:x},x))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.webSearch")}),e.jsxs(P,{value:$(o.webSearch),onValueChange:x=>c(j=>({...j,webSearch:x===A?null:x})),disabled:t,children:[e.jsx(O,{children:e.jsx(L,{placeholder:n("codex.useDefault")})}),e.jsxs(D,{children:[e.jsx(g,{value:A,children:n("codex.useDefault")}),h.map(x=>e.jsx(g,{value:x,children:x},x))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.toolOutputTokenLimit")}),e.jsx(y,{type:"number",min:1,value:o.toolOutputTokenLimit??"",onChange:x=>c(j=>({...j,toolOutputTokenLimit:x.target.value?Number(x.target.value):null})),placeholder:"25000",disabled:t})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.personality")}),e.jsxs(P,{value:$(o.personality),onValueChange:x=>c(j=>({...j,personality:x===A?null:x})),disabled:t,children:[e.jsx(O,{children:e.jsx(L,{placeholder:n("codex.useDefault")})}),e.jsxs(D,{children:[e.jsx(g,{value:A,children:n("codex.useDefault")}),b.map(x=>e.jsx(g,{value:x,children:x},x))]})]})]})]}),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(as,{className:"h-4 w-4 text-amber-600 dark:text-amber-300"}),e.jsx("p",{className:"text-sm font-semibold",children:n("codex.longContextOverride")}),e.jsx(k,{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(k,{variant:"secondary",className:"text-[10px] uppercase tracking-[0.16em] text-muted-foreground",children:R?"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(N,{type:"button",variant:"outline",size:"sm",disabled:t,onClick:()=>c(x=>({...x,modelContextWindow:ke,modelAutoCompactTokenLimit:Se})),children:"Fill cautious pair"}),e.jsx(N,{type:"button",variant:"outline",size:"sm",disabled:t,onClick:()=>c(x=>({...x,modelContextWindow:Is})),children:"Set official max window"}),e.jsx(N,{type:"button",variant:"ghost",size:"sm",disabled:t,onClick:()=>c(x=>({...x,modelContextWindow:null,modelAutoCompactTokenLimit:null})),children:"Clear"})]})]}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-3",children:[e.jsxs("div",{className:"rounded-lg border bg-background/85 px-3 py-3 shadow-sm shadow-black/5",children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:"Official max"}),e.jsx("p",{className:"mt-1 font-mono text-base font-semibold text-foreground",children:"1.05M / 1M"}),e.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:n("codex.gptContextCap")})]}),e.jsxs("div",{className:"rounded-lg border bg-background/85 px-3 py-3 shadow-sm shadow-black/5",children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:"Standard window"}),e.jsx("p",{className:"mt-1 font-mono text-base font-semibold text-foreground",children:de(Fs)}),e.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:n("codex.normalUsageWindow")})]}),e.jsxs("div",{className:"rounded-lg border bg-background/85 px-3 py-3 shadow-sm shadow-black/5",children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:"Above 272K"}),e.jsx("p",{className:"mt-1 font-mono text-base font-semibold text-foreground",children:n("codex.counts2x")}),e.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:n("codex.usageLimitCost")})]})]}),e.jsxs("div",{className:"space-y-3 rounded-lg border bg-background/75 px-3 py-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:"One cautious pair"}),e.jsxs("div",{className:"rounded-full border bg-background px-2.5 py-1 font-mono text-[11px] font-medium",children:["Context ",de(ke)]}),e.jsxs("div",{className:"rounded-full border bg-background px-2.5 py-1 font-mono text-[11px] font-medium",children:["Auto-compact ",de(Se)]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx(k,{variant:"outline",className:"border-border/70 bg-background/80 text-[10px] uppercase tracking-[0.14em] text-muted-foreground",children:"Not official"}),e.jsx(k,{variant:"outline",className:"border-border/70 bg-background/80 text-[10px] uppercase tracking-[0.14em] text-muted-foreground",children:"Draft only"})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] text-muted-foreground",children:[e.jsx("span",{children:n("codex.quickFillWarning")}),!R&&o.model?e.jsxs("span",{children:[e.jsx("code",{children:o.model})," should be checked separately."]}):null]})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.modelContextWindow")}),e.jsx(y,{"aria-label":n("codex.modelContextWindow"),type:"number",min:1,value:o.modelContextWindow??"",onChange:x=>c(j=>({...j,modelContextWindow:K(x.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:n("codex.autoCompactTokenLimit")}),e.jsx(y,{"aria-label":n("codex.autoCompactTokenLimit"),type:"number",min:1,value:o.modelAutoCompactTokenLimit??"",onChange:x=>c(j=>({...j,modelAutoCompactTokenLimit:K(x.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(N,{onClick:()=>a(p),disabled:t||l||!w,children:[l?e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save top-level settings"]})})]})}function Vs({values:s,providerNames:r,disabled:t=!1,disabledReason:l,saving:a=!1,onSave:n}){return e.jsx(J,{title:"Top-level controls",badge:"config.toml",icon:e.jsx(ns,{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:l,children:e.jsx(qs,{initialValues:s,providerNames:r,disabled:t,saving:a,onSave:n},JSON.stringify(s))})}function Gs({workspacePath:s,activeProfile:r,topLevelSettings:t,projectTrustEntries:l,profileEntries:a,modelProviderEntries:n,mcpServerEntries:o,featureCatalog:c,featureState:i,disabled:d,disabledReason:u,saving:m,onPatch:h}){const{t:b}=_();return e.jsx(pe,{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(ls,{className:"h-4 w-4"})}),e.jsx("div",{children:e.jsx("h2",{className:"text-base font-semibold tracking-tight text-foreground",children:b("codex.controlCenter")})})]}),e.jsxs("ul",{className:"grid gap-3 sm:grid-cols-2 text-sm text-muted-foreground",children:[e.jsxs("li",{className:"flex items-start gap-2.5",children:[e.jsx(os,{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(is,{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(cs,{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(Vs,{values:t,providerNames:n.map(p=>p.name),disabled:d,disabledReason:u,saving:m,onSave:p=>h({kind:"top-level",values:p},b("toasts.codexSaved"))}),e.jsx(Ms,{workspacePath:s,entries:l,disabled:d,disabledReason:u,saving:m,onSave:(p,w)=>h({kind:"project-trust",path:p,trustLevel:w},w?"Saved project trust entry.":"Removed project trust entry.")}),e.jsx(As,{activeProfile:r,entries:a,providerNames:n.map(p=>p.name),disabled:d,disabledReason:u,saving:m,onSave:(p,w,R)=>h({kind:"profile",action:"upsert",name:p,values:w,setAsActive:R},"Saved profile."),onDelete:p=>h({kind:"profile",action:"delete",name:p},"Deleted profile."),onSetActive:p=>h({kind:"profile",action:"set-active",name:p},"Set active profile.")}),e.jsx(Ls,{entries:n,disabled:d,disabledReason:u,saving:m,onSave:(p,w)=>h({kind:"model-provider",action:"upsert",name:p,values:w},"Saved model provider."),onDelete:p=>h({kind:"model-provider",action:"delete",name:p},"Deleted model provider.")}),e.jsx(_s,{entries:o,disabled:d,disabledReason:u,saving:m,onSave:(p,w)=>h({kind:"mcp-server",action:"upsert",name:p,values:w},"Saved MCP server."),onDelete:p=>h({kind:"mcp-server",action:"delete",name:p},"Deleted MCP server.")}),e.jsx(ks,{catalog:c,state:i,disabled:d,disabledReason:u,onToggle:(p,w)=>h({kind:"feature",feature:p,enabled:w},"Saved feature toggle.")})]})})}const Oe=`model_provider = "cliproxy"
2
-
3
- [model_providers.cliproxy]
4
- base_url = "http://127.0.0.1:8317/api/provider/codex"
5
- env_key = "CLIPROXY_API_KEY"
6
- wire_api = "responses"`,Le=[{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 G(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)?s:null}function T(s){return typeof s=="string"&&s.trim().length>0?s.trim():null}function H(s){return typeof s=="number"&&Number.isFinite(s)?s:null}function ue(s){return Array.isArray(s)?s.filter(r=>typeof r=="string").map(r=>r.trim()):[]}function De(s){return{model:T(s?.model),modelReasoningEffort:T(s?.model_reasoning_effort),modelContextWindow:H(s?.model_context_window),modelAutoCompactTokenLimit:H(s?.model_auto_compact_token_limit),modelProvider:T(s?.model_provider),approvalPolicy:T(s?.approval_policy),sandboxMode:T(s?.sandbox_mode),webSearch:T(s?.web_search),toolOutputTokenLimit:H(s?.tool_output_token_limit),personality:T(s?.personality)}}function Xs(s){const r=G(s?.projects);return r?Object.entries(r).map(([t,l])=>{const a=T(G(l)?.trust_level);return a?{path:t,trustLevel:a}:null}).filter(t=>t!==null).sort((t,l)=>t.path.localeCompare(l.path)):[]}function zs(s){const r=G(s?.profiles);return r?Object.entries(r).map(([t,l])=>({name:t,values:De(G(l))})).sort((t,l)=>t.name.localeCompare(l.name)):[]}function $s(s){const r=G(s?.model_providers);return r?Object.entries(r).map(([t,l])=>{const a=G(l);return a?{name:t,displayName:T(a.name),baseUrl:T(a.base_url),envKey:T(a.env_key),wireApi:T(a.wire_api),requiresOpenaiAuth:a.requires_openai_auth===!0,supportsWebsockets:a.supports_websockets===!0}:null}).filter(t=>t!==null).sort((t,l)=>t.name.localeCompare(l.name)):[]}function Bs(s){const r=G(s?.mcp_servers);return r?Object.entries(r).map(([t,l])=>{const a=G(l);if(!a)return null;const n=T(a.command)?"stdio":"streamable-http",o=H(a.startup_timeout_ms);return{name:t,transport:n,command:T(a.command),args:ue(a.args),url:T(a.url),enabled:a.enabled!==!1,required:a.required===!0,startupTimeoutSec:H(a.startup_timeout_sec)??(o!==null?o/1e3:null),toolTimeoutSec:H(a.tool_timeout_sec),enabledTools:ue(a.enabled_tools),disabledTools:ue(a.disabled_tools)}}).filter(t=>t!==null).sort((t,l)=>t.name.localeCompare(l.name)):[]}function Ys(s){const r=G(s?.features),t={};for(const l of Le){const a=r?.[l.name];t[l.name]=typeof a=="boolean"?a:null}if(r)for(const[l,a]of Object.entries(r))l in t||(t[l]=typeof a=="boolean"?a:null);return t}const Hs=[{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."}],Qs=[{provider:"openai",label:"OpenAI Responses API",apiFormat:"Responses API",url:"https://platform.openai.com/docs/api-reference/responses"}];function Js(s){const r=/https?:\/\/[^\s)]+/g,t=[];let l=0,a;for(;(a=r.exec(s))!==null;){const[n]=a,o=a.index;o>l&&t.push(s.slice(l,o)),t.push(e.jsx("a",{href:n,target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:n},`${n}-${o}`)),l=o+n.length}return l<s.length&&t.push(s.slice(l)),t.length>0?t:[s]}function Zs({diagnostics:s}){const{t:r}=_(),t=s.docsReference??{notes:[],links:[],providerDocs:[],providerValues:[],settingsHierarchy:[]},l=t.links.length>0?t.links:Hs,a=t.providerDocs.length>0?t.providerDocs:Qs;return e.jsx(pe,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 pr-1",children:[e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(W,{className:"flex items-center gap-2 text-base",children:[e.jsx(xe,{className:"h-4 w-4"}),"CCS bridge recipe"]})}),e.jsxs(U,{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:Oe}),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(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(W,{className:"flex items-center gap-2 text-base",children:[e.jsx(xe,{className:"h-4 w-4"}),"Upstream notes"]})}),e.jsxs(U,{className:"space-y-2 text-sm",children:[t.notes.length>0&&e.jsx("ul",{className:"ml-4 list-disc space-y-1.5 text-muted-foreground [&>li]:pl-1",children:t.notes.map((n,o)=>e.jsx("li",{children:Js(n)},`${o}-${n}`))}),e.jsx(Z,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:r("codex.codexDocs")}),e.jsx("div",{className:"space-y-1.5",children:l.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(be,{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(Z,{}),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(be,{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}`))})]}),t.providerValues.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(Z,{}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Provider values: ",t.providerValues.join(", ")]})]}),t.settingsHierarchy.length>0&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Settings hierarchy: ",t.settingsHierarchy.join(" -> ")]})]})]})]})})}function er(s,r){let t=s.slice(0,r).split(/\r\n|\n|\r/g);return[t.length,t.pop().length+1]}function sr(s,r,t){let l=s.split(/\r\n|\n|\r/g),a="",n=(Math.log10(r+1)|0)+1;for(let o=r-1;o<=r+1;o++){let c=l[o-1];c&&(a+=o.toString().padEnd(n," "),a+=": ",a+=c,a+=`
7
- `,o===r&&(a+=" ".repeat(n+t+2),a+=`^
8
- `))}return a}class f extends Error{line;column;codeblock;constructor(r,t){const[l,a]=er(t.toml,t.ptr),n=sr(t.toml,l,a);super(`Invalid TOML document: ${r}
9
-
10
- ${n}`,t),this.line=l,this.column=a,this.codeblock=n}}function rr(s,r){let t=0;for(;s[r-++t]==="\\";);return--t&&t%2}function me(s,r=0,t=s.length){let l=s.indexOf(`
11
- `,r);return s[l-1]==="\r"&&l--,l<=t?l:-1}function re(s,r){for(let t=r;t<s.length;t++){let l=s[t];if(l===`
12
- `)return t;if(l==="\r"&&s[t+1]===`
13
- `)return t+1;if(l<" "&&l!==" "||l==="")throw new f("control characters are not allowed in comments",{toml:s,ptr:r})}return s.length}function V(s,r,t,l){let a;for(;;){for(;(a=s[r])===" "||a===" "||!t&&(a===`
14
- `||a==="\r"&&s[r+1]===`
15
- `);)r++;if(l||a!=="#")break;r=re(s,r)}return r}function tr(s,r,t,l,a=!1){if(!l)return r=me(s,r),r<0?s.length:r;for(let n=r;n<s.length;n++){let o=s[n];if(o==="#")n=me(s,n);else{if(o===t)return n+1;if(o===l||a&&(o===`
16
- `||o==="\r"&&s[n+1]===`
17
- `))return n}}throw new f("cannot find end of structure",{toml:s,ptr:r})}function Ae(s,r){let t=s[r],l=t===s[r+1]&&s[r+1]===s[r+2]?s.slice(r,r+3):t;r+=l.length-1;do r=s.indexOf(l,++r);while(r>-1&&t!=="'"&&rr(s,r));return r>-1&&(r+=l.length,l.length>1&&(s[r]===t&&r++,s[r]===t&&r++)),r}let nr=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;class Y extends Date{#s=!1;#r=!1;#e=null;constructor(r){let t=!0,l=!0,a="Z";if(typeof r=="string"){let n=r.match(nr);n?(n[1]||(t=!1,r=`0000-01-01T${r}`),l=!!n[2],l&&r[10]===" "&&(r=r.replace(" ","T")),n[2]&&+n[2]>23?r="":(a=n[3]||null,r=r.toUpperCase(),!a&&l&&(r+="Z"))):r=""}super(r),isNaN(this.getTime())||(this.#s=t,this.#r=l,this.#e=a)}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 l=new Y(r);return l.#e=t,l}static wrapAsLocalDateTime(r){let t=new Y(r);return t.#e=null,t}static wrapAsLocalDate(r){let t=new Y(r);return t.#r=!1,t.#e=null,t}static wrapAsLocalTime(r){let t=new Y(r);return t.#s=!1,t.#e=null,t}}let ar=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,lr=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,or=/^[+-]?0[0-9_]/,ir=/^[0-9a-f]{2,8}$/i,Te={b:"\b",t:" ",n:`
18
- `,f:"\f",r:"\r",e:"\x1B",'"':'"',"\\":"\\"};function Re(s,r=0,t=s.length){let l=s[r]==="'",a=s[r++]===s[r]&&s[r]===s[r+1];a&&(t-=2,s[r+=2]==="\r"&&r++,s[r]===`
19
- `&&r++);let n=0,o,c="",i=r;for(;r<t-1;){let d=s[r++];if(d===`
20
- `||d==="\r"&&s[r]===`
21
- `){if(!a)throw new f("newlines are not allowed in strings",{toml:s,ptr:r-1})}else if(d<" "&&d!==" "||d==="")throw new f("control characters are not allowed in strings",{toml:s,ptr:r-1});if(o){if(o=!1,d==="x"||d==="u"||d==="U"){let u=s.slice(r,r+=d==="x"?2:d==="u"?4:8);if(!ir.test(u))throw new f("invalid unicode escape",{toml:s,ptr:n});try{c+=String.fromCodePoint(parseInt(u,16))}catch{throw new f("invalid unicode escape",{toml:s,ptr:n})}}else if(a&&(d===`
22
- `||d===" "||d===" "||d==="\r")){if(r=V(s,r-1,!0),s[r]!==`
23
- `&&s[r]!=="\r")throw new f("invalid escape: only line-ending whitespace may be escaped",{toml:s,ptr:n});r=V(s,r)}else if(d in Te)c+=Te[d];else throw new f("unrecognized escape sequence",{toml:s,ptr:n});i=r}else!l&&d==="\\"&&(n=r-1,o=!0,c+=s.slice(i,n))}return c+s.slice(i,t-1)}function cr(s,r,t,l){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 l?0n:0;let a=ar.test(s);if(a||lr.test(s)){if(or.test(s))throw new f("leading zeroes are not allowed",{toml:r,ptr:t});s=s.replace(/_/g,"");let o=+s;if(isNaN(o))throw new f("invalid number",{toml:r,ptr:t});if(a){if((a=!Number.isSafeInteger(o))&&!l)throw new f("integer value cannot be represented losslessly",{toml:r,ptr:t});(a||l===!0)&&(o=BigInt(s))}return o}const n=new Y(s);if(!n.isValid())throw new f("invalid value",{toml:r,ptr:t});return n}function dr(s,r,t){let l=s.slice(r,t),a=l.indexOf("#");return a>-1&&(re(s,a),l=l.slice(0,a)),[l.trimEnd(),a]}function fe(s,r,t,l,a){if(l===0)throw new f("document contains excessively nested structures. aborting.",{toml:s,ptr:r});let n=s[r];if(n==="["||n==="{"){let[i,d]=n==="["?mr(s,r,l,a):xr(s,r,l,a);if(t){if(d=V(s,d),s[d]===",")d++;else if(s[d]!==t)throw new f("expected comma or end of structure",{toml:s,ptr:d})}return[i,d]}let o;if(n==='"'||n==="'"){o=Ae(s,r);let i=Re(s,r,o);if(t){if(o=V(s,o),s[o]&&s[o]!==","&&s[o]!==t&&s[o]!==`
24
- `&&s[o]!=="\r")throw new f("unexpected character encountered",{toml:s,ptr:o});o+=+(s[o]===",")}return[i,o]}o=tr(s,r,",",t);let c=dr(s,r,o-+(s[o-1]===","));if(!c[0])throw new f("incomplete key-value declaration: no value specified",{toml:s,ptr:r});return t&&c[1]>-1&&(o=V(s,r+c[1]),o+=+(s[o]===",")),[cr(c[0],s,r,a),o]}let ur=/^[a-zA-Z0-9-_]+[ \t]*$/;function he(s,r,t="="){let l=r-1,a=[],n=s.indexOf(t,r);if(n<0)throw new f("incomplete key-value: cannot find end of key",{toml:s,ptr:r});do{let o=s[r=++l];if(o!==" "&&o!==" ")if(o==='"'||o==="'"){if(o===s[r+1]&&o===s[r+2])throw new f("multiline strings are not allowed in keys",{toml:s,ptr:r});let c=Ae(s,r);if(c<0)throw new f("unfinished string encountered",{toml:s,ptr:r});l=s.indexOf(".",c);let i=s.slice(c,l<0||l>n?n:l),d=me(i);if(d>-1)throw new f("newlines are not allowed in keys",{toml:s,ptr:r+l+d});if(i.trimStart())throw new f("found extra tokens after the string part",{toml:s,ptr:c});if(n<c&&(n=s.indexOf(t,c),n<0))throw new f("incomplete key-value: cannot find end of key",{toml:s,ptr:r});a.push(Re(s,r,c))}else{l=s.indexOf(".",r);let c=s.slice(r,l<0||l>n?n:l);if(!ur.test(c))throw new f("only letter, numbers, dashes and underscores are allowed in keys",{toml:s,ptr:r});a.push(c.trimEnd())}}while(l+1&&l<n);return[a,V(s,n+1,!0,!0)]}function xr(s,r,t,l){let a={},n=new Set,o;for(r++;(o=s[r++])!=="}"&&o;){if(o===",")throw new f("expected value, found comma",{toml:s,ptr:r-1});if(o==="#")r=re(s,r);else if(o!==" "&&o!==" "&&o!==`
25
- `&&o!=="\r"){let c,i=a,d=!1,[u,m]=he(s,r-1);for(let p=0;p<u.length;p++){if(p&&(i=d?i[c]:i[c]={}),c=u[p],(d=Object.hasOwn(i,c))&&(typeof i[c]!="object"||n.has(i[c])))throw new f("trying to redefine an already defined value",{toml:s,ptr:r});!d&&c==="__proto__"&&Object.defineProperty(i,c,{enumerable:!0,configurable:!0,writable:!0})}if(d)throw new f("trying to redefine an already defined value",{toml:s,ptr:r});let[h,b]=fe(s,m,"}",t-1,l);n.add(h),i[c]=h,r=b}}if(!o)throw new f("unfinished table encountered",{toml:s,ptr:r});return[a,r]}function mr(s,r,t,l){let a=[],n;for(r++;(n=s[r++])!=="]"&&n;){if(n===",")throw new f("expected value, found comma",{toml:s,ptr:r-1});if(n==="#")r=re(s,r);else if(n!==" "&&n!==" "&&n!==`
26
- `&&n!=="\r"){let o=fe(s,r-1,"]",t-1,l);a.push(o[0]),r=o[1]}}if(!n)throw new f("unfinished array encountered",{toml:s,ptr:r});return[a,r]}function _e(s,r,t,l){let a=r,n=t,o,c=!1,i;for(let d=0;d<s.length;d++){if(d){if(a=c?a[o]:a[o]={},n=(i=n[o]).c,l===0&&(i.t===1||i.t===2))return null;if(i.t===2){let u=a.length-1;a=a[u],n=n[u].c}}if(o=s[d],(c=Object.hasOwn(a,o))&&n[o]?.t===0&&n[o]?.d)return null;c||(o==="__proto__"&&(Object.defineProperty(a,o,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(n,o,{enumerable:!0,configurable:!0,writable:!0})),n[o]={t:d<s.length-1&&l===2?3:l,d:!1,i:0,c:{}})}if(i=n[o],i.t!==l&&!(l===1&&i.t===3)||(l===2&&(i.d||(i.d=!0,a[o]=[]),a[o].push(a={}),i.c[i.i++]=i={t:1,d:!1,i:0,c:{}}),i.d))return null;if(i.d=!0,l===1)a=c?a[o]:a[o]={};else if(l===0&&c)return null;return[o,a,i.c]}function hr(s,{maxDepth:r=1e3,integersAsBigInt:t}={}){let l={},a={},n=l,o=a;for(let c=V(s,0);c<s.length;){if(s[c]==="["){let i=s[++c]==="[",d=he(s,c+=+i,"]");if(i){if(s[d[1]-1]!=="]")throw new f("expected end of table declaration",{toml:s,ptr:d[1]-1});d[1]++}let u=_e(d[0],l,a,i?2:1);if(!u)throw new f("trying to redefine an already defined table or value",{toml:s,ptr:c});o=u[2],n=u[1],c=d[1]}else{let i=he(s,c),d=_e(i[0],n,o,0);if(!d)throw new f("trying to redefine an already defined table or value",{toml:s,ptr:c});let u=fe(s,i[1],void 0,r,t);d[1][d[0]]=u[0],c=u[1]}if(c=V(s,c,!0),s[c]&&s[c]!==`
27
- `&&s[c]!=="\r")throw new f("each key-value declaration must be followed by an end-of-line",{toml:s,ptr:c});c=V(s,c)}return l}function pr(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)}function fr(s){if(!s.trim())return{};const t=hr(s);if(!pr(t))throw new Error("TOML root must be a table.");return t}function Me(s){try{return{config:fr(s),parseError:null}}catch(r){return{config:null,parseError:r.message}}}async function jr(){const s=await fetch(ee("/codex/diagnostics"));if(!s.ok)throw new Error("Failed to fetch Codex diagnostics");return s.json()}async function gr(){const s=await fetch(ee("/codex/config/raw"));if(!s.ok)throw new Error("Failed to fetch Codex raw config");return s.json()}async function vr(s){const r=await fetch(ee("/codex/config/raw"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(r.status===409)throw new Ee("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 br(s){const r=await fetch(ee("/codex/config/patch"),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(r.status===409)throw new Ee("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 wr(){const s=bs(),r=Ne({queryKey:["codex-diagnostics"],queryFn:jr,refetchInterval:1e4}),t=Ne({queryKey:["codex-raw-config"],queryFn:gr}),l=Ce({mutationFn:vr,onSuccess:(n,o)=>{s.setQueryData(["codex-raw-config"],c=>{const i=c?.path??"$CODEX_HOME/config.toml",d=c?.resolvedPath??i,u=Me(o.rawText);return{path:i,resolvedPath:d,exists:!0,mtime:n.mtime,rawText:o.rawText,config:u.config,parseError:u.parseError,readError:null}}),s.invalidateQueries({queryKey:["codex-diagnostics"]})}}),a=Ce({mutationFn:br,onSuccess:n=>{s.setQueryData(["codex-raw-config"],n),s.invalidateQueries({queryKey:["codex-diagnostics"]})}});return v.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:l.mutate,saveRawConfigAsync:l.mutateAsync,isSavingRawConfig:l.isPending,patchConfig:a.mutate,patchConfigAsync:a.mutateAsync,isPatchingConfig:a.isPending}),[r.data,r.isLoading,r.error,r.refetch,t.data,t.isLoading,t.error,t.refetch,l.mutate,l.mutateAsync,l.isPending,a.mutate,a.mutateAsync,a.isPending])}const Nr=[{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 Cr({snippets:s=Nr}){const[r,t]=v.useState(null),{t:l}=_(),a=async(n,o)=>{await navigator.clipboard.writeText(n),t(o),setTimeout(()=>t(null),2e3)};return e.jsxs(I,{children:[e.jsx(F,{className:"pb-3",children:e.jsxs(W,{className:"text-lg flex items-center gap-2",children:[e.jsx(ds,{className:"w-5 h-5 text-muted-foreground"}),l("quickCommands.title")]})}),e.jsx(U,{children:e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:s.map((n,o)=>e.jsxs("div",{className:Pe("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(N,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>a(n.command,o),title:n.description,children:r===o?e.jsx(us,{className:"h-4 w-4 text-green-600"}):e.jsx(xs,{className:"h-4 w-4"})})]},o))})})]})}function yr(s){return!s||!Number.isFinite(s)?"N/A":new Date(s).toLocaleString()}function kr(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:Pe("text-right break-all",t&&"font-mono text-xs"),children:r})]})}function Sr({diagnostics:s}){const{t:r}=_(),t=s.config.activeProfile?`codex --profile ${s.config.activeProfile}`:"codex",l=s.binary.supportsConfigOverrides;return e.jsx(pe,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 pr-1",children:[e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(W,{className:"flex items-center gap-2 text-base",children:[e.jsx(ms,{className:"h-4 w-4"}),"How Codex works in CCS"]})}),e.jsx(U,{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:r("codex.nativeDesc")}),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:r("codex.apiProfilesDefault")})]})})]}),e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(W,{className:"flex items-center gap-2 text-base",children:[e.jsx(hs,{className:"h-4 w-4"}),"Runtime install"]})}),e.jsxs(U,{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:r("codex.status")}),e.jsx(k,{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(k,{variant:s.binary.supportsConfigOverrides?"default":"secondary",children:s.binary.supportsConfigOverrides?"Available":"Missing"})]})]})]}),e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(W,{className:"flex items-center gap-2 text-base",children:[e.jsx(we,{className:"h-4 w-4"}),"CLIProxy-backed native Codex"]})}),e.jsx(U,{className:"space-y-3 text-sm text-muted-foreground",children:l?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{children:e.jsx("strong",{children:r("codex.twoSupportedPaths")})}),e.jsxs("ul",{className:"ml-4 list-disc space-y-1 [&>li]:pl-1",children:[e.jsxs("li",{children:[e.jsx("strong",{children:"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:r("codex.codexNativeRecipe")}),e.jsx("pre",{className:"mt-2 overflow-x-auto rounded-md bg-background p-3 text-xs text-foreground",children:Oe})]}),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(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(W,{className:"flex items-center gap-2 text-base",children:[e.jsx(ps,{className:"h-4 w-4"}),"Config file"]})}),e.jsx(U,{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:r("codex.userConfig")}),s.file.exists?e.jsx(fs,{className:"h-4 w-4 text-green-600"}):e.jsx(js,{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:kr(s.file.sizeBytes)}),e.jsx(S,{label:"Last modified",value:yr(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(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(W,{className:"flex items-center gap-2 text-base",children:[e.jsx(xe,{className:"h-4 w-4"}),"Current user-layer summary"]})}),e.jsxs(U,{className:"space-y-3",children:[e.jsx(S,{label:r("codex.model"),value:s.config.model||"Not set",mono:!0}),e.jsx(S,{label:r("codex.defaultProvider"),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:r("codex.approvalPolicy"),value:s.config.approvalPolicy||"Not set",mono:!0}),e.jsx(S,{label:r("codex.sandboxMode"),value:s.config.sandboxMode||"Not set",mono:!0}),e.jsx(S,{label:r("codex.webSearch"),value:s.config.webSearch||"Not set",mono:!0}),e.jsx(Z,{}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs(k,{variant:"outline",className:"justify-center",children:["providers: ",s.config.modelProviderCount]}),e.jsxs(k,{variant:"outline",className:"justify-center",children:["profiles: ",s.config.profileCount]}),e.jsxs(k,{variant:"outline",className:"justify-center",children:["enabled features: ",s.config.enabledFeatures.length]}),e.jsxs(k,{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(k,{variant:"secondary",className:"font-mono text-[10px]",children:a},a))})]})]})]}),e.jsx(Cr,{snippets:[{label:"Native short alias",command:"ccsx",description:"Launch the short native Codex runtime alias."},{label:"CCS Codex shortcut",command:'ccsxp "your prompt"',description:l?r("codex.runBuiltInCodex"):"Requires a Codex build that exposes --config overrides."},{label:"Explicit provider route",command:'ccs codex --target codex "your prompt"',description:l?r("codex.runBuiltInCodexExplicit"):"Requires a Codex build that exposes --config overrides."},{label:s.config.activeProfile?"Inspect active profile":r("codex.openNativeCodex"),command:t,description:s.config.activeProfile?"Inspect the active named profile directly in native Codex.":"Open native Codex without forcing a named profile overlay."}]}),e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(W,{className:"flex items-center gap-2 text-base",children:[e.jsx(we,{className:"h-4 w-4"}),"Runtime vs provider"]})}),e.jsxs(U,{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:r("codex.nativeCodexRuntime")}),e.jsxs("ul",{className:"mt-2 flex-grow list-disc space-y-1.5 pl-4 text-muted-foreground [&>li]:pl-1",children:[e.jsx("li",{children:e.jsx("code",{children:"ccs-codex"})}),e.jsx("li",{children:e.jsx("code",{children:"ccsx"})}),e.jsx("li",{children:e.jsx("code",{children:"--target codex"})})]}),e.jsx(k,{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:r("codex.ccsCodexProvider")}),l?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(k,{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(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsx(W,{className:"text-base",children:r("codex.supportedFlows")})}),e.jsx(U,{children:e.jsxs(ws,{children:[e.jsx(Ns,{children:e.jsxs(ye,{children:[e.jsx(le,{children:r("codex.flow")}),e.jsx(le,{children:r("codex.status")}),e.jsx(le,{children:r("codex.notes")})]})}),e.jsx(Cs,{children:s.supportMatrix.map(a=>e.jsxs(ye,{children:[e.jsx(oe,{className:"font-mono text-xs",children:a.label}),e.jsx(oe,{children:e.jsx(k,{variant:a.supported?"default":"secondary",children:a.supported?"Yes":"No"})}),e.jsx(oe,{className:"text-xs text-muted-foreground",children:a.notes})]},a.id))})]})})]}),s.warnings.length>0&&e.jsxs(I,{className:"border-amber-200 bg-amber-50/50 dark:bg-amber-950/20",children:[e.jsx(F,{className:"pb-2",children:e.jsxs(W,{className:"flex items-center gap-2 text-base",children:[e.jsx(gs,{className:"h-4 w-4 text-amber-600"}),"Warnings"]})}),e.jsx(U,{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 Wr(){const{t:s}=_(),{diagnostics:r,diagnosticsLoading:t,diagnosticsError:l,refetchDiagnostics:a,rawConfig:n,rawConfigLoading:o,rawConfigError:c,refetchRawConfig:i,saveRawConfigAsync:d,isSavingRawConfig:u,patchConfigAsync:m,isPatchingConfig:h}=wr(),[b,p]=v.useState(null),w=n?.rawText??"",R=b??w,K=b!==null&&b!==w,x=Me(R),j=x.parseError?{valid:!1,error:x.parseError}:{valid:!0},E=n?.config??null,C=o||!n||K||n?.parseError!==null||n?.readError!==null,Ie=c?"Structured controls unavailable: failed to load the current config.toml.":n?.readError?`Structured controls unavailable: ${n.readError}`:K?j.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,Fe=v.useMemo(()=>De(E),[E]),We=v.useMemo(()=>Xs(E),[E]),Ue=v.useMemo(()=>zs(E),[E]),Ke=v.useMemo(()=>$s(E),[E]),qe=v.useMemo(()=>Bs(E),[E]),Ve=v.useMemo(()=>Ys(E),[E]),Ge=M=>{if(M===w){p(null);return}p(M)},Xe=async()=>{try{if((await Promise.all([a(),i()])).some(X=>!X||X.status==="error"||X.isError||X.error)){q.error(s("toasts.codexRefreshFailed"));return}p(null)}catch(M){q.error(M.message||s("toasts.codexRefreshError"))}},ze=async()=>{if(!j.valid){q.error(s("toasts.codexFixToml"));return}try{await d({rawText:R,expectedMtime:n?.exists?n.mtime:void 0}),p(null),q.success(s("toasts.codexSaved")),await a()}catch(M){ve(M)?q.error(s("toasts.codexChangedExternally")):q.error(M.message||s("toasts.codexSaveFailed"))}},$e=async(M,je)=>{try{await m({...M,expectedMtime:n?.exists?n.mtime:void 0}),p(null),q.success(je)}catch(X){ve(X)?q.error(s("toasts.codexChangedExternally")):q.error(X.message||s("toasts.codexUpdateFailed"))}},te="mt-0 h-full border-0 p-0 data-[state=inactive]:hidden",Be=()=>t?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..."]}):l||!r?e.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-destructive",children:"Failed to load Codex diagnostics."}):e.jsxs(Qe,{defaultValue:"overview",className:"flex h-full flex-col",children:[e.jsx("div",{className:"shrink-0 px-4 pt-4",children:e.jsxs(Je,{className:"grid w-full grid-cols-3",children:[e.jsx(ne,{value:"overview",children:s("codexPage.overview")}),e.jsx(ne,{value:"controls",children:s("codexPage.controlCenter")}),e.jsx(ne,{value:"docs",children:s("codexPage.docs")})]})}),e.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden px-4 pb-4 pt-3",children:[e.jsx(ae,{value:"overview",className:te,children:e.jsx(Sr,{diagnostics:r})}),e.jsx(ae,{value:"controls",className:te,children:e.jsx(Gs,{workspacePath:r.workspacePath,activeProfile:r.config.activeProfile,topLevelSettings:Fe,projectTrustEntries:We,profileEntries:Ue,modelProviderEntries:Ke,mcpServerEntries:qe,featureCatalog:Le,featureState:Ve,disabled:C,disabledReason:Ie,saving:h,onPatch:$e})}),e.jsx(ae,{value:"docs",className:te,children:e.jsx(Zs,{diagnostics:r})})]})]});return e.jsx("div",{className:"h-full min-h-0 overflow-hidden",children:e.jsxs(Ye,{direction:"horizontal",className:"h-full",children:[e.jsx(ge,{defaultSize:45,minSize:35,children:e.jsx("div",{className:"h-full border-r bg-muted/20",children:Be()})}),e.jsx(He,{className:"group flex w-2 cursor-col-resize items-center justify-center bg-border transition-colors hover:bg-primary/20",children:e.jsx(vs,{className:"h-3 w-3 text-muted-foreground group-hover:text-primary"})}),e.jsx(ge,{defaultSize:55,minSize:35,children:e.jsx(ys,{title:"Codex config.toml",pathLabel:n?.path||r?.file.path||"$CODEX_HOME/config.toml",loading:o,parseWarning:j.valid?n?.parseError:j.error,readWarning:n?.readError,value:R,dirty:K,readOnly:!!n?.readError,saving:u,saveDisabled:!K||u||o||!j.valid||!!n?.readError,onChange:M=>{Ge(M)},onSave:ze,onRefresh:Xe,onDiscard:()=>p(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{Wr as CodexPage};