feat(mesh): rich typed Sent records and echo dedup

Adds message_type + typed_payload (JSON) to MeshMessage so the UI can
render invoice/alert/coordinate/tx/lightning messages as structured
cards in both directions instead of showing raw wire bytes on the
Sent side. RPC handlers now route through send_typed_wire /
send_channel_typed_wire which transmit the binary envelope directly
(no utf8_lossy corruption) and record a rich Sent MeshMessage.

Also: store_message deduplicates echo-back doubles (20-msg lookback,
30s window), from_name is plumbed through the federation Incoming
path, and peer_dest_prefix / send_raw_payload are factored out of
send_message.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-04-13 08:01:10 -04:00
parent 53bea2124d
commit 865dccf29f
8 changed files with 244 additions and 32 deletions

View File

@@ -112,6 +112,7 @@ pub fn store_sent(message: &str) {
guard.messages.push(IncomingMessage {
from_pubkey: "me".to_string(),
from_onion: None,
from_name: None,
message: message.to_string(),
timestamp: chrono::Utc::now().to_rfc3339(),
direction: "sent".to_string(),