feat(lbm-agent): the connection to the hook, and a fake hook to develop against - #624
Merged
Merged
Conversation
…thing - lbm-ipc::endpoint: where the hook listens, one definition for the daemon and its clients; lbm-hook now takes its default endpoint from it (same names as before). client::listen is written as the C# client writes it, and client::messages batches commands in one frame, as C# sends every batch (Load and Run together keep the hook up across a re-apply). - lbm-agent::hook: one connection for both directions — subscribe, then events in and commands out in order (C# opened a connection per command). Kept up, retried every 100 ms; Lost when it drops, Unreachable on the first failed attempt then every ~5 s (the supervisor's cue). Commands given while disconnected are dropped, never replayed stale. - lbm-agent::fake_hook: speaks the protocol and answers as lbm-hook does, touching no input device: what --fake-hook will run, and what the tests talk to over a private endpoint. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Phase 3 of the v6 plan, next brick after the reconciler (#623): the agent's connection to the hook, and a fake hook to develop and test it without capturing anyone's mice.
lbm-ipcendpoint: where the hook listens — the Linux socket ($XDG_RUNTIME_DIR/littlebigmouse-v1.sock, else in the data dir), the per-session Windows pipe,LBM_HOOK_ENDPOINT— one definition for the daemon and its clients.lbm-hooknow takes its default endpoint from it: same names as before, no behaviour change.client::listenis spelled as the C#LocalIpcClientwrites it;client::messagesbatches commands in one<Messages>frame, as C# sends every batch — Load and Run together keep the hook up across a re-apply (frame_rehooks).lbm-agenthook::HookClient: one connection for both directions — subscribe (Listen), then events in and commands out, in order. (C# opened a fresh connection per command, which is one of the ways commands could reach the daemon out of order — Cursor gets trapped at screen edges after disconnecting and waking from sleep #607/fix: never hook a layout the desktop no longer matches (#607) #609.) Kept up and retried every 100 ms;Lostwhen it drops (C# synthesizesDeadthere),Unreachableon the first failed attempt then about every 5 s (C#'sConnectionFailedcadence, the cue for launching a hook). Commands given while disconnected are dropped, never replayed stale — a reconnected hook asks for its layout anyway (Connected→Stopped, answered by the reconciler).fake_hook::FakeHook: speaks the protocol and answers aslbm-hookdoes (state on Listen, Loaded/LoadFailed, Running/Stopped, Load unhooks unless its frame also runs), touching no input device. What--fake-hookwill run, and what the tests talk to over a private endpoint.Tests
Against the fake hook over a real Unix socket (a named pipe on the Windows runner): subscription and state, Load+Run in one frame, the hook's own events, loss and reconnection with nothing replayed, and the unreachable cadence. Repeated 15 times locally without a failure.
Nothing launches or talks to the real hook yet: supervision (D5) and the runtime come next.
🤖 Generated with Claude Code