@office-ai/aioncli-core 0.8.1 → 0.18.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/dist/index.d.ts +8 -2
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/src/agents/codebase-investigator.d.ts +36 -1
- package/dist/src/agents/codebase-investigator.js +93 -34
- package/dist/src/agents/codebase-investigator.js.map +1 -1
- package/dist/src/agents/codebase-investigator.test.d.ts +6 -0
- package/dist/src/agents/codebase-investigator.test.js +35 -0
- package/dist/src/agents/codebase-investigator.test.js.map +1 -0
- package/dist/src/agents/executor.d.ts +37 -11
- package/dist/src/agents/executor.js +512 -150
- package/dist/src/agents/executor.js.map +1 -1
- package/dist/src/agents/executor.test.js +1188 -245
- package/dist/src/agents/executor.test.js.map +1 -1
- package/dist/src/agents/invocation.d.ts +5 -2
- package/dist/src/agents/invocation.js +4 -2
- package/dist/src/agents/invocation.js.map +1 -1
- package/dist/src/agents/invocation.test.js +9 -0
- package/dist/src/agents/invocation.test.js.map +1 -1
- package/dist/src/agents/registry.d.ts +6 -1
- package/dist/src/agents/registry.js +51 -4
- package/dist/src/agents/registry.js.map +1 -1
- package/dist/src/agents/registry.test.js +30 -16
- package/dist/src/agents/registry.test.js.map +1 -1
- package/dist/src/agents/subagent-tool-wrapper.d.ts +3 -1
- package/dist/src/agents/subagent-tool-wrapper.js +4 -3
- package/dist/src/agents/subagent-tool-wrapper.js.map +1 -1
- package/dist/src/agents/subagent-tool-wrapper.test.js +9 -4
- package/dist/src/agents/subagent-tool-wrapper.test.js.map +1 -1
- package/dist/src/agents/types.d.ts +37 -7
- package/dist/src/agents/types.js +2 -0
- package/dist/src/agents/types.js.map +1 -1
- package/dist/src/code_assist/codeAssist.js +1 -1
- package/dist/src/code_assist/codeAssist.test.d.ts +6 -0
- package/dist/src/code_assist/codeAssist.test.js +99 -0
- package/dist/src/code_assist/codeAssist.test.js.map +1 -0
- package/dist/src/code_assist/converter.d.ts +1 -0
- package/dist/src/code_assist/converter.js +1 -0
- package/dist/src/code_assist/converter.js.map +1 -1
- package/dist/src/code_assist/converter.test.js +19 -0
- package/dist/src/code_assist/converter.test.js.map +1 -1
- package/dist/src/code_assist/experiments/client_metadata.d.ts +12 -0
- package/dist/src/code_assist/experiments/client_metadata.js +50 -0
- package/dist/src/code_assist/experiments/client_metadata.js.map +1 -0
- package/dist/src/code_assist/experiments/client_metadata.test.d.ts +6 -0
- package/dist/src/code_assist/experiments/client_metadata.test.js +99 -0
- package/dist/src/code_assist/experiments/client_metadata.test.js.map +1 -0
- package/dist/src/code_assist/experiments/experiments.d.ts +17 -0
- package/dist/src/code_assist/experiments/experiments.js +36 -0
- package/dist/src/code_assist/experiments/experiments.js.map +1 -0
- package/dist/src/code_assist/experiments/experiments.test.d.ts +6 -0
- package/dist/src/code_assist/experiments/experiments.test.js +92 -0
- package/dist/src/code_assist/experiments/experiments.test.js.map +1 -0
- package/dist/src/code_assist/experiments/flagNames.d.ts +13 -0
- package/dist/src/code_assist/experiments/flagNames.js +13 -0
- package/dist/src/code_assist/experiments/flagNames.js.map +1 -0
- package/dist/src/code_assist/experiments/types.d.ts +35 -0
- package/dist/src/code_assist/experiments/types.js +7 -0
- package/dist/src/code_assist/experiments/types.js.map +1 -0
- package/dist/src/code_assist/oauth-credential-storage.js +6 -5
- package/dist/src/code_assist/oauth-credential-storage.js.map +1 -1
- package/dist/src/code_assist/oauth-credential-storage.test.js +65 -3
- package/dist/src/code_assist/oauth-credential-storage.test.js.map +1 -1
- package/dist/src/code_assist/oauth2.d.ts +2 -2
- package/dist/src/code_assist/oauth2.js +161 -93
- package/dist/src/code_assist/oauth2.js.map +1 -1
- package/dist/src/code_assist/oauth2.test.js +103 -57
- package/dist/src/code_assist/oauth2.test.js.map +1 -1
- package/dist/src/code_assist/server.d.ts +6 -4
- package/dist/src/code_assist/server.js +16 -8
- package/dist/src/code_assist/server.js.map +1 -1
- package/dist/src/code_assist/server.test.js +126 -28
- package/dist/src/code_assist/server.test.js.map +1 -1
- package/dist/src/code_assist/setup.d.ts +2 -2
- package/dist/src/code_assist/setup.js +4 -2
- package/dist/src/code_assist/setup.js.map +1 -1
- package/dist/src/code_assist/types.d.ts +1 -1
- package/dist/src/code_assist/types.js.map +1 -1
- package/dist/src/commands/extensions.d.ts +7 -0
- package/dist/src/commands/extensions.js +9 -0
- package/dist/src/commands/extensions.js.map +1 -0
- package/dist/src/commands/extensions.test.d.ts +6 -0
- package/dist/src/commands/extensions.test.js +19 -0
- package/dist/src/commands/extensions.test.js.map +1 -0
- package/dist/src/config/config.d.ts +169 -43
- package/dist/src/config/config.js +418 -79
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/config.test.js +684 -49
- package/dist/src/config/config.test.js.map +1 -1
- package/dist/src/config/defaultModelConfigs.d.ts +7 -0
- package/dist/src/config/defaultModelConfigs.js +185 -0
- package/dist/src/config/defaultModelConfigs.js.map +1 -0
- package/dist/src/config/models.d.ts +23 -2
- package/dist/src/config/models.js +50 -7
- package/dist/src/config/models.js.map +1 -1
- package/dist/src/config/models.test.js +71 -10
- package/dist/src/config/models.test.js.map +1 -1
- package/dist/src/config/storage.d.ts +3 -1
- package/dist/src/config/storage.js +22 -2
- package/dist/src/config/storage.js.map +1 -1
- package/dist/src/config/storage.test.js +7 -6
- package/dist/src/config/storage.test.js.map +1 -1
- package/dist/src/confirmation-bus/message-bus.d.ts +3 -2
- package/dist/src/confirmation-bus/message-bus.js +9 -3
- package/dist/src/confirmation-bus/message-bus.js.map +1 -1
- package/dist/src/confirmation-bus/message-bus.test.js +30 -24
- package/dist/src/confirmation-bus/message-bus.test.js.map +1 -1
- package/dist/src/confirmation-bus/types.d.ts +13 -2
- package/dist/src/confirmation-bus/types.js +1 -0
- package/dist/src/confirmation-bus/types.js.map +1 -1
- package/dist/src/core/apiKeyCredentialStorage.d.ts +17 -0
- package/dist/src/core/apiKeyCredentialStorage.js +64 -0
- package/dist/src/core/apiKeyCredentialStorage.js.map +1 -0
- package/dist/src/core/apiKeyCredentialStorage.test.d.ts +6 -0
- package/dist/src/core/apiKeyCredentialStorage.test.js +71 -0
- package/dist/src/core/apiKeyCredentialStorage.test.js.map +1 -0
- package/dist/src/core/baseLlmClient.d.ts +4 -8
- package/dist/src/core/baseLlmClient.js +6 -11
- package/dist/src/core/baseLlmClient.js.map +1 -1
- package/dist/src/core/baseLlmClient.test.js +22 -27
- package/dist/src/core/baseLlmClient.test.js.map +1 -1
- package/dist/src/core/client.d.ts +12 -19
- package/dist/src/core/client.js +104 -206
- package/dist/src/core/client.js.map +1 -1
- package/dist/src/core/client.test.js +329 -452
- package/dist/src/core/client.test.js.map +1 -1
- package/dist/src/core/contentGenerator.d.ts +3 -2
- package/dist/src/core/contentGenerator.js +56 -41
- package/dist/src/core/contentGenerator.js.map +1 -1
- package/dist/src/core/contentGenerator.test.js +49 -1
- package/dist/src/core/contentGenerator.test.js.map +1 -1
- package/dist/src/core/coreToolScheduler.d.ts +8 -4
- package/dist/src/core/coreToolScheduler.js +348 -179
- package/dist/src/core/coreToolScheduler.js.map +1 -1
- package/dist/src/core/coreToolScheduler.test.js +575 -219
- package/dist/src/core/coreToolScheduler.test.js.map +1 -1
- package/dist/src/core/fakeContentGenerator.d.ts +33 -0
- package/dist/src/core/fakeContentGenerator.js +58 -0
- package/dist/src/core/fakeContentGenerator.js.map +1 -0
- package/dist/src/core/fakeContentGenerator.test.d.ts +6 -0
- package/dist/src/core/fakeContentGenerator.test.js +127 -0
- package/dist/src/core/fakeContentGenerator.test.js.map +1 -0
- package/dist/src/core/geminiChat.d.ts +23 -18
- package/dist/src/core/geminiChat.js +186 -108
- package/dist/src/core/geminiChat.js.map +1 -1
- package/dist/src/core/geminiChat.test.js +581 -270
- package/dist/src/core/geminiChat.test.js.map +1 -1
- package/dist/src/core/logger.d.ts +7 -2
- package/dist/src/core/logger.js +35 -27
- package/dist/src/core/logger.js.map +1 -1
- package/dist/src/core/logger.test.js +45 -29
- package/dist/src/core/logger.test.js.map +1 -1
- package/dist/src/core/loggingContentGenerator.d.ts +1 -0
- package/dist/src/core/loggingContentGenerator.js +113 -33
- package/dist/src/core/loggingContentGenerator.js.map +1 -1
- package/dist/src/core/loggingContentGenerator.test.d.ts +6 -0
- package/dist/src/core/loggingContentGenerator.test.js +180 -0
- package/dist/src/core/loggingContentGenerator.test.js.map +1 -0
- package/dist/src/core/nonInteractiveToolExecutor.d.ts +3 -2
- package/dist/src/core/nonInteractiveToolExecutor.js +12 -7
- package/dist/src/core/nonInteractiveToolExecutor.js.map +1 -1
- package/dist/src/core/nonInteractiveToolExecutor.test.js +12 -8
- package/dist/src/core/nonInteractiveToolExecutor.test.js.map +1 -1
- package/dist/src/core/openaiContentGenerator.js +31 -8
- package/dist/src/core/openaiContentGenerator.js.map +1 -1
- package/dist/src/core/prompts.d.ts +2 -1
- package/dist/src/core/prompts.js +135 -154
- package/dist/src/core/prompts.js.map +1 -1
- package/dist/src/core/prompts.test.js +128 -189
- package/dist/src/core/prompts.test.js.map +1 -1
- package/dist/src/core/recordingContentGenerator.d.ts +18 -0
- package/dist/src/core/recordingContentGenerator.js +77 -0
- package/dist/src/core/recordingContentGenerator.js.map +1 -0
- package/dist/src/core/recordingContentGenerator.test.d.ts +6 -0
- package/dist/src/core/recordingContentGenerator.test.js +101 -0
- package/dist/src/core/recordingContentGenerator.test.js.map +1 -0
- package/dist/src/core/tokenLimits.test.d.ts +6 -0
- package/dist/src/core/tokenLimits.test.js +26 -0
- package/dist/src/core/tokenLimits.test.js.map +1 -0
- package/dist/src/core/turn.d.ts +23 -3
- package/dist/src/core/turn.js +18 -9
- package/dist/src/core/turn.js.map +1 -1
- package/dist/src/core/turn.test.js +98 -104
- package/dist/src/core/turn.test.js.map +1 -1
- package/dist/src/fallback/handler.js +60 -8
- package/dist/src/fallback/handler.js.map +1 -1
- package/dist/src/fallback/handler.test.js +132 -17
- package/dist/src/fallback/handler.test.js.map +1 -1
- package/dist/src/fallback/types.d.ts +1 -1
- package/dist/src/generated/git-commit.d.ts +2 -2
- package/dist/src/generated/git-commit.js +2 -2
- package/dist/src/generated/git-commit.js.map +1 -1
- package/dist/src/hooks/hookAggregator.d.ts +68 -0
- package/dist/src/hooks/hookAggregator.js +262 -0
- package/dist/src/hooks/hookAggregator.js.map +1 -0
- package/dist/src/hooks/hookAggregator.test.d.ts +6 -0
- package/dist/src/hooks/hookAggregator.test.js +387 -0
- package/dist/src/hooks/hookAggregator.test.js.map +1 -0
- package/dist/src/hooks/hookPlanner.d.ts +46 -0
- package/dist/src/hooks/hookPlanner.js +108 -0
- package/dist/src/hooks/hookPlanner.js.map +1 -0
- package/dist/src/hooks/hookPlanner.test.d.ts +6 -0
- package/dist/src/hooks/hookPlanner.test.js +255 -0
- package/dist/src/hooks/hookPlanner.test.js.map +1 -0
- package/dist/src/hooks/hookRegistry.d.ts +87 -0
- package/dist/src/hooks/hookRegistry.js +198 -0
- package/dist/src/hooks/hookRegistry.js.map +1 -0
- package/dist/src/hooks/hookRegistry.test.d.ts +6 -0
- package/dist/src/hooks/hookRegistry.test.js +341 -0
- package/dist/src/hooks/hookRegistry.test.js.map +1 -0
- package/dist/src/hooks/hookRunner.d.ts +42 -0
- package/dist/src/hooks/hookRunner.js +272 -0
- package/dist/src/hooks/hookRunner.js.map +1 -0
- package/dist/src/hooks/hookRunner.test.d.ts +6 -0
- package/dist/src/hooks/hookRunner.test.js +468 -0
- package/dist/src/hooks/hookRunner.test.js.map +1 -0
- package/dist/src/hooks/hookTranslator.d.ts +113 -0
- package/dist/src/hooks/hookTranslator.js +232 -0
- package/dist/src/hooks/hookTranslator.js.map +1 -0
- package/dist/src/hooks/hookTranslator.test.d.ts +6 -0
- package/dist/src/hooks/hookTranslator.test.js +192 -0
- package/dist/src/hooks/hookTranslator.test.js.map +1 -0
- package/dist/src/hooks/types.d.ts +384 -0
- package/dist/src/hooks/types.js +284 -0
- package/dist/src/hooks/types.js.map +1 -0
- package/dist/src/hooks/types.test.d.ts +6 -0
- package/dist/src/hooks/types.test.js +313 -0
- package/dist/src/hooks/types.test.js.map +1 -0
- package/dist/src/ide/detect-ide.d.ts +4 -0
- package/dist/src/ide/detect-ide.js +6 -1
- package/dist/src/ide/detect-ide.js.map +1 -1
- package/dist/src/ide/detect-ide.test.js +16 -0
- package/dist/src/ide/detect-ide.test.js.map +1 -1
- package/dist/src/ide/ide-client.d.ts +3 -1
- package/dist/src/ide/ide-client.js +12 -10
- package/dist/src/ide/ide-client.js.map +1 -1
- package/dist/src/ide/ide-client.test.js +163 -4
- package/dist/src/ide/ide-client.test.js.map +1 -1
- package/dist/src/ide/ide-installer.js +66 -21
- package/dist/src/ide/ide-installer.js.map +1 -1
- package/dist/src/ide/ide-installer.test.js +54 -1
- package/dist/src/ide/ide-installer.test.js.map +1 -1
- package/dist/src/ide/process-utils.js +85 -75
- package/dist/src/ide/process-utils.js.map +1 -1
- package/dist/src/ide/process-utils.test.js +83 -90
- package/dist/src/ide/process-utils.test.js.map +1 -1
- package/dist/src/ide/types.d.ts +1 -1
- package/dist/src/ide/types.js +1 -1
- package/dist/src/index.d.ts +21 -0
- package/dist/src/index.js +24 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/google-auth-provider.d.ts +2 -0
- package/dist/src/mcp/google-auth-provider.js +21 -3
- package/dist/src/mcp/google-auth-provider.js.map +1 -1
- package/dist/src/mcp/google-auth-provider.test.js +42 -9
- package/dist/src/mcp/google-auth-provider.test.js.map +1 -1
- package/dist/src/mcp/oauth-provider.d.ts +8 -5
- package/dist/src/mcp/oauth-provider.js +140 -55
- package/dist/src/mcp/oauth-provider.js.map +1 -1
- package/dist/src/mcp/oauth-provider.test.js +369 -2
- package/dist/src/mcp/oauth-provider.test.js.map +1 -1
- package/dist/src/mcp/oauth-token-storage.js +5 -4
- package/dist/src/mcp/oauth-token-storage.js.map +1 -1
- package/dist/src/mcp/oauth-token-storage.test.js +17 -11
- package/dist/src/mcp/oauth-token-storage.test.js.map +1 -1
- package/dist/src/mcp/oauth-utils.d.ts +7 -0
- package/dist/src/mcp/oauth-utils.js +28 -8
- package/dist/src/mcp/oauth-utils.js.map +1 -1
- package/dist/src/mcp/oauth-utils.test.js +45 -2
- package/dist/src/mcp/oauth-utils.test.js.map +1 -1
- package/dist/src/mcp/sa-impersonation-provider.d.ts +0 -6
- package/dist/src/mcp/sa-impersonation-provider.js +6 -23
- package/dist/src/mcp/sa-impersonation-provider.js.map +1 -1
- package/dist/src/mcp/token-storage/base-token-storage.test.js +75 -84
- package/dist/src/mcp/token-storage/base-token-storage.test.js.map +1 -1
- package/dist/src/mcp/token-storage/file-token-storage.js +3 -2
- package/dist/src/mcp/token-storage/file-token-storage.js.map +1 -1
- package/dist/src/mcp/token-storage/file-token-storage.test.js +11 -8
- package/dist/src/mcp/token-storage/file-token-storage.test.js.map +1 -1
- package/dist/src/mcp/token-storage/keychain-token-storage.d.ts +6 -2
- package/dist/src/mcp/token-storage/keychain-token-storage.js +63 -7
- package/dist/src/mcp/token-storage/keychain-token-storage.js.map +1 -1
- package/dist/src/mcp/token-storage/keychain-token-storage.test.js +54 -3
- package/dist/src/mcp/token-storage/keychain-token-storage.test.js.map +1 -1
- package/dist/src/mcp/token-storage/types.d.ts +6 -0
- package/dist/src/mcp/token-storage/types.js.map +1 -1
- package/dist/src/output/stream-json-formatter.d.ts +32 -0
- package/dist/src/output/stream-json-formatter.js +52 -0
- package/dist/src/output/stream-json-formatter.js.map +1 -0
- package/dist/src/output/stream-json-formatter.test.d.ts +6 -0
- package/dist/src/output/stream-json-formatter.test.js +479 -0
- package/dist/src/output/stream-json-formatter.test.js.map +1 -0
- package/dist/src/output/types.d.ts +63 -1
- package/dist/src/output/types.js +11 -0
- package/dist/src/output/types.js.map +1 -1
- package/dist/src/policy/config.d.ts +31 -0
- package/dist/src/policy/config.js +199 -0
- package/dist/src/policy/config.js.map +1 -0
- package/dist/src/policy/config.test.d.ts +6 -0
- package/dist/src/policy/config.test.js +538 -0
- package/dist/src/policy/config.test.js.map +1 -0
- package/dist/src/policy/index.d.ts +2 -0
- package/dist/src/policy/index.js +2 -0
- package/dist/src/policy/index.js.map +1 -1
- package/dist/src/policy/policies/discovered.toml +8 -0
- package/dist/src/policy/policies/read-only.toml +56 -0
- package/dist/src/policy/policies/write.toml +73 -0
- package/dist/src/policy/policies/yolo.toml +31 -0
- package/dist/src/policy/policy-engine.d.ts +12 -3
- package/dist/src/policy/policy-engine.js +74 -8
- package/dist/src/policy/policy-engine.js.map +1 -1
- package/dist/src/policy/policy-engine.test.js +460 -76
- package/dist/src/policy/policy-engine.test.js.map +1 -1
- package/dist/src/policy/toml-loader.d.ts +47 -0
- package/dist/src/policy/toml-loader.js +411 -0
- package/dist/src/policy/toml-loader.js.map +1 -0
- package/dist/src/policy/toml-loader.test.d.ts +6 -0
- package/dist/src/policy/toml-loader.test.js +376 -0
- package/dist/src/policy/toml-loader.test.js.map +1 -0
- package/dist/src/policy/types.d.ts +83 -0
- package/dist/src/policy/types.js +10 -0
- package/dist/src/policy/types.js.map +1 -1
- package/dist/src/prompts/mcp-prompts.test.d.ts +6 -0
- package/dist/src/prompts/mcp-prompts.test.js +39 -0
- package/dist/src/prompts/mcp-prompts.test.js.map +1 -0
- package/dist/src/prompts/prompt-registry.js +2 -1
- package/dist/src/prompts/prompt-registry.js.map +1 -1
- package/dist/src/prompts/prompt-registry.test.d.ts +6 -0
- package/dist/src/prompts/prompt-registry.test.js +96 -0
- package/dist/src/prompts/prompt-registry.test.js.map +1 -0
- package/dist/src/routing/modelRouterService.js +15 -0
- package/dist/src/routing/modelRouterService.js.map +1 -1
- package/dist/src/routing/modelRouterService.test.js +62 -0
- package/dist/src/routing/modelRouterService.test.js.map +1 -1
- package/dist/src/routing/strategies/classifierStrategy.d.ts +1 -1
- package/dist/src/routing/strategies/classifierStrategy.js +9 -16
- package/dist/src/routing/strategies/classifierStrategy.js.map +1 -1
- package/dist/src/routing/strategies/classifierStrategy.test.js +17 -13
- package/dist/src/routing/strategies/classifierStrategy.test.js.map +1 -1
- package/dist/src/routing/strategies/fallbackStrategy.js +1 -1
- package/dist/src/routing/strategies/fallbackStrategy.js.map +1 -1
- package/dist/src/routing/strategies/fallbackStrategy.test.js +4 -0
- package/dist/src/routing/strategies/fallbackStrategy.test.js.map +1 -1
- package/dist/src/routing/strategies/overrideStrategy.js +2 -2
- package/dist/src/routing/strategies/overrideStrategy.js.map +1 -1
- package/dist/src/routing/strategies/overrideStrategy.test.js +3 -0
- package/dist/src/routing/strategies/overrideStrategy.test.js.map +1 -1
- package/dist/src/safety/built-in.d.ts +21 -0
- package/dist/src/safety/built-in.js +106 -0
- package/dist/src/safety/built-in.js.map +1 -0
- package/dist/src/safety/built-in.test.d.ts +6 -0
- package/dist/src/safety/built-in.test.js +199 -0
- package/dist/src/safety/built-in.test.js.map +1 -0
- package/dist/src/safety/checker-runner.d.ts +48 -0
- package/dist/src/safety/checker-runner.js +208 -0
- package/dist/src/safety/checker-runner.js.map +1 -0
- package/dist/src/safety/checker-runner.test.d.ts +6 -0
- package/dist/src/safety/checker-runner.test.js +238 -0
- package/dist/src/safety/checker-runner.test.js.map +1 -0
- package/dist/src/safety/context-builder.d.ts +23 -0
- package/dist/src/safety/context-builder.js +47 -0
- package/dist/src/safety/context-builder.js.map +1 -0
- package/dist/src/safety/context-builder.test.d.ts +6 -0
- package/dist/src/safety/context-builder.test.js +49 -0
- package/dist/src/safety/context-builder.test.js.map +1 -0
- package/dist/src/safety/protocol.d.ts +88 -0
- package/dist/src/safety/protocol.js +15 -0
- package/dist/src/safety/protocol.js.map +1 -0
- package/dist/src/safety/registry.d.ts +26 -0
- package/dist/src/safety/registry.js +65 -0
- package/dist/src/safety/registry.js.map +1 -0
- package/dist/src/safety/registry.test.d.ts +6 -0
- package/dist/src/safety/registry.test.js +31 -0
- package/dist/src/safety/registry.test.js.map +1 -0
- package/dist/src/services/chatCompressionService.d.ts +32 -0
- package/dist/src/services/chatCompressionService.js +162 -0
- package/dist/src/services/chatCompressionService.js.map +1 -0
- package/dist/src/services/chatCompressionService.test.d.ts +6 -0
- package/dist/src/services/chatCompressionService.test.js +210 -0
- package/dist/src/services/chatCompressionService.test.js.map +1 -0
- package/dist/src/services/chatRecordingService.d.ts +3 -2
- package/dist/src/services/chatRecordingService.js +11 -9
- package/dist/src/services/chatRecordingService.js.map +1 -1
- package/dist/src/services/fileDiscoveryService.d.ts +2 -14
- package/dist/src/services/fileDiscoveryService.js +19 -55
- package/dist/src/services/fileDiscoveryService.js.map +1 -1
- package/dist/src/services/fileDiscoveryService.test.js +91 -11
- package/dist/src/services/fileDiscoveryService.test.js.map +1 -1
- package/dist/src/services/loopDetectionService.d.ts +4 -1
- package/dist/src/services/loopDetectionService.js +95 -42
- package/dist/src/services/loopDetectionService.js.map +1 -1
- package/dist/src/services/loopDetectionService.test.js +220 -12
- package/dist/src/services/loopDetectionService.test.js.map +1 -1
- package/dist/src/services/modelConfig.golden.test.d.ts +6 -0
- package/dist/src/services/modelConfig.golden.test.js +42 -0
- package/dist/src/services/modelConfig.golden.test.js.map +1 -0
- package/dist/src/services/modelConfig.integration.test.d.ts +6 -0
- package/dist/src/services/modelConfig.integration.test.js +247 -0
- package/dist/src/services/modelConfig.integration.test.js.map +1 -0
- package/dist/src/services/modelConfigService.d.ts +48 -0
- package/dist/src/services/modelConfigService.js +151 -0
- package/dist/src/services/modelConfigService.js.map +1 -0
- package/dist/src/services/modelConfigService.test.d.ts +6 -0
- package/dist/src/services/modelConfigService.test.js +531 -0
- package/dist/src/services/modelConfigService.test.js.map +1 -0
- package/dist/src/services/shellExecutionService.d.ts +1 -0
- package/dist/src/services/shellExecutionService.js +195 -92
- package/dist/src/services/shellExecutionService.js.map +1 -1
- package/dist/src/services/shellExecutionService.test.js +137 -14
- package/dist/src/services/shellExecutionService.test.js.map +1 -1
- package/dist/src/services/test-data/resolved-aliases.golden.json +202 -0
- package/dist/src/telemetry/activity-monitor.d.ts +116 -0
- package/dist/src/telemetry/activity-monitor.js +209 -0
- package/dist/src/telemetry/activity-monitor.js.map +1 -0
- package/dist/src/telemetry/activity-monitor.test.d.ts +6 -0
- package/dist/src/telemetry/activity-monitor.test.js +251 -0
- package/dist/src/telemetry/activity-monitor.test.js.map +1 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +25 -7
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +294 -76
- 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 +192 -66
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +25 -3
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +59 -5
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -1
- package/dist/src/telemetry/constants.d.ts +0 -28
- package/dist/src/telemetry/constants.js +0 -29
- package/dist/src/telemetry/constants.js.map +1 -1
- package/dist/src/telemetry/gcp-exporters.js +0 -1
- package/dist/src/telemetry/gcp-exporters.js.map +1 -1
- package/dist/src/telemetry/gcp-exporters.test.js +1 -1
- package/dist/src/telemetry/gcp-exporters.test.js.map +1 -1
- package/dist/src/telemetry/index.d.ts +7 -3
- package/dist/src/telemetry/index.js +13 -4
- package/dist/src/telemetry/index.js.map +1 -1
- package/dist/src/telemetry/loggers.d.ts +14 -7
- package/dist/src/telemetry/loggers.js +197 -320
- package/dist/src/telemetry/loggers.js.map +1 -1
- package/dist/src/telemetry/loggers.test.circular.js +0 -1
- package/dist/src/telemetry/loggers.test.circular.js.map +1 -1
- package/dist/src/telemetry/loggers.test.js +460 -59
- package/dist/src/telemetry/loggers.test.js.map +1 -1
- package/dist/src/telemetry/memory-monitor.d.ts +149 -0
- package/dist/src/telemetry/memory-monitor.js +335 -0
- package/dist/src/telemetry/memory-monitor.js.map +1 -0
- package/dist/src/telemetry/memory-monitor.test.d.ts +6 -0
- package/dist/src/telemetry/memory-monitor.test.js +472 -0
- package/dist/src/telemetry/memory-monitor.test.js.map +1 -0
- package/dist/src/telemetry/metrics.d.ts +180 -4
- package/dist/src/telemetry/metrics.js +270 -6
- package/dist/src/telemetry/metrics.js.map +1 -1
- package/dist/src/telemetry/metrics.test.js +502 -184
- package/dist/src/telemetry/metrics.test.js.map +1 -1
- package/dist/src/telemetry/sdk.js +3 -2
- package/dist/src/telemetry/sdk.js.map +1 -1
- package/dist/src/telemetry/semantic.d.ts +82 -0
- package/dist/src/telemetry/semantic.js +269 -0
- package/dist/src/telemetry/semantic.js.map +1 -0
- package/dist/src/telemetry/semantic.test.d.ts +6 -0
- package/dist/src/telemetry/semantic.test.js +387 -0
- package/dist/src/telemetry/semantic.test.js.map +1 -0
- package/dist/src/telemetry/telemetry-utils.test.js +29 -28
- package/dist/src/telemetry/telemetry-utils.test.js.map +1 -1
- package/dist/src/telemetry/telemetryAttributes.d.ts +8 -0
- package/dist/src/telemetry/telemetryAttributes.js +19 -0
- package/dist/src/telemetry/telemetryAttributes.js.map +1 -0
- package/dist/src/telemetry/trace.d.ts +46 -0
- package/dist/src/telemetry/trace.js +121 -0
- package/dist/src/telemetry/trace.js.map +1 -0
- package/dist/src/telemetry/types.d.ts +227 -29
- package/dist/src/telemetry/types.js +858 -72
- package/dist/src/telemetry/types.js.map +1 -1
- package/dist/src/telemetry/uiTelemetry.d.ts +1 -1
- package/dist/src/telemetry/uiTelemetry.js +7 -7
- package/dist/src/telemetry/uiTelemetry.js.map +1 -1
- package/dist/src/telemetry/uiTelemetry.test.js +89 -67
- package/dist/src/telemetry/uiTelemetry.test.js.map +1 -1
- package/dist/src/test-utils/config.d.ts +1 -1
- package/dist/src/test-utils/config.js +1 -1
- package/dist/src/tools/base-tool-invocation.test.d.ts +6 -0
- package/dist/src/tools/base-tool-invocation.test.js +85 -0
- package/dist/src/tools/base-tool-invocation.test.js.map +1 -0
- package/dist/src/tools/edit.d.ts +4 -3
- package/dist/src/tools/edit.js +50 -47
- package/dist/src/tools/edit.js.map +1 -1
- package/dist/src/tools/edit.test.js +306 -216
- package/dist/src/tools/edit.test.js.map +1 -1
- package/dist/src/tools/glob.d.ts +4 -3
- package/dist/src/tools/glob.js +24 -27
- package/dist/src/tools/glob.js.map +1 -1
- package/dist/src/tools/glob.test.js +212 -205
- package/dist/src/tools/glob.test.js.map +1 -1
- package/dist/src/tools/grep.d.ts +4 -3
- package/dist/src/tools/grep.js +31 -25
- package/dist/src/tools/grep.js.map +1 -1
- package/dist/src/tools/grep.test.js +15 -12
- package/dist/src/tools/grep.test.js.map +1 -1
- package/dist/src/tools/ls.d.ts +4 -3
- package/dist/src/tools/ls.js +29 -35
- package/dist/src/tools/ls.js.map +1 -1
- package/dist/src/tools/ls.test.js +34 -42
- package/dist/src/tools/ls.test.js.map +1 -1
- package/dist/src/tools/mcp-client-manager.d.ts +49 -11
- package/dist/src/tools/mcp-client-manager.js +191 -31
- package/dist/src/tools/mcp-client-manager.js.map +1 -1
- package/dist/src/tools/mcp-client-manager.test.js +132 -25
- package/dist/src/tools/mcp-client-manager.test.js.map +1 -1
- package/dist/src/tools/mcp-client.d.ts +12 -5
- package/dist/src/tools/mcp-client.js +287 -267
- package/dist/src/tools/mcp-client.js.map +1 -1
- package/dist/src/tools/mcp-client.test.js +352 -45
- package/dist/src/tools/mcp-client.test.js.map +1 -1
- package/dist/src/tools/mcp-tool.d.ts +6 -2
- package/dist/src/tools/mcp-tool.js +19 -8
- package/dist/src/tools/mcp-tool.js.map +1 -1
- package/dist/src/tools/mcp-tool.test.js +186 -273
- package/dist/src/tools/mcp-tool.test.js.map +1 -1
- package/dist/src/tools/memoryTool.d.ts +7 -5
- package/dist/src/tools/memoryTool.js +14 -12
- package/dist/src/tools/memoryTool.js.map +1 -1
- package/dist/src/tools/memoryTool.test.js +10 -9
- package/dist/src/tools/memoryTool.test.js.map +1 -1
- package/dist/src/tools/message-bus-integration.test.js +14 -1
- package/dist/src/tools/message-bus-integration.test.js.map +1 -1
- package/dist/src/tools/modifiable-tool.d.ts +5 -1
- package/dist/src/tools/modifiable-tool.js +38 -16
- package/dist/src/tools/modifiable-tool.js.map +1 -1
- package/dist/src/tools/modifiable-tool.test.js +66 -31
- package/dist/src/tools/modifiable-tool.test.js.map +1 -1
- package/dist/src/tools/read-file.d.ts +6 -5
- package/dist/src/tools/read-file.js +26 -32
- package/dist/src/tools/read-file.js.map +1 -1
- package/dist/src/tools/read-file.test.js +68 -33
- package/dist/src/tools/read-file.test.js.map +1 -1
- package/dist/src/tools/read-many-files.d.ts +6 -12
- package/dist/src/tools/read-many-files.js +28 -57
- package/dist/src/tools/read-many-files.js.map +1 -1
- package/dist/src/tools/read-many-files.test.js +37 -36
- package/dist/src/tools/read-many-files.test.js.map +1 -1
- package/dist/src/tools/ripGrep.d.ts +28 -10
- package/dist/src/tools/ripGrep.js +195 -193
- package/dist/src/tools/ripGrep.js.map +1 -1
- package/dist/src/tools/ripGrep.test.js +533 -204
- package/dist/src/tools/ripGrep.test.js.map +1 -1
- package/dist/src/tools/shell.d.ts +8 -6
- package/dist/src/tools/shell.js +64 -38
- package/dist/src/tools/shell.js.map +1 -1
- package/dist/src/tools/shell.test.js +134 -43
- package/dist/src/tools/shell.test.js.map +1 -1
- package/dist/src/tools/smart-edit.d.ts +10 -23
- package/dist/src/tools/smart-edit.js +100 -85
- package/dist/src/tools/smart-edit.js.map +1 -1
- package/dist/src/tools/smart-edit.test.js +229 -179
- package/dist/src/tools/smart-edit.test.js.map +1 -1
- package/dist/src/tools/tool-error.d.ts +21 -0
- package/dist/src/tools/tool-error.js +27 -0
- package/dist/src/tools/tool-error.js.map +1 -1
- package/dist/src/tools/tool-names.d.ts +17 -0
- package/dist/src/tools/tool-names.js +21 -0
- package/dist/src/tools/tool-names.js.map +1 -0
- package/dist/src/tools/tool-registry.d.ts +32 -20
- package/dist/src/tools/tool-registry.js +122 -78
- package/dist/src/tools/tool-registry.js.map +1 -1
- package/dist/src/tools/tool-registry.test.js +167 -90
- package/dist/src/tools/tool-registry.test.js.map +1 -1
- package/dist/src/tools/tools.d.ts +23 -8
- package/dist/src/tools/tools.js +69 -37
- package/dist/src/tools/tools.js.map +1 -1
- package/dist/src/tools/web-fetch.d.ts +11 -3
- package/dist/src/tools/web-fetch.js +80 -38
- package/dist/src/tools/web-fetch.js.map +1 -1
- package/dist/src/tools/web-fetch.test.js +338 -9
- 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 +11 -9
- package/dist/src/tools/web-search.js.map +1 -1
- package/dist/src/tools/web-search.test.js +6 -0
- package/dist/src/tools/web-search.test.js.map +1 -1
- package/dist/src/tools/write-file.d.ts +3 -2
- package/dist/src/tools/write-file.js +41 -40
- package/dist/src/tools/write-file.js.map +1 -1
- package/dist/src/tools/write-file.test.js +130 -123
- package/dist/src/tools/write-file.test.js.map +1 -1
- package/dist/src/tools/write-todos.d.ts +34 -9
- package/dist/src/tools/write-todos.js +54 -11
- package/dist/src/tools/write-todos.js.map +1 -1
- package/dist/src/tools/write-todos.test.js +2 -2
- package/dist/src/tools/write-todos.test.js.map +1 -1
- package/dist/src/utils/bfsFileSearch.js +3 -2
- package/dist/src/utils/bfsFileSearch.js.map +1 -1
- package/dist/src/utils/channel.d.ts +19 -0
- package/dist/src/utils/channel.js +49 -0
- package/dist/src/utils/channel.js.map +1 -0
- package/dist/src/utils/channel.test.d.ts +6 -0
- package/dist/src/utils/channel.test.js +170 -0
- package/dist/src/utils/channel.test.js.map +1 -0
- package/dist/src/utils/debugLogger.d.ts +25 -0
- package/dist/src/utils/debugLogger.js +33 -0
- package/dist/src/utils/debugLogger.js.map +1 -0
- package/dist/src/utils/debugLogger.test.d.ts +6 -0
- package/dist/src/utils/debugLogger.test.js +69 -0
- package/dist/src/utils/debugLogger.test.js.map +1 -0
- package/dist/src/utils/delay.d.ts +16 -0
- package/dist/src/utils/delay.js +43 -0
- package/dist/src/utils/delay.js.map +1 -0
- package/dist/src/utils/delay.test.d.ts +6 -0
- package/dist/src/utils/delay.test.js +88 -0
- package/dist/src/utils/delay.test.js.map +1 -0
- package/dist/src/utils/editCorrector.js +10 -25
- package/dist/src/utils/editCorrector.js.map +1 -1
- package/dist/src/utils/editCorrector.test.js +19 -5
- package/dist/src/utils/editCorrector.test.js.map +1 -1
- package/dist/src/utils/editor.d.ts +4 -2
- package/dist/src/utils/editor.js +53 -39
- package/dist/src/utils/editor.js.map +1 -1
- package/dist/src/utils/editor.test.js +18 -45
- package/dist/src/utils/editor.test.js.map +1 -1
- package/dist/src/utils/environmentContext.d.ts +2 -1
- package/dist/src/utils/environmentContext.js +20 -33
- package/dist/src/utils/environmentContext.js.map +1 -1
- package/dist/src/utils/environmentContext.test.js +6 -34
- package/dist/src/utils/environmentContext.test.js.map +1 -1
- package/dist/src/utils/errorParsing.d.ts +1 -1
- package/dist/src/utils/errorParsing.js +5 -33
- package/dist/src/utils/errorParsing.js.map +1 -1
- package/dist/src/utils/errorParsing.test.js +0 -88
- package/dist/src/utils/errorParsing.test.js.map +1 -1
- package/dist/src/utils/errors.d.ts +3 -0
- package/dist/src/utils/errors.js +6 -0
- package/dist/src/utils/errors.js.map +1 -1
- package/dist/src/utils/events.d.ts +121 -0
- package/dist/src/utils/events.js +84 -0
- package/dist/src/utils/events.js.map +1 -0
- package/dist/src/utils/events.test.d.ts +6 -0
- package/dist/src/utils/events.test.js +212 -0
- package/dist/src/utils/events.test.js.map +1 -0
- package/dist/src/utils/extensionLoader.d.ts +86 -0
- package/dist/src/utils/extensionLoader.js +208 -0
- package/dist/src/utils/extensionLoader.js.map +1 -0
- package/dist/src/utils/extensionLoader.test.d.ts +6 -0
- package/dist/src/utils/extensionLoader.test.js +154 -0
- package/dist/src/utils/extensionLoader.test.js.map +1 -0
- package/dist/src/utils/fetch.d.ts +1 -0
- package/dist/src/utils/fetch.js +4 -0
- package/dist/src/utils/fetch.js.map +1 -1
- package/dist/src/utils/fileUtils.d.ts +4 -0
- package/dist/src/utils/fileUtils.js +34 -2
- package/dist/src/utils/fileUtils.js.map +1 -1
- package/dist/src/utils/fileUtils.test.js +87 -61
- package/dist/src/utils/fileUtils.test.js.map +1 -1
- package/dist/src/utils/filesearch/fileSearch.js +1 -1
- package/dist/src/utils/filesearch/fileSearch.js.map +1 -1
- package/dist/src/utils/flashFallback.test.js +28 -47
- package/dist/src/utils/flashFallback.test.js.map +1 -1
- package/dist/src/utils/formatters.d.ts +1 -0
- package/dist/src/utils/formatters.js +2 -1
- package/dist/src/utils/formatters.js.map +1 -1
- package/dist/src/utils/formatters.test.d.ts +6 -0
- package/dist/src/utils/formatters.test.js +26 -0
- package/dist/src/utils/formatters.test.js.map +1 -0
- package/dist/src/utils/getFolderStructure.js +9 -17
- package/dist/src/utils/getFolderStructure.js.map +1 -1
- package/dist/src/utils/getFolderStructure.test.js +7 -6
- package/dist/src/utils/getFolderStructure.test.js.map +1 -1
- package/dist/src/utils/gitIgnoreParser.d.ts +4 -1
- package/dist/src/utils/gitIgnoreParser.js +28 -10
- package/dist/src/utils/gitIgnoreParser.js.map +1 -1
- package/dist/src/utils/gitIgnoreParser.test.js +58 -0
- package/dist/src/utils/gitIgnoreParser.test.js.map +1 -1
- package/dist/src/utils/googleErrors.d.ts +104 -0
- package/dist/src/utils/googleErrors.js +152 -0
- package/dist/src/utils/googleErrors.js.map +1 -0
- package/dist/src/utils/googleErrors.test.d.ts +6 -0
- package/dist/src/utils/googleErrors.test.js +301 -0
- package/dist/src/utils/googleErrors.test.js.map +1 -0
- package/dist/src/utils/googleQuotaErrors.d.ts +37 -0
- package/dist/src/utils/googleQuotaErrors.js +157 -0
- package/dist/src/utils/googleQuotaErrors.js.map +1 -0
- package/dist/src/utils/googleQuotaErrors.test.d.ts +6 -0
- package/dist/src/utils/googleQuotaErrors.test.js +311 -0
- package/dist/src/utils/googleQuotaErrors.test.js.map +1 -0
- package/dist/src/utils/httpErrors.d.ts +18 -0
- package/dist/src/utils/httpErrors.js +36 -0
- package/dist/src/utils/httpErrors.js.map +1 -0
- package/dist/src/utils/ignorePatterns.test.js +26 -30
- package/dist/src/utils/ignorePatterns.test.js.map +1 -1
- package/dist/src/utils/installationManager.js +2 -1
- package/dist/src/utils/installationManager.js.map +1 -1
- package/dist/src/utils/installationManager.test.js +6 -4
- package/dist/src/utils/installationManager.test.js.map +1 -1
- package/dist/src/utils/llm-edit-fixer.d.ts +1 -1
- package/dist/src/utils/llm-edit-fixer.js +33 -9
- package/dist/src/utils/llm-edit-fixer.js.map +1 -1
- package/dist/src/utils/llm-edit-fixer.test.js +38 -1
- package/dist/src/utils/llm-edit-fixer.test.js.map +1 -1
- package/dist/src/utils/memoryDiscovery.d.ts +20 -1
- package/dist/src/utils/memoryDiscovery.js +176 -12
- package/dist/src/utils/memoryDiscovery.js.map +1 -1
- package/dist/src/utils/memoryDiscovery.test.js +299 -40
- package/dist/src/utils/memoryDiscovery.test.js.map +1 -1
- package/dist/src/utils/memoryImportProcessor.js +4 -3
- package/dist/src/utils/memoryImportProcessor.js.map +1 -1
- package/dist/src/utils/memoryImportProcessor.test.js +8 -14
- package/dist/src/utils/memoryImportProcessor.test.js.map +1 -1
- package/dist/src/utils/nextSpeakerChecker.js +3 -3
- package/dist/src/utils/nextSpeakerChecker.js.map +1 -1
- package/dist/src/utils/nextSpeakerChecker.test.js +13 -5
- package/dist/src/utils/nextSpeakerChecker.test.js.map +1 -1
- package/dist/src/utils/package.d.ts +12 -0
- package/dist/src/utils/package.js +15 -0
- package/dist/src/utils/package.js.map +1 -0
- package/dist/src/utils/pathCorrector.d.ts +25 -0
- package/dist/src/utils/pathCorrector.js +33 -0
- package/dist/src/utils/pathCorrector.js.map +1 -0
- package/dist/src/utils/pathCorrector.test.d.ts +6 -0
- package/dist/src/utils/pathCorrector.test.js +83 -0
- package/dist/src/utils/pathCorrector.test.js.map +1 -0
- package/dist/src/utils/pathReader.js +4 -4
- package/dist/src/utils/pathReader.js.map +1 -1
- package/dist/src/utils/pathReader.test.js +44 -1
- package/dist/src/utils/pathReader.test.js.map +1 -1
- package/dist/src/utils/paths.d.ts +1 -1
- package/dist/src/utils/paths.js +131 -29
- package/dist/src/utils/paths.js.map +1 -1
- package/dist/src/utils/paths.test.js +200 -68
- package/dist/src/utils/paths.test.js.map +1 -1
- package/dist/src/utils/quotaErrorDetection.d.ts +0 -2
- package/dist/src/utils/quotaErrorDetection.js +0 -46
- package/dist/src/utils/quotaErrorDetection.js.map +1 -1
- package/dist/src/utils/retry.d.ts +3 -10
- package/dist/src/utils/retry.js +97 -195
- package/dist/src/utils/retry.js.map +1 -1
- package/dist/src/utils/retry.test.js +179 -145
- package/dist/src/utils/retry.test.js.map +1 -1
- package/dist/src/utils/safeJsonStringify.d.ts +4 -4
- package/dist/src/utils/safeJsonStringify.js +31 -7
- package/dist/src/utils/safeJsonStringify.js.map +1 -1
- package/dist/src/utils/shell-utils.d.ts +15 -2
- package/dist/src/utils/shell-utils.js +387 -140
- package/dist/src/utils/shell-utils.js.map +1 -1
- package/dist/src/utils/shell-utils.test.js +244 -62
- package/dist/src/utils/shell-utils.test.js.map +1 -1
- package/dist/src/utils/stdio.d.ts +32 -0
- package/dist/src/utils/stdio.js +85 -0
- package/dist/src/utils/stdio.js.map +1 -0
- package/dist/src/utils/stdio.test.d.ts +6 -0
- package/dist/src/utils/stdio.test.js +47 -0
- package/dist/src/utils/stdio.test.js.map +1 -0
- package/dist/src/utils/summarizer.d.ts +4 -2
- package/dist/src/utils/summarizer.js +8 -9
- package/dist/src/utils/summarizer.js.map +1 -1
- package/dist/src/utils/summarizer.test.js +32 -12
- package/dist/src/utils/summarizer.test.js.map +1 -1
- package/dist/src/utils/systemEncoding.js +5 -4
- package/dist/src/utils/systemEncoding.js.map +1 -1
- package/dist/src/utils/systemEncoding.test.js +2 -1
- package/dist/src/utils/systemEncoding.test.js.map +1 -1
- package/dist/src/utils/terminal.d.ts +14 -0
- package/dist/src/utils/terminal.js +38 -0
- package/dist/src/utils/terminal.js.map +1 -0
- package/dist/src/utils/tool-utils.d.ts +2 -2
- package/dist/src/utils/tool-utils.js +15 -6
- package/dist/src/utils/tool-utils.js.map +1 -1
- package/dist/src/utils/tool-utils.test.js +8 -0
- package/dist/src/utils/tool-utils.test.js.map +1 -1
- package/dist/src/utils/userAccountManager.js +5 -4
- package/dist/src/utils/userAccountManager.js.map +1 -1
- package/dist/src/utils/userAccountManager.test.js +9 -7
- package/dist/src/utils/userAccountManager.test.js.map +1 -1
- package/dist/src/utils/workspaceContext.d.ts +4 -3
- package/dist/src/utils/workspaceContext.js +13 -13
- package/dist/src/utils/workspaceContext.js.map +1 -1
- package/dist/src/utils/workspaceContext.test.js +8 -7
- package/dist/src/utils/workspaceContext.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -7
|
@@ -4,14 +4,17 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
7
|
-
import { Config,
|
|
7
|
+
import { Config, DEFAULT_FILE_FILTERING_OPTIONS } from './config.js';
|
|
8
|
+
import { ExperimentFlags } from '../code_assist/experiments/flagNames.js';
|
|
9
|
+
import { debugLogger } from '../utils/debugLogger.js';
|
|
10
|
+
import { ApprovalMode } from '../policy/types.js';
|
|
11
|
+
import { HookType, HookEventName } from '../hooks/types.js';
|
|
8
12
|
import * as path from 'node:path';
|
|
9
13
|
import { setGeminiMdFilename as mockSetGeminiMdFilename } from '../tools/memoryTool.js';
|
|
10
14
|
import { DEFAULT_TELEMETRY_TARGET, DEFAULT_OTLP_ENDPOINT, } from '../telemetry/index.js';
|
|
11
15
|
import { AuthType, createContentGeneratorConfig, } from '../core/contentGenerator.js';
|
|
12
16
|
import { GeminiClient } from '../core/client.js';
|
|
13
17
|
import { GitService } from '../services/gitService.js';
|
|
14
|
-
import { ClearcutLogger } from '../telemetry/clearcut-logger/clearcut-logger.js';
|
|
15
18
|
import { ShellTool } from '../tools/shell.js';
|
|
16
19
|
import { ReadFileTool } from '../tools/read-file.js';
|
|
17
20
|
import { GrepTool } from '../tools/grep.js';
|
|
@@ -19,6 +22,7 @@ import { RipGrepTool, canUseRipgrep } from '../tools/ripGrep.js';
|
|
|
19
22
|
import { logRipgrepFallback } from '../telemetry/loggers.js';
|
|
20
23
|
import { RipgrepFallbackEvent } from '../telemetry/types.js';
|
|
21
24
|
import { ToolRegistry } from '../tools/tool-registry.js';
|
|
25
|
+
import { DEFAULT_MODEL_CONFIGS } from './defaultModelConfigs.js';
|
|
22
26
|
vi.mock('fs', async (importOriginal) => {
|
|
23
27
|
const actual = await importOriginal();
|
|
24
28
|
return {
|
|
@@ -35,6 +39,7 @@ vi.mock('../tools/tool-registry', () => {
|
|
|
35
39
|
const ToolRegistryMock = vi.fn();
|
|
36
40
|
ToolRegistryMock.prototype.registerTool = vi.fn();
|
|
37
41
|
ToolRegistryMock.prototype.discoverAllTools = vi.fn();
|
|
42
|
+
ToolRegistryMock.prototype.sortTools = vi.fn();
|
|
38
43
|
ToolRegistryMock.prototype.getAllTools = vi.fn(() => []); // Mock methods if needed
|
|
39
44
|
ToolRegistryMock.prototype.getTool = vi.fn();
|
|
40
45
|
ToolRegistryMock.prototype.getFunctionDeclarations = vi.fn(() => []);
|
|
@@ -63,7 +68,7 @@ vi.mock('../tools/memoryTool', () => ({
|
|
|
63
68
|
setGeminiMdFilename: vi.fn(),
|
|
64
69
|
getCurrentGeminiMdFilename: vi.fn(() => 'GEMINI.md'), // Mock the original filename
|
|
65
70
|
DEFAULT_CONTEXT_FILENAME: 'GEMINI.md',
|
|
66
|
-
|
|
71
|
+
GEMINI_DIR: '.gemini',
|
|
67
72
|
}));
|
|
68
73
|
vi.mock('../core/contentGenerator.js');
|
|
69
74
|
vi.mock('../core/client.js', () => ({
|
|
@@ -103,13 +108,39 @@ vi.mock('../ide/ide-client.js', () => ({
|
|
|
103
108
|
}),
|
|
104
109
|
},
|
|
105
110
|
}));
|
|
111
|
+
vi.mock('../agents/registry.js', () => {
|
|
112
|
+
const AgentRegistryMock = vi.fn();
|
|
113
|
+
AgentRegistryMock.prototype.initialize = vi.fn();
|
|
114
|
+
AgentRegistryMock.prototype.getAllDefinitions = vi.fn(() => []);
|
|
115
|
+
AgentRegistryMock.prototype.getDefinition = vi.fn();
|
|
116
|
+
return { AgentRegistry: AgentRegistryMock };
|
|
117
|
+
});
|
|
118
|
+
vi.mock('../agents/subagent-tool-wrapper.js', () => ({
|
|
119
|
+
SubagentToolWrapper: vi.fn(),
|
|
120
|
+
}));
|
|
121
|
+
const mockCoreEvents = vi.hoisted(() => ({
|
|
122
|
+
emitFeedback: vi.fn(),
|
|
123
|
+
emitModelChanged: vi.fn(),
|
|
124
|
+
emitConsoleLog: vi.fn(),
|
|
125
|
+
}));
|
|
126
|
+
const mockSetGlobalProxy = vi.hoisted(() => vi.fn());
|
|
127
|
+
vi.mock('../utils/events.js', () => ({
|
|
128
|
+
coreEvents: mockCoreEvents,
|
|
129
|
+
}));
|
|
130
|
+
vi.mock('../utils/fetch.js', () => ({
|
|
131
|
+
setGlobalProxy: mockSetGlobalProxy,
|
|
132
|
+
}));
|
|
106
133
|
import { BaseLlmClient } from '../core/baseLlmClient.js';
|
|
107
134
|
import { tokenLimit } from '../core/tokenLimits.js';
|
|
108
135
|
import { uiTelemetryService } from '../telemetry/index.js';
|
|
136
|
+
import { getCodeAssistServer } from '../code_assist/codeAssist.js';
|
|
137
|
+
import { getExperiments } from '../code_assist/experiments/experiments.js';
|
|
109
138
|
vi.mock('../core/baseLlmClient.js');
|
|
110
139
|
vi.mock('../core/tokenLimits.js', () => ({
|
|
111
140
|
tokenLimit: vi.fn(),
|
|
112
141
|
}));
|
|
142
|
+
vi.mock('../code_assist/codeAssist.js');
|
|
143
|
+
vi.mock('../code_assist/experiments/experiments.js');
|
|
113
144
|
describe('Server Config (config.ts)', () => {
|
|
114
145
|
const MODEL = 'gemini-pro';
|
|
115
146
|
const SANDBOX = {
|
|
@@ -119,7 +150,6 @@ describe('Server Config (config.ts)', () => {
|
|
|
119
150
|
const TARGET_DIR = '/path/to/target';
|
|
120
151
|
const DEBUG_MODE = false;
|
|
121
152
|
const QUESTION = 'test question';
|
|
122
|
-
const FULL_CONTEXT = false;
|
|
123
153
|
const USER_MEMORY = 'Test User Memory';
|
|
124
154
|
const TELEMETRY_SETTINGS = { enabled: false };
|
|
125
155
|
const EMBEDDING_MODEL = 'gemini-embedding';
|
|
@@ -131,7 +161,6 @@ describe('Server Config (config.ts)', () => {
|
|
|
131
161
|
targetDir: TARGET_DIR,
|
|
132
162
|
debugMode: DEBUG_MODE,
|
|
133
163
|
question: QUESTION,
|
|
134
|
-
fullContext: FULL_CONTEXT,
|
|
135
164
|
userMemory: USER_MEMORY,
|
|
136
165
|
telemetry: TELEMETRY_SETTINGS,
|
|
137
166
|
sessionId: SESSION_ID,
|
|
@@ -141,7 +170,6 @@ describe('Server Config (config.ts)', () => {
|
|
|
141
170
|
beforeEach(() => {
|
|
142
171
|
// Reset mocks if necessary
|
|
143
172
|
vi.clearAllMocks();
|
|
144
|
-
vi.spyOn(ClearcutLogger.prototype, 'logStartSessionEvent').mockImplementation(() => undefined);
|
|
145
173
|
});
|
|
146
174
|
describe('initialize', () => {
|
|
147
175
|
it('should throw an error if checkpointing is enabled and GitService fails', async () => {
|
|
@@ -170,6 +198,79 @@ describe('Server Config (config.ts)', () => {
|
|
|
170
198
|
await expect(config.initialize()).resolves.toBeUndefined();
|
|
171
199
|
await expect(config.initialize()).rejects.toThrow('Config was already initialized');
|
|
172
200
|
});
|
|
201
|
+
describe('getCompressionThreshold', () => {
|
|
202
|
+
it('should return the local compression threshold if it is set', async () => {
|
|
203
|
+
const config = new Config({
|
|
204
|
+
...baseParams,
|
|
205
|
+
compressionThreshold: 0.5,
|
|
206
|
+
});
|
|
207
|
+
expect(await config.getCompressionThreshold()).toBe(0.5);
|
|
208
|
+
});
|
|
209
|
+
it('should return the remote experiment threshold if it is a positive number', async () => {
|
|
210
|
+
const config = new Config({
|
|
211
|
+
...baseParams,
|
|
212
|
+
experiments: {
|
|
213
|
+
flags: {
|
|
214
|
+
[ExperimentFlags.CONTEXT_COMPRESSION_THRESHOLD]: {
|
|
215
|
+
floatValue: 0.8,
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
});
|
|
220
|
+
expect(await config.getCompressionThreshold()).toBe(0.8);
|
|
221
|
+
});
|
|
222
|
+
it('should return undefined if the remote experiment threshold is 0', async () => {
|
|
223
|
+
const config = new Config({
|
|
224
|
+
...baseParams,
|
|
225
|
+
experiments: {
|
|
226
|
+
flags: {
|
|
227
|
+
[ExperimentFlags.CONTEXT_COMPRESSION_THRESHOLD]: {
|
|
228
|
+
floatValue: 0.0,
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
});
|
|
233
|
+
expect(await config.getCompressionThreshold()).toBeUndefined();
|
|
234
|
+
});
|
|
235
|
+
it('should return undefined if there are no experiments', async () => {
|
|
236
|
+
const config = new Config(baseParams);
|
|
237
|
+
expect(await config.getCompressionThreshold()).toBeUndefined();
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
describe('getUserCaching', () => {
|
|
241
|
+
it('should return the remote experiment flag when available', async () => {
|
|
242
|
+
const config = new Config({
|
|
243
|
+
...baseParams,
|
|
244
|
+
experiments: {
|
|
245
|
+
flags: {
|
|
246
|
+
[ExperimentFlags.USER_CACHING]: {
|
|
247
|
+
boolValue: true,
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
experimentIds: [],
|
|
251
|
+
},
|
|
252
|
+
});
|
|
253
|
+
expect(await config.getUserCaching()).toBe(true);
|
|
254
|
+
});
|
|
255
|
+
it('should return false when the remote flag is false', async () => {
|
|
256
|
+
const config = new Config({
|
|
257
|
+
...baseParams,
|
|
258
|
+
experiments: {
|
|
259
|
+
flags: {
|
|
260
|
+
[ExperimentFlags.USER_CACHING]: {
|
|
261
|
+
boolValue: false,
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
experimentIds: [],
|
|
265
|
+
},
|
|
266
|
+
});
|
|
267
|
+
expect(await config.getUserCaching()).toBe(false);
|
|
268
|
+
});
|
|
269
|
+
it('should return undefined if there are no experiments', async () => {
|
|
270
|
+
const config = new Config(baseParams);
|
|
271
|
+
expect(await config.getUserCaching()).toBeUndefined();
|
|
272
|
+
});
|
|
273
|
+
});
|
|
173
274
|
});
|
|
174
275
|
describe('refreshAuth', () => {
|
|
175
276
|
it('should refresh auth and update config', async () => {
|
|
@@ -178,7 +279,7 @@ describe('Server Config (config.ts)', () => {
|
|
|
178
279
|
const mockContentConfig = {
|
|
179
280
|
apiKey: 'test-key',
|
|
180
281
|
};
|
|
181
|
-
vi.mocked(createContentGeneratorConfig).
|
|
282
|
+
vi.mocked(createContentGeneratorConfig).mockResolvedValue(mockContentConfig);
|
|
182
283
|
// Set fallback mode to true to ensure it gets reset
|
|
183
284
|
config.setFallbackMode(true);
|
|
184
285
|
expect(config.isInFallbackMode()).toBe(true);
|
|
@@ -192,19 +293,92 @@ describe('Server Config (config.ts)', () => {
|
|
|
192
293
|
});
|
|
193
294
|
it('should strip thoughts when switching from GenAI to Vertex', async () => {
|
|
194
295
|
const config = new Config(baseParams);
|
|
195
|
-
vi.mocked(createContentGeneratorConfig).mockImplementation((_, authType) => ({ authType }));
|
|
296
|
+
vi.mocked(createContentGeneratorConfig).mockImplementation(async (_, authType) => ({ authType }));
|
|
196
297
|
await config.refreshAuth(AuthType.USE_GEMINI);
|
|
197
298
|
await config.refreshAuth(AuthType.LOGIN_WITH_GOOGLE);
|
|
198
299
|
expect(config.getGeminiClient().stripThoughtsFromHistory).toHaveBeenCalledWith();
|
|
199
300
|
});
|
|
301
|
+
it('should strip thoughts when switching from GenAI to Vertex AI', async () => {
|
|
302
|
+
const config = new Config(baseParams);
|
|
303
|
+
vi.mocked(createContentGeneratorConfig).mockImplementation(async (_, authType) => ({ authType }));
|
|
304
|
+
await config.refreshAuth(AuthType.USE_GEMINI);
|
|
305
|
+
await config.refreshAuth(AuthType.USE_VERTEX_AI);
|
|
306
|
+
expect(config.getGeminiClient().stripThoughtsFromHistory).toHaveBeenCalledWith();
|
|
307
|
+
});
|
|
200
308
|
it('should not strip thoughts when switching from Vertex to GenAI', async () => {
|
|
201
309
|
const config = new Config(baseParams);
|
|
202
|
-
vi.mocked(createContentGeneratorConfig).mockImplementation((_, authType) => ({ authType }));
|
|
310
|
+
vi.mocked(createContentGeneratorConfig).mockImplementation(async (_, authType) => ({ authType }));
|
|
203
311
|
await config.refreshAuth(AuthType.USE_VERTEX_AI);
|
|
204
312
|
await config.refreshAuth(AuthType.USE_GEMINI);
|
|
205
313
|
expect(config.getGeminiClient().stripThoughtsFromHistory).not.toHaveBeenCalledWith();
|
|
206
314
|
});
|
|
207
315
|
});
|
|
316
|
+
describe('Preview Features Logic in refreshAuth', () => {
|
|
317
|
+
beforeEach(() => {
|
|
318
|
+
// Set up default mock behavior for these functions before each test
|
|
319
|
+
vi.mocked(getCodeAssistServer).mockReturnValue(undefined);
|
|
320
|
+
vi.mocked(getExperiments).mockResolvedValue({
|
|
321
|
+
flags: {},
|
|
322
|
+
experimentIds: [],
|
|
323
|
+
});
|
|
324
|
+
});
|
|
325
|
+
it('should enable preview features for Google auth when remote flag is true', async () => {
|
|
326
|
+
// Override the default mock for this specific test
|
|
327
|
+
vi.mocked(getCodeAssistServer).mockReturnValue({}); // Simulate Google auth by returning a truthy value
|
|
328
|
+
vi.mocked(getExperiments).mockResolvedValue({
|
|
329
|
+
flags: {
|
|
330
|
+
[ExperimentFlags.ENABLE_PREVIEW]: { boolValue: true },
|
|
331
|
+
},
|
|
332
|
+
experimentIds: [],
|
|
333
|
+
});
|
|
334
|
+
const config = new Config({ ...baseParams, previewFeatures: undefined });
|
|
335
|
+
await config.refreshAuth(AuthType.LOGIN_WITH_GOOGLE);
|
|
336
|
+
expect(config.getPreviewFeatures()).toBe(true);
|
|
337
|
+
});
|
|
338
|
+
it('should disable preview features for Google auth when remote flag is false', async () => {
|
|
339
|
+
// Override the default mock
|
|
340
|
+
vi.mocked(getCodeAssistServer).mockReturnValue({});
|
|
341
|
+
vi.mocked(getExperiments).mockResolvedValue({
|
|
342
|
+
flags: {
|
|
343
|
+
[ExperimentFlags.ENABLE_PREVIEW]: { boolValue: false },
|
|
344
|
+
},
|
|
345
|
+
experimentIds: [],
|
|
346
|
+
});
|
|
347
|
+
const config = new Config({ ...baseParams, previewFeatures: undefined });
|
|
348
|
+
await config.refreshAuth(AuthType.LOGIN_WITH_GOOGLE);
|
|
349
|
+
expect(config.getPreviewFeatures()).toBe(undefined);
|
|
350
|
+
});
|
|
351
|
+
it('should disable preview features for Google auth when remote flag is missing', async () => {
|
|
352
|
+
// Override the default mock for getCodeAssistServer, the getExperiments mock is already correct
|
|
353
|
+
vi.mocked(getCodeAssistServer).mockReturnValue({});
|
|
354
|
+
const config = new Config({ ...baseParams, previewFeatures: undefined });
|
|
355
|
+
await config.refreshAuth(AuthType.LOGIN_WITH_GOOGLE);
|
|
356
|
+
expect(config.getPreviewFeatures()).toBe(undefined);
|
|
357
|
+
});
|
|
358
|
+
it('should not change preview features or model if it is already set to true', async () => {
|
|
359
|
+
const initialModel = 'some-other-model';
|
|
360
|
+
const config = new Config({
|
|
361
|
+
...baseParams,
|
|
362
|
+
previewFeatures: true,
|
|
363
|
+
model: initialModel,
|
|
364
|
+
});
|
|
365
|
+
// It doesn't matter which auth method we use here, the logic should exit early
|
|
366
|
+
await config.refreshAuth(AuthType.USE_GEMINI);
|
|
367
|
+
expect(config.getPreviewFeatures()).toBe(true);
|
|
368
|
+
expect(config.getModel()).toBe(initialModel);
|
|
369
|
+
});
|
|
370
|
+
it('should not change preview features or model if it is already set to false', async () => {
|
|
371
|
+
const initialModel = 'some-other-model';
|
|
372
|
+
const config = new Config({
|
|
373
|
+
...baseParams,
|
|
374
|
+
previewFeatures: false,
|
|
375
|
+
model: initialModel,
|
|
376
|
+
});
|
|
377
|
+
await config.refreshAuth(AuthType.USE_GEMINI);
|
|
378
|
+
expect(config.getPreviewFeatures()).toBe(false);
|
|
379
|
+
expect(config.getModel()).toBe(initialModel);
|
|
380
|
+
});
|
|
381
|
+
});
|
|
208
382
|
it('Config constructor should store userMemory correctly', () => {
|
|
209
383
|
const config = new Config(baseParams);
|
|
210
384
|
expect(config.getUserMemory()).toBe(USER_MEMORY);
|
|
@@ -232,7 +406,7 @@ describe('Server Config (config.ts)', () => {
|
|
|
232
406
|
});
|
|
233
407
|
it('should set default file filtering settings when not provided', () => {
|
|
234
408
|
const config = new Config(baseParams);
|
|
235
|
-
expect(config.getFileFilteringRespectGitIgnore()).toBe(
|
|
409
|
+
expect(config.getFileFilteringRespectGitIgnore()).toBe(DEFAULT_FILE_FILTERING_OPTIONS.respectGitIgnore);
|
|
236
410
|
});
|
|
237
411
|
it('should set custom file filtering settings when provided', () => {
|
|
238
412
|
const paramsWithFileFiltering = {
|
|
@@ -245,7 +419,7 @@ describe('Server Config (config.ts)', () => {
|
|
|
245
419
|
expect(config.getFileFilteringRespectGitIgnore()).toBe(false);
|
|
246
420
|
});
|
|
247
421
|
it('should initialize WorkspaceContext with includeDirectories', () => {
|
|
248
|
-
const includeDirectories = ['
|
|
422
|
+
const includeDirectories = ['dir1', 'dir2'];
|
|
249
423
|
const paramsWithIncludeDirs = {
|
|
250
424
|
...baseParams,
|
|
251
425
|
includeDirectories,
|
|
@@ -253,11 +427,11 @@ describe('Server Config (config.ts)', () => {
|
|
|
253
427
|
const config = new Config(paramsWithIncludeDirs);
|
|
254
428
|
const workspaceContext = config.getWorkspaceContext();
|
|
255
429
|
const directories = workspaceContext.getDirectories();
|
|
256
|
-
// Should include the target directory
|
|
257
|
-
expect(directories).toHaveLength(
|
|
430
|
+
// Should include only the target directory initially
|
|
431
|
+
expect(directories).toHaveLength(1);
|
|
258
432
|
expect(directories).toContain(path.resolve(baseParams.targetDir));
|
|
259
|
-
|
|
260
|
-
expect(
|
|
433
|
+
// The other directories should be in the pending list
|
|
434
|
+
expect(config.getPendingIncludeDirectories()).toEqual(includeDirectories);
|
|
261
435
|
});
|
|
262
436
|
it('Config constructor should set telemetry to true when provided as true', () => {
|
|
263
437
|
const paramsWithTelemetry = {
|
|
@@ -325,14 +499,6 @@ describe('Server Config (config.ts)', () => {
|
|
|
325
499
|
});
|
|
326
500
|
expect(config.getUsageStatisticsEnabled()).toBe(enabled);
|
|
327
501
|
});
|
|
328
|
-
it('logs the session start event', async () => {
|
|
329
|
-
const config = new Config({
|
|
330
|
-
...baseParams,
|
|
331
|
-
usageStatisticsEnabled: true,
|
|
332
|
-
});
|
|
333
|
-
await config.refreshAuth(AuthType.USE_GEMINI);
|
|
334
|
-
expect(ClearcutLogger.prototype.logStartSessionEvent).toHaveBeenCalledOnce();
|
|
335
|
-
});
|
|
336
502
|
});
|
|
337
503
|
describe('Telemetry Settings', () => {
|
|
338
504
|
it('should return default telemetry target if not provided', () => {
|
|
@@ -447,26 +613,105 @@ describe('Server Config (config.ts)', () => {
|
|
|
447
613
|
expect(config.getUseRipgrep()).toBe(true);
|
|
448
614
|
});
|
|
449
615
|
});
|
|
450
|
-
describe('
|
|
451
|
-
it('should
|
|
452
|
-
const config = new Config(
|
|
616
|
+
describe('Model Router with Auth', () => {
|
|
617
|
+
it('should disable model router by default for oauth-personal', async () => {
|
|
618
|
+
const config = new Config({
|
|
619
|
+
...baseParams,
|
|
620
|
+
useModelRouter: true,
|
|
621
|
+
});
|
|
622
|
+
await config.refreshAuth(AuthType.LOGIN_WITH_GOOGLE);
|
|
623
|
+
expect(config.getUseModelRouter()).toBe(true);
|
|
624
|
+
});
|
|
625
|
+
it('should enable model router by default for other auth types', async () => {
|
|
626
|
+
const config = new Config({
|
|
627
|
+
...baseParams,
|
|
628
|
+
useModelRouter: true,
|
|
629
|
+
});
|
|
630
|
+
await config.refreshAuth(AuthType.USE_GEMINI);
|
|
631
|
+
expect(config.getUseModelRouter()).toBe(true);
|
|
632
|
+
});
|
|
633
|
+
it('should disable model router for specified auth type', async () => {
|
|
634
|
+
const config = new Config({
|
|
635
|
+
...baseParams,
|
|
636
|
+
useModelRouter: true,
|
|
637
|
+
disableModelRouterForAuth: [AuthType.USE_GEMINI],
|
|
638
|
+
});
|
|
639
|
+
await config.refreshAuth(AuthType.USE_GEMINI);
|
|
453
640
|
expect(config.getUseModelRouter()).toBe(false);
|
|
454
641
|
});
|
|
455
|
-
it('should
|
|
456
|
-
const
|
|
642
|
+
it('should enable model router for other auth type', async () => {
|
|
643
|
+
const config = new Config({
|
|
457
644
|
...baseParams,
|
|
458
645
|
useModelRouter: true,
|
|
459
|
-
|
|
460
|
-
|
|
646
|
+
disableModelRouterForAuth: [],
|
|
647
|
+
});
|
|
648
|
+
await config.refreshAuth(AuthType.LOGIN_WITH_GOOGLE);
|
|
461
649
|
expect(config.getUseModelRouter()).toBe(true);
|
|
462
650
|
});
|
|
463
|
-
it('should
|
|
464
|
-
const
|
|
651
|
+
it('should keep model router disabled when useModelRouter is false', async () => {
|
|
652
|
+
const config = new Config({
|
|
465
653
|
...baseParams,
|
|
466
654
|
useModelRouter: false,
|
|
467
|
-
|
|
468
|
-
|
|
655
|
+
disableModelRouterForAuth: [AuthType.USE_GEMINI],
|
|
656
|
+
});
|
|
657
|
+
await config.refreshAuth(AuthType.LOGIN_WITH_GOOGLE);
|
|
658
|
+
expect(config.getUseModelRouter()).toBe(false);
|
|
659
|
+
});
|
|
660
|
+
it('should keep the user-chosen model after refreshAuth, even when model router is disabled for the auth type', async () => {
|
|
661
|
+
const config = new Config({
|
|
662
|
+
...baseParams,
|
|
663
|
+
useModelRouter: true,
|
|
664
|
+
disableModelRouterForAuth: [AuthType.USE_GEMINI],
|
|
665
|
+
});
|
|
666
|
+
const chosenModel = 'gemini-1.5-pro-latest';
|
|
667
|
+
config.setModel(chosenModel);
|
|
668
|
+
await config.refreshAuth(AuthType.USE_GEMINI);
|
|
469
669
|
expect(config.getUseModelRouter()).toBe(false);
|
|
670
|
+
expect(config.getModel()).toBe(chosenModel);
|
|
671
|
+
});
|
|
672
|
+
it('should keep the user-chosen model after refreshAuth, when model router is enabled for the auth type', async () => {
|
|
673
|
+
const config = new Config({
|
|
674
|
+
...baseParams,
|
|
675
|
+
useModelRouter: true,
|
|
676
|
+
disableModelRouterForAuth: [AuthType.USE_GEMINI],
|
|
677
|
+
});
|
|
678
|
+
const chosenModel = 'gemini-1.5-pro-latest';
|
|
679
|
+
config.setModel(chosenModel);
|
|
680
|
+
await config.refreshAuth(AuthType.LOGIN_WITH_GOOGLE);
|
|
681
|
+
expect(config.getUseModelRouter()).toBe(true);
|
|
682
|
+
expect(config.getModel()).toBe(chosenModel);
|
|
683
|
+
});
|
|
684
|
+
it('should NOT switch to auto model if cli provides specific model, even if router is enabled', async () => {
|
|
685
|
+
const config = new Config({
|
|
686
|
+
...baseParams,
|
|
687
|
+
useModelRouter: true,
|
|
688
|
+
model: 'gemini-flash-latest',
|
|
689
|
+
});
|
|
690
|
+
await config.refreshAuth(AuthType.LOGIN_WITH_GOOGLE);
|
|
691
|
+
expect(config.getUseModelRouter()).toBe(true);
|
|
692
|
+
expect(config.getModel()).toBe('gemini-flash-latest');
|
|
693
|
+
});
|
|
694
|
+
});
|
|
695
|
+
describe('ContinueOnFailedApiCall Configuration', () => {
|
|
696
|
+
it('should default continueOnFailedApiCall to false when not provided', () => {
|
|
697
|
+
const config = new Config(baseParams);
|
|
698
|
+
expect(config.getContinueOnFailedApiCall()).toBe(true);
|
|
699
|
+
});
|
|
700
|
+
it('should set continueOnFailedApiCall to true when provided as true', () => {
|
|
701
|
+
const paramsWithContinueOnFailedApiCall = {
|
|
702
|
+
...baseParams,
|
|
703
|
+
continueOnFailedApiCall: true,
|
|
704
|
+
};
|
|
705
|
+
const config = new Config(paramsWithContinueOnFailedApiCall);
|
|
706
|
+
expect(config.getContinueOnFailedApiCall()).toBe(true);
|
|
707
|
+
});
|
|
708
|
+
it('should set continueOnFailedApiCall to false when explicitly provided as false', () => {
|
|
709
|
+
const paramsWithContinueOnFailedApiCall = {
|
|
710
|
+
...baseParams,
|
|
711
|
+
continueOnFailedApiCall: false,
|
|
712
|
+
};
|
|
713
|
+
const config = new Config(paramsWithContinueOnFailedApiCall);
|
|
714
|
+
expect(config.getContinueOnFailedApiCall()).toBe(false);
|
|
470
715
|
});
|
|
471
716
|
});
|
|
472
717
|
describe('createToolRegistry', () => {
|
|
@@ -486,6 +731,38 @@ describe('Server Config (config.ts)', () => {
|
|
|
486
731
|
const wasReadFileToolRegistered = registerToolMock.mock.calls.some((call) => call[0] instanceof vi.mocked(ReadFileTool));
|
|
487
732
|
expect(wasReadFileToolRegistered).toBe(false);
|
|
488
733
|
});
|
|
734
|
+
it('should register subagents as tools when codebaseInvestigatorSettings.enabled is true', async () => {
|
|
735
|
+
const params = {
|
|
736
|
+
...baseParams,
|
|
737
|
+
codebaseInvestigatorSettings: { enabled: true },
|
|
738
|
+
};
|
|
739
|
+
const config = new Config(params);
|
|
740
|
+
const mockAgentDefinition = {
|
|
741
|
+
name: 'codebase-investigator',
|
|
742
|
+
description: 'Agent 1',
|
|
743
|
+
instructions: 'Inst 1',
|
|
744
|
+
};
|
|
745
|
+
const AgentRegistryMock = (await vi.importMock('../agents/registry.js')).AgentRegistry;
|
|
746
|
+
AgentRegistryMock.prototype.getDefinition.mockReturnValue(mockAgentDefinition);
|
|
747
|
+
const SubagentToolWrapperMock = (await vi.importMock('../agents/subagent-tool-wrapper.js')).SubagentToolWrapper;
|
|
748
|
+
await config.initialize();
|
|
749
|
+
const registerToolMock = (await vi.importMock('../tools/tool-registry')).ToolRegistry.prototype.registerTool;
|
|
750
|
+
expect(SubagentToolWrapperMock).toHaveBeenCalledTimes(1);
|
|
751
|
+
expect(SubagentToolWrapperMock).toHaveBeenCalledWith(mockAgentDefinition, config, undefined);
|
|
752
|
+
const calls = registerToolMock.mock.calls;
|
|
753
|
+
const registeredWrappers = calls.filter((call) => call[0] instanceof SubagentToolWrapperMock);
|
|
754
|
+
expect(registeredWrappers).toHaveLength(1);
|
|
755
|
+
});
|
|
756
|
+
it('should not register subagents as tools when codebaseInvestigatorSettings.enabled is false', async () => {
|
|
757
|
+
const params = {
|
|
758
|
+
...baseParams,
|
|
759
|
+
codebaseInvestigatorSettings: { enabled: false },
|
|
760
|
+
};
|
|
761
|
+
const config = new Config(params);
|
|
762
|
+
const SubagentToolWrapperMock = (await vi.importMock('../agents/subagent-tool-wrapper.js')).SubagentToolWrapper;
|
|
763
|
+
await config.initialize();
|
|
764
|
+
expect(SubagentToolWrapperMock).not.toHaveBeenCalled();
|
|
765
|
+
});
|
|
489
766
|
describe('with minified tool class names', () => {
|
|
490
767
|
beforeEach(() => {
|
|
491
768
|
Object.defineProperty(vi.mocked(ShellTool).prototype.constructor, 'name', {
|
|
@@ -509,18 +786,6 @@ describe('Server Config (config.ts)', () => {
|
|
|
509
786
|
const wasShellToolRegistered = registerToolMock.mock.calls.some((call) => call[0] instanceof vi.mocked(ShellTool));
|
|
510
787
|
expect(wasShellToolRegistered).toBe(true);
|
|
511
788
|
});
|
|
512
|
-
it('should not register a tool if excludeTools contains the non-minified class name', async () => {
|
|
513
|
-
const params = {
|
|
514
|
-
...baseParams,
|
|
515
|
-
coreTools: undefined, // all tools enabled by default
|
|
516
|
-
excludeTools: ['ShellTool'],
|
|
517
|
-
};
|
|
518
|
-
const config = new Config(params);
|
|
519
|
-
await config.initialize();
|
|
520
|
-
const registerToolMock = (await vi.importMock('../tools/tool-registry')).ToolRegistry.prototype.registerTool;
|
|
521
|
-
const wasShellToolRegistered = registerToolMock.mock.calls.some((call) => call[0] instanceof vi.mocked(ShellTool));
|
|
522
|
-
expect(wasShellToolRegistered).toBe(false);
|
|
523
|
-
});
|
|
524
789
|
it('should register a tool if coreTools contains an argument-specific pattern with the non-minified class name', async () => {
|
|
525
790
|
const params = {
|
|
526
791
|
...baseParams,
|
|
@@ -572,6 +837,46 @@ describe('Server Config (config.ts)', () => {
|
|
|
572
837
|
expect(config.getTruncateToolOutputThreshold()).toBe(50000);
|
|
573
838
|
});
|
|
574
839
|
});
|
|
840
|
+
describe('Proxy Configuration Error Handling', () => {
|
|
841
|
+
beforeEach(() => {
|
|
842
|
+
vi.clearAllMocks();
|
|
843
|
+
});
|
|
844
|
+
it('should call setGlobalProxy when proxy is configured', () => {
|
|
845
|
+
const paramsWithProxy = {
|
|
846
|
+
...baseParams,
|
|
847
|
+
proxy: 'http://proxy.example.com:8080',
|
|
848
|
+
};
|
|
849
|
+
new Config(paramsWithProxy);
|
|
850
|
+
expect(mockSetGlobalProxy).toHaveBeenCalledWith('http://proxy.example.com:8080');
|
|
851
|
+
});
|
|
852
|
+
it('should not call setGlobalProxy when proxy is not configured', () => {
|
|
853
|
+
new Config(baseParams);
|
|
854
|
+
expect(mockSetGlobalProxy).not.toHaveBeenCalled();
|
|
855
|
+
});
|
|
856
|
+
it('should emit error feedback when setGlobalProxy throws an error', () => {
|
|
857
|
+
const proxyError = new Error('Invalid proxy URL');
|
|
858
|
+
mockSetGlobalProxy.mockImplementation(() => {
|
|
859
|
+
throw proxyError;
|
|
860
|
+
});
|
|
861
|
+
const paramsWithProxy = {
|
|
862
|
+
...baseParams,
|
|
863
|
+
proxy: 'invalid-proxy',
|
|
864
|
+
};
|
|
865
|
+
new Config(paramsWithProxy);
|
|
866
|
+
expect(mockCoreEvents.emitFeedback).toHaveBeenCalledWith('error', 'Invalid proxy configuration detected. Check debug drawer for more details (F12)', proxyError);
|
|
867
|
+
});
|
|
868
|
+
it('should not emit error feedback when setGlobalProxy succeeds', () => {
|
|
869
|
+
mockSetGlobalProxy.mockImplementation(() => {
|
|
870
|
+
// Success - no error thrown
|
|
871
|
+
});
|
|
872
|
+
const paramsWithProxy = {
|
|
873
|
+
...baseParams,
|
|
874
|
+
proxy: 'http://proxy.example.com:8080',
|
|
875
|
+
};
|
|
876
|
+
new Config(paramsWithProxy);
|
|
877
|
+
expect(mockCoreEvents.emitFeedback).not.toHaveBeenCalled();
|
|
878
|
+
});
|
|
879
|
+
});
|
|
575
880
|
});
|
|
576
881
|
describe('setApprovalMode with folder trust', () => {
|
|
577
882
|
const baseParams = {
|
|
@@ -665,6 +970,35 @@ describe('setApprovalMode with folder trust', () => {
|
|
|
665
970
|
});
|
|
666
971
|
});
|
|
667
972
|
});
|
|
973
|
+
describe('isYoloModeDisabled', () => {
|
|
974
|
+
const baseParams = {
|
|
975
|
+
sessionId: 'test',
|
|
976
|
+
targetDir: '.',
|
|
977
|
+
debugMode: false,
|
|
978
|
+
model: 'test-model',
|
|
979
|
+
cwd: '.',
|
|
980
|
+
};
|
|
981
|
+
it('should return false when yolo mode is not disabled and folder is trusted', () => {
|
|
982
|
+
const config = new Config(baseParams);
|
|
983
|
+
vi.spyOn(config, 'isTrustedFolder').mockReturnValue(true);
|
|
984
|
+
expect(config.isYoloModeDisabled()).toBe(false);
|
|
985
|
+
});
|
|
986
|
+
it('should return true when yolo mode is disabled by parameter', () => {
|
|
987
|
+
const config = new Config({ ...baseParams, disableYoloMode: true });
|
|
988
|
+
vi.spyOn(config, 'isTrustedFolder').mockReturnValue(true);
|
|
989
|
+
expect(config.isYoloModeDisabled()).toBe(true);
|
|
990
|
+
});
|
|
991
|
+
it('should return true when folder is untrusted', () => {
|
|
992
|
+
const config = new Config(baseParams);
|
|
993
|
+
vi.spyOn(config, 'isTrustedFolder').mockReturnValue(false);
|
|
994
|
+
expect(config.isYoloModeDisabled()).toBe(true);
|
|
995
|
+
});
|
|
996
|
+
it('should return true when yolo is disabled and folder is untrusted', () => {
|
|
997
|
+
const config = new Config({ ...baseParams, disableYoloMode: true });
|
|
998
|
+
vi.spyOn(config, 'isTrustedFolder').mockReturnValue(false);
|
|
999
|
+
expect(config.isYoloModeDisabled()).toBe(true);
|
|
1000
|
+
});
|
|
1001
|
+
});
|
|
668
1002
|
describe('BaseLlmClient Lifecycle', () => {
|
|
669
1003
|
const MODEL = 'gemini-pro';
|
|
670
1004
|
const SANDBOX = {
|
|
@@ -674,7 +1008,6 @@ describe('BaseLlmClient Lifecycle', () => {
|
|
|
674
1008
|
const TARGET_DIR = '/path/to/target';
|
|
675
1009
|
const DEBUG_MODE = false;
|
|
676
1010
|
const QUESTION = 'test question';
|
|
677
|
-
const FULL_CONTEXT = false;
|
|
678
1011
|
const USER_MEMORY = 'Test User Memory';
|
|
679
1012
|
const TELEMETRY_SETTINGS = { enabled: false };
|
|
680
1013
|
const EMBEDDING_MODEL = 'gemini-embedding';
|
|
@@ -686,7 +1019,6 @@ describe('BaseLlmClient Lifecycle', () => {
|
|
|
686
1019
|
targetDir: TARGET_DIR,
|
|
687
1020
|
debugMode: DEBUG_MODE,
|
|
688
1021
|
question: QUESTION,
|
|
689
|
-
fullContext: FULL_CONTEXT,
|
|
690
1022
|
userMemory: USER_MEMORY,
|
|
691
1023
|
telemetry: TELEMETRY_SETTINGS,
|
|
692
1024
|
sessionId: SESSION_ID,
|
|
@@ -701,7 +1033,7 @@ describe('BaseLlmClient Lifecycle', () => {
|
|
|
701
1033
|
const config = new Config(baseParams);
|
|
702
1034
|
const authType = AuthType.USE_GEMINI;
|
|
703
1035
|
const mockContentConfig = { model: 'gemini-flash', apiKey: 'test-key' };
|
|
704
|
-
vi.mocked(createContentGeneratorConfig).
|
|
1036
|
+
vi.mocked(createContentGeneratorConfig).mockResolvedValue(mockContentConfig);
|
|
705
1037
|
await config.refreshAuth(authType);
|
|
706
1038
|
// Should not throw
|
|
707
1039
|
const llmService = config.getBaseLlmClient();
|
|
@@ -709,4 +1041,307 @@ describe('BaseLlmClient Lifecycle', () => {
|
|
|
709
1041
|
expect(BaseLlmClient).toHaveBeenCalledWith(config.getContentGenerator(), config);
|
|
710
1042
|
});
|
|
711
1043
|
});
|
|
1044
|
+
describe('Generation Config Merging (HACK)', () => {
|
|
1045
|
+
const MODEL = 'gemini-pro';
|
|
1046
|
+
const SANDBOX = {
|
|
1047
|
+
command: 'docker',
|
|
1048
|
+
image: 'gemini-cli-sandbox',
|
|
1049
|
+
};
|
|
1050
|
+
const TARGET_DIR = '/path/to/target';
|
|
1051
|
+
const DEBUG_MODE = false;
|
|
1052
|
+
const QUESTION = 'test question';
|
|
1053
|
+
const USER_MEMORY = 'Test User Memory';
|
|
1054
|
+
const TELEMETRY_SETTINGS = { enabled: false };
|
|
1055
|
+
const EMBEDDING_MODEL = 'gemini-embedding';
|
|
1056
|
+
const SESSION_ID = 'test-session-id';
|
|
1057
|
+
const baseParams = {
|
|
1058
|
+
cwd: '/tmp',
|
|
1059
|
+
embeddingModel: EMBEDDING_MODEL,
|
|
1060
|
+
sandbox: SANDBOX,
|
|
1061
|
+
targetDir: TARGET_DIR,
|
|
1062
|
+
debugMode: DEBUG_MODE,
|
|
1063
|
+
question: QUESTION,
|
|
1064
|
+
userMemory: USER_MEMORY,
|
|
1065
|
+
telemetry: TELEMETRY_SETTINGS,
|
|
1066
|
+
sessionId: SESSION_ID,
|
|
1067
|
+
model: MODEL,
|
|
1068
|
+
usageStatisticsEnabled: false,
|
|
1069
|
+
};
|
|
1070
|
+
it('should merge default aliases when user provides only overrides', () => {
|
|
1071
|
+
const userOverrides = [
|
|
1072
|
+
{
|
|
1073
|
+
match: { model: 'test-model' },
|
|
1074
|
+
modelConfig: { generateContentConfig: { temperature: 0.1 } },
|
|
1075
|
+
},
|
|
1076
|
+
];
|
|
1077
|
+
const params = {
|
|
1078
|
+
...baseParams,
|
|
1079
|
+
modelConfigServiceConfig: {
|
|
1080
|
+
overrides: userOverrides,
|
|
1081
|
+
},
|
|
1082
|
+
};
|
|
1083
|
+
const config = new Config(params);
|
|
1084
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1085
|
+
const serviceConfig = config.modelConfigService.config;
|
|
1086
|
+
// Assert that the default aliases are present
|
|
1087
|
+
expect(serviceConfig.aliases).toEqual(DEFAULT_MODEL_CONFIGS.aliases);
|
|
1088
|
+
// Assert that the user's overrides are present
|
|
1089
|
+
expect(serviceConfig.overrides).toEqual(userOverrides);
|
|
1090
|
+
});
|
|
1091
|
+
it('should use user-provided aliases if they exist', () => {
|
|
1092
|
+
const userAliases = {
|
|
1093
|
+
'my-alias': {
|
|
1094
|
+
modelConfig: { model: 'my-model' },
|
|
1095
|
+
},
|
|
1096
|
+
};
|
|
1097
|
+
const params = {
|
|
1098
|
+
...baseParams,
|
|
1099
|
+
modelConfigServiceConfig: {
|
|
1100
|
+
aliases: userAliases,
|
|
1101
|
+
},
|
|
1102
|
+
};
|
|
1103
|
+
const config = new Config(params);
|
|
1104
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1105
|
+
const serviceConfig = config.modelConfigService.config;
|
|
1106
|
+
// Assert that the user's aliases are used, not the defaults
|
|
1107
|
+
expect(serviceConfig.aliases).toEqual(userAliases);
|
|
1108
|
+
});
|
|
1109
|
+
it('should use default generation config if none is provided', () => {
|
|
1110
|
+
const params = { ...baseParams };
|
|
1111
|
+
const config = new Config(params);
|
|
1112
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1113
|
+
const serviceConfig = config.modelConfigService.config;
|
|
1114
|
+
// Assert that the full default config is used
|
|
1115
|
+
expect(serviceConfig).toEqual(DEFAULT_MODEL_CONFIGS);
|
|
1116
|
+
});
|
|
1117
|
+
});
|
|
1118
|
+
describe('Config getHooks', () => {
|
|
1119
|
+
const baseParams = {
|
|
1120
|
+
cwd: '/tmp',
|
|
1121
|
+
targetDir: '/path/to/target',
|
|
1122
|
+
debugMode: false,
|
|
1123
|
+
sessionId: 'test-session-id',
|
|
1124
|
+
model: 'gemini-pro',
|
|
1125
|
+
usageStatisticsEnabled: false,
|
|
1126
|
+
};
|
|
1127
|
+
it('should return undefined when no hooks are provided', () => {
|
|
1128
|
+
const config = new Config(baseParams);
|
|
1129
|
+
expect(config.getHooks()).toBeUndefined();
|
|
1130
|
+
});
|
|
1131
|
+
it('should return empty object when empty hooks are provided', () => {
|
|
1132
|
+
const configWithEmptyHooks = new Config({
|
|
1133
|
+
...baseParams,
|
|
1134
|
+
hooks: {},
|
|
1135
|
+
});
|
|
1136
|
+
expect(configWithEmptyHooks.getHooks()).toEqual({});
|
|
1137
|
+
});
|
|
1138
|
+
it('should return the hooks configuration when provided', () => {
|
|
1139
|
+
const mockHooks = {
|
|
1140
|
+
[HookEventName.BeforeTool]: [
|
|
1141
|
+
{
|
|
1142
|
+
matcher: 'write_file',
|
|
1143
|
+
hooks: [
|
|
1144
|
+
{
|
|
1145
|
+
type: HookType.Command,
|
|
1146
|
+
command: 'echo "test hook"',
|
|
1147
|
+
timeout: 5000,
|
|
1148
|
+
},
|
|
1149
|
+
],
|
|
1150
|
+
},
|
|
1151
|
+
],
|
|
1152
|
+
[HookEventName.AfterTool]: [
|
|
1153
|
+
{
|
|
1154
|
+
hooks: [
|
|
1155
|
+
{
|
|
1156
|
+
type: HookType.Command,
|
|
1157
|
+
command: './hooks/after-tool.sh',
|
|
1158
|
+
timeout: 10000,
|
|
1159
|
+
},
|
|
1160
|
+
],
|
|
1161
|
+
},
|
|
1162
|
+
],
|
|
1163
|
+
};
|
|
1164
|
+
const config = new Config({
|
|
1165
|
+
...baseParams,
|
|
1166
|
+
hooks: mockHooks,
|
|
1167
|
+
});
|
|
1168
|
+
const retrievedHooks = config.getHooks();
|
|
1169
|
+
expect(retrievedHooks).toEqual(mockHooks);
|
|
1170
|
+
expect(retrievedHooks).toBe(mockHooks); // Should return the same reference
|
|
1171
|
+
});
|
|
1172
|
+
it('should return hooks with all supported event types', () => {
|
|
1173
|
+
const allEventHooks = {
|
|
1174
|
+
[HookEventName.BeforeAgent]: [
|
|
1175
|
+
{ hooks: [{ type: HookType.Command, command: 'test1' }] },
|
|
1176
|
+
],
|
|
1177
|
+
[HookEventName.AfterAgent]: [
|
|
1178
|
+
{ hooks: [{ type: HookType.Command, command: 'test2' }] },
|
|
1179
|
+
],
|
|
1180
|
+
[HookEventName.BeforeTool]: [
|
|
1181
|
+
{ hooks: [{ type: HookType.Command, command: 'test3' }] },
|
|
1182
|
+
],
|
|
1183
|
+
[HookEventName.AfterTool]: [
|
|
1184
|
+
{ hooks: [{ type: HookType.Command, command: 'test4' }] },
|
|
1185
|
+
],
|
|
1186
|
+
[HookEventName.BeforeModel]: [
|
|
1187
|
+
{ hooks: [{ type: HookType.Command, command: 'test5' }] },
|
|
1188
|
+
],
|
|
1189
|
+
[HookEventName.AfterModel]: [
|
|
1190
|
+
{ hooks: [{ type: HookType.Command, command: 'test6' }] },
|
|
1191
|
+
],
|
|
1192
|
+
[HookEventName.BeforeToolSelection]: [
|
|
1193
|
+
{ hooks: [{ type: HookType.Command, command: 'test7' }] },
|
|
1194
|
+
],
|
|
1195
|
+
[HookEventName.Notification]: [
|
|
1196
|
+
{ hooks: [{ type: HookType.Command, command: 'test8' }] },
|
|
1197
|
+
],
|
|
1198
|
+
[HookEventName.SessionStart]: [
|
|
1199
|
+
{ hooks: [{ type: HookType.Command, command: 'test9' }] },
|
|
1200
|
+
],
|
|
1201
|
+
[HookEventName.SessionEnd]: [
|
|
1202
|
+
{ hooks: [{ type: HookType.Command, command: 'test10' }] },
|
|
1203
|
+
],
|
|
1204
|
+
[HookEventName.PreCompress]: [
|
|
1205
|
+
{ hooks: [{ type: HookType.Command, command: 'test11' }] },
|
|
1206
|
+
],
|
|
1207
|
+
};
|
|
1208
|
+
const config = new Config({
|
|
1209
|
+
...baseParams,
|
|
1210
|
+
hooks: allEventHooks,
|
|
1211
|
+
});
|
|
1212
|
+
const retrievedHooks = config.getHooks();
|
|
1213
|
+
expect(retrievedHooks).toEqual(allEventHooks);
|
|
1214
|
+
expect(Object.keys(retrievedHooks)).toHaveLength(11); // All hook event types
|
|
1215
|
+
});
|
|
1216
|
+
describe('setModel', () => {
|
|
1217
|
+
it('should allow setting a pro (any) model and disable fallback mode', () => {
|
|
1218
|
+
const config = new Config(baseParams);
|
|
1219
|
+
config.setFallbackMode(true);
|
|
1220
|
+
expect(config.isInFallbackMode()).toBe(true);
|
|
1221
|
+
const proModel = 'gemini-2.5-pro';
|
|
1222
|
+
config.setModel(proModel);
|
|
1223
|
+
expect(config.getModel()).toBe(proModel);
|
|
1224
|
+
expect(config.isInFallbackMode()).toBe(false);
|
|
1225
|
+
expect(mockCoreEvents.emitModelChanged).toHaveBeenCalledWith(proModel);
|
|
1226
|
+
});
|
|
1227
|
+
it('should allow setting auto model from non-auto model and disable fallback mode', () => {
|
|
1228
|
+
const config = new Config(baseParams);
|
|
1229
|
+
config.setFallbackMode(true);
|
|
1230
|
+
expect(config.isInFallbackMode()).toBe(true);
|
|
1231
|
+
config.setModel('auto');
|
|
1232
|
+
expect(config.getModel()).toBe('auto');
|
|
1233
|
+
expect(config.isInFallbackMode()).toBe(false);
|
|
1234
|
+
expect(mockCoreEvents.emitModelChanged).toHaveBeenCalledWith('auto');
|
|
1235
|
+
});
|
|
1236
|
+
it('should allow setting auto model from auto model if it is in the fallback mode', () => {
|
|
1237
|
+
const config = new Config({
|
|
1238
|
+
cwd: '/tmp',
|
|
1239
|
+
targetDir: '/path/to/target',
|
|
1240
|
+
debugMode: false,
|
|
1241
|
+
sessionId: 'test-session-id',
|
|
1242
|
+
model: 'auto',
|
|
1243
|
+
usageStatisticsEnabled: false,
|
|
1244
|
+
});
|
|
1245
|
+
config.setFallbackMode(true);
|
|
1246
|
+
expect(config.isInFallbackMode()).toBe(true);
|
|
1247
|
+
config.setModel('auto');
|
|
1248
|
+
expect(config.getModel()).toBe('auto');
|
|
1249
|
+
expect(config.isInFallbackMode()).toBe(false);
|
|
1250
|
+
expect(mockCoreEvents.emitModelChanged).toHaveBeenCalledWith('auto');
|
|
1251
|
+
});
|
|
1252
|
+
});
|
|
1253
|
+
});
|
|
1254
|
+
describe('Config getExperiments', () => {
|
|
1255
|
+
const baseParams = {
|
|
1256
|
+
cwd: '/tmp',
|
|
1257
|
+
targetDir: '/path/to/target',
|
|
1258
|
+
debugMode: false,
|
|
1259
|
+
sessionId: 'test-session-id',
|
|
1260
|
+
model: 'gemini-pro',
|
|
1261
|
+
usageStatisticsEnabled: false,
|
|
1262
|
+
};
|
|
1263
|
+
it('should return undefined when no experiments are provided', () => {
|
|
1264
|
+
const config = new Config(baseParams);
|
|
1265
|
+
expect(config.getExperiments()).toBeUndefined();
|
|
1266
|
+
});
|
|
1267
|
+
it('should return empty object when empty experiments are provided', () => {
|
|
1268
|
+
const configWithEmptyExps = new Config({
|
|
1269
|
+
...baseParams,
|
|
1270
|
+
experiments: { flags: {}, experimentIds: [] },
|
|
1271
|
+
});
|
|
1272
|
+
expect(configWithEmptyExps.getExperiments()).toEqual({
|
|
1273
|
+
flags: {},
|
|
1274
|
+
experimentIds: [],
|
|
1275
|
+
});
|
|
1276
|
+
});
|
|
1277
|
+
it('should return the experiments configuration when provided', () => {
|
|
1278
|
+
const mockExps = {
|
|
1279
|
+
flags: {
|
|
1280
|
+
testFlag: { boolValue: true },
|
|
1281
|
+
},
|
|
1282
|
+
experimentIds: [],
|
|
1283
|
+
};
|
|
1284
|
+
const config = new Config({
|
|
1285
|
+
...baseParams,
|
|
1286
|
+
experiments: mockExps,
|
|
1287
|
+
});
|
|
1288
|
+
const retrievedExps = config.getExperiments();
|
|
1289
|
+
expect(retrievedExps).toEqual(mockExps);
|
|
1290
|
+
expect(retrievedExps).toBe(mockExps); // Should return the same reference
|
|
1291
|
+
});
|
|
1292
|
+
});
|
|
1293
|
+
describe('Config setExperiments logging', () => {
|
|
1294
|
+
const baseParams = {
|
|
1295
|
+
cwd: '/tmp',
|
|
1296
|
+
targetDir: '/path/to/target',
|
|
1297
|
+
debugMode: false,
|
|
1298
|
+
sessionId: 'test-session-id',
|
|
1299
|
+
model: 'gemini-pro',
|
|
1300
|
+
usageStatisticsEnabled: false,
|
|
1301
|
+
};
|
|
1302
|
+
it('logs a sorted, non-truncated summary of experiments when they are set', () => {
|
|
1303
|
+
const config = new Config(baseParams);
|
|
1304
|
+
const debugSpy = vi
|
|
1305
|
+
.spyOn(debugLogger, 'debug')
|
|
1306
|
+
.mockImplementation(() => { });
|
|
1307
|
+
const experiments = {
|
|
1308
|
+
flags: {
|
|
1309
|
+
ZetaFlag: {
|
|
1310
|
+
boolValue: true,
|
|
1311
|
+
stringValue: 'zeta',
|
|
1312
|
+
int32ListValue: { values: [1, 2] },
|
|
1313
|
+
},
|
|
1314
|
+
AlphaFlag: {
|
|
1315
|
+
boolValue: false,
|
|
1316
|
+
stringValue: 'alpha',
|
|
1317
|
+
stringListValue: { values: ['a', 'b', 'c'] },
|
|
1318
|
+
},
|
|
1319
|
+
MiddleFlag: {
|
|
1320
|
+
// Intentionally sparse to ensure undefined values are omitted
|
|
1321
|
+
floatValue: 0.42,
|
|
1322
|
+
int32ListValue: { values: [] },
|
|
1323
|
+
},
|
|
1324
|
+
},
|
|
1325
|
+
experimentIds: [101, 99],
|
|
1326
|
+
};
|
|
1327
|
+
config.setExperiments(experiments);
|
|
1328
|
+
const logCall = debugSpy.mock.calls.find(([message]) => message === 'Experiments loaded');
|
|
1329
|
+
expect(logCall).toBeDefined();
|
|
1330
|
+
const loggedSummary = logCall?.[1];
|
|
1331
|
+
expect(typeof loggedSummary).toBe('string');
|
|
1332
|
+
expect(loggedSummary).toContain('experimentIds');
|
|
1333
|
+
expect(loggedSummary).toContain('101');
|
|
1334
|
+
expect(loggedSummary).toContain('AlphaFlag');
|
|
1335
|
+
expect(loggedSummary).toContain('ZetaFlag');
|
|
1336
|
+
const alphaIndex = loggedSummary.indexOf('AlphaFlag');
|
|
1337
|
+
const zetaIndex = loggedSummary.indexOf('ZetaFlag');
|
|
1338
|
+
expect(alphaIndex).toBeGreaterThan(-1);
|
|
1339
|
+
expect(zetaIndex).toBeGreaterThan(-1);
|
|
1340
|
+
expect(alphaIndex).toBeLessThan(zetaIndex);
|
|
1341
|
+
expect(loggedSummary).toContain('\n');
|
|
1342
|
+
expect(loggedSummary).not.toContain('stringListLength: 0');
|
|
1343
|
+
expect(loggedSummary).not.toContain('int32ListLength: 0');
|
|
1344
|
+
debugSpy.mockRestore();
|
|
1345
|
+
});
|
|
1346
|
+
});
|
|
712
1347
|
//# sourceMappingURL=config.test.js.map
|