@kaitranntt/ccs 6.4.0-dev.3 → 6.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/VERSION +1 -1
- package/dist/auth/profile-detector.d.ts +1 -5
- package/dist/auth/profile-detector.d.ts.map +1 -1
- package/dist/auth/profile-detector.js +0 -31
- package/dist/auth/profile-detector.js.map +1 -1
- package/dist/ccs.d.ts +8 -0
- package/dist/ccs.d.ts.map +1 -1
- package/dist/ccs.js +11 -92
- package/dist/ccs.js.map +1 -1
- package/dist/commands/help-command.d.ts.map +1 -1
- package/dist/commands/help-command.js +0 -16
- package/dist/commands/help-command.js.map +1 -1
- package/dist/config/reserved-names.d.ts +1 -1
- package/dist/config/reserved-names.d.ts.map +1 -1
- package/dist/config/reserved-names.js +0 -2
- package/dist/config/reserved-names.js.map +1 -1
- package/dist/config/unified-config-loader.d.ts.map +1 -1
- package/dist/config/unified-config-loader.js +0 -30
- package/dist/config/unified-config-loader.js.map +1 -1
- package/dist/config/unified-config-types.d.ts +2 -45
- package/dist/config/unified-config-types.d.ts.map +1 -1
- package/dist/config/unified-config-types.js +2 -18
- package/dist/config/unified-config-types.js.map +1 -1
- package/dist/ui/assets/{accounts-OHf-47mH.js → accounts-aPbCYgXy.js} +1 -1
- package/dist/ui/assets/{analytics-C4uOxyuU.js → analytics-ByHzJ4fO.js} +1 -1
- package/dist/ui/assets/{api-B_mbwU9C.js → api-DRVliui6.js} +1 -1
- package/dist/ui/assets/{card-CR0u1y_L.js → card-CkFFTnqL.js} +1 -1
- package/dist/ui/assets/{cliproxy-tXwMpEJd.js → cliproxy-CJ5njiYX.js} +1 -1
- package/dist/ui/assets/{cliproxy-control-panel-DIIw97Bs.js → cliproxy-control-panel-C9y82uCL.js} +1 -1
- package/dist/ui/assets/{code-editor-CVohe7u9.js → code-editor-D1jkWlaX.js} +1 -1
- package/dist/ui/assets/health-B4BNP_1z.js +1 -0
- package/dist/ui/assets/icons-B9AtZK5c.js +1 -0
- package/dist/ui/assets/index-B_6ILhjh.css +1 -0
- package/dist/ui/assets/index-EyLCmFok.js +44 -0
- package/dist/ui/assets/settings-DcAQTmWn.js +1 -0
- package/dist/ui/assets/shared-DJshj6er.js +1 -0
- package/dist/ui/index.html +3 -3
- package/dist/utils/update-checker.d.ts +2 -14
- package/dist/utils/update-checker.d.ts.map +1 -1
- package/dist/utils/update-checker.js +9 -39
- package/dist/utils/update-checker.js.map +1 -1
- package/dist/web-server/routes.js +0 -275
- package/dist/web-server/routes.js.map +1 -1
- package/package.json +1 -1
- package/dist/commands/copilot-command.d.ts +0 -10
- package/dist/commands/copilot-command.d.ts.map +0 -1
- package/dist/commands/copilot-command.js +0 -227
- package/dist/commands/copilot-command.js.map +0 -1
- package/dist/copilot/copilot-auth.d.ts +0 -52
- package/dist/copilot/copilot-auth.d.ts.map +0 -1
- package/dist/copilot/copilot-auth.js +0 -201
- package/dist/copilot/copilot-auth.js.map +0 -1
- package/dist/copilot/copilot-daemon.d.ts +0 -36
- package/dist/copilot/copilot-daemon.d.ts.map +0 -1
- package/dist/copilot/copilot-daemon.js +0 -237
- package/dist/copilot/copilot-daemon.js.map +0 -1
- package/dist/copilot/copilot-executor.d.ts +0 -26
- package/dist/copilot/copilot-executor.d.ts.map +0 -1
- package/dist/copilot/copilot-executor.js +0 -144
- package/dist/copilot/copilot-executor.js.map +0 -1
- package/dist/copilot/copilot-models.d.ts +0 -34
- package/dist/copilot/copilot-models.d.ts.map +0 -1
- package/dist/copilot/copilot-models.js +0 -261
- package/dist/copilot/copilot-models.js.map +0 -1
- package/dist/copilot/copilot-package-manager.d.ts +0 -93
- package/dist/copilot/copilot-package-manager.d.ts.map +0 -1
- package/dist/copilot/copilot-package-manager.js +0 -488
- package/dist/copilot/copilot-package-manager.js.map +0 -1
- package/dist/copilot/index.d.ts +0 -13
- package/dist/copilot/index.d.ts.map +0 -1
- package/dist/copilot/index.js +0 -63
- package/dist/copilot/index.js.map +0 -1
- package/dist/copilot/types.d.ts +0 -65
- package/dist/copilot/types.d.ts.map +0 -1
- package/dist/copilot/types.js +0 -8
- package/dist/copilot/types.js.map +0 -1
- package/dist/ui/assets/copilot-C-eWI9Ce.js +0 -4
- package/dist/ui/assets/health-Dh8bSHe-.js +0 -1
- package/dist/ui/assets/icons-WTNLz24z.js +0 -1
- package/dist/ui/assets/index-BXPLu3zJ.js +0 -44
- package/dist/ui/assets/index-D2qNwUdc.css +0 -1
- package/dist/ui/assets/settings-Bi8Aw4yN.js +0 -1
- package/dist/ui/assets/shared-DQlPCpix.js +0 -1
- package/dist/ui/assets/switch-pOvJh4Ez.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,a8 as ie,a9 as oe}from"./radix-ui-VbLlN_Dz.js";import{r}from"./react-vendor-DMek_JCF.js";import{c as q,U as de,V as D,W as ce,X as me,i as xe,B as j,I as K,Y as pe}from"./index-EyLCmFok.js";import{CodeEditor as he}from"./code-editor-D1jkWlaX.js";import{p as u,ad as ue,a6 as ge,l as be,$ as z,v as L,u as F,a9 as R,k as fe,ae as X,j as je,o as Ne}from"./icons-B9AtZK5c.js";import"./tanstack-yybD444-.js";import"./notifications-cqk-Qeo2.js";import"./utils-CzKF5WmX.js";import"./form-utils-BXvNPyud.js";import"./code-highlight-C2TXE0-z.js";function H({className:a,...d}){return e.jsx(ie,{"data-slot":"switch",className:q("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",a),...d,children:e.jsx(oe,{"data-slot":"switch-thumb",className:q("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")})})}function Le(){const[a,d]=r.useState(null),[N,$]=r.useState(!0),[c,M]=r.useState(!1),[v,g]=r.useState(null),[O,A]=r.useState(!1),[n,Y]=r.useState(null),[m,P]=r.useState(!0),[x,b]=r.useState(null),[w,T]=r.useState(!1),[J,W]=r.useState(!1),[k,V]=r.useState(""),[y,_]=r.useState(""),[C,Z]=r.useState(!1),[S,Q]=r.useState(!1),[E,ee]=r.useState(!1);r.useEffect(()=>{B(),U(),G()},[]),r.useEffect(()=>{a&&(V(a.providers?.gemini?.model??"gemini-2.5-flash"),_(a.providers?.opencode?.model??"opencode/grok-code"))},[a]);const B=async()=>{try{$(!0),g(null);const s=await fetch("/api/websearch");if(!s.ok)throw new Error("Failed to load WebSearch config");const t=await s.json();d(t)}catch(s){g(s.message)}finally{$(!1)}},U=async()=>{try{P(!0);const s=await fetch("/api/websearch/status");if(!s.ok)throw new Error("Failed to load status");const t=await s.json();Y(t)}catch(s){console.error("Failed to fetch WebSearch status:",s)}finally{P(!1)}},G=async()=>{try{T(!0);const s=await fetch("/api/config/raw");if(!s.ok){b(null);return}const t=await s.text();b(t)}catch(s){console.error("Failed to fetch raw config:",s),b(null)}finally{T(!1)}},se=async()=>{if(x)try{await navigator.clipboard.writeText(x),W(!0),setTimeout(()=>W(!1),2e3)}catch(s){console.error("Failed to copy:",s)}},te=()=>{const s=a?.providers||{},t=s.gemini?.enabled??!1,i=s.grok?.enabled??!1,I=s.opencode?.enabled??!1;p({enabled:!t||i||I,providers:{...s,gemini:{...s.gemini,enabled:!t}}})},p=async s=>{if(!a)return;const t={...a,...s};d(t);try{M(!0),g(null);const i=await fetch("/api/websearch",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!i.ok){const o=await i.json();throw new Error(o.error||"Failed to save")}const I=await i.json();d(I.websearch),A(!0),setTimeout(()=>A(!1),1500),fetch("/api/config/raw").then(o=>o.ok?o.text():null).then(o=>o&&b(o)).catch(()=>{})}catch(i){d(a),g(i.message)}finally{M(!1)}},l=a?.providers?.gemini?.enabled??!1,f=a?.providers?.grok?.enabled??!1,h=a?.providers?.opencode?.enabled??!1,ae=()=>{const s=a?.providers||{},t=s.grok?.enabled??!1;p({enabled:l||!t||h,providers:{...s,grok:{...s.grok,enabled:!t}}})},re=()=>{const s=a?.providers||{},t=s.opencode?.enabled??!1;p({enabled:l||f||!t,providers:{...s,opencode:{...s.opencode,enabled:!t}}})},ne=()=>{const s=a?.providers?.gemini?.model??"gemini-2.5-flash";if(k!==s){const t=a?.providers||{};p({providers:{...t,gemini:{...t.gemini,model:k}}})}},le=()=>{const s=a?.providers?.opencode?.model??"opencode/grok-code";if(y!==s){const t=a?.providers||{};p({providers:{...t,opencode:{...t.opencode,model:y}}})}};return N?e.jsx("div",{className:"h-[calc(100vh-100px)] flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[e.jsx(u,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{className:"text-lg",children:"Loading configuration..."})]})}):e.jsx("div",{className:"h-[calc(100vh-100px)]",children:e.jsxs(de,{direction:"horizontal",className:"h-full",children:[e.jsx(D,{defaultSize:40,minSize:30,maxSize:55,children:e.jsxs("div",{className:"h-full border-r flex flex-col bg-muted/30 relative",children:[e.jsx("div",{className:"p-5 border-b bg-background",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ue,{className:"w-6 h-6 text-primary"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold",children:"WebSearch"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"CLI-based web search for third-party profiles"})]})]})}),e.jsxs("div",{className:`absolute left-5 right-5 top-20 z-10 transition-all duration-200 ease-out ${v||O?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[v&&e.jsxs(ce,{variant:"destructive",className:"py-2 shadow-lg",children:[e.jsx(ge,{className:"h-4 w-4"}),e.jsx(me,{children:v})]}),O&&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(be,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:"Saved"})]})]}),e.jsx(xe,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[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:l?"WebSearch enabled":"WebSearch disabled"}),m?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Checking status..."}):n?.readiness?e.jsx("p",{className:"text-sm text-muted-foreground",children:n.readiness.message}):null]}),e.jsx(j,{variant:"ghost",size:"sm",onClick:U,disabled:m,children:e.jsx(u,{className:`w-4 h-4 ${m?"animate-spin":""}`})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:"Providers"}),e.jsxs("div",{className:`rounded-lg border transition-colors ${l?"border-primary border-l-4":"border-border"}`,children:[e.jsxs("div",{className:"flex items-center justify-between p-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(z,{className:`w-5 h-5 ${l?"text-primary":"text-muted-foreground"}`}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"font-mono font-medium",children:"gemini"}),e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-500/10 text-green-600 font-medium",children:"FREE"}),n?.geminiCli?.installed?e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-500/10 text-green-600 font-medium",children:"installed"}):e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-amber-500/10 text-amber-600 font-medium",children:"not installed"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Google Gemini CLI (1000 req/day free)"})]})]}),e.jsx(H,{checked:l,onCheckedChange:te,disabled:c||!n?.geminiCli?.installed})]}),l&&e.jsx("div",{className:"px-4 pb-4 pt-0",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-muted-foreground whitespace-nowrap",children:"Model:"}),e.jsx(K,{value:k,onChange:s=>V(s.target.value),onBlur:ne,placeholder:"gemini-2.5-flash",className:"h-8 text-sm font-mono",disabled:c})]})}),!n?.geminiCli?.installed&&!m&&e.jsxs("div",{className:"px-4 pb-4 pt-0 border-t border-border/50",children:[e.jsxs("button",{onClick:()=>Z(!C),className:"flex items-center gap-2 text-sm text-amber-600 dark:text-amber-400 hover:underline w-full py-2",children:[C?e.jsx(L,{className:"w-4 h-4"}):e.jsx(F,{className:"w-4 h-4"}),"How to install Gemini CLI"]}),C&&e.jsxs("div",{className:"mt-2 p-3 rounded-md bg-amber-50 dark:bg-amber-900/20 text-sm",children:[e.jsx("p",{className:"text-amber-700 dark:text-amber-300 mb-2",children:"Install globally (FREE tier available):"}),e.jsx("code",{className:"text-sm bg-amber-100 dark:bg-amber-900/40 px-2 py-1 rounded font-mono block mb-2",children:"npm install -g @google/gemini-cli"}),e.jsxs("a",{href:"https://github.com/google-gemini/gemini-cli",target:"_blank",rel:"noopener noreferrer",className:"text-amber-700 dark:text-amber-300 hover:underline inline-flex items-center gap-1",children:[e.jsx(R,{className:"w-3 h-3"}),"View documentation"]})]})]})]}),e.jsxs("div",{className:`rounded-lg border transition-colors ${h?"border-primary border-l-4":"border-border"}`,children:[e.jsxs("div",{className:"flex items-center justify-between p-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(z,{className:`w-5 h-5 ${h?"text-primary":"text-muted-foreground"}`}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"font-mono font-medium",children:"opencode"}),e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-500/10 text-green-600 font-medium",children:"FREE"}),n?.opencodeCli?.installed?e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-500/10 text-green-600 font-medium",children:"installed"}):e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-amber-500/10 text-amber-600 font-medium",children:"not installed"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"OpenCode (web search via Zen)"})]})]}),e.jsx(H,{checked:h,onCheckedChange:re,disabled:c||!n?.opencodeCli?.installed})]}),h&&e.jsx("div",{className:"px-4 pb-4 pt-0",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-muted-foreground whitespace-nowrap",children:"Model:"}),e.jsx(K,{value:y,onChange:s=>_(s.target.value),onBlur:le,placeholder:"opencode/grok-code",className:"h-8 text-sm font-mono",disabled:c})]})}),!n?.opencodeCli?.installed&&!m&&e.jsxs("div",{className:"px-4 pb-4 pt-0 border-t border-border/50",children:[e.jsxs("button",{onClick:()=>Q(!S),className:"flex items-center gap-2 text-sm text-purple-600 dark:text-purple-400 hover:underline w-full py-2",children:[S?e.jsx(L,{className:"w-4 h-4"}):e.jsx(F,{className:"w-4 h-4"}),"How to install OpenCode"]}),S&&e.jsxs("div",{className:"mt-2 p-3 rounded-md bg-purple-50 dark:bg-purple-900/20 text-sm",children:[e.jsx("p",{className:"text-purple-700 dark:text-purple-300 mb-2",children:"Install globally (FREE tier available):"}),e.jsx("code",{className:"text-sm bg-purple-100 dark:bg-purple-900/40 px-2 py-1 rounded font-mono block mb-2",children:"curl -fsSL https://opencode.ai/install | bash"}),e.jsxs("a",{href:"https://github.com/sst/opencode",target:"_blank",rel:"noopener noreferrer",className:"text-purple-700 dark:text-purple-300 hover:underline inline-flex items-center gap-1",children:[e.jsx(R,{className:"w-3 h-3"}),"View documentation"]})]})]})]}),e.jsxs("div",{className:`rounded-lg border transition-colors ${f?"border-primary border-l-4":"border-border"}`,children:[e.jsxs("div",{className:"flex items-center justify-between p-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(z,{className:`w-5 h-5 ${f?"text-primary":"text-muted-foreground"}`}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"font-mono font-medium",children:"grok"}),e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-blue-500/10 text-blue-600 font-medium",children:"GROK_API_KEY"}),n?.grokCli?.installed?e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-500/10 text-green-600 font-medium",children:"installed"}):e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-amber-500/10 text-amber-600 font-medium",children:"not installed"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"xAI Grok CLI (web + X search)"})]})]}),e.jsx(H,{checked:f,onCheckedChange:ae,disabled:c||!n?.grokCli?.installed})]}),!n?.grokCli?.installed&&!m&&e.jsxs("div",{className:"px-4 pb-4 pt-0 border-t border-border/50",children:[e.jsxs("button",{onClick:()=>ee(!E),className:"flex items-center gap-2 text-sm text-blue-600 dark:text-blue-400 hover:underline w-full py-2",children:[E?e.jsx(L,{className:"w-4 h-4"}):e.jsx(F,{className:"w-4 h-4"}),"How to install Grok CLI"]}),E&&e.jsxs("div",{className:"mt-2 p-3 rounded-md bg-blue-50 dark:bg-blue-900/20 text-sm",children:[e.jsx("p",{className:"text-blue-700 dark:text-blue-300 mb-2",children:"Install globally (requires xAI API key):"}),e.jsx("code",{className:"text-sm bg-blue-100 dark:bg-blue-900/40 px-2 py-1 rounded font-mono block mb-2",children:"npm install -g @vibe-kit/grok-cli"}),e.jsxs("a",{href:"https://github.com/superagent-ai/grok-cli",target:"_blank",rel:"noopener noreferrer",className:"text-blue-700 dark:text-blue-300 hover:underline inline-flex items-center gap-1",children:[e.jsx(R,{className:"w-3 h-3"}),"View documentation"]})]})]})]})]})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(j,{variant:"outline",size:"sm",onClick:()=>{B(),G()},disabled:N||c,className:"w-full",children:[e.jsx(u,{className:`w-4 h-4 mr-2 ${N?"animate-spin":""}`}),"Refresh"]})})]})}),e.jsx(pe,{className:"w-2 bg-border hover:bg-primary/20 transition-colors cursor-col-resize flex items-center justify-center group",children:e.jsx(fe,{className:"w-3 h-3 text-muted-foreground group-hover:text-primary"})}),e.jsx(D,{defaultSize:60,minSize:35,children:e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"p-4 border-b bg-background flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(X,{className:"w-5 h-5 text-primary"}),e.jsxs("div",{children:[e.jsx("h2",{className:"font-semibold",children:"config.yaml"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"~/.ccs/config.yaml"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(j,{variant:"outline",size:"sm",onClick:se,disabled:!x,children:J?e.jsxs(e.Fragment,{children:[e.jsx(je,{className:"w-4 h-4 mr-1"}),"Copied"]}):e.jsxs(e.Fragment,{children:[e.jsx(Ne,{className:"w-4 h-4 mr-1"}),"Copy"]})}),e.jsx(j,{variant:"outline",size:"sm",onClick:G,disabled:w,children:e.jsx(u,{className:`w-4 h-4 ${w?"animate-spin":""}`})})]})]}),e.jsx("div",{className:"flex-1 overflow-auto",children:w?e.jsxs("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:[e.jsx(u,{className:"w-5 h-5 animate-spin mr-2"}),"Loading..."]}):x?e.jsx(he,{value:x,onChange:()=>{},language:"yaml",readonly:!0,minHeight:"auto",className:"min-h-full"}):e.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:e.jsxs("div",{className:"text-center",children:[e.jsx(X,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{children:"Config file not found"}),e.jsx("code",{className:"text-sm bg-muted px-2 py-1 rounded mt-2 inline-block",children:"ccs migrate"})]})})})]})})]})})}export{Le as SettingsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as s}from"./radix-ui-VbLlN_Dz.js";import{r as d}from"./react-vendor-DMek_JCF.js";import{C as l,a as m}from"./card-CkFFTnqL.js";import{a0 as c,a1 as x,W as u,a2 as h,X as p,B as g}from"./index-EyLCmFok.js";import{O as j,w as f,ah as N,T as b}from"./icons-B9AtZK5c.js";import"./tanstack-yybD444-.js";import"./notifications-cqk-Qeo2.js";import"./utils-CzKF5WmX.js";import"./form-utils-BXvNPyud.js";import"./code-highlight-C2TXE0-z.js";function D(){const[t,r]=d.useState("commands"),{data:e}=c(),{data:n,isLoading:i}=x(t),o=[{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(u,{variant:"warning",children:[s.jsx(b,{className:"h-4 w-4"}),s.jsx(h,{children:"Configuration Required"}),s.jsxs(p,{children:[e.symlinkStatus.message,". Run `ccs sync` to configure."]})]}),s.jsx("div",{className:"flex gap-2 border-b pb-2",children:o.map(a=>s.jsxs(g,{variant:t===a.id?"default":"ghost",size:"sm",onClick:()=>r(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:i?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(l,{children:s.jsxs(m,{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{D as SharedPage};
|
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-EyLCmFok.js"></script>
|
|
28
28
|
<link rel="modulepreload" crossorigin href="/assets/react-vendor-DMek_JCF.js">
|
|
29
29
|
<link rel="modulepreload" crossorigin href="/assets/radix-ui-VbLlN_Dz.js">
|
|
30
30
|
<link rel="modulepreload" crossorigin href="/assets/tanstack-yybD444-.js">
|
|
31
31
|
<link rel="modulepreload" crossorigin href="/assets/notifications-cqk-Qeo2.js">
|
|
32
32
|
<link rel="modulepreload" crossorigin href="/assets/utils-CzKF5WmX.js">
|
|
33
|
-
<link rel="modulepreload" crossorigin href="/assets/icons-
|
|
33
|
+
<link rel="modulepreload" crossorigin href="/assets/icons-B9AtZK5c.js">
|
|
34
34
|
<link rel="modulepreload" crossorigin href="/assets/form-utils-BXvNPyud.js">
|
|
35
35
|
<link rel="modulepreload" crossorigin href="/assets/code-highlight-C2TXE0-z.js">
|
|
36
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
36
|
+
<link rel="stylesheet" crossorigin href="/assets/index-B_6ILhjh.css">
|
|
37
37
|
</head>
|
|
38
38
|
<body>
|
|
39
39
|
<div id="root"></div>
|
|
@@ -40,27 +40,15 @@ export declare function writeCache(cache: UpdateCache): void;
|
|
|
40
40
|
*/
|
|
41
41
|
export declare function checkForUpdates(currentVersion: string, force?: boolean, installMethod?: 'npm' | 'direct', targetTag?: 'latest' | 'dev'): Promise<UpdateResult>;
|
|
42
42
|
/**
|
|
43
|
-
* Show update notification
|
|
43
|
+
* Show update notification
|
|
44
44
|
*/
|
|
45
45
|
export declare function showUpdateNotification(updateInfo: {
|
|
46
46
|
current: string;
|
|
47
47
|
latest: string;
|
|
48
|
-
}):
|
|
48
|
+
}): void;
|
|
49
49
|
/**
|
|
50
50
|
* Dismiss update notification for a specific version
|
|
51
51
|
*/
|
|
52
52
|
export declare function dismissUpdate(version: string): void;
|
|
53
|
-
/**
|
|
54
|
-
* Check cached update result synchronously (no network call)
|
|
55
|
-
* Returns update info if cached result indicates update available, null otherwise
|
|
56
|
-
*/
|
|
57
|
-
export declare function checkCachedUpdate(currentVersion: string): {
|
|
58
|
-
current: string;
|
|
59
|
-
latest: string;
|
|
60
|
-
} | null;
|
|
61
|
-
/**
|
|
62
|
-
* Check if cache is stale (older than CHECK_INTERVAL)
|
|
63
|
-
*/
|
|
64
|
-
export declare function isCacheStale(): boolean;
|
|
65
53
|
export {};
|
|
66
54
|
//# sourceMappingURL=update-checker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-checker.d.ts","sourceRoot":"","sources":["../../src/utils/update-checker.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"update-checker.d.ts","sourceRoot":"","sources":["../../src/utils/update-checker.ts"],"names":[],"mappings":"AAAA;;GAEG;AAeH,UAAU,WAAW;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC;AAED,UAAU,YAAY;IACpB,MAAM,EAAE,kBAAkB,GAAG,WAAW,GAAG,cAAc,CAAC;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAkCD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAW9D;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAqB5E;AAqFD;;GAEG;AACH,wBAAgB,SAAS,IAAI,WAAW,CAWvC;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAUnD;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,cAAc,EAAE,MAAM,EACtB,KAAK,UAAQ,EACb,aAAa,GAAE,KAAK,GAAG,QAAmB,EAC1C,SAAS,GAAE,QAAQ,GAAG,KAAgB,GACrC,OAAO,CAAC,YAAY,CAAC,CAmEvB;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAQ5F;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAInD"}
|
|
@@ -26,11 +26,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
26
26
|
return result;
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.
|
|
29
|
+
exports.dismissUpdate = exports.showUpdateNotification = exports.checkForUpdates = exports.writeCache = exports.readCache = exports.compareVersionsWithPrerelease = exports.compareVersions = void 0;
|
|
30
30
|
const fs = __importStar(require("fs"));
|
|
31
31
|
const path = __importStar(require("path"));
|
|
32
32
|
const os = __importStar(require("os"));
|
|
33
33
|
const https = __importStar(require("https"));
|
|
34
|
+
const ui_1 = require("./ui");
|
|
34
35
|
const CACHE_DIR = path.join(os.homedir(), '.ccs', 'cache');
|
|
35
36
|
const UPDATE_CHECK_FILE = path.join(CACHE_DIR, 'update-check.json');
|
|
36
37
|
const CHECK_INTERVAL = 24 * 60 * 60 * 1000; // 24 hours
|
|
@@ -277,19 +278,15 @@ async function checkForUpdates(currentVersion, force = false, installMethod = 'd
|
|
|
277
278
|
}
|
|
278
279
|
exports.checkForUpdates = checkForUpdates;
|
|
279
280
|
/**
|
|
280
|
-
* Show update notification
|
|
281
|
+
* Show update notification
|
|
281
282
|
*/
|
|
282
|
-
|
|
283
|
-
// Lazy import UI to ensure modules are loaded
|
|
284
|
-
const { initUI, warnBox, color } = await Promise.resolve().then(() => __importStar(require('./ui')));
|
|
285
|
-
await initUI();
|
|
286
|
-
const content = [
|
|
287
|
-
`Update available: ${updateInfo.current} -> ${updateInfo.latest}`,
|
|
288
|
-
'',
|
|
289
|
-
`Run ${color('ccs update', 'command')} to update`,
|
|
290
|
-
].join('\n');
|
|
283
|
+
function showUpdateNotification(updateInfo) {
|
|
291
284
|
console.log('');
|
|
292
|
-
console.log(
|
|
285
|
+
console.log((0, ui_1.color)('═══════════════════════════════════════════════════════', 'info'));
|
|
286
|
+
console.log((0, ui_1.warn)(`Update available: ${updateInfo.current} → ${updateInfo.latest}`));
|
|
287
|
+
console.log((0, ui_1.color)('═══════════════════════════════════════════════════════', 'info'));
|
|
288
|
+
console.log('');
|
|
289
|
+
console.log(` Run ${(0, ui_1.color)('ccs update', 'command')} to update`);
|
|
293
290
|
console.log('');
|
|
294
291
|
}
|
|
295
292
|
exports.showUpdateNotification = showUpdateNotification;
|
|
@@ -302,31 +299,4 @@ function dismissUpdate(version) {
|
|
|
302
299
|
writeCache(cache);
|
|
303
300
|
}
|
|
304
301
|
exports.dismissUpdate = dismissUpdate;
|
|
305
|
-
/**
|
|
306
|
-
* Check cached update result synchronously (no network call)
|
|
307
|
-
* Returns update info if cached result indicates update available, null otherwise
|
|
308
|
-
*/
|
|
309
|
-
function checkCachedUpdate(currentVersion) {
|
|
310
|
-
const cache = readCache();
|
|
311
|
-
// Check if cache has a newer version
|
|
312
|
-
if (cache.latest_version &&
|
|
313
|
-
compareVersionsWithPrerelease(cache.latest_version, currentVersion) > 0) {
|
|
314
|
-
// Don't show if user dismissed this version
|
|
315
|
-
if (cache.dismissed_version === cache.latest_version) {
|
|
316
|
-
return null;
|
|
317
|
-
}
|
|
318
|
-
return { current: currentVersion, latest: cache.latest_version };
|
|
319
|
-
}
|
|
320
|
-
return null;
|
|
321
|
-
}
|
|
322
|
-
exports.checkCachedUpdate = checkCachedUpdate;
|
|
323
|
-
/**
|
|
324
|
-
* Check if cache is stale (older than CHECK_INTERVAL)
|
|
325
|
-
*/
|
|
326
|
-
function isCacheStale() {
|
|
327
|
-
const cache = readCache();
|
|
328
|
-
const now = Date.now();
|
|
329
|
-
return now - cache.last_check >= CHECK_INTERVAL;
|
|
330
|
-
}
|
|
331
|
-
exports.isCacheStale = isCacheStale;
|
|
332
302
|
//# sourceMappingURL=update-checker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-checker.js","sourceRoot":"","sources":["../../src/utils/update-checker.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AACzB,6CAA+B;
|
|
1
|
+
{"version":3,"file":"update-checker.js","sourceRoot":"","sources":["../../src/utils/update-checker.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AACzB,6CAA+B;AAC/B,6BAAmC;AAEnC,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAC3D,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;AACpE,MAAM,cAAc,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,WAAW;AACvD,MAAM,cAAc,GAAG,6DAA6D,CAAC;AACrF,MAAM,iBAAiB,GAAG,4CAA4C,CAAC;AACvE,MAAM,eAAe,GAAG,IAAI,CAAC,CAAC,YAAY;AAwB1C;;GAEG;AACH,SAAS,YAAY,CAAC,OAAe;IACnC,gCA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AG,CAAC,IAAA,UAAK,EAAC,yDAAyD,EAAE,MAAM,CAAC,CAAC,CAAC;IACtF,OAAO,CAAC,GAAG,CAAC,IAAA,SAAI,EAAC,qBAAqB,UAAU,CAAC,OAAO,MAAM,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACpF,OAAO,CAAC,GAAG,CAAC,IAAA,UAAK,EAAC,yDAAyD,EAAE,MAAM,CAAC,CAAC,CAAC;IACtF,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,SAAS,IAAA,UAAK,EAAC,YAAY,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC;IACjE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC;AARD,wDAQC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAC,OAAe;IAC3C,MAAM,KAAK,GAAG,SAAS,EAAE,CAAC;IAC1B,KAAK,CAAC,iBAAiB,GAAG,OAAO,CAAC;IAClC,UAAU,CAAC,KAAK,CAAC,CAAC;AACpB,CAAC;AAJD,sCAIC"}
|
|
@@ -1438,279 +1438,4 @@ exports.apiRoutes.get('/websearch/status', (_req, res) => {
|
|
|
1438
1438
|
res.status(500).json({ error: error.message });
|
|
1439
1439
|
}
|
|
1440
1440
|
});
|
|
1441
|
-
// ============================================================================
|
|
1442
|
-
// COPILOT API ROUTES
|
|
1443
|
-
// GitHub Copilot integration via copilot-api proxy
|
|
1444
|
-
// ============================================================================
|
|
1445
|
-
const copilot_1 = require("../copilot");
|
|
1446
|
-
const unified_config_types_2 = require("../config/unified-config-types");
|
|
1447
|
-
const unified_config_loader_3 = require("../config/unified-config-loader");
|
|
1448
|
-
/**
|
|
1449
|
-
* GET /api/copilot/status - Get Copilot status (auth + daemon + install info)
|
|
1450
|
-
*/
|
|
1451
|
-
exports.apiRoutes.get('/copilot/status', async (_req, res) => {
|
|
1452
|
-
try {
|
|
1453
|
-
const config = (0, unified_config_loader_3.loadOrCreateUnifiedConfig)();
|
|
1454
|
-
const copilotConfig = config.copilot ?? unified_config_types_2.DEFAULT_COPILOT_CONFIG;
|
|
1455
|
-
const status = await (0, copilot_1.getCopilotStatus)(copilotConfig);
|
|
1456
|
-
const installed = (0, copilot_1.isCopilotApiInstalled)();
|
|
1457
|
-
const version = (0, copilot_1.getInstalledVersion)();
|
|
1458
|
-
res.json({
|
|
1459
|
-
enabled: copilotConfig.enabled,
|
|
1460
|
-
installed,
|
|
1461
|
-
version,
|
|
1462
|
-
authenticated: status.auth.authenticated,
|
|
1463
|
-
daemon_running: status.daemon.running,
|
|
1464
|
-
port: copilotConfig.port,
|
|
1465
|
-
model: copilotConfig.model,
|
|
1466
|
-
account_type: copilotConfig.account_type,
|
|
1467
|
-
auto_start: copilotConfig.auto_start,
|
|
1468
|
-
rate_limit: copilotConfig.rate_limit,
|
|
1469
|
-
wait_on_limit: copilotConfig.wait_on_limit,
|
|
1470
|
-
});
|
|
1471
|
-
}
|
|
1472
|
-
catch (error) {
|
|
1473
|
-
res.status(500).json({ error: error.message });
|
|
1474
|
-
}
|
|
1475
|
-
});
|
|
1476
|
-
/**
|
|
1477
|
-
* GET /api/copilot/config - Get Copilot configuration
|
|
1478
|
-
*/
|
|
1479
|
-
exports.apiRoutes.get('/copilot/config', (_req, res) => {
|
|
1480
|
-
try {
|
|
1481
|
-
const config = (0, unified_config_loader_3.loadOrCreateUnifiedConfig)();
|
|
1482
|
-
const copilotConfig = config.copilot ?? unified_config_types_2.DEFAULT_COPILOT_CONFIG;
|
|
1483
|
-
res.json(copilotConfig);
|
|
1484
|
-
}
|
|
1485
|
-
catch (error) {
|
|
1486
|
-
res.status(500).json({ error: error.message });
|
|
1487
|
-
}
|
|
1488
|
-
});
|
|
1489
|
-
/**
|
|
1490
|
-
* PUT /api/copilot/config - Update Copilot configuration
|
|
1491
|
-
*/
|
|
1492
|
-
exports.apiRoutes.put('/copilot/config', (req, res) => {
|
|
1493
|
-
try {
|
|
1494
|
-
const updates = req.body;
|
|
1495
|
-
const config = (0, unified_config_loader_3.loadOrCreateUnifiedConfig)();
|
|
1496
|
-
// Merge updates with existing config
|
|
1497
|
-
config.copilot = {
|
|
1498
|
-
enabled: updates.enabled ?? config.copilot?.enabled ?? unified_config_types_2.DEFAULT_COPILOT_CONFIG.enabled,
|
|
1499
|
-
auto_start: updates.auto_start ?? config.copilot?.auto_start ?? unified_config_types_2.DEFAULT_COPILOT_CONFIG.auto_start,
|
|
1500
|
-
port: updates.port ?? config.copilot?.port ?? unified_config_types_2.DEFAULT_COPILOT_CONFIG.port,
|
|
1501
|
-
account_type: updates.account_type ?? config.copilot?.account_type ?? unified_config_types_2.DEFAULT_COPILOT_CONFIG.account_type,
|
|
1502
|
-
rate_limit: updates.rate_limit !== undefined
|
|
1503
|
-
? updates.rate_limit
|
|
1504
|
-
: (config.copilot?.rate_limit ?? unified_config_types_2.DEFAULT_COPILOT_CONFIG.rate_limit),
|
|
1505
|
-
wait_on_limit: updates.wait_on_limit ??
|
|
1506
|
-
config.copilot?.wait_on_limit ??
|
|
1507
|
-
unified_config_types_2.DEFAULT_COPILOT_CONFIG.wait_on_limit,
|
|
1508
|
-
model: updates.model ?? config.copilot?.model ?? unified_config_types_2.DEFAULT_COPILOT_CONFIG.model,
|
|
1509
|
-
// Model mapping for opus/sonnet/haiku tiers
|
|
1510
|
-
opus_model: updates.opus_model !== undefined ? updates.opus_model : config.copilot?.opus_model,
|
|
1511
|
-
sonnet_model: updates.sonnet_model !== undefined ? updates.sonnet_model : config.copilot?.sonnet_model,
|
|
1512
|
-
haiku_model: updates.haiku_model !== undefined ? updates.haiku_model : config.copilot?.haiku_model,
|
|
1513
|
-
};
|
|
1514
|
-
(0, unified_config_loader_1.saveUnifiedConfig)(config);
|
|
1515
|
-
res.json({ success: true, copilot: config.copilot });
|
|
1516
|
-
}
|
|
1517
|
-
catch (error) {
|
|
1518
|
-
res.status(500).json({ error: error.message });
|
|
1519
|
-
}
|
|
1520
|
-
});
|
|
1521
|
-
/**
|
|
1522
|
-
* POST /api/copilot/auth/start - Start GitHub OAuth flow
|
|
1523
|
-
* Note: This is a long-running operation that opens browser
|
|
1524
|
-
*/
|
|
1525
|
-
exports.apiRoutes.post('/copilot/auth/start', async (_req, res) => {
|
|
1526
|
-
try {
|
|
1527
|
-
const result = await (0, copilot_1.startAuthFlow)();
|
|
1528
|
-
res.json(result);
|
|
1529
|
-
}
|
|
1530
|
-
catch (error) {
|
|
1531
|
-
res.status(500).json({ error: error.message });
|
|
1532
|
-
}
|
|
1533
|
-
});
|
|
1534
|
-
/**
|
|
1535
|
-
* GET /api/copilot/auth/status - Get auth status only
|
|
1536
|
-
*/
|
|
1537
|
-
exports.apiRoutes.get('/copilot/auth/status', async (_req, res) => {
|
|
1538
|
-
try {
|
|
1539
|
-
const status = await (0, copilot_1.checkAuthStatus)();
|
|
1540
|
-
res.json(status);
|
|
1541
|
-
}
|
|
1542
|
-
catch (error) {
|
|
1543
|
-
res.status(500).json({ error: error.message });
|
|
1544
|
-
}
|
|
1545
|
-
});
|
|
1546
|
-
/**
|
|
1547
|
-
* GET /api/copilot/models - Get available models
|
|
1548
|
-
*/
|
|
1549
|
-
exports.apiRoutes.get('/copilot/models', async (_req, res) => {
|
|
1550
|
-
try {
|
|
1551
|
-
const config = (0, unified_config_loader_3.loadOrCreateUnifiedConfig)();
|
|
1552
|
-
const port = config.copilot?.port ?? unified_config_types_2.DEFAULT_COPILOT_CONFIG.port;
|
|
1553
|
-
const currentModel = config.copilot?.model ?? unified_config_types_2.DEFAULT_COPILOT_CONFIG.model;
|
|
1554
|
-
const models = await (0, copilot_1.getAvailableModels)(port);
|
|
1555
|
-
// Mark current model
|
|
1556
|
-
const modelsWithCurrent = models.map((m) => ({
|
|
1557
|
-
...m,
|
|
1558
|
-
isCurrent: m.id === currentModel,
|
|
1559
|
-
}));
|
|
1560
|
-
res.json({ models: modelsWithCurrent, current: currentModel });
|
|
1561
|
-
}
|
|
1562
|
-
catch (error) {
|
|
1563
|
-
res.status(500).json({ error: error.message });
|
|
1564
|
-
}
|
|
1565
|
-
});
|
|
1566
|
-
/**
|
|
1567
|
-
* POST /api/copilot/daemon/start - Start copilot-api daemon
|
|
1568
|
-
*/
|
|
1569
|
-
exports.apiRoutes.post('/copilot/daemon/start', async (_req, res) => {
|
|
1570
|
-
try {
|
|
1571
|
-
const config = (0, unified_config_loader_3.loadOrCreateUnifiedConfig)();
|
|
1572
|
-
const copilotConfig = config.copilot ?? unified_config_types_2.DEFAULT_COPILOT_CONFIG;
|
|
1573
|
-
const result = await (0, copilot_1.startDaemon)(copilotConfig);
|
|
1574
|
-
res.json(result);
|
|
1575
|
-
}
|
|
1576
|
-
catch (error) {
|
|
1577
|
-
res.status(500).json({ error: error.message });
|
|
1578
|
-
}
|
|
1579
|
-
});
|
|
1580
|
-
/**
|
|
1581
|
-
* POST /api/copilot/daemon/stop - Stop copilot-api daemon
|
|
1582
|
-
*/
|
|
1583
|
-
exports.apiRoutes.post('/copilot/daemon/stop', async (_req, res) => {
|
|
1584
|
-
try {
|
|
1585
|
-
const result = await (0, copilot_1.stopDaemon)();
|
|
1586
|
-
res.json(result);
|
|
1587
|
-
}
|
|
1588
|
-
catch (error) {
|
|
1589
|
-
res.status(500).json({ error: error.message });
|
|
1590
|
-
}
|
|
1591
|
-
});
|
|
1592
|
-
/**
|
|
1593
|
-
* POST /api/copilot/install - Install copilot-api
|
|
1594
|
-
* Auto-installs latest version or specific version if provided
|
|
1595
|
-
*/
|
|
1596
|
-
exports.apiRoutes.post('/copilot/install', async (req, res) => {
|
|
1597
|
-
try {
|
|
1598
|
-
const { version } = req.body || {};
|
|
1599
|
-
if (version) {
|
|
1600
|
-
// Install specific version
|
|
1601
|
-
await (0, copilot_1.installCopilotApiVersion)(version);
|
|
1602
|
-
}
|
|
1603
|
-
else {
|
|
1604
|
-
// Install latest version
|
|
1605
|
-
await (0, copilot_1.ensureCopilotApi)();
|
|
1606
|
-
}
|
|
1607
|
-
const info = (0, copilot_1.getCopilotApiInfo)();
|
|
1608
|
-
res.json({
|
|
1609
|
-
success: true,
|
|
1610
|
-
installed: info.installed,
|
|
1611
|
-
version: info.version,
|
|
1612
|
-
path: info.path,
|
|
1613
|
-
});
|
|
1614
|
-
}
|
|
1615
|
-
catch (error) {
|
|
1616
|
-
res.status(500).json({ error: error.message });
|
|
1617
|
-
}
|
|
1618
|
-
});
|
|
1619
|
-
/**
|
|
1620
|
-
* GET /api/copilot/info - Get copilot-api installation info
|
|
1621
|
-
*/
|
|
1622
|
-
exports.apiRoutes.get('/copilot/info', (_req, res) => {
|
|
1623
|
-
try {
|
|
1624
|
-
const info = (0, copilot_1.getCopilotApiInfo)();
|
|
1625
|
-
res.json(info);
|
|
1626
|
-
}
|
|
1627
|
-
catch (error) {
|
|
1628
|
-
res.status(500).json({ error: error.message });
|
|
1629
|
-
}
|
|
1630
|
-
});
|
|
1631
|
-
/**
|
|
1632
|
-
* GET /api/copilot/settings/raw - Get raw copilot.settings.json
|
|
1633
|
-
* Returns the raw JSON content for editing in the code editor
|
|
1634
|
-
*/
|
|
1635
|
-
exports.apiRoutes.get('/copilot/settings/raw', (_req, res) => {
|
|
1636
|
-
try {
|
|
1637
|
-
const settingsPath = path.join((0, config_manager_1.getCcsDir)(), 'copilot.settings.json');
|
|
1638
|
-
const config = (0, unified_config_loader_3.loadOrCreateUnifiedConfig)();
|
|
1639
|
-
const copilotConfig = config.copilot ?? unified_config_types_2.DEFAULT_COPILOT_CONFIG;
|
|
1640
|
-
// Default model for all tiers
|
|
1641
|
-
const defaultModel = copilotConfig.model;
|
|
1642
|
-
// If file doesn't exist, return default structure with all model mappings
|
|
1643
|
-
if (!fs.existsSync(settingsPath)) {
|
|
1644
|
-
// Create settings structure matching CLIProxy pattern - always include all model mappings
|
|
1645
|
-
// Use 127.0.0.1 instead of localhost for more reliable local connections
|
|
1646
|
-
const defaultSettings = {
|
|
1647
|
-
env: {
|
|
1648
|
-
ANTHROPIC_BASE_URL: `http://127.0.0.1:${copilotConfig.port}`,
|
|
1649
|
-
ANTHROPIC_AUTH_TOKEN: 'copilot-managed',
|
|
1650
|
-
ANTHROPIC_MODEL: defaultModel,
|
|
1651
|
-
ANTHROPIC_DEFAULT_OPUS_MODEL: copilotConfig.opus_model || defaultModel,
|
|
1652
|
-
ANTHROPIC_DEFAULT_SONNET_MODEL: copilotConfig.sonnet_model || defaultModel,
|
|
1653
|
-
ANTHROPIC_DEFAULT_HAIKU_MODEL: copilotConfig.haiku_model || defaultModel,
|
|
1654
|
-
},
|
|
1655
|
-
};
|
|
1656
|
-
res.json({
|
|
1657
|
-
settings: defaultSettings,
|
|
1658
|
-
mtime: Date.now(),
|
|
1659
|
-
path: `~/.ccs/copilot.settings.json`,
|
|
1660
|
-
exists: false,
|
|
1661
|
-
});
|
|
1662
|
-
return;
|
|
1663
|
-
}
|
|
1664
|
-
const content = fs.readFileSync(settingsPath, 'utf-8');
|
|
1665
|
-
const settings = JSON.parse(content);
|
|
1666
|
-
const stat = fs.statSync(settingsPath);
|
|
1667
|
-
res.json({
|
|
1668
|
-
settings,
|
|
1669
|
-
mtime: stat.mtimeMs,
|
|
1670
|
-
path: `~/.ccs/copilot.settings.json`,
|
|
1671
|
-
exists: true,
|
|
1672
|
-
});
|
|
1673
|
-
}
|
|
1674
|
-
catch (error) {
|
|
1675
|
-
res.status(500).json({ error: error.message });
|
|
1676
|
-
}
|
|
1677
|
-
});
|
|
1678
|
-
/**
|
|
1679
|
-
* PUT /api/copilot/settings/raw - Save raw copilot.settings.json
|
|
1680
|
-
* Saves the raw JSON content from the code editor
|
|
1681
|
-
*/
|
|
1682
|
-
exports.apiRoutes.put('/copilot/settings/raw', (req, res) => {
|
|
1683
|
-
try {
|
|
1684
|
-
const { settings, expectedMtime } = req.body;
|
|
1685
|
-
const settingsPath = path.join((0, config_manager_1.getCcsDir)(), 'copilot.settings.json');
|
|
1686
|
-
// Check for conflict if file exists and expectedMtime provided
|
|
1687
|
-
if (fs.existsSync(settingsPath) && expectedMtime) {
|
|
1688
|
-
const stat = fs.statSync(settingsPath);
|
|
1689
|
-
if (Math.abs(stat.mtimeMs - expectedMtime) > 1000) {
|
|
1690
|
-
res.status(409).json({ error: 'File modified externally', mtime: stat.mtimeMs });
|
|
1691
|
-
return;
|
|
1692
|
-
}
|
|
1693
|
-
}
|
|
1694
|
-
// Write settings file atomically
|
|
1695
|
-
const tempPath = settingsPath + '.tmp';
|
|
1696
|
-
fs.writeFileSync(tempPath, JSON.stringify(settings, null, 2) + '\n');
|
|
1697
|
-
fs.renameSync(tempPath, settingsPath);
|
|
1698
|
-
// Also sync model mappings back to unified config
|
|
1699
|
-
const config = (0, unified_config_loader_3.loadOrCreateUnifiedConfig)();
|
|
1700
|
-
const env = settings.env || {};
|
|
1701
|
-
config.copilot = {
|
|
1702
|
-
...(config.copilot ?? unified_config_types_2.DEFAULT_COPILOT_CONFIG),
|
|
1703
|
-
model: env.ANTHROPIC_MODEL || config.copilot?.model || unified_config_types_2.DEFAULT_COPILOT_CONFIG.model,
|
|
1704
|
-
opus_model: env.ANTHROPIC_DEFAULT_OPUS_MODEL || undefined,
|
|
1705
|
-
sonnet_model: env.ANTHROPIC_DEFAULT_SONNET_MODEL || undefined,
|
|
1706
|
-
haiku_model: env.ANTHROPIC_DEFAULT_HAIKU_MODEL || undefined,
|
|
1707
|
-
};
|
|
1708
|
-
(0, unified_config_loader_1.saveUnifiedConfig)(config);
|
|
1709
|
-
const stat = fs.statSync(settingsPath);
|
|
1710
|
-
res.json({ success: true, mtime: stat.mtimeMs });
|
|
1711
|
-
}
|
|
1712
|
-
catch (error) {
|
|
1713
|
-
res.status(500).json({ error: error.message });
|
|
1714
|
-
}
|
|
1715
|
-
});
|
|
1716
1441
|
//# sourceMappingURL=routes.js.map
|