Files
skills/orchestrator/kvb_orchestrator/hub.py
T
Kevin Veen-BirkenbachandClaude Opus 5.5 90c56cb786 feat(orchestrator): Agents and Artifacts views with spawn tree, orbit, 3D and signed branch deletes
Phase 4 of requirement 001. Agents and Artifacts each offer Orbit, Chord, Swimlane, Tree and 3D: the spawn tree (page-spawn.js) and the artifacts orbit (page-artifacts.js, kvb_orchestrator/artifacts.py) replace the "folgt" placeholders, 3D runs on the vendored 3d-force-graph and three.js (MIT, LICENSE files kept, served from the image under the unchanged CSP), and a Bootstrap Icons sprite (icons.py, MIT) replaces the emoji glyphs, also in the meditation page.

Signed branch deletes: the Tree view offers a delete only for merged-clean branches without a gc skip reason; the operator signs the exact item with the passkey, the hub writes a job without any command (kvb_orchestrator/cleanup.py), and the host path unit runs client/cleanup.py, which verifies the signature, dry-runs pkgmgr branch cleanup for that exact branch, refuses patterns, option names, changed tips, other worktrees and plans naming other branches, deletes, and rewrites the branch tree. pkgmgr runs with core.hooksPath=/dev/null, core.fsmonitor=false and the config hook events disabled through GIT_CONFIG_COUNT, because the cwd is a repository agents can write and pkgmgr releases before 4c8b137 delete without scan mode (test with a positive control that both hook kinds fire without it).

3D labels go into the tooltip as a text node: the vendored tooltip renders a string label as HTML.

Tests: 503 OK, Chromium (CDP) and Firefox (BiDi) walks over every screen at three widths.

MEDUSA acceptances (kvb-think-criticize skeptic 2026-11-07): WEB-FLASK-004 view.py:135 (file template, autoescape on, state via tojson), MEDUSA-MM-SCAN-058 server.py:69/:85 (substring pla in --templates and Places), RH005 client/cleanup.py:199 (raise SystemExit(main())), B704 icons.py:45 (sprite baked into the image, names checked against it), EXA002 page-artifacts.js:221 (openAgent only opens the drawer), STG002 page-constants.js:64 (U+2212 in a static label), PL002 page-graph3d.js:44 (CSS class space-tools; the real tooltip sink fixed), B603 client/cleanup.py:75 (argv without shell; hook hole closed).

🎯 Fix: 92 %
💥 Break: 5 %
💸 Cost: 100 %
⏱️ Time: –
🛡️ Security: 100 %
🏆 Score: 87
🚦 Gate: ✅ 90/5, cost and time <= 100, security 100 %

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 15:03:14 +00:00

131 lines
3.7 KiB
Python

from __future__ import annotations
import threading
from dataclasses import dataclass
from pathlib import Path
import jinja2
from markupsafe import Markup
from .approving import Approving
from .artifacts import Touched
from .asking import Asking
from .batches import Pending
from .cleanup import Cleaning, Spool
from .engines import Engines, Speech
from .events import Log, Watch
from .icons import sheet
from .inbox import Inbox
from .jobs import Jobs
from .language import Language, Model
from .ledger import Ledger, Marks, Reviews
from .mcp import Mcp
from .messaging import Messaging
from .names import Names
from .reviewing import Reviewing
from .rules import Rules
from .settings import Settings
from .signed import signing
from .skill_scripts import Runner
from .sources import Sources
from .timeline import Timeline
from .transcripts import Transcripts
from .tree import TREE_HEARTBEAT, Tree
from .view import View
@dataclass(frozen=True)
class Places:
tree_file: Path
timers: Path
vendor: Path
cleanup: Path
def environment(templates: Path) -> jinja2.Environment:
env = jinja2.Environment(
loader=jinja2.FileSystemLoader(templates),
autoescape=True,
undefined=jinja2.StrictUndefined,
trim_blocks=True,
lstrip_blocks=True,
)
env.policies["json.dumps_kwargs"] = {"sort_keys": False}
return env
@dataclass(frozen=True)
class Hub(Mcp, Reviewing, Asking, Messaging, Approving, Cleaning, Inbox, Rules, Jobs, Sources, Timeline, View, Language):
council: Path
pages: Path
public_port: int
reviews: Reviews
asks: Ledger
decisions: Ledger
messages: Ledger
uploads: Path
host_state: Path
transcripts: Transcripts
scripts: Runner
templates: jinja2.Environment
rules: Ledger
jobs: Ledger
marks: Marks
log: Log
batches: Pending
names: Names
watch: Watch
tree: Tree
model: Model
timers: Path
settings: Settings
speech: Speech
approvers: Path
vendor: Path
icons: Markup
spool: Spool
touched: Touched
def hosts(self) -> tuple[str, str]:
return f"127.0.0.1:{self.public_port}", f"localhost:{self.public_port}"
def url(self) -> str:
return f"{signing.origin_of(self.public_port)}/"
def open_hub(council: Path, pages: Path, public_port: int, state: Path, host_state: Path, transcripts: Path, scripts: Runner, templates: Path, places: Places, model: Model, engines: Engines, approvers: Path) -> Hub:
uploads = state / "uploads"
uploads.mkdir(exist_ok=True)
reviews = Reviews(state)
return Hub(
vendor=places.vendor,
icons=sheet(places.vendor, templates),
spool=Spool(places.cleanup).ready(),
touched=Touched(reviews.stored),
approvers=approvers,
speech=Speech(engines, state / "tts"),
rules=Ledger(state / "rules.json"),
jobs=Ledger(state / "jobs.json"),
marks=Marks(state / "marks.json"),
log=Log(state / "log.jsonl"),
batches=Pending(),
names=Names(state / "names.json"),
settings=Settings(state / "settings.json"),
watch=Watch(),
tree=Tree(file=places.tree_file, heartbeat=state / TREE_HEARTBEAT, lock=threading.Lock(), cached=None, stamp=None),
model=model,
timers=places.timers,
council=council,
pages=pages,
public_port=public_port,
reviews=reviews,
asks=Ledger(state / "asks.json"),
decisions=Ledger(state / "decisions.json"),
messages=Ledger(state / "messages.json"),
uploads=uploads,
host_state=host_state,
transcripts=Transcripts(transcripts),
scripts=scripts,
templates=environment(templates),
)