@kaitranntt/ccs 7.73.1-dev.2 → 7.73.1-dev.4
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.
- package/README.md +3 -0
- package/dist/ui/assets/{accounts-CdmEv5jU.js → accounts-B830572d.js} +1 -1
- package/dist/ui/assets/{alert-dialog-pSzyQP3S.js → alert-dialog-DXdqyRvZ.js} +1 -1
- package/dist/ui/assets/{api-6xZ1yyns.js → api-ZdibJo1t.js} +1 -1
- package/dist/ui/assets/{auth-section-DJMuqfhE.js → auth-section-C5zA_IKC.js} +1 -1
- package/dist/ui/assets/{backups-section-DGKT51IG.js → backups-section-BD50d3Ks.js} +1 -1
- package/dist/ui/assets/{channels-DezQJzMm.js → channels-DB6oCzhb.js} +1 -1
- package/dist/ui/assets/{checkbox-D0fhe2bc.js → checkbox-B31y9NZ4.js} +1 -1
- package/dist/ui/assets/{claude-extension-zS7zGQAr.js → claude-extension-CfHHW5Bh.js} +1 -1
- package/dist/ui/assets/cliproxy-BQSzXOMq.js +3 -0
- package/dist/ui/assets/{cliproxy-ai-providers-DsMeN_St.js → cliproxy-ai-providers-D2PWVjG_.js} +1 -1
- package/dist/ui/assets/{cliproxy-control-panel-p9QVUsRu.js → cliproxy-control-panel-Dh0MOTBo.js} +1 -1
- package/dist/ui/assets/{codex-BibvFkeM.js → codex-NN7wN-Vm.js} +3 -3
- package/dist/ui/assets/{confirm-dialog-Cl3M6ytT.js → confirm-dialog-501NYQEI.js} +1 -1
- package/dist/ui/assets/{copilot-fBbT2Giy.js → copilot-CKysftVg.js} +1 -1
- package/dist/ui/assets/{cursor-Df6ARj5V.js → cursor-BYntx3WU.js} +1 -1
- package/dist/ui/assets/{droid-DxoeGW_k.js → droid-BoI5M9fG.js} +1 -1
- package/dist/ui/assets/{globalenv-section-Cpfv8x9d.js → globalenv-section-B3y8J6Su.js} +1 -1
- package/dist/ui/assets/{health-DftbLTPo.js → health-poXeqsdo.js} +1 -1
- package/dist/ui/assets/{index-BC_nh-r0.js → index-BmIC1TNI.js} +1 -1
- package/dist/ui/assets/{index-Bz4O7ubX.js → index-BrJU7DJe.js} +1 -1
- package/dist/ui/assets/index-CmAdgKyc.js +1 -0
- package/dist/ui/assets/{index-Dazklm4w.js → index-D_6C5xDE.js} +1 -1
- package/dist/ui/assets/index-DvsRe_Ab.js +72 -0
- package/dist/ui/assets/{index-BeGXGfW3.js → index-V6sDuG7c.js} +1 -1
- package/dist/ui/assets/{index-BU5nSuXf.js → index-WHelK_eu.js} +1 -1
- package/dist/ui/assets/{logs-BO4HN515.js → logs-GFG59ZNO.js} +1 -1
- package/dist/ui/assets/{masked-input-DOdZz311.js → masked-input-C3X9ShE6.js} +1 -1
- package/dist/ui/assets/{proxy-status-widget-BMrsa5c4.js → proxy-status-widget-BlB7y5Cc.js} +1 -1
- package/dist/ui/assets/{raw-json-settings-editor-panel-DxneYnUX.js → raw-json-settings-editor-panel-DqIGAU4M.js} +1 -1
- package/dist/ui/assets/{searchable-select-D5MLlu56.js → searchable-select-CiWJb83E.js} +1 -1
- package/dist/ui/assets/{separator-MbLyvcwG.js → separator-C8WoAtfl.js} +1 -1
- package/dist/ui/assets/{shared-Odb9AKYo.js → shared-FpITx2lN.js} +1 -1
- package/dist/ui/assets/{table-CtGeOCTd.js → table-BXBWE6lk.js} +1 -1
- package/dist/ui/assets/{updates-BnaFXuVV.js → updates-COAY1Ft3.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/package.json +5 -3
- package/scripts/ci-parity-gate.sh +8 -2
- package/scripts/run-test-bucket.js +181 -0
- package/dist/ui/assets/cliproxy-CllaWHzR.js +0 -3
- package/dist/ui/assets/index-Bg5fPsun.js +0 -1
- package/dist/ui/assets/index-CXjGRa6N.js +0 -72
package/dist/ui/assets/{cliproxy-ai-providers-DsMeN_St.js → cliproxy-ai-providers-D2PWVjG_.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as o,u as Fe,h as Ge}from"./react-vendor-CNOkPC89.js";import{c as B,
|
|
1
|
+
import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as o,u as Fe,h as Ge}from"./react-vendor-CNOkPC89.js";import{c as B,aG as pe,b8 as xe,B as p,a as Ue,b9 as Ie,ah as Ve,ai as ze,aj as Je,ak as _e,al as Qe,L,I as A,M as We,N as Xe,O as Ye,aD as Ze,d as y,ba as he,bb as Le,Y as ne,S as be,n as se,Q as je,R as Ne,U as X,V as Y,bc as we,bd as es,be as ss}from"./index-DvsRe_Ab.js";import{P as ts}from"./proxy-status-widget-BlB7y5Cc.js";import{C as rs}from"./confirm-dialog-501NYQEI.js";import{l as as,w as Re,m as Te,n as ge,aC as te,s as ns,R as de,Z as is,a9 as Ee,p as qe,O as ls,Q as os,at as ds,au as cs,_ as Ce,aM as Oe,aN as Ke,ai as He,ax as ms,aO as us}from"./icons-Dmi9qMuE.js";import{u as ps,a as fe,b as ve}from"./tanstack-CrmUhA7Z.js";import{t as G}from"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";import"./alert-dialog-DXdqyRvZ.js";function xs(s){switch(s){case"ready":return{icon:Te,text:"Ready",className:"text-green-600"};case"partial":return{icon:Re,text:"Needs attention",className:"text-amber-600"};default:return{icon:as,text:"Not configured",className:"text-muted-foreground"}}}function hs({families:s,selectedFamily:t,onSelect:r}){return e.jsx("div",{className:"space-y-1",children:s.map(n=>{const i=n.id===t,d=xs(n.status),h=d.icon;return e.jsx("button",{type:"button",onClick:()=>r(n.id),className:B("w-full cursor-pointer rounded-lg border px-3 py-2.5 text-left transition-colors",i?"border-primary/20 bg-primary/10":"border-transparent hover:bg-muted/70"),children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(pe,{provider:xe(n.id),size:"md"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:n.displayName}),n.entries.length>0&&e.jsx(p,{variant:"secondary",className:"h-4 px-1 text-[10px]",children:n.entries.length})]}),e.jsxs("div",{className:B("mt-0.5 flex items-center gap-1.5 text-xs",d.className),children:[e.jsx(h,{className:"h-3 w-3"}),e.jsx("span",{children:d.text})]})]}),e.jsx(p,{variant:"outline",className:"h-5 px-1.5 text-[9px] uppercase tracking-wide",children:n.authMode})]})},n.id)})})}function gs(s){switch(s){case"gemini-api-key":return{familyName:"Gemini",description:"Store the Gemini key here so CLIProxy can route Gemini requests without creating a separate CCS API Profile.",requiredNow:["Paste the Gemini API key.","Leave Base URL empty unless you use a custom Gemini host."],optionalLater:["Model mappings only when requested names and Gemini names differ.","Headers only when your provider setup requires them."],keyLabel:"Gemini API Key",keyPlaceholder:"AIza...",keyHelper:"This is the only field most Gemini setups need.",baseUrlPlaceholder:"https://generativelanguage.googleapis.com",baseUrlHelper:"Optional. Leave blank to keep the default Gemini endpoint.",aliasesPlaceholder:"claude-sonnet-4-5=gemini-2.5-pro",aliasesHelper:"Format: requested=upstream. Leave this blank unless the upstream Gemini model name differs.",headersPlaceholder:"X-Goog-User-Project: your-project"};case"codex-api-key":return{familyName:"Codex",description:"Store the Codex or OpenAI key here so CLIProxy can route Codex requests without duplicating the setup in API Profiles.",requiredNow:["Paste the Codex or OpenAI API key.","Leave Base URL empty unless this route should target another OpenAI-style endpoint."],optionalLater:["Model mappings only when the upstream model ID differs.","Headers only when org or project routing needs them."],keyLabel:"Codex API Key",keyPlaceholder:"sk-...",keyHelper:"This is the only field most Codex setups need.",baseUrlPlaceholder:"https://api.openai.com/v1",baseUrlHelper:"Optional. Leave blank to keep the default Codex endpoint.",aliasesPlaceholder:"claude-sonnet-4-5=gpt-5",aliasesHelper:"Format: requested=upstream. Add a mapping only when the upstream model name differs.",headersPlaceholder:"OpenAI-Organization: org_..."};case"claude-api-key":return{familyName:"Claude",description:"Store the Anthropic or compatible key here for CLIProxy-managed Claude routing. Save the key first, then add rewrites only if this route needs them.",requiredNow:["Paste the Claude or Anthropic-compatible API key.","Leave Base URL empty unless this route should target another compatible endpoint."],optionalLater:["Model mappings only when the requested and upstream Claude model IDs differ.","Proxy, prefix, exclusions, and headers only for advanced routing cases."],keyLabel:"Claude API Key",keyPlaceholder:"sk-ant-...",keyHelper:"Most Claude routes can start with the key only.",baseUrlPlaceholder:"https://api.anthropic.com",baseUrlHelper:"Optional. Leave blank to keep the default Claude-compatible endpoint.",aliasesPlaceholder:"claude-sonnet-4-5=claude-3-7-sonnet-latest",aliasesHelper:"Format: requested=upstream. Add a mapping only when the upstream model ID should differ.",headersPlaceholder:"X-Project: internal-routing"};case"vertex-api-key":return{familyName:"Vertex",description:"Store the Vertex key here so CLIProxy can route Vertex traffic without creating a separate CCS API Profile.",requiredNow:["Paste the Vertex API key.","Leave Base URL empty unless a regional or gateway endpoint is required."],optionalLater:["Model mappings only when the upstream name differs.","Headers only when the provider expects extra routing context."],keyLabel:"Vertex API Key",keyPlaceholder:"AIza...",keyHelper:"Most Vertex routes only need the key.",baseUrlPlaceholder:"https://vertex.googleapis.com",baseUrlHelper:"Optional. Leave blank to keep the default Vertex endpoint.",aliasesPlaceholder:"claude-sonnet-4-5=gemini-2.5-pro",aliasesHelper:"Format: requested=upstream. Leave blank unless the upstream model name differs.",headersPlaceholder:"X-Goog-User-Project: your-project"};case"openai-compatibility":return{familyName:"OpenAI-Compatible Connector",description:"Create a named connector for OpenRouter, Together, or any OpenAI-style endpoint. This page owns the connector setup directly inside CLIProxy.",requiredNow:["Pick a connector name such as openrouter or together.","Set the connector Base URL.","Add at least one API key before saving."],optionalLater:["Model mappings only when requested and upstream model names differ.","Headers only when the connector requires provider-specific auth or routing."],keyLabel:"API Keys",keyPlaceholder:"sk-...",keyHelper:"Add one key per line. Most connectors start with a single key.",connectorPlaceholder:"openrouter",connectorHelper:"This becomes the connector label in the saved entries list.",baseUrlPlaceholder:"https://openrouter.ai/api/v1",baseUrlHelper:"Required for connectors. This is the upstream OpenAI-style endpoint.",aliasesPlaceholder:"claude-sonnet-4-5=gpt-4.1",aliasesHelper:"Format: requested=upstream. Leave blank unless the connector expects a different model ID.",headersPlaceholder:"HTTP-Referer: https://your-app.example"}}}function ke(s){return s.split(`
|
|
2
2
|
`).map(t=>t.trim()).filter(t=>t.length>0)}function fs(s){return s.split(`
|
|
3
3
|
`).map(t=>t.trim()).filter(t=>t.length>0).map(t=>{const r=t.includes(":")?":":"=",[n,...i]=t.split(r);return{key:n.trim(),value:i.join(r).trim()}}).filter(t=>t.key.length>0)}function vs(s){return Le(s)}function Z({value:s,onChange:t,placeholder:r,rows:n=4}){return e.jsx("textarea",{rows:n,value:s,onChange:i=>t(i.target.value),placeholder:r,className:"flex min-h-24 w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs outline-none transition-[color,box-shadow] placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50"})}function ys(s){return(s?.headers||[]).map(t=>`${t.key}: ${t.value}`).join(`
|
|
4
4
|
`)}function bs(s){return(s?.excludedModels||[]).join(`
|
package/dist/ui/assets/{cliproxy-control-panel-p9QVUsRu.js → cliproxy-control-panel-Dh0MOTBo.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as s}from"./react-vendor-CNOkPC89.js";import{u as S}from"./tanstack-CrmUhA7Z.js";import{a as D,
|
|
1
|
+
import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as s}from"./react-vendor-CNOkPC89.js";import{u as S}from"./tanstack-CrmUhA7Z.js";import{a as D,bf as g,Y as I}from"./index-DvsRe_Ab.js";import{C as _}from"./default-ports-1QQSffYX.js";import{G as Q,R as $,w as X}from"./icons-Dmi9qMuE.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",O="isLoggedIn",U="apiBase",K="apiUrl",F="managementKey";function A(a){return a.startsWith("/")?new URL(a.replace(/\/$/,""),window.location.origin).href:a.replace(/\/$/,"")}function J(a,u){window.localStorage.removeItem(k),window.localStorage.setItem(U,a),window.localStorage.setItem(K,a),window.localStorage.setItem(F,u),window.localStorage.setItem(O,"true")}function T(){window.localStorage.removeItem(k),window.localStorage.removeItem(U),window.localStorage.removeItem(K),window.localStorage.removeItem(F),window.localStorage.removeItem(O)}function V({port:a=_}){const{t:u}=D(),f=s.useRef(null),[M,N]=s.useState(null),[B,Y]=s.useState(0),[L,v]=s.useState(null),[G,E]=s.useState(!1),{data:l,error:w}=S({queryKey:["cliproxy-server-config"],queryFn:()=>I.cliproxyServer.get(),staleTime:3e4});s.useEffect(()=>{w&&console.warn("[ControlPanelEmbed] Config fetch failed, using local mode:",w)},[w]);const j=!!(l?.remote?.enabled&&l?.remote?.host),{data:y,error:x}=S({queryKey:["auth-tokens-raw",j?"remote":"local"],enabled:l!==void 0&&!j,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 J(A(g("/cliproxy-local/")),o),n}catch(t){throw T(),t}},staleTime:3e4}),{managementUrl:R,checkUrl:h,authToken:b,isRemote:i,displayHost:c}=s.useMemo(()=>{const t=l?.remote,n=l?.local?.port??a;if(t?.enabled&&t?.host){const o=t.protocol||"http",m=t.port||(o==="https"?443:_),p=o==="https"&&m===443||o==="http"&&m===80?"":`:${m}`,r=`${o}://${t.host}${p}`;return{managementUrl:`${r}/management.html`,checkUrl:`${r}/`,authToken:t.auth_token||void 0,isRemote:!0,displayHost:`${t.host}${p}`}}return{managementUrl:g("/cliproxy-local/management.html"),checkUrl:g("/cliproxy-local/"),authToken:y?.managementSecret?.value||void 0,isRemote:!1,displayHost:`localhost:${n}`}},[l,y,a]),C=`${R}:${i?"remote":"local"}:${h}:${b??"missing"}:${B}`,P=l!==void 0&&(i||!!y||!!x);s.useEffect(()=>{x&&console.warn("[ControlPanelEmbed] Failed to preload local control panel session, falling back to manual login:",x)},[x]),s.useEffect(()=>{if(!i)return()=>{T()}},[i]);const H=!P||!(M===C),q=()=>{if(!(!i||!f.current?.contentWindow||!b))try{const t=A(h),n=new URL(`${t}/`).origin;if(new URL(f.current.src,window.location.origin).origin!==n){console.warn("[ControlPanelEmbed] Remote iframe origin mismatch, skipping postMessage");return}f.current.contentWindow.postMessage({type:"ccs-auto-login",apiBase:t,managementKey:b},n)}catch(t){console.debug("[ControlPanelEmbed] Remote postMessage bootstrap failed:",t)}};s.useEffect(()=>{const t=new AbortController;let n=!1;const o=(r,d)=>{n||(E(r),v(d))},m=async()=>{try{if(i){const r=l?.remote,d=await I.cliproxyServer.test({host:r?.host??"",port:r?.port,protocol:r?.protocol??"http",authToken:r?.auth_token});d?.reachable?o(!0,null):o(!1,d?.error?`Remote CLIProxy at ${c}: ${d.error}`:`Remote CLIProxy at ${c} returned an error`)}else(await fetch(h,{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 ${c} is not reachable`:"CLIProxy is not running")}},p=setTimeout(()=>t.abort(),2e3);return m().finally(()=>clearTimeout(p)),()=>{n=!0,t.abort()}},[h,i,c,l]);const W=()=>{N(C),q()},z=()=>{N(null),Y(t=>t+1),v(null),E(!1)};return!G&&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(Q,{className:"w-5 h-5 text-primary"}),e.jsx("h2",{className:"font-semibold",children:u("cliproxyHeader.cliproxyControlPanel")})]}),e.jsxs("button",{className:"inline-flex items-center gap-2 px-3 py-1.5 text-sm border rounded-md hover:bg-muted",onClick:z,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(X,{className:"w-8 h-8 text-destructive"})}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:u("cliproxyHeader.cliproxyNotAvailable")}),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:[H&&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 ${c}...`:"Loading Control Panel..."})]})}),P?e.jsx("iframe",{ref:f,src:R,className:"flex-1 w-full border-0",title:"CLIProxy Management Panel",onLoad:W},C):null]})})}function me(){return e.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:e.jsx(V,{})})}export{me as CliproxyControlPanelPage};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as N}from"./react-vendor-CNOkPC89.js";import{t as U}from"./notifications-B2HqRBj7.js";import{C as I,j as F,k as W,B as _,b as K,a as E,d as C,aG as J,r as P,s as O,t as D,v as L,w as b,I as S,n as fe,W as y,bc as se,bd as Pe,c as Oe,bj as He,bk as ve,bl as Qe,Q as Je,R as Ze,U as ae,V as oe,be}from"./index-CXjGRa6N.js";import{aa as es,aS as ss,at as re,L as z,n as rs,aT as ts,aU as ns,aC as as,w as os,a7 as ls,aV as is,aW as cs,aX as ds,ai as me,p as we,$ as xs,m as us,o as ms,_ as ps,S as hs,aN as Ne,aY as fs,x as gs,I as js,T as vs,N as bs}from"./icons-Dmi9qMuE.js";import{S as ee}from"./separator-MbLyvcwG.js";import{a as ws,u as ye,b as Ce}from"./tanstack-CrmUhA7Z.js";import"./code-highlight-BRUf_pqB.js";import{T as Ns,a as ys,b as Se,c as le,d as Cs,e as ie}from"./table-CtGeOCTd.js";import{R as Ss}from"./raw-json-settings-editor-panel-DxneYnUX.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";function Z({title:s,icon:r,badge:t,description:l,disabledReason:o,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(_,{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(K,{className:"space-y-3",children:[o?e.jsx("p",{className:"text-xs text-amber-600",children:o}):null,n]})]})}function _s({catalog:s,state:r,disabled:t=!1,disabledReason:l,onToggle:o}){const{t:n}=E(),a=new Set(s.map(i=>i.name)),c=Object.entries(r).filter(([i])=>!a.has(i)).sort(([i],[d])=>i.localeCompare(d));return e.jsxs(Z,{title:n("codex.features"),badge:"features",icon:e.jsx(es,{className:"h-4 w-4"}),description:n("codex.featuresDesc"),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(_,{variant:"outline",className:"font-mono text-[10px]",children:i.name})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:i.description})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[d!==null?e.jsx(C,{variant:"outline",size:"sm",onClick:()=>o(i.name,null),disabled:t,children:n("codex.useDefault")}):null,e.jsx(J,{checked:d===!0,onCheckedChange:m=>o(i.name,m),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:n("codex.configOnlyFlags")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n("codex.configOnlyFlagsDesc")})]}),c.map(([i,d])=>e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md border border-dashed px-3 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm font-medium",children:i}),e.jsx(_,{variant:"secondary",className:"text-[10px]",children:n("codex.existing")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n(d===null?"codex.nonBooleanForm":"codex.discoveredFromFile")})]}),d===null?e.jsx(_,{variant:"outline",children:n("codex.rawOnly")}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>o(i,null),disabled:t,children:n("codex.useDefault")}),e.jsx(J,{checked:d===!0,onCheckedChange:m=>o(i,m),disabled:t})]})]},i))]}):null]})}const ks={name:"",transport:"stdio",command:null,args:[],url:null,enabled:!0,required:!1,startupTimeoutSec:null,toolTimeoutSec:null,enabledTools:[],disabledTools:[],isCcsManaged:!1,managementSurface:null};function ce(s){return s.join(", ")}function de(s){return s.split(",").map(r=>r.trim()).filter(Boolean)}function Ts({initialDraft:s,isNew:r,disabled:t,saving:l,canDelete:o,onSave:n,onDelete:a}){const{t:c}=E(),[i,d]=N.useState(s),m=r&&i.name.trim()==="ccs_browser";return e.jsxs(e.Fragment,{children:[m?e.jsxs("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-900 dark:text-amber-200",children:[e.jsx("strong",{children:"ccs_browser"})," is reserved for the CCS-managed browser tooling path. Configure it from ",e.jsx("code",{children:"Settings > Browser"})," instead of creating it here."]}):null,e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(S,{value:i.name,onChange:p=>d(x=>({...x,name:p.target.value})),placeholder:"playwright",disabled:t||!r}),e.jsxs(P,{value:i.transport,onValueChange:p=>d(x=>({...x,transport:p})),disabled:t,children:[e.jsx(O,{children:e.jsx(D,{})}),e.jsxs(L,{children:[e.jsx(b,{value:"stdio",children:c("codex.stdio")}),e.jsx(b,{value:"streamable-http",children:c("codex.streamableHttp")})]})]}),i.transport==="stdio"?e.jsxs(e.Fragment,{children:[e.jsx(S,{value:i.command??"",onChange:p=>d(x=>({...x,command:p.target.value||null})),placeholder:"npx",disabled:t}),e.jsx(S,{value:ce(i.args),onChange:p=>d(x=>({...x,args:de(p.target.value)})),placeholder:"@playwright/mcp@latest, --flag",disabled:t})]}):e.jsx(S,{className:"sm:col-span-2",value:i.url??"",onChange:p=>d(x=>({...x,url:p.target.value||null})),placeholder:"https://example.test/mcp",disabled:t}),e.jsx(S,{type:"number",min:1,value:i.startupTimeoutSec??"",onChange:p=>d(x=>({...x,startupTimeoutSec:p.target.value?Number(p.target.value):null})),placeholder:"Startup timeout (sec)",disabled:t}),e.jsx(S,{type:"number",min:1,value:i.toolTimeoutSec??"",onChange:p=>d(x=>({...x,toolTimeoutSec:p.target.value?Number(p.target.value):null})),placeholder:"Tool timeout (sec)",disabled:t}),e.jsx(S,{value:ce(i.enabledTools),onChange:p=>d(x=>({...x,enabledTools:de(p.target.value)})),placeholder:"enabled_tools",disabled:t}),e.jsx(S,{value:ce(i.disabledTools),onChange:p=>d(x=>({...x,disabledTools:de(p.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(J,{checked:i.enabled,onCheckedChange:p=>d(x=>({...x,enabled:p})),disabled:t})]}),e.jsxs("label",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-sm",children:["Required",e.jsx(J,{checked:i.required,onCheckedChange:p=>d(x=>({...x,required:p})),disabled:t})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs(C,{variant:"outline",onClick:a,disabled:t||l||!o,children:[e.jsx(re,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsxs(C,{onClick:()=>n(i.name,{transport:i.transport,command:i.command,args:i.args,url:i.url,enabled:i.enabled,required:i.required,startupTimeoutSec:i.startupTimeoutSec,toolTimeoutSec:i.toolTimeoutSec,enabledTools:i.enabledTools,disabledTools:i.disabledTools}),disabled:t||l||i.name.trim().length===0||m,children:[l?e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save MCP server"]})]})]})}function Es({entries:s,disabled:r=!1,disabledReason:t,saving:l=!1,onSave:o,onDelete:n}){const{t:a}=E(),[c,i]=N.useState("new"),d=N.useMemo(()=>s.find(j=>j.name===c)??null,[s,c]),m=d??ks,p=JSON.stringify(m),x=d?.isCcsManaged&&d.managementSurface==="browser-settings";return e.jsxs(Z,{title:"MCP servers",badge:"mcp_servers",icon:e.jsx(ss,{className:"h-4 w-4"}),description:"Manage the safe MCP transport fields. Keep auth headers and bearer tokens in raw TOML.",disabledReason:t,children:[x?e.jsxs("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-900 dark:text-amber-200",children:[e.jsx("strong",{children:d?.name})," is CCS-managed. Configure browser tooling from"," ",e.jsx("code",{children:"Settings > Browser"}),"; the generic MCP editor is read-only for this entry."]}):null,e.jsxs(P,{value:c,onValueChange:i,disabled:r,children:[e.jsx(O,{children:e.jsx(D,{placeholder:"Select MCP server"})}),e.jsxs(L,{children:[e.jsx(b,{value:"new",children:a("codex.createNewMcpServer")}),s.map(j=>e.jsx(b,{value:j.name,children:j.isCcsManaged?`${j.name} (CCS managed)`:j.name},j.name))]})]}),e.jsx(Ts,{initialDraft:m,isNew:c==="new",disabled:r||!!x,saving:l,canDelete:d!==null&&!x,onDelete:async()=>{d&&(await n(d.name),i("new"))},onSave:async(j,h)=>{await o(j,h),i(j)}},p)]})}const Ps={name:"",displayName:null,baseUrl:null,envKey:null,wireApi:"responses",requiresOpenaiAuth:!1,supportsWebsockets:!1},Os={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 Ds({initialDraft:s,isNew:r,disabled:t,saving:l,canDelete:o,onSave:n,onDelete:a}){const{t:c}=E(),[i,d]=N.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(C,{variant:"outline",size:"sm",onClick:()=>d(Os),disabled:t,children:"Use CLIProxy Codex preset"})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(S,{value:i.name,onChange:m=>d(p=>({...p,name:m.target.value})),placeholder:"Provider id",disabled:t||!r}),e.jsx(S,{value:i.displayName??"",onChange:m=>d(p=>({...p,displayName:m.target.value||null})),placeholder:"Display name",disabled:t}),e.jsx(S,{value:i.baseUrl??"",onChange:m=>d(p=>({...p,baseUrl:m.target.value||null})),placeholder:"http://127.0.0.1:8317/api/provider/codex",disabled:t}),e.jsx(S,{value:i.envKey??"",onChange:m=>d(p=>({...p,envKey:m.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:m=>d(p=>({...p,wireApi:m})),disabled:t,children:[e.jsx(O,{children:e.jsx(D,{})}),e.jsx(L,{children:e.jsx(b,{value:"responses",children:c("codex.responses")})})]}),e.jsxs("label",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-sm",children:["Requires OpenAI auth",e.jsx(J,{checked:i.requiresOpenaiAuth,onCheckedChange:m=>d(p=>({...p,requiresOpenaiAuth:m})),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(J,{checked:i.supportsWebsockets,onCheckedChange:m=>d(p=>({...p,supportsWebsockets:m})),disabled:t})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs(C,{variant:"outline",onClick:a,disabled:t||l||!o,children:[e.jsx(re,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsxs(C,{onClick:()=>n(i.name,{displayName:i.displayName,baseUrl:i.baseUrl,envKey:i.envKey,wireApi:i.wireApi,requiresOpenaiAuth:i.requiresOpenaiAuth,supportsWebsockets:i.supportsWebsockets}),disabled: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:o,onDelete:n}){const{t:a}=E(),[c,i]=N.useState("new"),d=N.useMemo(()=>s.find(x=>x.name===c)??null,[s,c]),m=d??Ps,p=JSON.stringify(m);return e.jsxs(Z,{title:"Model providers",badge:"model_providers",icon:e.jsx(rs,{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(D,{placeholder:"Select provider"})}),e.jsxs(L,{children:[e.jsx(b,{value:"new",children:a("codex.createNewProvider")}),s.map(x=>e.jsx(b,{value:x.name,children:x.name},x.name))]})]}),e.jsx(Ds,{initialDraft:m,isNew:c==="new",disabled:r,saving:l,canDelete:d!==null,onDelete:async()=>{d&&(await n(d.name),i("new"))},onSave:async(x,j)=>{await o(x,j),i(x)}},p)]})}function As({initialName:s,initialModel:r,initialProvider:t,initialEffort:l,providerNames:o,activeProfile:n,selectedEntryName:a,disabled:c,saving:i,onSave:d,onDelete:m,onSetActive:p}){const{t:x}=E(),[j,h]=N.useState(s),[w,M]=N.useState(r),[q,u]=N.useState(t),[v,B]=N.useState(l);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(S,{value:j,onChange:g=>h(g.target.value),placeholder:"deep-review",disabled:c||a!==null}),e.jsx(S,{value:w??"",onChange:g=>M(g.target.value||null),placeholder:"gpt-5.4",disabled:c}),e.jsxs(P,{value:q??"__unset__",onValueChange:g=>u(g==="__unset__"?null:g),disabled:c,children:[e.jsx(O,{children:e.jsx(D,{placeholder:x("codex.useGlobalProvider")})}),e.jsxs(L,{children:[e.jsx(b,{value:"__unset__",children:x("codex.useGlobalProvider")}),o.map(g=>e.jsx(b,{value:g,children:g},g))]})]}),e.jsxs(P,{value:v??"__unset__",onValueChange:g=>B(g==="__unset__"?null:g),disabled:c,children:[e.jsx(O,{children:e.jsx(D,{placeholder:x("codex.useGlobalEffort")})}),e.jsxs(L,{children:[e.jsx(b,{value:"__unset__",children:x("codex.useGlobalEffort")}),["minimal","low","medium","high","xhigh"].map(g=>e.jsx(b,{value:g,children:g},g))]})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(C,{variant:"outline",onClick:m,disabled:c||i||!a,children:[e.jsx(re,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsx(C,{variant:"outline",onClick:p,disabled:c||i||!a||a===n,children:"Set active"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(C,{variant:"outline",onClick:()=>d(j,{model:w,modelProvider:q,modelReasoningEffort:v},!1),disabled:c||i||j.trim().length===0,children:[i?e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save profile"]}),e.jsxs(C,{onClick:()=>d(j,{model:w,modelProvider:q,modelReasoningEffort:v},!0),disabled:c||i||j.trim().length===0,children:[i?e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save + activate"]})]})]})]})}function Ms({activeProfile:s,entries:r,providerNames:t,disabled:l=!1,disabledReason:o,saving:n=!1,onSave:a,onDelete:c,onSetActive:i}){const{t:d}=E(),[m,p]=N.useState("new"),x=N.useMemo(()=>r.find(h=>h.name===m)??null,[r,m]),j=JSON.stringify(x??{name:"",values:{}});return e.jsxs(Z,{title:d("codex.profiles"),badge:"profiles",icon:e.jsx(ts,{className:"h-4 w-4"}),description:"Create reusable Codex overlays and set the active default profile.",disabledReason:o,children:[e.jsxs(P,{value:m,onValueChange:p,disabled:l,children:[e.jsx(O,{children:e.jsx(D,{placeholder:"Select profile"})}),e.jsxs(L,{children:[e.jsx(b,{value:"new",children:d("codex.createNewProfile")}),r.map(h=>e.jsxs(b,{value:h.name,children:[h.name,h.name===s?" (active)":""]},h.name))]})]}),e.jsx(As,{initialName:x?.name??"",initialModel:x?.values.model??null,initialProvider:x?.values.modelProvider??null,initialEffort:x?.values.modelReasoningEffort??null,providerNames:t,activeProfile:s,selectedEntryName:x?.name??null,disabled:l,saving:n,onDelete:async()=>{x&&(await c(x.name),p("new"))},onSetActive:async()=>{x&&await i(x.name)},onSave:async(h,w,M)=>{await a(h,w,M),p(h)}},j)]})}function Rs({workspacePath:s,disabled:r,saving:t,onSave:l}){const{t:o}=E(),[n,a]=N.useState(s),[c,i]=N.useState("trusted");return e.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_160px_auto]",children:[e.jsx(S,{value:n,onChange:d=>a(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(D,{})}),e.jsxs(L,{children:[e.jsx(b,{value:"trusted",children:o("codex.trusted")}),e.jsx(b,{value:"untrusted",children:o("codex.untrusted")})]})]}),e.jsxs(C,{onClick:()=>l(n,c),disabled:r||t,children:[t?e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save trust"]})]})}function Is({workspacePath:s,entries:r,disabled:t=!1,disabledReason:l,saving:o=!1,onSave:n}){const{t:a}=E();return e.jsxs(Z,{title:"Project trust",badge:"projects",icon:e.jsx(ns,{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:o,onSave:n},s),e.jsx(C,{variant:"outline",className:"w-full justify-start",onClick:()=>n(s,"trusted"),disabled:t||o,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:a("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(C,{variant:"ghost",size:"sm",onClick:()=>n(c.path,c.trustLevel==="trusted"?"untrusted":"trusted"),disabled:t||o,children:"Toggle"}),e.jsx(C,{variant:"ghost",size:"icon",onClick:()=>n(c.path,null),disabled:t||o,children:e.jsx(re,{className:"h-4 w-4"})})]})]},c.path))})]})}const A="__unset__",Fs=105e4,Ws=272e3,_e=8e5,ke=7e5,Ks=new Intl.NumberFormat("en-US");function X(s){return s??A}function Y(s,r){return r&&!s.includes(r)?[r,...s]:s}function xe(s){return Ks.format(s)}function qs(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 Vs({initialValues:s,providerNames:r,disabled:t,saving:l,onSave:o}){const{t:n}=E(),[a,c]=N.useState(s),i=Y(["minimal","low","medium","high","xhigh"],a.modelReasoningEffort),d=Y(r,a.modelProvider),m=Y(["on-request","never","untrusted"],a.approvalPolicy),p=Y(["read-only","workspace-write","danger-full-access"],a.sandboxMode),x=Y(["cached","live","disabled"],a.webSearch),j=Y(["none","friendly","pragmatic"],a.personality),h=Us(s,a),w=Object.keys(h).length>0,M=qs(a.model),q=u=>{const v=u.trim();return v.length>0?Number(v):null};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.model")}),e.jsx(S,{value:a.model??"",onChange:u=>c(v=>({...v,model:u.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:X(a.modelReasoningEffort),onValueChange:u=>c(v=>({...v,modelReasoningEffort:u===A?null:u})),disabled:t,children:[e.jsx(O,{children:e.jsx(D,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useDefault")}),i.map(u=>e.jsx(b,{value:u,children:u},u))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.defaultProvider")}),e.jsxs(P,{value:X(a.modelProvider),onValueChange:u=>c(v=>({...v,modelProvider:u===A?null:u})),disabled:t,children:[e.jsx(O,{children:e.jsx(D,{placeholder:n("codex.useCodexDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useCodexDefault")}),d.map(u=>e.jsx(b,{value:u,children:u},u))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.approvalPolicy")}),e.jsxs(P,{value:X(a.approvalPolicy),onValueChange:u=>c(v=>({...v,approvalPolicy:u===A?null:u})),disabled:t,children:[e.jsx(O,{children:e.jsx(D,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useDefault")}),m.map(u=>e.jsx(b,{value:u,children:u},u))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.sandboxMode")}),e.jsxs(P,{value:X(a.sandboxMode),onValueChange:u=>c(v=>({...v,sandboxMode:u===A?null:u})),disabled:t,children:[e.jsx(O,{children:e.jsx(D,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useDefault")}),p.map(u=>e.jsx(b,{value:u,children:u},u))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.webSearch")}),e.jsxs(P,{value:X(a.webSearch),onValueChange:u=>c(v=>({...v,webSearch:u===A?null:u})),disabled:t,children:[e.jsx(O,{children:e.jsx(D,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useDefault")}),x.map(u=>e.jsx(b,{value:u,children:u},u))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.toolOutputTokenLimit")}),e.jsx(S,{type:"number",min:1,value:a.toolOutputTokenLimit??"",onChange:u=>c(v=>({...v,toolOutputTokenLimit:u.target.value?Number(u.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:X(a.personality),onValueChange:u=>c(v=>({...v,personality:u===A?null:u})),disabled:t,children:[e.jsx(O,{children:e.jsx(D,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useDefault")}),j.map(u=>e.jsx(b,{value:u,children:u},u))]})]})]})]}),e.jsxs("div",{className:"space-y-4 rounded-xl border border-amber-500/30 bg-amber-500/5 p-4 shadow-sm dark:bg-amber-400/5",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(os,{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(_,{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(_,{variant:"secondary",className:"text-[10px] uppercase tracking-[0.16em] text-muted-foreground",children:M?"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(C,{type:"button",variant:"outline",size:"sm",disabled:t,onClick:()=>c(u=>({...u,modelContextWindow:_e,modelAutoCompactTokenLimit:ke})),children:"Fill cautious pair"}),e.jsx(C,{type:"button",variant:"outline",size:"sm",disabled:t,onClick:()=>c(u=>({...u,modelContextWindow:Fs})),children:"Set official max window"}),e.jsx(C,{type:"button",variant:"ghost",size:"sm",disabled:t,onClick:()=>c(u=>({...u,modelContextWindow:null,modelAutoCompactTokenLimit:null})),children:"Clear"})]})]}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-3",children:[e.jsxs("div",{className:"rounded-lg border bg-background/85 px-3 py-3 shadow-sm shadow-black/5",children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:"Official max"}),e.jsx("p",{className:"mt-1 font-mono text-base font-semibold text-foreground",children:"1.05M / 1M"}),e.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:n("codex.gptContextCap")})]}),e.jsxs("div",{className:"rounded-lg border bg-background/85 px-3 py-3 shadow-sm shadow-black/5",children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:"Standard window"}),e.jsx("p",{className:"mt-1 font-mono text-base font-semibold text-foreground",children:xe(Ws)}),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 ",xe(_e)]}),e.jsxs("div",{className:"rounded-full border bg-background px-2.5 py-1 font-mono text-[11px] font-medium",children:["Auto-compact ",xe(ke)]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx(_,{variant:"outline",className:"border-border/70 bg-background/80 text-[10px] uppercase tracking-[0.14em] text-muted-foreground",children:"Not official"}),e.jsx(_,{variant:"outline",className:"border-border/70 bg-background/80 text-[10px] uppercase tracking-[0.14em] text-muted-foreground",children:"Draft only"})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] text-muted-foreground",children:[e.jsx("span",{children:n("codex.quickFillWarning")}),!M&&a.model?e.jsxs("span",{children:[e.jsx("code",{children:a.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(S,{"aria-label":n("codex.modelContextWindow"),type:"number",min:1,value:a.modelContextWindow??"",onChange:u=>c(v=>({...v,modelContextWindow:q(u.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(S,{"aria-label":n("codex.autoCompactTokenLimit"),type:"number",min:1,value:a.modelAutoCompactTokenLimit??"",onChange:u=>c(v=>({...v,modelAutoCompactTokenLimit:q(u.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(C,{onClick:()=>o(h),disabled:t||l||!w,children:[l?e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save top-level settings"]})})]})}function Gs({values:s,providerNames:r,disabled:t=!1,disabledReason:l,saving:o=!1,onSave:n}){return e.jsx(Z,{title:"Top-level controls",badge:"config.toml",icon:e.jsx(as,{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(Vs,{initialValues:s,providerNames:r,disabled:t,saving:o,onSave:n},JSON.stringify(s))})}function Bs({workspacePath:s,activeProfile:r,topLevelSettings:t,projectTrustEntries:l,profileEntries:o,modelProviderEntries:n,mcpServerEntries:a,featureCatalog:c,featureState:i,disabled:d,disabledReason:m,saving:p,onPatch:x}){const{t:j}=E();return e.jsx(fe,{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:j("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(is,{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(cs,{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(ds,{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(Gs,{values:t,providerNames:n.map(h=>h.name),disabled:d,disabledReason:m,saving:p,onSave:h=>x({kind:"top-level",values:h},j("toasts.codexSaved"))}),e.jsx(Is,{workspacePath:s,entries:l,disabled:d,disabledReason:m,saving:p,onSave:(h,w)=>x({kind:"project-trust",path:h,trustLevel:w},w?"Saved project trust entry.":"Removed project trust entry.")}),e.jsx(Ms,{activeProfile:r,entries:o,providerNames:n.map(h=>h.name),disabled:d,disabledReason:m,saving:p,onSave:(h,w,M)=>x({kind:"profile",action:"upsert",name:h,values:w,setAsActive:M},"Saved profile."),onDelete:h=>x({kind:"profile",action:"delete",name:h},"Deleted profile."),onSetActive:h=>x({kind:"profile",action:"set-active",name:h},"Set active profile.")}),e.jsx(Ls,{entries:n,disabled:d,disabledReason:m,saving:p,onSave:(h,w)=>x({kind:"model-provider",action:"upsert",name:h,values:w},"Saved model provider."),onDelete:h=>x({kind:"model-provider",action:"delete",name:h},"Deleted model provider.")}),e.jsx(Es,{entries:a,disabled:d,disabledReason:m,saving:p,onSave:(h,w)=>x({kind:"mcp-server",action:"upsert",name:h,values:w},"Saved MCP server."),onDelete:h=>x({kind:"mcp-server",action:"delete",name:h},"Deleted MCP server.")}),e.jsx(_s,{catalog:c,state:i,disabled:d,disabledReason:m,onToggle:(h,w)=>x({kind:"feature",feature:h,enabled:w},"Saved feature toggle.")})]})})}const De=`model_provider = "cliproxy"
|
|
1
|
+
import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as N}from"./react-vendor-CNOkPC89.js";import{t as U}from"./notifications-B2HqRBj7.js";import{C as I,j as F,k as W,B as _,b as K,a as E,d as C,aI as J,r as P,s as O,t as D,v as L,w as b,I as S,n as fe,W as y,bf as se,bg as Pe,c as Oe,bm as He,bn as ve,bo as Qe,Q as Je,R as Ze,U as ae,V as oe,bh as be}from"./index-DvsRe_Ab.js";import{aa as es,aS as ss,at as re,L as z,n as rs,aT as ts,aU as ns,aC as as,w as os,a7 as ls,aV as is,aW as cs,aX as ds,ai as me,p as we,$ as xs,m as us,o as ms,_ as ps,S as hs,aN as Ne,aY as fs,x as gs,I as js,T as vs,N as bs}from"./icons-Dmi9qMuE.js";import{S as ee}from"./separator-C8WoAtfl.js";import{a as ws,u as ye,b as Ce}from"./tanstack-CrmUhA7Z.js";import"./code-highlight-BRUf_pqB.js";import{T as Ns,a as ys,b as Se,c as le,d as Cs,e as ie}from"./table-BXBWE6lk.js";import{R as Ss}from"./raw-json-settings-editor-panel-DqIGAU4M.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";function Z({title:s,icon:r,badge:t,description:l,disabledReason:o,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(_,{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(K,{className:"space-y-3",children:[o?e.jsx("p",{className:"text-xs text-amber-600",children:o}):null,n]})]})}function _s({catalog:s,state:r,disabled:t=!1,disabledReason:l,onToggle:o}){const{t:n}=E(),a=new Set(s.map(i=>i.name)),c=Object.entries(r).filter(([i])=>!a.has(i)).sort(([i],[d])=>i.localeCompare(d));return e.jsxs(Z,{title:n("codex.features"),badge:"features",icon:e.jsx(es,{className:"h-4 w-4"}),description:n("codex.featuresDesc"),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(_,{variant:"outline",className:"font-mono text-[10px]",children:i.name})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:i.description})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[d!==null?e.jsx(C,{variant:"outline",size:"sm",onClick:()=>o(i.name,null),disabled:t,children:n("codex.useDefault")}):null,e.jsx(J,{checked:d===!0,onCheckedChange:m=>o(i.name,m),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:n("codex.configOnlyFlags")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n("codex.configOnlyFlagsDesc")})]}),c.map(([i,d])=>e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md border border-dashed px-3 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm font-medium",children:i}),e.jsx(_,{variant:"secondary",className:"text-[10px]",children:n("codex.existing")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n(d===null?"codex.nonBooleanForm":"codex.discoveredFromFile")})]}),d===null?e.jsx(_,{variant:"outline",children:n("codex.rawOnly")}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>o(i,null),disabled:t,children:n("codex.useDefault")}),e.jsx(J,{checked:d===!0,onCheckedChange:m=>o(i,m),disabled:t})]})]},i))]}):null]})}const ks={name:"",transport:"stdio",command:null,args:[],url:null,enabled:!0,required:!1,startupTimeoutSec:null,toolTimeoutSec:null,enabledTools:[],disabledTools:[],isCcsManaged:!1,managementSurface:null};function ce(s){return s.join(", ")}function de(s){return s.split(",").map(r=>r.trim()).filter(Boolean)}function Ts({initialDraft:s,isNew:r,disabled:t,saving:l,canDelete:o,onSave:n,onDelete:a}){const{t:c}=E(),[i,d]=N.useState(s),m=r&&i.name.trim()==="ccs_browser";return e.jsxs(e.Fragment,{children:[m?e.jsxs("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-900 dark:text-amber-200",children:[e.jsx("strong",{children:"ccs_browser"})," is reserved for the CCS-managed browser tooling path. Configure it from ",e.jsx("code",{children:"Settings > Browser"})," instead of creating it here."]}):null,e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(S,{value:i.name,onChange:p=>d(x=>({...x,name:p.target.value})),placeholder:"playwright",disabled:t||!r}),e.jsxs(P,{value:i.transport,onValueChange:p=>d(x=>({...x,transport:p})),disabled:t,children:[e.jsx(O,{children:e.jsx(D,{})}),e.jsxs(L,{children:[e.jsx(b,{value:"stdio",children:c("codex.stdio")}),e.jsx(b,{value:"streamable-http",children:c("codex.streamableHttp")})]})]}),i.transport==="stdio"?e.jsxs(e.Fragment,{children:[e.jsx(S,{value:i.command??"",onChange:p=>d(x=>({...x,command:p.target.value||null})),placeholder:"npx",disabled:t}),e.jsx(S,{value:ce(i.args),onChange:p=>d(x=>({...x,args:de(p.target.value)})),placeholder:"@playwright/mcp@latest, --flag",disabled:t})]}):e.jsx(S,{className:"sm:col-span-2",value:i.url??"",onChange:p=>d(x=>({...x,url:p.target.value||null})),placeholder:"https://example.test/mcp",disabled:t}),e.jsx(S,{type:"number",min:1,value:i.startupTimeoutSec??"",onChange:p=>d(x=>({...x,startupTimeoutSec:p.target.value?Number(p.target.value):null})),placeholder:"Startup timeout (sec)",disabled:t}),e.jsx(S,{type:"number",min:1,value:i.toolTimeoutSec??"",onChange:p=>d(x=>({...x,toolTimeoutSec:p.target.value?Number(p.target.value):null})),placeholder:"Tool timeout (sec)",disabled:t}),e.jsx(S,{value:ce(i.enabledTools),onChange:p=>d(x=>({...x,enabledTools:de(p.target.value)})),placeholder:"enabled_tools",disabled:t}),e.jsx(S,{value:ce(i.disabledTools),onChange:p=>d(x=>({...x,disabledTools:de(p.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(J,{checked:i.enabled,onCheckedChange:p=>d(x=>({...x,enabled:p})),disabled:t})]}),e.jsxs("label",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-sm",children:["Required",e.jsx(J,{checked:i.required,onCheckedChange:p=>d(x=>({...x,required:p})),disabled:t})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs(C,{variant:"outline",onClick:a,disabled:t||l||!o,children:[e.jsx(re,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsxs(C,{onClick:()=>n(i.name,{transport:i.transport,command:i.command,args:i.args,url:i.url,enabled:i.enabled,required:i.required,startupTimeoutSec:i.startupTimeoutSec,toolTimeoutSec:i.toolTimeoutSec,enabledTools:i.enabledTools,disabledTools:i.disabledTools}),disabled:t||l||i.name.trim().length===0||m,children:[l?e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save MCP server"]})]})]})}function Es({entries:s,disabled:r=!1,disabledReason:t,saving:l=!1,onSave:o,onDelete:n}){const{t:a}=E(),[c,i]=N.useState("new"),d=N.useMemo(()=>s.find(j=>j.name===c)??null,[s,c]),m=d??ks,p=JSON.stringify(m),x=d?.isCcsManaged&&d.managementSurface==="browser-settings";return e.jsxs(Z,{title:"MCP servers",badge:"mcp_servers",icon:e.jsx(ss,{className:"h-4 w-4"}),description:"Manage the safe MCP transport fields. Keep auth headers and bearer tokens in raw TOML.",disabledReason:t,children:[x?e.jsxs("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-900 dark:text-amber-200",children:[e.jsx("strong",{children:d?.name})," is CCS-managed. Configure browser tooling from"," ",e.jsx("code",{children:"Settings > Browser"}),"; the generic MCP editor is read-only for this entry."]}):null,e.jsxs(P,{value:c,onValueChange:i,disabled:r,children:[e.jsx(O,{children:e.jsx(D,{placeholder:"Select MCP server"})}),e.jsxs(L,{children:[e.jsx(b,{value:"new",children:a("codex.createNewMcpServer")}),s.map(j=>e.jsx(b,{value:j.name,children:j.isCcsManaged?`${j.name} (CCS managed)`:j.name},j.name))]})]}),e.jsx(Ts,{initialDraft:m,isNew:c==="new",disabled:r||!!x,saving:l,canDelete:d!==null&&!x,onDelete:async()=>{d&&(await n(d.name),i("new"))},onSave:async(j,h)=>{await o(j,h),i(j)}},p)]})}const Ps={name:"",displayName:null,baseUrl:null,envKey:null,wireApi:"responses",requiresOpenaiAuth:!1,supportsWebsockets:!1},Os={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 Ds({initialDraft:s,isNew:r,disabled:t,saving:l,canDelete:o,onSave:n,onDelete:a}){const{t:c}=E(),[i,d]=N.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(C,{variant:"outline",size:"sm",onClick:()=>d(Os),disabled:t,children:"Use CLIProxy Codex preset"})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(S,{value:i.name,onChange:m=>d(p=>({...p,name:m.target.value})),placeholder:"Provider id",disabled:t||!r}),e.jsx(S,{value:i.displayName??"",onChange:m=>d(p=>({...p,displayName:m.target.value||null})),placeholder:"Display name",disabled:t}),e.jsx(S,{value:i.baseUrl??"",onChange:m=>d(p=>({...p,baseUrl:m.target.value||null})),placeholder:"http://127.0.0.1:8317/api/provider/codex",disabled:t}),e.jsx(S,{value:i.envKey??"",onChange:m=>d(p=>({...p,envKey:m.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:m=>d(p=>({...p,wireApi:m})),disabled:t,children:[e.jsx(O,{children:e.jsx(D,{})}),e.jsx(L,{children:e.jsx(b,{value:"responses",children:c("codex.responses")})})]}),e.jsxs("label",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-sm",children:["Requires OpenAI auth",e.jsx(J,{checked:i.requiresOpenaiAuth,onCheckedChange:m=>d(p=>({...p,requiresOpenaiAuth:m})),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(J,{checked:i.supportsWebsockets,onCheckedChange:m=>d(p=>({...p,supportsWebsockets:m})),disabled:t})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs(C,{variant:"outline",onClick:a,disabled:t||l||!o,children:[e.jsx(re,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsxs(C,{onClick:()=>n(i.name,{displayName:i.displayName,baseUrl:i.baseUrl,envKey:i.envKey,wireApi:i.wireApi,requiresOpenaiAuth:i.requiresOpenaiAuth,supportsWebsockets:i.supportsWebsockets}),disabled: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:o,onDelete:n}){const{t:a}=E(),[c,i]=N.useState("new"),d=N.useMemo(()=>s.find(x=>x.name===c)??null,[s,c]),m=d??Ps,p=JSON.stringify(m);return e.jsxs(Z,{title:"Model providers",badge:"model_providers",icon:e.jsx(rs,{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(D,{placeholder:"Select provider"})}),e.jsxs(L,{children:[e.jsx(b,{value:"new",children:a("codex.createNewProvider")}),s.map(x=>e.jsx(b,{value:x.name,children:x.name},x.name))]})]}),e.jsx(Ds,{initialDraft:m,isNew:c==="new",disabled:r,saving:l,canDelete:d!==null,onDelete:async()=>{d&&(await n(d.name),i("new"))},onSave:async(x,j)=>{await o(x,j),i(x)}},p)]})}function As({initialName:s,initialModel:r,initialProvider:t,initialEffort:l,providerNames:o,activeProfile:n,selectedEntryName:a,disabled:c,saving:i,onSave:d,onDelete:m,onSetActive:p}){const{t:x}=E(),[j,h]=N.useState(s),[w,M]=N.useState(r),[q,u]=N.useState(t),[v,G]=N.useState(l);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(S,{value:j,onChange:g=>h(g.target.value),placeholder:"deep-review",disabled:c||a!==null}),e.jsx(S,{value:w??"",onChange:g=>M(g.target.value||null),placeholder:"gpt-5.4",disabled:c}),e.jsxs(P,{value:q??"__unset__",onValueChange:g=>u(g==="__unset__"?null:g),disabled:c,children:[e.jsx(O,{children:e.jsx(D,{placeholder:x("codex.useGlobalProvider")})}),e.jsxs(L,{children:[e.jsx(b,{value:"__unset__",children:x("codex.useGlobalProvider")}),o.map(g=>e.jsx(b,{value:g,children:g},g))]})]}),e.jsxs(P,{value:v??"__unset__",onValueChange:g=>G(g==="__unset__"?null:g),disabled:c,children:[e.jsx(O,{children:e.jsx(D,{placeholder:x("codex.useGlobalEffort")})}),e.jsxs(L,{children:[e.jsx(b,{value:"__unset__",children:x("codex.useGlobalEffort")}),["minimal","low","medium","high","xhigh"].map(g=>e.jsx(b,{value:g,children:g},g))]})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(C,{variant:"outline",onClick:m,disabled:c||i||!a,children:[e.jsx(re,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsx(C,{variant:"outline",onClick:p,disabled:c||i||!a||a===n,children:"Set active"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(C,{variant:"outline",onClick:()=>d(j,{model:w,modelProvider:q,modelReasoningEffort:v},!1),disabled:c||i||j.trim().length===0,children:[i?e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save profile"]}),e.jsxs(C,{onClick:()=>d(j,{model:w,modelProvider:q,modelReasoningEffort:v},!0),disabled:c||i||j.trim().length===0,children:[i?e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save + activate"]})]})]})]})}function Ms({activeProfile:s,entries:r,providerNames:t,disabled:l=!1,disabledReason:o,saving:n=!1,onSave:a,onDelete:c,onSetActive:i}){const{t:d}=E(),[m,p]=N.useState("new"),x=N.useMemo(()=>r.find(h=>h.name===m)??null,[r,m]),j=JSON.stringify(x??{name:"",values:{}});return e.jsxs(Z,{title:d("codex.profiles"),badge:"profiles",icon:e.jsx(ts,{className:"h-4 w-4"}),description:"Create reusable Codex overlays and set the active default profile.",disabledReason:o,children:[e.jsxs(P,{value:m,onValueChange:p,disabled:l,children:[e.jsx(O,{children:e.jsx(D,{placeholder:"Select profile"})}),e.jsxs(L,{children:[e.jsx(b,{value:"new",children:d("codex.createNewProfile")}),r.map(h=>e.jsxs(b,{value:h.name,children:[h.name,h.name===s?" (active)":""]},h.name))]})]}),e.jsx(As,{initialName:x?.name??"",initialModel:x?.values.model??null,initialProvider:x?.values.modelProvider??null,initialEffort:x?.values.modelReasoningEffort??null,providerNames:t,activeProfile:s,selectedEntryName:x?.name??null,disabled:l,saving:n,onDelete:async()=>{x&&(await c(x.name),p("new"))},onSetActive:async()=>{x&&await i(x.name)},onSave:async(h,w,M)=>{await a(h,w,M),p(h)}},j)]})}function Rs({workspacePath:s,disabled:r,saving:t,onSave:l}){const{t:o}=E(),[n,a]=N.useState(s),[c,i]=N.useState("trusted");return e.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_160px_auto]",children:[e.jsx(S,{value:n,onChange:d=>a(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(D,{})}),e.jsxs(L,{children:[e.jsx(b,{value:"trusted",children:o("codex.trusted")}),e.jsx(b,{value:"untrusted",children:o("codex.untrusted")})]})]}),e.jsxs(C,{onClick:()=>l(n,c),disabled:r||t,children:[t?e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save trust"]})]})}function Is({workspacePath:s,entries:r,disabled:t=!1,disabledReason:l,saving:o=!1,onSave:n}){const{t:a}=E();return e.jsxs(Z,{title:"Project trust",badge:"projects",icon:e.jsx(ns,{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:o,onSave:n},s),e.jsx(C,{variant:"outline",className:"w-full justify-start",onClick:()=>n(s,"trusted"),disabled:t||o,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:a("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(C,{variant:"ghost",size:"sm",onClick:()=>n(c.path,c.trustLevel==="trusted"?"untrusted":"trusted"),disabled:t||o,children:"Toggle"}),e.jsx(C,{variant:"ghost",size:"icon",onClick:()=>n(c.path,null),disabled:t||o,children:e.jsx(re,{className:"h-4 w-4"})})]})]},c.path))})]})}const A="__unset__",Fs=105e4,Ws=272e3,_e=8e5,ke=7e5,Ks=new Intl.NumberFormat("en-US");function X(s){return s??A}function Y(s,r){return r&&!s.includes(r)?[r,...s]:s}function xe(s){return Ks.format(s)}function qs(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 Vs({initialValues:s,providerNames:r,disabled:t,saving:l,onSave:o}){const{t:n}=E(),[a,c]=N.useState(s),i=Y(["minimal","low","medium","high","xhigh"],a.modelReasoningEffort),d=Y(r,a.modelProvider),m=Y(["on-request","never","untrusted"],a.approvalPolicy),p=Y(["read-only","workspace-write","danger-full-access"],a.sandboxMode),x=Y(["cached","live","disabled"],a.webSearch),j=Y(["none","friendly","pragmatic"],a.personality),h=Us(s,a),w=Object.keys(h).length>0,M=qs(a.model),q=u=>{const v=u.trim();return v.length>0?Number(v):null};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.model")}),e.jsx(S,{value:a.model??"",onChange:u=>c(v=>({...v,model:u.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:X(a.modelReasoningEffort),onValueChange:u=>c(v=>({...v,modelReasoningEffort:u===A?null:u})),disabled:t,children:[e.jsx(O,{children:e.jsx(D,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useDefault")}),i.map(u=>e.jsx(b,{value:u,children:u},u))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.defaultProvider")}),e.jsxs(P,{value:X(a.modelProvider),onValueChange:u=>c(v=>({...v,modelProvider:u===A?null:u})),disabled:t,children:[e.jsx(O,{children:e.jsx(D,{placeholder:n("codex.useCodexDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useCodexDefault")}),d.map(u=>e.jsx(b,{value:u,children:u},u))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.approvalPolicy")}),e.jsxs(P,{value:X(a.approvalPolicy),onValueChange:u=>c(v=>({...v,approvalPolicy:u===A?null:u})),disabled:t,children:[e.jsx(O,{children:e.jsx(D,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useDefault")}),m.map(u=>e.jsx(b,{value:u,children:u},u))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.sandboxMode")}),e.jsxs(P,{value:X(a.sandboxMode),onValueChange:u=>c(v=>({...v,sandboxMode:u===A?null:u})),disabled:t,children:[e.jsx(O,{children:e.jsx(D,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useDefault")}),p.map(u=>e.jsx(b,{value:u,children:u},u))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.webSearch")}),e.jsxs(P,{value:X(a.webSearch),onValueChange:u=>c(v=>({...v,webSearch:u===A?null:u})),disabled:t,children:[e.jsx(O,{children:e.jsx(D,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useDefault")}),x.map(u=>e.jsx(b,{value:u,children:u},u))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.toolOutputTokenLimit")}),e.jsx(S,{type:"number",min:1,value:a.toolOutputTokenLimit??"",onChange:u=>c(v=>({...v,toolOutputTokenLimit:u.target.value?Number(u.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:X(a.personality),onValueChange:u=>c(v=>({...v,personality:u===A?null:u})),disabled:t,children:[e.jsx(O,{children:e.jsx(D,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useDefault")}),j.map(u=>e.jsx(b,{value:u,children:u},u))]})]})]})]}),e.jsxs("div",{className:"space-y-4 rounded-xl border border-amber-500/30 bg-amber-500/5 p-4 shadow-sm dark:bg-amber-400/5",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(os,{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(_,{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(_,{variant:"secondary",className:"text-[10px] uppercase tracking-[0.16em] text-muted-foreground",children:M?"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(C,{type:"button",variant:"outline",size:"sm",disabled:t,onClick:()=>c(u=>({...u,modelContextWindow:_e,modelAutoCompactTokenLimit:ke})),children:"Fill cautious pair"}),e.jsx(C,{type:"button",variant:"outline",size:"sm",disabled:t,onClick:()=>c(u=>({...u,modelContextWindow:Fs})),children:"Set official max window"}),e.jsx(C,{type:"button",variant:"ghost",size:"sm",disabled:t,onClick:()=>c(u=>({...u,modelContextWindow:null,modelAutoCompactTokenLimit:null})),children:"Clear"})]})]}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-3",children:[e.jsxs("div",{className:"rounded-lg border bg-background/85 px-3 py-3 shadow-sm shadow-black/5",children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:"Official max"}),e.jsx("p",{className:"mt-1 font-mono text-base font-semibold text-foreground",children:"1.05M / 1M"}),e.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:n("codex.gptContextCap")})]}),e.jsxs("div",{className:"rounded-lg border bg-background/85 px-3 py-3 shadow-sm shadow-black/5",children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:"Standard window"}),e.jsx("p",{className:"mt-1 font-mono text-base font-semibold text-foreground",children:xe(Ws)}),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 ",xe(_e)]}),e.jsxs("div",{className:"rounded-full border bg-background px-2.5 py-1 font-mono text-[11px] font-medium",children:["Auto-compact ",xe(ke)]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx(_,{variant:"outline",className:"border-border/70 bg-background/80 text-[10px] uppercase tracking-[0.14em] text-muted-foreground",children:"Not official"}),e.jsx(_,{variant:"outline",className:"border-border/70 bg-background/80 text-[10px] uppercase tracking-[0.14em] text-muted-foreground",children:"Draft only"})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] text-muted-foreground",children:[e.jsx("span",{children:n("codex.quickFillWarning")}),!M&&a.model?e.jsxs("span",{children:[e.jsx("code",{children:a.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(S,{"aria-label":n("codex.modelContextWindow"),type:"number",min:1,value:a.modelContextWindow??"",onChange:u=>c(v=>({...v,modelContextWindow:q(u.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(S,{"aria-label":n("codex.autoCompactTokenLimit"),type:"number",min:1,value:a.modelAutoCompactTokenLimit??"",onChange:u=>c(v=>({...v,modelAutoCompactTokenLimit:q(u.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(C,{onClick:()=>o(h),disabled:t||l||!w,children:[l?e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save top-level settings"]})})]})}function Bs({values:s,providerNames:r,disabled:t=!1,disabledReason:l,saving:o=!1,onSave:n}){return e.jsx(Z,{title:"Top-level controls",badge:"config.toml",icon:e.jsx(as,{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(Vs,{initialValues:s,providerNames:r,disabled:t,saving:o,onSave:n},JSON.stringify(s))})}function Gs({workspacePath:s,activeProfile:r,topLevelSettings:t,projectTrustEntries:l,profileEntries:o,modelProviderEntries:n,mcpServerEntries:a,featureCatalog:c,featureState:i,disabled:d,disabledReason:m,saving:p,onPatch:x}){const{t:j}=E();return e.jsx(fe,{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:j("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(is,{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(cs,{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(ds,{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(Bs,{values:t,providerNames:n.map(h=>h.name),disabled:d,disabledReason:m,saving:p,onSave:h=>x({kind:"top-level",values:h},j("toasts.codexSaved"))}),e.jsx(Is,{workspacePath:s,entries:l,disabled:d,disabledReason:m,saving:p,onSave:(h,w)=>x({kind:"project-trust",path:h,trustLevel:w},w?"Saved project trust entry.":"Removed project trust entry.")}),e.jsx(Ms,{activeProfile:r,entries:o,providerNames:n.map(h=>h.name),disabled:d,disabledReason:m,saving:p,onSave:(h,w,M)=>x({kind:"profile",action:"upsert",name:h,values:w,setAsActive:M},"Saved profile."),onDelete:h=>x({kind:"profile",action:"delete",name:h},"Deleted profile."),onSetActive:h=>x({kind:"profile",action:"set-active",name:h},"Set active profile.")}),e.jsx(Ls,{entries:n,disabled:d,disabledReason:m,saving:p,onSave:(h,w)=>x({kind:"model-provider",action:"upsert",name:h,values:w},"Saved model provider."),onDelete:h=>x({kind:"model-provider",action:"delete",name:h},"Deleted model provider.")}),e.jsx(Es,{entries:a,disabled:d,disabledReason:m,saving:p,onSave:(h,w)=>x({kind:"mcp-server",action:"upsert",name:h,values:w},"Saved MCP server."),onDelete:h=>x({kind:"mcp-server",action:"delete",name:h},"Deleted MCP server.")}),e.jsx(_s,{catalog:c,state:i,disabled:d,disabledReason:m,onToggle:(h,w)=>x({kind:"feature",feature:h,enabled:w},"Saved feature toggle.")})]})})}const De=`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"`,$s=["multi_agent","unified_exec","shell_snapshot","apply_patch_freeform","js_repl","runtime_metrics","prevent_idle_sleep","fast_mode","apps","smart_approvals"];function zs(){return[{name:"multi_agent",label:y.t("codex.featureMultiAgentLabel"),description:y.t("codex.featureMultiAgentDesc")},{name:"unified_exec",label:y.t("codex.featureUnifiedExecLabel"),description:y.t("codex.featureUnifiedExecDesc")},{name:"shell_snapshot",label:y.t("codex.featureShellSnapshotLabel"),description:y.t("codex.featureShellSnapshotDesc")},{name:"apply_patch_freeform",label:y.t("codex.featureApplyPatchLabel"),description:y.t("codex.featureApplyPatchDesc")},{name:"js_repl",label:y.t("codex.featureJsReplLabel"),description:y.t("codex.featureJsReplDesc")},{name:"runtime_metrics",label:y.t("codex.featureRuntimeMetricsLabel"),description:y.t("codex.featureRuntimeMetricsDesc")},{name:"prevent_idle_sleep",label:y.t("codex.featurePreventIdleSleepLabel"),description:y.t("codex.featurePreventIdleSleepDesc")},{name:"fast_mode",label:y.t("codex.featureFastModeLabel"),description:y.t("codex.featureFastModeDesc")},{name:"apps",label:y.t("codex.featureAppsLabel"),description:y.t("codex.featureAppsDesc")},{name:"smart_approvals",label:y.t("codex.featureSmartApprovalsLabel"),description:y.t("codex.featureSmartApprovalsDesc")}]}function
|
|
6
|
+
wire_api = "responses"`,$s=["multi_agent","unified_exec","shell_snapshot","apply_patch_freeform","js_repl","runtime_metrics","prevent_idle_sleep","fast_mode","apps","smart_approvals"];function zs(){return[{name:"multi_agent",label:y.t("codex.featureMultiAgentLabel"),description:y.t("codex.featureMultiAgentDesc")},{name:"unified_exec",label:y.t("codex.featureUnifiedExecLabel"),description:y.t("codex.featureUnifiedExecDesc")},{name:"shell_snapshot",label:y.t("codex.featureShellSnapshotLabel"),description:y.t("codex.featureShellSnapshotDesc")},{name:"apply_patch_freeform",label:y.t("codex.featureApplyPatchLabel"),description:y.t("codex.featureApplyPatchDesc")},{name:"js_repl",label:y.t("codex.featureJsReplLabel"),description:y.t("codex.featureJsReplDesc")},{name:"runtime_metrics",label:y.t("codex.featureRuntimeMetricsLabel"),description:y.t("codex.featureRuntimeMetricsDesc")},{name:"prevent_idle_sleep",label:y.t("codex.featurePreventIdleSleepLabel"),description:y.t("codex.featurePreventIdleSleepDesc")},{name:"fast_mode",label:y.t("codex.featureFastModeLabel"),description:y.t("codex.featureFastModeDesc")},{name:"apps",label:y.t("codex.featureAppsLabel"),description:y.t("codex.featureAppsDesc")},{name:"smart_approvals",label:y.t("codex.featureSmartApprovalsLabel"),description:y.t("codex.featureSmartApprovalsDesc")}]}function B(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 Q(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 Le(s){return{model:T(s?.model),modelReasoningEffort:T(s?.model_reasoning_effort),modelContextWindow:Q(s?.model_context_window),modelAutoCompactTokenLimit:Q(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:Q(s?.tool_output_token_limit),personality:T(s?.personality)}}function Xs(s){const r=B(s?.projects);return r?Object.entries(r).map(([t,l])=>{const o=T(B(l)?.trust_level);return o?{path:t,trustLevel:o}:null}).filter(t=>t!==null).sort((t,l)=>t.path.localeCompare(l.path)):[]}function Ys(s){const r=B(s?.profiles);return r?Object.entries(r).map(([t,l])=>({name:t,values:Le(B(l))})).sort((t,l)=>t.name.localeCompare(l.name)):[]}function Hs(s){const r=B(s?.model_providers);return r?Object.entries(r).map(([t,l])=>{const o=B(l);return o?{name:t,displayName:T(o.name),baseUrl:T(o.base_url),envKey:T(o.env_key),wireApi:T(o.wire_api),requiresOpenaiAuth:o.requires_openai_auth===!0,supportsWebsockets:o.supports_websockets===!0}:null}).filter(t=>t!==null).sort((t,l)=>t.name.localeCompare(l.name)):[]}function Qs(s){const r=B(s?.mcp_servers);return r?Object.entries(r).map(([t,l])=>{const o=B(l);if(!o)return null;const n=T(o.command)?"stdio":"streamable-http",a=Q(o.startup_timeout_ms);return{name:t,transport:n,command:T(o.command),args:ue(o.args),url:T(o.url),enabled:o.enabled!==!1,required:o.required===!0,startupTimeoutSec:Q(o.startup_timeout_sec)??(a!==null?a/1e3:null),toolTimeoutSec:Q(o.tool_timeout_sec),enabledTools:ue(o.enabled_tools),disabledTools:ue(o.disabled_tools),isCcsManaged:t==="ccs_browser",managementSurface:t==="ccs_browser"?"browser-settings":null}}).filter(t=>t!==null).sort((t,l)=>t.name.localeCompare(l.name)):[]}function Js(s){const r=B(s?.features),t={};for(const l of $s){const o=r?.[l];t[l]=typeof o=="boolean"?o:null}if(r)for(const[l,o]of Object.entries(r))l in t||(t[l]=typeof o=="boolean"?o:null);return t}const Zs=[{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."}],er=[{provider:"openai",label:"OpenAI Responses API",apiFormat:"Responses API",url:"https://platform.openai.com/docs/api-reference/responses"}];function sr(s){const r=/https?:\/\/[^\s)]+/g,t=[];let l=0,o;for(;(o=r.exec(s))!==null;){const[n]=o,a=o.index;a>l&&t.push(s.slice(l,a)),t.push(e.jsx("a",{href:n,target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:n},`${n}-${a}`)),l=a+n.length}return l<s.length&&t.push(s.slice(l)),t.length>0?t:[s]}function rr({diagnostics:s}){const{t:r}=E(),t=s.docsReference??{notes:[],links:[],providerDocs:[],providerValues:[],settingsHierarchy:[]},l=t.links.length>0?t.links:Zs,o=t.providerDocs.length>0?t.providerDocs:er;return e.jsx(fe,{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(me,{className:"h-4 w-4"}),"CCS bridge recipe"]})}),e.jsxs(K,{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:De}),e.jsxs("ol",{className:"ml-4 list-decimal space-y-1.5 [&>li]:pl-1",children:[e.jsxs("li",{children:["Save the ",e.jsx("code",{children:"cliproxy"})," provider in your user config."]}),e.jsxs("li",{children:["Set top-level ",e.jsx("code",{children:"model_provider"})," to ",e.jsx("code",{children:"cliproxy"}),"."]}),e.jsxs("li",{children:["Export ",e.jsx("code",{children:"CLIPROXY_API_KEY"})," before launching native Codex."]})]}),e.jsxs("p",{children:["CCS-managed browser tooling belongs to ",e.jsx("code",{children:"Settings > Browser"}),". Do not edit the ",e.jsx("code",{children:"ccs_browser"})," entry from the generic MCP card unless you are intentionally overriding the managed path in raw TOML."]})]})]}),e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(W,{className:"flex items-center gap-2 text-base",children:[e.jsx(me,{className:"h-4 w-4"}),"Upstream notes"]})}),e.jsxs(K,{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,a)=>e.jsx("li",{children:sr(n)},`${a}-${n}`))}),e.jsx(ee,{}),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(we,{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(ee,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:"Provider / bridge reference"}),e.jsx("div",{className:"space-y-1.5",children:o.map(n=>e.jsxs("a",{href:n.url,target:"_blank",rel:"noreferrer",className:"block rounded-md border px-2.5 py-2 transition-colors hover:bg-muted/50",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-xs font-medium",children:n.label}),e.jsx(we,{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(ee,{}),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 tr(s,r){let t=s.slice(0,r).split(/\r\n|\n|\r/g);return[t.length,t.pop().length+1]}function nr(s,r,t){let l=s.split(/\r\n|\n|\r/g),o="",n=(Math.log10(r+1)|0)+1;for(let a=r-1;a<=r+1;a++){let c=l[a-1];c&&(o+=a.toString().padEnd(n," "),o+=": ",o+=c,o+=`
|
|
7
7
|
`,a===r&&(o+=" ".repeat(n+t+2),o+=`^
|
|
8
8
|
`))}return o}class f extends Error{line;column;codeblock;constructor(r,t){const[l,o]=tr(t.toml,t.ptr),n=nr(t.toml,l,o);super(`Invalid TOML document: ${r}
|
|
9
9
|
|
|
@@ -24,4 +24,4 @@ ${n}`,t),this.line=l,this.column=o,this.codeblock=n}}function ar(s,r){let t=0;fo
|
|
|
24
24
|
`&&s[a]!=="\r")throw new f("unexpected character encountered",{toml:s,ptr:a});a+=+(s[a]===",")}return[i,a]}a=or(s,r,",",t);let c=mr(s,r,a-+(s[a-1]===","));if(!c[0])throw new f("incomplete key-value declaration: no value specified",{toml:s,ptr:r});return t&&c[1]>-1&&(a=V(s,r+c[1]),a+=+(s[a]===",")),[ur(c[0],s,r,o),a]}let pr=/^[a-zA-Z0-9-_]+[ \t]*$/;function he(s,r,t="="){let l=r-1,o=[],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 a=s[r=++l];if(a!==" "&&a!==" ")if(a==='"'||a==="'"){if(a===s[r+1]&&a===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=pe(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});o.push(Me(s,r,c))}else{l=s.indexOf(".",r);let c=s.slice(r,l<0||l>n?n:l);if(!pr.test(c))throw new f("only letter, numbers, dashes and underscores are allowed in keys",{toml:s,ptr:r});o.push(c.trimEnd())}}while(l+1&&l<n);return[o,V(s,n+1,!0,!0)]}function hr(s,r,t,l){let o={},n=new Set,a;for(r++;(a=s[r++])!=="}"&&a;){if(a===",")throw new f("expected value, found comma",{toml:s,ptr:r-1});if(a==="#")r=te(s,r);else if(a!==" "&&a!==" "&&a!==`
|
|
25
25
|
`&&a!=="\r"){let c,i=o,d=!1,[m,p]=he(s,r-1);for(let h=0;h<m.length;h++){if(h&&(i=d?i[c]:i[c]={}),c=m[h],(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[x,j]=ge(s,p,"}",t-1,l);n.add(x),i[c]=x,r=j}}if(!a)throw new f("unfinished table encountered",{toml:s,ptr:r});return[o,r]}function fr(s,r,t,l){let o=[],n;for(r++;(n=s[r++])!=="]"&&n;){if(n===",")throw new f("expected value, found comma",{toml:s,ptr:r-1});if(n==="#")r=te(s,r);else if(n!==" "&&n!==" "&&n!==`
|
|
26
26
|
`&&n!=="\r"){let a=ge(s,r-1,"]",t-1,l);o.push(a[0]),r=a[1]}}if(!n)throw new f("unfinished array encountered",{toml:s,ptr:r});return[o,r]}function Ee(s,r,t,l){let o=r,n=t,a,c=!1,i;for(let d=0;d<s.length;d++){if(d){if(o=c?o[a]:o[a]={},n=(i=n[a]).c,l===0&&(i.t===1||i.t===2))return null;if(i.t===2){let m=o.length-1;o=o[m],n=n[m].c}}if(a=s[d],(c=Object.hasOwn(o,a))&&n[a]?.t===0&&n[a]?.d)return null;c||(a==="__proto__"&&(Object.defineProperty(o,a,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(n,a,{enumerable:!0,configurable:!0,writable:!0})),n[a]={t:d<s.length-1&&l===2?3:l,d:!1,i:0,c:{}})}if(i=n[a],i.t!==l&&!(l===1&&i.t===3)||(l===2&&(i.d||(i.d=!0,o[a]=[]),o[a].push(o={}),i.c[i.i++]=i={t:1,d:!1,i:0,c:{}}),i.d))return null;if(i.d=!0,l===1)o=c?o[a]:o[a]={};else if(l===0&&c)return null;return[a,o,i.c]}function gr(s,{maxDepth:r=1e3,integersAsBigInt:t}={}){let l={},o={},n=l,a=o;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 m=Ee(d[0],l,o,i?2:1);if(!m)throw new f("trying to redefine an already defined table or value",{toml:s,ptr:c});a=m[2],n=m[1],c=d[1]}else{let i=he(s,c),d=Ee(i[0],n,a,0);if(!d)throw new f("trying to redefine an already defined table or value",{toml:s,ptr:c});let m=ge(s,i[1],void 0,r,t);d[1][d[0]]=m[0],c=m[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 jr(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)}function vr(s){if(!s.trim())return{};const t=gr(s);if(!jr(t))throw new Error("TOML root must be a table.");return t}function Re(s){try{return{config:vr(s),parseError:null}}catch(r){return{config:null,parseError:r.message}}}async function br(){const s=await fetch(se("/codex/diagnostics"));if(!s.ok)throw new Error("Failed to fetch Codex diagnostics");return s.json()}async function wr(){const s=await fetch(se("/codex/config/raw"));if(!s.ok)throw new Error("Failed to fetch Codex raw config");return s.json()}async function Nr(s){const r=await fetch(se("/codex/config/raw"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(r.status===409)throw new Pe("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 yr(s){const r=await fetch(se("/codex/config/patch"),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(r.status===409)throw new Pe("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 Cr(){const s=ws(),r=ye({queryKey:["codex-diagnostics"],queryFn:br,refetchInterval:1e4}),t=ye({queryKey:["codex-raw-config"],queryFn:wr}),l=Ce({mutationFn:Nr,onSuccess:(n,a)=>{s.setQueryData(["codex-raw-config"],c=>{const i=c?.path??"$CODEX_HOME/config.toml",d=c?.resolvedPath??i,m=Re(a.rawText);return{path:i,resolvedPath:d,exists:!0,mtime:n.mtime,rawText:a.rawText,config:m.config,parseError:m.parseError,readError:null}}),s.invalidateQueries({queryKey:["codex-diagnostics"]})}}),o=Ce({mutationFn:yr,onSuccess:n=>{s.setQueryData(["codex-raw-config"],n),s.invalidateQueries({queryKey:["codex-diagnostics"]})}});return N.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:o.mutate,patchConfigAsync:o.mutateAsync,isPatchingConfig:o.isPending}),[r.data,r.isLoading,r.error,r.refetch,t.data,t.isLoading,t.error,t.refetch,l.mutate,l.mutateAsync,l.isPending,o.mutate,o.mutateAsync,o.isPending])}const Sr=[{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 _r({snippets:s=Sr}){const[r,t]=N.useState(null),{t:l}=E(),o=async(n,a)=>{await navigator.clipboard.writeText(n),t(a),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(xs,{className:"w-5 h-5 text-muted-foreground"}),l("quickCommands.title")]})}),e.jsx(K,{children:e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:s.map((n,a)=>e.jsxs("div",{className:Oe("group flex items-center justify-between gap-2 px-3 py-2","rounded-lg border bg-muted/30 hover:bg-muted/50 transition-colors"),children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:n.label}),e.jsx("code",{className:"text-sm font-mono font-medium truncate block",children:n.command})]}),e.jsx(C,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>o(n.command,a),title:n.description,children:r===a?e.jsx(us,{className:"h-4 w-4 text-green-600"}):e.jsx(ms,{className:"h-4 w-4"})})]},a))})})]})}function kr(s){return!s||!Number.isFinite(s)?"N/A":new Date(s).toLocaleString()}function Tr(s){return!s||s<=0?"0 B":s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(2)} MB`}function k({label:s,value: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:Oe("text-right break-all",t&&"font-mono text-xs"),children:r})]})}function Er({diagnostics:s}){const{t:r}=E(),t=s.config.activeProfile?`codex --profile ${s.config.activeProfile}`:"codex",l=s.binary.supportsConfigOverrides;return e.jsx(fe,{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(ps,{className:"h-4 w-4"}),r("codex.howCodexWorks")]})}),e.jsx(K,{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:r("codex.nativeConfigLabel")})," ",r("codex.nativeConfigDesc")]}),e.jsxs("li",{children:[e.jsx("strong",{children:r("codex.transientOverridesLabel")})," ",r("codex.transientOverridesDesc")]}),e.jsxs("li",{children:[e.jsx("strong",{children:r("codex.cliproxyDefaultLabel")})," ",r("codex.cliproxyDefaultDesc")]}),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"}),r("codex.runtimeInstall")]})}),e.jsxs(K,{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(_,{variant:s.binary.installed?"default":"secondary",children:s.binary.installed?r("codex.detected"):r("codex.notFound")})]}),e.jsx(k,{label:r("codex.detectionSource"),value:s.binary.source,mono:!0}),e.jsx(k,{label:r("codex.binaryPath"),value:s.binary.path||r("codex.notFound"),mono:!0}),e.jsx(k,{label:r("codex.installDirectory"),value:s.binary.installDir||"N/A",mono:!0}),e.jsx(k,{label:r("codex.versionLabel"),value:s.binary.version||"Unknown",mono:!0}),e.jsx(k,{label:r("codex.nativeAliases"),value:"ccs-codex, ccsx",mono:!0}),e.jsx(k,{label:r("codex.ccsProviderShortcut"),value:"ccsxp",mono:!0}),e.jsxs("div",{className:"flex items-center justify-between rounded-md border px-3 py-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:r("codex.configOverrideSupport")}),e.jsx(_,{variant:s.binary.supportsConfigOverrides?"default":"secondary",children:s.binary.supportsConfigOverrides?r("codex.available"):r("codex.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(Ne,{className:"h-4 w-4"}),r("codex.cliproxyNativeCodex")]})}),e.jsx(K,{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:r("codex.builtInLabel")})," ",r("codex.builtInCcsxpDesc")]}),e.jsxs("li",{children:[e.jsx("strong",{children:r("codex.nativeRecipeLabel")})," ",r("codex.nativeRecipeDesc")]})]})]}),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:De})]}),e.jsxs("ol",{className:"ml-4 list-decimal space-y-1.5 [&>li]:pl-1",children:[e.jsx("li",{children:r("codex.saveProviderNamedCliproxy")}),e.jsx("li",{children:r("codex.inTopLevelSetDefault")}),e.jsx("li",{children:r("codex.exportCliproxyApiKey")})]})]}):e.jsx("p",{children:r("codex.noConfigOverrides")})})]}),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(fs,{className:"h-4 w-4"}),r("codex.configFile")]})}),e.jsx(K,{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(gs,{className:"h-4 w-4 text-green-600"}):e.jsx(js,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(k,{label:r("codex.path"),value:s.file.path,mono:!0}),e.jsx(k,{label:r("codex.resolved"),value:s.file.resolvedPath,mono:!0}),e.jsx(k,{label:r("codex.size"),value:Tr(s.file.sizeBytes)}),e.jsx(k,{label:r("codex.lastModified"),value:kr(s.file.mtimeMs)}),s.file.parseError&&e.jsxs("p",{className:"text-xs text-amber-600",children:[r("codex.tomlWarning"),": ",s.file.parseError]}),s.file.readError&&e.jsxs("p",{className:"text-xs text-destructive",children:[r("codex.readWarning"),": ",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(me,{className:"h-4 w-4"}),r("codex.currentUserLayerSummary")]})}),e.jsxs(K,{className:"space-y-3",children:[e.jsx(k,{label:r("codex.model"),value:s.config.model||r("codex.notSet"),mono:!0}),e.jsx(k,{label:r("codex.defaultProvider"),value:s.config.modelProvider||r("codex.notSet"),mono:!0}),e.jsx(k,{label:r("codex.activeProfile"),value:s.config.activeProfile||r("codex.notSet"),mono:!0}),e.jsx(k,{label:r("codex.approvalPolicy"),value:s.config.approvalPolicy||r("codex.notSet"),mono:!0}),e.jsx(k,{label:r("codex.sandboxMode"),value:s.config.sandboxMode||r("codex.notSet"),mono:!0}),e.jsx(k,{label:r("codex.webSearch"),value:s.config.webSearch||r("codex.notSet"),mono:!0}),e.jsx(ee,{}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsx(_,{variant:"outline",className:"justify-center",children:r("codex.providersCount",{count:s.config.modelProviderCount})}),e.jsx(_,{variant:"outline",className:"justify-center",children:r("codex.profilesCount",{count:s.config.profileCount})}),e.jsx(_,{variant:"outline",className:"justify-center",children:r("codex.enabledFeaturesCount",{count:s.config.enabledFeatures.length})}),e.jsx(_,{variant:"outline",className:"justify-center",children:r("codex.mcpServersCount",{count:s.config.mcpServerCount})})]}),s.config.topLevelKeys.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:r("codex.userLayerKeysPresent")}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.config.topLevelKeys.map(o=>e.jsx(_,{variant:"secondary",className:"font-mono text-[10px]",children:o},o))})]})]})]}),e.jsx(_r,{snippets:[{label:r("codex.nativeShortAlias"),command:"ccsx",description:"Launch the short native Codex runtime alias."},{label:r("codex.ccsCodexShortcut"),command:'ccsxp "your prompt"',description:l?r("codex.runBuiltInCodex"):"Requires a Codex build that exposes --config overrides."},{label:r("codex.explicitProviderRoute"),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(Ne,{className:"h-4 w-4"}),r("codex.runtimeVsProvider")]})}),e.jsxs(K,{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(_,{variant:"secondary",className:"mt-4 w-fit justify-center font-normal",children:r("codex.honorsSavedNativeConfig")})]}),e.jsxs("div",{className:"flex flex-col rounded-md border p-3 text-sm",children:[e.jsx("p",{className:"font-medium text-foreground",children: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(_,{variant:"secondary",className:"mt-4 w-fit justify-center font-normal",children:r("codex.usesTransientOverrides")})]}):e.jsx("p",{className:"mt-2 text-muted-foreground",children:r("codex.unavailableNoConfig")})]})]})]}),e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsx(W,{className:"text-base",children:r("codex.supportedFlows")})}),e.jsx(K,{children:e.jsxs(Ns,{children:[e.jsx(ys,{children:e.jsxs(Se,{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(o=>e.jsxs(Se,{children:[e.jsx(ie,{className:"font-mono text-xs",children:o.label}),e.jsx(ie,{children:e.jsx(_,{variant:o.supported?"default":"secondary",children:o.supported?r("codex.yes"):r("codex.no")})}),e.jsx(ie,{className:"text-xs text-muted-foreground",children:o.notes})]},o.id))})]})})]}),s.warnings.length>0&&e.jsxs(I,{className:"border-amber-200 bg-amber-50/50 dark:bg-amber-950/20",children:[e.jsx(F,{className:"pb-2",children:e.jsxs(W,{className:"flex items-center gap-2 text-base",children:[e.jsx(vs,{className:"h-4 w-4 text-amber-600"}),r("codex.warningsTitle")]})}),e.jsx(K,{className:"space-y-1.5",children:s.warnings.map(o=>e.jsxs("p",{className:"text-sm text-amber-800 dark:text-amber-300",children:["- ",o]},o))})]})]})})}function Ur(){const{t:s}=E(),r=zs(),{diagnostics:t,diagnosticsLoading:l,diagnosticsError:o,refetchDiagnostics:n,rawConfig:a,rawConfigLoading:c,rawConfigError:i,refetchRawConfig:d,saveRawConfigAsync:m,isSavingRawConfig:p,patchConfigAsync:x,isPatchingConfig:j}=Cr(),[h,w]=N.useState(null),M=a?.rawText??"",q=h??M,u=h!==null&&h!==M,v=Re(q),B=v.parseError?{valid:!1,error:v.parseError}:{valid:!0},g=a?.config??null,Ie=c||!a||u||a?.parseError!==null||a?.readError!==null,Fe=i?"Structured controls unavailable: failed to load the current config.toml.":a?.readError?`Structured controls unavailable: ${a.readError}`:u?B.valid?"Save or discard raw TOML edits before using structured controls.":"Fix or discard raw TOML edits before using structured controls.":a?.parseError?`Structured controls disabled: ${a.parseError}`:null,We=N.useMemo(()=>Le(g),[g]),Ke=N.useMemo(()=>Xs(g),[g]),qe=N.useMemo(()=>Ys(g),[g]),Ue=N.useMemo(()=>Hs(g),[g]),Ve=N.useMemo(()=>Qs(g),[g]),Ge=N.useMemo(()=>Js(g),[g]),Be=R=>{if(R===M){w(null);return}w(R)},$e=async()=>{try{if((await Promise.all([n(),d()])).some($=>!$||$.status==="error"||$.isError||$.error)){U.error(s("toasts.codexRefreshFailed"));return}w(null)}catch(R){U.error(R.message||s("toasts.codexRefreshError"))}},ze=async()=>{if(!B.valid){U.error(s("toasts.codexFixToml"));return}try{await m({rawText:q,expectedMtime:a?.exists?a.mtime:void 0}),w(null),U.success(s("toasts.codexSaved")),await n()}catch(R){be(R)?U.error(s("toasts.codexChangedExternally")):U.error(R.message||s("toasts.codexSaveFailed"))}},Xe=async(R,je)=>{try{await x({...R,expectedMtime:a?.exists?a.mtime:void 0}),w(null),U.success(je)}catch($){be($)?U.error(s("toasts.codexChangedExternally")):U.error($.message||s("toasts.codexUpdateFailed"))}},ne="mt-0 h-full border-0 p-0 data-[state=inactive]:hidden",Ye=()=>l?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..."]}):o||!t?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(Je,{defaultValue:"overview",className:"flex h-full flex-col",children:[e.jsx("div",{className:"shrink-0 px-4 pt-4",children:e.jsxs(Ze,{className:"grid w-full grid-cols-3",children:[e.jsx(ae,{value:"overview",children:s("codexPage.overview")}),e.jsx(ae,{value:"controls",children:s("codexPage.controlCenter")}),e.jsx(ae,{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(oe,{value:"overview",className:ne,children:e.jsx(Er,{diagnostics:t})}),e.jsx(oe,{value:"controls",className:ne,children:e.jsx(Bs,{workspacePath:t.workspacePath,activeProfile:t.config.activeProfile,topLevelSettings:We,projectTrustEntries:Ke,profileEntries:qe,modelProviderEntries:Ue,mcpServerEntries:Ve,featureCatalog:r,featureState:Ge,disabled:Ie,disabledReason:Fe,saving:j,onPatch:Xe})}),e.jsx(oe,{value:"docs",className:ne,children:e.jsx(rr,{diagnostics:t})})]})]});return e.jsx("div",{className:"h-full min-h-0 overflow-hidden",children:e.jsxs(He,{direction:"horizontal",className:"h-full",children:[e.jsx(ve,{defaultSize:45,minSize:35,children:e.jsx("div",{className:"h-full border-r bg-muted/20",children:Ye()})}),e.jsx(Qe,{className:"group flex w-2 cursor-col-resize items-center justify-center bg-border transition-colors hover:bg-primary/20",children:e.jsx(bs,{className:"h-3 w-3 text-muted-foreground group-hover:text-primary"})}),e.jsx(ve,{defaultSize:55,minSize:35,children:e.jsx(Ss,{title:"Codex config.toml",pathLabel:a?.path||t?.file.path||"$CODEX_HOME/config.toml",loading:c,parseWarning:B.valid?a?.parseError:B.error,readWarning:a?.readError,value:q,dirty:u,readOnly:!!a?.readError,saving:p,saveDisabled:!u||p||c||!B.valid||!!a?.readError,onChange:R=>{Be(R)},onSave:ze,onRefresh:$e,onDiscard:()=>w(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{Ur as CodexPage};
|
|
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 jr(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)}function vr(s){if(!s.trim())return{};const t=gr(s);if(!jr(t))throw new Error("TOML root must be a table.");return t}function Re(s){try{return{config:vr(s),parseError:null}}catch(r){return{config:null,parseError:r.message}}}async function br(){const s=await fetch(se("/codex/diagnostics"));if(!s.ok)throw new Error("Failed to fetch Codex diagnostics");return s.json()}async function wr(){const s=await fetch(se("/codex/config/raw"));if(!s.ok)throw new Error("Failed to fetch Codex raw config");return s.json()}async function Nr(s){const r=await fetch(se("/codex/config/raw"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(r.status===409)throw new Pe("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 yr(s){const r=await fetch(se("/codex/config/patch"),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(r.status===409)throw new Pe("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 Cr(){const s=ws(),r=ye({queryKey:["codex-diagnostics"],queryFn:br,refetchInterval:1e4}),t=ye({queryKey:["codex-raw-config"],queryFn:wr}),l=Ce({mutationFn:Nr,onSuccess:(n,a)=>{s.setQueryData(["codex-raw-config"],c=>{const i=c?.path??"$CODEX_HOME/config.toml",d=c?.resolvedPath??i,m=Re(a.rawText);return{path:i,resolvedPath:d,exists:!0,mtime:n.mtime,rawText:a.rawText,config:m.config,parseError:m.parseError,readError:null}}),s.invalidateQueries({queryKey:["codex-diagnostics"]})}}),o=Ce({mutationFn:yr,onSuccess:n=>{s.setQueryData(["codex-raw-config"],n),s.invalidateQueries({queryKey:["codex-diagnostics"]})}});return N.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:o.mutate,patchConfigAsync:o.mutateAsync,isPatchingConfig:o.isPending}),[r.data,r.isLoading,r.error,r.refetch,t.data,t.isLoading,t.error,t.refetch,l.mutate,l.mutateAsync,l.isPending,o.mutate,o.mutateAsync,o.isPending])}const Sr=[{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 _r({snippets:s=Sr}){const[r,t]=N.useState(null),{t:l}=E(),o=async(n,a)=>{await navigator.clipboard.writeText(n),t(a),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(xs,{className:"w-5 h-5 text-muted-foreground"}),l("quickCommands.title")]})}),e.jsx(K,{children:e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:s.map((n,a)=>e.jsxs("div",{className:Oe("group flex items-center justify-between gap-2 px-3 py-2","rounded-lg border bg-muted/30 hover:bg-muted/50 transition-colors"),children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:n.label}),e.jsx("code",{className:"text-sm font-mono font-medium truncate block",children:n.command})]}),e.jsx(C,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>o(n.command,a),title:n.description,children:r===a?e.jsx(us,{className:"h-4 w-4 text-green-600"}):e.jsx(ms,{className:"h-4 w-4"})})]},a))})})]})}function kr(s){return!s||!Number.isFinite(s)?"N/A":new Date(s).toLocaleString()}function Tr(s){return!s||s<=0?"0 B":s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(2)} MB`}function k({label:s,value: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:Oe("text-right break-all",t&&"font-mono text-xs"),children:r})]})}function Er({diagnostics:s}){const{t:r}=E(),t=s.config.activeProfile?`codex --profile ${s.config.activeProfile}`:"codex",l=s.binary.supportsConfigOverrides;return e.jsx(fe,{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(ps,{className:"h-4 w-4"}),r("codex.howCodexWorks")]})}),e.jsx(K,{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:r("codex.nativeConfigLabel")})," ",r("codex.nativeConfigDesc")]}),e.jsxs("li",{children:[e.jsx("strong",{children:r("codex.transientOverridesLabel")})," ",r("codex.transientOverridesDesc")]}),e.jsxs("li",{children:[e.jsx("strong",{children:r("codex.cliproxyDefaultLabel")})," ",r("codex.cliproxyDefaultDesc")]}),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"}),r("codex.runtimeInstall")]})}),e.jsxs(K,{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(_,{variant:s.binary.installed?"default":"secondary",children:s.binary.installed?r("codex.detected"):r("codex.notFound")})]}),e.jsx(k,{label:r("codex.detectionSource"),value:s.binary.source,mono:!0}),e.jsx(k,{label:r("codex.binaryPath"),value:s.binary.path||r("codex.notFound"),mono:!0}),e.jsx(k,{label:r("codex.installDirectory"),value:s.binary.installDir||"N/A",mono:!0}),e.jsx(k,{label:r("codex.versionLabel"),value:s.binary.version||"Unknown",mono:!0}),e.jsx(k,{label:r("codex.nativeAliases"),value:"ccs-codex, ccsx",mono:!0}),e.jsx(k,{label:r("codex.ccsProviderShortcut"),value:"ccsxp",mono:!0}),e.jsxs("div",{className:"flex items-center justify-between rounded-md border px-3 py-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:r("codex.configOverrideSupport")}),e.jsx(_,{variant:s.binary.supportsConfigOverrides?"default":"secondary",children:s.binary.supportsConfigOverrides?r("codex.available"):r("codex.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(Ne,{className:"h-4 w-4"}),r("codex.cliproxyNativeCodex")]})}),e.jsx(K,{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:r("codex.builtInLabel")})," ",r("codex.builtInCcsxpDesc")]}),e.jsxs("li",{children:[e.jsx("strong",{children:r("codex.nativeRecipeLabel")})," ",r("codex.nativeRecipeDesc")]})]})]}),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:De})]}),e.jsxs("ol",{className:"ml-4 list-decimal space-y-1.5 [&>li]:pl-1",children:[e.jsx("li",{children:r("codex.saveProviderNamedCliproxy")}),e.jsx("li",{children:r("codex.inTopLevelSetDefault")}),e.jsx("li",{children:r("codex.exportCliproxyApiKey")})]})]}):e.jsx("p",{children:r("codex.noConfigOverrides")})})]}),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(fs,{className:"h-4 w-4"}),r("codex.configFile")]})}),e.jsx(K,{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(gs,{className:"h-4 w-4 text-green-600"}):e.jsx(js,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(k,{label:r("codex.path"),value:s.file.path,mono:!0}),e.jsx(k,{label:r("codex.resolved"),value:s.file.resolvedPath,mono:!0}),e.jsx(k,{label:r("codex.size"),value:Tr(s.file.sizeBytes)}),e.jsx(k,{label:r("codex.lastModified"),value:kr(s.file.mtimeMs)}),s.file.parseError&&e.jsxs("p",{className:"text-xs text-amber-600",children:[r("codex.tomlWarning"),": ",s.file.parseError]}),s.file.readError&&e.jsxs("p",{className:"text-xs text-destructive",children:[r("codex.readWarning"),": ",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(me,{className:"h-4 w-4"}),r("codex.currentUserLayerSummary")]})}),e.jsxs(K,{className:"space-y-3",children:[e.jsx(k,{label:r("codex.model"),value:s.config.model||r("codex.notSet"),mono:!0}),e.jsx(k,{label:r("codex.defaultProvider"),value:s.config.modelProvider||r("codex.notSet"),mono:!0}),e.jsx(k,{label:r("codex.activeProfile"),value:s.config.activeProfile||r("codex.notSet"),mono:!0}),e.jsx(k,{label:r("codex.approvalPolicy"),value:s.config.approvalPolicy||r("codex.notSet"),mono:!0}),e.jsx(k,{label:r("codex.sandboxMode"),value:s.config.sandboxMode||r("codex.notSet"),mono:!0}),e.jsx(k,{label:r("codex.webSearch"),value:s.config.webSearch||r("codex.notSet"),mono:!0}),e.jsx(ee,{}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsx(_,{variant:"outline",className:"justify-center",children:r("codex.providersCount",{count:s.config.modelProviderCount})}),e.jsx(_,{variant:"outline",className:"justify-center",children:r("codex.profilesCount",{count:s.config.profileCount})}),e.jsx(_,{variant:"outline",className:"justify-center",children:r("codex.enabledFeaturesCount",{count:s.config.enabledFeatures.length})}),e.jsx(_,{variant:"outline",className:"justify-center",children:r("codex.mcpServersCount",{count:s.config.mcpServerCount})})]}),s.config.topLevelKeys.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:r("codex.userLayerKeysPresent")}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.config.topLevelKeys.map(o=>e.jsx(_,{variant:"secondary",className:"font-mono text-[10px]",children:o},o))})]})]})]}),e.jsx(_r,{snippets:[{label:r("codex.nativeShortAlias"),command:"ccsx",description:"Launch the short native Codex runtime alias."},{label:r("codex.ccsCodexShortcut"),command:'ccsxp "your prompt"',description:l?r("codex.runBuiltInCodex"):"Requires a Codex build that exposes --config overrides."},{label:r("codex.explicitProviderRoute"),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(Ne,{className:"h-4 w-4"}),r("codex.runtimeVsProvider")]})}),e.jsxs(K,{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(_,{variant:"secondary",className:"mt-4 w-fit justify-center font-normal",children:r("codex.honorsSavedNativeConfig")})]}),e.jsxs("div",{className:"flex flex-col rounded-md border p-3 text-sm",children:[e.jsx("p",{className:"font-medium text-foreground",children: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(_,{variant:"secondary",className:"mt-4 w-fit justify-center font-normal",children:r("codex.usesTransientOverrides")})]}):e.jsx("p",{className:"mt-2 text-muted-foreground",children:r("codex.unavailableNoConfig")})]})]})]}),e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsx(W,{className:"text-base",children:r("codex.supportedFlows")})}),e.jsx(K,{children:e.jsxs(Ns,{children:[e.jsx(ys,{children:e.jsxs(Se,{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(o=>e.jsxs(Se,{children:[e.jsx(ie,{className:"font-mono text-xs",children:o.label}),e.jsx(ie,{children:e.jsx(_,{variant:o.supported?"default":"secondary",children:o.supported?r("codex.yes"):r("codex.no")})}),e.jsx(ie,{className:"text-xs text-muted-foreground",children:o.notes})]},o.id))})]})})]}),s.warnings.length>0&&e.jsxs(I,{className:"border-amber-200 bg-amber-50/50 dark:bg-amber-950/20",children:[e.jsx(F,{className:"pb-2",children:e.jsxs(W,{className:"flex items-center gap-2 text-base",children:[e.jsx(vs,{className:"h-4 w-4 text-amber-600"}),r("codex.warningsTitle")]})}),e.jsx(K,{className:"space-y-1.5",children:s.warnings.map(o=>e.jsxs("p",{className:"text-sm text-amber-800 dark:text-amber-300",children:["- ",o]},o))})]})]})})}function Ur(){const{t:s}=E(),r=zs(),{diagnostics:t,diagnosticsLoading:l,diagnosticsError:o,refetchDiagnostics:n,rawConfig:a,rawConfigLoading:c,rawConfigError:i,refetchRawConfig:d,saveRawConfigAsync:m,isSavingRawConfig:p,patchConfigAsync:x,isPatchingConfig:j}=Cr(),[h,w]=N.useState(null),M=a?.rawText??"",q=h??M,u=h!==null&&h!==M,v=Re(q),G=v.parseError?{valid:!1,error:v.parseError}:{valid:!0},g=a?.config??null,Ie=c||!a||u||a?.parseError!==null||a?.readError!==null,Fe=i?"Structured controls unavailable: failed to load the current config.toml.":a?.readError?`Structured controls unavailable: ${a.readError}`:u?G.valid?"Save or discard raw TOML edits before using structured controls.":"Fix or discard raw TOML edits before using structured controls.":a?.parseError?`Structured controls disabled: ${a.parseError}`:null,We=N.useMemo(()=>Le(g),[g]),Ke=N.useMemo(()=>Xs(g),[g]),qe=N.useMemo(()=>Ys(g),[g]),Ue=N.useMemo(()=>Hs(g),[g]),Ve=N.useMemo(()=>Qs(g),[g]),Be=N.useMemo(()=>Js(g),[g]),Ge=R=>{if(R===M){w(null);return}w(R)},$e=async()=>{try{if((await Promise.all([n(),d()])).some($=>!$||$.status==="error"||$.isError||$.error)){U.error(s("toasts.codexRefreshFailed"));return}w(null)}catch(R){U.error(R.message||s("toasts.codexRefreshError"))}},ze=async()=>{if(!G.valid){U.error(s("toasts.codexFixToml"));return}try{await m({rawText:q,expectedMtime:a?.exists?a.mtime:void 0}),w(null),U.success(s("toasts.codexSaved")),await n()}catch(R){be(R)?U.error(s("toasts.codexChangedExternally")):U.error(R.message||s("toasts.codexSaveFailed"))}},Xe=async(R,je)=>{try{await x({...R,expectedMtime:a?.exists?a.mtime:void 0}),w(null),U.success(je)}catch($){be($)?U.error(s("toasts.codexChangedExternally")):U.error($.message||s("toasts.codexUpdateFailed"))}},ne="mt-0 h-full border-0 p-0 data-[state=inactive]:hidden",Ye=()=>l?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..."]}):o||!t?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(Je,{defaultValue:"overview",className:"flex h-full flex-col",children:[e.jsx("div",{className:"shrink-0 px-4 pt-4",children:e.jsxs(Ze,{className:"grid w-full grid-cols-3",children:[e.jsx(ae,{value:"overview",children:s("codexPage.overview")}),e.jsx(ae,{value:"controls",children:s("codexPage.controlCenter")}),e.jsx(ae,{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(oe,{value:"overview",className:ne,children:e.jsx(Er,{diagnostics:t})}),e.jsx(oe,{value:"controls",className:ne,children:e.jsx(Gs,{workspacePath:t.workspacePath,activeProfile:t.config.activeProfile,topLevelSettings:We,projectTrustEntries:Ke,profileEntries:qe,modelProviderEntries:Ue,mcpServerEntries:Ve,featureCatalog:r,featureState:Be,disabled:Ie,disabledReason:Fe,saving:j,onPatch:Xe})}),e.jsx(oe,{value:"docs",className:ne,children:e.jsx(rr,{diagnostics:t})})]})]});return e.jsx("div",{className:"h-full min-h-0 overflow-hidden",children:e.jsxs(He,{direction:"horizontal",className:"h-full",children:[e.jsx(ve,{defaultSize:45,minSize:35,children:e.jsx("div",{className:"h-full border-r bg-muted/20",children:Ye()})}),e.jsx(Qe,{className:"group flex w-2 cursor-col-resize items-center justify-center bg-border transition-colors hover:bg-primary/20",children:e.jsx(bs,{className:"h-3 w-3 text-muted-foreground group-hover:text-primary"})}),e.jsx(ve,{defaultSize:55,minSize:35,children:e.jsx(Ss,{title:"Codex config.toml",pathLabel:a?.path||t?.file.path||"$CODEX_HOME/config.toml",loading:c,parseWarning:G.valid?a?.parseError:G.error,readWarning:a?.readError,value:q,dirty:u,readOnly:!!a?.readError,saving:p,saveDisabled:!u||p||c||!G.valid||!!a?.readError,onChange:R=>{Ge(R)},onSave:ze,onRefresh:$e,onDiscard:()=>w(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{Ur as CodexPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-Zb8sVEtn.js";import{A as g,a as d,b as m,c as x,d as D,e as h,f,g as j}from"./alert-dialog-
|
|
1
|
+
import{j as e}from"./radix-ui-Zb8sVEtn.js";import{A as g,a as d,b as m,c as x,d as D,e as h,f,g as j}from"./alert-dialog-DXdqyRvZ.js";import{a as A}from"./index-DvsRe_Ab.js";function b({open:l,onConfirm:o,onCancel:r,title:a,description:s,confirmText:t,variant:n="default"}){const{t:i}=A();return e.jsx(g,{open:l,onOpenChange:c=>!c&&r(),children:e.jsxs(d,{children:[e.jsxs(m,{children:[e.jsx(x,{children:a}),e.jsx(D,{children:s})]}),e.jsxs(h,{children:[e.jsx(f,{onClick:r,children:i("confirmDialog.cancel")}),e.jsx(j,{onClick:o,className:n==="destructive"?"bg-red-600 hover:bg-red-700 text-white":"",children:t??i("confirmDialog.confirm")})]})]})})}export{b as C};
|