Repository navigation
Add Named Pipe transport to nodespace CLI for Windows support - #2610
Merged
Merged
Conversation
The nodespace CLI's run()/connect*() helpers were gated #[cfg(unix)] around a Unix Domain Socket-only transport, with a Windows run() falling straight to anyhow::bail!. Add a Windows Named Pipe client transport that dials the same \\.\pipe\nodespace-daemon pipe the daemon already serves (packages/daemon/src/main.rs, added in #1440), mirroring the desktop app's own client-side pipe transport (packages/desktop-app/src-tauri/src/services/grpc_client.rs). - dial_channel() is now platform-gated internally (UnixStream on Unix, tokio::net::windows::named_pipe::ClientOptions on Windows) behind one shared signature, so connect()/connect_import()/ connect_session()/connect_local_agent()/connect_database() and the run() dispatch stay a single, non-duplicated cross-platform implementation rather than parallel per-platform copies. - resolve_pipe_name() resolves --socket/NODESPACED_SOCKET/default on Windows, mirroring resolve_socket_path()'s Unix-only override chain. - Regenerated packages/skill/references/cli.md for the updated --socket flag help text. Closes #1452.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
This was referenced Sep 14, 2026
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.
Summary
The
nodespaceCLI only supported Unix Domain Socket transport (#[cfg(unix)]) —run()on Windows returned ananyhow::bail!stub, so the CLI could never connect tonodespacedon Windows. The daemon side already had Named Pipe transport (tokio::net::windows::named_pipe, added in #1440), listening on\\.\pipe\nodespace-daemon. This adds the matching client-side transport.dial_channel()is now platform-gated internally:UnixStreamon Unix (unchanged),tokio::net::windows::named_pipe::ClientOptionson Windows — mirroring the desktop app's existing client-side pipe transport (packages/desktop-app/src-tauri/src/services/grpc_client.rs) and the daemon's server-side pipe setup (packages/daemon/src/main.rs).connect()/connect_import()/connect_session()/connect_local_agent()/connect_database()and therun()dispatch are a single, non-duplicated cross-platform implementation — they only calldial_channel(&sock), so the platform branch lives in exactly one place instead of being copy-pasted per helper.resolve_pipe_name(override_: Option<&str>) -> Stringresolves--socket→NODESPACED_SOCKETenv → default\\.\pipe\nodespace-daemon, the Windows counterpart of the existing Unix-onlyresolve_socket_path()— kept separate rather than unified since the two transports resolve differently (Unix probes several build-variant socket files on disk; the pipe namespace is machine-global with nothing to probe).#[cfg(windows)] anyhow::bail!stub; there is now onerun()for both platforms.packages/skill/references/cli.md(generated from the CLI's own clap definitions) for the updated--socketflag help text.#[cfg(windows)]unit tests forresolve_pipe_name's override/env/default resolution order.Closes #1452.
Real Windows verification
I have real SSH access to an actual Windows 11 machine (build 26200) on the same Tailscale network this session, specifically to build and test this for real rather than only cross-referencing docs.
Environment gap hit and how it was worked around:
nodespace-cli's binary cannot currently be linked on this Windows box, because it depends onnodespace-daemon(for re-exported client types), which has a mandatory (non-optional, default-on-feature) dependency onnodespace-nlp-engine→llama-cpp-2/llama-cpp-sys-2, which needsbindgen, which needslibclang— not installed on this machine, and installing LLVM was blocked by this session's safety classifier (the same class of restriction that blocked setting up git-push credentials on this box — installing a new heavy toolchain judged too sensitive to route around silently). This is a real, pre-existing environment gap, unrelated to this change (the GNU Rust toolchain's own C compiler, mingw64 gcc, was present and used successfully once put onPATH, fixing a separatelibsql-ffibuild error along the way).Given that, I isolated and verified the actual new/changed transport code end-to-end for real, instead of only reasoning about it:
Built the real, unmodified
nodespace-daemon/nodespace-clias far as they'd go, confirming exactly where the pre-existing libclang gap bites (not related to this change):Wrote a small standalone harness crate (
pipe-verify, not part of the workspace, never committed) containing a byte-for-byte copy of:resolve_pipe_name()and the Windowsdial_channel()frompackages/cli/src/lib.rs(client side), andNamedPipeConn/ServerOptionsNamed Pipe server plumbing frompackages/daemon/src/main.rs(server side, serving the standardtonic-healthgRPC service instead of the full daemon service graph, which is what pulls in nlp-engine).This builds cleanly on the Windows box with the GNU toolchain (no bindgen/libclang needed —
tonic/tokio/hyper-util/toweronly) and exercises the exact sametokio::net::windows::named_pipe::ClientOptions::open()→hyper_util::rt::TokioIo→tonic::transport::Endpoint::connect_with_connectorwiring this PR adds, against the exact sameServerOptions::new().first_pipe_instance(false).create(&name)/server.connect()pattern the real daemon uses.Ran both for real, over SSH, on the Windows box:
This is a genuine client process connecting to a genuine server process over a real Windows Named Pipe, completing a real gRPC unary RPC round trip — using this PR's actual transport-dialing code, unmodified.
Only the MSVC target was not evaluated (Visual Studio Build Tools /
cl.exeis not installed on this box and installing it was out of scope per the task's own guidance) — CI/release Windows builds should confirm the MSVC target separately; nothing in this change is toolchain-specific (tokio::net::windows::named_pipebehaves identically under both ABIs).Test plan
bun run testbaseline: 240 files / 4951 tests passedbun run test:all: full unit + browser + Rust suite, no new failuresbun run quality:fix:cargo fmt+cargo clippy --all-targets -D warnings -D clippy::unused-asynccleancargo build -p nodespace-cliandcargo test -p nodespace-cli --lib(107 tests) still pass unchanged on the Unix side🤖 Generated with Claude Code