Repository navigation
feat(session-ui): show titles for referenced session links - #55648
Brendonovich wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
The approach looks sound. I couldn't run it in a browser: the sandbox's Chromium is missing a system library, so the new component tests couldn't start. markdown-session-links.test.ts passes, and typecheck is clean in packages/session-ui and packages/app. I read through the re-render path: a changed set of titles skips the hash shortcut, and streaming blocks are rebuilt and their old renderer cleaned up. It looks right.
Public API is unchanged: sessionTitle is a new optional prop on the internal MarkdownProvider.
This is a visible UI change. Could you add before/after screenshots or a short clip of a session link pill, both with and without a resolved title?
One minor inline note on which IDs get resolved. Nothing blocking.
| export function sessionTitleSignature(html: string, title: MarkdownSessionTitle | undefined) { | ||
| if (!title || !html.includes("ses_")) return "" | ||
|
|
||
| return [...new Set(Array.from(html.matchAll(sessionID), (match) => match[0]))] |
There was a problem hiding this comment.
This matches every ses_… in the block HTML, including IDs inside <pre> code blocks and inside <a> text or hrefs. markSessionLinks never turns those into links. Each of them still calls sessionTitle, which triggers a session.get in the app, and goes into the signature, so the block re-renders (or a streaming block is rebuilt) for a title that is never shown. Gathering IDs from the same nodes markSessionLinks actually links, for example by returning them from it, would keep the two in sync.
Summary
Session IDs in markdown (
ses_…) now show the referenced session's title instead of the raw ID.MarkdownProvideraccepts a reactivesessionTitleresolver. The app fills it from the session store first, then fetches unknown sessions once, without adding them to the shared session list. Archived sessions fall back to the ID.Before / After
Desktop web, 1280×520. An assistant message references two sessions, as plain text and as inline code.
Testing
packages/session-ui:bun typecheckpackages/session-ui:bun test src/components/markdown-session-links.test.ts