Revert "Make --allowed-tools work in non-interactive mode" (#10006)

This commit is contained in:
Gal Zahavi
2025-09-26 16:22:02 -07:00
committed by GitHub
parent 2aa2ab878b
commit 24c15b9d43
9 changed files with 7 additions and 388 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ import { quote } from 'shell-quote';
import { doesToolInvocationMatch } from './tool-utils.js';
import { spawn, type SpawnOptionsWithoutStdio } from 'node:child_process';
export const SHELL_TOOL_NAMES = ['run_shell_command', 'ShellTool'];
const SHELL_TOOL_NAMES = ['run_shell_command', 'ShellTool'];
/**
* An identifier for the shell type.
@@ -36,15 +36,6 @@ describe('doesToolInvocationMatch', () => {
expect(result).toBe(true);
});
it('should match a command with an alias', () => {
const invocation = {
params: { command: 'wc -l' },
} as AnyToolInvocation;
const patterns = ['ShellTool(wc)'];
const result = doesToolInvocationMatch('ShellTool', invocation, patterns);
expect(result).toBe(true);
});
it('should match a command that is a prefix', () => {
const invocation = {
params: { command: 'git status -v' },
+3 -2
View File
@@ -6,7 +6,8 @@
import type { AnyDeclarativeTool, AnyToolInvocation } from '../index.js';
import { isTool } from '../index.js';
import { SHELL_TOOL_NAMES } from './shell-utils.js';
const SHELL_TOOL_NAMES = ['run_shell_command', 'ShellTool'];
/**
* Checks if a tool invocation matches any of a list of patterns.
@@ -60,7 +61,7 @@ export function doesToolInvocationMatch(
if (
'command' in invocation.params &&
toolNames.some((name) => SHELL_TOOL_NAMES.includes(name))
toolNames.includes('run_shell_command')
) {
const argValue = String(
(invocation.params as { command: string }).command,