Skip to content

Commit 40bb8ee

Browse files
committed
chore(chatbot): declare the new exports as a widening; say what the allow-list drives
Claude-Session: https://claude.ai/code/session_01Utp6CY3qzEGtLEnwjFyRXG Co-authored-by: Claude <noreply@anthropic.com>
1 parent e2833f9 commit 40bb8ee

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

‎.changeset/37487-citations-survive-reload.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
fix(chatbot): an answer's record-citation chips are drawn again after a reload or when a conversation is reopened, and a navigation on the cited record no longer scrolls back to the cited heading
77

8-
Clause-②: no
8+
Clause-②: yes (widening)
99
Metadata-protocol: none
1010

11-
The history rebuild of the `/ai` page, the console's browser-side message cache and the `useObjectChat` store rebuild kept only an answer's charts, so a persisted `data-record-citations` part was not drawn again after a reload. All three now keep the data parts named by one allow-list, `STORED_ANSWER_DATA_PARTS` (charts and record citations), written by `storedAnswerParts` and read back by `storedAnswerData`. The citations list comes back as it was persisted: it is read through the same `RecordCitationsSchema` parse as a live part, so a list the schema refuses still draws nothing, and nothing is verified again.
11+
The history rebuild of the `/ai` page, the console's browser-side message cache and the `useObjectChat` store rebuild kept only an answer's charts, so a persisted `data-record-citations` part was not drawn again after a reload. All three now keep the data parts named by one allow-list, `STORED_ANSWER_DATA_PARTS` (charts and record citations), written by `storedAnswerParts` and read back by `storedAnswerData`. `@object-ui/plugin-chatbot` exports five new names: `storedAnswerParts`, `STORED_ANSWER_DATA_PARTS` and the types `StoredAnswerData` and `StoredAnswerPart` from the package root and from `@object-ui/plugin-chatbot/core`, and `storedAnswerData` from the package root. The citations list comes back as it was persisted: it is read through the same `RecordCitationsSchema` parse as a live part, so a list the schema refuses still draws nothing, and nothing is verified again.
1212

1313
A record opened from a chip (`?section=ANCHOR`) scrolls to the cited heading once per click. A navigation that drops the history state, such as the command palette or a record form opened over the page and closed with Back, no longer counts as a new click, so the page stays where the reader scrolled it.

‎ui/packages/plugin-chatbot/src/mapMessages.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -863,8 +863,8 @@ export function extractRecordCitations(parts: readonly AnyPart[]): RecordCitatio
863863
/**
864864
* objectstack#37487 — the reading half of `STORED_ANSWER_DATA_PARTS`: every
865865
* kept data part of a stored message, read back into the message fields the
866-
* chat draws. A history or cache rebuild calls this once, so a part added to
867-
* the allow-list is read wherever it is written. The citations list is taken
866+
* chat draws. A history or cache rebuild calls this once; a part added to the
867+
* allow-list is read here, beside its write in `storedAnswerParts`. The citations list is taken
868868
* as persisted (ruling Q1): parsed through the contract, never verified again.
869869
*/
870870
export function storedAnswerData(parts: readonly AnyPart[]): {

‎ui/packages/plugin-chatbot/src/toolResultParsers.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,13 @@ export function chartAnswerParts(
313313
* (progress frames, build trees) and is not kept. Keyed by the message field
314314
* that carries the part's payload between rebuilds.
315315
*
316+
* The table names the kept parts; it does not drive the code. A further kept
317+
* part takes three edits: an entry here, its write in
318+
* {@link storedAnswerParts}, and its read in `storedAnswerData`.
319+
*
316320
* `recordCitations` is spelled here rather than imported so this eager module
317321
* stays free of `@objectstack/spec/ai` and the schemas it loads;
318-
* `storedAnswerParts.recordCitations-37487.test.ts` pins it to the spec's
322+
* `useObjectChat.recordCitationsReload-37487.test.tsx` pins it to the spec's
319323
* `RECORD_CITATIONS_PART_TYPE`.
320324
*/
321325
export const STORED_ANSWER_DATA_PARTS = {

0 commit comments

Comments
 (0)