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
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ open-ended work. The default provider and model come from Settings → Providers
| Apple data | `apple/`, the "Apple" block in `bridge.mjs`, the Messages view in `web/src/messages/` | macOS only, off unless `APPLE_ENABLED=true`. Reads Messages (`chat.db`), Contacts and Photos (`Photos.sqlite` plus Photos' own search index) read-only; sends through the Messages app with `osascript`. The owner sends from the Messages tab (last on the desktop rail, not on the phone drawer; `/messages` still opens); agents only stage an `imessage` inbox proposal (`totem_apple_propose_message`), which only the dashboard can accept. `docs/apple.md`. |
| Chat | `chat/`, the "Web chat" block in `bridge.mjs`, `web/src/chat/` | Server-owned threads and runs that outlive the browser, listed as summaries and read a window at a time with Load earlier (`GET /api/threads?view=summary`, `GET /api/threads/<id>?turns=10&before=`; one merge file shared by web and app, `web/src/chat/history.ts`; each chat reopens where it was left, `scrollMemory.ts`; docs/chat.md → Loading chats) (`POST /api/chat` streams SSE; `GET /api/chat/runs/<thread>/stream?since=` re-attaches; only `POST /api/chat/stop` ends a run early; `POST /api/chat/steer` sends the owner's words and files into a running reply, live for Claude, interrupt-and-resume for the rest, `chat/steer.mjs`; or the message waits in the thread's queue, which the bridge drains itself when a run ends and holds after a stop or failure, `chat/queue.mjs`, `POST /api/chat/queue`; Settings → Chat › Follow-up behaviour picks which Enter does, Ctrl/⌘ the other). Native per-provider session resume, attachments, named tool cards folded with the reply's in-between text into one line above the answer, led by the connectors' own logos stacked (`web/src/chat/workFold.ts`; Claude's `tool_use_meta`, `connectorLook` in `chat/tools.mjs`), per-reply stats (setting, effort, tokens, tok/s, cost; `chat/stats.mjs`, shown on hover by `TurnStats.tsx`), no modes (every chat run gets the browser, computer use where the account has it, and an hour; the agent decides, `chat/reach.mjs`), the model picker (`ModelPicker.tsx`; no automatic routing since Auto/Instant/Thinking were retired; picking another account mid-chat hands the chat over with what it missed, `handoffReplay`, docs/chat.md → Switching accounts), thread titles and icons, local whisper.cpp dictation and an optional OpenAI Realtime voice mode. `docs/chat.md`. |
| Chat projects | `chat/projects.mjs`, `chat/memory-ref.mjs`, `web/src/chat/Project*.tsx` | Chats grouped with a shared default model (a new chat takes its own pick, else the folder's, else the project's, else Settings → Providers: `threadChoice`/`projectDefault` in `web/src/chat/store.ts`, `projectModelDefault` on the bridge; a pick in a draft never carries to another chat), owner-written instructions, an agent-kept `memory.md` and shared files (`data/chat-projects/`). Each turn names the memory file with a one-line summary (size, entries, last updated, headings) and the agent reads it on demand, again when the summary changed; only the owner's instructions are pasted (memory used to be, once per turn of a resumed session). OpenCode, which cannot read outside `AGENT_CWD` unattended, gets the file's start instead. One level of folders (`parentId`) that read the parent read-only and keep their own memory; a chat can turn project context off (`projectContextOff`); an uploaded image or a website's icon can stand in for the Tabler icon (`image`, `chat/favicon.mjs`); finished chats wait on the owner (`needsReply`) until the owner opens one, replies or marks it read; "Mark as unread" sets `keepUnread`, which opening does not clear. Every list (Home, project, folder) ends with its own Snoozed and Settled shelves, T3 Code style (`web/src/chat/settle.ts`; auto-settle and wake-up are computed on read, never written). An agent that finished a one-off request calls `mark_chat_done` (`chat/done.mjs`, on `/agent-mcp`): the row offers a one-tap Settle until the reply is read, then the chat settles itself once he moves off it (`doneAt`; dropped by a failed or stopped reply, a steer or his next message). The chats panel is scoped to Home or one project; chats drag onto folders and projects. `docs/chat.md` → Projects. |
| Tasks panel | `web/src/work/`, `chat/task-folders.mjs`, `chat/task-link.mjs`, `/api/chat/task-folders` in `bridge.mjs` | The chats panel's third face (Chats · Totems · Tasks): open local tasks and the shared sheet's action items, grouped by the chat project or folder each is filed under (a task's `folderId`; a sheet row's filing in `data/task-folders.json`, `TASK_FOLDERS_FILE`, `none` meaning Personal on purpose), each with its linked chats under it. A click on a task opens its floating card (`web/src/work/TaskCard.tsx`, mounted once in `App.tsx`; a bottom sheet on a phone): folder, due, priority, repeat, snooze, description, chats, Open in Tasks; the composer's task strip opens it too. A chat names at most one task (`thread.taskId`: a task id or a sheet row id), linked from its "…", by dropping it on a task, or by starting a chat from the task (`startTaskDraft`; the first send carries `taskId`, kept by `startChatTurn` on a new chat only). A linked chat's composer shows the task (Done, change, unlink; `TaskBar.tsx`) and every non-voice turn carries a `LINKED TASK.` block (`linkedTaskBlock`). Filing a task, Move to… and Link to task… share one T3 Code-style project-selector popover (`ComboPicker.tsx`: search, arrows, Enter, "New folder/project/task …" from what was typed). Tasks load only while the face, a strip or the composer's `$` menu is on screen. A chat not started yet is placed from its composer with `$` (Home, a project or folder, or a task, which starts it through `startTaskDraft` in the task's folder; `web/src/chat/destinations.ts`, `destinations` on `Composer`), and ⌘/Ctrl+Shift+O starts a blank chat at Home from any page (a hotkey: `hotkeys` in `web/src/shortcuts.ts`, Settings → Keyboard › Hotkeys; `docs/shortcuts.md` → Hotkeys). Not in the iPhone app yet. `docs/chat.md` → Tasks panel, → Placing a new chat with `$`. |
| Tasks panel | `web/src/work/`, `chat/task-folders.mjs`, `chat/task-link.mjs`, `/api/chat/task-folders` in `bridge.mjs` | The chats panel's third face (Chats · Totems · Tasks): open local tasks and the shared sheet's action items, grouped by the chat project or folder each is filed under (a task's `folderId`; a sheet row's filing in `data/task-folders.json`, `TASK_FOLDERS_FILE`, `none` meaning Personal on purpose), each with its linked chats under it. A task's card (`web/src/work/TaskCard.tsx`: folder, due, priority, repeat, snooze, description, chats, Open in Tasks) is pinned at the open chat's top right for that chat's own task (`PinnedTask` in `ChatView`; folds, never closes, the log moves left to clear it; opening that task anywhere unfolds it, `pinTask` in `card.ts`), and any other task opens it as a modal dialog (`TaskCardHost`, mounted once in `App.tsx`; a bottom sheet on a phone). A chat names at most one task (`thread.taskId`: a task id or a sheet row id), linked from its "…", by dropping it on a task, or by starting a chat from the task (`startTaskDraft`; the first send carries `taskId`, kept by `startChatTurn` on a new chat only). A linked chat's composer shows the task (Done, change, unlink; `TaskBar.tsx`) and every non-voice turn carries a `LINKED TASK.` block (`linkedTaskBlock`). Filing a task, Move to… and Link to task… share one T3 Code-style project-selector popover (`ComboPicker.tsx`: search, arrows, Enter, "New folder/project/task …" from what was typed). Tasks load only while the face, a strip or the composer's `$` menu is on screen. A chat not started yet is placed from its composer with `$` (Home, a project or folder, or a task, which starts it through `startTaskDraft` in the task's folder; `web/src/chat/destinations.ts`, `destinations` on `Composer`), and ⌘/Ctrl+Shift+O starts a blank chat at Home from any page (a hotkey: `hotkeys` in `web/src/shortcuts.ts`, Settings → Keyboard › Hotkeys; `docs/shortcuts.md` → Hotkeys). Not in the iPhone app yet. `docs/chat.md` → Tasks panel, → Placing a new chat with `$`. |
| Chat files | `chat/files.mjs`, `web/src/chat/FilesPanel.tsx`, `/api/chat/files*` in `bridge.mjs`, `openFile` in `web/src/chat/store.ts`, `web/src/links.ts` | T3 Code's files viewer: the chat's outputs folder as a tree beside the chat, every file openable in the canvas and downloadable from any device. It, the canvas, Browser and Agents panels share one slot, drag-resizable per panel (`docs/chat.md` → Side panel widths). Serves `CHAT_OUTPUTS_DIR` plus `FILES_ROOTS`, by real path, never Totem's `data/`, `secrets/` or `.env`. A reply's link to an absolute path opens there, and the same path opened as a URL redirects to the chat (`?file=`). Every opener goes through `openFile(path)`: `GET /api/chat/files/link` checks the path and returns a signed link (real path + 12 h expiry + HMAC under a random per-process key), which the canvas, its frames and the native download read without the bearer (a Files row's Download signs on the click; the listing carries no links); only the exact spelling `/api/chat/files/raw?…&sig=` skips the sign-in gate, and the roots/deny check runs on every read. A bearer-only dashboard read the bare raw URL with no header and showed `{"error":"unauthorized"}`; `chat/files-bridge.test.mjs` boots a bridge to hold this. `docs/chat.md` → Files panel. |
| Download activity | `web/src/downloads.ts`, `web/src/components/DownloadActivity.tsx`, `desktop/src-tauri/src/lib.rs` | App-wide activity for download links, chat and question attachments, generated files, previews, project files, Messages files and journal audio. Active repeats join one transfer; different files have separate progress, cancel/retry and dismiss controls. Browsers offering a save-file picker stream directly to the chosen file; otherwise transfers buffer at most 32 MiB before handing larger files to the browser. Browser handoff and application transfer completion explicitly tell the owner to check Downloads, never claim an OS save. Native wrappers advertising `downloads` stream through Tauri and report real saved/failed events (indeterminate: Tauri has no byte progress); this requires a new desktop build. A saved native download gets Show in folder (Show in Finder on a Mac): the app keeps the path (`Downloads` in `lib.rs`, the last 50) and the page asks by the download's URL through a cancelled `totem-desktop://reveal?u=` navigation, never seeing a path; older wrappers do not send `reveal`, so no button. Raw chat files and signed uploads accept authenticated HEAD preflights without reading file bodies; bearer-only users need a session or a signed URL (an upload's `?sig=`, a chat file's signed link) for native/browser navigation handoff. |
| Sub-agents | `chat/subagents.mjs`, `web/src/chat/AgentsPanel.tsx` | Agents a chat's agent starts: Claude's Agent/Task sub-agents (events tagged `parent_tool_use_id`), Codex collab children, and another CLI run from a shell (`codex exec`, `claude -p`, …), whose own session log is found by start time and prompt and tailed. Each folds into its tool card as `part.agent` (status, model, tokens, steps). The Agents panel beside the chat lists them and opens each one's live log. Each writes an `agent.delegate` line to the action log. `docs/chat.md` → Agents panel. |
Expand Down
34 changes: 24 additions & 10 deletions docs/chat.md
Original file line number Diff line number Diff line change
Expand Up @@ -1306,15 +1306,29 @@ moves between a task and any of its chats (`web/src/work/`).
from `GET /api/todos/sheet` already filed: its own filing, else the sheet's default
folder (`docs/task-sheet.md`). Deleting a folder moves its tasks up to its project,
deleting a project makes them Personal, as with its chats.
- **The task card** (`web/src/work/TaskCard.tsx`, `card.ts`). A click on a task opens a
floating card at the page's top right, T3 Code's thread card for a task: the check
circle and title, then one row per setting with a dropdown (Folder, Due, Priority,
Repeat, Snooze), the description, the chats working on it with New chat, Open in Tasks
(the Tasks page, scrolled to the task with its pane open) and Delete. Every change saves
at once and is drawn put back if refused. A sheet row's card is read-only but for its
folder, with Open in the sheet. Esc, × or a click elsewhere closes it; on a phone it is
a sheet from the bottom over a scrim. The count beside a task unfolds its chats; the
"…" has Edit task…, New chat, Move to folder… and Mark done.
- **The task card** (`web/src/work/TaskCard.tsx`, `card.ts`), T3 Code's thread card for a
task: the check circle and title, then one row per setting with a dropdown (Folder, Due,
Priority, Repeat, Snooze), the description, the chats working on it with New chat, Open
in Tasks (the Tasks page, scrolled to the task with its pane open) and Delete. Every
change saves at once and is drawn put back if refused. A sheet row's card is read-only
but for its folder, with Open in the sheet. It is drawn two ways:
- **Pinned.** The open chat's own task (a linked chat's `taskId`, or the task a new
chat is being started from) sits at the chat's top right under the header for as
long as the chat is open (`PinnedTask`, mounted by `ChatView`). Nothing outside
closes it; its chevron folds it to its title row, kept per device
(`totem.taskPin.folded`), and with no choice made it starts folded while the chat
column is under 1000px. Unfolded, the messages and composer move left just enough to
clear it (a `:has()` rule in `work.css`, percentages of `.vc`, no JS), keeping at
least 520px. Opening that task anywhere (the strip, its row in the chats panel)
unfolds and flashes it rather than opening a dialog (`pinTask` in `card.ts`), but only
while the chat is the page on screen. Not on a phone.
- **A dialog.** Any other task, opened from the chats panel's Tasks face (or the chat's
own task on a phone), opens in a modal over a backdrop (`TaskCardHost`, mounted once
in `App.tsx`). Esc, × or the backdrop close it; focus goes back where it was. On a
phone it is a sheet from the bottom.

The count beside a task unfolds its chats; the "…" has Edit task…, New chat, Move to
folder… and Mark done.
- **Live with the Tasks page.** The panel and the page keep their own copies of the list,
so each tells the other when it changes something (`web/src/todos/bus.ts`:
`announcing` wraps every call that writes; `onTasksChanged` reads again, once per burst,
Expand All @@ -1329,7 +1343,7 @@ moves between a task and any of its chats (`web/src/work/`).
- **The strip over the composer** (`web/src/work/TaskBar.tsx`) names a linked chat's task
with its folder and due day, Done (local tasks), and the link button to change or unlink
it; on a new chat from a task it says so, with × for a plain chat instead. The task's
title opens its card and turns every open chats panel to Tasks, scrolled to the task.
title unfolds and flashes the pinned card (the sheet on a phone) and turns every open chats panel to Tasks, scrolled to the task.
(It used to only turn the panel, which did nothing visible when the panel was already on
Tasks, as it is for a chat started there.)
- **Tasks an agent makes.** `totem_create_task` from a chat run (the gateway names the run,
Expand Down
6 changes: 6 additions & 0 deletions web/src/components/ChatView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { GroupPicker } from './TotemsView'
import { isSnoozed, settledAt, wakeDescription } from '../chat/settle'
import ProjectHome from '../chat/ProjectHome'
import TaskBar from '../work/TaskBar'
import { PinnedTask } from '../work/TaskCard'
import ProjectIcon from '../chat/ProjectIcon'
import Composer, { type ComposerHandle, type FollowUpPayload } from '../chat/Composer'
import QueuedMessages from '../chat/QueuedMessages'
Expand Down Expand Up @@ -705,6 +706,9 @@ export default function ChatView({ onAuthError, visible = true, onOpenMenu, pane
? <HandoffMark s={{ from: lastProvider, to: choice.provider }} pending />
: null

// The task the strip over the composer names (TaskBar), pinned at the top right.
const pinnedTaskRef = (active && !empty ? active.taskId : null) || (active ? null : draftTaskId) || null

// The one side panel showing, if any, and its own remembered width.
const sidePanel = artifact ? { id: 'canvas', label: 'Resize the canvas' }
: agentsShown ? { id: 'agents', label: 'Resize the agents panel' }
Expand Down Expand Up @@ -743,6 +747,8 @@ export default function ChatView({ onAuthError, visible = true, onOpenMenu, pane
temporary={(!active || empty) && !project ? { on: temporary, onToggle: () => newChat(temporary ? 'regular' : 'temporary') } : undefined}
newChatAtEnd={narrow}
/>
{/* The chat's task, pinned at its top right while the chat is open (work/TaskCard.tsx). */}
{pinnedTaskRef && <PinnedTask taskRef={pinnedTaskRef} visible={visible} />}
{picking && active && !active.totemId && (
<MembersPop anchor={membersRef} onClose={() => setPicking(false)}>
<GroupPicker
Expand Down
5 changes: 3 additions & 2 deletions web/src/work/TaskBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import { FolderChip } from './FolderField'
import './work.css'

// The strip over the composer that says which task a chat is for, drawn like the
// queue's drawer: the task (a click opens its card, TaskCard.tsx, to edit it, and
// shows it in the chats panel's Tasks face), its folder and due day, Mark done,
// queue's drawer: the task (a click unfolds and flashes the card pinned at the
// chat's top right, TaskCard.tsx, or opens it as a sheet on a phone, and shows it
// in the chats panel's Tasks face), its folder and due day, Mark done,
// and the link to change or drop it. The click used to only turn the panel to
// Tasks, which did nothing visible when it was already there. On a new chat started
// from a task it says so, with × to start a plain chat instead.
Expand Down
Loading
Loading