@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,8 +4,9 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
7
|
-
import { FileOperation } from './metrics.js';
|
|
7
|
+
import { FileOperation, MemoryMetricType, ToolExecutionPhase, ApiRequestPhase, } from './metrics.js';
|
|
8
8
|
import { makeFakeConfig } from '../test-utils/config.js';
|
|
9
|
+
import { ModelRoutingEvent } from './types.js';
|
|
9
10
|
const mockCounterAddFn = vi.fn();
|
|
10
11
|
const mockHistogramRecordFn = vi.fn();
|
|
11
12
|
const mockCreateCounterFn = vi.fn();
|
|
@@ -27,9 +28,11 @@ function originalOtelMockFactory() {
|
|
|
27
28
|
},
|
|
28
29
|
ValueType: {
|
|
29
30
|
INT: 1,
|
|
31
|
+
DOUBLE: 2,
|
|
30
32
|
},
|
|
31
33
|
diag: {
|
|
32
34
|
setLogger: vi.fn(),
|
|
35
|
+
warn: vi.fn(),
|
|
33
36
|
},
|
|
34
37
|
};
|
|
35
38
|
}
|
|
@@ -39,6 +42,17 @@ describe('Telemetry Metrics', () => {
|
|
|
39
42
|
let recordTokenUsageMetricsModule;
|
|
40
43
|
let recordFileOperationMetricModule;
|
|
41
44
|
let recordChatCompressionMetricsModule;
|
|
45
|
+
let recordModelRoutingMetricsModule;
|
|
46
|
+
let recordStartupPerformanceModule;
|
|
47
|
+
let recordMemoryUsageModule;
|
|
48
|
+
let recordCpuUsageModule;
|
|
49
|
+
let recordToolQueueDepthModule;
|
|
50
|
+
let recordToolExecutionBreakdownModule;
|
|
51
|
+
let recordTokenEfficiencyModule;
|
|
52
|
+
let recordApiRequestBreakdownModule;
|
|
53
|
+
let recordPerformanceScoreModule;
|
|
54
|
+
let recordPerformanceRegressionModule;
|
|
55
|
+
let recordBaselineComparisonModule;
|
|
42
56
|
beforeEach(async () => {
|
|
43
57
|
vi.resetModules();
|
|
44
58
|
vi.doMock('@opentelemetry/api', () => {
|
|
@@ -52,6 +66,19 @@ describe('Telemetry Metrics', () => {
|
|
|
52
66
|
recordFileOperationMetricModule = metricsJsModule.recordFileOperationMetric;
|
|
53
67
|
recordChatCompressionMetricsModule =
|
|
54
68
|
metricsJsModule.recordChatCompressionMetrics;
|
|
69
|
+
recordModelRoutingMetricsModule = metricsJsModule.recordModelRoutingMetrics;
|
|
70
|
+
recordStartupPerformanceModule = metricsJsModule.recordStartupPerformance;
|
|
71
|
+
recordMemoryUsageModule = metricsJsModule.recordMemoryUsage;
|
|
72
|
+
recordCpuUsageModule = metricsJsModule.recordCpuUsage;
|
|
73
|
+
recordToolQueueDepthModule = metricsJsModule.recordToolQueueDepth;
|
|
74
|
+
recordToolExecutionBreakdownModule =
|
|
75
|
+
metricsJsModule.recordToolExecutionBreakdown;
|
|
76
|
+
recordTokenEfficiencyModule = metricsJsModule.recordTokenEfficiency;
|
|
77
|
+
recordApiRequestBreakdownModule = metricsJsModule.recordApiRequestBreakdown;
|
|
78
|
+
recordPerformanceScoreModule = metricsJsModule.recordPerformanceScore;
|
|
79
|
+
recordPerformanceRegressionModule =
|
|
80
|
+
metricsJsModule.recordPerformanceRegression;
|
|
81
|
+
recordBaselineComparisonModule = metricsJsModule.recordBaselineComparison;
|
|
55
82
|
const otelApiModule = await import('@opentelemetry/api');
|
|
56
83
|
mockCounterAddFn.mockClear();
|
|
57
84
|
mockCreateCounterFn.mockClear();
|
|
@@ -88,14 +115,21 @@ describe('Telemetry Metrics', () => {
|
|
|
88
115
|
describe('recordTokenUsageMetrics', () => {
|
|
89
116
|
const mockConfig = {
|
|
90
117
|
getSessionId: () => 'test-session-id',
|
|
118
|
+
getTelemetryEnabled: () => true,
|
|
91
119
|
};
|
|
92
120
|
it('should not record metrics if not initialized', () => {
|
|
93
|
-
recordTokenUsageMetricsModule(mockConfig,
|
|
121
|
+
recordTokenUsageMetricsModule(mockConfig, 100, {
|
|
122
|
+
model: 'gemini-pro',
|
|
123
|
+
type: 'input',
|
|
124
|
+
});
|
|
94
125
|
expect(mockCounterAddFn).not.toHaveBeenCalled();
|
|
95
126
|
});
|
|
96
127
|
it('should record token usage with the correct attributes', () => {
|
|
97
128
|
initializeMetricsModule(mockConfig);
|
|
98
|
-
recordTokenUsageMetricsModule(mockConfig,
|
|
129
|
+
recordTokenUsageMetricsModule(mockConfig, 100, {
|
|
130
|
+
model: 'gemini-pro',
|
|
131
|
+
type: 'input',
|
|
132
|
+
});
|
|
99
133
|
expect(mockCounterAddFn).toHaveBeenCalledTimes(2);
|
|
100
134
|
expect(mockCounterAddFn).toHaveBeenNthCalledWith(1, 1, {
|
|
101
135
|
'session.id': 'test-session-id',
|
|
@@ -109,25 +143,37 @@ describe('Telemetry Metrics', () => {
|
|
|
109
143
|
it('should record token usage for different types', () => {
|
|
110
144
|
initializeMetricsModule(mockConfig);
|
|
111
145
|
mockCounterAddFn.mockClear();
|
|
112
|
-
recordTokenUsageMetricsModule(mockConfig,
|
|
146
|
+
recordTokenUsageMetricsModule(mockConfig, 50, {
|
|
147
|
+
model: 'gemini-pro',
|
|
148
|
+
type: 'output',
|
|
149
|
+
});
|
|
113
150
|
expect(mockCounterAddFn).toHaveBeenCalledWith(50, {
|
|
114
151
|
'session.id': 'test-session-id',
|
|
115
152
|
model: 'gemini-pro',
|
|
116
153
|
type: 'output',
|
|
117
154
|
});
|
|
118
|
-
recordTokenUsageMetricsModule(mockConfig,
|
|
155
|
+
recordTokenUsageMetricsModule(mockConfig, 25, {
|
|
156
|
+
model: 'gemini-pro',
|
|
157
|
+
type: 'thought',
|
|
158
|
+
});
|
|
119
159
|
expect(mockCounterAddFn).toHaveBeenCalledWith(25, {
|
|
120
160
|
'session.id': 'test-session-id',
|
|
121
161
|
model: 'gemini-pro',
|
|
122
162
|
type: 'thought',
|
|
123
163
|
});
|
|
124
|
-
recordTokenUsageMetricsModule(mockConfig,
|
|
164
|
+
recordTokenUsageMetricsModule(mockConfig, 75, {
|
|
165
|
+
model: 'gemini-pro',
|
|
166
|
+
type: 'cache',
|
|
167
|
+
});
|
|
125
168
|
expect(mockCounterAddFn).toHaveBeenCalledWith(75, {
|
|
126
169
|
'session.id': 'test-session-id',
|
|
127
170
|
model: 'gemini-pro',
|
|
128
171
|
type: 'cache',
|
|
129
172
|
});
|
|
130
|
-
recordTokenUsageMetricsModule(mockConfig,
|
|
173
|
+
recordTokenUsageMetricsModule(mockConfig, 125, {
|
|
174
|
+
model: 'gemini-pro',
|
|
175
|
+
type: 'tool',
|
|
176
|
+
});
|
|
131
177
|
expect(mockCounterAddFn).toHaveBeenCalledWith(125, {
|
|
132
178
|
'session.id': 'test-session-id',
|
|
133
179
|
model: 'gemini-pro',
|
|
@@ -137,7 +183,10 @@ describe('Telemetry Metrics', () => {
|
|
|
137
183
|
it('should handle different models', () => {
|
|
138
184
|
initializeMetricsModule(mockConfig);
|
|
139
185
|
mockCounterAddFn.mockClear();
|
|
140
|
-
recordTokenUsageMetricsModule(mockConfig,
|
|
186
|
+
recordTokenUsageMetricsModule(mockConfig, 200, {
|
|
187
|
+
model: 'gemini-ultra',
|
|
188
|
+
type: 'input',
|
|
189
|
+
});
|
|
141
190
|
expect(mockCounterAddFn).toHaveBeenCalledWith(200, {
|
|
142
191
|
'session.id': 'test-session-id',
|
|
143
192
|
model: 'gemini-ultra',
|
|
@@ -148,14 +197,25 @@ describe('Telemetry Metrics', () => {
|
|
|
148
197
|
describe('recordFileOperationMetric', () => {
|
|
149
198
|
const mockConfig = {
|
|
150
199
|
getSessionId: () => 'test-session-id',
|
|
200
|
+
getTelemetryEnabled: () => true,
|
|
151
201
|
};
|
|
152
202
|
it('should not record metrics if not initialized', () => {
|
|
153
|
-
recordFileOperationMetricModule(mockConfig,
|
|
203
|
+
recordFileOperationMetricModule(mockConfig, {
|
|
204
|
+
operation: FileOperation.CREATE,
|
|
205
|
+
lines: 10,
|
|
206
|
+
mimetype: 'text/plain',
|
|
207
|
+
extension: 'txt',
|
|
208
|
+
});
|
|
154
209
|
expect(mockCounterAddFn).not.toHaveBeenCalled();
|
|
155
210
|
});
|
|
156
211
|
it('should record file creation with all attributes', () => {
|
|
157
212
|
initializeMetricsModule(mockConfig);
|
|
158
|
-
recordFileOperationMetricModule(mockConfig,
|
|
213
|
+
recordFileOperationMetricModule(mockConfig, {
|
|
214
|
+
operation: FileOperation.CREATE,
|
|
215
|
+
lines: 10,
|
|
216
|
+
mimetype: 'text/plain',
|
|
217
|
+
extension: 'txt',
|
|
218
|
+
});
|
|
159
219
|
expect(mockCounterAddFn).toHaveBeenCalledTimes(2);
|
|
160
220
|
expect(mockCounterAddFn).toHaveBeenNthCalledWith(1, 1, {
|
|
161
221
|
'session.id': 'test-session-id',
|
|
@@ -171,7 +231,9 @@ describe('Telemetry Metrics', () => {
|
|
|
171
231
|
it('should record file read with minimal attributes', () => {
|
|
172
232
|
initializeMetricsModule(mockConfig);
|
|
173
233
|
mockCounterAddFn.mockClear();
|
|
174
|
-
recordFileOperationMetricModule(mockConfig,
|
|
234
|
+
recordFileOperationMetricModule(mockConfig, {
|
|
235
|
+
operation: FileOperation.READ,
|
|
236
|
+
});
|
|
175
237
|
expect(mockCounterAddFn).toHaveBeenCalledWith(1, {
|
|
176
238
|
'session.id': 'test-session-id',
|
|
177
239
|
operation: FileOperation.READ,
|
|
@@ -180,36 +242,36 @@ describe('Telemetry Metrics', () => {
|
|
|
180
242
|
it('should record file update with some attributes', () => {
|
|
181
243
|
initializeMetricsModule(mockConfig);
|
|
182
244
|
mockCounterAddFn.mockClear();
|
|
183
|
-
recordFileOperationMetricModule(mockConfig,
|
|
245
|
+
recordFileOperationMetricModule(mockConfig, {
|
|
246
|
+
operation: FileOperation.UPDATE,
|
|
247
|
+
mimetype: 'application/javascript',
|
|
248
|
+
});
|
|
184
249
|
expect(mockCounterAddFn).toHaveBeenCalledWith(1, {
|
|
185
250
|
'session.id': 'test-session-id',
|
|
186
251
|
operation: FileOperation.UPDATE,
|
|
187
252
|
mimetype: 'application/javascript',
|
|
188
253
|
});
|
|
189
254
|
});
|
|
190
|
-
it('should
|
|
255
|
+
it('should record file operation without diffStat', () => {
|
|
191
256
|
initializeMetricsModule(mockConfig);
|
|
192
257
|
mockCounterAddFn.mockClear();
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
user_added_lines: 3,
|
|
197
|
-
user_removed_lines: 1,
|
|
198
|
-
};
|
|
199
|
-
recordFileOperationMetricModule(mockConfig, FileOperation.UPDATE, undefined, undefined, undefined, diffStat);
|
|
258
|
+
recordFileOperationMetricModule(mockConfig, {
|
|
259
|
+
operation: FileOperation.UPDATE,
|
|
260
|
+
});
|
|
200
261
|
expect(mockCounterAddFn).toHaveBeenCalledWith(1, {
|
|
201
262
|
'session.id': 'test-session-id',
|
|
202
263
|
operation: FileOperation.UPDATE,
|
|
203
|
-
ai_added_lines: 5,
|
|
204
|
-
ai_removed_lines: 2,
|
|
205
|
-
user_added_lines: 3,
|
|
206
|
-
user_removed_lines: 1,
|
|
207
264
|
});
|
|
208
265
|
});
|
|
209
|
-
it('should
|
|
266
|
+
it('should record minimal file operation when optional parameters are undefined', () => {
|
|
210
267
|
initializeMetricsModule(mockConfig);
|
|
211
268
|
mockCounterAddFn.mockClear();
|
|
212
|
-
recordFileOperationMetricModule(mockConfig,
|
|
269
|
+
recordFileOperationMetricModule(mockConfig, {
|
|
270
|
+
operation: FileOperation.UPDATE,
|
|
271
|
+
lines: 10,
|
|
272
|
+
mimetype: 'text/plain',
|
|
273
|
+
extension: 'txt',
|
|
274
|
+
});
|
|
213
275
|
expect(mockCounterAddFn).toHaveBeenCalledWith(1, {
|
|
214
276
|
'session.id': 'test-session-id',
|
|
215
277
|
operation: FileOperation.UPDATE,
|
|
@@ -218,23 +280,506 @@ describe('Telemetry Metrics', () => {
|
|
|
218
280
|
extension: 'txt',
|
|
219
281
|
});
|
|
220
282
|
});
|
|
221
|
-
it('should
|
|
283
|
+
it('should not include diffStat attributes when diffStat is not provided', () => {
|
|
222
284
|
initializeMetricsModule(mockConfig);
|
|
223
285
|
mockCounterAddFn.mockClear();
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
user_added_lines: 0,
|
|
228
|
-
user_removed_lines: 0,
|
|
229
|
-
};
|
|
230
|
-
recordFileOperationMetricModule(mockConfig, FileOperation.UPDATE, undefined, undefined, undefined, diffStat);
|
|
286
|
+
recordFileOperationMetricModule(mockConfig, {
|
|
287
|
+
operation: FileOperation.UPDATE,
|
|
288
|
+
});
|
|
231
289
|
expect(mockCounterAddFn).toHaveBeenCalledWith(1, {
|
|
232
290
|
'session.id': 'test-session-id',
|
|
233
291
|
operation: FileOperation.UPDATE,
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
292
|
+
});
|
|
293
|
+
});
|
|
294
|
+
});
|
|
295
|
+
describe('recordModelRoutingMetrics', () => {
|
|
296
|
+
const mockConfig = {
|
|
297
|
+
getSessionId: () => 'test-session-id',
|
|
298
|
+
getTelemetryEnabled: () => true,
|
|
299
|
+
};
|
|
300
|
+
it('should not record metrics if not initialized', () => {
|
|
301
|
+
const event = new ModelRoutingEvent('gemini-pro', 'default', 100, 'test-reason', false, undefined);
|
|
302
|
+
recordModelRoutingMetricsModule(mockConfig, event);
|
|
303
|
+
expect(mockHistogramRecordFn).not.toHaveBeenCalled();
|
|
304
|
+
expect(mockCounterAddFn).not.toHaveBeenCalled();
|
|
305
|
+
});
|
|
306
|
+
it('should record latency for a successful routing decision', () => {
|
|
307
|
+
initializeMetricsModule(mockConfig);
|
|
308
|
+
const event = new ModelRoutingEvent('gemini-pro', 'default', 150, 'test-reason', false, undefined);
|
|
309
|
+
recordModelRoutingMetricsModule(mockConfig, event);
|
|
310
|
+
expect(mockHistogramRecordFn).toHaveBeenCalledWith(150, {
|
|
311
|
+
'session.id': 'test-session-id',
|
|
312
|
+
'routing.decision_model': 'gemini-pro',
|
|
313
|
+
'routing.decision_source': 'default',
|
|
314
|
+
});
|
|
315
|
+
// The session counter is called once on init
|
|
316
|
+
expect(mockCounterAddFn).toHaveBeenCalledTimes(1);
|
|
317
|
+
});
|
|
318
|
+
it('should record latency and failure for a failed routing decision', () => {
|
|
319
|
+
initializeMetricsModule(mockConfig);
|
|
320
|
+
const event = new ModelRoutingEvent('gemini-pro', 'classifier', 200, 'test-reason', true, 'test-error');
|
|
321
|
+
recordModelRoutingMetricsModule(mockConfig, event);
|
|
322
|
+
expect(mockHistogramRecordFn).toHaveBeenCalledWith(200, {
|
|
323
|
+
'session.id': 'test-session-id',
|
|
324
|
+
'routing.decision_model': 'gemini-pro',
|
|
325
|
+
'routing.decision_source': 'classifier',
|
|
326
|
+
});
|
|
327
|
+
expect(mockCounterAddFn).toHaveBeenCalledTimes(2);
|
|
328
|
+
expect(mockCounterAddFn).toHaveBeenNthCalledWith(2, 1, {
|
|
329
|
+
'session.id': 'test-session-id',
|
|
330
|
+
'routing.decision_source': 'classifier',
|
|
331
|
+
'routing.error_message': 'test-error',
|
|
332
|
+
});
|
|
333
|
+
});
|
|
334
|
+
});
|
|
335
|
+
describe('Performance Monitoring Metrics', () => {
|
|
336
|
+
const mockConfig = {
|
|
337
|
+
getSessionId: () => 'test-session-id',
|
|
338
|
+
getTelemetryEnabled: () => true,
|
|
339
|
+
};
|
|
340
|
+
describe('recordStartupPerformance', () => {
|
|
341
|
+
it('should not record metrics when performance monitoring is disabled', async () => {
|
|
342
|
+
// Re-import with performance monitoring disabled by mocking the config
|
|
343
|
+
const mockConfigDisabled = {
|
|
344
|
+
getSessionId: () => 'test-session-id',
|
|
345
|
+
getTelemetryEnabled: () => false, // Disable telemetry to disable performance monitoring
|
|
346
|
+
};
|
|
347
|
+
initializeMetricsModule(mockConfigDisabled);
|
|
348
|
+
mockHistogramRecordFn.mockClear();
|
|
349
|
+
recordStartupPerformanceModule(mockConfigDisabled, 100, {
|
|
350
|
+
phase: 'settings_loading',
|
|
351
|
+
details: {
|
|
352
|
+
auth_type: 'gemini',
|
|
353
|
+
},
|
|
354
|
+
});
|
|
355
|
+
expect(mockHistogramRecordFn).not.toHaveBeenCalled();
|
|
356
|
+
});
|
|
357
|
+
it('should record startup performance with phase and details', () => {
|
|
358
|
+
initializeMetricsModule(mockConfig);
|
|
359
|
+
mockHistogramRecordFn.mockClear();
|
|
360
|
+
recordStartupPerformanceModule(mockConfig, 150, {
|
|
361
|
+
phase: 'settings_loading',
|
|
362
|
+
details: {
|
|
363
|
+
auth_type: 'gemini',
|
|
364
|
+
telemetry_enabled: true,
|
|
365
|
+
settings_sources: 2,
|
|
366
|
+
},
|
|
367
|
+
});
|
|
368
|
+
expect(mockHistogramRecordFn).toHaveBeenCalledWith(150, {
|
|
369
|
+
'session.id': 'test-session-id',
|
|
370
|
+
phase: 'settings_loading',
|
|
371
|
+
auth_type: 'gemini',
|
|
372
|
+
telemetry_enabled: true,
|
|
373
|
+
settings_sources: 2,
|
|
374
|
+
});
|
|
375
|
+
});
|
|
376
|
+
it('should record startup performance without details', () => {
|
|
377
|
+
initializeMetricsModule(mockConfig);
|
|
378
|
+
mockHistogramRecordFn.mockClear();
|
|
379
|
+
recordStartupPerformanceModule(mockConfig, 50, { phase: 'cleanup' });
|
|
380
|
+
expect(mockHistogramRecordFn).toHaveBeenCalledWith(50, {
|
|
381
|
+
'session.id': 'test-session-id',
|
|
382
|
+
phase: 'cleanup',
|
|
383
|
+
});
|
|
384
|
+
});
|
|
385
|
+
it('should handle floating-point duration values from performance.now()', () => {
|
|
386
|
+
initializeMetricsModule(mockConfig);
|
|
387
|
+
mockHistogramRecordFn.mockClear();
|
|
388
|
+
// Test with realistic floating-point values that performance.now() would return
|
|
389
|
+
const floatingPointDuration = 123.45678;
|
|
390
|
+
recordStartupPerformanceModule(mockConfig, floatingPointDuration, {
|
|
391
|
+
phase: 'total_startup',
|
|
392
|
+
details: {
|
|
393
|
+
is_tty: true,
|
|
394
|
+
has_question: false,
|
|
395
|
+
},
|
|
396
|
+
});
|
|
397
|
+
expect(mockHistogramRecordFn).toHaveBeenCalledWith(floatingPointDuration, {
|
|
398
|
+
'session.id': 'test-session-id',
|
|
399
|
+
phase: 'total_startup',
|
|
400
|
+
is_tty: true,
|
|
401
|
+
has_question: false,
|
|
402
|
+
});
|
|
403
|
+
});
|
|
404
|
+
});
|
|
405
|
+
describe('recordMemoryUsage', () => {
|
|
406
|
+
it('should record memory usage for different memory types', () => {
|
|
407
|
+
initializeMetricsModule(mockConfig);
|
|
408
|
+
mockHistogramRecordFn.mockClear();
|
|
409
|
+
recordMemoryUsageModule(mockConfig, 15728640, {
|
|
410
|
+
memory_type: MemoryMetricType.HEAP_USED,
|
|
411
|
+
component: 'startup',
|
|
412
|
+
});
|
|
413
|
+
expect(mockHistogramRecordFn).toHaveBeenCalledWith(15728640, {
|
|
414
|
+
'session.id': 'test-session-id',
|
|
415
|
+
memory_type: 'heap_used',
|
|
416
|
+
component: 'startup',
|
|
417
|
+
});
|
|
418
|
+
});
|
|
419
|
+
it('should record memory usage for all memory metric types', () => {
|
|
420
|
+
initializeMetricsModule(mockConfig);
|
|
421
|
+
mockHistogramRecordFn.mockClear();
|
|
422
|
+
recordMemoryUsageModule(mockConfig, 31457280, {
|
|
423
|
+
memory_type: MemoryMetricType.HEAP_TOTAL,
|
|
424
|
+
component: 'api_call',
|
|
425
|
+
});
|
|
426
|
+
recordMemoryUsageModule(mockConfig, 2097152, {
|
|
427
|
+
memory_type: MemoryMetricType.EXTERNAL,
|
|
428
|
+
component: 'tool_execution',
|
|
429
|
+
});
|
|
430
|
+
recordMemoryUsageModule(mockConfig, 41943040, {
|
|
431
|
+
memory_type: MemoryMetricType.RSS,
|
|
432
|
+
component: 'memory_monitor',
|
|
433
|
+
});
|
|
434
|
+
expect(mockHistogramRecordFn).toHaveBeenCalledTimes(3); // One for each call
|
|
435
|
+
expect(mockHistogramRecordFn).toHaveBeenNthCalledWith(1, 31457280, {
|
|
436
|
+
'session.id': 'test-session-id',
|
|
437
|
+
memory_type: 'heap_total',
|
|
438
|
+
component: 'api_call',
|
|
439
|
+
});
|
|
440
|
+
expect(mockHistogramRecordFn).toHaveBeenNthCalledWith(2, 2097152, {
|
|
441
|
+
'session.id': 'test-session-id',
|
|
442
|
+
memory_type: 'external',
|
|
443
|
+
component: 'tool_execution',
|
|
444
|
+
});
|
|
445
|
+
expect(mockHistogramRecordFn).toHaveBeenNthCalledWith(3, 41943040, {
|
|
446
|
+
'session.id': 'test-session-id',
|
|
447
|
+
memory_type: 'rss',
|
|
448
|
+
component: 'memory_monitor',
|
|
449
|
+
});
|
|
450
|
+
});
|
|
451
|
+
it('should record memory usage without component', () => {
|
|
452
|
+
initializeMetricsModule(mockConfig);
|
|
453
|
+
mockHistogramRecordFn.mockClear();
|
|
454
|
+
recordMemoryUsageModule(mockConfig, 15728640, {
|
|
455
|
+
memory_type: MemoryMetricType.HEAP_USED,
|
|
456
|
+
});
|
|
457
|
+
expect(mockHistogramRecordFn).toHaveBeenCalledWith(15728640, {
|
|
458
|
+
'session.id': 'test-session-id',
|
|
459
|
+
memory_type: 'heap_used',
|
|
460
|
+
});
|
|
461
|
+
});
|
|
462
|
+
});
|
|
463
|
+
describe('recordCpuUsage', () => {
|
|
464
|
+
it('should record CPU usage percentage', () => {
|
|
465
|
+
initializeMetricsModule(mockConfig);
|
|
466
|
+
mockHistogramRecordFn.mockClear();
|
|
467
|
+
recordCpuUsageModule(mockConfig, 85.5, {
|
|
468
|
+
component: 'tool_execution',
|
|
469
|
+
});
|
|
470
|
+
expect(mockHistogramRecordFn).toHaveBeenCalledWith(85.5, {
|
|
471
|
+
'session.id': 'test-session-id',
|
|
472
|
+
component: 'tool_execution',
|
|
473
|
+
});
|
|
474
|
+
});
|
|
475
|
+
it('should record CPU usage without component', () => {
|
|
476
|
+
initializeMetricsModule(mockConfig);
|
|
477
|
+
mockHistogramRecordFn.mockClear();
|
|
478
|
+
recordCpuUsageModule(mockConfig, 42.3, {});
|
|
479
|
+
expect(mockHistogramRecordFn).toHaveBeenCalledWith(42.3, {
|
|
480
|
+
'session.id': 'test-session-id',
|
|
481
|
+
});
|
|
482
|
+
});
|
|
483
|
+
});
|
|
484
|
+
describe('recordToolQueueDepth', () => {
|
|
485
|
+
it('should record tool queue depth', () => {
|
|
486
|
+
initializeMetricsModule(mockConfig);
|
|
487
|
+
mockHistogramRecordFn.mockClear();
|
|
488
|
+
recordToolQueueDepthModule(mockConfig, 3);
|
|
489
|
+
expect(mockHistogramRecordFn).toHaveBeenCalledWith(3, {
|
|
490
|
+
'session.id': 'test-session-id',
|
|
491
|
+
});
|
|
492
|
+
});
|
|
493
|
+
it('should record zero queue depth', () => {
|
|
494
|
+
initializeMetricsModule(mockConfig);
|
|
495
|
+
mockHistogramRecordFn.mockClear();
|
|
496
|
+
recordToolQueueDepthModule(mockConfig, 0);
|
|
497
|
+
expect(mockHistogramRecordFn).toHaveBeenCalledWith(0, {
|
|
498
|
+
'session.id': 'test-session-id',
|
|
499
|
+
});
|
|
500
|
+
});
|
|
501
|
+
});
|
|
502
|
+
describe('recordToolExecutionBreakdown', () => {
|
|
503
|
+
it('should record tool execution breakdown for all phases', () => {
|
|
504
|
+
initializeMetricsModule(mockConfig);
|
|
505
|
+
mockHistogramRecordFn.mockClear();
|
|
506
|
+
recordToolExecutionBreakdownModule(mockConfig, 25, {
|
|
507
|
+
function_name: 'Read',
|
|
508
|
+
phase: ToolExecutionPhase.VALIDATION,
|
|
509
|
+
});
|
|
510
|
+
expect(mockHistogramRecordFn).toHaveBeenCalledWith(25, {
|
|
511
|
+
'session.id': 'test-session-id',
|
|
512
|
+
function_name: 'Read',
|
|
513
|
+
phase: 'validation',
|
|
514
|
+
});
|
|
515
|
+
});
|
|
516
|
+
it('should record execution breakdown for different phases', () => {
|
|
517
|
+
initializeMetricsModule(mockConfig);
|
|
518
|
+
mockHistogramRecordFn.mockClear();
|
|
519
|
+
recordToolExecutionBreakdownModule(mockConfig, 50, {
|
|
520
|
+
function_name: 'Bash',
|
|
521
|
+
phase: ToolExecutionPhase.PREPARATION,
|
|
522
|
+
});
|
|
523
|
+
recordToolExecutionBreakdownModule(mockConfig, 1500, {
|
|
524
|
+
function_name: 'Bash',
|
|
525
|
+
phase: ToolExecutionPhase.EXECUTION,
|
|
526
|
+
});
|
|
527
|
+
recordToolExecutionBreakdownModule(mockConfig, 75, {
|
|
528
|
+
function_name: 'Bash',
|
|
529
|
+
phase: ToolExecutionPhase.RESULT_PROCESSING,
|
|
530
|
+
});
|
|
531
|
+
expect(mockHistogramRecordFn).toHaveBeenCalledTimes(3); // One for each call
|
|
532
|
+
expect(mockHistogramRecordFn).toHaveBeenNthCalledWith(1, 50, {
|
|
533
|
+
'session.id': 'test-session-id',
|
|
534
|
+
function_name: 'Bash',
|
|
535
|
+
phase: 'preparation',
|
|
536
|
+
});
|
|
537
|
+
expect(mockHistogramRecordFn).toHaveBeenNthCalledWith(2, 1500, {
|
|
538
|
+
'session.id': 'test-session-id',
|
|
539
|
+
function_name: 'Bash',
|
|
540
|
+
phase: 'execution',
|
|
541
|
+
});
|
|
542
|
+
expect(mockHistogramRecordFn).toHaveBeenNthCalledWith(3, 75, {
|
|
543
|
+
'session.id': 'test-session-id',
|
|
544
|
+
function_name: 'Bash',
|
|
545
|
+
phase: 'result_processing',
|
|
546
|
+
});
|
|
547
|
+
});
|
|
548
|
+
});
|
|
549
|
+
describe('recordTokenEfficiency', () => {
|
|
550
|
+
it('should record token efficiency metrics', () => {
|
|
551
|
+
initializeMetricsModule(mockConfig);
|
|
552
|
+
mockHistogramRecordFn.mockClear();
|
|
553
|
+
recordTokenEfficiencyModule(mockConfig, 0.85, {
|
|
554
|
+
model: 'gemini-pro',
|
|
555
|
+
metric: 'cache_hit_rate',
|
|
556
|
+
context: 'api_request',
|
|
557
|
+
});
|
|
558
|
+
expect(mockHistogramRecordFn).toHaveBeenCalledWith(0.85, {
|
|
559
|
+
'session.id': 'test-session-id',
|
|
560
|
+
model: 'gemini-pro',
|
|
561
|
+
metric: 'cache_hit_rate',
|
|
562
|
+
context: 'api_request',
|
|
563
|
+
});
|
|
564
|
+
});
|
|
565
|
+
it('should record token efficiency without context', () => {
|
|
566
|
+
initializeMetricsModule(mockConfig);
|
|
567
|
+
mockHistogramRecordFn.mockClear();
|
|
568
|
+
recordTokenEfficiencyModule(mockConfig, 125.5, {
|
|
569
|
+
model: 'gemini-pro',
|
|
570
|
+
metric: 'tokens_per_operation',
|
|
571
|
+
});
|
|
572
|
+
expect(mockHistogramRecordFn).toHaveBeenCalledWith(125.5, {
|
|
573
|
+
'session.id': 'test-session-id',
|
|
574
|
+
model: 'gemini-pro',
|
|
575
|
+
metric: 'tokens_per_operation',
|
|
576
|
+
});
|
|
577
|
+
});
|
|
578
|
+
});
|
|
579
|
+
describe('recordApiRequestBreakdown', () => {
|
|
580
|
+
it('should record API request breakdown for all phases', () => {
|
|
581
|
+
initializeMetricsModule(mockConfig);
|
|
582
|
+
mockHistogramRecordFn.mockClear();
|
|
583
|
+
recordApiRequestBreakdownModule(mockConfig, 15, {
|
|
584
|
+
model: 'gemini-pro',
|
|
585
|
+
phase: ApiRequestPhase.REQUEST_PREPARATION,
|
|
586
|
+
});
|
|
587
|
+
expect(mockHistogramRecordFn).toHaveBeenCalledWith(15, {
|
|
588
|
+
'session.id': 'test-session-id',
|
|
589
|
+
model: 'gemini-pro',
|
|
590
|
+
phase: 'request_preparation',
|
|
591
|
+
});
|
|
592
|
+
});
|
|
593
|
+
it('should record API request breakdown for different phases', () => {
|
|
594
|
+
initializeMetricsModule(mockConfig);
|
|
595
|
+
mockHistogramRecordFn.mockClear();
|
|
596
|
+
recordApiRequestBreakdownModule(mockConfig, 250, {
|
|
597
|
+
model: 'gemini-pro',
|
|
598
|
+
phase: ApiRequestPhase.NETWORK_LATENCY,
|
|
599
|
+
});
|
|
600
|
+
recordApiRequestBreakdownModule(mockConfig, 100, {
|
|
601
|
+
model: 'gemini-pro',
|
|
602
|
+
phase: ApiRequestPhase.RESPONSE_PROCESSING,
|
|
603
|
+
});
|
|
604
|
+
recordApiRequestBreakdownModule(mockConfig, 50, {
|
|
605
|
+
model: 'gemini-pro',
|
|
606
|
+
phase: ApiRequestPhase.TOKEN_PROCESSING,
|
|
607
|
+
});
|
|
608
|
+
expect(mockHistogramRecordFn).toHaveBeenCalledTimes(3); // One for each call
|
|
609
|
+
expect(mockHistogramRecordFn).toHaveBeenNthCalledWith(1, 250, {
|
|
610
|
+
'session.id': 'test-session-id',
|
|
611
|
+
model: 'gemini-pro',
|
|
612
|
+
phase: 'network_latency',
|
|
613
|
+
});
|
|
614
|
+
expect(mockHistogramRecordFn).toHaveBeenNthCalledWith(2, 100, {
|
|
615
|
+
'session.id': 'test-session-id',
|
|
616
|
+
model: 'gemini-pro',
|
|
617
|
+
phase: 'response_processing',
|
|
618
|
+
});
|
|
619
|
+
expect(mockHistogramRecordFn).toHaveBeenNthCalledWith(3, 50, {
|
|
620
|
+
'session.id': 'test-session-id',
|
|
621
|
+
model: 'gemini-pro',
|
|
622
|
+
phase: 'token_processing',
|
|
623
|
+
});
|
|
624
|
+
});
|
|
625
|
+
});
|
|
626
|
+
describe('recordPerformanceScore', () => {
|
|
627
|
+
it('should record performance score with category and baseline', () => {
|
|
628
|
+
initializeMetricsModule(mockConfig);
|
|
629
|
+
mockHistogramRecordFn.mockClear();
|
|
630
|
+
recordPerformanceScoreModule(mockConfig, 85.5, {
|
|
631
|
+
category: 'memory_efficiency',
|
|
632
|
+
baseline: 80.0,
|
|
633
|
+
});
|
|
634
|
+
expect(mockHistogramRecordFn).toHaveBeenCalledWith(85.5, {
|
|
635
|
+
'session.id': 'test-session-id',
|
|
636
|
+
category: 'memory_efficiency',
|
|
637
|
+
baseline: 80.0,
|
|
638
|
+
});
|
|
639
|
+
});
|
|
640
|
+
it('should record performance score without baseline', () => {
|
|
641
|
+
initializeMetricsModule(mockConfig);
|
|
642
|
+
mockHistogramRecordFn.mockClear();
|
|
643
|
+
recordPerformanceScoreModule(mockConfig, 92.3, {
|
|
644
|
+
category: 'overall_performance',
|
|
645
|
+
});
|
|
646
|
+
expect(mockHistogramRecordFn).toHaveBeenCalledWith(92.3, {
|
|
647
|
+
'session.id': 'test-session-id',
|
|
648
|
+
category: 'overall_performance',
|
|
649
|
+
});
|
|
650
|
+
});
|
|
651
|
+
});
|
|
652
|
+
describe('recordPerformanceRegression', () => {
|
|
653
|
+
it('should record performance regression with baseline comparison', () => {
|
|
654
|
+
initializeMetricsModule(mockConfig);
|
|
655
|
+
mockCounterAddFn.mockClear();
|
|
656
|
+
mockHistogramRecordFn.mockClear();
|
|
657
|
+
recordPerformanceRegressionModule(mockConfig, {
|
|
658
|
+
metric: 'startup_time',
|
|
659
|
+
current_value: 1200,
|
|
660
|
+
baseline_value: 1000,
|
|
661
|
+
severity: 'medium',
|
|
662
|
+
});
|
|
663
|
+
// Verify regression counter
|
|
664
|
+
expect(mockCounterAddFn).toHaveBeenCalledWith(1, {
|
|
665
|
+
'session.id': 'test-session-id',
|
|
666
|
+
metric: 'startup_time',
|
|
667
|
+
severity: 'medium',
|
|
668
|
+
current_value: 1200,
|
|
669
|
+
baseline_value: 1000,
|
|
670
|
+
});
|
|
671
|
+
// Verify baseline comparison histogram (20% increase)
|
|
672
|
+
expect(mockHistogramRecordFn).toHaveBeenCalledWith(20, {
|
|
673
|
+
'session.id': 'test-session-id',
|
|
674
|
+
metric: 'startup_time',
|
|
675
|
+
severity: 'medium',
|
|
676
|
+
current_value: 1200,
|
|
677
|
+
baseline_value: 1000,
|
|
678
|
+
});
|
|
679
|
+
});
|
|
680
|
+
it('should handle zero baseline value gracefully', () => {
|
|
681
|
+
initializeMetricsModule(mockConfig);
|
|
682
|
+
mockCounterAddFn.mockClear();
|
|
683
|
+
mockHistogramRecordFn.mockClear();
|
|
684
|
+
recordPerformanceRegressionModule(mockConfig, {
|
|
685
|
+
metric: 'memory_usage',
|
|
686
|
+
current_value: 100,
|
|
687
|
+
baseline_value: 0,
|
|
688
|
+
severity: 'high',
|
|
689
|
+
});
|
|
690
|
+
// Verify regression counter still recorded
|
|
691
|
+
expect(mockCounterAddFn).toHaveBeenCalledWith(1, {
|
|
692
|
+
'session.id': 'test-session-id',
|
|
693
|
+
metric: 'memory_usage',
|
|
694
|
+
severity: 'high',
|
|
695
|
+
current_value: 100,
|
|
696
|
+
baseline_value: 0,
|
|
697
|
+
});
|
|
698
|
+
// Verify no baseline comparison due to zero baseline
|
|
699
|
+
expect(mockHistogramRecordFn).not.toHaveBeenCalled();
|
|
700
|
+
});
|
|
701
|
+
it('should record different severity levels', () => {
|
|
702
|
+
initializeMetricsModule(mockConfig);
|
|
703
|
+
mockCounterAddFn.mockClear();
|
|
704
|
+
recordPerformanceRegressionModule(mockConfig, {
|
|
705
|
+
metric: 'api_latency',
|
|
706
|
+
current_value: 500,
|
|
707
|
+
baseline_value: 400,
|
|
708
|
+
severity: 'low',
|
|
709
|
+
});
|
|
710
|
+
recordPerformanceRegressionModule(mockConfig, {
|
|
711
|
+
metric: 'cpu_usage',
|
|
712
|
+
current_value: 90,
|
|
713
|
+
baseline_value: 70,
|
|
714
|
+
severity: 'high',
|
|
715
|
+
});
|
|
716
|
+
expect(mockCounterAddFn).toHaveBeenNthCalledWith(1, 1, {
|
|
717
|
+
'session.id': 'test-session-id',
|
|
718
|
+
metric: 'api_latency',
|
|
719
|
+
severity: 'low',
|
|
720
|
+
current_value: 500,
|
|
721
|
+
baseline_value: 400,
|
|
722
|
+
});
|
|
723
|
+
expect(mockCounterAddFn).toHaveBeenNthCalledWith(2, 1, {
|
|
724
|
+
'session.id': 'test-session-id',
|
|
725
|
+
metric: 'cpu_usage',
|
|
726
|
+
severity: 'high',
|
|
727
|
+
current_value: 90,
|
|
728
|
+
baseline_value: 70,
|
|
729
|
+
});
|
|
730
|
+
});
|
|
731
|
+
});
|
|
732
|
+
describe('recordBaselineComparison', () => {
|
|
733
|
+
it('should record baseline comparison with percentage change', () => {
|
|
734
|
+
initializeMetricsModule(mockConfig);
|
|
735
|
+
mockHistogramRecordFn.mockClear();
|
|
736
|
+
recordBaselineComparisonModule(mockConfig, {
|
|
737
|
+
metric: 'memory_usage',
|
|
738
|
+
current_value: 120,
|
|
739
|
+
baseline_value: 100,
|
|
740
|
+
category: 'performance_tracking',
|
|
741
|
+
});
|
|
742
|
+
// 20% increase: (120 - 100) / 100 * 100 = 20%
|
|
743
|
+
expect(mockHistogramRecordFn).toHaveBeenCalledWith(20, {
|
|
744
|
+
'session.id': 'test-session-id',
|
|
745
|
+
metric: 'memory_usage',
|
|
746
|
+
category: 'performance_tracking',
|
|
747
|
+
current_value: 120,
|
|
748
|
+
baseline_value: 100,
|
|
749
|
+
});
|
|
750
|
+
});
|
|
751
|
+
it('should handle negative percentage change (improvement)', () => {
|
|
752
|
+
initializeMetricsModule(mockConfig);
|
|
753
|
+
mockHistogramRecordFn.mockClear();
|
|
754
|
+
recordBaselineComparisonModule(mockConfig, {
|
|
755
|
+
metric: 'startup_time',
|
|
756
|
+
current_value: 800,
|
|
757
|
+
baseline_value: 1000,
|
|
758
|
+
category: 'optimization',
|
|
759
|
+
});
|
|
760
|
+
// 20% decrease: (800 - 1000) / 1000 * 100 = -20%
|
|
761
|
+
expect(mockHistogramRecordFn).toHaveBeenCalledWith(-20, {
|
|
762
|
+
'session.id': 'test-session-id',
|
|
763
|
+
metric: 'startup_time',
|
|
764
|
+
category: 'optimization',
|
|
765
|
+
current_value: 800,
|
|
766
|
+
baseline_value: 1000,
|
|
767
|
+
});
|
|
768
|
+
});
|
|
769
|
+
it('should skip recording when baseline is zero', async () => {
|
|
770
|
+
// Access the actual mocked module
|
|
771
|
+
const mockedModule = (await vi.importMock('@opentelemetry/api'));
|
|
772
|
+
const diagSpy = vi.spyOn(mockedModule.diag, 'warn');
|
|
773
|
+
initializeMetricsModule(mockConfig);
|
|
774
|
+
mockHistogramRecordFn.mockClear();
|
|
775
|
+
recordBaselineComparisonModule(mockConfig, {
|
|
776
|
+
metric: 'new_metric',
|
|
777
|
+
current_value: 50,
|
|
778
|
+
baseline_value: 0,
|
|
779
|
+
category: 'testing',
|
|
780
|
+
});
|
|
781
|
+
expect(diagSpy).toHaveBeenCalledWith('Baseline value is zero, skipping comparison.');
|
|
782
|
+
expect(mockHistogramRecordFn).not.toHaveBeenCalled();
|
|
238
783
|
});
|
|
239
784
|
});
|
|
240
785
|
});
|