@kaitranntt/ccs 7.79.1-dev.2 → 7.79.1-dev.20
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 +29 -11
- package/dist/bin/ccsxp-runtime.d.ts.map +1 -1
- package/dist/bin/ccsxp-runtime.js +8 -0
- package/dist/bin/ccsxp-runtime.js.map +1 -1
- package/dist/bin/codex-runtime-router.d.ts +24 -0
- package/dist/bin/codex-runtime-router.d.ts.map +1 -0
- package/dist/bin/codex-runtime-router.js +91 -0
- package/dist/bin/codex-runtime-router.js.map +1 -0
- package/dist/bin/codex-runtime.d.ts +1 -0
- package/dist/bin/codex-runtime.js +7 -2
- package/dist/bin/codex-runtime.js.map +1 -1
- package/dist/ccs.js +2 -1
- package/dist/ccs.js.map +1 -1
- package/dist/cliproxy/ai-providers/model-id-normalizer.d.ts +8 -0
- package/dist/cliproxy/ai-providers/model-id-normalizer.d.ts.map +1 -1
- package/dist/cliproxy/ai-providers/model-id-normalizer.js +18 -1
- package/dist/cliproxy/ai-providers/model-id-normalizer.js.map +1 -1
- package/dist/cliproxy/ai-providers/service.d.ts.map +1 -1
- package/dist/cliproxy/ai-providers/service.js +39 -12
- package/dist/cliproxy/ai-providers/service.js.map +1 -1
- package/dist/cliproxy/quota/quota-fetcher-claude.d.ts.map +1 -1
- package/dist/cliproxy/quota/quota-fetcher-claude.js +35 -4
- package/dist/cliproxy/quota/quota-fetcher-claude.js.map +1 -1
- package/dist/cliproxy/services/oauth-usage-log-transformer.d.ts.map +1 -1
- package/dist/cliproxy/services/oauth-usage-log-transformer.js +5 -0
- package/dist/cliproxy/services/oauth-usage-log-transformer.js.map +1 -1
- package/dist/codex-auth/codex-account-identity.d.ts +8 -0
- package/dist/codex-auth/codex-account-identity.d.ts.map +1 -0
- package/dist/codex-auth/codex-account-identity.js +53 -0
- package/dist/codex-auth/codex-account-identity.js.map +1 -0
- package/dist/codex-auth/codex-auth-dashboard-service.d.ts +46 -0
- package/dist/codex-auth/codex-auth-dashboard-service.d.ts.map +1 -0
- package/dist/codex-auth/codex-auth-dashboard-service.js +228 -0
- package/dist/codex-auth/codex-auth-dashboard-service.js.map +1 -0
- package/dist/codex-auth/codex-auth-help.d.ts +7 -0
- package/dist/codex-auth/codex-auth-help.d.ts.map +1 -0
- package/dist/codex-auth/codex-auth-help.js +87 -0
- package/dist/codex-auth/codex-auth-help.js.map +1 -0
- package/dist/codex-auth/codex-auth-router.d.ts +16 -0
- package/dist/codex-auth/codex-auth-router.d.ts.map +1 -0
- package/dist/codex-auth/codex-auth-router.js +77 -0
- package/dist/codex-auth/codex-auth-router.js.map +1 -0
- package/dist/codex-auth/codex-config-symlink.d.ts +14 -0
- package/dist/codex-auth/codex-config-symlink.d.ts.map +1 -0
- package/dist/codex-auth/codex-config-symlink.js +128 -0
- package/dist/codex-auth/codex-config-symlink.js.map +1 -0
- package/dist/codex-auth/codex-profile-paths.d.ts +5 -0
- package/dist/codex-auth/codex-profile-paths.d.ts.map +1 -0
- package/dist/codex-auth/codex-profile-paths.js +58 -0
- package/dist/codex-auth/codex-profile-paths.js.map +1 -0
- package/dist/codex-auth/codex-profile-registry.d.ts +34 -0
- package/dist/codex-auth/codex-profile-registry.d.ts.map +1 -0
- package/dist/codex-auth/codex-profile-registry.js +360 -0
- package/dist/codex-auth/codex-profile-registry.js.map +1 -0
- package/dist/codex-auth/commands/create-command.d.ts +9 -0
- package/dist/codex-auth/commands/create-command.d.ts.map +1 -0
- package/dist/codex-auth/commands/create-command.js +189 -0
- package/dist/codex-auth/commands/create-command.js.map +1 -0
- package/dist/codex-auth/commands/import-default-command.d.ts +18 -0
- package/dist/codex-auth/commands/import-default-command.d.ts.map +1 -0
- package/dist/codex-auth/commands/import-default-command.js +385 -0
- package/dist/codex-auth/commands/import-default-command.js.map +1 -0
- package/dist/codex-auth/commands/index.d.ts +13 -0
- package/dist/codex-auth/commands/index.d.ts.map +1 -0
- package/dist/codex-auth/commands/index.js +27 -0
- package/dist/codex-auth/commands/index.js.map +1 -0
- package/dist/codex-auth/commands/login-command.d.ts +9 -0
- package/dist/codex-auth/commands/login-command.d.ts.map +1 -0
- package/dist/codex-auth/commands/login-command.js +152 -0
- package/dist/codex-auth/commands/login-command.js.map +1 -0
- package/dist/codex-auth/commands/remove-command.d.ts +10 -0
- package/dist/codex-auth/commands/remove-command.d.ts.map +1 -0
- package/dist/codex-auth/commands/remove-command.js +230 -0
- package/dist/codex-auth/commands/remove-command.js.map +1 -0
- package/dist/codex-auth/commands/show-command.d.ts +10 -0
- package/dist/codex-auth/commands/show-command.d.ts.map +1 -0
- package/dist/codex-auth/commands/show-command.js +127 -0
- package/dist/codex-auth/commands/show-command.js.map +1 -0
- package/dist/codex-auth/commands/show-detail-view.d.ts +7 -0
- package/dist/codex-auth/commands/show-detail-view.d.ts.map +1 -0
- package/dist/codex-auth/commands/show-detail-view.js +134 -0
- package/dist/codex-auth/commands/show-detail-view.js.map +1 -0
- package/dist/codex-auth/commands/switch-command.d.ts +7 -0
- package/dist/codex-auth/commands/switch-command.d.ts.map +1 -0
- package/dist/codex-auth/commands/switch-command.js +48 -0
- package/dist/codex-auth/commands/switch-command.js.map +1 -0
- package/dist/codex-auth/commands/types.d.ts +45 -0
- package/dist/codex-auth/commands/types.d.ts.map +1 -0
- package/dist/codex-auth/commands/types.js +85 -0
- package/dist/codex-auth/commands/types.js.map +1 -0
- package/dist/codex-auth/commands/use-command.d.ts +16 -0
- package/dist/codex-auth/commands/use-command.d.ts.map +1 -0
- package/dist/codex-auth/commands/use-command.js +86 -0
- package/dist/codex-auth/commands/use-command.js.map +1 -0
- package/dist/codex-auth/decode-id-token.d.ts +12 -0
- package/dist/codex-auth/decode-id-token.d.ts.map +1 -0
- package/dist/codex-auth/decode-id-token.js +83 -0
- package/dist/codex-auth/decode-id-token.js.map +1 -0
- package/dist/codex-auth/index.d.ts +8 -0
- package/dist/codex-auth/index.d.ts.map +1 -0
- package/dist/codex-auth/index.js +19 -0
- package/dist/codex-auth/index.js.map +1 -0
- package/dist/codex-auth/resolve-active-profile.d.ts +13 -0
- package/dist/codex-auth/resolve-active-profile.d.ts.map +1 -0
- package/dist/codex-auth/resolve-active-profile.js +161 -0
- package/dist/codex-auth/resolve-active-profile.js.map +1 -0
- package/dist/codex-auth/shell-detect.d.ts +19 -0
- package/dist/codex-auth/shell-detect.d.ts.map +1 -0
- package/dist/codex-auth/shell-detect.js +129 -0
- package/dist/codex-auth/shell-detect.js.map +1 -0
- package/dist/codex-auth/types.d.ts +26 -0
- package/dist/codex-auth/types.d.ts.map +1 -0
- package/dist/codex-auth/types.js +34 -0
- package/dist/codex-auth/types.js.map +1 -0
- package/dist/commands/persist-command.d.ts.map +1 -1
- package/dist/commands/persist-command.js +3 -2
- package/dist/commands/persist-command.js.map +1 -1
- package/dist/dispatcher/cli-argument-parser.d.ts +3 -2
- package/dist/dispatcher/cli-argument-parser.d.ts.map +1 -1
- package/dist/dispatcher/cli-argument-parser.js +37 -7
- package/dist/dispatcher/cli-argument-parser.js.map +1 -1
- package/dist/dispatcher/pre-dispatch.d.ts.map +1 -1
- package/dist/dispatcher/pre-dispatch.js +7 -0
- package/dist/dispatcher/pre-dispatch.js.map +1 -1
- package/dist/dispatcher/target-executor.d.ts +2 -2
- package/dist/dispatcher/target-executor.d.ts.map +1 -1
- package/dist/dispatcher/target-executor.js +5 -5
- package/dist/dispatcher/target-executor.js.map +1 -1
- package/dist/docker/docker-bootstrap.d.ts +1 -1
- package/dist/docker/docker-bootstrap.d.ts.map +1 -1
- package/dist/docker/docker-bootstrap.js +30 -3
- package/dist/docker/docker-bootstrap.js.map +1 -1
- package/dist/docker/docker-executor.d.ts.map +1 -1
- package/dist/docker/docker-executor.js +1 -0
- package/dist/docker/docker-executor.js.map +1 -1
- package/dist/management/checks/config-check.d.ts.map +1 -1
- package/dist/management/checks/config-check.js +10 -1
- package/dist/management/checks/config-check.js.map +1 -1
- package/dist/proxy/proxy-daemon.d.ts.map +1 -1
- package/dist/proxy/proxy-daemon.js +15 -3
- package/dist/proxy/proxy-daemon.js.map +1 -1
- package/dist/proxy/server/messages-route.d.ts.map +1 -1
- package/dist/proxy/server/messages-route.js +27 -1
- package/dist/proxy/server/messages-route.js.map +1 -1
- package/dist/shared/claude-extension-setup.d.ts.map +1 -1
- package/dist/shared/claude-extension-setup.js +21 -1
- package/dist/shared/claude-extension-setup.js.map +1 -1
- package/dist/targets/codex-cliproxy-provider-config.d.ts.map +1 -1
- package/dist/targets/codex-cliproxy-provider-config.js +56 -24
- package/dist/targets/codex-cliproxy-provider-config.js.map +1 -1
- package/dist/ui/assets/Trans-J6qQqjkU.js +1 -0
- package/dist/ui/assets/{accounts-C-sOjvWS.js → accounts-B9Y9uOFl.js} +1 -1
- package/dist/ui/assets/{alert-dialog-BrOo6Lh3.js → alert-dialog-B7gsksZn.js} +1 -1
- package/dist/ui/assets/{api-CXdC3ABc.js → api-Cz8U6P7R.js} +1 -1
- package/dist/ui/assets/{auth-section-XJ5PohAT.js → auth-section-C8dzvYje.js} +1 -1
- package/dist/ui/assets/{backups-section-DjMi9NN5.js → backups-section-D0dn59k8.js} +1 -1
- package/dist/ui/assets/{channels-dD6o7KFj.js → channels-BEmwDrRW.js} +1 -1
- package/dist/ui/assets/{checkbox-CVS69doq.js → checkbox-DD0s2D_O.js} +1 -1
- package/dist/ui/assets/{claude-extension-D47wkgfq.js → claude-extension-DHVBsw6b.js} +1 -1
- package/dist/ui/assets/{cliproxy-CXgzAe6X.js → cliproxy-BMlbpAIO.js} +2 -2
- package/dist/ui/assets/{cliproxy-ai-providers-POOrpQVc.js → cliproxy-ai-providers-B440rPlH.js} +2 -2
- package/dist/ui/assets/{cliproxy-control-panel-BWa_KiNM.js → cliproxy-control-panel-Bo-Y41B_.js} +1 -1
- package/dist/ui/assets/codex-DPe04ol4.js +30 -0
- package/dist/ui/assets/{confirm-dialog-BuxHs897.js → confirm-dialog-MQNmqmha.js} +1 -1
- package/dist/ui/assets/{copilot-BQ4Cltbo.js → copilot-COZj29YU.js} +1 -1
- package/dist/ui/assets/{cursor-BVUNUVux.js → cursor-D0occhsH.js} +1 -1
- package/dist/ui/assets/{droid-Bw34FF6c.js → droid-CSaYFApd.js} +1 -1
- package/dist/ui/assets/{globalenv-section-B4UDGHiP.js → globalenv-section-BwuNrdbO.js} +1 -1
- package/dist/ui/assets/{health-30TwUdp_.js → health-DjNOO9K-.js} +1 -1
- package/dist/ui/assets/{index-BUBCzEHD.js → index-Bm_0r3qk.js} +1 -1
- package/dist/ui/assets/{index-BxIFAuoV.js → index-Bnzie_zG.js} +1 -1
- package/dist/ui/assets/{index-C6j8gpEb.js → index-CSlgRg0s.js} +27 -27
- package/dist/ui/assets/index-CjM3Ehb8.js +1 -0
- package/dist/ui/assets/{index-BjQ5PWH7.js → index-CmOBelFi.js} +1 -1
- package/dist/ui/assets/{index-DtiygQmg.js → index-D9HfyuQr.js} +1 -1
- package/dist/ui/assets/index-G3mgTfgR.css +1 -0
- package/dist/ui/assets/{index-ByGCSVsI.js → index-i2MPNni3.js} +1 -1
- package/dist/ui/assets/{logs-CDD_WQvt.js → logs-7bWvuc1l.js} +1 -1
- package/dist/ui/assets/{masked-input-DpM1vKP_.js → masked-input-D_amxi96.js} +1 -1
- package/dist/ui/assets/proxy-status-widget-BkC-wCtI.js +1 -0
- package/dist/ui/assets/{raw-json-settings-editor-panel-D-zQkcvr.js → raw-json-settings-editor-panel-CVP5Bjfm.js} +1 -1
- package/dist/ui/assets/{searchable-select-B8Kp0x8p.js → searchable-select-e5sY7o6g.js} +1 -1
- package/dist/ui/assets/{separator-DlXQBF83.js → separator-BR5bmtI7.js} +1 -1
- package/dist/ui/assets/{shared-D_h3QKy6.js → shared-CsqW2cFN.js} +1 -1
- package/dist/ui/assets/{table-Dyt0FuBK.js → table-DPheAd4c.js} +1 -1
- package/dist/ui/assets/{updates-DfIV0IC0.js → updates-D07RjKLJ.js} +1 -1
- package/dist/ui/assets/{use-accounts-Dy2ogHT-.js → use-accounts-CWVR2NXQ.js} +1 -1
- package/dist/ui/index.html +2 -2
- package/dist/web-server/middleware/auth-middleware.d.ts.map +1 -1
- package/dist/web-server/middleware/auth-middleware.js +25 -1
- package/dist/web-server/middleware/auth-middleware.js.map +1 -1
- package/dist/web-server/routes/claude-extension-routes.d.ts.map +1 -1
- package/dist/web-server/routes/claude-extension-routes.js +5 -0
- package/dist/web-server/routes/claude-extension-routes.js.map +1 -1
- package/dist/web-server/routes/codex-routes.d.ts.map +1 -1
- package/dist/web-server/routes/codex-routes.js +14 -0
- package/dist/web-server/routes/codex-routes.js.map +1 -1
- package/lib/hooks/websearch-transformer.cjs +12 -3
- package/lib/mcp/ccs-browser-server.cjs +217 -12
- package/package.json +1 -1
- package/scripts/run-test-bucket.js +1 -0
- package/dist/ui/assets/codex-CYyPdHS4.js +0 -30
- package/dist/ui/assets/index-nSsKQx8t.css +0 -1
- package/dist/ui/assets/index-s94_IKNx.js +0 -1
- package/dist/ui/assets/proxy-status-widget-7iMiOpQe.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-nu4wz29m.js";import{r as o}from"./react-vendor-Bjx91N7w.js";import{by as ie,bz as ne,Y as E,a as Y,bA as oe,bi as O,bk as R,d as h,n as le,c as w,L as f,I as T,r as $,s as H,t as F,v as U,w as V,aI as G,M as ce,N as ue,O as xe}from"./index-C6j8gpEb.js";import{m as g,A as me}from"./proxy-C4-M_9kB.js";import{R as N,I as B,x as k,ab as ge,_ as be,bc as pe,w as Q,$ as he,a6 as fe,e as we,s as je}from"./icons-DzKUh8vG.js";import"./tanstack-bhJxV1h8.js";import"./notifications-B4_o8bcr.js";import"./utils-CzKF5WmX.js";import"./form-utils-CuHzLhJZ.js";import"./charts-eIPy2oG6.js";function ve(r,s){return{claude:{...r.claude,...s.claude},codex:{...r.codex,...s.codex}}}function Ne(){const{state:r}=ie(),s=ne(),i=o.useCallback(async()=>{try{s.setBrowserLoading(!0),s.setBrowserError(null);const d=await E.browser.get();s.setBrowserConfig(d.config),s.setBrowserStatus(d.status)}catch(d){s.setBrowserError(d.message)}finally{s.setBrowserLoading(!1),s.setBrowserStatusLoading(!1)}},[s]),a=o.useCallback(async()=>{try{s.setBrowserStatusLoading(!0),s.setBrowserError(null);const d=await E.browser.getStatus();return s.setBrowserStatus(d),d}catch(d){return s.setBrowserError(d.message),null}finally{s.setBrowserStatusLoading(!1)}},[s]),c=o.useCallback(async d=>{const l=r.browserConfig;if(!l)return!1;const b=ve(l,d);s.setBrowserConfig(b);try{s.setBrowserSaving(!0),s.setBrowserError(null);const x=await E.browser.update(d);return s.setBrowserConfig(x.browser.config),s.setBrowserStatus(x.browser.status),s.setBrowserSuccess(!0),window.setTimeout(()=>s.setBrowserSuccess(!1),1500),!0}catch(x){return s.setBrowserConfig(l),s.setBrowserError(x.message),!1}finally{s.setBrowserSaving(!1)}},[s,r.browserConfig]);return{config:r.browserConfig,status:r.browserStatus,loading:r.browserLoading,statusLoading:r.browserStatusLoading,saving:r.browserSaving,error:r.browserError,success:r.browserSuccess,fetchConfig:i,fetchStatus:a,saveConfig:c}}function ke(r){const s=r.toLowerCase();return s.includes("mac")?"darwin":s.includes("win")?"win32":"linux"}function ye(r=navigator){const s=typeof r.userAgentData?.platform=="string"?r.userAgentData.platform:"",i=typeof r.platform=="string"&&r.platform.trim()?r.platform:r.userAgent;return ke(s||i||"")}function Se(r){if(!/^\d+$/.test(r.trim()))return null;const s=Number.parseInt(r.trim(),10);return s<1||s>65535?null:s}const q=["disabled","readonly","readwrite"];function D(r,s){return r(`settingsPage.browserSection.evalMode.options.${s}`)}function Ce(r,s,i){const a=JSON.stringify(r);return i==="darwin"?`open -na "Google Chrome" --args --remote-debugging-port=${s} --user-data-dir=${a}`:i==="win32"?`chrome.exe --remote-debugging-port=${s} --user-data-dir=${a}`:`google-chrome --remote-debugging-port=${s} --user-data-dir=${a}`}function J({children:r,className:s,title:i,description:a,badge:c,action:d}){return e.jsx("div",{className:w("group relative overflow-hidden rounded-[2.5rem] border border-border/60 bg-muted/20 p-1.5 transition-all duration-700 ease-[cubic-bezier(0.32,0.72,0,1)] dark:border-white/[0.08] dark:bg-zinc-900/35",s),children:e.jsxs("div",{className:"relative overflow-hidden rounded-[calc(2.5rem-0.375rem)] border border-border/70 bg-card/90 shadow-[0_12px_36px_-18px_rgba(15,23,42,0.18)] dark:border-white/[0.08] dark:bg-zinc-900/70 dark:shadow-[0_18px_44px_-24px_rgba(0,0,0,0.55)]",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 shadow-[inset_0_1px_0_rgba(255,255,255,0.28)] dark:shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]"}),(i||d)&&e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4 border-b border-border/60 px-8 py-6 dark:border-white/[0.06]",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h3",{className:"text-xl font-semibold tracking-tight",children:i}),c]}),a&&e.jsx("p",{className:"text-sm text-muted-foreground",children:a})]}),d&&e.jsx("div",{className:"flex items-center gap-2",children:d})]}),e.jsx("div",{className:"px-8 py-8",children:r})]})})}function K({state:r,title:s,detail:i,nextStep:a}){const{t:c}=Y(),d=r==="ready"||r==="enabled",l=!d&&r!=="disabled";return e.jsx("div",{className:w("relative overflow-hidden rounded-2xl border p-4 transition-all duration-500",d?"border-emerald-500/20 bg-emerald-500/[0.03] dark:bg-emerald-500/[0.02]":l?"border-amber-500/20 bg-amber-500/[0.03] dark:bg-amber-500/[0.02]":"border-border/60 bg-muted/30 dark:border-white/[0.06] dark:bg-zinc-900/45"),children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:w("flex h-10 w-10 shrink-0 items-center justify-center rounded-xl transition-transform duration-500 group-hover:scale-110",d?"bg-emerald-500/10 text-emerald-600":l?"bg-amber-500/10 text-amber-600":"bg-slate-500/10 text-slate-500"),children:d?e.jsx(k,{size:24}):l?e.jsx(Q,{size:24}):e.jsx(B,{size:24})}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-semibold uppercase tracking-wider text-muted-foreground/60",children:c("settingsPage.browserSection.readiness")}),d&&e.jsx(g.span,{animate:{opacity:[.4,1,.4]},transition:{duration:2,repeat:1/0},className:"h-1.5 w-1.5 rounded-full bg-emerald-500"})]}),e.jsx("h4",{className:"font-medium text-foreground",children:s}),e.jsx("p",{className:"text-sm leading-relaxed text-muted-foreground",children:i}),a&&e.jsxs("div",{className:"mt-3 flex items-start gap-2 rounded-lg border border-border/50 bg-muted/35 p-3 dark:border-white/[0.05] dark:bg-zinc-900/45",children:[e.jsx(fe,{size:14,className:"mt-0.5 shrink-0 text-primary"}),e.jsxs("p",{className:"text-xs leading-normal",children:[e.jsxs("span",{className:"font-semibold text-primary",children:[c("settingsPage.browserSection.nextStep"),":"]})," ",a]})]})]})]})})}function W({title:r,children:s,defaultOpen:i=!1}){const[a,c]=o.useState(i);return e.jsxs(ce,{open:a,onOpenChange:c,className:"overflow-hidden rounded-2xl border border-border/60 bg-muted/20 dark:border-white/[0.06] dark:bg-zinc-900/30",children:[e.jsx(ue,{asChild:!0,children:e.jsxs("button",{className:"flex w-full items-center justify-between px-6 py-4 text-sm font-medium transition-colors hover:bg-muted/40 dark:hover:bg-zinc-900/50",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(we,{size:16,className:"text-muted-foreground"}),r]}),e.jsx(je,{size:16,className:w("transition-transform duration-300",a&&"rotate-180")})]})}),e.jsx(xe,{children:e.jsx("div",{className:"border-t border-border/60 px-6 py-6 dark:border-white/[0.06]",children:s})})]})}function Oe(){const{t:r}=Y(),{fetchRawConfig:s}=oe(),{config:i,status:a,loading:c,statusLoading:d,saving:l,error:b,success:x,fetchConfig:y,fetchStatus:L,saveConfig:S}=Ne(),[Z,m]=o.useState(null),[ee,C]=o.useState(null),[P,p]=o.useState(null);o.useEffect(()=>{y()},[y]),o.useEffect(()=>{if(!P&&!x)return;const n=window.setTimeout(()=>p(null),2500);return()=>window.clearTimeout(n)},[P,x]);const t=Z??i,j=o.useMemo(()=>t?Ce(t.claude.userDataDir,t.claude.devtoolsPort,ye()):"",[t]),M=ee??String(t?.claude.devtoolsPort??9222),v=Se(M),z=M.trim().length>0&&v===null,_=i!==null&&t!==null&&(i.claude.enabled!==t.claude.enabled||i.claude.userDataDir!==t.claude.userDataDir||i.claude.devtoolsPort!==v||i.claude.evalMode!==t.claude.evalMode),re=i!==null&&t!==null&&(i.codex.enabled!==t.codex.enabled||i.codex.evalMode!==t.codex.evalMode),I=o.useCallback(async()=>{p(null),m(null),C(null),await Promise.all([y(),s()])},[y,s]),se=o.useCallback(async()=>{await L()&&p(r("settingsPage.browserSection.messages.statusRefreshed"))},[L,r]),ae=o.useCallback(async()=>{if(!t||v===null)return;await S({claude:{enabled:t.claude.enabled,userDataDir:t.claude.userDataDir.trim(),devtoolsPort:v,evalMode:t.claude.evalMode}})&&(await s(),p(null),m(null),C(null))},[v,t,s,S]),te=o.useCallback(async()=>{if(!t)return;await S({codex:{enabled:t.codex.enabled,evalMode:t.codex.evalMode}})&&(await s(),p(null),m(null),C(null))},[t,s,S]),de=o.useCallback(async()=>{j&&(await navigator.clipboard.writeText(j),p(r("settingsPage.browserSection.messages.launchCommandCopied")))},[j,r]);return c?e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-4 text-muted-foreground",children:[e.jsx(g.div,{animate:{rotate:360},transition:{duration:1.5,repeat:1/0,ease:"linear"},children:e.jsx(N,{size:32})}),e.jsx("span",{className:"text-sm font-medium uppercase tracking-widest opacity-60",children:r("settings.loading")})]})}):!i||!a||!t?e.jsx("div",{className:"p-8",children:e.jsxs(O,{variant:"destructive",className:"rounded-[2rem] p-8 shadow-xl",children:[e.jsx(B,{size:24}),e.jsx(R,{className:"mt-2 text-md leading-relaxed",children:b??r("settingsPage.browserSection.description")}),e.jsx("div",{className:"mt-6",children:e.jsxs(h,{variant:"outline",className:"rounded-full px-6 transition-transform active:scale-95",onClick:I,children:[e.jsx(N,{className:"mr-2 h-4 w-4"}),r("sharedPage.retry")]})})]})}):e.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col overflow-hidden bg-background",children:[e.jsx(me,{children:(b||x||P)&&e.jsx(g.div,{initial:{opacity:0,y:-20,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-20,scale:.95},className:"absolute left-1/2 top-6 z-50 -translate-x-1/2",children:b?e.jsxs("div",{className:"flex items-center gap-3 rounded-full border border-rose-500/20 bg-card/95 px-6 py-2.5 text-sm font-medium text-rose-600 shadow-2xl dark:bg-zinc-900/85",children:[e.jsx(B,{size:18}),b]}):e.jsxs("div",{className:"flex items-center gap-3 rounded-full border border-emerald-500/20 bg-card/95 px-6 py-2.5 text-sm font-medium text-emerald-600 shadow-2xl dark:bg-zinc-900/85",children:[e.jsx(k,{size:18}),P??r("commonToast.settingsSaved")]})})}),e.jsx(le,{className:"flex-1",children:e.jsxs("div",{className:"mx-auto max-w-[1240px] space-y-12 p-8 py-16",children:[e.jsxs(g.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"flex flex-wrap items-end justify-between gap-6",children:[e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-2xl bg-primary/10 text-primary",children:e.jsx(ge,{size:28})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:r("settingsPage.browserSection.title")}),e.jsx("p",{className:"mt-1 text-muted-foreground",children:r("settingsPage.browserSection.description")})]})]})}),e.jsxs(h,{variant:"outline",className:"rounded-full border-border/70 bg-background/85 shadow-sm transition-all hover:bg-muted/50 active:scale-95 dark:border-white/[0.08] dark:bg-zinc-900/70 dark:hover:bg-zinc-900",onClick:I,disabled:l||c,children:[e.jsx(N,{className:w("mr-2 h-4 w-4",d&&"animate-spin")}),r("settings.refresh")]})]}),e.jsx(g.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},children:e.jsxs(O,{className:"items-center rounded-3xl border-primary/10 bg-primary/[0.04] p-6 py-4 dark:border-primary/15 dark:bg-primary/[0.05]",children:[e.jsx(be,{className:"h-5 w-5 text-primary"}),e.jsxs(R,{className:"ml-2 text-sm",children:[e.jsx("span",{className:"font-semibold text-primary/80",children:r("settingsPage.browserSection.primaryTitle")})," ",r("settingsPage.browserSection.primaryDescription")]})]})}),e.jsx(g.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},children:e.jsx(J,{title:r("settingsPage.browserSection.claude.title"),description:r("settingsPage.browserSection.claude.description"),action:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-border/60 bg-muted/30 px-4 py-2 dark:border-white/[0.06] dark:bg-zinc-900/45",children:[e.jsx(f,{htmlFor:"browser-claude-enabled",className:"cursor-pointer text-xs font-semibold leading-none",children:t.claude.enabled?"ENABLED":"DISABLED"}),e.jsx(G,{id:"browser-claude-enabled",checked:t.claude.enabled,onCheckedChange:n=>m(u=>A(u??t,{enabled:n}))})]}),e.jsxs(h,{onClick:ae,disabled:l||z||!_,className:"rounded-full px-6 shadow-md transition-transform active:scale-95",children:[l?e.jsx(N,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(k,{size:16,className:"mr-2"}),r("settingsPage.browserSection.actions.saveClaude")]}),e.jsxs(h,{variant:"outline",className:"rounded-full border-border/70 bg-background/85 shadow-sm transition-all hover:bg-muted/50 active:scale-95 dark:border-white/[0.08] dark:bg-zinc-900/70 dark:hover:bg-zinc-900",onClick:se,disabled:l||d||_||z,children:[e.jsx(he,{size:16,className:"mr-2"}),r("settingsPage.browserSection.actions.testConnection")]})]}),children:e.jsxs("div",{className:"grid gap-12",children:[e.jsx(K,{state:a.claude.state,title:a.claude.title,detail:a.claude.detail,nextStep:a.claude.nextStep}),e.jsxs("div",{className:"grid gap-8 lg:grid-cols-2",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(f,{htmlFor:"browser-claude-user-data-dir",className:"text-sm font-semibold tracking-wide text-muted-foreground/80",children:r("settingsPage.browserSection.claude.userDataDir")}),e.jsx(T,{id:"browser-claude-user-data-dir",value:t.claude.userDataDir,onChange:n=>m(u=>A(u??t,{userDataDir:n.target.value})),className:"rounded-xl border-border/70 bg-background/85 dark:border-white/[0.08] dark:bg-zinc-900/70",placeholder:a.claude.recommendedUserDataDir}),e.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground/70",children:r("settingsPage.browserSection.claude.userDataDirHint")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(f,{htmlFor:"browser-claude-devtools-port",className:"text-sm font-semibold tracking-wide text-muted-foreground/80",children:r("settingsPage.browserSection.claude.devtoolsPort")}),e.jsx(T,{id:"browser-claude-devtools-port",value:M,onChange:n=>C(n.target.value),inputMode:"numeric",className:"max-w-[120px] rounded-xl border-border/70 bg-background/85 dark:border-white/[0.08] dark:bg-zinc-900/70"}),e.jsx("p",{className:w("text-[11px] leading-relaxed text-muted-foreground/70",z&&"text-rose-500"),children:r(z?"settingsPage.browserSection.claude.devtoolsPortInvalid":"settingsPage.browserSection.claude.devtoolsPortHint")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(f,{className:"text-sm font-semibold tracking-wide text-muted-foreground/80",children:r("settingsPage.browserSection.evalMode.label")}),e.jsxs($,{value:t.claude.evalMode,onValueChange:n=>m(u=>A(u??t,{evalMode:n})),children:[e.jsx(H,{className:"rounded-xl border-border/70 bg-background/85 dark:border-white/[0.08] dark:bg-zinc-900/70",children:e.jsx(F,{})}),e.jsx(U,{children:q.map(n=>e.jsx(V,{value:n,children:D(r,n)},n))})]}),e.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground/70",children:r("settingsPage.browserSection.claude.evalModeHint")})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"group/launch relative overflow-hidden rounded-2xl border border-border/60 bg-muted/20 p-5 transition-all hover:bg-muted/35 dark:border-white/[0.06] dark:bg-zinc-900/35 dark:hover:bg-zinc-900/50",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[11px] font-bold uppercase tracking-[0.15em] text-primary/70",children:r("settingsPage.browserSection.claude.launchGuidance")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:r("settingsPage.browserSection.claude.launchGuidanceHint")})]}),e.jsx(h,{variant:"ghost",size:"sm",className:"h-8 w-8 rounded-full p-0 transition-transform active:scale-90",onClick:de,disabled:!j,children:e.jsx(pe,{size:18})})]}),e.jsx("code",{className:"mt-4 block break-all rounded-lg border border-border/50 bg-background/80 p-3 font-mono text-[10px] leading-relaxed dark:border-white/[0.05] dark:bg-zinc-900/60",children:j})]}),a.claude.overrideActive&&e.jsxs("div",{className:"flex items-center gap-3 rounded-2xl border border-amber-500/10 bg-amber-500/[0.05] p-4 text-xs font-medium text-amber-700 dark:text-amber-300",children:[e.jsx(Q,{size:18}),r("settingsPage.browserSection.claude.overrideMessage",{source:a.claude.source})]})]})]}),e.jsx(W,{title:r("settingsPage.browserSection.technicalDetails"),defaultOpen:a.claude.state!=="ready",children:e.jsxs("div",{className:"grid gap-6 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground/50",children:r("settingsPage.browserSection.claude.effectivePath")}),e.jsx("div",{className:"rounded-lg border border-border/50 bg-muted/25 p-3 dark:border-white/[0.05] dark:bg-zinc-900/45",children:e.jsx("p",{className:"break-all font-mono text-[11px] leading-relaxed",children:a.claude.effectiveUserDataDir})}),e.jsxs("p",{className:"text-[10px] font-medium text-muted-foreground/60",children:[e.jsxs("span",{className:"font-bold",children:[r("settingsPage.browserSection.claude.recommendedPath"),":"]})," ",a.claude.recommendedUserDataDir]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground/50",children:r("settingsPage.browserSection.claude.managedRuntime")}),e.jsxs("div",{className:"rounded-lg border border-border/50 bg-muted/25 p-3 dark:border-white/[0.05] dark:bg-zinc-900/45",children:[e.jsx("p",{className:"font-semibold text-primary/80",children:a.claude.managedMcpServerName}),e.jsx("p",{className:"mt-1 break-all font-mono text-[11px] leading-relaxed text-muted-foreground/80",children:a.claude.managedMcpServerPath})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground/50",children:r("settingsPage.browserSection.evalMode.label")}),e.jsx("div",{className:"rounded-lg border border-border/50 bg-muted/25 p-3 dark:border-white/[0.05] dark:bg-zinc-900/45",children:e.jsx("p",{className:"font-mono text-[11px] font-semibold",children:D(r,a.claude.evalMode)})})]})]})})]})})}),e.jsx(g.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.3},children:e.jsx(J,{title:r("settingsPage.browserSection.codex.title"),description:r("settingsPage.browserSection.codex.description"),action:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-border/60 bg-muted/30 px-4 py-2 dark:border-white/[0.06] dark:bg-zinc-900/45",children:[e.jsx(f,{htmlFor:"browser-codex-enabled",className:"cursor-pointer text-xs font-semibold leading-none",children:t.codex.enabled?"ENABLED":"DISABLED"}),e.jsx(G,{id:"browser-codex-enabled",checked:t.codex.enabled,onCheckedChange:n=>m(u=>X(u??t,{enabled:n}))})]}),e.jsxs(h,{onClick:te,disabled:l||!re,className:"rounded-full px-6 shadow-md transition-transform active:scale-95",children:[l?e.jsx(N,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(k,{size:16,className:"mr-2"}),r("settingsPage.browserSection.actions.saveCodex")]})]}),children:e.jsxs("div",{className:"grid gap-12",children:[e.jsx(K,{state:a.codex.state,title:a.codex.title,detail:a.codex.detail,nextStep:a.codex.nextStep}),e.jsxs("div",{className:"max-w-md space-y-3",children:[e.jsx(f,{className:"text-sm font-semibold tracking-wide text-muted-foreground/80",children:r("settingsPage.browserSection.evalMode.label")}),e.jsxs($,{value:t.codex.evalMode,onValueChange:n=>m(u=>X(u??t,{evalMode:n})),children:[e.jsx(H,{className:"rounded-xl border-border/70 bg-background/85 dark:border-white/[0.08] dark:bg-zinc-900/70",children:e.jsx(F,{})}),e.jsx(U,{children:q.map(n=>e.jsx(V,{value:n,children:D(r,n)},n))})]}),e.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground/70",children:r("settingsPage.browserSection.codex.evalModeHint")})]}),e.jsx(W,{title:r("settingsPage.browserSection.technicalDetails"),defaultOpen:a.codex.state==="unsupported_build",children:e.jsxs("div",{className:"grid gap-6 sm:grid-cols-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground/50",children:r("settingsPage.browserSection.codex.serverName")}),e.jsx("div",{className:"rounded-lg border border-border/50 bg-muted/25 p-3 dark:border-white/[0.05] dark:bg-zinc-900/45",children:e.jsx("p",{className:"font-mono text-[11px] font-semibold",children:a.codex.serverName})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground/50",children:r("settingsPage.browserSection.codex.overrideSupport")}),e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border/50 bg-muted/25 p-3 font-medium text-xs dark:border-white/[0.05] dark:bg-zinc-900/45",children:[a.codex.supportsConfigOverrides?e.jsx(k,{className:"text-emerald-500",size:16}):e.jsx(B,{className:"text-rose-500",size:16}),a.codex.supportsConfigOverrides?r("settingsPage.browserSection.codex.overrideSupported"):r("settingsPage.browserSection.codex.overrideUnsupported")]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground/50",children:r("settingsPage.browserSection.codex.binary")}),e.jsxs("div",{className:"rounded-lg border border-border/50 bg-muted/25 p-3 dark:border-white/[0.05] dark:bg-zinc-900/45",children:[e.jsx("p",{className:"break-all font-mono text-[11px] leading-relaxed",children:a.codex.binaryPath??r("settingsPage.browserSection.codex.notDetected")}),a.codex.version&&e.jsx("div",{className:"mt-2 inline-flex rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-bold text-primary",children:a.codex.version})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground/50",children:r("settingsPage.browserSection.evalMode.label")}),e.jsx("div",{className:"rounded-lg border border-border/50 bg-muted/25 p-3 dark:border-white/[0.05] dark:bg-zinc-900/45",children:e.jsx("p",{className:"font-mono text-[11px] font-semibold",children:D(r,a.codex.evalMode)})})]})]})})]})})})]})})]})}function A(r,s){return{...r,claude:{...r.claude,...s}}}function X(r,s){return{...r,codex:{...r.codex,...s}}}export{Oe as default};
|
|
1
|
+
import{j as e}from"./radix-ui-nu4wz29m.js";import{r as o}from"./react-vendor-Bjx91N7w.js";import{by as ie,bz as ne,Y as E,a as Y,bA as oe,bi as O,bk as R,d as h,n as le,c as w,L as f,I as T,r as $,s as H,t as F,v as U,w as V,aI as G,M as ce,N as ue,O as xe}from"./index-CSlgRg0s.js";import{m as g,A as me}from"./proxy-C4-M_9kB.js";import{R as N,I as B,x as k,ab as ge,_ as be,bc as pe,w as Q,$ as he,a6 as fe,e as we,s as je}from"./icons-DzKUh8vG.js";import"./tanstack-bhJxV1h8.js";import"./notifications-B4_o8bcr.js";import"./utils-CzKF5WmX.js";import"./form-utils-CuHzLhJZ.js";import"./charts-eIPy2oG6.js";function ve(r,s){return{claude:{...r.claude,...s.claude},codex:{...r.codex,...s.codex}}}function Ne(){const{state:r}=ie(),s=ne(),i=o.useCallback(async()=>{try{s.setBrowserLoading(!0),s.setBrowserError(null);const d=await E.browser.get();s.setBrowserConfig(d.config),s.setBrowserStatus(d.status)}catch(d){s.setBrowserError(d.message)}finally{s.setBrowserLoading(!1),s.setBrowserStatusLoading(!1)}},[s]),a=o.useCallback(async()=>{try{s.setBrowserStatusLoading(!0),s.setBrowserError(null);const d=await E.browser.getStatus();return s.setBrowserStatus(d),d}catch(d){return s.setBrowserError(d.message),null}finally{s.setBrowserStatusLoading(!1)}},[s]),c=o.useCallback(async d=>{const l=r.browserConfig;if(!l)return!1;const b=ve(l,d);s.setBrowserConfig(b);try{s.setBrowserSaving(!0),s.setBrowserError(null);const x=await E.browser.update(d);return s.setBrowserConfig(x.browser.config),s.setBrowserStatus(x.browser.status),s.setBrowserSuccess(!0),window.setTimeout(()=>s.setBrowserSuccess(!1),1500),!0}catch(x){return s.setBrowserConfig(l),s.setBrowserError(x.message),!1}finally{s.setBrowserSaving(!1)}},[s,r.browserConfig]);return{config:r.browserConfig,status:r.browserStatus,loading:r.browserLoading,statusLoading:r.browserStatusLoading,saving:r.browserSaving,error:r.browserError,success:r.browserSuccess,fetchConfig:i,fetchStatus:a,saveConfig:c}}function ke(r){const s=r.toLowerCase();return s.includes("mac")?"darwin":s.includes("win")?"win32":"linux"}function ye(r=navigator){const s=typeof r.userAgentData?.platform=="string"?r.userAgentData.platform:"",i=typeof r.platform=="string"&&r.platform.trim()?r.platform:r.userAgent;return ke(s||i||"")}function Se(r){if(!/^\d+$/.test(r.trim()))return null;const s=Number.parseInt(r.trim(),10);return s<1||s>65535?null:s}const q=["disabled","readonly","readwrite"];function D(r,s){return r(`settingsPage.browserSection.evalMode.options.${s}`)}function Ce(r,s,i){const a=JSON.stringify(r);return i==="darwin"?`open -na "Google Chrome" --args --remote-debugging-port=${s} --user-data-dir=${a}`:i==="win32"?`chrome.exe --remote-debugging-port=${s} --user-data-dir=${a}`:`google-chrome --remote-debugging-port=${s} --user-data-dir=${a}`}function J({children:r,className:s,title:i,description:a,badge:c,action:d}){return e.jsx("div",{className:w("group relative overflow-hidden rounded-[2.5rem] border border-border/60 bg-muted/20 p-1.5 transition-all duration-700 ease-[cubic-bezier(0.32,0.72,0,1)] dark:border-white/[0.08] dark:bg-zinc-900/35",s),children:e.jsxs("div",{className:"relative overflow-hidden rounded-[calc(2.5rem-0.375rem)] border border-border/70 bg-card/90 shadow-[0_12px_36px_-18px_rgba(15,23,42,0.18)] dark:border-white/[0.08] dark:bg-zinc-900/70 dark:shadow-[0_18px_44px_-24px_rgba(0,0,0,0.55)]",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 shadow-[inset_0_1px_0_rgba(255,255,255,0.28)] dark:shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]"}),(i||d)&&e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4 border-b border-border/60 px-8 py-6 dark:border-white/[0.06]",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h3",{className:"text-xl font-semibold tracking-tight",children:i}),c]}),a&&e.jsx("p",{className:"text-sm text-muted-foreground",children:a})]}),d&&e.jsx("div",{className:"flex items-center gap-2",children:d})]}),e.jsx("div",{className:"px-8 py-8",children:r})]})})}function K({state:r,title:s,detail:i,nextStep:a}){const{t:c}=Y(),d=r==="ready"||r==="enabled",l=!d&&r!=="disabled";return e.jsx("div",{className:w("relative overflow-hidden rounded-2xl border p-4 transition-all duration-500",d?"border-emerald-500/20 bg-emerald-500/[0.03] dark:bg-emerald-500/[0.02]":l?"border-amber-500/20 bg-amber-500/[0.03] dark:bg-amber-500/[0.02]":"border-border/60 bg-muted/30 dark:border-white/[0.06] dark:bg-zinc-900/45"),children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:w("flex h-10 w-10 shrink-0 items-center justify-center rounded-xl transition-transform duration-500 group-hover:scale-110",d?"bg-emerald-500/10 text-emerald-600":l?"bg-amber-500/10 text-amber-600":"bg-slate-500/10 text-slate-500"),children:d?e.jsx(k,{size:24}):l?e.jsx(Q,{size:24}):e.jsx(B,{size:24})}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-semibold uppercase tracking-wider text-muted-foreground/60",children:c("settingsPage.browserSection.readiness")}),d&&e.jsx(g.span,{animate:{opacity:[.4,1,.4]},transition:{duration:2,repeat:1/0},className:"h-1.5 w-1.5 rounded-full bg-emerald-500"})]}),e.jsx("h4",{className:"font-medium text-foreground",children:s}),e.jsx("p",{className:"text-sm leading-relaxed text-muted-foreground",children:i}),a&&e.jsxs("div",{className:"mt-3 flex items-start gap-2 rounded-lg border border-border/50 bg-muted/35 p-3 dark:border-white/[0.05] dark:bg-zinc-900/45",children:[e.jsx(fe,{size:14,className:"mt-0.5 shrink-0 text-primary"}),e.jsxs("p",{className:"text-xs leading-normal",children:[e.jsxs("span",{className:"font-semibold text-primary",children:[c("settingsPage.browserSection.nextStep"),":"]})," ",a]})]})]})]})})}function W({title:r,children:s,defaultOpen:i=!1}){const[a,c]=o.useState(i);return e.jsxs(ce,{open:a,onOpenChange:c,className:"overflow-hidden rounded-2xl border border-border/60 bg-muted/20 dark:border-white/[0.06] dark:bg-zinc-900/30",children:[e.jsx(ue,{asChild:!0,children:e.jsxs("button",{className:"flex w-full items-center justify-between px-6 py-4 text-sm font-medium transition-colors hover:bg-muted/40 dark:hover:bg-zinc-900/50",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(we,{size:16,className:"text-muted-foreground"}),r]}),e.jsx(je,{size:16,className:w("transition-transform duration-300",a&&"rotate-180")})]})}),e.jsx(xe,{children:e.jsx("div",{className:"border-t border-border/60 px-6 py-6 dark:border-white/[0.06]",children:s})})]})}function Oe(){const{t:r}=Y(),{fetchRawConfig:s}=oe(),{config:i,status:a,loading:c,statusLoading:d,saving:l,error:b,success:x,fetchConfig:y,fetchStatus:L,saveConfig:S}=Ne(),[Z,m]=o.useState(null),[ee,C]=o.useState(null),[P,p]=o.useState(null);o.useEffect(()=>{y()},[y]),o.useEffect(()=>{if(!P&&!x)return;const n=window.setTimeout(()=>p(null),2500);return()=>window.clearTimeout(n)},[P,x]);const t=Z??i,j=o.useMemo(()=>t?Ce(t.claude.userDataDir,t.claude.devtoolsPort,ye()):"",[t]),M=ee??String(t?.claude.devtoolsPort??9222),v=Se(M),z=M.trim().length>0&&v===null,_=i!==null&&t!==null&&(i.claude.enabled!==t.claude.enabled||i.claude.userDataDir!==t.claude.userDataDir||i.claude.devtoolsPort!==v||i.claude.evalMode!==t.claude.evalMode),re=i!==null&&t!==null&&(i.codex.enabled!==t.codex.enabled||i.codex.evalMode!==t.codex.evalMode),I=o.useCallback(async()=>{p(null),m(null),C(null),await Promise.all([y(),s()])},[y,s]),se=o.useCallback(async()=>{await L()&&p(r("settingsPage.browserSection.messages.statusRefreshed"))},[L,r]),ae=o.useCallback(async()=>{if(!t||v===null)return;await S({claude:{enabled:t.claude.enabled,userDataDir:t.claude.userDataDir.trim(),devtoolsPort:v,evalMode:t.claude.evalMode}})&&(await s(),p(null),m(null),C(null))},[v,t,s,S]),te=o.useCallback(async()=>{if(!t)return;await S({codex:{enabled:t.codex.enabled,evalMode:t.codex.evalMode}})&&(await s(),p(null),m(null),C(null))},[t,s,S]),de=o.useCallback(async()=>{j&&(await navigator.clipboard.writeText(j),p(r("settingsPage.browserSection.messages.launchCommandCopied")))},[j,r]);return c?e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-4 text-muted-foreground",children:[e.jsx(g.div,{animate:{rotate:360},transition:{duration:1.5,repeat:1/0,ease:"linear"},children:e.jsx(N,{size:32})}),e.jsx("span",{className:"text-sm font-medium uppercase tracking-widest opacity-60",children:r("settings.loading")})]})}):!i||!a||!t?e.jsx("div",{className:"p-8",children:e.jsxs(O,{variant:"destructive",className:"rounded-[2rem] p-8 shadow-xl",children:[e.jsx(B,{size:24}),e.jsx(R,{className:"mt-2 text-md leading-relaxed",children:b??r("settingsPage.browserSection.description")}),e.jsx("div",{className:"mt-6",children:e.jsxs(h,{variant:"outline",className:"rounded-full px-6 transition-transform active:scale-95",onClick:I,children:[e.jsx(N,{className:"mr-2 h-4 w-4"}),r("sharedPage.retry")]})})]})}):e.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col overflow-hidden bg-background",children:[e.jsx(me,{children:(b||x||P)&&e.jsx(g.div,{initial:{opacity:0,y:-20,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-20,scale:.95},className:"absolute left-1/2 top-6 z-50 -translate-x-1/2",children:b?e.jsxs("div",{className:"flex items-center gap-3 rounded-full border border-rose-500/20 bg-card/95 px-6 py-2.5 text-sm font-medium text-rose-600 shadow-2xl dark:bg-zinc-900/85",children:[e.jsx(B,{size:18}),b]}):e.jsxs("div",{className:"flex items-center gap-3 rounded-full border border-emerald-500/20 bg-card/95 px-6 py-2.5 text-sm font-medium text-emerald-600 shadow-2xl dark:bg-zinc-900/85",children:[e.jsx(k,{size:18}),P??r("commonToast.settingsSaved")]})})}),e.jsx(le,{className:"flex-1",children:e.jsxs("div",{className:"mx-auto max-w-[1240px] space-y-12 p-8 py-16",children:[e.jsxs(g.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"flex flex-wrap items-end justify-between gap-6",children:[e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-2xl bg-primary/10 text-primary",children:e.jsx(ge,{size:28})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:r("settingsPage.browserSection.title")}),e.jsx("p",{className:"mt-1 text-muted-foreground",children:r("settingsPage.browserSection.description")})]})]})}),e.jsxs(h,{variant:"outline",className:"rounded-full border-border/70 bg-background/85 shadow-sm transition-all hover:bg-muted/50 active:scale-95 dark:border-white/[0.08] dark:bg-zinc-900/70 dark:hover:bg-zinc-900",onClick:I,disabled:l||c,children:[e.jsx(N,{className:w("mr-2 h-4 w-4",d&&"animate-spin")}),r("settings.refresh")]})]}),e.jsx(g.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},children:e.jsxs(O,{className:"items-center rounded-3xl border-primary/10 bg-primary/[0.04] p-6 py-4 dark:border-primary/15 dark:bg-primary/[0.05]",children:[e.jsx(be,{className:"h-5 w-5 text-primary"}),e.jsxs(R,{className:"ml-2 text-sm",children:[e.jsx("span",{className:"font-semibold text-primary/80",children:r("settingsPage.browserSection.primaryTitle")})," ",r("settingsPage.browserSection.primaryDescription")]})]})}),e.jsx(g.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},children:e.jsx(J,{title:r("settingsPage.browserSection.claude.title"),description:r("settingsPage.browserSection.claude.description"),action:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-border/60 bg-muted/30 px-4 py-2 dark:border-white/[0.06] dark:bg-zinc-900/45",children:[e.jsx(f,{htmlFor:"browser-claude-enabled",className:"cursor-pointer text-xs font-semibold leading-none",children:t.claude.enabled?"ENABLED":"DISABLED"}),e.jsx(G,{id:"browser-claude-enabled",checked:t.claude.enabled,onCheckedChange:n=>m(u=>A(u??t,{enabled:n}))})]}),e.jsxs(h,{onClick:ae,disabled:l||z||!_,className:"rounded-full px-6 shadow-md transition-transform active:scale-95",children:[l?e.jsx(N,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(k,{size:16,className:"mr-2"}),r("settingsPage.browserSection.actions.saveClaude")]}),e.jsxs(h,{variant:"outline",className:"rounded-full border-border/70 bg-background/85 shadow-sm transition-all hover:bg-muted/50 active:scale-95 dark:border-white/[0.08] dark:bg-zinc-900/70 dark:hover:bg-zinc-900",onClick:se,disabled:l||d||_||z,children:[e.jsx(he,{size:16,className:"mr-2"}),r("settingsPage.browserSection.actions.testConnection")]})]}),children:e.jsxs("div",{className:"grid gap-12",children:[e.jsx(K,{state:a.claude.state,title:a.claude.title,detail:a.claude.detail,nextStep:a.claude.nextStep}),e.jsxs("div",{className:"grid gap-8 lg:grid-cols-2",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(f,{htmlFor:"browser-claude-user-data-dir",className:"text-sm font-semibold tracking-wide text-muted-foreground/80",children:r("settingsPage.browserSection.claude.userDataDir")}),e.jsx(T,{id:"browser-claude-user-data-dir",value:t.claude.userDataDir,onChange:n=>m(u=>A(u??t,{userDataDir:n.target.value})),className:"rounded-xl border-border/70 bg-background/85 dark:border-white/[0.08] dark:bg-zinc-900/70",placeholder:a.claude.recommendedUserDataDir}),e.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground/70",children:r("settingsPage.browserSection.claude.userDataDirHint")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(f,{htmlFor:"browser-claude-devtools-port",className:"text-sm font-semibold tracking-wide text-muted-foreground/80",children:r("settingsPage.browserSection.claude.devtoolsPort")}),e.jsx(T,{id:"browser-claude-devtools-port",value:M,onChange:n=>C(n.target.value),inputMode:"numeric",className:"max-w-[120px] rounded-xl border-border/70 bg-background/85 dark:border-white/[0.08] dark:bg-zinc-900/70"}),e.jsx("p",{className:w("text-[11px] leading-relaxed text-muted-foreground/70",z&&"text-rose-500"),children:r(z?"settingsPage.browserSection.claude.devtoolsPortInvalid":"settingsPage.browserSection.claude.devtoolsPortHint")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(f,{className:"text-sm font-semibold tracking-wide text-muted-foreground/80",children:r("settingsPage.browserSection.evalMode.label")}),e.jsxs($,{value:t.claude.evalMode,onValueChange:n=>m(u=>A(u??t,{evalMode:n})),children:[e.jsx(H,{className:"rounded-xl border-border/70 bg-background/85 dark:border-white/[0.08] dark:bg-zinc-900/70",children:e.jsx(F,{})}),e.jsx(U,{children:q.map(n=>e.jsx(V,{value:n,children:D(r,n)},n))})]}),e.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground/70",children:r("settingsPage.browserSection.claude.evalModeHint")})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"group/launch relative overflow-hidden rounded-2xl border border-border/60 bg-muted/20 p-5 transition-all hover:bg-muted/35 dark:border-white/[0.06] dark:bg-zinc-900/35 dark:hover:bg-zinc-900/50",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[11px] font-bold uppercase tracking-[0.15em] text-primary/70",children:r("settingsPage.browserSection.claude.launchGuidance")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:r("settingsPage.browserSection.claude.launchGuidanceHint")})]}),e.jsx(h,{variant:"ghost",size:"sm",className:"h-8 w-8 rounded-full p-0 transition-transform active:scale-90",onClick:de,disabled:!j,children:e.jsx(pe,{size:18})})]}),e.jsx("code",{className:"mt-4 block break-all rounded-lg border border-border/50 bg-background/80 p-3 font-mono text-[10px] leading-relaxed dark:border-white/[0.05] dark:bg-zinc-900/60",children:j})]}),a.claude.overrideActive&&e.jsxs("div",{className:"flex items-center gap-3 rounded-2xl border border-amber-500/10 bg-amber-500/[0.05] p-4 text-xs font-medium text-amber-700 dark:text-amber-300",children:[e.jsx(Q,{size:18}),r("settingsPage.browserSection.claude.overrideMessage",{source:a.claude.source})]})]})]}),e.jsx(W,{title:r("settingsPage.browserSection.technicalDetails"),defaultOpen:a.claude.state!=="ready",children:e.jsxs("div",{className:"grid gap-6 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground/50",children:r("settingsPage.browserSection.claude.effectivePath")}),e.jsx("div",{className:"rounded-lg border border-border/50 bg-muted/25 p-3 dark:border-white/[0.05] dark:bg-zinc-900/45",children:e.jsx("p",{className:"break-all font-mono text-[11px] leading-relaxed",children:a.claude.effectiveUserDataDir})}),e.jsxs("p",{className:"text-[10px] font-medium text-muted-foreground/60",children:[e.jsxs("span",{className:"font-bold",children:[r("settingsPage.browserSection.claude.recommendedPath"),":"]})," ",a.claude.recommendedUserDataDir]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground/50",children:r("settingsPage.browserSection.claude.managedRuntime")}),e.jsxs("div",{className:"rounded-lg border border-border/50 bg-muted/25 p-3 dark:border-white/[0.05] dark:bg-zinc-900/45",children:[e.jsx("p",{className:"font-semibold text-primary/80",children:a.claude.managedMcpServerName}),e.jsx("p",{className:"mt-1 break-all font-mono text-[11px] leading-relaxed text-muted-foreground/80",children:a.claude.managedMcpServerPath})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground/50",children:r("settingsPage.browserSection.evalMode.label")}),e.jsx("div",{className:"rounded-lg border border-border/50 bg-muted/25 p-3 dark:border-white/[0.05] dark:bg-zinc-900/45",children:e.jsx("p",{className:"font-mono text-[11px] font-semibold",children:D(r,a.claude.evalMode)})})]})]})})]})})}),e.jsx(g.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.3},children:e.jsx(J,{title:r("settingsPage.browserSection.codex.title"),description:r("settingsPage.browserSection.codex.description"),action:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-border/60 bg-muted/30 px-4 py-2 dark:border-white/[0.06] dark:bg-zinc-900/45",children:[e.jsx(f,{htmlFor:"browser-codex-enabled",className:"cursor-pointer text-xs font-semibold leading-none",children:t.codex.enabled?"ENABLED":"DISABLED"}),e.jsx(G,{id:"browser-codex-enabled",checked:t.codex.enabled,onCheckedChange:n=>m(u=>X(u??t,{enabled:n}))})]}),e.jsxs(h,{onClick:te,disabled:l||!re,className:"rounded-full px-6 shadow-md transition-transform active:scale-95",children:[l?e.jsx(N,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(k,{size:16,className:"mr-2"}),r("settingsPage.browserSection.actions.saveCodex")]})]}),children:e.jsxs("div",{className:"grid gap-12",children:[e.jsx(K,{state:a.codex.state,title:a.codex.title,detail:a.codex.detail,nextStep:a.codex.nextStep}),e.jsxs("div",{className:"max-w-md space-y-3",children:[e.jsx(f,{className:"text-sm font-semibold tracking-wide text-muted-foreground/80",children:r("settingsPage.browserSection.evalMode.label")}),e.jsxs($,{value:t.codex.evalMode,onValueChange:n=>m(u=>X(u??t,{evalMode:n})),children:[e.jsx(H,{className:"rounded-xl border-border/70 bg-background/85 dark:border-white/[0.08] dark:bg-zinc-900/70",children:e.jsx(F,{})}),e.jsx(U,{children:q.map(n=>e.jsx(V,{value:n,children:D(r,n)},n))})]}),e.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground/70",children:r("settingsPage.browserSection.codex.evalModeHint")})]}),e.jsx(W,{title:r("settingsPage.browserSection.technicalDetails"),defaultOpen:a.codex.state==="unsupported_build",children:e.jsxs("div",{className:"grid gap-6 sm:grid-cols-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground/50",children:r("settingsPage.browserSection.codex.serverName")}),e.jsx("div",{className:"rounded-lg border border-border/50 bg-muted/25 p-3 dark:border-white/[0.05] dark:bg-zinc-900/45",children:e.jsx("p",{className:"font-mono text-[11px] font-semibold",children:a.codex.serverName})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground/50",children:r("settingsPage.browserSection.codex.overrideSupport")}),e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border/50 bg-muted/25 p-3 font-medium text-xs dark:border-white/[0.05] dark:bg-zinc-900/45",children:[a.codex.supportsConfigOverrides?e.jsx(k,{className:"text-emerald-500",size:16}):e.jsx(B,{className:"text-rose-500",size:16}),a.codex.supportsConfigOverrides?r("settingsPage.browserSection.codex.overrideSupported"):r("settingsPage.browserSection.codex.overrideUnsupported")]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground/50",children:r("settingsPage.browserSection.codex.binary")}),e.jsxs("div",{className:"rounded-lg border border-border/50 bg-muted/25 p-3 dark:border-white/[0.05] dark:bg-zinc-900/45",children:[e.jsx("p",{className:"break-all font-mono text-[11px] leading-relaxed",children:a.codex.binaryPath??r("settingsPage.browserSection.codex.notDetected")}),a.codex.version&&e.jsx("div",{className:"mt-2 inline-flex rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-bold text-primary",children:a.codex.version})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-muted-foreground/50",children:r("settingsPage.browserSection.evalMode.label")}),e.jsx("div",{className:"rounded-lg border border-border/50 bg-muted/25 p-3 dark:border-white/[0.05] dark:bg-zinc-900/45",children:e.jsx("p",{className:"font-mono text-[11px] font-semibold",children:D(r,a.codex.evalMode)})})]})]})})]})})})]})})]})}function A(r,s){return{...r,claude:{...r.claude,...s}}}function X(r,s){return{...r,codex:{...r.codex,...s}}}export{Oe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-nu4wz29m.js";import{r as o}from"./react-vendor-Bjx91N7w.js";import{a as q,bi as J,bk as X,d as I,n as Y,L as A,r as R,s as M,t as K,v as B,w as E,I as F,aI as Q}from"./index-C6j8gpEb.js";import{R as $,w as Z,x as ee,ad as se,_ as te,s as re}from"./icons-DzKUh8vG.js";import"./tanstack-bhJxV1h8.js";import"./notifications-B4_o8bcr.js";import"./utils-CzKF5WmX.js";import"./form-utils-CuHzLhJZ.js";import"./charts-eIPy2oG6.js";const z={mode:"auto",tier_defaults:{opus:"high",sonnet:"medium",haiku:"low"},show_warnings:!0},U=1e4;function ie(){const[t,i]=o.useState(null),[b,d]=o.useState(!0),[_,N]=o.useState(!1),[p,g]=o.useState(null),[P,y]=o.useState(!1),f=o.useRef(void 0),w=o.useRef(!1),k=o.useCallback(async()=>{const r=new AbortController,c=setTimeout(()=>r.abort(),U);try{d(!0),g(null);const n=await fetch("/api/thinking",{signal:r.signal});if(clearTimeout(c),!n.ok)throw n.headers.get("content-type")?.includes("text/html")?new Error(`Server error (${n.status})`):new Error("Failed to load Thinking config");const m=await n.json();i(m.config||z),f.current=m.lastModified,w.current=!0}catch(n){clearTimeout(c),n.name==="AbortError"?g("Request timeout - please try again"):g(n.message)}finally{d(!1)}return()=>r.abort()},[]),l=o.useCallback(async r=>{if(!w.current||t===null){g("Cannot save settings before they load. Click Refresh and try again.");return}const c=t,n={...c,...r.mode!==void 0?{mode:r.mode}:{},...r.tier_defaults!==void 0?{tier_defaults:r.tier_defaults}:{},...r.show_warnings!==void 0?{show_warnings:r.show_warnings}:{}};r.clear_override||r.override===null?delete n.override:r.override!==void 0&&(n.override=r.override),r.clear_provider_overrides||r.provider_overrides===null?delete n.provider_overrides:r.provider_overrides!==void 0&&(n.provider_overrides=r.provider_overrides),i(n);const m=new AbortController,h=setTimeout(()=>m.abort(),U);try{N(!0),g(null);const x={...n,lastModified:f.current},u=await fetch("/api/thinking",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(x),signal:m.signal});if(clearTimeout(h),!u.ok){if(u.headers.get("content-type")?.includes("text/html"))throw new Error(`Server error (${u.status})`);const s=await u.json();throw u.status===409?new Error("Config changed by another session. Refreshing..."):new Error(s.error||"Failed to save")}const v=await u.json();i(v.config),f.current=v.lastModified,y(!0),setTimeout(()=>y(!1),1500)}catch(x){clearTimeout(h),i(c),x.name==="AbortError"?g("Request timeout - please try again"):(g(x.message),x.message.includes("another session")&&setTimeout(()=>k(),1e3))}finally{N(!1)}},[t,k]),T=o.useCallback(r=>{l({mode:r})},[l]),C=o.useCallback((r,c)=>{const n=t?.tier_defaults||z.tier_defaults;l({tier_defaults:{...n,[r]:c}})},[t,l]),O=o.useCallback(r=>{l({show_warnings:r})},[l]),D=o.useCallback(r=>{if(r===void 0){l({override:null,clear_override:!0});return}l({override:r,clear_override:!1})},[l]),L=o.useCallback((r,c,n)=>{const m=t?.provider_overrides||{},h=m[r]||{};if(n===void 0){const{[c]:x,...u}=h,v=Object.keys(u).length>0?u:void 0,{[r]:S,...s}=m,a=v?{...s,[r]:v}:s;l({provider_overrides:Object.keys(a).length>0?a:null,clear_provider_overrides:Object.keys(a).length===0})}else l({provider_overrides:{...m,[r]:{...h,[c]:n}},clear_provider_overrides:!1})},[t,l]);return{config:t||z,loading:b,saving:_,error:p,success:P,fetchConfig:k,saveConfig:l,setMode:T,setTierDefault:C,setShowWarnings:O,setOverride:D,setProviderOverride:L}}const H=[{value:"minimal",label:"Minimal (512 tokens)"},{value:"low",label:"Low (1K tokens)"},{value:"medium",label:"Medium (8K tokens)"},{value:"high",label:"High (24K tokens)"},{value:"xhigh",label:"Extra High (32K tokens)"},{value:"max",label:"Max (adaptive ceiling)"},{value:"auto",label:"Auto (dynamic)"}],ne=[{value:"__none__",label:"None (use CLI flags only)"},...H,{value:"__custom__",label:"Custom budget (number)"},{value:"off",label:"Off (disable thinking)"}],ae=["agy","gemini","codex"],G=0,V=1e5;function fe(){const{t}=q(),{config:i,loading:b,saving:d,error:_,success:N,fetchConfig:p,setMode:g,setTierDefault:P,setShowWarnings:y,setOverride:f,setProviderOverride:w}=ie(),[k,l]=o.useState(null),[T,C]=o.useState(""),[O,D]=o.useState([]),[L,r]=o.useState(null),c=o.useMemo(()=>Array.from(new Set([...ae,...Object.keys(i.provider_overrides??{}),...O])),[O,i.provider_overrides]),n=i.override===void 0?"__none__":typeof i.override=="number"||/^\d+$/.test(String(i.override))?"__custom__":String(i.override),m=typeof i.override=="number"||/^\d+$/.test(String(i.override??""))?String(i.override):"",h=L??m,x=Object.keys(i.provider_overrides??{}).length>0,u=k??x;o.useEffect(()=>{p()},[p]);const v=()=>{const s=T.trim().toLowerCase();s&&(c.includes(s)||D(a=>[...a,s]),C(""),l(!0))},S=()=>{const s=h.trim();if(!s){f(void 0);return}const a=Number.parseInt(s,10);Number.isNaN(a)||a<G||a>V||!/^\d+$/.test(s)||f(a)};return b?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($,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:t("settings.loading")})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`absolute left-5 right-5 top-20 z-10 transition-all duration-200 ease-out ${_||N?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[_&&e.jsx(J,{variant:"destructive",className:"py-2 shadow-lg",children:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Z,{className:"h-4 w-4"}),e.jsx(X,{children:_})]}),e.jsxs(I,{variant:"outline",size:"sm",onClick:p,className:"h-7 px-2 text-xs border-destructive/50 hover:bg-destructive/10",children:[e.jsx($,{className:"w-3 h-3 mr-1"}),t("sharedPage.retry")]})]})}),N&&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:t("settings.saved")})]})]}),e.jsx(Y,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(se,{className:"w-5 h-5 text-primary"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("settingsThinking.description")})]}),e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800",children:[e.jsx(te,{className:"w-4 h-4 text-blue-600 dark:text-blue-400 shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-blue-700 dark:text-blue-300",children:[e.jsx("p",{className:"font-medium",children:t("settingsThinking.supportedProviders")}),e.jsxs("ul",{className:"mt-1 space-y-0.5 text-blue-600 dark:text-blue-400",children:[e.jsxs("li",{children:[t("settingsThinking.supportLine1Prefix")," ",e.jsx("strong",{children:"agy"}),","," ",e.jsx("strong",{children:"gemini"})," ",t("settingsThinking.supportLine1Suffix")]}),e.jsxs("li",{children:[t("settingsThinking.supportLine2Prefix")," ",e.jsx("strong",{children:"codex"})," ",t("settingsThinking.supportLine2SuffixPrefix"),e.jsx("code",{children:"--effort"}),t("settingsThinking.supportLine2SuffixPostfix")]}),e.jsxs("li",{children:[t("settingsThinking.supportLine3Prefix")," ",e.jsx("code",{children:"-high"}),t("settingsThinking.supportLine3Suffix")]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:t("settingsThinking.modeTitle")}),e.jsx("div",{className:"space-y-2",children:["auto","off","manual"].map(s=>e.jsxs("div",{className:`flex items-center justify-between p-4 rounded-lg cursor-pointer transition-colors ${i.mode===s?"bg-primary/10 border border-primary/30":"bg-muted/50 hover:bg-muted/80"} ${d?"opacity-70 pointer-events-none":""}`,onClick:()=>{d||g(s)},children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium capitalize",children:s}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[s==="auto"&&t("settingsThinking.modeAutoDesc"),s==="off"&&t("settingsThinking.modeOffDesc"),s==="manual"&&t("settingsThinking.modeManualDesc")]})]}),e.jsx("div",{className:`w-4 h-4 rounded-full border-2 ${i.mode===s?"bg-primary border-primary":"border-muted-foreground/50"}`})]},s))})]}),i.mode==="auto"&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:t("settingsThinking.tierDefaults")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("settingsThinking.tierDefaultsDesc")}),e.jsx("div",{className:"space-y-3",children:["opus","sonnet","haiku"].map(s=>e.jsxs("div",{className:"flex items-center gap-4 p-3 rounded-lg bg-muted/30",children:[e.jsx(A,{className:"w-20 capitalize font-medium",children:s}),e.jsxs(R,{value:i.tier_defaults[s],onValueChange:a=>P(s,a),disabled:d,children:[e.jsx(M,{className:"flex-1",children:e.jsx(K,{})}),e.jsx(B,{children:H.map(a=>e.jsx(E,{value:a.value,children:a.label},a.value))})]})]},s))})]}),i.mode==="manual"&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:t("settingsThinking.persistentOverride")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("settingsThinking.persistentOverrideDesc")}),e.jsxs(R,{value:n,onValueChange:s=>{if(s==="__none__"){f(void 0);return}if(s==="__custom__"){h||r("8192");return}r(null),f(s)},disabled:d,children:[e.jsx(M,{children:e.jsx(K,{})}),e.jsx(B,{children:ne.map(s=>e.jsx(E,{value:s.value,children:s.label},s.value))})]}),n==="__custom__"&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{type:"number",min:G,max:V,value:h,onChange:s=>r(s.target.value),onBlur:S,disabled:d,placeholder:t("settingsThinking.enterCustomBudget")}),e.jsx(I,{type:"button",size:"sm",variant:"outline",onClick:S,disabled:d,children:t("settingsThinking.apply")})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Range: ",G," to ",V]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("button",{type:"button",className:"flex items-center gap-2 text-base font-medium w-full text-left",onClick:()=>l(s=>!(s??x)),disabled:d,children:[e.jsx(re,{className:`w-4 h-4 transition-transform ${u?"rotate-0":"-rotate-90"}`}),t("settingsThinking.providerOverrides",{count:Object.keys(i.provider_overrides??{}).length})]}),u&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:t("settingsThinking.providerOverridesDesc")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{value:T,onChange:s=>C(s.target.value),disabled:d,placeholder:t("settingsThinking.addProviderPlaceholder")}),e.jsx(I,{type:"button",size:"sm",variant:"outline",onClick:v,disabled:d,children:t("settingsGlobalEnv.add")})]}),c.map(s=>e.jsxs("div",{className:"space-y-2 p-3 rounded-lg bg-muted/30",children:[e.jsx(A,{className:"capitalize font-medium text-sm",children:s}),e.jsx("div",{className:"grid grid-cols-3 gap-2",children:["opus","sonnet","haiku"].map(a=>{const W=i.provider_overrides?.[s]?.[a]||"__default__";return e.jsxs("div",{className:"space-y-1",children:[e.jsx(A,{className:"text-xs text-muted-foreground capitalize",children:a}),e.jsxs(R,{value:W,onValueChange:j=>w(s,a,j==="__default__"?void 0:j),disabled:d,children:[e.jsx(M,{className:"h-8 text-xs",children:e.jsx(K,{})}),e.jsxs(B,{children:[e.jsx(E,{value:"__default__",children:t("cursorPage.default")}),H.map(j=>e.jsx(E,{value:j.value,children:j.label},j.value))]})]})]},a)})})]},s))]})]}),e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:t("settingsThinking.showWarnings")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("settingsThinking.showWarningsDesc")})]}),e.jsx(Q,{checked:i.show_warnings??!0,onCheckedChange:y,disabled:d})]}),e.jsxs("div",{className:"p-4 rounded-lg border bg-muted/30",children:[e.jsx("h4",{className:"text-sm font-medium mb-2",children:t("settingsThinking.cliEnvOverride")}),e.jsxs("p",{className:"text-sm text-muted-foreground mb-2",children:["Override per session with flags or"," ",e.jsx("code",{className:"px-1.5 py-0.5 rounded bg-muted",children:"CCS_THINKING"})," env var. Priority: flag > env > config."]}),e.jsxs("div",{className:"space-y-1 text-sm font-mono text-muted-foreground",children:[e.jsx("p",{children:"ccs gemini --thinking high"}),e.jsx("p",{children:"ccs codex --effort xhigh"}),e.jsx("p",{children:'CCS_THINKING=high ccs codex "debug this"'}),e.jsx("p",{children:"ccs config thinking --mode auto"})]})]})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(I,{variant:"outline",size:"sm",onClick:p,disabled:b||d,className:"w-full",children:[e.jsx($,{className:`w-4 h-4 mr-2 ${b?"animate-spin":""}`}),t("settings.refresh")]})})]})}export{fe as default};
|
|
1
|
+
import{j as e}from"./radix-ui-nu4wz29m.js";import{r as o}from"./react-vendor-Bjx91N7w.js";import{a as q,bi as J,bk as X,d as I,n as Y,L as A,r as R,s as M,t as K,v as B,w as E,I as F,aI as Q}from"./index-CSlgRg0s.js";import{R as $,w as Z,x as ee,ad as se,_ as te,s as re}from"./icons-DzKUh8vG.js";import"./tanstack-bhJxV1h8.js";import"./notifications-B4_o8bcr.js";import"./utils-CzKF5WmX.js";import"./form-utils-CuHzLhJZ.js";import"./charts-eIPy2oG6.js";const z={mode:"auto",tier_defaults:{opus:"high",sonnet:"medium",haiku:"low"},show_warnings:!0},U=1e4;function ie(){const[t,i]=o.useState(null),[b,d]=o.useState(!0),[_,N]=o.useState(!1),[p,g]=o.useState(null),[P,y]=o.useState(!1),f=o.useRef(void 0),w=o.useRef(!1),k=o.useCallback(async()=>{const r=new AbortController,c=setTimeout(()=>r.abort(),U);try{d(!0),g(null);const n=await fetch("/api/thinking",{signal:r.signal});if(clearTimeout(c),!n.ok)throw n.headers.get("content-type")?.includes("text/html")?new Error(`Server error (${n.status})`):new Error("Failed to load Thinking config");const m=await n.json();i(m.config||z),f.current=m.lastModified,w.current=!0}catch(n){clearTimeout(c),n.name==="AbortError"?g("Request timeout - please try again"):g(n.message)}finally{d(!1)}return()=>r.abort()},[]),l=o.useCallback(async r=>{if(!w.current||t===null){g("Cannot save settings before they load. Click Refresh and try again.");return}const c=t,n={...c,...r.mode!==void 0?{mode:r.mode}:{},...r.tier_defaults!==void 0?{tier_defaults:r.tier_defaults}:{},...r.show_warnings!==void 0?{show_warnings:r.show_warnings}:{}};r.clear_override||r.override===null?delete n.override:r.override!==void 0&&(n.override=r.override),r.clear_provider_overrides||r.provider_overrides===null?delete n.provider_overrides:r.provider_overrides!==void 0&&(n.provider_overrides=r.provider_overrides),i(n);const m=new AbortController,h=setTimeout(()=>m.abort(),U);try{N(!0),g(null);const x={...n,lastModified:f.current},u=await fetch("/api/thinking",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(x),signal:m.signal});if(clearTimeout(h),!u.ok){if(u.headers.get("content-type")?.includes("text/html"))throw new Error(`Server error (${u.status})`);const s=await u.json();throw u.status===409?new Error("Config changed by another session. Refreshing..."):new Error(s.error||"Failed to save")}const v=await u.json();i(v.config),f.current=v.lastModified,y(!0),setTimeout(()=>y(!1),1500)}catch(x){clearTimeout(h),i(c),x.name==="AbortError"?g("Request timeout - please try again"):(g(x.message),x.message.includes("another session")&&setTimeout(()=>k(),1e3))}finally{N(!1)}},[t,k]),T=o.useCallback(r=>{l({mode:r})},[l]),C=o.useCallback((r,c)=>{const n=t?.tier_defaults||z.tier_defaults;l({tier_defaults:{...n,[r]:c}})},[t,l]),O=o.useCallback(r=>{l({show_warnings:r})},[l]),D=o.useCallback(r=>{if(r===void 0){l({override:null,clear_override:!0});return}l({override:r,clear_override:!1})},[l]),L=o.useCallback((r,c,n)=>{const m=t?.provider_overrides||{},h=m[r]||{};if(n===void 0){const{[c]:x,...u}=h,v=Object.keys(u).length>0?u:void 0,{[r]:S,...s}=m,a=v?{...s,[r]:v}:s;l({provider_overrides:Object.keys(a).length>0?a:null,clear_provider_overrides:Object.keys(a).length===0})}else l({provider_overrides:{...m,[r]:{...h,[c]:n}},clear_provider_overrides:!1})},[t,l]);return{config:t||z,loading:b,saving:_,error:p,success:P,fetchConfig:k,saveConfig:l,setMode:T,setTierDefault:C,setShowWarnings:O,setOverride:D,setProviderOverride:L}}const H=[{value:"minimal",label:"Minimal (512 tokens)"},{value:"low",label:"Low (1K tokens)"},{value:"medium",label:"Medium (8K tokens)"},{value:"high",label:"High (24K tokens)"},{value:"xhigh",label:"Extra High (32K tokens)"},{value:"max",label:"Max (adaptive ceiling)"},{value:"auto",label:"Auto (dynamic)"}],ne=[{value:"__none__",label:"None (use CLI flags only)"},...H,{value:"__custom__",label:"Custom budget (number)"},{value:"off",label:"Off (disable thinking)"}],ae=["agy","gemini","codex"],G=0,V=1e5;function fe(){const{t}=q(),{config:i,loading:b,saving:d,error:_,success:N,fetchConfig:p,setMode:g,setTierDefault:P,setShowWarnings:y,setOverride:f,setProviderOverride:w}=ie(),[k,l]=o.useState(null),[T,C]=o.useState(""),[O,D]=o.useState([]),[L,r]=o.useState(null),c=o.useMemo(()=>Array.from(new Set([...ae,...Object.keys(i.provider_overrides??{}),...O])),[O,i.provider_overrides]),n=i.override===void 0?"__none__":typeof i.override=="number"||/^\d+$/.test(String(i.override))?"__custom__":String(i.override),m=typeof i.override=="number"||/^\d+$/.test(String(i.override??""))?String(i.override):"",h=L??m,x=Object.keys(i.provider_overrides??{}).length>0,u=k??x;o.useEffect(()=>{p()},[p]);const v=()=>{const s=T.trim().toLowerCase();s&&(c.includes(s)||D(a=>[...a,s]),C(""),l(!0))},S=()=>{const s=h.trim();if(!s){f(void 0);return}const a=Number.parseInt(s,10);Number.isNaN(a)||a<G||a>V||!/^\d+$/.test(s)||f(a)};return b?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($,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{children:t("settings.loading")})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`absolute left-5 right-5 top-20 z-10 transition-all duration-200 ease-out ${_||N?"opacity-100 translate-y-0":"opacity-0 -translate-y-2 pointer-events-none"}`,children:[_&&e.jsx(J,{variant:"destructive",className:"py-2 shadow-lg",children:e.jsxs("div",{className:"flex items-center justify-between w-full",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Z,{className:"h-4 w-4"}),e.jsx(X,{children:_})]}),e.jsxs(I,{variant:"outline",size:"sm",onClick:p,className:"h-7 px-2 text-xs border-destructive/50 hover:bg-destructive/10",children:[e.jsx($,{className:"w-3 h-3 mr-1"}),t("sharedPage.retry")]})]})}),N&&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:t("settings.saved")})]})]}),e.jsx(Y,{className:"flex-1",children:e.jsxs("div",{className:"p-5 space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(se,{className:"w-5 h-5 text-primary"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("settingsThinking.description")})]}),e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800",children:[e.jsx(te,{className:"w-4 h-4 text-blue-600 dark:text-blue-400 shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-blue-700 dark:text-blue-300",children:[e.jsx("p",{className:"font-medium",children:t("settingsThinking.supportedProviders")}),e.jsxs("ul",{className:"mt-1 space-y-0.5 text-blue-600 dark:text-blue-400",children:[e.jsxs("li",{children:[t("settingsThinking.supportLine1Prefix")," ",e.jsx("strong",{children:"agy"}),","," ",e.jsx("strong",{children:"gemini"})," ",t("settingsThinking.supportLine1Suffix")]}),e.jsxs("li",{children:[t("settingsThinking.supportLine2Prefix")," ",e.jsx("strong",{children:"codex"})," ",t("settingsThinking.supportLine2SuffixPrefix"),e.jsx("code",{children:"--effort"}),t("settingsThinking.supportLine2SuffixPostfix")]}),e.jsxs("li",{children:[t("settingsThinking.supportLine3Prefix")," ",e.jsx("code",{children:"-high"}),t("settingsThinking.supportLine3Suffix")]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:t("settingsThinking.modeTitle")}),e.jsx("div",{className:"space-y-2",children:["auto","off","manual"].map(s=>e.jsxs("div",{className:`flex items-center justify-between p-4 rounded-lg cursor-pointer transition-colors ${i.mode===s?"bg-primary/10 border border-primary/30":"bg-muted/50 hover:bg-muted/80"} ${d?"opacity-70 pointer-events-none":""}`,onClick:()=>{d||g(s)},children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium capitalize",children:s}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[s==="auto"&&t("settingsThinking.modeAutoDesc"),s==="off"&&t("settingsThinking.modeOffDesc"),s==="manual"&&t("settingsThinking.modeManualDesc")]})]}),e.jsx("div",{className:`w-4 h-4 rounded-full border-2 ${i.mode===s?"bg-primary border-primary":"border-muted-foreground/50"}`})]},s))})]}),i.mode==="auto"&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:t("settingsThinking.tierDefaults")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("settingsThinking.tierDefaultsDesc")}),e.jsx("div",{className:"space-y-3",children:["opus","sonnet","haiku"].map(s=>e.jsxs("div",{className:"flex items-center gap-4 p-3 rounded-lg bg-muted/30",children:[e.jsx(A,{className:"w-20 capitalize font-medium",children:s}),e.jsxs(R,{value:i.tier_defaults[s],onValueChange:a=>P(s,a),disabled:d,children:[e.jsx(M,{className:"flex-1",children:e.jsx(K,{})}),e.jsx(B,{children:H.map(a=>e.jsx(E,{value:a.value,children:a.label},a.value))})]})]},s))})]}),i.mode==="manual"&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-medium",children:t("settingsThinking.persistentOverride")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("settingsThinking.persistentOverrideDesc")}),e.jsxs(R,{value:n,onValueChange:s=>{if(s==="__none__"){f(void 0);return}if(s==="__custom__"){h||r("8192");return}r(null),f(s)},disabled:d,children:[e.jsx(M,{children:e.jsx(K,{})}),e.jsx(B,{children:ne.map(s=>e.jsx(E,{value:s.value,children:s.label},s.value))})]}),n==="__custom__"&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{type:"number",min:G,max:V,value:h,onChange:s=>r(s.target.value),onBlur:S,disabled:d,placeholder:t("settingsThinking.enterCustomBudget")}),e.jsx(I,{type:"button",size:"sm",variant:"outline",onClick:S,disabled:d,children:t("settingsThinking.apply")})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Range: ",G," to ",V]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("button",{type:"button",className:"flex items-center gap-2 text-base font-medium w-full text-left",onClick:()=>l(s=>!(s??x)),disabled:d,children:[e.jsx(re,{className:`w-4 h-4 transition-transform ${u?"rotate-0":"-rotate-90"}`}),t("settingsThinking.providerOverrides",{count:Object.keys(i.provider_overrides??{}).length})]}),u&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:t("settingsThinking.providerOverridesDesc")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{value:T,onChange:s=>C(s.target.value),disabled:d,placeholder:t("settingsThinking.addProviderPlaceholder")}),e.jsx(I,{type:"button",size:"sm",variant:"outline",onClick:v,disabled:d,children:t("settingsGlobalEnv.add")})]}),c.map(s=>e.jsxs("div",{className:"space-y-2 p-3 rounded-lg bg-muted/30",children:[e.jsx(A,{className:"capitalize font-medium text-sm",children:s}),e.jsx("div",{className:"grid grid-cols-3 gap-2",children:["opus","sonnet","haiku"].map(a=>{const W=i.provider_overrides?.[s]?.[a]||"__default__";return e.jsxs("div",{className:"space-y-1",children:[e.jsx(A,{className:"text-xs text-muted-foreground capitalize",children:a}),e.jsxs(R,{value:W,onValueChange:j=>w(s,a,j==="__default__"?void 0:j),disabled:d,children:[e.jsx(M,{className:"h-8 text-xs",children:e.jsx(K,{})}),e.jsxs(B,{children:[e.jsx(E,{value:"__default__",children:t("cursorPage.default")}),H.map(j=>e.jsx(E,{value:j.value,children:j.label},j.value))]})]})]},a)})})]},s))]})]}),e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:t("settingsThinking.showWarnings")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("settingsThinking.showWarningsDesc")})]}),e.jsx(Q,{checked:i.show_warnings??!0,onCheckedChange:y,disabled:d})]}),e.jsxs("div",{className:"p-4 rounded-lg border bg-muted/30",children:[e.jsx("h4",{className:"text-sm font-medium mb-2",children:t("settingsThinking.cliEnvOverride")}),e.jsxs("p",{className:"text-sm text-muted-foreground mb-2",children:["Override per session with flags or"," ",e.jsx("code",{className:"px-1.5 py-0.5 rounded bg-muted",children:"CCS_THINKING"})," env var. Priority: flag > env > config."]}),e.jsxs("div",{className:"space-y-1 text-sm font-mono text-muted-foreground",children:[e.jsx("p",{children:"ccs gemini --thinking high"}),e.jsx("p",{children:"ccs codex --effort xhigh"}),e.jsx("p",{children:'CCS_THINKING=high ccs codex "debug this"'}),e.jsx("p",{children:"ccs config thinking --mode auto"})]})]})]})}),e.jsx("div",{className:"p-4 border-t bg-background",children:e.jsxs(I,{variant:"outline",size:"sm",onClick:p,disabled:b||d,className:"w-full",children:[e.jsx($,{className:`w-4 h-4 mr-2 ${b?"animate-spin":""}`}),t("settings.refresh")]})})]})}export{fe as default};
|