@kaitranntt/ccs 7.46.0 → 7.47.0-dev.1
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 +7 -1
- package/dist/api/services/index.d.ts +1 -1
- package/dist/api/services/index.d.ts.map +1 -1
- package/dist/api/services/index.js +3 -1
- package/dist/api/services/index.js.map +1 -1
- package/dist/api/services/provider-presets.d.ts +9 -23
- package/dist/api/services/provider-presets.d.ts.map +1 -1
- package/dist/api/services/provider-presets.js +13 -140
- package/dist/api/services/provider-presets.js.map +1 -1
- package/dist/auth/commands/create-command.d.ts.map +1 -1
- package/dist/auth/commands/create-command.js +3 -2
- package/dist/auth/commands/create-command.js.map +1 -1
- package/dist/auth/profile-detector.d.ts +1 -1
- package/dist/auth/profile-detector.d.ts.map +1 -1
- package/dist/auth/profile-detector.js +31 -13
- package/dist/auth/profile-detector.js.map +1 -1
- package/dist/ccs.js +9 -5
- package/dist/ccs.js.map +1 -1
- package/dist/cliproxy/account-safety.d.ts +13 -0
- package/dist/cliproxy/account-safety.d.ts.map +1 -1
- package/dist/cliproxy/account-safety.js +54 -1
- package/dist/cliproxy/account-safety.js.map +1 -1
- package/dist/cliproxy/auth/auth-types.d.ts +1 -1
- package/dist/cliproxy/auth/auth-types.d.ts.map +1 -1
- package/dist/cliproxy/auth/auth-types.js +12 -55
- package/dist/cliproxy/auth/auth-types.js.map +1 -1
- package/dist/cliproxy/auth/gemini-token-refresh.d.ts +5 -3
- package/dist/cliproxy/auth/gemini-token-refresh.d.ts.map +1 -1
- package/dist/cliproxy/auth/gemini-token-refresh.js +51 -35
- package/dist/cliproxy/auth/gemini-token-refresh.js.map +1 -1
- package/dist/cliproxy/auth/oauth-handler.d.ts.map +1 -1
- package/dist/cliproxy/auth/oauth-handler.js +6 -1
- package/dist/cliproxy/auth/oauth-handler.js.map +1 -1
- package/dist/cliproxy/auth/provider-refreshers/index.d.ts +2 -2
- package/dist/cliproxy/auth/provider-refreshers/index.d.ts.map +1 -1
- package/dist/cliproxy/auth/provider-refreshers/index.js +34 -34
- package/dist/cliproxy/auth/provider-refreshers/index.js.map +1 -1
- package/dist/cliproxy/catalog-cache.d.ts.map +1 -1
- package/dist/cliproxy/catalog-cache.js +2 -1
- package/dist/cliproxy/catalog-cache.js.map +1 -1
- package/dist/cliproxy/codex-reasoning-proxy.d.ts +7 -0
- package/dist/cliproxy/codex-reasoning-proxy.d.ts.map +1 -1
- package/dist/cliproxy/codex-reasoning-proxy.js +54 -9
- package/dist/cliproxy/codex-reasoning-proxy.js.map +1 -1
- package/dist/cliproxy/config/env-builder.d.ts.map +1 -1
- package/dist/cliproxy/config/env-builder.js +56 -15
- package/dist/cliproxy/config/env-builder.js.map +1 -1
- package/dist/cliproxy/config/thinking-config.d.ts.map +1 -1
- package/dist/cliproxy/config/thinking-config.js +11 -9
- package/dist/cliproxy/config/thinking-config.js.map +1 -1
- package/dist/cliproxy/executor/env-resolver.d.ts.map +1 -1
- package/dist/cliproxy/executor/env-resolver.js +7 -3
- package/dist/cliproxy/executor/env-resolver.js.map +1 -1
- package/dist/cliproxy/executor/index.d.ts.map +1 -1
- package/dist/cliproxy/executor/index.js +11 -1
- package/dist/cliproxy/executor/index.js.map +1 -1
- package/dist/cliproxy/executor/retry-handler.d.ts.map +1 -1
- package/dist/cliproxy/executor/retry-handler.js +1 -0
- package/dist/cliproxy/executor/retry-handler.js.map +1 -1
- package/dist/cliproxy/executor/thinking-override-resolver.d.ts +28 -0
- package/dist/cliproxy/executor/thinking-override-resolver.d.ts.map +1 -0
- package/dist/cliproxy/executor/thinking-override-resolver.js +109 -0
- package/dist/cliproxy/executor/thinking-override-resolver.js.map +1 -0
- package/dist/cliproxy/index.d.ts +1 -0
- package/dist/cliproxy/index.d.ts.map +1 -1
- package/dist/cliproxy/index.js +12 -3
- package/dist/cliproxy/index.js.map +1 -1
- package/dist/cliproxy/management-api-client.d.ts.map +1 -1
- package/dist/cliproxy/management-api-client.js +16 -4
- package/dist/cliproxy/management-api-client.js.map +1 -1
- package/dist/cliproxy/model-catalog.d.ts.map +1 -1
- package/dist/cliproxy/model-catalog.js +7 -2
- package/dist/cliproxy/model-catalog.js.map +1 -1
- package/dist/cliproxy/model-id-normalizer.d.ts +70 -0
- package/dist/cliproxy/model-id-normalizer.d.ts.map +1 -0
- package/dist/cliproxy/model-id-normalizer.js +120 -0
- package/dist/cliproxy/model-id-normalizer.js.map +1 -0
- package/dist/cliproxy/provider-capabilities.d.ts +21 -0
- package/dist/cliproxy/provider-capabilities.d.ts.map +1 -1
- package/dist/cliproxy/provider-capabilities.js +116 -13
- package/dist/cliproxy/provider-capabilities.js.map +1 -1
- package/dist/cliproxy/quota-fetcher-ghcp.d.ts +38 -0
- package/dist/cliproxy/quota-fetcher-ghcp.d.ts.map +1 -0
- package/dist/cliproxy/quota-fetcher-ghcp.js +207 -0
- package/dist/cliproxy/quota-fetcher-ghcp.js.map +1 -0
- package/dist/cliproxy/quota-types.d.ts +49 -2
- package/dist/cliproxy/quota-types.d.ts.map +1 -1
- package/dist/cliproxy/quota-types.js +1 -1
- package/dist/cliproxy/thinking-validator.d.ts +5 -0
- package/dist/cliproxy/thinking-validator.d.ts.map +1 -1
- package/dist/cliproxy/thinking-validator.js +18 -6
- package/dist/cliproxy/thinking-validator.js.map +1 -1
- package/dist/cliproxy/tool-sanitization-proxy.d.ts.map +1 -1
- package/dist/cliproxy/tool-sanitization-proxy.js +15 -5
- package/dist/cliproxy/tool-sanitization-proxy.js.map +1 -1
- package/dist/commands/api-command.d.ts.map +1 -1
- package/dist/commands/api-command.js +27 -12
- package/dist/commands/api-command.js.map +1 -1
- package/dist/commands/cliproxy/help-subcommand.js +1 -1
- package/dist/commands/cliproxy/help-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/index.d.ts.map +1 -1
- package/dist/commands/cliproxy/index.js +17 -9
- package/dist/commands/cliproxy/index.js.map +1 -1
- package/dist/commands/cliproxy/quota-subcommand.d.ts +1 -1
- package/dist/commands/cliproxy/quota-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/quota-subcommand.js +56 -1
- package/dist/commands/cliproxy/quota-subcommand.js.map +1 -1
- package/dist/commands/config-command.d.ts.map +1 -1
- package/dist/commands/config-command.js +16 -0
- package/dist/commands/config-command.js.map +1 -1
- package/dist/commands/config-thinking-command.d.ts +9 -0
- package/dist/commands/config-thinking-command.d.ts.map +1 -0
- package/dist/commands/config-thinking-command.js +237 -0
- package/dist/commands/config-thinking-command.js.map +1 -0
- package/dist/commands/config-thinking-parser.d.ts +37 -0
- package/dist/commands/config-thinking-parser.d.ts.map +1 -0
- package/dist/commands/config-thinking-parser.js +135 -0
- package/dist/commands/config-thinking-parser.js.map +1 -0
- package/dist/commands/copilot-command.d.ts.map +1 -1
- package/dist/commands/copilot-command.js +51 -0
- package/dist/commands/copilot-command.js.map +1 -1
- package/dist/commands/env-command.d.ts.map +1 -1
- package/dist/commands/env-command.js +12 -4
- package/dist/commands/env-command.js.map +1 -1
- package/dist/commands/help-command.d.ts.map +1 -1
- package/dist/commands/help-command.js +8 -2
- package/dist/commands/help-command.js.map +1 -1
- package/dist/commands/persist-command.js +1 -1
- package/dist/commands/persist-command.js.map +1 -1
- package/dist/commands/setup-command.d.ts.map +1 -1
- package/dist/commands/setup-command.js +5 -4
- package/dist/commands/setup-command.js.map +1 -1
- package/dist/commands/version-command.d.ts.map +1 -1
- package/dist/commands/version-command.js +16 -12
- package/dist/commands/version-command.js.map +1 -1
- package/dist/config/migration-manager.d.ts.map +1 -1
- package/dist/config/migration-manager.js +51 -10
- package/dist/config/migration-manager.js.map +1 -1
- package/dist/config/unified-config-types.d.ts +1 -1
- package/dist/copilot/copilot-executor.d.ts.map +1 -1
- package/dist/copilot/copilot-executor.js +3 -2
- package/dist/copilot/copilot-executor.js.map +1 -1
- package/dist/copilot/copilot-usage.d.ts +16 -0
- package/dist/copilot/copilot-usage.d.ts.map +1 -0
- package/dist/copilot/copilot-usage.js +117 -0
- package/dist/copilot/copilot-usage.js.map +1 -0
- package/dist/copilot/index.d.ts +1 -0
- package/dist/copilot/index.d.ts.map +1 -1
- package/dist/copilot/index.js +6 -1
- package/dist/copilot/index.js.map +1 -1
- package/dist/copilot/types.d.ts +31 -0
- package/dist/copilot/types.d.ts.map +1 -1
- package/dist/delegation/delegation-handler.js +1 -1
- package/dist/delegation/delegation-handler.js.map +1 -1
- package/dist/delegation/headless-executor.d.ts +1 -1
- package/dist/delegation/headless-executor.d.ts.map +1 -1
- package/dist/delegation/headless-executor.js +14 -5
- package/dist/delegation/headless-executor.js.map +1 -1
- package/dist/management/checks/system-check.d.ts.map +1 -1
- package/dist/management/checks/system-check.js +2 -0
- package/dist/management/checks/system-check.js.map +1 -1
- package/dist/shared/provider-preset-catalog.d.ts +39 -0
- package/dist/shared/provider-preset-catalog.d.ts.map +1 -0
- package/dist/shared/provider-preset-catalog.js +241 -0
- package/dist/shared/provider-preset-catalog.js.map +1 -0
- package/dist/targets/claude-adapter.js +1 -1
- package/dist/targets/claude-adapter.js.map +1 -1
- package/dist/ui/assets/{accounts-DSbC2KOq.js → accounts-BiL_RD2P.js} +1 -1
- package/dist/ui/assets/{alert-dialog-Dj5MBrPS.js → alert-dialog-BoSPpkH2.js} +1 -1
- package/dist/ui/assets/{api-BIGOe-xE.js → api-BrHcZxrF.js} +1 -1
- package/dist/ui/assets/{auth-section-BFJ1CozG.js → auth-section-CNEQOji9.js} +1 -1
- package/dist/ui/assets/{backups-section-pfBnyzOg.js → backups-section-CYPJq2Y6.js} +1 -1
- package/dist/ui/assets/cliproxy-CDDlPp51.js +3 -0
- package/dist/ui/assets/cliproxy-control-panel-XSSdoJ3f.js +1 -0
- package/dist/ui/assets/{confirm-dialog-gV1ql3Ts.js → confirm-dialog-JGLPn0Pg.js} +1 -1
- package/dist/ui/assets/copilot-Bt-S8kHA.js +3 -0
- package/dist/ui/assets/cursor-Qg3y30M0.js +1 -0
- package/dist/ui/assets/default-ports-1QQSffYX.js +1 -0
- package/dist/ui/assets/{globalenv-section-CYGF1tAO.js → globalenv-section-Dxrj87dw.js} +1 -1
- package/dist/ui/assets/{health-CmKa7iS7.js → health-Bjnrp81E.js} +1 -1
- package/dist/ui/assets/{index-BhguKKYm.js → index-ApptKWow.js} +1 -1
- package/dist/ui/assets/index-Ce5AiHY_.js +47 -0
- package/dist/ui/assets/{index-DZJVwR0i.js → index-DOQkTkq-.js} +1 -1
- package/dist/ui/assets/index-UVFLMRYY.js +1 -0
- package/dist/ui/assets/index-XJ9726WB.js +1 -0
- package/dist/ui/assets/{proxy-status-widget-B0TxmrB5.js → proxy-status-widget-PLX0fi09.js} +1 -1
- package/dist/ui/assets/{separator-D_VeEEnJ.js → separator-yZDNbi3M.js} +1 -1
- package/dist/ui/assets/{shared-Buwj9ixP.js → shared-DZ3QOOgF.js} +1 -1
- package/dist/ui/assets/{switch-DPU26P6C.js → switch-DsTWD8-1.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/dist/utils/claude-spawner.d.ts.map +1 -1
- package/dist/utils/claude-spawner.js +2 -1
- package/dist/utils/claude-spawner.js.map +1 -1
- package/dist/utils/delegation-validator.d.ts +1 -1
- package/dist/utils/delegation-validator.d.ts.map +1 -1
- package/dist/utils/delegation-validator.js +10 -4
- package/dist/utils/delegation-validator.js.map +1 -1
- package/dist/utils/percentage.d.ts +5 -0
- package/dist/utils/percentage.d.ts.map +1 -0
- package/dist/utils/percentage.js +13 -0
- package/dist/utils/percentage.js.map +1 -0
- package/dist/utils/profile-compat.d.ts +22 -0
- package/dist/utils/profile-compat.d.ts.map +1 -0
- package/dist/utils/profile-compat.js +54 -0
- package/dist/utils/profile-compat.js.map +1 -0
- package/dist/utils/shell-executor.d.ts +7 -0
- package/dist/utils/shell-executor.d.ts.map +1 -1
- package/dist/utils/shell-executor.js +21 -2
- package/dist/utils/shell-executor.js.map +1 -1
- package/dist/web-server/health/config-checks.d.ts +1 -1
- package/dist/web-server/health/config-checks.d.ts.map +1 -1
- package/dist/web-server/health/config-checks.js +43 -45
- package/dist/web-server/health/config-checks.js.map +1 -1
- package/dist/web-server/model-pricing.d.ts.map +1 -1
- package/dist/web-server/model-pricing.js +29 -16
- package/dist/web-server/model-pricing.js.map +1 -1
- package/dist/web-server/routes/cliproxy-stats-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cliproxy-stats-routes.js +57 -3
- package/dist/web-server/routes/cliproxy-stats-routes.js.map +1 -1
- package/dist/web-server/routes/copilot-routes.d.ts.map +1 -1
- package/dist/web-server/routes/copilot-routes.js +29 -0
- package/dist/web-server/routes/copilot-routes.js.map +1 -1
- package/dist/web-server/routes/misc-routes.d.ts +2 -0
- package/dist/web-server/routes/misc-routes.d.ts.map +1 -1
- package/dist/web-server/routes/misc-routes.js +38 -7
- package/dist/web-server/routes/misc-routes.js.map +1 -1
- package/package.json +1 -1
- package/dist/ui/assets/cliproxy-DHNUC4SO.js +0 -3
- package/dist/ui/assets/cliproxy-control-panel-CGHjj5lg.js +0 -1
- package/dist/ui/assets/copilot-ECO8m-1E.js +0 -3
- package/dist/ui/assets/cursor-CvqxaXRD.js +0 -1
- package/dist/ui/assets/index-Ctljzi2I.js +0 -1
- package/dist/ui/assets/index-DzvaSlcG.js +0 -47
- package/dist/ui/assets/index-WfdZ4D-M.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-qEZD5MMp.js";import{r as c}from"./react-vendor-CNOkPC89.js";import{aV as fe,aW as ye,ae as A,I as T,X as be,Y as je,Z as ve,_ as Ne,$ as z,b as J,aX as ke,aY as Ce,aZ as Pe,aS as V,aU as U,m as Se}from"./index-DzvaSlcG.js";import{S as B}from"./switch-DPU26P6C.js";import{aC as Q,R as O,e as we,q as ee,W as Ie,a1 as Ee,aD as Te,aE as Ae,T as X,aF as Le}from"./icons-DGASzt3M.js";import{P as _e}from"./proxy-status-widget-B0TxmrB5.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-Dj5MBrPS.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(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(z,{value:"http",children:"HTTP"}),e.jsx(z,{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",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(Z)==="true"}catch{return!1}}),se=a=>{te(a);try{localStorage.setItem(Z,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,Y=C??de,q=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??Y;a!==t.remote.management_key&&r({remote:{...I,management_key:a||void 0}}),P(null)},pe=()=>{const a=parseInt(l??q,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(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: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:Y,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:q,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(),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};
|