feat(vault): clipboard.backend selection (auto / arboard / osc52)#17
Merged
Conversation
New `clipboard.backend` config key choosing how the TUI's copy keys reach a clipboard: - auto (default): native arboard, else the TUI falls back to OSC52. - arboard: force the native backend (warns if unavailable). - osc52: the agent declines so the TUI copies through the terminal via an OSC52 escape — for SSH/tmux, so copies land on the local machine. The agent can't emit OSC52 itself (no terminal); this just makes it step aside for the TUI's existing client-side path. - vault-config: clipboard.backend key (validated to auto/arboard/osc52) -> --clipboard-backend auto-spawn flag. - vault-agent: clipboard::BackendChoice + select() (wraps detect()); the flag is defined unconditionally so a headless agent accepts it as a no-op. Status reports `osc52` even with no native backend held. Tests: vault-config validation/round-trip + agent_args emission; BackendChoice as_str/default, select(osc52)=None (CI-safe), Status osc52-mode label. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
New
clipboard.backendconfig key (PRD §7.1) choosing how the TUI's copy keysreach a clipboard:
auto(default, = today): the agent uses its native backend (arboard:Wayland / X11 / macOS); if none is reachable it declines and the TUI falls
back to OSC52.
arboard: force the native backend (warns if unavailable).osc52: the agent uses no native backend and declines, so the TUIcopies through the terminal via an OSC52 escape. Use this over SSH/tmux so
copies land on your local machine.
Why
osc52works this wayThe agent is a detached daemon with no terminal, so it can't emit OSC52 itself
(established in
clipboard.rs). The TUI already does client-side OSC52 when theagent returns
ClipboardUnavailable(vault-tui/src/osc52.rs).osc52simplymakes the agent decline on demand so that existing path runs — previously you
couldn't force it when the agent's box happened to have a (wrong, headless-X)
clipboard. Only the TUI sends
Copy/CopyText(the CLI has no copy verb), sothis cleanly scopes to TUI copies.
How
vault-config:clipboard.backendvalidated toauto/arboard/osc52→
--clipboard-backendauto-spawn flag (same plumbing as the other keys).vault-agent:clipboard::BackendChoice+select()wrapping theexisting
detect(). The--clipboard-backendflag is definedunconditionally, so a headless agent (
--no-default-features) stillaccepts it as a no-op.
vault statusreportsosc52even when no nativebackend is held.
Tests
vault-config: validation (rejects e.g.xclip), lower-casing, tomlround-trip,
agent_argsflag emission.vault-agent:BackendChoiceas_str/default;select(Osc52)isNone(CI-safe — no clipboard touch); a
Statustest for theosc52-mode label;existing fake-backend / headless
Statusassertions unchanged.Local CI-exact gates all green:
fmt, fresh isolatedclippy -D warnings,cargo test --workspace --all-targetsunderRUSTFLAGS=-D warnings,cargo deny check(no new deps), both headless builds (agent still accepts--clipboard-backend).🤖 Generated with Claude Code