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

@@ -30,9 +30,11 @@ class Brain(Protocol):
screenView tool (screen_view.spec.md); ``trace``: a list the engine adds the steps of
this answer to (history.spec.md, "Traces")."""
def addressed(self, user: str, text: str, names: list[str]) -> Optional[bool]:
"""Blocking: was ``text`` said to the assistant (called ``names``)? None when it could not tell.
Runs on its own thread, also while a reply runs."""
def addressed(self, user: str, text: str, names: list[str], people: Optional[int] = None,
callers: Optional[int] = None) -> Optional[bool]:
"""Blocking: was ``text`` said to the assistant (called ``names``)? ``people``: how many are in
the voice channel, the speaker included; ``callers``: how many of them may call it (None:
not known). None when it could not tell. Runs on its own thread, also while a reply runs."""
def rank(self, candidates: list[dict]) -> Optional[list[str]]:
"""Blocking: candidate ids (``{"id", "user", "text"}``) most important first; None on failure.
@@ -333,9 +335,11 @@ class JarvisBrain:
f"ms={(time.perf_counter() - t0) * 1000:.0f}", "llm")
return answer
def addressed(self, user: str, text: str, names: list[str]) -> Optional[bool]:
def addressed(self, user: str, text: str, names: list[str], people: Optional[int] = None,
callers: Optional[int] = None) -> Optional[bool]:
from .judges import is_addressed
return is_addressed(self.cfg.ollama_base_url, self.cfg.ollama_chat_model, names, text)
return is_addressed(self.cfg.ollama_base_url, self.cfg.ollama_chat_model, names, text,
people=people, callers=callers)
def rank(self, candidates: list[dict]) -> Optional[list[str]]:
from .judges import rank_requests