@kaitranntt/ccs 7.75.0 → 7.76.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/services/cliproxy-profile-bridge.js +4 -4
- package/dist/api/services/cliproxy-profile-bridge.js.map +1 -1
- package/dist/api/services/profile-lifecycle-validation.js +1 -1
- package/dist/api/services/profile-lifecycle-validation.js.map +1 -1
- package/dist/api/services/profile-writer.js +1 -1
- package/dist/api/services/profile-writer.js.map +1 -1
- package/dist/auth/profile-registry.d.ts.map +1 -1
- package/dist/auth/profile-registry.js +9 -0
- package/dist/auth/profile-registry.js.map +1 -1
- package/dist/ccs.js +77 -9
- package/dist/ccs.js.map +1 -1
- package/dist/cliproxy/{account-manager.d.ts → accounts/account-manager.d.ts} +2 -2
- package/dist/cliproxy/accounts/account-manager.d.ts.map +1 -0
- package/dist/cliproxy/{account-manager.js → accounts/account-manager.js} +34 -34
- package/dist/cliproxy/accounts/account-manager.js.map +1 -0
- package/dist/cliproxy/{account-safety.d.ts → accounts/account-safety.d.ts} +1 -1
- package/dist/cliproxy/accounts/account-safety.d.ts.map +1 -0
- package/dist/cliproxy/{account-safety.js → accounts/account-safety.js} +5 -5
- package/dist/cliproxy/accounts/account-safety.js.map +1 -0
- package/dist/cliproxy/accounts/account-stats-key.d.ts.map +1 -0
- package/dist/cliproxy/accounts/account-stats-key.js.map +1 -0
- package/dist/cliproxy/accounts/registry.js +1 -1
- package/dist/cliproxy/accounts/registry.js.map +1 -1
- package/dist/cliproxy/accounts/token-file-ops.js +1 -1
- package/dist/cliproxy/accounts/token-file-ops.js.map +1 -1
- package/dist/cliproxy/{codex-plan-compatibility.d.ts → ai-providers/codex-plan-compatibility.d.ts} +4 -4
- package/dist/cliproxy/ai-providers/codex-plan-compatibility.d.ts.map +1 -0
- package/dist/cliproxy/{codex-plan-compatibility.js → ai-providers/codex-plan-compatibility.js} +5 -5
- package/dist/cliproxy/ai-providers/codex-plan-compatibility.js.map +1 -0
- package/dist/cliproxy/ai-providers/codex-reasoning-proxy.d.ts.map +1 -0
- package/dist/cliproxy/{codex-reasoning-proxy.js → ai-providers/codex-reasoning-proxy.js} +1 -1
- package/dist/cliproxy/ai-providers/codex-reasoning-proxy.js.map +1 -0
- package/dist/cliproxy/ai-providers/config-store.js +3 -3
- package/dist/cliproxy/ai-providers/config-store.js.map +1 -1
- package/dist/cliproxy/{managed-model-prefixes.d.ts → ai-providers/managed-model-prefixes.d.ts} +1 -1
- package/dist/cliproxy/ai-providers/managed-model-prefixes.d.ts.map +1 -0
- package/dist/cliproxy/{managed-model-prefixes.js → ai-providers/managed-model-prefixes.js} +3 -3
- package/dist/cliproxy/ai-providers/managed-model-prefixes.js.map +1 -0
- package/dist/cliproxy/{model-id-normalizer.d.ts → ai-providers/model-id-normalizer.d.ts} +1 -1
- package/dist/cliproxy/ai-providers/model-id-normalizer.d.ts.map +1 -0
- package/dist/cliproxy/{model-id-normalizer.js → ai-providers/model-id-normalizer.js} +1 -1
- package/dist/cliproxy/ai-providers/model-id-normalizer.js.map +1 -0
- package/dist/cliproxy/ai-providers/openai-compat-manager.d.ts.map +1 -0
- package/dist/cliproxy/{openai-compat-manager.js → ai-providers/openai-compat-manager.js} +7 -6
- package/dist/cliproxy/ai-providers/openai-compat-manager.js.map +1 -0
- package/dist/cliproxy/ai-providers/schema-sanitizer.d.ts.map +1 -0
- package/dist/cliproxy/ai-providers/schema-sanitizer.js.map +1 -0
- package/dist/cliproxy/{tool-name-mapper.d.ts → ai-providers/tool-name-mapper.d.ts} +7 -2
- package/dist/cliproxy/ai-providers/tool-name-mapper.d.ts.map +1 -0
- package/dist/cliproxy/{tool-name-mapper.js → ai-providers/tool-name-mapper.js} +35 -21
- package/dist/cliproxy/ai-providers/tool-name-mapper.js.map +1 -0
- package/dist/cliproxy/{tool-name-sanitizer.d.ts → ai-providers/tool-name-sanitizer.d.ts} +2 -1
- package/dist/cliproxy/ai-providers/tool-name-sanitizer.d.ts.map +1 -0
- package/dist/cliproxy/{tool-name-sanitizer.js → ai-providers/tool-name-sanitizer.js} +23 -3
- package/dist/cliproxy/ai-providers/tool-name-sanitizer.js.map +1 -0
- package/dist/cliproxy/auth/antigravity-responsibility.d.ts.map +1 -0
- package/dist/cliproxy/{antigravity-responsibility.js → auth/antigravity-responsibility.js} +2 -2
- package/dist/cliproxy/auth/antigravity-responsibility.js.map +1 -0
- package/dist/cliproxy/{auth-handler.d.ts → auth/auth-handler.d.ts} +5 -5
- package/dist/cliproxy/auth/auth-handler.d.ts.map +1 -0
- package/dist/cliproxy/{auth-handler.js → auth/auth-handler.js} +23 -23
- package/dist/cliproxy/auth/auth-handler.js.map +1 -0
- package/dist/cliproxy/{auth-session-manager.d.ts → auth/auth-session-manager.d.ts} +1 -1
- package/dist/cliproxy/auth/auth-session-manager.d.ts.map +1 -0
- package/dist/cliproxy/{auth-session-manager.js → auth/auth-session-manager.js} +16 -9
- package/dist/cliproxy/auth/auth-session-manager.js.map +1 -0
- package/dist/cliproxy/auth/auth-token-manager.d.ts.map +1 -0
- package/dist/cliproxy/{auth-token-manager.js → auth/auth-token-manager.js} +6 -6
- package/dist/cliproxy/auth/auth-token-manager.js.map +1 -0
- package/dist/cliproxy/auth/auth-types.d.ts +1 -1
- package/dist/cliproxy/auth/auth-types.d.ts.map +1 -1
- package/dist/cliproxy/auth/auth-utils.d.ts.map +1 -0
- package/dist/cliproxy/auth/auth-utils.js.map +1 -0
- package/dist/cliproxy/auth/device-code-handler.d.ts.map +1 -0
- package/dist/cliproxy/auth/device-code-handler.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 +2 -2
- package/dist/cliproxy/auth/oauth-handler.d.ts.map +1 -1
- package/dist/cliproxy/auth/oauth-handler.js +25 -5
- package/dist/cliproxy/auth/oauth-handler.js.map +1 -1
- package/dist/cliproxy/auth/oauth-process.d.ts +1 -1
- package/dist/cliproxy/auth/oauth-process.d.ts.map +1 -1
- package/dist/cliproxy/auth/oauth-process.js +3 -3
- package/dist/cliproxy/auth/oauth-process.js.map +1 -1
- package/dist/cliproxy/auth/project-selection-handler.d.ts.map +1 -0
- package/dist/cliproxy/auth/project-selection-handler.js.map +1 -0
- package/dist/cliproxy/{provider-entitlement-evidence.d.ts → auth/provider-entitlement-evidence.d.ts} +1 -1
- package/dist/cliproxy/auth/provider-entitlement-evidence.d.ts.map +1 -0
- package/dist/cliproxy/auth/provider-entitlement-evidence.js.map +1 -0
- package/dist/cliproxy/{provider-entitlement-types.d.ts → auth/provider-entitlement-types.d.ts} +1 -1
- package/dist/cliproxy/auth/provider-entitlement-types.d.ts.map +1 -0
- package/dist/cliproxy/auth/provider-entitlement-types.js.map +1 -0
- package/dist/cliproxy/auth/provider-refreshers/index.js +1 -1
- package/dist/cliproxy/auth/provider-refreshers/index.js.map +1 -1
- package/dist/cliproxy/auth/token-expiry-checker.js +1 -1
- package/dist/cliproxy/auth/token-expiry-checker.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 +4 -4
- package/dist/cliproxy/auth/token-manager.js.map +1 -1
- package/dist/cliproxy/binary/extractor.js +1 -1
- package/dist/cliproxy/binary/extractor.js.map +1 -1
- package/dist/cliproxy/binary/installer.d.ts +1 -1
- package/dist/cliproxy/binary/installer.d.ts.map +1 -1
- package/dist/cliproxy/binary/installer.js +1 -1
- package/dist/cliproxy/binary/installer.js.map +1 -1
- package/dist/cliproxy/binary/lifecycle.js +3 -3
- package/dist/cliproxy/binary/lifecycle.js.map +1 -1
- package/dist/cliproxy/{platform-detector.d.ts → binary/platform-detector.d.ts} +5 -5
- package/dist/cliproxy/binary/platform-detector.d.ts.map +1 -0
- package/dist/cliproxy/{platform-detector.js → binary/platform-detector.js} +2 -2
- package/dist/cliproxy/binary/platform-detector.js.map +1 -0
- package/dist/cliproxy/binary/tar-extractor.d.ts.map +1 -1
- package/dist/cliproxy/binary/tar-extractor.js +1 -1
- package/dist/cliproxy/binary/tar-extractor.js.map +1 -1
- package/dist/cliproxy/binary/version-cache.js +2 -2
- package/dist/cliproxy/binary/version-cache.js.map +1 -1
- package/dist/cliproxy/binary/version-checker.js +1 -1
- package/dist/cliproxy/binary/version-checker.js.map +1 -1
- package/dist/cliproxy/binary/zip-extractor.d.ts.map +1 -1
- package/dist/cliproxy/binary/zip-extractor.js +1 -1
- package/dist/cliproxy/binary/zip-extractor.js.map +1 -1
- package/dist/cliproxy/binary-manager.js +2 -2
- package/dist/cliproxy/binary-manager.js.map +1 -1
- package/dist/cliproxy/{base-config-loader.d.ts → config/base-config-loader.d.ts} +1 -1
- package/dist/cliproxy/config/base-config-loader.d.ts.map +1 -0
- package/dist/cliproxy/{base-config-loader.js → config/base-config-loader.js} +1 -1
- package/dist/cliproxy/config/base-config-loader.js.map +1 -0
- package/dist/cliproxy/config/composite-validator.d.ts.map +1 -0
- package/dist/cliproxy/{composite-validator.js → config/composite-validator.js} +2 -2
- package/dist/cliproxy/config/composite-validator.js.map +1 -0
- package/dist/cliproxy/{config-generator.d.ts → config/config-generator.d.ts} +1 -1
- package/dist/cliproxy/config/config-generator.d.ts.map +1 -0
- package/dist/cliproxy/{config-generator.js → config/config-generator.js} +1 -1
- package/dist/cliproxy/config/config-generator.js.map +1 -0
- package/dist/cliproxy/config/env-builder.js +3 -3
- package/dist/cliproxy/config/env-builder.js.map +1 -1
- package/dist/cliproxy/config/generator.js +3 -3
- package/dist/cliproxy/config/generator.js.map +1 -1
- package/dist/cliproxy/{model-config.d.ts → config/model-config.d.ts} +1 -1
- package/dist/cliproxy/config/model-config.d.ts.map +1 -0
- package/dist/cliproxy/{model-config.js → config/model-config.js} +5 -5
- package/dist/cliproxy/config/model-config.js.map +1 -0
- package/dist/cliproxy/config/thinking-config.js +1 -1
- package/dist/cliproxy/config/thinking-config.js.map +1 -1
- package/dist/cliproxy/{cliproxy-executor.d.ts → executor/cliproxy-executor.d.ts} +2 -2
- package/dist/cliproxy/executor/cliproxy-executor.d.ts.map +1 -0
- package/dist/cliproxy/{cliproxy-executor.js → executor/cliproxy-executor.js} +6 -6
- package/dist/cliproxy/executor/cliproxy-executor.js.map +1 -0
- package/dist/cliproxy/executor/env-resolver.d.ts +5 -5
- package/dist/cliproxy/executor/env-resolver.d.ts.map +1 -1
- package/dist/cliproxy/executor/env-resolver.js +3 -3
- package/dist/cliproxy/executor/env-resolver.js.map +1 -1
- package/dist/cliproxy/executor/index.d.ts +1 -1
- package/dist/cliproxy/executor/index.d.ts.map +1 -1
- package/dist/cliproxy/executor/index.js +18 -18
- package/dist/cliproxy/executor/index.js.map +1 -1
- package/dist/cliproxy/executor/lifecycle-manager.js +1 -1
- package/dist/cliproxy/executor/lifecycle-manager.js.map +1 -1
- package/dist/cliproxy/executor/retry-handler.js +3 -3
- package/dist/cliproxy/executor/retry-handler.js.map +1 -1
- package/dist/cliproxy/executor/session-bridge.d.ts.map +1 -1
- package/dist/cliproxy/executor/session-bridge.js +3 -3
- package/dist/cliproxy/executor/session-bridge.js.map +1 -1
- package/dist/cliproxy/index.d.ts +31 -31
- package/dist/cliproxy/index.d.ts.map +1 -1
- package/dist/cliproxy/index.js +20 -20
- package/dist/cliproxy/index.js.map +1 -1
- package/dist/cliproxy/{management-api-client.d.ts → management/management-api-client.d.ts} +1 -1
- package/dist/cliproxy/management/management-api-client.d.ts.map +1 -0
- package/dist/cliproxy/{management-api-client.js → management/management-api-client.js} +1 -1
- package/dist/cliproxy/management/management-api-client.js.map +1 -0
- package/dist/cliproxy/management/management-api-types.d.ts.map +1 -0
- package/dist/cliproxy/management/management-api-types.js.map +1 -0
- package/dist/cliproxy/management/remote-token-uploader.d.ts.map +1 -0
- package/dist/cliproxy/{remote-token-uploader.js → management/remote-token-uploader.js} +2 -2
- package/dist/cliproxy/management/remote-token-uploader.js.map +1 -0
- package/dist/cliproxy/model-catalog.js +1 -1
- package/dist/cliproxy/model-catalog.js.map +1 -1
- package/dist/cliproxy/proxy/https-tunnel-proxy.d.ts.map +1 -0
- package/dist/cliproxy/{https-tunnel-proxy.js → proxy/https-tunnel-proxy.js} +7 -2
- package/dist/cliproxy/proxy/https-tunnel-proxy.js.map +1 -0
- package/dist/cliproxy/{proxy-config-resolver.d.ts → proxy/proxy-config-resolver.d.ts} +1 -1
- package/dist/cliproxy/proxy/proxy-config-resolver.d.ts.map +1 -0
- package/dist/cliproxy/{proxy-config-resolver.js → proxy/proxy-config-resolver.js} +3 -3
- package/dist/cliproxy/proxy/proxy-config-resolver.js.map +1 -0
- package/dist/cliproxy/{proxy-detector.d.ts → proxy/proxy-detector.d.ts} +1 -1
- package/dist/cliproxy/proxy/proxy-detector.d.ts.map +1 -0
- package/dist/cliproxy/{proxy-detector.js → proxy/proxy-detector.js} +7 -7
- package/dist/cliproxy/proxy/proxy-detector.js.map +1 -0
- package/dist/cliproxy/proxy/proxy-target-resolver.d.ts.map +1 -0
- package/dist/cliproxy/{proxy-target-resolver.js → proxy/proxy-target-resolver.js} +7 -7
- package/dist/cliproxy/proxy/proxy-target-resolver.js.map +1 -0
- package/dist/cliproxy/proxy/tool-sanitization-proxy.d.ts.map +1 -0
- package/dist/cliproxy/{tool-sanitization-proxy.js → proxy/tool-sanitization-proxy.js} +6 -6
- package/dist/cliproxy/proxy/tool-sanitization-proxy.js.map +1 -0
- package/dist/cliproxy/quota/gemini-cli-quota-normalizer.d.ts.map +1 -0
- package/dist/cliproxy/quota/gemini-cli-quota-normalizer.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-claude-normalizer.d.ts.map +1 -0
- package/dist/cliproxy/{quota-fetcher-claude-normalizer.js → quota/quota-fetcher-claude-normalizer.js} +1 -1
- package/dist/cliproxy/quota/quota-fetcher-claude-normalizer.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-claude.d.ts.map +1 -0
- package/dist/cliproxy/{quota-fetcher-claude.js → quota/quota-fetcher-claude.js} +3 -3
- package/dist/cliproxy/quota/quota-fetcher-claude.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-codex.d.ts.map +1 -0
- package/dist/cliproxy/{quota-fetcher-codex.js → quota/quota-fetcher-codex.js} +4 -4
- package/dist/cliproxy/quota/quota-fetcher-codex.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli.d.ts.map +1 -0
- package/dist/cliproxy/{quota-fetcher-gemini-cli.js → quota/quota-fetcher-gemini-cli.js} +6 -6
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-ghcp.d.ts.map +1 -0
- package/dist/cliproxy/{quota-fetcher-ghcp.js → quota/quota-fetcher-ghcp.js} +2 -2
- package/dist/cliproxy/quota/quota-fetcher-ghcp.js.map +1 -0
- package/dist/cliproxy/{quota-fetcher.d.ts → quota/quota-fetcher.d.ts} +3 -3
- package/dist/cliproxy/quota/quota-fetcher.d.ts.map +1 -0
- package/dist/cliproxy/{quota-fetcher.js → quota/quota-fetcher.js} +33 -14
- package/dist/cliproxy/quota/quota-fetcher.js.map +1 -0
- package/dist/cliproxy/{quota-manager.d.ts → quota/quota-manager.d.ts} +2 -2
- package/dist/cliproxy/quota/quota-manager.d.ts.map +1 -0
- package/dist/cliproxy/{quota-manager.js → quota/quota-manager.js} +7 -7
- package/dist/cliproxy/quota/quota-manager.js.map +1 -0
- package/dist/cliproxy/quota/quota-response-cache.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-response-cache.js.map +1 -0
- package/dist/cliproxy/{quota-types.d.ts → quota/quota-types.d.ts} +1 -1
- package/dist/cliproxy/quota/quota-types.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-types.js.map +1 -0
- package/dist/cliproxy/{routing-strategy-http.d.ts → routing/routing-strategy-http.d.ts} +1 -1
- package/dist/cliproxy/routing/routing-strategy-http.d.ts.map +1 -0
- package/dist/cliproxy/{routing-strategy-http.js → routing/routing-strategy-http.js} +1 -1
- package/dist/cliproxy/routing/routing-strategy-http.js.map +1 -0
- package/dist/cliproxy/{routing-strategy.d.ts → routing/routing-strategy.d.ts} +1 -1
- package/dist/cliproxy/routing/routing-strategy.d.ts.map +1 -0
- package/dist/cliproxy/{routing-strategy.js → routing/routing-strategy.js} +3 -3
- package/dist/cliproxy/routing/routing-strategy.js.map +1 -0
- package/dist/cliproxy/service-manager.d.ts +3 -3
- package/dist/cliproxy/service-manager.d.ts.map +1 -1
- package/dist/cliproxy/service-manager.js +5 -5
- package/dist/cliproxy/service-manager.js.map +1 -1
- package/dist/cliproxy/services/binary-service.js +1 -1
- package/dist/cliproxy/services/binary-service.js.map +1 -1
- package/dist/cliproxy/{catalog-cache.d.ts → services/catalog-cache.d.ts} +3 -3
- package/dist/cliproxy/services/catalog-cache.d.ts.map +1 -0
- package/dist/cliproxy/{catalog-cache.js → services/catalog-cache.js} +4 -4
- package/dist/cliproxy/services/catalog-cache.js.map +1 -0
- package/dist/cliproxy/{catalog-routing.d.ts → services/catalog-routing.d.ts} +3 -3
- package/dist/cliproxy/services/catalog-routing.d.ts.map +1 -0
- package/dist/cliproxy/{catalog-routing.js → services/catalog-routing.js} +1 -1
- package/dist/cliproxy/services/catalog-routing.js.map +1 -0
- package/dist/cliproxy/services/proxy-lifecycle-service.js +1 -1
- package/dist/cliproxy/services/proxy-lifecycle-service.js.map +1 -1
- package/dist/cliproxy/{remote-auth-fetcher.d.ts → services/remote-auth-fetcher.d.ts} +2 -2
- package/dist/cliproxy/services/remote-auth-fetcher.d.ts.map +1 -0
- package/dist/cliproxy/{remote-auth-fetcher.js → services/remote-auth-fetcher.js} +2 -2
- package/dist/cliproxy/services/remote-auth-fetcher.js.map +1 -0
- package/dist/cliproxy/services/remote-proxy-client.d.ts.map +1 -0
- package/dist/cliproxy/{remote-proxy-client.js → services/remote-proxy-client.js} +1 -1
- package/dist/cliproxy/services/remote-proxy-client.js.map +1 -0
- package/dist/cliproxy/services/startup-lock.d.ts.map +1 -0
- package/dist/cliproxy/{startup-lock.js → services/startup-lock.js} +2 -2
- package/dist/cliproxy/services/startup-lock.js.map +1 -0
- package/dist/cliproxy/services/stats-fetcher.d.ts.map +1 -0
- package/dist/cliproxy/{stats-fetcher.js → services/stats-fetcher.js} +2 -2
- package/dist/cliproxy/services/stats-fetcher.js.map +1 -0
- package/dist/cliproxy/services/stats-transformer.d.ts.map +1 -0
- package/dist/cliproxy/{stats-transformer.js → services/stats-transformer.js} +3 -3
- package/dist/cliproxy/services/stats-transformer.js.map +1 -0
- package/dist/cliproxy/services/variant-config-adapter.js +1 -1
- package/dist/cliproxy/services/variant-config-adapter.js.map +1 -1
- package/dist/cliproxy/services/variant-service.js +3 -3
- package/dist/cliproxy/services/variant-service.js.map +1 -1
- package/dist/cliproxy/services/variant-settings.js +3 -3
- package/dist/cliproxy/services/variant-settings.js.map +1 -1
- package/dist/cliproxy/session-tracker.js +2 -2
- package/dist/cliproxy/session-tracker.js.map +1 -1
- package/dist/cliproxy/sync/local-config-sync.js +1 -1
- package/dist/cliproxy/sync/local-config-sync.js.map +1 -1
- package/dist/cliproxy/sync/profile-mapper.d.ts +1 -1
- package/dist/cliproxy/sync/profile-mapper.d.ts.map +1 -1
- package/dist/cliproxy/types/binary-types.d.ts +48 -0
- package/dist/cliproxy/types/binary-types.d.ts.map +1 -0
- package/dist/cliproxy/types/binary-types.js +6 -0
- package/dist/cliproxy/types/binary-types.js.map +1 -0
- package/dist/cliproxy/types/config-types.d.ts +89 -0
- package/dist/cliproxy/types/config-types.d.ts.map +1 -0
- package/dist/cliproxy/types/config-types.js +6 -0
- package/dist/cliproxy/types/config-types.js.map +1 -0
- package/dist/cliproxy/types/index.d.ts +5 -0
- package/dist/cliproxy/types/index.d.ts.map +1 -0
- package/dist/cliproxy/types/index.js +21 -0
- package/dist/cliproxy/types/index.js.map +1 -0
- package/dist/cliproxy/types/platform-types.d.ts +17 -0
- package/dist/cliproxy/types/platform-types.d.ts.map +1 -0
- package/dist/cliproxy/types/platform-types.js +6 -0
- package/dist/cliproxy/types/platform-types.js.map +1 -0
- package/dist/cliproxy/types/provider-types.d.ts +27 -0
- package/dist/cliproxy/types/provider-types.d.ts.map +1 -0
- package/dist/cliproxy/types/provider-types.js +16 -0
- package/dist/cliproxy/types/provider-types.js.map +1 -0
- package/dist/cliproxy/types.d.ts +4 -284
- package/dist/cliproxy/types.d.ts.map +1 -1
- package/dist/cliproxy/types.js +18 -14
- package/dist/cliproxy/types.js.map +1 -1
- package/dist/commands/cleanup-command.js +1 -1
- package/dist/commands/cleanup-command.js.map +1 -1
- package/dist/commands/cliproxy/auth-subcommand.js +1 -1
- package/dist/commands/cliproxy/auth-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/catalog-subcommand.js +4 -4
- package/dist/commands/cliproxy/catalog-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/help-subcommand.js +1 -1
- package/dist/commands/cliproxy/help-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/install-subcommand.js +1 -1
- package/dist/commands/cliproxy/install-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/proxy-lifecycle-subcommand.js +1 -1
- package/dist/commands/cliproxy/proxy-lifecycle-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/quota-subcommand.d.ts +1 -1
- package/dist/commands/cliproxy/quota-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/quota-subcommand.js +8 -8
- package/dist/commands/cliproxy/quota-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/routing-subcommand.js +1 -1
- package/dist/commands/cliproxy/routing-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/variant-subcommand.js +4 -4
- package/dist/commands/cliproxy/variant-subcommand.js.map +1 -1
- package/dist/commands/command-catalog.d.ts.map +1 -1
- package/dist/commands/command-catalog.js +4 -0
- package/dist/commands/command-catalog.js.map +1 -1
- package/dist/commands/config-command.js +1 -1
- package/dist/commands/config-command.js.map +1 -1
- package/dist/commands/doctor-command.d.ts.map +1 -1
- package/dist/commands/doctor-command.js +9 -0
- package/dist/commands/doctor-command.js.map +1 -1
- package/dist/commands/tokens-command.js +1 -1
- package/dist/commands/tokens-command.js.map +1 -1
- package/dist/config/config-loader-facade.d.ts +57 -0
- package/dist/config/config-loader-facade.d.ts.map +1 -0
- package/dist/config/config-loader-facade.js +131 -0
- package/dist/config/config-loader-facade.js.map +1 -0
- package/dist/config/schemas/auth.d.ts +97 -0
- package/dist/config/schemas/auth.d.ts.map +1 -0
- package/dist/config/schemas/auth.js +25 -0
- package/dist/config/schemas/auth.js.map +1 -0
- package/dist/config/schemas/browser.d.ts +53 -0
- package/dist/config/schemas/browser.d.ts.map +1 -0
- package/dist/config/schemas/browser.js +27 -0
- package/dist/config/schemas/browser.js.map +1 -0
- package/dist/config/schemas/channels.d.ts +27 -0
- package/dist/config/schemas/channels.d.ts.map +1 -0
- package/dist/config/schemas/channels.js +19 -0
- package/dist/config/schemas/channels.js.map +1 -0
- package/dist/config/schemas/cliproxy.d.ts +140 -0
- package/dist/config/schemas/cliproxy.d.ts.map +1 -0
- package/dist/config/schemas/cliproxy.js +18 -0
- package/dist/config/schemas/cliproxy.js.map +1 -0
- package/dist/config/schemas/copilot-cursor.d.ts +75 -0
- package/dist/config/schemas/copilot-cursor.d.ts.map +1 -0
- package/dist/config/schemas/copilot-cursor.js +36 -0
- package/dist/config/schemas/copilot-cursor.js.map +1 -0
- package/dist/config/schemas/index.d.ts +28 -0
- package/dist/config/schemas/index.d.ts.map +1 -0
- package/dist/config/schemas/index.js +51 -0
- package/dist/config/schemas/index.js.map +1 -0
- package/dist/config/schemas/logging.d.ts +43 -0
- package/dist/config/schemas/logging.d.ts.map +1 -0
- package/dist/config/schemas/logging.js +23 -0
- package/dist/config/schemas/logging.js.map +1 -0
- package/dist/config/schemas/providers.d.ts +14 -0
- package/dist/config/schemas/providers.d.ts.map +1 -0
- package/dist/config/schemas/providers.js +21 -0
- package/dist/config/schemas/providers.js.map +1 -0
- package/dist/config/schemas/proxy-server.d.ts +141 -0
- package/dist/config/schemas/proxy-server.d.ts.map +1 -0
- package/dist/config/schemas/proxy-server.js +71 -0
- package/dist/config/schemas/proxy-server.js.map +1 -0
- package/dist/config/schemas/quota.d.ts +88 -0
- package/dist/config/schemas/quota.d.ts.map +1 -0
- package/dist/config/schemas/quota.js +47 -0
- package/dist/config/schemas/quota.js.map +1 -0
- package/dist/config/schemas/thinking.d.ts +50 -0
- package/dist/config/schemas/thinking.d.ts.map +1 -0
- package/dist/config/schemas/thinking.js +26 -0
- package/dist/config/schemas/thinking.js.map +1 -0
- package/dist/config/schemas/unified-config.d.ts +74 -0
- package/dist/config/schemas/unified-config.d.ts.map +1 -0
- package/dist/config/schemas/unified-config.js +131 -0
- package/dist/config/schemas/unified-config.js.map +1 -0
- package/dist/config/schemas/version.d.ts +23 -0
- package/dist/config/schemas/version.d.ts.map +1 -0
- package/dist/config/schemas/version.js +26 -0
- package/dist/config/schemas/version.js.map +1 -0
- package/dist/config/schemas/websearch.d.ts +138 -0
- package/dist/config/schemas/websearch.d.ts.map +1 -0
- package/dist/config/schemas/websearch.js +12 -0
- package/dist/config/schemas/websearch.js.map +1 -0
- package/dist/config/unified-config-loader.js +1 -1
- package/dist/config/unified-config-loader.js.map +1 -1
- package/dist/config/unified-config-types.d.ts +3 -818
- package/dist/config/unified-config-types.d.ts.map +1 -1
- package/dist/config/unified-config-types.js +19 -319
- package/dist/config/unified-config-types.js.map +1 -1
- package/dist/copilot/copilot-auth.d.ts.map +1 -1
- package/dist/copilot/copilot-auth.js +22 -0
- package/dist/copilot/copilot-auth.js.map +1 -1
- package/dist/copilot/copilot-daemon.d.ts.map +1 -1
- package/dist/copilot/copilot-daemon.js +26 -0
- package/dist/copilot/copilot-daemon.js.map +1 -1
- package/dist/copilot/copilot-executor.d.ts +1 -1
- package/dist/copilot/copilot-executor.d.ts.map +1 -1
- package/dist/copilot/copilot-executor.js +23 -1
- package/dist/copilot/copilot-executor.js.map +1 -1
- package/dist/cursor/cursor-daemon.d.ts.map +1 -1
- package/dist/cursor/cursor-daemon.js +28 -1
- package/dist/cursor/cursor-daemon.js.map +1 -1
- package/dist/cursor/cursor-executor.d.ts.map +1 -1
- package/dist/cursor/cursor-executor.js +17 -1
- package/dist/cursor/cursor-executor.js.map +1 -1
- package/dist/delegation/delegation-handler.d.ts.map +1 -1
- package/dist/delegation/delegation-handler.js +4 -1
- package/dist/delegation/delegation-handler.js.map +1 -1
- package/dist/docker/docker-bootstrap.js +1 -1
- package/dist/docker/docker-bootstrap.js.map +1 -1
- package/dist/errors/error-types.d.ts +9 -0
- package/dist/errors/error-types.d.ts.map +1 -1
- package/dist/errors/error-types.js +15 -1
- package/dist/errors/error-types.js.map +1 -1
- package/dist/errors/index.d.ts +1 -1
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +3 -1
- package/dist/errors/index.js.map +1 -1
- package/dist/glmt/glmt-proxy.d.ts.map +1 -1
- package/dist/glmt/glmt-proxy.js +7 -0
- package/dist/glmt/glmt-proxy.js.map +1 -1
- package/dist/glmt/glmt-transformer.d.ts.map +1 -1
- package/dist/glmt/glmt-transformer.js +1 -3
- package/dist/glmt/glmt-transformer.js.map +1 -1
- package/dist/management/checks/image-analysis-check.js +2 -2
- package/dist/management/checks/image-analysis-check.js.map +1 -1
- package/dist/management/instance-manager.d.ts.map +1 -1
- package/dist/management/instance-manager.js +9 -0
- package/dist/management/instance-manager.js.map +1 -1
- package/dist/management/plugin-path-normalizer.d.ts +7 -0
- package/dist/management/plugin-path-normalizer.d.ts.map +1 -0
- package/dist/management/plugin-path-normalizer.js +82 -0
- package/dist/management/plugin-path-normalizer.js.map +1 -0
- package/dist/management/shared-manager.d.ts +1 -2
- package/dist/management/shared-manager.d.ts.map +1 -1
- package/dist/management/shared-manager.js +8 -56
- package/dist/management/shared-manager.js.map +1 -1
- package/dist/proxy/server/messages-route.d.ts.map +1 -1
- package/dist/proxy/server/messages-route.js +50 -9
- package/dist/proxy/server/messages-route.js.map +1 -1
- package/dist/proxy/server/proxy-server.d.ts.map +1 -1
- package/dist/proxy/server/proxy-server.js +24 -6
- package/dist/proxy/server/proxy-server.js.map +1 -1
- package/dist/proxy/transformers/request-transformer.d.ts +1 -0
- package/dist/proxy/transformers/request-transformer.d.ts.map +1 -1
- package/dist/proxy/transformers/request-transformer.js +10 -1
- package/dist/proxy/transformers/request-transformer.js.map +1 -1
- package/dist/services/logging/index.d.ts +6 -1
- package/dist/services/logging/index.d.ts.map +1 -1
- package/dist/services/logging/index.js +16 -1
- package/dist/services/logging/index.js.map +1 -1
- package/dist/services/logging/log-context.d.ts +41 -0
- package/dist/services/logging/log-context.d.ts.map +1 -0
- package/dist/services/logging/log-context.js +51 -0
- package/dist/services/logging/log-context.js.map +1 -0
- package/dist/services/logging/log-redaction.d.ts +8 -0
- package/dist/services/logging/log-redaction.d.ts.map +1 -1
- package/dist/services/logging/log-redaction.js +40 -3
- package/dist/services/logging/log-redaction.js.map +1 -1
- package/dist/services/logging/log-types.d.ts +30 -0
- package/dist/services/logging/log-types.d.ts.map +1 -1
- package/dist/services/logging/log-types.js +15 -1
- package/dist/services/logging/log-types.js.map +1 -1
- package/dist/services/logging/logger.d.ts +17 -0
- package/dist/services/logging/logger.d.ts.map +1 -1
- package/dist/services/logging/logger.js +23 -4
- package/dist/services/logging/logger.js.map +1 -1
- package/dist/shared/claude-extension-setup.js +1 -1
- package/dist/shared/claude-extension-setup.js.map +1 -1
- package/dist/targets/claude-adapter.d.ts.map +1 -1
- package/dist/targets/claude-adapter.js +11 -0
- package/dist/targets/claude-adapter.js.map +1 -1
- package/dist/targets/codex-adapter.d.ts.map +1 -1
- package/dist/targets/codex-adapter.js +11 -0
- package/dist/targets/codex-adapter.js.map +1 -1
- package/dist/targets/droid-adapter.d.ts.map +1 -1
- package/dist/targets/droid-adapter.js +11 -0
- package/dist/targets/droid-adapter.js.map +1 -1
- package/dist/ui/assets/{accounts-CP_Nosd7.js → accounts-CybVGDsm.js} +1 -1
- package/dist/ui/assets/{alert-dialog-CjnZBDj3.js → alert-dialog-C6npAhT0.js} +1 -1
- package/dist/ui/assets/{api-B7mmrAjt.js → api-DZosWVkR.js} +1 -1
- package/dist/ui/assets/{auth-section-BFQ8Mu15.js → auth-section-D4MZkgcP.js} +1 -1
- package/dist/ui/assets/{backups-section-CPwm9q19.js → backups-section-DvMJrmHH.js} +1 -1
- package/dist/ui/assets/{channels-B2colnY7.js → channels-BVftYfOn.js} +1 -1
- package/dist/ui/assets/{charts-BBPXh0Ar.js → charts-CeK2xCSo.js} +1 -1
- package/dist/ui/assets/{checkbox-BAMXPp68.js → checkbox-BLRznRTO.js} +1 -1
- package/dist/ui/assets/{claude-extension-BDVoXHr-.js → claude-extension-C6OeBQ73.js} +1 -1
- package/dist/ui/assets/cliproxy-B3Jyu3r9.js +3 -0
- package/dist/ui/assets/{cliproxy-ai-providers-8dH1cHVk.js → cliproxy-ai-providers-BAJ78pUc.js} +1 -1
- package/dist/ui/assets/{cliproxy-control-panel-CC8HzA8e.js → cliproxy-control-panel-XEvUMVJe.js} +1 -1
- package/dist/ui/assets/{code-highlight-BRUf_pqB.js → code-highlight-D4E79GKQ.js} +1 -1
- package/dist/ui/assets/{codex-C6Q9rOwp.js → codex-CY2vikqX.js} +1 -1
- package/dist/ui/assets/{confirm-dialog-D0VQlM7B.js → confirm-dialog-DjLHh1qX.js} +1 -1
- package/dist/ui/assets/{copilot-CgG2oaRV.js → copilot-afee2lL9.js} +1 -1
- package/dist/ui/assets/{cursor-CE1giQU2.js → cursor-DuWy60wp.js} +1 -1
- package/dist/ui/assets/{droid-FG2w7nRu.js → droid-FlceoQ6k.js} +1 -1
- package/dist/ui/assets/{form-utils-Bcoyqxpq.js → form-utils-CuHzLhJZ.js} +1 -1
- package/dist/ui/assets/{globalenv-section-BJbBud4W.js → globalenv-section-DpJ7unxC.js} +1 -1
- package/dist/ui/assets/{health-Dh7o4wt7.js → health-BEMgcKD3.js} +1 -1
- package/dist/ui/assets/icons-DQFHtVq5.js +1 -0
- package/dist/ui/assets/{index-BNTqP5R7.js → index-0GkznW41.js} +1 -1
- package/dist/ui/assets/{index-B6bIHdvz.js → index-0n_43sCZ.js} +1 -1
- package/dist/ui/assets/index-6xrth3Oz.css +1 -0
- package/dist/ui/assets/{index-0mNJhDEG.js → index-BRtgic66.js} +29 -29
- package/dist/ui/assets/{index-Bj8UFR7b.js → index-Ba4ysocb.js} +1 -1
- package/dist/ui/assets/{index-BNW5qVXZ.js → index-Cj7EjEq6.js} +1 -1
- package/dist/ui/assets/{index-X21iqV9e.js → index-Cq9VySs6.js} +1 -1
- package/dist/ui/assets/{index-DTAdzUUA.js → index-DOC7_hun.js} +1 -1
- package/dist/ui/assets/logs-Dth4naJl.js +1 -0
- package/dist/ui/assets/{masked-input-DygH0M2a.js → masked-input-DL6pJ8pE.js} +1 -1
- package/dist/ui/assets/{notifications-B2HqRBj7.js → notifications-B4_o8bcr.js} +1 -1
- package/dist/ui/assets/{proxy-g4_N-fbB.js → proxy-C4-M_9kB.js} +1 -1
- package/dist/ui/assets/{proxy-status-widget-BWjGFUas.js → proxy-status-widget-DW4cPFeD.js} +1 -1
- package/dist/ui/assets/{radix-ui-Zb8sVEtn.js → radix-ui-nu4wz29m.js} +1 -1
- package/dist/ui/assets/{raw-json-settings-editor-panel-DYpsr-1d.js → raw-json-settings-editor-panel-Dcumu3Qi.js} +1 -1
- package/dist/ui/assets/{react-vendor-CNOkPC89.js → react-vendor-Bjx91N7w.js} +1 -1
- package/dist/ui/assets/{searchable-select-BKx31cCH.js → searchable-select-CWL2D5Ft.js} +1 -1
- package/dist/ui/assets/{separator-mG07scBE.js → separator-Do_vqTQD.js} +1 -1
- package/dist/ui/assets/{shared-hbFOfnWU.js → shared-CwWuZx24.js} +1 -1
- package/dist/ui/assets/{table-DoECcNZ-.js → table-BP6nBZzg.js} +1 -1
- package/dist/ui/assets/{tanstack-CrmUhA7Z.js → tanstack-bhJxV1h8.js} +1 -1
- package/dist/ui/assets/{updates-BSeFQRwL.js → updates-BTHJZ7Rk.js} +1 -1
- package/dist/ui/index.html +9 -9
- package/dist/utils/hooks/get-image-analysis-hook-env.d.ts +1 -1
- package/dist/utils/hooks/get-image-analysis-hook-env.d.ts.map +1 -1
- package/dist/utils/hooks/get-image-analysis-hook-env.js +2 -2
- package/dist/utils/hooks/get-image-analysis-hook-env.js.map +1 -1
- 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/utils/hooks/image-analysis-runtime-status.d.ts +4 -4
- package/dist/utils/hooks/image-analysis-runtime-status.d.ts.map +1 -1
- package/dist/utils/hooks/image-analysis-runtime-status.js +5 -5
- package/dist/utils/hooks/image-analysis-runtime-status.js.map +1 -1
- package/dist/utils/retry-strategy.d.ts +37 -0
- package/dist/utils/retry-strategy.d.ts.map +1 -0
- package/dist/utils/retry-strategy.js +99 -0
- package/dist/utils/retry-strategy.js.map +1 -0
- package/dist/web-server/health/cliproxy-checks.js +2 -2
- package/dist/web-server/health/cliproxy-checks.js.map +1 -1
- package/dist/web-server/index.js +2 -2
- package/dist/web-server/index.js.map +1 -1
- package/dist/web-server/overview-routes.js +1 -1
- package/dist/web-server/overview-routes.js.map +1 -1
- package/dist/web-server/routes/account-routes.js +1 -1
- package/dist/web-server/routes/account-routes.js.map +1 -1
- package/dist/web-server/routes/catalog-routes.js +1 -1
- package/dist/web-server/routes/catalog-routes.js.map +1 -1
- package/dist/web-server/routes/cliproxy-auth-routes.js +10 -10
- package/dist/web-server/routes/cliproxy-auth-routes.js.map +1 -1
- package/dist/web-server/routes/cliproxy-routing-routes.js +1 -1
- package/dist/web-server/routes/cliproxy-routing-routes.js.map +1 -1
- package/dist/web-server/routes/cliproxy-stats-routes.js +10 -10
- package/dist/web-server/routes/cliproxy-stats-routes.js.map +1 -1
- package/dist/web-server/routes/image-analysis-routes.js +1 -1
- package/dist/web-server/routes/image-analysis-routes.js.map +1 -1
- package/dist/web-server/routes/provider-routes.js +1 -1
- package/dist/web-server/routes/provider-routes.js.map +1 -1
- package/dist/web-server/routes/proxy-routes.js +2 -2
- package/dist/web-server/routes/proxy-routes.js.map +1 -1
- package/dist/web-server/routes/route-helpers.js +1 -1
- package/dist/web-server/routes/route-helpers.js.map +1 -1
- package/dist/web-server/routes/settings-routes.js +2 -2
- package/dist/web-server/routes/settings-routes.js.map +1 -1
- package/dist/web-server/routes/variant-routes.js +1 -1
- package/dist/web-server/routes/variant-routes.js.map +1 -1
- package/dist/web-server/services/cliproxy-dashboard-install-service.js +1 -1
- package/dist/web-server/services/cliproxy-dashboard-install-service.js.map +1 -1
- package/dist/web-server/usage/cliproxy-usage-syncer.d.ts +1 -1
- package/dist/web-server/usage/cliproxy-usage-syncer.d.ts.map +1 -1
- package/dist/web-server/usage/cliproxy-usage-syncer.js +1 -1
- package/dist/web-server/usage/cliproxy-usage-syncer.js.map +1 -1
- package/dist/web-server/usage/cliproxy-usage-transformer.d.ts +1 -1
- package/dist/web-server/usage/cliproxy-usage-transformer.d.ts.map +1 -1
- package/dist/web-server/usage/cliproxy-usage-transformer.js.map +1 -1
- package/dist/web-server/websocket.js +2 -2
- package/dist/web-server/websocket.js.map +1 -1
- package/package.json +1 -1
- package/scripts/run-test-bucket.js +3 -1
- package/dist/cliproxy/account-manager.d.ts.map +0 -1
- package/dist/cliproxy/account-manager.js.map +0 -1
- package/dist/cliproxy/account-safety.d.ts.map +0 -1
- package/dist/cliproxy/account-safety.js.map +0 -1
- package/dist/cliproxy/account-stats-key.d.ts.map +0 -1
- package/dist/cliproxy/account-stats-key.js.map +0 -1
- package/dist/cliproxy/antigravity-responsibility.d.ts.map +0 -1
- package/dist/cliproxy/antigravity-responsibility.js.map +0 -1
- package/dist/cliproxy/auth-handler.d.ts.map +0 -1
- package/dist/cliproxy/auth-handler.js.map +0 -1
- package/dist/cliproxy/auth-session-manager.d.ts.map +0 -1
- package/dist/cliproxy/auth-session-manager.js.map +0 -1
- package/dist/cliproxy/auth-token-manager.d.ts.map +0 -1
- package/dist/cliproxy/auth-token-manager.js.map +0 -1
- package/dist/cliproxy/auth-utils.d.ts.map +0 -1
- package/dist/cliproxy/auth-utils.js.map +0 -1
- package/dist/cliproxy/base-config-loader.d.ts.map +0 -1
- package/dist/cliproxy/base-config-loader.js.map +0 -1
- package/dist/cliproxy/catalog-cache.d.ts.map +0 -1
- package/dist/cliproxy/catalog-cache.js.map +0 -1
- package/dist/cliproxy/catalog-routing.d.ts.map +0 -1
- package/dist/cliproxy/catalog-routing.js.map +0 -1
- package/dist/cliproxy/cliproxy-executor.d.ts.map +0 -1
- package/dist/cliproxy/cliproxy-executor.js.map +0 -1
- package/dist/cliproxy/codex-plan-compatibility.d.ts.map +0 -1
- package/dist/cliproxy/codex-plan-compatibility.js.map +0 -1
- package/dist/cliproxy/codex-reasoning-proxy.d.ts.map +0 -1
- package/dist/cliproxy/codex-reasoning-proxy.js.map +0 -1
- package/dist/cliproxy/composite-validator.d.ts.map +0 -1
- package/dist/cliproxy/composite-validator.js.map +0 -1
- package/dist/cliproxy/config-generator.d.ts.map +0 -1
- package/dist/cliproxy/config-generator.js.map +0 -1
- package/dist/cliproxy/device-code-handler.d.ts.map +0 -1
- package/dist/cliproxy/device-code-handler.js.map +0 -1
- package/dist/cliproxy/gemini-cli-quota-normalizer.d.ts.map +0 -1
- package/dist/cliproxy/gemini-cli-quota-normalizer.js.map +0 -1
- package/dist/cliproxy/https-tunnel-proxy.d.ts.map +0 -1
- package/dist/cliproxy/https-tunnel-proxy.js.map +0 -1
- package/dist/cliproxy/managed-model-prefixes.d.ts.map +0 -1
- package/dist/cliproxy/managed-model-prefixes.js.map +0 -1
- package/dist/cliproxy/management-api-client.d.ts.map +0 -1
- package/dist/cliproxy/management-api-client.js.map +0 -1
- package/dist/cliproxy/management-api-types.d.ts.map +0 -1
- package/dist/cliproxy/management-api-types.js.map +0 -1
- package/dist/cliproxy/model-config.d.ts.map +0 -1
- package/dist/cliproxy/model-config.js.map +0 -1
- package/dist/cliproxy/model-id-normalizer.d.ts.map +0 -1
- package/dist/cliproxy/model-id-normalizer.js.map +0 -1
- package/dist/cliproxy/openai-compat-manager.d.ts.map +0 -1
- package/dist/cliproxy/openai-compat-manager.js.map +0 -1
- package/dist/cliproxy/platform-detector.d.ts.map +0 -1
- package/dist/cliproxy/platform-detector.js.map +0 -1
- package/dist/cliproxy/project-selection-handler.d.ts.map +0 -1
- package/dist/cliproxy/project-selection-handler.js.map +0 -1
- package/dist/cliproxy/provider-entitlement-evidence.d.ts.map +0 -1
- package/dist/cliproxy/provider-entitlement-evidence.js.map +0 -1
- package/dist/cliproxy/provider-entitlement-types.d.ts.map +0 -1
- package/dist/cliproxy/provider-entitlement-types.js.map +0 -1
- package/dist/cliproxy/proxy-config-resolver.d.ts.map +0 -1
- package/dist/cliproxy/proxy-config-resolver.js.map +0 -1
- package/dist/cliproxy/proxy-detector.d.ts.map +0 -1
- package/dist/cliproxy/proxy-detector.js.map +0 -1
- package/dist/cliproxy/proxy-target-resolver.d.ts.map +0 -1
- package/dist/cliproxy/proxy-target-resolver.js.map +0 -1
- package/dist/cliproxy/quota-fetcher-claude-normalizer.d.ts.map +0 -1
- package/dist/cliproxy/quota-fetcher-claude-normalizer.js.map +0 -1
- package/dist/cliproxy/quota-fetcher-claude.d.ts.map +0 -1
- package/dist/cliproxy/quota-fetcher-claude.js.map +0 -1
- package/dist/cliproxy/quota-fetcher-codex.d.ts.map +0 -1
- package/dist/cliproxy/quota-fetcher-codex.js.map +0 -1
- package/dist/cliproxy/quota-fetcher-gemini-cli.d.ts.map +0 -1
- package/dist/cliproxy/quota-fetcher-gemini-cli.js.map +0 -1
- package/dist/cliproxy/quota-fetcher-ghcp.d.ts.map +0 -1
- package/dist/cliproxy/quota-fetcher-ghcp.js.map +0 -1
- package/dist/cliproxy/quota-fetcher.d.ts.map +0 -1
- package/dist/cliproxy/quota-fetcher.js.map +0 -1
- package/dist/cliproxy/quota-manager.d.ts.map +0 -1
- package/dist/cliproxy/quota-manager.js.map +0 -1
- package/dist/cliproxy/quota-response-cache.d.ts.map +0 -1
- package/dist/cliproxy/quota-response-cache.js.map +0 -1
- package/dist/cliproxy/quota-types.d.ts.map +0 -1
- package/dist/cliproxy/quota-types.js.map +0 -1
- package/dist/cliproxy/remote-auth-fetcher.d.ts.map +0 -1
- package/dist/cliproxy/remote-auth-fetcher.js.map +0 -1
- package/dist/cliproxy/remote-proxy-client.d.ts.map +0 -1
- package/dist/cliproxy/remote-proxy-client.js.map +0 -1
- package/dist/cliproxy/remote-token-uploader.d.ts.map +0 -1
- package/dist/cliproxy/remote-token-uploader.js.map +0 -1
- package/dist/cliproxy/routing-strategy-http.d.ts.map +0 -1
- package/dist/cliproxy/routing-strategy-http.js.map +0 -1
- package/dist/cliproxy/routing-strategy.d.ts.map +0 -1
- package/dist/cliproxy/routing-strategy.js.map +0 -1
- package/dist/cliproxy/schema-sanitizer.d.ts.map +0 -1
- package/dist/cliproxy/schema-sanitizer.js.map +0 -1
- package/dist/cliproxy/startup-lock.d.ts.map +0 -1
- package/dist/cliproxy/startup-lock.js.map +0 -1
- package/dist/cliproxy/stats-fetcher.d.ts.map +0 -1
- package/dist/cliproxy/stats-fetcher.js.map +0 -1
- package/dist/cliproxy/stats-transformer.d.ts.map +0 -1
- package/dist/cliproxy/stats-transformer.js.map +0 -1
- package/dist/cliproxy/tool-name-mapper.d.ts.map +0 -1
- package/dist/cliproxy/tool-name-mapper.js.map +0 -1
- package/dist/cliproxy/tool-name-sanitizer.d.ts.map +0 -1
- package/dist/cliproxy/tool-name-sanitizer.js.map +0 -1
- package/dist/cliproxy/tool-sanitization-proxy.d.ts.map +0 -1
- package/dist/cliproxy/tool-sanitization-proxy.js.map +0 -1
- package/dist/ui/assets/cliproxy-CuLlmDu7.js +0 -3
- package/dist/ui/assets/icons-DyorC3Xk.js +0 -1
- package/dist/ui/assets/index-DM5Khyln.css +0 -1
- package/dist/ui/assets/logs-CxwEaeVS.js +0 -1
- /package/dist/cliproxy/{account-stats-key.d.ts → accounts/account-stats-key.d.ts} +0 -0
- /package/dist/cliproxy/{account-stats-key.js → accounts/account-stats-key.js} +0 -0
- /package/dist/cliproxy/{codex-reasoning-proxy.d.ts → ai-providers/codex-reasoning-proxy.d.ts} +0 -0
- /package/dist/cliproxy/{openai-compat-manager.d.ts → ai-providers/openai-compat-manager.d.ts} +0 -0
- /package/dist/cliproxy/{schema-sanitizer.d.ts → ai-providers/schema-sanitizer.d.ts} +0 -0
- /package/dist/cliproxy/{schema-sanitizer.js → ai-providers/schema-sanitizer.js} +0 -0
- /package/dist/cliproxy/{antigravity-responsibility.d.ts → auth/antigravity-responsibility.d.ts} +0 -0
- /package/dist/cliproxy/{auth-token-manager.d.ts → auth/auth-token-manager.d.ts} +0 -0
- /package/dist/cliproxy/{auth-utils.d.ts → auth/auth-utils.d.ts} +0 -0
- /package/dist/cliproxy/{auth-utils.js → auth/auth-utils.js} +0 -0
- /package/dist/cliproxy/{device-code-handler.d.ts → auth/device-code-handler.d.ts} +0 -0
- /package/dist/cliproxy/{device-code-handler.js → auth/device-code-handler.js} +0 -0
- /package/dist/cliproxy/{project-selection-handler.d.ts → auth/project-selection-handler.d.ts} +0 -0
- /package/dist/cliproxy/{project-selection-handler.js → auth/project-selection-handler.js} +0 -0
- /package/dist/cliproxy/{provider-entitlement-evidence.js → auth/provider-entitlement-evidence.js} +0 -0
- /package/dist/cliproxy/{provider-entitlement-types.js → auth/provider-entitlement-types.js} +0 -0
- /package/dist/cliproxy/{composite-validator.d.ts → config/composite-validator.d.ts} +0 -0
- /package/dist/cliproxy/{management-api-types.d.ts → management/management-api-types.d.ts} +0 -0
- /package/dist/cliproxy/{management-api-types.js → management/management-api-types.js} +0 -0
- /package/dist/cliproxy/{remote-token-uploader.d.ts → management/remote-token-uploader.d.ts} +0 -0
- /package/dist/cliproxy/{https-tunnel-proxy.d.ts → proxy/https-tunnel-proxy.d.ts} +0 -0
- /package/dist/cliproxy/{proxy-target-resolver.d.ts → proxy/proxy-target-resolver.d.ts} +0 -0
- /package/dist/cliproxy/{tool-sanitization-proxy.d.ts → proxy/tool-sanitization-proxy.d.ts} +0 -0
- /package/dist/cliproxy/{gemini-cli-quota-normalizer.d.ts → quota/gemini-cli-quota-normalizer.d.ts} +0 -0
- /package/dist/cliproxy/{gemini-cli-quota-normalizer.js → quota/gemini-cli-quota-normalizer.js} +0 -0
- /package/dist/cliproxy/{quota-fetcher-claude-normalizer.d.ts → quota/quota-fetcher-claude-normalizer.d.ts} +0 -0
- /package/dist/cliproxy/{quota-fetcher-claude.d.ts → quota/quota-fetcher-claude.d.ts} +0 -0
- /package/dist/cliproxy/{quota-fetcher-codex.d.ts → quota/quota-fetcher-codex.d.ts} +0 -0
- /package/dist/cliproxy/{quota-fetcher-gemini-cli.d.ts → quota/quota-fetcher-gemini-cli.d.ts} +0 -0
- /package/dist/cliproxy/{quota-fetcher-ghcp.d.ts → quota/quota-fetcher-ghcp.d.ts} +0 -0
- /package/dist/cliproxy/{quota-response-cache.d.ts → quota/quota-response-cache.d.ts} +0 -0
- /package/dist/cliproxy/{quota-response-cache.js → quota/quota-response-cache.js} +0 -0
- /package/dist/cliproxy/{quota-types.js → quota/quota-types.js} +0 -0
- /package/dist/cliproxy/{remote-proxy-client.d.ts → services/remote-proxy-client.d.ts} +0 -0
- /package/dist/cliproxy/{startup-lock.d.ts → services/startup-lock.d.ts} +0 -0
- /package/dist/cliproxy/{stats-fetcher.d.ts → services/stats-fetcher.d.ts} +0 -0
- /package/dist/cliproxy/{stats-transformer.d.ts → services/stats-transformer.d.ts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as N}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 y,aI as J,r as P,s as D,t as O,v as L,w as b,I as S,n as fe,W as C,bf as se,bg as Pe,c as De,bm as He,bn as ve,bo as Qe,Q as Je,R as Ze,U as ae,V as oe,bh as be}from"./index-0mNJhDEG.js";import{aa as es,aS as ss,at as re,L as z,n as rs,aT as ts,aU as ns,aC as as,w as os,a7 as ls,aV as is,aW as cs,aX as ds,ai as me,p as we,$ as xs,m as us,o as ms,_ as ps,S as hs,aN as Ne,aY as fs,x as gs,I as js,T as vs,N as bs}from"./icons-DyorC3Xk.js";import{S as ee}from"./separator-mG07scBE.js";import{a as ws,u as Ce,b as ye}from"./tanstack-CrmUhA7Z.js";import"./code-highlight-BRUf_pqB.js";import{T as Ns,a as Cs,b as Se,c as le,d as ys,e as ie}from"./table-DoECcNZ-.js";import{R as Ss}from"./raw-json-settings-editor-panel-DYpsr-1d.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";function Z({title:r,icon:s,badge:t,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:[s,r,t?e.jsx(_,{variant:"outline",className:"text-[10px] font-normal",children:t}):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:r,state:s,disabled:t=!1,disabledReason:l,onToggle:o}){const{t:n}=E(),a=new Set(r.map(i=>i.name)),c=Object.entries(s).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:r.map(i=>{const d=s[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(y,{variant:"outline",size:"sm",onClick:()=>o(i.name,null),disabled:t,children:n("codex.useDefault")}):null,e.jsx(J,{checked:d===!0,onCheckedChange:m=>o(i.name,m),disabled:t})]})]},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(y,{variant:"outline",size:"sm",onClick:()=>o(i,null),disabled:t,children:n("codex.useDefault")}),e.jsx(J,{checked:d===!0,onCheckedChange:m=>o(i,m),disabled:t})]})]},i))]}):null]})}const ks={name:"",transport:"stdio",command:null,args:[],url:null,enabled:!0,required:!1,startupTimeoutSec:null,toolTimeoutSec:null,enabledTools:[],disabledTools:[],isCcsManaged:!1,managementSurface:null};function ce(r){return r.join(", ")}function de(r){return r.split(",").map(s=>s.trim()).filter(Boolean)}function Ts({initialDraft:r,isNew:s,disabled:t,saving:l,canDelete:o,onSave:n,onDelete:a}){const{t:c}=E(),[i,d]=N.useState(r),m=s&&i.name.trim()==="ccs_browser";return e.jsxs(e.Fragment,{children:[m?e.jsxs("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-900 dark:text-amber-200",children:[e.jsx("strong",{children:"ccs_browser"})," is reserved for the CCS-managed browser tooling path. Configure it from ",e.jsx("code",{children:"Settings > Browser"})," instead of creating it here."]}):null,e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(S,{value:i.name,onChange:p=>d(x=>({...x,name:p.target.value})),placeholder:"playwright",disabled:t||!s}),e.jsxs(P,{value:i.transport,onValueChange:p=>d(x=>({...x,transport:p})),disabled:t,children:[e.jsx(D,{children:e.jsx(O,{})}),e.jsxs(L,{children:[e.jsx(b,{value:"stdio",children:c("codex.stdio")}),e.jsx(b,{value:"streamable-http",children:c("codex.streamableHttp")})]})]}),i.transport==="stdio"?e.jsxs(e.Fragment,{children:[e.jsx(S,{value:i.command??"",onChange:p=>d(x=>({...x,command:p.target.value||null})),placeholder:"npx",disabled:t}),e.jsx(S,{value:ce(i.args),onChange:p=>d(x=>({...x,args:de(p.target.value)})),placeholder:"@playwright/mcp@latest, --flag",disabled:t})]}):e.jsx(S,{className:"sm:col-span-2",value:i.url??"",onChange:p=>d(x=>({...x,url:p.target.value||null})),placeholder:"https://example.test/mcp",disabled:t}),e.jsx(S,{type:"number",min:1,value:i.startupTimeoutSec??"",onChange:p=>d(x=>({...x,startupTimeoutSec:p.target.value?Number(p.target.value):null})),placeholder:"Startup timeout (sec)",disabled:t}),e.jsx(S,{type:"number",min:1,value:i.toolTimeoutSec??"",onChange:p=>d(x=>({...x,toolTimeoutSec:p.target.value?Number(p.target.value):null})),placeholder:"Tool timeout (sec)",disabled:t}),e.jsx(S,{value:ce(i.enabledTools),onChange:p=>d(x=>({...x,enabledTools:de(p.target.value)})),placeholder:"enabled_tools",disabled:t}),e.jsx(S,{value:ce(i.disabledTools),onChange:p=>d(x=>({...x,disabledTools:de(p.target.value)})),placeholder:"disabled_tools",disabled:t})]}),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:p=>d(x=>({...x,enabled:p})),disabled:t})]}),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:p=>d(x=>({...x,required:p})),disabled:t})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs(y,{variant:"outline",onClick:a,disabled:t||l||!o,children:[e.jsx(re,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsxs(y,{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:t||l||i.name.trim().length===0||m,children:[l?e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save MCP server"]})]})]})}function Es({entries:r,disabled:s=!1,disabledReason:t,saving:l=!1,onSave:o,onDelete:n}){const{t:a}=E(),[c,i]=N.useState("new"),d=N.useMemo(()=>r.find(j=>j.name===c)??null,[r,c]),m=d??ks,p=JSON.stringify(m),x=d?.isCcsManaged&&d.managementSurface==="browser-settings";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:t,children:[x?e.jsxs("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-900 dark:text-amber-200",children:[e.jsx("strong",{children:d?.name})," is CCS-managed. Configure browser tooling from"," ",e.jsx("code",{children:"Settings > Browser"}),"; the generic MCP editor is read-only for this entry."]}):null,e.jsxs(P,{value:c,onValueChange:i,disabled:s,children:[e.jsx(D,{children:e.jsx(O,{placeholder:"Select MCP server"})}),e.jsxs(L,{children:[e.jsx(b,{value:"new",children:a("codex.createNewMcpServer")}),r.map(j=>e.jsx(b,{value:j.name,children:j.isCcsManaged?`${j.name} (CCS managed)`:j.name},j.name))]})]}),e.jsx(Ts,{initialDraft:m,isNew:c==="new",disabled:s||!!x,saving:l,canDelete:d!==null&&!x,onDelete:async()=>{d&&(await n(d.name),i("new"))},onSave:async(j,h)=>{await o(j,h),i(j)}},p)]})}const Ps={name:"",displayName:null,baseUrl:null,envKey:null,wireApi:"responses",requiresOpenaiAuth:!1,supportsWebsockets:!1},Ds={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 Os({initialDraft:r,isNew:s,disabled:t,saving:l,canDelete:o,onSave:n,onDelete:a}){const{t:c}=E(),[i,d]=N.useState(r);return e.jsxs(e.Fragment,{children:[s&&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(y,{variant:"outline",size:"sm",onClick:()=>d(Ds),disabled:t,children:"Use CLIProxy Codex preset"})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(S,{value:i.name,onChange:m=>d(p=>({...p,name:m.target.value})),placeholder:"Provider id",disabled:t||!s}),e.jsx(S,{value:i.displayName??"",onChange:m=>d(p=>({...p,displayName:m.target.value||null})),placeholder:"Display name",disabled:t}),e.jsx(S,{value:i.baseUrl??"",onChange:m=>d(p=>({...p,baseUrl:m.target.value||null})),placeholder:"http://127.0.0.1:8317/api/provider/codex",disabled:t}),e.jsx(S,{value:i.envKey??"",onChange:m=>d(p=>({...p,envKey:m.target.value||null})),placeholder:"CLIPROXY_API_KEY",disabled:t})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[e.jsxs(P,{value:i.wireApi??"responses",onValueChange:m=>d(p=>({...p,wireApi:m})),disabled:t,children:[e.jsx(D,{children:e.jsx(O,{})}),e.jsx(L,{children:e.jsx(b,{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:m=>d(p=>({...p,requiresOpenaiAuth:m})),disabled:t})]}),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:m=>d(p=>({...p,supportsWebsockets:m})),disabled:t})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs(y,{variant:"outline",onClick:a,disabled:t||l||!o,children:[e.jsx(re,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsxs(y,{onClick:()=>n(i.name,{displayName:i.displayName,baseUrl:i.baseUrl,envKey:i.envKey,wireApi:i.wireApi,requiresOpenaiAuth:i.requiresOpenaiAuth,supportsWebsockets:i.supportsWebsockets}),disabled:t||l||i.name.trim().length===0,children:[l?e.jsx(z,{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:r,disabled:s=!1,disabledReason:t,saving:l=!1,onSave:o,onDelete:n}){const{t:a}=E(),[c,i]=N.useState("new"),d=N.useMemo(()=>r.find(x=>x.name===c)??null,[r,c]),m=d??Ps,p=JSON.stringify(m);return e.jsxs(Z,{title:"Model providers",badge:"model_providers",icon:e.jsx(rs,{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:t,children:[e.jsxs(P,{value:c,onValueChange:i,disabled:s,children:[e.jsx(D,{children:e.jsx(O,{placeholder:"Select provider"})}),e.jsxs(L,{children:[e.jsx(b,{value:"new",children:a("codex.createNewProvider")}),r.map(x=>e.jsx(b,{value:x.name,children:x.name},x.name))]})]}),e.jsx(Os,{initialDraft:m,isNew:c==="new",disabled:s,saving:l,canDelete:d!==null,onDelete:async()=>{d&&(await n(d.name),i("new"))},onSave:async(x,j)=>{await o(x,j),i(x)}},p)]})}function As({initialName:r,initialModel:s,initialProvider:t,initialEffort:l,providerNames:o,activeProfile:n,selectedEntryName:a,disabled:c,saving:i,onSave:d,onDelete:m,onSetActive:p}){const{t:x}=E(),[j,h]=N.useState(r),[w,M]=N.useState(s),[q,u]=N.useState(t),[v,G]=N.useState(l);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(S,{value:j,onChange:g=>h(g.target.value),placeholder:"deep-review",disabled:c||a!==null}),e.jsx(S,{value:w??"",onChange:g=>M(g.target.value||null),placeholder:"gpt-5.4",disabled:c}),e.jsxs(P,{value:q??"__unset__",onValueChange:g=>u(g==="__unset__"?null:g),disabled:c,children:[e.jsx(D,{children:e.jsx(O,{placeholder:x("codex.useGlobalProvider")})}),e.jsxs(L,{children:[e.jsx(b,{value:"__unset__",children:x("codex.useGlobalProvider")}),o.map(g=>e.jsx(b,{value:g,children:g},g))]})]}),e.jsxs(P,{value:v??"__unset__",onValueChange:g=>G(g==="__unset__"?null:g),disabled:c,children:[e.jsx(D,{children:e.jsx(O,{placeholder:x("codex.useGlobalEffort")})}),e.jsxs(L,{children:[e.jsx(b,{value:"__unset__",children:x("codex.useGlobalEffort")}),["minimal","low","medium","high","xhigh"].map(g=>e.jsx(b,{value:g,children:g},g))]})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(y,{variant:"outline",onClick:m,disabled:c||i||!a,children:[e.jsx(re,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsx(y,{variant:"outline",onClick:p,disabled:c||i||!a||a===n,children:"Set active"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(y,{variant:"outline",onClick:()=>d(j,{model:w,modelProvider:q,modelReasoningEffort:v},!1),disabled:c||i||j.trim().length===0,children:[i?e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save profile"]}),e.jsxs(y,{onClick:()=>d(j,{model:w,modelProvider:q,modelReasoningEffort:v},!0),disabled:c||i||j.trim().length===0,children:[i?e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save + activate"]})]})]})]})}function Ms({activeProfile:r,entries:s,providerNames:t,disabled:l=!1,disabledReason:o,saving:n=!1,onSave:a,onDelete:c,onSetActive:i}){const{t:d}=E(),[m,p]=N.useState("new"),x=N.useMemo(()=>s.find(h=>h.name===m)??null,[s,m]),j=JSON.stringify(x??{name:"",values:{}});return e.jsxs(Z,{title:d("codex.profiles"),badge:"profiles",icon:e.jsx(ts,{className:"h-4 w-4"}),description:"Create reusable Codex overlays and set the active default profile.",disabledReason:o,children:[e.jsxs(P,{value:m,onValueChange:p,disabled:l,children:[e.jsx(D,{children:e.jsx(O,{placeholder:"Select profile"})}),e.jsxs(L,{children:[e.jsx(b,{value:"new",children:d("codex.createNewProfile")}),s.map(h=>e.jsxs(b,{value:h.name,children:[h.name,h.name===r?" (active)":""]},h.name))]})]}),e.jsx(As,{initialName:x?.name??"",initialModel:x?.values.model??null,initialProvider:x?.values.modelProvider??null,initialEffort:x?.values.modelReasoningEffort??null,providerNames:t,activeProfile:r,selectedEntryName:x?.name??null,disabled:l,saving:n,onDelete:async()=>{x&&(await c(x.name),p("new"))},onSetActive:async()=>{x&&await i(x.name)},onSave:async(h,w,M)=>{await a(h,w,M),p(h)}},j)]})}function Rs({workspacePath:r,disabled:s,saving:t,onSave:l}){const{t:o}=E(),[n,a]=N.useState(r),[c,i]=N.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:s}),e.jsxs(P,{value:c,onValueChange:i,disabled:s,children:[e.jsx(D,{children:e.jsx(O,{})}),e.jsxs(L,{children:[e.jsx(b,{value:"trusted",children:o("codex.trusted")}),e.jsx(b,{value:"untrusted",children:o("codex.untrusted")})]})]}),e.jsxs(y,{onClick:()=>l(n,c),disabled:s||t,children:[t?e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save trust"]})]})}function Is({workspacePath:r,entries:s,disabled:t=!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(Rs,{workspacePath:r,disabled:t,saving:o,onSave:n},r),e.jsx(y,{variant:"outline",className:"w-full justify-start",onClick:()=>n(r,"trusted"),disabled:t||o,children:"Trust current workspace"}),e.jsx("div",{className:"space-y-2",children:s.length===0?e.jsx("p",{className:"text-xs text-muted-foreground",children:a("codex.noProjectTrustEntries")}):s.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(y,{variant:"ghost",size:"sm",onClick:()=>n(c.path,c.trustLevel==="trusted"?"untrusted":"trusted"),disabled:t||o,children:"Toggle"}),e.jsx(y,{variant:"ghost",size:"icon",onClick:()=>n(c.path,null),disabled:t||o,children:e.jsx(re,{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 X(r){return r??A}function Y(r,s){return s&&!r.includes(s)?[s,...r]:r}function xe(r){return Ks.format(r)}function qs(r){return r?.trim().toLowerCase().startsWith("gpt-5.4")??!1}function Us(r,s){const t={};return s.model!==r.model&&(t.model=s.model),s.modelReasoningEffort!==r.modelReasoningEffort&&(t.modelReasoningEffort=s.modelReasoningEffort),s.modelContextWindow!==r.modelContextWindow&&(t.modelContextWindow=s.modelContextWindow),s.modelAutoCompactTokenLimit!==r.modelAutoCompactTokenLimit&&(t.modelAutoCompactTokenLimit=s.modelAutoCompactTokenLimit),s.modelProvider!==r.modelProvider&&(t.modelProvider=s.modelProvider),s.approvalPolicy!==r.approvalPolicy&&(t.approvalPolicy=s.approvalPolicy),s.sandboxMode!==r.sandboxMode&&(t.sandboxMode=s.sandboxMode),s.webSearch!==r.webSearch&&(t.webSearch=s.webSearch),s.toolOutputTokenLimit!==r.toolOutputTokenLimit&&(t.toolOutputTokenLimit=s.toolOutputTokenLimit),s.personality!==r.personality&&(t.personality=s.personality),t}function Vs({initialValues:r,providerNames:s,disabled:t,saving:l,onSave:o}){const{t:n}=E(),[a,c]=N.useState(r),i=Y(["minimal","low","medium","high","xhigh"],a.modelReasoningEffort),d=Y(s,a.modelProvider),m=Y(["on-request","never","untrusted"],a.approvalPolicy),p=Y(["read-only","workspace-write","danger-full-access"],a.sandboxMode),x=Y(["cached","live","disabled"],a.webSearch),j=Y(["none","friendly","pragmatic"],a.personality),h=Us(r,a),w=Object.keys(h).length>0,M=qs(a.model),q=u=>{const v=u.trim();return v.length>0?Number(v):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(v=>({...v,model:u.target.value||null})),placeholder:"gpt-5.5",disabled:t})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.reasoningEffort")}),e.jsxs(P,{value:X(a.modelReasoningEffort),onValueChange:u=>c(v=>({...v,modelReasoningEffort:u===A?null:u})),disabled:t,children:[e.jsx(D,{children:e.jsx(O,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useDefault")}),i.map(u=>e.jsx(b,{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:X(a.modelProvider),onValueChange:u=>c(v=>({...v,modelProvider:u===A?null:u})),disabled:t,children:[e.jsx(D,{children:e.jsx(O,{placeholder:n("codex.useCodexDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useCodexDefault")}),d.map(u=>e.jsx(b,{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:X(a.approvalPolicy),onValueChange:u=>c(v=>({...v,approvalPolicy:u===A?null:u})),disabled:t,children:[e.jsx(D,{children:e.jsx(O,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useDefault")}),m.map(u=>e.jsx(b,{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:X(a.sandboxMode),onValueChange:u=>c(v=>({...v,sandboxMode:u===A?null:u})),disabled:t,children:[e.jsx(D,{children:e.jsx(O,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useDefault")}),p.map(u=>e.jsx(b,{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:X(a.webSearch),onValueChange:u=>c(v=>({...v,webSearch:u===A?null:u})),disabled:t,children:[e.jsx(D,{children:e.jsx(O,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useDefault")}),x.map(u=>e.jsx(b,{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(v=>({...v,toolOutputTokenLimit:u.target.value?Number(u.target.value):null})),placeholder:"25000",disabled:t})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.personality")}),e.jsxs(P,{value:X(a.personality),onValueChange:u=>c(v=>({...v,personality:u===A?null:u})),disabled:t,children:[e.jsx(D,{children:e.jsx(O,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useDefault")}),j.map(u=>e.jsx(b,{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:M?"GPT-5.4 long-context selected":"GPT-5.4 long-context 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(y,{type:"button",variant:"outline",size:"sm",disabled:t,onClick:()=>c(u=>({...u,modelContextWindow:_e,modelAutoCompactTokenLimit:ke})),children:"Fill cautious pair"}),e.jsx(y,{type:"button",variant:"outline",size:"sm",disabled:t,onClick:()=>c(u=>({...u,modelContextWindow:Fs})),children:"Set official max window"}),e.jsx(y,{type:"button",variant:"ghost",size:"sm",disabled:t,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")}),!M&&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(v=>({...v,modelContextWindow:q(u.target.value)})),placeholder:"Unset",disabled:t}),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(v=>({...v,modelAutoCompactTokenLimit:q(u.target.value)})),placeholder:"Unset",disabled:t}),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://platform.openai.com/docs/models",target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:"GPT-5 model guide"}),e.jsx("a",{href:"https://openai.com/index/introducing-gpt-5-5/",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(y,{onClick:()=>o(h),disabled:t||l||!w,children:[l?e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save top-level settings"]})})]})}function Bs({values:r,providerNames:s,disabled:t=!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:r,providerNames:s,disabled:t,saving:o,onSave:n},JSON.stringify(r))})}function Gs({workspacePath:r,activeProfile:s,topLevelSettings:t,projectTrustEntries:l,profileEntries:o,modelProviderEntries:n,mcpServerEntries:a,featureCatalog:c,featureState:i,disabled:d,disabledReason:m,saving:p,onPatch:x}){const{t:j}=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:j("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(Bs,{values:t,providerNames:n.map(h=>h.name),disabled:d,disabledReason:m,saving:p,onSave:h=>x({kind:"top-level",values:h},j("toasts.codexSaved"))}),e.jsx(Is,{workspacePath:r,entries:l,disabled:d,disabledReason:m,saving:p,onSave:(h,w)=>x({kind:"project-trust",path:h,trustLevel:w},w?"Saved project trust entry.":"Removed project trust entry.")}),e.jsx(Ms,{activeProfile:s,entries:o,providerNames:n.map(h=>h.name),disabled:d,disabledReason:m,saving:p,onSave:(h,w,M)=>x({kind:"profile",action:"upsert",name:h,values:w,setAsActive:M},"Saved profile."),onDelete:h=>x({kind:"profile",action:"delete",name:h},"Deleted profile."),onSetActive:h=>x({kind:"profile",action:"set-active",name:h},"Set active profile.")}),e.jsx(Ls,{entries:n,disabled:d,disabledReason:m,saving:p,onSave:(h,w)=>x({kind:"model-provider",action:"upsert",name:h,values:w},"Saved model provider."),onDelete:h=>x({kind:"model-provider",action:"delete",name:h},"Deleted model provider.")}),e.jsx(Es,{entries:a,disabled:d,disabledReason:m,saving:p,onSave:(h,w)=>x({kind:"mcp-server",action:"upsert",name:h,values:w},"Saved MCP server."),onDelete:h=>x({kind:"mcp-server",action:"delete",name:h},"Deleted MCP server.")}),e.jsx(_s,{catalog:c,state:i,disabled:d,disabledReason:m,onToggle:(h,w)=>x({kind:"feature",feature:h,enabled:w},"Saved feature toggle.")})]})})}const Oe=`model_provider = "cliproxy"
|
|
1
|
+
import{j as e}from"./radix-ui-nu4wz29m.js";import{r as N}from"./react-vendor-Bjx91N7w.js";import{t as U}from"./notifications-B4_o8bcr.js";import{C as I,j as F,k as W,B as _,b as K,a as E,d as y,aI as J,r as P,s as D,t as O,v as L,w as b,I as S,n as fe,W as C,bf as se,bg as Pe,c as De,bm as He,bn as ve,bo as Qe,Q as Je,R as Ze,U as ae,V as oe,bh as be}from"./index-BRtgic66.js";import{aa as es,aS as ss,at as re,L as z,n as rs,aT as ts,aU as ns,aC as as,w as os,a7 as ls,aV as is,aW as cs,aX as ds,ai as me,p as we,$ as xs,m as us,o as ms,_ as ps,S as hs,aN as Ne,aY as fs,x as gs,I as js,T as vs,N as bs}from"./icons-DQFHtVq5.js";import{S as ee}from"./separator-Do_vqTQD.js";import{a as ws,u as Ce,b as ye}from"./tanstack-bhJxV1h8.js";import"./code-highlight-D4E79GKQ.js";import{T as Ns,a as Cs,b as Se,c as le,d as ys,e as ie}from"./table-BP6nBZzg.js";import{R as Ss}from"./raw-json-settings-editor-panel-Dcumu3Qi.js";import"./utils-CzKF5WmX.js";import"./form-utils-CuHzLhJZ.js";function Z({title:r,icon:s,badge:t,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:[s,r,t?e.jsx(_,{variant:"outline",className:"text-[10px] font-normal",children:t}):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:r,state:s,disabled:t=!1,disabledReason:l,onToggle:o}){const{t:n}=E(),a=new Set(r.map(i=>i.name)),c=Object.entries(s).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:r.map(i=>{const d=s[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(y,{variant:"outline",size:"sm",onClick:()=>o(i.name,null),disabled:t,children:n("codex.useDefault")}):null,e.jsx(J,{checked:d===!0,onCheckedChange:m=>o(i.name,m),disabled:t})]})]},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(y,{variant:"outline",size:"sm",onClick:()=>o(i,null),disabled:t,children:n("codex.useDefault")}),e.jsx(J,{checked:d===!0,onCheckedChange:m=>o(i,m),disabled:t})]})]},i))]}):null]})}const ks={name:"",transport:"stdio",command:null,args:[],url:null,enabled:!0,required:!1,startupTimeoutSec:null,toolTimeoutSec:null,enabledTools:[],disabledTools:[],isCcsManaged:!1,managementSurface:null};function ce(r){return r.join(", ")}function de(r){return r.split(",").map(s=>s.trim()).filter(Boolean)}function Ts({initialDraft:r,isNew:s,disabled:t,saving:l,canDelete:o,onSave:n,onDelete:a}){const{t:c}=E(),[i,d]=N.useState(r),m=s&&i.name.trim()==="ccs_browser";return e.jsxs(e.Fragment,{children:[m?e.jsxs("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-900 dark:text-amber-200",children:[e.jsx("strong",{children:"ccs_browser"})," is reserved for the CCS-managed browser tooling path. Configure it from ",e.jsx("code",{children:"Settings > Browser"})," instead of creating it here."]}):null,e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(S,{value:i.name,onChange:p=>d(x=>({...x,name:p.target.value})),placeholder:"playwright",disabled:t||!s}),e.jsxs(P,{value:i.transport,onValueChange:p=>d(x=>({...x,transport:p})),disabled:t,children:[e.jsx(D,{children:e.jsx(O,{})}),e.jsxs(L,{children:[e.jsx(b,{value:"stdio",children:c("codex.stdio")}),e.jsx(b,{value:"streamable-http",children:c("codex.streamableHttp")})]})]}),i.transport==="stdio"?e.jsxs(e.Fragment,{children:[e.jsx(S,{value:i.command??"",onChange:p=>d(x=>({...x,command:p.target.value||null})),placeholder:"npx",disabled:t}),e.jsx(S,{value:ce(i.args),onChange:p=>d(x=>({...x,args:de(p.target.value)})),placeholder:"@playwright/mcp@latest, --flag",disabled:t})]}):e.jsx(S,{className:"sm:col-span-2",value:i.url??"",onChange:p=>d(x=>({...x,url:p.target.value||null})),placeholder:"https://example.test/mcp",disabled:t}),e.jsx(S,{type:"number",min:1,value:i.startupTimeoutSec??"",onChange:p=>d(x=>({...x,startupTimeoutSec:p.target.value?Number(p.target.value):null})),placeholder:"Startup timeout (sec)",disabled:t}),e.jsx(S,{type:"number",min:1,value:i.toolTimeoutSec??"",onChange:p=>d(x=>({...x,toolTimeoutSec:p.target.value?Number(p.target.value):null})),placeholder:"Tool timeout (sec)",disabled:t}),e.jsx(S,{value:ce(i.enabledTools),onChange:p=>d(x=>({...x,enabledTools:de(p.target.value)})),placeholder:"enabled_tools",disabled:t}),e.jsx(S,{value:ce(i.disabledTools),onChange:p=>d(x=>({...x,disabledTools:de(p.target.value)})),placeholder:"disabled_tools",disabled:t})]}),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:p=>d(x=>({...x,enabled:p})),disabled:t})]}),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:p=>d(x=>({...x,required:p})),disabled:t})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs(y,{variant:"outline",onClick:a,disabled:t||l||!o,children:[e.jsx(re,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsxs(y,{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:t||l||i.name.trim().length===0||m,children:[l?e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save MCP server"]})]})]})}function Es({entries:r,disabled:s=!1,disabledReason:t,saving:l=!1,onSave:o,onDelete:n}){const{t:a}=E(),[c,i]=N.useState("new"),d=N.useMemo(()=>r.find(j=>j.name===c)??null,[r,c]),m=d??ks,p=JSON.stringify(m),x=d?.isCcsManaged&&d.managementSurface==="browser-settings";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:t,children:[x?e.jsxs("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-900 dark:text-amber-200",children:[e.jsx("strong",{children:d?.name})," is CCS-managed. Configure browser tooling from"," ",e.jsx("code",{children:"Settings > Browser"}),"; the generic MCP editor is read-only for this entry."]}):null,e.jsxs(P,{value:c,onValueChange:i,disabled:s,children:[e.jsx(D,{children:e.jsx(O,{placeholder:"Select MCP server"})}),e.jsxs(L,{children:[e.jsx(b,{value:"new",children:a("codex.createNewMcpServer")}),r.map(j=>e.jsx(b,{value:j.name,children:j.isCcsManaged?`${j.name} (CCS managed)`:j.name},j.name))]})]}),e.jsx(Ts,{initialDraft:m,isNew:c==="new",disabled:s||!!x,saving:l,canDelete:d!==null&&!x,onDelete:async()=>{d&&(await n(d.name),i("new"))},onSave:async(j,h)=>{await o(j,h),i(j)}},p)]})}const Ps={name:"",displayName:null,baseUrl:null,envKey:null,wireApi:"responses",requiresOpenaiAuth:!1,supportsWebsockets:!1},Ds={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 Os({initialDraft:r,isNew:s,disabled:t,saving:l,canDelete:o,onSave:n,onDelete:a}){const{t:c}=E(),[i,d]=N.useState(r);return e.jsxs(e.Fragment,{children:[s&&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(y,{variant:"outline",size:"sm",onClick:()=>d(Ds),disabled:t,children:"Use CLIProxy Codex preset"})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(S,{value:i.name,onChange:m=>d(p=>({...p,name:m.target.value})),placeholder:"Provider id",disabled:t||!s}),e.jsx(S,{value:i.displayName??"",onChange:m=>d(p=>({...p,displayName:m.target.value||null})),placeholder:"Display name",disabled:t}),e.jsx(S,{value:i.baseUrl??"",onChange:m=>d(p=>({...p,baseUrl:m.target.value||null})),placeholder:"http://127.0.0.1:8317/api/provider/codex",disabled:t}),e.jsx(S,{value:i.envKey??"",onChange:m=>d(p=>({...p,envKey:m.target.value||null})),placeholder:"CLIPROXY_API_KEY",disabled:t})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[e.jsxs(P,{value:i.wireApi??"responses",onValueChange:m=>d(p=>({...p,wireApi:m})),disabled:t,children:[e.jsx(D,{children:e.jsx(O,{})}),e.jsx(L,{children:e.jsx(b,{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:m=>d(p=>({...p,requiresOpenaiAuth:m})),disabled:t})]}),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:m=>d(p=>({...p,supportsWebsockets:m})),disabled:t})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs(y,{variant:"outline",onClick:a,disabled:t||l||!o,children:[e.jsx(re,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsxs(y,{onClick:()=>n(i.name,{displayName:i.displayName,baseUrl:i.baseUrl,envKey:i.envKey,wireApi:i.wireApi,requiresOpenaiAuth:i.requiresOpenaiAuth,supportsWebsockets:i.supportsWebsockets}),disabled:t||l||i.name.trim().length===0,children:[l?e.jsx(z,{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:r,disabled:s=!1,disabledReason:t,saving:l=!1,onSave:o,onDelete:n}){const{t:a}=E(),[c,i]=N.useState("new"),d=N.useMemo(()=>r.find(x=>x.name===c)??null,[r,c]),m=d??Ps,p=JSON.stringify(m);return e.jsxs(Z,{title:"Model providers",badge:"model_providers",icon:e.jsx(rs,{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:t,children:[e.jsxs(P,{value:c,onValueChange:i,disabled:s,children:[e.jsx(D,{children:e.jsx(O,{placeholder:"Select provider"})}),e.jsxs(L,{children:[e.jsx(b,{value:"new",children:a("codex.createNewProvider")}),r.map(x=>e.jsx(b,{value:x.name,children:x.name},x.name))]})]}),e.jsx(Os,{initialDraft:m,isNew:c==="new",disabled:s,saving:l,canDelete:d!==null,onDelete:async()=>{d&&(await n(d.name),i("new"))},onSave:async(x,j)=>{await o(x,j),i(x)}},p)]})}function As({initialName:r,initialModel:s,initialProvider:t,initialEffort:l,providerNames:o,activeProfile:n,selectedEntryName:a,disabled:c,saving:i,onSave:d,onDelete:m,onSetActive:p}){const{t:x}=E(),[j,h]=N.useState(r),[w,M]=N.useState(s),[q,u]=N.useState(t),[v,G]=N.useState(l);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(S,{value:j,onChange:g=>h(g.target.value),placeholder:"deep-review",disabled:c||a!==null}),e.jsx(S,{value:w??"",onChange:g=>M(g.target.value||null),placeholder:"gpt-5.4",disabled:c}),e.jsxs(P,{value:q??"__unset__",onValueChange:g=>u(g==="__unset__"?null:g),disabled:c,children:[e.jsx(D,{children:e.jsx(O,{placeholder:x("codex.useGlobalProvider")})}),e.jsxs(L,{children:[e.jsx(b,{value:"__unset__",children:x("codex.useGlobalProvider")}),o.map(g=>e.jsx(b,{value:g,children:g},g))]})]}),e.jsxs(P,{value:v??"__unset__",onValueChange:g=>G(g==="__unset__"?null:g),disabled:c,children:[e.jsx(D,{children:e.jsx(O,{placeholder:x("codex.useGlobalEffort")})}),e.jsxs(L,{children:[e.jsx(b,{value:"__unset__",children:x("codex.useGlobalEffort")}),["minimal","low","medium","high","xhigh"].map(g=>e.jsx(b,{value:g,children:g},g))]})]})]}),e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(y,{variant:"outline",onClick:m,disabled:c||i||!a,children:[e.jsx(re,{className:"mr-2 h-4 w-4"}),"Delete"]}),e.jsx(y,{variant:"outline",onClick:p,disabled:c||i||!a||a===n,children:"Set active"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(y,{variant:"outline",onClick:()=>d(j,{model:w,modelProvider:q,modelReasoningEffort:v},!1),disabled:c||i||j.trim().length===0,children:[i?e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save profile"]}),e.jsxs(y,{onClick:()=>d(j,{model:w,modelProvider:q,modelReasoningEffort:v},!0),disabled:c||i||j.trim().length===0,children:[i?e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save + activate"]})]})]})]})}function Ms({activeProfile:r,entries:s,providerNames:t,disabled:l=!1,disabledReason:o,saving:n=!1,onSave:a,onDelete:c,onSetActive:i}){const{t:d}=E(),[m,p]=N.useState("new"),x=N.useMemo(()=>s.find(h=>h.name===m)??null,[s,m]),j=JSON.stringify(x??{name:"",values:{}});return e.jsxs(Z,{title:d("codex.profiles"),badge:"profiles",icon:e.jsx(ts,{className:"h-4 w-4"}),description:"Create reusable Codex overlays and set the active default profile.",disabledReason:o,children:[e.jsxs(P,{value:m,onValueChange:p,disabled:l,children:[e.jsx(D,{children:e.jsx(O,{placeholder:"Select profile"})}),e.jsxs(L,{children:[e.jsx(b,{value:"new",children:d("codex.createNewProfile")}),s.map(h=>e.jsxs(b,{value:h.name,children:[h.name,h.name===r?" (active)":""]},h.name))]})]}),e.jsx(As,{initialName:x?.name??"",initialModel:x?.values.model??null,initialProvider:x?.values.modelProvider??null,initialEffort:x?.values.modelReasoningEffort??null,providerNames:t,activeProfile:r,selectedEntryName:x?.name??null,disabled:l,saving:n,onDelete:async()=>{x&&(await c(x.name),p("new"))},onSetActive:async()=>{x&&await i(x.name)},onSave:async(h,w,M)=>{await a(h,w,M),p(h)}},j)]})}function Rs({workspacePath:r,disabled:s,saving:t,onSave:l}){const{t:o}=E(),[n,a]=N.useState(r),[c,i]=N.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:s}),e.jsxs(P,{value:c,onValueChange:i,disabled:s,children:[e.jsx(D,{children:e.jsx(O,{})}),e.jsxs(L,{children:[e.jsx(b,{value:"trusted",children:o("codex.trusted")}),e.jsx(b,{value:"untrusted",children:o("codex.untrusted")})]})]}),e.jsxs(y,{onClick:()=>l(n,c),disabled:s||t,children:[t?e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save trust"]})]})}function Is({workspacePath:r,entries:s,disabled:t=!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(Rs,{workspacePath:r,disabled:t,saving:o,onSave:n},r),e.jsx(y,{variant:"outline",className:"w-full justify-start",onClick:()=>n(r,"trusted"),disabled:t||o,children:"Trust current workspace"}),e.jsx("div",{className:"space-y-2",children:s.length===0?e.jsx("p",{className:"text-xs text-muted-foreground",children:a("codex.noProjectTrustEntries")}):s.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(y,{variant:"ghost",size:"sm",onClick:()=>n(c.path,c.trustLevel==="trusted"?"untrusted":"trusted"),disabled:t||o,children:"Toggle"}),e.jsx(y,{variant:"ghost",size:"icon",onClick:()=>n(c.path,null),disabled:t||o,children:e.jsx(re,{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 X(r){return r??A}function Y(r,s){return s&&!r.includes(s)?[s,...r]:r}function xe(r){return Ks.format(r)}function qs(r){return r?.trim().toLowerCase().startsWith("gpt-5.4")??!1}function Us(r,s){const t={};return s.model!==r.model&&(t.model=s.model),s.modelReasoningEffort!==r.modelReasoningEffort&&(t.modelReasoningEffort=s.modelReasoningEffort),s.modelContextWindow!==r.modelContextWindow&&(t.modelContextWindow=s.modelContextWindow),s.modelAutoCompactTokenLimit!==r.modelAutoCompactTokenLimit&&(t.modelAutoCompactTokenLimit=s.modelAutoCompactTokenLimit),s.modelProvider!==r.modelProvider&&(t.modelProvider=s.modelProvider),s.approvalPolicy!==r.approvalPolicy&&(t.approvalPolicy=s.approvalPolicy),s.sandboxMode!==r.sandboxMode&&(t.sandboxMode=s.sandboxMode),s.webSearch!==r.webSearch&&(t.webSearch=s.webSearch),s.toolOutputTokenLimit!==r.toolOutputTokenLimit&&(t.toolOutputTokenLimit=s.toolOutputTokenLimit),s.personality!==r.personality&&(t.personality=s.personality),t}function Vs({initialValues:r,providerNames:s,disabled:t,saving:l,onSave:o}){const{t:n}=E(),[a,c]=N.useState(r),i=Y(["minimal","low","medium","high","xhigh"],a.modelReasoningEffort),d=Y(s,a.modelProvider),m=Y(["on-request","never","untrusted"],a.approvalPolicy),p=Y(["read-only","workspace-write","danger-full-access"],a.sandboxMode),x=Y(["cached","live","disabled"],a.webSearch),j=Y(["none","friendly","pragmatic"],a.personality),h=Us(r,a),w=Object.keys(h).length>0,M=qs(a.model),q=u=>{const v=u.trim();return v.length>0?Number(v):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(v=>({...v,model:u.target.value||null})),placeholder:"gpt-5.5",disabled:t})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.reasoningEffort")}),e.jsxs(P,{value:X(a.modelReasoningEffort),onValueChange:u=>c(v=>({...v,modelReasoningEffort:u===A?null:u})),disabled:t,children:[e.jsx(D,{children:e.jsx(O,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useDefault")}),i.map(u=>e.jsx(b,{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:X(a.modelProvider),onValueChange:u=>c(v=>({...v,modelProvider:u===A?null:u})),disabled:t,children:[e.jsx(D,{children:e.jsx(O,{placeholder:n("codex.useCodexDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useCodexDefault")}),d.map(u=>e.jsx(b,{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:X(a.approvalPolicy),onValueChange:u=>c(v=>({...v,approvalPolicy:u===A?null:u})),disabled:t,children:[e.jsx(D,{children:e.jsx(O,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useDefault")}),m.map(u=>e.jsx(b,{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:X(a.sandboxMode),onValueChange:u=>c(v=>({...v,sandboxMode:u===A?null:u})),disabled:t,children:[e.jsx(D,{children:e.jsx(O,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useDefault")}),p.map(u=>e.jsx(b,{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:X(a.webSearch),onValueChange:u=>c(v=>({...v,webSearch:u===A?null:u})),disabled:t,children:[e.jsx(D,{children:e.jsx(O,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useDefault")}),x.map(u=>e.jsx(b,{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(v=>({...v,toolOutputTokenLimit:u.target.value?Number(u.target.value):null})),placeholder:"25000",disabled:t})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:n("codex.personality")}),e.jsxs(P,{value:X(a.personality),onValueChange:u=>c(v=>({...v,personality:u===A?null:u})),disabled:t,children:[e.jsx(D,{children:e.jsx(O,{placeholder:n("codex.useDefault")})}),e.jsxs(L,{children:[e.jsx(b,{value:A,children:n("codex.useDefault")}),j.map(u=>e.jsx(b,{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:M?"GPT-5.4 long-context selected":"GPT-5.4 long-context 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(y,{type:"button",variant:"outline",size:"sm",disabled:t,onClick:()=>c(u=>({...u,modelContextWindow:_e,modelAutoCompactTokenLimit:ke})),children:"Fill cautious pair"}),e.jsx(y,{type:"button",variant:"outline",size:"sm",disabled:t,onClick:()=>c(u=>({...u,modelContextWindow:Fs})),children:"Set official max window"}),e.jsx(y,{type:"button",variant:"ghost",size:"sm",disabled:t,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")}),!M&&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(v=>({...v,modelContextWindow:q(u.target.value)})),placeholder:"Unset",disabled:t}),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(v=>({...v,modelAutoCompactTokenLimit:q(u.target.value)})),placeholder:"Unset",disabled:t}),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://platform.openai.com/docs/models",target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:"GPT-5 model guide"}),e.jsx("a",{href:"https://openai.com/index/introducing-gpt-5-5/",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(y,{onClick:()=>o(h),disabled:t||l||!w,children:[l?e.jsx(z,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save top-level settings"]})})]})}function Bs({values:r,providerNames:s,disabled:t=!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:r,providerNames:s,disabled:t,saving:o,onSave:n},JSON.stringify(r))})}function Gs({workspacePath:r,activeProfile:s,topLevelSettings:t,projectTrustEntries:l,profileEntries:o,modelProviderEntries:n,mcpServerEntries:a,featureCatalog:c,featureState:i,disabled:d,disabledReason:m,saving:p,onPatch:x}){const{t:j}=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:j("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(Bs,{values:t,providerNames:n.map(h=>h.name),disabled:d,disabledReason:m,saving:p,onSave:h=>x({kind:"top-level",values:h},j("toasts.codexSaved"))}),e.jsx(Is,{workspacePath:r,entries:l,disabled:d,disabledReason:m,saving:p,onSave:(h,w)=>x({kind:"project-trust",path:h,trustLevel:w},w?"Saved project trust entry.":"Removed project trust entry.")}),e.jsx(Ms,{activeProfile:s,entries:o,providerNames:n.map(h=>h.name),disabled:d,disabledReason:m,saving:p,onSave:(h,w,M)=>x({kind:"profile",action:"upsert",name:h,values:w,setAsActive:M},"Saved profile."),onDelete:h=>x({kind:"profile",action:"delete",name:h},"Deleted profile."),onSetActive:h=>x({kind:"profile",action:"set-active",name:h},"Set active profile.")}),e.jsx(Ls,{entries:n,disabled:d,disabledReason:m,saving:p,onSave:(h,w)=>x({kind:"model-provider",action:"upsert",name:h,values:w},"Saved model provider."),onDelete:h=>x({kind:"model-provider",action:"delete",name:h},"Deleted model provider.")}),e.jsx(Es,{entries:a,disabled:d,disabledReason:m,saving:p,onSave:(h,w)=>x({kind:"mcp-server",action:"upsert",name:h,values:w},"Saved MCP server."),onDelete:h=>x({kind:"mcp-server",action:"delete",name:h},"Deleted MCP server.")}),e.jsx(_s,{catalog:c,state:i,disabled:d,disabledReason:m,onToggle:(h,w)=>x({kind:"feature",feature:h,enabled:w},"Saved feature toggle.")})]})})}const Oe=`model_provider = "cliproxy"
|
|
2
2
|
|
|
3
3
|
[model_providers.cliproxy]
|
|
4
4
|
base_url = "http://127.0.0.1:8317/api/provider/codex"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-
|
|
1
|
+
import{j as e}from"./radix-ui-nu4wz29m.js";import{A as g,a as d,b as m,c as x,d as D,e as h,f,g as j}from"./alert-dialog-C6npAhT0.js";import{a as A}from"./index-BRtgic66.js";function b({open:l,onConfirm:o,onCancel:r,title:a,description:s,confirmText:t,variant:n="default"}){const{t:i}=A();return e.jsx(g,{open:l,onOpenChange:c=>!c&&r(),children:e.jsxs(d,{children:[e.jsxs(m,{children:[e.jsx(x,{children:a}),e.jsx(D,{children:s})]}),e.jsxs(h,{children:[e.jsx(f,{onClick:r,children:i("confirmDialog.cancel")}),e.jsx(j,{onClick:o,className:n==="destructive"?"bg-red-600 hover:bg-red-700 text-white":"",children:t??i("confirmDialog.confirm")})]})]})})}export{b as C};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-Zb8sVEtn.js";import{bf as N,bg as ke,a as S,B as P,d as b,V as oe,n as V,L,aI as Z,I as de,r as Fe,s as Te,t as Me,v as Le,w as ee,x as ge,bh as Re,S as y,bi as Ae,bj as Ee,bk as Oe,Q as _e,R as qe,U as te,bl as De,c as ie}from"./index-0mNJhDEG.js";import{r as w}from"./react-vendor-CNOkPC89.js";import{a as Ie,u as D,b as R}from"./tanstack-CrmUhA7Z.js";import{C as Ue}from"./confirm-dialog-D0VQlM7B.js";import{R as fe,L as je,au as Ke,aa as Qe,Z as me,_ as Je,T as ve,ax as $e,b as ze,ae as Be,aF as Ge,aP as ue,K as He,Y as We,aQ as Ve,x as we,I as Ne}from"./icons-DyorC3Xk.js";import{S as ne}from"./separator-mG07scBE.js";import{S as Ye}from"./searchable-select-BKx31cCH.js";import{t as I}from"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";import"./alert-dialog-CjnZBDj3.js";async function Xe(){const t=await fetch(N("/copilot/status"));if(!t.ok)throw new Error("Failed to fetch copilot status");return t.json()}async function Ze(){const t=await fetch(N("/copilot/config"));if(!t.ok)throw new Error("Failed to fetch copilot config");return t.json()}async function et(){const t=await fetch(N("/copilot/models"));if(!t.ok)throw new Error("Failed to fetch copilot models");return t.json()}async function tt(){const t=await fetch(N("/copilot/settings/raw"));if(!t.ok)throw new Error("Failed to fetch copilot raw settings");return t.json()}async function st(t){const s=await fetch(N("/copilot/config"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!s.ok)throw new Error("Failed to update copilot config");return s.json()}async function at(t){const s=await fetch(N("/copilot/settings/raw"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(s.status===409)throw new ke("Copilot raw settings changed externally");if(!s.ok)throw new Error("Failed to save copilot raw settings");return s.json()}async function it(){const t=await fetch(N("/copilot/auth/start"),{method:"POST"});if(!t.ok)throw new Error("Failed to start auth");return t.json()}async function nt(){const t=await fetch(N("/copilot/daemon/start"),{method:"POST"});if(!t.ok)throw new Error("Failed to start daemon");return t.json()}async function ot(){const t=await fetch(N("/copilot/daemon/stop"),{method:"POST"});if(!t.ok)throw new Error("Failed to stop daemon");return t.json()}async function lt(){const t=await fetch(N("/copilot/info"));if(!t.ok)throw new Error("Failed to fetch copilot info");return t.json()}async function rt(t){const s=await fetch(N("/copilot/install"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t?{version:t}:{})});if(!s.ok)throw new Error("Failed to install copilot-api");return s.json()}function be(){const t=Ie(),s=D({queryKey:["copilot-status"],queryFn:Xe,refetchInterval:5e3}),o=D({queryKey:["copilot-config"],queryFn:Ze}),d=D({queryKey:["copilot-models"],queryFn:et}),r=D({queryKey:["copilot-raw-settings"],queryFn:tt}),i=D({queryKey:["copilot-info"],queryFn:lt}),c=R({mutationFn:st,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]}),t.invalidateQueries({queryKey:["copilot-config"]}),t.invalidateQueries({queryKey:["copilot-raw-settings"]})}}),a=R({mutationFn:at,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]}),t.invalidateQueries({queryKey:["copilot-config"]}),t.invalidateQueries({queryKey:["copilot-raw-settings"]})}}),x=R({mutationFn:it,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]})}}),h=R({mutationFn:nt,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]})}}),f=R({mutationFn:ot,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]})}}),u=R({mutationFn:rt,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]}),t.invalidateQueries({queryKey:["copilot-info"]})}});return w.useMemo(()=>({status:s.data,statusLoading:s.isLoading,statusError:s.error,refetchStatus:s.refetch,config:o.data,configLoading:o.isLoading,models:d.data?.models??[],currentModel:d.data?.current,modelsLoading:d.isLoading,rawSettings:r.data,rawSettingsLoading:r.isLoading,refetchRawSettings:r.refetch,updateConfig:c.mutate,updateConfigAsync:c.mutateAsync,isUpdating:c.isPending,saveRawSettings:a.mutate,saveRawSettingsAsync:a.mutateAsync,isSavingRawSettings:a.isPending,startAuth:x.mutate,startAuthAsync:x.mutateAsync,isAuthenticating:x.isPending,authResult:x.data,startDaemon:h.mutate,isStartingDaemon:h.isPending,stopDaemon:f.mutate,isStoppingDaemon:f.isPending,info:i.data,infoLoading:i.isLoading,refetchInfo:i.refetch,install:u.mutate,installAsync:u.mutateAsync,isInstalling:u.isPending}),[s.data,s.isLoading,s.error,s.refetch,o.data,o.isLoading,d.data,d.isLoading,r.data,r.isLoading,r.refetch,c.mutate,c.mutateAsync,c.isPending,a.mutate,a.mutateAsync,a.isPending,x.mutate,x.mutateAsync,x.isPending,x.data,h.mutate,h.isPending,f.mutate,f.isPending,i.data,i.isLoading,i.refetch,u.mutate,u.mutateAsync,u.isPending])}function ct({rawSettings:t,rawSettingsLoading:s,isUpdating:o,isSavingRawSettings:d,hasChanges:r,isRawJsonValid:i,onRefresh:c,onSave:a}){const{t:x}=S();return e.jsxs("div",{className:"px-6 py-4 border-b bg-background flex items-center justify-between shrink-0",children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold",children:x("copilotConfigForm.copilotConfiguration")}),t&&e.jsx(P,{variant:"outline",className:"text-xs",children:"copilot.settings.json"})]}),t&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["Last modified: ",t.exists?new Date(t.mtime).toLocaleString():"Never saved"]})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{variant:"ghost",size:"sm",onClick:c,disabled:s,children:e.jsx(fe,{className:`w-4 h-4 ${s?"animate-spin":""}`})}),e.jsx(b,{size:"sm",onClick:a,disabled:o||d||!r||!i,children:o||d?e.jsxs(e.Fragment,{children:[e.jsx(je,{className:"w-4 h-4 mr-1 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Ke,{className:"w-4 h-4 mr-1"}),"Save"]})})]})]})}const dt=[{name:"GPT-4.1 (Free)",description:"Free tier - no premium usage",default:"gpt-4.1",opus:"gpt-4.1",sonnet:"gpt-4.1",haiku:"gpt-4.1"},{name:"GPT-5 Mini (Free)",description:"Free tier - lightweight model",default:"gpt-5-mini",opus:"gpt-5-mini",sonnet:"gpt-5-mini",haiku:"gpt-5-mini"}],mt=[{name:"Claude Opus 4.5",description:"Pro+ (3x) - Most capable reasoning",default:"claude-opus-4.5",opus:"claude-opus-4.5",sonnet:"claude-sonnet-4.5",haiku:"claude-haiku-4.5"},{name:"Claude Sonnet 4.5",description:"Pro+ (1x) - Balanced performance",default:"claude-sonnet-4.5",opus:"claude-opus-4.5",sonnet:"claude-sonnet-4.5",haiku:"claude-haiku-4.5"},{name:"GPT-5.2",description:"Pro+ (1x) - Latest OpenAI (Preview)",default:"gpt-5.2",opus:"gpt-5.2",sonnet:"gpt-5.1",haiku:"gpt-5-mini"},{name:"GPT-5.1 Codex Max",description:"Pro+ (1x) - Best for coding",default:"gpt-5.1-codex-max",opus:"gpt-5.1-codex-max",sonnet:"gpt-5.1-codex",haiku:"gpt-5.1-codex-mini"},{name:"Gemini 2.5 Pro",description:"Pro+ (1x) - Google latest",default:"gemini-2.5-pro",opus:"gemini-2.5-pro",sonnet:"gemini-2.5-pro",haiku:"gemini-3-flash"}];function xe(t){switch(t){case"free":return"bg-green-100 text-green-700 border-green-200";case"pro":return"bg-blue-100 text-blue-700 border-blue-200";case"pro+":return"bg-purple-100 text-purple-700 border-purple-200";case"business":return"bg-orange-100 text-orange-700 border-orange-200";case"enterprise":return"bg-red-100 text-red-700 border-red-200";default:return"bg-muted text-muted-foreground"}}function ut(t){return t==null?null:t===0?"Free":t<1?`${t}x`:t===1?"1x":`${t}x`}function G({label:t,description:s,value:o,onChange:d,models:r,disabled:i}){const{t:c}=S();return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium",children:t}),s&&e.jsx("p",{className:"text-[10px] text-muted-foreground",children:s})]}),e.jsx(Ye,{value:o||void 0,onChange:d,disabled:i,placeholder:c("componentModelSelector.selectModel"),searchPlaceholder:c("searchableSelect.searchModels"),emptyText:c("searchableSelect.noResults"),triggerClassName:"h-9",groups:[{key:"models",label:c("componentModelSelector.availableModelsCount",{count:r.length})}],options:r.map(a=>({value:a.id,groupKey:"models",searchText:`${a.name||a.id} ${a.id}`,keywords:[a.minPlan??"",a.preview?"preview":""],triggerContent:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:a.id}),a.minPlan&&e.jsx(P,{variant:"outline",className:`text-[9px] px-1 py-0 h-4 ${xe(a.minPlan)}`,children:a.minPlan})]}),itemContent:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:a.name||a.id}),a.minPlan&&e.jsx(P,{variant:"outline",className:`text-[9px] px-1 py-0 h-4 ${xe(a.minPlan)}`,children:a.minPlan}),a.multiplier!==void 0&&e.jsx("span",{className:"text-[9px] text-muted-foreground",children:ut(a.multiplier)}),a.preview&&e.jsx(P,{variant:"secondary",className:"text-[9px] px-1 py-0 h-4",children:c("componentModelSelector.preview")})]})}))})]})}function se(t){if(t>=1e6){const s=t/1e6;return s%1===0?`${s}M`:`${s.toFixed(1)}M`}if(t>=1e3){const s=t/1e3;return s%1===0?`${s}K`:`${s.toFixed(1)}K`}return`${t}`}function xt(t){if(!t?.limits)return null;const s=[];return t.limits.maxPromptTokens&&s.push(`prompt ${se(t.limits.maxPromptTokens)}`),t.limits.maxContextWindowTokens&&s.push(`context ${se(t.limits.maxContextWindowTokens)}`),t.limits.maxOutputTokens&&s.push(`output ${se(t.limits.maxOutputTokens)}`),s.length>0?s.join(" | "):null}function pt({currentModel:t,opusModel:s,sonnetModel:o,haikuModel:d,models:r,modelsLoading:i,onApplyPreset:c,onUpdateModel:a,onUpdateOpusModel:x,onUpdateSonnetModel:h,onUpdateHaikuModel:f}){const{t:u}=S(),n=[{label:"Default",id:t},{label:"Opus",id:s||t},{label:"Sonnet",id:o||t},{label:"Haiku",id:d||t}].map(({label:l,id:p})=>{const C=r.find(F=>F.id===p),k=xt(C);return k?{label:l,id:p,limits:k}:null}).filter(l=>l!==null);return e.jsx(oe,{value:"config",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(V,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[e.jsx(Qe,{className:"w-4 h-4"}),u("providerEditor.presets")]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:u("copilotConfigForm.modelMapping")}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(P,{variant:"outline",className:"text-[10px] bg-green-100 text-green-700 border-green-200",children:"Free Tier"}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:u("copilotConfigForm.noPremiumUsage")})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:dt.map(l=>e.jsxs(b,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>c(l),title:l.description,children:[e.jsx(me,{className:"w-3 h-3 text-green-600"}),l.name]},l.name))})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(P,{variant:"outline",className:"text-[10px] bg-blue-100 text-blue-700 border-blue-200",children:"Pro+ Required"}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Uses premium request quota"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:mt.map(l=>e.jsxs(b,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>c(l),title:l.description,children:[e.jsx(me,{className:"w-3 h-3"}),l.name]},l.name))})]})]}),e.jsx(ne,{}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-2",children:u("copilotConfigForm.modelMapping")}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Configure which models to use for each tier"}),e.jsxs("div",{className:"mb-4 rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-xs text-amber-900 dark:text-amber-200",children:[e.jsx("p",{className:"font-medium",children:u("copilotConfigForm.githubCopilotControls")}),e.jsx("p",{className:"mt-1",children:"CCS can switch Copilot models, but it cannot increase the provider's max prompt or context window."}),n.length>0?e.jsx("div",{className:"mt-2 space-y-1 text-[11px] font-mono",children:n.map(l=>e.jsxs("p",{children:[l.label,": ",l.id," (",l.limits,")"]},`${l.label}-${l.id}`))}):e.jsx("p",{className:"mt-2 text-[11px] font-mono",children:"Start the daemon to inspect live model limits from GitHub Copilot metadata."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(G,{label:"Default Model",description:"Used when no specific tier is requested",value:t,onChange:a,models:r,disabled:i}),e.jsx(G,{label:"Opus (Most capable)",description:"For complex reasoning tasks",value:s||t,onChange:x,models:r,disabled:i}),e.jsx(G,{label:"Sonnet (Balanced)",description:"Balance of speed and capability",value:o||t,onChange:h,models:r,disabled:i}),e.jsx(G,{label:"Haiku (Fast)",description:"Quick responses for simple tasks",value:d||t,onChange:f,models:r,disabled:i})]})]})]})})})}function ht({enabled:t,autoStart:s,port:o,accountType:d,rateLimit:r,waitOnLimit:i,onUpdateEnabled:c,onUpdateAutoStart:a,onUpdatePort:x,onUpdateAccountType:h,onUpdateRateLimit:f,onUpdateWaitOnLimit:u}){const{t:n}=S();return e.jsx(oe,{value:"settings",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(V,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(L,{htmlFor:"enabled",className:"text-sm font-medium",children:n("copilotSettings.enableCopilot")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n("copilotSettings.enableCopilotDesc")})]}),e.jsx(Z,{id:"enabled",checked:t,onCheckedChange:c})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:n("copilotSettings.basicSettings")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L,{htmlFor:"port",className:"text-xs",children:n("copilotPage.port")}),e.jsx(de,{id:"port",type:"number",value:o,onChange:l=>x(parseInt(l.target.value,10)),min:1024,max:65535,className:"max-w-[150px] h-8"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L,{htmlFor:"account-type",className:"text-xs",children:n("copilotSettings.accountType")}),e.jsxs(Fe,{value:d,onValueChange:h,children:[e.jsx(Te,{id:"account-type",className:"max-w-[150px] h-8",children:e.jsx(Me,{})}),e.jsxs(Le,{children:[e.jsx(ee,{value:"individual",children:n("copilotSettings.accountTypeIndividual")}),e.jsx(ee,{value:"business",children:n("copilotSettings.accountTypeBusiness")}),e.jsx(ee,{value:"enterprise",children:n("copilotSettings.accountTypeEnterprise")})]})]})]})]}),e.jsx(ne,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:n("copilotSettings.rateLimiting")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L,{htmlFor:"rate-limit",className:"text-xs",children:n("copilotSettings.rateLimitSeconds")}),e.jsx(de,{id:"rate-limit",type:"number",value:r,onChange:l=>f(l.target.value),placeholder:n("copilotSettings.noLimit"),min:0,className:"max-w-[150px] h-8"})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(L,{htmlFor:"wait-on-limit",className:"text-xs",children:n("copilotSettings.waitOnRateLimit")}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:n("copilotSettings.waitOnRateLimitDesc")})]}),e.jsx(Z,{id:"wait-on-limit",checked:i,onCheckedChange:u})]})]}),e.jsx(ne,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:n("copilotSettings.daemonSettings")}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(L,{htmlFor:"auto-start",className:"text-xs",children:n("copilotSettings.autoStartDaemon")}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:n("copilotSettings.autoStartDaemonDesc")})]}),e.jsx(Z,{id:"auto-start",checked:s,onCheckedChange:a})]})]})]})})})}function H({label:t,command:s}){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:s}),e.jsx(ge,{value:s,size:"icon",className:"h-6 w-6"})]})]})}function gt({rawSettings:t}){const{t:s}=S();return e.jsx(oe,{value:"info",className:"h-full mt-0 border-0 p-0 data-[state=inactive]:hidden",children:e.jsx(V,{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(Je,{className:"w-4 h-4"}),"Configuration Info"]}),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:s("copilotConfigForm.provider")}),e.jsx("span",{className:"font-mono",children:"GitHub Copilot"})]}),t&&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:s("copilotConfigForm.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:t.path}),e.jsx(ge,{value:t.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:s("copilotConfigForm.status")}),e.jsx(P,{variant:"outline",className:t.exists?"w-fit text-green-600 border-green-200 bg-green-50":"w-fit text-muted-foreground",children:t.exists?"File exists":"Using defaults"})]})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-3",children:s("copilotConfigForm.quickUsage")}),e.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[e.jsx(H,{label:"Run with Copilot",command:"ccs copilot"}),e.jsx(H,{label:"Authenticate",command:"ccs copilot auth"}),e.jsx(H,{label:"Start daemon",command:"ccs copilot --start"}),e.jsx(H,{label:"Stop daemon",command:"ccs copilot --stop"})]})]})]})})})}const ft=["ANTHROPIC_BASE_URL","ANTHROPIC_AUTH_TOKEN"];function pe(t){const s=t?.env||{};return ft.filter(o=>!s[o]?.trim())}function he(t){if(!t||t.length===0)return[];const s=new Map;return t.forEach(o=>{s.set(o.message,o)}),[...s.values()]}function jt(){const{t}=S(),{config:s,configLoading:o,models:d,modelsLoading:r,rawSettings:i,rawSettingsLoading:c,updateConfigAsync:a,isUpdating:x,saveRawSettingsAsync:h,isSavingRawSettings:f,refetchRawSettings:u}=be(),[n,l]=w.useState({}),[p,C]=w.useState(null),[k,F]=w.useState(!1),U=n.enabled??s?.enabled??!1,K=n.autoStart??s?.auto_start??!1,A=n.port??s?.port??4141,Q=n.accountType??s?.account_type??"individual",E=n.model??s?.model??"claude-sonnet-4-6",O=n.rateLimit??s?.rate_limit?.toString()??"",j=n.waitOnLimit??s?.wait_on_limit??!0,J=n.opusModel??s?.opus_model??"",$=n.sonnetModel??s?.sonnet_model??"",z=n.haikuModel??s?.haiku_model??"",B=(g,v)=>{l(_=>({..._,[g]:v}))},Y=g=>{l(v=>({...v,model:g.default,opusModel:g.opus,sonnetModel:g.sonnet,haikuModel:g.haiku})),I.success(t("toasts.presetApplied",{name:g.name}))},T=w.useMemo(()=>p!==null?p:i?.settings?JSON.stringify(i.settings,null,2):`{
|
|
1
|
+
import{j as e}from"./radix-ui-nu4wz29m.js";import{bf as N,bg as ke,a as S,B as P,d as b,V as oe,n as V,L,aI as Z,I as de,r as Fe,s as Te,t as Me,v as Le,w as ee,x as ge,bh as Re,S as y,bi as Ae,bj as Ee,bk as Oe,Q as _e,R as qe,U as te,bl as De,c as ie}from"./index-BRtgic66.js";import{r as w}from"./react-vendor-Bjx91N7w.js";import{a as Ie,u as D,b as R}from"./tanstack-bhJxV1h8.js";import{C as Ue}from"./confirm-dialog-DjLHh1qX.js";import{R as fe,L as je,au as Ke,aa as Qe,Z as me,_ as Je,T as ve,ax as $e,b as ze,ae as Be,aF as Ge,aP as ue,K as He,Y as We,aQ as Ve,x as we,I as Ne}from"./icons-DQFHtVq5.js";import{S as ne}from"./separator-Do_vqTQD.js";import{S as Ye}from"./searchable-select-CWL2D5Ft.js";import{t as I}from"./notifications-B4_o8bcr.js";import"./utils-CzKF5WmX.js";import"./form-utils-CuHzLhJZ.js";import"./code-highlight-D4E79GKQ.js";import"./alert-dialog-C6npAhT0.js";async function Xe(){const t=await fetch(N("/copilot/status"));if(!t.ok)throw new Error("Failed to fetch copilot status");return t.json()}async function Ze(){const t=await fetch(N("/copilot/config"));if(!t.ok)throw new Error("Failed to fetch copilot config");return t.json()}async function et(){const t=await fetch(N("/copilot/models"));if(!t.ok)throw new Error("Failed to fetch copilot models");return t.json()}async function tt(){const t=await fetch(N("/copilot/settings/raw"));if(!t.ok)throw new Error("Failed to fetch copilot raw settings");return t.json()}async function st(t){const s=await fetch(N("/copilot/config"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!s.ok)throw new Error("Failed to update copilot config");return s.json()}async function at(t){const s=await fetch(N("/copilot/settings/raw"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(s.status===409)throw new ke("Copilot raw settings changed externally");if(!s.ok)throw new Error("Failed to save copilot raw settings");return s.json()}async function it(){const t=await fetch(N("/copilot/auth/start"),{method:"POST"});if(!t.ok)throw new Error("Failed to start auth");return t.json()}async function nt(){const t=await fetch(N("/copilot/daemon/start"),{method:"POST"});if(!t.ok)throw new Error("Failed to start daemon");return t.json()}async function ot(){const t=await fetch(N("/copilot/daemon/stop"),{method:"POST"});if(!t.ok)throw new Error("Failed to stop daemon");return t.json()}async function lt(){const t=await fetch(N("/copilot/info"));if(!t.ok)throw new Error("Failed to fetch copilot info");return t.json()}async function rt(t){const s=await fetch(N("/copilot/install"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t?{version:t}:{})});if(!s.ok)throw new Error("Failed to install copilot-api");return s.json()}function be(){const t=Ie(),s=D({queryKey:["copilot-status"],queryFn:Xe,refetchInterval:5e3}),o=D({queryKey:["copilot-config"],queryFn:Ze}),d=D({queryKey:["copilot-models"],queryFn:et}),r=D({queryKey:["copilot-raw-settings"],queryFn:tt}),i=D({queryKey:["copilot-info"],queryFn:lt}),c=R({mutationFn:st,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]}),t.invalidateQueries({queryKey:["copilot-config"]}),t.invalidateQueries({queryKey:["copilot-raw-settings"]})}}),a=R({mutationFn:at,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]}),t.invalidateQueries({queryKey:["copilot-config"]}),t.invalidateQueries({queryKey:["copilot-raw-settings"]})}}),x=R({mutationFn:it,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]})}}),h=R({mutationFn:nt,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]})}}),f=R({mutationFn:ot,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]})}}),u=R({mutationFn:rt,onSuccess:()=>{t.invalidateQueries({queryKey:["copilot-status"]}),t.invalidateQueries({queryKey:["copilot-info"]})}});return w.useMemo(()=>({status:s.data,statusLoading:s.isLoading,statusError:s.error,refetchStatus:s.refetch,config:o.data,configLoading:o.isLoading,models:d.data?.models??[],currentModel:d.data?.current,modelsLoading:d.isLoading,rawSettings:r.data,rawSettingsLoading:r.isLoading,refetchRawSettings:r.refetch,updateConfig:c.mutate,updateConfigAsync:c.mutateAsync,isUpdating:c.isPending,saveRawSettings:a.mutate,saveRawSettingsAsync:a.mutateAsync,isSavingRawSettings:a.isPending,startAuth:x.mutate,startAuthAsync:x.mutateAsync,isAuthenticating:x.isPending,authResult:x.data,startDaemon:h.mutate,isStartingDaemon:h.isPending,stopDaemon:f.mutate,isStoppingDaemon:f.isPending,info:i.data,infoLoading:i.isLoading,refetchInfo:i.refetch,install:u.mutate,installAsync:u.mutateAsync,isInstalling:u.isPending}),[s.data,s.isLoading,s.error,s.refetch,o.data,o.isLoading,d.data,d.isLoading,r.data,r.isLoading,r.refetch,c.mutate,c.mutateAsync,c.isPending,a.mutate,a.mutateAsync,a.isPending,x.mutate,x.mutateAsync,x.isPending,x.data,h.mutate,h.isPending,f.mutate,f.isPending,i.data,i.isLoading,i.refetch,u.mutate,u.mutateAsync,u.isPending])}function ct({rawSettings:t,rawSettingsLoading:s,isUpdating:o,isSavingRawSettings:d,hasChanges:r,isRawJsonValid:i,onRefresh:c,onSave:a}){const{t:x}=S();return e.jsxs("div",{className:"px-6 py-4 border-b bg-background flex items-center justify-between shrink-0",children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold",children:x("copilotConfigForm.copilotConfiguration")}),t&&e.jsx(P,{variant:"outline",className:"text-xs",children:"copilot.settings.json"})]}),t&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["Last modified: ",t.exists?new Date(t.mtime).toLocaleString():"Never saved"]})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{variant:"ghost",size:"sm",onClick:c,disabled:s,children:e.jsx(fe,{className:`w-4 h-4 ${s?"animate-spin":""}`})}),e.jsx(b,{size:"sm",onClick:a,disabled:o||d||!r||!i,children:o||d?e.jsxs(e.Fragment,{children:[e.jsx(je,{className:"w-4 h-4 mr-1 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Ke,{className:"w-4 h-4 mr-1"}),"Save"]})})]})]})}const dt=[{name:"GPT-4.1 (Free)",description:"Free tier - no premium usage",default:"gpt-4.1",opus:"gpt-4.1",sonnet:"gpt-4.1",haiku:"gpt-4.1"},{name:"GPT-5 Mini (Free)",description:"Free tier - lightweight model",default:"gpt-5-mini",opus:"gpt-5-mini",sonnet:"gpt-5-mini",haiku:"gpt-5-mini"}],mt=[{name:"Claude Opus 4.5",description:"Pro+ (3x) - Most capable reasoning",default:"claude-opus-4.5",opus:"claude-opus-4.5",sonnet:"claude-sonnet-4.5",haiku:"claude-haiku-4.5"},{name:"Claude Sonnet 4.5",description:"Pro+ (1x) - Balanced performance",default:"claude-sonnet-4.5",opus:"claude-opus-4.5",sonnet:"claude-sonnet-4.5",haiku:"claude-haiku-4.5"},{name:"GPT-5.2",description:"Pro+ (1x) - Latest OpenAI (Preview)",default:"gpt-5.2",opus:"gpt-5.2",sonnet:"gpt-5.1",haiku:"gpt-5-mini"},{name:"GPT-5.1 Codex Max",description:"Pro+ (1x) - Best for coding",default:"gpt-5.1-codex-max",opus:"gpt-5.1-codex-max",sonnet:"gpt-5.1-codex",haiku:"gpt-5.1-codex-mini"},{name:"Gemini 2.5 Pro",description:"Pro+ (1x) - Google latest",default:"gemini-2.5-pro",opus:"gemini-2.5-pro",sonnet:"gemini-2.5-pro",haiku:"gemini-3-flash"}];function xe(t){switch(t){case"free":return"bg-green-100 text-green-700 border-green-200";case"pro":return"bg-blue-100 text-blue-700 border-blue-200";case"pro+":return"bg-purple-100 text-purple-700 border-purple-200";case"business":return"bg-orange-100 text-orange-700 border-orange-200";case"enterprise":return"bg-red-100 text-red-700 border-red-200";default:return"bg-muted text-muted-foreground"}}function ut(t){return t==null?null:t===0?"Free":t<1?`${t}x`:t===1?"1x":`${t}x`}function G({label:t,description:s,value:o,onChange:d,models:r,disabled:i}){const{t:c}=S();return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium",children:t}),s&&e.jsx("p",{className:"text-[10px] text-muted-foreground",children:s})]}),e.jsx(Ye,{value:o||void 0,onChange:d,disabled:i,placeholder:c("componentModelSelector.selectModel"),searchPlaceholder:c("searchableSelect.searchModels"),emptyText:c("searchableSelect.noResults"),triggerClassName:"h-9",groups:[{key:"models",label:c("componentModelSelector.availableModelsCount",{count:r.length})}],options:r.map(a=>({value:a.id,groupKey:"models",searchText:`${a.name||a.id} ${a.id}`,keywords:[a.minPlan??"",a.preview?"preview":""],triggerContent:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:a.id}),a.minPlan&&e.jsx(P,{variant:"outline",className:`text-[9px] px-1 py-0 h-4 ${xe(a.minPlan)}`,children:a.minPlan})]}),itemContent:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:a.name||a.id}),a.minPlan&&e.jsx(P,{variant:"outline",className:`text-[9px] px-1 py-0 h-4 ${xe(a.minPlan)}`,children:a.minPlan}),a.multiplier!==void 0&&e.jsx("span",{className:"text-[9px] text-muted-foreground",children:ut(a.multiplier)}),a.preview&&e.jsx(P,{variant:"secondary",className:"text-[9px] px-1 py-0 h-4",children:c("componentModelSelector.preview")})]})}))})]})}function se(t){if(t>=1e6){const s=t/1e6;return s%1===0?`${s}M`:`${s.toFixed(1)}M`}if(t>=1e3){const s=t/1e3;return s%1===0?`${s}K`:`${s.toFixed(1)}K`}return`${t}`}function xt(t){if(!t?.limits)return null;const s=[];return t.limits.maxPromptTokens&&s.push(`prompt ${se(t.limits.maxPromptTokens)}`),t.limits.maxContextWindowTokens&&s.push(`context ${se(t.limits.maxContextWindowTokens)}`),t.limits.maxOutputTokens&&s.push(`output ${se(t.limits.maxOutputTokens)}`),s.length>0?s.join(" | "):null}function pt({currentModel:t,opusModel:s,sonnetModel:o,haikuModel:d,models:r,modelsLoading:i,onApplyPreset:c,onUpdateModel:a,onUpdateOpusModel:x,onUpdateSonnetModel:h,onUpdateHaikuModel:f}){const{t:u}=S(),n=[{label:"Default",id:t},{label:"Opus",id:s||t},{label:"Sonnet",id:o||t},{label:"Haiku",id:d||t}].map(({label:l,id:p})=>{const C=r.find(F=>F.id===p),k=xt(C);return k?{label:l,id:p,limits:k}:null}).filter(l=>l!==null);return e.jsx(oe,{value:"config",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(V,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[e.jsx(Qe,{className:"w-4 h-4"}),u("providerEditor.presets")]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:u("copilotConfigForm.modelMapping")}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(P,{variant:"outline",className:"text-[10px] bg-green-100 text-green-700 border-green-200",children:"Free Tier"}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:u("copilotConfigForm.noPremiumUsage")})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:dt.map(l=>e.jsxs(b,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>c(l),title:l.description,children:[e.jsx(me,{className:"w-3 h-3 text-green-600"}),l.name]},l.name))})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(P,{variant:"outline",className:"text-[10px] bg-blue-100 text-blue-700 border-blue-200",children:"Pro+ Required"}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Uses premium request quota"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:mt.map(l=>e.jsxs(b,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>c(l),title:l.description,children:[e.jsx(me,{className:"w-3 h-3"}),l.name]},l.name))})]})]}),e.jsx(ne,{}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-2",children:u("copilotConfigForm.modelMapping")}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Configure which models to use for each tier"}),e.jsxs("div",{className:"mb-4 rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-xs text-amber-900 dark:text-amber-200",children:[e.jsx("p",{className:"font-medium",children:u("copilotConfigForm.githubCopilotControls")}),e.jsx("p",{className:"mt-1",children:"CCS can switch Copilot models, but it cannot increase the provider's max prompt or context window."}),n.length>0?e.jsx("div",{className:"mt-2 space-y-1 text-[11px] font-mono",children:n.map(l=>e.jsxs("p",{children:[l.label,": ",l.id," (",l.limits,")"]},`${l.label}-${l.id}`))}):e.jsx("p",{className:"mt-2 text-[11px] font-mono",children:"Start the daemon to inspect live model limits from GitHub Copilot metadata."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(G,{label:"Default Model",description:"Used when no specific tier is requested",value:t,onChange:a,models:r,disabled:i}),e.jsx(G,{label:"Opus (Most capable)",description:"For complex reasoning tasks",value:s||t,onChange:x,models:r,disabled:i}),e.jsx(G,{label:"Sonnet (Balanced)",description:"Balance of speed and capability",value:o||t,onChange:h,models:r,disabled:i}),e.jsx(G,{label:"Haiku (Fast)",description:"Quick responses for simple tasks",value:d||t,onChange:f,models:r,disabled:i})]})]})]})})})}function ht({enabled:t,autoStart:s,port:o,accountType:d,rateLimit:r,waitOnLimit:i,onUpdateEnabled:c,onUpdateAutoStart:a,onUpdatePort:x,onUpdateAccountType:h,onUpdateRateLimit:f,onUpdateWaitOnLimit:u}){const{t:n}=S();return e.jsx(oe,{value:"settings",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(V,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(L,{htmlFor:"enabled",className:"text-sm font-medium",children:n("copilotSettings.enableCopilot")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n("copilotSettings.enableCopilotDesc")})]}),e.jsx(Z,{id:"enabled",checked:t,onCheckedChange:c})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:n("copilotSettings.basicSettings")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L,{htmlFor:"port",className:"text-xs",children:n("copilotPage.port")}),e.jsx(de,{id:"port",type:"number",value:o,onChange:l=>x(parseInt(l.target.value,10)),min:1024,max:65535,className:"max-w-[150px] h-8"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L,{htmlFor:"account-type",className:"text-xs",children:n("copilotSettings.accountType")}),e.jsxs(Fe,{value:d,onValueChange:h,children:[e.jsx(Te,{id:"account-type",className:"max-w-[150px] h-8",children:e.jsx(Me,{})}),e.jsxs(Le,{children:[e.jsx(ee,{value:"individual",children:n("copilotSettings.accountTypeIndividual")}),e.jsx(ee,{value:"business",children:n("copilotSettings.accountTypeBusiness")}),e.jsx(ee,{value:"enterprise",children:n("copilotSettings.accountTypeEnterprise")})]})]})]})]}),e.jsx(ne,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:n("copilotSettings.rateLimiting")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L,{htmlFor:"rate-limit",className:"text-xs",children:n("copilotSettings.rateLimitSeconds")}),e.jsx(de,{id:"rate-limit",type:"number",value:r,onChange:l=>f(l.target.value),placeholder:n("copilotSettings.noLimit"),min:0,className:"max-w-[150px] h-8"})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(L,{htmlFor:"wait-on-limit",className:"text-xs",children:n("copilotSettings.waitOnRateLimit")}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:n("copilotSettings.waitOnRateLimitDesc")})]}),e.jsx(Z,{id:"wait-on-limit",checked:i,onCheckedChange:u})]})]}),e.jsx(ne,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:n("copilotSettings.daemonSettings")}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(L,{htmlFor:"auto-start",className:"text-xs",children:n("copilotSettings.autoStartDaemon")}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:n("copilotSettings.autoStartDaemonDesc")})]}),e.jsx(Z,{id:"auto-start",checked:s,onCheckedChange:a})]})]})]})})})}function H({label:t,command:s}){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:s}),e.jsx(ge,{value:s,size:"icon",className:"h-6 w-6"})]})]})}function gt({rawSettings:t}){const{t:s}=S();return e.jsx(oe,{value:"info",className:"h-full mt-0 border-0 p-0 data-[state=inactive]:hidden",children:e.jsx(V,{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(Je,{className:"w-4 h-4"}),"Configuration Info"]}),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:s("copilotConfigForm.provider")}),e.jsx("span",{className:"font-mono",children:"GitHub Copilot"})]}),t&&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:s("copilotConfigForm.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:t.path}),e.jsx(ge,{value:t.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:s("copilotConfigForm.status")}),e.jsx(P,{variant:"outline",className:t.exists?"w-fit text-green-600 border-green-200 bg-green-50":"w-fit text-muted-foreground",children:t.exists?"File exists":"Using defaults"})]})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-3",children:s("copilotConfigForm.quickUsage")}),e.jsxs("div",{className:"space-y-3 bg-card rounded-lg border p-4 shadow-sm",children:[e.jsx(H,{label:"Run with Copilot",command:"ccs copilot"}),e.jsx(H,{label:"Authenticate",command:"ccs copilot auth"}),e.jsx(H,{label:"Start daemon",command:"ccs copilot --start"}),e.jsx(H,{label:"Stop daemon",command:"ccs copilot --stop"})]})]})]})})})}const ft=["ANTHROPIC_BASE_URL","ANTHROPIC_AUTH_TOKEN"];function pe(t){const s=t?.env||{};return ft.filter(o=>!s[o]?.trim())}function he(t){if(!t||t.length===0)return[];const s=new Map;return t.forEach(o=>{s.set(o.message,o)}),[...s.values()]}function jt(){const{t}=S(),{config:s,configLoading:o,models:d,modelsLoading:r,rawSettings:i,rawSettingsLoading:c,updateConfigAsync:a,isUpdating:x,saveRawSettingsAsync:h,isSavingRawSettings:f,refetchRawSettings:u}=be(),[n,l]=w.useState({}),[p,C]=w.useState(null),[k,F]=w.useState(!1),U=n.enabled??s?.enabled??!1,K=n.autoStart??s?.auto_start??!1,A=n.port??s?.port??4141,Q=n.accountType??s?.account_type??"individual",E=n.model??s?.model??"claude-sonnet-4-6",O=n.rateLimit??s?.rate_limit?.toString()??"",j=n.waitOnLimit??s?.wait_on_limit??!0,J=n.opusModel??s?.opus_model??"",$=n.sonnetModel??s?.sonnet_model??"",z=n.haikuModel??s?.haiku_model??"",B=(g,v)=>{l(_=>({..._,[g]:v}))},Y=g=>{l(v=>({...v,model:g.default,opusModel:g.opus,sonnetModel:g.sonnet,haikuModel:g.haiku})),I.success(t("toasts.presetApplied",{name:g.name}))},T=w.useMemo(()=>p!==null?p:i?.settings?JSON.stringify(i.settings,null,2):`{
|
|
2
2
|
"env": {}
|
|
3
3
|
}`,[p,i]),m=w.useCallback(g=>{C(g)},[]),le=w.useMemo(()=>{try{return JSON.parse(T),!0}catch{return!1}},[T]),ye=w.useMemo(()=>{const g=Object.keys(n).length>0,v=p!==null&&p!==JSON.stringify(i?.settings,null,2);return g||v},[n,p,i]),re=w.useMemo(()=>{if(p!==null)try{return JSON.parse(p)}catch{return i?.settings}return i?.settings},[p,i?.settings]),Se=w.useMemo(()=>pe(re),[re]),Ce=w.useMemo(()=>he([...s?.warnings??[],...i?.warnings??[]]),[s?.warnings,i?.warnings]),ce=async({overwriteRawSettings:g=!1}={})=>{try{const v=[];if(Object.keys(n).length>0){const M=await a({enabled:U,auto_start:K,port:A,account_type:Q,model:E,rate_limit:O?parseInt(O,10):null,wait_on_limit:j,opus_model:J||void 0,sonnet_model:$||void 0,haiku_model:z||void 0});v.push(...M.warnings??[])}let _=[];if(p!==null&&le){const M=JSON.parse(T);_=pe(M);const Pe=await h({settings:M,expectedMtime:g?void 0:i?.mtime});v.push(...Pe.warnings??[])}const X=he(v),q=[];X.length>0&&q.push(X.map(M=>M.message).join(" ")),_.length>0&&q.push(`Missing fields will use defaults: ${_.join(", ")}`),X.length>0?I.warning(t("toasts.settingsSavedWithAdjustments"),{description:q.join(" ")}):q.length>0?I.success(t("toasts.settingsSaved"),{description:q.join(" ")}):I.success(t("toasts.settingsSaved")),l({}),C(null)}catch(v){Re(v)?F(!0):I.error(t("toasts.failedSaveSettings"))}};return{configLoading:o,rawSettingsLoading:c,modelsLoading:r,isUpdating:x,isSavingRawSettings:f,models:d,rawSettings:i,rawJsonContent:T,rawJsonEdits:p,enabled:U,autoStart:K,port:A,accountType:Q,currentModel:E,rateLimit:O,waitOnLimit:j,opusModel:J,sonnetModel:$,haikuModel:z,isRawJsonValid:le,hasChanges:ye,normalizationWarnings:Ce,conflictDialog:k,updateField:B,applyPreset:Y,handleRawJsonChange:m,handleSave:ce,handleConflictResolve:async g=>{F(!1),g?await ce({overwriteRawSettings:!0}):C(null)},refetchRawSettings:u,missingRequiredFields:Se}}function vt(){const{t}=S(),{configLoading:s,rawSettingsLoading:o,modelsLoading:d,isUpdating:r,isSavingRawSettings:i,models:c,rawSettings:a,rawJsonContent:x,rawJsonEdits:h,enabled:f,autoStart:u,port:n,accountType:l,currentModel:p,rateLimit:C,waitOnLimit:k,opusModel:F,sonnetModel:U,haikuModel:K,isRawJsonValid:A,hasChanges:Q,normalizationWarnings:E,conflictDialog:O,updateField:j,applyPreset:J,handleRawJsonChange:$,handleSave:z,handleConflictResolve:B,refetchRawSettings:Y,missingRequiredFields:T}=jt();return s||o?e.jsxs("div",{className:"space-y-6",children:[e.jsx(y,{className:"h-10 w-full"}),e.jsx(y,{className:"h-10 w-full"}),e.jsx(y,{className:"h-10 w-full"}),e.jsx(y,{className:"h-10 w-full"})]}):e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx(ct,{rawSettings:a,rawSettingsLoading:o,isUpdating:r,isSavingRawSettings:i,hasChanges:Q,isRawJsonValid:A,onRefresh:()=>Y(),onSave:z}),E.length>0&&e.jsx("div",{className:"px-6 pt-4 shrink-0",children:e.jsxs(Ae,{variant:"warning",children:[e.jsx(ve,{className:"h-4 w-4"}),e.jsx(Ee,{children:t("copilotConfigForm.deprecatedModels")}),e.jsxs(Oe,{className:"space-y-2",children:[e.jsx("p",{children:"Loading this page did not rewrite your files. Save the Copilot configuration to persist these replacements."}),e.jsx("div",{className:"space-y-1",children:E.map(m=>e.jsx("p",{children:m.message},m.message))})]})]})}),e.jsxs("div",{className:"flex-1 flex divide-x overflow-hidden",children:[e.jsx("div",{className:"w-[540px] shrink-0 flex flex-col overflow-hidden bg-muted/5",children:e.jsx("div",{className:"h-full flex flex-col",children:e.jsxs(_e,{defaultValue:"config",className:"h-full flex flex-col",children:[e.jsx("div",{className:"px-4 pt-4 shrink-0",children:e.jsxs(qe,{className:"w-full",children:[e.jsx(te,{value:"config",className:"flex-1",children:"Model Config"}),e.jsx(te,{value:"settings",className:"flex-1",children:"Settings"}),e.jsx(te,{value:"info",className:"flex-1",children:"Info"})]})}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[e.jsx(pt,{currentModel:p,opusModel:F,sonnetModel:U,haikuModel:K,models:c,modelsLoading:d,onApplyPreset:J,onUpdateModel:m=>j("model",m),onUpdateOpusModel:m=>j("opusModel",m),onUpdateSonnetModel:m=>j("sonnetModel",m),onUpdateHaikuModel:m=>j("haikuModel",m)}),e.jsx(ht,{enabled:f,autoStart:u,port:n,accountType:l,rateLimit:C,waitOnLimit:k,onUpdateEnabled:m=>j("enabled",m),onUpdateAutoStart:m=>j("autoStart",m),onUpdatePort:m=>j("port",m),onUpdateAccountType:m=>j("accountType",m),onUpdateRateLimit:m=>j("rateLimit",m),onUpdateWaitOnLimit:m=>j("waitOnLimit",m)}),e.jsx(gt,{rawSettings:a})]})]})})}),e.jsxs("div",{className:"flex-1 min-w-0 flex 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($e,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Raw Configuration (JSON)"})]}),e.jsx(De,{rawJsonContent:x,isRawJsonValid:A,rawJsonEdits:h,rawSettingsEnv:a?.settings?.env,onChange:$,missingRequiredFields:T})]})]}),e.jsx(Ue,{open:O,title:"File Modified Externally",description:"This settings file was modified by another process. Overwrite with your changes or discard?",confirmText:"Overwrite",variant:"destructive",onConfirm:()=>B(!0),onCancel:()=>B(!1)})]})}function ae({title:t,children:s}){return e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide px-3",children:t}),e.jsx("div",{className:"space-y-1",children:s})]})}function W({icon:t,label:s,status:o,statusText:d,variant:r="default"}){return e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 rounded-lg bg-muted/50",children:[e.jsx(t,{className:"w-4 h-4 text-muted-foreground shrink-0"}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("span",{className:"text-sm",children:s})}),e.jsx("div",{className:"flex items-center gap-1.5",children:o?e.jsxs(e.Fragment,{children:[e.jsx(we,{className:ie("w-4 h-4",r==="warning"?"text-yellow-500":"text-green-500")}),e.jsx("span",{className:ie("text-xs",r==="warning"?"text-yellow-500":"text-green-500"),children:d||"Yes"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ne,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:d||"No"})]})})]})}function wt(){return e.jsxs("div",{className:"space-y-4 p-4",children:[e.jsx(y,{className:"h-8 w-full"}),e.jsx(y,{className:"h-12 w-full"}),e.jsx(y,{className:"h-12 w-full"}),e.jsx(y,{className:"h-12 w-full"})]})}function Ot(){const{t}=S(),{status:s,statusLoading:o,refetchStatus:d,startAuth:r,isAuthenticating:i,startDaemon:c,isStartingDaemon:a,stopDaemon:x,isStoppingDaemon:h,install:f,isInstalling:u}=be();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 shrink-0",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(ze,{className:"w-5 h-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:t("copilotPage.title")})]}),e.jsx(b,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>d(),disabled:o,children:e.jsx(fe,{className:ie("w-4 h-4",o&&"animate-spin")})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("copilotPage.subtitle")})]}),e.jsx(V,{className:"flex-1",children:o?e.jsx(wt,{}):e.jsxs("div",{className:"p-3 space-y-4",children:[e.jsxs("div",{className:"rounded-md border border-yellow-500/50 bg-yellow-500/15 p-3 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ve,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-400 shrink-0"}),e.jsx("span",{className:"text-xs font-semibold text-yellow-800 dark:text-yellow-200",children:t("copilotPage.unofficialTitle")})]}),e.jsxs("ul",{className:"text-[11px] text-yellow-700 dark:text-yellow-300 space-y-0.5 pl-6 list-disc",children:[e.jsx("li",{children:t("copilotPage.unofficialItem1")}),e.jsx("li",{children:t("copilotPage.unofficialItem2")}),e.jsx("li",{children:t("copilotPage.unofficialItem3")})]})]}),e.jsxs(ae,{title:t("copilotPage.setup"),children:[e.jsx(W,{icon:Be,label:"copilot-api",status:s?.installed??!1,statusText:s?.installed?s.version?`v${s.version}`:t("copilotPage.installed"):t("copilotPage.missing")}),!s?.installed&&e.jsx(b,{size:"sm",className:"w-full mt-2",onClick:()=>f(void 0),disabled:u,children:u?e.jsxs(e.Fragment,{children:[e.jsx(je,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}),t("copilotPage.installing")]}):e.jsxs(e.Fragment,{children:[e.jsx(Ge,{className:"w-3.5 h-3.5 mr-1.5"}),t("copilotPage.installCopilotApi")]})}),s?.installed&&e.jsx(W,{icon:ue,label:t("copilotPage.integration"),status:s?.enabled??!1,statusText:s?.enabled?t("copilotPage.enabled"):t("copilotPage.disabled")})]}),s?.installed&&e.jsxs(ae,{title:t("copilotPage.auth"),children:[e.jsx(W,{icon:He,label:t("copilotPage.github"),status:s?.authenticated??!1,statusText:s?.authenticated?t("copilotPage.connected"):t("copilotPage.notConnected")}),!s?.authenticated&&e.jsx(b,{size:"sm",className:"w-full mt-2",onClick:()=>r(),disabled:i,children:t(i?"copilotPage.authenticating":"copilotPage.authenticate")})]}),s?.authenticated&&e.jsxs(ae,{title:t("copilotPage.daemon"),children:[e.jsx(W,{icon:We,label:t("copilotPage.status"),status:s?.daemon_running??!1,statusText:s?.daemon_running?t("copilotPage.running"):t("copilotPage.stopped")}),e.jsxs("div",{className:"px-3 py-1 text-xs text-muted-foreground",children:[t("copilotPage.port"),": ",s?.port??4141]}),e.jsx("div",{className:"px-1",children:s?.daemon_running?e.jsxs(b,{size:"sm",variant:"outline",className:"w-full",onClick:()=>x(),disabled:h,children:[e.jsx(Ve,{className:"w-3.5 h-3.5 mr-1.5"}),t(h?"copilotPage.stopping":"copilotPage.stop")]}):e.jsxs(b,{size:"sm",variant:"outline",className:"w-full",onClick:()=>c(),disabled:a,children:[e.jsx(ue,{className:"w-3.5 h-3.5 mr-1.5"}),t(a?"copilotPage.starting":"copilotPage.start")]})})]})]})}),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("copilotPage.proxy")}),s?.daemon_running?e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(we,{className:"w-3 h-3 text-green-500"}),t("copilotPage.active")]}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ne,{className:"w-3 h-3 text-muted-foreground"}),t("copilotPage.inactive")]})]})})]}),e.jsx("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-hidden",children:e.jsx(vt,{})})]})}export{Ot as CopilotPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-Zb8sVEtn.js";import{r as b,h as gs}from"./react-vendor-CNOkPC89.js";import{t as i}from"./notifications-B2HqRBj7.js";import{bf as y,bg as xs,a as Oe,B as M,d as h,c as V,n as U,Q as hs,R as fs,U as ue,V as me,L,I as ge,aI as Fe,bl as ps,ah as js,ai as Ps,aj as bs,ak as ys,al as Ns,aD as vs,bh as ws}from"./index-0mNJhDEG.js";import{a as Cs,u as B,b as R}from"./tanstack-CrmUhA7Z.js";import{D as Ee}from"./default-ports-1QQSffYX.js";import{S as Ss}from"./separator-mG07scBE.js";import{S as ks}from"./searchable-select-BKx31cCH.js";import{R as Le,T as _s,K as z,Z as J,ai as As,ae as Ds,ax as xe,aQ as Ie,aP as Ms,L as F,J as Ts,au as Rs,aa as Fs,x as Ls,I as Is}from"./icons-DyorC3Xk.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";const N="/legacy/cursor";function Os(s){if(!s||typeof s!="object")return!1;const t=s;return typeof t.message=="string"&&typeof t.stage=="string"&&typeof t.status=="number"&&typeof t.duration_ms=="number"&&typeof t.ok=="boolean"}function Es(s){if(!s||typeof s!="object"||!("error"in s))return null;const t=s;return typeof t.error=="string"?t.error:null}async function zs(){const s=await fetch(y(`${N}/status`));if(!s.ok)throw new Error("Failed to fetch cursor status");return s.json()}async function Ks(){const s=await fetch(y(`${N}/settings`));if(!s.ok)throw new Error("Failed to fetch cursor config");return s.json()}async function qs(){const s=await fetch(y(`${N}/models`));if(!s.ok)throw new Error("Failed to fetch cursor models");return s.json()}async function Gs(){const s=await fetch(y(`${N}/settings/raw`));if(!s.ok)throw new Error("Failed to fetch cursor raw settings");return s.json()}async function Qs(s){const t=await fetch(y(`${N}/settings`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!t.ok)throw new Error("Failed to update cursor config");return t.json()}async function Us(s){const t=await fetch(y(`${N}/settings/raw`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(t.status===409)throw new xs("Cursor raw settings changed externally");if(!t.ok)throw new Error("Failed to save cursor raw settings");return t.json()}async function Bs(){const s=await fetch(y(`${N}/auth/auto-detect`),{method:"POST"});if(!s.ok){const t=await s.json().catch(()=>({error:"Auto-detect failed"}));throw new Error(t.error||"Auto-detect failed")}return s.json()}async function Js(s){const t=await fetch(y(`${N}/auth/import`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!t.ok){const r=await t.json().catch(()=>({error:"Manual import failed"}));throw new Error(r.error||"Manual import failed")}return t.json()}async function $s(){const s=await fetch(y(`${N}/daemon/start`),{method:"POST"});if(!s.ok)throw new Error("Failed to start cursor daemon");return s.json()}async function Hs(){const s=await fetch(y(`${N}/daemon/stop`),{method:"POST"});if(!s.ok)throw new Error("Failed to stop cursor daemon");return s.json()}async function Vs(){const s=await fetch(y(`${N}/probe`),{method:"POST"}),t=await s.json().catch(()=>null);return Os(t)?t:{ok:!1,stage:"runtime",status:s.status,duration_ms:0,error_type:"runtime_error",message:Es(t)??"Failed to run live probe"}}function Ws(){const s=Cs(),t=B({queryKey:["cursor-status"],queryFn:zs,refetchInterval:5e3}),r=B({queryKey:["cursor-config"],queryFn:Ks}),u=B({queryKey:["cursor-models"],queryFn:qs}),x=B({queryKey:["cursor-raw-settings"],queryFn:Gs}),c=()=>{s.invalidateQueries({queryKey:["cursor-status"]}),s.invalidateQueries({queryKey:["cursor-config"]}),s.invalidateQueries({queryKey:["cursor-models"]}),s.invalidateQueries({queryKey:["cursor-raw-settings"]})},f=R({mutationFn:Qs,onSuccess:c}),g=R({mutationFn:Us,onSuccess:c}),p=R({mutationFn:Bs,onSuccess:c}),n=R({mutationFn:Js,onSuccess:c}),l=R({mutationFn:$s,onSuccess:c}),d=R({mutationFn:Hs,onSuccess:c}),m=R({mutationFn:Vs,onSettled:()=>{s.invalidateQueries({queryKey:["cursor-status"]}),s.invalidateQueries({queryKey:["cursor-models"]})}});return b.useMemo(()=>({status:t.data,statusLoading:t.isLoading,statusError:t.error,refetchStatus:t.refetch,config:r.data,configLoading:r.isLoading,refetchConfig:r.refetch,models:u.data?.models??[],currentModel:u.data?.current??null,modelsLoading:u.isLoading,rawSettings:x.data,rawSettingsLoading:x.isLoading,refetchRawSettings:x.refetch,updateConfig:f.mutate,updateConfigAsync:f.mutateAsync,isUpdatingConfig:f.isPending,saveRawSettings:g.mutate,saveRawSettingsAsync:g.mutateAsync,isSavingRawSettings:g.isPending,autoDetectAuth:p.mutate,autoDetectAuthAsync:p.mutateAsync,isAutoDetectingAuth:p.isPending,autoDetectAuthResult:p.data,importManualAuth:n.mutate,importManualAuthAsync:n.mutateAsync,isImportingManualAuth:n.isPending,manualAuthResult:n.data,startDaemon:l.mutate,startDaemonAsync:l.mutateAsync,isStartingDaemon:l.isPending,stopDaemon:d.mutate,stopDaemonAsync:d.mutateAsync,isStoppingDaemon:d.isPending,runProbe:m.mutate,runProbeAsync:m.mutateAsync,isRunningProbe:m.isPending,probeResult:m.data,resetProbe:m.reset}),[t.data,t.isLoading,t.error,t.refetch,r.data,r.isLoading,r.refetch,u.data,u.isLoading,x.data,x.isLoading,x.refetch,f.mutate,f.mutateAsync,f.isPending,g.mutate,g.mutateAsync,g.isPending,p.mutate,p.mutateAsync,p.isPending,p.data,n.mutate,n.mutateAsync,n.isPending,n.data,l.mutate,l.mutateAsync,l.isPending,d.mutate,d.mutateAsync,d.isPending,m.mutate,m.mutateAsync,m.isPending,m.data,m.reset])}function he(s,t){return JSON.stringify({enabled:s?.enabled??null,authenticated:s?.authenticated??null,token_expired:s?.token_expired??null,daemon_running:s?.daemon_running??null,port:s?.port??null,ghost_mode:s?.ghost_mode??null,auto_start:t?.auto_start??null,model:t?.model??null})}function $(s){return{port:String(s?.port??Ee),auto_start:s?.auto_start??!1,ghost_mode:s?.ghost_mode??!0,model:s?.model?.trim()||"gpt-5.3-codex",opus_model:s?.opus_model?.trim()||"",sonnet_model:s?.sonnet_model?.trim()||"",haiku_model:s?.haiku_model?.trim()||""}}function S(s,t,r){return s.find(x=>t.some(c=>c.test(x.id)))?.id??r}function fe(s){return s.toLowerCase().replace(/[^a-z0-9]/g,"")}function k(s,t,r){const u=new Set(t.map(fe)),x=s.find(f=>u.has(fe(f.id)));if(x)return x.id;const c=s.find(f=>u.has(fe(f.name)));return c?c.id:r}function Xs(s){try{const t=JSON.parse(s||"{}");return!t||typeof t!="object"||Array.isArray(t)?{isValid:!1,error:"Raw settings must be a JSON object"}:{isValid:!0,settings:t}}catch(t){return{isValid:!1,error:t.message||"Invalid JSON"}}}function H({label:s,description:t,value:r,models:u,disabled:x,allowDefaultFallback:c=!1,onChange:f}){const{t:g}=Oe(),p=r||(c?"__default":""),n=b.useMemo(()=>{const l=u.map(d=>({value:d.id,groupKey:"models",searchText:`${d.name||d.id} ${d.id}`,keywords:[d.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:d.name||d.id}),d.provider&&e.jsx(M,{variant:"outline",className:"text-[9px] h-4 px-1 capitalize",children:d.provider})]}),itemContent:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate text-xs font-mono",children:d.name||d.id}),e.jsx(M,{variant:"outline",className:"text-[9px] h-4 px-1 capitalize",children:d.provider})]})}));return c?[{value:"__default",groupKey:"models",searchText:g("cursorPage.useDefaultModel"),triggerContent:e.jsx("span",{className:"truncate font-mono text-xs",children:g("cursorPage.useDefaultModel")}),itemContent:e.jsx("span",{children:g("cursorPage.useDefaultModel")})},...l]:l},[c,u,g]);return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{children:[e.jsx(L,{className:"text-xs font-medium",children:s}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:t})]}),e.jsx(ks,{value:p||void 0,onChange:l=>{if(c&&l==="__default"){f("");return}f(l)},disabled:x,placeholder:g("cursorPage.selectModel"),searchPlaceholder:g("searchableSelect.searchModels"),emptyText:g("searchableSelect.noResults"),triggerClassName:"h-9",groups:[{key:"models",label:g("cursorPage.availableModelCount",{count:u.length})}],options:n})]})}function pe({icon:s,label:t,ok:r,detail:u}){return e.jsxs("div",{className:"flex items-center gap-3 rounded-lg bg-muted/50 px-3 py-2",children:[e.jsx(s,{className:"h-4 w-4 text-muted-foreground shrink-0"}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("p",{className:"text-sm",children:t})}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[r?e.jsx(Ls,{className:"h-4 w-4 text-green-500"}):e.jsx(Is,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:V("text-xs",r?"text-green-500":"text-muted-foreground"),title:u,children:u})]})]})}function da(){const{t:s}=Oe(),t=gs(),{status:r,statusLoading:u,refetchStatus:x,config:c,refetchConfig:f,updateConfigAsync:g,isUpdatingConfig:p,models:n,modelsLoading:l,currentModel:d,rawSettings:m,rawSettingsLoading:je,refetchRawSettings:ze,saveRawSettingsAsync:Ke,isSavingRawSettings:Pe,autoDetectAuthAsync:qe,isAutoDetectingAuth:be,importManualAuthAsync:Ge,isImportingManualAuth:ye,startDaemonAsync:Qe,isStartingDaemon:Ue,stopDaemonAsync:Be,isStoppingDaemon:Ne,runProbeAsync:Je,isRunningProbe:W,probeResult:X,resetProbe:$e}=Ws(),[T,Z]=b.useState(()=>$()),[v,Y]=b.useState(!1),[ve,He]=b.useState("{}"),[I,ee]=b.useState(!1),[Ve,K]=b.useState(!1),[se,we]=b.useState(""),[ae,Ce]=b.useState(""),[Se,ke]=b.useState(()=>X?he(r,c):null),_=$(c),_e=v?T.port:_.port,te=v?T.auto_start:_.auto_start,re=v?T.ghost_mode:_.ghost_mode,w=v?T.model:_.model,ne=v?T.opus_model:_.opus_model,oe=v?T.sonnet_model:_.sonnet_model,ie=v?T.haiku_model:_.haiku_model,ce=I?ve:JSON.stringify(m?.settings??{},null,2),Ae=!!m,O=b.useMemo(()=>Xs(ce),[ce]),De=O.isValid,q=v||I,We=!I||Ae&&De,Xe=he(r,c),P=X&&!q&&Se!==null&&Se===Xe?X:null,G=b.useMemo(()=>{const a=new Set,o=[...n].sort((D,de)=>D.name.localeCompare(de.name)),j=o.filter(D=>a.has(D.id)?!1:(a.add(D.id),!0));return w&&!o.some(D=>D.id===w)?[{id:w,name:w,provider:"custom"},...j]:j},[n,w]),C=a=>{Z(o=>a(v?o:_)),Y(!0)},A=()=>{$e(),ke(null)},Ze=(a=c)=>{Z($(a)),Y(!1)},Ye=!!(r?.enabled&&r?.authenticated&&!r?.token_expired),es=b.useMemo(()=>r?.enabled?e.jsx(M,{children:s("cursorPage.enabled")}):e.jsx(M,{variant:"secondary",children:s("cursorPage.disabled")}),[r?.enabled,s]),ss=async({suppressSuccessToast:a=!1}={})=>{const o=Number(_e);if(!Number.isInteger(o)||o<1||o>65535)return i.error(s("cursorPage.invalidPort")),!1;if(!w.trim())return i.error(s("cursorPage.defaultModelRequired")),!1;try{return await g({port:o,auto_start:te,ghost_mode:re,model:w,opus_model:ne||void 0,sonnet_model:oe||void 0,haiku_model:ie||void 0}),Y(!1),Z($({port:o,auto_start:te,ghost_mode:re,model:w,opus_model:ne||void 0,sonnet_model:oe||void 0,haiku_model:ie||void 0})),A(),a||i.success(s("cursorPage.savedConfig")),!0}catch(j){return i.error(j.message||s("cursorPage.failedSaveConfig")),!1}},le=a=>{if(l){i.error(s("cursorPage.modelsLoadingWait"));return}if(n.length===0){i.error(s("cursorPage.noModelsAvailable"));return}const o=w||d||n[0]?.id||"gpt-5.3-codex",j=k(n,["gpt-5.3-codex","gpt53codex","GPT-5.3 Codex"],S(n,[/gpt[-.]?5.*codex/i],o)),D=k(n,["gpt-5.1-codex-max","gpt51codexmax","GPT-5.1 Codex Max"],S(n,[/gpt[-.]?5.*codex.*max/i],j)),de=k(n,["gpt-5-fast","gpt5fast","GPT-5 Fast"],S(n,[/gpt[-.]?5.*fast/i],j)),ds=k(n,["gpt-5-mini","gpt5mini","GPT-5 Mini"],S(n,[/gpt[-.]?5.*mini/i],de)),Te=k(n,["claude-4.6-opus","claude46opus","Claude 4.6 Opus"],S(n,[/claude[-.]?4\.?6.*opus/i,/claude.*opus/i],j)),Re=k(n,["claude-4.5-sonnet","claude45sonnet","Claude 4.5 Sonnet"],S(n,[/claude[-.]?4\.?5.*sonnet/i,/claude.*sonnet/i],j)),us=k(n,["claude-4.5-haiku","claude45haiku","Claude 4.5 Haiku"],S(n,[/claude[-.]?4\.?5.*haiku/i,/haiku/i],Re)),Q=k(n,["gemini-3-pro","gemini3pro","Gemini 3 Pro"],S(n,[/gemini[-.]?3.*pro/i],j)),ms=k(n,["gemini-3-flash","gemini3flash","Gemini 3 Flash"],S(n,[/gemini[-.]?3.*flash/i,/gemini[-.]?2\.?5.*flash/i],Q));if(a==="codex53"){C(E=>({...E,model:j,opus_model:D,sonnet_model:j,haiku_model:ds})),i.success(s("cursorPage.appliedCodexPreset"));return}if(a==="claude46"){C(E=>({...E,model:Te,opus_model:Te,sonnet_model:Re,haiku_model:us})),i.success(s("cursorPage.appliedClaudePreset"));return}C(E=>({...E,model:Q,opus_model:Q,sonnet_model:Q,haiku_model:ms})),i.success(s("cursorPage.appliedGeminiPreset"))},Me=async a=>{try{await g({enabled:a}),A(),i.success(s(a?"cursorPage.integrationEnabled":"cursorPage.integrationDisabled"))}catch(o){i.error(o.message||s("cursorPage.failedUpdateIntegration"))}},as=async()=>{try{await qe(),A(),i.success(s("cursorPage.credentialsImported"))}catch(a){i.error(a.message||s("cursorPage.autoDetectFailed"))}},ts=async()=>{if(!se.trim()||!ae.trim()){i.error(s("cursorPage.manualRequired"));return}try{await Ge({accessToken:se.trim(),machineId:ae.trim()}),A(),i.success(s("cursorPage.credentialsImported")),K(!1),we(""),Ce("")}catch(a){i.error(a.message||s("cursorPage.manualImportFailed"))}},rs=async()=>{try{const a=await Qe();if(!a.success){i.error(a.error||s("cursorPage.failedStartDaemon"));return}A(),i.success(a.pid?s("cursorPage.daemonStartedWithPid",{pid:a.pid}):s("cursorPage.daemonStarted"))}catch(a){i.error(a.message||s("cursorPage.failedStartDaemon"))}},ns=async()=>{try{const a=await Be();if(!a.success){i.error(a.error||s("cursorPage.failedStopDaemon"));return}A(),i.success(s("cursorPage.daemonStopped"))}catch(a){i.error(a.message||s("cursorPage.failedStopDaemon"))}},os=async()=>{if(q){i.error(s("cursorPage.probeSaveFirst"));return}try{const a=await Je(),o=await x();if(ke(he(o.data??r,c)),a.ok){i.success(s("cursorPage.probeSucceeded"));return}i.error(a.message||s("cursorPage.probeFailed"))}catch(a){i.error(a.message||s("cursorPage.probeFailed"))}},is=async({suppressSuccessToast:a=!1}={})=>{if(!Ae)return i.error(s("cursorPage.rawLoading")),!1;if(!O.isValid||!O.settings)return i.error(O.error||s("cursorPage.invalidJson")),!1;try{return await Ke({settings:O.settings,expectedMtime:m?.mtime}),ee(!1),A(),a||i.success(s("cursorPage.rawSaved")),!0}catch(o){return ws(o)?i.error(s("cursorPage.rawChanged")):i.error(o.message||s("cursorPage.failedSaveRaw")),!1}},cs=async()=>{if(!q)return;const a=v,o=I;a&&!await ss({suppressSuccessToast:o})||o&&!await is({suppressSuccessToast:a})||a&&o&&i.success(s("cursorPage.savedAll"))},ls=async()=>{ee(!1),A();const[,a]=await Promise.all([x(),f(),ze()]);Ze(a.data??c)};return e.jsxs(e.Fragment,{children:[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 shrink-0",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("img",{src:"/assets/sidebar/cursor.svg",alt:"",className:"w-5 h-5 object-contain shrink-0"}),e.jsx("h1",{className:"font-semibold",children:s("cursorPage.title")}),e.jsx(M,{variant:"outline",className:"h-5 border-red-500/50 bg-red-500/10 px-1.5 text-[10px] font-semibold uppercase tracking-wide text-red-700 dark:text-red-300",children:s("cursorPage.deprecated")}),es]}),e.jsx(h,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>x(),disabled:u,"aria-label":s("cursorPage.refreshStatus"),title:s("cursorPage.refreshStatus"),children:e.jsx(Le,{className:V("w-4 h-4",u&&"animate-spin")})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("cursorPage.subtitle")})]}),e.jsx(U,{className:"flex-1",children:e.jsxs("div",{className:"p-3 space-y-4",children:[e.jsxs("div",{className:"rounded-md border border-yellow-500/50 bg-yellow-500/15 p-3 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_s,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-400 shrink-0"}),e.jsx("span",{className:"text-xs font-semibold text-yellow-800 dark:text-yellow-200",children:s("cursorPage.unofficialTitle")})]}),e.jsxs("ul",{className:"text-[11px] text-yellow-700 dark:text-yellow-300 space-y-0.5 pl-6 list-disc",children:[e.jsx("li",{children:s("cursorPage.unofficialItem1")}),e.jsx("li",{children:s("cursorPage.unofficialItem2")}),e.jsx("li",{children:s("cursorPage.unofficialItem3")})]})]}),e.jsxs("div",{className:"rounded-md border border-border/70 bg-background/90 p-3 space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:s("cursorPage.supportedPathTitle")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("cursorPage.supportedPathDesc")})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(h,{size:"sm",className:"w-full",onClick:()=>t("/cliproxy?provider=cursor&action=auth"),children:[e.jsx(z,{className:"w-3.5 h-3.5 mr-1.5"}),s("cursorPage.startCliproxyAuth")]}),e.jsxs(h,{variant:"outline",size:"sm",className:"w-full",onClick:()=>t("/cliproxy?provider=cursor"),children:[e.jsx(J,{className:"w-3.5 h-3.5 mr-1.5"}),s("cursorPage.openCliproxyCursor")]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(pe,{icon:As,label:s("cursorPage.integration"),ok:!!r?.enabled,detail:r?.enabled?s("cursorPage.enabled"):s("cursorPage.disabled")}),e.jsx(pe,{icon:z,label:s("cursorPage.authentication"),ok:!!(r?.authenticated&&!r?.token_expired),detail:r?.authenticated?r?.token_expired?s("cursorPage.expired"):r.auth_method??s("cursorPage.connected"):s("cursorPage.notConnected")}),e.jsx(pe,{icon:Ds,label:s("cursorPage.daemon"),ok:!!r?.daemon_running,detail:r?.daemon_running?s("cursorPage.running"):s("cursorPage.stopped")})]}),e.jsxs("div",{className:"rounded-md border bg-background/80 p-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(xe,{className:"h-4 w-4 text-muted-foreground shrink-0"}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:s("cursorPage.liveProbe")})]}),e.jsx(M,{variant:P?"outline":"secondary",className:V(P?.ok&&"border-green-500/40 text-green-600 dark:text-green-300",P&&!P.ok&&"border-red-500/40 text-red-600 dark:text-red-300"),children:P?P.ok?s("cursorPage.probeSucceeded"):s("cursorPage.probeFailed"):s("cursorPage.probeNotRun")})]}),P?e.jsxs("div",{className:"space-y-1 text-xs",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{className:"text-muted-foreground",children:s("cursorPage.probeStage")}),e.jsx("span",{className:"font-mono uppercase",children:P.stage})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{className:"text-muted-foreground",children:s("cursorPage.probeHttpStatus")}),e.jsx("span",{className:"font-mono",children:P.status})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{className:"text-muted-foreground",children:s("cursorPage.probeDuration")}),e.jsxs("span",{className:"font-mono",children:[P.duration_ms," ms"]})]}),P.model?e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{className:"text-muted-foreground",children:s("cursorPage.probeModel")}),e.jsx("span",{className:"font-mono text-[11px] text-right break-all",children:P.model})]}):null,e.jsxs("div",{className:"space-y-1 pt-1",children:[e.jsx("span",{className:"text-muted-foreground",children:s("cursorPage.probeMessage")}),e.jsx("p",{className:"text-[11px] leading-relaxed break-words",children:P.message})]})]}):e.jsx("p",{className:"text-xs text-muted-foreground",children:s("cursorPage.probeNotRun")}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:s("cursorPage.probeLocalReadinessHint")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:s("cursorPage.actions")}),r?.enabled?e.jsxs(h,{variant:"outline",size:"sm",className:"w-full",onClick:()=>Me(!1),disabled:p,children:[e.jsx(Ie,{className:"w-3.5 h-3.5 mr-1.5"}),s("cursorPage.disableIntegration")]}):e.jsxs(h,{size:"sm",className:"w-full",onClick:()=>Me(!0),disabled:p,children:[e.jsx(Ms,{className:"w-3.5 h-3.5 mr-1.5"}),s("cursorPage.enableIntegration")]}),e.jsxs(h,{variant:"outline",size:"sm",className:"w-full",onClick:as,disabled:be,children:[be?e.jsx(F,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}):e.jsx(z,{className:"w-3.5 h-3.5 mr-1.5"}),s("cursorPage.autoDetectAuth")]}),e.jsxs(h,{variant:"outline",size:"sm",className:"w-full",onClick:()=>K(!0),children:[e.jsx(z,{className:"w-3.5 h-3.5 mr-1.5"}),s("cursorPage.manualAuthImport")]}),e.jsxs(h,{variant:"outline",size:"sm",className:"w-full",onClick:os,disabled:W,children:[W?e.jsx(F,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}):e.jsx(xe,{className:"w-3.5 h-3.5 mr-1.5"}),s(W?"cursorPage.probing":P?"cursorPage.rerunLiveProbe":"cursorPage.runLiveProbe")]}),r?.daemon_running?e.jsxs(h,{variant:"outline",size:"sm",className:"w-full",onClick:ns,disabled:Ne,children:[Ne?e.jsx(F,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}):e.jsx(Ie,{className:"w-3.5 h-3.5 mr-1.5"}),s("cursorPage.stopDaemon")]}):e.jsxs(h,{size:"sm",className:"w-full",onClick:rs,disabled:!Ye,children:[Ue?e.jsx(F,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}):e.jsx(Ts,{className:"w-3.5 h-3.5 mr-1.5"}),s("cursorPage.startDaemon")]})]})]})}),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:s("cursorPage.port")}),e.jsx("span",{children:r?.port??c?.port??Ee})]})})]}),e.jsx("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-hidden",children:e.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-4 border-b bg-background flex items-center justify-between shrink-0",children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold",children:s("cursorPage.configuration")}),m&&e.jsx(M,{variant:"outline",className:"text-xs",children:"cursor.settings.json"})]}),m&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[s("cursorPage.lastModified")," ",m.exists?new Date(m.mtime).toLocaleString():s("cursorPage.neverSaved")]})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{variant:"ghost",size:"sm",onClick:ls,disabled:u||je,"aria-label":s("cursorPage.refreshConfiguration"),title:s("cursorPage.refreshConfiguration"),children:e.jsx(Le,{className:V("w-4 h-4",(u||je)&&"animate-spin")})}),e.jsx(h,{size:"sm",onClick:cs,disabled:p||Pe||!q||!We,children:p||Pe?e.jsxs(e.Fragment,{children:[e.jsx(F,{className:"w-4 h-4 mr-1 animate-spin"}),s("cursorPage.saving")]}):e.jsxs(e.Fragment,{children:[e.jsx(Rs,{className:"w-4 h-4 mr-1"}),s("cursorPage.save")]})})]})]}),e.jsxs("div",{className:"flex-1 min-h-0 flex divide-x overflow-hidden",children:[e.jsx("div",{className:"w-[540px] shrink-0 flex flex-col min-h-0 overflow-hidden bg-muted/5",children:e.jsxs(hs,{defaultValue:"config",className:"h-full flex flex-col",children:[e.jsx("div",{className:"px-4 pt-4 shrink-0",children:e.jsxs(fs,{className:"w-full",children:[e.jsx(ue,{value:"config",className:"flex-1",children:s("cursorPage.modelConfig")}),e.jsx(ue,{value:"settings",className:"flex-1",children:s("cursorPage.settings")}),e.jsx(ue,{value:"info",className:"flex-1",children:s("cursorPage.info")})]})}),e.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden flex flex-col",children:[e.jsx(me,{value:"config",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(U,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[e.jsx(Fs,{className:"w-4 h-4"}),s("cursorPage.presets")]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:s("cursorPage.presetsDesc")}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(h,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>le("codex53"),disabled:l||n.length===0,title:"OpenAI-only mapping: GPT-5.3 Codex / Codex Max / GPT-5 Mini",children:[e.jsx(J,{className:"w-3 h-3"}),"GPT-5.3 Codex"]}),e.jsxs(h,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>le("claude46"),disabled:l||n.length===0,title:"Claude-first mapping: Opus 4.6 / Sonnet 4.5 / Haiku 4.5",children:[e.jsx(J,{className:"w-3 h-3"}),"Claude 4.6"]}),e.jsxs(h,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>le("gemini3"),disabled:l||n.length===0,title:"Gemini-first mapping: Gemini 3 Pro + Gemini 3 Flash",children:[e.jsx(J,{className:"w-3 h-3"}),"Gemini 3 Pro"]})]})]}),e.jsx(Ss,{}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-2",children:s("cursorPage.modelMapping")}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:s("cursorPage.modelMappingDesc")}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(H,{label:s("cursorPage.defaultModel"),description:s("cursorPage.defaultModelDesc"),value:w,models:G,disabled:l,onChange:a=>{C(o=>({...o,model:a}))}}),e.jsx(H,{label:s("cursorPage.opusModel"),description:s("cursorPage.opusModelDesc"),value:ne,models:G,disabled:l,allowDefaultFallback:!0,onChange:a=>{C(o=>({...o,opus_model:a}))}}),e.jsx(H,{label:s("cursorPage.sonnetModel"),description:s("cursorPage.sonnetModelDesc"),value:oe,models:G,disabled:l,allowDefaultFallback:!0,onChange:a=>{C(o=>({...o,sonnet_model:a}))}}),e.jsx(H,{label:s("cursorPage.haikuModel"),description:s("cursorPage.haikuModelDesc"),value:ie,models:G,disabled:l,allowDefaultFallback:!0,onChange:a=>{C(o=>({...o,haiku_model:a}))}})]})]})]})})}),e.jsx(me,{value:"settings",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(U,{className:"flex-1",children:e.jsx("div",{className:"p-4 space-y-6",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:s("cursorPage.runtimeSettings")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L,{htmlFor:"cursor-port",className:"text-xs",children:s("cursorPage.port")}),e.jsx(ge,{id:"cursor-port",type:"number",min:1,max:65535,className:"max-w-[150px] h-8",value:_e,onChange:a=>{C(o=>({...o,port:a.target.value}))}})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(L,{htmlFor:"cursor-auto-start",className:"text-xs",children:s("cursorPage.autoStartDaemon")}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:s("cursorPage.autoStartDesc")})]}),e.jsx(Fe,{id:"cursor-auto-start",checked:te,onCheckedChange:a=>{C(o=>({...o,auto_start:a}))}})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(L,{htmlFor:"cursor-ghost-mode",className:"text-xs",children:s("cursorPage.ghostMode")}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:s("cursorPage.ghostModeDesc")})]}),e.jsx(Fe,{id:"cursor-ghost-mode",checked:re,onCheckedChange:a=>{C(o=>({...o,ghost_mode:a}))}})]})]})})})}),e.jsx(me,{value:"info",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(U,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[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:s("cursorPage.provider")}),e.jsx("span",{className:"font-mono",children:"Cursor IDE (Legacy)"})]}),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:s("cursorPage.filePath")}),e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs break-all",children:m?.path??"~/.ccs/cursor.settings.json"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Legacy bridge model mapping writes `ANTHROPIC_MODEL`, `ANTHROPIC_DEFAULT_OPUS_MODEL`, `ANTHROPIC_DEFAULT_SONNET_MODEL`, and `ANTHROPIC_DEFAULT_HAIKU_MODEL` in `cursor.settings.json`."})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-3",children:s("cursorPage.availableModels")}),l?e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(F,{className:"w-4 h-4 animate-spin"}),s("cursorPage.loadingModels")]}):n.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:s("cursorPage.noModels")}):e.jsx("div",{className:"space-y-2",children:n.map(a=>e.jsxs("div",{className:"rounded-lg border px-3 py-2 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:a.id}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[a.name," • ",a.provider]})]}),a.id===d&&e.jsx(M,{children:s("cursorPage.default")})]},a.id))})]})]})})})]})]})}),e.jsxs("div",{className:"flex-1 min-w-0 flex 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(xe,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:s("cursorPage.rawConfiguration")})]}),e.jsx(ps,{rawJsonContent:ce,isRawJsonValid:De,rawJsonEdits:I?ve:null,rawSettingsEnv:m?.settings?.env,onChange:a=>{ee(!0),He(a)}})]})]})]})})]}),e.jsx(js,{open:Ve,onOpenChange:K,children:e.jsxs(Ps,{children:[e.jsxs(bs,{children:[e.jsx(ys,{children:s("cursorPage.manualImportTitle")}),e.jsx(Ns,{children:s("cursorPage.manualImportDesc")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(L,{htmlFor:"cursor-manual-token",children:s("cursorPage.accessToken")}),e.jsx(ge,{id:"cursor-manual-token",value:se,onChange:a=>we(a.target.value),placeholder:s("cursorPage.accessTokenPlaceholder")})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(L,{htmlFor:"cursor-manual-machine-id",children:s("cursorPage.machineId")}),e.jsx(ge,{id:"cursor-manual-machine-id",value:ae,onChange:a=>Ce(a.target.value),placeholder:s("cursorPage.machineIdPlaceholder")})]})]}),e.jsxs(vs,{children:[e.jsx(h,{variant:"outline",onClick:()=>K(!1),children:s("cursorPage.cancel")}),e.jsxs(h,{onClick:ts,disabled:ye,children:[ye?e.jsx(F,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(z,{className:"w-4 h-4 mr-2"}),s("cursorPage.import")]})]})]})})]})}export{da as CursorPage};
|
|
1
|
+
import{j as e}from"./radix-ui-nu4wz29m.js";import{r as b,e as gs}from"./react-vendor-Bjx91N7w.js";import{t as i}from"./notifications-B4_o8bcr.js";import{bf as y,bg as xs,a as Oe,B as M,d as h,c as V,n as U,Q as hs,R as fs,U as ue,V as me,L,I as ge,aI as Fe,bl as ps,ah as js,ai as Ps,aj as bs,ak as ys,al as Ns,aD as vs,bh as ws}from"./index-BRtgic66.js";import{a as Cs,u as B,b as R}from"./tanstack-bhJxV1h8.js";import{D as Ee}from"./default-ports-1QQSffYX.js";import{S as Ss}from"./separator-Do_vqTQD.js";import{S as ks}from"./searchable-select-CWL2D5Ft.js";import{R as Le,T as _s,K as z,Z as J,ai as As,ae as Ds,ax as xe,aQ as Ie,aP as Ms,L as F,J as Ts,au as Rs,aa as Fs,x as Ls,I as Is}from"./icons-DQFHtVq5.js";import"./utils-CzKF5WmX.js";import"./form-utils-CuHzLhJZ.js";import"./code-highlight-D4E79GKQ.js";const N="/legacy/cursor";function Os(s){if(!s||typeof s!="object")return!1;const t=s;return typeof t.message=="string"&&typeof t.stage=="string"&&typeof t.status=="number"&&typeof t.duration_ms=="number"&&typeof t.ok=="boolean"}function Es(s){if(!s||typeof s!="object"||!("error"in s))return null;const t=s;return typeof t.error=="string"?t.error:null}async function zs(){const s=await fetch(y(`${N}/status`));if(!s.ok)throw new Error("Failed to fetch cursor status");return s.json()}async function Ks(){const s=await fetch(y(`${N}/settings`));if(!s.ok)throw new Error("Failed to fetch cursor config");return s.json()}async function qs(){const s=await fetch(y(`${N}/models`));if(!s.ok)throw new Error("Failed to fetch cursor models");return s.json()}async function Gs(){const s=await fetch(y(`${N}/settings/raw`));if(!s.ok)throw new Error("Failed to fetch cursor raw settings");return s.json()}async function Qs(s){const t=await fetch(y(`${N}/settings`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!t.ok)throw new Error("Failed to update cursor config");return t.json()}async function Us(s){const t=await fetch(y(`${N}/settings/raw`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(t.status===409)throw new xs("Cursor raw settings changed externally");if(!t.ok)throw new Error("Failed to save cursor raw settings");return t.json()}async function Bs(){const s=await fetch(y(`${N}/auth/auto-detect`),{method:"POST"});if(!s.ok){const t=await s.json().catch(()=>({error:"Auto-detect failed"}));throw new Error(t.error||"Auto-detect failed")}return s.json()}async function Js(s){const t=await fetch(y(`${N}/auth/import`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!t.ok){const r=await t.json().catch(()=>({error:"Manual import failed"}));throw new Error(r.error||"Manual import failed")}return t.json()}async function $s(){const s=await fetch(y(`${N}/daemon/start`),{method:"POST"});if(!s.ok)throw new Error("Failed to start cursor daemon");return s.json()}async function Hs(){const s=await fetch(y(`${N}/daemon/stop`),{method:"POST"});if(!s.ok)throw new Error("Failed to stop cursor daemon");return s.json()}async function Vs(){const s=await fetch(y(`${N}/probe`),{method:"POST"}),t=await s.json().catch(()=>null);return Os(t)?t:{ok:!1,stage:"runtime",status:s.status,duration_ms:0,error_type:"runtime_error",message:Es(t)??"Failed to run live probe"}}function Ws(){const s=Cs(),t=B({queryKey:["cursor-status"],queryFn:zs,refetchInterval:5e3}),r=B({queryKey:["cursor-config"],queryFn:Ks}),u=B({queryKey:["cursor-models"],queryFn:qs}),x=B({queryKey:["cursor-raw-settings"],queryFn:Gs}),c=()=>{s.invalidateQueries({queryKey:["cursor-status"]}),s.invalidateQueries({queryKey:["cursor-config"]}),s.invalidateQueries({queryKey:["cursor-models"]}),s.invalidateQueries({queryKey:["cursor-raw-settings"]})},f=R({mutationFn:Qs,onSuccess:c}),g=R({mutationFn:Us,onSuccess:c}),p=R({mutationFn:Bs,onSuccess:c}),n=R({mutationFn:Js,onSuccess:c}),l=R({mutationFn:$s,onSuccess:c}),d=R({mutationFn:Hs,onSuccess:c}),m=R({mutationFn:Vs,onSettled:()=>{s.invalidateQueries({queryKey:["cursor-status"]}),s.invalidateQueries({queryKey:["cursor-models"]})}});return b.useMemo(()=>({status:t.data,statusLoading:t.isLoading,statusError:t.error,refetchStatus:t.refetch,config:r.data,configLoading:r.isLoading,refetchConfig:r.refetch,models:u.data?.models??[],currentModel:u.data?.current??null,modelsLoading:u.isLoading,rawSettings:x.data,rawSettingsLoading:x.isLoading,refetchRawSettings:x.refetch,updateConfig:f.mutate,updateConfigAsync:f.mutateAsync,isUpdatingConfig:f.isPending,saveRawSettings:g.mutate,saveRawSettingsAsync:g.mutateAsync,isSavingRawSettings:g.isPending,autoDetectAuth:p.mutate,autoDetectAuthAsync:p.mutateAsync,isAutoDetectingAuth:p.isPending,autoDetectAuthResult:p.data,importManualAuth:n.mutate,importManualAuthAsync:n.mutateAsync,isImportingManualAuth:n.isPending,manualAuthResult:n.data,startDaemon:l.mutate,startDaemonAsync:l.mutateAsync,isStartingDaemon:l.isPending,stopDaemon:d.mutate,stopDaemonAsync:d.mutateAsync,isStoppingDaemon:d.isPending,runProbe:m.mutate,runProbeAsync:m.mutateAsync,isRunningProbe:m.isPending,probeResult:m.data,resetProbe:m.reset}),[t.data,t.isLoading,t.error,t.refetch,r.data,r.isLoading,r.refetch,u.data,u.isLoading,x.data,x.isLoading,x.refetch,f.mutate,f.mutateAsync,f.isPending,g.mutate,g.mutateAsync,g.isPending,p.mutate,p.mutateAsync,p.isPending,p.data,n.mutate,n.mutateAsync,n.isPending,n.data,l.mutate,l.mutateAsync,l.isPending,d.mutate,d.mutateAsync,d.isPending,m.mutate,m.mutateAsync,m.isPending,m.data,m.reset])}function he(s,t){return JSON.stringify({enabled:s?.enabled??null,authenticated:s?.authenticated??null,token_expired:s?.token_expired??null,daemon_running:s?.daemon_running??null,port:s?.port??null,ghost_mode:s?.ghost_mode??null,auto_start:t?.auto_start??null,model:t?.model??null})}function $(s){return{port:String(s?.port??Ee),auto_start:s?.auto_start??!1,ghost_mode:s?.ghost_mode??!0,model:s?.model?.trim()||"gpt-5.3-codex",opus_model:s?.opus_model?.trim()||"",sonnet_model:s?.sonnet_model?.trim()||"",haiku_model:s?.haiku_model?.trim()||""}}function S(s,t,r){return s.find(x=>t.some(c=>c.test(x.id)))?.id??r}function fe(s){return s.toLowerCase().replace(/[^a-z0-9]/g,"")}function k(s,t,r){const u=new Set(t.map(fe)),x=s.find(f=>u.has(fe(f.id)));if(x)return x.id;const c=s.find(f=>u.has(fe(f.name)));return c?c.id:r}function Xs(s){try{const t=JSON.parse(s||"{}");return!t||typeof t!="object"||Array.isArray(t)?{isValid:!1,error:"Raw settings must be a JSON object"}:{isValid:!0,settings:t}}catch(t){return{isValid:!1,error:t.message||"Invalid JSON"}}}function H({label:s,description:t,value:r,models:u,disabled:x,allowDefaultFallback:c=!1,onChange:f}){const{t:g}=Oe(),p=r||(c?"__default":""),n=b.useMemo(()=>{const l=u.map(d=>({value:d.id,groupKey:"models",searchText:`${d.name||d.id} ${d.id}`,keywords:[d.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:d.name||d.id}),d.provider&&e.jsx(M,{variant:"outline",className:"text-[9px] h-4 px-1 capitalize",children:d.provider})]}),itemContent:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate text-xs font-mono",children:d.name||d.id}),e.jsx(M,{variant:"outline",className:"text-[9px] h-4 px-1 capitalize",children:d.provider})]})}));return c?[{value:"__default",groupKey:"models",searchText:g("cursorPage.useDefaultModel"),triggerContent:e.jsx("span",{className:"truncate font-mono text-xs",children:g("cursorPage.useDefaultModel")}),itemContent:e.jsx("span",{children:g("cursorPage.useDefaultModel")})},...l]:l},[c,u,g]);return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{children:[e.jsx(L,{className:"text-xs font-medium",children:s}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:t})]}),e.jsx(ks,{value:p||void 0,onChange:l=>{if(c&&l==="__default"){f("");return}f(l)},disabled:x,placeholder:g("cursorPage.selectModel"),searchPlaceholder:g("searchableSelect.searchModels"),emptyText:g("searchableSelect.noResults"),triggerClassName:"h-9",groups:[{key:"models",label:g("cursorPage.availableModelCount",{count:u.length})}],options:n})]})}function pe({icon:s,label:t,ok:r,detail:u}){return e.jsxs("div",{className:"flex items-center gap-3 rounded-lg bg-muted/50 px-3 py-2",children:[e.jsx(s,{className:"h-4 w-4 text-muted-foreground shrink-0"}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("p",{className:"text-sm",children:t})}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[r?e.jsx(Ls,{className:"h-4 w-4 text-green-500"}):e.jsx(Is,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:V("text-xs",r?"text-green-500":"text-muted-foreground"),title:u,children:u})]})]})}function da(){const{t:s}=Oe(),t=gs(),{status:r,statusLoading:u,refetchStatus:x,config:c,refetchConfig:f,updateConfigAsync:g,isUpdatingConfig:p,models:n,modelsLoading:l,currentModel:d,rawSettings:m,rawSettingsLoading:je,refetchRawSettings:ze,saveRawSettingsAsync:Ke,isSavingRawSettings:Pe,autoDetectAuthAsync:qe,isAutoDetectingAuth:be,importManualAuthAsync:Ge,isImportingManualAuth:ye,startDaemonAsync:Qe,isStartingDaemon:Ue,stopDaemonAsync:Be,isStoppingDaemon:Ne,runProbeAsync:Je,isRunningProbe:W,probeResult:X,resetProbe:$e}=Ws(),[T,Z]=b.useState(()=>$()),[v,Y]=b.useState(!1),[ve,He]=b.useState("{}"),[I,ee]=b.useState(!1),[Ve,K]=b.useState(!1),[se,we]=b.useState(""),[ae,Ce]=b.useState(""),[Se,ke]=b.useState(()=>X?he(r,c):null),_=$(c),_e=v?T.port:_.port,te=v?T.auto_start:_.auto_start,re=v?T.ghost_mode:_.ghost_mode,w=v?T.model:_.model,ne=v?T.opus_model:_.opus_model,oe=v?T.sonnet_model:_.sonnet_model,ie=v?T.haiku_model:_.haiku_model,ce=I?ve:JSON.stringify(m?.settings??{},null,2),Ae=!!m,O=b.useMemo(()=>Xs(ce),[ce]),De=O.isValid,q=v||I,We=!I||Ae&&De,Xe=he(r,c),P=X&&!q&&Se!==null&&Se===Xe?X:null,G=b.useMemo(()=>{const a=new Set,o=[...n].sort((D,de)=>D.name.localeCompare(de.name)),j=o.filter(D=>a.has(D.id)?!1:(a.add(D.id),!0));return w&&!o.some(D=>D.id===w)?[{id:w,name:w,provider:"custom"},...j]:j},[n,w]),C=a=>{Z(o=>a(v?o:_)),Y(!0)},A=()=>{$e(),ke(null)},Ze=(a=c)=>{Z($(a)),Y(!1)},Ye=!!(r?.enabled&&r?.authenticated&&!r?.token_expired),es=b.useMemo(()=>r?.enabled?e.jsx(M,{children:s("cursorPage.enabled")}):e.jsx(M,{variant:"secondary",children:s("cursorPage.disabled")}),[r?.enabled,s]),ss=async({suppressSuccessToast:a=!1}={})=>{const o=Number(_e);if(!Number.isInteger(o)||o<1||o>65535)return i.error(s("cursorPage.invalidPort")),!1;if(!w.trim())return i.error(s("cursorPage.defaultModelRequired")),!1;try{return await g({port:o,auto_start:te,ghost_mode:re,model:w,opus_model:ne||void 0,sonnet_model:oe||void 0,haiku_model:ie||void 0}),Y(!1),Z($({port:o,auto_start:te,ghost_mode:re,model:w,opus_model:ne||void 0,sonnet_model:oe||void 0,haiku_model:ie||void 0})),A(),a||i.success(s("cursorPage.savedConfig")),!0}catch(j){return i.error(j.message||s("cursorPage.failedSaveConfig")),!1}},le=a=>{if(l){i.error(s("cursorPage.modelsLoadingWait"));return}if(n.length===0){i.error(s("cursorPage.noModelsAvailable"));return}const o=w||d||n[0]?.id||"gpt-5.3-codex",j=k(n,["gpt-5.3-codex","gpt53codex","GPT-5.3 Codex"],S(n,[/gpt[-.]?5.*codex/i],o)),D=k(n,["gpt-5.1-codex-max","gpt51codexmax","GPT-5.1 Codex Max"],S(n,[/gpt[-.]?5.*codex.*max/i],j)),de=k(n,["gpt-5-fast","gpt5fast","GPT-5 Fast"],S(n,[/gpt[-.]?5.*fast/i],j)),ds=k(n,["gpt-5-mini","gpt5mini","GPT-5 Mini"],S(n,[/gpt[-.]?5.*mini/i],de)),Te=k(n,["claude-4.6-opus","claude46opus","Claude 4.6 Opus"],S(n,[/claude[-.]?4\.?6.*opus/i,/claude.*opus/i],j)),Re=k(n,["claude-4.5-sonnet","claude45sonnet","Claude 4.5 Sonnet"],S(n,[/claude[-.]?4\.?5.*sonnet/i,/claude.*sonnet/i],j)),us=k(n,["claude-4.5-haiku","claude45haiku","Claude 4.5 Haiku"],S(n,[/claude[-.]?4\.?5.*haiku/i,/haiku/i],Re)),Q=k(n,["gemini-3-pro","gemini3pro","Gemini 3 Pro"],S(n,[/gemini[-.]?3.*pro/i],j)),ms=k(n,["gemini-3-flash","gemini3flash","Gemini 3 Flash"],S(n,[/gemini[-.]?3.*flash/i,/gemini[-.]?2\.?5.*flash/i],Q));if(a==="codex53"){C(E=>({...E,model:j,opus_model:D,sonnet_model:j,haiku_model:ds})),i.success(s("cursorPage.appliedCodexPreset"));return}if(a==="claude46"){C(E=>({...E,model:Te,opus_model:Te,sonnet_model:Re,haiku_model:us})),i.success(s("cursorPage.appliedClaudePreset"));return}C(E=>({...E,model:Q,opus_model:Q,sonnet_model:Q,haiku_model:ms})),i.success(s("cursorPage.appliedGeminiPreset"))},Me=async a=>{try{await g({enabled:a}),A(),i.success(s(a?"cursorPage.integrationEnabled":"cursorPage.integrationDisabled"))}catch(o){i.error(o.message||s("cursorPage.failedUpdateIntegration"))}},as=async()=>{try{await qe(),A(),i.success(s("cursorPage.credentialsImported"))}catch(a){i.error(a.message||s("cursorPage.autoDetectFailed"))}},ts=async()=>{if(!se.trim()||!ae.trim()){i.error(s("cursorPage.manualRequired"));return}try{await Ge({accessToken:se.trim(),machineId:ae.trim()}),A(),i.success(s("cursorPage.credentialsImported")),K(!1),we(""),Ce("")}catch(a){i.error(a.message||s("cursorPage.manualImportFailed"))}},rs=async()=>{try{const a=await Qe();if(!a.success){i.error(a.error||s("cursorPage.failedStartDaemon"));return}A(),i.success(a.pid?s("cursorPage.daemonStartedWithPid",{pid:a.pid}):s("cursorPage.daemonStarted"))}catch(a){i.error(a.message||s("cursorPage.failedStartDaemon"))}},ns=async()=>{try{const a=await Be();if(!a.success){i.error(a.error||s("cursorPage.failedStopDaemon"));return}A(),i.success(s("cursorPage.daemonStopped"))}catch(a){i.error(a.message||s("cursorPage.failedStopDaemon"))}},os=async()=>{if(q){i.error(s("cursorPage.probeSaveFirst"));return}try{const a=await Je(),o=await x();if(ke(he(o.data??r,c)),a.ok){i.success(s("cursorPage.probeSucceeded"));return}i.error(a.message||s("cursorPage.probeFailed"))}catch(a){i.error(a.message||s("cursorPage.probeFailed"))}},is=async({suppressSuccessToast:a=!1}={})=>{if(!Ae)return i.error(s("cursorPage.rawLoading")),!1;if(!O.isValid||!O.settings)return i.error(O.error||s("cursorPage.invalidJson")),!1;try{return await Ke({settings:O.settings,expectedMtime:m?.mtime}),ee(!1),A(),a||i.success(s("cursorPage.rawSaved")),!0}catch(o){return ws(o)?i.error(s("cursorPage.rawChanged")):i.error(o.message||s("cursorPage.failedSaveRaw")),!1}},cs=async()=>{if(!q)return;const a=v,o=I;a&&!await ss({suppressSuccessToast:o})||o&&!await is({suppressSuccessToast:a})||a&&o&&i.success(s("cursorPage.savedAll"))},ls=async()=>{ee(!1),A();const[,a]=await Promise.all([x(),f(),ze()]);Ze(a.data??c)};return e.jsxs(e.Fragment,{children:[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 shrink-0",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("img",{src:"/assets/sidebar/cursor.svg",alt:"",className:"w-5 h-5 object-contain shrink-0"}),e.jsx("h1",{className:"font-semibold",children:s("cursorPage.title")}),e.jsx(M,{variant:"outline",className:"h-5 border-red-500/50 bg-red-500/10 px-1.5 text-[10px] font-semibold uppercase tracking-wide text-red-700 dark:text-red-300",children:s("cursorPage.deprecated")}),es]}),e.jsx(h,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>x(),disabled:u,"aria-label":s("cursorPage.refreshStatus"),title:s("cursorPage.refreshStatus"),children:e.jsx(Le,{className:V("w-4 h-4",u&&"animate-spin")})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("cursorPage.subtitle")})]}),e.jsx(U,{className:"flex-1",children:e.jsxs("div",{className:"p-3 space-y-4",children:[e.jsxs("div",{className:"rounded-md border border-yellow-500/50 bg-yellow-500/15 p-3 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_s,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-400 shrink-0"}),e.jsx("span",{className:"text-xs font-semibold text-yellow-800 dark:text-yellow-200",children:s("cursorPage.unofficialTitle")})]}),e.jsxs("ul",{className:"text-[11px] text-yellow-700 dark:text-yellow-300 space-y-0.5 pl-6 list-disc",children:[e.jsx("li",{children:s("cursorPage.unofficialItem1")}),e.jsx("li",{children:s("cursorPage.unofficialItem2")}),e.jsx("li",{children:s("cursorPage.unofficialItem3")})]})]}),e.jsxs("div",{className:"rounded-md border border-border/70 bg-background/90 p-3 space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:s("cursorPage.supportedPathTitle")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("cursorPage.supportedPathDesc")})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(h,{size:"sm",className:"w-full",onClick:()=>t("/cliproxy?provider=cursor&action=auth"),children:[e.jsx(z,{className:"w-3.5 h-3.5 mr-1.5"}),s("cursorPage.startCliproxyAuth")]}),e.jsxs(h,{variant:"outline",size:"sm",className:"w-full",onClick:()=>t("/cliproxy?provider=cursor"),children:[e.jsx(J,{className:"w-3.5 h-3.5 mr-1.5"}),s("cursorPage.openCliproxyCursor")]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(pe,{icon:As,label:s("cursorPage.integration"),ok:!!r?.enabled,detail:r?.enabled?s("cursorPage.enabled"):s("cursorPage.disabled")}),e.jsx(pe,{icon:z,label:s("cursorPage.authentication"),ok:!!(r?.authenticated&&!r?.token_expired),detail:r?.authenticated?r?.token_expired?s("cursorPage.expired"):r.auth_method??s("cursorPage.connected"):s("cursorPage.notConnected")}),e.jsx(pe,{icon:Ds,label:s("cursorPage.daemon"),ok:!!r?.daemon_running,detail:r?.daemon_running?s("cursorPage.running"):s("cursorPage.stopped")})]}),e.jsxs("div",{className:"rounded-md border bg-background/80 p-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(xe,{className:"h-4 w-4 text-muted-foreground shrink-0"}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:s("cursorPage.liveProbe")})]}),e.jsx(M,{variant:P?"outline":"secondary",className:V(P?.ok&&"border-green-500/40 text-green-600 dark:text-green-300",P&&!P.ok&&"border-red-500/40 text-red-600 dark:text-red-300"),children:P?P.ok?s("cursorPage.probeSucceeded"):s("cursorPage.probeFailed"):s("cursorPage.probeNotRun")})]}),P?e.jsxs("div",{className:"space-y-1 text-xs",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{className:"text-muted-foreground",children:s("cursorPage.probeStage")}),e.jsx("span",{className:"font-mono uppercase",children:P.stage})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{className:"text-muted-foreground",children:s("cursorPage.probeHttpStatus")}),e.jsx("span",{className:"font-mono",children:P.status})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{className:"text-muted-foreground",children:s("cursorPage.probeDuration")}),e.jsxs("span",{className:"font-mono",children:[P.duration_ms," ms"]})]}),P.model?e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{className:"text-muted-foreground",children:s("cursorPage.probeModel")}),e.jsx("span",{className:"font-mono text-[11px] text-right break-all",children:P.model})]}):null,e.jsxs("div",{className:"space-y-1 pt-1",children:[e.jsx("span",{className:"text-muted-foreground",children:s("cursorPage.probeMessage")}),e.jsx("p",{className:"text-[11px] leading-relaxed break-words",children:P.message})]})]}):e.jsx("p",{className:"text-xs text-muted-foreground",children:s("cursorPage.probeNotRun")}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:s("cursorPage.probeLocalReadinessHint")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:s("cursorPage.actions")}),r?.enabled?e.jsxs(h,{variant:"outline",size:"sm",className:"w-full",onClick:()=>Me(!1),disabled:p,children:[e.jsx(Ie,{className:"w-3.5 h-3.5 mr-1.5"}),s("cursorPage.disableIntegration")]}):e.jsxs(h,{size:"sm",className:"w-full",onClick:()=>Me(!0),disabled:p,children:[e.jsx(Ms,{className:"w-3.5 h-3.5 mr-1.5"}),s("cursorPage.enableIntegration")]}),e.jsxs(h,{variant:"outline",size:"sm",className:"w-full",onClick:as,disabled:be,children:[be?e.jsx(F,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}):e.jsx(z,{className:"w-3.5 h-3.5 mr-1.5"}),s("cursorPage.autoDetectAuth")]}),e.jsxs(h,{variant:"outline",size:"sm",className:"w-full",onClick:()=>K(!0),children:[e.jsx(z,{className:"w-3.5 h-3.5 mr-1.5"}),s("cursorPage.manualAuthImport")]}),e.jsxs(h,{variant:"outline",size:"sm",className:"w-full",onClick:os,disabled:W,children:[W?e.jsx(F,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}):e.jsx(xe,{className:"w-3.5 h-3.5 mr-1.5"}),s(W?"cursorPage.probing":P?"cursorPage.rerunLiveProbe":"cursorPage.runLiveProbe")]}),r?.daemon_running?e.jsxs(h,{variant:"outline",size:"sm",className:"w-full",onClick:ns,disabled:Ne,children:[Ne?e.jsx(F,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}):e.jsx(Ie,{className:"w-3.5 h-3.5 mr-1.5"}),s("cursorPage.stopDaemon")]}):e.jsxs(h,{size:"sm",className:"w-full",onClick:rs,disabled:!Ye,children:[Ue?e.jsx(F,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}):e.jsx(Ts,{className:"w-3.5 h-3.5 mr-1.5"}),s("cursorPage.startDaemon")]})]})]})}),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:s("cursorPage.port")}),e.jsx("span",{children:r?.port??c?.port??Ee})]})})]}),e.jsx("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-hidden",children:e.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-4 border-b bg-background flex items-center justify-between shrink-0",children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold",children:s("cursorPage.configuration")}),m&&e.jsx(M,{variant:"outline",className:"text-xs",children:"cursor.settings.json"})]}),m&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[s("cursorPage.lastModified")," ",m.exists?new Date(m.mtime).toLocaleString():s("cursorPage.neverSaved")]})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{variant:"ghost",size:"sm",onClick:ls,disabled:u||je,"aria-label":s("cursorPage.refreshConfiguration"),title:s("cursorPage.refreshConfiguration"),children:e.jsx(Le,{className:V("w-4 h-4",(u||je)&&"animate-spin")})}),e.jsx(h,{size:"sm",onClick:cs,disabled:p||Pe||!q||!We,children:p||Pe?e.jsxs(e.Fragment,{children:[e.jsx(F,{className:"w-4 h-4 mr-1 animate-spin"}),s("cursorPage.saving")]}):e.jsxs(e.Fragment,{children:[e.jsx(Rs,{className:"w-4 h-4 mr-1"}),s("cursorPage.save")]})})]})]}),e.jsxs("div",{className:"flex-1 min-h-0 flex divide-x overflow-hidden",children:[e.jsx("div",{className:"w-[540px] shrink-0 flex flex-col min-h-0 overflow-hidden bg-muted/5",children:e.jsxs(hs,{defaultValue:"config",className:"h-full flex flex-col",children:[e.jsx("div",{className:"px-4 pt-4 shrink-0",children:e.jsxs(fs,{className:"w-full",children:[e.jsx(ue,{value:"config",className:"flex-1",children:s("cursorPage.modelConfig")}),e.jsx(ue,{value:"settings",className:"flex-1",children:s("cursorPage.settings")}),e.jsx(ue,{value:"info",className:"flex-1",children:s("cursorPage.info")})]})}),e.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden flex flex-col",children:[e.jsx(me,{value:"config",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(U,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[e.jsx(Fs,{className:"w-4 h-4"}),s("cursorPage.presets")]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:s("cursorPage.presetsDesc")}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(h,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>le("codex53"),disabled:l||n.length===0,title:"OpenAI-only mapping: GPT-5.3 Codex / Codex Max / GPT-5 Mini",children:[e.jsx(J,{className:"w-3 h-3"}),"GPT-5.3 Codex"]}),e.jsxs(h,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>le("claude46"),disabled:l||n.length===0,title:"Claude-first mapping: Opus 4.6 / Sonnet 4.5 / Haiku 4.5",children:[e.jsx(J,{className:"w-3 h-3"}),"Claude 4.6"]}),e.jsxs(h,{variant:"outline",size:"sm",className:"text-xs h-7 gap-1",onClick:()=>le("gemini3"),disabled:l||n.length===0,title:"Gemini-first mapping: Gemini 3 Pro + Gemini 3 Flash",children:[e.jsx(J,{className:"w-3 h-3"}),"Gemini 3 Pro"]})]})]}),e.jsx(Ss,{}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-2",children:s("cursorPage.modelMapping")}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:s("cursorPage.modelMappingDesc")}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(H,{label:s("cursorPage.defaultModel"),description:s("cursorPage.defaultModelDesc"),value:w,models:G,disabled:l,onChange:a=>{C(o=>({...o,model:a}))}}),e.jsx(H,{label:s("cursorPage.opusModel"),description:s("cursorPage.opusModelDesc"),value:ne,models:G,disabled:l,allowDefaultFallback:!0,onChange:a=>{C(o=>({...o,opus_model:a}))}}),e.jsx(H,{label:s("cursorPage.sonnetModel"),description:s("cursorPage.sonnetModelDesc"),value:oe,models:G,disabled:l,allowDefaultFallback:!0,onChange:a=>{C(o=>({...o,sonnet_model:a}))}}),e.jsx(H,{label:s("cursorPage.haikuModel"),description:s("cursorPage.haikuModelDesc"),value:ie,models:G,disabled:l,allowDefaultFallback:!0,onChange:a=>{C(o=>({...o,haiku_model:a}))}})]})]})]})})}),e.jsx(me,{value:"settings",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(U,{className:"flex-1",children:e.jsx("div",{className:"p-4 space-y-6",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:s("cursorPage.runtimeSettings")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L,{htmlFor:"cursor-port",className:"text-xs",children:s("cursorPage.port")}),e.jsx(ge,{id:"cursor-port",type:"number",min:1,max:65535,className:"max-w-[150px] h-8",value:_e,onChange:a=>{C(o=>({...o,port:a.target.value}))}})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(L,{htmlFor:"cursor-auto-start",className:"text-xs",children:s("cursorPage.autoStartDaemon")}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:s("cursorPage.autoStartDesc")})]}),e.jsx(Fe,{id:"cursor-auto-start",checked:te,onCheckedChange:a=>{C(o=>({...o,auto_start:a}))}})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(L,{htmlFor:"cursor-ghost-mode",className:"text-xs",children:s("cursorPage.ghostMode")}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:s("cursorPage.ghostModeDesc")})]}),e.jsx(Fe,{id:"cursor-ghost-mode",checked:re,onCheckedChange:a=>{C(o=>({...o,ghost_mode:a}))}})]})]})})})}),e.jsx(me,{value:"info",className:"flex-1 mt-0 border-0 p-0 data-[state=inactive]:hidden flex flex-col overflow-hidden",children:e.jsx(U,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-6",children:[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:s("cursorPage.provider")}),e.jsx("span",{className:"font-mono",children:"Cursor IDE (Legacy)"})]}),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:s("cursorPage.filePath")}),e.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs break-all",children:m?.path??"~/.ccs/cursor.settings.json"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Legacy bridge model mapping writes `ANTHROPIC_MODEL`, `ANTHROPIC_DEFAULT_OPUS_MODEL`, `ANTHROPIC_DEFAULT_SONNET_MODEL`, and `ANTHROPIC_DEFAULT_HAIKU_MODEL` in `cursor.settings.json`."})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium mb-3",children:s("cursorPage.availableModels")}),l?e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(F,{className:"w-4 h-4 animate-spin"}),s("cursorPage.loadingModels")]}):n.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:s("cursorPage.noModels")}):e.jsx("div",{className:"space-y-2",children:n.map(a=>e.jsxs("div",{className:"rounded-lg border px-3 py-2 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:a.id}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[a.name," • ",a.provider]})]}),a.id===d&&e.jsx(M,{children:s("cursorPage.default")})]},a.id))})]})]})})})]})]})}),e.jsxs("div",{className:"flex-1 min-w-0 flex 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(xe,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:s("cursorPage.rawConfiguration")})]}),e.jsx(ps,{rawJsonContent:ce,isRawJsonValid:De,rawJsonEdits:I?ve:null,rawSettingsEnv:m?.settings?.env,onChange:a=>{ee(!0),He(a)}})]})]})]})})]}),e.jsx(js,{open:Ve,onOpenChange:K,children:e.jsxs(Ps,{children:[e.jsxs(bs,{children:[e.jsx(ys,{children:s("cursorPage.manualImportTitle")}),e.jsx(Ns,{children:s("cursorPage.manualImportDesc")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(L,{htmlFor:"cursor-manual-token",children:s("cursorPage.accessToken")}),e.jsx(ge,{id:"cursor-manual-token",value:se,onChange:a=>we(a.target.value),placeholder:s("cursorPage.accessTokenPlaceholder")})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(L,{htmlFor:"cursor-manual-machine-id",children:s("cursorPage.machineId")}),e.jsx(ge,{id:"cursor-manual-machine-id",value:ae,onChange:a=>Ce(a.target.value),placeholder:s("cursorPage.machineIdPlaceholder")})]})]}),e.jsxs(vs,{children:[e.jsx(h,{variant:"outline",onClick:()=>K(!1),children:s("cursorPage.cancel")}),e.jsxs(h,{onClick:ts,disabled:ye,children:[ye?e.jsx(F,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(z,{className:"w-4 h-4 mr-2"}),s("cursorPage.import")]})]})]})})]})}export{da as CursorPage};
|