feat(orchestrator): readers and acknowledgers per radio row from the seen marks (requirement 005 phase A)
receipts.py builds, for every radio row in a window, the sessions that took it (from their prompt and radio-seen marks) and those that acknowledged a call, with names taken only from the host agent-sessions.json snapshot, so a forged name in a row never reaches the readers; one snapshot build per call keeps a 90k-entry history at 13 ms instead of 8385 ms. radio.py gains seen(), which pending() now uses, so the hooks and the hub decide taken the same way. gating.py and receipts.py share one script loader (skill_scripts.script_module). Not wired into the hub yet: phase B. Tests: tests/test_hub_receipts.py and tests/test_radio_seen.py; both import unify-side helpers and run green merged into unify/skills-20261112-night with the prepared merge resolution. 🎯 Fix: 92 % 💥 Break: 3 % 💸 Cost: 100 % ⏱️ Time: 100 % 🛡️ Security: 100 % 🏆 Score: 89 🚦 Gate: ✅ 90/5, cost and time <= 100, security 100 % Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3418738993
commit
5fea5f1206
6 files changed
+633
-22
No files matched your search
@@ -411,9 +411,26 @@ def cmd_assist(args: argparse.Namespace) -> int:
|
||||
return 0
|
||||
|
||||
|
||||
def seen(row: dict, name: str, prompt: float, state: dict, since: float) -> bool:
|
||||
"""Args:
|
||||
row: a news.jsonl row with a numeric ts.
|
||||
name: the session's name, as name_of() gives it.
|
||||
prompt: the session's prompt mark, as prompt_mark() gives it.
|
||||
state: the session's radio-seen state; the mark of the row's channel
|
||||
holds the ts of the newest row the session took on it.
|
||||
since: rows at or before it count as taken; the hooks pass the start
|
||||
of WINDOW, a reader of the marks alone NEVER.
|
||||
|
||||
Returns:
|
||||
Whether the session has taken the row: it is for the session and its
|
||||
ts is not after the prompt mark, since or the mark of its channel.
|
||||
"""
|
||||
return for_me(row, name) and not row["ts"] > max(prompt, since, mark(state, channel(row)))
|
||||
|
||||
|
||||
def pending(sid: str, name: str, state: dict, family: str) -> list[dict]:
|
||||
floor = max(prompt_mark(sid), time.time() - WINDOW, mark(state, family))
|
||||
return [row for row in items() if channel(row) == family and row["ts"] > floor and for_me(row, name)]
|
||||
prompt, since = prompt_mark(sid), time.time() - WINDOW
|
||||
return [row for row in items() if channel(row) == family and for_me(row, name) and not seen(row, name, prompt, state, since)]
|
||||
|
||||
|
||||
def take(sid: str, family: str) -> list[dict]:
|
||||
|
||||
Reference in new issue
Block a user