093: triage.py classifies every request as open, failed, expired or stale; POST /api/requests/dismiss hides many requests hub-wide under one passkey signature with the usual undo window, ledger dismissals.json. 094: an ask or hooked decision lives as long as its Claude dialog: the hook waits the hub Settings' hook wait (1-60 min, default 60), PostToolUse, Stop, UserPromptSubmit and SessionEnd hooks close the session's cards, and a card whose hook stopped waiting reads open in Claude. Closes are bound to a per-session closer token whose sha256 the hub stores, so a local process cannot close another session's cards or forge a choice. GET /api/match/closed lets the page drop closed cards within 5 s. 096: the release signs dismissals of dropped expired cards together with the inbox entries; no radio reaches the agent. 088: the prune list is no longer capped at 50 tasks. 091: nvidia-smi's error line reaches the GPU row as its cause; limits take a batch of staged values under one proof. MEDUSA: 57 findings accepted as false positives after an independent skeptic review and the operator's word (MM-SCAN-058 regex PLA matching replay/place/replace, CODEGEN-SCAN-001 on Map.delete and labels, fixed nvidia-smi argv, localhost-only hook URLs, passkey in tooltips). Gate missed on the operator's word: break 8 %, the E2E runs after the page bundle; operator must run make orchestrator-hook and restart every Claude Code session after the install. 🎯 Fix: 92 % 💥 Break: 8 % 💸 Tokens: – ⏱️ Velocity: – 🛡️ Security: 100 % 🏆 Score: 85 🚦 Gate: ⛔ break 8 % > 5 Created-with: https://s.veen.world/skills Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
121 lines
4.6 KiB
Python
121 lines
4.6 KiB
Python
from __future__ import annotations
|
|
|
|
import datetime
|
|
import re
|
|
|
|
import signing
|
|
|
|
ANNOUNCE = "announce"
|
|
APPLY = "prune"
|
|
WINDOW_MIN = 60
|
|
SKEW = 300
|
|
SENDER = "Operator"
|
|
RECORDS = ("operator/", "hotfix/")
|
|
DAYS = re.compile(r"[1-9][0-9]{0,2}")
|
|
EPOCH = re.compile(r"[1-9][0-9]{9}")
|
|
|
|
|
|
def whole(value: object) -> bool:
|
|
return isinstance(value, int) and not isinstance(value, bool)
|
|
|
|
|
|
def checked_tasks(tasks: list[str]) -> list[str]:
|
|
"""Returns:
|
|
tasks: at least one distinct register slug signing.TASK matches,
|
|
none an operator/ or hotfix/ record; the hub's body limit is the
|
|
only bound on their number.
|
|
|
|
Raises:
|
|
signing.Refused for any other list.
|
|
"""
|
|
if not tasks or len(set(tasks)) != len(tasks):
|
|
raise signing.Refused("a prune names at least one task, each once")
|
|
if not all(signing.TASK.fullmatch(task) and not task.startswith(RECORDS) for task in tasks):
|
|
raise signing.Refused("a pruned task is no register task slug outside operator/ and hotfix/")
|
|
return tasks
|
|
|
|
|
|
def announced(argv: list[str]) -> bool:
|
|
return len(argv) >= 6 and argv[0] == ANNOUNCE and argv[1] == "--days" and argv[3] == "--deadline" and bool(DAYS.fullmatch(argv[2]) and EPOCH.fullmatch(argv[4]))
|
|
|
|
|
|
def applied(argv: list[str], not_before: object) -> bool:
|
|
if len(argv) < 4 or argv[:2] != [APPLY, "--since"] or not EPOCH.fullmatch(argv[2]) or not whole(not_before):
|
|
return False
|
|
return WINDOW_MIN <= not_before - int(argv[2]) <= signing.PRUNE_WINDOW
|
|
|
|
|
|
def prune_argv(argv: object, not_before: object) -> list[str]:
|
|
"""Args:
|
|
argv: the announce job's `announce --days <N> --deadline <epoch>
|
|
<task>...` (N 1 to 999 DAYS, an EPOCH) with not_before None, or
|
|
the apply job's rasci.py arguments `prune --since <epoch>
|
|
<task>...` with not_before the deadline, WINDOW_MIN to
|
|
signing.PRUNE_WINDOW seconds after since; the tasks as
|
|
checked_tasks() takes them.
|
|
not_before: the epoch the runner holds the job back until, signed
|
|
with it.
|
|
|
|
Returns:
|
|
argv, the hub and the runner check it the same way.
|
|
|
|
Raises:
|
|
signing.Refused for every other argv or not_before.
|
|
"""
|
|
if not isinstance(argv, list) or not all(isinstance(part, str) for part in argv):
|
|
raise signing.Refused("the argv is no list of texts")
|
|
if not_before is None and announced(argv):
|
|
checked_tasks(argv[5:])
|
|
return argv
|
|
if applied(argv, not_before):
|
|
checked_tasks(argv[3:])
|
|
return argv
|
|
raise signing.Refused(f"the argv is no prune announce with --days and --deadline, nor rasci.py prune --since with a deadline {WINDOW_MIN} to {signing.PRUNE_WINDOW} s later")
|
|
|
|
|
|
def prune_item(argv: list[str], not_before: int | None) -> dict:
|
|
item = {"kind": signing.PRUNE_KIND, "argv": argv}
|
|
return item if not_before is None else {**item, "not_before": not_before}
|
|
|
|
|
|
def tasks_of(argv: list[str]) -> list[str]:
|
|
return argv[5:] if argv[0] == ANNOUNCE else argv[3:]
|
|
|
|
|
|
def deadline_of(argv: list[str]) -> int:
|
|
return int(argv[4])
|
|
|
|
|
|
def timely(argv: list[str], not_before: int | None, now: float) -> None:
|
|
"""Raises:
|
|
signing.Refused for an announce whose deadline passed or lies over
|
|
signing.PRUNE_WINDOW + SKEW seconds ahead, and for an apply job
|
|
before its not_before.
|
|
"""
|
|
if not_before is not None and not_before > now:
|
|
raise signing.Refused(f"the prune is not due before {stamp(not_before)}")
|
|
if not_before is None and not now < deadline_of(argv) <= now + signing.PRUNE_WINDOW + SKEW:
|
|
raise signing.Refused(f"the prune deadline {stamp(deadline_of(argv))} passed or lies over {signing.PRUNE_WINDOW} s ahead")
|
|
|
|
|
|
def stamp(epoch: int) -> str:
|
|
return datetime.datetime.fromtimestamp(epoch).astimezone().isoformat(timespec="seconds")
|
|
|
|
|
|
def announcement(argv: list[str]) -> str:
|
|
"""Returns:
|
|
The Securite text of an announce argv: every task, the deadline in
|
|
local HH:MM and ISO 8601, and how an agent keeps a task.
|
|
"""
|
|
deadline = datetime.datetime.fromtimestamp(deadline_of(argv)).astimezone()
|
|
names = ", ".join(tasks_of(argv))
|
|
return (
|
|
f"Stale task prune at {deadline:%H:%M} ({deadline.isoformat(timespec='seconds')}): {names}. "
|
|
f"Each had no register change for {argv[2]} days; at the deadline the hub runner sets every one still unchanged to stopped. "
|
|
"Keep a task with rasci.py keep <task>; any register change of it keeps it too."
|
|
)
|
|
|
|
|
|
def radio_argv(argv: list[str]) -> list[str]:
|
|
return ["send", "security", announcement(argv), "--session", SENDER]
|