feat: Set a default env obj for calling shell tool (#45)

* feat: Set a default env obj for calling shell tool

* cr
This commit is contained in:
Brace Sproul 2025-05-28 18:23:51 -07:00 • committed by GitHub
parent 81fa410f03
commit e133e06e3c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,6 +11,11 @@ const logger = createLogger(LogLevel.INFO, "ShellTool");
const DEFAULT_COMMAND_TIMEOUT = 60_000; // 1 minute
const DEFAULT_ENV = {
// Prevents corepack from showing a y/n download prompt which causes the command to hang
COREPACK_ENABLE_DOWNLOAD_PROMPT: "0",
};
const shellToolSchema = z.object({
command: z.array(z.string()).describe("The command to run"),
workdir: z
@ -48,6 +53,7 @@ export const shellTool = tool(
const result = await sandbox.commands.run(command.join(" "), {
timeoutMs: timeout ?? DEFAULT_COMMAND_TIMEOUT,
cwd: workdir,
envs: DEFAULT_ENV,
});
if (result.error) {