- Add TimeoutCancellationException handling to getNodeDetails and getMeshMetrics
AppFunctions (consistent with Phase 1 functions)
- Rethrow CancellationException in all provider catch blocks to preserve
structured concurrency semantics
- Fix voltage documentation: millivolts → volts (matches actual Float field)
- Fix stale test comment referencing non-existent test class
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Extend AiFunctionProvider with two new suspend methods for advanced queries
- getNodeDetails: Retrieve per-node telemetry (16 fields) by hex or user ID
- getMeshMetrics: Aggregate mesh statistics and compute health score
- Add result types (GetNodeDetailsResult, GetMeshMetricsResult) and data models
- Add response models (@AppFunctionSerializable) for KSP serialization
- Both methods support timeout protection and rate limiting
- Health score calculation: 50 base + 50 online ratio, clamped 0-100
- All JVM, Android, detekt, spotless checks passing
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Previously, AiFunctionProviderImpl returned a hardcoded messageId of 0
for all successful sends, preventing unique message identification. The
underlying SendMessageUseCase generates a packetId but had no return
value to expose it.
Changes:
- Modified SendMessageUseCase interface to return Int (the packetId)
- Updated SendMessageUseCaseImpl to return the generated packetId
- Updated AiFunctionProviderImpl to capture and use the returned messageId
This enables the AI system to track individual messages and correlate
responses to specific send requests.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Expose Meshtastic mesh networking capabilities (sendMessage, getMeshStatus)
to Android system AI agents via the App Functions API.
Architecture:
- AiFunctionProvider interface in core/data commonMain (platform-agnostic)
- FuzzyNameResolver for node/channel name matching (LCS algorithm)
- RateLimiter with 5-call/60s sliding window to protect mesh radio
- AiFunctionProviderImpl wiring repositories and use cases
- @AppFunction declarations in androidApp Google flavor only
- GoogleMeshUtilApplication with AppFunctionConfiguration.Provider
- DI via AppFunctionsModule included in FlavorModule
Key design decisions:
- No confirmation dialog (AI invocation = user intent)
- Fuzzy name matching with 50% LCS threshold, error on ambiguity
- Admin channels excluded from resolution
- 5-second operation timeout
- 237-byte message length limit (Meshtastic standard)
Includes unit tests for RateLimiter and FuzzyNameResolver (LCS algorithm).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>