Skip to content

refactor(frontend-core): one citation chip grammar for the server and the renderer CU-17tkuw61kfy - #2897

Merged
michaelassraf merged 1 commit into
mainfrom
refactor/citation-chip-grammar
Oct 30, 2026
Merged

michaelassraf merged 1 commit into
mainfrom
refactor/citation-chip-grammar

Conversation

@michaelassraf

@michaelassraf michaelassraf commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

What

  • chat-protocol/citation-chip.ts: the one [N] citation chip grammar, exported from ./chat-protocol:
    • formatCitationChips(numbers): [1][3]
    • stripCitationChips(text): removes chips standing apart from a word, with the space before them
    • citedSourceNumbers(text): the numbers cited, in first-mention order
  • remarkStripCitations and splitCitedSources read it instead of their own regexes.

Why

The hub writes the chips and strips the numbers a model types; the renderer reads and hides them. That was three copies of one grammar (review on multi-platform-hub#1737). The hub moves onto this export once it is released.

Behaviour

  • A removed chip takes the space before it, so the guide [3] covers it reads the guide covers it with no collapse pass.
  • splitCitedSources now reads every number of a comma list ([1, 2]) and ignores an index glued to a word (argv[1]), the rule the renderer already used.

Tests: citation-chip.test.ts, plus the chat suites (979 passed).

Change-Set: feat-mcp-in-app-links

🤖 Generated with Claude Code

Change set flamingo-stack/openframe-oss-lib#2870: these pull requests are one change, reviewed together.

Linked work

Linked by the Depends-On / Change-Set lines in these descriptions; this block is maintained by the hub.

… the renderer CU-17tkuw61kfy

The [N] chip grammar lived in two readers here (the strip of cited sources and
the renderer that hides chips) and a third copy in the hub that writes them.
chat-protocol/citation-chip.ts is now the one definition: formatCitationChips,
stripCitationChips and citedSourceNumbers. A removed chip takes the space before
it, so no doubled space is left to collapse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@michaelassraf

Copy link
Copy Markdown
Member Author

@github-actions

Copy link
Copy Markdown
Contributor

🦩 Flamingo Code Review

Not reviewed yet. Reviews start when you ask, so the reviewer reads this pull request when it is ready, not when it is opened.

When it is ready:

  • Review this pull request

Or comment @flamingo-review. Add the flamingo-review-always label to review every push.

Updated 2026-10-30 14:32 UTC · workflow run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant