@kaitranntt/ccs 8.4.0 → 8.5.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- package/config/base-claude.settings.json +1 -1
- package/config/base-glm.settings.json +4 -4
- package/config/base-glmt.settings.json +4 -4
- package/config/base-km.settings.json +4 -4
- package/config/base-mm.settings.json +4 -4
- package/dist/api/services/cliproxy-profile-bridge.d.ts.map +1 -1
- package/dist/api/services/cliproxy-profile-bridge.js +20 -9
- package/dist/api/services/cliproxy-profile-bridge.js.map +1 -1
- package/dist/api/services/profile-lifecycle-validation.d.ts.map +1 -1
- package/dist/api/services/profile-lifecycle-validation.js +2 -0
- package/dist/api/services/profile-lifecycle-validation.js.map +1 -1
- package/dist/auth/commands/backup-command.d.ts.map +1 -1
- package/dist/auth/commands/backup-command.js +0 -1
- package/dist/auth/commands/backup-command.js.map +1 -1
- package/dist/auth/commands/create-command.d.ts.map +1 -1
- package/dist/auth/commands/create-command.js +4 -14
- 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 +0 -1
- package/dist/auth/commands/default-command.js.map +1 -1
- package/dist/auth/commands/index.d.ts +2 -1
- package/dist/auth/commands/index.d.ts.map +1 -1
- package/dist/auth/commands/index.js +0 -1
- package/dist/auth/commands/index.js.map +1 -1
- package/dist/auth/commands/remove-command.d.ts.map +1 -1
- package/dist/auth/commands/remove-command.js +0 -2
- package/dist/auth/commands/remove-command.js.map +1 -1
- package/dist/auth/commands/resources-command.d.ts.map +1 -1
- package/dist/auth/commands/resources-command.js +0 -1
- package/dist/auth/commands/resources-command.js.map +1 -1
- package/dist/auth/commands/show-command.d.ts.map +1 -1
- package/dist/auth/commands/show-command.js +0 -1
- package/dist/auth/commands/show-command.js.map +1 -1
- package/dist/auth/commands/types.d.ts.map +1 -1
- package/dist/auth/commands/types.js +0 -1
- package/dist/auth/commands/types.js.map +1 -1
- package/dist/auth/profile-registry.d.ts +3 -1
- package/dist/auth/profile-registry.d.ts.map +1 -1
- package/dist/auth/profile-registry.js +21 -15
- package/dist/auth/profile-registry.js.map +1 -1
- package/dist/ccs.js +27 -21
- package/dist/ccs.js.map +1 -1
- package/dist/cliproxy/accounts/account-safety.d.ts.map +1 -1
- package/dist/cliproxy/accounts/account-safety.js +56 -56
- package/dist/cliproxy/accounts/account-safety.js.map +1 -1
- package/dist/cliproxy/auth/antigravity-responsibility.d.ts.map +1 -1
- package/dist/cliproxy/auth/antigravity-responsibility.js +15 -15
- 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 +2 -1
- package/dist/cliproxy/auth/auth-token-manager.js.map +1 -1
- package/dist/cliproxy/auth/auth-types.d.ts.map +1 -1
- package/dist/cliproxy/auth/auth-types.js +3 -2
- package/dist/cliproxy/auth/auth-types.js.map +1 -1
- package/dist/cliproxy/auth/oauth-handler.d.ts.map +1 -1
- package/dist/cliproxy/auth/oauth-handler.js +16 -5
- package/dist/cliproxy/auth/oauth-handler.js.map +1 -1
- package/dist/cliproxy/auth/provider-refreshers/index.d.ts +2 -1
- package/dist/cliproxy/auth/provider-refreshers/index.d.ts.map +1 -1
- package/dist/cliproxy/auth/provider-refreshers/index.js +4 -2
- package/dist/cliproxy/auth/provider-refreshers/index.js.map +1 -1
- package/dist/cliproxy/auth/token-manager.d.ts +2 -1
- package/dist/cliproxy/auth/token-manager.d.ts.map +1 -1
- package/dist/cliproxy/auth/token-manager.js +2 -1
- package/dist/cliproxy/auth/token-manager.js.map +1 -1
- package/dist/cliproxy/binary/lifecycle.d.ts.map +1 -1
- package/dist/cliproxy/binary/lifecycle.js +3 -2
- package/dist/cliproxy/binary/lifecycle.js.map +1 -1
- package/dist/cliproxy/config/env-builder.d.ts +19 -2
- package/dist/cliproxy/config/env-builder.d.ts.map +1 -1
- package/dist/cliproxy/config/env-builder.js +58 -9
- package/dist/cliproxy/config/env-builder.js.map +1 -1
- package/dist/cliproxy/config/model-config.d.ts.map +1 -1
- package/dist/cliproxy/config/model-config.js +32 -32
- package/dist/cliproxy/config/model-config.js.map +1 -1
- package/dist/cliproxy/executor/arg-parser.d.ts.map +1 -1
- package/dist/cliproxy/executor/arg-parser.js +26 -26
- package/dist/cliproxy/executor/arg-parser.js.map +1 -1
- package/dist/cliproxy/executor/auth-coordinator.d.ts.map +1 -1
- package/dist/cliproxy/executor/auth-coordinator.js +15 -14
- package/dist/cliproxy/executor/auth-coordinator.js.map +1 -1
- package/dist/cliproxy/executor/browser-launch-setup.d.ts.map +1 -1
- package/dist/cliproxy/executor/browser-launch-setup.js +6 -2
- package/dist/cliproxy/executor/browser-launch-setup.js.map +1 -1
- package/dist/cliproxy/executor/index.d.ts.map +1 -1
- package/dist/cliproxy/executor/index.js +27 -17
- package/dist/cliproxy/executor/index.js.map +1 -1
- package/dist/cliproxy/executor/lifecycle-manager.d.ts.map +1 -1
- package/dist/cliproxy/executor/lifecycle-manager.js +18 -16
- package/dist/cliproxy/executor/lifecycle-manager.js.map +1 -1
- package/dist/cliproxy/executor/model-warnings.d.ts.map +1 -1
- package/dist/cliproxy/executor/model-warnings.js +24 -13
- package/dist/cliproxy/executor/model-warnings.js.map +1 -1
- package/dist/cliproxy/executor/retry-handler.d.ts.map +1 -1
- package/dist/cliproxy/executor/retry-handler.js +13 -11
- package/dist/cliproxy/executor/retry-handler.js.map +1 -1
- package/dist/cliproxy/executor/session-bridge.d.ts.map +1 -1
- package/dist/cliproxy/executor/session-bridge.js +18 -10
- package/dist/cliproxy/executor/session-bridge.js.map +1 -1
- package/dist/cliproxy/management/remote-token-uploader.d.ts.map +1 -1
- package/dist/cliproxy/management/remote-token-uploader.js +11 -11
- package/dist/cliproxy/management/remote-token-uploader.js.map +1 -1
- package/dist/cliproxy/provider-capabilities.d.ts +6 -0
- package/dist/cliproxy/provider-capabilities.d.ts.map +1 -1
- package/dist/cliproxy/provider-capabilities.js +28 -3
- package/dist/cliproxy/provider-capabilities.js.map +1 -1
- package/dist/cliproxy/proxy/https-tunnel-proxy.d.ts +5 -1
- package/dist/cliproxy/proxy/https-tunnel-proxy.d.ts.map +1 -1
- package/dist/cliproxy/proxy/https-tunnel-proxy.js +22 -10
- package/dist/cliproxy/proxy/https-tunnel-proxy.js.map +1 -1
- package/dist/cliproxy/proxy/tool-sanitization-proxy.d.ts +0 -12
- package/dist/cliproxy/proxy/tool-sanitization-proxy.d.ts.map +1 -1
- package/dist/cliproxy/proxy/tool-sanitization-proxy.js +42 -72
- package/dist/cliproxy/proxy/tool-sanitization-proxy.js.map +1 -1
- package/dist/cliproxy/quota/quota-fetcher/account-quota-fetcher.d.ts +21 -0
- package/dist/cliproxy/quota/quota-fetcher/account-quota-fetcher.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/account-quota-fetcher.js +154 -0
- package/dist/cliproxy/quota/quota-fetcher/account-quota-fetcher.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/all-accounts-fetcher.d.ts +35 -0
- package/dist/cliproxy/quota/quota-fetcher/all-accounts-fetcher.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/all-accounts-fetcher.js +98 -0
- package/dist/cliproxy/quota/quota-fetcher/all-accounts-fetcher.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/auth-file-reader.d.ts +22 -0
- package/dist/cliproxy/quota/quota-fetcher/auth-file-reader.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/auth-file-reader.js +111 -0
- package/dist/cliproxy/quota/quota-fetcher/auth-file-reader.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/available-models-fetcher.d.ts +17 -0
- package/dist/cliproxy/quota/quota-fetcher/available-models-fetcher.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/available-models-fetcher.js +85 -0
- package/dist/cliproxy/quota/quota-fetcher/available-models-fetcher.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/constants.d.ts +25 -0
- package/dist/cliproxy/quota/quota-fetcher/constants.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/constants.js +31 -0
- package/dist/cliproxy/quota/quota-fetcher/constants.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/http-client.d.ts +29 -0
- package/dist/cliproxy/quota/quota-fetcher/http-client.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/http-client.js +199 -0
- package/dist/cliproxy/quota/quota-fetcher/http-client.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/project-lookup.d.ts +16 -0
- package/dist/cliproxy/quota/quota-fetcher/project-lookup.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/project-lookup.js +89 -0
- package/dist/cliproxy/quota/quota-fetcher/project-lookup.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/status-classifier.d.ts +29 -0
- package/dist/cliproxy/quota/quota-fetcher/status-classifier.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/status-classifier.js +168 -0
- package/dist/cliproxy/quota/quota-fetcher/status-classifier.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/types.d.ts +165 -0
- package/dist/cliproxy/quota/quota-fetcher/types.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/types.js +9 -0
- package/dist/cliproxy/quota/quota-fetcher/types.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-claude.d.ts.map +1 -1
- package/dist/cliproxy/quota/quota-fetcher-claude.js +14 -3
- package/dist/cliproxy/quota/quota-fetcher-claude.js.map +1 -1
- package/dist/cliproxy/quota/quota-fetcher-codex.d.ts.map +1 -1
- package/dist/cliproxy/quota/quota-fetcher-codex.js +36 -9
- package/dist/cliproxy/quota/quota-fetcher-codex.js.map +1 -1
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/auth-file-discovery.d.ts +26 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/auth-file-discovery.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/auth-file-discovery.js +132 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/auth-file-discovery.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/bucket-building.d.ts +23 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/bucket-building.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/bucket-building.js +54 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/bucket-building.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/constants.d.ts +26 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/constants.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/constants.js +29 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/constants.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/error-parsing.d.ts +61 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/error-parsing.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/error-parsing.js +259 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/error-parsing.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/index.d.ts +20 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/index.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/index.js +38 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/index.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/managed-request.d.ts +82 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/managed-request.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/managed-request.js +263 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/managed-request.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/quota-fetcher.d.ts +46 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/quota-fetcher.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/quota-fetcher.js +188 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/quota-fetcher.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/shared-utils.d.ts +35 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/shared-utils.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/shared-utils.js +65 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/shared-utils.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/supplementary-metadata.d.ts +37 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/supplementary-metadata.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/supplementary-metadata.js +117 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/supplementary-metadata.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/token-parsing.d.ts +31 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/token-parsing.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/token-parsing.js +77 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/token-parsing.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/types.d.ts +114 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/types.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/types.js +10 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/types.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli.d.ts +13 -58
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli.d.ts.map +1 -1
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli.js +20 -819
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli.js.map +1 -1
- package/dist/cliproxy/quota/quota-fetcher-ghcp.d.ts.map +1 -1
- package/dist/cliproxy/quota/quota-fetcher-ghcp.js +19 -4
- package/dist/cliproxy/quota/quota-fetcher-ghcp.js.map +1 -1
- package/dist/cliproxy/quota/quota-fetcher.d.ts +12 -108
- package/dist/cliproxy/quota/quota-fetcher.d.ts.map +1 -1
- package/dist/cliproxy/quota/quota-fetcher.js +23 -766
- package/dist/cliproxy/quota/quota-fetcher.js.map +1 -1
- package/dist/cliproxy/quota/quota-manager.d.ts.map +1 -1
- package/dist/cliproxy/quota/quota-manager.js +7 -3
- 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 +11 -3
- package/dist/cliproxy/routing/routing-strategy.js.map +1 -1
- package/dist/commands/api-command/create-command.d.ts.map +1 -1
- package/dist/commands/api-command/create-command.js +17 -8
- package/dist/commands/api-command/create-command.js.map +1 -1
- package/dist/commands/bar/bar-server-probe.d.ts +16 -3
- package/dist/commands/bar/bar-server-probe.d.ts.map +1 -1
- package/dist/commands/bar/bar-server-probe.js +83 -18
- package/dist/commands/bar/bar-server-probe.js.map +1 -1
- package/dist/commands/bar/help-subcommand.d.ts.map +1 -1
- package/dist/commands/bar/help-subcommand.js +3 -2
- package/dist/commands/bar/help-subcommand.js.map +1 -1
- package/dist/commands/bar/index.d.ts.map +1 -1
- package/dist/commands/bar/index.js +1 -0
- package/dist/commands/bar/index.js.map +1 -1
- package/dist/commands/bar/install-subcommand.d.ts +4 -10
- package/dist/commands/bar/install-subcommand.d.ts.map +1 -1
- package/dist/commands/bar/install-subcommand.js +44 -53
- package/dist/commands/bar/install-subcommand.js.map +1 -1
- package/dist/commands/bar/launch-subcommand.d.ts +11 -1
- package/dist/commands/bar/launch-subcommand.d.ts.map +1 -1
- package/dist/commands/bar/launch-subcommand.js +82 -15
- package/dist/commands/bar/launch-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/help-subcommand.js +5 -5
- package/dist/commands/cliproxy/help-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/index.d.ts.map +1 -1
- package/dist/commands/cliproxy/index.js +7 -2
- package/dist/commands/cliproxy/index.js.map +1 -1
- package/dist/commands/cliproxy/pool-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/pool-subcommand.js +4 -2
- package/dist/commands/cliproxy/pool-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/proxy-lifecycle-subcommand.d.ts +1 -1
- package/dist/commands/cliproxy/proxy-lifecycle-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/proxy-lifecycle-subcommand.js +13 -1
- package/dist/commands/cliproxy/proxy-lifecycle-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/quota-subcommand/claude-window-helpers.d.ts +26 -0
- package/dist/commands/cliproxy/quota-subcommand/claude-window-helpers.d.ts.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/claude-window-helpers.js +82 -0
- package/dist/commands/cliproxy/quota-subcommand/claude-window-helpers.js.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/codex-window-helpers.d.ts +41 -0
- package/dist/commands/cliproxy/quota-subcommand/codex-window-helpers.d.ts.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/codex-window-helpers.js +202 -0
- package/dist/commands/cliproxy/quota-subcommand/codex-window-helpers.js.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/format-helpers.d.ts +32 -0
- package/dist/commands/cliproxy/quota-subcommand/format-helpers.d.ts.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/format-helpers.js +90 -0
- package/dist/commands/cliproxy/quota-subcommand/format-helpers.js.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/handlers.d.ts +25 -0
- package/dist/commands/cliproxy/quota-subcommand/handlers.d.ts.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/handlers.js +245 -0
- package/dist/commands/cliproxy/quota-subcommand/handlers.js.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/profile-args.d.ts +10 -0
- package/dist/commands/cliproxy/quota-subcommand/profile-args.d.ts.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/profile-args.js +37 -0
- package/dist/commands/cliproxy/quota-subcommand/profile-args.js.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/provider-runtime.d.ts +12 -0
- package/dist/commands/cliproxy/quota-subcommand/provider-runtime.d.ts.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/provider-runtime.js +64 -0
- package/dist/commands/cliproxy/quota-subcommand/provider-runtime.js.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/quota-failure-display.d.ts +27 -0
- package/dist/commands/cliproxy/quota-subcommand/quota-failure-display.d.ts.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/quota-failure-display.js +74 -0
- package/dist/commands/cliproxy/quota-subcommand/quota-failure-display.js.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/antigravity.d.ts +10 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/antigravity.d.ts.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/antigravity.js +46 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/antigravity.js.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/claude.d.ts +14 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/claude.d.ts.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/claude.js +68 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/claude.js.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/codex.d.ts +14 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/codex.d.ts.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/codex.js +82 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/codex.js.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/gemini-cli.d.ts +14 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/gemini-cli.d.ts.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/gemini-cli.js +61 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/gemini-cli.js.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/ghcp.d.ts +13 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/ghcp.d.ts.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/ghcp.js +63 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/ghcp.js.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/test-exports.d.ts +19 -0
- package/dist/commands/cliproxy/quota-subcommand/test-exports.d.ts.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/test-exports.js +22 -0
- package/dist/commands/cliproxy/quota-subcommand/test-exports.js.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/types.d.ts +42 -0
- package/dist/commands/cliproxy/quota-subcommand/types.d.ts.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/types.js +9 -0
- package/dist/commands/cliproxy/quota-subcommand/types.js.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand.d.ts +14 -36
- package/dist/commands/cliproxy/quota-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/quota-subcommand.js +21 -872
- package/dist/commands/cliproxy/quota-subcommand.js.map +1 -1
- package/dist/commands/command-catalog.js +1 -1
- package/dist/commands/command-catalog.js.map +1 -1
- package/dist/commands/config-channels-command.d.ts +1 -1
- package/dist/commands/config-channels-command.d.ts.map +1 -1
- package/dist/commands/config-channels-command.js +3 -3
- package/dist/commands/config-channels-command.js.map +1 -1
- package/dist/commands/config-command-options.d.ts.map +1 -1
- package/dist/commands/config-command-options.js +11 -2
- package/dist/commands/config-command-options.js.map +1 -1
- package/dist/commands/persist-command/arg-parsing.d.ts +14 -0
- package/dist/commands/persist-command/arg-parsing.d.ts.map +1 -0
- package/dist/commands/persist-command/arg-parsing.js +84 -0
- package/dist/commands/persist-command/arg-parsing.js.map +1 -0
- package/dist/commands/persist-command/backup-rotation.d.ts +23 -0
- package/dist/commands/persist-command/backup-rotation.d.ts.map +1 -0
- package/dist/commands/persist-command/backup-rotation.js +265 -0
- package/dist/commands/persist-command/backup-rotation.js.map +1 -0
- package/dist/commands/persist-command/handler.d.ts +10 -0
- package/dist/commands/persist-command/handler.d.ts.map +1 -0
- package/dist/commands/persist-command/handler.js +267 -0
- package/dist/commands/persist-command/handler.js.map +1 -0
- package/dist/commands/persist-command/help.d.ts +9 -0
- package/dist/commands/persist-command/help.d.ts.map +1 -0
- package/dist/commands/persist-command/help.js +86 -0
- package/dist/commands/persist-command/help.js.map +1 -0
- package/dist/commands/persist-command/receipt.d.ts +13 -0
- package/dist/commands/persist-command/receipt.d.ts.map +1 -0
- package/dist/commands/persist-command/receipt.js +102 -0
- package/dist/commands/persist-command/receipt.js.map +1 -0
- package/dist/commands/persist-command/secret-detection.d.ts +11 -0
- package/dist/commands/persist-command/secret-detection.d.ts.map +1 -0
- package/dist/commands/persist-command/secret-detection.js +54 -0
- package/dist/commands/persist-command/secret-detection.js.map +1 -0
- package/dist/commands/persist-command/secure-file.d.ts +21 -0
- package/dist/commands/persist-command/secure-file.d.ts.map +1 -0
- package/dist/commands/persist-command/secure-file.js +231 -0
- package/dist/commands/persist-command/secure-file.js.map +1 -0
- package/dist/commands/persist-command/types.d.ts +42 -0
- package/dist/commands/persist-command/types.d.ts.map +1 -0
- package/dist/commands/persist-command/types.js +34 -0
- package/dist/commands/persist-command/types.js.map +1 -0
- package/dist/commands/persist-command.d.ts +7 -2
- package/dist/commands/persist-command.d.ts.map +1 -1
- package/dist/commands/persist-command.js +17 -933
- package/dist/commands/persist-command.js.map +1 -1
- package/dist/commands/proxy-command.d.ts.map +1 -1
- package/dist/commands/proxy-command.js +7 -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 +11 -1
- package/dist/commands/setup-command.js.map +1 -1
- package/dist/commands/tokens-command.d.ts.map +1 -1
- package/dist/commands/tokens-command.js +6 -0
- package/dist/commands/tokens-command.js.map +1 -1
- package/dist/config/config-loader-facade.d.ts +1 -1
- package/dist/config/config-loader-facade.d.ts.map +1 -1
- package/dist/config/config-loader-facade.js +3 -1
- package/dist/config/config-loader-facade.js.map +1 -1
- package/dist/config/loader/config-getters.d.ts +16 -0
- package/dist/config/loader/config-getters.d.ts.map +1 -1
- package/dist/config/loader/config-getters.js +33 -1
- package/dist/config/loader/config-getters.js.map +1 -1
- package/dist/config/loader/defaults-merger.d.ts.map +1 -1
- package/dist/config/loader/defaults-merger.js +4 -0
- package/dist/config/loader/defaults-merger.js.map +1 -1
- package/dist/config/loader/yaml-serializer.d.ts.map +1 -1
- package/dist/config/loader/yaml-serializer.js +13 -0
- package/dist/config/loader/yaml-serializer.js.map +1 -1
- package/dist/config/schemas/index.d.ts +2 -0
- package/dist/config/schemas/index.d.ts.map +1 -1
- package/dist/config/schemas/index.js +5 -1
- package/dist/config/schemas/index.js.map +1 -1
- package/dist/config/schemas/runtime.d.ts +57 -0
- package/dist/config/schemas/runtime.d.ts.map +1 -0
- package/dist/config/schemas/runtime.js +51 -0
- package/dist/config/schemas/runtime.js.map +1 -0
- package/dist/config/schemas/unified-config.d.ts +3 -0
- package/dist/config/schemas/unified-config.d.ts.map +1 -1
- package/dist/config/schemas/unified-config.js.map +1 -1
- package/dist/config/unified-config-loader.d.ts +1 -1
- package/dist/config/unified-config-loader.d.ts.map +1 -1
- package/dist/config/unified-config-loader.js +25 -13
- package/dist/config/unified-config-loader.js.map +1 -1
- package/dist/copilot/copilot-executor.js +25 -25
- package/dist/copilot/copilot-executor.js.map +1 -1
- package/dist/cursor/cursor-daemon-entry.d.ts.map +1 -1
- package/dist/cursor/cursor-daemon-entry.js +34 -9
- package/dist/cursor/cursor-daemon-entry.js.map +1 -1
- package/dist/cursor/cursor-daemon.d.ts.map +1 -1
- package/dist/cursor/cursor-daemon.js +1 -0
- package/dist/cursor/cursor-daemon.js.map +1 -1
- package/dist/cursor/cursor-profile-executor.d.ts.map +1 -1
- package/dist/cursor/cursor-profile-executor.js +18 -17
- package/dist/cursor/cursor-profile-executor.js.map +1 -1
- package/dist/delegation/delegation-handler.d.ts.map +1 -1
- package/dist/delegation/delegation-handler.js +29 -23
- package/dist/delegation/delegation-handler.js.map +1 -1
- package/dist/delegation/headless-executor.d.ts +1 -0
- package/dist/delegation/headless-executor.d.ts.map +1 -1
- package/dist/delegation/headless-executor.js +36 -15
- package/dist/delegation/headless-executor.js.map +1 -1
- package/dist/delegation/session-manager.d.ts.map +1 -1
- package/dist/delegation/session-manager.js +12 -4
- package/dist/delegation/session-manager.js.map +1 -1
- package/dist/dispatcher/cli-argument-parser.d.ts +1 -1
- package/dist/dispatcher/cli-argument-parser.d.ts.map +1 -1
- package/dist/dispatcher/cli-argument-parser.js +24 -23
- package/dist/dispatcher/cli-argument-parser.js.map +1 -1
- package/dist/dispatcher/flows/cliproxy-flow.d.ts.map +1 -1
- package/dist/dispatcher/flows/cliproxy-flow.js +12 -15
- package/dist/dispatcher/flows/cliproxy-flow.js.map +1 -1
- package/dist/dispatcher/flows/copilot-flow.js +1 -1
- package/dist/dispatcher/flows/copilot-flow.js.map +1 -1
- package/dist/dispatcher/flows/cursor-flow.js +1 -1
- package/dist/dispatcher/flows/cursor-flow.js.map +1 -1
- package/dist/dispatcher/flows/settings-flow.d.ts.map +1 -1
- package/dist/dispatcher/flows/settings-flow.js +32 -29
- package/dist/dispatcher/flows/settings-flow.js.map +1 -1
- package/dist/dispatcher/pre-dispatch.d.ts.map +1 -1
- package/dist/dispatcher/pre-dispatch.js +26 -10
- package/dist/dispatcher/pre-dispatch.js.map +1 -1
- package/dist/dispatcher/profile-resolver.d.ts +1 -1
- package/dist/dispatcher/profile-resolver.d.ts.map +1 -1
- package/dist/dispatcher/profile-resolver.js +36 -23
- package/dist/dispatcher/profile-resolver.js.map +1 -1
- package/dist/docker/supervisord-lifecycle.d.ts.map +1 -1
- package/dist/docker/supervisord-lifecycle.js +5 -1
- package/dist/docker/supervisord-lifecycle.js.map +1 -1
- package/dist/errors/error-types.d.ts +26 -22
- package/dist/errors/error-types.d.ts.map +1 -1
- package/dist/errors/error-types.js +15 -12
- package/dist/errors/error-types.js.map +1 -1
- package/dist/errors/exit-codes.d.ts +20 -13
- package/dist/errors/exit-codes.d.ts.map +1 -1
- package/dist/errors/exit-codes.js +32 -28
- package/dist/errors/exit-codes.js.map +1 -1
- package/dist/glmt/delta-accumulator.d.ts +1 -0
- package/dist/glmt/delta-accumulator.d.ts.map +1 -1
- package/dist/glmt/delta-accumulator.js +12 -4
- package/dist/glmt/delta-accumulator.js.map +1 -1
- package/dist/glmt/glmt-proxy.d.ts.map +1 -1
- package/dist/glmt/glmt-proxy.js +39 -10
- package/dist/glmt/glmt-proxy.js.map +1 -1
- package/dist/glmt/glmt-transformer.d.ts.map +1 -1
- package/dist/glmt/glmt-transformer.js +1 -4
- package/dist/glmt/glmt-transformer.js.map +1 -1
- package/dist/glmt/pipeline/request-transformer.d.ts.map +1 -1
- package/dist/glmt/pipeline/request-transformer.js +5 -1
- package/dist/glmt/pipeline/request-transformer.js.map +1 -1
- package/dist/glmt/pipeline/response-builder.d.ts.map +1 -1
- package/dist/glmt/pipeline/response-builder.js +7 -3
- package/dist/glmt/pipeline/response-builder.js.map +1 -1
- package/dist/glmt/pipeline/stream-parser.d.ts.map +1 -1
- package/dist/glmt/pipeline/stream-parser.js +11 -5
- package/dist/glmt/pipeline/stream-parser.js.map +1 -1
- package/dist/glmt/pipeline/tool-call-handler.d.ts.map +1 -1
- package/dist/glmt/pipeline/tool-call-handler.js +7 -1
- package/dist/glmt/pipeline/tool-call-handler.js.map +1 -1
- package/dist/glmt/sse-parser.d.ts +1 -0
- package/dist/glmt/sse-parser.d.ts.map +1 -1
- package/dist/glmt/sse-parser.js +7 -3
- package/dist/glmt/sse-parser.js.map +1 -1
- package/dist/management/checks/cliproxy-check.d.ts.map +1 -1
- package/dist/management/checks/cliproxy-check.js +15 -1
- package/dist/management/checks/cliproxy-check.js.map +1 -1
- package/dist/management/checks/config-check.d.ts.map +1 -1
- package/dist/management/checks/config-check.js +4 -1
- package/dist/management/checks/config-check.js.map +1 -1
- package/dist/management/checks/profile-check.d.ts.map +1 -1
- package/dist/management/checks/profile-check.js +10 -6
- package/dist/management/checks/profile-check.js.map +1 -1
- package/dist/management/doctor.d.ts +7 -0
- package/dist/management/doctor.d.ts.map +1 -1
- package/dist/management/doctor.js +31 -9
- package/dist/management/doctor.js.map +1 -1
- package/dist/management/shared-manager/fs-helpers.d.ts +69 -0
- package/dist/management/shared-manager/fs-helpers.d.ts.map +1 -0
- package/dist/management/shared-manager/fs-helpers.js +241 -0
- package/dist/management/shared-manager/fs-helpers.js.map +1 -0
- package/dist/management/shared-manager/migrations.d.ts +21 -0
- package/dist/management/shared-manager/migrations.d.ts.map +1 -0
- package/dist/management/shared-manager/migrations.js +187 -0
- package/dist/management/shared-manager/migrations.js.map +1 -0
- package/dist/management/shared-manager/orchestrator.d.ts +87 -0
- package/dist/management/shared-manager/orchestrator.d.ts.map +1 -0
- package/dist/management/shared-manager/orchestrator.js +161 -0
- package/dist/management/shared-manager/orchestrator.js.map +1 -0
- package/dist/management/shared-manager/plugin-layout-internals.d.ts +42 -0
- package/dist/management/shared-manager/plugin-layout-internals.d.ts.map +1 -0
- package/dist/management/shared-manager/plugin-layout-internals.js +192 -0
- package/dist/management/shared-manager/plugin-layout-internals.js.map +1 -0
- package/dist/management/shared-manager/plugin-metadata-normalizer.d.ts +53 -0
- package/dist/management/shared-manager/plugin-metadata-normalizer.d.ts.map +1 -0
- package/dist/management/shared-manager/plugin-metadata-normalizer.js +253 -0
- package/dist/management/shared-manager/plugin-metadata-normalizer.js.map +1 -0
- package/dist/management/shared-manager/project-context-sync.d.ts +36 -0
- package/dist/management/shared-manager/project-context-sync.d.ts.map +1 -0
- package/dist/management/shared-manager/project-context-sync.js +204 -0
- package/dist/management/shared-manager/project-context-sync.js.map +1 -0
- package/dist/management/shared-manager/project-memory-sync.d.ts +21 -0
- package/dist/management/shared-manager/project-memory-sync.d.ts.map +1 -0
- package/dist/management/shared-manager/project-memory-sync.js +113 -0
- package/dist/management/shared-manager/project-memory-sync.js.map +1 -0
- package/dist/management/shared-manager/shared-dir-linker.d.ts +41 -0
- package/dist/management/shared-manager/shared-dir-linker.d.ts.map +1 -0
- package/dist/management/shared-manager/shared-dir-linker.js +227 -0
- package/dist/management/shared-manager/shared-dir-linker.js.map +1 -0
- package/dist/management/shared-manager/symlink-helpers.d.ts +61 -0
- package/dist/management/shared-manager/symlink-helpers.d.ts.map +1 -0
- package/dist/management/shared-manager/symlink-helpers.js +243 -0
- package/dist/management/shared-manager/symlink-helpers.js.map +1 -0
- package/dist/management/shared-manager/types.d.ts +45 -0
- package/dist/management/shared-manager/types.d.ts.map +1 -0
- package/dist/management/shared-manager/types.js +57 -0
- package/dist/management/shared-manager/types.js.map +1 -0
- package/dist/management/shared-manager.d.ts +13 -160
- package/dist/management/shared-manager.d.ts.map +1 -1
- package/dist/management/shared-manager.js +18 -1294
- package/dist/management/shared-manager.js.map +1 -1
- package/dist/proxy/proxy-daemon-entry.js +1 -1
- package/dist/proxy/proxy-daemon-entry.js.map +1 -1
- package/dist/proxy/server/messages-route.d.ts +10 -0
- package/dist/proxy/server/messages-route.d.ts.map +1 -1
- package/dist/proxy/server/messages-route.js +34 -7
- package/dist/proxy/server/messages-route.js.map +1 -1
- package/dist/proxy/server/proxy-server.d.ts.map +1 -1
- package/dist/proxy/server/proxy-server.js +1 -1
- package/dist/proxy/server/proxy-server.js.map +1 -1
- package/dist/proxy/transformers/sse-stream-transformer.d.ts.map +1 -1
- package/dist/proxy/transformers/sse-stream-transformer.js +12 -17
- package/dist/proxy/transformers/sse-stream-transformer.js.map +1 -1
- package/dist/services/logging/index.d.ts +1 -1
- package/dist/services/logging/index.d.ts.map +1 -1
- package/dist/services/logging/index.js +6 -1
- package/dist/services/logging/index.js.map +1 -1
- package/dist/services/logging/log-context.d.ts +27 -2
- package/dist/services/logging/log-context.d.ts.map +1 -1
- package/dist/services/logging/log-context.js +43 -4
- package/dist/services/logging/log-context.js.map +1 -1
- package/dist/services/logging/log-redaction.d.ts +9 -0
- package/dist/services/logging/log-redaction.d.ts.map +1 -1
- package/dist/services/logging/log-redaction.js +31 -3
- package/dist/services/logging/log-redaction.js.map +1 -1
- package/dist/services/logging/logger.js +2 -2
- package/dist/services/logging/logger.js.map +1 -1
- package/dist/shared/provider-preset-catalog.d.ts +1 -1
- package/dist/shared/provider-preset-catalog.d.ts.map +1 -1
- package/dist/shared/provider-preset-catalog.js +21 -7
- package/dist/shared/provider-preset-catalog.js.map +1 -1
- package/dist/targets/claude-adapter.d.ts.map +1 -1
- package/dist/targets/claude-adapter.js +5 -0
- package/dist/targets/claude-adapter.js.map +1 -1
- package/dist/targets/codex-adapter.d.ts.map +1 -1
- package/dist/targets/codex-adapter.js +11 -10
- package/dist/targets/codex-adapter.js.map +1 -1
- package/dist/targets/codex-detector.d.ts.map +1 -1
- package/dist/targets/codex-detector.js +14 -0
- package/dist/targets/codex-detector.js.map +1 -1
- package/dist/targets/droid-adapter.d.ts.map +1 -1
- package/dist/targets/droid-adapter.js +12 -12
- package/dist/targets/droid-adapter.js.map +1 -1
- package/dist/ui/assets/{Trans-RG_sMDEu.js → Trans-GYzYLs2D.js} +1 -1
- package/dist/ui/assets/{accounts-yTXURc-q.js → accounts-DC1QuyI9.js} +1 -1
- package/dist/ui/assets/{alert-dialog-DjvPgzFs.js → alert-dialog-6SiedqmE.js} +1 -1
- package/dist/ui/assets/{api-Ck1dtNEM.js → api-3s21dbNJ.js} +1 -1
- package/dist/ui/assets/{auth-section-DBnY_LPz.js → auth-section-XBfNgVN4.js} +1 -1
- package/dist/ui/assets/{backups-section-Ci-uL4Of.js → backups-section-BidiiVlq.js} +1 -1
- package/dist/ui/assets/{channels-BeS9O5q0.js → channels-pfgPUDGt.js} +1 -1
- package/dist/ui/assets/{checkbox-DFeFDZBp.js → checkbox-CJw_-nvC.js} +1 -1
- package/dist/ui/assets/{claude-extension-DS5qN19Z.js → claude-extension-BIIUOvTJ.js} +1 -1
- package/dist/ui/assets/{cliproxy-D7HJH4mZ.js → cliproxy-Cq8OX0Pu.js} +1 -1
- package/dist/ui/assets/{cliproxy-ai-providers-oJQZXrtc.js → cliproxy-ai-providers-DI760ZF0.js} +1 -1
- package/dist/ui/assets/{cliproxy-control-panel-2mRPEcRj.js → cliproxy-control-panel-CBqvpOqj.js} +1 -1
- package/dist/ui/assets/{codex-D0AUQ6jA.js → codex-DL4OLBUu.js} +1 -1
- package/dist/ui/assets/{confirm-dialog-B37-CVuq.js → confirm-dialog-CC_Cc3EO.js} +1 -1
- package/dist/ui/assets/{copilot-KaaW-mko.js → copilot-D2kEhTXR.js} +1 -1
- package/dist/ui/assets/{cursor-BKiTgYi5.js → cursor-BashLrYk.js} +1 -1
- package/dist/ui/assets/{droid-DHdqGnFw.js → droid-DaKTINFL.js} +1 -1
- package/dist/ui/assets/{globalenv-section-SfZO97nU.js → globalenv-section-BQicL8L0.js} +1 -1
- package/dist/ui/assets/{health-CSRS9O0D.js → health-bRbE_ADg.js} +1 -1
- package/dist/ui/assets/{index-CGgavq2X.js → index-B2JEyN3d.js} +36 -36
- package/dist/ui/assets/{index-Cu_F55_O.js → index-BwZdl1HU.js} +1 -1
- package/dist/ui/assets/{index-DWUuSBUe.js → index-CgeAb1-K.js} +1 -1
- package/dist/ui/assets/{index-iQuEEGbH.js → index-DAQ0qIQ_.js} +1 -1
- package/dist/ui/assets/{index-ChTYEBCZ.js → index-O2x1grGh.js} +1 -1
- package/dist/ui/assets/{index-DycwEe96.js → index-WA7tK6np.js} +1 -1
- package/dist/ui/assets/{index-DJ66NrBH.js → index-mf2X1GwS.js} +1 -1
- package/dist/ui/assets/{logs-tiZ_51mo.js → logs-qrBHUJ0H.js} +1 -1
- package/dist/ui/assets/{masked-input-D9FVoeMA.js → masked-input-CXwQ4E-g.js} +1 -1
- package/dist/ui/assets/{proxy-status-widget-2k26d8pS.js → proxy-status-widget-DPz4nCzR.js} +1 -1
- package/dist/ui/assets/{raw-json-settings-editor-panel-CguBh93H.js → raw-json-settings-editor-panel-CcvsWVh1.js} +1 -1
- package/dist/ui/assets/{searchable-select-C4wShshD.js → searchable-select-EXSjNCRu.js} +1 -1
- package/dist/ui/assets/{separator-mvGlDdEW.js → separator-D2CTfWBQ.js} +1 -1
- package/dist/ui/assets/{shared-Ck0yAwbs.js → shared-DpgzhFqe.js} +1 -1
- package/dist/ui/assets/{table-DrUJOxKL.js → table-DwbiGRYk.js} +1 -1
- package/dist/ui/assets/{updates-BVHBFcq8.js → updates-D8jfIb2y.js} +1 -1
- package/dist/ui/assets/{use-accounts-DLtuaniS.js → use-accounts-Bwtpnx-x.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/dist/utils/bar-auth-token.d.ts +4 -0
- package/dist/utils/bar-auth-token.d.ts.map +1 -0
- package/dist/utils/bar-auth-token.js +60 -0
- package/dist/utils/bar-auth-token.js.map +1 -0
- package/dist/utils/browser/browser-settings.d.ts +3 -1
- package/dist/utils/browser/browser-settings.d.ts.map +1 -1
- package/dist/utils/browser/browser-settings.js +2 -2
- package/dist/utils/browser/browser-settings.js.map +1 -1
- package/dist/utils/browser/browser-setup.d.ts.map +1 -1
- package/dist/utils/browser/browser-setup.js +3 -1
- 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 +4 -2
- package/dist/utils/browser/browser-status.js.map +1 -1
- package/dist/utils/fetch-proxy-setup.d.ts +3 -2
- package/dist/utils/fetch-proxy-setup.d.ts.map +1 -1
- package/dist/utils/fetch-proxy-setup.js +10 -6
- package/dist/utils/fetch-proxy-setup.js.map +1 -1
- package/dist/utils/image-analysis/mcp-installer.d.ts.map +1 -1
- package/dist/utils/image-analysis/mcp-installer.js +16 -13
- package/dist/utils/image-analysis/mcp-installer.js.map +1 -1
- package/dist/utils/websearch/index.d.ts +1 -1
- package/dist/utils/websearch/index.d.ts.map +1 -1
- package/dist/utils/websearch/index.js +2 -1
- package/dist/utils/websearch/index.js.map +1 -1
- package/dist/utils/websearch/mcp-installer.d.ts +8 -0
- package/dist/utils/websearch/mcp-installer.d.ts.map +1 -1
- package/dist/utils/websearch/mcp-installer.js +34 -13
- package/dist/utils/websearch/mcp-installer.js.map +1 -1
- package/dist/utils/websearch-manager.d.ts +1 -1
- package/dist/utils/websearch-manager.d.ts.map +1 -1
- package/dist/utils/websearch-manager.js +2 -1
- package/dist/utils/websearch-manager.js.map +1 -1
- package/dist/web-server/middleware/request-logging-middleware.d.ts.map +1 -1
- package/dist/web-server/middleware/request-logging-middleware.js +14 -9
- package/dist/web-server/middleware/request-logging-middleware.js.map +1 -1
- package/dist/web-server/model-pricing.d.ts.map +1 -1
- package/dist/web-server/model-pricing.js +22 -2
- package/dist/web-server/model-pricing.js.map +1 -1
- package/dist/web-server/routes/bar-routes.d.ts +12 -1
- package/dist/web-server/routes/bar-routes.d.ts.map +1 -1
- package/dist/web-server/routes/bar-routes.js +22 -6
- package/dist/web-server/routes/bar-routes.js.map +1 -1
- package/dist/web-server/routes/claude-extension-routes.d.ts.map +1 -1
- package/dist/web-server/routes/claude-extension-routes.js +3 -2
- package/dist/web-server/routes/claude-extension-routes.js.map +1 -1
- package/dist/web-server/routes/cliproxy-auth-routes.d.ts +1 -0
- package/dist/web-server/routes/cliproxy-auth-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cliproxy-auth-routes.js +20 -5
- package/dist/web-server/routes/cliproxy-auth-routes.js.map +1 -1
- package/dist/web-server/routes/cliproxy-stats-routes/config-routes.d.ts +16 -0
- package/dist/web-server/routes/cliproxy-stats-routes/config-routes.d.ts.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes/config-routes.js +219 -0
- package/dist/web-server/routes/cliproxy-stats-routes/config-routes.js.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes/error-log-routes.d.ts +12 -0
- package/dist/web-server/routes/cliproxy-stats-routes/error-log-routes.d.ts.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes/error-log-routes.js +153 -0
- package/dist/web-server/routes/cliproxy-stats-routes/error-log-routes.js.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes/quota-helpers.d.ts +19 -0
- package/dist/web-server/routes/cliproxy-stats-routes/quota-helpers.d.ts.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes/quota-helpers.js +38 -0
- package/dist/web-server/routes/cliproxy-stats-routes/quota-helpers.js.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes/quota-routes.d.ts +13 -0
- package/dist/web-server/routes/cliproxy-stats-routes/quota-routes.d.ts.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes/quota-routes.js +195 -0
- package/dist/web-server/routes/cliproxy-stats-routes/quota-routes.js.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes/restart-route.d.ts +17 -0
- package/dist/web-server/routes/cliproxy-stats-routes/restart-route.d.ts.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes/restart-route.js +34 -0
- package/dist/web-server/routes/cliproxy-stats-routes/restart-route.js.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes/router.d.ts +10 -0
- package/dist/web-server/routes/cliproxy-stats-routes/router.d.ts.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes/router.js +245 -0
- package/dist/web-server/routes/cliproxy-stats-routes/router.js.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes/shared.d.ts +35 -0
- package/dist/web-server/routes/cliproxy-stats-routes/shared.d.ts.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes/shared.js +59 -0
- package/dist/web-server/routes/cliproxy-stats-routes/shared.js.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes/version-helpers.d.ts +44 -0
- package/dist/web-server/routes/cliproxy-stats-routes/version-helpers.d.ts.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes/version-helpers.js +66 -0
- package/dist/web-server/routes/cliproxy-stats-routes/version-helpers.js.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes.d.ts +16 -57
- package/dist/web-server/routes/cliproxy-stats-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cliproxy-stats-routes.js +25 -926
- package/dist/web-server/routes/cliproxy-stats-routes.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 +9 -2
- package/dist/web-server/routes/cliproxy-sync-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 +2 -1
- 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 +3 -1
- package/dist/web-server/routes/cursor-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 +2 -1
- package/dist/web-server/routes/image-analysis-routes.js.map +1 -1
- package/dist/web-server/routes/index.d.ts.map +1 -1
- package/dist/web-server/routes/index.js +6 -0
- package/dist/web-server/routes/index.js.map +1 -1
- package/dist/web-server/routes/persist-routes.d.ts.map +1 -1
- package/dist/web-server/routes/persist-routes.js +8 -1
- package/dist/web-server/routes/persist-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 +33 -5
- 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 +18 -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 +7 -6
- package/dist/web-server/routes/settings-routes.js.map +1 -1
- package/dist/web-server/usage/aggregator.d.ts.map +1 -1
- package/dist/web-server/usage/aggregator.js +8 -8
- package/dist/web-server/usage/aggregator.js.map +1 -1
- package/dist/web-server/usage/bar-analytics.d.ts +21 -0
- package/dist/web-server/usage/bar-analytics.d.ts.map +1 -1
- package/dist/web-server/usage/bar-analytics.js +78 -9
- package/dist/web-server/usage/bar-analytics.js.map +1 -1
- package/dist/web-server/usage/cliproxy-usage-transformer.d.ts.map +1 -1
- package/dist/web-server/usage/cliproxy-usage-transformer.js +9 -4
- package/dist/web-server/usage/cliproxy-usage-transformer.js.map +1 -1
- package/dist/web-server/usage/codex-local-quota-collector.d.ts +2 -2
- package/dist/web-server/usage/codex-local-quota-collector.d.ts.map +1 -1
- package/dist/web-server/usage/codex-local-quota-collector.js +39 -11
- package/dist/web-server/usage/codex-local-quota-collector.js.map +1 -1
- package/dist/web-server/usage/handlers.d.ts.map +1 -1
- package/dist/web-server/usage/handlers.js +1 -1
- package/dist/web-server/usage/handlers.js.map +1 -1
- package/dist/web-server/usage/native-quota-collector.d.ts +37 -9
- package/dist/web-server/usage/native-quota-collector.d.ts.map +1 -1
- package/dist/web-server/usage/native-quota-collector.js +226 -23
- package/dist/web-server/usage/native-quota-collector.js.map +1 -1
- package/package.json +1 -1
- package/scripts/ci-parity-gate.sh +31 -0
- package/scripts/generate-throw-error-baseline.js +103 -0
- package/scripts/github/stable-release-issue-cleanup-lib.mjs +51 -11
- package/scripts/hardening-inventory.js +62 -4
- package/scripts/maintainability-metrics.js +356 -0
|
@@ -1,1303 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* v3.2.0: Symlink-based architecture
|
|
3
|
+
* shared-manager.ts - public barrel for the SharedManager module.
|
|
5
4
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Originally a 1631-line god file; split into focused submodules under
|
|
6
|
+
* ./shared-manager/. This file re-exports the full original public surface
|
|
7
|
+
* so consumers importing from 'shared-manager' (and from the
|
|
8
|
+
* 'management/index' re-export) continue to resolve unchanged:
|
|
9
|
+
*
|
|
10
|
+
* - default export: SharedManager class (now a thin orchestrator)
|
|
11
|
+
* - named exports: normalizePluginMetadataContent,
|
|
12
|
+
* normalizePluginMetadataPathString
|
|
13
|
+
*
|
|
14
|
+
* No logic lives in this file. Add new behavior to the appropriate
|
|
15
|
+
* submodule under ./shared-manager/.
|
|
8
16
|
*/
|
|
9
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
-
}
|
|
15
|
-
Object.defineProperty(o, k2, desc);
|
|
16
|
-
}) : (function(o, m, k, k2) {
|
|
17
|
-
if (k2 === undefined) k2 = k;
|
|
18
|
-
o[k2] = m[k];
|
|
19
|
-
}));
|
|
20
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
-
}) : function(o, v) {
|
|
23
|
-
o["default"] = v;
|
|
24
|
-
});
|
|
25
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
|
-
if (mod && mod.__esModule) return mod;
|
|
27
|
-
var result = {};
|
|
28
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
29
|
-
__setModuleDefault(result, mod);
|
|
30
|
-
return result;
|
|
31
|
-
};
|
|
32
17
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
33
18
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
34
19
|
};
|
|
35
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.normalizePluginMetadataPathString = exports.normalizePluginMetadataContent = void 0;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const account_context_1 = require("../auth/account-context");
|
|
43
|
-
const plugin_path_normalizer_1 = require("./plugin-path-normalizer");
|
|
44
|
-
const config_loader_facade_1 = require("../config/config-loader-facade");
|
|
45
|
-
const instance_directory_1 = require("./instance-directory");
|
|
46
|
-
var plugin_path_normalizer_2 = require("./plugin-path-normalizer");
|
|
47
|
-
Object.defineProperty(exports, "normalizePluginMetadataContent", { enumerable: true, get: function () { return plugin_path_normalizer_2.normalizePluginMetadataContent; } });
|
|
48
|
-
Object.defineProperty(exports, "normalizePluginMetadataPathString", { enumerable: true, get: function () { return plugin_path_normalizer_2.normalizePluginMetadataPathString; } });
|
|
49
|
-
const DEFAULT_INSTALLED_PLUGIN_REGISTRY = JSON.stringify({
|
|
50
|
-
version: 2,
|
|
51
|
-
plugins: {},
|
|
52
|
-
}, null, 2);
|
|
53
|
-
/**
|
|
54
|
-
* SharedManager Class
|
|
55
|
-
*/
|
|
56
|
-
class SharedManager {
|
|
57
|
-
constructor() {
|
|
58
|
-
this.sharedPluginEntries = [
|
|
59
|
-
{ name: 'cache', type: 'directory' },
|
|
60
|
-
{ name: 'marketplaces', type: 'directory' },
|
|
61
|
-
{ name: 'installed_plugins.json', type: 'file' },
|
|
62
|
-
];
|
|
63
|
-
this.instanceLocalPluginMetadataFiles = new Set(['known_marketplaces.json']);
|
|
64
|
-
this.advancedContinuityItems = [
|
|
65
|
-
'session-env',
|
|
66
|
-
'file-history',
|
|
67
|
-
'shell-snapshots',
|
|
68
|
-
'todos',
|
|
69
|
-
];
|
|
70
|
-
this.homeDir = os.homedir();
|
|
71
|
-
const ccsDir = (0, config_loader_facade_1.getCcsDir)();
|
|
72
|
-
this.sharedDir = path.join(ccsDir, 'shared');
|
|
73
|
-
this.claudeDir = path.join(this.homeDir, '.claude');
|
|
74
|
-
this.instancesDir = path.join(ccsDir, 'instances');
|
|
75
|
-
this.pluginLayoutLock = new profile_context_sync_lock_1.default(this.instancesDir);
|
|
76
|
-
this.sharedItems = [
|
|
77
|
-
{ name: 'commands', type: 'directory' },
|
|
78
|
-
{ name: 'skills', type: 'directory' },
|
|
79
|
-
{ name: 'agents', type: 'directory' },
|
|
80
|
-
{ name: 'plugins', type: 'directory' },
|
|
81
|
-
{ name: 'settings.json', type: 'file' },
|
|
82
|
-
];
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Detect circular symlink before creation
|
|
86
|
-
*/
|
|
87
|
-
detectCircularSymlink(target) {
|
|
88
|
-
try {
|
|
89
|
-
const stats = fs.lstatSync(target);
|
|
90
|
-
if (!stats.isSymbolicLink()) {
|
|
91
|
-
return false;
|
|
92
|
-
}
|
|
93
|
-
// Resolve target's link
|
|
94
|
-
const targetLink = fs.readlinkSync(target);
|
|
95
|
-
const resolvedTarget = path.resolve(path.dirname(target), targetLink);
|
|
96
|
-
const sharedDirPath = path.resolve(this.sharedDir);
|
|
97
|
-
// A raw target path pointing back into ~/.ccs/shared is already unsafe.
|
|
98
|
-
// Re-pointing ~/.ccs/shared/* to ~/.claude/* would turn it into a real loop,
|
|
99
|
-
// even if the current ~/.ccs/shared entry ultimately resolves to an external path.
|
|
100
|
-
if (this.isPathWithinDirectory(resolvedTarget, sharedDirPath)) {
|
|
101
|
-
console.log((0, ui_1.warn)(`Circular symlink detected: ${target} → ${resolvedTarget}`));
|
|
102
|
-
return true;
|
|
103
|
-
}
|
|
104
|
-
// Only treat targets inside the managed shared root as circular.
|
|
105
|
-
// Existing shared symlinks may already resolve through ~/.claude/ to an
|
|
106
|
-
// external repo, which is a supported upgrade path rather than a loop.
|
|
107
|
-
const sharedDir = this.resolveCanonicalPath(sharedDirPath);
|
|
108
|
-
const canonicalResolvedTarget = this.resolveCanonicalPath(resolvedTarget);
|
|
109
|
-
if (this.isPathWithinDirectory(canonicalResolvedTarget, sharedDir)) {
|
|
110
|
-
console.log((0, ui_1.warn)(`Circular symlink detected: ${target} → ${resolvedTarget}`));
|
|
111
|
-
return true;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
catch (err) {
|
|
115
|
-
if (err.code === 'ENOENT') {
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
|
-
throw err;
|
|
119
|
-
}
|
|
120
|
-
return false;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Ensure shared directories exist as symlinks to ~/.claude/
|
|
124
|
-
* Creates ~/.claude/ structure if missing
|
|
125
|
-
*/
|
|
126
|
-
ensureSharedDirectories() {
|
|
127
|
-
// Create ~/.claude/ if missing
|
|
128
|
-
if (!this.getLstatSync(this.claudeDir)) {
|
|
129
|
-
console.log((0, ui_1.info)('Creating ~/.claude/ directory structure'));
|
|
130
|
-
fs.mkdirSync(this.claudeDir, { recursive: true, mode: 0o700 });
|
|
131
|
-
}
|
|
132
|
-
// Create shared directory
|
|
133
|
-
if (!this.getLstatSync(this.sharedDir)) {
|
|
134
|
-
fs.mkdirSync(this.sharedDir, { recursive: true, mode: 0o700 });
|
|
135
|
-
}
|
|
136
|
-
this.ensureSharedPluginLayoutDefaults();
|
|
137
|
-
// Create symlinks ~/.ccs/shared/* → ~/.claude/*
|
|
138
|
-
for (const item of this.sharedItems) {
|
|
139
|
-
const claudePath = path.join(this.claudeDir, item.name);
|
|
140
|
-
const sharedPath = path.join(this.sharedDir, item.name);
|
|
141
|
-
// Create in ~/.claude/ if missing
|
|
142
|
-
if (!this.getLstatSync(claudePath)) {
|
|
143
|
-
if (item.type === 'directory') {
|
|
144
|
-
fs.mkdirSync(claudePath, { recursive: true, mode: 0o700 });
|
|
145
|
-
}
|
|
146
|
-
else if (item.type === 'file') {
|
|
147
|
-
// Create empty settings.json if missing
|
|
148
|
-
fs.writeFileSync(claudePath, JSON.stringify({}, null, 2), 'utf8');
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
// Check for circular symlink
|
|
152
|
-
if (this.detectCircularSymlink(claudePath)) {
|
|
153
|
-
console.log((0, ui_1.warn)(`Skipping ${item.name}: circular symlink detected`));
|
|
154
|
-
continue;
|
|
155
|
-
}
|
|
156
|
-
// If already a symlink pointing to correct target, skip
|
|
157
|
-
if (this.getLstatSync(sharedPath)) {
|
|
158
|
-
try {
|
|
159
|
-
const stats = fs.lstatSync(sharedPath);
|
|
160
|
-
if (stats.isSymbolicLink()) {
|
|
161
|
-
const currentTarget = fs.readlinkSync(sharedPath);
|
|
162
|
-
const resolvedTarget = path.resolve(path.dirname(sharedPath), currentTarget);
|
|
163
|
-
if (resolvedTarget === claudePath) {
|
|
164
|
-
continue; // Already correct
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
catch (_err) {
|
|
169
|
-
// Continue to recreate
|
|
170
|
-
}
|
|
171
|
-
// Remove existing file/directory/link
|
|
172
|
-
if (item.type === 'directory') {
|
|
173
|
-
fs.rmSync(sharedPath, { recursive: true, force: true });
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
fs.unlinkSync(sharedPath);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
// Create symlink
|
|
180
|
-
try {
|
|
181
|
-
const symlinkType = item.type === 'directory' ? 'dir' : 'file';
|
|
182
|
-
fs.symlinkSync(claudePath, sharedPath, symlinkType);
|
|
183
|
-
}
|
|
184
|
-
catch (_err) {
|
|
185
|
-
// Windows fallback: copy
|
|
186
|
-
if (process.platform === 'win32') {
|
|
187
|
-
if (item.type === 'directory') {
|
|
188
|
-
this.copyDirectoryFallback(claudePath, sharedPath);
|
|
189
|
-
}
|
|
190
|
-
else if (item.type === 'file') {
|
|
191
|
-
fs.copyFileSync(claudePath, sharedPath);
|
|
192
|
-
}
|
|
193
|
-
console.log((0, ui_1.warn)(`Symlink failed for ${item.name}, copied instead (enable Developer Mode)`));
|
|
194
|
-
}
|
|
195
|
-
else {
|
|
196
|
-
throw _err;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Link shared directories to instance
|
|
203
|
-
*/
|
|
204
|
-
linkSharedDirectories(instancePath) {
|
|
205
|
-
this.ensureSharedDirectories();
|
|
206
|
-
for (const item of this.sharedItems) {
|
|
207
|
-
if (item.name === 'plugins') {
|
|
208
|
-
this.linkInstancePlugins(instancePath);
|
|
209
|
-
continue;
|
|
210
|
-
}
|
|
211
|
-
const linkPath = path.join(instancePath, item.name);
|
|
212
|
-
const targetPath = path.join(this.sharedDir, item.name);
|
|
213
|
-
this.removeExistingPath(linkPath, item.type);
|
|
214
|
-
// Create symlink
|
|
215
|
-
try {
|
|
216
|
-
const symlinkType = item.type === 'directory' ? 'dir' : 'file';
|
|
217
|
-
fs.symlinkSync(targetPath, linkPath, symlinkType);
|
|
218
|
-
}
|
|
219
|
-
catch (_err) {
|
|
220
|
-
// Windows fallback
|
|
221
|
-
if (process.platform === 'win32') {
|
|
222
|
-
if (item.type === 'directory') {
|
|
223
|
-
this.copyDirectoryFallback(targetPath, linkPath);
|
|
224
|
-
}
|
|
225
|
-
else if (item.type === 'file') {
|
|
226
|
-
fs.copyFileSync(targetPath, linkPath);
|
|
227
|
-
}
|
|
228
|
-
console.log((0, ui_1.warn)(`Symlink failed for ${item.name}, copied instead (enable Developer Mode)`));
|
|
229
|
-
}
|
|
230
|
-
else {
|
|
231
|
-
throw _err;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
this.normalizeSharedPluginMetadataPaths(instancePath);
|
|
236
|
-
}
|
|
237
|
-
detachSharedDirectories(instancePath) {
|
|
238
|
-
this.ensureSharedDirectories();
|
|
239
|
-
for (const item of this.sharedItems) {
|
|
240
|
-
const managedPath = path.join(instancePath, item.name);
|
|
241
|
-
if (!fs.existsSync(managedPath)) {
|
|
242
|
-
continue;
|
|
243
|
-
}
|
|
244
|
-
if (item.name === 'plugins') {
|
|
245
|
-
this.detachManagedPluginLayout(instancePath);
|
|
246
|
-
continue;
|
|
247
|
-
}
|
|
248
|
-
const stats = fs.lstatSync(managedPath);
|
|
249
|
-
if (!stats.isSymbolicLink()) {
|
|
250
|
-
continue;
|
|
251
|
-
}
|
|
252
|
-
if (this.symlinkPointsTo(managedPath, path.join(this.sharedDir, item.name))) {
|
|
253
|
-
this.removeExistingPath(managedPath, item.type);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
ensureSharedPluginLayoutDefaults() {
|
|
258
|
-
const pluginsDir = path.join(this.claudeDir, 'plugins');
|
|
259
|
-
fs.mkdirSync(pluginsDir, { recursive: true, mode: 0o700 });
|
|
260
|
-
for (const entry of this.sharedPluginEntries) {
|
|
261
|
-
const entryPath = path.join(pluginsDir, entry.name);
|
|
262
|
-
if (fs.existsSync(entryPath)) {
|
|
263
|
-
continue;
|
|
264
|
-
}
|
|
265
|
-
if (entry.type === 'directory') {
|
|
266
|
-
fs.mkdirSync(entryPath, { recursive: true, mode: 0o700 });
|
|
267
|
-
continue;
|
|
268
|
-
}
|
|
269
|
-
fs.writeFileSync(entryPath, DEFAULT_INSTALLED_PLUGIN_REGISTRY, 'utf8');
|
|
270
|
-
}
|
|
271
|
-
const marketplaceRegistryPath = path.join(pluginsDir, 'known_marketplaces.json');
|
|
272
|
-
if (!fs.existsSync(marketplaceRegistryPath)) {
|
|
273
|
-
fs.writeFileSync(marketplaceRegistryPath, JSON.stringify({}, null, 2), 'utf8');
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
linkInstancePlugins(instancePath) {
|
|
277
|
-
const linkPath = path.join(instancePath, 'plugins');
|
|
278
|
-
const targetPath = path.join(this.sharedDir, 'plugins');
|
|
279
|
-
let linkStats = null;
|
|
280
|
-
try {
|
|
281
|
-
linkStats = fs.lstatSync(linkPath);
|
|
282
|
-
}
|
|
283
|
-
catch (err) {
|
|
284
|
-
if (err.code !== 'ENOENT') {
|
|
285
|
-
throw err;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
if (linkStats?.isSymbolicLink() || (linkStats && !linkStats.isDirectory())) {
|
|
289
|
-
this.removeExistingPath(linkPath, linkStats.isDirectory() ? 'directory' : 'file');
|
|
290
|
-
}
|
|
291
|
-
if (!linkStats || !linkStats.isDirectory()) {
|
|
292
|
-
fs.mkdirSync(linkPath, { recursive: true, mode: 0o700 });
|
|
293
|
-
}
|
|
294
|
-
for (const item of this.getSharedPluginLinkItems()) {
|
|
295
|
-
const targetEntryPath = path.join(targetPath, item.name);
|
|
296
|
-
const linkEntryPath = path.join(linkPath, item.name);
|
|
297
|
-
this.removeExistingPath(linkEntryPath, item.type);
|
|
298
|
-
try {
|
|
299
|
-
const symlinkType = item.type === 'directory' ? 'dir' : 'file';
|
|
300
|
-
fs.symlinkSync(targetEntryPath, linkEntryPath, symlinkType);
|
|
301
|
-
}
|
|
302
|
-
catch (_err) {
|
|
303
|
-
if (process.platform === 'win32') {
|
|
304
|
-
if (item.type === 'directory') {
|
|
305
|
-
this.copyDirectoryFallback(targetEntryPath, linkEntryPath);
|
|
306
|
-
}
|
|
307
|
-
else {
|
|
308
|
-
fs.copyFileSync(targetEntryPath, linkEntryPath);
|
|
309
|
-
}
|
|
310
|
-
console.log((0, ui_1.warn)(`Symlink failed for plugins/${item.name}, copied instead (enable Developer Mode)`));
|
|
311
|
-
}
|
|
312
|
-
else {
|
|
313
|
-
throw _err;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
getSharedPluginLinkItems() {
|
|
319
|
-
const sharedPluginsPath = path.join(this.sharedDir, 'plugins');
|
|
320
|
-
const items = new Map(this.sharedPluginEntries.map((entry) => [entry.name, { ...entry }]));
|
|
321
|
-
for (const entry of fs.readdirSync(sharedPluginsPath, { withFileTypes: true })) {
|
|
322
|
-
if (items.has(entry.name) || this.instanceLocalPluginMetadataFiles.has(entry.name)) {
|
|
323
|
-
continue;
|
|
324
|
-
}
|
|
325
|
-
const entryPath = path.join(sharedPluginsPath, entry.name);
|
|
326
|
-
let stats;
|
|
327
|
-
try {
|
|
328
|
-
stats = fs.statSync(entryPath);
|
|
329
|
-
}
|
|
330
|
-
catch (err) {
|
|
331
|
-
const code = err.code;
|
|
332
|
-
console.log((0, ui_1.warn)(`Skipping plugins/${entry.name}: unable to inspect shared plugin entry${code ? ` (${code})` : ''}`));
|
|
333
|
-
continue;
|
|
334
|
-
}
|
|
335
|
-
items.set(entry.name, {
|
|
336
|
-
name: entry.name,
|
|
337
|
-
type: stats.isDirectory() ? 'directory' : 'file',
|
|
338
|
-
});
|
|
339
|
-
}
|
|
340
|
-
return [...items.values()];
|
|
341
|
-
}
|
|
342
|
-
removeExistingPath(targetPath, typeHint) {
|
|
343
|
-
try {
|
|
344
|
-
const stats = fs.lstatSync(targetPath);
|
|
345
|
-
if (stats.isDirectory() && !stats.isSymbolicLink()) {
|
|
346
|
-
fs.rmSync(targetPath, { recursive: true, force: true });
|
|
347
|
-
return;
|
|
348
|
-
}
|
|
349
|
-
if (stats.isSymbolicLink() || typeHint === 'file') {
|
|
350
|
-
fs.unlinkSync(targetPath);
|
|
351
|
-
return;
|
|
352
|
-
}
|
|
353
|
-
fs.rmSync(targetPath, { recursive: true, force: true });
|
|
354
|
-
}
|
|
355
|
-
catch (err) {
|
|
356
|
-
if (err.code === 'ENOENT') {
|
|
357
|
-
return;
|
|
358
|
-
}
|
|
359
|
-
if (typeHint === 'directory') {
|
|
360
|
-
fs.rmSync(targetPath, { recursive: true, force: true });
|
|
361
|
-
}
|
|
362
|
-
else {
|
|
363
|
-
fs.rmSync(targetPath, { force: true });
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
/**
|
|
368
|
-
* Sync project workspace context based on account policy.
|
|
369
|
-
*
|
|
370
|
-
* - isolated (default): each profile keeps its own ./projects directory.
|
|
371
|
-
* - shared: profile ./projects becomes symlink to shared context group root.
|
|
372
|
-
*/
|
|
373
|
-
async syncProjectContext(instancePath, policy) {
|
|
374
|
-
const projectsPath = path.join(instancePath, 'projects');
|
|
375
|
-
const instanceName = path.basename(instancePath);
|
|
376
|
-
const mode = policy.mode === 'shared' ? 'shared' : 'isolated';
|
|
377
|
-
if (mode === 'shared') {
|
|
378
|
-
const contextGroup = policy.group || account_context_1.DEFAULT_ACCOUNT_CONTEXT_GROUP;
|
|
379
|
-
const sharedProjectsPath = path.join(this.sharedDir, 'context-groups', contextGroup, 'projects');
|
|
380
|
-
await this.ensureDirectory(sharedProjectsPath);
|
|
381
|
-
await this.ensureDirectory(path.dirname(projectsPath));
|
|
382
|
-
const currentStats = await this.getLstat(projectsPath);
|
|
383
|
-
if (!currentStats) {
|
|
384
|
-
await this.linkDirectoryWithFallback(sharedProjectsPath, projectsPath);
|
|
385
|
-
return;
|
|
386
|
-
}
|
|
387
|
-
if (currentStats.isSymbolicLink()) {
|
|
388
|
-
if (await this.isSymlinkTarget(projectsPath, sharedProjectsPath)) {
|
|
389
|
-
return;
|
|
390
|
-
}
|
|
391
|
-
const currentTarget = await this.resolveSymlinkTargetPath(projectsPath);
|
|
392
|
-
if (currentTarget &&
|
|
393
|
-
path.resolve(currentTarget) !== path.resolve(sharedProjectsPath) &&
|
|
394
|
-
this.isSafeProjectsMergeSource(currentTarget, instanceName) &&
|
|
395
|
-
(await this.pathExists(currentTarget))) {
|
|
396
|
-
await this.mergeDirectoryWithConflictCopies(currentTarget, sharedProjectsPath, instanceName);
|
|
397
|
-
}
|
|
398
|
-
else if (currentTarget && !this.isSafeProjectsMergeSource(currentTarget, instanceName)) {
|
|
399
|
-
console.log((0, ui_1.warn)(`Skipping unsafe project merge source outside CCS roots: ${currentTarget}`));
|
|
400
|
-
}
|
|
401
|
-
await fs.promises.unlink(projectsPath);
|
|
402
|
-
await this.linkDirectoryWithFallback(sharedProjectsPath, projectsPath);
|
|
403
|
-
return;
|
|
404
|
-
}
|
|
405
|
-
if (currentStats.isDirectory()) {
|
|
406
|
-
await this.detachLegacySharedMemoryLinks(projectsPath, instanceName);
|
|
407
|
-
await this.mergeDirectoryWithConflictCopies(projectsPath, sharedProjectsPath, instanceName);
|
|
408
|
-
await fs.promises.rm(projectsPath, { recursive: true, force: true });
|
|
409
|
-
await this.linkDirectoryWithFallback(sharedProjectsPath, projectsPath);
|
|
410
|
-
return;
|
|
411
|
-
}
|
|
412
|
-
await fs.promises.rm(projectsPath, { force: true });
|
|
413
|
-
await this.linkDirectoryWithFallback(sharedProjectsPath, projectsPath);
|
|
414
|
-
return;
|
|
415
|
-
}
|
|
416
|
-
const currentStats = await this.getLstat(projectsPath);
|
|
417
|
-
if (!currentStats) {
|
|
418
|
-
await this.ensureDirectory(projectsPath);
|
|
419
|
-
return;
|
|
420
|
-
}
|
|
421
|
-
if (currentStats.isDirectory()) {
|
|
422
|
-
await this.detachLegacySharedMemoryLinks(projectsPath, instanceName);
|
|
423
|
-
return;
|
|
424
|
-
}
|
|
425
|
-
if (currentStats.isSymbolicLink()) {
|
|
426
|
-
const currentTarget = await this.resolveSymlinkTargetPath(projectsPath);
|
|
427
|
-
await fs.promises.unlink(projectsPath);
|
|
428
|
-
await this.ensureDirectory(projectsPath);
|
|
429
|
-
if (currentTarget &&
|
|
430
|
-
path.resolve(currentTarget) !== path.resolve(projectsPath) &&
|
|
431
|
-
this.isSafeProjectsMergeSource(currentTarget, instanceName) &&
|
|
432
|
-
(await this.pathExists(currentTarget))) {
|
|
433
|
-
await this.mergeDirectoryWithConflictCopies(currentTarget, projectsPath, instanceName);
|
|
434
|
-
}
|
|
435
|
-
else if (currentTarget && !this.isSafeProjectsMergeSource(currentTarget, instanceName)) {
|
|
436
|
-
console.log((0, ui_1.warn)(`Skipping unsafe project merge source outside CCS roots: ${currentTarget}`));
|
|
437
|
-
}
|
|
438
|
-
return;
|
|
439
|
-
}
|
|
440
|
-
await fs.promises.rm(projectsPath, { force: true });
|
|
441
|
-
await this.ensureDirectory(projectsPath);
|
|
442
|
-
}
|
|
443
|
-
/**
|
|
444
|
-
* Sync advanced continuity artifacts for shared deeper mode.
|
|
445
|
-
*
|
|
446
|
-
* - shared + deeper: artifacts are linked per context group.
|
|
447
|
-
* - shared + standard / isolated: artifacts stay local to instance.
|
|
448
|
-
*/
|
|
449
|
-
async syncAdvancedContinuityArtifacts(instancePath, policy) {
|
|
450
|
-
const instanceName = path.basename(instancePath);
|
|
451
|
-
const useSharedContinuity = policy.mode === 'shared' && policy.continuityMode === 'deeper';
|
|
452
|
-
const contextGroup = policy.group || account_context_1.DEFAULT_ACCOUNT_CONTEXT_GROUP;
|
|
453
|
-
for (const artifactName of this.advancedContinuityItems) {
|
|
454
|
-
const instanceArtifactPath = path.join(instancePath, artifactName);
|
|
455
|
-
if (useSharedContinuity) {
|
|
456
|
-
const sharedArtifactPath = path.join(this.sharedDir, 'context-groups', contextGroup, 'continuity', artifactName);
|
|
457
|
-
await this.ensureDirectory(sharedArtifactPath);
|
|
458
|
-
await this.ensureDirectory(path.dirname(instanceArtifactPath));
|
|
459
|
-
const currentStats = await this.getLstat(instanceArtifactPath);
|
|
460
|
-
if (!currentStats) {
|
|
461
|
-
await this.linkDirectoryWithFallback(sharedArtifactPath, instanceArtifactPath);
|
|
462
|
-
continue;
|
|
463
|
-
}
|
|
464
|
-
if (currentStats.isSymbolicLink()) {
|
|
465
|
-
if (await this.isSymlinkTarget(instanceArtifactPath, sharedArtifactPath)) {
|
|
466
|
-
continue;
|
|
467
|
-
}
|
|
468
|
-
const currentTarget = await this.resolveSymlinkTargetPath(instanceArtifactPath);
|
|
469
|
-
if (currentTarget &&
|
|
470
|
-
path.resolve(currentTarget) !== path.resolve(sharedArtifactPath) &&
|
|
471
|
-
this.isSafeContinuityMergeSource(currentTarget, instanceName, artifactName) &&
|
|
472
|
-
(await this.pathExists(currentTarget))) {
|
|
473
|
-
await this.mergeDirectoryWithConflictCopies(currentTarget, sharedArtifactPath, instanceName);
|
|
474
|
-
}
|
|
475
|
-
else if (currentTarget &&
|
|
476
|
-
!this.isSafeContinuityMergeSource(currentTarget, instanceName, artifactName)) {
|
|
477
|
-
console.log((0, ui_1.warn)(`Skipping unsafe ${artifactName} merge source outside CCS roots: ${currentTarget}`));
|
|
478
|
-
}
|
|
479
|
-
await fs.promises.unlink(instanceArtifactPath);
|
|
480
|
-
await this.linkDirectoryWithFallback(sharedArtifactPath, instanceArtifactPath);
|
|
481
|
-
continue;
|
|
482
|
-
}
|
|
483
|
-
if (currentStats.isDirectory()) {
|
|
484
|
-
await this.mergeDirectoryWithConflictCopies(instanceArtifactPath, sharedArtifactPath, instanceName);
|
|
485
|
-
await fs.promises.rm(instanceArtifactPath, { recursive: true, force: true });
|
|
486
|
-
await this.linkDirectoryWithFallback(sharedArtifactPath, instanceArtifactPath);
|
|
487
|
-
continue;
|
|
488
|
-
}
|
|
489
|
-
await fs.promises.rm(instanceArtifactPath, { force: true });
|
|
490
|
-
await this.linkDirectoryWithFallback(sharedArtifactPath, instanceArtifactPath);
|
|
491
|
-
continue;
|
|
492
|
-
}
|
|
493
|
-
const currentStats = await this.getLstat(instanceArtifactPath);
|
|
494
|
-
if (!currentStats) {
|
|
495
|
-
await this.ensureDirectory(instanceArtifactPath);
|
|
496
|
-
continue;
|
|
497
|
-
}
|
|
498
|
-
if (currentStats.isDirectory()) {
|
|
499
|
-
continue;
|
|
500
|
-
}
|
|
501
|
-
if (currentStats.isSymbolicLink()) {
|
|
502
|
-
const currentTarget = await this.resolveSymlinkTargetPath(instanceArtifactPath);
|
|
503
|
-
await fs.promises.unlink(instanceArtifactPath);
|
|
504
|
-
await this.ensureDirectory(instanceArtifactPath);
|
|
505
|
-
if (currentTarget &&
|
|
506
|
-
path.resolve(currentTarget) !== path.resolve(instanceArtifactPath) &&
|
|
507
|
-
this.isSafeContinuityMergeSource(currentTarget, instanceName, artifactName) &&
|
|
508
|
-
(await this.pathExists(currentTarget))) {
|
|
509
|
-
await this.mergeDirectoryWithConflictCopies(currentTarget, instanceArtifactPath, instanceName);
|
|
510
|
-
}
|
|
511
|
-
else if (currentTarget &&
|
|
512
|
-
!this.isSafeContinuityMergeSource(currentTarget, instanceName, artifactName)) {
|
|
513
|
-
console.log((0, ui_1.warn)(`Skipping unsafe ${artifactName} merge source outside CCS roots: ${currentTarget}`));
|
|
514
|
-
}
|
|
515
|
-
continue;
|
|
516
|
-
}
|
|
517
|
-
await fs.promises.rm(instanceArtifactPath, { force: true });
|
|
518
|
-
await this.ensureDirectory(instanceArtifactPath);
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
/**
|
|
522
|
-
* Ensure all project memory directories for an instance are shared.
|
|
523
|
-
*
|
|
524
|
-
* Source layout (isolated):
|
|
525
|
-
* ~/.ccs/instances/<profile>/projects/<project>/memory/
|
|
526
|
-
*
|
|
527
|
-
* Shared layout (canonical):
|
|
528
|
-
* ~/.ccs/shared/memory/<project>/
|
|
529
|
-
*/
|
|
530
|
-
async syncProjectMemories(instancePath) {
|
|
531
|
-
const projectsDir = path.join(instancePath, 'projects');
|
|
532
|
-
if (!(await this.pathExists(projectsDir))) {
|
|
533
|
-
return;
|
|
534
|
-
}
|
|
535
|
-
await this.ensureDirectory(this.sharedDir);
|
|
536
|
-
const sharedMemoryRoot = path.join(this.sharedDir, 'memory');
|
|
537
|
-
await this.ensureDirectory(sharedMemoryRoot);
|
|
538
|
-
let projectEntries = [];
|
|
539
|
-
try {
|
|
540
|
-
projectEntries = await fs.promises.readdir(projectsDir, { withFileTypes: true });
|
|
541
|
-
}
|
|
542
|
-
catch (_err) {
|
|
543
|
-
return;
|
|
544
|
-
}
|
|
545
|
-
const projects = projectEntries.filter((entry) => entry.isDirectory());
|
|
546
|
-
if (projects.length === 0) {
|
|
547
|
-
return;
|
|
548
|
-
}
|
|
549
|
-
let migrated = 0;
|
|
550
|
-
let merged = 0;
|
|
551
|
-
let linked = 0;
|
|
552
|
-
const instanceName = path.basename(instancePath);
|
|
553
|
-
for (const project of projects) {
|
|
554
|
-
const projectDir = path.join(projectsDir, project.name);
|
|
555
|
-
const projectMemoryPath = path.join(projectDir, 'memory');
|
|
556
|
-
const sharedProjectMemoryPath = path.join(sharedMemoryRoot, project.name);
|
|
557
|
-
const projectMemoryStats = await this.getLstat(projectMemoryPath);
|
|
558
|
-
if (!projectMemoryStats) {
|
|
559
|
-
if (await this.ensureProjectMemoryLink(projectMemoryPath, sharedProjectMemoryPath)) {
|
|
560
|
-
linked++;
|
|
561
|
-
}
|
|
562
|
-
continue;
|
|
563
|
-
}
|
|
564
|
-
if (projectMemoryStats.isSymbolicLink()) {
|
|
565
|
-
if (await this.isSymlinkTarget(projectMemoryPath, sharedProjectMemoryPath)) {
|
|
566
|
-
continue;
|
|
567
|
-
}
|
|
568
|
-
await fs.promises.unlink(projectMemoryPath);
|
|
569
|
-
if (await this.ensureProjectMemoryLink(projectMemoryPath, sharedProjectMemoryPath)) {
|
|
570
|
-
linked++;
|
|
571
|
-
}
|
|
572
|
-
continue;
|
|
573
|
-
}
|
|
574
|
-
if (!projectMemoryStats.isDirectory()) {
|
|
575
|
-
continue;
|
|
576
|
-
}
|
|
577
|
-
if (!(await this.pathExists(sharedProjectMemoryPath))) {
|
|
578
|
-
await this.moveDirectory(projectMemoryPath, sharedProjectMemoryPath);
|
|
579
|
-
migrated++;
|
|
580
|
-
}
|
|
581
|
-
else {
|
|
582
|
-
merged += await this.mergeDirectoryWithConflictCopies(projectMemoryPath, sharedProjectMemoryPath, instanceName);
|
|
583
|
-
await fs.promises.rm(projectMemoryPath, { recursive: true, force: true });
|
|
584
|
-
}
|
|
585
|
-
if (await this.ensureProjectMemoryLink(projectMemoryPath, sharedProjectMemoryPath)) {
|
|
586
|
-
linked++;
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
if (migrated > 0 || merged > 0 || linked > 0) {
|
|
590
|
-
console.log((0, ui_1.ok)(`Synced shared project memory: ${migrated} migrated, ${merged} merged conflict(s), ${linked} linked`));
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
/**
|
|
594
|
-
* Normalize plugin metadata and reconcile marketplace metadata for the active config dir.
|
|
595
|
-
*/
|
|
596
|
-
normalizeSharedPluginMetadataPaths(configDir) {
|
|
597
|
-
this.normalizePluginRegistryPaths(configDir);
|
|
598
|
-
this.normalizeMarketplaceRegistryPaths(configDir);
|
|
599
|
-
}
|
|
600
|
-
normalizeSharedPluginMetadataPathsLocked(configDir) {
|
|
601
|
-
this.pluginLayoutLock.withNamedLockSync('__plugin-layout__', () => {
|
|
602
|
-
this.normalizeSharedPluginMetadataPaths(configDir);
|
|
603
|
-
});
|
|
604
|
-
}
|
|
605
|
-
/**
|
|
606
|
-
* Normalize plugin registry paths to use canonical ~/.claude/ paths
|
|
607
|
-
* instead of instance-specific ~/.ccs/instances/<name>/ paths.
|
|
608
|
-
*
|
|
609
|
-
* This ensures installed_plugins.json is consistent regardless of
|
|
610
|
-
* which CCS instance installed the plugin.
|
|
611
|
-
*/
|
|
612
|
-
normalizePluginRegistryPaths(configDir) {
|
|
613
|
-
this.normalizePluginMetadataFiles('installed_plugins.json', configDir, 'Normalized plugin registry paths', 'plugin registry');
|
|
614
|
-
}
|
|
615
|
-
/**
|
|
616
|
-
* Reconcile marketplace registry content into the active config dir while
|
|
617
|
-
* keeping the global ~/.claude copy up to date for non-instance flows.
|
|
618
|
-
*/
|
|
619
|
-
normalizeMarketplaceRegistryPaths(configDir) {
|
|
620
|
-
const successMessage = 'Synchronized marketplace registry paths';
|
|
621
|
-
const warningLabel = 'marketplace registry';
|
|
622
|
-
try {
|
|
623
|
-
const sourcePaths = this.getMarketplaceRegistrySourcePaths(configDir);
|
|
624
|
-
this.writePluginMetadataFile(path.join(this.claudeDir, 'plugins', 'known_marketplaces.json'), this.buildMarketplaceRegistryContent(sourcePaths, this.claudeDir), successMessage);
|
|
625
|
-
if (configDir && path.resolve(configDir) !== path.resolve(this.claudeDir)) {
|
|
626
|
-
this.writePluginMetadataFile(path.join(configDir, 'plugins', 'known_marketplaces.json'), this.buildMarketplaceRegistryContent(sourcePaths, configDir), successMessage);
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
catch (err) {
|
|
630
|
-
console.log((0, ui_1.warn)(`Could not synchronize ${warningLabel}: ${err.message}`));
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
normalizePluginMetadataFiles(fileName, configDir, successMessage, warningLabel) {
|
|
634
|
-
const seen = new Set();
|
|
635
|
-
for (const registryPath of this.getPluginMetadataFilePaths(fileName, configDir)) {
|
|
636
|
-
const dedupeKey = this.resolveCanonicalPath(registryPath);
|
|
637
|
-
if (seen.has(dedupeKey)) {
|
|
638
|
-
continue;
|
|
639
|
-
}
|
|
640
|
-
seen.add(dedupeKey);
|
|
641
|
-
this.normalizePluginMetadataFile(registryPath, successMessage, warningLabel);
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
getPluginMetadataFilePaths(fileName, configDir) {
|
|
645
|
-
const pluginDirs = new Set([
|
|
646
|
-
path.join(this.claudeDir, 'plugins'),
|
|
647
|
-
path.join(this.sharedDir, 'plugins'),
|
|
648
|
-
]);
|
|
649
|
-
if (configDir && path.resolve(configDir) !== path.resolve(this.claudeDir)) {
|
|
650
|
-
pluginDirs.add(path.join(configDir, 'plugins'));
|
|
651
|
-
}
|
|
652
|
-
return [...pluginDirs].map((pluginDir) => path.join(pluginDir, fileName));
|
|
653
|
-
}
|
|
654
|
-
normalizePluginMetadataFile(registryPath, successMessage, warningLabel) {
|
|
655
|
-
if (!fs.existsSync(registryPath)) {
|
|
656
|
-
return;
|
|
657
|
-
}
|
|
658
|
-
try {
|
|
659
|
-
const original = fs.readFileSync(registryPath, 'utf8');
|
|
660
|
-
const normalized = (0, plugin_path_normalizer_1.normalizePluginMetadataContent)(original);
|
|
661
|
-
if (normalized !== original) {
|
|
662
|
-
fs.writeFileSync(registryPath, normalized, 'utf8');
|
|
663
|
-
console.log((0, ui_1.ok)(successMessage));
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
catch (err) {
|
|
667
|
-
console.log((0, ui_1.warn)(`Could not normalize ${warningLabel}: ${err.message}`));
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
getMarketplaceRegistrySourcePaths(configDir) {
|
|
671
|
-
const sourcePaths = new Set([
|
|
672
|
-
path.join(this.claudeDir, 'plugins', 'known_marketplaces.json'),
|
|
673
|
-
]);
|
|
674
|
-
for (const instancePath of (0, instance_directory_1.listAccountInstancePaths)(this.instancesDir)) {
|
|
675
|
-
sourcePaths.add(path.join(instancePath, 'plugins', 'known_marketplaces.json'));
|
|
676
|
-
}
|
|
677
|
-
if (configDir && path.resolve(configDir) !== path.resolve(this.claudeDir)) {
|
|
678
|
-
sourcePaths.add(path.join(configDir, 'plugins', 'known_marketplaces.json'));
|
|
679
|
-
}
|
|
680
|
-
return [...sourcePaths];
|
|
681
|
-
}
|
|
682
|
-
buildMarketplaceRegistryContent(sourcePaths, targetConfigDir) {
|
|
683
|
-
const merged = {};
|
|
684
|
-
for (const registryPath of sourcePaths) {
|
|
685
|
-
if (!fs.existsSync(registryPath)) {
|
|
686
|
-
continue;
|
|
687
|
-
}
|
|
688
|
-
try {
|
|
689
|
-
const parsed = JSON.parse(fs.readFileSync(registryPath, 'utf8'));
|
|
690
|
-
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
691
|
-
continue;
|
|
692
|
-
}
|
|
693
|
-
for (const [name, value] of Object.entries(parsed)) {
|
|
694
|
-
if (!this.isMarketplaceRegistryEntry(value)) {
|
|
695
|
-
continue;
|
|
696
|
-
}
|
|
697
|
-
merged[name] = (0, plugin_path_normalizer_1.normalizePluginMetadataValue)(value, targetConfigDir).normalized;
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
catch (err) {
|
|
701
|
-
console.log((0, ui_1.warn)(`Skipping malformed marketplace registry ${registryPath}: ${err.message}`));
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
const discoveredEntries = this.discoverMarketplaceEntries(targetConfigDir);
|
|
705
|
-
// Keep only registry entries that have a physical directory, and update their
|
|
706
|
-
// installLocation. Entries only on disk (no registry record) are excluded —
|
|
707
|
-
// they lack required schema fields that Claude Code enforces.
|
|
708
|
-
for (const name of Object.keys(merged)) {
|
|
709
|
-
const entry = merged[name];
|
|
710
|
-
if (!(name in discoveredEntries)) {
|
|
711
|
-
delete merged[name];
|
|
712
|
-
}
|
|
713
|
-
else if (this.isMarketplaceRegistryEntry(entry)) {
|
|
714
|
-
merged[name] = {
|
|
715
|
-
...entry,
|
|
716
|
-
installLocation: discoveredEntries[name].installLocation,
|
|
717
|
-
};
|
|
718
|
-
}
|
|
719
|
-
else {
|
|
720
|
-
delete merged[name];
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
return JSON.stringify(merged, null, 2);
|
|
724
|
-
}
|
|
725
|
-
discoverMarketplaceEntries(targetConfigDir) {
|
|
726
|
-
const marketplacesDir = path.join(targetConfigDir, 'plugins', 'marketplaces');
|
|
727
|
-
if (!fs.existsSync(marketplacesDir)) {
|
|
728
|
-
return {};
|
|
729
|
-
}
|
|
730
|
-
const discovered = {};
|
|
731
|
-
for (const entry of fs.readdirSync(marketplacesDir, { withFileTypes: true })) {
|
|
732
|
-
if (!entry.isDirectory()) {
|
|
733
|
-
continue;
|
|
734
|
-
}
|
|
735
|
-
// Skip hidden dirs and Claude Code rename-dance leftovers (.staging/.bak).
|
|
736
|
-
if (this.isTransientMarketplaceDirectory(entry.name)) {
|
|
737
|
-
continue;
|
|
738
|
-
}
|
|
739
|
-
discovered[entry.name] = {
|
|
740
|
-
installLocation: path.join(targetConfigDir, 'plugins', 'marketplaces', entry.name),
|
|
741
|
-
};
|
|
742
|
-
}
|
|
743
|
-
return discovered;
|
|
744
|
-
}
|
|
745
|
-
isTransientMarketplaceDirectory(name) {
|
|
746
|
-
return name.startsWith('.') || name.endsWith('.staging') || name.endsWith('.bak');
|
|
747
|
-
}
|
|
748
|
-
isMarketplaceRegistryEntry(value) {
|
|
749
|
-
return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
|
|
750
|
-
}
|
|
751
|
-
writePluginMetadataFile(registryPath, content, successMessage) {
|
|
752
|
-
fs.mkdirSync(path.dirname(registryPath), { recursive: true, mode: 0o700 });
|
|
753
|
-
const current = fs.existsSync(registryPath) ? fs.readFileSync(registryPath, 'utf8') : null;
|
|
754
|
-
if (current === content) {
|
|
755
|
-
return;
|
|
756
|
-
}
|
|
757
|
-
fs.writeFileSync(registryPath, content, 'utf8');
|
|
758
|
-
console.log((0, ui_1.ok)(successMessage));
|
|
759
|
-
}
|
|
760
|
-
/**
|
|
761
|
-
* Migrate from v3.1.1 (copied data in ~/.ccs/shared/) to v3.2.0 (symlinks to ~/.claude/)
|
|
762
|
-
* Runs once on upgrade
|
|
763
|
-
*/
|
|
764
|
-
migrateFromV311() {
|
|
765
|
-
// Check if migration already done (shared dirs are symlinks)
|
|
766
|
-
const commandsPath = path.join(this.sharedDir, 'commands');
|
|
767
|
-
if (fs.existsSync(commandsPath)) {
|
|
768
|
-
try {
|
|
769
|
-
if (fs.lstatSync(commandsPath).isSymbolicLink()) {
|
|
770
|
-
return; // Already migrated
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
catch (_err) {
|
|
774
|
-
// Continue with migration
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
console.log((0, ui_1.info)('Migrating from v3.1.1 to v3.2.0...'));
|
|
778
|
-
// Ensure ~/.claude/ exists
|
|
779
|
-
if (!fs.existsSync(this.claudeDir)) {
|
|
780
|
-
fs.mkdirSync(this.claudeDir, { recursive: true, mode: 0o700 });
|
|
781
|
-
}
|
|
782
|
-
// Copy user modifications from ~/.ccs/shared/ to ~/.claude/
|
|
783
|
-
for (const item of this.sharedItems) {
|
|
784
|
-
const sharedPath = path.join(this.sharedDir, item.name);
|
|
785
|
-
const claudePath = path.join(this.claudeDir, item.name);
|
|
786
|
-
if (!fs.existsSync(sharedPath))
|
|
787
|
-
continue;
|
|
788
|
-
try {
|
|
789
|
-
const stats = fs.lstatSync(sharedPath);
|
|
790
|
-
// Handle directories
|
|
791
|
-
if (item.type === 'directory' && stats.isDirectory()) {
|
|
792
|
-
// Create claude dir if missing
|
|
793
|
-
if (!fs.existsSync(claudePath)) {
|
|
794
|
-
fs.mkdirSync(claudePath, { recursive: true, mode: 0o700 });
|
|
795
|
-
}
|
|
796
|
-
// Copy files from shared to claude (preserve user modifications)
|
|
797
|
-
const entries = fs.readdirSync(sharedPath, { withFileTypes: true });
|
|
798
|
-
let copied = 0;
|
|
799
|
-
for (const entry of entries) {
|
|
800
|
-
const src = path.join(sharedPath, entry.name);
|
|
801
|
-
const dest = path.join(claudePath, entry.name);
|
|
802
|
-
// Skip if already exists in claude
|
|
803
|
-
if (fs.existsSync(dest))
|
|
804
|
-
continue;
|
|
805
|
-
if (entry.isDirectory()) {
|
|
806
|
-
fs.cpSync(src, dest, { recursive: true });
|
|
807
|
-
}
|
|
808
|
-
else {
|
|
809
|
-
fs.copyFileSync(src, dest);
|
|
810
|
-
}
|
|
811
|
-
copied++;
|
|
812
|
-
}
|
|
813
|
-
if (copied > 0) {
|
|
814
|
-
console.log((0, ui_1.ok)(`Migrated ${copied} ${item.name} to ~/.claude/${item.name}`));
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
// Handle files (settings.json)
|
|
818
|
-
else if (item.type === 'file' && stats.isFile()) {
|
|
819
|
-
// Only copy if ~/.claude/ version doesn't exist
|
|
820
|
-
if (!fs.existsSync(claudePath)) {
|
|
821
|
-
fs.copyFileSync(sharedPath, claudePath);
|
|
822
|
-
console.log((0, ui_1.ok)(`Migrated ${item.name} to ~/.claude/${item.name}`));
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
catch (_err) {
|
|
827
|
-
console.log((0, ui_1.warn)(`Failed to migrate ${item.name}: ${_err.message}`));
|
|
828
|
-
}
|
|
829
|
-
}
|
|
830
|
-
// Now run ensureSharedDirectories to create symlinks
|
|
831
|
-
this.ensureSharedDirectories();
|
|
832
|
-
// Update all instances to use new symlinks
|
|
833
|
-
if (fs.existsSync(this.instancesDir)) {
|
|
834
|
-
try {
|
|
835
|
-
for (const instance of (0, instance_directory_1.listAccountInstanceNames)(this.instancesDir)) {
|
|
836
|
-
const instancePath = path.join(this.instancesDir, instance);
|
|
837
|
-
try {
|
|
838
|
-
this.linkSharedDirectories(instancePath);
|
|
839
|
-
}
|
|
840
|
-
catch (_err) {
|
|
841
|
-
console.log((0, ui_1.warn)(`Failed to update instance ${instance}: ${_err.message}`));
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
}
|
|
845
|
-
catch (_err) {
|
|
846
|
-
// No instances to update
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
console.log((0, ui_1.ok)('Migration to v3.2.0 complete'));
|
|
850
|
-
}
|
|
851
|
-
/**
|
|
852
|
-
* Migrate existing instances from isolated to shared settings.json (v4.4+)
|
|
853
|
-
* Runs once on upgrade
|
|
854
|
-
*/
|
|
855
|
-
migrateToSharedSettings() {
|
|
856
|
-
console.log((0, ui_1.info)('Migrating instances to shared settings.json...'));
|
|
857
|
-
// Ensure ~/.claude/settings.json exists (authoritative source)
|
|
858
|
-
const claudeSettings = path.join(this.claudeDir, 'settings.json');
|
|
859
|
-
if (!fs.existsSync(claudeSettings)) {
|
|
860
|
-
// Create empty settings if missing
|
|
861
|
-
fs.writeFileSync(claudeSettings, JSON.stringify({}, null, 2), 'utf8');
|
|
862
|
-
console.log((0, ui_1.info)('Created ~/.claude/settings.json'));
|
|
863
|
-
}
|
|
864
|
-
// Ensure shared settings.json symlink exists
|
|
865
|
-
this.ensureSharedDirectories();
|
|
866
|
-
// Migrate each instance
|
|
867
|
-
if (!fs.existsSync(this.instancesDir)) {
|
|
868
|
-
console.log((0, ui_1.info)('No instances to migrate'));
|
|
869
|
-
return;
|
|
870
|
-
}
|
|
871
|
-
const instances = (0, instance_directory_1.listAccountInstanceNames)(this.instancesDir);
|
|
872
|
-
let migrated = 0;
|
|
873
|
-
let skipped = 0;
|
|
874
|
-
for (const instance of instances) {
|
|
875
|
-
const instancePath = path.join(this.instancesDir, instance);
|
|
876
|
-
const instanceSettings = path.join(instancePath, 'settings.json');
|
|
877
|
-
try {
|
|
878
|
-
// Check if already symlink
|
|
879
|
-
if (fs.existsSync(instanceSettings)) {
|
|
880
|
-
const stats = fs.lstatSync(instanceSettings);
|
|
881
|
-
if (stats.isSymbolicLink()) {
|
|
882
|
-
skipped++;
|
|
883
|
-
continue; // Already migrated
|
|
884
|
-
}
|
|
885
|
-
// Backup existing settings
|
|
886
|
-
const backup = instanceSettings + '.pre-shared-migration';
|
|
887
|
-
if (!fs.existsSync(backup)) {
|
|
888
|
-
fs.copyFileSync(instanceSettings, backup);
|
|
889
|
-
console.log((0, ui_1.info)(`Backed up ${instance}/settings.json`));
|
|
890
|
-
}
|
|
891
|
-
// Remove old settings.json
|
|
892
|
-
fs.unlinkSync(instanceSettings);
|
|
893
|
-
}
|
|
894
|
-
// Create symlink via SharedManager
|
|
895
|
-
const sharedSettings = path.join(this.sharedDir, 'settings.json');
|
|
896
|
-
try {
|
|
897
|
-
fs.symlinkSync(sharedSettings, instanceSettings, 'file');
|
|
898
|
-
migrated++;
|
|
899
|
-
}
|
|
900
|
-
catch (_err) {
|
|
901
|
-
// Windows fallback
|
|
902
|
-
if (process.platform === 'win32') {
|
|
903
|
-
fs.copyFileSync(sharedSettings, instanceSettings);
|
|
904
|
-
console.log((0, ui_1.warn)(`Symlink failed for ${instance}, copied instead`));
|
|
905
|
-
migrated++;
|
|
906
|
-
}
|
|
907
|
-
else {
|
|
908
|
-
throw _err;
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
}
|
|
912
|
-
catch (_err) {
|
|
913
|
-
console.log((0, ui_1.warn)(`Failed to migrate ${instance}: ${_err.message}`));
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
|
-
console.log((0, ui_1.ok)(`Migrated ${migrated} instance(s), skipped ${skipped}`));
|
|
917
|
-
}
|
|
918
|
-
/**
|
|
919
|
-
* Ensure memory path is linked to shared memory root.
|
|
920
|
-
* Returns true when a link/copy was created or updated.
|
|
921
|
-
*/
|
|
922
|
-
async ensureProjectMemoryLink(linkPath, targetPath) {
|
|
923
|
-
await this.ensureDirectory(targetPath);
|
|
924
|
-
const linkStats = await this.getLstat(linkPath);
|
|
925
|
-
if (linkStats) {
|
|
926
|
-
if (linkStats.isSymbolicLink() && (await this.isSymlinkTarget(linkPath, targetPath))) {
|
|
927
|
-
return false;
|
|
928
|
-
}
|
|
929
|
-
if (linkStats.isDirectory()) {
|
|
930
|
-
await fs.promises.rm(linkPath, { recursive: true, force: true });
|
|
931
|
-
}
|
|
932
|
-
else {
|
|
933
|
-
await fs.promises.unlink(linkPath);
|
|
934
|
-
}
|
|
935
|
-
}
|
|
936
|
-
const symlinkType = process.platform === 'win32' ? 'junction' : 'dir';
|
|
937
|
-
const linkTarget = process.platform === 'win32' ? path.resolve(targetPath) : targetPath;
|
|
938
|
-
try {
|
|
939
|
-
await fs.promises.symlink(linkTarget, linkPath, symlinkType);
|
|
940
|
-
return true;
|
|
941
|
-
}
|
|
942
|
-
catch (_err) {
|
|
943
|
-
if (process.platform === 'win32') {
|
|
944
|
-
this.copyDirectoryFallback(targetPath, linkPath);
|
|
945
|
-
console.log((0, ui_1.warn)(`Symlink failed for project memory, copied instead (enable Developer Mode)`));
|
|
946
|
-
return true;
|
|
947
|
-
}
|
|
948
|
-
throw _err;
|
|
949
|
-
}
|
|
950
|
-
}
|
|
951
|
-
/**
|
|
952
|
-
* Check whether symlink points to expected target.
|
|
953
|
-
*/
|
|
954
|
-
async isSymlinkTarget(linkPath, expectedTarget) {
|
|
955
|
-
try {
|
|
956
|
-
const stats = await fs.promises.lstat(linkPath);
|
|
957
|
-
if (!stats.isSymbolicLink()) {
|
|
958
|
-
return false;
|
|
959
|
-
}
|
|
960
|
-
const currentTarget = await fs.promises.readlink(linkPath);
|
|
961
|
-
const resolvedCurrentTarget = path.resolve(path.dirname(linkPath), currentTarget);
|
|
962
|
-
const resolvedExpectedTarget = path.resolve(expectedTarget);
|
|
963
|
-
return resolvedCurrentTarget === resolvedExpectedTarget;
|
|
964
|
-
}
|
|
965
|
-
catch (_err) {
|
|
966
|
-
return false;
|
|
967
|
-
}
|
|
968
|
-
}
|
|
969
|
-
/**
|
|
970
|
-
* Resolve symlink target to absolute path.
|
|
971
|
-
*/
|
|
972
|
-
async resolveSymlinkTargetPath(linkPath) {
|
|
973
|
-
try {
|
|
974
|
-
const currentTarget = await fs.promises.readlink(linkPath);
|
|
975
|
-
return path.resolve(path.dirname(linkPath), currentTarget);
|
|
976
|
-
}
|
|
977
|
-
catch (_err) {
|
|
978
|
-
return null;
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
/**
|
|
982
|
-
* Guard project merge operations to known CCS-managed roots only.
|
|
983
|
-
*/
|
|
984
|
-
isSafeProjectsMergeSource(sourcePath, instanceName) {
|
|
985
|
-
const resolvedSource = this.resolveCanonicalPath(sourcePath);
|
|
986
|
-
const sharedContextRoot = this.resolveCanonicalPath(path.join(this.sharedDir, 'context-groups'));
|
|
987
|
-
const instanceProjectsRoot = this.resolveCanonicalPath(path.join(this.instancesDir, instanceName, 'projects'));
|
|
988
|
-
return (this.isPathWithinDirectory(resolvedSource, sharedContextRoot) ||
|
|
989
|
-
this.isPathWithinDirectory(resolvedSource, instanceProjectsRoot));
|
|
990
|
-
}
|
|
991
|
-
/**
|
|
992
|
-
* Guard advanced continuity merge operations to known CCS-managed roots only.
|
|
993
|
-
*/
|
|
994
|
-
isSafeContinuityMergeSource(sourcePath, instanceName, artifactName) {
|
|
995
|
-
const resolvedSource = this.resolveCanonicalPath(sourcePath);
|
|
996
|
-
const sharedContextRoot = this.resolveCanonicalPath(path.join(this.sharedDir, 'context-groups'));
|
|
997
|
-
const instanceArtifactRoot = this.resolveCanonicalPath(path.join(this.instancesDir, instanceName, artifactName));
|
|
998
|
-
const normalizedSource = process.platform === 'win32' ? resolvedSource.toLowerCase() : resolvedSource;
|
|
999
|
-
const continuitySegment = process.platform === 'win32'
|
|
1000
|
-
? `${path.sep}continuity${path.sep}`.toLowerCase()
|
|
1001
|
-
: `${path.sep}continuity${path.sep}`;
|
|
1002
|
-
const withinSharedContinuity = this.isPathWithinDirectory(resolvedSource, sharedContextRoot) &&
|
|
1003
|
-
normalizedSource.includes(continuitySegment);
|
|
1004
|
-
return (withinSharedContinuity || this.isPathWithinDirectory(resolvedSource, instanceArtifactRoot));
|
|
1005
|
-
}
|
|
1006
|
-
/**
|
|
1007
|
-
* Link directory with Windows fallback to recursive copy.
|
|
1008
|
-
*/
|
|
1009
|
-
async linkDirectoryWithFallback(targetPath, linkPath) {
|
|
1010
|
-
const symlinkType = process.platform === 'win32' ? 'junction' : 'dir';
|
|
1011
|
-
const linkTarget = process.platform === 'win32' ? path.resolve(targetPath) : targetPath;
|
|
1012
|
-
try {
|
|
1013
|
-
await fs.promises.symlink(linkTarget, linkPath, symlinkType);
|
|
1014
|
-
}
|
|
1015
|
-
catch (_err) {
|
|
1016
|
-
if (process.platform === 'win32') {
|
|
1017
|
-
this.copyDirectoryFallback(targetPath, linkPath);
|
|
1018
|
-
console.log((0, ui_1.warn)(`Symlink failed for context projects, copied instead (enable Developer Mode)`));
|
|
1019
|
-
return;
|
|
1020
|
-
}
|
|
1021
|
-
throw _err;
|
|
1022
|
-
}
|
|
1023
|
-
}
|
|
1024
|
-
/**
|
|
1025
|
-
* Migrate legacy per-project memory symlinks that point to ~/.ccs/shared/memory.
|
|
1026
|
-
* This preserves data while restoring true profile isolation.
|
|
1027
|
-
*/
|
|
1028
|
-
async detachLegacySharedMemoryLinks(projectsPath, instanceName) {
|
|
1029
|
-
const sharedMemoryRoot = this.resolveCanonicalPath(path.join(this.sharedDir, 'memory'));
|
|
1030
|
-
let projectEntries = [];
|
|
1031
|
-
try {
|
|
1032
|
-
projectEntries = await fs.promises.readdir(projectsPath, { withFileTypes: true });
|
|
1033
|
-
}
|
|
1034
|
-
catch (_err) {
|
|
1035
|
-
return;
|
|
1036
|
-
}
|
|
1037
|
-
for (const entry of projectEntries) {
|
|
1038
|
-
if (!entry.isDirectory()) {
|
|
1039
|
-
continue;
|
|
1040
|
-
}
|
|
1041
|
-
const projectPath = path.join(projectsPath, entry.name);
|
|
1042
|
-
const memoryPath = path.join(projectPath, 'memory');
|
|
1043
|
-
const memoryStats = await this.getLstat(memoryPath);
|
|
1044
|
-
if (!memoryStats?.isSymbolicLink()) {
|
|
1045
|
-
continue;
|
|
1046
|
-
}
|
|
1047
|
-
const memoryTarget = await this.resolveSymlinkTargetPath(memoryPath);
|
|
1048
|
-
if (!memoryTarget) {
|
|
1049
|
-
continue;
|
|
1050
|
-
}
|
|
1051
|
-
const canonicalMemoryTarget = this.resolveCanonicalPath(memoryTarget);
|
|
1052
|
-
if (!this.isPathWithinDirectory(canonicalMemoryTarget, sharedMemoryRoot)) {
|
|
1053
|
-
continue;
|
|
1054
|
-
}
|
|
1055
|
-
await fs.promises.unlink(memoryPath);
|
|
1056
|
-
await this.ensureDirectory(memoryPath);
|
|
1057
|
-
if (await this.pathExists(canonicalMemoryTarget)) {
|
|
1058
|
-
await this.mergeDirectoryWithConflictCopies(canonicalMemoryTarget, memoryPath, instanceName);
|
|
1059
|
-
}
|
|
1060
|
-
}
|
|
1061
|
-
}
|
|
1062
|
-
/**
|
|
1063
|
-
* Move directory, with cross-device fallback.
|
|
1064
|
-
*/
|
|
1065
|
-
async moveDirectory(src, dest) {
|
|
1066
|
-
try {
|
|
1067
|
-
await fs.promises.rename(src, dest);
|
|
1068
|
-
}
|
|
1069
|
-
catch (err) {
|
|
1070
|
-
const error = err;
|
|
1071
|
-
if (error.code !== 'EXDEV') {
|
|
1072
|
-
throw err;
|
|
1073
|
-
}
|
|
1074
|
-
await fs.promises.cp(src, dest, { recursive: true });
|
|
1075
|
-
await fs.promises.rm(src, { recursive: true, force: true });
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
/**
|
|
1079
|
-
* Merge source into target. On file conflicts, keep target and copy source
|
|
1080
|
-
* as "<name>.migrated-from-<instance>[-N]" to avoid data loss.
|
|
1081
|
-
*/
|
|
1082
|
-
async mergeDirectoryWithConflictCopies(sourceDir, targetDir, instanceName) {
|
|
1083
|
-
await this.ensureDirectory(targetDir);
|
|
1084
|
-
let conflicts = 0;
|
|
1085
|
-
const entries = await fs.promises.readdir(sourceDir, { withFileTypes: true });
|
|
1086
|
-
for (const entry of entries) {
|
|
1087
|
-
const sourcePath = path.join(sourceDir, entry.name);
|
|
1088
|
-
const targetPath = path.join(targetDir, entry.name);
|
|
1089
|
-
if (entry.isDirectory()) {
|
|
1090
|
-
conflicts += await this.mergeDirectoryWithConflictCopies(sourcePath, targetPath, instanceName);
|
|
1091
|
-
continue;
|
|
1092
|
-
}
|
|
1093
|
-
if (entry.isFile()) {
|
|
1094
|
-
if (!(await this.pathExists(targetPath))) {
|
|
1095
|
-
await fs.promises.copyFile(sourcePath, targetPath);
|
|
1096
|
-
continue;
|
|
1097
|
-
}
|
|
1098
|
-
if (await this.fileContentsEqual(sourcePath, targetPath)) {
|
|
1099
|
-
continue;
|
|
1100
|
-
}
|
|
1101
|
-
const conflictPath = await this.getConflictCopyPath(targetPath, instanceName);
|
|
1102
|
-
await fs.promises.copyFile(sourcePath, conflictPath);
|
|
1103
|
-
conflicts++;
|
|
1104
|
-
}
|
|
1105
|
-
}
|
|
1106
|
-
return conflicts;
|
|
1107
|
-
}
|
|
1108
|
-
/**
|
|
1109
|
-
* Compare two files byte-for-byte.
|
|
1110
|
-
*/
|
|
1111
|
-
async fileContentsEqual(fileA, fileB) {
|
|
1112
|
-
try {
|
|
1113
|
-
const [statA, statB] = await Promise.all([fs.promises.stat(fileA), fs.promises.stat(fileB)]);
|
|
1114
|
-
if (statA.size !== statB.size) {
|
|
1115
|
-
return false;
|
|
1116
|
-
}
|
|
1117
|
-
const [contentA, contentB] = await Promise.all([
|
|
1118
|
-
fs.promises.readFile(fileA),
|
|
1119
|
-
fs.promises.readFile(fileB),
|
|
1120
|
-
]);
|
|
1121
|
-
return contentA.equals(contentB);
|
|
1122
|
-
}
|
|
1123
|
-
catch (_err) {
|
|
1124
|
-
return false;
|
|
1125
|
-
}
|
|
1126
|
-
}
|
|
1127
|
-
/**
|
|
1128
|
-
* Build a non-destructive conflict copy path.
|
|
1129
|
-
*/
|
|
1130
|
-
async getConflictCopyPath(existingTargetPath, instanceName) {
|
|
1131
|
-
const safeInstanceName = instanceName.replace(/[^a-zA-Z0-9_-]/g, '-').toLowerCase();
|
|
1132
|
-
const baseSuffix = `.migrated-from-${safeInstanceName}`;
|
|
1133
|
-
let candidate = `${existingTargetPath}${baseSuffix}`;
|
|
1134
|
-
let sequence = 1;
|
|
1135
|
-
while (await this.pathExists(candidate)) {
|
|
1136
|
-
candidate = `${existingTargetPath}${baseSuffix}-${sequence}`;
|
|
1137
|
-
sequence++;
|
|
1138
|
-
}
|
|
1139
|
-
return candidate;
|
|
1140
|
-
}
|
|
1141
|
-
symlinkPointsTo(linkPath, expectedTarget) {
|
|
1142
|
-
try {
|
|
1143
|
-
const currentTarget = fs.readlinkSync(linkPath);
|
|
1144
|
-
const resolvedCurrentTarget = path.resolve(path.dirname(linkPath), currentTarget);
|
|
1145
|
-
return (this.resolveCanonicalPath(resolvedCurrentTarget) ===
|
|
1146
|
-
this.resolveCanonicalPath(expectedTarget));
|
|
1147
|
-
}
|
|
1148
|
-
catch {
|
|
1149
|
-
return false;
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
detachManagedPluginLayout(instancePath) {
|
|
1153
|
-
const pluginsPath = path.join(instancePath, 'plugins');
|
|
1154
|
-
if (!fs.existsSync(pluginsPath)) {
|
|
1155
|
-
return;
|
|
1156
|
-
}
|
|
1157
|
-
const stats = fs.lstatSync(pluginsPath);
|
|
1158
|
-
const sharedPluginsPath = path.join(this.sharedDir, 'plugins');
|
|
1159
|
-
if (stats.isSymbolicLink()) {
|
|
1160
|
-
if (this.symlinkPointsTo(pluginsPath, sharedPluginsPath)) {
|
|
1161
|
-
this.removeExistingPath(pluginsPath, 'directory');
|
|
1162
|
-
}
|
|
1163
|
-
return;
|
|
1164
|
-
}
|
|
1165
|
-
if (!stats.isDirectory()) {
|
|
1166
|
-
return;
|
|
1167
|
-
}
|
|
1168
|
-
let removedManagedEntries = false;
|
|
1169
|
-
for (const item of this.getSharedPluginLinkItems()) {
|
|
1170
|
-
const pluginEntryPath = path.join(pluginsPath, item.name);
|
|
1171
|
-
if (!fs.existsSync(pluginEntryPath)) {
|
|
1172
|
-
continue;
|
|
1173
|
-
}
|
|
1174
|
-
const entryStats = fs.lstatSync(pluginEntryPath);
|
|
1175
|
-
if (!entryStats.isSymbolicLink()) {
|
|
1176
|
-
continue;
|
|
1177
|
-
}
|
|
1178
|
-
if (this.symlinkPointsTo(pluginEntryPath, path.join(sharedPluginsPath, item.name))) {
|
|
1179
|
-
this.removeExistingPath(pluginEntryPath, item.type);
|
|
1180
|
-
removedManagedEntries = true;
|
|
1181
|
-
}
|
|
1182
|
-
}
|
|
1183
|
-
if (!removedManagedEntries) {
|
|
1184
|
-
return;
|
|
1185
|
-
}
|
|
1186
|
-
this.reconcileLocalMarketplaceRegistry(instancePath);
|
|
1187
|
-
if (fs.readdirSync(pluginsPath).length === 0) {
|
|
1188
|
-
fs.rmSync(pluginsPath, { recursive: true, force: true });
|
|
1189
|
-
}
|
|
1190
|
-
}
|
|
1191
|
-
reconcileLocalMarketplaceRegistry(configDir) {
|
|
1192
|
-
const registryPath = path.join(configDir, 'plugins', 'known_marketplaces.json');
|
|
1193
|
-
if (!fs.existsSync(registryPath)) {
|
|
1194
|
-
return;
|
|
1195
|
-
}
|
|
1196
|
-
const discoveredEntries = this.discoverMarketplaceEntries(configDir);
|
|
1197
|
-
if (Object.keys(discoveredEntries).length === 0) {
|
|
1198
|
-
this.removeExistingPath(registryPath, 'file');
|
|
1199
|
-
return;
|
|
1200
|
-
}
|
|
1201
|
-
let parsed = {};
|
|
1202
|
-
try {
|
|
1203
|
-
const raw = JSON.parse(fs.readFileSync(registryPath, 'utf8'));
|
|
1204
|
-
if (raw && typeof raw === 'object' && !Array.isArray(raw)) {
|
|
1205
|
-
parsed = raw;
|
|
1206
|
-
}
|
|
1207
|
-
}
|
|
1208
|
-
catch {
|
|
1209
|
-
parsed = {};
|
|
1210
|
-
}
|
|
1211
|
-
const reconciled = Object.fromEntries(Object.entries(discoveredEntries).map(([name, value]) => {
|
|
1212
|
-
const existing = parsed[name];
|
|
1213
|
-
if (existing && typeof existing === 'object' && !Array.isArray(existing)) {
|
|
1214
|
-
return [
|
|
1215
|
-
name,
|
|
1216
|
-
{
|
|
1217
|
-
...(0, plugin_path_normalizer_1.normalizePluginMetadataValue)(existing, configDir).normalized,
|
|
1218
|
-
installLocation: value.installLocation,
|
|
1219
|
-
},
|
|
1220
|
-
];
|
|
1221
|
-
}
|
|
1222
|
-
return [name, value];
|
|
1223
|
-
}));
|
|
1224
|
-
this.writePluginMetadataFile(registryPath, JSON.stringify(reconciled, null, 2), 'Synchronized marketplace registry paths');
|
|
1225
|
-
}
|
|
1226
|
-
resolveCanonicalPath(targetPath) {
|
|
1227
|
-
try {
|
|
1228
|
-
return fs.realpathSync.native(targetPath);
|
|
1229
|
-
}
|
|
1230
|
-
catch {
|
|
1231
|
-
return path.resolve(targetPath);
|
|
1232
|
-
}
|
|
1233
|
-
}
|
|
1234
|
-
isPathWithinDirectory(candidatePath, rootPath) {
|
|
1235
|
-
const normalizeForCompare = (inputPath) => {
|
|
1236
|
-
const resolved = path.resolve(inputPath);
|
|
1237
|
-
return process.platform === 'win32' ? resolved.toLowerCase() : resolved;
|
|
1238
|
-
};
|
|
1239
|
-
const normalizedCandidate = normalizeForCompare(candidatePath);
|
|
1240
|
-
const normalizedRoot = normalizeForCompare(rootPath);
|
|
1241
|
-
const relative = path.relative(normalizedRoot, normalizedCandidate);
|
|
1242
|
-
return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
|
|
1243
|
-
}
|
|
1244
|
-
async pathExists(targetPath) {
|
|
1245
|
-
try {
|
|
1246
|
-
await fs.promises.access(targetPath);
|
|
1247
|
-
return true;
|
|
1248
|
-
}
|
|
1249
|
-
catch (_err) {
|
|
1250
|
-
return false;
|
|
1251
|
-
}
|
|
1252
|
-
}
|
|
1253
|
-
async ensureDirectory(targetPath) {
|
|
1254
|
-
await fs.promises.mkdir(targetPath, { recursive: true, mode: 0o700 });
|
|
1255
|
-
}
|
|
1256
|
-
async getLstat(targetPath) {
|
|
1257
|
-
try {
|
|
1258
|
-
return await fs.promises.lstat(targetPath);
|
|
1259
|
-
}
|
|
1260
|
-
catch (err) {
|
|
1261
|
-
if (err.code === 'ENOENT') {
|
|
1262
|
-
return null;
|
|
1263
|
-
}
|
|
1264
|
-
throw err;
|
|
1265
|
-
}
|
|
1266
|
-
}
|
|
1267
|
-
getLstatSync(targetPath) {
|
|
1268
|
-
try {
|
|
1269
|
-
return fs.lstatSync(targetPath);
|
|
1270
|
-
}
|
|
1271
|
-
catch (err) {
|
|
1272
|
-
if (err.code === 'ENOENT') {
|
|
1273
|
-
return null;
|
|
1274
|
-
}
|
|
1275
|
-
throw err;
|
|
1276
|
-
}
|
|
1277
|
-
}
|
|
1278
|
-
/**
|
|
1279
|
-
* Copy directory as fallback (Windows without Developer Mode)
|
|
1280
|
-
*/
|
|
1281
|
-
copyDirectoryFallback(src, dest) {
|
|
1282
|
-
if (!fs.existsSync(src)) {
|
|
1283
|
-
fs.mkdirSync(src, { recursive: true, mode: 0o700 });
|
|
1284
|
-
return;
|
|
1285
|
-
}
|
|
1286
|
-
if (!fs.existsSync(dest)) {
|
|
1287
|
-
fs.mkdirSync(dest, { recursive: true, mode: 0o700 });
|
|
1288
|
-
}
|
|
1289
|
-
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
1290
|
-
for (const entry of entries) {
|
|
1291
|
-
const srcPath = path.join(src, entry.name);
|
|
1292
|
-
const destPath = path.join(dest, entry.name);
|
|
1293
|
-
if (entry.isDirectory()) {
|
|
1294
|
-
this.copyDirectoryFallback(srcPath, destPath);
|
|
1295
|
-
}
|
|
1296
|
-
else {
|
|
1297
|
-
fs.copyFileSync(srcPath, destPath);
|
|
1298
|
-
}
|
|
1299
|
-
}
|
|
1300
|
-
}
|
|
1301
|
-
}
|
|
1302
|
-
exports.default = SharedManager;
|
|
21
|
+
exports.normalizePluginMetadataPathString = exports.normalizePluginMetadataContent = exports.default = void 0;
|
|
22
|
+
var orchestrator_1 = require("./shared-manager/orchestrator");
|
|
23
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(orchestrator_1).default; } });
|
|
24
|
+
var plugin_path_normalizer_1 = require("./plugin-path-normalizer");
|
|
25
|
+
Object.defineProperty(exports, "normalizePluginMetadataContent", { enumerable: true, get: function () { return plugin_path_normalizer_1.normalizePluginMetadataContent; } });
|
|
26
|
+
Object.defineProperty(exports, "normalizePluginMetadataPathString", { enumerable: true, get: function () { return plugin_path_normalizer_1.normalizePluginMetadataPathString; } });
|
|
1303
27
|
//# sourceMappingURL=shared-manager.js.map
|