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
feat: New note button, pill and tray quick actions, and settings polish (#2163)
void48ec6308b0ff
diff --git a/main.js b/main.jsindex 1ab486465..cf28b34dd 100644--- a/main.js+++ b/main.js@@ -1163,11 +1163,8 @@ async function startApp() {const isMeetingPress = createHotkeyRepeatGate();const meetingHotkeyCallback = () => {if (!isMeetingPress()) return;- if (hotkeyManager.isInListeningMode()) return;- // Fail closed during onboarding, like every other hotkey slot.- if (!windowManager.isMeetingInputAllowed()) return;debugLogger.info("Meeting hotkey triggered", {}, "meeting");- meetingDetectionEngine?.startManualMeeting();+ windowManager.startManualMeeting();};const savedMeetingKey = environmentManager.getMeetingKey?.() || "";@@ -1334,6 +1331,9 @@ async function startApp() {trayManager.setWindows(windowManager.mainWindow, windowManager.controlPanelWindow);trayManager.setWindowManager(windowManager);+ // The tray's listen item is a toggle, so it has to rebuild when dictation+ // starts or stops.+ windowManager.onDictationStateChanged = () => trayManager.updateTrayMenu();trayManager.setCreateControlPanelCallback(() => windowManager.createControlPanelWindow());await trayManager.createTray();@@ -1728,9 +1728,7 @@ async function startApp() {} else if (hotkeyManager.slotHasHotkey("translation", key)) {windowManager.sendToggleTranslation();} else if (hotkeyManager.slotHasHotkey("meeting", key)) {- if (!hotkeyManager.isInListeningMode() && windowManager.isMeetingInputAllowed()) {- meetingDetectionEngine?.startManualMeeting();- }+ windowManager.startManualMeeting();}};diff --git a/preload.js b/preload.jsindex c0a5d0275..169da6cc2 100644--- a/preload.js+++ b/preload.js@@ -90,6 +90,7 @@ contextBridge.exposeInMainWorld("electronAPI", {onToggleDictation: registerListener("toggle-dictation", (callback) => () => callback()),onToggleVoiceAgent: registerListener("toggle-voice-agent", (callback) => () => callback()),onToggleTranslation: registerListener("toggle-translation", (callback) => () => callback()),+ onOpenAssistantPanel: registerListener("open-assistant-panel", (callback) => () => callback()),onStartDictation: registerListener("start-dictation", (callback) => () => callback()),onStopDictation: registerListener("stop-dictation", (callback) => () => callback()),onPrepareDictation: registerListener(@@ -1340,6 +1341,7 @@ contextBridge.exposeInMainWorld("electronAPI", {meetingNotificationRespond: (detectionId, action) =>ipcRenderer.invoke("meeting-notification-respond", detectionId, action),joinCalendarMeeting: (eventId) => ipcRenderer.invoke("join-calendar-meeting", eventId),+ startManualMeeting: () => ipcRenderer.invoke("start-manual-meeting"),getPendingMeetingNoteNavigation: () => ipcRenderer.invoke("get-pending-meeting-note-navigation"),onMeetingNoteNavigationPending: registerListener("meeting-note-navigation-pending",diff --git a/src/App.jsx b/src/App.jsxindex 981485415..54ff9847b 100644--- a/src/App.jsx+++ b/src/App.jsx@@ -16,6 +16,8 @@ import { useWindowResizeCompensation } from "./hooks/useWindowResizeCompensationimport { useSettingsStore } from "./stores/settingsStore";import { isAgentAllowed } from "./stores/policyRules";import { usePolicyStore } from "./stores/policyStore";+import { useTranscriptionContextAllowed } from "./hooks/usePolicy";+import { useTrayQuickActions } from "./hooks/useTrayQuickActions";import { VoicePill } from "./components/dictation/VoicePill";import { AssistantPanel } from "./components/dictation/AssistantPanel";import { LiveTranscriptPanel } from "./components/dictation/LiveTranscriptPanel";@@ -112,6 +114,12 @@ export default function App() {useMainProcessNotifications({ toast, dismiss, t });const agentAllowed = usePolicyStore(isAgentAllowed);+ const meetingAllowed = useTranscriptionContextAllowed("meeting");+ // Both allowances fail closed while the policy is loading or its fetch failed,+ // so the tray's refusals need to tell those apart from a real org restriction.+ const policyStatus = usePolicyStore((state) => state.status);+ const policyResolved =+ policyStatus === "idle" || policyStatus === "managed" || policyStatus === "unmanaged";const mainWindowResizeCoordinatorRef = useRef(null);useEffect(() => {@@ -172,7 +180,11 @@ export default function App() {recordingControlsRef,onPanelOpened,});- const { noteDictationError, openRef: assistantOpenRef } = assistant;+ const {+ noteDictationError,+ openRef: assistantOpenRef,+ openPanel: openAssistantPanel,+ } = assistant;const handleDictationError = React.useCallback((options = {}) => {@@ -371,6 +383,28 @@ export default function App() {return () => unsubscribe?.();}, [isRecording, isPreparing, isProcessing, cancelRecording, cancelProcessing]);+ // Every tray refusal surfaces the pill first, so the message is visible even+ // when the pill was hidden. useTrayQuickActions decides when one is needed.+ const refuse = useCallback(+ (messageKey) => {+ void window.electronAPI?.showDictationPanel?.();+ toast({ title: t(messageKey), variant: "default" });+ },+ [toast, t]+ );++ const closeCommandMenu = useCallback(() => setIsCommandMenuOpen(false), []);++ useTrayQuickActions({+ agentAllowed,+ policyResolved,+ isRecording,+ liveTranscriptMounted: liveTranscript.mounted,+ closeCommandMenu,+ openAssistantPanel,+ refuse,+ });+// Auto-hide the floating icon when idle (setting enabled or dictation cycle completed)useEffect(() => {let hideTimeout;@@ -722,6 +756,7 @@ export default function App() {buttonRef={buttonRef}isRecording={isRecording}agentAllowed={agentAllowed}+ meetingAllowed={meetingAllowed}isHovered={isHovered}setWindowInteractivity={setWindowInteractivity}onToggleListening={() => {@@ -729,7 +764,11 @@ export default function App() {}}onAskAssistant={() => {setIsCommandMenuOpen(false);- assistant.openPanel();+ void openAssistantPanel();+ }}+ onStartMeeting={() => {+ setIsCommandMenuOpen(false);+ void window.electronAPI?.startManualMeeting?.();}}onHide={() => {setIsCommandMenuOpen(false);diff --git a/src/components/ControlPanel.tsx b/src/components/ControlPanel.tsxindex c44e5ebce..6435f9792 100644--- a/src/components/ControlPanel.tsx+++ b/src/components/ControlPanel.tsx@@ -154,6 +154,7 @@ export default function ControlPanel({ initialSettingsSection }: ControlPanelProfolderId: number;event: any;} | null>(null);+ const [topBarActions, setTopBarActions] = useState<HTMLDivElement | null>(null);const [gpuBannerDismissed, setGpuBannerDismissed] = useState(() => localStorage.getItem("gpuBannerDismissedUnified") === "true");@@ -1027,6 +1028,7 @@ export default function ControlPanel({ initialSettingsSection }: ControlPanelProonOpenSearch={() => setShowSearch(true)}isSidePanelLayout={isSidePanelLayout}onExitSidePanel={handleExitSidePanel}+ actionsSlotRef={setTopBarActions}/><div className="scrollbar-hidden flex-1 overflow-y-auto">{updateRequiredByOrg && (@@ -1183,6 +1185,8 @@ export default function ControlPanel({ initialSettingsSection }: ControlPanelProonMeetingRecordingRequestHandled={handleMeetingRecordingRequestHandled}invitationEntry={invitationNotesEntry}onInvitationEntryHandled={() => setInvitationNotesEntry(null)}+ topBarActions={topBarActions}+ onNewChat={agentAllowedByPolicy ? () => setActiveView("chat") : undefined}/></Suspense>)}diff --git a/src/components/ControlPanelTopBar.tsx b/src/components/ControlPanelTopBar.tsxindex 617236a6d..98d8948c5 100644--- a/src/components/ControlPanelTopBar.tsx+++ b/src/components/ControlPanelTopBar.tsx@@ -24,6 +24,8 @@ interface ControlPanelTopBarProps {/** Meeting mode or a narrow window with an open note: sidebar hidden, back button shown. */isSidePanelLayout: boolean;onExitSidePanel: () => void;+ /** Receives the slot, right of the search bar, that the active page portals its actions into. */+ actionsSlotRef?: React.Ref<HTMLDivElement>;}export default function ControlPanelTopBar({@@ -35,6 +37,7 @@ export default function ControlPanelTopBar({onOpenSearch,isSidePanelLayout,onExitSidePanel,+ actionsSlotRef,}: ControlPanelTopBarProps) {const { t } = useTranslation();// With the sidebar out of the way the container's start edge sits under the@@ -44,7 +47,8 @@ export default function ControlPanelTopBar({return (<headerclassName={cn(- "grid h-12 shrink-0 grid-cols-[minmax(0,1fr)_minmax(0,340px)_minmax(0,1fr)] items-center gap-4 border-b border-border px-3 dark:border-white/10",+ // The trailing column never shrinks past its actions and window controls.+ "grid h-12 shrink-0 grid-cols-[minmax(0,1fr)_minmax(0,340px)_minmax(max-content,1fr)] items-center gap-4 border-b border-border px-3 dark:border-white/10",// Eased with the sidebar spacer so the toggle glides instead of jumping when the// clearance switches; a jump would drag it back under the cursor and re-trigger peek."transition-[padding] duration-300 ease-out",@@ -95,7 +99,7 @@ export default function ControlPanelTopBar({onClick={onOpenSearch}data-no-window-drag=""style={noDragStyle}- className="flex h-8 w-full items-center gap-2.5 rounded-full bg-foreground/4 px-4 text-start outline-none transition-colors duration-150 hover:bg-foreground/6 focus-visible:ring-1 focus-visible:ring-primary/30 dark:bg-white/5 dark:hover:bg-white/8"+ className="flex h-8 w-full items-center gap-2.5 rounded-full border border-border bg-foreground/4 px-4 text-start outline-none transition-colors duration-150 hover:bg-foreground/6 focus-visible:ring-1 focus-visible:ring-primary/30 dark:border-white/10 dark:bg-white/5 dark:hover:bg-white/8"><Search size={14} className="shrink-0 text-muted-foreground/70" /><span className="flex-1 truncate text-[13px] text-muted-foreground/70">@@ -110,9 +114,19 @@ export default function ControlPanelTopBar({</button>)}- <div className="col-start-3 flex items-center justify-self-end">+ <div className="col-start-3 flex items-center gap-2">+ {!isSidePanelLayout && (+ <div+ ref={actionsSlotRef}+ data-no-window-drag=""+ style={noDragStyle}+ // macOS keeps no window controls here, so page actions take the far+ // end; elsewhere they sit beside the search, left of the controls.+ className={cn("flex items-center", platform === "darwin" && "ms-auto")}+ />+ )}{platform !== "darwin" && (- <div data-no-window-drag="" style={noDragStyle}>+ <div data-no-window-drag="" style={noDragStyle} className="ms-auto"><WindowControls /></div>)}diff --git a/src/components/SettingsModal.tsx b/src/components/SettingsModal.tsxindex b0bdd2a02..a11f0fe82 100644--- a/src/components/SettingsModal.tsx+++ b/src/components/SettingsModal.tsx@@ -10,6 +10,7 @@ import {Keyboard,CreditCard,Shield,+ ShieldCheck,Users,} from "./icons";import SidebarModal, { type SidebarItem } from "./ui/SidebarModal";@@ -179,12 +180,15 @@ export default function SettingsModal({ open, onOpenChange, initialSection }: Se</div>) : undefined}+ notice={+ policyManaged ? (+ <>+ <ShieldCheck className="h-4 w-4 shrink-0" />+ {t("settingsModal.managedByOrg")}+ </>+ ) : undefined+ }>- {policyManaged && (- <div className="mx-4 mt-4 rounded-lg border border-primary/20 bg-primary/8 px-3 py-2 text-sm text-primary dark:border-primary/30 dark:bg-primary/15">- {t("settingsModal.managedByOrg")}- </div>- )}<SettingsPageactiveSection={activeSection}onNavigateToSection={handleSectionChange}diff --git a/src/components/dictation/PillCommandMenu.tsx b/src/components/dictation/PillCommandMenu.tsxindex 31a357042..9eee79638 100644--- a/src/components/dictation/PillCommandMenu.tsx+++ b/src/components/dictation/PillCommandMenu.tsx@@ -6,10 +6,12 @@ interface PillCommandMenuProps {buttonRef: React.RefObject<HTMLDivElement | null>;isRecording: boolean;agentAllowed: boolean;+ meetingAllowed: boolean;isHovered: boolean;setWindowInteractivity: (capture: boolean) => void;onToggleListening: () => void;onAskAssistant: () => void;+ onStartMeeting: () => void;onHide: () => void;onClose: () => void;}@@ -22,10 +24,12 @@ export function PillCommandMenu({buttonRef,isRecording,agentAllowed,+ meetingAllowed,isHovered,setWindowInteractivity,onToggleListening,onAskAssistant,+ onStartMeeting,onHide,onClose,}: PillCommandMenuProps): React.JSX.Element {@@ -83,6 +87,17 @@ export function PillCommandMenu({</button></>)}+ {meetingAllowed && !isRecording && (+ <>+ <div className="h-px bg-border" />+ <button+ className="w-full px-3 py-2 text-start text-sm hover:bg-muted focus:bg-muted focus:outline-none"+ onClick={onStartMeeting}+ >+ {t("app.commandMenu.startMeetingRecording")}+ </button>+ </>+ )}<div className="h-px bg-border" /><buttonclassName="w-full px-3 py-2 text-start text-sm hover:bg-muted focus:bg-muted focus:outline-none"diff --git a/src/components/notes/NewNoteMenu.tsx b/src/components/notes/NewNoteMenu.tsxnew file mode 100644index 000000000..c17ed013a--- /dev/null+++ b/src/components/notes/NewNoteMenu.tsx@@ -0,0 +1,117 @@+import { useRef, useState } from "react";+import { useTranslation } from "react-i18next";+import { ChevronDown, MessageSquare, NotebookPen, Plus, Users } from "../icons";+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuSeparator,+ DropdownMenuTrigger,+} from "../ui/dropdown-menu";+import {+ SPLIT_BUTTON_DIVIDER_CLASS,+ SPLIT_BUTTON_GROUP_CLASS,+ SPLIT_BUTTON_SEGMENT_CLASS,+} from "../ui/splitButton";+import { cn } from "../lib/utils";+import { useCanCreateTeamSpace } from "../../hooks/useCanCreateTeamSpace";+import CreateSpaceDialog from "./CreateSpaceDialog";++// Matched to the search bar it sits beside: the same translucent fill that+// lifts on hover, under the same hairline. The note's Share control keeps its+// own pill, so these apply to this instance of the shared split button rather+// than to the definition both share.+const SOFT_GROUP_CLASS = "bg-foreground/4 dark:bg-white/5";+const SOFT_SEGMENT_CLASS =+ "hover:bg-foreground/6 focus-visible:bg-foreground/6 focus-visible:ring-1 focus-visible:ring-primary/30 dark:hover:bg-white/8 dark:focus-visible:bg-white/8";+const SOFT_DIVIDER_CLASS = "bg-foreground/8";++interface NewNoteMenuProps {+ onNewNote: () => void;+ /** Opens a new chat in the Chat tab; omitted when policy turns the assistant off. */+ onNewChat?: () => void;+}++/** The Notes topbar's split "New note" button; the chevron offers the other things to create. */+export default function NewNoteMenu({ onNewNote, onNewChat }: NewNoteMenuProps) {+ const { t } = useTranslation();+ const canCreateTeamSpace = useCanCreateTeamSpace();+ const [createSpaceOpen, setCreateSpaceOpen] = useState(false);+ const itemChosenRef = useRef(false);++ // The chat input and the space dialog take focus themselves, so those closes+ // keep it. A new note focuses nothing (the editor mounts fresh), and dismissing+ // the menu returns focus to the chevron, as Radix does by default.+ const keepFocus = (action: () => void) => () => {+ itemChosenRef.current = true;+ action();+ };++ return (+ <>+ <div className={cn(SPLIT_BUTTON_GROUP_CLASS, SOFT_GROUP_CLASS, "h-8")}>+ <button+ type="button"+ onClick={onNewNote}+ className={cn(+ SPLIT_BUTTON_SEGMENT_CLASS,+ SOFT_SEGMENT_CLASS,+ "gap-1.5 whitespace-nowrap ps-3 pe-3.5"+ )}+ >+ <Plus size={14} />+ {t("notes.list.newNote")}+ </button>+ <span aria-hidden="true" className={cn(SPLIT_BUTTON_DIVIDER_CLASS, SOFT_DIVIDER_CLASS)} />+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <button+ type="button"+ aria-label={t("notes.createMenu.chooseType")}+ className={cn(SPLIT_BUTTON_SEGMENT_CLASS, SOFT_SEGMENT_CLASS, "w-8 justify-center")}+ >+ <ChevronDown size={14} />+ </button>+ </DropdownMenuTrigger>+ <DropdownMenuContent+ align="end"+ sideOffset={6}+ className="min-w-44"+ onCloseAutoFocus={(event) => {+ if (!itemChosenRef.current) return;+ itemChosenRef.current = false;+ event.preventDefault();+ }}+ >+ <DropdownMenuItem onSelect={onNewNote} className="gap-2.5">+ <NotebookPen className="h-4 w-4" />+ {t("notes.createMenu.note")}+ </DropdownMenuItem>+ {onNewChat && (+ <>+ <DropdownMenuSeparator />+ <DropdownMenuItem onSelect={keepFocus(onNewChat)} className="gap-2.5">+ <MessageSquare className="h-4 w-4" />+ {t("notes.createMenu.assistantChat")}+ </DropdownMenuItem>+ </>+ )}+ {canCreateTeamSpace && (+ <>+ <DropdownMenuSeparator />+ <DropdownMenuItem+ onSelect={keepFocus(() => setCreateSpaceOpen(true))}+ className="gap-2.5"+ >+ <Users className="h-4 w-4" />+ {t("notes.createMenu.teamSpace")}+ </DropdownMenuItem>+ </>+ )}+ </DropdownMenuContent>+ </DropdownMenu>+ </div>+ <CreateSpaceDialog open={createSpaceOpen} onOpenChange={setCreateSpaceOpen} />+ </>+ );+}diff --git a/src/components/notes/NoteEditor.tsx b/src/components/notes/NoteEditor.tsxindex 0e1d01138..1386805ea 100644--- a/src/components/notes/NoteEditor.tsx+++ b/src/components/notes/NoteEditor.tsx@@ -54,6 +54,11 @@ import {DropdownMenuSeparator,} from "../ui/dropdown-menu";import { cn } from "../lib/utils";+import {+ SPLIT_BUTTON_DIVIDER_CLASS,+ SPLIT_BUTTON_GROUP_CLASS,+ SPLIT_BUTTON_SEGMENT_CLASS,+} from "../ui/splitButton";import type { NoteItem, FolderItem } from "../../types/electron";import type { ActionProcessingState } from "../../hooks/useActionProcessing";import ActionProcessingOverlay from "./ActionProcessingOverlay";@@ -78,10 +83,6 @@ import { NOTE_META_CHIP_CLASS, defaultFolderDisplayName, folderMatchesQuery } frconst SEGMENT_BUTTON_CLASS ="relative z-1 flex h-[26px] items-center gap-1.5 rounded-full px-2.5 text-xs font-medium transition-colors duration-150";-const SHARE_GROUP_CLASS =- "flex h-[30px] items-stretch overflow-hidden rounded-full border border-border bg-surface-3 dark:border-white/10 dark:bg-surface-2";-const SHARE_SEGMENT_CLASS =- "flex items-center text-xs font-medium text-foreground/80 outline-none transition-colors duration-150 hover:bg-surface-raised hover:text-foreground focus-visible:bg-surface-raised dark:hover:bg-surface-3";const TRANSCRIPT_EXPORT_LABEL_KEYS = {txt: "notes.editor.asTranscriptText",@@ -1055,7 +1056,7 @@ export default function NoteEditor({)}><Sparkles size={12} />- {t("notes.editor.enhanced")}+ {t("notes.editor.aiSummary")}{enhancement.isStale && (<spanclassName="h-1 w-1 rounded-full bg-amber-400/60"@@ -1076,21 +1077,21 @@ export default function NoteEditor({onStop={onStopRecording}/>)}- <div className={SHARE_GROUP_CLASS}>+ <div className={cn(SPLIT_BUTTON_GROUP_CLASS, "h-[30px]")}><buttontype="button"onClick={() => openShare("open")}- className={cn(SHARE_SEGMENT_CLASS, "gap-1.5 ps-2.5 pe-3")}+ className={cn(SPLIT_BUTTON_SEGMENT_CLASS, "gap-1.5 ps-2.5 pe-3")}><Lock size={13} className={isShared ? "text-primary" : "text-foreground/60"} />{t("noteEditor.share.button")}</button>- <span aria-hidden="true" className="my-1.5 w-px bg-border dark:bg-white/10" />+ <span aria-hidden="true" className={SPLIT_BUTTON_DIVIDER_CLASS} /><buttontype="button"onClick={() => openShare("copy-link")}aria-label={t("noteEditor.share.dialog.copyLink")}- className={cn(SHARE_SEGMENT_CLASS, "w-[30px] justify-center")}+ className={cn(SPLIT_BUTTON_SEGMENT_CLASS, "w-[30px] justify-center")}><Link2 size={13} className="text-foreground/60" /></button>diff --git a/src/components/notes/PersonalNotesView.tsx b/src/components/notes/PersonalNotesView.tsxindex f5bbe6947..cf50cda5a 100644--- a/src/components/notes/PersonalNotesView.tsx+++ b/src/components/notes/PersonalNotesView.tsx@@ -1,9 +1,11 @@import { useState, useEffect, useRef, useCallback, useMemo } from "react";+import { createPortal } from "react-dom";import { useTranslation } from "react-i18next";import { useShallow } from "zustand/react/shallow";import { Plus, Sparkles } from "../icons";import { useToast } from "../ui/useToast";import NoteEditor from "./NoteEditor";+import NewNoteMenu from "./NewNoteMenu";import SpacesTree from "./SpacesTree";import { ContainerOverview } from "./overview/ContainerOverview";import NotesStructureIntroDialog from "./NotesStructureIntroDialog";@@ -125,6 +127,10 @@ interface PersonalNotesViewProps {onMeetingRecordingRequestHandled?: () => void;invitationEntry?: { workspaceId: string; teamIds: string[] } | null;onInvitationEntryHandled?: () => void;+ /** The topbar slot the New note button portals into; null while the topbar hides it. */+ topBarActions?: HTMLElement | null;+ /** Opens a new chat in the Chat tab; omitted when policy turns the assistant off. */+ onNewChat?: () => void;}export default function PersonalNotesView({@@ -133,6 +139,8 @@ export default function PersonalNotesView({onMeetingRecordingRequestHandled,invitationEntry,onInvitationEntryHandled,+ topBarActions,+ onNewChat,}: PersonalNotesViewProps) {const isMeetingMode = useIsMeetingMode();const isNarrowWindow = useIsNarrowWindow();@@ -765,6 +773,11 @@ export default function PersonalNotesView({return (<div className="flex h-full">+ {topBarActions &&+ createPortal(+ <NewNoteMenu onNewNote={handleNewNote} onNewChat={onNewChat} />,+ topBarActions+ )}<divclassName="shrink-0 overflow-hidden transition-[width] duration-300 ease-out"style={{ width: isSidePanelLayout ? 0 : "13rem" }}diff --git a/src/components/notes/SpacesTree.tsx b/src/components/notes/SpacesTree.tsxindex 83f260296..e956c8c43 100644--- a/src/components/notes/SpacesTree.tsx+++ b/src/components/notes/SpacesTree.tsx@@ -35,6 +35,7 @@ import { useDialogs } from "../../hooks/useDialogs";import { useToast } from "../ui/useToast";import { useNoteDragAndDrop, type NoteMoveTarget } from "../../hooks/useNoteDragAndDrop";import { useTeamSpacesCapability } from "../../hooks/useTeamSpacesCapability";+import { useCanCreateTeamSpace } from "../../hooks/useCanCreateTeamSpace";import { useAuth } from "../../hooks/useAuth";import { useWorkspace } from "../../hooks/useWorkspace";import { EmojiPickerInput } from "./EmojiPickerInput";@@ -1175,6 +1176,7 @@ export default function SpacesTree({const isTreeLoading = useIsTreeLoading();const { isSignedIn, user } = useAuth();const teamCapability = useTeamSpacesCapability(isSignedIn);+ const canCreateTeamSpace = useCanCreateTeamSpace();const { workspaces, loaded: workspacesLoaded } = useWorkspace();const noteFilesEnabled = useSettingsStore((s) => s.noteFilesEnabled);const shareByCloudId = useShareCache();@@ -1236,12 +1238,6 @@ export default function SpacesTree({// errors still flip `loaded`, so this can't skeleton forever.const workspacesPending = isSignedIn && !workspacesLoaded;- // The server 403s team creation for plain members; no-workspace users get the create funnel.- const canCreateTeamSpace =- isSignedIn &&- workspacesLoaded &&- (workspaces.length === 0 || workspaces.some((w) => canManageWorkspace(w.role)));-const currentUserId = user?.id ?? null;const workspaceRoleFor = (space: SpaceItem | undefined): WorkspaceRole | null =>workspaces.find((w) => w.id === space?.workspace_id)?.role ?? null;diff --git a/src/components/ui/SidebarModal.tsx b/src/components/ui/SidebarModal.tsxindex 25b1f1b4f..630255b55 100644--- a/src/components/ui/SidebarModal.tsx+++ b/src/components/ui/SidebarModal.tsx@@ -2,6 +2,7 @@ import React from "react";import { useTranslation } from "react-i18next";import * as DialogPrimitive from "@radix-ui/react-dialog";import { X } from "../icons";+import { InfoBox } from "./InfoBox";import { SettingsLayoutProvider } from "./useSettingsLayout";import { useDismissGuard } from "./useDismissGuard";@@ -28,6 +29,8 @@ interface SidebarModalProps<T extends string> {version?: string;/** Rendered above the nav (hidden in compact mode), e.g. account identity. */header?: React.ReactNode;+ /** Full-width banner above every section, e.g. an organization-managed notice. */+ notice?: React.ReactNode;}export default function SidebarModal<T extends string>({@@ -41,6 +44,7 @@ export default function SidebarModal<T extends string>({sidebarWidth = "w-52",version,header,+ notice,}: SidebarModalProps<T>) {const { t } = useTranslation();const { registerContent, shouldBlockDismiss } = useDismissGuard<HTMLDivElement>();@@ -110,6 +114,12 @@ export default function SidebarModal<T extends string>({<DialogPrimitive.Overlay className="fixed inset-0 z-50 bg-black/60 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0" /><DialogPrimitive.Contentref={registerContent}+ // Radix focuses the first tabbable on open, which is the close button;+ // focus the dialog itself so the X doesn't open wearing a focus ring.+ onOpenAutoFocus={(e) => {+ e.preventDefault();+ (e.currentTarget as HTMLElement).focus();+ }}onEscapeKeyDown={(e) => {if (document.querySelector("[data-capturing]")) e.preventDefault();}}@@ -119,10 +129,10 @@ export default function SidebarModal<T extends string>({// otherwise take the whole settings modal with it.if (shouldBlockDismiss(e)) e.preventDefault();}}- className="fixed left-[50%] top-[50%] z-50 max-h-[85vh] w-[90vw] max-w-4xl translate-x-[-50%] translate-y-[-50%] rounded-xl p-0 overflow-hidden bg-background border border-border shadow-[0_25px_50px_-12px_rgba(0,0,0,0.25)] dark:bg-surface-1 dark:border-border-subtle dark:shadow-[0_25px_60px_-12px_rgba(0,0,0,0.5),0_0_0_1px_rgba(255,255,255,0.05)] duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-98 data-[state=open]:zoom-in-98"+ className="fixed left-[50%] top-[50%] z-50 max-h-[85vh] w-[90vw] max-w-4xl translate-x-[-50%] translate-y-[-50%] rounded-xl p-0 overflow-hidden outline-none bg-background border border-border shadow-[0_25px_50px_-12px_rgba(0,0,0,0.25)] dark:bg-surface-1 dark:border-border-subtle dark:shadow-[0_25px_60px_-12px_rgba(0,0,0,0.5),0_0_0_1px_rgba(255,255,255,0.05)] duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-98 data-[state=open]:zoom-in-98"><div className="relative h-full max-h-[85vh] overflow-hidden">- <DialogPrimitive.Close className="absolute end-4 top-4 z-10 rounded-md p-1.5 opacity-40 ring-offset-background transition-[opacity,background-color] hover:opacity-100 bg-transparent hover:bg-muted dark:hover:bg-surface-raised focus:outline-none focus:ring-2 focus:ring-ring/30 focus:ring-offset-1">+ <DialogPrimitive.Close className="absolute end-4 top-4 z-10 rounded-md p-1.5 opacity-40 ring-offset-background transition-[opacity,background-color] hover:opacity-100 bg-transparent hover:bg-muted dark:hover:bg-surface-raised outline-none focus-visible:ring-2 focus-visible:ring-ring/30 focus-visible:ring-offset-1"><X className="h-3.5 w-3.5 text-muted-foreground" /><span className="sr-only">{t("common.close")}</span></DialogPrimitive.Close>@@ -232,7 +242,19 @@ export default function SidebarModal<T extends string>({{/* Main Content */}<div className="flex-1 overflow-y-auto bg-background dark:bg-surface-1"><SettingsLayoutProvider value={{ isCompact }}>- <div className={isCompact ? "p-4" : "p-6"}>{children}</div>+ <div className={isCompact ? "p-4" : "p-6"}>+ {/* Starts just below the close button, which floats over this column's top corner. */}+ {notice && (+ <InfoBox+ className={`mb-6 flex items-center gap-2.5 rounded-lg px-4 py-3 text-sm text-primary ${+ isCompact ? "mt-8" : "mt-6"+ }`}+ >+ {notice}+ </InfoBox>+ )}+ {children}+ </div></SettingsLayoutProvider></div></div>diff --git a/src/components/ui/splitButton.ts b/src/components/ui/splitButton.tsnew file mode 100644index 000000000..26bde9d07--- /dev/null+++ b/src/components/ui/splitButton.ts@@ -0,0 +1,7 @@+// Two actions in one pill, split by a hairline (the note's Share control, the+// Notes topbar's New note). Callers set the height to match their row.+export const SPLIT_BUTTON_GROUP_CLASS =+ "flex items-stretch overflow-hidden rounded-full border border-border bg-surface-3 dark:border-white/10 dark:bg-surface-2";+export const SPLIT_BUTTON_SEGMENT_CLASS =+ "flex items-center text-xs font-medium text-foreground/80 outline-none transition-colors duration-150 hover:bg-surface-raised hover:text-foreground focus-visible:bg-surface-raised focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset dark:hover:bg-surface-3";+export const SPLIT_BUTTON_DIVIDER_CLASS = "my-1.5 w-px bg-border dark:bg-white/10";diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.jsindex f5579838b..a02e82d53 100644--- a/src/helpers/ipcHandlers.js+++ b/src/helpers/ipcHandlers.js@@ -2,6 +2,7 @@ const { ipcMain, app, shell, BrowserWindow, systemPreferences, net, session } =const path = require("path");const fs = require("fs");const os = require("os");+const { isRestorablePasteTarget } = require("./windowsPasteTarget");const crypto = require("crypto");const debugLogger = require("./debugLogger");const { ANALYTICS_HISTORY_BACKFILL_VERSION } = require("./analytics");@@ -3052,9 +3053,20 @@ class IPCHandlers {// paste lands in the field the user was dictating into, not wherever focus// drifted during transcription (#859). macOS handles this via// activateTargetPid above; Linux re-detects the target inside pasteLinux.- const targetWindow =+ const winTarget =process.platform === "win32"- ? ((await this.selectionManager?.getWinTargetHwnd?.()) ?? null)+ ? ((await this.selectionManager?.getWinTarget?.()) ?? null)+ : null;+ const targetWindow =+ winTarget &&+ isRestorablePasteTarget({+ target: winTarget,+ ownExeName: path.basename(process.execPath),+ ownWindowHandles: BrowserWindow.getAllWindows()+ .filter((win) => !win.isDestroyed())+ .map((win) => win.getNativeWindowHandle()),+ })+ ? winTarget.id: null;const pasteResult = await this.clipboardManager.pasteText(textToPaste, {@@ -8438,6 +8450,7 @@ class IPCHandlers {sessionId: recordingSessionId,autoEndEligible: options.autoEndEligible === true,ownerWebContents: event.sender,+ noteId: options.noteId ?? null,// Renderer loopback may still fail after main chooses its strategy.// Auto-end stays fail-safe until the renderer confirms a real source.systemAudioAvailable: false,@@ -11491,6 +11504,8 @@ class IPCHandlers {}});+ ipcMain.handle("start-manual-meeting", () => this.windowManager.startManualMeeting());+ipcMain.handle("get-meeting-notification-data", async () => {return this.windowManager?._pendingNotificationData ?? null;});diff --git a/src/helpers/meetingDetectionEngine.js b/src/helpers/meetingDetectionEngine.jsindex 11fbc8895..169f357b5 100644--- a/src/helpers/meetingDetectionEngine.js+++ b/src/helpers/meetingDetectionEngine.js@@ -385,6 +385,7 @@ class MeetingDetectionEngine {autoEndEligible,ownerWebContents,systemAudioAvailable = false,+ noteId = null,}) {this._clearAutoEndRecovery();if (this._recordingSession) this._deactivateAutoEnd();@@ -394,6 +395,9 @@ class MeetingDetectionEngine {autoEndEligible: autoEndEligible === true,ownerWebContents,systemAudioAvailable: systemAudioAvailable === true,+ // Lets a second manual start surface this recording instead of opening a+ // new note over it.+ noteId,};this._syncMeetingProcessDetector();@@ -675,6 +679,15 @@ class MeetingDetectionEngine {async startManualMeeting() {debugLogger.info("Starting manual meeting", {}, "meeting");+ // A live meeting already owns a note: a second start would leave the recording+ // running in it behind a new, empty one. Surface the live note instead.+ if (this._recordingSession) {+ const { noteId } = this._recordingSession;+ debugLogger.info("Manual meeting ignored — a recording is live", { noteId }, "meeting");+ if (noteId != null) await this.windowManager.queueNoteNavigation({ noteId });+ return;+ }+const activeEvents = this.databaseManager.getActiveEvents();if (activeEvents?.length > 0) {return this.joinCalendarMeeting(activeEvents[0].id, "hotkey");diff --git a/src/helpers/selectionManager.js b/src/helpers/selectionManager.jsindex 0d80fe5f9..0396efb26 100644--- a/src/helpers/selectionManager.js+++ b/src/helpers/selectionManager.js@@ -143,12 +143,13 @@ class SelectionManager {// The Windows foreground window captured at record start, for the paste path// to restore before Ctrl+V lands (#859). Waits out an in-flight probe for the// same reason captureSelectedText does: the stop-press probe can still be- // running when fast transcription reaches the paste.- async getWinTargetHwnd() {+ // running when fast transcription reaches the paste. Carries the window's+ // identity so the paste can judge whether restoring it makes sense.+ async getWinTarget() {while (this._captureTargetPromise) {await this._captureTargetPromise;}- return this.lastTarget?.kind === "win-hwnd" ? this.lastTarget.id : null;+ return this.lastTarget?.kind === "win-hwnd" ? this.lastTarget : null;}async captureSelectedText(options = {}) {diff --git a/src/helpers/tray.js b/src/helpers/tray.jsindex b92cf52ef..58cb1a798 100644--- a/src/helpers/tray.js+++ b/src/helpers/tray.js@@ -253,8 +253,29 @@ class TrayManager {buildContextMenuTemplate() {const dictationVisible = this.windowManager?.isDictationPanelVisible?.() ?? false;+ const dictating = this.windowManager?.isDictating?.() ?? false;return [+ {+ label: dictating+ ? i18nMain.t("app.commandMenu.stopListening")+ : i18nMain.t("app.commandMenu.startListening"),+ click: () =>+ dictating+ ? this.windowManager?.sendStopDictation()+ : this.windowManager?.sendStartDictation(),+ },+ {+ label: i18nMain.t("app.commandMenu.askAssistant"),+ click: () => this.windowManager?.sendOpenAssistantPanel(),+ },+ {+ // Starts in the main process, like the meeting hotkey: the recording it+ // opens is policy-gated where it actually begins, in the control panel.+ label: i18nMain.t("app.commandMenu.startMeetingRecording"),+ click: () => this.windowManager?.startManualMeeting(),+ },+ { type: "separator" },{label: dictationVisible? i18nMain.t("tray.toggleDictation.hide")diff --git a/src/helpers/trayActionPolicy.js b/src/helpers/trayActionPolicy.jsnew file mode 100644index 000000000..0d8038e16--- /dev/null+++ b/src/helpers/trayActionPolicy.js@@ -0,0 +1,31 @@+// The pill's command menu hides Ask assistant when it cannot run; the tray always+// shows it, and only this renderer can open the panel. This decides what it does+// with the request, and the message it explains a refusal with. Keys resolve+// through i18n in the renderer. The meeting entry needs none of this: it starts+// in the main process, and the recording itself is policy-gated where it begins.+export const TRAY_REFUSAL_KEYS = Object.freeze({+ agentRestricted: "common.policyAgentRestricted",+ policyUnresolved: "common.policyUnresolved",+ busy: "app.commandMenu.busyRecording",+});++const run = Object.freeze({ action: "run" });+const refuse = (messageKey) => Object.freeze({ action: "refuse", messageKey });++// A policy that never arrived — offline, or a failed fetch — fails closed exactly+// like a real restriction, so the refusal must not blame an org that restricted+// nothing. `policyResolved` is required: defaulting it would hide a miswiring.+const policyRefusal = (policyResolved, restrictedKey) =>+ refuse(policyResolved ? restrictedKey : TRAY_REFUSAL_KEYS.policyUnresolved);++/** The pill menu hides Ask Assistant without the agent, and while a panel owns the pill. */+export function resolveTrayAssistantAction({+ agentAllowed,+ policyResolved,+ isRecording,+ liveTranscriptMounted,+}) {+ if (!agentAllowed) return policyRefusal(policyResolved, TRAY_REFUSAL_KEYS.agentRestricted);+ if (isRecording || liveTranscriptMounted) return refuse(TRAY_REFUSAL_KEYS.busy);+ return run;+}diff --git a/src/helpers/windowManager.js b/src/helpers/windowManager.jsindex 6ba90e589..7a59697e6 100644--- a/src/helpers/windowManager.js+++ b/src/helpers/windowManager.js@@ -61,6 +61,8 @@ class WindowManager {// Set by IPCHandlers so its demo session dies with the demo kind on every// teardown path (id-matched end, onboarding exit, control panel closed).this.onOnboardingDemoTeardown = null;+ // Set by main.js so the tray's listen item rebuilds with dictation state.+ this.onDictationStateChanged = null;this.notificationWindow = null;this.agentDictationPillWindow = null;this._agentDictationPillReady = false;@@ -837,13 +839,23 @@ class WindowManager {return isOnboardingInputAllowed(this._onboardingActive, this._onboardingDemoKind, inputKind);}- // Public gate for main.js's meeting hotkey call sites, which invoke the- // detection engine directly rather than routing through a send method here.// "meeting" is never a demo kind, so this is simply "not during onboarding".isMeetingInputAllowed() {return this._isOnboardingInputAllowed("meeting");}+ // The one entry for starting a meeting by hand: the meeting hotkey, the pill's+ // command menu, and the tray. Fails closed during onboarding and while a+ // hotkey is being captured, like every hotkey slot.+ async startManualMeeting() {+ if (this.hotkeyManager.isInListeningMode() || !this.isMeetingInputAllowed()) return;+ try {+ await this.meetingDetectionEngine?.startManualMeeting();+ } catch (error) {+ debugLogger.error("Failed to start manual meeting", { error: error.message }, "meeting");+ }+ }+// Visibility is part of "available": a ready pill that is merely hidden// (onboarding took the screen, a panel close hid it) cannot show a// recording, so counting it as a live surface would let dictation start@@ -939,6 +951,12 @@ class WindowManager {this._isDictatingToggle = isDictationRecording(nextState);this.meetingDetectionEngine?.setUserRecording(this._isDictatingToggle);this._sendAgentDictationPillState();+ this.onDictationStateChanged?.();+ }++ // The tray's listen item is a toggle over this state, like the pill's.+ isDictating() {+ return this._isDictatingToggle;}_sendAgentDictationPillState() {@@ -988,6 +1006,17 @@ class WindowManager {this._sendDictationToggle("toggle-translation", "translation");}+ // The tray's Ask assistant. Only the renderer can open the panel, and only it+ // knows the policy and recording state the pill menu gates the item on, so it+ // decides: nothing is shown or created here, and an accepted command surfaces+ // the pill itself through setAssistantPanelOpen. Onboarding blocks it outright+ // rather than through the demo-aware gate — the tray is never part of the demo.+ sendOpenAssistantPanel() {+ if (this.hotkeyManager.isInListeningMode() || this._onboardingActive) return;+ if (!this.mainWindow || this.mainWindow.isDestroyed()) return;+ this.mainWindow.webContents.send("open-assistant-panel");+ }+sendStartDictation() {if (!this._isOnboardingInputAllowed("dictation")) return;if (this._shouldBlockDictationInput("dictation")) {diff --git a/src/helpers/windowsPasteTarget.js b/src/helpers/windowsPasteTarget.jsnew file mode 100644index 000000000..f6ad812a3--- /dev/null+++ b/src/helpers/windowsPasteTarget.js@@ -0,0 +1,35 @@+// Whether a Windows paste may restore the window captured at record start+// (#859). The predicate is "ours and not one of our windows", not "ours and+// editable": a tray-menu start leaves the menu's owner window foreground, and+// force-activating that at paste time would pull the foreground onto OpenWhispr+// and drop the keystroke. Our real windows — the control panel's note editor —+// stay valid targets, so dictating into a note still pastes there.++/** "TARGET %p" prints hex, with or without an 0x prefix. */+function parseWindowHandle(value) {+ try {+ return BigInt(`0x${String(value).replace(/^0x/i, "")}`);+ } catch {+ return null;+ }+}++// Win64 hands back an 8-byte pointer, Win32 a 4-byte one.+function readWindowHandle(buffer) {+ return buffer.length >= 8 ? buffer.readBigUInt64LE(0) : BigInt(buffer.readUInt32LE(0));+}++function isRestorablePasteTarget({ target, ownExeName, ownWindowHandles = [] }) {+ if (!target?.id) return false;++ // An unreadable exe name reads as someone else's window, keeping the pre-#859+ // behaviour rather than dropping a target that was probably legitimate.+ const exeName = String(target.exeName || "").toLowerCase();+ if (!exeName || exeName !== String(ownExeName || "").toLowerCase()) return true;++ const handle = parseWindowHandle(target.id);+ if (handle === null) return false;+ return ownWindowHandles.some((buffer) => readWindowHandle(buffer) === handle);+}++module.exports = { isRestorablePasteTarget, parseWindowHandle };diff --git a/src/hooks/useAssistantPanel.js b/src/hooks/useAssistantPanel.jsindex cfceb8834..bd02fa840 100644--- a/src/hooks/useAssistantPanel.js+++ b/src/hooks/useAssistantPanel.js@@ -85,8 +85,10 @@ export function useAssistantPanel({}, [mounted, open, responseReady, clearFooterTimers]);const openPanel = useCallback(async () => {- setThinking(false);+ // After the guard: a second open (the tray's Ask assistant while a command is+ // already thinking) must not clear the flourish of the one in flight.if (openRef.current) return;+ setThinking(false);const generation = ++openGenerationRef.current;openRef.current = true;closingRef.current = false;diff --git a/src/hooks/useCanCreateTeamSpace.ts b/src/hooks/useCanCreateTeamSpace.tsnew file mode 100644index 000000000..7f79b1096--- /dev/null+++ b/src/hooks/useCanCreateTeamSpace.ts@@ -0,0 +1,19 @@+import { useAuth } from "./useAuth";+import { useTeamSpacesCapability } from "./useTeamSpacesCapability";+import { useWorkspace } from "./useWorkspace";+import { canManageWorkspace } from "../lib/spacePermissions";++/**+ * Whether to offer "new team space". The server 403s team creation for plain+ * members; users with no workspace yet get the create funnel in the dialog.+ */+export function useCanCreateTeamSpace(): boolean {+ const { isSignedIn } = useAuth();+ const teamSpacesAvailable = useTeamSpacesCapability(isSignedIn);+ const { workspaces, loaded } = useWorkspace();+ return (+ teamSpacesAvailable &&+ loaded &&+ (workspaces.length === 0 || workspaces.some((w) => canManageWorkspace(w.role)))+ );+}diff --git a/src/hooks/useTrayQuickActions.js b/src/hooks/useTrayQuickActions.jsnew file mode 100644index 000000000..f479dec2a--- /dev/null+++ b/src/hooks/useTrayQuickActions.js@@ -0,0 +1,46 @@+import { useEffect } from "react";+import { resolveTrayAssistantAction } from "../helpers/trayActionPolicy";++/**+ * The tray's Ask assistant, answered by the one renderer that can open the panel.+ *+ * The pill's command menu hides the item when policy or a live recording rules it+ * out; the tray always shows it, so this either opens the panel or explains+ * itself through `refuse`. The tray's other two entries need no renderer: listen+ * goes straight to the dictation start, and a meeting starts in the main process.+ */+export function useTrayQuickActions({+ agentAllowed,+ policyResolved,+ isRecording,+ liveTranscriptMounted,+ closeCommandMenu,+ openAssistantPanel,+ refuse,+}) {+ useEffect(() => {+ const unsubscribe = window.electronAPI?.onOpenAssistantPanel?.(() => {+ closeCommandMenu();+ const decision = resolveTrayAssistantAction({+ agentAllowed,+ policyResolved,+ isRecording,+ liveTranscriptMounted,+ });+ if (decision.action === "refuse") {+ refuse(decision.messageKey);+ return;+ }+ void openAssistantPanel();+ });+ return () => unsubscribe?.();+ }, [+ agentAllowed,+ policyResolved,+ isRecording,+ liveTranscriptMounted,+ closeCommandMenu,+ openAssistantPanel,+ refuse,+ ]);+}diff --git a/src/locales/ar/translation.json b/src/locales/ar/translation.jsonindex ea5be5755..53aff1fe6 100644--- a/src/locales/ar/translation.json+++ b/src/locales/ar/translation.json@@ -1355,7 +1355,9 @@"stopListening": "إيقاف الاستماع","startListening": "بدء الاستماع","hideForNow": "إخفاء الآن",- "askAssistant": "اسأل المساعد"+ "askAssistant": "اسأل المساعد",+ "busyRecording": "أنهِ التسجيل الحالي أولاً",+ "startMeetingRecording": "بدء تسجيل الاجتماع"}},"calendar": {@@ -1575,6 +1577,12 @@"hoursAgo": "منذ {{count}} س","daysAgo": "منذ {{count}} ي"},+ "createMenu": {+ "note": "ملاحظة",+ "assistantChat": "دردشة مع المساعد",+ "teamSpace": "مساحة فريق",+ "chooseType": "اختر ما تريد إنشاءه"+ },"editor": {"untitled": "بدون عنوان","noteTitle": "عنوان الملاحظة",@@ -1589,7 +1597,7 @@"asJson": "بصيغة JSON (.json)","asTranscriptMarkdown": "بصيغة Markdown (.md)","raw": "خام",- "enhanced": "مُحسّن",+ "aiSummary": "ملخص بالذكاء الاصطناعي","saving": "جاري الحفظ","transcriptEmptyTitle": "لم يتم تسجيل أي شيء بعد","transcriptEmptyDescription": "اضغط على تسجيل لبدء النسخ. كل ما يُقال يظهر هنا لحظيًا.",@@ -3581,6 +3589,7 @@"policyAiProcessingRestricted": "معالجة الذكاء الاصطناعي مقيدة من قبل مؤسستك.","policyAgentRestricted": "استخدام مساعد الذكاء الاصطناعي مقيد من قبل مؤسستك.","policyTranscriptionRestricted": "التفريغ الصوتي مقيد من قبل مؤسستك.",+ "policyUnresolved": "لم يتم تحميل إعدادات مؤسستك بعد. حاول مرة أخرى بعد قليل.","logout": "تسجيل الخروج","managedConfigLoading": "جارٍ التحقق من الإعداد المُدار لمؤسستك. أعد المحاولة بعد لحظات.","managedConfigUnavailable": "الوصول المُدار للمؤسسة غير متاح. سجّل الدخول مرة أخرى أو اتصل بالمسؤول.",diff --git a/src/locales/de/translation.json b/src/locales/de/translation.jsonindex af49577e2..636a7a36a 100644--- a/src/locales/de/translation.json+++ b/src/locales/de/translation.json@@ -204,6 +204,7 @@"policyAiProcessingRestricted": "Die KI-Verarbeitung ist durch Ihre Organisation eingeschränkt.","policyAgentRestricted": "Die Nutzung des KI-Assistenten ist durch Ihre Organisation eingeschränkt.","policyTranscriptionRestricted": "Die Transkription ist durch Ihre Organisation eingeschränkt.",+ "policyUnresolved": "Die Einstellungen deiner Organisation wurden noch nicht geladen. Versuche es gleich noch einmal.","managedConfigLoading": "Die verwaltete Einrichtung Ihrer Organisation wird überprüft. Versuchen Sie es gleich noch einmal.","managedConfigUnavailable": "Der verwaltete Unternehmenszugriff ist nicht verfügbar. Melden Sie sich erneut an oder wenden Sie sich an Ihren Administrator.","managedPolicyConflict": "Der verwaltete Zugriff wird durch Ihre Workspace-Richtlinie blockiert. Wenden Sie sich an Ihren Administrator."@@ -3235,6 +3236,12 @@"hoursAgo": "vor {{count}}h","daysAgo": "vor {{count}}T"},+ "createMenu": {+ "note": "Notiz",+ "assistantChat": "Assistent-Chat",+ "teamSpace": "Team-Bereich",+ "chooseType": "Auswählen, was erstellt werden soll"+ },"editor": {"untitled": "Unbenannt","noteTitle": "Notiztitel",@@ -3249,7 +3256,7 @@"asJson": "Als JSON (.json)","asTranscriptMarkdown": "Als Markdown (.md)","raw": "Roh",- "enhanced": "Verbessert",+ "aiSummary": "KI-Zusammenfassung","saving": "Wird gespeichert","transcriptEmptyTitle": "Noch nichts aufgenommen","transcriptEmptyDescription": "Drücke auf Aufnahme, um mit der Transkription zu beginnen. Alles Gesagte erscheint hier in Echtzeit.",@@ -3702,7 +3709,9 @@"stopListening": "Aufnahme beenden","startListening": "Aufnahme starten","hideForNow": "Vorerst ausblenden",- "askAssistant": "Assistent fragen"+ "askAssistant": "Assistent fragen",+ "busyRecording": "Beende zuerst die laufende Aufnahme",+ "startMeetingRecording": "Meeting-Aufnahme starten"}},"dictationAgent": {diff --git a/src/locales/en/translation.json b/src/locales/en/translation.jsonindex 071a23a33..54515e938 100644--- a/src/locales/en/translation.json+++ b/src/locales/en/translation.json@@ -204,6 +204,7 @@"policyAiProcessingRestricted": "AI processing is restricted by your organization.","policyAgentRestricted": "AI assistant use is restricted by your organization.","policyTranscriptionRestricted": "Transcription is restricted by your organization.",+ "policyUnresolved": "Your organization's settings haven't loaded yet. Try again in a moment.","managedConfigLoading": "Checking your organization's managed setup. Try again in a moment.","managedConfigUnavailable": "Managed enterprise access is unavailable. Sign in again or contact your administrator.","managedPolicyConflict": "Managed access is blocked by your workspace policy. Contact your administrator."@@ -3235,6 +3236,12 @@"hoursAgo": "{{count}}h","daysAgo": "{{count}}d"},+ "createMenu": {+ "note": "Note",+ "assistantChat": "Assistant chat",+ "teamSpace": "Team space",+ "chooseType": "Choose what to create"+ },"editor": {"untitled": "Untitled","noteTitle": "Note title",@@ -3249,7 +3256,7 @@"asJson": "As JSON (.json)","asTranscriptMarkdown": "As Markdown (.md)","raw": "Raw",- "enhanced": "Enhanced",+ "aiSummary": "AI Summary","saving": "Saving","transcriptEmptyTitle": "Nothing recorded yet","transcriptEmptyDescription": "Hit record to start transcribing. Everything said shows up here as it happens.",@@ -3702,7 +3709,9 @@"stopListening": "Stop listening","startListening": "Start listening","hideForNow": "Hide for now",- "askAssistant": "Ask Assistant"+ "askAssistant": "Ask assistant",+ "busyRecording": "Finish the current dictation first",+ "startMeetingRecording": "Start meeting recording"}},"dictationAgent": {diff --git a/src/locales/es/translation.json b/src/locales/es/translation.jsonindex f99d952b5..e673441e5 100644--- a/src/locales/es/translation.json+++ b/src/locales/es/translation.json@@ -204,6 +204,7 @@"policyAiProcessingRestricted": "El procesamiento con IA está restringido por tu organización.","policyAgentRestricted": "El uso del asistente de IA está restringido por tu organización.","policyTranscriptionRestricted": "La transcripción está restringida por tu organización.",+ "policyUnresolved": "La configuración de tu organización aún no se ha cargado. Inténtalo de nuevo en un momento.","managedConfigLoading": "Comprobando la configuración gestionada de tu organización. Inténtalo de nuevo en un momento.","managedConfigUnavailable": "El acceso empresarial gestionado no está disponible. Vuelve a iniciar sesión o contacta a tu administrador.","managedPolicyConflict": "El acceso gestionado está bloqueado por la política de tu espacio de trabajo. Contacta a tu administrador."@@ -2945,6 +2946,12 @@"hoursAgo": "hace {{count}}h","daysAgo": "hace {{count}}d"},+ "createMenu": {+ "note": "Nota",+ "assistantChat": "Chat con el asistente",+ "teamSpace": "Espacio de equipo",+ "chooseType": "Elegir qué crear"+ },"editor": {"untitled": "Sin título","noteTitle": "Título de la nota",@@ -2959,7 +2966,7 @@"asJson": "Como JSON (.json)","asTranscriptMarkdown": "Como Markdown (.md)","raw": "Sin procesar",- "enhanced": "Mejorado",+ "aiSummary": "Resumen con IA","saving": "Guardando","transcriptEmptyTitle": "Aún no hay grabaciones","transcriptEmptyDescription": "Pulsa grabar para empezar a transcribir. Todo lo que se diga aparecerá aquí en tiempo real.",@@ -3586,7 +3593,9 @@"stopListening": "Dejar de escuchar","startListening": "Empezar a escuchar","hideForNow": "Ocultar por ahora",- "askAssistant": "Preguntar al asistente"+ "askAssistant": "Preguntar al asistente",+ "busyRecording": "Primero termina la grabación actual",+ "startMeetingRecording": "Iniciar grabación de reunión"}},"dictationAgent": {diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.jsonindex 23e8bc11d..dd48dbe3d 100644--- a/src/locales/fr/translation.json+++ b/src/locales/fr/translation.json@@ -204,6 +204,7 @@"policyAiProcessingRestricted": "Le traitement par IA est restreint par votre organisation.","policyAgentRestricted": "L’utilisation de l’assistant IA est restreinte par votre organisation.","policyTranscriptionRestricted": "La transcription est restreinte par votre organisation.",+ "policyUnresolved": "Les paramètres de votre organisation ne sont pas encore chargés. Réessayez dans un instant.","managedConfigLoading": "Vérification de la configuration gérée de votre organisation en cours. Réessayez dans un instant.","managedConfigUnavailable": "L'accès d'entreprise géré est indisponible. Reconnectez-vous ou contactez votre administrateur.","managedPolicyConflict": "L'accès géré est bloqué par la politique de votre espace de travail. Contactez votre administrateur."@@ -3235,6 +3236,12 @@"hoursAgo": "il y a {{count}}h","daysAgo": "il y a {{count}}j"},+ "createMenu": {+ "note": "Note",+ "assistantChat": "Chat avec l'assistant",+ "teamSpace": "Espace d'équipe",+ "chooseType": "Choisir quoi créer"+ },"editor": {"untitled": "Sans titre","noteTitle": "Titre de la note",@@ -3249,7 +3256,7 @@"asJson": "En JSON (.json)","asTranscriptMarkdown": "En Markdown (.md)","raw": "Brut",- "enhanced": "Amélioré",+ "aiSummary": "Résumé IA","saving": "Enregistrement","transcriptEmptyTitle": "Rien d'enregistré pour l'instant","transcriptEmptyDescription": "Lancez l'enregistrement pour commencer la transcription. Tout ce qui est dit s'affiche ici en direct.",@@ -3702,7 +3709,9 @@"stopListening": "Arrêter l’écoute","startListening": "Commencer l’écoute","hideForNow": "Masquer pour l’instant",- "askAssistant": "Demander à l'assistant"+ "askAssistant": "Demander à l'assistant",+ "busyRecording": "Terminez d'abord l'enregistrement en cours",+ "startMeetingRecording": "Démarrer l’enregistrement de la réunion"}},"dictationAgent": {diff --git a/src/locales/it/translation.json b/src/locales/it/translation.jsonindex 6d571929a..8760d10ae 100644--- a/src/locales/it/translation.json+++ b/src/locales/it/translation.json@@ -204,6 +204,7 @@"policyAiProcessingRestricted": "L’elaborazione con IA è limitata dalla tua organizzazione.","policyAgentRestricted": "L’uso dell’assistente IA è limitato dalla tua organizzazione.","policyTranscriptionRestricted": "La trascrizione è limitata dalla tua organizzazione.",+ "policyUnresolved": "Le impostazioni della tua organizzazione non sono ancora state caricate. Riprova tra un momento.","managedConfigLoading": "Verifica della configurazione gestita della tua organizzazione in corso. Riprova tra un momento.","managedConfigUnavailable": "L'accesso aziendale gestito non è disponibile. Accedi di nuovo o contatta l'amministratore.","managedPolicyConflict": "L'accesso gestito è bloccato dai criteri del tuo spazio di lavoro. Contatta l'amministratore."@@ -2892,6 +2893,12 @@"hoursAgo": "{{count}}h","daysAgo": "{{count}}g"},+ "createMenu": {+ "note": "Nota",+ "assistantChat": "Chat con l'assistente",+ "teamSpace": "Spazio del team",+ "chooseType": "Scegli cosa creare"+ },"editor": {"untitled": "Senza titolo","noteTitle": "Titolo della nota",@@ -2906,7 +2913,7 @@"asJson": "Come JSON (.json)","asTranscriptMarkdown": "Come Markdown (.md)","raw": "Originale",- "enhanced": "Migliorato",+ "aiSummary": "Riepilogo AI","saving": "Salvataggio","transcriptEmptyTitle": "Nessuna registrazione","transcriptEmptyDescription": "Premi registra per iniziare a trascrivere. Tutto ciò che viene detto compare qui in tempo reale.",@@ -3533,7 +3540,9 @@"stopListening": "Smetti di ascoltare","startListening": "Inizia ad ascoltare","hideForNow": "Nascondi per ora",- "askAssistant": "Chiedi all'assistente"+ "askAssistant": "Chiedi all'assistente",+ "busyRecording": "Prima termina la registrazione in corso",+ "startMeetingRecording": "Avvia registrazione meeting"}},"dictationAgent": {diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.jsonindex dc53e6b5c..f39e90fa8 100644--- a/src/locales/ja/translation.json+++ b/src/locales/ja/translation.json@@ -204,6 +204,7 @@"policyAiProcessingRestricted": "AI処理は組織によって制限されています。","policyAgentRestricted": "AIアシスタントの使用は組織によって制限されています。","policyTranscriptionRestricted": "文字起こしは組織によって制限されています。",+ "policyUnresolved": "組織の設定がまだ読み込まれていません。しばらくしてからもう一度お試しください。","managedConfigLoading": "組織のマネージド設定を確認しています。しばらくしてからもう一度お試しください。","managedConfigUnavailable": "マネージド エンタープライズ アクセスを利用できません。再度サインインするか、管理者にお問い合わせください。","managedPolicyConflict": "ワークスペースのポリシーによりマネージド アクセスがブロックされています。管理者にお問い合わせください。"@@ -2814,7 +2815,7 @@"asJson": "JSON (.json)","asTranscriptMarkdown": "Markdown (.md)","raw": "元のテキスト",- "enhanced": "強化済み",+ "aiSummary": "AI要約","saving": "保存中","transcriptEmptyTitle": "まだ録音がありません","transcriptEmptyDescription": "録音ボタンを押すと文字起こしが始まります。話した内容がここにリアルタイムで表示されます。",@@ -2923,6 +2924,12 @@"hoursAgo": "{{count}}時間前","daysAgo": "{{count}}日前"},+ "createMenu": {+ "note": "ノート",+ "assistantChat": "アシスタントとのチャット",+ "teamSpace": "チームスペース",+ "chooseType": "作成する項目を選択"+ },"upload": {"title": "音声をアップロード","using": "{{model}} を使用中",@@ -3533,7 +3540,9 @@"stopListening": "録音を停止","startListening": "録音を開始","hideForNow": "一時的に非表示",- "askAssistant": "アシスタントに質問"+ "askAssistant": "アシスタントに質問",+ "busyRecording": "先に録音を終了してください",+ "startMeetingRecording": "ミーティングの録音を開始"}},"dictationAgent": {diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.jsonindex ed07a510e..109551e39 100644--- a/src/locales/pt/translation.json+++ b/src/locales/pt/translation.json@@ -183,6 +183,7 @@"policyAiProcessingRestricted": "O processamento de IA está restrito pela sua organização.","policyAgentRestricted": "O uso do assistente de IA está restrito pela sua organização.","policyTranscriptionRestricted": "A transcrição está restrita pela sua organização.",+ "policyUnresolved": "As configurações da sua organização ainda não foram carregadas. Tente novamente em instantes.","managedConfigLoading": "Verificando a configuração gerenciada da sua organização. Tente novamente em instantes.","managedConfigUnavailable": "O acesso empresarial gerenciado está indisponível. Entre novamente ou entre em contato com o administrador.","managedPolicyConflict": "O acesso gerenciado está bloqueado pela política do seu espaço de trabalho. Entre em contato com o administrador."@@ -2892,6 +2893,12 @@"hoursAgo": "{{count}}h","daysAgo": "{{count}}d"},+ "createMenu": {+ "note": "Nota",+ "assistantChat": "Chat com o assistente",+ "teamSpace": "Espaço de equipe",+ "chooseType": "Escolher o que criar"+ },"editor": {"untitled": "Sem título","noteTitle": "Título da nota",@@ -2906,7 +2913,7 @@"asJson": "Como JSON (.json)","asTranscriptMarkdown": "Como Markdown (.md)","raw": "Original",- "enhanced": "Aprimorado",+ "aiSummary": "Resumo com IA","saving": "Salvando","transcriptEmptyTitle": "Nada gravado ainda","transcriptEmptyDescription": "Toque em gravar para começar a transcrever. Tudo o que for dito aparece aqui em tempo real.",@@ -3533,7 +3540,9 @@"stopListening": "Parar de ouvir","startListening": "Começar a ouvir","hideForNow": "Ocultar por agora",- "askAssistant": "Perguntar ao assistente"+ "askAssistant": "Perguntar ao assistente",+ "busyRecording": "Termine primeiro a gravação atual",+ "startMeetingRecording": "Iniciar gravação da reunião"}},"dictationAgent": {diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.jsonindex 6df34522a..9e50ca88c 100644--- a/src/locales/ru/translation.json+++ b/src/locales/ru/translation.json@@ -204,6 +204,7 @@"policyAiProcessingRestricted": "Обработка ИИ ограничена вашей организацией.","policyAgentRestricted": "Использование ИИ-помощника ограничено вашей организацией.","policyTranscriptionRestricted": "Транскрипция ограничена вашей организацией.",+ "policyUnresolved": "Настройки вашей организации ещё не загружены. Повторите попытку через мгновение.","managedConfigLoading": "Проверяется управляемая настройка вашей организации. Повторите попытку через некоторое время.","managedConfigUnavailable": "Управляемый корпоративный доступ недоступен. Войдите снова или обратитесь к администратору.","managedPolicyConflict": "Управляемый доступ заблокирован политикой вашего рабочего пространства. Обратитесь к администратору."@@ -2914,6 +2915,12 @@"hoursAgo": "{{count}} ч. назад","daysAgo": "{{count}} дн. назад"},+ "createMenu": {+ "note": "Заметка",+ "assistantChat": "Чат с помощником",+ "teamSpace": "Командное пространство",+ "chooseType": "Выбрать, что создать"+ },"editor": {"untitled": "Без названия","noteTitle": "Название заметки",@@ -2928,7 +2935,7 @@"asJson": "Как JSON (.json)","asTranscriptMarkdown": "Как Markdown (.md)","raw": "Исходный",- "enhanced": "Улучшенный",+ "aiSummary": "ИИ-сводка","saving": "Сохранение","transcriptEmptyTitle": "Пока ничего не записано","transcriptEmptyDescription": "Нажмите «Запись», чтобы начать транскрипцию. Всё сказанное появится здесь в реальном времени.",@@ -3579,7 +3586,9 @@"stopListening": "Остановить запись","startListening": "Начать запись","hideForNow": "Скрыть",- "askAssistant": "Спросить помощника"+ "askAssistant": "Спросить помощника",+ "busyRecording": "Сначала завершите текущую запись",+ "startMeetingRecording": "Начать запись встречи"}},"dictationAgent": {diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.jsonindex e71ce7750..26ad074a6 100644--- a/src/locales/zh-CN/translation.json+++ b/src/locales/zh-CN/translation.json@@ -204,6 +204,7 @@"policyAiProcessingRestricted": "AI 处理已被您的组织限制。","policyAgentRestricted": "AI 助手的使用已被您的组织限制。","policyTranscriptionRestricted": "转录已被您的组织限制。",+ "policyUnresolved": "您所在组织的设置尚未加载完成。请稍后再试。","managedConfigLoading": "正在检查您组织的托管设置。请稍候再试。","managedConfigUnavailable": "托管企业访问不可用。请重新登录或联系管理员。","managedPolicyConflict": "托管访问已被您工作区的策略阻止。请联系管理员。"@@ -2892,6 +2893,12 @@"hoursAgo": "{{count}} 小时前","daysAgo": "{{count}} 天前"},+ "createMenu": {+ "note": "笔记",+ "assistantChat": "助手聊天",+ "teamSpace": "团队空间",+ "chooseType": "选择要创建的内容"+ },"editor": {"untitled": "无标题","noteTitle": "笔记标题",@@ -2906,7 +2913,7 @@"asJson": "导出为 JSON (.json)","asTranscriptMarkdown": "导出为 Markdown (.md)","raw": "原始内容",- "enhanced": "增强内容",+ "aiSummary": "AI 摘要","saving": "保存中","transcriptEmptyTitle": "尚未录制任何内容","transcriptEmptyDescription": "点击录制开始转写。所说的内容会实时显示在这里。",@@ -3533,7 +3540,9 @@"stopListening": "停止录音","startListening": "开始录音","hideForNow": "暂时隐藏",- "askAssistant": "询问助手"+ "askAssistant": "询问助手",+ "busyRecording": "请先结束当前录音",+ "startMeetingRecording": "开始会议录音"}},"dictationAgent": {diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.jsonindex b9409043a..d111fe4c2 100644--- a/src/locales/zh-TW/translation.json+++ b/src/locales/zh-TW/translation.json@@ -204,6 +204,7 @@"policyAiProcessingRestricted": "AI 處理已被您的組織限制。","policyAgentRestricted": "AI 助理的使用已被您的組織限制。","policyTranscriptionRestricted": "轉錄已被您的組織限制。",+ "policyUnresolved": "貴組織的設定尚未載入完成。請稍後再試。","managedConfigLoading": "正在檢查您組織的託管設定。請稍候再試。","managedConfigUnavailable": "託管企業存取無法使用。請重新登入或聯絡管理員。","managedPolicyConflict": "託管存取已被您工作區的政策封鎖。請聯絡管理員。"@@ -2892,6 +2893,12 @@"hoursAgo": "{{count}} 小時前","daysAgo": "{{count}} 天前"},+ "createMenu": {+ "note": "筆記",+ "assistantChat": "助理聊天",+ "teamSpace": "團隊空間",+ "chooseType": "選擇要建立的內容"+ },"editor": {"untitled": "未命名","noteTitle": "筆記標題",@@ -2906,7 +2913,7 @@"asJson": "匯出為 JSON (.json)","asTranscriptMarkdown": "匯出為 Markdown (.md)","raw": "原始",- "enhanced": "已增強",+ "aiSummary": "AI 摘要","saving": "儲存中","transcriptEmptyTitle": "尚未錄製任何內容","transcriptEmptyDescription": "點擊錄製開始轉錄。所說的內容會即時顯示在這裡。",@@ -3533,7 +3540,9 @@"stopListening": "停止錄音","startListening": "開始錄音","hideForNow": "暫時隱藏",- "askAssistant": "詢問助理"+ "askAssistant": "詢問助理",+ "busyRecording": "請先結束目前的錄音",+ "startMeetingRecording": "開始會議錄音"}},"dictationAgent": {diff --git a/src/types/electron.ts b/src/types/electron.tsindex 65e992c36..ecfc237e9 100644--- a/src/types/electron.ts+++ b/src/types/electron.ts@@ -1167,6 +1167,7 @@ declare global {onToggleDictation: (callback: () => void) => () => void;onToggleVoiceAgent?: (callback: () => void) => () => void;onToggleTranslation?: (callback: () => void) => () => void;+ onOpenAssistantPanel?: (callback: () => void) => () => void;onStartDictation?: (callback: () => void) => () => void;onStopDictation?: (callback: () => void) => () => void;onPrepareDictation?: (@@ -3160,6 +3161,7 @@ declare global {action: string) => Promise<{ success: boolean }>;joinCalendarMeeting?: (eventId: string) => Promise<{ success: boolean }>;+ startManualMeeting?: () => Promise<void>;getPendingMeetingNoteNavigation?: () => Promise<{noteId: number;folderId: number;diff --git a/test/components/newNoteMenu.test.js b/test/components/newNoteMenu.test.jsnew file mode 100644index 000000000..982535a45--- /dev/null+++ b/test/components/newNoteMenu.test.js@@ -0,0 +1,68 @@+const test = require("node:test");+const assert = require("node:assert/strict");+const { createElement } = require("react");+const { renderToStaticMarkup } = require("react-dom/server");+const { createRendererServer, installBrowserGlobals } = require("../lib/rendererTestHarness");++// The harness renders i18n keys verbatim (no i18next instance is initialized), so+// assertions match on the raw translation key rather than resolved copy. The dropdown+// primitives are stubbed so the menu's items render inline instead of into a portal.+async function renderMenu(t, { canCreateTeamSpace, withAssistant = true }) {+ installBrowserGlobals(t);+ const vite = await createRendererServer(t, {+ cachePrefix: "openwhispr-new-note-menu-test-",+ mockModules: {+ "/ui/dropdown-menu": `+ import { createElement } from "react";+ const passthrough = (props) => createElement("div", null, props.children);+ export const DropdownMenu = passthrough;+ export const DropdownMenuTrigger = passthrough;+ export const DropdownMenuContent = passthrough;+ export const DropdownMenuItem = passthrough;+ export const DropdownMenuSeparator = () => createElement("div", null);+ `,+ "/hooks/useCanCreateTeamSpace": `+ export const useCanCreateTeamSpace = () => globalThis.__canCreateTeamSpace === true;+ `,+ "/CreateSpaceDialog": `+ export default function CreateSpaceDialog() { return null; }+ `,+ },+ });+ globalThis.__canCreateTeamSpace = canCreateTeamSpace;+ t.after(() => {+ delete globalThis.__canCreateTeamSpace;+ });+ const mod = await vite.ssrLoadModule("/components/notes/NewNoteMenu.tsx");+ return renderToStaticMarkup(+ createElement(mod.default, {+ onNewNote: () => {},+ ...(withAssistant ? { onNewChat: () => {} } : {}),+ })+ );+}++test("the New note menu always offers a note and an assistant chat", async (t) => {+ const markup = await renderMenu(t, { canCreateTeamSpace: false });++ assert.match(markup, /notes\.list\.newNote/);+ assert.match(markup, /notes\.createMenu\.note/);+ assert.match(markup, /notes\.createMenu\.assistantChat/);+});++test("the New note menu offers a team space only when the user can create one", async (t) => {+ const withoutPermission = await renderMenu(t, { canCreateTeamSpace: false });+ assert.doesNotMatch(withoutPermission, /notes\.createMenu\.teamSpace/);++ const withPermission = await renderMenu(t, { canCreateTeamSpace: true });+ assert.match(withPermission, /notes\.createMenu\.teamSpace/);+});++// The Chat tab disappears entirely when an org turns the assistant off, so the+// item that navigates there goes with it.+test("the New note menu hides the assistant chat when the assistant is off", async (t) => {+ const markup = await renderMenu(t, { canCreateTeamSpace: false, withAssistant: false });++ assert.doesNotMatch(markup, /notes\.createMenu\.assistantChat/);+ assert.match(markup, /notes\.createMenu\.note/);+});diff --git a/test/components/pillCommandMenu.test.js b/test/components/pillCommandMenu.test.jsindex de2c6bac2..87bda0c43 100644--- a/test/components/pillCommandMenu.test.js+++ b/test/components/pillCommandMenu.test.js@@ -17,10 +17,12 @@ async function renderMenu(t, props) {buttonRef: { current: null },isRecording: false,agentAllowed: true,+ meetingAllowed: true,isHovered: false,setWindowInteractivity: () => {},onToggleListening: () => {},onAskAssistant: () => {},+ onStartMeeting: () => {},onHide: () => {},onClose: () => {},...props,@@ -35,3 +37,9 @@ test("the command menu hides Ask Assistant while a recording is active", async (const recordingMarkup = await renderMenu(t, { isRecording: true });assert.doesNotMatch(recordingMarkup, /askAssistant/);});++test("the command menu offers a meeting recording only while idle and allowed", async (t) => {+ assert.match(await renderMenu(t, {}), /startMeetingRecording/);+ assert.doesNotMatch(await renderMenu(t, { isRecording: true }), /startMeetingRecording/);+ assert.doesNotMatch(await renderMenu(t, { meetingAllowed: false }), /startMeetingRecording/);+});diff --git a/test/components/spacesTreeNoteActionClearance.test.js b/test/components/spacesTreeNoteActionClearance.test.jsindex 490262c5f..3f1b253a4 100644--- a/test/components/spacesTreeNoteActionClearance.test.js+++ b/test/components/spacesTreeNoteActionClearance.test.js@@ -80,6 +80,7 @@ async function renderTree(t, direction) {"/hooks/useAuth": "export const useAuth = () => ({ isSignedIn: false, user: null });","/hooks/useWorkspace":"export const useWorkspace = () => ({ workspaces: [], loaded: true });",+ "/hooks/useCanCreateTeamSpace": "export const useCanCreateTeamSpace = () => false;","/hooks/useDialogs": `export const useDialogs = () => ({confirmDialog: { open: false },diff --git a/test/helpers/meetingDetectionEngine.test.js b/test/helpers/meetingDetectionEngine.test.jsindex 438ede6a1..51114d6cd 100644--- a/test/helpers/meetingDetectionEngine.test.js+++ b/test/helpers/meetingDetectionEngine.test.js@@ -55,11 +55,14 @@ function createEngine() {audioDetector.stop = () => {};const shown = [];+ const meetingNavigations = [];+ const noteNavigations = [];const windowManager = {notificationPrefs: {},showMeetingNotification: (data) => shown.push(data),dismissMeetingNotification: () => {},- queueMeetingNoteNavigation: async () => {},+ queueMeetingNoteNavigation: async (payload) => meetingNavigations.push(payload),+ queueNoteNavigation: async (payload) => noteNavigations.push(payload),};const engine = new MeetingDetectionEngine(@@ -70,7 +73,7 @@ function createEngine() {{});- return { engine, audioDetector, processDetector, shown };+ return { engine, audioDetector, processDetector, shown, meetingNavigations, noteNavigations };}test("an unanswered audio prompt expires without cooling down the mic detector", () => {@@ -116,3 +119,23 @@ test("a meeting app appearing asks the mic detector to re-evaluate unattributedassert.equal(audioDetector.meetingAppNotifications, 1);assert.equal(shown.length, 0, "a running meeting app alone stays context-only");});++// The bare {} databaseManager is the assertion that no note was created: reaching+// the note path at all would throw on getActiveEvents.+test("a manual meeting start during a live recording surfaces that note, not a new one", async () => {+ const { engine, noteNavigations } = createEngine();+ engine._recordingSession = { sessionId: "s1", noteId: 42 };++ await engine.startManualMeeting();++ assert.deepEqual(noteNavigations, [{ noteId: 42 }]);+});++test("a live recording with no note id still blocks a second manual meeting", async () => {+ const { engine, noteNavigations } = createEngine();+ engine._recordingSession = { sessionId: "s2", noteId: null };++ await engine.startManualMeeting();++ assert.deepEqual(noteNavigations, []);+});diff --git a/test/helpers/selectionManager.test.js b/test/helpers/selectionManager.test.jsindex 488d94241..a646842c6 100644--- a/test/helpers/selectionManager.test.js+++ b/test/helpers/selectionManager.test.js@@ -193,8 +193,7 @@ test("a Linux AT-SPI terminal pid never becomes a caret delivery target", asyncconst editor = { kind: "atspi-pid", id: "8765" };assert.equal(- (await manager._markEditableCaret({ status: "none", target: terminal }, terminal, true))- .status,+ (await manager._markEditableCaret({ status: "none", target: terminal }, terminal, true)).status,"none");assert.equal(probes.length, 0, "a terminal pid must be refused without probing");@@ -458,9 +457,9 @@ test("a superseded probe never overwrites the newer probe's target", async () =>});// The Windows paste path restores the window captured at record start (#859).-// getWinTargetHwnd hands the paste that HWND exactly as --detect-only printed+// getWinTarget hands the paste that HWND exactly as --detect-only printed// it ("TARGET %p", hex) so the binary's base-16 --restore-window parse round-trips.-test("getWinTargetHwnd returns the hex HWND a win32 probe captured (#859)", async () => {+test("getWinTarget returns the hex HWND a win32 probe captured (#859)", async () => {const spawnCalls = [];const SpawningSelectionManager = loadSelectionManager({spawn: (command, args) => {@@ -490,12 +489,12 @@ test("getWinTargetHwnd returns the hex HWND a win32 probe captured (#859)", asynassert.deepEqual(spawnCalls, [{ command: "/tmp/windows-fast-paste.exe", args: ["--detect-only"] },]);- assert.equal(await manager.getWinTargetHwnd(), "00001A2B");+ assert.equal((await manager.getWinTarget())?.id, "00001A2B");});// captureTarget() nulls lastTarget while its probe runs; a paste racing the// stop-press probe must wait for the answer instead of restoring nothing.-test("getWinTargetHwnd waits for an in-flight probe before answering", async () => {+test("getWinTarget waits for an in-flight probe before answering", async () => {const manager = new SelectionManager({clipboardManager: {},textEditMonitor: {},@@ -506,24 +505,24 @@ test("getWinTargetHwnd waits for an in-flight probe before answering", async ()manager._probeTarget = () => new Promise((resolve) => (resolveProbe = resolve));const probe = manager.captureTarget();- const pending = manager.getWinTargetHwnd();+ const pending = manager.getWinTarget();resolveProbe({ kind: "win-hwnd", id: "0000F00D" });await probe;- assert.equal(await pending, "0000F00D");+ assert.equal((await pending)?.id, "0000F00D");});-test("getWinTargetHwnd is null without a capture or with a non-Windows target", async () => {+test("getWinTarget is null without a capture or with a non-Windows target", async () => {const manager = new SelectionManager({clipboardManager: {},textEditMonitor: {},platform: "linux",now: () => 1000,});- assert.equal(await manager.getWinTargetHwnd(), null);+ assert.equal(await manager.getWinTarget(), null);manager.lastTarget = { kind: "x11-window", id: "7" };- assert.equal(await manager.getWinTargetHwnd(), null);+ assert.equal(await manager.getWinTarget(), null);});test("caret delivery pins the captured Windows HWND into the paste helper", async () => {diff --git a/test/helpers/trayActionPolicy.test.js b/test/helpers/trayActionPolicy.test.jsnew file mode 100644index 000000000..daea912b5--- /dev/null+++ b/test/helpers/trayActionPolicy.test.js@@ -0,0 +1,64 @@+const test = require("node:test");+const assert = require("node:assert/strict");++const load = () => import("../../src/helpers/trayActionPolicy.js");++// The pill's command menu hides Ask assistant instead of refusing; the tray always+// shows it, so every path here must answer rather than swallow the click.+test("the tray's assistant action refuses policy and a busy pill, and runs otherwise", async () => {+ const { resolveTrayAssistantAction, TRAY_REFUSAL_KEYS } = await load();+ const idle = {+ agentAllowed: true,+ policyResolved: true,+ isRecording: false,+ liveTranscriptMounted: false,+ };++ assert.deepEqual(resolveTrayAssistantAction(idle), { action: "run" });+ assert.deepEqual(resolveTrayAssistantAction({ ...idle, agentAllowed: false }), {+ action: "refuse",+ messageKey: TRAY_REFUSAL_KEYS.agentRestricted,+ });+ assert.deepEqual(resolveTrayAssistantAction({ ...idle, isRecording: true }), {+ action: "refuse",+ messageKey: TRAY_REFUSAL_KEYS.busy,+ });+ // The transcript panel owns the pill just as a live recording does.+ assert.deepEqual(resolveTrayAssistantAction({ ...idle, liveTranscriptMounted: true }), {+ action: "refuse",+ messageKey: TRAY_REFUSAL_KEYS.busy,+ });+});++// Policy outranks busy: an org refusal explains the real reason.+test("a blocked policy is reported even while the pill is busy", async () => {+ const { resolveTrayAssistantAction, TRAY_REFUSAL_KEYS } = await load();++ assert.equal(+ resolveTrayAssistantAction({ agentAllowed: false, policyResolved: true, isRecording: true })+ .messageKey,+ TRAY_REFUSAL_KEYS.agentRestricted+ );+});++// An offline or failed policy fetch fails closed exactly like a restriction, and+// telling the user their org blocked something it never blocked is a lie.+test("an unresolved policy is not reported as an organization restriction", async () => {+ const { resolveTrayAssistantAction, TRAY_REFUSAL_KEYS } = await load();++ assert.equal(+ resolveTrayAssistantAction({+ agentAllowed: false,+ policyResolved: false,+ isRecording: false,+ liveTranscriptMounted: false,+ }).messageKey,+ TRAY_REFUSAL_KEYS.policyUnresolved+ );++ // A caller that forgets the input must not silently keep the org wording.+ assert.equal(+ resolveTrayAssistantAction({ agentAllowed: false, isRecording: false }).messageKey,+ TRAY_REFUSAL_KEYS.policyUnresolved+ );+});diff --git a/test/helpers/trayQuickActions.test.js b/test/helpers/trayQuickActions.test.jsnew file mode 100644index 000000000..17ec0d45e--- /dev/null+++ b/test/helpers/trayQuickActions.test.js@@ -0,0 +1,59 @@+const test = require("node:test");+const assert = require("node:assert/strict");+const Module = require("node:module");++const originalLoad = Module._load;+Module._load = function loadTrayWithStubs(request, parent, isMain) {+ if (request === "electron") return { Tray: class {}, Menu: {}, nativeImage: {}, app: {} };+ if (request === "./debugLogger") return { info: () => undefined, debug: () => undefined };+ if (request === "./dockManager") return {};+ if (request === "./i18nMain") return { i18nMain: { t: (key) => key } };+ return originalLoad.call(this, request, parent, isMain);+};+const TrayManager = require("../../src/helpers/tray");+Module._load = originalLoad;++function createTrayManager(calls, { dictating = false } = {}) {+ const trayManager = new TrayManager();+ trayManager.windowManager = {+ isDictationPanelVisible: () => false,+ isDictating: () => dictating,+ sendStartDictation: () => calls.push("start-dictation"),+ sendStopDictation: () => calls.push("stop-dictation"),+ sendOpenAssistantPanel: () => calls.push("assistant"),+ startManualMeeting: () => calls.push("meeting"),+ };+ return trayManager;+}++test("the tray menu leads with the dictation pill's quick actions", () => {+ const calls = [];+ const [listen, assistant, meeting, separator] =+ createTrayManager(calls).buildContextMenuTemplate();++ assert.deepEqual(+ [listen.label, assistant.label, meeting.label, separator.type],+ [+ "app.commandMenu.startListening",+ "app.commandMenu.askAssistant",+ "app.commandMenu.startMeetingRecording",+ "separator",+ ]+ );++ listen.click();+ assistant.click();+ meeting.click();+ // Listening and a meeting start in the main process; only the assistant needs+ // the renderer, which is the one that can open its panel.+ assert.deepEqual(calls, ["start-dictation", "assistant", "meeting"]);+});++test("the tray's listen item stops the recording it reflects", () => {+ const calls = [];+ const [listen] = createTrayManager(calls, { dictating: true }).buildContextMenuTemplate();++ assert.equal(listen.label, "app.commandMenu.stopListening");+ listen.click();+ assert.deepEqual(calls, ["stop-dictation"]);+});diff --git a/test/helpers/windowManagerMeetingNotification.test.js b/test/helpers/windowManagerMeetingNotification.test.jsindex 156c625b5..1716e1803 100644--- a/test/helpers/windowManagerMeetingNotification.test.js+++ b/test/helpers/windowManagerMeetingNotification.test.js@@ -86,7 +86,14 @@ Module._load = function loadWindowManagerWithStubs(request, parent, isMain) {dialog: {},};}- if (request === "./debugLogger") return { warn: () => undefined };+ if (request === "./debugLogger") {+ return {+ info: () => undefined,+ warn: () => undefined,+ debug: () => undefined,+ error: () => undefined,+ };+ }if (request === "./hotkeyManager") return FakeHotkeyManager;if (request === "./dragManager") return FakeDragManager;if (request === "./menuManager") return {};@@ -763,3 +770,58 @@ test("a detection card whose load fails releases that detection", async () => {await assert.rejects(showPromise, /load failed/);assert.deepEqual(closedDetections, ["audio:sustained-audio"]);});++test("manual meeting starts fail closed like the meeting hotkey", async () => {+ let starts = 0;+ const engine = { startManualMeeting: async () => (starts += 1) };++ const onboarding = new WindowManager();+ onboarding.meetingDetectionEngine = engine;+ await onboarding.startManualMeeting();+ assert.equal(starts, 0);++ const manager = createNormalWindowManager();+ manager.meetingDetectionEngine = engine;+ manager.hotkeyManager.isInListeningMode = () => true;+ await manager.startManualMeeting();+ assert.equal(starts, 0);++ manager.hotkeyManager.isInListeningMode = () => false;+ await manager.startManualMeeting();+ assert.equal(starts, 1);+});++// Only the renderer can open the assistant panel, and it owns the policy and+// recording state the pill menu gates the item on, so nothing may be shown,+// focused, or created before it accepts.+test("the tray's Ask assistant asks the renderer without showing or focusing the pill", () => {+ const fakeMainWindow = (events) => ({+ isDestroyed: () => false,+ isMinimized: () => false,+ isVisible: () => true,+ focus: () => events.push("focus"),+ show: () => events.push("show"),+ showInactive: () => events.push("show"),+ webContents: { send: (channel) => events.push(channel) },+ });++ const onboardingEvents = [];+ const onboarding = new WindowManager();+ onboarding.mainWindow = fakeMainWindow(onboardingEvents);+ onboarding.sendOpenAssistantPanel();+ assert.deepEqual(onboardingEvents, []);++ const events = [];+ const manager = createNormalWindowManager();+ manager.mainWindow = fakeMainWindow(events);+ manager.sendOpenAssistantPanel();+ assert.deepEqual(events, ["open-assistant-panel"]);++ // Capturing a hotkey swallows it, like every other input path.+ const capturingEvents = [];+ const capturing = createNormalWindowManager();+ capturing.mainWindow = fakeMainWindow(capturingEvents);+ capturing.hotkeyManager.isInListeningMode = () => true;+ capturing.sendOpenAssistantPanel();+ assert.deepEqual(capturingEvents, []);+});diff --git a/test/helpers/windowsPasteTarget.test.js b/test/helpers/windowsPasteTarget.test.jsnew file mode 100644index 000000000..698d72bb5--- /dev/null+++ b/test/helpers/windowsPasteTarget.test.js@@ -0,0 +1,80 @@+const test = require("node:test");+const assert = require("node:assert/strict");+const {+ isRestorablePasteTarget,+ parseWindowHandle,+} = require("../../src/helpers/windowsPasteTarget");++const OWN_EXE = "OpenWhispr.exe";++function handleBuffer(hex, bytes = 8) {+ const buffer = Buffer.alloc(bytes);+ if (bytes >= 8) buffer.writeBigUInt64LE(BigInt(`0x${hex}`));+ else buffer.writeUInt32LE(Number(`0x${hex}`));+ return buffer;+}++test("another app's window is restored, as it was before the tray could start dictation", () => {+ const restorable = isRestorablePasteTarget({+ target: { id: "00001A2B", exeName: "notepad.exe" },+ ownExeName: OWN_EXE,+ ownWindowHandles: [],+ });++ assert.equal(restorable, true);+});++test("our own window stays a target, so dictating into a note still pastes there", () => {+ const restorable = isRestorablePasteTarget({+ target: { id: "00001A2B", exeName: "openwhispr.exe" },+ ownExeName: OWN_EXE,+ ownWindowHandles: [handleBuffer("0000BEEF"), handleBuffer("00001A2B")],+ });++ assert.equal(restorable, true);+});++// The tray menu's owner window: ours, but not one of our windows.+test("our own non-window surface is dropped rather than force-activated", () => {+ const restorable = isRestorablePasteTarget({+ target: { id: "00001A2B", exeName: "OpenWhispr.exe" },+ ownExeName: OWN_EXE,+ ownWindowHandles: [handleBuffer("0000BEEF")],+ });++ assert.equal(restorable, false);+});++test("a 32-bit window handle compares by value, not by buffer width", () => {+ const restorable = isRestorablePasteTarget({+ target: { id: "0x1A2B", exeName: OWN_EXE },+ ownExeName: OWN_EXE,+ ownWindowHandles: [handleBuffer("00001A2B", 4)],+ });++ assert.equal(restorable, true);+});++test("an unreadable window identity keeps the old behaviour", () => {+ const noExeName = isRestorablePasteTarget({+ target: { id: "00001A2B", exeName: null },+ ownExeName: OWN_EXE,+ ownWindowHandles: [],+ });+ assert.equal(noExeName, true, "a missing exe name reads as another app's window");++ const unparsableOwn = isRestorablePasteTarget({+ target: { id: "not-a-handle", exeName: OWN_EXE },+ ownExeName: OWN_EXE,+ ownWindowHandles: [handleBuffer("00001A2B")],+ });+ assert.equal(unparsableOwn, false, "ours but unidentifiable: don't force the foreground");++ assert.equal(isRestorablePasteTarget({ target: null, ownExeName: OWN_EXE }), false);+});++test("handles parse as hex with or without the 0x the helper may print", () => {+ assert.equal(parseWindowHandle("00001A2B"), 0x1a2bn);+ assert.equal(parseWindowHandle("0x00001A2B"), 0x1a2bn);+ assert.equal(parseWindowHandle("nope"), null);+});diff --git a/test/hooks/canCreateTeamSpace.test.js b/test/hooks/canCreateTeamSpace.test.jsnew file mode 100644index 000000000..3b6c17775--- /dev/null+++ b/test/hooks/canCreateTeamSpace.test.js@@ -0,0 +1,74 @@+const assert = require("node:assert/strict");+const test = require("node:test");+const React = require("react");+const { createRoot } = require("react-dom/client");+const {+ createRendererServer,+ installBrowserGlobals,+ installHookDom,+} = require("../lib/rendererTestHarness");++// canManageWorkspace stays real: the rule under test is which roles it lets through.+test("team space creation is offered to workspace managers and to users with none yet", async (t) => {+ let root = null;+ t.after(async () => {+ if (root) await React.act(async () => root.unmount());+ });++ installBrowserGlobals(t);+ const container = installHookDom(t);++ const vite = await createRendererServer(t, {+ cachePrefix: "openwhispr-can-create-team-space-",+ mockModules: {+ "/useAuth": "export const useAuth = () => ({ isSignedIn: globalThis.__state.isSignedIn });",+ "/useTeamSpacesCapability": `+ export const useTeamSpacesCapability = (isSignedIn) =>+ isSignedIn && globalThis.__state.teamSpacesAvailable;+ `,+ "/useWorkspace": `+ export const useWorkspace = () => ({+ workspaces: globalThis.__state.workspaces,+ loaded: globalThis.__state.loaded,+ });+ `,+ },+ });+ const { useCanCreateTeamSpace } = await vite.ssrLoadModule("/hooks/useCanCreateTeamSpace.ts");++ let latest = null;+ function Harness() {+ latest = useCanCreateTeamSpace();+ return null;+ }++ root = createRoot(container);+ t.after(() => {+ delete globalThis.__state;+ });+ const canCreate = async (state) => {+ globalThis.__state = { isSignedIn: true, teamSpacesAvailable: true, loaded: true, ...state };+ await React.act(async () => {+ root.render(React.createElement(Harness, { key: JSON.stringify(state) }));+ await Promise.resolve();+ });+ return latest;+ };++ assert.equal(await canCreate({ isSignedIn: false, workspaces: [] }), false);+ assert.equal(await canCreate({ teamSpacesAvailable: false, workspaces: [] }), false);+ assert.equal(await canCreate({ loaded: false, workspaces: [] }), false);+ // No workspace yet: the dialog walks the user through creating one.+ assert.equal(await canCreate({ workspaces: [] }), true);+ assert.equal(await canCreate({ workspaces: [{ id: "w1", role: "member" }] }), false);+ assert.equal(await canCreate({ workspaces: [{ id: "w1", role: "admin" }] }), true);+ assert.equal(+ await canCreate({+ workspaces: [+ { id: "w1", role: "member" },+ { id: "w2", role: "owner" },+ ],+ }),+ true+ );+});diff --git a/test/hooks/useTrayQuickActions.test.js b/test/hooks/useTrayQuickActions.test.jsnew file mode 100644index 000000000..fcc6d8f37--- /dev/null+++ b/test/hooks/useTrayQuickActions.test.js@@ -0,0 +1,133 @@+const test = require("node:test");+const assert = require("node:assert/strict");+const React = require("react");+const {+ createRendererServer,+ installBrowserGlobals,+ installHookDom,+} = require("../lib/rendererTestHarness");++// The resolver is pure and tested on its own; what this pins is the wiring.+// App hands this hook its own state, and a forgotten or swapped input — the+// assistant panel's mounted flag where the transcript's belongs, a dropped+// policy input — would refuse or run at exactly the wrong moment with every+// other test still green. SSR cannot run useEffect, so the hook is mounted for+// real and the registered IPC callback is invoked like the tray would.+async function mountTrayQuickActions(t, props) {+ // Registered before the browser globals, so it runs before their teardown:+ // node:test runs after-hooks in registration order and react-dom reads+ // `window` while unmounting.+ const rootRef = { current: null };+ t.after(async () => {+ if (rootRef.current) await React.act(async () => rootRef.current.unmount());+ });++ const listeners = {};+ const calls = { assistantOpens: 0, menuCloses: 0, refusals: [] };+ const electronAPI = {+ onOpenAssistantPanel: (callback) => {+ listeners.assistant = callback;+ return () => {+ delete listeners.assistant;+ };+ },+ };++ installBrowserGlobals(t, { window: { electronAPI } });+ const container = installHookDom(t);+ const vite = await createRendererServer(t, {+ cachePrefix: "openwhispr-tray-quick-actions-test-",+ });+ const [{ useTrayQuickActions }, { TRAY_REFUSAL_KEYS }] = await Promise.all([+ vite.ssrLoadModule("/hooks/useTrayQuickActions.js"),+ vite.ssrLoadModule("/helpers/trayActionPolicy.js"),+ ]);++ function Harness() {+ useTrayQuickActions({+ ...props,+ closeCommandMenu: () => {+ calls.menuCloses += 1;+ },+ openAssistantPanel: async () => {+ calls.assistantOpens += 1;+ },+ refuse: (messageKey) => calls.refusals.push(messageKey),+ });+ return null;+ }++ const { createRoot } = require("react-dom/client");+ const root = createRoot(container);+ await React.act(async () => root.render(React.createElement(Harness)));+ rootRef.current = root;++ return { listeners, calls, TRAY_REFUSAL_KEYS };+}++const idle = {+ agentAllowed: true,+ policyResolved: true,+ isRecording: false,+ liveTranscriptMounted: false,+};++test("an idle pill opens the assistant and closes the command menu", async (t) => {+ const { listeners, calls } = await mountTrayQuickActions(t, idle);++ await React.act(async () => listeners.assistant());++ assert.equal(calls.assistantOpens, 1);+ assert.equal(calls.menuCloses, 1);+ assert.deepEqual(calls.refusals, []);+});++test("a live dictation refuses rather than stealing the pill", async (t) => {+ const { listeners, calls, TRAY_REFUSAL_KEYS } = await mountTrayQuickActions(t, {+ ...idle,+ isRecording: true,+ });++ await React.act(async () => listeners.assistant());++ assert.deepEqual(calls.refusals, [TRAY_REFUSAL_KEYS.busy]);+ assert.equal(calls.assistantOpens, 0);+});++// The transcript panel owns the pill exactly as a recording does, and it is the+// input most easily confused with the assistant panel's own mounted flag.+test("the transcript panel's flag gates the assistant item", async (t) => {+ const { listeners, calls, TRAY_REFUSAL_KEYS } = await mountTrayQuickActions(t, {+ ...idle,+ liveTranscriptMounted: true,+ });++ await React.act(async () => listeners.assistant());++ assert.deepEqual(calls.refusals, [TRAY_REFUSAL_KEYS.busy]);+ assert.equal(calls.assistantOpens, 0);+});++// Policy failing closed must not be reported as an org that restricted something.+test("an unresolved policy refuses without blaming the organization", async (t) => {+ const { listeners, calls, TRAY_REFUSAL_KEYS } = await mountTrayQuickActions(t, {+ ...idle,+ agentAllowed: false,+ policyResolved: false,+ });++ await React.act(async () => listeners.assistant());++ assert.deepEqual(calls.refusals, [TRAY_REFUSAL_KEYS.policyUnresolved]);+});++test("a resolved policy that really restricts the assistant says so", async (t) => {+ const { listeners, calls, TRAY_REFUSAL_KEYS } = await mountTrayQuickActions(t, {+ ...idle,+ agentAllowed: false,+ });++ await React.act(async () => listeners.assistant());++ assert.deepEqual(calls.refusals, [TRAY_REFUSAL_KEYS.agentRestricted]);+});