Skip to content

feat(shellv2): add ssh meta function and tabbed interface#2047

Draft
KCarretto wants to merge 1 commit intowasm-ssh-pivotfrom
feature/shellv2-meta-ssh-4121754529262080486
Draft

feat(shellv2): add ssh meta function and tabbed interface#2047
KCarretto wants to merge 1 commit intowasm-ssh-pivotfrom
feature/shellv2-meta-ssh-4121754529262080486

Conversation

@KCarretto
Copy link
Collaborator

This PR introduces a new "meta functions" feature to the ShellV2 interface, starting with the ssh("user:password@host") command.

Changes include:

  • Rust WASM Parser: Modified eldritch-wasm's BrowserRepl to intercept the ssh command and return a special JSON payload ({"status": "meta", ...}) instead of sending the command to the agent.
  • Tabbed UI: Refactored the ShellV2 component to use Chakra UI's Tabs, allowing the main shell and newly spawned SSH sessions to exist side-by-side.
  • SSH Terminal Component: Created a new SshTerminal component that uses xterm.js and connects to the backend via the /portals/ssh/ws WebSocket endpoint. It handles session UUID generation, sequence ID tracking (incrementing only on sends), and automatic reconnections.
  • State Management: Fixed a stale closure bug by using a useRef for portalId within useShellTerminal to ensure the handleMetaSsh callback always has access to the current portal state.
  • Rendering Fixes: Added a synthetic window resize event when switching tabs to ensure xterm.js's FitAddon correctly calculates dimensions for terminals that were previously hidden.

The SSH functionality requires an active portal connection to function; if invoked without one, an error message is printed directly to the shell terminal.

Testing performed:

  • Automated frontend verification using Playwright.
  • Backend tests passing (go test ./tavern/internal/portals/ws/... -v).
  • Rust tests passing (cargo check and cargo test).

PR created automatically by Jules for task 4121754529262080486 started by @KCarretto

- Add `ssh` meta function support in `eldritch-wasm` browser repl
- Refactor `ShellV2` UI to use Chakra UI `Tabs` for managing multiple terminal sessions
- Create `SshTerminal` component for interactive SSH sessions over portals via `wss://.../portals/ssh/ws`
- Implement WebSocket connection, sequence ID tracking, and reconnection logic for the SSH terminal
- Ensure `xterm.js` instances resize correctly when switching tabs
- Update `BrowserWasmAdapter` and `useShellTerminal` to handle and expose meta function execution results

Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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