feat(mesh): MessageKey foundation and debug-dump RPC
Adds sender_pubkey + sender_seq fields to MeshMessage so received messages carry a stable cross-transport identity: (sender_pubkey, sender_seq) pair. This is the foundation for the upcoming reply, reaction, edit, and read-receipt variants — they need to target a message by an ID that is meaningful on every node, not just locally. Receive-side population lives in dispatch.rs::store_typed_message, which now looks up the peer's pubkey_hex and copies envelope.seq from the decoded TypedEnvelope. Sent-side population will land when we plumb a per-node monotonic seq counter through the RPC layer. Also adds mesh.debug-dump: a full in-memory state snapshot returning peers, messages, status, shared-secret peer ids, encrypt_relay flag, and stego mode — intended for smoke tests and bug investigation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -287,6 +287,7 @@ impl RpcHandler {
|
||||
"mesh.status" => self.handle_mesh_status().await,
|
||||
"mesh.peers" => self.handle_mesh_peers().await,
|
||||
"mesh.messages" => self.handle_mesh_messages(params).await,
|
||||
"mesh.debug-dump" => self.handle_mesh_debug_dump().await,
|
||||
"mesh.send" => self.handle_mesh_send(params).await,
|
||||
"mesh.send-channel" => self.handle_mesh_send_channel(params).await,
|
||||
"mesh.broadcast" => self.handle_mesh_broadcast().await,
|
||||
|
||||
@@ -70,6 +70,18 @@ impl RpcHandler {
|
||||
}
|
||||
}
|
||||
|
||||
/// mesh.debug-dump — Full in-memory state snapshot for debugging.
|
||||
/// Returns peers, all messages, status, shared-secret peer ids, encrypt_relay
|
||||
/// flag, and stego mode. Intended for smoke tests and bug investigation.
|
||||
pub(in crate::api::rpc) async fn handle_mesh_debug_dump(&self) -> Result<serde_json::Value> {
|
||||
let service = self.mesh_service.read().await;
|
||||
if let Some(svc) = service.as_ref() {
|
||||
Ok(svc.debug_dump().await)
|
||||
} else {
|
||||
Ok(serde_json::json!({ "running": false }))
|
||||
}
|
||||
}
|
||||
|
||||
/// mesh.session-status — Get ratchet session info for a peer.
|
||||
pub(in crate::api::rpc) async fn handle_mesh_session_status(
|
||||
&self,
|
||||
|
||||
Reference in New Issue
Block a user