fix: initialize bash warnings before use

This commit is contained in:
Peter Steinberger
2026-01-07 23:26:26 +01:00
parent fd87290f6f
commit 48a333d9d5

View File

@@ -156,6 +156,10 @@ export function createBashTool(
throw new Error("Provide a command to start."); throw new Error("Provide a command to start.");
} }
const maxOutput = DEFAULT_MAX_OUTPUT;
const startedAt = Date.now();
const sessionId = randomUUID();
const warnings: string[] = [];
const backgroundRequested = params.background === true; const backgroundRequested = params.background === true;
const yieldRequested = typeof params.yieldMs === "number"; const yieldRequested = typeof params.yieldMs === "number";
if (!allowBackground && (backgroundRequested || yieldRequested)) { if (!allowBackground && (backgroundRequested || yieldRequested)) {
@@ -173,10 +177,6 @@ export function createBashTool(
120_000, 120_000,
) )
: null; : null;
const maxOutput = DEFAULT_MAX_OUTPUT;
const startedAt = Date.now();
const sessionId = randomUUID();
const warnings: string[] = [];
const elevatedDefaults = defaults?.elevated; const elevatedDefaults = defaults?.elevated;
const elevatedDefaultOn = const elevatedDefaultOn =
elevatedDefaults?.defaultLevel === "on" && elevatedDefaults?.defaultLevel === "on" &&