Skip to content

Private AI meeting notes that stay on your computer. No meeting bot. Free and open source for Mac, Windows and Linux. An alternative to Granola, Otter and Fireflies.

Ask: sources show as the meeting's name in a pill, once per paragraph, with a compact quote card

Eric Brownroutc1e7ceb9499f
diff --git a/app/e2e/askContext.spec.ts b/app/e2e/askContext.spec.ts
index 1f3d0edd..ad25c9b6 100644
--- a/app/e2e/askContext.spec.ts
+++ b/app/e2e/askContext.spec.ts
@@ -86,7 +86,30 @@ test('the note panel and full conversation expose Rename and a single Delete con
await expect(page.getByTestId('chat-turn')).toHaveAttribute('data-status', 'done', { timeout: 15_000 })
const citation = page.getByTestId('source-citation').first()
await citation.hover()
- await expect(page.getByTestId('citation-card')).toBeVisible()
+ const card = page.getByTestId('citation-card')
+ await expect(card).toBeVisible()
+ const popup = await card.boundingBox()
+ expect(popup).not.toBeNull()
+ // Travel diagonally through the gap into the card, then leave both surfaces.
+ await page.mouse.move(popup!.x + popup!.width - 20, popup!.y + popup!.height / 2, { steps: 12 })
+ await expect(card).toBeVisible()
+ await page.getByTestId('chat-input').hover()
+ await expect(card).toHaveCount(0)
+ await citation.hover()
+ await expect(card).toBeVisible()
+ // Regression for Base UI's 500ms patient-click threshold.
+ await page.waitForTimeout(600)
+ await citation.click()
+ await expect(citation).toHaveAttribute('aria-pressed', 'true')
+ await page.getByTestId('chat-input').hover()
+ await expect(card).toBeVisible()
+ await citation.click()
+ await expect(card).toHaveCount(0)
+ await citation.click()
+ await page.getByTestId('chat-input').click()
+ await expect(card).toHaveCount(0)
+ await citation.hover()
+ await expect(card).toBeVisible()
await page.keyboard.press('Escape') // The composer still has focus after hover.
await expect(page.getByTestId('citation-card')).toHaveCount(0)
await expect(page.getByTestId('chat-panel')).toBeVisible()
@@ -97,6 +120,15 @@ test('the note panel and full conversation expose Rename and a single Delete con
await expect(page.getByTestId('citation-open')).toBeFocused()
await page.keyboard.press('Escape')
await expect(citation).toBeFocused()
+ await expect(card).toHaveCount(0)
+ await page.keyboard.press('Enter')
+ await expect(citation).toHaveAttribute('aria-pressed', 'true')
+ await page.keyboard.press('Enter')
+ await expect(card).toHaveCount(0)
+ await page.keyboard.press('Space')
+ await expect(citation).toHaveAttribute('aria-pressed', 'true')
+ await page.keyboard.press('Escape')
+ await expect(card).toHaveCount(0)
await expect(page.getByTestId('chat-panel')).toBeVisible()
await page.getByTestId('chat-menu').click()
await page.getByTestId('chat-rename').click()
diff --git a/app/e2e/libraryChat.spec.ts b/app/e2e/libraryChat.spec.ts
index c6898dca..be215fe9 100644
--- a/app/e2e/libraryChat.spec.ts
+++ b/app/e2e/libraryChat.spec.ts
@@ -36,12 +36,14 @@ test('asking across meetings from Chat: the answer streams in with sources that
await expect(page.getByTestId('chat-page-answer').locator('.fw').first()).toBeVisible()
await expect(turn).toHaveAttribute('data-status', 'done', { timeout: 15_000 })
await expect(page.getByTestId('chat-page-answer')).toContainText('Pricing call')
- // Numbered marks reveal the retrieved source without leaving the answer.
+ // Meeting pills reveal the supporting quote without leaving the answer.
const chip = page.getByTestId('source-citation').first()
- await expect(chip).toHaveText('1')
+ await expect(chip).toHaveText('Pricing call')
await expect(chip).toHaveAccessibleName(/Pricing call/)
await chip.hover()
- await expect(page.getByTestId('citation-excerpt')).toContainText('Twenty dollars a seat')
+ await expect(page.getByTestId('citation-excerpt')).toContainText('How much would fifty seats be?')
+ await expect(page.getByTestId('citation-excerpt')).toContainText('Twenty dollars a seat, billed yearly.')
+ await expect(page.getByTestId('citation-card')).toHaveCSS('min-width', '280px')
await expect(page.getByTestId('chat-page-answer')).not.toContainText('[1]')
// the chat is saved, named after the question, and the address is its own
expect((await page.evaluate(() => window.yogurt.conversations.list()))[0].title).toBe('Who said twenty dollars?')
@@ -66,10 +68,10 @@ test('asking across meetings from Chat: the answer streams in with sources that
await expect(page.getByTestId('chat-page-turn')).toHaveAttribute('data-status', 'done')
await page.reload()
await expect(page.getByTestId('chat-page-answer')).toContainText('Pricing call')
- await expect(page.getByTestId('source-citation').first()).toHaveText('1')
+ await expect(page.getByTestId('source-citation').first()).toHaveText('Pricing call')
await page.keyboard.press('Tab')
await page.getByTestId('source-citation').first().focus()
- await expect(page.getByTestId('citation-excerpt')).toContainText('Twenty dollars a seat')
+ await expect(page.getByTestId('citation-excerpt')).toContainText('How much would fifty seats be?')
await page.keyboard.press('Tab')
await expect(page.getByTestId('citation-open')).toBeFocused()
await page.keyboard.press('Escape')
@@ -108,11 +110,11 @@ test('a follow-up stays in the chat; New chat starts another; chats can be renam
await page.getByTestId('chat-page-input').fill('What are my next steps?')
await page.getByTestId('chat-page-input').press('Enter')
await expect(page.getByTestId('chat-page-turn')).toHaveAttribute('data-status', 'done', { timeout: 15_000 })
- // The bubble treatment distinguishes Notes from timestamped transcript sources.
- await expect(page.getByTestId('source-citation').first()).toHaveText('1')
+ // The compact preview leads with the meeting and the supporting quote.
+ await expect(page.getByTestId('source-citation').first()).toHaveText('Pricing call')
await expect(page.getByTestId('source-citation').first()).toHaveAccessibleName(/Pricing call/)
await page.getByTestId('source-citation').first().hover()
- await expect(page.locator('.citation-footer')).toContainText('Notes')
+ await expect(page.locator('.citation-heading')).toContainText('Pricing call')
await expect(page.getByTestId('citation-open')).toBeVisible()
await page.keyboard.press('Escape')
const input = page.getByTestId('chat-page-input')
diff --git a/app/src/renderer/src/components/AnswerText.tsx b/app/src/renderer/src/components/AnswerText.tsx
index 17bd81be..17f1969d 100644
--- a/app/src/renderer/src/components/AnswerText.tsx
+++ b/app/src/renderer/src/components/AnswerText.tsx
@@ -1,4 +1,4 @@
-import { Fragment, useId, useMemo, useRef, useState, type ReactNode } from 'react'
+import { Fragment, useId, useLayoutEffect, useMemo, useRef, useState, type ReactNode } from 'react'
import { Popover } from '@base-ui/react/popover'
import type { LibrarySource } from '../../../shared/types'
import type { PMNode } from '../../../shared/markdown'
@@ -14,8 +14,9 @@ export function AnswerText({ md, live, sources, onSource }: {
onSource: (s: LibrarySource, match?: string) => void
}) {
const id = useId(), [open, setOpen] = useState(false), [triggerId, setTriggerId] = useState<string | null>(null)
- const [animate, setAnimate] = useState(false)
+ const [pinned, setPinned] = useState<string | null>(null)
const suppressed = useRef<string | null>(null)
+ const actions = useRef<Popover.Root.Actions>(null)
const doc = useMemo(() => {
const doc = citationDoc(md, sources, live)
const prepare = (node: PMNode) => {
@@ -26,50 +27,69 @@ export function AnswerText({ md, live, sources, onSource }: {
prepare(doc)
return doc
}, [md, sources, live])
- const ctx: Ctx = { live, at: { n: 0 }, id, sources, focus: (element) => {
+ useLayoutEffect(() => {
+ // A later streamed citation can replace the pill that owns the current preview.
+ if (triggerId && !document.getElementById(triggerId)) {
+ setPinned(null)
+ if (open) actions.current?.close()
+ else { actions.current?.unmount(); setTriggerId(null) }
+ }
+ }, [doc, open, triggerId])
+ const ctx: Ctx = { live, at: { n: 0 }, id, sources, pinned, focus: (element) => {
if (!element.matches(':focus-visible')) return
if (suppressed.current === element.id) { suppressed.current = null; return }
- setAnimate(false); setTriggerId(element.id); setOpen(true)
- }, blur: () => { suppressed.current = null }, activate: element => { suppressed.current = null; setAnimate(false); setTriggerId(element.id); setOpen(true) },
+ setPinned(null); setTriggerId(element.id); setOpen(true)
+ }, blur: () => { suppressed.current = null },
dismiss: element => {
if (!open || triggerId !== element.id) return false
- setOpen(false)
+ setPinned(null); setOpen(false)
return true
} }
- return <Popover.Root<{ source: LibrarySource; sentence: string }> open={open} triggerId={triggerId} onOpenChange={(next, details) => {
- if (!next && details.reason === 'trigger-press' && 'detail' in details.event && details.event.detail === 0) { details.cancel(); return }
+ return <Popover.Root<{ source: LibrarySource; sentence: string }> actionsRef={actions} open={open} triggerId={triggerId} onOpenChange={(next, details) => {
+ const trigger = triggerId ? document.getElementById(triggerId) : null
+ const popup = document.getElementById(trigger?.getAttribute('aria-controls') ?? '')
+ const focused = open && (trigger === document.activeElement || !!popup?.contains(document.activeElement))
+ if (details.reason === 'trigger-hover' && (pinned || focused && (!next || details.trigger?.id !== triggerId))) { details.cancel(); return }
+ if (!next && details.reason === 'focus-out' && (pinned || trigger?.matches(':hover') || popup?.matches(':hover'))) { details.cancel(); return }
+ if (details.reason === 'trigger-press') {
+ // Base UI lets a patient click close a hover preview; our first click always pins it.
+ const pin = pinned !== details.trigger?.id
+ if (next !== pin) details.cancel()
+ setPinned(pin ? details.trigger?.id ?? triggerId : null)
+ next = pin
+ } else if (!next) setPinned(null)
if (details.reason === 'escape-key' && document.activeElement?.closest('.citation-card')) {
suppressed.current = triggerId
if (triggerId) document.getElementById(triggerId)?.focus({ preventScroll: true })
}
if (next) {
- if (!open || details.trigger?.id !== triggerId) setAnimate(details.reason === 'trigger-hover' || (details.reason === 'trigger-press' && 'detail' in details.event && details.event.detail > 0))
setTriggerId(details.trigger?.id ?? triggerId)
}
setOpen(next)
}}>{({ payload }) => { ctx.at.n = 0; return <>
{(doc.content ?? []).map(n => render(n, ctx))}
- {payload && <SourceCitationCard key={triggerId} source={payload.source} sentence={payload.sentence} triggerId={triggerId} animate={animate} onOpen={match => { setOpen(false); onSource(payload.source, match) }} />}
+ {payload && <SourceCitationCard key={triggerId} source={payload.source} sentence={payload.sentence} triggerId={triggerId} animate onOpen={match => { setPinned(null); setOpen(false); onSource(payload.source, match) }} />}
</> }}</Popover.Root>
}
-type Ctx = { live: boolean; at: { n: number }; id: string; sources: LibrarySource[]; focus: (element: HTMLElement) => void; blur: () => void; activate: (element: HTMLElement) => void; dismiss: (element: HTMLElement) => boolean }
+type Ctx = { live: boolean; at: { n: number }; id: string; sources: LibrarySource[]; pinned: string | null; focus: (element: HTMLElement) => void; blur: () => void; dismiss: (element: HTMLElement) => boolean }
function render(node: PMNode, c: Ctx): ReactNode {
const key = `${node.type}-${c.at.n}`
if (node.type === 'citation') {
c.at.n += Number(node.attrs?.length ?? 0)
+ if (!(node.attrs!.marks as CitationMark[]).length) return null
return <span className="citation-group" data-gap={node.attrs!.gap || undefined} data-single={(node.attrs!.marks as CitationMark[]).length === 1 || undefined} key={key}>{(node.attrs!.marks as CitationMark[]).map((mark, i) => {
const source = c.sources.find(s => s.n === mark.source)!
const title = source.title || t('Untitled')
- return <Popover.Trigger key={mark.source} id={`${c.id}-${key}-${mark.source}`} payload={(node.attrs!.payloads as Array<{ source: LibrarySource; sentence: string }>)[i]} openOnHover delay={100} closeDelay={180}
+ const id = `${c.id}-${key}-${mark.source}`
+ return <Popover.Trigger key={mark.source} id={id} payload={(node.attrs!.payloads as Array<{ source: LibrarySource; sentence: string }>)[i]} openOnHover delay={120} closeDelay={180} aria-pressed={c.pinned === id}
className="source-citation" data-testid="source-citation" data-meeting={source.meetingId} data-at={source.atMs ?? undefined}
- aria-label={`${mark.number}: ${title} · ${dayLabel(source.startedAt)}`} onFocus={e => c.focus(e.currentTarget)} onBlur={c.blur} onKeyDown={e => {
- if (e.key === 'Enter') { e.preventDefault(); c.activate(e.currentTarget) }
+ aria-label={`${title} · ${dayLabel(source.startedAt)}`} onFocus={e => c.focus(e.currentTarget)} onBlur={c.blur} onKeyDown={e => {
// Consume Escape before the containing note panel handles it.
if (e.key === 'Escape' && c.dismiss(e.currentTarget)) { e.preventDefault(); e.stopPropagation() }
}}>
- {mark.number}
+ <span className="source-name">{title}</span>
</Popover.Trigger>
})}</span>
}
diff --git a/app/src/renderer/src/components/SourceCitation.tsx b/app/src/renderer/src/components/SourceCitation.tsx
index fe665a20..1956c7c3 100644
--- a/app/src/renderer/src/components/SourceCitation.tsx
+++ b/app/src/renderer/src/components/SourceCitation.tsx
@@ -1,25 +1,17 @@
-import { useId, useLayoutEffect, useRef, useState, type CSSProperties, type ReactNode } from 'react'
+import { useId, useLayoutEffect, useRef, type CSSProperties } from 'react'
import { Popover } from '@base-ui/react/popover'
import { ArrowUpRight } from 'lucide-react'
import type { LibrarySource } from '../../../shared/types'
import { language, t } from '../../../shared/i18n'
-import { clock, turns } from '../../../shared/transcript'
import { surfaceMotion, useReducedMotion } from '../motion'
-import { citationPassage } from '../../../shared/citations'
-import { citationCardPassage, citationLineWindow } from '../../../shared/citationCard'
-import { InlineText } from './InlineText'
-import type { PMNode } from '../../../shared/markdown'
-
-const CITATION_BUBBLES = true
+import { citationCardPassage } from '../../../shared/citationCard'
/** Only the decorative mass is filtered. The excerpt is the retrieved text, never generated by the answer. */
export function SourceCitationCard({ source, sentence, triggerId, animate, onOpen }: {
source: LibrarySource; sentence: string; triggerId: string | null; animate: boolean; onOpen: (match: string) => void
}) {
const filterId = useId().replace(/:/g, ''), popup = useRef<HTMLDivElement>(null)
- const passage = citationPassage(source.excerpt ?? '', sentence)
const preview = citationCardPassage(source, sentence)
- const bubble = CITATION_BUBBLES
const reduced = useReducedMotion()
const anchor = triggerId ? document.getElementById(triggerId) : null
const title = source.title || t('Untitled')
@@ -33,7 +25,7 @@ export function SourceCitationCard({ source, sentence, triggerId, animate, onOpe
if (!card || !anchor) return
const a = anchor.getBoundingClientRect(), b = card.getBoundingClientRect()
const x = a.left + a.width / 2 - b.left, y = a.top + a.height / 2 - b.top
- // Start outside the trigger so the neutral surface never paints over the purple number.
+ // Start outside the trigger so the neutral surface never paints over the source pill.
const vars = { 'from-x': `${x - 9}px`, 'from-y': `${y > b.height / 2 ? y - a.height / 2 - 18 : y + a.height / 2}px`,
'from-sx': 18 / b.width, 'from-sy': 18 / b.height }
for (const [key, value] of Object.entries(vars)) card.style.setProperty(`--${key}`, String(value))
@@ -53,120 +45,14 @@ export function SourceCitationCard({ source, sentence, triggerId, animate, onOpe
<div className="citation-content">
<div className="citation-heading">
<Popover.Title className="citation-title" title={title}>{title}</Popover.Title>
- <time className="citation-date" dateTime={date.toISOString()} title={fullDate}>{date.toLocaleDateString(language(), { month: 'short', day: 'numeric' })}</time>
+ <span aria-hidden="true">·</span><time className="citation-date" dateTime={date.toISOString()} title={fullDate}>{date.toLocaleDateString(language(), { month: 'short', day: 'numeric' })}</time>
</div>
- {bubble ? preview.match.text && (preview.kind === 'transcript' ? <TranscriptPassage key={JSON.stringify(preview.lines) + preview.matchedLine} preview={preview} /> : <NotesPassage preview={preview} />) : passage.match && <Passage key={passage.match + passage.before} passage={passage} />}
- <div className="citation-footer"><span>{source.atMs !== null ? <>{t('Transcript')} · {clock(bubble ? preview.match.atMs ?? source.atMs : source.atMs)}</> : t('Notes')}</span>
- <button className="citation-open" data-testid="citation-open" aria-label={t('Open {source}', { source: title })} onClick={() => onOpen(bubble ? preview.match.text : passage.match)}>{t('Open')}<ArrowUpRight size={12} aria-hidden="true" /></button>
+ {preview.match.text && <blockquote className="citation-quote" data-testid="citation-excerpt" dir="auto"><q>{preview.before.text && <span className="citation-context">{preview.before.text} </span>}<span className="citation-match">{preview.match.text}</span>{preview.after.text && <span className="citation-context"> {preview.after.text}</span>}</q></blockquote>}
+ <div className="citation-footer">
+ <button className="citation-open" data-testid="citation-open" aria-label={t('Open {source}', { source: title })} onClick={() => onOpen(preview.match.text)}>{t('Open')}<ArrowUpRight size={12} aria-hidden="true" /></button>
</div>
</div>
</Popover.Popup>
</Popover.Positioner>
</Popover.Portal>
}
-
-function TranscriptPassage({ preview }: { preview: ReturnType<typeof citationCardPassage> }) {
- const ref = useRef<HTMLDivElement>(null)
- const [window, setWindow] = useState({ start: 0, end: preview.lines.length })
- const [width, setWidth] = useState(0)
- useLayoutEffect(() => {
- const root = ref.current!
- const fit = () => {
- const heights: number[] = []
- for (const line of root.querySelectorAll<HTMLElement>('[data-citation-line]')) {
- const text = line.querySelector<HTMLElement>('.citation-lines')!
- heights.push(Math.ceil(text.scrollHeight / parseFloat(getComputedStyle(text).lineHeight)))
- }
- const fitted = citationLineWindow(heights, preview.matchedLine - window.start)
- const next = { start: window.start + fitted.start, end: window.start + fitted.end }
- setWindow(old => old.start === next.start && old.end === next.end ? old : next)
- }
- fit()
- }, [width, window.start, window.end])
- useLayoutEffect(() => {
- const root = ref.current!
- let previous = root.clientWidth
- const observer = new ResizeObserver(() => {
- if (root.clientWidth === previous) return
- previous = root.clientWidth
- setWindow({ start: 0, end: preview.lines.length }); setWidth(previous)
- })
- observer.observe(root)
- return () => observer.disconnect()
- }, [])
- return <div ref={ref} className="citation-passage citation-transcript" data-testid="citation-excerpt">
- {turns(preview.lines.slice(window.start, window.end)).map(turn => {
- const first = turn[0], me = first.track === 'me', named = me || !!first.speaker
- return <div key={first.index} className="transcript-turn" data-track={first.track}>
- {named && <span className="line-who citation-speaker" data-folder-color={first.color}>{me ? t('You') : first.speaker}</span>}
- {turn.map((line, i) => <p key={line.index} data-citation-line={line.index} data-citation-part={line.index === preview.matchedLine ? 'match' : 'context'} data-track={line.track} dir="auto"
- className={`bubble bubble-${line.track}`} data-continuation={!named || i > 0 || undefined}>
- <span className="citation-lines" style={{ WebkitLineClamp: 6 }}>{line.index === window.start && window.start > 0 && '… '}{line.text}{line.index === window.end - 1 && window.end < preview.lines.length && ' …'}</span>
- </p>)}
- </div>
- })}
- </div>
-}
-
-export function NotesPassage({ preview }: { preview: ReturnType<typeof citationCardPassage> }) {
- const ref = useRef<HTMLDivElement>(null)
- useLayoutEffect(() => {
- const root = ref.current!
- const fit = () => {
- const parts = [...root.querySelectorAll<HTMLElement>('[data-citation-part]')]
- const natural = new Map(parts.map(part => {
- part.hidden = false
- const text = part.querySelector<HTMLElement>('.citation-lines')!
- text.style.webkitLineClamp = 'unset'
- return [part.dataset.citationPart!, Math.ceil(text.scrollHeight / parseFloat(getComputedStyle(text).lineHeight))]
- }))
- const match = Math.min(6, natural.get('match') ?? 0), remaining = 6 - match
- const before = Math.min(2, natural.get('before') ?? 0, Math.floor(remaining / (natural.has('after') ? 2 : 1)))
- const after = Math.min(2, natural.get('after') ?? 0, remaining - before)
- for (const part of parts) {
- const count = part.dataset.citationPart === 'match' ? match : part.dataset.citationPart === 'before' ? before : after
- part.hidden = count === 0
- part.querySelector<HTMLElement>('.citation-lines')!.style.webkitLineClamp = String(count)
- }
- }
- fit()
- const observer = new ResizeObserver(fit)
- observer.observe(root)
- return () => observer.disconnect()
- }, [preview])
- const render = (node: PMNode, key: number): ReactNode => {
- if (node.type === 'citationPart') return <div key={key} data-citation-part={String(node.attrs!.part)}>
- <p className="citation-lines"><span className={node.attrs!.part === 'match' ? 'citation-match' : undefined}>{node.content?.map((n, i) => <InlineText key={i} marks={n.marks}>{n.text}</InlineText>)}</span></p>
- </div>
- const children = node.content?.map(render)
- if (node.type === 'bulletList') return <ul key={key}>{children}</ul>
- if (node.type === 'orderedList') return <ol key={key} start={Number(node.attrs?.start ?? 1)}>{children}</ol>
- return <li key={key} value={node.attrs?.value as number | undefined}>{children}</li>
- }
- return <div ref={ref} className="citation-passage citation-notes" data-testid="citation-excerpt">{preview.notes.map(render)}</div>
-}
-
-/** Preserve the match when a long preceding sentence would consume the six-line preview. */
-function Passage({ passage }: { passage: ReturnType<typeof citationPassage> }) {
- const ref = useRef<HTMLQuoteElement>(null), match = useRef<HTMLSpanElement>(null)
- const [before, setBefore] = useState(true)
- useLayoutEffect(() => {
- const element = ref.current!, selected = match.current!
- const fit = () => {
- const context = element.firstElementChild as HTMLElement
- context.hidden = false
- const fits = selected.getBoundingClientRect().bottom - element.getBoundingClientRect().top <= 120
- context.hidden = !fits
- setBefore(fits)
- }
- fit()
- const observer = new ResizeObserver(fit)
- observer.observe(element)
- return () => observer.disconnect()
- }, [])
- return <blockquote ref={ref} className="citation-excerpt" data-testid="citation-excerpt">
- <span hidden={!before}>{passage.before && passage.before + ' '}</span>
- <span ref={match} className="citation-match">{passage.match}</span>
- {passage.after && ' ' + passage.after}
- </blockquote>
-}
diff --git a/app/src/renderer/src/workspace.css b/app/src/renderer/src/workspace.css
index c77f25a2..fe8f5b94 100644
--- a/app/src/renderer/src/workspace.css
+++ b/app/src/renderer/src/workspace.css
@@ -293,54 +293,36 @@
.app-toast-close:hover { color:var(--ink);background:var(--control); }
.app-toast button:focus-visible { outline:2px solid var(--focus);outline-offset:2px; }
-/* Citations: numbered marks, with only the surface joining through goo. */
+/* Meeting source pills, with only the preview surface joining through goo. */
.citation-anchor { white-space:nowrap; }
-.citation-group { display:inline-flex;align-items:baseline;gap:1px;position:relative;top:-1ex;vertical-align:baseline;line-height:0;white-space:nowrap; }
-.citation-group[data-gap] { margin-inline-start:.18em; }
-.source-citation { display:inline-flex;align-items:center;justify-content:center;position:relative;height:1em;padding:0;border:0;border-radius:5px;background:transparent;color:var(--accent);font-size:.68em;font-weight:500;line-height:1;letter-spacing:1px; }
-/* A lone mark keeps a generous pointer target without adding space to the sentence. */
-.source-citation::before { content:"";position:absolute;inset:-6px 0; }
-.citation-group[data-single] .source-citation::before { inset:-6px -9px; }
+.citation-group { display:inline-flex;align-items:baseline;gap:4px;position:relative;vertical-align:baseline;line-height:1;margin-inline:2px 0;white-space:nowrap; }
+/* The folder-chip shape fits inside the answer line; its invisible target stays 24px high. */
+.source-citation { display:inline-flex;align-items:center;justify-content:center;position:relative;height:18px;max-width:180px;padding:0 7px;border:1px solid var(--line);border-radius:999px;background:var(--card);color:var(--written);font-size:13px;font-weight:400;line-height:16px;letter-spacing:0; }
+.source-name { min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
+.source-citation::before { content:"";position:absolute;top:50%;left:50%;width:max(100%,24px);height:max(100%,24px);transform:translate(-50%,-50%); }
+.citation-anchor:has(.citation-group:not([data-single])) { white-space:normal; }
+.citation-group:not([data-single]) { display:inline;white-space:normal; }
+/* Focus guards may sit between triggers; their insertion must not change the gap. */
+.citation-group:not([data-single]) .source-citation~.source-citation { margin-inline-start:4px; }
+.source-citation:hover,.source-citation[aria-expanded=true] { background:var(--accent-soft);border-color:color-mix(in srgb,var(--accent) 20%,var(--line));color:var(--ink); }
.source-citation:focus-visible { outline:2px solid var(--focus);outline-offset:1px; }
.citation-positioner { z-index:100; }
.citation-positioner[data-anchor-hidden] { visibility:hidden;pointer-events:none; }
-.citation-card { position:relative;isolation:isolate;width:380px;max-width:calc(100vw - 24px);color:var(--ink);text-align:start;font-size:13px;line-height:1.5;letter-spacing:-.012em;transition:opacity 160ms ease-out;outline:none; }
+.citation-card { position:relative;isolation:isolate;width:fit-content;min-width:min(280px,calc(100vw - 24px));max-width:min(400px,calc(100vw - 24px));color:var(--ink);text-align:start;font-size:14px;line-height:1.5;letter-spacing:-.012em;transition:opacity 160ms ease-out;outline:none; }
.citation-card[data-animate=false] { transition:none; }
.citation-card[data-ending-style] { opacity:0; }
.citation-filter { position:absolute;pointer-events:none; }
.citation-liquid,.citation-edge { position:absolute;inset:0;z-index:-1;pointer-events:none; }
.citation-mass { position:absolute;inset:0;border-radius:12px;background:var(--float);transform-origin:0 0; }
.citation-edge { border:1px solid var(--line);border-radius:12px;box-shadow:var(--shadow-soft); }
-.citation-content { padding:12px; }
-.citation-heading { display:flex;align-items:baseline;justify-content:space-between;gap:10px;line-height:18px; }
-.citation-title { min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin:0;font-size:13px;line-height:18px;font-weight:600; }
-.citation-date { flex:none;font-size:10px;color:var(--muted);white-space:nowrap; }
-.citation-excerpt { display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:6;margin:8px 0 0;color:var(--muted);font-size:13px;line-height:20px;overflow-wrap:anywhere;max-height:120px;overflow:clip; }
-.citation-match { color:var(--ink); }
-.citation-passage { margin-top:8px;color:var(--muted); }
-.citation-passage [hidden] { display:none!important; }
-.citation-lines { display:-webkit-box;-webkit-box-orient:vertical;overflow:clip;overflow-wrap:anywhere; }
-.citation-transcript { margin-top:12px;display:flex;flex-direction:column;gap:6px; }
-.citation-transcript .transcript-turn { display:flex;flex-direction:column;align-items:flex-start;gap:5px; }
-.citation-transcript .transcript-turn[data-track=me] { align-items:flex-end; }
-.citation-transcript .bubble { margin:0; }
-.citation-transcript .bubble+.bubble { margin-top:1px; }
-.citation-transcript .bubble:not([data-continuation]) { width:85%; }
-.citation-transcript .bubble[data-continuation] { margin-inline:12px; }
-.citation-speaker { padding-inline:4px;font-size:12px;font-weight:500;line-height:18px; }
-.citation-notes { font-size:13px;line-height:20px; }
-.citation-notes p { margin:0; }
-.citation-notes ul,.citation-notes ol { margin:0;padding-inline-start:18px; }
-.citation-notes ul { list-style-type:disc; }
-.citation-notes ol { list-style-type:decimal; }
-.citation-notes li+li { margin-top:4px; }
-.citation-notes li:not(:has([data-citation-part]:not([hidden]))) { display:none; }
-.citation-notes [data-citation-part]+[data-citation-part] { margin-top:8px; }
-.citation-notes .citation-match { background:color-mix(in srgb,var(--accent) 10%,transparent);border-radius:3px;box-decoration-break:clone;-webkit-box-decoration-break:clone; }
-.citation-notes code { font-size:.92em; }
-.citation-footer { display:flex;align-items:center;justify-content:flex-end;gap:12px;margin-top:8px;font-size:11px;color:var(--muted); }
-.citation-footer>span { margin-inline-end:auto; }
-.citation-open { display:inline-flex;align-items:center;gap:5px;height:24px;padding:2px 5px;border-radius:4px;background:transparent;color:var(--muted);font-size:11px;line-height:20px; }
+.citation-content { padding:12px 14px; }
+.citation-heading { display:flex;align-items:baseline;justify-content:flex-start;gap:6px;min-width:0;color:var(--muted);font-size:12px;line-height:18px; }
+.citation-title { flex:0 1 auto;min-width:0;max-width:260px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin:0;color:var(--muted);font-size:12px;line-height:18px;font-weight:400; }
+.citation-date { flex:none;font-size:12px;line-height:18px;white-space:nowrap; }
+.citation-quote { margin:8px 0;color:var(--ink);font-size:14px;line-height:21px;font-weight:400;letter-spacing:0;overflow-wrap:anywhere;max-height:min(320px,calc(100vh - 160px));overflow:auto; }
+.citation-context { color:var(--written); }
+.citation-footer { display:flex;align-items:center;justify-content:flex-end;margin:4px 0 0;font-size:11px;color:var(--muted); }
+.citation-open { display:inline-flex;align-items:center;gap:5px;height:24px;padding:2px 4px;border-radius:4px;background:transparent;color:var(--muted);font-size:11px;line-height:20px; }
.citation-open:hover { background:var(--control-hover);color:var(--ink); }
.citation-open:active { background:var(--control-pressed); }
.citation-open:focus-visible { outline:2px solid var(--focus);outline-offset:2px; }
diff --git a/app/src/shared/citations.ts b/app/src/shared/citations.ts
index e82376ce..bc1fe9bb 100644
--- a/app/src/shared/citations.ts
+++ b/app/src/shared/citations.ts
@@ -44,7 +44,7 @@ const TERMINAL = /[.!?…](?=$|[\s"'”’)\]]|\p{Lu})/u
const CLOSING = /^[ \t]*([.!?…"'”’)\]]+)/u
/** Move only sentence punctuation, retaining the Markdown marks on the text it came from. */
-function placeCitations(nodes: PMNode[], pending: boolean): PMNode[] {
+function placeCitations(nodes: PMNode[], pending: boolean, meetings?: Map<number, string>): PMNode[] {
const out: PMNode[] = []
for (let i = 0; i < nodes.length; i++) {
const node = nodes[i]
@@ -82,6 +82,16 @@ function placeCitations(nodes: PMNode[], pending: boolean): PMNode[] {
if (node.type === 'citation') node.attrs!.sentence = sentences.find(s => offset > s.index && offset <= s.end)?.text ?? ''
offset += node.text?.length ?? 0
}
+ if (meetings) {
+ const last = new Map<string, CitationMark>()
+ for (const node of out) if (node.type === 'citation') {
+ for (const mark of node.attrs!.marks as CitationMark[]) last.set(meetings.get(mark.source)!, mark)
+ }
+ for (const node of out) if (node.type === 'citation') {
+ // Keep empty marks as offsets so streamed word keys do not change when a pill moves.
+ node.attrs!.marks = (node.attrs!.marks as CitationMark[]).filter(mark => last.get(meetings.get(mark.source)!) === mark)
+ }
+ }
const bound: PMNode[] = []
for (const node of out) {
if (node.type !== 'citation') { bound.push(node); continue }
@@ -99,7 +109,7 @@ function placeCitations(nodes: PMNode[], pending: boolean): PMNode[] {
return bound
}
-/** Keep the source IDs intact; visible numbers belong to meetings, in this answer's reading order. */
+/** Keep passage IDs intact; each paragraph retains its last supporting mark per meeting. */
export function citationDoc(answer: string, sources: Array<{ n: number; meetingId: string }>, live = false): PMNode {
const text = tidyCitations(live ? answer.replace(/\[[\d,\s]*$/, '') : answer, sources)
const doc = mdToDoc(text.replace(/\n{2,}/g, '\n'), { streaming: live })
@@ -111,7 +121,7 @@ export function citationDoc(answer: string, sources: Array<{ n: number; meetingI
if (node.type !== 'text') {
if (!node.content) return [node]
const content = node.content.flatMap(transform)
- return [{ ...node, content: node.type === 'paragraph' || node.type === 'heading' ? placeCitations(content, node === pending) : content }]
+ return [{ ...node, content: node.type === 'paragraph' || node.type === 'heading' ? placeCitations(content, node === pending, node.type === 'paragraph' ? meetingOf : undefined) : content }]
}
const text = node.text ?? '', parts: PMNode[] = []
let last = 0
@@ -144,6 +154,7 @@ export function citationExcerptLines(text: string): PMNode[][] {
/** Transcript excerpts use the same parsing, without presenting formatting as part of someone's speech. */
export const citationExcerptText = (text: string): string => citationExcerptLines(text).map(line => line.map(n => n.text ?? '').join('')).join('\n')
+const wordSegmenter = new Intl.Segmenter(undefined, { granularity: 'word' })
const segmenter = new Intl.Segmenter(undefined, { granularity: 'sentence' })
function sourceSentences(text: string): Array<{ text: string; index: number; end: number }> {
let offset = 0
@@ -160,7 +171,14 @@ const tokens = (text: string) => new Set((text.toLowerCase().match(/[\p{L}\p{N}]
/** The source is quoted, never generated. Ties (including no overlap) keep the earliest sentence. */
export function citationPassage(excerpt: string, answerSentence: string): { before: string; match: string; after: string } {
- const sentences = sourceSentences(citationExcerptText(excerpt)).map(s => s.text)
+ const paragraphs = (node: PMNode): string[] => node.type === 'heading' ? [] : node.type === 'paragraph'
+ ? [(node.content ?? []).map(n => n.text ?? '').join('')] : (node.content ?? []).flatMap(paragraphs)
+ const body = paragraphs(mdToDoc(excerpt.replace(/^[\t ]*#{4,6}[\t ]+/gm, '### '), { inlineCode: true })).join('\n')
+ const sentences = sourceSentences(body).map(s => s.text).filter(text => {
+ const words = [...wordSegmenter.segment(text)].filter(s => s.isWordLike).length
+ // Reject short labels and clipped tails, retaining short punctuated statements and unpunctuated speech.
+ return !/[::…]$|\.{3}$/.test(text) && (words >= 3 || words >= 2 && /[.!?。!?]["'”’»))\]]*$/.test(text))
+ })
const answer = tokens(answerSentence)
let best = 0, score = -1
sentences.forEach((sentence, i) => {
diff --git a/app/src/shared/locales/ar.json b/app/src/shared/locales/ar.json
index 70e13225..3a917be0 100644
--- a/app/src/shared/locales/ar.json
+++ b/app/src/shared/locales/ar.json
@@ -12,7 +12,6 @@
"No matching meetings with {name} on {date}.": "لا توجد اجتماعات مطابقة مع {name} في {date}.",
"Meetings with {name}": "اجتماعات مع {name}",
"Hide checklist": "إخفاء قائمة التحقق",
- "Notes": "ملاحظات",
"Open": "فتح",
"Next day": "اليوم التالي",
"Previous day": "اليوم السابق",
diff --git a/app/src/shared/locales/bn.json b/app/src/shared/locales/bn.json
index 7290fc49..d9d0e57b 100644
--- a/app/src/shared/locales/bn.json
+++ b/app/src/shared/locales/bn.json
@@ -12,7 +12,6 @@
"No matching meetings with {name} on {date}.": "{date} তারিখে {name}-এর সঙ্গে মিলে যাওয়া কোনো মিটিং নেই।",
"Meetings with {name}": "{name}-এর সঙ্গে মিটিং",
"Hide checklist": "চেকলিস্ট লুকান",
- "Notes": "নোট",
"Open": "খুলুন",
"Next day": "পরের দিন",
"Previous day": "আগের দিন",
diff --git a/app/src/shared/locales/cs.json b/app/src/shared/locales/cs.json
index 5ca65cec..e07f2cf9 100644
--- a/app/src/shared/locales/cs.json
+++ b/app/src/shared/locales/cs.json
@@ -12,7 +12,6 @@
"No matching meetings with {name} on {date}.": "Žádné odpovídající schůzky s {name} dne {date}.",
"Meetings with {name}": "Schůzky s {name}",
"Hide checklist": "Skrýt kontrolní seznam",
- "Notes": "Poznámky",
"Open": "Otevřít",
"Next day": "Další den",
"Previous day": "Předchozí den",
diff --git a/app/src/shared/locales/da.json b/app/src/shared/locales/da.json
index deaef967..485a4f94 100644
--- a/app/src/shared/locales/da.json
+++ b/app/src/shared/locales/da.json
@@ -12,7 +12,6 @@
"No matching meetings with {name} on {date}.": "Ingen matchende møder med {name} den {date}.",
"Meetings with {name}": "Møder med {name}",
"Hide checklist": "Skjul tjekliste",
- "Notes": "Noter",
"Open": "Åbn",
"Next day": "Næste dag",
"Previous day": "Forrige dag",
diff --git a/app/src/shared/locales/de.json b/app/src/shared/locales/de.json
index d4b6e325..5adc462c 100644
--- a/app/src/shared/locales/de.json
+++ b/app/src/shared/locales/de.json
@@ -12,7 +12,6 @@
"No matching meetings with {name} on {date}.": "Keine passenden Besprechungen mit {name} am {date}.",
"Meetings with {name}": "Besprechungen mit {name}",
"Hide checklist": "Checkliste ausblenden",
- "Notes": "Notizen",
"Open": "Öffnen",
"Next day": "Nächster Tag",
"Previous day": "Vorheriger Tag",
diff --git a/app/src/shared/locales/el.json b/app/src/shared/locales/el.json
index fa1369bc..8788358c 100644
--- a/app/src/shared/locales/el.json
+++ b/app/src/shared/locales/el.json
@@ -12,7 +12,6 @@
"No matching meetings with {name} on {date}.": "Δεν βρέθηκαν συναντήσεις που να ταιριάζουν με {name} στις {date}.",
"Meetings with {name}": "Συναντήσεις με {name}",
"Hide checklist": "Απόκρυψη λίστας ελέγχου",
- "Notes": "Σημειώσεις",
"Open": "Άνοιγμα",
"Next day": "Επόμενη ημέρα",
"Previous day": "Προηγούμενη ημέρα",
diff --git a/app/src/shared/locales/es.json b/app/src/shared/locales/es.json
index 8f0e2972..2735eae5 100644
--- a/app/src/shared/locales/es.json
+++ b/app/src/shared/locales/es.json
@@ -12,7 +12,6 @@
"No matching meetings with {name} on {date}.": "No hay reuniones coincidentes con {name} el {date}.",
"Meetings with {name}": "Reuniones con {name}",
"Hide checklist": "Ocultar lista de verificación",
- "Notes": "Notas",
"Open": "Abrir",
"Next day": "Día siguiente",
"Previous day": "Día anterior",
diff --git a/app/src/shared/locales/fi.json b/app/src/shared/locales/fi.json
index 27bb1add..29433de3 100644
--- a/app/src/shared/locales/fi.json
+++ b/app/src/shared/locales/fi.json
@@ -12,7 +12,6 @@
"No matching meetings with {name} on {date}.": "Ei vastaavia kokouksia henkilön {name} kanssa päivänä {date}.",
"Meetings with {name}": "Kokoukset henkilön {name} kanssa",
"Hide checklist": "Piilota tarkistuslista",
- "Notes": "Muistiinpanot",
"Open": "Avaa",
"Next day": "Seuraava päivä",
"Previous day": "Edellinen päivä",
diff --git a/app/src/shared/locales/fil.json b/app/src/shared/locales/fil.json
index 4a3cf670..9a1f87fd 100644
--- a/app/src/shared/locales/fil.json
+++ b/app/src/shared/locales/fil.json
@@ -12,7 +12,6 @@
"No matching meetings with {name} on {date}.": "Walang tumutugmang pulong kasama si {name} sa {date}.",
"Meetings with {name}": "Mga pulong kasama si {name}",
"Hide checklist": "Itago ang checklist",
- "Notes": "Mga tala",
"Open": "Buksan",
"Next day": "Susunod na araw",
"Previous day": "Nakaraang araw",
diff --git a/app/src/shared/locales/fr.json b/app/src/shared/locales/fr.json
index e56d898f..483f79b7 100644
--- a/app/src/shared/locales/fr.json
+++ b/app/src/shared/locales/fr.json
@@ -12,7 +12,6 @@
"No matching meetings with {name} on {date}.": "Aucune réunion correspondante avec {name} le {date}.",
"Meetings with {name}": "Réunions avec {name}",
"Hide checklist": "Masquer la liste de contrôle",
- "Notes": "Notes",
"Open": "Ouvrir",
"Next day": "Jour suivant",
"Previous day": "Jour précédent",
diff --git a/app/src/shared/locales/he.json b/app/src/shared/locales/he.json
index 9d9b9abe..6e7c6d09 100644
--- a/app/src/shared/locales/he.json
+++ b/app/src/shared/locales/he.json
@@ -12,7 +12,6 @@
"No matching meetings with {name} on {date}.": "אין פגישות תואמות עם {name} בתאריך {date}.",
"Meetings with {name}": "פגישות עם {name}",
"Hide checklist": "הסתרת רשימת הבדיקה",
- "Notes": "הערות",
"Open": "פתיחה",
"Next day": "היום הבא",
"Previous day": "היום הקודם",
diff --git a/app/src/shared/locales/hi.json b/app/src/shared/locales/hi.json
index 6ad94359..f633157b 100644
--- a/app/src/shared/locales/hi.json
+++ b/app/src/shared/locales/hi.json
@@ -12,7 +12,6 @@
"No matching meetings with {name} on {date}.": "{date} को {name} के साथ कोई मेल खाती मीटिंग नहीं मिली।",
"Meetings with {name}": "{name} के साथ मीटिंग",
"Hide checklist": "चेकलिस्ट छिपाएँ",
- "Notes": "नोट्स",
"Open": "खोलें",
"Next day": "अगला दिन",
"Previous day": "पिछला दिन",
diff --git a/app/src/shared/locales/hu.json b/app/src/shared/locales/hu.json
index 9eea5f66..f5d3a600 100644
--- a/app/src/shared/locales/hu.json
+++ b/app/src/shared/locales/hu.json
@@ -12,7 +12,6 @@
"No matching meetings with {name} on {date}.": "Nincs megfelelő megbeszélés vele: {name}, ekkor: {date}.",
"Meetings with {name}": "Megbeszélések vele: {name}",
"Hide checklist": "Ellenőrzőlista elrejtése",
- "Notes": "Jegyzetek",
"Open": "Megnyitás",
"Next day": "Következő nap",
"Previous day": "Előző nap",
diff --git a/app/src/shared/locales/id.json b/app/src/shared/locales/id.json
index 5e921eec..18dcc425 100644
--- a/app/src/shared/locales/id.json
+++ b/app/src/shared/locales/id.json
@@ -12,7 +12,6 @@
"No matching meetings with {name} on {date}.": "Tidak ada rapat yang cocok dengan {name} pada {date}.",
"Meetings with {name}": "Rapat dengan {name}",
"Hide checklist": "Sembunyikan daftar periksa",
- "Notes": "Catatan",
"Open": "Buka",
"Next day": "Hari berikutnya",
"Previous day": "Hari sebelumnya",
diff --git a/app/src/shared/locales/it.json b/app/src/shared/locales/it.json
index fc294953..aca49bbe 100644
--- a/app/src/shared/locales/it.json
+++ b/app/src/shared/locales/it.json
@@ -12,7 +12,6 @@
"No matching meetings with {name} on {date}.": "Nessuna riunione corrispondente con {name} in data {date}.",
"Meetings with {name}": "Riunioni con {name}",
"Hide checklist": "Nascondi checklist",
- "Notes": "Note",
"Open": "Apri",
"Next day": "Giorno successivo",
"Previous day": "Giorno precedente",
diff --git a/app/src/shared/locales/ja.json b/app/src/shared/locales/ja.json
index 6f9effa3..3ec178ff 100644
--- a/app/src/shared/locales/ja.json
+++ b/app/src/shared/locales/ja.json
@@ -12,7 +12,6 @@
"No matching meetings with {name} on {date}.": "{date}の{name}との一致する会議はありません。",
"Meetings with {name}": "{name} との会議",
"Hide checklist": "チェックリストを非表示",
- "Notes": "ノート",
"Open": "開く",
"Next day": "次の日",
"Previous day": "前の日",
diff --git a/app/src/shared/locales/ko.json b/app/src/shared/locales/ko.json
index 5d99a4c4..e2d4c76c 100644
--- a/app/src/shared/locales/ko.json
+++ b/app/src/shared/locales/ko.json
@@ -12,7 +12,6 @@
"No matching meetings with {name} on {date}.": "{date}에 {name}님과의 일치하는 회의가 없습니다.",
"Meetings with {name}": "{name} 님과의 회의",
"Hide checklist": "체크리스트 숨기기",
- "Notes": "노트",
"Open": "열기",
"Next day": "다음 날",
"Previous day": "이전 날",
diff --git a/app/src/shared/locales/ms.json b/app/src/shared/locales/ms.json
index b3c774b9..abe4bb88 100644
--- a/app/src/shared/locales/ms.json
+++ b/app/src/shared/locales/ms.json
@@ -12,7 +12,6 @@
"No matching meetings with {name} on {date}.": "Tiada mesyuarat yang sepadan dengan {name} pada {date}.",
"Meetings with {name}": "Mesyuarat dengan {name}",
"Hide checklist": "Sembunyikan senarai semak",
- "Notes": "Nota",
"Open": "Buka",
"Next day": "Hari seterusnya",
"Previous day": "Hari sebelumnya",
diff --git a/app/src/shared/locales/nb.json b/app/src/shared/locales/nb.json
index 72158a66..d4b05576 100644
--- a/app/src/shared/locales/nb.json
+++ b/app/src/shared/locales/nb.json
@@ -12,7 +12,6 @@
"No matching meetings with {name} on {date}.": "Ingen samsvarende møter med {name} den {date}.",
"Meetings with {name}": "Møter med {name}",
"Hide checklist": "Skjul sjekkliste",
- "Notes": "Notater",
"Open": "Åpne",
"Next day": "Neste dag",
"Previous day": "Forrige dag",
diff --git a/app/src/shared/locales/nl.json b/app/src/shared/locales/nl.json
index 2861527c..45042070 100644
--- a/app/src/shared/locales/nl.json
+++ b/app/src/shared/locales/nl.json
@@ -12,7 +12,6 @@
"No matching meetings with {name} on {date}.": "Geen overeenkomende vergaderingen met {name} op {date}.",
"Meetings with {name}": "Vergaderingen met {name}",
"Hide checklist": "Checklist verbergen",
- "Notes": "Notities",
"Open": "Openen",
"Next day": "Volgende dag",
"Previous day": "Vorige dag",
diff --git a/app/src/shared/locales/pl.json b/app/src/shared/locales/pl.json
index 73027ec8..f1767c20 100644
--- a/app/src/shared/locales/pl.json
+++ b/app/src/shared/locales/pl.json
@@ -12,7 +12,6 @@
"No matching meetings with {name} on {date}.": "Brak pasujących spotkań z {name} w dniu {date}.",
"Meetings with {name}": "Spotkania z {name}",
"Hide checklist": "Ukryj listę kontrolną",
- "Notes": "Notatki",
"Open": "Otwórz",
"Next day": "Następny dzień",
"Previous day": "Poprzedni dzień",
diff --git a/app/src/shared/locales/pt-BR.json b/app/src/shared/locales/pt-BR.json
index 8eebac2b..d09eb2c2 100644
--- a/app/src/shared/locales/pt-BR.json
+++ b/app/src/shared/locales/pt-BR.json
@@ -12,7 +12,6 @@
"No matching meetings with {name} on {date}.": "Nenhuma reunião correspondente com {name} em {date}.",
"Meetings with {name}": "Reuniões com {name}",
"Hide checklist": "Ocultar lista de verificação",
- "Notes": "Notas",
"Open": "Abrir",
"Next day": "Próximo dia",
"Previous day": "Dia anterior",
diff --git a/app/src/shared/locales/ro.json b/app/src/shared/locales/ro.json
index 602a72db..0745de6d 100644
--- a/app/src/shared/locales/ro.json
+++ b/app/src/shared/locales/ro.json
@@ -12,7 +12,6 @@
"No matching meetings with {name} on {date}.": "Nicio întâlnire corespunzătoare cu {name} pe {date}.",
"Meetings with {name}": "Întâlniri cu {name}",
"Hide checklist": "Ascunde lista de verificare",
- "Notes": "Notițe",
"Open": "Deschide",
"Next day": "Ziua următoare",
"Previous day": "Ziua precedentă",
diff --git a/app/src/shared/locales/ru.json b/app/src/shared/locales/ru.json
index 8f67ad25..a3dd9f53 100644
--- a/app/src/shared/locales/ru.json
+++ b/app/src/shared/locales/ru.json
@@ -12,7 +12,6 @@
"No matching meetings with {name} on {date}.": "Нет подходящих встреч с {name} на {date}.",
"Meetings with {name}": "Встречи с {name}",
"Hide checklist": "Скрыть контрольный список",
- "Notes": "Заметки",
"Open": "Открыть",
"Next day": "Следующий день",
"Previous day": "Предыдущий день",
diff --git a/app/src/shared/locales/sv.json b/app/src/shared/locales/sv.json
index 38756f2e..817d0ab0 100644
--- a/app/src/shared/locales/sv.json
+++ b/app/src/shared/locales/sv.json
@@ -12,7 +12,6 @@
"No matching meetings with {name} on {date}.": "Inga matchande möten med {name} den {date}.",
"Meetings with {name}": "Möten med {name}",
"Hide checklist": "Dölj checklista",
- "Notes": "Anteckningar",
"Open": "Öppna",
"Next day": "Nästa dag",
"Previous day": "Föregående dag",
diff --git a/app/src/shared/locales/th.json b/app/src/shared/locales/th.json
index 64277a2d..bb5cd0d6 100644
--- a/app/src/shared/locales/th.json
+++ b/app/src/shared/locales/th.json
@@ -12,7 +12,6 @@
"No matching meetings with {name} on {date}.": "ไม่มีการประชุมที่ตรงกันกับ {name} ในวันที่ {date}",
"Meetings with {name}": "การประชุมกับ {name}",
"Hide checklist": "ซ่อนรายการตรวจสอบ",
- "Notes": "บันทึก",
"Open": "เปิด",
"Next day": "วันถัดไป",
"Previous day": "วันก่อนหน้า",
diff --git a/app/src/shared/locales/tr.json b/app/src/shared/locales/tr.json
index 929ea147..ec942b81 100644
--- a/app/src/shared/locales/tr.json
+++ b/app/src/shared/locales/tr.json
@@ -12,7 +12,6 @@
"No matching meetings with {name} on {date}.": "{date} tarihinde {name} ile eşleşen toplantı yok.",
"Meetings with {name}": "{name} ile toplantılar",
"Hide checklist": "Kontrol listesini gizle",
- "Notes": "Notlar",
"Open": "Aç",
"Next day": "Sonraki gün",
"Previous day": "Önceki gün",
diff --git a/app/src/shared/locales/uk.json b/app/src/shared/locales/uk.json
index efc6ff1f..d8d52c60 100644
--- a/app/src/shared/locales/uk.json
+++ b/app/src/shared/locales/uk.json
@@ -12,7 +12,6 @@
"No matching meetings with {name} on {date}.": "Немає відповідних зустрічей з {name} на {date}.",
"Meetings with {name}": "Зустрічі з {name}",
"Hide checklist": "Приховати контрольний список",
- "Notes": "Нотатки",
"Open": "Відкрити",
"Next day": "Наступний день",
"Previous day": "Попередній день",
diff --git a/app/src/shared/locales/vi.json b/app/src/shared/locales/vi.json
index 4fc52319..7ab1e82d 100644
--- a/app/src/shared/locales/vi.json
+++ b/app/src/shared/locales/vi.json
@@ -12,7 +12,6 @@
"No matching meetings with {name} on {date}.": "Không có cuộc họp phù hợp với {name} vào {date}.",
"Meetings with {name}": "Cuộc họp với {name}",
"Hide checklist": "Ẩn danh sách kiểm tra",
- "Notes": "Ghi chú",
"Open": "Mở",
"Next day": "Ngày tiếp theo",
"Previous day": "Ngày trước",
diff --git a/app/src/shared/locales/zh-CN.json b/app/src/shared/locales/zh-CN.json
index 8a7c12f2..a0c23ccd 100644
--- a/app/src/shared/locales/zh-CN.json
+++ b/app/src/shared/locales/zh-CN.json
@@ -12,7 +12,6 @@
"No matching meetings with {name} on {date}.": "{date}没有与{name}的匹配会议。",
"Meetings with {name}": "与 {name} 的会议",
"Hide checklist": "隐藏检查清单",
- "Notes": "笔记",
"Open": "打开",
"Next day": "后一天",
"Previous day": "前一天",
diff --git a/app/src/shared/locales/zh-TW.json b/app/src/shared/locales/zh-TW.json
index 3da01255..0de7b438 100644
--- a/app/src/shared/locales/zh-TW.json
+++ b/app/src/shared/locales/zh-TW.json
@@ -12,7 +12,6 @@
"No matching meetings with {name} on {date}.": "{date}沒有與{name}的相符會議。",
"Meetings with {name}": "與 {name} 的會議",
"Hide checklist": "隱藏檢查清單",
- "Notes": "筆記",
"Open": "開啟",
"Next day": "後一天",
"Previous day": "前一天",
diff --git a/app/test/citationCard.test.ts b/app/test/citationCard.test.ts
index f56ec733..87a8e369 100644
--- a/app/test/citationCard.test.ts
+++ b/app/test/citationCard.test.ts
@@ -3,9 +3,6 @@ import { citationCardPassage, citationLineWindow } from '../src/shared/citationC
import { turns } from '../src/shared/transcript'
import { SPEAKER_COLORS } from '../src/shared/speakerColors'
import type { LibrarySource } from '../src/shared/types'
-import { createElement } from 'react'
-import { renderToStaticMarkup } from 'react-dom/server'
-import { NotesPassage } from '../src/renderer/src/components/SourceCitation'
const source: LibrarySource = { n: 1, meetingId: 'm', title: 'Standup', startedAt: 0, atMs: null }
const transcript: LibrarySource = { ...source, atMs: 0, excerpt: 'You: The review is done.\nJenny: We can move the handoff to tomorrow.\nThem: That gives everyone time to check the notes.', transcript: {
@@ -17,23 +14,15 @@ const transcript: LibrarySource = { ...source, atMs: 0, excerpt: 'You: The revie
} }
describe('citation card source treatment', () => {
- it('keeps notes bullets, inline formatting and the matched item wash', () => {
+ it('selects the supporting quote from a notes bullet without adding its neighbors', () => {
const preview = citationCardPassage({ ...source, excerpt: '## Next steps\n- **You:** Send the plan.\n- **Jenny:** Book the room.\n- Review on Friday.' }, 'Jenny will book the room.')
- const html = renderToStaticMarkup(createElement(NotesPassage, { preview }))
- expect(html).toContain('<ul>')
- expect(html.match(/<li>/g)).toHaveLength(3)
- expect(html).toContain('<span class="citation-match"><strong>Jenny:</strong> Book the room.</span>')
- expect(html).not.toContain('Next steps')
+ expect(preview.match.text).toBe('Jenny: Book the room.')
+ expect(preview.match.text).not.toContain('Next steps')
})
- it('retains list numbering and keeps sentences from one item in one list item', () => {
+ it('selects the supporting sentence inside a numbered item without its list number', () => {
const preview = citationCardPassage({ ...source, excerpt: '4. Check the draft.\n5. **Send** the plan. Include the budget.\n6. Meet on Friday.' }, 'Include the budget.')
- const html = renderToStaticMarkup(createElement(NotesPassage, { preview }))
- expect(html).toContain('<ol start="5">')
- expect(html.match(/<li value=/g)).toHaveLength(2)
- expect(html).toContain('<li value="5">')
- expect(html).toContain('<li value="6">')
- expect(html).toContain('<strong>Send</strong> the plan.')
- expect(html).toContain('<span class="citation-match">Include the budget.</span>')
+ expect(preview.match.text).toBe('Include the budget.')
+ expect(preview.match.text).not.toContain('Send the plan')
})
it('renders notes with safe inline Markdown and the exact matched sentence', () => {
const card = citationCardPassage({ ...source, excerpt: 'QA is Tuesday. **Publish** the *release notes* on `Wednesday`. Ann will share [the link](https://example.com).' }, 'Publish the release notes on Wednesday.')
diff --git a/app/test/citationInteraction.test.ts b/app/test/citationInteraction.test.ts
new file mode 100644
index 00000000..14096f07
--- /dev/null
+++ b/app/test/citationInteraction.test.ts
@@ -0,0 +1,99 @@
+import { useId, useLayoutEffect, useMemo, useRef, useState, type ReactElement } from 'react'
+import { afterEach, expect, it, vi } from 'vitest'
+import { AnswerText } from '../src/renderer/src/components/AnswerText'
+import type { Popover } from '@base-ui/react/popover'
+
+vi.mock('react', async original => ({ ...await original<typeof import('react')>(), useId: vi.fn(), useLayoutEffect: vi.fn(), useMemo: vi.fn(), useRef: vi.fn(), useState: vi.fn() }))
+afterEach(() => { vi.clearAllMocks(); vi.unstubAllGlobals() })
+
+function harness() {
+ const states: unknown[] = [], refs: Array<{ current: unknown }> = []
+ const effects: Array<() => void> = []
+ let stateIndex = 0, refIndex = 0
+ const trigger = { id: 'first', getAttribute: () => 'popup', matches: vi.fn(() => false), focus: vi.fn() }
+ const popup = { contains: vi.fn(() => false), matches: vi.fn(() => false) }
+ const doc = { activeElement: null as unknown, getElementById: (id: string) => id === 'first' ? trigger : id === 'popup' ? popup : null }
+ vi.stubGlobal('document', doc)
+ vi.mocked(useId).mockReturnValue('answer')
+ vi.mocked(useLayoutEffect).mockImplementation(effect => { effects.push(effect) })
+ vi.mocked(useMemo).mockImplementation(fn => fn())
+ vi.mocked(useRef).mockImplementation(initial => refs[refIndex++] ?? (refs[refIndex - 1] = { current: initial }) as never)
+ vi.mocked(useState).mockImplementation((initial?: unknown): [unknown, (next: unknown) => void] => {
+ const i = stateIndex++
+ if (!(i in states)) states[i] = initial
+ return [states[i], next => { states[i] = next }]
+ })
+ const render = () => {
+ stateIndex = 0; refIndex = 0; effects.length = 0
+ return AnswerText({ md: 'A decision.', live: false, sources: [], onSource: vi.fn() }) as ReactElement<Popover.Root.Props>
+ }
+ const change = (next: boolean, reason: Popover.Root.ChangeEventReason, id = 'first') => {
+ const cancel = vi.fn()
+ render().props.onOpenChange!(next, { reason, trigger: { id }, event: { detail: 1 }, cancel } as unknown as Popover.Root.ChangeEventDetails)
+ return { open: render().props.open, triggerId: render().props.triggerId, cancel }
+ }
+ const close = vi.fn(), unmount = vi.fn()
+ const commit = () => {
+ const root = render()
+ close.mockImplementation(() => root.props.onOpenChange!(false, { reason: 'imperative-action', cancel: vi.fn() } as unknown as Popover.Root.ChangeEventDetails))
+ root.props.actionsRef!.current = { close, unmount }
+ effects.forEach(effect => effect())
+ return render().props
+ }
+ return { change, commit, close, unmount, doc, popup, trigger }
+}
+
+it('pins even a patient click on a hover preview, ignores hover exits, and toggles on the next press', () => {
+ const h = harness()
+ expect(h.change(true, 'trigger-hover').open).toBe(true)
+ const press = h.change(false, 'trigger-press')
+ expect(press.cancel).toHaveBeenCalledOnce()
+ expect(press.open).toBe(true)
+ expect(h.change(false, 'trigger-hover').open).toBe(true)
+ expect(h.change(false, 'focus-out').open).toBe(true)
+ expect(h.change(false, 'trigger-press').open).toBe(false)
+})
+
+it.each(['escape-key', 'outside-press'] as const)('%s dismisses a pinned citation', reason => {
+ const h = harness()
+ h.change(true, 'trigger-press')
+ expect(h.change(false, reason).open).toBe(false)
+ expect(h.change(true, 'trigger-hover', 'second').triggerId).toBe('second')
+})
+
+it('does not let another hover replace a pinned source, but another press can', () => {
+ const h = harness()
+ h.change(true, 'trigger-press')
+ expect(h.change(true, 'trigger-hover', 'second').triggerId).toBe('first')
+ expect(h.change(true, 'trigger-press', 'second').triggerId).toBe('second')
+})
+
+it('keeps a hovered preview open while the trigger or popup has focus', () => {
+ const h = harness()
+ h.change(true, 'trigger-hover')
+ h.doc.activeElement = h.trigger
+ expect(h.change(false, 'trigger-hover').open).toBe(true)
+ h.doc.activeElement = null; h.popup.contains.mockReturnValue(true)
+ expect(h.change(false, 'trigger-hover').open).toBe(true)
+ h.popup.contains.mockReturnValue(false)
+ expect(h.change(false, 'trigger-hover').open).toBe(false)
+})
+
+it('focus leaving a hovered popup does not close it until the pointer leaves too', () => {
+ const h = harness()
+ h.change(true, 'trigger-hover'); h.popup.matches.mockReturnValue(true)
+ expect(h.change(false, 'focus-out').open).toBe(true)
+ h.popup.matches.mockReturnValue(false)
+ expect(h.change(false, 'focus-out').open).toBe(false)
+})
+
+it('closes through the popover API when a streamed citation removes its pinned trigger', () => {
+ const h = harness()
+ h.change(true, 'trigger-press')
+ h.doc.getElementById = () => null
+ expect(h.commit().open).toBe(false)
+ expect(h.close).toHaveBeenCalledOnce()
+ expect(h.commit().triggerId).toBe(null)
+ expect(h.unmount).toHaveBeenCalledOnce()
+ expect(h.change(true, 'trigger-hover', 'second').open).toBe(true)
+})
diff --git a/app/test/citations.test.ts b/app/test/citations.test.ts
index ffaebc2b..2e6b515d 100644
--- a/app/test/citations.test.ts
+++ b/app/test/citations.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest'
import type { PMNode } from '../src/shared/markdown'
-import { citationPassage, citationTargetIndex, citationExcerptLines, citationExcerptText, citationDoc, citedIn, tidyCitations } from '../src/shared/citations'
+import { type CitationMark, citationPassage, citationTargetIndex, citationExcerptLines, citationExcerptText, citationDoc, citedIn, tidyCitations } from '../src/shared/citations'
/** sources numbered from 1, one letter per source naming its meeting: 'aab' is two parts of a, then b */
const of = (meetings: string) => [...meetings].map((meetingId, i) => ({ n: i + 1, meetingId }))
@@ -36,12 +36,12 @@ describe('citations in an answer', () => {
})
const citationNodes = (node: PMNode): PMNode[] => node.type === 'citation' ? [node] : (node.content ?? []).flatMap(citationNodes)
-const marks = (answer: string, sources = of('aab'), live = false) => citationNodes(citationDoc(answer, sources, live)).flatMap(n => n.attrs!.marks)
+const marks = (answer: string, sources = of('aab'), live = false) => citationNodes(citationDoc(answer, sources, live)).flatMap(n => n.attrs!.marks as CitationMark[])
describe('numbered citation Markdown', () => {
- it('numbers meetings by first appearance, reusing the number but keeping the specific chunk', () => {
+ it('keeps the last supporting passage per meeting and its original meeting identity', () => {
expect(marks('First [3]. Next [2]. Another part [1].')).toEqual([
- { source: 3, number: 1 }, { source: 2, number: 2 }, { source: 1, number: 2 },
+ { source: 3, number: 1 }, { source: 1, number: 2 },
])
expect(marks('A new answer [1].')).toEqual([{ source: 1, number: 1 }])
})
@@ -69,7 +69,7 @@ describe('numbered citation Markdown', () => {
it('keeps earlier numbers while streaming, waits for an incomplete mark, and matches the saved result', () => {
const prefix = 'First [3]. Next [2].'
expect(marks(prefix + ' And [1', of('aab'), true)).toEqual(marks(prefix))
- expect(marks(prefix + ' And [1].', of('aab'), true)).toEqual([...marks(prefix), { source: 1, number: 2 }])
+ expect(marks(prefix + ' And [1].', of('aab'), true)).toEqual([{ source: 3, number: 1 }, { source: 1, number: 2 }])
expect(citationDoc(prefix, of('aab'), true)).toEqual(citationDoc(prefix, of('aab')))
})
})
@@ -171,7 +171,7 @@ describe('citation passages', () => {
it('handles Unicode, repeated words, ties, empty excerpts and no overlap deterministically', () => {
expect(citationPassage('Launch launch launch. Launch pricing.', 'Launch pricing.').match).toBe('Launch pricing.')
expect(citationPassage('Le café ouvre lundi. Le café ferme mardi.', 'Café mardi.').match).toBe('Le café ferme mardi.')
- expect(citationPassage('First. Next.', 'No overlap.')).toEqual({ before: '', match: 'First.', after: 'Next.' })
+ expect(citationPassage('Next steps\nWe reviewed the plan. We agreed to proceed.', 'No overlap.')).toEqual({ before: '', match: 'We reviewed the plan.', after: 'We agreed to proceed.' })
expect(citationPassage('', 'Anything.')).toEqual({ before: '', match: '', after: '' })
})
it('finds the matching source block without punctuation, Markdown or speaker-prefix differences', () => {
@@ -183,3 +183,39 @@ describe('citation passages', () => {
expect(citationTargetIndex([''], '')).toBe(-1)
})
})
+
+describe('one meeting pill per paragraph', () => {
+ it('keeps interleaved meetings at their last support, ahead of unrelated trailing text', () => {
+ const doc = citationDoc('First [1]. Other [2]. **Last** [3]. Unrelated ending.', of('aba'))
+ const nodes = citationNodes(doc)
+ expect(nodes.flatMap(n => n.attrs!.marks as CitationMark[]).map(m => m.source)).toEqual([2, 3])
+ expect(nodes.find(n => (n.attrs!.marks as CitationMark[]).some((m: { source: number }) => m.source === 3))?.attrs!.sentence).toBe('Last.')
+ expect(doc.content![0].content!.at(-1)).toMatchObject({ type: 'text', text: ' Unrelated ending.' })
+ expect(JSON.stringify(doc)).toContain('bold')
+ })
+ it('collapses grouped passages independently in paragraphs and list items', () => {
+ expect(marks('Both [1, 2]. Again [3].\n\nAgain [1].\n- First [1]. Last [3].\n- Other [1].', of('aba')).map(m => m.source)).toEqual([2, 3, 1, 3, 1])
+ })
+ it('keeps offsets when a duplicate pill moves during streaming and waits for a complete new mark', () => {
+ const answer = 'First [1]. Last [2].'
+ expect(marks('First [1]. Last [2', of('aa'), true).map(m => m.source)).toEqual([1])
+ const doc = citationDoc(answer, of('aa'), true), nodes = citationNodes(doc)
+ expect(nodes.map(n => (n.attrs!.marks as CitationMark[]).map((m: { source: number }) => m.source))).toEqual([[], [2]])
+ expect(nodes.map(n => n.attrs!.length)).toEqual([3, 3])
+ expect(doc).toEqual(citationDoc(answer, of('aa')))
+ })
+})
+
+describe('citation sentence candidates', () => {
+ it('skips headings even when they overlap the claim more than its supporting sentence', () => {
+ expect(citationPassage('## Next steps for the release\nWe reviewed the draft. Send the release plan on Thursday. Review feedback on Friday.', 'The next steps for the release are to send the plan.')).toEqual({ before: 'We reviewed the draft.', match: 'Send the release plan on Thursday.', after: 'Review feedback on Friday.' })
+ })
+ it('skips plain labels, one-word fragments and clipped tails instead of using them as fallback', () => {
+ expect(citationPassage('Next steps\nThursday\nWe agreed to send the plan.\nPending…', 'What happened?')).toEqual({ before: '', match: 'We agreed to send the plan.', after: '' })
+ expect(citationPassage('## Next steps\nPending\nNext steps', 'Next steps')).toEqual({ before: '', match: '', after: '' })
+ })
+ it('keeps short complete statements and non-English sentences without inventing words', () => {
+ expect(citationPassage('## Planning\nShip Tuesday. Review feedback on Friday.', 'Ship Tuesday').match).toBe('Ship Tuesday.')
+ expect(citationPassage('## 次の手順\n計画を木曜日に送ります。金曜日に確認します。', '木曜日に送ります').match).toBe('計画を木曜日に送ります。')
+ })
+})