@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,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
/**
|
|
8
|
+
* Zod schema for validating a file context from the IDE.
|
|
9
|
+
*/
|
|
10
|
+
export const FileSchema = z.object({
|
|
11
|
+
path: z.string(),
|
|
12
|
+
timestamp: z.number(),
|
|
13
|
+
isActive: z.boolean().optional(),
|
|
14
|
+
selectedText: z.string().optional(),
|
|
15
|
+
cursor: z
|
|
16
|
+
.object({
|
|
17
|
+
line: z.number(),
|
|
18
|
+
character: z.number(),
|
|
19
|
+
})
|
|
20
|
+
.optional(),
|
|
21
|
+
});
|
|
22
|
+
export const IdeContextSchema = z.object({
|
|
23
|
+
workspaceState: z
|
|
24
|
+
.object({
|
|
25
|
+
openFiles: z.array(FileSchema).optional(),
|
|
26
|
+
})
|
|
27
|
+
.optional(),
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* Zod schema for validating the 'ide/contextUpdate' notification from the IDE.
|
|
31
|
+
*/
|
|
32
|
+
export const IdeContextNotificationSchema = z.object({
|
|
33
|
+
jsonrpc: z.literal('2.0'),
|
|
34
|
+
method: z.literal('ide/contextUpdate'),
|
|
35
|
+
params: IdeContextSchema,
|
|
36
|
+
});
|
|
37
|
+
export const IdeDiffAcceptedNotificationSchema = z.object({
|
|
38
|
+
jsonrpc: z.literal('2.0'),
|
|
39
|
+
method: z.literal('ide/diffAccepted'),
|
|
40
|
+
params: z.object({
|
|
41
|
+
filePath: z.string(),
|
|
42
|
+
content: z.string(),
|
|
43
|
+
}),
|
|
44
|
+
});
|
|
45
|
+
export const IdeDiffClosedNotificationSchema = z.object({
|
|
46
|
+
jsonrpc: z.literal('2.0'),
|
|
47
|
+
method: z.literal('ide/diffClosed'),
|
|
48
|
+
params: z.object({
|
|
49
|
+
filePath: z.string(),
|
|
50
|
+
content: z.string().optional(),
|
|
51
|
+
}),
|
|
52
|
+
});
|
|
53
|
+
export const CloseDiffResponseSchema = z
|
|
54
|
+
.object({
|
|
55
|
+
content: z
|
|
56
|
+
.array(z.object({
|
|
57
|
+
text: z.string(),
|
|
58
|
+
type: z.literal('text'),
|
|
59
|
+
}))
|
|
60
|
+
.min(1),
|
|
61
|
+
})
|
|
62
|
+
.transform((val, ctx) => {
|
|
63
|
+
try {
|
|
64
|
+
const parsed = JSON.parse(val.content[0].text);
|
|
65
|
+
const innerSchema = z.object({ content: z.string().optional() });
|
|
66
|
+
const validationResult = innerSchema.safeParse(parsed);
|
|
67
|
+
if (!validationResult.success) {
|
|
68
|
+
validationResult.error.issues.forEach((issue) => ctx.addIssue(issue));
|
|
69
|
+
return z.NEVER;
|
|
70
|
+
}
|
|
71
|
+
return validationResult.data;
|
|
72
|
+
}
|
|
73
|
+
catch (_) {
|
|
74
|
+
ctx.addIssue({
|
|
75
|
+
code: z.ZodIssueCode.custom,
|
|
76
|
+
message: 'Invalid JSON in text content',
|
|
77
|
+
});
|
|
78
|
+
return z.NEVER;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
/**
|
|
82
|
+
* Creates a new store for managing the IDE's context.
|
|
83
|
+
* This factory function encapsulates the state and logic, allowing for the creation
|
|
84
|
+
* of isolated instances, which is particularly useful for testing.
|
|
85
|
+
*
|
|
86
|
+
* @returns An object with methods to interact with the IDE context.
|
|
87
|
+
*/
|
|
88
|
+
export function createIdeContextStore() {
|
|
89
|
+
let ideContextState = undefined;
|
|
90
|
+
const subscribers = new Set();
|
|
91
|
+
/**
|
|
92
|
+
* Notifies all registered subscribers about the current IDE context.
|
|
93
|
+
*/
|
|
94
|
+
function notifySubscribers() {
|
|
95
|
+
for (const subscriber of subscribers) {
|
|
96
|
+
subscriber(ideContextState);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Sets the IDE context and notifies all registered subscribers of the change.
|
|
101
|
+
* @param newIdeContext The new IDE context from the IDE.
|
|
102
|
+
*/
|
|
103
|
+
function setIdeContext(newIdeContext) {
|
|
104
|
+
ideContextState = newIdeContext;
|
|
105
|
+
notifySubscribers();
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Clears the IDE context and notifies all registered subscribers of the change.
|
|
109
|
+
*/
|
|
110
|
+
function clearIdeContext() {
|
|
111
|
+
ideContextState = undefined;
|
|
112
|
+
notifySubscribers();
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Retrieves the current IDE context.
|
|
116
|
+
* @returns The `IdeContext` object if a file is active; otherwise, `undefined`.
|
|
117
|
+
*/
|
|
118
|
+
function getIdeContext() {
|
|
119
|
+
return ideContextState;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Subscribes to changes in the IDE context.
|
|
123
|
+
*
|
|
124
|
+
* When the IDE context changes, the provided `subscriber` function will be called.
|
|
125
|
+
* Note: The subscriber is not called with the current value upon subscription.
|
|
126
|
+
*
|
|
127
|
+
* @param subscriber The function to be called when the IDE context changes.
|
|
128
|
+
* @returns A function that, when called, will unsubscribe the provided subscriber.
|
|
129
|
+
*/
|
|
130
|
+
function subscribeToIdeContext(subscriber) {
|
|
131
|
+
subscribers.add(subscriber);
|
|
132
|
+
return () => {
|
|
133
|
+
subscribers.delete(subscriber);
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
setIdeContext,
|
|
138
|
+
getIdeContext,
|
|
139
|
+
subscribeToIdeContext,
|
|
140
|
+
clearIdeContext,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* The default, shared instance of the IDE context store for the application.
|
|
145
|
+
*/
|
|
146
|
+
export const ideContext = createIdeContextStore();
|
|
147
|
+
//# sourceMappingURL=ideContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ideContext.js","sourceRoot":"","sources":["../../../src/ide/ideContext.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAChC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,MAAM,EAAE,CAAC;SACN,MAAM,CAAC;QACN,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;KACtB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;IAEpD;;OAEG;IACH,SAAS,iBAAiB;QACxB,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;YACrC,UAAU,CAAC,eAAe,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,SAAS,aAAa,CAAC,aAAyB;QAC9C,eAAe,GAAG,aAAa,CAAC;QAChC,iBAAiB,EAAE,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,SAAS,eAAe;QACtB,eAAe,GAAG,SAAS,CAAC;QAC5B,iBAAiB,EAAE,CAAC;IACtB,CAAC;IAED;;;OAGG;IACH,SAAS,aAAa;QACpB,OAAO,eAAe,CAAC;IACzB,CAAC;IAED;;;;;;;;OAQG;IACH,SAAS,qBAAqB,CAAC,UAAgC;QAC7D,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC5B,OAAO,GAAG,EAAE;YACV,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACjC,CAAC,CAAC;IACJ,CAAC;IAED,OAAO;QACL,aAAa;QACb,aAAa;QACb,qBAAqB;QACrB,eAAe;KAChB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,qBAAqB,EAAE,CAAC"}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
|
7
|
+
import { createIdeContextStore, FileSchema, IdeContextSchema, } from './ideContext.js';
|
|
8
|
+
describe('ideContext', () => {
|
|
9
|
+
describe('createIdeContextStore', () => {
|
|
10
|
+
let ideContext;
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
// Create a fresh, isolated instance for each test
|
|
13
|
+
ideContext = createIdeContextStore();
|
|
14
|
+
});
|
|
15
|
+
it('should return undefined initially for ide context', () => {
|
|
16
|
+
expect(ideContext.getIdeContext()).toBeUndefined();
|
|
17
|
+
});
|
|
18
|
+
it('should set and retrieve the ide context', () => {
|
|
19
|
+
const testFile = {
|
|
20
|
+
workspaceState: {
|
|
21
|
+
openFiles: [
|
|
22
|
+
{
|
|
23
|
+
path: '/path/to/test/file.ts',
|
|
24
|
+
isActive: true,
|
|
25
|
+
selectedText: '1234',
|
|
26
|
+
timestamp: 0,
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
ideContext.setIdeContext(testFile);
|
|
32
|
+
const activeFile = ideContext.getIdeContext();
|
|
33
|
+
expect(activeFile).toEqual(testFile);
|
|
34
|
+
});
|
|
35
|
+
it('should update the ide context when called multiple times', () => {
|
|
36
|
+
const firstFile = {
|
|
37
|
+
workspaceState: {
|
|
38
|
+
openFiles: [
|
|
39
|
+
{
|
|
40
|
+
path: '/path/to/first.js',
|
|
41
|
+
isActive: true,
|
|
42
|
+
selectedText: '1234',
|
|
43
|
+
timestamp: 0,
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
ideContext.setIdeContext(firstFile);
|
|
49
|
+
const secondFile = {
|
|
50
|
+
workspaceState: {
|
|
51
|
+
openFiles: [
|
|
52
|
+
{
|
|
53
|
+
path: '/path/to/second.py',
|
|
54
|
+
isActive: true,
|
|
55
|
+
cursor: { line: 20, character: 30 },
|
|
56
|
+
timestamp: 0,
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
ideContext.setIdeContext(secondFile);
|
|
62
|
+
const activeFile = ideContext.getIdeContext();
|
|
63
|
+
expect(activeFile).toEqual(secondFile);
|
|
64
|
+
});
|
|
65
|
+
it('should handle empty string for file path', () => {
|
|
66
|
+
const testFile = {
|
|
67
|
+
workspaceState: {
|
|
68
|
+
openFiles: [
|
|
69
|
+
{
|
|
70
|
+
path: '',
|
|
71
|
+
isActive: true,
|
|
72
|
+
selectedText: '1234',
|
|
73
|
+
timestamp: 0,
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
ideContext.setIdeContext(testFile);
|
|
79
|
+
expect(ideContext.getIdeContext()).toEqual(testFile);
|
|
80
|
+
});
|
|
81
|
+
it('should notify subscribers when ide context changes', () => {
|
|
82
|
+
const subscriber1 = vi.fn();
|
|
83
|
+
const subscriber2 = vi.fn();
|
|
84
|
+
ideContext.subscribeToIdeContext(subscriber1);
|
|
85
|
+
ideContext.subscribeToIdeContext(subscriber2);
|
|
86
|
+
const testFile = {
|
|
87
|
+
workspaceState: {
|
|
88
|
+
openFiles: [
|
|
89
|
+
{
|
|
90
|
+
path: '/path/to/subscribed.ts',
|
|
91
|
+
isActive: true,
|
|
92
|
+
cursor: { line: 15, character: 25 },
|
|
93
|
+
timestamp: 0,
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
ideContext.setIdeContext(testFile);
|
|
99
|
+
expect(subscriber1).toHaveBeenCalledTimes(1);
|
|
100
|
+
expect(subscriber1).toHaveBeenCalledWith(testFile);
|
|
101
|
+
expect(subscriber2).toHaveBeenCalledTimes(1);
|
|
102
|
+
expect(subscriber2).toHaveBeenCalledWith(testFile);
|
|
103
|
+
// Test with another update
|
|
104
|
+
const newFile = {
|
|
105
|
+
workspaceState: {
|
|
106
|
+
openFiles: [
|
|
107
|
+
{
|
|
108
|
+
path: '/path/to/new.js',
|
|
109
|
+
isActive: true,
|
|
110
|
+
selectedText: '1234',
|
|
111
|
+
timestamp: 0,
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
ideContext.setIdeContext(newFile);
|
|
117
|
+
expect(subscriber1).toHaveBeenCalledTimes(2);
|
|
118
|
+
expect(subscriber1).toHaveBeenCalledWith(newFile);
|
|
119
|
+
expect(subscriber2).toHaveBeenCalledTimes(2);
|
|
120
|
+
expect(subscriber2).toHaveBeenCalledWith(newFile);
|
|
121
|
+
});
|
|
122
|
+
it('should stop notifying a subscriber after unsubscribe', () => {
|
|
123
|
+
const subscriber1 = vi.fn();
|
|
124
|
+
const subscriber2 = vi.fn();
|
|
125
|
+
const unsubscribe1 = ideContext.subscribeToIdeContext(subscriber1);
|
|
126
|
+
ideContext.subscribeToIdeContext(subscriber2);
|
|
127
|
+
ideContext.setIdeContext({
|
|
128
|
+
workspaceState: {
|
|
129
|
+
openFiles: [
|
|
130
|
+
{
|
|
131
|
+
path: '/path/to/file1.txt',
|
|
132
|
+
isActive: true,
|
|
133
|
+
selectedText: '1234',
|
|
134
|
+
timestamp: 0,
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
expect(subscriber1).toHaveBeenCalledTimes(1);
|
|
140
|
+
expect(subscriber2).toHaveBeenCalledTimes(1);
|
|
141
|
+
unsubscribe1();
|
|
142
|
+
ideContext.setIdeContext({
|
|
143
|
+
workspaceState: {
|
|
144
|
+
openFiles: [
|
|
145
|
+
{
|
|
146
|
+
path: '/path/to/file2.txt',
|
|
147
|
+
isActive: true,
|
|
148
|
+
selectedText: '1234',
|
|
149
|
+
timestamp: 0,
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
expect(subscriber1).toHaveBeenCalledTimes(1); // Should not be called again
|
|
155
|
+
expect(subscriber2).toHaveBeenCalledTimes(2);
|
|
156
|
+
});
|
|
157
|
+
it('should clear the ide context', () => {
|
|
158
|
+
const testFile = {
|
|
159
|
+
workspaceState: {
|
|
160
|
+
openFiles: [
|
|
161
|
+
{
|
|
162
|
+
path: '/path/to/test/file.ts',
|
|
163
|
+
isActive: true,
|
|
164
|
+
selectedText: '1234',
|
|
165
|
+
timestamp: 0,
|
|
166
|
+
},
|
|
167
|
+
],
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
ideContext.setIdeContext(testFile);
|
|
171
|
+
expect(ideContext.getIdeContext()).toEqual(testFile);
|
|
172
|
+
ideContext.clearIdeContext();
|
|
173
|
+
expect(ideContext.getIdeContext()).toBeUndefined();
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
describe('FileSchema', () => {
|
|
177
|
+
it('should validate a file with only required fields', () => {
|
|
178
|
+
const file = {
|
|
179
|
+
path: '/path/to/file.ts',
|
|
180
|
+
timestamp: 12345,
|
|
181
|
+
};
|
|
182
|
+
const result = FileSchema.safeParse(file);
|
|
183
|
+
expect(result.success).toBe(true);
|
|
184
|
+
});
|
|
185
|
+
it('should validate a file with all fields', () => {
|
|
186
|
+
const file = {
|
|
187
|
+
path: '/path/to/file.ts',
|
|
188
|
+
timestamp: 12345,
|
|
189
|
+
isActive: true,
|
|
190
|
+
selectedText: 'const x = 1;',
|
|
191
|
+
cursor: {
|
|
192
|
+
line: 10,
|
|
193
|
+
character: 20,
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
const result = FileSchema.safeParse(file);
|
|
197
|
+
expect(result.success).toBe(true);
|
|
198
|
+
});
|
|
199
|
+
it('should fail validation if path is missing', () => {
|
|
200
|
+
const file = {
|
|
201
|
+
timestamp: 12345,
|
|
202
|
+
};
|
|
203
|
+
const result = FileSchema.safeParse(file);
|
|
204
|
+
expect(result.success).toBe(false);
|
|
205
|
+
});
|
|
206
|
+
it('should fail validation if timestamp is missing', () => {
|
|
207
|
+
const file = {
|
|
208
|
+
path: '/path/to/file.ts',
|
|
209
|
+
};
|
|
210
|
+
const result = FileSchema.safeParse(file);
|
|
211
|
+
expect(result.success).toBe(false);
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
describe('IdeContextSchema', () => {
|
|
215
|
+
it('should validate an empty context', () => {
|
|
216
|
+
const context = {};
|
|
217
|
+
const result = IdeContextSchema.safeParse(context);
|
|
218
|
+
expect(result.success).toBe(true);
|
|
219
|
+
});
|
|
220
|
+
it('should validate a context with an empty workspaceState', () => {
|
|
221
|
+
const context = {
|
|
222
|
+
workspaceState: {},
|
|
223
|
+
};
|
|
224
|
+
const result = IdeContextSchema.safeParse(context);
|
|
225
|
+
expect(result.success).toBe(true);
|
|
226
|
+
});
|
|
227
|
+
it('should validate a context with an empty openFiles array', () => {
|
|
228
|
+
const context = {
|
|
229
|
+
workspaceState: {
|
|
230
|
+
openFiles: [],
|
|
231
|
+
},
|
|
232
|
+
};
|
|
233
|
+
const result = IdeContextSchema.safeParse(context);
|
|
234
|
+
expect(result.success).toBe(true);
|
|
235
|
+
});
|
|
236
|
+
it('should validate a context with a valid file', () => {
|
|
237
|
+
const context = {
|
|
238
|
+
workspaceState: {
|
|
239
|
+
openFiles: [
|
|
240
|
+
{
|
|
241
|
+
path: '/path/to/file.ts',
|
|
242
|
+
timestamp: 12345,
|
|
243
|
+
},
|
|
244
|
+
],
|
|
245
|
+
},
|
|
246
|
+
};
|
|
247
|
+
const result = IdeContextSchema.safeParse(context);
|
|
248
|
+
expect(result.success).toBe(true);
|
|
249
|
+
});
|
|
250
|
+
it('should fail validation with an invalid file', () => {
|
|
251
|
+
const context = {
|
|
252
|
+
workspaceState: {
|
|
253
|
+
openFiles: [
|
|
254
|
+
{
|
|
255
|
+
timestamp: 12345, // path is missing
|
|
256
|
+
},
|
|
257
|
+
],
|
|
258
|
+
},
|
|
259
|
+
};
|
|
260
|
+
const result = IdeContextSchema.safeParse(context);
|
|
261
|
+
expect(result.success).toBe(false);
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
});
|
|
265
|
+
//# sourceMappingURL=ideContext.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ideContext.test.js","sourceRoot":"","sources":["../../../src/ide/ideContext.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;A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YACF,MAAM,MAAM,GAAG,gBAAgB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;YACnD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;YACrD,MAAM,OAAO,GAAG;gBACd,cAAc,EAAE;oBACd,SAAS,EAAE;wBACT;4BACE,SAAS,EAAE,KAAK,EAAE,kBAAkB;yBACrC;qBACF;iBACF;aACF,CAAC;YACF,MAAM,MAAM,GAAG,gBAAgB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;YACnD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Traverses up the process tree to find the process ID and command of the IDE.
|
|
8
|
+
*
|
|
9
|
+
* This function uses different strategies depending on the operating system
|
|
10
|
+
* to identify the main application process (e.g., the main VS Code window
|
|
11
|
+
* process).
|
|
12
|
+
*
|
|
13
|
+
* If the IDE process cannot be reliably identified, it will return the
|
|
14
|
+
* top-level ancestor process ID and command as a fallback.
|
|
15
|
+
*
|
|
16
|
+
* @returns A promise that resolves to the PID and command of the IDE process.
|
|
17
|
+
* @throws Will throw an error if the underlying shell commands fail.
|
|
18
|
+
*/
|
|
19
|
+
export declare function getIdeProcessInfo(): Promise<{
|
|
20
|
+
pid: number;
|
|
21
|
+
command: string;
|
|
22
|
+
}>;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { exec } from 'node:child_process';
|
|
7
|
+
import { promisify } from 'node:util';
|
|
8
|
+
import os from 'node:os';
|
|
9
|
+
import path from 'node:path';
|
|
10
|
+
const execAsync = promisify(exec);
|
|
11
|
+
const MAX_TRAVERSAL_DEPTH = 32;
|
|
12
|
+
/**
|
|
13
|
+
* Fetches the parent process ID, name, and command for a given process ID.
|
|
14
|
+
*
|
|
15
|
+
* @param pid The process ID to inspect.
|
|
16
|
+
* @returns A promise that resolves to the parent's PID, name, and command.
|
|
17
|
+
*/
|
|
18
|
+
async function getProcessInfo(pid) {
|
|
19
|
+
const platform = os.platform();
|
|
20
|
+
if (platform === 'win32') {
|
|
21
|
+
const command = `wmic process where "ProcessId=${pid}" get Name,ParentProcessId,CommandLine /value`;
|
|
22
|
+
const { stdout } = await execAsync(command);
|
|
23
|
+
const nameMatch = stdout.match(/Name=([^\n]*)/);
|
|
24
|
+
const processName = nameMatch ? nameMatch[1].trim() : '';
|
|
25
|
+
const ppidMatch = stdout.match(/ParentProcessId=(\d+)/);
|
|
26
|
+
const parentPid = ppidMatch ? parseInt(ppidMatch[1], 10) : 0;
|
|
27
|
+
const commandLineMatch = stdout.match(/CommandLine=([^\n]*)/);
|
|
28
|
+
const commandLine = commandLineMatch ? commandLineMatch[1].trim() : '';
|
|
29
|
+
return { parentPid, name: processName, command: commandLine };
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
const command = `ps -o ppid=,command= -p ${pid}`;
|
|
33
|
+
const { stdout } = await execAsync(command);
|
|
34
|
+
const trimmedStdout = stdout.trim();
|
|
35
|
+
const ppidString = trimmedStdout.split(/\s+/)[0];
|
|
36
|
+
const parentPid = parseInt(ppidString, 10);
|
|
37
|
+
const fullCommand = trimmedStdout.substring(ppidString.length).trim();
|
|
38
|
+
const processName = path.basename(fullCommand.split(' ')[0]);
|
|
39
|
+
return {
|
|
40
|
+
parentPid: isNaN(parentPid) ? 1 : parentPid,
|
|
41
|
+
name: processName,
|
|
42
|
+
command: fullCommand,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Finds the IDE process info on Unix-like systems.
|
|
48
|
+
*
|
|
49
|
+
* The strategy is to find the shell process that spawned the CLI, and then
|
|
50
|
+
* find that shell's parent process (the IDE). To get the true IDE process,
|
|
51
|
+
* we traverse one level higher to get the grandparent.
|
|
52
|
+
*
|
|
53
|
+
* @returns A promise that resolves to the PID and command of the IDE process.
|
|
54
|
+
*/
|
|
55
|
+
async function getIdeProcessInfoForUnix() {
|
|
56
|
+
const shells = ['zsh', 'bash', 'sh', 'tcsh', 'csh', 'ksh', 'fish', 'dash'];
|
|
57
|
+
let currentPid = process.pid;
|
|
58
|
+
for (let i = 0; i < MAX_TRAVERSAL_DEPTH; i++) {
|
|
59
|
+
try {
|
|
60
|
+
const { parentPid, name } = await getProcessInfo(currentPid);
|
|
61
|
+
const isShell = shells.some((shell) => name === shell);
|
|
62
|
+
if (isShell) {
|
|
63
|
+
// The direct parent of the shell is often a utility process (e.g. VS
|
|
64
|
+
// Code's `ptyhost` process). To get the true IDE process, we need to
|
|
65
|
+
// traverse one level higher to get the grandparent.
|
|
66
|
+
let idePid = parentPid;
|
|
67
|
+
try {
|
|
68
|
+
const { parentPid: grandParentPid } = await getProcessInfo(parentPid);
|
|
69
|
+
if (grandParentPid > 1) {
|
|
70
|
+
idePid = grandParentPid;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
// Ignore if getting grandparent fails, we'll just use the parent pid.
|
|
75
|
+
}
|
|
76
|
+
const { command } = await getProcessInfo(idePid);
|
|
77
|
+
return { pid: idePid, command };
|
|
78
|
+
}
|
|
79
|
+
if (parentPid <= 1) {
|
|
80
|
+
break; // Reached the root
|
|
81
|
+
}
|
|
82
|
+
currentPid = parentPid;
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
// Process in chain died
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
const { command } = await getProcessInfo(currentPid);
|
|
90
|
+
return { pid: currentPid, command };
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Finds the IDE process info on Windows.
|
|
94
|
+
*
|
|
95
|
+
* The strategy is to find the great-grandchild of the root process.
|
|
96
|
+
*
|
|
97
|
+
* @returns A promise that resolves to the PID and command of the IDE process.
|
|
98
|
+
*/
|
|
99
|
+
async function getIdeProcessInfoForWindows() {
|
|
100
|
+
let currentPid = process.pid;
|
|
101
|
+
let previousPid = process.pid;
|
|
102
|
+
for (let i = 0; i < MAX_TRAVERSAL_DEPTH; i++) {
|
|
103
|
+
try {
|
|
104
|
+
const { parentPid } = await getProcessInfo(currentPid);
|
|
105
|
+
if (parentPid > 0) {
|
|
106
|
+
try {
|
|
107
|
+
const { parentPid: grandParentPid } = await getProcessInfo(parentPid);
|
|
108
|
+
if (grandParentPid === 0) {
|
|
109
|
+
// We've found the grandchild of the root (`currentPid`). The IDE
|
|
110
|
+
// process is its child, which we've stored in `previousPid`.
|
|
111
|
+
const { command } = await getProcessInfo(previousPid);
|
|
112
|
+
return { pid: previousPid, command };
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
// getting grandparent failed, proceed
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (parentPid <= 0) {
|
|
120
|
+
break; // Reached the root
|
|
121
|
+
}
|
|
122
|
+
previousPid = currentPid;
|
|
123
|
+
currentPid = parentPid;
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
// Process in chain died
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
const { command } = await getProcessInfo(currentPid);
|
|
131
|
+
return { pid: currentPid, command };
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Traverses up the process tree to find the process ID and command of the IDE.
|
|
135
|
+
*
|
|
136
|
+
* This function uses different strategies depending on the operating system
|
|
137
|
+
* to identify the main application process (e.g., the main VS Code window
|
|
138
|
+
* process).
|
|
139
|
+
*
|
|
140
|
+
* If the IDE process cannot be reliably identified, it will return the
|
|
141
|
+
* top-level ancestor process ID and command as a fallback.
|
|
142
|
+
*
|
|
143
|
+
* @returns A promise that resolves to the PID and command of the IDE process.
|
|
144
|
+
* @throws Will throw an error if the underlying shell commands fail.
|
|
145
|
+
*/
|
|
146
|
+
export async function getIdeProcessInfo() {
|
|
147
|
+
const platform = os.platform();
|
|
148
|
+
if (platform === 'win32') {
|
|
149
|
+
return getIdeProcessInfoForWindows();
|
|
150
|
+
}
|
|
151
|
+
return getIdeProcessInfoForUnix();
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=process-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-utils.js","sourceRoot":"","sources":["../../../src/ide/process-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAElC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAE/B;;;;;GAKG;AACH,KAAK,UAAU,cAAc,CAAC,GAAW;IAKvC,MAAM,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;IAC/B,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QACzB,MAAM,OAAO,GAAG,iCAAiC,GAAG,+CAA+C,CAAC;QACpG,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,CAAC;QAC5C,MAAM,SAAS,GAAG,MAAM,CAAC,KA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