Repository navigation
feat(chat): give Chat the page context on every page, the pages of one item included - #2470
Merged
Merged
Conversation
Chat beside a page now reads what the page shows (the owner's rule, 2026-11-16; step 5 of the page-data plan, gaps G1 and G2). - Period: a period the message names wins, then the page's date chip, then the person's default. A page on All time reads all time. On a page with its own dates the range card isn't shown and nothing is kept as the default; the composer hides the person's range chip beside the page's. A read with a period input (Ads) takes the range when it is one of its periods. - Filters (lib/chat/page-scope.ts, from scopeRead): platform, region and topic fill the reads of the page's brand that take them; a list's own filters (status, category, impact, type, Sources, prompt) only the read of that page's list. Values are checked against each input's schema; a chip no read takes the same way stays text. The model's own input wins, "" reads all, and a question that asks for all of a filter drops that chip. A page of another brand than the run's keeps its filters as words only. - Rules: the reader is told the page's dates and filters apply; each read's scope has from_page, and the writer says once what the answer covers, as on the page, never row counts. - Help: Chat answers for the page's dates and filters unless you ask otherwise. - Eval: citations-page-scope (24 hours, ChatGPT, Brand sources). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
The owner's decisions on ansvisor#2459 (16 Nov): - Citations: the domain and page lists follow the page's Sources, as its table does, and the citations and their average per answer count every source, as its cards do. When list_citations took Sources from the page, the engine runs the same read over every source beside it (one row, same filters and window) and puts its totals next to the filtered lists as all_sources_totals (lib/chat/citation-totals.ts). The person's own Sources read once, as before. The writer says counts are for all sources and lists for the chosen Sources. No change to lib/mcp or the read's registry row. - Ads: get_ads_opportunities takes the page's period only on Ads, and a period the message names anywhere; elsewhere it reads its own 30 days, never the person's default or another page's range (ScopeFacts.rangeFrom: message, page or default). - Lookups by domains or urls take no page filter, as codes and ids. - Help: Ads' Chat line says the period it reads. - Eval: the Citations scenario checks the answer says its scope. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Stacks step 7 on both open Chat PRs (ansvisor#2459 page period and filters, ansvisor#2460 lookups by name). Their eval scenarios, eval data, eval tests and Chat help keywords are kept as a union; approved-articles.json is regenerated. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Step 7 of the "Chat must read everything a page shows" plan: Chat's
numbers and "top" lists equal the screen's.
- Counts past 1,000 answers: the citations scan, the visibility
summary's raw window and a product's appearances read the window a
page at a time, newest first, up to 50,000 answers (answer-pages.ts).
Past that the note says what the counts cover, never a row count.
- Last 24 hours as the page reads it: on Overview and Citations reads,
the latest completed tracking run's days (the pages' own
getTrackingWindow, with the service role after brandAllowed); the
rolling 24 hours before a first run. Prompts and AI Traffic read a
preset as the last N x 24 hours, as their pages do (page-periods.ts).
- Prompts: get_prompt_performance gives each prompt's AI Visibility
Score and Coverage, as the Prompts table (the page's own read, or the
same sums over a platform's answers) and ranks by it by default;
avg_visibility stays, sorted by "answer_score", and is labelled.
- The page's default order: Actions can read every status, most
recently updated first (the list's tie-break too); Content
Opportunities take the page's Sort (newest, score, oldest). The
models get the page's order beside <page_context>; "what should I do
first" keeps priority, and the writer says which order a list is in.
- explain_change compares the run's period (the page's, else the
person's range) with the days before it, as the pages compare a
change, to yesterday; Last 24 hours keeps its 7 against 7.
- get_visibility_trend returns every day of its period, compact, within
its share of the run.
- Help: "Numbers that match the page"; "Why a number changed" says its
new default. approved-articles.json regenerated.
- Eval: prompts-page-top ("What are my top 5 prompts?" on Prompts).
No migration. MCP output is unchanged but for additive fields.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
The side panel now sends what the page shows beyond its chips: the open tab, the sort and search picked, the rows on screen by the code or id the page shows, the list's total, and the page's own URL state (whitelisted per page). The engine checks it again (cut, never refused), keeps it on the message, and gives it to both models in an untrusted page_view block with the rule to read those rows by their refs before saying anything. The page's chosen sort replaces its default in the order line, and a search goes into the read's search input. send() in chat-thread-view.tsx posts the view, with the owner's permission for this plan. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
The page's search (from its view) now fills `search` on the reads of the page's own list that take one, as ansvisor#2459 fills its list filters: as ansvisor#2460's capped lookup words, never over the model's own search, ids or codes, not for another brand's page, and dropped when the question asks for all. The read's scope names it (from_page.search) and the writer says it. In the models' page_view block every row and ref stay, each label cut to 80 characters; the stored view's cap is now a safety net that every 100-row view fits under. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
When Sources came from the Citations page, the engine ran list_citations twice in parallel: the filtered read and the same read over every source (limit 1) for the cards' totals. Limit 1 didn't shrink the work, so every such question scanned the window's answers twice. The read now counts every source's citations in the same pass that builds the Sources-filtered domain and page lists, and returns them as all_sources_totals when the engine asks (ChatToolContext.allSourcesTotals): one read, one scan. The writer's rule and the result's shape stay as they were. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
The maintainer's review: readAnswerPages paged prompt_results by offset, four pages at once up to 50,000 rows of jsonb, under the visibility summary (also the external MCP tool), the citations reads, product visibility and the prompt scores. It is gone. - Citations (list_citations and the domain/page lookups): over whole UTC days the domains, citations and answers come from the Citations page's own daily rollups (00118: citations_domains_daily and citations_window_stats_daily). They are security invoker over the rollup tables, so the service role runs them after the brand check, by brand. Every source's totals come from the same rows. The pages and the prompts citing them have no aggregate the service role may run (citations_urls_daily and citation_url_occurrences refuse it), so they come from one bounded request of the newest answers, never paged; the result says what that covers when the window holds more. - Visibility summary inside a day: the raw aggregates the page reads (competitor_aggregates, ai_visibility_aggregates, visible_prompt_stats, tracked_prompt_count), no answer rows. Whole days keep the rollups. The MCP output keeps its shape. - Product visibility: the Products page reads cards itself, so one bounded request with an exact count: every appearance counted, the breakdowns of the newest read, said when cut. - Prompt scores: always the Prompts page's prompt_visibility_summaries. It takes no platform, and the page counts every platform's answers, so the plan's platforms no longer send Starter to a raw read. - Visibility order: the Prompts table's own comparator, a prompt with no score counted as 0, an unscored one last. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
# Conflicts: # web/src/lib/chat/registry/read-tools.ts
# Conflicts: # help/chat/chat.md # web/src/lib/help/approved-articles.json # web/src/lib/mcp/brand-scope.test.ts
# Conflicts: # web/src/lib/chat/registry/tools.test.ts # web/src/lib/chat/testing/model-eval.ts
…erge The merged base runs ansvisor#2462's page periods over the reads ansvisor#2464 and ansvisor#2466 add: Prompts › Tracked's locations, the Topics tab, and AI Referral Traffic's bots and Search Console pages cut a preset as their pages do (the last N × 24 hours to today), and the eval set now has rows 38 (Today's first action) and 39 (losses to a competitor). Their tests say so. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Step 9 of the owner's "Chat must read everything a page shows" plan. Today, Signals, History (and its Scorecard), KPIs, Review, Agents and an agent's page, Competitors, Products, Site Audit, Library, Plan, Reports, the Topics tab and a cited page now tell the side panel their name, date range, filters and view: tab, sort, search, the rows on screen by the code each shows (else an id, a domain, an address or a key) with the list's total, and the item held open. Each from what the page already holds; no list sends rows while it loads. The server wires each page as the first 8: its URL keys whitelisted; its rows kept only for the ref kinds a read looks up, and the reader told which read takes each; the open item from the URL (?signal=, ?competitor=) or the view (Products' drawer by title, an agent's page); its list filters (priority, source, card, Products' channel, Agents' tab) on its own list's read only; its chosen sort mapped to the read's. list_signals takes category, impact and source, and get_action_center_kpis the period. Two scripted eval scenarios: "bunlar ne?" on Signals reads the S- codes on screen; "bu rakibe karşı nerede kaybediyoruz?" on Competitors reads the open competitor's head-to-head. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
…-same-maths-as-pages Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
…-page-view Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Step 9 of the owner's "Chat must read everything a page shows" plan, for the pages whose item is in their path: a topic's page, a prompt's, a saved report, a Site Audit report, a product's page, a content opportunity's and an AI answer's. Each now sends its name, its dates where it has them, the item it shows (view.open: its id and title) and the rows it lists that a read looks up: a topic's ranked prompts by id, a prompt's Top Sources by domain and its opportunities by id, a Site Audit report's failing and warning checks by key. Each from what the page already holds; nothing is read again in the browser. The server takes the item from the path (viewPathId), never from the view: "this topic", "this report", "this product" is the one the URL names, read with the read that takes its id. A topic's page is its topic's filter: its id fills topic_id on its brand's reads, unless the model gave its own or the question asks for all topics. A prompt's page fills no prompt_ids, so a ranking asked there stays one. A message from another brand's item page keeps the page's pattern only. A key ref may hold dashes (json-ld-validity), never a lower-case code. Help says detail pages too. One scripted eval scenario: "bu konuda en zayıf promptumuz hangisi?" on a topic's page reads that topic's prompts and names its weakest. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
…etail-pages Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
…ext-detail-pages Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
…context-detail-pages Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
This was referenced Nov 17, 2026
cihan-gyk
dismissed
gkhngyk’s stale review
November 17, 2026 18:14
The merge-base changed after approval.
getVisibilitySummaryFor read the raw competitor_aggregates whenever a window started or ended inside a day: on the busiest brand 13 s for 7 days and past 120 s for 90, which external MCP calls with timestamps reach. Now a window of at most about a day (25 hours of answers, up to now) is still read to the minute from the raw aggregates; a longer one is read over the whole UTC days it touches from the daily rollups, and the result says so (roundedToDays and a note). A bound that isn't a day or a time is refused with a clear message before any read. Chat's whole-day windows are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
…-page-view page-scope.ts takes both imports: the lookups' search words and the page-route helper. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
help/chat/chat.md keeps both sides' keywords; approved-articles.json regenerated from the help files. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
get_prompt_locations (from main) is a read of Prompts › Tracked, so the app gives it a preset as that page reads it: the last N × 24 hours up to now (page-periods.ts rollingWindow), as every other Prompts read here. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
…-same-maths-as-pages help/chat/chat.md keeps both sides' keywords; approved-articles.json regenerated from the help files. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
With the page's search, list_prompts and list_content_opportunities went down their lookup path, which reads every status and drops the page's other filters and the sort, while the scope note said they were taken. Now the app sets as_listed with the page's search: the search reads the list as the page lists it (status, impact, type, topic, active state, archived set aside, the read's sort, paged and counted like the list). The model's own search on such a read stays a lookup by name in every status, and then none of the page's filters is filled or said taken. /dashboard/prompts is Tracked Prompts (page-route.ts), so its search reaches list_prompts; the view's URL keys, open item and order use the same helper. The order line says the app applies the page's search, or leaves out a filter's "all", only where pageFilterInputs does. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
…etail-pages page-scope.ts keeps both: the brandless reads, tab and path filters of this branch, and the page-route alias and as_listed search from below. help/chat/chat.md says both; approved-articles.json regenerated. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
…-page-view help/chat/chat.md keeps both sides' keywords; approved-articles.json regenerated from the help files. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
…etail-pages Both sides' help keywords; the Prompts' Locations test and the brand-scope imports as below (the same reads, main's order); approved-articles.json regenerated. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Main now holds ansvisor#2465 (fix/chat-today-agents-reads), so it comes in with main rather than on its own. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
getActionCenterKpisFor took a period of any length, so a model could ask for 2015 to today. A period longer than 365 days now keeps its last 365 (as the Why read keeps its last 92 and Prompts its 90), and the result's note says what was asked and what was read. 90 days, and exactly 365, are read as asked. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
…-same-maths-as-pages Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
…-page-view Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
…etail-pages Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
scope.ts took any search on list_prompts or list_content_opportunities for named rows and dropped the model's limit. The page's search, as listed, reads the list, so it keeps them; ids still name rows. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
…re the app applies it Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
cihan-gyk
dismissed
gkhngyk’s stale review
November 18, 2026 11:26
The merge-base changed after approval.
This was referenced Nov 18, 2026
feat(chat): read Citations › Gaps; the citation functions let the service role through (00541)
#2469
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Review fixes (17 Nov)
getActionCenterKpisFor(web/src/lib/mcp/action-center-reads.ts) used to take a period of any length, such as 2015 to today. A period longer than 365 days (KPI_PERIOD_MAX_DAYS) now keeps its last 365, as the Why read keeps its last 92 days and Prompts its last 90. The result'snotesays what was asked and what was read, and the Chat tool description says so too (registry/action-center.ts). Tests inweb/src/lib/mcp/chat-reads.test.ts: a 10-year request reads 2025-11-17 to 2026-11-16, with the note. 90 days, and exactly 365, are read as asked, with no note./dashboard/promptsfixes from fix(chat): read the page's view: tab, sort, search and the rows on screen #2463 come in with the merge.pageFilterInputskeeps this branch's brandless reads and tab and path filters, plus the alias andas_listed. The order lines for History and Agents now say the app applies the search only where it does (page-order.test.ts).Summary
Step 9, the last step of the "Chat must read everything a page shows" plan (owner, 16 Nov): every page that sent no context now does, the pages of one item (its id in the path) included.
Until now, 13 pages and the Topics tab told the side panel nothing but their menu name and the brand. Chat didn't know the page's dates or filters, which rows were on screen, or which item was open. So "bunlar ne?" on Signals or "bu rakibe karşı nerede kaybediyoruz?" on Competitors was answered from a list read in its own order, or from another competitor.
Now each of these pages calls
useChatPageContextthe way #2463's 8 pages do. It sends its name, its date chip, its filter chips and its view: tab, sort, search, the rows on screen by the code the page shows (AC-n, S-n), else an id, a domain, an address or a key, plus the list's total and the item it holds open. Every value comes from what the page already holds. Nothing is read again in the browser.On the server, each new page is wired the way #2459, #2462 and #2463 wired the first 8:
sortinput.Two reads gained the inputs the pages need:
list_signalsnow takes category, impact and source, andget_action_center_kpistakes the period.Detail pages. The pages of one item told Chat nothing either: a topic's page, a prompt's, a saved report, a Site Audit report, a product's page, a content opportunity's and an AI answer's. So "bu konuda en zayıf promptumuz hangisi?" on a topic's page was answered over every topic. Now each sends its name, its dates where it has them, the item it shows (its id and title) and the rows it lists that a read can look up. The server takes the item from the path, never from the browser's view: "this topic", "this report" or "this product" is the one the URL names, read with the read that takes its id. On a topic's page the topic is the page's topic filter: the app fills
topic_idon its brand's reads, as a topic chip does.Changes
useChatPageContexteach. Where a list keeps its own state (Agents' list, the Products table, the Topics table), it hands its part up with anonChatViewcallback, as Prompts › Tracked does in fix(chat): read the page's view: tab, sort, search and the rows on screen #2463. Today's Since yesterday and Waiting for you hand up their rows the same way (onSignals,onRows). No rows or total are sent while a list is loading. Library's list computations moved above its "no brand" return, unchanged, so the hook runs on every render.ChatPageContext.view.open(lib/chat/page-view.ts): an item the page holds open outside its URL,{ ref?, label }. These are Products' product drawer (a product AI showed, known by its title only), an agent's page, and the competitor's name beside?competitor=.viewPage()maps/dashboard/agents/<uuid>to/dashboard/agents/[id]for the per-page tables.PAGE_QUERY_KEYS): Signals, History, Competitors, Products (tab), Site Audit (tab), Library and Plan (days), as each page writes or reads them. Today, KPIs, Review, Agents and Reports keep no state in the URL.lib/chat/page-view-scope.ts,PAGE_REFS):keyref kind (ai_visibility,citation_gap) is taken only where the page lists it: KPIs and History's Scorecard.?signal=→list_signalsids) and Competitors' competitor (?competitor=→get_competitor_head_to_headcompetitor_id, with its name).get_shopping_visibilitybyproduct_title) and an agent's page (→list_agent_runsagent_id).open: competitor <id> — Acme CRM, and the note says "this one" is that item.lib/chat/page-scope.ts):priority,sourceandcard, applied only on the page's own list, asstatusandcategoryare.list_citations'model, as Citations' does.list_my_agents'view. That read has no brand, so a brand-less read takes its own page's list filters, never a platform, region or topic.lib/chat/page-order.ts): Signals, History, Agents and the Topics table. Each read already lists in its page's default order, so the line comes only once a sort or search is chosen:get_action_history'ssort, and its search to itssearch.list_my_agents.list_signalstakescategory,impactandsource(sourcematches a signal with that source among its sources, as the page's filter does).get_action_center_kpistakesdate_fromanddate_toand reads the KPIs over those whole UTC days, as the KPIs page's range does. Without both, each KPI uses its own timeframe, as before.approved-articles.jsonwas regenerated.chatPanel.pageNames.citedPage("Cited page"), the cited page's chip.pageOpencheck (readOpenItem) and a head-to-head in the eval data.Detail pages (commit
f4f7d3c16):/content/[id]) and an AI answer's (/insights/[id]) each calluseChatPageContextwithview.open= the item (its id, its title). A content opportunity's page gets the title fromOpportunityDetailthrough a newonOpportunityprop, since the same panel also opens in Content's drawer, whose page sends its own context. The topic page's prompt roll-up moved above its early returns, unchanged.lib/chat/page-view.ts):viewPage()maps each of these paths to its pattern (/dashboard/prompts/topics/[id]), and a newviewPathId()gives the id. A product's page keepspromptandplatformfrom its URL (the shelf its "Why not you?" opened on); the others keep no URL state.lib/chat/page-view-scope.ts,PATH_OPEN): on an item's own page, the open item is the path's id, with the view's title only when the view names that same id. An agent's page moved here too. The note tells the reader the read:get_topics_overviewandget_prompt_performancewithtopic_id;get_prompt_performancewithprompt_ids;get_report;list_site_audit_issues;get_product_ai_says;get_content_opportunity;get_mention.PAGE_REFS): a topic's prompts by id (→get_prompt_performanceprompt_ids); a prompt's Top Sources by domain (→list_citationsdomains) and its content opportunities by id (→get_content_opportunity); a Site Audit report's checks that fail or warn, by their keys (→list_site_audit_issues, its check with that key). Akeyref may now hold dashes (json-ld-validity), each word starting with a letter, soac-12is still none. A saved report, a product, a content opportunity and an AI answer send no rows.lib/chat/page-scope.ts,PATH_FILTERS): a topic's page is its topic's filter, so its id fillstopic_idon every read of the page's brand that takes one, unless the model gave its own or named rows; "all topics" / "tüm konular" drops it.engine.tsmessageScopeOf): a message from an item's page of another brand than the run's keeps the page's pattern for its path, so its item's id reaches neither the reader nor a read.approved-articles.jsonwas regenerated.chatPanel.pageNames.prompt,siteAuditReportandaiAnswer, the chips of the pages whose own title is long or none.topic-page-weakest(below). The eval data'sget_prompt_performancenow takestopic_idandorder.Page by page
list_action_center_taskscodes,list_signalscodes or ids,list_draftsidslist_signals; platform as wordslist_signals?signal=→list_signalsidscategory), priority, source →get_action_historysort; search →searchlist_action_center_taskscodes; Scorecard by kind (key) →get_action_scorecardget_action_center_kpisget_action_center_kpislist_task_reviewslist_my_agentsview; search →searchlist_agent_runsagent_id/agents/[id])list_agent_runsagent_idget_competitor_head_to_headcompetitor_id; a domain →competitor?competitor=with its name →get_competitor_head_to_head/shopping)days)get_shopping_shelf,list_shopping_cardsplatform(own list); region →regionget_product_ai_says,list_catalog_productsget_shopping_visibilitylist_site_audit_issuesaudit_idstatus→list_drafts; created, made in, last send, shopping as wordslist_draftsidsget_content_plandaysget_content_plancard; page type as wordsget_content_opportunity; else the page's address → itsget_content_planrowget_reportget_topics_overviewlist_citationsmodel; region →region?u=→list_citationsurls (#2463)/prompts/topics/[id])topic_idon every read of its brand that takes oneget_prompt_performanceprompt_idsget_topics_overview,get_prompt_performancetopic_id/prompts/[id])list_citationsdomains; content opportunities: id →get_content_opportunityget_prompt_performanceprompt_ids/reports/[id])get_reportreads it whole)get_report/audit/[id])list_site_audit_issueslist_site_audit_issuesaudit_id/shopping/products/[productId])get_product_ai_saysproduct_id/content/[id])get_content_opportunity/insights/[id])get_mentionidSafety
brandAllowed, filters bybrand_idand joins the organization. The new open item goes through the same checks as a row: its ref must be the page's kind, its label is cut, cleaned of hidden text and withheld when it reads like an instruction. It is dropped with the rows when the view comes from another brand's page.topic_idon reads of the run's own brand (which filter bybrand_id), and from another brand's page the path keeps its pattern only, so the id reaches no read and no prompt.list_my_agents) takes its own page's list filters only.list_signals' new filters are fixed enums, passed as query values (eq,contains), never as text in a filter string.prompt_results:list_signalsadds three filters to its one query, and the KPI read passes the period to the page's own function.'use server'file changed.chat-thread-view.tsx,page-pane.tsx,page-open.ts, the content editor folder and the Action Center site-type files (lib/action-center/play.ts,components/action-center/play-section.tsx) are untouched.How to test
get_prompt_performancewith that topic'stopic_id(the step's scope says it came from the page), and the answer names one of that topic's prompts. Then ask "tüm konularda en zayıf prompt hangisi?": notopic_id.prompt_idsover the page's range. Switch to 7d and ask again: over 7 days. Ask "bu kaynaklar ne kadar alıntılanıyor?": Chat reads the Top Sources' domains.get_reportand says its dates.list_site_audit_issuesand names the failing checks.get_product_ai_sayswith that product's id./dashboard/content/<id>) and an AI answer (a prompt's run › Open full page): ask "bu ne?". Chat readsget_content_opportunityorget_mentionwith that id.topic_idfrom that page.context.view(rows, total, tab, open) and its URL keys.cd web && SKILL_EVAL=signals-page-view,competitor-open-losses,topic-page-weakest yarn vitest run src/lib/chat/agent-eval.test.ts.Checks
The merged base:
npx tsc --noEmit -p .passed on the base. The check set (below) found 3 failing tests: two period tests from fix(chat): read what the MCP Server already reads, and keep the two in step #2464 and fix(chat): read the Topics table, Query Fan-outs, a competitor head to head, Overview's map and Opportunities, AI bots and Search Console pages #2466 that predate fix(chat): rank and count as the pages do #2462's rolling Prompts and AI Traffic windows, and model-eval's row list after the renumbering.d9ae7f9b2fixes them; nothing else changed.npx tsc --noEmit -p .passes.Vitest passes: 620 files, 7,952 tests (1 skipped: the real-model eval). The set is
src/lib/chat,src/lib/mcp,src/components/chat,src/app/api/chat,src/app/api/mcp,src/components/action-center,src/lib/action-center,src/components/content,src/components/audit,src/lib/help,src/i18n,use-server-exports,subscription-guard-coverage, and every dashboard page's tests (src/app/[locale]/(dashboard)/dashboard, the content editor's included).New and extended tests:
page.test.tsx: window, filters as the reads name them, search, S- codes else ids, none while reading); History (range, filters with Type ascategory, sort, search, rows by code, Scorecard by kind and none by play); KPIs, Review, Agents' list (tab, debounced search, tab count), an agent's page (open by id, runs' filter), Competitors (period, rows, the open competitor), the Products page and table, Site Audit (Pages by audit id, Opportunities by last audit), Library (tab as status, none for Archived), Plan (days, card, rows by opportunity id or address), Reports, the Topics tab (sort only off the default, rows in the table's order), a cited page (newpage.test.tsx).page-view.test.ts: every new route keeps only its keys (token,code,next,utm_sourcedropped); pages with no URL state keep none;viewPagefor an agent's path.page-view-scope.test.ts: ref kinds kept and dropped on each new page; the first 8 unchanged and never taking a key; each page's own lookups in the rows rule; the open items (URL and view), their block lines and notes; a wrong-kind or out-of-place open item dropped; an instruction-like label withheld; another brand's view keeps its tab only.page-scope.test.ts:list_drafts, Agents' tab and search reachlist_my_agents(none for "all my agents", a tab the read lacks, or no brand chip), Products' channel reaches only its own reads, Plan's card reachesget_content_plan, and a cited page's platform maps tomodel.page-order.test.ts: silent at each default; History's sort and search; Signals' search; Agents' search; the Topics columns.signal-page.test.ts(category, impact, source) andchat-reads.test.ts(the KPI period, and none without both days).signals-page-viewandcompetitor-open-losseson the scripted model, each with a passing run and a failing one ("these" from the newest page; another competitor's head-to-head); the scenarios' data and thereadOpenItemcheck.page.test.tsx: open by id, all time, its ranked prompts each once, best first; none while reading or after a failed read), a prompt's (new: open, range and its changes, the first 10 Top Sources and the opportunities; none of them while reading), a saved report's (open, its days, no rows), a Site Audit report's (new: open by its page, failing and warning checks in the report's order; none while it runs), a product's (open, 30 days; none while reading, not in the catalog or without Product Visibility), a content opportunity's (new) andOpportunityDetail'sonOpportunity, an AI answer's (new).page-view.test.ts: each item page's pattern and id; lists, words, deeper paths and the Content Editor are none; a product's page keepspromptandplatform, the others no URL key.page-view-scope.test.ts: each item page's open item, block line and note; another id's title dropped and the path's id kept; each page's row kinds and lookups; a key with dashes, neverac-12; another brand's item page keeps its pattern, no open item and no filter.page-scope.test.ts: a topic's page fillstopic_idon the reads that take one (notget_topics_overview); never over the model's own topic, a lookup by ids, another brand's read, or "all topics" / "tüm konularda"; a topic chip wins over the path; no other item's page fills anything, so a prompt's page never makes a ranking a lookup.topic-page-weakeston the scripted model: the model gives no topic, the server fills the path's, and the answer names the topic's weakest prompt; the run that reads another topic fails. Its data: the topic's weakest isn't the brand's.ESLint shows no error on any changed TypeScript file, and no warning on a changed line (one warning stays on the Site Audit report page's existing poll clean-up, line 118, as on
main); Prettier is clean.git merge-tree --write-tree HEAD upstream/main(95aa9c4f7, which includes fix(chat): read the Topics table, Query Fan-outs, a competitor head to head, Overview's map and Opportunities, AI bots and Search Console pages #2466 and feat(chat): customers and revenue from AI visits, with the setup each answer needs #2451) has 5 conflicts, the same as before the detail pages, all already present in the stacked PRs:registry/tools.test.tsandmcp/brand-scope.test.ts, from fix(chat): read what the MCP Server already reads, and keep the two in step #2464 and fix(chat): read Today, your agents and their runs, History over a range, and the Signals summary #2465;testing/agent-eval.ts,agent-eval-data.tsandagent-eval.test.ts, from fix(chat): read the page's view: tab, sort, search and the rows on screen #2463 against feat(chat): customers and revenue from AI visits, with the setup each answer needs #2451.This PR adds its scenarios beside fix(chat): read the page's view: tab, sort, search and the rows on screen #2463's in the same files.
No migration, no new dependency, no lockfile change, no
'use server'file changed.Not in this PR
/brands/[id]/prompts,/topics,/settings: their id is a brand, which the brand chip already carries), an agent's edit form (/agents/[id]/edit: a form; the agent's page sends it), Chat's own pages (the panel is off there), and the paths that only redirect (/topics/[id],/action-center/actions/[id]and/code/[ref])./settings/[section]holds no item.get_reportreads it whole);prompt_idsby itself (see Choices made).list_agent_runsgives no run id).upstream/main: the stacked PRs already conflict with it (see Checks). They are resolved as each one lands.Choices made
The owner accepted step 9's choices; the detail pages add the last five. The owner can change any of them:
list_signalstakes category, impact and source, andget_action_center_kpistakes the period. Signals' platform and search stay words: the page matches them on texts it composes in the browser.keyref, for rows a page names by a key (a KPI, a kind of action). It is taken only on KPIs and History's Scorecard, so a stray word is never a ref on the other pages.view.open, for an item a page holds open outside its URL: Products' drawer by its title, an agent's page, and the open competitor's name.list_my_agents'view, the way a page's search is applied (dropped for "all my agents"). It is the one brand-less read that takes a page's list filters.d9ae7f9b2, and eval row 38 of fix(chat): read the Topics table, Query Fan-outs, a competitor head to head, Overview's map and Opportunities, AI bots and Search Console pages #2466 is now row 39.topic_idon every read of its brand that takes one (prompts, visibility, mentions, citations, competitors), dropped for "all topics". Its prompts are sent best first, each once, without their list's name: with 5 prompts or fewer both lists hold the same ones.prompt_ids: that input makes the read a lookup of that prompt alone, so "our best prompts" asked there would come back with one. The reader is told to read it withprompt_ids.get_report.keyrefs, which may now hold dashes (json-ld-validity): it is the third page that takes keys, beside KPIs and History's Scorecard. Each word starts with a letter, so a code written in lower case (ac-12) is still none.🤖 Generated with Claude Code
https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9