feat(hub): answer AskUserQuestion in the hub with a signed pick
The permission hook mirrors every question of an AskUserQuestion call as one hub decision (POST /api/decisions, hooked, multi for multiSelect, recommended from the (Recommended) labels) and waits for its pick. Once the operator's pinned passkey signed the pick of every question, checked locally in signature-counter order, the allow carries updatedInput with the answers, multi picks joined by ', '. A hub that does not answer, an expired decision or a pick whose signature fails leaves the terminal dialog untouched. choosing.picks accepts one label, ordered multi labels joined by a newline, or for a hooked decision one trimmed line of other text; decision_status expires a hooked decision whose wait ran out, and the state view and Match drop expired ones. decision_request shares choice_of with the hook; the answer text moves to signing.choice_text unchanged. Rebased from its lane base2754568ontof95196c: the scan copy's diff against2aea6d1would have reverted the release-flash fix, so the bundle was re-exported against 2754568; conflicts in view.py (reasons next to the decision_status filter) and page-match.js (toggles next to epoch and the ux constants) keep both sides. ruff and node --check pass. Tests: test_hub_questions (210 lines) and test_question_multi_e2e. Written, not run: the full suite runs once on master after all bundles (operator order). Security: MEDUSA over the staged tree on master: 100, no findings over 17 files; index.html.j2 is not covered and was read by hand (one style rule). 🎯 Fix: 90 % 💥 Break: 5 % 💸 Tokens: – ⏱️ Velocity: – 🛡️ Security: 100 % 🏆 Score: 86 🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 % Created-with: https://s.veen.world/skills Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f95196ca82
commit
a6eee78165
18 files changed
+763
-64
No files matched your search
@@ -28,6 +28,9 @@ TASK = re.compile(r"[a-z0-9][a-z0-9._-]{0,99}(?:/[a-z0-9][a-z0-9._-]{0,99}){0,7}
|
||||
PRIO = re.compile(r"[1-9][0-9]{0,2}")
|
||||
FIBONACCI = ("1", "2", "3", "5", "8", "13", "21", "34", "55", "89")
|
||||
ESTIMATOR = "Operator"
|
||||
CHOICE_CLASS = "post"
|
||||
QUESTION_SHOWN = 200
|
||||
PICKED = "\n"
|
||||
COMMANDS = "operator/"
|
||||
STATUSES = ("queued", "running", "blocked", "done", "stopped")
|
||||
GATE_LEVELS = ("none", "quick", "test", "quality-high", "e2e")
|
||||
@@ -179,6 +182,22 @@ def message_item(to: str, cls: str, text: str, upload: str, voice: str, voice_sh
|
||||
return {"kind": "message", "to": to, "class": cls, "text": text, "upload": upload, "voice": voice, "voice_sha256": voice_sha256}
|
||||
|
||||
|
||||
def choice_text(decision_id: str, question: str, label: str) -> str:
|
||||
shown = " ".join(question.split())[:QUESTION_SHOWN]
|
||||
return f"Choice for decision {decision_id} ({shown}): {label}"
|
||||
|
||||
|
||||
def choice_item(to: str, decision_id: str, question: str, label: str) -> dict:
|
||||
"""Args:
|
||||
to: the asking agent the answer is posted to.
|
||||
|
||||
Returns:
|
||||
The post that a pick of the option label of the decision decision_id
|
||||
signs, its question on one line and cut at QUESTION_SHOWN.
|
||||
"""
|
||||
return message_item(to, CHOICE_CLASS, choice_text(decision_id, question, label), "", "", "")
|
||||
|
||||
|
||||
def board_item(action: str, agents: list[str]) -> dict:
|
||||
"""Args:
|
||||
action: the board action.
|
||||
|
||||
Reference in new issue
Block a user