mirror of
https://github.com/meshtastic/web.git
synced 2026-08-02 07:57:52 -04:00
Replaces the (broken) web changeRegistry with a section-grain editor that
lives on the SDK. Per-connection state, signal-backed, exposed via
client.config.editor.
ConfigEditor (domain):
- baseline = what the device most recently sent. Updated automatically
from onConfigPacket / onModuleConfigPacket / onChannelPacket.
- working = UI edits. setRadioSection / setModuleSection / setChannel.
- dirtyRadioSections / dirtyModuleSections / dirtyChannels signals plus
an aggregate isDirty signal.
- Inbound baseline updates do NOT discard pending working changes — if a
section is already dirty, the new baseline is recorded but working stays
put; dirty bookkeeping recomputes against the updated baseline.
- reset() restores working = baseline.
- commit() wraps beginEditSettings → setConfig per dirty radio variant +
setModuleConfig per dirty module variant + setChannel per dirty channel
→ commitEditSettings, then optimistically promotes working to baseline.
- Disconnect clears both baseline and working so a stale working copy can
never leak across reconnects.
Domain types:
- RadioConfig and ModuleConfig are now derived directly from the proto
Config / ModuleConfig payloadVariant union (Extract<{case: V}> shape) so
new variants stay typed without manual list maintenance. This adds
deviceUi (radio) and statusmessage (module) automatically.
sdk-react:
- New useConfigEditor() hook returns the editor for the active client, or
undefined when no client is active. Components subscribe to the editor's
signals via the existing useSignal helper.
Tests:
- 5 new ConfigEditor tests covering: clean start, dirty tracking, multi-
section dirty, reset, mid-edit baseline update preservation, and
disconnect-clears-state. SDK suite 49 passing.
This commit is scaffolding only — no web settings page rewires yet. The
~25 settings pages move to editor.set* / editor.commit() in follow-up
commits, replacing setChange / commitEditSettings call sites and unblocking
deletion of changeRegistry from the device store.
@meshtastic/sdk
Domain-driven SDK for Meshtastic devices. Feature slices with signals-backed reactive state.
Replaces @meshtastic/core. During migration a shim layer re-exports the legacy MeshDevice class so existing consumers keep building — see src/shim/.
Install
pnpm add @meshtastic/sdk @meshtastic/transport-web-serial
Quickstart
import { MeshClient } from "@meshtastic/sdk";
import { TransportWebSerial } from "@meshtastic/transport-web-serial";
const transport = await TransportWebSerial.create({ baudRate: 115200 });
const client = new MeshClient({ transport });
await client.connect();
client.chat.send({ text: "hello mesh" });
console.log(client.nodes.list.value);
See the repo root README for architecture and feature slice layout.
Layout
src/
core/ # shared kernel: client, transport, event-bus, queue, xmodem, signals, logging, packet-codec
features/ # DDD feature slices (device, chat, nodes, channels, config, telemetry, position, traceroute, files)
shim/ # legacy MeshDevice compatibility exports (removed in Phase C)
License
GPL-3.0-only.