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>
This commit is contained in:
K7ZVX 2026-05-06 00:11:57 +00:00
commit 7670b7c0b9
3 changed files with 81 additions and 38 deletions

View file

@ -344,17 +344,19 @@ class MeshAI:
# Determine response
if result.route_type == RouteType.COMMAND:
# Chunk command output same as LLM responses
from .chunker import chunk_response
raw = result.response if isinstance(result.response, str) else str(result.response)
messages, remaining = chunk_response(
raw,
max_chars=self.config.response.max_length,
max_messages=self.config.response.max_messages,
)
# Store remaining for continuation
if remaining:
self.router.continuations.store(message.sender_id, remaining)
if isinstance(result.response, list):
# Command returned pre-split messages — send directly
messages = result.response
else:
# Single string — chunk it
from .chunker import chunk_response
messages, remaining = chunk_response(
result.response,
max_chars=self.config.response.max_length,
max_messages=self.config.response.max_messages,
)
if remaining:
self.router.continuations.store(message.sender_id, remaining)
elif result.route_type == RouteType.LLM:
messages = await self.router.generate_llm_response(message, result.query)
else: