diff --git a/packages/app/src/components/add-host-modal.tsx b/packages/app/src/components/add-host-modal.tsx index 37f644c87..10a2f962d 100644 --- a/packages/app/src/components/add-host-modal.tsx +++ b/packages/app/src/components/add-host-modal.tsx @@ -216,10 +216,10 @@ export function AddHostModal({ visible, onClose, onCancel, onSaved }: AddHostMod onSaved?.({ profile, serverId, hostname, isNewHost }); handleClose(); } catch (error) { - const { title, detail, raw } = buildConnectionFailureCopy(endpoint, error); + const { title, detail, raw: rawDetail } = buildConnectionFailureCopy(endpoint, error); const combined = - raw && detail && raw !== detail - ? `${title}\n${detail}\nDetails: ${raw}` + rawDetail && detail && rawDetail !== detail + ? `${title}\n${detail}\nDetails: ${rawDetail}` : detail ? `${title}\n${detail}` : title; diff --git a/packages/app/src/components/agent-status-bar.tsx b/packages/app/src/components/agent-status-bar.tsx index dc66f27b5..3f0557244 100644 --- a/packages/app/src/components/agent-status-bar.tsx +++ b/packages/app/src/components/agent-status-bar.tsx @@ -369,8 +369,8 @@ function ControlledStatusBar({ const handleModeSelect = useCallback((id: string) => onSelectMode?.(id), [onSelectMode]); const handleDesktopModelSelect = useCallback( - (selectedProviderId: string, modelId: string) => { - if (selectedProviderId === provider) { + (nextProviderId: string, modelId: string) => { + if (nextProviderId === provider) { onSelectModel?.(modelId); } }, @@ -425,13 +425,13 @@ function ControlledStatusBar({ ); const handleSheetModelSelect = useCallback( - (selectedProviderId: string, modelId: string) => { + (nextProviderId: string, modelId: string) => { if (onSelectProviderAndModel) { - onSelectProviderAndModel(selectedProviderId, modelId); + onSelectProviderAndModel(nextProviderId, modelId); return; } - if (selectedProviderId !== provider) { - onSelectProvider?.(selectedProviderId); + if (nextProviderId !== provider) { + onSelectProvider?.(nextProviderId); } onSelectModel?.(modelId); }, diff --git a/packages/app/src/components/sidebar-workspace-list.tsx b/packages/app/src/components/sidebar-workspace-list.tsx index 3595d2d16..7d806f661 100644 --- a/packages/app/src/components/sidebar-workspace-list.tsx +++ b/packages/app/src/components/sidebar-workspace-list.tsx @@ -1261,9 +1261,9 @@ function WorkspaceRowWithMenu({ if (!confirmed) { return; } - let workspaceDirectory: string; + let archiveDirectory: string; try { - workspaceDirectory = requireWorkspaceExecutionDirectory({ + archiveDirectory = requireWorkspaceExecutionDirectory({ workspaceId: workspace.workspaceId, workspaceDirectory: workspace.workspaceDirectory, }); @@ -1272,7 +1272,7 @@ function WorkspaceRowWithMenu({ return; } - if (!workspaceDirectory) { + if (!archiveDirectory) { toast.error("Workspace path not available"); return; } @@ -1281,8 +1281,8 @@ function WorkspaceRowWithMenu({ void archiveWorktree({ serverId: workspace.serverId, - cwd: workspaceDirectory, - worktreePath: workspaceDirectory, + cwd: archiveDirectory, + worktreePath: archiveDirectory, }).catch((error) => { const message = error instanceof Error ? error.message : "Failed to archive worktree"; toast.error(message); @@ -1348,9 +1348,9 @@ function WorkspaceRowWithMenu({ ]); const handleCopyPath = useCallback(() => { - let workspaceDirectory: string; + let copyTargetDirectory: string; try { - workspaceDirectory = requireWorkspaceExecutionDirectory({ + copyTargetDirectory = requireWorkspaceExecutionDirectory({ workspaceId: workspace.workspaceId, workspaceDirectory: workspace.workspaceDirectory, }); @@ -1358,7 +1358,7 @@ function WorkspaceRowWithMenu({ toast.error(error instanceof Error ? error.message : "Workspace path not available"); return; } - void Clipboard.setStringAsync(workspaceDirectory); + void Clipboard.setStringAsync(copyTargetDirectory); toast.copied("Path copied"); }, [toast, workspace.workspaceDirectory, workspace.workspaceId]); diff --git a/packages/app/src/components/terminal-pane.tsx b/packages/app/src/components/terminal-pane.tsx index f8da457a9..b2fab9d88 100644 --- a/packages/app/src/components/terminal-pane.tsx +++ b/packages/app/src/components/terminal-pane.tsx @@ -317,15 +317,15 @@ export function TerminalPane({ const controller = new TerminalStreamController({ client, getPreferredSize: () => lastReportedSizeRef.current, - onOutput: ({ terminalId, text }) => { - if (!isWorkspaceFocused || terminalIdRef.current !== terminalId) { + onOutput: ({ terminalId: outputTerminalId, text }) => { + if (!isWorkspaceFocused || terminalIdRef.current !== outputTerminalId) { return; } emulatorRef.current?.writeOutput(text); }, - onSnapshot: ({ terminalId, state }) => { - workspaceTerminalSession.snapshots.set({ terminalId, state }); - if (!isWorkspaceFocused || terminalIdRef.current !== terminalId) { + onSnapshot: ({ terminalId: snapshotTerminalId, state }) => { + workspaceTerminalSession.snapshots.set({ terminalId: snapshotTerminalId, state }); + if (!isWorkspaceFocused || terminalIdRef.current !== snapshotTerminalId) { return; } emulatorRef.current?.renderSnapshot(state); diff --git a/packages/app/src/components/workspace-setup-dialog.tsx b/packages/app/src/components/workspace-setup-dialog.tsx index d0c9fc3df..5e8fdcf2d 100644 --- a/packages/app/src/components/workspace-setup-dialog.tsx +++ b/packages/app/src/components/workspace-setup-dialog.tsx @@ -176,7 +176,7 @@ export function WorkspaceSetupDialog() { try { setPendingAction("chat"); setErrorMessage(null); - const workspace = await ensureWorkspace({ cwd, attachments }); + const ensuredWorkspace = await ensureWorkspace({ cwd, attachments }); const connectedClient = withConnectedClient(); if (!composerState) { throw new Error("Workspace setup composer state is required"); @@ -188,12 +188,12 @@ export function WorkspaceSetupDialog() { const wirePayload = splitComposerAttachmentsForSubmit(attachments); const encodedImages = await encodeImages(wirePayload.images); const workspaceDirectory = requireWorkspaceExecutionAuthority({ - workspace, + workspace: ensuredWorkspace, }).workspaceDirectory; const agent = await connectedClient.createAgent({ provider: composerState.selectedProvider, cwd: workspaceDirectory, - workspaceId: workspace.id, + workspaceId: ensuredWorkspace.id, ...(composerState.modeOptions.length > 0 && composerState.selectedMode !== "" ? { modeId: composerState.selectedMode } : {}), @@ -215,7 +215,7 @@ export function WorkspaceSetupDialog() { next.set(agent.id, normalizeAgentSnapshot(agent, serverId)); return next; }); - navigateAfterCreation(workspace.id, { kind: "agent", agentId: agent.id }); + navigateAfterCreation(ensuredWorkspace.id, { kind: "agent", agentId: agent.id }); } catch (error) { const message = toErrorMessage(error); setErrorMessage(message); diff --git a/packages/app/src/contexts/session-context.tsx b/packages/app/src/contexts/session-context.tsx index f7f4e16e9..a22ff9811 100644 --- a/packages/app/src/contexts/session-context.tsx +++ b/packages/app/src/contexts/session-context.tsx @@ -588,12 +588,12 @@ function SessionProviderInternal({ children, serverId, client }: SessionProvider }) => { const appState = appStateRef.current; const session = useSessionStore.getState().sessions[serverId]; - const focusedAgentId = session?.focusedAgentId ?? null; + const attentionFocusedAgentId = session?.focusedAgentId ?? null; if (params.reason === "error") { return; } const isActivelyVisible = getIsAppActivelyVisible(appState); - const isAwayFromAgent = !isActivelyVisible || focusedAgentId !== params.agentId; + const isAwayFromAgent = !isActivelyVisible || attentionFocusedAgentId !== params.agentId; if (!isAwayFromAgent) { return; } diff --git a/packages/app/src/hooks/use-is-local-daemon.ts b/packages/app/src/hooks/use-is-local-daemon.ts index 76601739a..4e47c71bf 100644 --- a/packages/app/src/hooks/use-is-local-daemon.ts +++ b/packages/app/src/hooks/use-is-local-daemon.ts @@ -24,7 +24,7 @@ export function useLocalDaemonServerId(): string | null { enabled: isDesktopApp, staleTime: Infinity, gcTime: Infinity, - refetchInterval: (query) => (query.state.data?.serverId ? false : 1000), + refetchInterval: (activeQuery) => (activeQuery.state.data?.serverId ? false : 1000), refetchOnMount: false, refetchOnReconnect: false, refetchOnWindowFocus: false, diff --git a/packages/app/src/panels/setup-panel.tsx b/packages/app/src/panels/setup-panel.tsx index c62652ce7..e8e3a2a4b 100644 --- a/packages/app/src/panels/setup-panel.tsx +++ b/packages/app/src/panels/setup-panel.tsx @@ -154,9 +154,9 @@ function SetupPanel() { next.add(index); // If the user re-expands, remove from manually collapsed setManuallyCollapsed((mc) => { - const next = new Set(mc); - next.delete(index); - return next; + const updated = new Set(mc); + updated.delete(index); + return updated; }); } return next; diff --git a/packages/app/src/screens/new-workspace-screen.tsx b/packages/app/src/screens/new-workspace-screen.tsx index f22418d21..bce285305 100644 --- a/packages/app/src/screens/new-workspace-screen.tsx +++ b/packages/app/src/screens/new-workspace-screen.tsx @@ -354,9 +354,9 @@ export function NewWorkspaceScreen({ } const { attachments: reviewAttachments } = splitComposerAttachmentsForSubmit(attachments); - const workspace = await ensureWorkspace({ cwd, attachments: reviewAttachments }); + const ensuredWorkspace = await ensureWorkspace({ cwd, attachments: reviewAttachments }); const draftId = generateDraftId(); - const workspaceDirectory = workspace.workspaceDirectory; + const workspaceDirectory = ensuredWorkspace.workspaceDirectory; useDraftStore.getState().saveDraftInput({ draftKey: buildDraftStoreKey({ serverId, @@ -371,7 +371,7 @@ export function NewWorkspaceScreen({ }); useWorkspaceDraftSubmissionStore.getState().setPending({ serverId, - workspaceId: workspace.id, + workspaceId: ensuredWorkspace.id, draftId, text, attachments, @@ -389,7 +389,7 @@ export function NewWorkspaceScreen({ }); navigateToPreparedWorkspaceTab({ serverId, - workspaceId: workspace.id, + workspaceId: ensuredWorkspace.id, target: { kind: "draft", draftId }, navigationMethod: "replace", }); diff --git a/packages/app/src/screens/workspace/workspace-desktop-tabs-row.tsx b/packages/app/src/screens/workspace/workspace-desktop-tabs-row.tsx index 440b312be..05daed306 100644 --- a/packages/app/src/screens/workspace/workspace-desktop-tabs-row.tsx +++ b/packages/app/src/screens/workspace/workspace-desktop-tabs-row.tsx @@ -324,12 +324,12 @@ function TabChip({ onPress={handleCloseButtonPress} style={closeButtonStyle} > - {({ hovered, pressed }) => + {({ hovered: closeHovered, pressed }) => isClosingTab ? (