feat(terminal): detect localhost URLs in PTY output and show preview banner#278
Open
dcieslak19973 wants to merge 23 commits into
Open
feat(terminal): detect localhost URLs in PTY output and show preview banner#278dcieslak19973 wants to merge 23 commits into
dcieslak19973 wants to merge 23 commits into
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…RUD, search, grep Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ands Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…de tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… mod, profile cmd paths Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Fix russh API paths for Windows (keys::key::PublicKey, keys::load_secret_key) - Fix profile_id serde rename to camelCase for frontend compat - Fix pty flush: use interval timer so output isn't stuck in pending buffer - Add ssh_home command to fetch remote home dir via exec - Auto-reconnect last SSH profile on app startup, persisted via lastSshProfileId pref - Connect SSH before fetching home dir in switchWorkspace Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…banner When a process running in a terminal pane prints a URL of the form http(s)://localhost:PORT or http(s)://127.0.0.1:PORT to stdout/stderr, a dismissible banner appears at the bottom of that pane showing the URL and an 'Open in Preview' button that loads the URL in the built-in preview tab. - url-detector.ts: pure function that strips ANSI escapes, matches localhost URLs (explicit port required), and flags OAuth-style redirect URLs - useTerminalSession: wires extractLocalhostUrls into the onData path; per-session seenUrls Set prevents re-firing the same URL - LocalUrlBanner: absolute-positioned overlay with auto-dismiss (30s), Key01Icon for OAuth hints, Link01Icon for plain servers - TerminalPane: wraps xterm container in a relative div, manages banner state, accepts onOpenUrl prop - PaneTreeView / TerminalStack: thread onOpenUrl down the bundle chain - App: pass onOpenUrl to TerminalStack, calling openPreviewTab
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.
Summary
When a process running in a terminal pane prints a localhost URL to stdout/stderr (e.g.
npm run devprintinghttp://localhost:5173), a dismissible banner appears at the bottom of that pane with a clickable URL and an Open in Preview button that loads it in the built-in preview tab.Changes
New files
src/modules/terminal/lib/url-detector.ts— pure function that decodes raw PTY bytes, strips ANSI escape sequences, and matcheshttp(s)://localhost:PORT/http(s)://127.0.0.1:PORTURLs. Requires an explicit port. Flags OAuth-style redirect URLs (/callback,?code=, etc.) for a distinct icon.src/modules/terminal/LocalUrlBanner.tsx— absolute-positioned overlay rendered inside the terminal pane. Shows aKey01Icon(amber) for OAuth hints orLink01Icon(blue) for plain servers, the truncated URL, an Open in Preview button, and a dismiss button. Auto-dismisses after 30 s.Modified files
useTerminalSession.ts— callsextractLocalhostUrlsalongsidedeliverPtyBytesin theonDatacallback; per-sessionseenUrls: Set<string>prevents re-firing the same URL;onUrlcallback added toCallbacksandOptionstypes;seenUrlsreset inrespawnSession.TerminalPane.tsx— wraps the xterm container in arelativediv, managesbannerstate, passesonUrltouseTerminalSession, renders<LocalUrlBanner>overlay, accepts newonOpenUrlprop.PaneTreeView.tsx/TerminalStack.tsx—onOpenUrlthreaded through the bundle chain (LeafBundle/Bundletypes updated).App.tsx—onOpenUrl={(_, url) => openPreviewTab(url)}added to<TerminalStack>.UX behaviour
seenUrls)seenUrlsso the URL can surface again