Repository navigation
Description
Overview
Build the nodespaced binary — the background daemon that owns the RocksDB lock and exposes all NodeSpace services over gRPC on localhost:50051. This issue covers the server startup, NodeService handler registration, and graceful shutdown. It is the second step in the ADR-031 daemon-client architecture.
Problem Statement
All NodeSpace services currently live inside the Tauri process. ADR-031 moves them to a dedicated background daemon (nodespaced) that starts independently of any UI and remains running as long as the user's session is active. Without this daemon, no gRPC client (Tauri UI, CLI, agent tools) can connect.
Proposed Solution
Implement packages/daemon/src/main.rs as a tokio-based async binary that initializes NodeService (from packages/core), registers it with a tonic gRPC server, binds to localhost:50051, and handles SIGTERM/SIGINT for graceful shutdown.
Acceptance Criteria
-
nodespacedbinary builds and starts without error - gRPC server listens on
localhost:50051 - All
NodeServiceRPC methods (CreateNode,GetNode,UpdateNode,DeleteNode,GetChildren,SearchNodes) are registered and respond correctly -
WatchNodesstreaming RPC is registered (may returnUnimplementedinitially — covered by dedicated streaming issue) -
Chatstreaming RPC is registered (may returnUnimplementedinitially) - Graceful shutdown on
SIGTERM/SIGINT: in-flight requests complete, server stops accepting new connections, RocksDB closes cleanly -
cargo build --bin nodespacedsucceeds - Integration test: start daemon, send
GetNodevia gRPC client, verify response - Code passes
bun run quality:fix
Technical Specifications
Files to create/modify
packages/daemon/src/main.rs— binary entry point, server setup, shutdown handlerpackages/daemon/src/services/node_service.rs— tonicNodeServicetrait implementation wrappingpackages/coreopspackages/daemon/src/services/mod.rs— module exportspackages/daemon/Cargo.toml— addtokio,tonic,anyhowdependencies; declare[[bin]]target
Server startup pattern
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let addr = "[::1]:50051".parse()?;
let node_service = NodeServiceImpl::new(/* core NodeService */);
Server::builder()
.add_service(NodeServiceServer::new(node_service))
.serve_with_shutdown(addr, shutdown_signal())
.await?;
Ok(())
}NodeService implementation
The tonic service impl wraps packages/core/src/ops/ — each RPC handler calls the corresponding op function and maps anyhow::Error to tonic::Status.
Dependencies (Cargo.toml)
tokio = { version = "1", features = ["full"] }
tonic = "0.12"
anyhow = "1"
tracing = "0.1"
tracing-subscriber = "0.3"Reference files
packages/core/src/ops/— business logic layer to wrap in gRPC handlerspackages/core/src/node_service.rs— existing NodeService trait to adaptpackages/daemon/proto/node_service.proto— proto definition (from Define protobuf schema and set up tonic/prost build pipeline for nodespaced #1111)
Dependencies
Non-Goals
- Tauri command migration (separate issue)
WatchNodesstreaming implementation (separate issue)- CLI binary (separate issue)
- System tray (separate issue)
Activity
malibio commentedon May 17, 2026
Frontend baseline: 128 test files, 3918 tests passed (Duration 66.93s). Starting work in isolated worktree on branch feature/issue-1112-nodespaced-grpc-server.
Implement nodespaced binary: gRPC server and NodeService handlers (#1131
WIP: gRPC proxy migration for #1113 — Phases 2-4 of 5 complete
Implement nodespaced binary: gRPC server and NodeService handlers (#1131