@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.
Files changed (362) hide show
  1. package/README.md +105 -62
  2. package/dist/index.d.ts +5 -2
  3. package/dist/index.js +4 -2
  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 +579 -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/oauth-credential-storage.js +1 -1
  48. package/dist/src/code_assist/oauth-credential-storage.js.map +1 -1
  49. package/dist/src/code_assist/oauth2.test.js +14 -13
  50. package/dist/src/code_assist/oauth2.test.js.map +1 -1
  51. package/dist/src/code_assist/setup.js +4 -2
  52. package/dist/src/code_assist/setup.js.map +1 -1
  53. package/dist/src/config/config.d.ts +46 -15
  54. package/dist/src/config/config.js +106 -27
  55. package/dist/src/config/config.js.map +1 -1
  56. package/dist/src/config/config.test.js +88 -3
  57. package/dist/src/config/config.test.js.map +1 -1
  58. package/dist/src/config/constants.d.ts +11 -0
  59. package/dist/src/config/constants.js +16 -0
  60. package/dist/src/config/constants.js.map +1 -0
  61. package/dist/src/config/storage.d.ts +0 -1
  62. package/dist/src/config/storage.js +2 -2
  63. package/dist/src/config/storage.js.map +1 -1
  64. package/dist/src/config/storage.test.js +7 -6
  65. package/dist/src/config/storage.test.js.map +1 -1
  66. package/dist/src/core/baseLlmClient.d.ts +4 -0
  67. package/dist/src/core/baseLlmClient.js +24 -23
  68. package/dist/src/core/baseLlmClient.js.map +1 -1
  69. package/dist/src/core/baseLlmClient.test.js +76 -13
  70. package/dist/src/core/baseLlmClient.test.js.map +1 -1
  71. package/dist/src/core/client.d.ts +3 -1
  72. package/dist/src/core/client.js +68 -47
  73. package/dist/src/core/client.js.map +1 -1
  74. package/dist/src/core/client.test.js +385 -134
  75. package/dist/src/core/client.test.js.map +1 -1
  76. package/dist/src/core/contentGenerator.js +3 -1
  77. package/dist/src/core/contentGenerator.js.map +1 -1
  78. package/dist/src/core/coreToolScheduler.js +24 -15
  79. package/dist/src/core/coreToolScheduler.js.map +1 -1
  80. package/dist/src/core/coreToolScheduler.test.js +359 -23
  81. package/dist/src/core/coreToolScheduler.test.js.map +1 -1
  82. package/dist/src/core/geminiChat.d.ts +11 -14
  83. package/dist/src/core/geminiChat.js +75 -124
  84. package/dist/src/core/geminiChat.js.map +1 -1
  85. package/dist/src/core/geminiChat.test.js +260 -239
  86. package/dist/src/core/geminiChat.test.js.map +1 -1
  87. package/dist/src/core/logger.test.js +2 -2
  88. package/dist/src/core/logger.test.js.map +1 -1
  89. package/dist/src/core/nonInteractiveToolExecutor.test.js +11 -11
  90. package/dist/src/core/nonInteractiveToolExecutor.test.js.map +1 -1
  91. package/dist/src/core/prompts.d.ts +2 -1
  92. package/dist/src/core/prompts.js +93 -18
  93. package/dist/src/core/prompts.js.map +1 -1
  94. package/dist/src/core/prompts.test.js +78 -29
  95. package/dist/src/core/prompts.test.js.map +1 -1
  96. package/dist/src/core/turn.d.ts +15 -6
  97. package/dist/src/core/turn.js +14 -13
  98. package/dist/src/core/turn.js.map +1 -1
  99. package/dist/src/core/turn.test.js +14 -2
  100. package/dist/src/core/turn.test.js.map +1 -1
  101. package/dist/src/generated/git-commit.d.ts +2 -2
  102. package/dist/src/generated/git-commit.js +2 -2
  103. package/dist/src/generated/git-commit.js.map +1 -1
  104. package/dist/src/ide/detect-ide.d.ts +5 -2
  105. package/dist/src/ide/detect-ide.js +11 -2
  106. package/dist/src/ide/detect-ide.js.map +1 -1
  107. package/dist/src/ide/detect-ide.test.js +34 -0
  108. package/dist/src/ide/detect-ide.test.js.map +1 -1
  109. package/dist/src/ide/ide-client.d.ts +2 -1
  110. package/dist/src/ide/ide-client.js +25 -20
  111. package/dist/src/ide/ide-client.js.map +1 -1
  112. package/dist/src/ide/ide-client.test.js +6 -6
  113. package/dist/src/ide/ide-client.test.js.map +1 -1
  114. package/dist/src/ide/ide-installer.js +1 -1
  115. package/dist/src/ide/ide-installer.js.map +1 -1
  116. package/dist/src/ide/ide-installer.test.js +13 -1
  117. package/dist/src/ide/ide-installer.test.js.map +1 -1
  118. package/dist/src/index.d.ts +3 -0
  119. package/dist/src/index.js +3 -0
  120. package/dist/src/index.js.map +1 -1
  121. package/dist/src/mcp/oauth-provider.d.ts +1 -0
  122. package/dist/src/mcp/oauth-provider.js +19 -14
  123. package/dist/src/mcp/oauth-provider.js.map +1 -1
  124. package/dist/src/mcp/oauth-provider.test.js +137 -1
  125. package/dist/src/mcp/oauth-provider.test.js.map +1 -1
  126. package/dist/src/mcp/oauth-utils.js +1 -0
  127. package/dist/src/mcp/oauth-utils.js.map +1 -1
  128. package/dist/src/mcp/sa-impersonation-provider.d.ts +33 -0
  129. package/dist/src/mcp/sa-impersonation-provider.js +130 -0
  130. package/dist/src/mcp/sa-impersonation-provider.js.map +1 -0
  131. package/dist/src/mcp/sa-impersonation-provider.test.d.ts +6 -0
  132. package/dist/src/mcp/sa-impersonation-provider.test.js +117 -0
  133. package/dist/src/mcp/sa-impersonation-provider.test.js.map +1 -0
  134. package/dist/src/mcp/token-storage/file-token-storage.js +2 -1
  135. package/dist/src/mcp/token-storage/file-token-storage.js.map +1 -1
  136. package/dist/src/mcp/token-storage/file-token-storage.test.js +4 -3
  137. package/dist/src/mcp/token-storage/file-token-storage.test.js.map +1 -1
  138. package/dist/src/routing/strategies/compositeStrategy.js +4 -3
  139. package/dist/src/routing/strategies/compositeStrategy.js.map +1 -1
  140. package/dist/src/services/chatRecordingService.d.ts +3 -2
  141. package/dist/src/services/chatRecordingService.js +3 -2
  142. package/dist/src/services/chatRecordingService.js.map +1 -1
  143. package/dist/src/services/fileSystemService.d.ts +9 -0
  144. package/dist/src/services/fileSystemService.js +11 -0
  145. package/dist/src/services/fileSystemService.js.map +1 -1
  146. package/dist/src/services/shellExecutionService.d.ts +3 -0
  147. package/dist/src/services/shellExecutionService.js +165 -49
  148. package/dist/src/services/shellExecutionService.js.map +1 -1
  149. package/dist/src/services/shellExecutionService.test.js +74 -5
  150. package/dist/src/services/shellExecutionService.test.js.map +1 -1
  151. package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +18 -2
  152. package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +156 -11
  153. package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -1
  154. package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.d.ts +1 -0
  155. package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +226 -1
  156. package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +1 -1
  157. package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +19 -3
  158. package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +44 -5
  159. package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -1
  160. package/dist/src/telemetry/config.d.ts +31 -0
  161. package/dist/src/telemetry/config.js +76 -0
  162. package/dist/src/telemetry/config.js.map +1 -0
  163. package/dist/src/telemetry/config.test.d.ts +6 -0
  164. package/dist/src/telemetry/config.test.js +124 -0
  165. package/dist/src/telemetry/config.test.js.map +1 -0
  166. package/dist/src/telemetry/constants.d.ts +0 -34
  167. package/dist/src/telemetry/constants.js +0 -34
  168. package/dist/src/telemetry/constants.js.map +1 -1
  169. package/dist/src/telemetry/index.d.ts +6 -2
  170. package/dist/src/telemetry/index.js +17 -2
  171. package/dist/src/telemetry/index.js.map +1 -1
  172. package/dist/src/telemetry/loggers.d.ts +10 -2
  173. package/dist/src/telemetry/loggers.js +206 -273
  174. package/dist/src/telemetry/loggers.js.map +1 -1
  175. package/dist/src/telemetry/loggers.test.circular.js +3 -3
  176. package/dist/src/telemetry/loggers.test.circular.js.map +1 -1
  177. package/dist/src/telemetry/loggers.test.js +260 -13
  178. package/dist/src/telemetry/loggers.test.js.map +1 -1
  179. package/dist/src/telemetry/memory-monitor.d.ts +149 -0
  180. package/dist/src/telemetry/memory-monitor.js +335 -0
  181. package/dist/src/telemetry/memory-monitor.js.map +1 -0
  182. package/dist/src/telemetry/memory-monitor.test.d.ts +6 -0
  183. package/dist/src/telemetry/memory-monitor.test.js +472 -0
  184. package/dist/src/telemetry/memory-monitor.test.js.map +1 -0
  185. package/dist/src/telemetry/metrics.d.ts +436 -11
  186. package/dist/src/telemetry/metrics.js +600 -110
  187. package/dist/src/telemetry/metrics.js.map +1 -1
  188. package/dist/src/telemetry/metrics.test.js +898 -16
  189. package/dist/src/telemetry/metrics.test.js.map +1 -1
  190. package/dist/src/telemetry/sdk.js +4 -1
  191. package/dist/src/telemetry/sdk.js.map +1 -1
  192. package/dist/src/telemetry/sdk.test.js +13 -0
  193. package/dist/src/telemetry/sdk.test.js.map +1 -1
  194. package/dist/src/telemetry/telemetryAttributes.d.ts +8 -0
  195. package/dist/src/telemetry/telemetryAttributes.js +18 -0
  196. package/dist/src/telemetry/telemetryAttributes.js.map +1 -0
  197. package/dist/src/telemetry/types.d.ts +167 -5
  198. package/dist/src/telemetry/types.js +692 -35
  199. package/dist/src/telemetry/types.js.map +1 -1
  200. package/dist/src/telemetry/uiTelemetry.d.ts +1 -1
  201. package/dist/src/telemetry/uiTelemetry.js +1 -1
  202. package/dist/src/telemetry/uiTelemetry.js.map +1 -1
  203. package/dist/src/telemetry/uiTelemetry.test.js +3 -3
  204. package/dist/src/telemetry/uiTelemetry.test.js.map +1 -1
  205. package/dist/src/test-utils/mock-tool.d.ts +28 -3
  206. package/dist/src/test-utils/mock-tool.js +71 -1
  207. package/dist/src/test-utils/mock-tool.js.map +1 -1
  208. package/dist/src/tools/edit.js +6 -0
  209. package/dist/src/tools/edit.js.map +1 -1
  210. package/dist/src/tools/edit.test.js +41 -0
  211. package/dist/src/tools/edit.test.js.map +1 -1
  212. package/dist/src/tools/glob.js +4 -2
  213. package/dist/src/tools/glob.js.map +1 -1
  214. package/dist/src/tools/ls.js +1 -1
  215. package/dist/src/tools/ls.js.map +1 -1
  216. package/dist/src/tools/mcp-client.d.ts +5 -14
  217. package/dist/src/tools/mcp-client.js +50 -97
  218. package/dist/src/tools/mcp-client.js.map +1 -1
  219. package/dist/src/tools/mcp-client.test.js +175 -157
  220. package/dist/src/tools/mcp-client.test.js.map +1 -1
  221. package/dist/src/tools/mcp-tool.js +30 -2
  222. package/dist/src/tools/mcp-tool.js.map +1 -1
  223. package/dist/src/tools/mcp-tool.test.js +117 -0
  224. package/dist/src/tools/mcp-tool.test.js.map +1 -1
  225. package/dist/src/tools/memoryTool.d.ts +1 -1
  226. package/dist/src/tools/memoryTool.js +1 -2
  227. package/dist/src/tools/memoryTool.js.map +1 -1
  228. package/dist/src/tools/memoryTool.test.js +9 -8
  229. package/dist/src/tools/memoryTool.test.js.map +1 -1
  230. package/dist/src/tools/message-bus-integration.test.d.ts +6 -0
  231. package/dist/src/tools/message-bus-integration.test.js +183 -0
  232. package/dist/src/tools/message-bus-integration.test.js.map +1 -0
  233. package/dist/src/tools/shell.js +60 -4
  234. package/dist/src/tools/shell.js.map +1 -1
  235. package/dist/src/tools/shell.test.js +2 -1
  236. package/dist/src/tools/shell.test.js.map +1 -1
  237. package/dist/src/tools/smart-edit.d.ts +1 -1
  238. package/dist/src/tools/smart-edit.js +122 -12
  239. package/dist/src/tools/smart-edit.js.map +1 -1
  240. package/dist/src/tools/smart-edit.test.js +136 -29
  241. package/dist/src/tools/smart-edit.test.js.map +1 -1
  242. package/dist/src/tools/tool-error.d.ts +22 -0
  243. package/dist/src/tools/tool-error.js +28 -0
  244. package/dist/src/tools/tool-error.js.map +1 -1
  245. package/dist/src/tools/tool-names.d.ts +9 -0
  246. package/dist/src/tools/tool-names.js +18 -0
  247. package/dist/src/tools/tool-names.js.map +1 -0
  248. package/dist/src/tools/tool-registry.test.js +10 -10
  249. package/dist/src/tools/tool-registry.test.js.map +1 -1
  250. package/dist/src/tools/tools.d.ts +11 -3
  251. package/dist/src/tools/tools.js +94 -3
  252. package/dist/src/tools/tools.js.map +1 -1
  253. package/dist/src/tools/web-fetch.js +3 -0
  254. package/dist/src/tools/web-fetch.js.map +1 -1
  255. package/dist/src/tools/web-fetch.test.js +44 -0
  256. package/dist/src/tools/web-fetch.test.js.map +1 -1
  257. package/dist/src/tools/web-search.js +2 -1
  258. package/dist/src/tools/web-search.js.map +1 -1
  259. package/dist/src/tools/write-file.js +2 -1
  260. package/dist/src/tools/write-file.js.map +1 -1
  261. package/dist/src/tools/write-todos.d.ts +25 -0
  262. package/dist/src/tools/write-todos.js +151 -0
  263. package/dist/src/tools/write-todos.js.map +1 -0
  264. package/dist/src/tools/write-todos.test.d.ts +6 -0
  265. package/dist/src/tools/write-todos.test.js +89 -0
  266. package/dist/src/tools/write-todos.test.js.map +1 -0
  267. package/dist/src/utils/bfsFileSearch.d.ts +1 -1
  268. package/dist/src/utils/editCorrector.js +2 -2
  269. package/dist/src/utils/editCorrector.js.map +1 -1
  270. package/dist/src/utils/editor.js +1 -0
  271. package/dist/src/utils/editor.js.map +1 -1
  272. package/dist/src/utils/editor.test.js +1 -0
  273. package/dist/src/utils/editor.test.js.map +1 -1
  274. package/dist/src/utils/errorParsing.d.ts +1 -1
  275. package/dist/src/utils/errorParsing.js +5 -33
  276. package/dist/src/utils/errorParsing.js.map +1 -1
  277. package/dist/src/utils/errorParsing.test.js +0 -88
  278. package/dist/src/utils/errorParsing.test.js.map +1 -1
  279. package/dist/src/utils/flashFallback.test.js +26 -45
  280. package/dist/src/utils/flashFallback.test.js.map +1 -1
  281. package/dist/src/utils/formatters.d.ts +1 -0
  282. package/dist/src/utils/formatters.js +2 -1
  283. package/dist/src/utils/formatters.js.map +1 -1
  284. package/dist/src/utils/formatters.test.d.ts +6 -0
  285. package/dist/src/utils/formatters.test.js +26 -0
  286. package/dist/src/utils/formatters.test.js.map +1 -0
  287. package/dist/src/utils/getFolderStructure.d.ts +1 -1
  288. package/dist/src/utils/getFolderStructure.js +1 -1
  289. package/dist/src/utils/getFolderStructure.js.map +1 -1
  290. package/dist/src/utils/getFolderStructure.test.js +7 -6
  291. package/dist/src/utils/getFolderStructure.test.js.map +1 -1
  292. package/dist/src/utils/googleErrors.d.ts +104 -0
  293. package/dist/src/utils/googleErrors.js +108 -0
  294. package/dist/src/utils/googleErrors.js.map +1 -0
  295. package/dist/src/utils/googleErrors.test.d.ts +6 -0
  296. package/dist/src/utils/googleErrors.test.js +212 -0
  297. package/dist/src/utils/googleErrors.test.js.map +1 -0
  298. package/dist/src/utils/googleQuotaErrors.d.ts +35 -0
  299. package/dist/src/utils/googleQuotaErrors.js +108 -0
  300. package/dist/src/utils/googleQuotaErrors.js.map +1 -0
  301. package/dist/src/utils/googleQuotaErrors.test.d.ts +6 -0
  302. package/dist/src/utils/googleQuotaErrors.test.js +189 -0
  303. package/dist/src/utils/googleQuotaErrors.test.js.map +1 -0
  304. package/dist/src/utils/installationManager.test.js +2 -1
  305. package/dist/src/utils/installationManager.test.js.map +1 -1
  306. package/dist/src/utils/llm-edit-fixer.js +14 -4
  307. package/dist/src/utils/llm-edit-fixer.js.map +1 -1
  308. package/dist/src/utils/llm-edit-fixer.test.js +81 -0
  309. package/dist/src/utils/llm-edit-fixer.test.js.map +1 -1
  310. package/dist/src/utils/memoryDiscovery.d.ts +2 -1
  311. package/dist/src/utils/memoryDiscovery.js +3 -2
  312. package/dist/src/utils/memoryDiscovery.js.map +1 -1
  313. package/dist/src/utils/memoryDiscovery.test.js +99 -21
  314. package/dist/src/utils/memoryDiscovery.test.js.map +1 -1
  315. package/dist/src/utils/memoryImportProcessor.js +13 -20
  316. package/dist/src/utils/memoryImportProcessor.js.map +1 -1
  317. package/dist/src/utils/memoryImportProcessor.test.js +14 -0
  318. package/dist/src/utils/memoryImportProcessor.test.js.map +1 -1
  319. package/dist/src/utils/pathCorrector.d.ts +25 -0
  320. package/dist/src/utils/pathCorrector.js +33 -0
  321. package/dist/src/utils/pathCorrector.js.map +1 -0
  322. package/dist/src/utils/pathCorrector.test.d.ts +6 -0
  323. package/dist/src/utils/pathCorrector.test.js +83 -0
  324. package/dist/src/utils/pathCorrector.test.js.map +1 -0
  325. package/dist/src/utils/quotaErrorDetection.d.ts +0 -2
  326. package/dist/src/utils/quotaErrorDetection.js +0 -46
  327. package/dist/src/utils/quotaErrorDetection.js.map +1 -1
  328. package/dist/src/utils/retry.d.ts +3 -1
  329. package/dist/src/utils/retry.js +60 -162
  330. package/dist/src/utils/retry.js.map +1 -1
  331. package/dist/src/utils/retry.test.js +105 -135
  332. package/dist/src/utils/retry.test.js.map +1 -1
  333. package/dist/src/utils/schemaValidator.js +11 -1
  334. package/dist/src/utils/schemaValidator.js.map +1 -1
  335. package/dist/src/utils/schemaValidator.test.d.ts +6 -0
  336. package/dist/src/utils/schemaValidator.test.js +113 -0
  337. package/dist/src/utils/schemaValidator.test.js.map +1 -0
  338. package/dist/src/utils/shell-utils.d.ts +1 -0
  339. package/dist/src/utils/shell-utils.js +6 -2
  340. package/dist/src/utils/shell-utils.js.map +1 -1
  341. package/dist/src/utils/shell-utils.test.js +5 -0
  342. package/dist/src/utils/shell-utils.test.js.map +1 -1
  343. package/dist/src/utils/terminalSerializer.d.ts +1 -4
  344. package/dist/src/utils/terminalSerializer.js +3 -3
  345. package/dist/src/utils/terminalSerializer.js.map +1 -1
  346. package/dist/src/utils/thoughtUtils.d.ts +21 -0
  347. package/dist/src/utils/thoughtUtils.js +39 -0
  348. package/dist/src/utils/thoughtUtils.js.map +1 -0
  349. package/dist/src/utils/thoughtUtils.test.d.ts +6 -0
  350. package/dist/src/utils/thoughtUtils.test.js +78 -0
  351. package/dist/src/utils/thoughtUtils.test.js.map +1 -0
  352. package/dist/src/utils/tool-utils.js +2 -2
  353. package/dist/src/utils/tool-utils.js.map +1 -1
  354. package/dist/src/utils/tool-utils.test.js +8 -0
  355. package/dist/src/utils/tool-utils.test.js.map +1 -1
  356. package/dist/src/utils/userAccountManager.test.js +2 -1
  357. package/dist/src/utils/userAccountManager.test.js.map +1 -1
  358. package/dist/tsconfig.tsbuildinfo +1 -1
  359. package/package.json +2 -2
  360. package/dist/src/test-utils/tools.d.ts +0 -45
  361. package/dist/src/test-utils/tools.js +0 -105
  362. 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,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 Assist License. (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)
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="YOUR_PROJECT_NAME"
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 [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).
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/cli/index.md) - Get up and running quickly
231
- - [**Authentication Setup**](./docs/cli/authentication.md) - Detailed auth configuration
232
- - [**Configuration Guide**](./docs/cli/configuration.md) - Settings and customization
233
- - [**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.
234
262
 
235
263
  ### Core Features
236
264
 
237
- - [**Commands Reference**](./docs/cli/commands.md) - All slash commands (`/help`, `/chat`, `/mcp`, etc.)
238
- - [**Checkpointing**](./docs/checkpointing.md) - Save and resume conversations
239
- - [**Memory Management**](./docs/tools/memory.md) - Using GEMINI.md context files
240
- - [**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.
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
- - [Multi-file Operations](./docs/tools/multi-file.md)
249
- - [**MCP Server Integration**](./docs/tools/mcp-server.md) - Extend with custom tools
250
- - [**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.
251
285
 
252
286
  ### Advanced Topics
253
287
 
254
- - [**Architecture Overview**](./docs/architecture.md) - How Gemini CLI works
255
- - [**IDE Integration**](./docs/ide-integration.md) - VS Code companion
256
- - [**Sandboxing & Security**](./docs/sandbox.md) - Safe execution environments
257
- - [**Enterprise Deployment**](./docs/deployment.md) - Docker, system-wide config
258
- - [**Telemetry & Monitoring**](./docs/telemetry.md) - Usage tracking
259
- - [**Tools API Development**](./docs/core/tools-api.md) - Create custom tools
260
-
261
- ### Configuration & Customization
262
-
263
- - [**Settings Reference**](./docs/cli/configuration.md) - All configuration options
264
- - [**Theme Customization**](./docs/cli/themes.md) - Visual customization
265
- - [**.gemini Directory**](./docs/gemini-ignore.md) - Project-specific settings
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 solutions
271
- - [**FAQ**](./docs/troubleshooting.md#frequently-asked-questions) - Quick answers
272
- - 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.
273
307
 
274
308
  ### Using MCP Servers
275
309
 
276
- 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:
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 instructions.
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 encourage the community to:
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 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.
296
334
 
297
- 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.
298
337
 
299
338
  ## 📖 Resources
300
339
 
301
- - **[Official Roadmap](./ROADMAP.md)** - See what's coming next
302
- - **[NPM Package](https://www.npmjs.com/package/@google/gemini-cli)** - Package registry
303
- - **[GitHub Issues](https://github.com/google-gemini/gemini-cli/issues)** - Report bugs or request features
304
- - **[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.
305
348
 
306
349
  ### Uninstall
307
350
 
308
- See the [Uninstall Guide](docs/Uninstall.md) for removal instructions.
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,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,oDAAoD,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,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
+ }