Files
orca/src/preload/api/dashboard-api.ts
T
Brennan Benson 8dda7de9aa feat(agent-map): open a workspace from the worktree ring popover
The agent map could start agents in a workspace but had no way to go to
it — the dashboard's "Open worktree" is agent-scoped and needs a tabId,
so a workspace-level route was missing.

Adds a workspace-level reveal: DashboardRevealWorktreeArgs carries the
worktree id plus executionHostId (ids collide across hosts), relayed over
dashboardPopout:revealWorktree with the same sender/args gate as the
other popout actions.

Both handlers route through activateAndRevealWorkspace rather than a raw
setActiveWorktree. The board spans every repo, so a cross-repo jump also
has to switch activeRepoId, reset activeView, reveal the sidebar row,
clear filters hiding it, and run the folder-workspace path gate — all of
which a bare setActiveWorktree drops. The shared dispatcher now takes an
optional executionHostId so it can serve host-qualified callers.

Extracts the popover into AgentMapWorktreeDetailsCard, and moves the
arrow-key direction map into agent-map-navigation next to
nextDirectionalAgent; both files were over the max-lines cap.
2026-08-14 17:18:44 -07:00

46 lines
2.1 KiB
TypeScript

import type {
DashboardRevealAgentArgs,
DashboardRevealWorktreeArgs,
DashboardSleepWorkspaceArgs,
DashboardSnapshot,
DashboardSpawnAgentArgs
} from '../../shared/dashboard-snapshot'
import type {
TerminalPreviewConnectResult,
TerminalPreviewDataPayload
} from '../../shared/terminal-preview'
export type DashboardApi = {
openPopout: (view?: 'board' | 'map') => Promise<void>
publishSnapshot: (snapshot: DashboardSnapshot) => Promise<void>
getPopoutOpen: () => Promise<boolean>
onPopoutOpenChanged: (callback: (open: boolean) => void) => () => void
onSnapshotRequested: (callback: () => void) => () => void
onRevealAgent: (callback: (args: DashboardRevealAgentArgs) => void) => () => void
onRevealWorktree: (callback: (args: DashboardRevealWorktreeArgs) => void) => () => void
onAckAgent: (callback: (paneKey: string) => void) => () => void
onSpawnAgent: (callback: (args: DashboardSpawnAgentArgs) => void) => () => void
onSleepWorkspace: (callback: (args: DashboardSleepWorkspaceArgs) => void) => () => void
requestSnapshot: () => Promise<void>
onSnapshot: (callback: (snapshot: DashboardSnapshot) => void) => () => void
onViewRequested: (callback: (view: 'board' | 'map') => void) => () => void
revealAgent: (args: DashboardRevealAgentArgs) => Promise<void>
revealWorktree: (args: DashboardRevealWorktreeArgs) => Promise<void>
ackAgent: (paneKey: string) => Promise<void>
spawnAgent: (args: DashboardSpawnAgentArgs) => Promise<void>
sleepWorkspace: (args: DashboardSleepWorkspaceArgs) => Promise<void>
}
export type TerminalPreviewApi = {
connect: (
ptyId: string,
opts?: { scrollbackRows?: number }
) => Promise<TerminalPreviewConnectResult>
input: (ptyId: string, data: string) => Promise<boolean>
/** Claim the PTY grid for the preview dialog; resolves to the size actually in effect. */
fit: (ptyId: string, cols: number, rows: number) => Promise<{ cols: number; rows: number } | null>
ack: (ptyId: string, bytes: number) => Promise<void>
unsubscribe: (ptyId: string) => Promise<void>
onData: (callback: (payload: TerminalPreviewDataPayload) => void) => () => void
}