Module IPCProvider

Module IPCProvider 

Source
Expand description

§IPCProvider (Environment)

RESPONSIBILITIES:

  • Implements IPCProvider for MountainEnvironment
  • Serves as the IPC bridge between Mountain and extension sidecar processes (Cocoon)
  • Delegates all communications to the Vine gRPC client for transport
  • Provides both request/response and notification patterns

ARCHITECTURAL ROLE:

  • Thin wrapper layer over Vine::Client
  • All IPC operations are async and use JSON-RPC 2.0 protocol
  • Sidecar routing via SideCarIdentifier to target specific extension hosts
  • Error translation from Vine errors to CommonError::IPCError

COMMUNICATION PATTERNS:

  • Request/Response SendRequestToSideCar:
  • Synchronous RPC with timeout protection
  • Returns Result<Value, CommonError>
  • Used for config resolution, URI lookup, content retrieval
  • Notification SendNotificationToSideCar:
  • Fire-and-forget pattern
  • Returns Result<(), CommonError> (indicating send success only)
  • Used for document changes, diagnostics, UI events

PERFORMANCE:

  • Vine client manages connection pooling and reuse
  • Timeouts enforced on requests to prevent blocking (caller-specified)
  • TODO: Add request queuing, batching, and priority handling

VS CODE REFERENCE:

  • vs/workbench/services/extensions/common/extensionHostProtocol.ts - main-ext host IPC
  • vs/base/parts/ipc/common/ipc.net.ts - IPC transport layer
  • vs/workbench/services/extensions/common/rpcProtocol.ts - JSON-RPC protocol

TODO:

  • Add message queuing for offline scenarios (caching when sidecar is down)
  • Implement bidirectional request handling (sidecar → main process)
  • Add request/response streaming support for large data transfers
  • Implement request cancellation with token support
  • Add request metrics and telemetry (latency, success rate, etc.)
  • Implement priority queue for urgent messages
  • Add support for batch IPC operations
  • Consider adding request deduplication
  • Implement proper connection health checking
  • Add support for IPC over Unix domain sockets for local sidecars

MODULE CONTENTS:

  • IPCProvider implementation:
  • SendNotificationToSideCar - fire-and-forget
  • SendRequestToSideCar - synchronous RPC
  • Delegate: Vine::Client handles all transport concerns