Files
Timmy-time-dashboard/tests/test_voice_nlu.py
Alexspayne f9b84c1e2f feat: Mission Control v2 — swarm, L402, voice, marketplace, React dashboard
Major expansion of the Timmy Time Dashboard:

Backend modules:
- Swarm subsystem: registry, manager, bidder, coordinator, agent_runner, swarm_node, tasks, comms
- L402/Lightning: payment_handler, l402_proxy with HMAC macaroons
- Voice NLU: regex-based intent detection (chat, status, swarm, task, help, voice)
- Notifications: push notifier for swarm events
- Shortcuts: Siri Shortcuts iOS integration endpoints
- WebSocket: live dashboard event manager
- Inter-agent: agent-to-agent messaging layer

Dashboard routes:
- /swarm/* — swarm management and agent registry
- /marketplace — agent catalog with sat pricing
- /voice/* — voice command processing
- /mobile — mobile status endpoint
- /swarm/live — WebSocket live feed

React web dashboard (dashboard-web/):
- Sovereign Terminal design — dark theme with Bitcoin orange accents
- Three-column layout: status sidebar, workspace tabs, context panel
- Chat, Swarm, Tasks, Marketplace tab views
- JetBrains Mono typography, terminal aesthetic
- Framer Motion animations throughout

Tests: 228 passing (expanded from 93)
Includes Kimi's additional templates and QA work.
2026-02-21 12:57:38 -05:00

91 lines
2.5 KiB
Python

"""Tests for voice/nlu.py — intent detection and command extraction."""
from voice.nlu import detect_intent, extract_command
# ── Intent detection ─────────────────────────────────────────────────────────
def test_status_intent():
intent = detect_intent("What is your status?")
assert intent.name == "status"
assert intent.confidence >= 0.8
def test_status_intent_health():
intent = detect_intent("health check")
assert intent.name == "status"
def test_swarm_intent():
intent = detect_intent("Show me the swarm agents")
assert intent.name == "swarm"
def test_task_intent():
intent = detect_intent("Create a new task for research")
assert intent.name == "task"
def test_help_intent():
intent = detect_intent("What commands do you support?")
assert intent.name == "help"
def test_voice_intent():
intent = detect_intent("Set the volume louder")
assert intent.name == "voice"
def test_chat_fallback():
intent = detect_intent("Tell me about Bitcoin sovereignty")
assert intent.name == "chat"
assert intent.confidence == 0.5
def test_empty_input():
intent = detect_intent("")
assert intent.name == "unknown"
assert intent.confidence == 0.0
def test_intent_has_raw_text():
intent = detect_intent("hello world")
assert intent.raw_text == "hello world"
# ── Entity extraction ────────────────────────────────────────────────────────
def test_entity_agent_name():
intent = detect_intent("spawn agent Echo")
assert "agent_name" in intent.entities
assert intent.entities["agent_name"] == "Echo"
def test_entity_number():
intent = detect_intent("set volume to 80")
assert "number" in intent.entities
assert intent.entities["number"] == "80"
# ── Command extraction ──────────────────────────────────────────────────────
def test_slash_command():
cmd = extract_command("/status")
assert cmd == "status"
def test_timmy_prefix_command():
cmd = extract_command("timmy, spawn agent Echo")
assert cmd is not None
assert "spawn" in cmd
def test_no_command():
cmd = extract_command("just a regular sentence")
assert cmd is None
def test_empty_slash():
cmd = extract_command("/")
assert cmd is None