From 3d07c2a28ab84d7aaa1b75f2d338250b47ef93c9 Mon Sep 17 00:00:00 2001 From: Jinwoo Hong <73622457+Jinwoo-H@users.noreply.github.com> Date: Wed, 13 May 2026 23:10:53 -0400 Subject: [PATCH] Add floating terminal orchestration setup (#1763) Co-authored-by: Orca --- .../FloatingTerminalOrchestrationDialog.tsx | 211 ++++++++++++++++++ .../FloatingTerminalPanel.tsx | 132 +++++++---- .../FloatingTerminalToggleButton.tsx | 42 ++++ .../components/settings/ExperimentalPane.tsx | 115 ++-------- .../components/settings/OrchestrationPane.tsx | 147 ++++++++++++ .../src/components/settings/Settings.tsx | 36 ++- .../settings/experimental-search.ts | 22 +- .../settings/orchestration-search.ts | 21 ++ .../use-terminal-pane-global-effects.ts | 25 ++- src/renderer/src/constants/terminal.ts | 6 + .../src/lib/orchestration-install-command.ts | 2 + .../src/lib/orchestration-setup-state.ts | 21 ++ 12 files changed, 620 insertions(+), 160 deletions(-) create mode 100644 src/renderer/src/components/floating-terminal/FloatingTerminalOrchestrationDialog.tsx create mode 100644 src/renderer/src/components/floating-terminal/FloatingTerminalToggleButton.tsx create mode 100644 src/renderer/src/components/settings/OrchestrationPane.tsx create mode 100644 src/renderer/src/components/settings/orchestration-search.ts create mode 100644 src/renderer/src/lib/orchestration-install-command.ts create mode 100644 src/renderer/src/lib/orchestration-setup-state.ts diff --git a/src/renderer/src/components/floating-terminal/FloatingTerminalOrchestrationDialog.tsx b/src/renderer/src/components/floating-terminal/FloatingTerminalOrchestrationDialog.tsx new file mode 100644 index 000000000..615155ead --- /dev/null +++ b/src/renderer/src/components/floating-terminal/FloatingTerminalOrchestrationDialog.tsx @@ -0,0 +1,211 @@ +import { useCallback, useEffect, useState } from 'react' +import { Check, Clipboard, Copy, Loader2 } from 'lucide-react' +import { toast } from 'sonner' +import { Button } from '@/components/ui/button' +import { + Dialog, + DialogContent, + DialogDescription, + DialogHeader, + DialogTitle +} from '@/components/ui/dialog' +import { PASTE_TERMINAL_TEXT_EVENT } from '@/constants/terminal' +import { ORCHESTRATION_SKILL_INSTALL_COMMAND } from '@/lib/orchestration-install-command' +import { notifyOrchestrationSetupStateChanged } from '@/lib/orchestration-setup-state' +import type { CliInstallStatus } from '../../../../shared/cli-install-types' + +type FloatingTerminalOrchestrationDialogProps = { + open: boolean + activeTabId: string | null + onOpenChange: (open: boolean) => void + onSetupStateChange: () => void +} + +export function FloatingTerminalOrchestrationDialog({ + open, + activeTabId, + onOpenChange, + onSetupStateChange +}: FloatingTerminalOrchestrationDialogProps): React.JSX.Element { + const [cliStatus, setCliStatus] = useState(null) + const [cliLoading, setCliLoading] = useState(false) + const [cliBusy, setCliBusy] = useState(false) + const [skillBusy, setSkillBusy] = useState(false) + + const refreshCliStatus = useCallback(async (): Promise => { + setCliLoading(true) + try { + setCliStatus(await window.api.cli.getInstallStatus()) + } catch (error) { + toast.error(error instanceof Error ? error.message : 'Failed to load CLI status.') + } finally { + setCliLoading(false) + } + }, []) + + useEffect(() => { + if (open) { + void refreshCliStatus() + } + }, [open, refreshCliStatus]) + + const cliInstalled = cliStatus?.state === 'installed' + const cliSupported = cliStatus?.supported ?? false + const cliLabel = cliInstalled + ? 'orca is already on PATH' + : cliLoading + ? 'Checking CLI status...' + : (cliStatus?.detail ?? 'Register orca so agents can call Orca from a terminal.') + + const handleInstallCli = async (): Promise => { + setCliBusy(true) + try { + const next = await window.api.cli.install() + setCliStatus(next) + notifyOrchestrationSetupStateChanged() + onSetupStateChange() + toast.success('Registered `orca` in PATH.') + } catch (error) { + toast.error(error instanceof Error ? error.message : 'Failed to register `orca` in PATH.') + } finally { + setCliBusy(false) + } + } + + const handlePasteSkillCommand = async (): Promise => { + setSkillBusy(true) + try { + localStorage.setItem('orca.orchestration.enabled', '1') + localStorage.removeItem('orca.orchestration.setupDismissed') + notifyOrchestrationSetupStateChanged() + await window.api.ui.writeClipboardText(ORCHESTRATION_SKILL_INSTALL_COMMAND) + if (activeTabId) { + window.dispatchEvent( + new CustomEvent(PASTE_TERMINAL_TEXT_EVENT, { + detail: { + tabId: activeTabId, + text: ORCHESTRATION_SKILL_INSTALL_COMMAND + } + }) + ) + toast.success('Pasted the skill install command. Press Enter to run it.') + } else { + toast.success('Copied the skill install command.') + } + onSetupStateChange() + if (cliInstalled) { + onOpenChange(false) + } + } catch (error) { + toast.error(error instanceof Error ? error.message : 'Failed to copy skill command.') + } finally { + setSkillBusy(false) + } + } + + const handleCopySkillCommand = async (): Promise => { + try { + await window.api.ui.writeClipboardText(ORCHESTRATION_SKILL_INSTALL_COMMAND) + toast.success('Copied the skill install command.') + } catch (error) { + toast.error(error instanceof Error ? error.message : 'Failed to copy skill command.') + } + } + + return ( + + + + Enable orchestration + + Add the Orca CLI, then install the agent skill in this terminal. + + + +
+
+
+
+

Orca CLI

+

+ {cliLabel} + {cliInstalled && cliStatus?.commandPath ? ( + + {cliStatus.commandPath} + + ) : null} +

+
+
+ {cliInstalled ? ( + + ) : ( + + )} +
+
+
+ +
+
+
+
+

Orchestration skill

+

+ Paste this command into the terminal so agents learn orchestration. +

+
+ +
+
+ + {ORCHESTRATION_SKILL_INSTALL_COMMAND} + + +
+
+
+
+
+
+ ) +} diff --git a/src/renderer/src/components/floating-terminal/FloatingTerminalPanel.tsx b/src/renderer/src/components/floating-terminal/FloatingTerminalPanel.tsx index fd60ea0d4..6cde9a008 100644 --- a/src/renderer/src/components/floating-terminal/FloatingTerminalPanel.tsx +++ b/src/renderer/src/components/floating-terminal/FloatingTerminalPanel.tsx @@ -1,21 +1,28 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react' -import { Maximize2, Minimize2, Minus, TerminalSquare } from 'lucide-react' +import { Maximize2, Minimize2, Minus } from 'lucide-react' import TabBar from '@/components/tab-bar/TabBar' import TerminalPane from '@/components/terminal-pane/TerminalPane' import { Button } from '@/components/ui/button' import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip' import { focusTerminalTabSurface } from '@/lib/focus-terminal-tab-surface' +import { + ORCHESTRATION_SETUP_STATE_EVENT, + hasOrchestrationSetupMarker, + isOrchestrationSetupDismissed, + notifyOrchestrationSetupStateChanged +} from '@/lib/orchestration-setup-state' import { useAppStore } from '@/store' import { FLOATING_TERMINAL_WORKTREE_ID } from '../../../../shared/constants' import type { TerminalTab } from '../../../../shared/types' +import { FloatingTerminalOrchestrationDialog } from './FloatingTerminalOrchestrationDialog' import { FloatingTerminalResizeHandles } from './FloatingTerminalResizeHandles' +export { FloatingTerminalToggleButton } from './FloatingTerminalToggleButton' import { clampFloatingTerminalBounds, getDefaultFloatingTerminalBounds, getMaximizedFloatingTerminalBounds, type FloatingTerminalPanelBounds } from './floating-terminal-panel-bounds' -import { FloatingTerminalIconContextMenu } from './FloatingTerminalIconContextMenu' const EMPTY_TERMINAL_TABS: TerminalTab[] = [] type FloatingTerminalPanelProps = { @@ -23,43 +30,6 @@ type FloatingTerminalPanelProps = { onOpenChange: (open: boolean) => void } -export function FloatingTerminalToggleButton({ - open, - onToggle -}: { - open: boolean - onToggle: () => void -}): React.JSX.Element { - const shortcutLabel = - typeof navigator !== 'undefined' && navigator.userAgent.includes('Mac') ? '⌘⌥T' : 'Ctrl+Alt+T' - return ( - - - - - - {`${open ? 'Minimize' : 'Show'} floating terminal (${shortcutLabel})`} - - - ) -} - export function FloatingTerminalPanel({ open, onOpenChange @@ -80,6 +50,10 @@ export function FloatingTerminalPanel({ const [cwd, setCwd] = useState(null) const [bounds, setBounds] = useState(() => getDefaultFloatingTerminalBounds()) const [maximized, setMaximized] = useState(false) + const [orchestrationDialogOpen, setOrchestrationDialogOpen] = useState(false) + const [showOrchestrationSetup, setShowOrchestrationSetup] = useState( + () => !hasOrchestrationSetupMarker() && !isOrchestrationSetupDismissed() + ) const restoreBoundsRef = useRef(null) const normalizedInitialBoundsRef = useRef(false) const panelRef = useRef(null) @@ -134,6 +108,39 @@ export function FloatingTerminalPanel({ focusTerminalTabSurface(activeFloatingTabId) }, [activeFloatingTabId, open]) + const refreshOrchestrationSetupVisibility = useCallback(async (): Promise => { + if (isOrchestrationSetupDismissed()) { + setShowOrchestrationSetup(false) + return + } + if (!hasOrchestrationSetupMarker()) { + setShowOrchestrationSetup(true) + return + } + try { + const status = await window.api.cli.getInstallStatus() + setShowOrchestrationSetup(status.state !== 'installed') + } catch { + setShowOrchestrationSetup(true) + } + }, []) + + useEffect(() => { + if (open) { + void refreshOrchestrationSetupVisibility() + } + }, [open, refreshOrchestrationSetupVisibility]) + + useEffect(() => { + const handleSetupStateChange = (): void => { + void refreshOrchestrationSetupVisibility() + } + window.addEventListener(ORCHESTRATION_SETUP_STATE_EVENT, handleSetupStateChange) + return () => { + window.removeEventListener(ORCHESTRATION_SETUP_STATE_EVENT, handleSetupStateChange) + } + }, [refreshOrchestrationSetupVisibility]) + const createFloatingTab = useCallback(() => { const tab = createTab(FLOATING_TERMINAL_WORKTREE_ID, undefined, undefined, { activate: false }) setActiveTabForWorktree(FLOATING_TERMINAL_WORKTREE_ID, tab.id) @@ -242,6 +249,12 @@ export function FloatingTerminalPanel({ } } + const dismissOrchestrationSetup = useCallback(() => { + localStorage.setItem('orca.orchestration.setupDismissed', '1') + setShowOrchestrationSetup(false) + notifyOrchestrationSetupStateChanged() + }, []) + return (
+ {showOrchestrationSetup ? ( +
+
+
+

Enable orchestration

+

+ Set up the Orca CLI and agent skill so agents can coordinate through Orca. +

+
+
+ + +
+
+
+ ) : null} {!maximized && } + void refreshOrchestrationSetupVisibility()} + /> ) } diff --git a/src/renderer/src/components/floating-terminal/FloatingTerminalToggleButton.tsx b/src/renderer/src/components/floating-terminal/FloatingTerminalToggleButton.tsx new file mode 100644 index 000000000..314f00efb --- /dev/null +++ b/src/renderer/src/components/floating-terminal/FloatingTerminalToggleButton.tsx @@ -0,0 +1,42 @@ +import { TerminalSquare } from 'lucide-react' +import { Button } from '@/components/ui/button' +import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip' +import { FloatingTerminalIconContextMenu } from './FloatingTerminalIconContextMenu' + +export function FloatingTerminalToggleButton({ + open, + onToggle +}: { + open: boolean + onToggle: () => void +}): React.JSX.Element { + const shortcutLabel = + typeof navigator !== 'undefined' && navigator.userAgent.includes('Mac') ? '⌘⌥T' : 'Ctrl+Alt+T' + return ( + + + + + + {`${open ? 'Minimize' : 'Show'} floating terminal (${shortcutLabel})`} + + + ) +} diff --git a/src/renderer/src/components/settings/ExperimentalPane.tsx b/src/renderer/src/components/settings/ExperimentalPane.tsx index 2344a0e1c..a8cb0a578 100644 --- a/src/renderer/src/components/settings/ExperimentalPane.tsx +++ b/src/renderer/src/components/settings/ExperimentalPane.tsx @@ -1,10 +1,5 @@ -import { useState } from 'react' -import { Copy } from 'lucide-react' -import { toast } from 'sonner' import type { GlobalSettings } from '../../../../shared/types' -import { Button } from '../ui/button' import { Label } from '../ui/label' -import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../ui/tooltip' import { useAppStore } from '../../store' import { SearchableSetting } from './SearchableSetting' import { matchesSettingsSearch } from './settings-search' @@ -13,9 +8,6 @@ import { HiddenExperimentalGroup } from './HiddenExperimentalGroup' export { EXPERIMENTAL_PANE_SEARCH_ENTRIES } -const ORCHESTRATION_SKILL_INSTALL_COMMAND = - 'npx skills add https://github.com/stablyai/orca --skill orchestration' - type ExperimentalPaneProps = { settings: GlobalSettings updateSettings: (updates: Partial) => void @@ -31,40 +23,11 @@ export function ExperimentalPane({ }: ExperimentalPaneProps): React.JSX.Element { const searchQuery = useAppStore((s) => s.settingsSearchQuery) const showPet = matchesSettingsSearch(searchQuery, [EXPERIMENTAL_SEARCH_ENTRY.pet]) - const showOrchestration = matchesSettingsSearch(searchQuery, [ - EXPERIMENTAL_SEARCH_ENTRY.orchestration - ]) + const showActivity = matchesSettingsSearch(searchQuery, [EXPERIMENTAL_SEARCH_ENTRY.activity]) const showWorktreeSymlinks = matchesSettingsSearch(searchQuery, [ EXPERIMENTAL_SEARCH_ENTRY.symlinks ]) - const [orchestrationEnabled, setOrchestrationEnabled] = useState(() => { - return localStorage.getItem('orca.orchestration.enabled') === '1' - }) - - const [orchestrationSkillInstalled, setOrchestrationSkillInstalled] = useState(() => { - return localStorage.getItem('orca.orchestration.skillInstalled') === '1' - }) - - const toggleOrchestration = (value: boolean): void => { - setOrchestrationEnabled(value) - localStorage.setItem('orca.orchestration.enabled', value ? '1' : '0') - } - - const markOrchestrationSkillInstalled = (value: boolean): void => { - setOrchestrationSkillInstalled(value) - localStorage.setItem('orca.orchestration.skillInstalled', value ? '1' : '0') - } - - const handleCopyOrchestrationCommand = async (): Promise => { - try { - await window.api.ui.writeClipboardText(ORCHESTRATION_SKILL_INSTALL_COMMAND) - toast.success('Copied install command. Run it in your agent project.') - } catch (error) { - toast.error(error instanceof Error ? error.message : 'Failed to copy command.') - } - } - return (
{showPet ? ( @@ -106,84 +69,42 @@ export function ExperimentalPane({ ) : null} - {showOrchestration ? ( + {showActivity ? (
- +

- Coordinate multiple coding agents with messaging, task DAGs, dispatch with preamble - injection, decision gates, and coordinator loops. Experimental — APIs may change. + Adds an Activity entry under Tasks with a threaded worktree feed for completed + agents, blocking questions, unread state, and worktree creation events. Experimental + — the event model and UI may change.

- - {orchestrationEnabled ? ( -
-
-

Install Orchestration Skill

-

- Run this in your agent project so agents learn to use inter-agent orchestration - commands. -

-
-
- - {ORCHESTRATION_SKILL_INSTALL_COMMAND} - - - - - - - - Copy - - - -
-
- - {orchestrationSkillInstalled - ? 'Marked as installed on this machine.' - : "Check off once you've run it in your project."} - - -
-
- ) : null}
) : null} diff --git a/src/renderer/src/components/settings/OrchestrationPane.tsx b/src/renderer/src/components/settings/OrchestrationPane.tsx new file mode 100644 index 000000000..a69210531 --- /dev/null +++ b/src/renderer/src/components/settings/OrchestrationPane.tsx @@ -0,0 +1,147 @@ +import { useEffect, useState } from 'react' +import { Copy } from 'lucide-react' +import { toast } from 'sonner' +import { Button } from '../ui/button' +import { Label } from '../ui/label' +import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../ui/tooltip' +import { ORCHESTRATION_SKILL_INSTALL_COMMAND } from '@/lib/orchestration-install-command' +import { + ORCHESTRATION_SETUP_STATE_EVENT, + isOrchestrationSetupEnabled, + isOrchestrationSkillMarkedInstalled, + notifyOrchestrationSetupStateChanged +} from '@/lib/orchestration-setup-state' +import { SearchableSetting } from './SearchableSetting' +import { matchesSettingsSearch } from './settings-search' +import { useAppStore } from '../../store' +import { ORCHESTRATION_PANE_SEARCH_ENTRIES } from './orchestration-search' + +export function OrchestrationPane(): React.JSX.Element { + const searchQuery = useAppStore((s) => s.settingsSearchQuery) + const showOrchestration = matchesSettingsSearch(searchQuery, ORCHESTRATION_PANE_SEARCH_ENTRIES) + + const [orchestrationEnabled, setOrchestrationEnabled] = useState(() => { + return isOrchestrationSetupEnabled() + }) + + const [orchestrationSkillInstalled, setOrchestrationSkillInstalled] = useState(() => { + return isOrchestrationSkillMarkedInstalled() + }) + + useEffect(() => { + const syncSetupState = (): void => { + setOrchestrationEnabled(isOrchestrationSetupEnabled()) + setOrchestrationSkillInstalled(isOrchestrationSkillMarkedInstalled()) + } + window.addEventListener(ORCHESTRATION_SETUP_STATE_EVENT, syncSetupState) + return () => { + window.removeEventListener(ORCHESTRATION_SETUP_STATE_EVENT, syncSetupState) + } + }, []) + + const toggleOrchestration = (value: boolean): void => { + setOrchestrationEnabled(value) + localStorage.setItem('orca.orchestration.enabled', value ? '1' : '0') + notifyOrchestrationSetupStateChanged() + } + + const markOrchestrationSkillInstalled = (value: boolean): void => { + setOrchestrationSkillInstalled(value) + localStorage.setItem('orca.orchestration.skillInstalled', value ? '1' : '0') + notifyOrchestrationSetupStateChanged() + } + + const handleCopyOrchestrationCommand = async (): Promise => { + try { + await window.api.ui.writeClipboardText(ORCHESTRATION_SKILL_INSTALL_COMMAND) + toast.success('Copied install command. Run it in your agent project.') + } catch (error) { + toast.error(error instanceof Error ? error.message : 'Failed to copy command.') + } + } + + if (!showOrchestration) { + return
+ } + + return ( + +
+
+ +

+ Coordinate multiple coding agents with messaging, task DAGs, dispatch with preamble + injection, decision gates, and coordinator loops. +

+
+ +
+ + {orchestrationEnabled ? ( +
+
+

Install Orchestration Skill

+

+ Run this in your agent project so agents learn to use inter-agent orchestration + commands. +

+
+
+ + {ORCHESTRATION_SKILL_INSTALL_COMMAND} + + + + + + + + Copy + + + +
+
+ + {orchestrationSkillInstalled + ? 'Marked as installed on this machine.' + : "Check off once you've run it in your project."} + + +
+
+ ) : null} +
+ ) +} diff --git a/src/renderer/src/components/settings/Settings.tsx b/src/renderer/src/components/settings/Settings.tsx index 3310fedc6..cc7234c91 100644 --- a/src/renderer/src/components/settings/Settings.tsx +++ b/src/renderer/src/components/settings/Settings.tsx @@ -11,6 +11,7 @@ import { Keyboard, Lock, MousePointerClick, + Network, ShieldCheck, Palette, Server, @@ -44,6 +45,8 @@ import { NotificationsPane, NOTIFICATIONS_PANE_SEARCH_ENTRIES } from './Notifica import { SshPane, SSH_PANE_SEARCH_ENTRIES } from './SshPane' import { ExperimentalPane, EXPERIMENTAL_PANE_SEARCH_ENTRIES } from './ExperimentalPane' import { AgentsPane, AGENTS_PANE_SEARCH_ENTRIES } from './AgentsPane' +import { OrchestrationPane } from './OrchestrationPane' +import { ORCHESTRATION_PANE_SEARCH_ENTRIES } from './orchestration-search' import { AccountsPane, ACCOUNTS_PANE_SEARCH_ENTRIES } from './AccountsPane' import { StatsPane, STATS_PANE_SEARCH_ENTRIES } from '../stats/StatsPane' import { IntegrationsPane, INTEGRATIONS_PANE_SEARCH_ENTRIES } from './IntegrationsPane' @@ -76,6 +79,7 @@ type SettingsNavTarget = | 'ssh' | 'experimental' | 'agents' + | 'orchestration' | 'mobile' | 'repo' @@ -116,18 +120,14 @@ function computerUsePlatformLabel(args: { isWindows: boolean; isMac: boolean }): const SECTION_FLASH_CLASS = 'settings-section-flash' const SECTION_FLASH_DURATION_MS = 900 -function scrollSectionIntoView(sectionId: string, container: HTMLElement | null): void { +function scrollSectionIntoView(sectionId: string): void { const target = document.getElementById(sectionId) if (!target) { return } - // Why: centering a tall section pushes its heading above the viewport, - // which defeats the purpose of jumping to it. Only center when the whole - // section fits; otherwise align to the top so the title is always visible. - const fitsInViewport = container - ? target.getBoundingClientRect().height <= container.clientHeight - : true - target.scrollIntoView({ block: fitsInViewport ? 'center' : 'start' }) + // Why: the scroll spy samples from the upper part of the viewport. Top-align + // sidebar jumps so it does not immediately reselect the previous section. + target.scrollIntoView({ block: 'start' }) } function flashSectionHighlight(sectionId: string): void { @@ -433,6 +433,13 @@ function Settings(): React.JSX.Element { icon: Bell, searchEntries: NOTIFICATIONS_PANE_SEARCH_ENTRIES }, + { + id: 'orchestration', + title: 'Orchestration', + description: 'Coordinate multiple coding agents through Orca.', + icon: Network, + searchEntries: ORCHESTRATION_PANE_SEARCH_ENTRIES + }, { id: 'mobile', title: 'Mobile', @@ -527,7 +534,7 @@ function Settings(): React.JSX.Element { const visibleIds = new Set(visibleNavSections.map((section) => section.id)) if (scrollTargetId && pendingNavSectionId && visibleIds.has(pendingNavSectionId)) { - scrollSectionIntoView(scrollTargetId, contentScrollRef.current) + scrollSectionIntoView(scrollTargetId) flashSectionHighlight(scrollTargetId) setActiveSectionId(pendingNavSectionId) pendingNavSectionRef.current = null @@ -632,7 +639,7 @@ function Settings(): React.JSX.Element { if (sectionId === 'experimental' && modifiers?.shiftKey) { setHiddenExperimentalUnlocked((previous) => !previous) } - scrollSectionIntoView(sectionId, contentScrollRef.current) + scrollSectionIntoView(sectionId) flashSectionHighlight(sectionId) setActiveSectionId(sectionId) }, @@ -791,6 +798,15 @@ function Settings(): React.JSX.Element { + + + + window.removeEventListener(FOCUS_TERMINAL_PANE_EVENT, onFocusPane) }, [tabId, managerRef]) + useEffect(() => { + const onPasteText = (event: Event): void => { + const detail = (event as CustomEvent).detail + if (!detail?.tabId || detail.tabId !== tabId || !detail.text) { + return + } + const manager = managerRef.current + if (!manager) { + return + } + const pane = manager.getActivePane() ?? manager.getPanes()[0] + if (!pane) { + return + } + pane.terminal.paste(detail.text) + pane.terminal.focus() + } + window.addEventListener(PASTE_TERMINAL_TEXT_EVENT, onPasteText) + return () => window.removeEventListener(PASTE_TERMINAL_TEXT_EVENT, onPasteText) + }, [tabId, managerRef]) + // Why: sidebar open/close toggles dispatch SYNC_FIT_PANES_EVENT from a // useLayoutEffect (pre-paint, same frame as the width change) so the // terminal fits synchronously with the new container size, eliminating the diff --git a/src/renderer/src/constants/terminal.ts b/src/renderer/src/constants/terminal.ts index 98988e637..bdfa382d1 100644 --- a/src/renderer/src/constants/terminal.ts +++ b/src/renderer/src/constants/terminal.ts @@ -1,5 +1,6 @@ export const TOGGLE_TERMINAL_PANE_EXPAND_EVENT = 'orca-toggle-terminal-pane-expand' export const FOCUS_TERMINAL_PANE_EVENT = 'orca-focus-terminal-pane' +export const PASTE_TERMINAL_TEXT_EVENT = 'orca-paste-terminal-text' export const SPLIT_TERMINAL_PANE_EVENT = 'orca-split-terminal-pane' export const CLOSE_TERMINAL_PANE_EVENT = 'orca-close-terminal-pane' @@ -26,6 +27,11 @@ export type FocusTerminalPaneDetail = { paneId: number } +export type PasteTerminalTextDetail = { + tabId: string + text: string +} + export type SplitTerminalPaneDetail = { tabId: string paneRuntimeId: number diff --git a/src/renderer/src/lib/orchestration-install-command.ts b/src/renderer/src/lib/orchestration-install-command.ts new file mode 100644 index 000000000..2312e1684 --- /dev/null +++ b/src/renderer/src/lib/orchestration-install-command.ts @@ -0,0 +1,2 @@ +export const ORCHESTRATION_SKILL_INSTALL_COMMAND = + 'npx skills add https://github.com/stablyai/orca --skill orchestration' diff --git a/src/renderer/src/lib/orchestration-setup-state.ts b/src/renderer/src/lib/orchestration-setup-state.ts new file mode 100644 index 000000000..c7670f1ba --- /dev/null +++ b/src/renderer/src/lib/orchestration-setup-state.ts @@ -0,0 +1,21 @@ +export const ORCHESTRATION_SETUP_STATE_EVENT = 'orca:orchestration-setup-state' + +export function isOrchestrationSetupEnabled(): boolean { + return localStorage.getItem('orca.orchestration.enabled') === '1' +} + +export function isOrchestrationSkillMarkedInstalled(): boolean { + return localStorage.getItem('orca.orchestration.skillInstalled') === '1' +} + +export function hasOrchestrationSetupMarker(): boolean { + return isOrchestrationSetupEnabled() || isOrchestrationSkillMarkedInstalled() +} + +export function isOrchestrationSetupDismissed(): boolean { + return localStorage.getItem('orca.orchestration.setupDismissed') === '1' +} + +export function notifyOrchestrationSetupStateChanged(): void { + window.dispatchEvent(new CustomEvent(ORCHESTRATION_SETUP_STATE_EVENT)) +}