//! User-scoped daemon infrastructure: endpoint discovery, hard single-winner
//! startup lock, and protocol-version handshake.
//!
//! This module provides the building blocks for the `leindexd` daemon and the
//! thin stdio shim that forwards MCP/JSON-RPC frames to it (spec §4.1, §4.2).
//! The daemon module itself is NOT feature-gated: the types it defines
//! (`Handshake`, `DaemonEndpoint`, `StartupOutcome`) are used by both the inline
//! server path and the daemon-client path. The actual shim forwarder and spawn
//! helpers that pull in tokio/UnixStream dependencies are feature-flagged under
//! `daemon-client` in later tasks.
/// Synchronous, `std`-only stdio shim used by `leindex mcp` (wire v2).
/// Daemon endpoint discovery + liveness checking.
/// Protocol-version handshake (spec §12.1).
/// Connection preamble (hello/ack) between shim and daemon, wire v2.
/// Stdio shim forwarder: connects to `leindexd` and byte-faithfully proxies
/// MCP/JSON-RPC frames between stdin/stdout and the daemon Unix socket
/// (spec §4.1). Unix-only: the daemon transport is a Unix domain socket
/// (Windows bundles carry the client alone).
/// Daemon spawn helper (creates `leindexd` when the shim wins the startup race).