Repository navigation
fix(billing): fill the chosen plan start and billing period - #1806
Conversation
The 14-day trial / Monthly / Yearly choice above the plan cards (Billing, onboarding's plan step and the plan dialog) marked the chosen one with the page's own background on a muted strip, which hardly showed. It is now filled as the site's other toggles are (bg-primary: dark on light, light on dark), and so is the Monthly / Annual toggle of a running plan. The saving and offer pills keep a solid ground on the filled one in the dark theme. aria-pressed was already right; tests pin it with the fill. Co-Authored-By: Claude Opus 5.5 <[email protected]>
gkhngyk
left a comment
There was a problem hiding this comment.
Approving. This only changes styles. The chosen option in the start picker (trial / monthly / yearly) and in the active plan's Monthly / Annual switch is now filled with bg-primary text-primary-foreground. When chosen, the saving and offer badges get a solid dark:bg-emerald-950. cn runs through tailwind-merge, so that class replaces dark:bg-emerald-950/50 rather than both being applied.
What I checked
- Nothing about behaviour changes.
aria-pressed,onChange/setPeriod, and the plan and period passed to the purchase flow are the same as before. No request body, route, role check or read-only path is touched. - The new tests catch the bug. With the old classes put back, the two new cases fail, and the other 21 in
plan-switcher.test.tsxstill pass. - Contrast: the light badge sits on the dark fill in the light theme. In the dark theme the solid emerald-950 badge sits on the light fill. Both are readable.
StartChoicePickeris shared, so Billing, onboarding's plan step and the choose-plan dialog all get the new style. Their tests pass.
Merge
- Merges cleanly on current main. It also merges cleanly with each of the open billing PRs #1804, #1818 and #1823. None of them changes these class lists, and none of their tests checks the old
bg-backgroundstyle.
Tests (PR merged with main): tsc is clean, and so are prettier and eslint on the changed files. Vitest ran 8 files and all 107 tests passed: plan-switcher, everything under components/billing, billing-section, the onboarding tests and lib/guards/plan-row.test.ts.
Optional, not for this PR: two other segmented toggles still use the old bg-background style, the fan-out tab in Prompts and the action plan in Shopping. A follow-up could move them to the same fill.
… dark, as the plan tabs AI credits / Storage in Settings › Billing › Add-ons marked the picked tab with bg-background in a muted track, which read as unpicked in the dark theme. It now uses bg-primary text-primary-foreground, as the plan tabs (ansvisor#1806) and the Get more window do; the test checks the picked tab by aria-pressed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
gkhngyk
left a comment
There was a problem hiding this comment.
Merging in order with the other approved PRs. This head merges current main; its tree is what main will be after this squash, checked with the full server and web suites, tsc, lint, format and next build.
…hases in Billing (W1-33) (#1846) * feat(chat): add Wave 1's tables for sharing, settings, attachments, Files, 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]> * feat(billing): sell AI credit and storage packs, granted only by the Stripe webhook CHAT-18 (W1-31), behind CHAT_AGENTIC, on 00413's tables. An Admin of a workspace on a paid, active plan buys a pack; nothing is granted before Stripe says it was paid. - Buying (startAddOnPurchase, a server action that never throws): AI credits open a Stripe Checkout in payment mode with an invoice; storage is a monthly item on the plan's subscription, prorated and charged to the card on file at once (a declined card fails the purchase with Stripe's words). A pending add_on_purchases row is written first and every Stripe object names it. Refused for non-Admins, the free trial, a plan that isn't active, Chat off, and a pack without a Stripe price ("unavailable", no Stripe call); storage also on a plan billed yearly. - Granting (the webhook, before the plan's handlers): checkout.session .completed / async_payment_succeeded and the pack's invoice.paid write one ai_credit_grants row (half the price in model cost, 12 months from the payment); invoice.paid with a storage item writes storage_grants until the period's end and moves it on at each renewal. A purchase is paid once (only from pending) and a grant written once (unique purchase_id), however often or early the event comes; an item not yet written down is found by its pack's price. A full charge.refunded takes back the unused credits or ends the storage, and a refunded pack isn't renewed. A pack's invoice never changes the plan's status. - Spending (server): with Chat on, a hold passes on the credits once the included budget is spent (creditRoomUsd), and a charged call's cost past the included budget is drawn from the grant ending soonest, its ledger row split by grant_id (drawCredits), for Chat's steps and every other AI feature. Credits outlive the monthly reset; own-key rows never touch them. - The plan's routes take the plan's subscription item, never a pack's. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(billing): name the pack purchase among the actions that check the plan themselves startAddOnPurchase refuses a workspace without an active, paid plan itself (trial, no_plan), answering a reason rather than throwing, as prepareImageUpload and Chat's settings do: the read-only coverage test lists it with why. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(billing): show the add-on packs, the AI credit left and the purchases in Billing CHAT-18 (W1-33), on W1-31, behind CHAT_AGENTIC: Settings › Billing gets an Add-ons card under the AI usage card; nothing renders while Chat is off. - Packs: AI credits and Storage tabs; each card is the "Get more" window's pack card (price, what it adds, validity, Most picked on $50 and +25 GB). What an AI pack adds is a share of the plan's own monthly AI limit ("+20% of the monthly limit", "+5 monthly limits"), worked out on the server; a pack without a Stripe price reads "Not on sale yet". - Buying: Admins pick a pack and Continue to payment; AI credits go to Stripe Checkout, storage asks first (it is charged at once) and says so when the card is declined. Others see the packs and "Ask an admin"; the trial and a plan not active say why they can't buy. - "AI credit: $X left · expires {date}": the credits still valid, in the packs' own dollars (what was paid, never the model cost), ending with the soonest. Dollars stay on Billing; Chat and the model get none. - Purchases (Admins): date, pack, price, status, what's left and the invoice, through GET /api/add-ons/invoice/{id} (Admins of the purchase's workspace, sent on to the PDF). - getBillingAddOns never throws; texts in settings.addOns; theme tokens with dark: variants. Help: help/settings/add-ons.md (approved: false). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(billing): load Stripe only when a pack's purchase or webhook needs it lib/stripe.ts makes its client when it is loaded and throws without STRIPE_SECRET_KEY (local development, self-hosted). The add-on actions imported it at the top, so on Settings, whose server actions are bundled together, every action beside them broke with it (Billing's AI usage card among them). loadStripe (lib/billing/add-ons.ts) imports it on demand and gives null without the key: a purchase then answers "unavailable", and the webhook's lookups load it only when they run. lib/stripe.ts and its routes are as they were. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(billing): load Stripe for a pack's invoice only when it is asked for The add-on invoice route imported lib/stripe.ts at the top, which throws without STRIPE_SECRET_KEY: it now loads it through loadStripe when an Admin opens an invoice, and answers 404 without the key. The test without a key also reads Billing's packs and credit line: they never touch Stripe. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(billing): mark the picked add-ons tab black in light and white in dark, as the plan tabs AI credits / Storage in Settings › Billing › Add-ons marked the picked tab with bg-background in a muted track, which read as unpicked in the dark theme. It now uses bg-primary text-primary-foreground, as the plan tabs (#1806) and the Get more window do; the test checks the picked tab by aria-pressed. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(billing): stop billing a refunded storage pack, grant only paid Checkouts, and let pages use purchased AI credits - A full refund of a storage pack now takes its item off the plan's subscription (no proration), so it isn't charged each month for storage it no longer grants. An item already gone is fine; any other Stripe error answers 500 so Stripe sends the event again. - checkout.session.completed grants AI credits only when payment_status is 'paid' ('no_payment_required' never grants). - getAiUsage says whether purchased credits are left (a boolean, no dollars), and aiUsageTone stays a warning at 100% while they are, so the Content Editor, the banners and Chat's composer don't say "used up" while calls still run on the credits. The Improve tab's quota counts them too. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0121amRjX7UFrgmGELAtkc7A --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
#1857) * feat(chat): add Wave 1's tables for sharing, settings, attachments, Files, 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]> * feat(chat): export an answer as Markdown, Word, PDF, CSV or Excel CHAT-06 items 30–42, the library W1-25's Download menu will call: an answer rendered from its stored content_md on the server, with no model call, nothing stored and no new dependency. - lib/chat/export.ts reads the answer: Markdown to the Content Editor's export blocks (headings, paragraphs with bold, italics and links, lists, tables, quotes, code), its tables named by the heading above them, the formats Download offers (CSV and Excel only with a table), and the file name: the question's slug, or the chat title's past 60 characters, plus the day it was generated in its time zone. App links are made whole with the app's origin; javascript: and other links are dropped. - lib/chat/export-file.ts writes the files: Markdown as UTF-8; Word with draft-export's docxBlocks; CSV (byte order mark, formula-safe cells), and a .zip of one CSV per table when there are several (fflate); Excel with one sheet per table and plain numbers as numbers (write-excel-file/node, as the traffic export). - lib/chat/export-pdf.tsx writes the PDF with @react-pdf/renderer on the server, Inter embedded from public/fonts so Turkish letters print, links clickable, tables as tables, page numbers. - Every file carries the answer's "Generated … · Data as of …" line (item 40): first line of Markdown, Word's and PDF's header and footer, the first row of a CSV and of each sheet. The caller words it from en.json, as the app shows it under the answer. - draft-export: docxBlocks and docxDocument are exported, and docxDocument takes an optional header and footer line; the Content Editor's exports don't change. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(chat): open Chat at /dashboard/chat and add its chats API 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 (#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 (#1812 note). - Help: a "chat" area and its first article (approved: false). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(chat): add the chat menu with Agents at work, day groups and Ctrl+\ 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, #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]> * feat(chat): add the chat ⋯ menus: pin, rename, share, archive and delete with Undo Behind CHAT_AGENTIC, like the rest of the Chat shell. - PATCH /api/chat/conversations/{id} `{ pinned?, title?, shared?, archived? }`: the author's own chat only (else 404), a trimmed title of 1 to 200 characters, answered as a value (#1777). - Each chat row's ⋯ (CHAT-23 chatMenu.rowMore, G9), on hover and focus: Open, Open in new window, then for the author Pin / Unpin, Rename, Share with team / Stop sharing, Archive, and Delete for the author or an Admin on a shared chat. A teammate's shared chat only opens. - The open chat's ⋯ in the header (G10): Chat settings, Open in new window, Pin, Rename (in the title), Share with team, Export chat, Activity log, Archive, Delete. Export chat is shown disabled ("Coming soon"): wiring it to the answer exports is left to W1-25. - Rename edits the name in place, in the row or the header: Enter or clicking away saves, Esc cancels; double-clicking a row's title starts it. - Every change shows at once and is then sent; a refused one is put back with "Couldn't save that". Archive's toast and Delete's (10 s) carry Undo; Delete asks first ("Delete this chat?", focus on Cancel, a red Delete), stops a running agent, and leaves the open chat for Chat Home. - A pinned chat shows the pin where its dot is. - Help: managing and sharing a chat. Split view, Pause / Stop run, Schedule this and Save as agent come with their pages (Wave 2 and 4). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): read a shared chat's author with the server's client for their initials Other members' profiles are hidden from the person by their policy, so a teammate's shared chat showed no initials. Read with the service role, kept to the person's workspace, for the name only. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(chat): add Chat Home's greeting, the Inbox and the due-tasks line Behind CHAT_AGENTIC, like the rest of the Chat shell. - Chat Home (CHAT-01 items 10-12, mockup #s-home): "Good morning / afternoon / evening, {first name}" by the person's own clock (switching at 12:00 and 18:00; no name, no comma), then one line: "Your agents worked while you were away. N things need you." linking to the Inbox, or "All caught up.". The composer stays below it. - The Action Center line (item 12, CHAT-09 item 3): "N Action Center tasks are due this week" (singular at 1, hidden at 0): the active brand's open actions due by Sunday, overdue ones included, read as the person by a server action that answers as a value (#1777). Complete with Chat asks Chat to complete this week's tasks in a new chat and opens it while the run goes on. - The Inbox at /dashboard/chat/inbox (mockup #s-inbox): what needs the person (Review), what runs (its progress, Watch) and unread results (Open), with "1 needs you · 1 running · 1 done today"; a row opens its chat; one line when empty. - The chat menu gets Inbox, with its count and an amber dot while something needs the person (also beside Menu when folded), and the collapsed strip gets an Inbox button, as in the mockup. - Help: Chat Home and the Inbox. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(chat): add the composer, with send, Stop and steering, run modes 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]> * feat(chat): add context chips and the Tab ghost suggestion to the composer 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]> * feat(chat): add the composer's / @ and + menus, with a reference search Chat Wave 1, W1-12 (CHAT-02 items 11–17, agentic update; mockup #slash, #atmenu, #plusmenu), on the composer's chips (W1-11). Menus open above the box: ↑ ↓ move, Enter picks, Esc closes and keeps the text, and a click outside closes them. - /: typed first in an empty box, or from the / button. It lists Wave 1's shortcuts, which start a message: /analyze "Analyze", /report "Create a report on", /create "Create content for". Typing filters them by command or a word of the name. From the button, the box's text stays after the starter. Analysts and Agency partners have no / (as the mockup). Skills join the menu in Wave 2. - @: typed at the start of a word, or from the @ button at the cursor. It references data: the page's own charts and metrics first (references, for W1-08), then the brand's matches (searchReferences), up to eight. A pick leaves the "@…" text and shows as a chip by name. × takes it off, and the send carries it (references: type, id, label, scope). No ID shows. - searchChatReferences (server action, CHAT_AGENTIC): the brand's tracked prompts, its pages and its open Action Center tasks that match, a source at a time. Read with the person's session; site_pages isn't in the generated types, so it is read with the service role for a brand the session can read. Template tasks are named from their keys. A search is made safe for PostgREST's filters. It answers { ok, failure } and never throws (#1777). - +: Attach files when the page uploads (onAttach, W1-13). Connect a tool: Settings › Integrations for an Admin; for others, "Ask your Admin to connect" sends one access request (B2). Read a page and Create an image stay hidden until their waves. - The preview's composers reference the mockup's chart, metric, table, page and task. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(chat): show a run's work live under its answer, with step chips, Data used and its stamp Chat Wave 1, W1-14 (CHAT-03 items 12a–14, the v2 timestamps), on the composer's menus (W1-12). RunAnswer draws an answer from its run's events, with the shared pieces (D1/D2): - The agent works beside it (AgentAvatar), waits on the person, or is still. - One status line, updated in place, in the running step's words: "Reading Citations…", "Opening ansvisor.com/pricing…", "Checking facts…". With no step running, "Writing the answer…" while text streams, else "Thinking…". "Reconnecting…" when the stream dropped. - The steps under their header (RunSteps). Each step done, thinking left out, is a ✓ chip with its rows, and a click shows its detail. W1-21's "Checked facts" step (#1822) is one of them. - The answer streams in (Markdown). - "Data used": one chip per source a read step read, with its largest row count, and per page a step opened. Skills, thinking, checks and failed reads are no source. The header counts these chips as its sources. - "Generated Oct 30, 2026 · 09:14 · Data as of …" in the person's time zone, the GMT offset in its tooltip. - What follows (next moves, the answer's actions) fades in once the run is done, and not at all with reduced motion. - run-view.ts holds the status line, chips and Data used, from the steps alone. - The Chat pieces preview plays the mockup's answer a step at a time ("Live answer"); its counts take the new pieces in. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(chat): attach files to a Chat message, up to 5 of 10 MB, kept 90 days Chat Wave 1, W1-13 (CHAT-02 items 18–22, 00409), on the live answer (W1-14), behind CHAT_AGENTIC. - The composer attaches files from + Attach files, a drop or a paste (uploader prop). Each file is a chip: type tag, name, "Uploading…", ×. Under the box: "This file type isn't supported.", "Files must be 10 MB or smaller.", "You can attach up to 5 files.", or "Upload failed." with Retry. Send waits while a file goes up, and a send carries the ready files' ids (ComposerSend.attachments). - lib/chat/uploads.ts holds the rules the bucket and table also hold: the listed types (a type from the extension when the browser gives none), 10 MB, 5 files. - Server actions (chat-uploads.ts), which answer { ok, failure } and never throw: - prepareChatUpload checks the type, the size, Chat on, an active plan and the person's own chat. It keeps a pending row ({organization_id}/{id}) and gives a one-time upload address. - finishChatUpload marks the file ready once it is there. - removeChatUpload takes a draft's file and row away. - Named in the subscription guard's open actions with why. - lib/chat/upload-client.ts sends the file to its address. A failure takes its row back, so Retry starts over. - startChatRun takes attachmentIds (up to 5). Each must be the person's own, ready and not sent with another message, checked before anything is kept; then the files are linked to the message and its chat. Reading attachments in the run is CHAT-04's work. - Server: sweepExpiredChatUploads deletes each attachment past its 90 days, file first, then row, in the daily run. - The preview's home composer attaches files that are "up" after a moment. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(chat): wire the composer and the live answer into Chat's pages Chat Wave 1: lane A's pages (W1-01…05) with lane B's composer and answer (W1-10…14), merged and joined. The engine's test page goes. - ChatThreadView (components/chat) carries the test view's run handling: send, streaming, reconnecting from the last event, Approve/Skip and Stop. ChatComposer and RunAnswer now draw it, with D2's approval and denial cards under each answer. Chat Home uses the home composer (2 rows); an open chat docks it under the messages. - The composer starts in the person's default mode (chat_user_prefs; a saved Full auto the plan no longer opens starts as Auto). Full auto opens as the plan facts say (chatComposerSetup). - Steering stops the run, then sends the text as the next message (decided 2026-10-30). - @ searches the chat's brand (searchChatReferences). Files go up with uploadChatFile and go with the message as attachmentIds. - A teammate's shared chat is read only: the box says so, with Start your own chat (loadChatThread's new `mine`). - The test page's title and box go, with their unused chatPage strings. - Help: chat.md covers asking, the modes, Stop and steering, shortcuts and your data, attaching files, and watching the work. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(chat): show the AI usage under Chat's composer, say 80% once, and pause at the limit Chat Wave 1, W1-23 (CHAT-04 items 15–17; mockup usgHTML, limHTML), on the wiring (ddbebf36). - The composer's line shows the AI usage meter: the header's meter and its popover, drawn small by class (ComposerUsageMeter). It is amber from 80% and red once used up. The free trial shows the meter's own words. - From 80%, one amber line above the composer, once a period. × closes it until the next period (localStorage, by the period's mark). - At the limit, Chat pauses (chatAtCap: used up, and Chat draws on the allowance). The red AI usage banner shows above the composer, with where to get more, or "ask an Admin" for other members. The box is off: "AI limit reached · models on your own key still work", or "Your trial AI limit is used up". On the workspace's own key Chat keeps working. - A teammate's shared chat shows none of it. - Help: chat.md's AI usage section. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(chat): copy Agent Chat's conversations into Chat on the first visit On a person's first visit to Chat (CHAT_AGENTIC on), their Agent Chat conversations in their workspace are copied into chat_conversations and chat_messages with the same ids, so old chats sit in Recents by their last message and open at /dashboard/chat/{id}. Questions and answers in words are kept; tool rows, tool-only answers and empty conversations are not. The default title "New conversation" becomes "New chat". Once per person: chat_user_prefs.legacy_imported_at (00408) is set only after a complete copy, so a copy that failed is tried again next visit. Already-copied ids are left alone (upsert ignoring duplicates), so two visits at once or a second run change nothing. It never throws and never keeps Chat from opening; the old tables are only read. The test fake learns upsert, range and ordering by several columns. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(chat): add Search chats, the Ctrl K palette and the All chats page Search chats (CHAT-01 item 6; CHAT-23 G2): GET /api/chat/conversations/search finds the person's chats and the team's shared ones whose title or messages hold every word typed (00407's search_tsv, 'simple' configuration, words as prefixes), newest first; `view=archived` searches their own archived chats. Input is cut to letters and digits, so no operator reaches Postgres. - The chat menu gets the Search chats field under Chats: typing lists the matches in place of the days, with "No chats match." and Clear filters. All chats · {n} › and Archived · {n} › close the list. - Ctrl K (⌘K) opens the palette (mockup #msearch) under Search chats, or under the strip's new Search button while the menu is hidden; again closes it. New chat, the latest or matching chats and the Chat pages by name; arrows and Enter, Enter opens the first match or a new chat. - All chats (/dashboard/chat/all, mockup #s-allchats): Active and Archived tabs with counts, search over names and messages, filters All, Running, Needs you, Done, Mine and Team, and Archive selected / Unarchive selected for the person's own chats, with one toast. - Archive's toast now says "Archived · find it in All chats › Archived"; it is brought back from All chats › Archived (CHAT-23 chat.archive). Help: new help/chat/all-chats.md, chat.md updated. Popover passes an anchor through; the test fake learns textSearch. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(billing): sell AI credit and storage packs, granted only by the Stripe webhook CHAT-18 (W1-31), behind CHAT_AGENTIC, on 00413's tables. An Admin of a workspace on a paid, active plan buys a pack; nothing is granted before Stripe says it was paid. - Buying (startAddOnPurchase, a server action that never throws): AI credits open a Stripe Checkout in payment mode with an invoice; storage is a monthly item on the plan's subscription, prorated and charged to the card on file at once (a declined card fails the purchase with Stripe's words). A pending add_on_purchases row is written first and every Stripe object names it. Refused for non-Admins, the free trial, a plan that isn't active, Chat off, and a pack without a Stripe price ("unavailable", no Stripe call); storage also on a plan billed yearly. - Granting (the webhook, before the plan's handlers): checkout.session .completed / async_payment_succeeded and the pack's invoice.paid write one ai_credit_grants row (half the price in model cost, 12 months from the payment); invoice.paid with a storage item writes storage_grants until the period's end and moves it on at each renewal. A purchase is paid once (only from pending) and a grant written once (unique purchase_id), however often or early the event comes; an item not yet written down is found by its pack's price. A full charge.refunded takes back the unused credits or ends the storage, and a refunded pack isn't renewed. A pack's invoice never changes the plan's status. - Spending (server): with Chat on, a hold passes on the credits once the included budget is spent (creditRoomUsd), and a charged call's cost past the included budget is drawn from the grant ending soonest, its ledger row split by grant_id (drawCredits), for Chat's steps and every other AI feature. Credits outlive the monthly reset; own-key rows never touch them. - The plan's routes take the plan's subscription item, never a pack's. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(chat): add Chat Settings › General, Back to Chat and the app rail beside Chat Chat Settings › General (/dashboard/chat/settings, mockup #s-settings; CHAT-23 chatSettings.*): default mode, answer language, notifications, "Thought for N s" and Ask Chat on every page, kept on chat_user_prefs (00408) at once and put back when refused. A new server action, saveChatGeneralSettings, checks each change against the person: no mode for Analysts and Agency partners, Full auto only on a paid Growth plan and where the Admin leaves it on for members (it says why when locked), Inbox + Slack only once Slack connects (not yet). It never throws (#1777). Settings sits in the chat menu under Inbox with the month's AI usage in percent, in the Ctrl K palette, and in the header ⋯ (Chat settings). Navigation (CHAT-01 4b, 4e, 4f; CHAT-23 nav.*, rail.toggle): - Inbox, All chats, Activity and What Chat can do show ← Back to Chat and the "Chat › {page}" breadcrumb; Back to Chat returns to the last conversation open in this tab, or Chat Home. Settings shows its name. - Esc closes only the topmost layer and never navigates (covered by tests). - On Chat's screens the app sidebar is the rail; the logo expands and collapses it, kept on the person (chat_user_prefs.rail_open) through a new saveChatRailOpen action. Elsewhere, and with the flag off, the sidebar keeps its own pinned state and the logo still goes home. Help: new help/chat/chat-settings.md; chat.md gets "Move around Chat". Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(chat): add Chat's side panel to every app page with Ask Chat and Ctrl J Ask Chat sits at the top right of every page header (after the AI usage meter) and Ctrl J / ⌘J opens and closes the panel from anywhere, a page input included; on Chat's routes the key focuses the composer, and the Content Editor is left to its own Chat. The panel hosts the chat view (panel variant, the page's address stays) with New chat, History, Compact / Wide / Full screen and Close; from 1100px a compact or wide panel pushes the page aside, narrower and in full screen it overlays, below 760px it is full width with ← back to the page. It greets the person when empty and reopens its last chat used in the last 30 minutes. The layout reads panel_on_pages and panel_size (00408); the panel keeps its last size on the person. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(chat): name why your own chats' routes stay open on a read-only 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]> * test(billing): name the pack purchase among the actions that check the plan themselves startAddOnPurchase refuses a workspace without an active, paid plan itself (trial, no_plan), answering a reason rather than throwing, as prepareImageUpload and Chat's settings do: the read-only coverage test lists it with why. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(billing): show the add-on packs, the AI credit left and the purchases in Billing CHAT-18 (W1-33), on W1-31, behind CHAT_AGENTIC: Settings › Billing gets an Add-ons card under the AI usage card; nothing renders while Chat is off. - Packs: AI credits and Storage tabs; each card is the "Get more" window's pack card (price, what it adds, validity, Most picked on $50 and +25 GB). What an AI pack adds is a share of the plan's own monthly AI limit ("+20% of the monthly limit", "+5 monthly limits"), worked out on the server; a pack without a Stripe price reads "Not on sale yet". - Buying: Admins pick a pack and Continue to payment; AI credits go to Stripe Checkout, storage asks first (it is charged at once) and says so when the card is declined. Others see the packs and "Ask an admin"; the trial and a plan not active say why they can't buy. - "AI credit: $X left · expires {date}": the credits still valid, in the packs' own dollars (what was paid, never the model cost), ending with the soonest. Dollars stay on Billing; Chat and the model get none. - Purchases (Admins): date, pack, price, status, what's left and the invoice, through GET /api/add-ons/invoice/{id} (Admins of the purchase's workspace, sent on to the PDF). - getBillingAddOns never throws; texts in settings.addOns; theme tokens with dark: variants. Help: help/settings/add-ons.md (approved: false). Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(chat): name why saving your own Chat menu state stays open on a read-only workspace Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(chat): name why editing your own chat stays open on a read-only workspace Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(chat): name why saving your own Chat settings and rail stays open on a read-only workspace Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): keep the 80% usage line on the person, once per period on every device The line above Chat's composer at 80% of the AI usage was kept closed per browser. It now shows once per person per usage period (CHAT-04 item 16): the first time it shows, its period goes to chat_user_prefs.usage_notice_period (00408) through saveUsageNoticePeriod, and the Chat pages read it with the composer's setup; × still closes it on the page. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(chat): show the page's context as chips in the side panel, with Ask about this The side panel's box starts with chips for what the page shows: its name (the menu's when the page says nothing), the brand, the date range and filters (CHAT-01 item 20). They follow the page while the panel is open; × keeps one off until New chat. Pages tell the panel through useChatPageContext, which reads a setter-only context so a page never renders again for the panel. The empty panel offers up to three of the page's questions, which fill the box unsent (item 21), and Ask about this opens the panel with a chart or table attached as an @ chip (item 22). The chips and @ objects go with the message: the engine keeps them on chat_messages.context_json and gives them to the models as a data block, the run's default scope (CHAT-04 item 8). Mentions & Sentiment is the first page with its dates, filters, questions and two Ask about this icons. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(billing): load Stripe only when a pack's purchase or webhook needs it lib/stripe.ts makes its client when it is loaded and throws without STRIPE_SECRET_KEY (local development, self-hosted). The add-on actions imported it at the top, so on Settings, whose server actions are bundled together, every action beside them broke with it (Billing's AI usage card among them). loadStripe (lib/billing/add-ons.ts) imports it on demand and gives null without the key: a purchase then answers "unavailable", and the webhook's lookups load it only when they run. lib/stripe.ts and its routes are as they were. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(billing): load Stripe for a pack's invoice only when it is asked for The add-on invoice route imported lib/stripe.ts at the top, which throws without STRIPE_SECRET_KEY: it now loads it through loadStripe when an Admin opens an invoice, and answers 404 without the key. The test without a key also reads Billing's packs and credit line: they never touch Stripe. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(chat): give Brand Visibility, Citations, Prompts, Action Center, Traffic and Content their page context Each page now tells Chat's side panel what it shows (W1-08's useChatPageContext): its name, date range and filters as chips, and up to three questions, one of them from data the page already loaded where it has some (the platform whose visibility or visits moved most, the source cited most, a tracked prompt the brand doesn't show up for, the top action, a high-impact opportunity), without a model call. Ask about this is on Brand Visibility's platform table and leaderboard, Citations' Top Sources, Traffic's two tables, each tracked prompt and each Action Center action; on a row it opens the panel, not the row. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(chat): add the side panel's ⋯ menu, Open as full page and Back to the page Once the panel has a chat, its ⋯ (CHAT-23 panel.more) offers Open as full page, Open in new window, and for the author Pin, Rename (in the panel's title), Share with team, Archive and Delete, the chat menus' own actions. ChatActionsProvider tells a page outside the shell of a chat's new row and of one archived or deleted, which empties the panel. Open as full page goes to the chat on Chat's page with ?from= the page and its query; the full page then shows ↙ Back to {page} (CHAT-22), only for a dashboard page outside Chat. Back on a page, a panel that was away reads its chat again, so it shows what happened on the full page. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): read the full page's search params at the top of the shell Calling useSearchParams inside an expression kept the React Compiler from preserving the shell's memoized callbacks (lint: preserve-manual-memoization). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(chat): name the app page a side panel chat started on A chat the side panel starts now keeps origin 'panel' and the page's path in origin_page (CHAT-01 data notes); Chat's own page keeps 'page' and /dashboard/chat. The engine takes origin and originPage with the first message; a page it can't name is left out and the message still goes. The path check is shared with POST /api/chat/conversations (lib/chat/origin.ts). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(chat): copy, download or save an answer to Files, and export a chat Every finished answer gets an icon bar (CHAT-06 items 30–37): Copy (rich text), Download as Markdown, Word or PDF, and CSV or Excel when it has a table, rendered on the server from the stored answer with its time line (GET /api/chat/runs/{id}/export, W1-24's writers), and Save to Files, once per answer, then "In Files" (POST /api/chat/runs/{id}/file). Filing goes through fileChatOutput, which run deliverables will use as they are made: a row in chat_files and its content in chat-files, counted toward storage, refused once a workspace is full. Storage per plan comes from the spec: Starter 5 GB, Growth 25 GB, Enterprise 99 GB or its contract (plan_overrides.maxStorageGb), 1 GB in the free trial, plus active storage packs; self-host has no cap. Export chat in a chat's ⋯ menu now downloads the whole chat as Markdown, Word or PDF. The PDF routes carry public/fonts and keep @react-pdf/renderer outside the server bundle for Vercel. The time line's words move to lib/chat/stamp for the server. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): keep a long answer's PDF from failing past ten pages With the line height set on the page, react-pdf's page number threw "unsupported number" once the PDF passed ten pages, so any long answer failed to export. The line height now sits on the body text. Claude-Session: https://claude.ai/code/session_0121amRjX7UFrgmGELAtkc7A * feat(chat): show what a run made as output cards and open answers in the Content Editor - A write that makes something (create_draft's page) files it in Files as it is made and shows it under the answer as an output card: its type, title, "In Files" / "Used in Content draft" or "Not saved to Files · Storage is full", Copy, Download in the formats it offers and Open in Content Editor (CHAT-06 items 1-6, 9, 29). - Open in Content Editor on an answer's bar makes a Content draft of the answer in the chat's brand (else the brand open) and opens it. - Files' pages download as HTML, Markdown, Word and PDF on the server: the Content Editor's writers run with a jsdom window (lib/content/server-dom). - A reopened chat shows its output cards and filed answers again. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): keep the focus in the composer when a chip is removed 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 * feat(chat): add the Files page with filters, downloads, Download selected and the storage meter - /dashboard/chat/files lists the workspace's files newest first, 50 at a time with Show more: name and formats ("Used in Content draft"), Made by (You, a teammate, Agent, Scheduled), From chat (only chats the person can open), and the generated time with "Data as of" (CHAT-06 items 12, 16-17). - Chips All (with the workspace's count), Drafts, Reports, Code, Tables, Images, From me, From agents, and "Filter by name..." over the search column; "No files match." with Clear filters. - Each row has Copy (Markdown), Open (its Content draft) and Download in the formats it offers. Picked rows download as one .zip in their main formats, up to 50 files and 100 MB (items 18-19). - The storage meter ("Storage 2.1 of 25 GB", amber from 80%) and a line once storage is full, with no Get more until the plan rules are set (items 26-29). - GET /api/chat/files, GET /api/chat/files/{id}, POST /api/chat/files/zip (reads only). Files sits under Settings in the chat menu, in the Ctrl K palette and in the breadcrumb. - Help: help/chat/files.md (new). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): keep Agents at work to the person's own chats, and read the 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. * fix(chat): show a teammate's initials on a shared chat 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. * fix(chat): keep a teammate's shared chat out of the Inbox and Home's count A shared chat that waits for approval waits on its author, who alone can answer it. The Inbox, its counts in the menu and the strip, and Home's "things need you" now count the person's own chats only. * fix(chat): read a * in the @ search as a space, not a wildcard PostgREST reads * as % in like and ilike, so "@price*list" matched anything between the two words. Strip it with the other pattern characters. Claude-Session: https://claude.ai/code/session_0121amRjX7UFrgmGELAtkc7A * style(chat): format the read-only open routes list so the web format check passes * feat(chat): keep own AI keys to Enterprise, and a saved key for 30 days Owner decision 2026-10-30 (CHAT-16 items 19 and 28): once Chat runs on the AI budget, own provider keys are Enterprise's only; on Growth they would take the place of AI credit packs. A workspace that saved a key before Chat went live for it keeps using it for 30 days, on any plan. - lib/chat/key.ts: ownKeyInPlan is Enterprise only; ownKeyAccess says open / plan / kept / locked and starts a kept key's 30 days the first time it is needed (organizations.legacy_key_until, 00414). - 00414: legacy_key_until, server only; marks paid Growth workspaces with a key too (00405 marked Starter and trials only). - Settings › AI Providers: below Enterprise the API refuses saving or switching keys (403 own_keys_enterprise) and the page says why, with only Remove; a kept key shows its end date and can be replaced. - Plan card: Own AI keys locked to Enterprise, listed in what Enterprise adds; the custom plan's points list them. - AI usage: "Use your own key" only where an own key helps. - Help: settings/ai-providers.md (approved: false). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(chat): open one Get more window from every limit, with the packs, what they cover and the plan CHAT-18 §B item 6 and §C (mockup #s-limits #more): - One window, on AI credits or Storage. "Your plan" on top (CHAT-20 §7a), where the limit stands ("AI usage this month: 18% · Growth · resets Nov 1", "Storage 2.1 of 25 GB · Growth"), the packs with what each adds, and on AI credits "What a pack can cover, roughly" (price ÷ 2 over the launch averages on Auto, rounded down) with its examples line and warning. - Continue to payment goes through Billing's own purchase, now shared as useAddOnPurchase: AI credits go to Stripe Checkout; storage is confirmed in the window first, then "Added. You can continue." - Only admins buy. Other members see the packs and Ask your Admin; the free trial sees them but can't buy. Use your own key shows on Enterprise only while Chat draws on the AI budget, the same rule as ownKeyOffered on the own-keys branch. - It opens from: - the AI usage meter's popover and the used-up banner ("Get more AI credits", for every member); - Chat at its cap (once a period); - the Files storage meter and its "Storage is full" line; - an output card that wasn't filed; - the Save to Files toast. With Chat off or self-hosted there is no window and the old links stay. - getGetMore reads the packs, the plan card and the storage. Help: settings/add-ons, chat/files, chat/chat. - Builds on W1-27 with W1-33 (and W1-31) merged in. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): style answers as the app's other AI answers, take hand-made brand ids, and keep Files' draft line whole From the W1-25…27 preview: - A Chat answer's Markdown gets the prose styles the Mentions drawer and the response detail use (prose prose-sm dark:prose-invert max-w-none): headings, lists and table cells, in both themes. - Starting a chat with a brand (createInput) and Chat Home's due-actions line take the demo brand's id with z.guid(): it is made by hand, not an RFC 4122 uuid (as #1849 did for starting a run). - On Files, "Used in Content draft" has its own line under the formats, so a 1024px table no longer cuts it off. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): mark the picked Get more tab black in light and white in dark, as Billing's plan tabs The picked tab was bg-background in a muted track, which read as unpicked in the dark theme. It now uses bg-primary text-primary-foreground, as the plan tabs in Billing do (#1806); the test checks the picked tab by aria-pressed. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(billing): mark the picked add-ons tab black in light and white in dark, as the plan tabs AI credits / Storage in Settings › Billing › Add-ons marked the picked tab with bg-background in a muted track, which read as unpicked in the dark theme. It now uses bg-primary text-primary-foreground, as the plan tabs (#1806) and the Get more window do; the test checks the picked tab by aria-pressed. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): clean the pages Chat files, number output cards by their files, copy as Safari allows From the pre-push review of W1-25…27: - create_draft's page goes to Files as the draft keeps it, through sanitizeDraftHtml, and Files' HTML download cleans it again: a page Chat read can't slip a script or an event handler into a download (CHAT-06: no script in exported HTML). - An output card's file is its place among the run's filed outputs, as the server counts them. A card that wasn't filed (storage full, failed) no longer shifts the next card onto another page's file. - Copy on an output card writes a clipboard item within the click, its text to come (Safari refuses a write after an await), and says when it can't. - A reopened chat's output cards mask ids in their titles, as the live events do. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): stream Download selected, copy Files rows as Safari allows, and say what a full workspace keeps From the pre-push review of W1-25…27: - Download selected streams the .zip as it is made (fflate's Zip): one file read, written and compressed at a time as the reader asks for more, so neither the files nor the .zip are held whole, and a .zip past a function's body cap still goes out. The limits stay: 50 files, 100 MB stored, checked before anything is read. - Copy on a Files row writes a clipboard item within the click, its text to come (Safari refuses a write after an await), and says when it can't. - Help: with storage full, an output's card can't copy or download it (it has no file); the answer above it still can. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(chat): keep Data used to "Read …" steps, and plain links in the answer A read step whose words aren't "Read …" (the app's own "Opened a page" from the page router) read no source: it no longer shows as a Data used chip or as "Reading Opened a page…". The answer's Markdown links only http(s) addresses (in a new tab) and pages of the app, and shows an image as its alt text. Claude-Session: https://claude.ai/code/session_0121amRjX7UFrgmGELAtkc7A * fix(chat): send an attachment with its type, and call it ready only when its bytes are that type - upload-client: a File goes up as a form part with the browser's type, not contentType, so a .md the browser gave no type reached the bucket as application/octet-stream and was refused. It now goes up as a File with the type the app named. - finishChatUpload: ready only when the object is there with the type it was prepared for, at most 10 MB, and its first 1 KB is that type's (contentMatchesType: %PDF-, zip, PNG/JPEG/WebP signatures, no NUL in text). The row keeps the bucket's size. A file that fails the check is deleted at once instead of waiting 90 days. Claude-Session: https://claude.ai/code/session_0121amRjX7UFrgmGELAtkc7A * fix(chat): keep a copied Agent Chat thread in its order Agent Chat wrote a conversation's whole thread again on every turn in one insert, so its messages share one created_at and their ids don't follow the order. The copy read them by created_at then id, which shuffled them, and Chat reads a chat by created_at alone. Read each conversation the way Agent Chat's own page did (by created_at, no tiebreak) and give the copies a strictly rising created_at, a millisecond apart where they tied. Also cut a long title or message without splitting an emoji in half. * fix(chat): open Full auto in the composer only where the server runs it, and steer only after Stop is taken The composer's Full auto now follows the same facts the approval check uses: the plan, and for anyone but an Admin the Admin's Full auto for members switch. When the switch closes it, the mode says Off by Admin rather than Needs Growth. Steering sends the new message only once the Stop is taken; otherwise the text stays in the box. * fix(chat): find a domain, a number or an email address in Search chats Each word goes to Postgres quoted, so it splits it the way it split the text: "nike.com", "4.5" or an address is one token there and is now found whole, and Postgres lowercases it itself. Claude-Session: https://claude.ai/code/session_0121amRjX7UFrgmGELAtkc7A * fix(chat): never leave the Get more window on its skeleton, say what a storage pack waits for, and update Help From the pre-push review of W1-32, on top of #1851 (merged in): - The own key follows ownKeyOffered everywhere, the window included: Enterprise only while Chat draws on the AI budget, and members are told askAdminNoKey. - A read of the window that fails (a dropped connection, a 502) says so instead of leaving it on its skeleton. A purchase that fails to start says so and frees Continue to payment, in the window and in Billing. - A storage pack counts once Stripe's webhook hears it was paid. The window says so (Billing's words) and reads again a moment later (AFTER_PAYMENT_READ_MS), as Billing does, instead of "Added. You can continue." and an immediate read. - Help: at the AI limit, Get more AI credits opens the window for every member, once by itself; own keys only on Enterprise. Co-Authored-By: Claude Opus 5.5 <[email protected]> * style(chat): format the read-only open actions list so the web format check passes * fix(chat): keep Chat on at the AI limit on the workspace's own key, and read the usage again after each run The composer turned off whenever the allowance was used up, but Chat on the workspace's own key never draws on it (the server's hold writes those steps unchecked), so a workspace with its own key could not send at all. The page now reads whether Chat runs on the workspace's own key, as the server picks it, and keeps the composer on then. The meter, the 80% line and the pause also read the usage again once a run stops working, so they follow the chat's own spending without a page change. One read per run, no timer. * fix(chat): name the run's own brand in the page context, and keep its block closed The brand chip a message carries is now the run's own brand (the chat's, checked against the workspace), not the posted label and id; it goes when the run has no brand. The page context reaches the models with < and > as JSON escapes, so a label can't end the block, and a reference's scope is capped at 8 entries. * fix(chat): name only a known platform in Traffic's question, and the first Top action in Action Center's AI Referral Traffic's suggestion now reads the platform the page can name, as the summary line does, and none over all time, where there is no previous period and every platform would read as a rise. Action Center's "How do I finish" names the first of the Top actions as the card ranks them; the list arrives unordered. * fix(chat): set up the side panel's composer as Chat's pages set theirs up The panel's setup read Full auto from the plan alone and left out whether Chat runs on the workspace's own key. So a member whose Admin turned "Full auto for members" off could pick a mode that then asks anyway, and the panel paused at the AI limit on a workspace's own key. The layout now reads the switch and the key (only with the new Chat on) and builds the setup with the same composerSetupOf Chat's pages use, moved to lib/chat/composer-setup; the panel passes fullAutoOffByAdmin and onOwnKey on to the composer. * perf(chat): load the side panel's code the first time it opens The layout imported the panel directly, so its thread, composer and run views came with every app page, Chat on or off. The layout now puts a small slot there that loads the panel the first time it opens and keeps it after that. * fix(chat): keep Back to the page off paths with dot segments panelReturnOf accepted /dashboard/../… and its %2e form, which resolve outside the dashboard or into Chat. Refuse a . or .. segment. * fix(billing): stop billing a refunded storage pack, grant only paid Checkouts, and let pages use purchased AI credits - A full refund of a storage pack now takes its item off the plan's subscription (no proration), so it isn't charged each month for storage it no longer grants. An item already gone is fine; any other Stripe error answers 500 so Stripe sends the event again. - checkout.session.completed grants AI credits only when payment_status is 'paid' ('no_payment_required' never grants). - getAiUsage says whether purchased credits are left (a boolean, no dollars), and aiUsageTone stays a warning at 100% while they are, so the Content Editor, the banners and Chat's composer don't say "used up" while calls still run on the credits. The Improve tab's quota counts them too. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0121amRjX7UFrgmGELAtkc7A * fix(chat): open an answer in the Content Editor as the answer shows it An image in the answer goes into the draft as its alt text, and raw HTML as its text, as the answer itself shows them; links stay, cleaned by the draft's own sanitizing. * fix(chat): open the Get more window at the cap only when the cap pauses Chat, not on the workspace's own key * fix(chat): keep a long answer's or chat's PDF within the route's time react-pdf's layout time grows with the square of the length: 2,000 table rows took about 60 s and 6,000 rows about 4 minutes, and Export chat joins every answer of a chat. A PDF now lays out 1,000 rows and blocks at most and ends with a line saying so (Markdown and Word keep all of it), and both export routes get maxDuration 300. Also matches the downloaded body in the answer bar's test by its size: fetch's Blob is Node's, not the test page's. Claude-Session: https://claude.ai/code/session_0121amRjX7UFrgmGELAtkc7A --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
Summary
Reported while testing: on the plan choice (14-day Trial · Monthly · Yearly) you couldn't tell which one was picked.
What changes
StartChoicePicker(web/src/components/billing/plan-start.tsx) fills the chosen option withbg-primary text-primary-foreground. That is near-black with white text in the light theme, and light gray with dark text in the dark theme. It is the same pattern the date range filter, the market picker and the trend card use. The component is used by Billing, onboarding's plan step and the plan dialog, so all three change.aria-pressedwas already right. Tests now check that the chosen option is both pressed and filled, and the others are neither.Related issue
None. Product owner's request.
Type of change
fix— Bug fixHow to test
On a workspace without a plan, open Settings › Billing (or onboarding's plan step). The chosen tab is filled; switch tabs and the fill follows. Check both themes.
Tests: 4 files, 99 tests;
plan-switcher23/23.Checklist
🤖 Generated with Claude Code