feat(orchestrator): hub requirements 066 to 082 and 084
Radio footer, rules page, schedules editor (System timers and Claude tasks through signed runner jobs), account usage bar, usage explorer with a streamed usage.jsonl, queue Controls tab and override, running tasks on the board, stale task prune with the generic dial, greyed card stamps, commit-tree diffs from the runner preview, VS Code path links, expired asks and decisions that stay as EXPIRED cards (asks keyed by a call digest; an async PostToolUse hook closes those answered in the terminal), the Match refresh hourglass, attachments by paste, drop and paperclip in every text field (page CSP gains img-src blob: for the thumbnails) and the limits board with profiles and a passkey to loosen. Fixes: one red accept on a red-gate commit and no release while a risk is open, the send bar footer segments share one height, the mic button survives a redraw, new Match cards queue before the release card. E2E specs were still running at commit time (operator order); their failures follow as separate fixes. 🎯 Fix: 88 % 💥 Break: 8 % 💸 Tokens: – ⏱️ Velocity: – 🛡️ Security: 100 % 🏆 Score: 81 🚦 Gate: ⛔ fix 88 % < 90, break 8 % > 5 (committed on the operator's word) Created-with: https://s.veen.world/skills Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
dc0d578eca
commit
f356083a24
149 files changed
+10646
-963
No files matched your search
@@ -7,7 +7,9 @@
|
||||
--approvers: the pinned passkeys, e.g. ~/.config/kvb-orchestrator/approvers.json.
|
||||
--replay: this hook's replay store, outside the hub's reach, e.g.
|
||||
~/.local/state/kvb-orchestrator-approvals/hook.json.
|
||||
stdin: the Claude Code PermissionRequest hook input.
|
||||
stdin: the Claude Code PermissionRequest hook input, or the PostToolUse
|
||||
input of a call that ran, which report_ran() tells the hub and which
|
||||
prints nothing.
|
||||
|
||||
Returns:
|
||||
stdout: the PermissionRequest decision JSON: allow only when a pinned
|
||||
@@ -70,6 +72,8 @@ QUESTION_TOOL = "AskUserQuestion"
|
||||
SHELL = "Bash"
|
||||
SHELL_KEYS = frozenset({"command", "description", "timeout", "run_in_background"})
|
||||
OPTION_KEYS = ("label", "description", "preview")
|
||||
RAN_EVENT = "PostToolUse"
|
||||
RAN_TIMEOUT = 2.0
|
||||
|
||||
|
||||
def summary(tool: str, tool_input: object) -> str:
|
||||
@@ -196,11 +200,41 @@ def encoded(payload: dict) -> bytes:
|
||||
return json.dumps(payload).encode()
|
||||
|
||||
|
||||
def create(base: str, ask: dict, timeout: float, shown: dict) -> str:
|
||||
data = encoded({**ask, "timeout": timeout, **shown})
|
||||
def call_key_of(hook: dict) -> str:
|
||||
"""Returns:
|
||||
signing.call_key() of the hook input's tool_name and tool_input, the
|
||||
same for the PermissionRequest and the PostToolUse input of one call;
|
||||
empty when they cannot be encoded, so the ask goes without it and
|
||||
never becomes an expired Match card.
|
||||
"""
|
||||
try:
|
||||
return signing.call_key(hook.get("tool_name"), hook.get("tool_input"))
|
||||
except (TypeError, ValueError):
|
||||
return ""
|
||||
|
||||
|
||||
def report_ran(base: str, hook: dict) -> None:
|
||||
"""Args:
|
||||
hook: the PostToolUse input of a call that ran; the hub closes the
|
||||
oldest still pending ask of that session and call_key_of() as
|
||||
answered in the terminal. The report approves and denies nothing.
|
||||
"""
|
||||
key, session = call_key_of(hook), str(hook.get("session_id") or "")
|
||||
if not key or not session or len(session) > NAME_LIMIT:
|
||||
return
|
||||
request = urllib.request.Request(f"{base}/api/asks/ran", data=encoded({"call_key": key, "session": session}), headers={"Content-Type": "application/json", **hub_api.GUARD}, method="POST")
|
||||
hub_api.call(request, RAN_TIMEOUT)
|
||||
|
||||
|
||||
def create(base: str, ask: dict, timeout: float, shown: dict, key: str) -> str:
|
||||
"""Args:
|
||||
key: the call's call_key_of(), sent only when not empty.
|
||||
"""
|
||||
called = {"call_key": key} if key else {}
|
||||
data = encoded({**ask, "timeout": timeout, **called, **shown})
|
||||
if len(data) > hub_limits.DIFF_BODY_LIMIT:
|
||||
print(f"kvb-orchestrator: the ask goes without its diff, its {len(data)} bytes pass the hub's {hub_limits.DIFF_BODY_LIMIT}", file=sys.stderr)
|
||||
data = encoded({**ask, "timeout": timeout})
|
||||
data = encoded({**ask, "timeout": timeout, **called})
|
||||
headers = {"Content-Type": "application/json", **hub_api.GUARD}
|
||||
request = urllib.request.Request(f"{base}/api/asks", data=data, headers=headers, method="POST")
|
||||
ask_id = hub_api.call(request, hub_api.SLACK)["id"]
|
||||
@@ -350,6 +384,9 @@ def main() -> int:
|
||||
deadline = time.monotonic() + args.timeout
|
||||
try:
|
||||
hook = json.load(sys.stdin)
|
||||
if hook.get("hook_event_name") == RAN_EVENT:
|
||||
report_ran(base, hook)
|
||||
return 0
|
||||
questions = asked_questions(hook)
|
||||
if questions is not None:
|
||||
chosen = answers_of(base, hook, questions, args.timeout, trust, deadline)
|
||||
@@ -365,7 +402,7 @@ def main() -> int:
|
||||
print(f"kvb-orchestrator: {WORKTREE}", file=sys.stderr)
|
||||
return 0
|
||||
pinned, shown = commit_diff(ask, staged_diff.rules_root())
|
||||
ask_id = create(base, ask, args.timeout, shown)
|
||||
ask_id = create(base, ask, args.timeout, shown, call_key_of(hook))
|
||||
answer = {"status": "pending"}
|
||||
while answer["status"] == "pending" and (left := deadline - time.monotonic()) > 0:
|
||||
answer = status(base, ask_id, min(left, POLL))
|
||||
|
||||
Reference in new issue
Block a user