1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
//! Rust client for the PLANA service profile (strict WebSocket JSON-RPC
//! 2.0), mirroring `@celestia-island/plana-rpc-client` on the TypeScript
//! side.
//!
//! [`RpcClient`] maintains one persistent connection with:
//!
//! - **id correlation** — request ids are UUID v7 strings; responses are
//! matched against in-flight calls and delivered to exactly one caller;
//! - **call timeouts** — every [`RpcClient::call`] is bounded independently
//! of transport health;
//! - **heartbeat keepalive** — `Base.Heartbeat` notifications at a fixed
//! cadence; if no inbound frame (ack or otherwise) arrives within the
//! watchdog window, the connection is considered dead and cycles;
//! - **reconnect with exponential backoff** — dropped connections re-dial
//! with 1.5x growth capped at 30s; pending calls are rejected (not
//! silently retried) at every disconnect, matching the TS client;
//! - **connection-state watch** — [`RpcClient::state`] /
//! [`RpcClient::subscribe_state`] for UIs and supervisors;
//! - **notification fan-out** — server-initiated notifications broadcast to
//! any number of subscribers;
//! - **deferred operations** — [`RpcClient::await_op`] collects the outcome of
//! a deferred operation (notification-first, `ops.result` polling as the
//! fallback) towards a caller-supplied deadline. This half is Rust-only for
//! now: the published TypeScript client has no equivalent helper yet.
//!
//! Transport matrix: plaintext `ws://` and Unix-domain `ipc://` sockets
//! (everything after `ipc://` is the socket file path) are always
//! available; `wss://` rides the `tls` feature (rustls with webpki roots,
//! certificate verification on by default — the builder's
//! `danger_accept_invalid_certs` hook exists for tests that stand up their
//! own throwaway certificate). The degraded-transport racing of the TS
//! client is still deferred; the HTTP POST fallback exists as a standalone
//! one-shot transport in [`http`] (`http://` only) for degraded
//! environments.
pub use ;
pub use post_rpc;
pub use ;
pub use ;
/// Connection lifecycle states surfaced by [`RpcClient::state`].
/// Everything that can go wrong on a client call.
/// Everything that can go wrong while awaiting a deferred operation.
///
/// The three terminal conditions are spelled out separately because they
/// call for different reactions: `Unknown`/`Expired` mean the outcome is
/// gone for good (re-issue the request, or ask the user to retry), while
/// `Deadline` means the operation is still running on the server and the
/// **same** `op_id` can be collected again later.
/// Heartbeat method names, shared with `plana-rpc-server`.