@google/gemini-cli-core 0.0.3-preview.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +310 -0
- package/dist/.last_build +0 -0
- package/dist/google-gemini-cli-core-0.3.0-preview.3.tgz +0 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/src/__mocks__/fs/promises.d.ts +11 -0
- package/dist/src/__mocks__/fs/promises.js +17 -0
- package/dist/src/__mocks__/fs/promises.js.map +1 -0
- package/dist/src/code_assist/codeAssist.d.ts +10 -0
- package/dist/src/code_assist/codeAssist.js +19 -0
- package/dist/src/code_assist/codeAssist.js.map +1 -0
- package/dist/src/code_assist/converter.d.ts +72 -0
- package/dist/src/code_assist/converter.js +159 -0
- package/dist/src/code_assist/converter.js.map +1 -0
- package/dist/src/code_assist/converter.test.d.ts +6 -0
- package/dist/src/code_assist/converter.test.js +362 -0
- package/dist/src/code_assist/converter.test.js.map +1 -0
- package/dist/src/code_assist/oauth2.d.ts +22 -0
- package/dist/src/code_assist/oauth2.js +353 -0
- package/dist/src/code_assist/oauth2.js.map +1 -0
- package/dist/src/code_assist/oauth2.test.d.ts +6 -0
- package/dist/src/code_assist/oauth2.test.js +427 -0
- package/dist/src/code_assist/oauth2.test.js.map +1 -0
- package/dist/src/code_assist/server.d.ts +37 -0
- package/dist/src/code_assist/server.js +125 -0
- package/dist/src/code_assist/server.js.map +1 -0
- package/dist/src/code_assist/server.test.d.ts +6 -0
- package/dist/src/code_assist/server.test.js +134 -0
- package/dist/src/code_assist/server.test.js.map +1 -0
- package/dist/src/code_assist/setup.d.ts +20 -0
- package/dist/src/code_assist/setup.js +101 -0
- package/dist/src/code_assist/setup.js.map +1 -0
- package/dist/src/code_assist/setup.test.d.ts +6 -0
- package/dist/src/code_assist/setup.test.js +171 -0
- package/dist/src/code_assist/setup.test.js.map +1 -0
- package/dist/src/code_assist/types.d.ts +148 -0
- package/dist/src/code_assist/types.js +46 -0
- package/dist/src/code_assist/types.js.map +1 -0
- package/dist/src/config/config.d.ts +318 -0
- package/dist/src/config/config.js +633 -0
- package/dist/src/config/config.js.map +1 -0
- package/dist/src/config/config.test.d.ts +6 -0
- package/dist/src/config/config.test.js +585 -0
- package/dist/src/config/config.test.js.map +1 -0
- package/dist/src/config/flashFallback.test.d.ts +6 -0
- package/dist/src/config/flashFallback.test.js +87 -0
- package/dist/src/config/flashFallback.test.js.map +1 -0
- package/dist/src/config/models.d.ts +9 -0
- package/dist/src/config/models.js +10 -0
- package/dist/src/config/models.js.map +1 -0
- package/dist/src/config/storage.d.ts +32 -0
- package/dist/src/config/storage.js +90 -0
- package/dist/src/config/storage.js.map +1 -0
- package/dist/src/config/storage.test.d.ts +6 -0
- package/dist/src/config/storage.test.js +43 -0
- package/dist/src/config/storage.test.js.map +1 -0
- package/dist/src/core/client.d.ts +65 -0
- package/dist/src/core/client.js +689 -0
- package/dist/src/core/client.js.map +1 -0
- package/dist/src/core/client.test.d.ts +6 -0
- package/dist/src/core/client.test.js +1857 -0
- package/dist/src/core/client.test.js.map +1 -0
- package/dist/src/core/contentGenerator.d.ts +33 -0
- package/dist/src/core/contentGenerator.js +80 -0
- package/dist/src/core/contentGenerator.js.map +1 -0
- package/dist/src/core/contentGenerator.test.d.ts +6 -0
- package/dist/src/core/contentGenerator.test.js +124 -0
- package/dist/src/core/contentGenerator.test.js.map +1 -0
- package/dist/src/core/coreToolScheduler.d.ts +126 -0
- package/dist/src/core/coreToolScheduler.js +605 -0
- package/dist/src/core/coreToolScheduler.js.map +1 -0
- package/dist/src/core/coreToolScheduler.test.d.ts +6 -0
- package/dist/src/core/coreToolScheduler.test.js +923 -0
- package/dist/src/core/coreToolScheduler.test.js.map +1 -0
- package/dist/src/core/geminiChat.d.ts +122 -0
- package/dist/src/core/geminiChat.js +547 -0
- package/dist/src/core/geminiChat.js.map +1 -0
- package/dist/src/core/geminiChat.test.d.ts +6 -0
- package/dist/src/core/geminiChat.test.js +875 -0
- package/dist/src/core/geminiChat.test.js.map +1 -0
- package/dist/src/core/geminiRequest.d.ts +13 -0
- package/dist/src/core/geminiRequest.js +11 -0
- package/dist/src/core/geminiRequest.js.map +1 -0
- package/dist/src/core/logger.d.ts +60 -0
- package/dist/src/core/logger.js +360 -0
- package/dist/src/core/logger.js.map +1 -0
- package/dist/src/core/logger.test.d.ts +6 -0
- package/dist/src/core/logger.test.js +534 -0
- package/dist/src/core/logger.test.js.map +1 -0
- package/dist/src/core/loggingContentGenerator.d.ts +25 -0
- package/dist/src/core/loggingContentGenerator.js +97 -0
- package/dist/src/core/loggingContentGenerator.js.map +1 -0
- package/dist/src/core/nonInteractiveToolExecutor.d.ts +10 -0
- package/dist/src/core/nonInteractiveToolExecutor.js +24 -0
- package/dist/src/core/nonInteractiveToolExecutor.js.map +1 -0
- package/dist/src/core/nonInteractiveToolExecutor.test.d.ts +6 -0
- package/dist/src/core/nonInteractiveToolExecutor.test.js +236 -0
- package/dist/src/core/nonInteractiveToolExecutor.test.js.map +1 -0
- package/dist/src/core/prompts.d.ts +12 -0
- package/dist/src/core/prompts.js +359 -0
- package/dist/src/core/prompts.js.map +1 -0
- package/dist/src/core/prompts.test.d.ts +6 -0
- package/dist/src/core/prompts.test.js +214 -0
- package/dist/src/core/prompts.test.js.map +1 -0
- package/dist/src/core/subagent.d.ts +236 -0
- package/dist/src/core/subagent.js +485 -0
- package/dist/src/core/subagent.js.map +1 -0
- package/dist/src/core/subagent.test.d.ts +6 -0
- package/dist/src/core/subagent.test.js +520 -0
- package/dist/src/core/subagent.test.js.map +1 -0
- package/dist/src/core/tokenLimits.d.ts +10 -0
- package/dist/src/core/tokenLimits.js +28 -0
- package/dist/src/core/tokenLimits.js.map +1 -0
- package/dist/src/core/turn.d.ts +125 -0
- package/dist/src/core/turn.js +154 -0
- package/dist/src/core/turn.js.map +1 -0
- package/dist/src/core/turn.test.d.ts +6 -0
- package/dist/src/core/turn.test.js +388 -0
- package/dist/src/core/turn.test.js.map +1 -0
- package/dist/src/generated/git-commit.d.ts +7 -0
- package/dist/src/generated/git-commit.js +10 -0
- package/dist/src/generated/git-commit.js.map +1 -0
- package/dist/src/ide/constants.d.ts +6 -0
- package/dist/src/ide/constants.js +7 -0
- package/dist/src/ide/constants.js.map +1 -0
- package/dist/src/ide/detect-ide.d.ts +25 -0
- package/dist/src/ide/detect-ide.js +104 -0
- package/dist/src/ide/detect-ide.js.map +1 -0
- package/dist/src/ide/detect-ide.test.d.ts +6 -0
- package/dist/src/ide/detect-ide.test.js +109 -0
- package/dist/src/ide/detect-ide.test.js.map +1 -0
- package/dist/src/ide/ide-client.d.ts +67 -0
- package/dist/src/ide/ide-client.js +418 -0
- package/dist/src/ide/ide-client.js.map +1 -0
- package/dist/src/ide/ide-client.test.d.ts +6 -0
- package/dist/src/ide/ide-client.test.js +155 -0
- package/dist/src/ide/ide-client.test.js.map +1 -0
- package/dist/src/ide/ide-installer.d.ts +14 -0
- package/dist/src/ide/ide-installer.js +107 -0
- package/dist/src/ide/ide-installer.js.map +1 -0
- package/dist/src/ide/ide-installer.test.d.ts +6 -0
- package/dist/src/ide/ide-installer.test.js +113 -0
- package/dist/src/ide/ide-installer.test.js.map +1 -0
- package/dist/src/ide/ideContext.d.ts +374 -0
- package/dist/src/ide/ideContext.js +147 -0
- package/dist/src/ide/ideContext.js.map +1 -0
- package/dist/src/ide/ideContext.test.d.ts +6 -0
- package/dist/src/ide/ideContext.test.js +265 -0
- package/dist/src/ide/ideContext.test.js.map +1 -0
- package/dist/src/ide/process-utils.d.ts +22 -0
- package/dist/src/ide/process-utils.js +153 -0
- package/dist/src/ide/process-utils.js.map +1 -0
- package/dist/src/ide/process-utils.test.d.ts +6 -0
- package/dist/src/ide/process-utils.test.js +72 -0
- package/dist/src/ide/process-utils.test.js.map +1 -0
- package/dist/src/index.d.ts +81 -0
- package/dist/src/index.js +90 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/index.test.d.ts +6 -0
- package/dist/src/index.test.js +12 -0
- package/dist/src/index.test.js.map +1 -0
- package/dist/src/mcp/google-auth-provider.d.ts +23 -0
- package/dist/src/mcp/google-auth-provider.js +72 -0
- package/dist/src/mcp/google-auth-provider.js.map +1 -0
- package/dist/src/mcp/google-auth-provider.test.d.ts +6 -0
- package/dist/src/mcp/google-auth-provider.test.js +89 -0
- package/dist/src/mcp/google-auth-provider.test.js.map +1 -0
- package/dist/src/mcp/oauth-provider.d.ts +146 -0
- package/dist/src/mcp/oauth-provider.js +601 -0
- package/dist/src/mcp/oauth-provider.js.map +1 -0
- package/dist/src/mcp/oauth-provider.test.d.ts +6 -0
- package/dist/src/mcp/oauth-provider.test.js +672 -0
- package/dist/src/mcp/oauth-provider.test.js.map +1 -0
- package/dist/src/mcp/oauth-token-storage.d.ts +61 -0
- package/dist/src/mcp/oauth-token-storage.js +148 -0
- package/dist/src/mcp/oauth-token-storage.js.map +1 -0
- package/dist/src/mcp/oauth-token-storage.test.d.ts +6 -0
- package/dist/src/mcp/oauth-token-storage.test.js +206 -0
- package/dist/src/mcp/oauth-token-storage.test.js.map +1 -0
- package/dist/src/mcp/oauth-utils.d.ts +119 -0
- package/dist/src/mcp/oauth-utils.js +235 -0
- package/dist/src/mcp/oauth-utils.js.map +1 -0
- package/dist/src/mcp/oauth-utils.test.d.ts +6 -0
- package/dist/src/mcp/oauth-utils.test.js +199 -0
- package/dist/src/mcp/oauth-utils.test.js.map +1 -0
- package/dist/src/mcp/token-storage/base-token-storage.d.ts +19 -0
- package/dist/src/mcp/token-storage/base-token-storage.js +36 -0
- package/dist/src/mcp/token-storage/base-token-storage.js.map +1 -0
- package/dist/src/mcp/token-storage/base-token-storage.test.d.ts +6 -0
- package/dist/src/mcp/token-storage/base-token-storage.test.js +160 -0
- package/dist/src/mcp/token-storage/base-token-storage.test.js.map +1 -0
- package/dist/src/mcp/token-storage/types.d.ts +34 -0
- package/dist/src/mcp/token-storage/types.js +7 -0
- package/dist/src/mcp/token-storage/types.js.map +1 -0
- package/dist/src/mocks/msw.d.ts +6 -0
- package/dist/src/mocks/msw.js +8 -0
- package/dist/src/mocks/msw.js.map +1 -0
- package/dist/src/prompts/mcp-prompts.d.ts +8 -0
- package/dist/src/prompts/mcp-prompts.js +13 -0
- package/dist/src/prompts/mcp-prompts.js.map +1 -0
- package/dist/src/prompts/prompt-registry.d.ts +34 -0
- package/dist/src/prompts/prompt-registry.js +63 -0
- package/dist/src/prompts/prompt-registry.js.map +1 -0
- package/dist/src/services/chatRecordingService.d.ts +150 -0
- package/dist/src/services/chatRecordingService.js +321 -0
- package/dist/src/services/chatRecordingService.js.map +1 -0
- package/dist/src/services/chatRecordingService.test.d.ts +6 -0
- package/dist/src/services/chatRecordingService.test.js +290 -0
- package/dist/src/services/chatRecordingService.test.js.map +1 -0
- package/dist/src/services/fileDiscoveryService.d.ts +35 -0
- package/dist/src/services/fileDiscoveryService.js +91 -0
- package/dist/src/services/fileDiscoveryService.js.map +1 -0
- package/dist/src/services/fileDiscoveryService.test.d.ts +6 -0
- package/dist/src/services/fileDiscoveryService.test.js +143 -0
- package/dist/src/services/fileDiscoveryService.test.js.map +1 -0
- package/dist/src/services/fileSystemService.d.ts +31 -0
- package/dist/src/services/fileSystemService.js +18 -0
- package/dist/src/services/fileSystemService.js.map +1 -0
- package/dist/src/services/fileSystemService.test.d.ts +6 -0
- package/dist/src/services/fileSystemService.test.js +41 -0
- package/dist/src/services/fileSystemService.test.js.map +1 -0
- package/dist/src/services/gitService.d.ts +23 -0
- package/dist/src/services/gitService.js +110 -0
- package/dist/src/services/gitService.js.map +1 -0
- package/dist/src/services/gitService.test.d.ts +6 -0
- package/dist/src/services/gitService.test.js +212 -0
- package/dist/src/services/gitService.test.js.map +1 -0
- package/dist/src/services/loopDetectionService.d.ts +98 -0
- package/dist/src/services/loopDetectionService.js +363 -0
- package/dist/src/services/loopDetectionService.js.map +1 -0
- package/dist/src/services/loopDetectionService.test.d.ts +6 -0
- package/dist/src/services/loopDetectionService.test.js +558 -0
- package/dist/src/services/loopDetectionService.test.js.map +1 -0
- package/dist/src/services/shellExecutionService.d.ts +68 -0
- package/dist/src/services/shellExecutionService.js +332 -0
- package/dist/src/services/shellExecutionService.js.map +1 -0
- package/dist/src/services/shellExecutionService.test.d.ts +6 -0
- package/dist/src/services/shellExecutionService.test.js +517 -0
- package/dist/src/services/shellExecutionService.test.js.map +1 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +121 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +773 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.d.ts +17 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +407 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +1 -0
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +90 -0
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +229 -0
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -0
- package/dist/src/telemetry/constants.d.ts +32 -0
- package/dist/src/telemetry/constants.js +33 -0
- package/dist/src/telemetry/constants.js.map +1 -0
- package/dist/src/telemetry/file-exporters.d.ts +29 -0
- package/dist/src/telemetry/file-exporters.js +62 -0
- package/dist/src/telemetry/file-exporters.js.map +1 -0
- package/dist/src/telemetry/index.d.ts +21 -0
- package/dist/src/telemetry/index.js +21 -0
- package/dist/src/telemetry/index.js.map +1 -0
- package/dist/src/telemetry/integration.test.circular.d.ts +6 -0
- package/dist/src/telemetry/integration.test.circular.js +54 -0
- package/dist/src/telemetry/integration.test.circular.js.map +1 -0
- package/dist/src/telemetry/loggers.d.ts +26 -0
- package/dist/src/telemetry/loggers.js +404 -0
- package/dist/src/telemetry/loggers.js.map +1 -0
- package/dist/src/telemetry/loggers.test.circular.d.ts +6 -0
- package/dist/src/telemetry/loggers.test.circular.js +107 -0
- package/dist/src/telemetry/loggers.test.circular.js.map +1 -0
- package/dist/src/telemetry/loggers.test.d.ts +6 -0
- package/dist/src/telemetry/loggers.test.js +658 -0
- package/dist/src/telemetry/loggers.test.js.map +1 -0
- package/dist/src/telemetry/metrics.d.ts +36 -0
- package/dist/src/telemetry/metrics.js +208 -0
- package/dist/src/telemetry/metrics.js.map +1 -0
- package/dist/src/telemetry/metrics.test.d.ts +6 -0
- package/dist/src/telemetry/metrics.test.js +242 -0
- package/dist/src/telemetry/metrics.test.js.map +1 -0
- package/dist/src/telemetry/sdk.d.ts +9 -0
- package/dist/src/telemetry/sdk.js +163 -0
- package/dist/src/telemetry/sdk.js.map +1 -0
- package/dist/src/telemetry/sdk.test.d.ts +6 -0
- package/dist/src/telemetry/sdk.test.js +82 -0
- package/dist/src/telemetry/sdk.test.js.map +1 -0
- package/dist/src/telemetry/telemetry-utils.d.ts +6 -0
- package/dist/src/telemetry/telemetry-utils.js +14 -0
- package/dist/src/telemetry/telemetry-utils.js.map +1 -0
- package/dist/src/telemetry/telemetry-utils.test.d.ts +6 -0
- package/dist/src/telemetry/telemetry-utils.test.js +40 -0
- package/dist/src/telemetry/telemetry-utils.test.js.map +1 -0
- package/dist/src/telemetry/telemetry.test.d.ts +6 -0
- package/dist/src/telemetry/telemetry.test.js +50 -0
- package/dist/src/telemetry/telemetry.test.js.map +1 -0
- package/dist/src/telemetry/tool-call-decision.d.ts +13 -0
- package/dist/src/telemetry/tool-call-decision.js +29 -0
- package/dist/src/telemetry/tool-call-decision.js.map +1 -0
- package/dist/src/telemetry/types.d.ts +220 -0
- package/dist/src/telemetry/types.js +383 -0
- package/dist/src/telemetry/types.js.map +1 -0
- package/dist/src/telemetry/uiTelemetry.d.ts +75 -0
- package/dist/src/telemetry/uiTelemetry.js +153 -0
- package/dist/src/telemetry/uiTelemetry.js.map +1 -0
- package/dist/src/telemetry/uiTelemetry.test.d.ts +6 -0
- package/dist/src/telemetry/uiTelemetry.test.js +558 -0
- package/dist/src/telemetry/uiTelemetry.test.js.map +1 -0
- package/dist/src/test-utils/config.d.ts +17 -0
- package/dist/src/test-utils/config.js +32 -0
- package/dist/src/test-utils/config.js.map +1 -0
- package/dist/src/test-utils/mockWorkspaceContext.d.ts +13 -0
- package/dist/src/test-utils/mockWorkspaceContext.js +24 -0
- package/dist/src/test-utils/mockWorkspaceContext.js.map +1 -0
- package/dist/src/test-utils/tools.d.ts +45 -0
- package/dist/src/test-utils/tools.js +105 -0
- package/dist/src/test-utils/tools.js.map +1 -0
- package/dist/src/tools/diffOptions.d.ts +9 -0
- package/dist/src/tools/diffOptions.js +38 -0
- package/dist/src/tools/diffOptions.js.map +1 -0
- package/dist/src/tools/diffOptions.test.d.ts +6 -0
- package/dist/src/tools/diffOptions.test.js +119 -0
- package/dist/src/tools/diffOptions.test.js.map +1 -0
- package/dist/src/tools/edit.d.ts +56 -0
- package/dist/src/tools/edit.js +423 -0
- package/dist/src/tools/edit.js.map +1 -0
- package/dist/src/tools/edit.test.d.ts +6 -0
- package/dist/src/tools/edit.test.js +713 -0
- package/dist/src/tools/edit.test.js.map +1 -0
- package/dist/src/tools/glob.d.ts +52 -0
- package/dist/src/tools/glob.js +236 -0
- package/dist/src/tools/glob.js.map +1 -0
- package/dist/src/tools/glob.test.d.ts +6 -0
- package/dist/src/tools/glob.test.js +375 -0
- package/dist/src/tools/glob.test.js.map +1 -0
- package/dist/src/tools/grep.d.ts +47 -0
- package/dist/src/tools/grep.js +517 -0
- package/dist/src/tools/grep.js.map +1 -0
- package/dist/src/tools/grep.test.d.ts +6 -0
- package/dist/src/tools/grep.test.js +295 -0
- package/dist/src/tools/grep.test.js.map +1 -0
- package/dist/src/tools/ls.d.ts +68 -0
- package/dist/src/tools/ls.js +227 -0
- package/dist/src/tools/ls.js.map +1 -0
- package/dist/src/tools/ls.test.d.ts +6 -0
- package/dist/src/tools/ls.test.js +389 -0
- package/dist/src/tools/ls.test.js.map +1 -0
- package/dist/src/tools/mcp-client-manager.d.ts +38 -0
- package/dist/src/tools/mcp-client-manager.js +74 -0
- package/dist/src/tools/mcp-client-manager.js.map +1 -0
- package/dist/src/tools/mcp-client-manager.test.d.ts +6 -0
- package/dist/src/tools/mcp-client-manager.test.js +39 -0
- package/dist/src/tools/mcp-client-manager.test.js.map +1 -0
- package/dist/src/tools/mcp-client.d.ts +199 -0
- package/dist/src/tools/mcp-client.js +995 -0
- package/dist/src/tools/mcp-client.js.map +1 -0
- package/dist/src/tools/mcp-client.test.d.ts +6 -0
- package/dist/src/tools/mcp-client.test.js +454 -0
- package/dist/src/tools/mcp-client.test.js.map +1 -0
- package/dist/src/tools/mcp-tool.d.ts +23 -0
- package/dist/src/tools/mcp-tool.js +240 -0
- package/dist/src/tools/mcp-tool.js.map +1 -0
- package/dist/src/tools/mcp-tool.test.d.ts +6 -0
- package/dist/src/tools/mcp-tool.test.js +576 -0
- package/dist/src/tools/mcp-tool.test.js.map +1 -0
- package/dist/src/tools/memoryTool.d.ts +40 -0
- package/dist/src/tools/memoryTool.js +296 -0
- package/dist/src/tools/memoryTool.js.map +1 -0
- package/dist/src/tools/memoryTool.test.d.ts +6 -0
- package/dist/src/tools/memoryTool.test.js +298 -0
- package/dist/src/tools/memoryTool.test.js.map +1 -0
- package/dist/src/tools/modifiable-tool.d.ts +32 -0
- package/dist/src/tools/modifiable-tool.js +88 -0
- package/dist/src/tools/modifiable-tool.js.map +1 -0
- package/dist/src/tools/modifiable-tool.test.d.ts +6 -0
- package/dist/src/tools/modifiable-tool.test.js +193 -0
- package/dist/src/tools/modifiable-tool.test.js.map +1 -0
- package/dist/src/tools/read-file.d.ts +35 -0
- package/dist/src/tools/read-file.js +127 -0
- package/dist/src/tools/read-file.js.map +1 -0
- package/dist/src/tools/read-file.test.d.ts +6 -0
- package/dist/src/tools/read-file.test.js +311 -0
- package/dist/src/tools/read-file.test.js.map +1 -0
- package/dist/src/tools/read-many-files.d.ts +60 -0
- package/dist/src/tools/read-many-files.js +414 -0
- package/dist/src/tools/read-many-files.js.map +1 -0
- package/dist/src/tools/read-many-files.test.d.ts +6 -0
- package/dist/src/tools/read-many-files.test.js +565 -0
- package/dist/src/tools/read-many-files.test.js.map +1 -0
- package/dist/src/tools/ripGrep.d.ts +47 -0
- package/dist/src/tools/ripGrep.js +368 -0
- package/dist/src/tools/ripGrep.js.map +1 -0
- package/dist/src/tools/ripGrep.test.d.ts +6 -0
- package/dist/src/tools/ripGrep.test.js +874 -0
- package/dist/src/tools/ripGrep.test.js.map +1 -0
- package/dist/src/tools/shell.d.ts +22 -0
- package/dist/src/tools/shell.js +320 -0
- package/dist/src/tools/shell.js.map +1 -0
- package/dist/src/tools/shell.test.d.ts +6 -0
- package/dist/src/tools/shell.test.js +336 -0
- package/dist/src/tools/shell.test.js.map +1 -0
- package/dist/src/tools/tool-error.d.ts +43 -0
- package/dist/src/tools/tool-error.js +58 -0
- package/dist/src/tools/tool-error.js.map +1 -0
- package/dist/src/tools/tool-registry.d.ts +86 -0
- package/dist/src/tools/tool-registry.js +369 -0
- package/dist/src/tools/tool-registry.js.map +1 -0
- package/dist/src/tools/tool-registry.test.d.ts +6 -0
- package/dist/src/tools/tool-registry.test.js +332 -0
- package/dist/src/tools/tool-registry.test.js.map +1 -0
- package/dist/src/tools/tools.d.ts +274 -0
- package/dist/src/tools/tools.js +250 -0
- package/dist/src/tools/tools.js.map +1 -0
- package/dist/src/tools/tools.test.d.ts +6 -0
- package/dist/src/tools/tools.test.js +205 -0
- package/dist/src/tools/tools.test.js.map +1 -0
- package/dist/src/tools/web-fetch.d.ts +27 -0
- package/dist/src/tools/web-fetch.js +243 -0
- package/dist/src/tools/web-fetch.js.map +1 -0
- package/dist/src/tools/web-fetch.test.d.ts +6 -0
- package/dist/src/tools/web-fetch.test.js +114 -0
- package/dist/src/tools/web-fetch.test.js.map +1 -0
- package/dist/src/tools/web-search.d.ts +49 -0
- package/dist/src/tools/web-search.js +137 -0
- package/dist/src/tools/web-search.js.map +1 -0
- package/dist/src/tools/web-search.test.d.ts +6 -0
- package/dist/src/tools/web-search.test.js +207 -0
- package/dist/src/tools/web-search.test.js.map +1 -0
- package/dist/src/tools/write-file.d.ts +52 -0
- package/dist/src/tools/write-file.js +314 -0
- package/dist/src/tools/write-file.js.map +1 -0
- package/dist/src/tools/write-file.test.d.ts +6 -0
- package/dist/src/tools/write-file.test.js +531 -0
- package/dist/src/tools/write-file.test.js.map +1 -0
- package/dist/src/utils/LruCache.d.ts +13 -0
- package/dist/src/utils/LruCache.js +38 -0
- package/dist/src/utils/LruCache.js.map +1 -0
- package/dist/src/utils/bfsFileSearch.d.ts +24 -0
- package/dist/src/utils/bfsFileSearch.js +89 -0
- package/dist/src/utils/bfsFileSearch.js.map +1 -0
- package/dist/src/utils/bfsFileSearch.test.d.ts +6 -0
- package/dist/src/utils/bfsFileSearch.test.js +163 -0
- package/dist/src/utils/bfsFileSearch.test.js.map +1 -0
- package/dist/src/utils/browser.d.ts +13 -0
- package/dist/src/utils/browser.js +50 -0
- package/dist/src/utils/browser.js.map +1 -0
- package/dist/src/utils/editCorrector.d.ts +53 -0
- package/dist/src/utils/editCorrector.js +545 -0
- package/dist/src/utils/editCorrector.js.map +1 -0
- package/dist/src/utils/editCorrector.test.d.ts +6 -0
- package/dist/src/utils/editCorrector.test.js +564 -0
- package/dist/src/utils/editCorrector.test.js.map +1 -0
- package/dist/src/utils/editor.d.ts +28 -0
- package/dist/src/utils/editor.js +186 -0
- package/dist/src/utils/editor.js.map +1 -0
- package/dist/src/utils/editor.test.d.ts +6 -0
- package/dist/src/utils/editor.test.js +445 -0
- package/dist/src/utils/editor.test.js.map +1 -0
- package/dist/src/utils/environmentContext.d.ts +21 -0
- package/dist/src/utils/environmentContext.js +90 -0
- package/dist/src/utils/environmentContext.js.map +1 -0
- package/dist/src/utils/environmentContext.test.d.ts +6 -0
- package/dist/src/utils/environmentContext.test.js +140 -0
- package/dist/src/utils/environmentContext.test.js.map +1 -0
- package/dist/src/utils/errorParsing.d.ts +8 -0
- package/dist/src/utils/errorParsing.js +93 -0
- package/dist/src/utils/errorParsing.js.map +1 -0
- package/dist/src/utils/errorParsing.test.d.ts +6 -0
- package/dist/src/utils/errorParsing.test.js +172 -0
- package/dist/src/utils/errorParsing.test.js.map +1 -0
- package/dist/src/utils/errorReporting.d.ts +14 -0
- package/dist/src/utils/errorReporting.js +88 -0
- package/dist/src/utils/errorReporting.js.map +1 -0
- package/dist/src/utils/errorReporting.test.d.ts +6 -0
- package/dist/src/utils/errorReporting.test.js +130 -0
- package/dist/src/utils/errorReporting.test.js.map +1 -0
- package/dist/src/utils/errors.d.ts +33 -0
- package/dist/src/utils/errors.js +86 -0
- package/dist/src/utils/errors.js.map +1 -0
- package/dist/src/utils/fetch.d.ts +11 -0
- package/dist/src/utils/fetch.js +51 -0
- package/dist/src/utils/fetch.js.map +1 -0
- package/dist/src/utils/fileUtils.d.ts +52 -0
- package/dist/src/utils/fileUtils.js +283 -0
- package/dist/src/utils/fileUtils.js.map +1 -0
- package/dist/src/utils/fileUtils.test.d.ts +6 -0
- package/dist/src/utils/fileUtils.test.js +364 -0
- package/dist/src/utils/fileUtils.test.js.map +1 -0
- package/dist/src/utils/filesearch/crawlCache.d.ts +25 -0
- package/dist/src/utils/filesearch/crawlCache.js +57 -0
- package/dist/src/utils/filesearch/crawlCache.js.map +1 -0
- package/dist/src/utils/filesearch/crawlCache.test.d.ts +6 -0
- package/dist/src/utils/filesearch/crawlCache.test.js +103 -0
- package/dist/src/utils/filesearch/crawlCache.test.js.map +1 -0
- package/dist/src/utils/filesearch/crawler.d.ts +15 -0
- package/dist/src/utils/filesearch/crawler.js +50 -0
- package/dist/src/utils/filesearch/crawler.js.map +1 -0
- package/dist/src/utils/filesearch/crawler.test.d.ts +6 -0
- package/dist/src/utils/filesearch/crawler.test.js +468 -0
- package/dist/src/utils/filesearch/crawler.test.js.map +1 -0
- package/dist/src/utils/filesearch/fileSearch.d.ts +38 -0
- package/dist/src/utils/filesearch/fileSearch.js +191 -0
- package/dist/src/utils/filesearch/fileSearch.js.map +1 -0
- package/dist/src/utils/filesearch/fileSearch.test.d.ts +6 -0
- package/dist/src/utils/filesearch/fileSearch.test.js +642 -0
- package/dist/src/utils/filesearch/fileSearch.test.js.map +1 -0
- package/dist/src/utils/filesearch/ignore.d.ts +42 -0
- package/dist/src/utils/filesearch/ignore.js +106 -0
- package/dist/src/utils/filesearch/ignore.js.map +1 -0
- package/dist/src/utils/filesearch/ignore.test.d.ts +6 -0
- package/dist/src/utils/filesearch/ignore.test.js +144 -0
- package/dist/src/utils/filesearch/ignore.test.js.map +1 -0
- package/dist/src/utils/filesearch/result-cache.d.ts +33 -0
- package/dist/src/utils/filesearch/result-cache.js +59 -0
- package/dist/src/utils/filesearch/result-cache.js.map +1 -0
- package/dist/src/utils/filesearch/result-cache.test.d.ts +6 -0
- package/dist/src/utils/filesearch/result-cache.test.js +46 -0
- package/dist/src/utils/filesearch/result-cache.test.js.map +1 -0
- package/dist/src/utils/flashFallback.integration.test.d.ts +6 -0
- package/dist/src/utils/flashFallback.integration.test.js +118 -0
- package/dist/src/utils/flashFallback.integration.test.js.map +1 -0
- package/dist/src/utils/formatters.d.ts +6 -0
- package/dist/src/utils/formatters.js +16 -0
- package/dist/src/utils/formatters.js.map +1 -0
- package/dist/src/utils/generateContentResponseUtilities.d.ts +13 -0
- package/dist/src/utils/generateContentResponseUtilities.js +80 -0
- package/dist/src/utils/generateContentResponseUtilities.js.map +1 -0
- package/dist/src/utils/generateContentResponseUtilities.test.d.ts +6 -0
- package/dist/src/utils/generateContentResponseUtilities.test.js +235 -0
- package/dist/src/utils/generateContentResponseUtilities.test.js.map +1 -0
- package/dist/src/utils/getFolderStructure.d.ts +31 -0
- package/dist/src/utils/getFolderStructure.js +246 -0
- package/dist/src/utils/getFolderStructure.js.map +1 -0
- package/dist/src/utils/getFolderStructure.test.d.ts +6 -0
- package/dist/src/utils/getFolderStructure.test.js +282 -0
- package/dist/src/utils/getFolderStructure.test.js.map +1 -0
- package/dist/src/utils/getPty.d.ts +19 -0
- package/dist/src/utils/getPty.js +23 -0
- package/dist/src/utils/getPty.js.map +1 -0
- package/dist/src/utils/gitIgnoreParser.d.ts +20 -0
- package/dist/src/utils/gitIgnoreParser.js +61 -0
- package/dist/src/utils/gitIgnoreParser.js.map +1 -0
- package/dist/src/utils/gitIgnoreParser.test.d.ts +6 -0
- package/dist/src/utils/gitIgnoreParser.test.js +154 -0
- package/dist/src/utils/gitIgnoreParser.test.js.map +1 -0
- package/dist/src/utils/gitUtils.d.ts +17 -0
- package/dist/src/utils/gitUtils.js +61 -0
- package/dist/src/utils/gitUtils.js.map +1 -0
- package/dist/src/utils/ignorePatterns.d.ts +103 -0
- package/dist/src/utils/ignorePatterns.js +220 -0
- package/dist/src/utils/ignorePatterns.js.map +1 -0
- package/dist/src/utils/ignorePatterns.test.d.ts +6 -0
- package/dist/src/utils/ignorePatterns.test.js +250 -0
- package/dist/src/utils/ignorePatterns.test.js.map +1 -0
- package/dist/src/utils/installationManager.d.ts +16 -0
- package/dist/src/utils/installationManager.js +50 -0
- package/dist/src/utils/installationManager.js.map +1 -0
- package/dist/src/utils/installationManager.test.d.ts +6 -0
- package/dist/src/utils/installationManager.test.js +83 -0
- package/dist/src/utils/installationManager.test.js.map +1 -0
- package/dist/src/utils/language-detection.d.ts +6 -0
- package/dist/src/utils/language-detection.js +101 -0
- package/dist/src/utils/language-detection.js.map +1 -0
- package/dist/src/utils/memoryDiscovery.d.ts +15 -0
- package/dist/src/utils/memoryDiscovery.js +253 -0
- package/dist/src/utils/memoryDiscovery.js.map +1 -0
- package/dist/src/utils/memoryDiscovery.test.d.ts +6 -0
- package/dist/src/utils/memoryDiscovery.test.js +219 -0
- package/dist/src/utils/memoryDiscovery.test.js.map +1 -0
- package/dist/src/utils/memoryImportProcessor.d.ts +42 -0
- package/dist/src/utils/memoryImportProcessor.js +296 -0
- package/dist/src/utils/memoryImportProcessor.js.map +1 -0
- package/dist/src/utils/memoryImportProcessor.test.d.ts +6 -0
- package/dist/src/utils/memoryImportProcessor.test.js +573 -0
- package/dist/src/utils/memoryImportProcessor.test.js.map +1 -0
- package/dist/src/utils/messageInspectors.d.ts +8 -0
- package/dist/src/utils/messageInspectors.js +16 -0
- package/dist/src/utils/messageInspectors.js.map +1 -0
- package/dist/src/utils/nextSpeakerChecker.d.ts +12 -0
- package/dist/src/utils/nextSpeakerChecker.js +91 -0
- package/dist/src/utils/nextSpeakerChecker.js.map +1 -0
- package/dist/src/utils/nextSpeakerChecker.test.d.ts +6 -0
- package/dist/src/utils/nextSpeakerChecker.test.js +168 -0
- package/dist/src/utils/nextSpeakerChecker.test.js.map +1 -0
- package/dist/src/utils/partUtils.d.ts +35 -0
- package/dist/src/utils/partUtils.js +133 -0
- package/dist/src/utils/partUtils.js.map +1 -0
- package/dist/src/utils/partUtils.test.d.ts +6 -0
- package/dist/src/utils/partUtils.test.js +241 -0
- package/dist/src/utils/partUtils.test.js.map +1 -0
- package/dist/src/utils/pathReader.d.ts +17 -0
- package/dist/src/utils/pathReader.js +92 -0
- package/dist/src/utils/pathReader.js.map +1 -0
- package/dist/src/utils/pathReader.test.d.ts +6 -0
- package/dist/src/utils/pathReader.test.js +363 -0
- package/dist/src/utils/pathReader.test.js.map +1 -0
- package/dist/src/utils/paths.d.ts +58 -0
- package/dist/src/utils/paths.js +159 -0
- package/dist/src/utils/paths.js.map +1 -0
- package/dist/src/utils/paths.test.d.ts +6 -0
- package/dist/src/utils/paths.test.js +225 -0
- package/dist/src/utils/paths.test.js.map +1 -0
- package/dist/src/utils/quotaErrorDetection.d.ts +18 -0
- package/dist/src/utils/quotaErrorDetection.js +65 -0
- package/dist/src/utils/quotaErrorDetection.js.map +1 -0
- package/dist/src/utils/retry.d.ts +30 -0
- package/dist/src/utils/retry.js +276 -0
- package/dist/src/utils/retry.js.map +1 -0
- package/dist/src/utils/retry.test.d.ts +6 -0
- package/dist/src/utils/retry.test.js +325 -0
- package/dist/src/utils/retry.test.js.map +1 -0
- package/dist/src/utils/safeJsonStringify.d.ts +13 -0
- package/dist/src/utils/safeJsonStringify.js +25 -0
- package/dist/src/utils/safeJsonStringify.js.map +1 -0
- package/dist/src/utils/safeJsonStringify.test.d.ts +6 -0
- package/dist/src/utils/safeJsonStringify.test.js +61 -0
- package/dist/src/utils/safeJsonStringify.test.js.map +1 -0
- package/dist/src/utils/schemaValidator.d.ts +15 -0
- package/dist/src/utils/schemaValidator.js +38 -0
- package/dist/src/utils/schemaValidator.js.map +1 -0
- package/dist/src/utils/secure-browser-launcher.d.ts +23 -0
- package/dist/src/utils/secure-browser-launcher.js +165 -0
- package/dist/src/utils/secure-browser-launcher.js.map +1 -0
- package/dist/src/utils/secure-browser-launcher.test.d.ts +6 -0
- package/dist/src/utils/secure-browser-launcher.test.js +149 -0
- package/dist/src/utils/secure-browser-launcher.test.js.map +1 -0
- package/dist/src/utils/session.d.ts +6 -0
- package/dist/src/utils/session.js +8 -0
- package/dist/src/utils/session.js.map +1 -0
- package/dist/src/utils/shell-utils.d.ts +117 -0
- package/dist/src/utils/shell-utils.js +370 -0
- package/dist/src/utils/shell-utils.js.map +1 -0
- package/dist/src/utils/shell-utils.test.d.ts +6 -0
- package/dist/src/utils/shell-utils.test.js +332 -0
- package/dist/src/utils/shell-utils.test.js.map +1 -0
- package/dist/src/utils/summarizer.d.ts +25 -0
- package/dist/src/utils/summarizer.js +51 -0
- package/dist/src/utils/summarizer.js.map +1 -0
- package/dist/src/utils/summarizer.test.d.ts +6 -0
- package/dist/src/utils/summarizer.test.js +131 -0
- package/dist/src/utils/summarizer.test.js.map +1 -0
- package/dist/src/utils/systemEncoding.d.ts +40 -0
- package/dist/src/utils/systemEncoding.js +149 -0
- package/dist/src/utils/systemEncoding.js.map +1 -0
- package/dist/src/utils/systemEncoding.test.d.ts +6 -0
- package/dist/src/utils/systemEncoding.test.js +368 -0
- package/dist/src/utils/systemEncoding.test.js.map +1 -0
- package/dist/src/utils/testUtils.d.ts +29 -0
- package/dist/src/utils/testUtils.js +70 -0
- package/dist/src/utils/testUtils.js.map +1 -0
- package/dist/src/utils/textUtils.d.ts +13 -0
- package/dist/src/utils/textUtils.js +28 -0
- package/dist/src/utils/textUtils.js.map +1 -0
- package/dist/src/utils/tool-utils.d.ts +19 -0
- package/dist/src/utils/tool-utils.js +58 -0
- package/dist/src/utils/tool-utils.js.map +1 -0
- package/dist/src/utils/tool-utils.test.d.ts +6 -0
- package/dist/src/utils/tool-utils.test.js +61 -0
- package/dist/src/utils/tool-utils.test.js.map +1 -0
- package/dist/src/utils/userAccountManager.d.ts +20 -0
- package/dist/src/utils/userAccountManager.js +114 -0
- package/dist/src/utils/userAccountManager.js.map +1 -0
- package/dist/src/utils/userAccountManager.test.d.ts +6 -0
- package/dist/src/utils/userAccountManager.test.js +223 -0
- package/dist/src/utils/userAccountManager.test.js.map +1 -0
- package/dist/src/utils/workspaceContext.d.ts +66 -0
- package/dist/src/utils/workspaceContext.js +171 -0
- package/dist/src/utils/workspaceContext.js.map +1 -0
- package/dist/src/utils/workspaceContext.test.d.ts +6 -0
- package/dist/src/utils/workspaceContext.test.js +318 -0
- package/dist/src/utils/workspaceContext.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +85 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { describe, it, expect, vi, afterEach, beforeEach, } from 'vitest';
|
|
7
|
+
import { getIdeProcessInfo } from './process-utils.js';
|
|
8
|
+
import os from 'node:os';
|
|
9
|
+
const mockedExec = vi.hoisted(() => vi.fn());
|
|
10
|
+
vi.mock('node:util', () => ({
|
|
11
|
+
promisify: vi.fn().mockReturnValue(mockedExec),
|
|
12
|
+
}));
|
|
13
|
+
vi.mock('node:os', () => ({
|
|
14
|
+
default: {
|
|
15
|
+
platform: vi.fn(),
|
|
16
|
+
},
|
|
17
|
+
}));
|
|
18
|
+
describe('getIdeProcessInfo', () => {
|
|
19
|
+
beforeEach(() => {
|
|
20
|
+
Object.defineProperty(process, 'pid', { value: 1000, configurable: true });
|
|
21
|
+
mockedExec.mockReset();
|
|
22
|
+
});
|
|
23
|
+
afterEach(() => {
|
|
24
|
+
vi.restoreAllMocks();
|
|
25
|
+
});
|
|
26
|
+
describe('on Unix', () => {
|
|
27
|
+
it('should traverse up to find the shell and return grandparent process info', async () => {
|
|
28
|
+
os.platform.mockReturnValue('linux');
|
|
29
|
+
// process (1000) -> shell (800) -> IDE (700)
|
|
30
|
+
mockedExec
|
|
31
|
+
.mockResolvedValueOnce({ stdout: '800 /bin/bash' }) // pid 1000 -> ppid 800 (shell)
|
|
32
|
+
.mockResolvedValueOnce({ stdout: '700 /usr/lib/vscode/code' }) // pid 800 -> ppid 700 (IDE)
|
|
33
|
+
.mockResolvedValueOnce({ stdout: '700 /usr/lib/vscode/code' }); // get command for pid 700
|
|
34
|
+
const result = await getIdeProcessInfo();
|
|
35
|
+
expect(result).toEqual({ pid: 700, command: '/usr/lib/vscode/code' });
|
|
36
|
+
});
|
|
37
|
+
it('should return parent process info if grandparent lookup fails', async () => {
|
|
38
|
+
os.platform.mockReturnValue('linux');
|
|
39
|
+
mockedExec
|
|
40
|
+
.mockResolvedValueOnce({ stdout: '800 /bin/bash' }) // pid 1000 -> ppid 800 (shell)
|
|
41
|
+
.mockRejectedValueOnce(new Error('ps failed')) // lookup for ppid of 800 fails
|
|
42
|
+
.mockResolvedValueOnce({ stdout: '800 /bin/bash' }); // get command for pid 800
|
|
43
|
+
const result = await getIdeProcessInfo();
|
|
44
|
+
expect(result).toEqual({ pid: 800, command: '/bin/bash' });
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
describe('on Windows', () => {
|
|
48
|
+
it('should traverse up and find the great-grandchild of the root process', async () => {
|
|
49
|
+
os.platform.mockReturnValue('win32');
|
|
50
|
+
const processInfoMap = new Map([
|
|
51
|
+
[1000, { stdout: 'ParentProcessId=900\r\nCommandLine=node.exe\r\n' }],
|
|
52
|
+
[
|
|
53
|
+
900,
|
|
54
|
+
{ stdout: 'ParentProcessId=800\r\nCommandLine=powershell.exe\r\n' },
|
|
55
|
+
],
|
|
56
|
+
[800, { stdout: 'ParentProcessId=700\r\nCommandLine=code.exe\r\n' }],
|
|
57
|
+
[700, { stdout: 'ParentProcessId=0\r\nCommandLine=wininit.exe\r\n' }],
|
|
58
|
+
]);
|
|
59
|
+
mockedExec.mockImplementation((command) => {
|
|
60
|
+
const pidMatch = command.match(/ProcessId=(\d+)/);
|
|
61
|
+
if (pidMatch) {
|
|
62
|
+
const pid = parseInt(pidMatch[1], 10);
|
|
63
|
+
return Promise.resolve(processInfoMap.get(pid));
|
|
64
|
+
}
|
|
65
|
+
return Promise.reject(new Error('Invalid command for mock'));
|
|
66
|
+
});
|
|
67
|
+
const result = await getIdeProcessInfo();
|
|
68
|
+
expect(result).toEqual({ pid: 900, command: 'powershell.exe' });
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
//# sourceMappingURL=process-utils.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-utils.test.js","sourceRoot":"","sources":["../../../src/ide/process-utils.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,QAAQ,EACR,EAAE,EACF,MAAM,EACN,EAAE,EACF,SAAS,EACT,UAAU,GAEX,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,MAAM,UAAU,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;AAC7C,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC;IAC1B,SAAS,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,UAAU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,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;gBAClD,CAAC;gBACD,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC,CAAC;YAC/D,CAAC,CAAC,CAAC;YAEH,MAAM,MAAM,GAAG,MAAM,iBAAiB,EAAE,CAAC;YACzC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
export * from './config/config.js';
|
|
7
|
+
export * from './core/client.js';
|
|
8
|
+
export * from './core/contentGenerator.js';
|
|
9
|
+
export * from './core/loggingContentGenerator.js';
|
|
10
|
+
export * from './core/geminiChat.js';
|
|
11
|
+
export * from './core/logger.js';
|
|
12
|
+
export * from './core/prompts.js';
|
|
13
|
+
export * from './core/tokenLimits.js';
|
|
14
|
+
export * from './core/turn.js';
|
|
15
|
+
export * from './core/geminiRequest.js';
|
|
16
|
+
export * from './core/coreToolScheduler.js';
|
|
17
|
+
export * from './core/nonInteractiveToolExecutor.js';
|
|
18
|
+
export * from './code_assist/codeAssist.js';
|
|
19
|
+
export * from './code_assist/oauth2.js';
|
|
20
|
+
export * from './code_assist/server.js';
|
|
21
|
+
export * from './code_assist/types.js';
|
|
22
|
+
export * from './utils/paths.js';
|
|
23
|
+
export * from './utils/schemaValidator.js';
|
|
24
|
+
export * from './utils/errors.js';
|
|
25
|
+
export * from './utils/getFolderStructure.js';
|
|
26
|
+
export * from './utils/memoryDiscovery.js';
|
|
27
|
+
export * from './utils/gitIgnoreParser.js';
|
|
28
|
+
export * from './utils/gitUtils.js';
|
|
29
|
+
export * from './utils/editor.js';
|
|
30
|
+
export * from './utils/quotaErrorDetection.js';
|
|
31
|
+
export * from './utils/fileUtils.js';
|
|
32
|
+
export * from './utils/retry.js';
|
|
33
|
+
export * from './utils/shell-utils.js';
|
|
34
|
+
export * from './utils/systemEncoding.js';
|
|
35
|
+
export * from './utils/textUtils.js';
|
|
36
|
+
export * from './utils/formatters.js';
|
|
37
|
+
export * from './utils/generateContentResponseUtilities.js';
|
|
38
|
+
export * from './utils/filesearch/fileSearch.js';
|
|
39
|
+
export * from './utils/errorParsing.js';
|
|
40
|
+
export * from './utils/workspaceContext.js';
|
|
41
|
+
export * from './utils/ignorePatterns.js';
|
|
42
|
+
export * from './utils/partUtils.js';
|
|
43
|
+
export * from './services/fileDiscoveryService.js';
|
|
44
|
+
export * from './services/gitService.js';
|
|
45
|
+
export * from './services/chatRecordingService.js';
|
|
46
|
+
export * from './services/fileSystemService.js';
|
|
47
|
+
export * from './ide/ide-client.js';
|
|
48
|
+
export * from './ide/ideContext.js';
|
|
49
|
+
export * from './ide/ide-installer.js';
|
|
50
|
+
export { getIdeInfo, DetectedIde } from './ide/detect-ide.js';
|
|
51
|
+
export { type IdeInfo } from './ide/detect-ide.js';
|
|
52
|
+
export * from './ide/constants.js';
|
|
53
|
+
export * from './services/shellExecutionService.js';
|
|
54
|
+
export * from './tools/tools.js';
|
|
55
|
+
export * from './tools/tool-error.js';
|
|
56
|
+
export * from './tools/tool-registry.js';
|
|
57
|
+
export * from './prompts/mcp-prompts.js';
|
|
58
|
+
export * from './tools/read-file.js';
|
|
59
|
+
export * from './tools/ls.js';
|
|
60
|
+
export * from './tools/grep.js';
|
|
61
|
+
export * from './tools/ripGrep.js';
|
|
62
|
+
export * from './tools/glob.js';
|
|
63
|
+
export * from './tools/edit.js';
|
|
64
|
+
export * from './tools/write-file.js';
|
|
65
|
+
export * from './tools/web-fetch.js';
|
|
66
|
+
export * from './tools/memoryTool.js';
|
|
67
|
+
export * from './tools/shell.js';
|
|
68
|
+
export * from './tools/web-search.js';
|
|
69
|
+
export * from './tools/read-many-files.js';
|
|
70
|
+
export * from './tools/mcp-client.js';
|
|
71
|
+
export * from './tools/mcp-tool.js';
|
|
72
|
+
export { MCPOAuthProvider } from './mcp/oauth-provider.js';
|
|
73
|
+
export type { OAuthToken, OAuthCredentials, } from './mcp/token-storage/types.js';
|
|
74
|
+
export { MCPOAuthTokenStorage } from './mcp/oauth-token-storage.js';
|
|
75
|
+
export type { MCPOAuthConfig } from './mcp/oauth-provider.js';
|
|
76
|
+
export type { OAuthAuthorizationServerMetadata, OAuthProtectedResourceMetadata, } from './mcp/oauth-utils.js';
|
|
77
|
+
export { OAuthUtils } from './mcp/oauth-utils.js';
|
|
78
|
+
export * from './telemetry/index.js';
|
|
79
|
+
export { sessionId } from './utils/session.js';
|
|
80
|
+
export * from './utils/browser.js';
|
|
81
|
+
export { Storage } from './config/storage.js';
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
// Export config
|
|
7
|
+
export * from './config/config.js';
|
|
8
|
+
// Export Core Logic
|
|
9
|
+
export * from './core/client.js';
|
|
10
|
+
export * from './core/contentGenerator.js';
|
|
11
|
+
export * from './core/loggingContentGenerator.js';
|
|
12
|
+
export * from './core/geminiChat.js';
|
|
13
|
+
export * from './core/logger.js';
|
|
14
|
+
export * from './core/prompts.js';
|
|
15
|
+
export * from './core/tokenLimits.js';
|
|
16
|
+
export * from './core/turn.js';
|
|
17
|
+
export * from './core/geminiRequest.js';
|
|
18
|
+
export * from './core/coreToolScheduler.js';
|
|
19
|
+
export * from './core/nonInteractiveToolExecutor.js';
|
|
20
|
+
export * from './code_assist/codeAssist.js';
|
|
21
|
+
export * from './code_assist/oauth2.js';
|
|
22
|
+
export * from './code_assist/server.js';
|
|
23
|
+
export * from './code_assist/types.js';
|
|
24
|
+
// Export utilities
|
|
25
|
+
export * from './utils/paths.js';
|
|
26
|
+
export * from './utils/schemaValidator.js';
|
|
27
|
+
export * from './utils/errors.js';
|
|
28
|
+
export * from './utils/getFolderStructure.js';
|
|
29
|
+
export * from './utils/memoryDiscovery.js';
|
|
30
|
+
export * from './utils/gitIgnoreParser.js';
|
|
31
|
+
export * from './utils/gitUtils.js';
|
|
32
|
+
export * from './utils/editor.js';
|
|
33
|
+
export * from './utils/quotaErrorDetection.js';
|
|
34
|
+
export * from './utils/fileUtils.js';
|
|
35
|
+
export * from './utils/retry.js';
|
|
36
|
+
export * from './utils/shell-utils.js';
|
|
37
|
+
export * from './utils/systemEncoding.js';
|
|
38
|
+
export * from './utils/textUtils.js';
|
|
39
|
+
export * from './utils/formatters.js';
|
|
40
|
+
export * from './utils/generateContentResponseUtilities.js';
|
|
41
|
+
export * from './utils/filesearch/fileSearch.js';
|
|
42
|
+
export * from './utils/errorParsing.js';
|
|
43
|
+
export * from './utils/workspaceContext.js';
|
|
44
|
+
export * from './utils/ignorePatterns.js';
|
|
45
|
+
export * from './utils/partUtils.js';
|
|
46
|
+
// Export services
|
|
47
|
+
export * from './services/fileDiscoveryService.js';
|
|
48
|
+
export * from './services/gitService.js';
|
|
49
|
+
export * from './services/chatRecordingService.js';
|
|
50
|
+
export * from './services/fileSystemService.js';
|
|
51
|
+
// Export IDE specific logic
|
|
52
|
+
export * from './ide/ide-client.js';
|
|
53
|
+
export * from './ide/ideContext.js';
|
|
54
|
+
export * from './ide/ide-installer.js';
|
|
55
|
+
export { getIdeInfo, DetectedIde } from './ide/detect-ide.js';
|
|
56
|
+
export {} from './ide/detect-ide.js';
|
|
57
|
+
export * from './ide/constants.js';
|
|
58
|
+
// Export Shell Execution Service
|
|
59
|
+
export * from './services/shellExecutionService.js';
|
|
60
|
+
// Export base tool definitions
|
|
61
|
+
export * from './tools/tools.js';
|
|
62
|
+
export * from './tools/tool-error.js';
|
|
63
|
+
export * from './tools/tool-registry.js';
|
|
64
|
+
// Export prompt logic
|
|
65
|
+
export * from './prompts/mcp-prompts.js';
|
|
66
|
+
// Export specific tool logic
|
|
67
|
+
export * from './tools/read-file.js';
|
|
68
|
+
export * from './tools/ls.js';
|
|
69
|
+
export * from './tools/grep.js';
|
|
70
|
+
export * from './tools/ripGrep.js';
|
|
71
|
+
export * from './tools/glob.js';
|
|
72
|
+
export * from './tools/edit.js';
|
|
73
|
+
export * from './tools/write-file.js';
|
|
74
|
+
export * from './tools/web-fetch.js';
|
|
75
|
+
export * from './tools/memoryTool.js';
|
|
76
|
+
export * from './tools/shell.js';
|
|
77
|
+
export * from './tools/web-search.js';
|
|
78
|
+
export * from './tools/read-many-files.js';
|
|
79
|
+
export * from './tools/mcp-client.js';
|
|
80
|
+
export * from './tools/mcp-tool.js';
|
|
81
|
+
// MCP OAuth
|
|
82
|
+
export { MCPOAuthProvider } from './mcp/oauth-provider.js';
|
|
83
|
+
export { MCPOAuthTokenStorage } from './mcp/oauth-token-storage.js';
|
|
84
|
+
export { OAuthUtils } from './mcp/oauth-utils.js';
|
|
85
|
+
// Export telemetry functions
|
|
86
|
+
export * from './telemetry/index.js';
|
|
87
|
+
export { sessionId } from './utils/session.js';
|
|
88
|
+
export * from './utils/browser.js';
|
|
89
|
+
export { Storage } from './config/storage.js';
|
|
90
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,gBAAgB;AAChB,cAAc,oBAAoB,CAAC;AAEnC,oBAAoB;AACpB,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mCAAmC,CAAC;AAClD,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc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BAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AAEzC,sBAAsB;AACtB,cAAc,0BAA0B,CAAC;AAEzC,6BAA6B;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AAEpC,YAAY;AACZ,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAK3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAMpE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,6BAA6B;AAC7B,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { describe, it, expect } from 'vitest';
|
|
7
|
+
describe('placeholder tests', () => {
|
|
8
|
+
it('should pass', () => {
|
|
9
|
+
expect(true).toBe(true);
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=index.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../src/index.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE9C,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,EAAE,CAAC,aAAa,EAAE,GAAG,EAAE;QACrB,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js';
|
|
7
|
+
import type { OAuthClientInformation, OAuthClientInformationFull, OAuthClientMetadata, OAuthTokens } from '@modelcontextprotocol/sdk/shared/auth.js';
|
|
8
|
+
import type { MCPServerConfig } from '../config/config.js';
|
|
9
|
+
export declare class GoogleCredentialProvider implements OAuthClientProvider {
|
|
10
|
+
private readonly config?;
|
|
11
|
+
private readonly auth;
|
|
12
|
+
readonly redirectUrl = "";
|
|
13
|
+
readonly clientMetadata: OAuthClientMetadata;
|
|
14
|
+
private _clientInformation?;
|
|
15
|
+
constructor(config?: MCPServerConfig | undefined);
|
|
16
|
+
clientInformation(): OAuthClientInformation | undefined;
|
|
17
|
+
saveClientInformation(clientInformation: OAuthClientInformationFull): void;
|
|
18
|
+
tokens(): Promise<OAuthTokens | undefined>;
|
|
19
|
+
saveTokens(_tokens: OAuthTokens): void;
|
|
20
|
+
redirectToAuthorization(_authorizationUrl: URL): void;
|
|
21
|
+
saveCodeVerifier(_codeVerifier: string): void;
|
|
22
|
+
codeVerifier(): string;
|
|
23
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { GoogleAuth } from 'google-auth-library';
|
|
7
|
+
const ALLOWED_HOSTS = [/^.+\.googleapis\.com$/, /^(.*\.)?luci\.app$/];
|
|
8
|
+
export class GoogleCredentialProvider {
|
|
9
|
+
config;
|
|
10
|
+
auth;
|
|
11
|
+
// Properties required by OAuthClientProvider, with no-op values
|
|
12
|
+
redirectUrl = '';
|
|
13
|
+
clientMetadata = {
|
|
14
|
+
client_name: 'Gemini CLI (Google ADC)',
|
|
15
|
+
redirect_uris: [],
|
|
16
|
+
grant_types: [],
|
|
17
|
+
response_types: [],
|
|
18
|
+
token_endpoint_auth_method: 'none',
|
|
19
|
+
};
|
|
20
|
+
_clientInformation;
|
|
21
|
+
constructor(config) {
|
|
22
|
+
this.config = config;
|
|
23
|
+
const url = this.config?.url || this.config?.httpUrl;
|
|
24
|
+
if (!url) {
|
|
25
|
+
throw new Error('URL must be provided in the config for Google Credentials provider');
|
|
26
|
+
}
|
|
27
|
+
const hostname = new URL(url).hostname;
|
|
28
|
+
if (!ALLOWED_HOSTS.some((pattern) => pattern.test(hostname))) {
|
|
29
|
+
throw new Error(`Host "${hostname}" is not an allowed host for Google Credential provider.`);
|
|
30
|
+
}
|
|
31
|
+
const scopes = this.config?.oauth?.scopes;
|
|
32
|
+
if (!scopes || scopes.length === 0) {
|
|
33
|
+
throw new Error('Scopes must be provided in the oauth config for Google Credentials provider');
|
|
34
|
+
}
|
|
35
|
+
this.auth = new GoogleAuth({
|
|
36
|
+
scopes,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
clientInformation() {
|
|
40
|
+
return this._clientInformation;
|
|
41
|
+
}
|
|
42
|
+
saveClientInformation(clientInformation) {
|
|
43
|
+
this._clientInformation = clientInformation;
|
|
44
|
+
}
|
|
45
|
+
async tokens() {
|
|
46
|
+
const client = await this.auth.getClient();
|
|
47
|
+
const accessTokenResponse = await client.getAccessToken();
|
|
48
|
+
if (!accessTokenResponse.token) {
|
|
49
|
+
console.error('Failed to get access token from Google ADC');
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
const tokens = {
|
|
53
|
+
access_token: accessTokenResponse.token,
|
|
54
|
+
token_type: 'Bearer',
|
|
55
|
+
};
|
|
56
|
+
return tokens;
|
|
57
|
+
}
|
|
58
|
+
saveTokens(_tokens) {
|
|
59
|
+
// No-op, ADC manages tokens.
|
|
60
|
+
}
|
|
61
|
+
redirectToAuthorization(_authorizationUrl) {
|
|
62
|
+
// No-op
|
|
63
|
+
}
|
|
64
|
+
saveCodeVerifier(_codeVerifier) {
|
|
65
|
+
// No-op
|
|
66
|
+
}
|
|
67
|
+
codeVerifier() {
|
|
68
|
+
// No-op
|
|
69
|
+
return '';
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=google-auth-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google-auth-provider.js","sourceRoot":"","sources":["../../../src/mcp/google-auth-provider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGjD,MAAM,aAAa,GAAG,CAAC,uBAAuB,EAAE,oBAAoB,CAAC,CAAC;AAEtE,MAAM,OAAO,wBAAwB;IAcN;IAbZ,IAAI,CAAa;IAElC,gEAAgE;IACvD,WAAW,GAAG,EAAE,CAAC;IACjB,cAAc,GAAwB;QAC7C,WAAW,EAAE,yBAAyB;QACtC,aAAa,EAAE,EAAE;QACjB,WAAW,EAAE,EAAE;QACf,cAAc,EAAE,EAAE;QAClB,0BAA0B,EAAE,MAAM;KACnC,CAAC;IACM,kBAAkB,CAA8B;IAExD,YAA6B,MAAwB;QAAxB,WAAM,GAAN,MAAM,CAAkB;QACnD,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC;QACrD,IAAI,C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,CAAC;IAED,UAAU,CAAC,OAAoB;QAC7B,6BAA6B;IAC/B,CAAC;IAED,uBAAuB,CAAC,iBAAsB;QAC5C,QAAQ;IACV,CAAC;IAED,gBAAgB,CAAC,aAAqB;QACpC,QAAQ;IACV,CAAC;IAED,YAAY;QACV,QAAQ;QACR,OAAO,EAAE,CAAC;IACZ,CAAC;CACF"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { GoogleAuth } from 'google-auth-library';
|
|
7
|
+
import { GoogleCredentialProvider } from './google-auth-provider.js';
|
|
8
|
+
import { vi, describe, beforeEach, it, expect } from 'vitest';
|
|
9
|
+
vi.mock('google-auth-library');
|
|
10
|
+
describe('GoogleCredentialProvider', () => {
|
|
11
|
+
const validConfig = {
|
|
12
|
+
url: 'https://test.googleapis.com',
|
|
13
|
+
oauth: {
|
|
14
|
+
scopes: ['scope1', 'scope2'],
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
it('should throw an error if no scopes are provided', () => {
|
|
18
|
+
const config = {
|
|
19
|
+
url: 'https://test.googleapis.com',
|
|
20
|
+
};
|
|
21
|
+
expect(() => new GoogleCredentialProvider(config)).toThrow('Scopes must be provided in the oauth config for Google Credentials provider');
|
|
22
|
+
});
|
|
23
|
+
it('should use scopes from the config if provided', () => {
|
|
24
|
+
new GoogleCredentialProvider(validConfig);
|
|
25
|
+
expect(GoogleAuth).toHaveBeenCalledWith({
|
|
26
|
+
scopes: ['scope1', 'scope2'],
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
it('should throw an error for a non-allowlisted host', () => {
|
|
30
|
+
const config = {
|
|
31
|
+
url: 'https://example.com',
|
|
32
|
+
oauth: {
|
|
33
|
+
scopes: ['scope1', 'scope2'],
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
expect(() => new GoogleCredentialProvider(config)).toThrow('Host "example.com" is not an allowed host for Google Credential provider.');
|
|
37
|
+
});
|
|
38
|
+
it('should allow luci.app', () => {
|
|
39
|
+
const config = {
|
|
40
|
+
url: 'https://luci.app',
|
|
41
|
+
oauth: {
|
|
42
|
+
scopes: ['scope1', 'scope2'],
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
new GoogleCredentialProvider(config);
|
|
46
|
+
});
|
|
47
|
+
it('should allow sub.luci.app', () => {
|
|
48
|
+
const config = {
|
|
49
|
+
url: 'https://sub.luci.app',
|
|
50
|
+
oauth: {
|
|
51
|
+
scopes: ['scope1', 'scope2'],
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
new GoogleCredentialProvider(config);
|
|
55
|
+
});
|
|
56
|
+
it('should not allow googleapis.com without a subdomain', () => {
|
|
57
|
+
const config = {
|
|
58
|
+
url: 'https://googleapis.com',
|
|
59
|
+
oauth: {
|
|
60
|
+
scopes: ['scope1', 'scope2'],
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
expect(() => new GoogleCredentialProvider(config)).toThrow('Host "googleapis.com" is not an allowed host for Google Credential provider.');
|
|
64
|
+
});
|
|
65
|
+
describe('with provider instance', () => {
|
|
66
|
+
let provider;
|
|
67
|
+
beforeEach(() => {
|
|
68
|
+
provider = new GoogleCredentialProvider(validConfig);
|
|
69
|
+
vi.clearAllMocks();
|
|
70
|
+
});
|
|
71
|
+
it('should return credentials', async () => {
|
|
72
|
+
const mockClient = {
|
|
73
|
+
getAccessToken: vi.fn().mockResolvedValue({ token: 'test-token' }),
|
|
74
|
+
};
|
|
75
|
+
GoogleAuth.prototype.getClient.mockResolvedValue(mockClient);
|
|
76
|
+
const credentials = await provider.tokens();
|
|
77
|
+
expect(credentials?.access_token).toBe('test-token');
|
|
78
|
+
});
|
|
79
|
+
it('should return undefined if access token is not available', async () => {
|
|
80
|
+
const mockClient = {
|
|
81
|
+
getAccessToken: vi.fn().mockResolvedValue({ token: null }),
|
|
82
|
+
};
|
|
83
|
+
GoogleAuth.prototype.getClient.mockResolvedValue(mockClient);
|
|
84
|
+
const credentials = await provider.tokens();
|
|
85
|
+
expect(credentials).toBeUndefined();
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
//# sourceMappingURL=google-auth-provider.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google-auth-provider.test.js","sourceRoot":"","sources":["../../../src/mcp/google-auth-provider.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAG9D,EAAE,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;AAE/B,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,MAAM,WAAW,GAAG;QAClB,GAAG,EAAE,6BAA6B;QAClC,KAAK,EAAE;YACL,MAAM,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;SAC7B;KACiB,CAAC;IAErB,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QACzD,MAAM,MAAM,GAAG;YACb,GAAG,EAAE,6BAA6B;SAChB,CAAC;QACrB,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,wBAAwB,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CACxD,6EAA6E,CAC9E,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACvD,IAAI,wBAAwB,CAAC,WAAW,CAAC,CAAC;QAC1C,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,CAAC;YACtC,MAAM,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;SA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';
|
|
7
|
+
/**
|
|
8
|
+
* OAuth configuration for an MCP server.
|
|
9
|
+
*/
|
|
10
|
+
export interface MCPOAuthConfig {
|
|
11
|
+
enabled?: boolean;
|
|
12
|
+
clientId?: string;
|
|
13
|
+
clientSecret?: string;
|
|
14
|
+
authorizationUrl?: string;
|
|
15
|
+
tokenUrl?: string;
|
|
16
|
+
scopes?: string[];
|
|
17
|
+
audiences?: string[];
|
|
18
|
+
redirectUri?: string;
|
|
19
|
+
tokenParamName?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* OAuth authorization response.
|
|
23
|
+
*/
|
|
24
|
+
export interface OAuthAuthorizationResponse {
|
|
25
|
+
code: string;
|
|
26
|
+
state: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* OAuth token response from the authorization server.
|
|
30
|
+
*/
|
|
31
|
+
export interface OAuthTokenResponse {
|
|
32
|
+
access_token: string;
|
|
33
|
+
token_type: string;
|
|
34
|
+
expires_in?: number;
|
|
35
|
+
refresh_token?: string;
|
|
36
|
+
scope?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Dynamic client registration request.
|
|
40
|
+
*/
|
|
41
|
+
export interface OAuthClientRegistrationRequest {
|
|
42
|
+
client_name: string;
|
|
43
|
+
redirect_uris: string[];
|
|
44
|
+
grant_types: string[];
|
|
45
|
+
response_types: string[];
|
|
46
|
+
token_endpoint_auth_method: string;
|
|
47
|
+
code_challenge_method?: string[];
|
|
48
|
+
scope?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Dynamic client registration response.
|
|
52
|
+
*/
|
|
53
|
+
export interface OAuthClientRegistrationResponse {
|
|
54
|
+
client_id: string;
|
|
55
|
+
client_secret?: string;
|
|
56
|
+
client_id_issued_at?: number;
|
|
57
|
+
client_secret_expires_at?: number;
|
|
58
|
+
redirect_uris: string[];
|
|
59
|
+
grant_types: string[];
|
|
60
|
+
response_types: string[];
|
|
61
|
+
token_endpoint_auth_method: string;
|
|
62
|
+
code_challenge_method?: string[];
|
|
63
|
+
scope?: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Provider for handling OAuth authentication for MCP servers.
|
|
67
|
+
*/
|
|
68
|
+
export declare class MCPOAuthProvider {
|
|
69
|
+
private static readonly REDIRECT_PORT;
|
|
70
|
+
private static readonly REDIRECT_PATH;
|
|
71
|
+
private static readonly HTTP_OK;
|
|
72
|
+
/**
|
|
73
|
+
* Register a client dynamically with the OAuth server.
|
|
74
|
+
*
|
|
75
|
+
* @param registrationUrl The client registration endpoint URL
|
|
76
|
+
* @param config OAuth configuration
|
|
77
|
+
* @returns The registered client information
|
|
78
|
+
*/
|
|
79
|
+
private static registerClient;
|
|
80
|
+
/**
|
|
81
|
+
* Discover OAuth configuration from an MCP server URL.
|
|
82
|
+
*
|
|
83
|
+
* @param mcpServerUrl The MCP server URL
|
|
84
|
+
* @returns OAuth configuration if discovered, null otherwise
|
|
85
|
+
*/
|
|
86
|
+
private static discoverOAuthFromMCPServer;
|
|
87
|
+
/**
|
|
88
|
+
* Generate PKCE parameters for OAuth flow.
|
|
89
|
+
*
|
|
90
|
+
* @returns PKCE parameters including code verifier, challenge, and state
|
|
91
|
+
*/
|
|
92
|
+
private static generatePKCEParams;
|
|
93
|
+
/**
|
|
94
|
+
* Start a local HTTP server to handle OAuth callback.
|
|
95
|
+
*
|
|
96
|
+
* @param expectedState The state parameter to validate
|
|
97
|
+
* @returns Promise that resolves with the authorization code
|
|
98
|
+
*/
|
|
99
|
+
private static startCallbackServer;
|
|
100
|
+
/**
|
|
101
|
+
* Build the authorization URL with PKCE parameters.
|
|
102
|
+
*
|
|
103
|
+
* @param config OAuth configuration
|
|
104
|
+
* @param pkceParams PKCE parameters
|
|
105
|
+
* @param mcpServerUrl The MCP server URL to use as the resource parameter
|
|
106
|
+
* @returns The authorization URL
|
|
107
|
+
*/
|
|
108
|
+
private static buildAuthorizationUrl;
|
|
109
|
+
/**
|
|
110
|
+
* Exchange authorization code for tokens.
|
|
111
|
+
*
|
|
112
|
+
* @param config OAuth configuration
|
|
113
|
+
* @param code Authorization code
|
|
114
|
+
* @param codeVerifier PKCE code verifier
|
|
115
|
+
* @param mcpServerUrl The MCP server URL to use as the resource parameter
|
|
116
|
+
* @returns The token response
|
|
117
|
+
*/
|
|
118
|
+
private static exchangeCodeForToken;
|
|
119
|
+
/**
|
|
120
|
+
* Refresh an access token using a refresh token.
|
|
121
|
+
*
|
|
122
|
+
* @param config OAuth configuration
|
|
123
|
+
* @param refreshToken The refresh token
|
|
124
|
+
* @param tokenUrl The token endpoint URL
|
|
125
|
+
* @param mcpServerUrl The MCP server URL to use as the resource parameter
|
|
126
|
+
* @returns The new token response
|
|
127
|
+
*/
|
|
128
|
+
static refreshAccessToken(config: MCPOAuthConfig, refreshToken: string, tokenUrl: string, mcpServerUrl?: string): Promise<OAuthTokenResponse>;
|
|
129
|
+
/**
|
|
130
|
+
* Perform the full OAuth authorization code flow with PKCE.
|
|
131
|
+
*
|
|
132
|
+
* @param serverName The name of the MCP server
|
|
133
|
+
* @param config OAuth configuration
|
|
134
|
+
* @param mcpServerUrl Optional MCP server URL for OAuth discovery
|
|
135
|
+
* @returns The obtained OAuth token
|
|
136
|
+
*/
|
|
137
|
+
static authenticate(serverName: string, config: MCPOAuthConfig, mcpServerUrl?: string): Promise<OAuthToken>;
|
|
138
|
+
/**
|
|
139
|
+
* Get a valid access token for an MCP server, refreshing if necessary.
|
|
140
|
+
*
|
|
141
|
+
* @param serverName The name of the MCP server
|
|
142
|
+
* @param config OAuth configuration
|
|
143
|
+
* @returns A valid access token or null if not authenticated
|
|
144
|
+
*/
|
|
145
|
+
static getValidToken(serverName: string, config: MCPOAuthConfig): Promise<string | null>;
|
|
146
|
+
}
|