Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 4 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ open-ended work. The default provider and model come from Settings → Providers
| Charts in replies | `chat/visuals.mjs`, `renderPage` in `browser/manager.mjs`, `showVisual` in `bridge.mjs`, `web/src/chat/VisualFrame.tsx`, `web/src/chat/visuals.ts`, `mobile/src/features/chat/VisualCard.tsx`, `mobile/src/ui/BridgeWebView.tsx`, `mobile/src/lib/bridgePage.ts` | T3 Code's `html_preview`/`html_render` on each chat run's `/agent-mcp` (`browser__html_*` through the gateway): the agent previews a self-contained HTML page in the box's Chromium (a PNG, its height, its console), then renders it, which stores it as a chat upload marked `visual` and adds a `visual` part where it was called. The uploads route serves only those uploads as pages, always under `VISUAL_CSP` (sandboxed, opaque origin, scripts from three chart CDNs, no fetch or remote images; a navigation is refused in the preview and closes the dashboard's frame). The dashboard draws it inline in a frame fitted to the height the page reports; the app draws it inline too, in `BridgeWebView`, the app's one WebView for bridge pages, which other screens reuse (only a page on the bridge; the Access token on the first request only, never the bridge secret; a non-persistent data store; no script unless `onHeight`, and the only message read is the height; the source URL loads once, and a reload, even mid-parse, or any page after it closes the view; `lib/bridgePage.ts`), with a full-screen view. A chart loads only its signed upload URL (`visualPagePath`). The in-app browser it used before could not send the Access token, so behind Access it showed the sign-in page (#260). Offered only beside the agent browser (a chart page can carry data out by navigating itself, which is no new way out only for a run that has the browser); never on voice, phone, jobs or totems. `docs/chat.md` → Charts in replies. |
| Approvals | `chat/approvals.mjs`, `askApproval` and `/api/chat/approvals` in `bridge.mjs`, `web/src/chat/ApprovalRow.tsx`, `web/src/chat/approvals.ts` | T3 Code's tool approvals for Claude: chat runs pass `--permission-prompt-tool stdio`, so a permission ask arrives as a `can_use_tool` control request; it shows in the reply with Decline / Approve / More (Always allow in this chat, Cancel turn), holds the run's clock, and the decision goes back on stdin. "Always allow" rules are saved on the thread (`allowedTools`) and passed as `--allowedTools` on later runs. A composer message while one waits declines it with those words. `docs/chat.md` → Approvals. |
| Approval cards | `chat/inbox-outcome.mjs`, `web/src/chat/InboxCardRow.tsx`, `web/src/chat/inboxCards.ts`, `POST /api/inbox/reply` | An inbox proposal a chat run stages remembers that chat: the run's `/agent-mcp` token reaches the gateway as `TOTEM_RUN_TOKEN` (Codex via `env_vars`), the gateway sends it as `x-totem-run` to `/mcp`, and the stagers write `thread:`/`run:` on the line (reserved meta). An `inbox` part joins the reply as the card, which accepts through the unchanged `/api/inbox/resolve` with the digest and the approval code (no new approval route); `note` on the resolve body goes to the agent. Every resolve updates the card (via the live reply until its final save, which revokes the grant only afterwards); the owner's dashboard decision (never an approval session's) is also sent to the chat as his message marked `inbox`, through `startChatTurn` or, while a reply runs, the queue or a steer per Follow-up behaviour; **a denial without a note starts no run** (it is only added to the thread). Reply sends words and leaves the proposal open. Lines without `thread:` are untouched. `docs/chat.md` → Approval cards. |
| Context window and compaction | `chat/context.mjs`, `chat/compaction.mjs`, `web/src/chat/context.ts` (byte copy in `mobile/src/lib/chat/`), `web/src/chat/ContextMeter.tsx`, `web/src/chat/CompactionMark.tsx` | T3 Code's context meter and compaction rules. A bar in the composer (amber 80%, red 90%, a tick at Claude's compaction point) from the last request's usage: Claude's `assistant` events live, Codex's rollout `token_count` (tailed, since `exec --json` lacks it), OpenCode's last step; never the reply's summed `stats`. The CLIs compact themselves; Totem shows a divider where they did, runs `/compact` on a Claude session as a hidden turn (other accounts get T3's "does not support /compact"), and Settings → Chat › Compact idle threads (`compactIdle`: When you return = a Compact chip and `compactFirst`, which queues the message behind a `/compact`; Before the cache expires = an in-memory timer two minutes before Claude's prompt cache expires; Never) plus Auto-compact after (`CLAUDE_CODE_AUTO_COMPACT_WINDOW`). A compaction turn is never replayed to another account and keeps the session's `through`. `docs/chat.md` → Context window and compaction. |
| Running chats | `web/src/chat/RunningChats.tsx`, `web/src/chat/onScreen.ts` | Bottom-right panel of chats answering, finished-but-unread (`needsReply`) or holding a pending approval card ("Waiting on your approval") out of sight, grouped by project and folder, with open, stop, snooze, settle and mark as read; finished replies also toast. "Out of sight" means not open and no row at least half on screen; a new list of chats should give its rows `useRowOnScreen`. `docs/chat.md` → Running chats panel. |
| Other chats, for agents | `chat/thread-tools.mjs`, `totem_threads_*` in `bridge.mjs` | `totem_threads_list`/`totem_threads_read` (`threads__*` in the gateway) let an agent list and read the owner's other chats (running, waiting, settled, by project or keyword). `totem_threads_create`/`totem_threads_projects` make a chat in a project or folder (creating the folder if needed), opening with the agent's message and optionally starting a run, deduplicated by `key` (`sourceKey` on the thread); this is how a totem opens a chat per new ticket. Every chat turn with the gateway on is told its own chat id and to use them only when the owner points at another chat or the turn truly needs one (`threadsRule`); keep that restraint in any change. `docs/chat.md` → Other chats. |
| Agent browser | `browser/`, `web/src/chat/BrowserPanel.tsx` | A headless Chrome or Chromium (`browser/pick.mjs`: `BROWSER_EXECUTABLE`, installed Chrome, Playwright's full Chromium, a system Chromium, the headless shell last; new headless mode, the user agent without "HeadlessChrome", a 1920×1080 screen; `BROWSER_HEADED=true` for a window on a host with a display) driven by `playwright-core` behind T3 Code's `preview_*` tool names, served to each chat run over a per-run loopback MCP endpoint (`/agent-mcp`). An open panel watches the chat's current tab live over `/api/chat/browser/ws` (`browser/socket.mjs`: CDP screencast while a viewer is there, never waiting on a slow viewer, which keeps only its newest frame; stopped when the last leaves; held input is per tab and per socket (owners), released on a tab switch or when its socket closes, each release bounded to a second; watching never opens or keeps alive a context), and the owner drives it with real input (mouse, drag, wheel, keys with modifiers, IME, paste; `browser/input.mjs`, `web/src/chat/browserInput.ts`), on the socket or `POST /api/chat/browser/input`. Driving is an approval route (low: a session or the approval code, never the bearer alone; the socket takes the code as a subprotocol); the iPhone app shows stills. That is how he signs in for the agent: the agent calls `preview_handoff`, the panel shows Done / Skip, and the call waits on him like `ask_questions` (`browser/handoff.mjs`). **Offered to every dashboard or app chat run** (not voice turns); the prompt has the agent use it only when a request needs it and ask first when unsure (`chat/reach.mjs`). Never give it, or computer use, to the phone path (`limitReach` in `runAgent` enforces it) or to jobs; a totem gets the browser only through its own `browser` switch. |
Expand Down Expand Up @@ -131,7 +132,9 @@ open-ended work. The default provider and model come from Settings → Providers
One deliberate exception: task folders (migration 013) changed every install at once,
at the owner's request: venture-tagged tasks move into the same-named chat project
once, and the task sheet's rows file themselves into the project its name starts with
unless `TASK_SHEET_FOLDER` says otherwise (`none` keeps them Personal).
unless `TASK_SHEET_FOLDER` says otherwise (`none` keeps them Personal). Another: Compact idle
threads defaults to When you return on every install, as T3 Code does, at the owner's request
(a Compact chip by Send, which Keep turns off for that send).
- **Env wins over dashboard settings**, except `AGENT_BACKEND`/`AGENT_MODEL` and the
`*_ENABLED`/`*_TIME` job seeds, which only apply before the stored config exists.
- **Sibling apps are optional.** The Bushido goal toggle appears only with `BUSHIDO_URL`.
Expand Down
Loading
Loading