20 Commits
Author SHA1 Message Date
lucioandClaude Opus 5 81e35b6691 polish P1: protocol §2.5 and §10.9, README D3 and Status, TODO §10
§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]>
2026-09-16 21:11:09 -07:00
lucioandClaude Opus 5 39df560fcd extras: protocol §10.8, feature README, TODO §9
§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]>
2026-09-16 05:29:33 -07:00
lucioandClaude Opus 5 dd26befe58 clipboard: de-duplicate in-band chunks by Id
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]>
2026-09-16 04:56:31 -07:00
lucioandClaude Opus 5 9eb05b522c clipboard: docs/protocol.md §10.7
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]>
2026-09-16 04:51:46 -07:00
lucioandClaude Opus 5 fc7a54b40a app-engine: protocol §10.6, the lane README and TODO §6
§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]>
2026-09-16 03:35:37 -07:00
lucioandClaude Opus 5 9a1ad519de input-inject: record why the lock hotkey's desktop gate is N/A (QA finding 2)
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]>
2026-09-16 03:06:27 -07:00
lucioandClaude Opus 5 f6fc2c5bd3 input-inject: protocol.md 10.5, feature README (assumptions, handshakes, work log), TODO ticks
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 02:51:47 -07:00
lucioandClaude Opus 5 3626dde603 input-capture: switch-to-all is swallowed only when it needs Ctrl+Alt
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]>
2026-09-16 02:35:51 -07:00
lucioandClaude Opus 5 fd1ceeac08 input-capture: protocol §10.4, README rewrite, TODO §4 ticked
§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]>
2026-09-16 02:18:12 -07:00
lucioandClaude Opus 5 a892af6ca3 control-channel: userActive is the SendAwakeBeat test, not a time window
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]>
2026-09-16 01:41:41 -07:00
lucioandClaude Opus 5 c9ea89ac50 control-channel: detect a machine-id collision on client sockets only
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]>
2026-09-16 01:40:55 -07:00
lucioandClaude Opus 5 43dc25ac71 control-channel: Resolver filters the Name2IP and DNS groups separately
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]>
2026-09-16 01:40:22 -07:00
lucio 3411293776 protocol: §10.3 control-channel findings (dial budget, reopen countdown, dedup, failure budget, Name2IP grouping) 2026-09-16 01:23:15 -07:00
lucioandClaude Sonnet 5 43e5e35885 qa: session-matrix round-2 QA log (PASS) and a stale protocol.md citation
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]>
2026-09-16 01:07:10 -07:00
lucioandClaude Opus 5 9980c685e2 session-matrix: Session cannot stamp an application packet (contracts C1)
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]>
2026-09-16 01:00:39 -07:00
lucioandClaude Opus 5 0e6ee77dc7 session-matrix: a failed read spends the untrusted budget, as on Windows
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]>
2026-09-16 00:58:29 -07:00
lucio 0e826d3b8f session-matrix: protocol.md 10.2 — handshake ids, Hi, cadence, matrix search quirks 2026-09-16 00:39:45 -07:00
lucio 56448cca0d qa: fix wrong hex annotation for the verified magic-number example
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.
2026-09-16 00:18:57 -07:00
lucio 76fd4366d2 protocol: wire-core lane notes (invalid packets are 64 bytes, magic overflow, 48-byte preamble) 2026-09-16 00:11:36 -07:00
lucioandClaude Fable 5.1 69c0f7ab53 Plan the macOS port of Mouse Without Borders
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]>
2026-09-15 23:33:27 -07:00