feat(agent-input): !-prefix bash command mode#1414
Open
chphch wants to merge 1 commit into
Open
Conversation
Type a message starting with `!` to run it as a one-off shell command in the session's working directory instead of sending it to the agent — mirrors the Claude Code CLI's `!` bash mode. Per-message only, no persistent toggle. The command runs via the session-scoped `bash` RPC (the same handler that powers directory autocomplete), so it executes in and is sandboxed to the session cwd. The echoed command and its output are injected as local-only messages (no server round-trip), rendering the output in a fenced code block. Gated behind a new `expBashMode` experiment flag (off by default), with a toggle under Settings -> Features -> Experiments. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
!-prefix bash command mode to the chat input, mirroring the Claude Code CLI: a message that starts with!runs as a one-off shell command in the session's working directory instead of being sent to the agent, and its output renders inline. It's per-message only — there's no persistent mode toggle. The command runs over the existing session-scopedbashRPC (the same handler that powers directory autocomplete and Windowscmdsupport), so it executes in and is sandboxed to the session cwd; the echoed command and its output are injected as local-only messages (no server round-trip, the agent is never involved), with output shown in a fenced code block. It's gated behind a newexpBashModeexperiment flag (off by default — Settings → Features → Experiments), so default behaviour is unchanged.Proof
Captured locally via a standalone
happy-server(PGlite) + Expo web + a pairedhappy-clidaemon, authenticated through thegetDevWebQueryCredentials()dev URL bypass and driven headlessly with Playwright (live e2e — real daemon, real session). With the flag on, typing!pwdand!echo BASHMODE_OK_4242runs each as a shell command and renders the output in ashcode block; the agent is never invoked.Verification:
tsc --noEmitclean, settings unit tests pass (settings.spec.ts, 34/34), and the new strings are added to all 10 locale files. No new message kind and no reducer changes — the output reuses the existing agent-text markdown rendering.Related: addresses #568 (run shell commands from mobile without burning tokens). #597 proposes the same capability with a
$prefix; this uses!to mirror the Claude Code CLI's bash mode.