@kaitranntt/ccs 8.10.0-dev.2 → 8.10.0-dev.21
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 +17 -5
- package/claude-mods/ccs-notices/.claude-plugin/plugin.json +1 -0
- package/claude-mods/ccs-notices/hooks/hooks.json +1 -0
- package/claude-mods/ccs-notices/hooks/register.ts +67 -0
- package/claude-mods/ccs-notices/tsconfig.json +3 -0
- package/dist/cliproxy/accounts/account-safety.d.ts +3 -2
- package/dist/cliproxy/accounts/account-safety.d.ts.map +1 -1
- package/dist/cliproxy/accounts/account-safety.js +23 -35
- package/dist/cliproxy/accounts/account-safety.js.map +1 -1
- package/dist/cliproxy/accounts/claude-pool-policy-api.d.ts +12 -0
- package/dist/cliproxy/accounts/claude-pool-policy-api.d.ts.map +1 -0
- package/dist/cliproxy/accounts/claude-pool-policy-api.js +74 -0
- package/dist/cliproxy/accounts/claude-pool-policy-api.js.map +1 -0
- package/dist/cliproxy/accounts/claude-pool-policy-lease.d.ts +11 -0
- package/dist/cliproxy/accounts/claude-pool-policy-lease.d.ts.map +1 -0
- package/dist/cliproxy/accounts/claude-pool-policy-lease.js +55 -0
- package/dist/cliproxy/accounts/claude-pool-policy-lease.js.map +1 -0
- package/dist/cliproxy/accounts/claude-pool-policy-reconciliation.d.ts +13 -0
- package/dist/cliproxy/accounts/claude-pool-policy-reconciliation.d.ts.map +1 -0
- package/dist/cliproxy/accounts/claude-pool-policy-reconciliation.js +215 -0
- package/dist/cliproxy/accounts/claude-pool-policy-reconciliation.js.map +1 -0
- package/dist/cliproxy/accounts/claude-pool-policy-runtime.d.ts +19 -0
- package/dist/cliproxy/accounts/claude-pool-policy-runtime.d.ts.map +1 -0
- package/dist/cliproxy/accounts/claude-pool-policy-runtime.js +65 -0
- package/dist/cliproxy/accounts/claude-pool-policy-runtime.js.map +1 -0
- package/dist/cliproxy/accounts/claude-pool-policy-state.d.ts +37 -0
- package/dist/cliproxy/accounts/claude-pool-policy-state.d.ts.map +1 -0
- package/dist/cliproxy/accounts/claude-pool-policy-state.js +205 -0
- package/dist/cliproxy/accounts/claude-pool-policy-state.js.map +1 -0
- package/dist/cliproxy/accounts/claude-pool-policy.d.ts +48 -0
- package/dist/cliproxy/accounts/claude-pool-policy.d.ts.map +1 -0
- package/dist/cliproxy/accounts/claude-pool-policy.js +401 -0
- package/dist/cliproxy/accounts/claude-pool-policy.js.map +1 -0
- package/dist/cliproxy/accounts/drain-order.d.ts +1 -1
- package/dist/cliproxy/accounts/drain-order.d.ts.map +1 -1
- package/dist/cliproxy/accounts/drain-order.js +17 -0
- package/dist/cliproxy/accounts/drain-order.js.map +1 -1
- package/dist/cliproxy/accounts/email-account-identity.d.ts.map +1 -1
- package/dist/cliproxy/accounts/email-account-identity.js +3 -1
- package/dist/cliproxy/accounts/email-account-identity.js.map +1 -1
- package/dist/cliproxy/accounts/pool-state.d.ts +1 -1
- package/dist/cliproxy/accounts/pool-state.d.ts.map +1 -1
- package/dist/cliproxy/accounts/registry-config.d.ts +4 -0
- package/dist/cliproxy/accounts/registry-config.d.ts.map +1 -0
- package/dist/cliproxy/accounts/registry-config.js +46 -0
- package/dist/cliproxy/accounts/registry-config.js.map +1 -0
- package/dist/cliproxy/accounts/registry.d.ts.map +1 -1
- package/dist/cliproxy/accounts/registry.js +38 -16
- package/dist/cliproxy/accounts/registry.js.map +1 -1
- package/dist/cliproxy/accounts/session-notices.d.ts +35 -0
- package/dist/cliproxy/accounts/session-notices.d.ts.map +1 -0
- package/dist/cliproxy/accounts/session-notices.js +147 -0
- package/dist/cliproxy/accounts/session-notices.js.map +1 -0
- package/dist/cliproxy/accounts/token-file-ops.d.ts +1 -2
- package/dist/cliproxy/accounts/token-file-ops.d.ts.map +1 -1
- package/dist/cliproxy/accounts/token-file-ops.js +2 -7
- package/dist/cliproxy/accounts/token-file-ops.js.map +1 -1
- package/dist/cliproxy/accounts/types.d.ts +1 -1
- package/dist/cliproxy/accounts/types.d.ts.map +1 -1
- package/dist/cliproxy/ai-providers/codex-plan-compatibility.d.ts.map +1 -1
- package/dist/cliproxy/ai-providers/codex-plan-compatibility.js +10 -8
- package/dist/cliproxy/ai-providers/codex-plan-compatibility.js.map +1 -1
- package/dist/cliproxy/ai-providers/codex-reasoning-proxy.d.ts +12 -2
- package/dist/cliproxy/ai-providers/codex-reasoning-proxy.d.ts.map +1 -1
- package/dist/cliproxy/ai-providers/codex-reasoning-proxy.js +107 -88
- package/dist/cliproxy/ai-providers/codex-reasoning-proxy.js.map +1 -1
- package/dist/cliproxy/ai-providers/model-id-normalizer.d.ts +1 -1
- package/dist/cliproxy/ai-providers/model-id-normalizer.d.ts.map +1 -1
- package/dist/cliproxy/ai-providers/model-id-normalizer.js +1 -1
- package/dist/cliproxy/ai-providers/model-id-normalizer.js.map +1 -1
- package/dist/cliproxy/ai-providers/schema-sanitizer.d.ts +3 -1
- package/dist/cliproxy/ai-providers/schema-sanitizer.d.ts.map +1 -1
- package/dist/cliproxy/ai-providers/schema-sanitizer.js +3 -1
- package/dist/cliproxy/ai-providers/schema-sanitizer.js.map +1 -1
- package/dist/cliproxy/config/env-builder.d.ts.map +1 -1
- package/dist/cliproxy/config/env-builder.js +8 -1
- package/dist/cliproxy/config/env-builder.js.map +1 -1
- package/dist/cliproxy/config/fallback-chain-serializer.d.ts +8 -0
- package/dist/cliproxy/config/fallback-chain-serializer.d.ts.map +1 -0
- package/dist/cliproxy/config/fallback-chain-serializer.js +67 -0
- package/dist/cliproxy/config/fallback-chain-serializer.js.map +1 -0
- package/dist/cliproxy/config/generator.d.ts +9 -1
- package/dist/cliproxy/config/generator.d.ts.map +1 -1
- package/dist/cliproxy/config/generator.js +162 -10
- package/dist/cliproxy/config/generator.js.map +1 -1
- package/dist/cliproxy/config/thinking-config.js +5 -5
- package/dist/cliproxy/config/thinking-config.js.map +1 -1
- package/dist/cliproxy/executor/account-resolution.d.ts.map +1 -1
- package/dist/cliproxy/executor/account-resolution.js +7 -1
- package/dist/cliproxy/executor/account-resolution.js.map +1 -1
- package/dist/cliproxy/executor/claude-launcher.d.ts.map +1 -1
- package/dist/cliproxy/executor/claude-launcher.js +23 -3
- package/dist/cliproxy/executor/claude-launcher.js.map +1 -1
- package/dist/cliproxy/executor/claude-mods.d.ts +33 -0
- package/dist/cliproxy/executor/claude-mods.d.ts.map +1 -0
- package/dist/cliproxy/executor/claude-mods.js +121 -0
- package/dist/cliproxy/executor/claude-mods.js.map +1 -0
- package/dist/cliproxy/executor/env-resolver.js +1 -1
- package/dist/cliproxy/executor/env-resolver.js.map +1 -1
- package/dist/cliproxy/executor/index.d.ts.map +1 -1
- package/dist/cliproxy/executor/index.js +2 -1
- package/dist/cliproxy/executor/index.js.map +1 -1
- package/dist/cliproxy/executor/launch-settings.d.ts +6 -15
- package/dist/cliproxy/executor/launch-settings.d.ts.map +1 -1
- package/dist/cliproxy/executor/launch-settings.js +19 -119
- package/dist/cliproxy/executor/launch-settings.js.map +1 -1
- package/dist/cliproxy/executor/proxy-chain-builder.d.ts.map +1 -1
- package/dist/cliproxy/executor/proxy-chain-builder.js +4 -0
- package/dist/cliproxy/executor/proxy-chain-builder.js.map +1 -1
- package/dist/cliproxy/model-catalog.d.ts +1 -1
- package/dist/cliproxy/model-catalog.d.ts.map +1 -1
- package/dist/cliproxy/model-catalog.js +103 -10
- package/dist/cliproxy/model-catalog.js.map +1 -1
- package/dist/cliproxy/proxy/content-encoding.d.ts +20 -0
- package/dist/cliproxy/proxy/content-encoding.d.ts.map +1 -0
- package/dist/cliproxy/proxy/content-encoding.js +37 -0
- package/dist/cliproxy/proxy/content-encoding.js.map +1 -0
- package/dist/cliproxy/proxy/tool-sanitization-proxy.d.ts +7 -1
- package/dist/cliproxy/proxy/tool-sanitization-proxy.d.ts.map +1 -1
- package/dist/cliproxy/proxy/tool-sanitization-proxy.js +71 -109
- package/dist/cliproxy/proxy/tool-sanitization-proxy.js.map +1 -1
- package/dist/cliproxy/proxy/upstream-response-timeout.d.ts +13 -0
- package/dist/cliproxy/proxy/upstream-response-timeout.d.ts.map +1 -1
- package/dist/cliproxy/proxy/upstream-response-timeout.js +26 -1
- package/dist/cliproxy/proxy/upstream-response-timeout.js.map +1 -1
- package/dist/cliproxy/quota/quota-fetcher-claude-normalizer.d.ts +17 -4
- package/dist/cliproxy/quota/quota-fetcher-claude-normalizer.d.ts.map +1 -1
- package/dist/cliproxy/quota/quota-fetcher-claude-normalizer.js +246 -153
- package/dist/cliproxy/quota/quota-fetcher-claude-normalizer.js.map +1 -1
- package/dist/cliproxy/quota/quota-fetcher-claude-probe-state.d.ts +47 -0
- package/dist/cliproxy/quota/quota-fetcher-claude-probe-state.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-claude-probe-state.js +160 -0
- package/dist/cliproxy/quota/quota-fetcher-claude-probe-state.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-claude.d.ts +4 -4
- package/dist/cliproxy/quota/quota-fetcher-claude.d.ts.map +1 -1
- package/dist/cliproxy/quota/quota-fetcher-claude.js +188 -21
- package/dist/cliproxy/quota/quota-fetcher-claude.js.map +1 -1
- package/dist/cliproxy/quota/quota-label-sanitizer.d.ts +3 -2
- package/dist/cliproxy/quota/quota-label-sanitizer.d.ts.map +1 -1
- package/dist/cliproxy/quota/quota-label-sanitizer.js +6 -5
- package/dist/cliproxy/quota/quota-label-sanitizer.js.map +1 -1
- package/dist/cliproxy/quota/quota-manager.d.ts.map +1 -1
- package/dist/cliproxy/quota/quota-manager.js +3 -9
- package/dist/cliproxy/quota/quota-manager.js.map +1 -1
- package/dist/cliproxy/quota/quota-types.d.ts +17 -0
- package/dist/cliproxy/quota/quota-types.d.ts.map +1 -1
- package/dist/cliproxy/services/stats-fetcher.d.ts +4 -0
- package/dist/cliproxy/services/stats-fetcher.d.ts.map +1 -1
- package/dist/cliproxy/services/stats-fetcher.js +14 -1
- package/dist/cliproxy/services/stats-fetcher.js.map +1 -1
- package/dist/cliproxy/services/usage-compatibility-transformer.d.ts +5 -0
- package/dist/cliproxy/services/usage-compatibility-transformer.d.ts.map +1 -1
- package/dist/cliproxy/services/usage-compatibility-transformer.js +77 -6
- package/dist/cliproxy/services/usage-compatibility-transformer.js.map +1 -1
- package/dist/cliproxy/types/config-types.d.ts +3 -0
- package/dist/cliproxy/types/config-types.d.ts.map +1 -1
- package/dist/commands/api-command/help.d.ts.map +1 -1
- package/dist/commands/api-command/help.js +2 -0
- package/dist/commands/api-command/help.js.map +1 -1
- package/dist/commands/cliproxy/help-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/help-subcommand.js +9 -0
- package/dist/commands/cliproxy/help-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/order-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/order-subcommand.js +86 -44
- package/dist/commands/cliproxy/order-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/pool-state-renderer.d.ts.map +1 -1
- package/dist/commands/cliproxy/pool-state-renderer.js +9 -2
- package/dist/commands/cliproxy/pool-state-renderer.js.map +1 -1
- package/dist/commands/cliproxy/quota-subcommand/claude-window-helpers.d.ts +1 -2
- package/dist/commands/cliproxy/quota-subcommand/claude-window-helpers.d.ts.map +1 -1
- package/dist/commands/cliproxy/quota-subcommand/claude-window-helpers.js +5 -16
- package/dist/commands/cliproxy/quota-subcommand/claude-window-helpers.js.map +1 -1
- package/dist/commands/cliproxy/quota-subcommand/sections/claude.d.ts.map +1 -1
- package/dist/commands/cliproxy/quota-subcommand/sections/claude.js +4 -1
- package/dist/commands/cliproxy/quota-subcommand/sections/claude.js.map +1 -1
- package/dist/config/schemas/cliproxy.d.ts +16 -1
- package/dist/config/schemas/cliproxy.d.ts.map +1 -1
- package/dist/config/schemas/cliproxy.js.map +1 -1
- package/dist/cursor/cursor-daemon-entry.d.ts.map +1 -1
- package/dist/cursor/cursor-daemon-entry.js +11 -49
- package/dist/cursor/cursor-daemon-entry.js.map +1 -1
- package/dist/cursor/cursor-daemon.d.ts.map +1 -1
- package/dist/cursor/cursor-daemon.js +7 -4
- package/dist/cursor/cursor-daemon.js.map +1 -1
- package/dist/dispatcher/flows/cliproxy-flow.d.ts.map +1 -1
- package/dist/dispatcher/flows/cliproxy-flow.js +1 -0
- package/dist/dispatcher/flows/cliproxy-flow.js.map +1 -1
- package/dist/dispatcher/flows/settings-flow.d.ts.map +1 -1
- package/dist/dispatcher/flows/settings-flow.js +3 -1
- package/dist/dispatcher/flows/settings-flow.js.map +1 -1
- package/dist/docker/docker-bootstrap.d.ts.map +1 -1
- package/dist/docker/docker-bootstrap.js +29 -5
- package/dist/docker/docker-bootstrap.js.map +1 -1
- package/dist/glmt/glmt-proxy.d.ts +0 -4
- package/dist/glmt/glmt-proxy.d.ts.map +1 -1
- package/dist/glmt/glmt-proxy.js +6 -21
- package/dist/glmt/glmt-proxy.js.map +1 -1
- package/dist/management/shared-manager/plugin-layout-internals.d.ts.map +1 -1
- package/dist/management/shared-manager/plugin-layout-internals.js +8 -0
- package/dist/management/shared-manager/plugin-layout-internals.js.map +1 -1
- package/dist/management/shared-manager/plugin-metadata-normalizer.d.ts.map +1 -1
- package/dist/management/shared-manager/plugin-metadata-normalizer.js +72 -21
- package/dist/management/shared-manager/plugin-metadata-normalizer.js.map +1 -1
- package/dist/management/shared-manager/shared-dir-linker.d.ts.map +1 -1
- package/dist/management/shared-manager/shared-dir-linker.js +5 -0
- package/dist/management/shared-manager/shared-dir-linker.js.map +1 -1
- package/dist/management/shared-manager/types.d.ts.map +1 -1
- package/dist/management/shared-manager/types.js +4 -1
- package/dist/management/shared-manager/types.js.map +1 -1
- package/dist/proxy/server/http-helpers.d.ts +6 -1
- package/dist/proxy/server/http-helpers.d.ts.map +1 -1
- package/dist/proxy/server/http-helpers.js +19 -77
- package/dist/proxy/server/http-helpers.js.map +1 -1
- package/dist/proxy/server/messages-route.d.ts.map +1 -1
- package/dist/proxy/server/messages-route.js +11 -5
- package/dist/proxy/server/messages-route.js.map +1 -1
- package/dist/shared/claude-pool-policy.d.ts +20 -0
- package/dist/shared/claude-pool-policy.d.ts.map +1 -0
- package/dist/shared/claude-pool-policy.js +3 -0
- package/dist/shared/claude-pool-policy.js.map +1 -0
- package/dist/shared/provider-preset-catalog.d.ts +1 -1
- package/dist/shared/provider-preset-catalog.d.ts.map +1 -1
- package/dist/shared/provider-preset-catalog.js +80 -7
- package/dist/shared/provider-preset-catalog.js.map +1 -1
- package/dist/targets/droid-provider.d.ts.map +1 -1
- package/dist/targets/droid-provider.js +10 -8
- package/dist/targets/droid-provider.js.map +1 -1
- package/dist/ui/assets/{Trans-BFurXtDk.js → Trans-Dlb02vqu.js} +1 -1
- package/dist/ui/assets/{accounts-B_ik6YOD.js → accounts-NMmfEBnl.js} +1 -1
- package/dist/ui/assets/{alert-dialog-C6fhMbXC.js → alert-dialog-CLeTz0Di.js} +1 -1
- package/dist/ui/assets/{api-CxCFoBC0.js → api-DxGxeHbw.js} +2 -2
- package/dist/ui/assets/{auth-section-CtmO77JA.js → auth-section-AI2YNrUB.js} +1 -1
- package/dist/ui/assets/{backups-section-BYKnAWUa.js → backups-section-CxyuzCda.js} +1 -1
- package/dist/ui/assets/{channels-3uR41jWp.js → channels-SBcIEMn0.js} +1 -1
- package/dist/ui/assets/{checkbox-fCmjUiDn.js → checkbox-C1D6YcRy.js} +1 -1
- package/dist/ui/assets/{claude-extension-BplTVbCF.js → claude-extension-C3Ik79tl.js} +1 -1
- package/dist/ui/assets/cliproxy-BySCuRxu.js +4 -0
- package/dist/ui/assets/{cliproxy-ai-providers-D4OTiwA3.js → cliproxy-ai-providers-B8LPZhj3.js} +6 -6
- package/dist/ui/assets/{cliproxy-control-panel-DCyhsdm1.js → cliproxy-control-panel-Dsv31SI_.js} +1 -1
- package/dist/ui/assets/{codex-BGF20GsK.js → codex-CWZlSLEn.js} +5 -5
- package/dist/ui/assets/{confirm-dialog-BtMwDW6c.js → confirm-dialog-tpU9d5TR.js} +1 -1
- package/dist/ui/assets/{copilot-r1b0KLFf.js → copilot-C5uwBK-k.js} +1 -1
- package/dist/ui/assets/{cursor-BhVKTiz1.js → cursor-BwoYXKM4.js} +1 -1
- package/dist/ui/assets/{droid-lol9hAdK.js → droid-Cv6mZctn.js} +2 -2
- package/dist/ui/assets/{globalenv-section-B0gg-kuR.js → globalenv-section-CKc1Udhj.js} +1 -1
- package/dist/ui/assets/{health-Bu6RFYCP.js → health-Ctfcm6p0.js} +1 -1
- package/dist/ui/assets/{index-BbPI5sU_.js → index--TAxR0Iy.js} +1 -1
- package/dist/ui/assets/index-0hASk2BU.css +1 -0
- package/dist/ui/assets/{index-Pn_n_HFQ.js → index-C2ABCKof.js} +1 -1
- package/dist/ui/assets/{index-Djse8iLV.js → index-C5YaR--I.js} +1 -1
- package/dist/ui/assets/{index-BmjgsjcO.js → index-CBKaNavQ.js} +1 -1
- package/dist/ui/assets/{index-ptYEAEzZ.js → index-DnnSa3K6.js} +1 -1
- package/dist/ui/assets/{index-awbhDVzL.js → index-G9JzuSyw.js} +1 -1
- package/dist/ui/assets/index-gX7Mi5Ws.js +56 -0
- package/dist/ui/assets/{logs-B5Sbi4IG.js → logs-D6LiKkzU.js} +1 -1
- package/dist/ui/assets/{masked-input-BnrL_TdT.js → masked-input-CmtENW5h.js} +1 -1
- package/dist/ui/assets/proxy-status-widget-DqVBhfEP.js +1 -0
- package/dist/ui/assets/{raw-json-settings-editor-panel-PStRjNEl.js → raw-json-settings-editor-panel-C9-_RC57.js} +1 -1
- package/dist/ui/assets/{searchable-select-BDpwwNsP.js → searchable-select-BeEQJh2E.js} +1 -1
- package/dist/ui/assets/{separator-CJCyWDRS.js → separator-CB-e5SCL.js} +1 -1
- package/dist/ui/assets/{shared-6BrToCad.js → shared-GU9wziRt.js} +3 -3
- package/dist/ui/assets/{table-CnZev3Iu.js → table-BFrniqUJ.js} +1 -1
- package/dist/ui/assets/{updates-BiS0o8aM.js → updates-DYhBCREi.js} +1 -1
- package/dist/ui/assets/{use-accounts-89FOqhFc.js → use-accounts-xaNW9KeG.js} +1 -1
- package/dist/ui/index.html +2 -2
- package/dist/utils/delegation-validator.d.ts.map +1 -1
- package/dist/utils/delegation-validator.js +29 -8
- package/dist/utils/delegation-validator.js.map +1 -1
- package/dist/utils/launch-settings.d.ts +51 -0
- package/dist/utils/launch-settings.d.ts.map +1 -0
- package/dist/utils/launch-settings.js +190 -0
- package/dist/utils/launch-settings.js.map +1 -0
- package/dist/utils/openai-compat-launch-settings.d.ts +13 -1
- package/dist/utils/openai-compat-launch-settings.d.ts.map +1 -1
- package/dist/utils/openai-compat-launch-settings.js +15 -58
- package/dist/utils/openai-compat-launch-settings.js.map +1 -1
- package/dist/utils/request-body.d.ts +40 -0
- package/dist/utils/request-body.d.ts.map +1 -0
- package/dist/utils/request-body.js +142 -0
- package/dist/utils/request-body.js.map +1 -0
- package/dist/web-server/index.d.ts +1 -1
- package/dist/web-server/index.d.ts.map +1 -1
- package/dist/web-server/index.js +4 -1
- package/dist/web-server/index.js.map +1 -1
- package/dist/web-server/jsonl-parser.d.ts +2 -0
- package/dist/web-server/jsonl-parser.d.ts.map +1 -1
- package/dist/web-server/jsonl-parser.js +54 -4
- package/dist/web-server/jsonl-parser.js.map +1 -1
- package/dist/web-server/model-pricing.d.ts.map +1 -1
- package/dist/web-server/model-pricing.js +99 -1
- package/dist/web-server/model-pricing.js.map +1 -1
- package/dist/web-server/routes/bar-pool-account-quota-adapter.d.ts.map +1 -1
- package/dist/web-server/routes/bar-pool-account-quota-adapter.js +1 -3
- package/dist/web-server/routes/bar-pool-account-quota-adapter.js.map +1 -1
- package/dist/web-server/routes/cliproxy-routing-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cliproxy-routing-routes.js +16 -0
- package/dist/web-server/routes/cliproxy-routing-routes.js.map +1 -1
- package/dist/web-server/shutdown.d.ts +2 -3
- package/dist/web-server/shutdown.d.ts.map +1 -1
- package/dist/web-server/shutdown.js +16 -8
- package/dist/web-server/shutdown.js.map +1 -1
- package/dist/web-server/usage/cliproxy-usage-transformer.d.ts +6 -0
- package/dist/web-server/usage/cliproxy-usage-transformer.d.ts.map +1 -1
- package/dist/web-server/usage/cliproxy-usage-transformer.js +57 -1
- package/dist/web-server/usage/cliproxy-usage-transformer.js.map +1 -1
- package/dist/web-server/usage/codex-native-usage-collector.d.ts.map +1 -1
- package/dist/web-server/usage/codex-native-usage-collector.js +7 -4
- package/dist/web-server/usage/codex-native-usage-collector.js.map +1 -1
- package/dist/web-server/usage/native-quota-collector.d.ts.map +1 -1
- package/dist/web-server/usage/native-quota-collector.js +35 -67
- package/dist/web-server/usage/native-quota-collector.js.map +1 -1
- package/package.json +3 -1
- package/scripts/run-test-bucket.js +4 -0
- package/dist/ui/assets/cliproxy-BdW2ctsn.js +0 -4
- package/dist/ui/assets/index-DzFlVVV3.css +0 -1
- package/dist/ui/assets/index-pHOoeHgY.js +0 -56
- package/dist/ui/assets/proxy-status-widget-ColaQQXh.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-nu4wz29m.js";import{r as x}from"./react-vendor-Bjx91N7w.js";import{a as Y,bG as _e,bH as Ee,c as b,B as R,e as $,bC as Ve,aZ as De,bI as Oe,bJ as $e,bK as Le,bL as Ue,bM as Me,bN as Fe,bO as qe,bP as Be,bQ as ze,T as He,O as Ke,R as Qe,j as Ye,k as Je,l as Xe,m as Ze,n as et,o as tt,p as st,q as nt,_ as rt}from"./index-pHOoeHgY.js";import{A as at,a as ot,b as it,c as lt,d as dt,e as ct,f as ut,g as xt}from"./alert-dialog-C6fhMbXC.js";import{u as Re,a as gt,b as mt,h as pt}from"./tanstack-bhJxV1h8.js";import{t as le}from"./notifications-B4_o8bcr.js";import{bg as je,R as z,u as ge,t as me,v as ft,A as ht,bh as bt,bi as yt,bj as jt,X as vt,e as Nt,bk as St,bl as wt,U as Ct,w as Rt,n as kt,x as At,aG as Gt,T as de,aQ as Tt}from"./icons-DSLG1YsC.js";import{T as ve}from"./Trans-BFurXtDk.js";async function Pt(){const t=await fetch("/api/cliproxy/sync/status");if(!t.ok){let s="Failed to fetch sync status";try{const n=await t.json();s=n.error||n.message||s}catch{}throw new Error(s)}return t.json()}async function Wt(){const t=new AbortController,s=setTimeout(()=>t.abort(),3e4);try{const n=await fetch("/api/cliproxy/sync",{method:"POST",headers:{"Content-Type":"application/json"},signal:t.signal});if(!n.ok){let a="Sync failed";try{const o=await n.json();a=o.error||o.message||a}catch{}throw new Error(a)}return n.json()}catch(n){throw n instanceof Error&&n.name==="AbortError"?new Error("Sync request timed out after 30 seconds"):n}finally{clearTimeout(s)}}function It(){return Re({queryKey:["cliproxy-sync-status"],queryFn:Pt,refetchInterval:3e4,retry:1,staleTime:1e4})}function _t(){const t=gt(),{t:s}=Y();return mt({mutationFn:Wt,onSuccess:n=>{t.invalidateQueries({queryKey:["cliproxy-sync-status"]}),t.invalidateQueries({queryKey:["cliproxy-sync-preview"]}),n.syncedCount===0?le.info(s("toasts.noProfilesToSync")):le.success(`Synced ${n.syncedCount} profile${n.syncedCount===1?"":"s"} to CLIProxy`)},onError:n=>{le.error(s("toasts.syncFailed",{error:n.message}))}})}function Ne(t){const s=t.trim().replace(/^v/,""),[n,a="0"]=s.split("-",2),[o=0,c=0,d=0]=n.split(".").map(y=>Number.parseInt(y,10)||0),p=/^\d+$/.test(a)&&Number.parseInt(a,10)||0;return{major:o,minor:c,patch:d,forkRelease:p}}function ee(t,s){return t>s?1:t<s?-1:0}function pe(t,s){const n=Ne(t),a=Ne(s);return ee(n.major,a.major)||ee(n.minor,a.minor)||ee(n.patch,a.patch)||ee(n.forkRelease,a.forkRelease)}function ce(t,s){return pe(t,s)>0}function ue(t,s,n){return pe(t,s)>=0&&pe(t,n)<=0}function Se(t){if(!/^\d+$/.test(t))return null;const s=Number(t);return Number.isSafeInteger(s)?s:null}function Et(){const{t}=Y(),s=_e(),n=Ee(),a=s.data?.request_retry??0,o=s.data?.max_retry_interval??0,c=s.data?.manageable!==!1,d=s.isLoading||s.isError||n.isPending||!c,p=s.error?.message??s.data?.message;return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg border border-border/60 bg-muted/20 px-2 py-1.5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[10px] font-medium text-foreground",children:t("routingGuidance.retryTitle")}),e.jsxs("div",{className:"text-[10px] text-muted-foreground",children:[t("routingGuidance.retryHint"),s.data?` · ${s.data.source} · ${s.data.target}`:""]})]}),e.jsx(Vt,{requestRetry:a,maxRetryInterval:o,disabled:d,onUpdate:(y,r)=>n.mutate({request_retry:y,max_retry_interval:r})},`${a}:${o}`)]}),p?e.jsx("div",{className:"rounded-lg border border-border/60 bg-muted/20 px-2 py-1.5 text-[10px] text-muted-foreground",children:p}):null]})}function Vt({requestRetry:t,maxRetryInterval:s,disabled:n,onUpdate:a}){const{t:o}=Y(),[c,d]=x.useState(String(t)),[p,y]=x.useState(String(s)),[r,j]=x.useState(null),g=()=>{if(n)return;const m=Se(c.trim()),S=Se(p.trim());if(m===null||S===null){j(o("routingGuidance.retryRangeError")),d(String(t)),y(String(s));return}j(null),(m!==t||S!==s)&&a(m,S)};return e.jsxs("div",{className:"flex flex-col items-end gap-1",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("input",{"aria-label":o("routingGuidance.requestRetryLabel"),inputMode:"numeric",className:"h-6 w-10 rounded border border-border/70 bg-background px-1.5 text-[10px] text-foreground",value:c,onChange:m=>d(m.target.value),onBlur:g,disabled:n}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"/"}),e.jsx("input",{"aria-label":o("routingGuidance.maxRetryIntervalLabel"),inputMode:"numeric",className:"h-6 w-10 rounded border border-border/70 bg-background px-1.5 text-[10px] text-foreground",value:p,onChange:m=>y(m.target.value),onBlur:g,disabled:n})]}),r?e.jsx("div",{className:"text-[10px] text-destructive",children:r}):null]})}const xe={"round-robin":{title:"Round Robin",description:"Spread requests across matching accounts for even usage."},"fill-first":{title:"Fill First",description:"Drain one healthy account first and keep backups untouched until needed."}};function we({className:t,compact:s=!1,state:n,sessionAffinityState:a,isLoading:o,isSaving:c,error:d,onApply:p,onApplyAffinity:y}){const{t:r}=Y(),j=n?.strategy??"round-robin",g=n?.poolRouting?.enabled??!1,m=n?.poolRouting?.maxRetryCredentials,S=n?.poolRouting?.manageable??!0,w=!S,L=n?.poolRouting?.message??r("routingGuidance.poolRoutingLocalOnly"),C=a?.enabled??!1,f=a?.ttl??"1h",h=a?.manageable??!0,[v,H]=x.useState(j),[P,E]=x.useState(C),[k,W]=x.useState(f),[N,te]=x.useState(!1),A=n?.source==="live"?"Live CLIProxy":"Saved startup default",J=o||c||!n||v===j,X=N?"Hide details":"Show details",U=o||c||!!d||!h,V=r(h?P?"routingGuidance.disableSessionAffinity":"routingGuidance.enableSessionAffinity":"routingGuidance.sessionAffinityUnavailable"),D=x.useRef(null),G=x.useRef(!1);x.useEffect(()=>{H(j)},[j]),x.useEffect(()=>{E(C),W(f)},[C,f]),x.useEffect(()=>{if(c||!D.current)return;const l=D.current;l.enabled===C&&l.ttl===f||(E(C),W(f)),D.current=null},[c,C,f]);const O=()=>{if(!h)return;const l=!P,u=k.trim()||"1h";D.current={enabled:l,ttl:u},E(l),y({enabled:l,ttl:u})},M=()=>{if(!h||d)return;if(G.current){G.current=!1;return}const l=k.trim()||"1h";l!==f&&(D.current={enabled:P,ttl:l},y({enabled:P,ttl:l}))};if(s){const l=u=>{H(u),u!==j&&p(u)};return e.jsxs("div",{className:b("group/routing mt-1 space-y-2 -mx-1 rounded-lg p-1",t),children:[e.jsxs("div",{className:"flex items-center justify-between rounded-lg transition-colors hover:bg-primary/5",children:[e.jsxs("div",{className:"flex items-center gap-2 px-1 text-xs font-medium text-foreground",children:[e.jsxs("div",{className:"relative flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-background border border-border/60 text-muted-foreground shadow-sm overflow-hidden transition-all duration-300 group-hover/routing:border-primary/40 group-hover/routing:text-primary group-hover/routing:shadow-[0_0_12px_rgba(59,130,246,0.15)] dark:group-hover/routing:shadow-[0_0_12px_rgba(59,130,246,0.1)]",children:[e.jsx("div",{className:"absolute inset-0 bg-primary/10 translate-y-full group-hover/routing:translate-y-0 transition-transform duration-300 ease-out"}),e.jsx(je,{className:"relative z-10 h-3.5 w-3.5 transition-transform duration-300 group-hover/routing:scale-110"})]}),e.jsx("span",{className:"tracking-tight transition-colors duration-300 group-hover/routing:text-primary group-hover/routing:font-semibold",children:"Routing"}),c&&e.jsx(z,{className:"ml-1 h-3 w-3 shrink-0 animate-spin text-primary"})]}),e.jsxs("div",{className:"relative grid grid-cols-2 p-0.5 gap-0.5 rounded-lg border border-border/60 bg-muted/30 shadow-[inset_0_1px_2px_rgba(0,0,0,0.05)] dark:shadow-[inset_0_1px_3px_rgba(0,0,0,0.2)] transition-colors duration-300 group-hover/routing:border-primary/20 group-hover/routing:bg-primary/5",children:[e.jsx("div",{className:b("absolute inset-y-0.5 left-0.5 w-[calc(50%-0.1875rem)] rounded bg-background shadow-[0_1px_3px_rgba(0,0,0,0.1),0_1px_2px_rgba(0,0,0,0.06)] ring-1 ring-black/5 dark:ring-white/10 transition-all duration-300",v==="fill-first"?"translate-x-[calc(100%+0.125rem)]":"translate-x-0","group-hover/routing:shadow-[0_0_8px_rgba(59,130,246,0.15)] dark:group-hover/routing:shadow-[0_0_8px_rgba(59,130,246,0.1)] group-hover/routing:ring-primary/30"),style:{transitionTimingFunction:"cubic-bezier(0.175, 0.885, 0.32, 1.275)"}}),Object.entries(xe).map(([u,I])=>{const se=v===u;return e.jsx("button",{type:"button",className:b("relative z-10 flex items-center justify-center rounded px-2.5 py-0.5 text-[10px] font-medium whitespace-nowrap transition-colors duration-200",se?"text-foreground group-hover/routing:text-primary":"text-muted-foreground/70 hover:text-foreground/90 group-hover/routing:text-muted-foreground/90"),onClick:()=>l(u),disabled:o||c||!!d,title:I.description,children:I.title},u)})]})]}),g&&S?e.jsx("div",{role:"status",className:"rounded-lg border border-amber-500/40 bg-amber-500/10 px-2 py-1.5 text-[10px] leading-4 text-amber-700 dark:text-amber-300",children:r("routingGuidance.poolRoutingApplyWarning")}):null,e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg border border-border/60 bg-muted/20 px-2 py-1.5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[10px] font-medium text-foreground",children:r("routingGuidance.poolRouting")}),e.jsx("div",{className:"text-[10px] text-muted-foreground",children:w?L:r(g?"routingGuidance.drainOrderHint":"routingGuidance.poolRoutingOffHint")})]}),e.jsx(R,{variant:w?"outline":g?"secondary":"outline",title:w?L:r(g?"routingGuidance.poolRoutingManaged":"routingGuidance.poolRoutingOffHint"),children:w?r("routingGuidance.localOnly"):g?`${r("routingGuidance.poolRoutingOn")} · ${r("routingGuidance.poolMaxRetry",{count:m??0})}`:r("routingGuidance.poolRoutingOff")})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg border border-border/60 bg-muted/20 px-2 py-1.5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[10px] font-medium text-foreground",children:r("routingGuidance.sessionAffinity")}),e.jsx("div",{className:"text-[10px] text-muted-foreground",children:h?r("routingGuidance.ttlBadge",{ttl:f}):r("routingGuidance.localOnlySetting")})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[h?e.jsx("input",{"aria-label":"Session affinity TTL",className:"h-6 w-14 rounded border border-border/70 bg-background px-2 text-[10px] text-foreground",value:k,onChange:u=>W(u.target.value),onBlur:M,disabled:U}):null,e.jsx("button",{type:"button","aria-label":V,className:b("rounded border px-2 py-1 text-[10px] font-medium transition-colors",h?"border-border/70 bg-background text-foreground hover:border-primary/40 hover:text-primary":"border-border/60 bg-muted/40 text-muted-foreground"),onMouseDown:()=>{G.current=!0},onClick:O,disabled:U,title:a?.message,children:r(h?P?"routingGuidance.sessionAffinityOn":"routingGuidance.sessionAffinityOff":"routingGuidance.sessionAffinityUnavailable")})]})]}),a?.message?e.jsx("div",{className:"rounded-lg border border-border/60 bg-muted/20 px-2 py-1.5 text-[10px] text-muted-foreground",children:a.message}):null,e.jsx(Et,{})]})}return e.jsx("section",{className:b("rounded-xl border border-border/70 bg-background",t),children:e.jsxs("div",{className:"grid gap-3 px-4 py-3 xl:grid-cols-[minmax(0,1fr)_auto] xl:items-start",children:[e.jsxs("div",{className:"min-w-0 space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"inline-flex h-7 w-7 items-center justify-center rounded-lg bg-muted text-primary",children:e.jsx(je,{className:"h-4 w-4"})}),e.jsx("div",{className:"text-sm font-medium",children:r("routingGuidance.routingStrategy")}),e.jsx(R,{variant:"secondary",children:j}),n?e.jsx(R,{variant:"outline",children:A}):null,n?e.jsx(R,{variant:"outline",children:n.target}):null,n?e.jsxs(R,{variant:w?"outline":g?"secondary":"outline",title:w?L:r(g?"routingGuidance.poolRoutingManaged":"routingGuidance.poolRoutingOffHint"),children:[r("routingGuidance.poolRouting"),":"," ",r(w?"routingGuidance.localOnly":g?"routingGuidance.poolRoutingOn":"routingGuidance.poolRoutingOff"),!w&&g&&m!==void 0?` · ${r("routingGuidance.poolMaxRetry",{count:m})}`:""]}):null]}),e.jsx("p",{className:"max-w-3xl text-xs leading-5 text-muted-foreground",children:"Proxy-wide account rotation. CCS keeps round-robin as the default until you explicitly change it."}),e.jsx("p",{className:"max-w-3xl text-[11px] leading-5 text-muted-foreground",children:r("routingGuidance.drainOrderHint")})]}),e.jsxs("div",{className:"flex flex-col gap-2 xl:items-end",children:[e.jsx("div",{className:"inline-flex flex-wrap rounded-lg border border-border/70 bg-muted/35 p-1",children:Object.entries(xe).map(([l,u])=>{const I=v===l;return e.jsx("button",{type:"button",className:b("rounded-md px-3 py-1.5 text-sm font-medium transition-colors",I?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),onClick:()=>H(l),disabled:o||c||!!d,children:u.title},l)})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs($,{type:"button",variant:"ghost",size:"sm",className:"h-8 px-2 text-xs text-muted-foreground",onClick:()=>te(l=>!l),children:[N?e.jsx(ge,{className:"mr-1 h-3.5 w-3.5"}):e.jsx(me,{className:"mr-1 h-3.5 w-3.5"}),X]}),e.jsx($,{size:"sm",onClick:()=>p(v),disabled:J||!!d,children:c?"Saving...":`Use ${v}`})]}),g&&S?e.jsx("p",{role:"status",className:"max-w-xs text-[11px] leading-4 text-amber-700 dark:text-amber-400 xl:text-right",children:r("routingGuidance.poolRoutingApplyWarning")}):null]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground xl:col-span-2",children:[e.jsx("span",{children:r("routingGuidance.roundRobin")}),e.jsx("span",{className:"hidden text-border sm:inline",children:"•"}),e.jsx("span",{children:r("routingGuidance.fillFirst")})]}),e.jsxs("div",{className:"grid gap-3 rounded-lg border border-border/70 bg-muted/20 px-3 py-3 xl:col-span-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"text-sm font-medium",children:r("routingGuidance.sessionAffinity")}),e.jsx(R,{variant:"secondary",children:r(P?"routingGuidance.sessionAffinityOn":"routingGuidance.sessionAffinityOff")}),a?.ttl?e.jsx(R,{variant:"outline",children:r("routingGuidance.ttlBadge",{ttl:f})}):null,h?null:e.jsx(R,{variant:"outline",children:r("routingGuidance.localOnly")})]}),e.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:r("routingGuidance.sessionAffinityDescription")}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("input",{"aria-label":"Session affinity TTL",className:"h-9 w-24 rounded-md border border-border/70 bg-background px-3 text-sm text-foreground",value:k,onChange:l=>W(l.target.value),onBlur:M,disabled:U}),e.jsx($,{type:"button",variant:"outline",onMouseDown:()=>{G.current=!0},onClick:O,disabled:U,"aria-label":V,children:V})]}),a?.message?e.jsx("div",{className:"rounded-lg border border-border/70 bg-background/70 px-3 py-2 text-xs text-muted-foreground",children:a.message}):null]}),d?e.jsx("div",{className:"rounded-lg border border-destructive/25 bg-destructive/5 px-3 py-2 text-sm xl:col-span-2",children:d.message}):null,!d&&n?.message?e.jsx("div",{className:"rounded-lg border border-border/70 bg-muted/35 px-3 py-2 text-xs text-muted-foreground xl:col-span-2",children:n.message}):null,N?e.jsxs("div",{className:"grid gap-4 border-t border-border/60 pt-3 md:grid-cols-2 xl:col-span-2",children:[Object.entries(xe).map(([l,u])=>{const I=j===l;return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"text-sm font-medium",children:u.title}),I?e.jsx(R,{variant:"secondary",children:"Current"}):null]}),e.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:u.description})]},l)}),e.jsxs("div",{className:"space-y-1 md:col-span-2",children:[e.jsx("div",{className:"text-sm font-medium",children:r("routingGuidance.sessionRecognitionTitle")}),e.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:r("routingGuidance.sessionRecognitionDescription")})]})]}):null]})})}const ke="cliproxy-status-widget-collapsed";function Dt(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(ke)==="true"}catch{return!1}}function Ce(t){if(!(typeof window>"u"))try{window.localStorage.setItem(ke,String(t))}catch{}}function Ot(t){if(!t)return"";const s=new Date(t).getTime(),a=Date.now()-s,o=Math.floor(a/(1e3*60*60)),c=Math.floor(a%(1e3*60*60)/(1e3*60));return o>0?`${o}h ${c}m`:`${c}m`}function $t(t,s){if(!t)return"";const n=Date.now()-t,a=Math.floor(n/(1e3*60)),o=Math.floor(n/(1e3*60*60));return a<1?s("proxyStatusWidget.justNow"):a<60?s("proxyStatusWidget.minutesAgo",{count:a}):s("proxyStatusWidget.hoursAgo",{count:o})}function Q({icon:t,tooltip:s,onClick:n,disabled:a,isPending:o,className:c,variant:d="ghost"}){return e.jsxs(tt,{children:[e.jsx(st,{asChild:!0,children:e.jsx($,{variant:d==="destructive-ghost"?"ghost":d,size:"sm",className:b("h-7 w-7 p-0",d==="destructive-ghost"&&"hover:bg-destructive/10 hover:text-destructive hover:border-destructive/30",c),onClick:n,disabled:a,"aria-label":s,children:o?e.jsx(z,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(t,{className:"w-3.5 h-3.5"})})}),e.jsx(nt,{side:"bottom",className:"text-xs",children:s})]})}function Kt(){const{t}=Y(),{data:s,isLoading:n}=Ve(),{data:a}=De(),{data:o,isLoading:c}=Oe(),{data:d,isLoading:p,error:y}=$e(),r=Le(),{data:j,isLoading:g,error:m}=Ue(),S=Me(),w=r.isPending||S.isPending,L=y instanceof Error?y:null,C=Fe(),f=qe(),h=Be(),v=ze(),{data:H}=It(),{mutate:P,isPending:E}=_t(),[k,W]=x.useState(!1),[N,te]=x.useState(""),[A,J]=x.useState(Dt),X=()=>{const i=!A;J(i),i&&W(!1),Ce(i)},U=()=>{const i=!k;W(i),i&&A&&(J(!1),Ce(!1))},V=t(A?"proxyStatusWidget.tooltipExpandWidget":"proxyStatusWidget.tooltipCollapseWidget"),[D,G]=x.useState(!1),[O,M]=x.useState(null),[l,u]=x.useState(null),{data:I}=Re({queryKey:["cliproxy-server-config"],queryFn:()=>rt.cliproxyServer.get(),staleTime:3e4}),se=pt({mutationKey:["update-backend"]})>0,F=I?.remote,ne=F?.enabled&&F?.host,_=j??(m instanceof Error?{source:"unsupported",target:d?.target??(ne?"remote":"local"),reachable:!1,manageable:!1,message:m.message}:void 0),K=s?.running??!1,re=C.isPending||f.isPending||h.isPending||v.isPending||se||E,Ae=a?.hasUpdate??!1,q=a?.isStable===!1,fe=a?.currentVersion,Z=H?.configured??!1,Ge=t(Z?"proxyStatusWidget.syncReady":"proxyStatusWidget.noConfig"),ae=q?a?.maxStableVersion||o?.latestStable:a?.latestVersion,he=o?.maxStableVersion||a?.maxStableVersion||"6.6.80",B=o?.faultyRange,Te=B&&`${B.min.replace(/-\d+$/,"")}-${B.max.replace(/-\d+$/,"")}`,oe=(i,T)=>{M(i),u(T),G(!0)},be=async i=>{if(!i)return;const T=ce(i,he);if(B!==void 0&&ue(i,B.min,B.max)){oe(i,"faulty");return}if(T){oe(i,"experimental");return}try{const ye=await v.mutateAsync({version:i});ye.requiresConfirmation&&oe(i,ye.isFaulty?"faulty":"experimental")}catch{}},Pe=()=>{O&&v.mutate({version:O,force:!0}),G(!1),M(null),u(null)},We=()=>{G(!1),M(null),u(null)},Ie=ne?(()=>{const i=F.protocol||"http",T=F.port||(i==="https"?443:80);return i==="https"&&T===443||i==="http"&&T===80?F.host:`${F.host}:${T}`})():null;return ne?e.jsxs("div",{className:b("rounded-lg border p-3 transition-colors","border-blue-500/30 bg-blue-500/5"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ft,{className:"w-4 h-4 text-blue-500"}),e.jsx("span",{className:"text-sm font-medium",children:t("proxyStatusWidget.remoteProxy")}),e.jsx(R,{variant:"secondary",className:"text-[10px] h-4 px-1.5 bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",children:t("proxyStatusWidget.active")})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ht,{className:"w-3 h-3 text-blue-600"}),e.jsx($,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:X,title:V,"aria-label":V,children:A?e.jsx(me,{className:"w-3.5 h-3.5"}):e.jsx(ge,{className:"w-3.5 h-3.5"})})]})]}),!A&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mt-2 text-xs text-muted-foreground",children:[e.jsx("div",{className:"flex items-center gap-1 mb-1",children:e.jsx("span",{className:"font-mono",children:Ie})}),e.jsx("p",{className:"text-[10px] text-muted-foreground/70 leading-tight",children:t("proxyStatusWidget.trafficAutoRouted")})]}),e.jsx(we,{compact:!0,className:"mt-3",state:d,sessionAffinityState:_,isLoading:p||g,isSaving:w,error:L,onApply:i=>r.mutate(i),onApplyAffinity:i=>S.mutate(i)},`remote:${d?.strategy??"round-robin"}:${_?.enabled??"na"}:${_?.ttl??"na"}:${_?.manageable??"na"}`)]})]}):e.jsx(He,{delayDuration:300,children:e.jsxs("div",{className:b("rounded-lg border p-3 transition-colors",K?"border-green-500/30 bg-green-500/5":"border-muted bg-muted/30"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:b("w-2 h-2 rounded-full",K?"bg-green-500 animate-pulse":"bg-muted-foreground/30")}),e.jsx("span",{className:"text-sm font-medium",children:a?.backendLabel??"CLIProxy"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[n?e.jsx(z,{className:"w-3 h-3 animate-spin text-muted-foreground"}):K?e.jsxs(e.Fragment,{children:[e.jsx(Q,{icon:E?z:bt,tooltip:t("proxyStatusWidget.tooltipSync"),onClick:()=>P(),disabled:!Z||re,isPending:E}),e.jsx(Q,{icon:yt,tooltip:t("proxyStatusWidget.tooltipRestart"),onClick:()=>h.mutate(),disabled:re,isPending:h.isPending}),e.jsx(Q,{icon:jt,tooltip:t("proxyStatusWidget.tooltipStop"),onClick:()=>f.mutate(),disabled:re,isPending:f.isPending,variant:"destructive-ghost"})]}):null,e.jsx(Q,{icon:k?vt:Nt,tooltip:t(k?"proxyStatusWidget.tooltipClose":"proxyStatusWidget.tooltipVersionSettings"),onClick:U,className:k?"bg-muted":void 0}),e.jsx(Q,{icon:A?me:ge,tooltip:V,onClick:X})]})]}),fe&&e.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[e.jsxs("span",{className:b("text-xs font-mono text-muted-foreground",q&&"text-amber-600 dark:text-amber-400"),children:["v",fe]}),(Ae||q)&&ae&&e.jsxs(R,{variant:"secondary",className:b("text-[10px] h-4 px-1.5 gap-0.5 cursor-pointer transition-colors",q?"bg-amber-100 text-amber-700 hover:bg-amber-200 dark:bg-amber-900/30 dark:text-amber-400 dark:hover:bg-amber-900/50":"bg-green-100 text-green-700 hover:bg-green-200 dark:bg-green-900/30 dark:text-green-400 dark:hover:bg-green-900/50"),onClick:()=>void be(ae),title:t(q?"proxyStatusWidget.clickToDowngrade":"proxyStatusWidget.clickToUpdate"),children:[q?e.jsx(St,{className:"w-2.5 h-2.5"}):e.jsx(wt,{className:"w-2.5 h-2.5"}),ae]})]}),!A&&K&&s&&e.jsxs("div",{className:"mt-2 flex items-center gap-4 text-xs text-muted-foreground",children:[e.jsx("span",{className:"flex items-center gap-1",children:t("proxyStatusWidget.port",{port:s.port})}),s.sessionCount!==void 0&&s.sessionCount>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ct,{className:"w-3 h-3"}),t("proxyStatusWidget.sessionCount",{count:s.sessionCount})]}),s.startedAt&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Rt,{className:"w-3 h-3"}),Ot(s.startedAt)]})]}),!A&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs",children:[Z?e.jsx(kt,{className:"w-3 h-3 text-green-600 dark:text-green-400"}):e.jsx(At,{className:"w-3 h-3 text-muted-foreground"}),e.jsx("span",{className:b("text-xs",Z?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:Ge})]}),e.jsx(we,{compact:!0,className:"mt-3",state:d,sessionAffinityState:_,isLoading:p||g,isSaving:w,error:L,onApply:i=>r.mutate(i),onApplyAffinity:i=>S.mutate(i)},`local:${d?.strategy??"round-robin"}:${_?.enabled??"na"}:${_?.ttl??"na"}:${_?.manageable??"na"}`)]}),e.jsx(Ke,{open:k,onOpenChange:W,children:e.jsxs(Qe,{className:"mt-3 pt-3 border-t border-muted",children:[e.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-3",children:t("proxyStatusWidget.versionManagement")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Ye,{value:N,onValueChange:te,disabled:c,children:[e.jsx(Je,{className:"h-8 text-xs flex-1",children:e.jsx(Xe,{placeholder:t("proxyStatusWidget.selectVersionPlaceholder")})}),e.jsx(Ze,{children:o?.versions.slice(0,20).map(i=>{const T=o?.maxStableVersion&&ce(i,o.maxStableVersion),ie=o?.faultyRange&&ue(i,o.faultyRange.min,o.faultyRange.max);return e.jsx(et,{value:i,className:"text-xs",children:e.jsxs("span",{className:"flex items-center gap-2",children:["v",i,i===o.latestStable&&e.jsx("span",{className:"text-green-600 dark:text-green-400",children:t("proxyStatusWidget.stable")}),(ie||T)&&e.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:"⚠"})]})},i)})})]}),e.jsxs($,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1.5 px-3",onClick:()=>void be(N),disabled:v.isPending||!N,children:[v.isPending?e.jsx(z,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(Gt,{className:"w-3.5 h-3.5"}),t("proxyStatusWidget.install")]})]}),N&&o?.maxStableVersion&&ce(N,o.maxStableVersion)&&e.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[e.jsx(de,{className:"w-3.5 h-3.5 flex-shrink-0"}),e.jsx("span",{children:t("proxyStatusWidget.versionsAboveUnstable",{version:o.maxStableVersion})})]}),N&&o?.faultyRange&&ue(N,o.faultyRange.min,o.faultyRange.max)&&e.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-[11px] text-amber-600 dark:text-amber-400",children:[e.jsx(de,{className:"w-3.5 h-3.5 flex-shrink-0"}),e.jsx("span",{children:t("proxyStatusWidget.versionsKnownIssues",{version:N})})]}),a?.checkedAt&&e.jsx("div",{className:"mt-2 text-[10px] text-muted-foreground/60",children:t("proxyStatusWidget.lastChecked",{time:$t(a.checkedAt,t)})})]})}),!K&&e.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:t("proxyStatusWidget.notRunning")}),e.jsxs($,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>C.mutate(),disabled:C.isPending,children:[C.isPending?e.jsx(z,{className:"w-3 h-3 animate-spin"}):e.jsx(Tt,{className:"w-3 h-3"}),t("proxyStatusWidget.start")]})]}),e.jsx(at,{open:D,onOpenChange:G,children:e.jsxs(ot,{children:[e.jsxs(it,{children:[e.jsxs(lt,{className:"flex items-center gap-2",children:[e.jsx(de,{className:"w-5 h-5 text-amber-500"}),t(l==="faulty"?"proxyStatusWidget.installFaultyTitle":"proxyStatusWidget.installUnstableTitle")]}),e.jsxs(dt,{className:"space-y-2",children:[l==="faulty"?e.jsx("p",{children:e.jsx(ve,{i18nKey:"proxyStatusWidget.installFaultyDesc",values:{version:O??"",range:Te||""},components:{strong:e.jsx("strong",{})}})}):e.jsx("p",{children:e.jsx(ve,{i18nKey:"proxyStatusWidget.installUnstableDesc",values:{version:O??"",maxStable:he},components:{strong:e.jsx("strong",{})}})}),e.jsx("p",{className:"text-amber-600 dark:text-amber-400",children:t(l==="faulty"?"proxyStatusWidget.installFaultyWarning":"proxyStatusWidget.installUnstableWarning")}),e.jsx("p",{children:t("proxyStatusWidget.installUnstableConfirm")})]})]}),e.jsxs(ct,{children:[e.jsx(ut,{onClick:We,children:t("proxyStatusWidget.cancel")}),e.jsx(xt,{onClick:Pe,className:"bg-amber-500 hover:bg-amber-600 text-white",children:t("proxyStatusWidget.installAnyway")})]})]})})]})})}export{Kt as P};
|