Skip to content

Add ImportService gRPC: proto definition, nodespaced handler, and Tauri proxy #1136

Closed

Description

@malibio

Overview

Define the ImportService protobuf service, implement the handler in nodespaced, and migrate commands/import.rs in the Tauri app to a thin gRPC proxy.

Problem Statement

commands/import.rs handles bulk markdown import with smart collection routing and a two-phase async pipeline (parse → background DB write). This currently runs in the Tauri process, meaning imports are unavailable from the CLI or agent tools, and the import background task is killed when the UI window closes. Under ADR-031 this moves to nodespaced so imports run headlessly from any client.

Proposed Solution

Define ImportService in the nodespace proto with server-streaming progress RPCs, implement the handler in nodespaced preserving the two-phase pipeline and collection routing logic, and replace direct calls in commands/import.rs with ImportServiceClient gRPC calls.

Technical Specifications

Proto addition (packages/daemon/proto/nodespace.proto)

service ImportService {
  rpc ImportMarkdown(ImportMarkdownRequest)           returns (stream ImportProgressEvent);
  rpc ImportMarkdownFiles(ImportMarkdownFilesRequest) returns (stream ImportProgressEvent);
}

Reference Files

  • packages/desktop-app/src-tauri/src/commands/import.rs — current implementation including collection routing logic to preserve
  • packages/daemon/src/services/node_service.rs — follow this handler pattern
  • packages/daemon/src/main.rs — register ImportService alongside NodeService

Implementation Details

  • packages/daemon/src/services/import_service.rs — new handler; preserves smart collection routing (archived/, decisions/, lessons/, etc.) and two-phase pipeline
  • Background import task spawned in daemon Tokio runtime; progress events streamed via gRPC server-streaming RPC
  • commands/import.rs subscribes to progress stream and forwards to Tauri frontend events
  • CLI: nodespace import <file> subcommand (wired in Implement nodespace CLI binary with node subcommands #1116)

Acceptance Criteria

  • ImportService proto defined and compiled via tonic-build
  • nodespaced handler implements two-phase import with smart collection routing preserved
  • Progress streamed back via gRPC server-streaming RPC
  • commands/import.rs proxies via gRPC; no direct packages/core imports remain
  • Import completes if Tauri window is closed mid-import
  • nodespace import <file> CLI subcommand works
  • cargo build succeeds
  • bun run test:all passes
  • bun run quality:fix passes

Dependencies

Related Issues

Activity

  1. added a commit that references this issue on May 17, 2026
  2. self-assigned this
    on May 18, 2026
  3. malibio commented on May 18, 2026

    @malibio
    CollaboratorAuthor

    Implementation complete. Tests: 128 files / 3918 passing. cargo build --workspace clean. Ready for review.

  4. added a commit that references this issue on May 18, 2026
    66b736c
  5. added a commit that references this issue on Jun 22, 2026
    7789d04
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