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:
- Protocol Agnostic: Support multiple IPC protocols
- Security First: All communications are secured and permission-gated
- High Performance: Optimized for low-latency communication
- 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§
- Advanced
Features - 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). - Configuration
Bridge - 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; nopub use. - DevLog
- Tag-filtered development logging (Trace env var). Must be declared before WindServiceHandlers so the dev_log! macro is available.
- Emit
With Traceparent - Outbound emit wrapper that stamps a W3C
_traceparentfield onto every JSON payload before forwarding toapp_handle.emit(...). Sky’sWorkbench/Electron/TraceparentBridge.tsextracts the header at the receiving end so spans emitted inside the handler attach to the same Jaeger trace. Release builds short-circuit to a plainemit(...)viacfg!(debug_assertions). Wrapapp_handle.emit(name, payload)so every outbound Sky-side Tauri event carries a W3C_traceparentfield on its JSON payload. Sky’sWorkbench/Electron/TraceparentBridge.ts::ConsumeFromPayloadstrips the field at the receiving end, registers the trace context for the duration of the event handler, and Sky’sOTELBridgereads it so spans emitted inside the handler attach to the same trace. - 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(nopub usere-exports). - Permission
- Legacy Permission subdirectory.
- Security
- Permission system for IPC access control.
- SkyEmit
- Central
sky://emit wrapper that logs under thesky-emitDevLog tag. Optional drop-in for anyApplicationHandle::emit(channel, …)call site; existing emits keep working unchanged. - Status
Reporter - Status and metrics reporting (atomized; siblings live in
StatusReporter/). - TauriIPC
Server_ Old - Main Tauri IPC server orchestrator.
- UriComponents
- Shared
UriComponentsemitter. Every handler that returns a URI to the renderer must route through this module so the$mid: 1marshalling marker is never forgotten (without it VS Code’s IPC reviver skips the field anduri.with is not a functioncascades through the sidebar). - Wind
Advanced Sync - Wind UI framework synchronization.
- Wind
AirCommands - Legacy Wind Air Commands.
- Wind
Service Adapters - Legacy Wind Service Adapters.
- Wind
Service Handlers - Wind Service Handlers - dispatcher for every
MountainIPCInvokeTauri call from Wind/Output/Sky. Themod.rsinside is the centralmatchthat routes wire strings to per-domain atoms or handler files. Atoms live underWindServiceHandlers/<Domain>/<Atom>.rsfollowing the one-export-per-file convention.