@google/gemini-cli-core 0.21.0-nightly.20251218.739c02bd6 → 0.21.0-nightly.20251220.41a1a3eed

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 (212) hide show
  1. package/dist/docs/CONTRIBUTING.md +546 -0
  2. package/dist/docs/architecture.md +80 -0
  3. package/dist/docs/assets/connected_devtools.png +0 -0
  4. package/dist/docs/assets/gemini-screenshot.png +0 -0
  5. package/dist/docs/assets/release_patch.png +0 -0
  6. package/dist/docs/assets/theme-ansi-light.png +0 -0
  7. package/dist/docs/assets/theme-ansi.png +0 -0
  8. package/dist/docs/assets/theme-atom-one.png +0 -0
  9. package/dist/docs/assets/theme-ayu-light.png +0 -0
  10. package/dist/docs/assets/theme-ayu.png +0 -0
  11. package/dist/docs/assets/theme-custom.png +0 -0
  12. package/dist/docs/assets/theme-default-light.png +0 -0
  13. package/dist/docs/assets/theme-default.png +0 -0
  14. package/dist/docs/assets/theme-dracula.png +0 -0
  15. package/dist/docs/assets/theme-github-light.png +0 -0
  16. package/dist/docs/assets/theme-github.png +0 -0
  17. package/dist/docs/assets/theme-google-light.png +0 -0
  18. package/dist/docs/assets/theme-xcode-light.png +0 -0
  19. package/dist/docs/changelogs/index.md +592 -0
  20. package/dist/docs/changelogs/latest.md +225 -0
  21. package/dist/docs/changelogs/preview.md +129 -0
  22. package/dist/docs/changelogs/releases.md +896 -0
  23. package/dist/docs/cli/authentication.md +3 -0
  24. package/dist/docs/cli/checkpointing.md +94 -0
  25. package/dist/docs/cli/commands.md +354 -0
  26. package/dist/docs/cli/configuration.md +780 -0
  27. package/dist/docs/cli/custom-commands.md +315 -0
  28. package/dist/docs/cli/enterprise.md +565 -0
  29. package/dist/docs/cli/gemini-ignore.md +71 -0
  30. package/dist/docs/cli/gemini-md.md +108 -0
  31. package/dist/docs/cli/generation-settings.md +210 -0
  32. package/dist/docs/cli/headless.md +388 -0
  33. package/dist/docs/cli/index.md +63 -0
  34. package/dist/docs/cli/keyboard-shortcuts.md +143 -0
  35. package/dist/docs/cli/model-routing.md +37 -0
  36. package/dist/docs/cli/model.md +62 -0
  37. package/dist/docs/cli/sandbox.md +171 -0
  38. package/dist/docs/cli/session-management.md +158 -0
  39. package/dist/docs/cli/settings.md +112 -0
  40. package/dist/docs/cli/system-prompt.md +93 -0
  41. package/dist/docs/cli/telemetry.md +791 -0
  42. package/dist/docs/cli/themes.md +237 -0
  43. package/dist/docs/cli/token-caching.md +20 -0
  44. package/dist/docs/cli/trusted-folders.md +95 -0
  45. package/dist/docs/cli/tutorials.md +83 -0
  46. package/dist/docs/cli/uninstall.md +47 -0
  47. package/dist/docs/core/index.md +101 -0
  48. package/dist/docs/core/memport.md +244 -0
  49. package/dist/docs/core/policy-engine.md +267 -0
  50. package/dist/docs/core/tools-api.md +131 -0
  51. package/dist/docs/examples/proxy-script.md +83 -0
  52. package/dist/docs/extensions/extension-releasing.md +183 -0
  53. package/dist/docs/extensions/getting-started-extensions.md +245 -0
  54. package/dist/docs/extensions/index.md +293 -0
  55. package/dist/docs/faq.md +154 -0
  56. package/dist/docs/get-started/authentication.md +321 -0
  57. package/dist/docs/get-started/configuration-v1.md +888 -0
  58. package/dist/docs/get-started/configuration.md +1444 -0
  59. package/dist/docs/get-started/deployment.md +143 -0
  60. package/dist/docs/get-started/examples.md +219 -0
  61. package/dist/docs/get-started/gemini-3.md +116 -0
  62. package/dist/docs/get-started/index.md +71 -0
  63. package/dist/docs/get-started/installation.md +141 -0
  64. package/dist/docs/hooks/best-practices.md +806 -0
  65. package/dist/docs/hooks/index.md +665 -0
  66. package/dist/docs/hooks/reference.md +168 -0
  67. package/dist/docs/hooks/writing-hooks.md +1026 -0
  68. package/dist/docs/ide-integration/ide-companion-spec.md +267 -0
  69. package/dist/docs/ide-integration/index.md +202 -0
  70. package/dist/docs/index.md +147 -0
  71. package/dist/docs/integration-tests.md +211 -0
  72. package/dist/docs/issue-and-pr-automation.md +134 -0
  73. package/dist/docs/local-development.md +128 -0
  74. package/dist/docs/mermaid/context.mmd +103 -0
  75. package/dist/docs/mermaid/render-path.mmd +64 -0
  76. package/dist/docs/npm.md +62 -0
  77. package/dist/docs/quota-and-pricing.md +158 -0
  78. package/dist/docs/release-confidence.md +164 -0
  79. package/dist/docs/releases.md +540 -0
  80. package/dist/docs/sidebar.json +297 -0
  81. package/dist/docs/tools/file-system.md +217 -0
  82. package/dist/docs/tools/index.md +95 -0
  83. package/dist/docs/tools/mcp-server.md +1044 -0
  84. package/dist/docs/tools/memory.md +54 -0
  85. package/dist/docs/tools/shell.md +260 -0
  86. package/dist/docs/tools/todos.md +57 -0
  87. package/dist/docs/tools/web-fetch.md +59 -0
  88. package/dist/docs/tools/web-search.md +42 -0
  89. package/dist/docs/tos-privacy.md +96 -0
  90. package/dist/docs/troubleshooting.md +158 -0
  91. package/dist/google-gemini-cli-core-0.21.0-nightly.20251219.70696e364.tgz +0 -0
  92. package/dist/src/agents/delegate-to-agent-tool.test.js +1 -0
  93. package/dist/src/agents/delegate-to-agent-tool.test.js.map +1 -1
  94. package/dist/src/agents/introspection-agent.d.ts +23 -0
  95. package/dist/src/agents/introspection-agent.js +72 -0
  96. package/dist/src/agents/introspection-agent.js.map +1 -0
  97. package/dist/src/agents/introspection-agent.test.d.ts +6 -0
  98. package/dist/src/agents/introspection-agent.test.js +47 -0
  99. package/dist/src/agents/introspection-agent.test.js.map +1 -0
  100. package/dist/src/agents/local-executor.d.ts +0 -6
  101. package/dist/src/agents/local-executor.js +73 -47
  102. package/dist/src/agents/local-executor.js.map +1 -1
  103. package/dist/src/agents/local-executor.test.d.ts +1 -7
  104. package/dist/src/agents/local-executor.test.js +27 -9
  105. package/dist/src/agents/local-executor.test.js.map +1 -1
  106. package/dist/src/agents/registry.d.ts +1 -0
  107. package/dist/src/agents/registry.js +51 -7
  108. package/dist/src/agents/registry.js.map +1 -1
  109. package/dist/src/agents/registry.test.js +112 -1
  110. package/dist/src/agents/registry.test.js.map +1 -1
  111. package/dist/src/agents/toml-loader.d.ts +65 -0
  112. package/dist/src/agents/toml-loader.js +176 -0
  113. package/dist/src/agents/toml-loader.js.map +1 -0
  114. package/dist/src/agents/toml-loader.test.d.ts +6 -0
  115. package/dist/src/agents/toml-loader.test.js +190 -0
  116. package/dist/src/agents/toml-loader.test.js.map +1 -0
  117. package/dist/src/availability/modelAvailabilityService.d.ts +2 -1
  118. package/dist/src/config/config.d.ts +9 -0
  119. package/dist/src/config/config.js +29 -0
  120. package/dist/src/config/config.js.map +1 -1
  121. package/dist/src/config/config.test.js +59 -1
  122. package/dist/src/config/config.test.js.map +1 -1
  123. package/dist/src/config/storage.d.ts +2 -0
  124. package/dist/src/config/storage.js +6 -0
  125. package/dist/src/config/storage.js.map +1 -1
  126. package/dist/src/config/storage.test.js +8 -0
  127. package/dist/src/config/storage.test.js.map +1 -1
  128. package/dist/src/core/client.js +8 -4
  129. package/dist/src/core/client.js.map +1 -1
  130. package/dist/src/core/client.test.js +20 -0
  131. package/dist/src/core/client.test.js.map +1 -1
  132. package/dist/src/core/clientHookTriggers.js +2 -2
  133. package/dist/src/core/clientHookTriggers.js.map +1 -1
  134. package/dist/src/core/coreToolHookTriggers.js +3 -3
  135. package/dist/src/core/coreToolHookTriggers.js.map +1 -1
  136. package/dist/src/core/geminiChatHookTriggers.js +3 -3
  137. package/dist/src/core/geminiChatHookTriggers.js.map +1 -1
  138. package/dist/src/core/sessionHookTriggers.js +3 -3
  139. package/dist/src/core/sessionHookTriggers.js.map +1 -1
  140. package/dist/src/generated/git-commit.d.ts +2 -2
  141. package/dist/src/generated/git-commit.js +2 -2
  142. package/dist/src/hooks/hookEventHandler.js +10 -4
  143. package/dist/src/hooks/hookEventHandler.js.map +1 -1
  144. package/dist/src/hooks/hookEventHandler.test.js +40 -0
  145. package/dist/src/hooks/hookEventHandler.test.js.map +1 -1
  146. package/dist/src/hooks/hookPlanner.js +3 -1
  147. package/dist/src/hooks/hookPlanner.js.map +1 -1
  148. package/dist/src/hooks/hookPlanner.test.js +61 -0
  149. package/dist/src/hooks/hookPlanner.test.js.map +1 -1
  150. package/dist/src/hooks/hookRegistry.d.ts +1 -1
  151. package/dist/src/hooks/hookRegistry.js +2 -2
  152. package/dist/src/hooks/hookRegistry.js.map +1 -1
  153. package/dist/src/hooks/hookRegistry.test.js +73 -0
  154. package/dist/src/hooks/hookRegistry.test.js.map +1 -1
  155. package/dist/src/hooks/hookRunner.js +14 -10
  156. package/dist/src/hooks/hookRunner.js.map +1 -1
  157. package/dist/src/hooks/hookRunner.test.js +81 -33
  158. package/dist/src/hooks/hookRunner.test.js.map +1 -1
  159. package/dist/src/hooks/types.d.ts +2 -0
  160. package/dist/src/hooks/types.js.map +1 -1
  161. package/dist/src/mcp/oauth-provider.js +6 -2
  162. package/dist/src/mcp/oauth-provider.js.map +1 -1
  163. package/dist/src/mcp/oauth-provider.test.js +4 -1
  164. package/dist/src/mcp/oauth-provider.test.js.map +1 -1
  165. package/dist/src/mcp/oauth-utils.d.ts +8 -1
  166. package/dist/src/mcp/oauth-utils.js +30 -1
  167. package/dist/src/mcp/oauth-utils.js.map +1 -1
  168. package/dist/src/mcp/oauth-utils.test.js +42 -0
  169. package/dist/src/mcp/oauth-utils.test.js.map +1 -1
  170. package/dist/src/services/contextManager.d.ts +5 -11
  171. package/dist/src/services/contextManager.js +20 -17
  172. package/dist/src/services/contextManager.js.map +1 -1
  173. package/dist/src/services/contextManager.test.js +40 -41
  174. package/dist/src/services/contextManager.test.js.map +1 -1
  175. package/dist/src/services/shellExecutionService.js +18 -2
  176. package/dist/src/services/shellExecutionService.js.map +1 -1
  177. package/dist/src/tools/get-internal-docs.d.ts +27 -0
  178. package/dist/src/tools/get-internal-docs.js +129 -0
  179. package/dist/src/tools/get-internal-docs.js.map +1 -0
  180. package/dist/src/tools/get-internal-docs.test.d.ts +6 -0
  181. package/dist/src/tools/get-internal-docs.test.js +56 -0
  182. package/dist/src/tools/get-internal-docs.test.js.map +1 -0
  183. package/dist/src/tools/tool-names.d.ts +14 -0
  184. package/dist/src/tools/tool-names.js +55 -0
  185. package/dist/src/tools/tool-names.js.map +1 -1
  186. package/dist/src/tools/tool-names.test.d.ts +6 -0
  187. package/dist/src/tools/tool-names.test.js +43 -0
  188. package/dist/src/tools/tool-names.test.js.map +1 -0
  189. package/dist/src/tools/tool-registry.d.ts +0 -1
  190. package/dist/src/tools/tool-registry.js +1 -1
  191. package/dist/src/tools/tool-registry.js.map +1 -1
  192. package/dist/src/tools/tool-registry.test.js +2 -1
  193. package/dist/src/tools/tool-registry.test.js.map +1 -1
  194. package/dist/src/utils/environmentContext.js +3 -0
  195. package/dist/src/utils/environmentContext.js.map +1 -1
  196. package/dist/src/utils/environmentContext.test.js +2 -0
  197. package/dist/src/utils/environmentContext.test.js.map +1 -1
  198. package/dist/src/utils/events.d.ts +3 -2
  199. package/dist/src/utils/events.js.map +1 -1
  200. package/dist/src/utils/googleQuotaErrors.js +20 -0
  201. package/dist/src/utils/googleQuotaErrors.js.map +1 -1
  202. package/dist/src/utils/googleQuotaErrors.test.js +53 -2
  203. package/dist/src/utils/googleQuotaErrors.test.js.map +1 -1
  204. package/dist/src/utils/memoryDiscovery.js +1 -1
  205. package/dist/src/utils/memoryDiscovery.js.map +1 -1
  206. package/dist/src/utils/memoryDiscovery.test.js +3 -1
  207. package/dist/src/utils/memoryDiscovery.test.js.map +1 -1
  208. package/dist/src/utils/shell-utils.js +25 -4
  209. package/dist/src/utils/shell-utils.js.map +1 -1
  210. package/dist/tsconfig.tsbuildinfo +1 -1
  211. package/package.json +1 -6
  212. package/dist/google-gemini-cli-core-0.21.0-nightly.20251216.bb0c0d8ee.tgz +0 -0
@@ -0,0 +1,158 @@
1
+ # Troubleshooting guide
2
+
3
+ This guide provides solutions to common issues and debugging tips, including
4
+ topics on:
5
+
6
+ - Authentication or login errors
7
+ - Frequently asked questions (FAQs)
8
+ - Debugging tips
9
+ - Existing GitHub Issues similar to yours or creating new Issues
10
+
11
+ ## Authentication or login errors
12
+
13
+ - **Error:
14
+ `You must be a named user on your organization's Gemini Code Assist Standard edition subscription to use this service. Please contact your administrator to request an entitlement to Gemini Code Assist Standard edition.`**
15
+ - **Cause:** This error might occur if Gemini CLI detects the
16
+ `GOOGLE_CLOUD_PROJECT` or `GOOGLE_CLOUD_PROJECT_ID` environment variable is
17
+ defined. Setting these variables forces an organization subscription check.
18
+ This might be an issue if you are using an individual Google account not
19
+ linked to an organizational subscription.
20
+
21
+ - **Solution:**
22
+ - **Individual Users:** Unset the `GOOGLE_CLOUD_PROJECT` and
23
+ `GOOGLE_CLOUD_PROJECT_ID` environment variables. Check and remove these
24
+ variables from your shell configuration files (for example, `.bashrc`,
25
+ `.zshrc`) and any `.env` files. If this doesn't resolve the issue, try
26
+ using a different Google account.
27
+
28
+ - **Organizational Users:** Contact your Google Cloud administrator to be
29
+ added to your organization's Gemini Code Assist subscription.
30
+
31
+ - **Error: `Failed to login. Message: Request contains an invalid argument`**
32
+ - **Cause:** Users with Google Workspace accounts or Google Cloud accounts
33
+ associated with their Gmail accounts may not be able to activate the free
34
+ tier of the Google Code Assist plan.
35
+ - **Solution:** For Google Cloud accounts, you can work around this by setting
36
+ `GOOGLE_CLOUD_PROJECT` to your project ID. Alternatively, you can obtain the
37
+ Gemini API key from
38
+ [Google AI Studio](http://aistudio.google.com/app/apikey), which also
39
+ includes a separate free tier.
40
+
41
+ - **Error: `UNABLE_TO_GET_ISSUER_CERT_LOCALLY` or
42
+ `unable to get local issuer certificate`**
43
+ - **Cause:** You may be on a corporate network with a firewall that intercepts
44
+ and inspects SSL/TLS traffic. This often requires a custom root CA
45
+ certificate to be trusted by Node.js.
46
+ - **Solution:** Set the `NODE_EXTRA_CA_CERTS` environment variable to the
47
+ absolute path of your corporate root CA certificate file.
48
+ - Example: `export NODE_EXTRA_CA_CERTS=/path/to/your/corporate-ca.crt`
49
+
50
+ ## Common error messages and solutions
51
+
52
+ - **Error: `EADDRINUSE` (Address already in use) when starting an MCP server.**
53
+ - **Cause:** Another process is already using the port that the MCP server is
54
+ trying to bind to.
55
+ - **Solution:** Either stop the other process that is using the port or
56
+ configure the MCP server to use a different port.
57
+
58
+ - **Error: Command not found (when attempting to run Gemini CLI with
59
+ `gemini`).**
60
+ - **Cause:** Gemini CLI is not correctly installed or it is not in your
61
+ system's `PATH`.
62
+ - **Solution:** The update depends on how you installed Gemini CLI:
63
+ - If you installed `gemini` globally, check that your `npm` global binary
64
+ directory is in your `PATH`. You can update Gemini CLI using the command
65
+ `npm install -g @google/gemini-cli@latest`.
66
+ - If you are running `gemini` from source, ensure you are using the correct
67
+ command to invoke it (e.g., `node packages/cli/dist/index.js ...`). To
68
+ update Gemini CLI, pull the latest changes from the repository, and then
69
+ rebuild using the command `npm run build`.
70
+
71
+ - **Error: `MODULE_NOT_FOUND` or import errors.**
72
+ - **Cause:** Dependencies are not installed correctly, or the project hasn't
73
+ been built.
74
+ - **Solution:**
75
+ 1. Run `npm install` to ensure all dependencies are present.
76
+ 2. Run `npm run build` to compile the project.
77
+ 3. Verify that the build completed successfully with `npm run start`.
78
+
79
+ - **Error: "Operation not permitted", "Permission denied", or similar.**
80
+ - **Cause:** When sandboxing is enabled, Gemini CLI may attempt operations
81
+ that are restricted by your sandbox configuration, such as writing outside
82
+ the project directory or system temp directory.
83
+ - **Solution:** Refer to the [Configuration: Sandboxing](./cli/sandbox.md)
84
+ documentation for more information, including how to customize your sandbox
85
+ configuration.
86
+
87
+ - **Gemini CLI is not running in interactive mode in "CI" environments**
88
+ - **Issue:** The Gemini CLI does not enter interactive mode (no prompt
89
+ appears) if an environment variable starting with `CI_` (e.g., `CI_TOKEN`)
90
+ is set. This is because the `is-in-ci` package, used by the underlying UI
91
+ framework, detects these variables and assumes a non-interactive CI
92
+ environment.
93
+ - **Cause:** The `is-in-ci` package checks for the presence of `CI`,
94
+ `CONTINUOUS_INTEGRATION`, or any environment variable with a `CI_` prefix.
95
+ When any of these are found, it signals that the environment is
96
+ non-interactive, which prevents the Gemini CLI from starting in its
97
+ interactive mode.
98
+ - **Solution:** If the `CI_` prefixed variable is not needed for the CLI to
99
+ function, you can temporarily unset it for the command. e.g.,
100
+ `env -u CI_TOKEN gemini`
101
+
102
+ - **DEBUG mode not working from project .env file**
103
+ - **Issue:** Setting `DEBUG=true` in a project's `.env` file doesn't enable
104
+ debug mode for gemini-cli.
105
+ - **Cause:** The `DEBUG` and `DEBUG_MODE` variables are automatically excluded
106
+ from project `.env` files to prevent interference with gemini-cli behavior.
107
+ - **Solution:** Use a `.gemini/.env` file instead, or configure the
108
+ `advanced.excludedEnvVars` setting in your `settings.json` to exclude fewer
109
+ variables.
110
+
111
+ ## Exit codes
112
+
113
+ The Gemini CLI uses specific exit codes to indicate the reason for termination.
114
+ This is especially useful for scripting and automation.
115
+
116
+ | Exit Code | Error Type | Description |
117
+ | --------- | -------------------------- | --------------------------------------------------------------------------------------------------- |
118
+ | 41 | `FatalAuthenticationError` | An error occurred during the authentication process. |
119
+ | 42 | `FatalInputError` | Invalid or missing input was provided to the CLI. (non-interactive mode only) |
120
+ | 44 | `FatalSandboxError` | An error occurred with the sandboxing environment (e.g., Docker, Podman, or Seatbelt). |
121
+ | 52 | `FatalConfigError` | A configuration file (`settings.json`) is invalid or contains errors. |
122
+ | 53 | `FatalTurnLimitedError` | The maximum number of conversational turns for the session was reached. (non-interactive mode only) |
123
+
124
+ ## Debugging tips
125
+
126
+ - **CLI debugging:**
127
+ - Use the `--debug` flag for more detailed output.
128
+ - Check the CLI logs, often found in a user-specific configuration or cache
129
+ directory.
130
+
131
+ - **Core debugging:**
132
+ - Check the server console output for error messages or stack traces.
133
+ - Increase log verbosity if configurable.
134
+ - Use Node.js debugging tools (e.g., `node --inspect`) if you need to step
135
+ through server-side code.
136
+
137
+ - **Tool issues:**
138
+ - If a specific tool is failing, try to isolate the issue by running the
139
+ simplest possible version of the command or operation the tool performs.
140
+ - For `run_shell_command`, check that the command works directly in your shell
141
+ first.
142
+ - For _file system tools_, verify that paths are correct and check the
143
+ permissions.
144
+
145
+ - **Pre-flight checks:**
146
+ - Always run `npm run preflight` before committing code. This can catch many
147
+ common issues related to formatting, linting, and type errors.
148
+
149
+ ## Existing GitHub issues similar to yours or creating new issues
150
+
151
+ If you encounter an issue that was not covered here in this _Troubleshooting
152
+ guide_, consider searching the Gemini CLI
153
+ [Issue tracker on GitHub](https://github.com/google-gemini/gemini-cli/issues).
154
+ If you can't find an issue similar to yours, consider creating a new GitHub
155
+ Issue with a detailed description. Pull requests are also welcome!
156
+
157
+ > **Note:** Issues tagged as "🔒Maintainers only" are reserved for project
158
+ > maintainers. We will not accept pull requests related to these issues.
@@ -39,6 +39,7 @@ describe('DelegateToAgentTool', () => {
39
39
  beforeEach(() => {
40
40
  config = {
41
41
  getDebugMode: () => false,
42
+ getActiveModel: () => 'test-model',
42
43
  modelConfigService: {
43
44
  registerRuntimeModelConfig: vi.fn(),
44
45
  },
@@ -1 +1 @@
1
- {"version":3,"file":"delegate-to-agent-tool.test.js","sourceRoot":"","sources":["../../../src/agents/delegate-to-agent-tool.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAErE,EAAE,CAAC,IAAI,CAAC,uBAAuB,EAAE,GAAG,EAAE,CAAC,CAAC;IACtC,uBAAuB,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,CAAC;QACzD,OAAO,EAAE,EAAE;aACR,EAAE,EAAE;a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{ z } from 'zod';
8
+ declare const IntrospectionReportSchema: z.ZodObject<{
9
+ answer: z.ZodString;
10
+ sources: z.ZodArray<z.ZodString, "many">;
11
+ }, "strip", z.ZodTypeAny, {
12
+ sources: string[];
13
+ answer: string;
14
+ }, {
15
+ sources: string[];
16
+ answer: string;
17
+ }>;
18
+ /**
19
+ * An agent specialized in answering questions about Gemini CLI itself,
20
+ * using its own documentation and runtime state.
21
+ */
22
+ export declare const IntrospectionAgent: AgentDefinition<typeof IntrospectionReportSchema>;
23
+ export {};
@@ -0,0 +1,72 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { GetInternalDocsTool } from '../tools/get-internal-docs.js';
7
+ import { GEMINI_MODEL_ALIAS_FLASH } from '../config/models.js';
8
+ import { z } from 'zod';
9
+ const IntrospectionReportSchema = z.object({
10
+ answer: z
11
+ .string()
12
+ .describe('The detailed answer to the user question about Gemini CLI.'),
13
+ sources: z
14
+ .array(z.string())
15
+ .describe('The documentation files used to answer the question.'),
16
+ });
17
+ /**
18
+ * An agent specialized in answering questions about Gemini CLI itself,
19
+ * using its own documentation and runtime state.
20
+ */
21
+ export const IntrospectionAgent = {
22
+ name: 'introspection_agent',
23
+ kind: 'local',
24
+ displayName: 'Introspection Agent',
25
+ description: 'Specialized in answering questions about yourself (Gemini CLI): features, documentation, and current runtime configuration.',
26
+ inputConfig: {
27
+ inputs: {
28
+ question: {
29
+ description: 'The specific question about Gemini CLI.',
30
+ type: 'string',
31
+ required: true,
32
+ },
33
+ },
34
+ },
35
+ outputConfig: {
36
+ outputName: 'report',
37
+ description: 'The final answer and sources as a JSON object.',
38
+ schema: IntrospectionReportSchema,
39
+ },
40
+ processOutput: (output) => JSON.stringify(output, null, 2),
41
+ modelConfig: {
42
+ model: GEMINI_MODEL_ALIAS_FLASH,
43
+ temp: 0.1,
44
+ top_p: 0.95,
45
+ thinkingBudget: -1,
46
+ },
47
+ runConfig: {
48
+ max_time_minutes: 3,
49
+ max_turns: 10,
50
+ },
51
+ toolConfig: {
52
+ tools: [new GetInternalDocsTool()],
53
+ },
54
+ promptConfig: {
55
+ query: 'Your task is to answer the following question about Gemini CLI:\n' +
56
+ '<question>\n' +
57
+ '${question}\n' +
58
+ '</question>',
59
+ systemPrompt: "You are **Introspection Agent**, an expert on Gemini CLI. Your purpose is to provide accurate information about Gemini CLI's features, configuration, and current state.\n\n" +
60
+ '### Runtime Context\n' +
61
+ '- **CLI Version:** ${cliVersion}\n' +
62
+ '- **Active Model:** ${activeModel}\n' +
63
+ "- **Today's Date:** ${today}\n\n" +
64
+ '### Instructions\n' +
65
+ "1. **Explore Documentation**: Use the `get_internal_docs` tool to find answers. If you don't know where to start, call `get_internal_docs()` without arguments to see the full list of available documentation files.\n" +
66
+ '2. **Be Precise**: Use the provided runtime context and documentation to give exact answers.\n' +
67
+ '3. **Cite Sources**: Always include the specific documentation files you used in your final report.\n' +
68
+ '4. **Non-Interactive**: You operate in a loop and cannot ask the user for more info. If the question is ambiguous, answer as best as you can with the information available.\n\n' +
69
+ 'You MUST call `complete_task` with a JSON report containing your `answer` and the `sources` you used.',
70
+ },
71
+ };
72
+ //# sourceMappingURL=introspection-agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"introspection-agent.js","sourceRoot":"","sources":["../../../src/agents/introspection-agent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,QAAQ,CAAC,4DAA4D,CAAC;IACzE,OAAO,EAAE,CAAC;SACP,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;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
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { describe, it, expect } from 'vitest';
7
+ import { IntrospectionAgent } from './introspection-agent.js';
8
+ import { GetInternalDocsTool } from '../tools/get-internal-docs.js';
9
+ import { GEMINI_MODEL_ALIAS_FLASH } from '../config/models.js';
10
+ describe('IntrospectionAgent', () => {
11
+ const localAgent = IntrospectionAgent;
12
+ it('should have the correct agent definition metadata', () => {
13
+ expect(localAgent.name).toBe('introspection_agent');
14
+ expect(localAgent.kind).toBe('local');
15
+ expect(localAgent.displayName).toBe('Introspection Agent');
16
+ expect(localAgent.description).toContain('Gemini CLI');
17
+ });
18
+ it('should have correctly configured inputs and outputs', () => {
19
+ expect(localAgent.inputConfig.inputs['question']).toBeDefined();
20
+ expect(localAgent.inputConfig.inputs['question'].required).toBe(true);
21
+ expect(localAgent.outputConfig?.outputName).toBe('report');
22
+ expect(localAgent.outputConfig?.description).toBeDefined();
23
+ });
24
+ it('should use the correct model and tools', () => {
25
+ expect(localAgent.modelConfig?.model).toBe(GEMINI_MODEL_ALIAS_FLASH);
26
+ const tools = localAgent.toolConfig?.tools || [];
27
+ const hasInternalDocsTool = tools.some((t) => t instanceof GetInternalDocsTool);
28
+ expect(hasInternalDocsTool).toBe(true);
29
+ });
30
+ it('should have expected prompt placeholders', () => {
31
+ const systemPrompt = localAgent.promptConfig.systemPrompt || '';
32
+ expect(systemPrompt).toContain('${cliVersion}');
33
+ expect(systemPrompt).toContain('${activeModel}');
34
+ expect(systemPrompt).toContain('${today}');
35
+ const query = localAgent.promptConfig.query || '';
36
+ expect(query).toContain('${question}');
37
+ });
38
+ it('should process output to a formatted JSON string', () => {
39
+ const mockOutput = {
40
+ answer: 'This is the answer.',
41
+ sources: ['file1.md', 'file2.md'],
42
+ };
43
+ const processed = localAgent.processOutput?.(mockOutput);
44
+ expect(processed).toBe(JSON.stringify(mockOutput, null, 2));
45
+ });
46
+ });
47
+ //# sourceMappingURL=introspection-agent.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"introspection-agent.test.js","sourceRoot":"","sources":["../../../src/agents/introspection-agent.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAG/D,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,MAAM,UAAU,GAAG,kBAA0C,CAAC;IAE9D,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;QAC3D,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QACpD,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAC3D,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qDAAqD,EAAE,GAAG,EAAE;QAC7D,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QAChE,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEtE,MAAM,CAAC,UAAU,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC3D,MAAM,CAAC,UAAU,CAA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AC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -97,12 +97,6 @@ export declare class LocalAgentExecutor<TOutput extends z.ZodTypeAny> {
97
97
  * @returns A new array of `Content` with templated strings.
98
98
  */
99
99
  private applyTemplateToInitialMessages;
100
- /**
101
- * Validates that all tools in a registry are safe for non-interactive use.
102
- *
103
- * @throws An error if a tool is not on the allow-list for non-interactive execution.
104
- */
105
- private static validateTools;
106
100
  /**
107
101
  * Checks if the agent should terminate due to exceeding configured limits.
108
102
  *
@@ -11,7 +11,6 @@ import { ToolRegistry } from '../tools/tool-registry.js';
11
11
  import { CompressionStatus } from '../core/turn.js';
12
12
  import { ChatCompressionService } from '../services/chatCompressionService.js';
13
13
  import { getDirectoryContextString } from '../utils/environmentContext.js';
14
- import { GLOB_TOOL_NAME, GREP_TOOL_NAME, LS_TOOL_NAME, MEMORY_TOOL_NAME, READ_FILE_TOOL_NAME, READ_MANY_FILES_TOOL_NAME, WEB_SEARCH_TOOL_NAME, } from '../tools/tool-names.js';
15
14
  import { promptIdContext } from '../utils/promptIdContext.js';
16
15
  import { logAgentStart, logAgentFinish, logRecoveryAttempt, } from '../telemetry/loggers.js';
17
16
  import { AgentStartEvent, AgentFinishEvent, RecoveryAttemptEvent, } from '../telemetry/types.js';
@@ -22,6 +21,8 @@ import {} from 'zod';
22
21
  import { zodToJsonSchema } from 'zod-to-json-schema';
23
22
  import { debugLogger } from '../utils/debugLogger.js';
24
23
  import { getModelConfigAlias } from './registry.js';
24
+ import { getVersion } from '../utils/version.js';
25
+ import { ApprovalMode } from '../policy/types.js';
25
26
  const TASK_COMPLETE_TOOL_NAME = 'complete_task';
26
27
  const GRACE_PERIOD_MS = 60 * 1000; // 1 min
27
28
  /**
@@ -72,9 +73,6 @@ export class LocalAgentExecutor {
72
73
  // registered; their schemas are passed directly to the model later.
73
74
  }
74
75
  agentToolRegistry.sortTools();
75
- // Validate that all registered tools are safe for non-interactive
76
- // execution.
77
- await LocalAgentExecutor.validateTools(agentToolRegistry, definition.name);
78
76
  }
79
77
  // Get the parent prompt ID from context
80
78
  const parentPromptId = promptIdContext.getStore();
@@ -243,10 +241,17 @@ export class LocalAgentExecutor {
243
241
  let chat;
244
242
  let tools;
245
243
  try {
244
+ // Inject standard runtime context into inputs
245
+ const augmentedInputs = {
246
+ ...inputs,
247
+ cliVersion: await getVersion(),
248
+ activeModel: this.runtimeContext.getActiveModel(),
249
+ today: new Date().toLocaleDateString(),
250
+ };
246
251
  tools = this.prepareToolsList();
247
- chat = await this.createChatObject(inputs, tools);
252
+ chat = await this.createChatObject(augmentedInputs, tools);
248
253
  const query = this.definition.promptConfig.query
249
- ? templateString(this.definition.promptConfig.query, inputs)
254
+ ? templateString(this.definition.promptConfig.query, augmentedInputs)
250
255
  : 'Get Started!';
251
256
  let currentMessage = { role: 'user', parts: [{ text: query }] };
252
257
  while (true) {
@@ -548,19 +553,44 @@ export class LocalAgentExecutor {
548
553
  }
549
554
  }
550
555
  else {
551
- // No output expected. Just signal completion.
552
- submittedOutput = 'Task completed successfully.';
553
- syncResponseParts.push({
554
- functionResponse: {
555
- name: TASK_COMPLETE_TOOL_NAME,
556
- response: { status: 'Task marked complete.' },
557
- id: callId,
558
- },
559
- });
560
- this.emitActivity('TOOL_CALL_END', {
561
- name: functionCall.name,
562
- output: 'Task marked complete.',
563
- });
556
+ // No outputConfig - use default 'result' parameter
557
+ const resultArg = args['result'];
558
+ if (resultArg !== undefined &&
559
+ resultArg !== null &&
560
+ resultArg !== '') {
561
+ submittedOutput =
562
+ typeof resultArg === 'string'
563
+ ? resultArg
564
+ : JSON.stringify(resultArg, null, 2);
565
+ syncResponseParts.push({
566
+ functionResponse: {
567
+ name: TASK_COMPLETE_TOOL_NAME,
568
+ response: { status: 'Result submitted and task completed.' },
569
+ id: callId,
570
+ },
571
+ });
572
+ this.emitActivity('TOOL_CALL_END', {
573
+ name: functionCall.name,
574
+ output: 'Result submitted and task completed.',
575
+ });
576
+ }
577
+ else {
578
+ // No result provided - this is an error for agents expected to return results
579
+ taskCompleted = false; // Revoke completion
580
+ const error = 'Missing required "result" argument. You must provide your findings when calling complete_task.';
581
+ syncResponseParts.push({
582
+ functionResponse: {
583
+ name: TASK_COMPLETE_TOOL_NAME,
584
+ response: { error },
585
+ id: callId,
586
+ },
587
+ });
588
+ this.emitActivity('ERROR', {
589
+ context: 'tool_call',
590
+ name: functionCall.name,
591
+ error,
592
+ });
593
+ }
564
594
  }
565
595
  continue;
566
596
  }
@@ -592,7 +622,10 @@ export class LocalAgentExecutor {
592
622
  };
593
623
  // Create a promise for the tool execution
594
624
  const executionPromise = (async () => {
595
- const { response: toolResponse } = await executeToolCall(this.runtimeContext, requestInfo, signal);
625
+ const agentContext = Object.create(this.runtimeContext);
626
+ agentContext.getToolRegistry = () => this.toolRegistry;
627
+ agentContext.getApprovalMode = () => ApprovalMode.YOLO;
628
+ const { response: toolResponse } = await executeToolCall(agentContext, requestInfo, signal);
596
629
  if (toolResponse.error) {
597
630
  this.emitActivity('ERROR', {
598
631
  context: 'tool_call',
@@ -663,7 +696,7 @@ export class LocalAgentExecutor {
663
696
  name: TASK_COMPLETE_TOOL_NAME,
664
697
  description: outputConfig
665
698
  ? 'Call this tool to submit your final answer and complete the task. This is the ONLY way to finish.'
666
- : 'Call this tool to signal that you have completed your task. This is the ONLY way to finish.',
699
+ : 'Call this tool to submit your final findings and complete the task. This is the ONLY way to finish.',
667
700
  parameters: {
668
701
  type: Type.OBJECT,
669
702
  properties: {},
@@ -677,6 +710,14 @@ export class LocalAgentExecutor {
677
710
  schema;
678
711
  completeTool.parameters.required.push(outputConfig.outputName);
679
712
  }
713
+ else {
714
+ completeTool.parameters.properties['result'] = {
715
+ type: Type.STRING,
716
+ description: 'Your final results or findings to return to the orchestrator. ' +
717
+ 'Ensure this is comprehensive and follows any formatting requested in your instructions.',
718
+ };
719
+ completeTool.parameters.required.push('result');
720
+ }
680
721
  toolsList.push(completeTool);
681
722
  return toolsList;
682
723
  }
@@ -697,10 +738,20 @@ Important Rules:
697
738
  * You are running in a non-interactive mode. You CANNOT ask the user for input or clarification.
698
739
  * Work systematically using available tools to complete your task.
699
740
  * Always use absolute paths for file operations. Construct them using the provided "Environment Context".`;
700
- finalPrompt += `
741
+ if (this.definition.outputConfig) {
742
+ finalPrompt += `
743
+ * When you have completed your task, you MUST call the \`${TASK_COMPLETE_TOOL_NAME}\` tool with your structured output.
744
+ * Do not call any other tools in the same turn as \`${TASK_COMPLETE_TOOL_NAME}\`.
745
+ * This is the ONLY way to complete your mission. If you stop calling tools without calling this, you have failed.`;
746
+ }
747
+ else {
748
+ finalPrompt += `
701
749
  * When you have completed your task, you MUST call the \`${TASK_COMPLETE_TOOL_NAME}\` tool.
750
+ * You MUST include your final findings in the "result" parameter. This is how you return the necessary results for the task to be marked complete.
751
+ * Ensure your findings are comprehensive and follow any specific formatting requirements provided in your instructions.
702
752
  * Do not call any other tools in the same turn as \`${TASK_COMPLETE_TOOL_NAME}\`.
703
753
  * This is the ONLY way to complete your mission. If you stop calling tools without calling this, you have failed.`;
754
+ }
704
755
  return finalPrompt;
705
756
  }
706
757
  /**
@@ -721,31 +772,6 @@ Important Rules:
721
772
  return { ...content, parts: newParts };
722
773
  });
723
774
  }
724
- /**
725
- * Validates that all tools in a registry are safe for non-interactive use.
726
- *
727
- * @throws An error if a tool is not on the allow-list for non-interactive execution.
728
- */
729
- static async validateTools(toolRegistry, agentName) {
730
- // Tools that are non-interactive. This is temporary until we have tool
731
- // confirmations for subagents.
732
- const allowlist = new Set([
733
- LS_TOOL_NAME,
734
- READ_FILE_TOOL_NAME,
735
- GREP_TOOL_NAME,
736
- GLOB_TOOL_NAME,
737
- READ_MANY_FILES_TOOL_NAME,
738
- MEMORY_TOOL_NAME,
739
- WEB_SEARCH_TOOL_NAME,
740
- ]);
741
- for (const tool of toolRegistry.getAllTools()) {
742
- if (!allowlist.has(tool.name)) {
743
- throw new Error(`Tool "${tool.name}" is not on the allow-list for non-interactive ` +
744
- `execution in agent "${agentName}". Only tools that do not require user ` +
745
- `confirmation can be used in subagents.`);
746
- }
747
- }
748
- }
749
775
  /**
750
776
  * Checks if the agent should terminate due to exceeding configured limits.
751
777
  *