@structured-world/gitlab-mcp 10.1.0 → 12.0.0
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 +8 -8
- package/README.md.in +2 -2
- package/dist/src/accounts/chat-accounts.d.ts +17 -0
- package/dist/src/accounts/chat-accounts.js +245 -0
- package/dist/src/accounts/chat-accounts.js.map +1 -0
- package/dist/src/accounts/instance-tokens.d.ts +2 -0
- package/dist/src/accounts/instance-tokens.js +43 -0
- package/dist/src/accounts/instance-tokens.js.map +1 -0
- package/dist/src/accounts/link.d.ts +16 -0
- package/dist/src/accounts/link.js +469 -0
- package/dist/src/accounts/link.js.map +1 -0
- package/dist/src/accounts/token-account.d.ts +6 -0
- package/dist/src/accounts/token-account.js +13 -0
- package/dist/src/accounts/token-account.js.map +1 -0
- package/dist/src/channel-gateway/format.js +7 -1
- package/dist/src/channel-gateway/format.js.map +1 -1
- package/dist/src/channel-gateway/forwarding.d.ts +3 -0
- package/dist/src/channel-gateway/forwarding.js +8 -1
- package/dist/src/channel-gateway/forwarding.js.map +1 -1
- package/dist/src/channel-gateway/gateway.d.ts +7 -0
- package/dist/src/channel-gateway/gateway.js +80 -16
- package/dist/src/channel-gateway/gateway.js.map +1 -1
- package/dist/src/cli/docker/container-runtime.d.ts +1 -0
- package/dist/src/cli/docker/container-runtime.js +37 -5
- package/dist/src/cli/docker/container-runtime.js.map +1 -1
- package/dist/src/cli/docker/docker-command.js +11 -2
- package/dist/src/cli/docker/docker-command.js.map +1 -1
- package/dist/src/cli/docker/docker-utils.d.ts +1 -0
- package/dist/src/cli/docker/docker-utils.js +137 -27
- package/dist/src/cli/docker/docker-utils.js.map +1 -1
- package/dist/src/cli/docker/oauth-issuer-prompt.d.ts +2 -0
- package/dist/src/cli/docker/oauth-issuer-prompt.js +47 -0
- package/dist/src/cli/docker/oauth-issuer-prompt.js.map +1 -0
- package/dist/src/cli/docker/types.d.ts +18 -4
- package/dist/src/cli/docker/types.js.map +1 -1
- package/dist/src/cli/init/config-generator.d.ts +3 -2
- package/dist/src/cli/init/config-generator.js +15 -0
- package/dist/src/cli/init/config-generator.js.map +1 -1
- package/dist/src/cli/init/types.d.ts +7 -2
- package/dist/src/cli/init/types.js +9 -0
- package/dist/src/cli/init/types.js.map +1 -1
- package/dist/src/cli/init/wizard.js +31 -1
- package/dist/src/cli/init/wizard.js.map +1 -1
- package/dist/src/cli/install/codex.d.ts +25 -0
- package/dist/src/cli/install/codex.js +261 -0
- package/dist/src/cli/install/codex.js.map +1 -0
- package/dist/src/cli/install/detector.js +22 -0
- package/dist/src/cli/install/detector.js.map +1 -1
- package/dist/src/cli/install/index.d.ts +2 -1
- package/dist/src/cli/install/index.js +3 -1
- package/dist/src/cli/install/index.js.map +1 -1
- package/dist/src/cli/install/install-command.d.ts +5 -2
- package/dist/src/cli/install/install-command.js +52 -8
- package/dist/src/cli/install/install-command.js.map +1 -1
- package/dist/src/cli/install/installers.d.ts +8 -8
- package/dist/src/cli/install/installers.js +18 -3
- package/dist/src/cli/install/installers.js.map +1 -1
- package/dist/src/cli/install/notes.d.ts +2 -0
- package/dist/src/cli/install/notes.js +8 -0
- package/dist/src/cli/install/notes.js.map +1 -0
- package/dist/src/cli/install/types.d.ts +1 -0
- package/dist/src/cli/install/types.js +12 -0
- package/dist/src/cli/install/types.js.map +1 -1
- package/dist/src/cli/list-tools.js +14 -35
- package/dist/src/cli/list-tools.js.map +1 -1
- package/dist/src/cli/plugin/build.d.ts +23 -0
- package/dist/src/cli/plugin/build.js +165 -0
- package/dist/src/cli/plugin/build.js.map +1 -0
- package/dist/src/cli/plugin/command.d.ts +4 -0
- package/dist/src/cli/plugin/command.js +89 -0
- package/dist/src/cli/plugin/command.js.map +1 -0
- package/dist/src/cli/plugin/index.d.ts +5 -0
- package/dist/src/cli/plugin/index.js +15 -0
- package/dist/src/cli/plugin/index.js.map +1 -0
- package/dist/src/cli/plugin/listing.d.ts +21 -0
- package/dist/src/cli/plugin/listing.js +44 -0
- package/dist/src/cli/plugin/listing.js.map +1 -0
- package/dist/src/cli/plugin/validate.d.ts +21 -0
- package/dist/src/cli/plugin/validate.js +496 -0
- package/dist/src/cli/plugin/validate.js.map +1 -0
- package/dist/src/cli/plugin/zip.d.ts +6 -0
- package/dist/src/cli/plugin/zip.js +83 -0
- package/dist/src/cli/plugin/zip.js.map +1 -0
- package/dist/src/cli/setup/flows/configure-existing.js +5 -0
- package/dist/src/cli/setup/flows/configure-existing.js.map +1 -1
- package/dist/src/cli/setup/flows/local-setup.js +3 -0
- package/dist/src/cli/setup/flows/local-setup.js.map +1 -1
- package/dist/src/cli/setup/flows/server-setup.js +15 -0
- package/dist/src/cli/setup/flows/server-setup.js.map +1 -1
- package/dist/src/cli-utils.d.ts +2 -0
- package/dist/src/cli-utils.js +6 -0
- package/dist/src/cli-utils.js.map +1 -1
- package/dist/src/config/instances-loader.js +17 -3
- package/dist/src/config/instances-loader.js.map +1 -1
- package/dist/src/config/instances-schema.d.ts +8 -3
- package/dist/src/config/instances-schema.js +12 -6
- package/dist/src/config/instances-schema.js.map +1 -1
- package/dist/src/config.js.map +1 -1
- package/dist/src/configuration/caller.d.ts +10 -0
- package/dist/src/configuration/caller.js +39 -0
- package/dist/src/configuration/caller.js.map +1 -0
- package/dist/src/configuration/composed-feeds.d.ts +31 -0
- package/dist/src/configuration/composed-feeds.js +698 -0
- package/dist/src/configuration/composed-feeds.js.map +1 -0
- package/dist/src/configuration/composed-listings.d.ts +14 -0
- package/dist/src/configuration/composed-listings.js +157 -0
- package/dist/src/configuration/composed-listings.js.map +1 -0
- package/dist/src/configuration/groups.d.ts +8 -0
- package/dist/src/configuration/groups.js +39 -0
- package/dist/src/configuration/groups.js.map +1 -0
- package/dist/src/configuration/index.d.ts +6 -0
- package/dist/src/configuration/index.js +87 -0
- package/dist/src/configuration/index.js.map +1 -0
- package/dist/src/configuration/policy.d.ts +34 -0
- package/dist/src/configuration/policy.js +122 -0
- package/dist/src/configuration/policy.js.map +1 -0
- package/dist/src/configuration/scope-ids.d.ts +7 -0
- package/dist/src/configuration/scope-ids.js +78 -0
- package/dist/src/configuration/scope-ids.js.map +1 -0
- package/dist/src/configuration/scope-projects.d.ts +5 -0
- package/dist/src/configuration/scope-projects.js +76 -0
- package/dist/src/configuration/scope-projects.js.map +1 -0
- package/dist/src/configuration/scope-targets.d.ts +26 -0
- package/dist/src/configuration/scope-targets.js +307 -0
- package/dist/src/configuration/scope-targets.js.map +1 -0
- package/dist/src/configuration/scoped-execution.d.ts +6 -0
- package/dist/src/configuration/scoped-execution.js +577 -0
- package/dist/src/configuration/scoped-execution.js.map +1 -0
- package/dist/src/configuration/scoped-feeds.d.ts +22 -0
- package/dist/src/configuration/scoped-feeds.js +136 -0
- package/dist/src/configuration/scoped-feeds.js.map +1 -0
- package/dist/src/configuration/service.d.ts +52 -0
- package/dist/src/configuration/service.js +169 -0
- package/dist/src/configuration/service.js.map +1 -0
- package/dist/src/configuration/settings-store.d.ts +20 -0
- package/dist/src/configuration/settings-store.js +228 -0
- package/dist/src/configuration/settings-store.js.map +1 -0
- package/dist/src/configuration/types.d.ts +30 -0
- package/dist/src/configuration/types.js +20 -0
- package/dist/src/configuration/types.js.map +1 -0
- package/dist/src/contracts/storage.d.ts +3 -2
- package/dist/src/dashboard/html-template.js +8 -15
- package/dist/src/dashboard/html-template.js.map +1 -1
- package/dist/src/dashboard/metrics.d.ts +1 -1
- package/dist/src/entities/context/accounts.d.ts +19 -0
- package/dist/src/entities/context/accounts.js +115 -0
- package/dist/src/entities/context/accounts.js.map +1 -0
- package/dist/src/entities/context/connection-check.d.ts +64 -0
- package/dist/src/entities/context/connection-check.js +117 -0
- package/dist/src/entities/context/connection-check.js.map +1 -0
- package/dist/src/entities/context/context-manager.d.ts +10 -23
- package/dist/src/entities/context/context-manager.js +101 -282
- package/dist/src/entities/context/context-manager.js.map +1 -1
- package/dist/src/entities/context/handlers.d.ts +5 -5
- package/dist/src/entities/context/handlers.js +11 -14
- package/dist/src/entities/context/handlers.js.map +1 -1
- package/dist/src/entities/context/output-schema.d.ts +320 -0
- package/dist/src/entities/context/output-schema.js +210 -0
- package/dist/src/entities/context/output-schema.js.map +1 -0
- package/dist/src/entities/context/profile.d.ts +29 -0
- package/dist/src/entities/context/profile.js +72 -0
- package/dist/src/entities/context/profile.js.map +1 -0
- package/dist/src/entities/context/registry.js +140 -3
- package/dist/src/entities/context/registry.js.map +1 -1
- package/dist/src/entities/context/schema.d.ts +32 -14
- package/dist/src/entities/context/schema.js +36 -13
- package/dist/src/entities/context/schema.js.map +1 -1
- package/dist/src/entities/context/scope-search.d.ts +49 -0
- package/dist/src/entities/context/scope-search.js +71 -0
- package/dist/src/entities/context/scope-search.js.map +1 -0
- package/dist/src/entities/context/settings-panel.d.ts +13 -0
- package/dist/src/entities/context/settings-panel.js +508 -0
- package/dist/src/entities/context/settings-panel.js.map +1 -0
- package/dist/src/entities/context/settings.d.ts +78 -0
- package/dist/src/entities/context/settings.js +239 -0
- package/dist/src/entities/context/settings.js.map +1 -0
- package/dist/src/entities/context/types.d.ts +3 -4
- package/dist/src/entities/context/whoami.js +39 -31
- package/dist/src/entities/context/whoami.js.map +1 -1
- package/dist/src/entities/core/registry.js +34 -33
- package/dist/src/entities/core/registry.js.map +1 -1
- package/dist/src/entities/core/schema-readonly.d.ts +4 -4
- package/dist/src/entities/environments/schema-readonly.d.ts +4 -4
- package/dist/src/entities/files/registry.js +3 -2
- package/dist/src/entities/files/registry.js.map +1 -1
- package/dist/src/entities/iterations/registry.js +3 -2
- package/dist/src/entities/iterations/registry.js.map +1 -1
- package/dist/src/entities/mrs/registry.js +6 -4
- package/dist/src/entities/mrs/registry.js.map +1 -1
- package/dist/src/entities/mrs/schema-readonly.d.ts +2 -2
- package/dist/src/entities/mrs/schema-readonly.js +19 -2
- package/dist/src/entities/mrs/schema-readonly.js.map +1 -1
- package/dist/src/entities/mrs/schema.d.ts +1 -1
- package/dist/src/entities/pipelines/registry.js +23 -31
- package/dist/src/entities/pipelines/registry.js.map +1 -1
- package/dist/src/entities/pipelines/schema-readonly.d.ts +11 -11
- package/dist/src/entities/pipelines/schema-readonly.js +5 -2
- package/dist/src/entities/pipelines/schema-readonly.js.map +1 -1
- package/dist/src/entities/pipelines/trace.d.ts +20 -0
- package/dist/src/entities/pipelines/trace.js +156 -0
- package/dist/src/entities/pipelines/trace.js.map +1 -0
- package/dist/src/entities/runners/project-access.d.ts +14 -0
- package/dist/src/entities/runners/project-access.js +64 -0
- package/dist/src/entities/runners/project-access.js.map +1 -0
- package/dist/src/entities/runners/registry.js +54 -26
- package/dist/src/entities/runners/registry.js.map +1 -1
- package/dist/src/entities/search/schema-readonly.d.ts +28 -28
- package/dist/src/graphql/runners.d.ts +26 -1
- package/dist/src/graphql/runners.js +43 -6
- package/dist/src/graphql/runners.js.map +1 -1
- package/dist/src/graphql/vulnerabilities.d.ts +3 -0
- package/dist/src/graphql/vulnerabilities.js +1 -0
- package/dist/src/graphql/vulnerabilities.js.map +1 -1
- package/dist/src/handlers.js +351 -190
- package/dist/src/handlers.js.map +1 -1
- package/dist/src/main.js +23 -5
- package/dist/src/main.js.map +1 -1
- package/dist/src/mcp-apps.d.ts +6 -0
- package/dist/src/mcp-apps.js +8 -0
- package/dist/src/mcp-apps.js.map +1 -0
- package/dist/src/mcp-server-context.d.ts +3 -0
- package/dist/src/mcp-server-context.js +13 -0
- package/dist/src/mcp-server-context.js.map +1 -0
- package/dist/src/middleware/mcp-auth-routes.d.ts +3 -0
- package/dist/src/middleware/mcp-auth-routes.js +9 -0
- package/dist/src/middleware/mcp-auth-routes.js.map +1 -0
- package/dist/src/middleware/oauth-auth.js +87 -24
- package/dist/src/middleware/oauth-auth.js.map +1 -1
- package/dist/src/middleware/rate-limiter.js +11 -10
- package/dist/src/middleware/rate-limiter.js.map +1 -1
- package/dist/src/oauth/authorization-response.d.ts +1 -0
- package/dist/src/oauth/authorization-response.js +14 -0
- package/dist/src/oauth/authorization-response.js.map +1 -0
- package/dist/src/oauth/client-auth.d.ts +16 -0
- package/dist/src/oauth/client-auth.js +73 -0
- package/dist/src/oauth/client-auth.js.map +1 -0
- package/dist/src/oauth/code-exchange.d.ts +7 -0
- package/dist/src/oauth/code-exchange.js +38 -0
- package/dist/src/oauth/code-exchange.js.map +1 -0
- package/dist/src/oauth/config.d.ts +2 -0
- package/dist/src/oauth/config.js +37 -0
- package/dist/src/oauth/config.js.map +1 -1
- package/dist/src/oauth/endpoints/authorize.d.ts +1 -0
- package/dist/src/oauth/endpoints/authorize.js +361 -102
- package/dist/src/oauth/endpoints/authorize.js.map +1 -1
- package/dist/src/oauth/endpoints/callback.js +76 -41
- package/dist/src/oauth/endpoints/callback.js.map +1 -1
- package/dist/src/oauth/endpoints/index.d.ts +1 -0
- package/dist/src/oauth/endpoints/index.js +3 -1
- package/dist/src/oauth/endpoints/index.js.map +1 -1
- package/dist/src/oauth/endpoints/metadata.d.ts +1 -1
- package/dist/src/oauth/endpoints/metadata.js +23 -8
- package/dist/src/oauth/endpoints/metadata.js.map +1 -1
- package/dist/src/oauth/endpoints/register.d.ts +3 -2
- package/dist/src/oauth/endpoints/register.js +70 -19
- package/dist/src/oauth/endpoints/register.js.map +1 -1
- package/dist/src/oauth/endpoints/revoke.d.ts +2 -0
- package/dist/src/oauth/endpoints/revoke.js +78 -0
- package/dist/src/oauth/endpoints/revoke.js.map +1 -0
- package/dist/src/oauth/endpoints/token.js +136 -62
- package/dist/src/oauth/endpoints/token.js.map +1 -1
- package/dist/src/oauth/gitlab-device-flow.d.ts +27 -8
- package/dist/src/oauth/gitlab-device-flow.js +119 -57
- package/dist/src/oauth/gitlab-device-flow.js.map +1 -1
- package/dist/src/oauth/gitlab-request-bound.d.ts +1 -0
- package/dist/src/oauth/gitlab-request-bound.js +6 -0
- package/dist/src/oauth/gitlab-request-bound.js.map +1 -0
- package/dist/src/oauth/gitlab-token-refresh.d.ts +7 -0
- package/dist/src/oauth/gitlab-token-refresh.js +147 -0
- package/dist/src/oauth/gitlab-token-refresh.js.map +1 -0
- package/dist/src/oauth/grant-revocation.d.ts +10 -0
- package/dist/src/oauth/grant-revocation.js +179 -0
- package/dist/src/oauth/grant-revocation.js.map +1 -0
- package/dist/src/oauth/granted-scopes.d.ts +1 -0
- package/dist/src/oauth/granted-scopes.js +7 -0
- package/dist/src/oauth/granted-scopes.js.map +1 -0
- package/dist/src/oauth/index.d.ts +2 -2
- package/dist/src/oauth/index.js +4 -2
- package/dist/src/oauth/index.js.map +1 -1
- package/dist/src/oauth/instance-app.d.ts +4 -0
- package/dist/src/oauth/instance-app.js +45 -0
- package/dist/src/oauth/instance-app.js.map +1 -0
- package/dist/src/oauth/issued-tokens.d.ts +1 -0
- package/dist/src/oauth/issued-tokens.js +24 -0
- package/dist/src/oauth/issued-tokens.js.map +1 -0
- package/dist/src/oauth/oauth-app.d.ts +9 -0
- package/dist/src/oauth/oauth-app.js +14 -0
- package/dist/src/oauth/oauth-app.js.map +1 -0
- package/dist/src/oauth/request-params.d.ts +1 -0
- package/dist/src/oauth/request-params.js +17 -0
- package/dist/src/oauth/request-params.js.map +1 -0
- package/dist/src/oauth/resource.d.ts +12 -0
- package/dist/src/oauth/resource.js +66 -0
- package/dist/src/oauth/resource.js.map +1 -0
- package/dist/src/oauth/routes.d.ts +2 -0
- package/dist/src/oauth/routes.js +31 -0
- package/dist/src/oauth/routes.js.map +1 -0
- package/dist/src/oauth/session-store.d.ts +51 -36
- package/dist/src/oauth/session-store.js +156 -251
- package/dist/src/oauth/session-store.js.map +1 -1
- package/dist/src/oauth/storage/factory.js +1 -1
- package/dist/src/oauth/storage/factory.js.map +1 -1
- package/dist/src/oauth/storage/file.d.ts +29 -2
- package/dist/src/oauth/storage/file.js +194 -42
- package/dist/src/oauth/storage/file.js.map +1 -1
- package/dist/src/oauth/storage/memory.d.ts +35 -2
- package/dist/src/oauth/storage/memory.js +327 -32
- package/dist/src/oauth/storage/memory.js.map +1 -1
- package/dist/src/oauth/storage/types.d.ts +37 -1
- package/dist/src/oauth/storage/types.js +6 -1
- package/dist/src/oauth/storage/types.js.map +1 -1
- package/dist/src/oauth/tool-auth.d.ts +12 -0
- package/dist/src/oauth/tool-auth.js +108 -0
- package/dist/src/oauth/tool-auth.js.map +1 -0
- package/dist/src/oauth/types.d.ts +41 -0
- package/dist/src/profiles/scope-enforcer.d.ts +8 -0
- package/dist/src/profiles/scope-enforcer.js +86 -24
- package/dist/src/profiles/scope-enforcer.js.map +1 -1
- package/dist/src/profiles/types.js +4 -1
- package/dist/src/profiles/types.js.map +1 -1
- package/dist/src/registry-manager.d.ts +16 -4
- package/dist/src/registry-manager.js +122 -33
- package/dist/src/registry-manager.js.map +1 -1
- package/dist/src/server.js +82 -50
- package/dist/src/server.js.map +1 -1
- package/dist/src/services/AdminDetector.d.ts +1 -1
- package/dist/src/services/AdminDetector.js +4 -4
- package/dist/src/services/AdminDetector.js.map +1 -1
- package/dist/src/services/ConnectionManager.d.ts +2 -2
- package/dist/src/services/ConnectionManager.js +43 -70
- package/dist/src/services/ConnectionManager.js.map +1 -1
- package/dist/src/services/HealthMonitor.js +4 -2
- package/dist/src/services/HealthMonitor.js.map +1 -1
- package/dist/src/services/NamespaceTierDetector.js +26 -27
- package/dist/src/services/NamespaceTierDetector.js.map +1 -1
- package/dist/src/services/TokenScopeDetector.d.ts +6 -2
- package/dist/src/services/TokenScopeDetector.js +22 -3
- package/dist/src/services/TokenScopeDetector.js.map +1 -1
- package/dist/src/session-manager.d.ts +3 -1
- package/dist/src/session-manager.js +43 -10
- package/dist/src/session-manager.js.map +1 -1
- package/dist/src/types.d.ts +3 -2
- package/dist/src/types.js.map +1 -1
- package/dist/src/utils/bounded-map.d.ts +1 -0
- package/dist/src/utils/bounded-map.js +23 -0
- package/dist/src/utils/bounded-map.js.map +1 -0
- package/dist/src/utils/fetch.d.ts +1 -2
- package/dist/src/utils/fetch.js +12 -17
- package/dist/src/utils/fetch.js.map +1 -1
- package/dist/src/utils/gitlab-api.js +2 -1
- package/dist/src/utils/gitlab-api.js.map +1 -1
- package/dist/src/utils/gitlab-base-url.d.ts +2 -0
- package/dist/src/utils/gitlab-base-url.js +34 -0
- package/dist/src/utils/gitlab-base-url.js.map +1 -0
- package/dist/src/utils/html.d.ts +1 -0
- package/dist/src/utils/html.js +12 -0
- package/dist/src/utils/html.js.map +1 -0
- package/dist/src/utils/namespace.d.ts +1 -0
- package/dist/src/utils/namespace.js +72 -24
- package/dist/src/utils/namespace.js.map +1 -1
- package/dist/src/utils/schema-utils.d.ts +5 -3
- package/dist/src/utils/schema-utils.js +50 -22
- package/dist/src/utils/schema-utils.js.map +1 -1
- package/dist/src/utils/smart-user-search.js +2 -1
- package/dist/src/utils/smart-user-search.js.map +1 -1
- package/dist/src/utils/sync-directory.d.ts +1 -0
- package/dist/src/utils/sync-directory.js +49 -0
- package/dist/src/utils/sync-directory.js.map +1 -0
- package/dist/src/utils/tool-result.d.ts +4 -0
- package/dist/src/utils/tool-result.js +41 -0
- package/dist/src/utils/tool-result.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +74 -21
- package/plugin/assets/composer-icon-dark.png +0 -0
- package/plugin/assets/composer-icon-dark.svg +17 -0
- package/plugin/assets/composer-icon.png +0 -0
- package/plugin/assets/composer-icon.svg +17 -0
- package/plugin/assets/logo.png +0 -0
- package/plugin/assets/screenshot-1.png +0 -0
- package/plugin/assets/screenshot-2.png +0 -0
- package/plugin/schemas/mcp.schema.json +120 -0
- package/plugin/schemas/plugin.schema.json +65 -0
- package/skills/gitlab-ci/SKILL.md +16 -0
- package/skills/gitlab-discovery/SKILL.md +15 -0
- package/skills/gitlab-review/SKILL.md +16 -0
- package/skills/gitlab-setup/SKILL.md +16 -0
- package/skills/gitlab-work-items/SKILL.md +16 -0
|
@@ -1,71 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.ContextManager = void 0;
|
|
4
|
+
exports.runtimeScopeOf = runtimeScopeOf;
|
|
37
5
|
exports.getContextManager = getContextManager;
|
|
38
6
|
const config_1 = require("../../config");
|
|
39
7
|
const logger_1 = require("../../logger");
|
|
40
8
|
const loader_1 = require("../../profiles/loader");
|
|
41
|
-
const scope_enforcer_1 = require("../../profiles/scope-enforcer");
|
|
42
|
-
const server_1 = require("../../server");
|
|
43
9
|
const namespace_1 = require("../../utils/namespace");
|
|
10
|
+
const configuration_1 = require("../../configuration");
|
|
11
|
+
const policy_1 = require("../../configuration/policy");
|
|
44
12
|
function isOAuthMode() {
|
|
45
13
|
return process.env.OAUTH_ENABLED === 'true';
|
|
46
14
|
}
|
|
47
|
-
function
|
|
15
|
+
function hostOf(url) {
|
|
48
16
|
try {
|
|
49
|
-
|
|
50
|
-
return url.hostname;
|
|
17
|
+
return new URL(url).hostname;
|
|
51
18
|
}
|
|
52
19
|
catch {
|
|
53
|
-
return
|
|
20
|
+
return url;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function runtimeScopeOf(scope, detected) {
|
|
24
|
+
if (scope.project) {
|
|
25
|
+
return { type: 'project', path: scope.project, includeSubgroups: false, detected };
|
|
26
|
+
}
|
|
27
|
+
if (scope.group ?? scope.namespace) {
|
|
28
|
+
return {
|
|
29
|
+
type: 'group',
|
|
30
|
+
path: (scope.group ?? scope.namespace),
|
|
31
|
+
includeSubgroups: scope.includeSubgroups !== false,
|
|
32
|
+
detected,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
if (scope.projects && scope.projects.length > 0) {
|
|
36
|
+
return {
|
|
37
|
+
type: 'project',
|
|
38
|
+
path: scope.projects[0],
|
|
39
|
+
additionalPaths: scope.projects.length > 1 ? scope.projects.slice(1) : undefined,
|
|
40
|
+
includeSubgroups: false,
|
|
41
|
+
detected,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
if (scope.groups && scope.groups.length > 0) {
|
|
45
|
+
return {
|
|
46
|
+
type: 'group',
|
|
47
|
+
path: scope.groups[0],
|
|
48
|
+
additionalPaths: scope.groups.length > 1 ? scope.groups.slice(1) : undefined,
|
|
49
|
+
includeSubgroups: scope.includeSubgroups !== false,
|
|
50
|
+
detected,
|
|
51
|
+
};
|
|
54
52
|
}
|
|
53
|
+
(0, logger_1.logError)('Invalid scope configuration: no usable scope fields found', { scope });
|
|
54
|
+
throw new Error('Invalid scope configuration: expected project, group, namespace, projects, or groups to be defined');
|
|
55
55
|
}
|
|
56
56
|
class ContextManager {
|
|
57
57
|
static instance = null;
|
|
58
|
-
profileLoader;
|
|
59
|
-
currentPreset = null;
|
|
60
|
-
currentPresetName = null;
|
|
61
|
-
currentScope = null;
|
|
62
|
-
currentScopeEnforcer = null;
|
|
63
|
-
currentProfileName = null;
|
|
64
|
-
initialContext = null;
|
|
65
|
-
constructor() {
|
|
66
|
-
this.profileLoader = new loader_1.ProfileLoader();
|
|
67
|
-
this.captureInitialContext();
|
|
68
|
-
}
|
|
58
|
+
profileLoader = new loader_1.ProfileLoader();
|
|
69
59
|
static getInstance() {
|
|
70
60
|
ContextManager.instance ??= new ContextManager();
|
|
71
61
|
return ContextManager.instance;
|
|
@@ -73,84 +63,38 @@ class ContextManager {
|
|
|
73
63
|
static resetInstance() {
|
|
74
64
|
ContextManager.instance = null;
|
|
75
65
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
66
|
+
caller() {
|
|
67
|
+
return (0, configuration_1.currentCaller)() ?? (0, configuration_1.resolveCaller)(undefined, config_1.GITLAB_BASE_URL);
|
|
68
|
+
}
|
|
69
|
+
operatorContext(caller) {
|
|
70
|
+
return {
|
|
71
|
+
host: hostOf(caller.instanceUrl),
|
|
72
|
+
apiUrl: caller.instanceUrl,
|
|
80
73
|
readOnly: config_1.GITLAB_READ_ONLY_MODE,
|
|
81
74
|
oauthMode: isOAuthMode(),
|
|
82
|
-
presetName: this.currentPresetName ?? undefined,
|
|
83
|
-
profileName: this.currentProfileName ?? undefined,
|
|
84
|
-
scope: this.currentScope
|
|
85
|
-
? this.scopeConfigToRuntimeScope(this.currentScope, false)
|
|
86
|
-
: undefined,
|
|
87
75
|
};
|
|
88
|
-
(0, logger_1.logDebug)('Captured initial context', { initialContext: this.initialContext });
|
|
89
76
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return {
|
|
101
|
-
type: 'group',
|
|
102
|
-
path: scope.group,
|
|
103
|
-
includeSubgroups: scope.includeSubgroups !== false,
|
|
104
|
-
detected,
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
if (scope.namespace) {
|
|
108
|
-
return {
|
|
109
|
-
type: 'group',
|
|
110
|
-
path: scope.namespace,
|
|
111
|
-
includeSubgroups: scope.includeSubgroups !== false,
|
|
112
|
-
detected,
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
if (scope.projects && scope.projects.length > 0) {
|
|
116
|
-
return {
|
|
117
|
-
type: 'project',
|
|
118
|
-
path: scope.projects[0],
|
|
119
|
-
additionalPaths: scope.projects.length > 1 ? scope.projects.slice(1) : undefined,
|
|
120
|
-
includeSubgroups: false,
|
|
121
|
-
detected,
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
if (scope.groups && scope.groups.length > 0) {
|
|
125
|
-
return {
|
|
126
|
-
type: 'group',
|
|
127
|
-
path: scope.groups[0],
|
|
128
|
-
additionalPaths: scope.groups.length > 1 ? scope.groups.slice(1) : undefined,
|
|
129
|
-
includeSubgroups: scope.includeSubgroups !== false,
|
|
130
|
-
detected,
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
(0, logger_1.logError)('Invalid scope configuration: no usable scope fields found', { scope });
|
|
134
|
-
throw new Error('Invalid scope configuration: expected project, group, namespace, projects, or groups to be defined');
|
|
135
|
-
}
|
|
136
|
-
getContext() {
|
|
137
|
-
const context = {
|
|
138
|
-
host: getHost(),
|
|
139
|
-
apiUrl: config_1.GITLAB_BASE_URL,
|
|
140
|
-
readOnly: config_1.GITLAB_READ_ONLY_MODE,
|
|
141
|
-
oauthMode: isOAuthMode(),
|
|
142
|
-
presetName: this.currentPresetName ?? undefined,
|
|
143
|
-
profileName: this.currentProfileName ?? undefined,
|
|
144
|
-
scope: this.currentScope
|
|
145
|
-
? this.scopeConfigToRuntimeScope(this.currentScope, false)
|
|
77
|
+
contextOf(caller, resolved) {
|
|
78
|
+
const operator = this.operatorContext(caller);
|
|
79
|
+
const scope = resolved.policy.scope;
|
|
80
|
+
return {
|
|
81
|
+
...operator,
|
|
82
|
+
readOnly: operator.readOnly || resolved.policy.readOnly,
|
|
83
|
+
presetName: resolved.policy.presetName,
|
|
84
|
+
disabledToolGroups: [...resolved.policy.disabledGroups].sort((a, b) => a.localeCompare(b)),
|
|
85
|
+
scope: scope
|
|
86
|
+
? runtimeScopeOf(scope, resolved.session.scope !== undefined && resolved.session.scope !== policy_1.EVERYWHERE)
|
|
146
87
|
: undefined,
|
|
147
|
-
initialContext:
|
|
88
|
+
initialContext: operator,
|
|
148
89
|
};
|
|
149
|
-
|
|
90
|
+
}
|
|
91
|
+
async getContext() {
|
|
92
|
+
const caller = this.caller();
|
|
93
|
+
return this.contextOf(caller, await (0, configuration_1.getConfigurationService)().resolve(caller));
|
|
150
94
|
}
|
|
151
95
|
async listPresets() {
|
|
152
96
|
const profiles = await this.profileLoader.listProfiles();
|
|
153
|
-
|
|
97
|
+
return profiles
|
|
154
98
|
.filter((p) => p.isPreset)
|
|
155
99
|
.map((p) => ({
|
|
156
100
|
name: p.name,
|
|
@@ -158,116 +102,47 @@ class ContextManager {
|
|
|
158
102
|
readOnly: p.readOnly,
|
|
159
103
|
isBuiltIn: p.isBuiltIn,
|
|
160
104
|
}));
|
|
161
|
-
if (this.currentPresetName && this.currentPreset) {
|
|
162
|
-
const exists = presets.some((p) => p.name === this.currentPresetName);
|
|
163
|
-
if (!exists) {
|
|
164
|
-
presets.unshift({
|
|
165
|
-
name: this.currentPresetName,
|
|
166
|
-
description: this.currentPreset.description,
|
|
167
|
-
readOnly: this.currentPreset.read_only ?? false,
|
|
168
|
-
isBuiltIn: false,
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
return presets;
|
|
173
|
-
}
|
|
174
|
-
async listProfiles() {
|
|
175
|
-
if (!isOAuthMode()) {
|
|
176
|
-
throw new Error('list_profiles is only available in OAuth mode');
|
|
177
|
-
}
|
|
178
|
-
const profiles = await this.profileLoader.listProfiles();
|
|
179
|
-
return profiles.filter((p) => !p.isPreset);
|
|
180
105
|
}
|
|
181
106
|
async switchPreset(presetName) {
|
|
182
|
-
const
|
|
107
|
+
const caller = this.caller();
|
|
108
|
+
const service = (0, configuration_1.getConfigurationService)();
|
|
109
|
+
const previous = (await service.resolve(caller)).policy.presetName;
|
|
183
110
|
try {
|
|
184
|
-
|
|
185
|
-
this.currentPreset = preset;
|
|
186
|
-
this.currentPresetName = presetName;
|
|
187
|
-
if (preset.scope) {
|
|
188
|
-
this.currentScope = preset.scope;
|
|
189
|
-
this.currentScopeEnforcer = new scope_enforcer_1.ScopeEnforcer(preset.scope);
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
this.currentScope = null;
|
|
193
|
-
this.currentScopeEnforcer = null;
|
|
194
|
-
}
|
|
195
|
-
(0, logger_1.logInfo)('Switched preset', { previous: previousPreset, current: presetName });
|
|
196
|
-
await (0, server_1.sendToolsListChangedNotification)();
|
|
197
|
-
return {
|
|
198
|
-
success: true,
|
|
199
|
-
previous: previousPreset ?? undefined,
|
|
200
|
-
current: presetName,
|
|
201
|
-
message: `Switched to preset '${presetName}'`,
|
|
202
|
-
};
|
|
111
|
+
await service.updateSession(caller, { preset: presetName });
|
|
203
112
|
}
|
|
204
113
|
catch (error) {
|
|
205
114
|
const message = error instanceof Error ? error.message : String(error);
|
|
206
115
|
(0, logger_1.logError)('Failed to switch preset', { error: message, preset: presetName });
|
|
207
116
|
throw new Error(`Failed to switch to preset '${presetName}': ${message}`, { cause: error });
|
|
208
117
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
async switchProfile(profileName) {
|
|
217
|
-
if (!isOAuthMode()) {
|
|
218
|
-
throw new Error('switch_profile is only available in OAuth mode');
|
|
219
|
-
}
|
|
220
|
-
const previousProfile = this.currentProfileName;
|
|
221
|
-
try {
|
|
222
|
-
await this.profileLoader.loadProfile(profileName);
|
|
223
|
-
this.currentProfileName = profileName;
|
|
224
|
-
(0, logger_1.logInfo)('Switched profile', { previous: previousProfile, current: profileName });
|
|
225
|
-
return {
|
|
226
|
-
success: true,
|
|
227
|
-
previous: previousProfile ?? undefined,
|
|
228
|
-
current: profileName,
|
|
229
|
-
message: `Switched to profile '${profileName}'`,
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
catch (error) {
|
|
233
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
234
|
-
(0, logger_1.logError)('Failed to switch profile', { error: message, profile: profileName });
|
|
235
|
-
throw new Error(`Failed to switch to profile '${profileName}': ${message}`, { cause: error });
|
|
236
|
-
}
|
|
118
|
+
(0, logger_1.logInfo)('Switched preset for session', { previous, current: presetName });
|
|
119
|
+
return {
|
|
120
|
+
success: true,
|
|
121
|
+
previous,
|
|
122
|
+
current: presetName,
|
|
123
|
+
message: `Switched this session to preset '${presetName}'`,
|
|
124
|
+
};
|
|
237
125
|
}
|
|
238
126
|
async setScope(namespace, includeSubgroups = true) {
|
|
239
127
|
try {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
else {
|
|
249
|
-
scopeConfig = {
|
|
250
|
-
group: namespace,
|
|
251
|
-
includeSubgroups,
|
|
252
|
-
};
|
|
128
|
+
let canonicalPath = namespace;
|
|
129
|
+
const type = await (0, namespace_1.findNamespaceType)(namespace, (path) => {
|
|
130
|
+
canonicalPath = path;
|
|
131
|
+
});
|
|
132
|
+
if (!type) {
|
|
133
|
+
throw new Error(`No project or group '${namespace}' was found on GitLab, or GitLab could not be reached`);
|
|
253
134
|
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
type:
|
|
258
|
-
path: namespace,
|
|
259
|
-
includeSubgroups: namespaceType === 'group' ? includeSubgroups : false,
|
|
260
|
-
detected: true,
|
|
135
|
+
const scope = {
|
|
136
|
+
type,
|
|
137
|
+
path: canonicalPath,
|
|
138
|
+
includeSubgroups: type === 'group' ? includeSubgroups : false,
|
|
261
139
|
};
|
|
262
|
-
(0,
|
|
263
|
-
|
|
264
|
-
type: namespaceType,
|
|
265
|
-
includeSubgroups,
|
|
266
|
-
});
|
|
140
|
+
await (0, configuration_1.getConfigurationService)().updateSession(this.caller(), { scope });
|
|
141
|
+
(0, logger_1.logInfo)('Scope set with auto-detection', { namespace, type, includeSubgroups });
|
|
267
142
|
return {
|
|
268
143
|
success: true,
|
|
269
|
-
scope:
|
|
270
|
-
message: `Scope set to ${
|
|
144
|
+
scope: { ...scope, detected: true },
|
|
145
|
+
message: `Scope set to ${type} '${canonicalPath}'${type === 'group' && includeSubgroups ? ' (including subgroups)' : ''}`,
|
|
271
146
|
};
|
|
272
147
|
}
|
|
273
148
|
catch (error) {
|
|
@@ -276,79 +151,23 @@ class ContextManager {
|
|
|
276
151
|
throw new Error(`Failed to set scope for '${namespace}': ${message}`, { cause: error });
|
|
277
152
|
}
|
|
278
153
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
}
|
|
283
|
-
this.currentPreset = null;
|
|
284
|
-
this.currentPresetName = null;
|
|
285
|
-
this.currentScope = null;
|
|
286
|
-
this.currentScopeEnforcer = null;
|
|
287
|
-
this.currentProfileName = null;
|
|
288
|
-
this.captureInitialContext();
|
|
289
|
-
(0, logger_1.logInfo)('Context reset to initial state');
|
|
154
|
+
async clearScope() {
|
|
155
|
+
await (0, configuration_1.getConfigurationService)().updateSession(this.caller(), { scope: policy_1.EVERYWHERE });
|
|
156
|
+
(0, logger_1.logInfo)('Session scope cleared');
|
|
290
157
|
return {
|
|
291
158
|
success: true,
|
|
292
|
-
message: '
|
|
293
|
-
context: this.getContext(),
|
|
159
|
+
message: 'This session now works everywhere the account has access',
|
|
160
|
+
context: await this.getContext(),
|
|
294
161
|
};
|
|
295
162
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
}
|
|
305
|
-
getCurrentPresetName() {
|
|
306
|
-
return this.currentPresetName;
|
|
307
|
-
}
|
|
308
|
-
async switchInstance(instanceUrl) {
|
|
309
|
-
if (isOAuthMode()) {
|
|
310
|
-
throw new Error('Cannot switch instances in OAuth mode. ' +
|
|
311
|
-
'Please re-authenticate with the desired GitLab instance.');
|
|
312
|
-
}
|
|
313
|
-
const { InstanceRegistry } = await Promise.resolve().then(() => __importStar(require('../../services/InstanceRegistry.js')));
|
|
314
|
-
const { clearNamespaceTierCache } = await Promise.resolve().then(() => __importStar(require('../../services/NamespaceTierDetector.js')));
|
|
315
|
-
const { ConnectionManager } = await Promise.resolve().then(() => __importStar(require('../../services/ConnectionManager.js')));
|
|
316
|
-
const registry = InstanceRegistry.getInstance();
|
|
317
|
-
if (!registry.isInitialized()) {
|
|
318
|
-
await registry.initialize();
|
|
319
|
-
}
|
|
320
|
-
const instance = registry.get(instanceUrl);
|
|
321
|
-
if (!instance) {
|
|
322
|
-
throw new Error(`Instance not configured: ${instanceUrl}. ` +
|
|
323
|
-
"Use 'instances list' to see configured instances.");
|
|
324
|
-
}
|
|
325
|
-
const connectionManager = ConnectionManager.getInstance();
|
|
326
|
-
const previousUrl = connectionManager.getCurrentInstanceUrl() ?? config_1.GITLAB_BASE_URL;
|
|
327
|
-
try {
|
|
328
|
-
clearNamespaceTierCache();
|
|
329
|
-
await connectionManager.reinitialize(instanceUrl);
|
|
330
|
-
this.currentScope = null;
|
|
331
|
-
this.currentScopeEnforcer = null;
|
|
332
|
-
(0, logger_1.logInfo)('Switched GitLab instance', {
|
|
333
|
-
previous: previousUrl,
|
|
334
|
-
current: instanceUrl,
|
|
335
|
-
label: instance.config.label,
|
|
336
|
-
});
|
|
337
|
-
await (0, server_1.sendToolsListChangedNotification)();
|
|
338
|
-
return {
|
|
339
|
-
success: true,
|
|
340
|
-
previous: previousUrl,
|
|
341
|
-
current: instanceUrl,
|
|
342
|
-
message: `Switched to instance '${instance.config.label ?? instanceUrl}'`,
|
|
343
|
-
};
|
|
344
|
-
}
|
|
345
|
-
catch (error) {
|
|
346
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
347
|
-
(0, logger_1.logError)('Failed to switch instance', { error: message, instanceUrl });
|
|
348
|
-
throw new Error(`Failed to switch to instance '${instanceUrl}': ${message}`, {
|
|
349
|
-
cause: error,
|
|
350
|
-
});
|
|
351
|
-
}
|
|
163
|
+
async reset() {
|
|
164
|
+
await (0, configuration_1.getConfigurationService)().resetSession(this.caller());
|
|
165
|
+
(0, logger_1.logInfo)('Session context reset');
|
|
166
|
+
return {
|
|
167
|
+
success: true,
|
|
168
|
+
message: 'Session context reset to the account settings',
|
|
169
|
+
context: await this.getContext(),
|
|
170
|
+
};
|
|
352
171
|
}
|
|
353
172
|
}
|
|
354
173
|
exports.ContextManager = ContextManager;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-manager.js","sourceRoot":"","sources":["../../../../src/entities/context/context-manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context-manager.js","sourceRoot":"","sources":["../../../../src/entities/context/context-manager.ts"],"names":[],"mappings":";;;AA4CA,wCAkCC;AAqJD,8CAEC;AA5ND,yCAAsE;AACtE,yCAAiD;AACjD,kDAAsD;AAEtD,qDAA0D;AAC1D,uDAM6B;AAC7B,uDAAwD;AAUxD,SAAS,WAAW;IAClB,OAAO,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,MAAM,CAAC;AAC9C,CAAC;AAED,SAAS,MAAM,CAAC,GAAW;IACzB,IAAI,CAAC;QACH,OAAO,IA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I;YACb,OAAO,EAAE,0DAA0D;YACnE,OAAO,EAAE,MAAM,IAAI,CAAC,UAAU,EAAE;SACjC,CAAC;IACJ,CAAC;IAGD,KAAK,CAAC,KAAK;QACT,MAAM,IAAA,uCAAuB,GAAE,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QAC5D,IAAA,gBAAO,EAAC,uBAAuB,CAAC,CAAC;QACjC,OAAO;YACL,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,+CAA+C;YACxD,OAAO,EAAE,MAAM,IAAI,CAAC,UAAU,EAAE;SACjC,CAAC;IACJ,CAAC;;AAhJH,wCAiJC;AAED,SAAgB,iBAAiB;IAC/B,OAAO,cAAc,CAAC,WAAW,EAAE,CAAC;AACtC,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ListPresetsInput,
|
|
2
|
-
import { PresetInfo,
|
|
1
|
+
import { ListPresetsInput, ManageContextInput, ResetContextInput, SetScopeInput, ShowContextInput, SwitchPresetInput, WhoamiInput } from './schema';
|
|
2
|
+
import { PresetInfo, ResetResult, SessionContext, SetScopeResult, SwitchResult, WhoamiResult } from './types';
|
|
3
|
+
import { AccountChangeResult, AccountLinkResult } from './accounts';
|
|
4
|
+
import type { ChatAccount } from '../../accounts/chat-accounts';
|
|
3
5
|
export declare function handleShowContext(_input: ShowContextInput): Promise<SessionContext>;
|
|
4
6
|
export declare function handleListPresets(_input: ListPresetsInput): Promise<PresetInfo[]>;
|
|
5
|
-
export declare function handleListProfiles(_input: ListProfilesInput): Promise<ProfileInfo[]>;
|
|
6
7
|
export declare function handleSwitchPreset(input: SwitchPresetInput): Promise<SwitchResult>;
|
|
7
|
-
export declare function handleSwitchProfile(input: SwitchProfileInput): Promise<SwitchResult>;
|
|
8
8
|
export declare function handleSetScope(input: SetScopeInput): Promise<SetScopeResult>;
|
|
9
9
|
export declare function handleResetContext(_input: ResetContextInput): Promise<ResetResult>;
|
|
10
10
|
export declare function handleWhoami(_input: WhoamiInput): Promise<WhoamiResult>;
|
|
11
|
-
export declare function handleManageContext(input: ManageContextInput): Promise<SessionContext | PresetInfo[] |
|
|
11
|
+
export declare function handleManageContext(input: ManageContextInput): Promise<SessionContext | PresetInfo[] | SwitchResult | SetScopeResult | ResetResult | WhoamiResult | ChatAccount[] | AccountChangeResult | AccountLinkResult>;
|
|
@@ -2,15 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.handleShowContext = handleShowContext;
|
|
4
4
|
exports.handleListPresets = handleListPresets;
|
|
5
|
-
exports.handleListProfiles = handleListProfiles;
|
|
6
5
|
exports.handleSwitchPreset = handleSwitchPreset;
|
|
7
|
-
exports.handleSwitchProfile = handleSwitchProfile;
|
|
8
6
|
exports.handleSetScope = handleSetScope;
|
|
9
7
|
exports.handleResetContext = handleResetContext;
|
|
10
8
|
exports.handleWhoami = handleWhoami;
|
|
11
9
|
exports.handleManageContext = handleManageContext;
|
|
12
10
|
const context_manager_1 = require("./context-manager");
|
|
13
11
|
const whoami_1 = require("./whoami");
|
|
12
|
+
const accounts_1 = require("./accounts");
|
|
14
13
|
async function handleShowContext(_input) {
|
|
15
14
|
const manager = (0, context_manager_1.getContextManager)();
|
|
16
15
|
return manager.getContext();
|
|
@@ -19,18 +18,10 @@ async function handleListPresets(_input) {
|
|
|
19
18
|
const manager = (0, context_manager_1.getContextManager)();
|
|
20
19
|
return manager.listPresets();
|
|
21
20
|
}
|
|
22
|
-
async function handleListProfiles(_input) {
|
|
23
|
-
const manager = (0, context_manager_1.getContextManager)();
|
|
24
|
-
return manager.listProfiles();
|
|
25
|
-
}
|
|
26
21
|
async function handleSwitchPreset(input) {
|
|
27
22
|
const manager = (0, context_manager_1.getContextManager)();
|
|
28
23
|
return manager.switchPreset(input.preset);
|
|
29
24
|
}
|
|
30
|
-
async function handleSwitchProfile(input) {
|
|
31
|
-
const manager = (0, context_manager_1.getContextManager)();
|
|
32
|
-
return manager.switchProfile(input.profile);
|
|
33
|
-
}
|
|
34
25
|
async function handleSetScope(input) {
|
|
35
26
|
const manager = (0, context_manager_1.getContextManager)();
|
|
36
27
|
return manager.setScope(input.namespace, input.includeSubgroups);
|
|
@@ -48,18 +39,24 @@ async function handleManageContext(input) {
|
|
|
48
39
|
return handleShowContext(input);
|
|
49
40
|
case 'list_presets':
|
|
50
41
|
return handleListPresets(input);
|
|
51
|
-
case 'list_profiles':
|
|
52
|
-
return handleListProfiles(input);
|
|
53
42
|
case 'switch_preset':
|
|
54
43
|
return handleSwitchPreset(input);
|
|
55
|
-
case 'switch_profile':
|
|
56
|
-
return handleSwitchProfile(input);
|
|
57
44
|
case 'set_scope':
|
|
58
45
|
return handleSetScope(input);
|
|
46
|
+
case 'clear_scope':
|
|
47
|
+
return (0, context_manager_1.getContextManager)().clearScope();
|
|
59
48
|
case 'reset':
|
|
60
49
|
return handleResetContext(input);
|
|
61
50
|
case 'whoami':
|
|
62
51
|
return handleWhoami(input);
|
|
52
|
+
case 'list_accounts':
|
|
53
|
+
return (0, accounts_1.handleListAccounts)();
|
|
54
|
+
case 'switch_account':
|
|
55
|
+
return (0, accounts_1.handleSwitchAccount)(input);
|
|
56
|
+
case 'link_account':
|
|
57
|
+
return (0, accounts_1.handleLinkAccount)(input);
|
|
58
|
+
case 'unlink_account':
|
|
59
|
+
return (0, accounts_1.handleUnlinkAccount)(input);
|
|
63
60
|
default:
|
|
64
61
|
throw new Error(`Unknown action: ${input.action}`);
|
|
65
62
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../../../src/entities/context/handlers.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../../../src/entities/context/handlers.ts"],"names":[],"mappings":";;AAsCA,8CAGC;AAKD,8CAGC;AAKD,gDAGC;AAKD,wCAGC;AAKD,gDAGC;AAKD,oCAEC;AAKD,kDAwCC;AAvHD,uDAAsD;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