@office-ai/aioncli-core 0.2.3 → 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 +16 -3
- package/dist/index.js +15 -3
- package/dist/index.js.map +1 -1
- package/dist/src/agents/codebase-investigator.d.ts +46 -0
- package/dist/src/agents/codebase-investigator.js +132 -0
- package/dist/src/agents/codebase-investigator.js.map +1 -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 +114 -0
- package/dist/src/agents/executor.js +779 -0
- package/dist/src/agents/executor.js.map +1 -0
- package/dist/src/agents/executor.test.js +1362 -0
- package/dist/src/agents/executor.test.js.map +1 -0
- package/dist/src/agents/invocation.d.ts +46 -0
- package/dist/src/agents/invocation.js +102 -0
- package/dist/src/agents/invocation.js.map +1 -0
- package/dist/src/agents/invocation.test.js +215 -0
- package/dist/src/agents/invocation.test.js.map +1 -0
- package/dist/src/agents/registry.d.ts +40 -0
- package/dist/src/agents/registry.js +105 -0
- package/dist/src/agents/registry.js.map +1 -0
- package/dist/src/agents/registry.test.d.ts +6 -0
- package/dist/src/agents/registry.test.js +160 -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 +38 -0
- package/dist/src/agents/subagent-tool-wrapper.js +48 -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 +110 -0
- package/dist/src/agents/subagent-tool-wrapper.test.js.map +1 -0
- package/dist/src/agents/types.d.ts +146 -0
- package/dist/src/agents/types.js +19 -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 +13 -1
- package/dist/src/code_assist/codeAssist.js.map +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 +5 -1
- package/dist/src/code_assist/converter.js +39 -5
- package/dist/src/code_assist/converter.js.map +1 -1
- package/dist/src/code_assist/converter.test.js +112 -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.d.ts +25 -0
- package/dist/src/code_assist/oauth-credential-storage.js +110 -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 +198 -0
- package/dist/src/code_assist/oauth-credential-storage.test.js.map +1 -0
- package/dist/src/code_assist/oauth2.d.ts +3 -3
- package/dist/src/code_assist/oauth2.js +252 -125
- package/dist/src/code_assist/oauth2.js.map +1 -1
- package/dist/src/code_assist/oauth2.test.js +788 -350
- package/dist/src/code_assist/oauth2.test.js.map +1 -1
- package/dist/src/code_assist/server.d.ts +8 -6
- package/dist/src/code_assist/server.js +41 -10
- package/dist/src/code_assist/server.js.map +1 -1
- package/dist/src/code_assist/server.test.js +151 -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 +5 -3
- 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 +18 -3
- 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 +282 -60
- package/dist/src/config/config.js +677 -129
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/config.test.js +1020 -146
- 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/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 +37 -0
- package/dist/src/config/models.js +72 -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 +116 -0
- package/dist/src/config/models.test.js.map +1 -0
- package/dist/src/config/storage.d.ts +36 -0
- package/dist/src/config/storage.js +115 -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 +48 -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 +18 -0
- package/dist/src/confirmation-bus/message-bus.js +87 -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 +170 -0
- package/dist/src/confirmation-bus/message-bus.test.js.map +1 -0
- package/dist/src/confirmation-bus/types.d.ts +49 -0
- package/dist/src/confirmation-bus/types.js +16 -0
- package/dist/src/confirmation-bus/types.js.map +1 -0
- 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 +50 -0
- package/dist/src/core/baseLlmClient.js +185 -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 +311 -0
- package/dist/src/core/baseLlmClient.test.js.map +1 -0
- package/dist/src/core/client.d.ts +30 -42
- package/dist/src/core/client.js +178 -477
- package/dist/src/core/client.js.map +1 -1
- package/dist/src/core/client.test.js +739 -617
- package/dist/src/core/client.test.js.map +1 -1
- package/dist/src/core/contentGenerator.d.ts +7 -6
- package/dist/src/core/contentGenerator.js +59 -45
- package/dist/src/core/contentGenerator.js.map +1 -1
- package/dist/src/core/contentGenerator.test.js +50 -4
- package/dist/src/core/contentGenerator.test.js.map +1 -1
- package/dist/src/core/coreToolScheduler.d.ts +28 -11
- package/dist/src/core/coreToolScheduler.js +493 -161
- package/dist/src/core/coreToolScheduler.js.map +1 -1
- package/dist/src/core/coreToolScheduler.test.js +995 -163
- 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 +61 -55
- package/dist/src/core/geminiChat.js +388 -366
- package/dist/src/core/geminiChat.js.map +1 -1
- package/dist/src/core/geminiChat.test.js +1600 -355
- 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 +11 -4
- package/dist/src/core/logger.js +39 -30
- package/dist/src/core/logger.js.map +1 -1
- package/dist/src/core/logger.test.js +62 -45
- package/dist/src/core/logger.test.js.map +1 -1
- package/dist/src/core/loggingContentGenerator.d.ts +4 -3
- package/dist/src/core/loggingContentGenerator.js +116 -37
- 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 +4 -5
- package/dist/src/core/nonInteractiveToolExecutor.js +17 -120
- package/dist/src/core/nonInteractiveToolExecutor.js.map +1 -1
- package/dist/src/core/nonInteractiveToolExecutor.test.js +168 -84
- 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 +49 -19
- 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 +7 -1
- package/dist/src/core/prompts.js +198 -195
- package/dist/src/core/prompts.js.map +1 -1
- package/dist/src/core/prompts.test.js +172 -104
- 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/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/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 +57 -13
- package/dist/src/core/turn.js +79 -35
- package/dist/src/core/turn.js.map +1 -1
- package/dist/src/core/turn.test.js +373 -120
- 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 +181 -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 +245 -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/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/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 +52 -12
- package/dist/src/ide/detect-ide.js +51 -65
- package/dist/src/ide/detect-ide.js.map +1 -1
- package/dist/src/ide/detect-ide.test.js +95 -52
- package/dist/src/ide/detect-ide.test.js.map +1 -1
- package/dist/src/ide/ide-client.d.ts +72 -24
- package/dist/src/ide/ide-client.js +380 -84
- package/dist/src/ide/ide-client.js.map +1 -1
- package/dist/src/ide/ide-client.test.js +539 -35
- 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 +93 -35
- package/dist/src/ide/ide-installer.js.map +1 -1
- package/dist/src/ide/ide-installer.test.js +157 -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 +108 -67
- 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 +151 -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 +41 -2
- package/dist/src/index.js +44 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/google-auth-provider.d.ts +5 -3
- 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 +25 -18
- package/dist/src/mcp/oauth-provider.js +194 -97
- package/dist/src/mcp/oauth-provider.js.map +1 -1
- package/dist/src/mcp/oauth-provider.test.js +581 -39
- 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 +58 -28
- package/dist/src/mcp/oauth-token-storage.js.map +1 -1
- package/dist/src/mcp/oauth-token-storage.test.js +262 -162
- package/dist/src/mcp/oauth-token-storage.test.js.map +1 -1
- package/dist/src/mcp/oauth-utils.d.ts +16 -1
- package/dist/src/mcp/oauth-utils.js +68 -33
- package/dist/src/mcp/oauth-utils.js.map +1 -1
- package/dist/src/mcp/oauth-utils.test.js +86 -3
- package/dist/src/mcp/oauth-utils.test.js.map +1 -1
- package/dist/src/mcp/sa-impersonation-provider.d.ts +27 -0
- package/dist/src/mcp/sa-impersonation-provider.js +113 -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 +151 -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 +145 -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 +238 -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 +35 -0
- package/dist/src/mcp/token-storage/keychain-token-storage.js +246 -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 +305 -0
- package/dist/src/mcp/token-storage/keychain-token-storage.test.js.map +1 -0
- package/dist/src/mcp/token-storage/types.d.ts +44 -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/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 +82 -0
- package/dist/src/output/types.js +22 -0
- package/dist/src/output/types.js.map +1 -0
- 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 +9 -0
- package/dist/src/policy/index.js +10 -0
- package/dist/src/policy/index.js.map +1 -0
- 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 +39 -0
- package/dist/src/policy/policy-engine.js +158 -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 +899 -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/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 +130 -0
- package/dist/src/policy/types.js +22 -0
- package/dist/src/policy/types.js.map +1 -0
- package/dist/src/prompts/mcp-prompts.d.ts +2 -2
- 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.d.ts +1 -1
- 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.d.ts +23 -0
- package/dist/src/routing/modelRouterService.js +85 -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 +160 -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 +166 -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 +196 -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 +59 -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 +45 -0
- package/dist/src/routing/strategies/overrideStrategy.test.js.map +1 -0
- 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 +10 -15
- package/dist/src/services/chatRecordingService.js +43 -29
- 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 +8 -10
- package/dist/src/services/fileDiscoveryService.js +31 -53
- package/dist/src/services/fileDiscoveryService.js.map +1 -1
- package/dist/src/services/fileDiscoveryService.test.js +94 -14
- 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 +12 -3
- package/dist/src/services/loopDetectionService.js +148 -55
- package/dist/src/services/loopDetectionService.js.map +1 -1
- package/dist/src/services/loopDetectionService.test.js +280 -21
- 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 +37 -2
- package/dist/src/services/shellExecutionService.js +361 -67
- package/dist/src/services/shellExecutionService.js.map +1 -1
- package/dist/src/services/shellExecutionService.test.js +333 -71
- 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-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-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/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 +53 -5
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +581 -56
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.d.ts +2 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +467 -31
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +75 -4
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +182 -6
- 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 +0 -18
- package/dist/src/telemetry/constants.js +0 -18
- 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 +116 -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 +16 -2
- package/dist/src/telemetry/index.js +25 -2
- package/dist/src/telemetry/index.js.map +1 -1
- package/dist/src/telemetry/loggers.d.ts +25 -3
- package/dist/src/telemetry/loggers.js +333 -154
- package/dist/src/telemetry/loggers.js.map +1 -1
- package/dist/src/telemetry/loggers.test.circular.js +3 -4
- package/dist/src/telemetry/loggers.test.circular.js.map +1 -1
- package/dist/src/telemetry/loggers.test.js +868 -63
- 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 +498 -11
- package/dist/src/telemetry/metrics.js +729 -84
- package/dist/src/telemetry/metrics.js.map +1 -1
- package/dist/src/telemetry/metrics.test.js +964 -101
- 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 +23 -4
- 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/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.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 +41 -0
- package/dist/src/telemetry/telemetry-utils.test.js.map +1 -0
- 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 +351 -25
- package/dist/src/telemetry/types.js +1071 -63
- package/dist/src/telemetry/types.js.map +1 -1
- package/dist/src/telemetry/uiTelemetry.d.ts +4 -4
- package/dist/src/telemetry/uiTelemetry.js +14 -15
- package/dist/src/telemetry/uiTelemetry.js.map +1 -1
- package/dist/src/telemetry/uiTelemetry.test.js +122 -96
- package/dist/src/telemetry/uiTelemetry.test.js.map +1 -1
- package/dist/src/test-utils/config.d.ts +3 -2
- package/dist/src/test-utils/config.js +1 -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/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/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 +10 -8
- package/dist/src/tools/edit.js +100 -79
- package/dist/src/tools/edit.js.map +1 -1
- package/dist/src/tools/edit.test.js +429 -163
- package/dist/src/tools/edit.test.js.map +1 -1
- package/dist/src/tools/glob.d.ts +11 -5
- package/dist/src/tools/glob.js +58 -42
- package/dist/src/tools/glob.js.map +1 -1
- package/dist/src/tools/glob.test.js +249 -166
- package/dist/src/tools/glob.test.js.map +1 -1
- package/dist/src/tools/grep.d.ts +7 -5
- package/dist/src/tools/grep.js +66 -40
- package/dist/src/tools/grep.js.map +1 -1
- package/dist/src/tools/grep.test.js +41 -15
- package/dist/src/tools/grep.test.js.map +1 -1
- package/dist/src/tools/ls.d.ts +7 -5
- package/dist/src/tools/ls.js +54 -68
- package/dist/src/tools/ls.js.map +1 -1
- package/dist/src/tools/ls.test.js +150 -293
- package/dist/src/tools/ls.test.js.map +1 -1
- package/dist/src/tools/mcp-client-manager.d.ts +52 -12
- package/dist/src/tools/mcp-client-manager.js +196 -27
- package/dist/src/tools/mcp-client-manager.js.map +1 -1
- package/dist/src/tools/mcp-client-manager.test.js +139 -13
- package/dist/src/tools/mcp-client-manager.test.js.map +1 -1
- package/dist/src/tools/mcp-client.d.ts +28 -24
- package/dist/src/tools/mcp-client.js +338 -351
- package/dist/src/tools/mcp-client.js.map +1 -1
- package/dist/src/tools/mcp-client.test.js +380 -193
- package/dist/src/tools/mcp-client.test.js.map +1 -1
- package/dist/src/tools/mcp-tool.d.ts +11 -5
- package/dist/src/tools/mcp-tool.js +66 -17
- package/dist/src/tools/mcp-tool.js.map +1 -1
- package/dist/src/tools/mcp-tool.test.js +278 -211
- package/dist/src/tools/mcp-tool.test.js.map +1 -1
- package/dist/src/tools/memoryTool.d.ts +10 -7
- package/dist/src/tools/memoryTool.js +28 -49
- package/dist/src/tools/memoryTool.js.map +1 -1
- package/dist/src/tools/memoryTool.test.js +26 -13
- 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 +196 -0
- package/dist/src/tools/message-bus-integration.test.js.map +1 -0
- package/dist/src/tools/modifiable-tool.d.ts +7 -3
- package/dist/src/tools/modifiable-tool.js +41 -19
- package/dist/src/tools/modifiable-tool.js.map +1 -1
- package/dist/src/tools/modifiable-tool.test.js +70 -35
- package/dist/src/tools/modifiable-tool.test.js.map +1 -1
- package/dist/src/tools/read-file.d.ts +9 -7
- package/dist/src/tools/read-file.js +39 -60
- package/dist/src/tools/read-file.js.map +1 -1
- package/dist/src/tools/read-file.test.js +103 -36
- package/dist/src/tools/read-file.test.js.map +1 -1
- package/dist/src/tools/read-many-files.d.ts +9 -14
- package/dist/src/tools/read-many-files.js +71 -155
- package/dist/src/tools/read-many-files.js.map +1 -1
- package/dist/src/tools/read-many-files.test.js +98 -44
- package/dist/src/tools/read-many-files.test.js.map +1 -1
- package/dist/src/tools/ripGrep.d.ts +73 -0
- package/dist/src/tools/ripGrep.js +395 -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 +1305 -0
- package/dist/src/tools/ripGrep.test.js.map +1 -0
- package/dist/src/tools/shell.d.ts +19 -6
- package/dist/src/tools/shell.js +92 -56
- package/dist/src/tools/shell.js.map +1 -1
- package/dist/src/tools/shell.test.js +176 -103
- package/dist/src/tools/shell.test.js.map +1 -1
- package/dist/src/tools/smart-edit.d.ts +78 -0
- package/dist/src/tools/smart-edit.js +717 -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 +592 -0
- package/dist/src/tools/smart-edit.test.js.map +1 -0
- package/dist/src/tools/tool-error.d.ts +39 -1
- package/dist/src/tools/tool-error.js +54 -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 +38 -20
- package/dist/src/tools/tool-registry.js +134 -77
- package/dist/src/tools/tool-registry.js.map +1 -1
- package/dist/src/tools/tool-registry.test.js +218 -58
- package/dist/src/tools/tool-registry.test.js.map +1 -1
- package/dist/src/tools/tools.d.ts +49 -17
- package/dist/src/tools/tools.js +150 -8
- 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 +14 -5
- package/dist/src/tools/web-fetch.js +90 -44
- package/dist/src/tools/web-fetch.js.map +1 -1
- package/dist/src/tools/web-fetch.test.js +388 -20
- package/dist/src/tools/web-fetch.test.js.map +1 -1
- package/dist/src/tools/web-search.d.ts +8 -6
- package/dist/src/tools/web-search.js +40 -15
- package/dist/src/tools/web-search.js.map +1 -1
- package/dist/src/tools/web-search.test.js +75 -1
- package/dist/src/tools/web-search.test.js.map +1 -1
- package/dist/src/tools/write-file.d.ts +7 -5
- package/dist/src/tools/write-file.js +54 -54
- package/dist/src/tools/write-file.js.map +1 -1
- package/dist/src/tools/write-file.test.js +237 -146
- package/dist/src/tools/write-file.test.js.map +1 -1
- package/dist/src/tools/write-todos.d.ts +50 -0
- package/dist/src/tools/write-todos.js +193 -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 +16 -9
- 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/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.d.ts +9 -8
- package/dist/src/utils/editCorrector.js +62 -34
- package/dist/src/utils/editCorrector.js.map +1 -1
- package/dist/src/utils/editCorrector.test.js +52 -87
- 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 +56 -55
- package/dist/src/utils/editor.js.map +1 -1
- package/dist/src/utils/editor.test.js +47 -88
- package/dist/src/utils/editor.test.js.map +1 -1
- package/dist/src/utils/environmentContext.d.ts +3 -2
- 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/errorReporting.d.ts +1 -1
- package/dist/src/utils/errors.d.ts +28 -0
- package/dist/src/utils/errors.js +48 -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 +5 -1
- package/dist/src/utils/fetch.js.map +1 -1
- package/dist/src/utils/fileUtils.d.ts +28 -12
- package/dist/src/utils/fileUtils.js +204 -81
- package/dist/src/utils/fileUtils.js.map +1 -1
- package/dist/src/utils/fileUtils.test.js +426 -82
- 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.test.js +103 -0
- package/dist/src/utils/flashFallback.test.js.map +1 -0
- 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/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 +12 -20
- package/dist/src/utils/getFolderStructure.js.map +1 -1
- package/dist/src/utils/getFolderStructure.test.js +11 -10
- package/dist/src/utils/getFolderStructure.test.js.map +1 -1
- package/dist/src/utils/gitIgnoreParser.d.ts +7 -8
- package/dist/src/utils/gitIgnoreParser.js +145 -36
- package/dist/src/utils/gitIgnoreParser.js.map +1 -1
- package/dist/src/utils/gitIgnoreParser.test.js +127 -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/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.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 +246 -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 +51 -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 +85 -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 +155 -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 +223 -0
- package/dist/src/utils/llm-edit-fixer.test.js.map +1 -0
- package/dist/src/utils/memoryDiscovery.d.ts +26 -6
- package/dist/src/utils/memoryDiscovery.js +239 -40
- package/dist/src/utils/memoryDiscovery.js.map +1 -1
- package/dist/src/utils/memoryDiscovery.test.js +365 -44
- package/dist/src/utils/memoryDiscovery.test.js.map +1 -1
- package/dist/src/utils/memoryImportProcessor.js +19 -25
- package/dist/src/utils/memoryImportProcessor.js.map +1 -1
- package/dist/src/utils/memoryImportProcessor.test.js +24 -155
- 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 +10 -4
- package/dist/src/utils/nextSpeakerChecker.js.map +1 -1
- package/dist/src/utils/nextSpeakerChecker.test.js +85 -66
- 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/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/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.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 +406 -0
- package/dist/src/utils/pathReader.test.js.map +1 -0
- package/dist/src/utils/paths.d.ts +1 -18
- package/dist/src/utils/paths.js +133 -57
- 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/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 -3
- package/dist/src/utils/quotaErrorDetection.js +0 -46
- package/dist/src/utils/quotaErrorDetection.js.map +1 -1
- package/dist/src/utils/retry.d.ts +5 -10
- package/dist/src/utils/retry.js +114 -197
- package/dist/src/utils/retry.js.map +1 -1
- package/dist/src/utils/retry.test.js +196 -130
- 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/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 +21 -3
- package/dist/src/utils/shell-utils.js +427 -159
- package/dist/src/utils/shell-utils.js.map +1 -1
- package/dist/src/utils/shell-utils.test.js +250 -59
- 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 +6 -4
- 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 +7 -6
- package/dist/src/utils/systemEncoding.js.map +1 -1
- package/dist/src/utils/systemEncoding.test.js +4 -3
- 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/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 +67 -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 +69 -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 +115 -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} +41 -36
- package/dist/src/utils/userAccountManager.test.js.map +1 -0
- package/dist/src/utils/workspaceContext.d.ts +4 -3
- package/dist/src/utils/workspaceContext.js +23 -17
- package/dist/src/utils/workspaceContext.js.map +1 -1
- package/dist/src/utils/workspaceContext.test.js +45 -19
- package/dist/src/utils/workspaceContext.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +24 -10
- 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 +0 -118
- 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/codebase-investigator.test.d.ts} +0 -0
- /package/dist/src/{utils/user_account.test.d.ts → agents/executor.test.d.ts} +0 -0
- /package/dist/src/{utils/user_id.test.d.ts → agents/invocation.test.d.ts} +0 -0
|
@@ -4,18 +4,24 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { AuthType, EditTool, GeminiClient, ToolConfirmationOutcome, ToolErrorType, ToolRegistry, } from '../index.js';
|
|
7
|
+
import { OutputFormat } from '../output/types.js';
|
|
7
8
|
import { logs } from '@opentelemetry/api-logs';
|
|
8
|
-
import {
|
|
9
|
-
import { EVENT_API_REQUEST, EVENT_API_RESPONSE, EVENT_CLI_CONFIG, EVENT_TOOL_CALL, EVENT_USER_PROMPT, EVENT_FLASH_FALLBACK, } from './constants.js';
|
|
10
|
-
import { logApiRequest, logApiResponse, logCliConfiguration, logUserPrompt, logToolCall, logFlashFallback, logChatCompression, } from './loggers.js';
|
|
9
|
+
import { logApiError, logApiRequest, logApiResponse, logCliConfiguration, logUserPrompt, logToolCall, logFlashFallback, logChatCompression, logMalformedJsonResponse, logFileOperation, logRipgrepFallback, logToolOutputTruncated, logModelRouting, logExtensionEnable, logExtensionDisable, logExtensionInstallEvent, logExtensionUninstall, logAgentStart, logAgentFinish, logWebFetchFallbackAttempt, logExtensionUpdateEvent, } from './loggers.js';
|
|
11
10
|
import { ToolCallDecision } from './tool-call-decision.js';
|
|
12
|
-
import { ApiRequestEvent, ApiResponseEvent, StartSessionEvent, ToolCallEvent, UserPromptEvent, FlashFallbackEvent, makeChatCompressionEvent, } from './types.js';
|
|
11
|
+
import { EVENT_API_ERROR, EVENT_API_REQUEST, EVENT_API_RESPONSE, EVENT_CLI_CONFIG, EVENT_TOOL_CALL, EVENT_USER_PROMPT, EVENT_FLASH_FALLBACK, EVENT_MALFORMED_JSON_RESPONSE, EVENT_FILE_OPERATION, EVENT_RIPGREP_FALLBACK, EVENT_MODEL_ROUTING, EVENT_EXTENSION_ENABLE, EVENT_EXTENSION_DISABLE, EVENT_EXTENSION_INSTALL, EVENT_EXTENSION_UNINSTALL, EVENT_TOOL_OUTPUT_TRUNCATED, EVENT_AGENT_START, EVENT_AGENT_FINISH, EVENT_WEB_FETCH_FALLBACK_ATTEMPT, ApiErrorEvent, ApiRequestEvent, ApiResponseEvent, StartSessionEvent, ToolCallEvent, UserPromptEvent, FlashFallbackEvent, RipgrepFallbackEvent, MalformedJsonResponseEvent, makeChatCompressionEvent, FileOperationEvent, ToolOutputTruncatedEvent, ModelRoutingEvent, ExtensionEnableEvent, ExtensionDisableEvent, ExtensionInstallEvent, ExtensionUninstallEvent, AgentStartEvent, AgentFinishEvent, WebFetchFallbackAttemptEvent, ExtensionUpdateEvent, EVENT_EXTENSION_UPDATE, } from './types.js';
|
|
13
12
|
import * as metrics from './metrics.js';
|
|
13
|
+
import { FileOperation } from './metrics.js';
|
|
14
14
|
import * as sdk from './sdk.js';
|
|
15
|
-
import { vi, describe, beforeEach, it, expect } from 'vitest';
|
|
15
|
+
import { vi, describe, beforeEach, it, expect, afterEach } from 'vitest';
|
|
16
|
+
import {} from '../config/config.js';
|
|
17
|
+
import { FinishReason, } from '@google/genai';
|
|
18
|
+
import { DiscoveredMCPTool } from '../tools/mcp-tool.js';
|
|
16
19
|
import * as uiTelemetry from './uiTelemetry.js';
|
|
17
20
|
import { makeFakeConfig } from '../test-utils/config.js';
|
|
18
21
|
import { ClearcutLogger } from './clearcut-logger/clearcut-logger.js';
|
|
22
|
+
import { UserAccountManager } from '../utils/userAccountManager.js';
|
|
23
|
+
import { InstallationManager } from '../utils/installationManager.js';
|
|
24
|
+
import { AgentTerminateMode } from '../agents/types.js';
|
|
19
25
|
describe('loggers', () => {
|
|
20
26
|
const mockLogger = {
|
|
21
27
|
emit: vi.fn(),
|
|
@@ -24,9 +30,12 @@ describe('loggers', () => {
|
|
|
24
30
|
addEvent: vi.fn(),
|
|
25
31
|
};
|
|
26
32
|
beforeEach(() => {
|
|
33
|
+
vi.clearAllMocks();
|
|
27
34
|
vi.spyOn(sdk, 'isTelemetrySdkInitialized').mockReturnValue(true);
|
|
28
35
|
vi.spyOn(logs, 'getLogger').mockReturnValue(mockLogger);
|
|
29
36
|
vi.spyOn(uiTelemetry.uiTelemetryService, 'addEvent').mockImplementation(mockUiEvent.addEvent);
|
|
37
|
+
vi.spyOn(UserAccountManager.prototype, 'getCachedGoogleAccount').mockReturnValue('test-user@example.com');
|
|
38
|
+
vi.spyOn(InstallationManager.prototype, 'getInstallationId').mockReturnValue('test-installation-id');
|
|
30
39
|
vi.useFakeTimers();
|
|
31
40
|
vi.setSystemTime(new Date('2025-01-01T00:00:00.000Z'));
|
|
32
41
|
});
|
|
@@ -73,14 +82,25 @@ describe('loggers', () => {
|
|
|
73
82
|
getFileFilteringRespectGitIgnore: () => true,
|
|
74
83
|
getFileFilteringAllowBuildArtifacts: () => false,
|
|
75
84
|
getDebugMode: () => true,
|
|
76
|
-
getMcpServers: () =>
|
|
77
|
-
'
|
|
78
|
-
|
|
79
|
-
},
|
|
80
|
-
}),
|
|
85
|
+
getMcpServers: () => {
|
|
86
|
+
throw new Error('Should not call');
|
|
87
|
+
},
|
|
81
88
|
getQuestion: () => 'test-question',
|
|
82
89
|
getTargetDir: () => 'target-dir',
|
|
83
90
|
getProxy: () => 'http://test.proxy.com:8080',
|
|
91
|
+
getOutputFormat: () => OutputFormat.JSON,
|
|
92
|
+
getExtensions: () => [
|
|
93
|
+
{ name: 'ext-one', id: 'id-one' },
|
|
94
|
+
{ name: 'ext-two', id: 'id-two' },
|
|
95
|
+
],
|
|
96
|
+
getMcpClientManager: () => ({
|
|
97
|
+
getMcpServers: () => ({
|
|
98
|
+
'test-server': {
|
|
99
|
+
command: 'test-command',
|
|
100
|
+
},
|
|
101
|
+
}),
|
|
102
|
+
}),
|
|
103
|
+
isInteractive: () => false,
|
|
84
104
|
};
|
|
85
105
|
const startSessionEvent = new StartSessionEvent(mockConfig);
|
|
86
106
|
logCliConfiguration(mockConfig, startSessionEvent);
|
|
@@ -88,8 +108,11 @@ describe('loggers', () => {
|
|
|
88
108
|
body: 'CLI configuration loaded.',
|
|
89
109
|
attributes: {
|
|
90
110
|
'session.id': 'test-session-id',
|
|
111
|
+
'user.email': 'test-user@example.com',
|
|
112
|
+
'installation.id': 'test-installation-id',
|
|
91
113
|
'event.name': EVENT_CLI_CONFIG,
|
|
92
114
|
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
115
|
+
interactive: false,
|
|
93
116
|
model: 'test-model',
|
|
94
117
|
embedding_model: 'test-embedding-model',
|
|
95
118
|
sandbox_enabled: true,
|
|
@@ -101,6 +124,14 @@ describe('loggers', () => {
|
|
|
101
124
|
file_filtering_respect_git_ignore: true,
|
|
102
125
|
debug_mode: true,
|
|
103
126
|
mcp_servers: 'test-server',
|
|
127
|
+
mcp_servers_count: 1,
|
|
128
|
+
mcp_tools: undefined,
|
|
129
|
+
mcp_tools_count: undefined,
|
|
130
|
+
output_format: 'json',
|
|
131
|
+
extension_ids: 'id-one,id-two',
|
|
132
|
+
extensions_count: 2,
|
|
133
|
+
extensions: 'ext-one,ext-two',
|
|
134
|
+
auth_type: 'vertex-ai',
|
|
104
135
|
},
|
|
105
136
|
});
|
|
106
137
|
});
|
|
@@ -111,6 +142,7 @@ describe('loggers', () => {
|
|
|
111
142
|
getTelemetryEnabled: () => true,
|
|
112
143
|
getTelemetryLogPromptsEnabled: () => true,
|
|
113
144
|
getUsageStatisticsEnabled: () => true,
|
|
145
|
+
isInteractive: () => false,
|
|
114
146
|
};
|
|
115
147
|
it('should log a user prompt', () => {
|
|
116
148
|
const event = new UserPromptEvent(11, 'prompt-id-8', AuthType.USE_VERTEX_AI, 'test-prompt');
|
|
@@ -119,10 +151,15 @@ describe('loggers', () => {
|
|
|
119
151
|
body: 'User prompt. Length: 11.',
|
|
120
152
|
attributes: {
|
|
121
153
|
'session.id': 'test-session-id',
|
|
154
|
+
'user.email': 'test-user@example.com',
|
|
155
|
+
'installation.id': 'test-installation-id',
|
|
122
156
|
'event.name': EVENT_USER_PROMPT,
|
|
123
157
|
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
158
|
+
interactive: false,
|
|
124
159
|
prompt_length: 11,
|
|
125
160
|
prompt: 'test-prompt',
|
|
161
|
+
prompt_id: 'prompt-id-8',
|
|
162
|
+
auth_type: 'vertex-ai',
|
|
126
163
|
},
|
|
127
164
|
});
|
|
128
165
|
});
|
|
@@ -133,16 +170,22 @@ describe('loggers', () => {
|
|
|
133
170
|
getTelemetryLogPromptsEnabled: () => false,
|
|
134
171
|
getTargetDir: () => 'target-dir',
|
|
135
172
|
getUsageStatisticsEnabled: () => true,
|
|
173
|
+
isInteractive: () => false,
|
|
136
174
|
};
|
|
137
|
-
const event = new UserPromptEvent(11, '
|
|
175
|
+
const event = new UserPromptEvent(11, 'prompt-id-9', AuthType.COMPUTE_ADC, 'test-prompt');
|
|
138
176
|
logUserPrompt(mockConfig, event);
|
|
139
177
|
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
140
178
|
body: 'User prompt. Length: 11.',
|
|
141
179
|
attributes: {
|
|
142
180
|
'session.id': 'test-session-id',
|
|
181
|
+
'user.email': 'test-user@example.com',
|
|
182
|
+
'installation.id': 'test-installation-id',
|
|
143
183
|
'event.name': EVENT_USER_PROMPT,
|
|
144
184
|
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
185
|
+
interactive: false,
|
|
145
186
|
prompt_length: 11,
|
|
187
|
+
prompt_id: 'prompt-id-9',
|
|
188
|
+
auth_type: 'compute-default-credentials',
|
|
146
189
|
},
|
|
147
190
|
});
|
|
148
191
|
});
|
|
@@ -154,6 +197,7 @@ describe('loggers', () => {
|
|
|
154
197
|
getUsageStatisticsEnabled: () => true,
|
|
155
198
|
getTelemetryEnabled: () => true,
|
|
156
199
|
getTelemetryLogPromptsEnabled: () => true,
|
|
200
|
+
isInteractive: () => false,
|
|
157
201
|
};
|
|
158
202
|
const mockMetrics = {
|
|
159
203
|
recordApiResponseMetrics: vi.fn(),
|
|
@@ -171,60 +215,216 @@ describe('loggers', () => {
|
|
|
171
215
|
thoughtsTokenCount: 5,
|
|
172
216
|
toolUsePromptTokenCount: 2,
|
|
173
217
|
};
|
|
174
|
-
const event = new ApiResponseEvent('test-model', 100,
|
|
218
|
+
const event = new ApiResponseEvent('test-model', 100, {
|
|
219
|
+
prompt_id: 'prompt-id-1',
|
|
220
|
+
contents: [
|
|
221
|
+
{
|
|
222
|
+
role: 'user',
|
|
223
|
+
parts: [{ text: 'Hello' }],
|
|
224
|
+
},
|
|
225
|
+
],
|
|
226
|
+
generate_content_config: {
|
|
227
|
+
temperature: 1,
|
|
228
|
+
topP: 2,
|
|
229
|
+
topK: 3,
|
|
230
|
+
responseMimeType: 'text/plain',
|
|
231
|
+
candidateCount: 1,
|
|
232
|
+
seed: 678,
|
|
233
|
+
frequencyPenalty: 10,
|
|
234
|
+
maxOutputTokens: 8000,
|
|
235
|
+
presencePenalty: 6,
|
|
236
|
+
stopSequences: ['stop', 'please stop'],
|
|
237
|
+
systemInstruction: {
|
|
238
|
+
role: 'model',
|
|
239
|
+
parts: [{ text: 'be nice' }],
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
server: {
|
|
243
|
+
address: 'foo.com',
|
|
244
|
+
port: 8080,
|
|
245
|
+
},
|
|
246
|
+
}, {
|
|
247
|
+
response_id: '',
|
|
248
|
+
candidates: [
|
|
249
|
+
{
|
|
250
|
+
content: {
|
|
251
|
+
role: 'model',
|
|
252
|
+
parts: [{ text: 'candidate 1' }],
|
|
253
|
+
},
|
|
254
|
+
finishReason: FinishReason.STOP,
|
|
255
|
+
},
|
|
256
|
+
],
|
|
257
|
+
}, AuthType.LOGIN_WITH_GOOGLE, usageData, 'test-response');
|
|
175
258
|
logApiResponse(mockConfig, event);
|
|
176
259
|
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
177
260
|
body: 'API response from test-model. Status: 200. Duration: 100ms.',
|
|
178
|
-
attributes: {
|
|
179
|
-
'session.id': 'test-session-id',
|
|
261
|
+
attributes: expect.objectContaining({
|
|
180
262
|
'event.name': EVENT_API_RESPONSE,
|
|
181
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
182
|
-
[SemanticAttributes.HTTP_STATUS_CODE]: 200,
|
|
183
|
-
model: 'test-model',
|
|
184
|
-
status_code: 200,
|
|
185
|
-
duration_ms: 100,
|
|
186
|
-
input_token_count: 17,
|
|
187
|
-
output_token_count: 50,
|
|
188
|
-
cached_content_token_count: 10,
|
|
189
|
-
thoughts_token_count: 5,
|
|
190
|
-
tool_token_count: 2,
|
|
191
|
-
total_token_count: 0,
|
|
192
|
-
response_text: 'test-response',
|
|
193
263
|
prompt_id: 'prompt-id-1',
|
|
194
|
-
|
|
264
|
+
}),
|
|
265
|
+
});
|
|
266
|
+
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
267
|
+
body: 'GenAI operation details from test-model. Status: 200. Duration: 100ms.',
|
|
268
|
+
attributes: expect.objectContaining({
|
|
269
|
+
'event.name': 'gen_ai.client.inference.operation.details',
|
|
270
|
+
'gen_ai.request.model': 'test-model',
|
|
271
|
+
'gen_ai.request.temperature': 1,
|
|
272
|
+
'gen_ai.request.top_p': 2,
|
|
273
|
+
'gen_ai.request.top_k': 3,
|
|
274
|
+
'gen_ai.input.messages': '[{"role":"user","parts":[{"type":"text","content":"Hello"}]}]',
|
|
275
|
+
'gen_ai.output.messages': '[{"finish_reason":"stop","role":"system","parts":[{"type":"text","content":"candidate 1"}]}]',
|
|
276
|
+
'gen_ai.response.finish_reasons': ['stop'],
|
|
277
|
+
'gen_ai.response.model': 'test-model',
|
|
278
|
+
'gen_ai.usage.input_tokens': 17,
|
|
279
|
+
'gen_ai.usage.output_tokens': 50,
|
|
280
|
+
'gen_ai.operation.name': 'generate_content',
|
|
281
|
+
'gen_ai.output.type': 'text',
|
|
282
|
+
'gen_ai.request.choice.count': 1,
|
|
283
|
+
'gen_ai.request.seed': 678,
|
|
284
|
+
'gen_ai.request.frequency_penalty': 10,
|
|
285
|
+
'gen_ai.request.presence_penalty': 6,
|
|
286
|
+
'gen_ai.request.max_tokens': 8000,
|
|
287
|
+
'server.address': 'foo.com',
|
|
288
|
+
'server.port': 8080,
|
|
289
|
+
'gen_ai.request.stop_sequences': ['stop', 'please stop'],
|
|
290
|
+
'gen_ai.system_instructions': '[{"type":"text","content":"be nice"}]',
|
|
291
|
+
}),
|
|
292
|
+
});
|
|
293
|
+
expect(mockMetrics.recordApiResponseMetrics).toHaveBeenCalledWith(mockConfig, 100, {
|
|
294
|
+
model: 'test-model',
|
|
295
|
+
status_code: 200,
|
|
296
|
+
genAiAttributes: {
|
|
297
|
+
'gen_ai.operation.name': 'generate_content',
|
|
298
|
+
'gen_ai.provider.name': 'gcp.vertex_ai',
|
|
299
|
+
'gen_ai.request.model': 'test-model',
|
|
300
|
+
'gen_ai.response.model': 'test-model',
|
|
301
|
+
},
|
|
302
|
+
});
|
|
303
|
+
// Verify token usage calls for all token types
|
|
304
|
+
expect(mockMetrics.recordTokenUsageMetrics).toHaveBeenCalledWith(mockConfig, 17, {
|
|
305
|
+
model: 'test-model',
|
|
306
|
+
type: 'input',
|
|
307
|
+
genAiAttributes: {
|
|
308
|
+
'gen_ai.operation.name': 'generate_content',
|
|
309
|
+
'gen_ai.provider.name': 'gcp.vertex_ai',
|
|
310
|
+
'gen_ai.request.model': 'test-model',
|
|
311
|
+
'gen_ai.response.model': 'test-model',
|
|
312
|
+
},
|
|
313
|
+
});
|
|
314
|
+
expect(mockMetrics.recordTokenUsageMetrics).toHaveBeenCalledWith(mockConfig, 50, {
|
|
315
|
+
model: 'test-model',
|
|
316
|
+
type: 'output',
|
|
317
|
+
genAiAttributes: {
|
|
318
|
+
'gen_ai.operation.name': 'generate_content',
|
|
319
|
+
'gen_ai.provider.name': 'gcp.vertex_ai',
|
|
320
|
+
'gen_ai.request.model': 'test-model',
|
|
321
|
+
'gen_ai.response.model': 'test-model',
|
|
195
322
|
},
|
|
196
323
|
});
|
|
197
|
-
expect(mockMetrics.recordApiResponseMetrics).toHaveBeenCalledWith(mockConfig, 'test-model', 100, 200, undefined);
|
|
198
|
-
expect(mockMetrics.recordTokenUsageMetrics).toHaveBeenCalledWith(mockConfig, 'test-model', 50, 'output');
|
|
199
324
|
expect(mockUiEvent.addEvent).toHaveBeenCalledWith({
|
|
200
325
|
...event,
|
|
201
326
|
'event.name': EVENT_API_RESPONSE,
|
|
202
327
|
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
203
328
|
});
|
|
204
329
|
});
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
330
|
+
});
|
|
331
|
+
describe('logApiError', () => {
|
|
332
|
+
const mockConfig = {
|
|
333
|
+
getSessionId: () => 'test-session-id',
|
|
334
|
+
getTargetDir: () => 'target-dir',
|
|
335
|
+
getUsageStatisticsEnabled: () => true,
|
|
336
|
+
getTelemetryEnabled: () => true,
|
|
337
|
+
getTelemetryLogPromptsEnabled: () => true,
|
|
338
|
+
isInteractive: () => false,
|
|
339
|
+
};
|
|
340
|
+
const mockMetrics = {
|
|
341
|
+
recordApiResponseMetrics: vi.fn(),
|
|
342
|
+
recordApiErrorMetrics: vi.fn(),
|
|
343
|
+
recordTokenUsageMetrics: vi.fn(),
|
|
344
|
+
};
|
|
345
|
+
beforeEach(() => {
|
|
346
|
+
vi.spyOn(metrics, 'recordApiResponseMetrics').mockImplementation(mockMetrics.recordApiResponseMetrics);
|
|
347
|
+
vi.spyOn(metrics, 'recordApiErrorMetrics').mockImplementation(mockMetrics.recordApiErrorMetrics);
|
|
348
|
+
});
|
|
349
|
+
it('should log an API error with all fields', () => {
|
|
350
|
+
const event = new ApiErrorEvent('test-model', 'UNAVAILABLE. {"error":{"code":503,"message":"The model is overloaded. Please try again later.","status":"UNAVAILABLE"}}', 100, {
|
|
351
|
+
prompt_id: 'prompt-id-1',
|
|
352
|
+
contents: [
|
|
353
|
+
{
|
|
354
|
+
role: 'user',
|
|
355
|
+
parts: [{ text: 'Hello' }],
|
|
356
|
+
},
|
|
357
|
+
],
|
|
358
|
+
generate_content_config: {
|
|
359
|
+
temperature: 1,
|
|
360
|
+
topP: 2,
|
|
361
|
+
topK: 3,
|
|
362
|
+
responseMimeType: 'text/plain',
|
|
363
|
+
candidateCount: 1,
|
|
364
|
+
seed: 678,
|
|
365
|
+
frequencyPenalty: 10,
|
|
366
|
+
maxOutputTokens: 8000,
|
|
367
|
+
presencePenalty: 6,
|
|
368
|
+
stopSequences: ['stop', 'please stop'],
|
|
369
|
+
systemInstruction: {
|
|
370
|
+
role: 'model',
|
|
371
|
+
parts: [{ text: 'be nice' }],
|
|
372
|
+
},
|
|
373
|
+
},
|
|
374
|
+
server: {
|
|
375
|
+
address: 'foo.com',
|
|
376
|
+
port: 8080,
|
|
377
|
+
},
|
|
378
|
+
}, AuthType.LOGIN_WITH_GOOGLE, 'ApiError', 503);
|
|
379
|
+
logApiError(mockConfig, event);
|
|
215
380
|
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
216
|
-
body: 'API
|
|
217
|
-
attributes: {
|
|
218
|
-
'
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
381
|
+
body: 'API error for test-model. Error: UNAVAILABLE. {"error":{"code":503,"message":"The model is overloaded. Please try again later.","status":"UNAVAILABLE"}}. Duration: 100ms.',
|
|
382
|
+
attributes: expect.objectContaining({
|
|
383
|
+
'event.name': EVENT_API_ERROR,
|
|
384
|
+
prompt_id: 'prompt-id-1',
|
|
385
|
+
}),
|
|
386
|
+
});
|
|
387
|
+
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
388
|
+
body: 'GenAI operation error details from test-model. Error: UNAVAILABLE. {"error":{"code":503,"message":"The model is overloaded. Please try again later.","status":"UNAVAILABLE"}}. Duration: 100ms.',
|
|
389
|
+
attributes: expect.objectContaining({
|
|
390
|
+
'event.name': 'gen_ai.client.inference.operation.details',
|
|
391
|
+
'gen_ai.request.model': 'test-model',
|
|
392
|
+
'gen_ai.request.temperature': 1,
|
|
393
|
+
'gen_ai.request.top_p': 2,
|
|
394
|
+
'gen_ai.request.top_k': 3,
|
|
395
|
+
'gen_ai.input.messages': '[{"role":"user","parts":[{"type":"text","content":"Hello"}]}]',
|
|
396
|
+
'gen_ai.operation.name': 'generate_content',
|
|
397
|
+
'gen_ai.output.type': 'text',
|
|
398
|
+
'gen_ai.request.choice.count': 1,
|
|
399
|
+
'gen_ai.request.seed': 678,
|
|
400
|
+
'gen_ai.request.frequency_penalty': 10,
|
|
401
|
+
'gen_ai.request.presence_penalty': 6,
|
|
402
|
+
'gen_ai.request.max_tokens': 8000,
|
|
403
|
+
'server.address': 'foo.com',
|
|
404
|
+
'server.port': 8080,
|
|
405
|
+
'gen_ai.request.stop_sequences': ['stop', 'please stop'],
|
|
406
|
+
'gen_ai.system_instructions': '[{"type":"text","content":"be nice"}]',
|
|
407
|
+
}),
|
|
408
|
+
});
|
|
409
|
+
expect(mockMetrics.recordApiErrorMetrics).toHaveBeenCalledWith(mockConfig, 100, {
|
|
410
|
+
model: 'test-model',
|
|
411
|
+
status_code: 503,
|
|
412
|
+
error_type: 'ApiError',
|
|
413
|
+
});
|
|
414
|
+
expect(mockMetrics.recordApiResponseMetrics).toHaveBeenCalledWith(mockConfig, 100, {
|
|
415
|
+
model: 'test-model',
|
|
416
|
+
status_code: 503,
|
|
417
|
+
genAiAttributes: {
|
|
418
|
+
'gen_ai.operation.name': 'generate_content',
|
|
419
|
+
'gen_ai.provider.name': 'gcp.vertex_ai',
|
|
420
|
+
'gen_ai.request.model': 'test-model',
|
|
421
|
+
'gen_ai.response.model': 'test-model',
|
|
422
|
+
'error.type': 'ApiError',
|
|
223
423
|
},
|
|
224
424
|
});
|
|
225
425
|
expect(mockUiEvent.addEvent).toHaveBeenCalledWith({
|
|
226
426
|
...event,
|
|
227
|
-
'event.name':
|
|
427
|
+
'event.name': EVENT_API_ERROR,
|
|
228
428
|
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
229
429
|
});
|
|
230
430
|
});
|
|
@@ -236,6 +436,7 @@ describe('loggers', () => {
|
|
|
236
436
|
getUsageStatisticsEnabled: () => true,
|
|
237
437
|
getTelemetryEnabled: () => true,
|
|
238
438
|
getTelemetryLogPromptsEnabled: () => true,
|
|
439
|
+
isInteractive: () => false,
|
|
239
440
|
};
|
|
240
441
|
it('should log an API request with request_text', () => {
|
|
241
442
|
const event = new ApiRequestEvent('test-model', 'prompt-id-7', 'This is a test request');
|
|
@@ -244,8 +445,11 @@ describe('loggers', () => {
|
|
|
244
445
|
body: 'API request to test-model.',
|
|
245
446
|
attributes: {
|
|
246
447
|
'session.id': 'test-session-id',
|
|
448
|
+
'user.email': 'test-user@example.com',
|
|
449
|
+
'installation.id': 'test-installation-id',
|
|
247
450
|
'event.name': EVENT_API_REQUEST,
|
|
248
451
|
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
452
|
+
interactive: false,
|
|
249
453
|
model: 'test-model',
|
|
250
454
|
request_text: 'This is a test request',
|
|
251
455
|
prompt_id: 'prompt-id-7',
|
|
@@ -259,8 +463,11 @@ describe('loggers', () => {
|
|
|
259
463
|
body: 'API request to test-model.',
|
|
260
464
|
attributes: {
|
|
261
465
|
'session.id': 'test-session-id',
|
|
466
|
+
'user.email': 'test-user@example.com',
|
|
467
|
+
'installation.id': 'test-installation-id',
|
|
262
468
|
'event.name': EVENT_API_REQUEST,
|
|
263
469
|
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
470
|
+
interactive: false,
|
|
264
471
|
model: 'test-model',
|
|
265
472
|
prompt_id: 'prompt-id-6',
|
|
266
473
|
},
|
|
@@ -271,6 +478,7 @@ describe('loggers', () => {
|
|
|
271
478
|
const mockConfig = {
|
|
272
479
|
getSessionId: () => 'test-session-id',
|
|
273
480
|
getUsageStatisticsEnabled: () => true,
|
|
481
|
+
isInteractive: () => false,
|
|
274
482
|
};
|
|
275
483
|
it('should log flash fallback event', () => {
|
|
276
484
|
const event = new FlashFallbackEvent(AuthType.USE_VERTEX_AI);
|
|
@@ -279,13 +487,54 @@ describe('loggers', () => {
|
|
|
279
487
|
body: 'Switching to flash as Fallback.',
|
|
280
488
|
attributes: {
|
|
281
489
|
'session.id': 'test-session-id',
|
|
490
|
+
'user.email': 'test-user@example.com',
|
|
491
|
+
'installation.id': 'test-installation-id',
|
|
282
492
|
'event.name': EVENT_FLASH_FALLBACK,
|
|
283
493
|
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
494
|
+
interactive: false,
|
|
284
495
|
auth_type: 'vertex-ai',
|
|
285
496
|
},
|
|
286
497
|
});
|
|
287
498
|
});
|
|
288
499
|
});
|
|
500
|
+
describe('logRipgrepFallback', () => {
|
|
501
|
+
const mockConfig = {
|
|
502
|
+
getSessionId: () => 'test-session-id',
|
|
503
|
+
getUsageStatisticsEnabled: () => true,
|
|
504
|
+
isInteractive: () => false,
|
|
505
|
+
};
|
|
506
|
+
beforeEach(() => {
|
|
507
|
+
vi.spyOn(ClearcutLogger.prototype, 'logRipgrepFallbackEvent');
|
|
508
|
+
});
|
|
509
|
+
it('should log ripgrep fallback event', () => {
|
|
510
|
+
const event = new RipgrepFallbackEvent();
|
|
511
|
+
logRipgrepFallback(mockConfig, event);
|
|
512
|
+
expect(ClearcutLogger.prototype.logRipgrepFallbackEvent).toHaveBeenCalled();
|
|
513
|
+
const emittedEvent = mockLogger.emit.mock.calls[0][0];
|
|
514
|
+
expect(emittedEvent.body).toBe('Switching to grep as fallback.');
|
|
515
|
+
expect(emittedEvent.attributes).toEqual(expect.objectContaining({
|
|
516
|
+
'session.id': 'test-session-id',
|
|
517
|
+
'user.email': 'test-user@example.com',
|
|
518
|
+
'installation.id': 'test-installation-id',
|
|
519
|
+
'event.name': EVENT_RIPGREP_FALLBACK,
|
|
520
|
+
error: undefined,
|
|
521
|
+
}));
|
|
522
|
+
});
|
|
523
|
+
it('should log ripgrep fallback event with an error', () => {
|
|
524
|
+
const event = new RipgrepFallbackEvent('rg not found');
|
|
525
|
+
logRipgrepFallback(mockConfig, event);
|
|
526
|
+
expect(ClearcutLogger.prototype.logRipgrepFallbackEvent).toHaveBeenCalled();
|
|
527
|
+
const emittedEvent = mockLogger.emit.mock.calls[0][0];
|
|
528
|
+
expect(emittedEvent.body).toBe('Switching to grep as fallback.');
|
|
529
|
+
expect(emittedEvent.attributes).toEqual(expect.objectContaining({
|
|
530
|
+
'session.id': 'test-session-id',
|
|
531
|
+
'user.email': 'test-user@example.com',
|
|
532
|
+
'installation.id': 'test-installation-id',
|
|
533
|
+
'event.name': EVENT_RIPGREP_FALLBACK,
|
|
534
|
+
error: 'rg not found',
|
|
535
|
+
}));
|
|
536
|
+
});
|
|
537
|
+
});
|
|
289
538
|
describe('logToolCall', () => {
|
|
290
539
|
const cfg1 = {
|
|
291
540
|
getSessionId: () => 'test-session-id',
|
|
@@ -314,7 +563,6 @@ describe('loggers', () => {
|
|
|
314
563
|
}),
|
|
315
564
|
getQuestion: () => 'test-question',
|
|
316
565
|
getToolRegistry: () => new ToolRegistry(cfg1),
|
|
317
|
-
getFullContext: () => false,
|
|
318
566
|
getUserMemory: () => 'user-memory',
|
|
319
567
|
};
|
|
320
568
|
const mockGeminiClient = new GeminiClient(cfg2);
|
|
@@ -325,12 +573,15 @@ describe('loggers', () => {
|
|
|
325
573
|
getUsageStatisticsEnabled: () => true,
|
|
326
574
|
getTelemetryEnabled: () => true,
|
|
327
575
|
getTelemetryLogPromptsEnabled: () => true,
|
|
576
|
+
isInteractive: () => false,
|
|
328
577
|
};
|
|
329
578
|
const mockMetrics = {
|
|
330
579
|
recordToolCallMetrics: vi.fn(),
|
|
580
|
+
recordLinesChanged: vi.fn(),
|
|
331
581
|
};
|
|
332
582
|
beforeEach(() => {
|
|
333
583
|
vi.spyOn(metrics, 'recordToolCallMetrics').mockImplementation(mockMetrics.recordToolCallMetrics);
|
|
584
|
+
vi.spyOn(metrics, 'recordLinesChanged').mockImplementation(mockMetrics.recordLinesChanged);
|
|
334
585
|
mockLogger.emit.mockReset();
|
|
335
586
|
});
|
|
336
587
|
it('should log a tool call with all fields', () => {
|
|
@@ -349,10 +600,26 @@ describe('loggers', () => {
|
|
|
349
600
|
},
|
|
350
601
|
response: {
|
|
351
602
|
callId: 'test-call-id',
|
|
352
|
-
responseParts: 'test-response',
|
|
353
|
-
resultDisplay:
|
|
603
|
+
responseParts: [{ text: 'test-response' }],
|
|
604
|
+
resultDisplay: {
|
|
605
|
+
fileDiff: 'diff',
|
|
606
|
+
fileName: 'file.txt',
|
|
607
|
+
originalContent: 'old content',
|
|
608
|
+
newContent: 'new content',
|
|
609
|
+
diffStat: {
|
|
610
|
+
model_added_lines: 1,
|
|
611
|
+
model_removed_lines: 2,
|
|
612
|
+
model_added_chars: 3,
|
|
613
|
+
model_removed_chars: 4,
|
|
614
|
+
user_added_lines: 5,
|
|
615
|
+
user_removed_lines: 6,
|
|
616
|
+
user_added_chars: 7,
|
|
617
|
+
user_removed_chars: 8,
|
|
618
|
+
},
|
|
619
|
+
},
|
|
354
620
|
error: undefined,
|
|
355
621
|
errorType: undefined,
|
|
622
|
+
contentLength: 13,
|
|
356
623
|
},
|
|
357
624
|
tool,
|
|
358
625
|
invocation: {},
|
|
@@ -365,8 +632,11 @@ describe('loggers', () => {
|
|
|
365
632
|
body: 'Tool call: test-function. Decision: accept. Success: true. Duration: 100ms.',
|
|
366
633
|
attributes: {
|
|
367
634
|
'session.id': 'test-session-id',
|
|
635
|
+
'user.email': 'test-user@example.com',
|
|
636
|
+
'installation.id': 'test-installation-id',
|
|
368
637
|
'event.name': EVENT_TOOL_CALL,
|
|
369
638
|
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
639
|
+
interactive: false,
|
|
370
640
|
function_name: 'test-function',
|
|
371
641
|
function_args: JSON.stringify({
|
|
372
642
|
arg1: 'value1',
|
|
@@ -377,14 +647,36 @@ describe('loggers', () => {
|
|
|
377
647
|
decision: ToolCallDecision.ACCEPT,
|
|
378
648
|
prompt_id: 'prompt-id-1',
|
|
379
649
|
tool_type: 'native',
|
|
650
|
+
error: undefined,
|
|
651
|
+
error_type: undefined,
|
|
652
|
+
mcp_server_name: undefined,
|
|
653
|
+
extension_id: undefined,
|
|
654
|
+
metadata: {
|
|
655
|
+
model_added_lines: 1,
|
|
656
|
+
model_removed_lines: 2,
|
|
657
|
+
model_added_chars: 3,
|
|
658
|
+
model_removed_chars: 4,
|
|
659
|
+
user_added_lines: 5,
|
|
660
|
+
user_removed_lines: 6,
|
|
661
|
+
user_added_chars: 7,
|
|
662
|
+
user_removed_chars: 8,
|
|
663
|
+
},
|
|
664
|
+
content_length: 13,
|
|
380
665
|
},
|
|
381
666
|
});
|
|
382
|
-
expect(mockMetrics.recordToolCallMetrics).toHaveBeenCalledWith(mockConfig,
|
|
667
|
+
expect(mockMetrics.recordToolCallMetrics).toHaveBeenCalledWith(mockConfig, 100, {
|
|
668
|
+
function_name: 'test-function',
|
|
669
|
+
success: true,
|
|
670
|
+
decision: ToolCallDecision.ACCEPT,
|
|
671
|
+
tool_type: 'native',
|
|
672
|
+
});
|
|
383
673
|
expect(mockUiEvent.addEvent).toHaveBeenCalledWith({
|
|
384
674
|
...event,
|
|
385
675
|
'event.name': EVENT_TOOL_CALL,
|
|
386
676
|
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
387
677
|
});
|
|
678
|
+
expect(mockMetrics.recordLinesChanged).toHaveBeenCalledWith(mockConfig, 1, 'added', { function_name: 'test-function' });
|
|
679
|
+
expect(mockMetrics.recordLinesChanged).toHaveBeenCalledWith(mockConfig, 2, 'removed', { function_name: 'test-function' });
|
|
388
680
|
});
|
|
389
681
|
it('should log a tool call with a reject decision', () => {
|
|
390
682
|
const call = {
|
|
@@ -401,10 +693,11 @@ describe('loggers', () => {
|
|
|
401
693
|
},
|
|
402
694
|
response: {
|
|
403
695
|
callId: 'test-call-id',
|
|
404
|
-
responseParts: 'test-response',
|
|
696
|
+
responseParts: [{ text: 'test-response' }],
|
|
405
697
|
resultDisplay: undefined,
|
|
406
698
|
error: undefined,
|
|
407
699
|
errorType: undefined,
|
|
700
|
+
contentLength: undefined,
|
|
408
701
|
},
|
|
409
702
|
durationMs: 100,
|
|
410
703
|
outcome: ToolConfirmationOutcome.Cancel,
|
|
@@ -415,8 +708,11 @@ describe('loggers', () => {
|
|
|
415
708
|
body: 'Tool call: test-function. Decision: reject. Success: false. Duration: 100ms.',
|
|
416
709
|
attributes: {
|
|
417
710
|
'session.id': 'test-session-id',
|
|
711
|
+
'user.email': 'test-user@example.com',
|
|
712
|
+
'installation.id': 'test-installation-id',
|
|
418
713
|
'event.name': EVENT_TOOL_CALL,
|
|
419
714
|
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
715
|
+
interactive: false,
|
|
420
716
|
function_name: 'test-function',
|
|
421
717
|
function_args: JSON.stringify({
|
|
422
718
|
arg1: 'value1',
|
|
@@ -427,9 +723,20 @@ describe('loggers', () => {
|
|
|
427
723
|
decision: ToolCallDecision.REJECT,
|
|
428
724
|
prompt_id: 'prompt-id-2',
|
|
429
725
|
tool_type: 'native',
|
|
726
|
+
error: undefined,
|
|
727
|
+
error_type: undefined,
|
|
728
|
+
mcp_server_name: undefined,
|
|
729
|
+
extension_id: undefined,
|
|
730
|
+
metadata: undefined,
|
|
731
|
+
content_length: undefined,
|
|
430
732
|
},
|
|
431
733
|
});
|
|
432
|
-
expect(mockMetrics.recordToolCallMetrics).toHaveBeenCalledWith(mockConfig,
|
|
734
|
+
expect(mockMetrics.recordToolCallMetrics).toHaveBeenCalledWith(mockConfig, 100, {
|
|
735
|
+
function_name: 'test-function',
|
|
736
|
+
success: false,
|
|
737
|
+
decision: ToolCallDecision.REJECT,
|
|
738
|
+
tool_type: 'native',
|
|
739
|
+
});
|
|
433
740
|
expect(mockUiEvent.addEvent).toHaveBeenCalledWith({
|
|
434
741
|
...event,
|
|
435
742
|
'event.name': EVENT_TOOL_CALL,
|
|
@@ -451,10 +758,11 @@ describe('loggers', () => {
|
|
|
451
758
|
},
|
|
452
759
|
response: {
|
|
453
760
|
callId: 'test-call-id',
|
|
454
|
-
responseParts: 'test-response',
|
|
761
|
+
responseParts: [{ text: 'test-response' }],
|
|
455
762
|
resultDisplay: undefined,
|
|
456
763
|
error: undefined,
|
|
457
764
|
errorType: undefined,
|
|
765
|
+
contentLength: 13,
|
|
458
766
|
},
|
|
459
767
|
outcome: ToolConfirmationOutcome.ModifyWithEditor,
|
|
460
768
|
tool: new EditTool(mockConfig),
|
|
@@ -467,8 +775,11 @@ describe('loggers', () => {
|
|
|
467
775
|
body: 'Tool call: test-function. Decision: modify. Success: true. Duration: 100ms.',
|
|
468
776
|
attributes: {
|
|
469
777
|
'session.id': 'test-session-id',
|
|
778
|
+
'user.email': 'test-user@example.com',
|
|
779
|
+
'installation.id': 'test-installation-id',
|
|
470
780
|
'event.name': EVENT_TOOL_CALL,
|
|
471
781
|
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
782
|
+
interactive: false,
|
|
472
783
|
function_name: 'test-function',
|
|
473
784
|
function_args: JSON.stringify({
|
|
474
785
|
arg1: 'value1',
|
|
@@ -479,9 +790,20 @@ describe('loggers', () => {
|
|
|
479
790
|
decision: ToolCallDecision.MODIFY,
|
|
480
791
|
prompt_id: 'prompt-id-3',
|
|
481
792
|
tool_type: 'native',
|
|
793
|
+
error: undefined,
|
|
794
|
+
error_type: undefined,
|
|
795
|
+
mcp_server_name: undefined,
|
|
796
|
+
extension_id: undefined,
|
|
797
|
+
metadata: undefined,
|
|
798
|
+
content_length: 13,
|
|
482
799
|
},
|
|
483
800
|
});
|
|
484
|
-
expect(mockMetrics.recordToolCallMetrics).toHaveBeenCalledWith(mockConfig,
|
|
801
|
+
expect(mockMetrics.recordToolCallMetrics).toHaveBeenCalledWith(mockConfig, 100, {
|
|
802
|
+
function_name: 'test-function',
|
|
803
|
+
success: true,
|
|
804
|
+
decision: ToolCallDecision.MODIFY,
|
|
805
|
+
tool_type: 'native',
|
|
806
|
+
});
|
|
485
807
|
expect(mockUiEvent.addEvent).toHaveBeenCalledWith({
|
|
486
808
|
...event,
|
|
487
809
|
'event.name': EVENT_TOOL_CALL,
|
|
@@ -503,10 +825,11 @@ describe('loggers', () => {
|
|
|
503
825
|
},
|
|
504
826
|
response: {
|
|
505
827
|
callId: 'test-call-id',
|
|
506
|
-
responseParts: 'test-response',
|
|
828
|
+
responseParts: [{ text: 'test-response' }],
|
|
507
829
|
resultDisplay: undefined,
|
|
508
830
|
error: undefined,
|
|
509
831
|
errorType: undefined,
|
|
832
|
+
contentLength: 13,
|
|
510
833
|
},
|
|
511
834
|
tool: new EditTool(mockConfig),
|
|
512
835
|
invocation: {},
|
|
@@ -518,8 +841,11 @@ describe('loggers', () => {
|
|
|
518
841
|
body: 'Tool call: test-function. Success: true. Duration: 100ms.',
|
|
519
842
|
attributes: {
|
|
520
843
|
'session.id': 'test-session-id',
|
|
844
|
+
'user.email': 'test-user@example.com',
|
|
845
|
+
'installation.id': 'test-installation-id',
|
|
521
846
|
'event.name': EVENT_TOOL_CALL,
|
|
522
847
|
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
848
|
+
interactive: false,
|
|
523
849
|
function_name: 'test-function',
|
|
524
850
|
function_args: JSON.stringify({
|
|
525
851
|
arg1: 'value1',
|
|
@@ -529,9 +855,21 @@ describe('loggers', () => {
|
|
|
529
855
|
success: true,
|
|
530
856
|
prompt_id: 'prompt-id-4',
|
|
531
857
|
tool_type: 'native',
|
|
858
|
+
decision: undefined,
|
|
859
|
+
error: undefined,
|
|
860
|
+
error_type: undefined,
|
|
861
|
+
mcp_server_name: undefined,
|
|
862
|
+
extension_id: undefined,
|
|
863
|
+
metadata: undefined,
|
|
864
|
+
content_length: 13,
|
|
532
865
|
},
|
|
533
866
|
});
|
|
534
|
-
expect(mockMetrics.recordToolCallMetrics).toHaveBeenCalledWith(mockConfig,
|
|
867
|
+
expect(mockMetrics.recordToolCallMetrics).toHaveBeenCalledWith(mockConfig, 100, {
|
|
868
|
+
function_name: 'test-function',
|
|
869
|
+
success: true,
|
|
870
|
+
decision: undefined,
|
|
871
|
+
tool_type: 'native',
|
|
872
|
+
});
|
|
535
873
|
expect(mockUiEvent.addEvent).toHaveBeenCalledWith({
|
|
536
874
|
...event,
|
|
537
875
|
'event.name': EVENT_TOOL_CALL,
|
|
@@ -539,6 +877,7 @@ describe('loggers', () => {
|
|
|
539
877
|
});
|
|
540
878
|
});
|
|
541
879
|
it('should log a failed tool call with an error', () => {
|
|
880
|
+
const errorMessage = 'test-error';
|
|
542
881
|
const call = {
|
|
543
882
|
status: 'error',
|
|
544
883
|
request: {
|
|
@@ -553,13 +892,11 @@ describe('loggers', () => {
|
|
|
553
892
|
},
|
|
554
893
|
response: {
|
|
555
894
|
callId: 'test-call-id',
|
|
556
|
-
responseParts: 'test-response',
|
|
895
|
+
responseParts: [{ text: 'test-response' }],
|
|
557
896
|
resultDisplay: undefined,
|
|
558
|
-
error:
|
|
559
|
-
name: 'test-error-type',
|
|
560
|
-
message: 'test-error',
|
|
561
|
-
},
|
|
897
|
+
error: new Error(errorMessage),
|
|
562
898
|
errorType: ToolErrorType.UNKNOWN,
|
|
899
|
+
contentLength: errorMessage.length,
|
|
563
900
|
},
|
|
564
901
|
durationMs: 100,
|
|
565
902
|
};
|
|
@@ -569,8 +906,11 @@ describe('loggers', () => {
|
|
|
569
906
|
body: 'Tool call: test-function. Success: false. Duration: 100ms.',
|
|
570
907
|
attributes: {
|
|
571
908
|
'session.id': 'test-session-id',
|
|
909
|
+
'user.email': 'test-user@example.com',
|
|
910
|
+
'installation.id': 'test-installation-id',
|
|
572
911
|
'event.name': EVENT_TOOL_CALL,
|
|
573
912
|
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
913
|
+
interactive: false,
|
|
574
914
|
function_name: 'test-function',
|
|
575
915
|
function_args: JSON.stringify({
|
|
576
916
|
arg1: 'value1',
|
|
@@ -584,15 +924,480 @@ describe('loggers', () => {
|
|
|
584
924
|
'error.type': ToolErrorType.UNKNOWN,
|
|
585
925
|
prompt_id: 'prompt-id-5',
|
|
586
926
|
tool_type: 'native',
|
|
927
|
+
decision: undefined,
|
|
928
|
+
mcp_server_name: undefined,
|
|
929
|
+
extension_id: undefined,
|
|
930
|
+
metadata: undefined,
|
|
931
|
+
content_length: errorMessage.length,
|
|
587
932
|
},
|
|
588
933
|
});
|
|
589
|
-
expect(mockMetrics.recordToolCallMetrics).toHaveBeenCalledWith(mockConfig,
|
|
934
|
+
expect(mockMetrics.recordToolCallMetrics).toHaveBeenCalledWith(mockConfig, 100, {
|
|
935
|
+
function_name: 'test-function',
|
|
936
|
+
success: false,
|
|
937
|
+
decision: undefined,
|
|
938
|
+
tool_type: 'native',
|
|
939
|
+
});
|
|
590
940
|
expect(mockUiEvent.addEvent).toHaveBeenCalledWith({
|
|
591
941
|
...event,
|
|
592
942
|
'event.name': EVENT_TOOL_CALL,
|
|
593
943
|
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
594
944
|
});
|
|
595
945
|
});
|
|
946
|
+
it('should log a tool call with mcp_server_name for MCP tools', () => {
|
|
947
|
+
const mockMcpTool = new DiscoveredMCPTool({}, 'mock_mcp_server', 'mock_mcp_tool', 'tool description', {
|
|
948
|
+
type: 'object',
|
|
949
|
+
properties: {
|
|
950
|
+
arg1: { type: 'string' },
|
|
951
|
+
arg2: { type: 'number' },
|
|
952
|
+
},
|
|
953
|
+
required: ['arg1', 'arg2'],
|
|
954
|
+
}, false, undefined, undefined, 'test-extension', 'test-extension-id');
|
|
955
|
+
const call = {
|
|
956
|
+
status: 'success',
|
|
957
|
+
request: {
|
|
958
|
+
name: 'mock_mcp_tool',
|
|
959
|
+
args: { arg1: 'value1', arg2: 2 },
|
|
960
|
+
callId: 'test-call-id',
|
|
961
|
+
isClientInitiated: true,
|
|
962
|
+
prompt_id: 'prompt-id',
|
|
963
|
+
},
|
|
964
|
+
response: {
|
|
965
|
+
callId: 'test-call-id',
|
|
966
|
+
responseParts: [{ text: 'test-response' }],
|
|
967
|
+
resultDisplay: undefined,
|
|
968
|
+
error: undefined,
|
|
969
|
+
errorType: undefined,
|
|
970
|
+
},
|
|
971
|
+
tool: mockMcpTool,
|
|
972
|
+
invocation: {},
|
|
973
|
+
durationMs: 100,
|
|
974
|
+
};
|
|
975
|
+
const event = new ToolCallEvent(call);
|
|
976
|
+
logToolCall(mockConfig, event);
|
|
977
|
+
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
978
|
+
body: 'Tool call: mock_mcp_tool. Success: true. Duration: 100ms.',
|
|
979
|
+
attributes: {
|
|
980
|
+
'session.id': 'test-session-id',
|
|
981
|
+
'user.email': 'test-user@example.com',
|
|
982
|
+
'installation.id': 'test-installation-id',
|
|
983
|
+
'event.name': EVENT_TOOL_CALL,
|
|
984
|
+
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
985
|
+
extension_name: 'test-extension',
|
|
986
|
+
extension_id: 'test-extension-id',
|
|
987
|
+
interactive: false,
|
|
988
|
+
function_name: 'mock_mcp_tool',
|
|
989
|
+
function_args: JSON.stringify({
|
|
990
|
+
arg1: 'value1',
|
|
991
|
+
arg2: 2,
|
|
992
|
+
}, null, 2),
|
|
993
|
+
duration_ms: 100,
|
|
994
|
+
success: true,
|
|
995
|
+
prompt_id: 'prompt-id',
|
|
996
|
+
tool_type: 'mcp',
|
|
997
|
+
mcp_server_name: 'mock_mcp_server',
|
|
998
|
+
decision: undefined,
|
|
999
|
+
error: undefined,
|
|
1000
|
+
error_type: undefined,
|
|
1001
|
+
metadata: undefined,
|
|
1002
|
+
content_length: undefined,
|
|
1003
|
+
},
|
|
1004
|
+
});
|
|
1005
|
+
});
|
|
1006
|
+
});
|
|
1007
|
+
describe('logMalformedJsonResponse', () => {
|
|
1008
|
+
beforeEach(() => {
|
|
1009
|
+
vi.spyOn(ClearcutLogger.prototype, 'logMalformedJsonResponseEvent');
|
|
1010
|
+
});
|
|
1011
|
+
it('logs the event to Clearcut and OTEL', () => {
|
|
1012
|
+
const mockConfig = makeFakeConfig();
|
|
1013
|
+
const event = new MalformedJsonResponseEvent('test-model');
|
|
1014
|
+
logMalformedJsonResponse(mockConfig, event);
|
|
1015
|
+
expect(ClearcutLogger.prototype.logMalformedJsonResponseEvent).toHaveBeenCalledWith(event);
|
|
1016
|
+
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
1017
|
+
body: 'Malformed JSON response from test-model.',
|
|
1018
|
+
attributes: {
|
|
1019
|
+
'session.id': 'test-session-id',
|
|
1020
|
+
'user.email': 'test-user@example.com',
|
|
1021
|
+
'installation.id': 'test-installation-id',
|
|
1022
|
+
'event.name': EVENT_MALFORMED_JSON_RESPONSE,
|
|
1023
|
+
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
1024
|
+
interactive: false,
|
|
1025
|
+
model: 'test-model',
|
|
1026
|
+
},
|
|
1027
|
+
});
|
|
1028
|
+
});
|
|
1029
|
+
});
|
|
1030
|
+
describe('logFileOperation', () => {
|
|
1031
|
+
const mockConfig = {
|
|
1032
|
+
getSessionId: () => 'test-session-id',
|
|
1033
|
+
getTargetDir: () => 'target-dir',
|
|
1034
|
+
getUsageStatisticsEnabled: () => true,
|
|
1035
|
+
getTelemetryEnabled: () => true,
|
|
1036
|
+
getTelemetryLogPromptsEnabled: () => true,
|
|
1037
|
+
isInteractive: () => false,
|
|
1038
|
+
};
|
|
1039
|
+
const mockMetrics = {
|
|
1040
|
+
recordFileOperationMetric: vi.fn(),
|
|
1041
|
+
};
|
|
1042
|
+
beforeEach(() => {
|
|
1043
|
+
vi.spyOn(metrics, 'recordFileOperationMetric').mockImplementation(mockMetrics.recordFileOperationMetric);
|
|
1044
|
+
});
|
|
1045
|
+
it('should log a file operation event', () => {
|
|
1046
|
+
const event = new FileOperationEvent('test-tool', FileOperation.READ, 10, 'text/plain', '.txt', 'typescript');
|
|
1047
|
+
logFileOperation(mockConfig, event);
|
|
1048
|
+
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
1049
|
+
body: 'File operation: read. Lines: 10.',
|
|
1050
|
+
attributes: {
|
|
1051
|
+
'session.id': 'test-session-id',
|
|
1052
|
+
'user.email': 'test-user@example.com',
|
|
1053
|
+
'installation.id': 'test-installation-id',
|
|
1054
|
+
'event.name': EVENT_FILE_OPERATION,
|
|
1055
|
+
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
1056
|
+
interactive: false,
|
|
1057
|
+
tool_name: 'test-tool',
|
|
1058
|
+
operation: 'read',
|
|
1059
|
+
lines: 10,
|
|
1060
|
+
mimetype: 'text/plain',
|
|
1061
|
+
extension: '.txt',
|
|
1062
|
+
programming_language: 'typescript',
|
|
1063
|
+
},
|
|
1064
|
+
});
|
|
1065
|
+
expect(mockMetrics.recordFileOperationMetric).toHaveBeenCalledWith(mockConfig, {
|
|
1066
|
+
operation: 'read',
|
|
1067
|
+
lines: 10,
|
|
1068
|
+
mimetype: 'text/plain',
|
|
1069
|
+
extension: '.txt',
|
|
1070
|
+
programming_language: 'typescript',
|
|
1071
|
+
});
|
|
1072
|
+
});
|
|
1073
|
+
});
|
|
1074
|
+
describe('logToolOutputTruncated', () => {
|
|
1075
|
+
const mockConfig = {
|
|
1076
|
+
getSessionId: () => 'test-session-id',
|
|
1077
|
+
getUsageStatisticsEnabled: () => true,
|
|
1078
|
+
isInteractive: () => false,
|
|
1079
|
+
};
|
|
1080
|
+
it('should log a tool output truncated event', () => {
|
|
1081
|
+
const event = new ToolOutputTruncatedEvent('prompt-id-1', {
|
|
1082
|
+
toolName: 'test-tool',
|
|
1083
|
+
originalContentLength: 1000,
|
|
1084
|
+
truncatedContentLength: 100,
|
|
1085
|
+
threshold: 500,
|
|
1086
|
+
lines: 10,
|
|
1087
|
+
});
|
|
1088
|
+
logToolOutputTruncated(mockConfig, event);
|
|
1089
|
+
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
1090
|
+
body: 'Tool output truncated for test-tool.',
|
|
1091
|
+
attributes: {
|
|
1092
|
+
'session.id': 'test-session-id',
|
|
1093
|
+
'user.email': 'test-user@example.com',
|
|
1094
|
+
'installation.id': 'test-installation-id',
|
|
1095
|
+
'event.name': EVENT_TOOL_OUTPUT_TRUNCATED,
|
|
1096
|
+
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
1097
|
+
eventName: 'tool_output_truncated',
|
|
1098
|
+
interactive: false,
|
|
1099
|
+
prompt_id: 'prompt-id-1',
|
|
1100
|
+
tool_name: 'test-tool',
|
|
1101
|
+
original_content_length: 1000,
|
|
1102
|
+
truncated_content_length: 100,
|
|
1103
|
+
threshold: 500,
|
|
1104
|
+
lines: 10,
|
|
1105
|
+
},
|
|
1106
|
+
});
|
|
1107
|
+
});
|
|
1108
|
+
});
|
|
1109
|
+
describe('logModelRouting', () => {
|
|
1110
|
+
const mockConfig = {
|
|
1111
|
+
getSessionId: () => 'test-session-id',
|
|
1112
|
+
getUsageStatisticsEnabled: () => true,
|
|
1113
|
+
isInteractive: () => false,
|
|
1114
|
+
};
|
|
1115
|
+
beforeEach(() => {
|
|
1116
|
+
vi.spyOn(ClearcutLogger.prototype, 'logModelRoutingEvent');
|
|
1117
|
+
vi.spyOn(metrics, 'recordModelRoutingMetrics');
|
|
1118
|
+
});
|
|
1119
|
+
it('should log the event to Clearcut and OTEL, and record metrics', () => {
|
|
1120
|
+
const event = new ModelRoutingEvent('gemini-pro', 'default', 100, 'test-reason', false, undefined);
|
|
1121
|
+
logModelRouting(mockConfig, event);
|
|
1122
|
+
expect(ClearcutLogger.prototype.logModelRoutingEvent).toHaveBeenCalledWith(event);
|
|
1123
|
+
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
1124
|
+
body: 'Model routing decision. Model: gemini-pro, Source: default',
|
|
1125
|
+
attributes: {
|
|
1126
|
+
'session.id': 'test-session-id',
|
|
1127
|
+
'user.email': 'test-user@example.com',
|
|
1128
|
+
'installation.id': 'test-installation-id',
|
|
1129
|
+
...event,
|
|
1130
|
+
'event.name': EVENT_MODEL_ROUTING,
|
|
1131
|
+
interactive: false,
|
|
1132
|
+
},
|
|
1133
|
+
});
|
|
1134
|
+
expect(metrics.recordModelRoutingMetrics).toHaveBeenCalledWith(mockConfig, event);
|
|
1135
|
+
});
|
|
1136
|
+
it('should only log to Clearcut if OTEL SDK is not initialized', () => {
|
|
1137
|
+
vi.spyOn(sdk, 'isTelemetrySdkInitialized').mockReturnValue(false);
|
|
1138
|
+
const event = new ModelRoutingEvent('gemini-pro', 'default', 100, 'test-reason', false, undefined);
|
|
1139
|
+
logModelRouting(mockConfig, event);
|
|
1140
|
+
expect(ClearcutLogger.prototype.logModelRoutingEvent).toHaveBeenCalledWith(event);
|
|
1141
|
+
expect(mockLogger.emit).not.toHaveBeenCalled();
|
|
1142
|
+
expect(metrics.recordModelRoutingMetrics).not.toHaveBeenCalled();
|
|
1143
|
+
});
|
|
1144
|
+
});
|
|
1145
|
+
describe('logExtensionInstall', () => {
|
|
1146
|
+
const mockConfig = {
|
|
1147
|
+
getSessionId: () => 'test-session-id',
|
|
1148
|
+
getUsageStatisticsEnabled: () => true,
|
|
1149
|
+
getContentGeneratorConfig: () => null,
|
|
1150
|
+
getUseSmartEdit: () => null,
|
|
1151
|
+
getUseModelRouter: () => null,
|
|
1152
|
+
isInteractive: () => false,
|
|
1153
|
+
};
|
|
1154
|
+
beforeEach(() => {
|
|
1155
|
+
vi.spyOn(ClearcutLogger.prototype, 'logExtensionInstallEvent');
|
|
1156
|
+
});
|
|
1157
|
+
afterEach(() => {
|
|
1158
|
+
vi.clearAllMocks();
|
|
1159
|
+
});
|
|
1160
|
+
it('should log extension install event', async () => {
|
|
1161
|
+
const event = new ExtensionInstallEvent('testing', 'testing-id', '0.1.0', 'git', 'success');
|
|
1162
|
+
await logExtensionInstallEvent(mockConfig, event);
|
|
1163
|
+
expect(ClearcutLogger.prototype.logExtensionInstallEvent).toHaveBeenCalledWith(event);
|
|
1164
|
+
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
1165
|
+
body: 'Installed extension testing',
|
|
1166
|
+
attributes: {
|
|
1167
|
+
'session.id': 'test-session-id',
|
|
1168
|
+
'user.email': 'test-user@example.com',
|
|
1169
|
+
'installation.id': 'test-installation-id',
|
|
1170
|
+
'event.name': EVENT_EXTENSION_INSTALL,
|
|
1171
|
+
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
1172
|
+
interactive: false,
|
|
1173
|
+
extension_name: 'testing',
|
|
1174
|
+
extension_version: '0.1.0',
|
|
1175
|
+
extension_source: 'git',
|
|
1176
|
+
status: 'success',
|
|
1177
|
+
},
|
|
1178
|
+
});
|
|
1179
|
+
});
|
|
1180
|
+
});
|
|
1181
|
+
describe('logExtensionUpdate', async () => {
|
|
1182
|
+
const mockConfig = {
|
|
1183
|
+
getSessionId: () => 'test-session-id',
|
|
1184
|
+
getUsageStatisticsEnabled: () => true,
|
|
1185
|
+
getContentGeneratorConfig: () => null,
|
|
1186
|
+
getUseSmartEdit: () => null,
|
|
1187
|
+
getUseModelRouter: () => null,
|
|
1188
|
+
isInteractive: () => false,
|
|
1189
|
+
};
|
|
1190
|
+
beforeEach(() => {
|
|
1191
|
+
vi.spyOn(ClearcutLogger.prototype, 'logExtensionUpdateEvent');
|
|
1192
|
+
});
|
|
1193
|
+
afterEach(() => {
|
|
1194
|
+
vi.clearAllMocks();
|
|
1195
|
+
});
|
|
1196
|
+
it('should log extension update event', async () => {
|
|
1197
|
+
const event = new ExtensionUpdateEvent('testing', 'testing-id', '0.1.0', '0.1.1', 'git', 'success');
|
|
1198
|
+
await logExtensionUpdateEvent(mockConfig, event);
|
|
1199
|
+
expect(ClearcutLogger.prototype.logExtensionUpdateEvent).toHaveBeenCalledWith(event);
|
|
1200
|
+
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
1201
|
+
body: 'Updated extension testing',
|
|
1202
|
+
attributes: {
|
|
1203
|
+
'session.id': 'test-session-id',
|
|
1204
|
+
'user.email': 'test-user@example.com',
|
|
1205
|
+
'installation.id': 'test-installation-id',
|
|
1206
|
+
'event.name': EVENT_EXTENSION_UPDATE,
|
|
1207
|
+
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
1208
|
+
interactive: false,
|
|
1209
|
+
extension_name: 'testing',
|
|
1210
|
+
extension_version: '0.1.0',
|
|
1211
|
+
extension_previous_version: '0.1.1',
|
|
1212
|
+
extension_source: 'git',
|
|
1213
|
+
status: 'success',
|
|
1214
|
+
},
|
|
1215
|
+
});
|
|
1216
|
+
});
|
|
1217
|
+
});
|
|
1218
|
+
describe('logExtensionUninstall', async () => {
|
|
1219
|
+
const mockConfig = {
|
|
1220
|
+
getSessionId: () => 'test-session-id',
|
|
1221
|
+
getUsageStatisticsEnabled: () => true,
|
|
1222
|
+
getContentGeneratorConfig: () => null,
|
|
1223
|
+
getUseSmartEdit: () => null,
|
|
1224
|
+
getUseModelRouter: () => null,
|
|
1225
|
+
isInteractive: () => false,
|
|
1226
|
+
};
|
|
1227
|
+
beforeEach(() => {
|
|
1228
|
+
vi.spyOn(ClearcutLogger.prototype, 'logExtensionUninstallEvent');
|
|
1229
|
+
});
|
|
1230
|
+
afterEach(() => {
|
|
1231
|
+
vi.clearAllMocks();
|
|
1232
|
+
});
|
|
1233
|
+
it('should log extension uninstall event', async () => {
|
|
1234
|
+
const event = new ExtensionUninstallEvent('testing', 'testing-id', 'success');
|
|
1235
|
+
await logExtensionUninstall(mockConfig, event);
|
|
1236
|
+
expect(ClearcutLogger.prototype.logExtensionUninstallEvent).toHaveBeenCalledWith(event);
|
|
1237
|
+
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
1238
|
+
body: 'Uninstalled extension testing',
|
|
1239
|
+
attributes: {
|
|
1240
|
+
'session.id': 'test-session-id',
|
|
1241
|
+
'user.email': 'test-user@example.com',
|
|
1242
|
+
'installation.id': 'test-installation-id',
|
|
1243
|
+
'event.name': EVENT_EXTENSION_UNINSTALL,
|
|
1244
|
+
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
1245
|
+
interactive: false,
|
|
1246
|
+
extension_name: 'testing',
|
|
1247
|
+
status: 'success',
|
|
1248
|
+
},
|
|
1249
|
+
});
|
|
1250
|
+
});
|
|
1251
|
+
});
|
|
1252
|
+
describe('logExtensionEnable', async () => {
|
|
1253
|
+
const mockConfig = {
|
|
1254
|
+
getSessionId: () => 'test-session-id',
|
|
1255
|
+
getUsageStatisticsEnabled: () => true,
|
|
1256
|
+
isInteractive: () => false,
|
|
1257
|
+
};
|
|
1258
|
+
beforeEach(() => {
|
|
1259
|
+
vi.spyOn(ClearcutLogger.prototype, 'logExtensionEnableEvent');
|
|
1260
|
+
});
|
|
1261
|
+
afterEach(() => {
|
|
1262
|
+
vi.clearAllMocks();
|
|
1263
|
+
});
|
|
1264
|
+
it('should log extension enable event', async () => {
|
|
1265
|
+
const event = new ExtensionEnableEvent('testing', 'testing-id', 'user');
|
|
1266
|
+
await logExtensionEnable(mockConfig, event);
|
|
1267
|
+
expect(ClearcutLogger.prototype.logExtensionEnableEvent).toHaveBeenCalledWith(event);
|
|
1268
|
+
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
1269
|
+
body: 'Enabled extension testing',
|
|
1270
|
+
attributes: {
|
|
1271
|
+
'session.id': 'test-session-id',
|
|
1272
|
+
'user.email': 'test-user@example.com',
|
|
1273
|
+
'installation.id': 'test-installation-id',
|
|
1274
|
+
'event.name': EVENT_EXTENSION_ENABLE,
|
|
1275
|
+
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
1276
|
+
interactive: false,
|
|
1277
|
+
extension_name: 'testing',
|
|
1278
|
+
setting_scope: 'user',
|
|
1279
|
+
},
|
|
1280
|
+
});
|
|
1281
|
+
});
|
|
1282
|
+
});
|
|
1283
|
+
describe('logExtensionDisable', () => {
|
|
1284
|
+
const mockConfig = {
|
|
1285
|
+
getSessionId: () => 'test-session-id',
|
|
1286
|
+
getUsageStatisticsEnabled: () => true,
|
|
1287
|
+
isInteractive: () => false,
|
|
1288
|
+
};
|
|
1289
|
+
beforeEach(() => {
|
|
1290
|
+
vi.spyOn(ClearcutLogger.prototype, 'logExtensionDisableEvent');
|
|
1291
|
+
});
|
|
1292
|
+
afterEach(() => {
|
|
1293
|
+
vi.clearAllMocks();
|
|
1294
|
+
});
|
|
1295
|
+
it('should log extension disable event', async () => {
|
|
1296
|
+
const event = new ExtensionDisableEvent('testing', 'testing-id', 'user');
|
|
1297
|
+
await logExtensionDisable(mockConfig, event);
|
|
1298
|
+
expect(ClearcutLogger.prototype.logExtensionDisableEvent).toHaveBeenCalledWith(event);
|
|
1299
|
+
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
1300
|
+
body: 'Disabled extension testing',
|
|
1301
|
+
attributes: {
|
|
1302
|
+
'session.id': 'test-session-id',
|
|
1303
|
+
'user.email': 'test-user@example.com',
|
|
1304
|
+
'installation.id': 'test-installation-id',
|
|
1305
|
+
'event.name': EVENT_EXTENSION_DISABLE,
|
|
1306
|
+
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
1307
|
+
interactive: false,
|
|
1308
|
+
extension_name: 'testing',
|
|
1309
|
+
setting_scope: 'user',
|
|
1310
|
+
},
|
|
1311
|
+
});
|
|
1312
|
+
});
|
|
1313
|
+
});
|
|
1314
|
+
describe('logAgentStart', () => {
|
|
1315
|
+
const mockConfig = {
|
|
1316
|
+
getSessionId: () => 'test-session-id',
|
|
1317
|
+
getUsageStatisticsEnabled: () => true,
|
|
1318
|
+
isInteractive: () => false,
|
|
1319
|
+
};
|
|
1320
|
+
beforeEach(() => {
|
|
1321
|
+
vi.spyOn(ClearcutLogger.prototype, 'logAgentStartEvent');
|
|
1322
|
+
});
|
|
1323
|
+
it('should log agent start event', () => {
|
|
1324
|
+
const event = new AgentStartEvent('agent-123', 'TestAgent');
|
|
1325
|
+
logAgentStart(mockConfig, event);
|
|
1326
|
+
expect(ClearcutLogger.prototype.logAgentStartEvent).toHaveBeenCalledWith(event);
|
|
1327
|
+
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
1328
|
+
body: 'Agent TestAgent started. ID: agent-123',
|
|
1329
|
+
attributes: {
|
|
1330
|
+
'session.id': 'test-session-id',
|
|
1331
|
+
'user.email': 'test-user@example.com',
|
|
1332
|
+
'installation.id': 'test-installation-id',
|
|
1333
|
+
'event.name': EVENT_AGENT_START,
|
|
1334
|
+
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
1335
|
+
interactive: false,
|
|
1336
|
+
agent_id: 'agent-123',
|
|
1337
|
+
agent_name: 'TestAgent',
|
|
1338
|
+
},
|
|
1339
|
+
});
|
|
1340
|
+
});
|
|
1341
|
+
});
|
|
1342
|
+
describe('logAgentFinish', () => {
|
|
1343
|
+
const mockConfig = {
|
|
1344
|
+
getSessionId: () => 'test-session-id',
|
|
1345
|
+
getUsageStatisticsEnabled: () => true,
|
|
1346
|
+
isInteractive: () => false,
|
|
1347
|
+
};
|
|
1348
|
+
beforeEach(() => {
|
|
1349
|
+
vi.spyOn(ClearcutLogger.prototype, 'logAgentFinishEvent');
|
|
1350
|
+
vi.spyOn(metrics, 'recordAgentRunMetrics');
|
|
1351
|
+
});
|
|
1352
|
+
it('should log agent finish event and record metrics', () => {
|
|
1353
|
+
const event = new AgentFinishEvent('agent-123', 'TestAgent', 1000, 5, AgentTerminateMode.GOAL);
|
|
1354
|
+
logAgentFinish(mockConfig, event);
|
|
1355
|
+
expect(ClearcutLogger.prototype.logAgentFinishEvent).toHaveBeenCalledWith(event);
|
|
1356
|
+
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
1357
|
+
body: 'Agent TestAgent finished. Reason: GOAL. Duration: 1000ms. Turns: 5.',
|
|
1358
|
+
attributes: {
|
|
1359
|
+
'session.id': 'test-session-id',
|
|
1360
|
+
'user.email': 'test-user@example.com',
|
|
1361
|
+
'installation.id': 'test-installation-id',
|
|
1362
|
+
'event.name': EVENT_AGENT_FINISH,
|
|
1363
|
+
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
1364
|
+
interactive: false,
|
|
1365
|
+
agent_id: 'agent-123',
|
|
1366
|
+
agent_name: 'TestAgent',
|
|
1367
|
+
duration_ms: 1000,
|
|
1368
|
+
turn_count: 5,
|
|
1369
|
+
terminate_reason: 'GOAL',
|
|
1370
|
+
},
|
|
1371
|
+
});
|
|
1372
|
+
expect(metrics.recordAgentRunMetrics).toHaveBeenCalledWith(mockConfig, event);
|
|
1373
|
+
});
|
|
1374
|
+
});
|
|
1375
|
+
describe('logWebFetchFallbackAttempt', () => {
|
|
1376
|
+
const mockConfig = {
|
|
1377
|
+
getSessionId: () => 'test-session-id',
|
|
1378
|
+
getUsageStatisticsEnabled: () => true,
|
|
1379
|
+
isInteractive: () => false,
|
|
1380
|
+
};
|
|
1381
|
+
beforeEach(() => {
|
|
1382
|
+
vi.spyOn(ClearcutLogger.prototype, 'logWebFetchFallbackAttemptEvent');
|
|
1383
|
+
});
|
|
1384
|
+
it('should log web fetch fallback attempt event', () => {
|
|
1385
|
+
const event = new WebFetchFallbackAttemptEvent('private_ip');
|
|
1386
|
+
logWebFetchFallbackAttempt(mockConfig, event);
|
|
1387
|
+
expect(ClearcutLogger.prototype.logWebFetchFallbackAttemptEvent).toHaveBeenCalledWith(event);
|
|
1388
|
+
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
1389
|
+
body: 'Web fetch fallback attempt. Reason: private_ip',
|
|
1390
|
+
attributes: {
|
|
1391
|
+
'session.id': 'test-session-id',
|
|
1392
|
+
'user.email': 'test-user@example.com',
|
|
1393
|
+
'installation.id': 'test-installation-id',
|
|
1394
|
+
'event.name': EVENT_WEB_FETCH_FALLBACK_ATTEMPT,
|
|
1395
|
+
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
1396
|
+
interactive: false,
|
|
1397
|
+
reason: 'private_ip',
|
|
1398
|
+
},
|
|
1399
|
+
});
|
|
1400
|
+
});
|
|
596
1401
|
});
|
|
597
1402
|
});
|
|
598
1403
|
//# sourceMappingURL=loggers.test.js.map
|