Skip to content

Local patches#3361

Closed
ameno- wants to merge 4 commits into
wavetermdev:mainfrom
ameno-:local-patches
Closed

Local patches#3361
ameno- wants to merge 4 commits into
wavetermdev:mainfrom
ameno-:local-patches

Conversation

@ameno-

@ameno- ameno- commented Jun 8, 2026

Copy link
Copy Markdown

No description provided.

ameno- and others added 4 commits June 7, 2026 14:40
…ersion

In --dev mode connserver logs to stderr, which is merged into the same pipe
the conn controller parses for the 'wsh version' line. Those [PID:...]-prefixed
log lines can race ahead of the version line over SSH (stdout and stderr are
delivered on independent channels), causing 'unexpected version format' and a
failed connection. Skip dev-log lines until the real version line is read.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds a stdio upstream transport for the SSH conn controller, mirroring the
mechanism the WSL path already uses (wshutil.HandleStdIOClient): the connserver
RPC link is carried over the SSH session's stdin/stdout instead of a forwarded
socket, so no listening socket/port is opened on the remote and the SSH channel
itself is the auth boundary (no JWT exchange). A relay goroutine feeds the
ConnMonitor on each line so health does not flip to 'degraded'. Selected via the
RouterTransport setting (default stdio); the domain-socket path remains for the
non-stdio case.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Local-only escape hatch: carry the connserver upstream RPC over a
reverse-forwarded loopback TCP port instead of a Unix domain socket, selected
with WAVETERM_ROUTER_TRANSPORT=tcp. Works around SSH servers that create the
forwarded Unix socket with the wrong owner (e.g. Tailscale SSH creates it
root:root 0600). stdio is the default and preferred transport; this is kept
only as a fallback and is not intended for upstream.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add term_send_command tool that sends a shell command to an open
terminal widget via ControllerInputCommand (the same PTY write path
used by keystrokes). Requires user approval before execution. Optionally
waits 2s and returns the first 50 lines of scrollback so the AI can
report the result inline.

Also enable the existing (commented-out) term_command_output tool which
returns the output of the last completed command when shell integration
is active.

Replace the system prompt language that told the model it "cannot
execute shell commands" (factually wrong with the new tool registered)
with accurate capability description: use term_send_command when a
terminal is open; ask the user to open one if not.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@ameno- ameno- closed this Jun 8, 2026
@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 77f4adc4-5dca-4801-84b9-9d83a64abb4a

📥 Commits

Reviewing files that changed from the base of the PR and between a5ac096 and 26f1f8c.

📒 Files selected for processing (5)
  • cmd/wsh/cmd/wshcmd-connserver.go
  • pkg/aiusechat/tools.go
  • pkg/aiusechat/tools_term.go
  • pkg/aiusechat/usechat-prompts.go
  • pkg/remote/conncontroller/conncontroller.go

Walkthrough

This PR introduces configurable upstream routing modes for connserver and enables AI-powered terminal command execution. On the connserver side, a new TCP router mode is added alongside the existing stdio mode, controlled by an environment variable and command-line flags. The TCP mode extracts a target address from a JWT token, establishes a TCP connection, performs RPC-based authentication, and forwards traffic through the connection. On the AI side, a new term_send_command tool allows the AI assistant to execute shell commands in open terminal widgets and fetch output, with updated system prompt guidance to prefer tool-based execution over manual copy-paste when terminals are available.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

2 participants