Repository navigation
Control handshake: connect to local and remote cores through tw-link (P2) - #183
Merged
Merged
Conversation
- Pin tw-api and the new tw-link to core main 1fae554 (same rev for both). - Local mode: no more per-launch token. ControlClient reads listen.control.key from config.yaml on every connection and runs the Noise handshake on the socket / Windows loopback; a missing config or key counts as "core not ready yet"; after WrongKey the key is read once more (rotation). token.rs, the Bearer header and TW_CONTROL_TOKEN are gone. - Remote mode: connector::handshake now uses tw_link::connect; LinkError maps onto ConnectError, VersionMismatch carries the server core's own version. ConnectError::NotYetAvailable is removed. - The app's required core version comes from the locked tw-api version (works for tags and revs). - Integration tests run against a real core with the key from its config, a wrong key, and a key rotated with `twcore control-key --rotate`. - Regenerated tw-api.ts (CONTROL_API_VERSION 18); zh translations for config.control_key_missing, config.control_key_invalid, control.control_key_locked; control.unauthorized removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e preview; no footer flash before the list loads Found while verifying the real app: - The disconnect banner made the whole content read-only, including Settings > Connection, where the fix usually is (replace the key, switch to this Mac). Settings now stays usable; only the sections that edit the server's config go read-only. - The sidebar footer drew "This Mac · Stopped" for a moment before the connection list arrived, even when connected to a remote. - menubar_preview gains --dump (and a remote state) to print the native NSMenu, submenus included, without screen recording. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Pin tw-api and tw-link to core 892e90e (ThinkWatch-Core#187, P4). - Remote gateway address for the sidebar / switch dialog: the host this computer dialled for the control port plus the gateway's port; gateway_reachable only as the fallback when core reports no gateway address. - zh translations for control.remote.shutdown_refused, control.remote.diagnostics_refused, control.remote.control_section_locked, config.remote_port_zero, config.remote_port_is_gateway, config.bad_remote_allow_from; regenerated tw-api.ts; notice fixture gains the two new Status fields. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e same version Unreleased builds carry the same version number on both sides; the page then read "server core 0.46.0, this app needs 0.46.0". When the two strings are equal, the protocol numbers from the handshake are added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- All core crates (tw-api, tw-types, tw-yaml, tw-guard, tw-watch, tw-link) on tag v0.47.0; regenerated tw-api.ts (CONTROL_API_VERSION 20) and lite-api.ts. - rotate_key no longer reads core's synced/failed fields: core does not sync adopted clients any more, the app does it. - scan_alert / clients_changed are gone from the core event switch in types.ts; control.key_bind_failed is gone from core.zh.json (no longer in core's msg codes). - tw-scan watch tests: a received signal is required, a closed channel no longer passes as one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fylorn
force-pushed
the
feat/control-handshake
branch
from
September 24, 2026 18:00
14aa4b0 to
5e90bc7
Compare
Merged
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.
Rebased onto
dev(after #180 and #182).What changes
tw-api,tw-types,tw-yaml,tw-guard,tw-watch, and the newtw-link) ontag = "v0.47.0";tw-api.tsregenerated (CONTROL_API_VERSION 20).keys.rsrotate_key;scan_alert/clients_changedcases insrc/types.ts;control.key_bind_failedtranslation. tw-scan watch tests now require a received signal (Ok(Some(()))), not just "not timed out".token.rs, the Bearer header,TW_CONTROL_TOKEN).ControlClientreadslisten.control.keyfrom the localconfig.yamlon every connection and runs the Noise handshake on the unix socket / Windows loopback. A missing config or key counts as "core not ready yet"; afterWrongKeythe key is read once more (rotation). The supervisor no longer passes anything to core.connector::handshakeusestw_link::connect;LinkErrormaps ontoConnectError(Unreachable / Closed / WrongKey / VersionMismatch / Timeout);NotYetAvailableis removed. The mismatch page shows the server core's own version (peer_version) and the app's required version (taken from the locked tw-api version; the control-protocol numbers are added when both version strings are equal, as with unreleased builds).gateway_reachableonly as a fallback.tw-api.ts(CONTROL_API_VERSION 19); zh translations forconfig.control_key_missing,config.control_key_invalid,control.control_key_locked,control.remote.*(3) andconfig.remote_port_zero/config.remote_port_is_gateway/config.bad_remote_allow_from;control.unauthorizedremoved.menubar_preview --dumpprints the native NSMenu including submenus.Verified
cargo fmt/clippy/test,pnpm typecheck/build/testwith the v0.47.0 twcore release binary (fetch-core.sh); end-to-end re-run on v0.47.0: remote enable → test connection → save and switch → back to local.twcore control-key --rotate(next connection gets in with the new key, the old key is refused).THINKWATCH_HOME, own ports), driven through its webview:twcore remote enable --allow 127.0.0.1/32: test OK, wrong key, denied source (dialled via the LAN address → "closed by the server"), save and switch (local core stops), server killed and restarted mid-session (banner, read-only, one notification, recovers and clears it), key rotated on the server → wrong key → key replaced in the edit dialog → reconnects, version mismatch against a P1-era core (page ⑥ with both versions);connection-keys.jsonis 0600; deleting the connection removes the entry;--dump.CI
Pins are on the v0.47.0 tag, whose release has all twcore assets, so
fetch-core.shresolves on every platform.🤖 Generated with Claude Code