Files
skills/orchestrator/kvb_orchestrator/register.py
T
Kevin Veen-BirkenbachandClaude Opus 5.5 6f940b4415 feat(orchestrator): rename kvb-hub to Agent Orchestrator with the phase 2 surface
Surface (requirement 001 phase 2): navigation Stream (Inbox, Regeln) / Agents / Artifacts with keys 1-3 and hash routes (#graph and #tree redirect), header with title, command palette and settings only, server-side badges (unsnoozed inbox, beats within 900 s, open jobs), a Mayday banner with "aufheben", four stream chips with agent:/art:/seit: search, Filter and time menus, the inbox in main, an agents toolbar (Funk an alle with Newsletter, Broadcast, Pan-Pan, Security, Mayday; Priorität; Tag/Nacht), Post or Call in the agent panel, Ambiente in the settings and read-aloud over the seven classes with Mayday locked.

Rename (decision 9): hub/ is orchestrator/, the package kvb_orchestrator, the unit kvb-orchestrator-runner.service, scripts/orchestrator.sh, environment KVB_ORCHESTRATOR_*, make targets orchestrator-*, the MCP server, image and compose project kvb-orchestrator, the guard header X-Kvb-Orchestrator and the message marker [kvb-orchestrator msg <id>]. install runs migrate first: it stops the old container, removes its image and code, moves state, approvals and pinned keys, swaps the MCP registration, the PermissionRequest hook and the runner unit, and changes nothing on a second run (scratch-HOME test with stub docker, claude and systemctl). Saved views fall back to the old localStorage key once.

MEDUSA acceptances carried to the renamed paths: 82 rows whose lines are unchanged (reason prefixed "renamed from <old path>, line unchanged"), and 7 rows whose text changed only in the product name, the package name, a temp prefix or a new class argument, each upheld by one kvb-think-criticize skeptic (approval.py:60, messaging.py:53, server.py:56, tests/hub_support.py:64, passkey.py:205, page-agent.js:75, language.py:46).

Cost 101 %: the longer name adds 15 tokens of skill text; the operator approved it with the commit.

🎯 Fix: 92 %
💥 Break: 4 %
💸 Cost: 101 %
⏱️ Time: –
🛡️ Security: 100 %
💰 Value: ?
🏆 Score: 87
🚦 Gate: ⚠️ cost 101 % > 100: ask the operator before the commit

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 22:20:06 +00:00

108 lines
3.2 KiB
Python

from __future__ import annotations
from pathlib import Path
from .council import agent
from .fields import ORDER_NAME
from .records import read_json, shown
REGISTER = "rasci.json"
OPERATOR = "operator/"
ENDED = ("done", "stopped")
def read_register(path: Path) -> dict[str, dict]:
data = read_json(path)
if not isinstance(data, dict):
return {}
return {task: row for task, row in data.items() if isinstance(row, dict)}
def status_of(row: dict) -> str:
if "status" not in row:
return "queued"
return str(row["status"])
def holders(row: dict, letter: str) -> str:
roles = row.get("roles")
if not isinstance(roles, dict):
return "-"
names = sorted((str(p) for p, v in roles.items() if isinstance(v, str) and letter in v), key=str.lower)
return shown(", ".join(names))
def parties(row: dict) -> dict[str, str]:
roles = row.get("roles")
if not isinstance(roles, dict):
return {}
found: dict[str, str] = {}
for party, letters in roles.items():
name = agent(party)
if name and isinstance(letters, str):
found[name] = found.get(name, "") + letters
return found
def is_open(task: str, row: dict, operator: bool) -> bool:
return task.startswith(OPERATOR) == operator and status_of(row) not in ENDED
def operator_rows(tasks: dict[str, dict]) -> list[dict]:
return [
{
"task": task,
"command": shown(row.get("title")),
"directory": shown(row.get("workdir")),
"why": shown(row.get("description")),
"check": shown(row.get("check")),
"status": status_of(row),
}
for task, row in sorted(tasks.items())
if is_open(task, row, True)
]
def runnable(row: dict) -> bool:
return row["command"] != "-" and row["directory"].startswith("/") and row["check"] != "decision"
def pinned(item: tuple[str, dict]) -> tuple[bool, int, str]:
task, row = item
prio = row.get("prio")
if isinstance(prio, int) and not isinstance(prio, bool):
return False, prio, task
return True, 0, task
def register_row(task: str, row: dict) -> dict:
results = row.get("key_results")
if not isinstance(results, list):
results = []
return {
"task": task,
"title": shown(row.get("title")),
"status": status_of(row),
"worker": shown(row.get("worker")),
"responsible": holders(row, "R"),
"accountable": holders(row, "A"),
"objective": shown(row.get("objective")),
"branch": shown(row.get("branch")),
"workdir": shown(row.get("workdir")),
"met": sum(1 for kr in results if isinstance(kr, dict) and kr.get("met") is True),
"total": len(results),
}
def register_rows(tasks: dict[str, dict]) -> list[dict]:
return [register_row(task, row) for task, row in sorted(tasks.items(), key=pinned) if is_open(task, row, False)]
def priority(tasks: dict[str, dict]) -> list[str]:
names: list[str] = []
for _, row in sorted(tasks.items(), key=pinned):
worker = row.get("worker")
if status_of(row) not in ENDED and isinstance(worker, str) and ORDER_NAME.fullmatch(worker) and worker not in names:
names.append(worker)
return names