voice gateway returns skill result only

This commit is contained in:
gabby committed 2026-10-06 05:55:07 +00:00
1 parent 172e61e6be
commit e8d1685177
8 files changed
+138 -11

No files matched your search

+49
View File
@@ -281,6 +281,55 @@ def test_service_surfaces_and_resolves_approval(tmp_path):
assert any("approved" in text for text in drain_outbound(service))
# ---- service: result-only front end (voice) ----
class FakeResultOnlyAdapter:
name = "voice"
result_only = True
def build_result_only_service(scheduler, config=None):
return GatewayService(scheduler, FakeResultOnlyAdapter(), config=config or {})
def test_result_detail_unwraps_scheduler_summary():
from semif_agent.gateway.service import _result_detail
assert _result_detail("time.now: ok — 2026-10-06 12:00") == "2026-10-06 12:00"
assert _result_detail("interrupted x; time.now: ok — 12:00") == "12:00"
assert _result_detail("a plain reply") == "a plain reply"
def test_result_only_speaks_detail_and_drops_status(tmp_path):
scheduler = build_scheduler(tmp_path)
service = build_result_only_service(scheduler)
service._reply("voice", "c", "[high] time.now: ok — 12:00", kind="result")
service._reply("voice", "c", "urgency low (weight 0.20)", kind="status")
service._reply("voice", "c", "Which account?", kind="question")
assert drain_outbound(service) == ["12:00", "Which account?"]
def test_plain_adapter_keeps_full_scheduler_output(tmp_path):
scheduler = build_scheduler(tmp_path)
service = build_service(scheduler) # FakeAdapter (simplex), not result_only
service._reply("simplex", "4", "[high] time.now: ok — 12:00", kind="result")
service._reply("simplex", "4", "urgency low (weight 0.20)", kind="status")
assert drain_outbound(service) == [
"[high] time.now: ok — 12:00",
"urgency low (weight 0.20)",
]
def test_config_can_turn_result_only_off(tmp_path):
scheduler = build_scheduler(tmp_path)
service = build_result_only_service(
scheduler, config={"voice": {"result_only": False}}
)
service._reply("voice", "c", "[high] time.now: ok — 12:00", kind="result")
service._reply("voice", "c", "urgency low", kind="status")
assert drain_outbound(service) == ["[high] time.now: ok — 12:00", "urgency low"]
# ---- LXMF adapter ----
def test_lxmf_default_deny_and_allowlist():
+6
View File
@@ -247,6 +247,12 @@ def test_adapter_ignores_empty_utterance():
assert seen == []
def test_adapter_is_result_only():
# The spoken front end speaks only the skill's result line, not the
# scheduler's bookkeeping (overridable via gateway.voice.result_only).
assert VoiceAdapter({}).result_only is True
# ---- CLI wiring ------------------------------------------------------------