@google/gemini-cli-core 0.1.13 → 0.1.15

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 (234) hide show
  1. package/README.md +22 -1
  2. package/dist/google-gemini-cli-core-0.1.13.tgz +0 -0
  3. package/dist/src/code_assist/codeAssist.js +2 -2
  4. package/dist/src/code_assist/codeAssist.js.map +1 -1
  5. package/dist/src/code_assist/oauth2.js +9 -2
  6. package/dist/src/code_assist/oauth2.js.map +1 -1
  7. package/dist/src/code_assist/oauth2.test.js +99 -7
  8. package/dist/src/code_assist/oauth2.test.js.map +1 -1
  9. package/dist/src/code_assist/server.d.ts +4 -6
  10. package/dist/src/code_assist/server.js +4 -69
  11. package/dist/src/code_assist/server.js.map +1 -1
  12. package/dist/src/code_assist/setup.d.ts +6 -1
  13. package/dist/src/code_assist/setup.js +4 -1
  14. package/dist/src/code_assist/setup.js.map +1 -1
  15. package/dist/src/code_assist/setup.test.js +4 -1
  16. package/dist/src/code_assist/setup.test.js.map +1 -1
  17. package/dist/src/code_assist/types.d.ts +2 -2
  18. package/dist/src/config/config.d.ts +28 -7
  19. package/dist/src/config/config.js +52 -16
  20. package/dist/src/config/config.js.map +1 -1
  21. package/dist/src/config/config.test.js +1 -23
  22. package/dist/src/config/config.test.js.map +1 -1
  23. package/dist/src/config/flashFallback.test.js +1 -1
  24. package/dist/src/config/flashFallback.test.js.map +1 -1
  25. package/dist/src/core/client.d.ts +5 -2
  26. package/dist/src/core/client.js +39 -17
  27. package/dist/src/core/client.js.map +1 -1
  28. package/dist/src/core/client.test.js +51 -0
  29. package/dist/src/core/client.test.js.map +1 -1
  30. package/dist/src/core/contentGenerator.d.ts +1 -1
  31. package/dist/src/core/contentGenerator.js +1 -1
  32. package/dist/src/core/contentGenerator.js.map +1 -1
  33. package/dist/src/core/geminiChat.d.ts +4 -3
  34. package/dist/src/core/geminiChat.js +8 -11
  35. package/dist/src/core/geminiChat.js.map +1 -1
  36. package/dist/src/core/geminiRequest.js +2 -37
  37. package/dist/src/core/geminiRequest.js.map +1 -1
  38. package/dist/src/core/logger.js +6 -0
  39. package/dist/src/core/logger.js.map +1 -1
  40. package/dist/src/core/logger.test.js +1 -1
  41. package/dist/src/core/logger.test.js.map +1 -1
  42. package/dist/src/core/nonInteractiveToolExecutor.test.js +5 -5
  43. package/dist/src/core/prompts.js +42 -18
  44. package/dist/src/core/prompts.js.map +1 -1
  45. package/dist/src/core/prompts.test.js +121 -4
  46. package/dist/src/core/prompts.test.js.map +1 -1
  47. package/dist/src/core/turn.d.ts +7 -2
  48. package/dist/src/core/turn.js +9 -0
  49. package/dist/src/core/turn.js.map +1 -1
  50. package/dist/src/core/turn.test.js +129 -0
  51. package/dist/src/core/turn.test.js.map +1 -1
  52. package/dist/src/ide/ide-client.d.ts +28 -0
  53. package/dist/src/ide/ide-client.js +88 -0
  54. package/dist/src/ide/ide-client.js.map +1 -0
  55. package/dist/src/ide/ideContext.d.ts +174 -0
  56. package/dist/src/{services → ide}/ideContext.js +28 -25
  57. package/dist/src/ide/ideContext.js.map +1 -0
  58. package/dist/src/{services → ide}/ideContext.test.js +39 -39
  59. package/dist/src/ide/ideContext.test.js.map +1 -0
  60. package/dist/src/index.d.ts +8 -1
  61. package/dist/src/index.js +11 -1
  62. package/dist/src/index.js.map +1 -1
  63. package/dist/src/mcp/google-auth-provider.d.ts +23 -0
  64. package/dist/src/mcp/google-auth-provider.js +63 -0
  65. package/dist/src/mcp/google-auth-provider.js.map +1 -0
  66. package/dist/src/mcp/google-auth-provider.test.js +54 -0
  67. package/dist/src/mcp/google-auth-provider.test.js.map +1 -0
  68. package/dist/src/mcp/oauth-provider.d.ts +5 -1
  69. package/dist/src/mcp/oauth-provider.js +36 -11
  70. package/dist/src/mcp/oauth-provider.js.map +1 -1
  71. package/dist/src/mcp/oauth-provider.test.js +2 -2
  72. package/dist/src/mcp/oauth-provider.test.js.map +1 -1
  73. package/dist/src/mcp/oauth-token-storage.d.ts +3 -1
  74. package/dist/src/mcp/oauth-token-storage.js +3 -1
  75. package/dist/src/mcp/oauth-token-storage.js.map +1 -1
  76. package/dist/src/prompts/mcp-prompts.d.ts +8 -0
  77. package/dist/src/prompts/mcp-prompts.js +13 -0
  78. package/dist/src/prompts/mcp-prompts.js.map +1 -0
  79. package/dist/src/prompts/prompt-registry.d.ts +26 -0
  80. package/dist/src/prompts/prompt-registry.js +47 -0
  81. package/dist/src/prompts/prompt-registry.js.map +1 -0
  82. package/dist/src/services/fileDiscoveryService.test.js +101 -60
  83. package/dist/src/services/fileDiscoveryService.test.js.map +1 -1
  84. package/dist/src/services/gitService.test.js +67 -86
  85. package/dist/src/services/gitService.test.js.map +1 -1
  86. package/dist/src/services/loopDetectionService.d.ts +48 -5
  87. package/dist/src/services/loopDetectionService.js +124 -38
  88. package/dist/src/services/loopDetectionService.js.map +1 -1
  89. package/dist/src/services/loopDetectionService.test.js +39 -112
  90. package/dist/src/services/loopDetectionService.test.js.map +1 -1
  91. package/dist/src/services/shellExecutionService.d.ts +70 -0
  92. package/dist/src/services/shellExecutionService.js +152 -0
  93. package/dist/src/services/shellExecutionService.js.map +1 -0
  94. package/dist/src/services/shellExecutionService.test.d.ts +6 -0
  95. package/dist/src/services/shellExecutionService.test.js +258 -0
  96. package/dist/src/services/shellExecutionService.test.js.map +1 -0
  97. package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +2 -1
  98. package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +17 -2
  99. package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -1
  100. package/dist/src/telemetry/constants.d.ts +1 -0
  101. package/dist/src/telemetry/constants.js +1 -0
  102. package/dist/src/telemetry/constants.js.map +1 -1
  103. package/dist/src/telemetry/file-exporters.d.ts +28 -0
  104. package/dist/src/telemetry/file-exporters.js +62 -0
  105. package/dist/src/telemetry/file-exporters.js.map +1 -0
  106. package/dist/src/telemetry/loggers.d.ts +2 -1
  107. package/dist/src/telemetry/loggers.js +17 -1
  108. package/dist/src/telemetry/loggers.js.map +1 -1
  109. package/dist/src/telemetry/sdk.js +17 -6
  110. package/dist/src/telemetry/sdk.js.map +1 -1
  111. package/dist/src/telemetry/types.d.ts +9 -2
  112. package/dist/src/telemetry/types.js +13 -1
  113. package/dist/src/telemetry/types.js.map +1 -1
  114. package/dist/src/tools/edit.js +10 -4
  115. package/dist/src/tools/edit.js.map +1 -1
  116. package/dist/src/tools/edit.test.js +12 -0
  117. package/dist/src/tools/edit.test.js.map +1 -1
  118. package/dist/src/tools/glob.test.js +7 -4
  119. package/dist/src/tools/glob.test.js.map +1 -1
  120. package/dist/src/tools/grep.test.js +5 -5
  121. package/dist/src/tools/grep.test.js.map +1 -1
  122. package/dist/src/tools/ls.d.ts +5 -2
  123. package/dist/src/tools/ls.js +39 -10
  124. package/dist/src/tools/ls.js.map +1 -1
  125. package/dist/src/tools/mcp-client.d.ts +31 -3
  126. package/dist/src/tools/mcp-client.js +478 -38
  127. package/dist/src/tools/mcp-client.js.map +1 -1
  128. package/dist/src/tools/mcp-client.test.js +99 -7
  129. package/dist/src/tools/mcp-client.test.js.map +1 -1
  130. package/dist/src/tools/mcp-tool.js +1 -1
  131. package/dist/src/tools/mcp-tool.js.map +1 -1
  132. package/dist/src/tools/mcp-tool.test.js +34 -0
  133. package/dist/src/tools/mcp-tool.test.js.map +1 -1
  134. package/dist/src/tools/modifiable-tool.test.js +51 -62
  135. package/dist/src/tools/modifiable-tool.test.js.map +1 -1
  136. package/dist/src/tools/read-file.test.js +98 -69
  137. package/dist/src/tools/read-file.test.js.map +1 -1
  138. package/dist/src/tools/read-many-files.d.ts +5 -3
  139. package/dist/src/tools/read-many-files.js +62 -22
  140. package/dist/src/tools/read-many-files.js.map +1 -1
  141. package/dist/src/tools/read-many-files.test.js +5 -2
  142. package/dist/src/tools/read-many-files.test.js.map +1 -1
  143. package/dist/src/tools/shell.d.ts +3 -23
  144. package/dist/src/tools/shell.js +165 -296
  145. package/dist/src/tools/shell.js.map +1 -1
  146. package/dist/src/tools/shell.test.js +254 -392
  147. package/dist/src/tools/shell.test.js.map +1 -1
  148. package/dist/src/tools/tool-registry.d.ts +13 -1
  149. package/dist/src/tools/tool-registry.js +46 -2
  150. package/dist/src/tools/tool-registry.js.map +1 -1
  151. package/dist/src/tools/tool-registry.test.js +5 -5
  152. package/dist/src/tools/tool-registry.test.js.map +1 -1
  153. package/dist/src/utils/bfsFileSearch.d.ts +2 -0
  154. package/dist/src/utils/bfsFileSearch.js +4 -1
  155. package/dist/src/utils/bfsFileSearch.js.map +1 -1
  156. package/dist/src/utils/bfsFileSearch.test.js +108 -105
  157. package/dist/src/utils/bfsFileSearch.test.js.map +1 -1
  158. package/dist/src/utils/editCorrector.js +4 -4
  159. package/dist/src/utils/editCorrector.js.map +1 -1
  160. package/dist/src/utils/editCorrector.test.js +1 -1
  161. package/dist/src/utils/editor.js +16 -10
  162. package/dist/src/utils/editor.js.map +1 -1
  163. package/dist/src/utils/editor.test.js +128 -28
  164. package/dist/src/utils/editor.test.js.map +1 -1
  165. package/dist/src/utils/errorReporting.d.ts +1 -1
  166. package/dist/src/utils/errorReporting.js +2 -2
  167. package/dist/src/utils/errorReporting.js.map +1 -1
  168. package/dist/src/utils/errorReporting.test.js +44 -38
  169. package/dist/src/utils/errorReporting.test.js.map +1 -1
  170. package/dist/src/utils/fileUtils.d.ts +4 -4
  171. package/dist/src/utils/fileUtils.js +31 -15
  172. package/dist/src/utils/fileUtils.js.map +1 -1
  173. package/dist/src/utils/fileUtils.test.js +37 -37
  174. package/dist/src/utils/fileUtils.test.js.map +1 -1
  175. package/dist/src/utils/formatters.d.ts +6 -0
  176. package/dist/src/utils/formatters.js +16 -0
  177. package/dist/src/utils/formatters.js.map +1 -0
  178. package/dist/src/utils/getFolderStructure.d.ts +3 -2
  179. package/dist/src/utils/getFolderStructure.js +27 -28
  180. package/dist/src/utils/getFolderStructure.js.map +1 -1
  181. package/dist/src/utils/getFolderStructure.test.js +169 -187
  182. package/dist/src/utils/getFolderStructure.test.js.map +1 -1
  183. package/dist/src/utils/gitIgnoreParser.js +4 -7
  184. package/dist/src/utils/gitIgnoreParser.js.map +1 -1
  185. package/dist/src/utils/gitIgnoreParser.test.js +70 -61
  186. package/dist/src/utils/gitIgnoreParser.test.js.map +1 -1
  187. package/dist/src/utils/memoryDiscovery.d.ts +2 -1
  188. package/dist/src/utils/memoryDiscovery.js +11 -5
  189. package/dist/src/utils/memoryDiscovery.js.map +1 -1
  190. package/dist/src/utils/memoryDiscovery.test.js +160 -371
  191. package/dist/src/utils/memoryDiscovery.test.js.map +1 -1
  192. package/dist/src/utils/partUtils.d.ts +14 -0
  193. package/dist/src/utils/partUtils.js +65 -0
  194. package/dist/src/utils/partUtils.js.map +1 -0
  195. package/dist/src/utils/partUtils.test.d.ts +6 -0
  196. package/dist/src/utils/partUtils.test.js +130 -0
  197. package/dist/src/utils/partUtils.test.js.map +1 -0
  198. package/dist/src/utils/paths.d.ts +11 -0
  199. package/dist/src/utils/paths.js +17 -1
  200. package/dist/src/utils/paths.js.map +1 -1
  201. package/dist/src/utils/quotaErrorDetection.js +0 -2
  202. package/dist/src/utils/quotaErrorDetection.js.map +1 -1
  203. package/dist/src/utils/retry.js +1 -1
  204. package/dist/src/utils/retry.js.map +1 -1
  205. package/dist/src/utils/schemaValidator.d.ts +1 -1
  206. package/dist/src/utils/schemaValidator.js +6 -3
  207. package/dist/src/utils/schemaValidator.js.map +1 -1
  208. package/dist/src/utils/shell-utils.d.ts +78 -0
  209. package/dist/src/utils/shell-utils.js +306 -0
  210. package/dist/src/utils/shell-utils.js.map +1 -0
  211. package/dist/src/utils/shell-utils.test.d.ts +6 -0
  212. package/dist/src/utils/shell-utils.test.js +200 -0
  213. package/dist/src/utils/shell-utils.test.js.map +1 -0
  214. package/dist/src/utils/summarizer.js +1 -30
  215. package/dist/src/utils/summarizer.js.map +1 -1
  216. package/dist/src/utils/systemEncoding.d.ts +40 -0
  217. package/dist/src/utils/systemEncoding.js +149 -0
  218. package/dist/src/utils/systemEncoding.js.map +1 -0
  219. package/dist/src/utils/systemEncoding.test.d.ts +6 -0
  220. package/dist/src/utils/systemEncoding.test.js +368 -0
  221. package/dist/src/utils/systemEncoding.test.js.map +1 -0
  222. package/dist/src/utils/textUtils.d.ts +13 -0
  223. package/dist/src/utils/textUtils.js +28 -0
  224. package/dist/src/utils/textUtils.js.map +1 -0
  225. package/dist/tsconfig.tsbuildinfo +1 -1
  226. package/package.json +2 -1
  227. package/dist/google-gemini-cli-core-0.1.12.tgz +0 -0
  228. package/dist/src/core/geminiRequest.test.js +0 -72
  229. package/dist/src/core/geminiRequest.test.js.map +0 -1
  230. package/dist/src/services/ideContext.d.ts +0 -126
  231. package/dist/src/services/ideContext.js.map +0 -1
  232. package/dist/src/services/ideContext.test.js.map +0 -1
  233. /package/dist/src/{services → ide}/ideContext.test.d.ts +0 -0
  234. /package/dist/src/{core/geminiRequest.test.d.ts → mcp/google-auth-provider.test.d.ts} +0 -0
@@ -11,28 +11,29 @@ import { BaseTool, ToolConfirmationOutcome, Icon, } from './tools.js';
11
11
  import { Type } from '@google/genai';
12
12
  import { SchemaValidator } from '../utils/schemaValidator.js';
13
13
  import { getErrorMessage } from '../utils/errors.js';
14
- import stripAnsi from 'strip-ansi';
15
- import { spawn } from 'child_process';
16
14
  import { summarizeToolOutput } from '../utils/summarizer.js';
17
- const OUTPUT_UPDATE_INTERVAL_MS = 1000;
15
+ import { ShellExecutionService, } from '../services/shellExecutionService.js';
16
+ import { formatMemoryUsage } from '../utils/formatters.js';
17
+ import { getCommandRoots, isCommandAllowed, stripShellWrapper, } from '../utils/shell-utils.js';
18
+ export const OUTPUT_UPDATE_INTERVAL_MS = 1000;
18
19
  export class ShellTool extends BaseTool {
19
20
  config;
20
21
  static Name = 'run_shell_command';
21
- whitelist = new Set();
22
+ allowlist = new Set();
22
23
  constructor(config) {
23
24
  super(ShellTool.Name, 'Shell', `This tool executes a given shell command as \`bash -c <command>\`. Command can start background processes using \`&\`. Command is executed as a subprocess that leads its own process group. Command process group can be terminated as \`kill -- -PGID\` or signaled as \`kill -s SIGNAL -- -PGID\`.
24
25
 
25
- The following information is returned:
26
+ The following information is returned:
26
27
 
27
- Command: Executed command.
28
- Directory: Directory (relative to project root) where command was executed, or \`(root)\`.
29
- Stdout: Output on stdout stream. Can be \`(empty)\` or partial on error and for any unwaited background processes.
30
- Stderr: Output on stderr stream. Can be \`(empty)\` or partial on error and for any unwaited background processes.
31
- Error: Error or \`(none)\` if no error was reported for the subprocess.
32
- Exit Code: Exit code or \`(none)\` if terminated by signal.
33
- Signal: Signal number or \`(none)\` if no signal was received.
34
- Background PIDs: List of background processes started or \`(none)\`.
35
- Process Group PGID: Process group started or \`(none)\``, Icon.Terminal, {
28
+ Command: Executed command.
29
+ Directory: Directory (relative to project root) where command was executed, or \`(root)\`.
30
+ Stdout: Output on stdout stream. Can be \`(empty)\` or partial on error and for any unwaited background processes.
31
+ Stderr: Output on stderr stream. Can be \`(empty)\` or partial on error and for any unwaited background processes.
32
+ Error: Error or \`(none)\` if no error was reported for the subprocess.
33
+ Exit Code: Exit code or \`(none)\` if terminated by signal.
34
+ Signal: Signal number or \`(none)\` if no signal was received.
35
+ Background PIDs: List of background processes started or \`(none)\`.
36
+ Process Group PGID: Process group started or \`(none)\``, Icon.Terminal, {
36
37
  type: Type.OBJECT,
37
38
  properties: {
38
39
  command: {
@@ -66,107 +67,8 @@ Process Group PGID: Process group started or \`(none)\``, Icon.Terminal, {
66
67
  }
67
68
  return description;
68
69
  }
69
- /**
70
- * Extracts the root command from a given shell command string.
71
- * This is used to identify the base command for permission checks.
72
- *
73
- * @param command The shell command string to parse
74
- * @returns The root command name, or undefined if it cannot be determined
75
- * @example getCommandRoot("ls -la /tmp") returns "ls"
76
- * @example getCommandRoot("git status && npm test") returns "git"
77
- */
78
- getCommandRoot(command) {
79
- return command
80
- .trim() // remove leading and trailing whitespace
81
- .replace(/[{}()]/g, '') // remove all grouping operators
82
- .split(/[\s;&|]+/)[0] // split on any whitespace or separator or chaining operators and take first part
83
- ?.split(/[/\\]/) // split on any path separators (or return undefined if previous line was undefined)
84
- .pop(); // take last part and return command root (or undefined if previous line was empty)
85
- }
86
- /**
87
- * Determines whether a given shell command is allowed to execute based on
88
- * the tool's configuration including allowlists and blocklists.
89
- *
90
- * @param command The shell command string to validate
91
- * @returns An object with 'allowed' boolean and optional 'reason' string if not allowed
92
- */
93
- isCommandAllowed(command) {
94
- // 0. Disallow command substitution
95
- if (command.includes('$(')) {
96
- return {
97
- allowed: false,
98
- reason: 'Command substitution using $() is not allowed for security reasons',
99
- };
100
- }
101
- const SHELL_TOOL_NAMES = [ShellTool.name, ShellTool.Name];
102
- const normalize = (cmd) => cmd.trim().replace(/\s+/g, ' ');
103
- /**
104
- * Checks if a command string starts with a given prefix, ensuring it's a
105
- * whole word match (i.e., followed by a space or it's an exact match).
106
- * e.g., `isPrefixedBy('npm install', 'npm')` -> true
107
- * e.g., `isPrefixedBy('npm', 'npm')` -> true
108
- * e.g., `isPrefixedBy('npminstall', 'npm')` -> false
109
- */
110
- const isPrefixedBy = (cmd, prefix) => {
111
- if (!cmd.startsWith(prefix)) {
112
- return false;
113
- }
114
- return cmd.length === prefix.length || cmd[prefix.length] === ' ';
115
- };
116
- /**
117
- * Extracts and normalizes shell commands from a list of tool strings.
118
- * e.g., 'ShellTool("ls -l")' becomes 'ls -l'
119
- */
120
- const extractCommands = (tools) => tools.flatMap((tool) => {
121
- for (const toolName of SHELL_TOOL_NAMES) {
122
- if (tool.startsWith(`${toolName}(`) && tool.endsWith(')')) {
123
- return [normalize(tool.slice(toolName.length + 1, -1))];
124
- }
125
- }
126
- return [];
127
- });
128
- const coreTools = this.config.getCoreTools() || [];
129
- const excludeTools = this.config.getExcludeTools() || [];
130
- // 1. Check if the shell tool is globally disabled.
131
- if (SHELL_TOOL_NAMES.some((name) => excludeTools.includes(name))) {
132
- return {
133
- allowed: false,
134
- reason: 'Shell tool is globally disabled in configuration',
135
- };
136
- }
137
- const blockedCommands = new Set(extractCommands(excludeTools));
138
- const allowedCommands = new Set(extractCommands(coreTools));
139
- const hasSpecificAllowedCommands = allowedCommands.size > 0;
140
- const isWildcardAllowed = SHELL_TOOL_NAMES.some((name) => coreTools.includes(name));
141
- const commandsToValidate = command.split(/&&|\|\||\||;/).map(normalize);
142
- const blockedCommandsArr = [...blockedCommands];
143
- for (const cmd of commandsToValidate) {
144
- // 2. Check if the command is on the blocklist.
145
- const isBlocked = blockedCommandsArr.some((blocked) => isPrefixedBy(cmd, blocked));
146
- if (isBlocked) {
147
- return {
148
- allowed: false,
149
- reason: `Command '${cmd}' is blocked by configuration`,
150
- };
151
- }
152
- // 3. If in strict allow-list mode, check if the command is permitted.
153
- const isStrictAllowlist = hasSpecificAllowedCommands && !isWildcardAllowed;
154
- const allowedCommandsArr = [...allowedCommands];
155
- if (isStrictAllowlist) {
156
- const isAllowed = allowedCommandsArr.some((allowed) => isPrefixedBy(cmd, allowed));
157
- if (!isAllowed) {
158
- return {
159
- allowed: false,
160
- reason: `Command '${cmd}' is not in the allowed commands list`,
161
- };
162
- }
163
- }
164
- }
165
- // 4. If all checks pass, the command is allowed.
166
- return { allowed: true };
167
- }
168
70
  validateToolParams(params) {
169
- const commandCheck = this.isCommandAllowed(params.command);
71
+ const commandCheck = isCommandAllowed(params.command, this.config);
170
72
  if (!commandCheck.allowed) {
171
73
  if (!commandCheck.reason) {
172
74
  console.error('Unexpected: isCommandAllowed returned false without a reason');
@@ -181,7 +83,7 @@ Process Group PGID: Process group started or \`(none)\``, Icon.Terminal, {
181
83
  if (!params.command.trim()) {
182
84
  return 'Command cannot be empty.';
183
85
  }
184
- if (!this.getCommandRoot(params.command)) {
86
+ if (getCommandRoots(params.command).length === 0) {
185
87
  return 'Could not identify command root to obtain permission from user.';
186
88
  }
187
89
  if (params.directory) {
@@ -199,35 +101,38 @@ Process Group PGID: Process group started or \`(none)\``, Icon.Terminal, {
199
101
  if (this.validateToolParams(params)) {
200
102
  return false; // skip confirmation, execute call will fail immediately
201
103
  }
202
- const rootCommand = this.getCommandRoot(params.command); // must be non-empty string post-validation
203
- if (this.whitelist.has(rootCommand)) {
104
+ const command = stripShellWrapper(params.command);
105
+ const rootCommands = [...new Set(getCommandRoots(command))];
106
+ const commandsToConfirm = rootCommands.filter((command) => !this.allowlist.has(command));
107
+ if (commandsToConfirm.length === 0) {
204
108
  return false; // already approved and whitelisted
205
109
  }
206
110
  const confirmationDetails = {
207
111
  type: 'exec',
208
112
  title: 'Confirm Shell Command',
209
113
  command: params.command,
210
- rootCommand,
114
+ rootCommand: commandsToConfirm.join(', '),
211
115
  onConfirm: async (outcome) => {
212
116
  if (outcome === ToolConfirmationOutcome.ProceedAlways) {
213
- this.whitelist.add(rootCommand);
117
+ commandsToConfirm.forEach((command) => this.allowlist.add(command));
214
118
  }
215
119
  },
216
120
  };
217
121
  return confirmationDetails;
218
122
  }
219
- async execute(params, abortSignal, updateOutput) {
220
- const validationError = this.validateToolParams(params);
123
+ async execute(params, signal, updateOutput) {
124
+ const strippedCommand = stripShellWrapper(params.command);
125
+ const validationError = this.validateToolParams({
126
+ ...params,
127
+ command: strippedCommand,
128
+ });
221
129
  if (validationError) {
222
130
  return {
223
- llmContent: [
224
- `Command rejected: ${params.command}`,
225
- `Reason: ${validationError}`,
226
- ].join('\n'),
227
- returnDisplay: `Error: ${validationError}`,
131
+ llmContent: validationError,
132
+ returnDisplay: validationError,
228
133
  };
229
134
  }
230
- if (abortSignal.aborted) {
135
+ if (signal.aborted) {
231
136
  return {
232
137
  llmContent: 'Command was cancelled by user before it could start.',
233
138
  returnDisplay: 'Command cancelled by user.',
@@ -238,198 +143,162 @@ Process Group PGID: Process group started or \`(none)\``, Icon.Terminal, {
238
143
  .randomBytes(6)
239
144
  .toString('hex')}.tmp`;
240
145
  const tempFilePath = path.join(os.tmpdir(), tempFileName);
241
- // pgrep is not available on Windows, so we can't get background PIDs
242
- const command = isWindows
243
- ? params.command
244
- : (() => {
245
- // wrap command to append subprocess pids (via pgrep) to temporary file
246
- let command = params.command.trim();
247
- if (!command.endsWith('&'))
248
- command += ';';
249
- return `{ ${command} }; __code=$?; pgrep -g 0 >${tempFilePath} 2>&1; exit $__code;`;
250
- })();
251
- // spawn command in specified directory (or project root if not specified)
252
- const shell = isWindows
253
- ? spawn('cmd.exe', ['/c', command], {
254
- stdio: ['ignore', 'pipe', 'pipe'],
255
- // detached: true, // ensure subprocess starts its own process group (esp. in Linux)
256
- cwd: path.resolve(this.config.getTargetDir(), params.directory || ''),
257
- })
258
- : spawn('bash', ['-c', command], {
259
- stdio: ['ignore', 'pipe', 'pipe'],
260
- detached: true, // ensure subprocess starts its own process group (esp. in Linux)
261
- cwd: path.resolve(this.config.getTargetDir(), params.directory || ''),
262
- });
263
- let exited = false;
264
- let stdout = '';
265
- let output = '';
266
- let lastUpdateTime = Date.now();
267
- const appendOutput = (str) => {
268
- output += str;
269
- if (updateOutput &&
270
- Date.now() - lastUpdateTime > OUTPUT_UPDATE_INTERVAL_MS) {
271
- updateOutput(output);
272
- lastUpdateTime = Date.now();
273
- }
274
- };
275
- shell.stdout.on('data', (data) => {
276
- // continue to consume post-exit for background processes
277
- // removing listeners can overflow OS buffer and block subprocesses
278
- // destroying (e.g. shell.stdout.destroy()) can terminate subprocesses via SIGPIPE
279
- if (!exited) {
280
- const str = stripAnsi(data.toString());
281
- stdout += str;
282
- appendOutput(str);
283
- }
284
- });
285
- let stderr = '';
286
- shell.stderr.on('data', (data) => {
287
- if (!exited) {
288
- const str = stripAnsi(data.toString());
289
- stderr += str;
290
- appendOutput(str);
291
- }
292
- });
293
- let error = null;
294
- shell.on('error', (err) => {
295
- error = err;
296
- // remove wrapper from user's command in error message
297
- error.message = error.message.replace(command, params.command);
298
- });
299
- let code = null;
300
- let processSignal = null;
301
- const exitHandler = (_code, _signal) => {
302
- exited = true;
303
- code = _code;
304
- processSignal = _signal;
305
- };
306
- shell.on('exit', exitHandler);
307
- const abortHandler = async () => {
308
- if (shell.pid && !exited) {
309
- if (os.platform() === 'win32') {
310
- // For Windows, use taskkill to kill the process tree
311
- spawn('taskkill', ['/pid', shell.pid.toString(), '/f', '/t']);
146
+ try {
147
+ // pgrep is not available on Windows, so we can't get background PIDs
148
+ const commandToExecute = isWindows
149
+ ? strippedCommand
150
+ : (() => {
151
+ // wrap command to append subprocess pids (via pgrep) to temporary file
152
+ let command = strippedCommand.trim();
153
+ if (!command.endsWith('&'))
154
+ command += ';';
155
+ return `{ ${command} }; __code=$?; pgrep -g 0 >${tempFilePath} 2>&1; exit $__code;`;
156
+ })();
157
+ const cwd = path.resolve(this.config.getTargetDir(), params.directory || '');
158
+ let cumulativeStdout = '';
159
+ let cumulativeStderr = '';
160
+ let lastUpdateTime = Date.now();
161
+ let isBinaryStream = false;
162
+ const { result: resultPromise } = ShellExecutionService.execute(commandToExecute, cwd, (event) => {
163
+ if (!updateOutput) {
164
+ return;
312
165
  }
313
- else {
314
- try {
315
- // attempt to SIGTERM process group (negative PID)
316
- // fall back to SIGKILL (to group) after 200ms
317
- process.kill(-shell.pid, 'SIGTERM');
318
- await new Promise((resolve) => setTimeout(resolve, 200));
319
- if (shell.pid && !exited) {
320
- process.kill(-shell.pid, 'SIGKILL');
166
+ let currentDisplayOutput = '';
167
+ let shouldUpdate = false;
168
+ switch (event.type) {
169
+ case 'data':
170
+ if (isBinaryStream)
171
+ break; // Don't process text if we are in binary mode
172
+ if (event.stream === 'stdout') {
173
+ cumulativeStdout += event.chunk;
321
174
  }
322
- }
323
- catch (_e) {
324
- // if group kill fails, fall back to killing just the main process
325
- try {
326
- if (shell.pid) {
327
- shell.kill('SIGKILL');
328
- }
175
+ else {
176
+ cumulativeStderr += event.chunk;
329
177
  }
330
- catch (_e) {
331
- console.error(`failed to kill shell process ${shell.pid}: ${_e}`);
178
+ currentDisplayOutput =
179
+ cumulativeStdout +
180
+ (cumulativeStderr ? `\n${cumulativeStderr}` : '');
181
+ if (Date.now() - lastUpdateTime > OUTPUT_UPDATE_INTERVAL_MS) {
182
+ shouldUpdate = true;
332
183
  }
184
+ break;
185
+ case 'binary_detected':
186
+ isBinaryStream = true;
187
+ currentDisplayOutput =
188
+ '[Binary output detected. Halting stream...]';
189
+ shouldUpdate = true;
190
+ break;
191
+ case 'binary_progress':
192
+ isBinaryStream = true;
193
+ currentDisplayOutput = `[Receiving binary output... ${formatMemoryUsage(event.bytesReceived)} received]`;
194
+ if (Date.now() - lastUpdateTime > OUTPUT_UPDATE_INTERVAL_MS) {
195
+ shouldUpdate = true;
196
+ }
197
+ break;
198
+ default: {
199
+ throw new Error('An unhandled ShellOutputEvent was found.');
333
200
  }
334
201
  }
335
- }
336
- };
337
- abortSignal.addEventListener('abort', abortHandler);
338
- // wait for the shell to exit
339
- try {
340
- await new Promise((resolve) => shell.on('exit', resolve));
341
- }
342
- finally {
343
- abortSignal.removeEventListener('abort', abortHandler);
344
- }
345
- // parse pids (pgrep output) from temporary file and remove it
346
- const backgroundPIDs = [];
347
- if (os.platform() !== 'win32') {
348
- if (fs.existsSync(tempFilePath)) {
349
- const pgrepLines = fs
350
- .readFileSync(tempFilePath, 'utf8')
351
- .split('\n')
352
- .filter(Boolean);
353
- for (const line of pgrepLines) {
354
- if (!/^\d+$/.test(line)) {
355
- console.error(`pgrep: ${line}`);
202
+ if (shouldUpdate) {
203
+ updateOutput(currentDisplayOutput);
204
+ lastUpdateTime = Date.now();
205
+ }
206
+ }, signal);
207
+ const result = await resultPromise;
208
+ const backgroundPIDs = [];
209
+ if (os.platform() !== 'win32') {
210
+ if (fs.existsSync(tempFilePath)) {
211
+ const pgrepLines = fs
212
+ .readFileSync(tempFilePath, 'utf8')
213
+ .split('\n')
214
+ .filter(Boolean);
215
+ for (const line of pgrepLines) {
216
+ if (!/^\d+$/.test(line)) {
217
+ console.error(`pgrep: ${line}`);
218
+ }
219
+ const pid = Number(line);
220
+ if (pid !== result.pid) {
221
+ backgroundPIDs.push(pid);
222
+ }
356
223
  }
357
- const pid = Number(line);
358
- // exclude the shell subprocess pid
359
- if (pid !== shell.pid) {
360
- backgroundPIDs.push(pid);
224
+ }
225
+ else {
226
+ if (!signal.aborted) {
227
+ console.error('missing pgrep output');
361
228
  }
362
229
  }
363
- fs.unlinkSync(tempFilePath);
364
230
  }
365
- else {
366
- if (!abortSignal.aborted) {
367
- console.error('missing pgrep output');
231
+ let llmContent = '';
232
+ if (result.aborted) {
233
+ llmContent = 'Command was cancelled by user before it could complete.';
234
+ if (result.output.trim()) {
235
+ llmContent += ` Below is the output (on stdout and stderr) before it was cancelled:\n${result.output}`;
236
+ }
237
+ else {
238
+ llmContent += ' There was no output before it was cancelled.';
368
239
  }
369
- }
370
- }
371
- let llmContent = '';
372
- if (abortSignal.aborted) {
373
- llmContent = 'Command was cancelled by user before it could complete.';
374
- if (output.trim()) {
375
- llmContent += ` Below is the output (on stdout and stderr) before it was cancelled:\n${output}`;
376
240
  }
377
241
  else {
378
- llmContent += ' There was no output before it was cancelled.';
242
+ // Create a formatted error string for display, replacing the wrapper command
243
+ // with the user-facing command.
244
+ const finalError = result.error
245
+ ? result.error.message.replace(commandToExecute, params.command)
246
+ : '(none)';
247
+ llmContent = [
248
+ `Command: ${params.command}`,
249
+ `Directory: ${params.directory || '(root)'}`,
250
+ `Stdout: ${result.stdout || '(empty)'}`,
251
+ `Stderr: ${result.stderr || '(empty)'}`,
252
+ `Error: ${finalError}`, // Use the cleaned error string.
253
+ `Exit Code: ${result.exitCode ?? '(none)'}`,
254
+ `Signal: ${result.signal ?? '(none)'}`,
255
+ `Background PIDs: ${backgroundPIDs.length ? backgroundPIDs.join(', ') : '(none)'}`,
256
+ `Process Group PGID: ${result.pid ?? '(none)'}`,
257
+ ].join('\n');
379
258
  }
380
- }
381
- else {
382
- llmContent = [
383
- `Command: ${params.command}`,
384
- `Directory: ${params.directory || '(root)'}`,
385
- `Stdout: ${stdout || '(empty)'}`,
386
- `Stderr: ${stderr || '(empty)'}`,
387
- `Error: ${error ?? '(none)'}`,
388
- `Exit Code: ${code ?? '(none)'}`,
389
- `Signal: ${processSignal ?? '(none)'}`,
390
- `Background PIDs: ${backgroundPIDs.length ? backgroundPIDs.join(', ') : '(none)'}`,
391
- `Process Group PGID: ${shell.pid ?? '(none)'}`,
392
- ].join('\n');
393
- }
394
- let returnDisplayMessage = '';
395
- if (this.config.getDebugMode()) {
396
- returnDisplayMessage = llmContent;
397
- }
398
- else {
399
- if (output.trim()) {
400
- returnDisplayMessage = output;
259
+ let returnDisplayMessage = '';
260
+ if (this.config.getDebugMode()) {
261
+ returnDisplayMessage = llmContent;
401
262
  }
402
263
  else {
403
- // Output is empty, let's provide a reason if the command failed or was cancelled
404
- if (abortSignal.aborted) {
405
- returnDisplayMessage = 'Command cancelled by user.';
264
+ if (result.output.trim()) {
265
+ returnDisplayMessage = result.output;
406
266
  }
407
- else if (processSignal) {
408
- returnDisplayMessage = `Command terminated by signal: ${processSignal}`;
409
- }
410
- else if (error) {
411
- // If error is not null, it's an Error object (or other truthy value)
412
- returnDisplayMessage = `Command failed: ${getErrorMessage(error)}`;
413
- }
414
- else if (code !== null && code !== 0) {
415
- returnDisplayMessage = `Command exited with code: ${code}`;
267
+ else {
268
+ if (result.aborted) {
269
+ returnDisplayMessage = 'Command cancelled by user.';
270
+ }
271
+ else if (result.signal) {
272
+ returnDisplayMessage = `Command terminated by signal: ${result.signal}`;
273
+ }
274
+ else if (result.error) {
275
+ returnDisplayMessage = `Command failed: ${getErrorMessage(result.error)}`;
276
+ }
277
+ else if (result.exitCode !== null && result.exitCode !== 0) {
278
+ returnDisplayMessage = `Command exited with code: ${result.exitCode}`;
279
+ }
280
+ // If output is empty and command succeeded (code 0, no error/signal/abort),
281
+ // returnDisplayMessage will remain empty, which is fine.
416
282
  }
417
- // If output is empty and command succeeded (code 0, no error/signal/abort),
418
- // returnDisplayMessage will remain empty, which is fine.
419
283
  }
420
- }
421
- const summarizeConfig = this.config.getSummarizeToolOutputConfig();
422
- if (summarizeConfig && summarizeConfig[this.name]) {
423
- const summary = await summarizeToolOutput(llmContent, this.config.getGeminiClient(), abortSignal, summarizeConfig[this.name].tokenBudget);
284
+ const summarizeConfig = this.config.getSummarizeToolOutputConfig();
285
+ if (summarizeConfig && summarizeConfig[this.name]) {
286
+ const summary = await summarizeToolOutput(llmContent, this.config.getGeminiClient(), signal, summarizeConfig[this.name].tokenBudget);
287
+ return {
288
+ llmContent: summary,
289
+ returnDisplay: returnDisplayMessage,
290
+ };
291
+ }
424
292
  return {
425
- llmContent: summary,
293
+ llmContent,
426
294
  returnDisplay: returnDisplayMessage,
427
295
  };
428
296
  }
429
- return {
430
- llmContent,
431
- returnDisplay: returnDisplayMessage,
432
- };
297
+ finally {
298
+ if (fs.existsSync(tempFilePath)) {
299
+ fs.unlinkSync(tempFilePath);
300
+ }
301
+ }
433
302
  }
434
303
  }
435
304
  //# sourceMappingURL=shell.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shell.js","sourceRoot":"","sources":["../../../src/tools/shell.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EACL,QAAQ,EAIR,uBAAuB,EACvB,IAAI,GACL,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,SAAS,MAAM,YAAY,CAAC;AAOnC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D,MAAM,yBAAyB,GAAG,IAAI,CAAC;AAEvC,MAAM,OAAO,SAAU,SAAQ,QAAqC;IAIrC;IAH7B,MAAM,CAAC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