@kaitranntt/ccs 7.63.0-dev.9 → 7.63.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -10
- package/dist/api/services/profile-lifecycle-service.js +4 -4
- package/dist/api/services/profile-lifecycle-service.js.map +1 -1
- package/dist/api/services/profile-writer.d.ts.map +1 -1
- package/dist/api/services/profile-writer.js +5 -3
- package/dist/api/services/profile-writer.js.map +1 -1
- package/dist/ccs.js +9 -21
- package/dist/ccs.js.map +1 -1
- package/dist/cliproxy/accounts/query.d.ts.map +1 -1
- package/dist/cliproxy/accounts/query.js +8 -15
- package/dist/cliproxy/accounts/query.js.map +1 -1
- package/dist/cliproxy/accounts/registry.d.ts +0 -6
- package/dist/cliproxy/accounts/registry.d.ts.map +1 -1
- package/dist/cliproxy/accounts/registry.js +42 -136
- package/dist/cliproxy/accounts/registry.js.map +1 -1
- package/dist/cliproxy/auth/token-manager.d.ts.map +1 -1
- package/dist/cliproxy/auth/token-manager.js +11 -45
- package/dist/cliproxy/auth/token-manager.js.map +1 -1
- package/dist/cliproxy/executor/index.d.ts.map +1 -1
- package/dist/cliproxy/executor/index.js +12 -25
- package/dist/cliproxy/executor/index.js.map +1 -1
- package/dist/cliproxy/quota-fetcher-codex.d.ts +3 -0
- package/dist/cliproxy/quota-fetcher-codex.d.ts.map +1 -1
- package/dist/cliproxy/quota-fetcher-codex.js +17 -46
- package/dist/cliproxy/quota-fetcher-codex.js.map +1 -1
- package/dist/cliproxy/services/variant-settings.d.ts.map +1 -1
- package/dist/cliproxy/services/variant-settings.js +6 -4
- package/dist/cliproxy/services/variant-settings.js.map +1 -1
- package/dist/cliproxy/stats-transformer.d.ts.map +1 -1
- package/dist/cliproxy/stats-transformer.js +3 -26
- package/dist/cliproxy/stats-transformer.js.map +1 -1
- package/dist/commands/cliproxy/quota-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/quota-subcommand.js +22 -25
- package/dist/commands/cliproxy/quota-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/variant-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/variant-subcommand.js +6 -14
- package/dist/commands/cliproxy/variant-subcommand.js.map +1 -1
- package/dist/commands/install-command.d.ts.map +1 -1
- package/dist/commands/install-command.js +2 -8
- package/dist/commands/install-command.js.map +1 -1
- package/dist/copilot/copilot-executor.d.ts.map +1 -1
- package/dist/copilot/copilot-executor.js +2 -11
- package/dist/copilot/copilot-executor.js.map +1 -1
- package/dist/delegation/executor/result-aggregator.d.ts +1 -2
- package/dist/delegation/executor/result-aggregator.d.ts.map +1 -1
- package/dist/delegation/executor/result-aggregator.js +1 -21
- package/dist/delegation/executor/result-aggregator.js.map +1 -1
- package/dist/delegation/executor/types.d.ts +0 -6
- package/dist/delegation/executor/types.d.ts.map +1 -1
- package/dist/delegation/headless-executor.d.ts.map +1 -1
- package/dist/delegation/headless-executor.js +4 -69
- package/dist/delegation/headless-executor.js.map +1 -1
- package/dist/management/instance-manager.d.ts +1 -1
- package/dist/management/instance-manager.d.ts.map +1 -1
- package/dist/management/instance-manager.js +2 -10
- package/dist/management/instance-manager.js.map +1 -1
- package/dist/targets/codex-adapter.d.ts.map +1 -1
- package/dist/targets/codex-adapter.js +3 -78
- package/dist/targets/codex-adapter.js.map +1 -1
- package/dist/targets/codex-detector.d.ts.map +1 -1
- package/dist/targets/codex-detector.js +7 -28
- package/dist/targets/codex-detector.js.map +1 -1
- package/dist/ui/assets/{accounts-D0UZf0nz.js → accounts-DkxZnPJE.js} +1 -1
- package/dist/ui/assets/{alert-dialog-Da7R-FpD.js → alert-dialog-CiYMglgR.js} +1 -1
- package/dist/ui/assets/{api-DpKfrsn2.js → api-DaOtMRT4.js} +2 -2
- package/dist/ui/assets/{auth-section-CH2_H6xn.js → auth-section-BMaKBRA_.js} +1 -1
- package/dist/ui/assets/{backups-section-C0k3svHF.js → backups-section-DOpSADoH.js} +1 -1
- package/dist/ui/assets/{channels-Cpxagv1M.js → channels-zDFV-BlC.js} +1 -1
- package/dist/ui/assets/{checkbox-B_ZY6YZW.js → checkbox-Cb5AZBZL.js} +1 -1
- package/dist/ui/assets/{claude-extension-CSnMQC_L.js → claude-extension-B5RngGem.js} +1 -1
- package/dist/ui/assets/cliproxy-VYe0Qov1.js +3 -0
- package/dist/ui/assets/{cliproxy-ai-providers-DdQZEqoN.js → cliproxy-ai-providers-DVaaS-CT.js} +1 -1
- package/dist/ui/assets/cliproxy-control-panel-FVIQcFti.js +1 -0
- package/dist/ui/assets/{codex-xj_XJVjB.js → codex-D2yIwOs4.js} +13 -13
- package/dist/ui/assets/{confirm-dialog-tjayxZcM.js → confirm-dialog-B9vRgowr.js} +1 -1
- package/dist/ui/assets/{copilot-DQ5Dr5Ff.js → copilot-HvsOp6hu.js} +2 -2
- package/dist/ui/assets/{cursor-DtFjK37Z.js → cursor-C1XOjAWS.js} +1 -1
- package/dist/ui/assets/{droid-C4qduLWT.js → droid-DshEfT1H.js} +1 -1
- package/dist/ui/assets/{globalenv-section-B2YBzWoz.js → globalenv-section-CmcMkb6z.js} +1 -1
- package/dist/ui/assets/{health-ocBJ9xoH.js → health-CE0VQs6K.js} +1 -1
- package/dist/ui/assets/{icons-Cn04FDSc.js → icons-EMBHZkGo.js} +1 -1
- package/dist/ui/assets/index-6dNBcNC3.js +1 -0
- package/dist/ui/assets/index-BAuT6yuc.css +1 -0
- package/dist/ui/assets/{index-9Qv0NQVB.js → index-CesVGA6m.js} +1 -1
- package/dist/ui/assets/{index-1TKCj6WA.js → index-CmKclBR1.js} +1 -1
- package/dist/ui/assets/{index-C9UUemEw.js → index-CmtSgCxo.js} +1 -1
- package/dist/ui/assets/{index-B3D2Pi4S.js → index-DAtuJuGe.js} +35 -35
- package/dist/ui/assets/{masked-input-XGpOJSYQ.js → masked-input-B2tcbvAj.js} +1 -1
- package/dist/ui/assets/{proxy-status-widget-DwizqfDs.js → proxy-status-widget-BnJD49TF.js} +1 -1
- package/dist/ui/assets/{raw-json-settings-editor-panel-DLf0iq8r.js → raw-json-settings-editor-panel-DnUbq1__.js} +1 -1
- package/dist/ui/assets/{searchable-select-C2N5ZoC7.js → searchable-select-ULayr5K1.js} +1 -1
- package/dist/ui/assets/{separator-CuY8SIhQ.js → separator--ZH5ZM-3.js} +1 -1
- package/dist/ui/assets/shared-qizFb9Ye.js +8 -0
- package/dist/ui/assets/{switch-Dz4ptkeA.js → switch-DmDIWykO.js} +1 -1
- package/dist/ui/assets/{table-CkgTbRUO.js → table-E5IxHhrW.js} +1 -1
- package/dist/ui/assets/tanstack-B8i0evp-.js +4 -0
- package/dist/ui/assets/updates-2Uu4Mgtg.js +1 -0
- package/dist/ui/index.html +4 -4
- package/dist/utils/claude-config-path.d.ts +0 -2
- package/dist/utils/claude-config-path.d.ts.map +1 -1
- package/dist/utils/claude-config-path.js +1 -6
- package/dist/utils/claude-config-path.js.map +1 -1
- package/dist/utils/websearch/hook-env.d.ts.map +1 -1
- package/dist/utils/websearch/hook-env.js +0 -8
- package/dist/utils/websearch/hook-env.js.map +1 -1
- package/dist/utils/websearch/hook-installer.d.ts +2 -3
- package/dist/utils/websearch/hook-installer.d.ts.map +1 -1
- package/dist/utils/websearch/hook-installer.js +2 -3
- package/dist/utils/websearch/hook-installer.js.map +1 -1
- package/dist/utils/websearch/index.d.ts +0 -3
- package/dist/utils/websearch/index.d.ts.map +1 -1
- package/dist/utils/websearch/index.js +2 -23
- package/dist/utils/websearch/index.js.map +1 -1
- package/dist/utils/websearch/profile-hook-injector.d.ts +3 -5
- package/dist/utils/websearch/profile-hook-injector.d.ts.map +1 -1
- package/dist/utils/websearch/profile-hook-injector.js +3 -5
- package/dist/utils/websearch/profile-hook-injector.js.map +1 -1
- package/dist/utils/websearch/status.d.ts.map +1 -1
- package/dist/utils/websearch/status.js +1 -67
- package/dist/utils/websearch/status.js.map +1 -1
- package/dist/utils/websearch-manager.d.ts +11 -11
- package/dist/utils/websearch-manager.d.ts.map +1 -1
- package/dist/utils/websearch-manager.js +17 -32
- package/dist/utils/websearch-manager.js.map +1 -1
- package/dist/web-server/index.d.ts.map +1 -1
- package/dist/web-server/index.js +0 -3
- package/dist/web-server/index.js.map +1 -1
- package/dist/web-server/routes/account-routes.d.ts.map +1 -1
- package/dist/web-server/routes/account-routes.js +1 -2
- package/dist/web-server/routes/account-routes.js.map +1 -1
- package/dist/web-server/routes/cliproxy-auth-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cliproxy-auth-routes.js +1 -1
- package/dist/web-server/routes/cliproxy-auth-routes.js.map +1 -1
- package/dist/web-server/services/codex-dashboard-service.d.ts.map +1 -1
- package/dist/web-server/services/codex-dashboard-service.js +8 -13
- package/dist/web-server/services/codex-dashboard-service.js.map +1 -1
- package/lib/hooks/websearch-transformer.cjs +96 -660
- package/package.json +1 -2
- package/dist/cliproxy/accounts/email-account-identity.d.ts +0 -12
- package/dist/cliproxy/accounts/email-account-identity.d.ts.map +0 -1
- package/dist/cliproxy/accounts/email-account-identity.js +0 -124
- package/dist/cliproxy/accounts/email-account-identity.js.map +0 -1
- package/dist/ui/assets/cliproxy-D9B-TLY3.js +0 -3
- package/dist/ui/assets/cliproxy-control-panel-3Glps_oU.js +0 -1
- package/dist/ui/assets/index-BkXZkwWB.js +0 -1
- package/dist/ui/assets/index-DGQOg_8Q.css +0 -1
- package/dist/ui/assets/shared-CbpV9mUS.js +0 -8
- package/dist/ui/assets/tanstack-CkjseTWE.js +0 -4
- package/dist/ui/assets/updates-HsQEuJIR.js +0 -1
- package/dist/utils/websearch/claude-tool-args.d.ts +0 -5
- package/dist/utils/websearch/claude-tool-args.d.ts.map +0 -1
- package/dist/utils/websearch/claude-tool-args.js +0 -125
- package/dist/utils/websearch/claude-tool-args.js.map +0 -1
- package/dist/utils/websearch/mcp-installer.d.ts +0 -14
- package/dist/utils/websearch/mcp-installer.d.ts.map +0 -1
- package/dist/utils/websearch/mcp-installer.js +0 -351
- package/dist/utils/websearch/mcp-installer.js.map +0 -1
- package/dist/utils/websearch/trace.d.ts +0 -23
- package/dist/utils/websearch/trace.d.ts.map +0 -1
- package/dist/utils/websearch/trace.js +0 -206
- package/dist/utils/websearch/trace.js.map +0 -1
- package/dist/web-server/routes/cliproxy-local-proxy.d.ts +0 -20
- package/dist/web-server/routes/cliproxy-local-proxy.d.ts.map +0 -1
- package/dist/web-server/routes/cliproxy-local-proxy.js +0 -117
- package/dist/web-server/routes/cliproxy-local-proxy.js.map +0 -1
- package/lib/mcp/ccs-websearch-server.cjs +0 -339
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-Dt3edmE5.js";import{r as b}from"./react-vendor-CNOkPC89.js";import{t as U}from"./notifications-B2HqRBj7.js";import{C as L,j as R,k as D,B as I,b as A,d as y,r as T,s as E,t as k,v as P,w as g,I as C,n as xe,b1 as J,b2 as Ne,c as Se,b8 as $e,b9 as fe,ba as ze,Q as Xe,R as Be,U as re,V as te,b3 as je}from"./index-B3D2Pi4S.js";import{S as B}from"./switch-Dz4ptkeA.js";import{a6 as We,aK as He,al as Z,L as Y,m as Ge,aL as Qe,aM as Je,aq as Ze,aE as ce,aF as de,o as ge,Y as es,l as ss,n as rs,V as ts,S as ns,aN as as,w as ls,D as os,T as is,J as cs}from"./icons-Cn04FDSc.js";import{S as G}from"./separator-CuY8SIhQ.js";import{a as ds,u as ve,b as be}from"./tanstack-CkjseTWE.js";import"./code-highlight-BRUf_pqB.js";import{T as us,a as ms,b as we,c as ne,d as xs,e as ae}from"./table-CkgTbRUO.js";import{R as hs}from"./raw-json-settings-editor-panel-DLf0iq8r.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";function W({title:s,icon:r,badge:t,description:a,disabledReason:n,children:o}){return e.jsxs(L,{children:[e.jsxs(R,{className:"pb-2",children:[e.jsxs(D,{className:"flex items-center gap-2 text-base",children:[r,s,t?e.jsx(I,{variant:"outline",className:"text-[10px] font-normal",children:t}):null]}),a?e.jsx("p",{className:"text-xs text-muted-foreground",children:a}):null]}),e.jsxs(A,{className:"space-y-3",children:[n?e.jsx("p",{className:"text-xs text-amber-600",children:n}):null,o]})]})}function ps({catalog:s,state:r,disabled:t=!1,disabledReason:a,onToggle:n}){const o=new Set(s.map(l=>l.name)),i=Object.entries(r).filter(([l])=>!o.has(l)).sort(([l],[d])=>l.localeCompare(d));return e.jsxs(W,{title:"Features",badge:"features",icon:e.jsx(We,{className:"h-4 w-4"}),description:"Toggle the supported Codex feature flags CCS can safely manage.",disabledReason:a,children:[e.jsx("div",{className:"space-y-2",children:s.map(l=>{const d=r[l.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:l.label}),e.jsx(I,{variant:"outline",className:"font-mono text-[10px]",children:l.name})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:l.description})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[d!==null?e.jsx(y,{variant:"outline",size:"sm",onClick:()=>n(l.name,null),disabled:t,children:"Use default"}):null,e.jsx(B,{checked:d===!0,onCheckedChange:c=>n(l.name,c),disabled:t})]})]},l.name)})}),i.length>0?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Existing config-only flags"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"These feature keys already exist in your `config.toml`, so CCS can surface them without claiming full catalog coverage."})]}),i.map(([l,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:l}),e.jsx(I,{variant:"secondary",className:"text-[10px]",children:"existing"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:d===null?"Stored in a non-boolean form. Use raw TOML if you need to edit it.":"Discovered from the current file instead of CCS's built-in catalog."})]}),d===null?e.jsx(I,{variant:"outline",children:"Raw only"}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(y,{variant:"outline",size:"sm",onClick:()=>n(l,null),disabled:t,children:"Use default"}),e.jsx(B,{checked:d===!0,onCheckedChange:c=>n(l,c),disabled:t})]})]},l))]}):null]})}const fs={name:"",transport:"stdio",command:null,args:[],url:null,enabled:!0,required:!1,startupTimeoutSec:null,toolTimeoutSec:null,enabledTools:[],disabledTools:[]};function le(s){return s.join(", ")}function oe(s){return s.split(",").map(r=>r.trim()).filter(Boolean)}function js({initialDraft:s,isNew:r,disabled:t,saving:a,canDelete:n,onSave:o,onDelete:i}){const[l,d]=b.useState(s);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(C,{value:l.name,onChange:c=>d(u=>({...u,name:c.target.value})),placeholder:"playwright",disabled:t||!r}),e.jsxs(T,{value:l.transport,onValueChange:c=>d(u=>({...u,transport:c})),disabled:t,children:[e.jsx(E,{children:e.jsx(k,{})}),e.jsxs(P,{children:[e.jsx(g,{value:"stdio",children:"stdio"}),e.jsx(g,{value:"streamable-http",children:"streamable-http"})]})]}),l.transport==="stdio"?e.jsxs(e.Fragment,{children:[e.jsx(C,{value:l.command??"",onChange:c=>d(u=>({...u,command:c.target.value||null})),placeholder:"npx",disabled:t}),e.jsx(C,{value:le(l.args),onChange:c=>d(u=>({...u,args:oe(c.target.value)})),placeholder:"@playwright/mcp@latest, --flag",disabled:t})]}):e.jsx(C,{className:"sm:col-span-2",value:l.url??"",onChange:c=>d(u=>({...u,url:c.target.value||null})),placeholder:"https://example.test/mcp",disabled:t}),e.jsx(C,{type:"number",min:1,value:l.startupTimeoutSec??"",onChange:c=>d(u=>({...u,startupTimeoutSec:c.target.value?Number(c.target.value):null})),placeholder:"Startup timeout (sec)",disabled:t}),e.jsx(C,{type:"number",min:1,value:l.toolTimeoutSec??"",onChange:c=>d(u=>({...u,toolTimeoutSec:c.target.value?Number(c.target.value):null})),placeholder:"Tool timeout (sec)",disabled:t}),e.jsx(C,{value:le(l.enabledTools),onChange:c=>d(u=>({...u,enabledTools:oe(c.target.value)})),placeholder:"enabled_tools",disabled:t}),e.jsx(C,{value:le(l.disabledTools),onChange:c=>d(u=>({...u,disabledTools:oe(c.target.value)})),placeholder:"disabled_tools",disabled:t})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("label",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-sm",children:["Enabled",e.jsx(B,{checked:l.enabled,onCheckedChange:c=>d(u=>({...u,enabled:c})),disabled:t})]}),e.jsxs("label",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-sm",children:["Required",e.jsx(B,{checked:l.required,onCheckedChange:c=>d(u=>({...u,required:c})),disabled:t})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs(y,{variant:"outline",onClick:i,disabled:t||a||!n,children:[e.jsx(Z,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsxs(y,{onClick:()=>o(l.name,{transport:l.transport,command:l.command,args:l.args,url:l.url,enabled:l.enabled,required:l.required,startupTimeoutSec:l.startupTimeoutSec,toolTimeoutSec:l.toolTimeoutSec,enabledTools:l.enabledTools,disabledTools:l.disabledTools}),disabled:t||a||l.name.trim().length===0,children:[a?e.jsx(Y,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save MCP server"]})]})]})}function gs({entries:s,disabled:r=!1,disabledReason:t,saving:a=!1,onSave:n,onDelete:o}){const[i,l]=b.useState("new"),d=b.useMemo(()=>s.find(h=>h.name===i)??null,[s,i]),c=d??fs,u=JSON.stringify(c);return e.jsxs(W,{title:"MCP servers",badge:"mcp_servers",icon:e.jsx(He,{className:"h-4 w-4"}),description:"Manage the safe MCP transport fields. Keep auth headers and bearer tokens in raw TOML.",disabledReason:t,children:[e.jsxs(T,{value:i,onValueChange:l,disabled:r,children:[e.jsx(E,{children:e.jsx(k,{placeholder:"Select MCP server"})}),e.jsxs(P,{children:[e.jsx(g,{value:"new",children:"Create new MCP server"}),s.map(h=>e.jsx(g,{value:h.name,children:h.name},h.name))]})]}),e.jsx(js,{initialDraft:c,isNew:i==="new",disabled:r,saving:a,canDelete:d!==null,onDelete:async()=>{d&&(await o(d.name),l("new"))},onSave:async(h,f)=>{await n(h,f),l(h)}},u)]})}const vs={name:"",displayName:null,baseUrl:null,envKey:null,wireApi:"responses",requiresOpenaiAuth:!1,supportsWebsockets:!1},bs={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 ws({initialDraft:s,isNew:r,disabled:t,saving:a,canDelete:n,onSave:o,onDelete:i}){const[l,d]=b.useState(s);return e.jsxs(e.Fragment,{children:[r&&e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 rounded-md border border-dashed px-3 py-2 text-xs text-muted-foreground",children:[e.jsxs("p",{children:["Quick start: apply the CLIProxy Codex preset here, then set"," ",e.jsx("strong",{children:"Default provider"})," to ",e.jsx("code",{children:"cliproxy"})," in Top-level settings."]}),e.jsx(y,{variant:"outline",size:"sm",onClick:()=>d(bs),disabled:t,children:"Use CLIProxy Codex preset"})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(C,{value:l.name,onChange:c=>d(u=>({...u,name:c.target.value})),placeholder:"Provider id",disabled:t||!r}),e.jsx(C,{value:l.displayName??"",onChange:c=>d(u=>({...u,displayName:c.target.value||null})),placeholder:"Display name",disabled:t}),e.jsx(C,{value:l.baseUrl??"",onChange:c=>d(u=>({...u,baseUrl:c.target.value||null})),placeholder:"http://127.0.0.1:8317/api/provider/codex",disabled:t}),e.jsx(C,{value:l.envKey??"",onChange:c=>d(u=>({...u,envKey:c.target.value||null})),placeholder:"CLIPROXY_API_KEY",disabled:t})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[e.jsxs(T,{value:l.wireApi??"responses",onValueChange:c=>d(u=>({...u,wireApi:c})),disabled:t,children:[e.jsx(E,{children:e.jsx(k,{})}),e.jsx(P,{children:e.jsx(g,{value:"responses",children:"responses"})})]}),e.jsxs("label",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-sm",children:["Requires OpenAI auth",e.jsx(B,{checked:l.requiresOpenaiAuth,onCheckedChange:c=>d(u=>({...u,requiresOpenaiAuth:c})),disabled:t})]}),e.jsxs("label",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-sm",children:["Supports websockets",e.jsx(B,{checked:l.supportsWebsockets,onCheckedChange:c=>d(u=>({...u,supportsWebsockets:c})),disabled:t})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs(y,{variant:"outline",onClick:i,disabled:t||a||!n,children:[e.jsx(Z,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsxs(y,{onClick:()=>o(l.name,{displayName:l.displayName,baseUrl:l.baseUrl,envKey:l.envKey,wireApi:l.wireApi,requiresOpenaiAuth:l.requiresOpenaiAuth,supportsWebsockets:l.supportsWebsockets}),disabled:t||a||l.name.trim().length===0,children:[a?e.jsx(Y,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save provider"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["If you want plain native ",e.jsx("code",{children:"codex"})," to default to CLIProxy, save a provider named"," ",e.jsx("code",{children:"cliproxy"})," with ",e.jsx("code",{children:"CLIPROXY_API_KEY"})," here, then pick"," ",e.jsx("code",{children:"cliproxy"})," in the ",e.jsx("strong",{children:"Default provider"})," control above."]})]})}function Cs({entries:s,disabled:r=!1,disabledReason:t,saving:a=!1,onSave:n,onDelete:o}){const[i,l]=b.useState("new"),d=b.useMemo(()=>s.find(h=>h.name===i)??null,[s,i]),c=d??vs,u=JSON.stringify(c);return e.jsxs(W,{title:"Model providers",badge:"model_providers",icon:e.jsx(Ge,{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(T,{value:i,onValueChange:l,disabled:r,children:[e.jsx(E,{children:e.jsx(k,{placeholder:"Select provider"})}),e.jsxs(P,{children:[e.jsx(g,{value:"new",children:"Create new provider"}),s.map(h=>e.jsx(g,{value:h.name,children:h.name},h.name))]})]}),e.jsx(ws,{initialDraft:c,isNew:i==="new",disabled:r,saving:a,canDelete:d!==null,onDelete:async()=>{d&&(await o(d.name),l("new"))},onSave:async(h,f)=>{await n(h,f),l(h)}},u)]})}function ys({initialName:s,initialModel:r,initialProvider:t,initialEffort:a,providerNames:n,activeProfile:o,selectedEntryName:i,disabled:l,saving:d,onSave:c,onDelete:u,onSetActive:h}){const[f,x]=b.useState(s),[j,m]=b.useState(r),[v,H]=b.useState(t),[F,_]=b.useState(a);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(C,{value:f,onChange:w=>x(w.target.value),placeholder:"deep-review",disabled:l||i!==null}),e.jsx(C,{value:j??"",onChange:w=>m(w.target.value||null),placeholder:"gpt-5.4",disabled:l}),e.jsxs(T,{value:v??"__unset__",onValueChange:w=>H(w==="__unset__"?null:w),disabled:l,children:[e.jsx(E,{children:e.jsx(k,{placeholder:"Use global provider"})}),e.jsxs(P,{children:[e.jsx(g,{value:"__unset__",children:"Use global provider"}),n.map(w=>e.jsx(g,{value:w,children:w},w))]})]}),e.jsxs(T,{value:F??"__unset__",onValueChange:w=>_(w==="__unset__"?null:w),disabled:l,children:[e.jsx(E,{children:e.jsx(k,{placeholder:"Use global effort"})}),e.jsxs(P,{children:[e.jsx(g,{value:"__unset__",children:"Use global effort"}),["minimal","low","medium","high","xhigh"].map(w=>e.jsx(g,{value:w,children:w},w))]})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(y,{variant:"outline",onClick:u,disabled:l||d||!i,children:[e.jsx(Z,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsx(y,{variant:"outline",onClick:h,disabled:l||d||!i||i===o,children:"Set active"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(y,{variant:"outline",onClick:()=>c(f,{model:j,modelProvider:v,modelReasoningEffort:F},!1),disabled:l||d||f.trim().length===0,children:[d?e.jsx(Y,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save profile"]}),e.jsxs(y,{onClick:()=>c(f,{model:j,modelProvider:v,modelReasoningEffort:F},!0),disabled:l||d||f.trim().length===0,children:[d?e.jsx(Y,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save + activate"]})]})]})]})}function Ns({activeProfile:s,entries:r,providerNames:t,disabled:a=!1,disabledReason:n,saving:o=!1,onSave:i,onDelete:l,onSetActive:d}){const[c,u]=b.useState("new"),h=b.useMemo(()=>r.find(x=>x.name===c)??null,[r,c]),f=JSON.stringify(h??{name:"",values:{}});return e.jsxs(W,{title:"Profiles",badge:"profiles",icon:e.jsx(Qe,{className:"h-4 w-4"}),description:"Create reusable Codex overlays and set the active default profile.",disabledReason:n,children:[e.jsxs(T,{value:c,onValueChange:u,disabled:a,children:[e.jsx(E,{children:e.jsx(k,{placeholder:"Select profile"})}),e.jsxs(P,{children:[e.jsx(g,{value:"new",children:"Create new profile"}),r.map(x=>e.jsxs(g,{value:x.name,children:[x.name,x.name===s?" (active)":""]},x.name))]})]}),e.jsx(ys,{initialName:h?.name??"",initialModel:h?.values.model??null,initialProvider:h?.values.modelProvider??null,initialEffort:h?.values.modelReasoningEffort??null,providerNames:t,activeProfile:s,selectedEntryName:h?.name??null,disabled:a,saving:o,onDelete:async()=>{h&&(await l(h.name),u("new"))},onSetActive:async()=>{h&&await d(h.name)},onSave:async(x,j,m)=>{await i(x,j,m),u(x)}},f)]})}function Ss({workspacePath:s,disabled:r,saving:t,onSave:a}){const[n,o]=b.useState(s),[i,l]=b.useState("trusted");return e.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_160px_auto]",children:[e.jsx(C,{value:n,onChange:d=>o(d.target.value),placeholder:"~/repo or /absolute/path",disabled:r}),e.jsxs(T,{value:i,onValueChange:l,disabled:r,children:[e.jsx(E,{children:e.jsx(k,{})}),e.jsxs(P,{children:[e.jsx(g,{value:"trusted",children:"trusted"}),e.jsx(g,{value:"untrusted",children:"untrusted"})]})]}),e.jsxs(y,{onClick:()=>a(n,i),disabled:r||t,children:[t?e.jsx(Y,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save trust"]})]})}function _s({workspacePath:s,entries:r,disabled:t=!1,disabledReason:a,saving:n=!1,onSave:o}){return e.jsxs(W,{title:"Project trust",badge:"projects",icon:e.jsx(Je,{className:"h-4 w-4"}),description:"Trust current workspaces or remove stale trust entries without opening raw TOML.",disabledReason:a,children:[e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Paths must be absolute or start with ",e.jsx("code",{children:"~/"}),". Relative paths are rejected so CCS does not trust the wrong folder."]}),e.jsx(Ss,{workspacePath:s,disabled:t,saving:n,onSave:o},s),e.jsx(y,{variant:"outline",className:"w-full justify-start",onClick:()=>o(s,"trusted"),disabled:t||n,children:"Trust current workspace"}),e.jsx("div",{className:"space-y-2",children:r.length===0?e.jsx("p",{className:"text-xs text-muted-foreground",children:"No explicit project trust entries saved."}):r.map(i=>e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border px-3 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:i.path}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["trust_level = ",i.trustLevel]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(y,{variant:"ghost",size:"sm",onClick:()=>o(i.path,i.trustLevel==="trusted"?"untrusted":"trusted"),disabled:t||n,children:"Toggle"}),e.jsx(y,{variant:"ghost",size:"icon",onClick:()=>o(i.path,null),disabled:t||n,children:e.jsx(Z,{className:"h-4 w-4"})})]})]},i.path))})]})}const O="__unset__";function $(s){return s??O}function z(s,r){return r&&!s.includes(r)?[r,...s]:s}function Ts(s,r){const t={};return r.model!==s.model&&(t.model=r.model),r.modelReasoningEffort!==s.modelReasoningEffort&&(t.modelReasoningEffort=r.modelReasoningEffort),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 Es({initialValues:s,providerNames:r,disabled:t,saving:a,onSave:n}){const[o,i]=b.useState(s),l=z(["minimal","low","medium","high","xhigh"],o.modelReasoningEffort),d=z(r,o.modelProvider),c=z(["on-request","never","untrusted"],o.approvalPolicy),u=z(["read-only","workspace-write","danger-full-access"],o.sandboxMode),h=z(["cached","live","disabled"],o.webSearch),f=z(["none","friendly","pragmatic"],o.personality),x=Ts(s,o),j=Object.keys(x).length>0;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Model"}),e.jsx(C,{value:o.model??"",onChange:m=>i(v=>({...v,model:m.target.value||null})),placeholder:"gpt-5.4",disabled:t})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Reasoning effort"}),e.jsxs(T,{value:$(o.modelReasoningEffort),onValueChange:m=>i(v=>({...v,modelReasoningEffort:m===O?null:m})),disabled:t,children:[e.jsx(E,{children:e.jsx(k,{placeholder:"Use default"})}),e.jsxs(P,{children:[e.jsx(g,{value:O,children:"Use default"}),l.map(m=>e.jsx(g,{value:m,children:m},m))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Default provider"}),e.jsxs(T,{value:$(o.modelProvider),onValueChange:m=>i(v=>({...v,modelProvider:m===O?null:m})),disabled:t,children:[e.jsx(E,{children:e.jsx(k,{placeholder:"Use Codex default"})}),e.jsxs(P,{children:[e.jsx(g,{value:O,children:"Use Codex default"}),d.map(m=>e.jsx(g,{value:m,children:m},m))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Approval policy"}),e.jsxs(T,{value:$(o.approvalPolicy),onValueChange:m=>i(v=>({...v,approvalPolicy:m===O?null:m})),disabled:t,children:[e.jsx(E,{children:e.jsx(k,{placeholder:"Use default"})}),e.jsxs(P,{children:[e.jsx(g,{value:O,children:"Use default"}),c.map(m=>e.jsx(g,{value:m,children:m},m))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Sandbox mode"}),e.jsxs(T,{value:$(o.sandboxMode),onValueChange:m=>i(v=>({...v,sandboxMode:m===O?null:m})),disabled:t,children:[e.jsx(E,{children:e.jsx(k,{placeholder:"Use default"})}),e.jsxs(P,{children:[e.jsx(g,{value:O,children:"Use default"}),u.map(m=>e.jsx(g,{value:m,children:m},m))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Web search"}),e.jsxs(T,{value:$(o.webSearch),onValueChange:m=>i(v=>({...v,webSearch:m===O?null:m})),disabled:t,children:[e.jsx(E,{children:e.jsx(k,{placeholder:"Use default"})}),e.jsxs(P,{children:[e.jsx(g,{value:O,children:"Use default"}),h.map(m=>e.jsx(g,{value:m,children:m},m))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Tool output token limit"}),e.jsx(C,{type:"number",min:1,value:o.toolOutputTokenLimit??"",onChange:m=>i(v=>({...v,toolOutputTokenLimit:m.target.value?Number(m.target.value):null})),placeholder:"25000",disabled:t})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Personality"}),e.jsxs(T,{value:$(o.personality),onValueChange:m=>i(v=>({...v,personality:m===O?null:m})),disabled:t,children:[e.jsx(E,{children:e.jsx(k,{placeholder:"Use default"})}),e.jsxs(P,{children:[e.jsx(g,{value:O,children:"Use default"}),f.map(m=>e.jsx(g,{value:m,children:m},m))]})]})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs(y,{onClick:()=>n(x),disabled:t||a||!j,children:[a?e.jsx(Y,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save top-level settings"]})})]})}function ks({values:s,providerNames:r,disabled:t=!1,disabledReason:a,saving:n=!1,onSave:o}){return e.jsx(W,{title:"Top-level controls",badge:"config.toml",icon:e.jsx(Ze,{className:"h-4 w-4"}),description:"Structured controls for the stable top-level Codex settings users touch most often. Unsupported upstream shapes stay untouched and should be edited in raw TOML.",disabledReason:a,children:e.jsx(Es,{initialValues:s,providerNames:r,disabled:t,saving:n,onSave:o},JSON.stringify(s))})}function Ps({workspacePath:s,activeProfile:r,topLevelSettings:t,projectTrustEntries:a,profileEntries:n,modelProviderEntries:o,mcpServerEntries:i,featureCatalog:l,featureState:d,disabled:c,disabledReason:u,saving:h,onPatch:f}){return e.jsx(xe,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 pr-1",children:[e.jsxs(L,{children:[e.jsx(R,{className:"pb-2",children:e.jsxs(D,{className:"flex items-center gap-2 text-base",children:[e.jsx(ce,{className:"h-4 w-4"}),"Structured controls boundary"]})}),e.jsxs(A,{className:"space-y-2 text-sm text-muted-foreground",children:[e.jsxs("p",{children:["Guided controls write only the user-layer ",e.jsx("code",{children:"config.toml"}),". They do not model the full effective Codex runtime once trusted repo layers and CCS transient"," ",e.jsx("code",{children:"-c"})," overrides are involved."]}),e.jsx("p",{children:"Structured saves normalize TOML formatting and strip comments. Use the raw editor on the right when exact layout matters."})]})]}),e.jsx(ks,{values:t,providerNames:o.map(x=>x.name),disabled:c,disabledReason:u,saving:h,onSave:x=>f({kind:"top-level",values:x},"Saved top-level Codex settings.")}),e.jsx(_s,{workspacePath:s,entries:a,disabled:c,disabledReason:u,saving:h,onSave:(x,j)=>f({kind:"project-trust",path:x,trustLevel:j},j?"Saved project trust entry.":"Removed project trust entry.")}),e.jsx(Ns,{activeProfile:r,entries:n,providerNames:o.map(x=>x.name),disabled:c,disabledReason:u,saving:h,onSave:(x,j,m)=>f({kind:"profile",action:"upsert",name:x,values:j,setAsActive:m},"Saved profile."),onDelete:x=>f({kind:"profile",action:"delete",name:x},"Deleted profile."),onSetActive:x=>f({kind:"profile",action:"set-active",name:x},"Set active profile.")}),e.jsx(Cs,{entries:o,disabled:c,disabledReason:u,saving:h,onSave:(x,j)=>f({kind:"model-provider",action:"upsert",name:x,values:j},"Saved model provider."),onDelete:x=>f({kind:"model-provider",action:"delete",name:x},"Deleted model provider.")}),e.jsx(gs,{entries:i,disabled:c,disabledReason:u,saving:h,onSave:(x,j)=>f({kind:"mcp-server",action:"upsert",name:x,values:j},"Saved MCP server."),onDelete:x=>f({kind:"mcp-server",action:"delete",name:x},"Deleted MCP server.")}),e.jsx(ps,{catalog:l,state:d,disabled:c,disabledReason:u,onToggle:(x,j)=>f({kind:"feature",feature:x,enabled:j},"Saved feature toggle.")})]})})}const _e=`model_provider = "cliproxy"
|
|
1
|
+
import{j as e}from"./radix-ui-Dt3edmE5.js";import{r as b}from"./react-vendor-CNOkPC89.js";import{t as F}from"./notifications-B2HqRBj7.js";import{C as L,j as D,k as R,B as I,b as A,d as y,r as T,s as E,t as k,v as P,w as g,I as C,n as xe,b7 as J,b8 as Ne,c as Se,be as ze,bf as pe,bg as Ye,Q as Xe,R as Be,U as re,V as te,b9 as je}from"./index-DAtuJuGe.js";import{S as B}from"./switch-DmDIWykO.js";import{a4 as We,aK as He,aj as Z,L as $,m as Qe,aL as Ge,aM as Je,ao as Ze,aE as ce,aF as de,o as ge,Q as es,l as ss,n as rs,O as ts,S as ns,aN as as,v as ls,w as os,T as is,D as cs}from"./icons-EMBHZkGo.js";import{S as Q}from"./separator--ZH5ZM-3.js";import{a as ds,u as ve,b as be}from"./tanstack-B8i0evp-.js";import"./code-highlight-BRUf_pqB.js";import{T as us,a as ms,b as we,c as ne,d as xs,e as ae}from"./table-E5IxHhrW.js";import{R as hs}from"./raw-json-settings-editor-panel-DnUbq1__.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";function W({title:s,icon:r,badge:t,description:a,disabledReason:n,children:o}){return e.jsxs(L,{children:[e.jsxs(D,{className:"pb-2",children:[e.jsxs(R,{className:"flex items-center gap-2 text-base",children:[r,s,t?e.jsx(I,{variant:"outline",className:"text-[10px] font-normal",children:t}):null]}),a?e.jsx("p",{className:"text-xs text-muted-foreground",children:a}):null]}),e.jsxs(A,{className:"space-y-3",children:[n?e.jsx("p",{className:"text-xs text-amber-600",children:n}):null,o]})]})}function fs({catalog:s,state:r,disabled:t=!1,disabledReason:a,onToggle:n}){const o=new Set(s.map(l=>l.name)),i=Object.entries(r).filter(([l])=>!o.has(l)).sort(([l],[d])=>l.localeCompare(d));return e.jsxs(W,{title:"Features",badge:"features",icon:e.jsx(We,{className:"h-4 w-4"}),description:"Toggle the supported Codex feature flags CCS can safely manage.",disabledReason:a,children:[e.jsx("div",{className:"space-y-2",children:s.map(l=>{const d=r[l.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:l.label}),e.jsx(I,{variant:"outline",className:"font-mono text-[10px]",children:l.name})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:l.description})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[d!==null?e.jsx(y,{variant:"outline",size:"sm",onClick:()=>n(l.name,null),disabled:t,children:"Use default"}):null,e.jsx(B,{checked:d===!0,onCheckedChange:c=>n(l.name,c),disabled:t})]})]},l.name)})}),i.length>0?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Existing config-only flags"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"These feature keys already exist in your `config.toml`, so CCS can surface them without claiming full catalog coverage."})]}),i.map(([l,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:l}),e.jsx(I,{variant:"secondary",className:"text-[10px]",children:"existing"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:d===null?"Stored in a non-boolean form. Use raw TOML if you need to edit it.":"Discovered from the current file instead of CCS's built-in catalog."})]}),d===null?e.jsx(I,{variant:"outline",children:"Raw only"}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(y,{variant:"outline",size:"sm",onClick:()=>n(l,null),disabled:t,children:"Use default"}),e.jsx(B,{checked:d===!0,onCheckedChange:c=>n(l,c),disabled:t})]})]},l))]}):null]})}const ps={name:"",transport:"stdio",command:null,args:[],url:null,enabled:!0,required:!1,startupTimeoutSec:null,toolTimeoutSec:null,enabledTools:[],disabledTools:[]};function le(s){return s.join(", ")}function oe(s){return s.split(",").map(r=>r.trim()).filter(Boolean)}function js({initialDraft:s,isNew:r,disabled:t,saving:a,canDelete:n,onSave:o,onDelete:i}){const[l,d]=b.useState(s);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(C,{value:l.name,onChange:c=>d(u=>({...u,name:c.target.value})),placeholder:"playwright",disabled:t||!r}),e.jsxs(T,{value:l.transport,onValueChange:c=>d(u=>({...u,transport:c})),disabled:t,children:[e.jsx(E,{children:e.jsx(k,{})}),e.jsxs(P,{children:[e.jsx(g,{value:"stdio",children:"stdio"}),e.jsx(g,{value:"streamable-http",children:"streamable-http"})]})]}),l.transport==="stdio"?e.jsxs(e.Fragment,{children:[e.jsx(C,{value:l.command??"",onChange:c=>d(u=>({...u,command:c.target.value||null})),placeholder:"npx",disabled:t}),e.jsx(C,{value:le(l.args),onChange:c=>d(u=>({...u,args:oe(c.target.value)})),placeholder:"@playwright/mcp@latest, --flag",disabled:t})]}):e.jsx(C,{className:"sm:col-span-2",value:l.url??"",onChange:c=>d(u=>({...u,url:c.target.value||null})),placeholder:"https://example.test/mcp",disabled:t}),e.jsx(C,{type:"number",min:1,value:l.startupTimeoutSec??"",onChange:c=>d(u=>({...u,startupTimeoutSec:c.target.value?Number(c.target.value):null})),placeholder:"Startup timeout (sec)",disabled:t}),e.jsx(C,{type:"number",min:1,value:l.toolTimeoutSec??"",onChange:c=>d(u=>({...u,toolTimeoutSec:c.target.value?Number(c.target.value):null})),placeholder:"Tool timeout (sec)",disabled:t}),e.jsx(C,{value:le(l.enabledTools),onChange:c=>d(u=>({...u,enabledTools:oe(c.target.value)})),placeholder:"enabled_tools",disabled:t}),e.jsx(C,{value:le(l.disabledTools),onChange:c=>d(u=>({...u,disabledTools:oe(c.target.value)})),placeholder:"disabled_tools",disabled:t})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("label",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-sm",children:["Enabled",e.jsx(B,{checked:l.enabled,onCheckedChange:c=>d(u=>({...u,enabled:c})),disabled:t})]}),e.jsxs("label",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-sm",children:["Required",e.jsx(B,{checked:l.required,onCheckedChange:c=>d(u=>({...u,required:c})),disabled:t})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs(y,{variant:"outline",onClick:i,disabled:t||a||!n,children:[e.jsx(Z,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsxs(y,{onClick:()=>o(l.name,{transport:l.transport,command:l.command,args:l.args,url:l.url,enabled:l.enabled,required:l.required,startupTimeoutSec:l.startupTimeoutSec,toolTimeoutSec:l.toolTimeoutSec,enabledTools:l.enabledTools,disabledTools:l.disabledTools}),disabled:t||a||l.name.trim().length===0,children:[a?e.jsx($,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save MCP server"]})]})]})}function gs({entries:s,disabled:r=!1,disabledReason:t,saving:a=!1,onSave:n,onDelete:o}){const[i,l]=b.useState("new"),d=b.useMemo(()=>s.find(h=>h.name===i)??null,[s,i]),c=d??ps,u=JSON.stringify(c);return e.jsxs(W,{title:"MCP servers",badge:"mcp_servers",icon:e.jsx(He,{className:"h-4 w-4"}),description:"Manage the safe MCP transport fields. Keep auth headers and bearer tokens in raw TOML.",disabledReason:t,children:[e.jsxs(T,{value:i,onValueChange:l,disabled:r,children:[e.jsx(E,{children:e.jsx(k,{placeholder:"Select MCP server"})}),e.jsxs(P,{children:[e.jsx(g,{value:"new",children:"Create new MCP server"}),s.map(h=>e.jsx(g,{value:h.name,children:h.name},h.name))]})]}),e.jsx(js,{initialDraft:c,isNew:i==="new",disabled:r,saving:a,canDelete:d!==null,onDelete:async()=>{d&&(await o(d.name),l("new"))},onSave:async(h,p)=>{await n(h,p),l(h)}},u)]})}const vs={name:"",displayName:null,baseUrl:null,envKey:null,wireApi:"responses",requiresOpenaiAuth:!1,supportsWebsockets:!1},bs={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 ws({initialDraft:s,isNew:r,disabled:t,saving:a,canDelete:n,onSave:o,onDelete:i}){const[l,d]=b.useState(s);return e.jsxs(e.Fragment,{children:[r&&e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 rounded-md border border-dashed px-3 py-2 text-xs text-muted-foreground",children:[e.jsxs("p",{children:["Quick start: apply the CLIProxy Codex preset here, then set"," ",e.jsx("strong",{children:"Default provider"})," to ",e.jsx("code",{children:"cliproxy"})," in Top-level settings."]}),e.jsx(y,{variant:"outline",size:"sm",onClick:()=>d(bs),disabled:t,children:"Use CLIProxy Codex preset"})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(C,{value:l.name,onChange:c=>d(u=>({...u,name:c.target.value})),placeholder:"Provider id",disabled:t||!r}),e.jsx(C,{value:l.displayName??"",onChange:c=>d(u=>({...u,displayName:c.target.value||null})),placeholder:"Display name",disabled:t}),e.jsx(C,{value:l.baseUrl??"",onChange:c=>d(u=>({...u,baseUrl:c.target.value||null})),placeholder:"http://127.0.0.1:8317/api/provider/codex",disabled:t}),e.jsx(C,{value:l.envKey??"",onChange:c=>d(u=>({...u,envKey:c.target.value||null})),placeholder:"CLIPROXY_API_KEY",disabled:t})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[e.jsxs(T,{value:l.wireApi??"responses",onValueChange:c=>d(u=>({...u,wireApi:c})),disabled:t,children:[e.jsx(E,{children:e.jsx(k,{})}),e.jsx(P,{children:e.jsx(g,{value:"responses",children:"responses"})})]}),e.jsxs("label",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-sm",children:["Requires OpenAI auth",e.jsx(B,{checked:l.requiresOpenaiAuth,onCheckedChange:c=>d(u=>({...u,requiresOpenaiAuth:c})),disabled:t})]}),e.jsxs("label",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-sm",children:["Supports websockets",e.jsx(B,{checked:l.supportsWebsockets,onCheckedChange:c=>d(u=>({...u,supportsWebsockets:c})),disabled:t})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs(y,{variant:"outline",onClick:i,disabled:t||a||!n,children:[e.jsx(Z,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsxs(y,{onClick:()=>o(l.name,{displayName:l.displayName,baseUrl:l.baseUrl,envKey:l.envKey,wireApi:l.wireApi,requiresOpenaiAuth:l.requiresOpenaiAuth,supportsWebsockets:l.supportsWebsockets}),disabled:t||a||l.name.trim().length===0,children:[a?e.jsx($,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save provider"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["If you want plain native ",e.jsx("code",{children:"codex"})," to default to CLIProxy, save a provider named"," ",e.jsx("code",{children:"cliproxy"})," with ",e.jsx("code",{children:"CLIPROXY_API_KEY"})," here, then pick"," ",e.jsx("code",{children:"cliproxy"})," in the ",e.jsx("strong",{children:"Default provider"})," control above."]})]})}function Cs({entries:s,disabled:r=!1,disabledReason:t,saving:a=!1,onSave:n,onDelete:o}){const[i,l]=b.useState("new"),d=b.useMemo(()=>s.find(h=>h.name===i)??null,[s,i]),c=d??vs,u=JSON.stringify(c);return e.jsxs(W,{title:"Model providers",badge:"model_providers",icon:e.jsx(Qe,{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(T,{value:i,onValueChange:l,disabled:r,children:[e.jsx(E,{children:e.jsx(k,{placeholder:"Select provider"})}),e.jsxs(P,{children:[e.jsx(g,{value:"new",children:"Create new provider"}),s.map(h=>e.jsx(g,{value:h.name,children:h.name},h.name))]})]}),e.jsx(ws,{initialDraft:c,isNew:i==="new",disabled:r,saving:a,canDelete:d!==null,onDelete:async()=>{d&&(await o(d.name),l("new"))},onSave:async(h,p)=>{await n(h,p),l(h)}},u)]})}function ys({initialName:s,initialModel:r,initialProvider:t,initialEffort:a,providerNames:n,activeProfile:o,selectedEntryName:i,disabled:l,saving:d,onSave:c,onDelete:u,onSetActive:h}){const[p,x]=b.useState(s),[j,m]=b.useState(r),[v,H]=b.useState(t),[U,_]=b.useState(a);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(C,{value:p,onChange:w=>x(w.target.value),placeholder:"deep-review",disabled:l||i!==null}),e.jsx(C,{value:j??"",onChange:w=>m(w.target.value||null),placeholder:"gpt-5.4",disabled:l}),e.jsxs(T,{value:v??"__unset__",onValueChange:w=>H(w==="__unset__"?null:w),disabled:l,children:[e.jsx(E,{children:e.jsx(k,{placeholder:"Use global provider"})}),e.jsxs(P,{children:[e.jsx(g,{value:"__unset__",children:"Use global provider"}),n.map(w=>e.jsx(g,{value:w,children:w},w))]})]}),e.jsxs(T,{value:U??"__unset__",onValueChange:w=>_(w==="__unset__"?null:w),disabled:l,children:[e.jsx(E,{children:e.jsx(k,{placeholder:"Use global effort"})}),e.jsxs(P,{children:[e.jsx(g,{value:"__unset__",children:"Use global effort"}),["minimal","low","medium","high","xhigh"].map(w=>e.jsx(g,{value:w,children:w},w))]})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(y,{variant:"outline",onClick:u,disabled:l||d||!i,children:[e.jsx(Z,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsx(y,{variant:"outline",onClick:h,disabled:l||d||!i||i===o,children:"Set active"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(y,{variant:"outline",onClick:()=>c(p,{model:j,modelProvider:v,modelReasoningEffort:U},!1),disabled:l||d||p.trim().length===0,children:[d?e.jsx($,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save profile"]}),e.jsxs(y,{onClick:()=>c(p,{model:j,modelProvider:v,modelReasoningEffort:U},!0),disabled:l||d||p.trim().length===0,children:[d?e.jsx($,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save + activate"]})]})]})]})}function Ns({activeProfile:s,entries:r,providerNames:t,disabled:a=!1,disabledReason:n,saving:o=!1,onSave:i,onDelete:l,onSetActive:d}){const[c,u]=b.useState("new"),h=b.useMemo(()=>r.find(x=>x.name===c)??null,[r,c]),p=JSON.stringify(h??{name:"",values:{}});return e.jsxs(W,{title:"Profiles",badge:"profiles",icon:e.jsx(Ge,{className:"h-4 w-4"}),description:"Create reusable Codex overlays and set the active default profile.",disabledReason:n,children:[e.jsxs(T,{value:c,onValueChange:u,disabled:a,children:[e.jsx(E,{children:e.jsx(k,{placeholder:"Select profile"})}),e.jsxs(P,{children:[e.jsx(g,{value:"new",children:"Create new profile"}),r.map(x=>e.jsxs(g,{value:x.name,children:[x.name,x.name===s?" (active)":""]},x.name))]})]}),e.jsx(ys,{initialName:h?.name??"",initialModel:h?.values.model??null,initialProvider:h?.values.modelProvider??null,initialEffort:h?.values.modelReasoningEffort??null,providerNames:t,activeProfile:s,selectedEntryName:h?.name??null,disabled:a,saving:o,onDelete:async()=>{h&&(await l(h.name),u("new"))},onSetActive:async()=>{h&&await d(h.name)},onSave:async(x,j,m)=>{await i(x,j,m),u(x)}},p)]})}function Ss({workspacePath:s,disabled:r,saving:t,onSave:a}){const[n,o]=b.useState(s),[i,l]=b.useState("trusted");return e.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_160px_auto]",children:[e.jsx(C,{value:n,onChange:d=>o(d.target.value),placeholder:"~/repo or /absolute/path",disabled:r}),e.jsxs(T,{value:i,onValueChange:l,disabled:r,children:[e.jsx(E,{children:e.jsx(k,{})}),e.jsxs(P,{children:[e.jsx(g,{value:"trusted",children:"trusted"}),e.jsx(g,{value:"untrusted",children:"untrusted"})]})]}),e.jsxs(y,{onClick:()=>a(n,i),disabled:r||t,children:[t?e.jsx($,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save trust"]})]})}function _s({workspacePath:s,entries:r,disabled:t=!1,disabledReason:a,saving:n=!1,onSave:o}){return e.jsxs(W,{title:"Project trust",badge:"projects",icon:e.jsx(Je,{className:"h-4 w-4"}),description:"Trust current workspaces or remove stale trust entries without opening raw TOML.",disabledReason:a,children:[e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Paths must be absolute or start with ",e.jsx("code",{children:"~/"}),". Relative paths are rejected so CCS does not trust the wrong folder."]}),e.jsx(Ss,{workspacePath:s,disabled:t,saving:n,onSave:o},s),e.jsx(y,{variant:"outline",className:"w-full justify-start",onClick:()=>o(s,"trusted"),disabled:t||n,children:"Trust current workspace"}),e.jsx("div",{className:"space-y-2",children:r.length===0?e.jsx("p",{className:"text-xs text-muted-foreground",children:"No explicit project trust entries saved."}):r.map(i=>e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border px-3 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:i.path}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["trust_level = ",i.trustLevel]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(y,{variant:"ghost",size:"sm",onClick:()=>o(i.path,i.trustLevel==="trusted"?"untrusted":"trusted"),disabled:t||n,children:"Toggle"}),e.jsx(y,{variant:"ghost",size:"icon",onClick:()=>o(i.path,null),disabled:t||n,children:e.jsx(Z,{className:"h-4 w-4"})})]})]},i.path))})]})}const O="__unset__";function z(s){return s??O}function Y(s,r){return r&&!s.includes(r)?[r,...s]:s}function Ts(s,r){const t={};return r.model!==s.model&&(t.model=r.model),r.modelReasoningEffort!==s.modelReasoningEffort&&(t.modelReasoningEffort=r.modelReasoningEffort),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 Es({initialValues:s,providerNames:r,disabled:t,saving:a,onSave:n}){const[o,i]=b.useState(s),l=Y(["minimal","low","medium","high","xhigh"],o.modelReasoningEffort),d=Y(r,o.modelProvider),c=Y(["on-request","never","untrusted"],o.approvalPolicy),u=Y(["read-only","workspace-write","danger-full-access"],o.sandboxMode),h=Y(["cached","live","disabled"],o.webSearch),p=Y(["none","friendly","pragmatic"],o.personality),x=Ts(s,o),j=Object.keys(x).length>0;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Model"}),e.jsx(C,{value:o.model??"",onChange:m=>i(v=>({...v,model:m.target.value||null})),placeholder:"gpt-5.4",disabled:t})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Reasoning effort"}),e.jsxs(T,{value:z(o.modelReasoningEffort),onValueChange:m=>i(v=>({...v,modelReasoningEffort:m===O?null:m})),disabled:t,children:[e.jsx(E,{children:e.jsx(k,{placeholder:"Use default"})}),e.jsxs(P,{children:[e.jsx(g,{value:O,children:"Use default"}),l.map(m=>e.jsx(g,{value:m,children:m},m))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Default provider"}),e.jsxs(T,{value:z(o.modelProvider),onValueChange:m=>i(v=>({...v,modelProvider:m===O?null:m})),disabled:t,children:[e.jsx(E,{children:e.jsx(k,{placeholder:"Use Codex default"})}),e.jsxs(P,{children:[e.jsx(g,{value:O,children:"Use Codex default"}),d.map(m=>e.jsx(g,{value:m,children:m},m))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Approval policy"}),e.jsxs(T,{value:z(o.approvalPolicy),onValueChange:m=>i(v=>({...v,approvalPolicy:m===O?null:m})),disabled:t,children:[e.jsx(E,{children:e.jsx(k,{placeholder:"Use default"})}),e.jsxs(P,{children:[e.jsx(g,{value:O,children:"Use default"}),c.map(m=>e.jsx(g,{value:m,children:m},m))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Sandbox mode"}),e.jsxs(T,{value:z(o.sandboxMode),onValueChange:m=>i(v=>({...v,sandboxMode:m===O?null:m})),disabled:t,children:[e.jsx(E,{children:e.jsx(k,{placeholder:"Use default"})}),e.jsxs(P,{children:[e.jsx(g,{value:O,children:"Use default"}),u.map(m=>e.jsx(g,{value:m,children:m},m))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Web search"}),e.jsxs(T,{value:z(o.webSearch),onValueChange:m=>i(v=>({...v,webSearch:m===O?null:m})),disabled:t,children:[e.jsx(E,{children:e.jsx(k,{placeholder:"Use default"})}),e.jsxs(P,{children:[e.jsx(g,{value:O,children:"Use default"}),h.map(m=>e.jsx(g,{value:m,children:m},m))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Tool output token limit"}),e.jsx(C,{type:"number",min:1,value:o.toolOutputTokenLimit??"",onChange:m=>i(v=>({...v,toolOutputTokenLimit:m.target.value?Number(m.target.value):null})),placeholder:"25000",disabled:t})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Personality"}),e.jsxs(T,{value:z(o.personality),onValueChange:m=>i(v=>({...v,personality:m===O?null:m})),disabled:t,children:[e.jsx(E,{children:e.jsx(k,{placeholder:"Use default"})}),e.jsxs(P,{children:[e.jsx(g,{value:O,children:"Use default"}),p.map(m=>e.jsx(g,{value:m,children:m},m))]})]})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs(y,{onClick:()=>n(x),disabled:t||a||!j,children:[a?e.jsx($,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save top-level settings"]})})]})}function ks({values:s,providerNames:r,disabled:t=!1,disabledReason:a,saving:n=!1,onSave:o}){return e.jsx(W,{title:"Top-level controls",badge:"config.toml",icon:e.jsx(Ze,{className:"h-4 w-4"}),description:"Structured controls for the stable top-level Codex settings users touch most often. Unsupported upstream shapes stay untouched and should be edited in raw TOML.",disabledReason:a,children:e.jsx(Es,{initialValues:s,providerNames:r,disabled:t,saving:n,onSave:o},JSON.stringify(s))})}function Ps({workspacePath:s,activeProfile:r,topLevelSettings:t,projectTrustEntries:a,profileEntries:n,modelProviderEntries:o,mcpServerEntries:i,featureCatalog:l,featureState:d,disabled:c,disabledReason:u,saving:h,onPatch:p}){return e.jsx(xe,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 pr-1",children:[e.jsxs(L,{children:[e.jsx(D,{className:"pb-2",children:e.jsxs(R,{className:"flex items-center gap-2 text-base",children:[e.jsx(ce,{className:"h-4 w-4"}),"Structured controls boundary"]})}),e.jsxs(A,{className:"space-y-2 text-sm text-muted-foreground",children:[e.jsxs("p",{children:["Guided controls write only the user-layer ",e.jsx("code",{children:"config.toml"}),". They do not model the full effective Codex runtime once trusted repo layers and CCS transient"," ",e.jsx("code",{children:"-c"})," overrides are involved."]}),e.jsx("p",{children:"Structured saves normalize TOML formatting and strip comments. Use the raw editor on the right when exact layout matters."})]})]}),e.jsx(ks,{values:t,providerNames:o.map(x=>x.name),disabled:c,disabledReason:u,saving:h,onSave:x=>p({kind:"top-level",values:x},"Saved top-level Codex settings.")}),e.jsx(_s,{workspacePath:s,entries:a,disabled:c,disabledReason:u,saving:h,onSave:(x,j)=>p({kind:"project-trust",path:x,trustLevel:j},j?"Saved project trust entry.":"Removed project trust entry.")}),e.jsx(Ns,{activeProfile:r,entries:n,providerNames:o.map(x=>x.name),disabled:c,disabledReason:u,saving:h,onSave:(x,j,m)=>p({kind:"profile",action:"upsert",name:x,values:j,setAsActive:m},"Saved profile."),onDelete:x=>p({kind:"profile",action:"delete",name:x},"Deleted profile."),onSetActive:x=>p({kind:"profile",action:"set-active",name:x},"Set active profile.")}),e.jsx(Cs,{entries:o,disabled:c,disabledReason:u,saving:h,onSave:(x,j)=>p({kind:"model-provider",action:"upsert",name:x,values:j},"Saved model provider."),onDelete:x=>p({kind:"model-provider",action:"delete",name:x},"Deleted model provider.")}),e.jsx(gs,{entries:i,disabled:c,disabledReason:u,saving:h,onSave:(x,j)=>p({kind:"mcp-server",action:"upsert",name:x,values:j},"Saved MCP server."),onDelete:x=>p({kind:"mcp-server",action:"delete",name:x},"Deleted MCP server.")}),e.jsx(fs,{catalog:l,state:d,disabled:c,disabledReason:u,onToggle:(x,j)=>p({kind:"feature",feature:x,enabled:j},"Saved feature toggle.")})]})})}const _e=`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"`,Te=[{name:"multi_agent",label:"Multi-agent",description:"Enable subagent collaboration tools."},{name:"unified_exec",label:"Unified exec",description:"Use the PTY-backed unified exec tool."},{name:"shell_snapshot",label:"Shell snapshot",description:"Reuse shell environment snapshots."},{name:"apply_patch_freeform",label:"Apply patch",description:"Enable freeform apply_patch edits."},{name:"js_repl",label:"JS REPL",description:"Enable the Node-backed JavaScript REPL."},{name:"runtime_metrics",label:"Runtime metrics",description:"Collect Codex runtime metrics."},{name:"prevent_idle_sleep",label:"Prevent idle sleep",description:"Keep the machine awake while active."},{name:"fast_mode",label:"Fast mode",description:"Allow the fast service tier path."},{name:"apps",label:"Apps",description:"Enable ChatGPT Apps and connectors support."},{name:"smart_approvals",label:"Smart approvals",description:"Route eligible approvals through the guardian flow."}];function
|
|
6
|
+
wire_api = "responses"`,Te=[{name:"multi_agent",label:"Multi-agent",description:"Enable subagent collaboration tools."},{name:"unified_exec",label:"Unified exec",description:"Use the PTY-backed unified exec tool."},{name:"shell_snapshot",label:"Shell snapshot",description:"Reuse shell environment snapshots."},{name:"apply_patch_freeform",label:"Apply patch",description:"Enable freeform apply_patch edits."},{name:"js_repl",label:"JS REPL",description:"Enable the Node-backed JavaScript REPL."},{name:"runtime_metrics",label:"Runtime metrics",description:"Collect Codex runtime metrics."},{name:"prevent_idle_sleep",label:"Prevent idle sleep",description:"Keep the machine awake while active."},{name:"fast_mode",label:"Fast mode",description:"Allow the fast service tier path."},{name:"apps",label:"Apps",description:"Enable ChatGPT Apps and connectors support."},{name:"smart_approvals",label:"Smart approvals",description:"Route eligible approvals through the guardian flow."}];function V(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)?s:null}function S(s){return typeof s=="string"&&s.trim().length>0?s.trim():null}function G(s){return typeof s=="number"&&Number.isFinite(s)?s:null}function ie(s){return Array.isArray(s)?s.filter(r=>typeof r=="string").map(r=>r.trim()):[]}function Ee(s){return{model:S(s?.model),modelReasoningEffort:S(s?.model_reasoning_effort),modelProvider:S(s?.model_provider),approvalPolicy:S(s?.approval_policy),sandboxMode:S(s?.sandbox_mode),webSearch:S(s?.web_search),toolOutputTokenLimit:G(s?.tool_output_token_limit),personality:S(s?.personality)}}function Os(s){const r=V(s?.projects);return r?Object.entries(r).map(([t,a])=>{const n=S(V(a)?.trust_level);return n?{path:t,trustLevel:n}:null}).filter(t=>t!==null).sort((t,a)=>t.path.localeCompare(a.path)):[]}function Ls(s){const r=V(s?.profiles);return r?Object.entries(r).map(([t,a])=>({name:t,values:Ee(V(a))})).sort((t,a)=>t.name.localeCompare(a.name)):[]}function Ds(s){const r=V(s?.model_providers);return r?Object.entries(r).map(([t,a])=>{const n=V(a);return n?{name:t,displayName:S(n.name),baseUrl:S(n.base_url),envKey:S(n.env_key),wireApi:S(n.wire_api),requiresOpenaiAuth:n.requires_openai_auth===!0,supportsWebsockets:n.supports_websockets===!0}:null}).filter(t=>t!==null).sort((t,a)=>t.name.localeCompare(a.name)):[]}function Rs(s){const r=V(s?.mcp_servers);return r?Object.entries(r).map(([t,a])=>{const n=V(a);if(!n)return null;const o=S(n.command)?"stdio":"streamable-http",i=G(n.startup_timeout_ms);return{name:t,transport:o,command:S(n.command),args:ie(n.args),url:S(n.url),enabled:n.enabled!==!1,required:n.required===!0,startupTimeoutSec:G(n.startup_timeout_sec)??(i!==null?i/1e3:null),toolTimeoutSec:G(n.tool_timeout_sec),enabledTools:ie(n.enabled_tools),disabledTools:ie(n.disabled_tools)}}).filter(t=>t!==null).sort((t,a)=>t.name.localeCompare(a.name)):[]}function As(s){const r=V(s?.features),t={};for(const a of Te){const n=r?.[a.name];t[a.name]=typeof n=="boolean"?n:null}if(r)for(const[a,n]of Object.entries(r))a in t||(t[a]=typeof n=="boolean"?n:null);return t}const Ms=[{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."}],Is=[{provider:"openai",label:"OpenAI Responses API",apiFormat:"Responses API",url:"https://platform.openai.com/docs/api-reference/responses"}];function Us(s){const r=/https?:\/\/[^\s)]+/g,t=[];let a=0,n;for(;(n=r.exec(s))!==null;){const[o]=n,i=n.index;i>a&&t.push(s.slice(a,i)),t.push(e.jsx("a",{href:o,target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:o},`${o}-${i}`)),a=i+o.length}return a<s.length&&t.push(s.slice(a)),t.length>0?t:[s]}function Fs({diagnostics:s}){const r=s.docsReference??{notes:[],links:[],providerDocs:[],providerValues:[],settingsHierarchy:[]},t=r.links.length>0?r.links:Ms,a=r.providerDocs.length>0?r.providerDocs:Is;return e.jsx(xe,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 pr-1",children:[e.jsxs(L,{children:[e.jsx(D,{className:"pb-2",children:e.jsxs(R,{className:"flex items-center gap-2 text-base",children:[e.jsx(de,{className:"h-4 w-4"}),"CCS bridge recipe"]})}),e.jsxs(A,{className:"space-y-3 text-sm text-muted-foreground",children:[e.jsxs("p",{children:["Use ",e.jsx("code",{children:"ccsxp"})," if you want the built-in CCS Codex provider shortcut on native Codex. Use the saved recipe below if you want plain ",e.jsx("code",{children:"codex"})," or a personal alias like ",e.jsx("code",{children:"cxp"})," to default to CLIProxy."]}),e.jsx("pre",{className:"overflow-x-auto rounded-md border bg-muted/20 p-3 text-xs text-foreground",children:_e}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{children:["1. Save the ",e.jsx("code",{children:"cliproxy"})," provider in your user config."]}),e.jsxs("p",{children:["2. Set top-level ",e.jsx("code",{children:"model_provider"})," to ",e.jsx("code",{children:"cliproxy"}),"."]}),e.jsxs("p",{children:["3. Export ",e.jsx("code",{children:"CLIPROXY_API_KEY"})," in your shell before launching native Codex."]})]})]})]}),e.jsxs(L,{children:[e.jsx(D,{className:"pb-2",children:e.jsxs(R,{className:"flex items-center gap-2 text-base",children:[e.jsx(de,{className:"h-4 w-4"}),"Upstream notes"]})}),e.jsxs(A,{className:"space-y-2 text-sm",children:[r.notes.map((n,o)=>e.jsxs("p",{className:"text-muted-foreground",children:["- ",Us(n)]},`${o}-${n}`)),e.jsx(Q,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:"Codex docs"}),e.jsx("div",{className:"space-y-1.5",children:t.map(n=>e.jsxs("a",{href:n.url,target:"_blank",rel:"noreferrer",className:"block rounded-md border px-2.5 py-2 transition-colors hover:bg-muted/50",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-xs font-medium",children:n.label}),e.jsx(ge,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),e.jsx("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:n.description}),e.jsx("p",{className:"mt-1 break-all font-mono text-[11px] text-muted-foreground/90 underline underline-offset-2",children:n.url})]},n.id))})]}),e.jsx(Q,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:"Provider / bridge reference"}),e.jsx("div",{className:"space-y-1.5",children:a.map(n=>e.jsxs("a",{href:n.url,target:"_blank",rel:"noreferrer",className:"block rounded-md border px-2.5 py-2 transition-colors hover:bg-muted/50",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-xs font-medium",children:n.label}),e.jsx(ge,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),e.jsxs("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:["provider: ",n.provider," | format: ",n.apiFormat]}),e.jsx("p",{className:"mt-1 break-all font-mono text-[11px] text-muted-foreground/90 underline underline-offset-2",children:n.url})]},`${n.provider}-${n.url}`))})]}),r.providerValues.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(Q,{}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Provider values: ",r.providerValues.join(", ")]})]}),r.settingsHierarchy.length>0&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Settings hierarchy: ",r.settingsHierarchy.join(" -> ")]})]})]})]})})}function Ks(s,r){let t=s.slice(0,r).split(/\r\n|\n|\r/g);return[t.length,t.pop().length+1]}function Vs(s,r,t){let a=s.split(/\r\n|\n|\r/g),n="",o=(Math.log10(r+1)|0)+1;for(let i=r-1;i<=r+1;i++){let l=a[i-1];l&&(n+=i.toString().padEnd(o," "),n+=": ",n+=l,n+=`
|
|
7
7
|
`,i===r&&(n+=" ".repeat(o+t+2),n+=`^
|
|
8
|
-
`))}return n}class
|
|
8
|
+
`))}return n}class f extends Error{line;column;codeblock;constructor(r,t){const[a,n]=Ks(t.toml,t.ptr),o=Vs(t.toml,a,n);super(`Invalid TOML document: ${r}
|
|
9
9
|
|
|
10
|
-
${o}`,t),this.line=a,this.column=n,this.codeblock=o}}function
|
|
10
|
+
${o}`,t),this.line=a,this.column=n,this.codeblock=o}}function qs(s,r){let t=0;for(;s[r-++t]==="\\";);return--t&&t%2}function ue(s,r=0,t=s.length){let a=s.indexOf(`
|
|
11
11
|
`,r);return s[a-1]==="\r"&&a--,a<=t?a:-1}function ee(s,r){for(let t=r;t<s.length;t++){let a=s[t];if(a===`
|
|
12
12
|
`)return t;if(a==="\r"&&s[t+1]===`
|
|
13
|
-
`)return t+1;if(a<" "&&a!==" "||a==="")throw new
|
|
13
|
+
`)return t+1;if(a<" "&&a!==" "||a==="")throw new f("control characters are not allowed in comments",{toml:s,ptr:r})}return s.length}function K(s,r,t,a){let n;for(;;){for(;(n=s[r])===" "||n===" "||!t&&(n===`
|
|
14
14
|
`||n==="\r"&&s[r+1]===`
|
|
15
|
-
`);)r++;if(a||n!=="#")break;r=ee(s,r)}return r}function
|
|
15
|
+
`);)r++;if(a||n!=="#")break;r=ee(s,r)}return r}function $s(s,r,t,a,n=!1){if(!a)return r=ue(s,r),r<0?s.length:r;for(let o=r;o<s.length;o++){let i=s[o];if(i==="#")o=ue(s,o);else{if(i===t)return o+1;if(i===a||n&&(i===`
|
|
16
16
|
`||i==="\r"&&s[o+1]===`
|
|
17
|
-
`))return o}}throw new
|
|
17
|
+
`))return o}}throw new f("cannot find end of structure",{toml:s,ptr:r})}function ke(s,r){let t=s[r],a=t===s[r+1]&&s[r+1]===s[r+2]?s.slice(r,r+3):t;r+=a.length-1;do r=s.indexOf(a,++r);while(r>-1&&t!=="'"&&qs(s,r));return r>-1&&(r+=a.length,a.length>1&&(s[r]===t&&r++,s[r]===t&&r++)),r}let zs=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;class X extends Date{#s=!1;#r=!1;#e=null;constructor(r){let t=!0,a=!0,n="Z";if(typeof r=="string"){let o=r.match(zs);o?(o[1]||(t=!1,r=`0000-01-01T${r}`),a=!!o[2],a&&r[10]===" "&&(r=r.replace(" ","T")),o[2]&&+o[2]>23?r="":(n=o[3]||null,r=r.toUpperCase(),!n&&a&&(r+="Z"))):r=""}super(r),isNaN(this.getTime())||(this.#s=t,this.#r=a,this.#e=n)}isDateTime(){return this.#s&&this.#r}isLocal(){return!this.#s||!this.#r||!this.#e}isDate(){return this.#s&&!this.#r}isTime(){return this.#r&&!this.#s}isValid(){return this.#s||this.#r}toISOString(){let r=super.toISOString();if(this.isDate())return r.slice(0,10);if(this.isTime())return r.slice(11,23);if(this.#e===null)return r.slice(0,-1);if(this.#e==="Z")return r;let t=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return t=this.#e[0]==="-"?t:-t,new Date(this.getTime()-t*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(r,t="Z"){let a=new X(r);return a.#e=t,a}static wrapAsLocalDateTime(r){let t=new X(r);return t.#e=null,t}static wrapAsLocalDate(r){let t=new X(r);return t.#r=!1,t.#e=null,t}static wrapAsLocalTime(r){let t=new X(r);return t.#s=!1,t.#e=null,t}}let Ys=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,Xs=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,Bs=/^[+-]?0[0-9_]/,Ws=/^[0-9a-f]{2,8}$/i,Ce={b:"\b",t:" ",n:`
|
|
18
18
|
`,f:"\f",r:"\r",e:"\x1B",'"':'"',"\\":"\\"};function Pe(s,r=0,t=s.length){let a=s[r]==="'",n=s[r++]===s[r]&&s[r]===s[r+1];n&&(t-=2,s[r+=2]==="\r"&&r++,s[r]===`
|
|
19
19
|
`&&r++);let o=0,i,l="",d=r;for(;r<t-1;){let c=s[r++];if(c===`
|
|
20
20
|
`||c==="\r"&&s[r]===`
|
|
21
|
-
`){if(!n)throw new
|
|
21
|
+
`){if(!n)throw new f("newlines are not allowed in strings",{toml:s,ptr:r-1})}else if(c<" "&&c!==" "||c==="")throw new f("control characters are not allowed in strings",{toml:s,ptr:r-1});if(i){if(i=!1,c==="x"||c==="u"||c==="U"){let u=s.slice(r,r+=c==="x"?2:c==="u"?4:8);if(!Ws.test(u))throw new f("invalid unicode escape",{toml:s,ptr:o});try{l+=String.fromCodePoint(parseInt(u,16))}catch{throw new f("invalid unicode escape",{toml:s,ptr:o})}}else if(n&&(c===`
|
|
22
22
|
`||c===" "||c===" "||c==="\r")){if(r=K(s,r-1,!0),s[r]!==`
|
|
23
|
-
`&&s[r]!=="\r")throw new
|
|
24
|
-
`&&s[i]!=="\r")throw new
|
|
25
|
-
`&&i!=="\r"){let l,d=n,c=!1,[u,h]=me(s,r-1);for(let j=0;j<u.length;j++){if(j&&(d=c?d[l]:d[l]={}),l=u[j],(c=Object.hasOwn(d,l))&&(typeof d[l]!="object"||o.has(d[l])))throw new
|
|
26
|
-
`&&o!=="\r"){let i=he(s,r-1,"]",t-1,a);n.push(i[0]),r=i[1]}}if(!o)throw new
|
|
27
|
-
`&&s[l]!=="\r")throw new p("each key-value declaration must be followed by an end-of-line",{toml:s,ptr:l});l=K(s,l)}return a}function sr(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)}function rr(s){if(!s.trim())return{};const t=er(s);if(!sr(t))throw new Error("TOML root must be a table.");return t}function Oe(s){try{return{config:rr(s),parseError:null}}catch(r){return{config:null,parseError:r.message}}}async function tr(){const s=await fetch(J("/codex/diagnostics"));if(!s.ok)throw new Error("Failed to fetch Codex diagnostics");return s.json()}async function nr(){const s=await fetch(J("/codex/config/raw"));if(!s.ok)throw new Error("Failed to fetch Codex raw config");return s.json()}async function ar(s){const r=await fetch(J("/codex/config/raw"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(r.status===409)throw new Ne("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 lr(s){const r=await fetch(J("/codex/config/patch"),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(r.status===409)throw new Ne("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 or(){const s=ds(),r=ve({queryKey:["codex-diagnostics"],queryFn:tr,refetchInterval:1e4}),t=ve({queryKey:["codex-raw-config"],queryFn:nr}),a=be({mutationFn:ar,onSuccess:(o,i)=>{s.setQueryData(["codex-raw-config"],l=>{const d=l?.path??"$CODEX_HOME/config.toml",c=l?.resolvedPath??d,u=Oe(i.rawText);return{path:d,resolvedPath:c,exists:!0,mtime:o.mtime,rawText:i.rawText,config:u.config,parseError:u.parseError,readError:null}}),s.invalidateQueries({queryKey:["codex-diagnostics"]})}}),n=be({mutationFn:lr,onSuccess:o=>{s.setQueryData(["codex-raw-config"],o),s.invalidateQueries({queryKey:["codex-diagnostics"]})}});return b.useMemo(()=>({diagnostics:r.data,diagnosticsLoading:r.isLoading,diagnosticsError:r.error,refetchDiagnostics:r.refetch,rawConfig:t.data,rawConfigLoading:t.isLoading,rawConfigError:t.error,refetchRawConfig:t.refetch,saveRawConfig:a.mutate,saveRawConfigAsync:a.mutateAsync,isSavingRawConfig:a.isPending,patchConfig:n.mutate,patchConfigAsync:n.mutateAsync,isPatchingConfig:n.isPending}),[r.data,r.isLoading,r.error,r.refetch,t.data,t.isLoading,t.error,t.refetch,a.mutate,a.mutateAsync,a.isPending,n.mutate,n.mutateAsync,n.isPending])}const ir=[{label:"Start Default",command:"ccs",description:"Launch Claude with default profile"},{label:"GLM Profile",command:"ccs glm",description:"Switch to GLM model"},{label:"Health Check",command:"ccs doctor",description:"Run system diagnostics"},{label:"Delegate Task",command:'ccs glm -p "your task"',description:"Delegate to GLM profile"}];function cr({snippets:s=ir}){const[r,t]=b.useState(null),a=async(n,o)=>{await navigator.clipboard.writeText(n),t(o),setTimeout(()=>t(null),2e3)};return e.jsxs(L,{children:[e.jsx(R,{className:"pb-3",children:e.jsxs(D,{className:"text-lg flex items-center gap-2",children:[e.jsx(es,{className:"w-5 h-5 text-muted-foreground"}),"Quick Commands"]})}),e.jsx(A,{children:e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:s.map((n,o)=>e.jsxs("div",{className:Se("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(y,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>a(n.command,o),title:n.description,children:r===o?e.jsx(ss,{className:"h-4 w-4 text-green-600"}):e.jsx(rs,{className:"h-4 w-4"})})]},o))})})]})}function dr(s){return!s||!Number.isFinite(s)?"N/A":new Date(s).toLocaleString()}function ur(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 N({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:Se("text-right break-all",t&&"font-mono text-xs"),children:r})]})}function mr({diagnostics:s}){const r=s.config.activeProfile?`codex --profile ${s.config.activeProfile}`:"codex",t=s.binary.supportsConfigOverrides;return e.jsx(xe,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 pr-1",children:[e.jsxs(L,{children:[e.jsx(R,{className:"pb-2",children:e.jsxs(D,{className:"flex items-center gap-2 text-base",children:[e.jsx(ts,{className:"h-4 w-4"}),"How Codex works in CCS"]})}),e.jsxs(A,{className:"space-y-2 text-sm text-muted-foreground",children:[e.jsx("p",{children:"Codex is a first-class runtime target in CCS, but it stays runtime-only in v1."}),e.jsxs("p",{children:[e.jsx("code",{children:"ccs-codex"})," and ",e.jsx("code",{children:"ccsx"})," launch native Codex against your saved native config, while ",e.jsx("code",{children:"ccsxp"})," is the opinionated shortcut for"," ",e.jsx("code",{children:"ccs codex --target codex"}),"."]}),e.jsxs("p",{children:["Plain ",e.jsx("code",{children:"codex"})," or a personal alias like ",e.jsx("code",{children:"cxp"})," needs"," ",e.jsx("code",{children:'model_provider = "cliproxy"'})," plus a matching"," ",e.jsx("code",{children:"[model_providers.cliproxy]"})," entry if you want CLIProxy as the saved native default."]}),e.jsxs("p",{children:["Built-in ",e.jsx("code",{children:"openai"})," and ",e.jsx("code",{children:"oss"})," providers are also valid native defaults and do not need a custom ",e.jsx("code",{children:"[model_providers]"})," stanza."]}),e.jsx("p",{children:"Saved default targets for API profiles and variants still remain on Claude or Droid."}),e.jsxs("p",{children:["CCS-backed Codex launches can apply transient ",e.jsx("code",{children:"-c"})," overrides and inject",e.jsx("code",{children:" CCS_CODEX_API_KEY"}),", so effective runtime values may not match this file exactly."]})]})]}),e.jsxs(L,{children:[e.jsx(R,{className:"pb-2",children:e.jsxs(D,{className:"flex items-center gap-2 text-base",children:[e.jsx(ns,{className:"h-4 w-4"}),"Runtime install"]})}),e.jsxs(A,{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Status"}),e.jsx(I,{variant:s.binary.installed?"default":"secondary",children:s.binary.installed?"Detected":"Not found"})]}),e.jsx(N,{label:"Detection source",value:s.binary.source,mono:!0}),e.jsx(N,{label:"Binary path",value:s.binary.path||"Not found",mono:!0}),e.jsx(N,{label:"Install directory",value:s.binary.installDir||"N/A",mono:!0}),e.jsx(N,{label:"Version",value:s.binary.version||"Unknown",mono:!0}),e.jsx(N,{label:"Native aliases",value:"ccs-codex, ccsx",mono:!0}),e.jsx(N,{label:"CCS provider shortcut",value:"ccsxp",mono:!0}),e.jsxs("div",{className:"flex items-center justify-between rounded-md border px-3 py-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"--config override support"}),e.jsx(I,{variant:s.binary.supportsConfigOverrides?"default":"secondary",children:s.binary.supportsConfigOverrides?"Available":"Missing"})]})]})]}),e.jsxs(L,{children:[e.jsx(R,{className:"pb-2",children:e.jsxs(D,{className:"flex items-center gap-2 text-base",children:[e.jsx(ce,{className:"h-4 w-4"}),"CLIProxy-backed native Codex"]})}),e.jsx(A,{className:"space-y-3 text-sm text-muted-foreground",children:t?e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:["There are two supported paths. Use ",e.jsx("code",{children:"ccsxp"})," if you want the built-in CCS Codex provider shortcut. Use the saved recipe below if you want plain"," ",e.jsx("code",{children:"codex"})," or a personal alias like ",e.jsx("code",{children:"cxp"})," to default to CLIProxy."]}),e.jsxs("div",{className:"rounded-md border bg-muted/20 p-3",children:[e.jsx("p",{className:"font-medium text-foreground",children:"Saved native Codex recipe"}),e.jsx("pre",{className:"mt-2 overflow-x-auto rounded-md bg-background p-3 text-xs text-foreground",children:_e})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{children:["1. Save a provider named ",e.jsx("code",{children:"cliproxy"})," with the base URL and env key above."]}),e.jsxs("p",{children:["2. In ",e.jsx("strong",{children:"Top-level settings"}),", set ",e.jsx("strong",{children:"Default provider"})," ","to ",e.jsx("code",{children:"cliproxy"}),"."]}),e.jsxs("p",{children:["3. Export ",e.jsx("code",{children:"CLIPROXY_API_KEY"})," in your shell before launching native Codex."]})]})]}):e.jsxs("p",{children:["This Codex build can still use the native path, but CCS-backed Codex routing via"," ",e.jsx("code",{children:"ccsxp"})," or ",e.jsx("code",{children:"ccs codex --target codex"})," stays unavailable until the detected Codex binary exposes ",e.jsx("code",{children:"--config"})," overrides."]})})]}),e.jsxs(L,{children:[e.jsx(R,{className:"pb-2",children:e.jsxs(D,{className:"flex items-center gap-2 text-base",children:[e.jsx(as,{className:"h-4 w-4"}),"Config file"]})}),e.jsx(A,{className:"space-y-3",children:e.jsxs("div",{className:"rounded-md border p-3 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"font-medium text-sm",children:"User config"}),s.file.exists?e.jsx(ls,{className:"h-4 w-4 text-green-600"}):e.jsx(os,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(N,{label:"Path",value:s.file.path,mono:!0}),e.jsx(N,{label:"Resolved",value:s.file.resolvedPath,mono:!0}),e.jsx(N,{label:"Size",value:ur(s.file.sizeBytes)}),e.jsx(N,{label:"Last modified",value:dr(s.file.mtimeMs)}),s.file.parseError&&e.jsxs("p",{className:"text-xs text-amber-600",children:["TOML warning: ",s.file.parseError]}),s.file.readError&&e.jsxs("p",{className:"text-xs text-destructive",children:["Read warning: ",s.file.readError]})]})})]}),e.jsxs(L,{children:[e.jsx(R,{className:"pb-2",children:e.jsxs(D,{className:"flex items-center gap-2 text-base",children:[e.jsx(de,{className:"h-4 w-4"}),"Current user-layer summary"]})}),e.jsxs(A,{className:"space-y-3",children:[e.jsx(N,{label:"Model",value:s.config.model||"Not set",mono:!0}),e.jsx(N,{label:"Model provider",value:s.config.modelProvider||"Not set",mono:!0}),e.jsx(N,{label:"Active profile",value:s.config.activeProfile||"Not set",mono:!0}),e.jsx(N,{label:"Approval policy",value:s.config.approvalPolicy||"Not set",mono:!0}),e.jsx(N,{label:"Sandbox mode",value:s.config.sandboxMode||"Not set",mono:!0}),e.jsx(N,{label:"Web search",value:s.config.webSearch||"Not set",mono:!0}),e.jsx(G,{}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs(I,{variant:"outline",className:"justify-center",children:["providers: ",s.config.modelProviderCount]}),e.jsxs(I,{variant:"outline",className:"justify-center",children:["profiles: ",s.config.profileCount]}),e.jsxs(I,{variant:"outline",className:"justify-center",children:["enabled features: ",s.config.enabledFeatures.length]}),e.jsxs(I,{variant:"outline",className:"justify-center",children:["MCP servers: ",s.config.mcpServerCount]})]}),s.config.topLevelKeys.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:"User-layer keys present"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.config.topLevelKeys.map(a=>e.jsx(I,{variant:"secondary",className:"font-mono text-[10px]",children:a},a))})]})]})]}),e.jsx(cr,{snippets:[{label:"Native short alias",command:"ccsx",description:"Launch the short native Codex runtime alias."},{label:"CCS Codex shortcut",command:'ccsxp "your prompt"',description:t?"Run the built-in CCS Codex provider on native Codex.":"Requires a Codex build that exposes --config overrides."},{label:"Explicit provider route",command:'ccs codex --target codex "your prompt"',description:t?"Use the explicit built-in Codex provider route.":"Requires a Codex build that exposes --config overrides."},{label:s.config.activeProfile?"Inspect active profile":"Open native Codex",command:r,description:s.config.activeProfile?"Inspect the active named profile directly in native Codex.":"Open native Codex without forcing a named profile overlay."}]}),e.jsxs(L,{children:[e.jsx(R,{className:"pb-2",children:e.jsxs(D,{className:"flex items-center gap-2 text-base",children:[e.jsx(ce,{className:"h-4 w-4"}),"Runtime vs provider"]})}),e.jsxs(A,{className:"grid gap-3 md:grid-cols-2",children:[e.jsxs("div",{className:"rounded-md border p-3 text-sm",children:[e.jsx("p",{className:"font-medium",children:"Native Codex runtime"}),e.jsxs("p",{className:"mt-1 text-muted-foreground",children:["Use ",e.jsx("code",{children:"ccs-codex"}),", ",e.jsx("code",{children:"ccsx"}),", or ",e.jsx("code",{children:"--target codex"})," when you want the local Codex CLI to honor your saved native user config."]})]}),e.jsxs("div",{className:"rounded-md border p-3 text-sm",children:[e.jsx("p",{className:"font-medium",children:"CCS Codex provider / bridge"}),e.jsx("p",{className:"mt-1 text-muted-foreground",children:t?e.jsxs(e.Fragment,{children:["Use ",e.jsx("code",{children:"ccsxp"})," or ",e.jsx("code",{children:"ccs codex --target codex"})," when you want the built-in CCS Codex provider on native Codex. That path uses transient CCS-managed overrides and is separate from the saved ",e.jsx("code",{children:"cliproxy"})," ","recipe above."]}):e.jsxs(e.Fragment,{children:["The CCS Codex provider route is currently unavailable because the detected Codex build does not expose ",e.jsx("code",{children:"--config"})," overrides."]})})]})]})]}),e.jsxs(L,{children:[e.jsx(R,{className:"pb-2",children:e.jsx(D,{className:"text-base",children:"Supported flows"})}),e.jsx(A,{children:e.jsxs(us,{children:[e.jsx(ms,{children:e.jsxs(we,{children:[e.jsx(ne,{children:"Flow"}),e.jsx(ne,{children:"Status"}),e.jsx(ne,{children:"Notes"})]})}),e.jsx(xs,{children:s.supportMatrix.map(a=>e.jsxs(we,{children:[e.jsx(ae,{className:"font-mono text-xs",children:a.label}),e.jsx(ae,{children:e.jsx(I,{variant:a.supported?"default":"secondary",children:a.supported?"Yes":"No"})}),e.jsx(ae,{className:"text-xs text-muted-foreground",children:a.notes})]},a.id))})]})})]}),s.warnings.length>0&&e.jsxs(L,{className:"border-amber-200 bg-amber-50/50 dark:bg-amber-950/20",children:[e.jsx(R,{className:"pb-2",children:e.jsxs(D,{className:"flex items-center gap-2 text-base",children:[e.jsx(is,{className:"h-4 w-4 text-amber-600"}),"Warnings"]})}),e.jsx(A,{className:"space-y-1.5",children:s.warnings.map(a=>e.jsxs("p",{className:"text-sm text-amber-800 dark:text-amber-300",children:["- ",a]},a))})]})]})})}function _r(){const{diagnostics:s,diagnosticsLoading:r,diagnosticsError:t,refetchDiagnostics:a,rawConfig:n,rawConfigLoading:o,rawConfigError:i,refetchRawConfig:l,saveRawConfigAsync:d,isSavingRawConfig:c,patchConfigAsync:u,isPatchingConfig:h}=or(),[f,x]=b.useState(null),j=n?.rawText??"",m=f??j,v=f!==null&&f!==j,H=Oe(m),F=H.parseError?{valid:!1,error:H.parseError}:{valid:!0},_=n?.config??null,w=o||!n||v||n?.parseError!==null||n?.readError!==null,Le=i?"Structured controls unavailable: failed to load the current config.toml.":n?.readError?`Structured controls unavailable: ${n.readError}`:v?F.valid?"Save or discard raw TOML edits before using structured controls.":"Fix or discard raw TOML edits before using structured controls.":n?.parseError?`Structured controls disabled: ${n.parseError}`:null,Re=b.useMemo(()=>Ee(_),[_]),De=b.useMemo(()=>Os(_),[_]),Ae=b.useMemo(()=>Ls(_),[_]),Me=b.useMemo(()=>Rs(_),[_]),Ie=b.useMemo(()=>Ds(_),[_]),Fe=b.useMemo(()=>As(_),[_]),Ue=M=>{if(M===j){x(null);return}x(M)},Ke=async()=>{try{if((await Promise.all([a(),l()])).some(V=>!V||V.status==="error"||V.isError||V.error)){U.error("Failed to refresh Codex snapshot. Raw edits were kept.");return}x(null)}catch(M){U.error(M.message||"Failed to refresh Codex snapshot.")}},qe=async()=>{if(!F.valid){U.error("Fix TOML before saving.");return}try{await d({rawText:m,expectedMtime:n?.exists?n.mtime:void 0}),x(null),U.success("Saved Codex config.toml."),await a()}catch(M){je(M)?U.error("config.toml changed externally. Refresh and retry."):U.error(M.message||"Failed to save Codex config.toml.")}},Ve=async(M,pe)=>{try{await u({...M,expectedMtime:n?.exists?n.mtime:void 0}),x(null),U.success(pe)}catch(V){je(V)?U.error("config.toml changed externally. Refresh and retry."):U.error(V.message||"Failed to update Codex config.")}},se="mt-0 h-full border-0 p-0 data-[state=inactive]:hidden",Ye=()=>r?e.jsxs("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:[e.jsx(Y,{className:"mr-2 h-5 w-5 animate-spin"}),"Loading Codex diagnostics..."]}):t||!s?e.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-destructive",children:"Failed to load Codex diagnostics."}):e.jsxs(Xe,{defaultValue:"overview",className:"flex h-full flex-col",children:[e.jsx("div",{className:"shrink-0 px-4 pt-4",children:e.jsxs(Be,{className:"grid w-full grid-cols-3",children:[e.jsx(re,{value:"overview",children:"Overview"}),e.jsx(re,{value:"controls",children:"Control Center"}),e.jsx(re,{value:"docs",children:"Docs"})]})}),e.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden px-4 pb-4 pt-3",children:[e.jsx(te,{value:"overview",className:se,children:e.jsx(mr,{diagnostics:s})}),e.jsx(te,{value:"controls",className:se,children:e.jsx(Ps,{workspacePath:s.workspacePath,activeProfile:s.config.activeProfile,topLevelSettings:Re,projectTrustEntries:De,profileEntries:Ae,modelProviderEntries:Me,mcpServerEntries:Ie,featureCatalog:Te,featureState:Fe,disabled:w,disabledReason:Le,saving:h,onPatch:Ve})}),e.jsx(te,{value:"docs",className:se,children:e.jsx(Us,{diagnostics:s})})]})]});return e.jsx("div",{className:"h-full min-h-0 overflow-hidden",children:e.jsxs($e,{direction:"horizontal",className:"h-full",children:[e.jsx(fe,{defaultSize:45,minSize:35,children:e.jsx("div",{className:"h-full border-r bg-muted/20",children:Ye()})}),e.jsx(ze,{className:"group flex w-2 cursor-col-resize items-center justify-center bg-border transition-colors hover:bg-primary/20",children:e.jsx(cs,{className:"h-3 w-3 text-muted-foreground group-hover:text-primary"})}),e.jsx(fe,{defaultSize:55,minSize:35,children:e.jsx(hs,{title:"Codex config.toml",pathLabel:n?.path||s?.file.path||"$CODEX_HOME/config.toml",loading:o,parseWarning:F.valid?n?.parseError:F.error,readWarning:n?.readError,value:m,dirty:v,readOnly:!!n?.readError,saving:c,saveDisabled:!v||c||o||!F.valid||!!n?.readError,onChange:M=>{Ue(M)},onSave:qe,onRefresh:Ke,onDiscard:()=>x(null),language:"toml",loadingLabel:"Loading config.toml...",parseWarningLabel:"TOML warning",ownershipNotice:e.jsxs("div",{className:"rounded-md border border-amber-200 bg-amber-50/60 px-3 py-2 text-sm text-amber-900 dark:bg-amber-950/20 dark:text-amber-300",children:[e.jsx("p",{className:"font-medium",children:"This file is upstream-owned by Codex CLI."}),e.jsxs("p",{children:["CCS does not keep ",e.jsx("code",{children:"~/.codex/config.toml"})," in sync for you."]}),e.jsxs("p",{children:["CCS-backed Codex launches may apply transient ",e.jsx("code",{children:"-c"})," overrides and",e.jsx("code",{children:" CCS_CODEX_API_KEY"}),"; those effective values may not appear here."]})]})})})]})})}export{_r as CodexPage};
|
|
23
|
+
`&&s[r]!=="\r")throw new f("invalid escape: only line-ending whitespace may be escaped",{toml:s,ptr:o});r=K(s,r)}else if(c in Ce)l+=Ce[c];else throw new f("unrecognized escape sequence",{toml:s,ptr:o});d=r}else!a&&c==="\\"&&(o=r-1,i=!0,l+=s.slice(d,o))}return l+s.slice(d,t-1)}function Hs(s,r,t,a){if(s==="true")return!0;if(s==="false")return!1;if(s==="-inf")return-1/0;if(s==="inf"||s==="+inf")return 1/0;if(s==="nan"||s==="+nan"||s==="-nan")return NaN;if(s==="-0")return a?0n:0;let n=Ys.test(s);if(n||Xs.test(s)){if(Bs.test(s))throw new f("leading zeroes are not allowed",{toml:r,ptr:t});s=s.replace(/_/g,"");let i=+s;if(isNaN(i))throw new f("invalid number",{toml:r,ptr:t});if(n){if((n=!Number.isSafeInteger(i))&&!a)throw new f("integer value cannot be represented losslessly",{toml:r,ptr:t});(n||a===!0)&&(i=BigInt(s))}return i}const o=new X(s);if(!o.isValid())throw new f("invalid value",{toml:r,ptr:t});return o}function Qs(s,r,t){let a=s.slice(r,t),n=a.indexOf("#");return n>-1&&(ee(s,n),a=a.slice(0,n)),[a.trimEnd(),n]}function he(s,r,t,a,n){if(a===0)throw new f("document contains excessively nested structures. aborting.",{toml:s,ptr:r});let o=s[r];if(o==="["||o==="{"){let[d,c]=o==="["?Zs(s,r,a,n):Js(s,r,a,n);if(t){if(c=K(s,c),s[c]===",")c++;else if(s[c]!==t)throw new f("expected comma or end of structure",{toml:s,ptr:c})}return[d,c]}let i;if(o==='"'||o==="'"){i=ke(s,r);let d=Pe(s,r,i);if(t){if(i=K(s,i),s[i]&&s[i]!==","&&s[i]!==t&&s[i]!==`
|
|
24
|
+
`&&s[i]!=="\r")throw new f("unexpected character encountered",{toml:s,ptr:i});i+=+(s[i]===",")}return[d,i]}i=$s(s,r,",",t);let l=Qs(s,r,i-+(s[i-1]===","));if(!l[0])throw new f("incomplete key-value declaration: no value specified",{toml:s,ptr:r});return t&&l[1]>-1&&(i=K(s,r+l[1]),i+=+(s[i]===",")),[Hs(l[0],s,r,n),i]}let Gs=/^[a-zA-Z0-9-_]+[ \t]*$/;function me(s,r,t="="){let a=r-1,n=[],o=s.indexOf(t,r);if(o<0)throw new f("incomplete key-value: cannot find end of key",{toml:s,ptr:r});do{let i=s[r=++a];if(i!==" "&&i!==" ")if(i==='"'||i==="'"){if(i===s[r+1]&&i===s[r+2])throw new f("multiline strings are not allowed in keys",{toml:s,ptr:r});let l=ke(s,r);if(l<0)throw new f("unfinished string encountered",{toml:s,ptr:r});a=s.indexOf(".",l);let d=s.slice(l,a<0||a>o?o:a),c=ue(d);if(c>-1)throw new f("newlines are not allowed in keys",{toml:s,ptr:r+a+c});if(d.trimStart())throw new f("found extra tokens after the string part",{toml:s,ptr:l});if(o<l&&(o=s.indexOf(t,l),o<0))throw new f("incomplete key-value: cannot find end of key",{toml:s,ptr:r});n.push(Pe(s,r,l))}else{a=s.indexOf(".",r);let l=s.slice(r,a<0||a>o?o:a);if(!Gs.test(l))throw new f("only letter, numbers, dashes and underscores are allowed in keys",{toml:s,ptr:r});n.push(l.trimEnd())}}while(a+1&&a<o);return[n,K(s,o+1,!0,!0)]}function Js(s,r,t,a){let n={},o=new Set,i;for(r++;(i=s[r++])!=="}"&&i;){if(i===",")throw new f("expected value, found comma",{toml:s,ptr:r-1});if(i==="#")r=ee(s,r);else if(i!==" "&&i!==" "&&i!==`
|
|
25
|
+
`&&i!=="\r"){let l,d=n,c=!1,[u,h]=me(s,r-1);for(let j=0;j<u.length;j++){if(j&&(d=c?d[l]:d[l]={}),l=u[j],(c=Object.hasOwn(d,l))&&(typeof d[l]!="object"||o.has(d[l])))throw new f("trying to redefine an already defined value",{toml:s,ptr:r});!c&&l==="__proto__"&&Object.defineProperty(d,l,{enumerable:!0,configurable:!0,writable:!0})}if(c)throw new f("trying to redefine an already defined value",{toml:s,ptr:r});let[p,x]=he(s,h,"}",t-1,a);o.add(p),d[l]=p,r=x}}if(!i)throw new f("unfinished table encountered",{toml:s,ptr:r});return[n,r]}function Zs(s,r,t,a){let n=[],o;for(r++;(o=s[r++])!=="]"&&o;){if(o===",")throw new f("expected value, found comma",{toml:s,ptr:r-1});if(o==="#")r=ee(s,r);else if(o!==" "&&o!==" "&&o!==`
|
|
26
|
+
`&&o!=="\r"){let i=he(s,r-1,"]",t-1,a);n.push(i[0]),r=i[1]}}if(!o)throw new f("unfinished array encountered",{toml:s,ptr:r});return[n,r]}function ye(s,r,t,a){let n=r,o=t,i,l=!1,d;for(let c=0;c<s.length;c++){if(c){if(n=l?n[i]:n[i]={},o=(d=o[i]).c,a===0&&(d.t===1||d.t===2))return null;if(d.t===2){let u=n.length-1;n=n[u],o=o[u].c}}if(i=s[c],(l=Object.hasOwn(n,i))&&o[i]?.t===0&&o[i]?.d)return null;l||(i==="__proto__"&&(Object.defineProperty(n,i,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(o,i,{enumerable:!0,configurable:!0,writable:!0})),o[i]={t:c<s.length-1&&a===2?3:a,d:!1,i:0,c:{}})}if(d=o[i],d.t!==a&&!(a===1&&d.t===3)||(a===2&&(d.d||(d.d=!0,n[i]=[]),n[i].push(n={}),d.c[d.i++]=d={t:1,d:!1,i:0,c:{}}),d.d))return null;if(d.d=!0,a===1)n=l?n[i]:n[i]={};else if(a===0&&l)return null;return[i,n,d.c]}function er(s,{maxDepth:r=1e3,integersAsBigInt:t}={}){let a={},n={},o=a,i=n;for(let l=K(s,0);l<s.length;){if(s[l]==="["){let d=s[++l]==="[",c=me(s,l+=+d,"]");if(d){if(s[c[1]-1]!=="]")throw new f("expected end of table declaration",{toml:s,ptr:c[1]-1});c[1]++}let u=ye(c[0],a,n,d?2:1);if(!u)throw new f("trying to redefine an already defined table or value",{toml:s,ptr:l});i=u[2],o=u[1],l=c[1]}else{let d=me(s,l),c=ye(d[0],o,i,0);if(!c)throw new f("trying to redefine an already defined table or value",{toml:s,ptr:l});let u=he(s,d[1],void 0,r,t);c[1][c[0]]=u[0],l=u[1]}if(l=K(s,l,!0),s[l]&&s[l]!==`
|
|
27
|
+
`&&s[l]!=="\r")throw new f("each key-value declaration must be followed by an end-of-line",{toml:s,ptr:l});l=K(s,l)}return a}function sr(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)}function rr(s){if(!s.trim())return{};const t=er(s);if(!sr(t))throw new Error("TOML root must be a table.");return t}function Oe(s){try{return{config:rr(s),parseError:null}}catch(r){return{config:null,parseError:r.message}}}async function tr(){const s=await fetch(J("/codex/diagnostics"));if(!s.ok)throw new Error("Failed to fetch Codex diagnostics");return s.json()}async function nr(){const s=await fetch(J("/codex/config/raw"));if(!s.ok)throw new Error("Failed to fetch Codex raw config");return s.json()}async function ar(s){const r=await fetch(J("/codex/config/raw"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(r.status===409)throw new Ne("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 lr(s){const r=await fetch(J("/codex/config/patch"),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(r.status===409)throw new Ne("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 or(){const s=ds(),r=ve({queryKey:["codex-diagnostics"],queryFn:tr,refetchInterval:1e4}),t=ve({queryKey:["codex-raw-config"],queryFn:nr}),a=be({mutationFn:ar,onSuccess:(o,i)=>{s.setQueryData(["codex-raw-config"],l=>{const d=l?.path??"$CODEX_HOME/config.toml",c=l?.resolvedPath??d,u=Oe(i.rawText);return{path:d,resolvedPath:c,exists:!0,mtime:o.mtime,rawText:i.rawText,config:u.config,parseError:u.parseError,readError:null}}),s.invalidateQueries({queryKey:["codex-diagnostics"]})}}),n=be({mutationFn:lr,onSuccess:o=>{s.setQueryData(["codex-raw-config"],o),s.invalidateQueries({queryKey:["codex-diagnostics"]})}});return b.useMemo(()=>({diagnostics:r.data,diagnosticsLoading:r.isLoading,diagnosticsError:r.error,refetchDiagnostics:r.refetch,rawConfig:t.data,rawConfigLoading:t.isLoading,rawConfigError:t.error,refetchRawConfig:t.refetch,saveRawConfig:a.mutate,saveRawConfigAsync:a.mutateAsync,isSavingRawConfig:a.isPending,patchConfig:n.mutate,patchConfigAsync:n.mutateAsync,isPatchingConfig:n.isPending}),[r.data,r.isLoading,r.error,r.refetch,t.data,t.isLoading,t.error,t.refetch,a.mutate,a.mutateAsync,a.isPending,n.mutate,n.mutateAsync,n.isPending])}const ir=[{label:"Start Default",command:"ccs",description:"Launch Claude with default profile"},{label:"GLM Profile",command:"ccs glm",description:"Switch to GLM model"},{label:"Health Check",command:"ccs doctor",description:"Run system diagnostics"},{label:"Delegate Task",command:'ccs glm -p "your task"',description:"Delegate to GLM profile"}];function cr({snippets:s=ir}){const[r,t]=b.useState(null),a=async(n,o)=>{await navigator.clipboard.writeText(n),t(o),setTimeout(()=>t(null),2e3)};return e.jsxs(L,{children:[e.jsx(D,{className:"pb-3",children:e.jsxs(R,{className:"text-lg flex items-center gap-2",children:[e.jsx(es,{className:"w-5 h-5 text-muted-foreground"}),"Quick Commands"]})}),e.jsx(A,{children:e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:s.map((n,o)=>e.jsxs("div",{className:Se("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(y,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>a(n.command,o),title:n.description,children:r===o?e.jsx(ss,{className:"h-4 w-4 text-green-600"}):e.jsx(rs,{className:"h-4 w-4"})})]},o))})})]})}function dr(s){return!s||!Number.isFinite(s)?"N/A":new Date(s).toLocaleString()}function ur(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 N({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:Se("text-right break-all",t&&"font-mono text-xs"),children:r})]})}function mr({diagnostics:s}){const r=s.config.activeProfile?`codex --profile ${s.config.activeProfile}`:"codex";return e.jsx(xe,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 pr-1",children:[e.jsxs(L,{children:[e.jsx(D,{className:"pb-2",children:e.jsxs(R,{className:"flex items-center gap-2 text-base",children:[e.jsx(ts,{className:"h-4 w-4"}),"How Codex works in CCS"]})}),e.jsxs(A,{className:"space-y-2 text-sm text-muted-foreground",children:[e.jsx("p",{children:"Codex is a first-class runtime target in CCS, but it stays runtime-only in v1."}),e.jsxs("p",{children:[e.jsx("code",{children:"ccs-codex"})," and ",e.jsx("code",{children:"ccsx"})," launch native Codex against your saved native config, while ",e.jsx("code",{children:"ccsxp"})," is the opinionated shortcut for"," ",e.jsx("code",{children:"ccs codex --target codex"}),"."]}),e.jsxs("p",{children:["Plain ",e.jsx("code",{children:"codex"})," or a personal alias like ",e.jsx("code",{children:"cxp"})," needs"," ",e.jsx("code",{children:'model_provider = "cliproxy"'})," plus a matching"," ",e.jsx("code",{children:"[model_providers.cliproxy]"})," entry if you want CLIProxy as the saved native default."]}),e.jsxs("p",{children:["Built-in ",e.jsx("code",{children:"openai"})," and ",e.jsx("code",{children:"oss"})," providers are also valid native defaults and do not need a custom ",e.jsx("code",{children:"[model_providers]"})," stanza."]}),e.jsx("p",{children:"Saved default targets for API profiles and variants still remain on Claude or Droid."}),e.jsxs("p",{children:["CCS-backed Codex launches can apply transient ",e.jsx("code",{children:"-c"})," overrides and inject",e.jsx("code",{children:" CCS_CODEX_API_KEY"}),", so effective runtime values may not match this file exactly."]})]})]}),e.jsxs(L,{children:[e.jsx(D,{className:"pb-2",children:e.jsxs(R,{className:"flex items-center gap-2 text-base",children:[e.jsx(ns,{className:"h-4 w-4"}),"Runtime install"]})}),e.jsxs(A,{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Status"}),e.jsx(I,{variant:s.binary.installed?"default":"secondary",children:s.binary.installed?"Detected":"Not found"})]}),e.jsx(N,{label:"Detection source",value:s.binary.source,mono:!0}),e.jsx(N,{label:"Binary path",value:s.binary.path||"Not found",mono:!0}),e.jsx(N,{label:"Install directory",value:s.binary.installDir||"N/A",mono:!0}),e.jsx(N,{label:"Version",value:s.binary.version||"Unknown",mono:!0}),e.jsx(N,{label:"Native aliases",value:"ccs-codex, ccsx",mono:!0}),e.jsx(N,{label:"CCS provider shortcut",value:"ccsxp",mono:!0}),e.jsxs("div",{className:"flex items-center justify-between rounded-md border px-3 py-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"--config override support"}),e.jsx(I,{variant:s.binary.supportsConfigOverrides?"default":"secondary",children:s.binary.supportsConfigOverrides?"Available":"Missing"})]})]})]}),e.jsxs(L,{children:[e.jsx(D,{className:"pb-2",children:e.jsxs(R,{className:"flex items-center gap-2 text-base",children:[e.jsx(ce,{className:"h-4 w-4"}),"CLIProxy-backed native Codex"]})}),e.jsxs(A,{className:"space-y-3 text-sm text-muted-foreground",children:[e.jsxs("p",{children:["There are two supported paths. Use ",e.jsx("code",{children:"ccsxp"})," if you want the built-in CCS Codex provider shortcut. Use the saved recipe below if you want plain"," ",e.jsx("code",{children:"codex"})," or a personal alias like ",e.jsx("code",{children:"cxp"})," to default to CLIProxy."]}),e.jsxs("div",{className:"rounded-md border bg-muted/20 p-3",children:[e.jsx("p",{className:"font-medium text-foreground",children:"Saved native Codex recipe"}),e.jsx("pre",{className:"mt-2 overflow-x-auto rounded-md bg-background p-3 text-xs text-foreground",children:_e})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{children:["1. Save a provider named ",e.jsx("code",{children:"cliproxy"})," with the base URL and env key above."]}),e.jsxs("p",{children:["2. In ",e.jsx("strong",{children:"Top-level settings"}),", set ",e.jsx("strong",{children:"Default provider"})," to"," ",e.jsx("code",{children:"cliproxy"}),"."]}),e.jsxs("p",{children:["3. Export ",e.jsx("code",{children:"CLIPROXY_API_KEY"})," in your shell before launching native Codex."]})]})]})]}),e.jsxs(L,{children:[e.jsx(D,{className:"pb-2",children:e.jsxs(R,{className:"flex items-center gap-2 text-base",children:[e.jsx(as,{className:"h-4 w-4"}),"Config file"]})}),e.jsx(A,{className:"space-y-3",children:e.jsxs("div",{className:"rounded-md border p-3 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"font-medium text-sm",children:"User config"}),s.file.exists?e.jsx(ls,{className:"h-4 w-4 text-green-600"}):e.jsx(os,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(N,{label:"Path",value:s.file.path,mono:!0}),e.jsx(N,{label:"Resolved",value:s.file.resolvedPath,mono:!0}),e.jsx(N,{label:"Size",value:ur(s.file.sizeBytes)}),e.jsx(N,{label:"Last modified",value:dr(s.file.mtimeMs)}),s.file.parseError&&e.jsxs("p",{className:"text-xs text-amber-600",children:["TOML warning: ",s.file.parseError]}),s.file.readError&&e.jsxs("p",{className:"text-xs text-destructive",children:["Read warning: ",s.file.readError]})]})})]}),e.jsxs(L,{children:[e.jsx(D,{className:"pb-2",children:e.jsxs(R,{className:"flex items-center gap-2 text-base",children:[e.jsx(de,{className:"h-4 w-4"}),"Current user-layer summary"]})}),e.jsxs(A,{className:"space-y-3",children:[e.jsx(N,{label:"Model",value:s.config.model||"Not set",mono:!0}),e.jsx(N,{label:"Model provider",value:s.config.modelProvider||"Not set",mono:!0}),e.jsx(N,{label:"Active profile",value:s.config.activeProfile||"Not set",mono:!0}),e.jsx(N,{label:"Approval policy",value:s.config.approvalPolicy||"Not set",mono:!0}),e.jsx(N,{label:"Sandbox mode",value:s.config.sandboxMode||"Not set",mono:!0}),e.jsx(N,{label:"Web search",value:s.config.webSearch||"Not set",mono:!0}),e.jsx(Q,{}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs(I,{variant:"outline",className:"justify-center",children:["providers: ",s.config.modelProviderCount]}),e.jsxs(I,{variant:"outline",className:"justify-center",children:["profiles: ",s.config.profileCount]}),e.jsxs(I,{variant:"outline",className:"justify-center",children:["enabled features: ",s.config.enabledFeatures.length]}),e.jsxs(I,{variant:"outline",className:"justify-center",children:["MCP servers: ",s.config.mcpServerCount]})]}),s.config.topLevelKeys.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:"User-layer keys present"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.config.topLevelKeys.map(t=>e.jsx(I,{variant:"secondary",className:"font-mono text-[10px]",children:t},t))})]})]})]}),e.jsx(cr,{snippets:[{label:"Native short alias",command:"ccsx",description:"Launch the short native Codex runtime alias."},{label:"CCS Codex shortcut",command:'ccsxp "your prompt"',description:"Run the built-in CCS Codex provider on native Codex."},{label:"Explicit provider route",command:'ccs codex --target codex "your prompt"',description:"Use the explicit built-in Codex provider route."},{label:s.config.activeProfile?"Inspect active profile":"Open native Codex",command:r,description:s.config.activeProfile?"Inspect the active named profile directly in native Codex.":"Open native Codex without forcing a named profile overlay."}]}),e.jsxs(L,{children:[e.jsx(D,{className:"pb-2",children:e.jsxs(R,{className:"flex items-center gap-2 text-base",children:[e.jsx(ce,{className:"h-4 w-4"}),"Runtime vs provider"]})}),e.jsxs(A,{className:"grid gap-3 md:grid-cols-2",children:[e.jsxs("div",{className:"rounded-md border p-3 text-sm",children:[e.jsx("p",{className:"font-medium",children:"Native Codex runtime"}),e.jsxs("p",{className:"mt-1 text-muted-foreground",children:["Use ",e.jsx("code",{children:"ccs-codex"}),", ",e.jsx("code",{children:"ccsx"}),", or ",e.jsx("code",{children:"--target codex"})," when you want the local Codex CLI to honor your saved native user config."]})]}),e.jsxs("div",{className:"rounded-md border p-3 text-sm",children:[e.jsx("p",{className:"font-medium",children:"CCS Codex provider / bridge"}),e.jsxs("p",{className:"mt-1 text-muted-foreground",children:["Use ",e.jsx("code",{children:"ccsxp"})," or ",e.jsx("code",{children:"ccs codex --target codex"})," when you want the built-in CCS Codex provider on native Codex. That path uses transient CCS-managed overrides and is separate from the saved ",e.jsx("code",{children:"cliproxy"})," recipe above."]})]})]})]}),e.jsxs(L,{children:[e.jsx(D,{className:"pb-2",children:e.jsx(R,{className:"text-base",children:"Supported flows"})}),e.jsx(A,{children:e.jsxs(us,{children:[e.jsx(ms,{children:e.jsxs(we,{children:[e.jsx(ne,{children:"Flow"}),e.jsx(ne,{children:"Status"}),e.jsx(ne,{children:"Notes"})]})}),e.jsx(xs,{children:s.supportMatrix.map(t=>e.jsxs(we,{children:[e.jsx(ae,{className:"font-mono text-xs",children:t.label}),e.jsx(ae,{children:e.jsx(I,{variant:t.supported?"default":"secondary",children:t.supported?"Yes":"No"})}),e.jsx(ae,{className:"text-xs text-muted-foreground",children:t.notes})]},t.id))})]})})]}),s.warnings.length>0&&e.jsxs(L,{className:"border-amber-200 bg-amber-50/50 dark:bg-amber-950/20",children:[e.jsx(D,{className:"pb-2",children:e.jsxs(R,{className:"flex items-center gap-2 text-base",children:[e.jsx(is,{className:"h-4 w-4 text-amber-600"}),"Warnings"]})}),e.jsx(A,{className:"space-y-1.5",children:s.warnings.map(t=>e.jsxs("p",{className:"text-sm text-amber-800 dark:text-amber-300",children:["- ",t]},t))})]})]})})}function _r(){const{diagnostics:s,diagnosticsLoading:r,diagnosticsError:t,refetchDiagnostics:a,rawConfig:n,rawConfigLoading:o,rawConfigError:i,refetchRawConfig:l,saveRawConfigAsync:d,isSavingRawConfig:c,patchConfigAsync:u,isPatchingConfig:h}=or(),[p,x]=b.useState(null),j=n?.rawText??"",m=p??j,v=p!==null&&p!==j,H=Oe(m),U=H.parseError?{valid:!1,error:H.parseError}:{valid:!0},_=n?.config??null,w=o||!n||v||n?.parseError!==null||n?.readError!==null,Le=i?"Structured controls unavailable: failed to load the current config.toml.":n?.readError?`Structured controls unavailable: ${n.readError}`:v?U.valid?"Save or discard raw TOML edits before using structured controls.":"Fix or discard raw TOML edits before using structured controls.":n?.parseError?`Structured controls disabled: ${n.parseError}`:null,De=b.useMemo(()=>Ee(_),[_]),Re=b.useMemo(()=>Os(_),[_]),Ae=b.useMemo(()=>Ls(_),[_]),Me=b.useMemo(()=>Ds(_),[_]),Ie=b.useMemo(()=>Rs(_),[_]),Ue=b.useMemo(()=>As(_),[_]),Fe=M=>{if(M===j){x(null);return}x(M)},Ke=async()=>{try{if((await Promise.all([a(),l()])).some(q=>!q||q.status==="error"||q.isError||q.error)){F.error("Failed to refresh Codex snapshot. Raw edits were kept.");return}x(null)}catch(M){F.error(M.message||"Failed to refresh Codex snapshot.")}},Ve=async()=>{if(!U.valid){F.error("Fix TOML before saving.");return}try{await d({rawText:m,expectedMtime:n?.exists?n.mtime:void 0}),x(null),F.success("Saved Codex config.toml."),await a()}catch(M){je(M)?F.error("config.toml changed externally. Refresh and retry."):F.error(M.message||"Failed to save Codex config.toml.")}},qe=async(M,fe)=>{try{await u({...M,expectedMtime:n?.exists?n.mtime:void 0}),x(null),F.success(fe)}catch(q){je(q)?F.error("config.toml changed externally. Refresh and retry."):F.error(q.message||"Failed to update Codex config.")}},se="mt-0 h-full border-0 p-0 data-[state=inactive]:hidden",$e=()=>r?e.jsxs("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:[e.jsx($,{className:"mr-2 h-5 w-5 animate-spin"}),"Loading Codex diagnostics..."]}):t||!s?e.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-destructive",children:"Failed to load Codex diagnostics."}):e.jsxs(Xe,{defaultValue:"overview",className:"flex h-full flex-col",children:[e.jsx("div",{className:"shrink-0 px-4 pt-4",children:e.jsxs(Be,{className:"grid w-full grid-cols-3",children:[e.jsx(re,{value:"overview",children:"Overview"}),e.jsx(re,{value:"controls",children:"Control Center"}),e.jsx(re,{value:"docs",children:"Docs"})]})}),e.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden px-4 pb-4 pt-3",children:[e.jsx(te,{value:"overview",className:se,children:e.jsx(mr,{diagnostics:s})}),e.jsx(te,{value:"controls",className:se,children:e.jsx(Ps,{workspacePath:s.workspacePath,activeProfile:s.config.activeProfile,topLevelSettings:De,projectTrustEntries:Re,profileEntries:Ae,modelProviderEntries:Me,mcpServerEntries:Ie,featureCatalog:Te,featureState:Ue,disabled:w,disabledReason:Le,saving:h,onPatch:qe})}),e.jsx(te,{value:"docs",className:se,children:e.jsx(Fs,{diagnostics:s})})]})]});return e.jsx("div",{className:"h-full min-h-0 overflow-hidden",children:e.jsxs(ze,{direction:"horizontal",className:"h-full",children:[e.jsx(pe,{defaultSize:45,minSize:35,children:e.jsx("div",{className:"h-full border-r bg-muted/20",children:$e()})}),e.jsx(Ye,{className:"group flex w-2 cursor-col-resize items-center justify-center bg-border transition-colors hover:bg-primary/20",children:e.jsx(cs,{className:"h-3 w-3 text-muted-foreground group-hover:text-primary"})}),e.jsx(pe,{defaultSize:55,minSize:35,children:e.jsx(hs,{title:"Codex config.toml",pathLabel:n?.path||s?.file.path||"$CODEX_HOME/config.toml",loading:o,parseWarning:U.valid?n?.parseError:U.error,readWarning:n?.readError,value:m,dirty:v,readOnly:!!n?.readError,saving:c,saveDisabled:!v||c||o||!U.valid||!!n?.readError,onChange:M=>{Fe(M)},onSave:Ve,onRefresh:Ke,onDiscard:()=>x(null),language:"toml",loadingLabel:"Loading config.toml...",parseWarningLabel:"TOML warning",ownershipNotice:e.jsxs("div",{className:"rounded-md border border-amber-200 bg-amber-50/60 px-3 py-2 text-sm text-amber-900 dark:bg-amber-950/20 dark:text-amber-300",children:[e.jsx("p",{className:"font-medium",children:"This file is upstream-owned by Codex CLI."}),e.jsxs("p",{children:["CCS does not keep ",e.jsx("code",{children:"~/.codex/config.toml"})," in sync for you."]}),e.jsxs("p",{children:["CCS-backed Codex launches may apply transient ",e.jsx("code",{children:"-c"})," overrides and",e.jsx("code",{children:" CCS_CODEX_API_KEY"}),"; those effective values may not appear here."]})]})})})]})})}export{_r as CodexPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-Dt3edmE5.js";import{A as c,a as d,b as g,c as x,d as h,e as j,f as A,g as D}from"./alert-dialog-
|
|
1
|
+
import{j as e}from"./radix-ui-Dt3edmE5.js";import{A as c,a as d,b as g,c as x,d as h,e as j,f as A,g as D}from"./alert-dialog-CiYMglgR.js";function f({open:i,onConfirm:l,onCancel:r,title:s,description:t,confirmText:a="Confirm",variant:o="default"}){return e.jsx(c,{open:i,onOpenChange:n=>!n&&r(),children:e.jsxs(d,{children:[e.jsxs(g,{children:[e.jsx(x,{children:s}),e.jsx(h,{children:t})]}),e.jsxs(j,{children:[e.jsx(A,{onClick:r,children:"Cancel"}),e.jsx(D,{onClick:l,className:o==="destructive"?"bg-red-600 hover:bg-red-700 text-white":"",children:a})]})]})})}export{f as C};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-Dt3edmE5.js";import{b1 as w,b2 as Pe,B as S,d as N,a as ie,V as ne,n as G,L as T,I as ce,r as ke,s as Fe,t as Te,v as Me,w as X,x as he,b3 as Le,S as b,b4 as Re,b5 as Ae,b6 as Ee,Q as Oe,R as De,U as Y,b7 as _e,c as se}from"./index-B3D2Pi4S.js";import{r as v}from"./react-vendor-CNOkPC89.js";import{a as qe,u as D,b as M}from"./tanstack-CkjseTWE.js";import{C as Ie}from"./confirm-dialog-tjayxZcM.js";import{R as ge,L as fe,am as Ke,a6 as Qe,Z as de,V as Ue,T as je,ap as $e,b as Je,a9 as ze,av as Be,aH as me,K as He,Q as Ge,aI as Ve,w as ve,D as we}from"./icons-Cn04FDSc.js";import{S as ae}from"./separator-CuY8SIhQ.js";import{S as We}from"./searchable-select-C2N5ZoC7.js";import{S as Z}from"./switch-Dz4ptkeA.js";import{t as _}from"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";import"./alert-dialog-Da7R-FpD.js";async function Xe(){const t=await fetch(w("/copilot/status"));if(!t.ok)throw new Error("Failed to fetch copilot status");return t.json()}async function Ye(){const t=await fetch(w("/copilot/config"));if(!t.ok)throw new Error("Failed to fetch copilot config");return t.json()}async function Ze(){const t=await fetch(w("/copilot/models"));if(!t.ok)throw new Error("Failed to fetch copilot models");return t.json()}async function et(){const t=await fetch(w("/copilot/settings/raw"));if(!t.ok)throw new Error("Failed to fetch copilot raw settings");return t.json()}async function tt(t){const s=await fetch(w("/copilot/config"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!s.ok)throw new Error("Failed to update copilot config");return s.json()}async function st(t){const s=await fetch(w("/copilot/settings/raw"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(s.status===409)throw new Pe("Copilot raw settings changed externally");if(!s.ok)throw new Error("Failed to save copilot raw settings");return s.json()}async function at(){const t=await fetch(w("/copilot/auth/start"),{method:"POST"});if(!t.ok)throw new Error("Failed to start auth");return t.json()}async function it(){const t=await fetch(w("/copilot/daemon/start"),{method:"POST"});if(!t.ok)throw new Error("Failed to start daemon");return t.json()}async function nt(){const t=await fetch(w("/copilot/daemon/stop"),{method:"POST"});if(!t.ok)throw new Error("Failed to stop daemon");return t.json()}async function ot(){const t=await fetch(w("/copilot/info"));if(!t.ok)throw new Error("Failed to fetch copilot info");return t.json()}async function lt(t){const s=await fetch(w("/copilot/install"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t?{version:t}:{})});if(!s.ok)throw new Error("Failed to install copilot-api");return s.json()}function Ne(){const t=qe(),s=D({queryKey:["copilot-status"],queryFn:Xe,refetchInterval:5e3}),l=D({queryKey:["copilot-config"],queryFn:Ye}),c=D({queryKey:["copilot-models"],queryFn:Ze}),i=D({queryKey:["copilot-raw-settings"],queryFn:et}),d=D({queryKey:["copilot-info"],queryFn:ot}),r=M({mutationFn:tt,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]}),t.invalidateQueries({queryKey:["copilot-config"]}),t.invalidateQueries({queryKey:["copilot-raw-settings"]})}}),n=M({mutationFn:st,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]}),t.invalidateQueries({queryKey:["copilot-config"]}),t.invalidateQueries({queryKey:["copilot-raw-settings"]})}}),x=M({mutationFn:at,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]})}}),p=M({mutationFn:it,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]})}}),g=M({mutationFn:nt,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]})}}),o=M({mutationFn:lt,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]}),t.invalidateQueries({queryKey:["copilot-info"]})}});return v.useMemo(()=>({status:s.data,statusLoading:s.isLoading,statusError:s.error,refetchStatus:s.refetch,config:l.data,configLoading:l.isLoading,models:c.data?.models??[],currentModel:c.data?.current,modelsLoading:c.isLoading,rawSettings:i.data,rawSettingsLoading:i.isLoading,refetchRawSettings:i.refetch,updateConfig:r.mutate,updateConfigAsync:r.mutateAsync,isUpdating:r.isPending,saveRawSettings:n.mutate,saveRawSettingsAsync:n.mutateAsync,isSavingRawSettings:n.isPending,startAuth:x.mutate,startAuthAsync:x.mutateAsync,isAuthenticating:x.isPending,authResult:x.data,startDaemon:p.mutate,isStartingDaemon:p.isPending,stopDaemon:g.mutate,isStoppingDaemon:g.isPending,info:d.data,infoLoading:d.isLoading,refetchInfo:d.refetch,install:o.mutate,installAsync:o.mutateAsync,isInstalling:o.isPending}),[s.data,s.isLoading,s.error,s.refetch,l.data,l.isLoading,c.data,c.isLoading,i.data,i.isLoading,i.refetch,r.mutate,r.mutateAsync,r.isPending,n.mutate,n.mutateAsync,n.isPending,x.mutate,x.mutateAsync,x.isPending,x.data,p.mutate,p.isPending,g.mutate,g.isPending,d.data,d.isLoading,d.refetch,o.mutate,o.mutateAsync,o.isPending])}function rt({rawSettings:t,rawSettingsLoading:s,isUpdating:l,isSavingRawSettings:c,hasChanges:i,isRawJsonValid:d,onRefresh:r,onSave:n}){return e.jsxs("div",{className:"px-6 py-4 border-b bg-background flex items-center justify-between shrink-0",children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Copilot Configuration"}),t&&e.jsx(S,{variant:"outline",className:"text-xs",children:"copilot.settings.json"})]}),t&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["Last modified:"," ",t.exists?new Date(t.mtime).toLocaleString():"Never saved"]})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(N,{variant:"ghost",size:"sm",onClick:r,disabled:s,children:e.jsx(ge,{className:`w-4 h-4 ${s?"animate-spin":""}`})}),e.jsx(N,{size:"sm",onClick:n,disabled:l||c||!i||!d,children:l||c?e.jsxs(e.Fragment,{children:[e.jsx(fe,{className:"w-4 h-4 mr-1 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Ke,{className:"w-4 h-4 mr-1"}),"Save"]})})]})]})}const ct=[{name:"GPT-4.1 (Free)",description:"Free tier - no premium usage",default:"gpt-4.1",opus:"gpt-4.1",sonnet:"gpt-4.1",haiku:"gpt-4.1"},{name:"GPT-5 Mini (Free)",description:"Free tier - lightweight model",default:"gpt-5-mini",opus:"gpt-5-mini",sonnet:"gpt-5-mini",haiku:"gpt-5-mini"}],dt=[{name:"Claude Opus 4.5",description:"Pro+ (3x) - Most capable reasoning",default:"claude-opus-4.5",opus:"claude-opus-4.5",sonnet:"claude-sonnet-4.5",haiku:"claude-haiku-4.5"},{name:"Claude Sonnet 4.5",description:"Pro+ (1x) - Balanced performance",default:"claude-sonnet-4.5",opus:"claude-opus-4.5",sonnet:"claude-sonnet-4.5",haiku:"claude-haiku-4.5"},{name:"GPT-5.2",description:"Pro+ (1x) - Latest OpenAI (Preview)",default:"gpt-5.2",opus:"gpt-5.2",sonnet:"gpt-5.1",haiku:"gpt-5-mini"},{name:"GPT-5.1 Codex Max",description:"Pro+ (1x) - Best for coding",default:"gpt-5.1-codex-max",opus:"gpt-5.1-codex-max",sonnet:"gpt-5.1-codex",haiku:"gpt-5.1-codex-mini"},{name:"Gemini 2.5 Pro",description:"Pro+ (1x) - Google latest",default:"gemini-2.5-pro",opus:"gemini-2.5-pro",sonnet:"gemini-2.5-pro",haiku:"gemini-3-flash"}];function ue(t){switch(t){case"free":return"bg-green-100 text-green-700 border-green-200";case"pro":return"bg-blue-100 text-blue-700 border-blue-200";case"pro+":return"bg-purple-100 text-purple-700 border-purple-200";case"business":return"bg-orange-100 text-orange-700 border-orange-200";case"enterprise":return"bg-red-100 text-red-700 border-red-200";default:return"bg-muted text-muted-foreground"}}function mt(t){return t==null?null:t===0?"Free":t<1?`${t}x`:t===1?"1x":`${t}x`}function z({label:t,description:s,value:l,onChange:c,models:i,disabled:d}){const{t:r}=ie();return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium",children:t}),s&&e.jsx("p",{className:"text-[10px] text-muted-foreground",children:s})]}),e.jsx(We,{value:l||void 0,onChange:c,disabled:d,placeholder:r("componentModelSelector.selectModel"),searchPlaceholder:r("searchableSelect.searchModels"),emptyText:r("searchableSelect.noResults"),triggerClassName:"h-9",groups:[{key:"models",label:r("componentModelSelector.availableModelsCount",{count:i.length})}],options:i.map(n=>({value:n.id,groupKey:"models",searchText:`${n.name||n.id} ${n.id}`,keywords:[n.minPlan??"",n.preview?"preview":""],triggerContent:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:n.id}),n.minPlan&&e.jsx(S,{variant:"outline",className:`text-[9px] px-1 py-0 h-4 ${ue(n.minPlan)}`,children:n.minPlan})]}),itemContent:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:n.name||n.id}),n.minPlan&&e.jsx(S,{variant:"outline",className:`text-[9px] px-1 py-0 h-4 ${ue(n.minPlan)}`,children:n.minPlan}),n.multiplier!==void 0&&e.jsx("span",{className:"text-[9px] text-muted-foreground",children:mt(n.multiplier)}),n.preview&&e.jsx(S,{variant:"secondary",className:"text-[9px] px-1 py-0 h-4",children:r("componentModelSelector.preview")})]})}))})]})}function ee(t){if(t>=1e6){const s=t/1e6;return s%1===0?`${s}M`:`${s.toFixed(1)}M`}if(t>=1e3){const s=t/1e3;return s%1===0?`${s}K`:`${s.toFixed(1)}K`}return`${t}`}function ut(t){if(!t?.limits)return null;const s=[];return t.limits.maxPromptTokens&&s.push(`prompt ${ee(t.limits.maxPromptTokens)}`),t.limits.maxContextWindowTokens&&s.push(`context ${ee(t.limits.maxContextWindowTokens)}`),t.limits.maxOutputTokens&&s.push(`output ${ee(t.limits.maxOutputTokens)}`),s.length>0?s.join(" | "):null}function xt({currentModel:t,opusModel:s,sonnetModel:l,haikuModel:c,models:i,modelsLoading:d,onApplyPreset:r,onUpdateModel:n,onUpdateOpusModel:x,onUpdateSonnetModel:p,onUpdateHaikuModel:g}){const o=[{label:"Default",id:t},{label:"Opus",id:s||t},{label:"Sonnet",id:l||t},{label:"Haiku",id:c||t}].map(({label:a,id:u})=>{const y=i.find(P=>P.id===u),C=ut(y);return C?{label:a,id:u,limits:C}:null}).filter(a=>a!==null);return e.jsx(ne,{value:"config",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(G,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[e.jsx(Qe,{className:"w-4 h-4"}),"Presets"]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Apply pre-configured model mappings"}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(S,{variant:"outline",className:"text-[10px] bg-green-100 text-green-700 border-green-200",children:"Free Tier"}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"No premium usage count"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:ct.map(a=>e.jsxs(N,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>r(a),title:a.description,children:[e.jsx(de,{className:"w-3 h-3 text-green-600"}),a.name]},a.name))})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(S,{variant:"outline",className:"text-[10px] bg-blue-100 text-blue-700 border-blue-200",children:"Pro+ Required"}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Uses premium request quota"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:dt.map(a=>e.jsxs(N,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>r(a),title:a.description,children:[e.jsx(de,{className:"w-3 h-3"}),a.name]},a.name))})]})]}),e.jsx(ae,{}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-2",children:"Model Mapping"}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Configure which models to use for each tier"}),e.jsxs("div",{className:"mb-4 rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-xs text-amber-900 dark:text-amber-200",children:[e.jsx("p",{className:"font-medium",children:"GitHub Copilot controls prompt/context limits upstream."}),e.jsx("p",{className:"mt-1",children:"CCS can switch Copilot models, but it cannot increase the provider's max prompt or context window."}),o.length>0?e.jsx("div",{className:"mt-2 space-y-1 text-[11px] font-mono",children:o.map(a=>e.jsxs("p",{children:[a.label,": ",a.id," (",a.limits,")"]},`${a.label}-${a.id}`))}):e.jsx("p",{className:"mt-2 text-[11px] font-mono",children:"Start the daemon to inspect live model limits from GitHub Copilot metadata."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(z,{label:"Default Model",description:"Used when no specific tier is requested",value:t,onChange:n,models:i,disabled:d}),e.jsx(z,{label:"Opus (Most capable)",description:"For complex reasoning tasks",value:s||t,onChange:x,models:i,disabled:d}),e.jsx(z,{label:"Sonnet (Balanced)",description:"Balance of speed and capability",value:l||t,onChange:p,models:i,disabled:d}),e.jsx(z,{label:"Haiku (Fast)",description:"Quick responses for simple tasks",value:c||t,onChange:g,models:i,disabled:d})]})]})]})})})}function pt({enabled:t,autoStart:s,port:l,accountType:c,rateLimit:i,waitOnLimit:d,onUpdateEnabled:r,onUpdateAutoStart:n,onUpdatePort:x,onUpdateAccountType:p,onUpdateRateLimit:g,onUpdateWaitOnLimit:o}){const{t:a}=ie();return e.jsx(ne,{value:"settings",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(G,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{htmlFor:"enabled",className:"text-sm font-medium",children:a("copilotSettings.enableCopilot")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a("copilotSettings.enableCopilotDesc")})]}),e.jsx(Z,{id:"enabled",checked:t,onCheckedChange:r})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:a("copilotSettings.basicSettings")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"port",className:"text-xs",children:a("copilotPage.port")}),e.jsx(ce,{id:"port",type:"number",value:l,onChange:u=>x(parseInt(u.target.value,10)),min:1024,max:65535,className:"max-w-[150px] h-8"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"account-type",className:"text-xs",children:a("copilotSettings.accountType")}),e.jsxs(ke,{value:c,onValueChange:p,children:[e.jsx(Fe,{id:"account-type",className:"max-w-[150px] h-8",children:e.jsx(Te,{})}),e.jsxs(Me,{children:[e.jsx(X,{value:"individual",children:a("copilotSettings.accountTypeIndividual")}),e.jsx(X,{value:"business",children:a("copilotSettings.accountTypeBusiness")}),e.jsx(X,{value:"enterprise",children:a("copilotSettings.accountTypeEnterprise")})]})]})]})]}),e.jsx(ae,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:a("copilotSettings.rateLimiting")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"rate-limit",className:"text-xs",children:a("copilotSettings.rateLimitSeconds")}),e.jsx(ce,{id:"rate-limit",type:"number",value:i,onChange:u=>g(u.target.value),placeholder:a("copilotSettings.noLimit"),min:0,className:"max-w-[150px] h-8"})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{htmlFor:"wait-on-limit",className:"text-xs",children:a("copilotSettings.waitOnRateLimit")}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:a("copilotSettings.waitOnRateLimitDesc")})]}),e.jsx(Z,{id:"wait-on-limit",checked:d,onCheckedChange:o})]})]}),e.jsx(ae,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:a("copilotSettings.daemonSettings")}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{htmlFor:"auto-start",className:"text-xs",children:a("copilotSettings.autoStartDaemon")}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:a("copilotSettings.autoStartDaemonDesc")})]}),e.jsx(Z,{id:"auto-start",checked:s,onCheckedChange:n})]})]})]})})})}function B({label:t,command:s}){return e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:t}),e.jsxs("div",{className:"mt-1 flex gap-2",children:[e.jsx("code",{className:"flex-1 px-2 py-1.5 bg-muted rounded text-xs font-mono truncate",children:s}),e.jsx(he,{value:s,size:"icon",className:"h-6 w-6"})]})]})}function ht({rawSettings:t}){return e.jsx(ne,{value:"info",className:"h-full mt-0 border-0 p-0 data-[state=inactive]:hidden",children:e.jsx(G,{className:"h-full",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium flex items-center gap-2 mb-3",children:[e.jsx(Ue,{className:"w-4 h-4"}),"Configuration Info"]}),e.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Provider"}),e.jsx("span",{className:"font-mono",children:"GitHub Copilot"})]}),t&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"File Path"}),e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs break-all",children:t.path}),e.jsx(he,{value:t.path,size:"icon",className:"h-5 w-5"})]})]}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Status"}),e.jsx(S,{variant:"outline",className:t.exists?"w-fit text-green-600 border-green-200 bg-green-50":"w-fit text-muted-foreground",children:t.exists?"File exists":"Using defaults"})]})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-3",children:"Quick Usage"}),e.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[e.jsx(B,{label:"Run with Copilot",command:"ccs copilot"}),e.jsx(B,{label:"Authenticate",command:"ccs copilot auth"}),e.jsx(B,{label:"Start daemon",command:"ccs copilot --start"}),e.jsx(B,{label:"Stop daemon",command:"ccs copilot --stop"})]})]})]})})})}const gt=["ANTHROPIC_BASE_URL","ANTHROPIC_AUTH_TOKEN"];function xe(t){const s=t?.env||{};return gt.filter(l=>!s[l]?.trim())}function pe(t){if(!t||t.length===0)return[];const s=new Map;return t.forEach(l=>{s.set(l.message,l)}),[...s.values()]}function ft(){const{config:t,configLoading:s,models:l,modelsLoading:c,rawSettings:i,rawSettingsLoading:d,updateConfigAsync:r,isUpdating:n,saveRawSettingsAsync:x,isSavingRawSettings:p,refetchRawSettings:g}=Ne(),[o,a]=v.useState({}),[u,y]=v.useState(null),[C,P]=v.useState(!1),q=o.enabled??t?.enabled??!1,I=o.autoStart??t?.auto_start??!1,L=o.port??t?.port??4141,K=o.accountType??t?.account_type??"individual",R=o.model??t?.model??"claude-sonnet-4-6",A=o.rateLimit??t?.rate_limit?.toString()??"",f=o.waitOnLimit??t?.wait_on_limit??!0,Q=o.opusModel??t?.opus_model??"",U=o.sonnetModel??t?.sonnet_model??"",$=o.haikuModel??t?.haiku_model??"",J=(h,j)=>{a(E=>({...E,[h]:j}))},V=h=>{a(j=>({...j,model:h.default,opusModel:h.opus,sonnetModel:h.sonnet,haikuModel:h.haiku})),_.success(`Applied "${h.name}" preset`)},k=v.useMemo(()=>u!==null?u:i?.settings?JSON.stringify(i.settings,null,2):`{
|
|
1
|
+
import{j as e}from"./radix-ui-Dt3edmE5.js";import{b7 as w,b8 as Pe,B as S,d as N,a as ie,V as ne,n as G,L as T,I as ce,r as ke,s as Fe,t as Te,v as Me,w as X,x as he,b9 as Le,S as b,ba as Re,bb as Ae,bc as Oe,Q as Ee,R as _e,U as Y,bd as qe,c as se}from"./index-DAtuJuGe.js";import{r as v}from"./react-vendor-CNOkPC89.js";import{a as De,u as _,b as M}from"./tanstack-B8i0evp-.js";import{C as Ie}from"./confirm-dialog-B9vRgowr.js";import{R as ge,L as fe,ak as Ke,a4 as Ue,Z as de,O as Qe,T as je,an as $e,b as Je,a7 as ze,at as Be,aH as me,K as He,N as Ge,aI as Ve,v as ve,w as we}from"./icons-EMBHZkGo.js";import{S as ae}from"./separator--ZH5ZM-3.js";import{S as We}from"./searchable-select-ULayr5K1.js";import{S as Z}from"./switch-DmDIWykO.js";import{t as q}from"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";import"./alert-dialog-CiYMglgR.js";async function Xe(){const t=await fetch(w("/copilot/status"));if(!t.ok)throw new Error("Failed to fetch copilot status");return t.json()}async function Ye(){const t=await fetch(w("/copilot/config"));if(!t.ok)throw new Error("Failed to fetch copilot config");return t.json()}async function Ze(){const t=await fetch(w("/copilot/models"));if(!t.ok)throw new Error("Failed to fetch copilot models");return t.json()}async function et(){const t=await fetch(w("/copilot/settings/raw"));if(!t.ok)throw new Error("Failed to fetch copilot raw settings");return t.json()}async function tt(t){const s=await fetch(w("/copilot/config"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!s.ok)throw new Error("Failed to update copilot config");return s.json()}async function st(t){const s=await fetch(w("/copilot/settings/raw"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(s.status===409)throw new Pe("Copilot raw settings changed externally");if(!s.ok)throw new Error("Failed to save copilot raw settings");return s.json()}async function at(){const t=await fetch(w("/copilot/auth/start"),{method:"POST"});if(!t.ok)throw new Error("Failed to start auth");return t.json()}async function it(){const t=await fetch(w("/copilot/daemon/start"),{method:"POST"});if(!t.ok)throw new Error("Failed to start daemon");return t.json()}async function nt(){const t=await fetch(w("/copilot/daemon/stop"),{method:"POST"});if(!t.ok)throw new Error("Failed to stop daemon");return t.json()}async function ot(){const t=await fetch(w("/copilot/info"));if(!t.ok)throw new Error("Failed to fetch copilot info");return t.json()}async function lt(t){const s=await fetch(w("/copilot/install"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t?{version:t}:{})});if(!s.ok)throw new Error("Failed to install copilot-api");return s.json()}function Ne(){const t=De(),s=_({queryKey:["copilot-status"],queryFn:Xe,refetchInterval:5e3}),l=_({queryKey:["copilot-config"],queryFn:Ye}),c=_({queryKey:["copilot-models"],queryFn:Ze}),i=_({queryKey:["copilot-raw-settings"],queryFn:et}),d=_({queryKey:["copilot-info"],queryFn:ot}),r=M({mutationFn:tt,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]}),t.invalidateQueries({queryKey:["copilot-config"]}),t.invalidateQueries({queryKey:["copilot-raw-settings"]})}}),n=M({mutationFn:st,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]}),t.invalidateQueries({queryKey:["copilot-config"]}),t.invalidateQueries({queryKey:["copilot-raw-settings"]})}}),x=M({mutationFn:at,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]})}}),p=M({mutationFn:it,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]})}}),g=M({mutationFn:nt,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]})}}),o=M({mutationFn:lt,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]}),t.invalidateQueries({queryKey:["copilot-info"]})}});return v.useMemo(()=>({status:s.data,statusLoading:s.isLoading,statusError:s.error,refetchStatus:s.refetch,config:l.data,configLoading:l.isLoading,models:c.data?.models??[],currentModel:c.data?.current,modelsLoading:c.isLoading,rawSettings:i.data,rawSettingsLoading:i.isLoading,refetchRawSettings:i.refetch,updateConfig:r.mutate,updateConfigAsync:r.mutateAsync,isUpdating:r.isPending,saveRawSettings:n.mutate,saveRawSettingsAsync:n.mutateAsync,isSavingRawSettings:n.isPending,startAuth:x.mutate,startAuthAsync:x.mutateAsync,isAuthenticating:x.isPending,authResult:x.data,startDaemon:p.mutate,isStartingDaemon:p.isPending,stopDaemon:g.mutate,isStoppingDaemon:g.isPending,info:d.data,infoLoading:d.isLoading,refetchInfo:d.refetch,install:o.mutate,installAsync:o.mutateAsync,isInstalling:o.isPending}),[s.data,s.isLoading,s.error,s.refetch,l.data,l.isLoading,c.data,c.isLoading,i.data,i.isLoading,i.refetch,r.mutate,r.mutateAsync,r.isPending,n.mutate,n.mutateAsync,n.isPending,x.mutate,x.mutateAsync,x.isPending,x.data,p.mutate,p.isPending,g.mutate,g.isPending,d.data,d.isLoading,d.refetch,o.mutate,o.mutateAsync,o.isPending])}function rt({rawSettings:t,rawSettingsLoading:s,isUpdating:l,isSavingRawSettings:c,hasChanges:i,isRawJsonValid:d,onRefresh:r,onSave:n}){return e.jsxs("div",{className:"px-6 py-4 border-b bg-background flex items-center justify-between shrink-0",children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Copilot Configuration"}),t&&e.jsx(S,{variant:"outline",className:"text-xs",children:"copilot.settings.json"})]}),t&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["Last modified:"," ",t.exists?new Date(t.mtime).toLocaleString():"Never saved"]})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(N,{variant:"ghost",size:"sm",onClick:r,disabled:s,children:e.jsx(ge,{className:`w-4 h-4 ${s?"animate-spin":""}`})}),e.jsx(N,{size:"sm",onClick:n,disabled:l||c||!i||!d,children:l||c?e.jsxs(e.Fragment,{children:[e.jsx(fe,{className:"w-4 h-4 mr-1 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Ke,{className:"w-4 h-4 mr-1"}),"Save"]})})]})]})}const ct=[{name:"GPT-4.1 (Free)",description:"Free tier - no premium usage",default:"gpt-4.1",opus:"gpt-4.1",sonnet:"gpt-4.1",haiku:"gpt-4.1"},{name:"GPT-5 Mini (Free)",description:"Free tier - lightweight model",default:"gpt-5-mini",opus:"gpt-5-mini",sonnet:"gpt-5-mini",haiku:"gpt-5-mini"}],dt=[{name:"Claude Opus 4.5",description:"Pro+ (3x) - Most capable reasoning",default:"claude-opus-4.5",opus:"claude-opus-4.5",sonnet:"claude-sonnet-4.5",haiku:"claude-haiku-4.5"},{name:"Claude Sonnet 4.5",description:"Pro+ (1x) - Balanced performance",default:"claude-sonnet-4.5",opus:"claude-opus-4.5",sonnet:"claude-sonnet-4.5",haiku:"claude-haiku-4.5"},{name:"GPT-5.2",description:"Pro+ (1x) - Latest OpenAI (Preview)",default:"gpt-5.2",opus:"gpt-5.2",sonnet:"gpt-5.1",haiku:"gpt-5-mini"},{name:"GPT-5.1 Codex Max",description:"Pro+ (1x) - Best for coding",default:"gpt-5.1-codex-max",opus:"gpt-5.1-codex-max",sonnet:"gpt-5.1-codex",haiku:"gpt-5.1-codex-mini"},{name:"Gemini 2.5 Pro",description:"Pro+ (1x) - Google latest",default:"gemini-2.5-pro",opus:"gemini-2.5-pro",sonnet:"gemini-2.5-pro",haiku:"gemini-3-flash"}];function ue(t){switch(t){case"free":return"bg-green-100 text-green-700 border-green-200";case"pro":return"bg-blue-100 text-blue-700 border-blue-200";case"pro+":return"bg-purple-100 text-purple-700 border-purple-200";case"business":return"bg-orange-100 text-orange-700 border-orange-200";case"enterprise":return"bg-red-100 text-red-700 border-red-200";default:return"bg-muted text-muted-foreground"}}function mt(t){return t==null?null:t===0?"Free":t<1?`${t}x`:t===1?"1x":`${t}x`}function z({label:t,description:s,value:l,onChange:c,models:i,disabled:d}){const{t:r}=ie();return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium",children:t}),s&&e.jsx("p",{className:"text-[10px] text-muted-foreground",children:s})]}),e.jsx(We,{value:l||void 0,onChange:c,disabled:d,placeholder:r("componentModelSelector.selectModel"),searchPlaceholder:r("searchableSelect.searchModels"),emptyText:r("searchableSelect.noResults"),triggerClassName:"h-9",groups:[{key:"models",label:r("componentModelSelector.availableModelsCount",{count:i.length})}],options:i.map(n=>({value:n.id,groupKey:"models",searchText:`${n.name||n.id} ${n.id}`,keywords:[n.minPlan??"",n.preview?"preview":""],triggerContent:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:n.id}),n.minPlan&&e.jsx(S,{variant:"outline",className:`text-[9px] px-1 py-0 h-4 ${ue(n.minPlan)}`,children:n.minPlan})]}),itemContent:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:n.name||n.id}),n.minPlan&&e.jsx(S,{variant:"outline",className:`text-[9px] px-1 py-0 h-4 ${ue(n.minPlan)}`,children:n.minPlan}),n.multiplier!==void 0&&e.jsx("span",{className:"text-[9px] text-muted-foreground",children:mt(n.multiplier)}),n.preview&&e.jsx(S,{variant:"secondary",className:"text-[9px] px-1 py-0 h-4",children:r("componentModelSelector.preview")})]})}))})]})}function ee(t){if(t>=1e6){const s=t/1e6;return s%1===0?`${s}M`:`${s.toFixed(1)}M`}if(t>=1e3){const s=t/1e3;return s%1===0?`${s}K`:`${s.toFixed(1)}K`}return`${t}`}function ut(t){if(!t?.limits)return null;const s=[];return t.limits.maxPromptTokens&&s.push(`prompt ${ee(t.limits.maxPromptTokens)}`),t.limits.maxContextWindowTokens&&s.push(`context ${ee(t.limits.maxContextWindowTokens)}`),t.limits.maxOutputTokens&&s.push(`output ${ee(t.limits.maxOutputTokens)}`),s.length>0?s.join(" | "):null}function xt({currentModel:t,opusModel:s,sonnetModel:l,haikuModel:c,models:i,modelsLoading:d,onApplyPreset:r,onUpdateModel:n,onUpdateOpusModel:x,onUpdateSonnetModel:p,onUpdateHaikuModel:g}){const o=[{label:"Default",id:t},{label:"Opus",id:s||t},{label:"Sonnet",id:l||t},{label:"Haiku",id:c||t}].map(({label:a,id:u})=>{const y=i.find(P=>P.id===u),C=ut(y);return C?{label:a,id:u,limits:C}:null}).filter(a=>a!==null);return e.jsx(ne,{value:"config",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(G,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[e.jsx(Ue,{className:"w-4 h-4"}),"Presets"]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Apply pre-configured model mappings"}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(S,{variant:"outline",className:"text-[10px] bg-green-100 text-green-700 border-green-200",children:"Free Tier"}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"No premium usage count"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:ct.map(a=>e.jsxs(N,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>r(a),title:a.description,children:[e.jsx(de,{className:"w-3 h-3 text-green-600"}),a.name]},a.name))})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(S,{variant:"outline",className:"text-[10px] bg-blue-100 text-blue-700 border-blue-200",children:"Pro+ Required"}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Uses premium request quota"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:dt.map(a=>e.jsxs(N,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>r(a),title:a.description,children:[e.jsx(de,{className:"w-3 h-3"}),a.name]},a.name))})]})]}),e.jsx(ae,{}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-2",children:"Model Mapping"}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Configure which models to use for each tier"}),e.jsxs("div",{className:"mb-4 rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-xs text-amber-900 dark:text-amber-200",children:[e.jsx("p",{className:"font-medium",children:"GitHub Copilot controls prompt/context limits upstream."}),e.jsx("p",{className:"mt-1",children:"CCS can switch Copilot models, but it cannot increase the provider's max prompt or context window."}),o.length>0?e.jsx("div",{className:"mt-2 space-y-1 text-[11px] font-mono",children:o.map(a=>e.jsxs("p",{children:[a.label,": ",a.id," (",a.limits,")"]},`${a.label}-${a.id}`))}):e.jsx("p",{className:"mt-2 text-[11px] font-mono",children:"Start the daemon to inspect live model limits from GitHub Copilot metadata."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(z,{label:"Default Model",description:"Used when no specific tier is requested",value:t,onChange:n,models:i,disabled:d}),e.jsx(z,{label:"Opus (Most capable)",description:"For complex reasoning tasks",value:s||t,onChange:x,models:i,disabled:d}),e.jsx(z,{label:"Sonnet (Balanced)",description:"Balance of speed and capability",value:l||t,onChange:p,models:i,disabled:d}),e.jsx(z,{label:"Haiku (Fast)",description:"Quick responses for simple tasks",value:c||t,onChange:g,models:i,disabled:d})]})]})]})})})}function pt({enabled:t,autoStart:s,port:l,accountType:c,rateLimit:i,waitOnLimit:d,onUpdateEnabled:r,onUpdateAutoStart:n,onUpdatePort:x,onUpdateAccountType:p,onUpdateRateLimit:g,onUpdateWaitOnLimit:o}){const{t:a}=ie();return e.jsx(ne,{value:"settings",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(G,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{htmlFor:"enabled",className:"text-sm font-medium",children:a("copilotSettings.enableCopilot")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a("copilotSettings.enableCopilotDesc")})]}),e.jsx(Z,{id:"enabled",checked:t,onCheckedChange:r})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:a("copilotSettings.basicSettings")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"port",className:"text-xs",children:a("copilotPage.port")}),e.jsx(ce,{id:"port",type:"number",value:l,onChange:u=>x(parseInt(u.target.value,10)),min:1024,max:65535,className:"max-w-[150px] h-8"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"account-type",className:"text-xs",children:a("copilotSettings.accountType")}),e.jsxs(ke,{value:c,onValueChange:p,children:[e.jsx(Fe,{id:"account-type",className:"max-w-[150px] h-8",children:e.jsx(Te,{})}),e.jsxs(Me,{children:[e.jsx(X,{value:"individual",children:a("copilotSettings.accountTypeIndividual")}),e.jsx(X,{value:"business",children:a("copilotSettings.accountTypeBusiness")}),e.jsx(X,{value:"enterprise",children:a("copilotSettings.accountTypeEnterprise")})]})]})]})]}),e.jsx(ae,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:a("copilotSettings.rateLimiting")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"rate-limit",className:"text-xs",children:a("copilotSettings.rateLimitSeconds")}),e.jsx(ce,{id:"rate-limit",type:"number",value:i,onChange:u=>g(u.target.value),placeholder:a("copilotSettings.noLimit"),min:0,className:"max-w-[150px] h-8"})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{htmlFor:"wait-on-limit",className:"text-xs",children:a("copilotSettings.waitOnRateLimit")}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:a("copilotSettings.waitOnRateLimitDesc")})]}),e.jsx(Z,{id:"wait-on-limit",checked:d,onCheckedChange:o})]})]}),e.jsx(ae,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:a("copilotSettings.daemonSettings")}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(T,{htmlFor:"auto-start",className:"text-xs",children:a("copilotSettings.autoStartDaemon")}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:a("copilotSettings.autoStartDaemonDesc")})]}),e.jsx(Z,{id:"auto-start",checked:s,onCheckedChange:n})]})]})]})})})}function B({label:t,command:s}){return e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:t}),e.jsxs("div",{className:"mt-1 flex gap-2",children:[e.jsx("code",{className:"flex-1 px-2 py-1.5 bg-muted rounded text-xs font-mono truncate",children:s}),e.jsx(he,{value:s,size:"icon",className:"h-6 w-6"})]})]})}function ht({rawSettings:t}){return e.jsx(ne,{value:"info",className:"h-full mt-0 border-0 p-0 data-[state=inactive]:hidden",children:e.jsx(G,{className:"h-full",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium flex items-center gap-2 mb-3",children:[e.jsx(Qe,{className:"w-4 h-4"}),"Configuration Info"]}),e.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Provider"}),e.jsx("span",{className:"font-mono",children:"GitHub Copilot"})]}),t&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"File Path"}),e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs break-all",children:t.path}),e.jsx(he,{value:t.path,size:"icon",className:"h-5 w-5"})]})]}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Status"}),e.jsx(S,{variant:"outline",className:t.exists?"w-fit text-green-600 border-green-200 bg-green-50":"w-fit text-muted-foreground",children:t.exists?"File exists":"Using defaults"})]})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-3",children:"Quick Usage"}),e.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[e.jsx(B,{label:"Run with Copilot",command:"ccs copilot"}),e.jsx(B,{label:"Authenticate",command:"ccs copilot auth"}),e.jsx(B,{label:"Start daemon",command:"ccs copilot --start"}),e.jsx(B,{label:"Stop daemon",command:"ccs copilot --stop"})]})]})]})})})}const gt=["ANTHROPIC_BASE_URL","ANTHROPIC_AUTH_TOKEN"];function xe(t){const s=t?.env||{};return gt.filter(l=>!s[l]?.trim())}function pe(t){if(!t||t.length===0)return[];const s=new Map;return t.forEach(l=>{s.set(l.message,l)}),[...s.values()]}function ft(){const{config:t,configLoading:s,models:l,modelsLoading:c,rawSettings:i,rawSettingsLoading:d,updateConfigAsync:r,isUpdating:n,saveRawSettingsAsync:x,isSavingRawSettings:p,refetchRawSettings:g}=Ne(),[o,a]=v.useState({}),[u,y]=v.useState(null),[C,P]=v.useState(!1),D=o.enabled??t?.enabled??!1,I=o.autoStart??t?.auto_start??!1,L=o.port??t?.port??4141,K=o.accountType??t?.account_type??"individual",R=o.model??t?.model??"claude-sonnet-4-6",A=o.rateLimit??t?.rate_limit?.toString()??"",f=o.waitOnLimit??t?.wait_on_limit??!0,U=o.opusModel??t?.opus_model??"",Q=o.sonnetModel??t?.sonnet_model??"",$=o.haikuModel??t?.haiku_model??"",J=(h,j)=>{a(O=>({...O,[h]:j}))},V=h=>{a(j=>({...j,model:h.default,opusModel:h.opus,sonnetModel:h.sonnet,haikuModel:h.haiku})),q.success(`Applied "${h.name}" preset`)},k=v.useMemo(()=>u!==null?u:i?.settings?JSON.stringify(i.settings,null,2):`{
|
|
2
2
|
"env": {}
|
|
3
|
-
}`,[u,i]),m=v.useCallback(h=>{y(h)},[]),oe=v.useMemo(()=>{try{return JSON.parse(k),!0}catch{return!1}},[k]),be=v.useMemo(()=>{const h=Object.keys(o).length>0,j=u!==null&&u!==JSON.stringify(i?.settings,null,2);return h||j},[o,u,i]),le=v.useMemo(()=>{if(u!==null)try{return JSON.parse(u)}catch{return i?.settings}return i?.settings},[u,i?.settings]),ye=v.useMemo(()=>xe(le),[le]),Se=v.useMemo(()=>pe([...t?.warnings??[],...i?.warnings??[]]),[t?.warnings,i?.warnings]),re=async({overwriteRawSettings:h=!1}={})=>{try{const j=[];if(Object.keys(o).length>0){const F=await r({enabled:q,auto_start:I,port:L,account_type:K,model:R,rate_limit:A?parseInt(A,10):null,wait_on_limit:f,opus_model:Q||void 0,sonnet_model:U||void 0,haiku_model:$||void 0});j.push(...F.warnings??[])}let E=[];if(u!==null&&oe){const F=JSON.parse(k);E=xe(F);const Ce=await x({settings:F,expectedMtime:h?void 0:i?.mtime});j.push(...Ce.warnings??[])}const W=pe(j),O=[];W.length>0&&O.push(W.map(F=>F.message).join(" ")),E.length>0&&O.push(`Missing fields will use defaults: ${E.join(", ")}`),W.length>0?_.warning("Copilot configuration saved with model adjustments",{description:O.join(" ")}):O.length>0?_.success("Copilot configuration saved",{description:O.join(" ")}):_.success("Copilot configuration saved"),a({}),y(null)}catch(j){Le(j)?P(!0):_.error("Failed to save settings")}};return{configLoading:s,rawSettingsLoading:d,modelsLoading:c,isUpdating:n,isSavingRawSettings:p,models:l,rawSettings:i,rawJsonContent:k,rawJsonEdits:u,enabled:q,autoStart:I,port:L,accountType:K,currentModel:R,rateLimit:A,waitOnLimit:f,opusModel:Q,sonnetModel:U,haikuModel:$,isRawJsonValid:oe,hasChanges:be,normalizationWarnings:Se,conflictDialog:C,updateField:J,applyPreset:V,handleRawJsonChange:m,handleSave:re,handleConflictResolve:async h=>{P(!1),h?await re({overwriteRawSettings:!0}):y(null)},refetchRawSettings:g,missingRequiredFields:ye}}function jt(){const{configLoading:t,rawSettingsLoading:s,modelsLoading:l,isUpdating:c,isSavingRawSettings:i,models:d,rawSettings:r,rawJsonContent:n,rawJsonEdits:x,enabled:p,autoStart:g,port:o,accountType:a,currentModel:u,rateLimit:y,waitOnLimit:C,opusModel:P,sonnetModel:q,haikuModel:I,isRawJsonValid:L,hasChanges:K,normalizationWarnings:R,conflictDialog:A,updateField:f,applyPreset:Q,handleRawJsonChange:U,handleSave:$,handleConflictResolve:J,refetchRawSettings:V,missingRequiredFields:k}=ft();return t||s?e.jsxs("div",{className:"space-y-6",children:[e.jsx(b,{className:"h-10 w-full"}),e.jsx(b,{className:"h-10 w-full"}),e.jsx(b,{className:"h-10 w-full"}),e.jsx(b,{className:"h-10 w-full"})]}):e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx(rt,{rawSettings:r,rawSettingsLoading:s,isUpdating:c,isSavingRawSettings:i,hasChanges:K,isRawJsonValid:L,onRefresh:()=>V(),onSave:$}),R.length>0&&e.jsx("div",{className:"px-6 pt-4 shrink-0",children:e.jsxs(Re,{variant:"warning",children:[e.jsx(je,{className:"h-4 w-4"}),e.jsx(Ae,{children:"Deprecated Copilot models detected"}),e.jsxs(Ee,{className:"space-y-2",children:[e.jsx("p",{children:"Loading this page did not rewrite your files. Save the Copilot configuration to persist these replacements."}),e.jsx("div",{className:"space-y-1",children:R.map(m=>e.jsx("p",{children:m.message},m.message))})]})]})}),e.jsxs("div",{className:"flex-1 flex divide-x overflow-hidden",children:[e.jsx("div",{className:"w-[540px] shrink-0 flex flex-col overflow-hidden bg-muted/5",children:e.jsx("div",{className:"h-full flex flex-col",children:e.jsxs(Oe,{defaultValue:"config",className:"h-full flex flex-col",children:[e.jsx("div",{className:"px-4 pt-4 shrink-0",children:e.jsxs(De,{className:"w-full",children:[e.jsx(Y,{value:"config",className:"flex-1",children:"Model Config"}),e.jsx(Y,{value:"settings",className:"flex-1",children:"Settings"}),e.jsx(Y,{value:"info",className:"flex-1",children:"Info"})]})}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[e.jsx(xt,{currentModel:u,opusModel:P,sonnetModel:q,haikuModel:I,models:d,modelsLoading:l,onApplyPreset:Q,onUpdateModel:m=>f("model",m),onUpdateOpusModel:m=>f("opusModel",m),onUpdateSonnetModel:m=>f("sonnetModel",m),onUpdateHaikuModel:m=>f("haikuModel",m)}),e.jsx(pt,{enabled:p,autoStart:g,port:o,accountType:a,rateLimit:y,waitOnLimit:C,onUpdateEnabled:m=>f("enabled",m),onUpdateAutoStart:m=>f("autoStart",m),onUpdatePort:m=>f("port",m),onUpdateAccountType:m=>f("accountType",m),onUpdateRateLimit:m=>f("rateLimit",m),onUpdateWaitOnLimit:m=>f("waitOnLimit",m)}),e.jsx(ht,{rawSettings:r})]})]})})}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-2 bg-muted/30 border-b flex items-center gap-2 shrink-0 h-[45px]",children:[e.jsx($e,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Raw Configuration (JSON)"})]}),e.jsx(_e,{rawJsonContent:n,isRawJsonValid:L,rawJsonEdits:x,rawSettingsEnv:r?.settings?.env,onChange:U,missingRequiredFields:k})]})]}),e.jsx(Ie,{open:A,title:"File Modified Externally",description:"This settings file was modified by another process. Overwrite with your changes or discard?",confirmText:"Overwrite",variant:"destructive",onConfirm:()=>J(!0),onCancel:()=>J(!1)})]})}function te({title:t,children:s}){return e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide px-3",children:t}),e.jsx("div",{className:"space-y-1",children:s})]})}function H({icon:t,label:s,status:l,statusText:c,variant:i="default"}){return e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 rounded-lg bg-muted/50",children:[e.jsx(t,{className:"w-4 h-4 text-muted-foreground shrink-0"}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("span",{className:"text-sm",children:s})}),e.jsx("div",{className:"flex items-center gap-1.5",children:l?e.jsxs(e.Fragment,{children:[e.jsx(ve,{className:se("w-4 h-4",i==="warning"?"text-yellow-500":"text-green-500")}),e.jsx("span",{className:se("text-xs",i==="warning"?"text-yellow-500":"text-green-500"),children:c||"Yes"})]}):e.jsxs(e.Fragment,{children:[e.jsx(we,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:c||"No"})]})})]})}function vt(){return e.jsxs("div",{className:"space-y-4 p-4",children:[e.jsx(b,{className:"h-8 w-full"}),e.jsx(b,{className:"h-12 w-full"}),e.jsx(b,{className:"h-12 w-full"}),e.jsx(b,{className:"h-12 w-full"})]})}function Ot(){const{t}=ie(),{status:s,statusLoading:l,refetchStatus:c,startAuth:i,isAuthenticating:d,startDaemon:r,isStartingDaemon:n,stopDaemon:x,isStoppingDaemon:p,install:g,isInstalling:o}=Ne();return e.jsxs("div",{className:"flex h-full min-h-0 overflow-hidden",children:[e.jsxs("div",{className:"w-80 border-r flex flex-col bg-muted/30 shrink-0",children:[e.jsxs("div",{className:"p-4 border-b bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Je,{className:"w-5 h-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:t("copilotPage.title")})]}),e.jsx(N,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>c(),disabled:l,children:e.jsx(ge,{className:se("w-4 h-4",l&&"animate-spin")})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("copilotPage.subtitle")})]}),e.jsx(G,{className:"flex-1",children:l?e.jsx(vt,{}):e.jsxs("div",{className:"p-3 space-y-4",children:[e.jsxs("div",{className:"rounded-md border border-yellow-500/50 bg-yellow-500/15 p-3 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(je,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-400 shrink-0"}),e.jsx("span",{className:"text-xs font-semibold text-yellow-800 dark:text-yellow-200",children:t("copilotPage.unofficialTitle")})]}),e.jsxs("ul",{className:"text-[11px] text-yellow-700 dark:text-yellow-300 space-y-0.5 pl-6 list-disc",children:[e.jsx("li",{children:t("copilotPage.unofficialItem1")}),e.jsx("li",{children:t("copilotPage.unofficialItem2")}),e.jsx("li",{children:t("copilotPage.unofficialItem3")})]})]}),e.jsxs(te,{title:t("copilotPage.setup"),children:[e.jsx(H,{icon:ze,label:"copilot-api",status:s?.installed??!1,statusText:s?.installed?s.version?`v${s.version}`:t("copilotPage.installed"):t("copilotPage.missing")}),!s?.installed&&e.jsx(N,{size:"sm",className:"w-full mt-2",onClick:()=>g(void 0),disabled:o,children:o?e.jsxs(e.Fragment,{children:[e.jsx(fe,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}),t("copilotPage.installing")]}):e.jsxs(e.Fragment,{children:[e.jsx(Be,{className:"w-3.5 h-3.5 mr-1.5"}),t("copilotPage.installCopilotApi")]})}),s?.installed&&e.jsx(H,{icon:me,label:t("copilotPage.integration"),status:s?.enabled??!1,statusText:s?.enabled?t("copilotPage.enabled"):t("copilotPage.disabled")})]}),s?.installed&&e.jsxs(te,{title:t("copilotPage.auth"),children:[e.jsx(H,{icon:He,label:t("copilotPage.github"),status:s?.authenticated??!1,statusText:s?.authenticated?t("copilotPage.connected"):t("copilotPage.notConnected")}),!s?.authenticated&&e.jsx(N,{size:"sm",className:"w-full mt-2",onClick:()=>i(),disabled:d,children:t(d?"copilotPage.authenticating":"copilotPage.authenticate")})]}),s?.authenticated&&e.jsxs(te,{title:t("copilotPage.daemon"),children:[e.jsx(H,{icon:Ge,label:t("copilotPage.status"),status:s?.daemon_running??!1,statusText:s?.daemon_running?t("copilotPage.running"):t("copilotPage.stopped")}),e.jsxs("div",{className:"px-3 py-1 text-xs text-muted-foreground",children:[t("copilotPage.port"),": ",s?.port??4141]}),e.jsx("div",{className:"px-1",children:s?.daemon_running?e.jsxs(N,{size:"sm",variant:"outline",className:"w-full",onClick:()=>x(),disabled:p,children:[e.jsx(Ve,{className:"w-3.5 h-3.5 mr-1.5"}),t(p?"copilotPage.stopping":"copilotPage.stop")]}):e.jsxs(N,{size:"sm",variant:"outline",className:"w-full",onClick:()=>r(),disabled:n,children:[e.jsx(me,{className:"w-3.5 h-3.5 mr-1.5"}),t(n?"copilotPage.starting":"copilotPage.start")]})})]})]})}),e.jsx("div",{className:"p-3 border-t bg-background text-xs text-muted-foreground",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:t("copilotPage.proxy")}),s?.daemon_running?e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ve,{className:"w-3 h-3 text-green-500"}),t("copilotPage.active")]}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(we,{className:"w-3 h-3 text-muted-foreground"}),t("copilotPage.inactive")]})]})})]}),e.jsx("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-hidden",children:e.jsx(jt,{})})]})}export{Ot as CopilotPage};
|
|
3
|
+
}`,[u,i]),m=v.useCallback(h=>{y(h)},[]),oe=v.useMemo(()=>{try{return JSON.parse(k),!0}catch{return!1}},[k]),be=v.useMemo(()=>{const h=Object.keys(o).length>0,j=u!==null&&u!==JSON.stringify(i?.settings,null,2);return h||j},[o,u,i]),le=v.useMemo(()=>{if(u!==null)try{return JSON.parse(u)}catch{return i?.settings}return i?.settings},[u,i?.settings]),ye=v.useMemo(()=>xe(le),[le]),Se=v.useMemo(()=>pe([...t?.warnings??[],...i?.warnings??[]]),[t?.warnings,i?.warnings]),re=async({overwriteRawSettings:h=!1}={})=>{try{const j=[];if(Object.keys(o).length>0){const F=await r({enabled:D,auto_start:I,port:L,account_type:K,model:R,rate_limit:A?parseInt(A,10):null,wait_on_limit:f,opus_model:U||void 0,sonnet_model:Q||void 0,haiku_model:$||void 0});j.push(...F.warnings??[])}let O=[];if(u!==null&&oe){const F=JSON.parse(k);O=xe(F);const Ce=await x({settings:F,expectedMtime:h?void 0:i?.mtime});j.push(...Ce.warnings??[])}const W=pe(j),E=[];W.length>0&&E.push(W.map(F=>F.message).join(" ")),O.length>0&&E.push(`Missing fields will use defaults: ${O.join(", ")}`),W.length>0?q.warning("Copilot configuration saved with model adjustments",{description:E.join(" ")}):E.length>0?q.success("Copilot configuration saved",{description:E.join(" ")}):q.success("Copilot configuration saved"),a({}),y(null)}catch(j){Le(j)?P(!0):q.error("Failed to save settings")}};return{configLoading:s,rawSettingsLoading:d,modelsLoading:c,isUpdating:n,isSavingRawSettings:p,models:l,rawSettings:i,rawJsonContent:k,rawJsonEdits:u,enabled:D,autoStart:I,port:L,accountType:K,currentModel:R,rateLimit:A,waitOnLimit:f,opusModel:U,sonnetModel:Q,haikuModel:$,isRawJsonValid:oe,hasChanges:be,normalizationWarnings:Se,conflictDialog:C,updateField:J,applyPreset:V,handleRawJsonChange:m,handleSave:re,handleConflictResolve:async h=>{P(!1),h?await re({overwriteRawSettings:!0}):y(null)},refetchRawSettings:g,missingRequiredFields:ye}}function jt(){const{configLoading:t,rawSettingsLoading:s,modelsLoading:l,isUpdating:c,isSavingRawSettings:i,models:d,rawSettings:r,rawJsonContent:n,rawJsonEdits:x,enabled:p,autoStart:g,port:o,accountType:a,currentModel:u,rateLimit:y,waitOnLimit:C,opusModel:P,sonnetModel:D,haikuModel:I,isRawJsonValid:L,hasChanges:K,normalizationWarnings:R,conflictDialog:A,updateField:f,applyPreset:U,handleRawJsonChange:Q,handleSave:$,handleConflictResolve:J,refetchRawSettings:V,missingRequiredFields:k}=ft();return t||s?e.jsxs("div",{className:"space-y-6",children:[e.jsx(b,{className:"h-10 w-full"}),e.jsx(b,{className:"h-10 w-full"}),e.jsx(b,{className:"h-10 w-full"}),e.jsx(b,{className:"h-10 w-full"})]}):e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx(rt,{rawSettings:r,rawSettingsLoading:s,isUpdating:c,isSavingRawSettings:i,hasChanges:K,isRawJsonValid:L,onRefresh:()=>V(),onSave:$}),R.length>0&&e.jsx("div",{className:"px-6 pt-4 shrink-0",children:e.jsxs(Re,{variant:"warning",children:[e.jsx(je,{className:"h-4 w-4"}),e.jsx(Ae,{children:"Deprecated Copilot models detected"}),e.jsxs(Oe,{className:"space-y-2",children:[e.jsx("p",{children:"Loading this page did not rewrite your files. Save the Copilot configuration to persist these replacements."}),e.jsx("div",{className:"space-y-1",children:R.map(m=>e.jsx("p",{children:m.message},m.message))})]})]})}),e.jsxs("div",{className:"flex-1 flex divide-x overflow-hidden",children:[e.jsx("div",{className:"w-[540px] shrink-0 flex flex-col overflow-hidden bg-muted/5",children:e.jsx("div",{className:"h-full flex flex-col",children:e.jsxs(Ee,{defaultValue:"config",className:"h-full flex flex-col",children:[e.jsx("div",{className:"px-4 pt-4 shrink-0",children:e.jsxs(_e,{className:"w-full",children:[e.jsx(Y,{value:"config",className:"flex-1",children:"Model Config"}),e.jsx(Y,{value:"settings",className:"flex-1",children:"Settings"}),e.jsx(Y,{value:"info",className:"flex-1",children:"Info"})]})}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[e.jsx(xt,{currentModel:u,opusModel:P,sonnetModel:D,haikuModel:I,models:d,modelsLoading:l,onApplyPreset:U,onUpdateModel:m=>f("model",m),onUpdateOpusModel:m=>f("opusModel",m),onUpdateSonnetModel:m=>f("sonnetModel",m),onUpdateHaikuModel:m=>f("haikuModel",m)}),e.jsx(pt,{enabled:p,autoStart:g,port:o,accountType:a,rateLimit:y,waitOnLimit:C,onUpdateEnabled:m=>f("enabled",m),onUpdateAutoStart:m=>f("autoStart",m),onUpdatePort:m=>f("port",m),onUpdateAccountType:m=>f("accountType",m),onUpdateRateLimit:m=>f("rateLimit",m),onUpdateWaitOnLimit:m=>f("waitOnLimit",m)}),e.jsx(ht,{rawSettings:r})]})]})})}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-2 bg-muted/30 border-b flex items-center gap-2 shrink-0 h-[45px]",children:[e.jsx($e,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Raw Configuration (JSON)"})]}),e.jsx(qe,{rawJsonContent:n,isRawJsonValid:L,rawJsonEdits:x,rawSettingsEnv:r?.settings?.env,onChange:Q,missingRequiredFields:k})]})]}),e.jsx(Ie,{open:A,title:"File Modified Externally",description:"This settings file was modified by another process. Overwrite with your changes or discard?",confirmText:"Overwrite",variant:"destructive",onConfirm:()=>J(!0),onCancel:()=>J(!1)})]})}function te({title:t,children:s}){return e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide px-3",children:t}),e.jsx("div",{className:"space-y-1",children:s})]})}function H({icon:t,label:s,status:l,statusText:c,variant:i="default"}){return e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 rounded-lg bg-muted/50",children:[e.jsx(t,{className:"w-4 h-4 text-muted-foreground shrink-0"}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("span",{className:"text-sm",children:s})}),e.jsx("div",{className:"flex items-center gap-1.5",children:l?e.jsxs(e.Fragment,{children:[e.jsx(ve,{className:se("w-4 h-4",i==="warning"?"text-yellow-500":"text-green-500")}),e.jsx("span",{className:se("text-xs",i==="warning"?"text-yellow-500":"text-green-500"),children:c||"Yes"})]}):e.jsxs(e.Fragment,{children:[e.jsx(we,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:c||"No"})]})})]})}function vt(){return e.jsxs("div",{className:"space-y-4 p-4",children:[e.jsx(b,{className:"h-8 w-full"}),e.jsx(b,{className:"h-12 w-full"}),e.jsx(b,{className:"h-12 w-full"}),e.jsx(b,{className:"h-12 w-full"})]})}function Et(){const{t}=ie(),{status:s,statusLoading:l,refetchStatus:c,startAuth:i,isAuthenticating:d,startDaemon:r,isStartingDaemon:n,stopDaemon:x,isStoppingDaemon:p,install:g,isInstalling:o}=Ne();return e.jsxs("div",{className:"flex h-full min-h-0 overflow-hidden",children:[e.jsxs("div",{className:"w-80 border-r flex flex-col bg-muted/30 shrink-0",children:[e.jsxs("div",{className:"p-4 border-b bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Je,{className:"w-5 h-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:t("copilotPage.title")})]}),e.jsx(N,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>c(),disabled:l,children:e.jsx(ge,{className:se("w-4 h-4",l&&"animate-spin")})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("copilotPage.subtitle")})]}),e.jsx(G,{className:"flex-1",children:l?e.jsx(vt,{}):e.jsxs("div",{className:"p-3 space-y-4",children:[e.jsxs("div",{className:"rounded-md border border-yellow-500/50 bg-yellow-500/15 p-3 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(je,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-400 shrink-0"}),e.jsx("span",{className:"text-xs font-semibold text-yellow-800 dark:text-yellow-200",children:t("copilotPage.unofficialTitle")})]}),e.jsxs("ul",{className:"text-[11px] text-yellow-700 dark:text-yellow-300 space-y-0.5 pl-6 list-disc",children:[e.jsx("li",{children:t("copilotPage.unofficialItem1")}),e.jsx("li",{children:t("copilotPage.unofficialItem2")}),e.jsx("li",{children:t("copilotPage.unofficialItem3")})]})]}),e.jsxs(te,{title:t("copilotPage.setup"),children:[e.jsx(H,{icon:ze,label:"copilot-api",status:s?.installed??!1,statusText:s?.installed?s.version?`v${s.version}`:t("copilotPage.installed"):t("copilotPage.missing")}),!s?.installed&&e.jsx(N,{size:"sm",className:"w-full mt-2",onClick:()=>g(void 0),disabled:o,children:o?e.jsxs(e.Fragment,{children:[e.jsx(fe,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}),t("copilotPage.installing")]}):e.jsxs(e.Fragment,{children:[e.jsx(Be,{className:"w-3.5 h-3.5 mr-1.5"}),t("copilotPage.installCopilotApi")]})}),s?.installed&&e.jsx(H,{icon:me,label:t("copilotPage.integration"),status:s?.enabled??!1,statusText:s?.enabled?t("copilotPage.enabled"):t("copilotPage.disabled")})]}),s?.installed&&e.jsxs(te,{title:t("copilotPage.auth"),children:[e.jsx(H,{icon:He,label:t("copilotPage.github"),status:s?.authenticated??!1,statusText:s?.authenticated?t("copilotPage.connected"):t("copilotPage.notConnected")}),!s?.authenticated&&e.jsx(N,{size:"sm",className:"w-full mt-2",onClick:()=>i(),disabled:d,children:t(d?"copilotPage.authenticating":"copilotPage.authenticate")})]}),s?.authenticated&&e.jsxs(te,{title:t("copilotPage.daemon"),children:[e.jsx(H,{icon:Ge,label:t("copilotPage.status"),status:s?.daemon_running??!1,statusText:s?.daemon_running?t("copilotPage.running"):t("copilotPage.stopped")}),e.jsxs("div",{className:"px-3 py-1 text-xs text-muted-foreground",children:[t("copilotPage.port"),": ",s?.port??4141]}),e.jsx("div",{className:"px-1",children:s?.daemon_running?e.jsxs(N,{size:"sm",variant:"outline",className:"w-full",onClick:()=>x(),disabled:p,children:[e.jsx(Ve,{className:"w-3.5 h-3.5 mr-1.5"}),t(p?"copilotPage.stopping":"copilotPage.stop")]}):e.jsxs(N,{size:"sm",variant:"outline",className:"w-full",onClick:()=>r(),disabled:n,children:[e.jsx(me,{className:"w-3.5 h-3.5 mr-1.5"}),t(n?"copilotPage.starting":"copilotPage.start")]})})]})]})}),e.jsx("div",{className:"p-3 border-t bg-background text-xs text-muted-foreground",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:t("copilotPage.proxy")}),s?.daemon_running?e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ve,{className:"w-3 h-3 text-green-500"}),t("copilotPage.active")]}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(we,{className:"w-3 h-3 text-muted-foreground"}),t("copilotPage.inactive")]})]})})]}),e.jsx("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-hidden",children:e.jsx(jt,{})})]})}export{Et as CopilotPage};
|