Skip to main content

Module IPC

Module IPC 

Source
Expand description

§IPC Module

§RESPONSIBILITIES

Inter-process communication (IPC) for the Mountain application, handling communication between the Tauri frontend and the Rust backend through various protocols including Tauri commands, WebSocket, and custom message formats.

§Core Functions:

  • Message Routing: Route IPC messages to appropriate handlers
  • Connection Management: Manage IPC connections with health monitoring
  • Security: Implement permission system for IPC access control
  • Encryption: Provide secure message channels and compression
  • Status Reporting: Report IPC system status and metrics
  • Configuration Bridge: Bridge configuration across IPC boundaries
  • Wind Sync: Advanced synchronization with Wind UI framework
  • Advanced Features: Experimental/advanced IPC features

§Architectural Role

The IPC module is the communication layer in Mountain’s architecture:

Sky (Frontend) ──► IPC (Communication) ──► Track (Dispatch) ──► Services
Wind (UI) ───────────────────────────────────────────────────────────────┘
Cocoon (Sidecar) ──► Vine (gRPC) ────────────────────────────┘

§Design Principles:

  1. Protocol Agnostic: Support multiple IPC protocols
  2. Security First: All communications are secured and permission-gated
  3. High Performance: Optimized for low-latency communication
  4. Observable: Comprehensive logging and metrics

§Key Components

  • TauriIPCServer: Main IPC server orchestrator
  • Message: Message types and routing
  • Connection: Connection management and health
  • Encryption: Message compression and secure channels
  • Security: Permission system
  • ConfigurationBridge: Configuration synchronization
  • StatusReporter: Status and metrics reporting
  • WindAdvancedSync: Wind framework integration
  • AdvancedFeatures: Advanced/experimental features

§TODOs

High Priority:

  • Add comprehensive unit tests for all modules
  • Implement connection pooling optimizations
  • Add connection timeout handling

Medium Priority:

  • Add message batching for efficiency
  • Implement keep-alive packets
  • Add connection retry logic

Low Priority:

  • Add message persistence for offline mode
  • Implement message compression ratio optimization
  • Add connection encryption rotation

Modules§

AdvancedFeatures
Advanced experimental features (collaboration, intelligent caching, performance monitoring). TODO: atomize this 648-LOC single file into a directory; for now consumers spell IPC::AdvancedFeatures::* directly.
Common
Common shared types and abstractions for IPC layer. Shared IPC abstractions used across IPC/. Each submodule owns one concept; callers spell the full path (IPC::Common::HealthStatus::Foo).
ConfigurationBridge
Configuration synchronization bridge.
Connection
Connection management and health monitoring. Connection lifecycle, pooling, and health monitoring for IPC. Submodules: Manager (pool + handles), Types (ConnectionHandle, Stats), Health (background checker). Callers spell the full path; no pub use.
DevLog
Tag-filtered development logging (Trace env var). Must be declared before WindServiceHandlers so the dev_log! macro is available.
Encryption
Message compression and secure channels.
Enhanced
Legacy Enhanced subdirectory.
Message
Message types and routing. Core message types and routing for the IPC layer between Wind and Mountain. Callers spell IPC::Message::Types::TauriIPCMessage (no pub use re-exports).
Permission
Legacy Permission subdirectory.
Security
Permission system for IPC access control.
SkyEmit
Central sky:// emit wrapper that logs under the sky-emit DevLog tag. Optional drop-in for any ApplicationHandle::emit(channel, …) call site; existing emits keep working unchanged.
StatusReporter
Status and metrics reporting.
TauriIPCServer_Old
Main Tauri IPC server orchestrator.
UriComponents
Shared UriComponents emitter. Every handler that returns a URI to the renderer must route through this module so the $mid: 1 marshalling marker is never forgotten (without it VS Code’s IPC reviver skips the field and uri.with is not a function cascades through the sidebar).
WindAdvancedSync
Wind UI framework synchronization.
WindAirCommands
Legacy Wind Air Commands.
WindServiceAdapters
Legacy Wind Service Adapters.
WindServiceHandlers
Wind Service Handlers - dispatcher for every MountainIPCInvoke Tauri call from Wind/Output/Sky. The mod.rs inside is the central match that routes wire strings to per-domain atoms or handler files. Atoms live under WindServiceHandlers/<Domain>/<Atom>.rs following the one-export-per-file convention.