Repository navigation
feat(chat): add the composer, with modes, Stop and steer (W1-10) - #1826
Merged
Merged
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]>
… and a read-only view Chat Wave 1, W1-10 (CHAT-02, agentic update). A copy of the mockup's composer (compHTML), as components to be wired into the Chat pages by the shell (W1-01). - ChatComposer: the box, a toolbar with the run mode and Send, and the line under it. Variants: home (2 rows), dock and panel (1 row). The box grows to 240px, then scrolls. - Enter sends, Shift+Enter adds a line. Enter during an input method's composition or on a touch screen is the box's own (composerKeyAction). Send is off for an empty box. - While a run answers, Send is Stop, and Esc stops too. The box steers: "Steer while I work…". Enter stops the run, its done steps kept, and sends the text as the next message (onSteer; decided 2026-10-30). The line under reads "Enter stops this run and sends your message". A page without steering keeps the text until the run ends. - ModeSwitch: Ask me first · Auto, ask before changes · Full auto, each pick with the mockup's toast. Full auto below Growth is locked: "Needs Growth", and it can't be picked. - Analysts and Agency partners read only: no mode switch, a "Read-only · Analyst" link to Your access, and "@ data · read-only" under the box. - The model button reads "Auto · Haiku reads, Sonnet writes". Slots for the + / @ tools (W1-12) and the usage meter (W1-23). - The Chat pieces preview gets a Composer section: home, a dock with a pretend run, and an Analyst's panel. Co-Authored-By: Claude Opus 5.5 <[email protected]>
5 of 6 tasks
gkhngyk
previously approved these changes
Oct 30, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good, with follow-ups.
Reviewed this PR's own commit only (c8921ac, on top of #1812 af43140): the composer (components/chat/composer/), its strings, and the Composer section of /dashboard/chat/preview. No migration, no route, no new dependency, and nothing outside the preview page renders it yet.
What I checked
- Flag off: the only place the composer shows is
/dashboard/chat/preview, which still answers 404 unlessCHAT_AGENTICis on for the workspace (checked on the server per request). With the flag off nothing changes. - Modes are a UI choice; the server decides. The composer only passes the picked mode to the page. On main,
POST /api/chat/runstakesmodefrom a fixed list, and the precedence check turns Full auto into a card when the plan doesn't allow it (full_auto_locked) or when the Admin has turned Full auto off for non-Admins (full_auto_off). The Analyst / Agency partner view hides the switch, and their writes are refused on the server whatever mode is sent. So a hand-made request can't get more than the UI offers. - Stop and steer only call the page's handlers here. The routes they will use (
/api/chat/runs/{id}/stop,/api/chat/runs) already check that the run is the person's own in their own workspace, and they only move a run from a status it is really in. A repeated Stop answersokfor a run that has already ended, so a double click does no harm. - Double submit:
sendingblocks a second Enter or click while a send or a steer is in flight. A refused send (falseor an error) puts the text back. Tested. - Keys: Enter sends, Shift+Enter adds a line, and Enter does nothing during IME composition (
isComposing/ 229) or on a coarse pointer. Esc stops only while a run answers. Enter on an empty box adds no line.composerKeyActionis pure and covered. - Plan lock: the locked Full auto has
aria-disabled, a "Needs Growth" tag and a title, and a click on it does nothing. Tested. - Copy: the strings are in
en.json, andchatAccess.roleNamescovers everyTeamRole, so the read-only label never falls back to a key. - Merges clean on current main (merge-base is main's tip, a8121a6). It needs #1812 merged first.
Tests
src/components/chat/composer(11),chat/preview/page.test.tsx(8),src/lib/guards/plan-row.test.ts: pass.- Web
tsc --noEmit: clean. eslint and prettier on the touched files anden.json: clean. - I didn't run
next build. Everything added is a client component that imports only client-safe modules, and plan-row passes.
Follow-ups (none block)
- Message length. The server takes up to 20,000 characters and answers a longer message with a generic "failed". Setting
maxLengthon the textarea, or a short "too long" line, from a shared constant would stop a long paste from failing without saying why. - Mode switch keyboard.
role="radiogroup"/role="radio"leads screen readers to expect arrow keys between the options with one tab stop. Right now each mode is its own tab stop and the arrows do nothing. Either add arrow keys with a rovingtabIndex, or drop the radio roles and usearia-pressedbuttons. - Esc in the side panel. Esc calls
preventDefault()but doesn't stop the event from spreading. When thepanelvariant goes into a sheet or dialog, check that Esc during a run stops the run and doesn't also close the panel. - Announcing the run state. The line under the box changes ("Answering · Esc to stop", "Enter stops this run…") without being read aloud. A polite
aria-liveon that line would tell screen-reader users. - Touch with a keyboard.
(pointer: coarse)is true on a tablet with a hardware keyboard, so Enter never sends there. This is fine if it's what the mockup intends. Otherwise, check(any-pointer: fine)too. - Minor: with
runningset and noonStop, the Stop button shows but does nothing. Hiding it, or makingonStoprequired whenrunningis set, would avoid a dead button.
For the stacked PRs (#1827, #1828, #1835)
fullAutoOpenshould match what the server will do. In #1835,chatComposerSetupopens it from the plan alone. A Manager in a workspace where the Admin turned Full auto off for members would see it open, and the server would then ask anyway. Passingplan.fullAuto && (role === 'admin' || settings.fullAutoForMembers)keeps the two in step.- A read-only workspace (lapsed plan):
POST /api/chat/runsanswers 402. #1835 opens the upgrade dialog on that, which works. Passingdisabled(or a read-only line) from the plan facts would say so before the person types. - Steer in #1835 awaits
stop()and then sends, whatever Stop answered. A run driven by another server instance takes a couple of seconds to see the Stop, so the new message can land in the queue behind it. That's acceptable, but worth a test in that PR.
5 tasks done
gkhngyk
added a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Oct 30, 2026
…ew fixes) into take-1840 # Conflicts: # web/src/app/[locale]/(dashboard)/dashboard/chat/_chat-page-access.ts # web/src/components/chat/chat-thread-view.tsx
This was referenced Oct 30, 2026
Merged
gkhngyk
approved these changes
Oct 30, 2026
gkhngyk
left a comment
Contributor
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.
8 of 13 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Chat Wave 1, behind
CHAT_AGENTIC. Stacked on #1812 (W1-DB). The diff against main includes the PRs below it until they merge. The product owner saw it in the/dashboard/chat/previewpage and approved it.W1-10: the composer (
components/chat/composer/), a copy of the approved mockup's composer, in theme tokens.home(2 rows),dockandpanel; up to 240px tall.fullAutoOpenfrom plan-facts).onSteer. The page stops the run (POST /api/chat/runs/{id}/stop), then sends the new message.data-actionname.The components aren't wired into
/dashboard/chatyet; the shell PRs (W1-01…05) wire them in. No migration, no new dependency.Related issue
Part of Chat (CHAT-02, Wave 1).
Type of change
feat— New featureHow to test
yarn vitest run src/components/chat/composercovers the keys (IME, touch, Esc), the modes and the Full auto lock, steer, and the read-only view. Then open/dashboard/chat/preview› Composer.Checklist
help/chat)🤖 Generated with Claude Code