feat(app): addressed calls follow who is in the voice channel

Alone with Jarvis, whatever the speaker says is answered without asking the judge. With others
present the judge is told how many people are in the channel and how many may call Jarvis: with
one other person most of what the speaker says counts as said to Jarvis (unclear is yes); with
more, or not known, the question is the group one it was before. Live 2026-11-16: alone in the
channel, questions without the wake word got no answer because the judge assumed a group.
Eval (qwen3:8b, pair cases): 3/7 before, 6/7 after; group cases unchanged.

Also: the protocol test fixture's brain takes the trace argument (the test failed since traces).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-16 15:43:10 +09:00
parent 80ce9281a3
commit 72518ca50e
14 changed files with 213 additions and 40 deletions

View File

@@ -790,11 +790,15 @@ class Session:
if self.worker.brain is None:
self.error("brain_unavailable", "the worker was started without --brain", id=qid)
return
# Who is in the voice channel (people, and of them who may call), when the app says.
count = lambda k: msg[k] if isinstance(msg.get(k), int) and not isinstance(msg[k], bool) and msg[k] > 0 else None
people, callers = count("people"), count("callers")
async def judge():
try:
async with self._llm():
yes = await asyncio.to_thread(self.worker.brain.addressed, user, text, list(self.settings.hotwords))
yes = await asyncio.to_thread(self.worker.brain.addressed, user, text, list(self.settings.hotwords),
people, callers)
except Exception as e: # the brain must never take the session down
debug_log(f"brain addressed {qid} failed: {type(e).__name__}", "llm")
yes = None