@google/gemini-cli-core 0.0.8999999 → 0.0.77777773
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/README.md +105 -62
- package/dist/index.d.ts +5 -2
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/src/agents/codebase-investigator.d.ts +46 -0
- package/dist/src/agents/codebase-investigator.js +136 -0
- package/dist/src/agents/codebase-investigator.js.map +1 -0
- package/dist/src/agents/executor.d.ts +92 -0
- package/dist/src/agents/executor.js +579 -0
- package/dist/src/agents/executor.js.map +1 -0
- package/dist/src/agents/executor.test.d.ts +6 -0
- package/dist/src/agents/executor.test.js +595 -0
- package/dist/src/agents/executor.test.js.map +1 -0
- package/dist/src/agents/invocation.d.ts +46 -0
- package/dist/src/agents/invocation.js +102 -0
- package/dist/src/agents/invocation.js.map +1 -0
- package/dist/src/agents/invocation.test.d.ts +6 -0
- package/dist/src/agents/invocation.test.js +215 -0
- package/dist/src/agents/invocation.test.js.map +1 -0
- package/dist/src/agents/registry.d.ts +36 -0
- package/dist/src/agents/registry.js +60 -0
- package/dist/src/agents/registry.js.map +1 -0
- package/dist/src/agents/registry.test.d.ts +6 -0
- package/dist/src/agents/registry.test.js +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 +38 -0
- package/dist/src/agents/subagent-tool-wrapper.js +48 -0
- package/dist/src/agents/subagent-tool-wrapper.js.map +1 -0
- package/dist/src/agents/subagent-tool-wrapper.test.d.ts +6 -0
- package/dist/src/agents/subagent-tool-wrapper.test.js +112 -0
- package/dist/src/agents/subagent-tool-wrapper.test.js.map +1 -0
- package/dist/src/agents/types.d.ts +145 -0
- package/dist/src/agents/types.js +18 -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/oauth-credential-storage.js +1 -1
- package/dist/src/code_assist/oauth-credential-storage.js.map +1 -1
- package/dist/src/code_assist/oauth2.test.js +14 -13
- package/dist/src/code_assist/oauth2.test.js.map +1 -1
- package/dist/src/code_assist/setup.js +4 -2
- package/dist/src/code_assist/setup.js.map +1 -1
- package/dist/src/config/config.d.ts +46 -15
- package/dist/src/config/config.js +106 -27
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/config.test.js +88 -3
- 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/storage.d.ts +0 -1
- package/dist/src/config/storage.js +2 -2
- package/dist/src/config/storage.js.map +1 -1
- package/dist/src/config/storage.test.js +7 -6
- package/dist/src/config/storage.test.js.map +1 -1
- package/dist/src/core/baseLlmClient.d.ts +4 -0
- package/dist/src/core/baseLlmClient.js +24 -23
- package/dist/src/core/baseLlmClient.js.map +1 -1
- package/dist/src/core/baseLlmClient.test.js +76 -13
- package/dist/src/core/baseLlmClient.test.js.map +1 -1
- package/dist/src/core/client.d.ts +3 -1
- package/dist/src/core/client.js +68 -47
- package/dist/src/core/client.js.map +1 -1
- package/dist/src/core/client.test.js +385 -134
- package/dist/src/core/client.test.js.map +1 -1
- package/dist/src/core/contentGenerator.js +3 -1
- package/dist/src/core/contentGenerator.js.map +1 -1
- package/dist/src/core/coreToolScheduler.js +24 -15
- package/dist/src/core/coreToolScheduler.js.map +1 -1
- package/dist/src/core/coreToolScheduler.test.js +359 -23
- package/dist/src/core/coreToolScheduler.test.js.map +1 -1
- package/dist/src/core/geminiChat.d.ts +11 -14
- package/dist/src/core/geminiChat.js +75 -124
- package/dist/src/core/geminiChat.js.map +1 -1
- package/dist/src/core/geminiChat.test.js +260 -239
- package/dist/src/core/geminiChat.test.js.map +1 -1
- package/dist/src/core/logger.test.js +2 -2
- package/dist/src/core/logger.test.js.map +1 -1
- package/dist/src/core/nonInteractiveToolExecutor.test.js +11 -11
- package/dist/src/core/nonInteractiveToolExecutor.test.js.map +1 -1
- package/dist/src/core/prompts.d.ts +2 -1
- package/dist/src/core/prompts.js +93 -18
- package/dist/src/core/prompts.js.map +1 -1
- package/dist/src/core/prompts.test.js +78 -29
- package/dist/src/core/prompts.test.js.map +1 -1
- package/dist/src/core/turn.d.ts +15 -6
- package/dist/src/core/turn.js +14 -13
- package/dist/src/core/turn.js.map +1 -1
- package/dist/src/core/turn.test.js +14 -2
- package/dist/src/core/turn.test.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/generated/git-commit.js.map +1 -1
- package/dist/src/ide/detect-ide.d.ts +5 -2
- package/dist/src/ide/detect-ide.js +11 -2
- package/dist/src/ide/detect-ide.js.map +1 -1
- package/dist/src/ide/detect-ide.test.js +34 -0
- package/dist/src/ide/detect-ide.test.js.map +1 -1
- package/dist/src/ide/ide-client.d.ts +2 -1
- package/dist/src/ide/ide-client.js +25 -20
- package/dist/src/ide/ide-client.js.map +1 -1
- package/dist/src/ide/ide-client.test.js +6 -6
- package/dist/src/ide/ide-client.test.js.map +1 -1
- package/dist/src/ide/ide-installer.js +1 -1
- package/dist/src/ide/ide-installer.js.map +1 -1
- package/dist/src/ide/ide-installer.test.js +13 -1
- package/dist/src/ide/ide-installer.test.js.map +1 -1
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/oauth-provider.d.ts +1 -0
- package/dist/src/mcp/oauth-provider.js +19 -14
- package/dist/src/mcp/oauth-provider.js.map +1 -1
- package/dist/src/mcp/oauth-provider.test.js +137 -1
- package/dist/src/mcp/oauth-provider.test.js.map +1 -1
- package/dist/src/mcp/oauth-utils.js +1 -0
- package/dist/src/mcp/oauth-utils.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/file-token-storage.js +2 -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 +4 -3
- package/dist/src/mcp/token-storage/file-token-storage.test.js.map +1 -1
- package/dist/src/routing/strategies/compositeStrategy.js +4 -3
- package/dist/src/routing/strategies/compositeStrategy.js.map +1 -1
- package/dist/src/services/chatRecordingService.d.ts +3 -2
- package/dist/src/services/chatRecordingService.js +3 -2
- package/dist/src/services/chatRecordingService.js.map +1 -1
- package/dist/src/services/fileSystemService.d.ts +9 -0
- package/dist/src/services/fileSystemService.js +11 -0
- package/dist/src/services/fileSystemService.js.map +1 -1
- package/dist/src/services/shellExecutionService.d.ts +3 -0
- package/dist/src/services/shellExecutionService.js +165 -49
- package/dist/src/services/shellExecutionService.js.map +1 -1
- package/dist/src/services/shellExecutionService.test.js +74 -5
- package/dist/src/services/shellExecutionService.test.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +18 -2
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +156 -11
- 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 +226 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +19 -3
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +44 -5
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -1
- package/dist/src/telemetry/config.d.ts +31 -0
- package/dist/src/telemetry/config.js +76 -0
- package/dist/src/telemetry/config.js.map +1 -0
- package/dist/src/telemetry/config.test.d.ts +6 -0
- package/dist/src/telemetry/config.test.js +124 -0
- package/dist/src/telemetry/config.test.js.map +1 -0
- package/dist/src/telemetry/constants.d.ts +0 -34
- package/dist/src/telemetry/constants.js +0 -34
- package/dist/src/telemetry/constants.js.map +1 -1
- package/dist/src/telemetry/index.d.ts +6 -2
- package/dist/src/telemetry/index.js +17 -2
- package/dist/src/telemetry/index.js.map +1 -1
- package/dist/src/telemetry/loggers.d.ts +10 -2
- package/dist/src/telemetry/loggers.js +206 -273
- 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 +260 -13
- package/dist/src/telemetry/loggers.test.js.map +1 -1
- package/dist/src/telemetry/memory-monitor.d.ts +149 -0
- package/dist/src/telemetry/memory-monitor.js +335 -0
- package/dist/src/telemetry/memory-monitor.js.map +1 -0
- package/dist/src/telemetry/memory-monitor.test.d.ts +6 -0
- package/dist/src/telemetry/memory-monitor.test.js +472 -0
- package/dist/src/telemetry/memory-monitor.test.js.map +1 -0
- package/dist/src/telemetry/metrics.d.ts +436 -11
- package/dist/src/telemetry/metrics.js +600 -110
- package/dist/src/telemetry/metrics.js.map +1 -1
- package/dist/src/telemetry/metrics.test.js +898 -16
- package/dist/src/telemetry/metrics.test.js.map +1 -1
- package/dist/src/telemetry/sdk.js +4 -1
- package/dist/src/telemetry/sdk.js.map +1 -1
- package/dist/src/telemetry/sdk.test.js +13 -0
- package/dist/src/telemetry/sdk.test.js.map +1 -1
- package/dist/src/telemetry/telemetryAttributes.d.ts +8 -0
- package/dist/src/telemetry/telemetryAttributes.js +18 -0
- package/dist/src/telemetry/telemetryAttributes.js.map +1 -0
- package/dist/src/telemetry/types.d.ts +167 -5
- package/dist/src/telemetry/types.js +692 -35
- package/dist/src/telemetry/types.js.map +1 -1
- package/dist/src/telemetry/uiTelemetry.d.ts +1 -1
- package/dist/src/telemetry/uiTelemetry.js +1 -1
- package/dist/src/telemetry/uiTelemetry.js.map +1 -1
- package/dist/src/telemetry/uiTelemetry.test.js +3 -3
- package/dist/src/telemetry/uiTelemetry.test.js.map +1 -1
- package/dist/src/test-utils/mock-tool.d.ts +28 -3
- package/dist/src/test-utils/mock-tool.js +71 -1
- package/dist/src/test-utils/mock-tool.js.map +1 -1
- package/dist/src/tools/edit.js +6 -0
- package/dist/src/tools/edit.js.map +1 -1
- package/dist/src/tools/edit.test.js +41 -0
- package/dist/src/tools/edit.test.js.map +1 -1
- package/dist/src/tools/glob.js +4 -2
- package/dist/src/tools/glob.js.map +1 -1
- package/dist/src/tools/ls.js +1 -1
- package/dist/src/tools/ls.js.map +1 -1
- package/dist/src/tools/mcp-client.d.ts +5 -14
- package/dist/src/tools/mcp-client.js +50 -97
- package/dist/src/tools/mcp-client.js.map +1 -1
- package/dist/src/tools/mcp-client.test.js +175 -157
- package/dist/src/tools/mcp-client.test.js.map +1 -1
- package/dist/src/tools/mcp-tool.js +30 -2
- package/dist/src/tools/mcp-tool.js.map +1 -1
- package/dist/src/tools/mcp-tool.test.js +117 -0
- package/dist/src/tools/mcp-tool.test.js.map +1 -1
- package/dist/src/tools/memoryTool.d.ts +1 -1
- package/dist/src/tools/memoryTool.js +1 -2
- package/dist/src/tools/memoryTool.js.map +1 -1
- package/dist/src/tools/memoryTool.test.js +9 -8
- 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/shell.js +60 -4
- package/dist/src/tools/shell.js.map +1 -1
- package/dist/src/tools/shell.test.js +2 -1
- package/dist/src/tools/shell.test.js.map +1 -1
- package/dist/src/tools/smart-edit.d.ts +1 -1
- package/dist/src/tools/smart-edit.js +122 -12
- package/dist/src/tools/smart-edit.js.map +1 -1
- package/dist/src/tools/smart-edit.test.js +136 -29
- package/dist/src/tools/smart-edit.test.js.map +1 -1
- package/dist/src/tools/tool-error.d.ts +22 -0
- package/dist/src/tools/tool-error.js +28 -0
- package/dist/src/tools/tool-error.js.map +1 -1
- package/dist/src/tools/tool-names.d.ts +9 -0
- package/dist/src/tools/tool-names.js +18 -0
- package/dist/src/tools/tool-names.js.map +1 -0
- package/dist/src/tools/tool-registry.test.js +10 -10
- package/dist/src/tools/tool-registry.test.js.map +1 -1
- package/dist/src/tools/tools.d.ts +11 -3
- package/dist/src/tools/tools.js +94 -3
- package/dist/src/tools/tools.js.map +1 -1
- package/dist/src/tools/web-fetch.js +3 -0
- package/dist/src/tools/web-fetch.js.map +1 -1
- package/dist/src/tools/web-fetch.test.js +44 -0
- package/dist/src/tools/web-fetch.test.js.map +1 -1
- package/dist/src/tools/web-search.js +2 -1
- package/dist/src/tools/web-search.js.map +1 -1
- package/dist/src/tools/write-file.js +2 -1
- package/dist/src/tools/write-file.js.map +1 -1
- package/dist/src/tools/write-todos.d.ts +25 -0
- package/dist/src/tools/write-todos.js +151 -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 +1 -1
- package/dist/src/utils/editCorrector.js +2 -2
- package/dist/src/utils/editCorrector.js.map +1 -1
- package/dist/src/utils/editor.js +1 -0
- package/dist/src/utils/editor.js.map +1 -1
- package/dist/src/utils/editor.test.js +1 -0
- package/dist/src/utils/editor.test.js.map +1 -1
- package/dist/src/utils/errorParsing.d.ts +1 -1
- package/dist/src/utils/errorParsing.js +5 -33
- package/dist/src/utils/errorParsing.js.map +1 -1
- package/dist/src/utils/errorParsing.test.js +0 -88
- package/dist/src/utils/errorParsing.test.js.map +1 -1
- package/dist/src/utils/flashFallback.test.js +26 -45
- package/dist/src/utils/flashFallback.test.js.map +1 -1
- package/dist/src/utils/formatters.d.ts +1 -0
- package/dist/src/utils/formatters.js +2 -1
- package/dist/src/utils/formatters.js.map +1 -1
- package/dist/src/utils/formatters.test.d.ts +6 -0
- package/dist/src/utils/formatters.test.js +26 -0
- package/dist/src/utils/formatters.test.js.map +1 -0
- package/dist/src/utils/getFolderStructure.d.ts +1 -1
- package/dist/src/utils/getFolderStructure.js +1 -1
- package/dist/src/utils/getFolderStructure.js.map +1 -1
- package/dist/src/utils/getFolderStructure.test.js +7 -6
- package/dist/src/utils/getFolderStructure.test.js.map +1 -1
- package/dist/src/utils/googleErrors.d.ts +104 -0
- package/dist/src/utils/googleErrors.js +108 -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 +212 -0
- package/dist/src/utils/googleErrors.test.js.map +1 -0
- package/dist/src/utils/googleQuotaErrors.d.ts +35 -0
- package/dist/src/utils/googleQuotaErrors.js +108 -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 +189 -0
- package/dist/src/utils/googleQuotaErrors.test.js.map +1 -0
- package/dist/src/utils/installationManager.test.js +2 -1
- package/dist/src/utils/installationManager.test.js.map +1 -1
- package/dist/src/utils/llm-edit-fixer.js +14 -4
- package/dist/src/utils/llm-edit-fixer.js.map +1 -1
- package/dist/src/utils/llm-edit-fixer.test.js +81 -0
- package/dist/src/utils/llm-edit-fixer.test.js.map +1 -1
- package/dist/src/utils/memoryDiscovery.d.ts +2 -1
- package/dist/src/utils/memoryDiscovery.js +3 -2
- package/dist/src/utils/memoryDiscovery.js.map +1 -1
- package/dist/src/utils/memoryDiscovery.test.js +99 -21
- package/dist/src/utils/memoryDiscovery.test.js.map +1 -1
- package/dist/src/utils/memoryImportProcessor.js +13 -20
- package/dist/src/utils/memoryImportProcessor.js.map +1 -1
- package/dist/src/utils/memoryImportProcessor.test.js +14 -0
- package/dist/src/utils/memoryImportProcessor.test.js.map +1 -1
- package/dist/src/utils/pathCorrector.d.ts +25 -0
- package/dist/src/utils/pathCorrector.js +33 -0
- package/dist/src/utils/pathCorrector.js.map +1 -0
- package/dist/src/utils/pathCorrector.test.d.ts +6 -0
- package/dist/src/utils/pathCorrector.test.js +83 -0
- package/dist/src/utils/pathCorrector.test.js.map +1 -0
- package/dist/src/utils/quotaErrorDetection.d.ts +0 -2
- package/dist/src/utils/quotaErrorDetection.js +0 -46
- package/dist/src/utils/quotaErrorDetection.js.map +1 -1
- package/dist/src/utils/retry.d.ts +3 -1
- package/dist/src/utils/retry.js +60 -162
- package/dist/src/utils/retry.js.map +1 -1
- package/dist/src/utils/retry.test.js +105 -135
- package/dist/src/utils/retry.test.js.map +1 -1
- package/dist/src/utils/schemaValidator.js +11 -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/shell-utils.d.ts +1 -0
- package/dist/src/utils/shell-utils.js +6 -2
- package/dist/src/utils/shell-utils.js.map +1 -1
- package/dist/src/utils/shell-utils.test.js +5 -0
- package/dist/src/utils/shell-utils.test.js.map +1 -1
- package/dist/src/utils/terminalSerializer.d.ts +1 -4
- package/dist/src/utils/terminalSerializer.js +3 -3
- package/dist/src/utils/terminalSerializer.js.map +1 -1
- 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.js +2 -2
- package/dist/src/utils/tool-utils.js.map +1 -1
- package/dist/src/utils/tool-utils.test.js +8 -0
- package/dist/src/utils/tool-utils.test.js.map +1 -1
- package/dist/src/utils/userAccountManager.test.js +2 -1
- package/dist/src/utils/userAccountManager.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/dist/src/test-utils/tools.d.ts +0 -45
- package/dist/src/test-utils/tools.js +0 -105
- package/dist/src/test-utils/tools.js.map +0 -1
package/README.md
CHANGED
|
@@ -7,16 +7,21 @@
|
|
|
7
7
|
|
|
8
8
|

|
|
9
9
|
|
|
10
|
-
Gemini CLI is an open-source AI agent that brings the power of Gemini directly
|
|
10
|
+
Gemini CLI is an open-source AI agent that brings the power of Gemini directly
|
|
11
|
+
into your terminal. It provides lightweight access to Gemini, giving you the
|
|
12
|
+
most direct path from your prompt to our model.
|
|
11
13
|
|
|
12
14
|
## 🚀 Why Gemini CLI?
|
|
13
15
|
|
|
14
|
-
- **🎯 Free tier**: 60 requests/min and 1,000 requests/day with personal Google
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
|
|
19
|
-
-
|
|
16
|
+
- **🎯 Free tier**: 60 requests/min and 1,000 requests/day with personal Google
|
|
17
|
+
account.
|
|
18
|
+
- **🧠 Powerful Gemini 2.5 Pro**: Access to 1M token context window.
|
|
19
|
+
- **🔧 Built-in tools**: Google Search grounding, file operations, shell
|
|
20
|
+
commands, web fetching.
|
|
21
|
+
- **🔌 Extensible**: MCP (Model Context Protocol) support for custom
|
|
22
|
+
integrations.
|
|
23
|
+
- **💻 Terminal-first**: Designed for developers who live in the command line.
|
|
24
|
+
- **🛡️ Open source**: Apache 2.0 licensed.
|
|
20
25
|
|
|
21
26
|
## 📦 Installation
|
|
22
27
|
|
|
@@ -52,7 +57,9 @@ See [Releases](./docs/releases.md) for more details.
|
|
|
52
57
|
|
|
53
58
|
### Preview
|
|
54
59
|
|
|
55
|
-
New preview releases will be published each week at UTC 2359 on Tuesdays. These
|
|
60
|
+
New preview releases will be published each week at UTC 2359 on Tuesdays. These
|
|
61
|
+
releases will not have been fully vetted and may contain regressions or other
|
|
62
|
+
outstanding issues. Please help us test and install with `preview` tag.
|
|
56
63
|
|
|
57
64
|
```bash
|
|
58
65
|
npm install -g @google/gemini-cli@preview
|
|
@@ -60,7 +67,9 @@ npm install -g @google/gemini-cli@preview
|
|
|
60
67
|
|
|
61
68
|
### Stable
|
|
62
69
|
|
|
63
|
-
- New stable releases will be published each week at UTC 2000 on Tuesdays, this
|
|
70
|
+
- New stable releases will be published each week at UTC 2000 on Tuesdays, this
|
|
71
|
+
will be the full promotion of last week's `preview` release + any bug fixes
|
|
72
|
+
and validations. Use `latest` tag.
|
|
64
73
|
|
|
65
74
|
```bash
|
|
66
75
|
npm install -g @google/gemini-cli@latest
|
|
@@ -68,7 +77,9 @@ npm install -g @google/gemini-cli@latest
|
|
|
68
77
|
|
|
69
78
|
### Nightly
|
|
70
79
|
|
|
71
|
-
- New releases will be published each week at UTC 0000 each day, This will be
|
|
80
|
+
- New releases will be published each week at UTC 0000 each day, This will be
|
|
81
|
+
all changes from the main branch as represented at time of release. It should
|
|
82
|
+
be assumed there are pending validations and issues. Use `nightly` tag.
|
|
72
83
|
|
|
73
84
|
```bash
|
|
74
85
|
npm install -g @google/gemini-cli@nightly
|
|
@@ -84,24 +95,33 @@ npm install -g @google/gemini-cli@nightly
|
|
|
84
95
|
|
|
85
96
|
### Automation & Integration
|
|
86
97
|
|
|
87
|
-
- Automate operational tasks like querying pull requests or handling complex
|
|
88
|
-
|
|
98
|
+
- Automate operational tasks like querying pull requests or handling complex
|
|
99
|
+
rebases
|
|
100
|
+
- Use MCP servers to connect new capabilities, including
|
|
101
|
+
[media generation with Imagen, Veo or Lyria](https://github.com/GoogleCloudPlatform/vertex-ai-creative-studio/tree/main/experiments/mcp-genmedia)
|
|
89
102
|
- Run non-interactively in scripts for workflow automation
|
|
90
103
|
|
|
91
104
|
### Advanced Capabilities
|
|
92
105
|
|
|
93
|
-
- Ground your queries with built-in
|
|
106
|
+
- Ground your queries with built-in
|
|
107
|
+
[Google Search](https://ai.google.dev/gemini-api/docs/grounding) for real-time
|
|
108
|
+
information
|
|
94
109
|
- Conversation checkpointing to save and resume complex sessions
|
|
95
110
|
- Custom context files (GEMINI.md) to tailor behavior for your projects
|
|
96
111
|
|
|
97
112
|
### GitHub Integration
|
|
98
113
|
|
|
99
|
-
Integrate Gemini CLI directly into your GitHub workflows with
|
|
114
|
+
Integrate Gemini CLI directly into your GitHub workflows with
|
|
115
|
+
[**Gemini CLI GitHub Action**](https://github.com/google-github-actions/run-gemini-cli):
|
|
100
116
|
|
|
101
|
-
- **Pull Request Reviews**: Automated code review with contextual feedback and
|
|
102
|
-
|
|
103
|
-
- **
|
|
104
|
-
|
|
117
|
+
- **Pull Request Reviews**: Automated code review with contextual feedback and
|
|
118
|
+
suggestions
|
|
119
|
+
- **Issue Triage**: Automated labeling and prioritization of GitHub issues based
|
|
120
|
+
on content analysis
|
|
121
|
+
- **On-demand Assistance**: Mention `@gemini-cli` in issues and pull requests
|
|
122
|
+
for help with debugging, explanations, or task delegation
|
|
123
|
+
- **Custom Workflows**: Build automated, scheduled and on-demand workflows
|
|
124
|
+
tailored to your team's needs
|
|
105
125
|
|
|
106
126
|
## 🔐 Authentication Options
|
|
107
127
|
|
|
@@ -109,7 +129,10 @@ Choose the authentication method that best fits your needs:
|
|
|
109
129
|
|
|
110
130
|
### Option 1: Login with Google (OAuth login using your Google Account)
|
|
111
131
|
|
|
112
|
-
**✨ Best for:** Individual developers as well as anyone who has a Gemini Code
|
|
132
|
+
**✨ Best for:** Individual developers as well as anyone who has a Gemini Code
|
|
133
|
+
Assist License. (see
|
|
134
|
+
[quota limits and terms of service](https://cloud.google.com/gemini/docs/quotas)
|
|
135
|
+
for details)
|
|
113
136
|
|
|
114
137
|
**Benefits:**
|
|
115
138
|
|
|
@@ -128,7 +151,7 @@ gemini
|
|
|
128
151
|
|
|
129
152
|
```bash
|
|
130
153
|
# Set your Google Cloud Project
|
|
131
|
-
export GOOGLE_CLOUD_PROJECT="
|
|
154
|
+
export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"
|
|
132
155
|
gemini
|
|
133
156
|
```
|
|
134
157
|
|
|
@@ -165,7 +188,8 @@ export GOOGLE_GENAI_USE_VERTEXAI=true
|
|
|
165
188
|
gemini
|
|
166
189
|
```
|
|
167
190
|
|
|
168
|
-
For Google Workspace accounts and other authentication methods, see the
|
|
191
|
+
For Google Workspace accounts and other authentication methods, see the
|
|
192
|
+
[authentication guide](./docs/get-started/authentication.md).
|
|
169
193
|
|
|
170
194
|
## 🚀 Getting Started
|
|
171
195
|
|
|
@@ -227,17 +251,26 @@ gemini
|
|
|
227
251
|
|
|
228
252
|
### Getting Started
|
|
229
253
|
|
|
230
|
-
- [**Quickstart Guide**](./docs/
|
|
231
|
-
|
|
232
|
-
- [**
|
|
233
|
-
|
|
254
|
+
- [**Quickstart Guide**](./docs/get-started/index.md) - Get up and running
|
|
255
|
+
quickly.
|
|
256
|
+
- [**Authentication Setup**](./docs/get-started/authentication.md) - Detailed
|
|
257
|
+
auth configuration.
|
|
258
|
+
- [**Configuration Guide**](./docs/get-started/configuration.md) - Settings and
|
|
259
|
+
customization.
|
|
260
|
+
- [**Keyboard Shortcuts**](./docs/cli/keyboard-shortcuts.md) - Productivity
|
|
261
|
+
tips.
|
|
234
262
|
|
|
235
263
|
### Core Features
|
|
236
264
|
|
|
237
|
-
- [**Commands Reference**](./docs/cli/commands.md) - All slash commands
|
|
238
|
-
|
|
239
|
-
- [**
|
|
240
|
-
|
|
265
|
+
- [**Commands Reference**](./docs/cli/commands.md) - All slash commands
|
|
266
|
+
(`/help`, `/chat`, etc).
|
|
267
|
+
- [**Custom Commands**](./docs/cli/custom-commands.md) - Create your own
|
|
268
|
+
reusable commands.
|
|
269
|
+
- [**Context Files (GEMINI.md)**](./docs/cli/gemini-md.md) - Provide persistent
|
|
270
|
+
context to Gemini CLI.
|
|
271
|
+
- [**Checkpointing**](./docs/cli/checkpointing.md) - Save and resume
|
|
272
|
+
conversations.
|
|
273
|
+
- [**Token Caching**](./docs/cli/token-caching.md) - Optimize token usage.
|
|
241
274
|
|
|
242
275
|
### Tools & Extensions
|
|
243
276
|
|
|
@@ -245,35 +278,37 @@ gemini
|
|
|
245
278
|
- [File System Operations](./docs/tools/file-system.md)
|
|
246
279
|
- [Shell Commands](./docs/tools/shell.md)
|
|
247
280
|
- [Web Fetch & Search](./docs/tools/web-fetch.md)
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
- [**Custom Extensions**](./docs/
|
|
281
|
+
- [**MCP Server Integration**](./docs/tools/mcp-server.md) - Extend with custom
|
|
282
|
+
tools.
|
|
283
|
+
- [**Custom Extensions**](./docs/extensions/index.md) - Build and share your own
|
|
284
|
+
commands.
|
|
251
285
|
|
|
252
286
|
### Advanced Topics
|
|
253
287
|
|
|
254
|
-
- [**
|
|
255
|
-
|
|
256
|
-
- [**
|
|
257
|
-
- [**
|
|
258
|
-
- [**
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
- [**
|
|
265
|
-
- [
|
|
266
|
-
- [**Environment Variables**](./docs/cli/configuration.md#environment-variables)
|
|
288
|
+
- [**Headless Mode (Scripting)**](./docs/cli/headless.md) - Use Gemini CLI in
|
|
289
|
+
automated workflows.
|
|
290
|
+
- [**Architecture Overview**](./docs/architecture.md) - How Gemini CLI works.
|
|
291
|
+
- [**IDE Integration**](./docs/ide-integration/index.md) - VS Code companion.
|
|
292
|
+
- [**Sandboxing & Security**](./docs/cli/sandbox.md) - Safe execution
|
|
293
|
+
environments.
|
|
294
|
+
- [**Trusted Folders**](./docs/cli/trusted-folders.md) - Control execution
|
|
295
|
+
policies by folder.
|
|
296
|
+
- [**Enterprise Guide**](./docs/cli/enterprise.md) - Deploy and manage in a
|
|
297
|
+
corporate environment.
|
|
298
|
+
- [**Telemetry & Monitoring**](./docs/cli/telemetry.md) - Usage tracking.
|
|
299
|
+
- [**Tools API Development**](./docs/core/tools-api.md) - Create custom tools.
|
|
267
300
|
|
|
268
301
|
### Troubleshooting & Support
|
|
269
302
|
|
|
270
|
-
- [**Troubleshooting Guide**](./docs/troubleshooting.md) - Common issues and
|
|
271
|
-
|
|
272
|
-
-
|
|
303
|
+
- [**Troubleshooting Guide**](./docs/troubleshooting.md) - Common issues and
|
|
304
|
+
solutions.
|
|
305
|
+
- [**FAQ**](./docs/faq.md) - Frequently asked questions.
|
|
306
|
+
- Use `/bug` command to report issues directly from the CLI.
|
|
273
307
|
|
|
274
308
|
### Using MCP Servers
|
|
275
309
|
|
|
276
|
-
Configure MCP servers in `~/.gemini/settings.json` to extend Gemini CLI with
|
|
310
|
+
Configure MCP servers in `~/.gemini/settings.json` to extend Gemini CLI with
|
|
311
|
+
custom tools:
|
|
277
312
|
|
|
278
313
|
```text
|
|
279
314
|
> @github List my open pull requests
|
|
@@ -281,31 +316,39 @@ Configure MCP servers in `~/.gemini/settings.json` to extend Gemini CLI with cus
|
|
|
281
316
|
> @database Run a query to find inactive users
|
|
282
317
|
```
|
|
283
318
|
|
|
284
|
-
See the [MCP Server Integration guide](./docs/tools/mcp-server.md) for setup
|
|
319
|
+
See the [MCP Server Integration guide](./docs/tools/mcp-server.md) for setup
|
|
320
|
+
instructions.
|
|
285
321
|
|
|
286
322
|
## 🤝 Contributing
|
|
287
323
|
|
|
288
|
-
We welcome contributions! Gemini CLI is fully open source (Apache 2.0), and we
|
|
324
|
+
We welcome contributions! Gemini CLI is fully open source (Apache 2.0), and we
|
|
325
|
+
encourage the community to:
|
|
289
326
|
|
|
290
|
-
- Report bugs and suggest features
|
|
291
|
-
- Improve documentation
|
|
292
|
-
- Submit code improvements
|
|
293
|
-
- Share your MCP servers and extensions
|
|
327
|
+
- Report bugs and suggest features.
|
|
328
|
+
- Improve documentation.
|
|
329
|
+
- Submit code improvements.
|
|
330
|
+
- Share your MCP servers and extensions.
|
|
294
331
|
|
|
295
|
-
See our [Contributing Guide](./CONTRIBUTING.md) for development setup, coding
|
|
332
|
+
See our [Contributing Guide](./CONTRIBUTING.md) for development setup, coding
|
|
333
|
+
standards, and how to submit pull requests.
|
|
296
334
|
|
|
297
|
-
Check our [Official Roadmap](https://github.com/orgs/google-gemini/projects/11
|
|
335
|
+
Check our [Official Roadmap](https://github.com/orgs/google-gemini/projects/11)
|
|
336
|
+
for planned features and priorities.
|
|
298
337
|
|
|
299
338
|
## 📖 Resources
|
|
300
339
|
|
|
301
|
-
- **[Official Roadmap](./ROADMAP.md)** - See what's coming next
|
|
302
|
-
- **[
|
|
303
|
-
- **[
|
|
304
|
-
|
|
340
|
+
- **[Official Roadmap](./ROADMAP.md)** - See what's coming next.
|
|
341
|
+
- **[Changelog](./docs/changelogs/index.md)** - See recent notable updates.
|
|
342
|
+
- **[NPM Package](https://www.npmjs.com/package/@google/gemini-cli)** - Package
|
|
343
|
+
registry.
|
|
344
|
+
- **[GitHub Issues](https://github.com/google-gemini/gemini-cli/issues)** -
|
|
345
|
+
Report bugs or request features.
|
|
346
|
+
- **[Security Advisories](https://github.com/google-gemini/gemini-cli/security/advisories)** -
|
|
347
|
+
Security updates.
|
|
305
348
|
|
|
306
349
|
### Uninstall
|
|
307
350
|
|
|
308
|
-
See the [Uninstall Guide](docs/
|
|
351
|
+
See the [Uninstall Guide](docs/cli/uninstall.md) for removal instructions.
|
|
309
352
|
|
|
310
353
|
## 📄 Legal
|
|
311
354
|
|
package/dist/index.d.ts
CHANGED
|
@@ -9,8 +9,11 @@ export { DEFAULT_GEMINI_MODEL, DEFAULT_GEMINI_MODEL_AUTO, DEFAULT_GEMINI_FLASH_M
|
|
|
9
9
|
export { serializeTerminalToObject, type AnsiOutput, type AnsiLine, type AnsiToken, } from './src/utils/terminalSerializer.js';
|
|
10
10
|
export { DEFAULT_TRUNCATE_TOOL_OUTPUT_LINES, DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD, } from './src/config/config.js';
|
|
11
11
|
export { detectIdeFromEnv } from './src/ide/detect-ide.js';
|
|
12
|
-
export { logIdeConnection } from './src/telemetry/loggers.js';
|
|
13
|
-
export { IdeConnectionEvent, IdeConnectionType, ExtensionInstallEvent, ExtensionUninstallEvent, } from './src/telemetry/types.js';
|
|
12
|
+
export { logExtensionEnable, logIdeConnection, logExtensionDisable, } from './src/telemetry/loggers.js';
|
|
13
|
+
export { IdeConnectionEvent, IdeConnectionType, ExtensionInstallEvent, ExtensionDisableEvent, ExtensionEnableEvent, ExtensionUninstallEvent, ExtensionUpdateEvent, ModelSlashCommandEvent, } from './src/telemetry/types.js';
|
|
14
14
|
export { makeFakeConfig } from './src/test-utils/config.js';
|
|
15
15
|
export * from './src/utils/pathReader.js';
|
|
16
16
|
export { ClearcutLogger } from './src/telemetry/clearcut-logger/clearcut-logger.js';
|
|
17
|
+
export { logModelSlashCommand } from './src/telemetry/loggers.js';
|
|
18
|
+
export * from './src/utils/googleQuotaErrors.js';
|
|
19
|
+
export type { GoogleApiError } from './src/utils/googleErrors.js';
|
package/dist/index.js
CHANGED
|
@@ -9,9 +9,11 @@ export { DEFAULT_GEMINI_MODEL, DEFAULT_GEMINI_MODEL_AUTO, DEFAULT_GEMINI_FLASH_M
|
|
|
9
9
|
export { serializeTerminalToObject, } from './src/utils/terminalSerializer.js';
|
|
10
10
|
export { DEFAULT_TRUNCATE_TOOL_OUTPUT_LINES, DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD, } from './src/config/config.js';
|
|
11
11
|
export { detectIdeFromEnv } from './src/ide/detect-ide.js';
|
|
12
|
-
export { logIdeConnection } from './src/telemetry/loggers.js';
|
|
13
|
-
export { IdeConnectionEvent, IdeConnectionType, ExtensionInstallEvent, ExtensionUninstallEvent, } from './src/telemetry/types.js';
|
|
12
|
+
export { logExtensionEnable, logIdeConnection, logExtensionDisable, } from './src/telemetry/loggers.js';
|
|
13
|
+
export { IdeConnectionEvent, IdeConnectionType, ExtensionInstallEvent, ExtensionDisableEvent, ExtensionEnableEvent, ExtensionUninstallEvent, ExtensionUpdateEvent, ModelSlashCommandEvent, } from './src/telemetry/types.js';
|
|
14
14
|
export { makeFakeConfig } from './src/test-utils/config.js';
|
|
15
15
|
export * from './src/utils/pathReader.js';
|
|
16
16
|
export { ClearcutLogger } from './src/telemetry/clearcut-logger/clearcut-logger.js';
|
|
17
|
+
export { logModelSlashCommand } from './src/telemetry/loggers.js';
|
|
18
|
+
export * from './src/utils/googleQuotaErrors.js';
|
|
17
19
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,0BAA0B,EAC1B,+BAA+B,EAC/B,8BAA8B,GAC/B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,yBAAyB,GAI1B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,kCAAkC,EAClC,sCAAsC,GACvC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,0BAA0B,EAC1B,+BAA+B,EAC/B,8BAA8B,GAC/B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,yBAAyB,GAI1B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,kCAAkC,EAClC,sCAAsC,GACvC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,cAAc,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { AgentDefinition } from './types.js';
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
declare const CodebaseInvestigationReportSchema: z.ZodObject<{
|
|
9
|
+
SummaryOfFindings: z.ZodString;
|
|
10
|
+
ExplorationTrace: z.ZodArray<z.ZodString, "many">;
|
|
11
|
+
RelevantLocations: z.ZodArray<z.ZodObject<{
|
|
12
|
+
FilePath: z.ZodString;
|
|
13
|
+
Reasoning: z.ZodString;
|
|
14
|
+
KeySymbols: z.ZodArray<z.ZodString, "many">;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
FilePath: string;
|
|
17
|
+
Reasoning: string;
|
|
18
|
+
KeySymbols: string[];
|
|
19
|
+
}, {
|
|
20
|
+
FilePath: string;
|
|
21
|
+
Reasoning: string;
|
|
22
|
+
KeySymbols: string[];
|
|
23
|
+
}>, "many">;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
SummaryOfFindings: string;
|
|
26
|
+
ExplorationTrace: string[];
|
|
27
|
+
RelevantLocations: {
|
|
28
|
+
FilePath: string;
|
|
29
|
+
Reasoning: string;
|
|
30
|
+
KeySymbols: string[];
|
|
31
|
+
}[];
|
|
32
|
+
}, {
|
|
33
|
+
SummaryOfFindings: string;
|
|
34
|
+
ExplorationTrace: string[];
|
|
35
|
+
RelevantLocations: {
|
|
36
|
+
FilePath: string;
|
|
37
|
+
Reasoning: string;
|
|
38
|
+
KeySymbols: string[];
|
|
39
|
+
}[];
|
|
40
|
+
}>;
|
|
41
|
+
/**
|
|
42
|
+
* A Proof-of-Concept subagent specialized in analyzing codebase structure,
|
|
43
|
+
* dependencies, and technologies.
|
|
44
|
+
*/
|
|
45
|
+
export declare const CodebaseInvestigatorAgent: AgentDefinition<typeof CodebaseInvestigationReportSchema>;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { LSTool } from '../tools/ls.js';
|
|
7
|
+
import { ReadFileTool } from '../tools/read-file.js';
|
|
8
|
+
import { GLOB_TOOL_NAME } from '../tools/tool-names.js';
|
|
9
|
+
import { GrepTool } from '../tools/grep.js';
|
|
10
|
+
import { DEFAULT_GEMINI_MODEL } from '../config/models.js';
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
// Define a type that matches the outputConfig schema for type safety.
|
|
13
|
+
const CodebaseInvestigationReportSchema = z.object({
|
|
14
|
+
SummaryOfFindings: z
|
|
15
|
+
.string()
|
|
16
|
+
.describe("A summary of the investigation's conclusions and insights for the main agent."),
|
|
17
|
+
ExplorationTrace: z
|
|
18
|
+
.array(z.string())
|
|
19
|
+
.describe('A step-by-step list of actions and tools used during the investigation.'),
|
|
20
|
+
RelevantLocations: z
|
|
21
|
+
.array(z.object({
|
|
22
|
+
FilePath: z.string(),
|
|
23
|
+
Reasoning: z.string(),
|
|
24
|
+
KeySymbols: z.array(z.string()),
|
|
25
|
+
}))
|
|
26
|
+
.describe('A list of relevant files and the key symbols within them.'),
|
|
27
|
+
});
|
|
28
|
+
/**
|
|
29
|
+
* A Proof-of-Concept subagent specialized in analyzing codebase structure,
|
|
30
|
+
* dependencies, and technologies.
|
|
31
|
+
*/
|
|
32
|
+
export const CodebaseInvestigatorAgent = {
|
|
33
|
+
name: 'codebase_investigator',
|
|
34
|
+
displayName: 'Codebase Investigator Agent',
|
|
35
|
+
description: `Your primary tool for multifile search tasks and codebase exploration.
|
|
36
|
+
Invoke this tool to delegate search tasks to an autonomous subagent.
|
|
37
|
+
Use this to find features, understand context, or locate specific files, functions, or symbols.
|
|
38
|
+
Returns a structured Json report with key file paths, symbols, architectural map and insights to solve a task or answer questions`,
|
|
39
|
+
inputConfig: {
|
|
40
|
+
inputs: {
|
|
41
|
+
objective: {
|
|
42
|
+
description: `A comprehensive and detailed description of the user's ultimate goal.
|
|
43
|
+
You must include original user's objective as well as questions and any extra context and questions you may have.`,
|
|
44
|
+
type: 'string',
|
|
45
|
+
required: true,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
outputConfig: {
|
|
50
|
+
outputName: 'report',
|
|
51
|
+
description: 'The final investigation report as a JSON object.',
|
|
52
|
+
schema: CodebaseInvestigationReportSchema,
|
|
53
|
+
},
|
|
54
|
+
// The 'output' parameter is now strongly typed as CodebaseInvestigationReportSchema
|
|
55
|
+
processOutput: (output) => JSON.stringify(output, null, 2),
|
|
56
|
+
modelConfig: {
|
|
57
|
+
model: DEFAULT_GEMINI_MODEL,
|
|
58
|
+
temp: 0.1,
|
|
59
|
+
top_p: 0.95,
|
|
60
|
+
thinkingBudget: -1,
|
|
61
|
+
},
|
|
62
|
+
runConfig: {
|
|
63
|
+
max_time_minutes: 5,
|
|
64
|
+
max_turns: 15,
|
|
65
|
+
},
|
|
66
|
+
toolConfig: {
|
|
67
|
+
// Grant access only to read-only tools.
|
|
68
|
+
tools: [LSTool.Name, ReadFileTool.Name, GLOB_TOOL_NAME, GrepTool.Name],
|
|
69
|
+
},
|
|
70
|
+
promptConfig: {
|
|
71
|
+
query: `Your task is to do a deep investigation of the codebase to find all relevant files, code locations, architectural mental map and insights to solve for the following user objective:
|
|
72
|
+
<objective>
|
|
73
|
+
\${objective}
|
|
74
|
+
</objective>`,
|
|
75
|
+
systemPrompt: `You are **Codebase Investigator**, a hyper-specialized AI agent and an expert in reverse-engineering complex software projects. You are a sub-agent within a larger development system.
|
|
76
|
+
Your **SOLE PURPOSE** is to build a complete mental model of the code relevant to a given investigation. You must identify all relevant files, understand their roles, and foresee the direct architectural consequences of potential changes.
|
|
77
|
+
You are a sub-agent in a larger system. Your only responsibility is to provide deep, actionable context.
|
|
78
|
+
- **DO:** Find the key modules, classes, and functions that are part of the problem and its solution.
|
|
79
|
+
- **DO:** Understand *why* the code is written the way it is. Question everything.
|
|
80
|
+
- **DO:** Foresee the ripple effects of a change. If \`function A\` is modified, you must check its callers. If a data structure is altered, you must identify where its type definitions need to be updated.
|
|
81
|
+
- **DO:** provide a conclusion and insights to the main agent that invoked you. If the agent is trying to solve a bug, you should provide the root cause of the bug, its impacts, how to fix it etc. If it's a new feature, you should provide insights on where to implement it, what chagnes are necessary etc.
|
|
82
|
+
- **DO NOT:** Write the final implementation code yourself.
|
|
83
|
+
- **DO NOT:** Stop at the first relevant file. Your goal is a comprehensive understanding of the entire relevant subsystem.
|
|
84
|
+
You operate in a non-interactive loop and must reason based on the information provided and the output of your tools.
|
|
85
|
+
---
|
|
86
|
+
## Core Directives
|
|
87
|
+
<RULES>
|
|
88
|
+
1. **DEEP ANALYSIS, NOT JUST FILE FINDING:** Your goal is to understand the *why* behind the code. Don't just list files; explain their purpose and the role of their key components. Your final report should empower another agent to make a correct and complete fix.
|
|
89
|
+
2. **SYSTEMATIC & CURIOUS EXPLORATION:** Start with high-value clues (like tracebacks or ticket numbers) and broaden your search as needed. Think like a senior engineer doing a code review. An initial file contains clues (imports, function calls, puzzling logic). **If you find something you don't understand, you MUST prioritize investigating it until it is clear.** Treat confusion as a signal to dig deeper.
|
|
90
|
+
3. **HOLISTIC & PRECISE:** Your goal is to find the complete and minimal set of locations that need to be understood or changed. Do not stop until you are confident you have considered the side effects of a potential fix (e.g., type errors, breaking changes to callers, opportunities for code reuse).
|
|
91
|
+
4. **Web Search:** You are allowed to use the \`web_fetch\` tool to research libraries, language features, or concepts you don't understand (e.g., "what does gettext.translation do with localedir=None?").
|
|
92
|
+
</RULES>
|
|
93
|
+
---
|
|
94
|
+
## Scratchpad Management
|
|
95
|
+
**This is your most critical function. Your scratchpad is your memory and your plan.**
|
|
96
|
+
1. **Initialization:** On your very first turn, you **MUST** create the \`<scratchpad>\` section. Analyze the \`task\` and create an initial \`Checklist\` of investigation goals and a \`Questions to Resolve\` section for any initial uncertainties.
|
|
97
|
+
2. **Constant Updates:** After **every** \`<OBSERVATION>\`, you **MUST** update the scratchpad.
|
|
98
|
+
* Mark checklist items as complete: \`[x]\`.
|
|
99
|
+
* Add new checklist items as you trace the architecture.
|
|
100
|
+
* **Explicitly log questions in \`Questions to Resolve\`** (e.g., \`[ ] What is the purpose of the 'None' element in this list?\`). Do not consider your investigation complete until this list is empty.
|
|
101
|
+
* Record \`Key Findings\` with file paths and notes about their purpose and relevance.
|
|
102
|
+
* Update \`Irrelevant Paths to Ignore\` to avoid re-investigating dead ends.
|
|
103
|
+
3. **Thinking on Paper:** The scratchpad must show your reasoning process, including how you resolve your questions.
|
|
104
|
+
---
|
|
105
|
+
## Termination
|
|
106
|
+
Your mission is complete **ONLY** when your \`Questions to Resolve\` list is empty and you have identified all files and necessary change *considerations*.
|
|
107
|
+
When you are finished, you **MUST** call the \`complete_task\` tool. The \`report\` argument for this tool **MUST** be a valid JSON object containing your findings.
|
|
108
|
+
|
|
109
|
+
**Example of the final report**
|
|
110
|
+
\`\`\`json
|
|
111
|
+
{
|
|
112
|
+
"SummaryOfFindings": "The core issue is a race condition in the \`updateUser\` function. The function reads the user's state, performs an asynchronous operation, and then writes the state back. If another request modifies the user state during the async operation, that change will be overwritten. The fix requires implementing a transactional read-modify-write pattern, potentially using a database lock or a versioning system.",
|
|
113
|
+
"ExplorationTrace": [
|
|
114
|
+
"Used \`grep\` to search for \`updateUser\` to locate the primary function.",
|
|
115
|
+
"Read the file \`src/controllers/userController.js\` to understand the function's logic.",
|
|
116
|
+
"Used \`ls -R\` to look for related files, such as services or database models.",
|
|
117
|
+
"Read \`src/services/userService.js\` and \`src/models/User.js\` to understand the data flow and how state is managed."
|
|
118
|
+
],
|
|
119
|
+
"RelevantLocations": [
|
|
120
|
+
{
|
|
121
|
+
"FilePath": "src/controllers/userController.js",
|
|
122
|
+
"Reasoning": "This file contains the \`updateUser\` function which has the race condition. It's the entry point for the problematic logic.",
|
|
123
|
+
"KeySymbols": ["updateUser", "getUser", "saveUser"]
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"FilePath": "src/services/userService.js",
|
|
127
|
+
"Reasoning": "This service is called by the controller and handles the direct interaction with the data layer. Any locking mechanism would likely be implemented here.",
|
|
128
|
+
"KeySymbols": ["updateUserData"]
|
|
129
|
+
}
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
\`\`\`
|
|
133
|
+
`,
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
//# sourceMappingURL=codebase-investigator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codebase-investigator.js","sourceRoot":"","sources":["../../../src/agents/codebase-investigator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,sEAAsE;AACtE,MAAM,iCAAiC,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,iBAAiB,EAAE,CAAC;SACjB,MAAM,EAAE;SACR,QAAQ,CACP,+EAA+E,CAChF;IACH,gBAAgB,EAAE,CAAC;SAChB,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;SACjB,QAAQ,CACP,yEAAyE,CAC1E;IACH,iBAAiB,EAAE,CAAC;SACjB,KAAK,CACJ,CAAC,CAAC,MAAM,CAAC;QACP,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;QACpB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;QACrB,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;KAChC,CAAC,CACH;SACA,QAAQ,CAAC,2DAA2D,CAAC;CACzE,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAElC;IACF,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EAAE,6BAA6B;IAC1C,WAAW,EAAE;;;sIAGuH;IACpI,WAAW,EAAE;QACX,MAAM,EAAE;YACN,SAAS,EAAE;gBACT,WAAW,EAAE;4HACuG;gBACpH,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;SACF;KACF;IACD,YAAY,EAAE;QACZ,UAAU,EAAE,QAAQ;QACpB,WAAW,EAAE,kDAAkD;QAC/D,MAAM,EAAE,iCAAiC;KAC1C;IAED,oFAAoF;IACpF,aAAa,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IAE1D,WAAW,EAAE;QACX,KAAK,EAAE,oBAAoB;QAC3B,IAAI,EAAE,GAAG;QACT,KAAK,EAAE,IAAI;QACX,cAAc,EAAE,CAAC,CAAC;KACnB;IAED,SAAS,EAAE;QACT,gBAAgB,EAAE,CAAC;QACnB,SAAS,EAAE,EAAE;KACd;IAED,UAAU,EAAE;QACV,wCAAwC;QACxC,KAAK,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,IAAI,EAAE,cAAc,EAAE,QAAQ,CAAC,IAAI,CAAC;KACvE;IAED,YAAY,EAAE;QACZ,KAAK,EAAE;;;aAGE;QACT,YAAY,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0DjB;KACE;CACF,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { Config } from '../config/config.js';
|
|
7
|
+
import type { AgentDefinition, AgentInputs, OutputObject, SubagentActivityEvent } from './types.js';
|
|
8
|
+
import { type z } from 'zod';
|
|
9
|
+
/** A callback function to report on agent activity. */
|
|
10
|
+
export type ActivityCallback = (activity: SubagentActivityEvent) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Executes an agent loop based on an {@link AgentDefinition}.
|
|
13
|
+
*
|
|
14
|
+
* This executor runs the agent in a loop, calling tools until it calls the
|
|
15
|
+
* mandatory `complete_task` tool to signal completion.
|
|
16
|
+
*/
|
|
17
|
+
export declare class AgentExecutor<TOutput extends z.ZodTypeAny> {
|
|
18
|
+
readonly definition: AgentDefinition<TOutput>;
|
|
19
|
+
private readonly agentId;
|
|
20
|
+
private readonly toolRegistry;
|
|
21
|
+
private readonly runtimeContext;
|
|
22
|
+
private readonly onActivity?;
|
|
23
|
+
/**
|
|
24
|
+
* Creates and validates a new `AgentExecutor` instance.
|
|
25
|
+
*
|
|
26
|
+
* This method ensures that all tools specified in the agent's definition are
|
|
27
|
+
* safe for non-interactive use before creating the executor.
|
|
28
|
+
*
|
|
29
|
+
* @param definition The definition object for the agent.
|
|
30
|
+
* @param runtimeContext The global runtime configuration.
|
|
31
|
+
* @param onActivity An optional callback to receive activity events.
|
|
32
|
+
* @returns A promise that resolves to a new `AgentExecutor` instance.
|
|
33
|
+
*/
|
|
34
|
+
static create<TOutput extends z.ZodTypeAny>(definition: AgentDefinition<TOutput>, runtimeContext: Config, onActivity?: ActivityCallback): Promise<AgentExecutor<TOutput>>;
|
|
35
|
+
/**
|
|
36
|
+
* Constructs a new AgentExecutor instance.
|
|
37
|
+
*
|
|
38
|
+
* @private This constructor is private. Use the static `create` method to
|
|
39
|
+
* instantiate the class.
|
|
40
|
+
*/
|
|
41
|
+
private constructor();
|
|
42
|
+
/**
|
|
43
|
+
* Runs the agent.
|
|
44
|
+
*
|
|
45
|
+
* @param inputs The validated input parameters for this invocation.
|
|
46
|
+
* @param signal An `AbortSignal` for cancellation.
|
|
47
|
+
* @returns A promise that resolves to the agent's final output.
|
|
48
|
+
*/
|
|
49
|
+
run(inputs: AgentInputs, signal: AbortSignal): Promise<OutputObject>;
|
|
50
|
+
/**
|
|
51
|
+
* Calls the generative model with the current context and tools.
|
|
52
|
+
*
|
|
53
|
+
* @returns The model's response, including any tool calls or text.
|
|
54
|
+
*/
|
|
55
|
+
private callModel;
|
|
56
|
+
/** Initializes a `GeminiChat` instance for the agent run. */
|
|
57
|
+
private createChatObject;
|
|
58
|
+
/**
|
|
59
|
+
* Executes function calls requested by the model and returns the results.
|
|
60
|
+
*
|
|
61
|
+
* @returns A new `Content` object for history, any submitted output, and completion status.
|
|
62
|
+
*/
|
|
63
|
+
private processFunctionCalls;
|
|
64
|
+
/**
|
|
65
|
+
* Prepares the list of tool function declarations to be sent to the model.
|
|
66
|
+
*/
|
|
67
|
+
private prepareToolsList;
|
|
68
|
+
/** Builds the system prompt from the agent definition and inputs. */
|
|
69
|
+
private buildSystemPrompt;
|
|
70
|
+
/**
|
|
71
|
+
* Applies template strings to initial messages.
|
|
72
|
+
*
|
|
73
|
+
* @param initialMessages The initial messages from the prompt config.
|
|
74
|
+
* @param inputs The validated input parameters for this invocation.
|
|
75
|
+
* @returns A new array of `Content` with templated strings.
|
|
76
|
+
*/
|
|
77
|
+
private applyTemplateToInitialMessages;
|
|
78
|
+
/**
|
|
79
|
+
* Validates that all tools in a registry are safe for non-interactive use.
|
|
80
|
+
*
|
|
81
|
+
* @throws An error if a tool is not on the allow-list for non-interactive execution.
|
|
82
|
+
*/
|
|
83
|
+
private static validateTools;
|
|
84
|
+
/**
|
|
85
|
+
* Checks if the agent should terminate due to exceeding configured limits.
|
|
86
|
+
*
|
|
87
|
+
* @returns The reason for termination, or `null` if execution can continue.
|
|
88
|
+
*/
|
|
89
|
+
private checkTermination;
|
|
90
|
+
/** Emits an activity event to the configured callback. */
|
|
91
|
+
private emitActivity;
|
|
92
|
+
}
|