Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

feat(shell): one catalog tool for run/output/kill (#1005)

Rach Pradhane20eb8d0af6f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 94afb580..f5779b9a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -36,12 +36,8 @@ current is part of cutting a release.
## v0.0.299
- The MCP `run_task` result view uses the codegraff.com paper palette (paper, rice, ink, coral, cobalt, gold) instead of the desktop emerald chrome. Host light/dark still applies. No webfonts.
-
-See [the release notes](docs/releases/v0.0.299.md) for details.
-
-## v0.0.299
-
-- The MCP `run_task` result view uses the codegraff.com paper palette (paper, rice, ink, coral, cobalt, gold) instead of the desktop emerald chrome. Host light/dark still applies. No webfonts.
+- One catalog `shell` tool (`action=run|output|kill`) replaces advertised `bash` / `bash_output` / `bash_kill`. The old names still dispatch. Not a PTY.
+- A follow-up typed during a foreground shell wait promotes the command instead of blocking or killing it, so you can talk while it runs.
See [the release notes](docs/releases/v0.0.299.md) for details.
diff --git a/TUI/dispatch.zig b/TUI/dispatch.zig
index c466f02d..b5f28580 100644
--- a/TUI/dispatch.zig
+++ b/TUI/dispatch.zig
@@ -81,6 +81,7 @@ pub fn queueSteerLine(self: *Model, text: []const u8) void {
if (dup.ptr != line.ptr) self.alloc.free(dup);
return;
};
+ if (engine.g_followup_fn) |f| f();
self.input.setValue("") catch {};
self.pushFmt(.system, "↳ queued ({d} waiting)", .{self.steer_queue.items.len}) catch {};
}
diff --git a/TUI/engine.zig b/TUI/engine.zig
index 10da41b7..e4dab1d9 100644
--- a/TUI/engine.zig
+++ b/TUI/engine.zig
@@ -62,6 +62,10 @@ pub const Job = struct {
/// The live job's raw bash tail. tui_sink writes here from the tool pool.
pub var g_raw: ?*StreamBuf = null;
+/// Host sets this so a TUI steer can unstick a foreground shell wait.
+pub const FollowupFn = *const fn () void;
+pub var g_followup_fn: ?FollowupFn = null;
+
/// Idle auto-wake: a finished background job wants a turn (grok-build notify).
pub const IdleWakeFn = *const fn (turn_ctx: ?*anyopaque, buf: []u8) ?[]const u8;
pub var g_idle_wake_fn: ?IdleWakeFn = null;
diff --git a/TUI/root.zig b/TUI/root.zig
index 4623f1e5..73665a91 100644
--- a/TUI/root.zig
+++ b/TUI/root.zig
@@ -21,6 +21,9 @@ pub const StreamBuf = engine.StreamBuf;
pub fn rawStream() ?*engine.StreamBuf {
return engine.g_raw;
}
+pub fn setFollowupFn(f: ?engine.FollowupFn) void {
+ engine.g_followup_fn = f;
+}
pub const Event = engine.Event;
pub const EventQueue = engine.EventQueue;
pub const ToolEvent = engine.ToolEvent;
diff --git a/docs/adr/0135-one-shell-tool.md b/docs/adr/0135-one-shell-tool.md
new file mode 100644
index 00000000..06a2b7bc
--- /dev/null
+++ b/docs/adr/0135-one-shell-tool.md
@@ -0,0 +1,32 @@
+# 0135. One `shell` tool: run, output, kill
+
+Status: accepted 2026-09-15
+
+## Context
+
+The catalog advertised `bash`, `bash_output`, and `bash_kill` as three tools
+for one job table. fx ships a single `shell` tool with `action=run|interact|stop`.
+Twenty-nine native names is already a lot; the split taught models to poll.
+
+fx `interact` writes into a PTY session. Graff jobs spawn with stdin ignored
+(`jobs.spawnJobOpts`). The composer already queues mid-turn follow-ups
+(`queueSteerLine` / `drainSteer`).
+
+## Decision
+
+Advertise one `shell` tool with `action=run|output|kill`. Keep
+`bash` / `bash_output` / `bash_kill` as dispatch aliases so rlm `bash()`,
+`!cmd`, and in-flight sessions still run. Refuse `action=interact`: it is
+not a PTY. Do not change the 120s / 15s auto-background waits (ADR 0026,
+ADR 0055).
+
+User typing while a command runs stays steer — it does not become process
+stdin.
+
+## Consequences
+
+The advertised catalog shrinks by two names. The tool-catalog kernel cube
+is regenerated. `--no-local-tools` still blocks the aliases.
+
+Rejected: stealing fx's PTY `interact`, hiding the aliases from dispatch,
+and shortening the foreground wait to fx's 30s yield cap.
diff --git a/docs/adr/0136-follow-up-promotes-a-live-shell.md b/docs/adr/0136-follow-up-promotes-a-live-shell.md
new file mode 100644
index 00000000..0e0c995a
--- /dev/null
+++ b/docs/adr/0136-follow-up-promotes-a-live-shell.md
@@ -0,0 +1,28 @@
+# 0136. A follow-up promotes a live shell; it does not kill it
+
+Status: accepted 2026-09-16
+
+## Context
+
+Foreground `shell` waits up to 120s (lean `-p`: 15s) before auto-background
+(ADR 0026, ADR 0055). Typing during that wait queued a steer, but the wait
+kept blocking, and a force-steer/Esc path killed the child. Talking to the
+model meant destroying the command.
+
+Astra `response.steer` only applies while a GPT-6 stream is live, not during
+a tool wait. Jobs still ignore stdin (ADR 0134): this is not a PTY.
+
+## Decision
+
+If a follow-up is queued, `waitForeground` returns a running job id and
+leaves the process alive. Force-steer already queued that line, so it
+promotes too. A real Esc (no follow-up) still kills the tree.
+
+The tool result tells the model the command is backgrounded because of the
+follow-up. The queued line remains the next user turn.
+
+## Consequences
+
+You can talk while a long command runs. The model sees a job id, not a
+cancel. Double-Enter force-steer no longer murders a `sleep` you wanted
+kept. Esc without a queued line is still a kill.
diff --git a/docs/adr/README.md b/docs/adr/README.md
index 0a6eb7d6..b55fddf5 100644
--- a/docs/adr/README.md
+++ b/docs/adr/README.md
@@ -154,6 +154,8 @@ record only when you need the evidence or the edge cases.
| [0133](0133-publication-review-binds-committed-inputs.md) | Proposed: non-draft publication reviews immutable source and observed checks; changed inputs invalidate earlier assessments. |
| [0134](0134-accord-live-jsonl-durable.md) | JSONL is the durable peer room; Accord Unix 0600 is opt-in live behind postMessage. |
+| [0135](0135-one-shell-tool.md) | Advertise one `shell` tool (`run` / `output` / `kill`); bash names stay dispatch aliases. Not a PTY. |
+| [0136](0136-follow-up-promotes-a-live-shell.md) | A queued follow-up or force-steer promotes a foreground shell; Esc still kills it. |
## When to write one
diff --git a/docs/releases/v0.0.299.md b/docs/releases/v0.0.299.md
index c9f8c4b5..26a23ba3 100644
--- a/docs/releases/v0.0.299.md
+++ b/docs/releases/v0.0.299.md
@@ -6,4 +6,12 @@ The MCP Apps task result view now matches the codegraff.com design system.
`run_task` results in MCP Apps hosts use the site palette: warm paper, rice surfaces, ink type, coral for Graff, cobalt for links, mustard focus rings. Radii stay small. Touch targets stay at least 44px. The view still cannot fetch webfonts or run tools. Light and dark follow the host.
+## Talk while a command runs
+
+Type a follow-up during a foreground shell wait and the command moves to the background instead of sitting for 120s or dying on force-steer. Esc with no queued line still kills it.
+
+## One shell tool
+
+`bash`, `bash_output`, and `bash_kill` collapse into one catalog `shell` tool with `action=run|output|kill`. The old names still dispatch. This is not a PTY: you cannot type into a running process. Type in the composer to steer the turn.
+
The rest of 0.0.298 is unchanged.
diff --git a/examples/edge-worker/src/remote.ts b/examples/edge-worker/src/remote.ts
index fca53126..5faa01ba 100644
--- a/examples/edge-worker/src/remote.ts
+++ b/examples/edge-worker/src/remote.ts
@@ -10,7 +10,7 @@
export const HARNESS_VERSION = "0.13";
export type ModelName = "MiniMax-M2.5" | "MiniMax-M2.7" | "MiniMax-M3" | "accounts/fireworks/models/deepseek-v4-flash" | "accounts/fireworks/models/deepseek-v4-pro" | "accounts/fireworks/models/glm-5p2" | "accounts/fireworks/models/gpt-oss-120b" | "accounts/fireworks/models/kimi-k2p6" | "accounts/fireworks/models/kimi-k2p7-code" | "accounts/fireworks/models/minimax-m3" | "accounts/fireworks/models/qwen3p7-plus" | "alibaba/qwen3.8-27b" | "anthropic/claude-sonnet-4.6" | "claude-fable-5" | "claude-haiku-4-5" | "claude-opus-4-5" | "claude-opus-4-6" | "claude-opus-4-7" | "claude-opus-4-8" | "claude-opus-4.8" | "claude-opus-5" | "claude-sonnet-4-5" | "claude-sonnet-4-6" | "claude-sonnet-4.6" | "claude-sonnet-5" | "deepseek-chat" | "deepseek-reasoner" | "deepseek-v4-flash" | "deepseek-v4-pro" | "fugu" | "fugu-ultra" | "fugu-ultra-20260615" | "gemini-3-flash-preview" | "gemini-3.1-flash-lite" | "gemini-3.1-pro-preview" | "gemini-3.5-flash" | "gemini-3.5-flash-lite" | "gemini-3.6-flash" | "gemini-3.7-flash" | "gemini-3.8-flash" | "gemma-4-26b-a4b-it" | "gemma-4-31b" | "gemma-4-31b-it" | "glm-4.5" | "glm-4.7" | "glm-5" | "glm-5-turbo" | "glm-5.2" | "glm-5.3" | "glm-5.3-flash" | "glm-5v-turbo" | "gpt-5-codex" | "gpt-5.2" | "gpt-5.3-codex-spark" | "gpt-5.4" | "gpt-5.4-mini" | "gpt-5.4-pro" | "gpt-5.5" | "gpt-5.6" | "gpt-5.6-luna" | "gpt-5.6-sol" | "gpt-5.6-terra" | "gpt-6-astra" | "gpt-oss-120b" | "grok-4.3" | "grok-4.6" | "grok-build" | "k3" | "kilo-auto/small" | "kimi-for-coding" | "kimi-for-coding-highspeed" | "kimi-k2.6" | "kimi-k2.7-code" | "kimi-k3" | "kimi-latest" | "lmstudio" | "mimo-v2-flash" | "mimo-v2.5" | "mimo-v2.5-pro" | "mimo-v2.5-pro-ultraspeed" | "minimax-m3" | "mistral-medium-latest" | "mlx-community/Qwen3.6-27B-OptiQ-4bit" | "muse-spark-1.2" | "muse-spark-1.2-contributor" | "openai/gpt-oss-120b" | (string & {});
-export type ToolName = "bash" | "bash_output" | "bash_kill" | "read_file" | "edit_file" | "write_file" | "webfetch" | "skill" | "codedb" | "read_tool_result" | "render_html" | "todo_write" | "todo_read" | "eval" | "note_constraint" | "ask_user" | "attempt_completion" | "load_tool_schemas" | "mcp_search_tools" | "mcp_select_tool" | "clock_sleep" | "subagent" | "workflow" | "agent_output" | "learn_candidate" | "peer_message" | "workspace" | "imagegen" | "rlm";
+export type ToolName = "shell" | "read_file" | "edit_file" | "write_file" | "webfetch" | "skill" | "codedb" | "read_tool_result" | "render_html" | "todo_write" | "todo_read" | "eval" | "note_constraint" | "ask_user" | "attempt_completion" | "load_tool_schemas" | "mcp_search_tools" | "mcp_select_tool" | "clock_sleep" | "subagent" | "workflow" | "agent_output" | "learn_candidate" | "peer_message" | "workspace" | "imagegen" | "rlm";
export type ProviderId = "anthropic" | "codegraff" | "deepseek" | "openai" | "google" | "minimax" | "xiaomi" | "kilo" | "groq" | "cerebras" | "mistral" | "kimi" | "moonshot" | "xai" | "zai" | "meta" | "vercel" | "openrouter" | "fugu" | "fireworks" | "mlx" | "lmstudio" | "codex";
/** Events streamed by the bridge (same `--json` contract as the stdio SDK).
@@ -522,4 +522,4 @@ export async function* runAgentRemote(opts: RunAgentRemoteOptions): AsyncGenerat
}
export const MODELS: ModelName[] = ["MiniMax-M2.5", "MiniMax-M2.7", "MiniMax-M3", "accounts/fireworks/models/deepseek-v4-flash", "accounts/fireworks/models/deepseek-v4-pro", "accounts/fireworks/models/glm-5p2", "accounts/fireworks/models/gpt-oss-120b", "accounts/fireworks/models/kimi-k2p6", "accounts/fireworks/models/kimi-k2p7-code", "accounts/fireworks/models/minimax-m3", "accounts/fireworks/models/qwen3p7-plus", "alibaba/qwen3.8-27b", "anthropic/claude-sonnet-4.6", "claude-fable-5", "claude-haiku-4-5", "claude-opus-4-5", "claude-opus-4-6", "claude-opus-4-7", "claude-opus-4-8", "claude-opus-4.8", "claude-opus-5", "claude-sonnet-4-5", "claude-sonnet-4-6", "claude-sonnet-4.6", "claude-sonnet-5", "deepseek-chat", "deepseek-reasoner", "deepseek-v4-flash", "deepseek-v4-pro", "fugu", "fugu-ultra", "fugu-ultra-20260615", "gemini-3-flash-preview", "gemini-3.1-flash-lite", "gemini-3.1-pro-preview", "gemini-3.5-flash", "gemini-3.5-flash-lite", "gemini-3.6-flash", "gemini-3.7-flash", "gemini-3.8-flash", "gemma-4-26b-a4b-it", "gemma-4-31b", "gemma-4-31b-it", "glm-4.5", "glm-4.7", "glm-5", "glm-5-turbo", "glm-5.2", "glm-5.3", "glm-5.3-flash", "glm-5v-turbo", "gpt-5-codex", "gpt-5.2", "gpt-5.3-codex-spark", "gpt-5.4", "gpt-5.4-mini", "gpt-5.4-pro", "gpt-5.5", "gpt-5.6", "gpt-5.6-luna", "gpt-5.6-sol", "gpt-5.6-terra", "gpt-6-astra", "gpt-oss-120b", "grok-4.3", "grok-4.6", "grok-build", "k3", "kilo-auto/small", "kimi-for-coding", "kimi-for-coding-highspeed", "kimi-k2.6", "kimi-k2.7-code", "kimi-k3", "kimi-latest", "lmstudio", "mimo-v2-flash", "mimo-v2.5", "mimo-v2.5-pro", "mimo-v2.5-pro-ultraspeed", "minimax-m3", "mistral-medium-latest", "mlx-community/Qwen3.6-27B-OptiQ-4bit", "muse-spark-1.2", "muse-spark-1.2-contributor", "openai/gpt-oss-120b"];
-export const TOOLS: ToolName[] = ["bash", "bash_output", "bash_kill", "read_file", "edit_file", "write_file", "webfetch", "skill", "codedb", "read_tool_result", "render_html", "todo_write", "todo_read", "eval", "note_constraint", "ask_user", "attempt_completion", "load_tool_schemas", "mcp_search_tools", "mcp_select_tool", "clock_sleep", "subagent", "workflow", "agent_output", "learn_candidate", "peer_message", "workspace", "imagegen", "rlm"];
+export const TOOLS: ToolName[] = ["shell", "read_file", "edit_file", "write_file", "webfetch", "skill", "codedb", "read_tool_result", "render_html", "todo_write", "todo_read", "eval", "note_constraint", "ask_user", "attempt_completion", "load_tool_schemas", "mcp_search_tools", "mcp_select_tool", "clock_sleep", "subagent", "workflow", "agent_output", "learn_candidate", "peer_message", "workspace", "imagegen", "rlm"];
diff --git a/lean-proofs/Graff/ToolCatalog.lean b/lean-proofs/Graff/ToolCatalog.lean
index f01a4000..a6e0cdaa 100644
--- a/lean-proofs/Graff/ToolCatalog.lean
+++ b/lean-proofs/Graff/ToolCatalog.lean
@@ -22,18 +22,18 @@ structure Flags where
deriving Repr, BEq
def localTools : List String :=
- ["bash", "bash_output", "bash_kill", "read_file", "edit_file",
+ ["shell", "read_file", "edit_file",
"write_file", "codedb", "read_tool_result", "render_html", "imagegen"]
def leanTools : List String :=
- ["bash", "read_file", "edit_file", "write_file", "codedb",
+ ["shell", "read_file", "edit_file", "write_file", "codedb",
"subagent", "attempt_completion", "load_tool_schemas"]
def optionalTools : List String :=
["imagegen"]
def baseTools : List String :=
- ["bash", "bash_output", "bash_kill", "read_file", "edit_file",
+ ["shell", "read_file", "edit_file",
"write_file", "webfetch", "skill", "codedb", "read_tool_result",
"render_html"]
@@ -110,9 +110,13 @@ theorem cube_imagegen_off :
(allFlags.filter (fun f => !f.imagegen)).all
(fun f => !advertised f "imagegen") = true := by native_decide
-theorem cube_no_local_drops_bash :
+theorem cube_no_local_drops_shell :
(allFlags.filter (fun f => f.noLocal)).all
- (fun f => !advertised f "bash") = true := by native_decide
+ (fun f => !advertised f "shell") = true := by native_decide
+
+theorem cube_never_advertises_bash_aliases :
+ allFlags.all (fun f =>
+ (!advertised f "bash" && !advertised f "bash_output" && !advertised f "bash_kill")) = true := by native_decide
theorem cube_sub_never_subagent :
(allFlags.filter (fun f => f.isSub)).all
@@ -141,7 +145,9 @@ example : catalog {} =
example : catalog { imagegen := true } =
catalog {} ++ ["imagegen"] := by native_decide
-example : advertised { noLocal := true } "bash" = false := by native_decide
+example : advertised {} "shell" = true := by native_decide
+example : advertised {} "bash" = false := by native_decide
+example : advertised { noLocal := true } "shell" = false := by native_decide
example : advertised { noLocal := true } "webfetch" = true := by native_decide
example : advertised { noLocal := true, imagegen := true } "imagegen" = false := by native_decide
example : advertised { lean := true, imagegen := true } "imagegen" = false := by native_decide
diff --git a/sdk/py/harness_sdk.py b/sdk/py/harness_sdk.py
index aa8f9e0d..bf3ea5ec 100644
--- a/sdk/py/harness_sdk.py
+++ b/sdk/py/harness_sdk.py
@@ -14,7 +14,7 @@ import urllib.request
from typing import Iterator, List, Literal, Optional, TypedDict, Union
MODELS = ["MiniMax-M2.5", "MiniMax-M2.7", "MiniMax-M3", "accounts/fireworks/models/deepseek-v4-flash", "accounts/fireworks/models/deepseek-v4-pro", "accounts/fireworks/models/glm-5p2", "accounts/fireworks/models/gpt-oss-120b", "accounts/fireworks/models/kimi-k2p6", "accounts/fireworks/models/kimi-k2p7-code", "accounts/fireworks/models/minimax-m3", "accounts/fireworks/models/qwen3p7-plus", "alibaba/qwen3.8-27b", "anthropic/claude-sonnet-4.6", "claude-fable-5", "claude-haiku-4-5", "claude-opus-4-5", "claude-opus-4-6", "claude-opus-4-7", "claude-opus-4-8", "claude-opus-4.8", "claude-opus-5", "claude-sonnet-4-5", "claude-sonnet-4-6", "claude-sonnet-4.6", "claude-sonnet-5", "deepseek-chat", "deepseek-reasoner", "deepseek-v4-flash", "deepseek-v4-pro", "fugu", "fugu-ultra", "fugu-ultra-20260615", "gemini-3-flash-preview", "gemini-3.1-flash-lite", "gemini-3.1-pro-preview", "gemini-3.5-flash", "gemini-3.5-flash-lite", "gemini-3.6-flash", "gemini-3.7-flash", "gemini-3.8-flash", "gemma-4-26b-a4b-it", "gemma-4-31b", "gemma-4-31b-it", "glm-4.5", "glm-4.7", "glm-5", "glm-5-turbo", "glm-5.2", "glm-5.3", "glm-5.3-flash", "glm-5v-turbo", "gpt-5-codex", "gpt-5.2", "gpt-5.3-codex-spark", "gpt-5.4", "gpt-5.4-mini", "gpt-5.4-pro", "gpt-5.5", "gpt-5.6", "gpt-5.6-luna", "gpt-5.6-sol", "gpt-5.6-terra", "gpt-6-astra", "gpt-oss-120b", "grok-4.3", "grok-4.6", "grok-build", "k3", "kilo-auto/small", "kimi-for-coding", "kimi-for-coding-highspeed", "kimi-k2.6", "kimi-k2.7-code", "kimi-k3", "kimi-latest", "lmstudio", "mimo-v2-flash", "mimo-v2.5", "mimo-v2.5-pro", "mimo-v2.5-pro-ultraspeed", "minimax-m3", "mistral-medium-latest", "mlx-community/Qwen3.6-27B-OptiQ-4bit", "muse-spark-1.2", "muse-spark-1.2-contributor", "openai/gpt-oss-120b"]
-TOOLS = ["bash", "bash_output", "bash_kill", "read_file", "edit_file", "write_file", "webfetch", "skill", "codedb", "read_tool_result", "render_html", "todo_write", "todo_read", "eval", "note_constraint", "ask_user", "attempt_completion", "load_tool_schemas", "mcp_search_tools", "mcp_select_tool", "clock_sleep", "subagent", "workflow", "agent_output", "learn_candidate", "peer_message", "workspace", "imagegen", "rlm"]
+TOOLS = ["shell", "read_file", "edit_file", "write_file", "webfetch", "skill", "codedb", "read_tool_result", "render_html", "todo_write", "todo_read", "eval", "note_constraint", "ask_user", "attempt_completion", "load_tool_schemas", "mcp_search_tools", "mcp_select_tool", "clock_sleep", "subagent", "workflow", "agent_output", "learn_candidate", "peer_message", "workspace", "imagegen", "rlm"]
PROVIDERS = ["anthropic", "codegraff", "deepseek", "openai", "google", "minimax", "xiaomi", "kilo", "groq", "cerebras", "mistral", "kimi", "moonshot", "xai", "zai", "meta", "vercel", "openrouter", "fugu", "fireworks", "mlx", "lmstudio", "codex"]
diff --git a/sdk/ts/harness.ts b/sdk/ts/harness.ts
index 1a33089c..14f7c407 100644
--- a/sdk/ts/harness.ts
+++ b/sdk/ts/harness.ts
@@ -12,7 +12,7 @@ import type { Readable, Writable } from "node:stream";
export const HARNESS_VERSION = "0.13";
export type ModelName = "MiniMax-M2.5" | "MiniMax-M2.7" | "MiniMax-M3" | "accounts/fireworks/models/deepseek-v4-flash" | "accounts/fireworks/models/deepseek-v4-pro" | "accounts/fireworks/models/glm-5p2" | "accounts/fireworks/models/gpt-oss-120b" | "accounts/fireworks/models/kimi-k2p6" | "accounts/fireworks/models/kimi-k2p7-code" | "accounts/fireworks/models/minimax-m3" | "accounts/fireworks/models/qwen3p7-plus" | "alibaba/qwen3.8-27b" | "anthropic/claude-sonnet-4.6" | "claude-fable-5" | "claude-haiku-4-5" | "claude-opus-4-5" | "claude-opus-4-6" | "claude-opus-4-7" | "claude-opus-4-8" | "claude-opus-4.8" | "claude-opus-5" | "claude-sonnet-4-5" | "claude-sonnet-4-6" | "claude-sonnet-4.6" | "claude-sonnet-5" | "deepseek-chat" | "deepseek-reasoner" | "deepseek-v4-flash" | "deepseek-v4-pro" | "fugu" | "fugu-ultra" | "fugu-ultra-20260615" | "gemini-3-flash-preview" | "gemini-3.1-flash-lite" | "gemini-3.1-pro-preview" | "gemini-3.5-flash" | "gemini-3.5-flash-lite" | "gemini-3.6-flash" | "gemini-3.7-flash" | "gemini-3.8-flash" | "gemma-4-26b-a4b-it" | "gemma-4-31b" | "gemma-4-31b-it" | "glm-4.5" | "glm-4.7" | "glm-5" | "glm-5-turbo" | "glm-5.2" | "glm-5.3" | "glm-5.3-flash" | "glm-5v-turbo" | "gpt-5-codex" | "gpt-5.2" | "gpt-5.3-codex-spark" | "gpt-5.4" | "gpt-5.4-mini" | "gpt-5.4-pro" | "gpt-5.5" | "gpt-5.6" | "gpt-5.6-luna" | "gpt-5.6-sol" | "gpt-5.6-terra" | "gpt-6-astra" | "gpt-oss-120b" | "grok-4.3" | "grok-4.6" | "grok-build" | "k3" | "kilo-auto/small" | "kimi-for-coding" | "kimi-for-coding-highspeed" | "kimi-k2.6" | "kimi-k2.7-code" | "kimi-k3" | "kimi-latest" | "lmstudio" | "mimo-v2-flash" | "mimo-v2.5" | "mimo-v2.5-pro" | "mimo-v2.5-pro-ultraspeed" | "minimax-m3" | "mistral-medium-latest" | "mlx-community/Qwen3.6-27B-OptiQ-4bit" | "muse-spark-1.2" | "muse-spark-1.2-contributor" | "openai/gpt-oss-120b" | (string & {});
-export type ToolName = "bash" | "bash_output" | "bash_kill" | "read_file" | "edit_file" | "write_file" | "webfetch" | "skill" | "codedb" | "read_tool_result" | "render_html" | "todo_write" | "todo_read" | "eval" | "note_constraint" | "ask_user" | "attempt_completion" | "load_tool_schemas" | "mcp_search_tools" | "mcp_select_tool" | "clock_sleep" | "subagent" | "workflow" | "agent_output" | "learn_candidate" | "peer_message" | "workspace" | "imagegen" | "rlm";
+export type ToolName = "shell" | "read_file" | "edit_file" | "write_file" | "webfetch" | "skill" | "codedb" | "read_tool_result" | "render_html" | "todo_write" | "todo_read" | "eval" | "note_constraint" | "ask_user" | "attempt_completion" | "load_tool_schemas" | "mcp_search_tools" | "mcp_select_tool" | "clock_sleep" | "subagent" | "workflow" | "agent_output" | "learn_candidate" | "peer_message" | "workspace" | "imagegen" | "rlm";
export type ProviderId = "anthropic" | "codegraff" | "deepseek" | "openai" | "google" | "minimax" | "xiaomi" | "kilo" | "groq" | "cerebras" | "mistral" | "kimi" | "moonshot" | "xai" | "zai" | "meta" | "vercel" | "openrouter" | "fugu" | "fireworks" | "mlx" | "lmstudio" | "codex";
/** Events streamed by `harness --json` (one JSON object per stdout line), each
@@ -675,4 +675,4 @@ export async function* runAgent(opts: RunAgentOptions): AsyncGenerator<Event> {
}
export const MODELS: ModelName[] = ["MiniMax-M2.5", "MiniMax-M2.7", "MiniMax-M3", "accounts/fireworks/models/deepseek-v4-flash", "accounts/fireworks/models/deepseek-v4-pro", "accounts/fireworks/models/glm-5p2", "accounts/fireworks/models/gpt-oss-120b", "accounts/fireworks/models/kimi-k2p6", "accounts/fireworks/models/kimi-k2p7-code", "accounts/fireworks/models/minimax-m3", "accounts/fireworks/models/qwen3p7-plus", "alibaba/qwen3.8-27b", "anthropic/claude-sonnet-4.6", "claude-fable-5", "claude-haiku-4-5", "claude-opus-4-5", "claude-opus-4-6", "claude-opus-4-7", "claude-opus-4-8", "claude-opus-4.8", "claude-opus-5", "claude-sonnet-4-5", "claude-sonnet-4-6", "claude-sonnet-4.6", "claude-sonnet-5", "deepseek-chat", "deepseek-reasoner", "deepseek-v4-flash", "deepseek-v4-pro", "fugu", "fugu-ultra", "fugu-ultra-20260615", "gemini-3-flash-preview", "gemini-3.1-flash-lite", "gemini-3.1-pro-preview", "gemini-3.5-flash", "gemini-3.5-flash-lite", "gemini-3.6-flash", "gemini-3.7-flash", "gemini-3.8-flash", "gemma-4-26b-a4b-it", "gemma-4-31b", "gemma-4-31b-it", "glm-4.5", "glm-4.7", "glm-5", "glm-5-turbo", "glm-5.2", "glm-5.3", "glm-5.3-flash", "glm-5v-turbo", "gpt-5-codex", "gpt-5.2", "gpt-5.3-codex-spark", "gpt-5.4", "gpt-5.4-mini", "gpt-5.4-pro", "gpt-5.5", "gpt-5.6", "gpt-5.6-luna", "gpt-5.6-sol", "gpt-5.6-terra", "gpt-6-astra", "gpt-oss-120b", "grok-4.3", "grok-4.6", "grok-build", "k3", "kilo-auto/small", "kimi-for-coding", "kimi-for-coding-highspeed", "kimi-k2.6", "kimi-k2.7-code", "kimi-k3", "kimi-latest", "lmstudio", "mimo-v2-flash", "mimo-v2.5", "mimo-v2.5-pro", "mimo-v2.5-pro-ultraspeed", "minimax-m3", "mistral-medium-latest", "mlx-community/Qwen3.6-27B-OptiQ-4bit", "muse-spark-1.2", "muse-spark-1.2-contributor", "openai/gpt-oss-120b"];
-export const TOOLS: ToolName[] = ["bash", "bash_output", "bash_kill", "read_file", "edit_file", "write_file", "webfetch", "skill", "codedb", "read_tool_result", "render_html", "todo_write", "todo_read", "eval", "note_constraint", "ask_user", "attempt_completion", "load_tool_schemas", "mcp_search_tools", "mcp_select_tool", "clock_sleep", "subagent", "workflow", "agent_output", "learn_candidate", "peer_message", "workspace", "imagegen", "rlm"];
+export const TOOLS: ToolName[] = ["shell", "read_file", "edit_file", "write_file", "webfetch", "skill", "codedb", "read_tool_result", "render_html", "todo_write", "todo_read", "eval", "note_constraint", "ask_user", "attempt_completion", "load_tool_schemas", "mcp_search_tools", "mcp_select_tool", "clock_sleep", "subagent", "workflow", "agent_output", "learn_candidate", "peer_message", "workspace", "imagegen", "rlm"];
diff --git a/sdk/ts/remote.ts b/sdk/ts/remote.ts
index fca53126..5faa01ba 100644
--- a/sdk/ts/remote.ts
+++ b/sdk/ts/remote.ts
@@ -10,7 +10,7 @@
export const HARNESS_VERSION = "0.13";
export type ModelName = "MiniMax-M2.5" | "MiniMax-M2.7" | "MiniMax-M3" | "accounts/fireworks/models/deepseek-v4-flash" | "accounts/fireworks/models/deepseek-v4-pro" | "accounts/fireworks/models/glm-5p2" | "accounts/fireworks/models/gpt-oss-120b" | "accounts/fireworks/models/kimi-k2p6" | "accounts/fireworks/models/kimi-k2p7-code" | "accounts/fireworks/models/minimax-m3" | "accounts/fireworks/models/qwen3p7-plus" | "alibaba/qwen3.8-27b" | "anthropic/claude-sonnet-4.6" | "claude-fable-5" | "claude-haiku-4-5" | "claude-opus-4-5" | "claude-opus-4-6" | "claude-opus-4-7" | "claude-opus-4-8" | "claude-opus-4.8" | "claude-opus-5" | "claude-sonnet-4-5" | "claude-sonnet-4-6" | "claude-sonnet-4.6" | "claude-sonnet-5" | "deepseek-chat" | "deepseek-reasoner" | "deepseek-v4-flash" | "deepseek-v4-pro" | "fugu" | "fugu-ultra" | "fugu-ultra-20260615" | "gemini-3-flash-preview" | "gemini-3.1-flash-lite" | "gemini-3.1-pro-preview" | "gemini-3.5-flash" | "gemini-3.5-flash-lite" | "gemini-3.6-flash" | "gemini-3.7-flash" | "gemini-3.8-flash" | "gemma-4-26b-a4b-it" | "gemma-4-31b" | "gemma-4-31b-it" | "glm-4.5" | "glm-4.7" | "glm-5" | "glm-5-turbo" | "glm-5.2" | "glm-5.3" | "glm-5.3-flash" | "glm-5v-turbo" | "gpt-5-codex" | "gpt-5.2" | "gpt-5.3-codex-spark" | "gpt-5.4" | "gpt-5.4-mini" | "gpt-5.4-pro" | "gpt-5.5" | "gpt-5.6" | "gpt-5.6-luna" | "gpt-5.6-sol" | "gpt-5.6-terra" | "gpt-6-astra" | "gpt-oss-120b" | "grok-4.3" | "grok-4.6" | "grok-build" | "k3" | "kilo-auto/small" | "kimi-for-coding" | "kimi-for-coding-highspeed" | "kimi-k2.6" | "kimi-k2.7-code" | "kimi-k3" | "kimi-latest" | "lmstudio" | "mimo-v2-flash" | "mimo-v2.5" | "mimo-v2.5-pro" | "mimo-v2.5-pro-ultraspeed" | "minimax-m3" | "mistral-medium-latest" | "mlx-community/Qwen3.6-27B-OptiQ-4bit" | "muse-spark-1.2" | "muse-spark-1.2-contributor" | "openai/gpt-oss-120b" | (string & {});
-export type ToolName = "bash" | "bash_output" | "bash_kill" | "read_file" | "edit_file" | "write_file" | "webfetch" | "skill" | "codedb" | "read_tool_result" | "render_html" | "todo_write" | "todo_read" | "eval" | "note_constraint" | "ask_user" | "attempt_completion" | "load_tool_schemas" | "mcp_search_tools" | "mcp_select_tool" | "clock_sleep" | "subagent" | "workflow" | "agent_output" | "learn_candidate" | "peer_message" | "workspace" | "imagegen" | "rlm";
+export type ToolName = "shell" | "read_file" | "edit_file" | "write_file" | "webfetch" | "skill" | "codedb" | "read_tool_result" | "render_html" | "todo_write" | "todo_read" | "eval" | "note_constraint" | "ask_user" | "attempt_completion" | "load_tool_schemas" | "mcp_search_tools" | "mcp_select_tool" | "clock_sleep" | "subagent" | "workflow" | "agent_output" | "learn_candidate" | "peer_message" | "workspace" | "imagegen" | "rlm";
export type ProviderId = "anthropic" | "codegraff" | "deepseek" | "openai" | "google" | "minimax" | "xiaomi" | "kilo" | "groq" | "cerebras" | "mistral" | "kimi" | "moonshot" | "xai" | "zai" | "meta" | "vercel" | "openrouter" | "fugu" | "fireworks" | "mlx" | "lmstudio" | "codex";
/** Events streamed by the bridge (same `--json` contract as the stdio SDK).
@@ -522,4 +522,4 @@ export async function* runAgentRemote(opts: RunAgentRemoteOptions): AsyncGenerat
}
export const MODELS: ModelName[] = ["MiniMax-M2.5", "MiniMax-M2.7", "MiniMax-M3", "accounts/fireworks/models/deepseek-v4-flash", "accounts/fireworks/models/deepseek-v4-pro", "accounts/fireworks/models/glm-5p2", "accounts/fireworks/models/gpt-oss-120b", "accounts/fireworks/models/kimi-k2p6", "accounts/fireworks/models/kimi-k2p7-code", "accounts/fireworks/models/minimax-m3", "accounts/fireworks/models/qwen3p7-plus", "alibaba/qwen3.8-27b", "anthropic/claude-sonnet-4.6", "claude-fable-5", "claude-haiku-4-5", "claude-opus-4-5", "claude-opus-4-6", "claude-opus-4-7", "claude-opus-4-8", "claude-opus-4.8", "claude-opus-5", "claude-sonnet-4-5", "claude-sonnet-4-6", "claude-sonnet-4.6", "claude-sonnet-5", "deepseek-chat", "deepseek-reasoner", "deepseek-v4-flash", "deepseek-v4-pro", "fugu", "fugu-ultra", "fugu-ultra-20260615", "gemini-3-flash-preview", "gemini-3.1-flash-lite", "gemini-3.1-pro-preview", "gemini-3.5-flash", "gemini-3.5-flash-lite", "gemini-3.6-flash", "gemini-3.7-flash", "gemini-3.8-flash", "gemma-4-26b-a4b-it", "gemma-4-31b", "gemma-4-31b-it", "glm-4.5", "glm-4.7", "glm-5", "glm-5-turbo", "glm-5.2", "glm-5.3", "glm-5.3-flash", "glm-5v-turbo", "gpt-5-codex", "gpt-5.2", "gpt-5.3-codex-spark", "gpt-5.4", "gpt-5.4-mini", "gpt-5.4-pro", "gpt-5.5", "gpt-5.6", "gpt-5.6-luna", "gpt-5.6-sol", "gpt-5.6-terra", "gpt-6-astra", "gpt-oss-120b", "grok-4.3", "grok-4.6", "grok-build", "k3", "kilo-auto/small", "kimi-for-coding", "kimi-for-coding-highspeed", "kimi-k2.6", "kimi-k2.7-code", "kimi-k3", "kimi-latest", "lmstudio", "mimo-v2-flash", "mimo-v2.5", "mimo-v2.5-pro", "mimo-v2.5-pro-ultraspeed", "minimax-m3", "mistral-medium-latest", "mlx-community/Qwen3.6-27B-OptiQ-4bit", "muse-spark-1.2", "muse-spark-1.2-contributor", "openai/gpt-oss-120b"];
-export const TOOLS: ToolName[] = ["bash", "bash_output", "bash_kill", "read_file", "edit_file", "write_file", "webfetch", "skill", "codedb", "read_tool_result", "render_html", "todo_write", "todo_read", "eval", "note_constraint", "ask_user", "attempt_completion", "load_tool_schemas", "mcp_search_tools", "mcp_select_tool", "clock_sleep", "subagent", "workflow", "agent_output", "learn_candidate", "peer_message", "workspace", "imagegen", "rlm"];
+export const TOOLS: ToolName[] = ["shell", "read_file", "edit_file", "write_file", "webfetch", "skill", "codedb", "read_tool_result", "render_html", "todo_write", "todo_read", "eval", "note_constraint", "ask_user", "attempt_completion", "load_tool_schemas", "mcp_search_tools", "mcp_select_tool", "clock_sleep", "subagent", "workflow", "agent_output", "learn_candidate", "peer_message", "workspace", "imagegen", "rlm"];
diff --git a/spec/kernels/tool_catalog.json b/spec/kernels/tool_catalog.json
index 12977ed7..b49e3e01 100644
--- a/spec/kernels/tool_catalog.json
+++ b/spec/kernels/tool_catalog.json
@@ -3,9 +3,7 @@
"version": 1,
"universe": {
"base": [
- "bash",
- "bash_output",
- "bash_kill",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -39,9 +37,7 @@
"imagegen"
],
"local": [
- "bash",
- "bash_output",
- "bash_kill",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -51,7 +47,7 @@
"imagegen"
],
"lean": [
- "bash",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -73,9 +69,7 @@
"seat": "root"
},
"advertised": [
- "bash",
- "bash_output",
- "bash_kill",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -114,9 +108,7 @@
"seat": "sub"
},
"advertised": [
- "bash",
- "bash_output",
- "bash_kill",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -141,9 +133,7 @@
"seat": "root"
},
"advertised": [
- "bash",
- "bash_output",
- "bash_kill",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -183,9 +173,7 @@
"seat": "sub"
},
"advertised": [
- "bash",
- "bash_output",
- "bash_kill",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -210,9 +198,7 @@
"seat": "root"
},
"advertised": [
- "bash",
- "bash_output",
- "bash_kill",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -252,9 +238,7 @@
"seat": "sub"
},
"advertised": [
- "bash",
- "bash_output",
- "bash_kill",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -279,9 +263,7 @@
"seat": "root"
},
"advertised": [
- "bash",
- "bash_output",
- "bash_kill",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -322,9 +304,7 @@
"seat": "sub"
},
"advertised": [
- "bash",
- "bash_output",
- "bash_kill",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -349,9 +329,7 @@
"seat": "root"
},
"advertised": [
- "bash",
- "bash_output",
- "bash_kill",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -389,9 +367,7 @@
"seat": "sub"
},
"advertised": [
- "bash",
- "bash_output",
- "bash_kill",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -415,9 +391,7 @@
"seat": "root"
},
"advertised": [
- "bash",
- "bash_output",
- "bash_kill",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -456,9 +430,7 @@
"seat": "sub"
},
"advertised": [
- "bash",
- "bash_output",
- "bash_kill",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -482,9 +454,7 @@
"seat": "root"
},
"advertised": [
- "bash",
- "bash_output",
- "bash_kill",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -523,9 +493,7 @@
"seat": "sub"
},
"advertised": [
- "bash",
- "bash_output",
- "bash_kill",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -549,9 +517,7 @@
"seat": "root"
},
"advertised": [
- "bash",
- "bash_output",
- "bash_kill",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -591,9 +557,7 @@
"seat": "sub"
},
"advertised": [
- "bash",
- "bash_output",
- "bash_kill",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -617,7 +581,7 @@
"seat": "root"
},
"advertised": [
- "bash",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -641,9 +605,7 @@
"seat": "sub"
},
"advertised": [
- "bash",
- "bash_output",
- "bash_kill",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -668,7 +630,7 @@
"seat": "root"
},
"advertised": [
- "bash",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -692,9 +654,7 @@
"seat": "sub"
},
"advertised": [
- "bash",
- "bash_output",
- "bash_kill",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -719,7 +679,7 @@
"seat": "root"
},
"advertised": [
- "bash",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -743,9 +703,7 @@
"seat": "sub"
},
"advertised": [
- "bash",
- "bash_output",
- "bash_kill",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -770,7 +728,7 @@
"seat": "root"
},
"advertised": [
- "bash",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -794,9 +752,7 @@
"seat": "sub"
},
"advertised": [
- "bash",
- "bash_output",
- "bash_kill",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -821,7 +777,7 @@
"seat": "root"
},
"advertised": [
- "bash",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -843,9 +799,7 @@
"seat": "sub"
},
"advertised": [
- "bash",
- "bash_output",
- "bash_kill",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -869,7 +823,7 @@
"seat": "root"
},
"advertised": [
- "bash",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -891,9 +845,7 @@
"seat": "sub"
},
"advertised": [
- "bash",
- "bash_output",
- "bash_kill",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -917,7 +869,7 @@
"seat": "root"
},
"advertised": [
- "bash",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -939,9 +891,7 @@
"seat": "sub"
},
"advertised": [
- "bash",
- "bash_output",
- "bash_kill",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -965,7 +915,7 @@
"seat": "root"
},
"advertised": [
- "bash",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -987,9 +937,7 @@
"seat": "sub"
},
"advertised": [
- "bash",
- "bash_output",
- "bash_kill",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -1031,15 +979,13 @@
"workspace"
],
"blocked": [
- "bash",
- "bash_kill",
- "bash_output",
"codedb",
"edit_file",
"imagegen",
"read_file",
"read_tool_result",
"render_html",
+ "shell",
"write_file"
]
},
@@ -1058,15 +1004,13 @@
"skill"
],
"blocked": [
- "bash",
- "bash_kill",
- "bash_output",
"codedb",
"edit_file",
"imagegen",
"read_file",
"read_tool_result",
"render_html",
+ "shell",
"write_file"
]
},
@@ -1100,15 +1044,13 @@
"workspace"
],
"blocked": [
- "bash",
- "bash_kill",
- "bash_output",
"codedb",
"edit_file",
"imagegen",
"read_file",
"read_tool_result",
"render_html",
+ "shell",
"write_file"
]
},
@@ -1127,15 +1069,13 @@
"skill"
],
"blocked": [
- "bash",
- "bash_kill",
- "bash_output",
"codedb",
"edit_file",
"imagegen",
"read_file",
"read_tool_result",
"render_html",
+ "shell",
"write_file"
]
},
@@ -1169,15 +1109,13 @@
"workspace"
],
"blocked": [
- "bash",
- "bash_kill",
- "bash_output",
"codedb",
"edit_file",
"imagegen",
"read_file",
"read_tool_result",
"render_html",
+ "shell",
"write_file"
]
},
@@ -1196,15 +1134,13 @@
"skill"
],
"blocked": [
- "bash",
- "bash_kill",
- "bash_output",
"codedb",
"edit_file",
"imagegen",
"read_file",
"read_tool_result",
"render_html",
+ "shell",
"write_file"
]
},
@@ -1239,15 +1175,13 @@
"workspace"
],
"blocked": [
- "bash",
- "bash_kill",
- "bash_output",
"codedb",
"edit_file",
"imagegen",
"read_file",
"read_tool_result",
"render_html",
+ "shell",
"write_file"
]
},
@@ -1266,15 +1200,13 @@
"skill"
],
"blocked": [
- "bash",
- "bash_kill",
- "bash_output",
"codedb",
"edit_file",
"imagegen",
"read_file",
"read_tool_result",
"render_html",
+ "shell",
"write_file"
]
},
@@ -1307,15 +1239,13 @@
"workspace"
],
"blocked": [
- "bash",
- "bash_kill",
- "bash_output",
"codedb",
"edit_file",
"imagegen",
"read_file",
"read_tool_result",
"render_html",
+ "shell",
"write_file"
]
},
@@ -1334,15 +1264,13 @@
"skill"
],
"blocked": [
- "bash",
- "bash_kill",
- "bash_output",
"codedb",
"edit_file",
"imagegen",
"read_file",
"read_tool_result",
"render_html",
+ "shell",
"write_file"
]
},
@@ -1376,15 +1304,13 @@
"workspace"
],
"blocked": [
- "bash",
- "bash_kill",
- "bash_output",
"codedb",
"edit_file",
"imagegen",
"read_file",
"read_tool_result",
"render_html",
+ "shell",
"write_file"
]
},
@@ -1403,15 +1329,13 @@
"skill"
],
"blocked": [
- "bash",
- "bash_kill",
- "bash_output",
"codedb",
"edit_file",
"imagegen",
"read_file",
"read_tool_result",
"render_html",
+ "shell",
"write_file"
]
},
@@ -1445,15 +1369,13 @@
"workspace"
],
"blocked": [
- "bash",
- "bash_kill",
- "bash_output",
"codedb",
"edit_file",
"imagegen",
"read_file",
"read_tool_result",
"render_html",
+ "shell",
"write_file"
]
},
@@ -1472,15 +1394,13 @@
"skill"
],
"blocked": [
- "bash",
- "bash_kill",
- "bash_output",
"codedb",
"edit_file",
"imagegen",
"read_file",
"read_tool_result",
"render_html",
+ "shell",
"write_file"
]
},
@@ -1515,15 +1435,13 @@
"workspace"
],
"blocked": [
- "bash",
- "bash_kill",
- "bash_output",
"codedb",
"edit_file",
"imagegen",
"read_file",
"read_tool_result",
"render_html",
+ "shell",
"write_file"
]
},
@@ -1542,15 +1460,13 @@
"skill"
],
"blocked": [
- "bash",
- "bash_kill",
- "bash_output",
"codedb",
"edit_file",
"imagegen",
"read_file",
"read_tool_result",
"render_html",
+ "shell",
"write_file"
]
},
@@ -1570,15 +1486,13 @@
"subagent"
],
"blocked": [
- "bash",
- "bash_kill",
- "bash_output",
"codedb",
"edit_file",
"imagegen",
"read_file",
"read_tool_result",
"render_html",
+ "shell",
"write_file"
]
},
@@ -1597,15 +1511,13 @@
"skill"
],
"blocked": [
- "bash",
- "bash_kill",
- "bash_output",
"codedb",
"edit_file",
"imagegen",
"read_file",
"read_tool_result",
"render_html",
+ "shell",
"write_file"
]
},
@@ -1625,15 +1537,13 @@
"subagent"
],
"blocked": [
- "bash",
- "bash_kill",
- "bash_output",
"codedb",
"edit_file",
"imagegen",
"read_file",
"read_tool_result",
"render_html",
+ "shell",
"write_file"
]
},
@@ -1652,15 +1562,13 @@
"skill"
],
"blocked": [
- "bash",
- "bash_kill",
- "bash_output",
"codedb",
"edit_file",
"imagegen",
"read_file",
"read_tool_result",
"render_html",
+ "shell",
"write_file"
]
},
@@ -1680,15 +1588,13 @@
"subagent"
],
"blocked": [
- "bash",
- "bash_kill",
- "bash_output",
"codedb",
"edit_file",
"imagegen",
"read_file",
"read_tool_result",
"render_html",
+ "shell",
"write_file"
]
},
@@ -1707,15 +1613,13 @@
"skill"
],
"blocked": [
- "bash",
- "bash_kill",
- "bash_output",
"codedb",
"edit_file",
"imagegen",
"read_file",
"read_tool_result",
"render_html",
+ "shell",
"write_file"
]
},
@@ -1735,15 +1639,13 @@
"subagent"
],
"blocked": [
- "bash",
- "bash_kill",
- "bash_output",
"codedb",
"edit_file",
"imagegen",
"read_file",
"read_tool_result",
"render_html",
+ "shell",
"write_file"
]
},
@@ -1762,15 +1664,13 @@
"skill"
],
"blocked": [
- "bash",
- "bash_kill",
- "bash_output",
"codedb",
"edit_file",
"imagegen",
"read_file",
"read_tool_result",
"render_html",
+ "shell",
"write_file"
]
},
@@ -1790,15 +1690,13 @@
"subagent"
],
"blocked": [
- "bash",
- "bash_kill",
- "bash_output",
"codedb",
"edit_file",
"imagegen",
"read_file",
"read_tool_result",
"render_html",
+ "shell",
"write_file"
]
},
@@ -1817,15 +1715,13 @@
"skill"
],
"blocked": [
- "bash",
- "bash_kill",
- "bash_output",
"codedb",
"edit_file",
"imagegen",
"read_file",
"read_tool_result",
"render_html",
+ "shell",
"write_file"
]
},
@@ -1845,15 +1741,13 @@
"subagent"
],
"blocked": [
- "bash",
- "bash_kill",
- "bash_output",
"codedb",
"edit_file",
"imagegen",
"read_file",
"read_tool_result",
"render_html",
+ "shell",
"write_file"
]
},
@@ -1872,15 +1766,13 @@
"skill"
],
"blocked": [
- "bash",
- "bash_kill",
- "bash_output",
"codedb",
"edit_file",
"imagegen",
"read_file",
"read_tool_result",
"render_html",
+ "shell",
"write_file"
]
},
@@ -1900,15 +1792,13 @@
"subagent"
],
"blocked": [
- "bash",
- "bash_kill",
- "bash_output",
"codedb",
"edit_file",
"imagegen",
"read_file",
"read_tool_result",
"render_html",
+ "shell",
"write_file"
]
},
@@ -1927,15 +1817,13 @@
"skill"
],
"blocked": [
- "bash",
- "bash_kill",
- "bash_output",
"codedb",
"edit_file",
"imagegen",
"read_file",
"read_tool_result",
"render_html",
+ "shell",
"write_file"
]
},
@@ -1955,15 +1843,13 @@
"subagent"
],
"blocked": [
- "bash",
- "bash_kill",
- "bash_output",
"codedb",
"edit_file",
"imagegen",
"read_file",
"read_tool_result",
"render_html",
+ "shell",
"write_file"
]
},
@@ -1982,15 +1868,13 @@
"skill"
],
"blocked": [
- "bash",
- "bash_kill",
- "bash_output",
"codedb",
"edit_file",
"imagegen",
"read_file",
"read_tool_result",
"render_html",
+ "shell",
"write_file"
]
}
diff --git a/spec/ref/tool_catalog.py b/spec/ref/tool_catalog.py
index 2f19c768..6eb76bc4 100644
--- a/spec/ref/tool_catalog.py
+++ b/spec/ref/tool_catalog.py
@@ -11,9 +11,7 @@ from itertools import product
from typing import Iterable
LOCAL_TOOLS = (
- "bash",
- "bash_output",
- "bash_kill",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -23,7 +21,7 @@ LOCAL_TOOLS = (
"imagegen",
)
LEAN_TOOLS = (
- "bash",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -34,9 +32,7 @@ LEAN_TOOLS = (
)
OPTIONAL_TOOLS = ("imagegen",)
BASE_TOOLS = (
- "bash",
- "bash_output",
- "bash_kill",
+ "shell",
"read_file",
"edit_file",
"write_file",
diff --git a/src/agent.zig b/src/agent.zig
index 25e80f26..dd85a030 100644
--- a/src/agent.zig
+++ b/src/agent.zig
@@ -516,6 +516,7 @@ pub const Agent = struct {
/// runTurn consumes the marker without erasing a cancellation arriving later.
pub fn prepareRootTurn() void {
@import("cancel_source.zig").clear(); // flag + source (#728)
+ @import("job_wait.zig").followup_pending.store(false, .release);
root_turn_prepared.store(true, .release);
}
diff --git a/src/agent_eval_control.zig b/src/agent_eval_control.zig
index 78981526..999a0a6f 100644
--- a/src/agent_eval_control.zig
+++ b/src/agent_eval_control.zig
@@ -33,7 +33,8 @@ pub fn toolInvalidatesEval(call: ToolCall) bool {
if (std.mem.eql(u8, call.name, "read_file") or
std.mem.eql(u8, call.name, "codedb") or
std.mem.eql(u8, call.name, "bash_output") or
- std.mem.eql(u8, call.name, "bash_kill"))
+ std.mem.eql(u8, call.name, "bash_kill") or
+ @import("shell_tool.zig").isJobControl(call))
{
return false;
}
diff --git a/src/agent_interrupt.zig b/src/agent_interrupt.zig
index 221a42a8..e0ada677 100644
--- a/src/agent_interrupt.zig
+++ b/src/agent_interrupt.zig
@@ -194,6 +194,7 @@ pub fn escPressedFrom(input: anytype, echo: bool) bool {
std.heap.page_allocator.free(dup);
} else {
main_mod.g_steer_queue.append(std.heap.page_allocator, .{ .text = dup, .force = false }) catch std.heap.page_allocator.free(dup);
+ @import("job_wait.zig").noteFollowup();
}
} else |_| main_mod.g_steer_buf.clearRetainingCapacity();
repl_glue.steerUnlock();
diff --git a/src/exec.zig b/src/exec.zig
index 2eae89ff..6f4fa8e1 100644
--- a/src/exec.zig
+++ b/src/exec.zig
@@ -44,9 +44,8 @@ const confinedPath = approvals_mod.confinedPath;
const noSymlinkEscape = approvals_mod.noSymlinkEscape;
const jobs = @import("jobs.zig");
const runCapped = jobs.runCapped;
-const jobOutput = jobs.jobOutput;
-const jobKill = jobs.jobKill;
const exec_bash = @import("exec_bash.zig");
+const shell_tool = @import("shell_tool.zig");
const skills = @import("skills.zig");
const skill_docs = @import("skill_docs.zig");
const mcp_schema_gate = @import("mcp_schema_gate.zig"); // #416: refuse an MCP tool whose schema was never loaded
@@ -150,17 +149,21 @@ fn execToolInner(ctx: ToolCtx, call: ToolCall) !ToolOutput {
.text = try gpa.dupe(u8, "plan mode is on — read-only; describe the change instead of making it"),
.is_error = true,
};
- if (std.mem.eql(u8, call.name, "bash")) {
- if (strField(call.input, "command")) |cmd| if (!Approvals.readOnlyAllowed(cmd)) {
- // The root may have approved this external read-only path this
- // session (#64); subagents (from_sub) never get the external hatch.
- const ext_ok = !ctx.from_sub and if (ctx.approvals) |ap| ap.planReadAllowed(ctx.io, cmd) else false;
- if (!ext_ok) return .{
- .text = try gpa.dupe(u8, "plan mode is on — only read-only commands run; describe this command in the plan instead"),
- .is_error = true,
- };
+ if (shell_tool.isKill(call)) {
+ return .{
+ .text = try gpa.dupe(u8, "plan mode is on — only read-only commands run; describe this command in the plan instead"),
+ .is_error = true,
};
}
+ if (shell_tool.runCommand(call)) |cmd| if (!Approvals.readOnlyAllowed(cmd)) {
+ // The root may have approved this external read-only path this
+ // session (#64); subagents (from_sub) never get the external hatch.
+ const ext_ok = !ctx.from_sub and if (ctx.approvals) |ap| ap.planReadAllowed(ctx.io, cmd) else false;
+ if (!ext_ok) return .{
+ .text = try gpa.dupe(u8, "plan mode is on — only read-only commands run; describe this command in the plan instead"),
+ .is_error = true,
+ };
+ };
}
if (mcp.Registry.isMcp(call.name)) {
@@ -231,18 +234,7 @@ fn execToolInner(ctx: ToolCtx, call: ToolCall) !ToolOutput {
if (run.stdout.len == 0 and run.stderr.len == 0) try aw.writer.writeAll(if (ok) "learning run completed" else "learning run failed without output");
return .{ .text = try aw.toOwnedSlice(), .is_error = !ok };
}
- if (std.mem.eql(u8, call.name, "bash")) return exec_bash.exec(ctx, call);
- if (std.mem.eql(u8, call.name, "bash_output")) {
- const id = intField(input, "id") orelse return missingArg(gpa, "id");
- const wait_ms = intField(input, "wait_ms") orelse 0;
- if (id < 0 or id > std.math.maxInt(u32)) return .{ .text = try gpa.dupe(u8, "invalid job id"), .is_error = true };
- return jobOutput(gpa, io, @intCast(id), @intCast(@max(wait_ms, 0)));
- }
- if (std.mem.eql(u8, call.name, "bash_kill")) {
- const id = intField(input, "id") orelse return missingArg(gpa, "id");
- if (id < 0 or id > std.math.maxInt(u32)) return .{ .text = try gpa.dupe(u8, "invalid job id"), .is_error = true };
- return jobKill(gpa, io, @intCast(id));
- }
+ if (shell_tool.isFamily(call.name)) return shell_tool.exec(ctx, call);
if (std.mem.eql(u8, call.name, "webfetch")) {
const url = strField(input, "url") orelse return missingArg(gpa, "url");
if (!std.mem.startsWith(u8, url, "http://") and !std.mem.startsWith(u8, url, "https://")) return .{
@@ -418,6 +410,7 @@ test "internal learning respects the parent privacy ceiling" {
test { // main.zig is at the 600-line cap; exec.zig is these modules' importer, so the compiled-in references live here (the reach check diffs the test binary, not which file holds the line)
_ = exec_bash;
+ _ = shell_tool;
_ = @import("codedbpro_report.zig");
_ = @import("tool_balance.zig");
_ = @import("codedb_exec.zig");
diff --git a/src/exec_bash.zig b/src/exec_bash.zig
index c50050ab..f91b2176 100644
--- a/src/exec_bash.zig
+++ b/src/exec_bash.zig
@@ -75,10 +75,12 @@ fn startedText(gpa: Allocator, id: u32, cmd: []const u8, ssh: bool, auto_bg: boo
errdefer aw.deinit();
const w = &aw.writer;
try w.print("[job {d} started: {s}]\n", .{ id, cmd });
- if (auto_bg) {
- try w.print("Command exceeded the {d}s foreground wait and was automatically moved to the background. Process is still running. You are notified on exit — do not poll. bash_output(id {d}) is a snapshot, not wait-until-exit; omit wait_ms for an immediate snapshot. Leave it on /jobs or bash_kill it. Explicit run_in_background keeps wait-until-exit for intentional long work.", .{ wait_s, id });
+ if (@import("job_wait.zig").followup_pending.load(.acquire)) {
+ try w.print("Follow-up received while this was running; it was moved to the background so you can talk. Process is still running as job {d}. shell action=output wait_ms>0 waits until it exits; omit wait_ms for a snapshot. action=kill stops it.", .{id});
+ } else if (auto_bg) {
+ try w.print("Command exceeded the {d}s foreground wait and was automatically moved to the background. Process is still running. Waiting via shell action=output shows elapsed-time pulses so a long rebuild is distinguishable from a hang. You are notified on exit — do not poll. shell action=output id {d} wait_ms>0 waits until it exits; omit wait_ms for a snapshot. action=kill stops it.", .{ wait_s, id });
} else {
- try w.print("This is a persistent job. bash_output wait_ms is a snapshot timeout, not wait-until-exit — omit wait_ms for an immediate snapshot. You are notified on exit — do not poll. bash_output(id {d}) reads unread output. bash_kill stops it.", .{id});
+ try w.print("This is a persistent job. shell action=output wait_ms is a snapshot timeout, not wait-until-exit — omit wait_ms for an immediate snapshot. You are notified on exit — do not poll. action=output id {d} reads unread output. action=kill stops it.", .{id});
}
if (ssh) try w.writeAll(" Killing the local SSH job cannot prove a detached remote process stopped; verify the remote host.");
if (partial.len > 0) {
diff --git a/src/job_notify.zig b/src/job_notify.zig
index da54f7d5..604cf208 100644
--- a/src/job_notify.zig
+++ b/src/job_notify.zig
@@ -56,7 +56,7 @@ fn wakeLine(buf: []u8, n: Notice) []const u8 {
var head: [96]u8 = undefined;
const h = line(&head, n);
if (n.idle) return std.fmt.bufPrint(buf, "{s} — silent and unread past the idle stop; rerun it only if it is still needed.", .{h}) catch h;
- return std.fmt.bufPrint(buf, "{s} — unread output via bash_output; do not poll.", .{h}) catch h;
+ return std.fmt.bufPrint(buf, "{s} — unread output via shell action=output; do not poll.", .{h}) catch h;
}
/// Standalone notification convenience (tests). The job pump MUST split
diff --git a/src/job_wait.zig b/src/job_wait.zig
index fa302389..6d7aac23 100644
--- a/src/job_wait.zig
+++ b/src/job_wait.zig
@@ -10,6 +10,19 @@
const std = @import("std");
+/// Set when the user queues a follow-up (line-REPL steer Enter, TUI steer).
+/// `waitForeground` promotes instead of blocking the rest of the 120s wait,
+/// and does not kill the child — the next turn can talk while it runs.
+pub var followup_pending: std.atomic.Value(bool) = .init(false);
+
+pub fn noteFollowup() void {
+ followup_pending.store(true, .release);
+}
+
+pub fn shouldPromote(deadline_hit: bool, followup: bool) bool {
+ return deadline_hit or followup;
+}
+
/// Same 10-hour ceiling grok-build uses for a foreground/background wait.
pub const wait_cap_ms: u64 = 10 * 60 * 60 * 1000;
@@ -34,6 +47,12 @@ pub fn resolveDeadlineFor(wait_ms: u64, persistent: bool) u64 {
return wait_cap_ms;
}
+test "shouldPromote: follow-up unsticks; a bare wait does not" {
+ try std.testing.expect(shouldPromote(true, false));
+ try std.testing.expect(shouldPromote(false, true));
+ try std.testing.expect(!shouldPromote(false, false));
+}
+
test "resolveDeadline: snapshot stays zero" {
try std.testing.expectEqual(@as(u64, 0), resolveDeadline(0));
}
diff --git a/src/jobs.zig b/src/jobs.zig
index 085bf34b..1b7fbe50 100644
--- a/src/jobs.zig
+++ b/src/jobs.zig
@@ -529,7 +529,7 @@ pub fn waitForeground(gpa: Allocator, io: Io, id: u32, wait_ms: u64) !FgWait {
g_jobs.mutex.unlock(io);
return result;
}
- if (waited >= deadline) {
+ if (job_wait.shouldPromote(waited >= deadline, job_wait.followup_pending.load(.acquire))) {
const pair = takeUnread(gpa, job) catch {
g_jobs.mutex.unlock(io);
return error.OutOfMemory;
@@ -541,7 +541,7 @@ pub fn waitForeground(gpa: Allocator, io: Io, id: u32, wait_ms: u64) !FgWait {
}
g_jobs.mutex.unlock(io);
if (Agent.esc_cancel.load(.acquire)) {
- _ = jobKill(gpa, io, id) catch {};
+ if (jobKill(gpa, io, id)) |out| gpa.free(out.text) else |_| {}
g_jobs.mutex.lockUncancelable(io);
if (g_jobs.find(id)) |j| {
const pair = takeUnread(gpa, j) catch {
diff --git a/src/main.zig b/src/main.zig
index fddfcf22..e624babf 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -596,5 +596,5 @@ test { // ── Unit tests (`zig build test`): pull in tests from imported modu
_ = @import("subagent_recovery.zig");
_ = @import("acp_agent_activity.zig");
_ = @import("read_image.zig");
- _ = .{ @import("pr_local_checks.zig"), @import("mcp_names.zig"), @import("workspace_history.zig"), @import("file_worktree.zig"), @import("mcp_turn_context.zig"), @import("review_deadline.zig"), @import("issue_cmd.zig") };
+ _ = .{ @import("pr_local_checks.zig"), @import("mcp_names.zig"), @import("workspace_history.zig"), @import("file_worktree.zig"), @import("mcp_turn_context.zig"), @import("review_deadline.zig"), @import("issue_cmd.zig"), @import("shell_tool.zig") };
}
diff --git a/src/native_fold.zig b/src/native_fold.zig
index e2039fa7..897c81fd 100644
--- a/src/native_fold.zig
+++ b/src/native_fold.zig
@@ -35,7 +35,7 @@ pub var enabled = true;
/// plus the deliberate-act tools whose first use tolerates one load call —
/// measured (GRAFF_REQ_STATS top-5) at ~9.5k bytes of every request, with
/// subagent alone at 5,052 (26% of the tools surface).
-/// Deliberately NOT here: the every-turn loop (bash, the file tools, codedb),
+/// Deliberately NOT here: the every-turn loop (shell, the file tools, codedb),
/// loop control (ask_user, attempt_completion), and the meta arm itself
/// (load_tool_schemas must stay callable to unfold these). Subagents are
/// exempt at the call gates: their catalogs are comptime-baked full surfaces,
diff --git a/src/no_local_tools.zig b/src/no_local_tools.zig
index 01a24145..1a55aeaf 100644
--- a/src/no_local_tools.zig
+++ b/src/no_local_tools.zig
@@ -28,15 +28,15 @@ const Allocator = std.mem.Allocator;
/// `GRAFF_NO_LOCAL_TOOLS=1` (session_run.zig). Never flipped mid-session.
pub var enabled: bool = false;
-/// The built-in tools that reach this host: shell execution plus its two job
-/// controls, the three file tools, and codedb - which reads the host checkout
-/// through its own index. `webfetch` is deliberately absent: it is plain host
-/// HTTP with no sandbox to escape. So are the orchestration/meta tools, and
-/// everything MCP-sourced (an `mcp__*` name never matches here).
+/// The built-in tools that reach this host: the advertised `shell` tool, the
+/// three file tools, and codedb - which reads the host checkout through its
+/// own index. `webfetch` is deliberately absent: it is plain host HTTP with
+/// no sandbox to escape. So are the orchestration/meta tools, and everything
+/// MCP-sourced (an `mcp__*` name never matches here). `bash` /
+/// `bash_output` / `bash_kill` are dispatch aliases (gated_aliases): they
+/// are not advertised, but layer 2 still refuses them under this gate.
pub const gated_tools = [_][]const u8{
- "bash",
- "bash_output",
- "bash_kill",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -55,12 +55,22 @@ pub const gated_tools = [_][]const u8{
"render_html",
};
+/// Pre-unification names. Still dispatched, still blocked by --no-local-tools.
+pub const gated_aliases = [_][]const u8{
+ "bash",
+ "bash_output",
+ "bash_kill",
+};
+
/// A name test only, independent of whether the gate is on, so the comptime
/// catalog filter and the runtime refusal can share one list.
pub fn isLocalTool(name: []const u8) bool {
for (gated_tools) |tool| {
if (std.mem.eql(u8, name, tool)) return true;
}
+ for (gated_aliases) |tool| {
+ if (std.mem.eql(u8, name, tool)) return true;
+ }
return false;
}
@@ -84,7 +94,7 @@ pub var lean: bool = false;
/// hidden only when nothing is deferred. Overflow paging
/// (`read_tool_result`) is interactive.
pub const lean_tools = [_][]const u8{
- "bash",
+ "shell",
"read_file",
"edit_file",
"write_file",
@@ -129,7 +139,8 @@ pub const lean_subagent_desc = "Spawn a sidecar for a self-contained task. Child
/// One-shot tool prose (ADR 0046). Same names and JSON schemas; shorter
/// descriptions so flash models start and finish instead of rereading
/// essays. Do not drop to four tools (ADR 0024).
-pub const lean_bash_desc = "Run /bin/sh -c in cwd. Returns stdout, stderr, exit. Foreground still running after 15s (or a shorter timeout) backgrounds — bash_output(wait_ms>0) waits; do not poll.";
+pub const lean_shell_desc = "Run /bin/sh -c in cwd. action=run returns stdout/stderr/exit. Foreground still running after 15s (or a shorter timeout) backgrounds — action=output wait_ms>0 waits; do not poll.";
+pub const lean_bash_desc = lean_shell_desc;
pub const lean_read_file_desc = "Read a UTF-8 file. Call before editing. contains=exact-key numbered lines; start_line/end_line for a window.";
pub const lean_edit_file_desc = "Replace exact text. Prefer one batched edits[] over many calls. Prefer over write_file for an existing file.";
pub const lean_codedb_desc = "Indexed nav: context <task> (local) · around <name> · callpath A B · list_dir <path> · status. Prefer over bash grep/find/ls.";
@@ -137,7 +148,7 @@ pub const lean_attempt_completion_desc = "Task is done. Put the final answer in
fn leanCompactDesc(name: []const u8) ?[]const u8 {
if (std.mem.eql(u8, name, "subagent")) return lean_subagent_desc;
- if (std.mem.eql(u8, name, "bash")) return lean_bash_desc;
+ if (std.mem.eql(u8, name, "shell") or std.mem.eql(u8, name, "bash")) return lean_shell_desc;
if (std.mem.eql(u8, name, "read_file")) return lean_read_file_desc;
if (std.mem.eql(u8, name, "edit_file")) return lean_edit_file_desc;
if (std.mem.eql(u8, name, "codedb")) return lean_codedb_desc;
@@ -204,7 +215,8 @@ test "#330: the gated set is exactly the host-touching built-ins; webfetch, meta
defer enabled = saved;
for (gated_tools) |tool| try std.testing.expect(isLocalTool(tool));
- try std.testing.expectEqual(@as(usize, 10), gated_tools.len);
+ try std.testing.expectEqual(@as(usize, 8), gated_tools.len);
+ try std.testing.expect(isLocalTool("bash") and isLocalTool("bash_output") and isLocalTool("bash_kill"));
try std.testing.expect(isLocalTool("imagegen")); // #352: optional, but still a local spawn+write
try std.testing.expect(isLocalTool("render_html")); // writes the snapshot under the host's own $HOME
for ([_][]const u8{ "webfetch", "skill", "subagent", "workflow", "todo_write", "eval", "mcp__sandbox__exec", "mcp__sandbox__bash" }) |tool|
@@ -215,6 +227,7 @@ test "#330: the gated set is exactly the host-touching built-ins; webfetch, meta
for (gated_tools) |tool| try std.testing.expect(!blocks(tool));
enabled = true;
for (gated_tools) |tool| try std.testing.expect(blocks(tool));
+ try std.testing.expect(blocks("bash") and blocks("bash_output") and blocks("bash_kill"));
try std.testing.expect(!blocks("webfetch"));
try std.testing.expect(!blocks("mcp__sandbox__bash"));
}
@@ -227,7 +240,7 @@ test "#330: GRAFF_NO_LOCAL_TOOLS is affirmative-only" {
test "lean: the filter keeps exactly the seven one-shot tools, and allocates nothing when off" {
const Spec = struct { name: []const u8, desc: []const u8 = "" };
const specs = [_]Spec{
- .{ .name = "bash" },
+ .{ .name = "shell" },
.{ .name = "workflow" },
.{ .name = "read_file" },
.{ .name = "todo_write" },
@@ -248,7 +261,7 @@ test "lean: the filter keeps exactly the seven one-shot tools, and allocates not
lean = true;
const kept = try filterLeanSpecs(Spec, arena, &specs);
try std.testing.expectEqual(@as(usize, 4), kept.len);
- try std.testing.expectEqualStrings("bash", kept[0].name);
+ try std.testing.expectEqualStrings("shell", kept[0].name);
try std.testing.expectEqualStrings("read_file", kept[1].name);
try std.testing.expectEqualStrings("subagent", kept[2].name);
try std.testing.expectEqualStrings("attempt_completion", kept[3].name);
@@ -268,7 +281,7 @@ test "lean: the filter keeps exactly the seven one-shot tools, and allocates not
try std.testing.expectEqual(specs.len, compact.len);
for (compact) |s| {
if (std.mem.eql(u8, s.name, "subagent")) try std.testing.expectEqualStrings(lean_subagent_desc, s.desc);
- if (std.mem.eql(u8, s.name, "bash")) try std.testing.expectEqualStrings(lean_bash_desc, s.desc);
+ if (std.mem.eql(u8, s.name, "shell")) try std.testing.expectEqualStrings(lean_shell_desc, s.desc);
if (leanCompactDesc(s.name) == null) try std.testing.expectEqualStrings("", s.desc);
}
try std.testing.expect(lean_bash_desc.len < 200);
@@ -281,7 +294,7 @@ test "lean: the filter keeps exactly the seven one-shot tools, and allocates not
test "#330: filterRootSpecs drops only the gated names, and does not allocate when the gate is off" {
const Spec = struct { name: []const u8 };
const specs = [_]Spec{
- .{ .name = "bash" },
+ .{ .name = "shell" },
.{ .name = "webfetch" },
.{ .name = "read_file" },
.{ .name = "subagent" },
@@ -355,7 +368,8 @@ test "#330: neither catalog advertises a local tool under the gate, and webfetch
try std.testing.expect(std.mem.indexOf(u8, catalog, "\"name\":\"webfetch\"") != null);
}
// …and the ungated twins still carry them, so the filter is what changed.
- try std.testing.expect(std.mem.indexOf(u8, schema.tools_anthropic_sub, "\"name\":\"bash\"") != null);
+ try std.testing.expect(std.mem.indexOf(u8, schema.tools_anthropic_sub, "\"name\":\"shell\"") != null);
+ try std.testing.expect(std.mem.indexOf(u8, schema.tools_anthropic_sub, "\"name\":\"bash\"") == null);
}
test "#330: dispatch refuses a hallucinated bash call for the root AND for a subagent" {
diff --git a/src/review.zig b/src/review.zig
index 7cf99875..a894033e 100644
--- a/src/review.zig
+++ b/src/review.zig
@@ -73,12 +73,11 @@ pub fn rejectTool(arena: std.mem.Allocator, call: ToolCall) !?ExecResult {
std.mem.eql(u8, call.name, "codedb") or
std.mem.eql(u8, call.name, "attempt_completion")) return null;
- if (std.mem.eql(u8, call.name, "bash") and call.input == .object) {
- const command = call.input.object.get("command") orelse return denied(arena, call.name);
- const background = call.input.object.get("run_in_background");
- if (command == .string and
- (background == null or background.? != .bool or !background.?.bool) and
- policy.readOnlyAllowed(command.string)) return null;
+ const shell_tool = @import("shell_tool.zig");
+ if (shell_tool.isFamily(call.name) and call.input == .object) {
+ if (shell_tool.isJobControl(call)) return denied(arena, call.name);
+ const command = shell_tool.runCommand(call) orelse return denied(arena, call.name);
+ if (!shell_tool.isBackgroundRun(call) and policy.readOnlyAllowed(command)) return null;
}
return denied(arena, call.name);
}
diff --git a/src/rlm_tests.zig b/src/rlm_tests.zig
index 41da1e77..4cf1b75d 100644
--- a/src/rlm_tests.zig
+++ b/src/rlm_tests.zig
@@ -302,7 +302,7 @@ test "effectiveRootSpecs: default rlm keeps subagent; --old and --lean do not dr
try std.testing.expect(catalogHas(lean_on, "subagent"));
try std.testing.expect(catalogHas(lean_on, rlm.tool_name));
try std.testing.expect(!catalogHas(lean_on, "workflow"));
- try std.testing.expect(catalogHas(lean_on, "bash"));
+ try std.testing.expect(catalogHas(lean_on, "shell"));
try std.testing.expect(no_local_tools.leanKeeps("subagent"));
try std.testing.expect(!no_local_tools.leanKeeps(rlm.tool_name));
}
diff --git a/src/schema.zig b/src/schema.zig
index 1a6abd52..e0962dc6 100644
--- a/src/schema.zig
+++ b/src/schema.zig
@@ -18,6 +18,7 @@ const rlm = @import("rlm.zig");
const mcp_schema_gate = @import("mcp_schema_gate.zig"); // #416: load_tool_schemas strings
const mcp_select = @import("mcp_select.zig"); // fx search-then-select
const result_read = @import("result_read.zig"); // overflow handle pager
+const shell_tool = @import("shell_tool.zig");
const native_fold = @import("native_fold.zig"); // folded native power tools
const render = @import("schema_render.zig"); // the comptime provider-tool renderers moved out when #352's optional-tool catalogs doubled the number held here (600-line ceiling)
const anthropicToolsJson = render.anthropicToolsJson;
@@ -51,27 +52,7 @@ const empty_schema =
;
pub const base_specs = [_]ToolSpec{
- .{
- .name = "bash",
- .desc = "Run a shell command via /bin/sh -c in the current working directory. Returns stdout, stderr, and the exit code. A user-cancelled command reports cancelled (its whole local process group is killed; a remote process started over ssh may survive on the remote host). Foreground commands that are still running after 120s (or a shorter timeout ms) are moved to the background and return a job id — the process keeps running. For long-running commands set run_in_background true to skip the wait. You are notified on completion — do not poll. bash_output(wait_ms>0) blocks until exit (up to 10h); omit wait_ms for a snapshot. Stop it with bash_kill. A background job that writes nothing and is read by nobody for 2 hours is stopped for inactivity and you are told; rerun it only if it is still needed (the user pins a long-lived server with /jobs keep).",
- .schema =
- \\{"type": "object", "properties": {"command": {"type": "string", "description": "Shell command to execute"}, "timeout": {"type": "integer", "description": "Optional foreground wait in milliseconds before auto-background. A shorter value promotes earlier; a larger value cannot extend past the 120s (lean -p: 15s) bound — to wait for a genuinely long command, set run_in_background true and use bash_output(wait_ms>0), which blocks until exit (10h cap). 0 uses the default. Ignored when run_in_background is true."}, "run_in_background": {"type": "boolean", "description": "Start as a background job and return its id immediately instead of waiting (default false)"}}, "required": ["command"]}
- ,
- },
- .{
- .name = "bash_output",
- .desc = "Read a background bash job's unread output and status. wait_ms=0 (or omitted) is a snapshot. For a finite job, wait_ms>0 blocks until exit (10h cap). For a job started with run_in_background (a server), wait_ms is an actual millisecond timeout before a running snapshot — it will not wait for exit. Do not poll in a loop.",
- .schema =
- \\{"type": "object", "properties": {"id": {"type": "integer", "description": "Job id returned by bash with run_in_background"}, "wait_ms": {"type": "integer", "description": "0 = snapshot now. Finite jobs: >0 waits until exit (10h cap). Persistent servers: >0 is a millisecond timeout, then a running snapshot."}}, "required": ["id"]}
- ,
- },
- .{
- .name = "bash_kill",
- .desc = "Terminate a background bash job. Unread output stays readable via bash_output afterwards.",
- .schema =
- \\{"type": "object", "properties": {"id": {"type": "integer", "description": "Job id to terminate"}}, "required": ["id"]}
- ,
- },
+ .{ .name = shell_tool.tool_name, .desc = shell_tool.tool_desc, .schema = shell_tool.tool_schema },
.{
.name = "read_file",
.desc = "Read a UTF-8 text file or view a PNG/JPEG/GIF/WebP image up to 5 MiB. Read images one at a time; pixels reach the next model request when vision is supported. Call this before editing any text file. For a read-only exact-key lookup, pass contains to return only matching numbered lines instead of the whole file. Whole-file reads over 256 KiB return a short preview; pass start_line/end_line (1-based, inclusive) for a byte-exact window from any size file.",
@@ -248,7 +229,7 @@ pub const tools_responses_sub = responsesToolsJson(&base_specs);
// #330 layer 1, subagent half: the same three catalogs with the host-touching
// tools filtered out at compile time. agent.zig picks between the twins on
-// no_local_tools.enabled, so a child is never even told bash exists.
+// no_local_tools.enabled, so a child is never even told shell exists.
const base_specs_remote = no_local_tools.remoteSpecs(ToolSpec, &base_specs);
pub const tools_anthropic_sub_remote = anthropicToolsJson(base_specs_remote);
pub const tools_openai_sub_remote = openaiToolsJson(base_specs_remote);
@@ -579,7 +560,7 @@ test "agent_output: root-only (subagent/workflow's run_in_background has nothing
found_root = true;
};
try std.testing.expect(found_root);
- try std.testing.expect(!isMetaName("agent_output")); // dispatched like bash_output, not handled inline
+ try std.testing.expect(!isMetaName("agent_output")); // dispatched like shell action=output, not handled inline
// Subagents can't spawn subagents (execSubagent's from_sub gate), so they
// can never mint an agent id to poll — keep it out of their own catalog
diff --git a/src/schema_interactions.zig b/src/schema_interactions.zig
index 3f1aa8c5..5fa62ba2 100644
--- a/src/schema_interactions.zig
+++ b/src/schema_interactions.zig
@@ -54,7 +54,7 @@ test "the interactions catalog is the responses catalog without strict" {
// Same tools, same order, same schemas — only the field Google rejects differs.
try std.testing.expect(std.mem.indexOf(u8, schema.tools_responses_sub, "\"strict\":false") != null);
try std.testing.expect(std.mem.indexOf(u8, tools_interactions_sub, "strict") == null);
- try std.testing.expect(std.mem.indexOf(u8, tools_interactions_sub, "\"type\":\"function\",\"name\":\"bash\"") != null);
+ try std.testing.expect(std.mem.indexOf(u8, tools_interactions_sub, "\"type\":\"function\",\"name\":\"shell\"") != null);
var parsed = try std.json.parseFromSlice(std.json.Value, std.testing.allocator, tools_interactions_sub, .{});
defer parsed.deinit();
var responses_parsed = try std.json.parseFromSlice(std.json.Value, std.testing.allocator, schema.tools_responses_sub, .{});
diff --git a/src/schema_protocol.zig b/src/schema_protocol.zig
index f77764a4..d0c1168c 100644
--- a/src/schema_protocol.zig
+++ b/src/schema_protocol.zig
@@ -21,7 +21,7 @@ pub const flags =
\\ {"flag": "--no-lean", "arg": null, "description": "opt a one-shot out of the implied --lean: full tool surface and eager MCP schemas, the pre-default -p behavior"},
\\ {"flag": "--add-dir", "arg": "path", "description": "extra workspace root file tools may touch (repeatable, max 16). Complementary to workspace switch; extra roots do not contribute skills or sessions"},
\\ {"flag": "--context-limit", "arg": "name=N", "description": "named prefix byte cap: skill_catalog_bytes, mcp_schema_bytes, or agents_md_bytes (repeatable). GRAFF_CONTEXT_LIMIT is the env form"},
- \\ {"flag": "--no-local-tools", "arg": null, "description": "embedder mode: hard-disable the built-in bash/bash_output/bash_kill/read_file/edit_file/write_file/codedb tools for the whole process, so the harness can run outside the sandbox and source its coding tools from an MCP server instead; webfetch, orchestration and MCP tools are unaffected, and subagents inherit the gate. GRAFF_NO_LOCAL_TOOLS=1 is the equivalent"},
+ \\ {"flag": "--no-local-tools", "arg": null, "description": "embedder mode: hard-disable the built-in shell/read_file/edit_file/write_file/codedb tools (and bash/bash_output/bash_kill aliases) for the whole process, so the harness can run outside the sandbox and source its coding tools from an MCP server instead; webfetch, orchestration and MCP tools are unaffected, and subagents inherit the gate. GRAFF_NO_LOCAL_TOOLS=1 is the equivalent"},
\\ {"flag": "--system-prompt", "arg": "text", "description": "replace the built-in system prompt (cwd project-instructions file is still appended)"},
\\ {"flag": "--append-system-prompt", "arg": "text", "description": "append extra text to the end of the system prompt"},
\\ {"flag": "--json", "arg": null, "description": "structured stdio protocol (JSON in, JSONL events out)"},
diff --git a/src/shell_tool.zig b/src/shell_tool.zig
new file mode 100644
index 00000000..361ee44a
--- /dev/null
+++ b/src/shell_tool.zig
@@ -0,0 +1,203 @@
+//! One `shell` tool (fx-style) for run / output / kill.
+//!
+//! Catalog advertises `shell`. Dispatch still accepts `bash`, `bash_output`,
+//! and `bash_kill` so in-flight models and rlm `bash()` keep working.
+//! `action=interact` is refused: jobs spawn with stdin ignored (not a PTY).
+//! Typing in the composer during a live command is steer, not process stdin.
+
+const std = @import("std");
+const Allocator = std.mem.Allocator;
+const Value = std.json.Value;
+
+const tools = @import("tools.zig");
+const ToolCall = tools.ToolCall;
+const ToolCtx = tools.ToolCtx;
+const ToolOutput = tools.ToolOutput;
+const strField = tools.strField;
+const intField = tools.intField;
+const missingArg = tools.missingArg;
+
+const jobs = @import("jobs.zig");
+const exec_bash = @import("exec_bash.zig");
+
+pub const tool_name = "shell";
+pub const tool_desc = "Run a shell command via /bin/sh -c in the current working directory, read a background job, or stop one. action=run (default when command is set) returns stdout/stderr/exit. A user-cancelled command reports cancelled (its whole local process group is killed; a remote process started over ssh may survive on the remote host). Foreground commands still running after 120s (lean -p: 15s, or a shorter timeout ms) move to the background and return a job id. For long-running commands set run_in_background true to skip the wait. You are notified on completion — do not poll. action=output wait_ms>0 blocks until exit (up to 10h) for a finite job; omit wait_ms for a snapshot. action=kill stops it. A background job that writes nothing and is read by nobody for 2 hours is stopped for inactivity; the user pins a long-lived server with /jobs keep. bash/bash_output/bash_kill still dispatch. Not a PTY: you cannot type into the process. Type in the composer to steer the turn.";
+pub const tool_schema =
+ \\{"type": "object", "properties": {"action": {"type": "string", "enum": ["run", "output", "kill"], "description": "run a command, read a job, or stop a job. Default run when command is set."}, "command": {"type": "string", "description": "Shell command to execute (action=run)"}, "timeout": {"type": "integer", "description": "Optional foreground wait in milliseconds before auto-background. A shorter value promotes earlier; a larger value cannot extend past the 120s (lean -p: 15s) bound — to wait for a genuinely long command, set run_in_background true and use action=output wait_ms>0, which blocks until exit (10h cap). 0 uses the default. Ignored when run_in_background is true."}, "run_in_background": {"type": "boolean", "description": "Start as a background job and return its id immediately instead of waiting (default false)"}, "id": {"type": "integer", "description": "Job id for action=output or kill"}, "wait_ms": {"type": "integer", "description": "0 = snapshot now. Finite jobs: >0 waits until exit (10h cap). Persistent servers: >0 is a millisecond timeout, then a running snapshot."}}}
+;
+
+pub const Action = enum { run, output, kill };
+
+pub fn isFamily(name: []const u8) bool {
+ return std.mem.eql(u8, name, tool_name) or
+ std.mem.eql(u8, name, "bash") or
+ std.mem.eql(u8, name, "bash_output") or
+ std.mem.eql(u8, name, "bash_kill");
+}
+
+pub fn isAlias(name: []const u8) bool {
+ return std.mem.eql(u8, name, "bash") or
+ std.mem.eql(u8, name, "bash_output") or
+ std.mem.eql(u8, name, "bash_kill");
+}
+
+fn aliasAction(name: []const u8) ?Action {
+ if (std.mem.eql(u8, name, "bash")) return .run;
+ if (std.mem.eql(u8, name, "bash_output")) return .output;
+ if (std.mem.eql(u8, name, "bash_kill")) return .kill;
+ return null;
+}
+
+fn parseAction(name: []const u8, input: Value) error{ Missing, Interact, Unknown }!Action {
+ if (aliasAction(name)) |a| return a;
+ const raw = strField(input, "action") orelse {
+ if (strField(input, "command") != null) return .run;
+ return error.Missing;
+ };
+ if (std.mem.eql(u8, raw, "run")) return .run;
+ if (std.mem.eql(u8, raw, "output") or std.mem.eql(u8, raw, "wait")) return .output;
+ if (std.mem.eql(u8, raw, "kill") or std.mem.eql(u8, raw, "stop")) return .kill;
+ if (std.mem.eql(u8, raw, "interact") or std.mem.eql(u8, raw, "write")) return error.Interact;
+ return error.Unknown;
+}
+
+pub fn actionOf(call: ToolCall) ?Action {
+ return parseAction(call.name, call.input) catch null;
+}
+
+pub fn runCommand(call: ToolCall) ?[]const u8 {
+ const action = actionOf(call) orelse return null;
+ if (action != .run) return null;
+ return strField(call.input, "command");
+}
+
+pub fn isBackgroundRun(call: ToolCall) bool {
+ if (actionOf(call) != .run) return false;
+ const v = call.input.object.get("run_in_background") orelse return false;
+ return v == .bool and v.bool;
+}
+
+pub fn isJobControl(call: ToolCall) bool {
+ const action = actionOf(call) orelse return false;
+ return action == .output or action == .kill;
+}
+
+pub fn isKill(call: ToolCall) bool {
+ return actionOf(call) == .kill;
+}
+
+pub fn exec(ctx: ToolCtx, call: ToolCall) !ToolOutput {
+ const gpa = ctx.gpa;
+ const action = parseAction(call.name, call.input) catch |err| switch (err) {
+ error.Missing => return missingArg(gpa, "action or command"),
+ error.Interact => return .{
+ .text = try gpa.dupe(u8, "shell action=interact is not available: jobs ignore stdin (not a PTY). Use action=run with a non-interactive command, or action=output/kill on a job id. Type in the composer to steer the turn — that does not type into the process."),
+ .is_error = true,
+ },
+ error.Unknown => return .{
+ .text = try gpa.dupe(u8, "shell action must be run, output, or kill"),
+ .is_error = true,
+ },
+ };
+ switch (action) {
+ .run => {
+ if (strField(call.input, "command") == null) return missingArg(gpa, "command");
+ return exec_bash.exec(ctx, call);
+ },
+ .output => {
+ const id = intField(call.input, "id") orelse return missingArg(gpa, "id");
+ const wait_ms = intField(call.input, "wait_ms") orelse 0;
+ if (id < 0 or id > std.math.maxInt(u32)) return .{ .text = try gpa.dupe(u8, "invalid job id"), .is_error = true };
+ return jobs.jobOutput(gpa, ctx.io, @intCast(id), @intCast(@max(wait_ms, 0)));
+ },
+ .kill => {
+ const id = intField(call.input, "id") orelse return missingArg(gpa, "id");
+ if (id < 0 or id > std.math.maxInt(u32)) return .{ .text = try gpa.dupe(u8, "invalid job id"), .is_error = true };
+ return jobs.jobKill(gpa, ctx.io, @intCast(id));
+ },
+ }
+}
+
+fn parseCall(gpa: Allocator, name: []const u8, json: []const u8) !struct { parsed: std.json.Parsed(Value), call: ToolCall } {
+ const parsed = try std.json.parseFromSlice(Value, gpa, json, .{});
+ return .{ .parsed = parsed, .call = .{ .id = "t", .name = name, .input = parsed.value } };
+}
+
+test "shell actions: run default, aliases, interact refused" {
+ const gpa = std.testing.allocator;
+ {
+ var c = try parseCall(gpa, "shell", "{\"command\":\"echo hi\"}");
+ defer c.parsed.deinit();
+ try std.testing.expectEqual(Action.run, actionOf(c.call).?);
+ try std.testing.expectEqualStrings("echo hi", runCommand(c.call).?);
+ try std.testing.expect(!isBackgroundRun(c.call));
+ try std.testing.expect(!isJobControl(c.call));
+ }
+ {
+ var c = try parseCall(gpa, "shell", "{\"action\":\"output\",\"id\":3}");
+ defer c.parsed.deinit();
+ try std.testing.expectEqual(Action.output, actionOf(c.call).?);
+ try std.testing.expect(isJobControl(c.call));
+ try std.testing.expect(!isKill(c.call));
+ }
+ {
+ var c = try parseCall(gpa, "shell", "{\"action\":\"stop\",\"id\":3}");
+ defer c.parsed.deinit();
+ try std.testing.expectEqual(Action.kill, actionOf(c.call).?);
+ try std.testing.expect(isKill(c.call));
+ }
+ {
+ var c = try parseCall(gpa, "bash", "{\"command\":\"true\"}");
+ defer c.parsed.deinit();
+ try std.testing.expectEqual(Action.run, actionOf(c.call).?);
+ try std.testing.expect(isFamily("bash") and isAlias("bash"));
+ }
+ {
+ var c = try parseCall(gpa, "bash_output", "{\"id\":1}");
+ defer c.parsed.deinit();
+ try std.testing.expectEqual(Action.output, actionOf(c.call).?);
+ }
+ {
+ var c = try parseCall(gpa, "shell", "{\"action\":\"interact\",\"session_id\":\"x\"}");
+ defer c.parsed.deinit();
+ try std.testing.expect(actionOf(c.call) == null);
+ try std.testing.expectError(error.Interact, parseAction("shell", c.call.input));
+ }
+}
+
+test "shell interact dispatch names the missing PTY" {
+ const gpa = std.testing.allocator;
+ var parsed = try std.json.parseFromSlice(Value, gpa, "{\"action\":\"interact\",\"chars\":\"ls\\n\"}", .{});
+ defer parsed.deinit();
+ var client: std.http.Client = undefined;
+ const ctx: ToolCtx = .{
+ .gpa = gpa,
+ .io = std.testing.io,
+ .client = &client,
+ .provider = undefined,
+ .registry = null,
+ .from_sub = false,
+ .approvals = null,
+ .tracer = null,
+ };
+ const out = try exec(ctx, .{ .id = "t", .name = "shell", .input = parsed.value });
+ defer gpa.free(out.text);
+ try std.testing.expect(out.is_error);
+ try std.testing.expect(std.mem.indexOf(u8, out.text, "not a PTY") != null);
+}
+
+test "catalog advertises shell, not the three bash names" {
+ const schema = @import("schema.zig");
+ var saw_shell = false;
+ for (schema.base_specs) |t| {
+ try std.testing.expect(!std.mem.eql(u8, t.name, "bash"));
+ try std.testing.expect(!std.mem.eql(u8, t.name, "bash_output"));
+ try std.testing.expect(!std.mem.eql(u8, t.name, "bash_kill"));
+ if (std.mem.eql(u8, t.name, tool_name)) {
+ saw_shell = true;
+ try std.testing.expectEqualStrings(tool_desc, t.desc);
+ try std.testing.expectEqualStrings(tool_schema, t.schema);
+ }
+ }
+ try std.testing.expect(saw_shell);
+}
diff --git a/src/tool_balance.zig b/src/tool_balance.zig
index a15cde79..b0135d2a 100644
--- a/src/tool_balance.zig
+++ b/src/tool_balance.zig
@@ -64,7 +64,7 @@ fn firstToken(cmd: []const u8) []const u8 {
pub fn classOf(call: tools.ToolCall) Class {
const name = call.name;
if (std.mem.eql(u8, name, "read_file") or std.mem.eql(u8, name, "codedb")) return .native_read;
- if (std.mem.eql(u8, name, "bash")) {
+ if (std.mem.eql(u8, name, "bash") or std.mem.eql(u8, name, "shell")) {
const cmd = tools.strField(call.input, "command") orelse return .other;
const first = firstToken(cmd);
if (std.mem.eql(u8, first, "zigrep")) return .zigrep;
diff --git a/src/tool_gates.zig b/src/tool_gates.zig
index 749ccc0a..757e405f 100644
--- a/src/tool_gates.zig
+++ b/src/tool_gates.zig
@@ -203,7 +203,7 @@ test "#352: neither the root nor the SUBAGENT catalog mentions imagegen until it
// skill gate says yes — the two gates compose, and the subtractive one
// always wins.
try std.testing.expectEqual(!gated, std.mem.indexOf(u8, catalog, "\"imagegen\"") != null);
- try std.testing.expectEqual(!gated, std.mem.indexOf(u8, catalog, "\"name\":\"bash\"") != null);
+ try std.testing.expectEqual(!gated, std.mem.indexOf(u8, catalog, "\"name\":\"shell\"") != null);
var parsed = try std.json.parseFromSlice(std.json.Value, std.testing.allocator, catalog, .{});
defer parsed.deinit();
try std.testing.expect(parsed.value.array.items.len > 1);
diff --git a/src/tui_launch.zig b/src/tui_launch.zig
index a1a692d2..cd38b8af 100644
--- a/src/tui_launch.zig
+++ b/src/tui_launch.zig
@@ -27,6 +27,7 @@ const tui_sink = @import("tui_sink.zig");
const tui_acp = @import("tui_acp.zig");
const job_notify = @import("job_notify.zig");
const peer_idle = @import("peer_idle.zig");
+const job_wait = @import("job_wait.zig");
const schedule = @import("schedule.zig");
const channel_worker = @import("channel_worker.zig");
const util = @import("util.zig");
@@ -128,6 +129,8 @@ pub fn run(
tui_acp.attach(&acp_session);
defer tui_acp.detach();
acp_session.ensure();
+ tui.setFollowupFn(noteFollowupCb);
+ defer tui.setFollowupFn(null);
try tui.run(gpa, io, environ_map, .{
.turn_ctx = &repl_ctx,
.turn_fn = turnCb,
@@ -319,6 +322,10 @@ fn compactCb(ctx: ?*anyopaque, gpa: Allocator, history: []const tui.Turn, out: *
return ok;
}
+fn noteFollowupCb() void {
+ job_wait.noteFollowup();
+}
+
fn cancelCb(ctx: ?*anyopaque) void {
tui_acp.cancel();
repl_glue.replCancelCb(ctx);