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: agent mode window starts at full screen height with drag-to-resize
Gabriel Steinba78ef0ee601
diff --git a/preload.js b/preload.jsindex 960627288..151e03ced 100644--- a/preload.js+++ b/preload.js@@ -512,16 +512,21 @@ contextBridge.exposeInMainWorld("electronAPI", {saveAgentKey: (key) => ipcRenderer.invoke("save-agent-key", key),onAgentStartRecording: registerListener("agent-start-recording", (callback) => () => callback()),onAgentStopRecording: registerListener("agent-stop-recording", (callback) => () => callback()),- onAgentToggleRecording: registerListener("agent-toggle-recording", (callback) => () => callback()),+ onAgentToggleRecording: registerListener(+ "agent-toggle-recording",+ (callback) => () => callback()+ ),toggleAgentOverlay: () => ipcRenderer.invoke("toggle-agent-overlay"),hideAgentOverlay: () => ipcRenderer.invoke("hide-agent-overlay"),resizeAgentWindow: (width, height) => ipcRenderer.invoke("resize-agent-window", width, height),+ getAgentWindowBounds: () => ipcRenderer.invoke("get-agent-window-bounds"),+ setAgentWindowBounds: (x, y, width, height) =>+ ipcRenderer.invoke("set-agent-window-bounds", x, y, width, height),acquireRecordingLock: (pipeline) => ipcRenderer.invoke("acquire-recording-lock", pipeline),releaseRecordingLock: (pipeline) => ipcRenderer.invoke("release-recording-lock", pipeline),// Agent cloud streaming- cloudAgentStream: (messages, opts) =>- ipcRenderer.invoke("cloud-agent-stream", messages, opts),+ cloudAgentStream: (messages, opts) => ipcRenderer.invoke("cloud-agent-stream", messages, opts),onAgentStreamChunk: registerListener("agent-stream-chunk",(callback) => (_event, chunk) => callback(chunk)@@ -529,20 +534,15 @@ contextBridge.exposeInMainWorld("electronAPI", {onAgentStreamDone: registerListener("agent-stream-done", (callback) => () => callback()),// Agent conversation persistence- createAgentConversation: (title) =>- ipcRenderer.invoke("db-create-agent-conversation", title),- getAgentConversations: (limit) =>- ipcRenderer.invoke("db-get-agent-conversations", limit),- getAgentConversation: (id) =>- ipcRenderer.invoke("db-get-agent-conversation", id),- deleteAgentConversation: (id) =>- ipcRenderer.invoke("db-delete-agent-conversation", id),+ createAgentConversation: (title) => ipcRenderer.invoke("db-create-agent-conversation", title),+ getAgentConversations: (limit) => ipcRenderer.invoke("db-get-agent-conversations", limit),+ getAgentConversation: (id) => ipcRenderer.invoke("db-get-agent-conversation", id),+ deleteAgentConversation: (id) => ipcRenderer.invoke("db-delete-agent-conversation", id),updateAgentConversationTitle: (id, title) =>ipcRenderer.invoke("db-update-agent-conversation-title", id, title),addAgentMessage: (conversationId, role, content) =>ipcRenderer.invoke("db-add-agent-message", conversationId, role, content),- getAgentMessages: (conversationId) =>- ipcRenderer.invoke("db-get-agent-messages", conversationId),+ getAgentMessages: (conversationId) => ipcRenderer.invoke("db-get-agent-messages", conversationId),// Google CalendargcalStartOAuth: () => ipcRenderer.invoke("gcal-start-oauth"),diff --git a/src/components/AgentOverlay.tsx b/src/components/AgentOverlay.tsxindex 92c0a2a81..226e6a9ba 100644--- a/src/components/AgentOverlay.tsx+++ b/src/components/AgentOverlay.tsx@@ -18,14 +18,12 @@ interface Message {}const MIN_HEIGHT = 200;-const MAX_HEIGHT = 1000;-const WIDTH = 420;+const MIN_WIDTH = 360;export default function AgentOverlay() {const [messages, setMessages] = useState<Message[]>([]);const [agentState, setAgentState] = useState<AgentState>("idle");const [partialTranscript, setPartialTranscript] = useState("");- const containerRef = useRef<HTMLDivElement>(null);const audioManagerRef = useRef<InstanceType<typeof AudioManager> | null>(null);const messagesRef = useRef<Message[]>([]);const agentStateRef = useRef<AgentState>("idle");@@ -169,58 +167,47 @@ export default function AgentOverlay() {};}, [addSystemMessage, handleTranscriptionComplete]);- const resizeTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);- const lastSentHeightRef = useRef<number>(0);-- const resizeToContent = useCallback(() => {- const el = containerRef.current;- if (!el) return;-- // Find the scrollable chat container- const chatEl = el.querySelector(".agent-chat-scroll") as HTMLElement;- if (!chatEl) return;-- const chatContent = chatEl.firstElementChild as HTMLElement;- if (!chatContent) return;-- // Empty state has h-full class — skip resize to avoid oscillation- if (chatContent.classList.contains("h-full")) return;-- // Measure the actual message list height + chat padding- const chatStyle = getComputedStyle(chatEl);- const chatPadding =- parseFloat(chatStyle.paddingTop || "0") + parseFloat(chatStyle.paddingBottom || "0");- const contentHeight = chatContent.scrollHeight + chatPadding;-- // Title bar (h-8 = 32px) + chat content + Input (h-12 = 48px) + borders (~2px)- const desiredHeight = 32 + contentHeight + 48 + 2;- const height = Math.max(MIN_HEIGHT, Math.min(Math.ceil(desiredHeight), MAX_HEIGHT));-- // Skip if height hasn't meaningfully changed- if (Math.abs(height - lastSentHeightRef.current) < 4) return;- lastSentHeightRef.current = height;-- if (resizeTimeoutRef.current) {- clearTimeout(resizeTimeoutRef.current);- }- resizeTimeoutRef.current = setTimeout(() => {- window.electronAPI?.resizeAgentWindow?.(WIDTH, height);- }, 50);- }, []);-- useEffect(() => {- resizeToContent();- }, [messages, agentState, resizeToContent]);-- useEffect(() => {- const observer = new ResizeObserver(() => {- resizeToContent();+ const handleResizeStart = useCallback((e: React.MouseEvent, direction: string) => {+ e.preventDefault();+ e.stopPropagation();+ const startX = e.screenX;+ const startY = e.screenY;++ window.electronAPI?.getAgentWindowBounds?.().then((bounds) => {+ if (!bounds) return;+ const startBounds = { ...bounds };++ const handleMouseMove = (ev: MouseEvent) => {+ const dx = ev.screenX - startX;+ const dy = ev.screenY - startY;+ let { x, y, width, height } = startBounds;++ if (direction.includes("e")) width += dx;+ if (direction.includes("w")) {+ x += dx;+ width -= dx;+ }+ if (direction.includes("s")) height += dy;+ if (direction.includes("n")) {+ y += dy;+ height -= dy;+ }++ width = Math.max(MIN_WIDTH, width);+ height = Math.max(MIN_HEIGHT, height);++ window.electronAPI?.setAgentWindowBounds?.(x, y, width, height);+ };++ const handleMouseUp = () => {+ document.removeEventListener("mousemove", handleMouseMove);+ document.removeEventListener("mouseup", handleMouseUp);+ };++ document.addEventListener("mousemove", handleMouseMove);+ document.addEventListener("mouseup", handleMouseUp);});- if (containerRef.current) {- observer.observe(containerRef.current);- }- return () => observer.disconnect();- }, [resizeToContent]);+ }, []);useEffect(() => {const handleKeyDown = (e: KeyboardEvent) => {@@ -262,8 +249,6 @@ export default function AgentOverlay() {setAgentState("idle");setPartialTranscript("");conversationIdRef.current = null;- lastSentHeightRef.current = 0;- window.electronAPI?.resizeAgentWindow?.(WIDTH, MIN_HEIGHT);}, []);const handleClose = useCallback(() => {@@ -271,9 +256,8 @@ export default function AgentOverlay() {}, []);return (- <div className="agent-overlay-window w-screen h-screen bg-transparent">+ <div className="agent-overlay-window w-screen h-screen bg-transparent relative"><div- ref={containerRef}className={cn("flex flex-col w-full h-full","bg-surface-1/75 backdrop-blur-2xl",@@ -286,6 +270,42 @@ export default function AgentOverlay() {<AgentChat messages={messages} /><AgentInput agentState={agentState} partialTranscript={partialTranscript} /></div>++ {/* Resize handles — edges */}+ <div+ className="absolute top-0 left-2 right-2 h-[5px] cursor-n-resize"+ onMouseDown={(e) => handleResizeStart(e, "n")}+ />+ <div+ className="absolute bottom-0 left-2 right-2 h-[5px] cursor-s-resize"+ onMouseDown={(e) => handleResizeStart(e, "s")}+ />+ <div+ className="absolute left-0 top-2 bottom-2 w-[5px] cursor-w-resize"+ onMouseDown={(e) => handleResizeStart(e, "w")}+ />+ <div+ className="absolute right-0 top-2 bottom-2 w-[5px] cursor-e-resize"+ onMouseDown={(e) => handleResizeStart(e, "e")}+ />++ {/* Resize handles — corners */}+ <div+ className="absolute top-0 left-0 w-[10px] h-[10px] cursor-nw-resize"+ onMouseDown={(e) => handleResizeStart(e, "nw")}+ />+ <div+ className="absolute top-0 right-0 w-[10px] h-[10px] cursor-ne-resize"+ onMouseDown={(e) => handleResizeStart(e, "ne")}+ />+ <div+ className="absolute bottom-0 left-0 w-[10px] h-[10px] cursor-sw-resize"+ onMouseDown={(e) => handleResizeStart(e, "sw")}+ />+ <div+ className="absolute bottom-0 right-0 w-[10px] h-[10px] cursor-se-resize"+ onMouseDown={(e) => handleResizeStart(e, "se")}+ /></div>);}diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.jsindex 24679d858..e64e324c0 100644--- a/src/helpers/ipcHandlers.js+++ b/src/helpers/ipcHandlers.js@@ -1679,6 +1679,7 @@ class IPCHandlers {ipcMain.handle("llama-server-start", async (event, modelId) => {try {const modelManager = require("./modelManagerBridge").default;+ modelManager.ensureInitialized();const modelInfo = modelManager.findModelById(modelId);if (!modelInfo) {return { success: false, error: `Model "${modelId}" not found` };@@ -3559,6 +3560,15 @@ class IPCHandlers {return { success: true };});+ ipcMain.handle("get-agent-window-bounds", async () => {+ return this.windowManager.getAgentWindowBounds();+ });++ ipcMain.handle("set-agent-window-bounds", async (_event, x, y, width, height) => {+ this.windowManager.setAgentWindowBounds(x, y, width, height);+ return { success: true };+ });+ipcMain.handle("acquire-recording-lock", async (_event, pipeline) => {if (this._activeRecordingPipeline && this._activeRecordingPipeline !== pipeline) {return { success: false, holder: this._activeRecordingPipeline };diff --git a/src/helpers/windowConfig.js b/src/helpers/windowConfig.jsindex e9079688d..a59a77407 100644--- a/src/helpers/windowConfig.js+++ b/src/helpers/windowConfig.js@@ -166,8 +166,8 @@ const AGENT_OVERLAY_CONFIG = {height: 300,minWidth: 360,minHeight: 200,- maxWidth: 600,- maxHeight: 1000,+ maxWidth: 800,+ maxHeight: 10000,frame: false,alwaysOnTop: true,transparent: true,diff --git a/src/helpers/windowManager.js b/src/helpers/windowManager.jsindex b0a16fc2a..37a92d723 100644--- a/src/helpers/windowManager.js+++ b/src/helpers/windowManager.js@@ -644,17 +644,32 @@ class WindowManager {showAgentOverlay() {if (!this.agentWindow || this.agentWindow.isDestroyed()) return;- // Reset to compact initial sizethis._clearAgentAnimation();- const bounds = this.agentWindow.getBounds();++ // Get work area to fill full screen height+ const mainBounds =+ this.mainWindow && !this.mainWindow.isDestroyed() ? this.mainWindow.getBounds() : null;+ const refPoint = mainBounds || { x: 0, y: 0 };+ const display = screen.getDisplayNearestPoint({ x: refPoint.x, y: refPoint.y });+ const workArea = display.workArea || display.bounds;++ const width = AGENT_OVERLAY_CONFIG.width;+ const height = workArea.height;++ // Center horizontally relative to main window, fill work area height+ let x = workArea.x;+ if (mainBounds) {+ x = mainBounds.x + Math.round((mainBounds.width - width) / 2);+ x = Math.max(workArea.x, Math.min(x, workArea.x + workArea.width - width));+ }+this.agentWindow.setBounds({- x: bounds.x,- y: bounds.y,- width: AGENT_OVERLAY_CONFIG.width,- height: AGENT_OVERLAY_CONFIG.height,+ x,+ y: workArea.y,+ width,+ height,});- this._positionAgentWindow();WindowPositionUtil.setupAlwaysOnTop(this.agentWindow);if (typeof this.agentWindow.showInactive === "function") {@@ -761,26 +776,32 @@ class WindowManager {this._agentAnimationState = null;}- _positionAgentWindow() {- if (!this.mainWindow || this.mainWindow.isDestroyed()) return;+ getAgentWindowBounds() {+ if (!this.agentWindow || this.agentWindow.isDestroyed()) return null;+ return this.agentWindow.getBounds();+ }++ setAgentWindowBounds(x, y, width, height) {if (!this.agentWindow || this.agentWindow.isDestroyed()) return;- const mainBounds = this.mainWindow.getBounds();- const agentBounds = this.agentWindow.getBounds();- const MARGIN = 8;+ const bounds = {+ x: Math.round(x),+ y: Math.round(y),+ width: Math.round(width),+ height: Math.round(height),+ };- const x = mainBounds.x + Math.round((mainBounds.width - agentBounds.width) / 2);- const y = mainBounds.y - agentBounds.height - MARGIN;+ // Enforce minimums+ bounds.width = Math.max(AGENT_OVERLAY_CONFIG.minWidth, bounds.width);+ bounds.height = Math.max(AGENT_OVERLAY_CONFIG.minHeight, bounds.height);- const display = screen.getDisplayNearestPoint({ x: mainBounds.x, y: mainBounds.y });+ // Clamp to screen work area+ const display = screen.getDisplayNearestPoint({ x: bounds.x, y: bounds.y });const workArea = display.workArea || display.bounds;+ bounds.width = Math.min(bounds.width, workArea.width);+ bounds.height = Math.min(bounds.height, workArea.y + workArea.height - bounds.y);- this.agentWindow.setBounds({- x: Math.max(workArea.x, Math.min(x, workArea.x + workArea.width - agentBounds.width)),- y: Math.max(workArea.y, y),- width: agentBounds.width,- height: agentBounds.height,- });+ this.agentWindow.setBounds(bounds);}showDictationPanel(options = {}) {diff --git a/src/types/electron.ts b/src/types/electron.tsindex 7e2981dbf..91f6e8403 100644--- a/src/types/electron.ts+++ b/src/types/electron.ts@@ -1002,6 +1002,13 @@ declare global {// Agent overlayresizeAgentWindow?: (width: number, height: number) => Promise<void>;+ getAgentWindowBounds?: () => Promise<{+ x: number;+ y: number;+ width: number;+ height: number;+ } | null>;+ setAgentWindowBounds?: (x: number, y: number, width: number, height: number) => Promise<void>;hideAgentOverlay?: () => Promise<void>;onAgentStartRecording?: (callback: () => void) => () => void;onAgentStopRecording?: (callback: () => void) => () => void;