{/* Match the open sidebar header’s alignment to prevent toggle jitter. */}
- {layout.workspaceChromeActive && !layout.rightSidebarOpen && (
+ {showsFloatingRightSidebarToggle(layout) && (
- {layout.showRightSidebarControls ? : null}
+
)}
diff --git a/src/renderer/src/app-shell/app-command-handlers.ts b/src/renderer/src/app-shell/app-command-handlers.ts
index 1ff366fd1a5..064e4bc6865 100644
--- a/src/renderer/src/app-shell/app-command-handlers.ts
+++ b/src/renderer/src/app-shell/app-command-handlers.ts
@@ -1,4 +1,4 @@
-import { canShowRightSidebarForView } from '@/lib/right-sidebar-visibility'
+import { canShowRightSidebarForView, canToggleRightSidebar } from '@/lib/right-sidebar-visibility'
import { runBuiltInOrReplacement } from '@/lib/plugin-command-replacements'
import { isFloatingWorkspacePanelFocused } from '@/lib/floating-workspace-terminal-actions'
import { hasVisibleOverlay } from '@/lib/visible-overlay'
@@ -270,7 +270,7 @@ export function createAppCommandHandlers(
[
'sidebar.right.toggle',
() =>
- canRevealRightSidebar
+ canToggleRightSidebar(activeView)
? claim('sidebar.right.toggle', () => actions.toggleRightSidebar())
: false
],
diff --git a/src/renderer/src/components/ClaudeAccountSwitchSessionTree.tsx b/src/renderer/src/components/ClaudeAccountSwitchSessionTree.tsx
index 8b712f06a6a..25ad85b58f6 100644
--- a/src/renderer/src/components/ClaudeAccountSwitchSessionTree.tsx
+++ b/src/renderer/src/components/ClaudeAccountSwitchSessionTree.tsx
@@ -16,12 +16,12 @@ import {
} from '@/lib/worktree-default-display-name'
import { makePaneKey } from '../../../shared/workspace-layout/stable-pane-id'
import { useAppStore } from '../store'
-import { ResumeTreeRow } from './NativeChatResumeTreeRow'
+import { ResumeTreeRow } from './native-chat-recovery/tree/NativeChatResumeTreeRow'
import {
resumeSelectionState,
toggleResumeSelection
-} from './native-chat-resume-on-restart-grouping'
-import { moveInTree } from './native-chat-resume-tree-keys'
+} from './native-chat-recovery/tree/native-chat-resume-on-restart-grouping'
+import { moveInTree } from './native-chat-recovery/tree/native-chat-resume-tree-keys'
type SessionRowData = ClaudeSessionMoveCandidate & { reason?: string }
diff --git a/src/renderer/src/components/NativeChatRemoteResume.test.tsx b/src/renderer/src/components/NativeChatRemoteResume.test.tsx
deleted file mode 100644
index c189ce7e8a7..00000000000
--- a/src/renderer/src/components/NativeChatRemoteResume.test.tsx
+++ /dev/null
@@ -1,121 +0,0 @@
-// @vitest-environment happy-dom
-import { act } from 'react'
-
-import { afterEach, expect, it, vi } from 'vitest'
-import {
- createResumeModalFixture,
- offered,
- type RestartRpc,
- type ResumeStatusStream
-} from './native-chat-resume-modal.test-support'
-
-import {
- createNativeChatRestartStore,
- type NativeChatRestartStore
-} from './native-chat-resume-on-restart-store'
-import type { RuntimeEnvironmentStatus } from '../../../shared/remote-runtime/host-status/runtime-host-status'
-
-const rpc = vi.hoisted(() => vi.fn())
-const stream: ResumeStatusStream = vi.hoisted(() => ({ emit: () => {}, snapshot: new Map() }))
-vi.mock('../runtime/native-chat/requests/structured-agent-session-call', () => ({
- callStructuredAgentSession: rpc
-}))
-
-vi.mock('../runtime/native-chat/requests/structured-agent-session-subscriptions', () => ({
- subscribeStructuredAgentSessionStatus: async (
- _target: unknown,
- emit: ResumeStatusStream['emit']
- ) => {
- stream.emit = emit
- emit({ type: 'snapshot', sessions: [] })
- return {
- unsubscribe: () => {}
- }
- }
-}))
-vi.mock('sonner', async () =>
- (await import('./native-chat-resume-sonner-mock.test-support')).resumeSonnerMock()
-)
-createResumeModalFixture(rpc, stream)
-const stores: NativeChatRestartStore[] = []
-afterEach(() => {
- for (const store of stores.splice(0)) {
- store._resetNativeChatRestartOffer()
- store.consumeNativeChatResumeOnRestartDialogRequest()
- }
- vi.useRealTimers()
- vi.unstubAllGlobals()
- vi.restoreAllMocks()
-})
-function store() {
- const value = createNativeChatRestartStore({ kind: 'environment', environmentId: 'ssh' })
- stores.push(value)
- vi.stubGlobal('api', { runtimeEnvironments: { desktopCreatedChatIds: async () => ['a'] } })
- return value
-}
-function ready(runtimeId: string): RuntimeEnvironmentStatus {
- return {
- checkedAt: 0,
- status: {
- runtimeId,
- rendererGraphEpoch: 0,
- graphStatus: 'ready',
- authoritativeWindowId: null,
- liveTabCount: 0,
- liveLeafCount: 0
- }
- }
-}
-
-it('snoozes server failures locally through reconnect and reopens for a new runtime', async () => {
- const remote = store()
- rpc.mockResolvedValue({ sessions: offered })
- await act(async () => remote.observeRuntimeStatus(ready('first')))
- await remote.dismissNativeChatRestartOffer(['a'])
- expect(rpc).toHaveBeenCalledTimes(1)
- expect(remote.getNativeChatRestartOffer().candidates).toHaveLength(2)
- remote.observeRuntimeStatus(undefined)
- await act(async () => remote.observeRuntimeStatus(ready('first')))
- expect(remote.getNativeChatResumeOnRestartDialogRequest()).toBe(false)
- await act(async () => remote.observeRuntimeStatus(ready('second')))
- expect(remote.getNativeChatResumeOnRestartDialogRequest()).toBe(true)
-})
-
-it.each(['failure', 'success', 'history'])(
- 'supersedes an older ordinary read through all awaits (%s)',
- async (mode) => {
- const remote = store()
- rpc.mockResolvedValue({ sessions: offered })
- await act(async () => remote.observeRuntimeStatus(ready('r1')))
- const old = Promise.withResolvers()
- const history = Promise.withResolvers()
- if (mode === 'history') {
- vi.stubGlobal('api', {
- runtimeEnvironments: { desktopCreatedChatIds: () => history.promise }
- })
- rpc.mockResolvedValueOnce({ sessions: [] })
- await act(async () => remote.refreshNativeChatRestartOffer())
- rpc.mockResolvedValue({ sessions: offered })
- } else {
- rpc.mockReturnValueOnce(old.promise)
- }
- let read: Promise
- await act(async () => {
- read = remote.refreshNativeChatRestartOffer()
- })
- rpc.mockResolvedValue({ sessions: mode === 'failure' ? offered : [] })
- remote.observeRuntimeStatus(undefined)
- await act(async () => remote.observeRuntimeStatus(ready('r1')))
- await act(async () => {
- if (mode === 'failure') {
- old.reject(new Error('obsolete failure'))
- } else {
- old.resolve({ sessions: offered })
- }
- history.resolve(['a'])
- await read!
- })
- expect(remote.getNativeChatRestartOffer().candidates).toHaveLength(mode === 'failure' ? 2 : 0)
- expect(remote.getNativeChatResumeOnRestartDialogRequest()).toBe(mode === 'failure')
- }
-)
diff --git a/src/renderer/src/components/NativeChatResumeOnRestartGroups.selection.test.tsx b/src/renderer/src/components/NativeChatResumeOnRestartGroups.selection.test.tsx
deleted file mode 100644
index f6c3909762a..00000000000
--- a/src/renderer/src/components/NativeChatResumeOnRestartGroups.selection.test.tsx
+++ /dev/null
@@ -1,134 +0,0 @@
-// @vitest-environment happy-dom
-
-import { act } from 'react'
-import { createRoot, type Root } from 'react-dom/client'
-import { afterEach, beforeEach, expect, it } from 'vitest'
-import { useAppStore } from '../store'
-import { getHostContextLabel } from '../../../shared/worktree/host-context-labels'
-import type { ExecutionHostId } from '../../../shared/execution-host'
-import {
- candidate,
- chatBox,
- countOf,
- disclosureOf,
- nodeBox,
- onToggleSpy,
- seedTree,
- treeOutline,
- unretryable,
- worktree
-} from './native-chat-resume-tree.test-support'
-import { ResumeTreeHarness as Harness } from './NativeChatResumeTreeHarness.test-support'
-
-globalThis.IS_REACT_ACT_ENVIRONMENT = true
-let root: Root
-let container: HTMLElement
-
-function render(props: React.ComponentProps): void {
- act(() => root.render())
-}
-
-function state(box: HTMLElement): string | null {
- return box.getAttribute('aria-checked')
-}
-
-beforeEach(() => {
- onToggleSpy.mockReset()
- useAppStore.setState(useAppStore.getInitialState(), true)
- container = document.createElement('div')
- document.body.append(container)
- root = createRoot(container)
-})
-
-afterEach(() => {
- act(() => root.unmount())
- container.remove()
- useAppStore.setState(useAppStore.getInitialState(), true)
-})
-
-it('is tri-state at every level, each node over every chat under it', () => {
- const remote: ExecutionHostId = 'ssh:build-server'
- render({ candidates: seedTree({ parent: remote, child: remote }) })
- const machine = getHostContextLabel(remote)
- expect([machine, 'orca', 'parent', 'child', 'other'].map((name) => countOf(name))).toEqual([
- '4 of 4',
- '4 of 4',
- '3 of 3',
- '2 of 2',
- '1 of 1'
- ])
-
- act(() => chatBox('in-child').click())
- expect([machine, 'orca', 'parent', 'child', 'other'].map((name) => state(nodeBox(name)))).toEqual(
- ['mixed', 'mixed', 'mixed', 'mixed', 'true']
- )
- expect(countOf(machine)).toBe('3 of 4')
- expect(countOf('child')).toBe('1 of 2')
-
- // Partly selected: ticking selects everything under the node, nested workspaces included.
- act(() => nodeBox('parent').click())
- expect(state(chatBox('in-child'))).toBe('true')
- expect(state(nodeBox(machine))).toBe('true')
-
- act(() => nodeBox(machine).click())
- for (const id of ['in-parent', 'in-child', 'also-in-child', 'in-other']) {
- expect(state(chatBox(id))).toBe('false')
- }
- expect(countOf('orca')).toBe('0 of 4')
-})
-
-it('selects every eligible chat in a project, never an unretryable one or another project’s', () => {
- const candidates = seedTree()
- const mobile = worktree('mobile', { repoId: 'repo-2', id: 'repo-2::/mobile/mobile' })
- useAppStore.setState((current) => ({
- repos: [
- ...current.repos,
- { id: 'repo-2', path: '/mobile', displayName: 'orca-mobile', badgeColor: '#999', addedAt: 1 }
- ],
- worktreesByRepo: { ...current.worktreesByRepo, 'repo-2': [mobile] }
- }))
- const stuck = unretryable(candidates[3]!)
- render({
- candidates: [...candidates, candidate('in-mobile', mobile)],
- initiallySelected: ['in-mobile'],
- failureFor: (sessionId) => (sessionId === 'in-other' ? stuck : undefined)
- })
- expect(countOf('orca')).toBe('0 of 3')
- expect(chatBox('in-other').hasAttribute('disabled')).toBe(true)
-
- act(() => nodeBox('orca').click())
- expect(countOf('orca')).toBe('3 of 3')
- expect(state(nodeBox('orca'))).toBe('true')
- const touched = onToggleSpy.mock.calls.map(([sessionId]) => sessionId)
- expect(touched).not.toContain('in-other')
- expect(touched).not.toContain('in-mobile')
- expect(countOf('orca-mobile')).toBe('1 of 1')
-})
-
-it('starts expanded; collapsing hides a node’s rows and keeps their selection', () => {
- render({ candidates: seedTree() })
- const parent = disclosureOf('parent')
- expect(parent.getAttribute('aria-expanded')).toBe('true')
- expect(parent.getAttribute('aria-label')).toBe('Collapse parent')
- expect(parent.tabIndex).toBe(-1)
- act(() => chatBox('in-child').click())
-
- act(() => parent.click())
- expect(treeOutline()).toEqual([
- '1:project:orca',
- '2:workspace:parent',
- '2:workspace:other',
- '3:chat:in-other'
- ])
- expect(disclosureOf('parent').getAttribute('aria-label')).toBe('Expand parent')
- expect(nodeBox('parent').closest('[role="treeitem"]')?.getAttribute('aria-expanded')).toBe(
- 'false'
- )
- // Hidden, not forgotten: the node still counts the pick made inside it.
- expect(state(nodeBox('parent'))).toBe('mixed')
- expect(countOf('parent')).toBe('2 of 3')
-
- act(() => disclosureOf('parent').click())
- expect(state(chatBox('in-child'))).toBe('false')
- expect(state(chatBox('also-in-child'))).toBe('true')
-})
diff --git a/src/renderer/src/components/NativeChatResumeOnRestartGroups.test.tsx b/src/renderer/src/components/NativeChatResumeOnRestartGroups.test.tsx
deleted file mode 100644
index 1b45bfcd55d..00000000000
--- a/src/renderer/src/components/NativeChatResumeOnRestartGroups.test.tsx
+++ /dev/null
@@ -1,73 +0,0 @@
-// @vitest-environment happy-dom
-
-import { act } from 'react'
-import { createRoot, type Root } from 'react-dom/client'
-import { afterEach, beforeEach, expect, it, vi } from 'vitest'
-import { useAppStore } from '../store'
-import { getDefaultSettings } from '../../../shared/constants'
-import type { ExecutionHostId } from '../../../shared/execution-host'
-import {
- candidate,
- chatBox,
- lineage,
- onToggleSpy,
- seedTree,
- worktree
-} from './native-chat-resume-tree.test-support'
-import { ResumeTreeHarness as Harness } from './NativeChatResumeTreeHarness.test-support'
-
-globalThis.IS_REACT_ACT_ENVIRONMENT = true
-let root: Root
-let container: HTMLElement
-
-function render(props: React.ComponentProps): void {
- act(() => root.render())
-}
-
-beforeEach(() => {
- onToggleSpy.mockReset()
- useAppStore.setState(useAppStore.getInitialState(), true)
- container = document.createElement('div')
- document.body.append(container)
- root = createRoot(container)
-})
-
-afterEach(() => {
- act(() => root.unmount())
- vi.restoreAllMocks()
- container.remove()
- useAppStore.setState(useAppStore.getInitialState(), true)
-})
-
-it('lists every offered chat exactly once, even with one workspace id on two hosts', () => {
- const remote: ExecutionHostId = 'ssh:build-server'
- const candidates = seedTree()
- const remoteParent = worktree('parent', { hostId: remote, instanceId: 'instance-remote' })
- useAppStore.setState((state) => ({
- worktreesByRepo: { 'repo-1': [...state.worktreesByRepo['repo-1']!, remoteParent] }
- }))
- const twin = candidate('on-remote', remoteParent)
- render({ candidates: [...candidates, twin] })
-
- for (const entry of [...candidates, twin]) {
- expect(
- container.querySelectorAll(`[role="checkbox"][aria-label*="Prompt ${entry.sessionId}"]`)
- ).toHaveLength(1)
- }
- // Same id, different machine: two separate workspace nodes.
- expect(container.querySelectorAll('[aria-label="Select all chats in parent"]')).toHaveLength(2)
-})
-
-it('lists every chat when workspace lineage loops', () => {
- const a = worktree('a')
- const b = worktree('b')
- useAppStore.setState({
- settings: getDefaultSettings(''),
- worktreesByRepo: { 'repo-1': [a, b] },
- worktreeLineageById: { [a.id]: lineage(a, b), [b.id]: lineage(b, a) }
- })
- render({ candidates: [candidate('in-a', a), candidate('in-b', b)] })
-
- expect(chatBox('in-a')).toBeTruthy()
- expect(chatBox('in-b')).toBeTruthy()
-})
diff --git a/src/renderer/src/components/NativeChatResumeTreeHarness.test-support.tsx b/src/renderer/src/components/NativeChatResumeTreeHarness.test-support.tsx
deleted file mode 100644
index 02f482ba820..00000000000
--- a/src/renderer/src/components/NativeChatResumeTreeHarness.test-support.tsx
+++ /dev/null
@@ -1,47 +0,0 @@
-// Mount the resume tree with dialog-owned selection for group-toggle tests.
-
-import { useState } from 'react'
-import { ResumeOnRestartGroups } from './NativeChatResumeOnRestartGroups'
-import { TooltipProvider } from './ui/tooltip'
-import type { ResumeCandidate, ResumeFailure } from './native-chat-resume-on-restart-grouping'
-import { onToggleSpy } from './native-chat-resume-tree.test-support'
-
-/** Owns the selection the way the dialog does, so group toggles show their effect. */
-export function ResumeTreeHarness({
- candidates,
- initiallySelected,
- busy = false,
- failureFor
-}: {
- candidates: ResumeCandidate[]
- initiallySelected?: string[]
- busy?: boolean
- failureFor?: (sessionId: string) => ResumeFailure | undefined
-}): React.JSX.Element {
- const [selected, setSelected] = useState>(
- () => new Set(initiallySelected ?? candidates.map((entry) => entry.sessionId))
- )
- return (
-
- {
- onToggleSpy(sessionId, checked)
- setSelected((current) => {
- const next = new Set(current)
- if (checked) {
- next.add(sessionId)
- } else {
- next.delete(sessionId)
- }
- return next
- })
- }}
- failureFor={failureFor}
- />
-
- )
-}
diff --git a/src/renderer/src/components/activity/activity-event-builder.ts b/src/renderer/src/components/activity/activity-event-builder.ts
index 57b65b1fc25..f92f3354a83 100644
--- a/src/renderer/src/components/activity/activity-event-builder.ts
+++ b/src/renderer/src/components/activity/activity-event-builder.ts
@@ -15,9 +15,8 @@ import type { TerminalTab } from '../../../../shared/workspace-layout/terminal-t
import type { Worktree } from '../../../../shared/worktree/types'
import type { ActivityEvent, ActivityLiveAgentSnapshot } from './activity-thread-types'
import { capActivityEvents } from './activity-event-cap'
-import { newestActivityHistoryEntries } from './activity-pane-events'
+import './activity-pane-events'
import {
- createActivityEventBuildCache,
resolveActivityTabIndexes,
resolvePaneBuild,
type ActivityEventBuildCache
@@ -30,8 +29,6 @@ import {
} from './activity-event-builder-context'
import type { Translate } from '@/i18n/use-translate'
-export { createActivityEventBuildCache, type ActivityEventBuildCache, newestActivityHistoryEntries }
-
export type BuildActivityEventsArgs = {
chatNames: StructuredChatTabNames
agentStatusByPaneKey: Record
diff --git a/src/renderer/src/components/activity/use-agent-pane-threads.ts b/src/renderer/src/components/activity/use-agent-pane-threads.ts
index 5f0f444d29d..48daeb648e6 100644
--- a/src/renderer/src/components/activity/use-agent-pane-threads.ts
+++ b/src/renderer/src/components/activity/use-agent-pane-threads.ts
@@ -1,7 +1,8 @@
import { useDeferredValue, useMemo, useRef } from 'react'
import { useAppStore } from '@/store'
import { useStructuredChatTabNames } from '@/runtime/native-chat/naming/structured-chat-name-observation'
-import { buildActivityEvents, createActivityEventBuildCache } from './activity-event-builder'
+import { buildActivityEvents } from './activity-event-builder'
+import { createActivityEventBuildCache } from '@/components/activity/activity-event-build-cache'
import { freshActivityLiveAgentState } from './activity-event-state'
import {
useAgentPaneThreadsDefaultHostId,
diff --git a/src/renderer/src/components/agent/AgentLaunchPickerMenu.select.test.tsx b/src/renderer/src/components/agent/AgentLaunchPickerMenu.select.test.tsx
index 42aac33f20c..e9077348be8 100644
--- a/src/renderer/src/components/agent/AgentLaunchPickerMenu.select.test.tsx
+++ b/src/renderer/src/components/agent/AgentLaunchPickerMenu.select.test.tsx
@@ -67,10 +67,7 @@ function Form({ query, onPick }: { query: string; onPick: (draft?: AgentPickerDr
)
}
-it.each([
- ['an agent row', ''],
- ['a search-result row', 'astra low']
-])(
+it.each([['a search-result row', 'astra low']])(
'applies each model and effort picked in %s setup to the form and keeps the panel on them',
(_row, query) => {
const onPick = vi.fn()
diff --git a/src/renderer/src/components/artifacts/ArtifactPublishedLinkPanel.tsx b/src/renderer/src/components/artifacts/ArtifactPublishedLinkPanel.tsx
index 41b9bd77269..ff9d79009a2 100644
--- a/src/renderer/src/components/artifacts/ArtifactPublishedLinkPanel.tsx
+++ b/src/renderer/src/components/artifacts/ArtifactPublishedLinkPanel.tsx
@@ -3,6 +3,7 @@ import { Check, Copy, ExternalLink, Loader2, RefreshCw } from 'lucide-react'
import { Button } from '@/components/ui/button'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
import { useTranslate } from '@/i18n/use-translate'
+import { cn } from '@/lib/utils'
import { copyArtifactLink, openArtifactInBrowser } from './artifact-link-actions'
export function ArtifactPublishedLinkPanel({
@@ -109,17 +110,36 @@ export function ArtifactPublishedLinkPanel({
type="button"
variant="outline"
size="sm"
- className="w-full"
+ className="h-auto min-h-8 w-full whitespace-normal"
disabled={publishing}
onClick={onUpdate}
>
- {publishing ? : }
- {publishing
- ? t('auto.components.artifacts.ArtifactPublishedLinkPanel.updating', 'Updating…')
- : t(
+ {/* Both labels share one grid cell, so a wrapped label cannot resize the popover mid-update. */}
+
+
+
+ {t(
'auto.components.artifacts.ArtifactPublishedLinkPanel.update',
'Update shared content'
)}
+
+
+
+ {t('auto.components.artifacts.ArtifactPublishedLinkPanel.updating', 'Updating…')}
+
+
) : null}
diff --git a/src/renderer/src/components/automations/AutomationEditorSettingsSidebar.test.tsx b/src/renderer/src/components/automations/AutomationEditorSettingsSidebar.test.tsx
deleted file mode 100644
index fedae0d26ae..00000000000
--- a/src/renderer/src/components/automations/AutomationEditorSettingsSidebar.test.tsx
+++ /dev/null
@@ -1,186 +0,0 @@
-// @vitest-environment happy-dom
-
-import { cleanup, fireEvent, render, screen } from '@testing-library/react'
-import { useState } from 'react'
-import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
-import { AGENT_CATALOG } from '@/lib/agent-catalog/agent-catalog'
-import { TooltipProvider } from '@/components/ui/tooltip'
-import { useAppStore } from '@/store'
-import { setLocalRuntimeCapabilitiesForTests } from '@/runtime/hosts/capabilities/local-runtime-capabilities'
-import { AUTOMATION_RUNTIME_CAPABILITIES } from '../../../../shared/automations/automation-runtime-capabilities'
-
-import { clearNativeChatComposerDraftsForTests } from '../native-chat/drafts/native-chat-draft-reset'
-import type { AutomationAuthorityRef } from '../../../../shared/automations/ownership/automation-owner-ref'
-import type { AutomationHostCatalogEntry } from './automation-host-catalog-types'
-import type { AutomationCreateDestinationControl } from './use-automation-create-destination'
-import type { AutomationDraft } from './AutomationEditorDialog'
-
-import { AutomationEditorSettingsSidebar } from './AutomationEditorSettingsSidebar'
-
-// Why: only the Agent field is under test; the sibling fields own their own coverage.
-vi.mock('./AutomationProjectCombobox', () => ({ default: () => null }))
-vi.mock('./AutomationWorkspaceField', () => ({ AutomationWorkspaceField: () => null }))
-vi.mock('./AutomationSessionField', () => ({ AutomationSessionField: () => null }))
-vi.mock('./AutomationSchedulePicker', () => ({ AutomationSchedulePicker: () => null }))
-vi.mock('./AutomationMissedRunGraceField', () => ({ AutomationMissedRunGraceField: () => null }))
-vi.mock('./AutomationPrecheckFields', () => ({ AutomationPrecheckFields: () => null }))
-vi.mock('./AutomationSetupDecisionField', () => ({ AutomationSetupDecisionField: () => null }))
-vi.mock('./AutomationDestinationField', () => ({ AutomationDestinationField: () => null }))
-vi.mock('@/hooks/useShortcutLabel', () => ({ useOptionalShortcutLabel: () => null }))
-vi.mock('../tab-bar/use-new-tab-agent-menu-rows', () => ({
- useAgentMenuObservation: () => ({
- model: { state: 'loading' },
- contextKey: 'automation-test',
- detection: {
- detectedIds: [],
- isLoading: false,
- isRefreshing: false,
- detectionFailed: false,
- needsServerUpdate: false,
- refresh: async () => []
- }
- })
-}))
-vi.mock('../agent/use-agent-launch-picker-inventory', () => ({
- useAgentLaunchPickerInventory: (_id: unknown, model: { rows: { agent: string }[] }) =>
- model.rows.map((row) => ({
- agent: row.agent,
- label: row.agent,
- rows: [row],
- ownerKey: `automation-${row.agent}`,
- surfaces: ['terminal'],
- defaultSurface: 'terminal',
- terminal: { model: 'gpt-5.4', permissionMode: 'ask' },
- structured: {},
- arguments: '--base',
- catalog: {
- origin: 'probe',
- fetchedAt: 1,
- models: [
- { id: 'gpt-5.4', label: 'Model A', isDefault: true, efforts: [] },
- { id: 'gpt-5.5', label: 'Model B', isDefault: false, efforts: [] }
- ]
- }
- }))
-}))
-
-const DRAFT: AutomationDraft = {
- name: '',
- prompt: '',
- agentId: 'codex',
- extraAgentArgs: '',
- projectId: '',
- workspaceMode: 'existing',
- workspaceId: '',
- baseBranch: '',
- reuseSession: false,
- precheckCommand: '',
- precheckTimeoutSeconds: '30',
- preset: 'weekly',
- time: '09:15',
- dayOfWeek: '5',
- customSchedule: '',
- missedRunGraceMinutes: '720',
- savedSchedule: null,
- scheduleWarning: null
-}
-
-function destinationControl(
- authority: AutomationAuthorityRef | null
-): AutomationCreateDestinationControl {
- if (!authority) {
- return {
- entries: [],
- projects: [],
- onSelect: vi.fn(),
- resolution: { status: 'choice-required', reason: 'unselected' }
- }
- }
- const entry: AutomationHostCatalogEntry = {
- stableRef: { authority, selector: { kind: 'self' } },
- owner: { authority, selector: { kind: 'self' } },
- stableKey: 'test-host',
- label: 'Test host',
- authorityLabel: 'Test host',
- kind: 'self',
- catalogState: 'authoritative',
- authorityHealth: 'fresh',
- executionHealth: 'connected',
- querySupport: 'scoped'
- }
- return {
- entries: [entry],
- projects: [],
- onSelect: vi.fn(),
- resolution: { status: 'ready', authority, destination: { selector: { kind: 'self' } }, entry }
- }
-}
-
-function renderSidebar(
- onDraftChange: (updater: (d: AutomationDraft) => AutomationDraft) => void,
- initial = DRAFT,
- authority: AutomationAuthorityRef | null = { kind: 'desktop' },
- destination = destinationControl(authority)
-) {
- function Form() {
- const [draft, setDraft] = useState(initial)
- return (
-
- repoId}
- repoMap={new Map()}
- worktrees={[]}
- settings={null}
- draft={draft}
- visibleAgents={AGENT_CATALOG}
- pickerTriggerClassName=""
- onProjectChange={vi.fn()}
- onDraftChange={(updater) => {
- onDraftChange(updater)
- setDraft(updater)
- }}
- onSetupDecisionTouched={vi.fn()}
- />
-
- )
- }
- return render(
)
-}
-
-beforeEach(() => {
- clearNativeChatComposerDraftsForTests()
- setLocalRuntimeCapabilitiesForTests(AUTOMATION_RUNTIME_CAPABILITIES)
-})
-afterEach(() => {
- cleanup()
- vi.restoreAllMocks()
- setLocalRuntimeCapabilitiesForTests(null)
- useAppStore.setState({ runtimeStatusByEnvironmentId: new Map() })
-})
-
-function openPicker() {
- fireEvent.pointerDown(screen.getByRole('button', { name: 'Select agent' }), { button: 0 })
-}
-
-describe('AutomationEditorSettingsSidebar agent picker', () => {
- it('discards an unaccepted setup when the editor owner closes', () => {
- const onDraftChange = vi.fn()
- const form = renderSidebar(onDraftChange)
- openPicker()
- fireEvent.click(screen.getByRole('button', { name: 'Configure Codex' }))
- fireEvent.change(document.querySelector('textarea')!, { target: { value: '--unaccepted' } })
- form.unmount()
- renderSidebar(onDraftChange)
- openPicker()
- fireEvent.click(screen.getByRole('button', { name: 'Configure Codex' }))
- expect(document.querySelector('textarea')).toHaveProperty('value', '--base')
- expect(onDraftChange).not.toHaveBeenCalled()
- })
-})
diff --git a/src/renderer/src/components/automations/AutomationTimeField.test.tsx b/src/renderer/src/components/automations/AutomationTimeField.test.tsx
deleted file mode 100644
index 3a230ca8a87..00000000000
--- a/src/renderer/src/components/automations/AutomationTimeField.test.tsx
+++ /dev/null
@@ -1,80 +0,0 @@
-// @vitest-environment happy-dom
-
-import '@testing-library/jest-dom/vitest'
-import React from 'react'
-import { cleanup, render, screen } from '@testing-library/react'
-import userEvent from '@testing-library/user-event'
-import { afterEach, describe, expect, it, vi } from 'vitest'
-import { AutomationTimeField } from './AutomationTimeField'
-
-afterEach(() => {
- cleanup()
-})
-
-function ControlledTimeField({
- initialTime = '09:15',
- mode = 'time',
- onTimeChange
-}: {
- initialTime?: string
- mode?: 'time' | 'minute'
- onTimeChange?: (time: string) => void
-}): React.JSX.Element {
- const [time, setTime] = React.useState(initialTime)
- return (
-
{
- setTime(next)
- onTimeChange?.(next)
- }}
- />
- )
-}
-
-describe('AutomationTimeField interactions', () => {
- it('commits typed hour/minute and toggles AM/PM into 24h storage', async () => {
- const user = userEvent.setup()
- const onTimeChange = vi.fn()
- render()
-
- const hour = screen.getByLabelText('Hour')
- await user.clear(hour)
- await user.type(hour, '11')
- expect(onTimeChange).toHaveBeenLastCalledWith('11:15')
-
- onTimeChange.mockClear()
- const minute = screen.getByLabelText('Minute')
- await user.clear(minute)
- await user.type(minute, '05')
- expect(onTimeChange).toHaveBeenLastCalledWith('11:05')
-
- onTimeChange.mockClear()
- await user.click(screen.getByRole('button', { name: /^AM or PM:/ }))
- expect(onTimeChange).toHaveBeenLastCalledWith('23:05')
- expect(screen.getByRole('button', { name: /^AM or PM:/ })).toHaveTextContent('PM')
- })
-
- it('treats empty blur as min and does not re-fire after 2-digit auto-commit', async () => {
- const user = userEvent.setup()
- const onTimeChange = vi.fn()
- render()
-
- const minute = screen.getByLabelText('Minute')
- await user.clear(minute)
- await user.tab()
- expect(onTimeChange).toHaveBeenLastCalledWith('09:00')
- expect(minute).toHaveValue('00')
-
- onTimeChange.mockClear()
- await user.click(minute)
- await user.clear(minute)
- await user.type(minute, '30')
- // 2-digit entry auto-commits once; blur must not emit a second identical update.
- const callsAfterType = onTimeChange.mock.calls.length
- expect(onTimeChange).toHaveBeenLastCalledWith('09:30')
- await user.tab()
- expect(onTimeChange.mock.calls.length).toBe(callsAfterType)
- })
-})
diff --git a/src/renderer/src/components/automations/AutomationsPage.cross-authority-actions.spec.tsx b/src/renderer/src/components/automations/AutomationsPage.cross-authority-actions.spec.tsx
index 8b9e79938fd..5e7a062f7d0 100644
--- a/src/renderer/src/components/automations/AutomationsPage.cross-authority-actions.spec.tsx
+++ b/src/renderer/src/components/automations/AutomationsPage.cross-authority-actions.spec.tsx
@@ -43,21 +43,6 @@ function runtimeAutomationCalls(): string[] {
describe('AutomationsPage row actions under a colliding automation id', () => {
installAutomationsPageHarness()
- it('names the selected row’s own host, not the desktop that listed it', async () => {
- await collidingHosts()
- await renderPage()
- await settleHostQueries()
-
- const remote = listedRows().find((candidate) => candidate.automation.name === 'Remote nightly')
- await act(async () => {
- mocks.listPanel?.selectAutomationRow(remote?.key ?? '')
- })
-
- // The record’s local target means local to its server; the catalog entry supplies the displayed host.
- expect(mocks.detailPane?.selected?.name).toBe('Remote nightly')
- expect(mocks.detailPane?.selectedHostEntry?.authorityLabel).toBe('GPU box')
- })
-
it('runs the selected desktop row on the desktop, not on the runtime holding the same id', async () => {
await collidingHosts()
const { container } = await renderPage()
diff --git a/src/renderer/src/components/automations/AutomationsPage.refresh-selection.spec.tsx b/src/renderer/src/components/automations/AutomationsPage.refresh-selection.spec.tsx
index 36b4a3a5aa6..2a96389539d 100644
--- a/src/renderer/src/components/automations/AutomationsPage.refresh-selection.spec.tsx
+++ b/src/renderer/src/components/automations/AutomationsPage.refresh-selection.spec.tsx
@@ -17,11 +17,7 @@ import {
settleHostQueries
} from './automations-page-test-harness'
import { listedRows } from './automations-page-listed-items'
-import { makeAutomation, makeRun, WORKSPACE_ID } from './automations-page-fixtures'
-import {
- AUTOMATIONS_CHANGED_EVENT,
- emitAutomationsChangedWindowEvent
-} from '@/lib/automations-changed-window-event'
+import { makeAutomation, makeRun } from './automations-page-fixtures'
async function openAutomationRow(container: HTMLElement, name: string): Promise {
const row = [
@@ -32,267 +28,9 @@ async function openAutomationRow(container: HTMLElement, name: string): Promise<
await settleHostQueries()
}
-describe('AutomationsPage refresh', () => {
- installAutomationsPageHarness()
-
- it.each(['desktop', 'runtime'] as const)(
- 'refreshes count and exact saved output on successive %s completion events without re-entry',
- async (authority) => {
- const automation = makeAutomation({ name: 'Selected nightly' })
- scopedList(authority === 'desktop' ? [automation] : [])
- api.automations.list.mockResolvedValue(authority === 'desktop' ? [automation] : [])
- if (authority === 'runtime') {
- runtimeHost([automation], [])
- mocks.state.automationHostFilter = RUNTIME_SELF_FILTER
- }
- const { container } = await renderPage()
- await openAutomationRow(container, automation.name)
- const count = container.querySelector('[data-testid="detail-run-count"]')
- expect(count?.textContent).toBe('0')
- const reads = (): unknown[][] =>
- mocks.callRuntimeRpc.mock.calls.filter(([, method]) => method === 'automation.runs')
- const beforeEvents = reads().length
- for (const unrelated of [
- {
- environmentId: authority === 'desktop' ? 'gpu' : null,
- selector: { kind: 'self' as const }
- },
- {
- environmentId: authority === 'runtime' ? 'gpu' : null,
- selector: { kind: 'ssh' as const, targetId: 'elsewhere' }
- }
- ]) {
- await act(async () => emitAutomationsChangedWindowEvent({ ...unrelated, reason: 'run' }))
- await settleHostQueries()
- expect(reads()).toHaveLength(beforeEvents)
- expect(container.querySelector('[data-testid="detail-run-count"]')).toBe(count)
- }
- const event = {
- ...(authority === 'runtime' ? { environmentId: 'gpu' } : {}),
- selector: { kind: 'self' as const },
- reason: 'run' as const
- }
- const first = makeRun({
- id: 'first-completed',
- outputSnapshot: {
- format: 'plain_text',
- content: 'First exact reply',
- capturedAt: 1,
- truncated: false
- }
- })
- const answer = (runs: (typeof first)[]): void => {
- api.automations.listRuns.mockResolvedValue(runs)
- if (authority === 'runtime') {
- mocks.state.runtimeAnswers = { automations: [automation], runs }
- }
- }
- answer([first])
- await act(async () => emitAutomationsChangedWindowEvent(event))
- await settleHostQueries()
- expect(count?.textContent).toBe('1')
- expect(mocks.detailPane?.selectedRuns).toEqual([first])
- expect(reads()).toHaveLength(beforeEvents + 1)
- await act(async () => mocks.detailPane?.openAutomationRunPage(first))
- expect(container.textContent).toContain('First exact reply')
- const revised = {
- ...first,
- outputSnapshot: { ...first.outputSnapshot!, content: 'Settled first exact reply' }
- }
- const second = makeRun({ id: 'second-completed' })
- answer([second, revised])
- await act(async () => emitAutomationsChangedWindowEvent(event))
- await settleHostQueries()
- expect(container.textContent).toContain('Settled first exact reply')
- expect(reads()).toHaveLength(beforeEvents + 2)
- await act(async () =>
- container.querySelector('[aria-label="Back to runs"]')?.click()
- )
- expect(container.querySelector('[data-testid="detail-run-count"]')?.textContent).toBe('2')
- expect(mocks.detailPane?.selectedRuns.map((run) => run.id)).toEqual([
- 'second-completed',
- 'first-completed'
- ])
- for (const [target, , params, options] of reads().slice(beforeEvents)) {
- expect(target).toEqual(
- authority === 'runtime'
- ? { kind: 'environment', environmentId: 'gpu' }
- : { kind: 'local' }
- )
- expect(params).toEqual({
- automationId: automation.id,
- expectedOwner: SELF_PRECONDITION,
- preview: true
- })
- if (authority === 'runtime') {
- expect(options).toMatchObject({ expectedEnvironmentPairingRevision: 4 })
- }
- }
- await settleHostQueries()
- expect(reads()).toHaveLength(beforeEvents + 2)
- }
- )
-})
-
describe('AutomationsPage selection', () => {
installAutomationsPageHarness()
- it('keeps an acquired exact run through definition removal, failed history settlement and Back', async () => {
- const automation = makeAutomation({ id: 'a-1', name: 'Nightly' })
- const leafId = '11111111-1111-4111-8111-111111111111'
- const run = makeRun({
- id: 'old-run',
- automationId: automation.id,
- workspaceId: WORKSPACE_ID,
- workspaceDisplayName: 'Original workspace',
- terminalSessionId: 'recorded-tab',
- terminalPaneKey: `recorded-tab:${leafId}`,
- terminalPtyId: 'recorded-pty',
- outputSnapshot: {
- format: 'plain_text',
- content: 'Saved exact historical output',
- capturedAt: 1,
- truncated: false
- }
- })
- scopedList([automation])
- api.automations.list.mockResolvedValue([automation])
- api.automations.listRuns.mockResolvedValue([run])
- mocks.state.selectedAutomationId = automation.id
- mocks.state.setSelectedAutomationId = (id: string | null) => {
- mocks.state.selectedAutomationId = id
- }
- mocks.state.tabsByWorktree = {}
- mocks.state.folderWorkspaces = []
- mocks.state.projectGroups = []
- mocks.state.unifiedTabsByWorktree = {
- [WORKSPACE_ID]: [
- {
- id: 'recorded-tab',
- entityId: 'recorded-tab',
- worktreeId: WORKSPACE_ID,
- contentType: 'terminal',
- executionHostId: 'local'
- }
- ]
- }
- mocks.state.terminalLayoutsByTabId = {
- 'recorded-tab': {
- root: { type: 'leaf', leafId },
- activeLeafId: leafId,
- ptyIdsByLeafId: { [leafId]: 'recorded-pty' }
- }
- }
- mocks.state.ptyIdsByTabId = { 'recorded-tab': ['recorded-pty'] }
- const { container, rerender } = await renderPage()
- await openAutomationRow(container, 'Nightly')
- const retryHistory = mocks.detailPane?.recoverSelectedRuns
- await act(async () => mocks.detailPane?.openAutomationRunPage(run))
- expect(container.textContent).toContain('Saved exact historical output')
- expect(
- [...container.querySelectorAll('button')].some((button) => button.textContent === 'View run')
- ).toBe(true)
- scopedList([])
- api.automations.list.mockResolvedValue([])
- api.automations.listRuns.mockRejectedValue(new Error('History temporarily unavailable'))
- const readsBeforeFailure = api.automations.listRuns.mock.calls.length
- await act(async () =>
- emitAutomationsChangedWindowEvent({ selector: { kind: 'self' }, reason: 'run' })
- )
- await settleHostQueries()
- expect(api.automations.listRuns.mock.calls.length).toBe(readsBeforeFailure + 1)
- expect(container.textContent).toContain('Saved exact historical output')
- await rerender()
- const readsBeforeRetry = api.automations.listRuns.mock.calls.length
- await act(async () => retryHistory?.('retry'))
- await settleHostQueries()
- expect(api.automations.listRuns.mock.calls.length).toBeGreaterThan(readsBeforeRetry)
- expect(container.textContent).toContain('Saved exact historical output')
- expect(container.querySelector('[aria-label="Back to runs"]')).not.toBeNull()
- expect(
- [...container.querySelectorAll('button')].some((button) => button.textContent === 'View run')
- ).toBe(true)
- await act(async () =>
- container.querySelector('[aria-label="Back to runs"]')?.click()
- )
- expect(container.querySelector('[data-testid="list-panel"]')).not.toBeNull()
- expect(mocks.toastMessage).not.toHaveBeenCalledWith('Run history no longer available.')
- })
-
- it('reacquires a same-row SSH incarnation only after explicit selection, retaining old output through Retry and Back', async () => {
- const automation = makeAutomation({ id: 'ssh-a', name: 'Captured SSH' })
- mocks.state.selectedAutomationId = automation.id
- mocks.state.setSelectedAutomationId = (id: string | null) => {
- mocks.state.selectedAutomationId = id
- }
- const run = makeRun({
- id: 'older-ssh-run',
- automationId: automation.id,
- outputSnapshot: {
- format: 'plain_text',
- content: 'Captured old output',
- capturedAt: 1,
- truncated: false
- }
- })
- mocks.state.folderWorkspaces = []
- mocks.state.projectGroups = []
- let generation = 7
- mocks.state.sshTargetLabels = new Map([['box', 'Box']])
- mocks.state.sshTargetGenerations = new Map([['box', generation]])
- mocks.state.sshConnectionStates = new Map([['box', { status: 'connected' }]])
- api.automations.listScoped.mockImplementation(async (args) => ({
- automations: args?.selector?.kind === 'ssh' ? [automation] : [],
- items:
- args?.selector?.kind === 'ssh'
- ? [
- {
- automationId: automation.id,
- selector: { kind: 'ssh', targetId: 'box', targetGeneration: generation }
- }
- ]
- : [],
- orphanCount: 0
- }))
- api.automations.listRuns.mockResolvedValue([run])
- const { container, rerender } = await renderPage()
- await openAutomationRow(container, 'Captured SSH')
- await act(async () => mocks.detailPane?.openAutomationRunPage(run))
- expect(container.textContent).toContain('Captured old output')
- generation = 9
- mocks.state.sshTargetGenerations = new Map([['box', generation]])
- await rerender()
- await act(async () => window.dispatchEvent(new Event(AUTOMATIONS_CHANGED_EVENT)))
- await settleHostQueries()
- expect(container.textContent).toContain('Captured old output')
- const back = container.querySelector('[aria-label="Back to runs"]')
- expect(back).not.toBeNull()
- await act(async () => back?.click())
- expect(container.querySelector('[data-testid="detail-pane"]')).not.toBeNull()
- const beforeRetry = api.automations.listRuns.mock.calls.length
- await act(async () => mocks.detailPane?.recoverSelectedRuns('retry'))
- await settleHostQueries()
- expect(api.automations.listRuns.mock.calls.length).toBeGreaterThan(beforeRetry)
- expect(
- api.automations.listRuns.mock.calls
- .slice(beforeRetry)
- .every(([args]) => args?.expectedOwner?.selector?.targetGeneration !== 9)
- ).toBe(true)
- expect(mocks.detailPane?.selectedRuns).toEqual([run])
- const automations = [...container.querySelectorAll('nav button')].find(
- (button) => button.textContent === 'Automations'
- )
- expect(automations).toBeTruthy()
- await act(async () => automations?.click())
- const beforeReselect = api.automations.listRuns.mock.calls.length
- await openAutomationRow(container, 'Captured SSH')
- expect(
- api.automations.listRuns.mock.calls
- .slice(beforeReselect)
- .some(([args]) => args?.expectedOwner?.selector?.targetGeneration === 9)
- ).toBe(true)
- })
-
it('fetches the newly selected automation runs when the selection changes', async () => {
scopedList([
makeAutomation({ id: 'a-1', name: 'Nightly' }),
diff --git a/src/renderer/src/components/automations/AutomationsPage.run-navigation.test.tsx b/src/renderer/src/components/automations/AutomationsPage.run-navigation.test.tsx
deleted file mode 100644
index 355cad9cdf4..00000000000
--- a/src/renderer/src/components/automations/AutomationsPage.run-navigation.test.tsx
+++ /dev/null
@@ -1,113 +0,0 @@
-// @vitest-environment happy-dom
-
-import { act } from 'react'
-import { within } from '@testing-library/react'
-import { describe, expect, it, vi } from 'vitest'
-import type { AutomationRun } from '../../../../shared/automations/history/automation-run'
-import {
- api,
- installAutomationsPageHarness,
- mocks,
- renderPage,
- scopedList,
- settleHostQueries
-} from './automations-page-test-harness'
-import { makeAutomation, makeRun } from './automations-page-fixtures'
-
-vi.mock('@tanstack/react-virtual', async () => {
- const { createVirtualizerStub } = await import('./virtualizer-test-stub')
- return { useVirtualizer: createVirtualizerStub() }
-})
-
-installAutomationsPageHarness()
-
-async function loadCachedHistory() {
- const automation = makeAutomation()
- const oldRun = makeRun({ id: 'run-26', runNumber: 26 })
- api.automations.list.mockResolvedValue([automation])
- scopedList([automation])
- api.automations.listRuns.mockResolvedValue([oldRun])
- mocks.state.selectedAutomationId = automation.id
- mocks.state.setPendingAutomationRunNavigation = mocks.setPendingRunNavigation
- mocks.setPendingRunNavigation.mockImplementation((navigation) => {
- mocks.state.pendingAutomationRunNavigation = navigation
- })
- const page = await renderPage()
- await settleHostQueries()
- return { ...page, automation, oldRun }
-}
-
-async function openDashboardRun(
- container: HTMLElement,
- newRun: AutomationRun,
- oldRun: AutomationRun
-) {
- const fresh = Promise.withResolvers()
- api.automations.listRuns.mockImplementation((args?: { limit?: number }) =>
- args?.limit ? Promise.resolve([newRun, oldRun]) : fresh.promise
- )
- await act(async () => within(container).getByRole('button', { name: 'Runs' }).click())
- await act(async () => {
- within(container)
- .getByRole('button', { name: new RegExp(newRun.title) })
- .click()
- })
- return fresh
-}
-
-describe('AutomationsPage run navigation', () => {
- it('keeps the runs dashboard open when the user backs out of a pending read', async () => {
- const { container, oldRun } = await loadCachedHistory()
- const newRun = makeRun({ id: 'run-27', title: 'Nightly run 27' })
- const fresh = await openDashboardRun(container, newRun, oldRun)
- const breadcrumb = within(container).getByRole('navigation', {
- name: 'Automations breadcrumb'
- })
-
- await act(async () => within(breadcrumb).getByRole('button', { name: 'Runs' }).click())
- await act(async () => fresh.resolve([newRun, oldRun]))
-
- expect(mocks.state.pendingAutomationRunNavigation).toBeNull()
- expect(within(container).getByRole('textbox', { name: 'Search runs…' })).toBeTruthy()
- expect(container.querySelector('[aria-label="Run context"]')).toBeNull()
- expect(mocks.toastMessage).not.toHaveBeenCalled()
- })
-
- it('returns to automation details when cancelling a workspace run link from there', async () => {
- const { container, rerender, automation, oldRun } = await loadCachedHistory()
- await act(async () => within(container).getByRole('button', { name: 'Nightly' }).click())
- const fresh = Promise.withResolvers()
- api.automations.listRuns.mockReturnValue(fresh.promise)
- mocks.state.pendingAutomationRunNavigation = {
- automationId: automation.id,
- runId: oldRun.id
- }
- await rerender()
-
- expect(within(container).getByRole('status')).toBeTruthy()
- await act(async () => {
- window.dispatchEvent(
- new KeyboardEvent('keydown', { key: 'Escape', bubbles: true, cancelable: true })
- )
- })
- expect(mocks.state.pendingAutomationRunNavigation).toBeNull()
- await act(async () => fresh.resolve([oldRun]))
-
- expect(within(container).getByTestId('detail-pane')).toBeTruthy()
- expect(container.querySelector('[aria-label="Run context"]')).toBeNull()
- expect(mocks.toastMessage).not.toHaveBeenCalled()
- })
-
- it('shows the history error when opening a run from the dashboard fails', async () => {
- const { container, oldRun } = await loadCachedHistory()
- const newRun = makeRun({ id: 'run-27', title: 'Nightly run 27' })
- const fresh = await openDashboardRun(container, newRun, oldRun)
-
- await act(async () => fresh.reject(new Error('Host disconnected')))
-
- expect(mocks.state.pendingAutomationRunNavigation).toBeNull()
- expect(mocks.toastMessage).not.toHaveBeenCalled()
- expect(container.querySelector('[data-testid="detail-pane"]')).not.toBeNull()
- expect(mocks.detailPane?.selectedRunsNotice?.message).toContain('Host disconnected')
- })
-})
diff --git a/src/renderer/src/components/automations/AutomationsPageDeleteDialogs.tsx b/src/renderer/src/components/automations/AutomationsPageDeleteDialogs.tsx
index e5bb6cef3bc..190e1f2dcb4 100644
--- a/src/renderer/src/components/automations/AutomationsPageDeleteDialogs.tsx
+++ b/src/renderer/src/components/automations/AutomationsPageDeleteDialogs.tsx
@@ -1,5 +1,8 @@
import React from 'react'
-import { AutomationDeleteDialog, ExternalAutomationDeleteDialog } from './AutomationDeleteDialogs'
+import {
+ AutomationDeleteDialog,
+ ExternalAutomationDeleteDialog
+} from './authoring/AutomationDeleteDialogs'
type Props = {
deleteTarget: React.ComponentProps['deleteTarget']
diff --git a/src/renderer/src/components/automations/AutomationsPageListPanel.tsx b/src/renderer/src/components/automations/AutomationsPageListPanel.tsx
index 28a5ac5b224..9cfefc8b39d 100644
--- a/src/renderer/src/components/automations/AutomationsPageListPanel.tsx
+++ b/src/renderer/src/components/automations/AutomationsPageListPanel.tsx
@@ -1,7 +1,7 @@
import React from 'react'
import type { AutomationsPageController } from './use-automations-page-controller'
-import { AutomationsListPanel } from './AutomationsListPanel'
-import { nextAutomationListSort } from './automation-list-view'
+import { AutomationsListPanel } from './listing/AutomationsListPanel'
+import { nextAutomationListSort } from './listing/automation-list-view'
export function AutomationsPageListPanel({
controller,
diff --git a/src/renderer/src/components/automations/AutomationsPageSkeleton.tsx b/src/renderer/src/components/automations/AutomationsPageSkeleton.tsx
index cc8e5a2f85d..10c081c2a23 100644
--- a/src/renderer/src/components/automations/AutomationsPageSkeleton.tsx
+++ b/src/renderer/src/components/automations/AutomationsPageSkeleton.tsx
@@ -1,6 +1,6 @@
import React from 'react'
import { cn } from '@/lib/utils'
-import { AUTOMATIONS_TABLE_GRID_CLASS } from './automations-table-layout'
+import { AUTOMATIONS_TABLE_GRID_CLASS } from './listing/automations-table-layout'
import {
LIST_TABLE_CONTAINER_CLASS,
LIST_TABLE_HEADER_CLASS,
diff --git a/src/renderer/src/components/automations/AutomationsPageSurface.tsx b/src/renderer/src/components/automations/AutomationsPageSurface.tsx
index 61593de5d8c..dff56fff22d 100644
--- a/src/renderer/src/components/automations/AutomationsPageSurface.tsx
+++ b/src/renderer/src/components/automations/AutomationsPageSurface.tsx
@@ -1,16 +1,19 @@
import React from 'react'
import { useTranslate } from '@/i18n/use-translate'
import { LoadingSpinner } from '@/components/LoadingSpinner'
-import { AutomationEditorDialog } from './AutomationEditorDialog'
-import { AutomationsDetailPane } from './AutomationsDetailPane'
+import { AutomationEditorDialog } from './authoring/AutomationEditorDialog'
+import { AutomationsDetailPane } from './details/AutomationsDetailPane'
import { AutomationsPageSkeleton } from './AutomationsPageSkeleton'
-import { getAutomationAuthorityTarget } from './automation-host-client'
-import { automationProjectName, type AutomationListRow } from './automation-list-row-identity'
-import type { AutomationHostRecoveryAction } from './automation-host-status-descriptors'
+import { getAutomationAuthorityTarget } from './hosts/automation-host-client'
+import {
+ automationProjectName,
+ type AutomationListRow
+} from './listing/automation-list-row-identity'
+import type { AutomationHostRecoveryAction } from './hosts/automation-host-status-descriptors'
import { AutomationsPageTopBar } from './AutomationsPageTopBar'
import type { AutomationsPageController } from './use-automations-page-controller'
-import { AutomationRunsDashboardSurface } from './AutomationRunsDashboardSurface'
-import { AutomationRunDetailsPage } from './AutomationRunDetailsPage'
+import { AutomationRunsDashboardSurface } from './runs/AutomationRunsDashboardSurface'
+import { AutomationRunDetailsPage } from './runs/AutomationRunDetailsPage'
import { AutomationsPageDeleteDialogs } from './AutomationsPageDeleteDialogs'
import { AutomationsPageListPanel } from './AutomationsPageListPanel'
export function AutomationsPageSurface({
diff --git a/src/renderer/src/components/automations/AutomationsPageTopBar.tsx b/src/renderer/src/components/automations/AutomationsPageTopBar.tsx
index e5ab99a505c..ae24bc32293 100644
--- a/src/renderer/src/components/automations/AutomationsPageTopBar.tsx
+++ b/src/renderer/src/components/automations/AutomationsPageTopBar.tsx
@@ -1,9 +1,9 @@
import React from 'react'
import { useTranslate } from '@/i18n/use-translate'
-import { AutomationOwnerConflictNotice } from './AutomationOwnerConflictNotice'
+import { AutomationOwnerConflictNotice } from './hosts/AutomationOwnerConflictNotice'
import { AutomationsPageBreadcrumb } from './AutomationsPageBreadcrumb'
-import type { AutomationHostRecoveryAction } from './automation-host-status-descriptors'
-import type { AutomationActionNotice } from './automation-row-action-dispatch'
+import type { AutomationHostRecoveryAction } from './hosts/automation-host-status-descriptors'
+import type { AutomationActionNotice } from './hosts/automation-row-action-dispatch'
export function AutomationsPageTopBar({
pageView,
diff --git a/src/renderer/src/components/automations/AutomationAgentLaunchPicker.tsx b/src/renderer/src/components/automations/authoring/AutomationAgentLaunchPicker.tsx
similarity index 92%
rename from src/renderer/src/components/automations/AutomationAgentLaunchPicker.tsx
rename to src/renderer/src/components/automations/authoring/AutomationAgentLaunchPicker.tsx
index beee205e96a..7d41df74e03 100644
--- a/src/renderer/src/components/automations/AutomationAgentLaunchPicker.tsx
+++ b/src/renderer/src/components/automations/authoring/AutomationAgentLaunchPicker.tsx
@@ -1,7 +1,7 @@
import { useCallback, useMemo, useState, type ComponentProps } from 'react'
-import { useAppStore } from '@/store'
+import { useAppStore } from '@/store/index'
import { AgentLaunchPicker } from '@/components/agent/AgentLaunchPicker'
-import { useAgentPickerDraftScope } from '@/components/agent/AgentLaunchSetupButton'
+import { useAgentPickerDraftScope } from '@/components/agent/agent-launch-picker-drafts'
import { useAgentLaunchPickerInventory } from '@/components/agent/use-agent-launch-picker-inventory'
import { useAgentMenuObservation } from '@/components/tab-bar/use-new-tab-agent-menu-rows'
import {
@@ -11,15 +11,15 @@ import {
type ProspectiveWorkspace
} from '@/lib/agent-session/launch/routing/agent-launch-route-input'
import type { AgentCatalogEntry } from '@/lib/agent-catalog/agent-catalog'
-import { parseExecutionHostId } from '../../../../shared/execution-host'
-import { AUTOMATION_LAUNCH_SETUP_RUNTIME_CAPABILITY } from '../../../../shared/automations/automation-runtime-capabilities'
-import { automationLegacyArguments } from '../../../../shared/automations/launch/automation-legacy-arguments'
-import type { AutomationAuthorityRef } from '../../../../shared/automations/ownership/automation-owner-ref'
+import { parseExecutionHostId } from '../../../../../shared/execution-host'
+import { AUTOMATION_LAUNCH_SETUP_RUNTIME_CAPABILITY } from '../../../../../shared/automations/automation-runtime-capabilities'
+import { automationLegacyArguments } from '../../../../../shared/automations/launch/automation-legacy-arguments'
+import type { AutomationAuthorityRef } from '../../../../../shared/automations/ownership/automation-owner-ref'
import { Button } from '@/components/ui/button'
import { useTranslate } from '@/i18n/use-translate'
import { draftExtraAgentArgsNeedFreshSession } from './automation-draft-model'
import type { AgentDetectionTarget } from '@/hooks/useDetectedAgents'
-import type { AgentPickerEntry } from '../../../../shared/agent-launch/picker/agent-launch-picker'
+import type { AgentPickerEntry } from '../../../../../shared/agent-launch/picker/agent-launch-picker'
import type { NewTabAgentMenuModel } from '@/components/tab-bar/new-tab-agent-menu-model'
import { useAutomationAgentPickerEntries } from './use-automation-agent-picker-entries'
import { AutomationExtraAgentArgsField } from './AutomationExtraAgentArgsField'
@@ -30,7 +30,7 @@ import {
editAutomationLegacyDraft,
editsSupplementalArguments
} from './automation-launch-draft'
-import type { GlobalSettings } from '../../../../shared/global-settings-types'
+import type { GlobalSettings } from '../../../../../shared/global-settings-types'
function legacyArgumentsDraft(draft: AutomationDraft): AutomationDraft {
return {
diff --git a/src/renderer/src/components/automations/AutomationCustomCronPanel.tsx b/src/renderer/src/components/automations/authoring/AutomationCustomCronPanel.tsx
similarity index 93%
rename from src/renderer/src/components/automations/AutomationCustomCronPanel.tsx
rename to src/renderer/src/components/automations/authoring/AutomationCustomCronPanel.tsx
index 6e744c62e49..99451dab731 100644
--- a/src/renderer/src/components/automations/AutomationCustomCronPanel.tsx
+++ b/src/renderer/src/components/automations/authoring/AutomationCustomCronPanel.tsx
@@ -2,11 +2,11 @@ import React from 'react'
import { CheckCircle2, CircleAlert } from 'lucide-react'
import { Input } from '@/components/ui/input'
import { cn } from '@/lib/utils'
-import { describeAutomationSchedule } from '../../../../shared/automations/scheduling/automation-schedules'
-import { getAutomationCronExpressionFields } from '../../../../shared/automations/scheduling/automation-schedule-parsing'
-import { formatUiAutomationScheduleDescriptor } from './automation-schedule-label'
+import { describeAutomationSchedule } from '../../../../../shared/automations/scheduling/automation-schedules'
+import { getAutomationCronExpressionFields } from '../../../../../shared/automations/scheduling/automation-schedule-parsing'
+import { formatUiAutomationScheduleDescriptor } from '../details/automation-schedule-label'
import type { AutomationDraft } from './AutomationEditorDialog'
-import { Field } from './automation-page-parts'
+import { Field } from '../automation-page-parts'
import { translate } from '@/i18n/i18n'
import { useIntlLocale, useTranslate, type Translate } from '@/i18n/use-translate'
diff --git a/src/renderer/src/components/automations/AutomationDeleteDialogs.tsx b/src/renderer/src/components/automations/authoring/AutomationDeleteDialogs.tsx
similarity index 95%
rename from src/renderer/src/components/automations/AutomationDeleteDialogs.tsx
rename to src/renderer/src/components/automations/authoring/AutomationDeleteDialogs.tsx
index e440982e095..f5f46a51520 100644
--- a/src/renderer/src/components/automations/AutomationDeleteDialogs.tsx
+++ b/src/renderer/src/components/automations/authoring/AutomationDeleteDialogs.tsx
@@ -9,13 +9,13 @@ import {
DialogHeader,
DialogTitle
} from '@/components/ui/dialog'
-import type { Automation } from '../../../../shared/automations/automation-definition'
+import type { Automation } from '../../../../../shared/automations/automation-definition'
import type {
ExternalAutomationJob,
ExternalAutomationManager
-} from '../../../../shared/automations/external/external-automation'
-import { getExternalAutomationScheduleDisplay } from './external-automation-schedule-display'
-import { getExternalProviderLabel } from './external-automation-display'
+} from '../../../../../shared/automations/external/external-automation'
+import { getExternalAutomationScheduleDisplay } from '../external/external-automation-schedule-display'
+import { getExternalProviderLabel } from '../external/external-automation-display'
import { Trans } from 'react-i18next'
import { i18n } from '@/i18n/i18n'
import { useIntlLocale, useTranslate } from '@/i18n/use-translate'
diff --git a/src/renderer/src/components/automations/AutomationDestinationField.tsx b/src/renderer/src/components/automations/authoring/AutomationDestinationField.tsx
similarity index 96%
rename from src/renderer/src/components/automations/AutomationDestinationField.tsx
rename to src/renderer/src/components/automations/authoring/AutomationDestinationField.tsx
index c2d8492df83..3d1971ec4d8 100644
--- a/src/renderer/src/components/automations/AutomationDestinationField.tsx
+++ b/src/renderer/src/components/automations/authoring/AutomationDestinationField.tsx
@@ -1,14 +1,14 @@
import React from 'react'
import { HostCombobox } from '@/components/host-picker/HostCombobox'
import { useTranslate } from '@/i18n/use-translate'
-import { AutomationHostLabel, AutomationHostStatusBadges } from './AutomationHostBadges'
-import { Field } from './automation-page-parts'
+import { AutomationHostLabel, AutomationHostStatusBadges } from '../hosts/AutomationHostBadges'
+import { Field } from '../automation-page-parts'
import {
automationCreateHostEligible,
automationCreateHostOffered,
automationCreateUpdateRequiredAuthorityLabels
} from './automation-create-destination'
-import { groupAutomationHostEntriesByAuthority } from './automation-host-picker-groups'
+import { groupAutomationHostEntriesByAuthority } from '../hosts/automation-host-picker-groups'
import type { AutomationCreateDestinationControl } from './use-automation-create-destination'
// This host stores/schedules the automation and may differ from workspace execution; saving an existing record elsewhere moves it.
diff --git a/src/renderer/src/components/automations/AutomationEditorDialog.tsx b/src/renderer/src/components/automations/authoring/AutomationEditorDialog.tsx
similarity index 87%
rename from src/renderer/src/components/automations/AutomationEditorDialog.tsx
rename to src/renderer/src/components/automations/authoring/AutomationEditorDialog.tsx
index 9a8b4ac659e..55e3087582b 100644
--- a/src/renderer/src/components/automations/AutomationEditorDialog.tsx
+++ b/src/renderer/src/components/automations/authoring/AutomationEditorDialog.tsx
@@ -1,6 +1,6 @@
-import type { AutomationAuthorityRef } from '../../../../shared/automations/ownership/automation-owner-ref'
+import type { AutomationAuthorityRef } from '../../../../../shared/automations/ownership/automation-owner-ref'
import React from 'react'
-import { useAppStore } from '@/store'
+import { useAppStore } from '@/store/index'
import { selectAgentLaunchRouteView } from '@/lib/agent-session/launch/routing/agent-launch-route-input'
import { useChatProgramFacts } from '@/lib/host-chat-program-acquisition'
import {
@@ -10,26 +10,26 @@ import {
} from './automation-launch-surface'
import { Dialog, DialogContent } from '@/components/ui/dialog'
import { getAgentCatalog } from '@/lib/agent-catalog/agent-catalog'
-import { filterEnabledTuiAgents } from '../../../../shared/agent-launch/catalog/tui-agent-selection'
+import { filterEnabledTuiAgents } from '../../../../../shared/agent-launch/catalog/tui-agent-selection'
import type {
AutomationLaunchPreferences,
AutomationLaunchSetupPatch
-} from '../../../../shared/automations/launch/automation-launch-types'
+} from '../../../../../shared/automations/launch/automation-launch-types'
import type {
AutomationSchedulePreset,
AutomationWorkspaceMode
-} from '../../../../shared/automations/automation-definition'
-import type { GlobalSettings } from '../../../../shared/global-settings-types'
-import type { OrcaHooks } from '../../../../shared/orca-yaml-hook-types'
-import type { ProjectHostSetup } from '../../../../shared/project-types'
-import type { Repo } from '../../../../shared/repo-types'
-import type { TuiAgent } from '../../../../shared/agent-launch/catalog/tui-agent'
-import type { SetupDecision } from '../../../../shared/worktree/create-types'
-import type { Worktree } from '../../../../shared/worktree/types'
+} from '../../../../../shared/automations/automation-definition'
+import type { GlobalSettings } from '../../../../../shared/global-settings-types'
+import type { OrcaHooks } from '../../../../../shared/orca-yaml-hook-types'
+import type { ProjectHostSetup } from '../../../../../shared/project-types'
+import type { Repo } from '../../../../../shared/repo-types'
+import type { TuiAgent } from '../../../../../shared/agent-launch/catalog/tui-agent'
+import type { SetupDecision } from '../../../../../shared/worktree/create-types'
+import type { Worktree } from '../../../../../shared/worktree/types'
import { closeUnfocusedMonacoFindOrPreventDialogDismiss } from '@/components/editor/monaco-find-widget'
-import { AutomationOwnerConflictNotice } from './AutomationOwnerConflictNotice'
-import type { AutomationActionNotice } from './automation-row-action-dispatch'
-import type { AutomationHostRecoveryAction } from './automation-host-status-descriptors'
+import { AutomationOwnerConflictNotice } from '../hosts/AutomationOwnerConflictNotice'
+import type { AutomationActionNotice } from '../hosts/automation-row-action-dispatch'
+import type { AutomationHostRecoveryAction } from '../hosts/automation-host-status-descriptors'
import type { AutomationCreateDestinationControl } from './use-automation-create-destination'
import { AutomationEditorDialogFooter } from './AutomationEditorDialogFooter'
import { AutomationEditorDialogHeader } from './AutomationEditorDialogHeader'
diff --git a/src/renderer/src/components/automations/AutomationEditorDialogFooter.tsx b/src/renderer/src/components/automations/authoring/AutomationEditorDialogFooter.tsx
similarity index 100%
rename from src/renderer/src/components/automations/AutomationEditorDialogFooter.tsx
rename to src/renderer/src/components/automations/authoring/AutomationEditorDialogFooter.tsx
diff --git a/src/renderer/src/components/automations/AutomationEditorDialogHeader.tsx b/src/renderer/src/components/automations/authoring/AutomationEditorDialogHeader.tsx
similarity index 100%
rename from src/renderer/src/components/automations/AutomationEditorDialogHeader.tsx
rename to src/renderer/src/components/automations/authoring/AutomationEditorDialogHeader.tsx
diff --git a/src/renderer/src/components/automations/AutomationEditorPromptEditor.test.tsx b/src/renderer/src/components/automations/authoring/AutomationEditorPromptEditor.test.tsx
similarity index 58%
rename from src/renderer/src/components/automations/AutomationEditorPromptEditor.test.tsx
rename to src/renderer/src/components/automations/authoring/AutomationEditorPromptEditor.test.tsx
index 4db710ee4f4..d9614be0865 100644
--- a/src/renderer/src/components/automations/AutomationEditorPromptEditor.test.tsx
+++ b/src/renderer/src/components/automations/authoring/AutomationEditorPromptEditor.test.tsx
@@ -15,7 +15,7 @@ vi.mock('@monaco-editor/react', () => ({
loader: { config: vi.fn() }
}))
vi.mock('@/lib/editor/monaco/monaco-setup', () => ({ monaco: {} }))
-vi.mock('@/store', () => ({
+vi.mock('@/store/index', () => ({
useAppStore: (selector: (state: Record) => unknown) =>
selector({
settings: { theme: 'dark', terminalFontSize: 13, terminalFontFamily: 'monospace' },
@@ -30,12 +30,7 @@ vi.mock('@/components/editor/monaco-content-sync', () => ({
syncContentUpdate
}))
-import { closeUnfocusedMonacoFindOrPreventDialogDismiss } from '@/components/editor/monaco-find-widget'
-import {
- AUTOMATION_PROMPT_EDITOR_SLOT,
- AutomationEditorPromptEditor,
- getAutomationPromptEditorRoot
-} from './AutomationEditorPromptEditor'
+import { AutomationEditorPromptEditor } from './AutomationEditorPromptEditor'
afterEach(() => {
cleanup()
@@ -75,37 +70,4 @@ describe('AutomationEditorPromptEditor', () => {
editorDom.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }))
expect(onDismiss).toHaveBeenCalledTimes(1)
})
-
- it('scopes find-widget lookups to the prompt editor slot, not the document', () => {
- const dialog = document.createElement('div')
- const editorRoot = document.createElement('div')
- editorRoot.setAttribute('data-slot', AUTOMATION_PROMPT_EDITOR_SLOT)
- const nameField = document.createElement('input')
- const background = document.createElement('div')
- const backgroundFind = document.createElement('div')
- backgroundFind.className = 'find-widget'
- const closeButton = document.createElement('button')
- closeButton.className = 'button codicon-widget-close'
- const onBackgroundClose = vi.fn()
- closeButton.addEventListener('click', onBackgroundClose)
- backgroundFind.append(closeButton)
- background.append(backgroundFind)
- dialog.append(editorRoot, nameField)
- document.body.append(dialog, background)
-
- expect(getAutomationPromptEditorRoot(dialog)).toBe(editorRoot)
- // Radix Escape fires on document; document-wide lookup could find editors behind the dialog.
- expect(getAutomationPromptEditorRoot(document)).toBeNull()
- expect(getAutomationPromptEditorRoot(null)).toBeNull()
- expect(
- closeUnfocusedMonacoFindOrPreventDialogDismiss({
- root: getAutomationPromptEditorRoot(dialog),
- eventTarget: nameField
- })
- ).toBe(false)
- expect(onBackgroundClose).not.toHaveBeenCalled()
-
- dialog.remove()
- background.remove()
- })
})
diff --git a/src/renderer/src/components/automations/AutomationEditorPromptEditor.tsx b/src/renderer/src/components/automations/authoring/AutomationEditorPromptEditor.tsx
similarity index 100%
rename from src/renderer/src/components/automations/AutomationEditorPromptEditor.tsx
rename to src/renderer/src/components/automations/authoring/AutomationEditorPromptEditor.tsx
diff --git a/src/renderer/src/components/automations/AutomationEditorPromptSection.tsx b/src/renderer/src/components/automations/authoring/AutomationEditorPromptSection.tsx
similarity index 100%
rename from src/renderer/src/components/automations/AutomationEditorPromptSection.tsx
rename to src/renderer/src/components/automations/authoring/AutomationEditorPromptSection.tsx
diff --git a/src/renderer/src/components/automations/AutomationEditorSettingsSidebar.tsx b/src/renderer/src/components/automations/authoring/AutomationEditorSettingsSidebar.tsx
similarity index 90%
rename from src/renderer/src/components/automations/AutomationEditorSettingsSidebar.tsx
rename to src/renderer/src/components/automations/authoring/AutomationEditorSettingsSidebar.tsx
index 6c89609af50..f7a0c642f9a 100644
--- a/src/renderer/src/components/automations/AutomationEditorSettingsSidebar.tsx
+++ b/src/renderer/src/components/automations/authoring/AutomationEditorSettingsSidebar.tsx
@@ -1,15 +1,15 @@
-import type { AutomationAuthorityRef } from '../../../../shared/automations/ownership/automation-owner-ref'
+import type { AutomationAuthorityRef } from '../../../../../shared/automations/ownership/automation-owner-ref'
import { AutomationAgentLaunchPicker } from './AutomationAgentLaunchPicker'
import type { ProspectiveWorkspace } from '@/lib/agent-session/launch/routing/agent-launch-route-input'
import { useTranslate } from '@/i18n/use-translate'
-import { isValidAutomationSchedule } from '../../../../shared/automations/scheduling/automation-schedule-parsing'
-import type { GlobalSettings } from '../../../../shared/global-settings-types'
-import type { OrcaHooks } from '../../../../shared/orca-yaml-hook-types'
-import type { ProjectHostSetup } from '../../../../shared/project-types'
-import type { Repo } from '../../../../shared/repo-types'
-import type { Worktree } from '../../../../shared/worktree/types'
+import { isValidAutomationSchedule } from '../../../../../shared/automations/scheduling/automation-schedule-parsing'
+import type { GlobalSettings } from '../../../../../shared/global-settings-types'
+import type { OrcaHooks } from '../../../../../shared/orca-yaml-hook-types'
+import type { ProjectHostSetup } from '../../../../../shared/project-types'
+import type { Repo } from '../../../../../shared/repo-types'
+import type { Worktree } from '../../../../../shared/worktree/types'
import type { AgentCatalogEntry } from '@/lib/agent-catalog/agent-catalog'
-import { AUTOMATION_EDITOR_SECTION_LABEL_CLASS, Field } from './automation-page-parts'
+import { AUTOMATION_EDITOR_SECTION_LABEL_CLASS, Field } from '../automation-page-parts'
import { AutomationMissedRunGraceField } from './AutomationMissedRunGraceField'
import { AutomationPrecheckFields } from './AutomationPrecheckFields'
import AutomationProjectCombobox from './AutomationProjectCombobox'
diff --git a/src/renderer/src/components/automations/AutomationExtraAgentArgsField.tsx b/src/renderer/src/components/automations/authoring/AutomationExtraAgentArgsField.tsx
similarity index 96%
rename from src/renderer/src/components/automations/AutomationExtraAgentArgsField.tsx
rename to src/renderer/src/components/automations/authoring/AutomationExtraAgentArgsField.tsx
index 26d21337223..e00587e9adf 100644
--- a/src/renderer/src/components/automations/AutomationExtraAgentArgsField.tsx
+++ b/src/renderer/src/components/automations/authoring/AutomationExtraAgentArgsField.tsx
@@ -6,8 +6,8 @@ import {
getExtraAgentArgsPlaceholder,
hasExtraAgentArgs,
supportsExtraAgentArgs
-} from '../../../../shared/agent-launch/startup/automation-extra-agent-args'
-import { AUTOMATION_EDITOR_SECTION_LABEL_CLASS } from './automation-page-parts'
+} from '../../../../../shared/agent-launch/startup/automation-extra-agent-args'
+import { AUTOMATION_EDITOR_SECTION_LABEL_CLASS } from '../automation-page-parts'
import {
draftExtraAgentArgsNeedFreshSession,
getDraftExtraAgentArgsError
diff --git a/src/renderer/src/components/automations/AutomationMissedRunGraceField.tsx b/src/renderer/src/components/automations/authoring/AutomationMissedRunGraceField.tsx
similarity index 97%
rename from src/renderer/src/components/automations/AutomationMissedRunGraceField.tsx
rename to src/renderer/src/components/automations/authoring/AutomationMissedRunGraceField.tsx
index 1da1c632957..cb92db8ffe9 100644
--- a/src/renderer/src/components/automations/AutomationMissedRunGraceField.tsx
+++ b/src/renderer/src/components/automations/authoring/AutomationMissedRunGraceField.tsx
@@ -7,7 +7,7 @@ import {
SelectValue
} from '@/components/ui/select'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
-import { AUTOMATION_EDITOR_SECTION_LABEL_CLASS, Field } from './automation-page-parts'
+import { AUTOMATION_EDITOR_SECTION_LABEL_CLASS, Field } from '../automation-page-parts'
import type { AutomationDraft } from './AutomationEditorDialog'
import { useTranslate } from '@/i18n/use-translate'
diff --git a/src/renderer/src/components/automations/AutomationPrecheckFields.tsx b/src/renderer/src/components/automations/authoring/AutomationPrecheckFields.tsx
similarity index 97%
rename from src/renderer/src/components/automations/AutomationPrecheckFields.tsx
rename to src/renderer/src/components/automations/authoring/AutomationPrecheckFields.tsx
index 696e93da1b9..53458d156e0 100644
--- a/src/renderer/src/components/automations/AutomationPrecheckFields.tsx
+++ b/src/renderer/src/components/automations/authoring/AutomationPrecheckFields.tsx
@@ -5,7 +5,7 @@ import {
SelectTrigger,
SelectValue
} from '@/components/ui/select'
-import { AUTOMATION_EDITOR_SECTION_LABEL_CLASS, Field } from './automation-page-parts'
+import { AUTOMATION_EDITOR_SECTION_LABEL_CLASS, Field } from '../automation-page-parts'
import type { AutomationDraft } from './AutomationEditorDialog'
import { useTranslate } from '@/i18n/use-translate'
diff --git a/src/renderer/src/components/automations/AutomationProjectCombobox.tsx b/src/renderer/src/components/automations/authoring/AutomationProjectCombobox.tsx
similarity index 98%
rename from src/renderer/src/components/automations/AutomationProjectCombobox.tsx
rename to src/renderer/src/components/automations/authoring/AutomationProjectCombobox.tsx
index c68704f2f67..490c23c1751 100644
--- a/src/renderer/src/components/automations/AutomationProjectCombobox.tsx
+++ b/src/renderer/src/components/automations/authoring/AutomationProjectCombobox.tsx
@@ -4,15 +4,15 @@ import { Button } from '@/components/ui/button'
import { Command, CommandInput, CommandList } from '@/components/ui/command'
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
import RepoBadgeLabel from '@/components/repo/RepoBadgeLabel'
-import { useAppStore } from '@/store'
-import { isGitRepoKind } from '../../../../shared/repo-kind'
-import { getRepoExecutionHostId } from '../../../../shared/execution-host'
+import { useAppStore } from '@/store/index'
+import { isGitRepoKind } from '../../../../../shared/repo-kind'
+import { getRepoExecutionHostId } from '../../../../../shared/execution-host'
import { isRepoSearchQueryTooLarge, searchRepos } from '@/lib/repo-search'
import { cn } from '@/lib/utils'
import { useMountedRef } from '@/hooks/useMountedRef'
import { useTranslate } from '@/i18n/use-translate'
import { projectHostCountLabel } from '@/components/project-host-count-label'
-import type { Repo } from '../../../../shared/repo-types'
+import type { Repo } from '../../../../../shared/repo-types'
import {
getAutomationProjectGroupForRepo,
getAutomationProjectGroups,
diff --git a/src/renderer/src/components/automations/AutomationSchedulePicker.test.ts b/src/renderer/src/components/automations/authoring/AutomationSchedulePicker.test.ts
similarity index 100%
rename from src/renderer/src/components/automations/AutomationSchedulePicker.test.ts
rename to src/renderer/src/components/automations/authoring/AutomationSchedulePicker.test.ts
diff --git a/src/renderer/src/components/automations/AutomationSchedulePicker.tsx b/src/renderer/src/components/automations/authoring/AutomationSchedulePicker.tsx
similarity index 92%
rename from src/renderer/src/components/automations/AutomationSchedulePicker.tsx
rename to src/renderer/src/components/automations/authoring/AutomationSchedulePicker.tsx
index 5b30f4d85b9..7a8147234fc 100644
--- a/src/renderer/src/components/automations/AutomationSchedulePicker.tsx
+++ b/src/renderer/src/components/automations/authoring/AutomationSchedulePicker.tsx
@@ -6,14 +6,14 @@ import {
SelectTrigger,
SelectValue
} from '@/components/ui/select'
-import type { AutomationSchedulePreset } from '../../../../shared/automations/automation-definition'
-import { buildAutomationCronSchedule } from '../../../../shared/automations/scheduling/automation-schedule-occurrences'
-import { isValidAutomationSchedule } from '../../../../shared/automations/scheduling/automation-schedule-parsing'
+import type { AutomationSchedulePreset } from '../../../../../shared/automations/automation-definition'
+import { buildAutomationCronSchedule } from '../../../../../shared/automations/scheduling/automation-schedule-occurrences'
+import { isValidAutomationSchedule } from '../../../../../shared/automations/scheduling/automation-schedule-parsing'
import type { AutomationDraft } from './AutomationEditorDialog'
import { AutomationCustomCronPanel } from './AutomationCustomCronPanel'
-import { acceptsAutomationDraftSchedule } from '../../../../shared/automations/scheduling/automation-schedule-input-gate'
+import { acceptsAutomationDraftSchedule } from '../../../../../shared/automations/scheduling/automation-schedule-input-gate'
import { AutomationTimeField, parseAutomationTime } from './AutomationTimeField'
-import { Field } from './automation-page-parts'
+import { Field } from '../automation-page-parts'
import { translate } from '@/i18n/i18n'
import { useIntlLocale, useTranslate, type Translate } from '@/i18n/use-translate'
import { getUiWeekdayNames } from '@/i18n/weekday-names'
diff --git a/src/renderer/src/components/automations/AutomationSessionField.tsx b/src/renderer/src/components/automations/authoring/AutomationSessionField.tsx
similarity index 96%
rename from src/renderer/src/components/automations/AutomationSessionField.tsx
rename to src/renderer/src/components/automations/authoring/AutomationSessionField.tsx
index 685bef4f1cc..5113ada679f 100644
--- a/src/renderer/src/components/automations/AutomationSessionField.tsx
+++ b/src/renderer/src/components/automations/authoring/AutomationSessionField.tsx
@@ -1,7 +1,7 @@
import { Info } from 'lucide-react'
import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
-import { AUTOMATION_EDITOR_SECTION_LABEL_CLASS, Field } from './automation-page-parts'
+import { AUTOMATION_EDITOR_SECTION_LABEL_CLASS, Field } from '../automation-page-parts'
import type { AutomationDraft } from './AutomationEditorDialog'
import { useTranslate } from '@/i18n/use-translate'
diff --git a/src/renderer/src/components/automations/AutomationSetupDecisionField.tsx b/src/renderer/src/components/automations/authoring/AutomationSetupDecisionField.tsx
similarity index 94%
rename from src/renderer/src/components/automations/AutomationSetupDecisionField.tsx
rename to src/renderer/src/components/automations/authoring/AutomationSetupDecisionField.tsx
index b31109af38d..a4ff868a06c 100644
--- a/src/renderer/src/components/automations/AutomationSetupDecisionField.tsx
+++ b/src/renderer/src/components/automations/authoring/AutomationSetupDecisionField.tsx
@@ -5,9 +5,9 @@ import { cn } from '@/lib/utils'
import { useTranslate } from '@/i18n/use-translate'
import { getVisibleAutomationSetupDecision } from './automation-setup-decision'
import type { AutomationDraft } from './AutomationEditorDialog'
-import type { OrcaHooks } from '../../../../shared/orca-yaml-hook-types'
-import type { ProjectHostSetup } from '../../../../shared/project-types'
-import type { Repo } from '../../../../shared/repo-types'
+import type { OrcaHooks } from '../../../../../shared/orca-yaml-hook-types'
+import type { ProjectHostSetup } from '../../../../../shared/project-types'
+import type { Repo } from '../../../../../shared/repo-types'
type AutomationSetupDecisionFieldProps = {
draft: AutomationDraft
diff --git a/src/renderer/src/components/automations/AutomationSurfaceField.tsx b/src/renderer/src/components/automations/authoring/AutomationSurfaceField.tsx
similarity index 88%
rename from src/renderer/src/components/automations/AutomationSurfaceField.tsx
rename to src/renderer/src/components/automations/authoring/AutomationSurfaceField.tsx
index 578df279d75..14932800b73 100644
--- a/src/renderer/src/components/automations/AutomationSurfaceField.tsx
+++ b/src/renderer/src/components/automations/authoring/AutomationSurfaceField.tsx
@@ -1,8 +1,8 @@
import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group'
import { useTranslate } from '@/i18n/use-translate'
-import { nativeChatPreferenceFor } from '../../../../shared/structured-native-chat-launch-route'
-import type { GlobalSettings } from '../../../../shared/global-settings-types'
-import { Field, AUTOMATION_EDITOR_SECTION_LABEL_CLASS } from './automation-page-parts'
+import { nativeChatPreferenceFor } from '../../../../../shared/structured-native-chat-launch-route'
+import type { GlobalSettings } from '../../../../../shared/global-settings-types'
+import { Field, AUTOMATION_EDITOR_SECTION_LABEL_CLASS } from '../automation-page-parts'
import { automationDraftSurface } from './automation-launch-surface'
import type { AutomationDraft } from './AutomationEditorDialog'
diff --git a/src/renderer/src/components/automations/AutomationTemplateEmptyState.tsx b/src/renderer/src/components/automations/authoring/AutomationTemplateEmptyState.tsx
similarity index 100%
rename from src/renderer/src/components/automations/AutomationTemplateEmptyState.tsx
rename to src/renderer/src/components/automations/authoring/AutomationTemplateEmptyState.tsx
diff --git a/src/renderer/src/components/automations/AutomationTimeField.tsx b/src/renderer/src/components/automations/authoring/AutomationTimeField.tsx
similarity index 100%
rename from src/renderer/src/components/automations/AutomationTimeField.tsx
rename to src/renderer/src/components/automations/authoring/AutomationTimeField.tsx
diff --git a/src/renderer/src/components/automations/AutomationWorkspaceField.tsx b/src/renderer/src/components/automations/authoring/AutomationWorkspaceField.tsx
similarity index 92%
rename from src/renderer/src/components/automations/AutomationWorkspaceField.tsx
rename to src/renderer/src/components/automations/authoring/AutomationWorkspaceField.tsx
index ad51852484d..2c336336b0c 100644
--- a/src/renderer/src/components/automations/AutomationWorkspaceField.tsx
+++ b/src/renderer/src/components/automations/authoring/AutomationWorkspaceField.tsx
@@ -3,10 +3,10 @@ import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
import { CreateFromPicker } from '@/components/repo/CreateFromPicker'
import { useTranslate } from '@/i18n/use-translate'
-import type { AutomationWorkspaceMode } from '../../../../shared/automations/automation-definition'
-import type { Repo } from '../../../../shared/repo-types'
-import type { Worktree } from '../../../../shared/worktree/types'
-import { AUTOMATION_EDITOR_SECTION_LABEL_CLASS, Field } from './automation-page-parts'
+import type { AutomationWorkspaceMode } from '../../../../../shared/automations/automation-definition'
+import type { Repo } from '../../../../../shared/repo-types'
+import type { Worktree } from '../../../../../shared/worktree/types'
+import { AUTOMATION_EDITOR_SECTION_LABEL_CLASS, Field } from '../automation-page-parts'
import { WorkspaceCombobox } from './WorkspaceCombobox'
import type { AutomationDraft } from './AutomationEditorDialog'
diff --git a/src/renderer/src/components/automations/WorkspaceCombobox.tsx b/src/renderer/src/components/automations/authoring/WorkspaceCombobox.tsx
similarity index 98%
rename from src/renderer/src/components/automations/WorkspaceCombobox.tsx
rename to src/renderer/src/components/automations/authoring/WorkspaceCombobox.tsx
index 1cce751348a..a262dfe5940 100644
--- a/src/renderer/src/components/automations/WorkspaceCombobox.tsx
+++ b/src/renderer/src/components/automations/authoring/WorkspaceCombobox.tsx
@@ -10,7 +10,7 @@ import {
} from '@/components/ui/command'
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
import { cn } from '@/lib/utils'
-import type { Worktree } from '../../../../shared/worktree/types'
+import type { Worktree } from '../../../../../shared/worktree/types'
import { useTranslate } from '@/i18n/use-translate'
export function WorkspaceCombobox({
diff --git a/src/renderer/src/components/automations/automation-create-destination.ts b/src/renderer/src/components/automations/authoring/automation-create-destination.ts
similarity index 92%
rename from src/renderer/src/components/automations/automation-create-destination.ts
rename to src/renderer/src/components/automations/authoring/automation-create-destination.ts
index 0fbe5a5bbee..18cc3d8dfcd 100644
--- a/src/renderer/src/components/automations/automation-create-destination.ts
+++ b/src/renderer/src/components/automations/authoring/automation-create-destination.ts
@@ -3,24 +3,24 @@
import type {
AutomationAuthorityRef,
AutomationOwnerRef
-} from '../../../../shared/automations/ownership/automation-owner-ref'
-import type { AutomationDestination } from '../../../../shared/automations/ownership/automation-owner-precondition'
+} from '../../../../../shared/automations/ownership/automation-owner-ref'
+import type { AutomationDestination } from '../../../../../shared/automations/ownership/automation-owner-precondition'
import {
hostStableKey,
isSameAutomationOwner
-} from '../../../../shared/automations/ownership/automation-owner-key'
-import { getRepoSshConnectionId, parseExecutionHostId } from '../../../../shared/execution-host'
-import type { Repo } from '../../../../shared/repo-types'
+} from '../../../../../shared/automations/ownership/automation-owner-key'
+import { getRepoSshConnectionId, parseExecutionHostId } from '../../../../../shared/execution-host'
+import type { Repo } from '../../../../../shared/repo-types'
import type {
AutomationCatalogHydrationEvidence,
AutomationHostCatalogEntry
-} from './automation-host-catalog-types'
-import { automationAuthorityCatalogKey } from './automation-host-catalog-types'
+} from '../hosts/automation-host-catalog-types'
+import { automationAuthorityCatalogKey } from '../hosts/automation-host-catalog-types'
import {
repoConnectionIdIn,
type AutomationAuthorityRepoTables
-} from './automation-authority-identity'
-import { automationHostRecoveryActions } from './automation-host-status-descriptors'
+} from '../hosts/automation-authority-identity'
+import { automationHostRecoveryActions } from '../hosts/automation-host-status-descriptors'
export type AutomationCreateDestinationChoiceReason =
/** No host is selected and nothing may be assumed. */
diff --git a/src/renderer/src/components/automations/automation-create-projects.ts b/src/renderer/src/components/automations/authoring/automation-create-projects.ts
similarity index 76%
rename from src/renderer/src/components/automations/automation-create-projects.ts
rename to src/renderer/src/components/automations/authoring/automation-create-projects.ts
index e53a9e70891..b16915b23a6 100644
--- a/src/renderer/src/components/automations/automation-create-projects.ts
+++ b/src/renderer/src/components/automations/authoring/automation-create-projects.ts
@@ -2,9 +2,9 @@ import {
getRepoExecutionHostId,
parseExecutionHostId,
toRuntimeExecutionHostId
-} from '../../../../shared/execution-host'
-import type { Repo } from '../../../../shared/repo-types'
-import type { AutomationHostTarget } from './automation-host-client'
+} from '../../../../../shared/execution-host'
+import type { Repo } from '../../../../../shared/repo-types'
+import type { AutomationHostTarget } from '../hosts/automation-host-client'
/** Runtime creation uses that host’s repo catalog; desktop storage retains its SSH-capable catalog. */
export function getAutomationCreateRepos(
diff --git a/src/renderer/src/components/automations/automation-delete-confirm-preference.ts b/src/renderer/src/components/automations/authoring/automation-delete-confirm-preference.ts
similarity index 100%
rename from src/renderer/src/components/automations/automation-delete-confirm-preference.ts
rename to src/renderer/src/components/automations/authoring/automation-delete-confirm-preference.ts
diff --git a/src/renderer/src/components/automations/automation-draft-model.ts b/src/renderer/src/components/automations/authoring/automation-draft-model.ts
similarity index 87%
rename from src/renderer/src/components/automations/automation-draft-model.ts
rename to src/renderer/src/components/automations/authoring/automation-draft-model.ts
index cf776994c35..d084574cf52 100644
--- a/src/renderer/src/components/automations/automation-draft-model.ts
+++ b/src/renderer/src/components/automations/authoring/automation-draft-model.ts
@@ -1,12 +1,12 @@
-import { buildAutomationRrule } from '../../../../shared/automations/scheduling/automation-schedule-occurrences'
-import { automationLaunchInputs } from '../../../../shared/automations/launch/automation-launch-choices'
+import { buildAutomationRrule } from '../../../../../shared/automations/scheduling/automation-schedule-occurrences'
+import { automationLaunchInputs } from '../../../../../shared/automations/launch/automation-launch-choices'
import { getAgentCatalog } from '@/lib/agent-catalog/agent-catalog'
-import type { AutomationPrecheck } from '../../../../shared/automations/automation-definition'
-import type { Worktree } from '../../../../shared/worktree/types'
+import type { AutomationPrecheck } from '../../../../../shared/automations/automation-definition'
+import type { Worktree } from '../../../../../shared/worktree/types'
import {
hasExtraAgentArgs,
parseExtraAgentArgs
-} from '../../../../shared/agent-launch/startup/automation-extra-agent-args'
+} from '../../../../../shared/agent-launch/startup/automation-extra-agent-args'
import type { AutomationDraft } from './AutomationEditorDialog'
import { extraAgentArgsErrorText } from './automation-extra-agent-args-error-copy'
diff --git a/src/renderer/src/components/automations/automation-edit-draft.ts b/src/renderer/src/components/automations/authoring/automation-edit-draft.ts
similarity index 85%
rename from src/renderer/src/components/automations/automation-edit-draft.ts
rename to src/renderer/src/components/automations/authoring/automation-edit-draft.ts
index e379eb47a33..3156c8c19df 100644
--- a/src/renderer/src/components/automations/automation-edit-draft.ts
+++ b/src/renderer/src/components/automations/authoring/automation-edit-draft.ts
@@ -1,11 +1,11 @@
-import { automationCanonicalLaunchSetup } from '../../../../shared/automations/launch/automation-canonical-launch-setup'
-import type { Automation } from '../../../../shared/automations/automation-definition'
+import { automationCanonicalLaunchSetup } from '../../../../../shared/automations/launch/automation-canonical-launch-setup'
+import type { Automation } from '../../../../../shared/automations/automation-definition'
import { translate } from '@/i18n/i18n'
-import { getAutomationRunRepoId } from '../../../../shared/automations/history/automation-run-identity'
+import { getAutomationRunRepoId } from '../../../../../shared/automations/history/automation-run-identity'
import {
isRunnableAutomationSchedule,
tryParseAutomationRrule
-} from '../../../../shared/automations/scheduling/automation-schedule-parsing'
+} from '../../../../../shared/automations/scheduling/automation-schedule-parsing'
import type { AutomationDraft } from './AutomationEditorDialog'
import { AUTOMATION_DEFAULT_TIME, formatTimeInput } from './automation-draft-model'
import { getAutomationSetupDecisionDraftValue } from './automation-setup-decision'
diff --git a/src/renderer/src/components/automations/automation-editor-prompt-options.ts b/src/renderer/src/components/automations/authoring/automation-editor-prompt-options.ts
similarity index 100%
rename from src/renderer/src/components/automations/automation-editor-prompt-options.ts
rename to src/renderer/src/components/automations/authoring/automation-editor-prompt-options.ts
diff --git a/src/renderer/src/components/automations/automation-extra-agent-args-error-copy.ts b/src/renderer/src/components/automations/authoring/automation-extra-agent-args-error-copy.ts
similarity index 95%
rename from src/renderer/src/components/automations/automation-extra-agent-args-error-copy.ts
rename to src/renderer/src/components/automations/authoring/automation-extra-agent-args-error-copy.ts
index 3badaa76ade..aca921a61c2 100644
--- a/src/renderer/src/components/automations/automation-extra-agent-args-error-copy.ts
+++ b/src/renderer/src/components/automations/authoring/automation-extra-agent-args-error-copy.ts
@@ -3,7 +3,7 @@ import {
EXTRA_AGENT_ARGS_FAILURE_COPY as EN,
type ExtraAgentArgsFailure,
type ExtraAgentArgsFailureCode
-} from '../../../../shared/agent-launch/startup/automation-extra-agent-args'
+} from '../../../../../shared/agent-launch/startup/automation-extra-agent-args'
const COPY: Record) => string> = {
unsupportedAgent: () =>
diff --git a/src/renderer/src/components/automations/automation-launch-draft.ts b/src/renderer/src/components/automations/authoring/automation-launch-draft.ts
similarity index 82%
rename from src/renderer/src/components/automations/automation-launch-draft.ts
rename to src/renderer/src/components/automations/authoring/automation-launch-draft.ts
index b95c199fe21..dc3052a3358 100644
--- a/src/renderer/src/components/automations/automation-launch-draft.ts
+++ b/src/renderer/src/components/automations/authoring/automation-launch-draft.ts
@@ -1,13 +1,13 @@
-import { automationLegacyArguments } from '../../../../shared/automations/launch/automation-legacy-arguments'
-import { automationCanonicalLaunchSetup } from '../../../../shared/automations/launch/automation-canonical-launch-setup'
-import { hasModernAutomationLaunchSetup } from '../../../../shared/automations/launch/automation-launch-setup'
+import { automationLegacyArguments } from '../../../../../shared/automations/launch/automation-legacy-arguments'
+import { automationCanonicalLaunchSetup } from '../../../../../shared/automations/launch/automation-canonical-launch-setup'
+import { hasModernAutomationLaunchSetup } from '../../../../../shared/automations/launch/automation-launch-setup'
import {
foldAutomationSourceEdit,
type AutomationLaunchEdit
-} from '../../../../shared/automations/launch/automation-launch-source-edits'
-import { parseExtraAgentArgs } from '../../../../shared/agent-launch/startup/automation-extra-agent-args'
-import type { AgentPickerDraft } from '../../../../shared/agent-launch/picker/agent-launch-picker'
-import type { TuiAgent } from '../../../../shared/agent-launch/catalog/tui-agent'
+} from '../../../../../shared/automations/launch/automation-launch-source-edits'
+import { parseExtraAgentArgs } from '../../../../../shared/agent-launch/startup/automation-extra-agent-args'
+import type { AgentPickerDraft } from '../../../../../shared/agent-launch/picker/agent-launch-picker'
+import type { TuiAgent } from '../../../../../shared/agent-launch/catalog/tui-agent'
import type { AutomationDraft } from './AutomationEditorDialog'
export function editsSupplementalArguments(draft: AutomationDraft, modern: boolean): boolean {
diff --git a/src/renderer/src/components/automations/automation-launch-surface.ts b/src/renderer/src/components/automations/authoring/automation-launch-surface.ts
similarity index 87%
rename from src/renderer/src/components/automations/automation-launch-surface.ts
rename to src/renderer/src/components/automations/authoring/automation-launch-surface.ts
index 7f4a33eb19b..e14fc76a84f 100644
--- a/src/renderer/src/components/automations/automation-launch-surface.ts
+++ b/src/renderer/src/components/automations/authoring/automation-launch-surface.ts
@@ -1,22 +1,22 @@
-import { encodeAutomationLaunchEdit } from '../../../../shared/automations/launch/automation-launch-source-edits'
+import { encodeAutomationLaunchEdit } from '../../../../../shared/automations/launch/automation-launch-source-edits'
import {
applyAutomationLaunchSetupPatch,
hasModernAutomationLaunchSetup
-} from '../../../../shared/automations/launch/automation-launch-setup'
-import { automationCanonicalLaunchSetup } from '../../../../shared/automations/launch/automation-canonical-launch-setup'
+} from '../../../../../shared/automations/launch/automation-launch-setup'
+import { automationCanonicalLaunchSetup } from '../../../../../shared/automations/launch/automation-canonical-launch-setup'
import type {
Automation,
AutomationUpdateInput,
AutomationCreateInput
-} from '../../../../shared/automations/automation-definition'
-import type { GlobalSettings } from '../../../../shared/global-settings-types'
-import { AUTOMATION_SURFACE_RUNTIME_CAPABILITY } from '../../../../shared/automations/automation-runtime-capabilities'
+} from '../../../../../shared/automations/automation-definition'
+import type { GlobalSettings } from '../../../../../shared/global-settings-types'
+import { AUTOMATION_SURFACE_RUNTIME_CAPABILITY } from '../../../../../shared/automations/automation-runtime-capabilities'
import {
STRUCTURED_AGENT_SESSION_RUNTIME_CAPABILITY,
STRUCTURED_AGENT_SESSION_CLIENT_LAUNCH_MODE_CAPABILITY
-} from '../../../../shared/agent-session/agent-session-runtime-capabilities'
-import { STRUCTURED_AGENT_SESSION_REGISTERED_AGENTS_RUNTIME_CAPABILITY } from '../../../../shared/agent-session/structured-agent-session-surface-capabilities'
-import { nativeChatPreferenceFor } from '../../../../shared/structured-native-chat-launch-route'
+} from '../../../../../shared/agent-session/agent-session-runtime-capabilities'
+import { STRUCTURED_AGENT_SESSION_REGISTERED_AGENTS_RUNTIME_CAPABILITY } from '../../../../../shared/agent-session/structured-agent-session-surface-capabilities'
+import { nativeChatPreferenceFor } from '../../../../../shared/structured-native-chat-launch-route'
import {
buildAgentLaunchRouteInput,
type AgentLaunchRouteStore,
diff --git a/src/renderer/src/components/automations/automation-legacy-schedule-editing.test.ts b/src/renderer/src/components/automations/authoring/automation-legacy-schedule-editing.test.ts
similarity index 79%
rename from src/renderer/src/components/automations/automation-legacy-schedule-editing.test.ts
rename to src/renderer/src/components/automations/authoring/automation-legacy-schedule-editing.test.ts
index 0a6a49893b9..f6db545bc1d 100644
--- a/src/renderer/src/components/automations/automation-legacy-schedule-editing.test.ts
+++ b/src/renderer/src/components/automations/authoring/automation-legacy-schedule-editing.test.ts
@@ -1,10 +1,10 @@
import { describe, expect, it } from 'vitest'
-import type { Automation } from '../../../../shared/automations/automation-definition'
-import { isValidAutomationSchedule } from '../../../../shared/automations/scheduling/automation-schedule-parsing'
+import type { Automation } from '../../../../../shared/automations/automation-definition'
+import { isValidAutomationSchedule } from '../../../../../shared/automations/scheduling/automation-schedule-parsing'
import { buildAutomationEditDraft } from './automation-edit-draft'
-import { acceptsAutomationDraftSchedule } from '../../../../shared/automations/scheduling/automation-schedule-input-gate'
+import { acceptsAutomationDraftSchedule } from '../../../../../shared/automations/scheduling/automation-schedule-input-gate'
// `*/90` on minutes was accepted before the oversized-step refusal (#15895) and still runs,
// firing at :00. Only a row persisted by an older build can hold it.
@@ -70,9 +70,4 @@ describe('editing an automation whose saved schedule predates the input gate', (
})
// Only oversized steps receive legacy leniency; unparseable schedules still need warnings.
- it('keeps warning about a saved schedule that cannot be parsed', () => {
- const draft = buildAutomationEditDraft(makeAutomation({ rrule: '0 9 32 * *' }))
- expect(draft.customSchedule).toBe('')
- expect(draft.scheduleWarning).toBeTruthy()
- })
})
diff --git a/src/renderer/src/components/automations/automation-management-actions.ts b/src/renderer/src/components/automations/authoring/automation-management-actions.ts
similarity index 88%
rename from src/renderer/src/components/automations/automation-management-actions.ts
rename to src/renderer/src/components/automations/authoring/automation-management-actions.ts
index cec9ce5db34..df1e5eeb9b7 100644
--- a/src/renderer/src/components/automations/automation-management-actions.ts
+++ b/src/renderer/src/components/automations/authoring/automation-management-actions.ts
@@ -1,13 +1,16 @@
-import { deleteAutomationForTarget, updateAutomationForTarget } from './automation-host-client'
-import type { AutomationUpdateInput } from '../../../../shared/automations/automation-definition'
+import {
+ deleteAutomationForTarget,
+ updateAutomationForTarget
+} from '../hosts/automation-host-client'
+import type { AutomationUpdateInput } from '../../../../../shared/automations/automation-definition'
import {
dispatchAutomationDelete,
dispatchAutomationUpdate
-} from './automation-row-action-dispatch'
+} from '../hosts/automation-row-action-dispatch'
import { persistSkipDeleteAutomationConfirm } from './automation-delete-confirm-preference'
-import type { AutomationListRow } from './automation-list-row-identity'
-import type { AutomationsPageActionContext } from './automations-page-action-context'
-import type { SetupTrustMismatch } from '../../../../shared/worktree/create-types'
+import type { AutomationListRow } from '../listing/automation-list-row-identity'
+import type { AutomationsPageActionContext } from '../automations-page-action-context'
+import type { SetupTrustMismatch } from '../../../../../shared/worktree/create-types'
import { reviewAutomationSkippedSetup } from './automation-setup-review'
/** Fenced toggle/delete handlers and the confirmation preference flow. */
diff --git a/src/renderer/src/components/automations/automation-orca-save-operations.ts b/src/renderer/src/components/automations/authoring/automation-orca-save-operations.ts
similarity index 92%
rename from src/renderer/src/components/automations/automation-orca-save-operations.ts
rename to src/renderer/src/components/automations/authoring/automation-orca-save-operations.ts
index f3108678dcb..109cd8b3d3f 100644
--- a/src/renderer/src/components/automations/automation-orca-save-operations.ts
+++ b/src/renderer/src/components/automations/authoring/automation-orca-save-operations.ts
@@ -3,20 +3,20 @@ import type {
Automation,
AutomationCreateInput,
AutomationUpdateInput
-} from '../../../../shared/automations/automation-definition'
+} from '../../../../../shared/automations/automation-definition'
import type {
AutomationAuthorityRef,
StableAutomationCatalogRef
-} from '../../../../shared/automations/ownership/automation-owner-ref'
-import type { AutomationDestination } from '../../../../shared/automations/ownership/automation-owner-precondition'
+} from '../../../../../shared/automations/ownership/automation-owner-ref'
+import type { AutomationDestination } from '../../../../../shared/automations/ownership/automation-owner-precondition'
import { translate } from '@/i18n/i18n'
import type { Translate } from '@/i18n/use-translate'
import {
deleteAutomationForTarget,
listAutomationsForTarget,
updateAutomationForTarget
-} from './automation-host-client'
-import { createAutomationAtDestination } from './automation-owner-action-runner'
+} from '../hosts/automation-host-client'
+import { createAutomationAtDestination } from '../hosts/automation-owner-action-runner'
import {
dispatchAutomationDelete,
dispatchAutomationReread,
@@ -25,16 +25,16 @@ import {
type AutomationActionNotice,
type AutomationDispatchContext,
type AutomationDispatchResult
-} from './automation-row-action-dispatch'
+} from '../hosts/automation-row-action-dispatch'
import {
revalidateAutomationCreateDestination,
type AutomationCreateDestination
} from './automation-create-destination'
-import type { AutomationHostTarget } from './automation-host-client'
-import type { AutomationAuthorityChangeReason } from './automation-host-invalidation'
+import type { AutomationHostTarget } from '../hosts/automation-host-client'
+import type { AutomationAuthorityChangeReason } from '../hosts/automation-host-invalidation'
import type { AutomationSaveContext } from './automation-save-context'
-import { automationAuthorityCatalogKey } from './automation-host-catalog-types'
-import { createNonSecureContextUuid as createBrowserUuid } from '../../../../shared/non-secure-context-uuid'
+import { automationAuthorityCatalogKey } from '../hosts/automation-host-catalog-types'
+import { createNonSecureContextUuid as createBrowserUuid } from '../../../../../shared/non-secure-context-uuid'
export type AutomationMoveOperationContext = {
automationDispatchContext: AutomationDispatchContext
diff --git a/src/renderer/src/components/automations/automation-orca-save.ts b/src/renderer/src/components/automations/authoring/automation-orca-save.ts
similarity index 96%
rename from src/renderer/src/components/automations/automation-orca-save.ts
rename to src/renderer/src/components/automations/authoring/automation-orca-save.ts
index c3d7a76dc0f..eb6de9e658b 100644
--- a/src/renderer/src/components/automations/automation-orca-save.ts
+++ b/src/renderer/src/components/automations/authoring/automation-orca-save.ts
@@ -3,7 +3,7 @@ import {
recordedAutomationRunContext,
isSameAutomationWorkspace
} from './automation-recorded-target'
-import { capturedAutomationOwner } from './automation-captured-owner'
+import { capturedAutomationOwner } from '../hosts/automation-captured-owner'
import {
automationChatSupport,
automationDraftLaunchSetup,
@@ -15,16 +15,16 @@ import type {
Automation,
AutomationCreateInput,
AutomationUpdateInput
-} from '../../../../shared/automations/automation-definition'
-import { getRepoExecutionHostId } from '../../../../shared/execution-host'
+} from '../../../../../shared/automations/automation-definition'
+import { getRepoExecutionHostId } from '../../../../../shared/execution-host'
import { ensureHooksApproved } from '@/lib/ensure-hooks-confirmed'
import { translate } from '@/i18n/i18n'
-import { useAppStore } from '@/store'
-import { listAutomationsForTarget } from './automation-host-client'
+import { useAppStore } from '@/store/index'
+import { listAutomationsForTarget } from '../hosts/automation-host-client'
import {
dispatchAutomationReread,
type AutomationDispatchResult
-} from './automation-row-action-dispatch'
+} from '../hosts/automation-row-action-dispatch'
import { buildDraftPrecheck, buildDraftSchedule } from './automation-draft-model'
import { buildAutomationRunContextForRepo } from './automation-run-context'
import { resolveAutomationSetupDecisionForSave } from './automation-setup-decision'
diff --git a/src/renderer/src/components/automations/automation-project-groups.ts b/src/renderer/src/components/automations/authoring/automation-project-groups.ts
similarity index 90%
rename from src/renderer/src/components/automations/automation-project-groups.ts
rename to src/renderer/src/components/automations/authoring/automation-project-groups.ts
index 212d577f07b..6c1a61e5424 100644
--- a/src/renderer/src/components/automations/automation-project-groups.ts
+++ b/src/renderer/src/components/automations/authoring/automation-project-groups.ts
@@ -1,6 +1,9 @@
-import { getRepoExecutionHostId, LOCAL_EXECUTION_HOST_ID } from '../../../../shared/execution-host'
-import { getProjectIdentityKey } from '../../../../shared/project-host-setup-projection'
-import type { Repo } from '../../../../shared/repo-types'
+import {
+ getRepoExecutionHostId,
+ LOCAL_EXECUTION_HOST_ID
+} from '../../../../../shared/execution-host'
+import { getProjectIdentityKey } from '../../../../../shared/project-host-setup-projection'
+import type { Repo } from '../../../../../shared/repo-types'
export type AutomationProjectGroup = {
projectKey: string
diff --git a/src/renderer/src/components/automations/automation-recorded-target.ts b/src/renderer/src/components/automations/authoring/automation-recorded-target.ts
similarity index 73%
rename from src/renderer/src/components/automations/automation-recorded-target.ts
rename to src/renderer/src/components/automations/authoring/automation-recorded-target.ts
index 91f2014b738..e5485d44490 100644
--- a/src/renderer/src/components/automations/automation-recorded-target.ts
+++ b/src/renderer/src/components/automations/authoring/automation-recorded-target.ts
@@ -1,8 +1,8 @@
-import type { Automation } from '../../../../shared/automations/automation-definition'
-import { AUTOMATION_ORPHAN_ISSUES } from '../../../../shared/automations/ownership/automation-list-scope'
-import { parseExecutionHostId } from '../../../../shared/execution-host'
-import { automationAuthorityCatalogKey } from './automation-host-catalog-types'
-import type { AutomationCapturedOwner } from './automation-captured-owner'
+import type { Automation } from '../../../../../shared/automations/automation-definition'
+import { AUTOMATION_ORPHAN_ISSUES } from '../../../../../shared/automations/ownership/automation-list-scope'
+import { parseExecutionHostId } from '../../../../../shared/execution-host'
+import { automationAuthorityCatalogKey } from '../hosts/automation-host-catalog-types'
+import type { AutomationCapturedOwner } from '../hosts/automation-captured-owner'
import type { AutomationCreateDestination } from './automation-create-destination'
export function isSameAutomationWorkspace(
diff --git a/src/renderer/src/components/automations/automation-run-context.ts b/src/renderer/src/components/automations/authoring/automation-run-context.ts
similarity index 76%
rename from src/renderer/src/components/automations/automation-run-context.ts
rename to src/renderer/src/components/automations/authoring/automation-run-context.ts
index 5418f94f20f..8f5d55a035d 100644
--- a/src/renderer/src/components/automations/automation-run-context.ts
+++ b/src/renderer/src/components/automations/authoring/automation-run-context.ts
@@ -1,10 +1,10 @@
import {
buildWorkspaceRunContext,
type WorkspaceRunContext
-} from '../../../../shared/work-items/task-source-context'
-import type { ProjectHostSetup } from '../../../../shared/project-types'
-import type { Repo } from '../../../../shared/repo-types'
-import { getRepoExecutionHostId } from '../../../../shared/execution-host'
+} from '../../../../../shared/work-items/task-source-context'
+import type { ProjectHostSetup } from '../../../../../shared/project-types'
+import type { Repo } from '../../../../../shared/repo-types'
+import { getRepoExecutionHostId } from '../../../../../shared/execution-host'
export function buildAutomationRunContextForRepo(args: {
repoId: string
diff --git a/src/renderer/src/components/automations/automation-save-action.ts b/src/renderer/src/components/automations/authoring/automation-save-action.ts
similarity index 93%
rename from src/renderer/src/components/automations/automation-save-action.ts
rename to src/renderer/src/components/automations/authoring/automation-save-action.ts
index 4080cffef2e..03fba22b0c0 100644
--- a/src/renderer/src/components/automations/automation-save-action.ts
+++ b/src/renderer/src/components/automations/authoring/automation-save-action.ts
@@ -1,14 +1,14 @@
-import { useAppStore } from '@/store'
+import { useAppStore } from '@/store/index'
import {
automationChatSupport,
automationDraftSurface,
automationLaunchWorkspace
} from './automation-launch-surface'
import { toast } from 'sonner'
-import { isTuiAgentEnabled } from '../../../../shared/agent-launch/catalog/tui-agent-selection'
-import { isValidAutomationSchedule } from '../../../../shared/automations/scheduling/automation-schedule-parsing'
+import { isTuiAgentEnabled } from '../../../../../shared/agent-launch/catalog/tui-agent-selection'
+import { isValidAutomationSchedule } from '../../../../../shared/automations/scheduling/automation-schedule-parsing'
import { translate } from '@/i18n/i18n'
-import { acceptsAutomationDraftSchedule } from '../../../../shared/automations/scheduling/automation-schedule-input-gate'
+import { acceptsAutomationDraftSchedule } from '../../../../../shared/automations/scheduling/automation-schedule-input-gate'
import {
draftExtraAgentArgsNeedFreshSession,
getDraftExtraAgentArgsError,
diff --git a/src/renderer/src/components/automations/automation-save-completion.ts b/src/renderer/src/components/automations/authoring/automation-save-completion.ts
similarity index 92%
rename from src/renderer/src/components/automations/automation-save-completion.ts
rename to src/renderer/src/components/automations/authoring/automation-save-completion.ts
index 4b9794af39a..160c5bc580a 100644
--- a/src/renderer/src/components/automations/automation-save-completion.ts
+++ b/src/renderer/src/components/automations/authoring/automation-save-completion.ts
@@ -1,5 +1,5 @@
-import type { Automation } from '../../../../shared/automations/automation-definition'
-import { useAppStore } from '@/store'
+import type { Automation } from '../../../../../shared/automations/automation-definition'
+import { useAppStore } from '@/store/index'
import type { AutomationCreateDestination } from './automation-create-destination'
import type { AutomationSaveContext } from './automation-save-context'
import { showAutomationSavedToast } from './automation-orca-save-operations'
diff --git a/src/renderer/src/components/automations/automation-save-context.ts b/src/renderer/src/components/automations/authoring/automation-save-context.ts
similarity index 63%
rename from src/renderer/src/components/automations/automation-save-context.ts
rename to src/renderer/src/components/automations/authoring/automation-save-context.ts
index c0f69d4eeed..ea4449c7b5b 100644
--- a/src/renderer/src/components/automations/automation-save-context.ts
+++ b/src/renderer/src/components/automations/authoring/automation-save-context.ts
@@ -1,8 +1,8 @@
-import type { AutomationsPageListState } from './use-automations-page-list-state'
-import type { AutomationsPageLocalState } from './use-automations-page-local-state'
-import type { AutomationsPageRefresh } from './use-automations-page-refresh'
+import type { AutomationsPageListState } from '../listing/use-automations-page-list-state'
+import type { AutomationsPageLocalState } from '../use-automations-page-local-state'
+import type { AutomationsPageRefresh } from '../use-automations-page-refresh'
import type { AutomationsPageSetupState } from './use-automations-page-setup-state'
-import type { AutomationsPageStoreState } from './use-automations-page-store-state'
+import type { AutomationsPageStoreState } from '../use-automations-page-store-state'
import type { AutomationsPageDestinationState } from './use-automations-page-destination-state'
import type { AutomationsPageDestinationFormState } from './use-automations-page-destination-form'
diff --git a/src/renderer/src/components/automations/automation-setup-decision.test.ts b/src/renderer/src/components/automations/authoring/automation-setup-decision.test.ts
similarity index 96%
rename from src/renderer/src/components/automations/automation-setup-decision.test.ts
rename to src/renderer/src/components/automations/authoring/automation-setup-decision.test.ts
index e99e6edfb46..76d9b1b8b28 100644
--- a/src/renderer/src/components/automations/automation-setup-decision.test.ts
+++ b/src/renderer/src/components/automations/authoring/automation-setup-decision.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest'
-import type { ProjectHostSetup } from '../../../../shared/project-types'
-import type { Repo } from '../../../../shared/repo-types'
+import type { ProjectHostSetup } from '../../../../../shared/project-types'
+import type { Repo } from '../../../../../shared/repo-types'
import {
getVisibleAutomationSetupDecision,
resolveAutomationSetupDecisionForSave
diff --git a/src/renderer/src/components/automations/automation-setup-decision.ts b/src/renderer/src/components/automations/authoring/automation-setup-decision.ts
similarity index 77%
rename from src/renderer/src/components/automations/automation-setup-decision.ts
rename to src/renderer/src/components/automations/authoring/automation-setup-decision.ts
index b385ad0d4e9..0a012cecc2d 100644
--- a/src/renderer/src/components/automations/automation-setup-decision.ts
+++ b/src/renderer/src/components/automations/authoring/automation-setup-decision.ts
@@ -1,13 +1,13 @@
-import { getAutomationSetupDefaultDecision } from '../../../../shared/automations/launch/automation-setup-decision'
+import { getAutomationSetupDefaultDecision } from '../../../../../shared/automations/launch/automation-setup-decision'
-import type { AutomationWorkspaceMode } from '../../../../shared/automations/automation-definition'
-import type { OrcaHooks, SetupRunPolicy } from '../../../../shared/orca-yaml-hook-types'
-import type { ProjectHostSetup } from '../../../../shared/project-types'
-import type { Repo } from '../../../../shared/repo-types'
-import type { SetupDecision } from '../../../../shared/worktree/create-types'
-import { findAutomationRepo } from '../../../../shared/automations/ownership/automation-repo-target'
-import { getRepoExecutionHostId } from '../../../../shared/execution-host'
-import { getSetupConfig } from '../../../../shared/orca-hook-setup-config'
+import type { AutomationWorkspaceMode } from '../../../../../shared/automations/automation-definition'
+import type { OrcaHooks, SetupRunPolicy } from '../../../../../shared/orca-yaml-hook-types'
+import type { ProjectHostSetup } from '../../../../../shared/project-types'
+import type { Repo } from '../../../../../shared/repo-types'
+import type { SetupDecision } from '../../../../../shared/worktree/create-types'
+import { findAutomationRepo } from '../../../../../shared/automations/ownership/automation-repo-target'
+import { getRepoExecutionHostId } from '../../../../../shared/execution-host'
+import { getSetupConfig } from '../../../../../shared/orca-hook-setup-config'
type AutomationSetupSource = {
setupScript: string
diff --git a/src/renderer/src/components/automations/automation-setup-review.ts b/src/renderer/src/components/automations/authoring/automation-setup-review.ts
similarity index 89%
rename from src/renderer/src/components/automations/automation-setup-review.ts
rename to src/renderer/src/components/automations/authoring/automation-setup-review.ts
index 6ffe96eebb0..f93f37175cb 100644
--- a/src/renderer/src/components/automations/automation-setup-review.ts
+++ b/src/renderer/src/components/automations/authoring/automation-setup-review.ts
@@ -1,17 +1,17 @@
import { toast } from 'sonner'
import { translate } from '@/i18n/i18n'
-import { useAppStore } from '@/store'
+import { useAppStore } from '@/store/index'
import {
confirmCreatedWorktreeSetupContent,
ensureHooksApproved,
type HookTrustApproval
} from '@/lib/ensure-hooks-confirmed'
import type { AutomationSaveContext } from './automation-save-context'
-import type { Automation } from '../../../../shared/automations/automation-definition'
-import type { AutomationUsageSummary } from '../../../../shared/automations/history/automation-usage-summary'
-import { getAutomationRunRepoId } from '../../../../shared/automations/history/automation-run-identity'
-import type { SetupDecision, SetupTrustMismatch } from '../../../../shared/worktree/create-types'
-import type { ExecutionHostId } from '../../../../shared/execution-host'
+import type { Automation } from '../../../../../shared/automations/automation-definition'
+import type { AutomationUsageSummary } from '../../../../../shared/automations/history/automation-usage-summary'
+import { getAutomationRunRepoId } from '../../../../../shared/automations/history/automation-run-identity'
+import type { SetupDecision, SetupTrustMismatch } from '../../../../../shared/worktree/create-types'
+import type { ExecutionHostId } from '../../../../../shared/execution-host'
/** A skipped setup still waiting for approval; null once the automation approves that content. */
export type PendingAutomationSetupReview = { content: SetupTrustMismatch | null }
diff --git a/src/renderer/src/components/automations/automation-templates.ts b/src/renderer/src/components/automations/authoring/automation-templates.ts
similarity index 95%
rename from src/renderer/src/components/automations/automation-templates.ts
rename to src/renderer/src/components/automations/authoring/automation-templates.ts
index 07bbb809dcd..d65b01ad459 100644
--- a/src/renderer/src/components/automations/automation-templates.ts
+++ b/src/renderer/src/components/automations/authoring/automation-templates.ts
@@ -1,5 +1,5 @@
-import type { AutomationSchedulePreset } from '../../../../shared/automations/automation-definition'
-import type { TuiAgent } from '../../../../shared/agent-launch/catalog/tui-agent'
+import type { AutomationSchedulePreset } from '../../../../../shared/automations/automation-definition'
+import type { TuiAgent } from '../../../../../shared/agent-launch/catalog/tui-agent'
import { translate } from '@/i18n/i18n'
import { createLocalizedCatalog } from '@/i18n/localized-catalog'
diff --git a/src/renderer/src/components/automations/use-automation-agent-picker-entries.ts b/src/renderer/src/components/automations/authoring/use-automation-agent-picker-entries.ts
similarity index 91%
rename from src/renderer/src/components/automations/use-automation-agent-picker-entries.ts
rename to src/renderer/src/components/automations/authoring/use-automation-agent-picker-entries.ts
index fb7d2ba5a49..d672fcd21e5 100644
--- a/src/renderer/src/components/automations/use-automation-agent-picker-entries.ts
+++ b/src/renderer/src/components/automations/authoring/use-automation-agent-picker-entries.ts
@@ -9,9 +9,9 @@ import {
agentPickerDraft,
type AgentPickerDraft,
type AgentPickerEntry
-} from '../../../../shared/agent-launch/picker/agent-launch-picker'
-import { automationLaunchChoices } from '../../../../shared/automations/launch/automation-launch-choices'
-import { mergeExtraAgentArgs } from '../../../../shared/agent-launch/startup/automation-extra-agent-args'
+} from '../../../../../shared/agent-launch/picker/agent-launch-picker'
+import { automationLaunchChoices } from '../../../../../shared/automations/launch/automation-launch-choices'
+import { mergeExtraAgentArgs } from '../../../../../shared/agent-launch/startup/automation-extra-agent-args'
import type { AutomationDraft } from './AutomationEditorDialog'
import { automationChatSupport } from './automation-launch-surface'
diff --git a/src/renderer/src/components/automations/use-automation-create-destination.ts b/src/renderer/src/components/automations/authoring/use-automation-create-destination.ts
similarity index 95%
rename from src/renderer/src/components/automations/use-automation-create-destination.ts
rename to src/renderer/src/components/automations/authoring/use-automation-create-destination.ts
index f861781eedc..c820a1c4493 100644
--- a/src/renderer/src/components/automations/use-automation-create-destination.ts
+++ b/src/renderer/src/components/automations/authoring/use-automation-create-destination.ts
@@ -2,12 +2,12 @@
import { useCallback, useMemo, useRef, useState } from 'react'
import { translate } from '@/i18n/i18n'
-import type { Repo } from '../../../../shared/repo-types'
+import type { Repo } from '../../../../../shared/repo-types'
import type {
AutomationHostCatalog,
AutomationHostCatalogEntry
-} from './automation-host-catalog-types'
-import type { AutomationAuthorityRepoTables } from './automation-authority-identity'
+} from '../hosts/automation-host-catalog-types'
+import type { AutomationAuthorityRepoTables } from '../hosts/automation-authority-identity'
import {
automationCreateEligibleProjects,
automationCreateProjectMismatch,
@@ -19,7 +19,7 @@ import {
type AutomationCreateDestinationChoiceReason,
type AutomationCreateDestinationResolution
} from './automation-create-destination'
-import type { AutomationActionNotice } from './automation-row-action-dispatch'
+import type { AutomationActionNotice } from '../hosts/automation-row-action-dispatch'
export type AutomationCreateDestinationControl = {
entries: readonly AutomationHostCatalogEntry[]
diff --git a/src/renderer/src/components/automations/use-automation-draft-effects.ts b/src/renderer/src/components/automations/authoring/use-automation-draft-effects.ts
similarity index 95%
rename from src/renderer/src/components/automations/use-automation-draft-effects.ts
rename to src/renderer/src/components/automations/authoring/use-automation-draft-effects.ts
index e834c7b8e29..4f629e3c2fb 100644
--- a/src/renderer/src/components/automations/use-automation-draft-effects.ts
+++ b/src/renderer/src/components/automations/authoring/use-automation-draft-effects.ts
@@ -1,11 +1,11 @@
import { useCallback, useEffect } from 'react'
import type { AutomationTemplate } from './automation-templates'
import { getDefaultWorktree } from './automation-draft-model'
-import { hasModernAutomationLaunchSetup } from '../../../../shared/automations/launch/automation-launch-setup'
+import { hasModernAutomationLaunchSetup } from '../../../../../shared/automations/launch/automation-launch-setup'
import type { AutomationsPageDestinationState } from './use-automations-page-destination-state'
import type { AutomationsPageDestinationFormState } from './use-automations-page-destination-form'
-import type { AutomationsPageLocalState } from './use-automations-page-local-state'
-import type { AutomationsPageRefresh } from './use-automations-page-refresh'
+import type { AutomationsPageLocalState } from '../use-automations-page-local-state'
+import type { AutomationsPageRefresh } from '../use-automations-page-refresh'
import type { AutomationsPageSetupState } from './use-automations-page-setup-state'
/** Synchronizes draft defaults, setup policy, and templates. */
diff --git a/src/renderer/src/components/automations/use-automation-editor-actions.ts b/src/renderer/src/components/automations/authoring/use-automation-editor-actions.ts
similarity index 93%
rename from src/renderer/src/components/automations/use-automation-editor-actions.ts
rename to src/renderer/src/components/automations/authoring/use-automation-editor-actions.ts
index 82b640d7c75..83f7f7eaa11 100644
--- a/src/renderer/src/components/automations/use-automation-editor-actions.ts
+++ b/src/renderer/src/components/automations/authoring/use-automation-editor-actions.ts
@@ -1,18 +1,18 @@
import { useCallback } from 'react'
-import { toRuntimeExecutionHostId } from '../../../../shared/execution-host'
-import { useAppStore } from '@/store'
+import { toRuntimeExecutionHostId } from '../../../../../shared/execution-host'
+import { useAppStore } from '@/store/index'
import { buildAutomationEditDraft } from './automation-edit-draft'
import { AUTOMATION_DEFAULT_TIME, getDefaultWorktree } from './automation-draft-model'
import type { AutomationTemplate } from './automation-templates'
-import { dispatchAutomationReread } from './automation-row-action-dispatch'
-import { listAutomationsForTarget } from './automation-host-client'
+import { dispatchAutomationReread } from '../hosts/automation-row-action-dispatch'
+import { listAutomationsForTarget } from '../hosts/automation-host-client'
import { automationCreateHostFor } from './automation-create-destination'
import type { AutomationDraft } from './AutomationEditorDialog'
-import type { AutomationListRow } from './automation-list-row-identity'
+import type { AutomationListRow } from '../listing/automation-list-row-identity'
import type { AutomationsPageDestinationState } from './use-automations-page-destination-state'
import type { AutomationsPageDestinationFormState } from './use-automations-page-destination-form'
-import type { AutomationsPageLocalState } from './use-automations-page-local-state'
-import type { AutomationsPageStoreState } from './use-automations-page-store-state'
+import type { AutomationsPageLocalState } from '../use-automations-page-local-state'
+import type { AutomationsPageStoreState } from '../use-automations-page-store-state'
import { selectWorktreesByRepo } from '@/store/workspaces/catalog/workspace-record-fields'
/** Dialog open/edit actions, including host-captured re-reads and project changes. */
diff --git a/src/renderer/src/components/automations/use-automation-migrate-action.ts b/src/renderer/src/components/automations/authoring/use-automation-migrate-action.ts
similarity index 96%
rename from src/renderer/src/components/automations/use-automation-migrate-action.ts
rename to src/renderer/src/components/automations/authoring/use-automation-migrate-action.ts
index 5f1ff3f8662..7da73b5ce72 100644
--- a/src/renderer/src/components/automations/use-automation-migrate-action.ts
+++ b/src/renderer/src/components/automations/authoring/use-automation-migrate-action.ts
@@ -3,7 +3,7 @@ import { toast } from 'sonner'
import { resolveAutomationCreateDestination } from './automation-create-destination'
import { createAutomationSaveAction } from './automation-save-action'
import type { AutomationSaveContext } from './automation-save-context'
-import type { AutomationListRow } from './automation-list-row-identity'
+import type { AutomationListRow } from '../listing/automation-list-row-identity'
import type { AutomationEditorActions } from './use-automation-editor-actions'
/** Migrate: the editor's own move-to-server save, run without opening the dialog. */
diff --git a/src/renderer/src/components/automations/use-automations-page-destination-form.ts b/src/renderer/src/components/automations/authoring/use-automations-page-destination-form.ts
similarity index 93%
rename from src/renderer/src/components/automations/use-automations-page-destination-form.ts
rename to src/renderer/src/components/automations/authoring/use-automations-page-destination-form.ts
index d5bb66ccdf2..1142cf1664d 100644
--- a/src/renderer/src/components/automations/use-automations-page-destination-form.ts
+++ b/src/renderer/src/components/automations/authoring/use-automations-page-destination-form.ts
@@ -1,13 +1,13 @@
import { resolveAutomationEditDestination } from './automation-orca-save-operations'
-import { AUTOMATION_ORPHAN_ISSUES } from '../../../../shared/automations/ownership/automation-list-scope'
+import { AUTOMATION_ORPHAN_ISSUES } from '../../../../../shared/automations/ownership/automation-list-scope'
import {
recordedAutomationRunContext,
isSameAutomationWorkspace
} from './automation-recorded-target'
import { useCallback, useEffect, useMemo } from 'react'
-import { toRuntimeExecutionHostId } from '../../../../shared/execution-host'
+import { toRuntimeExecutionHostId } from '../../../../../shared/execution-host'
import { useTranslate } from '@/i18n/use-translate'
-import { automationWorktreesForRepo } from './automation-list-row-identity'
+import { automationWorktreesForRepo } from '../listing/automation-list-row-identity'
import { getAutomationCreateRepos } from './automation-create-projects'
import {
automationCreateEligibleProjects,
@@ -23,15 +23,18 @@ import {
getAutomationOwnerTarget,
getAutomationTargetFromHostId,
type AutomationHostTarget
-} from './automation-host-client'
-import { automationAuthorityCatalogKey } from './automation-host-catalog-types'
-import { capturedAutomationOwner, type AutomationCapturedOwner } from './automation-captured-owner'
+} from '../hosts/automation-host-client'
+import { automationAuthorityCatalogKey } from '../hosts/automation-host-catalog-types'
+import {
+ capturedAutomationOwner,
+ type AutomationCapturedOwner
+} from '../hosts/automation-captured-owner'
import { buildAutomationRunContextForRepo } from './automation-run-context'
import type { AutomationCreateDestinationControl } from './use-automation-create-destination'
import type { AutomationsPageDestinationState } from './use-automations-page-destination-state'
-import type { AutomationsPageListState } from './use-automations-page-list-state'
-import type { AutomationsPageLocalState } from './use-automations-page-local-state'
-import type { AutomationsPageStoreState } from './use-automations-page-store-state'
+import type { AutomationsPageListState } from '../listing/use-automations-page-list-state'
+import type { AutomationsPageLocalState } from '../use-automations-page-local-state'
+import type { AutomationsPageStoreState } from '../use-automations-page-store-state'
/** Editor project/workspace projections for the captured create or edit host. */
export function useAutomationsPageDestinationForm({
diff --git a/src/renderer/src/components/automations/use-automations-page-destination-state.ts b/src/renderer/src/components/automations/authoring/use-automations-page-destination-state.ts
similarity index 89%
rename from src/renderer/src/components/automations/use-automations-page-destination-state.ts
rename to src/renderer/src/components/automations/authoring/use-automations-page-destination-state.ts
index c0d47c2da88..2d45137da48 100644
--- a/src/renderer/src/components/automations/use-automations-page-destination-state.ts
+++ b/src/renderer/src/components/automations/authoring/use-automations-page-destination-state.ts
@@ -2,49 +2,52 @@ import { useCallback, useEffect, useMemo } from 'react'
import type {
AutomationAuthorityRef,
StableAutomationCatalogRef
-} from '../../../../shared/automations/ownership/automation-owner-ref'
+} from '../../../../../shared/automations/ownership/automation-owner-ref'
import {
getRepoExecutionHostId,
normalizeExecutionHostId,
toSshExecutionHostId,
toRuntimeExecutionHostId
-} from '../../../../shared/execution-host'
+} from '../../../../../shared/execution-host'
import {
automationCreateHostOffered,
automationCreateHostStableKey
} from './automation-create-destination'
-import { getAutomationHostTargetFromKey, type AutomationHostTarget } from './automation-host-client'
+import {
+ getAutomationHostTargetFromKey,
+ type AutomationHostTarget
+} from '../hosts/automation-host-client'
import {
capturedAutomationOwner,
isAutomationActionEnabled,
type AutomationRowAction
-} from './automation-captured-owner'
+} from '../hosts/automation-captured-owner'
import {
automationRowCatalogRef,
automationWriteChangeEvent
-} from './automation-write-invalidation'
-import { automationRowRecoveryHost } from './automation-notice-recovery-host'
+} from '../hosts/automation-write-invalidation'
+import { automationRowRecoveryHost } from '../hosts/automation-notice-recovery-host'
import type {
AutomationActionNotice,
AutomationDispatchContext
-} from './automation-row-action-dispatch'
+} from '../hosts/automation-row-action-dispatch'
import {
automationRuntimePairingRevision,
groupReposByAutomationAuthority
-} from './automation-authority-identity'
+} from '../hosts/automation-authority-identity'
import { resolveIndexedWorktreeOwner } from '@/lib/workspace/ownership/worktree-runtime-owner-index'
import {
createRepoRowExecutionHostLookup,
resolveWorktreeExecutionHost
-} from '../../../../shared/execution-host/worktree-execution-host-resolution'
-import { automationWorktreesForRepo } from './automation-list-row-identity'
+} from '../../../../../shared/execution-host/worktree-execution-host-resolution'
+import { automationWorktreesForRepo } from '../listing/automation-list-row-identity'
import { getDefaultWorktree } from './automation-draft-model'
-import type { AutomationsPageListState } from './use-automations-page-list-state'
-import type { AutomationsPageLocalState } from './use-automations-page-local-state'
-import type { AutomationsPageStoreState } from './use-automations-page-store-state'
+import type { AutomationsPageListState } from '../listing/use-automations-page-list-state'
+import type { AutomationsPageLocalState } from '../use-automations-page-local-state'
+import type { AutomationsPageStoreState } from '../use-automations-page-store-state'
import { useAutomationCreateDestination } from './use-automation-create-destination'
-import type { AutomationHostCatalogEntry } from './automation-host-catalog-types'
-import type { AutomationAuthorityChangeReason } from './automation-host-invalidation'
+import type { AutomationHostCatalogEntry } from '../hosts/automation-host-catalog-types'
+import type { AutomationAuthorityChangeReason } from '../hosts/automation-host-invalidation'
/** Host destination, owner fencing, and authority-scoped project/workspace choices. */
export function useAutomationsPageDestinationState({
diff --git a/src/renderer/src/components/automations/use-automations-page-setup-state.ts b/src/renderer/src/components/automations/authoring/use-automations-page-setup-state.ts
similarity index 91%
rename from src/renderer/src/components/automations/use-automations-page-setup-state.ts
rename to src/renderer/src/components/automations/authoring/use-automations-page-setup-state.ts
index da39b2ebd5f..3165a7fc94c 100644
--- a/src/renderer/src/components/automations/use-automations-page-setup-state.ts
+++ b/src/renderer/src/components/automations/authoring/use-automations-page-setup-state.ts
@@ -1,14 +1,17 @@
import { useCallback, useMemo } from 'react'
-import type { OrcaHooks } from '../../../../shared/orca-yaml-hook-types'
+import type { OrcaHooks } from '../../../../../shared/orca-yaml-hook-types'
import { checkRuntimeHooks } from '@/runtime/repo-hooks/runtime-hooks-client'
import type { AutomationDraft } from './AutomationEditorDialog'
-import { getAutomationHostTargetFromKey, type AutomationHostTarget } from './automation-host-client'
-import { getRepoExecutionHostId, type ExecutionHostId } from '../../../../shared/execution-host'
-import { findAutomationRepo } from '../../../../shared/automations/ownership/automation-repo-target'
+import {
+ getAutomationHostTargetFromKey,
+ type AutomationHostTarget
+} from '../hosts/automation-host-client'
+import { getRepoExecutionHostId, type ExecutionHostId } from '../../../../../shared/execution-host'
+import { findAutomationRepo } from '../../../../../shared/automations/ownership/automation-repo-target'
import { getVisibleAutomationSetupDecision } from './automation-setup-decision'
-import type { AutomationsPageListState } from './use-automations-page-list-state'
-import type { AutomationsPageLocalState } from './use-automations-page-local-state'
-import type { AutomationsPageStoreState } from './use-automations-page-store-state'
+import type { AutomationsPageListState } from '../listing/use-automations-page-list-state'
+import type { AutomationsPageLocalState } from '../use-automations-page-local-state'
+import type { AutomationsPageStoreState } from '../use-automations-page-store-state'
/** Draft setup policy, selected history, and the page's legacy host target. */
export function useAutomationsPageSetupState({
diff --git a/src/renderer/src/components/automations/automation-create-destination.test.ts b/src/renderer/src/components/automations/automation-create-destination.test.ts
deleted file mode 100644
index 006ce63d56c..00000000000
--- a/src/renderer/src/components/automations/automation-create-destination.test.ts
+++ /dev/null
@@ -1,48 +0,0 @@
-import { describe, expect, it } from 'vitest'
-import { buildAutomationHostCatalog } from './automation-host-catalog'
-import type { AutomationCatalogSshMirrorInput } from './automation-host-catalog-types'
-import {
- automationCreateHostOffered,
- preselectAutomationCreateHost
-} from './automation-create-destination'
-
-function mirror(
- targets: AutomationCatalogSshMirrorInput['targets']
-): AutomationCatalogSshMirrorInput {
- return {
- targetsHydrated: true,
- targets,
- removedTargetLabels: new Map(),
- connectionStatusByTargetId: new Map()
- }
-}
-
-describe('create destination on a managed SSH host', () => {
- it("lists only the host's server and lands its desktop SSH key there", () => {
- const { entries } = buildAutomationHostCatalog({
- desktop: {
- label: 'Local Mac',
- ssh: mirror([{ targetId: 'box', label: 'Build box', generation: 2 }])
- },
- runtimes: [
- {
- environmentId: 'env-1',
- label: 'Build box',
- pairingRevision: 3,
- authorityHealth: 'fresh',
- querySupport: 'scoped',
- ssh: mirror([]),
- managedSshTargetId: 'box'
- }
- ],
- runtimeCatalogSettled: true
- })
- const desktopSshKey = 'host:desktop:ssh:box'
-
- const desktopSsh = entries.find((entry) => entry.stableKey === desktopSshKey)
- expect(desktopSsh && automationCreateHostOffered(desktopSsh)).toBe(false)
- expect(preselectAutomationCreateHost(entries, desktopSshKey, null)?.stableKey).toBe(
- 'host:runtime:env-1:self'
- )
- })
-})
diff --git a/src/renderer/src/components/automations/automation-create-projects.test.ts b/src/renderer/src/components/automations/automation-create-projects.test.ts
deleted file mode 100644
index af5905d7fe1..00000000000
--- a/src/renderer/src/components/automations/automation-create-projects.test.ts
+++ /dev/null
@@ -1,38 +0,0 @@
-import { describe, expect, it } from 'vitest'
-import type { Repo } from '../../../../shared/repo-types'
-import { getAutomationCreateRepos } from './automation-create-projects'
-
-function repo(id: string, executionHostId: Repo['executionHostId']): Repo {
- return {
- id,
- path: `/${id}`,
- displayName: id,
- badgeColor: '#000000',
- addedAt: 1,
- executionHostId
- }
-}
-
-describe('getAutomationCreateRepos', () => {
- const repos = [
- repo('local', 'local'),
- repo('remote', 'runtime:env-1'),
- repo('ssh', 'ssh:builder')
- ]
-
- it('selects only the destination runtime catalog', () => {
- expect(
- getAutomationCreateRepos(repos, { kind: 'environment', environmentId: 'env-1' })
- ).toEqual([repos[1]])
- })
-
- it('keeps local and direct SSH rows but excludes paired-runtime rows', () => {
- expect(getAutomationCreateRepos(repos, { kind: 'local' })).toEqual([repos[0], repos[2]])
- })
-
- it('fails closed when the destination runtime has no project', () => {
- expect(
- getAutomationCreateRepos(repos, { kind: 'environment', environmentId: 'missing' })
- ).toEqual([])
- })
-})
diff --git a/src/renderer/src/components/automations/automation-host-cache-error.test.ts b/src/renderer/src/components/automations/automation-host-cache-error.test.ts
deleted file mode 100644
index 6268e693234..00000000000
--- a/src/renderer/src/components/automations/automation-host-cache-error.test.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-import { describe, expect, it } from 'vitest'
-import { RemoteRuntimeClientError } from '../../../../shared/remote-runtime/remote-runtime-client-error'
-import { classifyAutomationHostQueryError } from './automation-host-cache-error'
-
-function classify(error: unknown): { code: string; retryable: boolean } {
- const { code, retryable } = classifyAutomationHostQueryError(error, { attempt: 1, now: 0 })
- return { code, retryable }
-}
-
-// Pin RPC failure-code mapping so dropping a classification is deliberate.
-describe('classifyAutomationHostQueryError code mapping', () => {
- it.each([
- ['runtime_unavailable', 'authority_unavailable', true],
- ['remote_runtime_unavailable', 'authority_unavailable', true],
- ['relay_quota_exceeded', 'authority_unavailable', true],
- ['timeout', 'timeout', true],
- ['runtime_timeout', 'timeout', true],
- ['permission_denied', 'permission_denied', false],
- ['unauthorized', 'permission_denied', false],
- ['forbidden', 'permission_denied', false],
- ['capability_unsupported', 'incompatible', false],
- ['legacy_read_only', 'incompatible', false],
- ['invalid_runtime_response', 'invalid_response', false],
- ['invalid_argument', 'invalid_response', false],
- ['runtime_manually_disconnected', 'unknown', true],
- ['runtime_rpc_queue_overloaded', 'unknown', true],
- ['remote_runtime_busy', 'unknown', true]
- ])('maps %s to %s (retryable: %s)', (rpcCode, code, retryable) => {
- expect(classify(new RemoteRuntimeClientError(rpcCode, 'failed'))).toEqual({ code, retryable })
- })
-
- it('reads a code-stripped message token', () => {
- expect(
- classify(new Error("Error invoking remote method 'x': Error: failed: runtime_timeout"))
- ).toEqual({ code: 'timeout', retryable: true })
- })
-})
diff --git a/src/renderer/src/components/automations/automation-host-cache-health.test.ts b/src/renderer/src/components/automations/automation-host-cache-health.test.ts
deleted file mode 100644
index 2cd2e47cc12..00000000000
--- a/src/renderer/src/components/automations/automation-host-cache-health.test.ts
+++ /dev/null
@@ -1,58 +0,0 @@
-import { describe, expect, it } from 'vitest'
-import type { AutomationHostCacheEntry } from './automation-host-cache-types'
-import type { AutomationHostCatalogEntry } from './automation-host-catalog-types'
-import { automationHostEntryHealth } from './automation-host-cache-health'
-
-function entry(
- overrides: Partial & Pick
-): AutomationHostCatalogEntry {
- return {
- stableRef: { authority: { kind: 'desktop' }, selector: { kind: 'self' } },
- owner: null,
- label: 'This computer',
- authorityLabel: 'This computer',
- kind: 'self',
- catalogState: 'authoritative',
- authorityHealth: 'fresh',
- executionHealth: 'connected',
- querySupport: 'scoped',
- ...overrides
- }
-}
-
-function cached(overrides: Partial): AutomationHostCacheEntry {
- return {
- data: [],
- fetchedAt: null,
- attempt: 0,
- requestGeneration: 0,
- catalogGeneration: 0,
- request: null,
- error: null,
- orphanCount: null,
- ...overrides
- }
-}
-
-const SELF = entry({ stableKey: 'host:desktop:self' })
-
-describe('automation host cache health', () => {
- it('marks a host whose unscoped list failed, so it never reads as empty', () => {
- expect(
- automationHostEntryHealth(SELF, {
- entry: () => null,
- failedAuthorityKeys: new Set(['authority:desktop'])
- })
- ).toBe('stale-error')
- })
-
- it('lets a successful host-scoped read outrank the unscoped failure', () => {
- // The per-host read is better evidence about this host than the ambient one.
- expect(
- automationHostEntryHealth(SELF, {
- entry: () => cached({ fetchedAt: 5 }),
- failedAuthorityKeys: new Set(['authority:desktop'])
- })
- ).toBe('fresh')
- })
-})
diff --git a/src/renderer/src/components/automations/automation-host-catalog-generation.test.ts b/src/renderer/src/components/automations/automation-host-catalog-generation.test.ts
deleted file mode 100644
index 8144378bacc..00000000000
--- a/src/renderer/src/components/automations/automation-host-catalog-generation.test.ts
+++ /dev/null
@@ -1,166 +0,0 @@
-import { beforeEach, describe, expect, it } from 'vitest'
-import type { StableAutomationAuthorityRef } from '../../../../shared/automations/ownership/automation-owner-ref'
-import { buildAutomationHostCatalog } from './automation-host-catalog'
-import { createAutomationCatalogGenerationRegistry } from './automation-host-catalog-generation'
-import type {
- AutomationCatalogSshMirrorInput,
- AutomationHostCatalogInput,
- AutomationRuntimeAuthorityInput
-} from './automation-host-catalog-types'
-
-const DESKTOP: StableAutomationAuthorityRef = { kind: 'desktop' }
-const ENV_A: StableAutomationAuthorityRef = { kind: 'runtime', environmentId: 'env-a' }
-const ENV_B: StableAutomationAuthorityRef = { kind: 'runtime', environmentId: 'env-b' }
-
-function mirror(
- overrides: Partial = {}
-): AutomationCatalogSshMirrorInput {
- return {
- targetsHydrated: true,
- targets: [],
- removedTargetLabels: new Map(),
- connectionStatusByTargetId: new Map(),
- ...overrides
- }
-}
-
-function runtime(
- environmentId: string,
- overrides: Partial = {}
-): AutomationRuntimeAuthorityInput {
- return {
- environmentId,
- label: environmentId,
- pairingRevision: 1,
- authorityHealth: 'fresh',
- querySupport: 'scoped',
- ssh: mirror(),
- ...overrides
- }
-}
-
-function input(overrides: Partial = {}): AutomationHostCatalogInput {
- return {
- desktop: { label: 'Local Mac', ssh: mirror() },
- runtimes: [runtime('env-a'), runtime('env-b')],
- runtimeCatalogSettled: true,
- ...overrides
- }
-}
-
-describe('automation catalog generation', () => {
- let registry = createAutomationCatalogGenerationRegistry()
-
- beforeEach(() => {
- registry = createAutomationCatalogGenerationRegistry()
- })
-
- it('advances only the authority whose target bucket hydrated', () => {
- registry.sync(
- buildAutomationHostCatalog(
- input({
- runtimes: [
- runtime('env-a', { ssh: mirror({ targetsHydrated: false }) }),
- runtime('env-b')
- ]
- })
- )
- )
- const before = {
- desktop: registry.get(DESKTOP),
- a: registry.get(ENV_A),
- b: registry.get(ENV_B)
- }
- const advanced = registry.sync(
- buildAutomationHostCatalog(
- input({
- runtimes: [
- runtime('env-a', {
- ssh: mirror({ targets: [{ targetId: 't', label: 'T', generation: 2 }] })
- }),
- runtime('env-b')
- ]
- })
- )
- )
- expect(advanced.advancedAuthorityKeys).toEqual(['authority:runtime:env-a'])
- expect(registry.get(ENV_A)).toBeGreaterThan(before.a)
- expect(registry.get(ENV_B)).toBe(before.b)
- expect(registry.get(DESKTOP)).toBe(before.desktop)
- })
-
- it('does not advance on runtime or SSH connection status changes', () => {
- const targets = [{ targetId: 't', label: 'T', generation: 2 }]
- registry.sync(
- buildAutomationHostCatalog(
- input({
- runtimes: [
- runtime('env-a', {
- ssh: mirror({ targets, connectionStatusByTargetId: new Map([['t', 'connected']]) })
- }),
- runtime('env-b')
- ]
- })
- )
- )
- const before = registry.get(ENV_A)
- const advanced = registry.sync(
- buildAutomationHostCatalog(
- input({
- runtimes: [
- runtime('env-a', {
- authorityHealth: 'stale-error',
- ssh: mirror({ targets, connectionStatusByTargetId: new Map([['t', 'reconnecting']]) })
- }),
- runtime('env-b')
- ]
- })
- )
- )
- expect(advanced.advancedAuthorityKeys).toEqual([])
- expect(registry.get(ENV_A)).toBe(before)
- })
-
- // doc:321 — the entry a same-id re-adoption produces is byte-identical apart
- // from this, so the caller has no other way to know its rows are obsolete.
- it('reports a same-id SSH re-adoption as a reincarnated host', () => {
- const desktopAt = (generation: number, label = 'Box'): AutomationHostCatalogInput =>
- input({
- desktop: {
- label: 'Local Mac',
- ssh: mirror({ targets: [{ targetId: 'ssh-1', label, generation }] })
- }
- })
- const first = registry.sync(buildAutomationHostCatalog(desktopAt(4)))
- expect(first.reincarnatedStableKeys).toEqual([])
-
- const renamed = registry.sync(buildAutomationHostCatalog(desktopAt(4, 'Renamed')))
- expect(renamed.reincarnatedStableKeys).toEqual([])
-
- const readopted = registry.sync(buildAutomationHostCatalog(desktopAt(5)))
- expect(readopted.reincarnatedStableKeys).toEqual(['host:desktop:ssh:ssh-1'])
- expect(readopted.advancedAuthorityKeys).toEqual(['authority:desktop'])
- })
-
- // The generation file's own warning: an offline authority reported as
- // legacy-unscoped loses its owner refs, which must not read as a re-adoption.
- it('does not report a host whose owner merely went absent', () => {
- const withSupport = (querySupport: 'scoped' | 'legacy-unscoped'): AutomationHostCatalogInput =>
- input({
- runtimes: [
- runtime('env-a', {
- querySupport,
- // An SSH entry is where the owner ref actually disappears with the support level.
- ssh: mirror({ targets: [{ targetId: 't', label: 'T', generation: 3 }] })
- })
- ]
- })
- registry.sync(buildAutomationHostCatalog(withSupport('scoped')))
-
- const degraded = registry.sync(buildAutomationHostCatalog(withSupport('legacy-unscoped')))
- expect(degraded.reincarnatedStableKeys).toEqual([])
-
- const restored = registry.sync(buildAutomationHostCatalog(withSupport('scoped')))
- expect(restored.reincarnatedStableKeys).toEqual([])
- })
-})
diff --git a/src/renderer/src/components/automations/automation-host-client.test.ts b/src/renderer/src/components/automations/automation-host-client.test.ts
deleted file mode 100644
index 480c6dcd016..00000000000
--- a/src/renderer/src/components/automations/automation-host-client.test.ts
+++ /dev/null
@@ -1,118 +0,0 @@
-import { describe, expect, it, vi, beforeEach } from 'vitest'
-import type {
- Automation,
- AutomationCreateInput
-} from '../../../../shared/automations/automation-definition'
-import {
- getAutomationListedTargetFromHostId,
- toRuntimeAutomationCreateInput
-} from './automation-host-client'
-
-vi.mock('@/runtime/rpc/calls/runtime-rpc-call', () => ({
- callRuntimeRpc: vi.fn()
-}))
-
-const mockApi = {
- automations: {
- list: vi.fn(),
- listRuns: vi.fn(),
- create: vi.fn(),
- update: vi.fn(),
- delete: vi.fn(),
- runNow: vi.fn()
- }
-}
-
-// @ts-expect-error test window mock
-globalThis.window = { api: mockApi }
-
-function makeAutomation(overrides: Partial = {}): Automation {
- return {
- id: 'auto-1',
- name: 'Remote check',
- prompt: 'Check',
- precheck: null,
- agentId: 'codex',
- projectId: 'repo-1',
- executionTargetType: 'local',
- executionTargetId: 'local',
- schedulerOwner: 'remote_host_service',
- workspaceMode: 'new_per_run',
- workspaceId: null,
- baseBranch: null,
- reuseSession: false,
- timezone: 'UTC',
- rrule: 'FREQ=DAILY;BYHOUR=9;BYMINUTE=0',
- dtstart: 1,
- enabled: true,
- nextRunAt: 2,
- missedRunPolicy: 'run_once_within_grace',
- missedRunGraceMinutes: 720,
- createdAt: 1,
- updatedAt: 1,
- runContext: {
- kind: 'workspace-run',
- projectId: 'github:stablyai/orca',
- hostId: 'runtime:gpu',
- projectHostSetupId: 'setup-gpu',
- repoId: 'repo-1',
- path: '/srv/orca'
- },
- ...overrides
- }
-}
-
-describe('automation host client', () => {
- beforeEach(() => {
- vi.clearAllMocks()
- })
-
- it('encodes exact machine selectors for the create wire input', () => {
- const automation = makeAutomation({
- workspaceMode: 'existing',
- workspaceId: 'repo-1::/srv/orca'
- })
- const input: AutomationCreateInput = {
- name: automation.name,
- prompt: automation.prompt,
- precheck: null,
- agentId: automation.agentId,
- runContext: automation.runContext,
- projectId: automation.projectId,
- workspaceMode: 'existing',
- workspaceId: automation.workspaceId,
- setupDecision: 'skip',
- timezone: automation.timezone,
- rrule: automation.rrule,
- dtstart: automation.dtstart
- }
-
- expect(toRuntimeAutomationCreateInput(input)).toMatchObject({
- repo: 'id:repo-1',
- workspace: 'id:repo-1::/srv/orca'
- })
- // A per-run workspace states no workspace selector at all.
- expect(
- toRuntimeAutomationCreateInput({ ...input, workspaceMode: 'new_per_run', workspaceId: null })
- ).toMatchObject({ repo: 'id:repo-1', workspace: undefined })
- })
-})
-
-describe('getAutomationListedTargetFromHostId', () => {
- const state = { runtimeEnvironments: [{ id: 'env-1' }] }
-
- // #32415: a web run link names 'local', but the catalog lists the server only as its runtime.
- it('lists a paired web client local and SSH hosts under its server', () => {
- Object.assign(globalThis, { __ORCA_WEB_CLIENT__: true })
- try {
- for (const hostId of ['local', 'ssh:box', undefined]) {
- expect(getAutomationListedTargetFromHostId(hostId, state)).toEqual({
- kind: 'environment',
- environmentId: 'env-1'
- })
- }
- } finally {
- Reflect.deleteProperty(globalThis, '__ORCA_WEB_CLIENT__')
- }
- })
-})
diff --git a/src/renderer/src/components/automations/automation-host-filter-resolution.test.ts b/src/renderer/src/components/automations/automation-host-filter-resolution.test.ts
deleted file mode 100644
index f06b11c8f5a..00000000000
--- a/src/renderer/src/components/automations/automation-host-filter-resolution.test.ts
+++ /dev/null
@@ -1,223 +0,0 @@
-import { describe, expect, it } from 'vitest'
-import type { AutomationHostFilter } from '../../../../shared/automations/ownership/automation-host-filter'
-import { hostStableKey } from '../../../../shared/automations/ownership/automation-owner-key'
-import type { StableAutomationCatalogRef } from '../../../../shared/automations/ownership/automation-owner-ref'
-import { buildAutomationHostCatalog } from './automation-host-catalog'
-import type {
- AutomationCatalogSshMirrorInput,
- AutomationHostCatalogInput,
- AutomationRuntimeAuthorityInput
-} from './automation-host-catalog-types'
-import { resolveAutomationHostFilter } from './automation-host-filter-resolution'
-
-function mirror(
- overrides: Partial = {}
-): AutomationCatalogSshMirrorInput {
- return {
- targetsHydrated: true,
- targets: [],
- removedTargetLabels: new Map(),
- connectionStatusByTargetId: new Map(),
- ...overrides
- }
-}
-
-function runtime(
- overrides: Partial = {}
-): AutomationRuntimeAuthorityInput {
- return {
- environmentId: 'env-1',
- label: 'Build server',
- pairingRevision: 3,
- authorityHealth: 'fresh',
- querySupport: 'scoped',
- ssh: mirror(),
- ...overrides
- }
-}
-
-function catalogOf(overrides: Partial = {}) {
- return buildAutomationHostCatalog({
- desktop: { label: 'Local Mac', ssh: mirror() },
- runtimes: [],
- runtimeCatalogSettled: true,
- ...overrides
- })
-}
-
-function filterFor(host: StableAutomationCatalogRef): AutomationHostFilter {
- return { kind: 'host', host }
-}
-
-const desktopSsh = (targetId: string): StableAutomationCatalogRef => ({
- authority: { kind: 'desktop' },
- selector: { kind: 'ssh', targetId }
-})
-const runtimeSelf: StableAutomationCatalogRef = {
- authority: { kind: 'runtime', environmentId: 'env-1' },
- selector: { kind: 'self' }
-}
-const runtimeSsh: StableAutomationCatalogRef = {
- authority: { kind: 'runtime', environmentId: 'env-1' },
- selector: { kind: 'ssh', targetId: 'nested' }
-}
-const desktopOrphan: StableAutomationCatalogRef = {
- authority: { kind: 'desktop' },
- selector: { kind: 'orphan' }
-}
-
-describe('resolveAutomationHostFilter', () => {
- it('retains a desktop SSH selection until the target list hydrates', () => {
- const filter = filterFor(desktopSsh('pending'))
- const resolution = resolveAutomationHostFilter({
- filter,
- catalog: catalogOf({
- desktop: { label: 'Local Mac', ssh: mirror({ targetsHydrated: false }) }
- })
- })
- expect(resolution).toMatchObject({ status: 'loading', announceFallback: false })
- expect(resolution.effective).toBe(filter)
- })
-
- it('falls back and announces once desktop SSH absence is authoritative', () => {
- const resolution = resolveAutomationHostFilter({
- filter: filterFor(desktopSsh('gone')),
- catalog: catalogOf()
- })
- expect(resolution).toEqual({
- effective: { kind: 'all' },
- entry: null,
- status: 'removed',
- announceFallback: true
- })
- })
-
- it('keeps a removed host as a ghost while automations still reference it', () => {
- const host = desktopSsh('gone')
- const key = hostStableKey(host)
- const resolution = resolveAutomationHostFilter({
- filter: filterFor(host),
- catalog: catalogOf({
- desktop: {
- label: 'Local Mac',
- ssh: mirror({ removedTargetLabels: new Map([['gone', 'Old box']]) })
- },
- referencedStableKeys: [key]
- }),
- referencedStableKeys: new Set([key])
- })
- expect(resolution.status).toBe('ghost')
- expect(resolution.announceFallback).toBe(false)
- expect(resolution.entry?.label).toBe('Old box')
- })
-
- it('retains a Runtime Self selection until the saved runtime catalog settles', () => {
- const filter = filterFor(runtimeSelf)
- expect(
- resolveAutomationHostFilter({ filter, catalog: catalogOf({ runtimeCatalogSettled: false }) })
- .status
- ).toBe('loading')
- expect(resolveAutomationHostFilter({ filter, catalog: catalogOf() })).toMatchObject({
- status: 'removed',
- announceFallback: true
- })
- })
-
- it('retains a Runtime SSH selection until that runtime bucket hydrates', () => {
- const filter = filterFor(runtimeSsh)
- expect(
- resolveAutomationHostFilter({
- filter,
- catalog: catalogOf({ runtimes: [runtime({ ssh: mirror({ targetsHydrated: false }) })] })
- }).status
- ).toBe('loading')
- expect(
- resolveAutomationHostFilter({ filter, catalog: catalogOf({ runtimes: [runtime()] }) })
- ).toMatchObject({ status: 'removed', announceFallback: true })
- })
-
- it('accepts a removal tombstone as positive evidence for a nested target', () => {
- const resolution = resolveAutomationHostFilter({
- filter: filterFor(runtimeSsh),
- catalog: catalogOf({
- runtimes: [
- runtime({
- ssh: mirror({
- targetsHydrated: false,
- removedTargetLabels: new Map([['nested', 'Nested box']])
- })
- })
- ]
- })
- })
- expect(resolution.status).toBe('removed')
- expect(resolution.announceFallback).toBe(true)
- })
-
- it('never claims removal while the owning authority is offline', () => {
- const offline = catalogOf({
- runtimes: [
- runtime({
- authorityHealth: 'unavailable',
- ssh: mirror({ removedTargetLabels: new Map([['nested', 'Nested box']]) })
- })
- ]
- })
- expect(
- resolveAutomationHostFilter({ filter: filterFor(runtimeSsh), catalog: offline })
- ).toMatchObject({ status: 'unavailable', announceFallback: false })
- expect(
- resolveAutomationHostFilter({
- filter: filterFor({
- authority: { kind: 'runtime', environmentId: 'env-1' },
- selector: { kind: 'ssh', targetId: 'never-seen' }
- }),
- catalog: offline
- })
- ).toMatchObject({ status: 'unavailable', announceFallback: false })
- })
-
- it('settles an orphan selection only on an authoritative orphan count', () => {
- const filter = filterFor(desktopOrphan)
- expect(resolveAutomationHostFilter({ filter, catalog: catalogOf() }).status).toBe('loading')
- expect(
- resolveAutomationHostFilter({
- filter,
- catalog: catalogOf({ desktop: { label: 'Local Mac', ssh: mirror(), orphanCount: 2 } })
- }).status
- ).toBe('ready')
- expect(
- resolveAutomationHostFilter({
- filter,
- catalog: catalogOf({ desktop: { label: 'Local Mac', ssh: mirror(), orphanCount: 0 } })
- })
- ).toMatchObject({ status: 'removed', announceFallback: true })
- })
-
- it('retains an orphan selection as unavailable while its authority is offline', () => {
- const resolution = resolveAutomationHostFilter({
- filter: filterFor({
- authority: { kind: 'runtime', environmentId: 'env-1' },
- selector: { kind: 'orphan' }
- }),
- catalog: catalogOf({ runtimes: [runtime({ authorityHealth: 'unavailable' })] })
- })
- expect(resolution).toMatchObject({ status: 'unavailable', announceFallback: false })
- })
-
- it('retains the display selection through a same-id re-pair', () => {
- const filter = filterFor(runtimeSelf)
- const before = resolveAutomationHostFilter({
- filter,
- catalog: catalogOf({ runtimes: [runtime({ pairingRevision: 3 })] })
- })
- const after = resolveAutomationHostFilter({
- filter,
- catalog: catalogOf({ runtimes: [runtime({ pairingRevision: 4 })] })
- })
- expect(after.status).toBe('ready')
- expect(after.entry?.stableKey).toBe(before.entry?.stableKey)
- // The display slot survives; the captured incarnation does not.
- expect(after.entry?.owner).not.toEqual(before.entry?.owner)
- })
-})
diff --git a/src/renderer/src/components/automations/automation-host-health.test.ts b/src/renderer/src/components/automations/automation-host-health.test.ts
deleted file mode 100644
index ee3aef12e07..00000000000
--- a/src/renderer/src/components/automations/automation-host-health.test.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import { describe, expect, it } from 'vitest'
-import {
- resolveAutomationAuthorityHealth,
- resolveSelfExecutionHealth,
- resolveSshExecutionHealth
-} from './automation-host-health'
-
-describe('resolveAutomationAuthorityHealth', () => {
- it('reports incompatibility ahead of every other signal', () => {
- expect(
- resolveAutomationAuthorityHealth({
- reachable: false,
- compatible: false,
- queryState: 'error',
- hasData: false
- })
- ).toBe('incompatible')
- })
-})
-
-describe('execution health', () => {
- it('never borrows a status for unverified or removed registrations', () => {
- expect(resolveSshExecutionHealth('removed', 'connected', 'disconnected')).toBe('unavailable')
- expect(resolveSshExecutionHealth('unhydrated', 'connected', 'disconnected')).toBe('unknown')
- })
-
- it('treats an offline authority as disconnected, not gone', () => {
- expect(resolveSelfExecutionHealth('unavailable')).toBe('disconnected')
- expect(resolveSelfExecutionHealth('stale-error')).toBe('connected')
- })
-})
diff --git a/src/renderer/src/components/automations/automation-host-recovery.test.ts b/src/renderer/src/components/automations/automation-host-recovery.test.ts
deleted file mode 100644
index af7de46aaf4..00000000000
--- a/src/renderer/src/components/automations/automation-host-recovery.test.ts
+++ /dev/null
@@ -1,55 +0,0 @@
-import { describe, expect, it, vi } from 'vitest'
-import type { AutomationHostCatalogEntry } from './automation-host-catalog-types'
-import {
- runAutomationHostRecovery,
- type AutomationHostRecoveryDeps
-} from './automation-host-recovery'
-
-function entry(
- overrides: Partial & Pick
-): AutomationHostCatalogEntry {
- return {
- owner: null,
- stableKey: 'host',
- label: 'Host',
- authorityLabel: 'Authority',
- kind: 'self',
- catalogState: 'authoritative',
- authorityHealth: 'fresh',
- executionHealth: 'connected',
- querySupport: 'scoped',
- ...overrides
- }
-}
-
-function deps() {
- return {
- retry: vi.fn(),
- connectSshTarget: vi.fn(),
- connectRuntimeEnvironment: vi.fn(),
- openSettings: vi.fn()
- }
-}
-
-const RUNTIME_ENVIRONMENT_ID = 'gpu'
-const RUNTIME_SSH = entry({
- stableRef: {
- authority: { kind: 'runtime', environmentId: RUNTIME_ENVIRONMENT_ID },
- selector: { kind: 'ssh', targetId: 't1' }
- },
- kind: 'ssh'
-})
-
-describe('automation host recovery', () => {
- it('dials the runtime first when the server itself is unreachable', () => {
- const target = deps()
- // Why: an unreachable server cannot be asked to dial its own SSH target.
- runAutomationHostRecovery(
- 'reconnect',
- { ...RUNTIME_SSH, authorityHealth: 'unavailable' },
- target
- )
- expect(target.connectRuntimeEnvironment).toHaveBeenCalledWith(RUNTIME_ENVIRONMENT_ID)
- expect(target.connectSshTarget).not.toHaveBeenCalled()
- })
-})
diff --git a/src/renderer/src/components/automations/automation-list-focus-recovery.test.ts b/src/renderer/src/components/automations/automation-list-focus-recovery.test.ts
deleted file mode 100644
index 55411b3cab4..00000000000
--- a/src/renderer/src/components/automations/automation-list-focus-recovery.test.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import { describe, expect, it } from 'vitest'
-import { resolveAutomationListFocusRecovery } from './automation-list-focus-recovery'
-
-describe('automation list focus recovery', () => {
- it('leaves focus alone when it was never on a row', () => {
- expect(
- resolveAutomationListFocusRecovery({
- previousRowKeys: ['a'],
- nextRowKeys: [],
- focusedRowKey: null
- })
- ).toBeNull()
- })
-
- it('moves to the next surviving row', () => {
- expect(
- resolveAutomationListFocusRecovery({
- previousRowKeys: ['a', 'b', 'c'],
- nextRowKeys: ['a', 'c'],
- focusedRowKey: 'b'
- })
- ).toEqual({ kind: 'row', rowKey: 'c' })
- })
-
- it('goes to the picker when the lost row was never in this list', () => {
- // A host switch replaces every row, so no neighbor here is the right one.
- expect(
- resolveAutomationListFocusRecovery({
- previousRowKeys: ['a', 'b'],
- nextRowKeys: ['x', 'y'],
- focusedRowKey: 'z'
- })
- ).toEqual({ kind: 'picker' })
- })
-})
diff --git a/src/renderer/src/components/automations/automation-list-row-identity.test.ts b/src/renderer/src/components/automations/automation-list-row-identity.test.ts
deleted file mode 100644
index d276371e712..00000000000
--- a/src/renderer/src/components/automations/automation-list-row-identity.test.ts
+++ /dev/null
@@ -1,167 +0,0 @@
-/** Follow colliding authority-local IDs from host cache through list/search joins so the last host cannot overwrite another’s row. */
-
-import { describe, expect, it } from 'vitest'
-import type { Automation } from '../../../../shared/automations/automation-definition'
-import type { AutomationHostCacheEntry, AutomationHostRow } from './automation-host-cache-types'
-import type {
- AutomationHostCatalog,
- AutomationHostCatalogEntry
-} from './automation-host-catalog-types'
-import type { AutomationHostFilterResolution } from './automation-host-filter-resolution'
-import type { Repo } from '../../../../shared/repo-types'
-import type { Worktree } from '../../../../shared/worktree/types'
-import { resolveAutomationHostListRows } from './automation-host-list-rows'
-
-import { REPO_ID } from './automations-page-fixtures'
-import { makeFolderWorkspace } from '../sidebar/workspace-creation/folder/folder-workspace-composer-submit-fixtures'
-import {
- automationFolderWorktreeForRow,
- automationRepoForRow,
- automationWorktreeForRow
-} from './automation-list-row-identity'
-
-const repoMap = new Map([
- [REPO_ID, { id: REPO_ID, displayName: 'orca', path: '/src/orca' } as Repo]
-])
-
-const DESKTOP_SELF: AutomationHostCatalogEntry = {
- stableRef: { authority: { kind: 'desktop' }, selector: { kind: 'self' } },
- owner: { authority: { kind: 'desktop' }, selector: { kind: 'self' } },
- stableKey: 'host:desktop:self',
- label: 'This computer',
- authorityLabel: 'This computer',
- kind: 'self',
- catalogState: 'authoritative',
- authorityHealth: 'fresh',
- executionHealth: 'connected',
- querySupport: 'scoped'
-}
-
-const RUNTIME_SSH: AutomationHostCatalogEntry = {
- ...DESKTOP_SELF,
- stableRef: {
- authority: { kind: 'runtime', environmentId: 'gpu' },
- selector: { kind: 'ssh', targetId: 'web-01' }
- },
- owner: {
- authority: { kind: 'runtime', environmentId: 'gpu', pairingRevision: 4 },
- selector: { kind: 'ssh', targetId: 'web-01', targetGeneration: 2 }
- },
- stableKey: 'host:runtime:gpu:ssh:web-01',
- label: 'web-01',
- authorityLabel: 'GPU box',
- kind: 'ssh'
-}
-
-const ALL_HOSTS: AutomationHostFilterResolution = {
- effective: { kind: 'all' },
- entry: null,
- status: 'all',
- announceFallback: false
-}
-
-function cached(rows: AutomationHostRow[]): AutomationHostCacheEntry {
- return {
- data: rows,
- fetchedAt: 1,
- attempt: 0,
- requestGeneration: 0,
- catalogGeneration: 0,
- request: null,
- error: null,
- orphanCount: null
- }
-}
-
-function hostRow(entry: AutomationHostCatalogEntry, name: string): AutomationHostRow {
- return {
- automation: {
- id: 'a-1',
- name,
- prompt: 'sweep',
- projectId: REPO_ID,
- workspaceMode: 'new_per_run',
- baseBranch: null,
- agentId: 'claude'
- } as Automation,
- owner: entry.owner,
- selector: { kind: 'self' },
- usageSummary: null,
- usageKnown: true
- }
-}
-
-/** The desktop and a runtime SSH host each holding a record called `a-1`. */
-function collidedListRows(): ReturnType {
- const entries = [DESKTOP_SELF, RUNTIME_SSH]
- const catalog: AutomationHostCatalog = {
- entries,
- byStableKey: new Map(entries.map((entry) => [entry.stableKey, entry])),
- hydration: {
- runtimeCatalogSettled: true,
- desktopSshHydrated: true,
- runtimeSshHydratedByEnvironmentId: new Map(),
- savedRuntimeEnvironmentIds: new Set(),
- orphanSettledAuthorityKeys: new Set(),
- unavailableAuthorityKeys: new Set()
- }
- }
- return resolveAutomationHostListRows({
- catalog,
- resolution: ALL_HOSTS,
- entry: (stableKey) =>
- cached([
- stableKey === DESKTOP_SELF.stableKey
- ? hostRow(DESKTOP_SELF, 'Nightly desktop')
- : hostRow(RUNTIME_SSH, 'Nightly web-01')
- ])
- })
-}
-
-describe('automation list row identity across hosts', () => {
- it('resolves colliding projects and worktrees inside each row authority', () => {
- const rows = collidedListRows().rows
- const repos = [
- { ...repoMap.get(REPO_ID)!, displayName: 'Desktop repo', executionHostId: 'local' as const },
- {
- ...repoMap.get(REPO_ID)!,
- displayName: 'Runtime repo',
- executionHostId: 'runtime:gpu' as const
- }
- ]
- const worktrees = [
- { id: 'ws-1', repoId: REPO_ID, hostId: 'local', displayName: 'Desktop workspace' },
- {
- id: 'ws-1',
- repoId: REPO_ID,
- hostId: 'runtime:gpu',
- displayName: 'Runtime workspace'
- }
- ] as Worktree[]
-
- expect(rows.map((row) => automationRepoForRow(row, repos)?.displayName)).toEqual([
- 'Desktop repo',
- 'Runtime repo'
- ])
- expect(
- rows.map((row) => {
- const repo = automationRepoForRow(row, repos)
- return automationWorktreeForRow(row, { [REPO_ID]: worktrees }, repo, repos, 'ws-1')
- ?.displayName
- })
- ).toEqual(['Desktop workspace', 'Runtime workspace'])
- })
-
- it('resolves a folder workspace target inside each row authority', () => {
- const rows = collidedListRows().rows
- const folders = [
- makeFolderWorkspace({ id: 'fw-1', name: 'Desktop folder' }),
- makeFolderWorkspace({ id: 'fw-1', name: 'Runtime folder', executionHostId: 'runtime:gpu' })
- ]
-
- expect(
- rows.map((row) => automationFolderWorktreeForRow(row, folders, 'folder:fw-1')?.displayName)
- ).toEqual(['Desktop folder', 'Runtime folder'])
- expect(automationFolderWorktreeForRow(rows[0], folders, 'ws-1')).toBeUndefined()
- })
-})
diff --git a/src/renderer/src/components/automations/automation-list-search.test.ts b/src/renderer/src/components/automations/automation-list-search.test.ts
deleted file mode 100644
index 01550ed7dcd..00000000000
--- a/src/renderer/src/components/automations/automation-list-search.test.ts
+++ /dev/null
@@ -1,48 +0,0 @@
-import { describe, expect, it } from 'vitest'
-import {
- AUTOMATION_LIST_SEARCH_PROMPT_MAX_CODE_UNITS,
- AUTOMATION_LIST_SEARCH_QUERY_MAX_BYTES,
- automationListSearchIndexMatches,
- buildAutomationListSearchIndex,
- clampAutomationListSearchQueryInput,
- isAutomationListSearchQueryTooLarge,
- resolveAutomationListSearchQuery,
- truncateAutomationListSearchField
-} from './automation-list-search'
-
-describe('automation-list-search', () => {
- it('rejects queries over the byte limit but under the code-unit limit', () => {
- // 3 UTF-8 bytes per character, so half the cap in code units is over it in bytes.
- const multiByte = '한'.repeat(AUTOMATION_LIST_SEARCH_QUERY_MAX_BYTES / 2)
- expect(multiByte.length).toBeLessThanOrEqual(AUTOMATION_LIST_SEARCH_QUERY_MAX_BYTES)
- expect(isAutomationListSearchQueryTooLarge(multiByte)).toBe(true)
- expect(resolveAutomationListSearchQuery(multiByte)).toEqual({ status: 'too_large' })
- })
-
- it('clamps stored query input so multi-MB pastes are discarded', () => {
- const hugePaste = 'a'.repeat(AUTOMATION_LIST_SEARCH_QUERY_MAX_BYTES * 100)
- const clamped = clampAutomationListSearchQueryInput(hugePaste)
- expect(clamped.length).toBe(AUTOMATION_LIST_SEARCH_QUERY_MAX_BYTES + 1)
- expect(isAutomationListSearchQueryTooLarge(clamped)).toBe(true)
- expect(clampAutomationListSearchQueryInput('auto pr')).toBe('auto pr')
- })
-
- it('caps indexed field length so huge prompts stay bounded', () => {
- const prompt = `${'x'.repeat(AUTOMATION_LIST_SEARCH_PROMPT_MAX_CODE_UNITS)}unique-tail-token`
- const index = buildAutomationListSearchIndex({
- name: 'Nightly',
- project: 'mobile',
- prompt
- })
- expect(index.prompt.length).toBe(AUTOMATION_LIST_SEARCH_PROMPT_MAX_CODE_UNITS)
- expect(automationListSearchIndexMatches(index, 'unique-tail-token')).toBe(false)
- expect(automationListSearchIndexMatches(index, 'xxxx')).toBe(true)
- })
-
- it('does not split surrogate pairs when truncating', () => {
- const emoji = '😀'
- const value = `${'a'.repeat(7)}${emoji}`
- expect(truncateAutomationListSearchField(value, 8)).toBe('a'.repeat(7))
- expect(truncateAutomationListSearchField(value, 9)).toBe(value)
- })
-})
diff --git a/src/renderer/src/components/automations/automation-page-parts.tsx b/src/renderer/src/components/automations/automation-page-parts.tsx
index 563284ee607..6019c4fe14a 100644
--- a/src/renderer/src/components/automations/automation-page-parts.tsx
+++ b/src/renderer/src/components/automations/automation-page-parts.tsx
@@ -3,7 +3,7 @@ import type { Badge } from '@/components/ui/badge'
import { Button } from '@/components/ui/button'
import { cn } from '@/lib/utils'
import type { AutomationRun } from '../../../../shared/automations/history/automation-run'
-import type { PendingAutomationSetupReview } from './automation-setup-review'
+import type { PendingAutomationSetupReview } from './authoring/automation-setup-review'
import { translate } from '@/i18n/i18n'
import { useTranslate, type Translate } from '@/i18n/use-translate'
import { formatUiNarrowRelativeTime } from '@/i18n/relative-time-format'
diff --git a/src/renderer/src/components/automations/automation-run-context.test.ts b/src/renderer/src/components/automations/automation-run-context.test.ts
deleted file mode 100644
index 32ecbf29012..00000000000
--- a/src/renderer/src/components/automations/automation-run-context.test.ts
+++ /dev/null
@@ -1,79 +0,0 @@
-import { describe, expect, it } from 'vitest'
-import type { ProjectHostSetup } from '../../../../shared/project-types'
-import type { Repo } from '../../../../shared/repo-types'
-import { buildAutomationRunContextForRepo } from './automation-run-context'
-
-function repo(id: string, path = `/repos/${id}`, executionHostId?: Repo['executionHostId']): Repo {
- return {
- id,
- path,
- displayName: id,
- badgeColor: '#000000',
- addedAt: 1,
- executionHostId
- }
-}
-
-function setup(overrides: Partial = {}): ProjectHostSetup {
- return {
- id: 'setup-builder',
- projectId: 'github:stablyai/orca',
- hostId: 'ssh:builder',
- repoId: 'repo-builder',
- path: '/remote/orca',
- displayName: 'orca',
- setupState: 'ready',
- setupMethod: 'cloned',
- createdAt: 1,
- updatedAt: 1,
- ...overrides
- }
-}
-
-describe('buildAutomationRunContextForRepo', () => {
- it('persists logical project and host setup identity for the selected run repo', () => {
- expect(
- buildAutomationRunContextForRepo({
- repoId: 'repo-builder',
- repos: [
- repo('repo-local', '/local/orca'),
- repo('repo-builder', '/remote/orca', 'ssh:builder')
- ],
- projectHostSetups: [
- setup({
- id: 'setup-local',
- hostId: 'local',
- repoId: 'repo-local',
- path: '/local/orca'
- }),
- setup()
- ]
- })
- ).toEqual({
- kind: 'workspace-run',
- projectId: 'github:stablyai/orca',
- hostId: 'ssh:builder',
- projectHostSetupId: 'setup-builder',
- repoId: 'repo-builder',
- path: '/remote/orca'
- })
- })
-
- it('does not build a run context for missing or not-ready setups', () => {
- expect(
- buildAutomationRunContextForRepo({
- repoId: 'repo-builder',
- repos: [repo('repo-builder')],
- projectHostSetups: [setup({ hostId: 'local', setupState: 'setting-up' })]
- })
- ).toBeNull()
-
- expect(
- buildAutomationRunContextForRepo({
- repoId: 'repo-builder',
- repos: [],
- projectHostSetups: [setup()]
- })
- ).toBeNull()
- })
-})
diff --git a/src/renderer/src/components/automations/automation-run-open-target.test.ts b/src/renderer/src/components/automations/automation-run-open-target.test.ts
deleted file mode 100644
index b55c3c41aa9..00000000000
--- a/src/renderer/src/components/automations/automation-run-open-target.test.ts
+++ /dev/null
@@ -1,179 +0,0 @@
-import { describe, expect, it } from 'vitest'
-import type { AutomationRun } from '../../../../shared/automations/history/automation-run'
-import {
- buildAutomationRunOpenLayout,
- resolveAutomationRunOpenTarget
-} from './automation-run-open-target'
-
-const leafId = '11111111-1111-4111-8111-111111111111'
-const otherLeafId = '22222222-2222-4222-8222-222222222222'
-const paneKey = `tab-1:${leafId}`
-
-const runLeafLayout = {
- root: { type: 'leaf' as const, leafId },
- activeLeafId: leafId,
- expandedLeafId: null
-}
-const livePtyIds = ['pty-run']
-const canOpen = (args: Parameters[0]): boolean =>
- resolveAutomationRunOpenTarget(args) !== null
-
-function run(overrides: Partial = {}): AutomationRun {
- return {
- id: 'run-1',
- automationId: 'automation-1',
- title: 'Run 1',
- scheduledFor: 1,
- status: 'completed',
- trigger: 'manual',
- workspaceId: 'wt-1',
- workspaceDisplayName: 'Workspace',
- sessionKind: 'terminal',
- chatSessionId: null,
- terminalSessionId: 'tab-1',
- terminalPaneKey: paneKey,
- terminalPtyId: 'pty-run',
- outputSnapshot: null,
- precheckResult: null,
- usage: null,
- error: null,
- startedAt: 1,
- dispatchedAt: 1,
- createdAt: 1,
- ...overrides
- }
-}
-
-describe('automation run open target', () => {
- it('rejects a layout whose run leaf is bound to another PTY', () => {
- expect(
- resolveAutomationRunOpenTarget({
- run: run(),
- terminalTabExists: true,
- currentLayout: {
- ...runLeafLayout,
- ptyIdsByLeafId: { [leafId]: 'pty-other' }
- },
- livePtyIds
- })
- ).toBeNull()
- })
-
- it('targets the pane a successful run slept in place, before and after it wakes', () => {
- // Why: hibernation drops only the run's PTY id; the pane key still names the run's own pane.
- const sleptRun = run({ terminalPtyId: null })
- const asleepLayout = { ...runLeafLayout, ptyIdsByLeafId: { [leafId]: 'pty-run' } }
- const asleep = resolveAutomationRunOpenTarget({
- run: sleptRun,
- terminalTabExists: true,
- currentLayout: asleepLayout,
- livePtyIds: []
- })
-
- expect(asleep).toEqual({ tabId: 'tab-1', paneKey, leafId, ptyId: null })
- if (!asleep) {
- throw new Error('Expected target.')
- }
- expect(
- buildAutomationRunOpenLayout({ target: asleep, currentLayout: asleepLayout }).ptyIdsByLeafId
- ).toBe(asleepLayout.ptyIdsByLeafId)
- expect(
- resolveAutomationRunOpenTarget({
- run: sleptRun,
- terminalTabExists: true,
- currentLayout: { ...runLeafLayout, ptyIdsByLeafId: { [leafId]: 'pty-resumed' } },
- livePtyIds: ['pty-resumed']
- })
- ).toEqual({ tabId: 'tab-1', paneKey, leafId, ptyId: 'pty-resumed' })
- expect(
- canOpen({
- run: sleptRun,
- terminalTabExists: false,
- currentLayout: asleepLayout,
- livePtyIds: []
- })
- ).toBe(false)
- })
-
- it('opens an existing run leaf when the layout has no PTY mapping yet', () => {
- const target = resolveAutomationRunOpenTarget({
- run: run(),
- terminalTabExists: true,
- currentLayout: runLeafLayout,
- livePtyIds
- })
-
- expect(target).not.toBeNull()
- if (!target) {
- throw new Error('Expected target.')
- }
- expect(buildAutomationRunOpenLayout({ target, currentLayout: runLeafLayout })).toMatchObject({
- root: { type: 'leaf', leafId },
- activeLeafId: leafId,
- ptyIdsByLeafId: { [leafId]: 'pty-run' }
- })
- })
-
- it('does not rebuild a layout that is missing the run pane', () => {
- expect(
- resolveAutomationRunOpenTarget({
- run: run(),
- terminalTabExists: true,
- currentLayout: {
- root: { type: 'leaf', leafId: otherLeafId },
- activeLeafId: otherLeafId,
- expandedLeafId: null,
- ptyIdsByLeafId: { [otherLeafId]: 'pty-empty-shell' }
- },
- livePtyIds
- })
- ).toBeNull()
- })
-
- it('does not open when the current tab layout is unavailable', () => {
- expect(
- resolveAutomationRunOpenTarget({
- run: run(),
- terminalTabExists: true,
- currentLayout: null,
- livePtyIds
- })
- ).toBeNull()
- })
-
- it('keeps an existing split layout when the run leaf is still present', () => {
- const currentLayout = {
- root: {
- type: 'split' as const,
- direction: 'horizontal' as const,
- first: { type: 'leaf' as const, leafId },
- second: { type: 'leaf' as const, leafId: otherLeafId }
- },
- activeLeafId: otherLeafId,
- expandedLeafId: otherLeafId,
- ptyIdsByLeafId: { [leafId]: 'pty-run', [otherLeafId]: 'pty-other' }
- }
- const target = resolveAutomationRunOpenTarget({
- run: run(),
- terminalTabExists: true,
- currentLayout,
- livePtyIds
- })
-
- expect(target).not.toBeNull()
- if (!target) {
- throw new Error('Expected target.')
- }
- const layout = buildAutomationRunOpenLayout({
- target,
- currentLayout
- })
-
- expect(layout).toMatchObject({
- root: expect.objectContaining({ type: 'split' }),
- activeLeafId: leafId,
- expandedLeafId: null,
- ptyIdsByLeafId: { [leafId]: 'pty-run', [otherLeafId]: 'pty-other' }
- })
- })
-})
diff --git a/src/renderer/src/components/automations/automations-page-action-context.ts b/src/renderer/src/components/automations/automations-page-action-context.ts
index 7b2c1b89c0f..27d9ebb5b0d 100644
--- a/src/renderer/src/components/automations/automations-page-action-context.ts
+++ b/src/renderer/src/components/automations/automations-page-action-context.ts
@@ -1,11 +1,11 @@
-import type { AutomationsPageListState } from './use-automations-page-list-state'
+import type { AutomationsPageListState } from './listing/use-automations-page-list-state'
import type { AutomationsPageLocalState } from './use-automations-page-local-state'
import type { AutomationsPagePresentationState } from './use-automations-page-presentation-state'
import type { AutomationsPageRefresh } from './use-automations-page-refresh'
-import type { AutomationsPageSetupState } from './use-automations-page-setup-state'
+import type { AutomationsPageSetupState } from './authoring/use-automations-page-setup-state'
import type { AutomationsPageStoreState } from './use-automations-page-store-state'
-import type { AutomationsPageDestinationState } from './use-automations-page-destination-state'
-import type { AutomationsPageDestinationFormState } from './use-automations-page-destination-form'
+import type { AutomationsPageDestinationState } from './authoring/use-automations-page-destination-state'
+import type { AutomationsPageDestinationFormState } from './authoring/use-automations-page-destination-form'
export type AutomationsPageActionContext = {
store: AutomationsPageStoreState
diff --git a/src/renderer/src/components/automations/automations-page-actions-test-harness.ts b/src/renderer/src/components/automations/automations-page-actions-test-harness.ts
index 70fe36d8109..cb581cd733e 100644
--- a/src/renderer/src/components/automations/automations-page-actions-test-harness.ts
+++ b/src/renderer/src/components/automations/automations-page-actions-test-harness.ts
@@ -17,7 +17,7 @@ import { checkRuntimeHooks, type HookCheckResult } from '@/runtime/repo-hooks/ru
import { loadHostStructuredAgents } from '@/runtime/native-chat/agent-catalogs/host-structured-agents'
import { getDefaultSettings } from '../../../../shared/constants'
import type { Automation } from '../../../../shared/automations/automation-definition'
-import type { AutomationDraft } from './AutomationEditorDialog'
+import type { AutomationDraft } from './authoring/AutomationEditorDialog'
import {
AUTOMATION_LIST_HOST_SCOPE_RUNTIME_CAPABILITY as LIST_HOST_SCOPE,
AUTOMATION_OWNER_FENCING_RUNTIME_CAPABILITY as OWNER_FENCING,
diff --git a/src/renderer/src/components/automations/automations-page-child-props.test-fixture.ts b/src/renderer/src/components/automations/automations-page-child-props.test-fixture.ts
index 34c91c3fe8a..7852a857b10 100644
--- a/src/renderer/src/components/automations/automations-page-child-props.test-fixture.ts
+++ b/src/renderer/src/components/automations/automations-page-child-props.test-fixture.ts
@@ -1,12 +1,12 @@
import type { AutomationAuthorityRef } from '../../../../shared/automations/ownership/automation-owner-ref'
import type { Automation } from '../../../../shared/automations/automation-definition'
import type { Worktree } from '../../../../shared/worktree/types'
-import type { AutomationHostCatalogView } from './use-automation-host-catalog'
-import type { AutomationCreateDestinationControl } from './use-automation-create-destination'
-import type { ExternalAutomationListEntry } from './external-automation-list-entries'
-import type { AutomationListRow } from './automation-list-row-identity'
-import type { AutomationListViewItem } from './automation-list-view'
-import type { AutomationTemplate } from './automation-templates'
+import type { AutomationHostCatalogView } from './hosts/use-automation-host-catalog'
+import type { AutomationCreateDestinationControl } from './authoring/use-automation-create-destination'
+import type { ExternalAutomationListEntry } from './external/external-automation-list-entries'
+import type { AutomationListRow } from './listing/automation-list-row-identity'
+import type { AutomationListViewItem } from './listing/automation-list-view'
+import type { AutomationTemplate } from './authoring/automation-templates'
export type ListPanelProps = {
sortedListItems: readonly AutomationListViewItem[]
diff --git a/src/renderer/src/components/automations/automations-page-fixtures.ts b/src/renderer/src/components/automations/automations-page-fixtures.ts
index 0c5daecf279..9b60daacd74 100644
--- a/src/renderer/src/components/automations/automations-page-fixtures.ts
+++ b/src/renderer/src/components/automations/automations-page-fixtures.ts
@@ -7,15 +7,18 @@ import type {
} from '../../../../shared/automations/history/automation-run'
import type { ExternalAutomationManager } from '../../../../shared/automations/external/external-automation'
import type { ProjectHostSetup } from '../../../../shared/project-types'
-import type { AutomationHostCatalogEntry } from './automation-host-catalog-types'
+import type { AutomationHostCatalogEntry } from './hosts/automation-host-catalog-types'
import type { AppState } from '@/store/types'
import type { Repo } from '../../../../shared/repo-types'
import type { Worktree } from '../../../../shared/worktree/types'
import type {
ExternalAutomationScope,
ScopedExternalAutomationManager
-} from './external-automation-scope-client'
-import { automationListRowKey, type AutomationListRow } from './automation-list-row-identity'
+} from './external/external-automation-scope-client'
+import {
+ automationListRowKey,
+ type AutomationListRow
+} from './listing/automation-list-row-identity'
import { ALL_AUTOMATION_HOSTS_FILTER } from '../../../../shared/automations/ownership/automation-host-filter'
import { getDefaultSettings } from '../../../../shared/constants'
diff --git a/src/renderer/src/components/automations/automations-page-listed-items.ts b/src/renderer/src/components/automations/automations-page-listed-items.ts
index 723d093ef38..2f64eff3037 100644
--- a/src/renderer/src/components/automations/automations-page-listed-items.ts
+++ b/src/renderer/src/components/automations/automations-page-listed-items.ts
@@ -1,7 +1,7 @@
/** Read authority-qualified row keys and render order from the mocked list panel, matching real clicks rather than synthesizing identity. */
-import type { AutomationListRow } from './automation-list-row-identity'
-import type { ExternalAutomationListEntry } from './external-automation-list-entries'
+import type { AutomationListRow } from './listing/automation-list-row-identity'
+import type { ExternalAutomationListEntry } from './external/external-automation-list-entries'
import { mocks } from './automations-page-test-harness'
function listedItems() {
diff --git a/src/renderer/src/components/automations/automations-page-test-harness.tsx b/src/renderer/src/components/automations/automations-page-test-harness.tsx
index d9ee8364a0b..309adc4fed9 100644
--- a/src/renderer/src/components/automations/automations-page-test-harness.tsx
+++ b/src/renderer/src/components/automations/automations-page-test-harness.tsx
@@ -21,10 +21,10 @@ import {
} from '../../../../shared/automations/automation-runtime-capabilities'
import type { AppState } from '@/store/types'
-import { AutomationDestinationField } from './AutomationDestinationField'
+import { AutomationDestinationField } from './authoring/AutomationDestinationField'
import { TooltipProvider } from '@/components/ui/tooltip'
-import { resetAutomationCapabilityProbes } from './automation-scoped-list-client'
+import { resetAutomationCapabilityProbes } from './hosts/automation-capability-probe'
import {
addRuntimeProject as addRuntimeProjectFixture,
selfScopedList
@@ -65,7 +65,7 @@ export const mocks: AutomationsPageMocks = {
setPendingRunNavigation: vi.fn()
}
-vi.mock('@/store', () => {
+vi.mock('@/store/index', () => {
const useAppStore = (selector: (state: Partial) => unknown): unknown =>
selector(mocks.state as Partial)
useAppStore.getState = (): Partial