@kaitranntt/ccs 7.9.0-dev.1 → 7.9.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.
- package/dist/cliproxy/index.d.ts +0 -2
- package/dist/cliproxy/index.d.ts.map +1 -1
- package/dist/cliproxy/index.js +1 -3
- package/dist/cliproxy/index.js.map +1 -1
- package/dist/cliproxy/stats-fetcher.d.ts +0 -4
- package/dist/cliproxy/stats-fetcher.d.ts.map +1 -1
- package/dist/cliproxy/stats-fetcher.js.map +1 -1
- package/dist/ui/assets/accounts-CZms_PBW.js +1 -0
- package/dist/ui/assets/{alert-dialog-zpnBn2CA.js → alert-dialog-sKmXLtjs.js} +1 -1
- package/dist/ui/assets/api-TANgowVA.js +1 -0
- package/dist/ui/assets/auth-section-Ddg5Cdd6.js +1 -0
- package/dist/ui/assets/{card-dTUi3LxW.js → card-CfgEo_Fi.js} +1 -1
- package/dist/ui/assets/cliproxy-BpCuX751.js +3 -0
- package/dist/ui/assets/cliproxy-control-panel-Cp0Tweyl.js +1 -0
- package/dist/ui/assets/{confirm-dialog-ByfOsjk9.js → confirm-dialog-Dut98zdb.js} +1 -1
- package/dist/ui/assets/{copilot-BQscualu.js → copilot-DvOZJmtw.js} +3 -3
- package/dist/ui/assets/globalenv-section-DlnizwvB.js +1 -0
- package/dist/ui/assets/{health-DTRd-dXk.js → health-D1M4owiM.js} +1 -1
- package/dist/ui/assets/icons-CMYcel9O.js +1 -0
- package/dist/ui/assets/index-BCBypoXT.js +1 -0
- package/dist/ui/assets/index-BXkzlgVE.js +1 -0
- package/dist/ui/assets/{index-Bfwze8tN.js → index-Bdp0Hpgh.js} +1 -1
- package/dist/ui/assets/index-D-LYJymx.js +47 -0
- package/dist/ui/assets/index-DQAJ1wqP.css +1 -0
- package/dist/ui/assets/{shared-BgDSyHKz.js → shared-Dgmje0CZ.js} +1 -1
- package/dist/ui/assets/{switch-B0PXGFIv.js → switch-MkSHHW1_.js} +1 -1
- package/dist/ui/index.html +3 -3
- package/dist/web-server/routes/cliproxy-stats-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cliproxy-stats-routes.js +5 -89
- package/dist/web-server/routes/cliproxy-stats-routes.js.map +1 -1
- package/package.json +1 -1
- package/dist/cliproxy/quota-fetcher.d.ts +0 -46
- package/dist/cliproxy/quota-fetcher.d.ts.map +0 -1
- package/dist/cliproxy/quota-fetcher.js +0 -406
- package/dist/cliproxy/quota-fetcher.js.map +0 -1
- package/dist/ui/assets/accounts-CmzZXhfc.js +0 -1
- package/dist/ui/assets/api-DFbZVPK4.js +0 -1
- package/dist/ui/assets/auth-section-YgJ7Cv--.js +0 -1
- package/dist/ui/assets/cliproxy-CsqKCFzj.js +0 -3
- package/dist/ui/assets/cliproxy-control-panel-BRCh_7b3.js +0 -1
- package/dist/ui/assets/globalenv-section-BEpPTvKo.js +0 -1
- package/dist/ui/assets/icons-CwFZAiDB.js +0 -1
- package/dist/ui/assets/index-BLoAjpcw.js +0 -1
- package/dist/ui/assets/index-CEZrgkam.js +0 -1
- package/dist/ui/assets/index-QeBLfRj8.js +0 -47
- package/dist/ui/assets/index-oS2cgEFl.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{j as e}from"./radix-ui-uXQB-q0u.js";import{B as y,a as v,O as le,Q as oe,U as re,V as ce,a4 as je,a5 as Ne,W as J,G as Y,i as K,L as b,I as te,m as de,ar as ve,as as we,S as w,D as ye,E as be,F as z,c as W}from"./index-QeBLfRj8.js";import{r as j}from"./react-vendor-B_CU-WTZ.js";import{u as Ce,a as M,b as C}from"./tanstack-Coed0rqz.js";import{S as X,C as Se}from"./confirm-dialog-ByfOsjk9.js";import{a0 as me,L as Z,aa as ke,j as Fe,Q as Pe,Z as ae,I as Me,X as Le,ad as Ae,a as Te,T as Ee,_ as Re,ai as Oe,ao as ne,K as _e,s as Ie,as as De,n as ue,o as xe}from"./icons-CwFZAiDB.js";import{S as B}from"./switch-B0PXGFIv.js";import{t as H}from"./notifications-dJQY2-U6.js";import"./utils-CzKF5WmX.js";import"./form-utils-kUVlZZAO.js";import"./code-highlight-DKN39ySy.js";import"./alert-dialog-zpnBn2CA.js";const f="/api";async function qe(){const s=await fetch(`${f}/copilot/status`);if(!s.ok)throw new Error("Failed to fetch copilot status");return s.json()}async function Qe(){const s=await fetch(`${f}/copilot/config`);if(!s.ok)throw new Error("Failed to fetch copilot config");return s.json()}async function Ue(){const s=await fetch(`${f}/copilot/models`);if(!s.ok)throw new Error("Failed to fetch copilot models");return s.json()}async function Je(){const s=await fetch(`${f}/copilot/settings/raw`);if(!s.ok)throw new Error("Failed to fetch copilot raw settings");return s.json()}async function Ke(s){const t=await fetch(`${f}/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 $e(s){const t=await fetch(`${f}/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 Ge(){const s=await fetch(`${f}/copilot/auth/start`,{method:"POST"});if(!s.ok)throw new Error("Failed to start auth");return s.json()}async function ze(){const s=await fetch(`${f}/copilot/daemon/start`,{method:"POST"});if(!s.ok)throw new Error("Failed to start daemon");return s.json()}async function Be(){const s=await fetch(`${f}/copilot/daemon/stop`,{method:"POST"});if(!s.ok)throw new Error("Failed to stop daemon");return s.json()}async function He(){const s=await fetch(`${f}/copilot/info`);if(!s.ok)throw new Error("Failed to fetch copilot info");return s.json()}async function Ve(s){const t=await fetch(`${f}/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 he(){const s=Ce(),t=M({queryKey:["copilot-status"],queryFn:qe,refetchInterval:5e3}),l=M({queryKey:["copilot-config"],queryFn:Qe}),r=M({queryKey:["copilot-models"],queryFn:Ue}),a=M({queryKey:["copilot-raw-settings"],queryFn:Je}),c=M({queryKey:["copilot-info"],queryFn:He}),o=C({mutationFn:Ke,onSuccess:()=>{s.invalidateQueries({queryKey:["copilot-status"]}),s.invalidateQueries({queryKey:["copilot-config"]}),s.invalidateQueries({queryKey:["copilot-raw-settings"]})}}),i=C({mutationFn:$e,onSuccess:()=>{s.invalidateQueries({queryKey:["copilot-status"]}),s.invalidateQueries({queryKey:["copilot-config"]}),s.invalidateQueries({queryKey:["copilot-raw-settings"]})}}),m=C({mutationFn:Ge,onSuccess:()=>{s.invalidateQueries({queryKey:["copilot-status"]})}}),h=C({mutationFn:ze,onSuccess:()=>{s.invalidateQueries({queryKey:["copilot-status"]})}}),x=C({mutationFn:Be,onSuccess:()=>{s.invalidateQueries({queryKey:["copilot-status"]})}}),n=C({mutationFn:Ve,onSuccess:()=>{s.invalidateQueries({queryKey:["copilot-status"]}),s.invalidateQueries({queryKey:["copilot-info"]})}});return j.useMemo(()=>({status:t.data,statusLoading:t.isLoading,statusError:t.error,refetchStatus:t.refetch,config:l.data,configLoading:l.isLoading,models:r.data?.models??[],currentModel:r.data?.current,modelsLoading:r.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:c.data,infoLoading:c.isLoading,refetchInfo:c.refetch,install:n.mutate,installAsync:n.mutateAsync,isInstalling:n.isPending}),[t.data,t.isLoading,t.error,t.refetch,l.data,l.isLoading,r.data,r.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,c.data,c.isLoading,c.refetch,n.mutate,n.mutateAsync,n.isPending])}function We({rawSettings:s,rawSettingsLoading:t,isUpdating:l,isSavingRawSettings:r,hasChanges:a,isRawJsonValid:c,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(y,{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(me,{className:`w-4 h-4 ${t?"animate-spin":""}`})}),e.jsx(v,{size:"sm",onClick:i,disabled:l||r||!a||!c,children:l||r?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(ke,{className:"w-4 h-4 mr-1"}),"Save"]})})]})]})}const Xe=[{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"}],Ye=[{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 ie(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 Ze(s){return s==null?null:s===0?"Free":s<1?`${s}x`:s===1?"1x":`${s}x`}function q({label:s,description:t,value:l,onChange:r,models:a,disabled:c}){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(le,{value:l||"",onValueChange:r,disabled:c,children:[e.jsx(oe,{className:"h-9",children:e.jsx(re,{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(y,{variant:"outline",className:`text-[9px] px-1 py-0 h-4 ${ie(o.minPlan)}`,children:o.minPlan})]})})}),e.jsx(ce,{className:"max-h-[300px]",children:e.jsxs(je,{children:[e.jsxs(Ne,{className:"text-xs text-muted-foreground",children:["Available Models (",a.length,")"]}),a.map(i=>e.jsx(J,{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(y,{variant:"outline",className:`text-[9px] px-1 py-0 h-4 ${ie(i.minPlan)}`,children:i.minPlan}),i.multiplier!==void 0&&e.jsx("span",{className:"text-[9px] text-muted-foreground",children:Ze(i.multiplier)}),i.preview&&e.jsx(y,{variant:"secondary",className:"text-[9px] px-1 py-0 h-4",children:"Preview"}),l===i.id&&e.jsx(Fe,{className:"w-3 h-3 text-primary ml-auto"})]})},i.id))]})})]})]})}function es({currentModel:s,opusModel:t,sonnetModel:l,haikuModel:r,models:a,modelsLoading:c,onApplyPreset:o,onUpdateModel:i,onUpdateOpusModel:m,onUpdateSonnetModel:h,onUpdateHaikuModel:x}){return e.jsx(Y,{value:"config",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(K,{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(Pe,{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(y,{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:Xe.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(ae,{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(y,{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:Ye.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(ae,{className:"w-3 h-3"}),n.name]},n.name))})]})]}),e.jsx(X,{}),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(q,{label:"Default Model",description:"Used when no specific tier is requested",value:s,onChange:i,models:a,disabled:c}),e.jsx(q,{label:"Opus (Most capable)",description:"For complex reasoning tasks",value:t||s,onChange:m,models:a,disabled:c}),e.jsx(q,{label:"Sonnet (Balanced)",description:"Balance of speed and capability",value:l||s,onChange:h,models:a,disabled:c}),e.jsx(q,{label:"Haiku (Fast)",description:"Quick responses for simple tasks",value:r||s,onChange:x,models:a,disabled:c})]})]})]})})})}function ss({enabled:s,autoStart:t,port:l,accountType:r,rateLimit:a,waitOnLimit:c,onUpdateEnabled:o,onUpdateAutoStart:i,onUpdatePort:m,onUpdateAccountType:h,onUpdateRateLimit:x,onUpdateWaitOnLimit:n}){return e.jsx(Y,{value:"settings",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(K,{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(b,{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(B,{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(b,{htmlFor:"port",className:"text-xs",children:"Port"}),e.jsx(te,{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(b,{htmlFor:"account-type",className:"text-xs",children:"Account Type"}),e.jsxs(le,{value:r,onValueChange:h,children:[e.jsx(oe,{id:"account-type",className:"max-w-[150px] h-8",children:e.jsx(re,{})}),e.jsxs(ce,{children:[e.jsx(J,{value:"individual",children:"Individual"}),e.jsx(J,{value:"business",children:"Business"}),e.jsx(J,{value:"enterprise",children:"Enterprise"})]})]})]})]}),e.jsx(X,{}),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(b,{htmlFor:"rate-limit",className:"text-xs",children:"Rate Limit (seconds)"}),e.jsx(te,{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(b,{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(B,{id:"wait-on-limit",checked:c,onCheckedChange:n})]})]}),e.jsx(X,{}),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(b,{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(B,{id:"auto-start",checked:t,onCheckedChange:i})]})]})]})})})}function Q({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(de,{value:t,size:"icon",className:"h-6 w-6"})]})]})}function ts({rawSettings:s}){return e.jsx(Y,{value:"info",className:"h-full mt-0 border-0 p-0 data-[state=inactive]:hidden",children:e.jsx(K,{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(Me,{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(de,{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(y,{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(Q,{label:"Run with Copilot",command:"ccs copilot"}),e.jsx(Q,{label:"Authenticate",command:"ccs copilot auth"}),e.jsx(Q,{label:"Start daemon",command:"ccs copilot --start"}),e.jsx(Q,{label:"Stop daemon",command:"ccs copilot --stop"})]})]})]})})})}const as=j.lazy(()=>we(()=>import("./index-QeBLfRj8.js").then(s=>s.aC),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])).then(s=>({default:s.CodeEditor})));function ns({rawJsonContent:s,isRawJsonValid:t,rawJsonEdits:l,rawSettingsEnv:r,onChange:a}){return e.jsx(j.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(Le,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),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(as,{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(ve,{profileEnv:r})})})]})})}function is(){const{config:s,configLoading:t,models:l,modelsLoading:r,rawSettings:a,rawSettingsLoading:c,updateConfigAsync:o,isUpdating:i,saveRawSettingsAsync:m,isSavingRawSettings:h,refetchRawSettings:x}=he(),[n,N]=j.useState({}),[g,S]=j.useState(null),[$,L]=j.useState(!1),A=n.enabled??s?.enabled??!1,T=n.autoStart??s?.auto_start??!1,k=n.port??s?.port??4141,E=n.accountType??s?.account_type??"individual",R=n.model??s?.model??"claude-opus-4-5-20250514",p=n.rateLimit??s?.rate_limit?.toString()??"",O=n.waitOnLimit??s?.wait_on_limit??!0,_=n.opusModel??s?.opus_model??"",I=n.sonnetModel??s?.sonnet_model??"",F=n.haikuModel??s?.haiku_model??"",G=(u,P)=>{N(ge=>({...ge,[u]:P}))},d=u=>{N(P=>({...P,model:u.default,opusModel:u.opus,sonnetModel:u.sonnet,haikuModel:u.haiku})),H.success(`Applied "${u.name}" preset`)},D=j.useMemo(()=>g!==null?g:a?.settings?JSON.stringify(a.settings,null,2):`{
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-D-LYJymx.js","assets/radix-ui-uXQB-q0u.js","assets/react-vendor-B_CU-WTZ.js","assets/tanstack-Coed0rqz.js","assets/notifications-dJQY2-U6.js","assets/utils-CzKF5WmX.js","assets/icons-CMYcel9O.js","assets/form-utils-kUVlZZAO.js","assets/code-highlight-DKN39ySy.js","assets/index-DQAJ1wqP.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{j as e}from"./radix-ui-uXQB-q0u.js";import{B as y,a as v,O as le,Q as oe,U as re,V as ce,a4 as je,a5 as Ne,W as J,G as Y,i as $,L as b,I as te,m as de,al as ve,am as we,S as w,D as ye,E as be,F as z,c as W}from"./index-D-LYJymx.js";import{r as j}from"./react-vendor-B_CU-WTZ.js";import{u as Ce,a as M,b as C}from"./tanstack-Coed0rqz.js";import{S as X,C as Se}from"./confirm-dialog-Dut98zdb.js";import{$ as me,L as Z,aa as ke,j as Fe,O as Pe,Z as ae,I as Me,X as Le,ad as Ae,a as Te,w as Ee,Y as Re,ai as Oe,an as ne,K as _e,a6 as Ie,ar as De,n as ue,o as xe}from"./icons-CMYcel9O.js";import{S as B}from"./switch-MkSHHW1_.js";import{t as H}from"./notifications-dJQY2-U6.js";import"./utils-CzKF5WmX.js";import"./form-utils-kUVlZZAO.js";import"./code-highlight-DKN39ySy.js";import"./alert-dialog-sKmXLtjs.js";const f="/api";async function qe(){const s=await fetch(`${f}/copilot/status`);if(!s.ok)throw new Error("Failed to fetch copilot status");return s.json()}async function Ue(){const s=await fetch(`${f}/copilot/config`);if(!s.ok)throw new Error("Failed to fetch copilot config");return s.json()}async function Qe(){const s=await fetch(`${f}/copilot/models`);if(!s.ok)throw new Error("Failed to fetch copilot models");return s.json()}async function Je(){const s=await fetch(`${f}/copilot/settings/raw`);if(!s.ok)throw new Error("Failed to fetch copilot raw settings");return s.json()}async function $e(s){const t=await fetch(`${f}/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 Ke(s){const t=await fetch(`${f}/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 Ge(){const s=await fetch(`${f}/copilot/auth/start`,{method:"POST"});if(!s.ok)throw new Error("Failed to start auth");return s.json()}async function ze(){const s=await fetch(`${f}/copilot/daemon/start`,{method:"POST"});if(!s.ok)throw new Error("Failed to start daemon");return s.json()}async function Be(){const s=await fetch(`${f}/copilot/daemon/stop`,{method:"POST"});if(!s.ok)throw new Error("Failed to stop daemon");return s.json()}async function He(){const s=await fetch(`${f}/copilot/info`);if(!s.ok)throw new Error("Failed to fetch copilot info");return s.json()}async function Ve(s){const t=await fetch(`${f}/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 he(){const s=Ce(),t=M({queryKey:["copilot-status"],queryFn:qe,refetchInterval:5e3}),l=M({queryKey:["copilot-config"],queryFn:Ue}),r=M({queryKey:["copilot-models"],queryFn:Qe}),a=M({queryKey:["copilot-raw-settings"],queryFn:Je}),c=M({queryKey:["copilot-info"],queryFn:He}),o=C({mutationFn:$e,onSuccess:()=>{s.invalidateQueries({queryKey:["copilot-status"]}),s.invalidateQueries({queryKey:["copilot-config"]}),s.invalidateQueries({queryKey:["copilot-raw-settings"]})}}),i=C({mutationFn:Ke,onSuccess:()=>{s.invalidateQueries({queryKey:["copilot-status"]}),s.invalidateQueries({queryKey:["copilot-config"]}),s.invalidateQueries({queryKey:["copilot-raw-settings"]})}}),m=C({mutationFn:Ge,onSuccess:()=>{s.invalidateQueries({queryKey:["copilot-status"]})}}),h=C({mutationFn:ze,onSuccess:()=>{s.invalidateQueries({queryKey:["copilot-status"]})}}),x=C({mutationFn:Be,onSuccess:()=>{s.invalidateQueries({queryKey:["copilot-status"]})}}),n=C({mutationFn:Ve,onSuccess:()=>{s.invalidateQueries({queryKey:["copilot-status"]}),s.invalidateQueries({queryKey:["copilot-info"]})}});return j.useMemo(()=>({status:t.data,statusLoading:t.isLoading,statusError:t.error,refetchStatus:t.refetch,config:l.data,configLoading:l.isLoading,models:r.data?.models??[],currentModel:r.data?.current,modelsLoading:r.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:c.data,infoLoading:c.isLoading,refetchInfo:c.refetch,install:n.mutate,installAsync:n.mutateAsync,isInstalling:n.isPending}),[t.data,t.isLoading,t.error,t.refetch,l.data,l.isLoading,r.data,r.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,c.data,c.isLoading,c.refetch,n.mutate,n.mutateAsync,n.isPending])}function We({rawSettings:s,rawSettingsLoading:t,isUpdating:l,isSavingRawSettings:r,hasChanges:a,isRawJsonValid:c,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(y,{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(me,{className:`w-4 h-4 ${t?"animate-spin":""}`})}),e.jsx(v,{size:"sm",onClick:i,disabled:l||r||!a||!c,children:l||r?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(ke,{className:"w-4 h-4 mr-1"}),"Save"]})})]})]})}const Xe=[{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"}],Ye=[{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 ie(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 Ze(s){return s==null?null:s===0?"Free":s<1?`${s}x`:s===1?"1x":`${s}x`}function q({label:s,description:t,value:l,onChange:r,models:a,disabled:c}){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(le,{value:l||"",onValueChange:r,disabled:c,children:[e.jsx(oe,{className:"h-9",children:e.jsx(re,{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(y,{variant:"outline",className:`text-[9px] px-1 py-0 h-4 ${ie(o.minPlan)}`,children:o.minPlan})]})})}),e.jsx(ce,{className:"max-h-[300px]",children:e.jsxs(je,{children:[e.jsxs(Ne,{className:"text-xs text-muted-foreground",children:["Available Models (",a.length,")"]}),a.map(i=>e.jsx(J,{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(y,{variant:"outline",className:`text-[9px] px-1 py-0 h-4 ${ie(i.minPlan)}`,children:i.minPlan}),i.multiplier!==void 0&&e.jsx("span",{className:"text-[9px] text-muted-foreground",children:Ze(i.multiplier)}),i.preview&&e.jsx(y,{variant:"secondary",className:"text-[9px] px-1 py-0 h-4",children:"Preview"}),l===i.id&&e.jsx(Fe,{className:"w-3 h-3 text-primary ml-auto"})]})},i.id))]})})]})]})}function es({currentModel:s,opusModel:t,sonnetModel:l,haikuModel:r,models:a,modelsLoading:c,onApplyPreset:o,onUpdateModel:i,onUpdateOpusModel:m,onUpdateSonnetModel:h,onUpdateHaikuModel:x}){return e.jsx(Y,{value:"config",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx($,{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(Pe,{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(y,{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:Xe.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(ae,{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(y,{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:Ye.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(ae,{className:"w-3 h-3"}),n.name]},n.name))})]})]}),e.jsx(X,{}),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(q,{label:"Default Model",description:"Used when no specific tier is requested",value:s,onChange:i,models:a,disabled:c}),e.jsx(q,{label:"Opus (Most capable)",description:"For complex reasoning tasks",value:t||s,onChange:m,models:a,disabled:c}),e.jsx(q,{label:"Sonnet (Balanced)",description:"Balance of speed and capability",value:l||s,onChange:h,models:a,disabled:c}),e.jsx(q,{label:"Haiku (Fast)",description:"Quick responses for simple tasks",value:r||s,onChange:x,models:a,disabled:c})]})]})]})})})}function ss({enabled:s,autoStart:t,port:l,accountType:r,rateLimit:a,waitOnLimit:c,onUpdateEnabled:o,onUpdateAutoStart:i,onUpdatePort:m,onUpdateAccountType:h,onUpdateRateLimit:x,onUpdateWaitOnLimit:n}){return e.jsx(Y,{value:"settings",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx($,{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(b,{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(B,{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(b,{htmlFor:"port",className:"text-xs",children:"Port"}),e.jsx(te,{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(b,{htmlFor:"account-type",className:"text-xs",children:"Account Type"}),e.jsxs(le,{value:r,onValueChange:h,children:[e.jsx(oe,{id:"account-type",className:"max-w-[150px] h-8",children:e.jsx(re,{})}),e.jsxs(ce,{children:[e.jsx(J,{value:"individual",children:"Individual"}),e.jsx(J,{value:"business",children:"Business"}),e.jsx(J,{value:"enterprise",children:"Enterprise"})]})]})]})]}),e.jsx(X,{}),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(b,{htmlFor:"rate-limit",className:"text-xs",children:"Rate Limit (seconds)"}),e.jsx(te,{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(b,{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(B,{id:"wait-on-limit",checked:c,onCheckedChange:n})]})]}),e.jsx(X,{}),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(b,{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(B,{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(de,{value:t,size:"icon",className:"h-6 w-6"})]})]})}function ts({rawSettings:s}){return e.jsx(Y,{value:"info",className:"h-full mt-0 border-0 p-0 data-[state=inactive]:hidden",children:e.jsx($,{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(Me,{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(de,{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(y,{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 as=j.lazy(()=>we(()=>import("./index-D-LYJymx.js").then(s=>s.aw),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])).then(s=>({default:s.CodeEditor})));function ns({rawJsonContent:s,isRawJsonValid:t,rawJsonEdits:l,rawSettingsEnv:r,onChange:a}){return e.jsx(j.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(Le,{className:"w-4 h-4"}),"Invalid JSON syntax"]}),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(as,{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(ve,{profileEnv:r})})})]})})}function is(){const{config:s,configLoading:t,models:l,modelsLoading:r,rawSettings:a,rawSettingsLoading:c,updateConfigAsync:o,isUpdating:i,saveRawSettingsAsync:m,isSavingRawSettings:h,refetchRawSettings:x}=he(),[n,N]=j.useState({}),[g,S]=j.useState(null),[K,L]=j.useState(!1),A=n.enabled??s?.enabled??!1,T=n.autoStart??s?.auto_start??!1,k=n.port??s?.port??4141,E=n.accountType??s?.account_type??"individual",R=n.model??s?.model??"claude-opus-4-5-20250514",p=n.rateLimit??s?.rate_limit?.toString()??"",O=n.waitOnLimit??s?.wait_on_limit??!0,_=n.opusModel??s?.opus_model??"",I=n.sonnetModel??s?.sonnet_model??"",F=n.haikuModel??s?.haiku_model??"",G=(u,P)=>{N(ge=>({...ge,[u]:P}))},d=u=>{N(P=>({...P,model:u.default,opusModel:u.opus,sonnetModel:u.sonnet,haikuModel:u.haiku})),H.success(`Applied "${u.name}" preset`)},D=j.useMemo(()=>g!==null?g:a?.settings?JSON.stringify(a.settings,null,2):`{
|
|
3
3
|
"env": {}
|
|
4
|
-
}`,[g,a]),pe=j.useCallback(u=>{S(u)},[]),ee=j.useMemo(()=>{try{return JSON.parse(D),!0}catch{return!1}},[D]),fe=j.useMemo(()=>{const u=Object.keys(n).length>0,P=g!==null&&g!==JSON.stringify(a?.settings,null,2);return u||P},[n,g,a]),se=async()=>{try{if(Object.keys(n).length>0&&await o({enabled:A,auto_start:T,port:k,account_type:E,model:R,rate_limit:p?parseInt(p,10):null,wait_on_limit:O,opus_model:_||void 0,sonnet_model:I||void 0,haiku_model:F||void 0}),g!==null&&ee){const u=JSON.parse(D);await m({settings:u,expectedMtime:a?.mtime})}N({}),S(null),H.success("Copilot configuration saved")}catch(u){u.message==="CONFLICT"?L(!0):H.error("Failed to save settings")}};return{configLoading:t,rawSettingsLoading:c,modelsLoading:r,isUpdating:i,isSavingRawSettings:h,models:l,rawSettings:a,rawJsonContent:D,rawJsonEdits:g,enabled:A,autoStart:T,port:k,accountType:E,currentModel:R,rateLimit:p,waitOnLimit:O,opusModel:_,sonnetModel:I,haikuModel:F,isRawJsonValid:ee,hasChanges:fe,conflictDialog
|
|
4
|
+
}`,[g,a]),pe=j.useCallback(u=>{S(u)},[]),ee=j.useMemo(()=>{try{return JSON.parse(D),!0}catch{return!1}},[D]),fe=j.useMemo(()=>{const u=Object.keys(n).length>0,P=g!==null&&g!==JSON.stringify(a?.settings,null,2);return u||P},[n,g,a]),se=async()=>{try{if(Object.keys(n).length>0&&await o({enabled:A,auto_start:T,port:k,account_type:E,model:R,rate_limit:p?parseInt(p,10):null,wait_on_limit:O,opus_model:_||void 0,sonnet_model:I||void 0,haiku_model:F||void 0}),g!==null&&ee){const u=JSON.parse(D);await m({settings:u,expectedMtime:a?.mtime})}N({}),S(null),H.success("Copilot configuration saved")}catch(u){u.message==="CONFLICT"?L(!0):H.error("Failed to save settings")}};return{configLoading:t,rawSettingsLoading:c,modelsLoading:r,isUpdating:i,isSavingRawSettings:h,models:l,rawSettings:a,rawJsonContent:D,rawJsonEdits:g,enabled:A,autoStart:T,port:k,accountType:E,currentModel:R,rateLimit:p,waitOnLimit:O,opusModel:_,sonnetModel:I,haikuModel:F,isRawJsonValid:ee,hasChanges:fe,conflictDialog:K,updateField:G,applyPreset:d,handleRawJsonChange:pe,handleSave:se,handleConflictResolve:async u=>{L(!1),u?(await x(),se()):S(null)},refetchRawSettings:x}}function ls(){const{configLoading:s,rawSettingsLoading:t,modelsLoading:l,isUpdating:r,isSavingRawSettings:a,models:c,rawSettings:o,rawJsonContent:i,rawJsonEdits:m,enabled:h,autoStart:x,port:n,accountType:N,currentModel:g,rateLimit:S,waitOnLimit:K,opusModel:L,sonnetModel:A,haikuModel:T,isRawJsonValid:k,hasChanges:E,conflictDialog:R,updateField:p,applyPreset:O,handleRawJsonChange:_,handleSave:I,handleConflictResolve:F,refetchRawSettings:G}=is();return s||t?e.jsxs("div",{className:"space-y-6",children:[e.jsx(w,{className:"h-10 w-full"}),e.jsx(w,{className:"h-10 w-full"}),e.jsx(w,{className:"h-10 w-full"}),e.jsx(w,{className:"h-10 w-full"})]}):e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx(We,{rawSettings:o,rawSettingsLoading:t,isUpdating:r,isSavingRawSettings:a,hasChanges:E,isRawJsonValid:k,onRefresh:()=>G(),onSave:I}),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(ye,{defaultValue:"config",className:"h-full flex flex-col",children:[e.jsx("div",{className:"px-4 pt-4 shrink-0",children:e.jsxs(be,{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(es,{currentModel:g,opusModel:L,sonnetModel:A,haikuModel:T,models:c,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(ss,{enabled:h,autoStart:x,port:n,accountType:N,rateLimit:S,waitOnLimit:K,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(ts,{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(Ae,{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(ns,{rawJsonContent:i,isRawJsonValid:k,rawJsonEdits:m,rawSettingsEnv:o?.settings?.env,onChange:_})]})]}),e.jsx(Se,{open:R,title:"File Modified Externally",description:"This settings file was modified by another process. Overwrite with your changes or discard?",confirmText:"Overwrite",variant:"destructive",onConfirm:()=>F(!0),onCancel:()=>F(!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:r,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(ue,{className:W("w-4 h-4",a==="warning"?"text-yellow-500":"text-green-500")}),e.jsx("span",{className:W("text-xs",a==="warning"?"text-yellow-500":"text-green-500"),children:r||"Yes"})]}):e.jsxs(e.Fragment,{children:[e.jsx(xe,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:r||"No"})]})})]})}function os(){return e.jsxs("div",{className:"space-y-4 p-4",children:[e.jsx(w,{className:"h-8 w-full"}),e.jsx(w,{className:"h-12 w-full"}),e.jsx(w,{className:"h-12 w-full"}),e.jsx(w,{className:"h-12 w-full"})]})}function ws(){const{status:s,statusLoading:t,refetchStatus:l,startAuth:r,isAuthenticating:a,startDaemon:c,isStartingDaemon:o,stopDaemon:i,isStoppingDaemon:m,install:h,isInstalling:x}=he();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(Te,{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(me,{className:W("w-4 h-4",t&&"animate-spin")})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"GitHub Copilot proxy"})]}),e.jsx($,{className:"flex-1",children:t?e.jsx(os,{}):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(Ee,{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:Re,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(Oe,{className:"w-3.5 h-3.5 mr-1.5"}),"Install copilot-api"]})}),s?.installed&&e.jsx(Q,{icon:ne,label:"Integration",status:s?.enabled??!1,statusText:s?.enabled?"Enabled":"Disabled"})]}),s?.installed&&e.jsxs(V,{title:"Auth",children:[e.jsx(Q,{icon:_e,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:()=>r(),disabled:a,children:a?"Authenticating...":"Authenticate"})]}),s?.authenticated&&e.jsxs(V,{title:"Daemon",children:[e.jsx(Q,{icon:Ie,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(De,{className:"w-3.5 h-3.5 mr-1.5"}),m?"Stopping...":"Stop"]}):e.jsxs(v,{size:"sm",variant:"outline",className:"w-full",onClick:()=>c(),disabled:o,children:[e.jsx(ne,{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(ue,{className:"w-3 h-3 text-green-500"}),"Active"]}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(xe,{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(ls,{})})]})}export{ws as CopilotPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./radix-ui-uXQB-q0u.js";import{r as c}from"./react-vendor-B_CU-WTZ.js";import{at as N,au as C,av as w,aq as y,as as G,i as S,a as b,I as p}from"./index-D-LYJymx.js";import{S as k}from"./switch-MkSHHW1_.js";import{$ as j,Q as A,n as R,a9 as L,N as V}from"./icons-CMYcel9O.js";import"./tanstack-Coed0rqz.js";import"./notifications-dJQY2-U6.js";import"./utils-CzKF5WmX.js";import"./form-utils-kUVlZZAO.js";import"./code-highlight-DKN39ySy.js";function _(){const{state:s}=N(),a=C(),[l,d]=c.useState(""),[m,v]=c.useState(""),u=c.useCallback(async()=>{try{a.setGlobalEnvLoading(!0),a.setGlobalEnvError(null);const t=await fetch("/api/global-env");if(!t.ok)throw new Error("Failed to load Global Env config");const o=await t.json();a.setGlobalEnvConfig(o)}catch(t){a.setGlobalEnvError(t.message)}finally{a.setGlobalEnvLoading(!1)}},[a]),i=c.useCallback(async t=>{const o=s.globalEnvConfig;if(!o)return;const x={...o,...t};a.setGlobalEnvConfig(x);try{a.setGlobalEnvSaving(!0),a.setGlobalEnvError(null);const r=await fetch("/api/global-env",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)});if(!r.ok){const n=await r.json();throw new Error(n.error||"Failed to save")}const h=await r.json();a.setGlobalEnvConfig(h.config),a.setGlobalEnvSuccess(!0),setTimeout(()=>a.setGlobalEnvSuccess(!1),1500)}catch(r){a.setGlobalEnvConfig(o),a.setGlobalEnvError(r.message)}finally{a.setGlobalEnvSaving(!1)}},[s.globalEnvConfig,a]),f=c.useCallback(()=>{if(!l.trim()||!s.globalEnvConfig)return;const t={...s.globalEnvConfig.env,[l.trim()]:m};i({env:t}),d(""),v("")},[l,m,s.globalEnvConfig,i]),g=c.useCallback(t=>{if(!s.globalEnvConfig)return;const o={...s.globalEnvConfig.env};delete o[t],i({env:o})},[s.globalEnvConfig,i]);return{config:s.globalEnvConfig,loading:s.globalEnvLoading,saving:s.globalEnvSaving,error:s.globalEnvError,success:s.globalEnvSuccess,newEnvKey:l,setNewEnvKey:d,newEnvValue:m,setNewEnvValue:v,fetchConfig:u,saveConfig:i,addEnvVar:f,removeEnvVar:g}}function F(){const{config:s,loading:a,saving:l,error:d,success:m,newEnvKey:v,setNewEnvKey:u,newEnvValue:i,setNewEnvValue:f,fetchConfig:g,saveConfig:t,addEnvVar:o,removeEnvVar:x}=_(),{fetchRawConfig:r}=w();c.useEffect(()=>{g(),r()},[g,r]);const h=()=>{t({enabled:!s?.enabled})};return a?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[e.jsx(j,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:"Loading..."})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`absolute left-5 right-5 top-20 z-10 transition-all duration-200 ease-out ${d||m?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[d&&e.jsxs(y,{variant:"destructive",className:"py-2 shadow-lg",children:[e.jsx(A,{className:"h-4 w-4"}),e.jsx(G,{children:d})]}),m&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-md border border-green-200 bg-green-50 text-green-700 shadow-lg dark:border-green-900/50 dark:bg-green-900/90 dark:text-green-300",children:[e.jsx(R,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:"Saved"})]})]}),e.jsx(S,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Environment variables injected into all non-Claude subscription profiles (gemini, codex, agy, ghcp, etc.)"}),e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:s?.enabled?"Global Env enabled":"Global Env disabled"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s?.enabled?"Env vars will be injected into third-party profiles":"Env vars will not be injected"})]}),e.jsx(k,{checked:s?.enabled??!0,onCheckedChange:h})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:"Environment Variables"}),s?.env&&Object.keys(s.env).length>0?e.jsx("div",{className:"space-y-2",children:Object.entries(s.env).map(([n,E])=>e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg border bg-background",children:[e.jsx("code",{className:"flex-1 font-mono text-sm truncate",children:n}),e.jsx("span",{className:"text-muted-foreground",children:"="}),e.jsx("code",{className:"font-mono text-sm px-2 py-1 bg-muted rounded",children:E}),e.jsx(b,{variant:"ghost",size:"sm",onClick:()=>x(n),disabled:l,className:"h-8 w-8 p-0 text-destructive hover:text-destructive hover:bg-destructive/10",children:e.jsx(L,{className:"w-4 h-4"})})]},n))}):e.jsx("div",{className:"p-4 rounded-lg border border-dashed text-center text-muted-foreground",children:e.jsx("p",{children:"No environment variables configured"})}),e.jsxs("div",{className:"p-4 rounded-lg border bg-muted/30",children:[e.jsx("h4",{className:"text-sm font-medium mb-3",children:"Add New Variable"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(p,{value:v,onChange:n=>u(n.target.value.toUpperCase()),placeholder:"KEY_NAME",className:"flex-1 font-mono text-sm h-9",disabled:l}),e.jsx("span",{className:"flex items-center text-muted-foreground",children:"="}),e.jsx(p,{value:i,onChange:n=>f(n.target.value),placeholder:"value",className:"flex-1 font-mono text-sm h-9",disabled:l}),e.jsxs(b,{size:"sm",onClick:o,disabled:l||!v.trim(),className:"h-9",children:[e.jsx(V,{className:"w-4 h-4 mr-1"}),"Add"]})]})]}),e.jsxs("div",{className:"p-4 rounded-lg border bg-muted/30",children:[e.jsx("h4",{className:"text-sm font-medium mb-3",children:"Quick Add Common Variables"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[[{key:"DISABLE_BUG_COMMAND",value:"1"},{key:"DISABLE_ERROR_REPORTING",value:"1"},{key:"DISABLE_TELEMETRY",value:"1"}].map(({key:n,value:E})=>!s?.env?.[n]&&e.jsxs(b,{variant:"outline",size:"sm",onClick:()=>{u(n),f(E)},className:"text-xs font-mono",children:["+ ",n]},n)),s?.env&&["DISABLE_BUG_COMMAND","DISABLE_ERROR_REPORTING","DISABLE_TELEMETRY"].every(n=>s.env[n])&&e.jsx("span",{className:"text-sm text-muted-foreground",children:"All common variables are configured"})]})]})]})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(b,{variant:"outline",size:"sm",onClick:()=>{g(),r()},disabled:a||l,className:"w-full",children:[e.jsx(j,{className:`w-4 h-4 mr-2 ${a?"animate-spin":""}`}),"Refresh"]})})]})}export{F as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-uXQB-q0u.js";import{c as l,a as p,y as w,z as y,A as k,B as z,S as h}from"./index-QeBLfRj8.js";import{a as M,u as R,b as W}from"./tanstack-Coed0rqz.js";import{t as g}from"./notifications-dJQY2-U6.js";import{r as j}from"./react-vendor-B_CU-WTZ.js";import{at as v,b as E,t as C,l as S,Z as P,f as O,U as $,S as H,au as I,J as T,s as F,a0 as A}from"./icons-CwFZAiDB.js";import"./utils-CzKF5WmX.js";import"./form-utils-kUVlZZAO.js";import"./code-highlight-DKN39ySy.js";const B={sm:{dimension:80,strokeWidth:6,fontSize:"text-lg",labelSize:"text-[10px]"},md:{dimension:120,strokeWidth:8,fontSize:"text-3xl",labelSize:"text-xs"},lg:{dimension:160,strokeWidth:10,fontSize:"text-4xl",labelSize:"text-sm"}},D={ok:{stroke:"#22C55E",glow:"rgba(34, 197, 94, 0.4)"},warning:{stroke:"#EAB308",glow:"rgba(234, 179, 8, 0.4)"},error:{stroke:"#EF4444",glow:"rgba(239, 68, 68, 0.4)"}};function L({passed:s,total:t,status:r,size:o="md"}){const n=B[o],d=D[r],i=t>0?Math.round(s/t*100):0,a=(n.dimension-n.strokeWidth)/2,c=2*Math.PI*a,f=c-i/100*c,x=n.dimension/2;return e.jsxs("div",{className:"relative inline-flex items-center justify-center",children:[e.jsxs("svg",{width:n.dimension,height:n.dimension,className:"transform -rotate-90",style:{filter:`drop-shadow(0 0 8px ${d.glow})`},children:[e.jsx("circle",{cx:x,cy:x,r:a,fill:"none",stroke:"currentColor",strokeWidth:n.strokeWidth,className:"text-muted/30"}),e.jsx("circle",{cx:x,cy:x,r:a,fill:"none",stroke:d.stroke,strokeWidth:n.strokeWidth,strokeLinecap:"round",strokeDasharray:c,strokeDashoffset:f,className:"transition-all duration-1000 ease-out"}),i>0&&e.jsx("circle",{cx:x+a*Math.cos(i/100*2*Math.PI-Math.PI/2),cy:x+a*Math.sin(i/100*2*Math.PI-Math.PI/2),r:n.strokeWidth/2,fill:d.stroke,className:"animate-pulse",style:{filter:`drop-shadow(0 0 4px ${d.glow})`}})]}),e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[e.jsx("span",{className:l("font-mono font-bold tracking-tight",n.fontSize),children:i}),e.jsx("span",{className:l("font-mono uppercase tracking-widest text-muted-foreground",n.labelSize),children:"health"})]})]})}function b({label:s,value:t,color:r,bgColor:o}){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:l("w-2 h-2 rounded-full animate-pulse",o)}),e.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:s}),e.jsx("span",{className:l("font-mono font-bold text-sm",r),children:t})]})}function q({total:s,passed:t,warnings:r,errors:o,info:n}){const d=t/s*100,i=r/s*100,a=o/s*100,c=n/s*100;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"h-2 rounded-full overflow-hidden bg-muted/50 flex",children:[a>0&&e.jsx("div",{className:"h-full bg-red-500 transition-all duration-500",style:{width:`${a}%`}}),i>0&&e.jsx("div",{className:"h-full bg-yellow-500 transition-all duration-500",style:{width:`${i}%`}}),c>0&&e.jsx("div",{className:"h-full bg-blue-500 transition-all duration-500",style:{width:`${c}%`}}),d>0&&e.jsx("div",{className:"h-full bg-green-500 transition-all duration-500",style:{width:`${d}%`}})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Checks"}),e.jsx("span",{className:"font-mono font-bold text-lg",children:s})]}),e.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[e.jsx(b,{label:"OK",value:t,color:"text-green-500",bgColor:"bg-green-500"}),e.jsx(b,{label:"WARN",value:r,color:"text-yellow-500",bgColor:"bg-yellow-500"}),e.jsx(b,{label:"ERR",value:o,color:"text-red-500",bgColor:"bg-red-500"}),e.jsx(b,{label:"INFO",value:n,color:"text-blue-500",bgColor:"bg-blue-500"})]})]})]})}function G(){return M({queryKey:["health"],queryFn:async()=>(await fetch("/api/health")).json(),refetchInterval:3e4})}function K(){const s=R();return W({mutationFn:async t=>{const r=await fetch(`/api/health/fix/${t}`,{method:"POST"}),o=await r.json();if(!r.ok)throw new Error(o.message);return o},onSuccess:t=>{s.invalidateQueries({queryKey:["health"]}),g.success(t.message)},onError:t=>{g.error(t.message)}})}const Q={ok:{dot:"bg-green-500",label:"OK",labelColor:"text-green-500"},warning:{dot:"bg-yellow-500",label:"WARN",labelColor:"text-yellow-500"},error:{dot:"bg-red-500",label:"ERR",labelColor:"text-red-500"},info:{dot:"bg-blue-500",label:"INFO",labelColor:"text-blue-500"}};function U({check:s}){const t=K(),r=Q[s.status],[o,n]=j.useState(!1),d=s.details||s.fix,i=a=>{navigator.clipboard.writeText(a),g.success("Copied to clipboard")};return d?e.jsx(w,{open:o,onOpenChange:n,children:e.jsxs("div",{className:l("group rounded-lg border transition-all duration-150",o?"border-border bg-muted/30":"border-transparent hover:border-border/50 hover:bg-muted/50"),children:[e.jsx(y,{asChild:!0,children:e.jsxs("button",{className:"w-full flex items-center gap-3 px-3 py-2 text-left",children:[e.jsxs("div",{className:"relative flex items-center justify-center w-4 h-4",children:[e.jsx("div",{className:l("w-2 h-2 rounded-full",r.dot)}),s.status!=="ok"&&e.jsx("div",{className:l("absolute w-2 h-2 rounded-full animate-ping opacity-75",r.dot)})]}),e.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:s.name}),e.jsxs("span",{className:l("font-mono text-xs font-semibold",r.labelColor),children:["[",r.label,"]"]}),e.jsx(E,{className:l("w-4 h-4 text-muted-foreground transition-transform duration-200",o&&"rotate-90")})]})}),e.jsx(k,{children:e.jsxs("div",{className:"px-3 pb-3 pt-1 space-y-2 ml-7",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s.message}),s.details&&e.jsx("pre",{className:"text-xs font-mono text-muted-foreground bg-background/50 rounded p-2 overflow-x-auto border border-border/50",children:s.details}),s.fix&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex-1 flex items-center gap-2 bg-background/50 rounded px-2 py-1.5 border border-border/50",children:[e.jsx(C,{className:"w-3 h-3 text-muted-foreground shrink-0"}),e.jsx("code",{className:"text-xs font-mono flex-1 truncate",children:s.fix}),e.jsx(p,{variant:"ghost",size:"sm",onClick:()=>s.fix&&i(s.fix),className:"h-5 w-5 p-0",children:e.jsx(S,{className:"w-3 h-3"})})]}),s.fixable&&s.status!=="ok"&&e.jsxs(p,{size:"sm",onClick:()=>t.mutate(s.id),disabled:t.isPending,className:"h-7 px-3 text-xs",children:[e.jsx(v,{className:"w-3 h-3 mr-1"}),"Apply Fix"]})]})]})})]})}):e.jsxs("div",{className:l("group flex items-center gap-3 px-3 py-2 rounded-lg","hover:bg-muted/50 transition-colors duration-150","border border-transparent hover:border-border/50"),children:[e.jsxs("div",{className:"relative flex items-center justify-center w-4 h-4",children:[e.jsx("div",{className:l("w-2 h-2 rounded-full",r.dot)}),s.status!=="ok"&&e.jsx("div",{className:l("absolute w-2 h-2 rounded-full animate-ping opacity-75",r.dot)})]}),e.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:s.name}),e.jsxs("span",{className:l("font-mono text-xs font-semibold",r.labelColor),children:["[",r.label,"]"]}),s.fixable&&s.status!=="ok"&&e.jsxs(p,{size:"sm",variant:"ghost",onClick:()=>t.mutate(s.id),disabled:t.isPending,className:"h-6 px-2 text-xs opacity-0 group-hover:opacity-100 transition-opacity",children:[e.jsx(v,{className:"w-3 h-3 mr-1"}),"Fix"]})]})}const Z={Monitor:I,Settings:H,Users:$,Shield:O,Zap:P};function J({group:s,defaultOpen:t=!0}){const[r,o]=j.useState(t),n=Z[s.icon]||I,d=s.checks.filter(m=>m.status==="ok").length,i=s.checks.length,a=s.checks.some(m=>m.status==="error"),c=s.checks.some(m=>m.status==="warning"),f=Math.round(d/i*100),x=a?"text-red-500":c?"text-yellow-500":"text-green-500",u=a?"bg-red-500":c?"bg-yellow-500":"bg-green-500";return e.jsx(w,{open:r,onOpenChange:o,children:e.jsxs("div",{className:l("rounded-lg border transition-all duration-200",a?"border-red-500/30":c?"border-yellow-500/30":"border-border"),children:[e.jsx(y,{asChild:!0,children:e.jsxs("button",{className:l("w-full flex items-center gap-3 p-3 text-left rounded-lg","hover:bg-muted/50 transition-colors duration-150",r&&"rounded-b-none border-b border-border/50"),children:[e.jsx("div",{className:l("p-1.5 rounded-md",a?"bg-red-500/10 text-red-500":c?"bg-yellow-500/10 text-yellow-500":"bg-muted text-muted-foreground"),children:e.jsx(n,{className:"w-4 h-4"})}),e.jsx("span",{className:"flex-1 text-sm font-semibold",children:s.name}),!r&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("div",{className:"w-16 h-1.5 rounded-full bg-muted overflow-hidden",children:e.jsx("div",{className:l("h-full transition-all duration-500",u),style:{width:`${f}%`}})})}),e.jsxs("span",{className:l("font-mono text-xs font-semibold",x),children:[d,"/",i]}),e.jsx(T,{className:l("w-4 h-4 text-muted-foreground transition-transform duration-200",r&&"rotate-180")})]})}),e.jsx(k,{children:e.jsx("div",{className:"p-2 space-y-0.5",children:s.checks.map(m=>e.jsx(U,{check:m},m.id))})})]})})}function V(s){return s.errors>0?"error":s.warnings>0?"warning":"ok"}function X(s){const t=Math.floor((Date.now()-s)/1e3);if(t<5)return"just now";if(t<60)return`${t}s ago`;const r=Math.floor(t/60);return r<60?`${r}m ago`:`${Math.floor(r/60)}h ago`}function Y(s){return[...s].sort((t,r)=>{const o=t.checks.filter(a=>a.status==="error").length,n=r.checks.filter(a=>a.status==="error").length,d=t.checks.filter(a=>a.status==="warning").length,i=r.checks.filter(a=>a.status==="warning").length;return o!==n?n-o:i-d})}function _(){return e.jsxs("div",{className:"font-mono text-sm text-muted-foreground flex items-center gap-2",children:[e.jsx("span",{className:"text-green-500",children:"$"}),e.jsx("span",{children:"ccs doctor"})]})}function ee(){return e.jsxs("div",{className:"p-6 max-w-6xl mx-auto space-y-6",children:[e.jsx("div",{className:"rounded-xl border bg-gradient-to-br from-background to-muted/20 p-6",children:e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsx(h,{className:"w-[120px] h-[120px] rounded-full"}),e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsx(h,{className:"h-5 w-48"}),e.jsx(h,{className:"h-8 w-64"}),e.jsx(h,{className:"h-4 w-32"})]})]})}),e.jsx(h,{className:"h-16 w-full rounded-lg"}),e.jsx("div",{className:"space-y-3",children:[1,2,3,4].map(s=>e.jsx(h,{className:"h-20 rounded-lg"},s))})]})}function ce(){const{data:s,isLoading:t,refetch:r,dataUpdatedAt:o}=G(),n=o,[d,i]=j.useState(0);j.useEffect(()=>{const u=setInterval(()=>i(m=>m+1),1e3);return()=>clearInterval(u)},[]);const a=()=>{navigator.clipboard.writeText("ccs doctor"),g.success("Copied to clipboard")},c=()=>{r(),g.info("Refreshing health checks...")};if(t&&!s)return e.jsx(ee,{});const f=s?V(s.summary):"ok",x=s?.groups?Y(s.groups):[];return e.jsxs("div",{className:"p-6 max-w-6xl mx-auto space-y-6",children:[e.jsxs("div",{className:l("relative overflow-hidden rounded-xl border p-6","bg-gradient-to-br from-background via-background to-muted/30"),children:[e.jsx("div",{className:"absolute inset-0 opacity-[0.02] pointer-events-none",style:{backgroundImage:"repeating-linear-gradient(0deg, transparent, transparent 2px, currentColor 2px, currentColor 3px)"}}),e.jsx("div",{className:"absolute inset-0 opacity-[0.03] pointer-events-none",children:e.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle at 1px 1px, currentColor 1px, transparent 0)",backgroundSize:"24px 24px"}})}),e.jsxs("div",{className:"relative flex flex-col md:flex-row items-start md:items-center gap-6",children:[s&&e.jsx("div",{className:"shrink-0",children:e.jsx(L,{passed:s.summary.passed,total:s.summary.total-s.summary.info,status:f,size:"md"})}),e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsx(_,{}),e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsx("h1",{className:"text-2xl font-bold font-mono tracking-tight",children:"System Health"}),s?.version&&e.jsxs(z,{variant:"outline",className:"font-mono text-xs bg-muted/50",children:["build ",s.version]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(F,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"Last scan:"}),e.jsx("span",{className:"font-mono",children:n?X(n):"--"}),e.jsx("span",{className:"text-muted-foreground",children:"|"}),e.jsx("span",{className:"text-muted-foreground",children:"Auto-refresh:"}),e.jsx("span",{className:"font-mono text-green-500",children:"30s"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsxs(p,{variant:"outline",size:"sm",onClick:a,className:"gap-2 font-mono text-xs",children:[e.jsx(C,{className:"w-3 h-3"}),"ccs doctor",e.jsx(S,{className:"w-3 h-3 opacity-50"})]}),e.jsxs(p,{variant:"outline",size:"sm",onClick:c,disabled:t,className:"gap-2",children:[e.jsx(A,{className:l("w-4 h-4",t&&"animate-spin")}),e.jsx("span",{className:"hidden sm:inline",children:"Refresh"}),e.jsx("kbd",{className:"hidden md:inline-flex h-5 items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground",children:"R"})]})]})]})]}),s&&e.jsx("div",{className:"rounded-lg border bg-card p-4",children:e.jsx(q,{total:s.summary.total,passed:s.summary.passed,warnings:s.summary.warnings,errors:s.summary.errors,info:s.summary.info})}),x.length>0&&e.jsx("div",{className:"space-y-3",children:x.map((u,m)=>e.jsx(J,{group:u,defaultOpen:m<2||u.checks.some(N=>N.status==="error"||N.status==="warning")},u.id))}),e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground border-t pt-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("span",{children:["Version ",e.jsx("span",{className:"font-mono",children:s?.version??"--"})]}),e.jsxs("span",{children:["Platform"," ",e.jsx("span",{className:"font-mono",children:typeof navigator<"u"?navigator.platform:"linux"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-green-500 animate-pulse"}),e.jsx("span",{children:"Live monitoring active"})]})]})]})}export{ce as HealthPage};
|
|
1
|
+
import{j as e}from"./radix-ui-uXQB-q0u.js";import{c as l,a as p,y as w,z as y,A as k,B as z,S as h}from"./index-D-LYJymx.js";import{a as M,u as R,b as W}from"./tanstack-Coed0rqz.js";import{t as g}from"./notifications-dJQY2-U6.js";import{r as j}from"./react-vendor-B_CU-WTZ.js";import{as as v,b as E,T as C,l as S,Z as P,f as O,U as $,S as T,at as I,D as H,a6 as F,$ as A}from"./icons-CMYcel9O.js";import"./utils-CzKF5WmX.js";import"./form-utils-kUVlZZAO.js";import"./code-highlight-DKN39ySy.js";const B={sm:{dimension:80,strokeWidth:6,fontSize:"text-lg",labelSize:"text-[10px]"},md:{dimension:120,strokeWidth:8,fontSize:"text-3xl",labelSize:"text-xs"},lg:{dimension:160,strokeWidth:10,fontSize:"text-4xl",labelSize:"text-sm"}},D={ok:{stroke:"#22C55E",glow:"rgba(34, 197, 94, 0.4)"},warning:{stroke:"#EAB308",glow:"rgba(234, 179, 8, 0.4)"},error:{stroke:"#EF4444",glow:"rgba(239, 68, 68, 0.4)"}};function L({passed:s,total:t,status:r,size:o="md"}){const n=B[o],d=D[r],i=t>0?Math.round(s/t*100):0,a=(n.dimension-n.strokeWidth)/2,c=2*Math.PI*a,f=c-i/100*c,x=n.dimension/2;return e.jsxs("div",{className:"relative inline-flex items-center justify-center",children:[e.jsxs("svg",{width:n.dimension,height:n.dimension,className:"transform -rotate-90",style:{filter:`drop-shadow(0 0 8px ${d.glow})`},children:[e.jsx("circle",{cx:x,cy:x,r:a,fill:"none",stroke:"currentColor",strokeWidth:n.strokeWidth,className:"text-muted/30"}),e.jsx("circle",{cx:x,cy:x,r:a,fill:"none",stroke:d.stroke,strokeWidth:n.strokeWidth,strokeLinecap:"round",strokeDasharray:c,strokeDashoffset:f,className:"transition-all duration-1000 ease-out"}),i>0&&e.jsx("circle",{cx:x+a*Math.cos(i/100*2*Math.PI-Math.PI/2),cy:x+a*Math.sin(i/100*2*Math.PI-Math.PI/2),r:n.strokeWidth/2,fill:d.stroke,className:"animate-pulse",style:{filter:`drop-shadow(0 0 4px ${d.glow})`}})]}),e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[e.jsx("span",{className:l("font-mono font-bold tracking-tight",n.fontSize),children:i}),e.jsx("span",{className:l("font-mono uppercase tracking-widest text-muted-foreground",n.labelSize),children:"health"})]})]})}function b({label:s,value:t,color:r,bgColor:o}){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:l("w-2 h-2 rounded-full animate-pulse",o)}),e.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:s}),e.jsx("span",{className:l("font-mono font-bold text-sm",r),children:t})]})}function q({total:s,passed:t,warnings:r,errors:o,info:n}){const d=t/s*100,i=r/s*100,a=o/s*100,c=n/s*100;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"h-2 rounded-full overflow-hidden bg-muted/50 flex",children:[a>0&&e.jsx("div",{className:"h-full bg-red-500 transition-all duration-500",style:{width:`${a}%`}}),i>0&&e.jsx("div",{className:"h-full bg-yellow-500 transition-all duration-500",style:{width:`${i}%`}}),c>0&&e.jsx("div",{className:"h-full bg-blue-500 transition-all duration-500",style:{width:`${c}%`}}),d>0&&e.jsx("div",{className:"h-full bg-green-500 transition-all duration-500",style:{width:`${d}%`}})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Checks"}),e.jsx("span",{className:"font-mono font-bold text-lg",children:s})]}),e.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[e.jsx(b,{label:"OK",value:t,color:"text-green-500",bgColor:"bg-green-500"}),e.jsx(b,{label:"WARN",value:r,color:"text-yellow-500",bgColor:"bg-yellow-500"}),e.jsx(b,{label:"ERR",value:o,color:"text-red-500",bgColor:"bg-red-500"}),e.jsx(b,{label:"INFO",value:n,color:"text-blue-500",bgColor:"bg-blue-500"})]})]})]})}function G(){return M({queryKey:["health"],queryFn:async()=>(await fetch("/api/health")).json(),refetchInterval:3e4})}function K(){const s=R();return W({mutationFn:async t=>{const r=await fetch(`/api/health/fix/${t}`,{method:"POST"}),o=await r.json();if(!r.ok)throw new Error(o.message);return o},onSuccess:t=>{s.invalidateQueries({queryKey:["health"]}),g.success(t.message)},onError:t=>{g.error(t.message)}})}const Q={ok:{dot:"bg-green-500",label:"OK",labelColor:"text-green-500"},warning:{dot:"bg-yellow-500",label:"WARN",labelColor:"text-yellow-500"},error:{dot:"bg-red-500",label:"ERR",labelColor:"text-red-500"},info:{dot:"bg-blue-500",label:"INFO",labelColor:"text-blue-500"}};function U({check:s}){const t=K(),r=Q[s.status],[o,n]=j.useState(!1),d=s.details||s.fix,i=a=>{navigator.clipboard.writeText(a),g.success("Copied to clipboard")};return d?e.jsx(w,{open:o,onOpenChange:n,children:e.jsxs("div",{className:l("group rounded-lg border transition-all duration-150",o?"border-border bg-muted/30":"border-transparent hover:border-border/50 hover:bg-muted/50"),children:[e.jsx(y,{asChild:!0,children:e.jsxs("button",{className:"w-full flex items-center gap-3 px-3 py-2 text-left",children:[e.jsxs("div",{className:"relative flex items-center justify-center w-4 h-4",children:[e.jsx("div",{className:l("w-2 h-2 rounded-full",r.dot)}),s.status!=="ok"&&e.jsx("div",{className:l("absolute w-2 h-2 rounded-full animate-ping opacity-75",r.dot)})]}),e.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:s.name}),e.jsxs("span",{className:l("font-mono text-xs font-semibold",r.labelColor),children:["[",r.label,"]"]}),e.jsx(E,{className:l("w-4 h-4 text-muted-foreground transition-transform duration-200",o&&"rotate-90")})]})}),e.jsx(k,{children:e.jsxs("div",{className:"px-3 pb-3 pt-1 space-y-2 ml-7",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s.message}),s.details&&e.jsx("pre",{className:"text-xs font-mono text-muted-foreground bg-background/50 rounded p-2 overflow-x-auto border border-border/50",children:s.details}),s.fix&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex-1 flex items-center gap-2 bg-background/50 rounded px-2 py-1.5 border border-border/50",children:[e.jsx(C,{className:"w-3 h-3 text-muted-foreground shrink-0"}),e.jsx("code",{className:"text-xs font-mono flex-1 truncate",children:s.fix}),e.jsx(p,{variant:"ghost",size:"sm",onClick:()=>s.fix&&i(s.fix),className:"h-5 w-5 p-0",children:e.jsx(S,{className:"w-3 h-3"})})]}),s.fixable&&s.status!=="ok"&&e.jsxs(p,{size:"sm",onClick:()=>t.mutate(s.id),disabled:t.isPending,className:"h-7 px-3 text-xs",children:[e.jsx(v,{className:"w-3 h-3 mr-1"}),"Apply Fix"]})]})]})})]})}):e.jsxs("div",{className:l("group flex items-center gap-3 px-3 py-2 rounded-lg","hover:bg-muted/50 transition-colors duration-150","border border-transparent hover:border-border/50"),children:[e.jsxs("div",{className:"relative flex items-center justify-center w-4 h-4",children:[e.jsx("div",{className:l("w-2 h-2 rounded-full",r.dot)}),s.status!=="ok"&&e.jsx("div",{className:l("absolute w-2 h-2 rounded-full animate-ping opacity-75",r.dot)})]}),e.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:s.name}),e.jsxs("span",{className:l("font-mono text-xs font-semibold",r.labelColor),children:["[",r.label,"]"]}),s.fixable&&s.status!=="ok"&&e.jsxs(p,{size:"sm",variant:"ghost",onClick:()=>t.mutate(s.id),disabled:t.isPending,className:"h-6 px-2 text-xs opacity-0 group-hover:opacity-100 transition-opacity",children:[e.jsx(v,{className:"w-3 h-3 mr-1"}),"Fix"]})]})}const Z={Monitor:I,Settings:T,Users:$,Shield:O,Zap:P};function V({group:s,defaultOpen:t=!0}){const[r,o]=j.useState(t),n=Z[s.icon]||I,d=s.checks.filter(m=>m.status==="ok").length,i=s.checks.length,a=s.checks.some(m=>m.status==="error"),c=s.checks.some(m=>m.status==="warning"),f=Math.round(d/i*100),x=a?"text-red-500":c?"text-yellow-500":"text-green-500",u=a?"bg-red-500":c?"bg-yellow-500":"bg-green-500";return e.jsx(w,{open:r,onOpenChange:o,children:e.jsxs("div",{className:l("rounded-lg border transition-all duration-200",a?"border-red-500/30":c?"border-yellow-500/30":"border-border"),children:[e.jsx(y,{asChild:!0,children:e.jsxs("button",{className:l("w-full flex items-center gap-3 p-3 text-left rounded-lg","hover:bg-muted/50 transition-colors duration-150",r&&"rounded-b-none border-b border-border/50"),children:[e.jsx("div",{className:l("p-1.5 rounded-md",a?"bg-red-500/10 text-red-500":c?"bg-yellow-500/10 text-yellow-500":"bg-muted text-muted-foreground"),children:e.jsx(n,{className:"w-4 h-4"})}),e.jsx("span",{className:"flex-1 text-sm font-semibold",children:s.name}),!r&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("div",{className:"w-16 h-1.5 rounded-full bg-muted overflow-hidden",children:e.jsx("div",{className:l("h-full transition-all duration-500",u),style:{width:`${f}%`}})})}),e.jsxs("span",{className:l("font-mono text-xs font-semibold",x),children:[d,"/",i]}),e.jsx(H,{className:l("w-4 h-4 text-muted-foreground transition-transform duration-200",r&&"rotate-180")})]})}),e.jsx(k,{children:e.jsx("div",{className:"p-2 space-y-0.5",children:s.checks.map(m=>e.jsx(U,{check:m},m.id))})})]})})}function J(s){return s.errors>0?"error":s.warnings>0?"warning":"ok"}function X(s){const t=Math.floor((Date.now()-s)/1e3);if(t<5)return"just now";if(t<60)return`${t}s ago`;const r=Math.floor(t/60);return r<60?`${r}m ago`:`${Math.floor(r/60)}h ago`}function Y(s){return[...s].sort((t,r)=>{const o=t.checks.filter(a=>a.status==="error").length,n=r.checks.filter(a=>a.status==="error").length,d=t.checks.filter(a=>a.status==="warning").length,i=r.checks.filter(a=>a.status==="warning").length;return o!==n?n-o:i-d})}function _(){return e.jsxs("div",{className:"font-mono text-sm text-muted-foreground flex items-center gap-2",children:[e.jsx("span",{className:"text-green-500",children:"$"}),e.jsx("span",{children:"ccs doctor"})]})}function ee(){return e.jsxs("div",{className:"p-6 max-w-6xl mx-auto space-y-6",children:[e.jsx("div",{className:"rounded-xl border bg-gradient-to-br from-background to-muted/20 p-6",children:e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsx(h,{className:"w-[120px] h-[120px] rounded-full"}),e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsx(h,{className:"h-5 w-48"}),e.jsx(h,{className:"h-8 w-64"}),e.jsx(h,{className:"h-4 w-32"})]})]})}),e.jsx(h,{className:"h-16 w-full rounded-lg"}),e.jsx("div",{className:"space-y-3",children:[1,2,3,4].map(s=>e.jsx(h,{className:"h-20 rounded-lg"},s))})]})}function ce(){const{data:s,isLoading:t,refetch:r,dataUpdatedAt:o}=G(),n=o,[d,i]=j.useState(0);j.useEffect(()=>{const u=setInterval(()=>i(m=>m+1),1e3);return()=>clearInterval(u)},[]);const a=()=>{navigator.clipboard.writeText("ccs doctor"),g.success("Copied to clipboard")},c=()=>{r(),g.info("Refreshing health checks...")};if(t&&!s)return e.jsx(ee,{});const f=s?J(s.summary):"ok",x=s?.groups?Y(s.groups):[];return e.jsxs("div",{className:"p-6 max-w-6xl mx-auto space-y-6",children:[e.jsxs("div",{className:l("relative overflow-hidden rounded-xl border p-6","bg-gradient-to-br from-background via-background to-muted/30"),children:[e.jsx("div",{className:"absolute inset-0 opacity-[0.02] pointer-events-none",style:{backgroundImage:"repeating-linear-gradient(0deg, transparent, transparent 2px, currentColor 2px, currentColor 3px)"}}),e.jsx("div",{className:"absolute inset-0 opacity-[0.03] pointer-events-none",children:e.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(circle at 1px 1px, currentColor 1px, transparent 0)",backgroundSize:"24px 24px"}})}),e.jsxs("div",{className:"relative flex flex-col md:flex-row items-start md:items-center gap-6",children:[s&&e.jsx("div",{className:"shrink-0",children:e.jsx(L,{passed:s.summary.passed,total:s.summary.total-s.summary.info,status:f,size:"md"})}),e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsx(_,{}),e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsx("h1",{className:"text-2xl font-bold font-mono tracking-tight",children:"System Health"}),s?.version&&e.jsxs(z,{variant:"outline",className:"font-mono text-xs bg-muted/50",children:["build ",s.version]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(F,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"Last scan:"}),e.jsx("span",{className:"font-mono",children:n?X(n):"--"}),e.jsx("span",{className:"text-muted-foreground",children:"|"}),e.jsx("span",{className:"text-muted-foreground",children:"Auto-refresh:"}),e.jsx("span",{className:"font-mono text-green-500",children:"30s"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsxs(p,{variant:"outline",size:"sm",onClick:a,className:"gap-2 font-mono text-xs",children:[e.jsx(C,{className:"w-3 h-3"}),"ccs doctor",e.jsx(S,{className:"w-3 h-3 opacity-50"})]}),e.jsxs(p,{variant:"outline",size:"sm",onClick:c,disabled:t,className:"gap-2",children:[e.jsx(A,{className:l("w-4 h-4",t&&"animate-spin")}),e.jsx("span",{className:"hidden sm:inline",children:"Refresh"}),e.jsx("kbd",{className:"hidden md:inline-flex h-5 items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground",children:"R"})]})]})]})]}),s&&e.jsx("div",{className:"rounded-lg border bg-card p-4",children:e.jsx(q,{total:s.summary.total,passed:s.summary.passed,warnings:s.summary.warnings,errors:s.summary.errors,info:s.summary.info})}),x.length>0&&e.jsx("div",{className:"space-y-3",children:x.map((u,m)=>e.jsx(V,{group:u,defaultOpen:m<2||u.checks.some(N=>N.status==="error"||N.status==="warning")},u.id))}),e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground border-t pt-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("span",{children:["Version ",e.jsx("span",{className:"font-mono",children:s?.version??"--"})]}),e.jsxs("span",{children:["Platform"," ",e.jsx("span",{className:"font-mono",children:typeof navigator<"u"?navigator.platform:"linux"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-green-500 animate-pulse"}),e.jsx("span",{children:"Live monitoring active"})]})]})]})}export{ce as HealthPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as y}from"./react-vendor-B_CU-WTZ.js";const _=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),M=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,c,o)=>o?o.toUpperCase():c.toLowerCase()),d=t=>{const a=M(t);return a.charAt(0).toUpperCase()+a.slice(1)},r=(...t)=>t.filter((a,c,o)=>!!a&&a.trim()!==""&&o.indexOf(a)===c).join(" ").trim(),x=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var v={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const m=y.forwardRef(({color:t="currentColor",size:a=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:h="",children:n,iconNode:k,...s},i)=>y.createElement("svg",{ref:i,...v,width:a,height:a,stroke:t,strokeWidth:o?Number(c)*24/Number(a):c,className:r("lucide",h),...!n&&!x(s)&&{"aria-hidden":"true"},...s},[...k.map(([p,l])=>y.createElement(p,l)),...Array.isArray(n)?n:[n]]));const e=(t,a)=>{const c=y.forwardRef(({className:o,...h},n)=>y.createElement(m,{ref:n,iconNode:a,className:r(`lucide-${_(d(t))}`,`lucide-${t}`,o),...h}));return c.displayName=d(t),c};const f=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],a2=e("activity",f);const g=[["path",{d:"M17 7 7 17",key:"15tmo1"}],["path",{d:"M17 17H7V7",key:"1org7z"}]],t2=e("arrow-down-left",g);const w=[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]],c2=e("arrow-down-right",w);const $=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],o2=e("arrow-left",$);const N=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],n2=e("arrow-right",N);const u=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],y2=e("arrow-up-right",u);const z=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],h2=e("arrow-up",z);const b=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],s2=e("book-open",b);const C=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],d2=e("bot",C);const j=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],r2=e("calendar",j);const q=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],k2=e("chart-column",q);const A=[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]],i2=e("chart-pie",A);const H=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],p2=e("check",H);const V=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],l2=e("chevron-down",V);const L=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],_2=e("chevron-left",L);const S=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],M2=e("chevron-right",S);const R=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],x2=e("chevron-up",R);const E=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],v2=e("circle-alert",E);const P=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],m2=e("circle-check-big",P);const U=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],f2=e("circle-check",U);const B=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],g2=e("circle-x",B);const D=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],w2=e("circle",D);const G=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],$2=e("clock",G);const O=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],N2=e("cloud",O);const W=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],u2=e("code-xml",W);const F=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],z2=e("code",F);const T=[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]],b2=e("coins",T);const Z=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],C2=e("copy",Z);const I=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],j2=e("cpu",I);const K=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],q2=e("database",K);const X=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],A2=e("dollar-sign",X);const J=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],H2=e("download",J);const Q=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],V2=e("ellipsis",Q);const Y=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],L2=e("external-link",Y);const e1=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],S2=e("eye-off",e1);const a1=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],R2=e("eye",a1);const t1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]],E2=e("file-braces",t1);const c1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],P2=e("file-code",c1);const o1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],U2=e("file-exclamation-point",o1);const n1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],B2=e("file-text",n1);const y1=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],D2=e("folder-open",y1);const h1=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],G2=e("gauge",h1);const s1=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],O2=e("git-branch",s1);const d1=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],W2=e("github",d1);const r1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],F2=e("globe",r1);const k1=[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]],T2=e("grip-horizontal",k1);const i1=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Z2=e("grip-vertical",i1);const p1=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],I2=e("heart",p1);const l1=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],K2=e("house",l1);const _1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],X2=e("info",_1);const M1=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],J2=e("key-round",M1);const x1=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],Q2=e("key",x1);const v1=[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]],Y2=e("laptop",v1);const m1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],e0=e("loader-circle",m1);const f1=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],a0=e("monitor",f1);const g1=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],t0=e("moon",g1);const w1=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],c0=e("network",w1);const $1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],o0=e("panel-left",$1);const N1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],n0=e("plus",N1);const u1=[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],y0=e("power-off",u1);const z1=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],h0=e("power",z1);const b1=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],s0=e("radio",b1);const C1=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],d0=e("refresh-cw",C1);const j1=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],r0=e("rotate-ccw",j1);const q1=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],k0=e("rotate-cw",q1);const A1=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],i0=e("save",A1);const H1=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],p0=e("search",H1);const V1=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],l0=e("server",V1);const L1=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],_0=e("settings-2",L1);const S1=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],M0=e("settings",S1);const R1=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],x0=e("shield-check",R1);const E1=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],v0=e("shield",E1);const P1=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],m0=e("sparkles",P1);const U1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],f0=e("square",U1);const B1=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],g0=e("star",B1);const D1=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],w0=e("sun",D1);const G1=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],$0=e("terminal",G1);const O1=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],N0=e("trash-2",O1);const W1=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],u0=e("trending-up",W1);const F1=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],z0=e("triangle-alert",F1);const T1=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],b0=e("user",T1);const Z1=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],C0=e("users",Z1);const I1=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],j0=e("wand-sparkles",I1);const K1=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],q0=e("wifi-off",K1);const X1=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],A0=e("wifi",X1);const J1=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],H0=e("wrench",J1);const Q1=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],V0=e("x",Q1);const Y1=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],L0=e("zap",Y1);export{d0 as $,a2 as A,s2 as B,k2 as C,l2 as D,S2 as E,D2 as F,G2 as G,K2 as H,X2 as I,_0 as J,Q2 as K,e0 as L,t0 as M,n0 as N,m0 as O,o0 as P,v2 as Q,r0 as R,M0 as S,$0 as T,C0 as U,F2 as V,q0 as W,V0 as X,l0 as Y,L0 as Z,P2 as _,W2 as a,_2 as a0,A2 as a1,q2 as a2,c2 as a3,r2 as a4,b2 as a5,j2 as a6,u0 as a7,i2 as a8,N0 as a9,i0 as aa,p0 as ab,j0 as ac,u2 as ad,n2 as ae,E2 as af,o2 as ag,b0 as ah,H2 as ai,g0 as aj,c0 as ak,V2 as al,h2 as am,h0 as an,k0 as ao,f0 as ap,O2 as aq,y0 as ar,H0 as as,a0 as at,d2 as au,N2 as av,Y2 as aw,x0 as ax,M2 as b,w0 as c,R2 as d,A0 as e,v0 as f,I2 as g,m2 as h,w2 as i,p2 as j,J2 as k,C2 as l,L2 as m,f2 as n,g2 as o,Z2 as p,s0 as q,$2 as r,B2 as s,z2 as t,y2 as u,t2 as v,z0 as w,U2 as x,T2 as y,x2 as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./radix-ui-uXQB-q0u.js";import{r as p}from"./react-vendor-B_CU-WTZ.js";import{at as G,au as J,a7 as L,I as S,O as K,Q as X,U as Y,V as Z,W as $,a as _,av as ee,aq as te,as as se,i as re}from"./index-D-LYJymx.js";import{S as A}from"./switch-MkSHHW1_.js";import{av as B,$ as I,e as oe,n as F,W as ae,Q as ne,aw as le}from"./icons-CMYcel9O.js";import"./tanstack-Coed0rqz.js";import"./notifications-dJQY2-U6.js";import"./utils-CzKF5WmX.js";import"./form-utils-kUVlZZAO.js";import"./code-highlight-DKN39ySy.js";function ce(){const{state:s}=G(),t=J(),[n,l]=p.useState(null),[u,f]=p.useState(null),[h,d]=p.useState(null),[j,y]=p.useState(null),b=p.useCallback(async()=>{try{t.setProxyLoading(!0),t.setProxyError(null);const a=await L.cliproxyServer.get();t.setProxyConfig(a)}catch(a){t.setProxyError(a.message)}finally{t.setProxyLoading(!1)}},[t]),v=p.useCallback(async a=>{const c=s.proxyConfig;if(!c)return;const m={remote:{...c.remote,...a.remote},fallback:{...c.fallback,...a.fallback},local:{...c.local,...a.local}};t.setProxyConfig(m),t.setProxyTestResult(null);try{t.setProxySaving(!0),t.setProxyError(null);const r=await L.cliproxyServer.update(a);t.setProxyConfig(r),t.setProxySuccess(!0),setTimeout(()=>t.setProxySuccess(!1),1500)}catch(r){t.setProxyConfig(c),t.setProxyError(r.message)}finally{t.setProxySaving(!1)}},[s.proxyConfig,t]),N=p.useCallback(async a=>{const{host:c,port:m,protocol:r,authToken:i}=a;if(!c){t.setProxyError("Host is required");return}try{t.setProxyTesting(!0),t.setProxyError(null),t.setProxyTestResult(null);const g=m?parseInt(m,10):void 0,x=await L.cliproxyServer.test({host:c,port:g||void 0,protocol:r,authToken:i||void 0});t.setProxyTestResult(x)}catch(g){t.setProxyError(g.message)}finally{t.setProxyTesting(!1)}},[t]);return{config:s.proxyConfig,loading:s.proxyLoading,saving:s.proxySaving,error:s.proxyError,success:s.proxySuccess,testResult:s.proxyTestResult,testing:s.proxyTesting,editedHost:n,setEditedHost:l,editedPort:u,setEditedPort:f,editedAuthToken:h,setEditedAuthToken:d,editedLocalPort:j,setEditedLocalPort:y,fetchConfig:b,saveConfig:v,testConnection:N}}function ie({config:s,saving:t,displayLocalPort:n,setEditedLocalPort:l,onSaveLocalPort:u,onSaveConfig:f}){const h=s.local;return e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:"Local Proxy"}),e.jsxs("div",{className:"space-y-3 p-4 rounded-lg border bg-muted/30",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:"Port"}),e.jsx(S,{type:"number",value:n,onChange:d=>l(d.target.value),onBlur:u,placeholder:"8317",className:"font-mono max-w-32",disabled:t})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:"Auto-start"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Start local proxy automatically when needed"})]}),e.jsx(A,{checked:h.auto_start??!0,onCheckedChange:d=>f({local:{...h,auto_start:d}}),disabled:t})]})]})]})}function de({config:s,saving:t,testing:n,testResult:l,displayHost:u,displayPort:f,displayAuthToken:h,setEditedHost:d,setEditedPort:j,setEditedAuthToken:y,onSaveHost:b,onSavePort:v,onSaveAuthToken:N,onSaveConfig:a,onTestConnection:c}){const m=s.remote,r=i=>i==="https"?443:8317;return e.jsxs("div",{className:"space-y-4 p-4 rounded-lg border bg-muted/30",children:[e.jsxs("h4",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(B,{className:"w-4 h-4"}),"Remote Server Configuration"]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:"Host"}),e.jsx(S,{value:u,onChange:i=>d(i.target.value),onBlur:b,placeholder:"192.168.1.100 or proxy.example.com",className:"font-mono",disabled:t})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("label",{className:"text-sm text-muted-foreground",children:["Port"," ",e.jsxs("span",{className:"text-xs opacity-70",children:["(default: ",r(s.remote.protocol||"http"),")"]})]}),e.jsx(S,{type:"text",inputMode:"numeric",value:f,onChange:i=>j(i.target.value.replace(/\D/g,"")),onBlur:v,placeholder:`Leave empty for ${r(s.remote.protocol||"http")}`,className:"font-mono",disabled:t})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:"Protocol"}),e.jsxs(K,{value:s.remote.protocol||"http",onValueChange:i=>a({remote:{...m,protocol:i}}),disabled:t,children:[e.jsx(X,{children:e.jsx(Y,{})}),e.jsxs(Z,{children:[e.jsx($,{value:"http",children:"HTTP"}),e.jsx($,{value:"https",children:"HTTPS"})]})]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:"Auth Token (optional)"}),e.jsx(S,{type:"password",value:h,onChange:i=>y(i.target.value),onBlur:N,placeholder:"Bearer token for authentication",className:"font-mono",disabled:t})]}),e.jsxs("div",{className:"space-y-3 pt-2",children:[e.jsx(_,{onClick:c,disabled:n||!u,variant:"outline",className:"w-full",children:n?e.jsxs(e.Fragment,{children:[e.jsx(I,{className:"w-4 h-4 mr-2 animate-spin"}),"Testing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"w-4 h-4 mr-2"}),"Test Connection"]})}),l&&e.jsx("div",{className:`p-3 rounded-md ${l.reachable?"bg-green-50 border border-green-200 dark:bg-green-900/20 dark:border-green-900/50":"bg-red-50 border border-red-200 dark:bg-red-900/20 dark:border-red-900/50"}`,children:e.jsx("div",{className:"flex items-center gap-2",children:l.reachable?e.jsxs(e.Fragment,{children:[e.jsx(F,{className:"w-4 h-4 text-green-600 dark:text-green-400"}),e.jsxs("span",{className:"text-sm font-medium text-green-700 dark:text-green-300",children:["Connected (",l.latencyMs,"ms)"]})]}):e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"w-4 h-4 text-red-600 dark:text-red-400"}),e.jsx("span",{className:"text-sm font-medium text-red-700 dark:text-red-300",children:l.error||"Connection failed"})]})})})]})]})}function ve(){const{config:s,loading:t,saving:n,error:l,success:u,testResult:f,testing:h,editedHost:d,setEditedHost:j,editedPort:y,setEditedPort:b,editedAuthToken:v,setEditedAuthToken:N,editedLocalPort:a,setEditedLocalPort:c,fetchConfig:m,saveConfig:r,testConnection:i}=ce(),{fetchRawConfig:g}=ee();if(p.useEffect(()=>{m(),g()},[m,g]),t||!s)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[e.jsx(I,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:"Loading..."})]})});const x=s.remote.enabled??!1,C=s.remote,P=s.fallback,M=s.remote.host??"",W=s.remote.port!==void 0?s.remote.port.toString():"",D=s.remote.auth_token??"",V=(s.local.port??8317).toString(),w=d??M,T=y??W,E=v??D,R=a??V,q=()=>{const o=d??w;o!==s.remote.host&&r({remote:{...C,host:o}}),j(null)},z=()=>{const o=y??T,k=o===""?void 0:parseInt(o,10),H=k&&!isNaN(k)&&k>0?k:void 0;H!==s.remote.port&&r({remote:{...C,port:H}}),b(null)},O=()=>{const o=v??E;o!==s.remote.auth_token&&r({remote:{...C,auth_token:o}}),N(null)},Q=()=>{const o=parseInt(a??R,10);!isNaN(o)&&o!==s.local.port&&r({local:{...s.local,port:o}}),c(null)},U=()=>{i({host:w,port:T,protocol:s.remote.protocol||"http",authToken:E})};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`absolute left-5 right-5 top-20 z-10 transition-all duration-200 ease-out ${l||u?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[l&&e.jsxs(te,{variant:"destructive",className:"py-2 shadow-lg",children:[e.jsx(ne,{className:"h-4 w-4"}),e.jsx(se,{children:l})]}),u&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-md border border-green-200 bg-green-50 text-green-700 shadow-lg dark:border-green-900/50 dark:bg-green-900/90 dark:text-green-300",children:[e.jsx(F,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:"Saved"})]})]}),e.jsx(re,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure local or remote CLIProxy Plus connection for proxy-based profiles"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:"Connection Mode"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("button",{onClick:()=>r({remote:{...C,enabled:!1}}),disabled:n,className:`p-4 rounded-lg border-2 text-left transition-all ${x?"border-border hover:border-muted-foreground/50":"border-primary bg-primary/5"}`,children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx(le,{className:`w-5 h-5 ${x?"text-muted-foreground":"text-primary"}`}),e.jsx("span",{className:"font-medium",children:"Local"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Run CLIProxy Plus binary on this machine"})]}),e.jsxs("button",{onClick:()=>r({remote:{...C,enabled:!0}}),disabled:n,className:`p-4 rounded-lg border-2 text-left transition-all ${x?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"}`,children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx(B,{className:`w-5 h-5 ${x?"text-primary":"text-muted-foreground"}`}),e.jsx("span",{className:"font-medium",children:"Remote"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Connect to a remote CLIProxy Plus server"})]})]})]}),x&&e.jsx(de,{config:s,saving:n,testing:h,testResult:f,displayHost:w,displayPort:T,displayAuthToken:E,setEditedHost:j,setEditedPort:b,setEditedAuthToken:N,onSaveHost:q,onSavePort:z,onSaveAuthToken:O,onSaveConfig:r,onTestConnection:U}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:"Fallback Settings"}),e.jsxs("div",{className:"space-y-3 p-4 rounded-lg border bg-muted/30",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:"Enable fallback to local"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Use local proxy if remote is unreachable"})]}),e.jsx(A,{checked:P.enabled??!0,onCheckedChange:o=>r({fallback:{...P,enabled:o}}),disabled:n||!x})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:"Auto-start local proxy"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Automatically start local proxy on fallback"})]}),e.jsx(A,{checked:P.auto_start??!1,onCheckedChange:o=>r({fallback:{...P,auto_start:o}}),disabled:n||!x||!P.enabled})]})]})]}),!x&&e.jsx(ie,{config:s,saving:n,displayLocalPort:R,setEditedLocalPort:c,onSaveLocalPort:Q,onSaveConfig:r})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>{m(),g()},disabled:t||n,className:"w-full",children:[e.jsx(I,{className:`w-4 h-4 mr-2 ${t?"animate-spin":""}`}),"Refresh"]})})]})}export{ve as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./radix-ui-uXQB-q0u.js";import{r as i}from"./react-vendor-B_CU-WTZ.js";import{at as $,au as P,I as F,av as U,aq as _,as as z,i as B,a as A}from"./index-D-LYJymx.js";import{S as K}from"./switch-MkSHHW1_.js";import{T as q,j as D,z as Y,D as J,m as Q,$ as L,Q as V,n as X}from"./icons-CMYcel9O.js";import"./tanstack-Coed0rqz.js";import"./notifications-dJQY2-U6.js";import"./utils-CzKF5WmX.js";import"./form-utils-kUVlZZAO.js";import"./code-highlight-DKN39ySy.js";function Z(){const{state:s}=$(),a=P(),[d,l]=i.useState(""),[o,m]=i.useState(""),[f,h]=i.useState(!1),[j,u]=i.useState(!1),S=i.useCallback(async()=>{try{a.setWebSearchLoading(!0),a.setWebSearchError(null);const t=await fetch("/api/websearch");if(!t.ok)throw new Error("Failed to load WebSearch config");const r=await t.json();a.setWebSearchConfig(r)}catch(t){a.setWebSearchError(t.message)}finally{a.setWebSearchLoading(!1)}},[a]),v=i.useCallback(async()=>{try{a.setWebSearchStatusLoading(!0);const t=await fetch("/api/websearch/status");if(!t.ok)throw new Error("Failed to load status");const r=await t.json();a.setWebSearchStatus(r)}catch{}finally{a.setWebSearchStatusLoading(!1)}},[a]),p=i.useCallback(async t=>{const r=s.webSearchConfig;if(!r)return;const w={...r,...t};a.setWebSearchConfig(w);try{a.setWebSearchSaving(!0),a.setWebSearchError(null);const n=await fetch("/api/websearch",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(w)});if(!n.ok){const k=await n.json();throw new Error(k.error||"Failed to save")}const C=await n.json();a.setWebSearchConfig(C.websearch),a.setWebSearchSuccess(!0),setTimeout(()=>a.setWebSearchSuccess(!1),1500)}catch(n){a.setWebSearchConfig(r),a.setWebSearchError(n.message)}finally{a.setWebSearchSaving(!1)}},[s.webSearchConfig,a]);i.useEffect(()=>{s.webSearchConfig&&(l(s.webSearchConfig.providers?.gemini?.model??"gemini-2.5-flash"),m(s.webSearchConfig.providers?.opencode?.model??"opencode/grok-code"))},[s.webSearchConfig]);const x=i.useCallback(async()=>{const t=s.webSearchConfig?.providers?.gemini?.model??"gemini-2.5-flash";if(d!==t){const r=s.webSearchConfig?.providers||{};await p({providers:{...r,gemini:{...r.gemini,model:d}}}),h(!0),setTimeout(()=>h(!1),2e3)}},[d,s.webSearchConfig,p]),g=i.useCallback(async()=>{const t=s.webSearchConfig?.providers?.opencode?.model??"opencode/grok-code";if(o!==t){const r=s.webSearchConfig?.providers||{};await p({providers:{...r,opencode:{...r.opencode,model:o}}}),u(!0),setTimeout(()=>u(!1),2e3)}},[o,s.webSearchConfig,p]);return{config:s.webSearchConfig,status:s.webSearchStatus,loading:s.webSearchLoading,statusLoading:s.webSearchStatusLoading,saving:s.webSearchSaving,error:s.webSearchError,success:s.webSearchSuccess,geminiModelInput:d,setGeminiModelInput:l,opencodeModelInput:o,setOpencodeModelInput:m,geminiModelSaved:f,opencodeModelSaved:j,fetchConfig:S,fetchStatus:v,saveConfig:p,saveGeminiModel:x,saveOpencodeModel:g}}function O({name:s,label:a,badge:d,badgeColor:l,enabled:o,installed:m,statusLoading:f,saving:h,onToggle:j,modelInput:u,setModelInput:S,onModelBlur:v,modelSaved:p,modelPlaceholder:x,showHint:g,setShowHint:t,installCmd:r,docsUrl:w,hintColor:n}){const C=l==="green"?"bg-green-500/10 text-green-600":l==="blue"?"bg-blue-500/10 text-blue-600":"bg-purple-500/10 text-purple-600",k=n==="amber"?"bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-300":n==="blue"?"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300":"bg-purple-50 dark:bg-purple-900/20 text-purple-700 dark:text-purple-300",y=n==="amber"?"bg-amber-100 dark:bg-amber-900/40":n==="blue"?"bg-blue-100 dark:bg-blue-900/40":"bg-purple-100 dark:bg-purple-900/40",E=n==="amber"?"text-amber-600 dark:text-amber-400":n==="blue"?"text-blue-600 dark:text-blue-400":"text-purple-600 dark:text-purple-400",M=s==="opencode"?"OpenCode":s.charAt(0).toUpperCase()+s.slice(1);return e.jsxs("div",{className:`rounded-lg border transition-colors ${o?"border-primary border-l-4":"border-border"}`,children:[e.jsxs("div",{className:"flex items-center justify-between p-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(q,{className:`w-5 h-5 ${o?"text-primary":"text-muted-foreground"}`}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"font-mono font-medium",children:s}),e.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded font-medium ${C}`,children:d}),m?e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-500/10 text-green-600 font-medium",children:"installed"}):e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-amber-500/10 text-amber-600 font-medium",children:"not installed"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:a})]})]}),e.jsx(K,{checked:o,onCheckedChange:j,disabled:h||!m})]}),o&&u!==void 0&&S&&v&&e.jsx("div",{className:"px-4 pb-4 pt-0",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-muted-foreground whitespace-nowrap",children:"Model:"}),e.jsx(F,{value:u,onChange:I=>S(I.target.value),onBlur:v,placeholder:x,className:"h-8 text-sm font-mono",disabled:h}),p&&e.jsxs("span",{className:"flex items-center gap-1 text-green-600 dark:text-green-400 text-xs animate-in fade-in duration-200",children:[e.jsx(D,{className:"w-3.5 h-3.5"}),"Saved"]})]})}),!m&&!f&&e.jsxs("div",{className:"px-4 pb-4 pt-0 border-t border-border/50",children:[e.jsxs("button",{onClick:()=>t(!g),className:`flex items-center gap-2 text-sm hover:underline w-full py-2 ${E}`,children:[g?e.jsx(Y,{className:"w-4 h-4"}):e.jsx(J,{className:"w-4 h-4"}),"How to install ",M," CLI"]}),g&&e.jsxs("div",{className:`mt-2 p-3 rounded-md text-sm ${k}`,children:[e.jsxs("p",{className:"mb-2",children:["Install globally"," ",d==="GROK_API_KEY"?"(requires xAI API key)":"(FREE tier available)",":"]}),e.jsx("code",{className:`text-sm px-2 py-1 rounded font-mono block mb-2 ${y}`,children:r}),e.jsxs("a",{href:w,target:"_blank",rel:"noopener noreferrer",className:"hover:underline inline-flex items-center gap-1",children:[e.jsx(Q,{className:"w-3 h-3"}),"View documentation"]})]})]})]})}function ce(){const{config:s,status:a,loading:d,statusLoading:l,saving:o,error:m,success:f,geminiModelInput:h,setGeminiModelInput:j,opencodeModelInput:u,setOpencodeModelInput:S,geminiModelSaved:v,opencodeModelSaved:p,fetchConfig:x,fetchStatus:g,saveConfig:t,saveGeminiModel:r,saveOpencodeModel:w}=Z(),{fetchRawConfig:n}=U(),[C,k]=i.useState(!1),[y,E]=i.useState(!1),[M,I]=i.useState(!1);i.useEffect(()=>{x(),g(),n()},[x,g,n]);const N=s?.providers?.gemini?.enabled??!1,W=s?.providers?.grok?.enabled??!1,G=s?.providers?.opencode?.enabled??!1,H=()=>{const c=s?.providers||{},b=c.gemini?.enabled??!1;t({enabled:!b||W||G,providers:{...c,gemini:{...c.gemini,enabled:!b}}})},T=()=>{const c=s?.providers||{},b=c.grok?.enabled??!1;t({enabled:N||!b||G,providers:{...c,grok:{...c.grok,enabled:!b}}})},R=()=>{const c=s?.providers||{},b=c.opencode?.enabled??!1;t({enabled:N||W||!b,providers:{...c,opencode:{...c.opencode,enabled:!b}}})};return d?e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[e.jsx(L,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:"Loading..."})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`absolute left-5 right-5 top-20 z-10 transition-all duration-200 ease-out ${m||f?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[m&&e.jsxs(_,{variant:"destructive",className:"py-2 shadow-lg",children:[e.jsx(V,{className:"h-4 w-4"}),e.jsx(z,{children:m})]}),f&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-md border border-green-200 bg-green-50 text-green-700 shadow-lg dark:border-green-900/50 dark:bg-green-900/90 dark:text-green-300",children:[e.jsx(X,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:"Saved"})]})]}),e.jsx(B,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"CLI-based web search for third-party profiles (gemini, codex, agy, etc.)"}),e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:N?"WebSearch enabled":"WebSearch disabled"}),l?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Checking status..."}):a?.readiness?e.jsx("p",{className:"text-sm text-muted-foreground",children:a.readiness.message}):null]}),e.jsx(A,{variant:"ghost",size:"sm",onClick:g,disabled:l,children:e.jsx(L,{className:`w-4 h-4 ${l?"animate-spin":""}`})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:"Providers"}),e.jsx(O,{name:"gemini",label:"Google Gemini CLI (1000 req/day free)",badge:"FREE",badgeColor:"green",enabled:N,installed:a?.geminiCli?.installed??!1,statusLoading:l,saving:o,onToggle:H,modelInput:h,setModelInput:j,onModelBlur:r,modelSaved:v,modelPlaceholder:"gemini-2.5-flash",showHint:C,setShowHint:k,installCmd:"npm install -g @google/gemini-cli",docsUrl:"https://github.com/google-gemini/gemini-cli",hintColor:"amber"}),e.jsx(O,{name:"opencode",label:"OpenCode (web search via Zen)",badge:"FREE",badgeColor:"green",enabled:G,installed:a?.opencodeCli?.installed??!1,statusLoading:l,saving:o,onToggle:R,modelInput:u,setModelInput:S,onModelBlur:w,modelSaved:p,modelPlaceholder:"opencode/grok-code",showHint:y,setShowHint:E,installCmd:"curl -fsSL https://opencode.ai/install | bash",docsUrl:"https://github.com/sst/opencode",hintColor:"purple"}),e.jsx(O,{name:"grok",label:"xAI Grok CLI (web + X search)",badge:"GROK_API_KEY",badgeColor:"blue",enabled:W,installed:a?.grokCli?.installed??!1,statusLoading:l,saving:o,onToggle:T,showHint:M,setShowHint:I,installCmd:"npm install -g @vibe-kit/grok-cli",docsUrl:"https://github.com/superagent-ai/grok-cli",hintColor:"blue"})]})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(A,{variant:"outline",size:"sm",onClick:()=>{x(),n()},disabled:d||o,className:"w-full",children:[e.jsx(L,{className:`w-4 h-4 mr-2 ${d?"animate-spin":""}`}),"Refresh"]})})]})}export{ce as default};
|