From 770667ced94997b4f631b76d72a3be2c91d90422 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 11 Nov 2026 23:39:17 +0000 Subject: [PATCH] feat(orchestrator): 003 W6 speech bubbles at the agents in every view MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A toolbar toggle, a hub setting off by default, shows a speech bubble per agent anchored at its face in every view and at its projected node in 3D; an agent without an anchor speaks from a caption bar. The speaking agent's bubble is the largest and reveals its line word by word over the audio duration, or at 180 words a minute without TTS, a failed TTS request included; queued agents wait as smaller ellipsis bubbles sized by order, and a finished bubble fades out while the next one grows. Comic Neue 400 latin is vendored under SIL OFL 1.1 and loaded through the FontFace API, so the CSP stays unchanged. Residuals: the caption says speaking while bubbles run silently; the word reveal follows the wall clock, not the audio clock; the e2e suite runs once in the unify gate (operator order 2026-11-11 21:15), score gate exit 1 accepted under that order. ๐ŸŽฏ Fix: 82 % ๐Ÿ’ฅ Break: 5 % ๐Ÿ’ธ Cost: 100 % โฑ๏ธ Time: 100 % ๐Ÿ›ก๏ธ Security: 100 % ๐Ÿ† Score: 78 ๐Ÿšฆ Gate: โ›” fix 82 % < 90 Co-Authored-By: Claude Opus 5.5 --- README.md | 4 +- orchestrator/kvb_orchestrator/handler.py | 14 +- orchestrator/kvb_orchestrator/settings.py | 2 + orchestrator/templates/bubbles.js | 49 ++++ orchestrator/templates/index.html.j2 | 8 + orchestrator/templates/page-boot.js | 2 + orchestrator/templates/page-bubbles.js | 125 ++++++++++ orchestrator/templates/page-graph-layout.js | 1 + orchestrator/templates/page-radioview.js | 1 + orchestrator/templates/page-settings.js | 2 + orchestrator/templates/page-speech.js | 70 +++++- orchestrator/templates/page-state.js | 2 +- orchestrator/templates/style-bubbles.css | 19 ++ orchestrator/vendor/comic-neue/LICENSE | 93 ++++++++ .../comic-neue-latin-400-normal.woff2 | Bin 0 -> 19572 bytes tests/e2e/test_orchestrator_e2e.py | 4 +- tests/e2e/test_workbench_w6_e2e.py | 220 ++++++++++++++++++ tests/test_hub_bubbles.py | 188 +++++++++++++++ tests/test_hub_surface.py | 4 +- 19 files changed, 788 insertions(+), 20 deletions(-) create mode 100644 orchestrator/templates/bubbles.js create mode 100644 orchestrator/templates/page-bubbles.js create mode 100644 orchestrator/templates/style-bubbles.css create mode 100644 orchestrator/vendor/comic-neue/LICENSE create mode 100644 orchestrator/vendor/comic-neue/comic-neue-latin-400-normal.woff2 create mode 100644 tests/e2e/test_workbench_w6_e2e.py create mode 100644 tests/test_hub_bubbles.py diff --git a/README.md b/README.md index 8f31644..d38305e 100644 --- a/README.md +++ b/README.md @@ -435,9 +435,9 @@ Both commands also patch the target's `.claude/settings.local.json` โ€” the mach The global install also runs the Agent Orchestrator, a local review page in which the operator approves or rejects the agents' staged commits (the `kvb-git-diff` skill): it copies `orchestrator/` to `~/.local/share/kvb-orchestrator`, starts it there with `docker compose up -d --build` (restart `unless-stopped`, bound to `127.0.0.1` only, state in `~/.local/state/kvb-orchestrator`) and registers its MCP server for Claude Code at user scope. Its port is `KVB_ORCHESTRATOR_PORT` in `orchestrator/.env`; the hub page is `http://localhost:/`, the MCP endpoint `/mcp`. Without docker the hub is skipped and the commit skills ask in chat. The hub reads new radio traffic aloud in maritime phraseology and takes push-to-talk input; its image builds both engines from pinned, sha256-verified sources and runs each as a separate process: Piper (`piper-tts`, GPL-3.0-or-later) with the `en_US-libritts-high` voice (904 speakers, trained on LibriTTS, CC BY 4.0, from `rhasspy/piper-voices`) and whisper.cpp (MIT) with the multilingual `ggml-base-q8_0` model (OpenAI Whisper weights, MIT, 82 MB). The operator's own voice is `KVB_ORCHESTRATOR_OPERATOR_VOICE` in `orchestrator/.env`. Its Tree reads only the file `pkgmgr branch tree` writes: the install clones `PKGMGR_REPO` (default the GitHub repository, never the sandbox-writable local checkout), builds the newest `v*` tag a fully trusted GPG key signed into `~/.local/share/kvb-orchestrator/pkgmgr`, and enables the `kvb-orchestrator-tree.timer` user timer, which writes `~/.local/state/pkgmgr/tree/branch-tree.json` a minute after its previous run while the hub page polls, on at most half a core; the hub mounts that directory read-only and starts no git. A signed tag without `branch tree` leaves the timer off. -Stream โ†’ Radio (`#stream/radio`) is the hub's radio interface. Its station list shows one line per station, the full name in the tooltip, with its state and a play or stop button; when the browser blocks autoplay, the stream fails or the CSP refuses its origin, the row and a toast say so, and one click starts the station. New stations play daily around the clock. While the hub reads a message aloud, the speaking agent pulses there and in the Orbit and Chord views, under the caption " speaking" with the message's first line; under `prefers-reduced-motion` the ring stays still. The composer sends on all seven channels: post and call to one agent, newsletter, broadcast, pan-pan, security and mayday to all. "Record" records with MediaRecorder; the hub transcribes the recording with whisper.cpp off the request thread (at most 120 s of audio, a 120 s timeout, four at a time), keeps it for replay in `~/.local/state/kvb-orchestrator/voice` (the newest 50) and puts the transcript into the field to edit; the message goes out as text, with the recording's host path and sha256 only when "Attach recording" is ticked. The hub transcribes at most six recordings a minute and 600 s of audio an hour. Every operator message is passkey-signed, and the hub verifies the signature against the pinned keys, each once, before it relays; `operator_message(id, text, to)` answers `match` only for the signed text and recipient; for a denial the signature covers the recipient the inbox resolved at signing, and the answer's text is only the signed reason, never the agent's own words the radio row quotes. "Cancel mayday", Evening, Sunset, Sunrise and a settings save that adds a stream URL take the passkey the same way. +Stream โ†’ Radio (`#stream/radio`) is the hub's radio interface. Its station list shows one line per station, the full name in the tooltip, with its state and a play or stop button; when the browser blocks autoplay, the stream fails or the CSP refuses its origin, the row and a toast say so, and one click starts the station. New stations play daily around the clock. While the hub reads a message aloud, the speaking agent pulses there and in the Orbit and Chord views, under the caption " speaking" with the message's first line; under `prefers-reduced-motion` the ring stays still. The speech bubble icon in the header (a hub setting, kept across reloads) puts a bubble at each speaking agent in the Agents graph, 3D, Hierarchy, Radio and Stream views, or in a caption bar at the bottom when the view does not show that agent: the agent being read gets the largest bubble and its words appear in time with the audio, waiting messages show a smaller `โ€ฆ` bubble per agent, and without speech output the same rows run at 180 words a minute, at least 1.5 s each. The composer sends on all seven channels: post and call to one agent, newsletter, broadcast, pan-pan, security and mayday to all. "Record" records with MediaRecorder; the hub transcribes the recording with whisper.cpp off the request thread (at most 120 s of audio, a 120 s timeout, four at a time), keeps it for replay in `~/.local/state/kvb-orchestrator/voice` (the newest 50) and puts the transcript into the field to edit; the message goes out as text, with the recording's host path and sha256 only when "Attach recording" is ticked. The hub transcribes at most six recordings a minute and 600 s of audio an hour. Every operator message is passkey-signed, and the hub verifies the signature against the pinned keys, each once, before it relays; `operator_message(id, text, to)` answers `match` only for the signed text and recipient; for a denial the signature covers the recipient the inbox resolved at signing, and the answer's text is only the signed reason, never the agent's own words the radio row quotes. "Cancel mayday", Evening, Sunset, Sunrise and a settings save that adds a stream URL take the passkey the same way. -The hub page loads nothing from the network: its icons come from Bootstrap Icons 1.13.1 (`orchestrator/vendor/bootstrap-icons`, MIT), inlined per page as the symbols it uses, and its 3D views from `3d-force-graph` 1.80.1 and `three` 0.186.1 (`orchestrator/vendor`, MIT, served by the hub under `/vendor/`). In the Artifacts Tree, "Delete" on a `merged-clean` branch without skip reason, or "Delete all merged", shows the dry-run lines and asks for the passkey signature; the hub then writes a job (repository, branch, worktree and tip per item, no command) into `~/.local/state/kvb-orchestrator/cleanup/jobs`. The `kvb-orchestrator-cleanup.path` user unit runs `client/cleanup.py` on the host, which verifies the signature against the pinned keys, runs `pkgmgr branch cleanup --json --local --branch ` as a dry run in the repository, then `--apply` only when that plan names exactly the signed branch as `merged-clean` at the signed tip and worktree, refuses everything else unchanged, writes each result to `cleanup/results` and rewrites the tree file. The buttons stay disabled while the tree file says `delete_ready: false`. +The hub page loads nothing from the network: its icons come from Bootstrap Icons 1.13.1 (`orchestrator/vendor/bootstrap-icons`, MIT), inlined per page as the symbols it uses, and its 3D views from `3d-force-graph` 1.80.1 and `three` 0.186.1 (`orchestrator/vendor`, MIT, served by the hub under `/vendor/`); the speech bubbles use Comic Neue 400 latin from `@fontsource/comic-neue` 5.3.0 (`orchestrator/vendor/comic-neue`, SIL OFL 1.1), which the page fetches and adds through the FontFace API, so the CSP needs no `font-src`. In the Artifacts Tree, "Delete" on a `merged-clean` branch without skip reason, or "Delete all merged", shows the dry-run lines and asks for the passkey signature; the hub then writes a job (repository, branch, worktree and tip per item, no command) into `~/.local/state/kvb-orchestrator/cleanup/jobs`. The `kvb-orchestrator-cleanup.path` user unit runs `client/cleanup.py` on the host, which verifies the signature against the pinned keys, runs `pkgmgr branch cleanup --json --local --branch ` as a dry run in the repository, then `--apply` only when that plan names exactly the signed branch as `merged-clean` at the signed tip and worktree, refuses everything else unchanged, writes each result to `cleanup/results` and rewrites the tree file. The buttons stay disabled while the tree file says `delete_ready: false`. The Agents view "Hierarchy" draws the council's formal offices as a collapsible org chart: Operator, chair, dimensions with their line representatives, organisers (`cluster/`) and presidents (`work/`); the chair in every graph is the holder of the `chair` office, not a fixed name. Appointing, handing over or recalling an office there asks for the passkey signature; the hub writes a job (office, signed holder, successor session, work; no command) into `~/.local/state/kvb-orchestrator/offices/jobs`, and the `kvb-orchestrator-offices.path` user unit runs `client/offices.py` on the host, which verifies the signature, refuses a council directory others can write, a link on the path or a holder that changed since the signature. For a takeover or recall it moves the office aside and removes it only while the claim there still names the signed holder; an appoint or takeover then runs a plain `council.py claim ` for the successor by argv. council.py itself has no flag that overrides a live holder. The same view holds the operator's agent order as a drag list with up and down buttons: `rasci.py agents order` stores it in `agent-order.json` beside the register, where it breaks ties of equal task priority and orders the chair's grants without touching any task's `--prio` pin. diff --git a/orchestrator/kvb_orchestrator/handler.py b/orchestrator/kvb_orchestrator/handler.py index c272289..5b35909 100644 --- a/orchestrator/kvb_orchestrator/handler.py +++ b/orchestrator/kvb_orchestrator/handler.py @@ -41,8 +41,14 @@ OFFICES_ROUTE = "/api/offices" OFFICE_STATE = re.compile(r"/api/offices/([0-9a-f]{16})") TASKS_ROUTE = "/api/tasks" VENDOR_ROUTE = re.compile(r"/vendor/([a-z0-9.-]{1,64})") -VENDOR = {"3d-force-graph.min.js": "3d-force-graph/3d-force-graph.min.js", "three.module.js": "three/three.module.js", "three.core.js": "three/three.core.js"} SCRIPT_TYPE = "text/javascript; charset=utf-8" +FONT_TYPE = "font/woff2" +VENDOR = { + "3d-force-graph.min.js": ("3d-force-graph/3d-force-graph.min.js", SCRIPT_TYPE), + "three.module.js": ("three/three.module.js", SCRIPT_TYPE), + "three.core.js": ("three/three.core.js", SCRIPT_TYPE), + "comic-neue.woff2": ("comic-neue/comic-neue-latin-400-normal.woff2", FONT_TYPE), +} VOICE_ROUTE = "/api/voice" VOICE_ITEM = re.compile(r"/api/voice/([0-9a-f]{16})(\.wav)?") MESSAGE_SIGN_ROUTE = "/api/messages/sign" @@ -82,7 +88,7 @@ class Handler(Exchange): elif path == "/": self.index() elif vendored and vendored.group(1) in VENDOR: - self.vendored(VENDOR[vendored.group(1)]) + self.vendored(*VENDOR[vendored.group(1)]) elif voice and voice.group(2): self.replay_voice(voice.group(1)) elif voice: @@ -248,9 +254,9 @@ class Handler(Exchange): headers = {"Content-Security-Policy": csp, "X-Frame-Options": "DENY"} self.send(HTTPStatus.OK, "text/html; charset=utf-8", page.encode("utf-8"), headers) - def vendored(self, name: str) -> None: + def vendored(self, name: str, content_type: str) -> None: headers = {"Content-Security-Policy": PLAIN_CSP, "Cache-Control": "private, max-age=86400"} - self.attempt((self.server.hub.vendor / name).read_bytes, lambda data: self.send(HTTPStatus.OK, SCRIPT_TYPE, data, headers)) + self.attempt((self.server.hub.vendor / name).read_bytes, lambda data: self.send(HTTPStatus.OK, content_type, data, headers)) def stored(self, review_id: str, name: str) -> None: suffix, content_type, csp = STORED[name] diff --git a/orchestrator/kvb_orchestrator/settings.py b/orchestrator/kvb_orchestrator/settings.py index db89b0d..9e06ab4 100644 --- a/orchestrator/kvb_orchestrator/settings.py +++ b/orchestrator/kvb_orchestrator/settings.py @@ -49,6 +49,7 @@ SETTINGS = { }, "estimation": "none", "trend": {"mode": "off", "days": 7}, + "bubbles": False, } SPACE_AXES = ("none", "time", "spawn") SPACE_LIMITS = { @@ -220,6 +221,7 @@ def valid_settings(raw: object) -> dict: "space": space_setting(data["space"]), "estimation": data["estimation"], "trend": trend_setting(data["trend"]), + "bubbles": flag(data["bubbles"], "bubbles"), } diff --git a/orchestrator/templates/bubbles.js b/orchestrator/templates/bubbles.js new file mode 100644 index 0000000..99ea4ac --- /dev/null +++ b/orchestrator/templates/bubbles.js @@ -0,0 +1,49 @@ +const Bubbles = (() => { + "use strict"; + const SCALES = [1, 0.8, 0.65]; + const SMALLEST = 0.5; + const PACE = 180; + const SHORTEST = 1.5; + + function scale(position) { + return SCALES[position] ?? SMALLEST; + } + + function words(text) { + return String(text || "").split(/\s+/).filter(Boolean); + } + + function reading(count) { + return Math.max(SHORTEST, (count * 60) / PACE); + } + + function reveals(count, duration) { + return Array.from({length: count}, (_, index) => (index / count) * duration); + } + + function shown(count, duration, elapsed) { + return reveals(count, duration).filter((at) => at <= elapsed).length; + } + + function picked(row, speech) { + return row.class === "mayday" || speech.classes.includes(row.class); + } + + function plan(head, pending) { + const queue = head ? [head, ...pending] : pending; + const shift = head ? 0 : 1; + const seen = new Set(); + return queue.flatMap((item, index) => { + if (seen.has(item.who)) { + return []; + } + seen.add(item.who); + return [{who: item.who, item, scale: scale(index + shift)}]; + }); + } + + return {SCALES, SMALLEST, PACE, SHORTEST, scale, words, reading, reveals, shown, picked, plan}; +})(); +if (typeof module === "object" && module.exports) { + module.exports = Bubbles; +} diff --git a/orchestrator/templates/index.html.j2 b/orchestrator/templates/index.html.j2 index 7a459db..f3640e2 100644 --- a/orchestrator/templates/index.html.j2 +++ b/orchestrator/templates/index.html.j2 @@ -411,6 +411,8 @@ pre.notes { margin: 0; padding: 8px 10px; background: var(--sunken); border-radi {% include "style-ui.css" %} {% include "style-tasks.css" %} + +{% include "style-bubbles.css" %} @@ -421,6 +423,7 @@ pre.notes { margin: 0; padding: 8px 10px; background: var(--sunken); border-radi

Agent Orchestrator

+
@@ -442,6 +445,7 @@ pre.notes { margin: 0; padding: 8px 10px; background: var(--sunken); border-radi
+