fix: rename bash tool to exec (#748) (thanks @myfunc)

This commit is contained in:
Peter Steinberger
2026-01-12 02:49:55 +00:00
parent b33bd6aaeb
commit 98337a14b3
51 changed files with 294 additions and 252 deletions
+13 -13
View File
@@ -1,9 +1,9 @@
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { resetProcessRegistryForTests } from "./bash-process-registry.js";
import {
bashTool,
createBashTool,
createExecTool,
createProcessTool,
execTool,
processTool,
} from "./bash-tools.js";
import { sanitizeBinaryOutput } from "./shell-utils.js";
@@ -50,7 +50,7 @@ beforeEach(() => {
resetProcessRegistryForTests();
});
describe("bash tool backgrounding", () => {
describe("exec tool backgrounding", () => {
const originalShell = process.env.SHELL;
beforeEach(() => {
@@ -64,7 +64,7 @@ describe("bash tool backgrounding", () => {
it(
"backgrounds after yield and can be polled",
async () => {
const result = await bashTool.execute("call1", {
const result = await execTool.execute("call1", {
command: joinCommands([yieldDelayCmd, "echo done"]),
yieldMs: 10,
});
@@ -97,7 +97,7 @@ describe("bash tool backgrounding", () => {
);
it("supports explicit background", async () => {
const result = await bashTool.execute("call1", {
const result = await execTool.execute("call1", {
command: echoAfterDelay("later"),
background: true,
});
@@ -113,7 +113,7 @@ describe("bash tool backgrounding", () => {
});
it("derives a session name from the command", async () => {
const result = await bashTool.execute("call1", {
const result = await execTool.execute("call1", {
command: "echo hello",
background: true,
});
@@ -129,7 +129,7 @@ describe("bash tool backgrounding", () => {
});
it("uses default timeout when timeout is omitted", async () => {
const customBash = createBashTool({ timeoutSec: 1, backgroundMs: 10 });
const customBash = createExecTool({ timeoutSec: 1, backgroundMs: 10 });
const customProcess = createProcessTool();
const result = await customBash.execute("call1", {
@@ -156,7 +156,7 @@ describe("bash tool backgrounding", () => {
});
it("rejects elevated requests when not allowed", async () => {
const customBash = createBashTool({
const customBash = createExecTool({
elevated: { enabled: true, allowed: false, defaultLevel: "off" },
});
@@ -169,7 +169,7 @@ describe("bash tool backgrounding", () => {
});
it("does not default to elevated when not allowed", async () => {
const customBash = createBashTool({
const customBash = createExecTool({
elevated: { enabled: true, allowed: false, defaultLevel: "on" },
backgroundMs: 1000,
timeoutSec: 5,
@@ -183,7 +183,7 @@ describe("bash tool backgrounding", () => {
});
it("logs line-based slices and defaults to last lines", async () => {
const result = await bashTool.execute("call1", {
const result = await execTool.execute("call1", {
command: echoLines(["one", "two", "three"]),
background: true,
});
@@ -203,7 +203,7 @@ describe("bash tool backgrounding", () => {
});
it("supports line offsets for log slices", async () => {
const result = await bashTool.execute("call1", {
const result = await execTool.execute("call1", {
command: echoLines(["alpha", "beta", "gamma"]),
background: true,
});
@@ -221,9 +221,9 @@ describe("bash tool backgrounding", () => {
});
it("scopes process sessions by scopeKey", async () => {
const bashA = createBashTool({ backgroundMs: 10, scopeKey: "agent:alpha" });
const bashA = createExecTool({ backgroundMs: 10, scopeKey: "agent:alpha" });
const processA = createProcessTool({ scopeKey: "agent:alpha" });
const bashB = createBashTool({ backgroundMs: 10, scopeKey: "agent:beta" });
const bashB = createExecTool({ backgroundMs: 10, scopeKey: "agent:beta" });
const processB = createProcessTool({ scopeKey: "agent:beta" });
const resultA = await bashA.execute("call1", {