@google/gemini-cli-core 0.34.0-preview.3 → 0.35.0-nightly.20260314.3038fdce2

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 (355) hide show
  1. package/dist/docs/changelogs/index.md +19 -0
  2. package/dist/docs/changelogs/latest.md +217 -191
  3. package/dist/docs/changelogs/preview.md +447 -184
  4. package/dist/docs/cli/model-routing.md +18 -1
  5. package/dist/docs/cli/model-steering.md +79 -0
  6. package/dist/docs/cli/plan-mode.md +99 -14
  7. package/dist/docs/cli/settings.md +14 -12
  8. package/dist/docs/cli/telemetry.md +45 -0
  9. package/dist/docs/cli/tutorials/plan-mode-steering.md +89 -0
  10. package/dist/docs/core/index.md +2 -0
  11. package/dist/docs/core/local-model-routing.md +193 -0
  12. package/dist/docs/reference/configuration.md +27 -3
  13. package/dist/docs/reference/keyboard-shortcuts.md +168 -90
  14. package/dist/docs/reference/policy-engine.md +30 -6
  15. package/dist/docs/resources/troubleshooting.md +15 -0
  16. package/dist/docs/sidebar.json +10 -0
  17. package/dist/docs/tools/shell.md +8 -0
  18. package/dist/google-gemini-cli-core-0.35.0-nightly.20260311.657f19c1f.tgz +0 -0
  19. package/dist/src/agents/a2a-client-manager.d.ts +11 -4
  20. package/dist/src/agents/a2a-client-manager.js +61 -34
  21. package/dist/src/agents/a2a-client-manager.js.map +1 -1
  22. package/dist/src/agents/a2a-client-manager.test.js +178 -115
  23. package/dist/src/agents/a2a-client-manager.test.js.map +1 -1
  24. package/dist/src/agents/a2aUtils.d.ts +4 -28
  25. package/dist/src/agents/a2aUtils.js +20 -181
  26. package/dist/src/agents/a2aUtils.js.map +1 -1
  27. package/dist/src/agents/a2aUtils.test.js +19 -106
  28. package/dist/src/agents/a2aUtils.test.js.map +1 -1
  29. package/dist/src/agents/agent-scheduler.d.ts +2 -0
  30. package/dist/src/agents/agent-scheduler.js +3 -2
  31. package/dist/src/agents/agent-scheduler.js.map +1 -1
  32. package/dist/src/agents/agent-scheduler.test.js +12 -3
  33. package/dist/src/agents/agent-scheduler.test.js.map +1 -1
  34. package/dist/src/agents/agentLoader.d.ts +2 -2
  35. package/dist/src/agents/agentLoader.js +15 -0
  36. package/dist/src/agents/agentLoader.js.map +1 -1
  37. package/dist/src/agents/auth-provider/factory.d.ts +2 -0
  38. package/dist/src/agents/auth-provider/factory.js +6 -3
  39. package/dist/src/agents/auth-provider/factory.js.map +1 -1
  40. package/dist/src/agents/auth-provider/google-credentials-provider.d.ts +26 -0
  41. package/dist/src/agents/auth-provider/google-credentials-provider.js +117 -0
  42. package/dist/src/agents/auth-provider/google-credentials-provider.js.map +1 -0
  43. package/dist/src/agents/auth-provider/google-credentials-provider.test.d.ts +6 -0
  44. package/dist/src/agents/auth-provider/google-credentials-provider.test.js +126 -0
  45. package/dist/src/agents/auth-provider/google-credentials-provider.test.js.map +1 -0
  46. package/dist/src/agents/browser/browserAgentFactory.js +11 -2
  47. package/dist/src/agents/browser/browserAgentFactory.js.map +1 -1
  48. package/dist/src/agents/browser/browserAgentInvocation.d.ts +4 -3
  49. package/dist/src/agents/browser/browserAgentInvocation.js +10 -4
  50. package/dist/src/agents/browser/browserAgentInvocation.js.map +1 -1
  51. package/dist/src/agents/browser/browserAgentInvocation.test.js +1 -0
  52. package/dist/src/agents/browser/browserAgentInvocation.test.js.map +1 -1
  53. package/dist/src/agents/browser/browserManager.d.ts +10 -0
  54. package/dist/src/agents/browser/browserManager.js +53 -8
  55. package/dist/src/agents/browser/browserManager.js.map +1 -1
  56. package/dist/src/agents/browser/inputBlocker.d.ts +51 -0
  57. package/dist/src/agents/browser/inputBlocker.js +234 -0
  58. package/dist/src/agents/browser/inputBlocker.js.map +1 -0
  59. package/dist/src/agents/browser/inputBlocker.test.d.ts +6 -0
  60. package/dist/src/agents/browser/inputBlocker.test.js +82 -0
  61. package/dist/src/agents/browser/inputBlocker.test.js.map +1 -0
  62. package/dist/src/agents/browser/mcpToolWrapper.d.ts +3 -2
  63. package/dist/src/agents/browser/mcpToolWrapper.js +49 -8
  64. package/dist/src/agents/browser/mcpToolWrapper.js.map +1 -1
  65. package/dist/src/agents/browser/mcpToolWrapper.test.js +51 -0
  66. package/dist/src/agents/browser/mcpToolWrapper.test.js.map +1 -1
  67. package/dist/src/agents/local-executor.d.ts +5 -4
  68. package/dist/src/agents/local-executor.js +30 -25
  69. package/dist/src/agents/local-executor.js.map +1 -1
  70. package/dist/src/agents/local-executor.test.js +269 -3
  71. package/dist/src/agents/local-executor.test.js.map +1 -1
  72. package/dist/src/agents/local-invocation.d.ts +4 -4
  73. package/dist/src/agents/local-invocation.js +12 -9
  74. package/dist/src/agents/local-invocation.js.map +1 -1
  75. package/dist/src/agents/local-invocation.test.js +19 -3
  76. package/dist/src/agents/local-invocation.test.js.map +1 -1
  77. package/dist/src/agents/registry.js +3 -2
  78. package/dist/src/agents/registry.js.map +1 -1
  79. package/dist/src/agents/registry.test.js +1 -0
  80. package/dist/src/agents/registry.test.js.map +1 -1
  81. package/dist/src/agents/remote-invocation.d.ts +0 -9
  82. package/dist/src/agents/remote-invocation.js +1 -28
  83. package/dist/src/agents/remote-invocation.js.map +1 -1
  84. package/dist/src/agents/remote-invocation.test.js +1 -0
  85. package/dist/src/agents/remote-invocation.test.js.map +1 -1
  86. package/dist/src/agents/subagent-tool-wrapper.d.ts +5 -4
  87. package/dist/src/agents/subagent-tool-wrapper.js +9 -5
  88. package/dist/src/agents/subagent-tool-wrapper.js.map +1 -1
  89. package/dist/src/agents/subagent-tool-wrapper.test.js +15 -1
  90. package/dist/src/agents/subagent-tool-wrapper.test.js.map +1 -1
  91. package/dist/src/agents/subagent-tool.d.ts +3 -3
  92. package/dist/src/agents/subagent-tool.js +16 -12
  93. package/dist/src/agents/subagent-tool.js.map +1 -1
  94. package/dist/src/agents/subagent-tool.test.js +13 -3
  95. package/dist/src/agents/subagent-tool.test.js.map +1 -1
  96. package/dist/src/code_assist/oauth2.js +0 -1
  97. package/dist/src/code_assist/oauth2.js.map +1 -1
  98. package/dist/src/code_assist/server.js +2 -2
  99. package/dist/src/code_assist/server.js.map +1 -1
  100. package/dist/src/code_assist/server.test.js +5 -1
  101. package/dist/src/code_assist/server.test.js.map +1 -1
  102. package/dist/src/code_assist/telemetry.d.ts +2 -2
  103. package/dist/src/code_assist/telemetry.js +5 -3
  104. package/dist/src/code_assist/telemetry.js.map +1 -1
  105. package/dist/src/code_assist/telemetry.test.js +14 -12
  106. package/dist/src/code_assist/telemetry.test.js.map +1 -1
  107. package/dist/src/code_assist/types.d.ts +14 -12
  108. package/dist/src/code_assist/types.js.map +1 -1
  109. package/dist/src/config/agent-loop-context.d.ts +3 -0
  110. package/dist/src/config/config.d.ts +75 -2
  111. package/dist/src/config/config.js +78 -11
  112. package/dist/src/config/config.js.map +1 -1
  113. package/dist/src/config/config.test.js +170 -10
  114. package/dist/src/config/config.test.js.map +1 -1
  115. package/dist/src/config/models.d.ts +14 -0
  116. package/dist/src/config/models.js +37 -0
  117. package/dist/src/config/models.js.map +1 -1
  118. package/dist/src/config/models.test.js +51 -1
  119. package/dist/src/config/models.test.js.map +1 -1
  120. package/dist/src/config/storage.d.ts +1 -0
  121. package/dist/src/config/storage.js +3 -0
  122. package/dist/src/config/storage.js.map +1 -1
  123. package/dist/src/core/baseLlmClient.js +19 -3
  124. package/dist/src/core/baseLlmClient.js.map +1 -1
  125. package/dist/src/core/baseLlmClient.test.js +2 -0
  126. package/dist/src/core/baseLlmClient.test.js.map +1 -1
  127. package/dist/src/core/client.d.ts +4 -3
  128. package/dist/src/core/client.js +42 -17
  129. package/dist/src/core/client.js.map +1 -1
  130. package/dist/src/core/client.test.js +8 -0
  131. package/dist/src/core/client.test.js.map +1 -1
  132. package/dist/src/core/contentGenerator.d.ts +1 -0
  133. package/dist/src/core/contentGenerator.js +35 -3
  134. package/dist/src/core/contentGenerator.js.map +1 -1
  135. package/dist/src/core/contentGenerator.test.js +137 -2
  136. package/dist/src/core/contentGenerator.test.js.map +1 -1
  137. package/dist/src/core/coreToolHookTriggers.d.ts +2 -3
  138. package/dist/src/core/coreToolHookTriggers.js +5 -11
  139. package/dist/src/core/coreToolHookTriggers.js.map +1 -1
  140. package/dist/src/core/coreToolHookTriggers.test.js +24 -0
  141. package/dist/src/core/coreToolHookTriggers.test.js.map +1 -1
  142. package/dist/src/core/coreToolScheduler.js +1 -1
  143. package/dist/src/core/coreToolScheduler.js.map +1 -1
  144. package/dist/src/core/geminiChat.js +31 -21
  145. package/dist/src/core/geminiChat.js.map +1 -1
  146. package/dist/src/core/geminiChat.test.js +6 -4
  147. package/dist/src/core/geminiChat.test.js.map +1 -1
  148. package/dist/src/core/geminiChat_network_retry.test.js +21 -11
  149. package/dist/src/core/geminiChat_network_retry.test.js.map +1 -1
  150. package/dist/src/fallback/handler.js +0 -4
  151. package/dist/src/fallback/handler.js.map +1 -1
  152. package/dist/src/fallback/handler.test.js +0 -6
  153. package/dist/src/fallback/handler.test.js.map +1 -1
  154. package/dist/src/generated/git-commit.d.ts +2 -2
  155. package/dist/src/generated/git-commit.js +2 -2
  156. package/dist/src/generated/git-commit.js.map +1 -1
  157. package/dist/src/ide/detect-ide.d.ts +8 -0
  158. package/dist/src/ide/detect-ide.js +12 -1
  159. package/dist/src/ide/detect-ide.js.map +1 -1
  160. package/dist/src/ide/detect-ide.test.js +12 -0
  161. package/dist/src/ide/detect-ide.test.js.map +1 -1
  162. package/dist/src/ide/ide-installer.js +20 -8
  163. package/dist/src/ide/ide-installer.js.map +1 -1
  164. package/dist/src/ide/ide-installer.test.js +60 -4
  165. package/dist/src/ide/ide-installer.test.js.map +1 -1
  166. package/dist/src/mcp/oauth-provider.js +0 -2
  167. package/dist/src/mcp/oauth-provider.js.map +1 -1
  168. package/dist/src/mcp/oauth-token-storage.test.js +6 -10
  169. package/dist/src/mcp/oauth-token-storage.test.js.map +1 -1
  170. package/dist/src/mcp/oauth-utils.js +0 -2
  171. package/dist/src/mcp/oauth-utils.js.map +1 -1
  172. package/dist/src/mcp/token-storage/file-token-storage.d.ts +24 -0
  173. package/dist/src/mcp/token-storage/file-token-storage.js +152 -0
  174. package/dist/src/mcp/token-storage/file-token-storage.js.map +1 -0
  175. package/dist/src/mcp/token-storage/file-token-storage.test.d.ts +6 -0
  176. package/dist/src/mcp/token-storage/file-token-storage.test.js +276 -0
  177. package/dist/src/mcp/token-storage/file-token-storage.test.js.map +1 -0
  178. package/dist/src/mcp/token-storage/hybrid-token-storage.js +21 -9
  179. package/dist/src/mcp/token-storage/hybrid-token-storage.js.map +1 -1
  180. package/dist/src/mcp/token-storage/hybrid-token-storage.test.js +59 -10
  181. package/dist/src/mcp/token-storage/hybrid-token-storage.test.js.map +1 -1
  182. package/dist/src/mcp/token-storage/index.d.ts +1 -1
  183. package/dist/src/mcp/token-storage/index.js +1 -1
  184. package/dist/src/mcp/token-storage/index.js.map +1 -1
  185. package/dist/src/mcp/token-storage/keychain-token-storage.d.ts +0 -1
  186. package/dist/src/mcp/token-storage/keychain-token-storage.js +0 -3
  187. package/dist/src/mcp/token-storage/keychain-token-storage.js.map +1 -1
  188. package/dist/src/policy/config.d.ts +14 -2
  189. package/dist/src/policy/config.js +94 -49
  190. package/dist/src/policy/config.js.map +1 -1
  191. package/dist/src/policy/config.test.js +208 -488
  192. package/dist/src/policy/config.test.js.map +1 -1
  193. package/dist/src/policy/policies/plan.toml +1 -1
  194. package/dist/src/policy/stable-stringify.js +15 -5
  195. package/dist/src/policy/stable-stringify.js.map +1 -1
  196. package/dist/src/policy/types.d.ts +1 -0
  197. package/dist/src/policy/types.js.map +1 -1
  198. package/dist/src/policy/utils.d.ts +17 -0
  199. package/dist/src/policy/utils.js +27 -7
  200. package/dist/src/policy/utils.js.map +1 -1
  201. package/dist/src/prompts/snippets.js +2 -1
  202. package/dist/src/prompts/snippets.js.map +1 -1
  203. package/dist/src/prompts/utils.test.d.ts +6 -0
  204. package/dist/src/prompts/utils.test.js +225 -0
  205. package/dist/src/prompts/utils.test.js.map +1 -0
  206. package/dist/src/routing/modelRouterService.js +2 -2
  207. package/dist/src/routing/modelRouterService.js.map +1 -1
  208. package/dist/src/routing/modelRouterService.test.js +4 -3
  209. package/dist/src/routing/modelRouterService.test.js.map +1 -1
  210. package/dist/src/routing/strategies/numericalClassifierStrategy.js +6 -40
  211. package/dist/src/routing/strategies/numericalClassifierStrategy.js.map +1 -1
  212. package/dist/src/routing/strategies/numericalClassifierStrategy.test.js +29 -64
  213. package/dist/src/routing/strategies/numericalClassifierStrategy.test.js.map +1 -1
  214. package/dist/src/scheduler/policy.d.ts +3 -7
  215. package/dist/src/scheduler/policy.js +4 -3
  216. package/dist/src/scheduler/policy.js.map +1 -1
  217. package/dist/src/scheduler/policy.test.js +51 -31
  218. package/dist/src/scheduler/policy.test.js.map +1 -1
  219. package/dist/src/scheduler/scheduler.d.ts +4 -2
  220. package/dist/src/scheduler/scheduler.js +19 -16
  221. package/dist/src/scheduler/scheduler.js.map +1 -1
  222. package/dist/src/scheduler/scheduler.test.js +33 -10
  223. package/dist/src/scheduler/scheduler.test.js.map +1 -1
  224. package/dist/src/scheduler/scheduler_parallel.test.js +40 -2
  225. package/dist/src/scheduler/scheduler_parallel.test.js.map +1 -1
  226. package/dist/src/scheduler/scheduler_waiting_callback.test.js +1 -1
  227. package/dist/src/scheduler/scheduler_waiting_callback.test.js.map +1 -1
  228. package/dist/src/scheduler/tool-executor.d.ts +3 -3
  229. package/dist/src/scheduler/tool-executor.js +15 -21
  230. package/dist/src/scheduler/tool-executor.js.map +1 -1
  231. package/dist/src/scheduler/tool-executor.test.js +43 -8
  232. package/dist/src/scheduler/tool-executor.test.js.map +1 -1
  233. package/dist/src/services/chatRecordingService.js +2 -1
  234. package/dist/src/services/chatRecordingService.js.map +1 -1
  235. package/dist/src/services/chatRecordingService.test.js +21 -0
  236. package/dist/src/services/chatRecordingService.test.js.map +1 -1
  237. package/dist/src/services/executionLifecycleService.d.ts +83 -0
  238. package/dist/src/services/executionLifecycleService.js +271 -0
  239. package/dist/src/services/executionLifecycleService.js.map +1 -0
  240. package/dist/src/services/executionLifecycleService.test.d.ts +6 -0
  241. package/dist/src/services/executionLifecycleService.test.js +227 -0
  242. package/dist/src/services/executionLifecycleService.test.js.map +1 -0
  243. package/dist/src/services/keychainService.d.ts +0 -5
  244. package/dist/src/services/keychainService.js +13 -30
  245. package/dist/src/services/keychainService.js.map +1 -1
  246. package/dist/src/services/keychainService.test.js +22 -52
  247. package/dist/src/services/keychainService.test.js.map +1 -1
  248. package/dist/src/services/sandboxManager.d.ts +54 -0
  249. package/dist/src/services/sandboxManager.js +30 -0
  250. package/dist/src/services/sandboxManager.js.map +1 -0
  251. package/dist/src/services/sandboxManager.test.d.ts +6 -0
  252. package/dist/src/services/sandboxManager.test.js +95 -0
  253. package/dist/src/services/sandboxManager.test.js.map +1 -0
  254. package/dist/src/services/shellExecutionService.d.ts +4 -52
  255. package/dist/src/services/shellExecutionService.js +437 -498
  256. package/dist/src/services/shellExecutionService.js.map +1 -1
  257. package/dist/src/services/shellExecutionService.test.js +10 -21
  258. package/dist/src/services/shellExecutionService.test.js.map +1 -1
  259. package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +13 -2
  260. package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +91 -1
  261. package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -1
  262. package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +77 -0
  263. package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +1 -1
  264. package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +10 -1
  265. package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +25 -1
  266. package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -1
  267. package/dist/src/telemetry/index.d.ts +3 -3
  268. package/dist/src/telemetry/index.js +3 -3
  269. package/dist/src/telemetry/index.js.map +1 -1
  270. package/dist/src/telemetry/loggers.d.ts +2 -1
  271. package/dist/src/telemetry/loggers.js +32 -1
  272. package/dist/src/telemetry/loggers.js.map +1 -1
  273. package/dist/src/telemetry/loggers.test.js +37 -2
  274. package/dist/src/telemetry/loggers.test.js.map +1 -1
  275. package/dist/src/telemetry/metrics.d.ts +13 -0
  276. package/dist/src/telemetry/metrics.js +17 -0
  277. package/dist/src/telemetry/metrics.js.map +1 -1
  278. package/dist/src/telemetry/startupProfiler.js +4 -4
  279. package/dist/src/telemetry/startupProfiler.js.map +1 -1
  280. package/dist/src/telemetry/startupProfiler.test.js +19 -0
  281. package/dist/src/telemetry/startupProfiler.test.js.map +1 -1
  282. package/dist/src/telemetry/telemetry-utils.test.js +3 -3
  283. package/dist/src/telemetry/types.d.ts +16 -2
  284. package/dist/src/telemetry/types.js +34 -0
  285. package/dist/src/telemetry/types.js.map +1 -1
  286. package/dist/src/telemetry/uiTelemetry.d.ts +7 -0
  287. package/dist/src/telemetry/uiTelemetry.js +78 -0
  288. package/dist/src/telemetry/uiTelemetry.js.map +1 -1
  289. package/dist/src/telemetry/uiTelemetry.test.js +101 -0
  290. package/dist/src/telemetry/uiTelemetry.test.js.map +1 -1
  291. package/dist/src/tools/exit-plan-mode.js +10 -2
  292. package/dist/src/tools/exit-plan-mode.js.map +1 -1
  293. package/dist/src/tools/exit-plan-mode.test.js +15 -0
  294. package/dist/src/tools/exit-plan-mode.test.js.map +1 -1
  295. package/dist/src/tools/ls.js +2 -2
  296. package/dist/src/tools/ls.js.map +1 -1
  297. package/dist/src/tools/mcp-client.js +0 -1
  298. package/dist/src/tools/mcp-client.js.map +1 -1
  299. package/dist/src/tools/mcp-client.test.js +4 -0
  300. package/dist/src/tools/mcp-client.test.js.map +1 -1
  301. package/dist/src/tools/mcp-tool.test.js +10 -1
  302. package/dist/src/tools/mcp-tool.test.js.map +1 -1
  303. package/dist/src/tools/read-many-files.js +2 -4
  304. package/dist/src/tools/read-many-files.js.map +1 -1
  305. package/dist/src/tools/shell.d.ts +1 -1
  306. package/dist/src/tools/shell.js +3 -3
  307. package/dist/src/tools/shell.js.map +1 -1
  308. package/dist/src/tools/tool-registry.test.js +4 -0
  309. package/dist/src/tools/tool-registry.test.js.map +1 -1
  310. package/dist/src/tools/tools.d.ts +34 -1
  311. package/dist/src/tools/tools.js +47 -1
  312. package/dist/src/tools/tools.js.map +1 -1
  313. package/dist/src/tools/web-fetch.d.ts +5 -0
  314. package/dist/src/tools/web-fetch.js +177 -100
  315. package/dist/src/tools/web-fetch.js.map +1 -1
  316. package/dist/src/tools/web-fetch.test.js +130 -26
  317. package/dist/src/tools/web-fetch.test.js.map +1 -1
  318. package/dist/src/tools/web-search.test.js +2 -0
  319. package/dist/src/tools/web-search.test.js.map +1 -1
  320. package/dist/src/utils/fetch.d.ts +0 -29
  321. package/dist/src/utils/fetch.js +10 -123
  322. package/dist/src/utils/fetch.js.map +1 -1
  323. package/dist/src/utils/fetch.test.js +1 -103
  324. package/dist/src/utils/fetch.test.js.map +1 -1
  325. package/dist/src/utils/language-detection.js +96 -89
  326. package/dist/src/utils/language-detection.js.map +1 -1
  327. package/dist/src/utils/language-detection.test.d.ts +6 -0
  328. package/dist/src/utils/language-detection.test.js +39 -0
  329. package/dist/src/utils/language-detection.test.js.map +1 -0
  330. package/dist/src/utils/oauth-flow.js +0 -2
  331. package/dist/src/utils/oauth-flow.js.map +1 -1
  332. package/dist/src/utils/paths.js +5 -2
  333. package/dist/src/utils/paths.js.map +1 -1
  334. package/dist/src/utils/paths.test.js +11 -0
  335. package/dist/src/utils/paths.test.js.map +1 -1
  336. package/dist/src/utils/process-utils.js +18 -4
  337. package/dist/src/utils/process-utils.js.map +1 -1
  338. package/dist/src/utils/process-utils.test.js +32 -10
  339. package/dist/src/utils/process-utils.test.js.map +1 -1
  340. package/dist/src/utils/retry.d.ts +7 -0
  341. package/dist/src/utils/retry.js +40 -3
  342. package/dist/src/utils/retry.js.map +1 -1
  343. package/dist/src/utils/retry.test.js +13 -0
  344. package/dist/src/utils/retry.test.js.map +1 -1
  345. package/dist/src/utils/summarizer.test.js +5 -0
  346. package/dist/src/utils/summarizer.test.js.map +1 -1
  347. package/dist/src/utils/surface.d.ts +18 -0
  348. package/dist/src/utils/surface.js +46 -0
  349. package/dist/src/utils/surface.js.map +1 -0
  350. package/dist/tsconfig.tsbuildinfo +1 -1
  351. package/package.json +1 -1
  352. package/dist/google-gemini-cli-core-0.34.0-preview.2.tgz +0 -0
  353. package/dist/src/services/fileKeychain.d.ts +0 -24
  354. package/dist/src/services/fileKeychain.js +0 -123
  355. package/dist/src/services/fileKeychain.js.map +0 -1
@@ -26,6 +26,20 @@ policies.
26
26
  the CLI will use an available fallback model for the current turn or the
27
27
  remainder of the session.
28
28
 
29
+ ### Local Model Routing (Experimental)
30
+
31
+ Gemini CLI supports using a local model for routing decisions. When configured,
32
+ Gemini CLI will use a locally-running **Gemma** model to make routing decisions
33
+ (instead of sending routing decisions to a hosted model). This feature can help
34
+ reduce costs associated with hosted model usage while offering similar routing
35
+ decision latency and quality.
36
+
37
+ In order to use this feature, the local Gemma model **must** be served behind a
38
+ Gemini API and accessible via HTTP at an endpoint configured in `settings.json`.
39
+
40
+ For more details on how to configure local model routing, see
41
+ [Local Model Routing](../core/local-model-routing.md).
42
+
29
43
  ### Model selection precedence
30
44
 
31
45
  The model used by Gemini CLI is determined by the following order of precedence:
@@ -38,5 +52,8 @@ The model used by Gemini CLI is determined by the following order of precedence:
38
52
  3. **`model.name` in `settings.json`:** If neither of the above are set, the
39
53
  model specified in the `model.name` property of your `settings.json` file
40
54
  will be used.
41
- 4. **Default model:** If none of the above are set, the default model will be
55
+ 4. **Local model (experimental):** If the Gemma local model router is enabled
56
+ in your `settings.json` file, the CLI will use the local Gemma model
57
+ (instead of Gemini models) to route the request to an appropriate model.
58
+ 5. **Default model:** If none of the above are set, the default model will be
42
59
  used. The default model is `auto`
@@ -0,0 +1,79 @@
1
+ # Model steering (experimental)
2
+
3
+ Model steering lets you provide real-time guidance and feedback to Gemini CLI
4
+ while it is actively executing a task. This lets you correct course, add missing
5
+ context, or skip unnecessary steps without having to stop and restart the agent.
6
+
7
+ > **Note:** This is a preview feature under active development. Preview features
8
+ > may only be available in the **Preview** channel or may need to be enabled
9
+ > under `/settings`.
10
+
11
+ Model steering is particularly useful during complex [Plan Mode](./plan-mode.md)
12
+ workflows or long-running subagent executions where you want to ensure the agent
13
+ stays on the right track.
14
+
15
+ ## Enabling model steering
16
+
17
+ Model steering is an experimental feature and is disabled by default. You can
18
+ enable it using the `/settings` command or by updating your `settings.json`
19
+ file.
20
+
21
+ 1. Type `/settings` in the Gemini CLI.
22
+ 2. Search for **Model Steering**.
23
+ 3. Set the value to **true**.
24
+
25
+ Alternatively, add the following to your `settings.json`:
26
+
27
+ ```json
28
+ {
29
+ "experimental": {
30
+ "modelSteering": true
31
+ }
32
+ }
33
+ ```
34
+
35
+ ## Using model steering
36
+
37
+ When model steering is enabled, Gemini CLI treats any text you type while the
38
+ agent is working as a steering hint.
39
+
40
+ 1. Start a task (for example, "Refactor the database service").
41
+ 2. While the agent is working (the spinner is visible), type your feedback in
42
+ the input box.
43
+ 3. Press **Enter**.
44
+
45
+ Gemini CLI acknowledges your hint with a brief message and injects it directly
46
+ into the model's context for the very next turn. The model then re-evaluates its
47
+ current plan and adjusts its actions accordingly.
48
+
49
+ ### Common use cases
50
+
51
+ You can use steering hints to guide the model in several ways:
52
+
53
+ - **Correcting a path:** "Actually, the utilities are in `src/common/utils`."
54
+ - **Skipping a step:** "Skip the unit tests for now and just focus on the
55
+ implementation."
56
+ - **Adding context:** "The `User` type is defined in `packages/core/types.ts`."
57
+ - **Redirecting the effort:** "Stop searching the codebase and start drafting
58
+ the plan now."
59
+ - **Handling ambiguity:** "Use the existing `Logger` class instead of creating a
60
+ new one."
61
+
62
+ ## How it works
63
+
64
+ When you submit a steering hint, Gemini CLI performs the following actions:
65
+
66
+ 1. **Immediate acknowledgment:** It uses a small, fast model to generate a
67
+ one-sentence acknowledgment so you know your hint was received.
68
+ 2. **Context injection:** It prepends an internal instruction to your hint that
69
+ tells the main agent to:
70
+ - Re-evaluate the active plan.
71
+ - Classify the update (for example, as a new task or extra context).
72
+ - Apply minimal-diff changes to affected tasks.
73
+ 3. **Real-time update:** The hint is delivered to the agent at the beginning of
74
+ its next turn, ensuring the most immediate course correction possible.
75
+
76
+ ## Next steps
77
+
78
+ - Tackle complex tasks with [Plan Mode](./plan-mode.md).
79
+ - Build custom [Agent Skills](./skills.md).
@@ -61,20 +61,44 @@ Gemini CLI takes action.
61
61
  [`ask_user`](../tools/ask-user.md). Provide your preferences to help guide
62
62
  the design.
63
63
  3. **Review the plan:** Once Gemini CLI has a proposed strategy, it creates a
64
- detailed implementation plan as a Markdown file in your plans directory. You
65
- can open and read this file to understand the proposed changes.
64
+ detailed implementation plan as a Markdown file in your plans directory.
65
+ - **View:** You can open and read this file to understand the proposed
66
+ changes.
67
+ - **Edit:** Press `Ctrl+X` to open the plan directly in your configured
68
+ external editor.
69
+
66
70
  4. **Approve or iterate:** Gemini CLI will present the finalized plan for your
67
71
  approval.
68
72
  - **Approve:** If you're satisfied with the plan, approve it to start the
69
73
  implementation immediately: **Yes, automatically accept edits** or **Yes,
70
74
  manually accept edits**.
71
- - **Iterate:** If the plan needs adjustments, provide feedback. Gemini CLI
72
- will refine the strategy and update the plan.
75
+ - **Iterate:** If the plan needs adjustments, provide feedback in the input
76
+ box or [edit the plan file directly](#collaborative-plan-editing). Gemini
77
+ CLI will refine the strategy and update the plan.
73
78
  - **Cancel:** You can cancel your plan with `Esc`.
74
79
 
75
80
  For more complex or specialized planning tasks, you can
76
81
  [customize the planning workflow with skills](#custom-planning-with-skills).
77
82
 
83
+ ### Collaborative plan editing
84
+
85
+ You can collaborate with Gemini CLI by making direct changes or leaving comments
86
+ in the implementation plan. This is often faster and more precise than
87
+ describing complex changes in natural language.
88
+
89
+ 1. **Open the plan:** Press `Ctrl+X` when Gemini CLI presents a plan for
90
+ review.
91
+ 2. **Edit or comment:** The plan opens in your configured external editor (for
92
+ example, VS Code or Vim). You can:
93
+ - **Modify steps:** Directly reorder, delete, or rewrite implementation
94
+ steps.
95
+ - **Leave comments:** Add inline questions or feedback (for example, "Wait,
96
+ shouldn't we use the existing `Logger` class here?").
97
+ 3. **Save and close:** Save your changes and close the editor.
98
+ 4. **Review and refine:** Gemini CLI automatically detects the changes, reviews
99
+ your comments, and adjusts the implementation strategy. It then presents the
100
+ refined plan for your final approval.
101
+
78
102
  ## How to exit Plan Mode
79
103
 
80
104
  You can exit Plan Mode at any time, whether you have finalized a plan or want to
@@ -85,16 +109,6 @@ switch back to another mode.
85
109
  - **Keyboard shortcut:** Press `Shift+Tab` to cycle to the desired mode.
86
110
  - **Natural language:** Ask Gemini CLI to "exit plan mode" or "stop planning."
87
111
 
88
- ## Customization and best practices
89
-
90
- Plan Mode is secure by default, but you can adapt it to fit your specific
91
- workflows. You can customize how Gemini CLI plans by using skills, adjusting
92
- safety policies, or changing where plans are stored.
93
-
94
- ## Commands
95
-
96
- - **`/plan copy`**: Copy the currently approved plan to your clipboard.
97
-
98
112
  ## Tool Restrictions
99
113
 
100
114
  Plan Mode enforces strict safety policies to prevent accidental changes.
@@ -122,6 +136,12 @@ These are the only allowed tools:
122
136
  - **Skills:** [`activate_skill`](../cli/skills.md) (allows loading specialized
123
137
  instructions and resources in a read-only manner)
124
138
 
139
+ ## Customization and best practices
140
+
141
+ Plan Mode is secure by default, but you can adapt it to fit your specific
142
+ workflows. You can customize how Gemini CLI plans by using skills, adjusting
143
+ safety policies, changing where plans are stored, or adding hooks.
144
+
125
145
  ### Custom planning with skills
126
146
 
127
147
  You can use [Agent Skills](../cli/skills.md) to customize how Gemini CLI
@@ -270,6 +290,71 @@ modes = ["plan"]
270
290
  argsPattern = "\"file_path\":\"[^\"]+[\\\\/]+\\.gemini[\\\\/]+plans[\\\\/]+[\\w-]+\\.md\""
271
291
  ```
272
292
 
293
+ ### Using hooks with Plan Mode
294
+
295
+ You can use the [hook system](../hooks/writing-hooks.md) to automate parts of
296
+ the planning workflow or enforce additional checks when Gemini CLI transitions
297
+ into or out of Plan Mode.
298
+
299
+ Hooks such as `BeforeTool` or `AfterTool` can be configured to intercept the
300
+ `enter_plan_mode` and `exit_plan_mode` tool calls.
301
+
302
+ > [!WARNING] When hooks are triggered by **tool executions**, they do **not**
303
+ > run when you manually toggle Plan Mode using the `/plan` command or the
304
+ > `Shift+Tab` keyboard shortcut. If you need hooks to execute on mode changes,
305
+ > ensure the transition is initiated by the agent (e.g., by asking "start a plan
306
+ > for...").
307
+
308
+ #### Example: Archive approved plans to GCS (`AfterTool`)
309
+
310
+ If your organizational policy requires a record of all execution plans, you can
311
+ use an `AfterTool` hook to securely copy the plan artifact to Google Cloud
312
+ Storage whenever Gemini CLI exits Plan Mode to start the implementation.
313
+
314
+ **`.gemini/hooks/archive-plan.sh`:**
315
+
316
+ ```bash
317
+ #!/usr/bin/env bash
318
+ # Extract the plan path from the tool input JSON
319
+ plan_path=$(jq -r '.tool_input.plan_path // empty')
320
+
321
+ if [ -f "$plan_path" ]; then
322
+ # Generate a unique filename using a timestamp
323
+ filename="$(date +%s)_$(basename "$plan_path")"
324
+
325
+ # Upload the plan to GCS in the background so it doesn't block the CLI
326
+ gsutil cp "$plan_path" "gs://my-audit-bucket/gemini-plans/$filename" > /dev/null 2>&1 &
327
+ fi
328
+
329
+ # AfterTool hooks should generally allow the flow to continue
330
+ echo '{"decision": "allow"}'
331
+ ```
332
+
333
+ To register this `AfterTool` hook, add it to your `settings.json`:
334
+
335
+ ```json
336
+ {
337
+ "hooks": {
338
+ "AfterTool": [
339
+ {
340
+ "matcher": "exit_plan_mode",
341
+ "hooks": [
342
+ {
343
+ "name": "archive-plan",
344
+ "type": "command",
345
+ "command": "./.gemini/hooks/archive-plan.sh"
346
+ }
347
+ ]
348
+ }
349
+ ]
350
+ }
351
+ }
352
+ ```
353
+
354
+ ## Commands
355
+
356
+ - **`/plan copy`**: Copy the currently approved plan to your clipboard.
357
+
273
358
  ## Planning workflows
274
359
 
275
360
  Plan Mode provides building blocks for structured research and design. These are
@@ -22,18 +22,19 @@ they appear in the UI.
22
22
 
23
23
  ### General
24
24
 
25
- | UI Label | Setting | Description | Default |
26
- | ----------------------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------- |
27
- | Vim Mode | `general.vimMode` | Enable Vim keybindings | `false` |
28
- | Default Approval Mode | `general.defaultApprovalMode` | The default approval mode for tool execution. 'default' prompts for approval, 'auto_edit' auto-approves edit tools, and 'plan' is read-only mode. 'yolo' is not supported yet. | `"default"` |
29
- | Enable Auto Update | `general.enableAutoUpdate` | Enable automatic updates. | `true` |
30
- | Enable Notifications | `general.enableNotifications` | Enable run-event notifications for action-required prompts and session completion. Currently macOS only. | `false` |
31
- | Plan Directory | `general.plan.directory` | The directory where planning artifacts are stored. If not specified, defaults to the system temporary directory. | `undefined` |
32
- | Plan Model Routing | `general.plan.modelRouting` | Automatically switch between Pro and Flash models based on Plan Mode status. Uses Pro for the planning phase and Flash for the implementation phase. | `true` |
33
- | Max Chat Model Attempts | `general.maxAttempts` | Maximum number of attempts for requests to the main chat model. Cannot exceed 10. | `10` |
34
- | Debug Keystroke Logging | `general.debugKeystrokeLogging` | Enable debug logging of keystrokes to the console. | `false` |
35
- | Enable Session Cleanup | `general.sessionRetention.enabled` | Enable automatic session cleanup | `true` |
36
- | Keep chat history | `general.sessionRetention.maxAge` | Automatically delete chats older than this time period (e.g., "30d", "7d", "24h", "1w") | `"30d"` |
25
+ | UI Label | Setting | Description | Default |
26
+ | ----------------------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
27
+ | Vim Mode | `general.vimMode` | Enable Vim keybindings | `false` |
28
+ | Default Approval Mode | `general.defaultApprovalMode` | The default approval mode for tool execution. 'default' prompts for approval, 'auto_edit' auto-approves edit tools, and 'plan' is read-only mode. YOLO mode (auto-approve all actions) can only be enabled via command line (--yolo or --approval-mode=yolo). | `"default"` |
29
+ | Enable Auto Update | `general.enableAutoUpdate` | Enable automatic updates. | `true` |
30
+ | Enable Notifications | `general.enableNotifications` | Enable run-event notifications for action-required prompts and session completion. Currently macOS only. | `false` |
31
+ | Plan Directory | `general.plan.directory` | The directory where planning artifacts are stored. If not specified, defaults to the system temporary directory. | `undefined` |
32
+ | Plan Model Routing | `general.plan.modelRouting` | Automatically switch between Pro and Flash models based on Plan Mode status. Uses Pro for the planning phase and Flash for the implementation phase. | `true` |
33
+ | Retry Fetch Errors | `general.retryFetchErrors` | Retry on "exception TypeError: fetch failed sending request" errors. | `true` |
34
+ | Max Chat Model Attempts | `general.maxAttempts` | Maximum number of attempts for requests to the main chat model. Cannot exceed 10. | `10` |
35
+ | Debug Keystroke Logging | `general.debugKeystrokeLogging` | Enable debug logging of keystrokes to the console. | `false` |
36
+ | Enable Session Cleanup | `general.sessionRetention.enabled` | Enable automatic session cleanup | `true` |
37
+ | Keep chat history | `general.sessionRetention.maxAge` | Automatically delete chats older than this time period (e.g., "30d", "7d", "24h", "1w") | `"30d"` |
37
38
 
38
39
  ### Output
39
40
 
@@ -54,6 +55,7 @@ they appear in the UI.
54
55
  | Show Home Directory Warning | `ui.showHomeDirectoryWarning` | Show a warning when running Gemini CLI in the home directory. | `true` |
55
56
  | Show Compatibility Warnings | `ui.showCompatibilityWarnings` | Show warnings about terminal or OS compatibility issues. | `true` |
56
57
  | Hide Tips | `ui.hideTips` | Hide helpful tips in the UI | `false` |
58
+ | Escape Pasted @ Symbols | `ui.escapePastedAtSymbols` | When enabled, @ symbols in pasted text are escaped to prevent unintended @path expansion. | `false` |
57
59
  | Show Shortcuts Hint | `ui.showShortcutsHint` | Show the "? for shortcuts" hint above the input. | `true` |
58
60
  | Hide Banner | `ui.hideBanner` | Hide the application banner | `false` |
59
61
  | Hide Context Summary | `ui.hideContextSummary` | Hide the context summary (GEMINI.md, MCP servers) above the input. | `false` |
@@ -45,6 +45,7 @@ Environment variables can override these settings.
45
45
  | `logPrompts` | `GEMINI_TELEMETRY_LOG_PROMPTS` | Include prompts in telemetry logs | `true`/`false` | `true` |
46
46
  | `useCollector` | `GEMINI_TELEMETRY_USE_COLLECTOR` | Use external OTLP collector (advanced) | `true`/`false` | `false` |
47
47
  | `useCliAuth` | `GEMINI_TELEMETRY_USE_CLI_AUTH` | Use CLI credentials for telemetry (GCP target only) | `true`/`false` | `false` |
48
+ | - | `GEMINI_CLI_SURFACE` | Optional custom label for traffic reporting | string | - |
48
49
 
49
50
  **Note on boolean environment variables:** For boolean settings like `enabled`,
50
51
  setting the environment variable to `true` or `1` enables the feature.
@@ -216,6 +217,50 @@ recommend using file-based output for local development.
216
217
  For advanced local telemetry setups (such as Jaeger or Genkit), see the
217
218
  [Local development guide](../local-development.md#viewing-traces).
218
219
 
220
+ ## Client identification
221
+
222
+ Gemini CLI includes identifiers in its `User-Agent` header to help you
223
+ differentiate and report on API traffic from different environments (for
224
+ example, identifying calls from Gemini Code Assist versus a standard terminal).
225
+
226
+ ### Automatic identification
227
+
228
+ Most integrated environments are identified automatically without additional
229
+ configuration. The identifier is included as a prefix to the `User-Agent` and as
230
+ a "surface" tag in the parenthetical metadata.
231
+
232
+ | Environment | User-Agent Prefix | Surface Tag |
233
+ | :---------------------------------- | :--------------------------- | :---------- |
234
+ | **Gemini Code Assist (Agent Mode)** | `GeminiCLI-a2a-server` | `vscode` |
235
+ | **Zed (via ACP)** | `GeminiCLI-acp-zed` | `zed` |
236
+ | **XCode (via ACP)** | `GeminiCLI-acp-xcode` | `xcode` |
237
+ | **IntelliJ IDEA (via ACP)** | `GeminiCLI-acp-intellijidea` | `jetbrains` |
238
+ | **Standard Terminal** | `GeminiCLI` | `terminal` |
239
+
240
+ **Example User-Agent:**
241
+ `GeminiCLI-a2a-server/0.34.0/gemini-pro (linux; x64; vscode)`
242
+
243
+ ### Custom identification
244
+
245
+ You can provide a custom identifier for your own scripts or automation by
246
+ setting the `GEMINI_CLI_SURFACE` environment variable. This is useful for
247
+ tracking specific internal tools or distribution channels in your GCP logs.
248
+
249
+ **macOS/Linux**
250
+
251
+ ```bash
252
+ export GEMINI_CLI_SURFACE="my-custom-tool"
253
+ ```
254
+
255
+ **Windows (PowerShell)**
256
+
257
+ ```powershell
258
+ $env:GEMINI_CLI_SURFACE="my-custom-tool"
259
+ ```
260
+
261
+ When set, the value appears at the end of the `User-Agent` parenthetical:
262
+ `GeminiCLI/0.34.0/gemini-pro (linux; x64; my-custom-tool)`
263
+
219
264
  ## Logs, metrics, and traces
220
265
 
221
266
  This section describes the structure of logs, metrics, and traces generated by
@@ -0,0 +1,89 @@
1
+ # Use Plan Mode with model steering for complex tasks
2
+
3
+ Architecting a complex solution requires precision. By combining Plan Mode's
4
+ structured environment with model steering's real-time feedback, you can guide
5
+ Gemini CLI through the research and design phases to ensure the final
6
+ implementation plan is exactly what you need.
7
+
8
+ > **Note:** This is a preview feature under active development. Preview features
9
+ > may only be available in the **Preview** channel or may need to be enabled
10
+ > under `/settings`.
11
+
12
+ ## Prerequisites
13
+
14
+ - Gemini CLI installed and authenticated.
15
+ - [Plan Mode](../plan-mode.md) enabled in your settings.
16
+ - [Model steering](../model-steering.md) enabled in your settings.
17
+
18
+ ## Why combine Plan Mode and model steering?
19
+
20
+ [Plan Mode](../plan-mode.md) typically follows a linear path: research, propose,
21
+ and draft. Adding model steering lets you:
22
+
23
+ 1. **Direct the research:** Correct the agent if it's looking in the wrong
24
+ directory or missing a key dependency.
25
+ 2. **Iterate mid-draft:** Suggest a different architectural pattern while the
26
+ agent is still writing the plan.
27
+ 3. **Speed up the loop:** Avoid waiting for a full research turn to finish
28
+ before providing critical context.
29
+
30
+ ## Step 1: Start a complex task
31
+
32
+ Enter Plan Mode and start a task that requires research.
33
+
34
+ **Prompt:** `/plan I want to implement a new notification service using Redis.`
35
+
36
+ Gemini CLI enters Plan Mode and starts researching your existing codebase to
37
+ identify where the new service should live.
38
+
39
+ ## Step 2: Steer the research phase
40
+
41
+ As you see the agent calling tools like `list_directory` or `grep_search`, you
42
+ might realize it's missing the relevant context.
43
+
44
+ **Action:** While the spinner is active, type your hint:
45
+ `"Don't forget to check packages/common/queues for the existing Redis config."`
46
+
47
+ **Result:** Gemini CLI acknowledges your hint and immediately incorporates it
48
+ into its research. You'll see it start exploring the directory you suggested in
49
+ its very next turn.
50
+
51
+ ## Step 3: Refine the design mid-turn
52
+
53
+ After research, the agent starts drafting the implementation plan. If you notice
54
+ it's proposing a design that doesn't align with your goals, steer it.
55
+
56
+ **Action:** Type:
57
+ `"Actually, let's use a Publisher/Subscriber pattern instead of a simple queue for this service."`
58
+
59
+ **Result:** The agent stops drafting the current version of the plan,
60
+ re-evaluates the design based on your feedback, and starts a new draft that uses
61
+ the Pub/Sub pattern.
62
+
63
+ ## Step 4: Approve and implement
64
+
65
+ Once the agent has used your hints to craft the perfect plan, review the final
66
+ `.md` file.
67
+
68
+ **Action:** Type: `"Looks perfect. Let's start the implementation."`
69
+
70
+ Gemini CLI exits Plan Mode and transitions to the implementation phase. Because
71
+ the plan was refined in real-time with your feedback, the agent can now execute
72
+ each step with higher confidence and fewer errors.
73
+
74
+ ## Tips for effective steering
75
+
76
+ - **Be specific:** Instead of "do it differently," try "use the existing
77
+ `Logger` class in `src/utils`."
78
+ - **Steer early:** Providing feedback during the research phase is more
79
+ efficient than waiting for the final plan to be drafted.
80
+ - **Use for context:** Steering is a great way to provide knowledge that might
81
+ not be obvious from reading the code (e.g., "We are planning to deprecate this
82
+ module next month").
83
+
84
+ ## Next steps
85
+
86
+ - Explore [Agent Skills](../skills.md) to add specialized expertise to your
87
+ planning turns.
88
+ - See the [Model steering reference](../model-steering.md) for technical
89
+ details.
@@ -15,6 +15,8 @@ requests sent from `packages/cli`. For a general overview of Gemini CLI, see the
15
15
  modular GEMINI.md import feature using @file.md syntax.
16
16
  - **[Policy Engine](../reference/policy-engine.md):** Use the Policy Engine for
17
17
  fine-grained control over tool execution.
18
+ - **[Local Model Routing (experimental)](./local-model-routing.md):** Learn how
19
+ to enable use of a local Gemma model for model routing decisions.
18
20
 
19
21
  ## Role of the core
20
22
 
@@ -0,0 +1,193 @@
1
+ # Local Model Routing (experimental)
2
+
3
+ Gemini CLI supports using a local model for
4
+ [routing decisions](../cli/model-routing.md). When configured, Gemini CLI will
5
+ use a locally-running **Gemma** model to make routing decisions (instead of
6
+ sending routing decisions to a hosted model).
7
+
8
+ This feature can help reduce costs associated with hosted model usage while
9
+ offering similar routing decision latency and quality.
10
+
11
+ > **Note: Local model routing is currently an experimental feature.**
12
+
13
+ ## Setup
14
+
15
+ Using a Gemma model for routing decisions requires that an implementation of a
16
+ Gemma model be running locally on your machine, served behind an HTTP endpoint
17
+ and accessed via the Gemini API.
18
+
19
+ To serve the Gemma model, follow these steps:
20
+
21
+ ### Download the LiteRT-LM runtime
22
+
23
+ The [LiteRT-LM](https://github.com/google-ai-edge/LiteRT-LM) runtime offers
24
+ pre-built binaries for locally-serving models. Download the binary appropriate
25
+ for your system.
26
+
27
+ #### Windows
28
+
29
+ 1. Download
30
+ [lit.windows_x86_64.exe](https://github.com/google-ai-edge/LiteRT-LM/releases/download/v0.9.0-alpha03/lit.windows_x86_64.exe).
31
+ 2. Using GPU on Windows requires the DirectXShaderCompiler. Download the
32
+ [dxc zip from the latest release](https://github.com/microsoft/DirectXShaderCompiler/releases/download/v1.8.2505.1/dxc_2025_07_14.zip).
33
+ Unzip the archive and from the architecture-appropriate `bin\` directory, and
34
+ copy the `dxil.dll` and `dxcompiler.dll` into the same location as you saved
35
+ `lit.windows_x86_64.exe`.
36
+ 3. (Optional) Test starting the runtime:
37
+ `.\lit.windows_x86_64.exe serve --verbose`
38
+
39
+ #### Linux
40
+
41
+ 1. Download
42
+ [lit.linux_x86_64](https://github.com/google-ai-edge/LiteRT-LM/releases/download/v0.9.0-alpha03/lit.linux_x86_64).
43
+ 2. Ensure the binary is executable: `chmod a+x lit.linux_x86_64`
44
+ 3. (Optional) Test starting the runtime: `./lit.linux_x86_64 serve --verbose`
45
+
46
+ #### MacOS
47
+
48
+ 1. Download
49
+ [lit-macos-arm64](https://github.com/google-ai-edge/LiteRT-LM/releases/download/v0.9.0-alpha03/lit.macos_arm64).
50
+ 2. Ensure the binary is executable: `chmod a+x lit.macos_arm64`
51
+ 3. (Optional) Test starting the runtime: `./lit.macos_arm64 serve --verbose`
52
+
53
+ > **Note**: MacOS can be configured to only allows binaries from "App Store &
54
+ > Known Developers". If you encounter an error message when attempting to run
55
+ > the binary, you will need to allow the application. One option is to visit
56
+ > `System Settings -> Privacy & Security`, scroll to `Security`, and click
57
+ > `"Allow Anyway"` for `"lit.macos_arm64"`. Another option is to run
58
+ > `xattr -d com.apple.quarantine lit.macos_arm64` from the commandline.
59
+
60
+ ### Download the Gemma Model
61
+
62
+ Before using Gemma, you will need to download the model (and agree to the Terms
63
+ of Service).
64
+
65
+ This can be done via the LiteRT-LM runtime.
66
+
67
+ #### Windows
68
+
69
+ ```bash
70
+ $ .\lit.windows_x86_64.exe pull gemma3-1b-gpu-custom
71
+
72
+ [Legal] The model you are about to download is governed by
73
+ the Gemma Terms of Use and Prohibited Use Policy. Please review these terms and ensure you agree before continuing.
74
+
75
+ Full Terms: https://ai.google.dev/gemma/terms
76
+ Prohibited Use Policy: https://ai.google.dev/gemma/prohibited_use_policy
77
+
78
+ Do you accept these terms? (Y/N): Y
79
+
80
+ Terms accepted.
81
+ Downloading model 'gemma3-1b-gpu-custom' ...
82
+ Downloading... 968.6 MB
83
+ Download complete.
84
+ ```
85
+
86
+ #### Linux
87
+
88
+ ```bash
89
+ $ ./lit.linux_x86_64 pull gemma3-1b-gpu-custom
90
+
91
+ [Legal] The model you are about to download is governed by
92
+ the Gemma Terms of Use and Prohibited Use Policy. Please review these terms and ensure you agree before continuing.
93
+
94
+ Full Terms: https://ai.google.dev/gemma/terms
95
+ Prohibited Use Policy: https://ai.google.dev/gemma/prohibited_use_policy
96
+
97
+ Do you accept these terms? (Y/N): Y
98
+
99
+ Terms accepted.
100
+ Downloading model 'gemma3-1b-gpu-custom' ...
101
+ Downloading... 968.6 MB
102
+ Download complete.
103
+ ```
104
+
105
+ #### MacOS
106
+
107
+ ```bash
108
+ $ ./lit.lit.macos_arm64 pull gemma3-1b-gpu-custom
109
+
110
+ [Legal] The model you are about to download is governed by
111
+ the Gemma Terms of Use and Prohibited Use Policy. Please review these terms and ensure you agree before continuing.
112
+
113
+ Full Terms: https://ai.google.dev/gemma/terms
114
+ Prohibited Use Policy: https://ai.google.dev/gemma/prohibited_use_policy
115
+
116
+ Do you accept these terms? (Y/N): Y
117
+
118
+ Terms accepted.
119
+ Downloading model 'gemma3-1b-gpu-custom' ...
120
+ Downloading... 968.6 MB
121
+ Download complete.
122
+ ```
123
+
124
+ ### Start LiteRT-LM Runtime
125
+
126
+ Using the command appropriate to your system, start the LiteRT-LM runtime.
127
+ Configure the port that you want to use for your Gemma model. For the purposes
128
+ of this document, we will use port `9379`.
129
+
130
+ Example command for MacOS: `./lit.macos_arm64 serve --port=9379 --verbose`
131
+
132
+ ### (Optional) Verify Model Serving
133
+
134
+ Send a quick prompt to the model via HTTP to validate successful model serving.
135
+ This will cause the runtime to download the model and run it once.
136
+
137
+ You should see a short joke in the server output as an indicator of success.
138
+
139
+ #### Windows
140
+
141
+ ```
142
+ # Run this in PowerShell to send a request to the server
143
+
144
+ $uri = "http://localhost:9379/v1beta/models/gemma3-1b-gpu-custom:generateContent"
145
+ $body = @{contents = @( @{
146
+ role = "user"
147
+ parts = @( @{ text = "Tell me a joke." } )
148
+ })} | ConvertTo-Json -Depth 10
149
+
150
+ Invoke-RestMethod -Uri $uri -Method Post -Body $body -ContentType "application/json"
151
+ ```
152
+
153
+ #### Linux/MacOS
154
+
155
+ ```bash
156
+ $ curl "http://localhost:9379/v1beta/models/gemma3-1b-gpu-custom:generateContent" \
157
+ -H 'Content-Type: application/json' \
158
+ -X POST \
159
+ -d '{"contents":[{"role":"user","parts":[{"text":"Tell me a joke."}]}]}'
160
+ ```
161
+
162
+ ## Configuration
163
+
164
+ To use a local Gemma model for routing, you must explicitly enable it in your
165
+ `settings.json`:
166
+
167
+ ```json
168
+ {
169
+ "experimental": {
170
+ "gemmaModelRouter": {
171
+ "enabled": true,
172
+ "classifier": {
173
+ "host": "http://localhost:9379",
174
+ "model": "gemma3-1b-gpu-custom"
175
+ }
176
+ }
177
+ }
178
+ }
179
+ ```
180
+
181
+ > Use the port you started your LiteRT-LM runtime on in the setup steps.
182
+
183
+ ### Configuration schema
184
+
185
+ | Field | Type | Required | Description |
186
+ | :----------------- | :------ | :------- | :----------------------------------------------------------------------------------------- |
187
+ | `enabled` | boolean | Yes | Must be `true` to enable the feature. |
188
+ | `classifier` | object | Yes | The configuration for the local model endpoint. It includes the host and model specifiers. |
189
+ | `classifier.host` | string | Yes | The URL to the local model server. Should be `http://localhost:<port>`. |
190
+ | `classifier.model` | string | Yes | The model name to use for decisions. Must be `"gemma3-1b-gpu-custom"`. |
191
+
192
+ > **Note: You will need to restart after configuration changes for local model
193
+ > routing to take effect.**