@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 03:37 UTC

main
md 34 lines 2.16 KB
Rendered Raw
1 # Assistant citations
2
3 Citations carry the selected excerpt and source identity in ordinary message text.
4 Drafts, clipboard copies, stashes, and sent messages keep that representation
5 without a separate citation store. The saved quote remains usable when its source
6 disappears or changes. The [shared format](../../packages/shared/src/assistantCitations.ts) uses
7 stable environment IDs without a browser origin, so moving between local, remote,
8 and tunnel connections does not change a citation's identity.
9
10 Source navigation is best effort. [Text selectors](../../apps/web/src/lib/assistantTextSelection.ts)
11 refer to rendered text after whitespace normalization, measured in UTF-16 units.
12 They cannot be applied to raw Markdown. The original excerpt keeps its whitespace;
13 normalization is only for locating it. Repeated text needs an unambiguous context
14 match, even if one occurrence still sits at the saved offsets. Guessing could
15 highlight the wrong claim. Mobile's native selection reports only text, so when a
16 passage repeats within its block the user picks the occurrence, and mobile saves
17 that occurrence's offsets and context like any other selector.
18
19 Released servers and clients reject a citation link with an unknown query key and
20 send or show it unexpanded. Adding a field to the link needs a new link version.
21
22 Navigation owns the highlight's lifetime across virtual-row remounts. The source
23 row must be fetched, unfolded, mounted, and measured before quote positioning
24 takes over from normal timeline scrolling. Remounting must not revive a dismissed
25 highlight. The [navigation hash](../../apps/web/src/lib/assistantCitationNavigation.ts)
26 uses base64url because router normalization otherwise decodes whitespace and
27 source IDs inside the citation URI.
28
29 Expand citations with the [shared formatter](../../packages/shared/src/assistantCitations.ts)
30 before dispatch to a provider adapter. Send the saved excerpt without looking up
31 the source, distinguish quoted reference material from the user's comment, and
32 leave persisted messages in their original form. Input limits apply after
33 expansion as well as before it. A draft that fits as encoded links can exceed the
34 provider limit once expanded.