Repository navigation
feat(native): one-click connect to T3 Code on this Mac, saved environments, connection status - #44
Merged
Merged
Conversation
…blocked-protocol status
Find the running server from <T3 home>/{userdata,dev}/server-runtime.json the way t3 pair does,
check its descriptor speaks our orchestration protocol, mint a token with the installed t3 pair,
and redeem it at the server's origin. Saved environments replace the single connection.json
(still read and migrated). The supervisor blocks a server on another protocol until Retry, keeps
the last failure while reconnecting, and can skip its backoff. status.rs ports the web's
connection presentation and direct-route diagnosis.
…t switcher, status indicator The connect screen offers Connect to T3 Code on this Mac when a server is running, lists saved environments (connect, pair again, remove), and keeps the paste-a-link flow. It doubles as the switcher (app menu, command palette, Settings). The titlebar shows connecting/reconnecting with the diagnosis as a tooltip and Retry; a rejected credential returns to the connect screen with a re-pair prompt.
…r unpaired homes A primary and default size on the settings Button replace the composer one, whose 160px label cap cut off Connect to T3 Code on this Mac. The pasted link clears once it pairs. The snapshot tool copies saved environments and renders the connect screen when there are none.
…tatus; local-connect test recipe
This was referenced Nov 2, 2026
Open
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.
The first thing a new user does with the native app is connect it to T3 Code on the same Mac. That took a pairing link copied out of Settings, and the app could only remember one server.
What changed
One-click local connect (CN-LOCAL). The connect screen finds a running server the same way
t3 pairdoes:<T3 home>/{userdata,dev}/server-runtime.json($T3CODE_HOMEor~/.t3), skipping dead PIDs, then reads/.well-known/t3/environmentfor its label, version, and protocol. "Connect to T3 Code on this Mac" runs the installed CLI,t3 pair --label "T3 Code Native" --ttl 2m(plus--base-dirwhen the home isn't the default), which is the supported way to pair a device. It parses theToken:line and redeems the token at the server's loopback origin. The CLI is looked up at<home>/bin/t3(the launcher the desktop app installs), then~/.t3/bin/t3, PATH, and the Homebrew prefixes, because apps opened from the Finder don't get the shell's PATH.T3_NATIVE_T3_BINoverrides the lookup completely. Each failure has its own message: CLI missing, server gone, server not answering, protocol too old or too new, andt3 pairfailures (shows the error line it logged). If this Mac is already saved, the button reuses that credential instead of minting a new one.Saved environments (CN-MULTI, partial).
environments.json(owner-only, written atomically) holds every paired server: label, address, credential,environmentId, version, and whether it is local. Pairing a server that is already saved updates its entry instead of adding a second one. Labels follow what the server reports. The oldconnection.jsonis still read and migrated, and the probes and examples keep working throughstore::load/save. The connect screen lists saved environments with Connect / Pair again / Remove (Remove asks to confirm), and it doubles as the switcher: T3 Code → Switch Environment..., the palette command "Switch environment...", and Settings → Environments (Switch, Disconnect, Remove). One environment is connected at a time.Connection status (CN-STATUS) and re-pair (CN-REPAIR). While the app isn't connected, the titlebar shows a status dot and the web's title ("Connecting...", "Failed to connect. Reconnecting..."). The tooltip carries the direct-route diagnosis from
diagnosis.ts, and a Retry button skips the backoff. The supervisor now remembers the last failure while it reconnects. A server on a different orchestration protocol is blocked ("Client not supported" / "runs an older T3 Code") and waits for Retry instead of looping. When a server rejects the credential, the app drops the token but keeps the entry, then returns to the connect screen with "T3 Code on X did not accept this device" and Pair again (one click for the local server).Compatibility (CN-COMPAT).
core::compatibilityportsorchestrationProtocolCompatibilityError. It runs before a pasted link spends its token, before the local pairing, and on every connect.Also: the settings
ButtongetsDefault(primary) variant and size. The composer button cut labels at 160px. The snapshot tool now copiesenvironments.jsonand renders the connect screen when the home has nothing saved.Ledger
CN-PAIR, CN-COMPAT, CN-STATUS, CN-MULTI, CN-LOCAL, CN-REPAIR → partial, with Native paths. Not done yet: multi-connect, environment badges, the run-on picker, host freeze, the animated status ping (the dot is static so it never repaints), offline detection, the legacy-permissions notice, and host + code as separate fields.
Evidence
Tests: discovery parsing and liveness, CLI argument building, CLI lookup, output and error parsing (from real CLI output), migration and the saved-environments store (upsert/dedupe, revoke, remove, 0600 round trip), status presentation and diagnosis, protocol check, and a supervisor test where a newer-protocol server blocks until
retry_now. Gates pass:cargo test --workspace,cargo clippy --workspace --all-targets -D warnings,gen-theme --check,parity/sync.test.ts,conformance --check.Headless one-click run against the isolated smoke server (fake
T3CODE_HOME,T3_NATIVE_T3_BINwrapper around the smoke server'sbin.ts pair):Real app window with the same setup, using a temporary local trigger in place of the click (not committed):
Offscreen snapshots (
--features snapshot, 1280×840 @2x):/private/tmp/claude-501/-Volumes-DevSSD-t3code/7a9093f7-05bd-4183-ab15-c4265aa48126/scratchpad/w13-shots/connect-first-run-light.png/private/tmp/claude-501/-Volumes-DevSSD-t3code/7a9093f7-05bd-4183-ab15-c4265aa48126/scratchpad/w13-shots/connect-first-run-dark.png/private/tmp/claude-501/-Volumes-DevSSD-t3code/7a9093f7-05bd-4183-ab15-c4265aa48126/scratchpad/w13-shots/connect-saved-light.png/private/tmp/claude-501/-Volumes-DevSSD-t3code/7a9093f7-05bd-4183-ab15-c4265aa48126/scratchpad/w13-shots/status-reconnecting-dark.pngNot verified at runtime: actual clicks (the screen is locked), and
t3 pairagainst the live desktop install, which was deliberately never run. That path runs~/.t3/bin/t3 pair --label "T3 Code Native" --ttl 2mwith no--base-dir, from~.Built by Claude Opus 5.5 (worker W13) in Claude Code.