Skip to content

Define protobuf schema and set up tonic/prost build pipeline for nodespaced #1111

Closed

Description

@malibio

Overview

Establish the protobuf schema and build infrastructure for nodespaced, the background daemon that will own all NodeSpace services. This is the foundation for ADR-031 (daemon-client architecture): every other daemon and CLI issue depends on this build pipeline being in place.

Problem Statement

NodeSpace currently uses Tauri commands for all IPC between the UI and backend. ADR-031 replaces this with gRPC — nodespaced runs a gRPC server, and the Tauri app, CLI, and agent tools all connect as pure gRPC clients. Before any of that can be built, the proto definitions and the tonic/prost build pipeline must exist.

Proposed Solution

Create a packages/daemon/ Rust crate with the proto definitions, a build.rs that compiles them via tonic-build, and a protoc-bin-vendored dependency so there is no system protoc requirement.

Acceptance Criteria

  • packages/daemon/ crate exists and is added to the Cargo workspace
  • proto/node_service.proto defines NodeService with all methods listed in Technical Specifications
  • proto/agent_session_service.proto defines AgentSessionService with all methods listed in Technical Specifications
  • build.rs uses tonic-build + protoc-bin-vendored to compile protos at build time
  • Generated Rust types compile without errors (cargo build -p daemon)
  • No system protoc required — vendored binary used automatically
  • cargo test -p daemon passes
  • Code passes bun run quality:fix

Technical Specifications

New files

  • packages/daemon/Cargo.toml — crate manifest
  • packages/daemon/build.rs — tonic-build invocation
  • packages/daemon/proto/node_service.proto — NodeService definition
  • packages/daemon/proto/agent_session_service.proto — AgentSessionService definition
  • packages/daemon/src/lib.rs — re-exports generated code
  • Cargo.toml (workspace root) — add packages/daemon member

NodeService proto

syntax = "proto3";
package nodespace;

service NodeService {
  rpc CreateNode(CreateNodeRequest) returns (NodeResponse);
  rpc GetNode(GetNodeRequest) returns (NodeResponse);
  rpc UpdateNode(UpdateNodeRequest) returns (NodeResponse);
  rpc DeleteNode(DeleteNodeRequest) returns (DeleteNodeResponse);
  rpc GetChildren(GetChildrenRequest) returns (NodeListResponse);
  rpc SearchNodes(SearchRequest) returns (NodeListResponse);
  rpc WatchNodes(WatchRequest) returns (stream NodeEvent);
  rpc Chat(stream ChatRequest) returns (stream ChatResponse);
}

AgentSessionService proto

syntax = "proto3";
package nodespace;

service AgentSessionService {
  rpc LaunchSession(LaunchSessionRequest) returns (LaunchSessionResponse);
  rpc StreamOutput(StreamOutputRequest) returns (stream OutputChunk);
  rpc WriteInput(WriteInputRequest) returns (WriteInputResponse);
  rpc ResizeTerminal(ResizeRequest) returns (ResizeResponse);
  rpc TerminateSession(TerminateSessionRequest) returns (TerminateSessionResponse);
  rpc ListSessions(ListSessionsRequest) returns (ListSessionsResponse);
}

Cargo dependencies

[dependencies]
tonic = "0.12"
prost = "0.13"

[build-dependencies]
tonic-build = "0.12"
protoc-bin-vendored = "3"

build.rs pattern

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let protoc = protoc_bin_vendored::protoc_bin_path().unwrap();
    std::env::set_var("PROTOC", protoc);
    tonic_build::compile_protos("proto/node_service.proto")?;
    tonic_build::compile_protos("proto/agent_session_service.proto")?;
    Ok(())
}

Message types to define

All request/response message types for each RPC method, matching the field shapes used by packages/core/src/ops/ (NodeId as string UUID, content as string, node_type as string enum).

Non-Goals

  • Implementing the gRPC server handlers (next issue)
  • Migrating Tauri commands (later issue)
  • CLI binary (later issue)

Activity

  1. malibio commented on May 17, 2026

    @malibio
    CollaboratorAuthor

    Baseline before starting: Frontend tests could not run due to missing .svelte-kit/tsconfig.json in worktree environment (worktree limitation). Rust-only issue — primary correctness signal is cargo build/test/clippy for the new daemon crate. Proceeding with implementation.

  2. self-assigned this
    on May 17, 2026
  3. added 3 commits that reference this issue on May 17, 2026
    9ab56fb
    5e7ef28
    d6f9975
  4. added 2 commits that reference this issue on Jun 22, 2026
    d54a9ad
    5ce9b47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions