mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-10-04 14:52:12 +00:00
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:
parent
81fa410f03
commit
e133e06e3c
1 changed files with 6 additions and 0 deletions
|
|
@ -11,6 +11,11 @@ const logger = createLogger(LogLevel.INFO, "ShellTool");
|
||||||
|
|
||||||
const DEFAULT_COMMAND_TIMEOUT = 60_000; // 1 minute
|
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({
|
const shellToolSchema = z.object({
|
||||||
command: z.array(z.string()).describe("The command to run"),
|
command: z.array(z.string()).describe("The command to run"),
|
||||||
workdir: z
|
workdir: z
|
||||||
|
|
@ -48,6 +53,7 @@ export const shellTool = tool(
|
||||||
const result = await sandbox.commands.run(command.join(" "), {
|
const result = await sandbox.commands.run(command.join(" "), {
|
||||||
timeoutMs: timeout ?? DEFAULT_COMMAND_TIMEOUT,
|
timeoutMs: timeout ?? DEFAULT_COMMAND_TIMEOUT,
|
||||||
cwd: workdir,
|
cwd: workdir,
|
||||||
|
envs: DEFAULT_ENV,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result.error) {
|
if (result.error) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue