feat: Windows support for the bridge via herdr's named pipe#27
feat: Windows support for the bridge via herdr's named pipe#27mikebenner wants to merge 2 commits into
Conversation
herdr's Windows beta does not expose AF_UNIX: the .sock path on disk is
a <pid>:<start_ns> pointer file, and the real transport is a named pipe
whose name is the full socket path (\.\pipe\C:\...\herdr.sock).
Bun.connect({unix}) cannot open named pipes, but Bun's node:net can, so
the two dial sites in herdr-client.ts now route through bridge/dial.ts,
which adapts node:net to the same write/flush/end handler shape on
win32 and stays on Bun.connect everywhere else.
Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VutEkP9A8oY72ZQBfFJdSw
…ization, APPDATA default, tests Review follow-ups from #25/#27 cross-review: - dialHerdr exposes onDial(cancel) so a caller timeout that fires mid-connect aborts the pending dial instead of leaking the OS handle (both request() and subscribeEvents() wire it up); a dial destroyed before connect now settles its promise instead of pending forever. - toPipeName() passes through already-prefixed pipe names (either slash direction) instead of double-prefixing. - defaultSocketPath() resolves %APPDATA%\herdr\herdr.sock on win32 so HERDR_SOCKET_PATH is no longer required there; pure and unit-tested. - New dial.test.ts: pure toPipeName cases everywhere, plus live named- pipe round-trip, mid-codepoint chunk split, connect-error, and cancel coverage on win32 (skipped elsewhere). - SockHandle.end() documented as immediate destroy, not a drained close. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VutEkP9A8oY72ZQBfFJdSw
|
Pushed 85a7411 addressing the gaps flagged in the #25/#27 cross-review: 🤖 Generated with Claude Code |
…ization, APPDATA default, tests Review follow-ups from #25/#27 cross-review: - dialHerdr exposes onDial(cancel) so a caller timeout that fires mid-connect aborts the pending dial instead of leaking the OS handle (both request() and subscribeEvents() wire it up); a dial destroyed before connect now settles its promise instead of pending forever. - toPipeName() passes through already-prefixed pipe names (either slash direction) instead of double-prefixing. - defaultSocketPath() resolves %APPDATA%\herdr\herdr.sock on win32 so HERDR_SOCKET_PATH is no longer required there; pure and unit-tested. - New dial.test.ts: pure toPipeName cases everywhere, plus live named- pipe round-trip, mid-codepoint chunk split, connect-error, and cancel coverage on win32 (skipped elsewhere). - SockHandle.end() documented as immediate destroy, not a drained close. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VutEkP9A8oY72ZQBfFJdSw
|
Thanks, this is the right shape. One shim, one seam, Your Both your commits are cherry-picked onto main with authorship preserved. What I added on top:
I left On your review of #25: it was accurate and well evidenced, and re-verifying the central claim before commenting was the right call. Thanks for doing that rather than just advocating for your own PR. Merged to main as dd6610d. Closing this as merged via cherry-pick. |
What
Runs the Collie bridge natively on Windows against herdr's Windows beta. One new file (
bridge/dial.ts) plus routing the twoBun.connectsites inbridge/herdr-client.tsthrough it. No behavior change on Linux/macOS — off win32 the shim delegates straight toBun.connect({unix}).Why it works
herdr's Windows beta doesn't use AF_UNIX: the
.sockpath on disk is a small pointer file (<pid>:<start_ns>), and the actual transport is a named pipe whose name is the full socket path —\\.\pipe\C:\Users\<you>\AppData\Roaming\herdr\herdr.sock.Bun.connect({unix})can't dial named pipes, but Bun'snode:netcan, and it adapts cleanly to the samewrite/flush/endhandler shape both call sites already use (the settled/fireDown re-entrancy guards work unchanged; the shim mapsend()todestroy()so close stays prompt for the one-shot RPCs).Scope / limitations
collie-ctl.sh, the systemd unit, andtailscale serveare untouched — on Windows I runbun run bridge/index.tsdirectly, in the README's Variant C posture (loopback bind, own ingress in front,COLLIE_PUBLIC_HOSTSpinned).COLLIE_MULTI_SESSION=offis the right setting on Windows.herdr-plugin.tomlplatforms are untouched (the plugin actions are bash).Tested
0.7.4-preview(protocol 16) on Windows 11:session.snapshotpolling,events.subscribestream up + resubscribe on pane changes, pane reads and replies, web UI served — running as my daily driver behind a NetBird mesh.bun run build(both typechecks) passes on Windows.bun run test: 205 pass / 14 fail — identical counts on a pristine checkout ofafa53fe; the 14 are pre-existing Windows-environment assumptions in tests (0600 permission fixtures, POSIX path fixtures), none in code this PR touches.Versioning
Left the version/CHANGELOG for your release flow (matching how #22 landed) — happy to push a
0.15.0bump + CHANGELOG entry citing the feature hash if you'd rather have it in the PR, and likewise a short README "Windows (experimental)" note.🤖 Generated with Claude Code
https://claude.ai/code/session_01VutEkP9A8oY72ZQBfFJdSw