Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
fix(society): accept spoken routine schedules with day names and blank fields
rubenluetke10-beep4ea99bc39eb0
diff --git a/jarvis/society/routines.py b/jarvis/society/routines.pyindex af62520d3c..a779ca9029 100644--- a/jarvis/society/routines.py+++ b/jarvis/society/routines.py@@ -66,6 +66,51 @@ def agent_tag(agent_id: str) -> str:return f"agent:{agent_id}"+_WEEKDAYS: Final[dict[str, int]] = {+ name: index+ for index, names in enumerate(+ (+ ("mon", "monday"),+ ("tue", "tuesday"),+ ("wed", "wednesday"),+ ("thu", "thursday"),+ ("fri", "friday"),+ ("sat", "saturday"),+ ("sun", "sunday"),+ )+ )+ for name in names+}+++def _without_blanks(schedule: dict[str, Any]) -> dict[str, Any]:+ """Drop the empty optionals a tool-calling model fills in (None, "", [])."""+ return {k: v for k, v in schedule.items() if v not in (None, "", [], ())}+++def _spoken_calendar(schedule: dict[str, Any]) -> dict[str, Any]:+ """Accept the voice command's shape: ``days`` as weekday names and+ ``local_time`` without a leading zero ("8:00")."""+ values = dict(schedule)+ days = values.pop("days", None)+ if days:+ weekdays = []+ for day in days:+ key = str(day).strip().lower()+ if key.isdigit() and int(key) in range(7):+ weekdays.append(int(key))+ elif key in _WEEKDAYS:+ weekdays.append(_WEEKDAYS[key])+ else:+ raise ValueError(f"unknown weekday {day!r}; use mon..sun")+ values["weekdays"] = sorted(set(weekdays))+ local_time = str(values.get("local_time") or "")+ hour, sep, minute = local_time.partition(":")+ if sep and hour.isdigit() and len(hour) == 1:+ values["local_time"] = f"0{hour}:{minute}"+ return values++def _trigger(schedule: dict[str, Any]) -> Any:from jarvis.tasks.calendar import absolute_timestampfrom jarvis.tasks.context import turn_timezone@@ -75,6 +120,7 @@ def _trigger(schedule: dict[str, Any]) -> Any:return TriggerSource.model_validate({"type": kind, **{k: v for k, v in schedule.items() if k not in ("kind", "type")}})+ schedule = _without_blanks(schedule)if kind == "cron":values = dict(schedule)values.setdefault("timezone", turn_timezone())@@ -87,7 +133,7 @@ def _trigger(schedule: dict[str, Any]) -> Any:{"type": kind, **{k: v for k, v in schedule.items() if k not in ("kind", "type")}})if kind == "calendar":- schedule = dict(schedule)+ schedule = _spoken_calendar(schedule)schedule.setdefault("timezone", turn_timezone())return TriggerCalendar.model_validate({"type": kind, **{k: v for k, v in schedule.items() if k not in ("kind", "type")}}diff --git a/tests/unit/ui/web/test_society_voice_management.py b/tests/unit/ui/web/test_society_voice_management.pyindex 435028555d..1903e7ac0c 100644--- a/tests/unit/ui/web/test_society_voice_management.py+++ b/tests/unit/ui/web/test_society_voice_management.py@@ -153,3 +153,25 @@ def test_ui_timezone_route_validates_the_zone(tmp_path: Path, monkeypatch) -> No)assert c.post("/api/tasks/client-timezone", json={"timezone": "Europe/Berlin"}).json()["ok"]assert task_context.turn_timezone() == "Europe/Berlin"+++def test_a_spoken_schedule_with_day_names_and_blank_fields_is_accepted(client) -> None:+ client.post("/api/society/agents", json={"name": "Briefer"})+ created = client.post(+ "/api/society/agents/briefer/routines",+ json={+ "title": "Weekday brief",+ "prompt": "Brief me.",+ "schedule": {+ "kind": "calendar",+ "local_time": "8:00",+ "days": ["mon", "Friday"],+ "timezone": "",+ "expression": None,+ },+ },+ headers={CLIENT_TIMEZONE_HEADER: "Europe/Berlin"},+ )+ assert created.status_code == 200, created.text+ spec = client.app.state.task_store.rows[0]["spec_json"]+ assert '"weekdays":[0,4]' in spec and '"local_time":"08:00"' in spec