@office-ai/aioncli-core 0.2.3 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +10 -3
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/dist/src/agents/codebase-investigator.d.ts +11 -0
- package/dist/src/agents/codebase-investigator.js +73 -0
- package/dist/src/agents/codebase-investigator.js.map +1 -0
- package/dist/src/agents/executor.d.ts +88 -0
- package/dist/src/agents/executor.js +417 -0
- package/dist/src/agents/executor.js.map +1 -0
- package/dist/src/agents/executor.test.js +419 -0
- package/dist/src/agents/executor.test.js.map +1 -0
- package/dist/src/agents/invocation.d.ts +43 -0
- package/dist/src/agents/invocation.js +100 -0
- package/dist/src/agents/invocation.js.map +1 -0
- package/dist/src/agents/invocation.test.js +206 -0
- package/dist/src/agents/invocation.test.js.map +1 -0
- package/dist/src/agents/registry.d.ts +35 -0
- package/dist/src/agents/registry.js +58 -0
- package/dist/src/agents/registry.js.map +1 -0
- package/dist/src/agents/registry.test.js +146 -0
- package/dist/src/agents/registry.test.js.map +1 -0
- package/dist/src/agents/schema-utils.d.ts +39 -0
- package/dist/src/agents/schema-utils.js +57 -0
- package/dist/src/agents/schema-utils.js.map +1 -0
- package/dist/src/agents/schema-utils.test.d.ts +6 -0
- package/dist/src/agents/schema-utils.test.js +144 -0
- package/dist/src/agents/schema-utils.test.js.map +1 -0
- package/dist/src/agents/subagent-tool-wrapper.d.ts +36 -0
- package/dist/src/agents/subagent-tool-wrapper.js +47 -0
- package/dist/src/agents/subagent-tool-wrapper.js.map +1 -0
- package/dist/src/agents/subagent-tool-wrapper.test.d.ts +6 -0
- package/dist/src/agents/subagent-tool-wrapper.test.js +105 -0
- package/dist/src/agents/subagent-tool-wrapper.test.js.map +1 -0
- package/dist/src/agents/types.d.ts +116 -0
- package/dist/src/agents/types.js +17 -0
- package/dist/src/agents/types.js.map +1 -0
- package/dist/src/agents/utils.d.ts +15 -0
- package/dist/src/agents/utils.js +29 -0
- package/dist/src/agents/utils.js.map +1 -0
- package/dist/src/agents/utils.test.d.ts +6 -0
- package/dist/src/agents/utils.test.js +87 -0
- package/dist/src/agents/utils.test.js.map +1 -0
- package/dist/src/code_assist/codeAssist.d.ts +6 -3
- package/dist/src/code_assist/codeAssist.js +12 -0
- package/dist/src/code_assist/codeAssist.js.map +1 -1
- package/dist/src/code_assist/converter.d.ts +4 -1
- package/dist/src/code_assist/converter.js +38 -5
- package/dist/src/code_assist/converter.js.map +1 -1
- package/dist/src/code_assist/converter.test.js +93 -0
- package/dist/src/code_assist/converter.test.js.map +1 -1
- package/dist/src/code_assist/oauth-credential-storage.d.ts +25 -0
- package/dist/src/code_assist/oauth-credential-storage.js +109 -0
- package/dist/src/code_assist/oauth-credential-storage.js.map +1 -0
- package/dist/src/code_assist/oauth-credential-storage.test.d.ts +6 -0
- package/dist/src/code_assist/oauth-credential-storage.test.js +136 -0
- package/dist/src/code_assist/oauth-credential-storage.test.js.map +1 -0
- package/dist/src/code_assist/oauth2.d.ts +1 -1
- package/dist/src/code_assist/oauth2.js +107 -48
- package/dist/src/code_assist/oauth2.js.map +1 -1
- package/dist/src/code_assist/oauth2.test.js +735 -343
- package/dist/src/code_assist/oauth2.test.js.map +1 -1
- package/dist/src/code_assist/server.d.ts +4 -4
- package/dist/src/code_assist/server.js +25 -2
- package/dist/src/code_assist/server.js.map +1 -1
- package/dist/src/code_assist/server.test.js +25 -0
- package/dist/src/code_assist/server.test.js.map +1 -1
- package/dist/src/code_assist/setup.d.ts +1 -1
- package/dist/src/code_assist/setup.js +1 -1
- package/dist/src/code_assist/setup.js.map +1 -1
- package/dist/src/code_assist/setup.test.js.map +1 -1
- package/dist/src/code_assist/types.d.ts +17 -2
- package/dist/src/config/config.d.ts +121 -25
- package/dist/src/config/config.js +298 -89
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/config.test.js +370 -131
- package/dist/src/config/config.test.js.map +1 -1
- package/dist/src/config/constants.d.ts +11 -0
- package/dist/src/config/constants.js +16 -0
- package/dist/src/config/constants.js.map +1 -0
- package/dist/src/config/models.d.ts +16 -0
- package/dist/src/config/models.js +29 -0
- package/dist/src/config/models.js.map +1 -1
- package/dist/src/config/models.test.d.ts +6 -0
- package/dist/src/config/models.test.js +55 -0
- package/dist/src/config/models.test.js.map +1 -0
- package/dist/src/config/storage.d.ts +34 -0
- package/dist/src/config/storage.js +95 -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 +47 -0
- package/dist/src/config/storage.test.js.map +1 -0
- package/dist/src/confirmation-bus/index.d.ts +7 -0
- package/dist/src/confirmation-bus/index.js +8 -0
- package/dist/src/confirmation-bus/index.js.map +1 -0
- package/dist/src/confirmation-bus/message-bus.d.ts +17 -0
- package/dist/src/confirmation-bus/message-bus.js +81 -0
- package/dist/src/confirmation-bus/message-bus.js.map +1 -0
- package/dist/src/confirmation-bus/message-bus.test.d.ts +6 -0
- package/dist/src/confirmation-bus/message-bus.test.js +164 -0
- package/dist/src/confirmation-bus/message-bus.test.js.map +1 -0
- package/dist/src/confirmation-bus/types.d.ts +38 -0
- package/dist/src/confirmation-bus/types.js +15 -0
- package/dist/src/confirmation-bus/types.js.map +1 -0
- package/dist/src/core/baseLlmClient.d.ts +54 -0
- package/dist/src/core/baseLlmClient.js +190 -0
- package/dist/src/core/baseLlmClient.js.map +1 -0
- package/dist/src/core/baseLlmClient.test.d.ts +6 -0
- package/dist/src/core/baseLlmClient.test.js +316 -0
- package/dist/src/core/baseLlmClient.test.js.map +1 -0
- package/dist/src/core/client.d.ts +28 -33
- package/dist/src/core/client.js +187 -384
- package/dist/src/core/client.js.map +1 -1
- package/dist/src/core/client.test.js +745 -500
- package/dist/src/core/client.test.js.map +1 -1
- package/dist/src/core/contentGenerator.d.ts +4 -4
- package/dist/src/core/contentGenerator.js +6 -7
- package/dist/src/core/contentGenerator.js.map +1 -1
- package/dist/src/core/contentGenerator.test.js +1 -3
- package/dist/src/core/contentGenerator.test.js.map +1 -1
- package/dist/src/core/coreToolScheduler.d.ts +20 -7
- package/dist/src/core/coreToolScheduler.js +216 -53
- package/dist/src/core/coreToolScheduler.js.map +1 -1
- package/dist/src/core/coreToolScheduler.test.js +564 -88
- package/dist/src/core/coreToolScheduler.test.js.map +1 -1
- package/dist/src/core/geminiChat.d.ts +54 -53
- package/dist/src/core/geminiChat.js +300 -356
- package/dist/src/core/geminiChat.js.map +1 -1
- package/dist/src/core/geminiChat.test.js +1255 -321
- package/dist/src/core/geminiChat.test.js.map +1 -1
- package/dist/src/core/geminiRequest.js +1 -0
- package/dist/src/core/geminiRequest.js.map +1 -1
- package/dist/src/core/logger.d.ts +4 -2
- package/dist/src/core/logger.js +4 -3
- package/dist/src/core/logger.js.map +1 -1
- package/dist/src/core/logger.test.js +17 -16
- package/dist/src/core/logger.test.js.map +1 -1
- package/dist/src/core/loggingContentGenerator.d.ts +3 -3
- package/dist/src/core/loggingContentGenerator.js +15 -16
- package/dist/src/core/loggingContentGenerator.js.map +1 -1
- package/dist/src/core/nonInteractiveToolExecutor.d.ts +3 -5
- package/dist/src/core/nonInteractiveToolExecutor.js +14 -122
- package/dist/src/core/nonInteractiveToolExecutor.js.map +1 -1
- package/dist/src/core/nonInteractiveToolExecutor.test.js +158 -78
- package/dist/src/core/nonInteractiveToolExecutor.test.js.map +1 -1
- package/dist/src/core/openaiContentGenerator.d.ts +4 -3
- package/dist/src/core/openaiContentGenerator.js +21 -14
- package/dist/src/core/openaiContentGenerator.js.map +1 -1
- package/dist/src/core/openaiContentGenerator.test.js +1 -0
- package/dist/src/core/openaiContentGenerator.test.js.map +1 -1
- package/dist/src/core/prompts.d.ts +5 -0
- package/dist/src/core/prompts.js +66 -44
- package/dist/src/core/prompts.js.map +1 -1
- package/dist/src/core/prompts.test.js +130 -1
- package/dist/src/core/prompts.test.js.map +1 -1
- package/dist/src/core/subagent.d.ts +24 -18
- package/dist/src/core/subagent.js +125 -90
- package/dist/src/core/subagent.js.map +1 -1
- package/dist/src/core/subagent.test.js +59 -44
- package/dist/src/core/subagent.test.js.map +1 -1
- package/dist/src/core/turn.d.ts +37 -13
- package/dist/src/core/turn.js +63 -28
- package/dist/src/core/turn.js.map +1 -1
- package/dist/src/core/turn.test.js +359 -100
- package/dist/src/core/turn.test.js.map +1 -1
- package/dist/src/fallback/handler.d.ts +7 -0
- package/dist/src/fallback/handler.js +129 -0
- package/dist/src/fallback/handler.js.map +1 -0
- package/dist/src/fallback/handler.test.d.ts +6 -0
- package/dist/src/fallback/handler.test.js +130 -0
- package/dist/src/fallback/handler.test.js.map +1 -0
- package/dist/src/fallback/types.d.ts +14 -0
- package/dist/src/fallback/types.js +7 -0
- package/dist/src/fallback/types.js.map +1 -0
- package/dist/src/ide/constants.d.ts +3 -0
- package/dist/src/ide/constants.js +3 -0
- package/dist/src/ide/constants.js.map +1 -1
- package/dist/src/ide/detect-ide.d.ts +48 -12
- package/dist/src/ide/detect-ide.js +47 -66
- package/dist/src/ide/detect-ide.js.map +1 -1
- package/dist/src/ide/detect-ide.test.js +79 -52
- package/dist/src/ide/detect-ide.test.js.map +1 -1
- package/dist/src/ide/ide-client.d.ts +69 -23
- package/dist/src/ide/ide-client.js +372 -78
- package/dist/src/ide/ide-client.js.map +1 -1
- package/dist/src/ide/ide-client.test.js +375 -30
- package/dist/src/ide/ide-client.test.js.map +1 -1
- package/dist/src/ide/ide-installer.d.ts +2 -2
- package/dist/src/ide/ide-installer.js +37 -24
- package/dist/src/ide/ide-installer.js.map +1 -1
- package/dist/src/ide/ide-installer.test.js +104 -26
- package/dist/src/ide/ide-installer.test.js.map +1 -1
- package/dist/src/ide/ideContext.d.ts +35 -365
- package/dist/src/ide/ideContext.js +60 -106
- package/dist/src/ide/ideContext.js.map +1 -1
- package/dist/src/ide/ideContext.test.js +152 -24
- package/dist/src/ide/ideContext.test.js.map +1 -1
- package/dist/src/ide/process-utils.d.ts +7 -5
- package/dist/src/ide/process-utils.js +81 -50
- package/dist/src/ide/process-utils.js.map +1 -1
- package/dist/src/ide/process-utils.test.d.ts +6 -0
- package/dist/src/ide/process-utils.test.js +158 -0
- package/dist/src/ide/process-utils.test.js.map +1 -0
- package/dist/src/ide/types.d.ts +486 -0
- package/dist/src/ide/types.js +138 -0
- package/dist/src/ide/types.js.map +1 -0
- package/dist/src/index.d.ts +20 -2
- package/dist/src/index.js +20 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/google-auth-provider.d.ts +3 -3
- package/dist/src/mcp/google-auth-provider.test.js.map +1 -1
- package/dist/src/mcp/oauth-provider.d.ts +17 -13
- package/dist/src/mcp/oauth-provider.js +81 -69
- package/dist/src/mcp/oauth-provider.js.map +1 -1
- package/dist/src/mcp/oauth-provider.test.js +212 -37
- package/dist/src/mcp/oauth-provider.test.js.map +1 -1
- package/dist/src/mcp/oauth-token-storage.d.ts +14 -32
- package/dist/src/mcp/oauth-token-storage.js +54 -25
- package/dist/src/mcp/oauth-token-storage.js.map +1 -1
- package/dist/src/mcp/oauth-token-storage.test.js +256 -162
- package/dist/src/mcp/oauth-token-storage.test.js.map +1 -1
- package/dist/src/mcp/oauth-utils.d.ts +9 -1
- package/dist/src/mcp/oauth-utils.js +42 -27
- package/dist/src/mcp/oauth-utils.js.map +1 -1
- package/dist/src/mcp/oauth-utils.test.js +41 -1
- package/dist/src/mcp/oauth-utils.test.js.map +1 -1
- package/dist/src/mcp/sa-impersonation-provider.d.ts +33 -0
- package/dist/src/mcp/sa-impersonation-provider.js +130 -0
- package/dist/src/mcp/sa-impersonation-provider.js.map +1 -0
- package/dist/src/mcp/sa-impersonation-provider.test.d.ts +6 -0
- package/dist/src/mcp/sa-impersonation-provider.test.js +117 -0
- package/dist/src/mcp/sa-impersonation-provider.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/file-token-storage.d.ts +24 -0
- package/dist/src/mcp/token-storage/file-token-storage.js +144 -0
- package/dist/src/mcp/token-storage/file-token-storage.js.map +1 -0
- package/dist/src/mcp/token-storage/file-token-storage.test.d.ts +6 -0
- package/dist/src/mcp/token-storage/file-token-storage.test.js +235 -0
- package/dist/src/mcp/token-storage/file-token-storage.test.js.map +1 -0
- package/dist/src/mcp/token-storage/hybrid-token-storage.d.ts +23 -0
- package/dist/src/mcp/token-storage/hybrid-token-storage.js +78 -0
- package/dist/src/mcp/token-storage/hybrid-token-storage.js.map +1 -0
- package/dist/src/mcp/token-storage/hybrid-token-storage.test.d.ts +6 -0
- package/dist/src/mcp/token-storage/hybrid-token-storage.test.js +193 -0
- package/dist/src/mcp/token-storage/hybrid-token-storage.test.js.map +1 -0
- package/dist/src/mcp/token-storage/index.d.ts +11 -0
- package/dist/src/mcp/token-storage/index.js +12 -0
- package/dist/src/mcp/token-storage/index.js.map +1 -0
- package/dist/src/mcp/token-storage/keychain-token-storage.d.ts +31 -0
- package/dist/src/mcp/token-storage/keychain-token-storage.js +190 -0
- package/dist/src/mcp/token-storage/keychain-token-storage.js.map +1 -0
- package/dist/src/mcp/token-storage/keychain-token-storage.test.d.ts +6 -0
- package/dist/src/mcp/token-storage/keychain-token-storage.test.js +254 -0
- package/dist/src/mcp/token-storage/keychain-token-storage.test.js.map +1 -0
- package/dist/src/mcp/token-storage/types.d.ts +38 -0
- package/dist/src/mcp/token-storage/types.js +11 -0
- package/dist/src/mcp/token-storage/types.js.map +1 -0
- package/dist/src/output/json-formatter.d.ts +11 -0
- package/dist/src/output/json-formatter.js +30 -0
- package/dist/src/output/json-formatter.js.map +1 -0
- package/dist/src/output/json-formatter.test.d.ts +6 -0
- package/dist/src/output/json-formatter.test.js +266 -0
- package/dist/src/output/json-formatter.test.js.map +1 -0
- package/dist/src/output/types.d.ts +20 -0
- package/dist/src/output/types.js +11 -0
- package/dist/src/output/types.js.map +1 -0
- package/dist/src/policy/index.d.ts +7 -0
- package/dist/src/policy/index.js +8 -0
- package/dist/src/policy/index.js.map +1 -0
- package/dist/src/policy/policy-engine.d.ts +30 -0
- package/dist/src/policy/policy-engine.js +92 -0
- package/dist/src/policy/policy-engine.js.map +1 -0
- package/dist/src/policy/policy-engine.test.d.ts +6 -0
- package/dist/src/policy/policy-engine.test.js +515 -0
- package/dist/src/policy/policy-engine.test.js.map +1 -0
- package/dist/src/policy/stable-stringify.d.ts +58 -0
- package/dist/src/policy/stable-stringify.js +122 -0
- package/dist/src/policy/stable-stringify.js.map +1 -0
- package/dist/src/policy/types.d.ts +47 -0
- package/dist/src/policy/types.js +12 -0
- package/dist/src/policy/types.js.map +1 -0
- package/dist/src/prompts/mcp-prompts.d.ts +2 -2
- package/dist/src/prompts/prompt-registry.d.ts +1 -1
- package/dist/src/routing/modelRouterService.d.ts +23 -0
- package/dist/src/routing/modelRouterService.js +70 -0
- package/dist/src/routing/modelRouterService.js.map +1 -0
- package/dist/src/routing/modelRouterService.test.d.ts +6 -0
- package/dist/src/routing/modelRouterService.test.js +98 -0
- package/dist/src/routing/modelRouterService.test.js.map +1 -0
- package/dist/src/routing/routingStrategy.d.ts +62 -0
- package/dist/src/routing/routingStrategy.js +7 -0
- package/dist/src/routing/routingStrategy.js.map +1 -0
- package/dist/src/routing/strategies/classifierStrategy.d.ts +12 -0
- package/dist/src/routing/strategies/classifierStrategy.js +173 -0
- package/dist/src/routing/strategies/classifierStrategy.js.map +1 -0
- package/dist/src/routing/strategies/classifierStrategy.test.d.ts +6 -0
- package/dist/src/routing/strategies/classifierStrategy.test.js +192 -0
- package/dist/src/routing/strategies/classifierStrategy.test.js.map +1 -0
- package/dist/src/routing/strategies/compositeStrategy.d.ts +26 -0
- package/dist/src/routing/strategies/compositeStrategy.js +68 -0
- package/dist/src/routing/strategies/compositeStrategy.js.map +1 -0
- package/dist/src/routing/strategies/compositeStrategy.test.d.ts +6 -0
- package/dist/src/routing/strategies/compositeStrategy.test.js +123 -0
- package/dist/src/routing/strategies/compositeStrategy.test.js.map +1 -0
- package/dist/src/routing/strategies/defaultStrategy.d.ts +12 -0
- package/dist/src/routing/strategies/defaultStrategy.js +20 -0
- package/dist/src/routing/strategies/defaultStrategy.js.map +1 -0
- package/dist/src/routing/strategies/defaultStrategy.test.d.ts +6 -0
- package/dist/src/routing/strategies/defaultStrategy.test.js +26 -0
- package/dist/src/routing/strategies/defaultStrategy.test.js.map +1 -0
- package/dist/src/routing/strategies/fallbackStrategy.d.ts +12 -0
- package/dist/src/routing/strategies/fallbackStrategy.js +25 -0
- package/dist/src/routing/strategies/fallbackStrategy.js.map +1 -0
- package/dist/src/routing/strategies/fallbackStrategy.test.d.ts +6 -0
- package/dist/src/routing/strategies/fallbackStrategy.test.js +55 -0
- package/dist/src/routing/strategies/fallbackStrategy.test.js.map +1 -0
- package/dist/src/routing/strategies/overrideStrategy.d.ts +15 -0
- package/dist/src/routing/strategies/overrideStrategy.js +28 -0
- package/dist/src/routing/strategies/overrideStrategy.js.map +1 -0
- package/dist/src/routing/strategies/overrideStrategy.test.d.ts +6 -0
- package/dist/src/routing/strategies/overrideStrategy.test.js +42 -0
- package/dist/src/routing/strategies/overrideStrategy.test.js.map +1 -0
- package/dist/src/services/chatRecordingService.d.ts +8 -14
- package/dist/src/services/chatRecordingService.js +33 -21
- package/dist/src/services/chatRecordingService.js.map +1 -1
- package/dist/src/services/chatRecordingService.test.js +69 -25
- package/dist/src/services/chatRecordingService.test.js.map +1 -1
- package/dist/src/services/fileDiscoveryService.d.ts +10 -0
- package/dist/src/services/fileDiscoveryService.js +32 -18
- package/dist/src/services/fileDiscoveryService.js.map +1 -1
- package/dist/src/services/fileDiscoveryService.test.js +3 -3
- package/dist/src/services/fileDiscoveryService.test.js.map +1 -1
- package/dist/src/services/fileSystemService.d.ts +9 -0
- package/dist/src/services/fileSystemService.js +12 -1
- package/dist/src/services/fileSystemService.js.map +1 -1
- package/dist/src/services/fileSystemService.test.js +1 -1
- package/dist/src/services/fileSystemService.test.js.map +1 -1
- package/dist/src/services/gitService.d.ts +3 -1
- package/dist/src/services/gitService.js +30 -24
- package/dist/src/services/gitService.js.map +1 -1
- package/dist/src/services/gitService.test.js +30 -37
- package/dist/src/services/gitService.test.js.map +1 -1
- package/dist/src/services/loopDetectionService.d.ts +8 -2
- package/dist/src/services/loopDetectionService.js +64 -24
- package/dist/src/services/loopDetectionService.js.map +1 -1
- package/dist/src/services/loopDetectionService.test.js +64 -13
- package/dist/src/services/loopDetectionService.test.js.map +1 -1
- package/dist/src/services/shellExecutionService.d.ts +36 -2
- package/dist/src/services/shellExecutionService.js +238 -47
- package/dist/src/services/shellExecutionService.js.map +1 -1
- package/dist/src/services/shellExecutionService.test.js +197 -58
- package/dist/src/services/shellExecutionService.test.js.map +1 -1
- package/dist/src/telemetry/activity-detector.d.ts +41 -0
- package/dist/src/telemetry/activity-detector.js +61 -0
- package/dist/src/telemetry/activity-detector.js.map +1 -0
- package/dist/src/telemetry/activity-detector.test.d.ts +6 -0
- package/dist/src/telemetry/activity-detector.test.js +136 -0
- package/dist/src/telemetry/activity-detector.test.js.map +1 -0
- package/dist/src/telemetry/activity-types.d.ts +19 -0
- package/dist/src/telemetry/activity-types.js +21 -0
- package/dist/src/telemetry/activity-types.js.map +1 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +34 -4
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +322 -15
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.d.ts +1 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +321 -11
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +51 -2
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +124 -2
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -1
- package/dist/src/telemetry/config.d.ts +31 -0
- package/dist/src/telemetry/config.js +76 -0
- package/dist/src/telemetry/config.js.map +1 -0
- package/dist/src/telemetry/config.test.d.ts +6 -0
- package/dist/src/telemetry/config.test.js +124 -0
- package/dist/src/telemetry/config.test.js.map +1 -0
- package/dist/src/telemetry/constants.d.ts +17 -7
- package/dist/src/telemetry/constants.js +18 -7
- package/dist/src/telemetry/constants.js.map +1 -1
- package/dist/src/telemetry/file-exporters.d.ts +5 -4
- package/dist/src/telemetry/file-exporters.js +1 -1
- package/dist/src/telemetry/file-exporters.js.map +1 -1
- package/dist/src/telemetry/gcp-exporters.d.ts +34 -0
- package/dist/src/telemetry/gcp-exporters.js +117 -0
- package/dist/src/telemetry/gcp-exporters.js.map +1 -0
- package/dist/src/telemetry/gcp-exporters.test.d.ts +6 -0
- package/dist/src/telemetry/gcp-exporters.test.js +318 -0
- package/dist/src/telemetry/gcp-exporters.test.js.map +1 -0
- package/dist/src/telemetry/high-water-mark-tracker.d.ts +43 -0
- package/dist/src/telemetry/high-water-mark-tracker.js +88 -0
- package/dist/src/telemetry/high-water-mark-tracker.js.map +1 -0
- package/dist/src/telemetry/high-water-mark-tracker.test.d.ts +6 -0
- package/dist/src/telemetry/high-water-mark-tracker.test.js +152 -0
- package/dist/src/telemetry/high-water-mark-tracker.test.js.map +1 -0
- package/dist/src/telemetry/index.d.ts +12 -2
- package/dist/src/telemetry/index.js +16 -2
- package/dist/src/telemetry/index.js.map +1 -1
- package/dist/src/telemetry/loggers.d.ts +17 -2
- package/dist/src/telemetry/loggers.js +316 -14
- package/dist/src/telemetry/loggers.js.map +1 -1
- package/dist/src/telemetry/loggers.test.circular.js +3 -3
- package/dist/src/telemetry/loggers.test.circular.js.map +1 -1
- package/dist/src/telemetry/loggers.test.js +452 -48
- package/dist/src/telemetry/loggers.test.js.map +1 -1
- package/dist/src/telemetry/metrics.d.ts +323 -12
- package/dist/src/telemetry/metrics.js +464 -83
- package/dist/src/telemetry/metrics.js.map +1 -1
- package/dist/src/telemetry/metrics.test.js +583 -38
- package/dist/src/telemetry/metrics.test.js.map +1 -1
- package/dist/src/telemetry/rate-limiter.d.ts +48 -0
- package/dist/src/telemetry/rate-limiter.js +100 -0
- package/dist/src/telemetry/rate-limiter.js.map +1 -0
- package/dist/src/telemetry/rate-limiter.test.d.ts +6 -0
- package/dist/src/telemetry/rate-limiter.test.js +207 -0
- package/dist/src/telemetry/rate-limiter.test.js.map +1 -0
- package/dist/src/telemetry/sdk.d.ts +1 -1
- package/dist/src/telemetry/sdk.js +20 -2
- package/dist/src/telemetry/sdk.js.map +1 -1
- package/dist/src/telemetry/sdk.test.js +108 -0
- package/dist/src/telemetry/sdk.test.js.map +1 -1
- 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/types.d.ts +136 -8
- package/dist/src/telemetry/types.js +233 -11
- package/dist/src/telemetry/types.js.map +1 -1
- package/dist/src/telemetry/uiTelemetry.d.ts +3 -3
- package/dist/src/telemetry/uiTelemetry.js +7 -8
- package/dist/src/telemetry/uiTelemetry.js.map +1 -1
- package/dist/src/telemetry/uiTelemetry.test.js +33 -29
- package/dist/src/telemetry/uiTelemetry.test.js.map +1 -1
- package/dist/src/test-utils/config.d.ts +2 -1
- package/dist/src/test-utils/config.js.map +1 -1
- package/dist/src/test-utils/index.d.ts +6 -0
- package/dist/src/test-utils/index.js +7 -0
- package/dist/src/test-utils/index.js.map +1 -0
- package/dist/src/test-utils/mock-tool.d.ts +66 -0
- package/dist/src/test-utils/{tools.js → mock-tool.js} +45 -29
- package/dist/src/test-utils/mock-tool.js.map +1 -0
- package/dist/src/test-utils/mockWorkspaceContext.d.ts +1 -1
- package/dist/src/tools/diffOptions.d.ts +1 -1
- package/dist/src/tools/diffOptions.js +21 -13
- package/dist/src/tools/diffOptions.js.map +1 -1
- package/dist/src/tools/diffOptions.test.js +58 -22
- package/dist/src/tools/diffOptions.test.js.map +1 -1
- package/dist/src/tools/edit.d.ts +6 -5
- package/dist/src/tools/edit.js +58 -40
- package/dist/src/tools/edit.js.map +1 -1
- package/dist/src/tools/edit.test.js +192 -16
- package/dist/src/tools/edit.test.js.map +1 -1
- package/dist/src/tools/glob.d.ts +7 -2
- package/dist/src/tools/glob.js +42 -23
- package/dist/src/tools/glob.js.map +1 -1
- package/dist/src/tools/glob.test.js +80 -4
- package/dist/src/tools/glob.test.js.map +1 -1
- package/dist/src/tools/grep.d.ts +3 -2
- package/dist/src/tools/grep.js +35 -15
- package/dist/src/tools/grep.js.map +1 -1
- package/dist/src/tools/grep.test.js +26 -3
- package/dist/src/tools/grep.test.js.map +1 -1
- package/dist/src/tools/ls.d.ts +3 -2
- package/dist/src/tools/ls.js +31 -39
- package/dist/src/tools/ls.js.map +1 -1
- package/dist/src/tools/ls.test.js +145 -280
- package/dist/src/tools/ls.test.js.map +1 -1
- package/dist/src/tools/mcp-client-manager.d.ts +8 -6
- package/dist/src/tools/mcp-client-manager.js +13 -4
- package/dist/src/tools/mcp-client-manager.js.map +1 -1
- package/dist/src/tools/mcp-client-manager.test.js +20 -1
- package/dist/src/tools/mcp-client-manager.test.js.map +1 -1
- package/dist/src/tools/mcp-client.d.ts +18 -21
- package/dist/src/tools/mcp-client.js +87 -120
- package/dist/src/tools/mcp-client.js.map +1 -1
- package/dist/src/tools/mcp-client.test.js +32 -152
- package/dist/src/tools/mcp-client.test.js.map +1 -1
- package/dist/src/tools/mcp-tool.d.ts +6 -4
- package/dist/src/tools/mcp-tool.js +51 -13
- package/dist/src/tools/mcp-tool.js.map +1 -1
- package/dist/src/tools/mcp-tool.test.js +166 -12
- package/dist/src/tools/mcp-tool.test.js.map +1 -1
- package/dist/src/tools/memoryTool.d.ts +3 -2
- package/dist/src/tools/memoryTool.js +14 -37
- package/dist/src/tools/memoryTool.js.map +1 -1
- package/dist/src/tools/memoryTool.test.js +16 -4
- package/dist/src/tools/memoryTool.test.js.map +1 -1
- package/dist/src/tools/message-bus-integration.test.d.ts +6 -0
- package/dist/src/tools/message-bus-integration.test.js +183 -0
- package/dist/src/tools/message-bus-integration.test.js.map +1 -0
- package/dist/src/tools/modifiable-tool.d.ts +2 -2
- package/dist/src/tools/modifiable-tool.js +3 -3
- package/dist/src/tools/modifiable-tool.js.map +1 -1
- package/dist/src/tools/modifiable-tool.test.js +4 -4
- package/dist/src/tools/modifiable-tool.test.js.map +1 -1
- package/dist/src/tools/read-file.d.ts +3 -2
- package/dist/src/tools/read-file.js +23 -38
- package/dist/src/tools/read-file.js.map +1 -1
- package/dist/src/tools/read-file.test.js +38 -6
- package/dist/src/tools/read-file.test.js.map +1 -1
- package/dist/src/tools/read-many-files.d.ts +3 -2
- package/dist/src/tools/read-many-files.js +52 -107
- package/dist/src/tools/read-many-files.js.map +1 -1
- package/dist/src/tools/read-many-files.test.js +64 -11
- package/dist/src/tools/read-many-files.test.js.map +1 -1
- package/dist/src/tools/ripGrep.d.ts +55 -0
- package/dist/src/tools/ripGrep.js +393 -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 +976 -0
- package/dist/src/tools/ripGrep.test.js.map +1 -0
- package/dist/src/tools/shell.d.ts +13 -2
- package/dist/src/tools/shell.js +42 -32
- package/dist/src/tools/shell.js.map +1 -1
- package/dist/src/tools/shell.test.js +57 -75
- package/dist/src/tools/shell.test.js.map +1 -1
- package/dist/src/tools/smart-edit.d.ts +91 -0
- package/dist/src/tools/smart-edit.js +702 -0
- package/dist/src/tools/smart-edit.js.map +1 -0
- package/dist/src/tools/smart-edit.test.d.ts +6 -0
- package/dist/src/tools/smart-edit.test.js +542 -0
- package/dist/src/tools/smart-edit.test.js.map +1 -0
- package/dist/src/tools/tool-error.d.ts +18 -1
- package/dist/src/tools/tool-error.js +27 -0
- package/dist/src/tools/tool-error.js.map +1 -1
- package/dist/src/tools/tool-registry.d.ts +10 -4
- package/dist/src/tools/tool-registry.js +20 -7
- package/dist/src/tools/tool-registry.js.map +1 -1
- package/dist/src/tools/tool-registry.test.js +93 -10
- package/dist/src/tools/tool-registry.test.js.map +1 -1
- package/dist/src/tools/tools.d.ts +33 -16
- package/dist/src/tools/tools.js +115 -5
- package/dist/src/tools/tools.js.map +1 -1
- package/dist/src/tools/tools.test.js +1 -2
- package/dist/src/tools/tools.test.js.map +1 -1
- package/dist/src/tools/web-fetch.d.ts +3 -2
- package/dist/src/tools/web-fetch.js +14 -10
- package/dist/src/tools/web-fetch.js.map +1 -1
- package/dist/src/tools/web-fetch.test.js +55 -16
- package/dist/src/tools/web-fetch.test.js.map +1 -1
- package/dist/src/tools/web-search.d.ts +4 -3
- package/dist/src/tools/web-search.js +31 -8
- package/dist/src/tools/web-search.js.map +1 -1
- package/dist/src/tools/web-search.test.js +69 -1
- package/dist/src/tools/web-search.test.js.map +1 -1
- package/dist/src/tools/write-file.d.ts +4 -3
- package/dist/src/tools/write-file.js +17 -18
- package/dist/src/tools/write-file.js.map +1 -1
- package/dist/src/tools/write-file.test.js +108 -24
- package/dist/src/tools/write-file.test.js.map +1 -1
- package/dist/src/tools/write-todos.d.ts +25 -0
- package/dist/src/tools/write-todos.js +150 -0
- package/dist/src/tools/write-todos.js.map +1 -0
- package/dist/src/tools/write-todos.test.d.ts +6 -0
- package/dist/src/tools/write-todos.test.js +89 -0
- package/dist/src/tools/write-todos.test.js.map +1 -0
- package/dist/src/utils/bfsFileSearch.d.ts +2 -2
- package/dist/src/utils/bfsFileSearch.js +13 -7
- package/dist/src/utils/bfsFileSearch.js.map +1 -1
- package/dist/src/utils/bfsFileSearch.test.js +3 -3
- package/dist/src/utils/bfsFileSearch.test.js.map +1 -1
- package/dist/src/utils/editCorrector.d.ts +9 -8
- package/dist/src/utils/editCorrector.js +62 -19
- package/dist/src/utils/editCorrector.js.map +1 -1
- package/dist/src/utils/editCorrector.test.js +33 -82
- package/dist/src/utils/editCorrector.test.js.map +1 -1
- package/dist/src/utils/editor.js +32 -45
- package/dist/src/utils/editor.js.map +1 -1
- package/dist/src/utils/editor.test.js +62 -76
- package/dist/src/utils/editor.test.js.map +1 -1
- package/dist/src/utils/environmentContext.d.ts +2 -2
- package/dist/src/utils/errorParsing.js +2 -2
- package/dist/src/utils/errorParsing.js.map +1 -1
- package/dist/src/utils/errorParsing.test.js +7 -7
- package/dist/src/utils/errorParsing.test.js.map +1 -1
- package/dist/src/utils/errorReporting.d.ts +1 -1
- package/dist/src/utils/errors.d.ts +25 -0
- package/dist/src/utils/errors.js +42 -0
- package/dist/src/utils/errors.js.map +1 -1
- package/dist/src/utils/fetch.js +1 -1
- package/dist/src/utils/fetch.js.map +1 -1
- package/dist/src/utils/fileUtils.d.ts +24 -12
- package/dist/src/utils/fileUtils.js +170 -79
- package/dist/src/utils/fileUtils.js.map +1 -1
- package/dist/src/utils/fileUtils.test.js +347 -29
- package/dist/src/utils/fileUtils.test.js.map +1 -1
- package/dist/src/utils/filesearch/crawler.d.ts +1 -1
- package/dist/src/utils/filesearch/crawler.test.js +2 -2
- package/dist/src/utils/filesearch/crawler.test.js.map +1 -1
- package/dist/src/utils/filesearch/fileSearch.d.ts +1 -0
- package/dist/src/utils/filesearch/fileSearch.js +14 -9
- package/dist/src/utils/filesearch/fileSearch.js.map +1 -1
- package/dist/src/utils/filesearch/fileSearch.test.js +90 -0
- package/dist/src/utils/filesearch/fileSearch.test.js.map +1 -1
- package/dist/src/utils/flashFallback.test.d.ts +6 -0
- package/dist/src/utils/{flashFallback.integration.test.js → flashFallback.test.js} +33 -29
- package/dist/src/utils/flashFallback.test.js.map +1 -0
- package/dist/src/utils/geminiIgnoreParser.d.ts +18 -0
- package/dist/src/utils/geminiIgnoreParser.js +61 -0
- package/dist/src/utils/geminiIgnoreParser.js.map +1 -0
- package/dist/src/utils/geminiIgnoreParser.test.d.ts +6 -0
- package/dist/src/utils/geminiIgnoreParser.test.js +50 -0
- package/dist/src/utils/geminiIgnoreParser.test.js.map +1 -0
- package/dist/src/utils/generateContentResponseUtilities.d.ts +1 -2
- package/dist/src/utils/generateContentResponseUtilities.js +1 -13
- package/dist/src/utils/generateContentResponseUtilities.js.map +1 -1
- package/dist/src/utils/generateContentResponseUtilities.test.js +2 -40
- package/dist/src/utils/generateContentResponseUtilities.test.js.map +1 -1
- package/dist/src/utils/getFolderStructure.d.ts +2 -2
- package/dist/src/utils/getFolderStructure.js +3 -3
- package/dist/src/utils/getFolderStructure.js.map +1 -1
- package/dist/src/utils/getFolderStructure.test.js +4 -4
- package/dist/src/utils/getFolderStructure.test.js.map +1 -1
- package/dist/src/utils/gitIgnoreParser.d.ts +3 -7
- package/dist/src/utils/gitIgnoreParser.js +126 -35
- package/dist/src/utils/gitIgnoreParser.js.map +1 -1
- package/dist/src/utils/gitIgnoreParser.test.js +69 -38
- package/dist/src/utils/gitIgnoreParser.test.js.map +1 -1
- package/dist/src/utils/gitUtils.js +2 -2
- package/dist/src/utils/gitUtils.js.map +1 -1
- 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/llm-edit-fixer.d.ts +26 -0
- package/dist/src/utils/llm-edit-fixer.js +131 -0
- package/dist/src/utils/llm-edit-fixer.js.map +1 -0
- package/dist/src/utils/llm-edit-fixer.test.d.ts +6 -0
- package/dist/src/utils/llm-edit-fixer.test.js +186 -0
- package/dist/src/utils/llm-edit-fixer.test.js.map +1 -0
- package/dist/src/utils/memoryDiscovery.d.ts +7 -6
- package/dist/src/utils/memoryDiscovery.js +68 -33
- package/dist/src/utils/memoryDiscovery.js.map +1 -1
- package/dist/src/utils/memoryDiscovery.test.js +88 -26
- package/dist/src/utils/memoryDiscovery.test.js.map +1 -1
- package/dist/src/utils/memoryImportProcessor.js +15 -22
- package/dist/src/utils/memoryImportProcessor.js.map +1 -1
- package/dist/src/utils/memoryImportProcessor.test.js +16 -141
- package/dist/src/utils/memoryImportProcessor.test.js.map +1 -1
- package/dist/src/utils/messageInspectors.d.ts +1 -1
- package/dist/src/utils/nextSpeakerChecker.d.ts +3 -3
- package/dist/src/utils/nextSpeakerChecker.js +8 -2
- package/dist/src/utils/nextSpeakerChecker.js.map +1 -1
- package/dist/src/utils/nextSpeakerChecker.test.js +75 -64
- package/dist/src/utils/nextSpeakerChecker.test.js.map +1 -1
- package/dist/src/utils/partUtils.d.ts +22 -1
- package/dist/src/utils/partUtils.js +68 -0
- package/dist/src/utils/partUtils.js.map +1 -1
- package/dist/src/utils/partUtils.test.js +112 -1
- package/dist/src/utils/partUtils.test.js.map +1 -1
- 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 +0 -17
- package/dist/src/utils/paths.js +2 -28
- package/dist/src/utils/paths.js.map +1 -1
- package/dist/src/utils/promptIdContext.d.ts +7 -0
- package/dist/src/utils/promptIdContext.js +8 -0
- package/dist/src/utils/promptIdContext.js.map +1 -0
- package/dist/src/utils/quotaErrorDetection.d.ts +1 -1
- package/dist/src/utils/retry.d.ts +3 -1
- package/dist/src/utils/retry.js +20 -5
- package/dist/src/utils/retry.js.map +1 -1
- package/dist/src/utils/retry.test.js +35 -3
- package/dist/src/utils/retry.test.js.map +1 -1
- package/dist/src/utils/schemaValidator.js +15 -1
- package/dist/src/utils/schemaValidator.js.map +1 -1
- package/dist/src/utils/schemaValidator.test.d.ts +6 -0
- package/dist/src/utils/schemaValidator.test.js +113 -0
- package/dist/src/utils/schemaValidator.test.js.map +1 -0
- package/dist/src/utils/session.js +1 -1
- package/dist/src/utils/session.js.map +1 -1
- package/dist/src/utils/shell-utils.d.ts +6 -1
- package/dist/src/utils/shell-utils.js +51 -30
- package/dist/src/utils/shell-utils.js.map +1 -1
- package/dist/src/utils/shell-utils.test.js +9 -0
- package/dist/src/utils/shell-utils.test.js.map +1 -1
- package/dist/src/utils/summarizer.d.ts +2 -2
- package/dist/src/utils/summarizer.test.js.map +1 -1
- package/dist/src/utils/systemEncoding.js +2 -2
- package/dist/src/utils/systemEncoding.js.map +1 -1
- package/dist/src/utils/systemEncoding.test.js +2 -2
- package/dist/src/utils/systemEncoding.test.js.map +1 -1
- package/dist/src/utils/terminalSerializer.d.ts +25 -0
- package/dist/src/utils/terminalSerializer.js +432 -0
- package/dist/src/utils/terminalSerializer.js.map +1 -0
- package/dist/src/utils/terminalSerializer.test.d.ts +6 -0
- package/dist/src/utils/terminalSerializer.test.js +176 -0
- package/dist/src/utils/terminalSerializer.test.js.map +1 -0
- package/dist/src/utils/textUtils.d.ts +5 -0
- package/dist/src/utils/textUtils.js +14 -0
- package/dist/src/utils/textUtils.js.map +1 -1
- package/dist/src/utils/textUtils.test.d.ts +6 -0
- package/dist/src/utils/textUtils.test.js +59 -0
- package/dist/src/utils/textUtils.test.js.map +1 -0
- package/dist/src/utils/thoughtUtils.d.ts +21 -0
- package/dist/src/utils/thoughtUtils.js +39 -0
- package/dist/src/utils/thoughtUtils.js.map +1 -0
- package/dist/src/utils/thoughtUtils.test.d.ts +6 -0
- package/dist/src/utils/thoughtUtils.test.js +78 -0
- package/dist/src/utils/thoughtUtils.test.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/{user_account.test.js → userAccountManager.test.js} +33 -30
- package/dist/src/utils/userAccountManager.test.js.map +1 -0
- package/dist/src/utils/workspaceContext.js +13 -7
- package/dist/src/utils/workspaceContext.js.map +1 -1
- package/dist/src/utils/workspaceContext.test.js +41 -16
- package/dist/src/utils/workspaceContext.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -9
- package/dist/src/core/modelCheck.d.ts +0 -14
- package/dist/src/core/modelCheck.js +0 -62
- package/dist/src/core/modelCheck.js.map +0 -1
- package/dist/src/test-utils/tools.d.ts +0 -44
- package/dist/src/test-utils/tools.js.map +0 -1
- package/dist/src/utils/flashFallback.integration.test.js.map +0 -1
- package/dist/src/utils/user_account.d.ts +0 -9
- package/dist/src/utils/user_account.js +0 -109
- package/dist/src/utils/user_account.js.map +0 -1
- package/dist/src/utils/user_account.test.js.map +0 -1
- package/dist/src/utils/user_id.d.ts +0 -11
- package/dist/src/utils/user_id.js +0 -49
- package/dist/src/utils/user_id.js.map +0 -1
- package/dist/src/utils/user_id.test.js +0 -21
- package/dist/src/utils/user_id.test.js.map +0 -1
- /package/dist/src/{utils/flashFallback.integration.test.d.ts → agents/executor.test.d.ts} +0 -0
- /package/dist/src/{utils/user_account.test.d.ts → agents/invocation.test.d.ts} +0 -0
- /package/dist/src/{utils/user_id.test.d.ts → agents/registry.test.d.ts} +0 -0
|
@@ -5,14 +5,19 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import * as fs from 'node:fs';
|
|
7
7
|
import { isSubpath } from '../utils/paths.js';
|
|
8
|
-
import { detectIde
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { detectIde } from '../ide/detect-ide.js';
|
|
9
|
+
import { ideContextStore } from './ideContext.js';
|
|
10
|
+
import { IdeContextNotificationSchema, IdeDiffAcceptedNotificationSchema, IdeDiffClosedNotificationSchema, IdeDiffRejectedNotificationSchema, } from './types.js';
|
|
11
|
+
import { getIdeProcessInfo } from './process-utils.js';
|
|
11
12
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
12
13
|
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
14
|
+
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
15
|
+
import { CallToolResultSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
13
16
|
import * as os from 'node:os';
|
|
14
17
|
import * as path from 'node:path';
|
|
15
18
|
import { EnvHttpProxyAgent } from 'undici';
|
|
19
|
+
import { ListToolsResultSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
20
|
+
import { IDE_REQUEST_TIMEOUT_MS } from './constants.js';
|
|
16
21
|
const logger = {
|
|
17
22
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
23
|
debug: (...args) => console.debug('[DEBUG] [IDEClient]', ...args),
|
|
@@ -39,27 +44,38 @@ function getRealPath(path) {
|
|
|
39
44
|
* Manages the connection to and interaction with the IDE server.
|
|
40
45
|
*/
|
|
41
46
|
export class IdeClient {
|
|
42
|
-
static
|
|
47
|
+
static instancePromise = null;
|
|
43
48
|
client = undefined;
|
|
44
49
|
state = {
|
|
45
50
|
status: IDEConnectionStatus.Disconnected,
|
|
46
51
|
details: 'IDE integration is currently disabled. To enable it, run /ide enable.',
|
|
47
52
|
};
|
|
48
53
|
currentIde;
|
|
49
|
-
|
|
54
|
+
ideProcessInfo;
|
|
55
|
+
connectionConfig;
|
|
56
|
+
authToken;
|
|
50
57
|
diffResponses = new Map();
|
|
51
58
|
statusListeners = new Set();
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
trustChangeListeners = new Set();
|
|
60
|
+
availableTools = [];
|
|
61
|
+
/**
|
|
62
|
+
* A mutex to ensure that only one diff view is open in the IDE at a time.
|
|
63
|
+
* This prevents race conditions and UI issues in IDEs like VSCode that
|
|
64
|
+
* can't handle multiple diff views being opened simultaneously.
|
|
65
|
+
*/
|
|
66
|
+
diffMutex = Promise.resolve();
|
|
67
|
+
constructor() { }
|
|
58
68
|
static getInstance() {
|
|
59
|
-
if (!IdeClient.
|
|
60
|
-
IdeClient.
|
|
69
|
+
if (!IdeClient.instancePromise) {
|
|
70
|
+
IdeClient.instancePromise = (async () => {
|
|
71
|
+
const client = new IdeClient();
|
|
72
|
+
client.ideProcessInfo = await getIdeProcessInfo();
|
|
73
|
+
client.connectionConfig = await client.getConnectionConfigFromFile();
|
|
74
|
+
client.currentIde = detectIde(client.ideProcessInfo, client.connectionConfig?.ideInfo);
|
|
75
|
+
return client;
|
|
76
|
+
})();
|
|
61
77
|
}
|
|
62
|
-
return IdeClient.
|
|
78
|
+
return IdeClient.instancePromise;
|
|
63
79
|
}
|
|
64
80
|
addStatusChangeListener(listener) {
|
|
65
81
|
this.statusListeners.add(listener);
|
|
@@ -67,92 +83,195 @@ export class IdeClient {
|
|
|
67
83
|
removeStatusChangeListener(listener) {
|
|
68
84
|
this.statusListeners.delete(listener);
|
|
69
85
|
}
|
|
86
|
+
addTrustChangeListener(listener) {
|
|
87
|
+
this.trustChangeListeners.add(listener);
|
|
88
|
+
}
|
|
89
|
+
removeTrustChangeListener(listener) {
|
|
90
|
+
this.trustChangeListeners.delete(listener);
|
|
91
|
+
}
|
|
70
92
|
async connect() {
|
|
71
|
-
if (!this.currentIde
|
|
72
|
-
this.setState(IDEConnectionStatus.Disconnected, `IDE integration is not supported in your current environment. To use this feature, run Gemini CLI in one of these supported IDEs:
|
|
73
|
-
.map((ide) => getIdeInfo(ide).displayName)
|
|
74
|
-
.join(', ')}`, false);
|
|
93
|
+
if (!this.currentIde) {
|
|
94
|
+
this.setState(IDEConnectionStatus.Disconnected, `IDE integration is not supported in your current environment. To use this feature, run Gemini CLI in one of these supported IDEs: VS Code or VS Code forks`, false);
|
|
75
95
|
return;
|
|
76
96
|
}
|
|
77
97
|
this.setState(IDEConnectionStatus.Connecting);
|
|
78
|
-
|
|
79
|
-
|
|
98
|
+
this.connectionConfig = await this.getConnectionConfigFromFile();
|
|
99
|
+
if (this.connectionConfig?.authToken) {
|
|
100
|
+
this.authToken = this.connectionConfig.authToken;
|
|
101
|
+
}
|
|
102
|
+
const workspacePath = this.connectionConfig?.workspacePath ??
|
|
80
103
|
process.env['GEMINI_CLI_IDE_WORKSPACE_PATH'];
|
|
81
|
-
const { isValid, error } = IdeClient.validateWorkspacePath(workspacePath,
|
|
104
|
+
const { isValid, error } = IdeClient.validateWorkspacePath(workspacePath, process.cwd());
|
|
82
105
|
if (!isValid) {
|
|
83
106
|
this.setState(IDEConnectionStatus.Disconnected, error, true);
|
|
84
107
|
return;
|
|
85
108
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
109
|
+
if (this.connectionConfig) {
|
|
110
|
+
if (this.connectionConfig.port) {
|
|
111
|
+
const connected = await this.establishHttpConnection(this.connectionConfig.port);
|
|
112
|
+
if (connected) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
if (this.connectionConfig.stdio) {
|
|
117
|
+
const connected = await this.establishStdioConnection(this.connectionConfig.stdio);
|
|
118
|
+
if (connected) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
91
121
|
}
|
|
92
122
|
}
|
|
93
123
|
const portFromEnv = this.getPortFromEnv();
|
|
94
124
|
if (portFromEnv) {
|
|
95
|
-
const connected = await this.
|
|
125
|
+
const connected = await this.establishHttpConnection(portFromEnv);
|
|
126
|
+
if (connected) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
const stdioConfigFromEnv = this.getStdioConfigFromEnv();
|
|
131
|
+
if (stdioConfigFromEnv) {
|
|
132
|
+
const connected = await this.establishStdioConnection(stdioConfigFromEnv);
|
|
96
133
|
if (connected) {
|
|
97
134
|
return;
|
|
98
135
|
}
|
|
99
136
|
}
|
|
100
|
-
this.setState(IDEConnectionStatus.Disconnected, `Failed to connect to IDE companion extension
|
|
137
|
+
this.setState(IDEConnectionStatus.Disconnected, `Failed to connect to IDE companion extension in ${this.currentIde.displayName}. Please ensure the extension is running. To install the extension, run /ide install.`, true);
|
|
101
138
|
}
|
|
102
139
|
/**
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* - Clicks the checkbox icon in the IDE to accept
|
|
106
|
-
* - Runs `command+shift+p` > "Gemini CLI: Accept Diff in IDE" to accept
|
|
107
|
-
* - Selects "accept" in the CLI UI
|
|
108
|
-
* - Saves the file via `ctrl/command+s`
|
|
140
|
+
* Opens a diff view in the IDE, allowing the user to review and accept or
|
|
141
|
+
* reject changes.
|
|
109
142
|
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
143
|
+
* This method sends a request to the IDE to display a diff between the
|
|
144
|
+
* current content of a file and the new content provided. It then waits for
|
|
145
|
+
* a notification from the IDE indicating that the user has either accepted
|
|
146
|
+
* (potentially with manual edits) or rejected the diff.
|
|
147
|
+
*
|
|
148
|
+
* A mutex ensures that only one diff view can be open at a time to prevent
|
|
149
|
+
* race conditions.
|
|
150
|
+
*
|
|
151
|
+
* @param filePath The absolute path to the file to be diffed.
|
|
152
|
+
* @param newContent The proposed new content for the file.
|
|
153
|
+
* @returns A promise that resolves with a `DiffUpdateResult`, indicating
|
|
154
|
+
* whether the diff was 'accepted' or 'rejected' and including the final
|
|
155
|
+
* content if accepted.
|
|
115
156
|
*/
|
|
116
157
|
async openDiff(filePath, newContent) {
|
|
117
|
-
|
|
158
|
+
const release = await this.acquireMutex();
|
|
159
|
+
const promise = new Promise((resolve, reject) => {
|
|
160
|
+
if (!this.client) {
|
|
161
|
+
// The promise will be rejected, and the finally block below will release the mutex.
|
|
162
|
+
return reject(new Error('IDE client is not connected.'));
|
|
163
|
+
}
|
|
118
164
|
this.diffResponses.set(filePath, resolve);
|
|
119
165
|
this.client
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
166
|
+
.request({
|
|
167
|
+
method: 'tools/call',
|
|
168
|
+
params: {
|
|
169
|
+
name: `openDiff`,
|
|
170
|
+
arguments: {
|
|
171
|
+
filePath,
|
|
172
|
+
newContent,
|
|
173
|
+
},
|
|
125
174
|
},
|
|
175
|
+
}, CallToolResultSchema, { timeout: IDE_REQUEST_TIMEOUT_MS })
|
|
176
|
+
.then((parsedResultData) => {
|
|
177
|
+
if (parsedResultData.isError) {
|
|
178
|
+
const textPart = parsedResultData.content.find((part) => part.type === 'text');
|
|
179
|
+
const errorMessage = textPart?.text ?? `Tool 'openDiff' reported an error.`;
|
|
180
|
+
logger.debug(`Request for openDiff ${filePath} failed with isError:`, errorMessage);
|
|
181
|
+
this.diffResponses.delete(filePath);
|
|
182
|
+
reject(new Error(errorMessage));
|
|
183
|
+
}
|
|
126
184
|
})
|
|
127
185
|
.catch((err) => {
|
|
128
|
-
logger.debug(`
|
|
186
|
+
logger.debug(`Request for openDiff ${filePath} failed:`, err);
|
|
187
|
+
this.diffResponses.delete(filePath);
|
|
129
188
|
reject(err);
|
|
130
189
|
});
|
|
131
190
|
});
|
|
191
|
+
// Ensure the mutex is released only after the diff interaction is complete.
|
|
192
|
+
promise.finally(release);
|
|
193
|
+
return promise;
|
|
132
194
|
}
|
|
133
|
-
|
|
195
|
+
/**
|
|
196
|
+
* Acquires a lock to ensure sequential execution of critical sections.
|
|
197
|
+
*
|
|
198
|
+
* This method implements a promise-based mutex. It works by chaining promises.
|
|
199
|
+
* Each call to `acquireMutex` gets the current `diffMutex` promise. It then
|
|
200
|
+
* creates a *new* promise (`newMutex`) that will be resolved when the caller
|
|
201
|
+
* invokes the returned `release` function. The `diffMutex` is immediately
|
|
202
|
+
* updated to this `newMutex`.
|
|
203
|
+
*
|
|
204
|
+
* The method returns a promise that resolves with the `release` function only
|
|
205
|
+
* *after* the *previous* `diffMutex` promise has resolved. This creates a
|
|
206
|
+
* queue where each subsequent operation must wait for the previous one to release
|
|
207
|
+
* the lock.
|
|
208
|
+
*
|
|
209
|
+
* @returns A promise that resolves to a function that must be called to
|
|
210
|
+
* release the lock.
|
|
211
|
+
*/
|
|
212
|
+
acquireMutex() {
|
|
213
|
+
let release;
|
|
214
|
+
const newMutex = new Promise((resolve) => {
|
|
215
|
+
release = resolve;
|
|
216
|
+
});
|
|
217
|
+
const oldMutex = this.diffMutex;
|
|
218
|
+
this.diffMutex = newMutex;
|
|
219
|
+
return oldMutex.then(() => release);
|
|
220
|
+
}
|
|
221
|
+
async closeDiff(filePath, options) {
|
|
134
222
|
try {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
223
|
+
if (!this.client) {
|
|
224
|
+
return undefined;
|
|
225
|
+
}
|
|
226
|
+
const resultData = await this.client.request({
|
|
227
|
+
method: 'tools/call',
|
|
228
|
+
params: {
|
|
229
|
+
name: `closeDiff`,
|
|
230
|
+
arguments: {
|
|
231
|
+
filePath,
|
|
232
|
+
suppressNotification: options?.suppressNotification,
|
|
233
|
+
},
|
|
139
234
|
},
|
|
140
|
-
});
|
|
141
|
-
if (
|
|
142
|
-
|
|
143
|
-
|
|
235
|
+
}, CallToolResultSchema, { timeout: IDE_REQUEST_TIMEOUT_MS });
|
|
236
|
+
if (!resultData) {
|
|
237
|
+
return undefined;
|
|
238
|
+
}
|
|
239
|
+
if (resultData.isError) {
|
|
240
|
+
const textPart = resultData.content.find((part) => part.type === 'text');
|
|
241
|
+
const errorMessage = textPart?.text ?? `Tool 'closeDiff' reported an error.`;
|
|
242
|
+
logger.debug(`Request for closeDiff ${filePath} failed with isError:`, errorMessage);
|
|
243
|
+
return undefined;
|
|
244
|
+
}
|
|
245
|
+
const textPart = resultData.content.find((part) => part.type === 'text');
|
|
246
|
+
if (textPart?.text) {
|
|
247
|
+
try {
|
|
248
|
+
const parsedJson = JSON.parse(textPart.text);
|
|
249
|
+
if (parsedJson && typeof parsedJson.content === 'string') {
|
|
250
|
+
return parsedJson.content;
|
|
251
|
+
}
|
|
252
|
+
if (parsedJson && parsedJson.content === null) {
|
|
253
|
+
return undefined;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
catch (_e) {
|
|
257
|
+
logger.debug(`Invalid JSON in closeDiff response for ${filePath}:`, textPart.text);
|
|
258
|
+
}
|
|
144
259
|
}
|
|
145
260
|
}
|
|
146
261
|
catch (err) {
|
|
147
|
-
logger.debug(`
|
|
262
|
+
logger.debug(`Request for closeDiff ${filePath} failed:`, err);
|
|
148
263
|
}
|
|
149
|
-
return;
|
|
264
|
+
return undefined;
|
|
150
265
|
}
|
|
151
266
|
// Closes the diff. Instead of waiting for a notification,
|
|
152
267
|
// manually resolves the diff resolver as the desired outcome.
|
|
153
268
|
async resolveDiffFromCli(filePath, outcome) {
|
|
154
|
-
const content = await this.closeDiff(filePath);
|
|
155
269
|
const resolver = this.diffResponses.get(filePath);
|
|
270
|
+
const content = await this.closeDiff(filePath, {
|
|
271
|
+
// Suppress notification to avoid race where closing the diff rejects the
|
|
272
|
+
// request.
|
|
273
|
+
suppressNotification: true,
|
|
274
|
+
});
|
|
156
275
|
if (resolver) {
|
|
157
276
|
if (outcome === 'accepted') {
|
|
158
277
|
resolver({ status: 'accepted', content });
|
|
@@ -181,7 +300,42 @@ export class IdeClient {
|
|
|
181
300
|
return this.state;
|
|
182
301
|
}
|
|
183
302
|
getDetectedIdeDisplayName() {
|
|
184
|
-
return this.
|
|
303
|
+
return this.currentIde?.displayName;
|
|
304
|
+
}
|
|
305
|
+
isDiffingEnabled() {
|
|
306
|
+
return (!!this.client &&
|
|
307
|
+
this.state.status === IDEConnectionStatus.Connected &&
|
|
308
|
+
this.availableTools.includes('openDiff') &&
|
|
309
|
+
this.availableTools.includes('closeDiff'));
|
|
310
|
+
}
|
|
311
|
+
async discoverTools() {
|
|
312
|
+
if (!this.client) {
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
try {
|
|
316
|
+
logger.debug('Discovering tools from IDE...');
|
|
317
|
+
const response = await this.client.request({ method: 'tools/list', params: {} }, ListToolsResultSchema);
|
|
318
|
+
// Map the array of tool objects to an array of tool names (strings)
|
|
319
|
+
this.availableTools = response.tools.map((tool) => tool.name);
|
|
320
|
+
if (this.availableTools.length > 0) {
|
|
321
|
+
logger.debug(`Discovered ${this.availableTools.length} tools from IDE: ${this.availableTools.join(', ')}`);
|
|
322
|
+
}
|
|
323
|
+
else {
|
|
324
|
+
logger.debug('IDE supports tool discovery, but no tools are available.');
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
catch (error) {
|
|
328
|
+
// It's okay if this fails, the IDE might not support it.
|
|
329
|
+
// Don't log an error if the method is not found, which is a common case.
|
|
330
|
+
if (error instanceof Error &&
|
|
331
|
+
!error.message?.includes('Method not found')) {
|
|
332
|
+
logger.error(`Error discovering tools from IDE: ${error.message}`);
|
|
333
|
+
}
|
|
334
|
+
else {
|
|
335
|
+
logger.debug('IDE does not support tool discovery.');
|
|
336
|
+
}
|
|
337
|
+
this.availableTools = [];
|
|
338
|
+
}
|
|
185
339
|
}
|
|
186
340
|
setState(status, details, logToConsole = false) {
|
|
187
341
|
const isAlreadyDisconnected = this.state.status === IDEConnectionStatus.Disconnected &&
|
|
@@ -205,20 +359,20 @@ export class IdeClient {
|
|
|
205
359
|
}
|
|
206
360
|
}
|
|
207
361
|
if (status === IDEConnectionStatus.Disconnected) {
|
|
208
|
-
|
|
362
|
+
ideContextStore.clear();
|
|
209
363
|
}
|
|
210
364
|
}
|
|
211
|
-
static validateWorkspacePath(ideWorkspacePath,
|
|
365
|
+
static validateWorkspacePath(ideWorkspacePath, cwd) {
|
|
212
366
|
if (ideWorkspacePath === undefined) {
|
|
213
367
|
return {
|
|
214
368
|
isValid: false,
|
|
215
|
-
error: `Failed to connect to IDE companion extension
|
|
369
|
+
error: `Failed to connect to IDE companion extension. Please ensure the extension is running. To install the extension, run /ide install.`,
|
|
216
370
|
};
|
|
217
371
|
}
|
|
218
372
|
if (ideWorkspacePath === '') {
|
|
219
373
|
return {
|
|
220
374
|
isValid: false,
|
|
221
|
-
error: `To use this feature, please open a workspace folder in
|
|
375
|
+
error: `To use this feature, please open a workspace folder in your IDE and try again.`,
|
|
222
376
|
};
|
|
223
377
|
}
|
|
224
378
|
const ideWorkspacePaths = ideWorkspacePath.split(path.delimiter);
|
|
@@ -230,7 +384,7 @@ export class IdeClient {
|
|
|
230
384
|
if (!isWithinWorkspace) {
|
|
231
385
|
return {
|
|
232
386
|
isValid: false,
|
|
233
|
-
error: `Directory mismatch. Gemini CLI is running in a different location than the open workspace in
|
|
387
|
+
error: `Directory mismatch. Gemini CLI is running in a different location than the open workspace in the IDE. Please run the CLI from one of the following directories: ${ideWorkspacePaths.join(', ')}`,
|
|
234
388
|
};
|
|
235
389
|
}
|
|
236
390
|
return { isValid: true };
|
|
@@ -242,20 +396,102 @@ export class IdeClient {
|
|
|
242
396
|
}
|
|
243
397
|
return port;
|
|
244
398
|
}
|
|
245
|
-
|
|
399
|
+
getStdioConfigFromEnv() {
|
|
400
|
+
const command = process.env['GEMINI_CLI_IDE_SERVER_STDIO_COMMAND'];
|
|
401
|
+
if (!command) {
|
|
402
|
+
return undefined;
|
|
403
|
+
}
|
|
404
|
+
const argsStr = process.env['GEMINI_CLI_IDE_SERVER_STDIO_ARGS'];
|
|
405
|
+
let args = [];
|
|
406
|
+
if (argsStr) {
|
|
407
|
+
try {
|
|
408
|
+
const parsedArgs = JSON.parse(argsStr);
|
|
409
|
+
if (Array.isArray(parsedArgs)) {
|
|
410
|
+
args = parsedArgs;
|
|
411
|
+
}
|
|
412
|
+
else {
|
|
413
|
+
logger.error('GEMINI_CLI_IDE_SERVER_STDIO_ARGS must be a JSON array string.');
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
catch (e) {
|
|
417
|
+
logger.error('Failed to parse GEMINI_CLI_IDE_SERVER_STDIO_ARGS:', e);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
return { command, args };
|
|
421
|
+
}
|
|
422
|
+
async getConnectionConfigFromFile() {
|
|
423
|
+
if (!this.ideProcessInfo) {
|
|
424
|
+
return undefined;
|
|
425
|
+
}
|
|
426
|
+
// For backwards compatability
|
|
246
427
|
try {
|
|
247
|
-
const
|
|
248
|
-
const portFile = path.join(os.tmpdir(), `gemini-ide-server-${ideProcessId}.json`);
|
|
428
|
+
const portFile = path.join(os.tmpdir(), `gemini-ide-server-${this.ideProcessInfo.pid}.json`);
|
|
249
429
|
const portFileContents = await fs.promises.readFile(portFile, 'utf8');
|
|
250
|
-
|
|
251
|
-
return {
|
|
252
|
-
port: ideInfo?.port?.toString(),
|
|
253
|
-
workspacePath: ideInfo?.workspacePath,
|
|
254
|
-
};
|
|
430
|
+
return JSON.parse(portFileContents);
|
|
255
431
|
}
|
|
256
432
|
catch (_) {
|
|
257
|
-
|
|
433
|
+
// For newer extension versions, the file name matches the pattern
|
|
434
|
+
// /^gemini-ide-server-${pid}-\d+\.json$/. If multiple IDE
|
|
435
|
+
// windows are open, multiple files matching the pattern are expected to
|
|
436
|
+
// exist.
|
|
437
|
+
}
|
|
438
|
+
const portFileDir = path.join(os.tmpdir(), 'gemini', 'ide');
|
|
439
|
+
let portFiles;
|
|
440
|
+
try {
|
|
441
|
+
portFiles = await fs.promises.readdir(portFileDir);
|
|
442
|
+
}
|
|
443
|
+
catch (e) {
|
|
444
|
+
logger.debug('Failed to read IDE connection directory:', e);
|
|
445
|
+
return undefined;
|
|
446
|
+
}
|
|
447
|
+
if (!portFiles) {
|
|
448
|
+
return undefined;
|
|
449
|
+
}
|
|
450
|
+
const fileRegex = new RegExp(`^gemini-ide-server-${this.ideProcessInfo.pid}-\\d+\\.json$`);
|
|
451
|
+
const matchingFiles = portFiles
|
|
452
|
+
.filter((file) => fileRegex.test(file))
|
|
453
|
+
.sort();
|
|
454
|
+
if (matchingFiles.length === 0) {
|
|
455
|
+
return undefined;
|
|
456
|
+
}
|
|
457
|
+
let fileContents;
|
|
458
|
+
try {
|
|
459
|
+
fileContents = await Promise.all(matchingFiles.map((file) => fs.promises.readFile(path.join(portFileDir, file), 'utf8')));
|
|
460
|
+
}
|
|
461
|
+
catch (e) {
|
|
462
|
+
logger.debug('Failed to read IDE connection config file(s):', e);
|
|
463
|
+
return undefined;
|
|
258
464
|
}
|
|
465
|
+
const parsedContents = fileContents.map((content) => {
|
|
466
|
+
try {
|
|
467
|
+
return JSON.parse(content);
|
|
468
|
+
}
|
|
469
|
+
catch (e) {
|
|
470
|
+
logger.debug('Failed to parse JSON from config file: ', e);
|
|
471
|
+
return undefined;
|
|
472
|
+
}
|
|
473
|
+
});
|
|
474
|
+
const validWorkspaces = parsedContents.filter((content) => {
|
|
475
|
+
if (!content) {
|
|
476
|
+
return false;
|
|
477
|
+
}
|
|
478
|
+
const { isValid } = IdeClient.validateWorkspacePath(content.workspacePath, process.cwd());
|
|
479
|
+
return isValid;
|
|
480
|
+
});
|
|
481
|
+
if (validWorkspaces.length === 0) {
|
|
482
|
+
return undefined;
|
|
483
|
+
}
|
|
484
|
+
if (validWorkspaces.length === 1) {
|
|
485
|
+
return validWorkspaces[0];
|
|
486
|
+
}
|
|
487
|
+
const portFromEnv = this.getPortFromEnv();
|
|
488
|
+
if (portFromEnv) {
|
|
489
|
+
const matchingPort = validWorkspaces.find((content) => String(content.port) === portFromEnv);
|
|
490
|
+
if (matchingPort) {
|
|
491
|
+
return matchingPort;
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
return validWorkspaces[0];
|
|
259
495
|
}
|
|
260
496
|
createProxyAwareFetch() {
|
|
261
497
|
// ignore proxy for 'localhost' by deafult to allow connecting to the ide mcp server
|
|
@@ -275,7 +511,7 @@ export class IdeClient {
|
|
|
275
511
|
return new Response(response.body, {
|
|
276
512
|
status: response.status,
|
|
277
513
|
statusText: response.statusText,
|
|
278
|
-
headers:
|
|
514
|
+
headers: [...response.headers.entries()],
|
|
279
515
|
});
|
|
280
516
|
};
|
|
281
517
|
}
|
|
@@ -284,13 +520,20 @@ export class IdeClient {
|
|
|
284
520
|
return;
|
|
285
521
|
}
|
|
286
522
|
this.client.setNotificationHandler(IdeContextNotificationSchema, (notification) => {
|
|
287
|
-
|
|
523
|
+
ideContextStore.set(notification.params);
|
|
524
|
+
const isTrusted = notification.params.workspaceState?.isTrusted;
|
|
525
|
+
if (isTrusted !== undefined) {
|
|
526
|
+
for (const listener of this.trustChangeListeners) {
|
|
527
|
+
listener(isTrusted);
|
|
528
|
+
}
|
|
529
|
+
}
|
|
288
530
|
});
|
|
289
531
|
this.client.onerror = (_error) => {
|
|
290
|
-
|
|
532
|
+
const errorMessage = _error instanceof Error ? _error.message : `_error`;
|
|
533
|
+
this.setState(IDEConnectionStatus.Disconnected, `IDE connection error. The connection was lost unexpectedly. Please try reconnecting by running /ide enable\n${errorMessage}`, true);
|
|
291
534
|
};
|
|
292
535
|
this.client.onclose = () => {
|
|
293
|
-
this.setState(IDEConnectionStatus.Disconnected, `IDE connection
|
|
536
|
+
this.setState(IDEConnectionStatus.Disconnected, `IDE connection closed. To reconnect, run /ide enable.`, true);
|
|
294
537
|
};
|
|
295
538
|
this.client.setNotificationHandler(IdeDiffAcceptedNotificationSchema, (notification) => {
|
|
296
539
|
const { filePath, content } = notification.params;
|
|
@@ -303,6 +546,19 @@ export class IdeClient {
|
|
|
303
546
|
logger.debug(`No resolver found for ${filePath}`);
|
|
304
547
|
}
|
|
305
548
|
});
|
|
549
|
+
this.client.setNotificationHandler(IdeDiffRejectedNotificationSchema, (notification) => {
|
|
550
|
+
const { filePath } = notification.params;
|
|
551
|
+
const resolver = this.diffResponses.get(filePath);
|
|
552
|
+
if (resolver) {
|
|
553
|
+
resolver({ status: 'rejected', content: undefined });
|
|
554
|
+
this.diffResponses.delete(filePath);
|
|
555
|
+
}
|
|
556
|
+
else {
|
|
557
|
+
logger.debug(`No resolver found for ${filePath}`);
|
|
558
|
+
}
|
|
559
|
+
});
|
|
560
|
+
// For backwards compatability. Newer extension versions will only send
|
|
561
|
+
// IdeDiffRejectedNotificationSchema.
|
|
306
562
|
this.client.setNotificationHandler(IdeDiffClosedNotificationSchema, (notification) => {
|
|
307
563
|
const { filePath } = notification.params;
|
|
308
564
|
const resolver = this.diffResponses.get(filePath);
|
|
@@ -315,9 +571,10 @@ export class IdeClient {
|
|
|
315
571
|
}
|
|
316
572
|
});
|
|
317
573
|
}
|
|
318
|
-
async
|
|
574
|
+
async establishHttpConnection(port) {
|
|
319
575
|
let transport;
|
|
320
576
|
try {
|
|
577
|
+
logger.debug('Attempting to connect to IDE via HTTP SSE');
|
|
321
578
|
this.client = new Client({
|
|
322
579
|
name: 'streamable-http-client',
|
|
323
580
|
// TODO(#3487): use the CLI version here.
|
|
@@ -325,9 +582,46 @@ export class IdeClient {
|
|
|
325
582
|
});
|
|
326
583
|
transport = new StreamableHTTPClientTransport(new URL(`http://${getIdeServerHost()}:${port}/mcp`), {
|
|
327
584
|
fetch: this.createProxyAwareFetch(),
|
|
585
|
+
requestInit: {
|
|
586
|
+
headers: this.authToken
|
|
587
|
+
? { Authorization: `Bearer ${this.authToken}` }
|
|
588
|
+
: {},
|
|
589
|
+
},
|
|
590
|
+
});
|
|
591
|
+
await this.client.connect(transport);
|
|
592
|
+
this.registerClientHandlers();
|
|
593
|
+
await this.discoverTools();
|
|
594
|
+
this.setState(IDEConnectionStatus.Connected);
|
|
595
|
+
return true;
|
|
596
|
+
}
|
|
597
|
+
catch (_error) {
|
|
598
|
+
if (transport) {
|
|
599
|
+
try {
|
|
600
|
+
await transport.close();
|
|
601
|
+
}
|
|
602
|
+
catch (closeError) {
|
|
603
|
+
logger.debug('Failed to close transport:', closeError);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
return false;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
async establishStdioConnection({ command, args, }) {
|
|
610
|
+
let transport;
|
|
611
|
+
try {
|
|
612
|
+
logger.debug('Attempting to connect to IDE via stdio');
|
|
613
|
+
this.client = new Client({
|
|
614
|
+
name: 'stdio-client',
|
|
615
|
+
// TODO(#3487): use the CLI version here.
|
|
616
|
+
version: '1.0.0',
|
|
617
|
+
});
|
|
618
|
+
transport = new StdioClientTransport({
|
|
619
|
+
command,
|
|
620
|
+
args,
|
|
328
621
|
});
|
|
329
622
|
await this.client.connect(transport);
|
|
330
623
|
this.registerClientHandlers();
|
|
624
|
+
await this.discoverTools();
|
|
331
625
|
this.setState(IDEConnectionStatus.Connected);
|
|
332
626
|
return true;
|
|
333
627
|
}
|