@vybestack/llxprt-code-core 0.1.13 → 0.1.14

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 (218) hide show
  1. package/README.md +24 -0
  2. package/dist/src/code_assist/codeAssist.d.ts +2 -1
  3. package/dist/src/code_assist/codeAssist.js +4 -3
  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 +94 -2
  8. package/dist/src/code_assist/oauth2.test.js.map +1 -1
  9. package/dist/src/code_assist/server.d.ts +5 -6
  10. package/dist/src/code_assist/server.js +7 -70
  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 +25 -3
  19. package/dist/src/config/config.js +47 -10
  20. package/dist/src/config/config.js.map +1 -1
  21. package/dist/src/config/config.test.js +1 -26
  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 +6 -2
  26. package/dist/src/core/client.js +41 -18
  27. package/dist/src/core/client.js.map +1 -1
  28. package/dist/src/core/client.test.js +78 -24
  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/coreToolScheduler.js +14 -1
  34. package/dist/src/core/coreToolScheduler.js.map +1 -1
  35. package/dist/src/core/coreToolScheduler.test.js +80 -0
  36. package/dist/src/core/coreToolScheduler.test.js.map +1 -1
  37. package/dist/src/core/geminiChat.d.ts +4 -3
  38. package/dist/src/core/geminiChat.js +8 -11
  39. package/dist/src/core/geminiChat.js.map +1 -1
  40. package/dist/src/core/geminiRequest.js +2 -37
  41. package/dist/src/core/geminiRequest.js.map +1 -1
  42. package/dist/src/core/logger.js +6 -0
  43. package/dist/src/core/logger.js.map +1 -1
  44. package/dist/src/core/nonInteractiveToolExecutor.test.js +5 -5
  45. package/dist/src/core/prompts.js +42 -18
  46. package/dist/src/core/prompts.js.map +1 -1
  47. package/dist/src/core/prompts.test.js +121 -4
  48. package/dist/src/core/prompts.test.js.map +1 -1
  49. package/dist/src/core/turn.d.ts +7 -2
  50. package/dist/src/core/turn.js +9 -0
  51. package/dist/src/core/turn.js.map +1 -1
  52. package/dist/src/core/turn.test.js +129 -0
  53. package/dist/src/core/turn.test.js.map +1 -1
  54. package/dist/src/ide/ide-client.d.ts +28 -0
  55. package/dist/src/ide/ide-client.js +79 -0
  56. package/dist/src/ide/ide-client.js.map +1 -0
  57. package/dist/src/ide/ideContext.d.ts +174 -0
  58. package/dist/src/{services → ide}/ideContext.js +28 -25
  59. package/dist/src/ide/ideContext.js.map +1 -0
  60. package/dist/src/{services → ide}/ideContext.test.js +39 -39
  61. package/dist/src/ide/ideContext.test.js.map +1 -0
  62. package/dist/src/index.d.ts +3 -1
  63. package/dist/src/index.js +4 -1
  64. package/dist/src/index.js.map +1 -1
  65. package/dist/src/mcp/google-auth-provider.d.ts +23 -0
  66. package/dist/src/mcp/google-auth-provider.js +63 -0
  67. package/dist/src/mcp/google-auth-provider.js.map +1 -0
  68. package/dist/src/mcp/google-auth-provider.test.js +54 -0
  69. package/dist/src/mcp/google-auth-provider.test.js.map +1 -0
  70. package/dist/src/providers/anthropic/AnthropicProvider.js.map +1 -1
  71. package/dist/src/providers/gemini/GeminiProvider.d.ts +2 -0
  72. package/dist/src/providers/gemini/GeminiProvider.integration.test.js +36 -0
  73. package/dist/src/providers/gemini/GeminiProvider.integration.test.js.map +1 -1
  74. package/dist/src/providers/gemini/GeminiProvider.js +57 -10
  75. package/dist/src/providers/gemini/GeminiProvider.js.map +1 -1
  76. package/dist/src/providers/openai/OpenAIProvider.js +10 -7
  77. package/dist/src/providers/openai/OpenAIProvider.js.map +1 -1
  78. package/dist/src/services/fileDiscoveryService.d.ts +4 -4
  79. package/dist/src/services/fileDiscoveryService.js +8 -8
  80. package/dist/src/services/gitService.js +1 -1
  81. package/dist/src/services/gitService.js.map +1 -1
  82. package/dist/src/services/gitService.test.js +1 -1
  83. package/dist/src/services/gitService.test.js.map +1 -1
  84. package/dist/src/services/loopDetectionService.d.ts +48 -5
  85. package/dist/src/services/loopDetectionService.js +127 -41
  86. package/dist/src/services/loopDetectionService.js.map +1 -1
  87. package/dist/src/services/loopDetectionService.test.js +50 -123
  88. package/dist/src/services/loopDetectionService.test.js.map +1 -1
  89. package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +2 -1
  90. package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +17 -2
  91. package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -1
  92. package/dist/src/telemetry/constants.d.ts +16 -15
  93. package/dist/src/telemetry/constants.js +16 -15
  94. package/dist/src/telemetry/constants.js.map +1 -1
  95. package/dist/src/telemetry/file-exporters.d.ts +28 -0
  96. package/dist/src/telemetry/file-exporters.js +62 -0
  97. package/dist/src/telemetry/file-exporters.js.map +1 -0
  98. package/dist/src/telemetry/loggers.d.ts +2 -1
  99. package/dist/src/telemetry/loggers.js +18 -3
  100. package/dist/src/telemetry/loggers.js.map +1 -1
  101. package/dist/src/telemetry/sdk.js +22 -7
  102. package/dist/src/telemetry/sdk.js.map +1 -1
  103. package/dist/src/telemetry/types.d.ts +9 -2
  104. package/dist/src/telemetry/types.js +13 -1
  105. package/dist/src/telemetry/types.js.map +1 -1
  106. package/dist/src/tools/ToolFormatter.js +19 -1
  107. package/dist/src/tools/ToolFormatter.js.map +1 -1
  108. package/dist/src/tools/edit.js +10 -4
  109. package/dist/src/tools/edit.js.map +1 -1
  110. package/dist/src/tools/edit.test.js +12 -0
  111. package/dist/src/tools/edit.test.js.map +1 -1
  112. package/dist/src/tools/grep.test.js +1 -1
  113. package/dist/src/tools/grep.test.js.map +1 -1
  114. package/dist/src/tools/ls.d.ts +5 -2
  115. package/dist/src/tools/ls.js +39 -10
  116. package/dist/src/tools/ls.js.map +1 -1
  117. package/dist/src/tools/mcp-client.d.ts +5 -1
  118. package/dist/src/tools/mcp-client.js +416 -29
  119. package/dist/src/tools/mcp-client.js.map +1 -1
  120. package/dist/src/tools/mcp-client.test.js +46 -6
  121. package/dist/src/tools/mcp-client.test.js.map +1 -1
  122. package/dist/src/tools/mcp-tool.js +1 -1
  123. package/dist/src/tools/mcp-tool.js.map +1 -1
  124. package/dist/src/tools/mcp-tool.test.js +34 -0
  125. package/dist/src/tools/mcp-tool.test.js.map +1 -1
  126. package/dist/src/tools/read-file.js +1 -1
  127. package/dist/src/tools/read-file.test.js +98 -69
  128. package/dist/src/tools/read-file.test.js.map +1 -1
  129. package/dist/src/tools/read-many-files.d.ts +5 -2
  130. package/dist/src/tools/read-many-files.js +61 -16
  131. package/dist/src/tools/read-many-files.js.map +1 -1
  132. package/dist/src/tools/read-many-files.test.js +5 -2
  133. package/dist/src/tools/read-many-files.test.js.map +1 -1
  134. package/dist/src/tools/shell.d.ts +15 -26
  135. package/dist/src/tools/shell.js +137 -358
  136. package/dist/src/tools/shell.js.map +1 -1
  137. package/dist/src/tools/shell.test.js +73 -318
  138. package/dist/src/tools/shell.test.js.map +1 -1
  139. package/dist/src/tools/tool-registry.d.ts +13 -1
  140. package/dist/src/tools/tool-registry.js +45 -1
  141. package/dist/src/tools/tool-registry.js.map +1 -1
  142. package/dist/src/tools/tool-registry.test.js +3 -3
  143. package/dist/src/tools/tool-registry.test.js.map +1 -1
  144. package/dist/src/utils/bfsFileSearch.d.ts +2 -0
  145. package/dist/src/utils/bfsFileSearch.js +4 -1
  146. package/dist/src/utils/bfsFileSearch.js.map +1 -1
  147. package/dist/src/utils/bfsFileSearch.test.js +108 -105
  148. package/dist/src/utils/bfsFileSearch.test.js.map +1 -1
  149. package/dist/src/utils/editCorrector.js +4 -4
  150. package/dist/src/utils/editCorrector.js.map +1 -1
  151. package/dist/src/utils/editCorrector.test.js +1 -1
  152. package/dist/src/utils/editor.js +16 -10
  153. package/dist/src/utils/editor.js.map +1 -1
  154. package/dist/src/utils/editor.test.js +128 -28
  155. package/dist/src/utils/editor.test.js.map +1 -1
  156. package/dist/src/utils/errorReporting.d.ts +1 -1
  157. package/dist/src/utils/errorReporting.js +2 -2
  158. package/dist/src/utils/errorReporting.js.map +1 -1
  159. package/dist/src/utils/errorReporting.test.js +44 -38
  160. package/dist/src/utils/errorReporting.test.js.map +1 -1
  161. package/dist/src/utils/fileUtils.d.ts +4 -4
  162. package/dist/src/utils/fileUtils.js +31 -15
  163. package/dist/src/utils/fileUtils.js.map +1 -1
  164. package/dist/src/utils/fileUtils.test.js +37 -37
  165. package/dist/src/utils/fileUtils.test.js.map +1 -1
  166. package/dist/src/utils/getFolderStructure.d.ts +3 -2
  167. package/dist/src/utils/getFolderStructure.js +27 -28
  168. package/dist/src/utils/getFolderStructure.js.map +1 -1
  169. package/dist/src/utils/getFolderStructure.test.js +169 -185
  170. package/dist/src/utils/getFolderStructure.test.js.map +1 -1
  171. package/dist/src/utils/gitIgnoreParser.js +4 -7
  172. package/dist/src/utils/gitIgnoreParser.js.map +1 -1
  173. package/dist/src/utils/gitIgnoreParser.test.js +71 -62
  174. package/dist/src/utils/gitIgnoreParser.test.js.map +1 -1
  175. package/dist/src/utils/memoryDiscovery.d.ts +2 -1
  176. package/dist/src/utils/memoryDiscovery.js +11 -5
  177. package/dist/src/utils/memoryDiscovery.js.map +1 -1
  178. package/dist/src/utils/memoryDiscovery.test.js +160 -371
  179. package/dist/src/utils/memoryDiscovery.test.js.map +1 -1
  180. package/dist/src/utils/partUtils.d.ts +14 -0
  181. package/dist/src/utils/partUtils.js +65 -0
  182. package/dist/src/utils/partUtils.js.map +1 -0
  183. package/dist/src/utils/partUtils.test.d.ts +6 -0
  184. package/dist/src/utils/partUtils.test.js +130 -0
  185. package/dist/src/utils/partUtils.test.js.map +1 -0
  186. package/dist/src/utils/paths.d.ts +11 -0
  187. package/dist/src/utils/paths.js +17 -1
  188. package/dist/src/utils/paths.js.map +1 -1
  189. package/dist/src/utils/quotaErrorDetection.js.map +1 -1
  190. package/dist/src/utils/retry.js +1 -1
  191. package/dist/src/utils/retry.js.map +1 -1
  192. package/dist/src/utils/schemaValidator.js +5 -2
  193. package/dist/src/utils/schemaValidator.js.map +1 -1
  194. package/dist/src/utils/shell-utils.d.ts +44 -0
  195. package/dist/src/utils/shell-utils.js +243 -0
  196. package/dist/src/utils/shell-utils.js.map +1 -0
  197. package/dist/src/utils/shell-utils.test.d.ts +6 -0
  198. package/dist/src/utils/shell-utils.test.js +450 -0
  199. package/dist/src/utils/shell-utils.test.js.map +1 -0
  200. package/dist/src/utils/summarizer.js +1 -30
  201. package/dist/src/utils/summarizer.js.map +1 -1
  202. package/dist/src/utils/systemEncoding.d.ts +40 -0
  203. package/dist/src/utils/systemEncoding.js +149 -0
  204. package/dist/src/utils/systemEncoding.js.map +1 -0
  205. package/dist/src/utils/systemEncoding.test.d.ts +6 -0
  206. package/dist/src/utils/systemEncoding.test.js +368 -0
  207. package/dist/src/utils/systemEncoding.test.js.map +1 -0
  208. package/dist/src/utils/user_account.test.js +1 -1
  209. package/dist/src/utils/user_account.test.js.map +1 -1
  210. package/dist/tsconfig.tsbuildinfo +1 -1
  211. package/package.json +4 -1
  212. package/dist/src/core/geminiRequest.test.js +0 -72
  213. package/dist/src/core/geminiRequest.test.js.map +0 -1
  214. package/dist/src/services/ideContext.d.ts +0 -126
  215. package/dist/src/services/ideContext.js.map +0 -1
  216. package/dist/src/services/ideContext.test.js.map +0 -1
  217. /package/dist/src/{services → ide}/ideContext.test.d.ts +0 -0
  218. /package/dist/src/{core/geminiRequest.test.d.ts → mcp/google-auth-provider.test.d.ts} +0 -0
@@ -7,166 +7,48 @@ import fs from 'fs';
7
7
  import path from 'path';
8
8
  import os from 'os';
9
9
  import crypto from 'crypto';
10
- import { BaseTool, ToolConfirmationOutcome, Icon, } from './tools.js';
10
+ import { BaseTool, Icon, } from './tools.js';
11
11
  import { SchemaValidator } from '../utils/schemaValidator.js';
12
12
  import { getErrorMessage } from '../utils/errors.js';
13
13
  import { Type } from '@google/genai';
14
14
  import stripAnsi from 'strip-ansi';
15
- import { spawn } from 'child_process';
15
+ import { getCommandRoots, isCommandAllowed, stripShellWrapper, } from '../utils/shell-utils.js';
16
16
  import { summarizeToolOutput } from '../utils/summarizer.js';
17
- const OUTPUT_UPDATE_INTERVAL_MS = 1000;
18
17
  export class ShellTool extends BaseTool {
19
18
  config;
20
- static Name = 'run_shell_command';
21
- whitelist = new Set();
19
+ static Name = 'shell_tool';
22
20
  constructor(config) {
23
- 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
- The following information is returned:
26
-
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, {
36
- type: Type.OBJECT,
21
+ super(ShellTool.Name, 'RunShellCommand', 'Execute a shell command within a secure sandboxed environment', Icon.Terminal, {
37
22
  properties: {
38
23
  command: {
24
+ description: 'The shell command to execute',
39
25
  type: Type.STRING,
40
- description: 'Exact bash command to execute as `bash -c <command>`',
41
26
  },
42
27
  description: {
28
+ description: 'Optional description of what this command does, used for confirmation prompts',
43
29
  type: Type.STRING,
44
- description: 'Brief description of the command for the user. Be specific and concise. Ideally a single sentence. Can be up to 3 sentences for clarity. No line breaks.',
45
- },
46
- directory: {
47
- type: Type.STRING,
48
- description: '(OPTIONAL) Directory to run the command in, if not the project root directory. Must be relative to the project root directory and must already exist.',
49
30
  },
50
31
  },
51
32
  required: ['command'],
52
- }, false, // output is not markdown
53
- true);
33
+ type: Type.OBJECT,
34
+ }, true);
54
35
  this.config = config;
55
36
  }
56
- getDescription(params) {
37
+ /**
38
+ * Gets a user-friendly description of the shell command to execute.
39
+ *
40
+ * @param params The shell tool parameters
41
+ * @returns A formatted description of the command
42
+ */
43
+ formatCommand(params) {
57
44
  let description = `${params.command}`;
58
- // append optional [in directory]
59
- // note description is needed even if validation fails due to absolute path
60
- if (params.directory) {
61
- description += ` [in ${params.directory}]`;
62
- }
63
- // append optional (description), replacing any line breaks with spaces
64
45
  if (params.description) {
65
46
  description += ` (${params.description.replace(/\n/g, ' ')})`;
66
47
  }
67
48
  return description;
68
49
  }
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('$(') || command.includes('`')) {
96
- return {
97
- allowed: false,
98
- reason: 'Command substitution using $() or backticks 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
50
  validateToolParams(params) {
169
- const commandCheck = this.isCommandAllowed(params.command);
51
+ const commandCheck = isCommandAllowed(params.command, this.config);
170
52
  if (!commandCheck.allowed) {
171
53
  if (!commandCheck.reason) {
172
54
  console.error('Unexpected: isCommandAllowed returned false without a reason');
@@ -181,255 +63,152 @@ Process Group PGID: Process group started or \`(none)\``, Icon.Terminal, {
181
63
  if (!params.command.trim()) {
182
64
  return 'Command cannot be empty.';
183
65
  }
184
- if (!this.getCommandRoot(params.command)) {
185
- return 'Could not identify command root to obtain permission from user.';
186
- }
187
- if (params.directory) {
188
- if (path.isAbsolute(params.directory)) {
189
- return 'Directory cannot be absolute. Must be relative to the project root directory.';
190
- }
191
- const directory = path.resolve(this.config.getTargetDir(), params.directory);
192
- if (!fs.existsSync(directory)) {
193
- return 'Directory must exist.';
194
- }
195
- }
196
66
  return null;
197
67
  }
198
- async shouldConfirmExecute(params, _abortSignal) {
199
- if (this.validateToolParams(params)) {
200
- return false; // skip confirmation, execute call will fail immediately
201
- }
202
- const rootCommand = this.getCommandRoot(params.command); // must be non-empty string post-validation
203
- if (this.whitelist.has(rootCommand)) {
204
- return false; // already approved and whitelisted
205
- }
206
- const confirmationDetails = {
68
+ async shouldConfirmExecute(params) {
69
+ const commandRoots = getCommandRoots(params.command);
70
+ const uniqueRoots = [...new Set(commandRoots)];
71
+ const rootCommand = uniqueRoots.length === 1 ? uniqueRoots[0] : uniqueRoots.join(', ');
72
+ return {
207
73
  type: 'exec',
208
- title: 'Confirm Shell Command',
209
- command: params.command,
74
+ title: `Execute shell command`,
75
+ command: this.formatCommand(params),
210
76
  rootCommand,
211
- onConfirm: async (outcome) => {
212
- if (outcome === ToolConfirmationOutcome.ProceedAlways) {
213
- this.whitelist.add(rootCommand);
214
- }
77
+ onConfirm: async () => {
78
+ // This will be handled by the calling code
215
79
  },
216
80
  };
217
- return confirmationDetails;
218
81
  }
219
- async execute(params, abortSignal, updateOutput) {
220
- const validationError = this.validateToolParams(params);
221
- if (validationError) {
222
- return {
223
- llmContent: [
224
- `Command rejected: ${params.command}`,
225
- `Reason: ${validationError}`,
226
- ].join('\n'),
227
- returnDisplay: `Error: ${validationError}`,
228
- };
229
- }
230
- if (abortSignal.aborted) {
231
- return {
232
- llmContent: 'Command was cancelled by user before it could start.',
233
- returnDisplay: 'Command cancelled by user.',
234
- };
235
- }
236
- const isWindows = os.platform() === 'win32';
237
- const tempFileName = `shell_pgrep_${crypto
238
- .randomBytes(6)
239
- .toString('hex')}.tmp`;
240
- 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']);
82
+ async execute(params, signal) {
83
+ try {
84
+ const isWindows = os.platform() === 'win32';
85
+ const shell = isWindows ? 'cmd.exe' : 'bash';
86
+ const shellArgs = isWindows
87
+ ? ['/c', params.command]
88
+ : ['-c', params.command];
89
+ const { execaCommandSync } = await import('execa');
90
+ let cleanedCommand = stripShellWrapper(params.command);
91
+ if (!isWindows) {
92
+ // On non-windows, wrap the command to capture the final working directory.
93
+ const pwdFileName = `shell_pwd_${crypto.randomBytes(6).toString('hex')}.tmp`;
94
+ const pwdFilePath = path.join(os.tmpdir(), pwdFileName);
95
+ // Ensure command ends with a separator before adding our own.
96
+ cleanedCommand = cleanedCommand.trim();
97
+ if (!cleanedCommand.endsWith(';') && !cleanedCommand.endsWith('&')) {
98
+ cleanedCommand += ';';
312
99
  }
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');
321
- }
322
- }
323
- catch (_e) {
324
- // if group kill fails, fall back to killing just the main process
100
+ cleanedCommand = `{ ${cleanedCommand} }; __code=$?; pwd > "${pwdFilePath}"; exit $__code`;
101
+ try {
102
+ const result = execaCommandSync(`${shell} ${shellArgs.map((arg) => `'${arg}'`).join(' ')} '${cleanedCommand}'`, {
103
+ cwd: this.config.getTargetDir(),
104
+ env: {
105
+ ...process.env,
106
+ GEMINI_CLI: '1',
107
+ },
108
+ timeout: 1000 * 60 * 15, // 15 minutes
109
+ all: true,
110
+ shell: false,
111
+ });
112
+ // Read the captured PWD
113
+ let finalPwd = this.config.getTargetDir();
114
+ if (fs.existsSync(pwdFilePath)) {
325
115
  try {
326
- if (shell.pid) {
327
- shell.kill('SIGKILL');
328
- }
116
+ finalPwd = fs.readFileSync(pwdFilePath, 'utf8').trim();
117
+ }
118
+ catch (readError) {
119
+ console.debug('Failed to read PWD file:', readError);
329
120
  }
330
- catch (_e) {
331
- console.error(`failed to kill shell process ${shell.pid}: ${_e}`);
121
+ finally {
122
+ // Clean up the temporary file
123
+ try {
124
+ fs.unlinkSync(pwdFilePath);
125
+ }
126
+ catch (unlinkError) {
127
+ console.debug('Failed to unlink PWD file:', unlinkError);
128
+ }
332
129
  }
333
130
  }
334
- }
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}`);
131
+ const allOutput = stripAnsi(result.all || '');
132
+ let response = allOutput;
133
+ // Add warning if directory changed
134
+ if (finalPwd !== this.config.getTargetDir()) {
135
+ response = `WARNING: shell mode is stateless; the directory change to '${finalPwd}' will not persist.\n\n${response}`;
136
+ }
137
+ // Check if summarization is enabled for this tool
138
+ const summarizerConfig = this.config.getSummarizeToolOutputConfig();
139
+ const toolSummarizeConfig = summarizerConfig
140
+ ? summarizerConfig[this.name]
141
+ : undefined;
142
+ let llmContent = response;
143
+ if (toolSummarizeConfig) {
144
+ const tokenBudget = toolSummarizeConfig.tokenBudget;
145
+ llmContent = await summarizeToolOutput(response, this.config.getGeminiClient(), signal, tokenBudget);
356
146
  }
357
- const pid = Number(line);
358
- // exclude the shell subprocess pid
359
- if (pid !== shell.pid) {
360
- backgroundPIDs.push(pid);
147
+ return {
148
+ summary: `Executed command: ${params.command}`,
149
+ returnDisplay: response,
150
+ llmContent,
151
+ };
152
+ }
153
+ catch (error) {
154
+ // Clean up PWD file on error
155
+ if (fs.existsSync(pwdFilePath)) {
156
+ try {
157
+ fs.unlinkSync(pwdFilePath);
158
+ }
159
+ catch (unlinkError) {
160
+ console.debug('Failed to unlink PWD file:', unlinkError);
161
+ }
361
162
  }
163
+ throw error; // Re-throw to be caught by outer try-catch
362
164
  }
363
- fs.unlinkSync(tempFilePath);
364
165
  }
365
166
  else {
366
- if (!abortSignal.aborted) {
367
- console.error('missing pgrep output');
167
+ // Windows path
168
+ const result = execaCommandSync(`${shell} ${shellArgs.map((arg) => `"${arg}"`).join(' ')} "${cleanedCommand}"`, {
169
+ cwd: this.config.getTargetDir(),
170
+ env: {
171
+ ...process.env,
172
+ GEMINI_CLI: '1',
173
+ },
174
+ timeout: 1000 * 60 * 15, // 15 minutes
175
+ all: true,
176
+ shell: false,
177
+ });
178
+ const allOutput = stripAnsi(result.all || '');
179
+ // Check if summarization is enabled for this tool
180
+ const summarizerConfig = this.config.getSummarizeToolOutputConfig();
181
+ const toolSummarizeConfig = summarizerConfig
182
+ ? summarizerConfig[this.name]
183
+ : undefined;
184
+ let llmContent = allOutput;
185
+ if (toolSummarizeConfig) {
186
+ const tokenBudget = toolSummarizeConfig.tokenBudget;
187
+ llmContent = await summarizeToolOutput(allOutput, this.config.getGeminiClient(), signal, tokenBudget);
368
188
  }
189
+ return {
190
+ summary: `Executed command: ${params.command}`,
191
+ returnDisplay: allOutput,
192
+ llmContent,
193
+ };
369
194
  }
370
195
  }
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
- }
377
- else {
378
- llmContent += ' There was no output before it was cancelled.';
379
- }
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;
401
- }
402
- 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.';
406
- }
407
- else if (processSignal) {
408
- returnDisplayMessage = `Command terminated by signal: ${processSignal}`;
196
+ catch (error) {
197
+ let errorMessage = getErrorMessage(error);
198
+ // Check if error has execa-specific properties
199
+ if (error && typeof error === 'object' && 'all' in error) {
200
+ const execaError = error;
201
+ if (execaError.all) {
202
+ const allOutput = stripAnsi(execaError.all);
203
+ errorMessage += `\nOutput:\n${allOutput}`;
409
204
  }
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}`;
416
- }
417
- // If output is empty and command succeeded (code 0, no error/signal/abort),
418
- // returnDisplayMessage will remain empty, which is fine.
419
205
  }
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);
424
206
  return {
425
- llmContent: summary,
426
- returnDisplay: returnDisplayMessage,
207
+ summary: `Command failed: ${params.command}`,
208
+ llmContent: errorMessage,
209
+ returnDisplay: errorMessage,
427
210
  };
428
211
  }
429
- return {
430
- llmContent,
431
- returnDisplay: returnDisplayMessage,
432
- };
433
212
  }
434
213
  }
435
214
  //# sourceMappingURL=shell.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shell.js","sourceRoot":"","sources":["../../../src/tools/shell.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA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