Commit graph

129 commits

Author SHA1 Message Date
ab7392c518 feat: Add MQTT source adapter 2026-05-12 21:57:11 +00:00
c5f4dac8b6 fix: remove hardcoded timezone and region names for portability
- Timezone now configurable (default America/Boise)
- Router prompt generates region name instructions from config
- Any operator can run MeshAI for their region without code changes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-12 15:39:54 -06:00
2255ca5803 feat(env): NIFC fire perimeters + avalanche advisories
- WFIGS ArcGIS fire perimeter polling with proximity alerts
- Avalanche.org advisory polling (seasonal, SNFAC)
- !fire and !avy commands
- Distance-based severity for fires near mesh infrastructure
- Dashboard environment page integration
- Alert engine fires on fires within 50km of mesh area

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-12 15:22:07 -06:00
1158e30c0b Make environmental feeds band-agnostic; add Environment page
- Remove band_assessment and band_detail from SWPC adapter
- Remove all frequency-specific conclusions (906 MHz, 10m-20m, etc.)
- Store only raw indices: SFI, Kp, R/S/G scales, dM/dz gradients
- Let LLM interpret propagation data based on user's band of interest
- Add full Environment page with feed status, solar indices, and ducting data
- Update Dashboard RF Propagation card to show raw values only
- Update alert messages to be frequency-agnostic

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-12 14:59:54 -06:00
61684f0ee2 feat(dashboard): config management pages (replaces TUI)
- Tabbed config editor covering all 15 config sections
- Mesh sources: card-based list with add/edit/delete
- Mesh intelligence: region editor, critical nodes, alert rules
- Environmental feeds: per-feed toggle and config cards
- Save with validation, restart-required detection, discard changes
- Form components: text, number, toggle, select, textarea, list inputs
- Password fields with show/hide toggle
- Conditional field visibility based on enable toggles
- Replaces the 1434-line TUI configurator for daily use

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-12 13:17:28 -06:00
ef7a63fb70 fix(dashboard): edges not interactive, only nodes trigger hover/dim
- Added blur config for dimmed state (opacity 0.15 for nodes, 0.04 for edges)
- Added scale effect on node hover (1.1x)
- Explicit edgeSymbol: none to disable edge markers
- Only nodes are interactive: hover, click, tooltip
- Edges have no hover effect, no tooltip, no click handler

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-12 13:02:50 -06:00
4625740057 fix(dashboard): rewrite topology graph for performance at scale
Replaced React state-driven animation with ECharts graph rendering.
Previous approach re-rendered 263+ SVG nodes via setState in rAF loop,
causing browser lockup. New approach uses ECharts which handles force
layout and rendering natively at scale.

Changes:
- Switch from D3 force sim + React state to ECharts graph
- Remove particle animation (was fake random noise, not real packets)
- Filter out nodes with zero edges by default
- Add filter controls: Connected, Infra, All
- ECharts handles zoom/pan/drag natively (roam: true)
- Node selection dims unrelated nodes
- Force config matches Meshview: repulsion 200, edgeLength [80,120]
- Animation disabled for performance (animation: false)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-12 12:47:42 -06:00
30dc0b75df fix(dashboard): SPA catch-all route for client-side routing
- Add catch-all route that serves index.html for any non-API path
- Mount /assets separately for static JS/CSS files
- Enables browser refresh on React Router paths (/mesh, /config, etc.)
- API routes (/api/*) continue to work normally

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-12 12:36:59 -06:00
d52abb2572 fix(dashboard): dynamic force scaling + zoom/pan on topology graph
- Dynamic force parameters based on node/edge count and density
- Per-node degree-weighted link strength for balanced layouts
- Position clamping keeps nodes within viewport
- d3-zoom for pan/zoom (wheel, drag, double-click reset)
- Zoom control buttons (+, -, reset) in corner
- Drag handlers account for zoom transform
- Legends stay fixed outside transform group
- Scales gracefully from 63 to 200+ nodes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-12 12:27:03 -06:00
8273913c1a feat(dashboard): mesh topology graph + geographic map + node table
- D3 force-directed topology graph with flowing particle animations
- Leaflet geographic map with CartoDB Dark tiles
- Drag-to-reorganize with visible settling (matches Meshview behavior)
- SNR-based edge coloring: excellent/good/fair/marginal/poor
- Node detail panel with neighbor list and external map links
- Sortable/filterable node table
- Region-colored nodes, infrastructure vs client distinction
- Click-to-select synced across graph, map, table, and detail panel

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-12 12:14:45 -06:00
7704923b8c fix(dashboard): add null checks for health.pillars
Prevents "e.pillars is undefined" crash when health object
doesn't have pillars property (e.g., during initial load or
if API response is malformed).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-12 11:45:38 -06:00
d1511a74b9 fix(swpc): handle new NOAA API format for Kp index
NOAA changed the planetary k-index endpoint from array of arrays
to array of objects. Updated parser to handle both formats.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-12 11:40:57 -06:00
549ae4bdfb feat(env): NWS weather alerts, NOAA space weather, tropospheric ducting
- Environmental feed system with tick-based adapters
- NWS Active Alerts: polls api.weather.gov, zone-based filtering
- NOAA SWPC: Kp, SFI, R/S/G scales, band assessment, alert detection
- Tropospheric ducting: Open-Meteo GFS refractivity profile, duct classification
- !alerts command for active weather warnings
- !solar / !hf commands for RF propagation (HF + UHF ducting)
- Alert engine integration: severe weather, R3+ blackout, ducting events
- LLM context injection for weather/propagation queries
- Dashboard RF Propagation card with HF + UHF ducting display
- EnvironmentalConfig with per-feed toggles in config.yaml
2026-05-12 17:21:43 +00:00
374fb835c5 fix(dashboard): content scroll overflow bug 2026-05-12 16:46:51 +00:00
4331bcb7e1 feat(dashboard): React frontend scaffold with overview page
- Vite + React 18 + TypeScript + Tailwind CSS
- Dashboard overview with health gauge, pillar bars, alerts
- WebSocket hook for real-time updates
- Layout with sidebar navigation and live indicator
- Placeholder pages for Mesh, Environment, Config, Alerts
- Dark theme ops center aesthetic with JetBrains Mono

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-12 10:28:12 -06:00
3ec09ad158 feat(dashboard): embedded FastAPI backend with REST API + WebSocket
- FastAPI runs in MeshAI asyncio loop (no separate process)
- REST API: /api/status, /api/health, /api/nodes, /api/edges,
  /api/regions, /api/sources, /api/config, /api/alerts
- WebSocket at /ws/live pushes health updates and alerts
- Config CRUD: GET/PUT per section with validation and save
- DashboardConfig with port/host in config.yaml
2026-05-12 15:47:58 +00:00
914c21e167 fix: Switch to delay-based delivery — wantAck firmware retries cause duplicates 2026-05-07 21:50:09 +00:00
a80ed6cc7c fix: Dedup packets across sources, translate numeric port numbers to names
Packet dedup: track seen packet IDs across all sources. Same packet from
Meshview + MeshMonitor counted once, not twice. Fixes inflated counts.
Portnum: numeric values (3, 4, 71) mapped to names (Position, NodeInfo, Neighbors).
LLM prompt: guidance on normal vs abnormal packet rates per type.
2026-05-07 03:08:08 +00:00
MeshAI Claude
1d97854319 docs: Update README — Qdrant/RECON knowledge backend, alert engine, architecture 2026-05-06 16:29:03 +00:00
b11874f016 feat(knowledge): add Qdrant backend with SQLite fallback
- Add QdrantKnowledgeSearch class for hybrid dense+sparse vector search
- Query RECON's 2.8M vector database via TEI embeddings + Qdrant
- Uses RRF (Reciprocal Rank Fusion) for hybrid search merging
- Extended KnowledgeConfig with Qdrant/TEI settings
- Auto backend tries Qdrant first, falls back to SQLite FTS5
- Graceful degradation if RECON infrastructure unreachable

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-06 15:54:43 +00:00
6119f33f57 fix: Rename ACK callback to onAckNak — meshtastic lib filters ACKs for other names
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-06 14:30:28 +00:00
34f894ea79 fix: ACK-accelerated delivery — immediate on ACK, retry once, abort on double fail
Delays 1.5-2.5s (was 3-5s, only for broadcasts now).
DMs: send → ACK → next immediately. No ACK → retry once → abort.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-06 14:10:16 +00:00
736d6a313a feat: Full alert engine — 17 conditions, scaling cooldown, per-condition TUI toggles
Alert conditions across all 5 pillars:
  Infrastructure: offline, recovery, new router
  Power: battery 50/25/10%, 7-day trend, USB→battery, solar not charging
  Utilization: sustained >20% for 6h, packet flood >500/24h
  Coverage: infra single gateway, feeder offline, region blackout
  Scores: mesh <70, region <60

Scaling cooldown: immediate → 12h → 24h → 48h → stop
Recovery notifications when conditions resolve
Per-condition on/off toggles in TUI
Battery trend queries SQLite node_snapshots for 7-day history

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-06 05:39:11 +00:00
c8400233bd feat: alert detection and dispatch system for real-time mesh alerts
- Add AlertEngine to detect infra down/recovery, battery critical, critical node offline
- Add alert_channel, critical_nodes, alert_cooldown_minutes config options
- Wire alerts to channel broadcast and DM subscribers
- Add TUI options for critical nodes, alert channel, cooldown

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-06 04:48:41 +00:00
0da697855e fix: delay_max 3.0 → 5.0 for randomized message pacing
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-06 04:24:12 +00:00
b7237469e4 feat: ACK-based message delivery, markdown stripping, prompt fixes
- Connector: send_and_wait_ack() waits for ACK before returning
- Responder: ACK waiting for DMs with retry, delay-based for broadcasts
- Chunker: strip_markdown() removes bold/italic/headers/lists from LLM output
- Router: applies strip_markdown before chunking
- Prompt: stronger no-markdown rules, no manual continuation prompt, gateway explanation
- Config: delays 3-5s (was 2.2-3), max_length 200 (was 150), max_messages 3 (was 2)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-06 04:17:44 +00:00
MeshAI Claude
d5fc69e9a0 docs: Complete README rewrite — mesh intelligence, data sources, updated architecture 2026-05-06 01:28:59 +00:00
6bf0e3427e fix: !health packs into 2-3 messages with newlines inside
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-06 00:57:44 +00:00
7670b7c0b9 feat: !health returns list for separate LoRa messages, partial name distance matching
- build_lora_compact returns list[str] instead of str
- Each line is a separate LoRa message (no chunking needed)
- main.py handles list responses from commands
- _try_compute_distance supports partial names (TVM Pearl → TVM Pearl Relay)
- Ambiguous names detected (TVM → asks which node)
- Max message size: 54 bytes (well under 228 byte limit)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-06 00:11:57 +00:00
525da64d85 chore: Change freq51 to Mesh in !health output
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-05 23:50:19 +00:00
5839fdeb18 feat: !health colored dots no numbers, distance from AIDA, router distance detection
!health: 🔵 perfect, 🟢 healthy, 🟠 warning, 🔴 critical — no /100 scores.
Each line ends with period for separate LoRa messages.
Uses long_name to avoid emoji shortnames (📡 → TVM Tablerock Relay).
Distance from AIDA shown on every infra node in Tier 1.
Router detects how far questions and injects computed distance.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-05 23:47:48 +00:00
5be1d20b24 fix: Command output goes through chunker, byte-safe for LoRa
- Commands now chunk output same as LLM responses
- split_sentences splits on newlines first for !health output
- chunk_response uses byte counting instead of character counting
- Emojis and UTF-8 properly counted for 228-byte LoRa limit
- !health 274 bytes now splits into 2 messages (195 + 74 bytes)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-05 23:07:25 +00:00
1662d80f02 feat: !health personality with emojis, skip empty regions, AIDA physical node identity
- Replace build_lora_compact with personality version using emojis
- Add _region_lora_compact helper for region-specific display
- Skip empty regions in 3 loops (build_tier1_summary, utilization, list_regions_compact)
- Update AIDA identity: she IS a physical node (!27780c47 AIDA-N2)
- AIDA now knows she has real GPS coordinates and radio connections

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-05 22:35:00 +00:00
a97d346449 feat: Add node-to-node distance calculation
- Add build_distance() method to MeshReporter
- Uses _haversine_km() for GPS distance calculation
- Formats output with both km and miles
- Handles missing nodes or GPS positions gracefully

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-05 22:16:43 +00:00
79ff756a38 fix: Remove hard-coded token limits on LLM responses
- Add max_response_tokens config (8192) to LLMConfig
- Use config value in router.py instead of hardcoded 500
- Update base.py default from 300 to 8192
- Lets LLM generate full responses; chunker handles size limits

Fixes truncated responses like Here are three nodes in the freq

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-05 22:06:50 +00:00
70c0ab3047 fix: Restore build_lora_compact, list_regions_compact, build_region_compact, build_node_compact
These methods were called by commands/health.py and main.py but missing
from mesh_reporter.py, causing crashes on !health and !region commands.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-05 21:50:18 +00:00
99c952b432 feat: Show hop count and GPS distance in node detail and single-gw listings
- Added hops_away to Connectivity section in node detail
- Added nearest infra distance after Position in node detail
- Added distance from reference infra to single-gw client listings
- Added _haversine_km and _format_distance helper functions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-05 21:16:55 +00:00
6ac21d5f0e fix: LLM prompt — use local names, concise node listings, no redundant regions
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-05 21:09:21 +00:00
29a57b459a fix: 6 reporter bugs — missing methods, undefined var, indentation, key types
1. Added _find_node() — delegates to health_engine.get_node()
2. Added _find_region() — fuzzy match with config aliases
3. Fixed undefined unified var in _node_recommendations
4. Fixed env recommendation indentation (was inside MQTT uplink check)
5. Fixed 6 string-vs-int key mismatches on health.nodes lookups
6. Fixed estimated_position_interval — compute inline from packets_by_type

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-05 20:58:41 +00:00
cc474e3bb3 feat: Show source name for single-gateway nodes
Single-gateway nodes now display "via {source_name}" to indicate
which data source they depend on. This helps identify coverage gaps
and understand node visibility.

Adds source info to:
- Tier 1 region summary (infra and client nodes)
- Node distribution section (infrastructure nodes)
- Region detail view (single gateway list)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-05 20:23:18 +00:00
1d9c90911b feat: Feeder-level gateway awareness from /api/packets_seen
Samples recent packets and calls /api/packets_seen to discover which
physical MQTT gateways hear each node. Per-gateway RSSI and SNR.

UnifiedNode:
- feeder_gateways list with gateway_id, gateway_name, avg_rssi, avg_snr
- feeder_count, feeder_best (strongest signal), feeder_worst

MeshviewSource:
- Added feeders to ENDPOINT_SCHEDULE (every 20 ticks / 10 min)
- _fetch_feeders() samples 20 packets and queries packets_seen
- Auto-disables if endpoint returns 404

MeshDataStore:
- _enrich_feeder_data() aggregates gateway data across all sources
- _normalize_node_id() helper for hex/decimal conversion
- get_feeder_map() shows per-gateway coverage statistics
- get_node_feeders() returns sorted gateway list for a node

MeshReporter:
- Node detail shows feeder gateways with signal strength
- Tier 1 shows total unique gateways and avg per node

Discovered gateways: AIDA, BKBS, STLR, N7MH, stor, JTS

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-05 19:55:23 +00:00
b3c79f12da feat: Tick-based staggered polling for all sources
Both MeshviewSource and MeshMonitorDataSource now use tick-based
staggered polling instead of batch-every-5-minutes:

MeshviewSource (30s ticks):
- Packets: every tick (30s)
- Nodes: every 4 ticks (2 min)
- Stats/Edges: every 6 ticks (3 min)
- Traceroutes: every 10 ticks (5 min)

MeshMonitorDataSource (30s ticks):
- Packets: every 2 ticks (60s)
- Nodes/Telemetry: every 4 ticks (2 min)
- Traceroutes/Channels/Network/Topology: every 10 ticks (5 min)
- Solar: every 20 ticks (10 min)

Features:
- Source health status (avg_response_ms, tick_count, backed_off)
- Source coverage analysis (unique vs shared nodes)
- Tier 1 DATA SOURCES section shows all source health
- Node detail shows source visibility
- Incremental packets and telemetry with dedup
- Rate limit detection (429) with backoff
- Consecutive error exponential backoff
- polite_mode config option for shared instances

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-05 19:16:00 +00:00
bc644b3ac2 fix: Name single-gateway client nodes in Tier 1 (top 10 per region)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-05 17:04:49 +00:00
aef78996a9 feat: Named single-gw nodes, infra-only monitoring, commands overhaul
Coverage:
- Single-gateway infra nodes named as critical risks per region
- Client single-gw nodes counted but not individually named
- Mesh-wide single-gw infra summary

Monitoring rules by node type:
- Infrastructure: full detail - battery, offline, coverage, neighbors, hardware
- Clients causing problems: named - high util, top senders
- Clients otherwise: counted per region, not individually tracked
- POWER breakdown now infra-only

Commands:
- Removed hardcoded command list from config.py system_prompt
- Dynamic command list in router.py from dispatcher (only enabled commands)
- MeshMonitor commands no longer listed as MeshAI commands
- !help overhaul: grouped by category, per-command detailed help
- LLM explicitly told to only mention listed commands

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-05 15:33:14 +00:00
56536f55c8 feat: Rich Tier 1 data - named infra per region, problem nodes, expanded recommendations
Tier 1 now includes:
- Every infrastructure node BY NAME per region with status/battery/util/gateways
- Problem nodes section: offline infra, critical battery, high util, coverage risks
- Per-region coverage with gateway counts and single-gw counts
- Environmental data per region
- All 5 pillars with weights
- Expanded recommendations with specifics (10 max, up from 5)
- LLM prompt simplified: data speaks for itself

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-05 14:32:43 +00:00
8d1a48ea08 fix: Short sentence instruction + chunker splits instead of truncating
- Added CRITICAL instruction to keep sentences under 150 chars
- Chunker now splits long sentences at word boundaries instead of truncating
- No words lost when splitting

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-05 07:22:52 +00:00
51969050da fix: Replace deleted REGION_CONTEXT with config method, replace hardcoded city map with config aliases
- Line 763: REGION_CONTEXT.get() → self._region_context() (same method used elsewhere)
- Deleted _CITY_TO_REGION hardcoded dict
- Scope detection now uses config aliases/cities from RegionAnchor
- Fixed Sun Valley/Ketchum geography (was Central ID, should be South Central ID)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-05 07:11:08 +00:00
de400068dd feat(mesh): config-driven regions with stale purge and coverage fix
- Extended RegionAnchor with local_name, description, aliases, cities
- Moved region geographic context from hardcoded Python to config.yaml
- Added 7-day stale node purge in _do_refresh (556 → 267 nodes)
- Fixed coverage lookup: str(node_num) → node_num (int key)
- Added bidirectional neighbor lookup for better region assignment
- Dynamic geography building in router from config
- Reporter reads region context from config instead of hardcoded dict

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-05 06:33:38 +00:00
abcf2d88e2 feat: Geographic context — local names, accurate Idaho/Utah geography, no Unknown gaps
- Magic Valley, Treasure Valley, Panhandle, Dixie — local names in all output
- Southern Idaho correctly maps to Magic Valley, not lumped with Boise/IF
- Unlocated nodes excluded from coverage gap recommendations
- LLM response rules override brevity for mesh questions
- Node detail shows region with local context

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-05 06:08:58 +00:00
45630f2cc6 fix: Override LLM brevity for mesh questions — give detailed data responses
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-05-05 05:29:09 +00:00