From fe038d7fce947370b89eb4e5544afa35f1b7b460 Mon Sep 17 00:00:00 2001 From: agent-box agent Date: Fri, 4 Sep 2026 18:50:33 +0000 Subject: [PATCH 1/3] feat(web): add a grid layout that shows every session at once (#119 follow-up) The workspace has one terminal on screen at a time, so watching four agents work means clicking through four tabs and seeing three of them only in hindsight. The grid button at the end of the tab bar lays every session out at once, each tile a live terminal captioned with the session's name; pressing a caption (or a tab) goes back to one terminal filling the page. It is one set of panes for both layouts, re-laid by CSS rather than mounted twice, and that is load-bearing rather than tidy: a pane is a live tmux client, and tmux sizes a window to its most recently used client, so a second attachment of the same session in a second layout would leave the two fighting over its size. A tile therefore never re-creates a terminal that is already attached - proved in a real chromium, along with the layout surviving a refresh from the live session feed. - ?view=grid is the layout, so it survives a reload, can be bookmarked and works with scripting off (the server renders the whole grid); anything else degrades to the tab layout. - SCRIPT intercepts the toggle, because following its href for real would tear down every attached terminal and re-attach it a moment later. - Tiles read in tab order however they were mounted, with CSS `order` and never by moving the element: re-inserting an iframe reloads it. - A session added while the grid is open takes its place on the grid, and a deleted one loses its tile, through the feed that already drives the tab bar. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01NWmLRsa4keJzBo9Minofxe --- README.md | 8 +- modules/agent-box.nix | 418 ++++++++++++++++-- modules/src/default-agents.md | 4 +- modules/src/settings-daemon.py | 204 +++++++-- modules/src/settings.css | 70 ++- modules/src/settings.js | 140 +++++- .../vm/etc/agent-box-guides/AGENTS.agent.md | 4 +- .../web/etc/agent-box-guides/AGENTS.agent.md | 4 +- .../agent-box-settings/bin/agent-box-settings | 414 +++++++++++++++-- .../etc/agent-box-guides/AGENTS.agent.md | 4 +- .../etc/agent-box-guides/AGENTS.robot.md | 4 +- tests/sessions-web.nix | 48 +- 12 files changed, 1170 insertions(+), 152 deletions(-) diff --git a/README.md b/README.md index 3b9454db..fef11330 100644 --- a/README.md +++ b/README.md @@ -410,7 +410,13 @@ settings page, where a sign-in and a first session are what is actually needed. On a box with several terminal users the root lists them instead, each behind their own login (add and close sessions from the tab bar — the tab's `×` arms on the first click and only closes on the second; restart/delete also on the -settings page) — and agents can spawn sibling sessions themselves (it's just +settings page). The grid button at the end of the tab bar lays **every** +session out at once, each tile a live terminal with the session's name above +it, which is what you want when four agents are working and one of them is +waiting on you; press a tile's name (or its tab) to go back to one terminal +filling the page. It is a URL too (`?view=grid`), so it survives a reload and +can be bookmarked, and a session added while it is open takes its place on the +grid without one — and agents can spawn sibling sessions themselves (it's just a file edit on their own account — handy for "have Codex cross-check this"). Open pages follow along live: a session added or removed anywhere — the CLI, an agent, a second browser tab — appears or disappears in the tab bar (and in diff --git a/modules/agent-box.nix b/modules/agent-box.nix index 5e09ef8e..a25890e5 100644 --- a/modules/agent-box.nix +++ b/modules/agent-box.nix @@ -360,7 +360,9 @@ let distro, and the two differ in ways worth knowing before you change anything outside $HOME.) Your workspace is at $AGENT_BOX_URL (`echo $AGENT_BOX_URL` prints it): one tab per session, and each session also - has a terminal of its own at ''${AGENT_BOX_URL}/. Share those URLs + has a terminal of its own at ''${AGENT_BOX_URL}/. The grid button at + the end of the tab bar (or ''${AGENT_BOX_URL}?view=grid) shows every session at + once, which is the URL to hand somebody who is watching several agents work. Share those URLs with anyone who needs to view or take over your session; the sign-in username is your own login name (`whoami`) and the password was set at deploy time. @@ -15332,25 +15334,81 @@ STYLE = """