Skip to content
Python

Card gallery (dev only): card states, scenario sessions, server contract check

Rohit C Prasad2be346d7ddb6
diff --git a/surfaces/gui/.gitignore b/surfaces/gui/.gitignore
index 053870b6..c488cb09 100644
--- a/surfaces/gui/.gitignore
+++ b/surfaces/gui/.gitignore
@@ -7,3 +7,7 @@ dist/
/test-results/
/playwright-report/
/e2e/_dbg.png
+
+# Scenarios exported from real runs (scripts/export-scenario.py) stay on this machine:
+# scrubbed, but still someone's real session. Hand-written scenarios are committed.
+src/gallery/scenarios/real-*.json
diff --git a/surfaces/gui/scripts/export-scenario.py b/surfaces/gui/scripts/export-scenario.py
new file mode 100755
index 00000000..6156a28a
--- /dev/null
+++ b/surfaces/gui/scripts/export-scenario.py
@@ -0,0 +1,166 @@
+#!/usr/bin/env python3
+"""Save one real session as a card-gallery scenario (dev tooling; stdlib only).
+
+ export-scenario.py <session_id> --id lead-issue-3 --title "SWE Lead · issue #3"
+ [--base http://127.0.0.1:8765/v1] [--token-file PATH] [--note TEXT]
+ [--out src/gallery/scenarios] [--max-tool-chars 1200] [--replace OLD=NEW ...]
+
+Reads the session row, its workers, the stored transcript, the pending Inbox items and
+the board from a running server (`--base` is the API root up to and including /v1; for a
+session on a joined machine, pass that machine's proxy root). The token, when one is
+needed, is read from a FILE so it never appears in argv or shell history.
+
+What is written is scrubbed: secrets and bearer tokens, email addresses, home
+directories, AWS account ids, and long tool output (truncated). The session id is
+replaced by a scenario-local one. `scenarios.test.ts` re-checks every file, so a leak
+fails the unit tests too. Exports are for THIS machine: name them `real-…` and they are
+gitignored (`src/gallery/scenarios/real-*.json`). Scrubbing catches patterns, not meaning,
+so a real session is never committed; write a hand-made scenario for anything shared.
+"""
+import argparse
+import json
+import os
+import re
+import sys
+import urllib.parse
+import urllib.request
+
+SECRET_PATTERNS = [
+ (re.compile(r"sk-[A-Za-z0-9_-]{16,}"), "sk-REDACTED"),
+ (re.compile(r"gh[pousr]_[A-Za-z0-9]{20,}"), "gh_REDACTED"),
+ (re.compile(r"github_pat_[A-Za-z0-9_]{20,}"), "gh_REDACTED"),
+ (re.compile(r"xox[abpr]-[A-Za-z0-9-]{10,}"), "xox-REDACTED"),
+ (re.compile(r"AKIA[0-9A-Z]{16}"), "AKIAREDACTED"),
+ (re.compile(r"(?i)(bearer\s+)[A-Za-z0-9._~+/=-]{20,}"), r"\1REDACTED"),
+ (re.compile(r"eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}"), "JWT_REDACTED"),
+ (re.compile(r"(?i)((?:password|passwd|secret|api[_-]?key|token)\"?\s*[:=]\s*\"?)[^\s\"',}]{8,}"), r"\1REDACTED"),
+ (re.compile(r"-----BEGIN [A-Z ]*PRIVATE KEY-----.*?-----END [A-Z ]*PRIVATE KEY-----", re.S), "PRIVATE_KEY_REDACTED"),
+]
+EMAIL = re.compile(r"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}")
+HOME = re.compile(r"/(?:Users|home)/[A-Za-z0-9._-]+")
+AWS_ACCOUNT = re.compile(r"(?<![0-9])[0-9]{12}(?![0-9])")
+
+
+def scrub_text(text: str) -> str:
+ for pattern, repl in SECRET_PATTERNS:
+ text = pattern.sub(repl, text)
+ text = EMAIL.sub("[email protected]", text)
+ text = HOME.sub("/home/user", text)
+ return AWS_ACCOUNT.sub("123456789012", text)
+
+
+def scrub(value):
+ if isinstance(value, str):
+ return scrub_text(value)
+ if isinstance(value, list):
+ return [scrub(v) for v in value]
+ if isinstance(value, dict):
+ return {k: scrub(v) for k, v in value.items()}
+ return value
+
+
+def main() -> int:
+ ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
+ ap.add_argument("session_id")
+ ap.add_argument("--id", required=True, help="scenario id (file name and URL slug)")
+ ap.add_argument("--title", required=True)
+ ap.add_argument("--note", default="")
+ ap.add_argument("--base", default="http://127.0.0.1:8765/v1")
+ ap.add_argument("--token-file", default="")
+ ap.add_argument("--out", default=os.path.join(os.path.dirname(__file__), "..", "src", "gallery", "scenarios"))
+ ap.add_argument("--max-tool-chars", type=int, default=1200)
+ ap.add_argument("--replace", action="append", default=[], metavar="OLD=NEW",
+ help="replace a name everywhere (a GitHub handle, a customer); repeatable")
+ args = ap.parse_args()
+ if not re.fullmatch(r"[a-z0-9-]+", args.id):
+ ap.error("--id must be lowercase letters, digits and dashes")
+ if not args.id.startswith("real-"):
+ args.id = "real-" + args.id # the gitignored prefix: an export never gets committed
+
+ headers = {}
+ if args.token_file:
+ with open(os.path.expanduser(args.token_file)) as fh:
+ headers["Authorization"] = "Bearer " + fh.read().rstrip()
+
+ def get(path: str, default=None):
+ try:
+ req = urllib.request.Request(args.base.rstrip("/") + path, headers=headers)
+ return json.load(urllib.request.urlopen(req, timeout=60))
+ except Exception as exc: # noqa: BLE001 - optional endpoints may be missing on older servers
+ if default is None:
+ raise SystemExit(f"GET {path} failed: {exc}")
+ return default
+
+ sid = args.session_id
+ quoted = urllib.parse.quote(sid)
+ rows = get("/sessions")
+ rows = rows if isinstance(rows, list) else rows.get("sessions", [])
+ row = next((s for s in rows if s.get("session_id") == sid), None)
+ if row is None:
+ raise SystemExit(f"no session {sid} on {args.base}")
+ workers = [s for s in rows if (s.get("team") or {}).get("lead_session") == sid]
+ messages = get(f"/sessions/{quoted}/messages").get("messages", [])
+ pending = get(f"/inbox?state=pending&session_id={quoted}", {"items": []}).get("items", [])
+ board = get(f"/sessions/{quoted}/board", {})
+ unattended = get(f"/sessions/{quoted}/unattended", {}).get("unattended")
+
+ for m in messages: # tool output is the bulk of a transcript and the likeliest leak
+ if m.get("role") == "tool" and isinstance(m.get("content"), str) and len(m["content"]) > args.max_tool_chars:
+ cut = len(m["content"]) - args.max_tool_chars
+ m["content"] = m["content"][: args.max_tool_chars] + f"\n… [{cut} characters cut by export-scenario]"
+
+ local_sid = "scn-" + args.id
+ team = row.get("team") or {}
+ scenario = {
+ "id": args.id,
+ "title": args.title,
+ "note": args.note,
+ "exported": {"from_session": sid[:8] + "…", "messages": len(messages)},
+ "session": {
+ "session_id": local_sid,
+ "title": row.get("title") or "",
+ "agent": row.get("agent") or "",
+ "model": row.get("model") or "",
+ "mode": row.get("mode") or "interactive",
+ "workspace": row.get("workspace") or "",
+ # No answer (older server): a session with parked items is, in effect, unattended.
+ "unattended": bool(unattended) if unattended is not None else bool(pending),
+ },
+ "messages": messages,
+ "pending": pending,
+ }
+ if workers:
+ scenario["team"] = {
+ "team_id": team.get("team_id") or "team",
+ "chat_enabled": bool(team.get("chat_enabled")),
+ "workers": [
+ {
+ "name": (w.get("team") or {}).get("actor") or w.get("title") or "worker",
+ "persona": w.get("agent") or "",
+ "model": w.get("model") or "",
+ "status": (w.get("team") or {}).get("status") or "idle",
+ "current_item": (w.get("team") or {}).get("current_item") or "",
+ "usage": w.get("usage") or {},
+ }
+ for w in workers
+ ],
+ }
+ if isinstance(board, dict) and board.get("items"):
+ scenario["board"] = board
+
+ # The real session id appears inside items, board rows and sometimes tool output.
+ text = json.dumps(scrub(scenario), indent=2, ensure_ascii=False).replace(sid, local_sid)
+ for pair in args.replace:
+ old, _, new = pair.partition("=")
+ if old:
+ text = text.replace(old, new)
+ out = os.path.join(args.out, args.id + ".json")
+ with open(out, "w") as fh:
+ fh.write(text + "\n")
+ print(f"wrote {os.path.normpath(out)}: {len(messages)} messages, {len(pending)} pending, {len(workers)} workers")
+ print("Gitignored (real-*.json): it stays on this machine.")
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/surfaces/gui/scripts/gallery-contract.write.test.ts b/surfaces/gui/scripts/gallery-contract.write.test.ts
new file mode 100644
index 00000000..f8d7aaa5
--- /dev/null
+++ b/surfaces/gui/scripts/gallery-contract.write.test.ts
@@ -0,0 +1,12 @@
+// Writer for src/gallery/states.contract.json. A vitest file so it can import the TypeScript
+// state files directly; it does nothing unless asked: npm run gallery:contract
+import { writeFileSync } from "node:fs";
+import path from "node:path";
+import { it } from "vitest";
+
+import { buildContract } from "../src/gallery/contract";
+
+it.skipIf(process.env.UPDATE_CONTRACT !== "1")("writes states.contract.json", () => {
+ const file = path.join(__dirname, "..", "src", "gallery", "states.contract.json");
+ writeFileSync(file, JSON.stringify(buildContract(), null, 2) + "\n");
+});
diff --git a/surfaces/gui/src/gallery/Gallery.tsx b/surfaces/gui/src/gallery/Gallery.tsx
new file mode 100644
index 00000000..73f7b165
--- /dev/null
+++ b/surfaces/gui/src/gallery/Gallery.tsx
@@ -0,0 +1,353 @@
+// Card gallery — a dev-only page (/#/gallery) that renders every tool-call card in every
+// named state from the payload files under states/, with no server, socket or model.
+// Spec: ocw-context/docs/card-gallery-spec.md. Loaded lazily from main.tsx behind
+// import.meta.env.DEV, so none of this ships in the desktop build.
+import { useEffect, useMemo, useState } from "react";
+import { InboxItemCard } from "../components/InboxItemCard";
+import { CARDS, GALLERY_MODEL_LABELS, GROUPS, type CardDef } from "./cards";
+import { inboxItemBuilders } from "./inboxItems";
+import { SCENARIOS, scenarioUrl } from "./scenarios";
+import "./gallery.css";
+
+type Place = "session" | "inbox";
+type Theme = "light" | "dark";
+type TextSize = "small" | "default" | "large";
+type Width = "wide" | "narrow";
+
+interface Route {
+ card: string;
+ state: string;
+ place: Place;
+}
+
+function parseHash(hash: string): Route {
+ const m = hash.match(/^#\/gallery(?:\/([\w-]+))?(?:\/([\w-]+))?(?:\?(.*))?$/);
+ const params = new URLSearchParams(m?.[3] ?? "");
+ return { card: m?.[1] ?? "", state: m?.[2] ?? "", place: params.get("place") === "inbox" ? "inbox" : "session" };
+}
+
+function hashFor(r: Route): string {
+ return `#/gallery/${r.card}/${r.state}${r.place === "inbox" ? "?place=inbox" : ""}`;
+}
+
+interface Sent {
+ at: string;
+ channel: string;
+ body: unknown;
+}
+
+function Segmented<T extends string>({
+ label,
+ value,
+ options,
+ onChange,
+}: {
+ label: string;
+ value: T;
+ options: { value: T; label: string }[];
+ onChange: (v: T) => void;
+}) {
+ return (
+ <div className="gal-seg" role="group" aria-label={label}>
+ <span className="gal-seg-label">{label}</span>
+ {options.map((o) => (
+ <button
+ key={o.value}
+ className={"gal-seg-btn" + (o.value === value ? " on" : "")}
+ data-testid={`gallery-${label.toLowerCase()}-${o.value}`}
+ onClick={() => onChange(o.value)}
+ >
+ {o.label}
+ </button>
+ ))}
+ </div>
+ );
+}
+
+export function Gallery() {
+ const [route, setRoute] = useState<Route>(() => parseHash(window.location.hash));
+ const [theme, setTheme] = useState<Theme>(() =>
+ document.documentElement.dataset.theme === "dark" ? "dark" : "light",
+ );
+ const [textSize, setTextSize] = useState<TextSize>(
+ () => (document.documentElement.dataset.textSize as TextSize) || "default",
+ );
+ const [width, setWidth] = useState<Width>("wide");
+ const [sent, setSent] = useState<Sent[]>([]);
+ const [showPayload, setShowPayload] = useState(false);
+ const [copied, setCopied] = useState(false);
+ // Cards keep their own state (ticks, expanders); bumping this remounts a fresh one.
+ const [nonce, setNonce] = useState(0);
+
+ useEffect(() => {
+ const onHash = () => setRoute(parseHash(window.location.hash));
+ window.addEventListener("hashchange", onHash);
+ return () => window.removeEventListener("hashchange", onHash);
+ }, []);
+
+ // Applied straight to <html>, never saved: the gallery must not change the app's own
+ // appearance preferences.
+ useEffect(() => {
+ document.documentElement.dataset.theme = theme;
+ }, [theme]);
+ useEffect(() => {
+ if (textSize === "default") delete document.documentElement.dataset.textSize;
+ else document.documentElement.dataset.textSize = textSize;
+ }, [textSize]);
+
+ const onScenarios = route.card === "scenarios";
+ const card: CardDef = CARDS.find((c) => c.id === route.card) ?? CARDS[0];
+ const state = card.states.find((s) => s.id === route.state) ?? card.states[0];
+ const toInbox = inboxItemBuilders[card.id];
+ const place: Place = route.place === "inbox" && toInbox ? "inbox" : "session";
+
+ const go = (next: Partial<Route>) => {
+ const r = { card: card.id, state: state.id, place, ...next };
+ if (next.card && next.card !== card.id && !next.state)
+ r.state = (CARDS.find((c) => c.id === next.card) ?? card).states[0].id;
+ window.location.hash = hashFor(r);
+ };
+
+ // A new card, state or place starts with an empty response panel and a fresh card.
+ useEffect(() => {
+ setSent([]);
+ setCopied(false);
+ }, [card.id, state.id, place]);
+
+ const record = (channel: string, body: unknown) =>
+ setSent((p) => [{ at: new Date().toLocaleTimeString(), channel, body }, ...p]);
+
+ const stage = useMemo(() => {
+ if (place === "inbox" && toInbox) {
+ const item = toInbox(state);
+ return (
+ <div className="max-w-4xl mx-auto px-7 py-6">
+ <InboxItemCard
+ item={item}
+ modelLabels={GALLERY_MODEL_LABELS}
+ onResolve={(id, resolution) => {
+ let parsed: unknown = resolution;
+ try {
+ parsed = JSON.parse(resolution);
+ } catch {
+ /* plain-string resolutions ("allow", "deny") stay strings */
+ }
+ record(`POST /v1/inbox/${id}/resolve · resolution${typeof parsed === "string" ? "" : " (a JSON string, parsed here)"}`, parsed);
+ }}
+ />
+ </div>
+ );
+ }
+ const inline = card.renderInline(state, (message, note) => record(note ?? "websocket message", message));
+ // Message cards live in the transcript column; everything else docks above the composer.
+ return card.stage === "transcript" ? (
+ <div className="px-6 py-5">
+ <div className="transcript">{inline}</div>
+ </div>
+ ) : (
+ <div className="composer-wrap px-6 pb-5 pt-4">{inline}</div>
+ );
+ // `nonce` is a dependency on purpose: Reset rebuilds the element so the key below remounts it.
+ }, [card, state, place, toInbox, nonce]);
+
+ const copyLink = async () => {
+ try {
+ await navigator.clipboard.writeText(window.location.origin + window.location.pathname + hashFor({ card: card.id, state: state.id, place }));
+ setCopied(true);
+ setTimeout(() => setCopied(false), 1500);
+ } catch {
+ /* clipboard blocked — the address bar has the same link */
+ }
+ };
+
+ return (
+ <div className="gal" data-testid="gallery">
+ <aside className="gal-rail">
+ <div className="gal-brand">
+ Card gallery <span className="gal-dev">dev only</span>
+ </div>
+ {GROUPS.map((g) => {
+ const cards = CARDS.filter((c) => c.group === g);
+ if (!cards.length) return null;
+ return (
+ <div key={g} className="gal-group">
+ <div className="gal-group-title">{g}</div>
+ {cards.map((c) => (
+ <button
+ key={c.id}
+ className={"gal-nav" + (!onScenarios && c.id === card.id ? " on" : "")}
+ data-testid={`gallery-card-${c.id}`}
+ onClick={() => go({ card: c.id, state: "" })}
+ >
+ <span>{c.title}</span>
+ <span className="gal-count">{c.states.length}</span>
+ </button>
+ ))}
+ </div>
+ );
+ })}
+ <div className="gal-group">
+ <div className="gal-group-title">Sessions</div>
+ <button
+ className={"gal-nav" + (onScenarios ? " on" : "")}
+ data-testid="gallery-scenarios"
+ onClick={() => (window.location.hash = "#/gallery/scenarios")}
+ >
+ <span>Scenarios</span>
+ <span className="gal-count">{SCENARIOS.length}</span>
+ </button>
+ </div>
+ </aside>
+
+ {onScenarios ? (
+ <main className="gal-main" data-testid="gallery-scenario-list">
+ <h1 className="gal-title">Scenarios</h1>
+ <div className="gal-sub">
+ A saved moment of a session: transcript, waiting cards and rail. Opens the real app against an
+ in-memory API — no server, no model. Files: <code>src/gallery/scenarios/*.json</code>
+ </div>
+ {SCENARIOS.map((s) => (
+ <a key={s.id} className="gal-scn" href={scenarioUrl(s)} data-testid={`gallery-scenario-${s.id}`}>
+ <div className="gal-scn-title">{s.title}</div>
+ {s.note && <div className="gal-state-note">{s.note}</div>}
+ <div className="gal-scn-meta">
+ {s.session.agent} · {s.session.mode} · {s.session.unattended ? "approvals to the Inbox" : "attended"} ·{" "}
+ {s.messages.length} messages
+ {s.team ? ` · ${s.team.workers.length} workers` : ""}
+ </div>
+ </a>
+ ))}
+ </main>
+ ) : (
+ <main className="gal-main">
+ <header className="gal-top">
+ <div>
+ <h1 className="gal-title">{card.title}</h1>
+ <div className="gal-sub">
+ raised by <code>{card.event}</code>
+ </div>
+ </div>
+ <div className="gal-toggles">
+ {toInbox && (
+ <Segmented
+ label="Place"
+ value={place}
+ options={[
+ { value: "session", label: "In the session" },
+ { value: "inbox", label: "In the Inbox" },
+ ]}
+ onChange={(v) => go({ place: v })}
+ />
+ )}
+ <Segmented
+ label="Width"
+ value={width}
+ options={[
+ { value: "wide", label: "Wide" },
+ { value: "narrow", label: "Narrow" },
+ ]}
+ onChange={setWidth}
+ />
+ <Segmented
+ label="Text"
+ value={textSize}
+ options={[
+ { value: "small", label: "S" },
+ { value: "default", label: "M" },
+ { value: "large", label: "L" },
+ ]}
+ onChange={setTextSize}
+ />
+ <Segmented
+ label="Theme"
+ value={theme}
+ options={[
+ { value: "light", label: "Light" },
+ { value: "dark", label: "Dark" },
+ ]}
+ onChange={setTheme}
+ />
+ </div>
+ </header>
+
+ <div className="gal-states" role="tablist" aria-label="States">
+ {card.states.map((s) => (
+ <button
+ key={s.id}
+ role="tab"
+ aria-selected={s.id === state.id}
+ className={"gal-chip" + (s.id === state.id ? " on" : "")}
+ data-testid={`gallery-state-${s.id}`}
+ onClick={() => go({ state: s.id })}
+ >
+ {s.title}
+ </button>
+ ))}
+ </div>
+
+ <div className="gal-state-line">
+ <span className="gal-state-note">{state.note || " "}</span>
+ <span className="gal-state-actions">
+ <button className="gal-link" onClick={() => setNonce((n) => n + 1)} data-testid="gallery-reset">
+ Reset card
+ </button>
+ <button className="gal-link" onClick={copyLink} data-testid="gallery-copy-link">
+ {copied ? "Copied" : "Copy link"}
+ </button>
+ </span>
+ </div>
+
+ <div className={"gal-stage-wrap " + width}>
+ <div className="gal-stage" data-testid="gallery-stage" key={`${card.id}/${state.id}/${place}/${nonce}`}>
+ {stage}
+ </div>
+ </div>
+
+ <section className="gal-panel">
+ <div className="gal-panel-head">
+ <span>What the card sends</span>
+ {sent.length > 0 && (
+ <button className="gal-link" onClick={() => setSent([])}>
+ Clear
+ </button>
+ )}
+ </div>
+ {sent.length === 0 ? (
+ <div className="gal-empty">
+ {card.stage === "transcript"
+ ? "This card is read-only: it sends nothing."
+ : "Click a button on the card. Nothing leaves this page."}
+ </div>
+ ) : (
+ <div data-testid="gallery-response">
+ {sent.map((s, i) => (
+ <div key={i} className="gal-sent">
+ <div className="gal-sent-head">
+ <span>{s.channel}</span>
+ <span>{s.at}</span>
+ </div>
+ {s.body !== null && <pre className="gal-json">{JSON.stringify(s.body, null, 2)}</pre>}
+ </div>
+ ))}
+ </div>
+ )}
+ </section>
+
+ <section className="gal-panel">
+ <div className="gal-panel-head">
+ <button className="gal-link" onClick={() => setShowPayload((v) => !v)} data-testid="gallery-payload-toggle">
+ {showPayload ? "Hide" : "Show"} the payload the server sends
+ </button>
+ <code className="gal-file">src/gallery/states/{card.id}.ts</code>
+ </div>
+ {showPayload && (
+ <pre className="gal-json" data-testid="gallery-payload">
+ {JSON.stringify(place === "inbox" && toInbox ? toInbox(state) : state.payload, null, 2)}
+ </pre>
+ )}
+ </section>
+ </main>
+ )}
+ </div>
+ );
+}
diff --git a/surfaces/gui/src/gallery/ScenarioBadge.tsx b/surfaces/gui/src/gallery/ScenarioBadge.tsx
new file mode 100644
index 00000000..25c24035
--- /dev/null
+++ b/surfaces/gui/src/gallery/ScenarioBadge.tsx
@@ -0,0 +1,39 @@
+// The small floating panel shown over the app while a scenario is open: what this moment
+// is, the way back to the gallery, and what the app tried to send (nothing is delivered).
+import { useState } from "react";
+import type { SentRecord } from "./scenarioApi";
+import type { Scenario } from "./scenarios/types";
+import "./gallery.css";
+
+export function ScenarioBadge({ scenario, sent }: { scenario: Scenario; sent: SentRecord[] }) {
+ const [open, setOpen] = useState(false);
+ return (
+ <div className={"gal-badge" + (open ? " open" : "")} data-testid="scenario-badge">
+ <button className="gal-badge-pill" onClick={() => setOpen((o) => !o)} data-testid="scenario-sent-toggle">
+ <span className="gal-dev">scenario</span>
+ <span>{sent.length ? `sent ${sent.length}` : "nothing sent"}</span>
+ </button>
+ {open && (
+ <div className="gal-badge-body" data-testid="scenario-sent">
+ <div className="gal-badge-line">
+ <span className="gal-badge-title">{scenario.title}</span>
+ <a className="gal-link" href={`${window.location.pathname}#/gallery/scenarios`}>
+ Back to gallery
+ </a>
+ </div>
+ {scenario.note && <div className="gal-state-note">{scenario.note}</div>}
+ {sent.length === 0 && <div className="gal-empty">Answer a card; what the app sends is printed here.</div>}
+ {sent.map((s, i) => (
+ <div key={i} className="gal-sent">
+ <div className="gal-sent-head">
+ <span>{s.channel}</span>
+ <span>{s.at}</span>
+ </div>
+ <pre className="gal-json">{JSON.stringify(s.body, null, 2)}</pre>
+ </div>
+ ))}
+ </div>
+ )}
+ </div>
+ );
+}
diff --git a/surfaces/gui/src/gallery/cards.tsx b/surfaces/gui/src/gallery/cards.tsx
new file mode 100644
index 00000000..a03a0396
--- /dev/null
+++ b/surfaces/gui/src/gallery/cards.tsx
@@ -0,0 +1,214 @@
+// The gallery's card registry: which cards exist, their states, and how the app renders
+// each one inline. The render functions use the SAME payload helpers and components the
+// session view uses (cardPayloads.ts) — nothing here is a copy of a card.
+import type { ReactNode } from "react";
+import type { MessageSource } from "../api";
+import {
+ approvalItemFromPayload,
+ approvalMessage,
+ connectorItemFromPayload,
+ connectorResponseMessage,
+ directoryItemFromPayload,
+ directoryResponseMessage,
+ itemsResponseMessage,
+ liveQuestionInboxItem,
+ planItemFromPayload,
+ planResponseMessage,
+ questionItemFromPayload,
+ questionResponseMessage,
+ teamItemFromPayload,
+ teamResponseMessage,
+ toolItemFromPayload,
+ toolResponseMessage,
+ workItemsItemFromPayload,
+} from "../cardPayloads";
+import { ApprovalCard } from "../components/ApprovalCard";
+import { BoardWakeCard } from "../components/BoardWakeCard";
+import { ConnectorMessageCard } from "../components/ConnectorMessageCard";
+import { ConnectorRequestCard } from "../components/ConnectorRequestCard";
+import { DirectoryRequestCard } from "../components/DirectoryRequestCard";
+import { InboxItemCard } from "../components/InboxItemCard";
+import { PlanCard } from "../components/PlanCard";
+import { TeamRequestCard } from "../components/TeamRequestCard";
+import { ToolRequestCard } from "../components/ToolRequestCard";
+import { WorkItemsCard } from "../components/WorkItemsCard";
+import { STATES } from "./states";
+import type { CardState } from "./types";
+
+// What /v1/settings.model_labels looks like in the app; the gallery passes it where the app does.
+export const GALLERY_MODEL_LABELS: Record<string, string> = {
+ "anthropic:claude-opus-4-8": "Claude Opus 4.8 · Anthropic",
+ "anthropic:claude-sonnet-4-8": "Claude Sonnet 4.8 · Anthropic",
+ "openai:gpt-5.2": "GPT-5.2 · OpenAI",
+};
+
+export type CardGroup = "Approvals" | "Team" | "Requests" | "Messages";
+export const GROUPS: CardGroup[] = ["Approvals", "Team", "Requests", "Messages"];
+
+export interface CardDef {
+ id: string;
+ title: string;
+ group: CardGroup;
+ /** The websocket event that raises the card inline. */
+ event: string;
+ states: CardState<any>[];
+ /** Where the app puts the card: docked above the composer (default) or in the transcript. */
+ stage?: "dock" | "transcript";
+ /** `send` receives the websocket message the app would send for this click. */
+ renderInline: (state: CardState<any>, send: (message: unknown, note?: string) => void) => ReactNode;
+}
+
+export const CARDS: CardDef[] = [
+ {
+ id: "approval",
+ title: "Approval",
+ group: "Approvals",
+ event: "permission_required",
+ states: STATES.approval,
+ renderInline: (s, send) => (
+ <ApprovalCard
+ item={approvalItemFromPayload(s.payload)}
+ onApprove={(decision) => send(approvalMessage(decision))}
+ runTask={s.context?.runTask ?? null}
+ autoApprove={s.context?.mode === "auto-approve"}
+ compact
+ />
+ ),
+ },
+ {
+ id: "plan",
+ title: "Plan",
+ group: "Approvals",
+ event: "plan_proposed",
+ states: STATES.plan,
+ renderInline: (s, send) => (
+ <PlanCard
+ item={planItemFromPayload(s.payload)}
+ onRespond={(approved, mode, feedback) => send(planResponseMessage(approved, mode, feedback))}
+ />
+ ),
+ },
+ {
+ id: "team-request",
+ title: "Team staffing",
+ group: "Team",
+ event: "team_proposed",
+ states: STATES["team-request"],
+ renderInline: (s, send) => (
+ <TeamRequestCard
+ item={teamItemFromPayload(s.payload)}
+ // In the app this is the composer's mode, which for a lead matches the payload.
+ leadMode={s.context?.mode ?? (typeof s.payload.lead_mode === "string" ? s.payload.lead_mode : undefined)}
+ modelLabels={GALLERY_MODEL_LABELS}
+ onRespond={(approved, feedback, enableChat, members) =>
+ send(teamResponseMessage(approved, feedback, enableChat, members))
+ }
+ />
+ ),
+ },
+ {
+ id: "worker-decision",
+ title: "Lead decides a worker's call",
+ group: "Team",
+ event: "permission_required (decide_worker_call)",
+ states: STATES["worker-decision"],
+ // Rendered through ApprovalCard, as the app does: it hands this tool to its own card.
+ renderInline: (s, send) => (
+ <ApprovalCard
+ item={approvalItemFromPayload(s.payload)}
+ onApprove={(decision) => send(approvalMessage(decision))}
+ onAnswerWorkerCall={(callId, resolution) =>
+ send({ resolution }, `POST /v1/inbox/${callId}/resolve · answers the WORKER'S call directly`)
+ }
+ autoApprove={s.context?.mode !== "interactive"}
+ compact
+ />
+ ),
+ },
+ {
+ id: "work-items",
+ title: "Work items",
+ group: "Team",
+ event: "items_proposed",
+ states: STATES["work-items"],
+ renderInline: (s, send) => (
+ <WorkItemsCard
+ item={workItemsItemFromPayload(s.payload)}
+ onRespond={(approved, feedback) => send(itemsResponseMessage(approved, feedback))}
+ />
+ ),
+ },
+ {
+ id: "connector-request",
+ title: "Connector request",
+ group: "Requests",
+ event: "connector_requested",
+ states: STATES["connector-request"],
+ renderInline: (s, send) => (
+ <ConnectorRequestCard
+ item={connectorItemFromPayload(s.payload)}
+ onRespond={(approved) => send(connectorResponseMessage(approved))}
+ onOpenConnectors={() => send(null, "opens Settings ▸ Connectors (nothing is sent)")}
+ />
+ ),
+ },
+ {
+ id: "question",
+ title: "Question",
+ group: "Requests",
+ event: "question_requested",
+ states: STATES.question,
+ // A live question wears the Inbox card (one question UI), docked and compact.
+ renderInline: (s, send) => (
+ <InboxItemCard
+ item={liveQuestionInboxItem(questionItemFromPayload(s.payload), "gallery-session")}
+ onResolve={(_id, answer) => send(questionResponseMessage(answer))}
+ compact
+ />
+ ),
+ },
+ {
+ id: "directory-request",
+ title: "Folder request",
+ group: "Requests",
+ event: "directory_requested",
+ states: STATES["directory-request"],
+ renderInline: (s, send) => (
+ <DirectoryRequestCard
+ item={directoryItemFromPayload(s.payload)}
+ onRespond={(granted, path, writable) => send(directoryResponseMessage(granted, path, writable))}
+ />
+ ),
+ },
+ {
+ id: "tool-request",
+ title: "Tool request",
+ group: "Requests",
+ event: "tool_requested",
+ states: STATES["tool-request"],
+ renderInline: (s, send) => (
+ <ToolRequestCard
+ item={toolItemFromPayload(s.payload)}
+ onRespond={(approved) => send(toolResponseMessage(approved))}
+ />
+ ),
+ },
+ {
+ id: "board-wake",
+ title: "Board wake",
+ group: "Messages",
+ event: "turn_start (source.connector = board)",
+ stage: "transcript",
+ states: STATES["board-wake"],
+ renderInline: (s) => <BoardWakeCard source={s.payload.source as MessageSource} />,
+ },
+ {
+ id: "connector-message",
+ title: "Connector message",
+ group: "Messages",
+ event: "turn_start (source)",
+ stage: "transcript",
+ states: STATES["connector-message"],
+ renderInline: (s) => <ConnectorMessageCard source={s.payload.source as MessageSource} />,
+ },
+];
diff --git a/surfaces/gui/src/gallery/contract.test.ts b/surfaces/gui/src/gallery/contract.test.ts
new file mode 100644
index 00000000..35e5a892
--- /dev/null
+++ b/surfaces/gui/src/gallery/contract.test.ts
@@ -0,0 +1,12 @@
+// Fails when states.contract.json is stale: the server-side check reads that file, so it
+// must always say what the state files say.
+import { describe, expect, it } from "vitest";
+
+import { buildContract } from "./contract";
+import committed from "./states.contract.json";
+
+describe("gallery contract file", () => {
+ it("matches the state files (else: npm run gallery:contract)", () => {
+ expect(committed).toEqual(buildContract());
+ });
+});
diff --git a/surfaces/gui/src/gallery/contract.ts b/surfaces/gui/src/gallery/contract.ts
new file mode 100644
index 00000000..ab43b5d9
--- /dev/null
+++ b/surfaces/gui/src/gallery/contract.ts
@@ -0,0 +1,22 @@
+// The gallery's payloads as one JSON-able object, for the server-side contract check
+// (tests/test_gallery_contract.py builds the same payloads from the real server code and
+// compares field names and types). Committed as states.contract.json; regenerate with
+// npm run gallery:contract
+import { CARDS } from "./cards";
+import { inboxItemBuilders } from "./inboxItems";
+
+export function buildContract() {
+ const cards: Record<string, unknown> = {};
+ for (const card of CARDS) {
+ const toInbox = inboxItemBuilders[card.id];
+ cards[card.id] = {
+ event: card.event,
+ // The first state is the card's common case: the fields the card relies on.
+ canonical: card.states[0].id,
+ states: Object.fromEntries(card.states.map((s) => [s.id, s.payload])),
+ inbox: toInbox ? Object.fromEntries(card.states.map((s) => [s.id, toInbox(s)])) : {},
+ };
+ }
+ // Through JSON once, so `undefined` fields drop out exactly as they do on disk.
+ return JSON.parse(JSON.stringify({ note: "GENERATED — run `npm run gallery:contract`; do not edit", cards }));
+}
diff --git a/surfaces/gui/src/gallery/gallery.css b/surfaces/gui/src/gallery/gallery.css
new file mode 100644
index 00000000..9517b669
--- /dev/null
+++ b/surfaces/gui/src/gallery/gallery.css
@@ -0,0 +1,57 @@
+/* Card gallery chrome (dev only). Uses the app's own tokens so the page follows the
+ theme and text-size toggles; nothing here styles a card. */
+.gal { display: flex; height: 100vh; background: var(--chrome); color: var(--ink); font-size: var(--fs-ui); }
+.gal-rail { width: 220px; flex: none; border-right: 1px solid var(--line); padding: 16px 10px; overflow-y: auto; }
+.gal-brand { font-weight: 600; font-size: var(--fs-body); padding: 0 8px 14px; display: flex; align-items: center; gap: 8px; }
+.gal-dev { font-size: var(--fs-label); font-weight: 500; color: var(--warn-ink); background: var(--warn-soft); border-radius: 999px; padding: 1px 7px; }
+.gal-group { margin-bottom: 14px; }
+.gal-group-title { font-size: var(--fs-label); color: var(--faint); font-weight: 500; padding: 0 8px 4px; }
+.gal-nav { display: flex; width: 100%; justify-content: space-between; align-items: center; border: none; background: none; color: var(--ink); padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: var(--fs-ui); text-align: left; }
+.gal-nav:hover { background: var(--chrome-hover); }
+.gal-nav.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
+.gal-count { font-size: var(--fs-label); color: var(--faint); font-weight: 400; }
+
+.gal-main { flex: 1; min-width: 0; overflow-y: auto; padding: 18px 28px 40px; }
+.gal-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
+.gal-title { font-size: var(--fs-heading); font-weight: 600; margin: 0; }
+.gal-sub { color: var(--muted); font-size: var(--fs-meta); margin-top: 2px; }
+.gal-sub code, .gal-file { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--fs-mono); color: var(--muted); }
+.gal-toggles { display: flex; gap: 14px; flex-wrap: wrap; }
+.gal-seg { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
+.gal-seg-label { padding: 4px 8px; font-size: var(--fs-label); color: var(--faint); border-right: 1px solid var(--line); }
+.gal-seg-btn { border: none; background: none; color: var(--muted); padding: 4px 9px; cursor: pointer; font-size: var(--fs-meta); }
+.gal-seg-btn:hover { color: var(--ink); }
+.gal-seg-btn.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
+
+.gal-states { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
+.gal-chip { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 999px; padding: 4px 11px; cursor: pointer; font-size: var(--fs-meta); }
+.gal-chip:hover { border-color: var(--accent); }
+.gal-chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
+.gal-state-line { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; margin: 10px 0 8px; }
+.gal-state-note { color: var(--muted); font-size: var(--fs-meta); }
+.gal-state-actions { display: inline-flex; gap: 14px; flex: none; }
+.gal-link { border: none; background: none; padding: 0; color: var(--accent); cursor: pointer; font-size: var(--fs-meta); }
+
+/* The stage is the app's reading column: same canvas, same wrappers around the card. */
+.gal-stage-wrap { border: 1px dashed var(--line-strong); border-radius: 12px; background: var(--canvas); }
+.gal-stage-wrap.narrow { max-width: 460px; }
+.gal-stage { padding: 12px 0 4px; }
+
+.gal-panel { margin-top: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 10px 14px; }
+.gal-panel-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: var(--fs-meta); }
+.gal-empty { color: var(--faint); font-size: var(--fs-meta); margin-top: 6px; }
+.gal-sent { margin-top: 10px; }
+.gal-sent-head { display: flex; justify-content: space-between; color: var(--faint); font-size: var(--fs-label); }
+.gal-json { margin: 4px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--paper); color: var(--ink); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--fs-mono); white-space: pre-wrap; word-break: break-word; max-height: 360px; overflow: auto; }
+
+/* Scenario badge: floats over the real app while a scenario is open. */
+.gal-badge { position: fixed; left: 10px; bottom: 44px; z-index: 9999; font-size: var(--fs-meta); color: var(--ink); }
+.gal-badge-pill { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--panel); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12); padding: 4px 10px 4px 4px; cursor: pointer; color: var(--muted); font-size: var(--fs-label); }
+.gal-badge-body { position: absolute; left: 0; bottom: 34px; width: 440px; max-height: 60vh; overflow: auto; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--panel); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16); padding: 10px 12px; }
+.gal-badge-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
+.gal-badge-line .gal-link { white-space: nowrap; }
+.gal-badge-title { font-weight: 600; }
+.gal-scn { display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--panel); border-radius: 12px; padding: 12px 14px; margin-top: 10px; cursor: pointer; color: var(--ink); text-decoration: none; }
+.gal-scn:hover { border-color: var(--line-strong); }
+.gal-scn-title { font-weight: 600; font-size: var(--fs-body); }
+.gal-scn-meta { color: var(--faint); font-size: var(--fs-label); margin-top: 2px; }
diff --git a/surfaces/gui/src/gallery/inboxItems.ts b/surfaces/gui/src/gallery/inboxItems.ts
new file mode 100644
index 00000000..21eae673
--- /dev/null
+++ b/surfaces/gui/src/gallery/inboxItems.ts
@@ -0,0 +1,95 @@
+// The Inbox item the server parks for each card, built from the same payload the inline
+// card gets. Mirrors coworker/server/manager.py (inbox_team_approver, inbox_items_approver,
+// inbox_connector_requester, approval_prompt_data, the plan gate) — the server-side
+// contract check (spec §4) is what keeps this file honest.
+import type { InboxItem } from "../api";
+import type { CardState } from "./types";
+
+function parked(kind: InboxItem["kind"], title: string, body: string, data?: Record<string, any>): InboxItem {
+ return {
+ id: "gallery-item",
+ session_id: "gallery-session",
+ kind,
+ title,
+ body,
+ state: "pending",
+ resolution: null,
+ inbox: "default",
+ created_at: "2026-09-17T09:30:00Z",
+ resolved_at: null,
+ visibility: "inbox",
+ session_title: "Mention #3 · Invoice PDF download",
+ session_agent: "swe-lead",
+ session_exists: true,
+ ...(data ? { data } : {}),
+ };
+}
+
+// Cards with no entry here never park in the Inbox, so they get no "In the Inbox" toggle.
+export const inboxItemBuilders: Partial<Record<string, (s: CardState<any>) => InboxItem>> = {
+ "team-request": ({ payload: p }) =>
+ parked(
+ "plan",
+ "Create this team?",
+ (p.members || []).map((m: any) => `- ${m.persona}${m.name ? ` (${m.name})` : ""}`).join("\n"),
+ { gate: "team", ...p },
+ ),
+ "work-items": ({ payload: p }) =>
+ parked(
+ "plan",
+ "Approve the proposed work items?",
+ (p.items || []).map((i: any) => `- ${i.title}`).join("\n"),
+ { gate: "items", items: p.items || [], note: p.note || "" },
+ ),
+ approval: ({ payload: p, context }) =>
+ parked("approval", `Run \`${p.name}\`?`, p.reason || "", {
+ tool: p.name,
+ arguments: p.arguments || {},
+ ...(context?.runTask ? { task_id: context.runTask.id, task_title: context.runTask.title } : {}),
+ ...(context?.runTask && p.standing_target ? { standing_target: p.standing_target } : {}),
+ }),
+ // A parked lead decision: the approval item plus the worker's call the server attaches.
+ "worker-decision": ({ payload: p }) =>
+ parked(
+ "approval",
+ `Run \`${p.name}\`?`,
+ `requires approval\nworker: ${p.arguments.worker} · call_id: ${p.arguments.call_id} · decision: ${p.arguments.decision}`,
+ { tool: p.name, arguments: p.arguments, ...(p.worker_call ? { worker_call: p.worker_call } : {}) },
+ ),
+ "connector-request": ({ payload: p }) =>
+ parked(
+ "connector",
+ p.request === "grant" ? `Give ${p.worker} access to ${p.connector}?` : `Connect ${p.connector}?`,
+ p.reason || "",
+ { request: p.request, connector: p.connector, worker: p.worker || "" },
+ ),
+ plan: ({ payload: p }) => parked("plan", "Approve the plan?", p.plan || ""),
+ // coworker/tools/ask.py question_item_fields: a grouped ask surfaces its FIRST question
+ // as the title and options too, so older surfaces degrade to one question.
+ question: ({ payload: p }) => {
+ const first = (p.questions || [])[0];
+ return {
+ ...parked("question", first ? first.question : p.question || "", ""),
+ options: first ? first.options || [] : p.options || [],
+ allow_text: (first ? first.allow_text : p.allow_text) !== false,
+ multi: !!(first ? first.multi : p.multi),
+ header: (first ? first.header : p.header) || "",
+ questions: p.questions || [],
+ };
+ },
+ "directory-request": ({ payload: p }) =>
+ parked("directory", "Grant access to a folder?", p.reason || "", {
+ path: p.path || "",
+ writable: !!p.writable,
+ primary: !!p.primary,
+ }),
+ "tool-request": ({ payload: p }) =>
+ parked("tool", p.name ? `Install ${p.name}?` : "Install a tool?", p.reason || "", {
+ tool: p.name || "",
+ installable: p.installable === true,
+ version: p.version || "",
+ summary: p.summary || "",
+ url: "",
+ source: p.source || "",
+ }),
+};
diff --git a/surfaces/gui/src/gallery/scenarioApi.ts b/surfaces/gui/src/gallery/scenarioApi.ts
new file mode 100644
index 00000000..971d4df2
--- /dev/null
+++ b/surfaces/gui/src/gallery/scenarioApi.ts
@@ -0,0 +1,222 @@
+// The in-memory API behind a scenario (dev only). Replaces window.fetch and WebSocket for
+// the app's own server, answering from one Scenario; the real <App/> then boots on top,
+// so what you see IS the session view, not a copy of it. Anything the scenario does not
+// cover fails like an unreachable server, which the app already tolerates.
+import type { Scenario } from "./scenarios/types";
+
+const SERVER = /^(https?|wss?):\/\/(127\.0\.0\.1|localhost):8765/;
+
+const PERSONA = (id: string, name: string, group: string, extra: Record<string, unknown> = {}) => ({
+ id,
+ name,
+ icon: "cowork",
+ tagline: "",
+ requires_folder: false,
+ builtin: true,
+ tools: ["files", "search"],
+ enabled: true,
+ surfaced: true,
+ ships: true,
+ group,
+ ...extra,
+});
+
+export interface SentRecord {
+ at: string;
+ channel: string;
+ body: unknown;
+}
+
+export function installScenario(scenario: Scenario, onSent: (r: SentRecord) => void): void {
+ const sid = scenario.session.session_id;
+ const now = new Date().toISOString();
+ const pending = [...(scenario.pending ?? [])];
+ let unattended = !!scenario.session.unattended;
+ const record = (channel: string, body: unknown) =>
+ onSent({ at: new Date().toLocaleTimeString(), channel, body });
+
+ const leadRow = {
+ session_id: sid,
+ title: scenario.session.title,
+ workspace: scenario.session.workspace ?? "",
+ agent: scenario.session.agent,
+ model: scenario.session.model,
+ mode: scenario.session.mode,
+ updated_at: now,
+ messages: scenario.messages.length,
+ pinned: false,
+ archived: false,
+ attention: pending.length,
+ liveness: pending.length ? "waiting" : "idle",
+ subscriptions: [],
+ unattended,
+ ...(scenario.team
+ ? { team: { role: "lead", team_id: scenario.team.team_id, chat_enabled: !!scenario.team.chat_enabled, chat_unread: 0 } }
+ : {}),
+ };
+ const workerRows = (scenario.team?.workers ?? []).map((w) => ({
+ session_id: `${sid}-${w.name}`,
+ title: w.name,
+ workspace: scenario.session.workspace ?? "",
+ agent: w.persona,
+ model: w.model ?? scenario.session.model,
+ mode: scenario.session.mode,
+ updated_at: now,
+ messages: 0,
+ pinned: false,
+ archived: false,
+ attention: 0,
+ liveness: "idle",
+ subscriptions: [],
+ team: {
+ role: "worker",
+ team_id: scenario.team!.team_id,
+ lead_session: sid,
+ actor: w.name,
+ status: w.status ?? "idle",
+ current_item: w.current_item ?? "",
+ },
+ usage: w.usage ?? {},
+ }));
+ const personaIds = [...new Set([scenario.session.agent, ...workerRows.map((w) => w.agent)])];
+ const models = [...new Set([scenario.session.model, ...workerRows.map((w) => w.model)])];
+
+ const route = (method: string, path: string, query: URLSearchParams, body: any): unknown => {
+ if (path.endsWith("/v1/capabilities")) return { mode: "desktop" };
+ if (path.endsWith("/v1/health")) return { status: "ok", default_workspace: null, model: scenario.session.model };
+ if (path.endsWith("/v1/settings"))
+ return {
+ provider: "anthropic",
+ auto_approve: true,
+ model: scenario.session.model,
+ models,
+ has_key: true,
+ model_ready: true,
+ source: "store",
+ onboarded: true,
+ experimental_connectors: false,
+ surfaces: { cowork: true, chat: false, code: true },
+ nav_layout: "grouped",
+ scratch_base: "~/OpenWorker",
+ sessions_peek: 5,
+ // Curated names, as the real /v1/settings sends them (the cards show the name part).
+ model_labels: {
+ "anthropic:claude-opus-4-8": "Claude Opus 4.8 · Anthropic",
+ "anthropic:claude-sonnet-4-8": "Claude Sonnet 4.8 · Anthropic",
+ },
+ model_context_windows: {},
+ };
+ if (path.endsWith("/v1/personas"))
+ return {
+ internal: true,
+ personas: [
+ PERSONA("cowork", "OpenWorker", "general", { default: true }),
+ ...personaIds.filter((id) => id !== "cowork").map((id) => PERSONA(id, id, "teams")),
+ ],
+ };
+ if (path.endsWith("/v1/sessions")) return { sessions: [leadRow, ...workerRows] };
+ if (path.endsWith("/v1/machines")) return { machines: [] };
+ if (new RegExp(`/v1/sessions/${sid}/messages$`).test(path)) return { messages: scenario.messages };
+ if (/\/v1\/sessions\/[^/]+\/messages$/.test(path)) return { messages: [] };
+ if (/\/v1\/sessions\/[^/]+\/unattended$/.test(path)) {
+ if (method === "POST") unattended = !!body?.unattended;
+ return { ok: true, unattended: path.includes(`/${sid}/`) ? unattended : false };
+ }
+ if (/\/v1\/sessions\/[^/]+\/board$/.test(path))
+ return path.includes(`/${sid}/`) && scenario.board ? scenario.board : { space: null, name: "", items: [] };
+ if (/\/v1\/inbox\/[^/]+\/resolve$/.test(path)) {
+ const id = path.split("/").slice(-2)[0];
+ const i = pending.findIndex((p) => p.id === id);
+ if (i >= 0) pending.splice(i, 1);
+ let parsed: unknown = body?.resolution;
+ try {
+ parsed = JSON.parse(body?.resolution);
+ } catch {
+ /* plain-string resolutions stay strings */
+ }
+ record(`POST /v1/inbox/${id}/resolve`, parsed);
+ return { ok: true };
+ }
+ if (path.endsWith("/v1/inbox")) {
+ const want = query.get("session_id");
+ return { items: pending.filter((p) => !want || p.session_id === want) };
+ }
+ if (/\/v1\/teams\/[^/]+\/chat$/.test(path)) return { team_id: scenario.team?.team_id ?? "", messages: [] };
+ if (/\/v1\/sessions\/[^/]+\/(roots|connections|bindings|skills)$/.test(path)) return {};
+ return undefined;
+ };
+
+ const realFetch = window.fetch.bind(window);
+ window.fetch = async (input: RequestInfo | URL, init?: RequestInit) => {
+ const url = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
+ if (!SERVER.test(url)) return realFetch(input as any, init);
+ const u = new URL(url);
+ const method = (init?.method || "GET").toUpperCase();
+ let body: any = undefined;
+ try {
+ body = init?.body ? JSON.parse(String(init.body)) : undefined;
+ } catch {
+ /* non-JSON bodies are not interpreted */
+ }
+ const answer = route(method, u.pathname, u.searchParams, body);
+ if (answer === undefined) {
+ console.debug(`[scenario] not covered: ${method} ${u.pathname}`);
+ throw new TypeError("scenario: endpoint not covered"); // same as an unreachable server
+ }
+ return new Response(JSON.stringify(answer), { status: 200, headers: { "Content-Type": "application/json" } });
+ };
+
+ // The socket: says `ready`, replays the scenario's events on the lead's session socket,
+ // and prints what the app sends instead of delivering it.
+ class ScenarioSocket extends EventTarget {
+ static CONNECTING = 0;
+ static OPEN = 1;
+ static CLOSING = 2;
+ static CLOSED = 3;
+ readyState = 0;
+ url: string;
+ protocol = "";
+ binaryType = "blob";
+ onopen: ((e: Event) => void) | null = null;
+ onmessage: ((e: MessageEvent) => void) | null = null;
+ onclose: ((e: CloseEvent) => void) | null = null;
+ onerror: ((e: Event) => void) | null = null;
+ constructor(url: string) {
+ super();
+ this.url = url;
+ setTimeout(() => {
+ this.readyState = 1;
+ const open = new Event("open");
+ this.onopen?.(open);
+ this.dispatchEvent(open);
+ if (!/\/ws\/session\//.test(url)) return;
+ if (!url.includes(`/ws/session/${sid}`)) return this.emit({ type: "ready", data: {} });
+ // Like the server: `ready` carries the session's model, mode and workspace.
+ const { model, mode, workspace } = scenario.session;
+ this.emit({ type: "ready", data: { model, mode, workspace: workspace ?? "", temp_workspace: false, running: false } });
+ for (const e of scenario.events ?? []) this.emit(e);
+ }, 0);
+ }
+ private emit(payload: unknown) {
+ const e = new MessageEvent("message", { data: JSON.stringify(payload) });
+ this.onmessage?.(e);
+ this.dispatchEvent(e);
+ }
+ send(data: string) {
+ try {
+ const msg = JSON.parse(data);
+ if (msg?.type && msg.type !== "ping") record("websocket message", msg);
+ } catch {
+ /* not JSON: nothing to show */
+ }
+ }
+ close() {
+ this.readyState = 3;
+ }
+ }
+ const RealSocket = window.WebSocket;
+ (window as any).WebSocket = function (url: string, protocols?: string | string[]) {
+ return SERVER.test(url) ? new ScenarioSocket(url) : new RealSocket(url, protocols);
+ };
+ Object.assign((window as any).WebSocket, { CONNECTING: 0, OPEN: 1, CLOSING: 2, CLOSED: 3 });
+}
diff --git a/surfaces/gui/src/gallery/scenarioBoot.tsx b/surfaces/gui/src/gallery/scenarioBoot.tsx
new file mode 100644
index 00000000..413cfee1
--- /dev/null
+++ b/surfaces/gui/src/gallery/scenarioBoot.tsx
@@ -0,0 +1,33 @@
+// Boots the real app on a scenario (dev only): install the in-memory API first, then
+// render <App/> with the scenario badge floating over it.
+import React, { useEffect, useState, type ComponentType } from "react";
+import type { Root } from "react-dom/client";
+import { ScenarioBadge } from "./ScenarioBadge";
+import { installScenario, type SentRecord } from "./scenarioApi";
+import { SCENARIOS } from "./scenarios";
+
+export function bootScenario(id: string, root: Root, App: ComponentType): boolean {
+ const scenario = SCENARIOS.find((s) => s.id === id);
+ if (!scenario) return false;
+ const sent: SentRecord[] = [];
+ const listeners = new Set<(list: SentRecord[]) => void>();
+ installScenario(scenario, (r) => {
+ sent.unshift(r);
+ listeners.forEach((l) => l([...sent]));
+ });
+ function Badge() {
+ const [list, setList] = useState<SentRecord[]>(sent);
+ useEffect(() => {
+ listeners.add(setList);
+ return () => void listeners.delete(setList);
+ }, []);
+ return <ScenarioBadge scenario={scenario!} sent={list} />;
+ }
+ root.render(
+ <React.StrictMode>
+ <App />
+ <Badge />
+ </React.StrictMode>,
+ );
+ return true;
+}
diff --git a/surfaces/gui/src/gallery/scenarios/index.ts b/surfaces/gui/src/gallery/scenarios/index.ts
new file mode 100644
index 00000000..2ae96ffb
--- /dev/null
+++ b/surfaces/gui/src/gallery/scenarios/index.ts
@@ -0,0 +1,14 @@
+// Every scenario the gallery lists: each *.json in this folder. Hand-written, or saved
+// from a real run with scripts/export-scenario.py — dropping a file here is enough.
+import type { Scenario } from "./types";
+
+const files = import.meta.glob("./*.json", { eager: true, import: "default" }) as Record<string, Scenario>;
+
+export const SCENARIOS: Scenario[] = Object.keys(files)
+ .sort()
+ .map((k) => files[k]);
+
+/** Opening a scenario is a page load: the app reads its session from the hash at start-up. */
+export function scenarioUrl(s: Scenario): string {
+ return `${window.location.pathname}?scenario=${encodeURIComponent(s.id)}#/s/${s.session.session_id}`;
+}
diff --git a/surfaces/gui/src/gallery/scenarios/lead-staffing-card-waiting.json b/surfaces/gui/src/gallery/scenarios/lead-staffing-card-waiting.json
new file mode 100644
index 00000000..32f06484
--- /dev/null
+++ b/surfaces/gui/src/gallery/scenarios/lead-staffing-card-waiting.json
@@ -0,0 +1,233 @@
+{
+ "id": "lead-staffing-card-waiting",
+ "title": "SWE Lead · staffing card waiting",
+ "note": "A lead woken by a GitHub mention, on a box, approvals going to the Inbox. Four steps in, it has split the work and now waits on the staffing card.",
+ "session": {
+ "session_id": "scn-lead-3",
+ "title": "Mention #3 · Invoice PDF download",
+ "agent": "swe-lead",
+ "model": "anthropic:claude-sonnet-4-8",
+ "mode": "auto-approve",
+ "workspace": "/home/parallels/work/billing-service",
+ "unattended": true
+ },
+ "messages": [
+ {
+ "role": "user",
+ "content": "[lead] Add a PDF download to every invoice in the drawer. The statements worker already renders them; the API needs a route and the web client a button.",
+ "source": {
+ "connector": "github",
+ "kind": "channel",
+ "channel_id": "acme/billing-service#3",
+ "channel_name": "acme/billing-service #3",
+ "sender_id": "demo-user",
+ "sender_name": "demo-user",
+ "ts": 1789900000,
+ "text": "[lead] Add a PDF download to every invoice in the drawer. The statements worker already renders them; the API needs a route and the web client a button."
+ },
+ "ts": 1789900000
+ },
+ {
+ "role": "assistant",
+ "content": "I'll read the issue and the code it touches before splitting the work.",
+ "tool_calls": [
+ {
+ "id": "t1",
+ "function": {
+ "name": "run_shell",
+ "arguments": "{\"command\": \"gh issue view 3 --repo acme/billing-service\"}"
+ }
+ },
+ {
+ "id": "t2",
+ "function": {
+ "name": "read_file",
+ "arguments": "{\"path\": \"api/src/invoices.ts\"}"
+ }
+ },
+ {
+ "id": "t3",
+ "function": {
+ "name": "read_file",
+ "arguments": "{\"path\": \"web/src/components/InvoiceDrawer.tsx\"}"
+ }
+ }
+ ],
+ "ts": 1789900010
+ },
+ {
+ "role": "tool",
+ "tool_call_id": "t1",
+ "content": "title: Invoice PDF download\nstate: OPEN\nlabels: enhancement"
+ },
+ {
+ "role": "tool",
+ "tool_call_id": "t2",
+ "content": "export async function getInvoice(accountId: string, id: string) { … }"
+ },
+ {
+ "role": "tool",
+ "tool_call_id": "t3",
+ "content": "export function InvoiceDrawer({ invoice }: Props) { … }"
+ },
+ {
+ "role": "assistant",
+ "content": "The statements worker already writes each PDF to S3 and records `pdf_key` on the invoice. What is missing is a route that streams it and a button that calls the route. I'll split this into three items.",
+ "tool_calls": [
+ {
+ "id": "t4",
+ "function": {
+ "name": "propose_work_items",
+ "arguments": "{\"items\": [{\"title\": \"Add GET /invoices/:id/pdf\", \"criteria\": \"Returns the stored PDF for the caller's own invoice; 404 for a missing file; 403 for another account.\"}, {\"title\": \"Download button in the invoice drawer\", \"criteria\": \"The button downloads the PDF and shows an error toast when the API fails.\"}, {\"title\": \"Tests for both\", \"criteria\": \"API and UI tests pass in CI.\"}], \"note\": \"Split by surface so the API and the web client can move in parallel.\"}"
+ }
+ }
+ ],
+ "ts": 1789900040
+ },
+ {
+ "role": "tool",
+ "tool_call_id": "t4",
+ "content": "{\"approved\": true, \"created\": [1, 2, 3]}"
+ },
+ {
+ "role": "assistant",
+ "content": "The three items are on the board. Two workers are enough: one to build both halves, one to verify them.",
+ "tool_calls": [
+ {
+ "id": "t5",
+ "function": {
+ "name": "team_options",
+ "arguments": "{}"
+ }
+ },
+ {
+ "id": "t6",
+ "function": {
+ "name": "propose_team",
+ "arguments": "{\"members\": [{\"persona\": \"swe-worker\", \"name\": \"nia\", \"reason\": \"Builds the PDF route and the download button\", \"connectors\": [\"github\"], \"connector_reasons\": {\"github\": \"pushes the branch and opens the PR\"}}, {\"persona\": \"test-worker\", \"name\": \"checks\", \"reason\": \"Writes the API and UI tests, runs the suites\"}], \"note\": \"Two workers: one builds, one verifies.\"}"
+ }
+ }
+ ],
+ "ts": 1789900070
+ },
+ {
+ "role": "tool",
+ "tool_call_id": "t5",
+ "content": "{\"workers\": {\"swe-worker\": {\"connectors\": {\"ready\": [\"github\"]}}, \"test-worker\": {\"connectors\": {\"ready\": [\"github\"]}}}, \"not_connected\": [\"jira\"]}"
+ }
+ ],
+ "pending": [
+ {
+ "id": "scn-gate-team",
+ "session_id": "scn-lead-3",
+ "kind": "plan",
+ "title": "Create this team?",
+ "body": "- swe-worker (nia)\n- test-worker (checks)",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "gate": "team",
+ "enable_chat": false,
+ "note": "Two workers: one builds, one verifies.",
+ "members": [
+ {
+ "persona": "swe-worker",
+ "name": "nia",
+ "reason": "Builds the PDF route and the download button",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes the branch and opens the PR"
+ }
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks",
+ "reason": "Writes the API and UI tests, runs the suites",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ }
+ ],
+ "offer": {
+ "swe-worker": [
+ "github"
+ ],
+ "test-worker": [
+ "github"
+ ]
+ },
+ "other_connected": [
+ "linear"
+ ],
+ "lead_mode": "auto-approve",
+ "lead_model": "anthropic:claude-sonnet-4-8",
+ "model_options": {
+ "swe-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "test-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ]
+ },
+ "runnable_models": [
+ {
+ "id": "anthropic:claude-opus-4-8",
+ "label": "Claude Opus 4.8"
+ },
+ {
+ "id": "anthropic:claude-sonnet-4-8",
+ "label": "Claude Sonnet 4.8"
+ }
+ ]
+ }
+ }
+ ],
+ "board": {
+ "space": "/home/parallels/work/billing-service",
+ "name": "billing-service",
+ "items": [
+ {
+ "id": 1,
+ "title": "Add GET /invoices/:id/pdf",
+ "description": "",
+ "criteria": "Returns the stored PDF for the caller's own invoice; 404 for a missing file; 403 for another account.",
+ "state": "open",
+ "assignee": "",
+ "creator": "lead",
+ "refs": [],
+ "links": []
+ },
+ {
+ "id": 2,
+ "title": "Download button in the invoice drawer",
+ "description": "",
+ "criteria": "The button downloads the PDF and shows an error toast when the API fails.",
+ "state": "open",
+ "assignee": "",
+ "creator": "lead",
+ "refs": [],
+ "links": []
+ },
+ {
+ "id": 3,
+ "title": "Tests for both",
+ "description": "",
+ "criteria": "API and UI tests pass in CI.",
+ "state": "open",
+ "assignee": "",
+ "creator": "lead",
+ "refs": [],
+ "links": []
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/surfaces/gui/src/gallery/scenarios/lead-team-running-approval.json b/surfaces/gui/src/gallery/scenarios/lead-team-running-approval.json
new file mode 100644
index 00000000..eae67019
--- /dev/null
+++ b/surfaces/gui/src/gallery/scenarios/lead-team-running-approval.json
@@ -0,0 +1,287 @@
+{
+ "id": "lead-team-running-approval",
+ "title": "SWE Lead · team running, approval waiting",
+ "note": "The same lead later, attended in Manual mode: the team exists (Team panel and board in the rail), a board wake has arrived, and a shell command waits on a live approval card.",
+ "session": {
+ "session_id": "scn-lead-3b",
+ "title": "Mention #3 · Invoice PDF download",
+ "agent": "swe-lead",
+ "model": "anthropic:claude-sonnet-4-8",
+ "mode": "interactive",
+ "workspace": "/home/parallels/work/billing-service",
+ "unattended": false
+ },
+ "messages": [
+ {
+ "role": "user",
+ "content": "[lead] Add a PDF download to every invoice in the drawer. The statements worker already renders them; the API needs a route and the web client a button.",
+ "source": {
+ "connector": "github",
+ "kind": "channel",
+ "channel_id": "acme/billing-service#3",
+ "channel_name": "acme/billing-service #3",
+ "sender_id": "demo-user",
+ "sender_name": "demo-user",
+ "ts": 1789900000,
+ "text": "[lead] Add a PDF download to every invoice in the drawer. The statements worker already renders them; the API needs a route and the web client a button."
+ },
+ "ts": 1789900000
+ },
+ {
+ "role": "assistant",
+ "content": "I'll read the issue and the code it touches before splitting the work.",
+ "tool_calls": [
+ {
+ "id": "t1",
+ "function": {
+ "name": "run_shell",
+ "arguments": "{\"command\": \"gh issue view 3 --repo acme/billing-service\"}"
+ }
+ },
+ {
+ "id": "t2",
+ "function": {
+ "name": "read_file",
+ "arguments": "{\"path\": \"api/src/invoices.ts\"}"
+ }
+ },
+ {
+ "id": "t3",
+ "function": {
+ "name": "read_file",
+ "arguments": "{\"path\": \"web/src/components/InvoiceDrawer.tsx\"}"
+ }
+ }
+ ],
+ "ts": 1789900010
+ },
+ {
+ "role": "tool",
+ "tool_call_id": "t1",
+ "content": "title: Invoice PDF download\nstate: OPEN\nlabels: enhancement"
+ },
+ {
+ "role": "tool",
+ "tool_call_id": "t2",
+ "content": "export async function getInvoice(accountId: string, id: string) { … }"
+ },
+ {
+ "role": "tool",
+ "tool_call_id": "t3",
+ "content": "export function InvoiceDrawer({ invoice }: Props) { … }"
+ },
+ {
+ "role": "assistant",
+ "content": "The statements worker already writes each PDF to S3 and records `pdf_key` on the invoice. What is missing is a route that streams it and a button that calls the route. I'll split this into three items.",
+ "tool_calls": [
+ {
+ "id": "t4",
+ "function": {
+ "name": "propose_work_items",
+ "arguments": "{\"items\": [{\"title\": \"Add GET /invoices/:id/pdf\", \"criteria\": \"Returns the stored PDF for the caller's own invoice; 404 for a missing file; 403 for another account.\"}, {\"title\": \"Download button in the invoice drawer\", \"criteria\": \"The button downloads the PDF and shows an error toast when the API fails.\"}, {\"title\": \"Tests for both\", \"criteria\": \"API and UI tests pass in CI.\"}], \"note\": \"Split by surface so the API and the web client can move in parallel.\"}"
+ }
+ }
+ ],
+ "ts": 1789900040
+ },
+ {
+ "role": "tool",
+ "tool_call_id": "t4",
+ "content": "{\"approved\": true, \"created\": [1, 2, 3]}"
+ },
+ {
+ "role": "assistant",
+ "content": "The three items are on the board. Two workers are enough: one to build both halves, one to verify them.",
+ "tool_calls": [
+ {
+ "id": "t5",
+ "function": {
+ "name": "team_options",
+ "arguments": "{}"
+ }
+ },
+ {
+ "id": "t6",
+ "function": {
+ "name": "propose_team",
+ "arguments": "{\"members\": [{\"persona\": \"swe-worker\", \"name\": \"nia\", \"reason\": \"Builds the PDF route and the download button\", \"connectors\": [\"github\"], \"connector_reasons\": {\"github\": \"pushes the branch and opens the PR\"}}, {\"persona\": \"test-worker\", \"name\": \"checks\", \"reason\": \"Writes the API and UI tests, runs the suites\"}], \"note\": \"Two workers: one builds, one verifies.\"}"
+ }
+ }
+ ],
+ "ts": 1789900070
+ },
+ {
+ "role": "tool",
+ "tool_call_id": "t5",
+ "content": "{\"workers\": {\"swe-worker\": {\"connectors\": {\"ready\": [\"github\"]}}, \"test-worker\": {\"connectors\": {\"ready\": [\"github\"]}}}, \"not_connected\": [\"jira\"]}"
+ },
+ {
+ "role": "tool",
+ "tool_call_id": "t6",
+ "content": "{\"approved\": true, \"team\": \"t-billing-3\", \"workers\": [\"nia\", \"checks\"]}"
+ },
+ {
+ "role": "assistant",
+ "content": "The team is staffed. nia has item 1 and 2, checks has item 3. I'll check in when the board moves.",
+ "ts": 1789900100
+ },
+ {
+ "role": "user",
+ "content": "⏰ Board wake",
+ "ts": 1789903000,
+ "source": {
+ "connector": "board",
+ "kind": "channel",
+ "channel_id": "/home/parallels/work/billing-service",
+ "channel_name": "Team board",
+ "sender_id": "board",
+ "sender_name": "Board",
+ "ts": 1789903000,
+ "text": "⏰ Board wake — your team needs decisions:\n- #1 moved to review by nia",
+ "board": {
+ "rows": [
+ {
+ "kind": "moved",
+ "item": 1,
+ "title": "Add GET /invoices/:id/pdf",
+ "actor": "nia",
+ "to": "review",
+ "note": "Route is up on lead/invoice-pdf, commit 4c1e9aa. 404 and 403 paths covered; needs checks' verdict."
+ },
+ {
+ "kind": "claimed",
+ "item": 3,
+ "title": "Tests for both",
+ "actor": "checks"
+ }
+ ]
+ }
+ }
+ },
+ {
+ "role": "assistant",
+ "content": "nia's route is ready for review. I'll run the API tests on her branch before handing it to checks.",
+ "tool_calls": [
+ {
+ "id": "t7",
+ "function": {
+ "name": "run_shell",
+ "arguments": "{\"command\": \"git fetch origin lead/invoice-pdf && git checkout lead/invoice-pdf\"}"
+ }
+ },
+ {
+ "id": "t8",
+ "function": {
+ "name": "run_shell",
+ "arguments": "{\"command\": \"npm test --prefix api -- --run invoices\"}"
+ }
+ }
+ ],
+ "ts": 1789903020
+ },
+ {
+ "role": "tool",
+ "tool_call_id": "t7",
+ "content": "Switched to branch 'lead/invoice-pdf'"
+ }
+ ],
+ "events": [
+ {
+ "type": "tool_proposed",
+ "data": {
+ "name": "run_shell",
+ "arguments": {
+ "command": "npm test --prefix api -- --run invoices"
+ }
+ }
+ },
+ {
+ "type": "permission_required",
+ "data": {
+ "name": "run_shell",
+ "arguments": {
+ "command": "npm test --prefix api -- --run invoices"
+ },
+ "reason": "Run the API tests on nia's branch",
+ "category": "shell"
+ }
+ }
+ ],
+ "team": {
+ "team_id": "t-billing-3",
+ "chat_enabled": true,
+ "workers": [
+ {
+ "name": "nia",
+ "persona": "swe-worker",
+ "model": "anthropic:claude-opus-4-8",
+ "status": "review",
+ "current_item": "#1 in review",
+ "usage": {
+ "anthropic:claude-opus-4-8": {
+ "input": 182000,
+ "output": 21000,
+ "cache_read": 640000,
+ "cache_write": 41000,
+ "turns": 14
+ }
+ }
+ },
+ {
+ "name": "checks",
+ "persona": "test-worker",
+ "model": "anthropic:claude-sonnet-4-8",
+ "status": "in_progress",
+ "current_item": "#3 in progress",
+ "usage": {
+ "anthropic:claude-sonnet-4-8": {
+ "input": 44000,
+ "output": 6000,
+ "cache_read": 120000,
+ "cache_write": 9000,
+ "turns": 5
+ }
+ }
+ }
+ ]
+ },
+ "board": {
+ "space": "/home/parallels/work/billing-service",
+ "name": "billing-service",
+ "items": [
+ {
+ "id": 1,
+ "title": "Add GET /invoices/:id/pdf",
+ "description": "",
+ "criteria": "Returns the stored PDF for the caller's own invoice; 404 for a missing file; 403 for another account.",
+ "state": "review",
+ "assignee": "nia",
+ "creator": "lead",
+ "refs": [],
+ "links": []
+ },
+ {
+ "id": 2,
+ "title": "Download button in the invoice drawer",
+ "description": "",
+ "criteria": "The button downloads the PDF and shows an error toast when the API fails.",
+ "state": "in_progress",
+ "assignee": "nia",
+ "creator": "lead",
+ "refs": [],
+ "links": []
+ },
+ {
+ "id": 3,
+ "title": "Tests for both",
+ "description": "",
+ "criteria": "API and UI tests pass in CI.",
+ "state": "in_progress",
+ "assignee": "checks",
+ "creator": "lead",
+ "refs": [],
+ "links": []
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/surfaces/gui/src/gallery/scenarios/scenarios.test.ts b/surfaces/gui/src/gallery/scenarios/scenarios.test.ts
new file mode 100644
index 00000000..0c95be37
--- /dev/null
+++ b/surfaces/gui/src/gallery/scenarios/scenarios.test.ts
@@ -0,0 +1,43 @@
+// Scenario files are data the real app boots on, so a malformed one fails silently in the
+// browser. These checks catch the mistakes that would: ids, session wiring, and a
+// transcript the app's own message parser accepts.
+import { describe, expect, it } from "vitest";
+
+import { itemsFromMessages } from "../../itemsFromMessages";
+import { SCENARIOS } from ".";
+
+describe("gallery scenarios", () => {
+ it("have unique ids and session ids", () => {
+ expect(new Set(SCENARIOS.map((s) => s.id)).size).toBe(SCENARIOS.length);
+ expect(new Set(SCENARIOS.map((s) => s.session.session_id)).size).toBe(SCENARIOS.length);
+ for (const s of SCENARIOS) expect(s.id).toMatch(/^[a-z0-9-]+$/);
+ });
+
+ for (const s of SCENARIOS) {
+ it(`${s.id}: pending items belong to the session and are pending`, () => {
+ for (const p of s.pending ?? []) {
+ expect(p.session_id).toBe(s.session.session_id);
+ expect(p.state).toBe("pending");
+ }
+ });
+
+ it(`${s.id}: the transcript parses into items, every tool call answered or last`, () => {
+ const items = itemsFromMessages(s.messages as any);
+ expect(items.length).toBeGreaterThan(0);
+ const calls = s.messages.flatMap((m: any) => (m.tool_calls ?? []).map((c: any) => c.id));
+ const answered = new Set(s.messages.filter((m: any) => m.role === "tool").map((m: any) => m.tool_call_id));
+ // Only the trailing calls may be unanswered: that is the moment the scenario freezes on.
+ const open = calls.filter((id: string) => !answered.has(id));
+ expect(open.length).toBeLessThanOrEqual(1);
+ if (open.length) expect(open[0]).toBe(calls[calls.length - 1]);
+ });
+
+ it(`${s.id}: no secrets, emails or home paths`, () => {
+ const text = JSON.stringify(s);
+ expect(text).not.toMatch(/sk-[A-Za-z0-9]{16,}|ghp_[A-Za-z0-9]{20,}|xox[bp]-|AKIA[0-9A-Z]{16}/);
+ // The export script rewrites every address to [email protected]; anything else is a leak.
+ expect(text.replace(/user@example\.com/g, "")).not.toMatch(/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[a-z]{2,}/);
+ expect(text).not.toMatch(/\/Users\/[a-z]+\//);
+ });
+ }
+});
diff --git a/surfaces/gui/src/gallery/scenarios/types.ts b/surfaces/gui/src/gallery/scenarios/types.ts
new file mode 100644
index 00000000..fedf3e75
--- /dev/null
+++ b/surfaces/gui/src/gallery/scenarios/types.ts
@@ -0,0 +1,42 @@
+// A scenario is one saved moment of a session: enough data for the REAL app to open on it
+// with no server, socket or model (card-gallery spec §5). Hand-written, or exported from a
+// real run with scripts/export-scenario.py.
+import type { Board, ConversationMessage, InboxItem } from "../../api";
+
+export interface ScenarioWorker {
+ name: string;
+ persona: string;
+ model?: string;
+ /** Board status shown on the Team panel: idle | in_progress | blocked | review… */
+ status?: string;
+ current_item?: string;
+ /** Persisted per-model token totals, as /v1/sessions reports them. */
+ usage?: Record<string, { input: number; output: number; cache_read: number; cache_write: number; turns: number }>;
+}
+
+export interface Scenario {
+ id: string;
+ title: string;
+ /** One line on what this moment shows. */
+ note?: string;
+ session: {
+ session_id: string;
+ title: string;
+ agent: string;
+ model: string;
+ mode: string;
+ workspace?: string;
+ /** Approvals go to the Inbox; the waiting card then comes from `pending`. */
+ unattended?: boolean;
+ machine?: string;
+ };
+ /** The stored transcript, exactly as GET /v1/sessions/{id}/messages returns it. */
+ messages: ConversationMessage[];
+ /** The session's wait queue: pending Inbox items (approval, gate, question…). */
+ pending?: InboxItem[];
+ /** Websocket events replayed after `ready` — how an ATTENDED session shows a live card. */
+ events?: { type: string; data: Record<string, unknown> }[];
+ /** Right-rail data. */
+ team?: { team_id: string; chat_enabled?: boolean; workers: ScenarioWorker[] };
+ board?: Board;
+}
diff --git a/surfaces/gui/src/gallery/states.contract.json b/surfaces/gui/src/gallery/states.contract.json
new file mode 100644
index 00000000..2db9e10d
--- /dev/null
+++ b/surfaces/gui/src/gallery/states.contract.json
@@ -0,0 +1,5085 @@
+{
+ "note": "GENERATED — run `npm run gallery:contract`; do not edit",
+ "cards": {
+ "approval": {
+ "event": "permission_required",
+ "canonical": "shell-command",
+ "states": {
+ "shell-command": {
+ "name": "run_shell",
+ "arguments": {
+ "command": "npm test -- --run invoices"
+ },
+ "reason": "Run the API tests for the new route",
+ "category": "shell"
+ },
+ "read-only-command": {
+ "name": "run_shell",
+ "arguments": {
+ "command": "ls"
+ },
+ "reason": "The coworker wants to run a command.",
+ "readonly_ok": true
+ },
+ "reviewer-unsure": {
+ "name": "run_shell",
+ "arguments": {
+ "command": "python3 helper.py"
+ },
+ "reason": "requires approval",
+ "reviewer_unsure": "This runs a newly created script whose effects cannot be determined from the command."
+ },
+ "provenance-warning": {
+ "name": "run_shell",
+ "arguments": {
+ "command": "python3 scripts/backfill_pdf_keys.py --apply"
+ },
+ "reason": "Backfill the missing keys",
+ "category": "shell",
+ "provenance": "backfill_pdf_keys.py was created by the agent 3 steps ago"
+ },
+ "write-file": {
+ "name": "write_file",
+ "arguments": {
+ "path": "src/fetch_data.py",
+ "content": "import json\nimport urllib.request\n\ncompanies = [\"NVDA\", \"AMD\"]\nprint(len(companies))\ndone = True"
+ },
+ "reason": ""
+ },
+ "web-fetch": {
+ "name": "web_fetch",
+ "arguments": {
+ "url": "https://docs.stripe.com/api/invoices/object"
+ },
+ "reason": "Check the invoice object's PDF field",
+ "category": "network"
+ },
+ "connector-action": {
+ "name": "github_create_pull_request",
+ "arguments": {
+ "repo": "acme/billing-service",
+ "title": "Invoice PDF download",
+ "base": "main",
+ "head": "lead/invoice-pdf"
+ },
+ "reason": "Open the pull request for issue #3",
+ "category": "connector"
+ },
+ "automation-run": {
+ "name": "send_message",
+ "arguments": {
+ "target": "slack:T1/C1",
+ "text": "Weekly digest ready"
+ },
+ "reason": "",
+ "category": "messaging",
+ "standing_target": "slack:T1/C1"
+ },
+ "long-message": {
+ "name": "send_message",
+ "arguments": {
+ "target": "slack:T1/C1",
+ "text": "aisuite — last 24 hours of work (through Jul 15): 5 PRs merged covering chat-completion streaming with unified chunks across providers, multimodal input conversion, Slack collaboration improvements, human attribution for outbound posts, and repo-wide formatting. aisuite — last 24 hours of work (through Jul 15): 5 PRs merged covering chat-completion streaming with unified chunks across providers, multimodal input conversion, Slack collaboration improvements, human attribution for outbound posts, and repo-wide formatting. aisuite — last 24 hours of work (through Jul 15): 5 PRs merged covering chat-completion streaming with unified chunks across providers, multimodal input conversion, Slack collaboration improvements, human attribution for outbound posts, and repo-wide formatting. aisuite — last 24 hours of work (through Jul 15): 5 PRs merged covering chat-completion streaming with unified chunks across providers, multimodal input conversion, Slack collaboration improvements, human attribution for outbound posts, and repo-wide formatting. aisuite — last 24 hours of work (through Jul 15): 5 PRs merged covering chat-completion streaming with unified chunks across providers, multimodal input conversion, Slack collaboration improvements, human attribution for outbound posts, and repo-wide formatting. aisuite — last 24 hours of work (through Jul 15): 5 PRs merged covering chat-completion streaming with unified chunks across providers, multimodal input conversion, Slack collaboration improvements, human attribution for outbound posts, and repo-wide formatting. "
+ },
+ "reason": "",
+ "category": "messaging"
+ },
+ "automation-consent": {
+ "name": "create_scheduled_task",
+ "arguments": {
+ "title": "Weekly digest",
+ "instructions": "Summarize the week and post it.",
+ "cron": "0 9 * * 1",
+ "permissions": [
+ {
+ "tool": "send_message",
+ "target": "slack:T1/C1",
+ "access": "write"
+ },
+ {
+ "tool": "github_list_commits",
+ "target": "rohit/agent-platform",
+ "access": "read"
+ }
+ ]
+ },
+ "reason": "",
+ "category": "automation"
+ },
+ "long-command": {
+ "name": "run_shell",
+ "arguments": {
+ "command": "set -euo pipefail\ncd infra\nterraform init -backend-config=envs/demo.backend.hcl\nterraform plan -var-file=envs/demo.tfvars -out=plan.bin\nterraform show -json plan.bin > plan.json\njq '[.resource_changes[] | select(.change.actions | index(\"delete\"))] | length' plan.json\nterraform apply plan.bin"
+ },
+ "reason": "Apply the bucket policy change",
+ "category": "shell"
+ },
+ "minimal": {
+ "name": "run_shell",
+ "arguments": {
+ "command": "ls"
+ }
+ }
+ },
+ "inbox": {
+ "shell-command": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "approval",
+ "title": "Run `run_shell`?",
+ "body": "Run the API tests for the new route",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "tool": "run_shell",
+ "arguments": {
+ "command": "npm test -- --run invoices"
+ }
+ }
+ },
+ "read-only-command": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "approval",
+ "title": "Run `run_shell`?",
+ "body": "The coworker wants to run a command.",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "tool": "run_shell",
+ "arguments": {
+ "command": "ls"
+ }
+ }
+ },
+ "reviewer-unsure": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "approval",
+ "title": "Run `run_shell`?",
+ "body": "requires approval",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "tool": "run_shell",
+ "arguments": {
+ "command": "python3 helper.py"
+ }
+ }
+ },
+ "provenance-warning": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "approval",
+ "title": "Run `run_shell`?",
+ "body": "Backfill the missing keys",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "tool": "run_shell",
+ "arguments": {
+ "command": "python3 scripts/backfill_pdf_keys.py --apply"
+ }
+ }
+ },
+ "write-file": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "approval",
+ "title": "Run `write_file`?",
+ "body": "",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "tool": "write_file",
+ "arguments": {
+ "path": "src/fetch_data.py",
+ "content": "import json\nimport urllib.request\n\ncompanies = [\"NVDA\", \"AMD\"]\nprint(len(companies))\ndone = True"
+ }
+ }
+ },
+ "web-fetch": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "approval",
+ "title": "Run `web_fetch`?",
+ "body": "Check the invoice object's PDF field",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "tool": "web_fetch",
+ "arguments": {
+ "url": "https://docs.stripe.com/api/invoices/object"
+ }
+ }
+ },
+ "connector-action": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "approval",
+ "title": "Run `github_create_pull_request`?",
+ "body": "Open the pull request for issue #3",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "tool": "github_create_pull_request",
+ "arguments": {
+ "repo": "acme/billing-service",
+ "title": "Invoice PDF download",
+ "base": "main",
+ "head": "lead/invoice-pdf"
+ }
+ }
+ },
+ "automation-run": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "approval",
+ "title": "Run `send_message`?",
+ "body": "",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "tool": "send_message",
+ "arguments": {
+ "target": "slack:T1/C1",
+ "text": "Weekly digest ready"
+ },
+ "task_id": "task-7f2c",
+ "task_title": "Weekly digest",
+ "standing_target": "slack:T1/C1"
+ }
+ },
+ "long-message": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "approval",
+ "title": "Run `send_message`?",
+ "body": "",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "tool": "send_message",
+ "arguments": {
+ "target": "slack:T1/C1",
+ "text": "aisuite — last 24 hours of work (through Jul 15): 5 PRs merged covering chat-completion streaming with unified chunks across providers, multimodal input conversion, Slack collaboration improvements, human attribution for outbound posts, and repo-wide formatting. aisuite — last 24 hours of work (through Jul 15): 5 PRs merged covering chat-completion streaming with unified chunks across providers, multimodal input conversion, Slack collaboration improvements, human attribution for outbound posts, and repo-wide formatting. aisuite — last 24 hours of work (through Jul 15): 5 PRs merged covering chat-completion streaming with unified chunks across providers, multimodal input conversion, Slack collaboration improvements, human attribution for outbound posts, and repo-wide formatting. aisuite — last 24 hours of work (through Jul 15): 5 PRs merged covering chat-completion streaming with unified chunks across providers, multimodal input conversion, Slack collaboration improvements, human attribution for outbound posts, and repo-wide formatting. aisuite — last 24 hours of work (through Jul 15): 5 PRs merged covering chat-completion streaming with unified chunks across providers, multimodal input conversion, Slack collaboration improvements, human attribution for outbound posts, and repo-wide formatting. aisuite — last 24 hours of work (through Jul 15): 5 PRs merged covering chat-completion streaming with unified chunks across providers, multimodal input conversion, Slack collaboration improvements, human attribution for outbound posts, and repo-wide formatting. "
+ }
+ }
+ },
+ "automation-consent": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "approval",
+ "title": "Run `create_scheduled_task`?",
+ "body": "",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "tool": "create_scheduled_task",
+ "arguments": {
+ "title": "Weekly digest",
+ "instructions": "Summarize the week and post it.",
+ "cron": "0 9 * * 1",
+ "permissions": [
+ {
+ "tool": "send_message",
+ "target": "slack:T1/C1",
+ "access": "write"
+ },
+ {
+ "tool": "github_list_commits",
+ "target": "rohit/agent-platform",
+ "access": "read"
+ }
+ ]
+ }
+ }
+ },
+ "long-command": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "approval",
+ "title": "Run `run_shell`?",
+ "body": "Apply the bucket policy change",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "tool": "run_shell",
+ "arguments": {
+ "command": "set -euo pipefail\ncd infra\nterraform init -backend-config=envs/demo.backend.hcl\nterraform plan -var-file=envs/demo.tfvars -out=plan.bin\nterraform show -json plan.bin > plan.json\njq '[.resource_changes[] | select(.change.actions | index(\"delete\"))] | length' plan.json\nterraform apply plan.bin"
+ }
+ }
+ },
+ "minimal": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "approval",
+ "title": "Run `run_shell`?",
+ "body": "",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "tool": "run_shell",
+ "arguments": {
+ "command": "ls"
+ }
+ }
+ }
+ }
+ },
+ "plan": {
+ "event": "plan_proposed",
+ "canonical": "short-plan",
+ "states": {
+ "short-plan": {
+ "plan": "1. Add `GET /invoices/:id/pdf` to the API.\n2. Add the download button to the invoice drawer.\n3. Write tests for both and run the suites."
+ },
+ "long-plan": {
+ "plan": "## Goal\nEvery invoice gets a PDF download.\n\n## Steps\n1. **API** — add `GET /invoices/:id/pdf`. Stream the file from S3 with the billing role.\n - 404 when `pdf_key` is null\n - 403 for another account's invoice\n2. **Worker** — backfill statements for seeded invoices:\n\n```bash\npython -m worker statements --missing-only\n```\n\n3. **Web** — a download button in the invoice drawer, disabled while the statement renders.\n4. **Tests** — API (happy path, missing file, foreign account), UI (button and error toast).\n\n## Risks\n- The bucket policy in `infra/storage.tf` is wider than it should be; I will not touch it in this change.\n- Rendering is slow for accounts with more than 500 meters.\n\n## Out of scope\nEmailing the PDF."
+ },
+ "minimal": {
+ "plan": ""
+ }
+ },
+ "inbox": {
+ "short-plan": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "plan",
+ "title": "Approve the plan?",
+ "body": "1. Add `GET /invoices/:id/pdf` to the API.\n2. Add the download button to the invoice drawer.\n3. Write tests for both and run the suites.",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true
+ },
+ "long-plan": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "plan",
+ "title": "Approve the plan?",
+ "body": "## Goal\nEvery invoice gets a PDF download.\n\n## Steps\n1. **API** — add `GET /invoices/:id/pdf`. Stream the file from S3 with the billing role.\n - 404 when `pdf_key` is null\n - 403 for another account's invoice\n2. **Worker** — backfill statements for seeded invoices:\n\n```bash\npython -m worker statements --missing-only\n```\n\n3. **Web** — a download button in the invoice drawer, disabled while the statement renders.\n4. **Tests** — API (happy path, missing file, foreign account), UI (button and error toast).\n\n## Risks\n- The bucket policy in `infra/storage.tf` is wider than it should be; I will not touch it in this change.\n- Rendering is slow for accounts with more than 500 meters.\n\n## Out of scope\nEmailing the PDF.",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true
+ },
+ "minimal": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "plan",
+ "title": "Approve the plan?",
+ "body": "",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true
+ }
+ }
+ },
+ "team-request": {
+ "event": "team_proposed",
+ "canonical": "lead-suggested-github",
+ "states": {
+ "lead-suggested-github": {
+ "lead_mode": "auto-approve",
+ "lead_model": "anthropic:claude-sonnet-4-8",
+ "runnable_models": [
+ {
+ "id": "anthropic:claude-opus-4-8",
+ "label": "Claude Opus 4.8"
+ },
+ {
+ "id": "anthropic:claude-sonnet-4-8",
+ "label": "Claude Sonnet 4.8"
+ },
+ {
+ "id": "openai:gpt-5.2",
+ "label": "GPT-5.2"
+ },
+ {
+ "id": "ollama:qwen3-coder:30b",
+ "label": "Qwen3 Coder 30B (local)"
+ }
+ ],
+ "model_options": {
+ "swe-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "test-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "review-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "docs-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ]
+ },
+ "members": [
+ {
+ "persona": "swe-worker",
+ "name": "nia",
+ "reason": "Builds the PDF endpoint and the download button",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes the branch and opens the PR"
+ }
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks",
+ "reason": "Writes the API and UI tests, runs the suite",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ }
+ ],
+ "offer": {
+ "swe-worker": [
+ "github"
+ ],
+ "test-worker": [
+ "github"
+ ]
+ },
+ "other_connected": [
+ "linear",
+ "slack"
+ ],
+ "enable_chat": false,
+ "note": "Two workers: one builds, one verifies."
+ },
+ "nothing-suggested": {
+ "lead_mode": "auto-approve",
+ "lead_model": "anthropic:claude-sonnet-4-8",
+ "runnable_models": [
+ {
+ "id": "anthropic:claude-opus-4-8",
+ "label": "Claude Opus 4.8"
+ },
+ {
+ "id": "anthropic:claude-sonnet-4-8",
+ "label": "Claude Sonnet 4.8"
+ },
+ {
+ "id": "openai:gpt-5.2",
+ "label": "GPT-5.2"
+ },
+ {
+ "id": "ollama:qwen3-coder:30b",
+ "label": "Qwen3 Coder 30B (local)"
+ }
+ ],
+ "model_options": {
+ "swe-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "test-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "review-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "docs-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ]
+ },
+ "members": [
+ {
+ "persona": "swe-worker",
+ "name": "nia",
+ "reason": "Builds the PDF endpoint and the download button",
+ "resolved_model": "anthropic:claude-opus-4-8"
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks",
+ "reason": "Writes the API and UI tests, runs the suite",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ }
+ ],
+ "offer": {
+ "swe-worker": [
+ "github"
+ ],
+ "test-worker": [
+ "github"
+ ]
+ },
+ "other_connected": [
+ "linear"
+ ],
+ "enable_chat": false,
+ "note": ""
+ },
+ "beyond-usual-set": {
+ "lead_mode": "auto-approve",
+ "lead_model": "anthropic:claude-sonnet-4-8",
+ "runnable_models": [
+ {
+ "id": "anthropic:claude-opus-4-8",
+ "label": "Claude Opus 4.8"
+ },
+ {
+ "id": "anthropic:claude-sonnet-4-8",
+ "label": "Claude Sonnet 4.8"
+ },
+ {
+ "id": "openai:gpt-5.2",
+ "label": "GPT-5.2"
+ },
+ {
+ "id": "ollama:qwen3-coder:30b",
+ "label": "Qwen3 Coder 30B (local)"
+ }
+ ],
+ "model_options": {
+ "swe-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "test-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "review-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "docs-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ]
+ },
+ "members": [
+ {
+ "persona": "swe-worker",
+ "name": "nia",
+ "reason": "Builds the PDF endpoint and the download button",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github",
+ "jira"
+ ],
+ "connector_reasons": {
+ "github": "pushes the branch and opens the PR",
+ "jira": "you asked: \"track the work in Jira, ticket BILL-212\""
+ }
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks",
+ "reason": "Writes the API and UI tests, runs the suite",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ }
+ ],
+ "offer": {
+ "swe-worker": [
+ "github"
+ ],
+ "test-worker": [
+ "github"
+ ]
+ },
+ "other_connected": [
+ "jira",
+ "linear",
+ "slack"
+ ],
+ "enable_chat": true,
+ "note": "nia updates BILL-212 as the work moves."
+ },
+ "no-connectors-available": {
+ "lead_mode": "auto-approve",
+ "lead_model": "anthropic:claude-sonnet-4-8",
+ "runnable_models": [
+ {
+ "id": "anthropic:claude-opus-4-8",
+ "label": "Claude Opus 4.8"
+ },
+ {
+ "id": "anthropic:claude-sonnet-4-8",
+ "label": "Claude Sonnet 4.8"
+ },
+ {
+ "id": "openai:gpt-5.2",
+ "label": "GPT-5.2"
+ },
+ {
+ "id": "ollama:qwen3-coder:30b",
+ "label": "Qwen3 Coder 30B (local)"
+ }
+ ],
+ "model_options": {
+ "swe-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "test-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "review-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "docs-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ]
+ },
+ "members": [
+ {
+ "persona": "swe-worker",
+ "name": "nia",
+ "reason": "Builds the PDF endpoint and the download button",
+ "resolved_model": "anthropic:claude-opus-4-8"
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks",
+ "reason": "Writes the API and UI tests, runs the suite",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ }
+ ],
+ "offer": {
+ "swe-worker": [],
+ "test-worker": []
+ },
+ "other_connected": [],
+ "enable_chat": false,
+ "note": ""
+ },
+ "model-fallback": {
+ "members": [
+ {
+ "persona": "swe-worker",
+ "name": "nia",
+ "model": "anthropic:claude-opus-4-8",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "reason": "implementation",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes the branch and opens the PR"
+ }
+ },
+ {
+ "persona": "design-worker",
+ "name": "webb",
+ "model": "anthropic:claude-sonnet-4-8",
+ "resolved_model": "anthropic:claude-sonnet-4-8",
+ "reason": "UI polish"
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks",
+ "model": "anthropic:claude-sonnet-4-8",
+ "resolved_model": "anthropic:claude-sonnet-4-8",
+ "model_warning": "None of test-worker's recommended models can run on this machine, so checks will use the lead's model (Claude Sonnet 4.8).",
+ "reason": "verifies against acceptance criteria"
+ }
+ ],
+ "enable_chat": false,
+ "note": "Three workers cover the plan; checks verifies before anything closes.",
+ "offer": {
+ "swe-worker": [
+ "github"
+ ],
+ "design-worker": [],
+ "test-worker": [
+ "github"
+ ]
+ },
+ "other_connected": [
+ "linear"
+ ],
+ "lead_mode": "interactive",
+ "model_options": {
+ "swe-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "design-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "test-worker": []
+ },
+ "runnable_models": [
+ {
+ "id": "anthropic:claude-opus-4-8",
+ "label": "Claude Opus 4.8"
+ },
+ {
+ "id": "anthropic:claude-sonnet-4-8",
+ "label": "Claude Sonnet 4.8"
+ },
+ {
+ "id": "anthropic:claude-haiku-4-8",
+ "label": "Claude Haiku 4.8"
+ }
+ ],
+ "lead_model": "anthropic:claude-sonnet-4-8"
+ },
+ "non-recommended-model": {
+ "lead_mode": "auto-approve",
+ "lead_model": "anthropic:claude-sonnet-4-8",
+ "runnable_models": [
+ {
+ "id": "anthropic:claude-opus-4-8",
+ "label": "Claude Opus 4.8"
+ },
+ {
+ "id": "anthropic:claude-sonnet-4-8",
+ "label": "Claude Sonnet 4.8"
+ },
+ {
+ "id": "openai:gpt-5.2",
+ "label": "GPT-5.2"
+ },
+ {
+ "id": "ollama:qwen3-coder:30b",
+ "label": "Qwen3 Coder 30B (local)"
+ }
+ ],
+ "model_options": {
+ "swe-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "test-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "review-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "docs-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ]
+ },
+ "members": [
+ {
+ "persona": "swe-worker",
+ "name": "nia",
+ "reason": "Builds the PDF endpoint and the download button",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "model": "ollama:qwen3-coder:30b"
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks",
+ "reason": "Writes the API and UI tests, runs the suite",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ }
+ ],
+ "offer": {
+ "swe-worker": [
+ "github"
+ ],
+ "test-worker": [
+ "github"
+ ]
+ },
+ "other_connected": [],
+ "enable_chat": false,
+ "note": ""
+ },
+ "old-server": {
+ "members": [
+ {
+ "persona": "swe-worker",
+ "name": "nia",
+ "reason": "Builds it"
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks",
+ "reason": "Verifies it"
+ }
+ ],
+ "offer": {
+ "swe-worker": [
+ "github"
+ ],
+ "test-worker": []
+ },
+ "enable_chat": false,
+ "note": ""
+ },
+ "old-server-raw-model-ids": {
+ "members": [
+ {
+ "persona": "swe-worker",
+ "name": "nia",
+ "model": "anthropic:claude-opus-4-8",
+ "reason": "Implements the api/ authorization fix and the web/ button gating for issue #3."
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks",
+ "model": "anthropic:claude-opus-4-8",
+ "reason": "Independently verifies the fix and proves the 403 + owner/staff paths with API tests."
+ }
+ ],
+ "offer": {
+ "swe-worker": [
+ "github"
+ ],
+ "test-worker": [
+ "github"
+ ]
+ },
+ "enable_chat": true,
+ "note": "Two workers for issue #3, as requested: nia implements the api/ + web/ fix, checks independently proves the 403 and owner/staff paths with API tests. Chat enabled so nia and checks can align on handler status codes."
+ },
+ "unknown-lead-mode": {
+ "lead_model": "anthropic:claude-sonnet-4-8",
+ "runnable_models": [
+ {
+ "id": "anthropic:claude-opus-4-8",
+ "label": "Claude Opus 4.8"
+ },
+ {
+ "id": "anthropic:claude-sonnet-4-8",
+ "label": "Claude Sonnet 4.8"
+ },
+ {
+ "id": "openai:gpt-5.2",
+ "label": "GPT-5.2"
+ },
+ {
+ "id": "ollama:qwen3-coder:30b",
+ "label": "Qwen3 Coder 30B (local)"
+ }
+ ],
+ "model_options": {
+ "swe-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "test-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "review-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "docs-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ]
+ },
+ "members": [
+ {
+ "persona": "swe-worker",
+ "name": "nia",
+ "reason": "Builds the PDF endpoint and the download button",
+ "resolved_model": "anthropic:claude-opus-4-8"
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks",
+ "reason": "Writes the API and UI tests, runs the suite",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ }
+ ],
+ "offer": {
+ "swe-worker": [
+ "github"
+ ],
+ "test-worker": [
+ "github"
+ ]
+ },
+ "other_connected": [],
+ "enable_chat": false,
+ "note": ""
+ },
+ "long-note": {
+ "lead_mode": "auto-approve",
+ "lead_model": "anthropic:claude-sonnet-4-8",
+ "runnable_models": [
+ {
+ "id": "anthropic:claude-opus-4-8",
+ "label": "Claude Opus 4.8"
+ },
+ {
+ "id": "anthropic:claude-sonnet-4-8",
+ "label": "Claude Sonnet 4.8"
+ },
+ {
+ "id": "openai:gpt-5.2",
+ "label": "GPT-5.2"
+ },
+ {
+ "id": "ollama:qwen3-coder:30b",
+ "label": "Qwen3 Coder 30B (local)"
+ }
+ ],
+ "model_options": {
+ "swe-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "test-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "review-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "docs-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ]
+ },
+ "members": [
+ {
+ "persona": "swe-worker",
+ "name": "nia",
+ "reason": "Builds the PDF endpoint and the download button",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes the branch and opens the PR"
+ }
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks",
+ "reason": "Writes the API and UI tests, runs the suite",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ }
+ ],
+ "offer": {
+ "swe-worker": [
+ "github"
+ ],
+ "test-worker": [
+ "github"
+ ]
+ },
+ "other_connected": [
+ "linear"
+ ],
+ "enable_chat": true,
+ "note": "The issue asks for a PDF download on every invoice. nia adds GET /invoices/:id/pdf to the API, streams the stored statement from S3 with the billing role, and adds the button to the invoice drawer. checks writes API tests for the happy path, a missing file and a foreign account, plus a UI test for the button, then runs all three suites. I review both branches and open one pull request against main when the suite is green."
+ },
+ "one-worker": {
+ "lead_mode": "auto-approve",
+ "lead_model": "anthropic:claude-sonnet-4-8",
+ "runnable_models": [
+ {
+ "id": "anthropic:claude-opus-4-8",
+ "label": "Claude Opus 4.8"
+ },
+ {
+ "id": "anthropic:claude-sonnet-4-8",
+ "label": "Claude Sonnet 4.8"
+ },
+ {
+ "id": "openai:gpt-5.2",
+ "label": "GPT-5.2"
+ },
+ {
+ "id": "ollama:qwen3-coder:30b",
+ "label": "Qwen3 Coder 30B (local)"
+ }
+ ],
+ "model_options": {
+ "swe-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "test-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "review-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "docs-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ]
+ },
+ "members": [
+ {
+ "persona": "swe-worker",
+ "name": "nia",
+ "reason": "Builds the PDF endpoint and the download button",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes the branch and opens the PR"
+ }
+ }
+ ],
+ "offer": {
+ "swe-worker": [
+ "github"
+ ]
+ },
+ "other_connected": [],
+ "enable_chat": false,
+ "note": "Small change; one worker is enough."
+ },
+ "six-workers": {
+ "lead_mode": "auto-approve",
+ "lead_model": "anthropic:claude-sonnet-4-8",
+ "runnable_models": [
+ {
+ "id": "anthropic:claude-opus-4-8",
+ "label": "Claude Opus 4.8"
+ },
+ {
+ "id": "anthropic:claude-sonnet-4-8",
+ "label": "Claude Sonnet 4.8"
+ },
+ {
+ "id": "openai:gpt-5.2",
+ "label": "GPT-5.2"
+ },
+ {
+ "id": "ollama:qwen3-coder:30b",
+ "label": "Qwen3 Coder 30B (local)"
+ }
+ ],
+ "model_options": {
+ "swe-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "test-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "review-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "docs-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ]
+ },
+ "members": [
+ {
+ "persona": "swe-worker",
+ "name": "nia",
+ "reason": "Builds the PDF endpoint and the download button",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes the API branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "omar",
+ "reason": "Builds the web client changes",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes the web branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "lena",
+ "reason": "Updates the statements worker",
+ "resolved_model": "anthropic:claude-opus-4-8"
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks",
+ "reason": "Writes the API and UI tests, runs the suite",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ },
+ {
+ "persona": "review-worker",
+ "name": "second-look",
+ "reason": "Reviews the three branches before the PR",
+ "resolved_model": "anthropic:claude-opus-4-8"
+ },
+ {
+ "persona": "docs-worker",
+ "name": "scribe",
+ "reason": "Updates the runbook and the API spec",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ }
+ ],
+ "offer": {
+ "swe-worker": [
+ "github"
+ ],
+ "test-worker": [
+ "github"
+ ],
+ "review-worker": [
+ "github"
+ ],
+ "docs-worker": []
+ },
+ "other_connected": [
+ "linear",
+ "slack"
+ ],
+ "enable_chat": true,
+ "note": "Three builders in parallel, then tests, review and docs."
+ },
+ "twelve-workers": {
+ "lead_mode": "auto-approve",
+ "lead_model": "anthropic:claude-sonnet-4-8",
+ "runnable_models": [
+ {
+ "id": "anthropic:claude-opus-4-8",
+ "label": "Claude Opus 4.8"
+ },
+ {
+ "id": "anthropic:claude-sonnet-4-8",
+ "label": "Claude Sonnet 4.8"
+ },
+ {
+ "id": "openai:gpt-5.2",
+ "label": "GPT-5.2"
+ },
+ {
+ "id": "ollama:qwen3-coder:30b",
+ "label": "Qwen3 Coder 30B (local)"
+ }
+ ],
+ "model_options": {
+ "swe-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "test-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "review-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "docs-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ]
+ },
+ "members": [
+ {
+ "persona": "swe-worker",
+ "name": "nia",
+ "reason": "Builds the invoice PDF route",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "omar",
+ "reason": "Builds the statement renderer",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "lena",
+ "reason": "Builds the rate limiting on the PDF route",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "kofi",
+ "reason": "Builds the download button",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "mei",
+ "reason": "Builds the error toasts",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "ravi",
+ "reason": "Builds the meter import job",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks-1",
+ "reason": "Tests builders 1 and 2",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks-2",
+ "reason": "Tests builders 3 and 4",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks-3",
+ "reason": "Tests builders 5 and 6",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ },
+ {
+ "persona": "review-worker",
+ "name": "second-look-1",
+ "reason": "Reviews finished branches before the PR",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "comments on the branch diff"
+ }
+ },
+ {
+ "persona": "review-worker",
+ "name": "second-look-2",
+ "reason": "Reviews finished branches before the PR",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "comments on the branch diff"
+ }
+ },
+ {
+ "persona": "docs-worker",
+ "name": "scribe",
+ "reason": "Keeps the runbook and the API spec current",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ }
+ ],
+ "offer": {
+ "swe-worker": [
+ "github"
+ ],
+ "test-worker": [
+ "github"
+ ],
+ "review-worker": [
+ "github"
+ ],
+ "docs-worker": []
+ },
+ "other_connected": [
+ "linear",
+ "slack"
+ ],
+ "enable_chat": true,
+ "note": "Six builders in parallel, one tester per two builders, two reviewers, one writer."
+ },
+ "twenty-four-workers": {
+ "lead_mode": "auto-approve",
+ "lead_model": "anthropic:claude-sonnet-4-8",
+ "runnable_models": [
+ {
+ "id": "anthropic:claude-opus-4-8",
+ "label": "Claude Opus 4.8"
+ },
+ {
+ "id": "anthropic:claude-sonnet-4-8",
+ "label": "Claude Sonnet 4.8"
+ },
+ {
+ "id": "openai:gpt-5.2",
+ "label": "GPT-5.2"
+ },
+ {
+ "id": "ollama:qwen3-coder:30b",
+ "label": "Qwen3 Coder 30B (local)"
+ }
+ ],
+ "model_options": {
+ "swe-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "test-worker": [],
+ "review-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "docs-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ]
+ },
+ "members": [
+ {
+ "persona": "swe-worker",
+ "name": "nia",
+ "reason": "Builds the invoice PDF route",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "omar",
+ "reason": "Builds the statement renderer",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "lena",
+ "reason": "Builds the rate limiting on the PDF route",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "kofi",
+ "reason": "Builds the download button",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "mei",
+ "reason": "Builds the error toasts",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "ravi",
+ "reason": "Builds the meter import job",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "sara",
+ "reason": "Builds the usage rollups",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "tomas",
+ "reason": "Builds the tariff table migration",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "yuki",
+ "reason": "Builds the account search",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "amara",
+ "reason": "Builds the CSV export",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "dev",
+ "reason": "Builds the audit log for downloads",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "elif",
+ "reason": "Builds the retry policy for S3 reads",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks-1",
+ "reason": "Tests builders 1 and 2",
+ "resolved_model": "anthropic:claude-sonnet-4-8",
+ "model_warning": "None of test-worker's recommended models can run on this machine. It will use the lead's model, Claude Sonnet 4.8."
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks-2",
+ "reason": "Tests builders 3 and 4",
+ "resolved_model": "anthropic:claude-sonnet-4-8",
+ "model_warning": "None of test-worker's recommended models can run on this machine. It will use the lead's model, Claude Sonnet 4.8."
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks-3",
+ "reason": "Tests builders 5 and 6",
+ "resolved_model": "anthropic:claude-sonnet-4-8",
+ "model_warning": "None of test-worker's recommended models can run on this machine. It will use the lead's model, Claude Sonnet 4.8."
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks-4",
+ "reason": "Tests builders 7 and 8",
+ "resolved_model": "anthropic:claude-sonnet-4-8",
+ "model_warning": "None of test-worker's recommended models can run on this machine. It will use the lead's model, Claude Sonnet 4.8."
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks-5",
+ "reason": "Tests builders 9 and 10",
+ "resolved_model": "anthropic:claude-sonnet-4-8",
+ "model_warning": "None of test-worker's recommended models can run on this machine. It will use the lead's model, Claude Sonnet 4.8."
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks-6",
+ "reason": "Tests builders 11 and 12",
+ "resolved_model": "anthropic:claude-sonnet-4-8",
+ "model_warning": "None of test-worker's recommended models can run on this machine. It will use the lead's model, Claude Sonnet 4.8."
+ },
+ {
+ "persona": "review-worker",
+ "name": "second-look-1",
+ "reason": "Reviews finished branches before the PR",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "comments on the branch diff"
+ }
+ },
+ {
+ "persona": "review-worker",
+ "name": "second-look-2",
+ "reason": "Reviews finished branches before the PR",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "comments on the branch diff"
+ }
+ },
+ {
+ "persona": "review-worker",
+ "name": "second-look-3",
+ "reason": "Reviews finished branches before the PR",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "comments on the branch diff"
+ }
+ },
+ {
+ "persona": "review-worker",
+ "name": "second-look-4",
+ "reason": "Reviews finished branches before the PR",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "comments on the branch diff"
+ }
+ },
+ {
+ "persona": "docs-worker",
+ "name": "scribe",
+ "reason": "Keeps the runbook and the API spec current",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ },
+ {
+ "persona": "docs-worker",
+ "name": "scribe-2",
+ "reason": "Keeps the runbook and the API spec current",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ }
+ ],
+ "offer": {
+ "swe-worker": [
+ "github"
+ ],
+ "test-worker": [
+ "github"
+ ],
+ "review-worker": [
+ "github"
+ ],
+ "docs-worker": []
+ },
+ "other_connected": [
+ "linear",
+ "slack"
+ ],
+ "enable_chat": true,
+ "note": "Twelve builders, six testers, four reviewers, two writers."
+ },
+ "mixed-within-a-role": {
+ "lead_mode": "auto-approve",
+ "lead_model": "anthropic:claude-sonnet-4-8",
+ "runnable_models": [
+ {
+ "id": "anthropic:claude-opus-4-8",
+ "label": "Claude Opus 4.8"
+ },
+ {
+ "id": "anthropic:claude-sonnet-4-8",
+ "label": "Claude Sonnet 4.8"
+ },
+ {
+ "id": "openai:gpt-5.2",
+ "label": "GPT-5.2"
+ },
+ {
+ "id": "ollama:qwen3-coder:30b",
+ "label": "Qwen3 Coder 30B (local)"
+ }
+ ],
+ "model_options": {
+ "swe-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "test-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "review-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "docs-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ]
+ },
+ "members": [
+ {
+ "persona": "swe-worker",
+ "name": "nia",
+ "reason": "Builds the invoice PDF route",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "omar",
+ "reason": "Builds the statement renderer",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "lena",
+ "reason": "Builds the rate limiting on the PDF route",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "kofi",
+ "reason": "Builds the download button",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [],
+ "connector_reasons": {}
+ },
+ {
+ "persona": "swe-worker",
+ "name": "mei",
+ "reason": "Builds the error toasts (small change)",
+ "resolved_model": "anthropic:claude-sonnet-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "ravi",
+ "reason": "Builds the meter import job (small change)",
+ "resolved_model": "anthropic:claude-sonnet-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks-1",
+ "reason": "Tests builders 1 and 2",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks-2",
+ "reason": "Tests builders 3 and 4",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ }
+ ],
+ "offer": {
+ "swe-worker": [
+ "github"
+ ],
+ "test-worker": [
+ "github"
+ ],
+ "review-worker": [
+ "github"
+ ],
+ "docs-worker": []
+ },
+ "other_connected": [
+ "linear"
+ ],
+ "enable_chat": false,
+ "note": "Four builders on the larger model for the API work; two on the smaller one for copy changes."
+ }
+ },
+ "inbox": {
+ "lead-suggested-github": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "plan",
+ "title": "Create this team?",
+ "body": "- swe-worker (nia)\n- test-worker (checks)",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "gate": "team",
+ "lead_mode": "auto-approve",
+ "lead_model": "anthropic:claude-sonnet-4-8",
+ "runnable_models": [
+ {
+ "id": "anthropic:claude-opus-4-8",
+ "label": "Claude Opus 4.8"
+ },
+ {
+ "id": "anthropic:claude-sonnet-4-8",
+ "label": "Claude Sonnet 4.8"
+ },
+ {
+ "id": "openai:gpt-5.2",
+ "label": "GPT-5.2"
+ },
+ {
+ "id": "ollama:qwen3-coder:30b",
+ "label": "Qwen3 Coder 30B (local)"
+ }
+ ],
+ "model_options": {
+ "swe-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "test-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "review-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "docs-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ]
+ },
+ "members": [
+ {
+ "persona": "swe-worker",
+ "name": "nia",
+ "reason": "Builds the PDF endpoint and the download button",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes the branch and opens the PR"
+ }
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks",
+ "reason": "Writes the API and UI tests, runs the suite",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ }
+ ],
+ "offer": {
+ "swe-worker": [
+ "github"
+ ],
+ "test-worker": [
+ "github"
+ ]
+ },
+ "other_connected": [
+ "linear",
+ "slack"
+ ],
+ "enable_chat": false,
+ "note": "Two workers: one builds, one verifies."
+ }
+ },
+ "nothing-suggested": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "plan",
+ "title": "Create this team?",
+ "body": "- swe-worker (nia)\n- test-worker (checks)",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "gate": "team",
+ "lead_mode": "auto-approve",
+ "lead_model": "anthropic:claude-sonnet-4-8",
+ "runnable_models": [
+ {
+ "id": "anthropic:claude-opus-4-8",
+ "label": "Claude Opus 4.8"
+ },
+ {
+ "id": "anthropic:claude-sonnet-4-8",
+ "label": "Claude Sonnet 4.8"
+ },
+ {
+ "id": "openai:gpt-5.2",
+ "label": "GPT-5.2"
+ },
+ {
+ "id": "ollama:qwen3-coder:30b",
+ "label": "Qwen3 Coder 30B (local)"
+ }
+ ],
+ "model_options": {
+ "swe-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "test-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "review-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "docs-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ]
+ },
+ "members": [
+ {
+ "persona": "swe-worker",
+ "name": "nia",
+ "reason": "Builds the PDF endpoint and the download button",
+ "resolved_model": "anthropic:claude-opus-4-8"
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks",
+ "reason": "Writes the API and UI tests, runs the suite",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ }
+ ],
+ "offer": {
+ "swe-worker": [
+ "github"
+ ],
+ "test-worker": [
+ "github"
+ ]
+ },
+ "other_connected": [
+ "linear"
+ ],
+ "enable_chat": false,
+ "note": ""
+ }
+ },
+ "beyond-usual-set": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "plan",
+ "title": "Create this team?",
+ "body": "- swe-worker (nia)\n- test-worker (checks)",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "gate": "team",
+ "lead_mode": "auto-approve",
+ "lead_model": "anthropic:claude-sonnet-4-8",
+ "runnable_models": [
+ {
+ "id": "anthropic:claude-opus-4-8",
+ "label": "Claude Opus 4.8"
+ },
+ {
+ "id": "anthropic:claude-sonnet-4-8",
+ "label": "Claude Sonnet 4.8"
+ },
+ {
+ "id": "openai:gpt-5.2",
+ "label": "GPT-5.2"
+ },
+ {
+ "id": "ollama:qwen3-coder:30b",
+ "label": "Qwen3 Coder 30B (local)"
+ }
+ ],
+ "model_options": {
+ "swe-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "test-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "review-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "docs-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ]
+ },
+ "members": [
+ {
+ "persona": "swe-worker",
+ "name": "nia",
+ "reason": "Builds the PDF endpoint and the download button",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github",
+ "jira"
+ ],
+ "connector_reasons": {
+ "github": "pushes the branch and opens the PR",
+ "jira": "you asked: \"track the work in Jira, ticket BILL-212\""
+ }
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks",
+ "reason": "Writes the API and UI tests, runs the suite",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ }
+ ],
+ "offer": {
+ "swe-worker": [
+ "github"
+ ],
+ "test-worker": [
+ "github"
+ ]
+ },
+ "other_connected": [
+ "jira",
+ "linear",
+ "slack"
+ ],
+ "enable_chat": true,
+ "note": "nia updates BILL-212 as the work moves."
+ }
+ },
+ "no-connectors-available": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "plan",
+ "title": "Create this team?",
+ "body": "- swe-worker (nia)\n- test-worker (checks)",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "gate": "team",
+ "lead_mode": "auto-approve",
+ "lead_model": "anthropic:claude-sonnet-4-8",
+ "runnable_models": [
+ {
+ "id": "anthropic:claude-opus-4-8",
+ "label": "Claude Opus 4.8"
+ },
+ {
+ "id": "anthropic:claude-sonnet-4-8",
+ "label": "Claude Sonnet 4.8"
+ },
+ {
+ "id": "openai:gpt-5.2",
+ "label": "GPT-5.2"
+ },
+ {
+ "id": "ollama:qwen3-coder:30b",
+ "label": "Qwen3 Coder 30B (local)"
+ }
+ ],
+ "model_options": {
+ "swe-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "test-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "review-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "docs-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ]
+ },
+ "members": [
+ {
+ "persona": "swe-worker",
+ "name": "nia",
+ "reason": "Builds the PDF endpoint and the download button",
+ "resolved_model": "anthropic:claude-opus-4-8"
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks",
+ "reason": "Writes the API and UI tests, runs the suite",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ }
+ ],
+ "offer": {
+ "swe-worker": [],
+ "test-worker": []
+ },
+ "other_connected": [],
+ "enable_chat": false,
+ "note": ""
+ }
+ },
+ "model-fallback": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "plan",
+ "title": "Create this team?",
+ "body": "- swe-worker (nia)\n- design-worker (webb)\n- test-worker (checks)",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "gate": "team",
+ "members": [
+ {
+ "persona": "swe-worker",
+ "name": "nia",
+ "model": "anthropic:claude-opus-4-8",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "reason": "implementation",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes the branch and opens the PR"
+ }
+ },
+ {
+ "persona": "design-worker",
+ "name": "webb",
+ "model": "anthropic:claude-sonnet-4-8",
+ "resolved_model": "anthropic:claude-sonnet-4-8",
+ "reason": "UI polish"
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks",
+ "model": "anthropic:claude-sonnet-4-8",
+ "resolved_model": "anthropic:claude-sonnet-4-8",
+ "model_warning": "None of test-worker's recommended models can run on this machine, so checks will use the lead's model (Claude Sonnet 4.8).",
+ "reason": "verifies against acceptance criteria"
+ }
+ ],
+ "enable_chat": false,
+ "note": "Three workers cover the plan; checks verifies before anything closes.",
+ "offer": {
+ "swe-worker": [
+ "github"
+ ],
+ "design-worker": [],
+ "test-worker": [
+ "github"
+ ]
+ },
+ "other_connected": [
+ "linear"
+ ],
+ "lead_mode": "interactive",
+ "model_options": {
+ "swe-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "design-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "test-worker": []
+ },
+ "runnable_models": [
+ {
+ "id": "anthropic:claude-opus-4-8",
+ "label": "Claude Opus 4.8"
+ },
+ {
+ "id": "anthropic:claude-sonnet-4-8",
+ "label": "Claude Sonnet 4.8"
+ },
+ {
+ "id": "anthropic:claude-haiku-4-8",
+ "label": "Claude Haiku 4.8"
+ }
+ ],
+ "lead_model": "anthropic:claude-sonnet-4-8"
+ }
+ },
+ "non-recommended-model": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "plan",
+ "title": "Create this team?",
+ "body": "- swe-worker (nia)\n- test-worker (checks)",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "gate": "team",
+ "lead_mode": "auto-approve",
+ "lead_model": "anthropic:claude-sonnet-4-8",
+ "runnable_models": [
+ {
+ "id": "anthropic:claude-opus-4-8",
+ "label": "Claude Opus 4.8"
+ },
+ {
+ "id": "anthropic:claude-sonnet-4-8",
+ "label": "Claude Sonnet 4.8"
+ },
+ {
+ "id": "openai:gpt-5.2",
+ "label": "GPT-5.2"
+ },
+ {
+ "id": "ollama:qwen3-coder:30b",
+ "label": "Qwen3 Coder 30B (local)"
+ }
+ ],
+ "model_options": {
+ "swe-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "test-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "review-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "docs-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ]
+ },
+ "members": [
+ {
+ "persona": "swe-worker",
+ "name": "nia",
+ "reason": "Builds the PDF endpoint and the download button",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "model": "ollama:qwen3-coder:30b"
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks",
+ "reason": "Writes the API and UI tests, runs the suite",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ }
+ ],
+ "offer": {
+ "swe-worker": [
+ "github"
+ ],
+ "test-worker": [
+ "github"
+ ]
+ },
+ "other_connected": [],
+ "enable_chat": false,
+ "note": ""
+ }
+ },
+ "old-server": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "plan",
+ "title": "Create this team?",
+ "body": "- swe-worker (nia)\n- test-worker (checks)",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "gate": "team",
+ "members": [
+ {
+ "persona": "swe-worker",
+ "name": "nia",
+ "reason": "Builds it"
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks",
+ "reason": "Verifies it"
+ }
+ ],
+ "offer": {
+ "swe-worker": [
+ "github"
+ ],
+ "test-worker": []
+ },
+ "enable_chat": false,
+ "note": ""
+ }
+ },
+ "old-server-raw-model-ids": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "plan",
+ "title": "Create this team?",
+ "body": "- swe-worker (nia)\n- test-worker (checks)",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "gate": "team",
+ "members": [
+ {
+ "persona": "swe-worker",
+ "name": "nia",
+ "model": "anthropic:claude-opus-4-8",
+ "reason": "Implements the api/ authorization fix and the web/ button gating for issue #3."
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks",
+ "model": "anthropic:claude-opus-4-8",
+ "reason": "Independently verifies the fix and proves the 403 + owner/staff paths with API tests."
+ }
+ ],
+ "offer": {
+ "swe-worker": [
+ "github"
+ ],
+ "test-worker": [
+ "github"
+ ]
+ },
+ "enable_chat": true,
+ "note": "Two workers for issue #3, as requested: nia implements the api/ + web/ fix, checks independently proves the 403 and owner/staff paths with API tests. Chat enabled so nia and checks can align on handler status codes."
+ }
+ },
+ "unknown-lead-mode": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "plan",
+ "title": "Create this team?",
+ "body": "- swe-worker (nia)\n- test-worker (checks)",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "gate": "team",
+ "lead_model": "anthropic:claude-sonnet-4-8",
+ "runnable_models": [
+ {
+ "id": "anthropic:claude-opus-4-8",
+ "label": "Claude Opus 4.8"
+ },
+ {
+ "id": "anthropic:claude-sonnet-4-8",
+ "label": "Claude Sonnet 4.8"
+ },
+ {
+ "id": "openai:gpt-5.2",
+ "label": "GPT-5.2"
+ },
+ {
+ "id": "ollama:qwen3-coder:30b",
+ "label": "Qwen3 Coder 30B (local)"
+ }
+ ],
+ "model_options": {
+ "swe-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "test-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "review-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "docs-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ]
+ },
+ "members": [
+ {
+ "persona": "swe-worker",
+ "name": "nia",
+ "reason": "Builds the PDF endpoint and the download button",
+ "resolved_model": "anthropic:claude-opus-4-8"
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks",
+ "reason": "Writes the API and UI tests, runs the suite",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ }
+ ],
+ "offer": {
+ "swe-worker": [
+ "github"
+ ],
+ "test-worker": [
+ "github"
+ ]
+ },
+ "other_connected": [],
+ "enable_chat": false,
+ "note": ""
+ }
+ },
+ "long-note": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "plan",
+ "title": "Create this team?",
+ "body": "- swe-worker (nia)\n- test-worker (checks)",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "gate": "team",
+ "lead_mode": "auto-approve",
+ "lead_model": "anthropic:claude-sonnet-4-8",
+ "runnable_models": [
+ {
+ "id": "anthropic:claude-opus-4-8",
+ "label": "Claude Opus 4.8"
+ },
+ {
+ "id": "anthropic:claude-sonnet-4-8",
+ "label": "Claude Sonnet 4.8"
+ },
+ {
+ "id": "openai:gpt-5.2",
+ "label": "GPT-5.2"
+ },
+ {
+ "id": "ollama:qwen3-coder:30b",
+ "label": "Qwen3 Coder 30B (local)"
+ }
+ ],
+ "model_options": {
+ "swe-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "test-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "review-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "docs-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ]
+ },
+ "members": [
+ {
+ "persona": "swe-worker",
+ "name": "nia",
+ "reason": "Builds the PDF endpoint and the download button",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes the branch and opens the PR"
+ }
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks",
+ "reason": "Writes the API and UI tests, runs the suite",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ }
+ ],
+ "offer": {
+ "swe-worker": [
+ "github"
+ ],
+ "test-worker": [
+ "github"
+ ]
+ },
+ "other_connected": [
+ "linear"
+ ],
+ "enable_chat": true,
+ "note": "The issue asks for a PDF download on every invoice. nia adds GET /invoices/:id/pdf to the API, streams the stored statement from S3 with the billing role, and adds the button to the invoice drawer. checks writes API tests for the happy path, a missing file and a foreign account, plus a UI test for the button, then runs all three suites. I review both branches and open one pull request against main when the suite is green."
+ }
+ },
+ "one-worker": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "plan",
+ "title": "Create this team?",
+ "body": "- swe-worker (nia)",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "gate": "team",
+ "lead_mode": "auto-approve",
+ "lead_model": "anthropic:claude-sonnet-4-8",
+ "runnable_models": [
+ {
+ "id": "anthropic:claude-opus-4-8",
+ "label": "Claude Opus 4.8"
+ },
+ {
+ "id": "anthropic:claude-sonnet-4-8",
+ "label": "Claude Sonnet 4.8"
+ },
+ {
+ "id": "openai:gpt-5.2",
+ "label": "GPT-5.2"
+ },
+ {
+ "id": "ollama:qwen3-coder:30b",
+ "label": "Qwen3 Coder 30B (local)"
+ }
+ ],
+ "model_options": {
+ "swe-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "test-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "review-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "docs-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ]
+ },
+ "members": [
+ {
+ "persona": "swe-worker",
+ "name": "nia",
+ "reason": "Builds the PDF endpoint and the download button",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes the branch and opens the PR"
+ }
+ }
+ ],
+ "offer": {
+ "swe-worker": [
+ "github"
+ ]
+ },
+ "other_connected": [],
+ "enable_chat": false,
+ "note": "Small change; one worker is enough."
+ }
+ },
+ "six-workers": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "plan",
+ "title": "Create this team?",
+ "body": "- swe-worker (nia)\n- swe-worker (omar)\n- swe-worker (lena)\n- test-worker (checks)\n- review-worker (second-look)\n- docs-worker (scribe)",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "gate": "team",
+ "lead_mode": "auto-approve",
+ "lead_model": "anthropic:claude-sonnet-4-8",
+ "runnable_models": [
+ {
+ "id": "anthropic:claude-opus-4-8",
+ "label": "Claude Opus 4.8"
+ },
+ {
+ "id": "anthropic:claude-sonnet-4-8",
+ "label": "Claude Sonnet 4.8"
+ },
+ {
+ "id": "openai:gpt-5.2",
+ "label": "GPT-5.2"
+ },
+ {
+ "id": "ollama:qwen3-coder:30b",
+ "label": "Qwen3 Coder 30B (local)"
+ }
+ ],
+ "model_options": {
+ "swe-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "test-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "review-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "docs-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ]
+ },
+ "members": [
+ {
+ "persona": "swe-worker",
+ "name": "nia",
+ "reason": "Builds the PDF endpoint and the download button",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes the API branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "omar",
+ "reason": "Builds the web client changes",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes the web branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "lena",
+ "reason": "Updates the statements worker",
+ "resolved_model": "anthropic:claude-opus-4-8"
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks",
+ "reason": "Writes the API and UI tests, runs the suite",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ },
+ {
+ "persona": "review-worker",
+ "name": "second-look",
+ "reason": "Reviews the three branches before the PR",
+ "resolved_model": "anthropic:claude-opus-4-8"
+ },
+ {
+ "persona": "docs-worker",
+ "name": "scribe",
+ "reason": "Updates the runbook and the API spec",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ }
+ ],
+ "offer": {
+ "swe-worker": [
+ "github"
+ ],
+ "test-worker": [
+ "github"
+ ],
+ "review-worker": [
+ "github"
+ ],
+ "docs-worker": []
+ },
+ "other_connected": [
+ "linear",
+ "slack"
+ ],
+ "enable_chat": true,
+ "note": "Three builders in parallel, then tests, review and docs."
+ }
+ },
+ "twelve-workers": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "plan",
+ "title": "Create this team?",
+ "body": "- swe-worker (nia)\n- swe-worker (omar)\n- swe-worker (lena)\n- swe-worker (kofi)\n- swe-worker (mei)\n- swe-worker (ravi)\n- test-worker (checks-1)\n- test-worker (checks-2)\n- test-worker (checks-3)\n- review-worker (second-look-1)\n- review-worker (second-look-2)\n- docs-worker (scribe)",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "gate": "team",
+ "lead_mode": "auto-approve",
+ "lead_model": "anthropic:claude-sonnet-4-8",
+ "runnable_models": [
+ {
+ "id": "anthropic:claude-opus-4-8",
+ "label": "Claude Opus 4.8"
+ },
+ {
+ "id": "anthropic:claude-sonnet-4-8",
+ "label": "Claude Sonnet 4.8"
+ },
+ {
+ "id": "openai:gpt-5.2",
+ "label": "GPT-5.2"
+ },
+ {
+ "id": "ollama:qwen3-coder:30b",
+ "label": "Qwen3 Coder 30B (local)"
+ }
+ ],
+ "model_options": {
+ "swe-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "test-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "review-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "docs-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ]
+ },
+ "members": [
+ {
+ "persona": "swe-worker",
+ "name": "nia",
+ "reason": "Builds the invoice PDF route",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "omar",
+ "reason": "Builds the statement renderer",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "lena",
+ "reason": "Builds the rate limiting on the PDF route",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "kofi",
+ "reason": "Builds the download button",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "mei",
+ "reason": "Builds the error toasts",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "ravi",
+ "reason": "Builds the meter import job",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks-1",
+ "reason": "Tests builders 1 and 2",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks-2",
+ "reason": "Tests builders 3 and 4",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks-3",
+ "reason": "Tests builders 5 and 6",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ },
+ {
+ "persona": "review-worker",
+ "name": "second-look-1",
+ "reason": "Reviews finished branches before the PR",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "comments on the branch diff"
+ }
+ },
+ {
+ "persona": "review-worker",
+ "name": "second-look-2",
+ "reason": "Reviews finished branches before the PR",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "comments on the branch diff"
+ }
+ },
+ {
+ "persona": "docs-worker",
+ "name": "scribe",
+ "reason": "Keeps the runbook and the API spec current",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ }
+ ],
+ "offer": {
+ "swe-worker": [
+ "github"
+ ],
+ "test-worker": [
+ "github"
+ ],
+ "review-worker": [
+ "github"
+ ],
+ "docs-worker": []
+ },
+ "other_connected": [
+ "linear",
+ "slack"
+ ],
+ "enable_chat": true,
+ "note": "Six builders in parallel, one tester per two builders, two reviewers, one writer."
+ }
+ },
+ "twenty-four-workers": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "plan",
+ "title": "Create this team?",
+ "body": "- swe-worker (nia)\n- swe-worker (omar)\n- swe-worker (lena)\n- swe-worker (kofi)\n- swe-worker (mei)\n- swe-worker (ravi)\n- swe-worker (sara)\n- swe-worker (tomas)\n- swe-worker (yuki)\n- swe-worker (amara)\n- swe-worker (dev)\n- swe-worker (elif)\n- test-worker (checks-1)\n- test-worker (checks-2)\n- test-worker (checks-3)\n- test-worker (checks-4)\n- test-worker (checks-5)\n- test-worker (checks-6)\n- review-worker (second-look-1)\n- review-worker (second-look-2)\n- review-worker (second-look-3)\n- review-worker (second-look-4)\n- docs-worker (scribe)\n- docs-worker (scribe-2)",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "gate": "team",
+ "lead_mode": "auto-approve",
+ "lead_model": "anthropic:claude-sonnet-4-8",
+ "runnable_models": [
+ {
+ "id": "anthropic:claude-opus-4-8",
+ "label": "Claude Opus 4.8"
+ },
+ {
+ "id": "anthropic:claude-sonnet-4-8",
+ "label": "Claude Sonnet 4.8"
+ },
+ {
+ "id": "openai:gpt-5.2",
+ "label": "GPT-5.2"
+ },
+ {
+ "id": "ollama:qwen3-coder:30b",
+ "label": "Qwen3 Coder 30B (local)"
+ }
+ ],
+ "model_options": {
+ "swe-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "test-worker": [],
+ "review-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "docs-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ]
+ },
+ "members": [
+ {
+ "persona": "swe-worker",
+ "name": "nia",
+ "reason": "Builds the invoice PDF route",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "omar",
+ "reason": "Builds the statement renderer",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "lena",
+ "reason": "Builds the rate limiting on the PDF route",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "kofi",
+ "reason": "Builds the download button",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "mei",
+ "reason": "Builds the error toasts",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "ravi",
+ "reason": "Builds the meter import job",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "sara",
+ "reason": "Builds the usage rollups",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "tomas",
+ "reason": "Builds the tariff table migration",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "yuki",
+ "reason": "Builds the account search",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "amara",
+ "reason": "Builds the CSV export",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "dev",
+ "reason": "Builds the audit log for downloads",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "elif",
+ "reason": "Builds the retry policy for S3 reads",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks-1",
+ "reason": "Tests builders 1 and 2",
+ "resolved_model": "anthropic:claude-sonnet-4-8",
+ "model_warning": "None of test-worker's recommended models can run on this machine. It will use the lead's model, Claude Sonnet 4.8."
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks-2",
+ "reason": "Tests builders 3 and 4",
+ "resolved_model": "anthropic:claude-sonnet-4-8",
+ "model_warning": "None of test-worker's recommended models can run on this machine. It will use the lead's model, Claude Sonnet 4.8."
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks-3",
+ "reason": "Tests builders 5 and 6",
+ "resolved_model": "anthropic:claude-sonnet-4-8",
+ "model_warning": "None of test-worker's recommended models can run on this machine. It will use the lead's model, Claude Sonnet 4.8."
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks-4",
+ "reason": "Tests builders 7 and 8",
+ "resolved_model": "anthropic:claude-sonnet-4-8",
+ "model_warning": "None of test-worker's recommended models can run on this machine. It will use the lead's model, Claude Sonnet 4.8."
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks-5",
+ "reason": "Tests builders 9 and 10",
+ "resolved_model": "anthropic:claude-sonnet-4-8",
+ "model_warning": "None of test-worker's recommended models can run on this machine. It will use the lead's model, Claude Sonnet 4.8."
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks-6",
+ "reason": "Tests builders 11 and 12",
+ "resolved_model": "anthropic:claude-sonnet-4-8",
+ "model_warning": "None of test-worker's recommended models can run on this machine. It will use the lead's model, Claude Sonnet 4.8."
+ },
+ {
+ "persona": "review-worker",
+ "name": "second-look-1",
+ "reason": "Reviews finished branches before the PR",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "comments on the branch diff"
+ }
+ },
+ {
+ "persona": "review-worker",
+ "name": "second-look-2",
+ "reason": "Reviews finished branches before the PR",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "comments on the branch diff"
+ }
+ },
+ {
+ "persona": "review-worker",
+ "name": "second-look-3",
+ "reason": "Reviews finished branches before the PR",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "comments on the branch diff"
+ }
+ },
+ {
+ "persona": "review-worker",
+ "name": "second-look-4",
+ "reason": "Reviews finished branches before the PR",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "comments on the branch diff"
+ }
+ },
+ {
+ "persona": "docs-worker",
+ "name": "scribe",
+ "reason": "Keeps the runbook and the API spec current",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ },
+ {
+ "persona": "docs-worker",
+ "name": "scribe-2",
+ "reason": "Keeps the runbook and the API spec current",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ }
+ ],
+ "offer": {
+ "swe-worker": [
+ "github"
+ ],
+ "test-worker": [
+ "github"
+ ],
+ "review-worker": [
+ "github"
+ ],
+ "docs-worker": []
+ },
+ "other_connected": [
+ "linear",
+ "slack"
+ ],
+ "enable_chat": true,
+ "note": "Twelve builders, six testers, four reviewers, two writers."
+ }
+ },
+ "mixed-within-a-role": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "plan",
+ "title": "Create this team?",
+ "body": "- swe-worker (nia)\n- swe-worker (omar)\n- swe-worker (lena)\n- swe-worker (kofi)\n- swe-worker (mei)\n- swe-worker (ravi)\n- test-worker (checks-1)\n- test-worker (checks-2)",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "gate": "team",
+ "lead_mode": "auto-approve",
+ "lead_model": "anthropic:claude-sonnet-4-8",
+ "runnable_models": [
+ {
+ "id": "anthropic:claude-opus-4-8",
+ "label": "Claude Opus 4.8"
+ },
+ {
+ "id": "anthropic:claude-sonnet-4-8",
+ "label": "Claude Sonnet 4.8"
+ },
+ {
+ "id": "openai:gpt-5.2",
+ "label": "GPT-5.2"
+ },
+ {
+ "id": "ollama:qwen3-coder:30b",
+ "label": "Qwen3 Coder 30B (local)"
+ }
+ ],
+ "model_options": {
+ "swe-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "test-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "review-worker": [
+ "anthropic:claude-opus-4-8",
+ "anthropic:claude-sonnet-4-8"
+ ],
+ "docs-worker": [
+ "anthropic:claude-sonnet-4-8"
+ ]
+ },
+ "members": [
+ {
+ "persona": "swe-worker",
+ "name": "nia",
+ "reason": "Builds the invoice PDF route",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "omar",
+ "reason": "Builds the statement renderer",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "lena",
+ "reason": "Builds the rate limiting on the PDF route",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "kofi",
+ "reason": "Builds the download button",
+ "resolved_model": "anthropic:claude-opus-4-8",
+ "connectors": [],
+ "connector_reasons": {}
+ },
+ {
+ "persona": "swe-worker",
+ "name": "mei",
+ "reason": "Builds the error toasts (small change)",
+ "resolved_model": "anthropic:claude-sonnet-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "swe-worker",
+ "name": "ravi",
+ "reason": "Builds the meter import job (small change)",
+ "resolved_model": "anthropic:claude-sonnet-4-8",
+ "connectors": [
+ "github"
+ ],
+ "connector_reasons": {
+ "github": "pushes its branch"
+ }
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks-1",
+ "reason": "Tests builders 1 and 2",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ },
+ {
+ "persona": "test-worker",
+ "name": "checks-2",
+ "reason": "Tests builders 3 and 4",
+ "resolved_model": "anthropic:claude-sonnet-4-8"
+ }
+ ],
+ "offer": {
+ "swe-worker": [
+ "github"
+ ],
+ "test-worker": [
+ "github"
+ ],
+ "review-worker": [
+ "github"
+ ],
+ "docs-worker": []
+ },
+ "other_connected": [
+ "linear"
+ ],
+ "enable_chat": false,
+ "note": "Four builders on the larger model for the API work; two on the smaller one for copy changes."
+ }
+ }
+ }
+ },
+ "worker-decision": {
+ "event": "permission_required (decide_worker_call)",
+ "canonical": "lead-denies-command",
+ "states": {
+ "lead-denies-command": {
+ "name": "decide_worker_call",
+ "arguments": {
+ "worker": "nia",
+ "call_id": "c51dc4bd79f74e87b7fc59050dc41c37",
+ "decision": "deny",
+ "note": "That targets the issue-1 worktree, which is already done and merged (PR #2). Your item is #3: work in the issue-3 worktree only."
+ },
+ "reason": "requires approval",
+ "category": "team",
+ "worker_call": {
+ "worker": "nia",
+ "tool": "run_shell",
+ "arguments": {
+ "command": "cd /home/user/work/billing-service/issue-1/web && npm run build",
+ "description": "Rebuild the web client"
+ },
+ "reason": "requires approval",
+ "state": "pending"
+ }
+ },
+ "lead-allows-command": {
+ "name": "decide_worker_call",
+ "arguments": {
+ "worker": "checks",
+ "call_id": "c51dc4bd79f74e87b7fc59050dc41c37",
+ "decision": "allow",
+ "note": "This is the red-green check the item asks for: remove the fix, see the test fail, put it back. It stays inside the issue-3 worktree."
+ },
+ "reason": "requires approval",
+ "category": "team",
+ "worker_call": {
+ "worker": "checks",
+ "tool": "run_shell",
+ "arguments": {
+ "command": "cd /home/user/work/billing-service/issue-3/api && cp src/invoices.ts /tmp/invoices.bak && sed -i 's/^ assertCanRead(claimsOf(req), invoice);$//' src/invoices.ts && npm test -- --run invoices; cp /tmp/invoices.bak src/invoices.ts",
+ "description": "Temporarily remove fix, confirm cross-account test fails, then restore"
+ },
+ "state": "pending"
+ }
+ },
+ "lead-denies-file-change": {
+ "name": "decide_worker_call",
+ "arguments": {
+ "worker": "omar",
+ "call_id": "c51dc4bd79f74e87b7fc59050dc41c37",
+ "decision": "deny",
+ "note": "The item is the Export button only. Rewriting the shared API client is outside it, and nia is editing the same file."
+ },
+ "reason": "requires approval",
+ "category": "team",
+ "worker_call": {
+ "worker": "omar",
+ "tool": "write_file",
+ "arguments": {
+ "path": "web/src/api.ts",
+ "content": "export async function getInvoices(params: InvoiceQuery) {\n const res = await http.get('/v1/invoices', { params });\n return res.data.invoices;\n}\n"
+ },
+ "state": "pending"
+ }
+ },
+ "already-answered": {
+ "name": "decide_worker_call",
+ "arguments": {
+ "worker": "nia",
+ "call_id": "c51dc4bd79f74e87b7fc59050dc41c37",
+ "decision": "deny",
+ "note": "That targets the issue-1 worktree, which is already done and merged (PR #2)."
+ },
+ "reason": "requires approval",
+ "category": "team",
+ "worker_call": {
+ "worker": "nia",
+ "tool": "run_shell",
+ "arguments": {
+ "command": "cd /home/user/work/billing-service/issue-1/web && npm run build"
+ },
+ "state": "resolved",
+ "resolution": "deny"
+ }
+ },
+ "long-note": {
+ "name": "decide_worker_call",
+ "arguments": {
+ "worker": "nia",
+ "call_id": "c51dc4bd79f74e87b7fc59050dc41c37",
+ "decision": "deny",
+ "note": "Three problems. First, it runs in the issue-1 worktree, which is merged; your item lives in issue-3. Second, it pipes a script from the network into the shell, which the item never asked for and which I cannot review from here. Third, the build it triggers would overwrite the dist folder that checks is using for the UI test right now. Re-run the build inside issue-3/web with the plain npm script instead, and tell me if that script is missing."
+ },
+ "reason": "requires approval",
+ "category": "team",
+ "worker_call": {
+ "worker": "nia",
+ "tool": "run_shell",
+ "arguments": {
+ "command": "set -euo pipefail\ncd /home/user/work/billing-service/issue-1/web\ncurl -fsSL https://example.com/setup-node.sh | bash\nnpm ci\nnpm run build\ncp -r dist ../../issue-3/web/dist\nls -la ../../issue-3/web/dist"
+ },
+ "state": "pending"
+ }
+ },
+ "old-server": {
+ "name": "decide_worker_call",
+ "arguments": {
+ "worker": "nia",
+ "call_id": "c51dc4bd79f74e87b7fc59050dc41c37",
+ "decision": "deny",
+ "note": "That targets the issue-1 worktree, which is already done and merged (PR #2)."
+ },
+ "reason": "requires approval",
+ "category": "team"
+ }
+ },
+ "inbox": {
+ "lead-denies-command": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "approval",
+ "title": "Run `decide_worker_call`?",
+ "body": "requires approval\nworker: nia · call_id: c51dc4bd79f74e87b7fc59050dc41c37 · decision: deny",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "tool": "decide_worker_call",
+ "arguments": {
+ "worker": "nia",
+ "call_id": "c51dc4bd79f74e87b7fc59050dc41c37",
+ "decision": "deny",
+ "note": "That targets the issue-1 worktree, which is already done and merged (PR #2). Your item is #3: work in the issue-3 worktree only."
+ },
+ "worker_call": {
+ "worker": "nia",
+ "tool": "run_shell",
+ "arguments": {
+ "command": "cd /home/user/work/billing-service/issue-1/web && npm run build",
+ "description": "Rebuild the web client"
+ },
+ "reason": "requires approval",
+ "state": "pending"
+ }
+ }
+ },
+ "lead-allows-command": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "approval",
+ "title": "Run `decide_worker_call`?",
+ "body": "requires approval\nworker: checks · call_id: c51dc4bd79f74e87b7fc59050dc41c37 · decision: allow",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "tool": "decide_worker_call",
+ "arguments": {
+ "worker": "checks",
+ "call_id": "c51dc4bd79f74e87b7fc59050dc41c37",
+ "decision": "allow",
+ "note": "This is the red-green check the item asks for: remove the fix, see the test fail, put it back. It stays inside the issue-3 worktree."
+ },
+ "worker_call": {
+ "worker": "checks",
+ "tool": "run_shell",
+ "arguments": {
+ "command": "cd /home/user/work/billing-service/issue-3/api && cp src/invoices.ts /tmp/invoices.bak && sed -i 's/^ assertCanRead(claimsOf(req), invoice);$//' src/invoices.ts && npm test -- --run invoices; cp /tmp/invoices.bak src/invoices.ts",
+ "description": "Temporarily remove fix, confirm cross-account test fails, then restore"
+ },
+ "state": "pending"
+ }
+ }
+ },
+ "lead-denies-file-change": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "approval",
+ "title": "Run `decide_worker_call`?",
+ "body": "requires approval\nworker: omar · call_id: c51dc4bd79f74e87b7fc59050dc41c37 · decision: deny",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "tool": "decide_worker_call",
+ "arguments": {
+ "worker": "omar",
+ "call_id": "c51dc4bd79f74e87b7fc59050dc41c37",
+ "decision": "deny",
+ "note": "The item is the Export button only. Rewriting the shared API client is outside it, and nia is editing the same file."
+ },
+ "worker_call": {
+ "worker": "omar",
+ "tool": "write_file",
+ "arguments": {
+ "path": "web/src/api.ts",
+ "content": "export async function getInvoices(params: InvoiceQuery) {\n const res = await http.get('/v1/invoices', { params });\n return res.data.invoices;\n}\n"
+ },
+ "state": "pending"
+ }
+ }
+ },
+ "already-answered": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "approval",
+ "title": "Run `decide_worker_call`?",
+ "body": "requires approval\nworker: nia · call_id: c51dc4bd79f74e87b7fc59050dc41c37 · decision: deny",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "tool": "decide_worker_call",
+ "arguments": {
+ "worker": "nia",
+ "call_id": "c51dc4bd79f74e87b7fc59050dc41c37",
+ "decision": "deny",
+ "note": "That targets the issue-1 worktree, which is already done and merged (PR #2)."
+ },
+ "worker_call": {
+ "worker": "nia",
+ "tool": "run_shell",
+ "arguments": {
+ "command": "cd /home/user/work/billing-service/issue-1/web && npm run build"
+ },
+ "state": "resolved",
+ "resolution": "deny"
+ }
+ }
+ },
+ "long-note": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "approval",
+ "title": "Run `decide_worker_call`?",
+ "body": "requires approval\nworker: nia · call_id: c51dc4bd79f74e87b7fc59050dc41c37 · decision: deny",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "tool": "decide_worker_call",
+ "arguments": {
+ "worker": "nia",
+ "call_id": "c51dc4bd79f74e87b7fc59050dc41c37",
+ "decision": "deny",
+ "note": "Three problems. First, it runs in the issue-1 worktree, which is merged; your item lives in issue-3. Second, it pipes a script from the network into the shell, which the item never asked for and which I cannot review from here. Third, the build it triggers would overwrite the dist folder that checks is using for the UI test right now. Re-run the build inside issue-3/web with the plain npm script instead, and tell me if that script is missing."
+ },
+ "worker_call": {
+ "worker": "nia",
+ "tool": "run_shell",
+ "arguments": {
+ "command": "set -euo pipefail\ncd /home/user/work/billing-service/issue-1/web\ncurl -fsSL https://example.com/setup-node.sh | bash\nnpm ci\nnpm run build\ncp -r dist ../../issue-3/web/dist\nls -la ../../issue-3/web/dist"
+ },
+ "state": "pending"
+ }
+ }
+ },
+ "old-server": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "approval",
+ "title": "Run `decide_worker_call`?",
+ "body": "requires approval\nworker: nia · call_id: c51dc4bd79f74e87b7fc59050dc41c37 · decision: deny",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "tool": "decide_worker_call",
+ "arguments": {
+ "worker": "nia",
+ "call_id": "c51dc4bd79f74e87b7fc59050dc41c37",
+ "decision": "deny",
+ "note": "That targets the issue-1 worktree, which is already done and merged (PR #2)."
+ }
+ }
+ }
+ }
+ },
+ "work-items": {
+ "event": "items_proposed",
+ "canonical": "three-items",
+ "states": {
+ "three-items": {
+ "items": [
+ {
+ "title": "Add GET /invoices/:id/pdf",
+ "criteria": "Returns the stored PDF for the caller's own invoice; 404 for a missing file; 403 for another account."
+ },
+ {
+ "title": "Download button in the invoice drawer",
+ "criteria": "The button downloads the PDF and shows an error toast when the API fails."
+ },
+ {
+ "title": "Tests for both",
+ "criteria": "API and UI tests pass in CI."
+ }
+ ],
+ "note": "Split by surface so the API and the web client can move in parallel."
+ },
+ "statements-split": {
+ "items": [
+ {
+ "title": "Statement API endpoint",
+ "criteria": "returns opening/closing balances over the chosen range; 8 endpoint tests green; malformed, missing, and reversed date ranges return 400; draft invoices are excluded from issued totals; inclusive boundaries verified end to end"
+ },
+ {
+ "title": "Statements dashboard page",
+ "criteria": "renders seeded data for Ada / Northgate; empty + error states covered"
+ },
+ {
+ "title": "Statement totals reconcile",
+ "criteria": "running balance matches invoices minus payments for the range"
+ },
+ {
+ "title": "Verification pass",
+ "criteria": "tester confirms page renders with live API data"
+ }
+ ],
+ "note": "Shared journal case: statements."
+ },
+ "seven-items": {
+ "items": [
+ {
+ "title": "Schema: add invoices.pdf_generated_at",
+ "criteria": "Migration applies cleanly on an empty database and on the seeded one; rollback drops only the new column."
+ },
+ {
+ "title": "Worker: regenerate missing statements",
+ "criteria": "A nightly job finds invoices with a null pdf_key, renders the statement, uploads it under statements/<account>/<invoice>.pdf and records the key. Re-running the job makes no second upload.",
+ "description": "The seed data ships with null keys; the first run fills them."
+ },
+ {
+ "title": "API: GET /invoices/:id/pdf",
+ "criteria": "Streams the file with the billing role; 404 when there is no key; 403 for another account's invoice."
+ },
+ {
+ "title": "API: rate-limit the PDF route",
+ "criteria": "More than 30 requests a minute from one account returns 429 with a Retry-After header."
+ },
+ {
+ "title": "Web: download button",
+ "criteria": "Visible only when the invoice has a PDF; disabled with a tooltip while the statement is still rendering."
+ },
+ {
+ "title": "Web: error states",
+ "criteria": "A failed download shows a toast and leaves the drawer open."
+ },
+ {
+ "title": "Docs: runbook entry",
+ "criteria": "The runbook explains how to regenerate one statement by hand."
+ }
+ ],
+ "note": ""
+ },
+ "done-when-prefix": {
+ "items": [
+ {
+ "title": "Cap the retry backoff",
+ "criteria": "Done when: no wait exceeds maxDelayMs, with a unit test for the cap."
+ },
+ {
+ "title": "Log the final attempt",
+ "criteria": "done when the last failure is logged once at warn level"
+ }
+ ],
+ "note": ""
+ },
+ "minimal": {
+ "items": [
+ {
+ "title": "Fix the typo in the README",
+ "criteria": "The heading reads “Billing service”."
+ }
+ ]
+ }
+ },
+ "inbox": {
+ "three-items": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "plan",
+ "title": "Approve the proposed work items?",
+ "body": "- Add GET /invoices/:id/pdf\n- Download button in the invoice drawer\n- Tests for both",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "gate": "items",
+ "items": [
+ {
+ "title": "Add GET /invoices/:id/pdf",
+ "criteria": "Returns the stored PDF for the caller's own invoice; 404 for a missing file; 403 for another account."
+ },
+ {
+ "title": "Download button in the invoice drawer",
+ "criteria": "The button downloads the PDF and shows an error toast when the API fails."
+ },
+ {
+ "title": "Tests for both",
+ "criteria": "API and UI tests pass in CI."
+ }
+ ],
+ "note": "Split by surface so the API and the web client can move in parallel."
+ }
+ },
+ "statements-split": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "plan",
+ "title": "Approve the proposed work items?",
+ "body": "- Statement API endpoint\n- Statements dashboard page\n- Statement totals reconcile\n- Verification pass",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "gate": "items",
+ "items": [
+ {
+ "title": "Statement API endpoint",
+ "criteria": "returns opening/closing balances over the chosen range; 8 endpoint tests green; malformed, missing, and reversed date ranges return 400; draft invoices are excluded from issued totals; inclusive boundaries verified end to end"
+ },
+ {
+ "title": "Statements dashboard page",
+ "criteria": "renders seeded data for Ada / Northgate; empty + error states covered"
+ },
+ {
+ "title": "Statement totals reconcile",
+ "criteria": "running balance matches invoices minus payments for the range"
+ },
+ {
+ "title": "Verification pass",
+ "criteria": "tester confirms page renders with live API data"
+ }
+ ],
+ "note": "Shared journal case: statements."
+ }
+ },
+ "seven-items": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "plan",
+ "title": "Approve the proposed work items?",
+ "body": "- Schema: add invoices.pdf_generated_at\n- Worker: regenerate missing statements\n- API: GET /invoices/:id/pdf\n- API: rate-limit the PDF route\n- Web: download button\n- Web: error states\n- Docs: runbook entry",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "gate": "items",
+ "items": [
+ {
+ "title": "Schema: add invoices.pdf_generated_at",
+ "criteria": "Migration applies cleanly on an empty database and on the seeded one; rollback drops only the new column."
+ },
+ {
+ "title": "Worker: regenerate missing statements",
+ "criteria": "A nightly job finds invoices with a null pdf_key, renders the statement, uploads it under statements/<account>/<invoice>.pdf and records the key. Re-running the job makes no second upload.",
+ "description": "The seed data ships with null keys; the first run fills them."
+ },
+ {
+ "title": "API: GET /invoices/:id/pdf",
+ "criteria": "Streams the file with the billing role; 404 when there is no key; 403 for another account's invoice."
+ },
+ {
+ "title": "API: rate-limit the PDF route",
+ "criteria": "More than 30 requests a minute from one account returns 429 with a Retry-After header."
+ },
+ {
+ "title": "Web: download button",
+ "criteria": "Visible only when the invoice has a PDF; disabled with a tooltip while the statement is still rendering."
+ },
+ {
+ "title": "Web: error states",
+ "criteria": "A failed download shows a toast and leaves the drawer open."
+ },
+ {
+ "title": "Docs: runbook entry",
+ "criteria": "The runbook explains how to regenerate one statement by hand."
+ }
+ ],
+ "note": ""
+ }
+ },
+ "done-when-prefix": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "plan",
+ "title": "Approve the proposed work items?",
+ "body": "- Cap the retry backoff\n- Log the final attempt",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "gate": "items",
+ "items": [
+ {
+ "title": "Cap the retry backoff",
+ "criteria": "Done when: no wait exceeds maxDelayMs, with a unit test for the cap."
+ },
+ {
+ "title": "Log the final attempt",
+ "criteria": "done when the last failure is logged once at warn level"
+ }
+ ],
+ "note": ""
+ }
+ },
+ "minimal": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "plan",
+ "title": "Approve the proposed work items?",
+ "body": "- Fix the typo in the README",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "gate": "items",
+ "items": [
+ {
+ "title": "Fix the typo in the README",
+ "criteria": "The heading reads “Billing service”."
+ }
+ ],
+ "note": ""
+ }
+ }
+ }
+ },
+ "connector-request": {
+ "event": "connector_requested",
+ "canonical": "connect-jira",
+ "states": {
+ "connect-jira": {
+ "request": "connect",
+ "connector": "jira",
+ "worker": "",
+ "reason": "You asked to \"track the work in Jira\", and Jira is not connected on this machine."
+ },
+ "connect-linear": {
+ "request": "connect",
+ "connector": "linear",
+ "worker": "",
+ "reason": "keep the tracker in step with the board"
+ },
+ "grant-github": {
+ "request": "grant",
+ "connector": "github",
+ "worker": "nia",
+ "reason": "push the branch for #1"
+ },
+ "long-reason": {
+ "request": "grant",
+ "connector": "github",
+ "worker": "checks",
+ "reason": "checks found that the UI test needs the preview deployment's URL, which GitHub posts as a deployment status on the pull request. Reading that status needs the GitHub connector; without it checks would have to guess the URL from the branch name, which has been wrong twice this week."
+ },
+ "minimal": {
+ "request": "connect",
+ "connector": "slack"
+ }
+ },
+ "inbox": {
+ "connect-jira": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "connector",
+ "title": "Connect jira?",
+ "body": "You asked to \"track the work in Jira\", and Jira is not connected on this machine.",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "request": "connect",
+ "connector": "jira",
+ "worker": ""
+ }
+ },
+ "connect-linear": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "connector",
+ "title": "Connect linear?",
+ "body": "keep the tracker in step with the board",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "request": "connect",
+ "connector": "linear",
+ "worker": ""
+ }
+ },
+ "grant-github": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "connector",
+ "title": "Give nia access to github?",
+ "body": "push the branch for #1",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "request": "grant",
+ "connector": "github",
+ "worker": "nia"
+ }
+ },
+ "long-reason": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "connector",
+ "title": "Give checks access to github?",
+ "body": "checks found that the UI test needs the preview deployment's URL, which GitHub posts as a deployment status on the pull request. Reading that status needs the GitHub connector; without it checks would have to guess the URL from the branch name, which has been wrong twice this week.",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "request": "grant",
+ "connector": "github",
+ "worker": "checks"
+ }
+ },
+ "minimal": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "connector",
+ "title": "Connect slack?",
+ "body": "",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "request": "connect",
+ "connector": "slack",
+ "worker": ""
+ }
+ }
+ }
+ },
+ "question": {
+ "event": "question_requested",
+ "canonical": "quick-replies",
+ "states": {
+ "quick-replies": {
+ "question": "Which environment should I restart?",
+ "options": [
+ "staging",
+ "production"
+ ],
+ "allow_text": true,
+ "multi": false
+ },
+ "rich-options": {
+ "header": "PDF storage",
+ "question": "Where should generated invoice PDFs live?",
+ "options": [
+ {
+ "label": "S3, private bucket",
+ "description": "Served through the API with the billing role. Matches how statements work today.",
+ "recommended": true
+ },
+ {
+ "label": "Database (bytea)",
+ "description": "No new infrastructure, but invoices average 180 KB and the table is already large."
+ },
+ {
+ "label": "Generate on demand",
+ "description": "Nothing stored; every download costs a render of about two seconds."
+ }
+ ],
+ "allow_text": true,
+ "multi": false
+ },
+ "options-with-preview": {
+ "header": "Error shape",
+ "question": "Which error body should the PDF route return?",
+ "options": [
+ {
+ "label": "Problem JSON",
+ "description": "RFC 9457, as the newer routes do.",
+ "recommended": true,
+ "preview": "{\n \"type\": \"about:blank\",\n \"title\": \"Invoice has no PDF\",\n \"status\": 404\n}"
+ },
+ {
+ "label": "Legacy envelope",
+ "description": "What the web client parses today.",
+ "preview": "{\n \"error\": {\n \"code\": \"NO_PDF\",\n \"message\": \"Invoice has no PDF\"\n }\n}"
+ }
+ ],
+ "allow_text": false,
+ "multi": false
+ },
+ "multi-select": {
+ "question": "Which suites should run before I open the pull request?",
+ "options": [
+ "API",
+ "Web",
+ "Worker",
+ "Terraform validate"
+ ],
+ "allow_text": true,
+ "multi": true
+ },
+ "grouped": {
+ "question": "",
+ "questions": [
+ {
+ "header": "Scope",
+ "question": "Should the download work for draft invoices too?",
+ "options": [
+ "Issued only",
+ "Drafts too"
+ ],
+ "allow_text": true
+ },
+ {
+ "header": "Naming",
+ "question": "What should the file be called?",
+ "options": [
+ "invoice-<number>.pdf",
+ "<account>-<period>.pdf"
+ ],
+ "allow_text": true
+ },
+ {
+ "header": "Rollout",
+ "question": "Ship behind a flag?",
+ "options": [
+ {
+ "label": "Yes",
+ "description": "Off by default; on for the demo account.",
+ "recommended": true
+ },
+ {
+ "label": "No",
+ "description": "Visible to every account at once."
+ }
+ ],
+ "allow_text": false
+ }
+ ]
+ },
+ "minimal": {
+ "question": "What should the branch be called?"
+ }
+ },
+ "inbox": {
+ "quick-replies": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "question",
+ "title": "Which environment should I restart?",
+ "body": "",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "options": [
+ "staging",
+ "production"
+ ],
+ "allow_text": true,
+ "multi": false,
+ "header": "",
+ "questions": []
+ },
+ "rich-options": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "question",
+ "title": "Where should generated invoice PDFs live?",
+ "body": "",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "options": [
+ {
+ "label": "S3, private bucket",
+ "description": "Served through the API with the billing role. Matches how statements work today.",
+ "recommended": true
+ },
+ {
+ "label": "Database (bytea)",
+ "description": "No new infrastructure, but invoices average 180 KB and the table is already large."
+ },
+ {
+ "label": "Generate on demand",
+ "description": "Nothing stored; every download costs a render of about two seconds."
+ }
+ ],
+ "allow_text": true,
+ "multi": false,
+ "header": "PDF storage",
+ "questions": []
+ },
+ "options-with-preview": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "question",
+ "title": "Which error body should the PDF route return?",
+ "body": "",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "options": [
+ {
+ "label": "Problem JSON",
+ "description": "RFC 9457, as the newer routes do.",
+ "recommended": true,
+ "preview": "{\n \"type\": \"about:blank\",\n \"title\": \"Invoice has no PDF\",\n \"status\": 404\n}"
+ },
+ {
+ "label": "Legacy envelope",
+ "description": "What the web client parses today.",
+ "preview": "{\n \"error\": {\n \"code\": \"NO_PDF\",\n \"message\": \"Invoice has no PDF\"\n }\n}"
+ }
+ ],
+ "allow_text": false,
+ "multi": false,
+ "header": "Error shape",
+ "questions": []
+ },
+ "multi-select": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "question",
+ "title": "Which suites should run before I open the pull request?",
+ "body": "",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "options": [
+ "API",
+ "Web",
+ "Worker",
+ "Terraform validate"
+ ],
+ "allow_text": true,
+ "multi": true,
+ "header": "",
+ "questions": []
+ },
+ "grouped": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "question",
+ "title": "Should the download work for draft invoices too?",
+ "body": "",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "options": [
+ "Issued only",
+ "Drafts too"
+ ],
+ "allow_text": true,
+ "multi": false,
+ "header": "Scope",
+ "questions": [
+ {
+ "header": "Scope",
+ "question": "Should the download work for draft invoices too?",
+ "options": [
+ "Issued only",
+ "Drafts too"
+ ],
+ "allow_text": true
+ },
+ {
+ "header": "Naming",
+ "question": "What should the file be called?",
+ "options": [
+ "invoice-<number>.pdf",
+ "<account>-<period>.pdf"
+ ],
+ "allow_text": true
+ },
+ {
+ "header": "Rollout",
+ "question": "Ship behind a flag?",
+ "options": [
+ {
+ "label": "Yes",
+ "description": "Off by default; on for the demo account.",
+ "recommended": true
+ },
+ {
+ "label": "No",
+ "description": "Visible to every account at once."
+ }
+ ],
+ "allow_text": false
+ }
+ ]
+ },
+ "minimal": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "question",
+ "title": "What should the branch be called?",
+ "body": "",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "options": [],
+ "allow_text": true,
+ "multi": false,
+ "header": "",
+ "questions": []
+ }
+ }
+ },
+ "directory-request": {
+ "event": "directory_requested",
+ "canonical": "read-only",
+ "states": {
+ "read-only": {
+ "reason": "Compare the statement template with the one marketing uses",
+ "path": "/Users/sam/Documents/brand/templates",
+ "writable": false,
+ "primary": false
+ },
+ "writable": {
+ "reason": "Save the regenerated statements next to the originals",
+ "path": "/Users/sam/SpaceSol/statements",
+ "writable": true,
+ "primary": false
+ },
+ "make-workspace": {
+ "reason": "The repository lives here; I need it as the workspace to run the tests",
+ "path": "/Users/sam/fleet/demo-universe/billing-service",
+ "writable": true,
+ "primary": true
+ },
+ "no-path": {
+ "reason": "I need somewhere to put the exported CSV files"
+ }
+ },
+ "inbox": {
+ "read-only": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "directory",
+ "title": "Grant access to a folder?",
+ "body": "Compare the statement template with the one marketing uses",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "path": "/Users/sam/Documents/brand/templates",
+ "writable": false,
+ "primary": false
+ }
+ },
+ "writable": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "directory",
+ "title": "Grant access to a folder?",
+ "body": "Save the regenerated statements next to the originals",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "path": "/Users/sam/SpaceSol/statements",
+ "writable": true,
+ "primary": false
+ }
+ },
+ "make-workspace": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "directory",
+ "title": "Grant access to a folder?",
+ "body": "The repository lives here; I need it as the workspace to run the tests",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "path": "/Users/sam/fleet/demo-universe/billing-service",
+ "writable": true,
+ "primary": true
+ }
+ },
+ "no-path": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "directory",
+ "title": "Grant access to a folder?",
+ "body": "I need somewhere to put the exported CSV files",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "path": "",
+ "writable": false,
+ "primary": false
+ }
+ }
+ }
+ },
+ "tool-request": {
+ "event": "tool_requested",
+ "canonical": "installable",
+ "states": {
+ "installable": {
+ "name": "gitleaks",
+ "reason": "scan the git history for committed secrets",
+ "installable": true,
+ "version": "8.30.1",
+ "summary": "scans git history and the working tree for committed secrets",
+ "source": "github.com/gitleaks"
+ },
+ "not-installable": {
+ "name": "somescanner",
+ "reason": "scan the Terraform for misconfigurations"
+ },
+ "long-reason": {
+ "name": "trivy",
+ "reason": "check the three container images for known vulnerabilities before the pull request goes up, because the API image moved to a new Node base this week and the last scan predates that change",
+ "installable": true,
+ "version": "0.56.2",
+ "summary": "scans container images, filesystems and IaC for vulnerabilities and misconfigurations",
+ "source": "github.com/aquasecurity/trivy"
+ }
+ },
+ "inbox": {
+ "installable": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "tool",
+ "title": "Install gitleaks?",
+ "body": "scan the git history for committed secrets",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "tool": "gitleaks",
+ "installable": true,
+ "version": "8.30.1",
+ "summary": "scans git history and the working tree for committed secrets",
+ "url": "",
+ "source": "github.com/gitleaks"
+ }
+ },
+ "not-installable": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "tool",
+ "title": "Install somescanner?",
+ "body": "scan the Terraform for misconfigurations",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "tool": "somescanner",
+ "installable": false,
+ "version": "",
+ "summary": "",
+ "url": "",
+ "source": ""
+ }
+ },
+ "long-reason": {
+ "id": "gallery-item",
+ "session_id": "gallery-session",
+ "kind": "tool",
+ "title": "Install trivy?",
+ "body": "check the three container images for known vulnerabilities before the pull request goes up, because the API image moved to a new Node base this week and the last scan predates that change",
+ "state": "pending",
+ "resolution": null,
+ "inbox": "default",
+ "created_at": "2026-09-17T09:30:00Z",
+ "resolved_at": null,
+ "visibility": "inbox",
+ "session_title": "Mention #3 · Invoice PDF download",
+ "session_agent": "swe-lead",
+ "session_exists": true,
+ "data": {
+ "tool": "trivy",
+ "installable": true,
+ "version": "0.56.2",
+ "summary": "scans container images, filesystems and IaC for vulnerabilities and misconfigurations",
+ "url": "",
+ "source": "github.com/aquasecurity/trivy"
+ }
+ }
+ }
+ },
+ "board-wake": {
+ "event": "turn_start (source.connector = board)",
+ "canonical": "waiting-and-review",
+ "states": {
+ "waiting-and-review": {
+ "source": {
+ "connector": "board",
+ "kind": "channel",
+ "channel_id": "/Users/test/OpenWorker/launch-note",
+ "channel_name": "Team board",
+ "sender_id": "board",
+ "sender_name": "Board",
+ "ts": 1789900000,
+ "text": "⏰ Board wake — your team needs decisions",
+ "board": {
+ "rows": [
+ {
+ "item": 5,
+ "title": "api: prove PDF 403 for other accounts and 200 for owner/staff with tests",
+ "actor": "nia",
+ "kind": "comment",
+ "note": "@checks PDF authz landed on issue-3 (commit fbc2190). GET /v1/invoices/:id/pdf status contract: 401 no token, 403 other account (assertCanRead), 404 unknown id or no pdf_key, 200 owner and staff. Test against that."
+ },
+ {
+ "item": 4,
+ "title": "api + web: enforce owner/staff authorization on invoice PDF download",
+ "actor": "swe-lead:3fbd018c",
+ "kind": "comment",
+ "note": "Received in review. Holding here until checks completes the independent verification in #5 (API gate + 403/owner-200/staff-200 assertions against the real handler)."
+ },
+ {
+ "item": 4,
+ "title": "api + web: enforce owner/staff authorization on invoice PDF download",
+ "actor": "nia",
+ "kind": "moved",
+ "to": "review",
+ "note": "Done on branch issue-3 (commit fbc2190). API: GET /:id/pdf now runs assertCanRead(claimsOf(req), invoice.account_id) after loadInvoice, before the S3 read. Web: the Download PDF button renders only for the invoice's owner or staff. Lint and build green in api/ and web/."
+ },
+ {
+ "item": 5,
+ "title": "api: prove PDF 403 for other accounts and 200 for owner/staff with tests",
+ "actor": "checks",
+ "kind": "waiting",
+ "tool": "run_shell",
+ "prompt_id": "c6e33538745f4a2d8689da0a4ba436cf",
+ "note": "requires approval\ncommand: cd /home/user/work/billing-service/issue-3/api && cp src/invoices.ts /tmp/… · description: Temporarily remove fix, confirm cross-account test fails, then restore"
+ },
+ {
+ "kind": "chat",
+ "actor": "nia",
+ "note": "@checks @lead I don't have decide_worker_call (worker, not lead), but for the record I endorse checks' mutation check — back up src/invoices.ts, remove the assert, see the 403 test go red, restore."
+ }
+ ]
+ }
+ }
+ },
+ "review-and-filed": {
+ "source": {
+ "connector": "board",
+ "kind": "channel",
+ "channel_id": "/Users/test/OpenWorker/launch-note",
+ "channel_name": "Team board",
+ "sender_id": "board",
+ "sender_name": "Board",
+ "ts": 1789900000,
+ "text": "⏰ Board wake — your team needs decisions:\n- #2 moved to review by webb",
+ "board": {
+ "rows": [
+ {
+ "kind": "moved",
+ "item": 2,
+ "title": "Statements page",
+ "actor": "webb",
+ "to": "review",
+ "note": "Ready for review on feat/customer-statements, commit 029f9f7. Build verified; final verdict stays with the tester."
+ },
+ {
+ "kind": "filed",
+ "item": 5,
+ "title": "Follow-up: rate limit",
+ "actor": "nia"
+ }
+ ]
+ }
+ }
+ },
+ "routine": {
+ "source": {
+ "connector": "board",
+ "kind": "channel",
+ "channel_id": "/Users/test/OpenWorker/launch-note",
+ "channel_name": "Team board",
+ "sender_id": "board",
+ "sender_name": "Board",
+ "ts": 1789900000,
+ "text": "Board wake — updates",
+ "board": {
+ "rows": [
+ {
+ "kind": "claimed",
+ "item": 1,
+ "title": "Statement API endpoint",
+ "actor": "nia"
+ },
+ {
+ "kind": "claimed",
+ "item": 3,
+ "title": "Statement totals reconcile",
+ "actor": "omar"
+ },
+ {
+ "kind": "comment",
+ "item": 1,
+ "title": "Statement API endpoint",
+ "actor": "nia",
+ "note": "Range parsing is done; starting on the totals."
+ }
+ ]
+ }
+ }
+ },
+ "blocked-and-chat": {
+ "source": {
+ "connector": "board",
+ "kind": "channel",
+ "channel_id": "/Users/test/OpenWorker/launch-note",
+ "channel_name": "Team board",
+ "sender_id": "board",
+ "sender_name": "Board",
+ "ts": 1789900000,
+ "text": "⏰ Board wake — your team needs decisions",
+ "board": {
+ "rows": [
+ {
+ "kind": "moved",
+ "item": 4,
+ "title": "Verification pass",
+ "actor": "checks",
+ "to": "blocked",
+ "note": "The seeded database has no invoices for Northgate in March, so the range test cannot pass. Need a seed change or a different range."
+ },
+ {
+ "kind": "chat",
+ "actor": "checks",
+ "note": "@lead the March seed data is missing — who owns db/seed.sql?"
+ },
+ {
+ "kind": "moved",
+ "item": 1,
+ "title": "Statement API endpoint",
+ "actor": "nia",
+ "to": "done"
+ },
+ {
+ "kind": "assigned",
+ "item": 6,
+ "title": "Seed data for March"
+ }
+ ]
+ }
+ }
+ },
+ "many-rows": {
+ "source": {
+ "connector": "board",
+ "kind": "channel",
+ "channel_id": "/Users/test/OpenWorker/launch-note",
+ "channel_name": "Team board",
+ "sender_id": "board",
+ "sender_name": "Board",
+ "ts": 1789900000,
+ "text": "⏰ Board wake — your team needs decisions",
+ "board": {
+ "rows": [
+ {
+ "kind": "moved",
+ "item": 1,
+ "title": "Work item 1",
+ "actor": "worker-1",
+ "to": "review",
+ "note": "Ready for review; tests green."
+ },
+ {
+ "kind": "claimed",
+ "item": 2,
+ "title": "Work item 2",
+ "actor": "worker-2"
+ },
+ {
+ "kind": "moved",
+ "item": 3,
+ "title": "Work item 3",
+ "actor": "worker-3",
+ "to": "done"
+ },
+ {
+ "kind": "comment",
+ "item": 4,
+ "title": "Work item 4",
+ "actor": "worker-4",
+ "note": "Halfway; no blockers."
+ },
+ {
+ "kind": "moved",
+ "item": 5,
+ "title": "Work item 5",
+ "actor": "worker-5",
+ "to": "review",
+ "note": "Ready for review; tests green."
+ },
+ {
+ "kind": "claimed",
+ "item": 6,
+ "title": "Work item 6",
+ "actor": "worker-6"
+ },
+ {
+ "kind": "moved",
+ "item": 7,
+ "title": "Work item 7",
+ "actor": "worker-7",
+ "to": "done"
+ },
+ {
+ "kind": "comment",
+ "item": 8,
+ "title": "Work item 8",
+ "actor": "worker-8",
+ "note": "Halfway; no blockers."
+ },
+ {
+ "kind": "moved",
+ "item": 9,
+ "title": "Work item 9",
+ "actor": "worker-9",
+ "to": "review",
+ "note": "Ready for review; tests green."
+ },
+ {
+ "kind": "claimed",
+ "item": 10,
+ "title": "Work item 10",
+ "actor": "worker-10"
+ },
+ {
+ "kind": "moved",
+ "item": 11,
+ "title": "Work item 11",
+ "actor": "worker-11",
+ "to": "done"
+ },
+ {
+ "kind": "comment",
+ "item": 12,
+ "title": "Work item 12",
+ "actor": "worker-12",
+ "note": "Halfway; no blockers."
+ }
+ ]
+ }
+ }
+ },
+ "minimal": {
+ "source": {
+ "connector": "board",
+ "kind": "channel",
+ "channel_id": "board",
+ "channel_name": "Team board",
+ "sender_id": "board",
+ "sender_name": "Board",
+ "ts": 1789900000,
+ "text": "Board wake"
+ }
+ }
+ },
+ "inbox": {}
+ },
+ "connector-message": {
+ "event": "turn_start (source)",
+ "canonical": "slack-channel",
+ "states": {
+ "slack-channel": {
+ "source": {
+ "connector": "slack",
+ "kind": "channel",
+ "channel_id": "C0BD7KZ1AH5",
+ "channel_name": "#billing-eng",
+ "sender_id": "U04ABCD12",
+ "sender_name": "Jordan Lee",
+ "ts": 1789900000,
+ "text": "Can the staging deploy go out before the 3pm demo? The invoice PDF change needs to be on it."
+ }
+ },
+ "slack-dm": {
+ "source": {
+ "connector": "slack",
+ "kind": "dm",
+ "channel_id": "D07XYZ",
+ "channel_name": "Direct message",
+ "sender_id": "U04ABCD12",
+ "sender_name": "Jordan Lee",
+ "ts": 1789900000,
+ "text": "quick one — what's the status of BILL-212?"
+ }
+ },
+ "github-mention": {
+ "source": {
+ "connector": "github",
+ "kind": "channel",
+ "channel_id": "acme/billing-service#3",
+ "channel_name": "acme/billing-service #3",
+ "sender_id": "demo-user",
+ "sender_name": "demo-user",
+ "ts": 1789900000,
+ "text": "[lead] Add a PDF download to every invoice in the drawer. The statements worker already renders them; the API needs a route and the web client a button."
+ }
+ },
+ "long-message": {
+ "source": {
+ "connector": "slack",
+ "kind": "channel",
+ "channel_id": "C0BD7KZ1AH5",
+ "channel_name": "#billing-eng",
+ "sender_id": "U04ABCD12",
+ "sender_name": "Jordan Lee",
+ "ts": 1789900000,
+ "text": "Three things from the customer call:\n\n1. They want the PDF to carry the PO number in the header.\n2. Statements for closed accounts should stay downloadable for seven years.\n3. The March invoices show the old tariff name.\n\nCan you look at 3 first? It is going in front of their finance team on Friday and I would rather not explain it live. Happy to pair on it after lunch if the tariff table is as confusing as I remember."
+ }
+ },
+ "unknown-connector": {
+ "source": {
+ "connector": "pagerduty",
+ "kind": "channel",
+ "channel_id": "PXY123",
+ "channel_name": "PXY123",
+ "sender_id": "U999",
+ "sender_name": "U999",
+ "ts": 1789900000,
+ "text": "Incident #4821 acknowledged."
+ }
+ }
+ },
+ "inbox": {}
+ }
+ }
+}
diff --git a/surfaces/gui/src/gallery/states.test.tsx b/surfaces/gui/src/gallery/states.test.tsx
new file mode 100644
index 00000000..9bf288ef
--- /dev/null
+++ b/surfaces/gui/src/gallery/states.test.tsx
@@ -0,0 +1,54 @@
+// One generated test per gallery state, in each place the card can appear: the payload
+// renders through the real component without a console error, and ids stay unique
+// (a state id is a URL). Behaviour checks stay in each card's own test file.
+import { cleanup, render } from "@testing-library/react";
+import { afterEach, describe, expect, it, vi } from "vitest";
+
+import { InboxItemCard } from "../components/InboxItemCard";
+import { CARDS } from "./cards";
+import { inboxItemBuilders } from "./inboxItems";
+
+describe("gallery states", () => {
+ afterEach(() => {
+ cleanup();
+ vi.restoreAllMocks();
+ });
+
+ it("has unique card ids and unique state ids per card", () => {
+ expect(new Set(CARDS.map((c) => c.id)).size).toBe(CARDS.length);
+ for (const card of CARDS) {
+ expect(card.states.length).toBeGreaterThan(0);
+ expect(new Set(card.states.map((s) => s.id)).size).toBe(card.states.length);
+ for (const s of card.states) expect(s.id).toMatch(/^[a-z0-9-]+$/);
+ }
+ });
+
+ it("keeps every payload plain JSON (the server contract check reads them as JSON)", () => {
+ for (const card of CARDS)
+ for (const s of card.states)
+ expect(JSON.parse(JSON.stringify(s.payload))).toEqual(
+ // undefined values are how a state says "the server did not send this field"
+ Object.fromEntries(Object.entries(s.payload).filter(([, v]) => v !== undefined)),
+ );
+ });
+
+ for (const card of CARDS) {
+ for (const state of card.states) {
+ it(`${card.id} / ${state.id} renders in the session`, () => {
+ const errors = vi.spyOn(console, "error").mockImplementation(() => {});
+ const { container } = render(<>{card.renderInline(state, () => {})}</>);
+ expect(container.firstElementChild).toBeTruthy();
+ expect(errors).not.toHaveBeenCalled();
+ });
+
+ const toInbox = inboxItemBuilders[card.id];
+ if (!toInbox) continue;
+ it(`${card.id} / ${state.id} renders in the Inbox`, () => {
+ const errors = vi.spyOn(console, "error").mockImplementation(() => {});
+ const { container } = render(<InboxItemCard item={toInbox(state)} onResolve={() => {}} />);
+ expect(container.firstElementChild).toBeTruthy();
+ expect(errors).not.toHaveBeenCalled();
+ });
+ }
+ }
+});
diff --git a/surfaces/gui/src/gallery/states/approval.ts b/surfaces/gui/src/gallery/states/approval.ts
new file mode 100644
index 00000000..8a4b7324
--- /dev/null
+++ b/surfaces/gui/src/gallery/states/approval.ts
@@ -0,0 +1,155 @@
+// `permission_required` payloads.
+import type { CardState } from "../types";
+
+export const approvalStates: CardState[] = [
+ {
+ id: "shell-command",
+ title: "Shell command",
+ note: "The common case in Manual mode: the command-scoped grant is offered, the tool-wide one is not.",
+ payload: {
+ name: "run_shell",
+ arguments: { command: "npm test -- --run invoices" },
+ reason: "Run the API tests for the new route",
+ category: "shell",
+ },
+ },
+ {
+ id: "read-only-command",
+ title: "Read-only command",
+ note: "The server classified the command as a local read, so the session-wide read-only grant appears.",
+ payload: {
+ name: "run_shell",
+ arguments: { command: "ls" },
+ reason: "The coworker wants to run a command.",
+ readonly_ok: true, // `ls` classifies read-only server-side
+ },
+ },
+ {
+ id: "reviewer-unsure",
+ title: "Auto-Approve: reviewer was unsure",
+ note: "Auto-Approve session: no session grants, and the reviewer's one-line reason is shown quietly.",
+ context: { mode: "auto-approve" },
+ payload: {
+ name: "run_shell",
+ arguments: { command: "python3 helper.py" },
+ reason: "requires approval",
+ reviewer_unsure: "This runs a newly created script whose effects cannot be determined from the command.",
+ },
+ },
+ {
+ id: "provenance-warning",
+ title: "Runs a file the agent wrote",
+ note: "The provenance line is the one fact the command text cannot show.",
+ payload: {
+ name: "run_shell",
+ arguments: { command: "python3 scripts/backfill_pdf_keys.py --apply" },
+ reason: "Backfill the missing keys",
+ category: "shell",
+ provenance: "backfill_pdf_keys.py was created by the agent 3 steps ago",
+ },
+ },
+ {
+ id: "write-file",
+ title: "File write (compact row)",
+ note: "Routine workspace writes are one line; the preview opens inline.",
+ payload: {
+ name: "write_file",
+ arguments: {
+ path: "src/fetch_data.py",
+ content: "import json\nimport urllib.request\n\ncompanies = [\"NVDA\", \"AMD\"]\nprint(len(companies))\ndone = True",
+ },
+ reason: "",
+ },
+ },
+ {
+ id: "web-fetch",
+ title: "Web fetch (leaves this computer)",
+ note: "Egress: the scope note names the host and the session grant is domain-shaped.",
+ payload: {
+ name: "web_fetch",
+ arguments: { url: "https://docs.stripe.com/api/invoices/object" },
+ reason: "Check the invoice object's PDF field",
+ category: "network",
+ },
+ },
+ {
+ id: "connector-action",
+ title: "Connector action",
+ note: "Acts on a connected service: no session-wide grant.",
+ payload: {
+ name: "github_create_pull_request",
+ arguments: { repo: "acme/billing-service", title: "Invoice PDF download", base: "main", head: "lead/invoice-pdf" },
+ reason: "Open the pull request for issue #3",
+ category: "connector",
+ },
+ },
+ {
+ id: "automation-run",
+ title: "Inside an automation run",
+ note: "A run context plus a standing target offers “Allow every time” in place of the session grant.",
+ context: { runTask: { id: "task-7f2c", title: "Weekly digest" } },
+ payload: {
+ name: "send_message",
+ arguments: { target: "slack:T1/C1", text: "Weekly digest ready" },
+ reason: "",
+ category: "messaging",
+ standing_target: "slack:T1/C1",
+ },
+ },
+ {
+ id: "long-message",
+ title: "Long message, no newlines",
+ note: "A one-paragraph digest once ballooned the card to full-transcript height; the preview clamps by characters.",
+ payload: {
+ name: "send_message",
+ arguments: {
+ target: "slack:T1/C1",
+ text:
+ "aisuite — last 24 hours of work (through Jul 15): 5 PRs merged covering chat-completion streaming with unified chunks across providers, multimodal input conversion, Slack collaboration improvements, human attribution for outbound posts, and repo-wide formatting. ".repeat(
+ 6,
+ ),
+ },
+ reason: "",
+ category: "messaging",
+ },
+ },
+ {
+ id: "automation-consent",
+ title: "Create an automation (consent card)",
+ note: "The agent proposes the automation's permission set; the card lists what it grants.",
+ payload: {
+ name: "create_scheduled_task",
+ arguments: {
+ title: "Weekly digest",
+ instructions: "Summarize the week and post it.",
+ cron: "0 9 * * 1",
+ permissions: [
+ { tool: "send_message", target: "slack:T1/C1", access: "write" },
+ { tool: "github_list_commits", target: "rohit/agent-platform", access: "read" },
+ ],
+ },
+ reason: "",
+ category: "automation",
+ },
+ },
+ {
+ id: "long-command",
+ title: "Long command",
+ note: "The preview clamps by lines and by characters.",
+ payload: {
+ name: "run_shell",
+ arguments: {
+ command:
+ "set -euo pipefail\ncd infra\nterraform init -backend-config=envs/demo.backend.hcl\nterraform plan -var-file=envs/demo.tfvars -out=plan.bin\nterraform show -json plan.bin > plan.json\njq '[.resource_changes[] | select(.change.actions | index(\"delete\"))] | length' plan.json\nterraform apply plan.bin",
+ },
+ reason: "Apply the bucket policy change",
+ category: "shell",
+ },
+ },
+ {
+ id: "minimal",
+ title: "Minimal payload",
+ note: "Name and arguments only, as an old server sends.",
+ payload: { name: "run_shell", arguments: { command: "ls" } },
+ },
+];
diff --git a/surfaces/gui/src/gallery/states/board-wake.ts b/surfaces/gui/src/gallery/states/board-wake.ts
new file mode 100644
index 00000000..ab23dec3
--- /dev/null
+++ b/surfaces/gui/src/gallery/states/board-wake.ts
@@ -0,0 +1,91 @@
+// Board wakes: `turn_start` payloads whose `source.connector` is "board". In a reopened
+// session the same `source` sits on the stored message.
+import type { CardState } from "../types";
+
+const board = (text: string, rows: Record<string, unknown>[]) => ({
+ source: {
+ connector: "board",
+ kind: "channel",
+ channel_id: "/Users/test/OpenWorker/launch-note",
+ channel_name: "Team board",
+ sender_id: "board",
+ sender_name: "Board",
+ ts: 1789900000,
+ text,
+ board: { rows },
+ },
+});
+
+export const boardWakeStates: CardState[] = [
+ {
+ id: "waiting-and-review",
+ title: "A worker waiting, a hand-off to review (real run)",
+ note: "From the SpaceSol issue #3 run, 2026-09-17: the row that matters most is checks waiting on the lead's decision. Grouped by work item; chat on its own.",
+ payload: board("⏰ Board wake — your team needs decisions", [
+ { item: 5, title: "api: prove PDF 403 for other accounts and 200 for owner/staff with tests", actor: "nia", kind: "comment", note: "@checks PDF authz landed on issue-3 (commit fbc2190). GET /v1/invoices/:id/pdf status contract: 401 no token, 403 other account (assertCanRead), 404 unknown id or no pdf_key, 200 owner and staff. Test against that." },
+ { item: 4, title: "api + web: enforce owner/staff authorization on invoice PDF download", actor: "swe-lead:3fbd018c", kind: "comment", note: "Received in review. Holding here until checks completes the independent verification in #5 (API gate + 403/owner-200/staff-200 assertions against the real handler)." },
+ { item: 4, title: "api + web: enforce owner/staff authorization on invoice PDF download", actor: "nia", kind: "moved", to: "review", note: "Done on branch issue-3 (commit fbc2190). API: GET /:id/pdf now runs assertCanRead(claimsOf(req), invoice.account_id) after loadInvoice, before the S3 read. Web: the Download PDF button renders only for the invoice's owner or staff. Lint and build green in api/ and web/." },
+ { item: 5, title: "api: prove PDF 403 for other accounts and 200 for owner/staff with tests", actor: "checks", kind: "waiting", tool: "run_shell", prompt_id: "c6e33538745f4a2d8689da0a4ba436cf", note: "requires approval\ncommand: cd /home/user/work/billing-service/issue-3/api && cp src/invoices.ts /tmp/… · description: Temporarily remove fix, confirm cross-account test fails, then restore" },
+ { kind: "chat", actor: "nia", note: "@checks @lead I don't have decide_worker_call (worker, not lead), but for the record I endorse checks' mutation check — back up src/invoices.ts, remove the assert, see the 403 test go red, restore." },
+ ]),
+ },
+ {
+ id: "review-and-filed",
+ title: "A hand-off to review",
+ note: "Collapsed by default; a review tints the line because it needs a decision.",
+ payload: board("⏰ Board wake — your team needs decisions:\n- #2 moved to review by webb", [
+ {
+ kind: "moved",
+ item: 2,
+ title: "Statements page",
+ actor: "webb",
+ to: "review",
+ note: "Ready for review on feat/customer-statements, commit 029f9f7. Build verified; final verdict stays with the tester.",
+ },
+ { kind: "filed", item: 5, title: "Follow-up: rate limit", actor: "nia" },
+ ]),
+ },
+ {
+ id: "routine",
+ title: "Routine updates",
+ note: "Claims and comments only: no tint.",
+ payload: board("Board wake — updates", [
+ { kind: "claimed", item: 1, title: "Statement API endpoint", actor: "nia" },
+ { kind: "claimed", item: 3, title: "Statement totals reconcile", actor: "omar" },
+ { kind: "comment", item: 1, title: "Statement API endpoint", actor: "nia", note: "Range parsing is done; starting on the totals." },
+ ]),
+ },
+ {
+ id: "blocked-and-chat",
+ title: "Blocked item and team chat",
+ payload: board("⏰ Board wake — your team needs decisions", [
+ { kind: "moved", item: 4, title: "Verification pass", actor: "checks", to: "blocked", note: "The seeded database has no invoices for Northgate in March, so the range test cannot pass. Need a seed change or a different range." },
+ { kind: "chat", actor: "checks", note: "@lead the March seed data is missing — who owns db/seed.sql?" },
+ { kind: "moved", item: 1, title: "Statement API endpoint", actor: "nia", to: "done" },
+ { kind: "assigned", item: 6, title: "Seed data for March" },
+ ]),
+ },
+ {
+ id: "many-rows",
+ title: "A busy wake (twelve rows)",
+ note: "What a lead of a large team sees; the summary line carries the counts.",
+ payload: board(
+ "⏰ Board wake — your team needs decisions",
+ Array.from({ length: 12 }, (_, i) =>
+ i % 4 === 0
+ ? { kind: "moved", item: i + 1, title: `Work item ${i + 1}`, actor: `worker-${i + 1}`, to: "review", note: "Ready for review; tests green." }
+ : i % 4 === 1
+ ? { kind: "claimed", item: i + 1, title: `Work item ${i + 1}`, actor: `worker-${i + 1}` }
+ : i % 4 === 2
+ ? { kind: "moved", item: i + 1, title: `Work item ${i + 1}`, actor: `worker-${i + 1}`, to: "done" }
+ : { kind: "comment", item: i + 1, title: `Work item ${i + 1}`, actor: `worker-${i + 1}`, note: "Halfway; no blockers." },
+ ),
+ ),
+ },
+ {
+ id: "minimal",
+ title: "No rows (old server)",
+ note: "A wake without structured rows still renders.",
+ payload: { source: { connector: "board", kind: "channel", channel_id: "board", channel_name: "Team board", sender_id: "board", sender_name: "Board", ts: 1789900000, text: "Board wake" } },
+ },
+];
diff --git a/surfaces/gui/src/gallery/states/connector-message.ts b/surfaces/gui/src/gallery/states/connector-message.ts
new file mode 100644
index 00000000..01d58a1e
--- /dev/null
+++ b/surfaces/gui/src/gallery/states/connector-message.ts
@@ -0,0 +1,52 @@
+// Messages that arrive from a connector: `turn_start` payloads with a `source` sidecar.
+import type { CardState } from "../types";
+
+const from = (connector: string, kind: "channel" | "dm", channel: [string, string], sender: [string, string], text: string) => ({
+ source: {
+ connector,
+ kind,
+ channel_id: channel[0],
+ channel_name: channel[1],
+ sender_id: sender[0],
+ sender_name: sender[1],
+ ts: 1789900000,
+ text,
+ },
+});
+
+export const connectorMessageStates: CardState[] = [
+ {
+ id: "slack-channel",
+ title: "Slack channel",
+ note: "Names by default; hover swaps to the raw ids.",
+ payload: from("slack", "channel", ["C0BD7KZ1AH5", "#billing-eng"], ["U04ABCD12", "Jordan Lee"], "Can the staging deploy go out before the 3pm demo? The invoice PDF change needs to be on it."),
+ },
+ {
+ id: "slack-dm",
+ title: "Slack direct message",
+ payload: from("slack", "dm", ["D07XYZ", "Direct message"], ["U04ABCD12", "Jordan Lee"], "quick one — what's the status of BILL-212?"),
+ },
+ {
+ id: "github-mention",
+ title: "GitHub mention",
+ note: "How a relay mention on an issue arrives on the box.",
+ payload: from("github", "channel", ["acme/billing-service#3", "acme/billing-service #3"], ["demo-user", "demo-user"], "[lead] Add a PDF download to every invoice in the drawer. The statements worker already renders them; the API needs a route and the web client a button."),
+ },
+ {
+ id: "long-message",
+ title: "Long multi-line message",
+ payload: from(
+ "slack",
+ "channel",
+ ["C0BD7KZ1AH5", "#billing-eng"],
+ ["U04ABCD12", "Jordan Lee"],
+ "Three things from the customer call:\n\n1. They want the PDF to carry the PO number in the header.\n2. Statements for closed accounts should stay downloadable for seven years.\n3. The March invoices show the old tariff name.\n\nCan you look at 3 first? It is going in front of their finance team on Friday and I would rather not explain it live. Happy to pair on it after lunch if the tariff table is as confusing as I remember.",
+ ),
+ },
+ {
+ id: "unknown-connector",
+ title: "Unknown connector, ids only",
+ note: "No registry entry and unresolved names: plug glyph, neutral colour, ids shown as names.",
+ payload: from("pagerduty", "channel", ["PXY123", "PXY123"], ["U999", "U999"], "Incident #4821 acknowledged."),
+ },
+];
diff --git a/surfaces/gui/src/gallery/states/connector-request.ts b/surfaces/gui/src/gallery/states/connector-request.ts
new file mode 100644
index 00000000..53648a63
--- /dev/null
+++ b/surfaces/gui/src/gallery/states/connector-request.ts
@@ -0,0 +1,44 @@
+// `connector_requested` payloads.
+import type { CardState } from "../types";
+
+export const connectorRequestStates: CardState[] = [
+ {
+ id: "connect-jira",
+ title: "Connect a service",
+ note: "The lead needs a connector that is not connected on this machine yet.",
+ payload: {
+ request: "connect",
+ connector: "jira",
+ worker: "",
+ reason: 'You asked to "track the work in Jira", and Jira is not connected on this machine.',
+ },
+ },
+ {
+ id: "connect-linear",
+ title: "Connect a service (short reason)",
+ payload: { request: "connect", connector: "linear", worker: "", reason: "keep the tracker in step with the board" },
+ },
+ {
+ id: "grant-github",
+ title: "Give a worker a connector",
+ note: "Mid-run grant: the worker exists already and needs one more connector.",
+ payload: { request: "grant", connector: "github", worker: "nia", reason: "push the branch for #1" },
+ },
+ {
+ id: "long-reason",
+ title: "Long reason",
+ payload: {
+ request: "grant",
+ connector: "github",
+ worker: "checks",
+ reason:
+ "checks found that the UI test needs the preview deployment's URL, which GitHub posts as a deployment status on the pull request. Reading that status needs the GitHub connector; without it checks would have to guess the URL from the branch name, which has been wrong twice this week.",
+ },
+ },
+ {
+ id: "minimal",
+ title: "Minimal payload",
+ note: "No reason, no worker.",
+ payload: { request: "connect", connector: "slack" },
+ },
+];
diff --git a/surfaces/gui/src/gallery/states/directory-request.ts b/surfaces/gui/src/gallery/states/directory-request.ts
new file mode 100644
index 00000000..5522e1c7
--- /dev/null
+++ b/surfaces/gui/src/gallery/states/directory-request.ts
@@ -0,0 +1,28 @@
+// `directory_requested` payloads.
+import type { CardState } from "../types";
+
+export const directoryRequestStates: CardState[] = [
+ {
+ id: "read-only",
+ title: "Read a folder",
+ payload: { reason: "Compare the statement template with the one marketing uses", path: "/Users/sam/Documents/brand/templates", writable: false, primary: false },
+ },
+ {
+ id: "writable",
+ title: "Write to a folder",
+ note: "The access level arrives pre-selected as the agent asked; the human can lower it.",
+ payload: { reason: "Save the regenerated statements next to the originals", path: "/Users/sam/SpaceSol/statements", writable: true, primary: false },
+ },
+ {
+ id: "make-workspace",
+ title: "Make it the workspace",
+ note: "Root promotion: the folder becomes the session's workspace, always writable.",
+ payload: { reason: "The repository lives here; I need it as the workspace to run the tests", path: "/Users/sam/fleet/demo-universe/billing-service", writable: true, primary: true },
+ },
+ {
+ id: "no-path",
+ title: "No folder suggested",
+ note: "The agent gave a reason but no path: the human has to pick one.",
+ payload: { reason: "I need somewhere to put the exported CSV files" },
+ },
+];
diff --git a/surfaces/gui/src/gallery/states/index.ts b/surfaces/gui/src/gallery/states/index.ts
new file mode 100644
index 00000000..fcf94772
--- /dev/null
+++ b/surfaces/gui/src/gallery/states/index.ts
@@ -0,0 +1,37 @@
+// Every card's states by card id — data only, no React, so the Playwright fixture and the
+// JSON export for the server-side contract check can import it.
+import type { CardState } from "../types";
+import { approvalStates } from "./approval";
+import { boardWakeStates } from "./board-wake";
+import { connectorMessageStates } from "./connector-message";
+import { connectorRequestStates } from "./connector-request";
+import { directoryRequestStates } from "./directory-request";
+import { planStates } from "./plan";
+import { questionStates } from "./question";
+import { teamRequestStates } from "./team-request";
+import { toolRequestStates } from "./tool-request";
+import { workItemsStates } from "./work-items";
+import { workerDecisionStates } from "./worker-decision";
+
+export const STATES = {
+ approval: approvalStates,
+ plan: planStates,
+ "team-request": teamRequestStates,
+ "work-items": workItemsStates,
+ "connector-request": connectorRequestStates,
+ "worker-decision": workerDecisionStates,
+ question: questionStates,
+ "directory-request": directoryRequestStates,
+ "tool-request": toolRequestStates,
+ "board-wake": boardWakeStates,
+ "connector-message": connectorMessageStates,
+} satisfies Record<string, CardState[]>;
+
+export type CardId = keyof typeof STATES;
+
+/** The payload of one named state. Throws on a typo, so a renamed state fails loudly. */
+export function statePayload(card: CardId, id: string): Record<string, unknown> {
+ const state = STATES[card].find((s) => s.id === id);
+ if (!state) throw new Error(`no gallery state ${card}/${id}`);
+ return state.payload;
+}
diff --git a/surfaces/gui/src/gallery/states/plan.ts b/surfaces/gui/src/gallery/states/plan.ts
new file mode 100644
index 00000000..30b458e8
--- /dev/null
+++ b/surfaces/gui/src/gallery/states/plan.ts
@@ -0,0 +1,26 @@
+// `plan_proposed` payloads.
+import type { CardState } from "../types";
+
+export const planStates: CardState[] = [
+ {
+ id: "short-plan",
+ title: "Short plan",
+ payload: {
+ plan: "1. Add `GET /invoices/:id/pdf` to the API.\n2. Add the download button to the invoice drawer.\n3. Write tests for both and run the suites.",
+ },
+ },
+ {
+ id: "long-plan",
+ title: "Long plan with headings and code",
+ note: "Markdown: headings, lists, inline code, a fenced block.",
+ payload: {
+ plan: "## Goal\nEvery invoice gets a PDF download.\n\n## Steps\n1. **API** — add `GET /invoices/:id/pdf`. Stream the file from S3 with the billing role.\n - 404 when `pdf_key` is null\n - 403 for another account's invoice\n2. **Worker** — backfill statements for seeded invoices:\n\n```bash\npython -m worker statements --missing-only\n```\n\n3. **Web** — a download button in the invoice drawer, disabled while the statement renders.\n4. **Tests** — API (happy path, missing file, foreign account), UI (button and error toast).\n\n## Risks\n- The bucket policy in `infra/storage.tf` is wider than it should be; I will not touch it in this change.\n- Rendering is slow for accounts with more than 500 meters.\n\n## Out of scope\nEmailing the PDF.",
+ },
+ },
+ {
+ id: "minimal",
+ title: "Minimal payload",
+ note: "An empty plan: the card must not collapse.",
+ payload: { plan: "" },
+ },
+];
diff --git a/surfaces/gui/src/gallery/states/question.ts b/surfaces/gui/src/gallery/states/question.ts
new file mode 100644
index 00000000..25ad1f8b
--- /dev/null
+++ b/surfaces/gui/src/gallery/states/question.ts
@@ -0,0 +1,77 @@
+// `question_requested` payloads (ask_user). Parked, the same fields sit on the Inbox item.
+import type { CardState } from "../types";
+
+export const questionStates: CardState[] = [
+ {
+ id: "quick-replies",
+ title: "Quick replies",
+ note: "Plain options answer on click; free text is always available.",
+ payload: {
+ question: "Which environment should I restart?",
+ options: ["staging", "production"],
+ allow_text: true,
+ multi: false,
+ },
+ },
+ {
+ id: "rich-options",
+ title: "Options with descriptions",
+ note: "A description on any option turns the pills into rows; one is marked Recommended.",
+ payload: {
+ header: "PDF storage",
+ question: "Where should generated invoice PDFs live?",
+ options: [
+ { label: "S3, private bucket", description: "Served through the API with the billing role. Matches how statements work today.", recommended: true },
+ { label: "Database (bytea)", description: "No new infrastructure, but invoices average 180 KB and the table is already large." },
+ { label: "Generate on demand", description: "Nothing stored; every download costs a render of about two seconds." },
+ ],
+ allow_text: true,
+ multi: false,
+ },
+ },
+ {
+ id: "options-with-preview",
+ title: "Options with a preview pane",
+ note: "A preview on any option adds the side pane; it follows hover and focus.",
+ payload: {
+ header: "Error shape",
+ question: "Which error body should the PDF route return?",
+ options: [
+ { label: "Problem JSON", description: "RFC 9457, as the newer routes do.", recommended: true, preview: '{\n "type": "about:blank",\n "title": "Invoice has no PDF",\n "status": 404\n}' },
+ { label: "Legacy envelope", description: "What the web client parses today.", preview: '{\n "error": {\n "code": "NO_PDF",\n "message": "Invoice has no PDF"\n }\n}' },
+ ],
+ allow_text: false,
+ multi: false,
+ },
+ },
+ {
+ id: "multi-select",
+ title: "Multi-select",
+ note: "Ticks accumulate; the answer is sent with the button.",
+ payload: {
+ question: "Which suites should run before I open the pull request?",
+ options: ["API", "Web", "Worker", "Terraform validate"],
+ allow_text: true,
+ multi: true,
+ },
+ },
+ {
+ id: "grouped",
+ title: "Grouped questions (stepper)",
+ note: "Several questions in one ask: a stepper, answered as one JSON object.",
+ payload: {
+ question: "",
+ questions: [
+ { header: "Scope", question: "Should the download work for draft invoices too?", options: ["Issued only", "Drafts too"], allow_text: true },
+ { header: "Naming", question: "What should the file be called?", options: ["invoice-<number>.pdf", "<account>-<period>.pdf"], allow_text: true },
+ { header: "Rollout", question: "Ship behind a flag?", options: [{ label: "Yes", description: "Off by default; on for the demo account.", recommended: true }, { label: "No", description: "Visible to every account at once." }], allow_text: false },
+ ],
+ },
+ },
+ {
+ id: "minimal",
+ title: "Minimal payload",
+ note: "A bare question: free text only.",
+ payload: { question: "What should the branch be called?" },
+ },
+];
diff --git a/surfaces/gui/src/gallery/states/team-request.ts b/surfaces/gui/src/gallery/states/team-request.ts
new file mode 100644
index 00000000..03a3d451
--- /dev/null
+++ b/surfaces/gui/src/gallery/states/team-request.ts
@@ -0,0 +1,312 @@
+// `team_proposed` payloads (and the parked `gate: "team"` Inbox item's data — same fields).
+import type { CardState } from "../types";
+
+const MODELS = [
+ { id: "anthropic:claude-opus-4-8", label: "Claude Opus 4.8" },
+ { id: "anthropic:claude-sonnet-4-8", label: "Claude Sonnet 4.8" },
+ { id: "openai:gpt-5.2", label: "GPT-5.2" },
+ { id: "ollama:qwen3-coder:30b", label: "Qwen3 Coder 30B (local)" },
+];
+const OPUS = MODELS[0].id;
+const SONNET = MODELS[1].id;
+
+// The machine the workers run on: what it can run, and what each persona recommends there.
+const MACHINE = {
+ lead_mode: "auto-approve",
+ lead_model: SONNET,
+ runnable_models: MODELS,
+ model_options: {
+ "swe-worker": [OPUS, SONNET],
+ "test-worker": [SONNET],
+ "review-worker": [OPUS, SONNET],
+ "docs-worker": [SONNET],
+ },
+};
+
+const nia = { persona: "swe-worker", name: "nia", reason: "Builds the PDF endpoint and the download button", resolved_model: OPUS };
+const checks = { persona: "test-worker", name: "checks", reason: "Writes the API and UI tests, runs the suite", resolved_model: SONNET };
+
+// Large rosters, for designing the grouped card (owner ask 2026-09-17: teams of 10-20+).
+const BUILD_JOBS = [
+ "invoice PDF route", "statement renderer", "rate limiting on the PDF route", "download button",
+ "error toasts", "meter import job", "usage rollups", "tariff table migration", "account search",
+ "CSV export", "audit log for downloads", "retry policy for S3 reads",
+];
+function roster(builders: number, testers: number, reviewers: number, docs: number) {
+ const names = ["nia", "omar", "lena", "kofi", "mei", "ravi", "sara", "tomas", "yuki", "amara", "dev", "elif"];
+ const gh = (why: string) => ({ connectors: ["github"], connector_reasons: { github: why } });
+ return [
+ ...Array.from({ length: builders }, (_, i) => ({
+ persona: "swe-worker", name: names[i % names.length] + (i >= names.length ? `-${i + 1}` : ""),
+ reason: `Builds the ${BUILD_JOBS[i % BUILD_JOBS.length]}`, resolved_model: OPUS, ...gh("pushes its branch"),
+ })),
+ ...Array.from({ length: testers }, (_, i) => ({
+ persona: "test-worker", name: `checks-${i + 1}`, reason: `Tests builders ${i * 2 + 1} and ${i * 2 + 2}`,
+ resolved_model: SONNET,
+ })),
+ ...Array.from({ length: reviewers }, (_, i) => ({
+ persona: "review-worker", name: `second-look-${i + 1}`, reason: "Reviews finished branches before the PR",
+ resolved_model: OPUS, ...gh("comments on the branch diff"),
+ })),
+ ...Array.from({ length: docs }, (_, i) => ({
+ persona: "docs-worker", name: i ? `scribe-${i + 1}` : "scribe", reason: "Keeps the runbook and the API spec current",
+ resolved_model: SONNET,
+ })),
+ ];
+}
+const BIG_OFFER = { "swe-worker": ["github"], "test-worker": ["github"], "review-worker": ["github"], "docs-worker": [] };
+
+export const teamRequestStates: CardState[] = [
+ {
+ id: "lead-suggested-github",
+ title: "Lead suggested GitHub",
+ note: "nia arrives ticked for GitHub with the lead's reason; checks has GitHub offered but unticked.",
+ payload: {
+ ...MACHINE,
+ members: [
+ { ...nia, connectors: ["github"], connector_reasons: { github: "pushes the branch and opens the PR" } },
+ checks,
+ ],
+ offer: { "swe-worker": ["github"], "test-worker": ["github"] },
+ other_connected: ["linear", "slack"],
+ enable_chat: false,
+ note: "Two workers: one builds, one verifies.",
+ },
+ },
+ {
+ id: "nothing-suggested",
+ title: "Nothing suggested",
+ note: "The lead named no connectors: everything in the usual set is offered, unticked.",
+ payload: {
+ ...MACHINE,
+ members: [nia, checks],
+ offer: { "swe-worker": ["github"], "test-worker": ["github"] },
+ other_connected: ["linear"],
+ enable_chat: false,
+ note: "",
+ },
+ },
+ {
+ id: "beyond-usual-set",
+ title: "Beyond the usual set (Jira quoted)",
+ note: "Jira is outside swe-worker's usual set; the lead may suggest it only with the human's own words.",
+ payload: {
+ ...MACHINE,
+ members: [
+ {
+ ...nia,
+ connectors: ["github", "jira"],
+ connector_reasons: {
+ github: "pushes the branch and opens the PR",
+ jira: 'you asked: "track the work in Jira, ticket BILL-212"',
+ },
+ },
+ checks,
+ ],
+ offer: { "swe-worker": ["github"], "test-worker": ["github"] },
+ other_connected: ["jira", "linear", "slack"],
+ enable_chat: true,
+ note: "nia updates BILL-212 as the work moves.",
+ },
+ },
+ {
+ id: "no-connectors-available",
+ title: "No connectors available",
+ note: "Nothing is connected on this machine: no offer, no expander.",
+ payload: {
+ ...MACHINE,
+ members: [nia, checks],
+ offer: { "swe-worker": [], "test-worker": [] },
+ other_connected: [],
+ enable_chat: false,
+ note: "",
+ },
+ },
+ {
+ id: "model-fallback",
+ title: "Model fallback warning (Manual lead)",
+ note: "test-worker recommends only models this machine cannot run, so checks falls back to the lead's model. design-worker has no connectors in its usual set.",
+ payload: {
+ members: [
+ { persona: "swe-worker", name: "nia", model: OPUS, resolved_model: OPUS, reason: "implementation", connectors: ["github"], connector_reasons: { github: "pushes the branch and opens the PR" } },
+ { persona: "design-worker", name: "webb", model: SONNET, resolved_model: SONNET, reason: "UI polish" },
+ {
+ persona: "test-worker",
+ name: "checks",
+ model: SONNET,
+ resolved_model: SONNET,
+ model_warning:
+ "None of test-worker's recommended models can run on this machine, so checks will use the lead's model (Claude Sonnet 4.8).",
+ reason: "verifies against acceptance criteria",
+ },
+ ],
+ enable_chat: false,
+ note: "Three workers cover the plan; checks verifies before anything closes.",
+ offer: { "swe-worker": ["github"], "design-worker": [], "test-worker": ["github"] },
+ other_connected: ["linear"],
+ lead_mode: "interactive",
+ model_options: { "swe-worker": [OPUS, SONNET], "design-worker": [SONNET], "test-worker": [] },
+ runnable_models: [
+ { id: OPUS, label: "Claude Opus 4.8" },
+ { id: SONNET, label: "Claude Sonnet 4.8" },
+ { id: "anthropic:claude-haiku-4-8", label: "Claude Haiku 4.8" },
+ ],
+ lead_model: SONNET,
+ },
+ },
+ {
+ id: "non-recommended-model",
+ title: "Non-recommended model",
+ note: "The lead asked for a local model swe-worker does not recommend, so the server kept the recommendation. Choose one under “Other models” on nia's row to see the quiet note.",
+ payload: {
+ ...MACHINE,
+ members: [{ ...nia, model: "ollama:qwen3-coder:30b", resolved_model: OPUS }, checks],
+ offer: { "swe-worker": ["github"], "test-worker": ["github"] },
+ other_connected: [],
+ enable_chat: false,
+ note: "",
+ },
+ },
+ {
+ id: "old-server",
+ title: "Old server (no model info)",
+ note: "A box on an older build: no models, no other_connected, no lead mode. The card must still work.",
+ payload: {
+ members: [
+ { persona: "swe-worker", name: "nia", reason: "Builds it" },
+ { persona: "test-worker", name: "checks", reason: "Verifies it" },
+ ],
+ offer: { "swe-worker": ["github"], "test-worker": [] },
+ enable_chat: false,
+ note: "",
+ },
+ },
+ {
+ id: "old-server-raw-model-ids",
+ title: "Old server, raw model ids",
+ note: "What a card parked before 2026-09-17 carries: the lead's model as a provider:id string and nothing else. The card shows the name; the full id is in the hover text.",
+ payload: {
+ members: [
+ { persona: "swe-worker", name: "nia", model: OPUS, reason: "Implements the api/ authorization fix and the web/ button gating for issue #3." },
+ { persona: "test-worker", name: "checks", model: OPUS, reason: "Independently verifies the fix and proves the 403 + owner/staff paths with API tests." },
+ ],
+ offer: { "swe-worker": ["github"], "test-worker": ["github"] },
+ enable_chat: true,
+ note: "Two workers for issue #3, as requested: nia implements the api/ + web/ fix, checks independently proves the 403 and owner/staff paths with API tests. Chat enabled so nia and checks can align on handler status codes.",
+ },
+ },
+ {
+ id: "unknown-lead-mode",
+ title: "Unknown lead mode",
+ note: "Models are known but the lead's mode is not: the approvals line stays hidden.",
+ payload: {
+ ...MACHINE,
+ lead_mode: undefined,
+ members: [nia, checks],
+ offer: { "swe-worker": ["github"], "test-worker": ["github"] },
+ other_connected: [],
+ enable_chat: false,
+ note: "",
+ },
+ },
+ {
+ id: "long-note",
+ title: "Long note",
+ note: "The lead's note clamps to two lines with More / Less.",
+ payload: {
+ ...MACHINE,
+ members: [
+ { ...nia, connectors: ["github"], connector_reasons: { github: "pushes the branch and opens the PR" } },
+ checks,
+ ],
+ offer: { "swe-worker": ["github"], "test-worker": ["github"] },
+ other_connected: ["linear"],
+ enable_chat: true,
+ note:
+ "The issue asks for a PDF download on every invoice. nia adds GET /invoices/:id/pdf to the API, streams the stored statement from S3 with the billing role, and adds the button to the invoice drawer. checks writes API tests for the happy path, a missing file and a foreign account, plus a UI test for the button, then runs all three suites. I review both branches and open one pull request against main when the suite is green.",
+ },
+ },
+ {
+ id: "one-worker",
+ title: "One worker",
+ payload: {
+ ...MACHINE,
+ members: [{ ...nia, connectors: ["github"], connector_reasons: { github: "pushes the branch and opens the PR" } }],
+ offer: { "swe-worker": ["github"] },
+ other_connected: [],
+ enable_chat: false,
+ note: "Small change; one worker is enough.",
+ },
+ },
+ {
+ id: "six-workers",
+ title: "Six workers",
+ note: "Three builders share a line; the three single-worker roles keep their ordinary rows.",
+ payload: {
+ ...MACHINE,
+ members: [
+ { ...nia, connectors: ["github"], connector_reasons: { github: "pushes the API branch" } },
+ { persona: "swe-worker", name: "omar", reason: "Builds the web client changes", resolved_model: OPUS, connectors: ["github"], connector_reasons: { github: "pushes the web branch" } },
+ { persona: "swe-worker", name: "lena", reason: "Updates the statements worker", resolved_model: OPUS },
+ checks,
+ { persona: "review-worker", name: "second-look", reason: "Reviews the three branches before the PR", resolved_model: OPUS },
+ { persona: "docs-worker", name: "scribe", reason: "Updates the runbook and the API spec", resolved_model: SONNET },
+ ],
+ offer: { "swe-worker": ["github"], "test-worker": ["github"], "review-worker": ["github"], "docs-worker": [] },
+ other_connected: ["linear", "slack"],
+ enable_chat: true,
+ note: "Three builders in parallel, then tests, review and docs.",
+ },
+ },
+ {
+ id: "twelve-workers",
+ title: "Twelve workers",
+ note: "Four roles, twelve workers: one line per role, one model and one set of connectors for the role. “Show workers” opens the per-worker rows.",
+ payload: {
+ ...MACHINE,
+ members: roster(6, 3, 2, 1),
+ offer: BIG_OFFER,
+ other_connected: ["linear", "slack"],
+ enable_chat: true,
+ note: "Six builders in parallel, one tester per two builders, two reviewers, one writer.",
+ },
+ },
+ {
+ id: "twenty-four-workers",
+ title: "Twenty-four workers",
+ note: "Twenty-four workers read as four lines. The testers' fallback warning sits on the role line.",
+ payload: {
+ ...MACHINE,
+ // The fallback is a fact about the role on this machine, so every tester carries it.
+ model_options: { ...MACHINE.model_options, "test-worker": [] },
+ members: roster(12, 6, 4, 2).map((m) =>
+ m.persona === "test-worker"
+ ? { ...m, model_warning: "None of test-worker's recommended models can run on this machine. It will use the lead's model, Claude Sonnet 4.8." }
+ : m,
+ ),
+ offer: BIG_OFFER,
+ other_connected: ["linear", "slack"],
+ enable_chat: true,
+ note: "Twelve builders, six testers, four reviewers, two writers.",
+ },
+ },
+ {
+ id: "mixed-within-a-role",
+ title: "Mixed within a role",
+ note: "The lead split one role: two builders on another model, and one builder without GitHub. The role line says so without opening.",
+ payload: {
+ ...MACHINE,
+ members: roster(6, 2, 0, 0).map((m, i) =>
+ i === 4 || i === 5
+ ? { ...m, resolved_model: SONNET, reason: `${m.reason} (small change)` }
+ : i === 3
+ ? { ...m, connectors: [], connector_reasons: {} }
+ : m,
+ ),
+ offer: BIG_OFFER,
+ other_connected: ["linear"],
+ enable_chat: false,
+ note: "Four builders on the larger model for the API work; two on the smaller one for copy changes.",
+ },
+ },
+];
diff --git a/surfaces/gui/src/gallery/states/tool-request.ts b/surfaces/gui/src/gallery/states/tool-request.ts
new file mode 100644
index 00000000..8124d3ec
--- /dev/null
+++ b/surfaces/gui/src/gallery/states/tool-request.ts
@@ -0,0 +1,37 @@
+// `tool_requested` payloads.
+import type { CardState } from "../types";
+
+export const toolRequestStates: CardState[] = [
+ {
+ id: "installable",
+ title: "Pinned build available",
+ note: "The fact strip is the product speaking (registry metadata), apart from the coworker's quoted reason.",
+ payload: {
+ name: "gitleaks",
+ reason: "scan the git history for committed secrets",
+ installable: true,
+ version: "8.30.1",
+ summary: "scans git history and the working tree for committed secrets",
+ source: "github.com/gitleaks",
+ },
+ },
+ {
+ id: "not-installable",
+ title: "No pinned build (old payload shape)",
+ note: "No installable / version / summary: must render NOT installable, never a guessed Install offer (owner-hit 2026-08-14).",
+ payload: { name: "somescanner", reason: "scan the Terraform for misconfigurations" },
+ },
+ {
+ id: "long-reason",
+ title: "Long reason",
+ payload: {
+ name: "trivy",
+ reason:
+ "check the three container images for known vulnerabilities before the pull request goes up, because the API image moved to a new Node base this week and the last scan predates that change",
+ installable: true,
+ version: "0.56.2",
+ summary: "scans container images, filesystems and IaC for vulnerabilities and misconfigurations",
+ source: "github.com/aquasecurity/trivy",
+ },
+ },
+];
diff --git a/surfaces/gui/src/gallery/states/work-items.ts b/surfaces/gui/src/gallery/states/work-items.ts
new file mode 100644
index 00000000..e46cc2e0
--- /dev/null
+++ b/surfaces/gui/src/gallery/states/work-items.ts
@@ -0,0 +1,67 @@
+// `items_proposed` payloads (and the parked `gate: "items"` Inbox item's data).
+import type { CardState } from "../types";
+
+export const workItemsStates: CardState[] = [
+ {
+ id: "three-items",
+ title: "Three items",
+ note: "The common case: everything fits without the expander.",
+ payload: {
+ items: [
+ { title: "Add GET /invoices/:id/pdf", criteria: "Returns the stored PDF for the caller's own invoice; 404 for a missing file; 403 for another account." },
+ { title: "Download button in the invoice drawer", criteria: "The button downloads the PDF and shows an error toast when the API fails." },
+ { title: "Tests for both", criteria: "API and UI tests pass in CI." },
+ ],
+ note: "Split by surface so the API and the web client can move in parallel.",
+ },
+ },
+ {
+ id: "statements-split",
+ title: "Four items, one long criterion",
+ note: "A criterion past the clamp gets “Show full criteria”; the fourth item sits behind the expander.",
+ payload: {
+ items: [
+ { title: "Statement API endpoint", criteria: "returns opening/closing balances over the chosen range; 8 endpoint tests green; malformed, missing, and reversed date ranges return 400; draft invoices are excluded from issued totals; inclusive boundaries verified end to end" },
+ { title: "Statements dashboard page", criteria: "renders seeded data for Ada / Northgate; empty + error states covered" },
+ { title: "Statement totals reconcile", criteria: "running balance matches invoices minus payments for the range" },
+ { title: "Verification pass", criteria: "tester confirms page renders with live API data" },
+ ],
+ note: "Shared journal case: statements.",
+ },
+ },
+ {
+ id: "seven-items",
+ title: "Seven items, long criteria",
+ note: "More than three items collapse behind the expander; long criteria wrap.",
+ payload: {
+ items: [
+ { title: "Schema: add invoices.pdf_generated_at", criteria: "Migration applies cleanly on an empty database and on the seeded one; rollback drops only the new column." },
+ { title: "Worker: regenerate missing statements", criteria: "A nightly job finds invoices with a null pdf_key, renders the statement, uploads it under statements/<account>/<invoice>.pdf and records the key. Re-running the job makes no second upload.", description: "The seed data ships with null keys; the first run fills them." },
+ { title: "API: GET /invoices/:id/pdf", criteria: "Streams the file with the billing role; 404 when there is no key; 403 for another account's invoice." },
+ { title: "API: rate-limit the PDF route", criteria: "More than 30 requests a minute from one account returns 429 with a Retry-After header." },
+ { title: "Web: download button", criteria: "Visible only when the invoice has a PDF; disabled with a tooltip while the statement is still rendering." },
+ { title: "Web: error states", criteria: "A failed download shows a toast and leaves the drawer open." },
+ { title: "Docs: runbook entry", criteria: "The runbook explains how to regenerate one statement by hand." },
+ ],
+ note: "",
+ },
+ },
+ {
+ id: "done-when-prefix",
+ title: "Criteria with a “Done when” prefix",
+ note: "Leads often write “Done when: …”. The card prints its own label, so the prefix is stripped.",
+ payload: {
+ items: [
+ { title: "Cap the retry backoff", criteria: "Done when: no wait exceeds maxDelayMs, with a unit test for the cap." },
+ { title: "Log the final attempt", criteria: "done when the last failure is logged once at warn level" },
+ ],
+ note: "",
+ },
+ },
+ {
+ id: "minimal",
+ title: "Minimal payload",
+ note: "One item, no note, no description: the least a server can send.",
+ payload: { items: [{ title: "Fix the typo in the README", criteria: "The heading reads “Billing service”." }] },
+ },
+];
diff --git a/surfaces/gui/src/gallery/states/worker-decision.ts b/surfaces/gui/src/gallery/states/worker-decision.ts
new file mode 100644
index 00000000..533bbf91
--- /dev/null
+++ b/surfaces/gui/src/gallery/states/worker-decision.ts
@@ -0,0 +1,104 @@
+// `permission_required` payloads for `decide_worker_call`: a lead answering one of its
+// workers' waiting calls. `worker_call` is attached by the server (looked up by `call_id`).
+import type { CardState } from "../types";
+
+const CALL_ID = "c51dc4bd79f74e87b7fc59050dc41c37";
+
+const decision = (worker: string, d: "allow" | "deny", note: string) => ({
+ name: "decide_worker_call",
+ arguments: { worker, call_id: CALL_ID, decision: d, note },
+ reason: "requires approval",
+ category: "team",
+});
+
+export const workerDecisionStates: CardState[] = [
+ {
+ id: "lead-denies-command",
+ title: "Lead denies a command",
+ note: "The owner's case (2026-09-17): the worker is about to run something in a folder that is already finished. Both halves are visible; the buttons say what happens to the WORKER'S command.",
+ payload: {
+ ...decision("nia", "deny", "That targets the issue-1 worktree, which is already done and merged (PR #2). Your item is #3: work in the issue-3 worktree only."),
+ worker_call: {
+ worker: "nia",
+ tool: "run_shell",
+ arguments: { command: "cd /home/user/work/billing-service/issue-1/web && npm run build", description: "Rebuild the web client" },
+ reason: "requires approval",
+ state: "pending",
+ },
+ },
+ },
+ {
+ id: "lead-allows-command",
+ title: "Lead allows a command",
+ note: "A Manual lead saying yes: the human confirms or stops it.",
+ context: { mode: "interactive" },
+ payload: {
+ ...decision("checks", "allow", "This is the red-green check the item asks for: remove the fix, see the test fail, put it back. It stays inside the issue-3 worktree."),
+ worker_call: {
+ worker: "checks",
+ tool: "run_shell",
+ arguments: {
+ command:
+ "cd /home/user/work/billing-service/issue-3/api && cp src/invoices.ts /tmp/invoices.bak && sed -i 's/^ assertCanRead(claimsOf(req), invoice);$//' src/invoices.ts && npm test -- --run invoices; cp /tmp/invoices.bak src/invoices.ts",
+ description: "Temporarily remove fix, confirm cross-account test fails, then restore",
+ },
+ state: "pending",
+ },
+ },
+ },
+ {
+ id: "lead-denies-file-change",
+ title: "Lead denies a file change",
+ note: "A write, not a command: the preview is the proposed content.",
+ payload: {
+ ...decision("omar", "deny", "The item is the Export button only. Rewriting the shared API client is outside it, and nia is editing the same file."),
+ worker_call: {
+ worker: "omar",
+ tool: "write_file",
+ arguments: { path: "web/src/api.ts", content: "export async function getInvoices(params: InvoiceQuery) {\n const res = await http.get('/v1/invoices', { params });\n return res.data.invoices;\n}\n" },
+ state: "pending",
+ },
+ },
+ },
+ {
+ id: "already-answered",
+ title: "The call was already answered",
+ note: "Someone answered the worker directly while the lead was deciding: nothing is left to decide.",
+ payload: {
+ ...decision("nia", "deny", "That targets the issue-1 worktree, which is already done and merged (PR #2)."),
+ worker_call: {
+ worker: "nia",
+ tool: "run_shell",
+ arguments: { command: "cd /home/user/work/billing-service/issue-1/web && npm run build" },
+ state: "resolved",
+ resolution: "deny",
+ },
+ },
+ },
+ {
+ id: "long-note",
+ title: "Long reason, long command",
+ payload: {
+ ...decision(
+ "nia",
+ "deny",
+ "Three problems. First, it runs in the issue-1 worktree, which is merged; your item lives in issue-3. Second, it pipes a script from the network into the shell, which the item never asked for and which I cannot review from here. Third, the build it triggers would overwrite the dist folder that checks is using for the UI test right now. Re-run the build inside issue-3/web with the plain npm script instead, and tell me if that script is missing.",
+ ),
+ worker_call: {
+ worker: "nia",
+ tool: "run_shell",
+ arguments: {
+ command:
+ "set -euo pipefail\ncd /home/user/work/billing-service/issue-1/web\ncurl -fsSL https://example.com/setup-node.sh | bash\nnpm ci\nnpm run build\ncp -r dist ../../issue-3/web/dist\nls -la ../../issue-3/web/dist",
+ },
+ state: "pending",
+ },
+ },
+ },
+ {
+ id: "old-server",
+ title: "Old server (no worker call)",
+ note: "What a box sends before the server change: the decision without the call it answers. The card says so instead of printing an id.",
+ payload: decision("nia", "deny", "That targets the issue-1 worktree, which is already done and merged (PR #2)."),
+ },
+];
diff --git a/surfaces/gui/src/gallery/types.ts b/surfaces/gui/src/gallery/types.ts
new file mode 100644
index 00000000..11d270ac
--- /dev/null
+++ b/surfaces/gui/src/gallery/types.ts
@@ -0,0 +1,24 @@
+// Card gallery (dev only) — spec: ocw-context/docs/card-gallery-spec.md.
+//
+// A state is a NAME plus the exact payload the server sends for that card: the websocket
+// event's `data` for an inline card. The files under states/ hold data only (no React), so
+// the gallery, the unit tests, the Playwright fixture and the server-side contract check
+// can all read the same payloads.
+
+/** What the card reads from the app around it, not from the payload. */
+export interface StateContext {
+ /** The session's approval mode (composer state) — "auto-approve" hides session grants. */
+ mode?: string;
+ /** The automation run this approval was raised in — unlocks "Allow every time". */
+ runTask?: { id: string; title: string };
+}
+
+export interface CardState<P = Record<string, unknown>> {
+ /** URL slug: /#/gallery/<card>/<id>. Never rename once linked. */
+ id: string;
+ title: string;
+ /** One line on what to look at in this state. */
+ note?: string;
+ payload: P;
+ context?: StateContext;
+}
diff --git a/surfaces/gui/vitest.contract.config.ts b/surfaces/gui/vitest.contract.config.ts
new file mode 100644
index 00000000..20eee391
--- /dev/null
+++ b/surfaces/gui/vitest.contract.config.ts
@@ -0,0 +1,9 @@
+// Runs only the gallery contract writer (npm run gallery:contract); the normal test run
+// never includes scripts/.
+import { defineConfig } from "vitest/config";
+import react from "@vitejs/plugin-react";
+
+export default defineConfig({
+ plugins: [react()],
+ test: { environment: "jsdom", include: ["scripts/**/*.write.test.ts"] },
+});
diff --git a/tests/test_gallery_contract.py b/tests/test_gallery_contract.py
new file mode 100644
index 00000000..0dbc294f
--- /dev/null
+++ b/tests/test_gallery_contract.py
@@ -0,0 +1,193 @@
+"""The GUI's card gallery and the server must agree on what a card's payload looks like.
+
+`surfaces/gui/src/gallery/states.contract.json` is generated from the gallery's state files
+(`npm run gallery:contract`). Here the same items are built by the REAL server code against
+a fixed fake machine, then compared with that file by field name and JSON type:
+
+ * a field the server sends that no gallery state has → the card has never been looked
+ at with that field (the bug class of 2026-09-16: a payload the card did not expect);
+ * a field the card's common-case state relies on that the server does not send
+ → the card would render wrong in the app while looking right in the gallery.
+
+No network, no LLM."""
+
+from __future__ import annotations
+
+import asyncio
+import json
+from pathlib import Path
+
+import pytest
+
+from coworker.server.manager import SessionManager
+from coworker.sessions import SessionRecord
+
+CONTRACT = Path(__file__).resolve().parents[1] / "surfaces/gui/src/gallery/states.contract.json"
+OPUS, SONNET = "anthropic:claude-opus-4-8", "anthropic:claude-sonnet-4-8"
+
+
[email protected](scope="module")
+def contract():
+ return json.loads(CONTRACT.read_text())["cards"]
+
+
+def manager(tmp_path, monkeypatch):
+ monkeypatch.setenv("COWORKER_STATE_DIR", str(tmp_path / "state"))
+ ws = tmp_path / "repo"
+ ws.mkdir()
+ m = SessionManager(data_dir=tmp_path / "data", workspace=str(ws))
+ m.secrets.put("github:default", {"token": "ghp_test", "enabled": True})
+ m.secrets.put("linear:default", {"token": "lin_test", "enabled": True})
+ # A machine that can run two models, so the payload carries real model information.
+ monkeypatch.setattr(m, "model_selectable", lambda model: model in (OPUS, SONNET))
+ monkeypatch.setattr(m, "_curated_models", lambda: [OPUS, SONNET])
+ m.session_store.save(
+ SessionRecord(session_id="lead-sid", workspace=m.default_workspace, model=SONNET, mode="auto-approve", messages=[], agent="swe-lead")
+ )
+ yield m
+
+
+def _kind(value) -> str:
+ if isinstance(value, bool):
+ return "bool"
+ if isinstance(value, (int, float)):
+ return "number"
+ return {str: "string", list: "array", dict: "object", type(None): "null"}[type(value)]
+
+
+def _compare(label: str, server: dict, canonical: dict, all_states: list[dict]) -> list[str]:
+ problems = []
+ known = {k for s in all_states for k in s}
+ for key in sorted(set(server) - known):
+ problems.append(f"{label}: the server sends `{key}` but no gallery state has it")
+ for key in sorted(set(canonical) - set(server)):
+ problems.append(f"{label}: the gallery's common case relies on `{key}` but the server does not send it")
+ for key in sorted(set(server) & set(canonical)):
+ a, b = _kind(server[key]), _kind(canonical[key])
+ if "null" not in (a, b) and a != b:
+ problems.append(f"{label}: `{key}` is {a} from the server but {b} in the gallery")
+ return problems
+
+
+async def _parked(manager, start, title_prefix):
+ task = asyncio.create_task(start)
+ for _ in range(100):
+ await asyncio.sleep(0.02)
+ items = [i for i in manager.inbox.list(session_id="lead-sid", state="pending") if i.title.startswith(title_prefix)]
+ if items:
+ return task, items[0]
+ raise AssertionError(f"nothing parked for {title_prefix!r}")
+
+
+def _inbox_data(card: dict) -> tuple[dict, list[dict]]:
+ items = card["inbox"]
+ return items[card["canonical"]].get("data") or {}, [i.get("data") or {} for i in items.values()]
+
+
+async def test_staffing_card_payload_matches_the_gallery(manager, contract):
+ card = contract["team-request"]
+ approve = manager.inbox_team_approver("lead-sid", "swe-lead")
+ args = {
+ "members": [
+ {"persona": "swe-worker", "name": "nia", "reason": "builds it", "connectors": ["github"], "connector_reasons": {"github": "pushes the branch"}},
+ {"persona": "test-worker", "name": "checks", "reason": "verifies it"},
+ ],
+ "note": "Two workers.",
+ }
+ task, item = await _parked(manager, approve(args, "t1"), "Create this team?")
+ data = item.data or {}
+ canonical, states = _inbox_data(card)
+ problems = _compare("team gate", data, canonical, states)
+ # Same check one level down: the roster rows.
+ gallery_members = [m for s in states for m in s.get("members", [])]
+ canonical_member = {k: v for k, v in canonical["members"][0].items()}
+ for member in data["members"]:
+ problems += _compare("team member", member, {k: canonical_member[k] for k in ("persona", "name", "resolved_model")}, gallery_members)
+ # The inline event carries the same fields minus the gate marker.
+ event_canonical = card["states"][card["canonical"]]
+ problems += _compare("team_proposed", {k: v for k, v in data.items() if k != "gate"}, event_canonical, list(card["states"].values()))
+ manager.inbox.resolve(item.id, '{"approved": false}')
+ await task
+ assert not problems, "\n".join(problems)
+
+
+async def test_work_items_payload_matches_the_gallery(manager, contract):
+ card = contract["work-items"]
+ approve = manager.inbox_items_approver("lead-sid", "swe-lead")
+ args = {"items": [{"title": "Cap the backoff", "criteria": "no wait exceeds maxDelayMs", "description": "in retry.ts"}], "note": "one item"}
+ task, item = await _parked(manager, approve(args, "t2"), "Approve the proposed")
+ canonical, states = _inbox_data(card)
+ problems = _compare("items gate", item.data or {}, canonical, states)
+ gallery_items = [i for s in card["states"].values() for i in s.get("items", [])]
+ problems += _compare("work item", (item.data or {})["items"][0], {"title": "", "criteria": ""}, gallery_items)
+ manager.inbox.resolve(item.id, '{"approved": false}')
+ await task
+ assert not problems, "\n".join(problems)
+
+
+async def test_connector_request_payload_matches_the_gallery(manager, contract):
+ card = contract["connector-request"]
+ ask = manager.inbox_connector_requester("lead-sid", "swe-lead")
+ task, item = await _parked(manager, ask({"connector": "jira", "reason": "track the work"}, "t3"), "Connect jira?")
+ canonical, states = _inbox_data(card)
+ problems = _compare("connector request", item.data or {}, canonical, states)
+ # The gallery writes the same title the server does.
+ assert item.title == card["inbox"][card["canonical"]]["title"].replace("jira", "jira")
+ manager.inbox.resolve(item.id, '{"approved": false}')
+ await task
+ assert not problems, "\n".join(problems)
+
+
+def test_approval_prompt_data_matches_the_gallery(manager, contract):
+ card = contract["approval"]
+
+ class Request:
+ tool_name = "run_shell"
+ arguments = {"command": "ls"}
+ metadata = None
+
+ canonical, states = _inbox_data(card)
+ problems = _compare("parked approval", manager.approval_prompt_data("lead-sid", Request()), canonical, states)
+ assert not problems, "\n".join(problems)
+
+
+def test_question_fields_match_the_gallery(contract):
+ from coworker.tools.ask import question_item_fields
+
+ card = contract["question"]
+ for state_id, payload in card["states"].items():
+ fields = question_item_fields(payload)
+ assert fields is not None, state_id
+ parked = card["inbox"][state_id]
+ for key in ("title", "options", "allow_text", "multi", "header"):
+ assert _kind(fields[key]) == _kind(parked[key]), f"question/{state_id}: `{key}`"
+ assert fields["title"] == parked["title"], f"question/{state_id}: title"
+ assert len(fields["questions"]) == len(parked["questions"]), f"question/{state_id}: grouped questions"
+
+
+def test_lead_decision_payload_matches_the_gallery(manager, contract):
+ """`decide_worker_call`: the parked approval carries the worker's call the card shows."""
+ card = contract["worker-decision"]
+ parked = manager.inbox.add_approval(
+ "worker-sid", "Run `run_shell`?", body="requires approval\ncommand: npm run build",
+ data={"tool": "run_shell", "arguments": {"command": "npm run build"}},
+ )
+
+ class Request:
+ tool_name = "decide_worker_call"
+ arguments = {"worker": "nia", "call_id": parked.id, "decision": "deny", "note": "wrong worktree"}
+ metadata = None
+
+ data = manager.approval_prompt_data("lead-sid", Request())
+ canonical, states = _inbox_data(card)
+ problems = _compare("lead decision", data, canonical, states)
+ problems += _compare(
+ "worker call", data["worker_call"], canonical["worker_call"],
+ [s["worker_call"] for s in states if "worker_call" in s],
+ )
+ problems += _compare("decision arguments", data["arguments"], canonical["arguments"], [s["arguments"] for s in states])
+ assert not problems, "\n".join(problems)