feat(orchestrator): choose notification channels in the settings
Settings store the notification channels (browser, sound, speech) instead of one notify flag, migrating the old flag to the browser channel; alerts and speech follow the chosen channels. Tests run once on unify/skills-20261114 after the merge (operator order 2026-11-14). 🎯 Fix: 85 % 💥 Break: 8 % 💸 Tokens: 100 % ⏱️ Velocity: 100 % 🛡️ Security: 100 % 🏆 Score: 78 🚦 Gate: ⛔ fix 85 % < 90, break 8 % > 5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
48f26b678a
commit
41e262407c
10 files changed
+361
-12
No files matched your search
@@ -33,7 +33,7 @@ SETTINGS = {
|
||||
"theme": "sky",
|
||||
"colors": {"top": "#0b1020", "bottom": "#2b3a67", "accent": "#8fadff"},
|
||||
"music": {"on": False, "volume": 0.4},
|
||||
"notify": True,
|
||||
"channels": {"browser": True, "sounds": True, "aloud": True, "title": True},
|
||||
"streams": [],
|
||||
"speech": {"threshold": 50},
|
||||
"space": {
|
||||
@@ -188,7 +188,7 @@ def valid_settings(raw: object) -> dict:
|
||||
"theme": data["theme"],
|
||||
"colors": {key: color(colors[key], f"colors.{key}") for key in SETTINGS["colors"]},
|
||||
"music": {"on": flag(music["on"], "music.on"), "volume": number_in(music["volume"], "music.volume", 0.0, 1.0)},
|
||||
"notify": flag(data["notify"], "notify"),
|
||||
"channels": channels_setting(data["channels"]),
|
||||
"streams": [stream_entry(entry, index) for index, entry in enumerate(data["streams"])],
|
||||
"speech": speech_setting(data["speech"]),
|
||||
"space": space_setting(data["space"]),
|
||||
@@ -216,6 +216,22 @@ def radio_moved(stored: object) -> object:
|
||||
return {**others, "speech": rest} if rest else others
|
||||
|
||||
|
||||
def channels_setting(raw: object) -> dict:
|
||||
entry = section(raw, "channels", tuple(SETTINGS["channels"]))
|
||||
return {name: flag(entry[name], f"channels.{name}") for name in SETTINGS["channels"]}
|
||||
|
||||
|
||||
def notify_moved(stored: object) -> object:
|
||||
"""Returns:
|
||||
The stored settings with the old notify flag as the browser channel
|
||||
and every other channel on; stored channels win over the flag.
|
||||
"""
|
||||
if not isinstance(stored, dict) or "notify" not in stored:
|
||||
return stored
|
||||
kept = {key: value for key, value in stored.items() if key != "notify"}
|
||||
return {"channels": {**SETTINGS["channels"], "browser": stored["notify"]}, **kept}
|
||||
|
||||
|
||||
def migrated(stored: object) -> object:
|
||||
"""Returns:
|
||||
The stored settings in the current shape: the radio set moved to the
|
||||
@@ -223,7 +239,7 @@ def migrated(stored: object) -> object:
|
||||
it may have been saved without the passkey, so the hub never dials
|
||||
it unsigned; re-adding it with the passkey resolves its redirects.
|
||||
"""
|
||||
stored = radio_moved(stored)
|
||||
stored = notify_moved(radio_moved(stored))
|
||||
streams = stored.get("streams") if isinstance(stored, dict) else None
|
||||
if not isinstance(streams, list):
|
||||
return stored
|
||||
|
||||
Reference in new issue
Block a user