Repository navigation
feat: Tern pane tools, a question card in sand's pane, and host commands with approval - #35
Merged
Merged
Conversation
When sand runs in a Tern pane, the agent gets tern_ls (the window's panes, not asked about) and tern_capture (a pane's text, with its scrollback if asked). sand runs `tern ls` / `tern capture` on the host through the bridge directory; reading a pane is confirmed once per pane for the session, panes are named by id alone, and their text stays out of network-prompts.log. The mod gives the tools to Claude Code's own UI, waiting through `node sand.mjs call`, since a hook may not wait for the person; the MCP server gives them over ACP. In a Tern pane, sand's questions (allow a host, mount a directory, read a pane) now float over sand's pane as a native Tern dialog (`sand tern-dialog`), falling back to the system dialog; SAND_TERN_DIALOG=0 keeps the system dialog.
In a Tern pane, sand's questions (a host to allow, a directory to mount, a pane to read) now come up in a native Tern card at the top of sand's own pane, over the agent's UI, which stays in sight and usable: the pointer goes through to it, and the card fades while the pointer is on the pane. A long question folds to three lines; minimize shrinks the card to a pulsing icon at the pane's top right. This replaces the split dialog (`sand tern-dialog`). sand only writes the surface (a `screen` surface, the kind Tern allows over a program on the alternate screen, with `listen: false`): the pane's input stays the agent's. The card's buttons are `sand-answer://` links carrying a secret per-question token, which sand's Tern plugin (assets/tern-plugin, installed and updated by sand) claims, checks against sand's request file and answers beside it. The plugin's styles keep the terminal visible under the card and let the pointer through. Without Tern, or when the card cannot be drawn, the system dialog asks; SAND_TERN_DIALOG=0 always uses it. In Claude Code's own UI the mod sends a blocked host or a mount request straight to the card (SAND_ASK_ON_HOST) instead of offering it in a row above the prompt first. The e2e tests no longer inherit TERN_PANE.
tern_run lets the agent propose a command the sandbox lacks (docker or podman, local servers and their logs, host-only tools). Each one is asked about in sand's card, shown whole with its directory and the agent's reason; on Allow it runs through the user's login shell in a new Tern pane floating over sand's, which stays open, and the agent may read that pane with tern_capture without a second question. Commands longer than 300 characters, spanning lines, or holding control, invisible or direction-changing characters are refused without asking; nothing is remembered between commands. While sand asks in Tern, the agent is told when to reach for tern_run, tern_ls and tern_capture: in Claude Code's system prompt from the mod (prompt.compose), and in the MCP server's instructions over ACP. The card now arrives expanded, highlighted with an amber ring that pulses twice; the hover fade is gone (minimize stays). A plugin linked for development is used while its major version matches, instead of sand falling back to the system dialog.
It stopped answering after about 5 seconds, so when node was slow to start (a Windows runner took over 5 minutes for the suite) the request came too late and the server reported that sand did not answer.
insertt
force-pushed
the
feat/tern-panes
branch
from
December 2, 2026 20:30
18442f6 to
35723eb
Compare
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.
First of a stack of four PRs (Tern integration → nightly images → shared sandboxes and worktrees → Tern follow-ups). Review and merge in order.
feat: read Tern panes from the sandbox, and ask in Tern's own dialog
When sand runs in a Tern pane, the agent gets tern_ls (the window's panes,
not asked about) and tern_capture (a pane's text, with its scrollback if
asked). sand runs
tern ls/tern captureon the host through the bridgedirectory; reading a pane is confirmed once per pane for the session, panes
are named by id alone, and their text stays out of network-prompts.log.
The mod gives the tools to Claude Code's own UI, waiting through
node sand.mjs call, since a hook may not wait for the person; the MCPserver gives them over ACP.
In a Tern pane, sand's questions (allow a host, mount a directory, read a
pane) now float over sand's pane as a native Tern dialog
(
sand tern-dialog), falling back to the system dialog;SAND_TERN_DIALOG=0 keeps the system dialog.
feat: ask sand's questions in a card at the top of its Tern pane
In a Tern pane, sand's questions (a host to allow, a directory to mount, a
pane to read) now come up in a native Tern card at the top of sand's own
pane, over the agent's UI, which stays in sight and usable: the pointer goes
through to it, and the card fades while the pointer is on the pane. A long
question folds to three lines; minimize shrinks the card to a pulsing icon
at the pane's top right. This replaces the split dialog (
sand tern-dialog).sand only writes the surface (a
screensurface, the kind Tern allows overa program on the alternate screen, with
listen: false): the pane's inputstays the agent's. The card's buttons are
sand-answer://links carrying asecret per-question token, which sand's Tern plugin (assets/tern-plugin,
installed and updated by sand) claims, checks against sand's request file
and answers beside it. The plugin's styles keep the terminal visible under
the card and let the pointer through. Without Tern, or when the card cannot
be drawn, the system dialog asks; SAND_TERN_DIALOG=0 always uses it.
In Claude Code's own UI the mod sends a blocked host or a mount request
straight to the card (SAND_ASK_ON_HOST) instead of offering it in a row
above the prompt first. The e2e tests no longer inherit TERN_PANE.
feat: run commands on the host from the sandbox, with approval in Tern
tern_run lets the agent propose a command the sandbox lacks (docker or
podman, local servers and their logs, host-only tools). Each one is asked
about in sand's card, shown whole with its directory and the agent's
reason; on Allow it runs through the user's login shell in a new Tern pane
floating over sand's, which stays open, and the agent may read that pane
with tern_capture without a second question. Commands longer than 300
characters, spanning lines, or holding control, invisible or
direction-changing characters are refused without asking; nothing is
remembered between commands.
While sand asks in Tern, the agent is told when to reach for tern_run,
tern_ls and tern_capture: in Claude Code's system prompt from the mod
(prompt.compose), and in the MCP server's instructions over ACP.
The card now arrives expanded, highlighted with an amber ring that pulses
twice; the hover fade is gone (minimize stays). A plugin linked for
development is used while its major version matches, instead of sand
falling back to the system dialog.
Checked locally on stable Rust:
cargo fmt --check,cargo clippy --all-targets --locked(with-D warnings) andcargo test --lockedpass.