Repository navigation
feat(chat): show context chips and a ghost prompt in the composer (W1-11) - #1827
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]>
…poser
Chat Wave 1, W1-11 (CHAT-02 items 5–10c), on the composer (W1-10).
- Context chips above the text: what Chat looks at, by name ("Ansvisor",
"Last 30 days"), never an ID. A label over 28 characters is cut, with the
whole name in its tooltip. × asks the page to drop it for the chat
(onRemoveChip). A send or a steer carries the chips left
(onSend(text, { context })).
- One ghost suggestion in the empty box, dim, with a Tab key hint. Tab, or a
click on it, makes it the text with the cursor after it. Typing replaces
it, and it comes back when the box is empty again. It never sends by
itself: while only it shows, Enter does nothing and Send stays off. With
text, Tab moves on as usual. No ghost while a run answers. The page picks
the suggestion: the variant's starter, then a clear follow-up, and a READ
one for Analysts and Agency partners.
- The line under reads "Tab to accept · / skills · @ data" while the ghost
shows.
- The preview's composers get the mockup's chips and starters.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The × button unmounts with its chip, so a keyboard user lost their place (focus fell to the page body). Focus the message box after removing a chip. Claude-Session: https://claude.ai/code/session_0121amRjX7UFrgmGELAtkc7A
gkhngyk
left a comment
There was a problem hiding this comment.
Looks good with b707bdc (one commit on this branch). I reviewed only what this PR adds on top of #1826 (8651366: chat-composer.tsx, composer-keys.ts, the composer tests, the preview and en.json). It's clean, client-only, and does what the description says.
Fixed: focus was lost when a chip was removed from the keyboard. The × is a real <button>, so keyboard users can reach it and press it. But it unmounts along with its chip, so focus drops to <body> and a keyboard or screen-reader user loses their place in the composer. The commit calls box.current?.focus() after onRemoveChip(chip.key), with a test that fails without it (keeps the focus in the composer when a chip is removed from the keyboard).
What I checked:
- Chips: names are rendered as React text and in a
titleattribute, so nothing is injected as HTML. The cut at 28 characters has the full name in the tooltip and in thearia-label("Remove …"). Chips withoutonRemoveChipshow no ×. - Context sent:
onSend/onSteerget{ context: chips }with only the page'skeyand displaylabel. Nothing reaches a server yet. When the shell PRs wire this into a route, the server should rebuild the context from the caller's own brand, page and range, not from the postedkey/label. - Ghost: it shows only when the box is empty, no run is answering and the composer isn't disabled. Enter is blocked and Send is disabled while only the ghost shows. Tab or a click only fills the box, and nothing sends without Enter or Send. The ghost is linked by
aria-describedby, so screen readers read it as a description and not as typed text. The ghost string comes from the page (only i18n starters in the preview), so the composer can't show another brand's data on its own. - Read-only and disabled: Analysts and Agency partners keep the read-only hint and link, and a disabled composer shows no ghost.
- The preview stays behind
chatAgenticEnabled(404 otherwise).
Nits (none blocking):
- In
composerKeyActionthe Tab check runs before the IMEcomposingcheck. Moving it after that check would be safer for input methods. - Tab in an empty box with a ghost fills the box instead of moving focus. This matches the spec and the hint line says so, but a keyboard user tabbing through the page has to press Tab twice to get past the box (or Shift+Tab back).
chip.keyis the React key, so two chips with the same key would clash. That's fine as long as pages keep keys unique.
Tests on the PR head (main is already an ancestor, merges clean): web tsc ok; vitest src/components/chat/composer, src/lib/chat, src/lib/guards/plan-row.test.ts: 25 files, 409 passed. eslint shows no problems in the changed files; prettier ok. No migration, no new dependency, no new server import in client code.
…svisor#1833 and ansvisor#1834 fixes) into take-1843 # Conflicts: # web/src/app/[locale]/(dashboard)/dashboard/chat/_chat-page-access.test.ts # web/src/app/[locale]/(dashboard)/dashboard/chat/_chat-page-access.ts # web/src/components/chat/chat-thread-view.tsx # web/src/components/chat/composer/chat-composer.test.tsx
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 #1826. 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-11: context chips and ghost text.
onSend(text, { context })carries them.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/composer(24 tests): chip cut and title, Tab/click accept, no send on ghost alone, no ghost while running.Checklist
help/chat)🤖 Generated with Claude Code