Repository navigation
feat(chat): add the Chat shell's menu, with Agents at work and chats by day (W1-03) - #1830
Conversation
…iles, Help and add-on packs Chat's Wave 1 tables in one PR (one DB PR per wave), behind CHAT_AGENTIC: nothing reads or writes them while the flag is off. Tables, types and the demo's coverage only; the code that uses them comes in the Wave 1 PRs. - 00407: chat_conversations gets shared_at (Share with team: every member of the workspace reads it), last_read_at (unread results), deleted_at (Delete with Undo; deleted chats are hidden from every member) and a title search column; chat_messages gets context_json (what a person's message was scoped to) and a text search column. 'simple' text search, so a chat in any language is found. The author policy now leaves deleted chats out, and a shared policy reads shared ones. - 00408: chat_user_prefs gets the rest of Settings › General and the one-time notices: rail_open, panel_size, default_mode, answer_language, notify_via, show_thought, panel_on_pages, focus_prompted_at, usage_notice_period, legacy_imported_at. - 00409: chat_uploads and the private bucket chat-uploads: 10 MB a file, the composer's 11 types, 5 a message (a trigger backs the server's check), kept 90 days. - 00410: chat_tool_cache (a chat's read results by tool and scope, server only) and each step's and model call's measure: latency, cache hit, truncation, result tokens on chat_run_steps (never granted to members), prompt cache read/write tokens and latency on the ledger. - 00411: chat_files (filed deliverables and saved answers, the workspace's, kept a year, searchable by title, summary and tags), chat_file_task_links, chat_storage_usage kept by a trigger, and the private bucket chat-files. - 00412: help_answer_cache and help_gaps (server only, no workspace or person ids). - 00413: add_on_products seeded with the owner's packs (AI credits $10, $50, $250, $1,000 at half their price in budget, 12 months; storage +25/+100/+250 GB at $5/$15/$29 a month; $50 and +25 GB Most picked), add_on_purchases (Admins read), ai_credit_grants and storage_grants (server only), and prompt_improve_usage.grant_id. Members only ever read; every write is the server's. Tool names, tool results and dollars stay server only. web/src/types/supabase.ts carries the new tables and columns; schema.test.ts checks the policies, the server-only tables, the limits and the seeded packs from the SQL; steps.test.ts keeps the step measure out of the member columns. The demo coverage skips chat_files and chat_tool_cache (a person's own Chat work). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Behind CHAT_AGENTIC; with it off, the Agent page and its menu link stay as
they are today.
- /dashboard/agent and every path under it answer a 301 to the matching
/dashboard/chat path, query kept, where the new Chat is on for the
person's workspace (CHAT-01 item 2). Sent with no-store, so turning the
flag off again takes effect at once. The sidebar and mobile menu link
Chat straight to /dashboard/chat.
- The chats API (CHAT-01 §1-3, 7-8, 26): GET /api/chat/conversations lists
the person's chats and the team's shared ones (or their archived ones),
newest first, with each row's brand name, dot and live step in words, and
the Chats / Archived counts; POST starts an empty chat; GET .../{id} opens
one with its messages and steps; DELETE stops a running agent, then hides
the chat for everyone; .../restore is the Undo (one minute); .../read
marks its result read for the author. Refusals come back as values
(ansvisor#1777), never thrown.
- A chat that isn't there, was deleted or isn't shared says "This chat isn't
available." with New chat (item 26); opening one marks it read.
- The engine and access requests read chats with the service role, so they
now leave deleted chats out too (ansvisor#1812 note).
- Help: a "chat" area and its first article (approved: false).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Behind CHAT_AGENTIC; with it off the Chat pages have no frame, as today. - Every Chat route now sits in a shell (CHAT-01 items 5, 9a-9f; CHAT-23 G1): the 256px chat menu beside the page and a 52px header with the open chat's title and status pill, and the runs tray. - The menu, top to bottom: the toggle and New chat (Ctrl+Shift+O / ⌘⇧O); Menu with Home and the count of what needs the person; Governance with Activity, What Chat can do and Tool policy (the governance mockup's menu); Agents at work (needs you, running, unread results: three rows, See all / Show less, the dots' legend); Chats with its count, Pinned, Today, Yesterday, Previous 7 days, Previous 30 days, then by month, in the person's own time zone. Rows show the dot, the title (bold while a result is unread), the live step or the result's time, or the brand, and a teammate's initials on a shared chat. Items whose pages aren't built yet stay out (Inbox, Settings, Skills, Integrations, Scheduled, Files, Search, All chats, Archived). - The toggle and Ctrl+\ (⌘\) hide or show the menu and keep the choice on the person for every device (chat_user_prefs.menu_open, a server action that answers as a value, ansvisor#1777). Hidden, the header starts with a strip: toggle, New chat, runs pill. Below 1100px the menu is a drawer that leaves the saved choice alone. Ctrl+B stays Bold. - The list is read from the chats API, again on each page change, every 5 s while a chat works or waits and every 30 s otherwise. - Thin, quiet scrollbars for Chat's lists (chat-scroll). - Help: the chat menu and how to hide it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…workspace Creating an empty chat, deleting, restoring and marking your own chat read start no cost; a chat's first message is a run, which the engine refuses with 402. The read-only coverage test lists them with that reason. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…read-only workspace Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e clock with each list read A teammate's shared chat that waits on its author's OK no longer shows under Agents at work or in Home's count. A chat that waits on an OK or is paused no longer keeps the list on the 5 s pace. A menu left open past midnight now moves Today's chats to Yesterday on the next list read.
A person reads only their own profile, so the author's name came back empty on every teammate's shared chat. Read it on the server, within the workspace; only the initials leave.
gkhngyk
left a comment
There was a problem hiding this comment.
Looks good with c4ec7e5: one commit on this branch (81122fc6), then a clean merge of #1829's fix.
The commit
- Agents at work showed teammates' shared chats.
chatMenuListsandneedsYouCountdidn't checkmine, so a teammate's shared chat waiting on an OK showed as "Needs your OK" and added to Home's count. Only the author can approve (prepareResumeanswers 404 to anyone else), and the help article says the list holds "the chats that need your OK". Both now take only the person's own chats. A teammate's shared chat stays under its day, with its dot and their initials. - The 5 s pace.
anyUnderWaycountedneedsYouandpaused, so the list was read every 5 s for as long as any chat waited on an OK or was paused, which can be days, and with the first point a teammate's waiting chat did this to every tab. It now counts onlyrunning, which covers queued. - Midnight.
nowwas memoized onnowPropalone and read once when the shell mounted, so a tab left open past midnight kept last night's chats under Today. The clock is now read again with every new list.
Three new tests fail without it. One assertion changed: anyUnderWay([needsYou, done]) is now false.
Checked, fine: with the flag off the layout just renders the page. saveChatMenuOpen checks auth and the flag, writes only the person's own row, and is in OPEN_ACTIONS. The list is scoped to the workspace, and hidden tabs don't read. Day grouping holds in 5 time zones, including a DST change at midnight. Titles are text with ids masked, and the aria attributes, focus and inert are right.
Later: the idle read stays at 30 s for as long as the tab is open, and holding Ctrl+\ repeats.
Tests: full web suite 6,526 pass (the timing cases pass alone). plan-row.test.ts and the coverage test pass, and tsc, eslint and prettier are clean. No migrations.
gkhngyk
left a comment
There was a problem hiding this comment.
Merging in order with the other approved Chat PRs. This head merges current main; where they overlapped, both sides are kept. Its tree is what main will be after this squash, checked with the full server and web suites, tsc, lint, format and next build. Chat stays behind CHAT_AGENTIC.
Summary
Chat Wave 1, behind
CHAT_AGENTIC. Stacked on #1829. The diff against main includes the PRs below it until they merge. With the flag off, the old Agent page and its menu link stay as they are today. The product owner saw the Chat shell in a local preview (menu, Home, row menus) and approved it.W1-03: the Chat shell and menu.
menu_open, across devices). Hidden, the header shows a shortcut strip.No migration, no new dependency.
Related issue
Part of Chat (CHAT-01, Wave 1).
Type of change
feat— New featureHow to test
Open
/dashboard/chat: menu groups and Ctrl+\. Tests: chat menu, layout, grouping by day in a time zone.Checklist
help/chat/chat.md,approved: false)🤖 Generated with Claude Code