Skip to main content

Request

Enum Request 

Source
pub enum Request {
Show 15 variants RegisterService { name: String, backend: BackendSpec, allow: Vec<String>, }, Status, Invite { services: Vec<String>, }, Pair { invite_line: String, }, PeerRemove { petname: String, }, PeerRename { user_id: Option<String>, petname: Option<String>, to: String, }, OpenSession { peer: String, service: String, }, RosterInstall { path: String, org_root_pk: Option<String>, }, OrgJoin { org_id: String, org_root_pk: String, user_id: String, user_key: String, }, SetRosterUrl { url: String, }, BlobPublish { scope: String, path: String, }, BlobGrant { scope: String, principal: String, }, BlobList, BlobFetch { ticket: String, dest_path: String, }, AuditSummary,
}
Expand description

Control-API requests. Serialized as { "method": "...", "params": {...} } (JSON-RPC-shaped; the id/jsonrpc envelope is added by the transport layer).

Clients construct and serialize requests via this enum. Servers dispatch on the method string and deserialize params per-method — tolerating omitted / null / empty-object params for parameterless methods — rather than deserializing a whole message into Request (adjacent tagging rejects params:{} for unit variants). This keeps the wire tolerant for third-party clients (§6.1 versioned surface). Use method_of to extract the tag, then match + deserialize params per-method.

Variants§

§

RegisterService

Register/update a [services.*] entry idempotently (spec §6.1).

Fields

§name: String
§backend: BackendSpec
§allow: Vec<String>
§

Status

§

Invite

Mint a one-time pairing invite granting services (spec §4.2). The daemon answers an InviteResult carrying the copyable mcpmesh-invite: line. Tag "invite" (snake_case). method_of needs no per-variant arm — it reads the method string generically; the tag comes from rename_all.

Fields

§services: Vec<String>
§

Pair

Redeem a pairing invite (spec §4.2). The daemon dials the inviter named by invite_line on mcpmesh/pair/1, proves the secret, writes the mutual (dial-back) [PeerEntry], and answers a PairResult. Tag "pair" (snake_case); method_of reads the method string generically.

[PeerEntry]: crate — the durable allowlist row lives in the daemon crate.

Fields

§invite_line: String
§

PeerRemove

Remove a paired peer by petname (spec §4.2, mcpmesh pair --remove). The daemon drops the peer’s [PeerEntry] (identity) AND revokes its access by removing the petname from every [services.*].allow (authorization) — the inverse of the pairing grant. Idempotent: a petname with no entry / no allow membership is a clean no-op. Live in-flight sessions are NOT severed here (M3/D8): existing sessions run to completion; the peer only loses the ability to establish NEW authorized sessions. Tag "peer_remove" (snake_case); method_of reads the method string generically (no per-variant arm).

[PeerEntry]: crate — the durable allowlist row lives in the daemon crate.

Fields

§petname: String
§

PeerRename

Rename a contact’s nickname (petname) authoritatively (Contacts rename spec). Renames the PERSON — every PeerEntry sharing user_id when given (one op for all their devices), else the single petname entry (a provisional, no-user_id contact) — to to, AND rewrites the old petname → to in every [services.*].allow so grants follow the rename. Refuses (error frame) when to is empty or already names/grants a DIFFERENT identity — the same collision guard the pairing rendezvous uses, so a rename can’t inherit another peer’s access. Tag "peer_rename"; host-privileged like the other pair ops.

Fields

§user_id: Option<String>
§petname: Option<String>
§

OpenSession

Open a mesh session to peer/service; the daemon dials and pipes. Distinct from the proxy’s job: this returns a session the client streams. Spec §6.1’s connect(peer[,device],service) — renamed to avoid colliding with the connect porcelain.

Fields

§peer: String
§service: String
§

RosterInstall

Install a signed roster from a local file (spec §4.3 manual internal roster install). path is a LOCAL file the same-uid daemon reads (P12/P14 trust boundary — passing a path not the bytes is fine). org_root_pk pins the org root on FIRST install (b64u:); omit it once pinned (config carries it). Tag "roster_install".

Fields

§path: String
§org_root_pk: Option<String>
§

OrgJoin

Pin the org root on a JOINER (spec §4.4 step 2) — WITHOUT a roster (the joiner has none yet, D5). Records [identity] org_id / org_root_pk / user_id / user_key. user_key is a LOCAL path (the key never crosses the API). Tag "org_join".

Fields

§org_id: String
§org_root_pk: String
§user_id: String
§user_key: String
§

SetRosterUrl

Pin the HTTPS roster URL ([roster].url) in config (spec §4.3 M3c). Written by org create --roster-url (the operator keeps it current) AND by join when the org invite carries one — so the joiner’s poll loop bootstraps its FIRST roster (D5). The daemon writes it under reload_lock (single-writer), then the poll loop picks it up on the next daemon start. Tag "set_roster_url".

Fields

§

BlobPublish

Publish a LOCAL file INTO a scope (spec §9, M4a): the daemon adds the bytes to its gated app-blob store and records the hash in scope. path is a local file the same-uid daemon reads (P12/P14). Answers a BlobPublishResult carrying the mcpmesh/blob/1 ticket + hash. Tag "blob_publish".

Fields

§scope: String
§path: String
§

BlobGrant

Grant a scope to a principal — any §5 flat-namespace entry: a group name, a user_id, or a petname (the shared principal_set expansion). Tag "blob_grant".

Fields

§scope: String
§principal: String
§

BlobList

List the daemon’s blob scopes (name → hashes + grants). Tag "blob_list".

§

BlobFetch

Fetch a mcpmesh/blob/1 ticket THROUGH the daemon (BLAKE3-verified streaming) and export the verified blob to dest_path (a local file the same-uid daemon writes). Answers a BlobFetchResult with the verified hash + byte length. Tag "blob_fetch".

Fields

§ticket: String
§dest_path: String
§

AuditSummary

Summarize this node’s LOCAL audit log into per-peer / per-service SESSION counts (spec §11.3 local-only — the daemon reads its OWN audit dir, nothing is transmitted). The host Mesh surface renders these as “who serves me / whom I serve / session counts”. Parameterless (like Status); the server dispatches on the method string. Tag "audit_summary" (snake_case); method_of reads the method string generically (no per-variant arm).

Trait Implementations§

Source§

impl Clone for Request

Source§

fn clone(&self) -> Request

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Request

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Request

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for Request

Source§

impl PartialEq for Request

Source§

fn eq(&self, other: &Request) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Request

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Request

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.