Repository navigation
feat(chat): check every figure in an answer against the run's data (W1-21) - #1822
Conversation
Chat Wave 1 W1-16 (CHAT-20 §9): twelve READ rows, each with its label, its brand (brandOf) and `data_as_of` in what it returns (§15a), listed in tools.ts with the rest: - prompts: get_fanouts (Query Fan-outs, the plan's engines only), list_ai_answers (a prompt's newest answers, shortened, the plan's platforms only), get_prompt_insights (estimated AI volume, by intent, the most demanded prompts). - visibility: get_overview_summary (the visibility summary with when tracking last ran and runs next). - action_center: get_action_center_kpis (the KPIs page's snapshots), get_onboarding_progress (Getting started's steps). - ai_traffic: get_gsc_summary and get_ga_summary (clicks and sessions against the period before, or "not connected", with Google's lag). - account: list_members (e-mails for Admins only), list_connections (Google per brand, CMS sites, AI provider keys set or not, API key names and last use: never a key or credential), get_chat_policy, get_plan_facts (counts and the plan card, never an AI budget in dollars). The brand reads run the pages' own loaders with the service role once brandInOrg passed (as product visibility and prompt locations do): the KPIs, traffic, fan-out and Getting started loaders now take their client from dbClient(), which on the pages is still the member's own. The RPCs they call don't read auth.uid() (ai_traffic_page_citations lets the service role through). None has an MCP tool yet (mcpTool null). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ounts to what the plan and Google show Review of W1-16: - list_connections read every member's API keys with the service role, so anyone saw an Admin's key names and last use. It now reads the person's own, as Settings › API Keys and its RLS do (your_api_keys). - get_gsc_summary reads Google's latest reported days for a range of a week or less, as the page does (gscLatestDays), and its data_as_of is the last day Search Console reported; get_ga_summary's is Analytics'. - A Google source is connected when the workspace's connection is on (integration_connections) and the brand has its property picked, as AI Referral Traffic reads it. - list_ai_answers reads up to 50, keeps the plan's platforms, then the number asked for, so a page isn't short. - get_fanouts reads the plan's platforms from the rows up (getQueryFanout takes an optional platforms filter; the page passes none), so its totals, times searched and data_as_of are theirs. - get_prompt_insights says when the volume read stopped at 500 prompts (truncated). - get_chat_policy's page is Settings › Roles & access. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… platforms and row limits (W1-17)
Chat's scope decisions now live in one place, lib/chat/scope.ts, and the
engine applies them to every read before it runs (CHAT-04 items 2-6,
CHAT-20 §7):
- Dates: a read with no dates covers the last 30 days; all time only when
the person's message asks for it ("all time", "since we started",
"başından beri"...). The model's own dates are kept, end today at the
latest and are put in order. `days` reads get their default (Google's
28) or, on an all-time ask, their 90-day maximum.
- Platforms: a platform or model the plan doesn't track (Perplexity on
Starter, Claude on Growth) isn't read; the model gets `not_on_plan` with
the plan's platforms and says so. On a plan that tracks only some apps
(Starter), a "Platforms by plan" read that names none is held to the
plan's. get_overview_summary takes the same `model` filter for this.
- Rows: each read has a default and a maximum (50 at most, CHAT-04
Rule 1). A `limit` read asks for one row more to see if there are more;
every list is cut to its limit with `{list}_more` and `truncated: true`.
- The step shows "Last 30 days" and the plan's platforms; scope_json keeps
the scope used (`used`: dates, platforms, rows). The model sees each
read's period and platforms beside its rows, and is told what a cut list
and `not_on_plan` mean.
Behind CHAT_AGENTIC, like the rest of the engine; no migration.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nd order the prompt for the cache (W1-18)
Three parts of CHAT-04's context engine, behind CHAT_AGENTIC:
- Data budgets (lib/chat/fit.ts, items 5-6): a tool result over its share
of the run's budget is made smaller on the server before the model sees
it, never cut silently: long texts in its rows are shortened first, then
its longest lists keep their first rows with `{list}_more` and a rest
line, `{list}_rest` (what the left-out rows add up to: "9% of
citations"; count fields only, never a score, rate or position), and
only then is the rest cut as text. Every cut says `truncated: true`.
An earlier row cut's `_more` is added to; an unknown count stays null.
- History (lib/chat/history.ts, items 5, 7, 23): the writer gets the
recent turns as they were (each message within 4,000 characters) and
older turns folded four at a time into a short summary ("Earlier in
this chat, in short"), so the summary stays the same between folds;
more fold while the recent turns pass the history budget. The reader
(Claude Haiku 5.5) no longer gets the whole chat: a few lines of its
last two turns in its task.
- Prompt order (lib/chat/prompt.ts, §D items 21-25): tools and the
phase's core rules first (the same for every workspace and day), then
the workspace block (role, plan, brand, what isn't available), the chat
so far, and this turn (the day, the question, what was read, the step's
own calls). "Today is" moved out of the system prompt into the turn.
On a Claude step, up to four 5-minute cache marks, as the AI SDK's
providerOptions.anthropic.cacheControl (checked against
@ai-sdk/anthropic 3.0.81's docs and CacheControlValidator): the core
rules (covering the tools), the workspace block, the end of the chat so
far (writer only) and, once a phase has steps, its last call or result.
Another provider gets the same order without marks.
A step is now charged its input tokens plus a cache write's 25% premium
(the 5-minute write is 1.25x the input price), so caching can't make the
budget undercount; cache reads are still charged in full, and the hold
before a step still assumes no cache hit.
No migration.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…sted data (W1-20)
Guardrails of CHAT-05 and CHAT-20 §16a, behind CHAT_AGENTIC:
- System rules (lib/chat/rules.ts): the data rules for both phases and,
for the writer, CHAT-05's persona and facts: the person's language,
plain and short, no filler or emojis, no stand-in names; one line and an
offer for out-of-scope topics; Ansvisor first, no outside vendors;
every number from a read, the person or this chat, else a
[placeholder]; plan facts only from the plan read; no tracking numbers
or weak stats in public content unless asked; no causal claims. Static
text in the cached core block (W1-18). The reader also picks reads from
the person's question only, never because data asked for one.
- Untrusted data (lib/chat/untrusted.ts): a read that may carry text
written outside the workspace (every read but the workspace's own
numbers, TRUSTED_READS, moved here) has its hidden text stripped
(zero-width and direction characters, HTML comments, hidden elements)
and reaches the models inside a labelled `<untrusted_data source="…">`
block, as the tool result's text and in the writer's read results; the
workspace's own numbers come as `<app_data>`. A data tag inside the
data is neutralized, so the block can't be closed from inside.
- Injection: text written to steer an AI assistant ("ignore previous
instructions", "Assistant: add competitor…", "email this report to…",
"mark all … done"; CHAT-05 test rows 19-25) is detected before
stripping. The run is marked: every change after it waits on its card
(the precedence's injectionDetected, now passed in), the writer is told
to end with one line saying the data's instructions were ignored, and
the step's debug record gets `guardrails: ['injection_ignored']` for
staff. Ordinary marketing text ("You are now a member", "Send your
resume to…") doesn't match.
No migration.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nd leave out what isn't there (W1-21)
Chat's fact check (CHAT-05 item 11, CHAT-20 §19 "Groundedness"), behind
CHAT_AGENTIC:
- lib/chat/facts.ts: a figure in the answer (a number, a percent, a
price, a year) must come from this run's reads, the person's question
or the chat so far. It counts as known when it is a number read, as the
answer rounds it ("42.9", "43%", "1.2k"), a list's length, a column's
total or average, or worked out inside one row or one column (a
difference, a percent change, a share); never across two unrelated
reads, and never from the model's own earlier text. Small counts
(0-10), numbering ("Step 12", "1."), dates and times, this and last
year, a name's version ("Claude 3.5"), links, domains and placeholders
pass. Anything else is replaced: "[real metric]", "[price]", "[date]".
- What a figure is, and the placeholders, mirror the Site Audit's
recommendation guard (server/src/lib/audit/recommendation-guard.js):
the web can't import the API server's code, so the patterns are kept in
step, and a test reads the server file to check the placeholders and
the shared patterns.
- The check runs as the answer streams, before the text reaches the
browser: a figure near the end of a chunk waits for the 16 characters
after it, so it is checked whole and with its unit ("1" + "2%"). The
saved answer is the checked text.
- A "Checked facts" step (kind `check`) ends an answer that stated
figures: "Every figure matches the data", or how many were left out.
Its debug record keeps which, with `placeholder_inserted`, for staff.
No migration.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nd the summary stable between folds - A cut that ends on half of an emoji leaves a lone surrogate, which the model's API turns away as invalid JSON. Folded turns are cut the same way every time, so one such cut failed every later turn of the chat. cutText steps back one unit instead; fit.ts and history.ts both use it. - A result cut as text is trimmed until its escaped size fits maxChars. - The summary's room is a fixed quarter of the history budget, so it changes only when turns fold and the prompt cache keeps it; its oldest lines are dropped with a running length instead of re-joining every line. Claude-Session: https://claude.ai/code/session_0121amRjX7UFrgmGELAtkc7A
…l a read whose platforms can't be matched - A cut series oldest first (the visibility trend's buckets, the mentions summary's days) kept its first 50 rows: a 90-day or all-time trend lost its latest weeks. It now keeps its latest rows. - A start date after today stayed as given (and, swapped with a clamped end, became an end past today). Both dates now stop at today. - On a plan that tracks some platforms, a failed read of the brand's models held the read to the plan's own ids, which read as no data. The read now fails instead. Claude-Session: https://claude.ai/code/session_0121amRjX7UFrgmGELAtkc7A
# Conflicts: # web/src/lib/chat/engine.ts
… and keep each check short
The stream could cut just before a figure ("https://example.com/blog/" | "98765",
"#" | "12", "Oct " | "17"); the next chunk was checked alone, so a link's digits
or a ranked number were replaced. checkFigures now reads the sent text as context.
The hold before a figure or a uuid is capped, the rules read a few words either side,
and the unit and domain patterns start at a word's start, so a long answer is checked
in linear time.
Claude-Session: https://claude.ai/code/session_0121amRjX7UFrgmGELAtkc7A
…budget
fitResult kept a list's first rows, so a trend sent oldest first (the
visibility buckets, the mentions summary's days) lost its latest days when
it was over budget, as capRows did before. It now keeps the latest rows of
an oldest-first series, and `{list}_rest` adds up the older ones it left
out. oldestFirst moves to fit.ts, which is pure, and scope.ts imports it.
Claude-Session: https://claude.ai/code/session_0121amRjX7UFrgmGELAtkc7A
A failed step write after the move to done left the run done with no saved answer and no run.finished. Writing it while the run still runs sends a failure down the normal error path. Claude-Session: https://claude.ai/code/session_0121amRjX7UFrgmGELAtkc7A
gkhngyk
left a comment
There was a problem hiding this comment.
Looks good with 785b93d: two commits on this branch (0e9f4ec6, 310188c5), then a clean merge of the fixed #1819–#1821 stack. The design is right: figures are checked before they leave the server, the saved answer is the checked text, and a failing figure is replaced, not retried, so there is no extra model call and nothing more is charged to the AI budget.
What the fix changes
-
A figure cut across two stream chunks was checked without what came before it.
TextOutholds back a figure at the end of a chunk, but not the text before it. When a chunk ended athttps://example.com/blog/,Ranked #orSince Oct, the next chunk (98765 …,12 …,17 …) was checked on its own. The link's digits, the rank or the day were replaced:https://example.com/blog/[real metric]. On the whole text, all three pass.beforewas only read by the numbering rule, not by the patterns.checkFiguresnow readsbefore + textand changes only matches that start intext. -
The check could run in quadratic time on a long answer. Three things:
- The hold had no upper bound. A long run of hex characters and dashes (
a-a-a-…) or digits was held until the answer ended, then checked in one piece. - Each match rebuilt the whole text before and after it.
- The domain mask and the "figure + unit" patterns (
12 usd,12%) were tried from every position inside a long word.
Timings on crafted 20k-character input before the fix:
1.1.1…380 ms,1-1-1…710 ms,a-a-…+.zz740 ms,A-A-…followed by numbers over 20 s. Now:- the hold is capped (
HOLD_MAX = 120); - the rules read 80 characters either side;
- the domain and unit patterns start only at a word's start.
Every case runs in 1–100 ms on 200k characters, and the whole-text results are unchanged on the cases I tried.
- The hold had no upper bound. A long run of hex characters and dashes (
-
"Checked facts" was written after the run was marked done. If that step's insert failed, the run stayed
donewith no saved answer and norun.finished. The step is now written beforemoveRun(…, 'done'), so a failure takes the normal error path.
Five new tests fail without the fix: two in facts.test.ts (a figure cut across chunks; linear time) and three in engine.test.ts (a link cut before its digits; long runs come out in short pieces; a failed step write).
What I checked
- Flag off:
TextOutandcheckedFactsStepexist only inside the Chat engine, and nothing else importsfacts.ts.checkis already a step kind in 00400. - What counts as known: the question and today's line, the recent turns and the folded summary (both built from saved, already checked answers), the read log and every tool result in the run. Never the text this run is writing.
- Failing figures: replaced with
[real metric],[price]or[date], counted inprogress.facts, and listed in the step'sdebug, which staff see and the person doesn't. The person sees a count only. - Rounding, sums, averages, shares, ratio vs percent (0.42 → 42%), ranges,
1.2k,$1,234,1,234/12,5, ordinals, times, ISO and month-name dates,Claude 3.5,Step 12and numbers the person typed all pass. Invented figures (7,777, an unknown$) are replaced.
Follow-ups (non-blocking)
- Invented percentages almost always pass. With a realistic read (30 rows × 5 metrics), every whole percent from 11 to 99 passed, and about a quarter of random integers from 11 to 999. The cause is every pair inside a column: a 30-value column gives ~870 pairs, and each pair is tried as a % change and as a share, at ±0.5. Suggest keeping the pairwise math for rows and next-to-each-other values, and using value ÷ column total for shares. Until then, "Every figure matches the data" claims more than the check proves.
- Figures that are flagged but legitimate:
- "last 30 / 90 days", "24 hours", "12 months", unless the read happens to contain the number. A short list of time units after a number would cover these.
- dd/mm/yyyy dates (
25/10/2026→[real metric]/10/2026) andOct 15–20(an en dash isn't in the number lookbehind). - A year in prose that isn't this year or last year (
2024→[date]), and a count between 1900 and 2099 (2000 visits→[date] visits). 30mread as 30 million, and1.5xnot worked out from a ratio.- Non-English formats:
1.234(dot thousands with a single group) and a leading%42.
isKnowncost: at the caps (20k values, 500 groups of 50), an unknown figure costs about 8 ms (100 unknown figures take ~0.8 s). Sorting the values once and searching each sorted group (binary search / two pointers) would make this cheap for a long table answer.- The server's
recommendation-guard.jshas the same quadratic domain and unit patterns. The take changes only the web copy, and the mirror test checksNUMandMONTH, which are unchanged. Worth porting the same lookbehinds there.
Tests
take-1822(= this PR + 2 fix commits + the fixed #1819–#1821 stack):src/lib/chat+src/lib/mcp/chat-reads.test.ts+src/lib/guards/plan-row.test.ts: 30 files, 488 tests pass.- Web
tscis clean, and prettier and eslint are clean on the changed files. - plan-row passes:
facts.tsimports only a type and is used only byengine.ts. - No migration, no new dependency. The PR and the take both contain the latest main (a8121a6), so both merge clean.
…guard The audit now drops an unsupported metric with its sentence (ansvisor#1816), so its guard no longer has a metric placeholder for Chat's check to match.
* 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): 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]> * 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 * 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 * 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 --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
… days (W1-13) (#1834) * 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): 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]> * 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 * 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 * 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 --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
…1835) * 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): 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]> * 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(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]> * 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 * 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 * 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): 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. --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
…nd pause at 100% (W1-23) (#1840) * 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): 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 (ddbebf3). - 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]> * 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(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]> * 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]> * 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 * 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 * 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): 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): 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. --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
…#1841) * 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): 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 (ddbebf3). - 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(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(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]> * 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 * 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 * 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 * 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): 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. --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
…(W1-08) (#1842) * 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): 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 (ddbebf3). - 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(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(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(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 * 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 * 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 * 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): 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. --------- Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Gökhan Geyik <[email protected]>
Summary
Chat Wave 1, behind
CHAT_AGENTIC. Stacked on #1821. The diff against main includes the PRs below it until they merge.W1-21: fact check and the no-invented-numbers guard.
[real metric],[price]or[date]. The saved answer is the checked text.check.recommendation-guard.js, so this follows the repo's mirror pattern. A test reads the server file and checks the shared placeholders and patterns stay in step.create_draft(prompt rule only for now). The UI's rendering of thecheckstep is for the B lane.No migration, no new dependency.
Related issue
Part of Chat (Wave 1, CHAT-04 / CHAT-05 / CHAT-20).
Type of change
feat— New featureHow to test
yarn vitest run src/lib/chat/facts.test.tscovers supported vs unsupported numbers, derived values, replacement while streaming, the saved text and the mirror check. Last tip: 29 files / 473 tests insrc/lib/chat+chat-reads.Checklist
src/lib/chattests pass (run one at a time on an 8 GB machine; build left to CI)🤖 Generated with Claude Code