Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

feat(notes): real speaker identity in note generation and @mention owner tagging

Gabriel Stein672cc901a5c0
diff --git a/package-lock.json b/package-lock.json
index 61a91d7e1..293f00928 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -35,11 +35,13 @@
"@radix-ui/react-tabs": "^1.1.12",
"@tanstack/react-virtual": "^3.13.2",
"@tiptap/core": "3.22.5",
+ "@tiptap/extension-mention": "^3.22.5",
"@tiptap/extension-placeholder": "3.22.5",
"@tiptap/extension-task-item": "3.22.5",
"@tiptap/extension-task-list": "3.22.5",
"@tiptap/react": "3.22.5",
"@tiptap/starter-kit": "3.22.5",
+ "@tiptap/suggestion": "^3.22.5",
"ai": "^6.0.116",
"better-auth": "1.6.27",
"better-sqlite3": "12.9.0",
@@ -4841,6 +4843,21 @@
"@tiptap/extension-list": "3.22.5"
}
},
+ "node_modules/@tiptap/extension-mention": {
+ "version": "3.22.5",
+ "resolved": "https://registry.npmjs.org/@tiptap/extension-mention/-/extension-mention-3.22.5.tgz",
+ "integrity": "sha512-rGTbTjyxLc5C/6QjfbQF53nMbxjVgJU1VK6Si1i1J2c5DU09COgEFlYvi4YHjb3xz39SprPfG+GTtgD96eg7Ww==",
+ "license": "MIT",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/ueberdosis"
+ },
+ "peerDependencies": {
+ "@tiptap/core": "3.22.5",
+ "@tiptap/pm": "3.22.5",
+ "@tiptap/suggestion": "3.22.5"
+ }
+ },
"node_modules/@tiptap/extension-ordered-list": {
"version": "3.22.5",
"resolved": "https://registry.npmjs.org/@tiptap/extension-ordered-list/-/extension-ordered-list-3.22.5.tgz",
@@ -5046,6 +5063,20 @@
"url": "https://github.com/sponsors/ueberdosis"
}
},
+ "node_modules/@tiptap/suggestion": {
+ "version": "3.22.5",
+ "resolved": "https://registry.npmjs.org/@tiptap/suggestion/-/suggestion-3.22.5.tgz",
+ "integrity": "sha512-Uv79Ht/o4mx1GWIT65jeQTE67LMrA+K7d8p51XOe9PJw0H0fS3iCdeMJ8tAo3h6QrMJFejdsB7z8jJL9UbAnhA==",
+ "license": "MIT",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/ueberdosis"
+ },
+ "peerDependencies": {
+ "@tiptap/core": "3.22.5",
+ "@tiptap/pm": "3.22.5"
+ }
+ },
"node_modules/@tybys/wasm-util": {
"version": "0.10.3",
"resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.3.tgz",
diff --git a/package.json b/package.json
index e2fd3e0d8..036107741 100644
--- a/package.json
+++ b/package.json
@@ -130,6 +130,7 @@
"@aws-sdk/client-bedrock": "^3.1090.0",
"@aws-sdk/credential-providers": "^3.1029.0",
"@better-auth/sso": "1.6.27",
+ "@homebridge/dbus-native": "^0.7.7",
"@napi-rs/keyring": "^1.3.0",
"@qdrant/js-client-rest": "^1.12.0",
"@radix-ui/react-accordion": "^1.1.2",
@@ -143,17 +144,18 @@
"@radix-ui/react-tabs": "^1.1.12",
"@tanstack/react-virtual": "^3.13.2",
"@tiptap/core": "3.22.5",
+ "@tiptap/extension-mention": "^3.22.5",
"@tiptap/extension-placeholder": "3.22.5",
"@tiptap/extension-task-item": "3.22.5",
"@tiptap/extension-task-list": "3.22.5",
"@tiptap/react": "3.22.5",
"@tiptap/starter-kit": "3.22.5",
+ "@tiptap/suggestion": "^3.22.5",
"ai": "^6.0.116",
"better-auth": "1.6.27",
"better-sqlite3": "12.9.0",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
- "@homebridge/dbus-native": "^0.7.7",
"dotenv": "^17.4.1",
"electron-updater": "^6.6.2",
"ffmpeg-static": "^5.2.0",
diff --git a/src/components/notes/NoteEditor.tsx b/src/components/notes/NoteEditor.tsx
index c70120546..2b440d5f7 100644
--- a/src/components/notes/NoteEditor.tsx
+++ b/src/components/notes/NoteEditor.tsx
@@ -60,6 +60,7 @@ import NoteBottomBar from "./NoteBottomBar";
import EmbeddedChat, { type EmbeddedChatMode } from "./EmbeddedChat";
import { useEmbeddedChat } from "../../hooks/useEmbeddedChat";
import { normalizeDbDate, formatRelativeTime, formatShortDate } from "../../utils/dateFormatting";
+import { collectKnownPeople } from "../../utils/llmTranscript";
import { parseTranscriptSegments } from "../../utils/parseTranscriptSegments";
import {
applyTranscriptSpeakerPatch,
@@ -402,6 +403,20 @@ export default function NoteEditor({
}
}, [note.participants]);
+ const mentionPeople = useMemo(
+ () =>
+ collectKnownPeople(
+ {
+ selfName: user?.name?.trim() || null,
+ selfEmail: user?.email?.trim() || null,
+ participants: parsedParticipants,
+ },
+ speakerMappings,
+ displaySegments
+ ),
+ [user?.name, user?.email, parsedParticipants, speakerMappings, displaySegments]
+ );
+
const refreshSpeakerProfiles = useCallback(() => {
window.electronAPI?.getSpeakerProfiles?.().then((profiles) => {
setSpeakerProfiles(
@@ -1180,6 +1195,7 @@ export default function NoteEditor({
value={enhancement.content}
onChange={handleEnhancedChange}
disabled={!canEditNote}
+ mentionPeople={mentionPeople}
/>
) : (
<RichTextEditor
@@ -1188,6 +1204,7 @@ export default function NoteEditor({
editorRef={editorRef}
placeholder={t("notes.editor.startWriting")}
disabled={!canEditNote || actionProcessingState === "processing"}
+ mentionPeople={mentionPeople}
/>
)}
</div>
diff --git a/src/components/notes/NoteParticipants.tsx b/src/components/notes/NoteParticipants.tsx
index ee6c2a5f0..c3a2c911b 100644
--- a/src/components/notes/NoteParticipants.tsx
+++ b/src/components/notes/NoteParticipants.tsx
@@ -2,59 +2,10 @@ import { useState, useEffect, useCallback, useMemo } from "react";
import { useTranslation } from "react-i18next";
import { Users, X } from "lucide-react";
import { Popover, PopoverTrigger, PopoverContent } from "../ui/popover";
+import PersonAvatar from "../ui/PersonAvatar";
import type { CalendarAttendee } from "../../types/calendar";
import { syncSessionExpectedCountFromParticipants } from "../../stores/meetingRecordingStore";
-function getInitials(displayName: string | null, email: string): string {
- if (displayName) return displayName.charAt(0).toUpperCase();
- return email.charAt(0).toUpperCase();
-}
-
-function getInitialColor(email: string): string {
- let hash = 0;
- for (let i = 0; i < email.length; i++) {
- hash = email.charCodeAt(i) + ((hash << 5) - hash);
- }
- const h = Math.abs(hash) % 360;
- return `hsl(${h}, 45%, 65%)`;
-}
-
-interface ParticipantAvatarProps {
- email: string;
- displayName: string | null;
- gravatarHash?: string;
- failed: boolean;
- onImageError: () => void;
-}
-
-function ParticipantAvatar({
- email,
- displayName,
- gravatarHash,
- failed,
- onImageError,
-}: ParticipantAvatarProps) {
- if (gravatarHash && !failed) {
- return (
- <img
- src={`https://www.gravatar.com/avatar/${gravatarHash}?d=404&s=64`}
- alt=""
- loading="lazy"
- className="shrink-0 w-6 h-6 rounded-full object-cover"
- onError={onImageError}
- />
- );
- }
- return (
- <span
- className="shrink-0 w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white"
- style={{ backgroundColor: getInitialColor(email) }}
- >
- {getInitials(displayName, email)}
- </span>
- );
-}
-
interface NoteParticipantsProps {
noteId: number;
participants: CalendarAttendee[];
@@ -67,33 +18,12 @@ export default function NoteParticipants({ noteId, participants }: NoteParticipa
const [suggestions, setSuggestions] = useState<
Array<{ email: string; display_name: string | null }>
>([]);
- const [gravatarHashes, setGravatarHashes] = useState<Record<string, string>>({});
- const [failedGravatars, setFailedGravatars] = useState<Set<string>>(new Set());
const [open, setOpen] = useState(false);
useEffect(() => {
setLocalParticipants(participants);
}, [participants]);
- useEffect(() => {
- const emails = localParticipants.map((p) => p.email);
- const missing = emails.filter((e) => !gravatarHashes[e]);
- if (missing.length === 0) return;
-
- Promise.all(
- missing.map(async (email) => {
- const hash = await window.electronAPI.getMD5Hash(email);
- return { email, hash };
- })
- ).then((results) => {
- setGravatarHashes((prev) => {
- const next = { ...prev };
- for (const { email, hash } of results) next[email] = hash;
- return next;
- });
- });
- }, [localParticipants, gravatarHashes]);
-
useEffect(() => {
if (!open) return;
const query = search.trim();
@@ -200,12 +130,7 @@ export default function NoteParticipants({ noteId, participants }: NoteParticipa
onClick={() => addParticipant(contact.email, contact.display_name)}
className="flex items-center gap-2 w-full px-2 py-1.5 rounded-md text-xs text-foreground/70 hover:bg-foreground/5 transition-colors cursor-pointer"
>
- <ParticipantAvatar
- email={contact.email}
- displayName={contact.display_name}
- failed={false}
- onImageError={() => {}}
- />
+ <PersonAvatar email={contact.email} displayName={contact.display_name} />
<span className="truncate">{contact.display_name || contact.email}</span>
</button>
))}
@@ -228,13 +153,7 @@ export default function NoteParticipants({ noteId, participants }: NoteParticipa
key={p.email}
className="group flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-foreground/5 transition-colors"
>
- <ParticipantAvatar
- email={p.email}
- displayName={p.displayName}
- gravatarHash={gravatarHashes[p.email]}
- failed={failedGravatars.has(p.email)}
- onImageError={() => setFailedGravatars((prev) => new Set(prev).add(p.email))}
- />
+ <PersonAvatar email={p.email} displayName={p.displayName} />
<span className="flex-1 min-w-0 truncate text-xs text-foreground/70">
{p.displayName || p.email.split("@")[0]}
diff --git a/src/components/notes/PersonalNotesView.tsx b/src/components/notes/PersonalNotesView.tsx
index cb15b6219..bb29a203a 100644
--- a/src/components/notes/PersonalNotesView.tsx
+++ b/src/components/notes/PersonalNotesView.tsx
@@ -23,6 +23,14 @@ import { cn } from "../lib/utils";
import logger from "../../utils/logger";
import { parseTranscriptSegments } from "../../utils/parseTranscriptSegments";
import { isExplicitSpeakerCount, resolveExpectedSpeakerCount } from "../../utils/participants";
+import {
+ buildLlmTranscript,
+ buildMeetingContext,
+ collectKnownPeople,
+ type MeetingIdentity,
+} from "../../utils/llmTranscript";
+import type { MentionPerson } from "../../utils/mentionMarkdown";
+import type { CalendarAttendee } from "../../types/calendar";
import {
useNotes,
useSpaces,
@@ -76,6 +84,16 @@ function makeContentHash(content: string): string {
return String(content.length) + "-" + content.slice(0, 50);
}
+function parseNoteParticipants(raw: string | null | undefined): CalendarAttendee[] {
+ if (!raw) return [];
+ try {
+ const parsed = JSON.parse(raw);
+ return Array.isArray(parsed) ? parsed : [];
+ } catch {
+ return [];
+ }
+}
+
function draftFromNote(note: NoteItem): NoteEditorDraft {
return {
noteId: note.id,
@@ -211,7 +229,7 @@ export default function PersonalNotesView({
const isCloudMode = noteFormatting.isCloudMode;
const effectiveModelId = noteFormatting.modelId;
const { isComplete: isOnboardingComplete, complete: completeOnboarding } = useNotesOnboarding();
- const { isSignedIn } = useAuth();
+ const { isSignedIn, user } = useAuth();
const teamSpacesAvailable = useTeamSpacesCapability(isSignedIn);
const isTreeLoading = useIsTreeLoading();
const [structureIntroPending, setStructureIntroPending] = useState(() =>
@@ -748,7 +766,7 @@ export default function PersonalNotesView({
actionName={actionName}
actionPicker={
<ActionPicker
- onRunAction={(action) => {
+ onRunAction={async (action) => {
if (!editorNote) return;
const { recordingNoteId: liveNoteId, transcript: liveTranscript } =
useMeetingRecordingStore.getState();
@@ -760,17 +778,34 @@ export default function PersonalNotesView({
if (!hasNotes && !rawTranscript) return;
let formattedTranscript = "";
+ let meetingContext = "";
let isMeetingNote = false;
+ let knownPeople: MentionPerson[] = [];
if (rawTranscript) {
const segments = parseTranscriptSegments(rawTranscript);
if (segments.length > 0) {
isMeetingNote = true;
- formattedTranscript = segments
- .map(
- (s) =>
- `${s.source === "mic" ? t("notes.speaker.you") : t("notes.speaker.them")}: ${s.text}`
- )
- .join("\n");
+ const mappingRows =
+ (await window.electronAPI
+ ?.getSpeakerMappings?.(editorNote.id)
+ .catch(() => [])) || [];
+ const speakerMappings: Record<string, string> = {};
+ for (const m of mappingRows) speakerMappings[m.speaker_id] = m.display_name;
+
+ const identity: MeetingIdentity = {
+ selfName: user?.name?.trim() || null,
+ selfEmail: user?.email?.trim() || null,
+ participants: parseNoteParticipants(editorNote.participants),
+ };
+ const selfLabel = identity.selfName || t("notes.speaker.you");
+ meetingContext = buildMeetingContext(identity, selfLabel);
+ formattedTranscript = buildLlmTranscript(
+ segments,
+ speakerMappings,
+ selfLabel,
+ t
+ );
+ knownPeople = collectKnownPeople(identity, speakerMappings, segments);
}
if (!formattedTranscript) {
formattedTranscript = rawTranscript;
@@ -779,6 +814,7 @@ export default function PersonalNotesView({
const parts = [
hasNotes ? noteContent : "",
+ meetingContext,
formattedTranscript ? `## Meeting Transcript\n${formattedTranscript}` : "",
]
.filter(Boolean)
@@ -787,6 +823,7 @@ export default function PersonalNotesView({
isCloudMode,
modelId: effectiveModelId,
isMeetingNote,
+ knownPeople,
allowTitleGeneration: isRegenerableNoteTitle(
editorNote.title,
[
diff --git a/src/components/ui/MentionChip.tsx b/src/components/ui/MentionChip.tsx
new file mode 100644
index 000000000..bb413addc
--- /dev/null
+++ b/src/components/ui/MentionChip.tsx
@@ -0,0 +1,20 @@
+import { NodeViewWrapper, type NodeViewProps } from "@tiptap/react";
+import PersonAvatar from "./PersonAvatar";
+
+/** Inline chip rendered for a mention node — avatar + name. */
+export default function MentionChip({ node }: NodeViewProps) {
+ const label = node.attrs.label as string;
+ const email = node.attrs.email as string | null;
+ return (
+ <NodeViewWrapper as="span" className="inline-flex items-baseline align-baseline mx-px">
+ <span
+ data-mention
+ title={email ?? undefined}
+ className="inline-flex items-center gap-1 rounded-md border border-border/50 bg-foreground/4 dark:bg-white/6 px-1 py-px text-[0.85em] font-medium leading-tight text-foreground/80 whitespace-nowrap"
+ >
+ <PersonAvatar email={email} displayName={label} size={13} />
+ {label}
+ </span>
+ </NodeViewWrapper>
+ );
+}
diff --git a/src/components/ui/MentionSuggestions.tsx b/src/components/ui/MentionSuggestions.tsx
new file mode 100644
index 000000000..7cacf5c6c
--- /dev/null
+++ b/src/components/ui/MentionSuggestions.tsx
@@ -0,0 +1,79 @@
+import { forwardRef, useEffect, useImperativeHandle, useState } from "react";
+import type { MentionNodeAttrs } from "@tiptap/extension-mention";
+import PersonAvatar from "./PersonAvatar";
+import { cn } from "../lib/utils";
+
+/** Conforms to MentionNodeAttrs so it can flow through the suggestion plugin. */
+export interface MentionSuggestionItem extends MentionNodeAttrs {
+ label: string;
+ email: string | null;
+}
+
+export interface MentionSuggestionsProps {
+ items: MentionSuggestionItem[];
+ command: (item: MentionSuggestionItem) => void;
+}
+
+export interface MentionSuggestionsHandle {
+ onKeyDown: (event: KeyboardEvent) => boolean;
+}
+
+/** Keyboard-navigable @mention picker rendered next to the editor caret. */
+const MentionSuggestions = forwardRef<MentionSuggestionsHandle, MentionSuggestionsProps>(
+ function MentionSuggestions({ items, command }, ref) {
+ const [selectedIndex, setSelectedIndex] = useState(0);
+
+ useEffect(() => setSelectedIndex(0), [items]);
+
+ useImperativeHandle(
+ ref,
+ () => ({
+ onKeyDown: (event) => {
+ if (items.length === 0) return false;
+ if (event.key === "ArrowDown") {
+ setSelectedIndex((i) => (i + 1) % items.length);
+ return true;
+ }
+ if (event.key === "ArrowUp") {
+ setSelectedIndex((i) => (i - 1 + items.length) % items.length);
+ return true;
+ }
+ if (event.key === "Enter" || event.key === "Tab") {
+ const item = items[selectedIndex];
+ if (item) command(item);
+ return true;
+ }
+ return false;
+ },
+ }),
+ [items, selectedIndex, command]
+ );
+
+ if (items.length === 0) return null;
+
+ return (
+ <div className="w-60 rounded-md border border-border bg-popover p-1 shadow-lg">
+ {items.map((item, index) => (
+ <button
+ key={`${item.label}-${item.email ?? index}`}
+ onMouseDown={(event) => event.preventDefault()}
+ onClick={() => command(item)}
+ onMouseEnter={() => setSelectedIndex(index)}
+ className={cn(
+ "flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs text-foreground/70 transition-colors cursor-pointer",
+ index === selectedIndex && "bg-foreground/5 text-foreground"
+ )}
+ >
+ <PersonAvatar email={item.email} displayName={item.label} size={20} />
+ <span className="min-w-0 flex-1 truncate">{item.label}</span>
+ {item.email && (
+ <span className="truncate text-[11px] text-foreground/30">{item.email}</span>
+ )}
+ </button>
+ ))}
+ </div>
+ );
+ }
+);
+
+export default MentionSuggestions;
diff --git a/src/components/ui/PersonAvatar.tsx b/src/components/ui/PersonAvatar.tsx
new file mode 100644
index 000000000..1bc1ad2c4
--- /dev/null
+++ b/src/components/ui/PersonAvatar.tsx
@@ -0,0 +1,76 @@
+import { useEffect, useState } from "react";
+import { cn } from "../lib/utils";
+
+function getInitial(displayName: string | null, email: string | null): string {
+ return (displayName || email || "?").charAt(0).toUpperCase();
+}
+
+function getInitialColor(seed: string): string {
+ let hash = 0;
+ for (let i = 0; i < seed.length; i++) {
+ hash = seed.charCodeAt(i) + ((hash << 5) - hash);
+ }
+ return `hsl(${Math.abs(hash) % 360}, 45%, 65%)`;
+}
+
+interface PersonAvatarProps {
+ email: string | null;
+ displayName: string | null;
+ /** Diameter in px. */
+ size?: number;
+ className?: string;
+}
+
+/** Gravatar avatar with a colored-initial fallback. Fetches its own MD5 hash. */
+export default function PersonAvatar({
+ email,
+ displayName,
+ size = 24,
+ className,
+}: PersonAvatarProps) {
+ const [hash, setHash] = useState<string | null>(null);
+ const [failed, setFailed] = useState(false);
+
+ useEffect(() => {
+ setHash(null);
+ setFailed(false);
+ if (!email) return;
+ let cancelled = false;
+ window.electronAPI?.getMD5Hash?.(email).then((result) => {
+ if (!cancelled) setHash(result);
+ });
+ return () => {
+ cancelled = true;
+ };
+ }, [email]);
+
+ if (hash && !failed) {
+ return (
+ <img
+ src={`https://www.gravatar.com/avatar/${hash}?d=404&s=${Math.min(512, size * 2)}`}
+ alt=""
+ loading="lazy"
+ style={{ width: size, height: size }}
+ className={cn("shrink-0 rounded-full object-cover", className)}
+ onError={() => setFailed(true)}
+ />
+ );
+ }
+
+ return (
+ <span
+ style={{
+ width: size,
+ height: size,
+ fontSize: Math.max(8, Math.round(size * 0.42)),
+ backgroundColor: getInitialColor(email || displayName || "?"),
+ }}
+ className={cn(
+ "shrink-0 rounded-full flex items-center justify-center font-medium text-white",
+ className
+ )}
+ >
+ {getInitial(displayName, email)}
+ </span>
+ );
+}
diff --git a/src/components/ui/RichTextEditor.tsx b/src/components/ui/RichTextEditor.tsx
index 1d679eff3..c0c4d9f72 100644
--- a/src/components/ui/RichTextEditor.tsx
+++ b/src/components/ui/RichTextEditor.tsx
@@ -6,6 +6,8 @@ import TaskItem from "@tiptap/extension-task-item";
import Placeholder from "@tiptap/extension-placeholder";
import { Markdown } from "tiptap-markdown";
import { cn } from "../lib/utils";
+import { createMentionExtension } from "./RichTextEditorMention";
+import type { MentionPerson } from "../../utils/mentionMarkdown";
interface RichTextEditorProps {
value: string;
@@ -14,6 +16,8 @@ interface RichTextEditorProps {
className?: string;
disabled?: boolean;
editorRef?: MutableRefObject<Editor | null>;
+ /** Enables @mention tagging with these people as suggestions. */
+ mentionPeople?: MentionPerson[];
}
export function RichTextEditor({
@@ -23,12 +27,22 @@ export function RichTextEditor({
className,
disabled,
editorRef,
+ mentionPeople,
}: RichTextEditorProps) {
const internalValueRef = useRef(value);
const suppressUpdateRef = useRef(false);
+ // Mention support is decided at mount; the ref keeps suggestions current
+ // without rebuilding the editor when the people list changes.
+ const mentionPeopleRef = useRef(mentionPeople);
+ useEffect(() => {
+ mentionPeopleRef.current = mentionPeople;
+ }, [mentionPeople]);
+ const withMentions = useRef(mentionPeople != null).current;
+
const editor = useEditor({
extensions: [
+ ...(withMentions ? [createMentionExtension(() => mentionPeopleRef.current ?? [])] : []),
StarterKit.configure({
heading: { levels: [1, 2, 3] },
bulletList: { keepMarks: true },
diff --git a/src/components/ui/RichTextEditorMention.tsx b/src/components/ui/RichTextEditorMention.tsx
new file mode 100644
index 000000000..f867c5b6a
--- /dev/null
+++ b/src/components/ui/RichTextEditorMention.tsx
@@ -0,0 +1,151 @@
+import { mergeAttributes } from "@tiptap/core";
+import Mention, { type MentionNodeAttrs } from "@tiptap/extension-mention";
+import { ReactNodeViewRenderer, ReactRenderer, type NodeViewProps } from "@tiptap/react";
+import type { SuggestionOptions } from "@tiptap/suggestion";
+import MentionChip from "./MentionChip";
+import MentionSuggestions, {
+ type MentionSuggestionItem,
+ type MentionSuggestionsHandle,
+ type MentionSuggestionsProps,
+} from "./MentionSuggestions";
+import {
+ MENTION_HREF_PREFIX,
+ buildMentionMarkdown,
+ parseMentionEmail,
+ type MentionPerson,
+} from "../../utils/mentionMarkdown";
+
+const SUGGESTION_WIDTH = 240;
+
+const suggestionRender: SuggestionOptions<
+ MentionSuggestionItem,
+ MentionNodeAttrs
+>["render"] = () => {
+ let component: ReactRenderer<MentionSuggestionsHandle, MentionSuggestionsProps> | null = null;
+
+ const position = (clientRect?: (() => DOMRect | null) | null) => {
+ const element = component?.element as HTMLElement | undefined;
+ const rect = clientRect?.();
+ if (!element || !rect) return;
+ element.style.position = "fixed";
+ element.style.zIndex = "9999";
+ element.style.left = `${Math.max(8, Math.min(rect.left, window.innerWidth - SUGGESTION_WIDTH - 8))}px`;
+ element.style.top = `${rect.bottom + 6}px`;
+ };
+
+ return {
+ onStart: (props) => {
+ component = new ReactRenderer(MentionSuggestions, {
+ props: { items: props.items, command: props.command },
+ editor: props.editor,
+ });
+ document.body.appendChild(component.element);
+ position(props.clientRect);
+ },
+ onUpdate: (props) => {
+ if (!component) return;
+ (component.element as HTMLElement).style.display = "";
+ component.updateProps({ items: props.items, command: props.command });
+ position(props.clientRect);
+ },
+ onKeyDown: (props) => {
+ if (props.event.key === "Escape") {
+ if (component) (component.element as HTMLElement).style.display = "none";
+ return true;
+ }
+ return component?.ref?.onKeyDown(props.event) ?? false;
+ },
+ onExit: () => {
+ component?.element.remove();
+ component?.destroy();
+ component = null;
+ },
+ };
+};
+
+const toSuggestionItems = (people: MentionPerson[], query: string): MentionSuggestionItem[] => {
+ const q = query.toLowerCase();
+ return people
+ .filter((p) => !q || p.name.toLowerCase().includes(q) || p.email?.toLowerCase().includes(q))
+ .slice(0, 6)
+ .map((p) => ({ id: p.email ?? p.name, label: p.name, email: p.email }));
+};
+
+/**
+ * Mention extension that round-trips through tiptap-markdown as a
+ * `[@Name](mention:email)` link — see buildMentionMarkdown. `getPeople` is
+ * read lazily so suggestions always reflect the latest known people without
+ * rebuilding the editor.
+ */
+export function createMentionExtension(getPeople: () => MentionPerson[]) {
+ return Mention.extend({
+ addAttributes() {
+ return {
+ label: { default: "" },
+ email: { default: null },
+ };
+ },
+ parseHTML() {
+ return [
+ {
+ tag: `a[href^="${MENTION_HREF_PREFIX}"]`,
+ priority: 100,
+ getAttrs: (element) => {
+ const label = (element.textContent || "").replace(/^@/, "").trim();
+ if (!label) return false;
+ return { label, email: parseMentionEmail(element.getAttribute("href")) };
+ },
+ },
+ ];
+ },
+ renderHTML({ node, HTMLAttributes }) {
+ const label = node.attrs.label as string;
+ const email = node.attrs.email as string | null;
+ return [
+ "a",
+ mergeAttributes(HTMLAttributes, {
+ href: `${MENTION_HREF_PREFIX}${encodeURIComponent(email || label)}`,
+ "data-mention": "",
+ }),
+ `@${label}`,
+ ];
+ },
+ renderText({ node }) {
+ return `@${node.attrs.label}`;
+ },
+ addNodeView() {
+ return ReactNodeViewRenderer(MentionChip);
+ },
+ addStorage() {
+ return {
+ markdown: {
+ serialize(state: { write: (content: string) => void }, node: NodeViewProps["node"]) {
+ state.write(
+ buildMentionMarkdown({
+ name: node.attrs.label as string,
+ email: node.attrs.email as string | null,
+ })
+ );
+ },
+ parse: {},
+ },
+ };
+ },
+ }).configure({
+ suggestion: {
+ items: ({ query }) => toSuggestionItems(getPeople(), query),
+ command: ({ editor, range, props }) => {
+ const item = props as MentionSuggestionItem;
+ editor
+ .chain()
+ .focus()
+ .insertContentAt(range, [
+ { type: "mention", attrs: { label: item.label, email: item.email } },
+ { type: "text", text: " " },
+ ])
+ .run();
+ },
+ render: suggestionRender,
+ },
+ });
+}
diff --git a/src/stores/actionProcessingStore.ts b/src/stores/actionProcessingStore.ts
index aa19a9b40..175d123fa 100644
--- a/src/stores/actionProcessingStore.ts
+++ b/src/stores/actionProcessingStore.ts
@@ -4,6 +4,7 @@ import { getSettings, selectResolvedNoteFormatting } from "./settingsStore";
import { appendDictionarySuffix } from "../config/prompts";
import { generateNoteTitle } from "../utils/generateTitle";
import { buildNoteFormattingOverrides } from "../helpers/noteFormattingOverrides";
+import { tagActionItemOwners, type MentionPerson } from "../utils/mentionMarkdown";
import type { ActionItem } from "../types/electron";
export type ActionProcessingStatus = "idle" | "processing" | "success";
@@ -64,17 +65,18 @@ FORMAT RULES (strict):
Instructions: `;
-const MEETING_SYSTEM_PROMPT = `You are a professional meeting notes assistant. You will receive a dual-speaker transcript where "You:" marks the user's speech and "Them:" marks the other participant(s), along with any manual notes the user took.
+const MEETING_SYSTEM_PROMPT = `You are a professional meeting notes assistant. You will receive a meeting transcript where each line is prefixed with the speaker's label — a real name when known, otherwise "You" (the note owner), "Them", or "Speaker N". A "## Meeting Context" block may identify the note owner and the invited participants. Manual notes the user took may be included as well.
Your job is to produce clean, actionable meeting notes in markdown. Follow these rules:
FORMAT RULES (strict):
- Do NOT include any preamble: no title, no "# Meeting Notes", no date/time/location, no attendee list, no topic header. Start directly with the summary.
+- Do NOT reproduce the Meeting Context block in the output.
- Do NOT use tables, horizontal rules, or block quotes.
-- Do NOT list or guess participant names/roles.
+- Refer to people only by the speaker labels used in the transcript. NEVER guess or invent an identity: the note owner is who the Meeting Context says they are — never a name mentioned in conversation. Keep unnamed speakers as "Them" or "Speaker N".
- Start with a concise 1–2 sentence summary of what the meeting was about.
- Use clear section headings: ## Key Discussion Points, ## Decisions Made, ## Action Items, ## Follow-ups (omit any section that has no content).
-- Under Action Items, use checkboxes (\`- [ ]\`) and attribute each item to "You" or "Them" where clear.
+- Under Action Items, use checkboxes in the format \`- [ ] Action — Owner\`, attributing each item to its owner by speaker label where clear.
CONTENT RULES:
- Preserve important quotes or specific commitments verbatim when they carry meaning.
@@ -91,6 +93,8 @@ export interface RunActionOptions {
isMeetingNote?: boolean;
/** Opt-in so enhancement never renames a note the user has titled. */
allowTitleGeneration?: boolean;
+ /** People whose names in generated action-item owners become mention tags. */
+ knownPeople?: MentionPerson[];
}
export interface RunActionLabels {
@@ -158,7 +162,9 @@ export function runBackgroundAction(
if (cancelledFlags.get(noteId)) return;
const updates: Record<string, string> = {
- enhanced_content: enhanced,
+ enhanced_content: options.knownPeople?.length
+ ? tagActionItemOwners(enhanced, options.knownPeople)
+ : enhanced,
enhancement_prompt: action.prompt,
enhanced_at_content_hash: contentHash,
};
diff --git a/src/utils/llmTranscript.ts b/src/utils/llmTranscript.ts
new file mode 100644
index 000000000..e53c6666c
--- /dev/null
+++ b/src/utils/llmTranscript.ts
@@ -0,0 +1,105 @@
+import type { TranscriptSegment } from "../stores/meetingRecordingStore";
+import type { CalendarAttendee } from "../types/calendar";
+import { resolveSegmentSpeakerName } from "./transcriptSpeakerState";
+import type { MentionPerson } from "./mentionMarkdown";
+
+type Translate = (key: string, options?: Record<string, unknown>) => string;
+
+export interface MeetingIdentity {
+ selfName: string | null;
+ selfEmail: string | null;
+ participants: CalendarAttendee[];
+}
+
+const isSelfParticipant = (participant: CalendarAttendee, identity: MeetingIdentity) =>
+ participant.self || (!!identity.selfEmail && participant.email === identity.selfEmail);
+
+/**
+ * Speaker label for the LLM payload. Mirrors the precedence the exporter
+ * applies in transcriptFormatter.js: explicit name → cluster mapping →
+ * "Speaker N" → source fallback. The mic track is the note owner, so it
+ * carries their real name instead of an anonymous "You" whenever it is known.
+ */
+export function resolveLlmSpeakerLabel(
+ segment: TranscriptSegment,
+ speakerMappings: Record<string, string>,
+ selfLabel: string,
+ t: Translate
+): string {
+ if (segment.source === "mic" || segment.speaker === "you") return selfLabel;
+ const resolved = resolveSegmentSpeakerName(segment, speakerMappings);
+ if (resolved) return resolved;
+ if (segment.speaker) {
+ const num = Number.parseInt(segment.speaker.replace("speaker_", ""), 10);
+ if (!Number.isNaN(num)) return t("notes.speaker.label", { n: num + 1 });
+ }
+ return t("notes.speaker.them");
+}
+
+export function buildLlmTranscript(
+ segments: TranscriptSegment[],
+ speakerMappings: Record<string, string>,
+ selfLabel: string,
+ t: Translate
+): string {
+ return segments
+ .map((s) => `${resolveLlmSpeakerLabel(s, speakerMappings, selfLabel, t)}: ${s.text}`)
+ .join("\n");
+}
+
+const formatPerson = (name: string | null, email: string | null): string => {
+ const trimmedName = name?.trim() || "";
+ const trimmedEmail = email?.trim() || "";
+ if (trimmedName && trimmedEmail) return `${trimmedName} <${trimmedEmail}>`;
+ return trimmedName || trimmedEmail;
+};
+
+/**
+ * Context block prepended to the LLM payload so note generation knows who the
+ * note owner is (instead of guessing an identity from names spoken in the
+ * transcript) and who was invited.
+ */
+export function buildMeetingContext(identity: MeetingIdentity, selfLabel: string): string {
+ const lines: string[] = [];
+ const self = formatPerson(identity.selfName, identity.selfEmail);
+ if (self) {
+ lines.push(`The user taking these notes ("${selfLabel}" in the transcript) is ${self}.`);
+ }
+ const invited = identity.participants
+ .filter((p) => !isSelfParticipant(p, identity))
+ .map((p) => formatPerson(p.displayName, p.email))
+ .filter(Boolean);
+ if (invited.length > 0) lines.push(`Invited participants: ${invited.join(", ")}.`);
+ return lines.length > 0 ? `## Meeting Context\n${lines.join("\n")}` : "";
+}
+
+/**
+ * Everyone we can name around a note — the note owner, calendar participants,
+ * mapped speaker clusters, and named segments — deduplicated by display name.
+ * Feeds the editor's @mention suggestions and action-item owner tagging.
+ */
+export function collectKnownPeople(
+ identity: MeetingIdentity,
+ speakerMappings: Record<string, string>,
+ segments: TranscriptSegment[]
+): MentionPerson[] {
+ const people: MentionPerson[] = [];
+ const seen = new Set<string>();
+ const push = (name: string | null | undefined, email: string | null | undefined) => {
+ const trimmed = name?.trim();
+ if (!trimmed) return;
+ const key = trimmed.toLowerCase();
+ if (seen.has(key)) return;
+ seen.add(key);
+ people.push({ name: trimmed, email: email?.trim() || null });
+ };
+
+ push(identity.selfName, identity.selfEmail);
+ for (const p of identity.participants) {
+ if (isSelfParticipant(p, identity)) continue;
+ push(p.displayName || p.email.split("@")[0], p.email);
+ }
+ for (const name of Object.values(speakerMappings)) push(name, null);
+ for (const segment of segments) push(segment.speakerName, null);
+ return people;
+}
diff --git a/src/utils/mentionMarkdown.ts b/src/utils/mentionMarkdown.ts
new file mode 100644
index 000000000..f8de295a6
--- /dev/null
+++ b/src/utils/mentionMarkdown.ts
@@ -0,0 +1,91 @@
+export interface MentionPerson {
+ name: string;
+ email: string | null;
+}
+
+export const MENTION_HREF_PREFIX = "mention:";
+
+const sanitizeLabel = (name: string) =>
+ name
+ .replace(/[[\]\n]/g, " ")
+ .replace(/\s+/g, " ")
+ .trim();
+
+// encodeURIComponent leaves ( and ) alone, which would end the markdown link early.
+const encodeMentionId = (id: string) =>
+ encodeURIComponent(id).replace(/[()]/g, (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`);
+
+/** A mention serializes as a plain markdown link, so exports and other markdown
+ * consumers degrade to a readable `@Name` link instead of losing the tag. */
+export function buildMentionMarkdown(person: MentionPerson): string {
+ const label = sanitizeLabel(person.name);
+ return `[@${label}](${MENTION_HREF_PREFIX}${encodeMentionId(person.email || label)})`;
+}
+
+export function parseMentionEmail(href: string | null): string | null {
+ if (!href?.startsWith(MENTION_HREF_PREFIX)) return null;
+ try {
+ const id = decodeURIComponent(href.slice(MENTION_HREF_PREFIX.length));
+ return id.includes("@") ? id : null;
+ } catch {
+ return null;
+ }
+}
+
+const TASK_OWNER_LINE = /^(\s*[-*]\s*\[[ xX]\]\s+\S.*?)(\s+[—–-]\s+)(\S.*?)\s*$/;
+const OWNER_SPLIT = /\s*(?:,|&|\/|\band\b)\s*/i;
+
+interface NameIndex {
+ byFullName: Map<string, MentionPerson>;
+ byFirstName: Map<string, MentionPerson | null>;
+}
+
+function buildNameIndex(people: MentionPerson[]): NameIndex {
+ const byFullName = new Map<string, MentionPerson>();
+ for (const person of people) {
+ const name = sanitizeLabel(person.name).toLowerCase();
+ if (name && !byFullName.has(name)) byFullName.set(name, person);
+ }
+ // First names resolve only when unambiguous across all known people.
+ const byFirstName = new Map<string, MentionPerson | null>();
+ for (const [fullName, person] of byFullName) {
+ const first = fullName.split(" ")[0];
+ byFirstName.set(first, byFirstName.has(first) ? null : person);
+ }
+ return { byFullName, byFirstName };
+}
+
+function matchOwner(raw: string, index: NameIndex): MentionPerson | null {
+ const owner = raw.trim().replace(/^@/, "").replace(/[.:]$/, "").toLowerCase();
+ if (!owner) return null;
+ return index.byFullName.get(owner) ?? index.byFirstName.get(owner) ?? null;
+}
+
+/**
+ * Converts the trailing owner of `- [ ] Action — Owner` checkbox lines into
+ * mention links when the owner matches a known person, so generated action
+ * items render as tagged owner chips in the editor. Lines with unknown or
+ * ambiguous owners are left untouched.
+ */
+export function tagActionItemOwners(markdown: string, people: MentionPerson[]): string {
+ if (!markdown || people.length === 0) return markdown;
+ const index = buildNameIndex(people);
+ if (index.byFullName.size === 0) return markdown;
+
+ return markdown
+ .split("\n")
+ .map((line) => {
+ if (line.includes(MENTION_HREF_PREFIX)) return line;
+ const match = line.match(TASK_OWNER_LINE);
+ if (!match) return line;
+ const [, task, separator, ownerText] = match;
+ const parts = ownerText.split(OWNER_SPLIT).filter(Boolean);
+ if (parts.length === 0) return line;
+ const owners = parts.map((part) => matchOwner(part, index));
+ if (owners.some((owner) => owner == null)) return line;
+ return `${task}${separator}${owners
+ .map((owner) => buildMentionMarkdown(owner as MentionPerson))
+ .join(", ")}`;
+ })
+ .join("\n");
+}
diff --git a/test/utils/llmTranscript.test.js b/test/utils/llmTranscript.test.js
new file mode 100644
index 000000000..b26cd8c60
--- /dev/null
+++ b/test/utils/llmTranscript.test.js
@@ -0,0 +1,117 @@
+const test = require("node:test");
+const assert = require("node:assert/strict");
+
+const load = () => import("../../src/utils/llmTranscript.ts");
+
+const t = (key, options) => {
+ if (key === "notes.speaker.label") return `Speaker ${options.n}`;
+ if (key === "notes.speaker.them") return "Them";
+ if (key === "notes.speaker.you") return "You";
+ return key;
+};
+
+const attendee = (email, displayName, self = false) => ({
+ email,
+ displayName,
+ responseStatus: null,
+ self,
+});
+
+test("mic segments carry the note owner's label", async () => {
+ const { resolveLlmSpeakerLabel } = await load();
+ assert.equal(resolveLlmSpeakerLabel({ source: "mic", text: "hi" }, {}, "Gabriel Stein", t), "Gabriel Stein");
+ assert.equal(
+ resolveLlmSpeakerLabel({ source: "system", speaker: "you", text: "hi" }, {}, "Gabriel Stein", t),
+ "Gabriel Stein"
+ );
+});
+
+test("system segments resolve name → mapping → Speaker N → Them", async () => {
+ const { resolveLlmSpeakerLabel } = await load();
+ const locked = {
+ source: "system",
+ speaker: "speaker_0",
+ speakerName: "Michael",
+ speakerLocked: true,
+ text: "hi",
+ };
+ assert.equal(resolveLlmSpeakerLabel(locked, { speaker_0: "Wrong" }, "You", t), "Michael");
+ assert.equal(
+ resolveLlmSpeakerLabel({ source: "system", speaker: "speaker_1", text: "hi" }, { speaker_1: "Sean" }, "You", t),
+ "Sean"
+ );
+ assert.equal(
+ resolveLlmSpeakerLabel({ source: "system", speaker: "speaker_2", text: "hi" }, {}, "You", t),
+ "Speaker 3"
+ );
+ assert.equal(resolveLlmSpeakerLabel({ source: "system", text: "hi" }, {}, "You", t), "Them");
+});
+
+test("buildLlmTranscript prefixes every line with the resolved label", async () => {
+ const { buildLlmTranscript } = await load();
+ const segments = [
+ { source: "mic", text: "Morning everyone" },
+ { source: "system", speaker: "speaker_0", text: "Morning" },
+ ];
+ assert.equal(
+ buildLlmTranscript(segments, { speaker_0: "Michael" }, "Gabriel", t),
+ "Gabriel: Morning everyone\nMichael: Morning"
+ );
+});
+
+test("buildMeetingContext names the owner and invited participants", async () => {
+ const { buildMeetingContext } = await load();
+ const identity = {
+ selfName: "Gabriel Stein",
+ selfEmail: "[email protected]",
+ participants: [
+ attendee("[email protected]", "Gabriel Stein", true),
+ attendee("[email protected]", "Michael Chen"),
+ attendee("[email protected]", null),
+ ],
+ };
+ assert.equal(
+ buildMeetingContext(identity, "Gabriel Stein"),
+ [
+ "## Meeting Context",
+ 'The user taking these notes ("Gabriel Stein" in the transcript) is Gabriel Stein <[email protected]>.',
+ "Invited participants: Michael Chen <[email protected]>, [email protected].",
+ ].join("\n")
+ );
+});
+
+test("buildMeetingContext omits what it does not know", async () => {
+ const { buildMeetingContext } = await load();
+ assert.equal(buildMeetingContext({ selfName: null, selfEmail: null, participants: [] }, "You"), "");
+ assert.equal(
+ buildMeetingContext(
+ { selfName: null, selfEmail: null, participants: [attendee("[email protected]", "Ada")] },
+ "You"
+ ),
+ "## Meeting Context\nInvited participants: Ada <[email protected]>."
+ );
+});
+
+test("collectKnownPeople merges owner, participants, mappings, and named segments", async () => {
+ const { collectKnownPeople } = await load();
+ const people = collectKnownPeople(
+ {
+ selfName: "Gabriel Stein",
+ selfEmail: "[email protected]",
+ participants: [
+ attendee("[email protected]", "Gabriel Stein", true),
+ attendee("[email protected]", "Michael Chen"),
+ attendee("[email protected]", null),
+ ],
+ },
+ { speaker_0: "Michael Chen", speaker_1: "Priya" },
+ [{ source: "system", speaker: "speaker_2", speakerName: "Ada", text: "hi" }]
+ );
+ assert.deepEqual(people, [
+ { name: "Gabriel Stein", email: "[email protected]" },
+ { name: "Michael Chen", email: "[email protected]" },
+ { name: "sean", email: "[email protected]" },
+ { name: "Priya", email: null },
+ { name: "Ada", email: null },
+ ]);
+});
diff --git a/test/utils/mentionMarkdown.test.js b/test/utils/mentionMarkdown.test.js
new file mode 100644
index 000000000..8640af118
--- /dev/null
+++ b/test/utils/mentionMarkdown.test.js
@@ -0,0 +1,99 @@
+const test = require("node:test");
+const assert = require("node:assert/strict");
+
+const load = () => import("../../src/utils/mentionMarkdown.ts");
+
+const PEOPLE = [
+ { name: "Gabriel Stein", email: "[email protected]" },
+ { name: "Michael Chen", email: "[email protected]" },
+ { name: "Sean", email: null },
+];
+
+test("buildMentionMarkdown links the email when present", async () => {
+ const { buildMentionMarkdown } = await load();
+ assert.equal(
+ buildMentionMarkdown({ name: "Michael Chen", email: "[email protected]" }),
+ "[@Michael Chen](mention:michael%40acme.com)"
+ );
+});
+
+test("buildMentionMarkdown falls back to the name and escapes link-breaking chars", async () => {
+ const { buildMentionMarkdown } = await load();
+ assert.equal(buildMentionMarkdown({ name: "Sean", email: null }), "[@Sean](mention:Sean)");
+ // Parens would end the markdown link destination early; brackets break the label.
+ assert.equal(
+ buildMentionMarkdown({ name: "Ana (PM)", email: null }),
+ "[@Ana (PM)](mention:Ana%20%28PM%29)"
+ );
+ assert.equal(
+ buildMentionMarkdown({ name: "Bob [ops]", email: null }),
+ "[@Bob ops](mention:Bob%20ops)"
+ );
+});
+
+test("parseMentionEmail extracts emails and rejects everything else", async () => {
+ const { parseMentionEmail } = await load();
+ assert.equal(parseMentionEmail("mention:michael%40acme.com"), "[email protected]");
+ assert.equal(parseMentionEmail("mention:Sean"), null);
+ assert.equal(parseMentionEmail("https://example.com"), null);
+ assert.equal(parseMentionEmail(null), null);
+ assert.equal(parseMentionEmail("mention:%E0%A4%A"), null);
+});
+
+test("tags a full-name owner on a checkbox line", async () => {
+ const { tagActionItemOwners } = await load();
+ assert.equal(
+ tagActionItemOwners("- [ ] Send the deck — Michael Chen", PEOPLE),
+ "- [ ] Send the deck — [@Michael Chen](mention:michael%40acme.com)"
+ );
+});
+
+test("tags by unique first name, case-insensitively", async () => {
+ const { tagActionItemOwners } = await load();
+ assert.equal(
+ tagActionItemOwners("- [x] Review PR - michael", PEOPLE),
+ "- [x] Review PR - [@Michael Chen](mention:michael%40acme.com)"
+ );
+});
+
+test("leaves ambiguous first names untouched", async () => {
+ const { tagActionItemOwners } = await load();
+ const people = [
+ { name: "Michael Chen", email: "[email protected]" },
+ { name: "Michael Ross", email: "[email protected]" },
+ ];
+ const line = "- [ ] Review PR — Michael";
+ assert.equal(tagActionItemOwners(line, people), line);
+});
+
+test("tags multiple owners only when every owner is known", async () => {
+ const { tagActionItemOwners } = await load();
+ assert.equal(
+ tagActionItemOwners("- [ ] Draft the plan — Sean and Michael", PEOPLE),
+ "- [ ] Draft the plan — [@Sean](mention:Sean), [@Michael Chen](mention:michael%40acme.com)"
+ );
+ const partiallyUnknown = "- [ ] Draft the plan — Sean and Priya";
+ assert.equal(tagActionItemOwners(partiallyUnknown, PEOPLE), partiallyUnknown);
+});
+
+test("ignores unknown owners, non-task lines, and already-tagged lines", async () => {
+ const { tagActionItemOwners } = await load();
+ const unknown = "- [ ] Follow up — Priya";
+ assert.equal(tagActionItemOwners(unknown, PEOPLE), unknown);
+
+ const prose = "We agreed — Michael will follow up.";
+ assert.equal(tagActionItemOwners(prose, PEOPLE), prose);
+
+ const tagged = "- [ ] Send the deck — [@Michael Chen](mention:michael%40acme.com)";
+ assert.equal(tagActionItemOwners(tagged, PEOPLE), tagged);
+});
+
+test("handles multi-line markdown and empty people", async () => {
+ const { tagActionItemOwners } = await load();
+ const markdown = ["## Action Items", "- [ ] Ship it — Sean", "- [ ] Untouched text"].join("\n");
+ assert.equal(
+ tagActionItemOwners(markdown, PEOPLE),
+ ["## Action Items", "- [ ] Ship it — [@Sean](mention:Sean)", "- [ ] Untouched text"].join("\n")
+ );
+ assert.equal(tagActionItemOwners(markdown, []), markdown);
+});