Drive MeshService through the MeshMonitor HTTP gateway (Phase 2) #56

Merged
kamilkrzywda merged 2 commits from feat/meshmonitor-connection into main 2026-10-13 03:10:15 +02:00
2 Commits
Author SHA1 Message Date
kamilkrzywda f6b884dfdf feat(mesh): drive MeshService through the MeshMonitor HTTP gateway (Phase 2)
CI / build + unit (pull_request) Successful in 1m17s
Rewire MeshService off the raw TCP socket + codec onto the Phase-1
MeshMonitorClient contract (HttpMeshMonitorClient in production,
FakeMeshMonitorClient in tests): status/messages/nodes/channels/telemetry
are polled (15s/1s/30s/5min/60s) instead of streamed, outbound broadcasts
and DMs go through client.send(), respond/inject/notifier/command/battery/
weather behavior and all /api/* + MCP endpoint shapes are preserved.
The fake TCP bridge is deleted and every consumer spec (mesh service, MCP
controller, command auto-responder, battery alerts) now drives the real
service through the widened fake client. Docker compose drops
MESH_HOST/MESH_PORT and adds the MESHMONITOR_* env (token from .env,
self-signed TLS via NODE_TLS_REJECT_UNAUTHORIZED=0).

Live smoke against https://meshmonitor.kkhost.pl: getStatus ->
{connected:true, myNodeNum:3994646728, longName:'SP8MK Bot',
nodeResponsive:true}; getNodes -> 104 nodes.

Build green, suite 17 files / 245 tests (baseline 234).
2026-10-13 00:42:02 +00:00
kamilkrzywda f80340ae6e feat(meshmonitor): add stateless MeshMonitor HTTP-gateway client + fake + module
Phase 1 of the MeshMonitor HTTP-gateway migration: a stateless REST client
that a later phase wires into MeshService to replace the raw
Meshtastic protobuf-over-TCP bridge.

- mesh-monitor-client.ts: MeshMonitorClient interface, HttpMeshMonitorClient
  (native fetch, Bearer auth, injectable base/source/poll params), mappers for
  the gateway's actual JSON shapes (source-scoped paths, flat node position,
  second-based node lastHeard vs ms message/telemetry timestamps, long-format
  telemetry, packet id = 3rd segment of the id string), MeshMonitorError,
  nodeNumToId/nodeIdToNum, shared assertSendTarget XOR, and
  createMeshMonitorClientFromEnv() (null when MESHMONITOR_API_TOKEN unset).
- fake-mesh-monitor-client.ts: in-memory double mirroring the client contract
  (set*/pushInbound config, sends[] recorder, outbound mirrored into
  getMessages, newest-first, limit/channel/toNodeId/fromNodeId filters).
- meshmonitor.module.ts: thin Nest provider exposing the env-built client
  (or null) under MESH_MONITOR_CLIENT for Phase 2's MeshModule.
- specs: HttpMeshMonitorClient against an in-process node:http gateway
  (raw->typed mapping per endpoint, Authorization: Bearer header, send body
  shape with channel/toNodeId XOR + replyId passthrough, 401/413/429/503
  -> MeshMonitorError); FakeMeshMonitorClient behavior.

No MeshService changes, no version bump, no changelog, no PR.
2026-10-12 20:29:50 +00:00