Skip to content

Add EmbeddingsService gRPC: proto definition, nodespaced handler, and Tauri proxy #1135

Closed

Description

@malibio

Overview

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

Problem Statement

commands/embeddings.rs currently calls NodeEmbeddingService and EmbeddingProcessor directly via AppServices in the Tauri process. Under ADR-031, all services move to nodespaced. The GPU lifecycle complexity (release_gpu_context, drain-then-replace protocol on shutdown) must be managed in the daemon, not the Tauri process. Without this migration, embeddings and semantic search are unavailable when the UI window is closed.

Proposed Solution

Define EmbeddingsService in the nodespace proto, implement the handler in nodespaced wrapping the existing NodeEmbeddingService and EmbeddingProcessor, and replace AppServices calls in commands/embeddings.rs with gRPC client calls.

Technical Specifications

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

service EmbeddingsService {
  rpc GetEmbeddingStatus(GetEmbeddingStatusRequest)     returns (EmbeddingStatusResponse);
  rpc SearchSemantic(SearchSemanticRequest)             returns (SearchSemanticResponse);
  rpc RegenerateEmbedding(RegenerateEmbeddingRequest)   returns (RegenerateEmbeddingResponse);
}

Reference Files

  • packages/desktop-app/src-tauri/src/commands/embeddings.rs — current implementation to migrate
  • packages/desktop-app/src-tauri/src/app_services.rs — EmbeddingState struct to remove once migrated
  • packages/daemon/src/main.rs — register EmbeddingsService alongside NodeService
  • packages/daemon/src/services/node_service.rs — follow this pattern for new handler

Implementation Details

  • packages/daemon/src/services/embeddings_service.rs — new handler wrapping NodeEmbeddingService and EmbeddingProcessor
  • GPU drain protocol (release_gpu_context) handled on daemon shutdown, not Tauri shutdown
  • EmbeddingsServiceClient initialized in Tauri startup alongside NodeServiceClient (pattern from Migrate Tauri command handlers to thin gRPC proxy wrappers #1113)
  • EmbeddingState removed from AppServices once migration complete

Acceptance Criteria

  • EmbeddingsService proto defined and compiled via tonic-build
  • nodespaced handler implemented; GPU drain protocol handled on daemon shutdown
  • commands/embeddings.rs calls nodespaced via gRPC; no direct packages/core imports remain
  • Semantic search works end-to-end: Tauri UI → gRPC → nodespaced → response
  • Embedding generation continues when Tauri window is closed
  • EmbeddingState removed from AppServices
  • 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. malibio commented on May 18, 2026

    @malibio
    CollaboratorAuthor

    Frontend baseline: 128 files, 3918 tests passed

  3. self-assigned this
    on May 18, 2026
  4. added a commit that references this issue on May 18, 2026
    807611c
  5. added a commit that references this issue on Jun 22, 2026
    a20606a
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