CLAUDE.md gains a 'How this project is developed' section: strictly serial Dev (Opus 5) -> QA (Sonnet 5, code quality) -> lead inspection; commit along the way without requiring every commit to compile; the user is the tester. docs/loop.md, docs/topo.md and TODO.md are rewritten to a serial lane order with no test-writing items; the test targets are removed and tools/gates.sh is lint + layering grep + build. Co-Authored-By: Claude Fable 5.1 <[email protected]>
7.7 KiB
7.7 KiB
TODO — mwb-mac backlog, one lane at a time
Legend: (core) MWBCore, (net) MWBNet, (mac) MWBMac,
(app) executable/tooling. Lanes run strictly in this order
(docs/topo.md §3, docs/loop.md §6); each lane ticks only its own
lines. Items describe Windows behaviour to port, with the
docs/protocol.md section that specifies it. No test-writing items
exist by the user's instruction — the user tests the app.
0. bootstrap (app) — done 2026-09-15
- SwiftPM skeleton, four targets, layering enforced by
tools/gates.sh. tools/gates.sh(lint + build),tools/bundle.sh,tools/lane.sh,.swift-format,Resources/Info.plist.mwb --version,mwb --check-permissions.docs/loop.md,docs/features/TEMPLATE.md.- Xcode 27.0 installed; toolchain verified.
1. packet-codec (core) — Sources/MWBCore/Packet.swift, Framing.swift
PackageType(rawUInt8, every value in protocol §1.2), the big/small rule §1.1, unknown values tolerated.Packetvalue type over a 32/64-byte little-endian buffer with the union views: mouse, keyboard, nonce, postAction, machineName, 48-byte clipboard payload at offset 16.- ASCII, space-padded, 32-byte machine name; non-ASCII refused.
Framing.seal/Framing.openexactly as §1.3 (checksum over bytes 2..31 only; magic top 16 bits; bytes 1–3 zeroed on open).
2. cipher-stream (core) — Sources/MWBCore/MagicHash.swift, CipherStream.swift
magicNumber(for:)per §2.1 (50 001 SHA-512 rounds,<< 23overlap, UTF-16 unit truncated to a byte, 32-byte buffer).- PBKDF2-HMAC-SHA512, 100 000 rounds, 32 bytes, via CommonCrypto.
CipherWriter/CipherReader: 16+16 cleartext header, 16-byte sacrificial block, AES-256-CBC no padding, streaming with partial block buffering (§2.3). Descriptions never include secrets.
3. session (core) — Sources/MWBCore/Session.swift
- Sans-I/O state machine:
feed(bytes) -> [Event],outgoing() -> Data,SocketStatusNA…Connected (§3.2). - Handshake: 10×
Handshake, nonce complement,HandshakeAck, adopt peer name/id, >10 untrusted packets ⇒ InvalidKey, self-connection close, >10 failures from one endpoint ⇒ give up (§3.2). - Dedup ring of 50 ids with the four exemptions (§1.4).
- Heartbeat 60 s / 300 s,
AwakevsHeartbeat,Hicounting,ByeBye, 25 min liveness; injected clock (§3.3).
4. matrix-edge (core) — Sources/MWBCore/Matrix.swift, Edge.swift
Matrix(4 slots, one/two rows, wrap),MachinePool(Name:Id,…serialisation, 25 min alive) §4.1.Matrixpacket encode/decode (slot inSrc, flags inType) §4.2; learning peers from Heartbeat/Hello/Awake.LiveMachineMatrix, move left/right/up/down,desMachineID, ALL mode.- Edge detection §4.3 (primary-vs-desktop rectangle rule, 100 ms
debounce, corner blocking) and coordinate normalisation §4.4 (all
four rectangle cases, relative-move biases,
NextMachine).
5. control-channel (net) — Sources/MWBNet/ControlChannel.swift, Resolver.swift
NWListeneron port+1, both IP families; oneNWConnectionper non-local matrix name; 1 s retry for 30 s; one client socket per peer (§3.1).Resolver:getaddrinfo+Name2IPlines; optional /16 and reverse-lookup checks (§7).- One
Session+ one cipher pair per connection; serialised sends with 500 ms timeout; 32-then-32 receive. - Reconnect on path change, wake, reset, hotkey; delete
Placeholder.swift.
6. event-tap (mac) — Sources/MWBMac/EventTap.swift, Permissions.swift, Sources/MWBCore/KeyMap.swift
Permissions.request…added to the existing preflight file.- Session-level, head-insert, swallowing
CGEventTapfor keys, flags, mouse, scroll; enqueue and return; pass tagged injected events; re-enable on timeout/user-input disable (invariants 3, 4). - Modifier tracking and hotkey matching per §4.5 with D4 mapping (⌘=Win, ⌥=Alt); Easy Mouse modes.
KeyMap: macOS keycode ↔ Windows VK,flagsChanged→ modifier VK pairs,LLKHFflags;WM_*mouse mapping, wheel ×120, X-buttons, absolute 0..65535 moves (§5).
7. screens-cursor (mac) — Sources/MWBMac/Screens.swift, Cursor.swift
- Display list, primary, desktop union, corner points; refresh on screen-parameter change.
- Park/hide cursor (primary centre-x, y=4), decouple cursor while
controlling a remote, restore on return;
HideMouse (50)(§5.3).
8. input-inject (mac) — Sources/MWBMac/Injector.swift
Keyboardpacket →CGEventdown/up via KeyMap; modifiers asflagsChanged; repeat as repeated downs.Mousepacket → absolute move (de-normalise onto desktop bounds §4.4), buttons with click-count, wheel (WheelDelta/120), X-buttons.- Injected-event tag;
ReleaseAllKeyson switch/lock; remote Win+L → lock; remote Ctrl+Alt+Del → ignored.
9. menubar-app (app + core + mac) — Sources/mwb/*, Sources/MWBMac/StatusItem.swift, Sources/MWBCore/Settings.swift
Settings: PowerToys schema (README §Settings), load/save/watch, 0600, random key /MachineID/DeviceIDon first run.- Menu-bar item with per-machine status dots in the documented colours; matrix editor; key entry; port; toggles; Reconnect; Quit.
- Permissions onboarding; LaunchAgent install/uninstall; single instance; logs without key material.
- Wire everything: tap → edge → session → channel → injector.
- Hand
dist/mwb.appto the user with a checklist: switch by edge and hotkey, wrap, one/two rows, keyboard with modifiers and function keys, wheel, reconnect after sleep, wrong key, peer killed mid-control.
10. clipboard-inband (core + mac) — Sources/MWBCore/ClipboardCodec.swift, Sources/MWBMac/Pasteboard.swift
- Text codec
TXT/RTF/HTM+ SEP, UTF-16LE, raw DEFLATE (§6.1); confirm Foundation.zlibmatches .NETDeflateStreamby reasoning from the docs, note the decision. - 48-byte chunks at offset 16,
ClipboardDataEnd, zero-padding semantics, 1 MB limit (§6.2); PNG images. NSPasteboardpolling (500 ms), 1 s suppression, write on receive,ShareClipboardflag.
11. clipboard-bulk (net) — Sources/MWBNet/BulkChannel.swift
- Listener on port;
Clipboard (69)broadcast; pull onMachineSwitched, push onClipboardAsk(§6.3). - Bulk handshake, 1024-byte UTF-16LE
"<len>*<name>"header, 1 MB chunks, 32-byte file padding, exact-length read, atomic commit to~/Desktop/MouseWithoutBorders/; 100 MB limit;TransferFileflag.
12. end-to-end polish
- Driven entirely by the user's testing findings; each becomes a line here with the lane that owns the fix.
13. Later (post-v1)
- Keychain storage for
SecurityKey(D3). - Easy Mouse fullscreen suppression + excluded apps.
Heartbeat_exkey propagation (§3.3).- "Swap ⌘/⌃ when controlling Windows" option.
- Non-US keyboard layouts: by position vs by character.
- CI on the Gitea runner running
tools/gates.sh(lint + build only). - Updates, notarization, Homebrew cask.
14. Out of scope, with reasons (D6)
- Windows service / logon-screen / UAC secure-desktop control: the macOS login window cannot be driven from a user-session event tap.
- Explorer drag-and-drop (§6.4): depends on a Windows-shell helper.
- Screen capture to Paint: niche; packets ignored and logged.
- GPO, telemetry,
ShowOriginalUI: Windows-only. - Animated fake cursor (
DrawMouse): cosmetic.