Stream -> Radio gets one line per station with state, play and stop, autoplay and CSP refusals as row state and toast, and the speaking agent pulsing there and in the Orbit and Chord views. The composer sends on all seven channels; push-to-talk records with MediaRecorder, whisper.cpp transcribes off the request thread under per-minute and per-hour caps, and the recording travels only when "Aufnahme anhängen" is ticked. Every operator message, the mayday clear, the day and night board actions and a settings save that adds a stream origin take the passkey; the hub verifies each signature once against the pinned keys before it relays or acts. The container gets TMPDIR=/scratch so that verification no longer fails on the read-only root. A denial now signs its recipient: the inbox and the signing step resolve it through one function, a claim set naming several agents leaves a direct denial without recipient, and a recipient that changed after the inbox showed it is refused with 409. operator_message returns only the signed reason for a denial, never the agent's own words the radio row quotes, and the permission hook hashes the signed recipient too. 🎯 Fix: 95 % 💥 Break: 3 % 💸 Cost: 99 % ⏱️ Time: 68 % 🛡️ Security: 100 % 🏆 Score: 100 🚦 Gate: ✅ 90/5, cost and time <= 100, security 100 % Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
57 lines
2.0 KiB
Python
57 lines
2.0 KiB
Python
from __future__ import annotations
|
|
|
|
import importlib.util
|
|
import sys
|
|
from pathlib import Path
|
|
from types import ModuleType
|
|
|
|
CLIENT = Path(__file__).resolve().parents[1] / "client"
|
|
|
|
|
|
def client_module(name: str, uses: dict[str, ModuleType]) -> ModuleType:
|
|
"""Args:
|
|
name: a module of orchestrator/client, loaded under its own
|
|
kvb_orchestrator_<name> name.
|
|
uses: the client modules it imports by their bare names; they are
|
|
visible under those names only while it loads.
|
|
"""
|
|
spec = importlib.util.spec_from_file_location(f"kvb_orchestrator_{name}", CLIENT / f"{name}.py")
|
|
module = importlib.util.module_from_spec(spec)
|
|
before = {key: sys.modules.get(key) for key in uses}
|
|
sys.modules.update(uses)
|
|
try:
|
|
spec.loader.exec_module(module)
|
|
finally:
|
|
for key, old in before.items():
|
|
if old is None:
|
|
sys.modules.pop(key, None)
|
|
else:
|
|
sys.modules[key] = old
|
|
return module
|
|
|
|
|
|
signing = client_module("signing", {})
|
|
passkey = client_module("passkey", {"signing": signing})
|
|
verifier = client_module("verifier", {"signing": signing, "passkey": passkey})
|
|
|
|
|
|
def ask_signed(ask: dict) -> dict:
|
|
return signing.ask_item(ask["id"], ask["tool"], ask["command"], ask["cwd"], ask["session"])
|
|
|
|
|
|
def review_signed(review: dict) -> dict:
|
|
return signing.review_item(review["id"], review.get("repo", ""), review["worktree"], review["branch"], review["tree"])
|
|
|
|
|
|
def operator_signed(row: dict) -> dict:
|
|
return signing.operator_item(row["task"], row["command"], row["directory"])
|
|
|
|
|
|
def request_signed(request: dict) -> dict:
|
|
return signing.rule_request_item(request["id"], request["kind"], request["tool"], request["pattern"], request["scope"], int(request["expires"]))
|
|
|
|
|
|
def message_signed(message: dict) -> dict:
|
|
upload = message["upload"]
|
|
return signing.message_item(message["to"], message["class"], message["text"], "" if upload is None else upload["id"], message["voice"] or "", message["voice_sha256"])
|