@kaitranntt/ccs 7.44.0 → 7.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/config/unified-config-loader.d.ts.map +1 -1
  2. package/dist/config/unified-config-loader.js +6 -0
  3. package/dist/config/unified-config-loader.js.map +1 -1
  4. package/dist/config/unified-config-types.d.ts +8 -0
  5. package/dist/config/unified-config-types.d.ts.map +1 -1
  6. package/dist/config/unified-config-types.js +1 -0
  7. package/dist/config/unified-config-types.js.map +1 -1
  8. package/dist/cursor/cursor-models.d.ts +3 -3
  9. package/dist/cursor/cursor-models.d.ts.map +1 -1
  10. package/dist/cursor/cursor-models.js +105 -22
  11. package/dist/cursor/cursor-models.js.map +1 -1
  12. package/dist/ui/assets/accounts-B8J62kJ6.js +1 -0
  13. package/dist/ui/assets/{alert-dialog-z6HEaPqe.js → alert-dialog-B5t_5_UL.js} +1 -1
  14. package/dist/ui/assets/api-DuZyDFf7.js +1 -0
  15. package/dist/ui/assets/{auth-section-DXzTOTWo.js → auth-section-Dnaxf97q.js} +1 -1
  16. package/dist/ui/assets/{backups-section-BWlvR34E.js → backups-section-DUIq9Rxi.js} +1 -1
  17. package/dist/ui/assets/{cliproxy-BSyjTE6L.js → cliproxy-aK19VC4f.js} +2 -2
  18. package/dist/ui/assets/{cliproxy-control-panel-CKJHMGqD.js → cliproxy-control-panel-9OS_kdTh.js} +1 -1
  19. package/dist/ui/assets/confirm-dialog-D7hNt3ez.js +1 -0
  20. package/dist/ui/assets/copilot-B5dVoOMQ.js +3 -0
  21. package/dist/ui/assets/cursor-4zDGbBRA.js +1 -0
  22. package/dist/ui/assets/globalenv-section-DuUcheRN.js +1 -0
  23. package/dist/ui/assets/{health-Dqa61Bj1.js → health-Ddkl8zIJ.js} +1 -1
  24. package/dist/ui/assets/{icons-G0rMFC4M.js → icons-DGASzt3M.js} +1 -1
  25. package/dist/ui/assets/{index-DacpfVrt.js → index-BRCdKMse.js} +1 -1
  26. package/dist/ui/assets/{index-CiJndnpm.js → index-BRxqvMyp.js} +1 -1
  27. package/dist/ui/assets/index-C6u1zYVL.css +1 -0
  28. package/dist/ui/assets/{index-akX3q-m-.js → index-D0I8OsQ3.js} +1 -1
  29. package/dist/ui/assets/{index-qMp3rvH4.js → index-DOxNxHpI.js} +1 -1
  30. package/dist/ui/assets/{index-DGFnVfdv.js → index-Dv5jtphl.js} +17 -17
  31. package/dist/ui/assets/{proxy-status-widget-CSq7bxEv.js → proxy-status-widget-DKYj4dWI.js} +1 -1
  32. package/dist/ui/assets/separator-DrDw3JjB.js +1 -0
  33. package/dist/ui/assets/shared-psG1uSqB.js +1 -0
  34. package/dist/ui/assets/sidebar/cursor.svg +1 -0
  35. package/dist/ui/assets/{switch-Cr9fAsnM.js → switch-C0ri2ChT.js} +1 -1
  36. package/dist/ui/index.html +3 -3
  37. package/dist/web-server/routes/cursor-routes.d.ts.map +1 -1
  38. package/dist/web-server/routes/cursor-routes.js +1 -1
  39. package/dist/web-server/routes/cursor-routes.js.map +1 -1
  40. package/dist/web-server/routes/cursor-settings-routes.d.ts.map +1 -1
  41. package/dist/web-server/routes/cursor-settings-routes.js +114 -18
  42. package/dist/web-server/routes/cursor-settings-routes.js.map +1 -1
  43. package/package.json +1 -1
  44. package/dist/ui/assets/accounts-D7apG3NM.js +0 -1
  45. package/dist/ui/assets/api-C-aJLAbg.js +0 -1
  46. package/dist/ui/assets/confirm-dialog-D8vB20zr.js +0 -1
  47. package/dist/ui/assets/copilot-7sa7MFH_.js +0 -4
  48. package/dist/ui/assets/cursor-KwsbcPyA.js +0 -1
  49. package/dist/ui/assets/globalenv-section-BiyiJmIj.js +0 -1
  50. package/dist/ui/assets/index-Bqle3SG4.css +0 -1
  51. package/dist/ui/assets/shared-DvyiNZGg.js +0 -1
@@ -1 +1 @@
1
- import{j as e}from"./radix-ui-qEZD5MMp.js";import{r as y}from"./react-vendor-CNOkPC89.js";import{a$ as J,aG as W,b0 as Z,b1 as _,b2 as ee,b3 as se,b4 as te,c as d,B as E,as as ae,E as ne,G as re,X as oe,Y as ie,Z as le,_ as ce,$ as de,b as T,T as xe,o as me,p as ue,ae as he}from"./index-DGFnVfdv.js";import{A as ge,a as pe,b as fe,c as be,d as je,e as ye,f as Ne,g as we}from"./alert-dialog-z6HEaPqe.js";import{u as R,a as ve,b as Ce,e as Se}from"./tanstack-De4wvi8X.js";import{t as V}from"./notifications-B2HqRBj7.js";import{a3 as ke,A as Pe,R as f,aG as Ve,aH as Ae,aI as Te,X as De,S as Ie,aJ as Ue,aK as $e,U as Ee,q as qe,k as Re,a2 as Le,ap as Me,T as q,aw as Fe}from"./icons-G0rMFC4M.js";async function Ke(){const s=await fetch("/api/cliproxy/sync/status");if(!s.ok){let n="Failed to fetch sync status";try{const t=await s.json();n=t.error||t.message||n}catch{}throw new Error(n)}return s.json()}async function Be(){const s=new AbortController,n=setTimeout(()=>s.abort(),3e4);try{const t=await fetch("/api/cliproxy/sync",{method:"POST",headers:{"Content-Type":"application/json"},signal:s.signal});if(!t.ok){let a="Sync failed";try{const r=await t.json();a=r.error||r.message||a}catch{}throw new Error(a)}return t.json()}catch(t){throw t instanceof Error&&t.name==="AbortError"?new Error("Sync request timed out after 30 seconds"):t}finally{clearTimeout(n)}}function Ge(){return R({queryKey:["cliproxy-sync-status"],queryFn:Ke,refetchInterval:3e4,retry:1,staleTime:1e4})}function Qe(){const s=ve();return Ce({mutationFn:Be,onSuccess:n=>{s.invalidateQueries({queryKey:["cliproxy-sync-status"]}),s.invalidateQueries({queryKey:["cliproxy-sync-preview"]}),n.syncedCount===0?V.info("No profiles to sync"):V.success(`Synced ${n.syncedCount} profile${n.syncedCount===1?"":"s"} to CLIProxy`)},onError:n=>{V.error(`Sync failed: ${n.message}`)}})}function A(s,n){const t=s.replace(/-\d+$/,"").split(".").map(Number),a=n.replace(/-\d+$/,"").split(".").map(Number);for(let r=0;r<3;r++){if((t[r]||0)>(a[r]||0))return!0;if((t[r]||0)<(a[r]||0))return!1}return!1}function ze(s){if(!s)return"";const n=new Date(s).getTime(),a=Date.now()-n,r=Math.floor(a/(1e3*60*60)),i=Math.floor(a%(1e3*60*60)/(1e3*60));return r>0?`${r}h ${i}m`:`${i}m`}function He(s){if(!s)return"";const n=Date.now()-s,t=Math.floor(n/(1e3*60)),a=Math.floor(n/(1e3*60*60));return t<1?"just now":t<60?`${t}m ago`:`${a}h ago`}function N({icon:s,tooltip:n,onClick:t,disabled:a,isPending:r,className:i,variant:l="ghost"}){return e.jsxs(xe,{children:[e.jsx(me,{asChild:!0,children:e.jsx(T,{variant:l==="destructive-ghost"?"ghost":l,size:"sm",className:d("h-7 w-7 p-0",l==="destructive-ghost"&&"hover:bg-destructive/10 hover:text-destructive hover:border-destructive/30",i),onClick:t,disabled:a,children:r?e.jsx(f,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(s,{className:"w-3.5 h-3.5"})})}),e.jsx(ue,{side:"bottom",className:"text-xs",children:n})]})}function es(){const{data:s,isLoading:n}=J(),{data:t}=W(),{data:a,isLoading:r}=Z(),i=_(),l=ee(),w=se(),u=te(),{data:L}=Ge(),{mutate:M,isPending:v}=Qe(),[h,D]=y.useState(!1),[g,F]=y.useState(""),[K,b]=y.useState(!1),[C,S]=y.useState(null),{data:B}=R({queryKey:["cliproxy-server-config"],queryFn:()=>he.cliproxyServer.get(),staleTime:3e4}),G=Se({mutationKey:["update-backend"]})>0,x=B?.remote,I=x?.enabled&&x?.host,p=s?.running??!1,k=i.isPending||l.isPending||w.isPending||u.isPending||G||v,Q=t?.hasUpdate??!1,m=t?.isStable===!1,U=t?.currentVersion,j=L?.configured??!1,z=j?"Sync Ready":"No Config",P=m?t?.maxStableVersion||a?.latestStable:t?.latestVersion,$=o=>{if(!o)return;const c=a?.maxStableVersion||"6.6.80";if(A(o,c)){S(o),b(!0);return}u.mutate({version:o})},H=()=>{C&&u.mutate({version:C,force:!0}),b(!1),S(null)},O=()=>{b(!1),S(null)},X=I?(()=>{const o=x.protocol||"http",c=x.port||(o==="https"?443:80);return o==="https"&&c===443||o==="http"&&c===80?x.host:`${x.host}:${c}`})():null;return I?e.jsxs("div",{className:d("rounded-lg border p-3 transition-colors","border-blue-500/30 bg-blue-500/5"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ke,{className:"w-4 h-4 text-blue-500"}),e.jsx("span",{className:"text-sm font-medium",children:"Remote Proxy"}),e.jsx(E,{variant:"secondary",className:"text-[10px] h-4 px-1.5 bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",children:"Active"})]}),e.jsx(Pe,{className:"w-3 h-3 text-blue-600"})]}),e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:[e.jsx("div",{className:"flex items-center gap-1 mb-1",children:e.jsx("span",{className:"font-mono",children:X})}),e.jsx("p",{className:"text-[10px] text-muted-foreground/70 leading-tight",children:"Traffic auto-routed to remote server"})]})]}):e.jsx(ae,{delayDuration:300,children:e.jsxs("div",{className:d("rounded-lg border p-3 transition-colors",p?"border-green-500/30 bg-green-500/5":"border-muted bg-muted/30"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:d("w-2 h-2 rounded-full",p?"bg-green-500 animate-pulse":"bg-muted-foreground/30")}),e.jsx("span",{className:"text-sm font-medium",children:t?.backendLabel??"CLIProxy"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[n?e.jsx(f,{className:"w-3 h-3 animate-spin text-muted-foreground"}):p?e.jsxs(e.Fragment,{children:[e.jsx(N,{icon:v?f:Ve,tooltip:"Sync profiles to CLIProxy",onClick:()=>M(),disabled:!j||k,isPending:v}),e.jsx(N,{icon:Ae,tooltip:"Restart",onClick:()=>w.mutate(),disabled:k,isPending:w.isPending}),e.jsx(N,{icon:Te,tooltip:"Stop",onClick:()=>l.mutate(),disabled:k,isPending:l.isPending,variant:"destructive-ghost"})]}):null,e.jsx(N,{icon:h?De:Ie,tooltip:h?"Close":"Version settings",onClick:()=>D(!h),className:h?"bg-muted":void 0})]})]}),U&&e.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[e.jsxs("span",{className:d("text-xs font-mono text-muted-foreground",m&&"text-amber-600 dark:text-amber-400"),children:["v",U]}),(Q||m)&&P&&e.jsxs(E,{variant:"secondary",className:d("text-[10px] h-4 px-1.5 gap-0.5 cursor-pointer transition-colors",m?"bg-amber-100 text-amber-700 hover:bg-amber-200 dark:bg-amber-900/30 dark:text-amber-400 dark:hover:bg-amber-900/50":"bg-green-100 text-green-700 hover:bg-green-200 dark:bg-green-900/30 dark:text-green-400 dark:hover:bg-green-900/50"),onClick:()=>$(P),title:`Click to ${m?"downgrade":"update"}`,children:[m?e.jsx(Ue,{className:"w-2.5 h-2.5"}):e.jsx($e,{className:"w-2.5 h-2.5"}),P]})]}),p&&s&&e.jsxs("div",{className:"mt-2 flex items-center gap-4 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:["Port ",s.port]}),s.sessionCount!==void 0&&s.sessionCount>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ee,{className:"w-3 h-3"}),s.sessionCount," session",s.sessionCount!==1?"s":""]}),s.startedAt&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(qe,{className:"w-3 h-3"}),ze(s.startedAt)]})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs",children:[j?e.jsx(Re,{className:"w-3 h-3 text-green-600 dark:text-green-400"}):e.jsx(Le,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:d("text-xs",j?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:z})]}),e.jsx(ne,{open:h,onOpenChange:D,children:e.jsxs(re,{className:"mt-3 pt-3 border-t border-muted",children:[e.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-3",children:"Version Management"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(oe,{value:g,onValueChange:F,disabled:r,children:[e.jsx(ie,{className:"h-8 text-xs flex-1",children:e.jsx(le,{placeholder:"Select version to install..."})}),e.jsx(ce,{children:a?.versions.slice(0,20).map(o=>{const c=a?.maxStableVersion&&A(o,a.maxStableVersion);return e.jsx(de,{value:o,className:"text-xs",children:e.jsxs("span",{className:"flex items-center gap-2",children:["v",o,o===a.latestStable&&e.jsx("span",{className:"text-green-600 dark:text-green-400",children:"(stable)"}),c&&e.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:"⚠"})]})},o)})})]}),e.jsxs(T,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1.5 px-3",onClick:()=>$(g),disabled:u.isPending||!g,children:[u.isPending?e.jsx(f,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(Me,{className:"w-3.5 h-3.5"}),"Install"]})]}),g&&a?.maxStableVersion&&A(g,a.maxStableVersion)&&e.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[e.jsx(q,{className:"w-3.5 h-3.5 flex-shrink-0"}),e.jsxs("span",{children:["Versions above ",a.maxStableVersion," have known issues"]})]}),t?.checkedAt&&e.jsxs("div",{className:"mt-2 text-[10px] text-muted-foreground/60",children:["Last checked ",He(t.checkedAt)]})]})}),!p&&e.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Not running"}),e.jsxs(T,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>i.mutate(),disabled:i.isPending,children:[i.isPending?e.jsx(f,{className:"w-3 h-3 animate-spin"}):e.jsx(Fe,{className:"w-3 h-3"}),"Start"]})]}),e.jsx(ge,{open:K,onOpenChange:b,children:e.jsxs(pe,{children:[e.jsxs(fe,{children:[e.jsxs(be,{className:"flex items-center gap-2",children:[e.jsx(q,{className:"w-5 h-5 text-amber-500"}),"Install Unstable Version?"]}),e.jsxs(je,{className:"space-y-2",children:[e.jsxs("p",{children:["You are about to install ",e.jsxs("strong",{children:["v",C]}),", which is above the maximum stable version"," ",e.jsxs("strong",{children:["v",a?.maxStableVersion||"6.6.80"]}),"."]}),e.jsx("p",{className:"text-amber-600 dark:text-amber-400",children:"This version has known stability issues and may cause unexpected behavior."}),e.jsx("p",{children:"Are you sure you want to proceed?"})]})]}),e.jsxs(ye,{children:[e.jsx(Ne,{onClick:O,children:"Cancel"}),e.jsx(we,{onClick:H,className:"bg-amber-500 hover:bg-amber-600 text-white",children:"Install Anyway"})]})]})})]})})}export{es as P};
1
+ import{j as e}from"./radix-ui-qEZD5MMp.js";import{r as y}from"./react-vendor-CNOkPC89.js";import{aZ as Z,aG as _,a_ as J,a$ as W,b0 as ee,b1 as se,b2 as te,c as d,B as E,as as ae,E as ne,G as re,X as oe,Y as ie,Z as le,_ as ce,$ as de,b as T,T as xe,o as me,p as ue,ae as he}from"./index-Dv5jtphl.js";import{A as ge,a as pe,b as fe,c as be,d as je,e as ye,f as Ne,g as we}from"./alert-dialog-B5t_5_UL.js";import{u as q,a as ve,b as Ce,e as Se}from"./tanstack-De4wvi8X.js";import{t as V}from"./notifications-B2HqRBj7.js";import{a2 as ke,A as Pe,R as f,aG as Ve,aH as Ae,aI as Te,X as De,S as Ie,aJ as Ue,aK as $e,U as Ee,p as Re,j as qe,a1 as Le,ao as Me,T as R,av as Fe}from"./icons-DGASzt3M.js";async function Ke(){const s=await fetch("/api/cliproxy/sync/status");if(!s.ok){let n="Failed to fetch sync status";try{const t=await s.json();n=t.error||t.message||n}catch{}throw new Error(n)}return s.json()}async function Be(){const s=new AbortController,n=setTimeout(()=>s.abort(),3e4);try{const t=await fetch("/api/cliproxy/sync",{method:"POST",headers:{"Content-Type":"application/json"},signal:s.signal});if(!t.ok){let a="Sync failed";try{const r=await t.json();a=r.error||r.message||a}catch{}throw new Error(a)}return t.json()}catch(t){throw t instanceof Error&&t.name==="AbortError"?new Error("Sync request timed out after 30 seconds"):t}finally{clearTimeout(n)}}function Ge(){return q({queryKey:["cliproxy-sync-status"],queryFn:Ke,refetchInterval:3e4,retry:1,staleTime:1e4})}function Qe(){const s=ve();return Ce({mutationFn:Be,onSuccess:n=>{s.invalidateQueries({queryKey:["cliproxy-sync-status"]}),s.invalidateQueries({queryKey:["cliproxy-sync-preview"]}),n.syncedCount===0?V.info("No profiles to sync"):V.success(`Synced ${n.syncedCount} profile${n.syncedCount===1?"":"s"} to CLIProxy`)},onError:n=>{V.error(`Sync failed: ${n.message}`)}})}function A(s,n){const t=s.replace(/-\d+$/,"").split(".").map(Number),a=n.replace(/-\d+$/,"").split(".").map(Number);for(let r=0;r<3;r++){if((t[r]||0)>(a[r]||0))return!0;if((t[r]||0)<(a[r]||0))return!1}return!1}function ze(s){if(!s)return"";const n=new Date(s).getTime(),a=Date.now()-n,r=Math.floor(a/(1e3*60*60)),i=Math.floor(a%(1e3*60*60)/(1e3*60));return r>0?`${r}h ${i}m`:`${i}m`}function He(s){if(!s)return"";const n=Date.now()-s,t=Math.floor(n/(1e3*60)),a=Math.floor(n/(1e3*60*60));return t<1?"just now":t<60?`${t}m ago`:`${a}h ago`}function N({icon:s,tooltip:n,onClick:t,disabled:a,isPending:r,className:i,variant:l="ghost"}){return e.jsxs(xe,{children:[e.jsx(me,{asChild:!0,children:e.jsx(T,{variant:l==="destructive-ghost"?"ghost":l,size:"sm",className:d("h-7 w-7 p-0",l==="destructive-ghost"&&"hover:bg-destructive/10 hover:text-destructive hover:border-destructive/30",i),onClick:t,disabled:a,children:r?e.jsx(f,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(s,{className:"w-3.5 h-3.5"})})}),e.jsx(ue,{side:"bottom",className:"text-xs",children:n})]})}function es(){const{data:s,isLoading:n}=Z(),{data:t}=_(),{data:a,isLoading:r}=J(),i=W(),l=ee(),w=se(),u=te(),{data:L}=Ge(),{mutate:M,isPending:v}=Qe(),[h,D]=y.useState(!1),[g,F]=y.useState(""),[K,b]=y.useState(!1),[C,S]=y.useState(null),{data:B}=q({queryKey:["cliproxy-server-config"],queryFn:()=>he.cliproxyServer.get(),staleTime:3e4}),G=Se({mutationKey:["update-backend"]})>0,x=B?.remote,I=x?.enabled&&x?.host,p=s?.running??!1,k=i.isPending||l.isPending||w.isPending||u.isPending||G||v,Q=t?.hasUpdate??!1,m=t?.isStable===!1,U=t?.currentVersion,j=L?.configured??!1,z=j?"Sync Ready":"No Config",P=m?t?.maxStableVersion||a?.latestStable:t?.latestVersion,$=o=>{if(!o)return;const c=a?.maxStableVersion||"6.6.80";if(A(o,c)){S(o),b(!0);return}u.mutate({version:o})},H=()=>{C&&u.mutate({version:C,force:!0}),b(!1),S(null)},O=()=>{b(!1),S(null)},X=I?(()=>{const o=x.protocol||"http",c=x.port||(o==="https"?443:80);return o==="https"&&c===443||o==="http"&&c===80?x.host:`${x.host}:${c}`})():null;return I?e.jsxs("div",{className:d("rounded-lg border p-3 transition-colors","border-blue-500/30 bg-blue-500/5"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ke,{className:"w-4 h-4 text-blue-500"}),e.jsx("span",{className:"text-sm font-medium",children:"Remote Proxy"}),e.jsx(E,{variant:"secondary",className:"text-[10px] h-4 px-1.5 bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",children:"Active"})]}),e.jsx(Pe,{className:"w-3 h-3 text-blue-600"})]}),e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:[e.jsx("div",{className:"flex items-center gap-1 mb-1",children:e.jsx("span",{className:"font-mono",children:X})}),e.jsx("p",{className:"text-[10px] text-muted-foreground/70 leading-tight",children:"Traffic auto-routed to remote server"})]})]}):e.jsx(ae,{delayDuration:300,children:e.jsxs("div",{className:d("rounded-lg border p-3 transition-colors",p?"border-green-500/30 bg-green-500/5":"border-muted bg-muted/30"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:d("w-2 h-2 rounded-full",p?"bg-green-500 animate-pulse":"bg-muted-foreground/30")}),e.jsx("span",{className:"text-sm font-medium",children:t?.backendLabel??"CLIProxy"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[n?e.jsx(f,{className:"w-3 h-3 animate-spin text-muted-foreground"}):p?e.jsxs(e.Fragment,{children:[e.jsx(N,{icon:v?f:Ve,tooltip:"Sync profiles to CLIProxy",onClick:()=>M(),disabled:!j||k,isPending:v}),e.jsx(N,{icon:Ae,tooltip:"Restart",onClick:()=>w.mutate(),disabled:k,isPending:w.isPending}),e.jsx(N,{icon:Te,tooltip:"Stop",onClick:()=>l.mutate(),disabled:k,isPending:l.isPending,variant:"destructive-ghost"})]}):null,e.jsx(N,{icon:h?De:Ie,tooltip:h?"Close":"Version settings",onClick:()=>D(!h),className:h?"bg-muted":void 0})]})]}),U&&e.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[e.jsxs("span",{className:d("text-xs font-mono text-muted-foreground",m&&"text-amber-600 dark:text-amber-400"),children:["v",U]}),(Q||m)&&P&&e.jsxs(E,{variant:"secondary",className:d("text-[10px] h-4 px-1.5 gap-0.5 cursor-pointer transition-colors",m?"bg-amber-100 text-amber-700 hover:bg-amber-200 dark:bg-amber-900/30 dark:text-amber-400 dark:hover:bg-amber-900/50":"bg-green-100 text-green-700 hover:bg-green-200 dark:bg-green-900/30 dark:text-green-400 dark:hover:bg-green-900/50"),onClick:()=>$(P),title:`Click to ${m?"downgrade":"update"}`,children:[m?e.jsx(Ue,{className:"w-2.5 h-2.5"}):e.jsx($e,{className:"w-2.5 h-2.5"}),P]})]}),p&&s&&e.jsxs("div",{className:"mt-2 flex items-center gap-4 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:["Port ",s.port]}),s.sessionCount!==void 0&&s.sessionCount>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ee,{className:"w-3 h-3"}),s.sessionCount," session",s.sessionCount!==1?"s":""]}),s.startedAt&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Re,{className:"w-3 h-3"}),ze(s.startedAt)]})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs",children:[j?e.jsx(qe,{className:"w-3 h-3 text-green-600 dark:text-green-400"}):e.jsx(Le,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:d("text-xs",j?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:z})]}),e.jsx(ne,{open:h,onOpenChange:D,children:e.jsxs(re,{className:"mt-3 pt-3 border-t border-muted",children:[e.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-3",children:"Version Management"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(oe,{value:g,onValueChange:F,disabled:r,children:[e.jsx(ie,{className:"h-8 text-xs flex-1",children:e.jsx(le,{placeholder:"Select version to install..."})}),e.jsx(ce,{children:a?.versions.slice(0,20).map(o=>{const c=a?.maxStableVersion&&A(o,a.maxStableVersion);return e.jsx(de,{value:o,className:"text-xs",children:e.jsxs("span",{className:"flex items-center gap-2",children:["v",o,o===a.latestStable&&e.jsx("span",{className:"text-green-600 dark:text-green-400",children:"(stable)"}),c&&e.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:"⚠"})]})},o)})})]}),e.jsxs(T,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1.5 px-3",onClick:()=>$(g),disabled:u.isPending||!g,children:[u.isPending?e.jsx(f,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(Me,{className:"w-3.5 h-3.5"}),"Install"]})]}),g&&a?.maxStableVersion&&A(g,a.maxStableVersion)&&e.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[e.jsx(R,{className:"w-3.5 h-3.5 flex-shrink-0"}),e.jsxs("span",{children:["Versions above ",a.maxStableVersion," have known issues"]})]}),t?.checkedAt&&e.jsxs("div",{className:"mt-2 text-[10px] text-muted-foreground/60",children:["Last checked ",He(t.checkedAt)]})]})}),!p&&e.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Not running"}),e.jsxs(T,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>i.mutate(),disabled:i.isPending,children:[i.isPending?e.jsx(f,{className:"w-3 h-3 animate-spin"}):e.jsx(Fe,{className:"w-3 h-3"}),"Start"]})]}),e.jsx(ge,{open:K,onOpenChange:b,children:e.jsxs(pe,{children:[e.jsxs(fe,{children:[e.jsxs(be,{className:"flex items-center gap-2",children:[e.jsx(R,{className:"w-5 h-5 text-amber-500"}),"Install Unstable Version?"]}),e.jsxs(je,{className:"space-y-2",children:[e.jsxs("p",{children:["You are about to install ",e.jsxs("strong",{children:["v",C]}),", which is above the maximum stable version"," ",e.jsxs("strong",{children:["v",a?.maxStableVersion||"6.6.80"]}),"."]}),e.jsx("p",{className:"text-amber-600 dark:text-amber-400",children:"This version has known stability issues and may cause unexpected behavior."}),e.jsx("p",{children:"Are you sure you want to proceed?"})]})]}),e.jsxs(ye,{children:[e.jsx(Ne,{onClick:O,children:"Cancel"}),e.jsx(we,{onClick:H,className:"bg-amber-500 hover:bg-amber-600 text-white",children:"Install Anyway"})]})]})})]})})}export{es as P};
@@ -0,0 +1 @@
1
+ import{j as i,a1 as n}from"./radix-ui-qEZD5MMp.js";import"./react-vendor-CNOkPC89.js";import{c as e}from"./index-Dv5jtphl.js";function m({className:t,orientation:a="horizontal",decorative:o=!0,...r}){return i.jsx(n,{"data-slot":"separator",decorative:o,orientation:a,className:e("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...r})}export{m as S};
@@ -0,0 +1 @@
1
+ import{j as s}from"./radix-ui-qEZD5MMp.js";import{r as l}from"./react-vendor-CNOkPC89.js";import{aQ as o,aR as m,aS as c,aT as x,aU as u,b as h,C as p,a as g}from"./index-Dv5jtphl.js";import{N as j,a0 as f,aA as N,T as b}from"./icons-DGASzt3M.js";import"./tanstack-De4wvi8X.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-C-pVd1--.js";import"./code-highlight-BRUf_pqB.js";function B(){const[t,i]=l.useState("commands"),{data:e}=o(),{data:n,isLoading:r}=m(t),d=[{id:"commands",label:"Commands",icon:j,count:e?.commands??0},{id:"skills",label:"Skills",icon:f,count:e?.skills??0},{id:"agents",label:"Agents",icon:N,count:e?.agents??0}];return s.jsxs("div",{className:"p-6 max-w-6xl mx-auto space-y-8",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold",children:"Shared Data"}),s.jsx("p",{className:"text-muted-foreground",children:"Commands, skills, and agents shared across Claude instances"})]}),e&&!e.symlinkStatus.valid&&s.jsxs(c,{variant:"warning",children:[s.jsx(b,{className:"h-4 w-4"}),s.jsx(x,{children:"Configuration Required"}),s.jsxs(u,{children:[e.symlinkStatus.message,". Run `ccs sync` to configure."]})]}),s.jsx("div",{className:"flex gap-2 border-b pb-2",children:d.map(a=>s.jsxs(h,{variant:t===a.id?"default":"ghost",size:"sm",onClick:()=>i(a.id),className:"flex items-center gap-2",children:[s.jsx(a.icon,{className:"w-4 h-4"}),a.label," (",a.count,")"]},a.id))}),s.jsx("div",{className:"mt-4",children:r?s.jsx("div",{className:"text-muted-foreground",children:"Loading..."}):n?.items.length===0?s.jsxs("div",{className:"text-muted-foreground",children:["No ",t," found"]}):s.jsx("div",{className:"grid gap-3",children:n?.items.map(a=>s.jsx(p,{children:s.jsxs(g,{children:[s.jsx("div",{className:"font-medium",children:a.name}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:a.description}),s.jsx("p",{className:"text-xs text-muted-foreground mt-2 font-mono truncate",children:a.path})]})},a.name))})})]})}export{B as SharedPage};
@@ -0,0 +1 @@
1
+ <svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Cursor</title><path d="M22.106 5.68L12.5.135a.998.998 0 00-.998 0L1.893 5.68a.84.84 0 00-.419.726v11.186c0 .3.16.577.42.727l9.607 5.547a.999.999 0 00.998 0l9.608-5.547a.84.84 0 00.42-.727V6.407a.84.84 0 00-.42-.726zm-.603 1.176L12.228 22.92c-.063.108-.228.064-.228-.061V12.34a.59.59 0 00-.295-.51l-9.11-5.26c-.107-.062-.063-.228.062-.228h18.55c.264 0 .428.286.296.514z"></path></svg>
@@ -1 +1 @@
1
- import{j as a,a2 as s,a3 as n}from"./radix-ui-qEZD5MMp.js";import"./react-vendor-CNOkPC89.js";import{c as e}from"./index-DGFnVfdv.js";function c({className:t,...r}){return a.jsx(s,{"data-slot":"switch",className:e("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...r,children:a.jsx(n,{"data-slot":"switch-thumb",className:e("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}export{c as S};
1
+ import{j as a,a2 as s,a3 as n}from"./radix-ui-qEZD5MMp.js";import"./react-vendor-CNOkPC89.js";import{c as e}from"./index-Dv5jtphl.js";function c({className:t,...r}){return a.jsx(s,{"data-slot":"switch",className:e("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...r,children:a.jsx(n,{"data-slot":"switch-thumb",className:e("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}export{c as S};
@@ -24,16 +24,16 @@
24
24
  href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap"
25
25
  rel="stylesheet"
26
26
  />
27
- <script type="module" crossorigin src="/assets/index-DGFnVfdv.js"></script>
27
+ <script type="module" crossorigin src="/assets/index-Dv5jtphl.js"></script>
28
28
  <link rel="modulepreload" crossorigin href="/assets/react-vendor-CNOkPC89.js">
29
29
  <link rel="modulepreload" crossorigin href="/assets/radix-ui-qEZD5MMp.js">
30
30
  <link rel="modulepreload" crossorigin href="/assets/tanstack-De4wvi8X.js">
31
31
  <link rel="modulepreload" crossorigin href="/assets/notifications-B2HqRBj7.js">
32
- <link rel="modulepreload" crossorigin href="/assets/icons-G0rMFC4M.js">
32
+ <link rel="modulepreload" crossorigin href="/assets/icons-DGASzt3M.js">
33
33
  <link rel="modulepreload" crossorigin href="/assets/utils-CzKF5WmX.js">
34
34
  <link rel="modulepreload" crossorigin href="/assets/form-utils-C-pVd1--.js">
35
35
  <link rel="modulepreload" crossorigin href="/assets/code-highlight-BRUf_pqB.js">
36
- <link rel="stylesheet" crossorigin href="/assets/index-Bqle3SG4.css">
36
+ <link rel="stylesheet" crossorigin href="/assets/index-C6u1zYVL.css">
37
37
  </head>
38
38
  <body>
39
39
  <div id="root"></div>
@@ -1 +1 @@
1
- {"version":3,"file":"cursor-routes.d.ts","sourceRoot":"","sources":["../../../src/web-server/routes/cursor-routes.ts"],"names":[],"mappings":"AAAA;;GAEG;AAkBH,QAAA,MAAM,MAAM,4CAAW,CAAC;AAExB,UAAU,4BAA4B;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,UAAU,4BAA4B;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,4BAA4B,GAClC,4BAA4B,GAAG,IAAI,CAuBrC;AAiJD,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"cursor-routes.d.ts","sourceRoot":"","sources":["../../../src/web-server/routes/cursor-routes.ts"],"names":[],"mappings":"AAAA;;GAEG;AAiBH,QAAA,MAAM,MAAM,4CAAW,CAAC;AAExB,UAAU,4BAA4B;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,UAAU,4BAA4B;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,4BAA4B,GAClC,4BAA4B,GAAG,IAAI,CAuBrC;AAiJD,eAAe,MAAM,CAAC"}
@@ -118,7 +118,7 @@ router.get('/models', async (_req, res) => {
118
118
  try {
119
119
  const cursorConfig = (0, unified_config_loader_1.getCursorConfig)();
120
120
  const models = await (0, cursor_1.getAvailableModels)(cursorConfig.port);
121
- res.json({ models, current: (0, cursor_1.getDefaultModel)() });
121
+ res.json({ models, current: cursorConfig.model });
122
122
  }
123
123
  catch (error) {
124
124
  res.status(500).json({ error: error.message });
@@ -1 +1 @@
1
- {"version":3,"file":"cursor-routes.js","sourceRoot":"","sources":["../../../src/web-server/routes/cursor-routes.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;AAGH,qCAAiC;AACjC,yCAUsB;AACtB,8EAAqE;AACrE,sFAA4D;AAE5D,MAAM,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;AAaxB,SAAgB,+BAA+B,CAC7C,KAAmC;IAEnC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAA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CAAC,CAAC;QAEH,IAAI,iBAAiB,EAAE,CAAC;YACtB,GAAG,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;gBACxC,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,iBAAiB,CAAC,KAAK;aAC/B,CAAC,CAAC;YACH,OAAO;QACT,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,IAAA,oBAAW,EAAC;YAC/B,IAAI,EAAE,YAAY,CAAC,IAAI;YACvB,UAAU,EAAE,YAAY,CAAC,UAAU;SACpC,CAAC,CAAC;QACH,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACnB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAG,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,EAAE,IAAa,EAAE,GAAa,EAAiB,EAAE;IAChF,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,IAAA,mBAAU,GAAE,CAAC;QAClC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACnB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAG,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,kBAAe,MAAM,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"cursor-settings-routes.d.ts","sourceRoot":"","sources":["../../../src/web-server/routes/cursor-settings-routes.ts"],"names":[],"mappings":"AAAA;;GAEG;AAcH,QAAA,MAAM,MAAM,4CAAW,CAAC;AA4LxB,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"cursor-settings-routes.d.ts","sourceRoot":"","sources":["../../../src/web-server/routes/cursor-settings-routes.ts"],"names":[],"mappings":"AAAA;;GAEG;AAgBH,QAAA,MAAM,MAAM,4CAAW,CAAC;AA4SxB,eAAe,MAAM,CAAC"}
@@ -28,6 +28,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  const express_1 = require("express");
30
30
  const fs = __importStar(require("fs"));
31
+ const fs_1 = require("fs");
31
32
  const path = __importStar(require("path"));
32
33
  const config_manager_1 = require("../../utils/config-manager");
33
34
  const unified_config_types_1 = require("../../config/unified-config-types");
@@ -55,8 +56,69 @@ function parseLocalCursorPort(settings) {
55
56
  return null;
56
57
  }
57
58
  }
59
+ function parseRequiredModel(value) {
60
+ if (typeof value !== 'string')
61
+ return null;
62
+ const trimmed = value.trim();
63
+ return trimmed.length > 0 ? trimmed : null;
64
+ }
65
+ function parseOptionalModel(value) {
66
+ if (typeof value !== 'string')
67
+ return undefined;
68
+ const trimmed = value.trim();
69
+ return trimmed.length > 0 ? trimmed : undefined;
70
+ }
71
+ function getDefaultCursorSettings(cursorConfig) {
72
+ const model = cursorConfig.model || unified_config_types_1.DEFAULT_CURSOR_CONFIG.model;
73
+ return {
74
+ env: {
75
+ ANTHROPIC_BASE_URL: `http://127.0.0.1:${cursorConfig.port}`,
76
+ ANTHROPIC_AUTH_TOKEN: 'cursor-managed',
77
+ ANTHROPIC_MODEL: model,
78
+ ANTHROPIC_DEFAULT_OPUS_MODEL: cursorConfig.opus_model || model,
79
+ ANTHROPIC_DEFAULT_SONNET_MODEL: cursorConfig.sonnet_model || model,
80
+ ANTHROPIC_DEFAULT_HAIKU_MODEL: cursorConfig.haiku_model || model,
81
+ },
82
+ };
83
+ }
84
+ async function syncRawSettingsFromCursorConfig(cursorConfig) {
85
+ const settingsPath = path.join((0, config_manager_1.getCcsDir)(), 'cursor.settings.json');
86
+ let settings = {};
87
+ try {
88
+ const parsed = JSON.parse(await fs_1.promises.readFile(settingsPath, 'utf-8'));
89
+ if (typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed)) {
90
+ settings = parsed;
91
+ }
92
+ }
93
+ catch {
94
+ settings = {};
95
+ }
96
+ const envSource = settings.env;
97
+ const env = typeof envSource === 'object' && envSource !== null && !Array.isArray(envSource)
98
+ ? { ...envSource }
99
+ : {};
100
+ const model = cursorConfig.model || unified_config_types_1.DEFAULT_CURSOR_CONFIG.model;
101
+ const localPort = parseLocalCursorPort({ env });
102
+ if (!env.ANTHROPIC_BASE_URL || localPort !== null) {
103
+ env.ANTHROPIC_BASE_URL = `http://127.0.0.1:${cursorConfig.port}`;
104
+ }
105
+ if (!env.ANTHROPIC_AUTH_TOKEN) {
106
+ env.ANTHROPIC_AUTH_TOKEN = 'cursor-managed';
107
+ }
108
+ env.ANTHROPIC_MODEL = model;
109
+ env.ANTHROPIC_DEFAULT_OPUS_MODEL = cursorConfig.opus_model || model;
110
+ env.ANTHROPIC_DEFAULT_SONNET_MODEL = cursorConfig.sonnet_model || model;
111
+ env.ANTHROPIC_DEFAULT_HAIKU_MODEL = cursorConfig.haiku_model || model;
112
+ const nextSettings = {
113
+ ...settings,
114
+ env,
115
+ };
116
+ const tempPath = settingsPath + '.tmp';
117
+ await fs_1.promises.writeFile(tempPath, JSON.stringify(nextSettings, null, 2) + '\n');
118
+ await fs_1.promises.rename(tempPath, settingsPath);
119
+ }
58
120
  /**
59
- * GET /api/cursor/settings - Get cursor config (port, auto_start, ghost_mode)
121
+ * GET /api/cursor/settings - Get cursor config
60
122
  */
61
123
  router.get('/', (_req, res) => {
62
124
  try {
@@ -70,7 +132,7 @@ router.get('/', (_req, res) => {
70
132
  /**
71
133
  * PUT /api/cursor/settings - Update cursor config
72
134
  */
73
- router.put('/', (req, res) => {
135
+ router.put('/', async (req, res) => {
74
136
  try {
75
137
  const updates = req.body;
76
138
  // Reject non-object bodies
@@ -101,7 +163,33 @@ router.put('/', (req, res) => {
101
163
  res.status(400).json({ error: 'ghost_mode must be a boolean' });
102
164
  return;
103
165
  }
166
+ if ('model' in updates && !parseRequiredModel(updates.model)) {
167
+ res.status(400).json({ error: 'model must be a non-empty string' });
168
+ return;
169
+ }
170
+ if ('opus_model' in updates &&
171
+ updates.opus_model !== undefined &&
172
+ updates.opus_model !== null &&
173
+ typeof updates.opus_model !== 'string') {
174
+ res.status(400).json({ error: 'opus_model must be a string' });
175
+ return;
176
+ }
177
+ if ('sonnet_model' in updates &&
178
+ updates.sonnet_model !== undefined &&
179
+ updates.sonnet_model !== null &&
180
+ typeof updates.sonnet_model !== 'string') {
181
+ res.status(400).json({ error: 'sonnet_model must be a string' });
182
+ return;
183
+ }
184
+ if ('haiku_model' in updates &&
185
+ updates.haiku_model !== undefined &&
186
+ updates.haiku_model !== null &&
187
+ typeof updates.haiku_model !== 'string') {
188
+ res.status(400).json({ error: 'haiku_model must be a string' });
189
+ return;
190
+ }
104
191
  const config = (0, unified_config_loader_1.loadOrCreateUnifiedConfig)();
192
+ const normalizedModel = parseRequiredModel(updates.model);
105
193
  // Merge updates with existing config
106
194
  // Only known fields are merged — unknown properties are ignored
107
195
  config.cursor = {
@@ -109,8 +197,19 @@ router.put('/', (req, res) => {
109
197
  port: updates.port ?? config.cursor?.port ?? unified_config_types_1.DEFAULT_CURSOR_CONFIG.port,
110
198
  auto_start: updates.auto_start ?? config.cursor?.auto_start ?? unified_config_types_1.DEFAULT_CURSOR_CONFIG.auto_start,
111
199
  ghost_mode: updates.ghost_mode ?? config.cursor?.ghost_mode ?? unified_config_types_1.DEFAULT_CURSOR_CONFIG.ghost_mode,
200
+ model: normalizedModel ?? config.cursor?.model ?? unified_config_types_1.DEFAULT_CURSOR_CONFIG.model,
201
+ opus_model: 'opus_model' in updates
202
+ ? parseOptionalModel(updates.opus_model)
203
+ : config.cursor?.opus_model,
204
+ sonnet_model: 'sonnet_model' in updates
205
+ ? parseOptionalModel(updates.sonnet_model)
206
+ : config.cursor?.sonnet_model,
207
+ haiku_model: 'haiku_model' in updates
208
+ ? parseOptionalModel(updates.haiku_model)
209
+ : config.cursor?.haiku_model,
112
210
  };
113
211
  (0, unified_config_loader_1.saveUnifiedConfig)(config);
212
+ await syncRawSettingsFromCursorConfig(config.cursor);
114
213
  res.json({ success: true, cursor: config.cursor });
115
214
  }
116
215
  catch (error) {
@@ -127,14 +226,7 @@ router.get('/raw', (_req, res) => {
127
226
  const cursorConfig = (0, unified_config_loader_1.getCursorConfig)();
128
227
  // If file doesn't exist, return default structure
129
228
  if (!fs.existsSync(settingsPath)) {
130
- // Create settings structure matching Cursor pattern
131
- // Use 127.0.0.1 instead of localhost for more reliable local connections
132
- const defaultSettings = {
133
- env: {
134
- ANTHROPIC_BASE_URL: `http://127.0.0.1:${cursorConfig.port}`,
135
- ANTHROPIC_AUTH_TOKEN: 'cursor-managed',
136
- },
137
- };
229
+ const defaultSettings = getDefaultCursorSettings(cursorConfig);
138
230
  res.json({
139
231
  settings: defaultSettings,
140
232
  mtime: Date.now(),
@@ -190,14 +282,18 @@ router.put('/raw', (req, res) => {
190
282
  fs.renameSync(tempPath, settingsPath);
191
283
  // Keep unified config aligned with raw settings edits (parity with Copilot raw editor).
192
284
  const parsedPort = parseLocalCursorPort(settings);
193
- if (parsedPort) {
194
- const config = (0, unified_config_loader_1.loadOrCreateUnifiedConfig)();
195
- config.cursor = {
196
- ...(config.cursor ?? unified_config_types_1.DEFAULT_CURSOR_CONFIG),
197
- port: parsedPort,
198
- };
199
- (0, unified_config_loader_1.saveUnifiedConfig)(config);
200
- }
285
+ const config = (0, unified_config_loader_1.loadOrCreateUnifiedConfig)();
286
+ const env = settings.env ?? {};
287
+ const model = parseRequiredModel(env.ANTHROPIC_MODEL) ?? config.cursor?.model;
288
+ config.cursor = {
289
+ ...(config.cursor ?? unified_config_types_1.DEFAULT_CURSOR_CONFIG),
290
+ ...(parsedPort !== null ? { port: parsedPort } : {}),
291
+ ...(model ? { model } : {}),
292
+ opus_model: parseOptionalModel(env.ANTHROPIC_DEFAULT_OPUS_MODEL),
293
+ sonnet_model: parseOptionalModel(env.ANTHROPIC_DEFAULT_SONNET_MODEL),
294
+ haiku_model: parseOptionalModel(env.ANTHROPIC_DEFAULT_HAIKU_MODEL),
295
+ };
296
+ (0, unified_config_loader_1.saveUnifiedConfig)(config);
201
297
  const stat = fs.statSync(settingsPath);
202
298
  res.json({ success: true, mtime: stat.mtimeMs });
203
299
  }
@@ -1 +1 @@
1
- {"version":3,"file":"cursor-settings-routes.js","sourceRoot":"","sources":["../../../src/web-server/routes/cursor-settings-routes.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,qCAAiC;AACjC,uCAAyB;AACzB,2CAA6B;AAC7B,+DAAuD;AACvD,4EAA0E;AAC1E,8EAI4C;AAE5C,MAAM,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;AAExB,SAAS,oBAAoB,CAAC,QAAiB;IAC7C,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACnE,MAAM,GAAG,GAAI,QAA8B,CAAC,GAAG,CAAC;IAChD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACzD,MAAM,OAAO,GAAI,GAAwC,CAAC,kBAAkB,CAAC;IAC7E,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAEzD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;QAChC,IAAI,MAAM,CAAC,QAAQ,KAAK,WAAW,IAAI,MAAM,CAAC,QAAQ,KAAK,WAAW;YAAE,OAAO,IAAI,CAAC;QACpF,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,CAAC,MAAM,CAAC,SAAS,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,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAG,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,kBAAe,MAAM,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaitranntt/ccs",
3
- "version": "7.44.0",
3
+ "version": "7.45.0",
4
4
  "description": "Claude Code Switch - Instant profile switching between Claude Sonnet 4.5 and GLM 4.6",
5
5
  "keywords": [
6
6
  "cli",
@@ -1 +0,0 @@
1
- import{j as e}from"./radix-ui-qEZD5MMp.js";import{r as p}from"./react-vendor-CNOkPC89.js";import{u as D,a as b,b as N,d as A,f as y,g as T}from"./tanstack-De4wvi8X.js";import{c as m,ae as f,b as d,a4 as k,a5 as z,a6 as R,a7 as S,a8 as P,L as C,I as q}from"./index-DGFnVfdv.js";import{A as F,a as _,b as K,c as L,d as M,e as E,f as H,g as Q}from"./alert-dialog-z6HEaPqe.js";import{t as u}from"./notifications-B2HqRBj7.js";import{w as $,k as j,ah as O,z as I,m as v,a0 as B}from"./icons-G0rMFC4M.js";import"./utils-CzKF5WmX.js";import"./form-utils-C-pVd1--.js";import"./code-highlight-BRUf_pqB.js";function U({className:t,...s}){return e.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:e.jsx("table",{"data-slot":"table",className:m("w-full caption-bottom text-sm",t),...s})})}function V({className:t,...s}){return e.jsx("thead",{"data-slot":"table-header",className:m("[&_tr]:border-b",t),...s})}function Z({className:t,...s}){return e.jsx("tbody",{"data-slot":"table-body",className:m("[&_tr:last-child]:border-0",t),...s})}function w({className:t,...s}){return e.jsx("tr",{"data-slot":"table-row",className:m("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",t),...s})}function G({className:t,...s}){return e.jsx("th",{"data-slot":"table-head",className:m("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...s})}function J({className:t,...s}){return e.jsx("td",{"data-slot":"table-cell",className:m("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...s})}function W(){return D({queryKey:["accounts"],queryFn:()=>f.accounts.list()})}function X(){const t=b();return N({mutationFn:s=>f.accounts.setDefault(s),onSuccess:(s,l)=>{t.invalidateQueries({queryKey:["accounts"]}),u.success(`Default account set to "${l}"`)},onError:s=>{u.error(s.message)}})}function Y(){const t=b();return N({mutationFn:()=>f.accounts.resetDefault(),onSuccess:()=>{t.invalidateQueries({queryKey:["accounts"]}),u.success("Default account reset to CCS")},onError:s=>{u.error(s.message)}})}function ee(){const t=b();return N({mutationFn:s=>f.accounts.delete(s),onSuccess:(s,l)=>{t.invalidateQueries({queryKey:["accounts"]}),u.success(`Account "${l}" deleted`)},onError:s=>{u.error(s.message)}})}function se({data:t,defaultAccount:s}){const l=X(),i=ee(),r=Y(),[c,o]=p.useState(null),x=A({data:t,columns:[{accessorKey:"name",header:"Name",size:200,cell:({row:a})=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:a.original.name}),a.original.name===s&&e.jsx("span",{className:"text-xs bg-primary/10 text-primary px-1.5 py-0.5 rounded border border-primary/20",children:"default"})]})},{accessorKey:"type",header:"Type",size:100,cell:({row:a})=>e.jsx("span",{className:"capitalize text-muted-foreground",children:a.original.type||"oauth"})},{accessorKey:"created",header:"Created",size:150,cell:({row:a})=>{const n=new Date(a.original.created);return e.jsx("span",{className:"text-muted-foreground",children:n.toLocaleDateString()})}},{accessorKey:"last_used",header:"Last Used",size:150,cell:({row:a})=>{if(!a.original.last_used)return e.jsx("span",{className:"text-muted-foreground/50",children:"-"});const n=new Date(a.original.last_used);return e.jsx("span",{className:"text-muted-foreground",children:n.toLocaleDateString()})}},{id:"actions",header:"Actions",size:180,cell:({row:a})=>{const n=a.original.name===s,h=l.isPending||i.isPending;return e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs(d,{variant:n?"secondary":"default",size:"sm",className:"h-8 px-2",disabled:n||h,onClick:()=>l.mutate(a.original.name),children:[e.jsx(j,{className:`w-3 h-3 mr-1 ${n?"opacity-50":""}`}),n?"Active":"Set Default"]}),e.jsx(d,{variant:"ghost",size:"sm",className:"h-8 px-2 text-destructive hover:text-destructive hover:bg-destructive/10",disabled:n||h,onClick:()=>o(a.original.name),title:n?"Cannot delete default account":"Delete account",children:e.jsx(O,{className:"w-4 h-4"})})]})}}],getCoreRowModel:T()});return t.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:["No accounts found. Use"," ",e.jsx("code",{className:"text-sm bg-muted px-1 rounded",children:"ccs auth create"})," to add accounts."]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"border rounded-md",children:e.jsxs(U,{children:[e.jsx(V,{children:x.getHeaderGroups().map(a=>e.jsx(w,{children:a.headers.map(n=>{const h={name:"w-[200px]",type:"w-[100px]",created:"w-[150px]",last_used:"w-[150px]",actions:"w-[180px]"}[n.id]||"w-auto";return e.jsx(G,{className:h,children:n.isPlaceholder?null:y(n.column.columnDef.header,n.getContext())},n.id)})},a.id))}),e.jsx(Z,{children:x.getRowModel().rows.map(a=>e.jsx(w,{children:a.getVisibleCells().map(n=>e.jsx(J,{children:y(n.column.columnDef.cell,n.getContext())},n.id))},a.id))})]})}),s&&e.jsx("div",{className:"flex justify-end",children:e.jsxs(d,{variant:"outline",size:"sm",onClick:()=>r.mutate(),disabled:r.isPending,children:[e.jsx($,{className:"w-4 h-4 mr-2"}),"Reset to CCS Default"]})})]}),e.jsx(F,{open:!!c,onOpenChange:a=>!a&&o(null),children:e.jsxs(_,{children:[e.jsxs(K,{children:[e.jsx(L,{children:"Delete Account"}),e.jsxs(M,{children:['Are you sure you want to delete the account "',c,'"? This will remove the profile and all its session data. This action cannot be undone.']})]}),e.jsxs(E,{children:[e.jsx(H,{children:"Cancel"}),e.jsx(Q,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{c&&(i.mutate(c),o(null))},children:"Delete"})]})]})})]})}function te({open:t,onClose:s}){const[l,i]=p.useState(""),[r,c]=p.useState(!1),o=/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(l),g=l?`ccs auth create ${l}`:"ccs auth create <name>",x=async()=>{o&&(await navigator.clipboard.writeText(g),c(!0),setTimeout(()=>c(!1),2e3))},a=()=>{i(""),c(!1),s()};return e.jsx(k,{open:t,onOpenChange:n=>!n&&a(),children:e.jsxs(z,{className:"sm:max-w-md",children:[e.jsxs(R,{children:[e.jsx(S,{children:"Create New Account"}),e.jsx(P,{children:"Auth profiles require Claude CLI login. Run the command below in your terminal."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"profile-name",children:"Profile Name"}),e.jsx(q,{id:"profile-name",value:l,onChange:n=>i(n.target.value),placeholder:"e.g., work, personal, client",autoComplete:"off"}),l&&!o&&e.jsx("p",{className:"text-xs text-destructive",children:"Name must start with a letter and contain only letters, numbers, dashes, or underscores."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:"Command"}),e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-md font-mono text-sm",children:[e.jsx(I,{className:"w-4 h-4 text-muted-foreground shrink-0"}),e.jsx("code",{className:"flex-1 break-all",children:g}),e.jsx(d,{variant:"ghost",size:"sm",className:"shrink-0 h-8 px-2",onClick:x,disabled:!o,children:r?e.jsx(j,{className:"w-4 h-4 text-green-500"}):e.jsx(v,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[e.jsx("p",{children:"After running the command:"}),e.jsxs("ol",{className:"list-decimal list-inside pl-2 space-y-0.5",children:[e.jsx("li",{children:"Complete the Claude login in your browser"}),e.jsx("li",{children:"Return here and refresh to see the new account"})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(d,{variant:"ghost",onClick:a,children:"Close"}),e.jsx(d,{onClick:x,disabled:!o,children:r?e.jsxs(e.Fragment,{children:[e.jsx(j,{className:"w-4 h-4 mr-2"}),"Copied!"]}):e.jsxs(e.Fragment,{children:[e.jsx(v,{className:"w-4 h-4 mr-2"}),"Copy Command"]})})]})]})]})})}function xe(){const{data:t,isLoading:s,refetch:l}=W(),[i,r]=p.useState(!1);return e.jsxs("div",{className:"p-6 max-w-6xl mx-auto space-y-8",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Accounts"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Manage multi-account Claude sessions (profiles.json)"})]}),e.jsxs(d,{onClick:()=>r(!0),children:[e.jsx(B,{className:"w-4 h-4 mr-2"}),"Create Account"]})]}),s?e.jsx("div",{className:"text-muted-foreground",children:"Loading accounts..."}):e.jsx(se,{data:t?.accounts||[],defaultAccount:t?.default??null,onRefresh:l}),e.jsx(te,{open:i,onClose:()=>r(!1)})]})}export{xe as AccountsPage};
@@ -1 +0,0 @@
1
- import{j as e}from"./radix-ui-qEZD5MMp.js";import{r as c}from"./react-vendor-CNOkPC89.js";import{B as S,c as E,T as Ne,o as ve,p as be,b as g,I as y,m as I,L as T,q as M,r as ne,s as we,t as Ce,v as ye,w as Oe,S as W,x as L,y as $,z as re,A as Ae,D as Ee,E as ie,F as le,G as ce,H as Te,J as _e,K as X,M as Z,R as ke,N as q,C as Se,i as Re,j as Pe,O as Le,a as Me,Q as De,U as Ie,V as Ue,W as He}from"./index-DGFnVfdv.js";import{a as Fe,u as Ke,b as ze}from"./tanstack-De4wvi8X.js";import{C as B,S as ee}from"./confirm-dialog-D8vB20zr.js";import{t as Q}from"./notifications-B2HqRBj7.js";import{R as U,ah as oe,L as G,ai as Je,E as $e,d as Be,a0 as D,I as Qe,aj as de,a1 as V,b as xe,ak as qe,$ as Ge,al as Ve,n as me,X as Ye,Z as ue,am as We,a5 as Xe,a2 as he,an as Ze,r as fe}from"./icons-G0rMFC4M.js";import"./utils-CzKF5WmX.js";import"./form-utils-C-pVd1--.js";import"./code-highlight-BRUf_pqB.js";import"./alert-dialog-z6HEaPqe.js";function es({className:s,showTooltip:t=!0}){const i=e.jsxs(S,{variant:"outline",className:E("bg-accent/10 border-accent/30 text-accent","dark:bg-accent/20 dark:border-accent/40 dark:text-accent-foreground",s),children:[e.jsx("img",{src:"/icons/openrouter.svg",alt:"OpenRouter",className:"mr-1 h-3 w-3"}),"OpenRouter"]});return t?e.jsxs(Ne,{children:[e.jsx(ve,{asChild:!0,children:i}),e.jsx(be,{children:e.jsx("p",{children:"Access 349+ models via OpenRouter"})})]}):i}function se(s){return[/^ANTHROPIC_AUTH_TOKEN$/,/_API_KEY$/,/_AUTH_TOKEN$/,/^API_KEY$/,/^AUTH_TOKEN$/,/_SECRET$/,/^SECRET$/].some(i=>i.test(s))}function pe(s){return s?.env?(s.env.ANTHROPIC_BASE_URL||"").toLowerCase().includes("openrouter.ai"):!1}function ss(s){return{opus:s.ANTHROPIC_DEFAULT_OPUS_MODEL||void 0,sonnet:s.ANTHROPIC_DEFAULT_SONNET_MODEL||void 0,haiku:s.ANTHROPIC_DEFAULT_HAIKU_MODEL||void 0}}function ts(s,t){const i={...s};return t.opus?i.ANTHROPIC_DEFAULT_OPUS_MODEL=t.opus:delete i.ANTHROPIC_DEFAULT_OPUS_MODEL,t.sonnet?i.ANTHROPIC_DEFAULT_SONNET_MODEL=t.sonnet:delete i.ANTHROPIC_DEFAULT_SONNET_MODEL,t.haiku?i.ANTHROPIC_DEFAULT_HAIKU_MODEL=t.haiku:delete i.ANTHROPIC_DEFAULT_HAIKU_MODEL,i}function as({profileName:s,data:t,settings:i,isLoading:l,isSaving:d,hasChanges:f,isRawJsonValid:x,onRefresh:n,onDelete:o,onSave:m}){return e.jsxs("div",{className:"px-6 py-4 border-b bg-background flex items-center justify-between shrink-0",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold",children:s}),t?.path&&e.jsx(S,{variant:"outline",className:"text-xs",children:t.path.replace(/^.*\//,"")}),pe(i)&&e.jsx(es,{className:"ml-1"})]}),t&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["Last modified: ",new Date(t.mtime).toLocaleString()]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(g,{variant:"ghost",size:"sm",onClick:n,disabled:l,children:e.jsx(U,{className:`w-4 h-4 ${l?"animate-spin":""}`})}),o&&e.jsx(g,{variant:"ghost",size:"sm",onClick:o,children:e.jsx(oe,{className:"w-4 h-4 text-destructive"})}),e.jsx(g,{size:"sm",onClick:m,disabled:d||!f||!x,children:d?e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"w-4 h-4 mr-1 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Je,{className:"w-4 h-4 mr-1"}),"Save"]})})]})]})}function ge({label:s,...t}){const[i,l]=c.useState(!1);return e.jsxs("div",{className:"space-y-1",children:[s&&e.jsx("label",{className:"text-sm font-medium",children:s}),e.jsxs("div",{className:"relative",children:[e.jsx(y,{type:i?"text":"password",className:"pr-10 font-mono",...t}),e.jsx(g,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3",onClick:()=>l(!i),tabIndex:-1,children:i?e.jsx($e,{className:"w-4 h-4"}):e.jsx(Be,{className:"w-4 h-4"})})]})]})}function ns({currentSettings:s,newEnvKey:t,newEnvValue:i,onNewEnvKeyChange:l,onNewEnvValueChange:d,onEnvValueChange:f,onAddEnvVar:x}){return e.jsxs(e.Fragment,{children:[e.jsx(I,{className:"flex-1",children:e.jsx("div",{className:"p-4 space-y-4",children:s?.env&&Object.keys(s.env).length>0?e.jsx(e.Fragment,{children:Object.entries(s.env).map(([n,o])=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(T,{className:"text-xs font-medium flex items-center gap-2 text-muted-foreground",children:[n,se(n)&&e.jsx(S,{variant:"secondary",className:"text-[10px] px-1 py-0 h-4",children:"sensitive"})]}),se(n)?e.jsx(ge,{value:o,onChange:m=>f(n,m.target.value),className:"font-mono text-sm h-8"}):e.jsx(y,{value:o,onChange:m=>f(n,m.target.value),className:"font-mono text-sm h-8"})]},n))}):e.jsxs("div",{className:"py-8 text-center text-muted-foreground bg-muted/30 rounded-lg border border-dashed text-sm",children:[e.jsx("p",{children:"No environment variables configured."}),e.jsx("p",{className:"text-xs mt-1 opacity-70",children:"Add variables using the input below or edit the JSON directly."})]})})}),e.jsxs("div",{className:"p-4 border-t bg-background shrink-0",children:[e.jsx(T,{className:"text-xs font-medium text-muted-foreground",children:"Add Environment Variable"}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(y,{placeholder:"VARIABLE_NAME",value:t,onChange:n=>l(n.target.value.toUpperCase()),className:"font-mono text-sm h-8 w-2/5",onKeyDown:n=>n.key==="Enter"&&t.trim()&&x()}),e.jsx(y,{placeholder:"value",value:i,onChange:n=>d(n.target.value),className:"font-mono text-sm h-8 flex-1",onKeyDown:n=>n.key==="Enter"&&t.trim()&&x()}),e.jsx(g,{variant:"outline",size:"sm",className:"h-8",onClick:x,disabled:!t.trim(),children:e.jsx(D,{className:"w-4 h-4"})})]})]})]})}function rs({profileName:s,data:t}){return e.jsx(I,{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"}),"Profile Information"]}),e.jsx("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children: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:"Profile Name"}),e.jsx("span",{className:"font-mono",children:t.profile})]}),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(M,{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:"Last Modified"}),e.jsx("span",{className:"text-xs",children:new Date(t.mtime).toLocaleString()})]})]})})]}),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.jsxs("div",{children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"Run with profile"}),e.jsxs("div",{className:"mt-1 flex gap-2",children:[e.jsxs("code",{className:"flex-1 px-2 py-1.5 bg-muted rounded text-xs font-mono truncate",children:["ccs ",s,' "prompt"']}),e.jsx(M,{value:`ccs ${s} "prompt"`,size:"icon",className:"h-6 w-6"})]})]}),e.jsxs("div",{children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:"Set as default"}),e.jsxs("div",{className:"mt-1 flex gap-2",children:[e.jsxs("code",{className:"flex-1 px-2 py-1.5 bg-muted rounded text-xs font-mono truncate",children:["ccs default ",s]}),e.jsx(M,{value:`ccs default ${s}`,size:"icon",className:"h-6 w-6"})]})]})]})]})]})})}function is({value:s,onChange:t,placeholder:i="Search models...",className:l}){const[d,f]=c.useState(""),[x,n]=c.useState(null),{models:o,isLoading:m,isError:j,isFetching:O}=ne(),A=we(),N=c.useMemo(()=>Ce(o,d,{category:x??void 0}),[o,d,x]),b=c.useMemo(()=>ye(o,2),[o]),k=!d.trim()&&!x,_=c.useMemo(()=>{const r={anthropic:[],openai:[],google:[],meta:[],mistral:[],opensource:[],other:[]};N.forEach(a=>{r[a.category].push(a)});for(const a of Object.keys(r))r[a]=Oe(r[a]);return r},[N]),C=c.useCallback(()=>{A()},[A]),p=o.find(r=>r.id===s);return m&&o.length===0?e.jsxs("div",{className:E("space-y-2",l),children:[e.jsx(W,{className:"h-10 w-full"}),e.jsx(W,{className:"h-32 w-full"})]}):e.jsxs("div",{className:E("space-y-2 w-full min-w-0 overflow-hidden",l),children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(de,{className:"text-muted-foreground absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2"}),e.jsx(y,{value:d,onChange:r=>f(r.target.value),placeholder:i,className:"pl-9"})]}),e.jsx(g,{variant:"outline",size:"icon",onClick:C,disabled:O,title:"Refresh models",children:O?e.jsx(G,{className:"h-4 w-4 animate-spin"}):e.jsx(U,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.jsxs(S,{variant:x===null?"default":"outline",className:"cursor-pointer",onClick:()=>n(null),children:["All (",o.length,")"]}),Object.keys(L).map(r=>{const a=_[r].length;return a===0?null:e.jsxs(S,{variant:x===r?"default":"outline",className:"cursor-pointer",onClick:()=>n(r),children:[L[r]," (",a,")"]},r)})]}),p&&e.jsxs("div",{className:"bg-muted rounded-md p-2 text-sm",children:[e.jsx("span",{className:"font-medium",children:p.name}),e.jsxs("span",{className:"text-muted-foreground ml-2",children:[$(p.pricing)," |"," ",re(p.context_length)]})]}),e.jsx(I,{className:"h-72 w-full rounded-md border",children:j?e.jsxs("div",{className:"text-destructive p-4 text-center",children:["Failed to load models."," ",e.jsx(g,{variant:"link",onClick:C,children:"Retry"})]}):N.length===0?e.jsxs("div",{className:"text-muted-foreground p-4 text-center",children:['No models found matching "',d,'"']}):e.jsxs("div",{className:"space-y-6 p-3",children:[k&&b.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"text-muted-foreground bg-background sticky top-0 mb-2 flex items-center gap-1.5 py-1.5 text-xs font-semibold border-b pb-2",children:[e.jsx(V,{className:"h-3 w-3 text-accent"}),e.jsx("span",{children:"Newest Models"})]}),e.jsx("div",{className:"space-y-1",children:b.map(r=>e.jsx(te,{model:r,isSelected:r.id===s,onClick:()=>t(r.id),showAge:!0},r.id))})]}),Object.keys(L).map(r=>{const a=_[r];return a.length===0?null:e.jsxs("div",{children:[e.jsx("div",{className:"text-muted-foreground bg-background sticky top-0 mb-2 py-1.5 text-xs font-semibold border-b pb-2",children:L[r]}),e.jsx("div",{className:"space-y-1",children:a.map(v=>e.jsx(te,{model:v,isSelected:v.id===s,onClick:()=>t(v.id)},v.id))})]},r)})]})})]})}function te({model:s,isSelected:t,onClick:i,showAge:l=!1}){return e.jsxs("button",{type:"button",onClick:i,className:E("group flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm transition-colors","hover:bg-accent hover:text-accent-foreground",t&&"bg-accent text-accent-foreground"),children:[e.jsx("span",{className:"flex-1 min-w-0 truncate font-medium",children:s.name}),e.jsxs("span",{className:E("flex shrink-0 items-center gap-1 text-xs whitespace-nowrap",t?"text-accent-foreground/80":"text-muted-foreground group-hover:text-accent-foreground/80"),children:[l&&s.created&&e.jsx(S,{variant:"outline",className:E("text-[10px] px-1",t?"border-accent-foreground/30 text-accent-foreground/80":"text-accent border-accent/30 group-hover:text-accent-foreground/80 group-hover:border-accent-foreground/30"),children:Ae(s.created)}),s.isFree?e.jsx(S,{variant:"secondary",className:E("text-[10px] px-1",t?"bg-accent-foreground/20 text-accent-foreground":"group-hover:bg-accent-foreground/20 group-hover:text-accent-foreground"),children:"Free"}):s.isExacto?e.jsxs(e.Fragment,{children:[e.jsx(S,{variant:"outline",className:E("text-[10px] px-1 border-emerald-500/50 text-emerald-600",t?"border-accent-foreground/30 text-accent-foreground/80":"group-hover:border-accent-foreground/30 group-hover:text-accent-foreground/80"),children:"Exacto"}),e.jsx("span",{className:"tabular-nums",children:$(s.pricing)})]}):e.jsx("span",{className:"tabular-nums",children:$(s.pricing)}),e.jsx("span",{className:"tabular-nums",children:re(s.context_length)})]})]})}function ls({selectedModel:s,value:t,onChange:i,className:l}){const{models:d}=ne(),f=c.useMemo(()=>s?Ee(s,d):{},[s,d]),x=()=>{i(f)},n=(m,j)=>{i({...t,[m]:j||void 0})},o=s&&Object.keys(f).length>0;return e.jsxs(ie,{className:E("group",l),children:[e.jsxs(le,{className:"flex items-center gap-2 text-sm font-medium hover:underline",children:[e.jsx(xe,{className:"h-4 w-4 transition-transform group-data-[state=open]:rotate-90"}),"Model Tier Mapping",e.jsx("span",{className:"text-muted-foreground font-normal",children:"(Advanced)"})]}),e.jsxs(ce,{className:"space-y-3 pt-3",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Configure different models for Claude Code's opus/sonnet/haiku tiers."}),o&&e.jsxs(g,{type:"button",variant:"outline",size:"sm",onClick:x,children:[e.jsx(qe,{className:"mr-1 h-4 w-4"}),"Auto-suggest based on ",s?.split("/")[0]]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"grid grid-cols-[80px_1fr] items-center gap-2",children:[e.jsx(T,{htmlFor:"tier-opus",className:"text-right",children:"Opus"}),e.jsx(y,{id:"tier-opus",value:t.opus??"",onChange:m=>n("opus",m.target.value),placeholder:"e.g., anthropic/claude-opus-4"})]}),e.jsxs("div",{className:"grid grid-cols-[80px_1fr] items-center gap-2",children:[e.jsx(T,{htmlFor:"tier-sonnet",className:"text-right",children:"Sonnet"}),e.jsx(y,{id:"tier-sonnet",value:t.sonnet??"",onChange:m=>n("sonnet",m.target.value),placeholder:"e.g., anthropic/claude-sonnet-4"})]}),e.jsxs("div",{className:"grid grid-cols-[80px_1fr] items-center gap-2",children:[e.jsx(T,{htmlFor:"tier-haiku",className:"text-right",children:"Haiku"}),e.jsx(y,{id:"tier-haiku",value:t.haiku??"",onChange:m=>n("haiku",m.target.value),placeholder:"e.g., anthropic/claude-3.5-haiku"})]})]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"These set ANTHROPIC_DEFAULT_OPUS_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL, ANTHROPIC_DEFAULT_HAIKU_MODEL."})]})]})}function cs({profileName:s,data:t,currentSettings:i,newEnvKey:l,newEnvValue:d,onNewEnvKeyChange:f,onNewEnvValueChange:x,onEnvValueChange:n,onAddEnvVar:o,onEnvBulkChange:m}){const j=pe(i),O=i?.env,A=c.useMemo(()=>ss(O??{}),[O]),N=O??{},b=a=>{if(m){const v={...N,ANTHROPIC_MODEL:a,ANTHROPIC_DEFAULT_OPUS_MODEL:a,ANTHROPIC_DEFAULT_SONNET_MODEL:a,ANTHROPIC_DEFAULT_HAIKU_MODEL:a};m(v)}else n("ANTHROPIC_MODEL",a),n("ANTHROPIC_DEFAULT_OPUS_MODEL",a),n("ANTHROPIC_DEFAULT_SONNET_MODEL",a),n("ANTHROPIC_DEFAULT_HAIKU_MODEL",a);Q.success("Applied model to all tiers",{duration:2e3})},k=a=>{if(m){const v=ts(N,a);m(v)}else a.opus!==void 0&&n("ANTHROPIC_DEFAULT_OPUS_MODEL",a.opus||""),a.sonnet!==void 0&&n("ANTHROPIC_DEFAULT_SONNET_MODEL",a.sonnet||""),a.haiku!==void 0&&n("ANTHROPIC_DEFAULT_HAIKU_MODEL",a.haiku||"")},[_,C]=c.useState(!1),p=new Set(["ANTHROPIC_AUTH_TOKEN"]),r=Object.entries(N).filter(([a])=>!p.has(a));return e.jsx("div",{className:"h-full w-full min-w-0 flex flex-col",children:e.jsxs(Te,{defaultValue:"env",className:"h-full w-full min-w-0 flex flex-col",children:[e.jsx("div",{className:"px-4 pt-4 shrink-0",children:e.jsxs(_e,{className:"w-full",children:[e.jsx(X,{value:"env",className:"flex-1",children:j?"Configuration":"Environment Variables"}),e.jsx(X,{value:"info",className:"flex-1",children:"Info & Usage"})]})}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col min-w-0",children:[e.jsx(Z,{value:"env",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden min-w-0",children:j?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsxs("div",{className:"h-full overflow-y-auto overflow-x-hidden p-4 space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(T,{className:"text-sm font-medium",children:"Model Selection"}),e.jsx(is,{value:N.ANTHROPIC_MODEL,onChange:b,placeholder:"Search OpenRouter models..."})]}),e.jsx(ls,{selectedModel:N.ANTHROPIC_MODEL,value:A,onChange:k}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{className:"text-sm font-medium",children:"API Key"}),e.jsx(ge,{value:N.ANTHROPIC_AUTH_TOKEN||"",onChange:a=>n("ANTHROPIC_AUTH_TOKEN",a.target.value),placeholder:"sk-or-v1-...",className:"font-mono text-sm"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your API key from"," ",e.jsx("a",{href:"https://openrouter.ai/keys",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"openrouter.ai/keys"})]})]}),r.length>0&&e.jsxs(ie,{open:_,onOpenChange:C,children:[e.jsxs(le,{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors group",children:[e.jsx(xe,{className:E("h-4 w-4 transition-transform",_&&"rotate-90")}),e.jsx(Ge,{className:"h-4 w-4"}),e.jsx("span",{children:"Additional Variables"}),e.jsxs("span",{className:"text-xs font-normal opacity-70",children:["(",r.length,")"]})]}),e.jsx(ce,{className:"pt-4",children:e.jsx("div",{className:"space-y-3 border rounded-lg p-3 bg-muted/30",children:r.map(([a,v])=>e.jsxs("div",{className:"space-y-1",children:[e.jsx(T,{className:"text-xs text-muted-foreground",children:a}),e.jsx(y,{value:v,onChange:P=>n(a,P.target.value),className:"font-mono text-xs h-8"})]},a))})})]})]})}),e.jsxs("div",{className:"p-4 border-t bg-background shrink-0",children:[e.jsx(T,{className:"text-xs font-medium text-muted-foreground",children:"Add Environment Variable"}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(y,{placeholder:"VARIABLE_NAME",value:l,onChange:a=>f(a.target.value.toUpperCase()),className:"font-mono text-sm h-8 w-2/5",onKeyDown:a=>a.key==="Enter"&&l.trim()&&o()}),e.jsx(y,{placeholder:"value",value:d,onChange:a=>x(a.target.value),className:"font-mono text-sm h-8 flex-1",onKeyDown:a=>a.key==="Enter"&&l.trim()&&o()}),e.jsx(g,{variant:"outline",size:"sm",className:"h-8",onClick:o,disabled:!l.trim(),children:e.jsx(D,{className:"w-4 h-4"})})]})]})]}):e.jsx(ns,{currentSettings:i,newEnvKey:l,newEnvValue:d,onNewEnvKeyChange:f,onNewEnvValueChange:x,onEnvValueChange:n,onAddEnvVar:o})}),e.jsx(Z,{value:"info",className:"h-full mt-0 border-0 p-0 data-[state=inactive]:hidden",children:e.jsx(rs,{profileName:s,data:t})})]})]})})}function os({profileName:s,onDelete:t,onHasChangesUpdate:i}){const[l,d]=c.useState({}),[f,x]=c.useState(!1),[n,o]=c.useState(null),[m,j]=c.useState(""),[O,A]=c.useState(""),N=Fe(),{data:b,isLoading:k,isError:_,refetch:C}=Ke({queryKey:["settings",s],queryFn:async()=>{const h=await fetch(`/api/settings/${s}/raw`);if(!h.ok)throw new Error(`Failed to load settings: ${h.status}`);return h.json()}}),p=b?.settings,r=c.useMemo(()=>{if(n!==null)try{return JSON.parse(n)}catch{}if(p)return{...p,env:{...p.env,...l}}},[p,l,n]),a=c.useMemo(()=>n!==null?n:p?JSON.stringify(p,null,2):"",[n,p]),v=c.useCallback(h=>{o(h)},[]),P=(h,w)=>{const R={...r?.env||{},[h]:w};d(J=>({...J,[h]:w})),o(JSON.stringify({...r,env:R},null,2))},H=h=>{const w={...r?.env||{},...h};d(R=>({...R,...h})),o(JSON.stringify({...r,env:w},null,2))},F=()=>{if(!m.trim())return;const h=m.trim(),w=O,R={...r?.env||{},[h]:w};d(J=>({...J,[h]:w})),o(JSON.stringify({...r,env:R},null,2)),j(""),A("")},u=c.useMemo(()=>{try{return JSON.parse(a),!0}catch{return!1}},[a]),K=c.useMemo(()=>n!==null?n!==JSON.stringify(p,null,2):Object.keys(l).length>0,[n,l,p]),je=c.useMemo(()=>{const h=["ANTHROPIC_BASE_URL","ANTHROPIC_AUTH_TOKEN"],w=r?.env||{};return h.filter(R=>!w[R]?.trim())},[r]);c.useEffect(()=>{i?.(K)},[K,i]);const z=ze({mutationFn:async()=>{let h;try{h=JSON.parse(a)}catch{h={...b?.settings,env:{...b?.settings?.env,...l}}}const w=await fetch(`/api/settings/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:h,expectedMtime:b?.mtime})});if(w.status===409)throw new Error("CONFLICT");if(!w.ok)throw new Error("Failed to save");return w.json()},onSuccess:()=>{N.invalidateQueries({queryKey:["settings",s]}),N.invalidateQueries({queryKey:["profiles"]}),d({}),o(null),Q.success("Settings saved")},onError:h=>{h.message==="CONFLICT"?x(!0):Q.error(h.message)}}),Y=async h=>{x(!1),h?(await C(),z.mutate()):(d({}),o(null))};return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx(as,{profileName:s,data:b,settings:r,isLoading:k,isSaving:z.isPending,hasChanges:K,isRawJsonValid:u,onRefresh:()=>C(),onDelete:t,onSave:()=>z.mutate()}),k?e.jsxs("div",{className:"flex-1 flex items-center justify-center",children:[e.jsx(G,{className:"w-8 h-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:"Loading settings..."})]}):_?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed to load settings."}),e.jsxs(g,{variant:"outline",size:"sm",onClick:()=>C(),children:[e.jsx(U,{className:"w-4 h-4 mr-1"}),"Retry"]})]})}):e.jsxs("div",{className:"flex-1 grid grid-cols-[40%_60%] divide-x overflow-hidden",children:[e.jsx("div",{className:"flex flex-col overflow-hidden bg-muted/5 min-w-0",children:e.jsx(cs,{profileName:s,data:b,currentSettings:r,newEnvKey:m,newEnvValue:O,onNewEnvKeyChange:j,onNewEnvValueChange:A,onEnvValueChange:P,onEnvBulkChange:H,onAddEnvVar:F})}),e.jsxs("div",{className:"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(Ve,{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(ke,{rawJsonContent:a,isRawJsonValid:u,rawJsonEdits:n,settings:p,onChange:v,missingRequiredFields:je})]})]}),e.jsx(B,{open:f,title:"File Modified Externally",description:"Overwrite with your changes or discard?",confirmText:"Overwrite",variant:"destructive",onConfirm:()=>Y(!0),onCancel:()=>Y(!1)})]},s)}const ae="ccs:openrouter-banner-dismissed";function ds({onCreateClick:s}){const[t,i]=c.useState(!0),{modelCount:l,isLoading:d}=q();c.useEffect(()=>{const x=localStorage.getItem(ae)==="true";i(x)},[]);const f=()=>{localStorage.setItem(ae,"true"),i(!0)};return t?null:e.jsx("div",{className:"bg-gradient-to-r from-accent to-accent/90 text-white px-4 py-3 relative shrink-0",children:e.jsxs("div",{className:"flex items-center justify-between gap-4 max-w-screen-xl mx-auto",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx("div",{className:"p-1.5 bg-white/20 rounded-md shrink-0",children:e.jsx(V,{className:"w-4 h-4"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium text-sm",children:"NEW: OpenRouter Integration"}),e.jsxs("p",{className:"text-xs text-white/80 truncate",children:["Browse ",d?"300+":`${l}+`," models from OpenAI, Anthropic, Google, Meta and more."]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s&&e.jsx(g,{size:"sm",variant:"secondary",onClick:s,className:"bg-white text-accent hover:bg-white/90 h-8",children:"Try it now"}),e.jsxs("a",{href:"https://openrouter.ai",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-white/80 hover:text-white hidden sm:flex items-center gap-1",children:["Learn more",e.jsx(me,{className:"w-3 h-3"})]}),e.jsxs(g,{size:"icon",variant:"ghost",onClick:f,className:"h-7 w-7 text-white/70 hover:text-white hover:bg-white/20",children:[e.jsx(Ye,{className:"w-4 h-4"}),e.jsx("span",{className:"sr-only",children:"Dismiss"})]})]})]})})}function xs({onOpenRouterClick:s,onCustomClick:t}){const{modelCount:i,isLoading:l}=q();return e.jsx("div",{className:"flex-1 flex items-center justify-center bg-muted/20 p-8",children:e.jsxs("div",{className:"max-w-lg w-full space-y-6",children:[e.jsxs(Se,{className:"border-accent/30 dark:border-accent/40 bg-gradient-to-br from-accent/5 to-background dark:from-accent/10",children:[e.jsxs(Re,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"p-2 rounded-lg bg-accent/10 dark:bg-accent/20",children:e.jsx("img",{src:"/icons/openrouter.svg",alt:"OpenRouter",className:"w-6 h-6"})}),e.jsx(S,{variant:"secondary",className:"bg-accent/10 text-accent dark:bg-accent/20 dark:text-accent-foreground",children:"Recommended"})]}),e.jsx(Pe,{className:"text-xl",children:"Start with OpenRouter"}),e.jsxs(Le,{className:"text-base",children:["Access ",l?"300+":`${i}+`," models from OpenAI, Anthropic, Google, Meta and more - all through one API."]})]}),e.jsxs(Me,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(ue,{className:"w-4 h-4 text-accent"}),e.jsx("span",{children:"One API, all providers"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(V,{className:"w-4 h-4 text-accent"}),e.jsx("span",{children:"Model tier mapping"})]})]}),e.jsxs(g,{onClick:s,className:"w-full bg-accent hover:bg-accent/90 text-white",size:"lg",children:["Create OpenRouter Profile",e.jsx(We,{className:"w-4 h-4 ml-2"})]}),e.jsxs("p",{className:"text-xs text-center text-muted-foreground",children:["Get your API key at"," ",e.jsxs("a",{href:"https://openrouter.ai/keys",target:"_blank",rel:"noopener noreferrer",className:"text-accent hover:underline inline-flex items-center gap-1",children:["openrouter.ai/keys",e.jsx(me,{className:"w-3 h-3"})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(ee,{className:"flex-1"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"or"}),e.jsx(ee,{className:"flex-1"})]}),e.jsx(g,{variant:"outline",onClick:t,className:"w-full",children:"Create Custom API Profile"})]})})}function ms({onCreateClick:s}){const{modelCount:t,isLoading:i}=q();return e.jsx("div",{className:"p-3 border-t bg-gradient-to-r from-accent/5 to-accent/10 dark:from-accent/10 dark:to-accent/15",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-1.5 bg-accent/10 dark:bg-accent/20 rounded shrink-0",children:e.jsx("img",{src:"/icons/openrouter.svg",alt:"",className:"w-4 h-4"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs font-medium text-accent dark:text-accent-foreground",children:"OpenRouter"}),e.jsxs("p",{className:"text-[10px] text-muted-foreground truncate",children:[i?"300+":`${t}+`," models available"]})]}),e.jsxs(g,{size:"sm",variant:"ghost",onClick:s,className:"h-7 px-2 text-accent hover:text-accent hover:bg-accent/10 dark:hover:bg-accent/20",children:[e.jsx(ue,{className:"w-3 h-3 mr-1"}),e.jsx("span",{className:"text-xs",children:"Add"})]})]})})}function Os(){const{data:s,isLoading:t,isError:i,refetch:l}=De(),d=Ie(),[f,x]=c.useState(null),[n,o]=c.useState(""),[m,j]=c.useState(!1),[O,A]=c.useState("normal"),[N,b]=c.useState(null),[k,_]=c.useState(!1),[C,p]=c.useState(null);Ue();const r=c.useMemo(()=>s?.profiles||[],[s?.profiles]),a=c.useMemo(()=>r.filter(u=>u.name.toLowerCase().includes(n.toLowerCase())),[r,n]),v=f?r.find(u=>u.name===f):null,P=u=>{d.mutate(u,{onSuccess:()=>{f===u&&x(null),b(null)}})},H=u=>{j(!1),k&&f!==null?p(u):x(u)},F=u=>{k&&f!==u?p(u):x(u)};return e.jsxs("div",{className:"h-[calc(100vh-100px)] flex flex-col",children:[e.jsx(ds,{onCreateClick:()=>j(!0)}),e.jsxs("div",{className:"flex-1 flex min-h-0",children:[e.jsxs("div",{className:"w-80 border-r flex flex-col bg-muted/30",children:[e.jsxs("div",{className:"p-4 border-b bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Xe,{className:"w-5 h-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:"API Profiles"})]}),e.jsxs(g,{size:"sm",onClick:()=>{j(!0)},children:[e.jsx(D,{className:"w-4 h-4 mr-1"}),"New"]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(de,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(y,{placeholder:"Search profiles...",className:"pl-8 h-9",value:n,onChange:u=>o(u.target.value)})]})]}),e.jsx(I,{className:"flex-1",children:t?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading profiles..."}):i?e.jsx("div",{className:"p-4 text-center",children:e.jsxs("div",{className:"space-y-3 py-8",children:[e.jsx(he,{className:"w-12 h-12 mx-auto text-destructive/50"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Failed to load profiles"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Unable to fetch API profiles. Please try again."})]}),e.jsxs(g,{size:"sm",variant:"outline",onClick:()=>l(),children:[e.jsx(U,{className:"w-4 h-4 mr-1"}),"Retry"]})]})}):a.length===0?e.jsx("div",{className:"p-4 text-center",children:r.length===0?e.jsxs("div",{className:"space-y-3 py-8",children:[e.jsx(Ze,{className:"w-12 h-12 mx-auto text-muted-foreground/50"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"No API profiles yet"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Create your first profile to connect to custom API endpoints"})]}),e.jsxs(g,{size:"sm",variant:"outline",onClick:()=>{j(!0)},children:[e.jsx(D,{className:"w-4 h-4 mr-1"}),"Create Profile"]})]}):e.jsxs("p",{className:"text-sm text-muted-foreground py-4",children:['No profiles match "',n,'"']})}):e.jsx("div",{className:"p-2 space-y-1",children:a.map(u=>e.jsx(us,{profile:u,isSelected:f===u.name,onSelect:()=>F(u.name),onDelete:()=>b(u.name)},u.name))})}),r.length>0&&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.jsxs("span",{children:[r.length," profile",r.length!==1?"s":""]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(fe,{className:"w-3 h-3 text-green-600"}),r.filter(u=>u.configured).length," configured"]})]})}),e.jsx(ms,{onCreateClick:()=>{A("openrouter"),j(!0)}})]}),e.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:v?e.jsx(os,{profileName:v.name,onDelete:()=>b(v.name),onHasChangesUpdate:_},v.name):e.jsx(xs,{onOpenRouterClick:()=>{A("openrouter"),j(!0)},onCustomClick:()=>{A("normal"),j(!0)}})})]}),e.jsx(He,{open:m,onOpenChange:j,onSuccess:H,initialMode:O}),e.jsx(B,{open:!!N,title:"Delete Profile",description:`Are you sure you want to delete "${N}"? This will remove the settings file and cannot be undone.`,confirmText:"Delete",variant:"destructive",onConfirm:()=>N&&P(N),onCancel:()=>b(null)}),e.jsx(B,{open:!!C,title:"Unsaved Changes",description:`You have unsaved changes in "${f}". Discard and switch to "${C}"?`,confirmText:"Discard & Switch",variant:"destructive",onConfirm:()=>{_(!1),x(C),p(null)},onCancel:()=>p(null)})]})}function us({profile:s,isSelected:t,onSelect:i,onDelete:l}){return e.jsxs("div",{className:E("group flex items-center gap-2 px-3 py-2.5 rounded-md cursor-pointer transition-colors",t?"bg-primary/10 border border-primary/20":"hover:bg-muted border border-transparent"),onClick:i,children:[s.configured?e.jsx(fe,{className:"w-4 h-4 text-green-600 shrink-0"}):e.jsx(he,{className:"w-4 h-4 text-yellow-600 shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-sm truncate",children:s.name}),e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("div",{className:"text-xs text-muted-foreground truncate flex-1",children:s.settingsPath}),e.jsx(M,{value:s.settingsPath,size:"icon",className:"h-5 w-5 opacity-0 group-hover:opacity-100 transition-opacity"})]})]}),e.jsx(g,{variant:"ghost",size:"icon",className:"h-7 w-7 opacity-0 group-hover:opacity-100 transition-opacity",onClick:d=>{d.stopPropagation(),l()},children:e.jsx(oe,{className:"w-3.5 h-3.5 text-destructive"})})]})}export{Os as ApiPage};
@@ -1 +0,0 @@
1
- import{j as a,a1 as c}from"./radix-ui-qEZD5MMp.js";import"./react-vendor-CNOkPC89.js";import{c as d}from"./index-DGFnVfdv.js";import{A as h,a as x,b as g,c as m,d as p,e as f,f as j,g as u}from"./alert-dialog-z6HEaPqe.js";function v({className:t,orientation:e="horizontal",decorative:r=!0,...o}){return a.jsx(c,{"data-slot":"separator",decorative:r,orientation:e,className:d("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...o})}function k({open:t,onConfirm:e,onCancel:r,title:o,description:i,confirmText:l="Confirm",variant:n="default"}){return a.jsx(h,{open:t,onOpenChange:s=>!s&&r(),children:a.jsxs(x,{children:[a.jsxs(g,{children:[a.jsx(m,{children:o}),a.jsx(p,{children:i})]}),a.jsxs(f,{children:[a.jsx(j,{onClick:r,children:"Cancel"}),a.jsx(u,{onClick:e,className:n==="destructive"?"bg-red-600 hover:bg-red-700 text-white":"",children:l})]})]})})}export{k as C,v as S};
@@ -1,4 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DGFnVfdv.js","assets/radix-ui-qEZD5MMp.js","assets/react-vendor-CNOkPC89.js","assets/tanstack-De4wvi8X.js","assets/notifications-B2HqRBj7.js","assets/icons-G0rMFC4M.js","assets/utils-CzKF5WmX.js","assets/form-utils-C-pVd1--.js","assets/code-highlight-BRUf_pqB.js","assets/index-Bqle3SG4.css"])))=>i.map(i=>d[i]);
2
- import{j as e}from"./radix-ui-qEZD5MMp.js";import{B as b,b as v,X as re,Y as ce,Z as de,_ as me,ak as ye,al as be,$ as K,M as W,m as J,L as C,I as ae,q as ue,aP as Ce,aQ as Se,S as y,H as ke,J as Fe,K as z,c as X}from"./index-DGFnVfdv.js";import{r as g}from"./react-vendor-CNOkPC89.js";import{a as Pe,u as M,b as S}from"./tanstack-De4wvi8X.js";import{S as Y,C as Me}from"./confirm-dialog-D8vB20zr.js";import{R as xe,L as Z,ai as Ae,k as Le,a1 as Te,Z as ne,I as Ee,X as Re,T as he,al as _e,a as Oe,a5 as Ie,ap as qe,aw as ie,K as De,y as Ue,ax as Qe,r as pe,s as fe}from"./icons-G0rMFC4M.js";import{S as H}from"./switch-Cr9fAsnM.js";import{t as A}from"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-C-pVd1--.js";import"./code-highlight-BRUf_pqB.js";import"./alert-dialog-z6HEaPqe.js";const j="/api";async function Ke(){const s=await fetch(`${j}/copilot/status`);if(!s.ok)throw new Error("Failed to fetch copilot status");return s.json()}async function Je(){const s=await fetch(`${j}/copilot/config`);if(!s.ok)throw new Error("Failed to fetch copilot config");return s.json()}async function $e(){const s=await fetch(`${j}/copilot/models`);if(!s.ok)throw new Error("Failed to fetch copilot models");return s.json()}async function Be(){const s=await fetch(`${j}/copilot/settings/raw`);if(!s.ok)throw new Error("Failed to fetch copilot raw settings");return s.json()}async function Ge(s){const t=await fetch(`${j}/copilot/config`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!t.ok)throw new Error("Failed to update copilot config");return t.json()}async function ze(s){const t=await fetch(`${j}/copilot/settings/raw`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(t.status===409)throw new Error("CONFLICT");if(!t.ok)throw new Error("Failed to save copilot raw settings");return t.json()}async function He(){const s=await fetch(`${j}/copilot/auth/start`,{method:"POST"});if(!s.ok)throw new Error("Failed to start auth");return s.json()}async function Ve(){const s=await fetch(`${j}/copilot/daemon/start`,{method:"POST"});if(!s.ok)throw new Error("Failed to start daemon");return s.json()}async function Xe(){const s=await fetch(`${j}/copilot/daemon/stop`,{method:"POST"});if(!s.ok)throw new Error("Failed to stop daemon");return s.json()}async function Ye(){const s=await fetch(`${j}/copilot/info`);if(!s.ok)throw new Error("Failed to fetch copilot info");return s.json()}async function We(s){const t=await fetch(`${j}/copilot/install`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s?{version:s}:{})});if(!t.ok)throw new Error("Failed to install copilot-api");return t.json()}function ge(){const s=Pe(),t=M({queryKey:["copilot-status"],queryFn:Ke,refetchInterval:5e3}),l=M({queryKey:["copilot-config"],queryFn:Je}),c=M({queryKey:["copilot-models"],queryFn:$e}),a=M({queryKey:["copilot-raw-settings"],queryFn:Be}),r=M({queryKey:["copilot-info"],queryFn:Ye}),o=S({mutationFn:Ge,onSuccess:()=>{s.invalidateQueries({queryKey:["copilot-status"]}),s.invalidateQueries({queryKey:["copilot-config"]}),s.invalidateQueries({queryKey:["copilot-raw-settings"]})}}),i=S({mutationFn:ze,onSuccess:()=>{s.invalidateQueries({queryKey:["copilot-status"]}),s.invalidateQueries({queryKey:["copilot-config"]}),s.invalidateQueries({queryKey:["copilot-raw-settings"]})}}),m=S({mutationFn:He,onSuccess:()=>{s.invalidateQueries({queryKey:["copilot-status"]})}}),h=S({mutationFn:Ve,onSuccess:()=>{s.invalidateQueries({queryKey:["copilot-status"]})}}),x=S({mutationFn:Xe,onSuccess:()=>{s.invalidateQueries({queryKey:["copilot-status"]})}}),n=S({mutationFn:We,onSuccess:()=>{s.invalidateQueries({queryKey:["copilot-status"]}),s.invalidateQueries({queryKey:["copilot-info"]})}});return g.useMemo(()=>({status:t.data,statusLoading:t.isLoading,statusError:t.error,refetchStatus:t.refetch,config:l.data,configLoading:l.isLoading,models:c.data?.models??[],currentModel:c.data?.current,modelsLoading:c.isLoading,rawSettings:a.data,rawSettingsLoading:a.isLoading,refetchRawSettings:a.refetch,updateConfig:o.mutate,updateConfigAsync:o.mutateAsync,isUpdating:o.isPending,saveRawSettings:i.mutate,saveRawSettingsAsync:i.mutateAsync,isSavingRawSettings:i.isPending,startAuth:m.mutate,startAuthAsync:m.mutateAsync,isAuthenticating:m.isPending,authResult:m.data,startDaemon:h.mutate,isStartingDaemon:h.isPending,stopDaemon:x.mutate,isStoppingDaemon:x.isPending,info:r.data,infoLoading:r.isLoading,refetchInfo:r.refetch,install:n.mutate,installAsync:n.mutateAsync,isInstalling:n.isPending}),[t.data,t.isLoading,t.error,t.refetch,l.data,l.isLoading,c.data,c.isLoading,a.data,a.isLoading,a.refetch,o.mutate,o.mutateAsync,o.isPending,i.mutate,i.mutateAsync,i.isPending,m.mutate,m.mutateAsync,m.isPending,m.data,h.mutate,h.isPending,x.mutate,x.isPending,r.data,r.isLoading,r.refetch,n.mutate,n.mutateAsync,n.isPending])}function Ze({rawSettings:s,rawSettingsLoading:t,isUpdating:l,isSavingRawSettings:c,hasChanges:a,isRawJsonValid:r,onRefresh:o,onSave:i}){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"}),s&&e.jsx(b,{variant:"outline",className:"text-xs",children:"copilot.settings.json"})]}),s&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["Last modified:"," ",s.exists?new Date(s.mtime).toLocaleString():"Never saved"]})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(v,{variant:"ghost",size:"sm",onClick:o,disabled:t,children:e.jsx(xe,{className:`w-4 h-4 ${t?"animate-spin":""}`})}),e.jsx(v,{size:"sm",onClick:i,disabled:l||c||!a||!r,children:l||c?e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"w-4 h-4 mr-1 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Ae,{className:"w-4 h-4 mr-1"}),"Save"]})})]})]})}const es=[{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"},{name:"Raptor Mini (Free)",description:"Free tier - fine-tuned for coding",default:"raptor-mini",opus:"raptor-mini",sonnet:"raptor-mini",haiku:"raptor-mini"}],ss=[{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 le(s){switch(s){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 ts(s){return s==null?null:s===0?"Free":s<1?`${s}x`:s===1?"1x":`${s}x`}function D({label:s,description:t,value:l,onChange:c,models:a,disabled:r}){const o=a.find(i=>i.id===l);return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium",children:s}),t&&e.jsx("p",{className:"text-[10px] text-muted-foreground",children:t})]}),e.jsxs(re,{value:l||"",onValueChange:c,disabled:r,children:[e.jsx(ce,{className:"h-9",children:e.jsx(de,{placeholder:"Select model",children:l&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:l}),o?.minPlan&&e.jsx(b,{variant:"outline",className:`text-[9px] px-1 py-0 h-4 ${le(o.minPlan)}`,children:o.minPlan})]})})}),e.jsx(me,{className:"max-h-[300px]",children:e.jsxs(ye,{children:[e.jsxs(be,{className:"text-xs text-muted-foreground",children:["Available Models (",a.length,")"]}),a.map(i=>e.jsx(K,{value:i.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:i.name||i.id}),i.minPlan&&e.jsx(b,{variant:"outline",className:`text-[9px] px-1 py-0 h-4 ${le(i.minPlan)}`,children:i.minPlan}),i.multiplier!==void 0&&e.jsx("span",{className:"text-[9px] text-muted-foreground",children:ts(i.multiplier)}),i.preview&&e.jsx(b,{variant:"secondary",className:"text-[9px] px-1 py-0 h-4",children:"Preview"}),l===i.id&&e.jsx(Le,{className:"w-3 h-3 text-primary ml-auto"})]})},i.id))]})})]})]})}function as({currentModel:s,opusModel:t,sonnetModel:l,haikuModel:c,models:a,modelsLoading:r,onApplyPreset:o,onUpdateModel:i,onUpdateOpusModel:m,onUpdateSonnetModel:h,onUpdateHaikuModel:x}){return e.jsx(W,{value:"config",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(J,{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(Te,{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(b,{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:es.map(n=>e.jsxs(v,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>o(n),title:n.description,children:[e.jsx(ne,{className:"w-3 h-3 text-green-600"}),n.name]},n.name))})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(b,{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:ss.map(n=>e.jsxs(v,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>o(n),title:n.description,children:[e.jsx(ne,{className:"w-3 h-3"}),n.name]},n.name))})]})]}),e.jsx(Y,{}),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:"space-y-4",children:[e.jsx(D,{label:"Default Model",description:"Used when no specific tier is requested",value:s,onChange:i,models:a,disabled:r}),e.jsx(D,{label:"Opus (Most capable)",description:"For complex reasoning tasks",value:t||s,onChange:m,models:a,disabled:r}),e.jsx(D,{label:"Sonnet (Balanced)",description:"Balance of speed and capability",value:l||s,onChange:h,models:a,disabled:r}),e.jsx(D,{label:"Haiku (Fast)",description:"Quick responses for simple tasks",value:c||s,onChange:x,models:a,disabled:r})]})]})]})})})}function ns({enabled:s,autoStart:t,port:l,accountType:c,rateLimit:a,waitOnLimit:r,onUpdateEnabled:o,onUpdateAutoStart:i,onUpdatePort:m,onUpdateAccountType:h,onUpdateRateLimit:x,onUpdateWaitOnLimit:n}){return e.jsx(W,{value:"settings",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(J,{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(C,{htmlFor:"enabled",className:"text-sm font-medium",children:"Enable Copilot"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Allow using GitHub Copilot subscription"})]}),e.jsx(H,{id:"enabled",checked:s,onCheckedChange:o})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Basic Settings"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"port",className:"text-xs",children:"Port"}),e.jsx(ae,{id:"port",type:"number",value:l,onChange:N=>m(parseInt(N.target.value,10)),min:1024,max:65535,className:"max-w-[150px] h-8"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"account-type",className:"text-xs",children:"Account Type"}),e.jsxs(re,{value:c,onValueChange:h,children:[e.jsx(ce,{id:"account-type",className:"max-w-[150px] h-8",children:e.jsx(de,{})}),e.jsxs(me,{children:[e.jsx(K,{value:"individual",children:"Individual"}),e.jsx(K,{value:"business",children:"Business"}),e.jsx(K,{value:"enterprise",children:"Enterprise"})]})]})]})]}),e.jsx(Y,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Rate Limiting"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"rate-limit",className:"text-xs",children:"Rate Limit (seconds)"}),e.jsx(ae,{id:"rate-limit",type:"number",value:a,onChange:N=>x(N.target.value),placeholder:"No limit",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(C,{htmlFor:"wait-on-limit",className:"text-xs",children:"Wait on Rate Limit"}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Wait instead of error when limit hit"})]}),e.jsx(H,{id:"wait-on-limit",checked:r,onCheckedChange:n})]})]}),e.jsx(Y,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Daemon Settings"}),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(C,{htmlFor:"auto-start",className:"text-xs",children:"Auto-start Daemon"}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Start copilot-api when using profile"})]}),e.jsx(H,{id:"auto-start",checked:t,onCheckedChange:i})]})]})]})})})}function U({label:s,command:t}){return e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:s}),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:t}),e.jsx(ue,{value:t,size:"icon",className:"h-6 w-6"})]})]})}function is({rawSettings:s}){return e.jsx(W,{value:"info",className:"h-full mt-0 border-0 p-0 data-[state=inactive]:hidden",children:e.jsx(J,{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(Ee,{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"})]}),s&&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:s.path}),e.jsx(ue,{value:s.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(b,{variant:"outline",className:s.exists?"w-fit text-green-600 border-green-200 bg-green-50":"w-fit text-muted-foreground",children:s.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(U,{label:"Run with Copilot",command:"ccs copilot"}),e.jsx(U,{label:"Authenticate",command:"ccs copilot auth"}),e.jsx(U,{label:"Start daemon",command:"ccs copilot --start"}),e.jsx(U,{label:"Stop daemon",command:"ccs copilot --stop"})]})]})]})})})}const ls=g.lazy(()=>Se(()=>import("./index-DGFnVfdv.js").then(s=>s.b6),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])).then(s=>({default:s.CodeEditor})));function os({rawJsonContent:s,isRawJsonValid:t,rawJsonEdits:l,rawSettingsEnv:c,onChange:a,missingRequiredFields:r=[]}){const o=r.length>0;return e.jsx(g.Suspense,{fallback:e.jsxs("div",{className:"flex items-center justify-center h-full",children:[e.jsx(Z,{className:"w-6 h-6 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading editor..."})]}),children:e.jsxs("div",{className:"h-full flex flex-col",children:[!t&&l!==null&&e.jsxs("div",{className:"mb-2 px-3 py-2 bg-destructive/10 text-destructive text-sm rounded-md flex items-center gap-2 mx-6 mt-4 shrink-0",children:[e.jsx(Re,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),t&&o&&e.jsxs("div",{className:"mb-2 px-3 py-2 bg-warning/10 text-warning-foreground text-sm rounded-md flex items-start gap-2 mx-6 mt-4 shrink-0 border border-warning/20",children:[e.jsx(he,{className:"w-4 h-4 mt-0.5 text-amber-500 shrink-0"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"Missing required fields:"})," ",e.jsx("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:r.join(", ")}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"These fields will use default values at runtime."})]})]}),e.jsx("div",{className:"flex-1 overflow-hidden px-6 pb-4 pt-4",children:e.jsx("div",{className:"h-full border rounded-md overflow-hidden bg-background",children:e.jsx(ls,{value:s,onChange:a,language:"json",minHeight:"100%"})})}),e.jsx("div",{className:"mx-6 mb-4",children:e.jsx("div",{className:"border rounded-md overflow-hidden",children:e.jsx(Ce,{profileEnv:c})})})]})})}const rs=["ANTHROPIC_BASE_URL","ANTHROPIC_AUTH_TOKEN"];function oe(s){const t=s?.env||{};return rs.filter(l=>!t[l]?.trim())}function cs(){const{config:s,configLoading:t,models:l,modelsLoading:c,rawSettings:a,rawSettingsLoading:r,updateConfigAsync:o,isUpdating:i,saveRawSettingsAsync:m,isSavingRawSettings:h,refetchRawSettings:x}=ge(),[n,N]=g.useState({}),[f,k]=g.useState(null),[$,L]=g.useState(!1),T=n.enabled??s?.enabled??!1,E=n.autoStart??s?.auto_start??!1,F=n.port??s?.port??4141,R=n.accountType??s?.account_type??"individual",_=n.model??s?.model??"claude-sonnet-4-5-20250929",p=n.rateLimit??s?.rate_limit?.toString()??"",O=n.waitOnLimit??s?.wait_on_limit??!0,I=n.opusModel??s?.opus_model??"",q=n.sonnetModel??s?.sonnet_model??"",P=n.haikuModel??s?.haiku_model??"",B=(u,w)=>{N(we=>({...we,[u]:w}))},G=u=>{N(w=>({...w,model:u.default,opusModel:u.opus,sonnetModel:u.sonnet,haikuModel:u.haiku})),A.success(`Applied "${u.name}" preset`)},d=g.useMemo(()=>f!==null?f:a?.settings?JSON.stringify(a.settings,null,2):`{
3
- "env": {}
4
- }`,[f,a]),je=g.useCallback(u=>{k(u)},[]),ee=g.useMemo(()=>{try{return JSON.parse(d),!0}catch{return!1}},[d]),Ne=g.useMemo(()=>{const u=Object.keys(n).length>0,w=f!==null&&f!==JSON.stringify(a?.settings,null,2);return u||w},[n,f,a]),se=g.useMemo(()=>{if(f!==null)try{return JSON.parse(f)}catch{return a?.settings}return a?.settings},[f,a?.settings]),ve=g.useMemo(()=>oe(se),[se]),te=async()=>{try{if(Object.keys(n).length>0&&await o({enabled:T,auto_start:E,port:F,account_type:R,model:_,rate_limit:p?parseInt(p,10):null,wait_on_limit:O,opus_model:I||void 0,sonnet_model:q||void 0,haiku_model:P||void 0}),f!==null&&ee){const u=JSON.parse(d),w=oe(u);await m({settings:u,expectedMtime:a?.mtime}),w.length>0?A.success("Copilot configuration saved",{description:`Missing fields will use defaults: ${w.join(", ")}`}):A.success("Copilot configuration saved")}else A.success("Copilot configuration saved");N({}),k(null)}catch(u){u.message==="CONFLICT"?L(!0):A.error("Failed to save settings")}};return{configLoading:t,rawSettingsLoading:r,modelsLoading:c,isUpdating:i,isSavingRawSettings:h,models:l,rawSettings:a,rawJsonContent:d,rawJsonEdits:f,enabled:T,autoStart:E,port:F,accountType:R,currentModel:_,rateLimit:p,waitOnLimit:O,opusModel:I,sonnetModel:q,haikuModel:P,isRawJsonValid:ee,hasChanges:Ne,conflictDialog:$,updateField:B,applyPreset:G,handleRawJsonChange:je,handleSave:te,handleConflictResolve:async u=>{L(!1),u?(await x(),te()):k(null)},refetchRawSettings:x,missingRequiredFields:ve}}function ds(){const{configLoading:s,rawSettingsLoading:t,modelsLoading:l,isUpdating:c,isSavingRawSettings:a,models:r,rawSettings:o,rawJsonContent:i,rawJsonEdits:m,enabled:h,autoStart:x,port:n,accountType:N,currentModel:f,rateLimit:k,waitOnLimit:$,opusModel:L,sonnetModel:T,haikuModel:E,isRawJsonValid:F,hasChanges:R,conflictDialog:_,updateField:p,applyPreset:O,handleRawJsonChange:I,handleSave:q,handleConflictResolve:P,refetchRawSettings:B,missingRequiredFields:G}=cs();return s||t?e.jsxs("div",{className:"space-y-6",children:[e.jsx(y,{className:"h-10 w-full"}),e.jsx(y,{className:"h-10 w-full"}),e.jsx(y,{className:"h-10 w-full"}),e.jsx(y,{className:"h-10 w-full"})]}):e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx(Ze,{rawSettings:o,rawSettingsLoading:t,isUpdating:c,isSavingRawSettings:a,hasChanges:R,isRawJsonValid:F,onRefresh:()=>B(),onSave:q}),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(ke,{defaultValue:"config",className:"h-full flex flex-col",children:[e.jsx("div",{className:"px-4 pt-4 shrink-0",children:e.jsxs(Fe,{className:"w-full",children:[e.jsx(z,{value:"config",className:"flex-1",children:"Model Config"}),e.jsx(z,{value:"settings",className:"flex-1",children:"Settings"}),e.jsx(z,{value:"info",className:"flex-1",children:"Info"})]})}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[e.jsx(as,{currentModel:f,opusModel:L,sonnetModel:T,haikuModel:E,models:r,modelsLoading:l,onApplyPreset:O,onUpdateModel:d=>p("model",d),onUpdateOpusModel:d=>p("opusModel",d),onUpdateSonnetModel:d=>p("sonnetModel",d),onUpdateHaikuModel:d=>p("haikuModel",d)}),e.jsx(ns,{enabled:h,autoStart:x,port:n,accountType:N,rateLimit:k,waitOnLimit:$,onUpdateEnabled:d=>p("enabled",d),onUpdateAutoStart:d=>p("autoStart",d),onUpdatePort:d=>p("port",d),onUpdateAccountType:d=>p("accountType",d),onUpdateRateLimit:d=>p("rateLimit",d),onUpdateWaitOnLimit:d=>p("waitOnLimit",d)}),e.jsx(is,{rawSettings:o})]})]})})}),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(os,{rawJsonContent:i,isRawJsonValid:F,rawJsonEdits:m,rawSettingsEnv:o?.settings?.env,onChange:I,missingRequiredFields:G})]})]}),e.jsx(Me,{open:_,title:"File Modified Externally",description:"This settings file was modified by another process. Overwrite with your changes or discard?",confirmText:"Overwrite",variant:"destructive",onConfirm:()=>P(!0),onCancel:()=>P(!1)})]})}function V({title:s,children:t}){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:s}),e.jsx("div",{className:"space-y-1",children:t})]})}function Q({icon:s,label:t,status:l,statusText:c,variant:a="default"}){return e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 rounded-lg bg-muted/50",children:[e.jsx(s,{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:t})}),e.jsx("div",{className:"flex items-center gap-1.5",children:l?e.jsxs(e.Fragment,{children:[e.jsx(pe,{className:X("w-4 h-4",a==="warning"?"text-yellow-500":"text-green-500")}),e.jsx("span",{className:X("text-xs",a==="warning"?"text-yellow-500":"text-green-500"),children:c||"Yes"})]}):e.jsxs(e.Fragment,{children:[e.jsx(fe,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:c||"No"})]})})]})}function ms(){return e.jsxs("div",{className:"space-y-4 p-4",children:[e.jsx(y,{className:"h-8 w-full"}),e.jsx(y,{className:"h-12 w-full"}),e.jsx(y,{className:"h-12 w-full"}),e.jsx(y,{className:"h-12 w-full"})]})}function Ss(){const{status:s,statusLoading:t,refetchStatus:l,startAuth:c,isAuthenticating:a,startDaemon:r,isStartingDaemon:o,stopDaemon:i,isStoppingDaemon:m,install:h,isInstalling:x}=ge();return e.jsxs("div",{className:"h-[calc(100vh-100px)] flex",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(Oe,{className:"w-5 h-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:"Copilot"})]}),e.jsx(v,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>l(),disabled:t,children:e.jsx(xe,{className:X("w-4 h-4",t&&"animate-spin")})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"GitHub Copilot proxy"})]}),e.jsx(J,{className:"flex-1",children:t?e.jsx(ms,{}):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(he,{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:"Unofficial API - Use at Your Own Risk"})]}),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:"Reverse-engineered API - may break anytime"}),e.jsx("li",{children:"Excessive use may trigger account restrictions"}),e.jsx("li",{children:"No warranty, no responsibility from CCS"})]})]}),e.jsxs(V,{title:"Setup",children:[e.jsx(Q,{icon:Ie,label:"copilot-api",status:s?.installed??!1,statusText:s?.installed?s.version?`v${s.version}`:"Installed":"Missing"}),!s?.installed&&e.jsx(v,{size:"sm",className:"w-full mt-2",onClick:()=>h(void 0),disabled:x,children:x?e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}),"Installing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(qe,{className:"w-3.5 h-3.5 mr-1.5"}),"Install copilot-api"]})}),s?.installed&&e.jsx(Q,{icon:ie,label:"Integration",status:s?.enabled??!1,statusText:s?.enabled?"Enabled":"Disabled"})]}),s?.installed&&e.jsxs(V,{title:"Auth",children:[e.jsx(Q,{icon:De,label:"GitHub",status:s?.authenticated??!1,statusText:s?.authenticated?"Connected":"Not Connected"}),!s?.authenticated&&e.jsx(v,{size:"sm",className:"w-full mt-2",onClick:()=>c(),disabled:a,children:a?"Authenticating...":"Authenticate"})]}),s?.authenticated&&e.jsxs(V,{title:"Daemon",children:[e.jsx(Q,{icon:Ue,label:"Status",status:s?.daemon_running??!1,statusText:s?.daemon_running?"Running":"Stopped"}),e.jsxs("div",{className:"px-3 py-1 text-xs text-muted-foreground",children:["Port: ",s?.port??4141]}),e.jsx("div",{className:"px-1",children:s?.daemon_running?e.jsxs(v,{size:"sm",variant:"outline",className:"w-full",onClick:()=>i(),disabled:m,children:[e.jsx(Qe,{className:"w-3.5 h-3.5 mr-1.5"}),m?"Stopping...":"Stop"]}):e.jsxs(v,{size:"sm",variant:"outline",className:"w-full",onClick:()=>r(),disabled:o,children:[e.jsx(ie,{className:"w-3.5 h-3.5 mr-1.5"}),o?"Starting...":"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:"Proxy"}),s?.daemon_running?e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(pe,{className:"w-3 h-3 text-green-500"}),"Active"]}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(fe,{className:"w-3 h-3 text-muted-foreground"}),"Inactive"]})]})})]}),e.jsx("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-hidden",children:e.jsx(ds,{})})]})}export{Ss as CopilotPage};