Skip to main content

Module Channel

Module Channel 

Source
Expand description

§Channel Registry - single source of truth for Wind ↔ Mountain IPC

Every Tauri invoke request from Wind is a string-typed RPC. Historically that string was hand-kept on both sides (Rust match command.as_str() in Mountain/Source/IPC/WindServiceHandlers.rs and string literals in Wind’s Effect/*/Live.ts files). The result: drift - a channel could be declared in Wind, referenced in Mountain’s match, and still have no implementation (the extensions:install no-op stub shipped for months).

Channel is the enumerated registry. Rust callers dispatch on the variant; the wire string is produced by AsStr() and parsed by FromStr. The matching TypeScript const object lives at Element/Wind/Source/IPC/Channel.ts - kept in sync by convention (a grep diff is cheap; a full codegen would be overkill for 147 strings).

§Why a declarative macro?

The variant → wire-string mapping is pure data. DefineChannels! expands it into the enum body, AsStr, All, and FromStr in one pass so adding a channel is a single-line change that compilers can’t forget.

§Channel priority classes (Atom O3)

Priority returns the Echo scheduler lane a given channel should dispatch on. Used by the O1 wrap in mountain_ipc_invoke so user-facing latency never queues behind background work. Three classes:

  • High: direct user action (commands, file read, terminal input, notifications, VSIX install).
  • Low: background / deferrable (search, logging, update checks, offline-gallery stubs).
  • Normal: everything else.

Macros§

DefineChannels 🔒

Enums§

Channel
Enumerated IPC channel identifiers for Wind ↔ Mountain calls.
ChannelPriority
Lane selector for Echo scheduler dispatch.