@kaitranntt/ccs 7.71.0 → 7.72.1-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 +39 -2
- package/config/base-codebuddy.settings.json +10 -0
- package/config/base-codex.settings.json +4 -4
- package/config/base-cursor.settings.json +10 -0
- package/config/base-gitlab.settings.json +10 -0
- package/config/base-kilo.settings.json +10 -0
- package/dist/auth/profile-detector.d.ts +2 -3
- package/dist/auth/profile-detector.d.ts.map +1 -1
- package/dist/auth/profile-detector.js +19 -19
- package/dist/auth/profile-detector.js.map +1 -1
- package/dist/ccs.js +89 -27
- package/dist/ccs.js.map +1 -1
- package/dist/cliproxy/accounts/email-account-identity.d.ts.map +1 -1
- package/dist/cliproxy/accounts/email-account-identity.js +22 -2
- package/dist/cliproxy/accounts/email-account-identity.js.map +1 -1
- package/dist/cliproxy/auth/auth-types.d.ts +10 -0
- package/dist/cliproxy/auth/auth-types.d.ts.map +1 -1
- package/dist/cliproxy/auth/auth-types.js +32 -0
- package/dist/cliproxy/auth/auth-types.js.map +1 -1
- package/dist/cliproxy/auth/gitlab-pat-response.d.ts +9 -0
- package/dist/cliproxy/auth/gitlab-pat-response.d.ts.map +1 -0
- package/dist/cliproxy/auth/gitlab-pat-response.js +64 -0
- package/dist/cliproxy/auth/gitlab-pat-response.js.map +1 -0
- package/dist/cliproxy/auth/kiro-import.js +1 -1
- package/dist/cliproxy/auth/kiro-import.js.map +1 -1
- package/dist/cliproxy/auth/oauth-handler.d.ts +3 -0
- package/dist/cliproxy/auth/oauth-handler.d.ts.map +1 -1
- package/dist/cliproxy/auth/oauth-handler.js +120 -4
- package/dist/cliproxy/auth/oauth-handler.js.map +1 -1
- package/dist/cliproxy/auth/provider-refreshers/index.d.ts +1 -2
- package/dist/cliproxy/auth/provider-refreshers/index.d.ts.map +1 -1
- package/dist/cliproxy/auth/provider-refreshers/index.js +6 -25
- package/dist/cliproxy/auth/provider-refreshers/index.js.map +1 -1
- package/dist/cliproxy/auth/token-manager.d.ts +1 -1
- package/dist/cliproxy/auth/token-manager.d.ts.map +1 -1
- package/dist/cliproxy/auth/token-manager.js +9 -6
- package/dist/cliproxy/auth/token-manager.js.map +1 -1
- package/dist/cliproxy/binary/lifecycle.d.ts.map +1 -1
- package/dist/cliproxy/binary/lifecycle.js +12 -1
- package/dist/cliproxy/binary/lifecycle.js.map +1 -1
- package/dist/cliproxy/binary-manager.d.ts +5 -1
- package/dist/cliproxy/binary-manager.d.ts.map +1 -1
- package/dist/cliproxy/binary-manager.js +10 -2
- package/dist/cliproxy/binary-manager.js.map +1 -1
- package/dist/cliproxy/codex-plan-compatibility.d.ts.map +1 -1
- package/dist/cliproxy/codex-plan-compatibility.js +6 -6
- package/dist/cliproxy/codex-plan-compatibility.js.map +1 -1
- package/dist/cliproxy/config/env-builder.d.ts +5 -0
- package/dist/cliproxy/config/env-builder.d.ts.map +1 -1
- package/dist/cliproxy/config/env-builder.js +56 -4
- package/dist/cliproxy/config/env-builder.js.map +1 -1
- package/dist/cliproxy/config/generator.d.ts +6 -1
- package/dist/cliproxy/config/generator.d.ts.map +1 -1
- package/dist/cliproxy/config/generator.js +4 -3
- package/dist/cliproxy/config/generator.js.map +1 -1
- package/dist/cliproxy/config/path-resolver.d.ts +21 -0
- package/dist/cliproxy/config/path-resolver.d.ts.map +1 -1
- package/dist/cliproxy/config/path-resolver.js +42 -2
- package/dist/cliproxy/config/path-resolver.js.map +1 -1
- package/dist/cliproxy/executor/index.d.ts +1 -0
- package/dist/cliproxy/executor/index.d.ts.map +1 -1
- package/dist/cliproxy/executor/index.js +42 -12
- package/dist/cliproxy/executor/index.js.map +1 -1
- package/dist/cliproxy/model-catalog.d.ts.map +1 -1
- package/dist/cliproxy/model-catalog.js +14 -59
- package/dist/cliproxy/model-catalog.js.map +1 -1
- package/dist/cliproxy/model-config.js +4 -4
- package/dist/cliproxy/model-config.js.map +1 -1
- package/dist/cliproxy/model-id-normalizer.d.ts +2 -0
- package/dist/cliproxy/model-id-normalizer.d.ts.map +1 -1
- package/dist/cliproxy/model-id-normalizer.js +25 -1
- package/dist/cliproxy/model-id-normalizer.js.map +1 -1
- package/dist/cliproxy/provider-capabilities.d.ts.map +1 -1
- package/dist/cliproxy/provider-capabilities.js +49 -1
- package/dist/cliproxy/provider-capabilities.js.map +1 -1
- package/dist/cliproxy/quota-fetcher-claude-normalizer.d.ts +1 -5
- package/dist/cliproxy/quota-fetcher-claude-normalizer.d.ts.map +1 -1
- package/dist/cliproxy/quota-fetcher-claude-normalizer.js +33 -6
- package/dist/cliproxy/quota-fetcher-claude-normalizer.js.map +1 -1
- package/dist/cliproxy/quota-fetcher-claude.d.ts +2 -2
- package/dist/cliproxy/quota-fetcher-claude.d.ts.map +1 -1
- package/dist/cliproxy/quota-fetcher-claude.js +18 -32
- package/dist/cliproxy/quota-fetcher-claude.js.map +1 -1
- package/dist/cliproxy/quota-fetcher-codex.d.ts.map +1 -1
- package/dist/cliproxy/quota-fetcher-codex.js +2 -0
- package/dist/cliproxy/quota-fetcher-codex.js.map +1 -1
- package/dist/cliproxy/quota-fetcher-gemini-cli.d.ts.map +1 -1
- package/dist/cliproxy/quota-fetcher-gemini-cli.js +221 -99
- package/dist/cliproxy/quota-fetcher-gemini-cli.js.map +1 -1
- package/dist/cliproxy/quota-types.d.ts +2 -2
- package/dist/cliproxy/quota-types.d.ts.map +1 -1
- package/dist/cliproxy/routing-strategy.d.ts.map +1 -1
- package/dist/cliproxy/routing-strategy.js +4 -1
- package/dist/cliproxy/routing-strategy.js.map +1 -1
- package/dist/cliproxy/service-manager.d.ts.map +1 -1
- package/dist/cliproxy/service-manager.js +4 -1
- package/dist/cliproxy/service-manager.js.map +1 -1
- package/dist/cliproxy/types.d.ts +11 -3
- package/dist/cliproxy/types.d.ts.map +1 -1
- package/dist/cliproxy/types.js +8 -1
- package/dist/cliproxy/types.js.map +1 -1
- package/dist/commands/browser-command.d.ts +5 -0
- package/dist/commands/browser-command.d.ts.map +1 -0
- package/dist/commands/browser-command.js +118 -0
- package/dist/commands/browser-command.js.map +1 -0
- package/dist/commands/command-catalog.d.ts +3 -2
- package/dist/commands/command-catalog.d.ts.map +1 -1
- package/dist/commands/command-catalog.js +29 -4
- package/dist/commands/command-catalog.js.map +1 -1
- package/dist/commands/completion-backend.d.ts.map +1 -1
- package/dist/commands/completion-backend.js +4 -0
- package/dist/commands/completion-backend.js.map +1 -1
- package/dist/commands/cursor-command-display.d.ts.map +1 -1
- package/dist/commands/cursor-command-display.js +43 -30
- package/dist/commands/cursor-command-display.js.map +1 -1
- package/dist/commands/cursor-command.d.ts.map +1 -1
- package/dist/commands/cursor-command.js +30 -13
- package/dist/commands/cursor-command.js.map +1 -1
- package/dist/commands/help-command.d.ts +2 -0
- package/dist/commands/help-command.d.ts.map +1 -1
- package/dist/commands/help-command.js +62 -3
- package/dist/commands/help-command.js.map +1 -1
- package/dist/commands/index.d.ts +1 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +3 -1
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/proxy-command.d.ts +2 -0
- package/dist/commands/proxy-command.d.ts.map +1 -0
- package/dist/commands/proxy-command.js +156 -0
- package/dist/commands/proxy-command.js.map +1 -0
- package/dist/commands/root-command-router.d.ts.map +1 -1
- package/dist/commands/root-command-router.js +14 -0
- package/dist/commands/root-command-router.js.map +1 -1
- package/dist/config/reserved-names.d.ts +1 -1
- package/dist/config/reserved-names.d.ts.map +1 -1
- package/dist/config/reserved-names.js +10 -0
- package/dist/config/reserved-names.js.map +1 -1
- package/dist/config/unified-config-loader.d.ts +6 -1
- package/dist/config/unified-config-loader.d.ts.map +1 -1
- package/dist/config/unified-config-loader.js +67 -1
- package/dist/config/unified-config-loader.js.map +1 -1
- package/dist/config/unified-config-types.d.ts +37 -0
- package/dist/config/unified-config-types.d.ts.map +1 -1
- package/dist/config/unified-config-types.js +25 -1
- package/dist/config/unified-config-types.js.map +1 -1
- package/dist/cursor/constants.d.ts +3 -0
- package/dist/cursor/constants.d.ts.map +1 -1
- package/dist/cursor/constants.js +26 -1
- package/dist/cursor/constants.js.map +1 -1
- package/dist/cursor/cursor-anthropic-response.d.ts +1 -6
- package/dist/cursor/cursor-anthropic-response.d.ts.map +1 -1
- package/dist/cursor/cursor-anthropic-response.js +3 -186
- package/dist/cursor/cursor-anthropic-response.js.map +1 -1
- package/dist/cursor/cursor-daemon-entry.js +2 -2
- package/dist/cursor/cursor-daemon-entry.js.map +1 -1
- package/dist/cursor/cursor-profile-executor.js +4 -4
- package/dist/cursor/cursor-profile-executor.js.map +1 -1
- package/dist/cursor/cursor-runtime-probe.js +3 -3
- package/dist/cursor/cursor-runtime-probe.js.map +1 -1
- package/dist/glmt/sse-parser.d.ts.map +1 -1
- package/dist/glmt/sse-parser.js +46 -41
- package/dist/glmt/sse-parser.js.map +1 -1
- package/dist/management/shared-manager.d.ts +2 -0
- package/dist/management/shared-manager.d.ts.map +1 -1
- package/dist/management/shared-manager.js +25 -10
- package/dist/management/shared-manager.js.map +1 -1
- package/dist/proxy/index.d.ts +8 -0
- package/dist/proxy/index.d.ts.map +1 -0
- package/dist/proxy/index.js +24 -0
- package/dist/proxy/index.js.map +1 -0
- package/dist/proxy/profile-router.d.ts +28 -0
- package/dist/proxy/profile-router.d.ts.map +1 -0
- package/dist/proxy/profile-router.js +43 -0
- package/dist/proxy/profile-router.js.map +1 -0
- package/dist/proxy/proxy-daemon-entry.d.ts +2 -0
- package/dist/proxy/proxy-daemon-entry.d.ts.map +1 -0
- package/dist/proxy/proxy-daemon-entry.js +68 -0
- package/dist/proxy/proxy-daemon-entry.js.map +1 -0
- package/dist/proxy/proxy-daemon-paths.d.ts +6 -0
- package/dist/proxy/proxy-daemon-paths.d.ts.map +1 -0
- package/dist/proxy/proxy-daemon-paths.js +43 -0
- package/dist/proxy/proxy-daemon-paths.js.map +1 -0
- package/dist/proxy/proxy-daemon-state.d.ts +18 -0
- package/dist/proxy/proxy-daemon-state.d.ts.map +1 -0
- package/dist/proxy/proxy-daemon-state.js +92 -0
- package/dist/proxy/proxy-daemon-state.js.map +1 -0
- package/dist/proxy/proxy-daemon.d.ts +26 -0
- package/dist/proxy/proxy-daemon.d.ts.map +1 -0
- package/dist/proxy/proxy-daemon.js +350 -0
- package/dist/proxy/proxy-daemon.js.map +1 -0
- package/dist/proxy/proxy-env.d.ts +3 -0
- package/dist/proxy/proxy-env.d.ts.map +1 -0
- package/dist/proxy/proxy-env.js +26 -0
- package/dist/proxy/proxy-env.js.map +1 -0
- package/dist/proxy/request-router.d.ts +12 -0
- package/dist/proxy/request-router.d.ts.map +1 -0
- package/dist/proxy/request-router.js +163 -0
- package/dist/proxy/request-router.js.map +1 -0
- package/dist/proxy/routing-config.d.ts +10 -0
- package/dist/proxy/routing-config.d.ts.map +1 -0
- package/dist/proxy/routing-config.js +79 -0
- package/dist/proxy/routing-config.js.map +1 -0
- package/dist/proxy/server/http-helpers.d.ts +8 -0
- package/dist/proxy/server/http-helpers.d.ts.map +1 -0
- package/dist/proxy/server/http-helpers.js +73 -0
- package/dist/proxy/server/http-helpers.js.map +1 -0
- package/dist/proxy/server/messages-route.d.ts +12 -0
- package/dist/proxy/server/messages-route.d.ts.map +1 -0
- package/dist/proxy/server/messages-route.js +208 -0
- package/dist/proxy/server/messages-route.js.map +1 -0
- package/dist/proxy/server/proxy-server.d.ts +12 -0
- package/dist/proxy/server/proxy-server.d.ts.map +1 -0
- package/dist/proxy/server/proxy-server.js +110 -0
- package/dist/proxy/server/proxy-server.js.map +1 -0
- package/dist/proxy/transformers/request-transformer.d.ts +52 -0
- package/dist/proxy/transformers/request-transformer.d.ts.map +1 -0
- package/dist/proxy/transformers/request-transformer.js +254 -0
- package/dist/proxy/transformers/request-transformer.js.map +1 -0
- package/dist/proxy/transformers/sse-stream-transformer.d.ts +11 -0
- package/dist/proxy/transformers/sse-stream-transformer.d.ts.map +1 -0
- package/dist/proxy/transformers/sse-stream-transformer.js +199 -0
- package/dist/proxy/transformers/sse-stream-transformer.js.map +1 -0
- package/dist/proxy/upstream-url.d.ts +3 -0
- package/dist/proxy/upstream-url.d.ts.map +1 -0
- package/dist/proxy/upstream-url.js +35 -0
- package/dist/proxy/upstream-url.js.map +1 -0
- package/dist/shared/claude-extension-setup.js +1 -1
- package/dist/shared/claude-extension-setup.js.map +1 -1
- package/dist/targets/codex-detector.d.ts.map +1 -1
- package/dist/targets/codex-detector.js +20 -9
- package/dist/targets/codex-detector.js.map +1 -1
- package/dist/targets/droid-provider.d.ts.map +1 -1
- package/dist/targets/droid-provider.js +2 -0
- package/dist/targets/droid-provider.js.map +1 -1
- package/dist/types/config.d.ts +13 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/config.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/ui/assets/{accounts-B8EmUjf7.js → accounts-DfkqFx14.js} +1 -1
- package/dist/ui/assets/{alert-dialog-zvnFuSZG.js → alert-dialog-BJ9GwHLZ.js} +1 -1
- package/dist/ui/assets/{api-vTHvDFg5.js → api-BVo8Vm1B.js} +1 -1
- package/dist/ui/assets/{auth-section-Dg3AdWQR.js → auth-section-B-Ms1O_M.js} +1 -1
- package/dist/ui/assets/{backups-section-CuRlCk7U.js → backups-section-f8hvkPfH.js} +1 -1
- package/dist/ui/assets/{channels-ByIXpMal.js → channels-Bgvry5fT.js} +1 -1
- package/dist/ui/assets/{checkbox-DoV2JinM.js → checkbox-CbI3Vbww.js} +1 -1
- package/dist/ui/assets/{claude-extension-B-Ofp87Z.js → claude-extension-lDT7lp8C.js} +1 -1
- package/dist/ui/assets/cliproxy-D50Owb9u.js +3 -0
- package/dist/ui/assets/{cliproxy-ai-providers-BVOtMT7b.js → cliproxy-ai-providers-Cjrk90aJ.js} +8 -8
- package/dist/ui/assets/{cliproxy-control-panel-qL0R878z.js → cliproxy-control-panel-DL8JoyKU.js} +1 -1
- package/dist/ui/assets/codex-B3bW7lzx.js +27 -0
- package/dist/ui/assets/{confirm-dialog-BcfzKHj3.js → confirm-dialog-Bm2Y3ArL.js} +1 -1
- package/dist/ui/assets/{copilot-Dti40Uv-.js → copilot-CPLBRpFA.js} +1 -1
- package/dist/ui/assets/cursor-D1xhqEEF.js +1 -0
- package/dist/ui/assets/{droid-BmuIeDFh.js → droid-DiFtSJkl.js} +2 -2
- package/dist/ui/assets/{globalenv-section-CGbpkbpW.js → globalenv-section-BadlR8mm.js} +1 -1
- package/dist/ui/assets/{health-DryU1jzv.js → health-Bxol1p1X.js} +1 -1
- package/dist/ui/assets/{icons-KVCk4_U8.js → icons-Dmi9qMuE.js} +1 -1
- package/dist/ui/assets/{index-Dgu-LYP_.js → index-BPCsEKJ8.js} +1 -1
- package/dist/ui/assets/{index-B_vdNMI1.js → index-BZYBDV6A.js} +1 -1
- package/dist/ui/assets/index-C2-J9AKi.js +1 -0
- package/dist/ui/assets/{index-DUCkRc_D.js → index-CA4r5qY8.js} +1 -1
- package/dist/ui/assets/index-CXRoMyUA.js +9 -0
- package/dist/ui/assets/index-DM7Qb4kd.js +72 -0
- package/dist/ui/assets/index-DuTB1_9r.css +1 -0
- package/dist/ui/assets/{index-Cu--MLG0.js → index-x07V45Iw.js} +1 -1
- package/dist/ui/assets/{logs-CtIgaS7y.js → logs-kvpMF-pw.js} +1 -1
- package/dist/ui/assets/{masked-input-Dm8T-Vtr.js → masked-input-CFQ05toP.js} +1 -1
- package/dist/ui/assets/providers/codebuddy.png +0 -0
- package/dist/ui/assets/providers/cursor.svg +5 -0
- package/dist/ui/assets/providers/gitlab.svg +22 -0
- package/dist/ui/assets/providers/kilo.png +0 -0
- package/dist/ui/assets/{proxy-status-widget-BXghaDz7.js → proxy-status-widget-Df_-wCR0.js} +1 -1
- package/dist/ui/assets/{raw-json-settings-editor-panel-DhhcWn5Q.js → raw-json-settings-editor-panel-DeWgWDSP.js} +1 -1
- package/dist/ui/assets/{searchable-select-DiGUiefs.js → searchable-select-CPbVBSoE.js} +1 -1
- package/dist/ui/assets/{separator-DnQqlaL0.js → separator--T-CzItG.js} +1 -1
- package/dist/ui/assets/{shared-BPuiJsYO.js → shared-Dx_5pa5N.js} +1 -1
- package/dist/ui/assets/{table-BDsTJlxT.js → table-wE_LUUUQ.js} +1 -1
- package/dist/ui/assets/{updates-DQxYQBCf.js → updates-mWDqf-fm.js} +1 -1
- package/dist/ui/index.html +3 -3
- package/dist/utils/browser/browser-settings.d.ts +27 -0
- package/dist/utils/browser/browser-settings.d.ts.map +1 -0
- package/dist/utils/browser/browser-settings.js +127 -0
- package/dist/utils/browser/browser-settings.js.map +1 -0
- package/dist/utils/browser/browser-status.d.ts +39 -0
- package/dist/utils/browser/browser-status.d.ts.map +1 -0
- package/dist/utils/browser/browser-status.js +134 -0
- package/dist/utils/browser/browser-status.js.map +1 -0
- package/dist/utils/browser/chrome-reuse.d.ts +1 -0
- package/dist/utils/browser/chrome-reuse.d.ts.map +1 -1
- package/dist/utils/browser/chrome-reuse.js.map +1 -1
- package/dist/utils/browser/index.d.ts +4 -0
- package/dist/utils/browser/index.d.ts.map +1 -1
- package/dist/utils/browser/index.js +8 -1
- package/dist/utils/browser/index.js.map +1 -1
- package/dist/utils/browser/platform.d.ts +4 -0
- package/dist/utils/browser/platform.d.ts.map +1 -0
- package/dist/utils/browser/platform.js +12 -0
- package/dist/utils/browser/platform.js.map +1 -0
- package/dist/utils/hooks/image-analysis-backend-resolver.js +1 -1
- package/dist/utils/hooks/image-analysis-backend-resolver.js.map +1 -1
- package/dist/web-server/routes/browser-routes.d.ts +3 -0
- package/dist/web-server/routes/browser-routes.d.ts.map +1 -0
- package/dist/web-server/routes/browser-routes.js +116 -0
- package/dist/web-server/routes/browser-routes.js.map +1 -0
- package/dist/web-server/routes/cliproxy-auth-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cliproxy-auth-routes.js +124 -1
- package/dist/web-server/routes/cliproxy-auth-routes.js.map +1 -1
- package/dist/web-server/routes/config-routes.d.ts.map +1 -1
- package/dist/web-server/routes/config-routes.js +3 -0
- package/dist/web-server/routes/config-routes.js.map +1 -1
- package/dist/web-server/routes/index.d.ts.map +1 -1
- package/dist/web-server/routes/index.js +3 -0
- package/dist/web-server/routes/index.js.map +1 -1
- package/dist/web-server/routes/settings-routes.d.ts.map +1 -1
- package/dist/web-server/routes/settings-routes.js +8 -0
- package/dist/web-server/routes/settings-routes.js.map +1 -1
- package/dist/web-server/services/compatible-cli-docs-registry.d.ts.map +1 -1
- package/dist/web-server/services/compatible-cli-docs-registry.js +1 -0
- package/dist/web-server/services/compatible-cli-docs-registry.js.map +1 -1
- package/package.json +1 -1
- package/dist/cliproxy/auth/gemini-token-refresh.d.ts +0 -40
- package/dist/cliproxy/auth/gemini-token-refresh.d.ts.map +0 -1
- package/dist/cliproxy/auth/gemini-token-refresh.js +0 -371
- package/dist/cliproxy/auth/gemini-token-refresh.js.map +0 -1
- package/dist/ui/assets/cliproxy-Bhu0JvIb.js +0 -3
- package/dist/ui/assets/codex-BCHZ-0dx.js +0 -27
- package/dist/ui/assets/cursor-BG0Y8Z5F.js +0 -1
- package/dist/ui/assets/index-B1mN7ZR-.js +0 -72
- package/dist/ui/assets/index-BBVoDJnl.js +0 -1
- package/dist/ui/assets/index-BMC5Tudw.css +0 -1
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as u}from"./react-vendor-CNOkPC89.js";import{a as ut,u as qt,b as us}from"./tanstack-CrmUhA7Z.js";import{a8 as ms,a as B,d as K,C as Ht,b as zt,a9 as Gt,c as J,P as mt,B as G,aa as de,L as Z,I as me,r as Ze,s as et,t as tt,v as st,w as Pe,ab as Vt,ac as Bt,ad as ps,ae as xs,af as hs,u as $t,ag as pt,ah as xt,ai as ht,aj as gt,W as le,ak as Wt,al as St,am as gs,an as fs,ao as at,ap as Qt,Y as Fe,aq as vs,ar as At,as as Pt,at as js,au as bs,av as Ns,aw as ys,ax as ws,ay as Cs,az as ks,aA as Ss,aB as Mt,aC as As,x as Jt,n as ft,aD as vt,aE as Dt,aF as Xt,aG as Ps,m as Ms,aH as Ds,aI as Is,aJ as nt,T as it,p as rt,q as ot,aK as Ts,aL as Es,aM as Ls,aN as It,aO as Rs,aP as Os,aQ as _s,aR as Fs,aS as Us,aT as Ks,Q as qs,R as Hs,U as Tt,V as Et,aU as zs,aV as Gs,aW as Vs,aX as Bs,aY as $s,aZ as Ws,a_ as Qs,a$ as Js,b0 as Xs,b1 as Ys,b2 as Zs,b3 as ea,S as ta}from"./index-B1mN7ZR-.js";import{C as dt}from"./default-ports-1QQSffYX.js";import{t as V}from"./notifications-B2HqRBj7.js";import{C as Yt,L as ie,p as ve,$ as sa,m as je,o as Zt,aF as jt,R as bt,q as Me,aa as De,T as qe,a7 as Lt,aG as es,aE as aa,z as Nt,Z as Ie,_ as ts,i as na,u as ss,aH as ia,at as ra,X as yt,a9 as as,J as ns,D as is,aI as oa,as as rs,aJ as da,aw as la,aK as os}from"./icons-KVCk4_U8.js";import{R as Ue,A as Rt,D as Qe,i as ca,a as ua}from"./antigravity-responsibility-constants-Bvh4Ybz0.js";import{C as Ke}from"./checkbox-DoV2JinM.js";import{C as ma}from"./confirm-dialog-BcfzKHj3.js";import{S as wt}from"./separator-DnQqlaL0.js";import{S as pa}from"./searchable-select-DiGUiefs.js";import{P as xa}from"./proxy-status-widget-BXghaDz7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";import"./alert-dialog-zvnFuSZG.js";const Y="gemini-3.1-pro-high",Ne="gemini-3.1-pro-low",ha=Object.freeze({"gemini-3-pro-high":Y,"gemini-3.1-pro-high":Y,"gemini-3-pro-low":Ne,"gemini-3.1-pro-low":Ne,"gemini-3-pro-preview":Y,"gemini-3-pro-preview-customtools":Y,"gemini-3.1-pro-preview":Y,"gemini-3.1-pro-preview-customtools":Y,"gemini-3-1-pro-preview":Y,"gemini-3-1-pro-preview-customtools":Y}),ds=Object.freeze({"gemini-3-pro-preview":"gemini-3.1-pro-preview","gemini-3.1-pro-preview":"gemini-3-pro-preview","gemini-3-flash-preview":"gemini-3.1-flash-preview","gemini-3.1-flash-preview":"gemini-3-flash-preview"}),ga=/^gemini-(\d+(?:[.-]\d+)*)-(pro|flash)-preview(-customtools)?$/i,fa=["agy/","gcli/"];function $(t){return ms(t).toLowerCase()}function va(t){const a=t.trim(),s=a.toLowerCase();for(const n of fa)if(s.startsWith(n))return a.slice(n.length);return a}function ja(t){return t.replace(/-customtools$/i,"")}function ba(t){return ha[$(t)]}function He(t){const a=$(t),s=a.match(ga);if(!s)return null;const[,n,i,c]=s;return{normalizedId:a,version:n.split(/[.-]/).map(d=>Number(d)),family:i,customtools:!!c,dottedVersion:n.includes(".")}}function ls(t,a){const s=Math.max(t.length,a.length);for(let n=0;n<s;n+=1){const i=t[n]??0,c=a[n]??0;if(i!==c)return i>c?1:-1}return 0}function Na(t,a,s){if(t.customtools!==a.customtools)return t.customtools?1:-1;const n=ls(t.version,a.version);if(n!==0)return n>0?-1:1;const i=+(t.dottedVersion===s.dottedVersion),c=+(a.dottedVersion===s.dottedVersion);return i!==c?c-i:t.normalizedId.localeCompare(a.normalizedId)}function Ot(t,a){const s=$(a);return t.find(n=>$(n.id)===s)?.id}function ya(t,a){const s=He(t);return!s||a.length===0?void 0:a.map(i=>{const c=He(i.id);return!c||c.family!==s.family?null:{id:i.id,info:c}}).filter(i=>!!i).sort((i,c)=>Na(i.info,c.info,s))[0]?.id}const pe={agy:{provider:"agy",displayName:"Antigravity",defaultModel:"claude-opus-4-6-thinking",models:[{id:"claude-opus-4-6-thinking",name:"Claude Opus 4.6 Thinking",description:"Latest flagship, extended thinking",extendedContext:!1,presetMapping:{default:"claude-opus-4-6-thinking",opus:"claude-opus-4-6-thinking",sonnet:"claude-sonnet-4-6",haiku:"claude-sonnet-4-6"}},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",description:"Latest Sonnet with thinking budget support",presetMapping:{default:"claude-sonnet-4-6",opus:"claude-opus-4-6-thinking",sonnet:"claude-sonnet-4-6",haiku:"claude-sonnet-4-6"}},{id:Y,name:"Gemini Pro High",description:"Current Antigravity Gemini Pro route with higher reasoning budget",extendedContext:!0,presetMapping:{default:Y,opus:Y,sonnet:Y,haiku:"gemini-3-1-flash-preview"}},{id:Ne,name:"Gemini Pro Low",description:"Current Antigravity Gemini Pro route with the lighter quota tier",extendedContext:!0,presetMapping:{default:Ne,opus:Ne,sonnet:Ne,haiku:"gemini-3-1-flash-preview"}},{id:"gemini-3-1-flash-preview",name:"Gemini Flash",description:"Resolves to the best advertised Gemini Flash preview via Antigravity",extendedContext:!0,presetMapping:{default:"gemini-3-1-flash-preview",opus:Y,sonnet:Y,haiku:"gemini-3-1-flash-preview"}}]},gemini:{provider:"gemini",displayName:"Gemini",defaultModel:"gemini-2.5-pro",models:[{id:"gemini-3.1-pro-preview",name:"Gemini Pro",tier:"paid",description:"Uses the best advertised Gemini Pro preview when Google exposes one",extendedContext:!0,presetMapping:{default:"gemini-3.1-pro-preview",opus:"gemini-3.1-pro-preview",sonnet:"gemini-3.1-pro-preview",haiku:"gemini-3-flash-preview"}},{id:"gemini-3-flash-preview",name:"Gemini Flash",tier:"paid",description:"Uses the best advertised Gemini Flash preview when Google exposes one",extendedContext:!0,presetMapping:{default:"gemini-3-flash-preview",opus:"gemini-3.1-pro-preview",sonnet:"gemini-3.1-pro-preview",haiku:"gemini-3-flash-preview"}},{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro",description:"Stable, works with free Google account",extendedContext:!0,presetMapping:{default:"gemini-2.5-pro",opus:"gemini-2.5-pro",sonnet:"gemini-2.5-pro",haiku:"gemini-2.5-flash"}}]},codex:{provider:"codex",displayName:"Codex",defaultModel:"gpt-5-codex",models:[{id:"gpt-5-codex",name:"GPT-5 Codex",description:"Cross-plan safe Codex default",presetMapping:{default:"gpt-5-codex",opus:"gpt-5-codex",sonnet:"gpt-5-codex",haiku:"gpt-5-codex-mini"}},{id:"gpt-5-codex-mini",name:"GPT-5 Codex Mini",description:"Faster and cheaper Codex option",presetMapping:{default:"gpt-5-codex-mini",opus:"gpt-5-codex",sonnet:"gpt-5-codex",haiku:"gpt-5-codex-mini"}},{id:"gpt-5-mini",name:"GPT-5 Mini",description:"Legacy mini model ID kept for backwards compatibility",presetMapping:{default:"gpt-5-mini",opus:"gpt-5-codex",sonnet:"gpt-5-mini",haiku:"gpt-5-mini"}},{id:"gpt-5.1-codex-mini",name:"GPT-5.1 Codex Mini",description:"Legacy fast Codex mini model",presetMapping:{default:"gpt-5.1-codex-mini",opus:"gpt-5.1-codex-max",sonnet:"gpt-5.1-codex-max",haiku:"gpt-5.1-codex-mini"}},{id:"gpt-5.1-codex-max",name:"GPT-5.1 Codex Max",description:"Higher-effort Codex model with xhigh support",presetMapping:{default:"gpt-5.1-codex-max",opus:"gpt-5.1-codex-max",sonnet:"gpt-5.1-codex-max",haiku:"gpt-5.1-codex-mini"}},{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",description:"Cross-plan Codex model with xhigh support",presetMapping:{default:"gpt-5.2-codex",opus:"gpt-5.2-codex",sonnet:"gpt-5.2-codex",haiku:"gpt-5-codex-mini"}},{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",tier:"paid",description:"Paid Codex plans only",presetMapping:{default:"gpt-5.3-codex",opus:"gpt-5.3-codex",sonnet:"gpt-5.3-codex",haiku:"gpt-5-codex-mini"}},{id:"gpt-5.3-codex-spark",name:"GPT-5.3 Codex Spark",tier:"paid",description:"Paid Codex plans only, ultra-fast coding model",presetMapping:{default:"gpt-5.3-codex-spark",opus:"gpt-5.3-codex",sonnet:"gpt-5.3-codex",haiku:"gpt-5-codex-mini"}},{id:"gpt-5.4",name:"GPT-5.4",tier:"paid",description:"Paid Codex plans only, latest GPT-5 family model",presetMapping:{default:"gpt-5.4",opus:"gpt-5.4",sonnet:"gpt-5.4",haiku:"gpt-5-codex-mini"}}]},qwen:{provider:"qwen",displayName:"Qwen",defaultModel:"qwen3-coder-plus",models:[{id:"qwen3-coder-plus",name:"Qwen3 Coder Plus",description:"Code-focused model (1M context)",presetMapping:{default:"qwen3-coder-plus",opus:"qwen3-max",sonnet:"qwen3-coder-plus",haiku:"qwen3-coder-flash"}},{id:"qwen3-max",name:"Qwen3 Max",description:"Flagship model (256K context)",presetMapping:{default:"qwen3-max",opus:"qwen3-max",sonnet:"qwen3-coder-plus",haiku:"qwen3-coder-flash"}},{id:"qwen3-max-preview",name:"Qwen3 Max Preview",description:"Preview with thinking support (256K)",presetMapping:{default:"qwen3-max-preview",opus:"qwen3-max-preview",sonnet:"qwen3-max",haiku:"qwen3-coder-flash"}},{id:"qwen3-235b",name:"Qwen3 235B",description:"Large 235B A22B model",presetMapping:{default:"qwen3-235b",opus:"qwen3-max",sonnet:"qwen3-235b",haiku:"qwen3-coder-flash"}},{id:"qwen3-vl-plus",name:"Qwen3 VL Plus",description:"Vision-language multimodal"},{id:"qwen3-coder-flash",name:"Qwen3 Coder Flash",description:"Fast code generation"},{id:"qwen3-32b",name:"Qwen3 32B",description:"Qwen3 32B model"}]},iflow:{provider:"iflow",displayName:"iFlow",defaultModel:"qwen3-coder-plus",models:[{id:"qwen3-coder-plus",name:"Qwen3 Coder Plus",description:"Recommended default for iFlow accounts",presetMapping:{default:"qwen3-coder-plus",opus:"qwen3-coder-plus",sonnet:"qwen3-coder-plus",haiku:"qwen3-coder-plus"}},{id:"qwen3-max",name:"Qwen3 Max",description:"Flagship Qwen model via iFlow"},{id:"kimi-k2",name:"Kimi K2",description:"Kimi model currently available via iFlow"},{id:"deepseek-v3.2",name:"DeepSeek V3.2",description:"Current DeepSeek V3.2 model via iFlow"},{id:"deepseek-r1",name:"DeepSeek R1",description:"Reasoning-focused DeepSeek model"},{id:"glm-4.6",name:"GLM 4.6",description:"Zhipu GLM 4.6 via iFlow"},{id:"qwen3-vl-plus",name:"Qwen3 VL Plus",description:"Vision-language model"}]},kimi:{provider:"kimi",displayName:"Kimi (Moonshot)",defaultModel:"kimi-k2.5",models:[{id:"kimi-k2.5",name:"Kimi K2.5",description:"Latest multimodal model (262K context)",presetMapping:{default:"kimi-k2.5",opus:"kimi-k2.5",sonnet:"kimi-k2-thinking",haiku:"kimi-k2"}},{id:"kimi-k2-thinking",name:"Kimi K2 Thinking",description:"Extended reasoning model",presetMapping:{default:"kimi-k2-thinking",opus:"kimi-k2.5",sonnet:"kimi-k2-thinking",haiku:"kimi-k2"}},{id:"kimi-k2",name:"Kimi K2",description:"Flagship coding model"}]},kiro:{provider:"kiro",displayName:"Kiro (AWS)",defaultModel:"kiro-claude-sonnet-4-6",models:[{id:"kiro-claude-opus-4-6",name:"Kiro Claude Opus 4.6",description:"Claude Opus 4.6 via Kiro (2.2x credit)",presetMapping:{default:"kiro-claude-opus-4-6",opus:"kiro-claude-opus-4-6",sonnet:"kiro-claude-sonnet-4-6",haiku:"kiro-claude-haiku-4-5"}},{id:"kiro-claude-sonnet-4-6",name:"Kiro Claude Sonnet 4.6",description:"Claude Sonnet 4.6 via Kiro (1.3x credit)",presetMapping:{default:"kiro-claude-sonnet-4-6",opus:"kiro-claude-opus-4-6",sonnet:"kiro-claude-sonnet-4-6",haiku:"kiro-claude-haiku-4-5"}},{id:"kiro-claude-opus-4-5",name:"Kiro Claude Opus 4.5",description:"Claude Opus 4.5 via Kiro (2.2x credit)",presetMapping:{default:"kiro-claude-opus-4-5",opus:"kiro-claude-opus-4-5",sonnet:"kiro-claude-sonnet-4-5",haiku:"kiro-claude-haiku-4-5"}},{id:"kiro-claude-sonnet-4-5",name:"Kiro Claude Sonnet 4.5",description:"Claude Sonnet 4.5 via Kiro (1.3x credit)",presetMapping:{default:"kiro-claude-sonnet-4-5",opus:"kiro-claude-opus-4-5",sonnet:"kiro-claude-sonnet-4-5",haiku:"kiro-claude-haiku-4-5"}},{id:"kiro-claude-sonnet-4",name:"Kiro Claude Sonnet 4",description:"Claude Sonnet 4 via Kiro (1.3x credit)",presetMapping:{default:"kiro-claude-sonnet-4",opus:"kiro-claude-opus-4-5",sonnet:"kiro-claude-sonnet-4",haiku:"kiro-claude-haiku-4-5"}},{id:"kiro-claude-haiku-4-5",name:"Kiro Claude Haiku 4.5",description:"Claude Haiku 4.5 via Kiro (0.4x credit)"}]},ghcp:{provider:"ghcp",displayName:"GitHub Copilot (OAuth)",defaultModel:"claude-sonnet-4.5",models:[{id:"claude-opus-4.5",name:"Claude Opus 4.5",description:"Anthropic Claude Opus 4.5 via GitHub Copilot",presetMapping:{default:"claude-opus-4.5",opus:"claude-opus-4.5",sonnet:"claude-sonnet-4.5",haiku:"claude-haiku-4.5"}},{id:"claude-sonnet-4.5",name:"Claude Sonnet 4.5",description:"Anthropic Claude Sonnet 4.5 via GitHub Copilot",presetMapping:{default:"claude-sonnet-4.5",opus:"claude-opus-4.5",sonnet:"claude-sonnet-4.5",haiku:"claude-haiku-4.5"}},{id:"claude-sonnet-4",name:"Claude Sonnet 4",description:"Anthropic Claude Sonnet 4 via GitHub Copilot"},{id:"claude-haiku-4.5",name:"Claude Haiku 4.5",description:"Anthropic Claude Haiku 4.5 via GitHub Copilot"},{id:"gpt-5.2",name:"GPT-5.2",description:"OpenAI GPT-5.2 via GitHub Copilot",presetMapping:{default:"gpt-5.2",opus:"gpt-5.2",sonnet:"gpt-5.1",haiku:"gpt-5-mini"}},{id:"gpt-5.1",name:"GPT-5.1",description:"OpenAI GPT-5.1 via GitHub Copilot"},{id:"gpt-5",name:"GPT-5",description:"OpenAI GPT-5 via GitHub Copilot"},{id:"gpt-5-mini",name:"GPT-5 Mini",description:"OpenAI GPT-5 Mini via GitHub Copilot"},{id:"gemini-3-pro",name:"Gemini 3 Pro",description:"Google Gemini 3 Pro via GitHub Copilot"}]},claude:{provider:"claude",displayName:"Claude (Anthropic)",defaultModel:"claude-sonnet-4-6",models:[{id:"claude-opus-4-6",name:"Claude Opus 4.6",description:"Latest flagship model",extendedContext:!0,presetMapping:{default:"claude-opus-4-6",opus:"claude-opus-4-6",sonnet:"claude-sonnet-4-6",haiku:"claude-haiku-4-5-20251001"}},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",description:"Balanced performance and speed",extendedContext:!0,presetMapping:{default:"claude-sonnet-4-6",opus:"claude-opus-4-6",sonnet:"claude-sonnet-4-6",haiku:"claude-haiku-4-5-20251001"}},{id:"claude-opus-4-5-20251101",name:"Claude Opus 4.5",description:"Most capable Claude model",extendedContext:!0,presetMapping:{default:"claude-opus-4-5-20251101",opus:"claude-opus-4-5-20251101",sonnet:"claude-sonnet-4-5-20250929",haiku:"claude-haiku-4-5-20251001"}},{id:"claude-sonnet-4-5-20250929",name:"Claude Sonnet 4.5",description:"Balanced performance and speed",extendedContext:!0,presetMapping:{default:"claude-sonnet-4-5-20250929",opus:"claude-opus-4-5-20251101",sonnet:"claude-sonnet-4-5-20250929",haiku:"claude-haiku-4-5-20251001"}},{id:"claude-sonnet-4-20250514",name:"Claude Sonnet 4",description:"Previous generation Sonnet",extendedContext:!0,presetMapping:{default:"claude-sonnet-4-20250514",opus:"claude-opus-4-5-20251101",sonnet:"claude-sonnet-4-20250514",haiku:"claude-haiku-4-5-20251001"}},{id:"claude-haiku-4-5-20251001",name:"Claude Haiku 4.5",description:"Fast and efficient"}]}};function we(t,a){if(!t)return;const s=$(a);if(t.provider==="agy"){const d=ba(s);if(d){const l=t.models.find(r=>r.id===d);if(l)return l}}const n=ds[s.toLowerCase()],i=t.models.find(d=>d.id===s||d.id===n);if(i)return i;const c=He(s);if(c)return t.models.map(d=>({model:d,info:He(d.id)})).filter(d=>!!(d.info&&d.info.family===c.family)).sort((d,l)=>ls(l.info.version,d.info.version))[0]?.model}function wa(t){if(t==="free")return"free";if(typeof t=="string"&&t.trim().length>0)return"paid"}function Ca(t,a){const s=pe[t.toLowerCase()];if(!a||a.models.length===0)return s;const n=a.models.map(l=>({id:l.id,owned_by:a.provider})),i=a.models.map(l=>{const r=we(s,l.id);return{...l,name:l.name||r?.name||l.id,tier:r?.tier??wa(l.tier),description:l.description??r?.description,broken:r?.broken,issueUrl:r?.issueUrl,deprecated:r?.deprecated,deprecationReason:r?.deprecationReason,extendedContext:l.extendedContext??r?.extendedContext,presetMapping:r?.presetMapping}}),c=s?.defaultModel?ye(s.defaultModel,n):void 0,d=typeof c=="string"&&n.some(l=>$(l.id)===$(c));return{provider:a.provider,displayName:a.displayName||s?.displayName||t,defaultModel:d?c:a.defaultModel,models:i}}function Ct(t){const a={},s=new Set([...Object.keys(pe),...Object.keys(t??{})]);for(const n of s){const i=Ca(n,t?.[n]);i&&(a[n]=i)}return a}function cs(t,a,s){const n=we(s,a);return n||we(pe[t.toLowerCase()],a)}function ye(t,a=[]){const s=$(t),n=ya(s,a);if(n)return n;const i=Ot(a,s);if(i)return i;const c=ds[s];return(c?Ot(a,c):void 0)??s}function ka(t,a=[]){return{default:ye(t.default,a),opus:ye(t.opus,a),sonnet:ye(t.sonnet,a),haiku:ye(t.haiku,a)}}function kt(t,a=[]){if(!t)return[];const s=pe[t.provider.toLowerCase()]??t,n=new Set;return s.models.map(i=>{const c=ye(i.id,a),d=i.presetMapping?ka(i.presetMapping,a):void 0,l=t.models.find(r=>$(r.id)===$(c));return{...i,id:c,name:l?.name||i.name,description:l?.description??i.description,presetMapping:d}}).filter(i=>n.has(i.id)?!1:(n.add(i.id),!0))}function Sa(t,a,s=[]){const n=t.trim().toLowerCase();if(!a||!n)return[];const i=pe[n]??a,c=kt(a,s),d=new Set(c.map(p=>$(p.id))),l=new Set(c.map(p=>we(i,p.id)?.id).filter(p=>!!p).map(p=>$(p))),r=new Set,h=new Set(s.map(p=>$(p.id)));return s.filter(p=>{const v=$(p.id),x=va(p.id),m=ja(x),L=we(i,x)??we(i,m);if(d.has($(x))||v!==$(x)&&h.has($(x)))return!1;const w=$(m);if(w!==$(x)&&h.has(w))return!1;const I=L?$(L.id):w;return L&&l.has(I)||r.has(I)||!L&&n==="agy"?!1:(r.add(I),!0)})}function Aa(t,a,s){return cs(t,a,s)?.extendedContext===!0}const Je="ccs-internal-managed";async function Pa(){try{const t=await fetch("/api/settings/auth/tokens/raw");return t.ok?(await t.json())?.apiKey?.value??Je:Je}catch{return Je}}async function Ma(t,a){if(a)return a;try{const s=await fetch("/api/cliproxy/catalog");if(!s.ok)return pe[t];const n=await s.json();return Ct(n.catalogs)[t]??pe[t]}catch{return pe[t]}}async function lt(t,a,s){const n=await Ma(t,s);if(!n)return{success:!1};const i=n.models.find(h=>h.id===n.defaultModel)||n.models[0],c=i?.presetMapping||{default:n.defaultModel,opus:n.defaultModel,sonnet:n.defaultModel,haiku:n.defaultModel},d=await Pa(),r={env:{ANTHROPIC_BASE_URL:`http://127.0.0.1:${dt}/api/provider/${t}`,ANTHROPIC_AUTH_TOKEN:d,ANTHROPIC_MODEL:c.default,ANTHROPIC_DEFAULT_OPUS_MODEL:c.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:c.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:c.haiku}};try{return{success:(await fetch(`/api/settings/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:r})})).ok,presetName:i?.name||n.defaultModel}}catch{return{success:!1}}}function Da({currentProgress:t,allSteps:a}){return e.jsx("div",{className:"flex justify-center gap-1 pt-2",children:a.map((s,n)=>e.jsx("div",{className:`w-2 h-2 rounded-full transition-colors ${t>=n?"bg-primary":"bg-muted"}`},s))})}function Ia({providers:t,onSelect:a}){return e.jsx("div",{className:"grid gap-2",children:t.map(s=>e.jsxs("button",{onClick:()=>a(s.id),className:"flex items-center justify-between p-3 border rounded-lg hover:bg-muted/50 transition-colors text-left",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:s.name}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s.description})]}),e.jsx(Yt,{className:"w-4 h-4 text-muted-foreground"})]},s.id))})}function Ta({selectedProvider:t,providers:a,authCommand:s,isRefreshing:n,isPending:i,onBack:c,onStartAuth:d,onRefresh:l}){const{t:r}=B(),[h,p]=u.useState(!1),v=async x=>{await navigator.clipboard.writeText(x),p(!0),setTimeout(()=>p(!1),2e3)};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-center space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:r("setupWizard.authStep.authenticateWith",{provider:a.find(x=>x.id===t)?.name})}),e.jsx(K,{onClick:d,disabled:i,className:"w-full gap-2",size:"lg",children:i?e.jsxs(e.Fragment,{children:[e.jsx(ie,{className:"w-4 h-4 animate-spin"}),r("setupWizard.authStep.authenticating")]}):e.jsxs(e.Fragment,{children:[e.jsx(ve,{className:"w-4 h-4"}),r("setupWizard.authStep.authenticateInBrowser")]})}),i&&e.jsx("p",{className:"text-xs text-muted-foreground",children:r("setupWizard.authStep.completeOAuth")})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:r("setupWizard.authStep.orUseTerminal")})})]}),e.jsx(Ht,{children:e.jsxs(zt,{className:"p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(sa,{className:"w-4 h-4"}),r("setupWizard.authStep.runCommandHint")]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 px-3 py-2 bg-muted rounded-md font-mono text-sm",children:s}),e.jsx(K,{variant:"outline",size:"icon",onClick:()=>v(s),children:h?e.jsx(je,{className:"w-4 h-4 text-green-500"}):e.jsx(Zt,{className:"w-4 h-4"})})]})]})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(K,{variant:"ghost",onClick:c,disabled:i,children:[e.jsx(jt,{className:"w-4 h-4 mr-2"}),r("setupWizard.authStep.back")]}),e.jsxs(K,{variant:"outline",onClick:l,disabled:n||i,children:[e.jsx(bt,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),r(n?"setupWizard.authStep.checking":"setupWizard.authStep.refreshStatus")]})]})]})}function Ea({accounts:t,privacyMode:a,onSelect:s,onAddNew:n,onBack:i}){const{t:c}=B();return e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:c("setupWizard.accountStep.selectAccount",{count:t.length})}),e.jsx("div",{className:"grid gap-2 max-h-[320px] overflow-y-auto pr-1",children:t.map(d=>{const l=Gt(d.id,d.email,d.tokenFile);return e.jsxs("button",{type:"button",onClick:()=>s(d),className:"flex items-center justify-between p-3 border rounded-lg hover:bg-muted/50 transition-colors text-left",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-muted flex items-center justify-center",children:e.jsx(Me,{className:"w-4 h-4 text-muted-foreground"})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:J("font-medium",a&&mt),children:l.email}),e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[l.audienceLabel&&e.jsx(G,{variant:"outline",className:J("text-[10px] h-4 px-1.5 border-transparent",l.audience==="business"?"bg-sky-500/12 text-sky-700 dark:text-sky-300":"bg-emerald-500/12 text-emerald-700 dark:text-emerald-300"),children:l.audienceLabel}),l.detailLabel&&e.jsx(G,{variant:"outline",className:"text-[10px] h-4 px-1.5",children:l.detailLabel}),d.isDefault&&e.jsx("span",{className:"text-xs text-muted-foreground",children:c("setupWizard.accountStep.defaultAccount")})]})]})]}),e.jsx(Yt,{className:"w-4 h-4 text-muted-foreground"})]},d.id)})}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:c("setupWizard.accountStep.or")})})]}),e.jsxs("button",{type:"button",className:"w-full flex items-center gap-3 p-3 border-2 border-dashed border-primary/50 rounded-lg hover:border-primary hover:bg-primary/5 transition-colors text-left",onClick:n,children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center shrink-0",children:e.jsx(ve,{className:"w-4 h-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-primary",children:c("setupWizard.accountStep.addNewAccount")}),e.jsx("div",{className:"text-xs text-muted-foreground",children:c("setupWizard.accountStep.addNewAccountDesc")})]})]}),e.jsx("div",{className:"flex items-center justify-between pt-2",children:e.jsxs(K,{variant:"ghost",onClick:i,children:[e.jsx(jt,{className:"w-4 h-4 mr-2"}),c("setupWizard.accountStep.back")]})})]})}const _t="__custom__";function La({selectedProvider:t,catalog:a,selectedAccount:s,variantName:n,modelName:i,isPending:c,privacyMode:d,onVariantNameChange:l,onModelChange:r,onBack:h,onSkip:p,onCreate:v}){const{t:x}=B(),m=a||pe[t],L=m?.models||[],w=i&&!L.some(o=>o.id===i),[I,k]=u.useState(w),S=t==="agy"&&i.trim().length>0?de(i):!1,y=s?Gt(s.id,s.email,s.tokenFile):null,C=o=>{o===_t?(k(!0),r("")):(k(!1),r(o))};return e.jsxs("div",{className:"space-y-4",children:[s&&e.jsxs("div",{className:"flex items-start gap-2 p-2 bg-muted/50 rounded-md text-sm",children:[e.jsx(Me,{className:"w-4 h-4"}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("span",{children:[x("setupVariant.using")," ",e.jsx("span",{className:J(d&&mt),children:y?.email})]}),(y?.audienceLabel||y?.detailLabel)&&e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[y?.audienceLabel&&e.jsx(G,{variant:"outline",className:J("text-[10px] h-4 px-1.5 border-transparent",y.audience==="business"?"bg-sky-500/12 text-sky-700 dark:text-sky-300":"bg-emerald-500/12 text-emerald-700 dark:text-emerald-300"),children:y.audienceLabel}),y?.detailLabel&&e.jsx(G,{variant:"outline",className:"text-[10px] h-4 px-1.5",children:y.detailLabel})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Z,{htmlFor:"variant-name",children:x("setupVariant.variantNameRequired")}),e.jsx(me,{id:"variant-name",value:n,onChange:o=>l(o.target.value),placeholder:x("setupVariant.variantNamePlaceholder")}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[x("setupVariant.invokeHintPrefix")," ccs ",n||"<name>",' "prompt"']})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Z,{children:x("setupVariant.model")}),I?e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{value:i,onChange:o=>r(o.target.value),placeholder:x("setupVariant.modelPlaceholder")}),S&&e.jsx("p",{className:"text-xs text-destructive",children:x("providerEditor.agyDenylist")}),e.jsx("button",{type:"button",className:"text-xs text-primary hover:underline",onClick:()=>{k(!1),t==="agy"&&de(i)&&r("")},children:x("setupVariant.choosePresetInstead")})]}):e.jsxs(Ze,{value:L.some(o=>o.id===i)?i:"",onValueChange:C,children:[e.jsx(et,{children:e.jsx(tt,{placeholder:x("setupVariant.selectModel")})}),e.jsxs(st,{children:[L.map(o=>e.jsx(Pe,{value:o.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:o.name}),o.description&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["- ",o.description]})]})},o.id)),e.jsx(Pe,{value:_t,children:e.jsx("span",{className:"text-primary",children:x("setupVariant.customModelName")})})]})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:I?x("setupVariant.enterAnyModel"):x("setupVariant.defaultModel",{model:m?.defaultModel||x("setupVariant.providerDefault")})})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsxs(K,{variant:"ghost",onClick:h,children:[e.jsx(jt,{className:"w-4 h-4 mr-2"}),x("setupVariant.back")]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(K,{variant:"ghost",onClick:p,children:x("setupVariant.skip")}),e.jsx(K,{onClick:v,disabled:!n||c||S,children:x(c?"setupVariant.creating":"setupVariant.createVariant")})]})]}),e.jsx("p",{className:"text-xs text-center text-muted-foreground",children:x("setupVariant.skipHint")})]})}function Ra({variantName:t,onClose:a}){const{t:s}=B();return e.jsxs("div",{className:"space-y-4 text-center",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("div",{className:"w-16 h-16 bg-green-100 dark:bg-green-900/30 rounded-full flex items-center justify-center",children:e.jsx(je,{className:"w-8 h-8 text-green-600 dark:text-green-400"})})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-lg",children:s("setupWizard.successStep.title")}),e.jsx("div",{className:"text-sm text-muted-foreground",children:s("setupWizard.successStep.subtitle")})]}),e.jsx(Ht,{children:e.jsxs(zt,{className:"p-4 space-y-2",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:s("setupWizard.successStep.usage")}),e.jsxs("code",{className:"block px-3 py-2 bg-muted rounded-md font-mono text-sm",children:["ccs ",t,' "your prompt here"']})]})}),e.jsx(K,{onClick:a,className:"w-full",children:s("setupWizard.successStep.done")})]})}function Oa({open:t,onClose:a}){const[s,n]=u.useState("provider"),[i,c]=u.useState(""),[d,l]=u.useState(null),[r,h]=u.useState(""),[p,v]=u.useState(""),[x,m]=u.useState(!1),[L,w]=u.useState(!1),{data:I,refetch:k}=Vt(),{data:S}=Bt(),y=ps(),C=xs(),o=hs(),{privacyMode:A}=$t(),T=I?.authStatus.find(R=>R.provider===i),g=u.useMemo(()=>T?.accounts||[],[T?.accounts]),D=u.useMemo(()=>Ct(S?.catalogs),[S?.catalogs]),b=!!S;u.useEffect(()=>{if(!t){const R=setTimeout(()=>{n("provider"),c(""),l(null),h(""),v(""),w(!1)},0);return()=>clearTimeout(R)}},[t]),u.useEffect(()=>{if(s==="auth"&&g.length>0&&!L){const R=setTimeout(()=>{n("account")},0);return()=>clearTimeout(R)}},[s,g,L]);const H=async()=>{m(!0),await k(),m(!1)},P=()=>{const R=(T?.accounts?.length||0)===0;C.mutate({provider:i},{onSuccess:async q=>{if(R){const Q=await lt(i,void 0,b?D[i]:void 0);Q.success&&Q.presetName?V.success(`Applied "${Q.presetName}" preset`):Q.success||V.warning(le.t("commonToast.accountAddedPresetFailed"))}q.account&&(l(q.account),n("variant")),k()}})},O=R=>{c(R),(I?.authStatus.find(ee=>ee.provider===R)?.accounts||[]).length===0?n("auth"):n("account")},j=R=>{l(R),n("variant")},z=async()=>{if(!(!r||!i))try{await y.mutateAsync({name:r,provider:i,model:p||void 0,account:d?.id}),n("success")}catch(R){console.error("Failed to create variant:",R)}},E=`ccs ${i} --auth --add`,F=fs(s),N=R=>{if(!R&&(C.isPending&&i&&o.mutate(i),s==="success"||s==="provider")){a();return}};return e.jsx(pt,{open:t,onOpenChange:N,children:e.jsxs(xt,{className:"sm:max-w-lg",onPointerDownOutside:R=>{s!=="success"&&s!=="provider"&&R.preventDefault()},onEscapeKeyDown:R=>{(C.isPending||y.isPending)&&R.preventDefault()},children:[e.jsxs(ht,{children:[e.jsxs(gt,{className:"flex items-center gap-2",children:[e.jsx(De,{className:"w-5 h-5 text-primary"}),le.t("setupWizard.title")]}),e.jsxs(Wt,{children:[s==="provider"&&le.t("setupWizard.stepProviderDesc"),s==="auth"&&le.t("setupWizard.stepAuthDesc"),s==="account"&&le.t("setupWizard.stepAccountDesc"),s==="variant"&&le.t("setupWizard.stepVariantDesc"),s==="success"&&le.t("setupWizard.stepSuccessDesc")]})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[s==="provider"&&e.jsx(Ia,{providers:St,onSelect:O}),s==="auth"&&e.jsx(Ta,{selectedProvider:i,providers:St,authCommand:E,isRefreshing:x,isPending:C.isPending,onBack:()=>n("provider"),onStartAuth:P,onRefresh:H}),s==="account"&&e.jsx(Ea,{accounts:g,privacyMode:A,onSelect:j,onAddNew:()=>{w(!0),n("auth")},onBack:()=>n("provider")}),s==="variant"&&e.jsx(La,{selectedProvider:i,catalog:D[i],selectedAccount:d,variantName:r,modelName:p,isPending:y.isPending,privacyMode:A,onVariantNameChange:h,onModelChange:v,onBack:()=>g.length>0?n("account"):n("provider"),onSkip:a,onCreate:z}),s==="success"&&e.jsx(Ra,{variantName:r,onClose:a})]}),e.jsx(Da,{currentProgress:F,allSteps:gs})]})})}const _a=3e3,Fa=300*1e3,Ua=3;function Xe(t){t.invalidateQueries({queryKey:["cliproxy-catalog"]}),t.invalidateQueries({queryKey:["cliproxy-models"]})}async function Ye(t){const a=await t.text();if(!a)return{};try{return JSON.parse(a)}catch{const s=t.status>=400?`Request failed with status ${t.status}`:void 0;return s?{error:s}:{}}}const xe={provider:null,isAuthenticating:!1,error:null,authUrl:null,oauthState:null,isSubmittingCallback:!1,isDeviceCodeFlow:!1};function Ka(){const{t}=B(),[a,s]=u.useState(xe),n=u.useRef(xe),i=u.useRef(0),c=u.useRef(null),d=u.useRef(null),l=u.useRef(0),r=u.useRef(0),h=u.useRef(!1),p=ut(),v=u.useCallback(k=>k===i.current,[]),x=u.useCallback(()=>{d.current&&(clearInterval(d.current),d.current=null),r.current=0},[]);u.useEffect(()=>()=>{c.current?.abort(),x(),h.current=!1},[x]),u.useEffect(()=>{n.current=a},[a]);const m=u.useCallback(async(k,S,y)=>{if(v(y)){if(Date.now()-l.current>Fa){x(),v(y)&&s(C=>({...C,isAuthenticating:!1,error:t("toasts.providerAuthTimeout")}));return}try{const C=await fetch(`/api/cliproxy/auth/${k}/status?state=${encodeURIComponent(S)}`);if(!v(y))return;const o=await C.json();if(r.current=0,o.status==="ok"){if(!(typeof o.account=="object"&&o.account!==null)){x();const T=t("toasts.providerAccountRegistrationFailed");V.error(T),s(g=>({...g,isAuthenticating:!1,error:T}));return}x(),p.invalidateQueries({queryKey:["cliproxy-auth"]}),p.invalidateQueries({queryKey:["cliproxy-accounts"]}),p.invalidateQueries({queryKey:["account-quota"]}),Xe(p),V.success(t("toasts.providerAuthSuccess",{provider:k})),h.current=!1,s(xe)}else if(o.status==="auth_url"){const A=o.url||o.auth_url;A&&(s(T=>({...T,authUrl:A})),h.current||(h.current=!0,window.open(A,"_blank")))}else if(o.status==="device_code"){x();const A=o.user_code&&o.verification_url?`Open ${o.verification_url} and enter code: ${o.user_code}`:"Switch to Device Code method and try again.";V.error(t("toasts.providerDeviceCodeInCallback")),s(T=>({...T,isAuthenticating:!1,error:A}))}else if(o.status==="error"){x();const A=o.error||"Authentication failed";V.error(A),s(T=>({...T,isAuthenticating:!1,error:A}))}}catch(C){if(!v(y)||(r.current+=1,r.current<Ua))return;x();const o=C instanceof Error&&C.message.trim().length>0?C.message:t("toasts.providerLostStatusEndpoint");V.error(o),s(A=>({...A,isAuthenticating:!1,error:o}))}}},[v,p,x,t]),L=u.useCallback(async(k,S)=>{if(!at(k)){s({...xe,error:t("toasts.providerUnknown",{provider:k})});return}c.current?.abort(),x(),h.current=!1,r.current=0;const y=new AbortController,C=i.current+1;i.current=C,c.current=y;const A=(S?.flowType||(Qt(k)?"device_code":"authorization_code"))==="device_code",T=S?.startEndpoint||(A?"start":"start-url"),g={nickname:S?.nickname,kiroMethod:S?.kiroMethod,kiroIDCStartUrl:S?.kiroIDCStartUrl,kiroIDCRegion:S?.kiroIDCRegion,kiroIDCFlow:S?.kiroIDCFlow,riskAcknowledgement:S?.riskAcknowledgement};s({provider:k,isAuthenticating:!0,error:null,authUrl:null,oauthState:null,isSubmittingCallback:!1,isDeviceCodeFlow:A});try{if(T==="start")fetch(`/api/cliproxy/auth/${k}/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(g),signal:y.signal}).then(async D=>{if(!v(C))return;const b=await Ye(D);if(!v(C))return;const H=b.success===!0,P=typeof b.account=="object"&&b.account!==null;if(D.ok&&H&&P)p.invalidateQueries({queryKey:["cliproxy-auth"]}),p.invalidateQueries({queryKey:["cliproxy-accounts"]}),p.invalidateQueries({queryKey:["account-quota"]}),Xe(p),h.current=!1,s(xe);else{const O=typeof b.error=="string"?b.error:t(H?"toasts.providerAccountRegistrationFailed":"auth.loginFailed");V.error(O),s(j=>({...j,isAuthenticating:!1,error:O}))}}).catch(D=>{if(!v(C)||D instanceof Error&&D.name==="AbortError")return;const b=D instanceof Error?D.message:"Authentication failed";V.error(b),s(H=>({...H,isAuthenticating:!1,error:b}))});else{const D=await fetch(`/api/cliproxy/auth/${k}/start-url`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(g),signal:y.signal});if(!v(C))return;const b=await Ye(D);if(!v(C))return;const H=b.success===!0;if(!D.ok||!H){const j=typeof b.error=="string"?b.error:t("toasts.providerStartOAuthFailed");throw new Error(j)}const P=typeof b.authUrl=="string"?b.authUrl:null,O=typeof b.state=="string"?b.state:null;if(s(j=>({...j,authUrl:P,oauthState:O})),P&&(h.current=!0,window.open(P,"_blank")),O){if(l.current=Date.now(),!P){if(await m(k,O,C),!v(C))return;const j=n.current;if(!j.isAuthenticating||j.provider!==k)return}d.current=setInterval(()=>{m(k,O,C)},_a)}}}catch(D){if(!v(C))return;if(D instanceof Error&&D.name==="AbortError"){h.current=!1,s(xe);return}const b=D instanceof Error?D.message:t("auth.loginFailed");V.error(b),s(H=>({...H,isAuthenticating:!1,error:b}))}},[v,m,x,p,t]),w=u.useCallback(()=>{const k=a.provider;i.current+=1,c.current?.abort(),x(),h.current=!1,s(xe),k&&Fe.cliproxy.auth.cancel(k).catch(()=>{})},[a.provider,x]),I=u.useCallback(async k=>{if(!a.provider)return;const S=i.current,y=a.provider;s(C=>({...C,isSubmittingCallback:!0,error:null}));try{const C=await fetch(`/api/cliproxy/auth/${y}/submit-callback`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({redirectUrl:k})});if(!v(S))return;const o=await Ye(C);if(!v(S))return;const A=o.success===!0,T=o.status==="wait",g=typeof o.account=="object"&&o.account!==null;if(C.ok&&T)s(D=>({...D,isSubmittingCallback:!1,error:null}));else if(C.ok&&A&&g)x(),p.invalidateQueries({queryKey:["cliproxy-auth"]}),p.invalidateQueries({queryKey:["cliproxy-accounts"]}),p.invalidateQueries({queryKey:["account-quota"]}),Xe(p),V.success(t("toasts.providerAuthSuccess",{provider:y})),s(xe);else{const D=typeof o.error=="string"?o.error:t(A?"toasts.providerAccountRegistrationFailed":"toasts.providerCallbackFailed");throw new Error(D)}}catch(C){if(!v(S))return;const o=C instanceof Error?C.message:t("toasts.providerSubmitCallbackFailed");V.error(o),s(A=>({...A,isSubmittingCallback:!1,error:o}))}},[v,a.provider,p,x,t]);return u.useMemo(()=>({...a,startAuth:L,cancelAuth:w,submitCallback:I}),[a,L,w,I])}function ct({className:t,compact:a=!1,showAcknowledgement:s=!1,acknowledgementPhrase:n=Ue,acknowledgementText:i="",onAcknowledgementTextChange:c,disabled:d=!1,showProxySettingsLink:l=!1}){const{t:r}=B(),h=r("accountSafetyWarning.title"),p=r("accountSafetyWarning.subtitle"),v=r("accountSafetyWarning.firstLine"),x=r("accountSafetyWarning.secondLine"),m="https://github.com/kaitranntt/ccs/issues/509",L=r("accountSafetyWarning.issueLabel"),w=r("accountSafetyWarning.proxySettingsLabel");return a?e.jsx("section",{role:"alert",className:J("border-b border-amber-200/70 bg-amber-50/45 dark:bg-amber-950/5",t),children:e.jsxs("div",{className:"flex flex-col gap-3 px-6 py-3 lg:flex-row lg:items-start lg:justify-between",children:[e.jsxs("div",{className:"min-w-0 flex items-start gap-3",children:[e.jsx("div",{className:"mt-0.5 inline-flex h-6 w-6 items-center justify-center rounded-md bg-amber-500/12 text-amber-700 dark:text-amber-300",children:e.jsx(qe,{className:"h-3.5 w-3.5"})}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("p",{className:"text-xs font-semibold leading-5",children:h}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:p})]}),e.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:v}),e.jsx("p",{className:"text-xs font-medium leading-5 text-amber-900 dark:text-amber-200",children:x})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 lg:justify-end",children:[e.jsxs("a",{href:m,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-md border border-amber-500/25 bg-background/90 px-2 py-1 text-[11px] font-medium text-amber-800 transition-colors hover:bg-amber-500/10 dark:text-amber-200",children:[L,e.jsx(ve,{className:"h-3 w-3"})]}),l?e.jsxs("a",{href:"/settings?tab=proxy",className:"inline-flex items-center gap-1 rounded-md border border-amber-500/25 bg-background/90 px-2 py-1 text-[11px] font-medium text-amber-800 transition-colors hover:bg-amber-500/10 dark:text-amber-200",children:[e.jsx(Lt,{className:"h-3 w-3"}),w]}):null,e.jsx(G,{variant:"outline",className:"border-amber-500/40 text-[10px] text-amber-700 dark:text-amber-300",children:"High Risk"})]})]})}):e.jsxs("section",{role:"alert",className:J("relative overflow-hidden rounded-xl border border-amber-500/30 bg-gradient-to-br from-amber-50 via-background to-rose-50/70 shadow-sm dark:from-amber-950/20 dark:to-rose-950/20",t),children:[e.jsx("div",{className:"absolute inset-x-0 top-0 h-0.5 bg-gradient-to-r from-amber-500 via-orange-500 to-rose-500"}),e.jsxs("div",{className:"space-y-3 p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx("div",{className:"mt-0.5 inline-flex h-7 w-7 items-center justify-center rounded-md bg-amber-500/15 text-amber-700 dark:text-amber-400",children:e.jsx(qe,{className:"h-4 w-4"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold leading-5",children:h}),e.jsx("p",{className:"text-xs text-muted-foreground",children:p})]})]}),e.jsx(G,{variant:"outline",className:"border-amber-500/40 text-amber-700 dark:text-amber-300",children:"High Risk"})]}),e.jsxs("div",{className:"space-y-2 text-sm leading-relaxed",children:[e.jsx("p",{children:v}),e.jsx("p",{className:"font-medium text-amber-900 dark:text-amber-200",children:x}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"CCS is provided as-is and does not take responsibility for suspension, bans, or access loss from upstream providers."})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("a",{href:m,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-md border border-amber-500/30 bg-amber-500/10 px-2.5 py-1 text-xs font-medium text-amber-800 transition-colors hover:bg-amber-500/15 dark:text-amber-200",children:[L,e.jsx(ve,{className:"h-3.5 w-3.5"})]}),l&&e.jsxs("a",{href:"/settings?tab=proxy",className:"inline-flex items-center gap-1.5 rounded-md border border-amber-500/30 bg-amber-500/10 px-2.5 py-1 text-xs font-medium text-amber-800 transition-colors hover:bg-amber-500/15 dark:text-amber-200",children:[e.jsx(Lt,{className:"h-3.5 w-3.5"}),w]}),e.jsx("span",{className:"rounded-md border border-border/70 bg-muted/60 px-2.5 py-1 text-xs text-muted-foreground",children:"Applies to CLI and dashboard auth"})]}),s&&c&&e.jsxs("div",{className:"rounded-lg border border-amber-500/25 bg-amber-500/5 p-2.5",children:[e.jsxs(Z,{htmlFor:"account-risk-ack-text",className:"text-xs leading-5",children:["Type exact phrase to continue:"," ",e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono",children:n})]}),e.jsx(me,{id:"account-risk-ack-text",value:i,onChange:I=>c(I.target.value),placeholder:n,disabled:d,className:"mt-2 font-mono text-xs"})]})]})]})}function qa({className:t,value:a,onChange:s,disabled:n=!1}){const{t:i}=B(),c=[a.reviewedIssue509,a.understandsBanRisk,a.acceptsFullResponsibility,a.typedPhrase.trim().replace(/\s+/g," ").toUpperCase()===Rt].filter(Boolean).length,d=c/4*100,l=r=>{s({...a,...r})};return e.jsxs("section",{role:"alert",className:J("relative overflow-hidden rounded-xl border border-rose-500/35 bg-gradient-to-br from-rose-50 via-background to-amber-50/70 p-4 shadow-sm dark:from-rose-950/20 dark:to-amber-950/20",t),children:[e.jsx("div",{className:"absolute inset-x-0 top-0 h-0.5 bg-gradient-to-r from-rose-500 via-orange-500 to-amber-500"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx("div",{className:"mt-0.5 inline-flex h-7 w-7 items-center justify-center rounded-md bg-rose-500/15 text-rose-700 dark:text-rose-300",children:e.jsx(qe,{className:"h-4 w-4"})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-semibold leading-5",children:i("antigravityChecklist.title")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:i("antigravityChecklist.subtitle")})]})]}),e.jsx(G,{variant:"outline",className:"border-rose-500/40 text-rose-700 dark:text-rose-300",children:i("antigravityChecklist.mandatory")})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:i("antigravityChecklist.completion")}),e.jsx("span",{children:i("antigravityChecklist.stepsCount",{current:c})})]}),e.jsx(vs,{value:d,className:"h-2"})]}),e.jsxs("div",{className:"space-y-3 rounded-lg border border-rose-500/20 bg-rose-500/5 p-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Ke,{id:"agy-step-reviewed-issue",checked:a.reviewedIssue509,onCheckedChange:r=>l({reviewedIssue509:!!r}),disabled:n}),e.jsx(Z,{htmlFor:"agy-step-reviewed-issue",className:"text-xs leading-5",children:"Step 1: I reviewed issue #509 and understand AGY OAuth can trigger account bans/suspensions."})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Ke,{id:"agy-step-understands-risk",checked:a.understandsBanRisk,onCheckedChange:r=>l({understandsBanRisk:!!r}),disabled:n}),e.jsx(Z,{htmlFor:"agy-step-understands-risk",className:"text-xs leading-5",children:"Step 2: I understand this OAuth action is my own decision and I accept the upstream risk."})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Ke,{id:"agy-step-accept-responsibility",checked:a.acceptsFullResponsibility,onCheckedChange:r=>l({acceptsFullResponsibility:!!r}),disabled:n}),e.jsx(Z,{htmlFor:"agy-step-accept-responsibility",className:"text-xs leading-5",children:"Step 3: I accept full responsibility. CCS is not liable for suspension, bans, or access loss."})]})]}),e.jsxs("div",{className:"space-y-2 rounded-lg border border-amber-500/25 bg-amber-500/5 p-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium text-amber-800 dark:text-amber-200",children:[e.jsx(es,{className:"h-3.5 w-3.5"}),"Step 4: Type exact phrase to continue"]}),e.jsx(me,{value:a.typedPhrase,onChange:r=>l({typedPhrase:r.target.value}),placeholder:Rt,disabled:n,className:"font-mono text-xs"})]}),e.jsx("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:e.jsxs("a",{href:"https://github.com/kaitranntt/ccs/issues/509",target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-md border border-rose-500/30 bg-rose-500/10 px-2.5 py-1 font-medium text-rose-800 transition-colors hover:bg-rose-500/15 dark:text-rose-200",children:["Read issue #509",e.jsx(ve,{className:"h-3.5 w-3.5"})]})})]})]})}function Ha(t){return t.trim().replace(/\s+/g," ").toUpperCase()}function za({open:t,onClose:a,provider:s,displayName:n,catalog:i,isFirstAccount:c=!1}){const[d,l]=u.useState(""),[r,h]=u.useState(""),[p,v]=u.useState(!1),[x,m]=u.useState(null),[L,w]=u.useState(""),[I,k]=u.useState(Qe),[S,y]=u.useState(!1),[C,o]=u.useState(!1),[A,T]=u.useState(At),[g,D]=u.useState(""),[b,H]=u.useState(""),[P,O]=u.useState(Pt),{t:j}=B(),z=u.useRef(!1),E=u.useRef(0),F=u.useRef(!1),N=Ka(),R=js(),q=s==="kiro",Q=s==="agy"||s==="gemini",ee=s==="gemini"&&!S,te=s==="agy"&&!S,re=Q&&C,oe=ca(I),se=Ha(L)===Ue,ae=Qt(s),f=bs(A),U=q&&A==="idc",ne=q&&ys(A),Te=q?Ns(A,P):void 0,ze=q?Cs(A):void 0,Ge=q?Te==="device_code":ae,ce=N.isAuthenticating||R.isPending,Ee=d.trim(),Ce=g.trim(),Le=b.trim(),ke=x||N.error,Re=u.useCallback(async()=>{const M=await fetch("/api/settings/auth/antigravity-risk");if(!M.ok)throw new Error("Failed to load power user mode setting");return(await M.json()).antigravityAckBypass===!0},[]),be=u.useCallback(async({pendingMessage:M=null,disabledMessage:ue=null}={})=>{const We=++E.current;o(!0),M!==null&&m(M);try{const Oe=await Re();return E.current!==We||(y(Oe),ue?m(Oe?null:ue):M!==null&&m(null)),Oe}catch{return E.current!==We||(y(!1),m(ue??j("addAccountDialog.powerUserLoadFailed")),F.current||(F.current=!0,V.error(j("addAccountDialog.powerUserLoadFailed")))),!1}finally{E.current===We&&o(!1)}},[Re,j]),Se=()=>{l(""),h(""),v(!1),m(null),w(""),k(Qe),y(!1),o(!1),T(At),D(""),H(""),O(Pt),E.current+=1,F.current=!1,z.current=!1,a()};u.useEffect(()=>{t&&(w(""),k(Qe),m(null))},[s,t]),u.useEffect(()=>()=>{E.current+=1},[]),u.useEffect(()=>{if(!t||!Q){E.current+=1,y(!1),o(!1);return}be()},[t,s,Q,be]),u.useEffect(()=>{if(!t||s!=="agy"||!N.error||!S)return;const M=N.error.toLowerCase();(M.includes("agy_risk_ack_required")||M.includes("responsibility acknowledgement")||M.includes("responsibility checklist"))&&be({pendingMessage:j("addAccountDialog.powerUserLoading"),disabledMessage:j("addAccountDialog.powerUserUnavailableRetry")})},[N.error,t,S,s,be,j]),u.useEffect(()=>{!N.isAuthenticating&&!N.error&&N.provider===null&&t&&z.current&&(z.current=!1,(async()=>{try{const ue=await lt(s,void 0,i);ue.success&&ue.presetName&&c&&V.success(`Applied "${ue.presetName}" preset`)}catch{}Se()})())},[N.isAuthenticating,N.error,N.provider]);const Ae=()=>{N.cancelAuth(),Se()},Ve=async()=>{N.authUrl&&(await navigator.clipboard.writeText(N.authUrl),v(!0),setTimeout(()=>v(!1),2e3))},Be=()=>{r.trim()&&N.submitCallback(r.trim())},$e=()=>{if(re){m(j("addAccountDialog.powerUserLoading"));return}if(te&&!oe){m("Complete all Antigravity responsibility steps before authenticating this provider.");return}if(ee&&!se){m(`Type "${Ue}" to acknowledge the account safety warning before authenticating this provider.`);return}if(m(null),U&&!Ce){m("IDC Start URL is required for Kiro IAM Identity Center login.");return}z.current=!0,N.startAuth(s,{nickname:Ee||void 0,kiroMethod:q?A:void 0,kiroIDCStartUrl:U?Ce:void 0,kiroIDCRegion:U&&Le?Le:void 0,kiroIDCFlow:U?P:void 0,flowType:q?Te:void 0,startEndpoint:q?ze:void 0,riskAcknowledgement:te?{version:ua,reviewedIssue509:I.reviewedIssue509,understandsBanRisk:I.understandsBanRisk,acceptsFullResponsibility:I.acceptsFullResponsibility,typedPhrase:I.typedPhrase}:void 0})},_=()=>{z.current=!0,R.mutate(void 0,{onSuccess:async()=>{const M=await lt("kiro",void 0,i);M.success&&M.presetName&&c&&V.success(`Applied "${M.presetName}" preset`),Se()}})},X=M=>{M||Ae()},W=N.isAuthenticating;return e.jsx(pt,{open:t,onOpenChange:X,children:e.jsxs(xt,{className:"sm:max-w-md",onInteractOutside:M=>{W&&M.preventDefault()},children:[e.jsxs(ht,{children:[e.jsx(gt,{children:j("addAccountDialog.title",{displayName:n})}),e.jsx(Wt,{children:j(q?"addAccountDialog.descKiro":Ge?"addAccountDialog.descDeviceCode":"addAccountDialog.descOauth")})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[te&&!W&&e.jsx(qa,{value:I,onChange:M=>{k(M),m(null)},disabled:ce}),Q&&S&&!W&&e.jsxs("div",{className:"rounded-lg border border-amber-400/35 bg-amber-50/70 p-3 text-xs text-amber-900 dark:border-amber-800/60 dark:bg-amber-950/25 dark:text-amber-100",children:[e.jsxs("div",{className:"mb-1.5 flex items-center gap-1.5 font-semibold",children:[e.jsx(es,{className:"h-3.5 w-3.5"}),j("addAccountDialog.powerUserEnabled")]}),j("addAccountDialog.powerUserSkipped")]}),ee&&!W&&e.jsx(ct,{showAcknowledgement:!0,acknowledgementPhrase:Ue,acknowledgementText:L,onAcknowledgementTextChange:M=>{w(M),m(null)},disabled:ce}),q&&!W&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(Z,{htmlFor:"kiro-auth-method",children:j("addAccountDialog.authMethod")}),e.jsxs(Ze,{value:A,onValueChange:M=>{T(M),m(null)},children:[e.jsx(et,{id:"kiro-auth-method",children:e.jsx(tt,{placeholder:j("addAccountDialog.selectKiroAuthMethod")})}),e.jsx(st,{children:ws.map(M=>e.jsx(Pe,{value:M.id,children:M.label},M.id))})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:f.description}),ne&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["If your browser does not return automatically after login, CCS can accept the final",e.jsx("span",{className:"mx-1 rounded bg-muted px-1.5 py-0.5 font-mono text-[11px]",children:"kiro://..."}),"callback URL in the next step."]})]}),U&&!W&&e.jsxs("div",{className:"space-y-4 rounded-lg border border-border/60 bg-muted/20 p-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Z,{htmlFor:"kiro-idc-start-url",children:"IDC Start URL"}),e.jsx(me,{id:"kiro-idc-start-url",value:g,onChange:M=>{D(M.target.value),m(null)},placeholder:"https://d-xxx.awsapps.com/start",disabled:ce}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Required for organization IAM Identity Center login."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Z,{htmlFor:"kiro-idc-region",children:"IDC Region"}),e.jsx(me,{id:"kiro-idc-region",value:b,onChange:M=>{H(M.target.value),m(null)},placeholder:"us-east-1",disabled:ce}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional. Leave blank to use the upstream default region."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Z,{htmlFor:"kiro-idc-flow",children:"IDC Flow"}),e.jsxs(Ze,{value:P,onValueChange:M=>{O(M),m(null)},children:[e.jsx(et,{id:"kiro-idc-flow",children:e.jsx(tt,{placeholder:"{/* TODO i18n: missing key */}Select IDC flow"})}),e.jsxs(st,{children:[e.jsx(Pe,{value:"authcode",children:"Authorization Code"}),e.jsx(Pe,{value:"device",children:"Device Code"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Auth Code opens a browser and may need the final callback URL pasted back. Device Code shows a verification code instead."})]})]}),!W&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(Z,{htmlFor:"nickname",children:j("addAccountDialog.nicknameOptional")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Me,{className:"w-4 h-4 text-muted-foreground"}),e.jsx(me,{id:"nickname",value:d,onChange:M=>{l(M.target.value),m(null)},placeholder:j("addAccountDialog.nicknamePlaceholder"),disabled:ce,className:"flex-1"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:j("addAccountDialog.nicknameOptionalHint")})]}),W&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-center",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.jsx(ie,{className:"w-4 h-4 inline mr-2 animate-spin"}),j("addAccountDialog.waitingForAuth")]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:N.isDeviceCodeFlow?j("addAccountDialog.deviceCodeHint"):ne?"Complete sign-in in your browser. If it does not return automatically, paste the final kiro:// callback URL below.":j("addAccountDialog.browserHint")})]}),N.authUrl&&!N.isDeviceCodeFlow&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Z,{className:"text-xs",children:j("addAccountDialog.openUrlLabel")}),e.jsxs("div",{className:"p-3 bg-muted rounded-md",children:[e.jsx("p",{className:"text-xs text-muted-foreground break-all font-mono line-clamp-3",children:N.authUrl}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(K,{variant:"outline",size:"sm",onClick:Ve,children:p?e.jsxs(e.Fragment,{children:[e.jsx(je,{className:"w-3 h-3 mr-1"}),j("addAccountDialog.copied")]}):e.jsxs(e.Fragment,{children:[e.jsx(Zt,{className:"w-3 h-3 mr-1"}),j("addAccountDialog.copy")]})}),e.jsxs(K,{variant:"outline",size:"sm",onClick:()=>{if(!N.authUrl)return;const M=window.open(N.authUrl,"_blank");(!M||M.closed||typeof M.closed>"u")&&V.warning(j("addAccountDialog.popupBlocked"),{duration:5e3})},children:[e.jsx(ve,{className:"w-3 h-3 mr-1"}),j("addAccountDialog.open")]})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Z,{htmlFor:"callback-url",className:"text-xs",children:ne?"Browser did not return? Paste the final kiro:// callback URL:":j("addAccountDialog.redirectPasteLabel")}),e.jsx(me,{id:"callback-url",value:r,onChange:M=>h(M.target.value),placeholder:ne?"kiro://kiro.kiroAgent/authenticate-success?code=...&state=...":j("addAccountDialog.callbackPlaceholder"),className:"font-mono text-xs"}),e.jsx(K,{variant:"secondary",size:"sm",onClick:Be,disabled:!r.trim()||N.isSubmittingCallback,children:N.isSubmittingCallback?e.jsxs(e.Fragment,{children:[e.jsx(ie,{className:"w-3 h-3 mr-1 animate-spin"}),j("addAccountDialog.submitting")]}):j("addAccountDialog.submitCallback")})]})]}),!N.authUrl&&!N.isDeviceCodeFlow&&e.jsx("p",{className:"text-xs text-center text-muted-foreground",children:ne?"Preparing the Kiro sign-in URL. If it does not open automatically, it will appear here shortly.":j("addAccountDialog.preparingUrl")})]}),ke&&e.jsx("p",{className:"text-xs text-center text-destructive",children:ke}),R.isPending&&e.jsxs("p",{className:"text-sm text-center text-muted-foreground",children:[e.jsx(ie,{className:"w-4 h-4 inline mr-2 animate-spin"}),j("addAccountDialog.importingToken")]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-2",children:[e.jsx(K,{variant:"ghost",onClick:Ae,children:j("addAccountDialog.cancel")}),q&&!W&&e.jsx(K,{variant:"outline",onClick:_,disabled:ce,children:R.isPending?e.jsxs(e.Fragment,{children:[e.jsx(ie,{className:"w-4 h-4 mr-2 animate-spin"}),j("addAccountDialog.importing")]}):e.jsxs(e.Fragment,{children:[e.jsx(aa,{className:"w-4 h-4 mr-2"}),j("addAccountDialog.importFromIde")]})}),!W&&e.jsxs(K,{onClick:$e,disabled:ce||re||te&&!oe||ee&&!se,children:[e.jsx(ve,{className:"w-4 h-4 mr-2"}),j("addAccountDialog.authenticate")]})]})]})]})})}const Ga=["ANTHROPIC_BASE_URL","ANTHROPIC_AUTH_TOKEN"];function Va(t){const a=t?.env||{};return Ga.filter(s=>!a[s]?.trim())}function Ba(t,a){const[s,n]=u.useState(null),[i,c]=u.useState(!1),d=ut(),{data:l,isLoading:r,refetch:h}=qt({queryKey:["settings",t],queryFn:async()=>{const P=await fetch(`/api/settings/${t}/raw`);return P.ok?P.json():{profile:t,settings:{env:{}},mtime:Date.now(),path:`~/.ccs/profiles/${t}/settings.json`}}}),p=l?.settings,v=u.useMemo(()=>s!==null?s:p?JSON.stringify(p,null,2):`{
|
|
2
|
-
"env": {}
|
|
3
|
-
}`,[s,p]),x=u.useCallback(P=>{n(P)},[]),m=u.useMemo(()=>{try{return JSON.parse(v)}catch{return p||{env:{}}}},[v,p]),L=m?.env?.ANTHROPIC_MODEL,w=m?.env?.ANTHROPIC_DEFAULT_OPUS_MODEL,I=m?.env?.ANTHROPIC_DEFAULT_SONNET_MODEL,k=m?.env?.ANTHROPIC_DEFAULT_HAIKU_MODEL,S=u.useMemo(()=>ks(m?.env||{}),[m]),y=u.useCallback((P,O)=>Ss(P,O,{supportsExtendedContext:j=>Aa(t,j,a)}),[a,t]),C=u.useCallback((P,O)=>{const j={...m?.env||{},[P]:O},z=Mt(P)?y(j,S):j;delete z.CCS_EXTENDED_CONTEXT;const E={...m,env:z};n(JSON.stringify(E,null,2))},[y,m,S]),o=u.useCallback(P=>{const O=m?.env||{},j=y(O,P);delete j.CCS_EXTENDED_CONTEXT;const z={...m,env:j};n(JSON.stringify(z,null,2))},[y,m]),A=u.useCallback(P=>{const O={...m?.env||{},...P},z=Object.keys(P).some(Mt)?y(O,S):O;delete z.CCS_EXTENDED_CONTEXT;const E={...m,env:z};n(JSON.stringify(E,null,2))},[y,m,S]),T=u.useMemo(()=>{try{return JSON.parse(v),!0}catch{return!1}},[v]),g=u.useMemo(()=>s===null?!1:s!==JSON.stringify(p,null,2),[s,p]),D=u.useMemo(()=>Va(m),[m]),b=us({mutationFn:async()=>{const P=JSON.parse(v),O=await fetch(`/api/settings/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:P,expectedMtime:l?.mtime})});if(O.status===409)throw new Error("CONFLICT");if(!O.ok)throw new Error("Failed to save");return O.json()},onSuccess:P=>{d.invalidateQueries({queryKey:["settings",t]}),n(null),P?.warning?V.success(le.t("settings.saved"),{description:P.warning}):V.success(le.t("settings.saved"))},onError:P=>{P.message==="CONFLICT"?c(!0):V.error(P.message)}}),H=async P=>{c(!1),P?(await h(),b.mutate()):n(null)};return{data:l,isLoading:r,refetch:h,rawJsonContent:v,rawJsonEdits:s,isRawJsonValid:T,hasChanges:g,currentSettings:m,currentModel:L,opusModel:w,sonnetModel:I,haikuModel:k,extendedContextEnabled:S,toggleExtendedContext:o,handleRawJsonChange:x,updateEnvValue:C,updateEnvValues:A,saveMutation:{mutate:()=>b.mutate(),isPending:b.isPending},conflictDialog:i,setConflictDialog:c,handleConflictResolve:H,missingRequiredFields:D}}const $a=/-(medium|high|xhigh)$/i;function Wa(t){if(!t)return;const a=t.trim().match($a);if(a?.[1])return a[1].toLowerCase()}function Qa(t,a){if(!t)return null;const s=Wa(t);return s?{label:`Pinned ${s}`,explicit:!0}:{label:"Auto effort",explicit:!1}}function Ja({label:t}){return e.jsx(G,{variant:"outline",className:"text-[9px] h-4 px-1",children:t})}function _e({modelId:t}){const a=Qa(t);return a?e.jsx(G,{variant:a.explicit?"secondary":"outline",className:"text-[9px] h-4 px-1 uppercase",children:a.label}):null}function Ft(t,a){if(!t)return"";if(!a?.prefix)return t;const s=`${a.prefix}/`;return t.startsWith(s)?t.slice(s.length):t}function he(t,a){return a?.recommendedModelId??t}function fe({label:t,description:a,value:s,onChange:n,catalog:i,allModels:c,routing:d,disabled:l}){const{t:r}=B(),h=i?.provider==="codex",p=u.useMemo(()=>kt(i,c),[c,i]),v=u.useMemo(()=>Sa(i?.provider??"",i,c),[c,i]),x=new Set(p.map(o=>o.id)),m=u.useMemo(()=>new Map((d?.models??[]).map(o=>[o.modelId.toLowerCase(),o])),[d]),L=u.useMemo(()=>new Set(p.map(o=>he(o.id,m.get(o.id.toLowerCase())))),[p,m]),w=u.useMemo(()=>m.get(Ft(s,d).toLowerCase()),[d,m,s]),I=p.map(o=>({value:he(o.id,m.get(o.id.toLowerCase())),groupKey:"recommended",searchText:`${o.id} ${o.name} ${m.get(o.id.toLowerCase())?.recommendedModelId??""}`,keywords:[o.tier??"",i?.provider??""],triggerContent:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:he(o.id,m.get(o.id.toLowerCase()))}),m.get(o.id.toLowerCase())?.pinnedAvailable?e.jsx(G,{variant:"secondary",className:"text-[9px] h-4 px-1 uppercase",children:m.get(o.id.toLowerCase())?.prefix}):null,h&&e.jsx(_e,{modelId:o.id})]}),itemContent:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:he(o.id,m.get(o.id.toLowerCase()))}),o.tier==="paid"&&e.jsx(Ja,{label:r("providerModelSelector.paid")}),m.get(o.id.toLowerCase())?.unprefixedStatus==="shadowed"?e.jsx(G,{variant:"outline",className:"text-[9px] h-4 px-1",children:r("providerModelSelector.shadowed")}):null,m.get(o.id.toLowerCase())?.unprefixedStatus==="prefix-only"?e.jsx(G,{variant:"outline",className:"text-[9px] h-4 px-1",children:r("providerModelSelector.prefixOnly")}):null,h&&e.jsx(_e,{modelId:o.id})]})})),k=v.filter(o=>!x.has(o.id)).filter(o=>!L.has(he(o.id,m.get(o.id.toLowerCase())))).map(o=>({value:he(o.id,m.get(o.id.toLowerCase())),groupKey:"all",searchText:`${o.id} ${m.get(o.id.toLowerCase())?.recommendedModelId??""}`,keywords:[o.owned_by],triggerContent:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:he(o.id,m.get(o.id.toLowerCase()))}),m.get(o.id.toLowerCase())?.pinnedAvailable?e.jsx(G,{variant:"secondary",className:"text-[9px] h-4 px-1 uppercase",children:m.get(o.id.toLowerCase())?.prefix}):null,h&&e.jsx(_e,{modelId:o.id})]}),itemContent:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:he(o.id,m.get(o.id.toLowerCase()))}),m.get(o.id.toLowerCase())?.unprefixedStatus==="shadowed"?e.jsx(G,{variant:"outline",className:"text-[9px] h-4 px-1",children:r("providerModelSelector.shadowed")}):null,m.get(o.id.toLowerCase())?.unprefixedStatus==="prefix-only"?e.jsx(G,{variant:"outline",className:"text-[9px] h-4 px-1",children:r("providerModelSelector.prefixOnly")}):null,h&&e.jsx(_e,{modelId:o.id})]})})),S=!!s&&!I.some(o=>o.value===s)&&!k.some(o=>o.value===s),y=s?{value:s,groupKey:"current",searchText:s,triggerContent:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:s}),e.jsx(G,{variant:"outline",className:"text-[9px] h-4 px-1",children:r("providerModelSelector.current")})]}),itemContent:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:s}),e.jsx(G,{variant:"outline",className:"text-[9px] h-4 px-1",children:r("providerModelSelector.current")})]})}:null,C=I.length+k.length>0;return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium",children:t}),a&&e.jsx("p",{className:"text-[10px] text-muted-foreground",children:a})]}),e.jsx(pa,{value:s||void 0,onChange:n,disabled:l,placeholder:r("providerModelSelector.selectModel"),searchPlaceholder:r("searchableSelect.searchModels"),emptyText:r(C?"searchableSelect.noResults":"providerModelSelector.noModelsAvailable"),triggerClassName:"h-9",groups:[...S&&y?[{key:"current",label:e.jsx("span",{className:"text-xs text-muted-foreground",children:r("providerModelSelector.currentValue")})}]:[],{key:"recommended",label:e.jsx("span",{className:"text-xs text-primary",children:r("providerModelSelector.recommended")})},...k.length>0?[{key:"all",label:e.jsx("span",{className:"text-xs text-muted-foreground",children:r("providerModelSelector.allModelsCount",{count:k.length})})}]:[]],options:[...S&&y?[y]:[],...I,...k]}),w?e.jsxs("div",{className:J("rounded-md border px-2.5 py-2 text-[11px]",w.unprefixedStatus==="safe"?"border-border/70 bg-muted/25 text-muted-foreground":"border-amber-300/60 bg-amber-50 text-amber-900 dark:border-amber-500/30 dark:bg-amber-950/25 dark:text-amber-100"),children:[e.jsxs("div",{className:"font-medium",children:[w.pinnedAvailable?r("providerModelSelector.preferredPinnedModel"):r("providerModelSelector.pinnedRouteStatus")," ",e.jsx("code",{children:w.pinnedAvailable?w.recommendedModelId:w.pinnedModelId})]}),e.jsx("p",{className:"mt-1 leading-5",children:w.summary})]}):null,s&&!w&&Ft(s,d)!==s?e.jsx("div",{className:"rounded-md border border-amber-300/60 bg-amber-50 px-2.5 py-2 text-[11px] text-amber-900 dark:border-amber-500/30 dark:bg-amber-950/25 dark:text-amber-100",children:r("providerModelSelector.pinnedModelNotAdvertised",{model:s})}):null]})}function Ut(t,a){const s=n=>a?.models.find(c=>c.modelId.toLowerCase()===n.toLowerCase())?.recommendedModelId??n;return{default:s(t.default),opus:s(t.opus),sonnet:s(t.sonnet),haiku:s(t.haiku)}}function Xa({open:t,onClose:a,currentValues:s,onApply:n,onSave:i,isSaving:c,catalog:d,allModels:l,routing:r}){const{t:h}=B(),[p,v]=u.useState(Ut(s,r)),[x,m]=u.useState(""),L=w=>{w?(v(Ut(s,r)),m("")):a()};return e.jsx(pt,{open:t,onOpenChange:L,children:e.jsxs(xt,{className:"sm:max-w-md",children:[e.jsx(ht,{children:e.jsxs(gt,{className:"flex items-center gap-2",children:[e.jsx(De,{className:"w-4 h-4"}),h("customPresetDialog.title")]})}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Z,{htmlFor:"preset-name",children:h("customPresetDialog.presetNameOptional")}),e.jsx(me,{id:"preset-name",value:x,onChange:w=>m(w.target.value),placeholder:h("customPresetDialog.presetNamePlaceholder"),className:"text-sm"})]}),e.jsx(wt,{}),d?.provider==="codex"&&e.jsxs("p",{className:"text-[11px] text-muted-foreground rounded-md border bg-muted/30 px-2.5 py-2",children:[h("customPresetDialog.codexTipPrefix")," ",e.jsx("code",{children:"-medium"}),", ",e.jsx("code",{children:"-high"}),", and"," ",e.jsx("code",{children:"-xhigh"})," ",h("customPresetDialog.codexTipSuffix")]}),e.jsx(fe,{label:h("customPresetDialog.defaultModel"),description:h("customPresetDialog.defaultModelDesc"),value:p.default,onChange:w=>v({...p,default:w}),catalog:d,allModels:l,routing:r}),e.jsx(fe,{label:h("customPresetDialog.opusModel"),description:h("customPresetDialog.opusModelDesc"),value:p.opus,onChange:w=>v({...p,opus:w}),catalog:d,allModels:l,routing:r}),e.jsx(fe,{label:h("customPresetDialog.sonnetModel"),description:h("customPresetDialog.sonnetModelDesc"),value:p.sonnet,onChange:w=>v({...p,sonnet:w}),catalog:d,allModels:l,routing:r}),e.jsx(fe,{label:h("customPresetDialog.haikuModel"),description:h("customPresetDialog.haikuModelDesc"),value:p.haiku,onChange:w=>v({...p,haiku:w}),catalog:d,allModels:l,routing:r})]}),e.jsxs(As,{className:"gap-2 sm:gap-0",children:[e.jsx(K,{variant:"outline",onClick:a,children:h("customPresetDialog.cancel")}),i&&e.jsxs(K,{variant:"secondary",onClick:()=>i(p,x||void 0),disabled:c||!x.trim(),children:[c?e.jsx(ie,{className:"w-4 h-4 mr-1 animate-spin"}):e.jsx(Nt,{className:"w-4 h-4 mr-1"}),h("customPresetDialog.savePreset")]}),e.jsxs(K,{onClick:()=>n(p,x||void 0),children:[e.jsx(Ie,{className:"w-4 h-4 mr-1"}),h("customPresetDialog.applyPreset")]})]})]})})}function ge({label:t,command:a}){return e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:t}),e.jsxs("div",{className:"mt-1 flex gap-2",children:[e.jsx("code",{className:"flex-1 px-2 py-1.5 bg-muted rounded text-xs font-mono truncate",children:a}),e.jsx(Jt,{value:a,size:"icon",className:"h-6 w-6"})]})]})}function Ya({provider:t,displayName:a,defaultTarget:s,data:n,authStatus:i,supportsModelConfig:c=!1}){const{t:d}=B(),l=s||"claude",r=l==="droid",h=t==="codex",p=l==="claude"?`ccs ${t}`:`ccs ${t} --target claude`,v=`${p} --config`,x=`${p} --auth --add`,m=`${p} --accounts`;return e.jsx(ft,{className:"h-full",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium flex items-center gap-2 mb-3",children:[e.jsx(ts,{className:"w-4 h-4"}),"Provider Information"]}),e.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:d("providerEditor.provider")}),e.jsx("span",{className:"font-mono",children:a})]}),n&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:d("providerEditor.filePath")}),e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs break-all",children:n.path}),e.jsx(Jt,{value:n.path,size:"icon",className:"h-5 w-5"})]})]}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:d("providerEditor.lastModified")}),e.jsx("span",{className:"text-xs",children:new Date(n.mtime).toLocaleString()})]})]}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:d("providerEditor.status")}),i.authenticated?e.jsxs(G,{variant:"outline",className:"w-fit text-green-600 border-green-200 bg-green-50",children:[e.jsx(na,{className:"w-3 h-3 mr-1"}),"Authenticated"]}):e.jsx(G,{variant:"outline",className:"w-fit text-muted-foreground",children:"Not connected"})]}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 text-sm items-center",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:d("providerEditor.defaultTarget")}),e.jsx("span",{className:"font-mono",children:l})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-3",children:d("providerEditor.quickUsage")}),e.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[e.jsx(ge,{label:"Run with prompt",command:`ccs ${t} "your prompt"`}),h&&e.jsxs(e.Fragment,{children:[e.jsx(ge,{label:"Run on native Codex (shortcut)",command:'ccsxp "your prompt"'}),e.jsx(ge,{label:"Run on native Codex (--target)",command:`ccs ${t} --target codex "your prompt"`})]}),e.jsx(ge,{label:r?"Droid alias (explicit)":"Run on Droid",command:`ccs-droid ${t} "your prompt"`}),e.jsx(ge,{label:r?"Override to Claude":"Run on Droid (--target)",command:`ccs ${t} --target ${r?"claude":"droid"} "your prompt"`}),c&&e.jsx(ge,{label:l==="claude"?"Change model":"Change model (Claude target)",command:v}),e.jsx(ge,{label:l==="claude"?"Add account":"Add account (Claude target)",command:x}),e.jsx(ge,{label:l==="claude"?"List accounts":"List accounts (Claude target)",command:m}),l!=="claude"&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"Account and model-management flags stay on Claude target. Codex and Droid runtime launches reject those CLIProxy management commands."})]})]})]})})}function Za({displayName:t,logoProvider:a,provider:s,data:n,isLoading:i,hasChanges:c,isRawJsonValid:d,isSaving:l,isRemoteMode:r,port:h,onRefetch:p,onSave:v}){const{t:x}=B();return e.jsxs("div",{className:"px-6 py-4 border-b bg-background flex items-center justify-between shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(vt,{provider:a||s,size:"lg"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold",children:t}),r&&e.jsxs(G,{variant:"secondary",className:"text-xs gap-1 bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",children:[e.jsx(ss,{className:"w-3 h-3"}),"Remote"]}),h&&e.jsxs(G,{variant:"outline",className:"text-xs gap-1 font-mono",children:[e.jsx(ia,{className:"w-3 h-3"}),":",h]}),!r&&n?.path&&e.jsx(G,{variant:"outline",className:"text-xs",children:n.path.replace(/^.*[\\/]/,"")})]}),r?e.jsx("p",{className:"text-xs text-blue-600 dark:text-blue-400 mt-0.5",children:"Traffic auto-routed to remote server"}):n&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[x("providerEditor.lastModified"),": ",new Date(n.mtime).toLocaleString()]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(K,{variant:"ghost",size:"sm",onClick:p,disabled:i,children:e.jsx(bt,{className:`w-4 h-4 ${i?"animate-spin":""}`})}),e.jsx(K,{size:"sm",onClick:v,disabled:l||!c||!d,children:l?e.jsxs(e.Fragment,{children:[e.jsx(ie,{className:"w-4 h-4 mr-1 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ra,{className:"w-4 h-4 mr-1"}),"Save"]})})]})]})}function en({models:t,provider:a,enabled:s,onToggle:n,disabled:i,className:c}){const{t:d}=B();if(t.length===0)return null;const l=t.some(p=>Dt(p.id)),r=t.some(p=>!Dt(p.id));let h="Compatible mappings stay on standard context unless you turn this on.";return l&&r?h="Gemini-compatible mappings can use 1M automatically. Claude mappings stay plain unless you turn this on.":l&&(h="Gemini-compatible mappings can use 1M by default. Turn this off to keep standard context."),e.jsxs("div",{className:J("rounded-lg border p-3 space-y-2",s?"border-primary/50 bg-primary/5":"border-border bg-muted/30",c),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ie,{className:J("w-4 h-4",s?"text-primary":"text-muted-foreground")}),e.jsx("span",{className:"text-sm font-medium",children:d("extendedContext.extendedContext")}),e.jsx(G,{variant:s?"default":"secondary",className:"text-[10px] h-5 px-1.5",children:"1M tokens"})]}),e.jsx(Xt,{checked:s,onCheckedChange:n,disabled:i})]}),e.jsxs("div",{className:"flex items-start gap-2 text-xs text-muted-foreground",children:[e.jsx(ts,{className:"w-3.5 h-3.5 mt-0.5 shrink-0"}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{children:["Applies the explicit ",e.jsx("code",{children:"[1m]"})," long-context suffix to compatible saved mappings."]}),e.jsx("p",{className:"text-[10px]",children:h}),e.jsxs("p",{className:"text-amber-600 dark:text-amber-500",children:["CCS only saves ",e.jsx("code",{children:"[1m]"}),". Provider pricing and entitlement are separate, and some accounts can still return 429 extra-usage errors for long-context requests."]})]})]})]})}function tn(t,a){const s=t.presetMapping||{default:t.id,opus:t.id,sonnet:t.id,haiku:t.id};return{ANTHROPIC_MODEL:a(s.default),ANTHROPIC_DEFAULT_OPUS_MODEL:a(s.opus),ANTHROPIC_DEFAULT_SONNET_MODEL:a(s.sonnet),ANTHROPIC_DEFAULT_HAIKU_MODEL:a(s.haiku)}}function sn({catalog:t,savedPresets:a,currentModel:s,opusModel:n,sonnetModel:i,haikuModel:c,providerModels:d,routing:l,provider:r,extendedContextEnabled:h,onExtendedContextToggle:p,onApplyPreset:v,onUpdateEnvValue:x,onOpenCustomPreset:m,onDeletePreset:L,isDeletePending:w}){const{t:I}=B(),k=(l?.models??[]).some(g=>g.pinnedAvailable),S=u.useMemo(()=>new Map((l?.models??[]).map(g=>[g.modelId.toLowerCase(),g])),[l]),y=g=>S.get(g.toLowerCase())?.recommendedModelId??g,C=u.useMemo(()=>{if(!t)return[];const g=[s,n,i,c].filter(b=>!!b).map(b=>Ps(b));return[...new Set(g)].map(b=>cs(t.provider,b,t)).filter(b=>!!b?.extendedContext)},[t,s,n,i,c]),o=u.useMemo(()=>kt(t,d),[t,d]),A=u.useMemo(()=>{const g=o.filter(b=>b.presetMapping);return g.length===0?[]:g.some(b=>b.tier==="paid")?[{key:"free",label:"Free Tier",description:"Available on free or paid plans",badgeClassName:"text-[10px] bg-green-100 text-green-700 border-green-200",iconClassName:"text-green-600",models:g.filter(b=>b.tier!=="paid")},{key:"paid",label:"Paid Tier",description:"Requires paid access",badgeClassName:"text-[10px] bg-amber-100 text-amber-700 border-amber-200",iconClassName:"text-amber-700",models:g.filter(b=>b.tier==="paid")}].filter(b=>b.models.length>0):[{key:"default",models:g.slice(0,4)}]},[o]),T=A.length>0||a.length>0;return e.jsxs(e.Fragment,{children:[T&&e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[e.jsx(De,{className:"w-4 h-4"}),"Presets"]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:I("providerEditor.presets")}),e.jsxs("div",{className:"space-y-4",children:[A.map(g=>e.jsxs("div",{children:["label"in g&&g.label&&e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(G,{variant:"outline",className:g.badgeClassName,children:g.label}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:g.description})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:g.models.map(D=>e.jsxs(K,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>v(tn(D,y)),children:[e.jsx(Ie,{className:`w-3 h-3 ${"iconClassName"in g?g.iconClassName:""}`}),D.name]},D.id))})]},g.key)),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.map(g=>e.jsxs("div",{className:"group relative",children:[e.jsxs(K,{variant:"secondary",size:"sm",className:"text-xs h-7 gap-1 pr-6",onClick:()=>{v({ANTHROPIC_MODEL:y(g.default),ANTHROPIC_DEFAULT_OPUS_MODEL:y(g.opus),ANTHROPIC_DEFAULT_SONNET_MODEL:y(g.sonnet),ANTHROPIC_DEFAULT_HAIKU_MODEL:y(g.haiku)})},children:[e.jsx(Nt,{className:"w-3 h-3 fill-current"}),g.name]}),e.jsx(K,{variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-7 w-5 opacity-0 group-hover:opacity-100 hover:text-destructive",onClick:D=>{D.stopPropagation(),L(g.name)},disabled:w,children:e.jsx(yt,{className:"w-3 h-3"})})]},g.name)),e.jsxs(K,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1 border-primary/50 text-primary hover:bg-primary/10 hover:border-primary",onClick:m,children:[e.jsx(as,{className:"w-3 h-3"}),"Custom"]})]})]})]}),e.jsx(wt,{}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-2",children:I("providerEditor.modelMapping")}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Configure which models to use for each tier"}),l?e.jsx("p",{className:"text-[11px] text-muted-foreground mb-3 rounded-md border bg-muted/30 px-2.5 py-2",children:k?e.jsxs(e.Fragment,{children:["Preferred pinned model names use the ",e.jsxs("code",{children:[l.prefix,"/"]})," prefix. Unprefixed names can still resolve to a different backend when providers overlap."]}):e.jsxs(e.Fragment,{children:["Managed pinning for ",e.jsxs("code",{children:[l.prefix,"/"]})," is not currently advertised by the proxy. Unprefixed names may still be ambiguous until prefix repair completes."]})}):null,r==="codex"&&e.jsxs("p",{className:"text-[11px] text-muted-foreground mb-3 rounded-md border bg-muted/30 px-2.5 py-2",children:["Codex tip: suffixes ",e.jsx("code",{children:"-medium"}),", ",e.jsx("code",{children:"-high"}),", and ",e.jsx("code",{children:"-xhigh"})," ","pin reasoning effort. Unsuffixed models use Thinking settings."]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(fe,{label:"Default Model",description:"Used when no specific tier is requested",value:s,onChange:g=>x("ANTHROPIC_MODEL",g),catalog:t,allModels:d,routing:l}),C.length>0&&p&&e.jsx(en,{models:C,provider:r,enabled:h??!1,onToggle:p}),e.jsx(fe,{label:"Opus (Most capable)",description:"For complex reasoning tasks",value:n,onChange:g=>x("ANTHROPIC_DEFAULT_OPUS_MODEL",g),catalog:t,allModels:d,routing:l}),e.jsx(fe,{label:"Sonnet (Balanced)",description:"Balance of speed and capability",value:i,onChange:g=>x("ANTHROPIC_DEFAULT_SONNET_MODEL",g),catalog:t,allModels:d,routing:l}),e.jsx(fe,{label:"Haiku (Fast)",description:"Quick responses for simple tasks",value:c,onChange:g=>x("ANTHROPIC_DEFAULT_HAIKU_MODEL",g),catalog:t,allModels:d,routing:l})]})]})]})}function an(t,a,s){return t?e.jsx(nt,{children:e.jsxs(it,{children:[e.jsx(rt,{asChild:!0,children:e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(da,{className:"w-3 h-3","aria-hidden":"true"}),e.jsx("span",{className:J("font-mono max-w-[180px] truncate",a&&mt),title:t,children:t})]})}),e.jsx(ot,{side:"bottom",children:e.jsx("p",{className:"text-xs",children:s("providerEditor.gcpProjectIdReadonly")})})]})}):e.jsx(nt,{children:e.jsxs(it,{children:[e.jsx(rt,{asChild:!0,children:e.jsxs("div",{className:"flex items-center gap-1 text-xs text-amber-600 dark:text-amber-500",children:[e.jsx(qe,{className:"w-3 h-3","aria-label":"Warning"}),e.jsx("span",{children:s("providerEditor.projectIdNA")})]})}),e.jsx(ot,{side:"bottom",className:"max-w-[250px]",children:e.jsxs("div",{className:"text-xs space-y-1",children:[e.jsx("p",{className:"font-medium text-amber-600",children:s("providerEditor.missingProjectId")}),e.jsx("p",{children:s("providerEditor.missingProjectIdHint")})]})})]})})}function nn({account:t,onSetDefault:a,onRemove:s,onPauseToggle:n,isRemoving:i,isPausingAccount:c,privacyMode:d,showQuota:l,selectable:r,selected:h,onSelectChange:p}){const{t:v}=B(),x=t.provider.toLowerCase(),{data:m}=Ms(l),{data:L,isLoading:w}=Ds(x,t.id,l),I=Is(m,t)?.lastUsedAt,k=r||n?e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[r&&e.jsx("button",{type:"button",onClick:()=>p?.(!h),className:J("flex items-center justify-center w-5 h-5 rounded border-2 transition-colors shrink-0",h?"bg-primary border-primary text-primary-foreground":"border-muted-foreground/30 hover:border-primary/50"),"aria-label":h?"Deselect account":"Select account",children:h&&e.jsx(je,{className:"w-3 h-3"})}),n&&e.jsx(nt,{children:e.jsxs(it,{children:[e.jsx(rt,{asChild:!0,children:e.jsx(K,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:()=>n(!t.paused),disabled:c,children:c?e.jsx(ie,{className:"w-4 h-4 animate-spin"}):t.paused?e.jsx(ns,{className:"w-4 h-4 text-emerald-500"}):e.jsx(is,{className:"w-4 h-4 text-muted-foreground hover:text-foreground"})})}),e.jsx(ot,{side:"top",children:t.paused?"Resume account":"Pause account"})]})})]}):void 0,S=e.jsxs(Ts,{children:[e.jsx(Es,{asChild:!0,children:e.jsx(K,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",children:e.jsx(oa,{className:"w-4 h-4"})})}),e.jsxs(Ls,{align:"end",children:[!t.isDefault&&e.jsxs(It,{onClick:a,children:[e.jsx(Nt,{className:"w-4 h-4 mr-2"}),"Set as default"]}),e.jsxs(It,{className:"text-destructive focus:text-destructive",onClick:s,disabled:i,children:[e.jsx(rs,{className:"w-4 h-4 mr-2"}),i?"Removing...":"Remove account"]})]})]});return e.jsx("div",{className:J("rounded-lg border p-3 transition-colors overflow-hidden",t.isDefault?"border-primary/30 bg-primary/5":"border-border hover:bg-muted/30",t.paused&&"opacity-75",h&&"ring-2 ring-primary/50 bg-primary/5"),children:e.jsx(Rs,{mode:"detailed",provider:t.provider,accountId:t.id,email:t.email,displayEmail:t.email||t.id,tokenFile:t.tokenFile,tier:t.tier,isDefault:t.isDefault,paused:t.paused,privacyMode:d,showQuota:l,quota:L,quotaLoading:w,runtimeLastUsed:I,beforeIdentity:k,headerEnd:S,bodySlot:t.provider==="agy"?an(t.projectId,d,v):null,quotaInsetClassName:"pl-11"})})}function rn({selectedCount:t,onPauseSelected:a,onResumeSelected:s,onClearSelection:n,isPausing:i,isResuming:c}){if(t<1)return null;const d=i||c;return e.jsxs("div",{className:"flex items-center gap-3 p-2 bg-muted/50 rounded-lg border mt-2",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:[t," selected"]}),e.jsx(K,{variant:"ghost",size:"sm",className:"text-xs h-6 px-2",onClick:n,disabled:d,children:"Clear"}),e.jsxs("div",{className:"flex gap-2 ml-auto",children:[e.jsxs(K,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:a,disabled:d,children:[i?e.jsx(ie,{className:"w-3 h-3 animate-spin"}):e.jsx(is,{className:"w-3 h-3"}),"Pause Selected"]}),e.jsxs(K,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:s,disabled:d,children:[c?e.jsx(ie,{className:"w-3 h-3 animate-spin"}):e.jsx(ns,{className:"w-3 h-3"}),"Resume Selected"]})]})]})}function on({accounts:t,onAddAccount:a,onSetDefault:s,onRemoveAccount:n,onPauseToggle:i,onSoloMode:c,onBulkPause:d,onBulkResume:l,isRemovingAccount:r,isPausingAccount:h,isSoloingAccount:p,isBulkPausing:v,isBulkResuming:x,privacyMode:m,showQuota:L,isKiro:w,kiroNoIncognito:I,onKiroNoIncognitoChange:k,kiroSettingsLoading:S}){const{t:y}=B(),[C,o]=u.useState(new Set),A=u.useMemo(()=>new Set(t.map(N=>N.id)),[t]),T=u.useMemo(()=>new Set([...C].filter(N=>A.has(N))),[C,A]),g=!!(d&&l),D=T.size,b=t.length>0&&T.size===t.length,H=T.size>0&&T.size<t.length,P=u.useCallback(N=>{o(R=>{const q=new Set(R);return q.has(N)?q.delete(N):q.add(N),q})},[]),O=u.useCallback(()=>{o(new Set(t.map(N=>N.id)))},[t]),j=u.useCallback(()=>{o(new Set)},[]),z=u.useCallback(()=>{b?j():O()},[b,O,j]),E=u.useCallback(()=>{d&&T.size>0&&(d(Array.from(T)),o(new Set))},[d,T]),F=u.useCallback(()=>{l&&T.size>0&&(l(Array.from(T)),o(new Set))},[l,T]);return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("h3",{className:"text-sm font-medium flex items-center gap-2",children:[g&&t.length>0&&e.jsx(Ke,{checked:b,onCheckedChange:z,"aria-label":"Select all accounts",className:H?"data-[state=checked]:bg-primary/50":"",...H?{"data-state":"indeterminate"}:{}}),e.jsx(Me,{className:"w-4 h-4"}),"Accounts",t.length>0&&e.jsx(G,{variant:"secondary",className:"text-xs",children:t.length})]}),e.jsxs(K,{variant:"default",size:"sm",className:"h-7 text-xs gap-1",onClick:a,children:[e.jsx(as,{className:"w-3 h-3"}),"Add"]})]}),g&&D>0&&e.jsx(rn,{selectedCount:D,onPauseSelected:E,onResumeSelected:F,onClearSelection:j,isPausing:!!v,isResuming:!!x}),t.length>0?e.jsx("div",{className:"space-y-2",children:t.map(N=>e.jsx(nn,{account:N,onSetDefault:()=>s(N.id),onRemove:()=>n(N.id),onPauseToggle:i?R=>i(N.id,R):void 0,onSoloMode:c?()=>c(N.id):void 0,isRemoving:r,isPausingAccount:h,isSoloingAccount:p,privacyMode:m,showQuota:L,selectable:g,selected:T.has(N.id),onSelectChange:()=>P(N.id)},N.id))}):e.jsxs("div",{className:"py-6 text-center text-muted-foreground bg-muted/30 rounded-lg border border-dashed",children:[e.jsx(Me,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:y("providerEditor.noAccountsConnected")}),e.jsx("p",{className:"text-xs opacity-70",children:y("providerEditor.addAccountToStart")})]}),w&&k&&e.jsx("div",{className:"mt-3 pt-3 border-t border-dashed",children:e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(ss,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:y("providerEditor.useIncognito")})]}),e.jsx(Xt,{checked:!I,onCheckedChange:N=>k(!N),disabled:S,className:"scale-90"})]})})]})}function dn({provider:t,catalog:a,savedPresets:s,currentModel:n,opusModel:i,sonnetModel:c,haikuModel:d,providerModels:l,routing:r,extendedContextEnabled:h,onExtendedContextToggle:p,onApplyPreset:v,onUpdateEnvValue:x,onOpenCustomPreset:m,onDeletePreset:L,isDeletePending:w,accounts:I,onAddAccount:k,onSetDefault:S,onRemoveAccount:y,onPauseToggle:C,onSoloMode:o,onBulkPause:A,onBulkResume:T,isRemovingAccount:g,isPausingAccount:D,isSoloingAccount:b,isBulkPausing:H,isBulkResuming:P,privacyMode:O,isRemoteMode:j}){const z=t.toLowerCase(),E=(Os.includes(z)||["anthropic","antigravity","gemini-cli","copilot","github-copilot"].includes(z))&&!j,F=t==="kiro",[N,R]=u.useState(!0),[q,Q]=u.useState(!0),[ee,te]=u.useState(!1),re=u.useCallback(async()=>{if(F)try{Q(!0);const ae=(await Fe.config.get()).cliproxy;R(ae?.kiro_no_incognito??!0)}catch{R(!0)}finally{Q(!1)}},[F]),oe=u.useCallback(async se=>{R(se),te(!0);try{const ae=await Fe.config.get(),f=ae.cliproxy??{};await Fe.config.update({...ae,cliproxy:{...f,kiro_no_incognito:se}})}catch{R(!se)}finally{te(!1)}},[]);return u.useEffect(()=>{re()},[re]),e.jsx(ft,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsx(sn,{catalog:a,savedPresets:s,currentModel:n,opusModel:i,sonnetModel:c,haikuModel:d,providerModels:l,routing:r,provider:t,extendedContextEnabled:h,onExtendedContextToggle:p,onApplyPreset:v,onUpdateEnvValue:x,onOpenCustomPreset:m,onDeletePreset:L,isDeletePending:w}),e.jsx(wt,{}),e.jsx(on,{accounts:I,onAddAccount:k,onSetDefault:S,onRemoveAccount:y,onPauseToggle:C,onSoloMode:o,onBulkPause:A,onBulkResume:T,isRemovingAccount:g,isPausingAccount:D,isSoloingAccount:b,isBulkPausing:H,isBulkResuming:P,privacyMode:O,showQuota:E,isKiro:F,kiroNoIncognito:N,onKiroNoIncognitoChange:oe,kiroSettingsLoading:q||ee})]})})}function Kt({provider:t,displayName:a,authStatus:s,catalog:n,routing:i,logoProvider:c,baseProvider:d,isRemoteMode:l,port:r,defaultTarget:h,topNotice:p,onAddAccount:v,onSetDefault:x,onRemoveAccount:m,onPauseToggle:L,onSoloMode:w,onBulkPause:I,onBulkResume:k,isRemovingAccount:S,isPausingAccount:y,isSoloingAccount:C,isBulkPausing:o,isBulkResuming:A}){const[T,g]=u.useState(!1),{privacyMode:D}=$t(),{t:b}=B(),{data:H}=_s(),{data:P}=Fs(t),O=Us(),j=Ks(),z=d||t,E=z.toLowerCase()==="agy",F=u.useMemo(()=>{const _=P?.presets||[];return E?_.filter(X=>!de(X.default)&&!de(X.opus)&&!de(X.sonnet)&&!de(X.haiku)):_},[E,P?.presets]),N=u.useMemo(()=>{if(!H?.models)return[];const X={gemini:["google"],agy:["antigravity"],codex:["openai"],qwen:["alibaba","qwen"],iflow:["iflow"],kiro:["kiro","aws"],ghcp:["github","copilot"],kimi:["kimi","moonshot"]}[z.toLowerCase()]||[z.toLowerCase()];return H.models.filter(W=>X.some(M=>W.owned_by.toLowerCase().includes(M))?E?!de(W.id):!0:!1)},[E,H,z]),R=(d||t).toLowerCase(),{data:q,isLoading:Q,refetch:ee,rawJsonContent:te,rawJsonEdits:re,isRawJsonValid:oe,hasChanges:se,currentModel:ae,opusModel:f,sonnetModel:U,haikuModel:ne,extendedContextEnabled:Te,toggleExtendedContext:ze,handleRawJsonChange:Ge,updateEnvValue:ce,updateEnvValues:Ee,saveMutation:Ce,conflictDialog:Le,handleConflictResolve:ke,missingRequiredFields:Re}=Ba(t,n),be=u.useMemo(()=>(s.accounts||[]).map(_=>({..._,provider:_.provider||d||t})),[s.accounts,d,t]),{data:Se}=qt({queryKey:["auth-tokens-raw"],queryFn:async()=>{const _=await fetch("/api/settings/auth/tokens/raw");return _.ok?_.json():{apiKey:{value:"ccs-internal-managed"}}},staleTime:6e4}),Ae=Se?.apiKey?.value??"ccs-internal-managed",Ve=_=>{if(E&&[_.ANTHROPIC_MODEL,_.ANTHROPIC_DEFAULT_OPUS_MODEL,_.ANTHROPIC_DEFAULT_SONNET_MODEL,_.ANTHROPIC_DEFAULT_HAIKU_MODEL].some(W=>typeof W=="string"&&de(W))){V.error(b("providerEditor.agyDenylist"));return}Ee({ANTHROPIC_BASE_URL:`http://127.0.0.1:${r??dt}/api/provider/${R}`,ANTHROPIC_AUTH_TOKEN:Ae,..._}),V.success(`Applied "${_.ANTHROPIC_MODEL?.split("/").pop()||"preset"}" preset`)},Be=(_,X)=>{if(E&&[_.default,_.opus,_.sonnet,_.haiku].some(M=>de(M))){V.error(b("providerEditor.agyDenylist"));return}Ee({ANTHROPIC_BASE_URL:`http://127.0.0.1:${r??dt}/api/provider/${R}`,ANTHROPIC_AUTH_TOKEN:Ae,ANTHROPIC_MODEL:_.default,ANTHROPIC_DEFAULT_OPUS_MODEL:_.opus,ANTHROPIC_DEFAULT_SONNET_MODEL:_.sonnet,ANTHROPIC_DEFAULT_HAIKU_MODEL:_.haiku}),V.success(`Applied ${X?`"${X}"`:"custom"} preset`),g(!1)},$e=(_,X)=>{if(!X){V.error(le.t("commonToast.enterPresetName"));return}if(E&&[_.default,_.opus,_.sonnet,_.haiku].some(W=>de(W))){V.error(b("providerEditor.agyDenylist"));return}O.mutate({profile:t,data:{name:X,..._}}),g(!1)};return e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx(Za,{provider:t,displayName:a,logoProvider:c,data:q,isLoading:Q,hasChanges:se,isRawJsonValid:oe,isSaving:Ce.isPending,isRemoteMode:l,port:r,onRefetch:ee,onSave:()=>Ce.mutate()}),p?e.jsx("div",{className:"border-b bg-muted/10 px-4 py-3",children:p}):null,Q?e.jsxs("div",{className:"flex-1 flex items-center justify-center",children:[e.jsx(ie,{className:"w-8 h-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-3 text-muted-foreground",children:b("providerEditor.loadingSettings")})]}):e.jsxs("div",{className:"min-h-0 flex-1 grid grid-cols-[40%_60%] divide-x overflow-hidden",children:[e.jsx("div",{className:"flex min-h-0 min-w-0 flex-col overflow-hidden bg-muted/5",children:e.jsxs(qs,{defaultValue:"config",className:"h-full flex flex-col",children:[e.jsx("div",{className:"px-4 pt-4 shrink-0",children:e.jsxs(Hs,{className:"w-full",children:[e.jsx(Tt,{value:"config",className:"flex-1",children:"Model Config"}),e.jsx(Tt,{value:"info",className:"flex-1",children:"Info & Usage"})]})}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[e.jsx(Et,{value:"config",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(dn,{provider:t,catalog:n,savedPresets:F,currentModel:ae,opusModel:f,sonnetModel:U,haikuModel:ne,providerModels:N,routing:i,extendedContextEnabled:Te,onExtendedContextToggle:ze,onApplyPreset:Ve,onUpdateEnvValue:ce,onOpenCustomPreset:()=>g(!0),onDeletePreset:_=>j.mutate({profile:t,name:_}),isDeletePending:j.isPending,accounts:be,onAddAccount:v,onSetDefault:x,onRemoveAccount:m,onPauseToggle:L,onSoloMode:w,onBulkPause:I,onBulkResume:k,isRemovingAccount:S,isPausingAccount:y,isSoloingAccount:C,isBulkPausing:o,isBulkResuming:A,privacyMode:D,isRemoteMode:l})}),e.jsx(Et,{value:"info",className:"h-full mt-0 border-0 p-0 data-[state=inactive]:hidden",children:e.jsx(Ya,{provider:t,displayName:a,defaultTarget:h,data:q,authStatus:s,supportsModelConfig:!!n})})]})]})}),e.jsxs("div",{className:"flex min-h-0 min-w-0 flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-2 bg-muted/30 border-b flex items-center gap-2 shrink-0 h-[45px]",children:[e.jsx(la,{className:"w-4 h-4 text-muted-foreground"}),e.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:[b("rawEditorSection.rawConfig")," (JSON)"]})]}),e.jsx(zs,{rawJsonContent:te,isRawJsonValid:oe,rawJsonEdits:re,onRawJsonChange:Ge,profileEnv:q?.settings?.env,missingRequiredFields:Re})]})]}),e.jsx(ma,{open:Le,title:"File Modified Externally",description:"This settings file was modified by another process. Overwrite with your changes or discard?",confirmText:"Overwrite",variant:"destructive",onConfirm:()=>ke(!0),onCancel:()=>ke(!1)}),e.jsx(Xa,{open:T,onClose:()=>g(!1),currentValues:{default:ae||"",opus:f||"",sonnet:U||"",haiku:ne||""},onApply:Be,onSave:$e,isSaving:O.isPending,catalog:n,allModels:N,routing:i})]})}function ln({status:t,isSelected:a,onSelect:s}){const{t:n}=B(),i=t.accounts?.length||0;return e.jsxs("button",{className:J("w-full flex items-center gap-3 px-3 py-2.5 rounded-lg transition-colors cursor-pointer text-left",a?"bg-primary/10 border border-primary/20":"hover:bg-muted border border-transparent"),onClick:s,children:[e.jsx(vt,{provider:t.provider,size:"md"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-sm truncate",children:t.displayName}),i>0&&e.jsx(G,{variant:"secondary",className:"text-[10px] h-4 px-1",children:i})]}),e.jsx("div",{className:"flex items-center gap-1.5 mt-0.5",children:t.authenticated?e.jsxs(e.Fragment,{children:[e.jsx(je,{className:"w-3 h-3 text-green-600"}),e.jsx("span",{className:"text-xs text-green-600",children:n("cliproxyPage.connected")})]}):e.jsxs(e.Fragment,{children:[e.jsx(yt,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:n("cliproxyPage.notConnected")})]})})]})]})}function cn({variant:t,parentAuth:a,isSelected:s,onSelect:n,onDelete:i,isDeleting:c}){const{t:d}=B(),l=()=>{n()};return e.jsxs("div",{role:"button",tabIndex:0,className:J("group w-full flex items-center gap-3 px-3 py-2 rounded-lg transition-colors cursor-pointer text-left pl-6",s?"bg-primary/10 border border-primary/20":"hover:bg-muted border border-transparent"),onClick:l,onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),l())},children:[e.jsxs("div",{className:"relative",children:[e.jsx(vt,{provider:t.provider,size:"sm"}),e.jsx(os,{className:"w-2.5 h-2.5 absolute -bottom-0.5 -right-0.5 text-muted-foreground"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-sm truncate",children:t.name}),e.jsx(G,{variant:"outline",className:"text-[9px] h-4 px-1",children:d("cliproxyPage.variant")}),e.jsx(G,{variant:"outline",className:"text-[9px] h-4 px-1 uppercase",children:t.target||"claude"})]}),e.jsx("div",{className:"flex items-center gap-1.5 mt-0.5",children:a?.authenticated?e.jsxs(e.Fragment,{children:[e.jsx(je,{className:"w-3 h-3 text-green-600"}),e.jsx("span",{className:"text-xs text-muted-foreground truncate",children:d("cliproxyPage.viaProvider",{provider:t.provider})})]}):e.jsxs(e.Fragment,{children:[e.jsx(yt,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:d("cliproxyPage.parentNotConnected")})]})})]}),e.jsx(K,{variant:"ghost",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100 hover:text-destructive",onClick:r=>{r.stopPropagation(),i()},disabled:c,children:e.jsx(rs,{className:"w-3 h-3"})})]})}function un({onSetup:t}){const{t:a}=B();return e.jsx("div",{className:"flex-1 flex items-center justify-center bg-muted/20",children:e.jsxs("div",{className:"text-center max-w-md px-8",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-muted flex items-center justify-center mx-auto mb-6",children:e.jsx(Ie,{className:"w-8 h-8 text-muted-foreground"})}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:a("cliproxyPage.emptyTitle")}),e.jsx("p",{className:"text-muted-foreground mb-4",children:a("cliproxyPage.emptyDesc")}),e.jsxs("p",{className:"text-xs text-muted-foreground mb-6",children:[a("cliproxyPage.emptyControlPanelPrefix")," ",e.jsx("a",{href:"/cliproxy/control-panel",className:"text-primary hover:underline",children:a("cliproxyPage.controlPanel")}),"."]}),e.jsxs(K,{onClick:t,className:"gap-2",children:[e.jsx(De,{className:"w-4 h-4"}),a("cliproxyPage.quickSetup")]})]})})}function Mn(){const{t}=B(),a=ut(),{data:s,isLoading:n}=Vt(),{data:i,isFetching:c}=Gs(),{data:d}=Bt(),{data:l}=Vs(),r=Bs(),h=$s(),p=Ws(),v=Qs(),x=Js(),m=Xs(),L=Ys(),w=Zs(),[I,k]=u.useState(()=>{if(typeof window<"u"){const U=new URLSearchParams(window.location.search).get("provider")?.trim().toLowerCase();return U&&at(U)?U:localStorage.getItem("cliproxy-selected-provider")}return null}),[S,y]=u.useState(null),[C,o]=u.useState(!1),[A,T]=u.useState(()=>{if(typeof window>"u")return null;const f=new URLSearchParams(window.location.search),U=f.get("provider")?.trim().toLowerCase();return f.get("action")!=="auth"||!U||!at(U)?null:{provider:U,displayName:ea(U),isFirstAccount:!1}}),g=u.useMemo(()=>s?.authStatus||[],[s?.authStatus]),D=s?.source==="remote",b=u.useMemo(()=>i?.variants||[],[i?.variants]),H=u.useMemo(()=>Ct(d?.catalogs),[d?.catalogs]),P=d?.routing??{},O=!!d,j=f=>{k(f),f&&localStorage.setItem("cliproxy-selected-provider",f)},z=u.useMemo(()=>S?null:I&&g.some(f=>f.provider===I)?I:g.length>0&&(g.find(U=>(U.accounts?.length||0)>0)?.provider||g[0]?.provider)||null,[I,S,g]),E=g.find(f=>f.provider===z),F=b.find(f=>f.name===S),N=F?g.find(f=>f.provider===F.provider):void 0,R=(F?.provider||E?.provider||"").toLowerCase().trim(),q=R==="gemini"||R==="agy",Q=()=>{a.invalidateQueries({queryKey:["cliproxy"]}),a.invalidateQueries({queryKey:["cliproxy-auth"]}),a.invalidateQueries({queryKey:["cliproxy-catalog"]}),a.invalidateQueries({queryKey:["cliproxy-models"]})},ee=(f,U,ne)=>{p.isPending||v.isPending||(ne?p.mutate({provider:f,accountId:U}):v.mutate({provider:f,accountId:U}))},te=(f,U)=>{x.isPending||x.mutate({provider:f,accountId:U})},re=(f,U)=>{m.isPending||m.mutate({provider:f,accountIds:U})},oe=(f,U)=>{L.isPending||L.mutate({provider:f,accountIds:U})},se=f=>{j(f),y(null)},ae=f=>{y(f),j(null)};return e.jsxs("div",{className:"flex h-full min-h-0 overflow-hidden",children:[e.jsxs("div",{className:"w-80 border-r flex flex-col bg-muted/30",children:[e.jsxs("div",{className:"p-4 border-b bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ie,{className:"w-5 h-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:l?.backendLabel??"CLIProxy"})]}),e.jsx(K,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:Q,disabled:c,children:e.jsx(bt,{className:J("w-4 h-4",c&&"animate-spin")})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:t("cliproxyPage.accountManagement")}),e.jsxs(K,{variant:"default",size:"sm",className:"w-full gap-2",onClick:()=>o(!0),children:[e.jsx(De,{className:"w-4 h-4"}),t("cliproxyPage.quickSetup")]})]}),e.jsx(ft,{className:"flex-1",children:e.jsxs("div",{className:"p-2",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide px-3 py-2",children:t("cliproxyPage.providers")}),n?e.jsx("div",{className:"space-y-2 px-2",children:[1,2,3,4].map(f=>e.jsx(ta,{className:"h-14 w-full rounded-lg"},f))}):e.jsx("div",{className:"space-y-1",children:g.map(f=>e.jsx(ln,{status:f,isSelected:z===f.provider,onSelect:()=>se(f.provider)},f.provider))}),b.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide px-3 py-2 mt-4 flex items-center gap-1.5",children:[e.jsx(os,{className:"w-3 h-3"}),t("cliproxyPage.variants")]}),e.jsx("div",{className:"space-y-1",children:b.map(f=>e.jsx(cn,{variant:f,parentAuth:g.find(U=>U.provider===f.provider),isSelected:S===f.name,onSelect:()=>ae(f.name),onDelete:()=>w.mutate(f.name),isDeleting:w.isPending},f.name))})]})]})}),e.jsx("div",{className:"p-3 border-t",children:e.jsx(xa,{})}),e.jsx("div",{className:"p-3 border-t bg-background text-xs text-muted-foreground",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:t("cliproxyPage.providerCount",{count:g.length})}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(je,{className:"w-3 h-3 text-green-600"}),t("cliproxyPage.connectedCount",{count:g.filter(f=>f.authenticated).length})]})]})})]}),e.jsx("div",{className:"flex-1 flex min-w-0 flex-col overflow-hidden bg-background",children:F&&N?e.jsx(e.Fragment,{children:e.jsx(Kt,{provider:F.name,displayName:t("cliproxyPage.variantDisplay",{name:F.name,provider:F.provider}),authStatus:N,catalog:H[F.provider],routing:P[F.provider],logoProvider:F.provider,baseProvider:F.provider,defaultTarget:F.target,isRemoteMode:D,port:F.port,topNotice:q?e.jsx(ct,{compact:!0,showProxySettingsLink:!0}):void 0,onAddAccount:()=>T({provider:F.provider,displayName:N.displayName,isFirstAccount:(N.accounts?.length||0)===0}),onSetDefault:f=>r.mutate({provider:F.provider,accountId:f}),onRemoveAccount:f=>h.mutate({provider:F.provider,accountId:f}),onPauseToggle:(f,U)=>ee(F.provider,f,U),onSoloMode:f=>te(F.provider,f),onBulkPause:f=>re(F.provider,f),onBulkResume:f=>oe(F.provider,f),isRemovingAccount:h.isPending,isPausingAccount:p.isPending||v.isPending,isSoloingAccount:x.isPending,isBulkPausing:m.isPending,isBulkResuming:L.isPending})}):E?e.jsx(e.Fragment,{children:e.jsx(Kt,{provider:E.provider,displayName:E.displayName,authStatus:E,catalog:H[E.provider],routing:P[E.provider],isRemoteMode:D,topNotice:q?e.jsx(ct,{compact:!0,showProxySettingsLink:!0}):void 0,onAddAccount:()=>T({provider:E.provider,displayName:E.displayName,isFirstAccount:(E.accounts?.length||0)===0}),onSetDefault:f=>r.mutate({provider:E.provider,accountId:f}),onRemoveAccount:f=>h.mutate({provider:E.provider,accountId:f}),onPauseToggle:(f,U)=>ee(E.provider,f,U),onSoloMode:f=>te(E.provider,f),onBulkPause:f=>re(E.provider,f),onBulkResume:f=>oe(E.provider,f),isRemovingAccount:h.isPending,isPausingAccount:p.isPending||v.isPending,isSoloingAccount:x.isPending,isBulkPausing:m.isPending,isBulkResuming:L.isPending})}):e.jsx(un,{onSetup:()=>o(!0)})}),e.jsx(Oa,{open:C,onClose:()=>o(!1)}),e.jsx(za,{open:A!==null,onClose:()=>T(null),provider:A?.provider||"",displayName:A?.displayName||"",catalog:O&&A?.provider?H[A.provider]:void 0,isFirstAccount:A?.isFirstAccount||!1})]})}export{Mn as CliproxyPage};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as w}from"./react-vendor-CNOkPC89.js";import{t as U}from"./notifications-B2HqRBj7.js";import{C as I,j as F,k as W,B as _,b as K,a as E,d as C,aF as J,r as P,s as O,t as D,v as L,w as v,I as S,n as fe,W as y,bb as se,bc as Pe,c as Oe,bi as He,bj as ve,bk as Qe,Q as Je,R as Ze,U as ae,V as oe,bd as be}from"./index-B1mN7ZR-.js";import{aa as es,aR as ss,as as te,L as $,n as ts,aS as rs,aT as ns,aB as as,w as os,a7 as ls,aU as is,aV as cs,aW as ds,ah as me,p as we,$ as xs,m as us,o as ms,_ as ps,S as hs,aM as Ne,aX as fs,x as js,I as gs,T as vs,N as bs}from"./icons-KVCk4_U8.js";import{S as ee}from"./separator-DnQqlaL0.js";import{a as ws,u as ye,b as Ce}from"./tanstack-CrmUhA7Z.js";import"./code-highlight-BRUf_pqB.js";import{T as Ns,a as ys,b as Se,c as le,d as Cs,e as ie}from"./table-BDsTJlxT.js";import{R as Ss}from"./raw-json-settings-editor-panel-DhhcWn5Q.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";function Z({title:s,icon:t,badge:r,description:l,disabledReason:o,children:n}){return e.jsxs(I,{children:[e.jsxs(F,{className:"pb-2",children:[e.jsxs(W,{className:"flex items-center gap-2 text-base",children:[t,s,r?e.jsx(_,{variant:"outline",className:"text-[10px] font-normal",children:r}):null]}),l?e.jsx("p",{className:"text-xs text-muted-foreground",children:l}):null]}),e.jsxs(K,{className:"space-y-3",children:[o?e.jsx("p",{className:"text-xs text-amber-600",children:o}):null,n]})]})}function _s({catalog:s,state:t,disabled:r=!1,disabledReason:l,onToggle:o}){const{t:n}=E(),a=new Set(s.map(i=>i.name)),c=Object.entries(t).filter(([i])=>!a.has(i)).sort(([i],[d])=>i.localeCompare(d));return e.jsxs(Z,{title:n("codex.features"),badge:"features",icon:e.jsx(es,{className:"h-4 w-4"}),description:n("codex.featuresDesc"),disabledReason:l,children:[e.jsx("div",{className:"space-y-2",children:s.map(i=>{const d=t[i.name]??null;return e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md border px-3 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm font-medium",children:i.label}),e.jsx(_,{variant:"outline",className:"font-mono text-[10px]",children:i.name})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:i.description})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[d!==null?e.jsx(C,{variant:"outline",size:"sm",onClick:()=>o(i.name,null),disabled:r,children:n("codex.useDefault")}):null,e.jsx(J,{checked:d===!0,onCheckedChange:x=>o(i.name,x),disabled:r})]})]},i.name)})}),c.length>0?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:n("codex.configOnlyFlags")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n("codex.configOnlyFlagsDesc")})]}),c.map(([i,d])=>e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md border border-dashed px-3 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm font-medium",children:i}),e.jsx(_,{variant:"secondary",className:"text-[10px]",children:n("codex.existing")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n(d===null?"codex.nonBooleanForm":"codex.discoveredFromFile")})]}),d===null?e.jsx(_,{variant:"outline",children:n("codex.rawOnly")}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"outline",size:"sm",onClick:()=>o(i,null),disabled:r,children:n("codex.useDefault")}),e.jsx(J,{checked:d===!0,onCheckedChange:x=>o(i,x),disabled:r})]})]},i))]}):null]})}const ks={name:"",transport:"stdio",command:null,args:[],url:null,enabled:!0,required:!1,startupTimeoutSec:null,toolTimeoutSec:null,enabledTools:[],disabledTools:[]};function ce(s){return s.join(", ")}function de(s){return s.split(",").map(t=>t.trim()).filter(Boolean)}function Ts({initialDraft:s,isNew:t,disabled:r,saving:l,canDelete:o,onSave:n,onDelete:a}){const{t:c}=E(),[i,d]=w.useState(s);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(S,{value:i.name,onChange:x=>d(m=>({...m,name:x.target.value})),placeholder:"playwright",disabled:r||!t}),e.jsxs(P,{value:i.transport,onValueChange:x=>d(m=>({...m,transport:x})),disabled:r,children:[e.jsx(O,{children:e.jsx(D,{})}),e.jsxs(L,{children:[e.jsx(v,{value:"stdio",children:c("codex.stdio")}),e.jsx(v,{value:"streamable-http",children:c("codex.streamableHttp")})]})]}),i.transport==="stdio"?e.jsxs(e.Fragment,{children:[e.jsx(S,{value:i.command??"",onChange:x=>d(m=>({...m,command:x.target.value||null})),placeholder:"npx",disabled:r}),e.jsx(S,{value:ce(i.args),onChange:x=>d(m=>({...m,args:de(x.target.value)})),placeholder:"@playwright/mcp@latest, --flag",disabled:r})]}):e.jsx(S,{className:"sm:col-span-2",value:i.url??"",onChange:x=>d(m=>({...m,url:x.target.value||null})),placeholder:"https://example.test/mcp",disabled:r}),e.jsx(S,{type:"number",min:1,value:i.startupTimeoutSec??"",onChange:x=>d(m=>({...m,startupTimeoutSec:x.target.value?Number(x.target.value):null})),placeholder:"Startup timeout (sec)",disabled:r}),e.jsx(S,{type:"number",min:1,value:i.toolTimeoutSec??"",onChange:x=>d(m=>({...m,toolTimeoutSec:x.target.value?Number(x.target.value):null})),placeholder:"Tool timeout (sec)",disabled:r}),e.jsx(S,{value:ce(i.enabledTools),onChange:x=>d(m=>({...m,enabledTools:de(x.target.value)})),placeholder:"enabled_tools",disabled:r}),e.jsx(S,{value:ce(i.disabledTools),onChange:x=>d(m=>({...m,disabledTools:de(x.target.value)})),placeholder:"disabled_tools",disabled:r})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("label",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-sm",children:["Enabled",e.jsx(J,{checked:i.enabled,onCheckedChange:x=>d(m=>({...m,enabled:x})),disabled:r})]}),e.jsxs("label",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-sm",children:["Required",e.jsx(J,{checked:i.required,onCheckedChange:x=>d(m=>({...m,required:x})),disabled:r})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs(C,{variant:"outline",onClick:a,disabled:r||l||!o,children:[e.jsx(te,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsxs(C,{onClick:()=>n(i.name,{transport:i.transport,command:i.command,args:i.args,url:i.url,enabled:i.enabled,required:i.required,startupTimeoutSec:i.startupTimeoutSec,toolTimeoutSec:i.toolTimeoutSec,enabledTools:i.enabledTools,disabledTools:i.disabledTools}),disabled:r||l||i.name.trim().length===0,children:[l?e.jsx($,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save MCP server"]})]})]})}function Es({entries:s,disabled:t=!1,disabledReason:r,saving:l=!1,onSave:o,onDelete:n}){const{t:a}=E(),[c,i]=w.useState("new"),d=w.useMemo(()=>s.find(p=>p.name===c)??null,[s,c]),x=d??ks,m=JSON.stringify(x);return e.jsxs(Z,{title:"MCP servers",badge:"mcp_servers",icon:e.jsx(ss,{className:"h-4 w-4"}),description:"Manage the safe MCP transport fields. Keep auth headers and bearer tokens in raw TOML.",disabledReason:r,children:[e.jsxs(P,{value:c,onValueChange:i,disabled:t,children:[e.jsx(O,{children:e.jsx(D,{placeholder:"Select MCP server"})}),e.jsxs(L,{children:[e.jsx(v,{value:"new",children:a("codex.createNewMcpServer")}),s.map(p=>e.jsx(v,{value:p.name,children:p.name},p.name))]})]}),e.jsx(Ts,{initialDraft:x,isNew:c==="new",disabled:t,saving:l,canDelete:d!==null,onDelete:async()=>{d&&(await n(d.name),i("new"))},onSave:async(p,N)=>{await o(p,N),i(p)}},m)]})}const Ps={name:"",displayName:null,baseUrl:null,envKey:null,wireApi:"responses",requiresOpenaiAuth:!1,supportsWebsockets:!1},Os={name:"cliproxy",displayName:"CLIProxy Codex",baseUrl:"http://127.0.0.1:8317/api/provider/codex",envKey:"CLIPROXY_API_KEY",wireApi:"responses",requiresOpenaiAuth:!1,supportsWebsockets:!1};function Ds({initialDraft:s,isNew:t,disabled:r,saving:l,canDelete:o,onSave:n,onDelete:a}){const{t:c}=E(),[i,d]=w.useState(s);return e.jsxs(e.Fragment,{children:[t&&e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 rounded-md border border-dashed px-3 py-2 text-xs text-muted-foreground",children:[e.jsxs("p",{children:["Quick start: apply the CLIProxy Codex preset here, then set"," ",e.jsx("strong",{children:c("codex.defaultProvider")})," to ",e.jsx("code",{children:"cliproxy"})," in Top-level settings."]}),e.jsx(C,{variant:"outline",size:"sm",onClick:()=>d(Os),disabled:r,children:"Use CLIProxy Codex preset"})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(S,{value:i.name,onChange:x=>d(m=>({...m,name:x.target.value})),placeholder:"Provider id",disabled:r||!t}),e.jsx(S,{value:i.displayName??"",onChange:x=>d(m=>({...m,displayName:x.target.value||null})),placeholder:"Display name",disabled:r}),e.jsx(S,{value:i.baseUrl??"",onChange:x=>d(m=>({...m,baseUrl:x.target.value||null})),placeholder:"http://127.0.0.1:8317/api/provider/codex",disabled:r}),e.jsx(S,{value:i.envKey??"",onChange:x=>d(m=>({...m,envKey:x.target.value||null})),placeholder:"CLIPROXY_API_KEY",disabled:r})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[e.jsxs(P,{value:i.wireApi??"responses",onValueChange:x=>d(m=>({...m,wireApi:x})),disabled:r,children:[e.jsx(O,{children:e.jsx(D,{})}),e.jsx(L,{children:e.jsx(v,{value:"responses",children:c("codex.responses")})})]}),e.jsxs("label",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-sm",children:["Requires OpenAI auth",e.jsx(J,{checked:i.requiresOpenaiAuth,onCheckedChange:x=>d(m=>({...m,requiresOpenaiAuth:x})),disabled:r})]}),e.jsxs("label",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-sm",children:["Supports websockets",e.jsx(J,{checked:i.supportsWebsockets,onCheckedChange:x=>d(m=>({...m,supportsWebsockets:x})),disabled:r})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs(C,{variant:"outline",onClick:a,disabled:r||l||!o,children:[e.jsx(te,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsxs(C,{onClick:()=>n(i.name,{displayName:i.displayName,baseUrl:i.baseUrl,envKey:i.envKey,wireApi:i.wireApi,requiresOpenaiAuth:i.requiresOpenaiAuth,supportsWebsockets:i.supportsWebsockets}),disabled:r||l||i.name.trim().length===0,children:[l?e.jsx($,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save provider"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["If you want plain native ",e.jsx("code",{children:"codex"})," to default to CLIProxy, save a provider named"," ",e.jsx("code",{children:"cliproxy"})," with ",e.jsx("code",{children:"CLIPROXY_API_KEY"})," here, then pick"," ",e.jsx("code",{children:"cliproxy"})," in the ",e.jsx("strong",{children:c("codex.defaultProvider")})," control above."]})]})}function Ls({entries:s,disabled:t=!1,disabledReason:r,saving:l=!1,onSave:o,onDelete:n}){const{t:a}=E(),[c,i]=w.useState("new"),d=w.useMemo(()=>s.find(p=>p.name===c)??null,[s,c]),x=d??Ps,m=JSON.stringify(x);return e.jsxs(Z,{title:"Model providers",badge:"model_providers",icon:e.jsx(ts,{className:"h-4 w-4"}),description:"Edit the common provider fields CCS can support safely. Keep secret migration and inline bearer tokens in raw TOML.",disabledReason:r,children:[e.jsxs(P,{value:c,onValueChange:i,disabled:t,children:[e.jsx(O,{children:e.jsx(D,{placeholder:"Select provider"})}),e.jsxs(L,{children:[e.jsx(v,{value:"new",children:a("codex.createNewProvider")}),s.map(p=>e.jsx(v,{value:p.name,children:p.name},p.name))]})]}),e.jsx(Ds,{initialDraft:x,isNew:c==="new",disabled:t,saving:l,canDelete:d!==null,onDelete:async()=>{d&&(await n(d.name),i("new"))},onSave:async(p,N)=>{await o(p,N),i(p)}},m)]})}function As({initialName:s,initialModel:t,initialProvider:r,initialEffort:l,providerNames:o,activeProfile:n,selectedEntryName:a,disabled:c,saving:i,onSave:d,onDelete:x,onSetActive:m}){const{t:p}=E(),[N,h]=w.useState(s),[b,R]=w.useState(t),[q,u]=w.useState(r),[g,z]=w.useState(l);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(S,{value:N,onChange:j=>h(j.target.value),placeholder:"deep-review",disabled:c||a!==null}),e.jsx(S,{value:b??"",onChange:j=>R(j.target.value||null),placeholder:"gpt-5.4",disabled:c}),e.jsxs(P,{value:q??"__unset__",onValueChange:j=>u(j==="__unset__"?null:j),disabled:c,children:[e.jsx(O,{children:e.jsx(D,{placeholder:p("codex.useGlobalProvider")})}),e.jsxs(L,{children:[e.jsx(v,{value:"__unset__",children:p("codex.useGlobalProvider")}),o.map(j=>e.jsx(v,{value:j,children:j},j))]})]}),e.jsxs(P,{value:g??"__unset__",onValueChange:j=>z(j==="__unset__"?null:j),disabled:c,children:[e.jsx(O,{children:e.jsx(D,{placeholder:p("codex.useGlobalEffort")})}),e.jsxs(L,{children:[e.jsx(v,{value:"__unset__",children:p("codex.useGlobalEffort")}),["minimal","low","medium","high","xhigh"].map(j=>e.jsx(v,{value:j,children:j},j))]})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(C,{variant:"outline",onClick:x,disabled:c||i||!a,children:[e.jsx(te,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsx(C,{variant:"outline",onClick:m,disabled:c||i||!a||a===n,children:"Set active"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(C,{variant:"outline",onClick:()=>d(N,{model:b,modelProvider:q,modelReasoningEffort:g},!1),disabled:c||i||N.trim().length===0,children:[i?e.jsx($,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save profile"]}),e.jsxs(C,{onClick:()=>d(N,{model:b,modelProvider:q,modelReasoningEffort:g},!0),disabled:c||i||N.trim().length===0,children:[i?e.jsx($,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save + activate"]})]})]})]})}function Rs({activeProfile:s,entries:t,providerNames:r,disabled:l=!1,disabledReason:o,saving:n=!1,onSave:a,onDelete:c,onSetActive:i}){const{t:d}=E(),[x,m]=w.useState("new"),p=w.useMemo(()=>t.find(h=>h.name===x)??null,[t,x]),N=JSON.stringify(p??{name:"",values:{}});return e.jsxs(Z,{title:d("codex.profiles"),badge:"profiles",icon:e.jsx(rs,{className:"h-4 w-4"}),description:"Create reusable Codex overlays and set the active default profile.",disabledReason:o,children:[e.jsxs(P,{value:x,onValueChange:m,disabled:l,children:[e.jsx(O,{children:e.jsx(D,{placeholder:"Select profile"})}),e.jsxs(L,{children:[e.jsx(v,{value:"new",children:d("codex.createNewProfile")}),t.map(h=>e.jsxs(v,{value:h.name,children:[h.name,h.name===s?" (active)":""]},h.name))]})]}),e.jsx(As,{initialName:p?.name??"",initialModel:p?.values.model??null,initialProvider:p?.values.modelProvider??null,initialEffort:p?.values.modelReasoningEffort??null,providerNames:r,activeProfile:s,selectedEntryName:p?.name??null,disabled:l,saving:n,onDelete:async()=>{p&&(await c(p.name),m("new"))},onSetActive:async()=>{p&&await i(p.name)},onSave:async(h,b,R)=>{await a(h,b,R),m(h)}},N)]})}function Ms({workspacePath:s,disabled:t,saving:r,onSave:l}){const{t:o}=E(),[n,a]=w.useState(s),[c,i]=w.useState("trusted");return e.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_160px_auto]",children:[e.jsx(S,{value:n,onChange:d=>a(d.target.value),placeholder:"~/repo or /absolute/path",disabled:t}),e.jsxs(P,{value:c,onValueChange:i,disabled:t,children:[e.jsx(O,{children:e.jsx(D,{})}),e.jsxs(L,{children:[e.jsx(v,{value:"trusted",children:o("codex.trusted")}),e.jsx(v,{value:"untrusted",children:o("codex.untrusted")})]})]}),e.jsxs(C,{onClick:()=>l(n,c),disabled:t||r,children:[r?e.jsx($,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save trust"]})]})}function Is({workspacePath:s,entries:t,disabled:r=!1,disabledReason:l,saving:o=!1,onSave:n}){const{t:a}=E();return e.jsxs(Z,{title:"Project trust",badge:"projects",icon:e.jsx(ns,{className:"h-4 w-4"}),description:"Trust current workspaces or remove stale trust entries without opening raw TOML.",disabledReason:l,children:[e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Paths must be absolute or start with ",e.jsx("code",{children:"~/"}),". Relative paths are rejected so CCS does not trust the wrong folder."]}),e.jsx(Ms,{workspacePath:s,disabled:r,saving:o,onSave:n},s),e.jsx(C,{variant:"outline",className:"w-full justify-start",onClick:()=>n(s,"trusted"),disabled:r||o,children:"Trust current workspace"}),e.jsx("div",{className:"space-y-2",children:t.length===0?e.jsx("p",{className:"text-xs text-muted-foreground",children:a("codex.noProjectTrustEntries")}):t.map(c=>e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border px-3 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:c.path}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["trust_level = ",c.trustLevel]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"ghost",size:"sm",onClick:()=>n(c.path,c.trustLevel==="trusted"?"untrusted":"trusted"),disabled:r||o,children:"Toggle"}),e.jsx(C,{variant:"ghost",size:"icon",onClick:()=>n(c.path,null),disabled:r||o,children:e.jsx(te,{className:"h-4 w-4"})})]})]},c.path))})]})}const A="__unset__",Fs=105e4,Ws=272e3,_e=8e5,ke=7e5,Ks=new Intl.NumberFormat("en-US");function B(s){return s??A}function Y(s,t){return t&&!s.includes(t)?[t,...s]:s}function xe(s){return Ks.format(s)}function qs(s){return s?.trim().toLowerCase().startsWith("gpt-5.4")??!1}function Us(s,t){const r={};return t.model!==s.model&&(r.model=t.model),t.modelReasoningEffort!==s.modelReasoningEffort&&(r.modelReasoningEffort=t.modelReasoningEffort),t.modelContextWindow!==s.modelContextWindow&&(r.modelContextWindow=t.modelContextWindow),t.modelAutoCompactTokenLimit!==s.modelAutoCompactTokenLimit&&(r.modelAutoCompactTokenLimit=t.modelAutoCompactTokenLimit),t.modelProvider!==s.modelProvider&&(r.modelProvider=t.modelProvider),t.approvalPolicy!==s.approvalPolicy&&(r.approvalPolicy=t.approvalPolicy),t.sandboxMode!==s.sandboxMode&&(r.sandboxMode=t.sandboxMode),t.webSearch!==s.webSearch&&(r.webSearch=t.webSearch),t.toolOutputTokenLimit!==s.toolOutputTokenLimit&&(r.toolOutputTokenLimit=t.toolOutputTokenLimit),t.personality!==s.personality&&(r.personality=t.personality),r}function Vs({initialValues:s,providerNames:t,disabled:r,saving:l,onSave:o}){const{t:n}=E(),[a,c]=w.useState(s),i=Y(["minimal","low","medium","high","xhigh"],a.modelReasoningEffort),d=Y(t,a.modelProvider),x=Y(["on-request","never","untrusted"],a.approvalPolicy),m=Y(["read-only","workspace-write","danger-full-access"],a.sandboxMode),p=Y(["cached","live","disabled"],a.webSearch),N=Y(["none","friendly","pragmatic"],a.personality),h=Us(s,a),b=Object.keys(h).length>0,R=qs(a.model),q=u=>{const g=u.trim();return g.length>0?Number(g):null};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.model")}),e.jsx(S,{value:a.model??"",onChange:u=>c(g=>({...g,model:u.target.value||null})),placeholder:"gpt-5.4",disabled:r})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.reasoningEffort")}),e.jsxs(P,{value:B(a.modelReasoningEffort),onValueChange:u=>c(g=>({...g,modelReasoningEffort:u===A?null:u})),disabled:r,children:[e.jsx(O,{children:e.jsx(D,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(v,{value:A,children:n("codex.useDefault")}),i.map(u=>e.jsx(v,{value:u,children:u},u))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.defaultProvider")}),e.jsxs(P,{value:B(a.modelProvider),onValueChange:u=>c(g=>({...g,modelProvider:u===A?null:u})),disabled:r,children:[e.jsx(O,{children:e.jsx(D,{placeholder:n("codex.useCodexDefault")})}),e.jsxs(L,{children:[e.jsx(v,{value:A,children:n("codex.useCodexDefault")}),d.map(u=>e.jsx(v,{value:u,children:u},u))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.approvalPolicy")}),e.jsxs(P,{value:B(a.approvalPolicy),onValueChange:u=>c(g=>({...g,approvalPolicy:u===A?null:u})),disabled:r,children:[e.jsx(O,{children:e.jsx(D,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(v,{value:A,children:n("codex.useDefault")}),x.map(u=>e.jsx(v,{value:u,children:u},u))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.sandboxMode")}),e.jsxs(P,{value:B(a.sandboxMode),onValueChange:u=>c(g=>({...g,sandboxMode:u===A?null:u})),disabled:r,children:[e.jsx(O,{children:e.jsx(D,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(v,{value:A,children:n("codex.useDefault")}),m.map(u=>e.jsx(v,{value:u,children:u},u))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.webSearch")}),e.jsxs(P,{value:B(a.webSearch),onValueChange:u=>c(g=>({...g,webSearch:u===A?null:u})),disabled:r,children:[e.jsx(O,{children:e.jsx(D,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(v,{value:A,children:n("codex.useDefault")}),p.map(u=>e.jsx(v,{value:u,children:u},u))]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.toolOutputTokenLimit")}),e.jsx(S,{type:"number",min:1,value:a.toolOutputTokenLimit??"",onChange:u=>c(g=>({...g,toolOutputTokenLimit:u.target.value?Number(u.target.value):null})),placeholder:"25000",disabled:r})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.personality")}),e.jsxs(P,{value:B(a.personality),onValueChange:u=>c(g=>({...g,personality:u===A?null:u})),disabled:r,children:[e.jsx(O,{children:e.jsx(D,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(v,{value:A,children:n("codex.useDefault")}),N.map(u=>e.jsx(v,{value:u,children:u},u))]})]})]})]}),e.jsxs("div",{className:"space-y-4 rounded-xl border border-amber-500/30 bg-amber-500/5 p-4 shadow-sm dark:bg-amber-400/5",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(os,{className:"h-4 w-4 text-amber-600 dark:text-amber-300"}),e.jsx("p",{className:"text-sm font-semibold",children:n("codex.longContextOverride")}),e.jsx(_,{variant:"outline",className:"border-amber-500/40 bg-background/80 text-[10px] uppercase tracking-[0.16em] text-amber-700 dark:text-amber-300",children:"Manual opt-in only"}),e.jsx(_,{variant:"secondary",className:"text-[10px] uppercase tracking-[0.16em] text-muted-foreground",children:R?"GPT-5.4 selected":"GPT-5.4 reference"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Draft values only. Nothing applies until Save."})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(C,{type:"button",variant:"outline",size:"sm",disabled:r,onClick:()=>c(u=>({...u,modelContextWindow:_e,modelAutoCompactTokenLimit:ke})),children:"Fill cautious pair"}),e.jsx(C,{type:"button",variant:"outline",size:"sm",disabled:r,onClick:()=>c(u=>({...u,modelContextWindow:Fs})),children:"Set official max window"}),e.jsx(C,{type:"button",variant:"ghost",size:"sm",disabled:r,onClick:()=>c(u=>({...u,modelContextWindow:null,modelAutoCompactTokenLimit:null})),children:"Clear"})]})]}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-3",children:[e.jsxs("div",{className:"rounded-lg border bg-background/85 px-3 py-3 shadow-sm shadow-black/5",children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:"Official max"}),e.jsx("p",{className:"mt-1 font-mono text-base font-semibold text-foreground",children:"1.05M / 1M"}),e.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:n("codex.gptContextCap")})]}),e.jsxs("div",{className:"rounded-lg border bg-background/85 px-3 py-3 shadow-sm shadow-black/5",children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:"Standard window"}),e.jsx("p",{className:"mt-1 font-mono text-base font-semibold text-foreground",children:xe(Ws)}),e.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:n("codex.normalUsageWindow")})]}),e.jsxs("div",{className:"rounded-lg border bg-background/85 px-3 py-3 shadow-sm shadow-black/5",children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:"Above 272K"}),e.jsx("p",{className:"mt-1 font-mono text-base font-semibold text-foreground",children:n("codex.counts2x")}),e.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:n("codex.usageLimitCost")})]})]}),e.jsxs("div",{className:"space-y-3 rounded-lg border bg-background/75 px-3 py-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:"One cautious pair"}),e.jsxs("div",{className:"rounded-full border bg-background px-2.5 py-1 font-mono text-[11px] font-medium",children:["Context ",xe(_e)]}),e.jsxs("div",{className:"rounded-full border bg-background px-2.5 py-1 font-mono text-[11px] font-medium",children:["Auto-compact ",xe(ke)]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx(_,{variant:"outline",className:"border-border/70 bg-background/80 text-[10px] uppercase tracking-[0.14em] text-muted-foreground",children:"Not official"}),e.jsx(_,{variant:"outline",className:"border-border/70 bg-background/80 text-[10px] uppercase tracking-[0.14em] text-muted-foreground",children:"Draft only"})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] text-muted-foreground",children:[e.jsx("span",{children:n("codex.quickFillWarning")}),!R&&a.model?e.jsxs("span",{children:[e.jsx("code",{children:a.model})," should be checked separately."]}):null]})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.modelContextWindow")}),e.jsx(S,{"aria-label":n("codex.modelContextWindow"),type:"number",min:1,value:a.modelContextWindow??"",onChange:u=>c(g=>({...g,modelContextWindow:q(u.target.value)})),placeholder:"Unset",disabled:r}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Writes ",e.jsx("code",{children:"model_context_window"}),". Leave unset to keep Codex defaults."]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.autoCompactTokenLimit")}),e.jsx(S,{"aria-label":n("codex.autoCompactTokenLimit"),type:"number",min:1,value:a.modelAutoCompactTokenLimit??"",onChange:u=>c(g=>({...g,modelAutoCompactTokenLimit:q(u.target.value)})),placeholder:"Unset",disabled:r}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Writes ",e.jsx("code",{children:"model_auto_compact_token_limit"}),". Leave unset to keep model defaults."]})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] text-muted-foreground",children:[e.jsx("span",{className:"text-[10px] uppercase tracking-[0.14em]",children:"Docs"}),e.jsx("a",{href:"https://developers.openai.com/api/docs/models/gpt-5.4",target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:"GPT-5.4 model page"}),e.jsx("a",{href:"https://openai.com/index/introducing-gpt-5-4/",target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:"Release notes"}),e.jsx("a",{href:"https://developers.openai.com/codex/config-reference",target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:"Config reference"})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs(C,{onClick:()=>o(h),disabled:r||l||!b,children:[l?e.jsx($,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save top-level settings"]})})]})}function Gs({values:s,providerNames:t,disabled:r=!1,disabledReason:l,saving:o=!1,onSave:n}){return e.jsx(Z,{title:"Top-level controls",badge:"config.toml",icon:e.jsx(as,{className:"h-4 w-4"}),description:"Structured controls for the stable top-level Codex settings users touch most often. Unsupported upstream shapes stay untouched and should be edited in raw TOML.",disabledReason:l,children:e.jsx(Vs,{initialValues:s,providerNames:t,disabled:r,saving:o,onSave:n},JSON.stringify(s))})}function zs({workspacePath:s,activeProfile:t,topLevelSettings:r,projectTrustEntries:l,profileEntries:o,modelProviderEntries:n,mcpServerEntries:a,featureCatalog:c,featureState:i,disabled:d,disabledReason:x,saving:m,onPatch:p}){const{t:N}=E();return e.jsx(fe,{className:"h-full",children:e.jsxs("div",{className:"space-y-6 pr-1 pb-6",children:[e.jsxs("div",{className:"group relative overflow-hidden rounded-xl border border-border/80 bg-background/50 p-5 shadow-sm transition-all hover:bg-background hover:shadow-md dark:border-border/60",children:[e.jsx("div",{className:"absolute inset-x-0 -top-px h-px bg-gradient-to-r from-transparent via-foreground/15 to-transparent transition-opacity group-hover:via-foreground/30"}),e.jsxs("div",{className:"flex flex-col gap-6 lg:flex-row lg:items-start lg:justify-between",children:[e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg border border-primary/20 bg-primary/10 text-primary transition-colors group-hover:border-primary/30",children:e.jsx(ls,{className:"h-4 w-4"})}),e.jsx("div",{children:e.jsx("h2",{className:"text-base font-semibold tracking-tight text-foreground",children:N("codex.controlCenter")})})]}),e.jsxs("ul",{className:"grid gap-3 sm:grid-cols-2 text-sm text-muted-foreground",children:[e.jsxs("li",{className:"flex items-start gap-2.5",children:[e.jsx(is,{className:"h-4 w-4 shrink-0 text-muted-foreground/60 mt-0.5"}),e.jsxs("span",{className:"leading-relaxed",children:["Writes exclusively to user-layer"," ",e.jsx("code",{className:"text-[11px] bg-muted/70 px-1.5 py-0.5 rounded border border-border/50",children:"config.toml"})]})]}),e.jsxs("li",{className:"flex items-start gap-2.5",children:[e.jsx(cs,{className:"h-4 w-4 shrink-0 text-muted-foreground/60 mt-0.5"}),e.jsx("span",{className:"leading-relaxed",children:"Does not reflect repo trust layers or CLI overrides"})]})]})]}),e.jsx("div",{className:"shrink-0 lg:w-[280px]",children:e.jsx("div",{className:"relative overflow-hidden rounded-lg border border-amber-500/20 bg-amber-500/5 p-4 transition-colors group-hover:border-amber-500/30 group-hover:bg-amber-500/10 dark:border-amber-400/10 dark:bg-amber-400/5",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ds,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-600 dark:text-amber-400"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[11px] font-bold text-amber-700 dark:text-amber-300 uppercase tracking-wider",children:"Formatting Note"}),e.jsx("p",{className:"text-[13px] leading-relaxed text-amber-800/80 dark:text-amber-200/70",children:"Saves normalize TOML formatting and strip comments. Switch to the raw editor if exact layout matters."})]})]})})})]})]}),e.jsx(Gs,{values:r,providerNames:n.map(h=>h.name),disabled:d,disabledReason:x,saving:m,onSave:h=>p({kind:"top-level",values:h},N("toasts.codexSaved"))}),e.jsx(Is,{workspacePath:s,entries:l,disabled:d,disabledReason:x,saving:m,onSave:(h,b)=>p({kind:"project-trust",path:h,trustLevel:b},b?"Saved project trust entry.":"Removed project trust entry.")}),e.jsx(Rs,{activeProfile:t,entries:o,providerNames:n.map(h=>h.name),disabled:d,disabledReason:x,saving:m,onSave:(h,b,R)=>p({kind:"profile",action:"upsert",name:h,values:b,setAsActive:R},"Saved profile."),onDelete:h=>p({kind:"profile",action:"delete",name:h},"Deleted profile."),onSetActive:h=>p({kind:"profile",action:"set-active",name:h},"Set active profile.")}),e.jsx(Ls,{entries:n,disabled:d,disabledReason:x,saving:m,onSave:(h,b)=>p({kind:"model-provider",action:"upsert",name:h,values:b},"Saved model provider."),onDelete:h=>p({kind:"model-provider",action:"delete",name:h},"Deleted model provider.")}),e.jsx(Es,{entries:a,disabled:d,disabledReason:x,saving:m,onSave:(h,b)=>p({kind:"mcp-server",action:"upsert",name:h,values:b},"Saved MCP server."),onDelete:h=>p({kind:"mcp-server",action:"delete",name:h},"Deleted MCP server.")}),e.jsx(_s,{catalog:c,state:i,disabled:d,disabledReason:x,onToggle:(h,b)=>p({kind:"feature",feature:h,enabled:b},"Saved feature toggle.")})]})})}const De=`model_provider = "cliproxy"
|
|
2
|
-
|
|
3
|
-
[model_providers.cliproxy]
|
|
4
|
-
base_url = "http://127.0.0.1:8317/api/provider/codex"
|
|
5
|
-
env_key = "CLIPROXY_API_KEY"
|
|
6
|
-
wire_api = "responses"`,Xs=["multi_agent","unified_exec","shell_snapshot","apply_patch_freeform","js_repl","runtime_metrics","prevent_idle_sleep","fast_mode","apps","smart_approvals"];function $s(){return[{name:"multi_agent",label:y.t("codex.featureMultiAgentLabel"),description:y.t("codex.featureMultiAgentDesc")},{name:"unified_exec",label:y.t("codex.featureUnifiedExecLabel"),description:y.t("codex.featureUnifiedExecDesc")},{name:"shell_snapshot",label:y.t("codex.featureShellSnapshotLabel"),description:y.t("codex.featureShellSnapshotDesc")},{name:"apply_patch_freeform",label:y.t("codex.featureApplyPatchLabel"),description:y.t("codex.featureApplyPatchDesc")},{name:"js_repl",label:y.t("codex.featureJsReplLabel"),description:y.t("codex.featureJsReplDesc")},{name:"runtime_metrics",label:y.t("codex.featureRuntimeMetricsLabel"),description:y.t("codex.featureRuntimeMetricsDesc")},{name:"prevent_idle_sleep",label:y.t("codex.featurePreventIdleSleepLabel"),description:y.t("codex.featurePreventIdleSleepDesc")},{name:"fast_mode",label:y.t("codex.featureFastModeLabel"),description:y.t("codex.featureFastModeDesc")},{name:"apps",label:y.t("codex.featureAppsLabel"),description:y.t("codex.featureAppsDesc")},{name:"smart_approvals",label:y.t("codex.featureSmartApprovalsLabel"),description:y.t("codex.featureSmartApprovalsDesc")}]}function G(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)?s:null}function T(s){return typeof s=="string"&&s.trim().length>0?s.trim():null}function Q(s){return typeof s=="number"&&Number.isFinite(s)?s:null}function ue(s){return Array.isArray(s)?s.filter(t=>typeof t=="string").map(t=>t.trim()):[]}function Le(s){return{model:T(s?.model),modelReasoningEffort:T(s?.model_reasoning_effort),modelContextWindow:Q(s?.model_context_window),modelAutoCompactTokenLimit:Q(s?.model_auto_compact_token_limit),modelProvider:T(s?.model_provider),approvalPolicy:T(s?.approval_policy),sandboxMode:T(s?.sandbox_mode),webSearch:T(s?.web_search),toolOutputTokenLimit:Q(s?.tool_output_token_limit),personality:T(s?.personality)}}function Bs(s){const t=G(s?.projects);return t?Object.entries(t).map(([r,l])=>{const o=T(G(l)?.trust_level);return o?{path:r,trustLevel:o}:null}).filter(r=>r!==null).sort((r,l)=>r.path.localeCompare(l.path)):[]}function Ys(s){const t=G(s?.profiles);return t?Object.entries(t).map(([r,l])=>({name:r,values:Le(G(l))})).sort((r,l)=>r.name.localeCompare(l.name)):[]}function Hs(s){const t=G(s?.model_providers);return t?Object.entries(t).map(([r,l])=>{const o=G(l);return o?{name:r,displayName:T(o.name),baseUrl:T(o.base_url),envKey:T(o.env_key),wireApi:T(o.wire_api),requiresOpenaiAuth:o.requires_openai_auth===!0,supportsWebsockets:o.supports_websockets===!0}:null}).filter(r=>r!==null).sort((r,l)=>r.name.localeCompare(l.name)):[]}function Qs(s){const t=G(s?.mcp_servers);return t?Object.entries(t).map(([r,l])=>{const o=G(l);if(!o)return null;const n=T(o.command)?"stdio":"streamable-http",a=Q(o.startup_timeout_ms);return{name:r,transport:n,command:T(o.command),args:ue(o.args),url:T(o.url),enabled:o.enabled!==!1,required:o.required===!0,startupTimeoutSec:Q(o.startup_timeout_sec)??(a!==null?a/1e3:null),toolTimeoutSec:Q(o.tool_timeout_sec),enabledTools:ue(o.enabled_tools),disabledTools:ue(o.disabled_tools)}}).filter(r=>r!==null).sort((r,l)=>r.name.localeCompare(l.name)):[]}function Js(s){const t=G(s?.features),r={};for(const l of Xs){const o=t?.[l];r[l]=typeof o=="boolean"?o:null}if(t)for(const[l,o]of Object.entries(t))l in r||(r[l]=typeof o=="boolean"?o:null);return r}const Zs=[{id:"codex-config-basic",label:"Codex Config Basics",url:"https://developers.openai.com/codex/config-basic",description:"Official user-layer setup, config location, and baseline configuration behavior."},{id:"codex-config-advanced",label:"Codex Config Advanced",url:"https://developers.openai.com/codex/config-advanced",description:"Layering, trust, profiles, and advanced config behavior."},{id:"codex-config-reference",label:"Codex Config Reference",url:"https://developers.openai.com/codex/config-reference",description:"Canonical upstream config surface for providers, MCP, features, and trust."},{id:"codex-releases",label:"Codex GitHub Releases",url:"https://github.com/openai/codex/releases",description:"Track upstream release notes and fast-moving CLI changes."}],et=[{provider:"openai",label:"OpenAI Responses API",apiFormat:"Responses API",url:"https://platform.openai.com/docs/api-reference/responses"}];function st(s){const t=/https?:\/\/[^\s)]+/g,r=[];let l=0,o;for(;(o=t.exec(s))!==null;){const[n]=o,a=o.index;a>l&&r.push(s.slice(l,a)),r.push(e.jsx("a",{href:n,target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:n},`${n}-${a}`)),l=a+n.length}return l<s.length&&r.push(s.slice(l)),r.length>0?r:[s]}function tt({diagnostics:s}){const{t}=E(),r=s.docsReference??{notes:[],links:[],providerDocs:[],providerValues:[],settingsHierarchy:[]},l=r.links.length>0?r.links:Zs,o=r.providerDocs.length>0?r.providerDocs:et;return e.jsx(fe,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 pr-1",children:[e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(W,{className:"flex items-center gap-2 text-base",children:[e.jsx(me,{className:"h-4 w-4"}),"CCS bridge recipe"]})}),e.jsxs(K,{className:"space-y-3 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("p",{children:[e.jsx("strong",{children:"Built-in:"})," Use ",e.jsx("code",{children:"ccsxp"})," for the CCS provider shortcut."]}),e.jsxs("p",{children:[e.jsx("strong",{children:"Native:"})," Configure the recipe below to use CLIProxy directly with"," ",e.jsx("code",{children:"codex"}),"."]})]}),e.jsx("pre",{className:"overflow-x-auto rounded-md border bg-muted/20 p-3 text-xs text-foreground",children:De}),e.jsxs("ol",{className:"ml-4 list-decimal space-y-1.5 [&>li]:pl-1",children:[e.jsxs("li",{children:["Save the ",e.jsx("code",{children:"cliproxy"})," provider in your user config."]}),e.jsxs("li",{children:["Set top-level ",e.jsx("code",{children:"model_provider"})," to ",e.jsx("code",{children:"cliproxy"}),"."]}),e.jsxs("li",{children:["Export ",e.jsx("code",{children:"CLIPROXY_API_KEY"})," before launching native Codex."]})]})]})]}),e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(W,{className:"flex items-center gap-2 text-base",children:[e.jsx(me,{className:"h-4 w-4"}),"Upstream notes"]})}),e.jsxs(K,{className:"space-y-2 text-sm",children:[r.notes.length>0&&e.jsx("ul",{className:"ml-4 list-disc space-y-1.5 text-muted-foreground [&>li]:pl-1",children:r.notes.map((n,a)=>e.jsx("li",{children:st(n)},`${a}-${n}`))}),e.jsx(ee,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:t("codex.codexDocs")}),e.jsx("div",{className:"space-y-1.5",children:l.map(n=>e.jsxs("a",{href:n.url,target:"_blank",rel:"noreferrer",className:"block rounded-md border px-2.5 py-2 transition-colors hover:bg-muted/50",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-xs font-medium",children:n.label}),e.jsx(we,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),e.jsx("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:n.description}),e.jsx("p",{className:"mt-1 break-all font-mono text-[11px] text-muted-foreground/90 underline underline-offset-2",children:n.url})]},n.id))})]}),e.jsx(ee,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:"Provider / bridge reference"}),e.jsx("div",{className:"space-y-1.5",children:o.map(n=>e.jsxs("a",{href:n.url,target:"_blank",rel:"noreferrer",className:"block rounded-md border px-2.5 py-2 transition-colors hover:bg-muted/50",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-xs font-medium",children:n.label}),e.jsx(we,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),e.jsxs("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:["provider: ",n.provider," | format: ",n.apiFormat]}),e.jsx("p",{className:"mt-1 break-all font-mono text-[11px] text-muted-foreground/90 underline underline-offset-2",children:n.url})]},`${n.provider}-${n.url}`))})]}),r.providerValues.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(ee,{}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Provider values: ",r.providerValues.join(", ")]})]}),r.settingsHierarchy.length>0&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Settings hierarchy: ",r.settingsHierarchy.join(" -> ")]})]})]})]})})}function rt(s,t){let r=s.slice(0,t).split(/\r\n|\n|\r/g);return[r.length,r.pop().length+1]}function nt(s,t,r){let l=s.split(/\r\n|\n|\r/g),o="",n=(Math.log10(t+1)|0)+1;for(let a=t-1;a<=t+1;a++){let c=l[a-1];c&&(o+=a.toString().padEnd(n," "),o+=": ",o+=c,o+=`
|
|
7
|
-
`,a===t&&(o+=" ".repeat(n+r+2),o+=`^
|
|
8
|
-
`))}return o}class f extends Error{line;column;codeblock;constructor(t,r){const[l,o]=rt(r.toml,r.ptr),n=nt(r.toml,l,o);super(`Invalid TOML document: ${t}
|
|
9
|
-
|
|
10
|
-
${n}`,r),this.line=l,this.column=o,this.codeblock=n}}function at(s,t){let r=0;for(;s[t-++r]==="\\";);return--r&&r%2}function pe(s,t=0,r=s.length){let l=s.indexOf(`
|
|
11
|
-
`,t);return s[l-1]==="\r"&&l--,l<=r?l:-1}function re(s,t){for(let r=t;r<s.length;r++){let l=s[r];if(l===`
|
|
12
|
-
`)return r;if(l==="\r"&&s[r+1]===`
|
|
13
|
-
`)return r+1;if(l<" "&&l!==" "||l==="")throw new f("control characters are not allowed in comments",{toml:s,ptr:t})}return s.length}function V(s,t,r,l){let o;for(;;){for(;(o=s[t])===" "||o===" "||!r&&(o===`
|
|
14
|
-
`||o==="\r"&&s[t+1]===`
|
|
15
|
-
`);)t++;if(l||o!=="#")break;t=re(s,t)}return t}function ot(s,t,r,l,o=!1){if(!l)return t=pe(s,t),t<0?s.length:t;for(let n=t;n<s.length;n++){let a=s[n];if(a==="#")n=pe(s,n);else{if(a===r)return n+1;if(a===l||o&&(a===`
|
|
16
|
-
`||a==="\r"&&s[n+1]===`
|
|
17
|
-
`))return n}}throw new f("cannot find end of structure",{toml:s,ptr:t})}function Ae(s,t){let r=s[t],l=r===s[t+1]&&s[t+1]===s[t+2]?s.slice(t,t+3):r;t+=l.length-1;do t=s.indexOf(l,++t);while(t>-1&&r!=="'"&&at(s,t));return t>-1&&(t+=l.length,l.length>1&&(s[t]===r&&t++,s[t]===r&&t++)),t}let lt=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;class H extends Date{#s=!1;#t=!1;#e=null;constructor(t){let r=!0,l=!0,o="Z";if(typeof t=="string"){let n=t.match(lt);n?(n[1]||(r=!1,t=`0000-01-01T${t}`),l=!!n[2],l&&t[10]===" "&&(t=t.replace(" ","T")),n[2]&&+n[2]>23?t="":(o=n[3]||null,t=t.toUpperCase(),!o&&l&&(t+="Z"))):t=""}super(t),isNaN(this.getTime())||(this.#s=r,this.#t=l,this.#e=o)}isDateTime(){return this.#s&&this.#t}isLocal(){return!this.#s||!this.#t||!this.#e}isDate(){return this.#s&&!this.#t}isTime(){return this.#t&&!this.#s}isValid(){return this.#s||this.#t}toISOString(){let t=super.toISOString();if(this.isDate())return t.slice(0,10);if(this.isTime())return t.slice(11,23);if(this.#e===null)return t.slice(0,-1);if(this.#e==="Z")return t;let r=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return r=this.#e[0]==="-"?r:-r,new Date(this.getTime()-r*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(t,r="Z"){let l=new H(t);return l.#e=r,l}static wrapAsLocalDateTime(t){let r=new H(t);return r.#e=null,r}static wrapAsLocalDate(t){let r=new H(t);return r.#t=!1,r.#e=null,r}static wrapAsLocalTime(t){let r=new H(t);return r.#s=!1,r.#e=null,r}}let it=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,ct=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,dt=/^[+-]?0[0-9_]/,xt=/^[0-9a-f]{2,8}$/i,Te={b:"\b",t:" ",n:`
|
|
18
|
-
`,f:"\f",r:"\r",e:"\x1B",'"':'"',"\\":"\\"};function Re(s,t=0,r=s.length){let l=s[t]==="'",o=s[t++]===s[t]&&s[t]===s[t+1];o&&(r-=2,s[t+=2]==="\r"&&t++,s[t]===`
|
|
19
|
-
`&&t++);let n=0,a,c="",i=t;for(;t<r-1;){let d=s[t++];if(d===`
|
|
20
|
-
`||d==="\r"&&s[t]===`
|
|
21
|
-
`){if(!o)throw new f("newlines are not allowed in strings",{toml:s,ptr:t-1})}else if(d<" "&&d!==" "||d==="")throw new f("control characters are not allowed in strings",{toml:s,ptr:t-1});if(a){if(a=!1,d==="x"||d==="u"||d==="U"){let x=s.slice(t,t+=d==="x"?2:d==="u"?4:8);if(!xt.test(x))throw new f("invalid unicode escape",{toml:s,ptr:n});try{c+=String.fromCodePoint(parseInt(x,16))}catch{throw new f("invalid unicode escape",{toml:s,ptr:n})}}else if(o&&(d===`
|
|
22
|
-
`||d===" "||d===" "||d==="\r")){if(t=V(s,t-1,!0),s[t]!==`
|
|
23
|
-
`&&s[t]!=="\r")throw new f("invalid escape: only line-ending whitespace may be escaped",{toml:s,ptr:n});t=V(s,t)}else if(d in Te)c+=Te[d];else throw new f("unrecognized escape sequence",{toml:s,ptr:n});i=t}else!l&&d==="\\"&&(n=t-1,a=!0,c+=s.slice(i,n))}return c+s.slice(i,r-1)}function ut(s,t,r,l){if(s==="true")return!0;if(s==="false")return!1;if(s==="-inf")return-1/0;if(s==="inf"||s==="+inf")return 1/0;if(s==="nan"||s==="+nan"||s==="-nan")return NaN;if(s==="-0")return l?0n:0;let o=it.test(s);if(o||ct.test(s)){if(dt.test(s))throw new f("leading zeroes are not allowed",{toml:t,ptr:r});s=s.replace(/_/g,"");let a=+s;if(isNaN(a))throw new f("invalid number",{toml:t,ptr:r});if(o){if((o=!Number.isSafeInteger(a))&&!l)throw new f("integer value cannot be represented losslessly",{toml:t,ptr:r});(o||l===!0)&&(a=BigInt(s))}return a}const n=new H(s);if(!n.isValid())throw new f("invalid value",{toml:t,ptr:r});return n}function mt(s,t,r){let l=s.slice(t,r),o=l.indexOf("#");return o>-1&&(re(s,o),l=l.slice(0,o)),[l.trimEnd(),o]}function je(s,t,r,l,o){if(l===0)throw new f("document contains excessively nested structures. aborting.",{toml:s,ptr:t});let n=s[t];if(n==="["||n==="{"){let[i,d]=n==="["?ft(s,t,l,o):ht(s,t,l,o);if(r){if(d=V(s,d),s[d]===",")d++;else if(s[d]!==r)throw new f("expected comma or end of structure",{toml:s,ptr:d})}return[i,d]}let a;if(n==='"'||n==="'"){a=Ae(s,t);let i=Re(s,t,a);if(r){if(a=V(s,a),s[a]&&s[a]!==","&&s[a]!==r&&s[a]!==`
|
|
24
|
-
`&&s[a]!=="\r")throw new f("unexpected character encountered",{toml:s,ptr:a});a+=+(s[a]===",")}return[i,a]}a=ot(s,t,",",r);let c=mt(s,t,a-+(s[a-1]===","));if(!c[0])throw new f("incomplete key-value declaration: no value specified",{toml:s,ptr:t});return r&&c[1]>-1&&(a=V(s,t+c[1]),a+=+(s[a]===",")),[ut(c[0],s,t,o),a]}let pt=/^[a-zA-Z0-9-_]+[ \t]*$/;function he(s,t,r="="){let l=t-1,o=[],n=s.indexOf(r,t);if(n<0)throw new f("incomplete key-value: cannot find end of key",{toml:s,ptr:t});do{let a=s[t=++l];if(a!==" "&&a!==" ")if(a==='"'||a==="'"){if(a===s[t+1]&&a===s[t+2])throw new f("multiline strings are not allowed in keys",{toml:s,ptr:t});let c=Ae(s,t);if(c<0)throw new f("unfinished string encountered",{toml:s,ptr:t});l=s.indexOf(".",c);let i=s.slice(c,l<0||l>n?n:l),d=pe(i);if(d>-1)throw new f("newlines are not allowed in keys",{toml:s,ptr:t+l+d});if(i.trimStart())throw new f("found extra tokens after the string part",{toml:s,ptr:c});if(n<c&&(n=s.indexOf(r,c),n<0))throw new f("incomplete key-value: cannot find end of key",{toml:s,ptr:t});o.push(Re(s,t,c))}else{l=s.indexOf(".",t);let c=s.slice(t,l<0||l>n?n:l);if(!pt.test(c))throw new f("only letter, numbers, dashes and underscores are allowed in keys",{toml:s,ptr:t});o.push(c.trimEnd())}}while(l+1&&l<n);return[o,V(s,n+1,!0,!0)]}function ht(s,t,r,l){let o={},n=new Set,a;for(t++;(a=s[t++])!=="}"&&a;){if(a===",")throw new f("expected value, found comma",{toml:s,ptr:t-1});if(a==="#")t=re(s,t);else if(a!==" "&&a!==" "&&a!==`
|
|
25
|
-
`&&a!=="\r"){let c,i=o,d=!1,[x,m]=he(s,t-1);for(let h=0;h<x.length;h++){if(h&&(i=d?i[c]:i[c]={}),c=x[h],(d=Object.hasOwn(i,c))&&(typeof i[c]!="object"||n.has(i[c])))throw new f("trying to redefine an already defined value",{toml:s,ptr:t});!d&&c==="__proto__"&&Object.defineProperty(i,c,{enumerable:!0,configurable:!0,writable:!0})}if(d)throw new f("trying to redefine an already defined value",{toml:s,ptr:t});let[p,N]=je(s,m,"}",r-1,l);n.add(p),i[c]=p,t=N}}if(!a)throw new f("unfinished table encountered",{toml:s,ptr:t});return[o,t]}function ft(s,t,r,l){let o=[],n;for(t++;(n=s[t++])!=="]"&&n;){if(n===",")throw new f("expected value, found comma",{toml:s,ptr:t-1});if(n==="#")t=re(s,t);else if(n!==" "&&n!==" "&&n!==`
|
|
26
|
-
`&&n!=="\r"){let a=je(s,t-1,"]",r-1,l);o.push(a[0]),t=a[1]}}if(!n)throw new f("unfinished array encountered",{toml:s,ptr:t});return[o,t]}function Ee(s,t,r,l){let o=t,n=r,a,c=!1,i;for(let d=0;d<s.length;d++){if(d){if(o=c?o[a]:o[a]={},n=(i=n[a]).c,l===0&&(i.t===1||i.t===2))return null;if(i.t===2){let x=o.length-1;o=o[x],n=n[x].c}}if(a=s[d],(c=Object.hasOwn(o,a))&&n[a]?.t===0&&n[a]?.d)return null;c||(a==="__proto__"&&(Object.defineProperty(o,a,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(n,a,{enumerable:!0,configurable:!0,writable:!0})),n[a]={t:d<s.length-1&&l===2?3:l,d:!1,i:0,c:{}})}if(i=n[a],i.t!==l&&!(l===1&&i.t===3)||(l===2&&(i.d||(i.d=!0,o[a]=[]),o[a].push(o={}),i.c[i.i++]=i={t:1,d:!1,i:0,c:{}}),i.d))return null;if(i.d=!0,l===1)o=c?o[a]:o[a]={};else if(l===0&&c)return null;return[a,o,i.c]}function jt(s,{maxDepth:t=1e3,integersAsBigInt:r}={}){let l={},o={},n=l,a=o;for(let c=V(s,0);c<s.length;){if(s[c]==="["){let i=s[++c]==="[",d=he(s,c+=+i,"]");if(i){if(s[d[1]-1]!=="]")throw new f("expected end of table declaration",{toml:s,ptr:d[1]-1});d[1]++}let x=Ee(d[0],l,o,i?2:1);if(!x)throw new f("trying to redefine an already defined table or value",{toml:s,ptr:c});a=x[2],n=x[1],c=d[1]}else{let i=he(s,c),d=Ee(i[0],n,a,0);if(!d)throw new f("trying to redefine an already defined table or value",{toml:s,ptr:c});let x=je(s,i[1],void 0,t,r);d[1][d[0]]=x[0],c=x[1]}if(c=V(s,c,!0),s[c]&&s[c]!==`
|
|
27
|
-
`&&s[c]!=="\r")throw new f("each key-value declaration must be followed by an end-of-line",{toml:s,ptr:c});c=V(s,c)}return l}function gt(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)}function vt(s){if(!s.trim())return{};const r=jt(s);if(!gt(r))throw new Error("TOML root must be a table.");return r}function Me(s){try{return{config:vt(s),parseError:null}}catch(t){return{config:null,parseError:t.message}}}async function bt(){const s=await fetch(se("/codex/diagnostics"));if(!s.ok)throw new Error("Failed to fetch Codex diagnostics");return s.json()}async function wt(){const s=await fetch(se("/codex/config/raw"));if(!s.ok)throw new Error("Failed to fetch Codex raw config");return s.json()}async function Nt(s){const t=await fetch(se("/codex/config/raw"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(t.status===409)throw new Pe("Codex raw config changed externally");if(!t.ok){const r=await t.json().catch(()=>null);throw new Error(r?.error||"Failed to save Codex raw config")}return t.json()}async function yt(s){const t=await fetch(se("/codex/config/patch"),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(t.status===409)throw new Pe("Codex config changed externally");if(!t.ok){const r=await t.json().catch(()=>null);throw new Error(r?.error||"Failed to patch Codex config")}return t.json()}function Ct(){const s=ws(),t=ye({queryKey:["codex-diagnostics"],queryFn:bt,refetchInterval:1e4}),r=ye({queryKey:["codex-raw-config"],queryFn:wt}),l=Ce({mutationFn:Nt,onSuccess:(n,a)=>{s.setQueryData(["codex-raw-config"],c=>{const i=c?.path??"$CODEX_HOME/config.toml",d=c?.resolvedPath??i,x=Me(a.rawText);return{path:i,resolvedPath:d,exists:!0,mtime:n.mtime,rawText:a.rawText,config:x.config,parseError:x.parseError,readError:null}}),s.invalidateQueries({queryKey:["codex-diagnostics"]})}}),o=Ce({mutationFn:yt,onSuccess:n=>{s.setQueryData(["codex-raw-config"],n),s.invalidateQueries({queryKey:["codex-diagnostics"]})}});return w.useMemo(()=>({diagnostics:t.data,diagnosticsLoading:t.isLoading,diagnosticsError:t.error,refetchDiagnostics:t.refetch,rawConfig:r.data,rawConfigLoading:r.isLoading,rawConfigError:r.error,refetchRawConfig:r.refetch,saveRawConfig:l.mutate,saveRawConfigAsync:l.mutateAsync,isSavingRawConfig:l.isPending,patchConfig:o.mutate,patchConfigAsync:o.mutateAsync,isPatchingConfig:o.isPending}),[t.data,t.isLoading,t.error,t.refetch,r.data,r.isLoading,r.error,r.refetch,l.mutate,l.mutateAsync,l.isPending,o.mutate,o.mutateAsync,o.isPending])}const St=[{label:"Start Default",command:"ccs",description:"Launch Claude with default profile"},{label:"GLM Profile",command:"ccs glm",description:"Switch to GLM model"},{label:"Health Check",command:"ccs doctor",description:"Run system diagnostics"},{label:"Delegate Task",command:'ccs glm -p "your task"',description:"Delegate to GLM profile"}];function _t({snippets:s=St}){const[t,r]=w.useState(null),{t:l}=E(),o=async(n,a)=>{await navigator.clipboard.writeText(n),r(a),setTimeout(()=>r(null),2e3)};return e.jsxs(I,{children:[e.jsx(F,{className:"pb-3",children:e.jsxs(W,{className:"text-lg flex items-center gap-2",children:[e.jsx(xs,{className:"w-5 h-5 text-muted-foreground"}),l("quickCommands.title")]})}),e.jsx(K,{children:e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:s.map((n,a)=>e.jsxs("div",{className:Oe("group flex items-center justify-between gap-2 px-3 py-2","rounded-lg border bg-muted/30 hover:bg-muted/50 transition-colors"),children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:n.label}),e.jsx("code",{className:"text-sm font-mono font-medium truncate block",children:n.command})]}),e.jsx(C,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>o(n.command,a),title:n.description,children:t===a?e.jsx(us,{className:"h-4 w-4 text-green-600"}):e.jsx(ms,{className:"h-4 w-4"})})]},a))})})]})}function kt(s){return!s||!Number.isFinite(s)?"N/A":new Date(s).toLocaleString()}function Tt(s){return!s||s<=0?"0 B":s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(2)} MB`}function k({label:s,value:t,mono:r=!1}){return e.jsxs("div",{className:"flex items-start justify-between gap-3 text-sm",children:[e.jsx("span",{className:"text-muted-foreground shrink-0",children:s}),e.jsx("span",{className:Oe("text-right break-all",r&&"font-mono text-xs"),children:t})]})}function Et({diagnostics:s}){const{t}=E(),r=s.config.activeProfile?`codex --profile ${s.config.activeProfile}`:"codex",l=s.binary.supportsConfigOverrides;return e.jsx(fe,{className:"h-full",children:e.jsxs("div",{className:"space-y-4 pr-1",children:[e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(W,{className:"flex items-center gap-2 text-base",children:[e.jsx(ps,{className:"h-4 w-4"}),t("codex.howCodexWorks")]})}),e.jsx(K,{className:"text-sm text-muted-foreground",children:e.jsxs("ul",{className:"ml-4 list-disc space-y-1.5 [&>li]:pl-1",children:[e.jsx("li",{children:t("codex.nativeDesc")}),e.jsxs("li",{children:[e.jsx("strong",{children:t("codex.nativeConfigLabel")})," ",t("codex.nativeConfigDesc")]}),e.jsxs("li",{children:[e.jsx("strong",{children:t("codex.transientOverridesLabel")})," ",t("codex.transientOverridesDesc")]}),e.jsxs("li",{children:[e.jsx("strong",{children:t("codex.cliproxyDefaultLabel")})," ",t("codex.cliproxyDefaultDesc")]}),e.jsx("li",{children:t("codex.apiProfilesDefault")})]})})]}),e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(W,{className:"flex items-center gap-2 text-base",children:[e.jsx(hs,{className:"h-4 w-4"}),t("codex.runtimeInstall")]})}),e.jsxs(K,{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:t("codex.status")}),e.jsx(_,{variant:s.binary.installed?"default":"secondary",children:s.binary.installed?t("codex.detected"):t("codex.notFound")})]}),e.jsx(k,{label:t("codex.detectionSource"),value:s.binary.source,mono:!0}),e.jsx(k,{label:t("codex.binaryPath"),value:s.binary.path||t("codex.notFound"),mono:!0}),e.jsx(k,{label:t("codex.installDirectory"),value:s.binary.installDir||"N/A",mono:!0}),e.jsx(k,{label:t("codex.versionLabel"),value:s.binary.version||"Unknown",mono:!0}),e.jsx(k,{label:t("codex.nativeAliases"),value:"ccs-codex, ccsx",mono:!0}),e.jsx(k,{label:t("codex.ccsProviderShortcut"),value:"ccsxp",mono:!0}),e.jsxs("div",{className:"flex items-center justify-between rounded-md border px-3 py-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:t("codex.configOverrideSupport")}),e.jsx(_,{variant:s.binary.supportsConfigOverrides?"default":"secondary",children:s.binary.supportsConfigOverrides?t("codex.available"):t("codex.missing")})]})]})]}),e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(W,{className:"flex items-center gap-2 text-base",children:[e.jsx(Ne,{className:"h-4 w-4"}),t("codex.cliproxyNativeCodex")]})}),e.jsx(K,{className:"space-y-3 text-sm text-muted-foreground",children:l?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{children:e.jsx("strong",{children:t("codex.twoSupportedPaths")})}),e.jsxs("ul",{className:"ml-4 list-disc space-y-1 [&>li]:pl-1",children:[e.jsxs("li",{children:[e.jsx("strong",{children:t("codex.builtInLabel")})," ",t("codex.builtInCcsxpDesc")]}),e.jsxs("li",{children:[e.jsx("strong",{children:t("codex.nativeRecipeLabel")})," ",t("codex.nativeRecipeDesc")]})]})]}),e.jsxs("div",{className:"rounded-md border bg-muted/20 p-3",children:[e.jsx("p",{className:"font-medium text-foreground",children:t("codex.codexNativeRecipe")}),e.jsx("pre",{className:"mt-2 overflow-x-auto rounded-md bg-background p-3 text-xs text-foreground",children:De})]}),e.jsxs("ol",{className:"ml-4 list-decimal space-y-1.5 [&>li]:pl-1",children:[e.jsx("li",{children:t("codex.saveProviderNamedCliproxy")}),e.jsx("li",{children:t("codex.inTopLevelSetDefault")}),e.jsx("li",{children:t("codex.exportCliproxyApiKey")})]})]}):e.jsx("p",{children:t("codex.noConfigOverrides")})})]}),e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(W,{className:"flex items-center gap-2 text-base",children:[e.jsx(fs,{className:"h-4 w-4"}),t("codex.configFile")]})}),e.jsx(K,{className:"space-y-3",children:e.jsxs("div",{className:"rounded-md border p-3 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"font-medium text-sm",children:t("codex.userConfig")}),s.file.exists?e.jsx(js,{className:"h-4 w-4 text-green-600"}):e.jsx(gs,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(k,{label:t("codex.path"),value:s.file.path,mono:!0}),e.jsx(k,{label:t("codex.resolved"),value:s.file.resolvedPath,mono:!0}),e.jsx(k,{label:t("codex.size"),value:Tt(s.file.sizeBytes)}),e.jsx(k,{label:t("codex.lastModified"),value:kt(s.file.mtimeMs)}),s.file.parseError&&e.jsxs("p",{className:"text-xs text-amber-600",children:[t("codex.tomlWarning"),": ",s.file.parseError]}),s.file.readError&&e.jsxs("p",{className:"text-xs text-destructive",children:[t("codex.readWarning"),": ",s.file.readError]})]})})]}),e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(W,{className:"flex items-center gap-2 text-base",children:[e.jsx(me,{className:"h-4 w-4"}),t("codex.currentUserLayerSummary")]})}),e.jsxs(K,{className:"space-y-3",children:[e.jsx(k,{label:t("codex.model"),value:s.config.model||t("codex.notSet"),mono:!0}),e.jsx(k,{label:t("codex.defaultProvider"),value:s.config.modelProvider||t("codex.notSet"),mono:!0}),e.jsx(k,{label:t("codex.activeProfile"),value:s.config.activeProfile||t("codex.notSet"),mono:!0}),e.jsx(k,{label:t("codex.approvalPolicy"),value:s.config.approvalPolicy||t("codex.notSet"),mono:!0}),e.jsx(k,{label:t("codex.sandboxMode"),value:s.config.sandboxMode||t("codex.notSet"),mono:!0}),e.jsx(k,{label:t("codex.webSearch"),value:s.config.webSearch||t("codex.notSet"),mono:!0}),e.jsx(ee,{}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsx(_,{variant:"outline",className:"justify-center",children:t("codex.providersCount",{count:s.config.modelProviderCount})}),e.jsx(_,{variant:"outline",className:"justify-center",children:t("codex.profilesCount",{count:s.config.profileCount})}),e.jsx(_,{variant:"outline",className:"justify-center",children:t("codex.enabledFeaturesCount",{count:s.config.enabledFeatures.length})}),e.jsx(_,{variant:"outline",className:"justify-center",children:t("codex.mcpServersCount",{count:s.config.mcpServerCount})})]}),s.config.topLevelKeys.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:t("codex.userLayerKeysPresent")}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.config.topLevelKeys.map(o=>e.jsx(_,{variant:"secondary",className:"font-mono text-[10px]",children:o},o))})]})]})]}),e.jsx(_t,{snippets:[{label:t("codex.nativeShortAlias"),command:"ccsx",description:"Launch the short native Codex runtime alias."},{label:t("codex.ccsCodexShortcut"),command:'ccsxp "your prompt"',description:l?t("codex.runBuiltInCodex"):"Requires a Codex build that exposes --config overrides."},{label:t("codex.explicitProviderRoute"),command:'ccs codex --target codex "your prompt"',description:l?t("codex.runBuiltInCodexExplicit"):"Requires a Codex build that exposes --config overrides."},{label:s.config.activeProfile?"Inspect active profile":t("codex.openNativeCodex"),command:r,description:s.config.activeProfile?"Inspect the active named profile directly in native Codex.":"Open native Codex without forcing a named profile overlay."}]}),e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsxs(W,{className:"flex items-center gap-2 text-base",children:[e.jsx(Ne,{className:"h-4 w-4"}),t("codex.runtimeVsProvider")]})}),e.jsxs(K,{className:"grid gap-3 md:grid-cols-2",children:[e.jsxs("div",{className:"flex flex-col rounded-md border p-3 text-sm",children:[e.jsx("p",{className:"font-medium text-foreground",children:t("codex.nativeCodexRuntime")}),e.jsxs("ul",{className:"mt-2 flex-grow list-disc space-y-1.5 pl-4 text-muted-foreground [&>li]:pl-1",children:[e.jsx("li",{children:e.jsx("code",{children:"ccs-codex"})}),e.jsx("li",{children:e.jsx("code",{children:"ccsx"})}),e.jsx("li",{children:e.jsx("code",{children:"--target codex"})})]}),e.jsx(_,{variant:"secondary",className:"mt-4 w-fit justify-center font-normal",children:t("codex.honorsSavedNativeConfig")})]}),e.jsxs("div",{className:"flex flex-col rounded-md border p-3 text-sm",children:[e.jsx("p",{className:"font-medium text-foreground",children:t("codex.ccsCodexProvider")}),l?e.jsxs(e.Fragment,{children:[e.jsxs("ul",{className:"mt-2 flex-grow list-disc space-y-1.5 pl-4 text-muted-foreground [&>li]:pl-1",children:[e.jsx("li",{children:e.jsx("code",{children:"ccsxp"})}),e.jsx("li",{children:e.jsx("code",{children:"ccs codex --target codex"})})]}),e.jsx(_,{variant:"secondary",className:"mt-4 w-fit justify-center font-normal",children:t("codex.usesTransientOverrides")})]}):e.jsx("p",{className:"mt-2 text-muted-foreground",children:t("codex.unavailableNoConfig")})]})]})]}),e.jsxs(I,{children:[e.jsx(F,{className:"pb-2",children:e.jsx(W,{className:"text-base",children:t("codex.supportedFlows")})}),e.jsx(K,{children:e.jsxs(Ns,{children:[e.jsx(ys,{children:e.jsxs(Se,{children:[e.jsx(le,{children:t("codex.flow")}),e.jsx(le,{children:t("codex.status")}),e.jsx(le,{children:t("codex.notes")})]})}),e.jsx(Cs,{children:s.supportMatrix.map(o=>e.jsxs(Se,{children:[e.jsx(ie,{className:"font-mono text-xs",children:o.label}),e.jsx(ie,{children:e.jsx(_,{variant:o.supported?"default":"secondary",children:o.supported?t("codex.yes"):t("codex.no")})}),e.jsx(ie,{className:"text-xs text-muted-foreground",children:o.notes})]},o.id))})]})})]}),s.warnings.length>0&&e.jsxs(I,{className:"border-amber-200 bg-amber-50/50 dark:bg-amber-950/20",children:[e.jsx(F,{className:"pb-2",children:e.jsxs(W,{className:"flex items-center gap-2 text-base",children:[e.jsx(vs,{className:"h-4 w-4 text-amber-600"}),t("codex.warningsTitle")]})}),e.jsx(K,{className:"space-y-1.5",children:s.warnings.map(o=>e.jsxs("p",{className:"text-sm text-amber-800 dark:text-amber-300",children:["- ",o]},o))})]})]})})}function Ut(){const{t:s}=E(),t=$s(),{diagnostics:r,diagnosticsLoading:l,diagnosticsError:o,refetchDiagnostics:n,rawConfig:a,rawConfigLoading:c,rawConfigError:i,refetchRawConfig:d,saveRawConfigAsync:x,isSavingRawConfig:m,patchConfigAsync:p,isPatchingConfig:N}=Ct(),[h,b]=w.useState(null),R=a?.rawText??"",q=h??R,u=h!==null&&h!==R,g=Me(q),z=g.parseError?{valid:!1,error:g.parseError}:{valid:!0},j=a?.config??null,Ie=c||!a||u||a?.parseError!==null||a?.readError!==null,Fe=i?"Structured controls unavailable: failed to load the current config.toml.":a?.readError?`Structured controls unavailable: ${a.readError}`:u?z.valid?"Save or discard raw TOML edits before using structured controls.":"Fix or discard raw TOML edits before using structured controls.":a?.parseError?`Structured controls disabled: ${a.parseError}`:null,We=w.useMemo(()=>Le(j),[j]),Ke=w.useMemo(()=>Bs(j),[j]),qe=w.useMemo(()=>Ys(j),[j]),Ue=w.useMemo(()=>Hs(j),[j]),Ve=w.useMemo(()=>Qs(j),[j]),Ge=w.useMemo(()=>Js(j),[j]),ze=M=>{if(M===R){b(null);return}b(M)},Xe=async()=>{try{if((await Promise.all([n(),d()])).some(X=>!X||X.status==="error"||X.isError||X.error)){U.error(s("toasts.codexRefreshFailed"));return}b(null)}catch(M){U.error(M.message||s("toasts.codexRefreshError"))}},$e=async()=>{if(!z.valid){U.error(s("toasts.codexFixToml"));return}try{await x({rawText:q,expectedMtime:a?.exists?a.mtime:void 0}),b(null),U.success(s("toasts.codexSaved")),await n()}catch(M){be(M)?U.error(s("toasts.codexChangedExternally")):U.error(M.message||s("toasts.codexSaveFailed"))}},Be=async(M,ge)=>{try{await p({...M,expectedMtime:a?.exists?a.mtime:void 0}),b(null),U.success(ge)}catch(X){be(X)?U.error(s("toasts.codexChangedExternally")):U.error(X.message||s("toasts.codexUpdateFailed"))}},ne="mt-0 h-full border-0 p-0 data-[state=inactive]:hidden",Ye=()=>l?e.jsxs("div",{className:"flex h-full items-center justify-center text-muted-foreground",children:[e.jsx($,{className:"mr-2 h-5 w-5 animate-spin"}),"Loading Codex diagnostics..."]}):o||!r?e.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-destructive",children:"Failed to load Codex diagnostics."}):e.jsxs(Je,{defaultValue:"overview",className:"flex h-full flex-col",children:[e.jsx("div",{className:"shrink-0 px-4 pt-4",children:e.jsxs(Ze,{className:"grid w-full grid-cols-3",children:[e.jsx(ae,{value:"overview",children:s("codexPage.overview")}),e.jsx(ae,{value:"controls",children:s("codexPage.controlCenter")}),e.jsx(ae,{value:"docs",children:s("codexPage.docs")})]})}),e.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden px-4 pb-4 pt-3",children:[e.jsx(oe,{value:"overview",className:ne,children:e.jsx(Et,{diagnostics:r})}),e.jsx(oe,{value:"controls",className:ne,children:e.jsx(zs,{workspacePath:r.workspacePath,activeProfile:r.config.activeProfile,topLevelSettings:We,projectTrustEntries:Ke,profileEntries:qe,modelProviderEntries:Ue,mcpServerEntries:Ve,featureCatalog:t,featureState:Ge,disabled:Ie,disabledReason:Fe,saving:N,onPatch:Be})}),e.jsx(oe,{value:"docs",className:ne,children:e.jsx(tt,{diagnostics:r})})]})]});return e.jsx("div",{className:"h-full min-h-0 overflow-hidden",children:e.jsxs(He,{direction:"horizontal",className:"h-full",children:[e.jsx(ve,{defaultSize:45,minSize:35,children:e.jsx("div",{className:"h-full border-r bg-muted/20",children:Ye()})}),e.jsx(Qe,{className:"group flex w-2 cursor-col-resize items-center justify-center bg-border transition-colors hover:bg-primary/20",children:e.jsx(bs,{className:"h-3 w-3 text-muted-foreground group-hover:text-primary"})}),e.jsx(ve,{defaultSize:55,minSize:35,children:e.jsx(Ss,{title:"Codex config.toml",pathLabel:a?.path||r?.file.path||"$CODEX_HOME/config.toml",loading:c,parseWarning:z.valid?a?.parseError:z.error,readWarning:a?.readError,value:q,dirty:u,readOnly:!!a?.readError,saving:m,saveDisabled:!u||m||c||!z.valid||!!a?.readError,onChange:M=>{ze(M)},onSave:$e,onRefresh:Xe,onDiscard:()=>b(null),language:"toml",loadingLabel:"Loading config.toml...",parseWarningLabel:"TOML warning",ownershipNotice:e.jsxs("div",{className:"rounded-md border border-amber-200 bg-amber-50/60 px-3 py-2 text-sm text-amber-900 dark:bg-amber-950/20 dark:text-amber-300",children:[e.jsx("p",{className:"font-medium",children:"This file is upstream-owned by Codex CLI."}),e.jsxs("p",{children:["CCS does not keep ",e.jsx("code",{children:"~/.codex/config.toml"})," in sync for you."]}),e.jsxs("p",{children:["CCS-backed Codex launches may apply transient ",e.jsx("code",{children:"-c"})," overrides and",e.jsx("code",{children:" CCS_CODEX_API_KEY"}),"; those effective values may not appear here."]})]})})})]})})}export{Ut as CodexPage};
|