@kaitranntt/ccs 6.5.0-dev.3 → 6.5.0-dev.4
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/VERSION +1 -1
- package/dist/ccs.js +5 -0
- package/dist/ccs.js.map +1 -1
- package/dist/cliproxy/config-generator.d.ts +1 -1
- package/dist/cliproxy/config-generator.d.ts.map +1 -1
- package/dist/cliproxy/config-generator.js +20 -8
- package/dist/cliproxy/config-generator.js.map +1 -1
- package/dist/config/unified-config-loader.d.ts +6 -1
- package/dist/config/unified-config-loader.d.ts.map +1 -1
- package/dist/config/unified-config-loader.js +35 -1
- package/dist/config/unified-config-loader.js.map +1 -1
- package/dist/config/unified-config-types.d.ts +18 -0
- package/dist/config/unified-config-types.d.ts.map +1 -1
- package/dist/config/unified-config-types.js +14 -1
- package/dist/config/unified-config-types.js.map +1 -1
- package/dist/copilot/copilot-executor.d.ts.map +1 -1
- package/dist/copilot/copilot-executor.js +6 -1
- package/dist/copilot/copilot-executor.js.map +1 -1
- package/dist/ui/assets/{accounts-Cno_nr-i.js → accounts-DpWwKi5h.js} +1 -1
- package/dist/ui/assets/{analytics-iF-Az9y6.js → analytics-DoFD4MUg.js} +1 -1
- package/dist/ui/assets/api-CwUJMuXb.js +1 -0
- package/dist/ui/assets/{card-7gGxs3iI.js → card-CyWUt_38.js} +1 -1
- package/dist/ui/assets/{charts-D_0N6JY8.js → charts-B9Jh-s-X.js} +1 -1
- package/dist/ui/assets/cliproxy-Clb4iYcu.js +1 -0
- package/dist/ui/assets/{cliproxy-control-panel-CROmsCnw.js → cliproxy-control-panel-DPdlwOom.js} +1 -1
- package/dist/ui/assets/{code-editor-B0MIQXBU.js → code-editor-Cle0Dpfm.js} +1 -1
- package/dist/ui/assets/{code-highlight-C2TXE0-z.js → code-highlight-BoHWVYut.js} +1 -1
- package/dist/ui/assets/copilot-De6CUpAp.js +4 -0
- package/dist/ui/assets/{form-utils-BXvNPyud.js → form-utils-BuXDJb0w.js} +1 -1
- package/dist/ui/assets/{health-6IR3Aj8H.js → health-BhWyRLcf.js} +1 -1
- package/dist/ui/assets/{icons-rlGkaRKF.js → icons-DueS9DOr.js} +1 -1
- package/dist/ui/assets/index-BOt9W1nO.css +1 -0
- package/dist/ui/assets/index-DgE4vUOj.js +48 -0
- package/dist/ui/assets/{notifications-cqk-Qeo2.js → notifications-B2Pz7lik.js} +1 -1
- package/dist/ui/assets/{radix-ui-VbLlN_Dz.js → radix-ui-DFHQr9A5.js} +1 -1
- package/dist/ui/assets/react-vendor-FspHSO0w.js +3 -0
- package/dist/ui/assets/settings-CF8hsr9i.js +1 -0
- package/dist/ui/assets/{shared-DyO5taQR.js → shared-DOouyrMo.js} +1 -1
- package/dist/ui/assets/{switch-RuCXlnvJ.js → switch-Brk5YONT.js} +1 -1
- package/dist/ui/assets/{tanstack-yybD444-.js → tanstack-C4gT2P7V.js} +1 -1
- package/dist/ui/index.html +9 -9
- package/dist/web-server/routes.js +43 -0
- package/dist/web-server/routes.js.map +1 -1
- package/package.json +1 -1
- package/dist/ui/assets/api-aiUhSlkb.js +0 -1
- package/dist/ui/assets/cliproxy-D0BBuZq0.js +0 -1
- package/dist/ui/assets/copilot-CioTYLzs.js +0 -4
- package/dist/ui/assets/index-CmXcNr-M.js +0 -48
- package/dist/ui/assets/index-CpFV39RC.css +0 -1
- package/dist/ui/assets/react-vendor-DMek_JCF.js +0 -3
- package/dist/ui/assets/settings-CswNtUjU.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./radix-ui-DFHQr9A5.js";import{r as o}from"./react-vendor-FspHSO0w.js";import{u as fe}from"./tanstack-C4gT2P7V.js";import{r as H,s as je,t as J,u as ve,D as Z,v as X,w as ee,x as se,y as te,B as m,c as b,d as E,L as T,I as ae,z as Ne,A as we,E as ye,F as be,G as Ce,H as Se,J as Ae,K as ke,M as Pe,N as De,O as Me,i as Fe,S as Le,Q as $,R as ne,e as ie}from"./index-DgE4vUOj.js";import{C as U,a as K}from"./card-CyWUt_38.js";import{Y as I,b as W,L as re,D as V,t as Oe,j as P,o as Re,ae as R,J as M,$ as G,A as Te,af as Y,U as Ve,r as Ge,Z as de,ag as ce,X as le,N as Ie}from"./icons-DueS9DOr.js";import"./notifications-B2Pz7lik.js";import"./utils-CzKF5WmX.js";import"./form-utils-BuXDJb0w.js";import"./code-highlight-BoHWVYut.js";const F={agy:{provider:"agy",displayName:"Antigravity",defaultModel:"gemini-claude-opus-4-5-thinking",models:[{id:"gemini-claude-opus-4-5-thinking",name:"Claude Opus 4.5 Thinking",description:"Most capable, extended thinking"},{id:"gemini-claude-sonnet-4-5-thinking",name:"Claude Sonnet 4.5 Thinking",description:"Balanced with extended thinking"},{id:"gemini-claude-sonnet-4-5",name:"Claude Sonnet 4.5",description:"Fast and capable"},{id:"gemini-3-pro-preview",name:"Gemini 3 Pro",description:"Google latest model via Antigravity"}]},gemini:{provider:"gemini",displayName:"Gemini",defaultModel:"gemini-2.5-pro",models:[{id:"gemini-3-pro-preview",name:"Gemini 3 Pro",tier:"paid",description:"Latest model, requires paid Google account"},{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro",description:"Stable, works with free Google account"}]},codex:{provider:"codex",displayName:"Codex",defaultModel:"gpt-5.1-codex-max",models:[{id:"gpt-5.1-codex-max",name:"Codex Max (5.1)",description:"Most capable Codex model",presetMapping:{default:"gpt-5.1-codex-max",opus:"gpt-5.1-codex-max-high",sonnet:"gpt-5.1-codex-max",haiku:"gpt-5.1-codex-mini-high"}},{id:"gpt-5.2",name:"GPT 5.2",description:"Latest GPT model",presetMapping:{default:"gpt-5.2",opus:"gpt-5.2",sonnet:"gpt-5.2",haiku:"gpt-5.2"}},{id:"gpt-5.1-codex-mini",name:"Codex Mini",description:"Fast and efficient Codex model"}]},qwen:{provider:"qwen",displayName:"Qwen",defaultModel:"qwen-coder-plus",models:[{id:"qwen-coder-plus",name:"Qwen Coder Plus",description:"Alibaba code-focused model"},{id:"qwen-max",name:"Qwen Max",description:"Most capable Qwen model"}]},iflow:{provider:"iflow",displayName:"iFlow",defaultModel:"iflow-default",models:[{id:"iflow-default",name:"iFlow Default",description:"Default iFlow model"}]}},_=[{id:"gemini",name:"Google Gemini",description:"Gemini Pro/Flash models"},{id:"codex",name:"OpenAI Codex",description:"GPT-4 and codex models"},{id:"agy",name:"Antigravity",description:"Antigravity AI models"},{id:"qwen",name:"Alibaba Qwen",description:"Qwen Code models"},{id:"iflow",name:"iFlow",description:"iFlow AI models"}];function Qe({open:a,onClose:c}){const[n,i]=o.useState("provider"),[r,u]=o.useState(""),[d,j]=o.useState(null),[p,f]=o.useState(""),[v,A]=o.useState(""),[L,N]=o.useState(!1),[w,C]=o.useState(!1),[x,S]=o.useState(!1),{data:k,refetch:h}=H(),l=je(),g=J(),{privacyMode:D}=ve(),y=k?.authStatus.find(s=>s.provider===r)?.accounts||[];o.useEffect(()=>{if(!a){const s=setTimeout(()=>{i("provider"),u(""),j(null),f(""),A(""),N(!1),S(!1)},0);return()=>clearTimeout(s)}},[a]),o.useEffect(()=>{if(n==="auth"&&y.length>0&&!x){const s=setTimeout(()=>{i("account")},0);return()=>clearTimeout(s)}},[n,y,x]);const t=async s=>{await navigator.clipboard.writeText(s),N(!0),setTimeout(()=>N(!1),2e3)},O=async()=>{C(!0),await h(),C(!1)},oe=()=>{g.mutate({provider:r},{onSuccess:s=>{s.account&&(j(s.account),i("variant")),h()}})},me=s=>{u(s),(k?.authStatus.find(ge=>ge.provider===s)?.accounts||[]).length===0?i("auth"):i("account")},ue=s=>{j(s),i("variant")},xe=async()=>{if(!(!p||!r))try{await l.mutateAsync({name:p,provider:r,model:v||void 0,account:d?.id}),i("success")}catch(s){console.error("Failed to create variant:",s)}},z=`ccs ${r} --auth --add`,q=["provider","auth","variant","success"],pe=(s=>s==="account"?1:q.indexOf(s))(n),he=s=>{if(!s&&(n==="success"||n==="provider")){c();return}};return e.jsx(Z,{open:a,onOpenChange:he,children:e.jsxs(X,{className:"sm:max-w-lg",onPointerDownOutside:s=>{n!=="success"&&n!=="provider"&&s.preventDefault()},onEscapeKeyDown:s=>{(g.isPending||l.isPending)&&s.preventDefault()},children:[e.jsxs(ee,{children:[e.jsxs(se,{className:"flex items-center gap-2",children:[e.jsx(I,{className:"w-5 h-5 text-primary"}),"Quick Setup Wizard"]}),e.jsxs(te,{children:[n==="provider"&&"Select a provider to get started",n==="auth"&&"Authenticate with your provider",n==="account"&&"Select which account to use",n==="variant"&&"Create your custom variant",n==="success"&&"Setup complete!"]})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[n==="provider"&&e.jsx("div",{className:"grid gap-2",children:_.map(s=>e.jsxs("button",{onClick:()=>me(s.id),className:"flex items-center justify-between p-3 border rounded-lg hover:bg-muted/50 transition-colors text-left",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:s.name}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s.description})]}),e.jsx(W,{className:"w-4 h-4 text-muted-foreground"})]},s.id))}),n==="auth"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-center space-y-3",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Authenticate with ",_.find(s=>s.id===r)?.name," to add an account"]}),e.jsx(m,{onClick:oe,disabled:g.isPending,className:"w-full gap-2",size:"lg",children:g.isPending?e.jsxs(e.Fragment,{children:[e.jsx(re,{className:"w-4 h-4 animate-spin"}),"Authenticating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"w-4 h-4"}),"Authenticate in Browser"]})}),g.isPending&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"Complete the OAuth flow in your browser..."})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"Or use terminal"})})]}),e.jsx(U,{children:e.jsxs(K,{className:"p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(Oe,{className:"w-4 h-4"}),"Run this command in your terminal:"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 px-3 py-2 bg-muted rounded-md font-mono text-sm",children:z}),e.jsx(m,{variant:"outline",size:"icon",onClick:()=>t(z),children:L?e.jsx(P,{className:"w-4 h-4 text-green-500"}):e.jsx(Re,{className:"w-4 h-4"})})]})]})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(m,{variant:"ghost",onClick:()=>i("provider"),disabled:g.isPending,children:[e.jsx(R,{className:"w-4 h-4 mr-2"}),"Back"]}),e.jsxs(m,{variant:"outline",onClick:O,disabled:w||g.isPending,children:[e.jsx(M,{className:`w-4 h-4 mr-2 ${w?"animate-spin":""}`}),w?"Checking...":"Refresh Status"]})]})]}),n==="account"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:["Select an account (",y.length,")"]}),e.jsx("div",{className:"grid gap-2",children:y.map(s=>e.jsxs("button",{type:"button",onClick:()=>ue(s),className:"flex items-center justify-between p-3 border rounded-lg hover:bg-muted/50 transition-colors text-left",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-muted flex items-center justify-center",children:e.jsx(G,{className:"w-4 h-4 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("div",{className:b("font-medium",D&&E),children:s.email||s.id}),s.isDefault&&e.jsx("div",{className:"text-xs text-muted-foreground",children:"Default account"})]})]}),e.jsx(W,{className:"w-4 h-4 text-muted-foreground"})]},s.id))}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"Or"})})]}),e.jsxs("button",{type:"button",className:"w-full flex items-center gap-3 p-3 border-2 border-dashed border-primary/50 rounded-lg hover:border-primary hover:bg-primary/5 transition-colors text-left",onClick:()=>{S(!0),i("auth")},children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center shrink-0",children:e.jsx(V,{className:"w-4 h-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-primary",children:"Add new account"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Authenticate with a different account"})]})]}),e.jsx("div",{className:"flex items-center justify-between pt-2",children:e.jsxs(m,{variant:"ghost",onClick:()=>i("provider"),children:[e.jsx(R,{className:"w-4 h-4 mr-2"}),"Back"]})})]}),n==="variant"&&e.jsxs("div",{className:"space-y-4",children:[d&&e.jsxs("div",{className:"flex items-center gap-2 p-2 bg-muted/50 rounded-md text-sm",children:[e.jsx(G,{className:"w-4 h-4"}),e.jsxs("span",{children:["Using:"," ",e.jsx("span",{className:b(D&&E),children:d.email||d.id})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"variant-name",children:"Variant Name *"}),e.jsx(ae,{id:"variant-name",value:p,onChange:s=>f(s.target.value),placeholder:"e.g., my-gemini, g3, flash"}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Use this name to invoke: ccs ",p||"<name>",' "prompt"']})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{children:"Model"}),e.jsxs(Ne,{value:v,onValueChange:A,children:[e.jsx(we,{children:e.jsx(ye,{placeholder:"Select a model"})}),e.jsx(be,{children:F[r]?.models.map(s=>e.jsx(Ce,{value:s.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:s.name}),s.description&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["- ",s.description]})]})},s.id))})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Default: ",F[r]?.defaultModel||"provider default"]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsxs(m,{variant:"ghost",onClick:()=>y.length>0?i("account"):i("provider"),children:[e.jsx(R,{className:"w-4 h-4 mr-2"}),"Back"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m,{variant:"ghost",onClick:c,children:"Skip"}),e.jsx(m,{onClick:xe,disabled:!p||l.isPending,children:l.isPending?"Creating...":"Create Variant"})]})]}),e.jsx("p",{className:"text-xs text-center text-muted-foreground",children:"Skip if you just wanted to add an account without creating a variant"})]}),n==="success"&&e.jsxs("div",{className:"space-y-4 text-center",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("div",{className:"w-16 h-16 bg-green-100 dark:bg-green-900/30 rounded-full flex items-center justify-center",children:e.jsx(P,{className:"w-8 h-8 text-green-600 dark:text-green-400"})})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-lg",children:"Variant Created!"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Your custom variant is ready to use"})]}),e.jsx(U,{children:e.jsxs(K,{className:"p-4 space-y-2",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"Usage:"}),e.jsxs("code",{className:"block px-3 py-2 bg-muted rounded-md font-mono text-sm",children:["ccs ",p,' "your prompt here"']})]})}),e.jsx(m,{onClick:c,className:"w-full",children:"Done"})]})]}),e.jsx("div",{className:"flex justify-center gap-1 pt-2",children:q.map((s,B)=>e.jsx("div",{className:`w-2 h-2 rounded-full transition-colors ${pe>=B?"bg-primary":"bg-muted"}`},s))})]})})}function ze({open:a,onClose:c,provider:n,displayName:i}){const[r,u]=o.useState(""),d=J(),j=()=>{d.mutate({provider:n,nickname:r.trim()||void 0},{onSuccess:()=>{u(""),c()}})},p=f=>{!f&&!d.isPending&&(u(""),c())};return e.jsx(Z,{open:a,onOpenChange:p,children:e.jsxs(X,{className:"sm:max-w-md",children:[e.jsxs(ee,{children:[e.jsxs(se,{children:["Add ",i," Account"]}),e.jsx(te,{children:"Click the button below to authenticate a new account. A browser window will open for OAuth."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(T,{htmlFor:"nickname",children:"Nickname (optional)"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(G,{className:"w-4 h-4 text-muted-foreground"}),e.jsx(ae,{id:"nickname",value:r,onChange:f=>u(f.target.value),placeholder:"e.g., work, personal",disabled:d.isPending,className:"flex-1"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"A friendly name to identify this account. Auto-generated from email if left empty."})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-2",children:[e.jsx(m,{variant:"ghost",onClick:c,disabled:d.isPending,children:"Cancel"}),e.jsx(m,{onClick:j,disabled:d.isPending,children:d.isPending?e.jsxs(e.Fragment,{children:[e.jsx(re,{className:"w-4 h-4 mr-2 animate-spin"}),"Authenticating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"w-4 h-4 mr-2"}),"Authenticate"]})})]}),d.isPending&&e.jsx("p",{className:"text-sm text-center text-muted-foreground",children:"Complete the OAuth flow in your browser..."})]})]})})}function qe(a){if(!a)return"";const c=new Date(a).getTime(),i=Date.now()-c,r=Math.floor(i/(1e3*60*60)),u=Math.floor(i%(1e3*60*60)/(1e3*60));return r>0?`${r}h ${u}m`:`${u}m`}function Be(){const{data:a,isLoading:c}=Se(),n=Ae(),i=a?.running??!1;return e.jsxs("div",{className:b("rounded-lg border p-3 transition-colors",i?"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:b("w-2 h-2 rounded-full",i?"bg-green-500 animate-pulse":"bg-muted-foreground/30")}),e.jsx("span",{className:"text-sm font-medium",children:"CLIProxy Service"})]}),e.jsx("div",{className:"flex items-center gap-1",children:c?e.jsx(M,{className:"w-3 h-3 animate-spin text-muted-foreground"}):i?e.jsx(Te,{className:"w-3 h-3 text-green-600"}):e.jsx(Y,{className:"w-3 h-3 text-muted-foreground"})})]}),i&&a?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 ",a.port]}),a.sessionCount!==void 0&&a.sessionCount>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ve,{className:"w-3 h-3"}),a.sessionCount," session",a.sessionCount!==1?"s":""]}),a.startedAt&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ge,{className:"w-3 h-3"}),qe(a.startedAt)]})]}):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(m,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>n.mutate(),disabled:n.isPending,children:[n.isPending?e.jsx(M,{className:"w-3 h-3 animate-spin"}):e.jsx(Y,{className:"w-3 h-3"}),"Start"]})]})]})}function Ee({status:a,isSelected:c,onSelect:n}){const i=a.accounts?.length||0;return e.jsxs("button",{className:b("w-full flex items-center gap-3 px-3 py-2.5 rounded-lg transition-colors cursor-pointer text-left",c?"bg-primary/10 border border-primary/20":"hover:bg-muted border border-transparent"),onClick:n,children:[e.jsx(ne,{provider:a.provider,size:"md"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-sm truncate",children:a.displayName}),i>0&&e.jsx(ie,{variant:"secondary",className:"text-[10px] h-4 px-1",children:i})]}),e.jsx("div",{className:"flex items-center gap-1.5 mt-0.5",children:a.authenticated?e.jsxs(e.Fragment,{children:[e.jsx(P,{className:"w-3 h-3 text-green-600"}),e.jsx("span",{className:"text-xs text-green-600",children:"Connected"})]}):e.jsxs(e.Fragment,{children:[e.jsx(le,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Not connected"})]})})]})]})}function $e({variant:a,parentAuth:c,isSelected:n,onSelect:i,onDelete:r,isDeleting:u}){return e.jsxs("button",{className:b("group w-full flex items-center gap-3 px-3 py-2 rounded-lg transition-colors cursor-pointer text-left pl-6",n?"bg-primary/10 border border-primary/20":"hover:bg-muted border border-transparent"),onClick:i,children:[e.jsxs("div",{className:"relative",children:[e.jsx(ne,{provider:a.provider,size:"sm"}),e.jsx(ce,{className:"w-2.5 h-2.5 absolute -bottom-0.5 -right-0.5 text-muted-foreground"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-sm truncate",children:a.name}),e.jsx(ie,{variant:"outline",className:"text-[9px] h-4 px-1",children:"variant"})]}),e.jsx("div",{className:"flex items-center gap-1.5 mt-0.5",children:c?.authenticated?e.jsxs(e.Fragment,{children:[e.jsx(P,{className:"w-3 h-3 text-green-600"}),e.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["via ",a.provider]})]}):e.jsxs(e.Fragment,{children:[e.jsx(le,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Parent not connected"})]})})]}),e.jsx(m,{variant:"ghost",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100 hover:text-destructive",onClick:d=>{d.stopPropagation(),r()},disabled:u,children:e.jsx(Ie,{className:"w-3 h-3"})})]})}function Ue({onSetup:a}){return e.jsx("div",{className:"flex-1 flex items-center justify-center bg-muted/20",children:e.jsxs("div",{className:"text-center max-w-md px-8",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-muted flex items-center justify-center mx-auto mb-6",children:e.jsx(de,{className:"w-8 h-8 text-muted-foreground"})}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"CCS Profile Manager"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"Manage OAuth authentication, account preferences, and model selection for CLIProxy providers. Configure how CCS routes requests to different AI backends."}),e.jsxs("p",{className:"text-xs text-muted-foreground mb-6",children:["For live usage stats and real-time monitoring, visit the"," ",e.jsx("a",{href:"/cliproxy/control-panel",className:"text-primary hover:underline",children:"Control Panel"}),"."]}),e.jsxs(m,{onClick:a,className:"gap-2",children:[e.jsx(I,{className:"w-4 h-4"}),"Quick Setup"]})]})})}function ns(){const a=fe(),{data:c,isLoading:n}=H(),{data:i,isFetching:r}=ke(),u=Pe(),d=De(),j=Me(),[p,f]=o.useState(null),[v,A]=o.useState(null),[L,N]=o.useState(!1),[w,C]=o.useState(null),x=c?.authStatus||[],S=i?.variants||[],k=o.useMemo(()=>v?null:p&&x.some(t=>t.provider===p)?p:x.length>0?x[0].provider:null,[p,v,x]),h=x.find(t=>t.provider===k),l=S.find(t=>t.name===v),g=l?x.find(t=>t.provider===l.provider):void 0,D=()=>{a.invalidateQueries({queryKey:["cliproxy"]}),a.invalidateQueries({queryKey:["cliproxy-auth"]})},Q=t=>{f(t),A(null)},y=t=>{A(t),f(null)};return e.jsxs("div",{className:"h-[calc(100vh-100px)] flex",children:[e.jsxs("div",{className:"w-80 border-r flex flex-col bg-muted/30",children:[e.jsxs("div",{className:"p-4 border-b bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(de,{className:"w-5 h-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:"CLIProxy"})]}),e.jsx(m,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:D,disabled:r,children:e.jsx(M,{className:b("w-4 h-4",r&&"animate-spin")})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"CCS-level account management"}),e.jsxs(m,{variant:"default",size:"sm",className:"w-full gap-2",onClick:()=>N(!0),children:[e.jsx(I,{className:"w-4 h-4"}),"Quick Setup"]})]}),e.jsx(Fe,{className:"flex-1",children:e.jsxs("div",{className:"p-2",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide px-3 py-2",children:"Providers"}),n?e.jsx("div",{className:"space-y-2 px-2",children:[1,2,3,4].map(t=>e.jsx(Le,{className:"h-14 w-full rounded-lg"},t))}):e.jsx("div",{className:"space-y-1",children:x.map(t=>e.jsx(Ee,{status:t,isSelected:k===t.provider,onSelect:()=>Q(t.provider)},t.provider))}),S.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide px-3 py-2 mt-4 flex items-center gap-1.5",children:[e.jsx(ce,{className:"w-3 h-3"}),"Variants"]}),e.jsx("div",{className:"space-y-1",children:S.map(t=>e.jsx($e,{variant:t,parentAuth:x.find(O=>O.provider===t.provider),isSelected:v===t.name,onSelect:()=>y(t.name),onDelete:()=>j.mutate(t.name),isDeleting:j.isPending},t.name))})]})]})}),e.jsx("div",{className:"p-3 border-t",children:e.jsx(Be,{})}),e.jsx("div",{className:"p-3 border-t bg-background text-xs text-muted-foreground",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{children:[x.length," provider",x.length!==1?"s":""]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(P,{className:"w-3 h-3 text-green-600"}),x.filter(t=>t.authenticated).length," connected"]})]})})]}),e.jsx("div",{className:"flex-1 flex flex-col min-w-0 bg-background",children:l&&g?e.jsx($,{provider:l.name,displayName:`${l.name} (${l.provider} variant)`,authStatus:g,catalog:F[l.provider],logoProvider:l.provider,onAddAccount:()=>C({provider:l.provider,displayName:g.displayName}),onSetDefault:t=>u.mutate({provider:l.provider,accountId:t}),onRemoveAccount:t=>d.mutate({provider:l.provider,accountId:t}),isRemovingAccount:d.isPending}):h?e.jsx($,{provider:h.provider,displayName:h.displayName,authStatus:h,catalog:F[h.provider],onAddAccount:()=>C({provider:h.provider,displayName:h.displayName}),onSetDefault:t=>u.mutate({provider:h.provider,accountId:t}),onRemoveAccount:t=>d.mutate({provider:h.provider,accountId:t}),isRemovingAccount:d.isPending}):e.jsx(Ue,{onSetup:()=>N(!0)})}),e.jsx(Qe,{open:L,onClose:()=>N(!1)}),e.jsx(ze,{open:w!==null,onClose:()=>C(null),provider:w?.provider||"",displayName:w?.displayName||""})]})}export{ns as CliproxyPage};
|
package/dist/ui/assets/{cliproxy-control-panel-CROmsCnw.js → cliproxy-control-panel-DPdlwOom.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-
|
|
1
|
+
import{j as e}from"./radix-ui-DFHQr9A5.js";import{r as s}from"./react-vendor-FspHSO0w.js";import{G as b,J as d,ac as g,K as j,X as p}from"./icons-DueS9DOr.js";const N=8317,C="ccs";function y({port:t=N}){const n=s.useRef(null),[r,c]=s.useState(!0),[o,a]=s.useState(null),[x,l]=s.useState(!1),[m,u]=s.useState(!0),i=`http://localhost:${t}/management.html`;s.useEffect(()=>{(async()=>{try{(await fetch(`http://localhost:${t}/`,{signal:AbortSignal.timeout(2e3)})).ok?(l(!0),a(null)):(l(!1),a("CLIProxy returned an error"))}catch{l(!1),a("CLIProxy is not running")}})()},[t]);const h=s.useCallback(()=>{if(c(!1),n.current?.contentWindow)try{n.current.contentWindow.postMessage({type:"ccs-auto-login",apiBase:`http://localhost:${t}`,managementKey:C},`http://localhost:${t}`)}catch{console.debug("[ControlPanelEmbed] postMessage failed - cross-origin")}},[t]),f=()=>{c(!0),n.current&&(n.current.src=i)};return!x&&o?e.jsxs("div",{className:"flex-1 flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{className:"w-5 h-5 text-primary"}),e.jsx("h2",{className:"font-semibold",children:"CLIProxy Control Panel"})]}),e.jsxs("button",{className:"inline-flex items-center gap-2 px-3 py-1.5 text-sm border rounded-md hover:bg-muted",onClick:f,children:[e.jsx(d,{className:"w-4 h-4"}),"Retry"]})]}),e.jsx("div",{className:"flex-1 flex items-center justify-center bg-muted/20",children:e.jsxs("div",{className:"text-center max-w-md px-8",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-destructive/10 flex items-center justify-center mx-auto mb-6",children:e.jsx(g,{className:"w-8 h-8 text-destructive"})}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"CLIProxy Not Available"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:o}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Start a CLIProxy session with"," ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"ccs gemini"})," or run"," ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"ccs config"})," which auto-starts it."]})]})})]}):e.jsxs("div",{className:"flex-1 flex flex-col relative",children:[m&&!r&&e.jsx("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 z-20",children:e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-blue-50 dark:bg-blue-950 border border-blue-200 dark:border-blue-800 rounded-md text-sm",children:[e.jsx(j,{className:"h-3.5 w-3.5 text-blue-600"}),e.jsxs("span",{children:["Key:"," ",e.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded font-mono font-semibold",children:"ccs"})]}),e.jsx("button",{className:"text-blue-600 hover:text-blue-800 dark:hover:text-blue-400",onClick:()=>u(!1),children:e.jsx(p,{className:"h-3.5 w-3.5"})})]})}),r&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/80 z-10",children:e.jsxs("div",{className:"text-center",children:[e.jsx(d,{className:"w-8 h-8 animate-spin text-primary mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading Control Panel..."})]})}),e.jsx("iframe",{ref:n,src:i,className:"flex-1 w-full border-0",title:"CLIProxy Management Panel",onLoad:h})]})}function E(){return e.jsx("div",{className:"h-[calc(100vh-100px)] flex flex-col",children:e.jsx(y,{})})}export{E as CliproxyControlPanelPage};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-
|
|
1
|
+
import{j as e}from"./radix-ui-DFHQr9A5.js";import{r as p}from"./react-vendor-FspHSO0w.js";import{ab as $,c as d,ac as A,B as I}from"./index-DgE4vUOj.js";import{H as w,t as E}from"./code-highlight-BoHWVYut.js";import{d as K,E as O,l as M,ac as P}from"./icons-DueS9DOr.js";import"./tanstack-C4gT2P7V.js";import"./notifications-B2Pz7lik.js";import"./utils-CzKF5WmX.js";import"./form-utils-BuXDJb0w.js";const F=[/^ANTHROPIC_AUTH_TOKEN$/,/_API_KEY$/,/_AUTH_TOKEN$/,/_SECRET$/,/_SECRET_KEY$/,/^API_KEY$/,/^AUTH_TOKEN$/,/^SECRET$/,/_PASSWORD$/,/^PASSWORD$/,/_CREDENTIAL$/,/_PRIVATE_KEY$/];function H(t){return F.some(n=>n.test(t))}function V(t){if(!t.trim())return{valid:!0};try{return JSON.parse(t),{valid:!0}}catch(n){const r=n.message,u=r.match(/position (\d+)/);if(u){const m=parseInt(u[1],10),o=t.substring(0,m).split(`
|
|
2
2
|
`);return{valid:!1,error:r,line:o.length}}return{valid:!1,error:r}}}function q({value:t,onChange:n,language:a="json",readonly:r=!1,className:u,minHeight:m="300px"}){const{isDark:o}=$(),[N,h]=p.useState(!1),[l,j]=p.useState(!0),i=p.useMemo(()=>a==="json"?V(t):{valid:!0},[t,a]),b=p.useCallback(S=>e.jsx(w,{theme:o?E.nightOwl:E.github,code:S,language:a,children:({tokens:_,getLineProps:C,getTokenProps:T})=>{let c=!1;return e.jsx(e.Fragment,{children:_.map((x,g)=>e.jsx("div",{...C({line:x}),className:d(i.line===g+1&&"bg-destructive/20"),children:x.map((s,y)=>{let v=!1;if(s.types.includes("property")){const R=s.content.replace(/['"]/g,"");H(R)?c=!0:c=!1}else(s.types.includes("string")||s.types.includes("number")||s.types.includes("boolean"))&&c?(v=!0,c=!1):s.types.includes("punctuation")&&s.content!==":"&&s.content!=="["&&s.content!=="{"&&(c=!1);const f=T({token:s});return v&&l&&(f.className=d(f.className,"blur-[3px] select-none opacity-70 transition-all duration-200")),e.jsx("span",{...f},y)})},g))})}}),[o,a,i.line,l]);return e.jsxs("div",{className:d("flex flex-col",u),children:[e.jsxs("div",{className:d("relative rounded-md border overflow-hidden","bg-muted/30",N&&"ring-2 ring-ring ring-offset-2 ring-offset-background",r&&"opacity-70 cursor-not-allowed",!i.valid&&"border-destructive"),style:{minHeight:m},children:[e.jsx(A,{value:t,onValueChange:r?()=>{}:n,highlight:b,padding:12,disabled:r,onFocus:()=>h(!0),onBlur:()=>h(!1),textareaClassName:d("focus:outline-none font-mono text-sm",r&&"cursor-not-allowed"),preClassName:"font-mono text-sm",style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:"0.875rem",minHeight:m}},o?"dark-editor":"light-editor"),e.jsx("div",{className:"absolute top-2 right-2 z-10 opacity-50 hover:opacity-100 transition-opacity",children:e.jsx(I,{variant:"ghost",size:"icon",className:"h-6 w-6 bg-background/50 hover:bg-background border shadow-sm rounded-full",onClick:()=>j(!l),title:l?"Reveal sensitive values":"Mask sensitive values",children:l?e.jsx(K,{className:"h-3 w-3"}):e.jsx(O,{className:"h-3 w-3"})})})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-2 text-xs",children:[i.valid?e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",children:[e.jsx(M,{className:"w-3 h-3 text-green-500"}),"Valid ",a.toUpperCase()]}):e.jsxs("span",{className:"flex items-center gap-1 text-destructive",children:[e.jsx(P,{className:"w-3 h-3"}),i.error,i.line&&` (line ${i.line})`]}),r&&e.jsx("span",{className:"ml-auto text-muted-foreground",children:"(Read-only)"})]})]})}export{q as CodeEditor};
|