@google/gemini-cli-core 0.10.0-nightly.20250926.1487841d → 0.10.0-nightly.20251009.ae02236c

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.
Files changed (252) hide show
  1. package/README.md +108 -71
  2. package/dist/index.d.ts +2 -0
  3. package/dist/index.js +1 -0
  4. package/dist/index.js.map +1 -1
  5. package/dist/src/agents/codebase-investigator.d.ts +46 -0
  6. package/dist/src/agents/codebase-investigator.js +136 -0
  7. package/dist/src/agents/codebase-investigator.js.map +1 -0
  8. package/dist/src/agents/executor.d.ts +92 -0
  9. package/dist/src/agents/executor.js +580 -0
  10. package/dist/src/agents/executor.js.map +1 -0
  11. package/dist/src/agents/executor.test.d.ts +6 -0
  12. package/dist/src/agents/executor.test.js +595 -0
  13. package/dist/src/agents/executor.test.js.map +1 -0
  14. package/dist/src/agents/invocation.d.ts +46 -0
  15. package/dist/src/agents/invocation.js +102 -0
  16. package/dist/src/agents/invocation.js.map +1 -0
  17. package/dist/src/agents/invocation.test.d.ts +6 -0
  18. package/dist/src/agents/invocation.test.js +215 -0
  19. package/dist/src/agents/invocation.test.js.map +1 -0
  20. package/dist/src/agents/registry.d.ts +36 -0
  21. package/dist/src/agents/registry.js +60 -0
  22. package/dist/src/agents/registry.js.map +1 -0
  23. package/dist/src/agents/registry.test.d.ts +6 -0
  24. package/dist/src/agents/registry.test.js +146 -0
  25. package/dist/src/agents/registry.test.js.map +1 -0
  26. package/dist/src/agents/schema-utils.d.ts +39 -0
  27. package/dist/src/agents/schema-utils.js +57 -0
  28. package/dist/src/agents/schema-utils.js.map +1 -0
  29. package/dist/src/agents/schema-utils.test.d.ts +6 -0
  30. package/dist/src/agents/schema-utils.test.js +144 -0
  31. package/dist/src/agents/schema-utils.test.js.map +1 -0
  32. package/dist/src/agents/subagent-tool-wrapper.d.ts +38 -0
  33. package/dist/src/agents/subagent-tool-wrapper.js +48 -0
  34. package/dist/src/agents/subagent-tool-wrapper.js.map +1 -0
  35. package/dist/src/agents/subagent-tool-wrapper.test.d.ts +6 -0
  36. package/dist/src/agents/subagent-tool-wrapper.test.js +112 -0
  37. package/dist/src/agents/subagent-tool-wrapper.test.js.map +1 -0
  38. package/dist/src/agents/types.d.ts +145 -0
  39. package/dist/src/agents/types.js +18 -0
  40. package/dist/src/agents/types.js.map +1 -0
  41. package/dist/src/agents/utils.d.ts +15 -0
  42. package/dist/src/agents/utils.js +29 -0
  43. package/dist/src/agents/utils.js.map +1 -0
  44. package/dist/src/agents/utils.test.d.ts +6 -0
  45. package/dist/src/agents/utils.test.js +87 -0
  46. package/dist/src/agents/utils.test.js.map +1 -0
  47. package/dist/src/code_assist/setup.js +4 -2
  48. package/dist/src/code_assist/setup.js.map +1 -1
  49. package/dist/src/config/config.d.ts +28 -5
  50. package/dist/src/config/config.js +61 -7
  51. package/dist/src/config/config.js.map +1 -1
  52. package/dist/src/config/config.test.js +63 -0
  53. package/dist/src/config/config.test.js.map +1 -1
  54. package/dist/src/core/baseLlmClient.js +19 -21
  55. package/dist/src/core/baseLlmClient.js.map +1 -1
  56. package/dist/src/core/baseLlmClient.test.js +57 -17
  57. package/dist/src/core/baseLlmClient.test.js.map +1 -1
  58. package/dist/src/core/client.d.ts +2 -0
  59. package/dist/src/core/client.js +52 -43
  60. package/dist/src/core/client.js.map +1 -1
  61. package/dist/src/core/client.test.js +300 -95
  62. package/dist/src/core/client.test.js.map +1 -1
  63. package/dist/src/core/contentGenerator.js +3 -1
  64. package/dist/src/core/contentGenerator.js.map +1 -1
  65. package/dist/src/core/coreToolScheduler.test.js +33 -23
  66. package/dist/src/core/coreToolScheduler.test.js.map +1 -1
  67. package/dist/src/core/geminiChat.d.ts +6 -0
  68. package/dist/src/core/geminiChat.js +21 -18
  69. package/dist/src/core/geminiChat.js.map +1 -1
  70. package/dist/src/core/geminiChat.test.js +20 -19
  71. package/dist/src/core/geminiChat.test.js.map +1 -1
  72. package/dist/src/core/nonInteractiveToolExecutor.test.js +11 -11
  73. package/dist/src/core/nonInteractiveToolExecutor.test.js.map +1 -1
  74. package/dist/src/core/prompts.d.ts +2 -1
  75. package/dist/src/core/prompts.js +88 -15
  76. package/dist/src/core/prompts.js.map +1 -1
  77. package/dist/src/core/prompts.test.js +73 -24
  78. package/dist/src/core/prompts.test.js.map +1 -1
  79. package/dist/src/core/turn.d.ts +10 -2
  80. package/dist/src/core/turn.js +6 -1
  81. package/dist/src/core/turn.js.map +1 -1
  82. package/dist/src/core/turn.test.js +1 -1
  83. package/dist/src/core/turn.test.js.map +1 -1
  84. package/dist/src/generated/git-commit.d.ts +2 -2
  85. package/dist/src/generated/git-commit.js +2 -2
  86. package/dist/src/ide/detect-ide.d.ts +1 -0
  87. package/dist/src/ide/detect-ide.js +4 -1
  88. package/dist/src/ide/detect-ide.js.map +1 -1
  89. package/dist/src/ide/detect-ide.test.js +11 -0
  90. package/dist/src/ide/detect-ide.test.js.map +1 -1
  91. package/dist/src/ide/ide-client.js +3 -3
  92. package/dist/src/ide/ide-client.test.js +4 -4
  93. package/dist/src/ide/ide-installer.js +1 -1
  94. package/dist/src/ide/ide-installer.js.map +1 -1
  95. package/dist/src/ide/ide-installer.test.js +13 -1
  96. package/dist/src/ide/ide-installer.test.js.map +1 -1
  97. package/dist/src/index.d.ts +1 -0
  98. package/dist/src/index.js +1 -0
  99. package/dist/src/index.js.map +1 -1
  100. package/dist/src/mcp/sa-impersonation-provider.d.ts +33 -0
  101. package/dist/src/mcp/sa-impersonation-provider.js +130 -0
  102. package/dist/src/mcp/sa-impersonation-provider.js.map +1 -0
  103. package/dist/src/mcp/sa-impersonation-provider.test.d.ts +6 -0
  104. package/dist/src/mcp/sa-impersonation-provider.test.js +117 -0
  105. package/dist/src/mcp/sa-impersonation-provider.test.js.map +1 -0
  106. package/dist/src/services/chatRecordingService.d.ts +2 -1
  107. package/dist/src/services/chatRecordingService.js +2 -1
  108. package/dist/src/services/chatRecordingService.js.map +1 -1
  109. package/dist/src/services/fileSystemService.d.ts +9 -0
  110. package/dist/src/services/fileSystemService.js +11 -0
  111. package/dist/src/services/fileSystemService.js.map +1 -1
  112. package/dist/src/services/shellExecutionService.d.ts +2 -0
  113. package/dist/src/services/shellExecutionService.js +48 -7
  114. package/dist/src/services/shellExecutionService.js.map +1 -1
  115. package/dist/src/services/shellExecutionService.test.js +13 -4
  116. package/dist/src/services/shellExecutionService.test.js.map +1 -1
  117. package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +12 -2
  118. package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +79 -9
  119. package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -1
  120. package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +99 -1
  121. package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +1 -1
  122. package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +11 -3
  123. package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +27 -4
  124. package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -1
  125. package/dist/src/telemetry/constants.d.ts +6 -24
  126. package/dist/src/telemetry/constants.js +7 -25
  127. package/dist/src/telemetry/constants.js.map +1 -1
  128. package/dist/src/telemetry/index.d.ts +5 -3
  129. package/dist/src/telemetry/index.js +10 -3
  130. package/dist/src/telemetry/index.js.map +1 -1
  131. package/dist/src/telemetry/loggers.d.ts +6 -1
  132. package/dist/src/telemetry/loggers.js +132 -12
  133. package/dist/src/telemetry/loggers.js.map +1 -1
  134. package/dist/src/telemetry/loggers.test.circular.js +3 -3
  135. package/dist/src/telemetry/loggers.test.circular.js.map +1 -1
  136. package/dist/src/telemetry/loggers.test.js +160 -13
  137. package/dist/src/telemetry/loggers.test.js.map +1 -1
  138. package/dist/src/telemetry/memory-monitor.d.ts +149 -0
  139. package/dist/src/telemetry/memory-monitor.js +335 -0
  140. package/dist/src/telemetry/memory-monitor.js.map +1 -0
  141. package/dist/src/telemetry/memory-monitor.test.d.ts +6 -0
  142. package/dist/src/telemetry/memory-monitor.test.js +472 -0
  143. package/dist/src/telemetry/memory-monitor.test.js.map +1 -0
  144. package/dist/src/telemetry/metrics.d.ts +392 -20
  145. package/dist/src/telemetry/metrics.js +463 -235
  146. package/dist/src/telemetry/metrics.js.map +1 -1
  147. package/dist/src/telemetry/metrics.test.js +391 -55
  148. package/dist/src/telemetry/metrics.test.js.map +1 -1
  149. package/dist/src/telemetry/types.d.ts +37 -1
  150. package/dist/src/telemetry/types.js +60 -0
  151. package/dist/src/telemetry/types.js.map +1 -1
  152. package/dist/src/telemetry/uiTelemetry.test.js +2 -2
  153. package/dist/src/telemetry/uiTelemetry.test.js.map +1 -1
  154. package/dist/src/test-utils/mock-tool.d.ts +28 -3
  155. package/dist/src/test-utils/mock-tool.js +71 -1
  156. package/dist/src/test-utils/mock-tool.js.map +1 -1
  157. package/dist/src/tools/glob.js +2 -1
  158. package/dist/src/tools/glob.js.map +1 -1
  159. package/dist/src/tools/mcp-client.d.ts +3 -2
  160. package/dist/src/tools/mcp-client.js +44 -30
  161. package/dist/src/tools/mcp-client.js.map +1 -1
  162. package/dist/src/tools/mcp-client.test.js +168 -5
  163. package/dist/src/tools/mcp-client.test.js.map +1 -1
  164. package/dist/src/tools/shell.js +2 -2
  165. package/dist/src/tools/shell.js.map +1 -1
  166. package/dist/src/tools/shell.test.js +1 -1
  167. package/dist/src/tools/shell.test.js.map +1 -1
  168. package/dist/src/tools/smart-edit.d.ts +1 -1
  169. package/dist/src/tools/smart-edit.js +114 -10
  170. package/dist/src/tools/smart-edit.js.map +1 -1
  171. package/dist/src/tools/smart-edit.test.js +91 -29
  172. package/dist/src/tools/smart-edit.test.js.map +1 -1
  173. package/dist/src/tools/tool-names.d.ts +8 -0
  174. package/dist/src/tools/tool-names.js +17 -0
  175. package/dist/src/tools/tool-names.js.map +1 -0
  176. package/dist/src/tools/tool-registry.test.js +10 -10
  177. package/dist/src/tools/tool-registry.test.js.map +1 -1
  178. package/dist/src/tools/web-fetch.js +3 -0
  179. package/dist/src/tools/web-fetch.js.map +1 -1
  180. package/dist/src/tools/web-fetch.test.js +44 -0
  181. package/dist/src/tools/web-fetch.test.js.map +1 -1
  182. package/dist/src/tools/write-file.js +2 -1
  183. package/dist/src/tools/write-file.js.map +1 -1
  184. package/dist/src/tools/write-todos.d.ts +1 -1
  185. package/dist/src/tools/write-todos.js +4 -3
  186. package/dist/src/tools/write-todos.js.map +1 -1
  187. package/dist/src/utils/editCorrector.js +2 -2
  188. package/dist/src/utils/editCorrector.js.map +1 -1
  189. package/dist/src/utils/editor.js +1 -0
  190. package/dist/src/utils/editor.js.map +1 -1
  191. package/dist/src/utils/editor.test.js +1 -0
  192. package/dist/src/utils/editor.test.js.map +1 -1
  193. package/dist/src/utils/errorParsing.d.ts +1 -1
  194. package/dist/src/utils/errorParsing.js +5 -33
  195. package/dist/src/utils/errorParsing.js.map +1 -1
  196. package/dist/src/utils/errorParsing.test.js +0 -88
  197. package/dist/src/utils/errorParsing.test.js.map +1 -1
  198. package/dist/src/utils/flashFallback.test.js +26 -45
  199. package/dist/src/utils/flashFallback.test.js.map +1 -1
  200. package/dist/src/utils/formatters.d.ts +1 -0
  201. package/dist/src/utils/formatters.js +2 -1
  202. package/dist/src/utils/formatters.js.map +1 -1
  203. package/dist/src/utils/formatters.test.d.ts +6 -0
  204. package/dist/src/utils/formatters.test.js +26 -0
  205. package/dist/src/utils/formatters.test.js.map +1 -0
  206. package/dist/src/utils/googleErrors.d.ts +104 -0
  207. package/dist/src/utils/googleErrors.js +108 -0
  208. package/dist/src/utils/googleErrors.js.map +1 -0
  209. package/dist/src/utils/googleErrors.test.d.ts +6 -0
  210. package/dist/src/utils/googleErrors.test.js +212 -0
  211. package/dist/src/utils/googleErrors.test.js.map +1 -0
  212. package/dist/src/utils/googleQuotaErrors.d.ts +35 -0
  213. package/dist/src/utils/googleQuotaErrors.js +108 -0
  214. package/dist/src/utils/googleQuotaErrors.js.map +1 -0
  215. package/dist/src/utils/googleQuotaErrors.test.d.ts +6 -0
  216. package/dist/src/utils/googleQuotaErrors.test.js +189 -0
  217. package/dist/src/utils/googleQuotaErrors.test.js.map +1 -0
  218. package/dist/src/utils/llm-edit-fixer.js +13 -4
  219. package/dist/src/utils/llm-edit-fixer.js.map +1 -1
  220. package/dist/src/utils/llm-edit-fixer.test.js +81 -0
  221. package/dist/src/utils/llm-edit-fixer.test.js.map +1 -1
  222. package/dist/src/utils/memoryDiscovery.d.ts +1 -0
  223. package/dist/src/utils/memoryDiscovery.js +2 -1
  224. package/dist/src/utils/memoryDiscovery.js.map +1 -1
  225. package/dist/src/utils/memoryDiscovery.test.js +99 -21
  226. package/dist/src/utils/memoryDiscovery.test.js.map +1 -1
  227. package/dist/src/utils/memoryImportProcessor.js +13 -20
  228. package/dist/src/utils/memoryImportProcessor.js.map +1 -1
  229. package/dist/src/utils/memoryImportProcessor.test.js +14 -0
  230. package/dist/src/utils/memoryImportProcessor.test.js.map +1 -1
  231. package/dist/src/utils/pathCorrector.d.ts +25 -0
  232. package/dist/src/utils/pathCorrector.js +33 -0
  233. package/dist/src/utils/pathCorrector.js.map +1 -0
  234. package/dist/src/utils/pathCorrector.test.d.ts +6 -0
  235. package/dist/src/utils/pathCorrector.test.js +83 -0
  236. package/dist/src/utils/pathCorrector.test.js.map +1 -0
  237. package/dist/src/utils/quotaErrorDetection.d.ts +0 -2
  238. package/dist/src/utils/quotaErrorDetection.js +0 -46
  239. package/dist/src/utils/quotaErrorDetection.js.map +1 -1
  240. package/dist/src/utils/retry.d.ts +3 -1
  241. package/dist/src/utils/retry.js +53 -161
  242. package/dist/src/utils/retry.js.map +1 -1
  243. package/dist/src/utils/retry.test.js +87 -146
  244. package/dist/src/utils/retry.test.js.map +1 -1
  245. package/dist/src/utils/terminalSerializer.d.ts +1 -4
  246. package/dist/src/utils/terminalSerializer.js +3 -3
  247. package/dist/src/utils/terminalSerializer.js.map +1 -1
  248. package/dist/tsconfig.tsbuildinfo +1 -1
  249. package/package.json +1 -1
  250. package/dist/src/test-utils/tools.d.ts +0 -45
  251. package/dist/src/test-utils/tools.js +0 -105
  252. package/dist/src/test-utils/tools.js.map +0 -1
package/README.md CHANGED
@@ -7,16 +7,21 @@
7
7
 
8
8
  ![Gemini CLI Screenshot](./docs/assets/gemini-screenshot.png)
9
9
 
10
- Gemini CLI is an open-source AI agent that brings the power of Gemini directly into your terminal. It provides lightweight access to Gemini, giving you the most direct path from your prompt to our model.
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 account
15
- - **🧠 Powerful Gemini 2.5 Pro**: Access to 1M token context window
16
- - **🔧 Built-in tools**: Google Search grounding, file operations, shell commands, web fetching
17
- - **🔌 Extensible**: MCP (Model Context Protocol) support for custom integrations
18
- - **💻 Terminal-first**: Designed for developers who live in the command line
19
- - **🛡️ Open source**: Apache 2.0 licensed
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 releases will not have been fully vetted and may contain regressions or other outstanding issues. Please help us test and install with `preview` tag.
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 will be the full promotion of last week's `preview` release + any bug fixes and validations. Use `latest` tag.
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 all changes from the main branch as represented at time of release. It should be assumed there are pending validations and issues. Use `nightly` tag.
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 rebases
88
- - Use MCP servers to connect new capabilities, including [media generation with Imagen, Veo or Lyria](https://github.com/GoogleCloudPlatform/vertex-ai-creative-studio/tree/main/experiments/mcp-genmedia)
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 [Google Search](https://ai.google.dev/gemini-api/docs/grounding) for real-time information
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 [**Gemini CLI GitHub Action**](https://github.com/google-github-actions/run-gemini-cli):
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 suggestions
102
- - **Issue Triage**: Automated labeling and prioritization of GitHub issues based on content analysis
103
- - **On-demand Assistance**: Mention `@gemini-cli` in issues and pull requests for help with debugging, explanations, or task delegation
104
- - **Custom Workflows**: Build automated, scheduled and on-demand workflows tailored to your team's needs
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,20 +129,17 @@ 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:**
113
-
114
- - Individual developers.
115
- - Google AI Pro and AI Ultra subscribers.
116
- - Anyone who has a Gemini Code Assist license.
117
-
118
- _See [quota limits and terms of service](https://cloud.google.com/gemini/docs/quotas) for details._
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)
119
136
 
120
137
  **Benefits:**
121
138
 
122
- - **Free tier** with 60 requests/min and 1,000 requests/day
123
- - **Gemini 2.5 Pro and Flash** with 1M token context window
139
+ - **Free tier**: 60 requests/min and 1,000 requests/day
140
+ - **Gemini 2.5 Pro** with 1M token context window
124
141
  - **No API key management** - just sign in with your Google account
125
- - **Automatic updates** to our latest models
142
+ - **Automatic updates** to latest models
126
143
 
127
144
  #### Start Gemini CLI, then choose _Login with Google_ and follow the browser authentication flow when prompted
128
145
 
@@ -134,7 +151,7 @@ gemini
134
151
 
135
152
  ```bash
136
153
  # Set your Google Cloud Project
137
- export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_NAME"
154
+ export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"
138
155
  gemini
139
156
  ```
140
157
 
@@ -171,7 +188,8 @@ export GOOGLE_GENAI_USE_VERTEXAI=true
171
188
  gemini
172
189
  ```
173
190
 
174
- For Google Workspace accounts and other authentication methods, see the [authentication guide](./docs/cli/authentication.md).
191
+ For Google Workspace accounts and other authentication methods, see the
192
+ [authentication guide](./docs/get-started/authentication.md).
175
193
 
176
194
  ## 🚀 Getting Started
177
195
 
@@ -233,17 +251,26 @@ gemini
233
251
 
234
252
  ### Getting Started
235
253
 
236
- - [**Quickstart Guide**](./docs/cli/index.md) - Get up and running quickly
237
- - [**Authentication Setup**](./docs/cli/authentication.md) - Detailed auth configuration
238
- - [**Configuration Guide**](./docs/cli/configuration.md) - Settings and customization
239
- - [**Keyboard Shortcuts**](./docs/keyboard-shortcuts.md) - Productivity tips
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.
240
262
 
241
263
  ### Core Features
242
264
 
243
- - [**Commands Reference**](./docs/cli/commands.md) - All slash commands (`/help`, `/chat`, `/mcp`, etc.)
244
- - [**Checkpointing**](./docs/checkpointing.md) - Save and resume conversations
245
- - [**Memory Management**](./docs/tools/memory.md) - Using GEMINI.md context files
246
- - [**Token Caching**](./docs/cli/token-caching.md) - Optimize token usage
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.
247
274
 
248
275
  ### Tools & Extensions
249
276
 
@@ -251,35 +278,37 @@ gemini
251
278
  - [File System Operations](./docs/tools/file-system.md)
252
279
  - [Shell Commands](./docs/tools/shell.md)
253
280
  - [Web Fetch & Search](./docs/tools/web-fetch.md)
254
- - [Multi-file Operations](./docs/tools/multi-file.md)
255
- - [**MCP Server Integration**](./docs/tools/mcp-server.md) - Extend with custom tools
256
- - [**Custom Extensions**](./docs/extension.md) - Build your own commands
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.
257
285
 
258
286
  ### Advanced Topics
259
287
 
260
- - [**Architecture Overview**](./docs/architecture.md) - How Gemini CLI works
261
- - [**IDE Integration**](./docs/ide-integration.md) - VS Code companion
262
- - [**Sandboxing & Security**](./docs/sandbox.md) - Safe execution environments
263
- - [**Enterprise Deployment**](./docs/deployment.md) - Docker, system-wide config
264
- - [**Telemetry & Monitoring**](./docs/telemetry.md) - Usage tracking
265
- - [**Tools API Development**](./docs/core/tools-api.md) - Create custom tools
266
-
267
- ### Configuration & Customization
268
-
269
- - [**Settings Reference**](./docs/cli/configuration.md) - All configuration options
270
- - [**Theme Customization**](./docs/cli/themes.md) - Visual customization
271
- - [**.gemini Directory**](./docs/gemini-ignore.md) - Project-specific settings
272
- - [**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.
273
300
 
274
301
  ### Troubleshooting & Support
275
302
 
276
- - [**Troubleshooting Guide**](./docs/troubleshooting.md) - Common issues and solutions
277
- - [**FAQ**](./docs/troubleshooting.md#frequently-asked-questions) - Quick answers
278
- - Use `/bug` command to report issues directly from the CLI
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.
279
307
 
280
308
  ### Using MCP Servers
281
309
 
282
- Configure MCP servers in `~/.gemini/settings.json` to extend Gemini CLI with custom tools:
310
+ Configure MCP servers in `~/.gemini/settings.json` to extend Gemini CLI with
311
+ custom tools:
283
312
 
284
313
  ```text
285
314
  > @github List my open pull requests
@@ -287,31 +316,39 @@ Configure MCP servers in `~/.gemini/settings.json` to extend Gemini CLI with cus
287
316
  > @database Run a query to find inactive users
288
317
  ```
289
318
 
290
- See the [MCP Server Integration guide](./docs/tools/mcp-server.md) for setup instructions.
319
+ See the [MCP Server Integration guide](./docs/tools/mcp-server.md) for setup
320
+ instructions.
291
321
 
292
322
  ## 🤝 Contributing
293
323
 
294
- We welcome contributions! Gemini CLI is fully open source (Apache 2.0), and we encourage the community to:
324
+ We welcome contributions! Gemini CLI is fully open source (Apache 2.0), and we
325
+ encourage the community to:
295
326
 
296
- - Report bugs and suggest features
297
- - Improve documentation
298
- - Submit code improvements
299
- - 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.
300
331
 
301
- See our [Contributing Guide](./CONTRIBUTING.md) for development setup, coding standards, and how to submit pull requests.
332
+ See our [Contributing Guide](./CONTRIBUTING.md) for development setup, coding
333
+ standards, and how to submit pull requests.
302
334
 
303
- Check our [Official Roadmap](https://github.com/orgs/google-gemini/projects/11/) for planned features and priorities.
335
+ Check our [Official Roadmap](https://github.com/orgs/google-gemini/projects/11)
336
+ for planned features and priorities.
304
337
 
305
338
  ## 📖 Resources
306
339
 
307
- - **[Official Roadmap](./ROADMAP.md)** - See what's coming next
308
- - **[NPM Package](https://www.npmjs.com/package/@google/gemini-cli)** - Package registry
309
- - **[GitHub Issues](https://github.com/google-gemini/gemini-cli/issues)** - Report bugs or request features
310
- - **[Security Advisories](https://github.com/google-gemini/gemini-cli/security/advisories)** - Security updates
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.
311
348
 
312
349
  ### Uninstall
313
350
 
314
- See the [Uninstall Guide](docs/Uninstall.md) for removal instructions.
351
+ See the [Uninstall Guide](docs/cli/uninstall.md) for removal instructions.
315
352
 
316
353
  ## 📄 Legal
317
354
 
package/dist/index.d.ts CHANGED
@@ -15,3 +15,5 @@ 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
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
@@ -15,4 +15,5 @@ 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
17
  export { logModelSlashCommand } from './src/telemetry/loggers.js';
18
+ export * from './src/utils/googleQuotaErrors.js';
18
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,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,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"}
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,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
+ }