feat(sim): two-device messaging + repeater relay over a JS ether

Ports examples/simple_repeater to variants/sim/ (new sim_simple_repeater
native env + build_wasm_repeater.sh) and adds a JS "ether"
(variants/sim/web/mesh.html) that bridges two real companion_radio WASM
instances through a real simple_repeater instance in a strict A<->R<->B
topology (no direct A-B link), proving genuine relay routing rather than
a shortcut.

Also fixes multi-instance issues Phase 2's single-instance design never
surfaced: SimDisplayDriver's canvas context/id caching was keyed on a
single global instead of per-instance, and both wasm builds were missing
_malloc/_free/HEAPU8 runtime exports needed for the ether to poke bytes
into an instance's memory.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-09-03 09:14:15 +02:00
co-authored by Claude Sonnet 5
parent 8f4c92a217
commit 9cfb58a60b
18 changed files with 1199 additions and 54 deletions
+11
View File
@@ -108,6 +108,17 @@ public:
void loop();
void handleCmdFrame(size_t len);
bool advert();
#ifdef SIM_PLATFORM
// Phase 3 sim-only test hook: same as advert() but FLOOD-routed (like the
// real phone-app CMD_SEND_SELF_ADVERT command's flood=1 branch) instead of
// zero-hop, so a JS test harness can make an instance's identity actually
// propagate through an intermediate repeater instance -- advert() alone
// (zero-hop) never leaves the immediate ether link. Not reachable from any
// real hardware build (no phone app exists in the sim to send the real
// CMD_SEND_SELF_ADVERT command over), so this is additive/dead code
// everywhere else, not a behavior change.
bool advertFlood();
#endif
void sendNodeDiscoverReq();
void enterCLIRescue();