@office-ai/aioncli-core 0.2.2 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +10 -3
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/dist/src/agents/codebase-investigator.d.ts +11 -0
- package/dist/src/agents/codebase-investigator.js +73 -0
- package/dist/src/agents/codebase-investigator.js.map +1 -0
- package/dist/src/agents/executor.d.ts +88 -0
- package/dist/src/agents/executor.js +417 -0
- package/dist/src/agents/executor.js.map +1 -0
- package/dist/src/agents/executor.test.js +419 -0
- package/dist/src/agents/executor.test.js.map +1 -0
- package/dist/src/agents/invocation.d.ts +43 -0
- package/dist/src/agents/invocation.js +100 -0
- package/dist/src/agents/invocation.js.map +1 -0
- package/dist/src/agents/invocation.test.js +206 -0
- package/dist/src/agents/invocation.test.js.map +1 -0
- package/dist/src/agents/registry.d.ts +35 -0
- package/dist/src/agents/registry.js +58 -0
- package/dist/src/agents/registry.js.map +1 -0
- package/dist/src/agents/registry.test.js +146 -0
- package/dist/src/agents/registry.test.js.map +1 -0
- package/dist/src/agents/schema-utils.d.ts +39 -0
- package/dist/src/agents/schema-utils.js +57 -0
- package/dist/src/agents/schema-utils.js.map +1 -0
- package/dist/src/agents/schema-utils.test.d.ts +6 -0
- package/dist/src/agents/schema-utils.test.js +144 -0
- package/dist/src/agents/schema-utils.test.js.map +1 -0
- package/dist/src/agents/subagent-tool-wrapper.d.ts +36 -0
- package/dist/src/agents/subagent-tool-wrapper.js +47 -0
- package/dist/src/agents/subagent-tool-wrapper.js.map +1 -0
- package/dist/src/agents/subagent-tool-wrapper.test.d.ts +6 -0
- package/dist/src/agents/subagent-tool-wrapper.test.js +105 -0
- package/dist/src/agents/subagent-tool-wrapper.test.js.map +1 -0
- package/dist/src/agents/types.d.ts +116 -0
- package/dist/src/agents/types.js +17 -0
- package/dist/src/agents/types.js.map +1 -0
- package/dist/src/agents/utils.d.ts +15 -0
- package/dist/src/agents/utils.js +29 -0
- package/dist/src/agents/utils.js.map +1 -0
- package/dist/src/agents/utils.test.d.ts +6 -0
- package/dist/src/agents/utils.test.js +87 -0
- package/dist/src/agents/utils.test.js.map +1 -0
- package/dist/src/code_assist/codeAssist.d.ts +6 -3
- package/dist/src/code_assist/codeAssist.js +12 -0
- package/dist/src/code_assist/codeAssist.js.map +1 -1
- package/dist/src/code_assist/converter.d.ts +4 -1
- package/dist/src/code_assist/converter.js +38 -5
- package/dist/src/code_assist/converter.js.map +1 -1
- package/dist/src/code_assist/converter.test.js +93 -0
- package/dist/src/code_assist/converter.test.js.map +1 -1
- package/dist/src/code_assist/oauth-credential-storage.d.ts +25 -0
- package/dist/src/code_assist/oauth-credential-storage.js +109 -0
- package/dist/src/code_assist/oauth-credential-storage.js.map +1 -0
- package/dist/src/code_assist/oauth-credential-storage.test.d.ts +6 -0
- package/dist/src/code_assist/oauth-credential-storage.test.js +136 -0
- package/dist/src/code_assist/oauth-credential-storage.test.js.map +1 -0
- package/dist/src/code_assist/oauth2.d.ts +1 -1
- package/dist/src/code_assist/oauth2.js +107 -48
- package/dist/src/code_assist/oauth2.js.map +1 -1
- package/dist/src/code_assist/oauth2.test.js +735 -343
- package/dist/src/code_assist/oauth2.test.js.map +1 -1
- package/dist/src/code_assist/server.d.ts +4 -4
- package/dist/src/code_assist/server.js +25 -2
- package/dist/src/code_assist/server.js.map +1 -1
- package/dist/src/code_assist/server.test.js +25 -0
- package/dist/src/code_assist/server.test.js.map +1 -1
- package/dist/src/code_assist/setup.d.ts +1 -1
- package/dist/src/code_assist/setup.js +1 -1
- package/dist/src/code_assist/setup.js.map +1 -1
- package/dist/src/code_assist/setup.test.js.map +1 -1
- package/dist/src/code_assist/types.d.ts +17 -2
- package/dist/src/config/config.d.ts +121 -25
- package/dist/src/config/config.js +298 -87
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/config.test.js +370 -131
- package/dist/src/config/config.test.js.map +1 -1
- package/dist/src/config/constants.d.ts +11 -0
- package/dist/src/config/constants.js +16 -0
- package/dist/src/config/constants.js.map +1 -0
- package/dist/src/config/models.d.ts +16 -0
- package/dist/src/config/models.js +29 -0
- package/dist/src/config/models.js.map +1 -1
- package/dist/src/config/models.test.d.ts +6 -0
- package/dist/src/config/models.test.js +55 -0
- package/dist/src/config/models.test.js.map +1 -0
- package/dist/src/config/storage.d.ts +34 -0
- package/dist/src/config/storage.js +95 -0
- package/dist/src/config/storage.js.map +1 -0
- package/dist/src/config/storage.test.d.ts +6 -0
- package/dist/src/config/storage.test.js +47 -0
- package/dist/src/config/storage.test.js.map +1 -0
- package/dist/src/confirmation-bus/index.d.ts +7 -0
- package/dist/src/confirmation-bus/index.js +8 -0
- package/dist/src/confirmation-bus/index.js.map +1 -0
- package/dist/src/confirmation-bus/message-bus.d.ts +17 -0
- package/dist/src/confirmation-bus/message-bus.js +81 -0
- package/dist/src/confirmation-bus/message-bus.js.map +1 -0
- package/dist/src/confirmation-bus/message-bus.test.d.ts +6 -0
- package/dist/src/confirmation-bus/message-bus.test.js +164 -0
- package/dist/src/confirmation-bus/message-bus.test.js.map +1 -0
- package/dist/src/confirmation-bus/types.d.ts +38 -0
- package/dist/src/confirmation-bus/types.js +15 -0
- package/dist/src/confirmation-bus/types.js.map +1 -0
- package/dist/src/core/baseLlmClient.d.ts +54 -0
- package/dist/src/core/baseLlmClient.js +190 -0
- package/dist/src/core/baseLlmClient.js.map +1 -0
- package/dist/src/core/baseLlmClient.test.d.ts +6 -0
- package/dist/src/core/baseLlmClient.test.js +316 -0
- package/dist/src/core/baseLlmClient.test.js.map +1 -0
- package/dist/src/core/client.d.ts +28 -28
- package/dist/src/core/client.js +187 -333
- package/dist/src/core/client.js.map +1 -1
- package/dist/src/core/client.test.js +745 -500
- package/dist/src/core/client.test.js.map +1 -1
- package/dist/src/core/contentGenerator.d.ts +4 -4
- package/dist/src/core/contentGenerator.js +6 -7
- package/dist/src/core/contentGenerator.js.map +1 -1
- package/dist/src/core/contentGenerator.test.js +1 -3
- package/dist/src/core/contentGenerator.test.js.map +1 -1
- package/dist/src/core/coreToolScheduler.d.ts +20 -7
- package/dist/src/core/coreToolScheduler.js +216 -53
- package/dist/src/core/coreToolScheduler.js.map +1 -1
- package/dist/src/core/coreToolScheduler.test.js +564 -88
- package/dist/src/core/coreToolScheduler.test.js.map +1 -1
- package/dist/src/core/geminiChat.d.ts +54 -43
- package/dist/src/core/geminiChat.js +298 -280
- package/dist/src/core/geminiChat.js.map +1 -1
- package/dist/src/core/geminiChat.test.js +1255 -321
- package/dist/src/core/geminiChat.test.js.map +1 -1
- package/dist/src/core/geminiRequest.js +1 -0
- package/dist/src/core/geminiRequest.js.map +1 -1
- package/dist/src/core/logger.d.ts +4 -2
- package/dist/src/core/logger.js +4 -3
- package/dist/src/core/logger.js.map +1 -1
- package/dist/src/core/logger.test.js +17 -16
- package/dist/src/core/logger.test.js.map +1 -1
- package/dist/src/core/loggingContentGenerator.d.ts +3 -3
- package/dist/src/core/loggingContentGenerator.js +15 -16
- package/dist/src/core/loggingContentGenerator.js.map +1 -1
- package/dist/src/core/nonInteractiveToolExecutor.d.ts +3 -5
- package/dist/src/core/nonInteractiveToolExecutor.js +14 -122
- package/dist/src/core/nonInteractiveToolExecutor.js.map +1 -1
- package/dist/src/core/nonInteractiveToolExecutor.test.js +158 -78
- package/dist/src/core/nonInteractiveToolExecutor.test.js.map +1 -1
- package/dist/src/core/openaiContentGenerator.d.ts +4 -3
- package/dist/src/core/openaiContentGenerator.js +21 -14
- package/dist/src/core/openaiContentGenerator.js.map +1 -1
- package/dist/src/core/openaiContentGenerator.test.js +1 -0
- package/dist/src/core/openaiContentGenerator.test.js.map +1 -1
- package/dist/src/core/prompts.d.ts +5 -0
- package/dist/src/core/prompts.js +66 -44
- package/dist/src/core/prompts.js.map +1 -1
- package/dist/src/core/prompts.test.js +130 -1
- package/dist/src/core/prompts.test.js.map +1 -1
- package/dist/src/core/subagent.d.ts +24 -18
- package/dist/src/core/subagent.js +125 -90
- package/dist/src/core/subagent.js.map +1 -1
- package/dist/src/core/subagent.test.js +59 -44
- package/dist/src/core/subagent.test.js.map +1 -1
- package/dist/src/core/turn.d.ts +37 -13
- package/dist/src/core/turn.js +63 -28
- package/dist/src/core/turn.js.map +1 -1
- package/dist/src/core/turn.test.js +359 -100
- package/dist/src/core/turn.test.js.map +1 -1
- package/dist/src/fallback/handler.d.ts +7 -0
- package/dist/src/fallback/handler.js +129 -0
- package/dist/src/fallback/handler.js.map +1 -0
- package/dist/src/fallback/handler.test.d.ts +6 -0
- package/dist/src/fallback/handler.test.js +130 -0
- package/dist/src/fallback/handler.test.js.map +1 -0
- package/dist/src/fallback/types.d.ts +14 -0
- package/dist/src/fallback/types.js +7 -0
- package/dist/src/fallback/types.js.map +1 -0
- package/dist/src/generated/git-commit.d.ts +1 -1
- package/dist/src/generated/git-commit.js +1 -1
- package/dist/src/ide/constants.d.ts +3 -0
- package/dist/src/ide/constants.js +3 -0
- package/dist/src/ide/constants.js.map +1 -1
- package/dist/src/ide/detect-ide.d.ts +48 -12
- package/dist/src/ide/detect-ide.js +47 -66
- package/dist/src/ide/detect-ide.js.map +1 -1
- package/dist/src/ide/detect-ide.test.js +79 -52
- package/dist/src/ide/detect-ide.test.js.map +1 -1
- package/dist/src/ide/ide-client.d.ts +69 -23
- package/dist/src/ide/ide-client.js +372 -78
- package/dist/src/ide/ide-client.js.map +1 -1
- package/dist/src/ide/ide-client.test.js +375 -30
- package/dist/src/ide/ide-client.test.js.map +1 -1
- package/dist/src/ide/ide-installer.d.ts +2 -2
- package/dist/src/ide/ide-installer.js +37 -24
- package/dist/src/ide/ide-installer.js.map +1 -1
- package/dist/src/ide/ide-installer.test.js +104 -26
- package/dist/src/ide/ide-installer.test.js.map +1 -1
- package/dist/src/ide/ideContext.d.ts +35 -365
- package/dist/src/ide/ideContext.js +60 -106
- package/dist/src/ide/ideContext.js.map +1 -1
- package/dist/src/ide/ideContext.test.js +152 -24
- package/dist/src/ide/ideContext.test.js.map +1 -1
- package/dist/src/ide/process-utils.d.ts +7 -5
- package/dist/src/ide/process-utils.js +81 -50
- package/dist/src/ide/process-utils.js.map +1 -1
- package/dist/src/ide/process-utils.test.d.ts +6 -0
- package/dist/src/ide/process-utils.test.js +158 -0
- package/dist/src/ide/process-utils.test.js.map +1 -0
- package/dist/src/ide/types.d.ts +486 -0
- package/dist/src/ide/types.js +138 -0
- package/dist/src/ide/types.js.map +1 -0
- package/dist/src/index.d.ts +20 -2
- package/dist/src/index.js +20 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/google-auth-provider.d.ts +3 -3
- package/dist/src/mcp/google-auth-provider.test.js.map +1 -1
- package/dist/src/mcp/oauth-provider.d.ts +17 -13
- package/dist/src/mcp/oauth-provider.js +81 -69
- package/dist/src/mcp/oauth-provider.js.map +1 -1
- package/dist/src/mcp/oauth-provider.test.js +212 -37
- package/dist/src/mcp/oauth-provider.test.js.map +1 -1
- package/dist/src/mcp/oauth-token-storage.d.ts +14 -32
- package/dist/src/mcp/oauth-token-storage.js +54 -25
- package/dist/src/mcp/oauth-token-storage.js.map +1 -1
- package/dist/src/mcp/oauth-token-storage.test.js +256 -162
- package/dist/src/mcp/oauth-token-storage.test.js.map +1 -1
- package/dist/src/mcp/oauth-utils.d.ts +9 -1
- package/dist/src/mcp/oauth-utils.js +42 -27
- package/dist/src/mcp/oauth-utils.js.map +1 -1
- package/dist/src/mcp/oauth-utils.test.js +41 -1
- package/dist/src/mcp/oauth-utils.test.js.map +1 -1
- package/dist/src/mcp/sa-impersonation-provider.d.ts +33 -0
- package/dist/src/mcp/sa-impersonation-provider.js +130 -0
- package/dist/src/mcp/sa-impersonation-provider.js.map +1 -0
- package/dist/src/mcp/sa-impersonation-provider.test.d.ts +6 -0
- package/dist/src/mcp/sa-impersonation-provider.test.js +117 -0
- package/dist/src/mcp/sa-impersonation-provider.test.js.map +1 -0
- package/dist/src/mcp/token-storage/base-token-storage.d.ts +19 -0
- package/dist/src/mcp/token-storage/base-token-storage.js +36 -0
- package/dist/src/mcp/token-storage/base-token-storage.js.map +1 -0
- package/dist/src/mcp/token-storage/base-token-storage.test.d.ts +6 -0
- package/dist/src/mcp/token-storage/base-token-storage.test.js +160 -0
- package/dist/src/mcp/token-storage/base-token-storage.test.js.map +1 -0
- package/dist/src/mcp/token-storage/file-token-storage.d.ts +24 -0
- package/dist/src/mcp/token-storage/file-token-storage.js +144 -0
- package/dist/src/mcp/token-storage/file-token-storage.js.map +1 -0
- package/dist/src/mcp/token-storage/file-token-storage.test.d.ts +6 -0
- package/dist/src/mcp/token-storage/file-token-storage.test.js +235 -0
- package/dist/src/mcp/token-storage/file-token-storage.test.js.map +1 -0
- package/dist/src/mcp/token-storage/hybrid-token-storage.d.ts +23 -0
- package/dist/src/mcp/token-storage/hybrid-token-storage.js +78 -0
- package/dist/src/mcp/token-storage/hybrid-token-storage.js.map +1 -0
- package/dist/src/mcp/token-storage/hybrid-token-storage.test.d.ts +6 -0
- package/dist/src/mcp/token-storage/hybrid-token-storage.test.js +193 -0
- package/dist/src/mcp/token-storage/hybrid-token-storage.test.js.map +1 -0
- package/dist/src/mcp/token-storage/index.d.ts +11 -0
- package/dist/src/mcp/token-storage/index.js +12 -0
- package/dist/src/mcp/token-storage/index.js.map +1 -0
- package/dist/src/mcp/token-storage/keychain-token-storage.d.ts +31 -0
- package/dist/src/mcp/token-storage/keychain-token-storage.js +190 -0
- package/dist/src/mcp/token-storage/keychain-token-storage.js.map +1 -0
- package/dist/src/mcp/token-storage/keychain-token-storage.test.d.ts +6 -0
- package/dist/src/mcp/token-storage/keychain-token-storage.test.js +254 -0
- package/dist/src/mcp/token-storage/keychain-token-storage.test.js.map +1 -0
- package/dist/src/mcp/token-storage/types.d.ts +38 -0
- package/dist/src/mcp/token-storage/types.js +11 -0
- package/dist/src/mcp/token-storage/types.js.map +1 -0
- package/dist/src/output/json-formatter.d.ts +11 -0
- package/dist/src/output/json-formatter.js +30 -0
- package/dist/src/output/json-formatter.js.map +1 -0
- package/dist/src/output/json-formatter.test.d.ts +6 -0
- package/dist/src/output/json-formatter.test.js +266 -0
- package/dist/src/output/json-formatter.test.js.map +1 -0
- package/dist/src/output/types.d.ts +20 -0
- package/dist/src/output/types.js +11 -0
- package/dist/src/output/types.js.map +1 -0
- package/dist/src/policy/index.d.ts +7 -0
- package/dist/src/policy/index.js +8 -0
- package/dist/src/policy/index.js.map +1 -0
- package/dist/src/policy/policy-engine.d.ts +30 -0
- package/dist/src/policy/policy-engine.js +92 -0
- package/dist/src/policy/policy-engine.js.map +1 -0
- package/dist/src/policy/policy-engine.test.d.ts +6 -0
- package/dist/src/policy/policy-engine.test.js +515 -0
- package/dist/src/policy/policy-engine.test.js.map +1 -0
- package/dist/src/policy/stable-stringify.d.ts +58 -0
- package/dist/src/policy/stable-stringify.js +122 -0
- package/dist/src/policy/stable-stringify.js.map +1 -0
- package/dist/src/policy/types.d.ts +47 -0
- package/dist/src/policy/types.js +12 -0
- package/dist/src/policy/types.js.map +1 -0
- package/dist/src/prompts/mcp-prompts.d.ts +2 -2
- package/dist/src/prompts/prompt-registry.d.ts +1 -1
- package/dist/src/routing/modelRouterService.d.ts +23 -0
- package/dist/src/routing/modelRouterService.js +70 -0
- package/dist/src/routing/modelRouterService.js.map +1 -0
- package/dist/src/routing/modelRouterService.test.d.ts +6 -0
- package/dist/src/routing/modelRouterService.test.js +98 -0
- package/dist/src/routing/modelRouterService.test.js.map +1 -0
- package/dist/src/routing/routingStrategy.d.ts +62 -0
- package/dist/src/routing/routingStrategy.js +7 -0
- package/dist/src/routing/routingStrategy.js.map +1 -0
- package/dist/src/routing/strategies/classifierStrategy.d.ts +12 -0
- package/dist/src/routing/strategies/classifierStrategy.js +173 -0
- package/dist/src/routing/strategies/classifierStrategy.js.map +1 -0
- package/dist/src/routing/strategies/classifierStrategy.test.d.ts +6 -0
- package/dist/src/routing/strategies/classifierStrategy.test.js +192 -0
- package/dist/src/routing/strategies/classifierStrategy.test.js.map +1 -0
- package/dist/src/routing/strategies/compositeStrategy.d.ts +26 -0
- package/dist/src/routing/strategies/compositeStrategy.js +68 -0
- package/dist/src/routing/strategies/compositeStrategy.js.map +1 -0
- package/dist/src/routing/strategies/compositeStrategy.test.d.ts +6 -0
- package/dist/src/routing/strategies/compositeStrategy.test.js +123 -0
- package/dist/src/routing/strategies/compositeStrategy.test.js.map +1 -0
- package/dist/src/routing/strategies/defaultStrategy.d.ts +12 -0
- package/dist/src/routing/strategies/defaultStrategy.js +20 -0
- package/dist/src/routing/strategies/defaultStrategy.js.map +1 -0
- package/dist/src/routing/strategies/defaultStrategy.test.d.ts +6 -0
- package/dist/src/routing/strategies/defaultStrategy.test.js +26 -0
- package/dist/src/routing/strategies/defaultStrategy.test.js.map +1 -0
- package/dist/src/routing/strategies/fallbackStrategy.d.ts +12 -0
- package/dist/src/routing/strategies/fallbackStrategy.js +25 -0
- package/dist/src/routing/strategies/fallbackStrategy.js.map +1 -0
- package/dist/src/routing/strategies/fallbackStrategy.test.d.ts +6 -0
- package/dist/src/routing/strategies/fallbackStrategy.test.js +55 -0
- package/dist/src/routing/strategies/fallbackStrategy.test.js.map +1 -0
- package/dist/src/routing/strategies/overrideStrategy.d.ts +15 -0
- package/dist/src/routing/strategies/overrideStrategy.js +28 -0
- package/dist/src/routing/strategies/overrideStrategy.js.map +1 -0
- package/dist/src/routing/strategies/overrideStrategy.test.d.ts +6 -0
- package/dist/src/routing/strategies/overrideStrategy.test.js +42 -0
- package/dist/src/routing/strategies/overrideStrategy.test.js.map +1 -0
- package/dist/src/services/chatRecordingService.d.ts +8 -14
- package/dist/src/services/chatRecordingService.js +33 -21
- package/dist/src/services/chatRecordingService.js.map +1 -1
- package/dist/src/services/chatRecordingService.test.js +69 -25
- package/dist/src/services/chatRecordingService.test.js.map +1 -1
- package/dist/src/services/fileDiscoveryService.d.ts +10 -0
- package/dist/src/services/fileDiscoveryService.js +32 -18
- package/dist/src/services/fileDiscoveryService.js.map +1 -1
- package/dist/src/services/fileDiscoveryService.test.js +3 -3
- package/dist/src/services/fileDiscoveryService.test.js.map +1 -1
- package/dist/src/services/fileSystemService.d.ts +9 -0
- package/dist/src/services/fileSystemService.js +12 -1
- package/dist/src/services/fileSystemService.js.map +1 -1
- package/dist/src/services/fileSystemService.test.js +1 -1
- package/dist/src/services/fileSystemService.test.js.map +1 -1
- package/dist/src/services/gitService.d.ts +3 -1
- package/dist/src/services/gitService.js +30 -24
- package/dist/src/services/gitService.js.map +1 -1
- package/dist/src/services/gitService.test.js +30 -37
- package/dist/src/services/gitService.test.js.map +1 -1
- package/dist/src/services/loopDetectionService.d.ts +8 -2
- package/dist/src/services/loopDetectionService.js +64 -24
- package/dist/src/services/loopDetectionService.js.map +1 -1
- package/dist/src/services/loopDetectionService.test.js +64 -13
- package/dist/src/services/loopDetectionService.test.js.map +1 -1
- package/dist/src/services/shellExecutionService.d.ts +36 -2
- package/dist/src/services/shellExecutionService.js +238 -47
- package/dist/src/services/shellExecutionService.js.map +1 -1
- package/dist/src/services/shellExecutionService.test.js +197 -58
- package/dist/src/services/shellExecutionService.test.js.map +1 -1
- package/dist/src/telemetry/activity-detector.d.ts +41 -0
- package/dist/src/telemetry/activity-detector.js +61 -0
- package/dist/src/telemetry/activity-detector.js.map +1 -0
- package/dist/src/telemetry/activity-detector.test.d.ts +6 -0
- package/dist/src/telemetry/activity-detector.test.js +136 -0
- package/dist/src/telemetry/activity-detector.test.js.map +1 -0
- package/dist/src/telemetry/activity-types.d.ts +19 -0
- package/dist/src/telemetry/activity-types.js +21 -0
- package/dist/src/telemetry/activity-types.js.map +1 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +34 -4
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +322 -15
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.d.ts +1 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +321 -11
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +51 -2
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +124 -2
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -1
- package/dist/src/telemetry/config.d.ts +31 -0
- package/dist/src/telemetry/config.js +76 -0
- package/dist/src/telemetry/config.js.map +1 -0
- package/dist/src/telemetry/config.test.d.ts +6 -0
- package/dist/src/telemetry/config.test.js +124 -0
- package/dist/src/telemetry/config.test.js.map +1 -0
- package/dist/src/telemetry/constants.d.ts +17 -7
- package/dist/src/telemetry/constants.js +18 -7
- package/dist/src/telemetry/constants.js.map +1 -1
- package/dist/src/telemetry/file-exporters.d.ts +5 -4
- package/dist/src/telemetry/file-exporters.js +1 -1
- package/dist/src/telemetry/file-exporters.js.map +1 -1
- package/dist/src/telemetry/gcp-exporters.d.ts +34 -0
- package/dist/src/telemetry/gcp-exporters.js +117 -0
- package/dist/src/telemetry/gcp-exporters.js.map +1 -0
- package/dist/src/telemetry/gcp-exporters.test.d.ts +6 -0
- package/dist/src/telemetry/gcp-exporters.test.js +318 -0
- package/dist/src/telemetry/gcp-exporters.test.js.map +1 -0
- package/dist/src/telemetry/high-water-mark-tracker.d.ts +43 -0
- package/dist/src/telemetry/high-water-mark-tracker.js +88 -0
- package/dist/src/telemetry/high-water-mark-tracker.js.map +1 -0
- package/dist/src/telemetry/high-water-mark-tracker.test.d.ts +6 -0
- package/dist/src/telemetry/high-water-mark-tracker.test.js +152 -0
- package/dist/src/telemetry/high-water-mark-tracker.test.js.map +1 -0
- package/dist/src/telemetry/index.d.ts +12 -2
- package/dist/src/telemetry/index.js +16 -2
- package/dist/src/telemetry/index.js.map +1 -1
- package/dist/src/telemetry/loggers.d.ts +17 -2
- package/dist/src/telemetry/loggers.js +316 -14
- package/dist/src/telemetry/loggers.js.map +1 -1
- package/dist/src/telemetry/loggers.test.circular.js +3 -3
- package/dist/src/telemetry/loggers.test.circular.js.map +1 -1
- package/dist/src/telemetry/loggers.test.js +452 -48
- package/dist/src/telemetry/loggers.test.js.map +1 -1
- package/dist/src/telemetry/metrics.d.ts +323 -12
- package/dist/src/telemetry/metrics.js +464 -83
- package/dist/src/telemetry/metrics.js.map +1 -1
- package/dist/src/telemetry/metrics.test.js +583 -38
- package/dist/src/telemetry/metrics.test.js.map +1 -1
- package/dist/src/telemetry/rate-limiter.d.ts +48 -0
- package/dist/src/telemetry/rate-limiter.js +100 -0
- package/dist/src/telemetry/rate-limiter.js.map +1 -0
- package/dist/src/telemetry/rate-limiter.test.d.ts +6 -0
- package/dist/src/telemetry/rate-limiter.test.js +207 -0
- package/dist/src/telemetry/rate-limiter.test.js.map +1 -0
- package/dist/src/telemetry/sdk.d.ts +1 -1
- package/dist/src/telemetry/sdk.js +20 -2
- package/dist/src/telemetry/sdk.js.map +1 -1
- package/dist/src/telemetry/sdk.test.js +108 -0
- package/dist/src/telemetry/sdk.test.js.map +1 -1
- package/dist/src/telemetry/telemetry-utils.d.ts +6 -0
- package/dist/src/telemetry/telemetry-utils.js +14 -0
- package/dist/src/telemetry/telemetry-utils.js.map +1 -0
- package/dist/src/telemetry/telemetry-utils.test.d.ts +6 -0
- package/dist/src/telemetry/telemetry-utils.test.js +40 -0
- package/dist/src/telemetry/telemetry-utils.test.js.map +1 -0
- package/dist/src/telemetry/types.d.ts +136 -8
- package/dist/src/telemetry/types.js +233 -11
- package/dist/src/telemetry/types.js.map +1 -1
- package/dist/src/telemetry/uiTelemetry.d.ts +3 -3
- package/dist/src/telemetry/uiTelemetry.js +7 -8
- package/dist/src/telemetry/uiTelemetry.js.map +1 -1
- package/dist/src/telemetry/uiTelemetry.test.js +33 -29
- package/dist/src/telemetry/uiTelemetry.test.js.map +1 -1
- package/dist/src/test-utils/config.d.ts +2 -1
- package/dist/src/test-utils/config.js.map +1 -1
- package/dist/src/test-utils/index.d.ts +6 -0
- package/dist/src/test-utils/index.js +7 -0
- package/dist/src/test-utils/index.js.map +1 -0
- package/dist/src/test-utils/mock-tool.d.ts +66 -0
- package/dist/src/test-utils/{tools.js → mock-tool.js} +45 -29
- package/dist/src/test-utils/mock-tool.js.map +1 -0
- package/dist/src/test-utils/mockWorkspaceContext.d.ts +1 -1
- package/dist/src/tools/diffOptions.d.ts +1 -1
- package/dist/src/tools/diffOptions.js +21 -13
- package/dist/src/tools/diffOptions.js.map +1 -1
- package/dist/src/tools/diffOptions.test.js +58 -22
- package/dist/src/tools/diffOptions.test.js.map +1 -1
- package/dist/src/tools/edit.d.ts +6 -5
- package/dist/src/tools/edit.js +58 -40
- package/dist/src/tools/edit.js.map +1 -1
- package/dist/src/tools/edit.test.js +192 -16
- package/dist/src/tools/edit.test.js.map +1 -1
- package/dist/src/tools/glob.d.ts +7 -2
- package/dist/src/tools/glob.js +42 -23
- package/dist/src/tools/glob.js.map +1 -1
- package/dist/src/tools/glob.test.js +80 -4
- package/dist/src/tools/glob.test.js.map +1 -1
- package/dist/src/tools/grep.d.ts +3 -2
- package/dist/src/tools/grep.js +35 -15
- package/dist/src/tools/grep.js.map +1 -1
- package/dist/src/tools/grep.test.js +26 -3
- package/dist/src/tools/grep.test.js.map +1 -1
- package/dist/src/tools/ls.d.ts +3 -2
- package/dist/src/tools/ls.js +31 -39
- package/dist/src/tools/ls.js.map +1 -1
- package/dist/src/tools/ls.test.js +145 -280
- package/dist/src/tools/ls.test.js.map +1 -1
- package/dist/src/tools/mcp-client-manager.d.ts +8 -6
- package/dist/src/tools/mcp-client-manager.js +13 -4
- package/dist/src/tools/mcp-client-manager.js.map +1 -1
- package/dist/src/tools/mcp-client-manager.test.js +20 -1
- package/dist/src/tools/mcp-client-manager.test.js.map +1 -1
- package/dist/src/tools/mcp-client.d.ts +18 -21
- package/dist/src/tools/mcp-client.js +87 -120
- package/dist/src/tools/mcp-client.js.map +1 -1
- package/dist/src/tools/mcp-client.test.js +32 -152
- package/dist/src/tools/mcp-client.test.js.map +1 -1
- package/dist/src/tools/mcp-tool.d.ts +6 -4
- package/dist/src/tools/mcp-tool.js +51 -13
- package/dist/src/tools/mcp-tool.js.map +1 -1
- package/dist/src/tools/mcp-tool.test.js +166 -12
- package/dist/src/tools/mcp-tool.test.js.map +1 -1
- package/dist/src/tools/memoryTool.d.ts +3 -2
- package/dist/src/tools/memoryTool.js +14 -37
- package/dist/src/tools/memoryTool.js.map +1 -1
- package/dist/src/tools/memoryTool.test.js +16 -4
- package/dist/src/tools/memoryTool.test.js.map +1 -1
- package/dist/src/tools/message-bus-integration.test.d.ts +6 -0
- package/dist/src/tools/message-bus-integration.test.js +183 -0
- package/dist/src/tools/message-bus-integration.test.js.map +1 -0
- package/dist/src/tools/modifiable-tool.d.ts +2 -2
- package/dist/src/tools/modifiable-tool.js +3 -3
- package/dist/src/tools/modifiable-tool.js.map +1 -1
- package/dist/src/tools/modifiable-tool.test.js +4 -4
- package/dist/src/tools/modifiable-tool.test.js.map +1 -1
- package/dist/src/tools/read-file.d.ts +3 -2
- package/dist/src/tools/read-file.js +33 -43
- package/dist/src/tools/read-file.js.map +1 -1
- package/dist/src/tools/read-file.test.js +39 -7
- package/dist/src/tools/read-file.test.js.map +1 -1
- package/dist/src/tools/read-many-files.d.ts +3 -2
- package/dist/src/tools/read-many-files.js +52 -107
- package/dist/src/tools/read-many-files.js.map +1 -1
- package/dist/src/tools/read-many-files.test.js +64 -11
- package/dist/src/tools/read-many-files.test.js.map +1 -1
- package/dist/src/tools/ripGrep.d.ts +55 -0
- package/dist/src/tools/ripGrep.js +393 -0
- package/dist/src/tools/ripGrep.js.map +1 -0
- package/dist/src/tools/ripGrep.test.d.ts +6 -0
- package/dist/src/tools/ripGrep.test.js +976 -0
- package/dist/src/tools/ripGrep.test.js.map +1 -0
- package/dist/src/tools/shell.d.ts +13 -2
- package/dist/src/tools/shell.js +42 -32
- package/dist/src/tools/shell.js.map +1 -1
- package/dist/src/tools/shell.test.js +57 -75
- package/dist/src/tools/shell.test.js.map +1 -1
- package/dist/src/tools/smart-edit.d.ts +91 -0
- package/dist/src/tools/smart-edit.js +702 -0
- package/dist/src/tools/smart-edit.js.map +1 -0
- package/dist/src/tools/smart-edit.test.d.ts +6 -0
- package/dist/src/tools/smart-edit.test.js +542 -0
- package/dist/src/tools/smart-edit.test.js.map +1 -0
- package/dist/src/tools/tool-error.d.ts +18 -1
- package/dist/src/tools/tool-error.js +27 -0
- package/dist/src/tools/tool-error.js.map +1 -1
- package/dist/src/tools/tool-registry.d.ts +10 -4
- package/dist/src/tools/tool-registry.js +20 -7
- package/dist/src/tools/tool-registry.js.map +1 -1
- package/dist/src/tools/tool-registry.test.js +93 -10
- package/dist/src/tools/tool-registry.test.js.map +1 -1
- package/dist/src/tools/tools.d.ts +33 -16
- package/dist/src/tools/tools.js +115 -5
- package/dist/src/tools/tools.js.map +1 -1
- package/dist/src/tools/tools.test.js +1 -2
- package/dist/src/tools/tools.test.js.map +1 -1
- package/dist/src/tools/web-fetch.d.ts +3 -2
- package/dist/src/tools/web-fetch.js +14 -10
- package/dist/src/tools/web-fetch.js.map +1 -1
- package/dist/src/tools/web-fetch.test.js +55 -16
- package/dist/src/tools/web-fetch.test.js.map +1 -1
- package/dist/src/tools/web-search.d.ts +4 -3
- package/dist/src/tools/web-search.js +31 -8
- package/dist/src/tools/web-search.js.map +1 -1
- package/dist/src/tools/web-search.test.js +69 -1
- package/dist/src/tools/web-search.test.js.map +1 -1
- package/dist/src/tools/write-file.d.ts +4 -3
- package/dist/src/tools/write-file.js +17 -18
- package/dist/src/tools/write-file.js.map +1 -1
- package/dist/src/tools/write-file.test.js +108 -24
- package/dist/src/tools/write-file.test.js.map +1 -1
- package/dist/src/tools/write-todos.d.ts +25 -0
- package/dist/src/tools/write-todos.js +150 -0
- package/dist/src/tools/write-todos.js.map +1 -0
- package/dist/src/tools/write-todos.test.d.ts +6 -0
- package/dist/src/tools/write-todos.test.js +89 -0
- package/dist/src/tools/write-todos.test.js.map +1 -0
- package/dist/src/utils/bfsFileSearch.d.ts +2 -2
- package/dist/src/utils/bfsFileSearch.js +13 -7
- package/dist/src/utils/bfsFileSearch.js.map +1 -1
- package/dist/src/utils/bfsFileSearch.test.js +3 -3
- package/dist/src/utils/bfsFileSearch.test.js.map +1 -1
- package/dist/src/utils/editCorrector.d.ts +9 -8
- package/dist/src/utils/editCorrector.js +62 -19
- package/dist/src/utils/editCorrector.js.map +1 -1
- package/dist/src/utils/editCorrector.test.js +33 -82
- package/dist/src/utils/editCorrector.test.js.map +1 -1
- package/dist/src/utils/editor.js +32 -45
- package/dist/src/utils/editor.js.map +1 -1
- package/dist/src/utils/editor.test.js +62 -76
- package/dist/src/utils/editor.test.js.map +1 -1
- package/dist/src/utils/environmentContext.d.ts +2 -2
- package/dist/src/utils/errorParsing.js +2 -2
- package/dist/src/utils/errorParsing.js.map +1 -1
- package/dist/src/utils/errorParsing.test.js +7 -7
- package/dist/src/utils/errorParsing.test.js.map +1 -1
- package/dist/src/utils/errorReporting.d.ts +1 -1
- package/dist/src/utils/errors.d.ts +25 -0
- package/dist/src/utils/errors.js +42 -0
- package/dist/src/utils/errors.js.map +1 -1
- package/dist/src/utils/fetch.js +1 -1
- package/dist/src/utils/fetch.js.map +1 -1
- package/dist/src/utils/fileUtils.d.ts +24 -12
- package/dist/src/utils/fileUtils.js +170 -79
- package/dist/src/utils/fileUtils.js.map +1 -1
- package/dist/src/utils/fileUtils.test.js +347 -29
- package/dist/src/utils/fileUtils.test.js.map +1 -1
- package/dist/src/utils/filesearch/crawler.d.ts +1 -1
- package/dist/src/utils/filesearch/crawler.test.js +2 -2
- package/dist/src/utils/filesearch/crawler.test.js.map +1 -1
- package/dist/src/utils/filesearch/fileSearch.d.ts +1 -0
- package/dist/src/utils/filesearch/fileSearch.js +14 -9
- package/dist/src/utils/filesearch/fileSearch.js.map +1 -1
- package/dist/src/utils/filesearch/fileSearch.test.js +90 -0
- package/dist/src/utils/filesearch/fileSearch.test.js.map +1 -1
- package/dist/src/utils/flashFallback.test.d.ts +6 -0
- package/dist/src/utils/{flashFallback.integration.test.js → flashFallback.test.js} +33 -29
- package/dist/src/utils/flashFallback.test.js.map +1 -0
- package/dist/src/utils/geminiIgnoreParser.d.ts +18 -0
- package/dist/src/utils/geminiIgnoreParser.js +61 -0
- package/dist/src/utils/geminiIgnoreParser.js.map +1 -0
- package/dist/src/utils/geminiIgnoreParser.test.d.ts +6 -0
- package/dist/src/utils/geminiIgnoreParser.test.js +50 -0
- package/dist/src/utils/geminiIgnoreParser.test.js.map +1 -0
- package/dist/src/utils/generateContentResponseUtilities.d.ts +1 -2
- package/dist/src/utils/generateContentResponseUtilities.js +1 -13
- package/dist/src/utils/generateContentResponseUtilities.js.map +1 -1
- package/dist/src/utils/generateContentResponseUtilities.test.js +2 -40
- package/dist/src/utils/generateContentResponseUtilities.test.js.map +1 -1
- package/dist/src/utils/getFolderStructure.d.ts +2 -2
- package/dist/src/utils/getFolderStructure.js +3 -3
- package/dist/src/utils/getFolderStructure.js.map +1 -1
- package/dist/src/utils/getFolderStructure.test.js +4 -4
- package/dist/src/utils/getFolderStructure.test.js.map +1 -1
- package/dist/src/utils/gitIgnoreParser.d.ts +3 -7
- package/dist/src/utils/gitIgnoreParser.js +126 -35
- package/dist/src/utils/gitIgnoreParser.js.map +1 -1
- package/dist/src/utils/gitIgnoreParser.test.js +69 -38
- package/dist/src/utils/gitIgnoreParser.test.js.map +1 -1
- package/dist/src/utils/gitUtils.js +2 -2
- package/dist/src/utils/gitUtils.js.map +1 -1
- package/dist/src/utils/ignorePatterns.d.ts +103 -0
- package/dist/src/utils/ignorePatterns.js +220 -0
- package/dist/src/utils/ignorePatterns.js.map +1 -0
- package/dist/src/utils/ignorePatterns.test.d.ts +6 -0
- package/dist/src/utils/ignorePatterns.test.js +250 -0
- package/dist/src/utils/ignorePatterns.test.js.map +1 -0
- package/dist/src/utils/installationManager.d.ts +16 -0
- package/dist/src/utils/installationManager.js +50 -0
- package/dist/src/utils/installationManager.js.map +1 -0
- package/dist/src/utils/installationManager.test.d.ts +6 -0
- package/dist/src/utils/installationManager.test.js +83 -0
- package/dist/src/utils/installationManager.test.js.map +1 -0
- package/dist/src/utils/language-detection.d.ts +6 -0
- package/dist/src/utils/language-detection.js +101 -0
- package/dist/src/utils/language-detection.js.map +1 -0
- package/dist/src/utils/llm-edit-fixer.d.ts +26 -0
- package/dist/src/utils/llm-edit-fixer.js +131 -0
- package/dist/src/utils/llm-edit-fixer.js.map +1 -0
- package/dist/src/utils/llm-edit-fixer.test.d.ts +6 -0
- package/dist/src/utils/llm-edit-fixer.test.js +186 -0
- package/dist/src/utils/llm-edit-fixer.test.js.map +1 -0
- package/dist/src/utils/memoryDiscovery.d.ts +7 -6
- package/dist/src/utils/memoryDiscovery.js +68 -33
- package/dist/src/utils/memoryDiscovery.js.map +1 -1
- package/dist/src/utils/memoryDiscovery.test.js +88 -26
- package/dist/src/utils/memoryDiscovery.test.js.map +1 -1
- package/dist/src/utils/memoryImportProcessor.js +15 -22
- package/dist/src/utils/memoryImportProcessor.js.map +1 -1
- package/dist/src/utils/memoryImportProcessor.test.js +16 -141
- package/dist/src/utils/memoryImportProcessor.test.js.map +1 -1
- package/dist/src/utils/messageInspectors.d.ts +1 -1
- package/dist/src/utils/nextSpeakerChecker.d.ts +3 -3
- package/dist/src/utils/nextSpeakerChecker.js +8 -2
- package/dist/src/utils/nextSpeakerChecker.js.map +1 -1
- package/dist/src/utils/nextSpeakerChecker.test.js +75 -64
- package/dist/src/utils/nextSpeakerChecker.test.js.map +1 -1
- package/dist/src/utils/partUtils.d.ts +22 -1
- package/dist/src/utils/partUtils.js +68 -0
- package/dist/src/utils/partUtils.js.map +1 -1
- package/dist/src/utils/partUtils.test.js +112 -1
- package/dist/src/utils/partUtils.test.js.map +1 -1
- package/dist/src/utils/pathReader.d.ts +17 -0
- package/dist/src/utils/pathReader.js +92 -0
- package/dist/src/utils/pathReader.js.map +1 -0
- package/dist/src/utils/pathReader.test.d.ts +6 -0
- package/dist/src/utils/pathReader.test.js +363 -0
- package/dist/src/utils/pathReader.test.js.map +1 -0
- package/dist/src/utils/paths.d.ts +0 -17
- package/dist/src/utils/paths.js +2 -28
- package/dist/src/utils/paths.js.map +1 -1
- package/dist/src/utils/promptIdContext.d.ts +7 -0
- package/dist/src/utils/promptIdContext.js +8 -0
- package/dist/src/utils/promptIdContext.js.map +1 -0
- package/dist/src/utils/quotaErrorDetection.d.ts +1 -1
- package/dist/src/utils/retry.d.ts +3 -1
- package/dist/src/utils/retry.js +60 -5
- package/dist/src/utils/retry.js.map +1 -1
- package/dist/src/utils/retry.test.js +35 -3
- package/dist/src/utils/retry.test.js.map +1 -1
- package/dist/src/utils/schemaValidator.js +15 -1
- package/dist/src/utils/schemaValidator.js.map +1 -1
- package/dist/src/utils/schemaValidator.test.d.ts +6 -0
- package/dist/src/utils/schemaValidator.test.js +113 -0
- package/dist/src/utils/schemaValidator.test.js.map +1 -0
- package/dist/src/utils/session.js +1 -1
- package/dist/src/utils/session.js.map +1 -1
- package/dist/src/utils/shell-utils.d.ts +6 -1
- package/dist/src/utils/shell-utils.js +51 -30
- package/dist/src/utils/shell-utils.js.map +1 -1
- package/dist/src/utils/shell-utils.test.js +9 -0
- package/dist/src/utils/shell-utils.test.js.map +1 -1
- package/dist/src/utils/summarizer.d.ts +2 -2
- package/dist/src/utils/summarizer.test.js.map +1 -1
- package/dist/src/utils/systemEncoding.js +2 -2
- package/dist/src/utils/systemEncoding.js.map +1 -1
- package/dist/src/utils/systemEncoding.test.js +2 -2
- package/dist/src/utils/systemEncoding.test.js.map +1 -1
- package/dist/src/utils/terminalSerializer.d.ts +25 -0
- package/dist/src/utils/terminalSerializer.js +432 -0
- package/dist/src/utils/terminalSerializer.js.map +1 -0
- package/dist/src/utils/terminalSerializer.test.d.ts +6 -0
- package/dist/src/utils/terminalSerializer.test.js +176 -0
- package/dist/src/utils/terminalSerializer.test.js.map +1 -0
- package/dist/src/utils/textUtils.d.ts +5 -0
- package/dist/src/utils/textUtils.js +14 -0
- package/dist/src/utils/textUtils.js.map +1 -1
- package/dist/src/utils/textUtils.test.d.ts +6 -0
- package/dist/src/utils/textUtils.test.js +59 -0
- package/dist/src/utils/textUtils.test.js.map +1 -0
- package/dist/src/utils/thoughtUtils.d.ts +21 -0
- package/dist/src/utils/thoughtUtils.js +39 -0
- package/dist/src/utils/thoughtUtils.js.map +1 -0
- package/dist/src/utils/thoughtUtils.test.d.ts +6 -0
- package/dist/src/utils/thoughtUtils.test.js +78 -0
- package/dist/src/utils/thoughtUtils.test.js.map +1 -0
- package/dist/src/utils/tool-utils.d.ts +19 -0
- package/dist/src/utils/tool-utils.js +58 -0
- package/dist/src/utils/tool-utils.js.map +1 -0
- package/dist/src/utils/tool-utils.test.d.ts +6 -0
- package/dist/src/utils/tool-utils.test.js +61 -0
- package/dist/src/utils/tool-utils.test.js.map +1 -0
- package/dist/src/utils/userAccountManager.d.ts +20 -0
- package/dist/src/utils/userAccountManager.js +114 -0
- package/dist/src/utils/userAccountManager.js.map +1 -0
- package/dist/src/utils/userAccountManager.test.d.ts +6 -0
- package/dist/src/utils/{user_account.test.js → userAccountManager.test.js} +33 -30
- package/dist/src/utils/userAccountManager.test.js.map +1 -0
- package/dist/src/utils/workspaceContext.js +13 -7
- package/dist/src/utils/workspaceContext.js.map +1 -1
- package/dist/src/utils/workspaceContext.test.js +41 -16
- package/dist/src/utils/workspaceContext.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -9
- package/dist/src/core/modelCheck.d.ts +0 -14
- package/dist/src/core/modelCheck.js +0 -62
- package/dist/src/core/modelCheck.js.map +0 -1
- package/dist/src/test-utils/tools.d.ts +0 -44
- package/dist/src/test-utils/tools.js.map +0 -1
- package/dist/src/utils/flashFallback.integration.test.js.map +0 -1
- package/dist/src/utils/user_account.d.ts +0 -9
- package/dist/src/utils/user_account.js +0 -109
- package/dist/src/utils/user_account.js.map +0 -1
- package/dist/src/utils/user_account.test.js.map +0 -1
- package/dist/src/utils/user_id.d.ts +0 -11
- package/dist/src/utils/user_id.js +0 -49
- package/dist/src/utils/user_id.js.map +0 -1
- package/dist/src/utils/user_id.test.js +0 -21
- package/dist/src/utils/user_id.test.js.map +0 -1
- /package/dist/src/{utils/flashFallback.integration.test.d.ts → agents/executor.test.d.ts} +0 -0
- /package/dist/src/{utils/user_account.test.d.ts → agents/invocation.test.d.ts} +0 -0
- /package/dist/src/{utils/user_id.test.d.ts → agents/registry.test.d.ts} +0 -0
|
@@ -4,18 +4,22 @@
|
|
|
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
9
|
import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
|
|
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';
|
|
10
|
+
import { 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, } from './constants.js';
|
|
11
|
+
import { logApiRequest, logApiResponse, logCliConfiguration, logUserPrompt, logToolCall, logFlashFallback, logChatCompression, logMalformedJsonResponse, logFileOperation, logRipgrepFallback, logToolOutputTruncated, logModelRouting, logExtensionEnable, logExtensionDisable, logExtensionInstallEvent, logExtensionUninstall, } from './loggers.js';
|
|
11
12
|
import { ToolCallDecision } from './tool-call-decision.js';
|
|
12
|
-
import { ApiRequestEvent, ApiResponseEvent, StartSessionEvent, ToolCallEvent, UserPromptEvent, FlashFallbackEvent, makeChatCompressionEvent, } from './types.js';
|
|
13
|
+
import { ApiRequestEvent, ApiResponseEvent, StartSessionEvent, ToolCallEvent, UserPromptEvent, FlashFallbackEvent, RipgrepFallbackEvent, MalformedJsonResponseEvent, makeChatCompressionEvent, FileOperationEvent, ToolOutputTruncatedEvent, ModelRoutingEvent, ExtensionEnableEvent, ExtensionDisableEvent, ExtensionInstallEvent, ExtensionUninstallEvent, } from './types.js';
|
|
13
14
|
import * as metrics from './metrics.js';
|
|
15
|
+
import { FileOperation } from './metrics.js';
|
|
14
16
|
import * as sdk from './sdk.js';
|
|
15
|
-
import { vi, describe, beforeEach, it, expect } from 'vitest';
|
|
17
|
+
import { vi, describe, beforeEach, it, expect, afterEach } from 'vitest';
|
|
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';
|
|
19
23
|
describe('loggers', () => {
|
|
20
24
|
const mockLogger = {
|
|
21
25
|
emit: vi.fn(),
|
|
@@ -24,9 +28,11 @@ describe('loggers', () => {
|
|
|
24
28
|
addEvent: vi.fn(),
|
|
25
29
|
};
|
|
26
30
|
beforeEach(() => {
|
|
31
|
+
vi.clearAllMocks();
|
|
27
32
|
vi.spyOn(sdk, 'isTelemetrySdkInitialized').mockReturnValue(true);
|
|
28
33
|
vi.spyOn(logs, 'getLogger').mockReturnValue(mockLogger);
|
|
29
34
|
vi.spyOn(uiTelemetry.uiTelemetryService, 'addEvent').mockImplementation(mockUiEvent.addEvent);
|
|
35
|
+
vi.spyOn(UserAccountManager.prototype, 'getCachedGoogleAccount').mockReturnValue('test-user@example.com');
|
|
30
36
|
vi.useFakeTimers();
|
|
31
37
|
vi.setSystemTime(new Date('2025-01-01T00:00:00.000Z'));
|
|
32
38
|
});
|
|
@@ -81,6 +87,7 @@ describe('loggers', () => {
|
|
|
81
87
|
getQuestion: () => 'test-question',
|
|
82
88
|
getTargetDir: () => 'target-dir',
|
|
83
89
|
getProxy: () => 'http://test.proxy.com:8080',
|
|
90
|
+
getOutputFormat: () => OutputFormat.JSON,
|
|
84
91
|
};
|
|
85
92
|
const startSessionEvent = new StartSessionEvent(mockConfig);
|
|
86
93
|
logCliConfiguration(mockConfig, startSessionEvent);
|
|
@@ -88,6 +95,7 @@ describe('loggers', () => {
|
|
|
88
95
|
body: 'CLI configuration loaded.',
|
|
89
96
|
attributes: {
|
|
90
97
|
'session.id': 'test-session-id',
|
|
98
|
+
'user.email': 'test-user@example.com',
|
|
91
99
|
'event.name': EVENT_CLI_CONFIG,
|
|
92
100
|
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
93
101
|
model: 'test-model',
|
|
@@ -101,6 +109,10 @@ describe('loggers', () => {
|
|
|
101
109
|
file_filtering_respect_git_ignore: true,
|
|
102
110
|
debug_mode: true,
|
|
103
111
|
mcp_servers: 'test-server',
|
|
112
|
+
mcp_servers_count: 1,
|
|
113
|
+
mcp_tools: undefined,
|
|
114
|
+
mcp_tools_count: undefined,
|
|
115
|
+
output_format: 'json',
|
|
104
116
|
},
|
|
105
117
|
});
|
|
106
118
|
});
|
|
@@ -119,10 +131,13 @@ describe('loggers', () => {
|
|
|
119
131
|
body: 'User prompt. Length: 11.',
|
|
120
132
|
attributes: {
|
|
121
133
|
'session.id': 'test-session-id',
|
|
134
|
+
'user.email': 'test-user@example.com',
|
|
122
135
|
'event.name': EVENT_USER_PROMPT,
|
|
123
136
|
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
124
137
|
prompt_length: 11,
|
|
125
138
|
prompt: 'test-prompt',
|
|
139
|
+
prompt_id: 'prompt-id-8',
|
|
140
|
+
auth_type: 'vertex-ai',
|
|
126
141
|
},
|
|
127
142
|
});
|
|
128
143
|
});
|
|
@@ -134,15 +149,18 @@ describe('loggers', () => {
|
|
|
134
149
|
getTargetDir: () => 'target-dir',
|
|
135
150
|
getUsageStatisticsEnabled: () => true,
|
|
136
151
|
};
|
|
137
|
-
const event = new UserPromptEvent(11, '
|
|
152
|
+
const event = new UserPromptEvent(11, 'prompt-id-9', AuthType.CLOUD_SHELL, 'test-prompt');
|
|
138
153
|
logUserPrompt(mockConfig, event);
|
|
139
154
|
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
140
155
|
body: 'User prompt. Length: 11.',
|
|
141
156
|
attributes: {
|
|
142
157
|
'session.id': 'test-session-id',
|
|
158
|
+
'user.email': 'test-user@example.com',
|
|
143
159
|
'event.name': EVENT_USER_PROMPT,
|
|
144
160
|
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
145
161
|
prompt_length: 11,
|
|
162
|
+
prompt_id: 'prompt-id-9',
|
|
163
|
+
auth_type: 'cloud-shell',
|
|
146
164
|
},
|
|
147
165
|
});
|
|
148
166
|
});
|
|
@@ -177,6 +195,7 @@ describe('loggers', () => {
|
|
|
177
195
|
body: 'API response from test-model. Status: 200. Duration: 100ms.',
|
|
178
196
|
attributes: {
|
|
179
197
|
'session.id': 'test-session-id',
|
|
198
|
+
'user.email': 'test-user@example.com',
|
|
180
199
|
'event.name': EVENT_API_RESPONSE,
|
|
181
200
|
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
182
201
|
[SemanticAttributes.HTTP_STATUS_CODE]: 200,
|
|
@@ -194,34 +213,8 @@ describe('loggers', () => {
|
|
|
194
213
|
auth_type: 'oauth-personal',
|
|
195
214
|
},
|
|
196
215
|
});
|
|
197
|
-
expect(mockMetrics.recordApiResponseMetrics).toHaveBeenCalledWith(mockConfig, 'test-model',
|
|
198
|
-
expect(mockMetrics.recordTokenUsageMetrics).toHaveBeenCalledWith(mockConfig, 'test-model',
|
|
199
|
-
expect(mockUiEvent.addEvent).toHaveBeenCalledWith({
|
|
200
|
-
...event,
|
|
201
|
-
'event.name': EVENT_API_RESPONSE,
|
|
202
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
203
|
-
});
|
|
204
|
-
});
|
|
205
|
-
it('should log an API response with an error', () => {
|
|
206
|
-
const usageData = {
|
|
207
|
-
promptTokenCount: 17,
|
|
208
|
-
candidatesTokenCount: 50,
|
|
209
|
-
cachedContentTokenCount: 10,
|
|
210
|
-
thoughtsTokenCount: 5,
|
|
211
|
-
toolUsePromptTokenCount: 2,
|
|
212
|
-
};
|
|
213
|
-
const event = new ApiResponseEvent('test-model', 100, 'prompt-id-1', AuthType.USE_GEMINI, usageData, 'test-response', 'test-error');
|
|
214
|
-
logApiResponse(mockConfig, event);
|
|
215
|
-
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
216
|
-
body: 'API response from test-model. Status: 200. Duration: 100ms.',
|
|
217
|
-
attributes: {
|
|
218
|
-
'session.id': 'test-session-id',
|
|
219
|
-
...event,
|
|
220
|
-
'event.name': EVENT_API_RESPONSE,
|
|
221
|
-
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
222
|
-
'error.message': 'test-error',
|
|
223
|
-
},
|
|
224
|
-
});
|
|
216
|
+
expect(mockMetrics.recordApiResponseMetrics).toHaveBeenCalledWith(mockConfig, 100, { model: 'test-model', status_code: 200 });
|
|
217
|
+
expect(mockMetrics.recordTokenUsageMetrics).toHaveBeenCalledWith(mockConfig, 50, { model: 'test-model', type: 'output' });
|
|
225
218
|
expect(mockUiEvent.addEvent).toHaveBeenCalledWith({
|
|
226
219
|
...event,
|
|
227
220
|
'event.name': EVENT_API_RESPONSE,
|
|
@@ -244,6 +237,7 @@ describe('loggers', () => {
|
|
|
244
237
|
body: 'API request to test-model.',
|
|
245
238
|
attributes: {
|
|
246
239
|
'session.id': 'test-session-id',
|
|
240
|
+
'user.email': 'test-user@example.com',
|
|
247
241
|
'event.name': EVENT_API_REQUEST,
|
|
248
242
|
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
249
243
|
model: 'test-model',
|
|
@@ -259,6 +253,7 @@ describe('loggers', () => {
|
|
|
259
253
|
body: 'API request to test-model.',
|
|
260
254
|
attributes: {
|
|
261
255
|
'session.id': 'test-session-id',
|
|
256
|
+
'user.email': 'test-user@example.com',
|
|
262
257
|
'event.name': EVENT_API_REQUEST,
|
|
263
258
|
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
264
259
|
model: 'test-model',
|
|
@@ -279,6 +274,7 @@ describe('loggers', () => {
|
|
|
279
274
|
body: 'Switching to flash as Fallback.',
|
|
280
275
|
attributes: {
|
|
281
276
|
'session.id': 'test-session-id',
|
|
277
|
+
'user.email': 'test-user@example.com',
|
|
282
278
|
'event.name': EVENT_FLASH_FALLBACK,
|
|
283
279
|
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
284
280
|
auth_type: 'vertex-ai',
|
|
@@ -286,6 +282,41 @@ describe('loggers', () => {
|
|
|
286
282
|
});
|
|
287
283
|
});
|
|
288
284
|
});
|
|
285
|
+
describe('logRipgrepFallback', () => {
|
|
286
|
+
const mockConfig = {
|
|
287
|
+
getSessionId: () => 'test-session-id',
|
|
288
|
+
getUsageStatisticsEnabled: () => true,
|
|
289
|
+
};
|
|
290
|
+
beforeEach(() => {
|
|
291
|
+
vi.spyOn(ClearcutLogger.prototype, 'logRipgrepFallbackEvent');
|
|
292
|
+
});
|
|
293
|
+
it('should log ripgrep fallback event', () => {
|
|
294
|
+
const event = new RipgrepFallbackEvent();
|
|
295
|
+
logRipgrepFallback(mockConfig, event);
|
|
296
|
+
expect(ClearcutLogger.prototype.logRipgrepFallbackEvent).toHaveBeenCalled();
|
|
297
|
+
const emittedEvent = mockLogger.emit.mock.calls[0][0];
|
|
298
|
+
expect(emittedEvent.body).toBe('Switching to grep as fallback.');
|
|
299
|
+
expect(emittedEvent.attributes).toEqual(expect.objectContaining({
|
|
300
|
+
'session.id': 'test-session-id',
|
|
301
|
+
'user.email': 'test-user@example.com',
|
|
302
|
+
'event.name': EVENT_RIPGREP_FALLBACK,
|
|
303
|
+
error: undefined,
|
|
304
|
+
}));
|
|
305
|
+
});
|
|
306
|
+
it('should log ripgrep fallback event with an error', () => {
|
|
307
|
+
const event = new RipgrepFallbackEvent('rg not found');
|
|
308
|
+
logRipgrepFallback(mockConfig, event);
|
|
309
|
+
expect(ClearcutLogger.prototype.logRipgrepFallbackEvent).toHaveBeenCalled();
|
|
310
|
+
const emittedEvent = mockLogger.emit.mock.calls[0][0];
|
|
311
|
+
expect(emittedEvent.body).toBe('Switching to grep as fallback.');
|
|
312
|
+
expect(emittedEvent.attributes).toEqual(expect.objectContaining({
|
|
313
|
+
'session.id': 'test-session-id',
|
|
314
|
+
'user.email': 'test-user@example.com',
|
|
315
|
+
'event.name': EVENT_RIPGREP_FALLBACK,
|
|
316
|
+
error: 'rg not found',
|
|
317
|
+
}));
|
|
318
|
+
});
|
|
319
|
+
});
|
|
289
320
|
describe('logToolCall', () => {
|
|
290
321
|
const cfg1 = {
|
|
291
322
|
getSessionId: () => 'test-session-id',
|
|
@@ -349,10 +380,26 @@ describe('loggers', () => {
|
|
|
349
380
|
},
|
|
350
381
|
response: {
|
|
351
382
|
callId: 'test-call-id',
|
|
352
|
-
responseParts: 'test-response',
|
|
353
|
-
resultDisplay:
|
|
383
|
+
responseParts: [{ text: 'test-response' }],
|
|
384
|
+
resultDisplay: {
|
|
385
|
+
fileDiff: 'diff',
|
|
386
|
+
fileName: 'file.txt',
|
|
387
|
+
originalContent: 'old content',
|
|
388
|
+
newContent: 'new content',
|
|
389
|
+
diffStat: {
|
|
390
|
+
model_added_lines: 1,
|
|
391
|
+
model_removed_lines: 2,
|
|
392
|
+
model_added_chars: 3,
|
|
393
|
+
model_removed_chars: 4,
|
|
394
|
+
user_added_lines: 5,
|
|
395
|
+
user_removed_lines: 6,
|
|
396
|
+
user_added_chars: 7,
|
|
397
|
+
user_removed_chars: 8,
|
|
398
|
+
},
|
|
399
|
+
},
|
|
354
400
|
error: undefined,
|
|
355
401
|
errorType: undefined,
|
|
402
|
+
contentLength: 13,
|
|
356
403
|
},
|
|
357
404
|
tool,
|
|
358
405
|
invocation: {},
|
|
@@ -365,6 +412,7 @@ describe('loggers', () => {
|
|
|
365
412
|
body: 'Tool call: test-function. Decision: accept. Success: true. Duration: 100ms.',
|
|
366
413
|
attributes: {
|
|
367
414
|
'session.id': 'test-session-id',
|
|
415
|
+
'user.email': 'test-user@example.com',
|
|
368
416
|
'event.name': EVENT_TOOL_CALL,
|
|
369
417
|
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
370
418
|
function_name: 'test-function',
|
|
@@ -377,9 +425,27 @@ describe('loggers', () => {
|
|
|
377
425
|
decision: ToolCallDecision.ACCEPT,
|
|
378
426
|
prompt_id: 'prompt-id-1',
|
|
379
427
|
tool_type: 'native',
|
|
428
|
+
error: undefined,
|
|
429
|
+
error_type: undefined,
|
|
430
|
+
metadata: {
|
|
431
|
+
model_added_lines: 1,
|
|
432
|
+
model_removed_lines: 2,
|
|
433
|
+
model_added_chars: 3,
|
|
434
|
+
model_removed_chars: 4,
|
|
435
|
+
user_added_lines: 5,
|
|
436
|
+
user_removed_lines: 6,
|
|
437
|
+
user_added_chars: 7,
|
|
438
|
+
user_removed_chars: 8,
|
|
439
|
+
},
|
|
440
|
+
content_length: 13,
|
|
380
441
|
},
|
|
381
442
|
});
|
|
382
|
-
expect(mockMetrics.recordToolCallMetrics).toHaveBeenCalledWith(mockConfig,
|
|
443
|
+
expect(mockMetrics.recordToolCallMetrics).toHaveBeenCalledWith(mockConfig, 100, {
|
|
444
|
+
function_name: 'test-function',
|
|
445
|
+
success: true,
|
|
446
|
+
decision: ToolCallDecision.ACCEPT,
|
|
447
|
+
tool_type: 'native',
|
|
448
|
+
});
|
|
383
449
|
expect(mockUiEvent.addEvent).toHaveBeenCalledWith({
|
|
384
450
|
...event,
|
|
385
451
|
'event.name': EVENT_TOOL_CALL,
|
|
@@ -401,10 +467,11 @@ describe('loggers', () => {
|
|
|
401
467
|
},
|
|
402
468
|
response: {
|
|
403
469
|
callId: 'test-call-id',
|
|
404
|
-
responseParts: 'test-response',
|
|
470
|
+
responseParts: [{ text: 'test-response' }],
|
|
405
471
|
resultDisplay: undefined,
|
|
406
472
|
error: undefined,
|
|
407
473
|
errorType: undefined,
|
|
474
|
+
contentLength: undefined,
|
|
408
475
|
},
|
|
409
476
|
durationMs: 100,
|
|
410
477
|
outcome: ToolConfirmationOutcome.Cancel,
|
|
@@ -415,6 +482,7 @@ describe('loggers', () => {
|
|
|
415
482
|
body: 'Tool call: test-function. Decision: reject. Success: false. Duration: 100ms.',
|
|
416
483
|
attributes: {
|
|
417
484
|
'session.id': 'test-session-id',
|
|
485
|
+
'user.email': 'test-user@example.com',
|
|
418
486
|
'event.name': EVENT_TOOL_CALL,
|
|
419
487
|
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
420
488
|
function_name: 'test-function',
|
|
@@ -427,9 +495,18 @@ describe('loggers', () => {
|
|
|
427
495
|
decision: ToolCallDecision.REJECT,
|
|
428
496
|
prompt_id: 'prompt-id-2',
|
|
429
497
|
tool_type: 'native',
|
|
498
|
+
error: undefined,
|
|
499
|
+
error_type: undefined,
|
|
500
|
+
metadata: undefined,
|
|
501
|
+
content_length: undefined,
|
|
430
502
|
},
|
|
431
503
|
});
|
|
432
|
-
expect(mockMetrics.recordToolCallMetrics).toHaveBeenCalledWith(mockConfig,
|
|
504
|
+
expect(mockMetrics.recordToolCallMetrics).toHaveBeenCalledWith(mockConfig, 100, {
|
|
505
|
+
function_name: 'test-function',
|
|
506
|
+
success: false,
|
|
507
|
+
decision: ToolCallDecision.REJECT,
|
|
508
|
+
tool_type: 'native',
|
|
509
|
+
});
|
|
433
510
|
expect(mockUiEvent.addEvent).toHaveBeenCalledWith({
|
|
434
511
|
...event,
|
|
435
512
|
'event.name': EVENT_TOOL_CALL,
|
|
@@ -451,10 +528,11 @@ describe('loggers', () => {
|
|
|
451
528
|
},
|
|
452
529
|
response: {
|
|
453
530
|
callId: 'test-call-id',
|
|
454
|
-
responseParts: 'test-response',
|
|
531
|
+
responseParts: [{ text: 'test-response' }],
|
|
455
532
|
resultDisplay: undefined,
|
|
456
533
|
error: undefined,
|
|
457
534
|
errorType: undefined,
|
|
535
|
+
contentLength: 13,
|
|
458
536
|
},
|
|
459
537
|
outcome: ToolConfirmationOutcome.ModifyWithEditor,
|
|
460
538
|
tool: new EditTool(mockConfig),
|
|
@@ -467,6 +545,7 @@ describe('loggers', () => {
|
|
|
467
545
|
body: 'Tool call: test-function. Decision: modify. Success: true. Duration: 100ms.',
|
|
468
546
|
attributes: {
|
|
469
547
|
'session.id': 'test-session-id',
|
|
548
|
+
'user.email': 'test-user@example.com',
|
|
470
549
|
'event.name': EVENT_TOOL_CALL,
|
|
471
550
|
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
472
551
|
function_name: 'test-function',
|
|
@@ -479,9 +558,18 @@ describe('loggers', () => {
|
|
|
479
558
|
decision: ToolCallDecision.MODIFY,
|
|
480
559
|
prompt_id: 'prompt-id-3',
|
|
481
560
|
tool_type: 'native',
|
|
561
|
+
error: undefined,
|
|
562
|
+
error_type: undefined,
|
|
563
|
+
metadata: undefined,
|
|
564
|
+
content_length: 13,
|
|
482
565
|
},
|
|
483
566
|
});
|
|
484
|
-
expect(mockMetrics.recordToolCallMetrics).toHaveBeenCalledWith(mockConfig,
|
|
567
|
+
expect(mockMetrics.recordToolCallMetrics).toHaveBeenCalledWith(mockConfig, 100, {
|
|
568
|
+
function_name: 'test-function',
|
|
569
|
+
success: true,
|
|
570
|
+
decision: ToolCallDecision.MODIFY,
|
|
571
|
+
tool_type: 'native',
|
|
572
|
+
});
|
|
485
573
|
expect(mockUiEvent.addEvent).toHaveBeenCalledWith({
|
|
486
574
|
...event,
|
|
487
575
|
'event.name': EVENT_TOOL_CALL,
|
|
@@ -503,10 +591,11 @@ describe('loggers', () => {
|
|
|
503
591
|
},
|
|
504
592
|
response: {
|
|
505
593
|
callId: 'test-call-id',
|
|
506
|
-
responseParts: 'test-response',
|
|
594
|
+
responseParts: [{ text: 'test-response' }],
|
|
507
595
|
resultDisplay: undefined,
|
|
508
596
|
error: undefined,
|
|
509
597
|
errorType: undefined,
|
|
598
|
+
contentLength: 13,
|
|
510
599
|
},
|
|
511
600
|
tool: new EditTool(mockConfig),
|
|
512
601
|
invocation: {},
|
|
@@ -518,6 +607,7 @@ describe('loggers', () => {
|
|
|
518
607
|
body: 'Tool call: test-function. Success: true. Duration: 100ms.',
|
|
519
608
|
attributes: {
|
|
520
609
|
'session.id': 'test-session-id',
|
|
610
|
+
'user.email': 'test-user@example.com',
|
|
521
611
|
'event.name': EVENT_TOOL_CALL,
|
|
522
612
|
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
523
613
|
function_name: 'test-function',
|
|
@@ -529,9 +619,19 @@ describe('loggers', () => {
|
|
|
529
619
|
success: true,
|
|
530
620
|
prompt_id: 'prompt-id-4',
|
|
531
621
|
tool_type: 'native',
|
|
622
|
+
decision: undefined,
|
|
623
|
+
error: undefined,
|
|
624
|
+
error_type: undefined,
|
|
625
|
+
metadata: undefined,
|
|
626
|
+
content_length: 13,
|
|
532
627
|
},
|
|
533
628
|
});
|
|
534
|
-
expect(mockMetrics.recordToolCallMetrics).toHaveBeenCalledWith(mockConfig,
|
|
629
|
+
expect(mockMetrics.recordToolCallMetrics).toHaveBeenCalledWith(mockConfig, 100, {
|
|
630
|
+
function_name: 'test-function',
|
|
631
|
+
success: true,
|
|
632
|
+
decision: undefined,
|
|
633
|
+
tool_type: 'native',
|
|
634
|
+
});
|
|
535
635
|
expect(mockUiEvent.addEvent).toHaveBeenCalledWith({
|
|
536
636
|
...event,
|
|
537
637
|
'event.name': EVENT_TOOL_CALL,
|
|
@@ -539,6 +639,7 @@ describe('loggers', () => {
|
|
|
539
639
|
});
|
|
540
640
|
});
|
|
541
641
|
it('should log a failed tool call with an error', () => {
|
|
642
|
+
const errorMessage = 'test-error';
|
|
542
643
|
const call = {
|
|
543
644
|
status: 'error',
|
|
544
645
|
request: {
|
|
@@ -553,13 +654,11 @@ describe('loggers', () => {
|
|
|
553
654
|
},
|
|
554
655
|
response: {
|
|
555
656
|
callId: 'test-call-id',
|
|
556
|
-
responseParts: 'test-response',
|
|
657
|
+
responseParts: [{ text: 'test-response' }],
|
|
557
658
|
resultDisplay: undefined,
|
|
558
|
-
error:
|
|
559
|
-
name: 'test-error-type',
|
|
560
|
-
message: 'test-error',
|
|
561
|
-
},
|
|
659
|
+
error: new Error(errorMessage),
|
|
562
660
|
errorType: ToolErrorType.UNKNOWN,
|
|
661
|
+
contentLength: errorMessage.length,
|
|
563
662
|
},
|
|
564
663
|
durationMs: 100,
|
|
565
664
|
};
|
|
@@ -569,6 +668,7 @@ describe('loggers', () => {
|
|
|
569
668
|
body: 'Tool call: test-function. Success: false. Duration: 100ms.',
|
|
570
669
|
attributes: {
|
|
571
670
|
'session.id': 'test-session-id',
|
|
671
|
+
'user.email': 'test-user@example.com',
|
|
572
672
|
'event.name': EVENT_TOOL_CALL,
|
|
573
673
|
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
574
674
|
function_name: 'test-function',
|
|
@@ -584,15 +684,319 @@ describe('loggers', () => {
|
|
|
584
684
|
'error.type': ToolErrorType.UNKNOWN,
|
|
585
685
|
prompt_id: 'prompt-id-5',
|
|
586
686
|
tool_type: 'native',
|
|
687
|
+
decision: undefined,
|
|
688
|
+
metadata: undefined,
|
|
689
|
+
content_length: errorMessage.length,
|
|
587
690
|
},
|
|
588
691
|
});
|
|
589
|
-
expect(mockMetrics.recordToolCallMetrics).toHaveBeenCalledWith(mockConfig,
|
|
692
|
+
expect(mockMetrics.recordToolCallMetrics).toHaveBeenCalledWith(mockConfig, 100, {
|
|
693
|
+
function_name: 'test-function',
|
|
694
|
+
success: false,
|
|
695
|
+
decision: undefined,
|
|
696
|
+
tool_type: 'native',
|
|
697
|
+
});
|
|
590
698
|
expect(mockUiEvent.addEvent).toHaveBeenCalledWith({
|
|
591
699
|
...event,
|
|
592
700
|
'event.name': EVENT_TOOL_CALL,
|
|
593
701
|
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
594
702
|
});
|
|
595
703
|
});
|
|
704
|
+
it('should log a tool call with mcp_server_name for MCP tools', () => {
|
|
705
|
+
const mockMcpTool = new DiscoveredMCPTool({}, 'mock_mcp_server', 'mock_mcp_tool', 'tool description', {
|
|
706
|
+
type: 'object',
|
|
707
|
+
properties: {
|
|
708
|
+
arg1: { type: 'string' },
|
|
709
|
+
arg2: { type: 'number' },
|
|
710
|
+
},
|
|
711
|
+
required: ['arg1', 'arg2'],
|
|
712
|
+
});
|
|
713
|
+
const call = {
|
|
714
|
+
status: 'success',
|
|
715
|
+
request: {
|
|
716
|
+
name: 'mock_mcp_tool',
|
|
717
|
+
args: { arg1: 'value1', arg2: 2 },
|
|
718
|
+
callId: 'test-call-id',
|
|
719
|
+
isClientInitiated: true,
|
|
720
|
+
prompt_id: 'prompt-id',
|
|
721
|
+
},
|
|
722
|
+
response: {
|
|
723
|
+
callId: 'test-call-id',
|
|
724
|
+
responseParts: [{ text: 'test-response' }],
|
|
725
|
+
resultDisplay: undefined,
|
|
726
|
+
error: undefined,
|
|
727
|
+
errorType: undefined,
|
|
728
|
+
},
|
|
729
|
+
tool: mockMcpTool,
|
|
730
|
+
invocation: {},
|
|
731
|
+
durationMs: 100,
|
|
732
|
+
};
|
|
733
|
+
const event = new ToolCallEvent(call);
|
|
734
|
+
logToolCall(mockConfig, event);
|
|
735
|
+
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
736
|
+
body: 'Tool call: mock_mcp_tool. Success: true. Duration: 100ms.',
|
|
737
|
+
attributes: {
|
|
738
|
+
'session.id': 'test-session-id',
|
|
739
|
+
'user.email': 'test-user@example.com',
|
|
740
|
+
'event.name': EVENT_TOOL_CALL,
|
|
741
|
+
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
742
|
+
function_name: 'mock_mcp_tool',
|
|
743
|
+
function_args: JSON.stringify({
|
|
744
|
+
arg1: 'value1',
|
|
745
|
+
arg2: 2,
|
|
746
|
+
}, null, 2),
|
|
747
|
+
duration_ms: 100,
|
|
748
|
+
success: true,
|
|
749
|
+
prompt_id: 'prompt-id',
|
|
750
|
+
tool_type: 'mcp',
|
|
751
|
+
mcp_server_name: 'mock_mcp_server',
|
|
752
|
+
decision: undefined,
|
|
753
|
+
error: undefined,
|
|
754
|
+
error_type: undefined,
|
|
755
|
+
metadata: undefined,
|
|
756
|
+
},
|
|
757
|
+
});
|
|
758
|
+
});
|
|
759
|
+
});
|
|
760
|
+
describe('logMalformedJsonResponse', () => {
|
|
761
|
+
beforeEach(() => {
|
|
762
|
+
vi.spyOn(ClearcutLogger.prototype, 'logMalformedJsonResponseEvent');
|
|
763
|
+
});
|
|
764
|
+
it('logs the event to Clearcut and OTEL', () => {
|
|
765
|
+
const mockConfig = makeFakeConfig();
|
|
766
|
+
const event = new MalformedJsonResponseEvent('test-model');
|
|
767
|
+
logMalformedJsonResponse(mockConfig, event);
|
|
768
|
+
expect(ClearcutLogger.prototype.logMalformedJsonResponseEvent).toHaveBeenCalledWith(event);
|
|
769
|
+
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
770
|
+
body: 'Malformed JSON response from test-model.',
|
|
771
|
+
attributes: {
|
|
772
|
+
'session.id': 'test-session-id',
|
|
773
|
+
'user.email': 'test-user@example.com',
|
|
774
|
+
'event.name': EVENT_MALFORMED_JSON_RESPONSE,
|
|
775
|
+
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
776
|
+
model: 'test-model',
|
|
777
|
+
},
|
|
778
|
+
});
|
|
779
|
+
});
|
|
780
|
+
});
|
|
781
|
+
describe('logFileOperation', () => {
|
|
782
|
+
const mockConfig = {
|
|
783
|
+
getSessionId: () => 'test-session-id',
|
|
784
|
+
getTargetDir: () => 'target-dir',
|
|
785
|
+
getUsageStatisticsEnabled: () => true,
|
|
786
|
+
getTelemetryEnabled: () => true,
|
|
787
|
+
getTelemetryLogPromptsEnabled: () => true,
|
|
788
|
+
};
|
|
789
|
+
const mockMetrics = {
|
|
790
|
+
recordFileOperationMetric: vi.fn(),
|
|
791
|
+
};
|
|
792
|
+
beforeEach(() => {
|
|
793
|
+
vi.spyOn(metrics, 'recordFileOperationMetric').mockImplementation(mockMetrics.recordFileOperationMetric);
|
|
794
|
+
});
|
|
795
|
+
it('should log a file operation event', () => {
|
|
796
|
+
const event = new FileOperationEvent('test-tool', FileOperation.READ, 10, 'text/plain', '.txt', 'typescript');
|
|
797
|
+
logFileOperation(mockConfig, event);
|
|
798
|
+
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
799
|
+
body: 'File operation: read. Lines: 10.',
|
|
800
|
+
attributes: {
|
|
801
|
+
'session.id': 'test-session-id',
|
|
802
|
+
'user.email': 'test-user@example.com',
|
|
803
|
+
'event.name': EVENT_FILE_OPERATION,
|
|
804
|
+
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
805
|
+
tool_name: 'test-tool',
|
|
806
|
+
operation: 'read',
|
|
807
|
+
lines: 10,
|
|
808
|
+
mimetype: 'text/plain',
|
|
809
|
+
extension: '.txt',
|
|
810
|
+
programming_language: 'typescript',
|
|
811
|
+
},
|
|
812
|
+
});
|
|
813
|
+
expect(mockMetrics.recordFileOperationMetric).toHaveBeenCalledWith(mockConfig, {
|
|
814
|
+
operation: 'read',
|
|
815
|
+
lines: 10,
|
|
816
|
+
mimetype: 'text/plain',
|
|
817
|
+
extension: '.txt',
|
|
818
|
+
programming_language: 'typescript',
|
|
819
|
+
});
|
|
820
|
+
});
|
|
821
|
+
});
|
|
822
|
+
describe('logToolOutputTruncated', () => {
|
|
823
|
+
const mockConfig = {
|
|
824
|
+
getSessionId: () => 'test-session-id',
|
|
825
|
+
getUsageStatisticsEnabled: () => true,
|
|
826
|
+
};
|
|
827
|
+
it('should log a tool output truncated event', () => {
|
|
828
|
+
const event = new ToolOutputTruncatedEvent('prompt-id-1', {
|
|
829
|
+
toolName: 'test-tool',
|
|
830
|
+
originalContentLength: 1000,
|
|
831
|
+
truncatedContentLength: 100,
|
|
832
|
+
threshold: 500,
|
|
833
|
+
lines: 10,
|
|
834
|
+
});
|
|
835
|
+
logToolOutputTruncated(mockConfig, event);
|
|
836
|
+
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
837
|
+
body: 'Tool output truncated for test-tool.',
|
|
838
|
+
attributes: {
|
|
839
|
+
'session.id': 'test-session-id',
|
|
840
|
+
'user.email': 'test-user@example.com',
|
|
841
|
+
'event.name': 'tool_output_truncated',
|
|
842
|
+
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
843
|
+
eventName: 'tool_output_truncated',
|
|
844
|
+
prompt_id: 'prompt-id-1',
|
|
845
|
+
tool_name: 'test-tool',
|
|
846
|
+
original_content_length: 1000,
|
|
847
|
+
truncated_content_length: 100,
|
|
848
|
+
threshold: 500,
|
|
849
|
+
lines: 10,
|
|
850
|
+
},
|
|
851
|
+
});
|
|
852
|
+
});
|
|
853
|
+
});
|
|
854
|
+
describe('logModelRouting', () => {
|
|
855
|
+
const mockConfig = {
|
|
856
|
+
getSessionId: () => 'test-session-id',
|
|
857
|
+
getUsageStatisticsEnabled: () => true,
|
|
858
|
+
};
|
|
859
|
+
beforeEach(() => {
|
|
860
|
+
vi.spyOn(ClearcutLogger.prototype, 'logModelRoutingEvent');
|
|
861
|
+
vi.spyOn(metrics, 'recordModelRoutingMetrics');
|
|
862
|
+
});
|
|
863
|
+
it('should log the event to Clearcut and OTEL, and record metrics', () => {
|
|
864
|
+
const event = new ModelRoutingEvent('gemini-pro', 'default', 100, 'test-reason', false, undefined);
|
|
865
|
+
logModelRouting(mockConfig, event);
|
|
866
|
+
expect(ClearcutLogger.prototype.logModelRoutingEvent).toHaveBeenCalledWith(event);
|
|
867
|
+
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
868
|
+
body: 'Model routing decision. Model: gemini-pro, Source: default',
|
|
869
|
+
attributes: {
|
|
870
|
+
'session.id': 'test-session-id',
|
|
871
|
+
'user.email': 'test-user@example.com',
|
|
872
|
+
...event,
|
|
873
|
+
'event.name': EVENT_MODEL_ROUTING,
|
|
874
|
+
},
|
|
875
|
+
});
|
|
876
|
+
expect(metrics.recordModelRoutingMetrics).toHaveBeenCalledWith(mockConfig, event);
|
|
877
|
+
});
|
|
878
|
+
it('should only log to Clearcut if OTEL SDK is not initialized', () => {
|
|
879
|
+
vi.spyOn(sdk, 'isTelemetrySdkInitialized').mockReturnValue(false);
|
|
880
|
+
const event = new ModelRoutingEvent('gemini-pro', 'default', 100, 'test-reason', false, undefined);
|
|
881
|
+
logModelRouting(mockConfig, event);
|
|
882
|
+
expect(ClearcutLogger.prototype.logModelRoutingEvent).toHaveBeenCalledWith(event);
|
|
883
|
+
expect(mockLogger.emit).not.toHaveBeenCalled();
|
|
884
|
+
expect(metrics.recordModelRoutingMetrics).not.toHaveBeenCalled();
|
|
885
|
+
});
|
|
886
|
+
});
|
|
887
|
+
describe('logExtensionInstall', () => {
|
|
888
|
+
const mockConfig = {
|
|
889
|
+
getSessionId: () => 'test-session-id',
|
|
890
|
+
getUsageStatisticsEnabled: () => true,
|
|
891
|
+
};
|
|
892
|
+
beforeEach(() => {
|
|
893
|
+
vi.spyOn(ClearcutLogger.prototype, 'logExtensionInstallEvent');
|
|
894
|
+
});
|
|
895
|
+
afterEach(() => {
|
|
896
|
+
vi.resetAllMocks();
|
|
897
|
+
});
|
|
898
|
+
it('should log extension install event', () => {
|
|
899
|
+
const event = new ExtensionInstallEvent('vscode', '0.1.0', 'git', 'success');
|
|
900
|
+
logExtensionInstallEvent(mockConfig, event);
|
|
901
|
+
expect(ClearcutLogger.prototype.logExtensionInstallEvent).toHaveBeenCalledWith(event);
|
|
902
|
+
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
903
|
+
body: 'Installed extension vscode',
|
|
904
|
+
attributes: {
|
|
905
|
+
'session.id': 'test-session-id',
|
|
906
|
+
'user.email': 'test-user@example.com',
|
|
907
|
+
'event.name': EVENT_EXTENSION_INSTALL,
|
|
908
|
+
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
909
|
+
extension_name: 'vscode',
|
|
910
|
+
extension_version: '0.1.0',
|
|
911
|
+
extension_source: 'git',
|
|
912
|
+
status: 'success',
|
|
913
|
+
},
|
|
914
|
+
});
|
|
915
|
+
});
|
|
916
|
+
});
|
|
917
|
+
describe('logExtensionUninstall', () => {
|
|
918
|
+
const mockConfig = {
|
|
919
|
+
getSessionId: () => 'test-session-id',
|
|
920
|
+
getUsageStatisticsEnabled: () => true,
|
|
921
|
+
};
|
|
922
|
+
beforeEach(() => {
|
|
923
|
+
vi.spyOn(ClearcutLogger.prototype, 'logExtensionUninstallEvent');
|
|
924
|
+
});
|
|
925
|
+
afterEach(() => {
|
|
926
|
+
vi.resetAllMocks();
|
|
927
|
+
});
|
|
928
|
+
it('should log extension uninstall event', () => {
|
|
929
|
+
const event = new ExtensionUninstallEvent('vscode', 'success');
|
|
930
|
+
logExtensionUninstall(mockConfig, event);
|
|
931
|
+
expect(ClearcutLogger.prototype.logExtensionUninstallEvent).toHaveBeenCalledWith(event);
|
|
932
|
+
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
933
|
+
body: 'Uninstalled extension vscode',
|
|
934
|
+
attributes: {
|
|
935
|
+
'session.id': 'test-session-id',
|
|
936
|
+
'user.email': 'test-user@example.com',
|
|
937
|
+
'event.name': EVENT_EXTENSION_UNINSTALL,
|
|
938
|
+
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
939
|
+
extension_name: 'vscode',
|
|
940
|
+
status: 'success',
|
|
941
|
+
},
|
|
942
|
+
});
|
|
943
|
+
});
|
|
944
|
+
});
|
|
945
|
+
describe('logExtensionEnable', () => {
|
|
946
|
+
const mockConfig = {
|
|
947
|
+
getSessionId: () => 'test-session-id',
|
|
948
|
+
getUsageStatisticsEnabled: () => true,
|
|
949
|
+
};
|
|
950
|
+
beforeEach(() => {
|
|
951
|
+
vi.spyOn(ClearcutLogger.prototype, 'logExtensionEnableEvent');
|
|
952
|
+
});
|
|
953
|
+
afterEach(() => {
|
|
954
|
+
vi.resetAllMocks();
|
|
955
|
+
});
|
|
956
|
+
it('should log extension enable event', () => {
|
|
957
|
+
const event = new ExtensionEnableEvent('vscode', 'user');
|
|
958
|
+
logExtensionEnable(mockConfig, event);
|
|
959
|
+
expect(ClearcutLogger.prototype.logExtensionEnableEvent).toHaveBeenCalledWith(event);
|
|
960
|
+
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
961
|
+
body: 'Enabled extension vscode',
|
|
962
|
+
attributes: {
|
|
963
|
+
'session.id': 'test-session-id',
|
|
964
|
+
'user.email': 'test-user@example.com',
|
|
965
|
+
'event.name': EVENT_EXTENSION_ENABLE,
|
|
966
|
+
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
967
|
+
extension_name: 'vscode',
|
|
968
|
+
setting_scope: 'user',
|
|
969
|
+
},
|
|
970
|
+
});
|
|
971
|
+
});
|
|
972
|
+
});
|
|
973
|
+
describe('logExtensionDisable', () => {
|
|
974
|
+
const mockConfig = {
|
|
975
|
+
getSessionId: () => 'test-session-id',
|
|
976
|
+
getUsageStatisticsEnabled: () => true,
|
|
977
|
+
};
|
|
978
|
+
beforeEach(() => {
|
|
979
|
+
vi.spyOn(ClearcutLogger.prototype, 'logExtensionDisableEvent');
|
|
980
|
+
});
|
|
981
|
+
afterEach(() => {
|
|
982
|
+
vi.resetAllMocks();
|
|
983
|
+
});
|
|
984
|
+
it('should log extension disable event', () => {
|
|
985
|
+
const event = new ExtensionDisableEvent('vscode', 'user');
|
|
986
|
+
logExtensionDisable(mockConfig, event);
|
|
987
|
+
expect(ClearcutLogger.prototype.logExtensionDisableEvent).toHaveBeenCalledWith(event);
|
|
988
|
+
expect(mockLogger.emit).toHaveBeenCalledWith({
|
|
989
|
+
body: 'Disabled extension vscode',
|
|
990
|
+
attributes: {
|
|
991
|
+
'session.id': 'test-session-id',
|
|
992
|
+
'user.email': 'test-user@example.com',
|
|
993
|
+
'event.name': EVENT_EXTENSION_DISABLE,
|
|
994
|
+
'event.timestamp': '2025-01-01T00:00:00.000Z',
|
|
995
|
+
extension_name: 'vscode',
|
|
996
|
+
setting_scope: 'user',
|
|
997
|
+
},
|
|
998
|
+
});
|
|
999
|
+
});
|
|
596
1000
|
});
|
|
597
1001
|
});
|
|
598
1002
|
//# sourceMappingURL=loggers.test.js.map
|