refactor(core): remove shell description input (#32823)

This commit is contained in:
Aiden Cline 2026-06-22 21:18:06 -05:00 committed by GitHub
commit d29f5eba92
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 124 additions and 161 deletions

View file

@ -266,7 +266,7 @@ export function shellOutputSnapshot(state: { readonly metadata?: unknown }) {
// For shell tools, surface the actual command as the title so it stays visible
// before output lands; non-shell tools keep their model-provided title.
function toolTitle(toolName: string, input: ToolInput, fallback: string | undefined) {
if (isShell(toolName)) return shellCommand(input) ?? stringValue(input.description) ?? fallback ?? toolName
if (isShell(toolName)) return shellCommand(input) ?? fallback ?? toolName
return fallback || toolName
}

View file

@ -623,20 +623,18 @@ function snapQuestion(p: ToolProps<typeof QuestionTool>): ToolSnapshot {
function scrollBashStart(p: ToolProps<typeof BashTool>): string {
const cmd = p.input.command ?? ""
const desc = p.input.description || "Shell"
const wd = p.input.workdir ?? ""
const dir = wd && wd !== "." ? toolPath(wd) : ""
if (cmd && desc === "Shell" && !dir) {
const formatted = wd && wd !== "." ? toolPath(wd) : ""
const dir = formatted === "." ? "" : formatted
if (cmd && !dir) {
return `$ ${cmd}`
}
const title = dir && !desc.includes(dir) ? `${desc} in ${dir}` : desc
if (!cmd) {
return `# ${title}`
return dir ? `# Running in ${dir}` : ""
}
return `# ${title}\n$ ${cmd}`
return `# Running in ${dir}\n$ ${cmd}`
}
function scrollBashProgress(p: ToolProps<typeof BashTool>): string {
@ -968,11 +966,10 @@ function permList(p: ToolPermissionProps): ToolPermissionInfo {
}
function permBash(p: ToolPermissionProps<typeof BashTool>): ToolPermissionInfo {
const title = p.input.description || "Shell command"
const cmd = p.input.command || ""
return {
icon: "#",
title,
title: "Shell command",
lines: cmd ? [`$ ${cmd}`] : p.patterns.map((item) => `- ${item}`),
}
}

View file

@ -542,7 +542,7 @@ export const layer = Layer.effect(
time: { ...part.state.time, end: completed },
input: part.state.input,
title: "",
metadata: { output, description: "" },
metadata: { output },
output,
}
yield* sessions.updatePart(part)
@ -569,7 +569,7 @@ export const layer = Layer.effect(
Effect.gen(function* () {
output += chunk
if (part.state.status === "running") {
part.state.metadata = { output, description: "" }
part.state.metadata = { output }
yield* sessions.updatePart(part)
}
}),

View file

@ -263,7 +263,7 @@ const parse = Effect.fn("ShellTool.parse")(function* (command: string, ps: boole
const ask = Effect.fn("ShellTool.ask")(function* (
ctx: Tool.Context,
scan: Scan,
input: { command: string; description: string },
input: { command: string },
) {
if (scan.dirs.size > 0) {
const directories = Array.from(scan.dirs)
@ -277,7 +277,6 @@ const ask = Effect.fn("ShellTool.ask")(function* (
always: globs,
metadata: {
command: input.command,
description: input.description,
directories,
patterns: globs,
},
@ -291,7 +290,6 @@ const ask = Effect.fn("ShellTool.ask")(function* (
always: Array.from(scan.always),
metadata: {
command: input.command,
description: input.description,
},
})
})
@ -438,7 +436,6 @@ export const ShellTool = Tool.define(
cwd: string
env: NodeJS.ProcessEnv
timeout: number
description: string
},
ctx: Tool.Context,
) {
@ -482,7 +479,6 @@ export const ShellTool = Tool.define(
yield* ctx.metadata({
metadata: {
output: "",
description: input.description,
},
})
@ -523,7 +519,6 @@ export const ShellTool = Tool.define(
ctx.metadata({
metadata: {
output: last,
description: input.description,
},
}),
),
@ -534,7 +529,6 @@ export const ShellTool = Tool.define(
return ctx.metadata({
metadata: {
output: last,
description: input.description,
},
})
}),
@ -593,11 +587,10 @@ export const ShellTool = Tool.define(
output += "\n\n<shell_metadata>\n" + meta.join("\n") + "\n</shell_metadata>"
}
return {
title: input.description,
title: input.command,
metadata: {
output: last || preview(output),
exit: code,
description: input.description,
truncated: cut,
...(cut && file ? { outputPath: file } : {}),
},
@ -646,7 +639,6 @@ export const ShellTool = Tool.define(
cwd,
env: yield* shellEnv(ctx, cwd),
timeout,
description: params.description,
},
ctx,
)

View file

@ -7,30 +7,22 @@ import { ShellID } from "./id"
const PS = new Set(["powershell", "pwsh"])
const CMD = new Set(["cmd"])
const descriptions = {
bash: "Clear, concise description of what this command does in 5-10 words. Examples:\nInput: ls\nOutput: Lists files in current directory\n\nInput: git status\nOutput: Shows working tree status\n\nInput: npm install\nOutput: Installs package dependencies\n\nInput: mkdir foo\nOutput: Creates directory 'foo'",
powershell:
'Clear, concise description of what this command does in 5-10 words. Examples:\nInput: Get-ChildItem -LiteralPath "."\nOutput: Lists current directory\n\nInput: git status\nOutput: Shows working tree status\n\nInput: npm install\nOutput: Installs package dependencies\n\nInput: New-Item -ItemType Directory -Path "tmp"\nOutput: Creates directory tmp',
cmd: 'Clear, concise description of what this command does in 5-10 words. Examples:\nInput: dir\nOutput: Lists current directory\n\nInput: if exist "package.json" type "package.json"\nOutput: Prints package.json when it exists\n\nInput: mkdir tmp\nOutput: Creates directory tmp',
}
export type Limits = {
maxLines: number
maxBytes: number
}
export function parameterSchema(description: string) {
export function parameterSchema() {
return Schema.Struct({
command: Schema.String.annotate({ description: "The command to execute" }),
timeout: Schema.optional(PositiveInt).annotate({ description: "Optional timeout in milliseconds" }),
workdir: Schema.optional(Schema.String).annotate({
description: `The working directory to run the command in. Defaults to the current directory. Use this instead of 'cd' commands.`,
}),
description: Schema.String.annotate({ description }),
})
}
export const Parameters = parameterSchema(descriptions.bash)
export const Parameters = parameterSchema()
export type Parameters = Schema.Schema.Type<typeof Parameters>
function renderPrompt(template: string, values: Record<string, string>) {
@ -103,7 +95,6 @@ function bashCommandSection(chain: string, limits: Limits, defaultTimeoutMs: num
Usage notes:
- The command argument is required.
- You can specify an optional timeout in milliseconds. If not specified, commands will time out after ${defaultTimeoutMs}ms.
- It is very helpful if you write a clear, concise description of what this command does in 5-10 words.
- If the output exceeds ${limits.maxLines} lines or ${limits.maxBytes} bytes, it will be truncated and the full output will be written to a file. You can use Read with offset/limit to read specific sections or Grep to search the full content. Do NOT use \`head\`, \`tail\`, or other truncation commands to limit output; the full output will already be captured to a file for more precise searching.
- Avoid using Bash with the \`find\`, \`grep\`, \`cat\`, \`head\`, \`tail\`, \`sed\`, \`awk\`, or \`echo\` commands, unless explicitly instructed or when these commands are truly necessary for the task. Instead, always prefer using the dedicated tools for these commands:
@ -155,7 +146,6 @@ Before executing the command, please follow these steps:
Usage notes:
- The command argument is required.
- You can specify an optional timeout in milliseconds. If not specified, commands will time out after ${defaultTimeoutMs}ms.
- It is very helpful if you write a clear, concise description of what this command does in 5-10 words.
- If the output exceeds ${limits.maxLines} lines or ${limits.maxBytes} bytes, it will be truncated and the full output will be written to a file. You can use Read with offset/limit to read specific sections or Grep to search the full content. Do NOT use \`Select-Object -First\`, \`Select-Object -Last\`, or other truncation commands to limit output; the full output will already be captured to a file for more precise searching.
- Avoid using Shell with PowerShell file/content cmdlets unless explicitly instructed or when these cmdlets are truly necessary for the task. Instead, always prefer using the dedicated tools for these commands:
@ -205,7 +195,6 @@ Before executing the command, please follow these steps:
Usage notes:
- The command argument is required.
- You can specify an optional timeout in milliseconds. If not specified, commands will time out after ${defaultTimeoutMs}ms.
- It is very helpful if you write a clear, concise description of what this command does in 5-10 words.
- If the output exceeds ${limits.maxLines} lines or ${limits.maxBytes} bytes, it will be truncated and the full output will be written to a file. You can use Read with offset/limit to read specific sections or Grep to search the full content. Do NOT use \`more\` or other pagination commands to limit output; the full output will already be captured to a file for more precise searching.
- Avoid using Shell with cmd.exe file/content commands unless explicitly instructed or when these commands are truly necessary for the task. Instead, always prefer using the dedicated tools for these commands:
@ -242,7 +231,6 @@ function profile(name: string, platform: NodeJS.Platform, limits: Limits, defaul
gitCommandRestriction: "git commands",
createPrInstruction: "Create PR using a temporary body file so cmd.exe quoting stays simple.",
createPrExample: `(\n echo ## Summary\n echo - ^<1-3 bullet points^>\n) > pr-body.txt\ngh pr create --title "the pr title" --body-file pr-body.txt`,
parameterDescription: descriptions.cmd,
}
}
if (isPowerShell) {
@ -264,7 +252,6 @@ function profile(name: string, platform: NodeJS.Platform, limits: Limits, defaul
## Summary
- <1-3 bullet points>
'@`,
parameterDescription: descriptions.powershell,
}
}
return {
@ -280,7 +267,6 @@ function profile(name: string, platform: NodeJS.Platform, limits: Limits, defaul
createPrExample: `gh pr create --title "the pr title" --body "$(cat <<'EOF'
## Summary
<1-3 bullet points>`,
parameterDescription: descriptions.bash,
}
}
@ -300,7 +286,7 @@ export function render(name: string, platform: NodeJS.Platform, limits: Limits,
createPrInstruction: selected.createPrInstruction,
createPrExample: selected.createPrExample,
}),
parameters: parameterSchema(selected.parameterDescription),
parameters: parameterSchema(),
}
}

View file

@ -589,6 +589,38 @@ test("coalesces same-line tool progress into one snapshot", async () => {
}
})
test("omits the current directory from bash titles", async () => {
const out = await setup()
try {
await out.scrollback.append(
toolCommit({
tool: "bash",
phase: "start",
toolState: "running",
state: {
status: "running",
input: {
command: "pwd",
workdir: process.cwd(),
},
time: { start: 1 },
},
}),
)
const commits = claim(out.renderer)
try {
expect(render(commits)).toContain("$ pwd")
expect(render(commits)).not.toContain("Running in .")
} finally {
destroy(commits)
}
} finally {
out.scrollback.destroy()
}
})
test("renders completed bash output with one blank line after the command and before the next group", async () => {
const out = await setup()
@ -615,7 +647,6 @@ test("renders completed bash output with one blank line after the command and be
input: {
command: "git status",
workdir: "/tmp/demo",
description: "Show git status",
},
time: { start: 1 },
},
@ -633,7 +664,6 @@ test("renders completed bash output with one blank line after the command and be
input: {
command: "git status",
workdir: "/tmp/demo",
description: "Show git status",
},
time: { start: 1, end: 2 },
},
@ -645,6 +675,7 @@ test("renders completed bash output with one blank line after the command and be
take()
const output = lines.join("\n")
expect(output).toContain("# Running in /tmp/demo\n$ git status")
expect(output).toContain("$ git status\n\nOn branch demo")
expect(output).toContain("nothing to commit, working tree clean\n\noc-run-dev ahead 1")
expect(output).not.toContain("nothing to commit, working tree clean\n\n\noc-run-dev ahead 1")
@ -677,7 +708,6 @@ test("inserts a spacer before the next tool after completed multiline bash outpu
input: {
command: "pwd; ls -la",
workdir: "/tmp/demo",
description: "Lists current directory files",
},
time: { start: 1 },
},
@ -695,7 +725,6 @@ test("inserts a spacer before the next tool after completed multiline bash outpu
input: {
command: "pwd; ls -la",
workdir: "/tmp/demo",
description: "Lists current directory files",
},
output: ["/tmp/demo", "pwd; ls -la", "/tmp/demo", "total 4", "", ""].join("\n"),
title: "pwd; ls -la",
@ -755,7 +784,6 @@ test("does not double-space before completed bash output when inline tool header
input: {
command: "ls",
workdir: "src/cli/cmd/run",
description: "Lists files in run directory",
},
time: { start: 1 },
},
@ -805,7 +833,6 @@ test("does not double-space before completed bash output when inline tool header
input: {
command: "ls",
workdir: "src/cli/cmd/run",
description: "Lists files in run directory",
},
output: ["src/cli/cmd/run", "ls", "demo.ts", "entry.body.ts", "", ""].join("\n"),
title: "ls",

View file

@ -435,7 +435,6 @@ describe("run session data", () => {
title: "",
metadata: {
output: "/tmp/demo\n",
description: "",
},
time: { start: 1, end: 2 },
},
@ -490,7 +489,6 @@ describe("run session data", () => {
title: "",
metadata: {
output: "/tmp/demo\n",
description: "",
},
time: { start: 1, end: 2 },
},

View file

@ -238,7 +238,6 @@ function shellAssistantMessage(id: string, parentID: string): SessionMessages[nu
title: "",
metadata: {
output: "account.ts\n",
description: "",
},
time: {
start: 200,

View file

@ -1811,7 +1811,6 @@ unix(
yield* llm.tool("bash", {
command:
'i=0; while [ "$i" -lt 4000 ]; do printf "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx %05d\\n" "$i"; i=$((i + 1)); done; printf truncation-ready; sleep 30',
description: "Print many lines",
timeout: 30_000,
workdir: path.resolve(dir),
})

View file

@ -139,7 +139,6 @@ it.live("tool execution produces non-empty session diff (snapshot race)", () =>
const command = `echo 'snapshot race test content' > ${path.join(dir, "race-test.txt")}`
yield* llm.toolMatch((hit) => JSON.stringify(hit.body).includes("create the file"), "bash", {
command,
description: "create test file",
})
yield* llm.textMatch((hit) => JSON.stringify(hit.body).includes("bash"), "done")

View file

@ -24,23 +24,6 @@ exports[`tool parameters JSON Schema (wire shape) bash 1`] = `
"description": "The command to execute",
"type": "string",
},
"description": {
"description":
"Clear, concise description of what this command does in 5-10 words. Examples:
Input: ls
Output: Lists files in current directory
Input: git status
Output: Shows working tree status
Input: npm install
Output: Installs package dependencies
Input: mkdir foo
Output: Creates directory 'foo'"
,
"type": "string",
},
"timeout": {
"description": "Optional timeout in milliseconds",
"exclusiveMinimum": 0,
@ -55,7 +38,6 @@ Output: Creates directory 'foo'"
},
"required": [
"command",
"description",
],
"type": "object",
}

View file

@ -106,19 +106,16 @@ describe("tool parameters", () => {
})
describe("shell", () => {
test("accepts minimum: command + description", () => {
expect(parse(Shell, { command: "ls", description: "list" })).toEqual({ command: "ls", description: "list" })
test("accepts command", () => {
expect(parse(Shell, { command: "ls" })).toEqual({ command: "ls" })
})
test("accepts optional timeout + workdir", () => {
const parsed = parse(Shell, { command: "ls", description: "list", timeout: 5000, workdir: "/tmp" })
const parsed = parse(Shell, { command: "ls", timeout: 5000, workdir: "/tmp" })
expect(parsed.timeout).toBe(5000)
expect(parsed.workdir).toBe("/tmp")
})
test("rejects missing description", () => {
expect(accepts(Shell, { command: "ls" })).toBe(false)
})
test("rejects missing command", () => {
expect(accepts(Shell, { description: "list" })).toBe(false)
expect(accepts(Shell, {})).toBe(false)
})
})

View file

@ -182,7 +182,6 @@ describe("tool.shell", () => {
Effect.gen(function* () {
const result = yield* run({
command: "echo test",
description: "Echo test message",
})
expect(result.metadata.exit).toBe(0)
expect(result.metadata.output).toContain("test")
@ -204,7 +203,6 @@ describe("tool.shell", () => {
const result = yield* bash.execute(
{
command: "echo fallback",
description: "Echo fallback text",
},
ctx,
)
@ -227,7 +225,6 @@ describe("tool.shell permissions", () => {
yield* run(
{
command: "echo hello",
description: "Echo hello",
},
capture(requests),
)
@ -249,7 +246,6 @@ describe("tool.shell permissions", () => {
yield* run(
{
command: "echo foo && echo bar",
description: "Echo twice",
},
capture(requests),
)
@ -273,7 +269,6 @@ describe("tool.shell permissions", () => {
yield* run(
{
command: "Write-Host foo; if ($?) { Write-Host bar }",
description: "Check PowerShell conditional",
},
capture(requests),
)
@ -303,7 +298,6 @@ describe("tool.shell permissions", () => {
yield* fail(
{
command: "Remove-Item -Recurse tmp",
description: "Remove a temp directory",
},
capture(requests, err),
),
@ -331,7 +325,6 @@ describe("tool.shell permissions", () => {
yield* fail(
{
command: `cat ${file}`,
description: "Read wildcard path",
},
capture(requests, err),
),
@ -359,7 +352,6 @@ describe("tool.shell permissions", () => {
yield* run(
{
command: `echo $(cat "${file}")`,
description: "Read nested bash file",
},
capture(requests),
)
@ -389,7 +381,6 @@ describe("tool.shell permissions", () => {
yield* fail(
{
command: `Copy-Item -PassThru "${process.env.WINDIR!.replaceAll("\\", "/")}/win.ini" ./out`,
description: "Copy Windows ini",
},
capture(requests, err),
),
@ -415,7 +406,6 @@ describe("tool.shell permissions", () => {
yield* run(
{
command: `Write-Output $(Get-Content ${file})`,
description: "Read nested PowerShell file",
},
capture(requests),
)
@ -446,7 +436,6 @@ describe("tool.shell permissions", () => {
yield* fail(
{
command: 'Get-Content "C:../outside.txt"',
description: "Read drive-relative file",
},
capture(requests, err),
),
@ -474,7 +463,6 @@ describe("tool.shell permissions", () => {
yield* fail(
{
command: 'Get-Content "$HOME/.ssh/config"',
description: "Read home config",
},
capture(requests, err),
),
@ -503,7 +491,6 @@ describe("tool.shell permissions", () => {
yield* fail(
{
command: 'Get-Content "$PWD/../outside.txt"',
description: "Read pwd-relative file",
},
capture(requests, err),
),
@ -531,7 +518,6 @@ describe("tool.shell permissions", () => {
yield* fail(
{
command: 'Get-Content "$PSHOME/outside.txt"',
description: "Read pshome file",
},
capture(requests, err),
),
@ -567,7 +553,6 @@ describe("tool.shell permissions", () => {
yield* fail(
{
command: `Get-Content -Path "${root}$env:${key}\\Windows\\win.ini"`,
description: "Read Windows ini with missing env",
},
capture(requests, err),
),
@ -598,7 +583,6 @@ describe("tool.shell permissions", () => {
yield* run(
{
command: "Get-Content $env:WINDIR/win.ini",
description: "Read Windows ini from env",
},
capture(requests),
)
@ -626,7 +610,6 @@ describe("tool.shell permissions", () => {
yield* fail(
{
command: `Get-Content -Path FileSystem::${process.env.WINDIR!.replaceAll("\\", "/")}/win.ini`,
description: "Read Windows ini from FileSystem provider",
},
capture(requests, err),
),
@ -655,7 +638,6 @@ describe("tool.shell permissions", () => {
yield* fail(
{
command: "Get-Content ${env:WINDIR}/win.ini",
description: "Read Windows ini from braced env",
},
capture(requests, err),
),
@ -682,7 +664,6 @@ describe("tool.shell permissions", () => {
yield* run(
{
command: "Set-Location C:/Windows",
description: "Change location",
},
capture(requests),
)
@ -710,7 +691,6 @@ describe("tool.shell permissions", () => {
yield* run(
{
command: "Write-Output ('a' * 3)",
description: "Write repeated text",
},
capture(requests),
)
@ -736,7 +716,6 @@ describe("tool.shell permissions", () => {
yield* run(
{
command: `TYPE "${path.join(process.env.WINDIR!, "win.ini")}"`,
description: "Read Windows ini with cmd",
},
capture(requests),
)
@ -761,7 +740,6 @@ describe("tool.shell permissions", () => {
yield* fail(
{
command: "cd ../",
description: "Change to parent directory",
},
capture(requests, err),
),
@ -786,7 +764,6 @@ describe("tool.shell permissions", () => {
{
command: "echo ok",
workdir: os.tmpdir(),
description: "Echo from temp dir",
},
capture(requests, err),
),
@ -817,7 +794,6 @@ describe("tool.shell permissions", () => {
{
command: "echo ok",
workdir: dir,
description: "Echo from external dir",
},
capture(requests, err),
),
@ -850,7 +826,6 @@ describe("tool.shell permissions", () => {
{
command: "echo ok",
workdir: "/tmp",
description: "Echo from Git Bash tmp",
},
capture(requests, err),
),
@ -878,7 +853,6 @@ describe("tool.shell permissions", () => {
yield* fail(
{
command: "cat /tmp/opencode-does-not-exist",
description: "Read Git Bash tmp file",
},
capture(requests, err),
),
@ -910,7 +884,6 @@ describe("tool.shell permissions", () => {
yield* fail(
{
command: `cat ${filepath}`,
description: "Read external file",
},
capture(requests, err),
),
@ -922,7 +895,6 @@ describe("tool.shell permissions", () => {
expect(extDirReq!.always).toContain(expected)
expect(extDirReq!.metadata).toMatchObject({
command: `cat ${filepath}`,
description: "Read external file",
directories: [outerTmp],
patterns: [expected],
})
@ -942,7 +914,6 @@ describe("tool.shell permissions", () => {
yield* run(
{
command: `rm -rf ${path.join(tmp, "nested")}`,
description: "Remove nested dir",
},
capture(requests),
)
@ -963,7 +934,6 @@ describe("tool.shell permissions", () => {
yield* run(
{
command: "git log --oneline -5",
description: "Git log",
},
capture(requests),
)
@ -985,7 +955,6 @@ describe("tool.shell permissions", () => {
yield* run(
{
command: "cd .",
description: "Stay in current directory",
},
capture(requests),
)
@ -1006,7 +975,7 @@ describe("tool.shell permissions", () => {
const requests: Array<Omit<PermissionV1.Request, "id" | "sessionID" | "tool">> = []
expect(
yield* fail(
{ command: "echo test > output.txt", description: "Redirect test output" },
{ command: "echo test > output.txt" },
capture(requests, err),
),
).toMatchObject({ message: err.message })
@ -1025,7 +994,7 @@ describe("tool.shell permissions", () => {
tmp,
Effect.gen(function* () {
const requests: Array<Omit<PermissionV1.Request, "id" | "sessionID" | "tool">> = []
yield* run({ command: "ls -la", description: "List" }, capture(requests))
yield* run({ command: "ls -la" }, capture(requests))
const bashReq = requests.find((r) => r.permission === "bash")
expect(bashReq).toBeDefined()
expect(bashReq!.always[0]).toBe("ls *")
@ -1047,7 +1016,6 @@ describe("tool.shell abort", () => {
const res = yield* run(
{
command: `echo before && sleep 30`,
description: "Long running command",
},
{
...ctx,
@ -1078,7 +1046,6 @@ describe("tool.shell abort", () => {
Effect.gen(function* () {
const result = yield* run({
command: `sleep 60`,
description: "Timeout test",
timeout: 500,
})
expect(result.output).toContain("shell tool terminated command after exceeding timeout")
@ -1099,7 +1066,6 @@ describe("tool.shell abort", () => {
const result = yield* tool.execute(
{
command: `sleep 60`,
description: "Default timeout test",
},
ctx,
)
@ -1116,7 +1082,6 @@ describe("tool.shell abort", () => {
Effect.gen(function* () {
const result = yield* run({
command: `echo stdout_msg && echo stderr_msg >&2`,
description: "Stderr test",
})
expect(result.output).toContain("stdout_msg")
expect(result.output).toContain("stderr_msg")
@ -1132,7 +1097,6 @@ describe("tool.shell abort", () => {
Effect.gen(function* () {
const result = yield* run({
command: `exit 42`,
description: "Non-zero exit",
})
expect(result.metadata.exit).toBe(42)
}),
@ -1147,7 +1111,6 @@ describe("tool.shell abort", () => {
const result = yield* run(
{
command: `echo first && sleep 0.1 && echo second`,
description: "Streaming test",
},
{
...ctx,
@ -1174,7 +1137,6 @@ describe("tool.shell truncation", () => {
const lineCount = Truncate.MAX_LINES + 500
const result = yield* run({
command: fill("lines", lineCount),
description: "Generate lines exceeding limit",
})
mustTruncate(result)
expect(result.output).toMatch(/\.\.\.output truncated\.\.\./)
@ -1190,7 +1152,6 @@ describe("tool.shell truncation", () => {
const byteCount = Truncate.MAX_BYTES + 10000
const result = yield* run({
command: fill("bytes", byteCount),
description: "Generate bytes exceeding limit",
})
mustTruncate(result)
expect(result.output).toMatch(/\.\.\.output truncated\.\.\./)
@ -1205,7 +1166,6 @@ describe("tool.shell truncation", () => {
Effect.gen(function* () {
const result = yield* run({
command: fill("lines", 1),
description: "Generate one line",
})
expect((result.metadata as { truncated?: boolean }).truncated).toBe(false)
expect(result.output).toContain("1")
@ -1220,7 +1180,6 @@ describe("tool.shell truncation", () => {
const lineCount = Truncate.MAX_LINES + 100
const result = yield* run({
command: fill("lines", lineCount),
description: "Generate lines for file check",
})
mustTruncate(result)