@kaitranntt/ccs 7.11.0 → 7.11.1-dev.2
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/auth/profile-detector.d.ts +2 -0
- package/dist/auth/profile-detector.d.ts.map +1 -1
- package/dist/auth/profile-detector.js +3 -0
- package/dist/auth/profile-detector.js.map +1 -1
- package/dist/ccs.js +5 -1
- package/dist/ccs.js.map +1 -1
- package/dist/cliproxy/cliproxy-executor.d.ts.map +1 -1
- package/dist/cliproxy/cliproxy-executor.js +12 -1
- package/dist/cliproxy/cliproxy-executor.js.map +1 -1
- package/dist/cliproxy/config-generator.d.ts +18 -0
- package/dist/cliproxy/config-generator.d.ts.map +1 -1
- package/dist/cliproxy/config-generator.js +92 -11
- package/dist/cliproxy/config-generator.js.map +1 -1
- package/dist/cliproxy/proxy-target-resolver.d.ts.map +1 -1
- package/dist/cliproxy/proxy-target-resolver.js +7 -7
- package/dist/cliproxy/proxy-target-resolver.js.map +1 -1
- package/dist/cliproxy/remote-proxy-client.d.ts.map +1 -1
- package/dist/cliproxy/remote-proxy-client.js +4 -12
- package/dist/cliproxy/remote-proxy-client.js.map +1 -1
- package/dist/ui/assets/{accounts-CmzZXhfc.js → accounts-pORYyZZq.js} +1 -1
- package/dist/ui/assets/{alert-dialog-zpnBn2CA.js → alert-dialog-CJDKpxIB.js} +1 -1
- package/dist/ui/assets/api-CHvz6Qix.js +1 -0
- package/dist/ui/assets/{auth-section-YgJ7Cv--.js → auth-section-DHEHxsUD.js} +1 -1
- package/dist/ui/assets/{card-dTUi3LxW.js → card-D1Y227zA.js} +1 -1
- package/dist/ui/assets/{cliproxy-control-panel-BRCh_7b3.js → cliproxy-control-panel-mvHu3jmO.js} +1 -1
- package/dist/ui/assets/cliproxy-eIVzg8mX.js +3 -0
- package/dist/ui/assets/{confirm-dialog-ByfOsjk9.js → confirm-dialog-vEOgFLmZ.js} +1 -1
- package/dist/ui/assets/copilot-CeO1DqOb.js +4 -0
- package/dist/ui/assets/{globalenv-section-BEpPTvKo.js → globalenv-section-C8R1-g9k.js} +1 -1
- package/dist/ui/assets/{health-DTRd-dXk.js → health-S9iu8TAT.js} +1 -1
- package/dist/ui/assets/{index-BLoAjpcw.js → index-BF0Dx6OT.js} +1 -1
- package/dist/ui/assets/{index-Bfwze8tN.js → index-C_C5u43y.js} +1 -1
- package/dist/ui/assets/{index-QeBLfRj8.js → index-Dt3tYzqM.js} +11 -11
- package/dist/ui/assets/{index-CEZrgkam.js → index-LvT3edLL.js} +1 -1
- package/dist/ui/assets/{shared-BgDSyHKz.js → shared-O0SpcFPN.js} +1 -1
- package/dist/ui/assets/{switch-B0PXGFIv.js → switch-D6yNT7Xn.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/dist/web-server/routes/profile-routes.d.ts.map +1 -1
- package/dist/web-server/routes/profile-routes.js +9 -0
- package/dist/web-server/routes/profile-routes.js.map +1 -1
- package/dist/web-server/routes/settings-routes.d.ts.map +1 -1
- package/dist/web-server/routes/settings-routes.js +19 -0
- package/dist/web-server/routes/settings-routes.js.map +1 -1
- package/dist/web-server/routes/variant-routes.d.ts.map +1 -1
- package/dist/web-server/routes/variant-routes.js +6 -1
- package/dist/web-server/routes/variant-routes.js.map +1 -1
- package/package.json +1 -1
- package/dist/ui/assets/api-DFbZVPK4.js +0 -1
- package/dist/ui/assets/cliproxy-CsqKCFzj.js +0 -3
- package/dist/ui/assets/copilot-BQscualu.js +0 -4
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-QeBLfRj8.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-CwFZAiDB.js","assets/form-utils-kUVlZZAO.js","assets/code-highlight-DKN39ySy.js","assets/index-oS2cgEFl.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 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):`{
|
|
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:$,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:$,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:$,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 U({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(K,{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(U,{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(U,{icon:ne,label:"Integration",status:s?.enabled??!1,statusText:s?.enabled?"Enabled":"Disabled"})]}),s?.installed&&e.jsxs(V,{title:"Auth",children:[e.jsx(U,{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(U,{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};
|