Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
fix(notes): clarify action destinations and controls (#2578)
Joshua2462c78e6603
diff --git a/CLAUDE.md b/CLAUDE.mdindex abf8b1642..5b26d00e4 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -775,10 +775,10 @@ Live meeting transcription runs two streams (mic + system-audio tap) and must keRows in the `actions` table (built-ins seeded from `src/helpers/builtinActions.js`) are one of two kinds:- **Templates** (`kind: 'template'`) write a note's AI summary (`enhanced_content`) from its notes, meeting context, and transcript, never from the summary they replace. A template is a context (`prompt`) plus ordered `sections` (`{heading, instruction}`); `compileTemplatePrompt` wraps sections in the shared notes rules. A template without sections keeps the request it always had after the `SOURCE_FIDELITY_RULE` prefix (the generic system prompt, or the material preamble for a standalone key). The note records the template in `enhancement_template_id` (its `client_id`), which syncs with the note, and `enhancement_prompt` the compiled system prompt-- **Actions** (`kind: 'action'`) work from the AI summary when the note has one, and from its notes and transcript otherwise (`buildNoteRunInput`). An `output` of `summary` edits that summary (`requireCompleteOutput`, never split into parts; only `enhanced_content` is written), or with no summary yet writes one from the transcript and applies the action to it, run like a template (split into parts on a local model, the material hash recorded); `chat` runs in the note chat via `SendToAIOptions.requestText` (the chat shows a built-in's call to action where it has one, otherwise the action's name, and the preamble points the model at the summary or the transcript and has it answer in the chat as text in the note's language, using a tool to draft, send or post only when the action's instructions explicitly ask to send, post or file something; the note chat's tools and attendee block otherwise apply as usual, and its transcript context names speakers only on notes known to be the user's own (`ownsNote`), never listing the unfiltered invitees)+- **Actions** (`kind: 'action'`) work from the AI summary when the note has one, and from its notes and transcript otherwise (`buildNoteRunInput`). Only the built-in Make notes shorter (`shorten`) and Make notes longer (`lengthen`) actions edit that summary, selected by fixed built-in identity (`toActionItem`), never an editable name or stored `output`. A summary edit requires complete output, never splits into parts, and writes only `enhanced_content`; with no summary yet it writes one from the transcript and applies the action to it, run like a template (split into parts on a local model, the material hash recorded); every other built-in and custom action, including Write TL;DR (`addTldr`), runs in the note chat via `SendToAIOptions.requestText` (the chat shows a built-in's call to action where it has one, otherwise the action's name, and the preamble points the model at the summary or the transcript and has it answer in the chat as text in the note's language, using a tool to draft, send or post only when the action's instructions explicitly ask to send, post or file something; the note chat's tools and attendee block otherwise apply as usual, and its transcript context names speakers only on notes known to be the user's own (`ownsNote`), never listing the unfiltered invitees)- The default template is the built-in AI Summary (the generic prompt, stored under the old Generate Notes key `generateNotes`), listed first, then Detailed Notes (launch re-applies the built-in order). Invariant: Detailed Notes, compiled from its sections, equals the flat 1.10.2 prompt it replaced after the `SOURCE_FIDELITY_RULE` prefix every template and action prompt starts with (`sourceFidelity.js`), but for the closing rule on material with nothing to summarize (`test/helpers/templatePrompts.test.js`); a built-in's `previousPrompts` only upgrades rows that are still flat- For material with nothing substantive (only greetings, filler or recording checks), sectioned templates, AI Summary and a summary action writing a first summary ask the model to answer `NOTHING_TO_SUMMARIZE`; custom context-only templates and flat built-ins edited before this rule keep their own rules. A reply that is the marker (bare, fenced, emphasised or after a short sentence) outside a thinking block writes nothing; a summary that merely contains it is saved, and the runner shows `notes.actions.errors.nothingToSummarize` as a neutral notice (`notice` on the error event) instead of saving a placeholder summary-- UI: `TemplatePicker` opens from the chevron in the AI Summary tab, which names the note's template; the "Generate AI Summary" callout (runs the note's template, else the default), `ActionPicker` in the collapsed ask bar (runs the last action picked from it, in place of the send button), `ActionChips` once the in-view chat opens and in the docked chat (the first four actions, each with its action's icon, and All actions; hovering a chip shows its description; the in-view chat pins All actions at the end, and the docked chat shows them as filled pills in one tray with its composer: All actions, Generate summary, then the actions, scrolling together), a `/` menu in the note composers (`slashCommands` on `ChatInput`, each row with its action's icon, or a "/" for an icon this build doesn't know; it fills the chat above the composer until a command runs, the "/" is deleted, nothing matches or the composer loses focus), and `ActionManagerDialog` (Templates | Actions). The notes list and the docked chat widen or narrow from their edge facing the note (`useResizableWidth`, `PanelResizeHandle`), and keep their width across launches (localStorage `notesSidebarWidth`, `noteChatWidth`). Anything the ask bar sends (a message, or a chat action from the picker, a chip or the `/` menu) starts a new conversation in the docked chat, which holds the conversation and its history; the in-view chat is only the chips and the composer. A new action's output is Auto, Chat or AI summary (a saved one offers only the last two); Auto asks the note model on save (`inferActionOutput`) and stores chat or summary, falling back to chat. A run that writes the summary is undoable for 6 s instead of asking first: the runner queues the fields it overwrote (`appliedEvents`) and `BackgroundActionToastListener` shows the Undo toast+- UI: `TemplatePicker` opens from the chevron in the AI Summary tab, which names the note's template; the "Generate AI Summary" callout (runs the note's template, else the default), `ActionPicker` in the collapsed ask bar (runs the last action picked from it, in place of the send button), `ActionChips` once the in-view chat opens and in the docked chat (the first five actions in docked chat; the centered row omits Make notes longer without backfilling another chip; each has its action's icon, and All actions keeps every action; hovering a chip shows its icon, title and description without a destination badge; the in-view chat pins All actions at the end, and the docked chat shows them as filled pills in one tray with its composer: All actions, then the actions, scrolling together), a `/` menu in the note composers (`slashCommands` on `ChatInput`, each row with its action's icon, or a "/" for an icon this build doesn't know; it fills the chat above the composer until a command runs, the "/" is deleted, nothing matches or the composer loses focus), and `ActionManagerDialog` (Templates | Actions). The notes list and the docked chat widen or narrow from their edge facing the note (`useResizableWidth`, `PanelResizeHandle`), and keep their width across launches (localStorage `notesSidebarWidth`, `noteChatWidth`). Anything the ask bar sends (a message, or a chat action from the picker, a chip or the `/` menu) starts a new conversation in the docked chat, which holds the conversation and its history; the in-view chat is only the chips and the composer. Destinations are fixed and described in the editor; saving never asks a model to choose one. Legacy custom summary destinations read as chat (`toActionItem`), keeping the existing IPC fields, IDs and prompts. Summary generation stays in the AI Summary tab and callout. A run that writes the summary is undoable for 6 s instead of asking first: the runner queues the fields it overwrote (`appliedEvents`) and `BackgroundActionToastListener` shows the Undo toast## Development Guidelines@@ -812,7 +812,7 @@ const { t } = useTranslation();Raster UI assets live in `src/assets/` (onboarding ones are named `onboarding-*`). Vector provider/brand marks live in `src/assets/icons/`.-UI icons come from `src/components/icons/` (vendored Nucleo core outline components behind lucide-style names, e.g. `import { Check, Loader2 } from "../icons"`). To add one, map a name to a Nucleo label in `src/components/icons/nucleo-map.json` and run `node scripts/sync-nucleo-icons.js`; never import from `lucide-react` or a machine-local Nucleo path. Icons outside that set — the status marks, the note toolbar's formatting glyphs, the note chat's rounded copy and "/" glyphs, and the design's action icons (`TextCursorInput`, `ListEnd`, `FolderRounded`) — are drawn by hand in `src/components/icons/primitives.tsx`, which the generated `index.ts` re-exports.+UI icons come from `src/components/icons/` (vendored Nucleo core outline components behind lucide-style names, e.g. `import { Check, Loader2 } from "../icons"`). To add one, map a name to a Nucleo label in `src/components/icons/nucleo-map.json` and run `node scripts/sync-nucleo-icons.js`; never import from `lucide-react` or a machine-local Nucleo path. Icons outside that set — the status marks, the note toolbar's formatting glyphs, the note chat's rounded copy and "/" glyphs, and the design's action icons (`ListEnd`, `FolderRounded`) — are drawn by hand in `src/components/icons/primitives.tsx`, which the generated `index.ts` re-exports.**Typography**: `--font-family-sans` is Yowza (brand, Latin only) falling back to the bundled Noto Sans; `--font-family-display` is Yowza Soft for headings. The font files are licensed and never committed — `src/brandFonts.ts` registers whatever `scripts/download-brand-fonts.js` fetched at build time, and a build without them silently uses Noto Sans.diff --git a/scripts/sync-nucleo-icons.js b/scripts/sync-nucleo-icons.jsindex e69b93021..894832ff5 100644--- a/scripts/sync-nucleo-icons.js+++ b/scripts/sync-nucleo-icons.js@@ -103,7 +103,6 @@ export {SquareSlash,Strikethrough,Table,- TextCursorInput,} from "./primitives";${exportLines.join("\n")}diff --git a/src/components/icons/index.ts b/src/components/icons/index.tsindex 8aa6cb463..d282d4438 100644--- a/src/components/icons/index.ts+++ b/src/components/icons/index.ts@@ -19,7 +19,6 @@ export {SquareSlash,Strikethrough,Table,- TextCursorInput,} from "./primitives";export const AlertCircle = createIcon("alert-circle", Nucleo.CircleWarningOutline24);diff --git a/src/components/icons/primitives.tsx b/src/components/icons/primitives.tsxindex 070b2cb53..89747ec18 100644--- a/src/components/icons/primitives.tsx+++ b/src/components/icons/primitives.tsx@@ -167,16 +167,6 @@ const ListEndMark = glyph(</>);-const TextCursorInputMark = glyph(- <>- <path d="M5 4h1a3 3 0 0 1 3 3 3 3 0 0 1 3-3h1" />- <path d="M9 7v10" />- <path d="M13 20h-1a3 3 0 0 1-3-3 3 3 0 0 1-3 3H5" />- <path d="M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1" />- <path d="M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7" />- </>-);-const TableMark = glyph(<><rect x="3" y="4" width="18" height="16" rx="2" />@@ -201,4 +191,3 @@ export const ListOrdered = createIcon("list-ordered", ListOrderedMark);export const Quote = createIcon("quote", QuoteMark);export const Strikethrough = createIcon("strikethrough", StrikethroughMark);export const Table = createIcon("table", TableMark);-export const TextCursorInput = createIcon("text-cursor-input", TextCursorInputMark);diff --git a/src/components/notes/ActionChips.tsx b/src/components/notes/ActionChips.tsxindex c397917be..8d96afb54 100644--- a/src/components/notes/ActionChips.tsx+++ b/src/components/notes/ActionChips.tsx@@ -1,14 +1,14 @@import { useState } from "react";import { useTranslation } from "react-i18next";-import { Blocks, TextCursorInput } from "../icons";+import { Blocks } from "../icons";import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent } from "../ui/dropdown-menu";import { cn } from "../lib/utils";import { getActionName, getActionDescription } from "../../stores/actionStore";import type { ActionItem } from "../../types/electron";-import ActionMenuItems, { ActionOutputBadge, type ActionMenuItemsProps } from "./ActionMenuItems";+import ActionMenuItems, { type ActionMenuItemsProps } from "./ActionMenuItems";import { getActionIcon } from "./actionIcons";-const VISIBLE_CHIPS = 4;+const VISIBLE_CHIPS = 5;const CHIP_CLASS = cn("inline-flex h-7 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-2.5 text-xs text-foreground/60",@@ -32,8 +32,6 @@ const chipEntrance = (index: number) => ({ animationDelay: `${140 + index * 40}minterface ActionChipsProps extends ActionMenuItemsProps {/** The docked chat's look: filled pills on its tray. */docked?: boolean;- /** A first pill that writes the note's AI summary; absent when the note has no template to run. */- generateSummary?: { run: () => void; disabled: boolean };}/**@@ -47,23 +45,28 @@ export default function ActionChips({onRunAction,onManageActions,docked = false,- generateSummary,}: ActionChipsProps) {const { t } = useTranslation();const [previewed, setPreviewed] = useState<ActionItem | null>(null);const description = previewed && getActionDescription(previewed, t);const chipClass = docked ? DOCKED_CHIP_CLASS : CHIP_CLASS;const PreviewedIcon = previewed && getActionIcon(previewed);+ const visibleActions = actions+ .slice(0, VISIBLE_CHIPS)+ .filter((action) => docked || action.translation_key !== "notes.actions.builtin.lengthen");// Docked, All actions leads the row and scrolls with the chips, opening toward them.- const firstChip = (docked ? 1 : 0) + (generateSummary ? 1 : 0);+ const firstChip = docked ? 1 : 0;const allActions = (<DropdownMenu><DropdownMenuTrigger asChild><buttontype="button"onPointerEnter={() => setPreviewed(null)}+ onFocus={(event) => {+ event.currentTarget.scrollIntoView({ block: "nearest", inline: "nearest" });+ }}className={chipClass}- style={chipEntrance(docked ? 0 : firstChip + Math.min(actions.length, VISIBLE_CHIPS))}+ style={chipEntrance(docked ? 0 : firstChip + visibleActions.length)}><Blocks size={14} className={CHIP_ICON_CLASS} />{t("notes.actions.allActions")}@@ -104,7 +107,6 @@ export default function ActionChips({</span>)}</span>- <ActionOutputBadge action={previewed} /></div>)}{/* Left as a row, so moving between chips swaps the card instead of replaying it. */}@@ -112,27 +114,13 @@ export default function ActionChips({{/* In the in-view chat only the chips scroll, so All actions at the end stays in reach. */}<divclassName={cn(- "scrollbar-hidden flex min-w-0 flex-1 items-center overflow-x-auto pe-6",+ "scrollbar-hidden flex min-w-0 flex-1 items-center overflow-x-auto scroll-pe-6 pe-6",docked ? "gap-1.5" : "gap-1","[mask-image:linear-gradient(to_right,#000_calc(100%_-_1.5rem),transparent)] rtl:[mask-image:linear-gradient(to_left,#000_calc(100%_-_1.5rem),transparent)]")}>{docked && allActions}- {generateSummary && (- <button- type="button"- onMouseDown={(event) => event.preventDefault()}- onClick={generateSummary.run}- onPointerEnter={() => setPreviewed(null)}- disabled={generateSummary.disabled}- className={chipClass}- style={chipEntrance(docked ? 1 : 0)}- >- <TextCursorInput size={14} className={CHIP_ICON_CLASS} />- {t("embeddedChat.generateSummary")}- </button>- )}- {actions.slice(0, VISIBLE_CHIPS).map((action, index) => {+ {visibleActions.map((action, index) => {const Icon = getActionIcon(action);return (<button@@ -147,7 +135,10 @@ export default function ActionChips({}}// Pointer, not mouse: React drops mouse events on disabled buttons.onPointerEnter={() => setPreviewed(action)}- onFocus={() => setPreviewed(action)}+ onFocus={(event) => {+ event.currentTarget.scrollIntoView({ block: "nearest", inline: "nearest" });+ setPreviewed(action);+ }}onBlur={() => setPreviewed(null)}disabled={!canRun(action)}className={chipClass}diff --git a/src/components/notes/ActionManagerDialog.tsx b/src/components/notes/ActionManagerDialog.tsxindex f5c89e072..b4a46ae1a 100644--- a/src/components/notes/ActionManagerDialog.tsx+++ b/src/components/notes/ActionManagerDialog.tsx@@ -10,14 +10,13 @@ import { cn } from "../lib/utils";import { useActionsOfKind, initializeActions, getActionName } from "../../stores/actionStore";import { NOTE_ACTION_LIMITS } from "../../helpers/builtinActions";import { normalizeSections } from "../../helpers/templatePrompts";-import type { ActionItem, ActionKind, ActionOutput, TemplateSection } from "../../types/electron";+import { getActionIcon } from "./actionIcons";+import type { ActionItem, ActionKind, TemplateSection } from "../../types/electron";interface ActionManagerDialogProps {open: boolean;onOpenChange: (open: boolean) => void;initialKind: ActionKind;- /** Picks chat or summary for an action saved with Auto. */- onInferOutput: (prompt: string) => Promise<ActionOutput>;}// Rows keep a stable key while sections are reordered or removed.@@ -37,12 +36,6 @@ const TEXTAREA_CLASS = cn("font-mono text-[13px]");-const OUTPUT_HINT_KEYS = {- auto: "notes.actions.output.autoHint",- chat: "notes.actions.output.chatHint",- summary: "notes.actions.output.summaryHint",-} as const;-const ICON_BUTTON_CLASS ="p-1 rounded-md text-muted-foreground/70 hover:text-foreground/70 hover:bg-foreground/5 dark:hover:bg-white/6 transition-colors duration-150 disabled:opacity-30 disabled:pointer-events-none";@@ -50,7 +43,6 @@ export default function ActionManagerDialog({open,onOpenChange,initialKind,- onInferOutput,}: ActionManagerDialogProps) {const { t } = useTranslation();const { toast } = useToast();@@ -60,7 +52,6 @@ export default function ActionManagerDialog({const [description, setDescription] = useState("");const [prompt, setPrompt] = useState("");const [sections, setSections] = useState<SectionDraft[]>([]);- const [output, setOutput] = useState<ActionOutput | "auto">("auto");const [editingId, setEditingId] = useState<number | null>(null);const [selectedId, setSelectedId] = useState<number | null>(null);const [isSaving, setIsSaving] = useState(false);@@ -73,7 +64,6 @@ export default function ActionManagerDialog({setDescription("");setPrompt("");setSections([]);- setOutput("auto");setEditingId(null);};@@ -101,7 +91,6 @@ export default function ActionManagerDialog({setDescription(action.description);setPrompt(action.prompt);setSections(toDrafts(action.sections));- setOutput(action.output ?? "chat");setIsCreating(false);};@@ -153,9 +142,7 @@ export default function ActionManagerDialog({if (!canSave) return;setIsSaving(true);try {- const fields = isTemplate- ? { sections: savedSections }- : { output: output === "auto" ? await onInferOutput(prompt.trim()) : output };+ const fields = isTemplate ? { sections: savedSections } : {};const result =editingId !== null? await window.electronAPI.updateAction(editingId, {@@ -176,6 +163,8 @@ export default function ActionManagerDialog({return;}if (editingId === null) setIsCreating(false);+ } catch {+ toast({ title: t("notes.actions.errors.saveFailed"), variant: "destructive" });} finally {setIsSaving(false);}@@ -189,8 +178,7 @@ export default function ActionManagerDialog({? name !== selectedAction.name ||description !== selectedAction.description ||prompt !== selectedAction.prompt ||- JSON.stringify(savedSections) !== JSON.stringify(selectedAction.sections ?? []) ||- (!isTemplate && output !== selectedAction.output)+ JSON.stringify(savedSections) !== JSON.stringify(selectedAction.sections ?? []): false;return (@@ -202,7 +190,7 @@ export default function ActionManagerDialog({<div className="flex h-[min(44rem,85vh)]">{/* Left panel — template/action list */}<div- // Auto can take a moment on save; switching away then would drop the new draft.+ // Keep the draft selected until the save has finished.inert={isSaving}className={cn("w-56 shrink-0 border-e border-border dark:border-white/10 flex flex-col bg-card/50 dark:bg-surface-1/30",@@ -259,66 +247,69 @@ export default function ActionManagerDialog({</div>) : (<div className="space-y-0.5">- {items.map((action) => (- <div- key={action.id}- onClick={() => handleSelectAction(action)}- className={cn(- "flex items-center gap-2 w-full px-2.5 py-2 rounded-md text-start group cursor-pointer",- "transition-colors duration-150",- selectedId === action.id && !isCreating- ? "bg-accent/8 dark:bg-accent/10"- : "hover:bg-foreground/3 dark:hover:bg-white/3"- )}- >- <Sparkles- size={12}+ {items.map((action) => {+ const Icon = isTemplate ? Sparkles : getActionIcon(action);+ return (+ <div+ key={action.id}+ onClick={() => handleSelectAction(action)}className={cn(- "shrink-0 transition-colors duration-150",+ "flex items-center gap-2 w-full px-2.5 py-2 rounded-md text-start group cursor-pointer",+ "transition-colors duration-150",selectedId === action.id && !isCreating- ? "text-accent/60"- : "text-muted-foreground/70"+ ? "bg-accent/8 dark:bg-accent/10"+ : "hover:bg-foreground/3 dark:hover:bg-white/3")}- />- <div className="flex-1 min-w-0">- <div className="flex items-center gap-1.5">- <span+ >+ <Icon+ size={12}+ className={cn(+ "shrink-0 transition-colors duration-150",+ selectedId === action.id && !isCreating+ ? "text-accent/60"+ : "text-muted-foreground/70"+ )}+ />+ <div className="flex-1 min-w-0">+ <div className="flex items-center gap-1.5">+ <span+ className={cn(+ "text-xs font-medium truncate",+ selectedId === action.id && !isCreating+ ? "text-foreground"+ : "text-foreground/70"+ )}+ >+ {getActionName(action, t)}+ </span>+ {action.is_builtin === 1 && (+ <span className="text-[10px] font-medium px-1 py-px rounded bg-foreground/5 dark:bg-white/6 text-muted-foreground/70 shrink-0">+ {t("notes.actions.builtIn")}+ </span>+ )}+ </div>+ </div>+ {action.is_builtin !== 1 && (+ <button+ onClick={(e) => {+ e.stopPropagation();+ handleDelete(action.id);+ }}+ aria-label={t("notes.context.delete")}className={cn(- "text-xs font-medium truncate",- selectedId === action.id && !isCreating- ? "text-foreground"- : "text-foreground/70"+ "p-1 rounded-md shrink-0",+ "text-muted-foreground/0 group-hover:text-muted-foreground/70",+ "hover:text-destructive/60! hover:bg-destructive/5",+ "active:bg-destructive/8",+ "transition-all duration-150")}>- {getActionName(action, t)}- </span>- {action.is_builtin === 1 && (- <span className="text-[10px] font-medium px-1 py-px rounded bg-foreground/5 dark:bg-white/6 text-muted-foreground/70 shrink-0">- {t("notes.actions.builtIn")}- </span>- )}- </div>+ <Trash2 size={11} />+ </button>+ )}</div>- {action.is_builtin !== 1 && (- <button- onClick={(e) => {- e.stopPropagation();- handleDelete(action.id);- }}- aria-label={t("notes.context.delete")}- className={cn(- "p-1 rounded-md shrink-0",- "text-muted-foreground/0 group-hover:text-muted-foreground/70",- "hover:text-destructive/60! hover:bg-destructive/5",- "active:bg-destructive/8",- "transition-all duration-150"- )}- >- <Trash2 size={11} />- </button>- )}- </div>- ))}+ );+ })}</div>)}</div>@@ -399,32 +390,15 @@ export default function ActionManagerDialog({className="h-9"/>- {!isTemplate && (- <div className="space-y-1.5">- <Tabs- value={output}- onValueChange={(value) => setOutput(value as ActionOutput | "auto")}- >- <TabsList className="h-8 px-1 py-0.5">- {/* A saved action keeps the output it was given, so Auto is for new ones. */}- {editingId === null && (- <TabsTrigger value="auto" className="px-3 py-1 text-xs">- {t("notes.actions.output.auto")}- </TabsTrigger>- )}- <TabsTrigger value="chat" className="px-3 py-1 text-xs">- {t("notes.actions.output.chat")}- </TabsTrigger>- <TabsTrigger value="summary" className="px-3 py-1 text-xs">- {t("notes.actions.output.summary")}- </TabsTrigger>- </TabsList>- </Tabs>- <p className="text-xs text-muted-foreground/70">- {t(OUTPUT_HINT_KEYS[output])}- </p>- </div>- )}+ <p className="text-xs text-muted-foreground/70">+ {t(+ isTemplate+ ? "notes.templates.outputHint"+ : selectedAction?.output === "summary"+ ? "notes.actions.output.summaryHint"+ : "notes.actions.output.chatHint"+ )}+ </p>{/* Prompt — a template's context, or what an action does */}<div className="flex flex-col flex-1 space-y-1.5">diff --git a/src/components/notes/NoteEditor.tsx b/src/components/notes/NoteEditor.tsxindex c55100058..a97bbe813 100644--- a/src/components/notes/NoteEditor.tsx+++ b/src/components/notes/NoteEditor.tsx@@ -1523,19 +1523,7 @@ export default function NoteEditor({activeConversationId={embeddedChat.activeConversationId}onSwitchConversation={embeddedChat.switchConversation}onNewChat={embeddedChat.startNewChat}- actionChips={- offersActions && (- <ActionChips- {...chipProps}- docked- generateSummary={- canRunTemplate && noteTemplate- ? { run: () => onRunNoteAction?.(noteTemplate), disabled: isActionRunning }- : undefined- }- />- )- }+ actionChips={offersActions && <ActionChips {...chipProps} docked />}slashCommands={actionCommands}/>)}diff --git a/src/components/notes/PersonalNotesView.tsx b/src/components/notes/PersonalNotesView.tsxindex 535d96f0d..6bc08c1ca 100644--- a/src/components/notes/PersonalNotesView.tsx+++ b/src/components/notes/PersonalNotesView.tsx@@ -15,7 +15,6 @@ import { useResizableWidth } from "../../hooks/useResizableWidth";import type { NoteMoveTarget } from "../../hooks/useNoteDragAndDrop";import type { ActionItem, ActionKind, NoteItem } from "../../types/electron";import { buildNoteRunInput } from "../../helpers/templatePrompts";-import { inferActionOutput } from "../../utils/inferActionOutput";import {useSettingsStore,selectIsCloudNoteFormattingMode,@@ -825,7 +824,6 @@ export default function PersonalNotesView({open={managerKind !== null}onOpenChange={(open) => !open && setManagerKind(null)}initialKind={managerKind ?? "template"}- onInferOutput={(prompt) => inferActionOutput(prompt, effectiveModelId, isCloudMode)}/></>) : activeContext && overviewSpace ? (diff --git a/src/components/notes/actionIcons.ts b/src/components/notes/actionIcons.tsindex 558d619b1..96ac39040 100644--- a/src/components/notes/actionIcons.ts+++ b/src/components/notes/actionIcons.ts@@ -2,6 +2,7 @@ import {FolderRounded,ListEnd,Mail,+ MessageSquareText,Send,Sparkles,SquareSlash,@@ -10,6 +11,7 @@ import {const ACTION_ICONS: Record<string, IconComponent> = {mail: Mail,+ "message-square-text": MessageSquareText,"clipboard-check": ListEnd,"file-text": FolderRounded,send: Send,diff --git a/src/helpers/builtinActions.js b/src/helpers/builtinActions.jsindex a9e1f4242..d2c18a515 100644--- a/src/helpers/builtinActions.js+++ b/src/helpers/builtinActions.js@@ -344,7 +344,11 @@ const SLACK_UPDATE_PROMPT = `Write a short Slack message I can post to my team aconst SHORTEN_PROMPT = `Make it about half as long. Keep every decision, number, date, name, and action item; cut repetition, background, and detail that would not change what anyone does next.`;-const ADD_TLDR_PROMPT = `Add a "## TL;DR" section at the very top: two or three sentences on what the meeting decided and what happens next. Leave the rest of the summary exactly as it is.`;+const ADD_TLDR_PROMPT_PREVIOUS = `Add a "## TL;DR" section at the very top: two or three sentences on what the meeting decided and what happens next. Leave the rest of the summary exactly as it is.`;++const WRITE_TLDR_PROMPT = `Write a two- or three-sentence TL;DR of what the note says, what was decided, and what happens next. Use only supported facts. Return only the TL;DR in chat, without repeating or rewriting the full summary.`;++const LENGTHEN_PROMPT = `Make the notes more detailed using only facts supported by the current summary and reference material. Expand compressed points with relevant context and explanations; keep every name, number, date, decision, and action item. Never invent facts, commitments, or identities, and do not pad with repetition. If the material does not support more detail, keep the notes accurate rather than forcing extra length.`;// System-prompt wrappers the note action store puts around a built-in or// custom action prompt. They live here, with the action prompts, so the live@@ -449,6 +453,9 @@ const builtinAction = ({description,prompt,output,+ previousPrompts = [],+ previousNames = [],+ previousDescriptions = [],icon = "sparkles",sortOrder,}) => ({@@ -459,7 +466,9 @@ const builtinAction = ({prompt,sections: null,output,- previousPrompts: [],+ previousPrompts,+ previousNames,+ previousDescriptions,icon,sortOrder,});@@ -525,20 +534,34 @@ export const BUILTIN_ACTIONS = [}),builtinAction({key: "shorten",- name: "Shorten",- description: "Make the summary about half as long",+ name: "Make notes shorter",+ previousNames: ["Shorten"],+ previousDescriptions: ["Make the summary about half as long"],+ description: "Shorten the saved AI summary while keeping key facts",prompt: SHORTEN_PROMPT,output: "summary",sortOrder: 4,}),builtinAction({- key: "addTldr",- name: "Add TL;DR",- description: "Put a two- or three-sentence TL;DR at the top of the summary",- prompt: ADD_TLDR_PROMPT,+ key: "lengthen",+ name: "Make notes longer",+ description: "Expand the saved AI summary with supported detail",+ prompt: LENGTHEN_PROMPT,output: "summary",sortOrder: 5,}),+ builtinAction({+ key: "addTldr",+ name: "Write TL;DR",+ icon: "message-square-text",+ previousNames: ["Add TL;DR"],+ previousDescriptions: ["Put a two- or three-sentence TL;DR at the top of the summary"],+ description: "Write a two- or three-sentence TL;DR in chat",+ prompt: WRITE_TLDR_PROMPT,+ previousPrompts: [ADD_TLDR_PROMPT_PREVIOUS],+ output: "chat",+ sortOrder: 6,+ }),builtinAction({key: "createOutline",name: "Create outline",@@ -546,7 +569,7 @@ export const BUILTIN_ACTIONS = [prompt: CREATE_OUTLINE_PROMPT,output: "chat",icon: "file-text",- sortOrder: 6,+ sortOrder: 7,}),builtinAction({key: "slackUpdate",@@ -555,7 +578,7 @@ export const BUILTIN_ACTIONS = [prompt: SLACK_UPDATE_PROMPT,output: "chat",icon: "send",- sortOrder: 7,+ sortOrder: 8,}),builtinTemplate({key: "oneOnOne",@@ -563,7 +586,7 @@ export const BUILTIN_ACTIONS = [description: "Updates, feedback, growth, and next steps from a one-on-one",prompt: ONE_ON_ONE_CONTEXT,sections: ONE_ON_ONE_SECTIONS,- sortOrder: 8,+ sortOrder: 9,}),builtinTemplate({key: "standUp",@@ -571,7 +594,7 @@ export const BUILTIN_ACTIONS = [description: "Each person's progress, plans, and blockers",prompt: STAND_UP_CONTEXT,sections: STAND_UP_SECTIONS,- sortOrder: 9,+ sortOrder: 10,}),builtinTemplate({key: "salesCall",@@ -579,7 +602,7 @@ export const BUILTIN_ACTIONS = [description: "Needs, objections, budget, and the decision process",prompt: SALES_CALL_CONTEXT,sections: SALES_CALL_SECTIONS,- sortOrder: 10,+ sortOrder: 11,}),builtinTemplate({key: "userInterview",@@ -587,7 +610,7 @@ export const BUILTIN_ACTIONS = [description: "Workflow, pain points, reactions, and quotes from a participant",prompt: USER_INTERVIEW_CONTEXT,sections: USER_INTERVIEW_SECTIONS,- sortOrder: 11,+ sortOrder: 12,}),];diff --git a/src/helpers/database.js b/src/helpers/database.jsindex 5823b8eb6..bbf5f8166 100644--- a/src/helpers/database.js+++ b/src/helpers/database.js@@ -115,7 +115,11 @@ function toActionItem(row) {} catch {sections = null;}- return { ...row, sections };+ // Destinations are fixed by built-in identity, never by editable copy or stored output.+ const builtin = BUILTIN_ACTIONS.find((action) => action.translationKey === row.translation_key);+ const output =+ row.kind === "template" ? null : builtin?.output === "summary" ? "summary" : "chat";+ return { ...row, sections, output };}function rowMatchesSnapshot(row, snapshot, fields) {@@ -649,19 +653,18 @@ class DatabaseManager {// Built-ins: insert any that are missing, and roll a new default out to rows// that are still a previous flat default (never a user edit). A built-in's- // kind is fixed, so it is settled whatever the prompt; its output is only- // filled in, since the user may point an action at the summary instead.+ // kind and destination are fixed, regardless of prompt edits.const selectBuiltin = this.db.prepare(- "SELECT id, prompt, sections FROM actions WHERE is_builtin = 1 AND translation_key = ?"+ "SELECT id, name, description, prompt, sections FROM actions WHERE is_builtin = 1 AND translation_key = ?");const insertBuiltin = this.db.prepare("INSERT INTO actions (name, description, prompt, icon, is_builtin, sort_order, translation_key, client_id, kind, sections, output) VALUES (?, ?, ?, ?, 1, ?, ?, ?, ?, ?, ?)");const upgradeBuiltin = this.db.prepare(- "UPDATE actions SET description = ?, prompt = ?, sections = ? WHERE id = ?"+ "UPDATE actions SET prompt = ?, sections = ? WHERE id = ?");const settleBuiltin = this.db.prepare(- "UPDATE actions SET client_id = ?, kind = ?, sort_order = ?, output = COALESCE(output, ?) WHERE id = ?"+ "UPDATE actions SET client_id = ?, kind = ?, sort_order = ?, output = ?, name = ?, description = ?, icon = ? WHERE id = ?");for (const action of BUILTIN_ACTIONS) {const sections = action.sections ? JSON.stringify(action.sections) : null;@@ -681,14 +684,25 @@ class DatabaseManager {);continue;}- if (existing.sections === null && action.previousPrompts.includes(existing.prompt)) {- upgradeBuiltin.run(action.description, action.prompt, sections, existing.id);+ const upgradesPrompt =+ existing.sections === null && action.previousPrompts.includes(existing.prompt);+ if (upgradesPrompt) {+ upgradeBuiltin.run(action.prompt, sections, existing.id);}settleBuiltin.run(action.translationKey,action.kind,action.sortOrder,action.output,+ action.previousNames?.includes(existing.name) ? action.name : existing.name,+ (+ action.previousDescriptions?.length+ ? action.previousDescriptions.includes(existing.description)+ : upgradesPrompt+ )+ ? action.description+ : existing.description,+ action.icon,existing.id);}diff --git a/src/locales/ar/translation.json b/src/locales/ar/translation.jsonindex 2ac557206..38b20c70c 100644--- a/src/locales/ar/translation.json+++ b/src/locales/ar/translation.json@@ -2384,19 +2384,24 @@"description": "سير العمل والمشكلات وردود الفعل والاقتباسات من أحد المشاركين"},"shorten": {- "name": "اختصار",- "description": "اجعل الملخص بنصف طوله تقريبًا",- "cta": "اختصر الملخص"+ "name": "اختصار الملاحظات",+ "description": "اختصر ملخص الذكاء الاصطناعي المحفوظ مع الحفاظ على الحقائق الأساسية",+ "cta": "اختصار الملاحظات"},"addTldr": {- "name": "إضافة خلاصة سريعة",- "description": "أضف خلاصة من جملتين أو ثلاث في بداية الملخص",- "cta": "أضف خلاصة سريعة"+ "name": "كتابة خلاصة موجزة",+ "description": "اكتب خلاصة من جملتين أو ثلاث في المحادثة",+ "cta": "كتابة خلاصة موجزة"},"slackUpdate": {"name": "تحديث لـ Slack","description": "اكتب تحديثًا قصيرًا للفريق لنشره على Slack","cta": "اكتب تحديثًا لـ Slack"+ },+ "lengthen": {+ "name": "توسيع الملاحظات",+ "description": "وسّع ملخص الذكاء الاصطناعي المحفوظ بتفاصيل يدعمها المحتوى",+ "cta": "توسيع الملاحظات"}},"errors": {@@ -2409,12 +2414,10 @@},"tab": "الإجراءات","output": {- "auto": "تلقائي","chat": "الدردشة","summary": "الملخص بالذكاء الاصطناعي",- "chatHint": "يجيب في دردشة الملاحظة ويترك الملخص بالذكاء الاصطناعي كما هو.",- "summaryHint": "يعدّل ملخص الملاحظة بالذكاء الاصطناعي، أو يكتبه من النص المفرَّغ إن لم يكن موجودًا بعد.",- "autoHint": "يقرأ التعليمات عند الحفظ ويختار الدردشة أو الملخص بالذكاء الاصطناعي."+ "chatHint": "يرد هذا الإجراء في المحادثة. يظل ملخص الذكاء الاصطناعي المحفوظ دون تغيير.",+ "summaryHint": "يحدّث هذا الإجراء المدمج ملخص الذكاء الاصطناعي المحفوظ. يمكنك التراجع عن التغيير."},"applied": "تم تحديث الملخص بالذكاء الاصطناعي باستخدام {{name}}"},@@ -2439,7 +2442,8 @@"noSectionsHint": "من دون أقسام، يكون السياق هو التعليمات الكاملة للملخص.","noTemplates": "لا توجد قوالب بعد","emptyEditorTitle": "اختر قالبًا",- "emptyEditorDescription": "اختر قالبًا من القائمة أو أنشئ قالبًا جديدًا"+ "emptyEditorDescription": "اختر قالبًا من القائمة أو أنشئ قالبًا جديدًا",+ "outputHint": "يؤدي تطبيق قالب إلى إنشاء ملخص بالذكاء الاصطناعي أو استبداله باستخدام ملاحظاتك ونص التسجيل."},"onboarding": {"llm": {@@ -4861,8 +4865,7 @@"close": "إغلاق الدردشة","newChat": "محادثة جديدة","conversationSelector": "تبديل المحادثة",- "history": "السجل",- "generateSummary": "إنشاء ملخص"+ "history": "السجل"},"transcriptionPreview": {"label": "معاينة",diff --git a/src/locales/de/translation.json b/src/locales/de/translation.jsonindex 70331b159..64e9ed1f7 100644--- a/src/locales/de/translation.json+++ b/src/locales/de/translation.json@@ -3606,19 +3606,24 @@"description": "Arbeitsablauf, Probleme, Reaktionen und Zitate einer teilnehmenden Person"},"shorten": {- "name": "Kürzen",- "description": "Die Zusammenfassung etwa halb so lang machen",- "cta": "Zusammenfassung kürzen"+ "name": "Notizen kürzen",+ "description": "Die gespeicherte KI-Zusammenfassung kürzen und wichtige Fakten beibehalten",+ "cta": "Notizen kürzen"},"addTldr": {- "name": "TL;DR hinzufügen",- "description": "Ein TL;DR aus zwei oder drei Sätzen an den Anfang der Zusammenfassung setzen",- "cta": "TL;DR hinzufügen"+ "name": "Kurzfassung schreiben",+ "description": "Eine Kurzfassung mit zwei bis drei Sätzen im Chat schreiben",+ "cta": "Kurzfassung schreiben"},"slackUpdate": {"name": "Slack-Update","description": "Ein kurzes Team-Update für Slack schreiben","cta": "Slack-Update schreiben"+ },+ "lengthen": {+ "name": "Notizen erweitern",+ "description": "Die gespeicherte KI-Zusammenfassung mit belegten Details erweitern",+ "cta": "Notizen erweitern"}},"errors": {@@ -3631,12 +3636,10 @@},"tab": "Aktionen","output": {- "auto": "Automatisch","chat": "Chat","summary": "KI-Zusammenfassung",- "chatHint": "Antwortet im Chat der Notiz und lässt die KI-Zusammenfassung unverändert.",- "summaryHint": "Bearbeitet die KI-Zusammenfassung der Notiz oder erstellt sie aus dem Transkript, falls es noch keine gibt.",- "autoHint": "Liest beim Speichern den Prompt und wählt den Chat oder die KI-Zusammenfassung."+ "chatHint": "Diese Aktion antwortet im Chat. Deine gespeicherte KI-Zusammenfassung bleibt unverändert.",+ "summaryHint": "Diese integrierte Aktion aktualisiert deine gespeicherte KI-Zusammenfassung. Du kannst die Änderung rückgängig machen."},"applied": "KI-Zusammenfassung mit {{name}} aktualisiert"},@@ -3661,7 +3664,8 @@"noSectionsHint": "Ohne Abschnitte ist der Kontext die gesamte Anweisung für die Zusammenfassung.","noTemplates": "Noch keine Vorlagen","emptyEditorTitle": "Vorlage auswählen",- "emptyEditorDescription": "Wählen Sie eine Vorlage aus der Liste oder erstellen Sie eine neue"+ "emptyEditorDescription": "Wählen Sie eine Vorlage aus der Liste oder erstellen Sie eine neue",+ "outputHint": "Eine Vorlage erstellt oder ersetzt die KI-Zusammenfassung anhand deiner Notizen und des Transkripts."},"onboarding": {"llm": {@@ -4739,8 +4743,7 @@"close": "Chat schließen","newChat": "Neuer Chat","conversationSelector": "Unterhaltung wechseln",- "history": "Verlauf",- "generateSummary": "Zusammenfassung erstellen"+ "history": "Verlauf"},"transcriptionPreview": {"label": "Vorschau",diff --git a/src/locales/en/translation.json b/src/locales/en/translation.jsonindex 3edc6755e..bff8d6693 100644--- a/src/locales/en/translation.json+++ b/src/locales/en/translation.json@@ -3606,19 +3606,24 @@"description": "Workflow, pain points, reactions, and quotes from a participant"},"shorten": {- "name": "Shorten",- "description": "Make the summary about half as long",- "cta": "Shorten the summary"+ "name": "Make notes shorter",+ "description": "Shorten the saved AI summary while keeping key facts",+ "cta": "Make notes shorter"},"addTldr": {- "name": "Add TL;DR",- "description": "Put a two- or three-sentence TL;DR at the top of the summary",- "cta": "Add a TL;DR"+ "name": "Write TL;DR",+ "description": "Write a two- or three-sentence TL;DR in chat",+ "cta": "Write TL;DR"},"slackUpdate": {"name": "Slack update","description": "Write a short team update to post in Slack","cta": "Write a Slack update"+ },+ "lengthen": {+ "name": "Make notes longer",+ "description": "Expand the saved AI summary with supported detail",+ "cta": "Make notes longer"}},"errors": {@@ -3631,12 +3636,10 @@},"tab": "Actions","output": {- "auto": "Auto","chat": "Chat","summary": "AI summary",- "chatHint": "Answers in the note's chat and leaves the AI summary as it is.",- "summaryHint": "Edits the note's AI summary, or writes one from the transcript if there isn't one yet.",- "autoHint": "Reads the prompt when you save and picks the chat or the AI summary."+ "chatHint": "This action replies in chat. Your saved AI summary stays unchanged.",+ "summaryHint": "This built-in action updates your saved AI summary. You can undo the change."},"applied": "AI summary updated with {{name}}"},@@ -3661,7 +3664,8 @@"noSectionsHint": "Without sections, the context is the whole instruction for the summary.","noTemplates": "No templates yet","emptyEditorTitle": "Select a template",- "emptyEditorDescription": "Choose a template from the list or create a new one"+ "emptyEditorDescription": "Choose a template from the list or create a new one",+ "outputHint": "Applying a template creates or replaces the AI summary using your notes and transcript."},"onboarding": {"llm": {@@ -4739,8 +4743,7 @@"close": "Close chat","newChat": "New chat","conversationSelector": "Switch conversation",- "history": "History",- "generateSummary": "Generate summary"+ "history": "History"},"transcriptionPreview": {"label": "Preview",diff --git a/src/locales/es/translation.json b/src/locales/es/translation.jsonindex 02243e3b8..7f4f96ca1 100644--- a/src/locales/es/translation.json+++ b/src/locales/es/translation.json@@ -3291,19 +3291,24 @@"description": "Flujo de trabajo, problemas, reacciones y citas de un participante"},"shorten": {- "name": "Acortar",- "description": "Deja el resumen en la mitad de largo",- "cta": "Acortar el resumen"+ "name": "Acortar las notas",+ "description": "Acorta el resumen de IA guardado conservando los datos clave",+ "cta": "Acortar las notas"},"addTldr": {- "name": "Añadir TL;DR",- "description": "Pon un TL;DR de dos o tres frases al principio del resumen",- "cta": "Añadir un TL;DR"+ "name": "Escribir un resumen breve",+ "description": "Escribe un resumen de dos o tres frases en el chat",+ "cta": "Escribir un resumen breve"},"slackUpdate": {"name": "Actualización para Slack","description": "Escribe una breve actualización para el equipo en Slack","cta": "Escribir una actualización para Slack"+ },+ "lengthen": {+ "name": "Ampliar las notas",+ "description": "Amplía el resumen de IA guardado con detalles respaldados por el contenido",+ "cta": "Ampliar las notas"}},"errors": {@@ -3316,12 +3321,10 @@},"tab": "Acciones","output": {- "auto": "Automático","chat": "Chat","summary": "Resumen con IA",- "chatHint": "Responde en el chat de la nota y deja el resumen con IA como está.",- "summaryHint": "Edita el resumen con IA de la nota, o lo escribe a partir de la transcripción si aún no hay uno.",- "autoHint": "Lee el prompt al guardar y elige el chat o el resumen con IA."+ "chatHint": "Esta acción responde en el chat. Tu resumen de IA guardado no cambia.",+ "summaryHint": "Esta acción integrada actualiza tu resumen de IA guardado. Puedes deshacer el cambio."},"applied": "Resumen con IA actualizado con {{name}}"},@@ -3346,7 +3349,8 @@"noSectionsHint": "Sin secciones, el contexto es la instrucción completa para el resumen.","noTemplates": "Aún no hay plantillas","emptyEditorTitle": "Seleccionar plantilla",- "emptyEditorDescription": "Elige una plantilla de la lista o crea una nueva"+ "emptyEditorDescription": "Elige una plantilla de la lista o crea una nueva",+ "outputHint": "Al aplicar una plantilla, se crea o reemplaza el resumen de IA a partir de tus notas y la transcripción."},"empty": {"title": "Todavía no hay notas aquí",@@ -4663,8 +4667,7 @@"close": "Cerrar chat","newChat": "Nuevo chat","conversationSelector": "Cambiar conversación",- "history": "Historial",- "generateSummary": "Generar resumen"+ "history": "Historial"},"transcriptionPreview": {"label": "Vista previa",diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.jsonindex ec6a6d468..db5c2f064 100644--- a/src/locales/fr/translation.json+++ b/src/locales/fr/translation.json@@ -3606,19 +3606,24 @@"description": "Méthode de travail, difficultés, réactions et citations d'un participant"},"shorten": {- "name": "Raccourcir",- "description": "Réduire le résumé de moitié environ",- "cta": "Raccourcir le résumé"+ "name": "Raccourcir les notes",+ "description": "Raccourcir le résumé IA enregistré en conservant les faits essentiels",+ "cta": "Raccourcir les notes"},"addTldr": {- "name": "Ajouter un TL;DR",- "description": "Placer un TL;DR de deux ou trois phrases en tête du résumé",- "cta": "Ajouter un TL;DR"+ "name": "Rédiger un résumé bref",+ "description": "Rédiger un résumé de deux ou trois phrases dans le chat",+ "cta": "Rédiger un résumé bref"},"slackUpdate": {"name": "Point Slack","description": "Rédiger un court point d'équipe à publier sur Slack","cta": "Rédiger un point Slack"+ },+ "lengthen": {+ "name": "Développer les notes",+ "description": "Enrichir le résumé IA enregistré avec des détails étayés par le contenu",+ "cta": "Développer les notes"}},"errors": {@@ -3631,12 +3636,10 @@},"tab": "Actions","output": {- "auto": "Auto","chat": "Chat","summary": "Résumé IA",- "chatHint": "Répond dans le chat de la note et laisse le résumé IA tel quel.",- "summaryHint": "Modifie le résumé IA de la note, ou le rédige à partir de la transcription s'il n'y en a pas encore.",- "autoHint": "Lit le prompt à l'enregistrement et choisit le chat ou le résumé IA."+ "chatHint": "Cette action répond dans le chat. Votre résumé IA enregistré reste inchangé.",+ "summaryHint": "Cette action intégrée met à jour votre résumé IA enregistré. Vous pouvez annuler la modification."},"applied": "Résumé IA mis à jour avec {{name}}"},@@ -3661,7 +3664,8 @@"noSectionsHint": "Sans sections, le contexte constitue toute la consigne du résumé.","noTemplates": "Aucun modèle pour l'instant","emptyEditorTitle": "Sélectionner un modèle",- "emptyEditorDescription": "Choisissez un modèle dans la liste ou créez-en un nouveau"+ "emptyEditorDescription": "Choisissez un modèle dans la liste ou créez-en un nouveau",+ "outputHint": "Appliquer un modèle crée ou remplace le résumé IA à partir de vos notes et de la transcription."},"onboarding": {"llm": {@@ -4739,8 +4743,7 @@"close": "Fermer le chat","newChat": "Nouvelle discussion","conversationSelector": "Changer de conversation",- "history": "Historique",- "generateSummary": "Générer un résumé"+ "history": "Historique"},"transcriptionPreview": {"label": "Aperçu",diff --git a/src/locales/it/translation.json b/src/locales/it/translation.jsonindex 3be5b98cd..127c976f6 100644--- a/src/locales/it/translation.json+++ b/src/locales/it/translation.json@@ -3239,19 +3239,24 @@"description": "Flusso di lavoro, problemi, reazioni e citazioni di un partecipante"},"shorten": {- "name": "Accorcia",- "description": "Rendi il riepilogo lungo circa la metà",- "cta": "Accorcia il riepilogo"+ "name": "Accorcia le note",+ "description": "Accorcia il riepilogo IA salvato mantenendo i fatti principali",+ "cta": "Accorcia le note"},"addTldr": {- "name": "Aggiungi TL;DR",- "description": "Metti un TL;DR di due o tre frasi all'inizio del riepilogo",- "cta": "Aggiungi un TL;DR"+ "name": "Scrivi un breve riepilogo",+ "description": "Scrivi un riepilogo di due o tre frasi nella chat",+ "cta": "Scrivi un breve riepilogo"},"slackUpdate": {"name": "Aggiornamento Slack","description": "Scrivi un breve aggiornamento per il team da pubblicare su Slack","cta": "Scrivi un aggiornamento Slack"+ },+ "lengthen": {+ "name": "Amplia le note",+ "description": "Amplia il riepilogo IA salvato con dettagli supportati dal contenuto",+ "cta": "Amplia le note"}},"errors": {@@ -3264,12 +3269,10 @@},"tab": "Azioni","output": {- "auto": "Automatico","chat": "Chat","summary": "Riepilogo AI",- "chatHint": "Risponde nella chat della nota e lascia invariato il riepilogo AI.",- "summaryHint": "Modifica il riepilogo AI della nota, oppure lo scrive dalla trascrizione se non c'è ancora.",- "autoHint": "Legge il prompt al salvataggio e sceglie la chat o il riepilogo AI."+ "chatHint": "Questa azione risponde nella chat. Il riepilogo IA salvato resta invariato.",+ "summaryHint": "Questa azione integrata aggiorna il riepilogo IA salvato. Puoi annullare la modifica."},"applied": "Riepilogo AI aggiornato con {{name}}"},@@ -3294,7 +3297,8 @@"noSectionsHint": "Senza sezioni, il contesto è l'intera istruzione per il riepilogo.","noTemplates": "Nessun modello ancora","emptyEditorTitle": "Seleziona un modello",- "emptyEditorDescription": "Scegli un modello dall'elenco o creane uno nuovo"+ "emptyEditorDescription": "Scegli un modello dall'elenco o creane uno nuovo",+ "outputHint": "Applicare un modello crea o sostituisce il riepilogo IA usando le tue note e la trascrizione."},"empty": {"title": "Ancora nessuna nota qui",@@ -4663,8 +4667,7 @@"close": "Chiudi chat","newChat": "Nuova chat","conversationSelector": "Cambia conversazione",- "history": "Cronologia",- "generateSummary": "Genera riepilogo"+ "history": "Cronologia"},"transcriptionPreview": {"label": "Anteprima",diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.jsonindex 267471ea3..dd762e125 100644--- a/src/locales/ja/translation.json+++ b/src/locales/ja/translation.json@@ -3019,19 +3019,24 @@"description": "参加者のワークフロー、課題、反応、発言の引用"},"shorten": {- "name": "短くする",- "description": "要約を約半分の長さにします",- "cta": "要約を短くする"+ "name": "ノートを短くする",+ "description": "重要な事実を残して保存済みのAI要約を短くします",+ "cta": "ノートを短くする"},"addTldr": {- "name": "TL;DRを追加",- "description": "要約の先頭に2〜3文のTL;DRを追加します",- "cta": "TL;DRを追加"+ "name": "短い要約を書く",+ "description": "2〜3文の短い要約をチャットに書きます",+ "cta": "短い要約を書く"},"slackUpdate": {"name": "Slack用の共有","description": "Slackに投稿するチーム向けの短い共有文を作成します","cta": "Slack用の共有を書く"+ },+ "lengthen": {+ "name": "ノートを詳しくする",+ "description": "内容に裏付けられた詳細を保存済みのAI要約に追加します",+ "cta": "ノートを詳しくする"}},"errors": {@@ -3044,12 +3049,10 @@},"tab": "アクション","output": {- "auto": "自動","chat": "チャット","summary": "AI要約",- "chatHint": "ノートのチャットで回答し、AI要約はそのまま残します。",- "summaryHint": "ノートのAI要約を編集します。要約がまだない場合は文字起こしから作成します。",- "autoHint": "保存時にプロンプトを読み取り、チャットかAI要約かを選びます。"+ "chatHint": "このアクションはチャットに返信します。保存済みのAI要約は変更されません。",+ "summaryHint": "この組み込みアクションは保存済みのAI要約を更新します。変更は元に戻せます。"},"applied": "{{name}}でAI要約を更新しました"},@@ -3074,7 +3077,8 @@"noSectionsHint": "セクションがない場合、コンテキストが要約への指示のすべてになります。","noTemplates": "テンプレートはまだありません","emptyEditorTitle": "テンプレートを選択",- "emptyEditorDescription": "リストからテンプレートを選択するか、新しく作成してください"+ "emptyEditorDescription": "リストからテンプレートを選択するか、新しく作成してください",+ "outputHint": "テンプレートを適用すると、ノートと文字起こしをもとにAI要約を作成、または置き換えます。"},"empty": {"title": "まだノートがありません",@@ -4663,8 +4667,7 @@"close": "チャットを閉じる","newChat": "新しいチャット","conversationSelector": "会話を切り替え",- "history": "履歴",- "generateSummary": "要約を作成"+ "history": "履歴"},"transcriptionPreview": {"label": "プレビュー",diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.jsonindex f605dd3f9..32aa872bb 100644--- a/src/locales/pt/translation.json+++ b/src/locales/pt/translation.json@@ -3239,19 +3239,24 @@"description": "Fluxo de trabalho, dificuldades, reações e citações de um participante"},"shorten": {- "name": "Encurtar",- "description": "Deixe o resumo com cerca de metade do tamanho",- "cta": "Encurtar o resumo"+ "name": "Encurtar as notas",+ "description": "Encurta o resumo de IA salvo mantendo os fatos principais",+ "cta": "Encurtar as notas"},"addTldr": {- "name": "Adicionar TL;DR",- "description": "Coloque um TL;DR de duas ou três frases no início do resumo",- "cta": "Adicionar um TL;DR"+ "name": "Escrever um resumo breve",+ "description": "Escreve um resumo de duas ou três frases no chat",+ "cta": "Escrever um resumo breve"},"slackUpdate": {"name": "Atualização no Slack","description": "Escreva uma breve atualização para a equipe no Slack","cta": "Escrever uma atualização no Slack"+ },+ "lengthen": {+ "name": "Expandir as notas",+ "description": "Expande o resumo de IA salvo com detalhes fundamentados no conteúdo",+ "cta": "Expandir as notas"}},"errors": {@@ -3264,12 +3269,10 @@},"tab": "Ações","output": {- "auto": "Automático","chat": "Chat","summary": "Resumo com IA",- "chatHint": "Responde no chat da nota e deixa o resumo com IA como está.",- "summaryHint": "Edita o resumo com IA da nota, ou escreve um a partir da transcrição se ainda não houver.",- "autoHint": "Lê o prompt ao salvar e escolhe o chat ou o resumo com IA."+ "chatHint": "Esta ação responde no chat. Seu resumo de IA salvo permanece inalterado.",+ "summaryHint": "Esta ação integrada atualiza seu resumo de IA salvo. Você pode desfazer a alteração."},"applied": "Resumo com IA atualizado com {{name}}"},@@ -3294,7 +3297,8 @@"noSectionsHint": "Sem seções, o contexto é a instrução completa para o resumo.","noTemplates": "Nenhum modelo ainda","emptyEditorTitle": "Selecionar modelo",- "emptyEditorDescription": "Escolha um modelo da lista ou crie um novo"+ "emptyEditorDescription": "Escolha um modelo da lista ou crie um novo",+ "outputHint": "Aplicar um modelo cria ou substitui o resumo de IA usando suas notas e a transcrição."},"empty": {"title": "Ainda não há notas aqui",@@ -4663,8 +4667,7 @@"close": "Fechar chat","newChat": "Novo chat","conversationSelector": "Trocar conversa",- "history": "Histórico",- "generateSummary": "Gerar resumo"+ "history": "Histórico"},"transcriptionPreview": {"label": "Pré-visualização",diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.jsonindex 99f76b0e9..2cb7c823b 100644--- a/src/locales/ru/translation.json+++ b/src/locales/ru/translation.json@@ -3259,19 +3259,24 @@"description": "Рабочий процесс, проблемы, реакции и цитаты участника"},"shorten": {- "name": "Сократить",- "description": "Сделать сводку примерно вдвое короче",- "cta": "Сократить сводку"+ "name": "Сократить заметки",+ "description": "Сократить сохранённое ИИ-резюме, сохранив ключевые факты",+ "cta": "Сократить заметки"},"addTldr": {- "name": "Добавить TL;DR",- "description": "Добавить в начало сводки TL;DR из двух-трёх предложений",- "cta": "Добавить TL;DR"+ "name": "Написать краткий итог",+ "description": "Написать итог из двух-трёх предложений в чате",+ "cta": "Написать краткий итог"},"slackUpdate": {"name": "Апдейт для Slack","description": "Написать короткий апдейт для команды в Slack","cta": "Написать апдейт для Slack"+ },+ "lengthen": {+ "name": "Расширить заметки",+ "description": "Дополнить сохранённое ИИ-резюме подтверждёнными деталями",+ "cta": "Расширить заметки"}},"errors": {@@ -3284,12 +3289,10 @@},"tab": "Действия","output": {- "auto": "Авто","chat": "Чат","summary": "ИИ-сводка",- "chatHint": "Отвечает в чате заметки и не меняет ИИ-сводку.",- "summaryHint": "Редактирует ИИ-сводку заметки или создаёт её из транскрипции, если сводки ещё нет.",- "autoHint": "При сохранении читает промпт и выбирает чат или ИИ-сводку."+ "chatHint": "Это действие отвечает в чате. Сохранённое ИИ-резюме не изменяется.",+ "summaryHint": "Это встроенное действие обновляет сохранённое ИИ-резюме. Изменение можно отменить."},"applied": "ИИ-сводка обновлена с помощью «{{name}}»"},@@ -3314,7 +3317,8 @@"noSectionsHint": "Без разделов контекст — это вся инструкция для сводки.","noTemplates": "Шаблонов пока нет","emptyEditorTitle": "Выберите шаблон",- "emptyEditorDescription": "Выберите шаблон из списка или создайте новый"+ "emptyEditorDescription": "Выберите шаблон из списка или создайте новый",+ "outputHint": "Применение шаблона создаёт или заменяет ИИ-резюме на основе ваших заметок и расшифровки."},"empty": {"title": "Нет заметок",@@ -4707,8 +4711,7 @@"close": "Закрыть чат","newChat": "Новый чат","conversationSelector": "Сменить беседу",- "history": "История",- "generateSummary": "Создать сводку"+ "history": "История"},"transcriptionPreview": {"label": "Предпросмотр",diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.jsonindex 213533b57..0cad52750 100644--- a/src/locales/zh-CN/translation.json+++ b/src/locales/zh-CN/translation.json@@ -3239,19 +3239,24 @@"description": "参与者的工作流程、痛点、反应和原话"},"shorten": {- "name": "精简",- "description": "把摘要缩短到大约一半",- "cta": "精简摘要"+ "name": "缩短笔记",+ "description": "缩短已保存的 AI 摘要,同时保留关键事实",+ "cta": "缩短笔记"},"addTldr": {- "name": "添加 TL;DR",- "description": "在摘要开头加上两三句话的 TL;DR",- "cta": "添加 TL;DR"+ "name": "撰写简短摘要",+ "description": "在聊天中撰写两到三句话的简短摘要",+ "cta": "撰写简短摘要"},"slackUpdate": {"name": "Slack 更新","description": "写一条发到 Slack 的简短团队更新","cta": "写一条 Slack 更新"+ },+ "lengthen": {+ "name": "扩充笔记",+ "description": "用有依据的细节扩充已保存的 AI 摘要",+ "cta": "扩充笔记"}},"errors": {@@ -3264,12 +3269,10 @@},"tab": "操作","output": {- "auto": "自动","chat": "聊天","summary": "AI 摘要",- "chatHint": "在笔记的聊天中回复,AI 摘要保持不变。",- "summaryHint": "编辑笔记的 AI 摘要;如果还没有摘要,就根据转录内容生成一份。",- "autoHint": "保存时读取提示词,并选择聊天或 AI 摘要。"+ "chatHint": "此操作会在聊天中回复,不会更改已保存的 AI 摘要。",+ "summaryHint": "此内置操作会更新已保存的 AI 摘要。你可以撤销更改。"},"applied": "已使用 {{name}} 更新 AI 摘要"},@@ -3294,7 +3297,8 @@"noSectionsHint": "没有章节时,背景就是摘要的全部指令。","noTemplates": "暂无模板","emptyEditorTitle": "选择模板",- "emptyEditorDescription": "从列表中选择一个模板或创建新模板"+ "emptyEditorDescription": "从列表中选择一个模板或创建新模板",+ "outputHint": "应用模板会根据你的笔记和转录内容创建或替换 AI 摘要。"},"empty": {"title": "这里还没有笔记",@@ -4663,8 +4667,7 @@"close": "关闭聊天","newChat": "新对话","conversationSelector": "切换对话",- "history": "历史记录",- "generateSummary": "生成摘要"+ "history": "历史记录"},"transcriptionPreview": {"label": "预览",diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.jsonindex b9f10dfe6..a02f9ad1b 100644--- a/src/locales/zh-TW/translation.json+++ b/src/locales/zh-TW/translation.json@@ -3239,19 +3239,24 @@"description": "參與者的工作流程、痛點、反應和原話"},"shorten": {- "name": "精簡",- "description": "把摘要縮短到大約一半",- "cta": "精簡摘要"+ "name": "縮短筆記",+ "description": "縮短已儲存的 AI 摘要,同時保留關鍵事實",+ "cta": "縮短筆記"},"addTldr": {- "name": "新增 TL;DR",- "description": "在摘要開頭加上兩三句話的 TL;DR",- "cta": "新增 TL;DR"+ "name": "撰寫簡短摘要",+ "description": "在聊天中撰寫兩到三句話的簡短摘要",+ "cta": "撰寫簡短摘要"},"slackUpdate": {"name": "Slack 更新","description": "寫一則發到 Slack 的簡短團隊更新","cta": "寫一則 Slack 更新"+ },+ "lengthen": {+ "name": "擴充筆記",+ "description": "用有依據的細節擴充已儲存的 AI 摘要",+ "cta": "擴充筆記"}},"errors": {@@ -3264,12 +3269,10 @@},"tab": "動作","output": {- "auto": "自動","chat": "聊天","summary": "AI 摘要",- "chatHint": "在筆記的聊天中回覆,AI 摘要維持不變。",- "summaryHint": "編輯筆記的 AI 摘要;如果還沒有摘要,就根據轉錄內容產生一份。",- "autoHint": "儲存時讀取提示詞,並選擇聊天或 AI 摘要。"+ "chatHint": "此動作會在聊天中回覆,不會變更已儲存的 AI 摘要。",+ "summaryHint": "此內建動作會更新已儲存的 AI 摘要。你可以復原變更。"},"applied": "已使用 {{name}} 更新 AI 摘要"},@@ -3294,7 +3297,8 @@"noSectionsHint": "沒有段落時,背景就是摘要的完整指示。","noTemplates": "尚無範本","emptyEditorTitle": "選擇範本",- "emptyEditorDescription": "從列表中選擇一個範本或建立新範本"+ "emptyEditorDescription": "從列表中選擇一個範本或建立新範本",+ "outputHint": "套用範本會根據你的筆記和轉錄內容建立或取代 AI 摘要。"},"empty": {"title": "這裡還沒有筆記",@@ -4663,8 +4667,7 @@"close": "關閉聊天","newChat": "新對話","conversationSelector": "切換對話",- "history": "歷史記錄",- "generateSummary": "產生摘要"+ "history": "歷史記錄"},"transcriptionPreview": {"label": "預覽",diff --git a/src/utils/inferActionOutput.ts b/src/utils/inferActionOutput.tsdeleted file mode 100644index 1c76fd524..000000000--- a/src/utils/inferActionOutput.ts+++ /dev/null@@ -1,28 +0,0 @@-import reasoningService from "../services/ReasoningService";-import { getSettings, selectResolvedNoteFormatting } from "../stores/settingsStore";-import { buildNoteFormattingOverrides } from "../helpers/noteFormattingOverrides";-import { stripThinkingTags } from "../helpers/stripThinking";-import type { ActionOutput } from "../types/electron";--const OUTPUT_SYSTEM_PROMPT = `You sort instructions that a user runs on a meeting note. Reply SUMMARY if the instruction changes the note's AI summary itself: rewrites, shortens, expands, reformats, or translates it, or adds a section to it. Reply CHAT if it produces something separate from the summary, such as an email, a message, a list, an outline, or an answer to a question. Reply with exactly one word: SUMMARY or CHAT.`;--/** Where an action's result belongs, read from its prompt by the note model; chat when it can't tell. */-export async function inferActionOutput(- prompt: string,- modelId: string,- isCloudMode: boolean-): Promise<ActionOutput> {- try {- const reply = await reasoningService.processText(prompt.slice(0, 2000), modelId, null, {- systemPrompt: OUTPUT_SYSTEM_PROMPT,- temperature: 0,- // A one-word answer needs no thinking, and a kept <think> block would hide it.- disableThinking: true,- ...buildNoteFormattingOverrides(selectResolvedNoteFormatting(getSettings()), isCloudMode),- });- // Not every route strips a reasoning model's inline <think> block.- return /^\W*summary\b/i.test(stripThinkingTags(reply)) ? "summary" : "chat";- } catch {- return "chat";- }-}diff --git a/test/components/actionManagerDialog.test.js b/test/components/actionManagerDialog.test.jsnew file mode 100644index 000000000..80e8cd2cd--- /dev/null+++ b/test/components/actionManagerDialog.test.js@@ -0,0 +1,179 @@+const test = require("node:test");+const assert = require("node:assert/strict");+const React = require("react");+const { createRoot } = require("react-dom/client");+const {+ createRendererServer,+ installBrowserGlobals,+ installHookDom,+} = require("../lib/rendererTestHarness");+const { BUILTIN_ACTIONS } = require("../../src/helpers/builtinActions.js");++function collect(node, result = []) {+ if (!node || typeof node !== "object") return result;+ if (Array.isArray(node)) {+ node.forEach((n) => collect(n, result));+ return result;+ }+ if (node.props) {+ result.push(node);+ collect(node.props.children, result);+ }+ return result;+}++async function load(t, rows = [], initialKind = "action") {+ let root;+ t.after(() => root && React.act(async () => root.unmount()));+ const saves = [];+ const toasts = [];+ let failure = false;+ let throws = false;+ const persist = (...args) => {+ saves.push(args);+ if (throws) throw new Error("IPC failed");+ return { success: !failure };+ };+ installBrowserGlobals(t, {+ window: {+ electronAPI: {+ getActions: async () => rows,+ createAction: async (...args) => persist("create", ...args),+ updateAction: async (...args) => persist("update", ...args),+ },+ },+ });+ const container = installHookDom(t);+ globalThis.__actionDialogToasts = toasts;+ t.after(() => delete globalThis.__actionDialogToasts);+ const vite = await createRendererServer(t, {+ cachePrefix: "openwhispr-action-manager-",+ noExternal: ["react-i18next"],+ mockModules: {+ "react-i18next": `const t = (key) => key; export function useTranslation() { return { t }; }`,+ "/ui/useToast": `export function useToast() { return { toast: (value) => globalThis.__actionDialogToasts.push(value) }; }`,+ },+ });+ const Dialog = (await vite.ssrLoadModule("/components/notes/ActionManagerDialog.tsx")).default;+ let tree;+ function Harness() {+ tree = Dialog({ open: true, onOpenChange() {}, initialKind });+ return null;+ }+ root = createRoot(container);+ await React.act(async () => root.render(React.createElement(Harness)));+ const elements = () => collect(tree);+ const find = (predicate) => {+ const node = elements().find(predicate);+ assert.ok(node, "control exists");+ return node;+ };+ const click = (label) =>+ React.act(async () =>+ find(+ (n) =>+ n.props.onClick &&+ (n.props.children === label ||+ (Array.isArray(n.props.children) && n.props.children.includes(label)) ||+ n.props["aria-label"] === label)+ ).props.onClick()+ );+ const change = (placeholder, value) =>+ React.act(async () =>+ find((n) => n.props.placeholder === placeholder).props.onChange({ target: { value } })+ );+ return {+ saves,+ toasts,+ elements,+ find,+ click,+ change,+ fail: (value) => {+ failure = value;+ },+ throwOnSave: () => {+ throws = true;+ },+ };+}++const row = (key) => {+ const b = BUILTIN_ACTIONS.find((a) => a.translationKey.endsWith(`.${key}`));+ return {+ ...b,+ id: 10,+ client_id: b.translationKey,+ translation_key: b.translationKey,+ is_builtin: 1,+ };+};++test("creating a custom action has a fixed chat hint and one persistence call", async (t) => {+ const ui = await load(t);+ await ui.click("notes.actions.addAction");+ assert.ok(ui.elements().some((n) => n.props.children === "notes.actions.output.chatHint"));+ assert.equal(ui.find((n) => n.props.children === "notes.actions.save").props.disabled, true);+ await ui.change("notes.actions.namePlaceholder", "Make notes shorter");+ await ui.change("notes.actions.promptPlaceholder", "Replace the summary with a poem");+ await ui.click("notes.actions.save");+ assert.equal(ui.saves.length, 1);+ assert.deepEqual(ui.saves[0], [+ "create",+ "Make notes shorter",+ "",+ "Replace the summary with a poem",+ undefined,+ { kind: "action" },+ ]);+});++test("failed and rejected saves keep the draft editable and show the save error", async (t) => {+ const ui = await load(t);+ await ui.click("notes.actions.addAction");+ await ui.change("notes.actions.namePlaceholder", "Custom");+ await ui.change("notes.actions.promptPlaceholder", "Draft a reply");+ ui.fail(true);+ await ui.click("notes.actions.save");+ assert.equal(ui.toasts.length, 1);+ assert.equal(+ ui.find((n) => n.props.placeholder === "notes.actions.promptPlaceholder").props.value,+ "Draft a reply"+ );+ ui.throwOnSave();+ await ui.click("notes.actions.save");+ assert.equal(ui.toasts.length, 2);+ assert.equal(ui.find((n) => n.props.children === "notes.actions.save").props.disabled, false);+});++test("template section editing, ordering and saving stay separate from action destinations", async (t) => {+ const template = {+ ...row("oneOnOne"),+ sections: [+ { heading: "First", instruction: "Keep facts" },+ { heading: "Second", instruction: "Next steps" },+ ],+ };+ const ui = await load(t, [template], "template");+ const sections = ui+ .elements()+ .filter((n) => n.props["aria-label"] === "notes.templates.moveSectionDown");+ await React.act(async () => sections[0].props.onClick());+ await ui.change("notes.templates.sectionInstructionPlaceholder", "Edited next steps");+ await ui.click("notes.actions.update");+ assert.deepEqual(ui.saves[0][2].sections, [+ { heading: "Second", instruction: "Edited next steps" },+ { heading: "First", instruction: "Keep facts" },+ ]);+ await ui.click("notes.templates.addTemplate");+ await ui.change("notes.templates.namePlaceholder", "New template");+ await ui.click("notes.templates.addSection");+ await ui.change("notes.templates.sectionInstructionPlaceholder", "Cannot save without a heading");+ assert.equal(ui.find((n) => n.props.children === "notes.actions.save").props.disabled, true);+ await ui.change("notes.templates.sectionHeadingPlaceholder", "## Decisions");+ await ui.click("notes.actions.save");+ assert.deepEqual(ui.saves[1].at(-1), {+ kind: "template",+ sections: [{ heading: "Decisions", instruction: "Cannot save without a heading" }],+ });+});diff --git a/test/components/meetingRecordingSurvivesViewSwitch.test.js b/test/components/meetingRecordingSurvivesViewSwitch.test.jsindex 68367c7d8..8ff1d27fc 100644--- a/test/components/meetingRecordingSurvivesViewSwitch.test.js+++ b/test/components/meetingRecordingSurvivesViewSwitch.test.js@@ -66,7 +66,6 @@ const MOCKS = {export const useActionProcessing = () => ({ state: "idle", actionName: null, runAction() {} });`,"/stores/actionStore": `export const getActionName = (action) => action.name;`,- "/utils/inferActionOutput": `export const inferActionOutput = async () => "chat";`,"/hooks/useNotesOnboarding": `export const useNotesOnboarding = () => ({ isComplete: true, complete() {} });`,diff --git a/test/components/noteActionChips.test.js b/test/components/noteActionChips.test.jsindex c527bc4ea..0e0760321 100644--- a/test/components/noteActionChips.test.js+++ b/test/components/noteActionChips.test.js@@ -29,7 +29,14 @@ const FOLLOW_UP = action({name: "Follow-up email",translation_key: "notes.actions.builtin.followUpEmail",});-const SHORTEN = action({ id: 3, client_id: "shorten", name: "Shorten", output: "summary" });+const SHORTEN = action({+ id: 3,+ client_id: "shorten",+ name: "Make notes shorter",+ output: "summary",+ is_builtin: 1,+ translation_key: "notes.actions.builtin.shorten",+});async function load(t, path, initialStorage) {installBrowserGlobals(t, { initialStorage });@@ -64,11 +71,19 @@ const ACTIONS = [FOLLOW_UP,action({ id: 4, client_id: "todos", name: "Create to-dos" }),SHORTEN,- action({ id: 5, client_id: "tldr", name: "Add TL;DR", output: "summary" }),+ action({+ id: 7,+ client_id: "lengthen",+ name: "Make notes longer",+ output: "summary",+ is_builtin: 1,+ translation_key: "notes.actions.builtin.lengthen",+ }),+ action({ id: 5, client_id: "tldr", name: "Write TL;DR", output: "chat" }),action({ id: 6, client_id: "outline", name: "Create outline" }),];-test("the open chat shows the first four actions as chips that run on click, disabled while they can't", async (t) => {+test("the centered chat omits Make notes longer without backfilling, preserving click and busy state", async (t) => {const ActionChips = await load(t, "/components/notes/ActionChips.tsx");const ran = [];const props = {@@ -84,9 +99,17 @@ test("the open chat shows the first four actions as chips that run on click, dischips.map((chip) => chip.key),["2", "4", "3", "5"]);+ const renamed = ACTIONS.map((a) => (a.id === 7 ? { ...a, name: "Notes plus détaillées" } : a));+ assert.deepEqual(+ collect(renderTree(ActionChips, { ...props, actions: renamed }))+ .filter((node) => node.type === "button" && node.props.onClick)+ .map((node) => node.key),+ ["2", "4", "3", "5"],+ "a renamed Make notes longer stays hidden"+ );assert.deepEqual(chips.map((chip) => chip.props.disabled),- [false, false, true, true],+ [false, false, true, false],"a chip is disabled while its action can't run");chips[0].props.onClick();@@ -145,6 +168,15 @@ test("hovering a chip shows what its action does above the row", async (t) => {assert.ok(description(), "the hovered action's description shows");const card = description().parentNode.parentNode;+ assert.equal(+ card.textContent.trim(),+ "Create to-dosList every to-do",+ "the hover keeps its title and description without a destination badge"+ );+ assert.ok(+ findElement(card, (el) => el.tagName === "SVG"),+ "the action icon remains"+ );const followUpChip = findElement(container, (el) => el.tagName === "BUTTON");const strip = followUpChip.parentNode;const move = (from, to) =>@@ -175,30 +207,31 @@ test("hovering a chip shows what its action does above the row", async (t) => {await pointer("click");assert.equal(ran, 1);assert.equal(description(), null, "and once the action runs, so it can't cover the reply");+ await pointer("focusin");+ assert.ok(description(), "keyboard focus shows the same action preview without running it");+ assert.equal(ran, 1);+ await pointer("focusout");+ assert.equal(description(), null, "moving keyboard focus away dismisses the preview");});-test("the docked chips lead with Generate summary, held back while a summary is being written", async (t) => {+test("Make notes longer stays in docked chips and both All actions menus", async (t) => {const ActionChips = await load(t, "/components/notes/ActionChips.tsx");- const ran = [];const props = {actions: ACTIONS,canRun: () => true,- onRunAction: (a) => ran.push(a.name),+ onRunAction: () => {},onManageActions: () => {},- docked: true,};- const buttons = (generateSummary) =>- collect(renderTree(ActionChips, { ...props, generateSummary })).filter(- (node) => node.type === "button" && node.props.onClick+ for (const docked of [false, true]) {+ const tree = collect(renderTree(ActionChips, { ...props, docked }));+ const buttons = tree.filter((node) => node.type === "button" && node.props.onClick);+ assert.deepEqual(+ buttons.map((node) => node.key),+ docked ? ["2", "4", "3", "7", "5"] : ["2", "4", "3", "5"]);-- const idle = buttons({ run: () => ran.push("summary"), disabled: false });- assert.equal(idle.length, 5, "Generate summary, then the first four actions");- idle[0].props.onClick();- idle[1].props.onClick();- assert.deepEqual(ran, ["summary", "Follow-up email"]);- assert.equal(buttons({ run: () => {}, disabled: true })[0].props.disabled, true);- assert.equal(buttons(undefined).length, 4, "no pill when the note has no template to run");+ const menu = tree.find((node) => node.props.onManageActions);+ assert.equal(menu.props.actions, ACTIONS, "All actions still receives every action");+ }// All actions (the menu's trigger) leads the docked row and opens toward the chips.const order = (docked) =>@@ -224,7 +257,7 @@ test("the action menu lists every action, then Manage Actions", async (t) => {assert.equal(menuItems.length, ACTIONS.length + 1, "every action, then Manage Actions");assert.deepEqual(menuItems.slice(0, -1).map((item) => item.props.disabled),- [false, false, true, true, false]+ [false, false, true, true, false, false]);menuItems.at(-2).props.onClick();menuItems.at(-1).props.onClick();diff --git a/test/components/noteEditorSummaryDeletion.test.js b/test/components/noteEditorSummaryDeletion.test.jsindex b6c530a2e..70f76da09 100644--- a/test/components/noteEditorSummaryDeletion.test.js+++ b/test/components/noteEditorSummaryDeletion.test.js@@ -140,7 +140,7 @@ function baseProps(enhancement) {};}-async function loadNoteEditor(t) {+async function loadNoteEditor(t, permission) {installBrowserGlobals(t, {window: {electronAPI: {@@ -215,6 +215,15 @@ async function loadNoteEditor(t) {},});+ if (permission) {+ const { updateShareCache } = await vite.ssrLoadModule("/stores/noteStore.ts");+ updateShareCache("shared-note", () => ({+ share: { visibility: "private" },+ invitations: [],+ rawToken: null,+ access: { my_permission: permission },+ }));+ }const mod = await vite.ssrLoadModule("/components/notes/NoteEditor.tsx");const NoteEditor = mod.default;@@ -537,7 +546,7 @@ test("the docked chat holds the conversation and its history, and its chips contawait unmount();});-test("a chat action from the collapsed picker opens the docked chat, with the actions and Generate summary", async (t) => {+test("a chat action from the collapsed picker opens the docked chat, with the actions", async (t) => {globalThis.__noteActions = [FOLLOW_UP];globalThis.__embeddedChatSent = [];t.after(() => {@@ -557,8 +566,7 @@ test("a chat action from the collapsed picker opens the docked chat, with the acassert.equal(chips.docked, true);assert.deepEqual(chips.actions, [FOLLOW_UP]);assert.equal(docked.props.slashCommands.length, 1, "and offers the same / menu");- chips.generateSummary.run();- assert.deepEqual(ran, [DEFAULT_TEMPLATE.client_id], "Generate summary runs the default template");+ assert.deepEqual(ran, []);const [[marker, shown, { requestText }]] = globalThis.__embeddedChatSent;assert.equal(marker, "new chat", "from the ask bar it starts a new conversation");assert.equal(shown, "Follow-up");@@ -612,3 +620,127 @@ test("a question sent while a reply is still coming waits as the docked chat's dassert.equal(findDockedChat(latest()).props.draftText, "And the budget?");await unmount();});++for (const surface of ["picker", "floating", "sidebar", "slash"]) {+ test(`${surface} dispatch, busy states and hints follow the destination`, async (t) => {+ const rows = [+ FOLLOW_UP,+ {+ ...FOLLOW_UP,+ id: 4,+ client_id: "tldr",+ is_builtin: 1,+ translation_key: "notes.actions.builtin.addTldr",+ },+ {+ ...FOLLOW_UP,+ id: 5,+ client_id: "custom",+ name: "Make notes shorter",+ is_builtin: 0,+ translation_key: null,+ },+ ...["shorten", "lengthen"].map((key, i) => ({+ ...FOLLOW_UP,+ id: 6 + i,+ client_id: key,+ is_builtin: 1,+ translation_key: `notes.actions.builtin.${key}`,+ output: "summary",+ })),+ ];+ globalThis.__noteActions = rows;+ globalThis.__embeddedChatSent = [];+ t.after(() => {+ delete globalThis.__noteActions;+ delete globalThis.__embeddedChatSent;+ delete globalThis.__embeddedChatAgentState;+ });+ let cleanup;+ t.after(() => cleanup?.());+ const { render, latest, unmount } = await loadNoteEditor(t);+ const originalHTMLElement = globalThis.HTMLElement;+ globalThis.HTMLElement = globalThis.window.HTMLElement;+ cleanup = async () => {+ await unmount();+ if (originalHTMLElement === undefined) delete globalThis.HTMLElement;+ else globalThis.HTMLElement = originalHTMLElement;+ };+ const written = [];+ const overrides = { onRunNoteAction: (a) => written.push(a.client_id) };+ await render(ENHANCEMENT, overrides);+ if (surface === "floating")+ await React.act(async () => findBottomBar(latest()).props.onInputFocus());+ if (surface === "sidebar")+ await React.act(async () => findBottomBar(latest()).props.onAskSubmit("open"));+ const bar = findBottomBar(latest());+ const commands =+ surface === "sidebar"+ ? findDockedChat(latest()).props.slashCommands+ : bar.props.slashCommands;+ const controls =+ surface === "picker"+ ? bar.props.actionPicker.props+ : surface === "sidebar"+ ? findDockedChat(latest()).props.actionChips.props+ : bar.props.actionChips.props;+ // The same dispatch callbacks feed the actual chips and All actions menu.+ for (const row of rows) {+ await React.act(async () =>+ surface === "slash"+ ? commands.find((c) => c.id === row.client_id).run()+ : controls.onRunAction(row)+ );+ }+ assert.deepEqual(written, ["shorten", "lengthen"]);+ assert.equal(globalThis.__embeddedChatSent.length, surface === "sidebar" ? 4 : 3);+ if (!findDockedChat(latest()))+ await React.act(async () => findBottomBar(latest()).props.onAskSubmit("reopen"));+ const currentCommands = findDockedChat(latest()).props.slashCommands;+ assert.deepEqual(+ currentCommands.map((c) => c.hint),+ [+ "notes.actions.output.chat",+ "notes.actions.output.chat",+ "notes.actions.output.chat",+ "notes.actions.output.summary",+ "notes.actions.output.summary",+ ]+ );+ globalThis.__embeddedChatAgentState = "streaming";+ await render(ENHANCEMENT, overrides);+ assert.deepEqual(+ findDockedChat(latest()).props.slashCommands.map((c) => c.disabled),+ [true, true, true, false, false]+ );+ globalThis.__embeddedChatAgentState = "idle";+ await render(ENHANCEMENT, { ...overrides, actionProcessingState: "processing" });+ assert.deepEqual(+ findDockedChat(latest()).props.slashCommands.map((c) => c.disabled),+ [false, false, false, true, true]+ );+ await render(ENHANCEMENT, { ...overrides, isRecording: true });+ assert.equal(findDockedChat(latest()).props.slashCommands, undefined);+ });+}++test("a read-only shared note offers no action picker, chips, slash menu or summary generation", async (t) => {+ globalThis.__noteActions = [FOLLOW_UP];+ t.after(() => delete globalThis.__noteActions);+ const { render, latest, unmount } = await loadNoteEditor(t, "viewer");+ try {+ await render(undefined, {+ note: { ...NOTE, cloud_id: "shared-note", enhanced_content: null },+ onRunNoteAction() {+ throw new Error("must not run");+ },+ });+ const bar = findBottomBar(latest()).props;+ assert.ok(!bar.actionPicker);+ assert.ok(!bar.actionChips);+ assert.equal(bar.slashCommands, undefined);+ assert.ok(!bar.callout);+ } finally {+ await unmount();+ }+});diff --git a/test/helpers/builtinActionsDatabase.test.js b/test/helpers/builtinActionsDatabase.test.jsindex 059518dd5..2d34aef4a 100644--- a/test/helpers/builtinActionsDatabase.test.js+++ b/test/helpers/builtinActionsDatabase.test.js@@ -55,6 +55,7 @@ for (const action of BUILTIN_ACTIONS) {assert.equal(rows[0].prompt, action.prompt);assert.equal(rows[0].kind, action.kind);assert.equal(rows[0].output, action.output);+ assert.equal(rows[0].icon, action.icon);assert.equal(rows[0].client_id, translationKey);assert.deepEqual(rows[0].sections, action.sections);});@@ -199,7 +200,7 @@ test("templates and actions are validated and normalized when saved", (t) => {sections: [{ heading: "Ignored", instruction: "" }],});assert.equal(action.success, true);- assert.equal(action.action.output, "summary");+ assert.equal(action.action.output, "chat");assert.equal(action.action.sections, null, "only templates have sections");assert.equal(db.createAction("Ask", "", "Draft it.", undefined, { kind: "action" }).action.output,@@ -223,8 +224,8 @@ test("templates and actions are validated and normalized when saved", (t) => {test("an older build renaming the newer built-ins doesn't stop the next launch", (t) => {const db = createDb(t);if (!db) return;- const newerKeys = ["notes.actions.builtin.makeTodos", "notes.actions.builtin.createOutline"];- // What a build that predates Create to-dos and Create outline does to their rows.+ const newerKeys = ["notes.actions.builtin.makeTodos", "notes.actions.builtin.lengthen"];+ // What a build that predates these built-ins does to their rows.db.db.prepare("UPDATE actions SET translation_key = ? WHERE is_builtin = 1 AND translation_key IN (?, ?)"@@ -239,14 +240,138 @@ test("an older build renaming the newer built-ins doesn't stop the next launch",});});-test("a built-in action pointed at the summary stays there across launches", (t) => {+test("legacy summary destinations read as chat without changing the stored row", (t) => {const db = createDb(t);if (!db) return;- const [email] = builtinRows(db, FOLLOW_UP_EMAIL_KEY);- assert.equal(db.updateAction(email.id, { output: "summary" }).success, true);+ const { action } = db.createAction(+ "Make notes shorter",+ "Keep this description",+ "My edited prompt",+ "mail",+ { kind: "action" }+ );+ db.db.prepare("UPDATE actions SET output = 'summary' WHERE kind = 'action'").run();+ const raw = db.db.prepare("SELECT * FROM actions WHERE id = ?").get(action.id);+ assert.equal(db.getAction(action.id).output, "chat", "reads ignore stale output before restart");db.db.close();+ for (let run = 0; run < 2; run++)+ relaunch((reopened) => {+ assert.deepEqual(+ reopened.db.prepare("SELECT * FROM actions WHERE id = ?").get(action.id),+ raw+ );+ assert.equal(reopened.getAction(action.id).output, "chat");+ assert.equal(builtinRows(reopened, FOLLOW_UP_EMAIL_KEY)[0].output, "chat");+ assert.equal(builtinRows(reopened, "notes.actions.builtin.addTldr")[0].output, "chat");+ assert.equal(builtinRows(reopened, "notes.actions.builtin.lengthen").length, 1);+ });+});- relaunch((reopened) => {- assert.equal(builtinRows(reopened, FOLLOW_UP_EMAIL_KEY)[0].output, "summary");+test("writes enforce stored built-in identity and still reject invalid destinations", (t) => {+ const db = createDb(t);+ if (!db) return;+ for (const key of ["shorten", "lengthen"]) {+ const [row] = builtinRows(db, `notes.actions.builtin.${key}`);+ const updated = db.updateAction(row.id, {+ output: "chat",+ prompt: "Edited instructions",+ is_builtin: 0,+ translation_key: null,+ });+ assert.equal(updated.action.output, "summary");+ assert.equal(updated.action.prompt, "Edited instructions");+ }+ const { action } = db.createAction("Make notes longer", "", "Update the summary", undefined, {+ kind: "action",+ output: "summary",+ });+ const updated = db.updateAction(action.id, {+ output: "summary",+ is_builtin: 1,+ translation_key: "notes.actions.builtin.lengthen",+ client_id: "notes.actions.builtin.lengthen",});+ assert.equal(updated.action.output, "chat");+ assert.equal(updated.action.client_id, action.client_id);+ assert.equal(db.updateAction(action.id, { output: "auto" }).success, false);+ assert.equal(+ db.createAction("Bad", "", "x", undefined, { kind: "action", output: "unknown" }).success,+ false+ );+});++test("renamed built-ins upgrade stock labels but keep user edits", (t) => {+ const db = createDb(t);+ if (!db) return;+ const renamed = BUILTIN_ACTIONS.filter((a) => a.previousNames?.length);+ for (const a of renamed)+ db.db+ .prepare("UPDATE actions SET name = ?, description = ? WHERE translation_key = ?")+ .run(a.previousNames[0], a.previousDescriptions[0], a.translationKey);+ db.db.close();+ relaunch((upgraded) => {+ for (const a of renamed) {+ const [row] = builtinRows(upgraded, a.translationKey);+ assert.equal(row.name, a.name);+ assert.equal(row.description, a.description);+ upgraded.updateAction(row.id, {+ name: "My label",+ description: "My description",+ prompt: "My prompt",+ });+ }+ assert.deepEqual(+ upgraded+ .getActions()+ .filter((a) => a.kind === "action")+ .slice(0, 5)+ .map((a) => a.translation_key.split(".").pop()),+ ["followUpEmail", "makeTodos", "shorten", "lengthen", "addTldr"]+ );+ });+ relaunch((steady) => {+ for (const a of renamed) {+ const [row] = builtinRows(steady, a.translationKey);+ assert.equal(row.name, "My label");+ assert.equal(row.description, "My description");+ assert.equal(row.prompt, "My prompt");+ }+ });+});++test("TL;DR stock prompt upgrades without replacing an edited description", (t) => {+ const db = createDb(t);+ if (!db) return;+ const tldr = BUILTIN_ACTIONS.find((a) => a.translationKey.endsWith(".addTldr"));+ const [row] = builtinRows(db, tldr.translationKey);+ db.db+ .prepare("UPDATE actions SET prompt = ?, description = ? WHERE id = ?")+ .run(tldr.previousPrompts[0], "My description", row.id);+ db.db.close();+ relaunch((upgraded) => {+ const action = upgraded.getAction(row.id);+ assert.equal(action.prompt, tldr.prompt);+ assert.equal(action.description, "My description");+ assert.equal(action.output, "chat");+ });+});++test("TL;DR upgrades its stock icon and leaves custom icons alone", (t) => {+ const db = createDb(t);+ if (!db) return;+ const [tldr] = builtinRows(db, "notes.actions.builtin.addTldr");+ const custom = db.createAction("Write TL;DR", "My description", "My prompt", "sparkles", {+ kind: "action",+ }).action;+ const customBefore = db.db.prepare("SELECT * FROM actions WHERE id = ?").get(custom.id);+ db.db.prepare("UPDATE actions SET icon = 'sparkles' WHERE id = ?").run(tldr.id);+ db.db.close();+ for (let run = 0; run < 2; run++)+ relaunch((reopened) => {+ assert.equal(reopened.getAction(tldr.id).icon, "message-square-text");+ assert.deepEqual(+ reopened.db.prepare("SELECT * FROM actions WHERE id = ?").get(custom.id),+ customBefore+ );+ });});diff --git a/test/helpers/templatePrompts.test.js b/test/helpers/templatePrompts.test.jsindex 735347128..65f8d6b16 100644--- a/test/helpers/templatePrompts.test.js+++ b/test/helpers/templatePrompts.test.js@@ -202,3 +202,17 @@ test("a chat action works from the summary when there is one, and the transcript);}});++test("TL;DR is a standalone chat reply and lengthening keeps supported facts", async () => {+ const { BUILTIN_ACTIONS, compileChatActionPrompt } = await load();+ const tldr = BUILTIN_ACTIONS.find((a) => a.translationKey.endsWith(".addTldr"));+ assert.equal(tldr.output, "chat");+ const request = compileChatActionPrompt(tldr, { fromSummary: true });+ assert.match(request, /two- or three-sentence TL;DR/);+ assert.match(request, /Return only the TL;DR in chat/);+ assert.doesNotMatch(request, /Leave the rest|at the very top|complete revised summary/);+ const longer = BUILTIN_ACTIONS.find((a) => a.translationKey.endsWith(".lengthen"));+ assert.match(longer.prompt, /Never invent facts/);+ assert.match(longer.prompt, /do not pad with repetition/);+ assert.match(longer.prompt, /keep every name, number, date, decision, and action item/);+});diff --git a/test/stores/actionProcessingChunked.test.js b/test/stores/actionProcessingChunked.test.jsindex e21552739..fe0d32578 100644--- a/test/stores/actionProcessingChunked.test.js+++ b/test/stores/actionProcessingChunked.test.js@@ -180,11 +180,11 @@ test("a summary action writing a first summary splits a refused recording like aconst { store, calls, updates } = await loadStore(t, { failFirst: true });const tldr = {id: 2,- client_id: "tldr",+ client_id: "notes.actions.builtin.lengthen",kind: "action",output: "summary",name: "Add TL;DR",- prompt: "Add a TL;DR.",+ prompt: "Add supported detail.",};run(store, 30, longMaterial(400), { fromSummary: false }, tldr);await waitFor(() => updates.length > 0, "save");@@ -200,7 +200,7 @@ test("a summary action writing a first summary splits a refused recording like aassert.equal(part.config.refuseClippedByWindow, false);}assert.equal(calls.at(-1).config.requireCompleteOutput, undefined);- assert.match(calls.at(-1).config.systemPrompt, /no AI summary yet[\s\S]*Add a TL;DR\./);+ assert.match(calls.at(-1).config.systemPrompt, /no AI summary yet[\s\S]*Add supported detail\./);assert.deepEqual(Object.keys(updates[0].payload), ["enhanced_content","enhanced_at_content_hash",diff --git a/test/stores/actionProcessingNoteOutput.test.js b/test/stores/actionProcessingNoteOutput.test.jsindex 1e655dd90..153f3e211 100644--- a/test/stores/actionProcessingNoteOutput.test.js+++ b/test/stores/actionProcessingNoteOutput.test.js@@ -273,11 +273,11 @@ test("a summary action on a note without a summary writes one from the transcripconst { store, calls, updates } = await loadStore(t);const action = {id: 6,- client_id: "tldr",+ client_id: "notes.actions.builtin.lengthen",kind: "action",output: "summary",- name: "TL;DR",- prompt: "Add a TL;DR.",+ name: "Make notes longer",+ prompt: "Add supported detail.",};store.runBackgroundAction(@@ -290,7 +290,7 @@ test("a summary action on a note without a summary writes one from the transcrip);await waitFor(() => updates.length > 0, "the note to be written");- assert.match(calls[0].config.systemPrompt, /no AI summary yet[\s\S]*Add a TL;DR\.$/);+ assert.match(calls[0].config.systemPrompt, /no AI summary yet[\s\S]*Add supported detail\.$/);assert.equal(calls[0].text, "## Meeting Transcript\nAlice: we ship Friday.");assert.equal(calls[0].config.requireCompleteOutput, undefined, "nothing to lose yet");assert.deepEqual(Object.keys(updates[0].payload), [@@ -370,7 +370,7 @@ test("Undo of a first summary clears it with an empty string, which sync can't i});test("a write the database refused offers no Undo and reports the failure", async (t) => {- const { store, updates } = await loadStore(t);+ const { store } = await loadStore(t);globalThis.__updateNoteFails = true;store.runBackgroundAction(17,@@ -460,3 +460,25 @@ test("a summary that merely contains the marker is still saved", async (t) => {}assert.deepEqual(store.consumeErrorEvents(), []);});++test("cancelling a summary action before a provider returns keeps the saved summary and Undo queue unchanged", async (t) => {+ const { store, calls, updates } = await loadStore(t);+ let finish;+ globalThis.__processTextResult = new Promise((resolve) => {+ finish = resolve;+ });+ store.runBackgroundAction(+ 120,+ "## Current Summary\nOriginal",+ "hash",+ { kind: "action", name: "Shorten", prompt: "Revise" },+ { isCloudMode: true, fromSummary: true },+ LABELS+ );+ await waitFor(() => calls.length === 1, "provider start");+ store.cancelAction(120);+ finish("A late reply");+ await new Promise((resolve) => setImmediate(resolve));+ assert.deepEqual(updates, []);+ assert.deepEqual(store.consumeAppliedEvents(), []);+});diff --git a/test/utils/inferActionOutput.test.js b/test/utils/inferActionOutput.test.jsdeleted file mode 100644index aeadd412c..000000000--- a/test/utils/inferActionOutput.test.js+++ /dev/null@@ -1,55 +0,0 @@-const test = require("node:test");-const assert = require("node:assert/strict");-const { createRendererServer, installBrowserGlobals } = require("../lib/rendererTestHarness");--async function loadInfer(t, reply) {- installBrowserGlobals(t);- const calls = [];- globalThis.__inferCalls = calls;- globalThis.__inferReply = reply;- t.after(() => {- delete globalThis.__inferCalls;- delete globalThis.__inferReply;- });- const vite = await createRendererServer(t, {- cachePrefix: "openwhispr-infer-action-output-test-",- mockModules: {- "/services/ReasoningService": `- export default {- processText: async (text, model, agentName, config) => {- globalThis.__inferCalls.push({ text, model, config });- const reply = globalThis.__inferReply;- if (reply instanceof Error) throw reply;- return reply;- },- };- `,- },- });- const { inferActionOutput } = await vite.ssrLoadModule("/utils/inferActionOutput.ts");- return { inferActionOutput, calls };-}--test("an action that changes the summary is inferred as a summary action", async (t) => {- const { inferActionOutput, calls } = await loadInfer(t, "SUMMARY");- assert.equal(await inferActionOutput("Translate it to Spanish.", "gpt-4.1", true), "summary");- assert.equal(calls[0].text, "Translate it to Spanish.");- assert.equal(calls[0].config.inferenceScope, "noteFormatting", "asks the note model");- assert.equal(calls[0].config.disableThinking, true, "thinking text would hide the answer");-});--test("a reply is read by its first word, whatever the case or punctuation", async (t) => {- const { inferActionOutput } = await loadInfer(t, " summary.");- assert.equal(await inferActionOutput("Shorten it.", "gpt-4.1", true), "summary");- globalThis.__inferReply = "<think>Could be chat, but it rewrites the summary.</think>\nSUMMARY";- assert.equal(await inferActionOutput("Make it longer.", "gpt-4.1", true), "summary");- globalThis.__inferReply = "CHAT — it writes an email, not the summary";- assert.equal(await inferActionOutput("Draft an email.", "gpt-4.1", true), "chat");-});--test("without an answer, an action answers in chat and leaves the summary alone", async (t) => {- const { inferActionOutput } = await loadInfer(t, new Error("no model"));- assert.equal(await inferActionOutput("Anything.", "", false), "chat");- globalThis.__inferReply = "";- assert.equal(await inferActionOutput("Anything.", "gpt-4.1", true), "chat");-});