@machina.ai/cell-cli-core 1.11.0-rc1 → 1.13.0-rc1
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 +5 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/package.json +9 -3
- package/dist/src/agents/executor.d.ts +19 -0
- package/dist/src/agents/executor.js +226 -32
- package/dist/src/agents/executor.js.map +1 -1
- package/dist/src/agents/executor.test.js +335 -9
- package/dist/src/agents/executor.test.js.map +1 -1
- package/dist/src/agents/subagent-tool-wrapper.test.js +2 -4
- package/dist/src/agents/subagent-tool-wrapper.test.js.map +1 -1
- package/dist/src/agents/types.d.ts +2 -1
- package/dist/src/agents/types.js +1 -0
- package/dist/src/agents/types.js.map +1 -1
- package/dist/src/code_assist/experiments/client_metadata.d.ts +12 -0
- package/dist/src/code_assist/experiments/client_metadata.js +49 -0
- package/dist/src/code_assist/experiments/client_metadata.js.map +1 -0
- package/dist/src/code_assist/experiments/experiments.d.ts +17 -0
- package/dist/src/code_assist/experiments/experiments.js +36 -0
- package/dist/src/code_assist/experiments/experiments.js.map +1 -0
- package/dist/src/code_assist/experiments/types.d.ts +35 -0
- package/dist/src/code_assist/experiments/types.js +7 -0
- package/dist/src/code_assist/experiments/types.js.map +1 -0
- package/dist/src/code_assist/oauth-credential-storage.js +5 -4
- package/dist/src/code_assist/oauth-credential-storage.js.map +1 -1
- package/dist/src/code_assist/oauth-credential-storage.test.js +15 -3
- package/dist/src/code_assist/oauth-credential-storage.test.js.map +1 -1
- package/dist/src/code_assist/oauth2.d.ts +2 -2
- package/dist/src/code_assist/oauth2.js +53 -41
- package/dist/src/code_assist/oauth2.js.map +1 -1
- package/dist/src/code_assist/oauth2.test.js +65 -33
- package/dist/src/code_assist/oauth2.test.js.map +1 -1
- package/dist/src/code_assist/server.d.ts +6 -4
- package/dist/src/code_assist/server.js +11 -0
- package/dist/src/code_assist/server.js.map +1 -1
- package/dist/src/code_assist/server.test.js +17 -0
- package/dist/src/code_assist/server.test.js.map +1 -1
- package/dist/src/code_assist/setup.d.ts +2 -2
- package/dist/src/code_assist/setup.js.map +1 -1
- package/dist/src/code_assist/types.d.ts +1 -1
- package/dist/src/code_assist/types.js.map +1 -1
- package/dist/src/commands/extensions.d.ts +7 -0
- package/dist/src/commands/extensions.js +9 -0
- package/dist/src/commands/extensions.js.map +1 -0
- package/dist/src/commands/extensions.test.d.ts +6 -0
- package/dist/src/commands/extensions.test.js +19 -0
- package/dist/src/commands/extensions.test.js.map +1 -0
- package/dist/src/config/config.d.ts +72 -24
- package/dist/src/config/config.js +168 -55
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/config.test.js +59 -23
- package/dist/src/config/config.test.js.map +1 -1
- package/dist/src/config/models.d.ts +1 -1
- package/dist/src/config/models.js +2 -2
- package/dist/src/config/models.js.map +1 -1
- package/dist/src/config/storage.d.ts +3 -0
- package/dist/src/config/storage.js +20 -0
- package/dist/src/config/storage.js.map +1 -1
- package/dist/src/core/apiKeyCredentialStorage.d.ts +17 -0
- package/dist/src/core/apiKeyCredentialStorage.js +64 -0
- package/dist/src/core/apiKeyCredentialStorage.js.map +1 -0
- package/dist/src/core/apiKeyCredentialStorage.test.d.ts +6 -0
- package/dist/src/core/apiKeyCredentialStorage.test.js +71 -0
- package/dist/src/core/apiKeyCredentialStorage.test.js.map +1 -0
- package/dist/src/core/client.d.ts +2 -11
- package/dist/src/core/client.js +28 -168
- package/dist/src/core/client.js.map +1 -1
- package/dist/src/core/client.test.js +107 -409
- package/dist/src/core/client.test.js.map +1 -1
- package/dist/src/core/contentGenerator.js +64 -59
- package/dist/src/core/contentGenerator.js.map +1 -1
- package/dist/src/core/contentGenerator.test.js +38 -4
- package/dist/src/core/contentGenerator.test.js.map +1 -1
- package/dist/src/core/coreToolScheduler.d.ts +7 -8
- package/dist/src/core/coreToolScheduler.js +316 -187
- package/dist/src/core/coreToolScheduler.js.map +1 -1
- package/dist/src/core/coreToolScheduler.test.js +240 -10
- package/dist/src/core/coreToolScheduler.test.js.map +1 -1
- package/dist/src/core/fakeContentGenerator.d.ts +33 -0
- package/dist/src/core/fakeContentGenerator.js +58 -0
- package/dist/src/core/fakeContentGenerator.js.map +1 -0
- package/dist/src/core/fakeContentGenerator.test.d.ts +6 -0
- package/dist/src/core/fakeContentGenerator.test.js +127 -0
- package/dist/src/core/fakeContentGenerator.test.js.map +1 -0
- package/dist/src/core/geminiChat.d.ts +2 -0
- package/dist/src/core/geminiChat.js +6 -2
- package/dist/src/core/geminiChat.js.map +1 -1
- package/dist/src/core/geminiChat.test.js +15 -3
- package/dist/src/core/geminiChat.test.js.map +1 -1
- package/dist/src/core/logger.js +10 -9
- package/dist/src/core/logger.js.map +1 -1
- package/dist/src/core/loggingContentGenerator.d.ts +1 -0
- package/dist/src/core/loggingContentGenerator.js +113 -33
- package/dist/src/core/loggingContentGenerator.js.map +1 -1
- package/dist/src/core/nonInteractiveToolExecutor.js +5 -4
- package/dist/src/core/nonInteractiveToolExecutor.js.map +1 -1
- package/dist/src/core/prompts.js +104 -55
- package/dist/src/core/prompts.js.map +1 -1
- package/dist/src/core/prompts.test.js +30 -108
- package/dist/src/core/prompts.test.js.map +1 -1
- package/dist/src/core/recordingContentGenerator.d.ts +18 -0
- package/dist/src/core/recordingContentGenerator.js +77 -0
- package/dist/src/core/recordingContentGenerator.js.map +1 -0
- package/dist/src/core/recordingContentGenerator.test.d.ts +6 -0
- package/dist/src/core/recordingContentGenerator.test.js +101 -0
- package/dist/src/core/recordingContentGenerator.test.js.map +1 -0
- package/dist/src/fallback/handler.js +2 -0
- package/dist/src/fallback/handler.js.map +1 -1
- package/dist/src/generated/git-commit.d.ts +2 -2
- package/dist/src/generated/git-commit.js +2 -2
- package/dist/src/hooks/hookPlanner.d.ts +46 -0
- package/dist/src/hooks/hookPlanner.js +108 -0
- package/dist/src/hooks/hookPlanner.js.map +1 -0
- package/dist/src/hooks/hookPlanner.test.d.ts +6 -0
- package/dist/src/hooks/hookPlanner.test.js +255 -0
- package/dist/src/hooks/hookPlanner.test.js.map +1 -0
- package/dist/src/hooks/hookRegistry.d.ts +87 -0
- package/dist/src/hooks/hookRegistry.js +198 -0
- package/dist/src/hooks/hookRegistry.js.map +1 -0
- package/dist/src/hooks/hookRegistry.test.d.ts +6 -0
- package/dist/src/hooks/hookRegistry.test.js +341 -0
- package/dist/src/hooks/hookRegistry.test.js.map +1 -0
- package/dist/src/hooks/hookTranslator.d.ts +113 -0
- package/dist/src/hooks/hookTranslator.js +232 -0
- package/dist/src/hooks/hookTranslator.js.map +1 -0
- package/dist/src/hooks/hookTranslator.test.d.ts +6 -0
- package/dist/src/hooks/hookTranslator.test.js +192 -0
- package/dist/src/hooks/hookTranslator.test.js.map +1 -0
- package/dist/src/hooks/types.d.ts +384 -0
- package/dist/src/hooks/types.js +284 -0
- package/dist/src/hooks/types.js.map +1 -0
- package/dist/src/hooks/types.test.d.ts +6 -0
- package/dist/src/hooks/types.test.js +35 -0
- package/dist/src/hooks/types.test.js.map +1 -0
- package/dist/src/index.d.ts +11 -0
- package/dist/src/index.js +14 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/google-auth-provider.d.ts +2 -0
- package/dist/src/mcp/google-auth-provider.js +21 -3
- package/dist/src/mcp/google-auth-provider.js.map +1 -1
- package/dist/src/mcp/google-auth-provider.test.js +42 -9
- package/dist/src/mcp/google-auth-provider.test.js.map +1 -1
- package/dist/src/mcp/mcpLauncher.d.ts +26 -0
- package/dist/src/mcp/mcpLauncher.js +238 -0
- package/dist/src/mcp/mcpLauncher.js.map +1 -0
- package/dist/src/mcp/oauth-provider.d.ts +8 -5
- package/dist/src/mcp/oauth-provider.js +120 -36
- package/dist/src/mcp/oauth-provider.js.map +1 -1
- package/dist/src/mcp/oauth-provider.test.js +191 -2
- package/dist/src/mcp/oauth-provider.test.js.map +1 -1
- package/dist/src/mcp/oauth-token-storage.js +5 -4
- package/dist/src/mcp/oauth-token-storage.js.map +1 -1
- package/dist/src/mcp/oauth-token-storage.test.js +17 -11
- package/dist/src/mcp/oauth-token-storage.test.js.map +1 -1
- package/dist/src/mcp/oauth-utils.d.ts +7 -0
- package/dist/src/mcp/oauth-utils.js +19 -0
- package/dist/src/mcp/oauth-utils.js.map +1 -1
- package/dist/src/mcp/oauth-utils.test.js +32 -0
- package/dist/src/mcp/oauth-utils.test.js.map +1 -1
- package/dist/src/mcp/sa-impersonation-provider.d.ts +0 -6
- package/dist/src/mcp/sa-impersonation-provider.js +6 -23
- package/dist/src/mcp/sa-impersonation-provider.js.map +1 -1
- package/dist/src/mcp/token-storage/base-token-storage.test.js +75 -84
- package/dist/src/mcp/token-storage/base-token-storage.test.js.map +1 -1
- package/dist/src/mcp/token-storage/file-token-storage.js +1 -1
- package/dist/src/mcp/token-storage/file-token-storage.js.map +1 -1
- package/dist/src/mcp/token-storage/file-token-storage.test.js +7 -5
- package/dist/src/mcp/token-storage/file-token-storage.test.js.map +1 -1
- package/dist/src/mcp/token-storage/hybrid-token-storage.js +1 -1
- package/dist/src/mcp/token-storage/hybrid-token-storage.js.map +1 -1
- package/dist/src/mcp/token-storage/hybrid-token-storage.test.js +2 -2
- package/dist/src/mcp/token-storage/hybrid-token-storage.test.js.map +1 -1
- package/dist/src/mcp/token-storage/keychain-token-storage.d.ts +6 -2
- package/dist/src/mcp/token-storage/keychain-token-storage.js +63 -7
- package/dist/src/mcp/token-storage/keychain-token-storage.js.map +1 -1
- package/dist/src/mcp/token-storage/keychain-token-storage.test.js +54 -3
- package/dist/src/mcp/token-storage/keychain-token-storage.test.js.map +1 -1
- package/dist/src/mcp/token-storage/types.d.ts +6 -0
- package/dist/src/mcp/token-storage/types.js.map +1 -1
- package/dist/src/policy/config.d.ts +31 -0
- package/dist/src/policy/config.js +197 -0
- package/dist/src/policy/config.js.map +1 -0
- package/dist/src/policy/config.test.d.ts +6 -0
- package/dist/src/policy/config.test.js +404 -0
- package/dist/src/policy/config.test.js.map +1 -0
- package/dist/src/policy/index.d.ts +2 -0
- package/dist/src/policy/index.js +2 -0
- package/dist/src/policy/index.js.map +1 -1
- package/dist/src/policy/policies/read-only.toml +56 -0
- package/dist/src/policy/policies/write.toml +63 -0
- package/dist/src/policy/policies/yolo.toml +31 -0
- package/dist/src/policy/policy-engine.js +4 -0
- package/dist/src/policy/policy-engine.js.map +1 -1
- package/dist/src/policy/toml-loader.d.ts +46 -0
- package/dist/src/policy/toml-loader.js +314 -0
- package/dist/src/policy/toml-loader.js.map +1 -0
- package/dist/src/policy/toml-loader.test.d.ts +6 -0
- package/dist/src/policy/toml-loader.test.js +522 -0
- package/dist/src/policy/toml-loader.test.js.map +1 -0
- package/dist/src/policy/types.d.ts +18 -0
- package/dist/src/policy/types.js +6 -0
- package/dist/src/policy/types.js.map +1 -1
- package/dist/src/services/chatCompressionService.d.ts +32 -0
- package/dist/src/services/chatCompressionService.js +162 -0
- package/dist/src/services/chatCompressionService.js.map +1 -0
- package/dist/src/services/chatCompressionService.test.d.ts +6 -0
- package/dist/src/services/chatCompressionService.test.js +209 -0
- package/dist/src/services/chatCompressionService.test.js.map +1 -0
- package/dist/src/services/chatRecordingService.js +9 -8
- package/dist/src/services/chatRecordingService.js.map +1 -1
- package/dist/src/services/fileDiscoveryService.d.ts +2 -14
- package/dist/src/services/fileDiscoveryService.js +19 -55
- package/dist/src/services/fileDiscoveryService.js.map +1 -1
- package/dist/src/services/fileDiscoveryService.test.js +91 -11
- package/dist/src/services/fileDiscoveryService.test.js.map +1 -1
- package/dist/src/services/loopDetectionService.d.ts +1 -1
- package/dist/src/services/loopDetectionService.js +26 -13
- package/dist/src/services/loopDetectionService.js.map +1 -1
- package/dist/src/services/loopDetectionService.test.js +119 -11
- package/dist/src/services/loopDetectionService.test.js.map +1 -1
- package/dist/src/services/shellExecutionService.js +22 -6
- package/dist/src/services/shellExecutionService.js.map +1 -1
- package/dist/src/services/shellExecutionService.test.js +32 -6
- package/dist/src/services/shellExecutionService.test.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +4 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +84 -33
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +40 -61
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +4 -1
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +6 -0
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -1
- package/dist/src/telemetry/gcp-exporters.js +0 -1
- package/dist/src/telemetry/gcp-exporters.js.map +1 -1
- package/dist/src/telemetry/gcp-exporters.test.js +1 -1
- package/dist/src/telemetry/gcp-exporters.test.js.map +1 -1
- package/dist/src/telemetry/index.d.ts +2 -1
- package/dist/src/telemetry/index.js +3 -2
- package/dist/src/telemetry/index.js.map +1 -1
- package/dist/src/telemetry/loggers.d.ts +2 -1
- package/dist/src/telemetry/loggers.js +37 -26
- package/dist/src/telemetry/loggers.js.map +1 -1
- package/dist/src/telemetry/loggers.test.js +199 -44
- package/dist/src/telemetry/loggers.test.js.map +1 -1
- package/dist/src/telemetry/metrics.d.ts +55 -6
- package/dist/src/telemetry/metrics.js +89 -1
- package/dist/src/telemetry/metrics.js.map +1 -1
- package/dist/src/telemetry/metrics.test.js +172 -213
- package/dist/src/telemetry/metrics.test.js.map +1 -1
- package/dist/src/telemetry/semantic.d.ts +82 -0
- package/dist/src/telemetry/semantic.js +269 -0
- package/dist/src/telemetry/semantic.js.map +1 -0
- package/dist/src/telemetry/semantic.test.d.ts +6 -0
- package/dist/src/telemetry/semantic.test.js +387 -0
- package/dist/src/telemetry/semantic.test.js.map +1 -0
- package/dist/src/telemetry/telemetry-utils.test.js +29 -28
- package/dist/src/telemetry/telemetry-utils.test.js.map +1 -1
- package/dist/src/telemetry/trace.d.ts +46 -0
- package/dist/src/telemetry/trace.js +121 -0
- package/dist/src/telemetry/trace.js.map +1 -0
- package/dist/src/telemetry/types.d.ts +64 -28
- package/dist/src/telemetry/types.js +163 -55
- package/dist/src/telemetry/types.js.map +1 -1
- package/dist/src/telemetry/uiTelemetry.js +6 -6
- package/dist/src/telemetry/uiTelemetry.js.map +1 -1
- package/dist/src/telemetry/uiTelemetry.test.js +88 -66
- package/dist/src/telemetry/uiTelemetry.test.js.map +1 -1
- package/dist/src/tools/edit.d.ts +3 -2
- package/dist/src/tools/edit.js +16 -12
- package/dist/src/tools/edit.js.map +1 -1
- package/dist/src/tools/edit.test.js +78 -1
- package/dist/src/tools/edit.test.js.map +1 -1
- package/dist/src/tools/glob.js +9 -13
- package/dist/src/tools/glob.js.map +1 -1
- package/dist/src/tools/glob.test.js +203 -199
- package/dist/src/tools/glob.test.js.map +1 -1
- package/dist/src/tools/grep.js +2 -2
- package/dist/src/tools/grep.js.map +1 -1
- package/dist/src/tools/ls.js +7 -13
- package/dist/src/tools/ls.js.map +1 -1
- package/dist/src/tools/ls.test.js +2 -9
- package/dist/src/tools/ls.test.js.map +1 -1
- package/dist/src/tools/mcp-client-manager.d.ts +49 -4
- package/dist/src/tools/mcp-client-manager.js +209 -23
- package/dist/src/tools/mcp-client-manager.js.map +1 -1
- package/dist/src/tools/mcp-client-manager.test.js +130 -33
- package/dist/src/tools/mcp-client-manager.test.js.map +1 -1
- package/dist/src/tools/mcp-client.d.ts +5 -1
- package/dist/src/tools/mcp-client.js +72 -92
- package/dist/src/tools/mcp-client.js.map +1 -1
- package/dist/src/tools/mcp-client.test.js +65 -6
- package/dist/src/tools/mcp-client.test.js.map +1 -1
- package/dist/src/tools/mcp-tool.d.ts +4 -2
- package/dist/src/tools/mcp-tool.js +14 -10
- package/dist/src/tools/mcp-tool.js.map +1 -1
- package/dist/src/tools/memoryTool.d.ts +5 -3
- package/dist/src/tools/memoryTool.js +10 -8
- package/dist/src/tools/memoryTool.js.map +1 -1
- package/dist/src/tools/modifiable-tool.js +3 -2
- package/dist/src/tools/modifiable-tool.js.map +1 -1
- package/dist/src/tools/read-file.js +7 -3
- package/dist/src/tools/read-file.js.map +1 -1
- package/dist/src/tools/read-file.test.js +25 -2
- package/dist/src/tools/read-file.test.js.map +1 -1
- package/dist/src/tools/read-many-files.js +8 -29
- package/dist/src/tools/read-many-files.js.map +1 -1
- package/dist/src/tools/shell.d.ts +6 -4
- package/dist/src/tools/shell.js +23 -16
- package/dist/src/tools/shell.js.map +1 -1
- package/dist/src/tools/shell.test.js +8 -1
- package/dist/src/tools/shell.test.js.map +1 -1
- package/dist/src/tools/smart-edit.d.ts +3 -2
- package/dist/src/tools/smart-edit.js +23 -12
- package/dist/src/tools/smart-edit.js.map +1 -1
- package/dist/src/tools/smart-edit.test.js +62 -1
- package/dist/src/tools/smart-edit.test.js.map +1 -1
- package/dist/src/tools/tool-registry.d.ts +6 -19
- package/dist/src/tools/tool-registry.js +11 -47
- package/dist/src/tools/tool-registry.js.map +1 -1
- package/dist/src/tools/tool-registry.test.js +2 -24
- package/dist/src/tools/tool-registry.test.js.map +1 -1
- package/dist/src/tools/tools.d.ts +8 -1
- package/dist/src/tools/tools.js +32 -18
- package/dist/src/tools/tools.js.map +1 -1
- package/dist/src/tools/web-fetch.js +4 -18
- package/dist/src/tools/web-fetch.js.map +1 -1
- package/dist/src/tools/web-fetch.test.js +3 -3
- package/dist/src/tools/web-fetch.test.js.map +1 -1
- package/dist/src/tools/write-file.d.ts +2 -1
- package/dist/src/tools/write-file.js +7 -7
- package/dist/src/tools/write-file.js.map +1 -1
- package/dist/src/tools/write-file.test.js +1 -1
- package/dist/src/tools/write-file.test.js.map +1 -1
- package/dist/src/tools/write-todos.d.ts +2 -1
- package/dist/src/tools/write-todos.js +5 -2
- package/dist/src/tools/write-todos.js.map +1 -1
- package/dist/src/utils/channel.d.ts +19 -0
- package/dist/src/utils/channel.js +49 -0
- package/dist/src/utils/channel.js.map +1 -0
- package/dist/src/utils/channel.test.d.ts +6 -0
- package/dist/src/utils/channel.test.js +170 -0
- package/dist/src/utils/channel.test.js.map +1 -0
- package/dist/src/utils/environmentContext.d.ts +2 -1
- package/dist/src/utils/environmentContext.js +18 -0
- package/dist/src/utils/environmentContext.js.map +1 -1
- package/dist/src/utils/errorParsing.d.ts +1 -1
- package/dist/src/utils/errorParsing.js +5 -33
- package/dist/src/utils/errorParsing.js.map +1 -1
- package/dist/src/utils/errorParsing.test.js +0 -88
- package/dist/src/utils/errorParsing.test.js.map +1 -1
- package/dist/src/utils/errors.d.ts +3 -0
- package/dist/src/utils/errors.js +6 -0
- package/dist/src/utils/errors.js.map +1 -1
- package/dist/src/utils/events.d.ts +88 -0
- package/dist/src/utils/events.js +77 -0
- package/dist/src/utils/events.js.map +1 -0
- package/dist/src/utils/events.test.d.ts +6 -0
- package/dist/src/utils/events.test.js +131 -0
- package/dist/src/utils/events.test.js.map +1 -0
- package/dist/src/utils/extensionLoader.d.ts +78 -0
- package/dist/src/utils/extensionLoader.js +162 -0
- package/dist/src/utils/extensionLoader.js.map +1 -0
- package/dist/src/utils/extensionLoader.test.d.ts +6 -0
- package/dist/src/utils/extensionLoader.test.js +90 -0
- package/dist/src/utils/extensionLoader.test.js.map +1 -0
- package/dist/src/utils/fetch.js +1 -6
- package/dist/src/utils/fetch.js.map +1 -1
- package/dist/src/utils/flashFallback.test.js +26 -45
- package/dist/src/utils/flashFallback.test.js.map +1 -1
- package/dist/src/utils/getFolderStructure.js +7 -16
- package/dist/src/utils/getFolderStructure.js.map +1 -1
- package/dist/src/utils/gitIgnoreParser.d.ts +4 -1
- package/dist/src/utils/gitIgnoreParser.js +21 -4
- package/dist/src/utils/gitIgnoreParser.js.map +1 -1
- package/dist/src/utils/gitIgnoreParser.test.js +28 -0
- package/dist/src/utils/gitIgnoreParser.test.js.map +1 -1
- package/dist/src/utils/googleErrors.d.ts +104 -0
- package/dist/src/utils/googleErrors.js +152 -0
- package/dist/src/utils/googleErrors.js.map +1 -0
- package/dist/src/utils/googleErrors.test.d.ts +6 -0
- package/dist/src/utils/googleErrors.test.js +301 -0
- package/dist/src/utils/googleErrors.test.js.map +1 -0
- package/dist/src/utils/googleQuotaErrors.d.ts +36 -0
- package/dist/src/utils/googleQuotaErrors.js +149 -0
- package/dist/src/utils/googleQuotaErrors.js.map +1 -0
- package/dist/src/utils/googleQuotaErrors.test.d.ts +6 -0
- package/dist/src/utils/googleQuotaErrors.test.js +311 -0
- package/dist/src/utils/googleQuotaErrors.test.js.map +1 -0
- package/dist/src/utils/ignorePatterns.test.js +26 -30
- package/dist/src/utils/ignorePatterns.test.js.map +1 -1
- package/dist/src/utils/installationManager.js +2 -1
- package/dist/src/utils/installationManager.js.map +1 -1
- package/dist/src/utils/installationManager.test.js +3 -3
- package/dist/src/utils/installationManager.test.js.map +1 -1
- package/dist/src/utils/llm-edit-fixer.d.ts +1 -1
- package/dist/src/utils/llm-edit-fixer.js +27 -3
- package/dist/src/utils/llm-edit-fixer.js.map +1 -1
- package/dist/src/utils/llm-edit-fixer.test.js +21 -0
- package/dist/src/utils/llm-edit-fixer.test.js.map +1 -1
- package/dist/src/utils/memoryDiscovery.d.ts +11 -2
- package/dist/src/utils/memoryDiscovery.js +140 -2
- package/dist/src/utils/memoryDiscovery.js.map +1 -1
- package/dist/src/utils/memoryDiscovery.test.js +153 -37
- package/dist/src/utils/memoryDiscovery.test.js.map +1 -1
- package/dist/src/utils/package.d.ts +12 -0
- package/dist/src/utils/package.js +15 -0
- package/dist/src/utils/package.js.map +1 -0
- package/dist/src/utils/paths.js +126 -26
- package/dist/src/utils/paths.js.map +1 -1
- package/dist/src/utils/paths.test.js +200 -68
- package/dist/src/utils/paths.test.js.map +1 -1
- package/dist/src/utils/quotaErrorDetection.d.ts +0 -2
- package/dist/src/utils/quotaErrorDetection.js +0 -46
- package/dist/src/utils/quotaErrorDetection.js.map +1 -1
- package/dist/src/utils/retry.js +41 -145
- package/dist/src/utils/retry.js.map +1 -1
- package/dist/src/utils/retry.test.js +31 -110
- package/dist/src/utils/retry.test.js.map +1 -1
- package/dist/src/utils/shell-utils.js +29 -1
- package/dist/src/utils/shell-utils.js.map +1 -1
- package/dist/src/utils/shell-utils.test.js +88 -0
- package/dist/src/utils/shell-utils.test.js.map +1 -1
- package/dist/src/utils/summarizer.js +2 -1
- package/dist/src/utils/summarizer.js.map +1 -1
- package/dist/src/utils/summarizer.test.js +0 -1
- package/dist/src/utils/summarizer.test.js.map +1 -1
- package/dist/src/utils/workspaceContext.js +1 -1
- package/dist/src/utils/workspaceContext.js.map +1 -1
- package/dist/src/utils/workspaceContext.test.js +2 -2
- package/dist/src/utils/workspaceContext.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -3
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import type { GenerateContentResponseUsageMetadata } from '@google/genai';
|
|
6
|
+
import type { Candidate, Content, GenerateContentConfig, GenerateContentResponseUsageMetadata } from '@google/genai';
|
|
7
7
|
import type { Config } from '../config/config.js';
|
|
8
|
-
import type { ApprovalMode } from '../
|
|
8
|
+
import type { ApprovalMode } from '../policy/types.js';
|
|
9
9
|
import type { CompletedToolCall } from '../core/coreToolScheduler.js';
|
|
10
|
-
import type { LogAttributes } from '@opentelemetry/api-logs';
|
|
10
|
+
import type { LogAttributes, LogRecord } from '@opentelemetry/api-logs';
|
|
11
11
|
import { ToolCallDecision } from './tool-call-decision.js';
|
|
12
|
-
import type
|
|
12
|
+
import { type FileOperation } from './metrics.js';
|
|
13
13
|
export { ToolCallDecision };
|
|
14
14
|
import type { ToolRegistry } from '../tools/tool-registry.js';
|
|
15
15
|
import type { OutputFormat } from '../output/types.js';
|
|
@@ -41,7 +41,9 @@ export declare class StartSessionEvent implements BaseTelemetryEvent {
|
|
|
41
41
|
mcp_tools?: string;
|
|
42
42
|
output_format: OutputFormat;
|
|
43
43
|
extensions_count: number;
|
|
44
|
+
extensions: string;
|
|
44
45
|
extension_ids: string;
|
|
46
|
+
auth_type?: string;
|
|
45
47
|
constructor(config: Config, toolRegistry?: ToolRegistry);
|
|
46
48
|
toOpenTelemetryAttributes(config: Config): LogAttributes;
|
|
47
49
|
toLogBody(): string;
|
|
@@ -79,6 +81,7 @@ export declare class ToolCallEvent implements BaseTelemetryEvent {
|
|
|
79
81
|
tool_type: 'native' | 'mcp';
|
|
80
82
|
content_length?: number;
|
|
81
83
|
mcp_server_name?: string;
|
|
84
|
+
extension_name?: string;
|
|
82
85
|
extension_id?: string;
|
|
83
86
|
metadata?: {
|
|
84
87
|
[key: string]: any;
|
|
@@ -104,35 +107,54 @@ export declare class ApiErrorEvent implements BaseTelemetryEvent {
|
|
|
104
107
|
'event.name': 'api_error';
|
|
105
108
|
'event.timestamp': string;
|
|
106
109
|
model: string;
|
|
110
|
+
prompt: GenAIPromptDetails;
|
|
107
111
|
error: string;
|
|
108
112
|
error_type?: string;
|
|
109
113
|
status_code?: number | string;
|
|
110
114
|
duration_ms: number;
|
|
111
|
-
prompt_id: string;
|
|
112
115
|
auth_type?: string;
|
|
113
|
-
constructor(model: string, error: string, duration_ms: number,
|
|
114
|
-
|
|
115
|
-
|
|
116
|
+
constructor(model: string, error: string, duration_ms: number, prompt_details: GenAIPromptDetails, auth_type?: string, error_type?: string, status_code?: number | string);
|
|
117
|
+
toLogRecord(config: Config): LogRecord;
|
|
118
|
+
toSemanticLogRecord(config: Config): LogRecord;
|
|
116
119
|
}
|
|
117
|
-
export
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
120
|
+
export interface ServerDetails {
|
|
121
|
+
address: string;
|
|
122
|
+
port: number;
|
|
123
|
+
}
|
|
124
|
+
export interface GenAIPromptDetails {
|
|
125
|
+
prompt_id: string;
|
|
126
|
+
contents: Content[];
|
|
127
|
+
generate_content_config?: GenerateContentConfig;
|
|
128
|
+
server?: ServerDetails;
|
|
129
|
+
}
|
|
130
|
+
export interface GenAIResponseDetails {
|
|
131
|
+
response_id?: string;
|
|
132
|
+
candidates?: Candidate[];
|
|
133
|
+
}
|
|
134
|
+
export interface GenAIUsageDetails {
|
|
124
135
|
input_token_count: number;
|
|
125
136
|
output_token_count: number;
|
|
126
137
|
cached_content_token_count: number;
|
|
127
138
|
thoughts_token_count: number;
|
|
128
139
|
tool_token_count: number;
|
|
129
140
|
total_token_count: number;
|
|
141
|
+
}
|
|
142
|
+
export declare const EVENT_API_RESPONSE = "gemini_cli.api_response";
|
|
143
|
+
export declare const EVENT_GEN_AI_OPERATION_DETAILS = "gen_ai.client.inference.operation.details";
|
|
144
|
+
export declare class ApiResponseEvent implements BaseTelemetryEvent {
|
|
145
|
+
'event.name': 'api_response';
|
|
146
|
+
'event.timestamp': string;
|
|
147
|
+
status_code?: number | string;
|
|
148
|
+
duration_ms: number;
|
|
130
149
|
response_text?: string;
|
|
131
|
-
prompt_id: string;
|
|
132
150
|
auth_type?: string;
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
151
|
+
model: string;
|
|
152
|
+
prompt: GenAIPromptDetails;
|
|
153
|
+
response: GenAIResponseDetails;
|
|
154
|
+
usage: GenAIUsageDetails;
|
|
155
|
+
constructor(model: string, duration_ms: number, prompt_details: GenAIPromptDetails, response_details: GenAIResponseDetails, auth_type?: string, usage_data?: GenerateContentResponseUsageMetadata, response_text?: string);
|
|
156
|
+
toLogRecord(config: Config): LogRecord;
|
|
157
|
+
toSemanticLogRecord(config: Config): LogRecord;
|
|
136
158
|
}
|
|
137
159
|
export declare const EVENT_FLASH_FALLBACK = "gemini_cli.flash_fallback";
|
|
138
160
|
export declare class FlashFallbackEvent implements BaseTelemetryEvent {
|
|
@@ -392,7 +414,7 @@ export declare class ModelSlashCommandEvent implements BaseTelemetryEvent {
|
|
|
392
414
|
toOpenTelemetryAttributes(config: Config): LogAttributes;
|
|
393
415
|
toLogBody(): string;
|
|
394
416
|
}
|
|
395
|
-
export type TelemetryEvent = StartSessionEvent | EndSessionEvent | UserPromptEvent | ToolCallEvent | ApiRequestEvent | ApiErrorEvent | ApiResponseEvent | FlashFallbackEvent | LoopDetectedEvent | LoopDetectionDisabledEvent | NextSpeakerCheckEvent | KittySequenceOverflowEvent | MalformedJsonResponseEvent | IdeConnectionEvent | ConversationFinishedEvent | SlashCommandEvent | FileOperationEvent | InvalidChunkEvent | ContentRetryEvent | ContentRetryFailureEvent | ExtensionEnableEvent | ExtensionInstallEvent | ExtensionUninstallEvent | ModelRoutingEvent | ToolOutputTruncatedEvent | ModelSlashCommandEvent | AgentStartEvent | AgentFinishEvent | WebFetchFallbackAttemptEvent;
|
|
417
|
+
export type TelemetryEvent = StartSessionEvent | EndSessionEvent | UserPromptEvent | ToolCallEvent | ApiRequestEvent | ApiErrorEvent | ApiResponseEvent | FlashFallbackEvent | LoopDetectedEvent | LoopDetectionDisabledEvent | NextSpeakerCheckEvent | KittySequenceOverflowEvent | MalformedJsonResponseEvent | IdeConnectionEvent | ConversationFinishedEvent | SlashCommandEvent | FileOperationEvent | InvalidChunkEvent | ContentRetryEvent | ContentRetryFailureEvent | ExtensionEnableEvent | ExtensionInstallEvent | ExtensionUninstallEvent | ModelRoutingEvent | ToolOutputTruncatedEvent | ModelSlashCommandEvent | AgentStartEvent | AgentFinishEvent | RecoveryAttemptEvent | WebFetchFallbackAttemptEvent;
|
|
396
418
|
export declare const EVENT_EXTENSION_DISABLE = "gemini_cli.extension_disable";
|
|
397
419
|
export declare class ExtensionDisableEvent implements BaseTelemetryEvent {
|
|
398
420
|
'event.name': 'extension_disable';
|
|
@@ -422,22 +444,25 @@ export declare class SmartEditCorrectionEvent implements BaseTelemetryEvent {
|
|
|
422
444
|
toOpenTelemetryAttributes(config: Config): LogAttributes;
|
|
423
445
|
toLogBody(): string;
|
|
424
446
|
}
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
'event.name': 'agent_start';
|
|
447
|
+
declare abstract class BaseAgentEvent implements BaseTelemetryEvent {
|
|
448
|
+
abstract 'event.name': 'agent_start' | 'agent_finish' | 'agent_recovery_attempt';
|
|
428
449
|
'event.timestamp': string;
|
|
429
450
|
agent_id: string;
|
|
430
451
|
agent_name: string;
|
|
431
452
|
constructor(agent_id: string, agent_name: string);
|
|
432
453
|
toOpenTelemetryAttributes(config: Config): LogAttributes;
|
|
454
|
+
abstract toLogBody(): string;
|
|
455
|
+
}
|
|
456
|
+
export declare const EVENT_AGENT_START = "gemini_cli.agent.start";
|
|
457
|
+
export declare class AgentStartEvent extends BaseAgentEvent {
|
|
458
|
+
'event.name': "agent_start";
|
|
459
|
+
constructor(agent_id: string, agent_name: string);
|
|
460
|
+
toOpenTelemetryAttributes(config: Config): LogAttributes;
|
|
433
461
|
toLogBody(): string;
|
|
434
462
|
}
|
|
435
463
|
export declare const EVENT_AGENT_FINISH = "gemini_cli.agent.finish";
|
|
436
|
-
export declare class AgentFinishEvent
|
|
437
|
-
'event.name':
|
|
438
|
-
'event.timestamp': string;
|
|
439
|
-
agent_id: string;
|
|
440
|
-
agent_name: string;
|
|
464
|
+
export declare class AgentFinishEvent extends BaseAgentEvent {
|
|
465
|
+
'event.name': "agent_finish";
|
|
441
466
|
duration_ms: number;
|
|
442
467
|
turn_count: number;
|
|
443
468
|
terminate_reason: AgentTerminateMode;
|
|
@@ -445,6 +470,17 @@ export declare class AgentFinishEvent implements BaseTelemetryEvent {
|
|
|
445
470
|
toOpenTelemetryAttributes(config: Config): LogAttributes;
|
|
446
471
|
toLogBody(): string;
|
|
447
472
|
}
|
|
473
|
+
export declare const EVENT_AGENT_RECOVERY_ATTEMPT = "gemini_cli.agent.recovery_attempt";
|
|
474
|
+
export declare class RecoveryAttemptEvent extends BaseAgentEvent {
|
|
475
|
+
'event.name': "agent_recovery_attempt";
|
|
476
|
+
reason: AgentTerminateMode;
|
|
477
|
+
duration_ms: number;
|
|
478
|
+
success: boolean;
|
|
479
|
+
turn_count: number;
|
|
480
|
+
constructor(agent_id: string, agent_name: string, reason: AgentTerminateMode, duration_ms: number, success: boolean, turn_count: number);
|
|
481
|
+
toOpenTelemetryAttributes(config: Config): LogAttributes;
|
|
482
|
+
toLogBody(): string;
|
|
483
|
+
}
|
|
448
484
|
export declare const EVENT_WEB_FETCH_FALLBACK_ATTEMPT = "gemini_cli.web_fetch_fallback_attempt";
|
|
449
485
|
export declare class WebFetchFallbackAttemptEvent implements BaseTelemetryEvent {
|
|
450
486
|
'event.name': 'web_fetch_fallback_attempt';
|
|
@@ -6,10 +6,12 @@
|
|
|
6
6
|
import { DiscoveredMCPTool } from '../tools/mcp-tool.js';
|
|
7
7
|
import { AuthType } from '../core/contentGenerator.js';
|
|
8
8
|
import { getDecisionFromOutcome, ToolCallDecision, } from './tool-call-decision.js';
|
|
9
|
+
import { getConventionAttributes } from './metrics.js';
|
|
9
10
|
export { ToolCallDecision };
|
|
10
11
|
import { getCommonAttributes } from './telemetryAttributes.js';
|
|
11
12
|
import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
|
|
12
13
|
import { safeJsonStringify } from '../utils/safeJsonStringify.js';
|
|
14
|
+
import { toInputMessages, toOutputMessages, toFinishReasons, toOutputType, toSystemInstruction, } from './semantic.js';
|
|
13
15
|
export const EVENT_CLI_CONFIG = 'gemini_cli.config';
|
|
14
16
|
export class StartSessionEvent {
|
|
15
17
|
'event.name';
|
|
@@ -31,10 +33,12 @@ export class StartSessionEvent {
|
|
|
31
33
|
mcp_tools;
|
|
32
34
|
output_format;
|
|
33
35
|
extensions_count;
|
|
36
|
+
extensions;
|
|
34
37
|
extension_ids;
|
|
38
|
+
auth_type;
|
|
35
39
|
constructor(config, toolRegistry) {
|
|
36
40
|
const generatorConfig = config.getContentGeneratorConfig();
|
|
37
|
-
const mcpServers = config.getMcpServers();
|
|
41
|
+
const mcpServers = config.getMcpClientManager()?.getMcpServers() ?? config.getMcpServers();
|
|
38
42
|
let useGemini = false;
|
|
39
43
|
let useVertex = false;
|
|
40
44
|
if (generatorConfig && generatorConfig.authType) {
|
|
@@ -62,7 +66,9 @@ export class StartSessionEvent {
|
|
|
62
66
|
this.output_format = config.getOutputFormat();
|
|
63
67
|
const extensions = config.getExtensions();
|
|
64
68
|
this.extensions_count = extensions.length;
|
|
69
|
+
this.extensions = extensions.map((e) => e.name).join(',');
|
|
65
70
|
this.extension_ids = extensions.map((e) => e.id).join(',');
|
|
71
|
+
this.auth_type = generatorConfig?.authType;
|
|
66
72
|
if (toolRegistry) {
|
|
67
73
|
const mcpTools = toolRegistry
|
|
68
74
|
.getAllTools()
|
|
@@ -93,8 +99,10 @@ export class StartSessionEvent {
|
|
|
93
99
|
mcp_tools: this.mcp_tools,
|
|
94
100
|
mcp_tools_count: this.mcp_tools_count,
|
|
95
101
|
output_format: this.output_format,
|
|
102
|
+
extensions: this.extensions,
|
|
96
103
|
extensions_count: this.extensions_count,
|
|
97
104
|
extension_ids: this.extension_ids,
|
|
105
|
+
auth_type: this.auth_type,
|
|
98
106
|
};
|
|
99
107
|
}
|
|
100
108
|
toLogBody() {
|
|
@@ -162,6 +170,7 @@ export class ToolCallEvent {
|
|
|
162
170
|
tool_type;
|
|
163
171
|
content_length;
|
|
164
172
|
mcp_server_name;
|
|
173
|
+
extension_name;
|
|
165
174
|
extension_id;
|
|
166
175
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
167
176
|
metadata;
|
|
@@ -184,6 +193,7 @@ export class ToolCallEvent {
|
|
|
184
193
|
call.tool instanceof DiscoveredMCPTool) {
|
|
185
194
|
this.tool_type = 'mcp';
|
|
186
195
|
this.mcp_server_name = call.tool.serverName;
|
|
196
|
+
this.extension_name = call.tool.extensionName;
|
|
187
197
|
this.extension_id = call.tool.extensionId;
|
|
188
198
|
}
|
|
189
199
|
else {
|
|
@@ -232,6 +242,7 @@ export class ToolCallEvent {
|
|
|
232
242
|
tool_type: this.tool_type,
|
|
233
243
|
content_length: this.content_length,
|
|
234
244
|
mcp_server_name: this.mcp_server_name,
|
|
245
|
+
extension_name: this.extension_name,
|
|
235
246
|
extension_id: this.extension_id,
|
|
236
247
|
metadata: this.metadata,
|
|
237
248
|
};
|
|
@@ -282,13 +293,13 @@ export class ApiErrorEvent {
|
|
|
282
293
|
'event.name';
|
|
283
294
|
'event.timestamp';
|
|
284
295
|
model;
|
|
296
|
+
prompt;
|
|
285
297
|
error;
|
|
286
298
|
error_type;
|
|
287
299
|
status_code;
|
|
288
300
|
duration_ms;
|
|
289
|
-
prompt_id;
|
|
290
301
|
auth_type;
|
|
291
|
-
constructor(model, error, duration_ms,
|
|
302
|
+
constructor(model, error, duration_ms, prompt_details, auth_type, error_type, status_code) {
|
|
292
303
|
this['event.name'] = 'api_error';
|
|
293
304
|
this['event.timestamp'] = new Date().toISOString();
|
|
294
305
|
this.model = model;
|
|
@@ -296,10 +307,10 @@ export class ApiErrorEvent {
|
|
|
296
307
|
this.error_type = error_type;
|
|
297
308
|
this.status_code = status_code;
|
|
298
309
|
this.duration_ms = duration_ms;
|
|
299
|
-
this.
|
|
310
|
+
this.prompt = prompt_details;
|
|
300
311
|
this.auth_type = auth_type;
|
|
301
312
|
}
|
|
302
|
-
|
|
313
|
+
toLogRecord(config) {
|
|
303
314
|
const attributes = {
|
|
304
315
|
...getCommonAttributes(config),
|
|
305
316
|
'event.name': EVENT_API_ERROR,
|
|
@@ -311,7 +322,7 @@ export class ApiErrorEvent {
|
|
|
311
322
|
error: this.error,
|
|
312
323
|
status_code: this.status_code,
|
|
313
324
|
duration_ms: this.duration_ms,
|
|
314
|
-
prompt_id: this.prompt_id,
|
|
325
|
+
prompt_id: this.prompt.prompt_id,
|
|
315
326
|
auth_type: this.auth_type,
|
|
316
327
|
};
|
|
317
328
|
if (this.error_type) {
|
|
@@ -320,58 +331,98 @@ export class ApiErrorEvent {
|
|
|
320
331
|
if (typeof this.status_code === 'number') {
|
|
321
332
|
attributes[SemanticAttributes.HTTP_STATUS_CODE] = this.status_code;
|
|
322
333
|
}
|
|
323
|
-
|
|
334
|
+
const logRecord = {
|
|
335
|
+
body: `API error for ${this.model}. Error: ${this.error}. Duration: ${this.duration_ms}ms.`,
|
|
336
|
+
attributes,
|
|
337
|
+
};
|
|
338
|
+
return logRecord;
|
|
324
339
|
}
|
|
325
|
-
|
|
326
|
-
|
|
340
|
+
toSemanticLogRecord(config) {
|
|
341
|
+
const attributes = {
|
|
342
|
+
...getCommonAttributes(config),
|
|
343
|
+
'event.name': EVENT_GEN_AI_OPERATION_DETAILS,
|
|
344
|
+
'event.timestamp': this['event.timestamp'],
|
|
345
|
+
...toGenerateContentConfigAttributes(this.prompt.generate_content_config),
|
|
346
|
+
...getConventionAttributes(this),
|
|
347
|
+
};
|
|
348
|
+
if (this.prompt.server) {
|
|
349
|
+
attributes['server.address'] = this.prompt.server.address;
|
|
350
|
+
attributes['server.port'] = this.prompt.server.port;
|
|
351
|
+
}
|
|
352
|
+
if (config.getTelemetryLogPromptsEnabled() && this.prompt.contents) {
|
|
353
|
+
attributes['gen_ai.input.messages'] = JSON.stringify(toInputMessages(this.prompt.contents));
|
|
354
|
+
}
|
|
355
|
+
const logRecord = {
|
|
356
|
+
body: `GenAI operation error details from ${this.model}. Error: ${this.error}. Duration: ${this.duration_ms}ms.`,
|
|
357
|
+
attributes,
|
|
358
|
+
};
|
|
359
|
+
return logRecord;
|
|
327
360
|
}
|
|
328
361
|
}
|
|
329
362
|
export const EVENT_API_RESPONSE = 'gemini_cli.api_response';
|
|
363
|
+
export const EVENT_GEN_AI_OPERATION_DETAILS = 'gen_ai.client.inference.operation.details';
|
|
364
|
+
function toGenerateContentConfigAttributes(config) {
|
|
365
|
+
if (!config) {
|
|
366
|
+
return {};
|
|
367
|
+
}
|
|
368
|
+
return {
|
|
369
|
+
'gen_ai.request.temperature': config.temperature,
|
|
370
|
+
'gen_ai.request.top_p': config.topP,
|
|
371
|
+
'gen_ai.request.top_k': config.topK,
|
|
372
|
+
'gen_ai.request.choice.count': config.candidateCount,
|
|
373
|
+
'gen_ai.request.seed': config.seed,
|
|
374
|
+
'gen_ai.request.frequency_penalty': config.frequencyPenalty,
|
|
375
|
+
'gen_ai.request.presence_penalty': config.presencePenalty,
|
|
376
|
+
'gen_ai.request.max_tokens': config.maxOutputTokens,
|
|
377
|
+
'gen_ai.output.type': toOutputType(config.responseMimeType),
|
|
378
|
+
'gen_ai.request.stop_sequences': config.stopSequences,
|
|
379
|
+
'gen_ai.system_instructions': JSON.stringify(toSystemInstruction(config.systemInstruction)),
|
|
380
|
+
};
|
|
381
|
+
}
|
|
330
382
|
export class ApiResponseEvent {
|
|
331
383
|
'event.name';
|
|
332
384
|
'event.timestamp';
|
|
333
|
-
model;
|
|
334
385
|
status_code;
|
|
335
386
|
duration_ms;
|
|
336
|
-
input_token_count;
|
|
337
|
-
output_token_count;
|
|
338
|
-
cached_content_token_count;
|
|
339
|
-
thoughts_token_count;
|
|
340
|
-
tool_token_count;
|
|
341
|
-
total_token_count;
|
|
342
387
|
response_text;
|
|
343
|
-
prompt_id;
|
|
344
388
|
auth_type;
|
|
345
|
-
|
|
389
|
+
model;
|
|
390
|
+
prompt;
|
|
391
|
+
response;
|
|
392
|
+
usage;
|
|
393
|
+
constructor(model, duration_ms, prompt_details, response_details, auth_type, usage_data, response_text) {
|
|
346
394
|
this['event.name'] = 'api_response';
|
|
347
395
|
this['event.timestamp'] = new Date().toISOString();
|
|
348
|
-
this.model = model;
|
|
349
396
|
this.duration_ms = duration_ms;
|
|
350
397
|
this.status_code = 200;
|
|
351
|
-
this.input_token_count = usage_data?.promptTokenCount ?? 0;
|
|
352
|
-
this.output_token_count = usage_data?.candidatesTokenCount ?? 0;
|
|
353
|
-
this.cached_content_token_count = usage_data?.cachedContentTokenCount ?? 0;
|
|
354
|
-
this.thoughts_token_count = usage_data?.thoughtsTokenCount ?? 0;
|
|
355
|
-
this.tool_token_count = usage_data?.toolUsePromptTokenCount ?? 0;
|
|
356
|
-
this.total_token_count = usage_data?.totalTokenCount ?? 0;
|
|
357
398
|
this.response_text = response_text;
|
|
358
|
-
this.prompt_id = prompt_id;
|
|
359
399
|
this.auth_type = auth_type;
|
|
400
|
+
this.model = model;
|
|
401
|
+
this.prompt = prompt_details;
|
|
402
|
+
this.response = response_details;
|
|
403
|
+
this.usage = {
|
|
404
|
+
input_token_count: usage_data?.promptTokenCount ?? 0,
|
|
405
|
+
output_token_count: usage_data?.candidatesTokenCount ?? 0,
|
|
406
|
+
cached_content_token_count: usage_data?.cachedContentTokenCount ?? 0,
|
|
407
|
+
thoughts_token_count: usage_data?.thoughtsTokenCount ?? 0,
|
|
408
|
+
tool_token_count: usage_data?.toolUsePromptTokenCount ?? 0,
|
|
409
|
+
total_token_count: usage_data?.totalTokenCount ?? 0,
|
|
410
|
+
};
|
|
360
411
|
}
|
|
361
|
-
|
|
412
|
+
toLogRecord(config) {
|
|
362
413
|
const attributes = {
|
|
363
414
|
...getCommonAttributes(config),
|
|
364
415
|
'event.name': EVENT_API_RESPONSE,
|
|
365
416
|
'event.timestamp': this['event.timestamp'],
|
|
366
417
|
model: this.model,
|
|
367
418
|
duration_ms: this.duration_ms,
|
|
368
|
-
input_token_count: this.input_token_count,
|
|
369
|
-
output_token_count: this.output_token_count,
|
|
370
|
-
cached_content_token_count: this.cached_content_token_count,
|
|
371
|
-
thoughts_token_count: this.thoughts_token_count,
|
|
372
|
-
tool_token_count: this.tool_token_count,
|
|
373
|
-
total_token_count: this.total_token_count,
|
|
374
|
-
prompt_id: this.prompt_id,
|
|
419
|
+
input_token_count: this.usage.input_token_count,
|
|
420
|
+
output_token_count: this.usage.output_token_count,
|
|
421
|
+
cached_content_token_count: this.usage.cached_content_token_count,
|
|
422
|
+
thoughts_token_count: this.usage.thoughts_token_count,
|
|
423
|
+
tool_token_count: this.usage.tool_token_count,
|
|
424
|
+
total_token_count: this.usage.total_token_count,
|
|
425
|
+
prompt_id: this.prompt.prompt_id,
|
|
375
426
|
auth_type: this.auth_type,
|
|
376
427
|
status_code: this.status_code,
|
|
377
428
|
};
|
|
@@ -383,10 +434,39 @@ export class ApiResponseEvent {
|
|
|
383
434
|
attributes[SemanticAttributes.HTTP_STATUS_CODE] = this.status_code;
|
|
384
435
|
}
|
|
385
436
|
}
|
|
386
|
-
|
|
437
|
+
const logRecord = {
|
|
438
|
+
body: `API response from ${this.model}. Status: ${this.status_code || 'N/A'}. Duration: ${this.duration_ms}ms.`,
|
|
439
|
+
attributes,
|
|
440
|
+
};
|
|
441
|
+
return logRecord;
|
|
387
442
|
}
|
|
388
|
-
|
|
389
|
-
|
|
443
|
+
toSemanticLogRecord(config) {
|
|
444
|
+
const attributes = {
|
|
445
|
+
...getCommonAttributes(config),
|
|
446
|
+
'event.name': EVENT_GEN_AI_OPERATION_DETAILS,
|
|
447
|
+
'event.timestamp': this['event.timestamp'],
|
|
448
|
+
'gen_ai.response.id': this.response.response_id,
|
|
449
|
+
'gen_ai.response.finish_reasons': toFinishReasons(this.response.candidates),
|
|
450
|
+
'gen_ai.output.messages': JSON.stringify(toOutputMessages(this.response.candidates)),
|
|
451
|
+
...toGenerateContentConfigAttributes(this.prompt.generate_content_config),
|
|
452
|
+
...getConventionAttributes(this),
|
|
453
|
+
};
|
|
454
|
+
if (this.prompt.server) {
|
|
455
|
+
attributes['server.address'] = this.prompt.server.address;
|
|
456
|
+
attributes['server.port'] = this.prompt.server.port;
|
|
457
|
+
}
|
|
458
|
+
if (config.getTelemetryLogPromptsEnabled() && this.prompt.contents) {
|
|
459
|
+
attributes['gen_ai.input.messages'] = JSON.stringify(toInputMessages(this.prompt.contents));
|
|
460
|
+
}
|
|
461
|
+
if (this.usage) {
|
|
462
|
+
attributes['gen_ai.usage.input_tokens'] = this.usage.input_token_count;
|
|
463
|
+
attributes['gen_ai.usage.output_tokens'] = this.usage.output_token_count;
|
|
464
|
+
}
|
|
465
|
+
const logRecord = {
|
|
466
|
+
body: `GenAI operation details from ${this.model}. Status: ${this.status_code || 'N/A'}. Duration: ${this.duration_ms}ms.`,
|
|
467
|
+
attributes,
|
|
468
|
+
};
|
|
469
|
+
return logRecord;
|
|
390
470
|
}
|
|
391
471
|
}
|
|
392
472
|
export const EVENT_FLASH_FALLBACK = 'gemini_cli.flash_fallback';
|
|
@@ -1087,14 +1167,11 @@ export class SmartEditCorrectionEvent {
|
|
|
1087
1167
|
return `Smart Edit Tool Correction: ${this.correction}`;
|
|
1088
1168
|
}
|
|
1089
1169
|
}
|
|
1090
|
-
|
|
1091
|
-
export class AgentStartEvent {
|
|
1092
|
-
'event.name';
|
|
1170
|
+
class BaseAgentEvent {
|
|
1093
1171
|
'event.timestamp';
|
|
1094
1172
|
agent_id;
|
|
1095
1173
|
agent_name;
|
|
1096
1174
|
constructor(agent_id, agent_name) {
|
|
1097
|
-
this['event.name'] = 'agent_start';
|
|
1098
1175
|
this['event.timestamp'] = new Date().toISOString();
|
|
1099
1176
|
this.agent_id = agent_id;
|
|
1100
1177
|
this.agent_name = agent_name;
|
|
@@ -1102,41 +1179,44 @@ export class AgentStartEvent {
|
|
|
1102
1179
|
toOpenTelemetryAttributes(config) {
|
|
1103
1180
|
return {
|
|
1104
1181
|
...getCommonAttributes(config),
|
|
1105
|
-
'event.name': EVENT_AGENT_START,
|
|
1106
1182
|
'event.timestamp': this['event.timestamp'],
|
|
1107
1183
|
agent_id: this.agent_id,
|
|
1108
1184
|
agent_name: this.agent_name,
|
|
1109
1185
|
};
|
|
1110
1186
|
}
|
|
1187
|
+
}
|
|
1188
|
+
export const EVENT_AGENT_START = 'gemini_cli.agent.start';
|
|
1189
|
+
export class AgentStartEvent extends BaseAgentEvent {
|
|
1190
|
+
'event.name' = 'agent_start';
|
|
1191
|
+
constructor(agent_id, agent_name) {
|
|
1192
|
+
super(agent_id, agent_name);
|
|
1193
|
+
}
|
|
1194
|
+
toOpenTelemetryAttributes(config) {
|
|
1195
|
+
return {
|
|
1196
|
+
...super.toOpenTelemetryAttributes(config),
|
|
1197
|
+
'event.name': EVENT_AGENT_START,
|
|
1198
|
+
};
|
|
1199
|
+
}
|
|
1111
1200
|
toLogBody() {
|
|
1112
1201
|
return `Agent ${this.agent_name} started. ID: ${this.agent_id}`;
|
|
1113
1202
|
}
|
|
1114
1203
|
}
|
|
1115
1204
|
export const EVENT_AGENT_FINISH = 'gemini_cli.agent.finish';
|
|
1116
|
-
export class AgentFinishEvent {
|
|
1117
|
-
'event.name';
|
|
1118
|
-
'event.timestamp';
|
|
1119
|
-
agent_id;
|
|
1120
|
-
agent_name;
|
|
1205
|
+
export class AgentFinishEvent extends BaseAgentEvent {
|
|
1206
|
+
'event.name' = 'agent_finish';
|
|
1121
1207
|
duration_ms;
|
|
1122
1208
|
turn_count;
|
|
1123
1209
|
terminate_reason;
|
|
1124
1210
|
constructor(agent_id, agent_name, duration_ms, turn_count, terminate_reason) {
|
|
1125
|
-
|
|
1126
|
-
this['event.timestamp'] = new Date().toISOString();
|
|
1127
|
-
this.agent_id = agent_id;
|
|
1128
|
-
this.agent_name = agent_name;
|
|
1211
|
+
super(agent_id, agent_name);
|
|
1129
1212
|
this.duration_ms = duration_ms;
|
|
1130
1213
|
this.turn_count = turn_count;
|
|
1131
1214
|
this.terminate_reason = terminate_reason;
|
|
1132
1215
|
}
|
|
1133
1216
|
toOpenTelemetryAttributes(config) {
|
|
1134
1217
|
return {
|
|
1135
|
-
...
|
|
1218
|
+
...super.toOpenTelemetryAttributes(config),
|
|
1136
1219
|
'event.name': EVENT_AGENT_FINISH,
|
|
1137
|
-
'event.timestamp': this['event.timestamp'],
|
|
1138
|
-
agent_id: this.agent_id,
|
|
1139
|
-
agent_name: this.agent_name,
|
|
1140
1220
|
duration_ms: this.duration_ms,
|
|
1141
1221
|
turn_count: this.turn_count,
|
|
1142
1222
|
terminate_reason: this.terminate_reason,
|
|
@@ -1146,6 +1226,34 @@ export class AgentFinishEvent {
|
|
|
1146
1226
|
return `Agent ${this.agent_name} finished. Reason: ${this.terminate_reason}. Duration: ${this.duration_ms}ms. Turns: ${this.turn_count}.`;
|
|
1147
1227
|
}
|
|
1148
1228
|
}
|
|
1229
|
+
export const EVENT_AGENT_RECOVERY_ATTEMPT = 'gemini_cli.agent.recovery_attempt';
|
|
1230
|
+
export class RecoveryAttemptEvent extends BaseAgentEvent {
|
|
1231
|
+
'event.name' = 'agent_recovery_attempt';
|
|
1232
|
+
reason;
|
|
1233
|
+
duration_ms;
|
|
1234
|
+
success;
|
|
1235
|
+
turn_count;
|
|
1236
|
+
constructor(agent_id, agent_name, reason, duration_ms, success, turn_count) {
|
|
1237
|
+
super(agent_id, agent_name);
|
|
1238
|
+
this.reason = reason;
|
|
1239
|
+
this.duration_ms = duration_ms;
|
|
1240
|
+
this.success = success;
|
|
1241
|
+
this.turn_count = turn_count;
|
|
1242
|
+
}
|
|
1243
|
+
toOpenTelemetryAttributes(config) {
|
|
1244
|
+
return {
|
|
1245
|
+
...super.toOpenTelemetryAttributes(config),
|
|
1246
|
+
'event.name': EVENT_AGENT_RECOVERY_ATTEMPT,
|
|
1247
|
+
reason: this.reason,
|
|
1248
|
+
duration_ms: this.duration_ms,
|
|
1249
|
+
success: this.success,
|
|
1250
|
+
turn_count: this.turn_count,
|
|
1251
|
+
};
|
|
1252
|
+
}
|
|
1253
|
+
toLogBody() {
|
|
1254
|
+
return `Agent ${this.agent_name} recovery attempt. Reason: ${this.reason}. Success: ${this.success}. Duration: ${this.duration_ms}ms.`;
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1149
1257
|
export const EVENT_WEB_FETCH_FALLBACK_ATTEMPT = 'gemini_cli.web_fetch_fallback_attempt';
|
|
1150
1258
|
export class WebFetchFallbackAttemptEvent {
|
|
1151
1259
|
'event.name';
|