Add floating terminal orchestration setup (#1763)

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
Jinwoo Hong
2026-05-13 20:10:53 -07:00
committed by GitHub
co-authored by Orca
parent ffaaf9f51a
commit 3d07c2a28a
12 changed files with 620 additions and 160 deletions
@@ -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<CliInstallStatus | null>(null)
const [cliLoading, setCliLoading] = useState(false)
const [cliBusy, setCliBusy] = useState(false)
const [skillBusy, setSkillBusy] = useState(false)
const refreshCliStatus = useCallback(async (): Promise<void> => {
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<void> => {
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<void> => {
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<void> => {
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 (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="gap-4 sm:max-w-[620px]">
<DialogHeader>
<DialogTitle>Enable orchestration</DialogTitle>
<DialogDescription>
Add the Orca CLI, then install the agent skill in this terminal.
</DialogDescription>
</DialogHeader>
<div className="min-w-0 divide-y divide-border/60 overflow-hidden rounded-md border border-border/60 bg-muted/20">
<div className="min-w-0 px-3 py-3">
<div className="flex items-start justify-between gap-4">
<div className="min-w-0 space-y-1">
<p className="text-sm font-medium">Orca CLI</p>
<p className="flex min-w-0 items-center gap-2 text-xs text-muted-foreground">
<span className="shrink-0">{cliLabel}</span>
{cliInstalled && cliStatus?.commandPath ? (
<code className="min-w-0 overflow-x-auto whitespace-nowrap rounded bg-background px-2 py-0.5 text-[11px] text-muted-foreground">
{cliStatus.commandPath}
</code>
) : null}
</p>
</div>
<div className="shrink-0">
{cliInstalled ? (
<Button
variant="outline"
size="xs"
disabled
className="shrink-0 gap-1.5 disabled:opacity-100"
aria-label="Orca CLI added to PATH"
>
<Check className="size-3" />
Added
</Button>
) : (
<Button
variant="outline"
size="xs"
onClick={() => void handleInstallCli()}
disabled={cliLoading || cliBusy || !cliSupported}
className="shrink-0 gap-1.5"
>
{cliBusy ? <Loader2 className="size-3.5 animate-spin" /> : null}
Add to PATH
</Button>
)}
</div>
</div>
</div>
<div className="px-3 py-3">
<div className="space-y-2">
<div className="flex items-start justify-between gap-3">
<div className="min-w-0 space-y-1">
<p className="text-sm font-medium">Orchestration skill</p>
<p className="text-xs text-muted-foreground">
Paste this command into the terminal so agents learn orchestration.
</p>
</div>
<Button
variant="outline"
size="xs"
onClick={() => void handlePasteSkillCommand()}
disabled={skillBusy}
className="shrink-0 gap-1.5"
>
{skillBusy ? (
<Loader2 className="size-3.5 animate-spin" />
) : (
<Clipboard className="size-3.5" />
)}
{activeTabId ? 'Paste' : 'Copy'}
</Button>
</div>
<div className="flex min-w-0 items-center gap-2 rounded bg-background px-2 py-1.5">
<code className="min-w-0 flex-1 text-[11px] leading-relaxed break-all whitespace-normal text-muted-foreground">
{ORCHESTRATION_SKILL_INSTALL_COMMAND}
</code>
<Button
variant="ghost"
size="icon-xs"
className="shrink-0"
onClick={() => void handleCopySkillCommand()}
aria-label="Copy orchestration skill install command"
>
<Copy className="size-3.5" />
</Button>
</div>
</div>
</div>
</div>
</DialogContent>
</Dialog>
)
}
@@ -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 (
<FloatingTerminalIconContextMenu
currentLocation="floating-button"
className="fixed bottom-8 right-3 z-40"
>
<Tooltip>
<TooltipTrigger asChild>
<Button
type="button"
variant="outline"
size="icon-sm"
className="bg-card/95 shadow-xs"
aria-label={open ? 'Minimize floating terminal' : 'Show floating terminal'}
aria-pressed={open}
onClick={onToggle}
>
<TerminalSquare className="size-3.5" />
</Button>
</TooltipTrigger>
<TooltipContent
side="left"
sideOffset={6}
>{`${open ? 'Minimize' : 'Show'} floating terminal (${shortcutLabel})`}</TooltipContent>
</Tooltip>
</FloatingTerminalIconContextMenu>
)
}
export function FloatingTerminalPanel({
open,
onOpenChange
@@ -80,6 +50,10 @@ export function FloatingTerminalPanel({
const [cwd, setCwd] = useState<string | null>(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<FloatingTerminalPanelBounds | null>(null)
const normalizedInitialBoundsRef = useRef(false)
const panelRef = useRef<HTMLDivElement>(null)
@@ -134,6 +108,39 @@ export function FloatingTerminalPanel({
focusTerminalTabSurface(activeFloatingTabId)
}, [activeFloatingTabId, open])
const refreshOrchestrationSetupVisibility = useCallback(async (): Promise<void> => {
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 (
<div
ref={panelRef}
@@ -362,7 +375,48 @@ export function FloatingTerminalPanel({
: null}
</div>
</div>
{showOrchestrationSetup ? (
<div
className="absolute right-4 bottom-4 z-10 w-[280px] rounded-md border border-border/60 bg-card/95 p-3 text-card-foreground shadow-xs"
data-floating-terminal-no-drag
>
<div className="space-y-2">
<div className="space-y-0.5">
<p className="text-sm font-medium">Enable orchestration</p>
<p className="text-xs leading-5 text-muted-foreground">
Set up the Orca CLI and agent skill so agents can coordinate through Orca.
</p>
</div>
<div className="flex items-center gap-2">
<Button
type="button"
variant="ghost"
size="sm"
className="flex-1"
onClick={dismissOrchestrationSetup}
>
Dismiss
</Button>
<Button
type="button"
variant="default"
size="sm"
className="flex-1"
onClick={() => setOrchestrationDialogOpen(true)}
>
Enable
</Button>
</div>
</div>
</div>
) : null}
{!maximized && <FloatingTerminalResizeHandles bounds={bounds} setBounds={setBounds} />}
<FloatingTerminalOrchestrationDialog
open={orchestrationDialogOpen}
activeTabId={activeTab?.id ?? null}
onOpenChange={setOrchestrationDialogOpen}
onSetupStateChange={() => void refreshOrchestrationSetupVisibility()}
/>
</div>
)
}
@@ -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 (
<FloatingTerminalIconContextMenu
currentLocation="floating-button"
className="fixed bottom-8 right-3 z-40"
>
<Tooltip>
<TooltipTrigger asChild>
<Button
type="button"
variant="outline"
size="icon-sm"
className="bg-card/95 shadow-xs"
data-floating-terminal-toggle
aria-label={open ? 'Minimize floating terminal' : 'Show floating terminal'}
aria-pressed={open}
onClick={onToggle}
>
<TerminalSquare className="size-3.5" />
</Button>
</TooltipTrigger>
<TooltipContent
side="left"
sideOffset={6}
>{`${open ? 'Minimize' : 'Show'} floating terminal (${shortcutLabel})`}</TooltipContent>
</Tooltip>
</FloatingTerminalIconContextMenu>
)
}
@@ -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<GlobalSettings>) => 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<boolean>(() => {
return localStorage.getItem('orca.orchestration.enabled') === '1'
})
const [orchestrationSkillInstalled, setOrchestrationSkillInstalled] = useState<boolean>(() => {
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<void> => {
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 (
<div className="space-y-4">
{showPet ? (
@@ -106,84 +69,42 @@ export function ExperimentalPane({
</SearchableSetting>
) : null}
{showOrchestration ? (
{showActivity ? (
<SearchableSetting
title="Agent Orchestration"
description="Coordinate multiple coding agents via messaging, task DAGs, dispatch, and decision gates."
keywords={EXPERIMENTAL_SEARCH_ENTRY.orchestration.keywords}
title="Activity Page"
description="Slack-style worktree activity feed for agent completions and blocking states."
keywords={EXPERIMENTAL_SEARCH_ENTRY.activity.keywords}
className="space-y-3 px-1 py-2"
>
<div className="flex items-start justify-between gap-4">
<div className="min-w-0 shrink space-y-0.5">
<Label>Agent Orchestration</Label>
<Label>Activity Page</Label>
<p className="text-xs text-muted-foreground">
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.
</p>
</div>
<button
type="button"
role="switch"
aria-checked={orchestrationEnabled}
onClick={() => toggleOrchestration(!orchestrationEnabled)}
aria-checked={settings.experimentalActivity}
onClick={() =>
updateSettings({
experimentalActivity: !settings.experimentalActivity
})
}
className={`relative inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border border-transparent transition-colors ${
orchestrationEnabled ? 'bg-foreground' : 'bg-muted-foreground/30'
settings.experimentalActivity ? 'bg-foreground' : 'bg-muted-foreground/30'
}`}
>
<span
className={`inline-block h-3.5 w-3.5 transform rounded-full bg-background shadow-sm transition-transform ${
orchestrationEnabled ? 'translate-x-4' : 'translate-x-0.5'
settings.experimentalActivity ? 'translate-x-4' : 'translate-x-0.5'
}`}
/>
</button>
</div>
{orchestrationEnabled ? (
<div className="space-y-3 rounded-xl border border-border/60 bg-card/50 p-4">
<div className="space-y-1">
<p className="text-sm font-medium">Install Orchestration Skill</p>
<p className="text-xs text-muted-foreground">
Run this in your agent project so agents learn to use inter-agent orchestration
commands.
</p>
</div>
<div className="flex max-w-full items-center gap-2 rounded-lg border border-border/60 bg-background/60 px-3 py-2">
<code className="flex-1 overflow-x-auto whitespace-nowrap text-[11px] text-muted-foreground">
{ORCHESTRATION_SKILL_INSTALL_COMMAND}
</code>
<TooltipProvider delayDuration={250}>
<Tooltip>
<TooltipTrigger asChild>
<Button
variant="ghost"
size="icon-xs"
onClick={() => void handleCopyOrchestrationCommand()}
aria-label="Copy orchestration skill install command"
>
<Copy className="size-3.5" />
</Button>
</TooltipTrigger>
<TooltipContent side="bottom" sideOffset={6}>
Copy
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
<div className="flex items-center gap-2 text-[11px] text-muted-foreground">
<span>
{orchestrationSkillInstalled
? 'Marked as installed on this machine.'
: "Check off once you've run it in your project."}
</span>
<button
type="button"
className="underline-offset-2 hover:text-foreground hover:underline"
onClick={() => markOrchestrationSkillInstalled(!orchestrationSkillInstalled)}
>
{orchestrationSkillInstalled ? 'Undo' : 'I ran it'}
</button>
</div>
</div>
) : null}
</SearchableSetting>
) : null}
@@ -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<boolean>(() => {
return isOrchestrationSetupEnabled()
})
const [orchestrationSkillInstalled, setOrchestrationSkillInstalled] = useState<boolean>(() => {
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<void> => {
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 <div />
}
return (
<SearchableSetting
title="Agent Orchestration"
description="Coordinate multiple coding agents via messaging, task DAGs, dispatch, and decision gates."
keywords={ORCHESTRATION_PANE_SEARCH_ENTRIES[0].keywords}
className="space-y-3 px-1 py-2"
>
<div className="flex items-start justify-between gap-4">
<div className="min-w-0 shrink space-y-0.5">
<Label>Agent Orchestration</Label>
<p className="text-xs text-muted-foreground">
Coordinate multiple coding agents with messaging, task DAGs, dispatch with preamble
injection, decision gates, and coordinator loops.
</p>
</div>
<button
role="switch"
aria-checked={orchestrationEnabled}
onClick={() => toggleOrchestration(!orchestrationEnabled)}
className={`relative inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border border-transparent transition-colors ${
orchestrationEnabled ? 'bg-foreground' : 'bg-muted-foreground/30'
}`}
>
<span
className={`inline-block h-3.5 w-3.5 transform rounded-full bg-background shadow-sm transition-transform ${
orchestrationEnabled ? 'translate-x-4' : 'translate-x-0.5'
}`}
/>
</button>
</div>
{orchestrationEnabled ? (
<div className="space-y-3 rounded-xl border border-border/60 bg-card/50 p-4">
<div className="space-y-1">
<p className="text-sm font-medium">Install Orchestration Skill</p>
<p className="text-xs text-muted-foreground">
Run this in your agent project so agents learn to use inter-agent orchestration
commands.
</p>
</div>
<div className="flex max-w-full items-center gap-2 rounded-lg border border-border/60 bg-background/60 px-3 py-2">
<code className="flex-1 overflow-x-auto whitespace-nowrap text-[11px] text-muted-foreground">
{ORCHESTRATION_SKILL_INSTALL_COMMAND}
</code>
<TooltipProvider delayDuration={250}>
<Tooltip>
<TooltipTrigger asChild>
<Button
variant="ghost"
size="icon-xs"
onClick={() => void handleCopyOrchestrationCommand()}
aria-label="Copy orchestration skill install command"
>
<Copy className="size-3.5" />
</Button>
</TooltipTrigger>
<TooltipContent side="bottom" sideOffset={6}>
Copy
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
<div className="flex items-center gap-2 text-[11px] text-muted-foreground">
<span>
{orchestrationSkillInstalled
? 'Marked as installed on this machine.'
: "Check off once you've run it in your project."}
</span>
<button
type="button"
className="underline-offset-2 hover:text-foreground hover:underline"
onClick={() => markOrchestrationSkillInstalled(!orchestrationSkillInstalled)}
>
{orchestrationSkillInstalled ? 'Undo' : 'I ran it'}
</button>
</div>
</div>
) : null}
</SearchableSetting>
)
}
@@ -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 {
<NotificationsPane settings={settings} updateSettings={updateSettings} />
</SettingsSection>
<SettingsSection
id="orchestration"
title="Orchestration"
description="Coordinate multiple coding agents through Orca."
searchEntries={ORCHESTRATION_PANE_SEARCH_ENTRIES}
>
<OrchestrationPane />
</SettingsSection>
<SettingsSection
id="mobile"
title="Mobile"
@@ -16,21 +16,17 @@ export const EXPERIMENTAL_PANE_SEARCH_ENTRIES: SettingsSearchEntry[] = [
]
},
{
title: 'Agent Orchestration',
description:
'Coordinate multiple coding agents via messaging, task DAGs, dispatch, and decision gates.',
title: 'Activity Page',
description: 'Slack-style worktree activity feed for agent completions and blocking states.',
keywords: [
'experimental',
'orchestration',
'multi-agent',
'activity',
'notifications',
'agents',
'coordination',
'messaging',
'dispatch',
'task',
'DAG',
'worker',
'coordinator'
'worktrees',
'timeline',
'unread',
'bell'
]
},
{
@@ -65,6 +61,6 @@ function findEntry(title: string): SettingsSearchEntry {
export const EXPERIMENTAL_SEARCH_ENTRY = {
pet: findEntry('Pet'),
orchestration: findEntry('Agent Orchestration'),
activity: findEntry('Activity Page'),
symlinks: findEntry('Symlinks on worktrees')
} as const
@@ -0,0 +1,21 @@
import type { SettingsSearchEntry } from './settings-search'
export const ORCHESTRATION_PANE_SEARCH_ENTRIES: SettingsSearchEntry[] = [
{
title: 'Agent Orchestration',
description:
'Coordinate multiple coding agents via messaging, task DAGs, dispatch, and decision gates.',
keywords: [
'orchestration',
'multi-agent',
'agents',
'coordination',
'messaging',
'dispatch',
'task',
'DAG',
'worker',
'coordinator'
]
}
]
@@ -1,9 +1,11 @@
import { useEffect, useRef } from 'react'
import {
FOCUS_TERMINAL_PANE_EVENT,
PASTE_TERMINAL_TEXT_EVENT,
SYNC_FIT_PANES_EVENT,
TOGGLE_TERMINAL_PANE_EXPAND_EVENT,
type FocusTerminalPaneDetail
type FocusTerminalPaneDetail,
type PasteTerminalTextDetail
} from '@/constants/terminal'
import type { PaneManager } from '@/lib/pane-manager/pane-manager'
import { fitAndFocusPanes, fitPanes } from './pane-helpers'
@@ -129,6 +131,27 @@ export function useTerminalPaneGlobalEffects({
return () => window.removeEventListener(FOCUS_TERMINAL_PANE_EVENT, onFocusPane)
}, [tabId, managerRef])
useEffect(() => {
const onPasteText = (event: Event): void => {
const detail = (event as CustomEvent<PasteTerminalTextDetail | undefined>).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
+6
View File
@@ -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
@@ -0,0 +1,2 @@
export const ORCHESTRATION_SKILL_INSTALL_COMMAND =
'npx skills add https://github.com/stablyai/orca --skill orchestration'
@@ -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))
}