feat: thunderbolt — stdio-bridge CLI (thunderbolt bridge), curl|bash installer, and in-app connect flows#1021
Closed
ital0 wants to merge 45 commits into
Closed
feat: thunderbolt — stdio-bridge CLI (thunderbolt bridge), curl|bash installer, and in-app connect flows#1021ital0 wants to merge 45 commits into
ital0 wants to merge 45 commits into
Conversation
Semgrep Security ScanFound 1 issue(s).
Finding details
|
|
Preview environment destroyed 🧹 Stack |
PR Metrics
Updated Mon, 29 Jun 2026 21:35:49 GMT · run #2114 |
54fe525 to
361f4eb
Compare
361f4eb to
1fead79
Compare
…hoist hot-path work
…and fix teardown hangs
… installer checksum
cjroth
requested changes
Jun 26, 2026
…nnot strand a live face
…d exports + unused mock params)
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 46b7fcd. Configure here.
Collaborator
Author
|
closed that in favor or #1032 |
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.

Brings up the full stdio-bridge feature in one PR: the
thunderboltCLI package, itscurl | bashdelivery, and the in-app "Connect via bridge" flows (agent catalog + MCP servers). Built clean-room from the approved THU-601 design. Supersedes #989 (first implementation, discarded as incorrect).CLI —
cli/(thunderbolt bridgesubcommand)Renamed
thunderbolt-stdio-bridge→thunderbolt(package dircli/); the bridge is thethunderbolt bridgesubcommand (positions for the future general-purpose Thunderbolt CLI). Plain Node, no bundled runtime. Modules + tests: argv parser + subcommand dispatch, exit-code table, PII-safe logger, loopback/util, child supervisor, ACP↔WS relay, ACP WebSocket face, MCP Streamable-HTTP face, MCP session multiplexer, cloudflared tunnel, composition root.Contracts:
thunderbolt bridge --mode <acp|mcp> … -- <launch>; banners/logs stderr-only; sysexits exit codes (0/64/69/70/130); Origin allowlist default-on (ACP rejects at upgrade, MCP rejects present-but-disallowed Origins server-side); tunnel ⇒ mandatory constant-time bearer (never in URL); never-orphan child (SIGKILL on every fatal path); newest-wins ACP client + backpressure; MCP body cap + deterministic teardown. The MCP face multiplexes sessions so the probe + the live connection + reconnects share one stdio child (initialized once) — a single-session child would otherwise reject the second client with "already initialized".bun test: 199 green incl. a real multi-client server-everything integration test.Delivery
cli/install.sh— POSIXcurl | bash: resolves version frommain'spackage.json, downloadsthunderbolt.cjs+ verifies its SHA-256 from the GitHub Release, installs the barethunderbolton the npm global bin (sudo fallback). Requiresnode..github/workflows/thunderbolt-release.yml— PR/main pushes build + smoke;thunderbolt-v*tag builds, smoke-tests, and attachesthunderbolt.cjs+thunderbolt.cjs.sha256to the Release.App connect flows
Extends the #987 catalog; no schema/DAL/migration changes. Loopback carve-out (
resolveWebSocketFactoryACP +resolveMcpFetchMCP) routes loopback URLs to native WS/fetch ahead of standalone/proxy (classifies all of127.0.0.0/8, matching the bridge).BridgeConnectDialog("Connect via bridge" card action) —composeBridgeCommandemitsthunderbolt bridge --mode acp -- <launch>(installed binary directly,--allow-origin '<app-origin>'for non-loopback web).McpBridgeConnectDialog— free-text stdio command →composeMcpBridgeCommandemitsthunderbolt bridge --mode mcp -- <command>; user adds the printedhttp://127.0.0.1:PORT/mcp.BridgeInstallStep(shared by both dialogs) — on macOS/Linux desktop an "Install automatically" button invokes a new Tauriinstall_bridgecommand (runsinstall.shvia the login$SHELLwrappingbash -c 'set -o pipefail; …'— login PATH + pipefail, fish-safe); web/Windows show the manualcurl | bash(also pipefail-wrapped so a failed curl isn't silent).Validation
bun run checkgreen (type/lint/prettier/license);thunderbolt(cli/)bun test199 green (5×); app glue + fullsrcsuite green; Rustcargo check/cargo test. Reviewed blind by GLM-5.2 + Codex (gpt-5.5) each round; consensus findings fixed. Verified end-to-end against the real app via Playwright: the binary wrapsserver-everything, the MCP server connects (13 tools), and a chat message drives the model to call an MCP tool through the bridge. Bot-review findings triaged + resolved (incl. two validated false positives: HTTPS→loopback "mixed content" — loopback is potentially-trustworthy per W3C; and apaths+tagsworkflow trigger — paths aren't evaluated for tag pushes).Note
High Risk
New security-sensitive local networking (Origin gate, bearer, optional public tunnel) and child-process lifecycle; mistakes could expose LAN services or leak access, though defaults target loopback and the surface is heavily tested.
Overview
Introduces the
thunderboltCLI undercli/, a local toolkit whosebridgesubcommand spawns a stdio ACP or MCP child and exposes it on loopback as WebSocket (--mode acp) or Streamable HTTP (--mode mcp). Diagnostics and readiness URLs go to stderr only; sysexits-style exit codes, signal/fatal teardown, and never-orphan child reaping are wired inbin/cli.ts.The MCP path adds a session multiplexer so multiple HTTP clients share one stdio child (single
initialize, id remapping, cached init). Security defaults include an Origin allowlist, optional bearer auth (constant-time), body caps, and loud warnings for non-loopback binds; optional--tunnelfronts MCP with cloudflared and a minted bearer.Delivery:
install.shdownloads a releasethunderbolt.cjs, verifies SHA-256, and installs to the npm global bin;scripts/build-cli.mjsesbuild-bundles the entry;.github/workflows/thunderbolt-release.ymlbuilds, smoke-tests ACP/MCP banners, and publishes artifacts onthunderbolt-v*tags. Root.gitignoregains.playwright-mcp/.Reviewed by Cursor Bugbot for commit 950a0e1. Bugbot is set up for automated code reviews on this repo. Configure here.