Commit Graph

6687 Commits

Author SHA1 Message Date
James Rich
f6bfefd439 feat(discovery): wire Gemini Nano via ML Kit GenAI Prompt API
Replace the stub GeminiNanoSummaryProvider with a real implementation
that uses com.google.mlkit:genai-prompt:1.0.0-beta2 for on-device
AI-powered scan summaries on supported Android hardware.

Implementation:
- Generation.getClient() to obtain the GenerativeModel
- generateContentRequest with TextPart for structured prompts
- Temperature 0.3, topK 16, maxOutputTokens 200 for concise output
- Graceful fallback to DiscoverySummaryGenerator on any failure
- Lazy model initialization with error logging via Kermit

The existing buildSessionPrompt() and buildPresetPrompt() methods in
DiscoverySummaryGenerator provide the prompt text. On unsupported
devices or fdroid builds, the provider falls through to the
deterministic algorithmic summary seamlessly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-20 17:10:21 -05:00
James Rich
4bf8aaf0a9 docs(spec): update discovery spec to reflect implementation state
- Update status from 'Not Started' to 'Implementation Complete'
- Add Implementation Status section documenting per-user-story completion
- Add data model divergences (simplified schema, RF health fields, neighborType)
- Add Cross-Platform Alignment section comparing with meshtastic-apple
- Document intentional differences (2-level state machine, production nav location)
- Document known divergences and their priority (radar sweep, icon classification)
- Reference design repo audit confirmation (50/51 tasks, D048 remaining)
- Add implementation note to data-model.md about actual vs proposed schema

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-20 17:09:50 -05:00
James Rich
728678dade feat(discovery): extract hardcoded UI strings to resources
Replace all hardcoded strings in discovery UI screens and components
with stringResource() calls using centralized string resources.

Files updated:
- DiscoverySummaryScreen: session stats, AI analysis labels
- DiscoveryHistoryDetailScreen: history metadata labels
- DiscoveryScanScreen: disabled button semantics descriptions
- PresetPickerCard: selected/unselected state descriptions
- PresetResultCard: scan result stat labels
- RfHealthSection: RF health stat labels
- DwellProgressIndicator: dwell progress text

Added 33 new discovery_stat_* and discovery_* string resources.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-20 17:09:50 -05:00
James Rich
99ff328677 fix(discovery): unregister packet collector on success, use string resources in settings
- Fix resource leak: collectorRegistry.collector was never cleared in
  the successful scan completion path (only in stop/abort paths)
- Replace hardcoded 'Local Mesh Discovery' strings in both Settings
  screens with stringResource(Res.string.discovery_local_mesh)
- Add missing explicit imports for the CMP string accessor
- Remove redundant .gitkeep files from directories with content

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-20 17:09:50 -05:00
James Rich
2d1fc984bb [Spec Kit] Implementation progress: D044 accessibility polish
- Added semantics annotations for screen readers
- Added progress announcements for dwell indicator
- Added disabled-preset explanations
- Migrated string resources to strings.xml
- Added DiscoveryMigrationTest for string resource migration
- Marked D000, D011, D044 as complete in tasks.md
2026-05-20 17:09:29 -05:00
James Rich
d6f44f2d0b fix(discovery): resolve all detekt and lint issues across discovery modules (D048)
- Fix copyright headers (2025-2026 → 2026) in ~30 files across feature/discovery, core/database, core/repository, core/data, core/prefs
- Fix detekt compose issues: add modifier params to all public composable functions, fix parameter ordering in PresetResultCard, rename onMinutesSelected → onMinuteSelect (past tense), suppress LongMethod for DiscoverySummaryContent
- Fix detekt suppressions: CompositionLocalAllowlist in LocalDiscoveryMapProvider, MagicNumber/ReturnCount in DeepLinkRouter.routeSettings
- Mark D048 complete in tasks.md
All verification passes: spotlessCheck ✓, detekt ✓, tests ✓, kmpSmokeCompile ✓
2026-05-20 17:09:29 -05:00
James Rich
349094e9e3 feat(discovery): replace hardcoded UI strings with string resources (D047) 2026-05-20 17:09:08 -05:00
James Rich
ee91bcd2f7 test(discovery): add map preset filter and topology toggle tests (D028) 2026-05-20 17:09:08 -05:00
James Rich
d3eccf1892 feat(discovery): add neighbor info requests at dwell boundaries and map filter state (D020, D024, D032) 2026-05-20 17:09:08 -05:00
James Rich
d1c50336e7 test(discovery): add DAO, packet collection, history, and deep-link tests (D010, D023, D042) 2026-05-20 17:09:08 -05:00
James Rich
e2e8483de6 feat(discovery): add 2.4 GHz hardware gating and AI provider tests (D045, D037) 2026-05-20 17:09:08 -05:00
James Rich
8be3c8a874 docs(discovery): mark D012 complete 2026-05-20 17:09:08 -05:00
James Rich
531ea8363f feat(discovery): add DiscoveryPrefs for persistent user defaults (D012)
Add DataStore-backed preferences for discovery scan settings:
- dwellMinutes: persisted dwell time per preset (default 15)
- selectedPresets: last-used preset selection (restored on reopen)
- aiEnabled: whether AI summary expansion is enabled
- topologyOverlayEnabled: map topology overlay default
Architecture:
- Interface: DiscoveryPrefs in core:repository/AppPreferences.kt
- Implementation: DiscoveryPrefsImpl in core:prefs (reuses UiDataStore)
- Fake: FakeDiscoveryPrefs in core:testing
- Wiring: DiscoveryViewModel restores prefs on init, persists on change
Validated: spotlessApply, allTests, compileKotlinJvm
2026-05-20 17:09:08 -05:00
James Rich
f8d98f1667 docs(discovery): mark D030 complete in tasks.md 2026-05-20 17:09:08 -05:00
James Rich
941ae3ca99 feat(discovery): wire DiscoveryRankingEngine into summary UI (D030)
- Add rankings StateFlow to DiscoverySummaryViewModel
- Compute rankings from PresetRankingInput on loadNodes and rerunAnalysis
- Pass rank/isTied to PresetResultCard for display
- Show rank badge (#1, #2, tied) in preset header
- Rank 1 (untied) highlighted in primary color
Validated: spotlessApply, allTests, compileKotlinJvm
2026-05-20 17:09:08 -05:00
James Rich
a90a6a5448 docs(discovery): update tasks.md to reflect actual implementation status
Mark 30 of 49 tasks as complete based on code review of the
feat/discovery branch. Key phases completed: setup (P1), data model
(P2 partial), scan engine (P3), packet collection (P4 partial),
map (P5 partial), summary (P6 partial), AI (P7 partial), history (P8).
Remaining: D010-D011 (DAO/migration tests), D012 (prefs), D020
(neighbor info trigger), D023-D024 (tests + map filter), D028
(map UI tests), D030/D032 (summary models + tests), D037 (AI tests),
D042 (history tests), D044-D045/D047-D048 (polish).
2026-05-20 17:09:08 -05:00
James Rich
b918a91acc feat(discovery): add DiscoveryRankingEngine with 6-level deterministic heuristic (D029)
Implement the spec's ranking and recommendation heuristic:
1. Highest unique discovered node count
2. Highest neighbor-report diversity (direct + mesh)
3. Highest non-duplicate packet count
4. Best median link quality (SNR first, then RSSI)
5. Greatest best known distance
6. Lowest failure/reconnect penalty
Presets tied after all 6 criteria share the same rank with isTied=true.
Includes RankingScoreBreakdown for transparent per-criterion scoring.
11 unit tests covering each criterion as tiebreaker, full ties,
edge cases (empty/single preset, no nodes, failed presets).
Validated: spotlessApply, allTests, kmpSmokeCompile
2026-05-20 17:09:08 -05:00
James Rich
5792e09989 feat(discovery): align state machine with spec, add deep links, fix tests
- Add Preparing, Cancelling, Failed states to DiscoveryScanState (FR-008)
- Change Complete to data class with CompletionOutcome enum
- Add local-mesh-discovery deep link routes to DeepLinkRouter (FR-031)
- Compute packetSuccessRate/packetFailureRate in scan engine (FR-012)
- Fix DiscoveryScanEngineTest compilation and restructure with shared scheduler
- All 8 tests pass, kmpSmokeCompile clean
2026-05-20 17:09:08 -05:00
James Rich
182cc336c2 refactor(discovery): reorder imports for clarity and consistency 2026-05-20 17:08:46 -05:00
James Rich
edee2c9993 refactor(discovery): improve KMP compatibility and clean up icon imports
- Replace platform-specific `String.format` with Kotlin standard library `padStart` in `DwellProgressIndicator` to support common code.
- Simplify fully qualified icon references in `DiscoveryGoogleMap` by adding explicit imports.
2026-05-20 17:08:46 -05:00
James Rich
0907e63445 feat(discovery): improve scan metrics, node enrichment, and configuration restoration
- Implement distance tracking using `latLongToMeter` and a new `getMaxDistance` DAO query
- Calculate Airtime Rate as a delta over time to align with telemetry specifications
- Capture and restore the full `LoRaConfig` instead of just the modem preset after a scan
- Persist local radio statistics (Tx/Rx counts, uptime, relay stats) in preset results
- Backfill missing node names and positions from the local NodeDB during discovery
- Refactor `DiscoveryScanEngine` to use injected `CoroutineDispatchers` and `ApplicationCoroutineScope`
- Reduce BLE connection priority request delay in `BleRadioTransport` to 1 second
- Improve test reliability by replacing fixed `Thread.sleep` calls with state-based polling and `delay`
2026-05-20 17:08:46 -05:00
James Rich
a960f9ac2d Add Local Mesh Discovery feature
* Introduce a new `:feature:discovery` module for scanning mesh topology across multiple LoRa presets
* Add `DiscoveryScanEngine` to manage scan lifecycles, preset shifting, and packet collection
* Update database schema to version 39 with tables for discovery sessions, preset results, and discovered nodes
* Implement UI screens for scan configuration, real-time progress, and historical session management
* Add flavor-specific discovery maps (Google Maps and OSM) for visualizing node positions and topology
* Include algorithmic and AI-powered summary generation for analyzing LoRa preset performance
* Add report export functionality for Text and PDF formats
* Integrate discovery entry point into the settings screen and navigation graphs
2026-05-20 17:08:09 -05:00
James Rich
4c588b73f8 fix(settings): rename UDP toggle label for cross-platform audit alignment (#5549)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-20 21:51:29 +00:00
James Rich
676be26460 Remove admin_channel_enabled toggle from Security Config screen (#5547)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-20 21:14:45 +00:00
James Rich
91ad5dbb81 fix(flatpak): resolve unique snapshot timestamp URLs from local cached maven-metadata (#5542) 2026-05-20 14:11:50 -05:00
James Rich
0fccf54462 fix(flatpak): route JitPack com.github group to jitpack.io primaryUrl (#5541) 2026-05-20 12:47:33 -05:00
James Rich
32df44fbaa feat(flatpak): reconstruct standard maven filenames from local Gradle cache (#5538) 2026-05-20 12:19:56 -05:00
github-actions[bot]
0724ebf20b docs: update CHANGELOG.md (#5536) 2026-05-20 10:56:19 -05:00
James Rich
89fe2b58d7 docs(nav): fix sidebar nesting, dynamic language switcher, and delete translations page (#5535) 2026-05-20 10:42:34 -05:00
github-actions[bot]
19d10a18cd docs: update CHANGELOG.md (#5534) 2026-05-20 09:28:19 -05:00
James Rich
0076be3a24 chore: Scheduled updates (Firmware, Hardware, Translations, Graphs) (#5532)
Co-authored-by: github-merge-queue <118344674+github-merge-queue@users.noreply.github.com>
2026-05-20 09:11:32 -05:00
James Rich
8113167833 build(flatpak): overhaul offline source generation with native cache scanner (#5533) 2026-05-20 09:11:03 -05:00
github-actions[bot]
cd0b9d6668 docs: update CHANGELOG.md (#5527) 2026-05-20 07:12:58 -05:00
James Rich
99b5688b00 build(flatpak): overhaul and automate flatpak offline manifest generation (#5529) 2026-05-20 07:12:03 -05:00
github-actions[bot]
95df500142 docs: update CHANGELOG.md (#5520) 2026-05-20 04:59:00 -05:00
James Rich
f94358551c fix(docs): compile Jekyll docs site and add root redirect in CI (#5526) 2026-05-20 04:58:44 -05:00
James Rich
7ae1b26813 chore(flatpak): optimize CI source generation and clean up redundant tasks (#5525) 2026-05-20 04:51:47 -05:00
renovate[bot]
8de0a1f167 chore(deps): update koin.plugin to v1.0.0 (#5524) 2026-05-20 04:47:33 -05:00
James Rich
a6523acbb8 ci: unify GitHub Pages deployment (Dokka + docs site) (#5523)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-20 04:23:54 -05:00
James Rich
1998277555 fix(ci): downgrade Ruby to 4.0.4 for ubuntu-24.04 compatibility (#5519)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-19 21:12:38 -05:00
github-actions[bot]
54fafd225b docs: update CHANGELOG.md (#5518) 2026-05-19 21:05:25 -05:00
James Rich
e13a4359e1 fix(ci): exclude kotlinNativeBundleConfiguration from flatpak source generation (#5517)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-19 21:03:51 -05:00
github-actions[bot]
f5e5fb6da6 docs: update CHANGELOG.md (#5516) 2026-05-19 20:39:29 -05:00
renovate[bot]
d37e08fccd chore(deps): update ruby to v4.0.5 (#5515) 2026-05-19 20:38:36 -05:00
James Rich
877909fa94 fix: prevent node details hang when device hardware API is unreachable (#5514)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-19 20:37:42 -05:00
github-actions[bot]
0803dd3ae8 docs: update CHANGELOG.md (#5510) 2026-05-19 18:28:34 -05:00
James Rich
1dcb7b9d1a chore: Scheduled updates (Firmware, Hardware, Translations, Graphs) (#5511) 2026-05-19 18:28:06 -05:00
James Rich
3f64b5a0ec ci: reduce flatpak source generation thrash (#5513)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-19 18:11:13 -05:00
James Rich
5c3b22584e chore(deps): migrate takpacket-sdk to Maven Central coordinates (#5512)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-19 17:12:02 -05:00
James Rich
930dee09e5 build: reorder Maven repos to reduce flatpak generator 404s (#5509)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-19 15:43:00 -05:00