@kaitranntt/ccs 7.43.0-dev.13 → 7.43.0-dev.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -0
- package/dist/commands/cursor-command-display.d.ts +6 -0
- package/dist/commands/cursor-command-display.d.ts.map +1 -0
- package/dist/commands/cursor-command-display.js +100 -0
- package/dist/commands/cursor-command-display.js.map +1 -0
- package/dist/commands/cursor-command.d.ts +1 -1
- package/dist/commands/cursor-command.d.ts.map +1 -1
- package/dist/commands/cursor-command.js +103 -106
- package/dist/commands/cursor-command.js.map +1 -1
- package/dist/commands/help-command.d.ts.map +1 -1
- package/dist/commands/help-command.js +3 -0
- package/dist/commands/help-command.js.map +1 -1
- package/dist/cursor/cursor-daemon-entry.d.ts +14 -0
- package/dist/cursor/cursor-daemon-entry.d.ts.map +1 -0
- package/dist/cursor/cursor-daemon-entry.js +236 -0
- package/dist/cursor/cursor-daemon-entry.js.map +1 -0
- package/dist/cursor/cursor-daemon.d.ts +2 -2
- package/dist/cursor/cursor-daemon.d.ts.map +1 -1
- package/dist/cursor/cursor-daemon.js +44 -23
- package/dist/cursor/cursor-daemon.js.map +1 -1
- package/dist/cursor/cursor-models.d.ts +1 -1
- package/dist/cursor/cursor-models.d.ts.map +1 -1
- package/dist/cursor/cursor-models.js +1 -1
- package/dist/cursor/cursor-models.js.map +1 -1
- package/dist/cursor/index.d.ts +1 -1
- package/dist/cursor/index.d.ts.map +1 -1
- package/dist/cursor/index.js +3 -1
- package/dist/cursor/index.js.map +1 -1
- package/dist/cursor/types.d.ts +3 -4
- package/dist/cursor/types.d.ts.map +1 -1
- package/dist/ui/assets/accounts-CgWMEM-H.js +1 -0
- package/dist/ui/assets/{alert-dialog-B9Uu5j7u.js → alert-dialog-DfmPw3Uo.js} +1 -1
- package/dist/ui/assets/api-B8PJnqh-.js +1 -0
- package/dist/ui/assets/auth-section-C2zorVIh.js +1 -0
- package/dist/ui/assets/{backups-section-DvQ6124z.js → backups-section-2ekrKuhL.js} +1 -1
- package/dist/ui/assets/{cliproxy-CwCnK3nw.js → cliproxy-CcNxxdqw.js} +1 -1
- package/dist/ui/assets/{cliproxy-control-panel-CIXluDh-.js → cliproxy-control-panel-6mA9xEG2.js} +1 -1
- package/dist/ui/assets/{confirm-dialog-B75dfynE.js → confirm-dialog-CGx7ZD2g.js} +1 -1
- package/dist/ui/assets/{copilot-DbnYMqPk.js → copilot-rmVACCSc.js} +2 -2
- package/dist/ui/assets/cursor-DFQu6Ztc.js +1 -0
- package/dist/ui/assets/globalenv-section-BHdZLGWK.js +1 -0
- package/dist/ui/assets/{health-DYrD6KCx.js → health-BP_x4Is4.js} +1 -1
- package/dist/ui/assets/{icons-D5eAI-GR.js → icons-G0rMFC4M.js} +1 -1
- package/dist/ui/assets/{index-DyigGY6D.js → index-530Q5dXw.js} +18 -18
- package/dist/ui/assets/{index-XGsZr8Ow.js → index-BoO0EOgA.js} +1 -1
- package/dist/ui/assets/{index-Bmb4X9Km.js → index-Boc8Hrz5.js} +1 -1
- package/dist/ui/assets/index-Bqle3SG4.css +1 -0
- package/dist/ui/assets/{index-dfia1xYK.js → index-BxHrM_le.js} +1 -1
- package/dist/ui/assets/{index-C27PqItS.js → index-Ce-93Swf.js} +1 -1
- package/dist/ui/assets/{proxy-status-widget-DiMcpCvZ.js → proxy-status-widget-CNxExMuD.js} +1 -1
- package/dist/ui/assets/shared-BhZjemmr.js +1 -0
- package/dist/ui/assets/{switch-BKMDc-FD.js → switch-Dwq92XO7.js} +1 -1
- package/dist/ui/index.html +3 -3
- package/dist/web-server/routes/cursor-routes.d.ts +10 -0
- package/dist/web-server/routes/cursor-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cursor-routes.js +54 -46
- package/dist/web-server/routes/cursor-routes.js.map +1 -1
- package/dist/web-server/routes/cursor-settings-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cursor-settings-routes.js +43 -5
- package/dist/web-server/routes/cursor-settings-routes.js.map +1 -1
- package/package.json +1 -1
- package/dist/ui/assets/accounts-CQjv5gdg.js +0 -1
- package/dist/ui/assets/api-8PhE29RT.js +0 -1
- package/dist/ui/assets/auth-section-DOVsMam9.js +0 -1
- package/dist/ui/assets/globalenv-section-D1RvXzRJ.js +0 -1
- package/dist/ui/assets/index-ByiEOnlQ.css +0 -1
- package/dist/ui/assets/shared-DqLXV07P.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-qEZD5MMp.js";import{r as a}from"./react-vendor-CNOkPC89.js";import{
|
|
1
|
+
import{j as e}from"./radix-ui-qEZD5MMp.js";import{r as a}from"./react-vendor-CNOkPC89.js";import{aQ as A,aS as R,b as C,m as M,L as D,X as L,Y as $,Z as F,_ as K,$ as z}from"./index-530Q5dXw.js";import{S as H}from"./switch-Dwq92XO7.js";import{R as k,a2 as U,r as O,a4 as G,I as V}from"./icons-G0rMFC4M.js";import"./tanstack-De4wvi8X.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-C-pVd1--.js";import"./code-highlight-BRUf_pqB.js";const p={mode:"auto",tier_defaults:{opus:"high",sonnet:"medium",haiku:"low"},show_warnings:!0},T=1e4;function W(){const[n,i]=a.useState(null),[g,u]=a.useState(!0),[b,c]=a.useState(!1),[j,o]=a.useState(null),[v,s]=a.useState(!1),l=a.useRef(void 0),N=a.useCallback(async()=>{const r=new AbortController,m=setTimeout(()=>r.abort(),T);try{u(!0),o(null);const t=await fetch("/api/thinking",{signal:r.signal});if(clearTimeout(m),!t.ok)throw t.headers.get("content-type")?.includes("text/html")?new Error(`Server error (${t.status})`):new Error("Failed to load Thinking config");const x=await t.json();i(x.config||p),l.current=x.lastModified}catch(t){clearTimeout(m),t.name==="AbortError"?o("Request timeout - please try again"):o(t.message),i(p)}finally{u(!1)}return()=>r.abort()},[]),d=a.useCallback(async r=>{const m=n||p,t={...m,...r};i(t);const x=new AbortController,w=setTimeout(()=>x.abort(),T);try{c(!0),o(null);const f={...t,lastModified:l.current},h=await fetch("/api/thinking",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(f),signal:x.signal});if(clearTimeout(w),!h.ok){if(h.headers.get("content-type")?.includes("text/html"))throw new Error(`Server error (${h.status})`);const I=await h.json();throw h.status===409?new Error("Config changed by another session. Refreshing..."):new Error(I.error||"Failed to save")}const y=await h.json();i(y.config),l.current=y.lastModified,s(!0),setTimeout(()=>s(!1),1500)}catch(f){clearTimeout(w),i(m),f.name==="AbortError"?o("Request timeout - please try again"):(o(f.message),f.message.includes("another session")&&setTimeout(()=>N(),1e3))}finally{c(!1)}},[n,N]),S=a.useCallback(r=>{d({mode:r})},[d]),E=a.useCallback((r,m)=>{const t=n?.tier_defaults||p.tier_defaults;d({tier_defaults:{...t,[r]:m}})},[n,d]),_=a.useCallback(r=>{d({show_warnings:r})},[d]);return{config:n||p,loading:g,saving:b,error:j,success:v,fetchConfig:N,saveConfig:d,setMode:S,setTierDefault:E,setShowWarnings:_}}const q=[{value:"minimal",label:"Minimal (512 tokens)"},{value:"low",label:"Low (1K tokens)"},{value:"medium",label:"Medium (8K tokens)"},{value:"high",label:"High (24K tokens)"},{value:"xhigh",label:"Extra High (32K tokens)"},{value:"auto",label:"Auto (dynamic)"}];function ne(){const{config:n,loading:i,saving:g,error:u,success:b,fetchConfig:c,setMode:j,setTierDefault:o,setShowWarnings:v}=W();return a.useEffect(()=>{c()},[c]),i?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(k,{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 ${u||b?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[u&&e.jsx(A,{variant:"destructive",className:"py-2 shadow-lg",children:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(U,{className:"h-4 w-4"}),e.jsx(R,{children:u})]}),e.jsxs(C,{variant:"outline",size:"sm",onClick:c,className:"h-7 px-2 text-xs border-destructive/50 hover:bg-destructive/10",children:[e.jsx(k,{className:"w-3 h-3 mr-1"}),"Retry"]})]})}),b&&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(O,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:"Saved"})]})]}),e.jsx(M,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(G,{className:"w-5 h-5 text-primary"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure extended thinking/reasoning for supported models."})]}),e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800",children:[e.jsx(V,{className:"w-4 h-4 text-blue-600 dark:text-blue-400 shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-blue-700 dark:text-blue-300",children:[e.jsx("p",{className:"font-medium",children:"Supported Providers"}),e.jsxs("ul",{className:"mt-1 space-y-0.5 text-blue-600 dark:text-blue-400",children:[e.jsxs("li",{children:["Thinking budget: ",e.jsx("strong",{children:"agy"}),", ",e.jsx("strong",{children:"gemini"})," (token-based)"]}),e.jsxs("li",{children:["Reasoning effort: ",e.jsx("strong",{children:"codex"})," (level-based: medium/high/xhigh)"]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:"Thinking Mode"}),e.jsx("div",{className:"space-y-2",children:["auto","off","manual"].map(s=>e.jsxs("div",{className:`flex items-center justify-between p-4 rounded-lg cursor-pointer transition-colors ${n.mode===s?"bg-primary/10 border border-primary/30":"bg-muted/50 hover:bg-muted/80"}`,onClick:()=>j(s),children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium capitalize",children:s}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[s==="auto"&&"Automatically set thinking based on model tier",s==="off"&&"Disable extended thinking",s==="manual"&&"Use --thinking flag to control manually"]})]}),e.jsx("div",{className:`w-4 h-4 rounded-full border-2 ${n.mode===s?"bg-primary border-primary":"border-muted-foreground/50"}`})]},s))})]}),n.mode==="auto"&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:"Tier Defaults"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Default thinking level for each model tier when in auto mode."}),e.jsx("div",{className:"space-y-3",children:["opus","sonnet","haiku"].map(s=>e.jsxs("div",{className:"flex items-center gap-4 p-3 rounded-lg bg-muted/30",children:[e.jsx(D,{className:"w-20 capitalize font-medium",children:s}),e.jsxs(L,{value:n.tier_defaults[s],onValueChange:l=>o(s,l),disabled:g,children:[e.jsx($,{className:"flex-1",children:e.jsx(F,{})}),e.jsx(K,{children:q.map(l=>e.jsx(z,{value:l.value,children:l.label},l.value))})]})]},s))})]}),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:"Show Warnings"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Display warnings when thinking values are clamped or adjusted"})]}),e.jsx(H,{checked:n.show_warnings??!0,onCheckedChange:v,disabled:g})]}),e.jsxs("div",{className:"p-4 rounded-lg border bg-muted/30",children:[e.jsx("h4",{className:"text-sm font-medium mb-2",children:"CLI Override"}),e.jsxs("p",{className:"text-sm text-muted-foreground mb-2",children:["Use ",e.jsx("code",{className:"px-1.5 py-0.5 rounded bg-muted",children:"--thinking"})," flag to override settings per session:"]}),e.jsxs("div",{className:"space-y-1 text-sm font-mono text-muted-foreground",children:[e.jsx("p",{children:"ccs gemini --thinking high"}),e.jsx("p",{children:"ccs agy --thinking 16384"}),e.jsx("p",{children:"ccs gemini --thinking off"})]})]})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(C,{variant:"outline",size:"sm",onClick:c,disabled:i||g,className:"w-full",children:[e.jsx(k,{className:`w-4 h-4 mr-2 ${i?"animate-spin":""}`}),"Refresh"]})})]})}export{ne as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-qEZD5MMp.js";import{r as c}from"./react-vendor-CNOkPC89.js";import{aS as fe,aT as ye,ae as A,I as T,X as be,Y as je,Z as ve,_ as Ne,$ as Y,b as J,aU as ke,aV as Ce,aW as Pe,aP as V,aR as U,m as Se}from"./index-DyigGY6D.js";import{S as B}from"./switch-BKMDc-FD.js";import{aB as Q,R as O,e as we,q as ee,W as Ie,a1 as Ee,aC as Te,aD as Ae,T as X,aE as Le}from"./icons-D5eAI-GR.js";import{P as _e}from"./proxy-status-widget-DiMcpCvZ.js";import"./tanstack-De4wvi8X.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-C-pVd1--.js";import"./code-highlight-BRUf_pqB.js";import"./alert-dialog-B9Uu5j7u.js";function Be(){const{state:t}=fe(),s=ye(),[n,d]=c.useState(null),[h,f]=c.useState(null),[p,x]=c.useState(null),[b,j]=c.useState(null),[v,N]=c.useState(null),k=c.useCallback(async()=>{try{s.setProxyLoading(!0),s.setProxyError(null);const l=await A.cliproxyServer.get();s.setProxyConfig(l)}catch(l){s.setProxyError(l.message)}finally{s.setProxyLoading(!1)}},[s]),C=c.useCallback(async l=>{const i=t.proxyConfig;if(!i)return;const u={remote:{...i.remote,...l.remote},fallback:{...i.fallback,...l.fallback},local:{...i.local,...l.local}};s.setProxyConfig(u),s.setProxyTestResult(null);try{s.setProxySaving(!0),s.setProxyError(null);const r=await A.cliproxyServer.update(l);s.setProxyConfig(r),s.setProxySuccess(!0),setTimeout(()=>s.setProxySuccess(!1),1500)}catch(r){s.setProxyConfig(i),s.setProxyError(r.message)}finally{s.setProxySaving(!1)}},[t.proxyConfig,s]),P=c.useCallback(async l=>{const{host:i,port:u,protocol:r,authToken:S}=l;if(!i){s.setProxyError("Host is required");return}try{s.setProxyTesting(!0),s.setProxyError(null),s.setProxyTestResult(null);const o=u?parseInt(u,10):void 0,w=await A.cliproxyServer.test({host:i,port:o||void 0,protocol:r,authToken:S||void 0});s.setProxyTestResult(w)}catch(o){s.setProxyError(o.message)}finally{s.setProxyTesting(!1)}},[s]);return{config:t.proxyConfig,loading:t.proxyLoading,saving:t.proxySaving,error:t.proxyError,success:t.proxySuccess,testResult:t.proxyTestResult,testing:t.proxyTesting,editedHost:n,setEditedHost:d,editedPort:h,setEditedPort:f,editedAuthToken:p,setEditedAuthToken:x,editedManagementKey:b,setEditedManagementKey:j,editedLocalPort:v,setEditedLocalPort:N,fetchConfig:k,saveConfig:C,testConnection:P}}function Re({config:t,saving:s,displayLocalPort:n,setEditedLocalPort:d,onSaveLocalPort:h,onSaveConfig:f}){const p=t.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:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:"Port"}),e.jsx(T,{type:"number",value:n,onChange:x=>d(x.target.value),onBlur:h,placeholder:"8317",className:"font-mono max-w-32",disabled:s})]}),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(B,{checked:p.auto_start??!0,onCheckedChange:x=>f({local:{...p,auto_start:x}}),disabled:s})]})]})]})}function De({config:t,saving:s,testing:n,testResult:d,displayHost:h,displayPort:f,displayAuthToken:p,displayManagementKey:x,setEditedHost:b,setEditedPort:j,setEditedAuthToken:v,setEditedManagementKey:N,onSaveHost:k,onSavePort:C,onSaveAuthToken:P,onSaveManagementKey:l,onSaveConfig:i,onTestConnection:u}){const r=t.remote,S=o=>o==="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(Q,{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(T,{value:h,onChange:o=>b(o.target.value),onBlur:k,placeholder:"192.168.1.100 or proxy.example.com",className:"font-mono",disabled:s})]}),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: ",S(t.remote.protocol||"http"),")"]})]}),e.jsx(T,{type:"text",inputMode:"numeric",value:f,onChange:o=>j(o.target.value.replace(/\D/g,"")),onBlur:C,placeholder:`Leave empty for ${S(t.remote.protocol||"http")}`,className:"font-mono",disabled:s})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:"Protocol"}),e.jsxs(be,{value:t.remote.protocol||"http",onValueChange:o=>i({remote:{...r,protocol:o}}),disabled:s,children:[e.jsx(je,{children:e.jsx(ve,{})}),e.jsxs(Ne,{children:[e.jsx(Y,{value:"http",children:"HTTP"}),e.jsx(Y,{value:"https",children:"HTTPS"})]})]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:"API Key (optional)"}),e.jsx(T,{type:"password",value:p,onChange:o=>v(o.target.value),onBlur:P,placeholder:"For /v1/* API endpoints",className:"font-mono",disabled:s}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Used for API requests to /v1/chat/completions"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:"Management Key (optional)"}),e.jsx(T,{type:"password",value:x,onChange:o=>N(o.target.value),onBlur:l,placeholder:"For /v0/management/* endpoints",className:"font-mono",disabled:s}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Used for dashboard management APIs. Falls back to API Key if not set."})]}),e.jsxs("div",{className:"space-y-3 pt-2",children:[e.jsx(J,{onClick:u,disabled:n||!h,variant:"outline",className:"w-full",children:n?e.jsxs(e.Fragment,{children:[e.jsx(O,{className:"w-4 h-4 mr-2 animate-spin"}),"Testing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(we,{className:"w-4 h-4 mr-2"}),"Test Connection"]})}),d&&e.jsx("div",{className:`p-3 rounded-md ${d.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:d.reachable?e.jsxs(e.Fragment,{children:[e.jsx(ee,{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 (",d.latencyMs,"ms)"]})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ie,{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:d.error||"Connection failed"})]})})})]})]})}const Z="ccs_debug_mode",Me=["kiro","ghcp"];function Xe(){const{config:t,loading:s,saving:n,error:d,success:h,testResult:f,testing:p,editedHost:x,setEditedHost:b,editedPort:j,setEditedPort:v,editedAuthToken:N,setEditedAuthToken:k,editedManagementKey:C,setEditedManagementKey:P,editedLocalPort:l,setEditedLocalPort:i,fetchConfig:u,saveConfig:r,testConnection:S}=Be(),{fetchRawConfig:o}=ke(),[w,te]=c.useState(()=>{try{return localStorage.getItem(Z)==="true"}catch{return!1}}),se=a=>{te(a);try{localStorage.setItem(Z,String(a))}catch{}},[y,R]=c.useState("plus"),[ae,re]=c.useState(!1),D=Ce(),{data:oe}=Pe(),G=oe?.running??!1,M=c.useCallback(async()=>{try{const a=await A.cliproxyServer.getBackend();R(a.backend)}catch(a){console.error("[Proxy] Failed to fetch backend:",a)}},[]),K=c.useCallback(async()=>{try{const g=(await A.cliproxy.list()).variants.some(_=>Me.includes(_.provider));re(g)}catch(a){console.error("[Proxy] Failed to check variants:",a)}},[]),W=a=>{const g=y;R(a),D.mutate({backend:a},{onError:()=>{R(g)}})};if(c.useEffect(()=>{if(w&&t){const a={...t,remote:{...t.remote,auth_token:t.remote.auth_token?"[REDACTED]":void 0,management_key:t.remote.management_key?"[REDACTED]":void 0}};console.log("[CCS Debug] Debug mode enabled - proxy config:",a)}},[w,t]),c.useEffect(()=>{u(),o(),M(),K()},[u,o,M,K]),s||!t)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(O,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:"Loading..."})]})});const m=t.remote.enabled??!1,L=!m&&G,I=t.remote,E=t.fallback,ne=t.remote.host??"",le=t.remote.port!==void 0?t.remote.port.toString():"",ce=t.remote.auth_token??"",de=t.remote.management_key??"",ie=(t.local.port??8317).toString(),$=x??ne,F=j??le,H=N??ce,q=C??de,z=l??ie,me=()=>{const a=x??$;a!==t.remote.host&&r({remote:{...I,host:a}}),b(null)},xe=()=>{const a=j??F,g=a===""?void 0:parseInt(a,10),_=g&&!isNaN(g)&&g>0?g:void 0;_!==t.remote.port&&r({remote:{...I,port:_}}),v(null)},ue=()=>{const a=N??H;a!==t.remote.auth_token&&r({remote:{...I,auth_token:a}}),k(null)},he=()=>{const a=C??q;a!==t.remote.management_key&&r({remote:{...I,management_key:a||void 0}}),P(null)},pe=()=>{const a=parseInt(l??z,10);!isNaN(a)&&a!==t.local.port&&r({local:{...t.local,port:a}}),i(null)},ge=()=>{S({host:$,port:F,protocol:t.remote.protocol||"http",authToken:H})};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 ${d||h?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[d&&e.jsxs(V,{variant:"destructive",className:"py-2 shadow-lg",children:[e.jsx(Ee,{className:"h-4 w-4"}),e.jsx(U,{children:d})]}),h&&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(ee,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:"Saved"})]})]}),e.jsx(Se,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Configure local or remote ",y==="plus"?"CLIProxy Plus":"CLIProxy"," connection for proxy-based profiles"]}),!m&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:"Instance Status"}),e.jsx(_e,{})]}),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:{...I,enabled:!1}}),disabled:n,className:`p-4 rounded-lg border-2 text-left transition-all ${m?"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(Te,{className:`w-5 h-5 ${m?"text-muted-foreground":"text-primary"}`}),e.jsx("span",{className:"font-medium",children:"Local"})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Run ",y==="plus"?"CLIProxy Plus":"CLIProxy"," binary on this machine"]})]}),e.jsxs("button",{onClick:()=>r({remote:{...I,enabled:!0}}),disabled:n,className:`p-4 rounded-lg border-2 text-left transition-all ${m?"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(Q,{className:`w-5 h-5 ${m?"text-primary":"text-muted-foreground"}`}),e.jsx("span",{className:"font-medium",children:"Remote"})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Connect to a remote ",y==="plus"?"CLIProxy Plus":"CLIProxy"," server"]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h3",{className:"text-base font-medium flex items-center gap-2",children:[e.jsx(Ae,{className:"w-4 h-4"}),"Backend Binary"]}),!m&&G&&e.jsxs(V,{className:"py-2 border-amber-200 bg-amber-50 dark:border-amber-900/50 dark:bg-amber-900/20 [&>svg]:top-2.5",children:[e.jsx(X,{className:"h-4 w-4 text-amber-600"}),e.jsx(U,{className:"text-amber-700 dark:text-amber-400",children:"Stop the running proxy in Instance Status to switch backend."})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("button",{onClick:()=>W("plus"),disabled:D.isPending||L,className:`p-4 rounded-lg border-2 text-left transition-all ${y==="plus"?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"} ${L?"opacity-60 cursor-not-allowed":""}`,children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("span",{className:"font-medium",children:"CLIProxyAPIPlus"}),e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-400",children:"Default"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Full provider support including Kiro and GitHub Copilot"})]}),e.jsxs("button",{onClick:()=>W("original"),disabled:D.isPending||L,className:`p-4 rounded-lg border-2 text-left transition-all ${y==="original"?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"} ${L?"opacity-60 cursor-not-allowed":""}`,children:[e.jsx("div",{className:"flex items-center gap-3 mb-2",children:e.jsx("span",{className:"font-medium",children:"CLIProxyAPI"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Original binary (Gemini, Codex, Antigravity only)"})]})]}),y==="original"&&ae&&e.jsxs(V,{variant:"destructive",className:"py-2",children:[e.jsx(X,{className:"h-4 w-4"}),e.jsx(U,{children:"Existing Kiro/Copilot variants will not work with CLIProxyAPI. Switch to CLIProxyAPIPlus or remove those variants."})]})]}),m&&e.jsx(De,{config:t,saving:n,testing:p,testResult:f,displayHost:$,displayPort:F,displayAuthToken:H,displayManagementKey:q,setEditedHost:b,setEditedPort:v,setEditedAuthToken:k,setEditedManagementKey:P,onSaveHost:me,onSavePort:xe,onSaveAuthToken:ue,onSaveManagementKey:he,onSaveConfig:r,onTestConnection:ge}),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(B,{checked:E.enabled??!0,onCheckedChange:a=>r({fallback:{...E,enabled:a}}),disabled:n||!m})]}),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(B,{checked:E.auto_start??!1,onCheckedChange:a=>r({fallback:{...E,auto_start:a}}),disabled:n||!m||!E.enabled})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h3",{className:"text-base font-medium flex items-center gap-2",children:[e.jsx(Le,{className:"w-4 h-4"}),"Advanced"]}),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:"Debug Mode"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Enable developer diagnostics in browser console"})]}),e.jsx(B,{checked:w,onCheckedChange:se,disabled:n})]}),w&&e.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400 pl-0.5",children:"Debug mode enabled. Check browser console for detailed logs."})]})]}),!m&&e.jsx(Re,{config:t,saving:n,displayLocalPort:z,setEditedLocalPort:i,onSaveLocalPort:pe,onSaveConfig:r})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(J,{variant:"outline",size:"sm",onClick:()=>{u(),o(),M(),K()},disabled:s||n,className:"w-full",children:[e.jsx(O,{className:`w-4 h-4 mr-2 ${s?"animate-spin":""}`}),"Refresh"]})})]})}export{Xe as default};
|
|
1
|
+
import{j as e}from"./radix-ui-qEZD5MMp.js";import{r as c}from"./react-vendor-CNOkPC89.js";import{aT as fe,aU as ye,ae as A,I as T,X as be,Y as je,Z as ve,_ as Ne,$ as q,b as Z,aV as ke,aW as Ce,aX as Pe,aQ as V,aS as U,m as Se}from"./index-530Q5dXw.js";import{S as B}from"./switch-Dwq92XO7.js";import{aC as J,R as O,f as we,r as ee,W as Ie,a2 as Ee,aD as Te,aE as Ae,T as X,aF as Le}from"./icons-G0rMFC4M.js";import{P as _e}from"./proxy-status-widget-CNxExMuD.js";import"./tanstack-De4wvi8X.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-C-pVd1--.js";import"./code-highlight-BRUf_pqB.js";import"./alert-dialog-DfmPw3Uo.js";function Be(){const{state:t}=fe(),s=ye(),[n,d]=c.useState(null),[h,f]=c.useState(null),[p,x]=c.useState(null),[b,j]=c.useState(null),[v,N]=c.useState(null),k=c.useCallback(async()=>{try{s.setProxyLoading(!0),s.setProxyError(null);const l=await A.cliproxyServer.get();s.setProxyConfig(l)}catch(l){s.setProxyError(l.message)}finally{s.setProxyLoading(!1)}},[s]),C=c.useCallback(async l=>{const i=t.proxyConfig;if(!i)return;const u={remote:{...i.remote,...l.remote},fallback:{...i.fallback,...l.fallback},local:{...i.local,...l.local}};s.setProxyConfig(u),s.setProxyTestResult(null);try{s.setProxySaving(!0),s.setProxyError(null);const r=await A.cliproxyServer.update(l);s.setProxyConfig(r),s.setProxySuccess(!0),setTimeout(()=>s.setProxySuccess(!1),1500)}catch(r){s.setProxyConfig(i),s.setProxyError(r.message)}finally{s.setProxySaving(!1)}},[t.proxyConfig,s]),P=c.useCallback(async l=>{const{host:i,port:u,protocol:r,authToken:S}=l;if(!i){s.setProxyError("Host is required");return}try{s.setProxyTesting(!0),s.setProxyError(null),s.setProxyTestResult(null);const o=u?parseInt(u,10):void 0,w=await A.cliproxyServer.test({host:i,port:o||void 0,protocol:r,authToken:S||void 0});s.setProxyTestResult(w)}catch(o){s.setProxyError(o.message)}finally{s.setProxyTesting(!1)}},[s]);return{config:t.proxyConfig,loading:t.proxyLoading,saving:t.proxySaving,error:t.proxyError,success:t.proxySuccess,testResult:t.proxyTestResult,testing:t.proxyTesting,editedHost:n,setEditedHost:d,editedPort:h,setEditedPort:f,editedAuthToken:p,setEditedAuthToken:x,editedManagementKey:b,setEditedManagementKey:j,editedLocalPort:v,setEditedLocalPort:N,fetchConfig:k,saveConfig:C,testConnection:P}}function De({config:t,saving:s,displayLocalPort:n,setEditedLocalPort:d,onSaveLocalPort:h,onSaveConfig:f}){const p=t.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:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:"Port"}),e.jsx(T,{type:"number",value:n,onChange:x=>d(x.target.value),onBlur:h,placeholder:"8317",className:"font-mono max-w-32",disabled:s})]}),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(B,{checked:p.auto_start??!0,onCheckedChange:x=>f({local:{...p,auto_start:x}}),disabled:s})]})]})]})}function Me({config:t,saving:s,testing:n,testResult:d,displayHost:h,displayPort:f,displayAuthToken:p,displayManagementKey:x,setEditedHost:b,setEditedPort:j,setEditedAuthToken:v,setEditedManagementKey:N,onSaveHost:k,onSavePort:C,onSaveAuthToken:P,onSaveManagementKey:l,onSaveConfig:i,onTestConnection:u}){const r=t.remote,S=o=>o==="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(J,{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(T,{value:h,onChange:o=>b(o.target.value),onBlur:k,placeholder:"192.168.1.100 or proxy.example.com",className:"font-mono",disabled:s})]}),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: ",S(t.remote.protocol||"http"),")"]})]}),e.jsx(T,{type:"text",inputMode:"numeric",value:f,onChange:o=>j(o.target.value.replace(/\D/g,"")),onBlur:C,placeholder:`Leave empty for ${S(t.remote.protocol||"http")}`,className:"font-mono",disabled:s})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:"Protocol"}),e.jsxs(be,{value:t.remote.protocol||"http",onValueChange:o=>i({remote:{...r,protocol:o}}),disabled:s,children:[e.jsx(je,{children:e.jsx(ve,{})}),e.jsxs(Ne,{children:[e.jsx(q,{value:"http",children:"HTTP"}),e.jsx(q,{value:"https",children:"HTTPS"})]})]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:"API Key (optional)"}),e.jsx(T,{type:"password",value:p,onChange:o=>v(o.target.value),onBlur:P,placeholder:"For /v1/* API endpoints",className:"font-mono",disabled:s}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Used for API requests to /v1/chat/completions"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:"Management Key (optional)"}),e.jsx(T,{type:"password",value:x,onChange:o=>N(o.target.value),onBlur:l,placeholder:"For /v0/management/* endpoints",className:"font-mono",disabled:s}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Used for dashboard management APIs. Falls back to API Key if not set."})]}),e.jsxs("div",{className:"space-y-3 pt-2",children:[e.jsx(Z,{onClick:u,disabled:n||!h,variant:"outline",className:"w-full",children:n?e.jsxs(e.Fragment,{children:[e.jsx(O,{className:"w-4 h-4 mr-2 animate-spin"}),"Testing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(we,{className:"w-4 h-4 mr-2"}),"Test Connection"]})}),d&&e.jsx("div",{className:`p-3 rounded-md ${d.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:d.reachable?e.jsxs(e.Fragment,{children:[e.jsx(ee,{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 (",d.latencyMs,"ms)"]})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ie,{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:d.error||"Connection failed"})]})})})]})]})}const Q="ccs_debug_mode",Re=["kiro","ghcp"];function Xe(){const{config:t,loading:s,saving:n,error:d,success:h,testResult:f,testing:p,editedHost:x,setEditedHost:b,editedPort:j,setEditedPort:v,editedAuthToken:N,setEditedAuthToken:k,editedManagementKey:C,setEditedManagementKey:P,editedLocalPort:l,setEditedLocalPort:i,fetchConfig:u,saveConfig:r,testConnection:S}=Be(),{fetchRawConfig:o}=ke(),[w,te]=c.useState(()=>{try{return localStorage.getItem(Q)==="true"}catch{return!1}}),se=a=>{te(a);try{localStorage.setItem(Q,String(a))}catch{}},[y,D]=c.useState("plus"),[ae,re]=c.useState(!1),M=Ce(),{data:oe}=Pe(),G=oe?.running??!1,R=c.useCallback(async()=>{try{const a=await A.cliproxyServer.getBackend();D(a.backend)}catch(a){console.error("[Proxy] Failed to fetch backend:",a)}},[]),K=c.useCallback(async()=>{try{const g=(await A.cliproxy.list()).variants.some(_=>Re.includes(_.provider));re(g)}catch(a){console.error("[Proxy] Failed to check variants:",a)}},[]),W=a=>{const g=y;D(a),M.mutate({backend:a},{onError:()=>{D(g)}})};if(c.useEffect(()=>{if(w&&t){const a={...t,remote:{...t.remote,auth_token:t.remote.auth_token?"[REDACTED]":void 0,management_key:t.remote.management_key?"[REDACTED]":void 0}};console.log("[CCS Debug] Debug mode enabled - proxy config:",a)}},[w,t]),c.useEffect(()=>{u(),o(),R(),K()},[u,o,R,K]),s||!t)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(O,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:"Loading..."})]})});const m=t.remote.enabled??!1,L=!m&&G,I=t.remote,E=t.fallback,ne=t.remote.host??"",le=t.remote.port!==void 0?t.remote.port.toString():"",ce=t.remote.auth_token??"",de=t.remote.management_key??"",ie=(t.local.port??8317).toString(),F=x??ne,$=j??le,H=N??ce,z=C??de,Y=l??ie,me=()=>{const a=x??F;a!==t.remote.host&&r({remote:{...I,host:a}}),b(null)},xe=()=>{const a=j??$,g=a===""?void 0:parseInt(a,10),_=g&&!isNaN(g)&&g>0?g:void 0;_!==t.remote.port&&r({remote:{...I,port:_}}),v(null)},ue=()=>{const a=N??H;a!==t.remote.auth_token&&r({remote:{...I,auth_token:a}}),k(null)},he=()=>{const a=C??z;a!==t.remote.management_key&&r({remote:{...I,management_key:a||void 0}}),P(null)},pe=()=>{const a=parseInt(l??Y,10);!isNaN(a)&&a!==t.local.port&&r({local:{...t.local,port:a}}),i(null)},ge=()=>{S({host:F,port:$,protocol:t.remote.protocol||"http",authToken:H})};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 ${d||h?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[d&&e.jsxs(V,{variant:"destructive",className:"py-2 shadow-lg",children:[e.jsx(Ee,{className:"h-4 w-4"}),e.jsx(U,{children:d})]}),h&&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(ee,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:"Saved"})]})]}),e.jsx(Se,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Configure local or remote ",y==="plus"?"CLIProxy Plus":"CLIProxy"," connection for proxy-based profiles"]}),!m&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:"Instance Status"}),e.jsx(_e,{})]}),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:{...I,enabled:!1}}),disabled:n,className:`p-4 rounded-lg border-2 text-left transition-all ${m?"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(Te,{className:`w-5 h-5 ${m?"text-muted-foreground":"text-primary"}`}),e.jsx("span",{className:"font-medium",children:"Local"})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Run ",y==="plus"?"CLIProxy Plus":"CLIProxy"," binary on this machine"]})]}),e.jsxs("button",{onClick:()=>r({remote:{...I,enabled:!0}}),disabled:n,className:`p-4 rounded-lg border-2 text-left transition-all ${m?"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(J,{className:`w-5 h-5 ${m?"text-primary":"text-muted-foreground"}`}),e.jsx("span",{className:"font-medium",children:"Remote"})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Connect to a remote ",y==="plus"?"CLIProxy Plus":"CLIProxy"," server"]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h3",{className:"text-base font-medium flex items-center gap-2",children:[e.jsx(Ae,{className:"w-4 h-4"}),"Backend Binary"]}),!m&&G&&e.jsxs(V,{className:"py-2 border-amber-200 bg-amber-50 dark:border-amber-900/50 dark:bg-amber-900/20 [&>svg]:top-2.5",children:[e.jsx(X,{className:"h-4 w-4 text-amber-600"}),e.jsx(U,{className:"text-amber-700 dark:text-amber-400",children:"Stop the running proxy in Instance Status to switch backend."})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("button",{onClick:()=>W("plus"),disabled:M.isPending||L,className:`p-4 rounded-lg border-2 text-left transition-all ${y==="plus"?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"} ${L?"opacity-60 cursor-not-allowed":""}`,children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("span",{className:"font-medium",children:"CLIProxyAPIPlus"}),e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-400",children:"Default"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Full provider support including Kiro and GitHub Copilot"})]}),e.jsxs("button",{onClick:()=>W("original"),disabled:M.isPending||L,className:`p-4 rounded-lg border-2 text-left transition-all ${y==="original"?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"} ${L?"opacity-60 cursor-not-allowed":""}`,children:[e.jsx("div",{className:"flex items-center gap-3 mb-2",children:e.jsx("span",{className:"font-medium",children:"CLIProxyAPI"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Original binary (Gemini, Codex, Antigravity only)"})]})]}),y==="original"&&ae&&e.jsxs(V,{variant:"destructive",className:"py-2",children:[e.jsx(X,{className:"h-4 w-4"}),e.jsx(U,{children:"Existing Kiro/Copilot variants will not work with CLIProxyAPI. Switch to CLIProxyAPIPlus or remove those variants."})]})]}),m&&e.jsx(Me,{config:t,saving:n,testing:p,testResult:f,displayHost:F,displayPort:$,displayAuthToken:H,displayManagementKey:z,setEditedHost:b,setEditedPort:v,setEditedAuthToken:k,setEditedManagementKey:P,onSaveHost:me,onSavePort:xe,onSaveAuthToken:ue,onSaveManagementKey:he,onSaveConfig:r,onTestConnection:ge}),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(B,{checked:E.enabled??!0,onCheckedChange:a=>r({fallback:{...E,enabled:a}}),disabled:n||!m})]}),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(B,{checked:E.auto_start??!1,onCheckedChange:a=>r({fallback:{...E,auto_start:a}}),disabled:n||!m||!E.enabled})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h3",{className:"text-base font-medium flex items-center gap-2",children:[e.jsx(Le,{className:"w-4 h-4"}),"Advanced"]}),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:"Debug Mode"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Enable developer diagnostics in browser console"})]}),e.jsx(B,{checked:w,onCheckedChange:se,disabled:n})]}),w&&e.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400 pl-0.5",children:"Debug mode enabled. Check browser console for detailed logs."})]})]}),!m&&e.jsx(De,{config:t,saving:n,displayLocalPort:Y,setEditedLocalPort:i,onSaveLocalPort:pe,onSaveConfig:r})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>{u(),o(),R(),K()},disabled:s||n,className:"w-full",children:[e.jsx(O,{className:`w-4 h-4 mr-2 ${s?"animate-spin":""}`}),"Refresh"]})})]})}export{Xe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-qEZD5MMp.js";import{r as y}from"./react-vendor-CNOkPC89.js";import{aW as W,aC as Z,aX as _,aY as J,aZ as ee,a_ as se,a$ as te,c as d,B as E,ao as ae,E as ne,G as re,X as oe,Y as ie,Z as le,_ as ce,$ as de,b as T,T as xe,o as me,p as ue,ae as he}from"./index-DyigGY6D.js";import{A as ge,a as pe,b as fe,c as be,d as je,e as ye,f as Ne,g as we}from"./alert-dialog-B9Uu5j7u.js";import{u as q,a as ve,b as Ce,e as Se}from"./tanstack-De4wvi8X.js";import{t as V}from"./notifications-B2HqRBj7.js";import{a2 as ke,A as Pe,R as f,aF as Ve,aG as Ae,aH as Te,X as De,S as Ie,aI as Ue,aJ as $e,U as Ee,p as Re,j as qe,a1 as Fe,ao as Le,T as R,av as Me}from"./icons-D5eAI-GR.js";async function Be(){const s=await fetch("/api/cliproxy/sync/status");if(!s.ok){let n="Failed to fetch sync status";try{const t=await s.json();n=t.error||t.message||n}catch{}throw new Error(n)}return s.json()}async function Ke(){const s=new AbortController,n=setTimeout(()=>s.abort(),3e4);try{const t=await fetch("/api/cliproxy/sync",{method:"POST",headers:{"Content-Type":"application/json"},signal:s.signal});if(!t.ok){let a="Sync failed";try{const r=await t.json();a=r.error||r.message||a}catch{}throw new Error(a)}return t.json()}catch(t){throw t instanceof Error&&t.name==="AbortError"?new Error("Sync request timed out after 30 seconds"):t}finally{clearTimeout(n)}}function Qe(){return q({queryKey:["cliproxy-sync-status"],queryFn:Be,refetchInterval:3e4,retry:1,staleTime:1e4})}function ze(){const s=ve();return Ce({mutationFn:Ke,onSuccess:n=>{s.invalidateQueries({queryKey:["cliproxy-sync-status"]}),s.invalidateQueries({queryKey:["cliproxy-sync-preview"]}),n.syncedCount===0?V.info("No profiles to sync"):V.success(`Synced ${n.syncedCount} profile${n.syncedCount===1?"":"s"} to CLIProxy`)},onError:n=>{V.error(`Sync failed: ${n.message}`)}})}function A(s,n){const t=s.replace(/-\d+$/,"").split(".").map(Number),a=n.replace(/-\d+$/,"").split(".").map(Number);for(let r=0;r<3;r++){if((t[r]||0)>(a[r]||0))return!0;if((t[r]||0)<(a[r]||0))return!1}return!1}function Ge(s){if(!s)return"";const n=new Date(s).getTime(),a=Date.now()-n,r=Math.floor(a/(1e3*60*60)),i=Math.floor(a%(1e3*60*60)/(1e3*60));return r>0?`${r}h ${i}m`:`${i}m`}function He(s){if(!s)return"";const n=Date.now()-s,t=Math.floor(n/(1e3*60)),a=Math.floor(n/(1e3*60*60));return t<1?"just now":t<60?`${t}m ago`:`${a}h ago`}function N({icon:s,tooltip:n,onClick:t,disabled:a,isPending:r,className:i,variant:l="ghost"}){return e.jsxs(xe,{children:[e.jsx(me,{asChild:!0,children:e.jsx(T,{variant:l==="destructive-ghost"?"ghost":l,size:"sm",className:d("h-7 w-7 p-0",l==="destructive-ghost"&&"hover:bg-destructive/10 hover:text-destructive hover:border-destructive/30",i),onClick:t,disabled:a,children:r?e.jsx(f,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(s,{className:"w-3.5 h-3.5"})})}),e.jsx(ue,{side:"bottom",className:"text-xs",children:n})]})}function es(){const{data:s,isLoading:n}=W(),{data:t}=Z(),{data:a,isLoading:r}=_(),i=J(),l=ee(),w=se(),u=te(),{data:F}=Qe(),{mutate:L,isPending:v}=ze(),[h,D]=y.useState(!1),[g,M]=y.useState(""),[B,b]=y.useState(!1),[C,S]=y.useState(null),{data:K}=q({queryKey:["cliproxy-server-config"],queryFn:()=>he.cliproxyServer.get(),staleTime:3e4}),Q=Se({mutationKey:["update-backend"]})>0,x=K?.remote,I=x?.enabled&&x?.host,p=s?.running??!1,k=i.isPending||l.isPending||w.isPending||u.isPending||Q||v,z=t?.hasUpdate??!1,m=t?.isStable===!1,U=t?.currentVersion,j=F?.configured??!1,G=j?"Sync Ready":"No Config",P=m?t?.maxStableVersion||a?.latestStable:t?.latestVersion,$=o=>{if(!o)return;const c=a?.maxStableVersion||"6.6.80";if(A(o,c)){S(o),b(!0);return}u.mutate({version:o})},H=()=>{C&&u.mutate({version:C,force:!0}),b(!1),S(null)},O=()=>{b(!1),S(null)},X=I?(()=>{const o=x.protocol||"http",c=x.port||(o==="https"?443:80);return o==="https"&&c===443||o==="http"&&c===80?x.host:`${x.host}:${c}`})():null;return I?e.jsxs("div",{className:d("rounded-lg border p-3 transition-colors","border-blue-500/30 bg-blue-500/5"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ke,{className:"w-4 h-4 text-blue-500"}),e.jsx("span",{className:"text-sm font-medium",children:"Remote Proxy"}),e.jsx(E,{variant:"secondary",className:"text-[10px] h-4 px-1.5 bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",children:"Active"})]}),e.jsx(Pe,{className:"w-3 h-3 text-blue-600"})]}),e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:[e.jsx("div",{className:"flex items-center gap-1 mb-1",children:e.jsx("span",{className:"font-mono",children:X})}),e.jsx("p",{className:"text-[10px] text-muted-foreground/70 leading-tight",children:"Traffic auto-routed to remote server"})]})]}):e.jsx(ae,{delayDuration:300,children:e.jsxs("div",{className:d("rounded-lg border p-3 transition-colors",p?"border-green-500/30 bg-green-500/5":"border-muted bg-muted/30"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:d("w-2 h-2 rounded-full",p?"bg-green-500 animate-pulse":"bg-muted-foreground/30")}),e.jsx("span",{className:"text-sm font-medium",children:t?.backendLabel??"CLIProxy"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[n?e.jsx(f,{className:"w-3 h-3 animate-spin text-muted-foreground"}):p?e.jsxs(e.Fragment,{children:[e.jsx(N,{icon:v?f:Ve,tooltip:"Sync profiles to CLIProxy",onClick:()=>L(),disabled:!j||k,isPending:v}),e.jsx(N,{icon:Ae,tooltip:"Restart",onClick:()=>w.mutate(),disabled:k,isPending:w.isPending}),e.jsx(N,{icon:Te,tooltip:"Stop",onClick:()=>l.mutate(),disabled:k,isPending:l.isPending,variant:"destructive-ghost"})]}):null,e.jsx(N,{icon:h?De:Ie,tooltip:h?"Close":"Version settings",onClick:()=>D(!h),className:h?"bg-muted":void 0})]})]}),U&&e.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[e.jsxs("span",{className:d("text-xs font-mono text-muted-foreground",m&&"text-amber-600 dark:text-amber-400"),children:["v",U]}),(z||m)&&P&&e.jsxs(E,{variant:"secondary",className:d("text-[10px] h-4 px-1.5 gap-0.5 cursor-pointer transition-colors",m?"bg-amber-100 text-amber-700 hover:bg-amber-200 dark:bg-amber-900/30 dark:text-amber-400 dark:hover:bg-amber-900/50":"bg-green-100 text-green-700 hover:bg-green-200 dark:bg-green-900/30 dark:text-green-400 dark:hover:bg-green-900/50"),onClick:()=>$(P),title:`Click to ${m?"downgrade":"update"}`,children:[m?e.jsx(Ue,{className:"w-2.5 h-2.5"}):e.jsx($e,{className:"w-2.5 h-2.5"}),P]})]}),p&&s&&e.jsxs("div",{className:"mt-2 flex items-center gap-4 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:["Port ",s.port]}),s.sessionCount!==void 0&&s.sessionCount>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ee,{className:"w-3 h-3"}),s.sessionCount," session",s.sessionCount!==1?"s":""]}),s.startedAt&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Re,{className:"w-3 h-3"}),Ge(s.startedAt)]})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs",children:[j?e.jsx(qe,{className:"w-3 h-3 text-green-600 dark:text-green-400"}):e.jsx(Fe,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:d("text-xs",j?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:G})]}),e.jsx(ne,{open:h,onOpenChange:D,children:e.jsxs(re,{className:"mt-3 pt-3 border-t border-muted",children:[e.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-3",children:"Version Management"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(oe,{value:g,onValueChange:M,disabled:r,children:[e.jsx(ie,{className:"h-8 text-xs flex-1",children:e.jsx(le,{placeholder:"Select version to install..."})}),e.jsx(ce,{children:a?.versions.slice(0,20).map(o=>{const c=a?.maxStableVersion&&A(o,a.maxStableVersion);return e.jsx(de,{value:o,className:"text-xs",children:e.jsxs("span",{className:"flex items-center gap-2",children:["v",o,o===a.latestStable&&e.jsx("span",{className:"text-green-600 dark:text-green-400",children:"(stable)"}),c&&e.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:"⚠"})]})},o)})})]}),e.jsxs(T,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1.5 px-3",onClick:()=>$(g),disabled:u.isPending||!g,children:[u.isPending?e.jsx(f,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(Le,{className:"w-3.5 h-3.5"}),"Install"]})]}),g&&a?.maxStableVersion&&A(g,a.maxStableVersion)&&e.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[e.jsx(R,{className:"w-3.5 h-3.5 flex-shrink-0"}),e.jsxs("span",{children:["Versions above ",a.maxStableVersion," have known issues"]})]}),t?.checkedAt&&e.jsxs("div",{className:"mt-2 text-[10px] text-muted-foreground/60",children:["Last checked ",He(t.checkedAt)]})]})}),!p&&e.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Not running"}),e.jsxs(T,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>i.mutate(),disabled:i.isPending,children:[i.isPending?e.jsx(f,{className:"w-3 h-3 animate-spin"}):e.jsx(Me,{className:"w-3 h-3"}),"Start"]})]}),e.jsx(ge,{open:B,onOpenChange:b,children:e.jsxs(pe,{children:[e.jsxs(fe,{children:[e.jsxs(be,{className:"flex items-center gap-2",children:[e.jsx(R,{className:"w-5 h-5 text-amber-500"}),"Install Unstable Version?"]}),e.jsxs(je,{className:"space-y-2",children:[e.jsxs("p",{children:["You are about to install ",e.jsxs("strong",{children:["v",C]}),", which is above the maximum stable version"," ",e.jsxs("strong",{children:["v",a?.maxStableVersion||"6.6.80"]}),"."]}),e.jsx("p",{className:"text-amber-600 dark:text-amber-400",children:"This version has known stability issues and may cause unexpected behavior."}),e.jsx("p",{children:"Are you sure you want to proceed?"})]})]}),e.jsxs(ye,{children:[e.jsx(Ne,{onClick:O,children:"Cancel"}),e.jsx(we,{onClick:H,className:"bg-amber-500 hover:bg-amber-600 text-white",children:"Install Anyway"})]})]})})]})})}export{es as P};
|
|
1
|
+
import{j as e}from"./radix-ui-qEZD5MMp.js";import{r as y}from"./react-vendor-CNOkPC89.js";import{aX as Z,aC as _,aY as J,aZ as W,a_ as ee,a$ as se,b0 as te,c as d,B as E,ao as ae,E as ne,G as re,X as oe,Y as ie,Z as le,_ as ce,$ as de,b as T,T as xe,o as me,p as ue,ae as he}from"./index-530Q5dXw.js";import{A as ge,a as pe,b as fe,c as be,d as je,e as ye,f as Ne,g as we}from"./alert-dialog-DfmPw3Uo.js";import{u as R,a as ve,b as Ce,e as Se}from"./tanstack-De4wvi8X.js";import{t as V}from"./notifications-B2HqRBj7.js";import{a3 as ke,A as Pe,R as f,aG as Ve,aH as Ae,aI as Te,X as De,S as Ie,aJ as Ue,aK as $e,U as Ee,q as qe,k as Re,a2 as Le,ap as Me,T as q,aw as Fe}from"./icons-G0rMFC4M.js";async function Ke(){const s=await fetch("/api/cliproxy/sync/status");if(!s.ok){let n="Failed to fetch sync status";try{const t=await s.json();n=t.error||t.message||n}catch{}throw new Error(n)}return s.json()}async function Be(){const s=new AbortController,n=setTimeout(()=>s.abort(),3e4);try{const t=await fetch("/api/cliproxy/sync",{method:"POST",headers:{"Content-Type":"application/json"},signal:s.signal});if(!t.ok){let a="Sync failed";try{const r=await t.json();a=r.error||r.message||a}catch{}throw new Error(a)}return t.json()}catch(t){throw t instanceof Error&&t.name==="AbortError"?new Error("Sync request timed out after 30 seconds"):t}finally{clearTimeout(n)}}function Qe(){return R({queryKey:["cliproxy-sync-status"],queryFn:Ke,refetchInterval:3e4,retry:1,staleTime:1e4})}function ze(){const s=ve();return Ce({mutationFn:Be,onSuccess:n=>{s.invalidateQueries({queryKey:["cliproxy-sync-status"]}),s.invalidateQueries({queryKey:["cliproxy-sync-preview"]}),n.syncedCount===0?V.info("No profiles to sync"):V.success(`Synced ${n.syncedCount} profile${n.syncedCount===1?"":"s"} to CLIProxy`)},onError:n=>{V.error(`Sync failed: ${n.message}`)}})}function A(s,n){const t=s.replace(/-\d+$/,"").split(".").map(Number),a=n.replace(/-\d+$/,"").split(".").map(Number);for(let r=0;r<3;r++){if((t[r]||0)>(a[r]||0))return!0;if((t[r]||0)<(a[r]||0))return!1}return!1}function Ge(s){if(!s)return"";const n=new Date(s).getTime(),a=Date.now()-n,r=Math.floor(a/(1e3*60*60)),i=Math.floor(a%(1e3*60*60)/(1e3*60));return r>0?`${r}h ${i}m`:`${i}m`}function He(s){if(!s)return"";const n=Date.now()-s,t=Math.floor(n/(1e3*60)),a=Math.floor(n/(1e3*60*60));return t<1?"just now":t<60?`${t}m ago`:`${a}h ago`}function N({icon:s,tooltip:n,onClick:t,disabled:a,isPending:r,className:i,variant:l="ghost"}){return e.jsxs(xe,{children:[e.jsx(me,{asChild:!0,children:e.jsx(T,{variant:l==="destructive-ghost"?"ghost":l,size:"sm",className:d("h-7 w-7 p-0",l==="destructive-ghost"&&"hover:bg-destructive/10 hover:text-destructive hover:border-destructive/30",i),onClick:t,disabled:a,children:r?e.jsx(f,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(s,{className:"w-3.5 h-3.5"})})}),e.jsx(ue,{side:"bottom",className:"text-xs",children:n})]})}function es(){const{data:s,isLoading:n}=Z(),{data:t}=_(),{data:a,isLoading:r}=J(),i=W(),l=ee(),w=se(),u=te(),{data:L}=Qe(),{mutate:M,isPending:v}=ze(),[h,D]=y.useState(!1),[g,F]=y.useState(""),[K,b]=y.useState(!1),[C,S]=y.useState(null),{data:B}=R({queryKey:["cliproxy-server-config"],queryFn:()=>he.cliproxyServer.get(),staleTime:3e4}),Q=Se({mutationKey:["update-backend"]})>0,x=B?.remote,I=x?.enabled&&x?.host,p=s?.running??!1,k=i.isPending||l.isPending||w.isPending||u.isPending||Q||v,z=t?.hasUpdate??!1,m=t?.isStable===!1,U=t?.currentVersion,j=L?.configured??!1,G=j?"Sync Ready":"No Config",P=m?t?.maxStableVersion||a?.latestStable:t?.latestVersion,$=o=>{if(!o)return;const c=a?.maxStableVersion||"6.6.80";if(A(o,c)){S(o),b(!0);return}u.mutate({version:o})},H=()=>{C&&u.mutate({version:C,force:!0}),b(!1),S(null)},O=()=>{b(!1),S(null)},X=I?(()=>{const o=x.protocol||"http",c=x.port||(o==="https"?443:80);return o==="https"&&c===443||o==="http"&&c===80?x.host:`${x.host}:${c}`})():null;return I?e.jsxs("div",{className:d("rounded-lg border p-3 transition-colors","border-blue-500/30 bg-blue-500/5"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ke,{className:"w-4 h-4 text-blue-500"}),e.jsx("span",{className:"text-sm font-medium",children:"Remote Proxy"}),e.jsx(E,{variant:"secondary",className:"text-[10px] h-4 px-1.5 bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",children:"Active"})]}),e.jsx(Pe,{className:"w-3 h-3 text-blue-600"})]}),e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:[e.jsx("div",{className:"flex items-center gap-1 mb-1",children:e.jsx("span",{className:"font-mono",children:X})}),e.jsx("p",{className:"text-[10px] text-muted-foreground/70 leading-tight",children:"Traffic auto-routed to remote server"})]})]}):e.jsx(ae,{delayDuration:300,children:e.jsxs("div",{className:d("rounded-lg border p-3 transition-colors",p?"border-green-500/30 bg-green-500/5":"border-muted bg-muted/30"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:d("w-2 h-2 rounded-full",p?"bg-green-500 animate-pulse":"bg-muted-foreground/30")}),e.jsx("span",{className:"text-sm font-medium",children:t?.backendLabel??"CLIProxy"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[n?e.jsx(f,{className:"w-3 h-3 animate-spin text-muted-foreground"}):p?e.jsxs(e.Fragment,{children:[e.jsx(N,{icon:v?f:Ve,tooltip:"Sync profiles to CLIProxy",onClick:()=>M(),disabled:!j||k,isPending:v}),e.jsx(N,{icon:Ae,tooltip:"Restart",onClick:()=>w.mutate(),disabled:k,isPending:w.isPending}),e.jsx(N,{icon:Te,tooltip:"Stop",onClick:()=>l.mutate(),disabled:k,isPending:l.isPending,variant:"destructive-ghost"})]}):null,e.jsx(N,{icon:h?De:Ie,tooltip:h?"Close":"Version settings",onClick:()=>D(!h),className:h?"bg-muted":void 0})]})]}),U&&e.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[e.jsxs("span",{className:d("text-xs font-mono text-muted-foreground",m&&"text-amber-600 dark:text-amber-400"),children:["v",U]}),(z||m)&&P&&e.jsxs(E,{variant:"secondary",className:d("text-[10px] h-4 px-1.5 gap-0.5 cursor-pointer transition-colors",m?"bg-amber-100 text-amber-700 hover:bg-amber-200 dark:bg-amber-900/30 dark:text-amber-400 dark:hover:bg-amber-900/50":"bg-green-100 text-green-700 hover:bg-green-200 dark:bg-green-900/30 dark:text-green-400 dark:hover:bg-green-900/50"),onClick:()=>$(P),title:`Click to ${m?"downgrade":"update"}`,children:[m?e.jsx(Ue,{className:"w-2.5 h-2.5"}):e.jsx($e,{className:"w-2.5 h-2.5"}),P]})]}),p&&s&&e.jsxs("div",{className:"mt-2 flex items-center gap-4 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:["Port ",s.port]}),s.sessionCount!==void 0&&s.sessionCount>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ee,{className:"w-3 h-3"}),s.sessionCount," session",s.sessionCount!==1?"s":""]}),s.startedAt&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(qe,{className:"w-3 h-3"}),Ge(s.startedAt)]})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs",children:[j?e.jsx(Re,{className:"w-3 h-3 text-green-600 dark:text-green-400"}):e.jsx(Le,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:d("text-xs",j?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:G})]}),e.jsx(ne,{open:h,onOpenChange:D,children:e.jsxs(re,{className:"mt-3 pt-3 border-t border-muted",children:[e.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-3",children:"Version Management"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(oe,{value:g,onValueChange:F,disabled:r,children:[e.jsx(ie,{className:"h-8 text-xs flex-1",children:e.jsx(le,{placeholder:"Select version to install..."})}),e.jsx(ce,{children:a?.versions.slice(0,20).map(o=>{const c=a?.maxStableVersion&&A(o,a.maxStableVersion);return e.jsx(de,{value:o,className:"text-xs",children:e.jsxs("span",{className:"flex items-center gap-2",children:["v",o,o===a.latestStable&&e.jsx("span",{className:"text-green-600 dark:text-green-400",children:"(stable)"}),c&&e.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:"⚠"})]})},o)})})]}),e.jsxs(T,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1.5 px-3",onClick:()=>$(g),disabled:u.isPending||!g,children:[u.isPending?e.jsx(f,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(Me,{className:"w-3.5 h-3.5"}),"Install"]})]}),g&&a?.maxStableVersion&&A(g,a.maxStableVersion)&&e.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[e.jsx(q,{className:"w-3.5 h-3.5 flex-shrink-0"}),e.jsxs("span",{children:["Versions above ",a.maxStableVersion," have known issues"]})]}),t?.checkedAt&&e.jsxs("div",{className:"mt-2 text-[10px] text-muted-foreground/60",children:["Last checked ",He(t.checkedAt)]})]})}),!p&&e.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Not running"}),e.jsxs(T,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>i.mutate(),disabled:i.isPending,children:[i.isPending?e.jsx(f,{className:"w-3 h-3 animate-spin"}):e.jsx(Fe,{className:"w-3 h-3"}),"Start"]})]}),e.jsx(ge,{open:K,onOpenChange:b,children:e.jsxs(pe,{children:[e.jsxs(fe,{children:[e.jsxs(be,{className:"flex items-center gap-2",children:[e.jsx(q,{className:"w-5 h-5 text-amber-500"}),"Install Unstable Version?"]}),e.jsxs(je,{className:"space-y-2",children:[e.jsxs("p",{children:["You are about to install ",e.jsxs("strong",{children:["v",C]}),", which is above the maximum stable version"," ",e.jsxs("strong",{children:["v",a?.maxStableVersion||"6.6.80"]}),"."]}),e.jsx("p",{className:"text-amber-600 dark:text-amber-400",children:"This version has known stability issues and may cause unexpected behavior."}),e.jsx("p",{children:"Are you sure you want to proceed?"})]})]}),e.jsxs(ye,{children:[e.jsx(Ne,{onClick:O,children:"Cancel"}),e.jsx(we,{onClick:H,className:"bg-amber-500 hover:bg-amber-600 text-white",children:"Install Anyway"})]})]})})]})})}export{es as P};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as s}from"./radix-ui-qEZD5MMp.js";import{r as l}from"./react-vendor-CNOkPC89.js";import{aO as o,aP as m,aQ as c,aR as x,aS as u,b as h,C as p,a as g}from"./index-530Q5dXw.js";import{O as j,a1 as f,B as N,T as b}from"./icons-G0rMFC4M.js";import"./tanstack-De4wvi8X.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-C-pVd1--.js";import"./code-highlight-BRUf_pqB.js";function B(){const[t,i]=l.useState("commands"),{data:e}=o(),{data:n,isLoading:r}=m(t),d=[{id:"commands",label:"Commands",icon:j,count:e?.commands??0},{id:"skills",label:"Skills",icon:f,count:e?.skills??0},{id:"agents",label:"Agents",icon:N,count:e?.agents??0}];return s.jsxs("div",{className:"p-6 max-w-6xl mx-auto space-y-8",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold",children:"Shared Data"}),s.jsx("p",{className:"text-muted-foreground",children:"Commands, skills, and agents shared across Claude instances"})]}),e&&!e.symlinkStatus.valid&&s.jsxs(c,{variant:"warning",children:[s.jsx(b,{className:"h-4 w-4"}),s.jsx(x,{children:"Configuration Required"}),s.jsxs(u,{children:[e.symlinkStatus.message,". Run `ccs sync` to configure."]})]}),s.jsx("div",{className:"flex gap-2 border-b pb-2",children:d.map(a=>s.jsxs(h,{variant:t===a.id?"default":"ghost",size:"sm",onClick:()=>i(a.id),className:"flex items-center gap-2",children:[s.jsx(a.icon,{className:"w-4 h-4"}),a.label," (",a.count,")"]},a.id))}),s.jsx("div",{className:"mt-4",children:r?s.jsx("div",{className:"text-muted-foreground",children:"Loading..."}):n?.items.length===0?s.jsxs("div",{className:"text-muted-foreground",children:["No ",t," found"]}):s.jsx("div",{className:"grid gap-3",children:n?.items.map(a=>s.jsx(p,{children:s.jsxs(g,{children:[s.jsx("div",{className:"font-medium",children:a.name}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:a.description}),s.jsx("p",{className:"text-xs text-muted-foreground mt-2 font-mono truncate",children:a.path})]})},a.name))})})]})}export{B as SharedPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as a,a2 as s,a3 as n}from"./radix-ui-qEZD5MMp.js";import"./react-vendor-CNOkPC89.js";import{c as e}from"./index-
|
|
1
|
+
import{j as a,a2 as s,a3 as n}from"./radix-ui-qEZD5MMp.js";import"./react-vendor-CNOkPC89.js";import{c as e}from"./index-530Q5dXw.js";function c({className:t,...r}){return a.jsx(s,{"data-slot":"switch",className:e("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...r,children:a.jsx(n,{"data-slot":"switch-thumb",className:e("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}export{c as S};
|
package/dist/ui/index.html
CHANGED
|
@@ -24,16 +24,16 @@
|
|
|
24
24
|
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap"
|
|
25
25
|
rel="stylesheet"
|
|
26
26
|
/>
|
|
27
|
-
<script type="module" crossorigin src="/assets/index-
|
|
27
|
+
<script type="module" crossorigin src="/assets/index-530Q5dXw.js"></script>
|
|
28
28
|
<link rel="modulepreload" crossorigin href="/assets/react-vendor-CNOkPC89.js">
|
|
29
29
|
<link rel="modulepreload" crossorigin href="/assets/radix-ui-qEZD5MMp.js">
|
|
30
30
|
<link rel="modulepreload" crossorigin href="/assets/tanstack-De4wvi8X.js">
|
|
31
31
|
<link rel="modulepreload" crossorigin href="/assets/notifications-B2HqRBj7.js">
|
|
32
|
-
<link rel="modulepreload" crossorigin href="/assets/icons-
|
|
32
|
+
<link rel="modulepreload" crossorigin href="/assets/icons-G0rMFC4M.js">
|
|
33
33
|
<link rel="modulepreload" crossorigin href="/assets/utils-CzKF5WmX.js">
|
|
34
34
|
<link rel="modulepreload" crossorigin href="/assets/form-utils-C-pVd1--.js">
|
|
35
35
|
<link rel="modulepreload" crossorigin href="/assets/code-highlight-BRUf_pqB.js">
|
|
36
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
36
|
+
<link rel="stylesheet" crossorigin href="/assets/index-Bqle3SG4.css">
|
|
37
37
|
</head>
|
|
38
38
|
<body>
|
|
39
39
|
<div id="root"></div>
|
|
@@ -2,5 +2,15 @@
|
|
|
2
2
|
* Cursor Routes - Cursor IDE integration via cursor proxy daemon
|
|
3
3
|
*/
|
|
4
4
|
declare const router: import("express-serve-static-core").Router;
|
|
5
|
+
interface DaemonStartPreconditionInput {
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
authenticated: boolean;
|
|
8
|
+
tokenExpired?: boolean;
|
|
9
|
+
}
|
|
10
|
+
interface DaemonStartPreconditionError {
|
|
11
|
+
status: number;
|
|
12
|
+
error: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function getDaemonStartPreconditionError(input: DaemonStartPreconditionInput): DaemonStartPreconditionError | null;
|
|
5
15
|
export default router;
|
|
6
16
|
//# sourceMappingURL=cursor-routes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cursor-routes.d.ts","sourceRoot":"","sources":["../../../src/web-server/routes/cursor-routes.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"cursor-routes.d.ts","sourceRoot":"","sources":["../../../src/web-server/routes/cursor-routes.ts"],"names":[],"mappings":"AAAA;;GAEG;AAkBH,QAAA,MAAM,MAAM,4CAAW,CAAC;AAExB,UAAU,4BAA4B;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,UAAU,4BAA4B;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,4BAA4B,GAClC,4BAA4B,GAAG,IAAI,CAuBrC;AAiJD,eAAe,MAAM,CAAC"}
|
|
@@ -6,59 +6,50 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
6
6
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.getDaemonStartPreconditionError = void 0;
|
|
9
10
|
const express_1 = require("express");
|
|
10
|
-
const
|
|
11
|
+
const cursor_1 = require("../../cursor");
|
|
11
12
|
const unified_config_loader_1 = require("../../config/unified-config-loader");
|
|
12
13
|
const cursor_settings_routes_1 = __importDefault(require("./cursor-settings-routes"));
|
|
13
14
|
const router = (0, express_1.Router)();
|
|
15
|
+
function getDaemonStartPreconditionError(input) {
|
|
16
|
+
if (!input.enabled) {
|
|
17
|
+
return {
|
|
18
|
+
status: 400,
|
|
19
|
+
error: 'Cursor integration is disabled. Enable it before starting daemon.',
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
if (!input.authenticated) {
|
|
23
|
+
return {
|
|
24
|
+
status: 401,
|
|
25
|
+
error: 'Cursor authentication required. Import credentials before starting daemon.',
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
if (input.tokenExpired) {
|
|
29
|
+
return {
|
|
30
|
+
status: 401,
|
|
31
|
+
error: 'Cursor credentials expired. Re-authenticate before starting daemon.',
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
exports.getDaemonStartPreconditionError = getDaemonStartPreconditionError;
|
|
14
37
|
// Mount settings sub-routes
|
|
15
38
|
router.use('/settings', cursor_settings_routes_1.default);
|
|
16
|
-
/**
|
|
17
|
-
* Get daemon status
|
|
18
|
-
* TODO: Implement in cursor-executor.ts (#520)
|
|
19
|
-
*/
|
|
20
|
-
async function getDaemonStatus(port) {
|
|
21
|
-
// Stub - will be implemented in #520
|
|
22
|
-
return { running: false, port };
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Get available models
|
|
26
|
-
* TODO: Implement in cursor-executor.ts (#520)
|
|
27
|
-
*/
|
|
28
|
-
async function getAvailableModels() {
|
|
29
|
-
// Stub - will be implemented in #520
|
|
30
|
-
return []; // TODO: populated by cursor-models.ts (#520)
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Start daemon
|
|
34
|
-
* TODO: Implement in cursor-executor.ts (#520)
|
|
35
|
-
*/
|
|
36
|
-
async function startDaemon(port, ghostMode) {
|
|
37
|
-
// Stub - will be implemented in #520
|
|
38
|
-
return {
|
|
39
|
-
success: false,
|
|
40
|
-
message: `Daemon start not implemented (port: ${port}, ghost: ${ghostMode})`,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Stop daemon
|
|
45
|
-
* TODO: Implement in cursor-executor.ts (#520)
|
|
46
|
-
*/
|
|
47
|
-
async function stopDaemon() {
|
|
48
|
-
// Stub - will be implemented in #520
|
|
49
|
-
return { success: false, message: 'Daemon stop not implemented' };
|
|
50
|
-
}
|
|
51
39
|
/**
|
|
52
40
|
* GET /api/cursor/status - Get Cursor status (auth + daemon)
|
|
53
41
|
*/
|
|
54
42
|
router.get('/status', async (_req, res) => {
|
|
55
43
|
try {
|
|
56
44
|
const cursorConfig = (0, unified_config_loader_1.getCursorConfig)();
|
|
57
|
-
const authStatus = (0,
|
|
58
|
-
const daemonStatus = await getDaemonStatus(cursorConfig.port);
|
|
45
|
+
const authStatus = (0, cursor_1.checkAuthStatus)();
|
|
46
|
+
const daemonStatus = await (0, cursor_1.getDaemonStatus)(cursorConfig.port);
|
|
59
47
|
res.json({
|
|
60
48
|
enabled: cursorConfig.enabled,
|
|
61
49
|
authenticated: authStatus.authenticated,
|
|
50
|
+
auth_method: authStatus.credentials?.authMethod ?? null,
|
|
51
|
+
token_age: authStatus.tokenAge ?? null,
|
|
52
|
+
token_expired: authStatus.expired ?? false,
|
|
62
53
|
daemon_running: daemonStatus.running,
|
|
63
54
|
port: cursorConfig.port,
|
|
64
55
|
auto_start: cursorConfig.auto_start,
|
|
@@ -80,12 +71,12 @@ router.post('/auth/import', async (req, res) => {
|
|
|
80
71
|
return;
|
|
81
72
|
}
|
|
82
73
|
// Validate token format
|
|
83
|
-
if (!(0,
|
|
74
|
+
if (!(0, cursor_1.validateToken)(accessToken, machineId)) {
|
|
84
75
|
res.status(400).json({ error: 'Invalid token or machine ID format' });
|
|
85
76
|
return;
|
|
86
77
|
}
|
|
87
78
|
// Save credentials
|
|
88
|
-
(0,
|
|
79
|
+
(0, cursor_1.saveCredentials)({
|
|
89
80
|
accessToken,
|
|
90
81
|
machineId,
|
|
91
82
|
authMethod: 'manual',
|
|
@@ -102,13 +93,13 @@ router.post('/auth/import', async (req, res) => {
|
|
|
102
93
|
*/
|
|
103
94
|
router.post('/auth/auto-detect', async (_req, res) => {
|
|
104
95
|
try {
|
|
105
|
-
const result = (0,
|
|
96
|
+
const result = (0, cursor_1.autoDetectTokens)();
|
|
106
97
|
if (!result.found || !result.accessToken || !result.machineId) {
|
|
107
98
|
res.status(404).json({ error: result.error ?? 'Token not found' });
|
|
108
99
|
return;
|
|
109
100
|
}
|
|
110
101
|
// Save credentials
|
|
111
|
-
(0,
|
|
102
|
+
(0, cursor_1.saveCredentials)({
|
|
112
103
|
accessToken: result.accessToken,
|
|
113
104
|
machineId: result.machineId,
|
|
114
105
|
authMethod: 'auto-detect',
|
|
@@ -125,8 +116,9 @@ router.post('/auth/auto-detect', async (_req, res) => {
|
|
|
125
116
|
*/
|
|
126
117
|
router.get('/models', async (_req, res) => {
|
|
127
118
|
try {
|
|
128
|
-
const
|
|
129
|
-
|
|
119
|
+
const cursorConfig = (0, unified_config_loader_1.getCursorConfig)();
|
|
120
|
+
const models = await (0, cursor_1.getAvailableModels)(cursorConfig.port);
|
|
121
|
+
res.json({ models, current: (0, cursor_1.getDefaultModel)() });
|
|
130
122
|
}
|
|
131
123
|
catch (error) {
|
|
132
124
|
res.status(500).json({ error: error.message });
|
|
@@ -139,7 +131,23 @@ router.get('/models', async (_req, res) => {
|
|
|
139
131
|
router.post('/daemon/start', async (_req, res) => {
|
|
140
132
|
try {
|
|
141
133
|
const cursorConfig = (0, unified_config_loader_1.getCursorConfig)();
|
|
142
|
-
const
|
|
134
|
+
const authStatus = (0, cursor_1.checkAuthStatus)();
|
|
135
|
+
const preconditionError = getDaemonStartPreconditionError({
|
|
136
|
+
enabled: cursorConfig.enabled,
|
|
137
|
+
authenticated: authStatus.authenticated,
|
|
138
|
+
tokenExpired: authStatus.expired ?? false,
|
|
139
|
+
});
|
|
140
|
+
if (preconditionError) {
|
|
141
|
+
res.status(preconditionError.status).json({
|
|
142
|
+
success: false,
|
|
143
|
+
error: preconditionError.error,
|
|
144
|
+
});
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
const result = await (0, cursor_1.startDaemon)({
|
|
148
|
+
port: cursorConfig.port,
|
|
149
|
+
ghost_mode: cursorConfig.ghost_mode,
|
|
150
|
+
});
|
|
143
151
|
res.json(result);
|
|
144
152
|
}
|
|
145
153
|
catch (error) {
|
|
@@ -152,7 +160,7 @@ router.post('/daemon/start', async (_req, res) => {
|
|
|
152
160
|
*/
|
|
153
161
|
router.post('/daemon/stop', async (_req, res) => {
|
|
154
162
|
try {
|
|
155
|
-
const result = await stopDaemon();
|
|
163
|
+
const result = await (0, cursor_1.stopDaemon)();
|
|
156
164
|
res.json(result);
|
|
157
165
|
}
|
|
158
166
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cursor-routes.js","sourceRoot":"","sources":["../../../src/web-server/routes/cursor-routes.ts"],"names":[],"mappings":";AAAA;;GAEG
|
|
1
|
+
{"version":3,"file":"cursor-routes.js","sourceRoot":"","sources":["../../../src/web-server/routes/cursor-routes.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;AAGH,qCAAiC;AACjC,yCAUsB;AACtB,8EAAqE;AACrE,sFAA4D;AAE5D,MAAM,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;AAaxB,SAAgB,+BAA+B,CAC7C,KAAmC;IAEnC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACnB,OAAO;YACL,MAAM,EAAE,GAAG;YACX,KAAK,EAAE,mEAAmE;SAC3E,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;QACzB,OAAO;YACL,MAAM,EAAE,GAAG;YACX,KAAK,EAAE,4EAA4E;SACpF,CAAC;IACJ,CAAC;IAED,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC;QACvB,OAAO;YACL,MAAM,EAAE,GAAG;YACX,KAAK,EAAE,qEAAqE;SAC7E,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAzBD,0EAyBC;AAED,4BAA4B;AAC5B,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,gCAAoB,CAAC,CAAC;AAE9C;;GAEG;AACH,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,IAAa,EAAE,GAAa,EAAiB,EAAE;IAC1E,IAAI,CAAC;QACH,MAAM,YAAY,GAAG,IAAA,uCAAe,GAAE,CAAC;QACvC,MAAM,UAAU,GAAG,IAAA,wBAAe,GAAE,CAAC;QACrC,MA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O,EAAE,KAAK;gBACd,KAAK,EAAE,iBAAiB,CAAC,KAAK;aAC/B,CAAC,CAAC;YACH,OAAO;QACT,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,IAAA,oBAAW,EAAC;YAC/B,IAAI,EAAE,YAAY,CAAC,IAAI;YACvB,UAAU,EAAE,YAAY,CAAC,UAAU;SACpC,CAAC,CAAC;QACH,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACnB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAG,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,EAAE,IAAa,EAAE,GAAa,EAAiB,EAAE;IAChF,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,IAAA,mBAAU,GAAE,CAAC;QAClC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACnB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAG,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,kBAAe,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cursor-settings-routes.d.ts","sourceRoot":"","sources":["../../../src/web-server/routes/cursor-settings-routes.ts"],"names":[],"mappings":"AAAA;;GAEG;AAcH,QAAA,MAAM,MAAM,4CAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"cursor-settings-routes.d.ts","sourceRoot":"","sources":["../../../src/web-server/routes/cursor-settings-routes.ts"],"names":[],"mappings":"AAAA;;GAEG;AAcH,QAAA,MAAM,MAAM,4CAAW,CAAC;AA4LxB,eAAe,MAAM,CAAC"}
|
|
@@ -33,6 +33,28 @@ const config_manager_1 = require("../../utils/config-manager");
|
|
|
33
33
|
const unified_config_types_1 = require("../../config/unified-config-types");
|
|
34
34
|
const unified_config_loader_1 = require("../../config/unified-config-loader");
|
|
35
35
|
const router = (0, express_1.Router)();
|
|
36
|
+
function parseLocalCursorPort(settings) {
|
|
37
|
+
if (typeof settings !== 'object' || settings === null)
|
|
38
|
+
return null;
|
|
39
|
+
const env = settings.env;
|
|
40
|
+
if (typeof env !== 'object' || env === null)
|
|
41
|
+
return null;
|
|
42
|
+
const baseUrl = env.ANTHROPIC_BASE_URL;
|
|
43
|
+
if (typeof baseUrl !== 'string' || !baseUrl)
|
|
44
|
+
return null;
|
|
45
|
+
try {
|
|
46
|
+
const parsed = new URL(baseUrl);
|
|
47
|
+
if (parsed.hostname !== '127.0.0.1' && parsed.hostname !== 'localhost')
|
|
48
|
+
return null;
|
|
49
|
+
const port = Number(parsed.port);
|
|
50
|
+
if (!Number.isInteger(port) || port < 1 || port > 65535)
|
|
51
|
+
return null;
|
|
52
|
+
return port;
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
36
58
|
/**
|
|
37
59
|
* GET /api/cursor/settings - Get cursor config (port, auto_start, ghost_mode)
|
|
38
60
|
*/
|
|
@@ -116,7 +138,7 @@ router.get('/raw', (_req, res) => {
|
|
|
116
138
|
res.json({
|
|
117
139
|
settings: defaultSettings,
|
|
118
140
|
mtime: Date.now(),
|
|
119
|
-
path:
|
|
141
|
+
path: '~/.ccs/cursor.settings.json',
|
|
120
142
|
exists: false,
|
|
121
143
|
});
|
|
122
144
|
return;
|
|
@@ -127,7 +149,7 @@ router.get('/raw', (_req, res) => {
|
|
|
127
149
|
res.json({
|
|
128
150
|
settings,
|
|
129
151
|
mtime: stat.mtimeMs,
|
|
130
|
-
path:
|
|
152
|
+
path: '~/.ccs/cursor.settings.json',
|
|
131
153
|
exists: true,
|
|
132
154
|
});
|
|
133
155
|
}
|
|
@@ -147,9 +169,16 @@ router.put('/raw', (req, res) => {
|
|
|
147
169
|
return;
|
|
148
170
|
}
|
|
149
171
|
const settingsPath = path.join((0, config_manager_1.getCcsDir)(), 'cursor.settings.json');
|
|
150
|
-
//
|
|
151
|
-
if (fs.existsSync(settingsPath)
|
|
172
|
+
// For existing files, expectedMtime is required to prevent blind overwrite races.
|
|
173
|
+
if (fs.existsSync(settingsPath)) {
|
|
152
174
|
const stat = fs.statSync(settingsPath);
|
|
175
|
+
if (typeof expectedMtime !== 'number' || !Number.isFinite(expectedMtime)) {
|
|
176
|
+
res.status(409).json({
|
|
177
|
+
error: 'File metadata not loaded. Refresh and retry.',
|
|
178
|
+
mtime: stat.mtimeMs,
|
|
179
|
+
});
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
153
182
|
if (Math.abs(stat.mtimeMs - expectedMtime) > 1000) {
|
|
154
183
|
res.status(409).json({ error: 'File modified externally', mtime: stat.mtimeMs });
|
|
155
184
|
return;
|
|
@@ -159,7 +188,16 @@ router.put('/raw', (req, res) => {
|
|
|
159
188
|
const tempPath = settingsPath + '.tmp';
|
|
160
189
|
fs.writeFileSync(tempPath, JSON.stringify(settings, null, 2) + '\n');
|
|
161
190
|
fs.renameSync(tempPath, settingsPath);
|
|
162
|
-
//
|
|
191
|
+
// Keep unified config aligned with raw settings edits (parity with Copilot raw editor).
|
|
192
|
+
const parsedPort = parseLocalCursorPort(settings);
|
|
193
|
+
if (parsedPort) {
|
|
194
|
+
const config = (0, unified_config_loader_1.loadOrCreateUnifiedConfig)();
|
|
195
|
+
config.cursor = {
|
|
196
|
+
...(config.cursor ?? unified_config_types_1.DEFAULT_CURSOR_CONFIG),
|
|
197
|
+
port: parsedPort,
|
|
198
|
+
};
|
|
199
|
+
(0, unified_config_loader_1.saveUnifiedConfig)(config);
|
|
200
|
+
}
|
|
163
201
|
const stat = fs.statSync(settingsPath);
|
|
164
202
|
res.json({ success: true, mtime: stat.mtimeMs });
|
|
165
203
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cursor-settings-routes.js","sourceRoot":"","sources":["../../../src/web-server/routes/cursor-settings-routes.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,qCAAiC;AACjC,uCAAyB;AACzB,2CAA6B;AAC7B,+DAAuD;AACvD,4EAA0E;AAC1E,8EAI4C;AAE5C,MAAM,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;AAExB;;GAEG;AACH,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAa,EAAE,GAAa,EAAQ,EAAE;IACrD,IAAI,CAAC;QACH,MAAM,YAAY,GAAG,IAAA,uCAAe,GAAE,CAAC;QACvC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACzB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAG,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAY,EAAE,GAAa,EAAQ,EAAE;IACpD,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC;QAEzB,2BAA2B;QAC3B,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YACtE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,oCAAoC,EAAE,CAAC,CAAC;YACtE,OAAO;QACT,CAAC;QAED,uBAAuB;QACvB,IAAI,MAAM,IAAI,OAAO,EAAE,CAAC;YACtB,IAAI,OAAO,O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AC,IAAI,CAAC,EAAE,KAAK,EAAG,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,kBAAe,MAAM,CAAC"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-qEZD5MMp.js";import{r as p}from"./react-vendor-CNOkPC89.js";import{u as D,a as b,b as N,d as A,f as y,g as T}from"./tanstack-De4wvi8X.js";import{c as m,ae as f,b as d,a4 as k,a5 as R,a6 as S,a7 as z,a8 as P,L as C,I as q}from"./index-DyigGY6D.js";import{A as F,a as _,b as K,c as L,d as M,e as $,f as E,g as H}from"./alert-dialog-B9Uu5j7u.js";import{t as u}from"./notifications-B2HqRBj7.js";import{v as Q,j,ag as O,y as I,l as v,$ as B}from"./icons-D5eAI-GR.js";import"./utils-CzKF5WmX.js";import"./form-utils-C-pVd1--.js";import"./code-highlight-BRUf_pqB.js";function U({className:t,...s}){return e.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:e.jsx("table",{"data-slot":"table",className:m("w-full caption-bottom text-sm",t),...s})})}function V({className:t,...s}){return e.jsx("thead",{"data-slot":"table-header",className:m("[&_tr]:border-b",t),...s})}function Z({className:t,...s}){return e.jsx("tbody",{"data-slot":"table-body",className:m("[&_tr:last-child]:border-0",t),...s})}function w({className:t,...s}){return e.jsx("tr",{"data-slot":"table-row",className:m("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",t),...s})}function G({className:t,...s}){return e.jsx("th",{"data-slot":"table-head",className:m("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...s})}function J({className:t,...s}){return e.jsx("td",{"data-slot":"table-cell",className:m("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...s})}function W(){return D({queryKey:["accounts"],queryFn:()=>f.accounts.list()})}function X(){const t=b();return N({mutationFn:s=>f.accounts.setDefault(s),onSuccess:(s,l)=>{t.invalidateQueries({queryKey:["accounts"]}),u.success(`Default account set to "${l}"`)},onError:s=>{u.error(s.message)}})}function Y(){const t=b();return N({mutationFn:()=>f.accounts.resetDefault(),onSuccess:()=>{t.invalidateQueries({queryKey:["accounts"]}),u.success("Default account reset to CCS")},onError:s=>{u.error(s.message)}})}function ee(){const t=b();return N({mutationFn:s=>f.accounts.delete(s),onSuccess:(s,l)=>{t.invalidateQueries({queryKey:["accounts"]}),u.success(`Account "${l}" deleted`)},onError:s=>{u.error(s.message)}})}function se({data:t,defaultAccount:s}){const l=X(),i=ee(),r=Y(),[c,o]=p.useState(null),x=A({data:t,columns:[{accessorKey:"name",header:"Name",size:200,cell:({row:a})=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:a.original.name}),a.original.name===s&&e.jsx("span",{className:"text-xs bg-primary/10 text-primary px-1.5 py-0.5 rounded border border-primary/20",children:"default"})]})},{accessorKey:"type",header:"Type",size:100,cell:({row:a})=>e.jsx("span",{className:"capitalize text-muted-foreground",children:a.original.type||"oauth"})},{accessorKey:"created",header:"Created",size:150,cell:({row:a})=>{const n=new Date(a.original.created);return e.jsx("span",{className:"text-muted-foreground",children:n.toLocaleDateString()})}},{accessorKey:"last_used",header:"Last Used",size:150,cell:({row:a})=>{if(!a.original.last_used)return e.jsx("span",{className:"text-muted-foreground/50",children:"-"});const n=new Date(a.original.last_used);return e.jsx("span",{className:"text-muted-foreground",children:n.toLocaleDateString()})}},{id:"actions",header:"Actions",size:180,cell:({row:a})=>{const n=a.original.name===s,h=l.isPending||i.isPending;return e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs(d,{variant:n?"secondary":"default",size:"sm",className:"h-8 px-2",disabled:n||h,onClick:()=>l.mutate(a.original.name),children:[e.jsx(j,{className:`w-3 h-3 mr-1 ${n?"opacity-50":""}`}),n?"Active":"Set Default"]}),e.jsx(d,{variant:"ghost",size:"sm",className:"h-8 px-2 text-destructive hover:text-destructive hover:bg-destructive/10",disabled:n||h,onClick:()=>o(a.original.name),title:n?"Cannot delete default account":"Delete account",children:e.jsx(O,{className:"w-4 h-4"})})]})}}],getCoreRowModel:T()});return t.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:["No accounts found. Use"," ",e.jsx("code",{className:"text-sm bg-muted px-1 rounded",children:"ccs auth create"})," to add accounts."]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"border rounded-md",children:e.jsxs(U,{children:[e.jsx(V,{children:x.getHeaderGroups().map(a=>e.jsx(w,{children:a.headers.map(n=>{const h={name:"w-[200px]",type:"w-[100px]",created:"w-[150px]",last_used:"w-[150px]",actions:"w-[180px]"}[n.id]||"w-auto";return e.jsx(G,{className:h,children:n.isPlaceholder?null:y(n.column.columnDef.header,n.getContext())},n.id)})},a.id))}),e.jsx(Z,{children:x.getRowModel().rows.map(a=>e.jsx(w,{children:a.getVisibleCells().map(n=>e.jsx(J,{children:y(n.column.columnDef.cell,n.getContext())},n.id))},a.id))})]})}),s&&e.jsx("div",{className:"flex justify-end",children:e.jsxs(d,{variant:"outline",size:"sm",onClick:()=>r.mutate(),disabled:r.isPending,children:[e.jsx(Q,{className:"w-4 h-4 mr-2"}),"Reset to CCS Default"]})})]}),e.jsx(F,{open:!!c,onOpenChange:a=>!a&&o(null),children:e.jsxs(_,{children:[e.jsxs(K,{children:[e.jsx(L,{children:"Delete Account"}),e.jsxs(M,{children:['Are you sure you want to delete the account "',c,'"? This will remove the profile and all its session data. This action cannot be undone.']})]}),e.jsxs($,{children:[e.jsx(E,{children:"Cancel"}),e.jsx(H,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{c&&(i.mutate(c),o(null))},children:"Delete"})]})]})})]})}function te({open:t,onClose:s}){const[l,i]=p.useState(""),[r,c]=p.useState(!1),o=/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(l),g=l?`ccs auth create ${l}`:"ccs auth create <name>",x=async()=>{o&&(await navigator.clipboard.writeText(g),c(!0),setTimeout(()=>c(!1),2e3))},a=()=>{i(""),c(!1),s()};return e.jsx(k,{open:t,onOpenChange:n=>!n&&a(),children:e.jsxs(R,{className:"sm:max-w-md",children:[e.jsxs(S,{children:[e.jsx(z,{children:"Create New Account"}),e.jsx(P,{children:"Auth profiles require Claude CLI login. Run the command below in your terminal."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"profile-name",children:"Profile Name"}),e.jsx(q,{id:"profile-name",value:l,onChange:n=>i(n.target.value),placeholder:"e.g., work, personal, client",autoComplete:"off"}),l&&!o&&e.jsx("p",{className:"text-xs text-destructive",children:"Name must start with a letter and contain only letters, numbers, dashes, or underscores."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{children:"Command"}),e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-md font-mono text-sm",children:[e.jsx(I,{className:"w-4 h-4 text-muted-foreground shrink-0"}),e.jsx("code",{className:"flex-1 break-all",children:g}),e.jsx(d,{variant:"ghost",size:"sm",className:"shrink-0 h-8 px-2",onClick:x,disabled:!o,children:r?e.jsx(j,{className:"w-4 h-4 text-green-500"}):e.jsx(v,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[e.jsx("p",{children:"After running the command:"}),e.jsxs("ol",{className:"list-decimal list-inside pl-2 space-y-0.5",children:[e.jsx("li",{children:"Complete the Claude login in your browser"}),e.jsx("li",{children:"Return here and refresh to see the new account"})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(d,{variant:"ghost",onClick:a,children:"Close"}),e.jsx(d,{onClick:x,disabled:!o,children:r?e.jsxs(e.Fragment,{children:[e.jsx(j,{className:"w-4 h-4 mr-2"}),"Copied!"]}):e.jsxs(e.Fragment,{children:[e.jsx(v,{className:"w-4 h-4 mr-2"}),"Copy Command"]})})]})]})]})})}function xe(){const{data:t,isLoading:s,refetch:l}=W(),[i,r]=p.useState(!1);return e.jsxs("div",{className:"p-6 max-w-6xl mx-auto space-y-8",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Accounts"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Manage multi-account Claude sessions (profiles.json)"})]}),e.jsxs(d,{onClick:()=>r(!0),children:[e.jsx(B,{className:"w-4 h-4 mr-2"}),"Create Account"]})]}),s?e.jsx("div",{className:"text-muted-foreground",children:"Loading accounts..."}):e.jsx(se,{data:t?.accounts||[],defaultAccount:t?.default??null,onRefresh:l}),e.jsx(te,{open:i,onClose:()=>r(!1)})]})}export{xe as AccountsPage};
|