voice gateway returns skill result only
This commit is contained in:
1 parent
172e61e6be
commit
e8d1685177
8 files changed
+138
-11
No files matched your search
@@ -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():
|
||||
|
||||
Reference in new issue
Block a user