@kaitranntt/ccs 7.76.0-dev.2 → 7.76.0-dev.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/api/services/cliproxy-profile-bridge.d.ts.map +1 -1
- package/dist/api/services/cliproxy-profile-bridge.js +5 -6
- package/dist/api/services/cliproxy-profile-bridge.js.map +1 -1
- package/dist/api/services/openrouter-catalog.js +2 -2
- package/dist/api/services/openrouter-catalog.js.map +1 -1
- package/dist/api/services/profile-lifecycle-service.d.ts.map +1 -1
- package/dist/api/services/profile-lifecycle-service.js +6 -6
- package/dist/api/services/profile-lifecycle-service.js.map +1 -1
- package/dist/api/services/profile-reader.d.ts.map +1 -1
- package/dist/api/services/profile-reader.js +14 -15
- package/dist/api/services/profile-reader.js.map +1 -1
- package/dist/api/services/profile-writer.d.ts.map +1 -1
- package/dist/api/services/profile-writer.js +13 -13
- package/dist/api/services/profile-writer.js.map +1 -1
- package/dist/auth/commands/create-command.d.ts.map +1 -1
- package/dist/auth/commands/create-command.js +2 -2
- package/dist/auth/commands/create-command.js.map +1 -1
- package/dist/auth/commands/default-command.d.ts.map +1 -1
- package/dist/auth/commands/default-command.js +3 -3
- package/dist/auth/commands/default-command.js.map +1 -1
- package/dist/auth/commands/remove-command.d.ts.map +1 -1
- package/dist/auth/commands/remove-command.js +2 -2
- package/dist/auth/commands/remove-command.js.map +1 -1
- package/dist/auth/profile-continuity-inheritance.d.ts.map +1 -1
- package/dist/auth/profile-continuity-inheritance.js +4 -4
- package/dist/auth/profile-continuity-inheritance.js.map +1 -1
- package/dist/auth/profile-detector.d.ts.map +1 -1
- package/dist/auth/profile-detector.js +5 -6
- package/dist/auth/profile-detector.js.map +1 -1
- package/dist/auth/profile-registry.d.ts.map +1 -1
- package/dist/auth/profile-registry.js +14 -15
- package/dist/auth/profile-registry.js.map +1 -1
- package/dist/auth/resume-lane-diagnostics.d.ts.map +1 -1
- package/dist/auth/resume-lane-diagnostics.js +2 -2
- package/dist/auth/resume-lane-diagnostics.js.map +1 -1
- package/dist/ccs.js +30 -1257
- package/dist/ccs.js.map +1 -1
- package/dist/channels/official-channels-ids.d.ts +21 -0
- package/dist/channels/official-channels-ids.d.ts.map +1 -0
- package/dist/channels/official-channels-ids.js +46 -0
- package/dist/channels/official-channels-ids.js.map +1 -0
- package/dist/channels/official-channels-runtime.d.ts +2 -5
- package/dist/channels/official-channels-runtime.d.ts.map +1 -1
- package/dist/channels/official-channels-runtime.js +14 -29
- package/dist/channels/official-channels-runtime.js.map +1 -1
- package/dist/channels/official-channels-store.d.ts.map +1 -1
- package/dist/channels/official-channels-store.js +2 -2
- package/dist/channels/official-channels-store.js.map +1 -1
- package/dist/cliproxy/accounts/account-safety.js +4 -4
- package/dist/cliproxy/accounts/account-safety.js.map +1 -1
- package/dist/cliproxy/auth/antigravity-responsibility.js +2 -2
- package/dist/cliproxy/auth/antigravity-responsibility.js.map +1 -1
- package/dist/cliproxy/auth/auth-token-manager.d.ts.map +1 -1
- package/dist/cliproxy/auth/auth-token-manager.js +8 -8
- package/dist/cliproxy/auth/auth-token-manager.js.map +1 -1
- package/dist/cliproxy/auth/token-refresh-config.d.ts.map +1 -1
- package/dist/cliproxy/auth/token-refresh-config.js +2 -2
- package/dist/cliproxy/auth/token-refresh-config.js.map +1 -1
- package/dist/cliproxy/binary-manager.d.ts.map +1 -1
- package/dist/cliproxy/binary-manager.js +2 -2
- package/dist/cliproxy/binary-manager.js.map +1 -1
- package/dist/cliproxy/config/env-builder.d.ts.map +1 -1
- package/dist/cliproxy/config/env-builder.js +2 -2
- package/dist/cliproxy/config/env-builder.js.map +1 -1
- package/dist/cliproxy/config/generator.d.ts +6 -2
- package/dist/cliproxy/config/generator.d.ts.map +1 -1
- package/dist/cliproxy/config/generator.js +43 -10
- package/dist/cliproxy/config/generator.js.map +1 -1
- package/dist/cliproxy/config/model-config.d.ts.map +1 -1
- package/dist/cliproxy/config/model-config.js +2 -2
- package/dist/cliproxy/config/model-config.js.map +1 -1
- package/dist/cliproxy/config/path-resolver.d.ts.map +1 -1
- package/dist/cliproxy/config/path-resolver.js +4 -4
- package/dist/cliproxy/config/path-resolver.js.map +1 -1
- package/dist/cliproxy/config/thinking-config.d.ts.map +1 -1
- package/dist/cliproxy/config/thinking-config.js +2 -2
- package/dist/cliproxy/config/thinking-config.js.map +1 -1
- package/dist/cliproxy/executor/account-resolution.d.ts +52 -0
- package/dist/cliproxy/executor/account-resolution.d.ts.map +1 -0
- package/dist/cliproxy/executor/account-resolution.js +154 -0
- package/dist/cliproxy/executor/account-resolution.js.map +1 -0
- package/dist/cliproxy/executor/arg-parser.d.ts +96 -0
- package/dist/cliproxy/executor/arg-parser.d.ts.map +1 -0
- package/dist/cliproxy/executor/arg-parser.js +529 -0
- package/dist/cliproxy/executor/arg-parser.js.map +1 -0
- package/dist/cliproxy/executor/auth-coordinator.d.ts +96 -0
- package/dist/cliproxy/executor/auth-coordinator.d.ts.map +1 -0
- package/dist/cliproxy/executor/auth-coordinator.js +342 -0
- package/dist/cliproxy/executor/auth-coordinator.js.map +1 -0
- package/dist/cliproxy/executor/browser-launch-setup.d.ts +36 -0
- package/dist/cliproxy/executor/browser-launch-setup.d.ts.map +1 -0
- package/dist/cliproxy/executor/browser-launch-setup.js +80 -0
- package/dist/cliproxy/executor/browser-launch-setup.js.map +1 -0
- package/dist/cliproxy/executor/claude-launcher.d.ts +55 -0
- package/dist/cliproxy/executor/claude-launcher.d.ts.map +1 -0
- package/dist/cliproxy/executor/claude-launcher.js +112 -0
- package/dist/cliproxy/executor/claude-launcher.js.map +1 -0
- package/dist/cliproxy/executor/index.d.ts +4 -9
- package/dist/cliproxy/executor/index.d.ts.map +1 -1
- package/dist/cliproxy/executor/index.js +110 -866
- package/dist/cliproxy/executor/index.js.map +1 -1
- package/dist/cliproxy/executor/model-warnings.d.ts +22 -0
- package/dist/cliproxy/executor/model-warnings.d.ts.map +1 -0
- package/dist/cliproxy/executor/model-warnings.js +67 -0
- package/dist/cliproxy/executor/model-warnings.js.map +1 -0
- package/dist/cliproxy/executor/proxy-chain-builder.d.ts +71 -0
- package/dist/cliproxy/executor/proxy-chain-builder.d.ts.map +1 -0
- package/dist/cliproxy/executor/proxy-chain-builder.js +143 -0
- package/dist/cliproxy/executor/proxy-chain-builder.js.map +1 -0
- package/dist/cliproxy/executor/proxy-resolver.d.ts +44 -0
- package/dist/cliproxy/executor/proxy-resolver.d.ts.map +1 -0
- package/dist/cliproxy/executor/proxy-resolver.js +173 -0
- package/dist/cliproxy/executor/proxy-resolver.js.map +1 -0
- package/dist/cliproxy/proxy/proxy-target-resolver.js +2 -2
- package/dist/cliproxy/proxy/proxy-target-resolver.js.map +1 -1
- package/dist/cliproxy/proxy/tool-sanitization-proxy.d.ts.map +1 -1
- package/dist/cliproxy/proxy/tool-sanitization-proxy.js +2 -2
- package/dist/cliproxy/proxy/tool-sanitization-proxy.js.map +1 -1
- package/dist/cliproxy/quota/quota-manager.d.ts.map +1 -1
- package/dist/cliproxy/quota/quota-manager.js +4 -4
- package/dist/cliproxy/quota/quota-manager.js.map +1 -1
- package/dist/cliproxy/routing/routing-strategy.d.ts.map +1 -1
- package/dist/cliproxy/routing/routing-strategy.js +5 -5
- package/dist/cliproxy/routing/routing-strategy.js.map +1 -1
- package/dist/cliproxy/service-manager.js +2 -2
- package/dist/cliproxy/service-manager.js.map +1 -1
- package/dist/cliproxy/services/binary-service.js +8 -8
- package/dist/cliproxy/services/binary-service.js.map +1 -1
- package/dist/cliproxy/services/catalog-cache.d.ts.map +1 -1
- package/dist/cliproxy/services/catalog-cache.js +2 -2
- package/dist/cliproxy/services/catalog-cache.js.map +1 -1
- package/dist/cliproxy/services/variant-config-adapter.d.ts.map +1 -1
- package/dist/cliproxy/services/variant-config-adapter.js +10 -10
- package/dist/cliproxy/services/variant-config-adapter.js.map +1 -1
- package/dist/cliproxy/services/variant-service.d.ts.map +1 -1
- package/dist/cliproxy/services/variant-service.js +7 -8
- package/dist/cliproxy/services/variant-service.js.map +1 -1
- package/dist/cliproxy/services/variant-settings.d.ts.map +1 -1
- package/dist/cliproxy/services/variant-settings.js +5 -5
- package/dist/cliproxy/services/variant-settings.js.map +1 -1
- package/dist/cliproxy/sync/auto-sync-watcher.js +3 -4
- package/dist/cliproxy/sync/auto-sync-watcher.js.map +1 -1
- package/dist/cliproxy/sync/profile-mapper.d.ts.map +1 -1
- package/dist/cliproxy/sync/profile-mapper.js +2 -2
- package/dist/cliproxy/sync/profile-mapper.js.map +1 -1
- package/dist/commands/browser-command.d.ts.map +1 -1
- package/dist/commands/browser-command.js +7 -7
- package/dist/commands/browser-command.js.map +1 -1
- package/dist/commands/cliproxy/resolve-lifecycle-port.d.ts.map +1 -1
- package/dist/commands/cliproxy/resolve-lifecycle-port.js +2 -2
- package/dist/commands/cliproxy/resolve-lifecycle-port.js.map +1 -1
- package/dist/commands/cliproxy/variant-subcommand.d.ts.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/config-auth/disable-command.d.ts.map +1 -1
- package/dist/commands/config-auth/disable-command.js +3 -3
- package/dist/commands/config-auth/disable-command.js.map +1 -1
- package/dist/commands/config-auth/setup-command.d.ts.map +1 -1
- package/dist/commands/config-auth/setup-command.js +2 -2
- package/dist/commands/config-auth/setup-command.js.map +1 -1
- package/dist/commands/config-auth/show-command.js +2 -2
- package/dist/commands/config-auth/show-command.js.map +1 -1
- package/dist/commands/config-channels-command.d.ts.map +1 -1
- package/dist/commands/config-channels-command.js +4 -4
- package/dist/commands/config-channels-command.js.map +1 -1
- package/dist/commands/config-command.d.ts +1 -1
- package/dist/commands/config-command.d.ts.map +1 -1
- package/dist/commands/config-command.js +2 -2
- package/dist/commands/config-command.js.map +1 -1
- package/dist/commands/config-image-analysis-command.d.ts.map +1 -1
- package/dist/commands/config-image-analysis-command.js +4 -4
- package/dist/commands/config-image-analysis-command.js.map +1 -1
- package/dist/commands/config-thinking-command.d.ts.map +1 -1
- package/dist/commands/config-thinking-command.js +4 -4
- package/dist/commands/config-thinking-command.js.map +1 -1
- package/dist/commands/copilot-command.d.ts.map +1 -1
- package/dist/commands/copilot-command.js +4 -4
- package/dist/commands/copilot-command.js.map +1 -1
- package/dist/commands/cursor-command.d.ts.map +1 -1
- package/dist/commands/cursor-command.js +7 -7
- package/dist/commands/cursor-command.js.map +1 -1
- package/dist/commands/env-command.d.ts.map +1 -1
- package/dist/commands/env-command.js +2 -2
- package/dist/commands/env-command.js.map +1 -1
- package/dist/commands/migrate-command.d.ts.map +1 -1
- package/dist/commands/migrate-command.js +2 -2
- package/dist/commands/migrate-command.js.map +1 -1
- package/dist/commands/proxy-command.d.ts.map +1 -1
- package/dist/commands/proxy-command.js +2 -1
- package/dist/commands/proxy-command.js.map +1 -1
- package/dist/commands/setup-command.d.ts.map +1 -1
- package/dist/commands/setup-command.js +6 -7
- package/dist/commands/setup-command.js.map +1 -1
- package/dist/commands/version-command.d.ts.map +1 -1
- package/dist/commands/version-command.js +2 -1
- package/dist/commands/version-command.js.map +1 -1
- package/dist/config/loader/config-getters.d.ts +121 -0
- package/dist/config/loader/config-getters.d.ts.map +1 -0
- package/dist/config/loader/config-getters.js +260 -0
- package/dist/config/loader/config-getters.js.map +1 -0
- package/dist/config/loader/defaults-merger.d.ts +21 -0
- package/dist/config/loader/defaults-merger.d.ts.map +1 -0
- package/dist/config/loader/defaults-merger.js +278 -0
- package/dist/config/loader/defaults-merger.js.map +1 -0
- package/dist/config/loader/io-locks.d.ts +76 -0
- package/dist/config/loader/io-locks.d.ts.map +1 -0
- package/dist/config/loader/io-locks.js +297 -0
- package/dist/config/loader/io-locks.js.map +1 -0
- package/dist/config/loader/normalizers.d.ts +40 -0
- package/dist/config/loader/normalizers.d.ts.map +1 -0
- package/dist/config/loader/normalizers.js +172 -0
- package/dist/config/loader/normalizers.js.map +1 -0
- package/dist/config/loader/yaml-serializer.d.ts +19 -0
- package/dist/config/loader/yaml-serializer.d.ts.map +1 -0
- package/dist/config/loader/yaml-serializer.js +300 -0
- package/dist/config/loader/yaml-serializer.js.map +1 -0
- package/dist/config/schemas/cliproxy.d.ts +2 -0
- package/dist/config/schemas/cliproxy.d.ts.map +1 -1
- package/dist/config/unified-config-loader.d.ts +21 -124
- package/dist/config/unified-config-loader.d.ts.map +1 -1
- package/dist/config/unified-config-loader.js +100 -1098
- package/dist/config/unified-config-loader.js.map +1 -1
- package/dist/copilot/copilot-daemon.d.ts.map +1 -1
- package/dist/copilot/copilot-daemon.js +2 -2
- package/dist/copilot/copilot-daemon.js.map +1 -1
- package/dist/copilot/copilot-executor.d.ts.map +1 -1
- package/dist/copilot/copilot-executor.js +2 -2
- package/dist/copilot/copilot-executor.js.map +1 -1
- package/dist/copilot/copilot-package-manager.js +2 -2
- package/dist/copilot/copilot-package-manager.js.map +1 -1
- package/dist/cursor/cursor-auth.js +2 -2
- package/dist/cursor/cursor-auth.js.map +1 -1
- package/dist/cursor/cursor-daemon-pid.js +2 -2
- package/dist/cursor/cursor-daemon-pid.js.map +1 -1
- package/dist/cursor/cursor-profile-executor.d.ts.map +1 -1
- package/dist/cursor/cursor-profile-executor.js +2 -2
- package/dist/cursor/cursor-profile-executor.js.map +1 -1
- package/dist/delegation/delegation-handler.js +2 -2
- package/dist/delegation/delegation-handler.js.map +1 -1
- package/dist/delegation/headless-executor.d.ts.map +1 -1
- package/dist/delegation/headless-executor.js +4 -4
- package/dist/delegation/headless-executor.js.map +1 -1
- package/dist/delegation/session-manager.js +2 -2
- package/dist/delegation/session-manager.js.map +1 -1
- package/dist/dispatcher/cli-argument-parser.d.ts +70 -0
- package/dist/dispatcher/cli-argument-parser.d.ts.map +1 -0
- package/dist/dispatcher/cli-argument-parser.js +285 -0
- package/dist/dispatcher/cli-argument-parser.js.map +1 -0
- package/dist/dispatcher/dispatcher-context.d.ts +24 -0
- package/dist/dispatcher/dispatcher-context.d.ts.map +1 -0
- package/dist/dispatcher/dispatcher-context.js +11 -0
- package/dist/dispatcher/dispatcher-context.js.map +1 -0
- package/dist/dispatcher/environment-builder.d.ts +20 -0
- package/dist/dispatcher/environment-builder.d.ts.map +1 -0
- package/dist/dispatcher/environment-builder.js +95 -0
- package/dist/dispatcher/environment-builder.js.map +1 -0
- package/dist/dispatcher/flows/account-flow.d.ts +9 -0
- package/dist/dispatcher/flows/account-flow.d.ts.map +1 -0
- package/dist/dispatcher/flows/account-flow.js +49 -0
- package/dist/dispatcher/flows/account-flow.js.map +1 -0
- package/dist/dispatcher/flows/cliproxy-flow.d.ts +8 -0
- package/dist/dispatcher/flows/cliproxy-flow.d.ts.map +1 -0
- package/dist/dispatcher/flows/cliproxy-flow.js +165 -0
- package/dist/dispatcher/flows/cliproxy-flow.js.map +1 -0
- package/dist/dispatcher/flows/copilot-flow.d.ts +8 -0
- package/dist/dispatcher/flows/copilot-flow.d.ts.map +1 -0
- package/dist/dispatcher/flows/copilot-flow.js +72 -0
- package/dist/dispatcher/flows/copilot-flow.js.map +1 -0
- package/dist/dispatcher/flows/cursor-flow.d.ts +8 -0
- package/dist/dispatcher/flows/cursor-flow.d.ts.map +1 -0
- package/dist/dispatcher/flows/cursor-flow.js +62 -0
- package/dist/dispatcher/flows/cursor-flow.js.map +1 -0
- package/dist/dispatcher/flows/default-flow.d.ts +10 -0
- package/dist/dispatcher/flows/default-flow.d.ts.map +1 -0
- package/dist/dispatcher/flows/default-flow.js +99 -0
- package/dist/dispatcher/flows/default-flow.js.map +1 -0
- package/dist/dispatcher/flows/settings-flow.d.ts +9 -0
- package/dist/dispatcher/flows/settings-flow.d.ts.map +1 -0
- package/dist/dispatcher/flows/settings-flow.js +318 -0
- package/dist/dispatcher/flows/settings-flow.js.map +1 -0
- package/dist/dispatcher/flows/settings-image-analysis-prep.d.ts +28 -0
- package/dist/dispatcher/flows/settings-image-analysis-prep.d.ts.map +1 -0
- package/dist/dispatcher/flows/settings-image-analysis-prep.js +81 -0
- package/dist/dispatcher/flows/settings-image-analysis-prep.js.map +1 -0
- package/dist/dispatcher/pre-dispatch.d.ts +23 -0
- package/dist/dispatcher/pre-dispatch.d.ts.map +1 -0
- package/dist/dispatcher/pre-dispatch.js +156 -0
- package/dist/dispatcher/pre-dispatch.js.map +1 -0
- package/dist/dispatcher/profile-resolver.d.ts +65 -0
- package/dist/dispatcher/profile-resolver.d.ts.map +1 -0
- package/dist/dispatcher/profile-resolver.js +290 -0
- package/dist/dispatcher/profile-resolver.js.map +1 -0
- package/dist/dispatcher/target-executor.d.ts +26 -0
- package/dist/dispatcher/target-executor.d.ts.map +1 -0
- package/dist/dispatcher/target-executor.js +81 -0
- package/dist/dispatcher/target-executor.js.map +1 -0
- package/dist/docker/docker-assets.d.ts.map +1 -1
- package/dist/docker/docker-assets.js +2 -2
- package/dist/docker/docker-assets.js.map +1 -1
- package/dist/glmt/glmt-transformer.d.ts.map +1 -1
- package/dist/glmt/glmt-transformer.js +2 -2
- package/dist/glmt/glmt-transformer.js.map +1 -1
- package/dist/management/checks/config-check.d.ts.map +1 -1
- package/dist/management/checks/config-check.js +2 -2
- package/dist/management/checks/config-check.js.map +1 -1
- package/dist/management/checks/env-check.d.ts.map +1 -1
- package/dist/management/checks/env-check.js +2 -1
- package/dist/management/checks/env-check.js.map +1 -1
- package/dist/management/checks/image-analysis-check.d.ts.map +1 -1
- package/dist/management/checks/image-analysis-check.js +4 -4
- package/dist/management/checks/image-analysis-check.js.map +1 -1
- package/dist/management/checks/profile-check.js +4 -4
- package/dist/management/checks/profile-check.js.map +1 -1
- package/dist/management/checks/symlink-check.js +2 -2
- package/dist/management/checks/symlink-check.js.map +1 -1
- package/dist/management/checks/system-check.js +2 -2
- package/dist/management/checks/system-check.js.map +1 -1
- package/dist/management/instance-manager.d.ts.map +1 -1
- package/dist/management/instance-manager.js +2 -1
- package/dist/management/instance-manager.js.map +1 -1
- package/dist/management/recovery-manager.d.ts.map +1 -1
- package/dist/management/recovery-manager.js +5 -5
- package/dist/management/recovery-manager.js.map +1 -1
- package/dist/management/repair/auto-repair.d.ts.map +1 -1
- package/dist/management/repair/auto-repair.js +2 -2
- package/dist/management/repair/auto-repair.js.map +1 -1
- package/dist/management/shared-manager.d.ts.map +1 -1
- package/dist/management/shared-manager.js +2 -2
- package/dist/management/shared-manager.js.map +1 -1
- package/dist/proxy/proxy-daemon-entry.js +2 -2
- package/dist/proxy/proxy-daemon-entry.js.map +1 -1
- package/dist/proxy/proxy-daemon-paths.js +2 -2
- package/dist/proxy/proxy-daemon-paths.js.map +1 -1
- package/dist/proxy/proxy-port-resolver.js +2 -2
- package/dist/proxy/proxy-port-resolver.js.map +1 -1
- package/dist/proxy/request-router.d.ts.map +1 -1
- package/dist/proxy/request-router.js +3 -3
- package/dist/proxy/request-router.js.map +1 -1
- package/dist/services/logging/log-config.d.ts.map +1 -1
- package/dist/services/logging/log-config.js +3 -3
- package/dist/services/logging/log-config.js.map +1 -1
- package/dist/services/logging/log-paths.js +3 -3
- package/dist/services/logging/log-paths.js.map +1 -1
- package/dist/utils/browser/browser-setup.d.ts +2 -2
- package/dist/utils/browser/browser-setup.d.ts.map +1 -1
- package/dist/utils/browser/browser-setup.js +4 -4
- package/dist/utils/browser/browser-setup.js.map +1 -1
- package/dist/utils/browser/browser-status.d.ts.map +1 -1
- package/dist/utils/browser/browser-status.js +3 -3
- package/dist/utils/browser/browser-status.js.map +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-analyzer-hook-configuration.d.ts.map +1 -1
- package/dist/utils/hooks/image-analyzer-hook-configuration.js +2 -2
- package/dist/utils/hooks/image-analyzer-hook-configuration.js.map +1 -1
- package/dist/utils/hooks/image-analyzer-hook-installer.d.ts.map +1 -1
- package/dist/utils/hooks/image-analyzer-hook-installer.js +2 -2
- package/dist/utils/hooks/image-analyzer-hook-installer.js.map +1 -1
- package/dist/utils/hooks/image-analyzer-profile-hook-injector.d.ts.map +1 -1
- package/dist/utils/hooks/image-analyzer-profile-hook-injector.js +2 -2
- package/dist/utils/hooks/image-analyzer-profile-hook-injector.js.map +1 -1
- package/dist/utils/image-analysis/mcp-installer.d.ts.map +1 -1
- package/dist/utils/image-analysis/mcp-installer.js +5 -5
- package/dist/utils/image-analysis/mcp-installer.js.map +1 -1
- package/dist/utils/shell-executor.d.ts.map +1 -1
- package/dist/utils/shell-executor.js +2 -2
- package/dist/utils/shell-executor.js.map +1 -1
- package/dist/utils/websearch/hook-config.d.ts.map +1 -1
- package/dist/utils/websearch/hook-config.js +3 -3
- package/dist/utils/websearch/hook-config.js.map +1 -1
- package/dist/utils/websearch/hook-env.js +2 -2
- package/dist/utils/websearch/hook-env.js.map +1 -1
- package/dist/utils/websearch/hook-installer.d.ts.map +1 -1
- package/dist/utils/websearch/hook-installer.js +2 -2
- package/dist/utils/websearch/hook-installer.js.map +1 -1
- package/dist/utils/websearch/mcp-installer.d.ts.map +1 -1
- package/dist/utils/websearch/mcp-installer.js +5 -5
- package/dist/utils/websearch/mcp-installer.js.map +1 -1
- package/dist/utils/websearch/profile-hook-injector.d.ts.map +1 -1
- package/dist/utils/websearch/profile-hook-injector.js +3 -3
- package/dist/utils/websearch/profile-hook-injector.js.map +1 -1
- package/dist/utils/websearch/provider-secrets.js +2 -2
- package/dist/utils/websearch/provider-secrets.js.map +1 -1
- package/dist/utils/websearch/status.d.ts.map +1 -1
- package/dist/utils/websearch/status.js +4 -4
- package/dist/utils/websearch/status.js.map +1 -1
- package/dist/web-server/file-watcher.js +2 -2
- package/dist/web-server/file-watcher.js.map +1 -1
- package/dist/web-server/health/config-checks.d.ts.map +1 -1
- package/dist/web-server/health/config-checks.js +3 -3
- package/dist/web-server/health/config-checks.js.map +1 -1
- package/dist/web-server/health/profile-checks.d.ts.map +1 -1
- package/dist/web-server/health/profile-checks.js +3 -3
- package/dist/web-server/health/profile-checks.js.map +1 -1
- package/dist/web-server/health-service.d.ts.map +1 -1
- package/dist/web-server/health-service.js +7 -6
- package/dist/web-server/health-service.js.map +1 -1
- package/dist/web-server/middleware/auth-middleware.d.ts.map +1 -1
- package/dist/web-server/middleware/auth-middleware.js +6 -7
- package/dist/web-server/middleware/auth-middleware.js.map +1 -1
- package/dist/web-server/models-dev/registry-cache.d.ts.map +1 -1
- package/dist/web-server/models-dev/registry-cache.js +2 -2
- package/dist/web-server/models-dev/registry-cache.js.map +1 -1
- package/dist/web-server/overview-routes.d.ts.map +1 -1
- package/dist/web-server/overview-routes.js +2 -2
- package/dist/web-server/overview-routes.js.map +1 -1
- package/dist/web-server/routes/account-routes.d.ts.map +1 -1
- package/dist/web-server/routes/account-routes.js +7 -7
- package/dist/web-server/routes/account-routes.js.map +1 -1
- package/dist/web-server/routes/auth-routes.d.ts.map +1 -1
- package/dist/web-server/routes/auth-routes.js +4 -4
- package/dist/web-server/routes/auth-routes.js.map +1 -1
- package/dist/web-server/routes/browser-routes.d.ts.map +1 -1
- package/dist/web-server/routes/browser-routes.js +2 -2
- package/dist/web-server/routes/browser-routes.js.map +1 -1
- package/dist/web-server/routes/channels-routes.d.ts.map +1 -1
- package/dist/web-server/routes/channels-routes.js +4 -4
- package/dist/web-server/routes/channels-routes.js.map +1 -1
- package/dist/web-server/routes/cliproxy-auth-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cliproxy-auth-routes.js +2 -2
- package/dist/web-server/routes/cliproxy-auth-routes.js.map +1 -1
- package/dist/web-server/routes/cliproxy-local-proxy.d.ts.map +1 -1
- package/dist/web-server/routes/cliproxy-local-proxy.js +2 -2
- package/dist/web-server/routes/cliproxy-local-proxy.js.map +1 -1
- package/dist/web-server/routes/cliproxy-sync-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cliproxy-sync-routes.js +2 -2
- package/dist/web-server/routes/cliproxy-sync-routes.js.map +1 -1
- package/dist/web-server/routes/config-routes.d.ts.map +1 -1
- package/dist/web-server/routes/config-routes.js +6 -6
- package/dist/web-server/routes/config-routes.js.map +1 -1
- package/dist/web-server/routes/copilot-routes.d.ts.map +1 -1
- package/dist/web-server/routes/copilot-routes.js +3 -3
- package/dist/web-server/routes/copilot-routes.js.map +1 -1
- package/dist/web-server/routes/copilot-settings-routes.d.ts.map +1 -1
- package/dist/web-server/routes/copilot-settings-routes.js +6 -7
- package/dist/web-server/routes/copilot-settings-routes.js.map +1 -1
- package/dist/web-server/routes/cursor-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cursor-routes.js +5 -5
- package/dist/web-server/routes/cursor-routes.js.map +1 -1
- package/dist/web-server/routes/cursor-settings-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cursor-settings-routes.js +8 -9
- package/dist/web-server/routes/cursor-settings-routes.js.map +1 -1
- package/dist/web-server/routes/image-analysis-routes.d.ts.map +1 -1
- package/dist/web-server/routes/image-analysis-routes.js +5 -6
- package/dist/web-server/routes/image-analysis-routes.js.map +1 -1
- package/dist/web-server/routes/misc-routes.d.ts.map +1 -1
- package/dist/web-server/routes/misc-routes.js +10 -11
- package/dist/web-server/routes/misc-routes.js.map +1 -1
- package/dist/web-server/routes/proxy-routes.d.ts.map +1 -1
- package/dist/web-server/routes/proxy-routes.js +18 -10
- package/dist/web-server/routes/proxy-routes.js.map +1 -1
- package/dist/web-server/routes/route-helpers.d.ts.map +1 -1
- package/dist/web-server/routes/route-helpers.js +7 -6
- package/dist/web-server/routes/route-helpers.js.map +1 -1
- package/dist/web-server/routes/settings-routes.d.ts.map +1 -1
- package/dist/web-server/routes/settings-routes.js +8 -9
- package/dist/web-server/routes/settings-routes.js.map +1 -1
- package/dist/web-server/routes/websearch-routes.d.ts.map +1 -1
- package/dist/web-server/routes/websearch-routes.js +4 -4
- package/dist/web-server/routes/websearch-routes.js.map +1 -1
- package/dist/web-server/services/claude-extension-binding-service.js +2 -2
- package/dist/web-server/services/claude-extension-binding-service.js.map +1 -1
- package/dist/web-server/services/logs-dashboard-service.d.ts.map +1 -1
- package/dist/web-server/services/logs-dashboard-service.js +2 -2
- package/dist/web-server/services/logs-dashboard-service.js.map +1 -1
- package/dist/web-server/shared-routes.d.ts.map +1 -1
- package/dist/web-server/shared-routes.js +4 -4
- package/dist/web-server/shared-routes.js.map +1 -1
- package/dist/web-server/usage/aggregator.d.ts.map +1 -1
- package/dist/web-server/usage/aggregator.js +2 -2
- package/dist/web-server/usage/aggregator.js.map +1 -1
- package/dist/web-server/usage/cliproxy-usage-syncer.d.ts.map +1 -1
- package/dist/web-server/usage/cliproxy-usage-syncer.js +2 -2
- package/dist/web-server/usage/cliproxy-usage-syncer.js.map +1 -1
- package/dist/web-server/usage/disk-cache.js +2 -2
- package/dist/web-server/usage/disk-cache.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Unified Config Loader
|
|
3
|
+
* Unified Config Loader — orchestrator
|
|
4
4
|
*
|
|
5
5
|
* Loads and saves the unified YAML configuration.
|
|
6
6
|
* Provides fallback to legacy JSON format for backward compatibility.
|
|
7
|
+
*
|
|
8
|
+
* Phase 1-6 refactor (issue #1164):
|
|
9
|
+
* Phase 1 → src/config/loader/io-locks.ts
|
|
10
|
+
* Phase 2 → src/config/loader/normalizers.ts
|
|
11
|
+
* Phase 3 → src/config/loader/yaml-serializer.ts
|
|
12
|
+
* Phase 4 → src/config/loader/defaults-merger.ts
|
|
13
|
+
* Phase 5 → src/config/loader/config-getters.ts
|
|
14
|
+
*
|
|
15
|
+
* This file re-exports the full public API so all existing import sites
|
|
16
|
+
* continue to work without modification.
|
|
7
17
|
*/
|
|
8
18
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
19
|
if (k2 === undefined) k2 = k;
|
|
@@ -29,185 +39,74 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
29
39
|
return result;
|
|
30
40
|
};
|
|
31
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.getCursorConfig = exports.getLoggingConfig = exports.getImageAnalysisConfig = exports.getBrowserConfig = exports.getDashboardAuthConfig = exports.isDashboardAuthEnabled = exports.getOfficialChannelsConfig = exports.getThinkingConfig = exports.getCliproxySafetyConfig = exports.getContinuityInheritanceMap = exports.getGlobalEnvConfig = exports.getWebSearchConfig = exports.
|
|
42
|
+
exports.setDefaultProfile = exports.getDefaultProfile = exports.isUnifiedMode = exports.updateUnifiedConfig = exports.mutateUnifiedConfig = exports.saveUnifiedConfig = exports.loadOrCreateUnifiedConfig = exports.loadUnifiedConfig = exports.getConfigFormat = exports.getCursorConfig = exports.getLoggingConfig = exports.getImageAnalysisConfig = exports.getBrowserConfig = exports.getDashboardAuthConfig = exports.isDashboardAuthEnabled = exports.getOfficialChannelsConfig = exports.getThinkingConfig = exports.getCliproxySafetyConfig = exports.getContinuityInheritanceMap = exports.getGlobalEnvConfig = exports.getWebSearchConfig = exports.mergeWithDefaults = exports.generateYamlWithComments = exports.generateYamlHeader = exports.normalizeOfficialChannelsConfig = exports.normalizeContinuityConfig = exports.normalizeContinuityInheritanceMap = exports.validateCompositeVariants = exports.hasPositiveDuration = exports.normalizeSessionAffinityTtl = exports.canonicalizeBrowserConfig = exports.normalizeBrowserEvalMode = exports.normalizeBrowserPolicy = exports.normalizeBrowserDevtoolsPort = exports.withConfigWriteLock = exports.sleepSync = exports.hasLegacyConfig = exports.hasUnifiedConfig = exports.releaseLock = exports.acquireLock = exports.getConfigJsonPath = exports.getConfigYamlPath = exports.GO_DURATION_PATTERN = exports.GO_DURATION_SEGMENT = exports.LOCK_STALE_MS = exports.CONFIG_LOCK = exports.CONFIG_JSON = exports.CONFIG_YAML = void 0;
|
|
33
43
|
const fs = __importStar(require("fs"));
|
|
34
|
-
const path = __importStar(require("path"));
|
|
35
|
-
const crypto = __importStar(require("crypto"));
|
|
36
44
|
const yaml = __importStar(require("js-yaml"));
|
|
37
|
-
const config_manager_1 = require("../utils/config-manager");
|
|
38
45
|
const unified_config_types_1 = require("./unified-config-types");
|
|
39
|
-
const composite_validator_1 = require("../cliproxy/config/composite-validator");
|
|
40
46
|
const feature_flags_1 = require("./feature-flags");
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
function
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
function
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
function
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
function
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
function
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
return segments.some((segment) => {
|
|
105
|
-
const numeric = parseFloat(segment);
|
|
106
|
-
return Number.isFinite(numeric) && numeric > 0;
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Get path to unified config.yaml
|
|
111
|
-
*/
|
|
112
|
-
function getConfigYamlPath() {
|
|
113
|
-
return path.join((0, config_manager_1.getCcsDir)(), CONFIG_YAML);
|
|
114
|
-
}
|
|
115
|
-
exports.getConfigYamlPath = getConfigYamlPath;
|
|
116
|
-
/**
|
|
117
|
-
* Get path to legacy config.json
|
|
118
|
-
*/
|
|
119
|
-
function getConfigJsonPath() {
|
|
120
|
-
return path.join((0, config_manager_1.getCcsDir)(), CONFIG_JSON);
|
|
121
|
-
}
|
|
122
|
-
exports.getConfigJsonPath = getConfigJsonPath;
|
|
123
|
-
/**
|
|
124
|
-
* Get path to config lockfile
|
|
125
|
-
*/
|
|
126
|
-
function getLockFilePath() {
|
|
127
|
-
return path.join((0, config_manager_1.getCcsDir)(), CONFIG_LOCK);
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Acquire lockfile for config write operations.
|
|
131
|
-
* Returns a lock token if acquired, null if already locked by another process.
|
|
132
|
-
* Cleans up stale locks (older than LOCK_STALE_MS).
|
|
133
|
-
*/
|
|
134
|
-
function acquireLock() {
|
|
135
|
-
const lockPath = getLockFilePath();
|
|
136
|
-
const lockDir = path.dirname(lockPath);
|
|
137
|
-
const lockToken = crypto.randomUUID();
|
|
138
|
-
const lockData = `${process.pid}\n${Date.now()}\n${lockToken}`;
|
|
139
|
-
try {
|
|
140
|
-
if (!fs.existsSync(lockDir)) {
|
|
141
|
-
fs.mkdirSync(lockDir, { recursive: true, mode: 0o700 });
|
|
142
|
-
}
|
|
143
|
-
// Check if lock exists
|
|
144
|
-
if (fs.existsSync(lockPath)) {
|
|
145
|
-
const content = fs.readFileSync(lockPath, 'utf8');
|
|
146
|
-
const [pidStr, timestampStr] = content.trim().split('\n');
|
|
147
|
-
const pid = Number.parseInt(pidStr, 10);
|
|
148
|
-
const timestamp = Number.parseInt(timestampStr, 10);
|
|
149
|
-
const hasLiveOwner = Number.isInteger(pid) && pid > 0 && processExists(pid);
|
|
150
|
-
const isStale = !Number.isFinite(timestamp) || Date.now() - timestamp > LOCK_STALE_MS;
|
|
151
|
-
if (hasLiveOwner) {
|
|
152
|
-
return null;
|
|
153
|
-
}
|
|
154
|
-
if (isStale || !hasLiveOwner) {
|
|
155
|
-
fs.unlinkSync(lockPath);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
// Acquire lock
|
|
159
|
-
fs.writeFileSync(lockPath, lockData, { flag: 'wx', mode: 0o600 });
|
|
160
|
-
return lockToken;
|
|
161
|
-
}
|
|
162
|
-
catch (error) {
|
|
163
|
-
// EEXIST means another process acquired the lock between our check and write
|
|
164
|
-
if (error.code === 'EEXIST') {
|
|
165
|
-
return null;
|
|
166
|
-
}
|
|
167
|
-
return null;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Release lockfile after config write operation.
|
|
172
|
-
*/
|
|
173
|
-
function releaseLock(lockToken) {
|
|
174
|
-
const lockPath = getLockFilePath();
|
|
175
|
-
try {
|
|
176
|
-
if (fs.existsSync(lockPath)) {
|
|
177
|
-
const content = fs.readFileSync(lockPath, 'utf8');
|
|
178
|
-
const fileToken = content.trim().split('\n')[2];
|
|
179
|
-
if (fileToken === lockToken) {
|
|
180
|
-
fs.unlinkSync(lockPath);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
catch {
|
|
185
|
-
// Ignore cleanup errors
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
function processExists(pid) {
|
|
189
|
-
try {
|
|
190
|
-
process.kill(pid, 0);
|
|
191
|
-
return true;
|
|
192
|
-
}
|
|
193
|
-
catch {
|
|
194
|
-
return false;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Check if unified config.yaml exists
|
|
199
|
-
*/
|
|
200
|
-
function hasUnifiedConfig() {
|
|
201
|
-
return fs.existsSync(getConfigYamlPath());
|
|
202
|
-
}
|
|
203
|
-
exports.hasUnifiedConfig = hasUnifiedConfig;
|
|
204
|
-
/**
|
|
205
|
-
* Check if legacy config.json exists
|
|
206
|
-
*/
|
|
207
|
-
function hasLegacyConfig() {
|
|
208
|
-
return fs.existsSync(getConfigJsonPath());
|
|
209
|
-
}
|
|
210
|
-
exports.hasLegacyConfig = hasLegacyConfig;
|
|
47
|
+
// ---------------------------------------------------------------------------
|
|
48
|
+
// Phase 1 re-exports: io-locks
|
|
49
|
+
// ---------------------------------------------------------------------------
|
|
50
|
+
var io_locks_1 = require("./loader/io-locks");
|
|
51
|
+
Object.defineProperty(exports, "CONFIG_YAML", { enumerable: true, get: function () { return io_locks_1.CONFIG_YAML; } });
|
|
52
|
+
Object.defineProperty(exports, "CONFIG_JSON", { enumerable: true, get: function () { return io_locks_1.CONFIG_JSON; } });
|
|
53
|
+
Object.defineProperty(exports, "CONFIG_LOCK", { enumerable: true, get: function () { return io_locks_1.CONFIG_LOCK; } });
|
|
54
|
+
Object.defineProperty(exports, "LOCK_STALE_MS", { enumerable: true, get: function () { return io_locks_1.LOCK_STALE_MS; } });
|
|
55
|
+
Object.defineProperty(exports, "GO_DURATION_SEGMENT", { enumerable: true, get: function () { return io_locks_1.GO_DURATION_SEGMENT; } });
|
|
56
|
+
Object.defineProperty(exports, "GO_DURATION_PATTERN", { enumerable: true, get: function () { return io_locks_1.GO_DURATION_PATTERN; } });
|
|
57
|
+
Object.defineProperty(exports, "getConfigYamlPath", { enumerable: true, get: function () { return io_locks_1.getConfigYamlPath; } });
|
|
58
|
+
Object.defineProperty(exports, "getConfigJsonPath", { enumerable: true, get: function () { return io_locks_1.getConfigJsonPath; } });
|
|
59
|
+
Object.defineProperty(exports, "acquireLock", { enumerable: true, get: function () { return io_locks_1.acquireLock; } });
|
|
60
|
+
Object.defineProperty(exports, "releaseLock", { enumerable: true, get: function () { return io_locks_1.releaseLock; } });
|
|
61
|
+
Object.defineProperty(exports, "hasUnifiedConfig", { enumerable: true, get: function () { return io_locks_1.hasUnifiedConfig; } });
|
|
62
|
+
Object.defineProperty(exports, "hasLegacyConfig", { enumerable: true, get: function () { return io_locks_1.hasLegacyConfig; } });
|
|
63
|
+
Object.defineProperty(exports, "sleepSync", { enumerable: true, get: function () { return io_locks_1.sleepSync; } });
|
|
64
|
+
Object.defineProperty(exports, "withConfigWriteLock", { enumerable: true, get: function () { return io_locks_1.withConfigWriteLock; } });
|
|
65
|
+
const io_locks_2 = require("./loader/io-locks");
|
|
66
|
+
// ---------------------------------------------------------------------------
|
|
67
|
+
// Phase 2 re-exports: normalizers
|
|
68
|
+
// ---------------------------------------------------------------------------
|
|
69
|
+
var normalizers_1 = require("./loader/normalizers");
|
|
70
|
+
Object.defineProperty(exports, "normalizeBrowserDevtoolsPort", { enumerable: true, get: function () { return normalizers_1.normalizeBrowserDevtoolsPort; } });
|
|
71
|
+
Object.defineProperty(exports, "normalizeBrowserPolicy", { enumerable: true, get: function () { return normalizers_1.normalizeBrowserPolicy; } });
|
|
72
|
+
Object.defineProperty(exports, "normalizeBrowserEvalMode", { enumerable: true, get: function () { return normalizers_1.normalizeBrowserEvalMode; } });
|
|
73
|
+
Object.defineProperty(exports, "canonicalizeBrowserConfig", { enumerable: true, get: function () { return normalizers_1.canonicalizeBrowserConfig; } });
|
|
74
|
+
Object.defineProperty(exports, "normalizeSessionAffinityTtl", { enumerable: true, get: function () { return normalizers_1.normalizeSessionAffinityTtl; } });
|
|
75
|
+
Object.defineProperty(exports, "hasPositiveDuration", { enumerable: true, get: function () { return normalizers_1.hasPositiveDuration; } });
|
|
76
|
+
Object.defineProperty(exports, "validateCompositeVariants", { enumerable: true, get: function () { return normalizers_1.validateCompositeVariants; } });
|
|
77
|
+
Object.defineProperty(exports, "normalizeContinuityInheritanceMap", { enumerable: true, get: function () { return normalizers_1.normalizeContinuityInheritanceMap; } });
|
|
78
|
+
Object.defineProperty(exports, "normalizeContinuityConfig", { enumerable: true, get: function () { return normalizers_1.normalizeContinuityConfig; } });
|
|
79
|
+
Object.defineProperty(exports, "normalizeOfficialChannelsConfig", { enumerable: true, get: function () { return normalizers_1.normalizeOfficialChannelsConfig; } });
|
|
80
|
+
const normalizers_2 = require("./loader/normalizers");
|
|
81
|
+
// ---------------------------------------------------------------------------
|
|
82
|
+
// Phase 3 re-exports: yaml-serializer
|
|
83
|
+
// ---------------------------------------------------------------------------
|
|
84
|
+
var yaml_serializer_1 = require("./loader/yaml-serializer");
|
|
85
|
+
Object.defineProperty(exports, "generateYamlHeader", { enumerable: true, get: function () { return yaml_serializer_1.generateYamlHeader; } });
|
|
86
|
+
Object.defineProperty(exports, "generateYamlWithComments", { enumerable: true, get: function () { return yaml_serializer_1.generateYamlWithComments; } });
|
|
87
|
+
const yaml_serializer_2 = require("./loader/yaml-serializer");
|
|
88
|
+
// ---------------------------------------------------------------------------
|
|
89
|
+
// Phase 4 re-exports: defaults-merger
|
|
90
|
+
// ---------------------------------------------------------------------------
|
|
91
|
+
var defaults_merger_1 = require("./loader/defaults-merger");
|
|
92
|
+
Object.defineProperty(exports, "mergeWithDefaults", { enumerable: true, get: function () { return defaults_merger_1.mergeWithDefaults; } });
|
|
93
|
+
const defaults_merger_2 = require("./loader/defaults-merger");
|
|
94
|
+
var config_getters_1 = require("./loader/config-getters");
|
|
95
|
+
Object.defineProperty(exports, "getWebSearchConfig", { enumerable: true, get: function () { return config_getters_1.getWebSearchConfig; } });
|
|
96
|
+
Object.defineProperty(exports, "getGlobalEnvConfig", { enumerable: true, get: function () { return config_getters_1.getGlobalEnvConfig; } });
|
|
97
|
+
Object.defineProperty(exports, "getContinuityInheritanceMap", { enumerable: true, get: function () { return config_getters_1.getContinuityInheritanceMap; } });
|
|
98
|
+
Object.defineProperty(exports, "getCliproxySafetyConfig", { enumerable: true, get: function () { return config_getters_1.getCliproxySafetyConfig; } });
|
|
99
|
+
Object.defineProperty(exports, "getThinkingConfig", { enumerable: true, get: function () { return config_getters_1.getThinkingConfig; } });
|
|
100
|
+
Object.defineProperty(exports, "getOfficialChannelsConfig", { enumerable: true, get: function () { return config_getters_1.getOfficialChannelsConfig; } });
|
|
101
|
+
Object.defineProperty(exports, "isDashboardAuthEnabled", { enumerable: true, get: function () { return config_getters_1.isDashboardAuthEnabled; } });
|
|
102
|
+
Object.defineProperty(exports, "getDashboardAuthConfig", { enumerable: true, get: function () { return config_getters_1.getDashboardAuthConfig; } });
|
|
103
|
+
Object.defineProperty(exports, "getBrowserConfig", { enumerable: true, get: function () { return config_getters_1.getBrowserConfig; } });
|
|
104
|
+
Object.defineProperty(exports, "getImageAnalysisConfig", { enumerable: true, get: function () { return config_getters_1.getImageAnalysisConfig; } });
|
|
105
|
+
Object.defineProperty(exports, "getLoggingConfig", { enumerable: true, get: function () { return config_getters_1.getLoggingConfig; } });
|
|
106
|
+
Object.defineProperty(exports, "getCursorConfig", { enumerable: true, get: function () { return config_getters_1.getCursorConfig; } });
|
|
107
|
+
// ---------------------------------------------------------------------------
|
|
108
|
+
// getConfigFormat
|
|
109
|
+
// ---------------------------------------------------------------------------
|
|
211
110
|
/**
|
|
212
111
|
* Determine which config format is active.
|
|
213
112
|
* Returns 'yaml' if unified config exists or is enabled,
|
|
@@ -215,23 +114,25 @@ exports.hasLegacyConfig = hasLegacyConfig;
|
|
|
215
114
|
* 'none' if no config exists.
|
|
216
115
|
*/
|
|
217
116
|
function getConfigFormat() {
|
|
218
|
-
if (hasUnifiedConfig())
|
|
117
|
+
if ((0, io_locks_2.hasUnifiedConfig)())
|
|
219
118
|
return 'yaml';
|
|
220
119
|
if ((0, feature_flags_1.isUnifiedConfigEnabled)())
|
|
221
120
|
return 'yaml';
|
|
222
|
-
if (hasLegacyConfig())
|
|
121
|
+
if ((0, io_locks_2.hasLegacyConfig)())
|
|
223
122
|
return 'json';
|
|
224
123
|
return 'none';
|
|
225
124
|
}
|
|
226
125
|
exports.getConfigFormat = getConfigFormat;
|
|
126
|
+
// ---------------------------------------------------------------------------
|
|
127
|
+
// Core load / save / mutate
|
|
128
|
+
// ---------------------------------------------------------------------------
|
|
227
129
|
/**
|
|
228
130
|
* Load unified config from YAML file.
|
|
229
131
|
* Returns null if file doesn't exist.
|
|
230
132
|
* Auto-upgrades config if version is outdated (regenerates comments).
|
|
231
133
|
*/
|
|
232
134
|
function loadUnifiedConfig() {
|
|
233
|
-
const yamlPath = getConfigYamlPath();
|
|
234
|
-
// If file doesn't exist, return null
|
|
135
|
+
const yamlPath = (0, io_locks_2.getConfigYamlPath)();
|
|
235
136
|
if (!fs.existsSync(yamlPath)) {
|
|
236
137
|
return null;
|
|
237
138
|
}
|
|
@@ -243,8 +144,7 @@ function loadUnifiedConfig() {
|
|
|
243
144
|
}
|
|
244
145
|
// Auto-upgrade if version is outdated (regenerates YAML with new comments and fields)
|
|
245
146
|
if ((parsed.version ?? 1) < unified_config_types_1.UNIFIED_CONFIG_VERSION) {
|
|
246
|
-
|
|
247
|
-
const upgraded = mergeWithDefaults(parsed);
|
|
147
|
+
const upgraded = (0, defaults_merger_2.mergeWithDefaults)(parsed);
|
|
248
148
|
upgraded.version = unified_config_types_1.UNIFIED_CONFIG_VERSION;
|
|
249
149
|
try {
|
|
250
150
|
saveUnifiedConfig(upgraded);
|
|
@@ -279,322 +179,6 @@ function loadUnifiedConfig() {
|
|
|
279
179
|
}
|
|
280
180
|
}
|
|
281
181
|
exports.loadUnifiedConfig = loadUnifiedConfig;
|
|
282
|
-
/**
|
|
283
|
-
* Validate composite variant provider strings.
|
|
284
|
-
* Warns about invalid providers in composite variant configurations.
|
|
285
|
-
*/
|
|
286
|
-
function validateCompositeVariants(config) {
|
|
287
|
-
const variants = config.cliproxy?.variants;
|
|
288
|
-
if (!variants)
|
|
289
|
-
return;
|
|
290
|
-
for (const [name, variant] of Object.entries(variants)) {
|
|
291
|
-
if ('type' in variant && variant.type === 'composite') {
|
|
292
|
-
const error = (0, composite_validator_1.validateCompositeTiers)(variant.tiers, {
|
|
293
|
-
defaultTier: variant.default_tier,
|
|
294
|
-
requireAllTiers: true,
|
|
295
|
-
});
|
|
296
|
-
if (error) {
|
|
297
|
-
console.warn(`[!] Variant '${name}': invalid composite config (${error})`);
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
/**
|
|
303
|
-
* Normalize continuity inheritance mapping payload.
|
|
304
|
-
* Keeps only non-empty string keys and values.
|
|
305
|
-
*/
|
|
306
|
-
function normalizeContinuityInheritanceMap(value) {
|
|
307
|
-
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
308
|
-
return undefined;
|
|
309
|
-
}
|
|
310
|
-
const normalized = {};
|
|
311
|
-
for (const [profileName, accountName] of Object.entries(value)) {
|
|
312
|
-
const normalizedProfile = profileName.trim();
|
|
313
|
-
const normalizedAccount = typeof accountName === 'string' ? accountName.trim() : '';
|
|
314
|
-
if (!normalizedProfile || !normalizedAccount) {
|
|
315
|
-
continue;
|
|
316
|
-
}
|
|
317
|
-
normalized[normalizedProfile] = normalizedAccount;
|
|
318
|
-
}
|
|
319
|
-
return Object.keys(normalized).length > 0 ? normalized : undefined;
|
|
320
|
-
}
|
|
321
|
-
/**
|
|
322
|
-
* Normalize continuity section.
|
|
323
|
-
* Supports legacy root key: continuity_inherit_from_account.
|
|
324
|
-
*/
|
|
325
|
-
function normalizeContinuityConfig(partial) {
|
|
326
|
-
const legacyMap = normalizeContinuityInheritanceMap(partial
|
|
327
|
-
.continuity_inherit_from_account);
|
|
328
|
-
const continuityMap = normalizeContinuityInheritanceMap(partial.continuity?.inherit_from_account);
|
|
329
|
-
if (!legacyMap && !continuityMap) {
|
|
330
|
-
return undefined;
|
|
331
|
-
}
|
|
332
|
-
return {
|
|
333
|
-
inherit_from_account: {
|
|
334
|
-
...(legacyMap ?? {}),
|
|
335
|
-
...(continuityMap ?? {}),
|
|
336
|
-
},
|
|
337
|
-
};
|
|
338
|
-
}
|
|
339
|
-
function normalizeOfficialChannelsConfig(partial) {
|
|
340
|
-
const hasCanonicalChannelsSection = partial.channels !== undefined;
|
|
341
|
-
const hasExplicitSelectedField = hasCanonicalChannelsSection &&
|
|
342
|
-
Object.prototype.hasOwnProperty.call(partial.channels, 'selected');
|
|
343
|
-
const rawSelected = hasExplicitSelectedField && Array.isArray(partial.channels?.selected)
|
|
344
|
-
? partial.channels.selected.filter((value) => (0, official_channels_runtime_1.isOfficialChannelId)(value))
|
|
345
|
-
: [];
|
|
346
|
-
return {
|
|
347
|
-
selected: hasCanonicalChannelsSection
|
|
348
|
-
? (0, official_channels_runtime_1.normalizeOfficialChannelIds)(rawSelected)
|
|
349
|
-
: (0, official_channels_runtime_1.resolveLegacyDiscordSelection)(partial.discord_channels?.enabled),
|
|
350
|
-
unattended: partial.channels?.unattended ??
|
|
351
|
-
partial.discord_channels?.unattended ??
|
|
352
|
-
unified_config_types_1.DEFAULT_OFFICIAL_CHANNELS_CONFIG.unattended,
|
|
353
|
-
};
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* Merge partial config with defaults.
|
|
357
|
-
* Preserves existing data while filling in missing sections.
|
|
358
|
-
*/
|
|
359
|
-
function mergeWithDefaults(partial) {
|
|
360
|
-
const defaults = (0, unified_config_types_1.createEmptyUnifiedConfig)();
|
|
361
|
-
const continuity = normalizeContinuityConfig(partial);
|
|
362
|
-
return {
|
|
363
|
-
version: partial.version ?? defaults.version,
|
|
364
|
-
setup_completed: partial.setup_completed,
|
|
365
|
-
default: partial.default ?? defaults.default,
|
|
366
|
-
accounts: partial.accounts ?? defaults.accounts,
|
|
367
|
-
profiles: partial.profiles ?? defaults.profiles,
|
|
368
|
-
cliproxy: {
|
|
369
|
-
...partial.cliproxy,
|
|
370
|
-
oauth_accounts: partial.cliproxy?.oauth_accounts ?? defaults.cliproxy.oauth_accounts,
|
|
371
|
-
providers: defaults.cliproxy.providers, // Always use defaults for providers
|
|
372
|
-
variants: partial.cliproxy?.variants ?? defaults.cliproxy.variants,
|
|
373
|
-
logging: {
|
|
374
|
-
enabled: partial.cliproxy?.logging?.enabled ?? defaults.cliproxy.logging?.enabled ?? false,
|
|
375
|
-
request_log: partial.cliproxy?.logging?.request_log ?? defaults.cliproxy.logging?.request_log ?? false,
|
|
376
|
-
},
|
|
377
|
-
safety: {
|
|
378
|
-
antigravity_ack_bypass: partial.cliproxy?.safety?.antigravity_ack_bypass ??
|
|
379
|
-
unified_config_types_1.DEFAULT_CLIPROXY_SAFETY_CONFIG.antigravity_ack_bypass,
|
|
380
|
-
},
|
|
381
|
-
// Kiro browser behavior setting (optional)
|
|
382
|
-
kiro_no_incognito: partial.cliproxy?.kiro_no_incognito,
|
|
383
|
-
// Auth config - preserve user values, no defaults (uses constants as fallback)
|
|
384
|
-
auth: partial.cliproxy?.auth,
|
|
385
|
-
// Background token refresh config (optional)
|
|
386
|
-
token_refresh: partial.cliproxy?.token_refresh,
|
|
387
|
-
// Backend selection - validate and preserve user choice (original vs plus)
|
|
388
|
-
backend: partial.cliproxy?.backend === 'original' || partial.cliproxy?.backend === 'plus'
|
|
389
|
-
? partial.cliproxy.backend
|
|
390
|
-
: undefined, // Invalid values become undefined (defaults to 'original' at runtime)
|
|
391
|
-
// Auto-sync - default to true
|
|
392
|
-
auto_sync: partial.cliproxy?.auto_sync ?? defaults.cliproxy.auto_sync ?? true,
|
|
393
|
-
routing: {
|
|
394
|
-
strategy: partial.cliproxy?.routing?.strategy === 'fill-first' ||
|
|
395
|
-
partial.cliproxy?.routing?.strategy === 'round-robin'
|
|
396
|
-
? partial.cliproxy.routing.strategy
|
|
397
|
-
: defaults.cliproxy.routing?.strategy,
|
|
398
|
-
session_affinity: typeof partial.cliproxy?.routing?.session_affinity === 'boolean'
|
|
399
|
-
? partial.cliproxy.routing.session_affinity
|
|
400
|
-
: defaults.cliproxy.routing?.session_affinity,
|
|
401
|
-
session_affinity_ttl: normalizeSessionAffinityTtl(partial.cliproxy?.routing?.session_affinity_ttl, defaults.cliproxy.routing?.session_affinity_ttl ?? '1h'),
|
|
402
|
-
},
|
|
403
|
-
},
|
|
404
|
-
proxy: {
|
|
405
|
-
port: partial.proxy?.port ?? unified_config_types_1.DEFAULT_OPENAI_COMPAT_PROXY_CONFIG.port,
|
|
406
|
-
profile_ports: partial.proxy?.profile_ports ?? {
|
|
407
|
-
...unified_config_types_1.DEFAULT_OPENAI_COMPAT_PROXY_CONFIG.profile_ports,
|
|
408
|
-
},
|
|
409
|
-
routing: {
|
|
410
|
-
default: partial.proxy?.routing?.default ?? defaults.proxy?.routing?.default,
|
|
411
|
-
background: partial.proxy?.routing?.background ?? defaults.proxy?.routing?.background,
|
|
412
|
-
think: partial.proxy?.routing?.think ?? defaults.proxy?.routing?.think,
|
|
413
|
-
longContext: partial.proxy?.routing?.longContext ?? defaults.proxy?.routing?.longContext,
|
|
414
|
-
webSearch: partial.proxy?.routing?.webSearch ?? defaults.proxy?.routing?.webSearch,
|
|
415
|
-
longContextThreshold: partial.proxy?.routing?.longContextThreshold ??
|
|
416
|
-
defaults.proxy?.routing?.longContextThreshold,
|
|
417
|
-
},
|
|
418
|
-
},
|
|
419
|
-
logging: {
|
|
420
|
-
enabled: partial.logging?.enabled ?? unified_config_types_1.DEFAULT_LOGGING_CONFIG.enabled,
|
|
421
|
-
level: partial.logging?.level ?? unified_config_types_1.DEFAULT_LOGGING_CONFIG.level,
|
|
422
|
-
rotate_mb: partial.logging?.rotate_mb ?? unified_config_types_1.DEFAULT_LOGGING_CONFIG.rotate_mb,
|
|
423
|
-
retain_days: partial.logging?.retain_days ?? unified_config_types_1.DEFAULT_LOGGING_CONFIG.retain_days,
|
|
424
|
-
redact: partial.logging?.redact ?? unified_config_types_1.DEFAULT_LOGGING_CONFIG.redact,
|
|
425
|
-
live_buffer_size: partial.logging?.live_buffer_size ?? unified_config_types_1.DEFAULT_LOGGING_CONFIG.live_buffer_size,
|
|
426
|
-
},
|
|
427
|
-
preferences: {
|
|
428
|
-
...defaults.preferences,
|
|
429
|
-
...partial.preferences,
|
|
430
|
-
},
|
|
431
|
-
websearch: {
|
|
432
|
-
enabled: partial.websearch?.enabled ?? defaults.websearch?.enabled ?? true,
|
|
433
|
-
providers: {
|
|
434
|
-
exa: {
|
|
435
|
-
enabled: partial.websearch?.providers?.exa?.enabled ?? false,
|
|
436
|
-
max_results: partial.websearch?.providers?.exa?.max_results ?? 5,
|
|
437
|
-
},
|
|
438
|
-
tavily: {
|
|
439
|
-
enabled: partial.websearch?.providers?.tavily?.enabled ?? false,
|
|
440
|
-
max_results: partial.websearch?.providers?.tavily?.max_results ?? 5,
|
|
441
|
-
},
|
|
442
|
-
brave: {
|
|
443
|
-
enabled: partial.websearch?.providers?.brave?.enabled ?? false,
|
|
444
|
-
max_results: partial.websearch?.providers?.brave?.max_results ?? 5,
|
|
445
|
-
},
|
|
446
|
-
searxng: {
|
|
447
|
-
enabled: partial.websearch?.providers?.searxng?.enabled ?? false,
|
|
448
|
-
url: (0, types_1.normalizeSearxngBaseUrl)(partial.websearch?.providers?.searxng?.url) ?? '',
|
|
449
|
-
max_results: partial.websearch?.providers?.searxng?.max_results ?? 5,
|
|
450
|
-
},
|
|
451
|
-
duckduckgo: {
|
|
452
|
-
enabled: partial.websearch?.providers?.duckduckgo?.enabled ?? true,
|
|
453
|
-
max_results: partial.websearch?.providers?.duckduckgo?.max_results ?? 5,
|
|
454
|
-
},
|
|
455
|
-
gemini: {
|
|
456
|
-
enabled: partial.websearch?.providers?.gemini?.enabled ??
|
|
457
|
-
partial.websearch?.gemini?.enabled ?? // Legacy fallback
|
|
458
|
-
false,
|
|
459
|
-
model: partial.websearch?.providers?.gemini?.model ?? 'gemini-2.5-flash',
|
|
460
|
-
timeout: partial.websearch?.providers?.gemini?.timeout ??
|
|
461
|
-
partial.websearch?.gemini?.timeout ?? // Legacy fallback
|
|
462
|
-
55,
|
|
463
|
-
},
|
|
464
|
-
opencode: {
|
|
465
|
-
enabled: partial.websearch?.providers?.opencode?.enabled ?? false,
|
|
466
|
-
model: partial.websearch?.providers?.opencode?.model ?? 'opencode/grok-code',
|
|
467
|
-
timeout: partial.websearch?.providers?.opencode?.timeout ?? 90,
|
|
468
|
-
},
|
|
469
|
-
grok: {
|
|
470
|
-
enabled: partial.websearch?.providers?.grok?.enabled ?? false,
|
|
471
|
-
timeout: partial.websearch?.providers?.grok?.timeout ?? 55,
|
|
472
|
-
},
|
|
473
|
-
},
|
|
474
|
-
// Legacy fields (keep for backwards compatibility during read)
|
|
475
|
-
gemini: partial.websearch?.gemini,
|
|
476
|
-
},
|
|
477
|
-
// Copilot config - strictly opt-in, merge with defaults
|
|
478
|
-
copilot: {
|
|
479
|
-
enabled: partial.copilot?.enabled ?? unified_config_types_1.DEFAULT_COPILOT_CONFIG.enabled,
|
|
480
|
-
auto_start: partial.copilot?.auto_start ?? unified_config_types_1.DEFAULT_COPILOT_CONFIG.auto_start,
|
|
481
|
-
port: partial.copilot?.port ?? unified_config_types_1.DEFAULT_COPILOT_CONFIG.port,
|
|
482
|
-
account_type: partial.copilot?.account_type ?? unified_config_types_1.DEFAULT_COPILOT_CONFIG.account_type,
|
|
483
|
-
rate_limit: partial.copilot?.rate_limit ?? unified_config_types_1.DEFAULT_COPILOT_CONFIG.rate_limit,
|
|
484
|
-
wait_on_limit: partial.copilot?.wait_on_limit ?? unified_config_types_1.DEFAULT_COPILOT_CONFIG.wait_on_limit,
|
|
485
|
-
model: partial.copilot?.model ?? unified_config_types_1.DEFAULT_COPILOT_CONFIG.model,
|
|
486
|
-
},
|
|
487
|
-
// Cursor config - disabled by default, merge with defaults
|
|
488
|
-
cursor: {
|
|
489
|
-
enabled: partial.cursor?.enabled ?? unified_config_types_1.DEFAULT_CURSOR_CONFIG.enabled,
|
|
490
|
-
port: partial.cursor?.port ?? unified_config_types_1.DEFAULT_CURSOR_CONFIG.port,
|
|
491
|
-
auto_start: partial.cursor?.auto_start ?? unified_config_types_1.DEFAULT_CURSOR_CONFIG.auto_start,
|
|
492
|
-
ghost_mode: partial.cursor?.ghost_mode ?? unified_config_types_1.DEFAULT_CURSOR_CONFIG.ghost_mode,
|
|
493
|
-
model: partial.cursor?.model ?? unified_config_types_1.DEFAULT_CURSOR_CONFIG.model,
|
|
494
|
-
opus_model: partial.cursor?.opus_model,
|
|
495
|
-
sonnet_model: partial.cursor?.sonnet_model,
|
|
496
|
-
haiku_model: partial.cursor?.haiku_model,
|
|
497
|
-
},
|
|
498
|
-
// Global env - injected into all non-Claude subscription profiles
|
|
499
|
-
global_env: {
|
|
500
|
-
enabled: partial.global_env?.enabled ?? true,
|
|
501
|
-
env: partial.global_env?.env ?? { ...unified_config_types_1.DEFAULT_GLOBAL_ENV },
|
|
502
|
-
},
|
|
503
|
-
continuity,
|
|
504
|
-
// CLIProxy server config - remote/local CLIProxyAPI settings
|
|
505
|
-
cliproxy_server: {
|
|
506
|
-
remote: {
|
|
507
|
-
enabled: partial.cliproxy_server?.remote?.enabled ?? unified_config_types_1.DEFAULT_CLIPROXY_SERVER_CONFIG.remote.enabled,
|
|
508
|
-
host: partial.cliproxy_server?.remote?.host ?? unified_config_types_1.DEFAULT_CLIPROXY_SERVER_CONFIG.remote.host,
|
|
509
|
-
// Port is optional - undefined means use protocol default (443 for HTTPS, 8317 for HTTP)
|
|
510
|
-
port: partial.cliproxy_server?.remote?.port,
|
|
511
|
-
protocol: partial.cliproxy_server?.remote?.protocol ??
|
|
512
|
-
unified_config_types_1.DEFAULT_CLIPROXY_SERVER_CONFIG.remote.protocol,
|
|
513
|
-
auth_token: partial.cliproxy_server?.remote?.auth_token ??
|
|
514
|
-
unified_config_types_1.DEFAULT_CLIPROXY_SERVER_CONFIG.remote.auth_token,
|
|
515
|
-
// management_key is optional - falls back to auth_token when not set
|
|
516
|
-
management_key: partial.cliproxy_server?.remote?.management_key,
|
|
517
|
-
},
|
|
518
|
-
fallback: {
|
|
519
|
-
enabled: partial.cliproxy_server?.fallback?.enabled ??
|
|
520
|
-
unified_config_types_1.DEFAULT_CLIPROXY_SERVER_CONFIG.fallback.enabled,
|
|
521
|
-
auto_start: partial.cliproxy_server?.fallback?.auto_start ??
|
|
522
|
-
unified_config_types_1.DEFAULT_CLIPROXY_SERVER_CONFIG.fallback.auto_start,
|
|
523
|
-
},
|
|
524
|
-
local: {
|
|
525
|
-
port: partial.cliproxy_server?.local?.port ?? unified_config_types_1.DEFAULT_CLIPROXY_SERVER_CONFIG.local.port,
|
|
526
|
-
auto_start: partial.cliproxy_server?.local?.auto_start ??
|
|
527
|
-
unified_config_types_1.DEFAULT_CLIPROXY_SERVER_CONFIG.local.auto_start,
|
|
528
|
-
},
|
|
529
|
-
},
|
|
530
|
-
// Quota management config - hybrid auto+manual account selection
|
|
531
|
-
quota_management: {
|
|
532
|
-
mode: partial.quota_management?.mode ?? unified_config_types_1.DEFAULT_QUOTA_MANAGEMENT_CONFIG.mode,
|
|
533
|
-
auto: {
|
|
534
|
-
preflight_check: partial.quota_management?.auto?.preflight_check ??
|
|
535
|
-
unified_config_types_1.DEFAULT_QUOTA_MANAGEMENT_CONFIG.auto.preflight_check,
|
|
536
|
-
exhaustion_threshold: partial.quota_management?.auto?.exhaustion_threshold ??
|
|
537
|
-
unified_config_types_1.DEFAULT_QUOTA_MANAGEMENT_CONFIG.auto.exhaustion_threshold,
|
|
538
|
-
tier_priority: partial.quota_management?.auto?.tier_priority ??
|
|
539
|
-
unified_config_types_1.DEFAULT_QUOTA_MANAGEMENT_CONFIG.auto.tier_priority,
|
|
540
|
-
cooldown_minutes: partial.quota_management?.auto?.cooldown_minutes ??
|
|
541
|
-
unified_config_types_1.DEFAULT_QUOTA_MANAGEMENT_CONFIG.auto.cooldown_minutes,
|
|
542
|
-
},
|
|
543
|
-
manual: {
|
|
544
|
-
paused_accounts: partial.quota_management?.manual?.paused_accounts ??
|
|
545
|
-
unified_config_types_1.DEFAULT_QUOTA_MANAGEMENT_CONFIG.manual.paused_accounts,
|
|
546
|
-
forced_default: partial.quota_management?.manual?.forced_default ??
|
|
547
|
-
unified_config_types_1.DEFAULT_QUOTA_MANAGEMENT_CONFIG.manual.forced_default,
|
|
548
|
-
tier_lock: partial.quota_management?.manual?.tier_lock ??
|
|
549
|
-
unified_config_types_1.DEFAULT_QUOTA_MANAGEMENT_CONFIG.manual.tier_lock,
|
|
550
|
-
},
|
|
551
|
-
runtime_monitor: {
|
|
552
|
-
enabled: partial.quota_management?.runtime_monitor?.enabled ??
|
|
553
|
-
unified_config_types_1.DEFAULT_QUOTA_MANAGEMENT_CONFIG.runtime_monitor.enabled,
|
|
554
|
-
normal_interval_seconds: partial.quota_management?.runtime_monitor?.normal_interval_seconds ??
|
|
555
|
-
unified_config_types_1.DEFAULT_QUOTA_MANAGEMENT_CONFIG.runtime_monitor.normal_interval_seconds,
|
|
556
|
-
critical_interval_seconds: partial.quota_management?.runtime_monitor?.critical_interval_seconds ??
|
|
557
|
-
unified_config_types_1.DEFAULT_QUOTA_MANAGEMENT_CONFIG.runtime_monitor.critical_interval_seconds,
|
|
558
|
-
warn_threshold: partial.quota_management?.runtime_monitor?.warn_threshold ??
|
|
559
|
-
unified_config_types_1.DEFAULT_QUOTA_MANAGEMENT_CONFIG.runtime_monitor.warn_threshold,
|
|
560
|
-
exhaustion_threshold: partial.quota_management?.runtime_monitor?.exhaustion_threshold ??
|
|
561
|
-
unified_config_types_1.DEFAULT_QUOTA_MANAGEMENT_CONFIG.runtime_monitor.exhaustion_threshold,
|
|
562
|
-
cooldown_minutes: partial.quota_management?.runtime_monitor?.cooldown_minutes ??
|
|
563
|
-
unified_config_types_1.DEFAULT_QUOTA_MANAGEMENT_CONFIG.runtime_monitor.cooldown_minutes,
|
|
564
|
-
},
|
|
565
|
-
},
|
|
566
|
-
// Thinking config - auto/manual/off control for reasoning budget
|
|
567
|
-
thinking: {
|
|
568
|
-
mode: partial.thinking?.mode ?? unified_config_types_1.DEFAULT_THINKING_CONFIG.mode,
|
|
569
|
-
override: partial.thinking?.override,
|
|
570
|
-
tier_defaults: {
|
|
571
|
-
opus: partial.thinking?.tier_defaults?.opus ?? unified_config_types_1.DEFAULT_THINKING_CONFIG.tier_defaults.opus,
|
|
572
|
-
sonnet: partial.thinking?.tier_defaults?.sonnet ?? unified_config_types_1.DEFAULT_THINKING_CONFIG.tier_defaults.sonnet,
|
|
573
|
-
haiku: partial.thinking?.tier_defaults?.haiku ?? unified_config_types_1.DEFAULT_THINKING_CONFIG.tier_defaults.haiku,
|
|
574
|
-
},
|
|
575
|
-
provider_overrides: partial.thinking?.provider_overrides,
|
|
576
|
-
show_warnings: partial.thinking?.show_warnings ?? unified_config_types_1.DEFAULT_THINKING_CONFIG.show_warnings,
|
|
577
|
-
},
|
|
578
|
-
channels: normalizeOfficialChannelsConfig(partial),
|
|
579
|
-
// Dashboard auth config - disabled by default
|
|
580
|
-
dashboard_auth: {
|
|
581
|
-
enabled: partial.dashboard_auth?.enabled ?? unified_config_types_1.DEFAULT_DASHBOARD_AUTH_CONFIG.enabled,
|
|
582
|
-
username: partial.dashboard_auth?.username ?? unified_config_types_1.DEFAULT_DASHBOARD_AUTH_CONFIG.username,
|
|
583
|
-
password_hash: partial.dashboard_auth?.password_hash ?? unified_config_types_1.DEFAULT_DASHBOARD_AUTH_CONFIG.password_hash,
|
|
584
|
-
session_timeout_hours: partial.dashboard_auth?.session_timeout_hours ??
|
|
585
|
-
unified_config_types_1.DEFAULT_DASHBOARD_AUTH_CONFIG.session_timeout_hours,
|
|
586
|
-
},
|
|
587
|
-
browser: canonicalizeBrowserConfig(partial.browser),
|
|
588
|
-
// Image analysis config - enabled by default for CLIProxy providers
|
|
589
|
-
image_analysis: (0, image_analysis_backend_resolver_1.canonicalizeImageAnalysisConfig)({
|
|
590
|
-
enabled: partial.image_analysis?.enabled ?? unified_config_types_1.DEFAULT_IMAGE_ANALYSIS_CONFIG.enabled,
|
|
591
|
-
timeout: partial.image_analysis?.timeout ?? unified_config_types_1.DEFAULT_IMAGE_ANALYSIS_CONFIG.timeout,
|
|
592
|
-
provider_models: partial.image_analysis?.provider_models ?? unified_config_types_1.DEFAULT_IMAGE_ANALYSIS_CONFIG.provider_models,
|
|
593
|
-
fallback_backend: partial.image_analysis?.fallback_backend ?? unified_config_types_1.DEFAULT_IMAGE_ANALYSIS_CONFIG.fallback_backend,
|
|
594
|
-
profile_backends: partial.image_analysis?.profile_backends ?? unified_config_types_1.DEFAULT_IMAGE_ANALYSIS_CONFIG.profile_backends,
|
|
595
|
-
}),
|
|
596
|
-
};
|
|
597
|
-
}
|
|
598
182
|
/**
|
|
599
183
|
* Load config, preferring YAML if available, falling back to creating empty config.
|
|
600
184
|
* Merges with defaults to ensure all sections exist.
|
|
@@ -602,387 +186,21 @@ function mergeWithDefaults(partial) {
|
|
|
602
186
|
function loadOrCreateUnifiedConfig() {
|
|
603
187
|
const existing = loadUnifiedConfig();
|
|
604
188
|
if (existing) {
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
// Validate composite variant provider strings
|
|
608
|
-
validateCompositeVariants(merged);
|
|
189
|
+
const merged = (0, defaults_merger_2.mergeWithDefaults)(existing);
|
|
190
|
+
(0, normalizers_2.validateCompositeVariants)(merged);
|
|
609
191
|
return merged;
|
|
610
192
|
}
|
|
611
|
-
|
|
612
|
-
const config = (0, unified_config_types_1.createEmptyUnifiedConfig)();
|
|
613
|
-
return config;
|
|
193
|
+
return (0, unified_config_types_1.createEmptyUnifiedConfig)();
|
|
614
194
|
}
|
|
615
195
|
exports.loadOrCreateUnifiedConfig = loadOrCreateUnifiedConfig;
|
|
616
|
-
/**
|
|
617
|
-
* Generate YAML header with helpful comments.
|
|
618
|
-
*/
|
|
619
|
-
function generateYamlHeader() {
|
|
620
|
-
return `# CCS Unified Configuration
|
|
621
|
-
# Docs: https://github.com/kaitranntt/ccs
|
|
622
|
-
`;
|
|
623
|
-
}
|
|
624
|
-
/**
|
|
625
|
-
* Generate YAML content with section comments for better readability.
|
|
626
|
-
*/
|
|
627
|
-
function generateYamlWithComments(config) {
|
|
628
|
-
const lines = [];
|
|
629
|
-
// Version
|
|
630
|
-
lines.push(`version: ${config.version}`);
|
|
631
|
-
if (config.setup_completed !== undefined) {
|
|
632
|
-
lines.push(`setup_completed: ${config.setup_completed}`);
|
|
633
|
-
}
|
|
634
|
-
lines.push('');
|
|
635
|
-
// Default
|
|
636
|
-
if (config.default) {
|
|
637
|
-
lines.push(`# Default profile used when running 'ccs' without arguments`);
|
|
638
|
-
lines.push(`default: "${config.default}"`);
|
|
639
|
-
lines.push('');
|
|
640
|
-
}
|
|
641
|
-
// Accounts section
|
|
642
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
643
|
-
lines.push('# Accounts: Isolated Claude instances (each with separate auth/sessions)');
|
|
644
|
-
lines.push('# Manage with: ccs auth add <name>, ccs auth list, ccs auth remove <name>');
|
|
645
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
646
|
-
lines.push(yaml.dump({ accounts: config.accounts }, { indent: 2, lineWidth: -1, quotingType: '"' }).trim());
|
|
647
|
-
lines.push('');
|
|
648
|
-
// Profiles section
|
|
649
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
650
|
-
lines.push('# Profiles: API-based providers (GLM, Kimi, custom endpoints)');
|
|
651
|
-
lines.push('# Each profile points to a *.settings.json file containing env vars.');
|
|
652
|
-
lines.push('# Edit the settings file directly to customize (ANTHROPIC_MAX_TOKENS, etc.)');
|
|
653
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
654
|
-
lines.push(yaml.dump({ profiles: config.profiles }, { indent: 2, lineWidth: -1, quotingType: '"' }).trim());
|
|
655
|
-
lines.push('');
|
|
656
|
-
// CLIProxy section
|
|
657
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
658
|
-
lines.push('# CLIProxy: OAuth-based providers (gemini, codex, agy, qwen, iflow)');
|
|
659
|
-
lines.push('# Each variant can reference a *.settings.json file for custom env vars.');
|
|
660
|
-
lines.push('# Edit the settings file directly to customize model or other settings.');
|
|
661
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
662
|
-
lines.push(yaml.dump({ cliproxy: config.cliproxy }, { indent: 2, lineWidth: -1, quotingType: '"' }).trim());
|
|
663
|
-
lines.push('');
|
|
664
|
-
if (config.proxy?.routing) {
|
|
665
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
666
|
-
lines.push('# Proxy Routing: OpenAI-compatible local proxy model selection rules');
|
|
667
|
-
lines.push('# Use profile:model selectors to force a target profile and upstream model.');
|
|
668
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
669
|
-
lines.push(yaml.dump({ proxy: config.proxy }, { indent: 2, lineWidth: -1, quotingType: '"' }).trim());
|
|
670
|
-
lines.push('');
|
|
671
|
-
}
|
|
672
|
-
if (config.logging) {
|
|
673
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
674
|
-
lines.push('# Logging: CCS-owned structured runtime logs');
|
|
675
|
-
lines.push('# Current file: ~/.ccs/logs/current.jsonl');
|
|
676
|
-
lines.push('# Archives rotate automatically and are pruned by retain_days.');
|
|
677
|
-
lines.push('# This is separate from cliproxy.logging, which controls CLIProxy runtime files.');
|
|
678
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
679
|
-
lines.push(yaml.dump({ logging: config.logging }, { indent: 2, lineWidth: -1, quotingType: '"' }).trim());
|
|
680
|
-
lines.push('');
|
|
681
|
-
}
|
|
682
|
-
// CLIProxy Server section (remote proxy configuration) - placed right after cliproxy
|
|
683
|
-
if (config.cliproxy_server) {
|
|
684
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
685
|
-
lines.push('# CLIProxy Server: Remote proxy connection settings');
|
|
686
|
-
lines.push('# Configure via Dashboard (`ccs config`) > Proxy tab.');
|
|
687
|
-
lines.push('#');
|
|
688
|
-
lines.push('# remote: Connect to a remote CLIProxyAPI instance');
|
|
689
|
-
lines.push('# fallback: Use local proxy if remote is unreachable');
|
|
690
|
-
lines.push('# local: Local proxy settings (port, auto-start)');
|
|
691
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
692
|
-
lines.push(yaml
|
|
693
|
-
.dump({ cliproxy_server: config.cliproxy_server }, { indent: 2, lineWidth: -1, quotingType: '"' })
|
|
694
|
-
.trim());
|
|
695
|
-
lines.push('');
|
|
696
|
-
}
|
|
697
|
-
// Preferences section
|
|
698
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
699
|
-
lines.push('# Preferences: User settings');
|
|
700
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
701
|
-
lines.push(yaml
|
|
702
|
-
.dump({ preferences: config.preferences }, { indent: 2, lineWidth: -1, quotingType: '"' })
|
|
703
|
-
.trim());
|
|
704
|
-
lines.push('');
|
|
705
|
-
// WebSearch section
|
|
706
|
-
if (config.websearch) {
|
|
707
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
708
|
-
lines.push('# WebSearch: real search backends for third-party profiles');
|
|
709
|
-
lines.push('# Dashboard (`ccs config`) is the source of truth for provider selection.');
|
|
710
|
-
lines.push('#');
|
|
711
|
-
lines.push('# Third-party providers (gemini, codex, agy, etc.) do not have access to');
|
|
712
|
-
lines.push("# Anthropic's WebSearch tool. CCS intercepts that tool and runs local search.");
|
|
713
|
-
lines.push('#');
|
|
714
|
-
lines.push('# Priority: Exa -> Tavily -> Brave -> DuckDuckGo -> optional legacy AI CLI fallbacks');
|
|
715
|
-
lines.push('#');
|
|
716
|
-
lines.push('# Exa requires EXA_API_KEY in your environment.');
|
|
717
|
-
lines.push('# Tavily requires TAVILY_API_KEY in your environment.');
|
|
718
|
-
lines.push('# Brave requires BRAVE_API_KEY in your environment.');
|
|
719
|
-
lines.push('# DuckDuckGo works with zero extra setup and is enabled by default.');
|
|
720
|
-
lines.push('#');
|
|
721
|
-
lines.push('# Legacy LLM fallbacks remain optional if you still want them:');
|
|
722
|
-
lines.push('# gemini: npm i -g @google/gemini-cli');
|
|
723
|
-
lines.push('# opencode: curl -fsSL https://opencode.ai/install | bash');
|
|
724
|
-
lines.push('# grok: npm i -g @vibe-kit/grok-cli');
|
|
725
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
726
|
-
lines.push(yaml
|
|
727
|
-
.dump({ websearch: config.websearch }, { indent: 2, lineWidth: -1, quotingType: '"' })
|
|
728
|
-
.trim());
|
|
729
|
-
lines.push('');
|
|
730
|
-
}
|
|
731
|
-
// Copilot section (GitHub Copilot proxy)
|
|
732
|
-
if (config.copilot) {
|
|
733
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
734
|
-
lines.push('# Copilot: GitHub Copilot API proxy (via copilot-api)');
|
|
735
|
-
lines.push('# Uses your existing GitHub Copilot subscription with Claude Code.');
|
|
736
|
-
lines.push('#');
|
|
737
|
-
lines.push('# !! DISCLAIMER - USE AT YOUR OWN RISK !!');
|
|
738
|
-
lines.push('# This uses an UNOFFICIAL reverse-engineered API.');
|
|
739
|
-
lines.push('# Excessive usage may trigger GitHub account restrictions.');
|
|
740
|
-
lines.push('# CCS provides NO WARRANTY and accepts NO RESPONSIBILITY for consequences.');
|
|
741
|
-
lines.push('#');
|
|
742
|
-
lines.push('# Setup: npx copilot-api auth (authenticate with GitHub)');
|
|
743
|
-
lines.push('# Usage: ccs copilot (switch to copilot profile)');
|
|
744
|
-
lines.push('#');
|
|
745
|
-
lines.push('# Models: claude-sonnet-4.5, claude-opus-4.5, gpt-5.1, gemini-2.5-pro');
|
|
746
|
-
lines.push('# Account types: individual, business, enterprise');
|
|
747
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
748
|
-
lines.push(yaml.dump({ copilot: config.copilot }, { indent: 2, lineWidth: -1, quotingType: '"' }).trim());
|
|
749
|
-
lines.push('');
|
|
750
|
-
}
|
|
751
|
-
// Cursor section (Cursor IDE proxy daemon)
|
|
752
|
-
if (config.cursor) {
|
|
753
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
754
|
-
lines.push('# Cursor: Cursor IDE proxy daemon');
|
|
755
|
-
lines.push('# Enables Cursor IDE integration via local proxy daemon.');
|
|
756
|
-
lines.push('#');
|
|
757
|
-
lines.push('# enabled: Enable/disable Cursor integration (default: false)');
|
|
758
|
-
lines.push('# port: Port for cursor proxy daemon (default: 20129)');
|
|
759
|
-
lines.push('# auto_start: Auto-start daemon when CCS starts (default: false)');
|
|
760
|
-
lines.push('# ghost_mode: Disable telemetry for privacy (default: true)');
|
|
761
|
-
lines.push('# model: Default model ID (used for ANTHROPIC_MODEL)');
|
|
762
|
-
lines.push('# opus_model/sonnet_model/haiku_model: Optional tier model mapping');
|
|
763
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
764
|
-
lines.push(yaml.dump({ cursor: config.cursor }, { indent: 2, lineWidth: -1, quotingType: '"' }).trim());
|
|
765
|
-
lines.push('');
|
|
766
|
-
}
|
|
767
|
-
// Global env section
|
|
768
|
-
if (config.global_env) {
|
|
769
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
770
|
-
lines.push('# Global Environment Variables: Injected into all non-Claude subscription profiles');
|
|
771
|
-
lines.push('# These env vars disable telemetry/reporting for third-party providers.');
|
|
772
|
-
lines.push('# Configure via Dashboard (`ccs config`) > Global Env tab.');
|
|
773
|
-
lines.push('#');
|
|
774
|
-
lines.push('# Default variables:');
|
|
775
|
-
lines.push('# DISABLE_BUG_COMMAND: Disables /bug command (not supported by proxy)');
|
|
776
|
-
lines.push('# DISABLE_ERROR_REPORTING: Disables error reporting to Anthropic');
|
|
777
|
-
lines.push('# DISABLE_TELEMETRY: Disables usage telemetry');
|
|
778
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
779
|
-
lines.push(yaml
|
|
780
|
-
.dump({ global_env: config.global_env }, { indent: 2, lineWidth: -1, quotingType: '"' })
|
|
781
|
-
.trim());
|
|
782
|
-
lines.push('');
|
|
783
|
-
}
|
|
784
|
-
// Continuity inheritance section
|
|
785
|
-
if (config.continuity?.inherit_from_account) {
|
|
786
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
787
|
-
lines.push('# Continuity Inheritance: Reuse account continuity artifacts across profiles');
|
|
788
|
-
lines.push('# Map execution profile names to source account profiles (CLAUDE_CONFIG_DIR).');
|
|
789
|
-
lines.push('# Applies to Claude target only; credentials remain profile-specific.');
|
|
790
|
-
lines.push('# Example: continuity.inherit_from_account.glm: pro');
|
|
791
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
792
|
-
lines.push(yaml
|
|
793
|
-
.dump({ continuity: config.continuity }, { indent: 2, lineWidth: -1, quotingType: '"' })
|
|
794
|
-
.trim());
|
|
795
|
-
lines.push('');
|
|
796
|
-
}
|
|
797
|
-
// Thinking section (extended thinking/reasoning configuration)
|
|
798
|
-
if (config.thinking) {
|
|
799
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
800
|
-
lines.push('# Thinking: Extended thinking/reasoning budget configuration');
|
|
801
|
-
lines.push('# Controls reasoning depth for supported providers (agy, gemini, codex).');
|
|
802
|
-
lines.push('#');
|
|
803
|
-
lines.push('# Modes: auto (use tier_defaults), off (disable), manual (--thinking/--effort flags)');
|
|
804
|
-
lines.push('# Levels: minimal (512), low (1K), medium (8K), high (24K), xhigh (32K), max (adaptive ceiling), auto');
|
|
805
|
-
lines.push('# Override: Set global override value (number or level name)');
|
|
806
|
-
lines.push('# Provider overrides: Per-provider tier defaults');
|
|
807
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
808
|
-
lines.push(yaml
|
|
809
|
-
.dump({ thinking: config.thinking }, { indent: 2, lineWidth: -1, quotingType: '"' })
|
|
810
|
-
.trim());
|
|
811
|
-
lines.push('');
|
|
812
|
-
}
|
|
813
|
-
// Official Channels section
|
|
814
|
-
if (config.channels) {
|
|
815
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
816
|
-
lines.push('# Official Channels: Runtime auto-enable for Anthropic official channel plugins');
|
|
817
|
-
lines.push('# Supported channels: telegram, discord, imessage');
|
|
818
|
-
lines.push('# Runtime-only: CCS injects --channels at launch for compatible Claude sessions.');
|
|
819
|
-
lines.push('# Bot tokens live in Claude channel env files, not in config.yaml.');
|
|
820
|
-
lines.push('# Use selected: [telegram, discord, imessage] to choose channels.');
|
|
821
|
-
lines.push('# unattended adds --dangerously-skip-permissions only when channel auto-enable is active.');
|
|
822
|
-
lines.push('# Compatible sessions: native Claude default/account profiles only.');
|
|
823
|
-
lines.push('# Configure via: ccs config channels or the Settings > Channels dashboard tab.');
|
|
824
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
825
|
-
lines.push(yaml
|
|
826
|
-
.dump({ channels: config.channels }, { indent: 2, lineWidth: -1, quotingType: '"' })
|
|
827
|
-
.trim());
|
|
828
|
-
lines.push('');
|
|
829
|
-
}
|
|
830
|
-
// Dashboard auth section (only if configured)
|
|
831
|
-
if (config.dashboard_auth?.enabled) {
|
|
832
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
833
|
-
lines.push('# Dashboard Auth: Optional login protection for CCS dashboard');
|
|
834
|
-
lines.push('# Generate password hash: npx bcrypt-cli hash "your-password"');
|
|
835
|
-
lines.push('# ENV override: CCS_DASHBOARD_AUTH_ENABLED, CCS_DASHBOARD_USERNAME, CCS_DASHBOARD_PASSWORD_HASH');
|
|
836
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
837
|
-
lines.push(yaml
|
|
838
|
-
.dump({ dashboard_auth: config.dashboard_auth }, { indent: 2, lineWidth: -1, quotingType: '"' })
|
|
839
|
-
.trim());
|
|
840
|
-
lines.push('');
|
|
841
|
-
}
|
|
842
|
-
// Browser automation section
|
|
843
|
-
if (config.browser) {
|
|
844
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
845
|
-
lines.push('# Browser Automation: Claude browser attach and Codex browser tooling');
|
|
846
|
-
lines.push('# Claude attach reuses a running Chrome/Chromium session with remote debugging.');
|
|
847
|
-
lines.push('# Codex tooling controls whether CCS injects Playwright MCP overrides.');
|
|
848
|
-
lines.push('#');
|
|
849
|
-
lines.push('# claude.user_data_dir should point at the Chrome user-data directory for the');
|
|
850
|
-
lines.push('# dedicated attach session. claude.devtools_port is the expected debugging port.');
|
|
851
|
-
lines.push('# Configure via: Settings > Browser or `ccs browser ...`.');
|
|
852
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
853
|
-
lines.push(yaml.dump({ browser: config.browser }, { indent: 2, lineWidth: -1, quotingType: '"' }).trim());
|
|
854
|
-
lines.push('');
|
|
855
|
-
}
|
|
856
|
-
// Image analysis section
|
|
857
|
-
if (config.image_analysis) {
|
|
858
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
859
|
-
lines.push('# Image Analysis: Vision-based analysis for images and PDFs');
|
|
860
|
-
lines.push('# Routes Read tool requests for images/PDFs through CLIProxy vision API.');
|
|
861
|
-
lines.push('#');
|
|
862
|
-
lines.push('# When enabled: Image files trigger vision analysis instead of raw file read');
|
|
863
|
-
lines.push('# Provider models: Vision model used for each CLIProxy provider');
|
|
864
|
-
lines.push('# Timeout: Maximum seconds to wait for analysis (10-600)');
|
|
865
|
-
lines.push('#');
|
|
866
|
-
lines.push('# Supported formats: .jpg, .jpeg, .png, .gif, .webp, .heic, .bmp, .tiff, .pdf');
|
|
867
|
-
lines.push('# Configure via: ccs config image-analysis');
|
|
868
|
-
lines.push('# ----------------------------------------------------------------------------');
|
|
869
|
-
lines.push(yaml
|
|
870
|
-
.dump({ image_analysis: config.image_analysis }, { indent: 2, lineWidth: -1, quotingType: '"' })
|
|
871
|
-
.trim());
|
|
872
|
-
lines.push('');
|
|
873
|
-
}
|
|
874
|
-
return lines.join('\n');
|
|
875
|
-
}
|
|
876
|
-
/**
|
|
877
|
-
* Sync sleep helper for lock retry loops.
|
|
878
|
-
* Uses Atomics.wait when available to avoid CPU-intensive busy-wait.
|
|
879
|
-
*/
|
|
880
|
-
function sleepSync(ms) {
|
|
881
|
-
try {
|
|
882
|
-
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
883
|
-
}
|
|
884
|
-
catch {
|
|
885
|
-
const end = Date.now() + ms;
|
|
886
|
-
while (Date.now() < end) {
|
|
887
|
-
/* busy-wait */
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
|
-
/**
|
|
892
|
-
* Execute a callback while holding the config lock.
|
|
893
|
-
*/
|
|
894
|
-
function withConfigWriteLock(callback) {
|
|
895
|
-
// Acquire lock (retry for up to 1 second)
|
|
896
|
-
const maxRetries = 10;
|
|
897
|
-
const retryDelayMs = 100;
|
|
898
|
-
let lockToken = null;
|
|
899
|
-
for (let i = 0; i < maxRetries; i++) {
|
|
900
|
-
const acquiredToken = acquireLock();
|
|
901
|
-
if (acquiredToken) {
|
|
902
|
-
lockToken = acquiredToken;
|
|
903
|
-
break;
|
|
904
|
-
}
|
|
905
|
-
sleepSync(retryDelayMs);
|
|
906
|
-
}
|
|
907
|
-
if (!lockToken) {
|
|
908
|
-
throw new Error('Config file is locked by another process. Wait a moment and try again.');
|
|
909
|
-
}
|
|
910
|
-
try {
|
|
911
|
-
return callback();
|
|
912
|
-
}
|
|
913
|
-
finally {
|
|
914
|
-
// Always release lock
|
|
915
|
-
releaseLock(lockToken);
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
/**
|
|
919
|
-
* Load unified config directly from disk while lock is already held.
|
|
920
|
-
* Falls back to empty config when file doesn't exist.
|
|
921
|
-
*/
|
|
922
|
-
function loadUnifiedConfigWithLockHeld() {
|
|
923
|
-
const yamlPath = getConfigYamlPath();
|
|
924
|
-
if (!fs.existsSync(yamlPath)) {
|
|
925
|
-
return (0, unified_config_types_1.createEmptyUnifiedConfig)();
|
|
926
|
-
}
|
|
927
|
-
const content = fs.readFileSync(yamlPath, 'utf8');
|
|
928
|
-
const parsed = yaml.load(content);
|
|
929
|
-
if (!(0, unified_config_types_1.isUnifiedConfig)(parsed)) {
|
|
930
|
-
throw new Error(`Invalid config format in ${yamlPath}`);
|
|
931
|
-
}
|
|
932
|
-
const merged = mergeWithDefaults(parsed);
|
|
933
|
-
validateCompositeVariants(merged);
|
|
934
|
-
return merged;
|
|
935
|
-
}
|
|
936
|
-
/**
|
|
937
|
-
* Write unified config to disk while lock is already held.
|
|
938
|
-
*/
|
|
939
|
-
function writeUnifiedConfigWithLockHeld(config) {
|
|
940
|
-
const yamlPath = getConfigYamlPath();
|
|
941
|
-
const dir = path.dirname(yamlPath);
|
|
942
|
-
// Ensure directory exists
|
|
943
|
-
if (!fs.existsSync(dir)) {
|
|
944
|
-
fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
945
|
-
}
|
|
946
|
-
// Ensure version is set
|
|
947
|
-
config.version = unified_config_types_1.UNIFIED_CONFIG_VERSION;
|
|
948
|
-
// Generate YAML with section comments
|
|
949
|
-
const yamlContent = generateYamlWithComments(config);
|
|
950
|
-
const content = generateYamlHeader() + yamlContent;
|
|
951
|
-
// Atomic write: write to temp file, then rename
|
|
952
|
-
const tempPath = `${yamlPath}.tmp.${process.pid}`;
|
|
953
|
-
try {
|
|
954
|
-
fs.writeFileSync(tempPath, content, { mode: 0o600 });
|
|
955
|
-
fs.renameSync(tempPath, yamlPath);
|
|
956
|
-
}
|
|
957
|
-
catch (error) {
|
|
958
|
-
// Clean up temp file on error
|
|
959
|
-
if (fs.existsSync(tempPath)) {
|
|
960
|
-
try {
|
|
961
|
-
fs.unlinkSync(tempPath);
|
|
962
|
-
}
|
|
963
|
-
catch {
|
|
964
|
-
// Ignore cleanup errors
|
|
965
|
-
}
|
|
966
|
-
}
|
|
967
|
-
// Classify filesystem errors
|
|
968
|
-
const err = error;
|
|
969
|
-
if (err.code === 'ENOSPC') {
|
|
970
|
-
throw new Error('Disk full - cannot save config. Free up space and try again.');
|
|
971
|
-
}
|
|
972
|
-
else if (err.code === 'EROFS' || err.code === 'EACCES') {
|
|
973
|
-
throw new Error(`Cannot write config - check file permissions: ${err.message}`);
|
|
974
|
-
}
|
|
975
|
-
throw error;
|
|
976
|
-
}
|
|
977
|
-
}
|
|
978
196
|
/**
|
|
979
197
|
* Save unified config to YAML file.
|
|
980
198
|
* Uses atomic write (temp file + rename) to prevent corruption.
|
|
981
199
|
* Uses lockfile to prevent concurrent writes.
|
|
982
200
|
*/
|
|
983
201
|
function saveUnifiedConfig(config) {
|
|
984
|
-
withConfigWriteLock(() => {
|
|
985
|
-
writeUnifiedConfigWithLockHeld(config);
|
|
202
|
+
(0, io_locks_2.withConfigWriteLock)(() => {
|
|
203
|
+
(0, io_locks_2.writeUnifiedConfigWithLockHeld)(config, yaml_serializer_2.generateYamlHeader, yaml_serializer_2.generateYamlWithComments);
|
|
986
204
|
});
|
|
987
205
|
}
|
|
988
206
|
exports.saveUnifiedConfig = saveUnifiedConfig;
|
|
@@ -991,16 +209,16 @@ exports.saveUnifiedConfig = saveUnifiedConfig;
|
|
|
991
209
|
* Prevents stale writes from overwriting concurrent updates.
|
|
992
210
|
*/
|
|
993
211
|
function mutateUnifiedConfig(mutator) {
|
|
994
|
-
return withConfigWriteLock(() => {
|
|
995
|
-
const current = loadUnifiedConfigWithLockHeld();
|
|
212
|
+
return (0, io_locks_2.withConfigWriteLock)(() => {
|
|
213
|
+
const current = (0, io_locks_2.loadUnifiedConfigWithLockHeld)(defaults_merger_2.mergeWithDefaults, normalizers_2.validateCompositeVariants);
|
|
996
214
|
const previousBrowser = current.browser
|
|
997
|
-
? canonicalizeBrowserConfig(current.browser)
|
|
215
|
+
? (0, normalizers_2.canonicalizeBrowserConfig)(current.browser)
|
|
998
216
|
: undefined;
|
|
999
217
|
mutator(current);
|
|
1000
218
|
if (current.browser) {
|
|
1001
|
-
current.browser = canonicalizeBrowserConfig(current.browser, previousBrowser);
|
|
219
|
+
current.browser = (0, normalizers_2.canonicalizeBrowserConfig)(current.browser, previousBrowser);
|
|
1002
220
|
}
|
|
1003
|
-
writeUnifiedConfigWithLockHeld(current);
|
|
221
|
+
(0, io_locks_2.writeUnifiedConfigWithLockHeld)(current, yaml_serializer_2.generateYamlHeader, yaml_serializer_2.generateYamlWithComments);
|
|
1004
222
|
return current;
|
|
1005
223
|
});
|
|
1006
224
|
}
|
|
@@ -1015,246 +233,30 @@ function updateUnifiedConfig(updates) {
|
|
|
1015
233
|
});
|
|
1016
234
|
}
|
|
1017
235
|
exports.updateUnifiedConfig = updateUnifiedConfig;
|
|
236
|
+
// ---------------------------------------------------------------------------
|
|
237
|
+
// Derived helpers
|
|
238
|
+
// ---------------------------------------------------------------------------
|
|
1018
239
|
/**
|
|
1019
240
|
* Check if unified config mode is active.
|
|
1020
241
|
* Returns true if config.yaml exists OR CCS_UNIFIED_CONFIG=1.
|
|
1021
|
-
*
|
|
1022
|
-
* Use this centralized function instead of duplicating the logic.
|
|
1023
242
|
*/
|
|
1024
243
|
function isUnifiedMode() {
|
|
1025
|
-
return hasUnifiedConfig() || (0, feature_flags_1.isUnifiedConfigEnabled)();
|
|
244
|
+
return (0, io_locks_2.hasUnifiedConfig)() || (0, feature_flags_1.isUnifiedConfigEnabled)();
|
|
1026
245
|
}
|
|
1027
246
|
exports.isUnifiedMode = isUnifiedMode;
|
|
1028
247
|
/**
|
|
1029
|
-
* Get
|
|
248
|
+
* Get default profile name from config.
|
|
1030
249
|
*/
|
|
1031
250
|
function getDefaultProfile() {
|
|
1032
251
|
const config = loadUnifiedConfig();
|
|
1033
252
|
return config?.default;
|
|
1034
253
|
}
|
|
1035
254
|
exports.getDefaultProfile = getDefaultProfile;
|
|
255
|
+
/**
|
|
256
|
+
* Set default profile name in config.
|
|
257
|
+
*/
|
|
1036
258
|
function setDefaultProfile(name) {
|
|
1037
259
|
updateUnifiedConfig({ default: name });
|
|
1038
260
|
}
|
|
1039
261
|
exports.setDefaultProfile = setDefaultProfile;
|
|
1040
|
-
/**
|
|
1041
|
-
* Get websearch configuration.
|
|
1042
|
-
* Returns defaults if not configured.
|
|
1043
|
-
* Supports deterministic providers and optional Gemini/OpenCode/Grok CLI fallbacks.
|
|
1044
|
-
*/
|
|
1045
|
-
function getWebSearchConfig() {
|
|
1046
|
-
const config = loadOrCreateUnifiedConfig();
|
|
1047
|
-
// Build provider configs
|
|
1048
|
-
const exaConfig = {
|
|
1049
|
-
enabled: config.websearch?.providers?.exa?.enabled ?? false,
|
|
1050
|
-
max_results: config.websearch?.providers?.exa?.max_results ?? 5,
|
|
1051
|
-
};
|
|
1052
|
-
const tavilyConfig = {
|
|
1053
|
-
enabled: config.websearch?.providers?.tavily?.enabled ?? false,
|
|
1054
|
-
max_results: config.websearch?.providers?.tavily?.max_results ?? 5,
|
|
1055
|
-
};
|
|
1056
|
-
const duckDuckGoConfig = {
|
|
1057
|
-
enabled: config.websearch?.providers?.duckduckgo?.enabled ?? true,
|
|
1058
|
-
max_results: config.websearch?.providers?.duckduckgo?.max_results ?? 5,
|
|
1059
|
-
};
|
|
1060
|
-
const braveConfig = {
|
|
1061
|
-
enabled: config.websearch?.providers?.brave?.enabled ?? false,
|
|
1062
|
-
max_results: config.websearch?.providers?.brave?.max_results ?? 5,
|
|
1063
|
-
};
|
|
1064
|
-
const searxngConfig = {
|
|
1065
|
-
enabled: config.websearch?.providers?.searxng?.enabled ?? false,
|
|
1066
|
-
url: (0, types_1.normalizeSearxngBaseUrl)(config.websearch?.providers?.searxng?.url) ?? '',
|
|
1067
|
-
max_results: config.websearch?.providers?.searxng?.max_results ?? 5,
|
|
1068
|
-
};
|
|
1069
|
-
const geminiConfig = {
|
|
1070
|
-
enabled: config.websearch?.providers?.gemini?.enabled ?? config.websearch?.gemini?.enabled ?? false,
|
|
1071
|
-
model: config.websearch?.providers?.gemini?.model ?? 'gemini-2.5-flash',
|
|
1072
|
-
timeout: config.websearch?.providers?.gemini?.timeout ?? config.websearch?.gemini?.timeout ?? 55,
|
|
1073
|
-
};
|
|
1074
|
-
const opencodeConfig = {
|
|
1075
|
-
enabled: config.websearch?.providers?.opencode?.enabled ?? false,
|
|
1076
|
-
model: config.websearch?.providers?.opencode?.model ?? 'opencode/grok-code',
|
|
1077
|
-
timeout: config.websearch?.providers?.opencode?.timeout ?? 90,
|
|
1078
|
-
};
|
|
1079
|
-
const grokConfig = {
|
|
1080
|
-
enabled: config.websearch?.providers?.grok?.enabled ?? false,
|
|
1081
|
-
timeout: config.websearch?.providers?.grok?.timeout ?? 55,
|
|
1082
|
-
};
|
|
1083
|
-
// Auto-enable master switch if ANY provider is enabled
|
|
1084
|
-
const anyProviderEnabled = exaConfig.enabled ||
|
|
1085
|
-
tavilyConfig.enabled ||
|
|
1086
|
-
braveConfig.enabled ||
|
|
1087
|
-
searxngConfig.enabled ||
|
|
1088
|
-
duckDuckGoConfig.enabled ||
|
|
1089
|
-
geminiConfig.enabled ||
|
|
1090
|
-
opencodeConfig.enabled ||
|
|
1091
|
-
grokConfig.enabled;
|
|
1092
|
-
const enabled = anyProviderEnabled && (config.websearch?.enabled ?? true);
|
|
1093
|
-
return {
|
|
1094
|
-
enabled,
|
|
1095
|
-
providers: {
|
|
1096
|
-
exa: exaConfig,
|
|
1097
|
-
tavily: tavilyConfig,
|
|
1098
|
-
brave: braveConfig,
|
|
1099
|
-
searxng: searxngConfig,
|
|
1100
|
-
duckduckgo: duckDuckGoConfig,
|
|
1101
|
-
gemini: geminiConfig,
|
|
1102
|
-
opencode: opencodeConfig,
|
|
1103
|
-
grok: grokConfig,
|
|
1104
|
-
},
|
|
1105
|
-
// Legacy field for backwards compatibility
|
|
1106
|
-
gemini: config.websearch?.gemini,
|
|
1107
|
-
};
|
|
1108
|
-
}
|
|
1109
|
-
exports.getWebSearchConfig = getWebSearchConfig;
|
|
1110
|
-
/**
|
|
1111
|
-
* Get global_env configuration.
|
|
1112
|
-
* Returns defaults if not configured.
|
|
1113
|
-
*/
|
|
1114
|
-
function getGlobalEnvConfig() {
|
|
1115
|
-
const config = loadOrCreateUnifiedConfig();
|
|
1116
|
-
return {
|
|
1117
|
-
enabled: config.global_env?.enabled ?? true,
|
|
1118
|
-
env: config.global_env?.env ?? { ...unified_config_types_1.DEFAULT_GLOBAL_ENV },
|
|
1119
|
-
};
|
|
1120
|
-
}
|
|
1121
|
-
exports.getGlobalEnvConfig = getGlobalEnvConfig;
|
|
1122
|
-
/**
|
|
1123
|
-
* Get continuity inheritance mapping.
|
|
1124
|
-
* Returns empty mapping when not configured.
|
|
1125
|
-
*/
|
|
1126
|
-
function getContinuityInheritanceMap() {
|
|
1127
|
-
const config = loadOrCreateUnifiedConfig();
|
|
1128
|
-
return config.continuity?.inherit_from_account ?? {};
|
|
1129
|
-
}
|
|
1130
|
-
exports.getContinuityInheritanceMap = getContinuityInheritanceMap;
|
|
1131
|
-
/**
|
|
1132
|
-
* Get cliproxy safety configuration.
|
|
1133
|
-
* Returns defaults if not configured.
|
|
1134
|
-
*/
|
|
1135
|
-
function getCliproxySafetyConfig() {
|
|
1136
|
-
const config = loadOrCreateUnifiedConfig();
|
|
1137
|
-
return {
|
|
1138
|
-
antigravity_ack_bypass: config.cliproxy?.safety?.antigravity_ack_bypass ??
|
|
1139
|
-
unified_config_types_1.DEFAULT_CLIPROXY_SAFETY_CONFIG.antigravity_ack_bypass,
|
|
1140
|
-
};
|
|
1141
|
-
}
|
|
1142
|
-
exports.getCliproxySafetyConfig = getCliproxySafetyConfig;
|
|
1143
|
-
/**
|
|
1144
|
-
* Get thinking configuration.
|
|
1145
|
-
* Returns defaults if not configured.
|
|
1146
|
-
*/
|
|
1147
|
-
function getThinkingConfig() {
|
|
1148
|
-
const config = loadOrCreateUnifiedConfig();
|
|
1149
|
-
// W2: Check for invalid thinking config (e.g., thinking: true instead of object)
|
|
1150
|
-
if (config.thinking !== undefined && typeof config.thinking !== 'object') {
|
|
1151
|
-
console.warn(`[!] Invalid thinking config: expected object, got ${typeof config.thinking}. Using defaults.`);
|
|
1152
|
-
console.warn(` Tip: Use 'thinking: { mode: auto }' instead of 'thinking: true'`);
|
|
1153
|
-
return unified_config_types_1.DEFAULT_THINKING_CONFIG;
|
|
1154
|
-
}
|
|
1155
|
-
return {
|
|
1156
|
-
mode: config.thinking?.mode ?? unified_config_types_1.DEFAULT_THINKING_CONFIG.mode,
|
|
1157
|
-
override: config.thinking?.override,
|
|
1158
|
-
tier_defaults: {
|
|
1159
|
-
opus: config.thinking?.tier_defaults?.opus ?? unified_config_types_1.DEFAULT_THINKING_CONFIG.tier_defaults.opus,
|
|
1160
|
-
sonnet: config.thinking?.tier_defaults?.sonnet ?? unified_config_types_1.DEFAULT_THINKING_CONFIG.tier_defaults.sonnet,
|
|
1161
|
-
haiku: config.thinking?.tier_defaults?.haiku ?? unified_config_types_1.DEFAULT_THINKING_CONFIG.tier_defaults.haiku,
|
|
1162
|
-
},
|
|
1163
|
-
provider_overrides: config.thinking?.provider_overrides,
|
|
1164
|
-
show_warnings: config.thinking?.show_warnings ?? unified_config_types_1.DEFAULT_THINKING_CONFIG.show_warnings,
|
|
1165
|
-
};
|
|
1166
|
-
}
|
|
1167
|
-
exports.getThinkingConfig = getThinkingConfig;
|
|
1168
|
-
/**
|
|
1169
|
-
* Get Official Channels configuration.
|
|
1170
|
-
* Returns defaults if not configured.
|
|
1171
|
-
*/
|
|
1172
|
-
function getOfficialChannelsConfig() {
|
|
1173
|
-
const config = loadOrCreateUnifiedConfig();
|
|
1174
|
-
return {
|
|
1175
|
-
selected: config.channels?.selected && config.channels.selected.length > 0
|
|
1176
|
-
? (0, official_channels_runtime_1.normalizeOfficialChannelIds)(config.channels.selected)
|
|
1177
|
-
: unified_config_types_1.DEFAULT_OFFICIAL_CHANNELS_CONFIG.selected,
|
|
1178
|
-
unattended: config.channels?.unattended ?? unified_config_types_1.DEFAULT_OFFICIAL_CHANNELS_CONFIG.unattended,
|
|
1179
|
-
};
|
|
1180
|
-
}
|
|
1181
|
-
exports.getOfficialChannelsConfig = getOfficialChannelsConfig;
|
|
1182
|
-
/**
|
|
1183
|
-
* Get dashboard_auth configuration with ENV var override.
|
|
1184
|
-
* Priority: ENV vars > config.yaml > defaults
|
|
1185
|
-
*/
|
|
1186
|
-
function isDashboardAuthEnabled() {
|
|
1187
|
-
const envEnabled = process.env.CCS_DASHBOARD_AUTH_ENABLED;
|
|
1188
|
-
if (envEnabled !== undefined) {
|
|
1189
|
-
return envEnabled === 'true' || envEnabled === '1';
|
|
1190
|
-
}
|
|
1191
|
-
const config = loadOrCreateUnifiedConfig();
|
|
1192
|
-
return config.dashboard_auth?.enabled ?? false;
|
|
1193
|
-
}
|
|
1194
|
-
exports.isDashboardAuthEnabled = isDashboardAuthEnabled;
|
|
1195
|
-
/**
|
|
1196
|
-
* Get dashboard_auth configuration with ENV var override.
|
|
1197
|
-
* Priority: ENV vars > config.yaml > defaults
|
|
1198
|
-
*/
|
|
1199
|
-
function getDashboardAuthConfig() {
|
|
1200
|
-
const config = loadOrCreateUnifiedConfig();
|
|
1201
|
-
// ENV vars take precedence
|
|
1202
|
-
const envEnabled = process.env.CCS_DASHBOARD_AUTH_ENABLED;
|
|
1203
|
-
const envUsername = process.env.CCS_DASHBOARD_USERNAME;
|
|
1204
|
-
const envPasswordHash = process.env.CCS_DASHBOARD_PASSWORD_HASH;
|
|
1205
|
-
return {
|
|
1206
|
-
enabled: envEnabled !== undefined
|
|
1207
|
-
? envEnabled === 'true' || envEnabled === '1'
|
|
1208
|
-
: (config.dashboard_auth?.enabled ?? false),
|
|
1209
|
-
username: envUsername ?? config.dashboard_auth?.username ?? '',
|
|
1210
|
-
password_hash: envPasswordHash ?? config.dashboard_auth?.password_hash ?? '',
|
|
1211
|
-
session_timeout_hours: config.dashboard_auth?.session_timeout_hours ?? 24,
|
|
1212
|
-
};
|
|
1213
|
-
}
|
|
1214
|
-
exports.getDashboardAuthConfig = getDashboardAuthConfig;
|
|
1215
|
-
/**
|
|
1216
|
-
* Get browser automation configuration.
|
|
1217
|
-
* Returns canonicalized defaults if not configured.
|
|
1218
|
-
*/
|
|
1219
|
-
function getBrowserConfig() {
|
|
1220
|
-
const config = loadOrCreateUnifiedConfig();
|
|
1221
|
-
return canonicalizeBrowserConfig(config.browser);
|
|
1222
|
-
}
|
|
1223
|
-
exports.getBrowserConfig = getBrowserConfig;
|
|
1224
|
-
/**
|
|
1225
|
-
* Get image_analysis configuration.
|
|
1226
|
-
* Returns defaults if not configured.
|
|
1227
|
-
*/
|
|
1228
|
-
function getImageAnalysisConfig() {
|
|
1229
|
-
const config = loadOrCreateUnifiedConfig();
|
|
1230
|
-
return (0, image_analysis_backend_resolver_1.canonicalizeImageAnalysisConfig)({
|
|
1231
|
-
enabled: config.image_analysis?.enabled ?? unified_config_types_1.DEFAULT_IMAGE_ANALYSIS_CONFIG.enabled,
|
|
1232
|
-
timeout: config.image_analysis?.timeout ?? unified_config_types_1.DEFAULT_IMAGE_ANALYSIS_CONFIG.timeout,
|
|
1233
|
-
provider_models: config.image_analysis?.provider_models ?? unified_config_types_1.DEFAULT_IMAGE_ANALYSIS_CONFIG.provider_models,
|
|
1234
|
-
fallback_backend: config.image_analysis?.fallback_backend ?? unified_config_types_1.DEFAULT_IMAGE_ANALYSIS_CONFIG.fallback_backend,
|
|
1235
|
-
profile_backends: config.image_analysis?.profile_backends ?? unified_config_types_1.DEFAULT_IMAGE_ANALYSIS_CONFIG.profile_backends,
|
|
1236
|
-
});
|
|
1237
|
-
}
|
|
1238
|
-
exports.getImageAnalysisConfig = getImageAnalysisConfig;
|
|
1239
|
-
function getLoggingConfig() {
|
|
1240
|
-
const config = loadOrCreateUnifiedConfig();
|
|
1241
|
-
return {
|
|
1242
|
-
enabled: config.logging?.enabled ?? unified_config_types_1.DEFAULT_LOGGING_CONFIG.enabled,
|
|
1243
|
-
level: config.logging?.level ?? unified_config_types_1.DEFAULT_LOGGING_CONFIG.level,
|
|
1244
|
-
rotate_mb: config.logging?.rotate_mb ?? unified_config_types_1.DEFAULT_LOGGING_CONFIG.rotate_mb,
|
|
1245
|
-
retain_days: config.logging?.retain_days ?? unified_config_types_1.DEFAULT_LOGGING_CONFIG.retain_days,
|
|
1246
|
-
redact: config.logging?.redact ?? unified_config_types_1.DEFAULT_LOGGING_CONFIG.redact,
|
|
1247
|
-
live_buffer_size: config.logging?.live_buffer_size ?? unified_config_types_1.DEFAULT_LOGGING_CONFIG.live_buffer_size,
|
|
1248
|
-
};
|
|
1249
|
-
}
|
|
1250
|
-
exports.getLoggingConfig = getLoggingConfig;
|
|
1251
|
-
/**
|
|
1252
|
-
* Get cursor configuration.
|
|
1253
|
-
* Returns defaults if not configured.
|
|
1254
|
-
*/
|
|
1255
|
-
function getCursorConfig() {
|
|
1256
|
-
const config = loadOrCreateUnifiedConfig();
|
|
1257
|
-
return config.cursor ?? { ...unified_config_types_1.DEFAULT_CURSOR_CONFIG };
|
|
1258
|
-
}
|
|
1259
|
-
exports.getCursorConfig = getCursorConfig;
|
|
1260
262
|
//# sourceMappingURL=unified-config-loader.js.map
|