Skip to content

feat(terminal): find, zoom, GPU render, prompt marks, OSC 7501 agent status, restore after restart - #422

Open
itsmeakhil wants to merge 2 commits into
mainfrom
feat/terminal-improvements
Open

itsmeakhil wants to merge 2 commits into
mainfrom
feat/terminal-improvements

Conversation

@itsmeakhil

Copy link
Copy Markdown
Owner

Improves the Terminal tool without a daemon or new backend. Borrows herdr's open status protocol (OSC 7501) instead of embedding herdr.

What changes

Daily-driver basics (pane)

  • ⌘F opens a find bar (@xterm/addon-search): Enter / ⇧Enter step through matches, Esc closes it.
  • ⌘K clears the screen and also drops the Rust-side scrollback, so a remount doesn't replay what was cleared.
  • ⌘+ / ⌘− / ⌘0 zoom the font. The size is shared by all panes, saved with the terminal layout, and clamped to 9–24.
  • WebGL renderer (@xterm/addon-webgl), falling back to the DOM renderer if WebGL fails or the context is lost.
  • Unicode 11 widths (@xterm/addon-unicode11) so emoji and CJK line up in agent TUIs.

Shell awareness

  • The zsh/bash integration now writes OSC 133 (A = prompt, C = command started) and OSC 7 (cwd) in-band.
    • It no longer forks a backgrounded mdt-hook shell-* + nc on every prompt.
    • Status is now ordered with the output, so the shell_seq per-pid reordering code is deleted.
  • The PTY reader scans OSC 7 / 133 / 7501 with a small streaming scanner (terminal/osc.rs). It handles sequences split across reads, both terminators, a size cap, and CAN/SUB aborts.
  • Any shell that emits OSC 133 itself (fish 4, nushell) now gets running/idle too, which covers the deferred fish/nushell item.
  • ⌘↑ / ⌘↓ jump between prompts, using xterm markers placed at OSC 133 A.
  • New splits and new tabs open in the focused pane's current directory (OSC 7), not the project root.

Agent-agnostic status (OSC 7501)

  • Root records map as follows:
    • working becomes running.
    • blocked, done and error become needs-you. msg (base64) is used as the notification text.
    • idle and clear become idle.
    • Child records (id=) are ignored.
  • Any agent that reports OSC 7501 gets the Needs-you box, badge and notification without a per-agent shim.
  • The Claude Code hooks path is unchanged.

Restore after restart

  • At quit (RunEvent::Exit), each open pane's last 256 KiB of scrollback and its cwd are saved to the encrypted SQLCipher kv table.
  • On next launch the pane replays that history above a fresh shell started in the same directory. Before the new shell, the replay resets leftover modes (alt screen, mouse, cursor, bracketed paste, SGR) and draws a faint rule.
  • Each row is replayed once. Rows for panes no longer in the layout are pruned at the next quit.
  • Processes themselves don't survive a restart; that would need a daemon (out of scope, see below).

Not done (deliberate)

  • herdr-core sidecar / daemon, SSH machines, mobile, agent-to-agent CLI. They conflict with the offline, no-server product direction and are terminal-spec non-goals.
  • Opt-out setting for scrollback restore. The data stays in the encrypted DB like other app data. Easy to add if wanted.

Testing

  • cargo test: 113 passed. New tests:
    • OSC scanner: split reads, terminators, percent-decoding, 7501 mapping, oversize and abort.
    • Restore: save, prune and take-once; tail bound; mode reset.
    • bash and zsh integration emit the marks.
    • A real-PTY zsh run where cd /usr produces Idle → Running → Idle and cwd() becomes /usr (5/5 stable).
  • jest: 1016 passed, 122 suites. New tests: pane shortcuts, prompt targeting, font clamping, store cwd inheritance, font-size persistence.
  • tsc --noEmit: clean.
  • Not run in the GUI yet. The worktree dev build (isolated identifier) stopped at the macOS Keychain prompt because the DB key is shared with the installed app. Please check in pnpm dev:tauri:
    1. ⌘F, ⌘K, ⌘+/−/0 and ⌘↑/⌘↓ in a pane. The WebGL renderer looks right in WebKit, in light and dark themes.
    2. cd /tmp, then ⌘D: the new pane opens in /tmp.
    3. printf '\e]7501;state=blocked:msg=aGk=\e\\': the pane turns Needs-you with the notification "hi".
    4. Run claude and hit a permission prompt: Needs-you still works through the hooks path.
    5. Quit and relaunch: history is replayed dimmed above a fresh prompt, in the same directory.
    6. With powerlevel10k / oh-my-zsh: no instant-prompt warning from the precmd marks.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XGT1MWxtnLeLXxBbn7YQkv

itsmeakhil and others added 2 commits November 14, 2026 17:08
…atus, restore after restart

- Pane: ⌘F find bar (search addon), ⌘K clear (also drops Rust scrollback),
  ⌘+/⌘−/⌘0 font zoom persisted with the layout, ⌘↑/⌘↓ jump between prompts,
  WebGL renderer with DOM fallback, Unicode 11 widths for emoji/CJK.
- Shell integration writes OSC 133 (prompt/command) and OSC 7 (cwd) in-band
  instead of forking a backgrounded mdt-hook per prompt, so status is ordered
  with output; the shell_seq reordering machinery is gone. Any shell that emits
  OSC 133 itself (fish, nushell) now gets running/idle too.
- PTY reader scans OSC 7 / 133 / 7501. OSC 7501 (herdr's open program status
  protocol) maps working → running, blocked/done/error → needs you, so any
  agent that reports it gets the Needs-you flow without a per-agent shim.
  The Claude hooks path is unchanged.
- New splits and tabs open in the focused pane's current directory.
- At quit, each open pane's last 256 KiB of scrollback and its cwd are saved to
  the encrypted DB and replayed (modes reset, faint rule) above a fresh shell on
  next launch; rows for closed panes are pruned.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XGT1MWxtnLeLXxBbn7YQkv
@vercel

vercel Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
mydevtools-tech Ready Ready Preview Nov 14, 2026 11:52am UTC

This branch was successfully deployed

1 active deployment
Preview — 72cd2727 Deployed Nov 14, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant