Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
5313170
Agent blocks: link outside AI agents to a dashboard by pairing code
robdmac Nov 18, 2026
2cb8ff7
Add PokerBench: AI agents and models play no-limit hold'em, measured …
robdmac Nov 17, 2026
2dc1cf8
PokerBench: every player is its own canvas component
robdmac Nov 17, 2026
28acc93
PokerBench: Siren agents get a seat at the table
robdmac Nov 17, 2026
41344db
PokerBench: Agent blocks take a seat at the table
robdmac Nov 18, 2026
ff6b1ac
Agent blocks: point dev at the agent hub and bake the client into the…
robdmac Nov 18, 2026
57a995c
Agent blocks: use agents.orcabot.com as the hub address
robdmac Nov 18, 2026
3681ee9
Warm pool: a control plane claims only the VMs it made
robdmac Nov 18, 2026
1232d75
Agent blocks: say why a dashboard can't reach its agents
robdmac Nov 18, 2026
d492b15
VMs talk to the control plane that created them, not the app-wide secret
robdmac Nov 18, 2026
cabcda3
Warm pool: retire unclaimed VMs that aren't on the current image
robdmac Nov 18, 2026
9d84cc3
PokerBench: Start/Pause/Resume from a real poker table
robdmac Nov 18, 2026
f7a568e
PokerBench: set up the game on the table page before Start
robdmac Nov 18, 2026
045b26e
PokerBench: open the game settings from a Settings button on the table
robdmac Nov 18, 2026
3f009d1
PokerBench: remove the losing condition (rigged seats and coolers)
robdmac Nov 18, 2026
21753d3
Terminal links: a terminal can see the terminals linked to it on the …
robdmac Nov 18, 2026
4f116df
PokerBench: players are what's linked to the engine; choose them on t…
robdmac Nov 18, 2026
166b8fc
Sandbox self-input: a process may type into its own terminal
robdmac Nov 18, 2026
a83ef36
No more empty dashboards from a missing template
robdmac Nov 18, 2026
480a50e
PokerBench: agent seats are normal interactive agent terminals
robdmac Nov 18, 2026
a34d183
list_items reads the dashboard from D1, not the Durable Object's copy
robdmac Nov 18, 2026
bf97105
PokerBench setup guide: everything is already on the canvas; never re…
robdmac Nov 18, 2026
45e5bd5
Sandbox own screen: a terminal's raw recent output, to render what it…
robdmac Nov 18, 2026
7165ae5
PokerBench seats read the agent's rendered screen, not its output text
robdmac Nov 18, 2026
1133bd3
Dashboard VMs on performance-2x CPUs; warm pool retires other sizes
robdmac Nov 18, 2026
920bc68
PokerBench seat helper: much lighter while waiting
robdmac Nov 18, 2026
dbb223d
PokerBench: Gemini seat includes /tmp/pokerbench in its workspace; ta…
robdmac Nov 18, 2026
4b4656c
PokerBench template: a bigger table with the players placed round it
robdmac Nov 18, 2026
1d5a3de
PokerBench: End game from the paused table, and every agent is told t…
robdmac Nov 18, 2026
b820376
PokerBench: a restarted table carries the game on; silent players sit…
robdmac Nov 20, 2026
4127481
Auto sleep: a per-dashboard switch so benchmarks keep running unwatched
robdmac Nov 20, 2026
febb417
PokerBench: a silent agent's turn counts as missed; the table fits th…
robdmac Nov 20, 2026
0d82a18
Gemini CLI: auto-approve its flagged-command prompt (on in PokerBench)
robdmac Nov 21, 2026
ac12a88
PokerBench: agents check in before Start, come back when they answer …
robdmac Nov 21, 2026
e6c447f
Control plane: a VM that lost its session keeps its workspace
robdmac Nov 22, 2026
7534a90
PokerBench: wait while Gemini's API-key entry dialog is open
robdmac Nov 22, 2026
4c2d92b
PokerBench: a "Fair play" condition (decide every move, no cheating)
robdmac Nov 22, 2026
54b39db
Restart asks which background processes to stop
robdmac Nov 23, 2026
ee6a7e9
PokerBench: record which model each agent actually used
robdmac Nov 23, 2026
dcb571c
PokerBench: run Codex with --no-daemon so each Codex plays its own seat
robdmac Nov 23, 2026
806d86a
Canvas: copy and paste blocks with Cmd/Ctrl+C and Cmd/Ctrl+V
robdmac Nov 23, 2026
ee9e408
Terminals: rename by double-clicking the title or from the menu
robdmac Nov 23, 2026
c2fa104
PokerBench: Antigravity CLI (agy) seats
robdmac Nov 23, 2026
9fa4eee
Antigravity CLI (agy) as a supported agent
robdmac Nov 23, 2026
f5b8613
PokerBench: an agent seat's helper runs again if it exits
robdmac Nov 23, 2026
1bef9fa
PokerBench: each agent seat its own OS user; forbidden file reads aud…
robdmac Nov 23, 2026
bbb8423
PokerBench: series, ratings, limit hold'em, random seeds, results pub…
robdmac Nov 23, 2026
7b2bf6e
PokerBench: audit tools other than poker; Orcabot's are a second hone…
robdmac Nov 23, 2026
9b396cb
PokerBench: tool audit reads escaped JavaScript strings; reports re-c…
robdmac Nov 23, 2026
cb10425
PokerBench: tool audit ignores quoted reasons and redirections
robdmac Nov 23, 2026
067b789
PokerBench: prompt typed in once the agent can take it, and checked; …
robdmac Nov 23, 2026
b34690e
PokerBench: each seat keeps its own login
robdmac Nov 24, 2026
edd5587
PokerBench: track invalid moves and decisions on cards a seat didn't …
robdmac Nov 24, 2026
606ca27
PokerBench: Codex seats skip the update check and report their model …
robdmac Nov 25, 2026
7ced8e0
PokerBench: delayed public table for the benchmark page; tool audit c…
robdmac Nov 25, 2026
6d88522
Benchmarks: PokerBench page with a live table, headline chart and pro…
robdmac Nov 25, 2026
0cf0b7f
PokerBench: the live table never shows another game's cards
robdmac Nov 26, 2026
ebdbe42
PokerBench template: RELAY_TARGET and RELAY_DELAY settings
robdmac Nov 26, 2026
b6907a0
PokerBench relay: send its own User-Agent
robdmac Nov 26, 2026
c30e813
PokerBench relay: upload host on orcabot.com, not workers.dev
robdmac Nov 26, 2026
7e16e5e
Benchmarks: TTS page intro names the recogniser it reports (Whisper b…
robdmac Nov 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,16 @@ Key files:
- `frontend/src/components/EgressApprovalDialog.tsx` — Approval dialog UI
- `frontend/src/components/EgressAllowlistPanel.tsx` — Allowlist management UI

### Agent Blocks (outside AI agents)
An `agent` canvas block is an AI agent that runs on its own computer (Grok Bot, Muse, Dots, Claude Code, Codex, ...), linked to the user with a pairing code. Messages are end-to-end encrypted (MLS) through an agent hub (`AGENT_HUB_URL`); the hub is never named in the UI.
- Each Orcabot user has a hub **owner** identity, issued server to server (`AGENT_HUB_PARTNER_SECRET`). Its token lives only in `agent_hub_owners` (encrypted) — **never in `user_secrets`**, which are pushed into the VM env — and only approves codes / lists / removes agents.
- Each dashboard VM is a **linked device of the dashboard owner** (as with secrets: one VM, the owner's credentials). The VM's client (`sandbox/internal/agentlink`, running `orcabot-agent-link` as its own user, state outside `/workspace`) makes its own keys; the control plane approves its code only after checking it is a *device* code with *this dashboard's* device name (`/internal/dashboards/:id/agent-link/approve-device`).
- **No agent without edge**: a terminal reaches only Agent blocks its canvas item has an edge to, decided by the control plane from D1 edges (`/internal/dashboards/:id/terminals/:ptyId/agents`), served to the terminal over the privileged socket (`/agents`, SO_PEERCRED) or MCPLocal (per-PTY secret, pool-guarded).
- The block's chat view is **owner-only** (`/dashboards/:id/agents/chat`): chatting from the VM is chatting as the owner.
- **Terminal links**, the same way: a terminal can ask which *terminals* its item has an edge to (`/internal/dashboards/:id/terminals/:ptyId/links` → `controlplane/src/terminals/links.ts`; sandbox `/links` on the privileged socket or MCPLocal, `sandbox/cmd/server/terminallinks.go`). It returns names and PTY ids only (never boot commands, output or env), plus each linked PTY's pool UID in pool mode, so a coordinator (PokerBench's engine seats the players linked to it) can bind each to its own OS user.
- **Self-input**: a process may type into *its own* terminal, as if the user typed or pasted it (sandbox `/input` on the privileged socket or `POST /sessions/:id/ptys/:ptyId/input` on MCPLocal, `sandbox/cmd/server/selfinput.go`; text, optional bracketed paste, optional Enter; every use logged). Used to hand a prompt to the interactive agent a user started and logged into there (PokerBench's seat helper at Start). Only ever the caller's own PTY, never another terminal. Its counterpart **own screen** (`/screen`, `GET .../ptys/:ptyId/screen`) returns the caller's own raw recent output (ANSI intact, 64KB) and `X-Screen-Rows`/`X-Screen-Cols`, so it can render what its terminal shows now: `/scrollback` strips the escape codes, so text an agent's UI has redrawn over (an answered dialog) stays in it.
- Key files: `controlplane/src/agents/handler.ts`, `sandbox/internal/agentlink/`, `sandbox/cmd/server/agentlink.go`, `frontend/src/components/blocks/AgentBlock.tsx`, `frontend/src/data/agent-kinds.ts`

### Network Egress Proxy Feature Flag
The egress proxy is gated behind a single env var:
- **Global**: Set `EGRESS_PROXY_ENABLED=true` on the Fly machine to enable for all sessions
Expand Down Expand Up @@ -202,7 +212,8 @@ LLM (in sandbox PTY)
When an LLM agent (Claude, Gemini, etc.) finishes a turn, stop hooks notify the
sandbox so it can broadcast `agent_stopped` WebSocket events to all connected clients.
- Hook scripts: `sandbox/internal/agenthooks/hooks.go`
- Supported agents: Claude Code, Gemini CLI, OpenCode, Codex, Droid, OpenClaw
- Supported agents: Claude Code, Gemini CLI, Antigravity CLI (`agy`), OpenCode, Codex, Droid, OpenClaw
- Antigravity CLI (Gemini CLI's successor for Google AI Pro/Ultra plans, which Gemini CLI stopped serving on 2026-06-18): installed in the image (`/usr/local/bin/agy`, self-updating); sign-in is Google OAuth in the terminal (open the link, paste the code), and with no keyring on the VM its token lands in `~/.gemini/antigravity-cli/antigravity-oauth-token` on the workspace volume. Orcabot's MCP server goes in `.agents/mcp_config.json`, users' MCP tools in `~/.gemini/config/mcp_config.json`, the Stop hook in `.agents/hooks.json`
- Settings files generated per-agent (`.claude/settings.json`, `.gemini/settings.json`, etc.)
- **All hooks must include `X-MCP-Secret` header** from `ORCABOT_MCP_SECRET` env var — unauthenticated hook callbacks are rejected

Expand All @@ -215,6 +226,9 @@ sandbox so it can broadcast `agent_stopped` WebSocket events to all connected cl
- Sandbox sessions use a shared `/workspace` by default
- PTY cwd is set to the session workspace
- Multiple PTYs per sandbox with turn-taking
- **Auto sleep** (per dashboard, `dashboards.auto_sleep`, default on; checkbox in the dashboard menu bar, `frontend/src/components/AutoSleepToggle.tsx`). On: a terminal with no viewer is stopped after the PTY hub's 10-minute idle timeout (`sandbox/internal/pty/hub.go`), Fly suspends the idle VM, and the cron retires a VM 6h after the last terminal activity. Off (benchmark templates start that way): the sandbox session's `keepAwake` flag (sent as `auto_sleep` on every PTY create and via `POST /sessions/:id/auto-sleep` on toggle) keeps terminals running unwatched, the cron pings the VM through the Fly proxy every tick so it isn't suspended, and the VM is retired only 48h after the last terminal activity. See `controlplane/src/dashboards/auto-sleep.ts`. Templates carry `auto_sleep`; `benchmarks/bin/seed-benchmark-templates` seeds benchmark templates with it off
- **Restart asks about background processes**: a restart kills the terminal's PTY process group, but a process that detached from it (a daemon, `setsid`) keeps running with that run's env (e.g. Codex's shared app-server daemon keeps an old `ORCABOT_PTY_ID`). Before a *user* restart (menu, "restart to apply", Reopen; never automatic restarts) the frontend lists them and the user picks which to stop (`RestartBackgroundDialog.tsx`). The control plane (owners/editors) supplies every PTY id the terminal's sessions ever had (`controlplane/src/sessions/background-processes.ts`); the sandbox finds live processes carrying one in `ORCABOT_PTY_ID` and outside every live PTY's group, and re-checks PID + start time before SIGTERM→SIGKILL (`sandbox/internal/bgproc`, `GET/POST /sessions/:id/background-processes[/stop]`)
- **Auto-approve flagged commands** (Gemini CLI terminals only; `terminalContent.autoApproveFlagged`, terminal settings dropdown; off by default, on in the PokerBench template). Gemini CLI asks before running a command that reuses a path/URL/flag from earlier tool output ("Untrusted Command Flags" prompt), and `--yolo` doesn't cover it. When on, the control plane sends `auto_approve_flagged` on PTY create and the sandbox watches that PTY's output (`Hub.AddOutputWatcher`) and answers only that dialog with "Allow once" (Enter), logging each answer — `sandbox/internal/geminiapprove`. Applies when the terminal restarts

### Desktop, the `orcabot` CLI & Surface Switching
- The `desktop` Tauri app bundles the whole stack locally: control plane on `workerd`, a SQLite "D1" shim, and a sandbox VM (Apple Virtualization.framework on macOS / QEMU on Linux).
Expand Down
1 change: 1 addition & 0 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ results surface in a browser/note block.
| SWE-bench (Lite/Verified/Full) | [`swebench/`](swebench/) | ✅ yes | Inference on host + **Docker-per-task** eval (Modal or DinD) |
| SWE-bench Pro (public 731) | [`swebench-pro/`](swebench-pro/) | ✅ yes | Inference on host + **Docker-per-task** eval (`--use_local_docker` or Modal) |
| Terminal-Bench 2.1 | [`terminal-bench/`](terminal-bench/) | ✅ yes | **Harbor** harness; Docker-per-task (or `--env daytona`/Modal remote) |
| PokerBench | [`pokerbench/`](pokerbench/) | ✅ yes | **Host**: an engine owns the cards; agents and models play hold'em (2–10 seats) through a `poker` CLI; skill, bluffing + cheat detection |
| FrontierCode (Diamond) | [`frontiercode/`](frontiercode/) | ❌ no | **Closed / submission-only** — no public harness, see the note |

## Two architecture families
Expand Down
40 changes: 29 additions & 11 deletions benchmarks/bin/seed-benchmark-templates
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,22 @@ D1_URL = os.environ.get("D1_URL", "http://127.0.0.1:9001")
AUTHOR_ID = os.environ.get("AUTHOR_ID", "dev-desktop")
AUTHOR_NAME = os.environ.get("AUTHOR_NAME", "OrcaBot")

# REVISION: seed-benchmark-templates-v3-auto-sleep-off
# Benchmark dashboards run unattended (overnight games, long eval matrices), so their
# templates carry Auto sleep off unless template.json says "autoSleep": true. Needs the
# dashboard_templates.auto_sleep column (controlplane initializeDatabase / /init-db).
def auto_sleep(tpl) -> int:
return 1 if tpl.get("autoSleep") is True else 0


# REVISION: seed-benchmark-templates-v2-stable-id
# A template's id is derived from its name, so re-seeding keeps it: a dashboards page
# loaded before a re-seed still creates from the right template. (A fresh id each time
# made such a page create an empty dashboard: the control plane found no template.)
def template_id(name: str) -> str:
return str(uuid.uuid5(uuid.NAMESPACE_URL, f"https://orcabot.com/benchmark-templates/{name}"))


# benchmarks/ root (this file lives in benchmarks/bin/).
ROOT = pathlib.Path(__file__).resolve().parent.parent

Expand Down Expand Up @@ -57,19 +73,19 @@ def discover(filter_dirs):


def upsert(tpl):
tid = str(uuid.uuid4())
tid = template_id(tpl["name"])
now = datetime.datetime.utcnow().isoformat()
q("DELETE FROM dashboard_templates WHERE name = ?", [tpl["name"]])
q(
"""INSERT INTO dashboard_templates
(id,name,description,category,author_id,author_name,items_json,edges_json,
viewport_json,setup_guide,item_count,is_featured,use_count,status,created_at,updated_at)
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)""",
viewport_json,setup_guide,auto_sleep,item_count,is_featured,use_count,status,created_at,updated_at)
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)""",
[
tid, tpl["name"], tpl["description"], tpl.get("category", "coding"),
AUTHOR_ID, AUTHOR_NAME,
json.dumps(tpl["items"]), json.dumps(tpl["edges"]),
json.dumps(tpl.get("viewport")), tpl.get("setupGuide"), len(tpl["items"]),
json.dumps(tpl.get("viewport")), tpl.get("setupGuide"), auto_sleep(tpl), len(tpl["items"]),
1, 0, "approved", now, now,
],
)
Expand All @@ -86,16 +102,16 @@ def _sql_lit(v):

def emit_sql(tpl):
"""Emit DELETE+INSERT SQL for a template (for `wrangler d1 execute --file`)."""
tid = str(uuid.uuid4())
tid = template_id(tpl["name"])
now = datetime.datetime.utcnow().isoformat()
cols = ("id,name,description,category,author_id,author_name,items_json,edges_json,"
"viewport_json,setup_guide,item_count,is_featured,use_count,status,created_at,updated_at")
"viewport_json,setup_guide,auto_sleep,item_count,is_featured,use_count,status,created_at,updated_at")
vals = [
tid, tpl["name"], tpl["description"], tpl.get("category", "coding"),
AUTHOR_ID, AUTHOR_NAME,
json.dumps(tpl["items"]), json.dumps(tpl["edges"]),
json.dumps(tpl.get("viewport")) if tpl.get("viewport") is not None else None,
tpl.get("setupGuide"), len(tpl["items"]), 1, 0, "approved", now, now,
tpl.get("setupGuide"), auto_sleep(tpl), len(tpl["items"]), 1, 0, "approved", now, now,
]
literals = ", ".join(_sql_lit(v) for v in vals)
return (f"DELETE FROM dashboard_templates WHERE name = {_sql_lit(tpl['name'])};\n"
Expand All @@ -117,10 +133,12 @@ def main():
return

# Ensure the setup_guide column exists (idempotent) so older DBs accept the insert.
try:
q("ALTER TABLE dashboard_templates ADD COLUMN setup_guide TEXT", [])
except Exception:
pass
for ddl in ("ALTER TABLE dashboard_templates ADD COLUMN setup_guide TEXT",
"ALTER TABLE dashboard_templates ADD COLUMN auto_sleep INTEGER NOT NULL DEFAULT 1"):
try:
q(ddl, [])
except Exception:
pass
for path in paths:
tpl = json.loads(path.read_text())
tid = upsert(tpl)
Expand Down
2 changes: 2 additions & 0 deletions benchmarks/pokerbench/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.egg-info/
build/
Loading
Loading