§2.5 is the legacy stream: the fixed salt, IV and iteration count with
citations into the pre-a9e1f0f20e Encryption.cs, the missing cleartext
header, why the sacrificial block exists, the MacCipherScheme setting and
the mismatch diagnostic. §2.3 now says plainly that it describes v0.101
and later only.
§10.9 records the one fact in this document confirmed against a live
Windows machine rather than the source: the lead's independent Python
probe completed the whole handshake against the user's PC under the
legacy scheme, which proves framing, the magic hash, the packet layout
and the handshake as transcribed, and localises the earlier failure to
the stream cipher alone.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
§10.8 records seven findings with citations: the Awake receiver honours
the sender's setting and pokes itself with a mouse jiggle; the fullscreen
rule is asked once, only by the pointer's owner; the excluded-apps list
matches two spellings of the image name; DrawMouseCursor only draws when
the real cursor is suppressed; BlockMouseAtCorners is a 100 px square
around every monitor corner; relative mode moves edge detection to the
controlled machine and gates NextMachine on IsSwitchingByMouseEnabled;
both edge paths set HasSwitchedMachineSinceLastCopy.
README: Assumptions confirmed, Handshakes updated to the shipped API with
four deviations, two open requests (input-capture's easyMouseKeyDown,
clipboard's HasSwitchedMachineSinceLastCopy) and the three provisional
lines taken in ClipboardBridge.swift, Status ticked, Work log with the
corners/relative-mode reading trace.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
A machine pair keeps two control connections and PreProcess exempts
ClipboardText/ClipboardImage from the replay ring (Receiver.cs:40-82), so
every chunk is delivered twice. Windows reassembles from the one socket the
first chunk arrived on (Clipboard.cs:308-373) and never sees it; ours is
keyed by sending machine, so the copies interleaved and corrupted the
payload. Reassembler now keeps a 50-entry ring of chunk Ids, which works
because contracts C1 stamps one Id per chunk for both deliveries.
docs/protocol.md §10.7 note 11.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Answers the two open questions: the bulk connection's 64-byte DATA is raw,
not framed (Clipboard.cs:987, 996-997), and Foundation's .zlib is raw
DEFLATE (verified against Python zlib -15 both directions).
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
§10.6 records six things the Windows source says that §1-§9 did not:
that a switch moves the pointer only when the target is the local
machine (Helper.cs:75-127), that a Mouse packet addressed to us takes
control back by assignment rather than by switching (Receiver.cs:122-125),
that relative mode puts the edge detection on the controlled machine
(Receiver.cs:147-172), that the reconnect countdown is 30 s and gated on
"no socket established" (frmScreen.cs:425-449), the exact JSON shapes of
the settings file, and why Heartbeat has to be a 64-byte packet.
The README's Handshakes section now documents the API as shipped, six
deliberate deviations, the answers to all eleven open requests from
lanes 3-5, and four new requests: PacketSequencer is used from two
queues and is not thread-safe (session-matrix), PermissionState has no
public initialiser and Cursor publishes no pointer position
(input-capture), and there is no way to send a Heartbeat on demand
(control-channel).
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Windows wraps the `HotKeyLockMachine` branch in
`if (!Common.RunOnLogonDesktop && !Common.RunOnScrSaverDesktop)`
(`InputSimulation.cs:408-409`); `KeyState.processDown` has no such
guard, and nothing said whether that was considered or missed.
Both flags are set only where the MWB service launches a second copy of
the process onto the `Winlogon` or `Screen-saver` secure desktop
(`Program.cs:150-167`, `Common.cs:176-186`). macOS has no secure-desktop
session split, no copy of us behind `loginwindow` or the screen saver,
and a user-space `CGEventTap` neither receives nor posts once the screen
is locked; the Windows service is out of scope besides (README D6). So
the condition is unconditionally true for a Mac receiver and the
always-eat-and-lock behaviour is the faithful port.
Recorded as docs/protocol.md 10.5 note 8 (appended, so the note numbers
existing citations use stay stable), as a feature README Assumptions
bullet, and as a comment at the site in `KeyState.processDown`. No
behaviour change.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
QA finding 4: `ProcessHotKeys` never returns `false` for a matched
`HotKeySwitch2AllPC` (`InputHook.cs:518-522`) — unlike every other hotkey
branch it falls through, so a chord that does not itself hold Ctrl+Alt
toggles ALL mode and still reaches the OS. `HotkeyMatch` grows
`swallows`, true for every hotkey except that one when its configured
chord requires neither Ctrl nor Alt; `handleKey` then queues the action
and carries on encoding the key as an ordinary keystroke, which is what
`ProcessHotKeys` returning `true` leaves to `KeyboardEvent` and
`CallNextHookEx`. Documented in docs/protocol.md §4.5 and in the feature
README, including the residual narrowing (Windows also requires the VK to
land in the switch-machine range, `:611-620`). Unreachable today: the
shortcut ships empty (`MouseWithoutBordersProperties.cs:30`) and an empty
hotkey never matches (`Common.cs:127-129`).
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
§10.4 records ten things the lane established from the Windows source
(one-sided hotkey matching, the three meanings of Md.WheelDelta, the
virtual cursor and its primary+-1 clamp, the unconditional relative bias,
SwitchLocation, synthesised LLKHF bits, the eleven ReleaseAllKeys VKs, the
two input counters, monitor enumeration) plus the macOS device masks. The
README's Assumptions and Handshakes now describe what shipped, with the
nine decisions and three deliberate non-ports in the work log.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
QA finding 3. `tick` computed `userActive` as "input within the last
heartbeat interval". `SendAwakeBeat` instead sends `Awake` when
`lastRealInputEventCount != Event.RealInputEventCount` — real input since
the previous heartbeat — and re-records the counter every time it runs
(Common.cs:545-558). Keep the same two counters: `noteUserActivity()` is
`Event.RealInputEventCount++` (InputHook.cs:223, 345) and the channel
re-records on its own heartbeat boundary, which is the one global beat
Windows's 100 ms timer runs for every socket (frmScreen.cs:565-575).
Also fixes the stale citation for this rule in docs/protocol.md §3.3,
which pointed at SendHeartBeat/screen-capture code (Common.cs:499-513,
662-676) instead of SendAwakeBeat.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
QA finding 2. The id check ran for every connection that finished its
handshake, so an inbound peer announcing our own id could force-close
every socket and make the app draw a new machine id. Windows runs the id
comparison and the keep-the-first-client rule as two branches of one
block gated by `status == Connected && tcp.IsClient`
(SocketStuff.cs:1980-1981): a server-accepted socket reaches neither.
Move the collision check inside the `isOutbound` gate the dedup half
already had, and say so in the README and docs/protocol.md §10.3 note 3.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
QA finding 1. `Resolver.addresses` applied one same-subnet check to the
union of the Name2IP mappings and the DNS results. `StartNewTcpClient`
checks each group on its own: the mapped group's failure is a `return`
that skips `Dns.GetHostEntry` entirely (SocketStuff.cs:934-937, 950), so
nothing is dialled for that name that round; the DNS group's failure
(:1037-1040) drops only the DNS addresses, because the mapped ones have
already been dialled (:941). Port that control flow, and document it in
the feature README's Assumptions and docs/protocol.md §10.3 note 6.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Verified the rework against the reference checkout at 3104d5c: read-error
counting now matches SocketStuff.cs:1330-1529/1531, Switcher.learn persists
only on a new machine (MachineStuff.cs:737/755), parkCursor carries the
HideMouseCursor gate (Common.cs:1488, MachineStuff.cs:1025), and contract
C1's forward(_:)-only stamping matches SkSend (Common.cs:901-935). Fixed a
trivially wrong citation in protocol.md §10.2 note 11 (Common.cs:914 ->
916, the actual PackageID increment line). tools/gates.sh green.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Session.send(_:) is gone as a public entry point. Application traffic gets
its Id once from the process-wide PacketSequencer and reaches each target
connection through forward(_:), which never re-stamps; the per-connection
stamp survives only as `private func originate(_:)` for the packets
Windows also sends per connection — the handshake pair, heartbeats, Hi and
ByeBye. Nothing outside the type can now sequence an application packet.
README Assumptions and Handshakes say this is API-enforced rather than a
convention. protocol.md gains §10.2 note 11: SkSend increments PackageID
once before the socket loop (Common.cs:914) and hands the same DATA to
every matching socket, which is exactly what makes the receiver's 50-entry
replay ring collapse a peer pair's duplicate delivery.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
QA finding 1. TcpReceiveData does not signal a bad read out of band: it
rewrites the buffer's type byte to PackageType.Error (0 bytes) or
PackageType.Invalid (short read) (SocketStuff.cs:574-578, 588-593) and
MainTCPRoutine runs that package through the whole loop body — the
private errCount for the Error case (:1332-1364), then the same untrusted
counting as any garbage packet (:1370-1529). So a run of malformed reads
ends in .invalidKey, not .error, and the trusted branch's
`receivedCount > 0` guard (:1531) keeps a 0-byte read out of the receiver.
Session.noteReceiveError now takes the byte count and feeds a synthetic
.error/.invalid packet through the new receive(_:bytesReceived:), which
is the loop body; feed() goes through it too. Written up as protocol
§10.2 note 10 and in the README's Assumptions.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
334517251 decimal is 0x13F0_5403, not 0x13EC_4F03; the decimal value
(independently re-verified against a Python SHA-512 chain) was already
correct, only the hex gloss was wrong.
Planning documents only: CLAUDE.md rules, README with decisions and
architecture, docs/protocol.md transcribed from the Windows source with
citations, docs/topo.md, TODO.md milestones and the first-wave feature
briefs (bootstrap, packet-codec, cipher-stream), plus tools/guard.sh.
Co-Authored-By: Claude Fable 5.1 <[email protected]>