Skip to main content

Vine/
Library.rs

1#![allow(
2	non_snake_case,
3	non_camel_case_types,
4	non_upper_case_globals,
5	dead_code,
6	unused_imports,
7	unused_variables,
8	unused_assignments
9)]
10
11//! # Vine 🌿 - gRPC Protocol Layer for Land 🏞️
12//!
13//! Vine is the canonical home of the gRPC IPC schema + runtime that wires
14//! the Land elements together:
15//!
16//! - **Mountain** (Tauri editor host) - hosts the `MountainService` gRPC
17//!   server; routes notifications from Cocoon and Air into Tauri's renderer.
18//! - **Cocoon** (Node.js extension host) - speaks Vine to invoke VS Code-shaped
19//!   operations on Mountain.
20//! - **Air** (background daemon) - speaks Vine as a client to query Mountain
21//!   for editor state when running indexing / update / download tasks; also
22//!   hosts its own `AirService` gRPC server on `[::1]:50053`.
23//!
24//! ## Module layout
25//!
26//! - [`Error`] - canonical [`VineError`](Error::VineError) variants and `From`
27//!   conversions for `serde_json`, `tonic::transport`, `tonic::Status`,
28//!   `http::uri::InvalidUri`, and `std::net::AddrParseError`.
29//! - [`Host`] - the [`VineHost`](Host::VineHost) trait,
30//!   [`IPCProvider`](Host::IPCProvider), and
31//!   [`ApplicationStateAccess`](Host::ApplicationStateAccess) - the seam
32//!   between Vine handlers and any embedder runtime.
33//! - [`Generated`] - prost-built message types + tonic clients and servers
34//!   produced from [`Proto/Vine.proto`](../Proto/Vine.proto) by `build.rs`.
35//! - [`Client`] - client building blocks (cargo feature `client`).
36//! - [`Server`] - server scaffolding + notification handler tree (cargo feature
37//!   `server`).
38//! - [`Multiplexer`] - bidirectional envelope multiplexer
39//!   (`OpenChannelFromMountain` / `OpenChannelFromCocoon` per LAND-PATCH B7-S6
40//!   P14.1; cargo feature `multiplexer`).
41//!
42//! ## Cargo features
43//!
44//! | Feature | Default | Pulls in |
45//! | --- | :---: | --- |
46//! | `client` | ✅ | `Source/Client/` - tonic-generated client stub wrappers + connection pool |
47//! | `server` | ✅ | `Source/Server/` - bind helpers + notification handler tree |
48//! | `multiplexer` |  | bidirectional streaming envelope multiplexer |
49//!
50//! ## Port allocation
51//!
52//! - `50051` - Mountain Vine server (Cocoon ↔ Mountain)
53//! - `50052` - Cocoon Vine server (Mountain → Cocoon callbacks)
54//! - `50053` - Air Vine server (Mountain / external → Air)
55
56pub mod DevLog;
57
58pub mod Error;
59
60pub mod Generated;
61
62pub mod Host;
63
64#[cfg(feature = "client")]
65pub mod Client;
66
67#[cfg(feature = "server")]
68pub mod Server;
69
70#[cfg(feature = "multiplexer")]
71pub mod Multiplexer;
72
73/// Canonical Vine protocol version. Sent on every gRPC envelope; receivers
74/// reject mismatched versions early in the dispatch path.
75pub const ProtocolVersion:u32 = 1;
76
77/// Default maximum gRPC message size, in bytes (4 MB).
78///
79/// Mirrors tonic's default. The dispatch layer enforces this at the envelope
80/// boundary so individual handlers can ignore size validation.
81pub const DefaultMaxMessageSize:usize = 4 * 1024 * 1024;
82
83/// Default request timeout, in milliseconds, applied to every
84/// `SendRequestToSideCar` invocation that does not pass an explicit
85/// override. Per-call overrides are supported - long-running tree-view
86/// fetches use ~1 500 ms, indexing queries use the default.
87pub const DefaultRequestTimeoutMs:u64 = 15_000;
88
89/// Default Mountain Vine server bind address.
90pub const DefaultMountainAddress:&str = "[::1]:50051";
91
92/// Default Cocoon Vine server bind address.
93pub const DefaultCocoonAddress:&str = "[::1]:50052";
94
95/// Default Air Vine server bind address.
96pub const DefaultAirAddress:&str = "[::1]:50053";
97
98// External consumers reach the canonical names via
99// `::Vine::Error::{Result, VineError}` and
100// `::Vine::Host::{VineHost, IPCProvider, ApplicationStateAccess}` - the
101// canonical paths live exactly where the items are declared, with no
102// crate-root re-exports.