100 Commits
Author SHA1 Message Date
lucioandClaude Fable 5.1 3612a6af2f polish: close P1 (lead review; handshake verified against a real Windows peer)
Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-16 21:19:49 -07:00
lucioandClaude Sonnet 5 367c739252 qa: P1 QA log — legacy cipher scheme verified, verdict PASS
Verified constants against a9e1f0f20e^ Encryption.cs/Common.cs, the
MacCipherScheme setting's default/round-trip/reach into both configs,
the PeerConnection scheme-mismatch diagnostic (both directions traced
by hand, including the wrong-key non-misfire case), SocketStatus 100
never hits the wire, and the Security-pane picker's commit-on-change +
full-reopen path. gates.sh green under tools/guard.sh; no app launch,
no sockets, no tests (none exist in this repo).

One non-blocking finding: BulkChannel.reconfigure's disruptive check
omits cipherScheme, unlike ChannelConfig.needsFullReopen — traced as
harmless (new BulkConnections pick up the current config regardless)
but worth a comment for the next reader.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-09-16 21:19:20 -07:00
lucioandClaude Opus 5 9930412c6b polish P1: drop CipherScheme's unused Codable and CaseIterable
Nothing encodes a CipherScheme — Settings stores its rawValue through the
accessor — and nothing enumerates the cases; the picker lists both by
hand. String, Sendable and Hashable are the three that are actually load
bearing (settings, ChannelConfig, SwiftUI's .tag).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 21:12:47 -07:00
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 2de39f79de polish P1: "Encryption compatibility" picker in the Security pane
Two radio buttons, PowerToys 0.100 and earlier (the default) or 0.101 and
later, bound straight to MacCipherScheme. Not a draft like the key and the
port: one click is already a whole change, with no half-typed state to
protect. The note points at it as the fix for the menu's "wrong encryption
compatibility setting".

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 21:08:57 -07:00
lucioandClaude Opus 5 1445d546a1 polish P1: carry the cipher scheme through the channels, diagnose a mismatch
ChannelConfig and BulkConfig carry MacCipherScheme; a change to it reopens
every connection the way a key change does. PeerConnection reads the
scheme's preamble length (16 legacy, 48 modern) instead of a hard-coded 48.

The diagnostic: the peer's opening bytes are kept until one packet has
framed. If the first packet fails framing under the configured scheme and
the same raw bytes frame under the other one, the connection closes with
.invalidKey(.cipherSchemeMismatch) and reports status
.cipherSchemeMismatch, so the menu names the setting to change rather than
blaming the security key. Costs one AES setup on a connection that was
going to fail anyway, and nothing at all on success.

The bulk channel needs no diagnostic: a transfer only starts with a peer
whose control connection already framed.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 21:08:19 -07:00
lucioandClaude Opus 5 c0031c00da polish P1: CipherScheme (.legacy/.modern) in the cipher stream
The legacy scheme is what every PowerToys up to v0.100.2 speaks: a fixed
PBKDF2 salt (UTF-16LE of "18446744073709551615", 40 bytes), 50 000
iterations, a fixed ASCII IV "1844674407370955" and no cleartext header —
citations to the pre-a9e1f0f20e Encryption.cs. The sacrificial block is
still the first ciphertext block under both schemes.

- CipherWriter/CipherReader take the scheme; the writer's header is 16
  bytes under .legacy and 48 under .modern, the reader consumes as many.
- MacCipherScheme setting, default legacy, Mac-only key in the same file.
- InvalidKeyReason.cipherSchemeMismatch and SocketStatus
  .cipherSchemeMismatch (raw value 100, outside the Windows range) with
  its menu text, for the diagnostic the network layer raises next.

Verified offline against Python cryptography in both directions: our
legacy writer's stream decrypts under
pbkdf2_hmac('sha512', key, '18446744073709551615'.encode('utf-16-le'),
50000, 32) + AES-CBC, and our reader recovers Python's.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 21:06:41 -07:00
lucioandClaude Fable 5.1 32a0c72944 polish: P1 — PowerToys stable uses the legacy cipher scheme (verified against Lu-Corsair)
Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-16 20:58:53 -07:00
lucioandClaude Fable 5.1 bec1a370f9 extras: close lane (lead review), CP3 handed over; development pauses for CP1-CP3 findings
Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-16 05:36:24 -07:00
lucioandClaude Sonnet 5 32925c8943 extras: QA log — verified against Windows source, PASS with 1 informational finding
Cross-checked every Status/TODO tick against the PowerToys source (Awake
assertion lifetime, fullscreen edge-path-only gating, drawn-cursor
lifecycle, ClipboardBridge provisional lines, corners/relative-mode
trace). tools/gates.sh green. One informational, non-blocking finding:
the display-awake renew has no equivalent of HumanBeingDetected's
local-activity guard.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-09-16 05:35:48 -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 21c886165e extras: awake assertion, fullscreen rule, drawn cursor, transfer notices
- MWBMac/Awake.swift: DisplayAwake renews an IOPMAssertion
  (PreventUserIdleDisplaySleep, 90 s timeout) on every Awake (21), the
  macOS answer to Common.HumanBeingDetected/PokeMyself
  (Receiver.cs:244-249, Common.cs:561-591) without posting input.
- MWBMac/Fullscreen.swift: the frontmost app's excluded-apps test and a
  covers-a-whole-display window check, cached 250 ms; gated in the
  Engine by IsEasyMouseSwitchAllowed's two early outs
  (Common.cs:1638-1650), so it is asked only on the edge path.
- MWBMac/FakeCursor.swift: CursorOverlay draws NSCursor.arrow at the
  last injected position (Receiver.cs:186-188) and hides on park, local
  input and shutdown (Common.cs:1495, InputHook.cs:256-264); FakeCursor
  coalesces the main-thread hops.
- Settings.drawMouseCursor accessor + the Behaviour-pane toggle,
  answering app-ui's open request.
- UIBridge.TransferNotices wires ClipboardAction.note to the Notifier,
  answering clipboard's open request (Clipboard.cs:610-618, 869-881, 916).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 05:25:10 -07:00
lucioandClaude Fable 5.1 b73e878ae4 clipboard: close lane (lead review), CP2 handed over; brief: extras
Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-16 05:13:13 -07:00
lucioandClaude Sonnet 5 e5e38b496e clipboard: QA log — verified against Windows source, PASS with 5 follow-up findings
Reviewed the diff against Core/Clipboard.cs, SocketStuff.cs, FormHelper.cs,
ReceivedDestinationFile.cs, Receiver.cs and Common.cs; ran tools/gates.sh
(all green). No wire-format, trust-gate, or logging violations found.
Findings are all low/medium severity and don't block CP2: the bulk
connection limit doesn't reproduce Windows's single-flight receive
semaphore, a dead stagingURL(in:) helper, a comment/behaviour mismatch
on the text-size gate, an unused AppKit import, and a send-time failure
message that can say "not found" instead of "too big" in a narrow race.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-09-16 05:11:33 -07:00
lucioandClaude Opus 5 21963d54c9 clipboard: work log note for the offer-clearing and size-cap fixes
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 05:00:04 -07:00
lucioandClaude Opus 5 9b5a05ce4e clipboard: acceptHandshake returns Void; the handshake always ends the parse loop
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 04:59:50 -07:00
lucioandClaude Opus 5 1365db96e4 clipboard: clear the offer before examining a new copy; text/image size caps
Clipboard.cs:111-114 nulls LastClipboardData and LastDragDropFile before it
looks at the new clipboard, so a branch that decides not to share leaves
nothing for a peer to pull. FormHelper.cs:204-210 and :287 refuse text over
20 MB and images over 50 MB at the reader.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 04:59:04 -07:00
lucioandClaude Opus 5 4181bb273f clipboard: pace in-band chunks, 128 packets every 5 ms
A 1 MB payload is 21 846 packets. Handing them to ControlChannel.forward in
one loop overruns the 512-packet outbox (contracts C3), which closes the
connection, and puts a second of clipboard traffic ahead of the next mouse
packet. Windows paces naturally because SendClipboardDataUsingTCP writes
each packet down a blocking socket from its own thread (Clipboard.cs:260-305).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 04:58:07 -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 105a34cb45 clipboard: feature README (assumptions, handshakes, work log) and TODO ticks
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 04:53:58 -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 386c915861 clipboard: the policy bridge and its Engine wiring
ClipboardBridge ports CheckClipboardEx (Clipboard.cs:85-251), the in-band
chunking and reassembly (253-373), GetRemoteClipboard (377-449) and the
clipboard cases of Receiver.cs (273-380) and Event.cs (219-231). It is held
by the Engine actor and returns [ClipboardAction] the way Switcher returns
[SwitchAction]; ClipboardRelay is the Sendable sink the bulk channel and the
pasteboard watcher call.

Engine.swift: the bridge property and the authorised dispatch cases. Four
further lines (Engine.start/stop, EngineActions.applyConfiguration and the
.remoteClipboardWanted case) are beyond the letter of the brief and are
flagged in the feature README's Handshakes for the lead to rule on.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 04:50:04 -07:00
lucioandClaude Opus 5 2276c20792 clipboard: bulk channel on the TCP port, pull/push/accept
Listener and dials ported from SocketStuff.cs:475-495, 1566-1666 and
Clipboard.cs:401-485, 1068-1099; the transfer from Clipboard.ShakeHand
(961-1066), ReceiveAndProcessClipboardDataCore (498-923) and
SocketStuff.SendClipboardData/SendFileEx/SendData (1673-1931).

The 64-byte DATA on this connection is raw, not framed (docs/protocol.md
§10.7 (a)): bytes 1..3 must be zero and are checked.

Verified on loopback in the scratchpad: pull of text, push of a file,
a 3 MB image across chunks, and an unauthorised peer refused.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 04:45:36 -07:00
lucioandClaude Opus 5 9ab4956551 clipboard: pasteboard watcher/writer and received-file staging
Pasteboard.swift is the macOS FormHelper (FormHelper.cs:234-330) plus the
writing half of Clipboard.cs:1101-1294, polled on one private serial queue.
ReceivedFile.swift ports ReceivedDestinationFile.cs and Common.GetMyStorageDir.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 04:38:19 -07:00
lucioandClaude Opus 5 8105f5f24f clipboard: text/CF_HTML codec, in-band chunking, bulk header, Reassembler
Ported from App/Core/Clipboard.cs (42-47, 190-201, 253-373, 1101-1194),
App/Helper/FormHelper.cs (180-218) and App/Class/SocketStuff.cs (1673-1811).
Foundation's .zlib is raw DEFLATE, verified against Python zlib -15.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 04:36:51 -07:00
lucioandClaude Fable 5.1 18c9702524 app-ui: close lane (lead review), CP1 handed over; brief: clipboard
Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-16 04:27:26 -07:00
lucioandClaude Sonnet 5 083b00bb9f app-ui: QA log (PASS, one low finding)
Verified gates/bundle build-only, settings completeness against README
§Settings, menu actions, status colours against the PowerToys devdocs,
hotkey-recorder modifier mapping, the SettingsStore-only edit path, the
single Permissions.request() call site, bundle-identifier guards on
notifications/SMAppService, dead-code removal in AppLifecycle, file/
function size and force-unwrap/try!/fatalError checks, MWBMac layering
imports, and that the security key never reaches a log call. One
plausible low-severity finding: a strong reference cycle between Engine
and UIBridge from a dropped [weak ui] capture, inert today because
AppDelegate is a process-lifetime singleton.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-09-16 04:25:27 -07:00
lucioandClaude Opus 5 783c358334 app-ui: bundle key, docs, TODO ticks
- Resources/Info.plist: NSSupportsSuddenTermination = false, so nothing
  can skip applicationWillTerminate (invariant 3, contracts C2). That is
  the only bundle change notifications and login items turned out to
  need; the work log says what else was checked.
- docs/features/app-ui/README.md: Assumptions brought in line with what
  shipped, Handshakes replaced with the real API (five deviations, all
  reasoned), one open request to app-engine for a DrawMouseCursor
  accessor, Status/TODO ticked, work log.
- TODO.md §7: three lines ticked; CP1 left for the lead.
- UIBridge: dropped an unused openSettings entry point.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 04:18:35 -07:00
lucioandClaude Opus 5 716c5be5c5 app-ui: three fixes found re-reading the first pass
- UIBridge remembered only the lowercased key of a peer, so a "Lost X"
  notification for a row that vanished printed the name in lower case;
  and the spelling map was built with Dictionary(uniqueKeysWithValues:),
  which traps when a peer pair has two connections carrying one name.
- SettingsWindowController.show() refreshed the drafts unconditionally,
  so opening the Advanced pane from the menu threw away a half-typed
  security key. It now refreshes only when the window was not visible.
- StatusItem: dropped the unused StatusModel.hasProblem and the dead
  fill/size argument in the icon drawing.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 04:15:54 -07:00
lucioandClaude Opus 5 6b2b3fc65a app-ui: menu bar, settings window, notifications, login item
The real user interface, replacing app-engine's placeholder status item.

- MWBMac/StatusItem.swift: NSStatusItem with a code-drawn icon, the
  documented status colours (doc/devdocs/modules/mousewithoutborders.md)
  and the menu the Windows tray menu offers (frmScreen.Designer.cs:91-180).
- MWBMac/SettingsWindow/*: one NSWindow hosting a SwiftUI TabView with six
  panes; every property in README §Settings is reachable. Labels and help
  text taken from MouseWithoutBordersPage.xaml + Resources.resw, cited per
  file.
- MWBMac/Notifications.swift, LaunchAgent.swift: UNUserNotificationCenter
  and SMAppService.mainApp, both guarded on a bundle identifier.
- mwb/UIBridge.swift: EngineSnapshot -> StatusModel, clicks -> Engine, and
  the connected/lost/invalid-key notification diff.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 04:14:11 -07:00
lucioandClaude Fable 5.1 bce5c3c36e app-engine: close lane (lead review); brief: app-ui
Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-16 04:01:06 -07:00
lucioandClaude Opus 5 9be0923243 app-engine: rework work log, the two answered requests, no stale counts
Records the rework round item by item, moves session-matrix request 1 and
input-capture request 1 to "answered", brings the Assumptions section
into line with the three fixes (0600 re-applied after the replace,
`releaseAll()` in the tail of `perform(_ actions:)`, `ByeBye` on the
signal path) and replaces the stale "Engine.swift 598" with prose —
quoting a line count in a work log guarantees it is wrong by the next
commit, and the judgement it supported is unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 03:58:57 -07:00
lucioandClaude Opus 5 76d1053aaf input-capture: public init for PermissionState (app-engine request 1)
Cross-lane edit, authorised by the lead. The struct declared two public
lets and no init, so the memberwise one was internal and no other target
could build a value — `EngineSnapshot.permissions` had to default to
`Permissions.preflight()`, i.e. a TCC query, just to have a value to
hold. The default is now `PermissionState(listen: false, post: false)`,
which is also the honest value before `start()` has read anything.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 03:57:27 -07:00
lucioandClaude Opus 5 8125cb1ede session-matrix: PacketSequencer is thread-safe (app-engine request 1)
Cross-lane edit, authorised by the lead. Contracts C1 gives the process
one sequencer and two callers: the Engine actor stamps application
packets, each `Session` stamps its own handshake, heartbeat, `Hi` and
`ByeBye` on the channel's queue (`Session.swift:402-403`). `value &+ 1`
with no synchronisation can lose an update and hand two packets the same
`Id`, which the peer's replay ring drops (`Receiver.cs:40-82`). The
counter now lives under an `NSLock` — Foundation only, so MWBCore's
layering holds — and the class is `@unchecked Sendable`, which is the
guarantee Windows gets from `Interlocked.Increment` (`Common.cs:916`).
`ReplayFilter` is unchanged: one queue touches it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 03:56:52 -07:00
lucioandClaude Opus 5 02df633a01 app-engine: say ByeBye on SIGTERM/SIGINT/SIGHUP too
QA finding 3. contracts C2's last row promises the sockets send `ByeBye`
however the process ends, and the signal path only released the keys and
the pointer. `ControlChannel` is `Sendable` and each of its methods hops
to its own serial queue, so the handler can hold the channel and queue
the goodbye itself without waking the Engine actor — which the header
comment on `EmergencyRelease` forbids, and rightly. The 150 ms wait
afterwards is the same grace `Engine.stop()` gives the packet
(`InitAndCleanup.cs:192-215`); it is best effort, and it runs after the
keys are already back.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 03:56:14 -07:00
lucioandClaude Opus 5 ccbeff2e0a app-engine: release held keys on every switch that lands control here
QA finding 2. `Helper.HelperThread` releases once `NewDesMachineID ==
MachineID` (`Helper.cs:120-123`) and its event is set by both
`SwitchToMachine` (`MachineStuff.cs:1024`) and `PrepareToSwitchToMachine`
(`Event.cs:203`), so Windows releases on the `ByeBye`, edge-crossing and
`NextMachine` paths too — we only did on the hotkey, the broadcast
toggle and `recoverLocal`. The tail of `perform(_ actions:)` now covers
all of them, gated on the destination actually moving so that a switch
which leaves control local (a matrix edit while a peer drives this Mac)
cannot drop that peer's held modifiers.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 03:55:23 -07:00
lucioandClaude Opus 5 f76eb8fabc app-engine: settings.json is 0600 whatever the old file's mode was
QA finding 1. `FileManager.replaceItemAt` copies the *original* item's
metadata onto the replacement unless `.usingNewMetadataOnly` is passed,
so a `settings.json` that arrived from another machine (README D3:
copying the file is a supported way to share the key and the matrix)
kept its permissive mode through every later `SettingsStore.update()` —
with `SecurityKey` in the clear. Pass the option, and set the mode on
the final path afterwards so the guarantee does not depend on which
branch wrote the file.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 03:54:57 -07:00
lucioandClaude Sonnet 5 bd7be40186 app-engine: QA log — REWORK (settings 0600 gap, key-release parity, ByeBye-on-signal)
Reviewed against CLAUDE.md, contracts C1-C5, protocol §10.6 and the Windows
source. Gates green; one confirmed finding (Settings.save(to:) does not
reliably enforce 0600 via replaceItemAt on a pre-existing file, verified
empirically) and two plausible ones (releaseAll() parity across switch-to-
local paths; ByeBye not sent on SIGTERM/SIGINT/SIGHUP), filed with file:line
on both sides for the dev.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-09-16 03:52:04 -07:00
lucioandClaude Opus 5 bb873807b8 app-engine: install the event tap when the permission finally arrives
The 5 s health check already had to notice Input Monitoring being
revoked (contracts C2). Noticing it being granted and retrying
EventTap.start() means a first run does not have to be restarted after
the user ticks the box in System Settings.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 03:36:21 -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 c4741fcfeb app-engine: the Engine actor, its actions, recovery and the app shell
Engine.swift is the actor contracts C3 names: it owns the Switcher, the
sequencer, the replay filter, the channel, the tap, the routing state,
the capture ring, the injector, the cursor and the screens, and it is
the only thing that stamps an Id (contracts C1). Every callback — the
channel's sink, the tap's wake-up, the timers, the workspace and
settings observers — funnels through one AsyncStream so four queues are
serialised once instead of racing as free Tasks. `dispatch` is the port
of Receiver.ProcessPackage (Receiver.cs:86-390), long on purpose.

EngineActions.swift performs [SwitchAction] (MachineStuff.cs:1008-1050,
Helper.cs:73-127), the hotkeys (InputHook.cs:516-655) and the mapping
from Settings onto every lane's config struct (contracts C4).

Recovery.swift is contracts C2 end to end: escape hotkey, controlled
peer lost, tap lost, capture overflow, revoked permission, quit — each
ending in route-local, releaseAll and a pointer that is coupled again —
plus the reopen countdown (frmScreen.cs:427-450).

AppLifecycle.swift is the process: flock single instance, the
LSUIElement NSApplication with a placeholder status item, the
DispatchSourceSignal + atexit emergency release, and hostname
validation (README D7).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 03:30:27 -07:00
lucioandClaude Opus 5 679dee27af app-engine: Settings in the PowerToys schema, and the rotating log
Settings.swift keeps the raw property tree so properties this port does
not implement round-trip untouched (README D3), with typed accessors for
the ones we do: the `{"value": …}` boxing, the HotkeySettings shape
(HotkeySettings.cs:121-136) and the defaults of
MouseWithoutBordersProperties.cs:165-206. SettingsStore loads, saves
atomically at 0600 and watches the file (Setting.cs:197-207); a corrupt
file throws rather than being replaced by defaults, which would discard
the user's security key.

Log.swift is os.Logger plus a 1 MB x 3 rotating file. Nothing here can
take a KeyboardData or a key string (CLAUDE.md invariant 2).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 03:19:17 -07:00
lucioandClaude Fable 5.1 ca9be2eb16 input-inject: close lane (lead review); split app-shell into app-engine + app-ui; brief: app-engine
Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-16 03:09:07 -07:00
lucioandClaude Opus 5 c7d294a7a3 input-inject: work log — rework entry answering both QA findings
Dated 2026-09-16 rework entry in docs/features/input-inject/README.md:
finding 1 accepted and fixed (chord tracking and the lock-hotkey test
now see the raw wire VK; `normalise(vk:)` is the posting path only),
finding 2 accepted as a documentation gap and recorded (Windows'
secure-desktop gate has no macOS analogue, so always-eat-and-lock is a
decision). Notes why 10.5 note 8 was appended rather than inserted.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 03:07:01 -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 3ea50a7ae3 input-inject: chord and lock-hotkey match on the raw VK (QA finding 1)
`injectKey` normalised the incoming virtual key before handing it to
`KeyState.process`, so a side-less `VK_SHIFT`/`VK_CONTROL`/`VK_MENU` set
`chord.shift`/`.control`/`.option`. Windows' `InputProcessKeyEx` matches
side-specific VKs only — `VK.LSHIFT`/`VK.RSHIFT`, `VK.LCONTROL`/
`VK.RCONTROL`, `VK.LMENU`/`VK.RMENU`, `VK.LWIN`/`VK.RWIN` in both its
switches (`InputSimulation.cs:372-403` up, `:418-438` down) — and
`Common.HotkeyMatched` (`:406`) is given the raw `vkCode`, so those
side-less codes, which the lock-chord replay puts on the wire
(`InputHook.cs:485-512`), never move the chord booleans
(docs/protocol.md §10.5 note 3).

The chord state and the hotkey test now see `data.virtualKey`
unchanged; `KeyState.normalise(vk:)` is applied only on the posting
path, where "macOS has no keycode for either Shift" actually applies.
Without this, a replayed lock chord locked a Mac peer for any
`HotKeyLockMachine` requiring Ctrl or Alt while the Windows peer beside
it ignored the same bytes — wire compatibility, invariant 1.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 03:05:06 -07:00
lucioandClaude Sonnet 5 22b077b5df qa: input-inject QA log — REWORK (normalise-before-hotkey-match finding)
Gates green; verified KeyState.swift and Injector.swift against
InputSimulation.cs, Receiver.cs, InitAndCleanup.cs, InputHook.cs and
Event.cs. One confirmed finding: KeyState normalises side-less
modifier VKs before chord/hotkey matching, so a lock-chord replay
matches hotkeys Windows' side-specific-only switch would not match
from the same bytes — contradicts this lane's own protocol.md §10.4
note 3 citation. One plausible finding: the configurable lock hotkey
is missing Windows' RunOnLogonDesktop/RunOnScrSaverDesktop guard,
undocumented either way.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-09-16 03:03:04 -07:00
lucioandClaude Opus 5 ccb058ed3a input-inject: wheel remainder, release buttons at the real pointer
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 02:52:40 -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 d48f644450 input-inject: modifiers post as flagsChanged, monotonic click clock, move deltas
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 02:48:32 -07:00
lucioandClaude Opus 5 e0123a1745 input-inject: KeyState and Injector — CGEvent posting for Keyboard/Mouse packets
Ports InputSimulation.SendKey/SendMouse/InputProcessKeyEx and
InitAndCleanup.ReleaseAllKeys onto CGEvent posting: one tagged
hidSystemState source, held-key/button bookkeeping on the injector's
serial queue, click counting macOS needs and Windows drops, the
relative/absolute coordinate rules of Receiver.cs:147-153, and the
remote Win+L / Ctrl+Alt+Del interception.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 02:47:10 -07:00
lucioandClaude Fable 5.1 3c51e95969 input-capture: close lane (lead review); brief: input-inject
Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-16 02:38:11 -07:00
lucioandClaude Opus 5 add0fa4bbc input-capture: work-log entry for the rework round
Answers the four QA findings of 2026-09-16 by number, with what changed
and why, and records that the round was build-only: no tap created, no
`CGEvent` posted, no cursor moved, no permission requested.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 02:36:22 -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 09df9c09b2 input-capture: README states the real per-event lock counts
QA finding 3: the Assumptions bullet claimed "three acquisitions per
event at most (snapshot, virtual cursor, counters)", which named neither
`Screens` nor `CaptureQueue` and undercounted every path. Replaced with
the four lock objects the callback can reach and the count on each of the
four paths — local key 2, local move 3-4, remote key 3, remote move 5-6 —
counted from the code, with the extras (unmapped key, hotkey, escape,
modifier transitions) spelled out.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 02:34:28 -07:00
lucioandClaude Opus 5 ece6bbf8fd input-capture: handleMouse reads the screen layout only when remote
QA finding 2: `screens.layout` (a locked read) was taken before the
destination branch, but only the remote branch uses it. The local branch
is what runs for essentially every mouse event while this Mac keeps its
own pointer, so it was paying for a lock acquisition it discarded
(invariant 4: minimum work on the local path). Moved inside the
`isRemote` branch, matching `handleScroll`, which already checked the
destination before reading the layout.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 02:33:58 -07:00
lucioandClaude Opus 5 8af26751a8 input-capture: one lock for the tap's run loop and its thread
QA finding 1: `EventTap.thread` was a plain `var` read in `start()` and
written in both `start()` and `stop()`, while the class comment claimed
every cross-thread field was locked and `stop()` claimed to be safe from
any thread (the contracts-C2 signal-handler recovery calls it off the tap
thread). `runLoopLock` becomes `stateLock` and guards both fields;
`start()` claims the slot and tests it in one critical section so two
concurrent starts cannot both install a tap.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 02:33:39 -07:00
lucioandClaude Sonnet 5 2aa08946ad qa: input-capture QA log — gates green, four findings, verdict REWORK
Verified every Status/TODO tick against InputHook.cs/Event.cs/VK.cs/WM.cs/
WinAPI.cs/Common.cs and docs/protocol.md §10.4, docs/contracts.md C2-C4.
Findings: EventTap.thread unguarded across start()/stop() despite the
class's own Sendable-safety claim; screens.layout fetched unconditionally
on the hot local-mouse-move path; README's lock-count claim undercounts
actual acquisitions; a disabled-by-default Switch2AllPC swallow quirk vs
Windows. No typos fixed (all findings need real changes).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-09-16 02:31:07 -07:00
lucioandClaude Opus 5 84aa59a512 input-capture: coalescing looks back two entries
In remote mode one physical move queues a .mouse and an .edgeCandidate,
so matching only the last entry meant the kinds alternated and motion was
never coalesced -- the ring would fill at two entries per move whenever
the Engine stalled, which is the case C3's coalescing exists to survive.
The scan stops at the first non-motion entry so transitions keep order.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 02:19:38 -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 59fc7a3162 input-capture: coalescing two relative moves sums the deltas
Latest-wins is right for an absolute position and wrong for a
MOVE_MOUSE_RELATIVE delta, which would have silently dropped motion in
MoveMouseRelatively mode.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 02:14:52 -07:00
lucioandClaude Opus 5 c578e0a656 input-capture: the event tap, the hotkey matcher and Permissions.request
EventTap is InputHook on CGEventTap: one dedicated run-loop thread, the
injected-event tag passed through, keys/modifiers/mouse/scroll encoded to
WM_*/LLKHF_*, the virtual cursor clamped to primary+-1 as InputHook does,
Easy Mouse gating on edge candidates, and tap-loss re-enabling the tap
AND routing local (C2). HotkeyMatcher ports ProcessHotKeys including the
500 ms double-press lock and the Shift/Win veto; Permissions gains
request() and the 5 s health check.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 02:14:01 -07:00
lucioandClaude Opus 5 42c614591b input-capture: Screens and Cursor
ScreenLayout is GetScreenConfig/MonitorEnumProc on CGDisplayBounds, with
the four corners BlockMouseAtScreenCorners needs, refreshed on
didChangeScreenParameters. Cursor is HideMouseCursor plus the macOS-only
decoupling that keeps the real pointer still while a peer is controlled.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 02:09:27 -07:00
lucioandClaude Opus 5 d2d221fe29 input-capture: the routing snapshot lock and the bounded capture ring
RoutingState holds the snapshot and the virtual cursor behind one
OSAllocatedUnfairLock so the tap callback can decide synchronously
(contracts C3); CaptureQueue is the 4096-entry ring with the C3
coalescing and overflow policy, plus notices that survive a full ring.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 02:07:56 -07:00
lucioandClaude Opus 5 c4c04914b3 input-capture: InputTypes and KeyMap in MWBCore
The shared vocabulary of the input path (contracts C3, C4): the injected
event tag, the WM_*/LLKHF_* numbers, the routing snapshot, CapturedInput,
the hotkey config with the PowerToys defaults, and the macOS keycode <->
Windows VK table with the NX device modifier masks.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 02:06:31 -07:00
lucioandClaude Fable 5.1 1c24c9f67c control-channel: close lane (lead review); brief: input-capture
Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-16 01:57:56 -07:00
lucioandClaude Opus 5 c03b8cdbcf control-channel: the Awake test moves into Session, where the beat is
Round-2 QA finding: the channel reset beatInputEventCount on its own
clock, out of phase with every connection's heartbeat instant, so a
session could send Heartbeat (20) where Windows sends Awake (21) — and
Awake is what drives the peer's Common.HumanBeingDetected()
(Receiver.cs:245-248), the default-on BlockScreenSaver mechanism.

Windows's beat is the send: SendAwakeBeat() compares
lastRealInputEventCount against Event.RealInputEventCount and re-records
it in the same call (Common.cs:542-559). So the comparison belongs at the
send. Session.tick(now:userActive:) becomes
Session.tick(now:inputEventCount:), taking the raw process-wide counter
(Event.cs:51-55, InputHook.cs:223, 345) and keeping its own
beatInputEventCount — Common.lastRealInputEventCount, Common.cs:543 —
recorded on both branches (:558).

ControlChannel loses lastBeatAt and beatInputEventCount entirely;
noteUserActivity() only increments the counter and tick() hands the same
value to every connection. No userActive-shaped name is left in Sources.

Sources/MWBCore/Session.swift is session-matrix's file, edited for this
fix with the lead's authorisation, as is that lane's Handshakes section.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 01:57:03 -07:00
lucioandClaude Sonnet 5 23eddb42b9 control-channel: round-2 QA — findings 1/2 fixed, new heartbeat-phase finding
Verified the rework against SocketStuff.cs, Common.cs, Event.cs and
InputHook.cs: finding 1 (Resolver two-group control flow) and finding 2
(id-collision gated to outbound) are both correctly fixed and cited, and
the literal ask for finding 3 (counter compare, not sliding window) is met.

But reading how ControlChannel's userActive is actually consumed by
Session.tick (Sources/MWBCore/Session.swift) turned up a new problem: the
channel's own beat-reset clock (ControlChannel.swift:457-471) is not
synchronized with any connection's actual heartbeat send, which is decided
independently by each Session's own nextHeartbeat. A connection can read
userActive == false at its own send instant even though real input happened
since its own previous heartbeat, silently downgrading Awake to Heartbeat
for that peer — in the default (blockScreenSaver = true) configuration.
Documented with a concrete timeline; verdict REWORK.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-09-16 01:52:56 -07:00
lucioandClaude Opus 5 fa9d914c91 control-channel: README rework entry for the three QA findings
Dated 2026-09-16 work-log entry answering findings 1-3 by number plus the
CLAUDE.md re-read, and the Assumptions bullets the fixes changed (name
resolution per group, the client-only id collision, the userActive
counter rule).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 01:44:32 -07:00
lucioandClaude Opus 5 c4ac584df0 control-channel: CLAUDE.md re-read — citation and doc-comment fixes
Item 4 of the rework brief: re-read the four MWBNet files against
CLAUDE.md. Sizes (189/234/356/524), function lengths, layering, the
one-sentence responsibility test, no force-unwrap/try!/fatalError/
precondition, no logging of any kind and no packet interpretation all
hold; `swift-format format -i` is a no-op on all four. Three citations
were off and are corrected against the source:

- `Common.SendByeBye` is Common.cs:611-615, not 612-616 (ControlChannel,
  PeerConnection).
- `SkSend`'s stamp-and-fan-out is Common.cs:916-930, and the
  `Des == ID.ALL` matrix test is :922-930, not :912-930 / :919-929.

`DisconnectReason.idCollision` and `channelDetectedIDCollision` now say
in their doc comments what the previous commit made true in the code:
the collision is looked for on outbound connections only
(SocketStuff.cs:1980-1992).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 01:43:07 -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
lucioandClaude Sonnet 5 09ca9906e8 qa: control-channel QA log — gates green, two protocol findings, verdict REWORK
Verified gates, TODO ticks against SocketStuff.cs, C1-C4 compliance,
Sendable justification and no key/packet logging. Two undocumented
behavioural deviations from Windows found by line-by-line comparison:
Resolver.addresses merges the Name2IP/DNS same-subnet checks instead of
running them separately (and misses Windows's early return when the
Name2IP group fails its check), and ControlChannel detects machine-id
collision on inbound connections too where Windows gates that on
IsClient. A third, minor, doc-only note on the userActive heuristic.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-09-16 01:37:08 -07:00
lucio 4e4a6d745c control-channel: a matrix change resets the dial budget 2026-09-16 01:26:36 -07:00
lucio 5a9a1dd60a control-channel: README (shipped API, deviations, work log) and TODO §3 2026-09-16 01:25:32 -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
lucio f6cc824e91 control-channel: ChannelConfig, Resolver, PeerConnection, ControlChannel; drop MWBNet placeholder 2026-09-16 01:21:18 -07:00
lucioandClaude Fable 5.1 0db3aa8c9a session-matrix: topo handshakes 3/4/6, loop log
Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-16 01:09:41 -07:00
lucioandClaude Fable 5.1 5f9a18cf83 session-matrix: close lane (lead review, topo handshakes 3/4/6)
Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-16 01:09:13 -07:00
lucio b085023f3a brief: control-channel 2026-09-16 01:08:39 -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 f190157535 session-matrix: CLAUDE.md compliance pass and the rework work-log entry
Re-read all seven files: no force-unwrap, try!, fatalError or
precondition; longest file 422 lines (Session.swift), longest function 26
(countUntrusted); nothing logs. Corrected four SocketStuff.cs citations
that were off by one or two against the reference checkout (:1390->:1389,
:1441->:1439, the untrusted branch :1386-1500 -> :1387-1529).
`xcrun swift-format format -i --recursive Sources Package.swift` made no
further changes; tools/gates.sh green.

Work log gains a dated rework entry answering QA findings 1-3 and
contract C1 by number.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 01:02: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 9252158bbc session-matrix: parkCursor carries the HideMouseCursor gate
QA finding 3. HideMouseCursor moves the real cursor only when
(desMachineID != MachineID && desMachineID != ID.ALL) || byHideMouseMessage
(Common.cs:1488), and SwitchToMachine calls it after setting DesMachineID
(MachineStuff.cs:1025) — so control coming home parks nothing. The action
is now .parkCursor(destinationIsRemote:byHideMouseMessage:), both halves
of that gate pre-evaluated by Switcher (new .destinationIsRemote), so
input-inject can implement it without reading the Windows source. Spelled
out as a consumer rule in the README's Handshakes.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 00:59:29 -07:00
lucioandClaude Opus 5 e0638de0b9 session-matrix: learn() persists only when a new machine is learned
QA finding 2. AddToMachinePool returns inside the TryFindMachineByName
branch (MachineStuff.cs:737), before the UpdateMachinePoolStringSetting()
at :755 — which is reachable only from the fall-through "new machine"
path. Switcher.learn was returning [.persistMachinePool] from the known
branch too, asking the app to write MachinePool to disk on every
heartbeat cadence tick from every already-known peer. It now returns [].

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 00:58:52 -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
lucioandClaude Fable 5.1 08b243a29a contracts: sequencing, recovery, concurrency, shared constants, checkpoints
Written after an external review of the plan found cross-module
behaviour under-specified. TODO, topo, loop and the session-matrix
brief now reference docs/contracts.md.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-16 00:54:33 -07:00
lucioandClaude Sonnet 5 e588f1f71c session-matrix: QA log — gates green, three findings, verdict REWORK
Verified handshake/trust gate, dedup ring, one-row/two-row neighbour
search, matrix packet encoding, edge/landing geometry and the relative
and pixel biases against the Windows source; all faithful. Three
findings: the 10-untrusted-packets rule doesn't count read errors like
Windows does, Switcher.learn persists the pool on every known-peer
heartbeat, and SwitchAction.parkCursor doesn't carry enough information
for a future consumer to replicate HideMouseCursor's real-cursor-move
gating without rereading the Windows source.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-09-16 00:52:25 -07:00
lucio 2997c88440 session-matrix: Session.forward for pre-sequenced broadcasts; doc counts 2026-09-16 00:42:52 -07:00
lucio 605a9753b0 session-matrix: README handshakes/status/work log, TODO section 2 2026-09-16 00:42:32 -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 8d61347218 session-matrix: MachinePool, Matrix + Matrix packets, Coordinates, Edge, Switcher, Session 2026-09-16 00:37:29 -07:00
lucio 73de465986 session-matrix: PacketSequencer and ReplayFilter (protocol 1.4) 2026-09-16 00:27:40 -07:00
lucio 55213cb9d8 brief: session-matrix 2026-09-16 00:22:33 -07:00
lucioandClaude Fable 5.1 be7c4e934b wire-core: close lane; lanes now run directly on main, no worktrees
Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-16 00:21:29 -07:00
lucioandClaude Fable 5.1 1ed49d145e Merge lane/wire-core: DATA packet, framing, magic hash, CBC stream
Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-16 00:21:25 -07:00
lucio 9283946c30 wire-core: lead review — merge 2026-09-16 00:21:25 -07:00
lucioandClaude Sonnet 5 e13748c225 wire-core: QA log — gates green, port verified against Windows source
Verdict: PASS. Checked every PackageType value, byte offset, the
checksum range, the magic-hash shift/overflow expression, PBKDF2
parameters and the 48-byte stream preamble against the Windows source
directly, and re-derived the documented magic-number and PBKDF2
examples independently in Python. No findings beyond the hex-gloss typo
already fixed in the prior commit.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-09-16 00:19:53 -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