diff --git a/config/focus-setting-read-baseline.txt b/config/focus-setting-read-baseline.txt index 05f8b90d114..bbb5f649286 100644 --- a/config/focus-setting-read-baseline.txt +++ b/config/focus-setting-read-baseline.txt @@ -19,10 +19,10 @@ 1 src/renderer/src/components/activity/use-agent-pane-thread-store-data.ts 1 src/renderer/src/components/activity/use-agent-pane-threads.ts 4 src/renderer/src/components/agent/AgentSettingsDialog.tsx -1 src/renderer/src/components/automations/automation-host-client.ts +1 src/renderer/src/components/automations/hosts/automation-host-client.ts 1 src/renderer/src/components/automations/automations-page-fixtures.ts 1 src/renderer/src/components/automations/use-automations-page-controller.ts -1 src/renderer/src/components/automations/use-automations-page-destination-form.ts +1 src/renderer/src/components/automations/authoring/use-automations-page-destination-form.ts 1 src/renderer/src/components/browser-pane/ReopenBrowserPageOnServerButton.tsx 1 src/renderer/src/components/browser-pane/browser-reopen-on-server.ts 1 src/renderer/src/components/browser-pane/stream-remote/use-remote-browser-page-stream.ts diff --git a/config/host-list-render-baseline.txt b/config/host-list-render-baseline.txt index 09d3a029300..8cceee047a8 100644 --- a/config/host-list-render-baseline.txt +++ b/config/host-list-render-baseline.txt @@ -1,7 +1,7 @@ # JSX mapped straight over a host collection, per file, outside components/host-picker. # This is a RATCHET: counts may only go DOWN. Draw host lists with HostCombobox or # useBoundedHostRows. Prune after a fix: pnpm check:host-list-render-ratchet --prune -1 src/renderer/src/components/automations/AutomationRunsDashboard.tsx +1 src/renderer/src/components/automations/runs/AutomationRunsDashboard.tsx 1 src/renderer/src/components/right-sidebar/ai-vault/panel/AiVaultPanelControls.tsx 1 src/renderer/src/components/right-sidebar/source-control/ai/SourceControlAgentActionDialogForm.tsx 1 src/renderer/src/components/settings/browser/profiles/BrowserSessionCookiesSection.tsx diff --git a/config/react-compiler-bailout-baseline.txt b/config/react-compiler-bailout-baseline.txt index 0229fb2152a..68511863f1e 100644 --- a/config/react-compiler-bailout-baseline.txt +++ b/config/react-compiler-bailout-baseline.txt @@ -28,27 +28,27 @@ 1 src/renderer/src/components/artifacts/ArtifactPublishButton.tsx 2 src/renderer/src/components/artifacts/ArtifactsPage.tsx 2 src/renderer/src/components/artifacts/useArtifactPagination.ts -2 src/renderer/src/components/automations/AutomationEditorPromptEditor.tsx -1 src/renderer/src/components/automations/AutomationHostFilterNotice.tsx -1 src/renderer/src/components/automations/AutomationProjectCombobox.tsx -1 src/renderer/src/components/automations/AutomationRunHistory.tsx -1 src/renderer/src/components/automations/AutomationRunsDashboard.tsx -1 src/renderer/src/components/automations/AutomationRunsTable.tsx +2 src/renderer/src/components/automations/authoring/AutomationEditorPromptEditor.tsx +1 src/renderer/src/components/automations/hosts/AutomationHostFilterNotice.tsx +1 src/renderer/src/components/automations/authoring/AutomationProjectCombobox.tsx +1 src/renderer/src/components/automations/runs/AutomationRunHistory.tsx +1 src/renderer/src/components/automations/runs/AutomationRunsDashboard.tsx +1 src/renderer/src/components/automations/runs/AutomationRunsTable.tsx 1 src/renderer/src/components/automations/AutomationsPageSurface.tsx -1 src/renderer/src/components/automations/use-automation-agent-picker-entries.ts -2 src/renderer/src/components/automations/use-automation-create-destination.ts -4 src/renderer/src/components/automations/use-automation-host-catalog.ts -4 src/renderer/src/components/automations/use-automation-list-search.ts -2 src/renderer/src/components/automations/use-automation-migrate-action.ts -1 src/renderer/src/components/automations/use-automation-runs-dashboard.ts -1 src/renderer/src/components/automations/use-automations-page-list-state.ts +1 src/renderer/src/components/automations/authoring/use-automation-agent-picker-entries.ts +2 src/renderer/src/components/automations/authoring/use-automation-create-destination.ts +4 src/renderer/src/components/automations/hosts/use-automation-host-catalog.ts +4 src/renderer/src/components/automations/listing/use-automation-list-search.ts +2 src/renderer/src/components/automations/authoring/use-automation-migrate-action.ts +1 src/renderer/src/components/automations/runs/use-automation-runs-dashboard.ts +1 src/renderer/src/components/automations/listing/use-automations-page-list-state.ts 1 src/renderer/src/components/automations/use-automations-page-local-state.ts 1 src/renderer/src/components/automations/use-automations-page-refresh.ts -1 src/renderer/src/components/automations/use-automations-page-setup-state.ts +1 src/renderer/src/components/automations/authoring/use-automations-page-setup-state.ts 1 src/renderer/src/components/automations/use-automations-page-store-state.ts -1 src/renderer/src/components/automations/use-external-automation-scope-retention.ts -2 src/renderer/src/components/automations/use-scoped-external-automations.ts -16 src/renderer/src/components/automations/use-selected-automation-run-history.ts +1 src/renderer/src/components/automations/external/use-external-automation-scope-retention.ts +2 src/renderer/src/components/automations/external/use-scoped-external-automations.ts +16 src/renderer/src/components/automations/runs/use-selected-automation-run-history.ts 7 src/renderer/src/components/browser-extension-install-dialog.tsx 1 src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.tsx 2 src/renderer/src/components/browser-pane/annotate/MarkupOverlay.tsx diff --git a/config/render-path-translate-baseline.txt b/config/render-path-translate-baseline.txt index 0a7b19061a2..2da76433302 100644 --- a/config/render-path-translate-baseline.txt +++ b/config/render-path-translate-baseline.txt @@ -2,7 +2,7 @@ # This is a RATCHET: counts may only go DOWN. Use useTranslate()/useIntlLocale() from # @/i18n/use-translate. Prune after a fix: pnpm check:render-path-translate-ratchet --prune 2 src/renderer/src/components/agent/AgentLaunchPromptComposer.tsx -5 src/renderer/src/components/automations/use-external-automation-actions.ts +5 src/renderer/src/components/automations/external/use-external-automation-actions.ts 1 src/renderer/src/components/diff-comments/useDiffCommentDecorator.tsx 2 src/renderer/src/components/editor/markdown-preview/render-tree/use-markdown-preview-components.tsx 1 src/renderer/src/components/tab-group/useTabGroupCreationCommands.ts diff --git a/config/scripts/ci/sharding/ci-shard-timings.json b/config/scripts/ci/sharding/ci-shard-timings.json index 94dbb700e57..88df61e82ea 100644 --- a/config/scripts/ci/sharding/ci-shard-timings.json +++ b/config/scripts/ci/sharding/ci-shard-timings.json @@ -4675,53 +4675,52 @@ "src/renderer/src/components/artifacts/ArtifactPublishButton.test.tsx": 706, "src/renderer/src/components/artifacts/ArtifactsPage.test.tsx": 2052, "src/renderer/src/components/artifacts/artifact-publish-flow.test.ts": 114, - "src/renderer/src/components/automations/AutomationEditorPromptEditor.test.tsx": 396, + "src/renderer/src/components/automations/authoring/AutomationEditorPromptEditor.test.tsx": 396, "src/renderer/src/components/automations/AutomationPromptDisclosure.test.tsx": 893, "src/renderer/src/components/automations/AutomationRunsTable.test.tsx": 668, - "src/renderer/src/components/automations/AutomationSchedulePicker.test.ts": 431, - "src/renderer/src/components/automations/AutomationTimeField.test.tsx": 654, + "src/renderer/src/components/automations/authoring/AutomationSchedulePicker.test.ts": 431, + "src/renderer/src/components/automations/AutomationsPage.behavior.test.tsx": 3389, "src/renderer/src/components/automations/AutomationsPage.edit-destination.test.tsx": 2932, - "src/renderer/src/components/automations/AutomationsPage.run-navigation.test.tsx": 3056, + "src/renderer/src/components/automations/ExternalAutomationManagers.test.tsx": 852, - "src/renderer/src/components/automations/automation-captured-owner.test.ts": 379, - "src/renderer/src/components/automations/automation-create-projects.test.ts": 42, + "src/renderer/src/components/automations/hosts/automation-captured-owner.test.ts": 379, + "src/renderer/src/components/automations/authoring/automation-create-projects.test.ts": 42, "src/renderer/src/components/automations/automation-host-cache-controller.test.ts": 411, - "src/renderer/src/components/automations/automation-host-cache-error.test.ts": 391, - "src/renderer/src/components/automations/automation-host-cache-health.test.ts": 52, - "src/renderer/src/components/automations/automation-host-cache.test.ts": 79, - "src/renderer/src/components/automations/automation-host-catalog-generation.test.ts": 258, - "src/renderer/src/components/automations/automation-host-client.test.ts": 374, + "src/renderer/src/components/automations/hosts/automation-host-cache-error.test.ts": 391, + "src/renderer/src/components/automations/hosts/automation-host-cache-health.test.ts": 52, + "src/renderer/src/components/automations/hosts/automation-host-cache.test.ts": 79, + + "src/renderer/src/components/automations/hosts/automation-host-client.test.ts": 374, "src/renderer/src/components/automations/automation-host-diagnostics.test.ts": 460, - "src/renderer/src/components/automations/automation-host-filter-resolution.test.ts": 256, - "src/renderer/src/components/automations/automation-host-health.test.ts": 47, + + "src/renderer/src/components/automations/hosts/automation-host-health.test.ts": 47, "src/renderer/src/components/automations/automation-host-invalidation-window-events.test.ts": 83, "src/renderer/src/components/automations/automation-host-invalidation.test.ts": 85, - "src/renderer/src/components/automations/automation-host-list-rows.test.ts": 419, - "src/renderer/src/components/automations/automation-host-recovery.test.ts": 51, + "src/renderer/src/components/automations/hosts/automation-host-list-rows.test.ts": 419, + "src/renderer/src/components/automations/hosts/automation-host-recovery.test.ts": 51, "src/renderer/src/components/automations/automation-host-scale-gates.test.ts": 638, - "src/renderer/src/components/automations/automation-host-scheduler.test.ts": 439, - "src/renderer/src/components/automations/automation-legacy-schedule-editing.test.ts": 449, - "src/renderer/src/components/automations/automation-list-focus-recovery.test.ts": 48, - "src/renderer/src/components/automations/automation-list-row-identity.test.ts": 626, - "src/renderer/src/components/automations/automation-list-search.test.ts": 75, + "src/renderer/src/components/automations/hosts/automation-host-scheduler.test.ts": 439, + "src/renderer/src/components/automations/authoring/automation-legacy-schedule-editing.test.ts": 449, + "src/renderer/src/components/automations/listing/automation-list-focus-recovery.test.ts": 48, + "src/renderer/src/components/automations/automation-list-view.test.ts": 257, - "src/renderer/src/components/automations/automation-run-context.test.ts": 58, - "src/renderer/src/components/automations/automation-run-history-keyboard-navigation.test.ts": 434, - "src/renderer/src/components/automations/automation-run-open-target.test.ts": 442, + "src/renderer/src/components/automations/authoring/automation-run-context.test.ts": 58, + "src/renderer/src/components/automations/runs/automation-run-history-keyboard-navigation.test.ts": 434, + "src/renderer/src/components/automations/runs/automation-run-open-target.test.ts": 442, "src/renderer/src/components/automations/automation-run-output-snapshot-equivalence.test.ts": 158, "src/renderer/src/components/automations/automation-run-output-snapshot.test.ts": 96, - "src/renderer/src/components/automations/automation-setup-decision.test.ts": 58, + "src/renderer/src/components/automations/authoring/automation-setup-decision.test.ts": 58, "src/renderer/src/components/automations/automation-usage-model.test.ts": 200, "src/renderer/src/components/automations/external-automation-list-entries.test.ts": 57, - "src/renderer/src/components/automations/external-automation-scope-gating.test.ts": 67, + "src/renderer/src/components/automations/external/external-automation-scope-gating.test.ts": 67, "src/renderer/src/components/automations/external-automation-scope-keys.test.ts": 53, - "src/renderer/src/components/automations/use-automation-host-catalog-readoption.test.tsx": 802, - "src/renderer/src/components/automations/use-automation-host-catalog.test.tsx": 920, - "src/renderer/src/components/automations/use-automation-list-focus-recovery.test.tsx": 229, - "src/renderer/src/components/automations/use-automation-list-search.test.tsx": 679, - "src/renderer/src/components/automations/use-automation-runs-dashboard-payload.test.tsx": 6692, - "src/renderer/src/components/automations/use-automation-runs-dashboard.test.tsx": 854, + "src/renderer/src/components/automations/hosts/use-automation-host-catalog-readoption.test.tsx": 802, + "src/renderer/src/components/automations/hosts/use-automation-host-catalog.test.tsx": 920, + + "src/renderer/src/components/automations/listing/use-automation-list-search.test.tsx": 679, + "src/renderer/src/components/automations/runs/use-automation-runs-dashboard-payload.test.tsx": 6692, + "src/renderer/src/components/automations/runs/use-automation-runs-dashboard.test.tsx": 854, "src/renderer/src/components/automations/use-selected-automation-run-history.test.tsx": 2104, "src/renderer/src/components/browser-favicon.test.tsx": 333, "src/renderer/src/components/browser-pane/ClientHostedBrowserPagePane.dead-guest.test.tsx": 6219, @@ -7989,7 +7988,7 @@ "tests/e2e/ai-vault-account-stream.unit.test.ts": 4506, "tests/e2e/ai-vault-manual-name-clear.unit.test.ts": 21206, "tests/e2e/automation-chat-reopen.unit.test.ts": 6262, - "tests/e2e/automation-save-fallback.unit.test.ts": 9065, + "tests/e2e/claude-agent-row-view.unit.test.ts": 1491, "tests/e2e/codex-child-approval-activity-row.unit.test.ts": 14886, "tests/e2e/completed-worker-retirement-resume.unit.test.ts": 38857, diff --git a/config/scripts/performance/renderer-projection/locale-collator-sort-benchmark.mjs b/config/scripts/performance/renderer-projection/locale-collator-sort-benchmark.mjs index 7253d22afb5..073a78ffaa5 100644 --- a/config/scripts/performance/renderer-projection/locale-collator-sort-benchmark.mjs +++ b/config/scripts/performance/renderer-projection/locale-collator-sort-benchmark.mjs @@ -18,7 +18,7 @@ const { sortJiraIssues } = await jiti.import( '../../../../src/renderer/src/components/jira-issue-sorter.ts' ) const { sortAutomationListViewItems } = await jiti.import( - '../../../../src/renderer/src/components/automations/automation-list-view.ts' + '../../../../src/renderer/src/components/automations/listing/automation-list-view.ts' ) const automationLocale = 'en-US' diff --git a/config/scripts/test-runtime/sqlite-admission/vitest-node-runtime-files.mjs b/config/scripts/test-runtime/sqlite-admission/vitest-node-runtime-files.mjs index 0aebc9e3011..9d2286a006a 100644 --- a/config/scripts/test-runtime/sqlite-admission/vitest-node-runtime-files.mjs +++ b/config/scripts/test-runtime/sqlite-admission/vitest-node-runtime-files.mjs @@ -137,7 +137,7 @@ const NODE_RUNTIME_INCLUDE = [ 'src/main/gitlab/gitlab-known-host-retirement.test.ts', 'src/main/window/main-window-updater-deferred-setup.test.ts', 'src/renderer/src/components/terminal-pane/host-state/terminal-pane-host-state-memo.test.ts', - 'src/renderer/src/components/automations/use-automation-runs-dashboard-payload.test.tsx', + 'src/renderer/src/components/automations/runs/use-automation-runs-dashboard-payload.test.tsx', 'src/main/native-chat/agent-session-journal/**/*.test.ts', 'src/main/native-chat/agent-session-wire/host/testing/structured-agent-session-terminal-writer-acquire.test.ts', 'src/main/runtime/agent-session/records/agent-session-conversation-name-store.test.ts', 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.test.ts b/src/renderer/src/components/automations/authoring/automation-create-projects.test.ts similarity index 94% rename from src/renderer/src/components/automations/automation-create-projects.test.ts rename to src/renderer/src/components/automations/authoring/automation-create-projects.test.ts index af5905d7fe1..459aa4e323b 100644 --- a/src/renderer/src/components/automations/automation-create-projects.test.ts +++ b/src/renderer/src/components/automations/authoring/automation-create-projects.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import type { Repo } from '../../../../shared/repo-types' +import type { Repo } from '../../../../../shared/repo-types' import { getAutomationCreateRepos } from './automation-create-projects' function repo(id: string, executionHostId: Repo['executionHostId']): Repo { 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.test.ts b/src/renderer/src/components/automations/authoring/automation-run-context.test.ts similarity index 93% rename from src/renderer/src/components/automations/automation-run-context.test.ts rename to src/renderer/src/components/automations/authoring/automation-run-context.test.ts index 32ecbf29012..5d457a53cce 100644 --- a/src/renderer/src/components/automations/automation-run-context.test.ts +++ b/src/renderer/src/components/automations/authoring/automation-run-context.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 { buildAutomationRunContextForRepo } from './automation-run-context' function repo(id: string, path = `/repos/${id}`, executionHostId?: Repo['executionHostId']): Repo { 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-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-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-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-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 => mocks.state as Partial @@ -122,7 +122,7 @@ vi.mock('@/lib/workspace/activation/worktree-activation', () => ({ activateAndRevealWorktree: vi.fn() })) -vi.mock('./AutomationsListPanel', () => ({ +vi.mock('./listing/AutomationsListPanel', () => ({ AutomationsListPanel: (props: ListPanelProps) => { const selectAutomationRow = (rowKey: string | null): void => { props.selectAutomationRow(rowKey) @@ -164,7 +164,7 @@ vi.mock('./AutomationsListPanel', () => ({ } })) -vi.mock('./AutomationsDetailPane', () => ({ +vi.mock('./details/AutomationsDetailPane', () => ({ AutomationsDetailPane: (props: DetailPaneProps) => { mocks.detailPane = props return ( @@ -176,7 +176,7 @@ vi.mock('./AutomationsDetailPane', () => ({ } })) -vi.mock('./AutomationEditorDialog', () => ({ +vi.mock('./authoring/AutomationEditorDialog', () => ({ AutomationEditorDialog: (props: EditorDialogProps) => { mocks.editorDialog = props return ( @@ -195,7 +195,7 @@ vi.mock('./AutomationEditorDialog', () => ({ } })) -vi.mock('./AutomationDeleteDialogs', () => ({ +vi.mock('./authoring/AutomationDeleteDialogs', () => ({ AutomationDeleteDialog: (props: DeleteDialogProps) => { mocks.deleteDialog = props return null diff --git a/src/renderer/src/components/automations/AutomationDetail.tsx b/src/renderer/src/components/automations/details/AutomationDetail.tsx similarity index 94% rename from src/renderer/src/components/automations/AutomationDetail.tsx rename to src/renderer/src/components/automations/details/AutomationDetail.tsx index cb8f9f992e3..faa95e3070d 100644 --- a/src/renderer/src/components/automations/AutomationDetail.tsx +++ b/src/renderer/src/components/automations/details/AutomationDetail.tsx @@ -5,25 +5,25 @@ import { Badge } from '@/components/ui/badge' import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip' import { getAgentCatalog } from '@/lib/agent-catalog/agent-catalog' import { AgentIcon } from '@/components/agent/icons/AgentIcon' -import type { Automation } from '../../../../shared/automations/automation-definition' -import type { AutomationRun } from '../../../../shared/automations/history/automation-run' +import type { Automation } from '../../../../../shared/automations/automation-definition' +import type { AutomationRun } from '../../../../../shared/automations/history/automation-run' import { formatUiAutomationSchedule } from './automation-schedule-label' import { formatUiNarrowDuration } from '@/i18n/relative-time-format' import { AutomationRunErrorNotice, formatAutomationDateTimeWithRelative -} from './automation-page-parts' -import { indexLatestAutomationRuns } from './automation-list-last-run' -import { formatAutomationCost, formatAutomationTokens } from './automation-usage-model' -import { summarizeAutomationRunUsage } from '../../../../shared/automations/history/automation-usage-summary' -import type { AutomationTargetAvailability } from './automation-target-availability' -import type { AutomationHostCatalogEntry } from './automation-host-catalog-types' -import { getAutomationHostDetailDisplay } from './automation-host-detail-display' +} from '../automation-page-parts' +import { indexLatestAutomationRuns } from '../listing/automation-list-last-run' +import { formatAutomationCost, formatAutomationTokens } from '../runs/automation-usage-model' +import { summarizeAutomationRunUsage } from '../../../../../shared/automations/history/automation-usage-summary' +import type { AutomationTargetAvailability } from '../hosts/automation-target-availability-types' +import type { AutomationHostCatalogEntry } from '../hosts/automation-host-catalog-types' +import { getAutomationHostDetailDisplay } from '../hosts/automation-host-detail-display' import { getAutomationSourceDisplay } from './automation-source-display' import { translate } from '@/i18n/i18n' import { useIntlLocale, useTranslate, type Translate } from '@/i18n/use-translate' import { AutomationPromptDisclosure } from './AutomationPromptDisclosure' -import { automationRunErrorText } from './automation-run-error-copy' +import { automationRunErrorText } from '../runs/automation-run-error-copy' type AutomationDetailProps = { automation: Automation | null diff --git a/src/renderer/src/components/automations/AutomationPromptDisclosure.tsx b/src/renderer/src/components/automations/details/AutomationPromptDisclosure.tsx similarity index 100% rename from src/renderer/src/components/automations/AutomationPromptDisclosure.tsx rename to src/renderer/src/components/automations/details/AutomationPromptDisclosure.tsx diff --git a/src/renderer/src/components/automations/AutomationsDetailPane.tsx b/src/renderer/src/components/automations/details/AutomationsDetailPane.tsx similarity index 87% rename from src/renderer/src/components/automations/AutomationsDetailPane.tsx rename to src/renderer/src/components/automations/details/AutomationsDetailPane.tsx index fb770460a33..41cabc8235d 100644 --- a/src/renderer/src/components/automations/AutomationsDetailPane.tsx +++ b/src/renderer/src/components/automations/details/AutomationsDetailPane.tsx @@ -2,24 +2,24 @@ import React from 'react' import { ArrowLeft } from 'lucide-react' import { Button } from '@/components/ui/button' import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs' -import type { Automation } from '../../../../shared/automations/automation-definition' +import type { Automation } from '../../../../../shared/automations/automation-definition' import type { ExternalAutomationAction, ExternalAutomationJob, ExternalAutomationManager -} from '../../../../shared/automations/external/external-automation' -import type { AutomationRun } from '../../../../shared/automations/history/automation-run' -import type { Worktree } from '../../../../shared/worktree/types' +} from '../../../../../shared/automations/external/external-automation' +import type { AutomationRun } from '../../../../../shared/automations/history/automation-run' +import type { Worktree } from '../../../../../shared/worktree/types' import { AutomationDetail } from './AutomationDetail' -import { AutomationRunHistory } from './AutomationRunHistory' -import { ExternalAutomationManagers } from './ExternalAutomationManagers' -import type { ExternalAutomationListEntry } from './external-automation-list-entries' -import type { ExternalAutomationScope } from './external-automation-scope-client' -import type { AutomationActionNotice } from './automation-row-action-dispatch' -import type { AutomationHostRecoveryAction } from './automation-host-status-descriptors' -import type { AutomationHostCatalogEntry } from './automation-host-catalog-types' -import type { AutomationTargetAvailability } from './automation-target-availability' -import type { AutomationPaneTab } from './automation-page-state' +import { AutomationRunHistory } from '../runs/AutomationRunHistory' +import { ExternalAutomationManagers } from '../external/ExternalAutomationManagers' +import type { ExternalAutomationListEntry } from '../external/external-automation-list-entries' +import type { ExternalAutomationScope } from '../external/external-automation-scope-client' +import type { AutomationActionNotice } from '../hosts/automation-row-action-dispatch' +import type { AutomationHostRecoveryAction } from '../hosts/automation-host-status-descriptors' +import type { AutomationHostCatalogEntry } from '../hosts/automation-host-catalog-types' +import type { AutomationTargetAvailability } from '../hosts/automation-target-availability-types' +import type { AutomationPaneTab } from '../automation-page-state' import { getAutomationDetailNextTab, shouldHandleAutomationDetailEscapeKey, diff --git a/src/renderer/src/components/automations/automation-detail-tab-navigation.ts b/src/renderer/src/components/automations/details/automation-detail-tab-navigation.ts similarity index 97% rename from src/renderer/src/components/automations/automation-detail-tab-navigation.ts rename to src/renderer/src/components/automations/details/automation-detail-tab-navigation.ts index f9bf2c8d239..f4bfa877d43 100644 --- a/src/renderer/src/components/automations/automation-detail-tab-navigation.ts +++ b/src/renderer/src/components/automations/details/automation-detail-tab-navigation.ts @@ -1,4 +1,4 @@ -import type { AutomationPaneTab } from './automation-page-state' +import type { AutomationPaneTab } from '../automation-page-state' export type AutomationDetailTabArrowKey = 'ArrowLeft' | 'ArrowRight' diff --git a/src/renderer/src/components/automations/automation-schedule-label.ts b/src/renderer/src/components/automations/details/automation-schedule-label.ts similarity index 96% rename from src/renderer/src/components/automations/automation-schedule-label.ts rename to src/renderer/src/components/automations/details/automation-schedule-label.ts index b0808cbd018..c39b3f267a4 100644 --- a/src/renderer/src/components/automations/automation-schedule-label.ts +++ b/src/renderer/src/components/automations/details/automation-schedule-label.ts @@ -2,7 +2,7 @@ import { describeAutomationSchedule, formatAutomationScheduleTime, type AutomationScheduleDescriptor -} from '../../../../shared/automations/scheduling/automation-schedules' +} from '../../../../../shared/automations/scheduling/automation-schedules' import { translate } from '@/i18n/i18n' import type { Translate } from '@/i18n/use-translate' import { getUiWeekdayNames } from '@/i18n/weekday-names' diff --git a/src/renderer/src/components/automations/automation-source-display.ts b/src/renderer/src/components/automations/details/automation-source-display.ts similarity index 93% rename from src/renderer/src/components/automations/automation-source-display.ts rename to src/renderer/src/components/automations/details/automation-source-display.ts index b0c62fdd4d6..fdd82e1edc7 100644 --- a/src/renderer/src/components/automations/automation-source-display.ts +++ b/src/renderer/src/components/automations/details/automation-source-display.ts @@ -1,7 +1,7 @@ import { translate } from '@/i18n/i18n' import type { Translate } from '@/i18n/use-translate' -import { getExecutionHostLabel } from '../../../../shared/execution-host' -import type { TaskSourceContext } from '../../../../shared/work-items/task-source-context' +import { getExecutionHostLabel } from '../../../../../shared/execution-host' +import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context' export type AutomationSourceDisplay = { label: string diff --git a/src/renderer/src/components/automations/ExternalAutomationManagers.tsx b/src/renderer/src/components/automations/external/ExternalAutomationManagers.tsx similarity index 99% rename from src/renderer/src/components/automations/ExternalAutomationManagers.tsx rename to src/renderer/src/components/automations/external/ExternalAutomationManagers.tsx index 16d1f70dab8..9acba22517e 100644 --- a/src/renderer/src/components/automations/ExternalAutomationManagers.tsx +++ b/src/renderer/src/components/automations/external/ExternalAutomationManagers.tsx @@ -8,7 +8,7 @@ import type { ExternalAutomationAction, ExternalAutomationJob, ExternalAutomationManager -} from '../../../../shared/automations/external/external-automation' +} from '../../../../../shared/automations/external/external-automation' import type { ExternalAutomationScope, ScopedExternalAutomationManager diff --git a/src/renderer/src/components/automations/external-automation-display.ts b/src/renderer/src/components/automations/external/external-automation-display.ts similarity index 86% rename from src/renderer/src/components/automations/external-automation-display.ts rename to src/renderer/src/components/automations/external/external-automation-display.ts index 55d73755b68..a49380ff4b0 100644 --- a/src/renderer/src/components/automations/external-automation-display.ts +++ b/src/renderer/src/components/automations/external/external-automation-display.ts @@ -1,10 +1,10 @@ -import type { ExternalAutomationManager } from '../../../../shared/automations/external/external-automation' +import type { ExternalAutomationManager } from '../../../../../shared/automations/external/external-automation' import { translate } from '@/i18n/i18n' import type { Translate } from '@/i18n/use-translate' import { formatAutomationDateTime, formatAutomationDateTimeWithRelative -} from './automation-page-parts' +} from '../automation-page-parts' export function formatExternalDate( value: string | null, diff --git a/src/renderer/src/components/automations/external-automation-list-entries.ts b/src/renderer/src/components/automations/external/external-automation-list-entries.ts similarity index 93% rename from src/renderer/src/components/automations/external-automation-list-entries.ts rename to src/renderer/src/components/automations/external/external-automation-list-entries.ts index 18100f8a173..1757432c632 100644 --- a/src/renderer/src/components/automations/external-automation-list-entries.ts +++ b/src/renderer/src/components/automations/external/external-automation-list-entries.ts @@ -1,7 +1,7 @@ import type { ExternalAutomationJob, ExternalAutomationManager -} from '../../../../shared/automations/external/external-automation' +} from '../../../../../shared/automations/external/external-automation' import type { ExternalAutomationScope, ScopedExternalAutomationManager diff --git a/src/renderer/src/components/automations/external-automation-schedule-display.ts b/src/renderer/src/components/automations/external/external-automation-schedule-display.ts similarity index 82% rename from src/renderer/src/components/automations/external-automation-schedule-display.ts rename to src/renderer/src/components/automations/external/external-automation-schedule-display.ts index 02f7a79000c..9ac4c01d9ff 100644 --- a/src/renderer/src/components/automations/external-automation-schedule-display.ts +++ b/src/renderer/src/components/automations/external/external-automation-schedule-display.ts @@ -1,9 +1,9 @@ import type { ExternalAutomationJob, ExternalAutomationManager -} from '../../../../shared/automations/external/external-automation' -import { isRunnableAutomationCronSchedule } from '../../../../shared/automations/scheduling/automation-schedule-parsing' -import { formatUiAutomationSchedule } from './automation-schedule-label' +} from '../../../../../shared/automations/external/external-automation' +import { isRunnableAutomationCronSchedule } from '../../../../../shared/automations/scheduling/automation-schedule-parsing' +import { formatUiAutomationSchedule } from '../details/automation-schedule-label' import { translate } from '@/i18n/i18n' import type { Translate } from '@/i18n/use-translate' diff --git a/src/renderer/src/components/automations/external-automation-scope-client.ts b/src/renderer/src/components/automations/external/external-automation-scope-client.ts similarity index 89% rename from src/renderer/src/components/automations/external-automation-scope-client.ts rename to src/renderer/src/components/automations/external/external-automation-scope-client.ts index d2d3db21c67..b98661be8b2 100644 --- a/src/renderer/src/components/automations/external-automation-scope-client.ts +++ b/src/renderer/src/components/automations/external/external-automation-scope-client.ts @@ -4,10 +4,10 @@ import type { ExternalAutomationAction, ExternalAutomationManager, ExternalAutomationProvider -} from '../../../../shared/automations/external/external-automation' -import type { AutomationOwnerRef } from '../../../../shared/automations/ownership/automation-owner-ref' -import { EXTERNAL_AUTOMATION_PROVIDERS } from '../../../../shared/external-automation-scope' -import type { AutomationHostCatalogEntry } from './automation-host-catalog-types' +} from '../../../../../shared/automations/external/external-automation' +import type { AutomationOwnerRef } from '../../../../../shared/automations/ownership/automation-owner-ref' +import { EXTERNAL_AUTOMATION_PROVIDERS } from '../../../../../shared/external-automation-scope' +import type { AutomationHostCatalogEntry } from '../hosts/automation-host-catalog-types' import { resolveExternalAutomationScopeGate } from './external-automation-scope-gating' export type ExternalAutomationScope = { diff --git a/src/renderer/src/components/automations/external-automation-scope-gating.test.ts b/src/renderer/src/components/automations/external/external-automation-scope-gating.test.ts similarity index 69% rename from src/renderer/src/components/automations/external-automation-scope-gating.test.ts rename to src/renderer/src/components/automations/external/external-automation-scope-gating.test.ts index 6060de28186..dbb45ed5d28 100644 --- a/src/renderer/src/components/automations/external-automation-scope-gating.test.ts +++ b/src/renderer/src/components/automations/external/external-automation-scope-gating.test.ts @@ -1,9 +1,6 @@ import { describe, expect, it } from 'vitest' -import { - EXTERNAL_AUTOMATION_SCOPE_CODES, - ExternalAutomationScopeError -} from '../../../../shared/external-automation-scope' -import type { AutomationHostCatalogEntry } from './automation-host-catalog-types' + +import type { AutomationHostCatalogEntry } from '../hosts/automation-host-catalog-types' import { externalAutomationProbeOwners, externalAutomationScopeGateFromError, @@ -46,19 +43,6 @@ describe('external automation scope gating', () => { }) describe('engine scope errors', () => { - it('reads the code the engine appends to its message', () => { - const hidden = new ExternalAutomationScopeError(EXTERNAL_AUTOMATION_SCOPE_CODES.targetHidden) - expect(parseExternalAutomationScopeCode(hidden)).toBe( - EXTERNAL_AUTOMATION_SCOPE_CODES.targetHidden - ) - // Electron rewraps the message; the trailing token still terminates it. - expect( - parseExternalAutomationScopeCode( - new Error(`Error invoking remote method 'x': ${hidden.message}`) - ) - ).toBe(EXTERNAL_AUTOMATION_SCOPE_CODES.targetHidden) - }) - it('leaves unrelated failures alone so they are not relabelled as scope limits', () => { expect(externalAutomationScopeGateFromError(new Error('socket hang up'))).toBeNull() expect(parseExternalAutomationScopeCode(null)).toBeNull() diff --git a/src/renderer/src/components/automations/external-automation-scope-gating.ts b/src/renderer/src/components/automations/external/external-automation-scope-gating.ts similarity index 89% rename from src/renderer/src/components/automations/external-automation-scope-gating.ts rename to src/renderer/src/components/automations/external/external-automation-scope-gating.ts index 03b747a91d9..300b86aa86a 100644 --- a/src/renderer/src/components/automations/external-automation-scope-gating.ts +++ b/src/renderer/src/components/automations/external/external-automation-scope-gating.ts @@ -3,10 +3,10 @@ import { EXTERNAL_AUTOMATION_SCOPE_CODES, type ExternalAutomationScopeCode -} from '../../../../shared/external-automation-scope' -import type { AutomationOwnerRef } from '../../../../shared/automations/ownership/automation-owner-ref' -import type { AutomationHostCatalogEntry } from './automation-host-catalog-types' -import type { AutomationHostFilterResolution } from './automation-host-filter-resolution' +} from '../../../../../shared/external-automation-scope' +import type { AutomationOwnerRef } from '../../../../../shared/automations/ownership/automation-owner-ref' +import type { AutomationHostCatalogEntry } from '../hosts/automation-host-catalog-types' +import type { AutomationHostFilterResolution } from '../hosts/automation-host-filter-resolution' export type ExternalAutomationScopeStatus = 'listed' | 'not-listed' | 'unknown' diff --git a/src/renderer/src/components/automations/external-automation-scope-keys.ts b/src/renderer/src/components/automations/external/external-automation-scope-keys.ts similarity index 83% rename from src/renderer/src/components/automations/external-automation-scope-keys.ts rename to src/renderer/src/components/automations/external/external-automation-scope-keys.ts index 842cd71e9db..17bb63e3ee7 100644 --- a/src/renderer/src/components/automations/external-automation-scope-keys.ts +++ b/src/renderer/src/components/automations/external/external-automation-scope-keys.ts @@ -1,11 +1,11 @@ /** Qualify external row/job/action keys by kind, captured owner and provider; manager IDs alone collide across hosts. */ -import { ownerKey } from '../../../../shared/automations/ownership/automation-owner-key' -import type { AutomationOwnerRef } from '../../../../shared/automations/ownership/automation-owner-ref' +import { ownerKey } from '../../../../../shared/automations/ownership/automation-owner-key' +import type { AutomationOwnerRef } from '../../../../../shared/automations/ownership/automation-owner-ref' import type { ExternalAutomationAction, ExternalAutomationProvider -} from '../../../../shared/automations/external/external-automation' +} from '../../../../../shared/automations/external/external-automation' const SEPARATOR = '|' diff --git a/src/renderer/src/components/automations/external-automation-source-availability.ts b/src/renderer/src/components/automations/external/external-automation-source-availability.ts similarity index 91% rename from src/renderer/src/components/automations/external-automation-source-availability.ts rename to src/renderer/src/components/automations/external/external-automation-source-availability.ts index 27ea88d0bd3..5fc3717b0f9 100644 --- a/src/renderer/src/components/automations/external-automation-source-availability.ts +++ b/src/renderer/src/components/automations/external/external-automation-source-availability.ts @@ -1,5 +1,5 @@ -import type { ExternalAutomationManager } from '../../../../shared/automations/external/external-automation' -import type { SshConnectionStatus } from '../../../../shared/ssh-types' +import type { ExternalAutomationManager } from '../../../../../shared/automations/external/external-automation' +import type { SshConnectionStatus } from '../../../../../shared/ssh-types' import { isConnectingSshStatus } from '@/ssh/ssh-connection-recoverability' import { translate } from '@/i18n/i18n' import type { Translate } from '@/i18n/use-translate' diff --git a/src/renderer/src/components/automations/external-automation-unchecked-hosts.ts b/src/renderer/src/components/automations/external/external-automation-unchecked-hosts.ts similarity index 91% rename from src/renderer/src/components/automations/external-automation-unchecked-hosts.ts rename to src/renderer/src/components/automations/external/external-automation-unchecked-hosts.ts index a555fbdb0a8..eda7929bd26 100644 --- a/src/renderer/src/components/automations/external-automation-unchecked-hosts.ts +++ b/src/renderer/src/components/automations/external/external-automation-unchecked-hosts.ts @@ -2,8 +2,8 @@ import { translate } from '@/i18n/i18n' import type { Translate } from '@/i18n/use-translate' -import { ownerKey } from '../../../../shared/automations/ownership/automation-owner-key' -import type { AutomationHostCatalogEntry } from './automation-host-catalog-types' +import { ownerKey } from '../../../../../shared/automations/ownership/automation-owner-key' +import type { AutomationHostCatalogEntry } from '../hosts/automation-host-catalog-types' import type { ScopedExternalAutomationFailure } from './external-automation-scope-client' export function externalAutomationUncheckedHostLabels( diff --git a/src/renderer/src/components/automations/use-external-automation-actions.ts b/src/renderer/src/components/automations/external/use-external-automation-actions.ts similarity index 92% rename from src/renderer/src/components/automations/use-external-automation-actions.ts rename to src/renderer/src/components/automations/external/use-external-automation-actions.ts index 1f67bf7d97b..3da957d4bb7 100644 --- a/src/renderer/src/components/automations/use-external-automation-actions.ts +++ b/src/renderer/src/components/automations/external/use-external-automation-actions.ts @@ -1,18 +1,18 @@ import { toast } from 'sonner' -import type { AutomationRun } from '../../../../shared/automations/history/automation-run' +import type { AutomationRun } from '../../../../../shared/automations/history/automation-run' import type { ExternalAutomationAction, ExternalAutomationJob, ExternalAutomationManager -} from '../../../../shared/automations/external/external-automation' +} from '../../../../../shared/automations/external/external-automation' import { translate } from '@/i18n/i18n' -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' import { externalAutomationActionKey, externalAutomationJobKey } from './external-automation-scope-keys' import type { ExternalAutomationScope } from './external-automation-scope-client' -import type { AutomationsPageActionContext } from './automations-page-action-context' +import type { AutomationsPageActionContext } from '../automations-page-action-context' /** External manager actions always carry the scope that produced their row. */ export function useExternalAutomationActions({ diff --git a/src/renderer/src/components/automations/use-external-automation-scope-retention.ts b/src/renderer/src/components/automations/external/use-external-automation-scope-retention.ts similarity index 84% rename from src/renderer/src/components/automations/use-external-automation-scope-retention.ts rename to src/renderer/src/components/automations/external/use-external-automation-scope-retention.ts index 22d888f6804..1d2fc4fad82 100644 --- a/src/renderer/src/components/automations/use-external-automation-scope-retention.ts +++ b/src/renderer/src/components/automations/external/use-external-automation-scope-retention.ts @@ -1,7 +1,7 @@ import { useEffect, useMemo, useRef } from 'react' -import { ownerKey } from '../../../../shared/automations/ownership/automation-owner-key' +import { ownerKey } from '../../../../../shared/automations/ownership/automation-owner-key' import { externalAutomationProbeOwners } from './external-automation-scope-gating' -import type { AutomationHostCatalogEntry } from './automation-host-catalog-types' +import type { AutomationHostCatalogEntry } from '../hosts/automation-host-catalog-types' /** Retain probes only for visible hosts; cancel filtered/page-exit work so stale results cannot compete with requested Orca traffic. */ export function useExternalAutomationScopeRetention( diff --git a/src/renderer/src/components/automations/use-scoped-external-automations.ts b/src/renderer/src/components/automations/external/use-scoped-external-automations.ts similarity index 94% rename from src/renderer/src/components/automations/use-scoped-external-automations.ts rename to src/renderer/src/components/automations/external/use-scoped-external-automations.ts index 6cf31a8de2c..4bebb5cfa02 100644 --- a/src/renderer/src/components/automations/use-scoped-external-automations.ts +++ b/src/renderer/src/components/automations/external/use-scoped-external-automations.ts @@ -1,6 +1,6 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react' -import type { ExternalAutomationAction } from '../../../../shared/automations/external/external-automation' -import type { AutomationHostCatalogEntry } from './automation-host-catalog-types' +import type { ExternalAutomationAction } from '../../../../../shared/automations/external/external-automation' +import type { AutomationHostCatalogEntry } from '../hosts/automation-host-catalog-types' import { externalAutomationScopes, listScopedExternalAutomationManagers, diff --git a/src/renderer/src/components/automations/AutomationHostBadges.tsx b/src/renderer/src/components/automations/hosts/AutomationHostBadges.tsx similarity index 100% rename from src/renderer/src/components/automations/AutomationHostBadges.tsx rename to src/renderer/src/components/automations/hosts/AutomationHostBadges.tsx diff --git a/src/renderer/src/components/automations/AutomationHostFilterNotice.tsx b/src/renderer/src/components/automations/hosts/AutomationHostFilterNotice.tsx similarity index 100% rename from src/renderer/src/components/automations/AutomationHostFilterNotice.tsx rename to src/renderer/src/components/automations/hosts/AutomationHostFilterNotice.tsx diff --git a/src/renderer/src/components/automations/AutomationOwnerConflictNotice.tsx b/src/renderer/src/components/automations/hosts/AutomationOwnerConflictNotice.tsx similarity index 100% rename from src/renderer/src/components/automations/AutomationOwnerConflictNotice.tsx rename to src/renderer/src/components/automations/hosts/AutomationOwnerConflictNotice.tsx diff --git a/src/renderer/src/components/automations/automation-authority-identity.ts b/src/renderer/src/components/automations/hosts/automation-authority-identity.ts similarity index 91% rename from src/renderer/src/components/automations/automation-authority-identity.ts rename to src/renderer/src/components/automations/hosts/automation-authority-identity.ts index 5453709217a..c6a39690f73 100644 --- a/src/renderer/src/components/automations/automation-authority-identity.ts +++ b/src/renderer/src/components/automations/hosts/automation-authority-identity.ts @@ -1,14 +1,14 @@ /** Read live pairing revisions/repo tables at use time; cached values can fence against a re-paired authority or a project that moved hosts. */ -import type { Repo } from '../../../../shared/repo-types' -import type { LegacyAutomationPartitionContext } from '../../../../shared/automations/ownership/automation-legacy-list-partition' -import type { StableAutomationAuthorityRef } from '../../../../shared/automations/ownership/automation-owner-ref' +import type { Repo } from '../../../../../shared/repo-types' +import type { LegacyAutomationPartitionContext } from '../../../../../shared/automations/ownership/automation-legacy-list-partition' +import type { StableAutomationAuthorityRef } from '../../../../../shared/automations/ownership/automation-owner-ref' import { automationAuthorityCatalogKey } from './automation-host-catalog-types' import { getRepoExecutionHostId, getRepoSshConnectionId, parseExecutionHostId -} from '../../../../shared/execution-host' +} from '../../../../../shared/execution-host' type RepoConnection = Pick diff --git a/src/renderer/src/components/automations/automation-capability-probe.ts b/src/renderer/src/components/automations/hosts/automation-capability-probe.ts similarity index 92% rename from src/renderer/src/components/automations/automation-capability-probe.ts rename to src/renderer/src/components/automations/hosts/automation-capability-probe.ts index 43350f0f710..a2a5c345482 100644 --- a/src/renderer/src/components/automations/automation-capability-probe.ts +++ b/src/renderer/src/components/automations/hosts/automation-capability-probe.ts @@ -1,24 +1,22 @@ import type { AutomationCreateInput, AutomationUpdateInput -} from '../../../../shared/automations/automation-definition' +} from '../../../../../shared/automations/automation-definition' import { AUTOMATION_LAUNCH_SETUP_RUNTIME_CAPABILITY, AUTOMATION_SURFACE_RUNTIME_CAPABILITY, - AUTOMATION_LIST_HOST_SCOPE_RUNTIME_CAPABILITY, - AUTOMATION_LIST_HOST_SCOPE_UPDATE_REQUIRED_MESSAGE, AUTOMATION_OWNER_FENCING_RUNTIME_CAPABILITY, AUTOMATION_OWNER_FENCING_UPDATE_REQUIRED_MESSAGE, AUTOMATION_CREATE_IDEMPOTENCY_RUNTIME_CAPABILITY, AUTOMATION_EXTRA_AGENT_ARGS_RUNTIME_CAPABILITY -} from '../../../../shared/automations/automation-runtime-capabilities' +} from '../../../../../shared/automations/automation-runtime-capabilities' import { getRuntimeEnvironmentStatus } from '@/runtime/rpc/compatibility/runtime-compatibility-probe' -import type { AutomationAuthorityRef } from '../../../../shared/automations/ownership/automation-owner-ref' -import type { RuntimeCapability } from '../../../../shared/protocol-version' +import type { AutomationAuthorityRef } from '../../../../../shared/automations/ownership/automation-owner-ref' +import type { RuntimeCapability } from '../../../../../shared/protocol-version' import { EXTRA_AGENT_ARGS_HOST_UPDATE_REQUIRED, hasExtraAgentArgs -} from '../../../../shared/agent-launch/startup/automation-extra-agent-args' +} from '../../../../../shared/agent-launch/startup/automation-extra-agent-args' import { automationAuthorityCatalogKey } from './automation-host-catalog-types' import { automationHostDiagnostics } from './automation-host-diagnostics' import { translate } from '@/i18n/i18n' @@ -191,12 +189,6 @@ export async function assertEnvironmentSupportsExtraAgentArgs( } } -export { - AUTOMATION_LIST_HOST_SCOPE_RUNTIME_CAPABILITY, - AUTOMATION_LIST_HOST_SCOPE_UPDATE_REQUIRED_MESSAGE, - AUTOMATION_CREATE_IDEMPOTENCY_RUNTIME_CAPABILITY -} - /** Old hosts keep their terminal contract; an explicit chat must refuse before a move creates anything. */ export async function prepareAutomationLaunchSetup< T extends AutomationCreateInput | AutomationUpdateInput diff --git a/src/renderer/src/components/automations/automation-captured-owner.test.ts b/src/renderer/src/components/automations/hosts/automation-captured-owner.test.ts similarity index 100% rename from src/renderer/src/components/automations/automation-captured-owner.test.ts rename to src/renderer/src/components/automations/hosts/automation-captured-owner.test.ts diff --git a/src/renderer/src/components/automations/automation-captured-owner.ts b/src/renderer/src/components/automations/hosts/automation-captured-owner.ts similarity index 92% rename from src/renderer/src/components/automations/automation-captured-owner.ts rename to src/renderer/src/components/automations/hosts/automation-captured-owner.ts index d7de9f229f0..d804dc626ac 100644 --- a/src/renderer/src/components/automations/automation-captured-owner.ts +++ b/src/renderer/src/components/automations/hosts/automation-captured-owner.ts @@ -1,13 +1,13 @@ /** Carry the listed owner into actions so a host move fences against the incarnation the user saw. Owned rows act normally, orphans allow pause/delete/history but cannot execute, and unfenced legacy rows stay view-only. */ -import { AUTOMATION_CAPTURED_HOST_REFUSALS } from '../../../../shared/automations/ownership/automation-owner-conflict' -import { AUTOMATION_ORPHAN_ISSUES } from '../../../../shared/automations/ownership/automation-list-scope' +import { AUTOMATION_CAPTURED_HOST_REFUSALS } from '../../../../../shared/automations/ownership/automation-owner-conflict' +import { AUTOMATION_ORPHAN_ISSUES } from '../../../../../shared/automations/ownership/automation-list-scope' import type { AutomationAuthorityRef, AutomationOwnerRef -} from '../../../../shared/automations/ownership/automation-owner-ref' -import { ownerKey } from '../../../../shared/automations/ownership/automation-owner-key' -import type { AutomationOwnerPrecondition } from '../../../../shared/automations/ownership/automation-owner-precondition' +} from '../../../../../shared/automations/ownership/automation-owner-ref' +import { ownerKey } from '../../../../../shared/automations/ownership/automation-owner-key' +import type { AutomationOwnerPrecondition } from '../../../../../shared/automations/ownership/automation-owner-precondition' import { translate } from '@/i18n/i18n' import type { Translate } from '@/i18n/use-translate' import type { AutomationHostRow, AutomationHostRowSelector } from './automation-host-cache-types' diff --git a/src/renderer/src/components/automations/automation-host-cache-controller.ts b/src/renderer/src/components/automations/hosts/automation-host-cache-controller.ts similarity index 98% rename from src/renderer/src/components/automations/automation-host-cache-controller.ts rename to src/renderer/src/components/automations/hosts/automation-host-cache-controller.ts index 35541c084a1..80d167157bf 100644 --- a/src/renderer/src/components/automations/automation-host-cache-controller.ts +++ b/src/renderer/src/components/automations/hosts/automation-host-cache-controller.ts @@ -1,11 +1,11 @@ /** Apply catalog membership/incarnation generations before fetching, discard stale work and evict missing entries. Background All-hosts refresh preserves unreachable authorities without dialing them. */ import { getRuntimeEnvironmentRevision } from '@/runtime/rpc/environment-revisions/runtime-environment-revision' -import type { LegacyAutomationPartitionContext } from '../../../../shared/automations/ownership/automation-legacy-list-partition' +import type { LegacyAutomationPartitionContext } from '../../../../../shared/automations/ownership/automation-legacy-list-partition' import type { AutomationAuthorityRef, StableAutomationAuthorityRef -} from '../../../../shared/automations/ownership/automation-owner-ref' +} from '../../../../../shared/automations/ownership/automation-owner-ref' import { syncAutomationHostCatalogGenerations } from './automation-host-catalog-generation' import type { AutomationHostCatalog, diff --git a/src/renderer/src/components/automations/automation-host-cache-error.test.ts b/src/renderer/src/components/automations/hosts/automation-host-cache-error.test.ts similarity index 93% rename from src/renderer/src/components/automations/automation-host-cache-error.test.ts rename to src/renderer/src/components/automations/hosts/automation-host-cache-error.test.ts index 6268e693234..630fa0b68ce 100644 --- a/src/renderer/src/components/automations/automation-host-cache-error.test.ts +++ b/src/renderer/src/components/automations/hosts/automation-host-cache-error.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import { RemoteRuntimeClientError } from '../../../../shared/remote-runtime/remote-runtime-client-error' +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 } { diff --git a/src/renderer/src/components/automations/automation-host-cache-error.ts b/src/renderer/src/components/automations/hosts/automation-host-cache-error.ts similarity index 90% rename from src/renderer/src/components/automations/automation-host-cache-error.ts rename to src/renderer/src/components/automations/hosts/automation-host-cache-error.ts index c0f0be1a0b2..e4cda8def2a 100644 --- a/src/renderer/src/components/automations/automation-host-cache-error.ts +++ b/src/renderer/src/components/automations/hosts/automation-host-cache-error.ts @@ -1,15 +1,13 @@ /** Classify by error code: contract/owner failures do not spend retry budget; unreachable or slow hosts do. */ -import { hasRuntimeRpcErrorCode } from '../../../../shared/runtime-rpc-error-code' +import { hasRuntimeRpcErrorCode } from '../../../../../shared/runtime-rpc-error-code' import { AUTOMATION_OWNER_CONFLICT_CODES, matchAutomationOwnerConflict, stripAutomationOwnerConflictCode -} from '../../../../shared/automations/ownership/automation-owner-conflict' -import { - AutomationHostScopeUnsupportedError, - AutomationListResponseError -} from './automation-scoped-list-client' +} from '../../../../../shared/automations/ownership/automation-owner-conflict' +import { AutomationHostScopeUnsupportedError } from './automation-capability-probe' +import { AutomationListResponseError } from './automation-scoped-list-client' import type { AutomationHostQueryError, AutomationHostQueryErrorCode diff --git a/src/renderer/src/components/automations/automation-host-cache-health.test.ts b/src/renderer/src/components/automations/hosts/automation-host-cache-health.test.ts similarity index 100% rename from src/renderer/src/components/automations/automation-host-cache-health.test.ts rename to src/renderer/src/components/automations/hosts/automation-host-cache-health.test.ts diff --git a/src/renderer/src/components/automations/automation-host-cache-health.ts b/src/renderer/src/components/automations/hosts/automation-host-cache-health.ts similarity index 100% rename from src/renderer/src/components/automations/automation-host-cache-health.ts rename to src/renderer/src/components/automations/hosts/automation-host-cache-health.ts diff --git a/src/renderer/src/components/automations/automation-host-cache-rows.ts b/src/renderer/src/components/automations/hosts/automation-host-cache-rows.ts similarity index 89% rename from src/renderer/src/components/automations/automation-host-cache-rows.ts rename to src/renderer/src/components/automations/hosts/automation-host-cache-rows.ts index 643202c371c..f4c63e9273e 100644 --- a/src/renderer/src/components/automations/automation-host-cache-rows.ts +++ b/src/renderer/src/components/automations/hosts/automation-host-cache-rows.ts @@ -1,17 +1,17 @@ /** Scoped rows retain their captured owner for later fences. Legacy responses prove neither owner nor usage; never compensate with run-history downloads. */ -import type { Automation } from '../../../../shared/automations/automation-definition' -import type { AutomationListItem } from '../../../../shared/automations/ownership/automation-list-scope' +import type { Automation } from '../../../../../shared/automations/automation-definition' +import type { AutomationListItem } from '../../../../../shared/automations/ownership/automation-list-scope' import { partitionLegacyAutomationList, type LegacyAutomationPartitionContext, type LegacyAutomationSelector -} from '../../../../shared/automations/ownership/automation-legacy-list-partition' +} from '../../../../../shared/automations/ownership/automation-legacy-list-partition' import type { AutomationAuthorityRef, AutomationOwnerRef, StableAutomationCatalogRef -} from '../../../../shared/automations/ownership/automation-owner-ref' +} from '../../../../../shared/automations/ownership/automation-owner-ref' import type { ScopedAutomationList } from './automation-scoped-list-client' import type { AutomationHostRow } from './automation-host-cache-types' diff --git a/src/renderer/src/components/automations/automation-host-cache-types.ts b/src/renderer/src/components/automations/hosts/automation-host-cache-types.ts similarity index 81% rename from src/renderer/src/components/automations/automation-host-cache-types.ts rename to src/renderer/src/components/automations/hosts/automation-host-cache-types.ts index 2b49f0aa0ad..9acef78e5dd 100644 --- a/src/renderer/src/components/automations/automation-host-cache-types.ts +++ b/src/renderer/src/components/automations/hosts/automation-host-cache-types.ts @@ -1,13 +1,13 @@ /** Rows retain captured owners, null when unqualified; requests retain all three generations required by their commit fence. */ -import type { Automation } from '../../../../shared/automations/automation-definition' -import type { AutomationListItemSelector } from '../../../../shared/automations/ownership/automation-list-scope' -import type { LegacyAutomationSelector } from '../../../../shared/automations/ownership/automation-legacy-list-partition' +import type { Automation } from '../../../../../shared/automations/automation-definition' +import type { AutomationListItemSelector } from '../../../../../shared/automations/ownership/automation-list-scope' +import type { LegacyAutomationSelector } from '../../../../../shared/automations/ownership/automation-legacy-list-partition' import type { AutomationAuthorityRef, AutomationOwnerRef -} from '../../../../shared/automations/ownership/automation-owner-ref' -import type { AutomationUsageSummary } from '../../../../shared/automations/history/automation-usage-summary' +} from '../../../../../shared/automations/ownership/automation-owner-ref' +import type { AutomationUsageSummary } from '../../../../../shared/automations/history/automation-usage-summary' /** A legacy SSH row carries no registration generation, which is why it can never be fenced. */ export type AutomationHostRowSelector = AutomationListItemSelector | LegacyAutomationSelector diff --git a/src/renderer/src/components/automations/automation-host-cache.test.ts b/src/renderer/src/components/automations/hosts/automation-host-cache.test.ts similarity index 94% rename from src/renderer/src/components/automations/automation-host-cache.test.ts rename to src/renderer/src/components/automations/hosts/automation-host-cache.test.ts index fd6870a6d42..5ad2c8280b5 100644 --- a/src/renderer/src/components/automations/automation-host-cache.test.ts +++ b/src/renderer/src/components/automations/hosts/automation-host-cache.test.ts @@ -1,12 +1,12 @@ /** A formerly correct answer can arrive after host replacement; the commit fence must reject it instead of misattributing automations. */ import { describe, expect, it } from 'vitest' -import type { Automation } from '../../../../shared/automations/automation-definition' -import { hostStableKey } from '../../../../shared/automations/ownership/automation-owner-key' +import type { Automation } from '../../../../../shared/automations/automation-definition' +import { hostStableKey } from '../../../../../shared/automations/ownership/automation-owner-key' import type { StableAutomationAuthorityRef, StableAutomationCatalogRef -} from '../../../../shared/automations/ownership/automation-owner-ref' +} from '../../../../../shared/automations/ownership/automation-owner-ref' import { createAutomationHostCache } from './automation-host-cache' import type { AutomationHostRow } from './automation-host-cache-types' diff --git a/src/renderer/src/components/automations/automation-host-cache.ts b/src/renderer/src/components/automations/hosts/automation-host-cache.ts similarity index 98% rename from src/renderer/src/components/automations/automation-host-cache.ts rename to src/renderer/src/components/automations/hosts/automation-host-cache.ts index 80bed279cd2..edf9ff5aafb 100644 --- a/src/renderer/src/components/automations/automation-host-cache.ts +++ b/src/renderer/src/components/automations/hosts/automation-host-cache.ts @@ -1,11 +1,11 @@ /** Commit only while request, authority-catalog and connection generations match. This rejects stale answers after re-pair, re-registration or host changes; removal tombstones advance the same catalog fence. */ import { getRuntimeEnvironmentRevision } from '@/runtime/rpc/environment-revisions/runtime-environment-revision' -import { hostStableKey } from '../../../../shared/automations/ownership/automation-owner-key' +import { hostStableKey } from '../../../../../shared/automations/ownership/automation-owner-key' import type { StableAutomationAuthorityRef, StableAutomationCatalogRef -} from '../../../../shared/automations/ownership/automation-owner-ref' +} from '../../../../../shared/automations/ownership/automation-owner-ref' import { automationAuthorityCatalogKey } from './automation-host-catalog-types' import { getAuthorityCatalogGeneration } from './automation-host-catalog-generation' import { diff --git a/src/renderer/src/components/automations/automation-host-catalog-generation.ts b/src/renderer/src/components/automations/hosts/automation-host-catalog-generation.ts similarity index 96% rename from src/renderer/src/components/automations/automation-host-catalog-generation.ts rename to src/renderer/src/components/automations/hosts/automation-host-catalog-generation.ts index 89dfb296c72..5fb7d46cf54 100644 --- a/src/renderer/src/components/automations/automation-host-catalog-generation.ts +++ b/src/renderer/src/components/automations/hosts/automation-host-catalog-generation.ts @@ -1,5 +1,5 @@ -import { ownerKey } from '../../../../shared/automations/ownership/automation-owner-key' -import type { StableAutomationAuthorityRef } from '../../../../shared/automations/ownership/automation-owner-ref' +import { ownerKey } from '../../../../../shared/automations/ownership/automation-owner-key' +import type { StableAutomationAuthorityRef } from '../../../../../shared/automations/ownership/automation-owner-ref' import { automationAuthorityCatalogKey, type AutomationHostCatalog, diff --git a/src/renderer/src/components/automations/automation-host-catalog-order.ts b/src/renderer/src/components/automations/hosts/automation-host-catalog-order.ts similarity index 100% rename from src/renderer/src/components/automations/automation-host-catalog-order.ts rename to src/renderer/src/components/automations/hosts/automation-host-catalog-order.ts diff --git a/src/renderer/src/components/automations/automation-host-catalog-source.ts b/src/renderer/src/components/automations/hosts/automation-host-catalog-source.ts similarity index 92% rename from src/renderer/src/components/automations/automation-host-catalog-source.ts rename to src/renderer/src/components/automations/hosts/automation-host-catalog-source.ts index 8f551e83044..bfd8fe113a8 100644 --- a/src/renderer/src/components/automations/automation-host-catalog-source.ts +++ b/src/renderer/src/components/automations/hosts/automation-host-catalog-source.ts @@ -1,10 +1,10 @@ /** Build catalog input only from mirrored store state. Fold query results into the separate health projection so cache commits cannot trigger generation changes/cancellation. */ -import { getLocalExecutionHostLabel } from '../../../../shared/execution-host' -import { AUTOMATION_LIST_HOST_SCOPE_RUNTIME_CAPABILITY } from '../../../../shared/automations/automation-runtime-capabilities' -import type { RuntimeStatus } from '../../../../shared/runtime-session-contracts' -import type { SshConnectionStatus } from '../../../../shared/ssh-types' -import type { StableAutomationAuthorityRef } from '../../../../shared/automations/ownership/automation-owner-ref' +import { getLocalExecutionHostLabel } from '../../../../../shared/execution-host' +import { AUTOMATION_LIST_HOST_SCOPE_RUNTIME_CAPABILITY } from '../../../../../shared/automations/automation-runtime-capabilities' +import type { RuntimeStatus } from '../../../../../shared/runtime-session-contracts' +import type { SshConnectionStatus } from '../../../../../shared/ssh-types' +import type { StableAutomationAuthorityRef } from '../../../../../shared/automations/ownership/automation-owner-ref' import type { AutomationAuthorityHealth, AutomationCatalogSshMirrorInput, diff --git a/src/renderer/src/components/automations/automation-host-catalog-types.ts b/src/renderer/src/components/automations/hosts/automation-host-catalog-types.ts similarity index 97% rename from src/renderer/src/components/automations/automation-host-catalog-types.ts rename to src/renderer/src/components/automations/hosts/automation-host-catalog-types.ts index e0d30aef0e4..287be350acc 100644 --- a/src/renderer/src/components/automations/automation-host-catalog-types.ts +++ b/src/renderer/src/components/automations/hosts/automation-host-catalog-types.ts @@ -2,8 +2,8 @@ import type { AutomationOwnerRef, StableAutomationAuthorityRef, StableAutomationCatalogRef -} from '../../../../shared/automations/ownership/automation-owner-ref' -import type { SshConnectionStatus } from '../../../../shared/ssh-types' +} from '../../../../../shared/automations/ownership/automation-owner-ref' +import type { SshConnectionStatus } from '../../../../../shared/ssh-types' /** Authority storage-query health, independent of execution targets; SSH downtime must not prevent listing/editing stored records. */ export type AutomationAuthorityHealth = diff --git a/src/renderer/src/components/automations/automation-host-catalog.ts b/src/renderer/src/components/automations/hosts/automation-host-catalog.ts similarity index 98% rename from src/renderer/src/components/automations/automation-host-catalog.ts rename to src/renderer/src/components/automations/hosts/automation-host-catalog.ts index f70f2c756a9..cc994d823fc 100644 --- a/src/renderer/src/components/automations/automation-host-catalog.ts +++ b/src/renderer/src/components/automations/hosts/automation-host-catalog.ts @@ -1,14 +1,14 @@ import { hostStableKey, parseHostStableKey -} from '../../../../shared/automations/ownership/automation-owner-key' +} from '../../../../../shared/automations/ownership/automation-owner-key' import { translate } from '@/i18n/i18n' import type { AutomationOwnerRef, StableAutomationAuthorityRef, StableAutomationCatalogRef -} from '../../../../shared/automations/ownership/automation-owner-ref' -import { isOwnedSshTargetId } from '../../../../shared/execution-host' +} from '../../../../../shared/automations/ownership/automation-owner-ref' +import { isOwnedSshTargetId } from '../../../../../shared/execution-host' import { automationAuthorityCatalogKey, type AutomationCatalogSshMirrorInput, diff --git a/src/renderer/src/components/automations/automation-host-client.test.ts b/src/renderer/src/components/automations/hosts/automation-host-client.test.ts similarity index 98% rename from src/renderer/src/components/automations/automation-host-client.test.ts rename to src/renderer/src/components/automations/hosts/automation-host-client.test.ts index 480c6dcd016..2f1a249a1aa 100644 --- a/src/renderer/src/components/automations/automation-host-client.test.ts +++ b/src/renderer/src/components/automations/hosts/automation-host-client.test.ts @@ -2,7 +2,7 @@ import { describe, expect, it, vi, beforeEach } from 'vitest' import type { Automation, AutomationCreateInput -} from '../../../../shared/automations/automation-definition' +} from '../../../../../shared/automations/automation-definition' import { getAutomationListedTargetFromHostId, toRuntimeAutomationCreateInput diff --git a/src/renderer/src/components/automations/automation-host-client.ts b/src/renderer/src/components/automations/hosts/automation-host-client.ts similarity index 93% rename from src/renderer/src/components/automations/automation-host-client.ts rename to src/renderer/src/components/automations/hosts/automation-host-client.ts index 82290fe80db..ccc395d8126 100644 --- a/src/renderer/src/components/automations/automation-host-client.ts +++ b/src/renderer/src/components/automations/hosts/automation-host-client.ts @@ -5,11 +5,11 @@ import type { Automation, AutomationCreateInput, AutomationUpdateInput -} from '../../../../shared/automations/automation-definition' -import type { AutomationRun } from '../../../../shared/automations/history/automation-run' -import type { StableAutomationAuthorityRef } from '../../../../shared/automations/ownership/automation-owner-ref' -import { parseExecutionHostId } from '../../../../shared/execution-host' -import type { GlobalSettings } from '../../../../shared/global-settings-types' +} from '../../../../../shared/automations/automation-definition' +import type { AutomationRun } from '../../../../../shared/automations/history/automation-run' +import type { StableAutomationAuthorityRef } from '../../../../../shared/automations/ownership/automation-owner-ref' +import { parseExecutionHostId } from '../../../../../shared/execution-host' +import type { GlobalSettings } from '../../../../../shared/global-settings-types' type RuntimeAutomationCreateInput = Omit< AutomationCreateInput, diff --git a/src/renderer/src/components/automations/automation-host-detail-display.ts b/src/renderer/src/components/automations/hosts/automation-host-detail-display.ts similarity index 90% rename from src/renderer/src/components/automations/automation-host-detail-display.ts rename to src/renderer/src/components/automations/hosts/automation-host-detail-display.ts index b11110667e5..c9c4eba9114 100644 --- a/src/renderer/src/components/automations/automation-host-detail-display.ts +++ b/src/renderer/src/components/automations/hosts/automation-host-detail-display.ts @@ -1,7 +1,7 @@ // Use the catalog row’s storage host: a record’s local target means local to its server. Fall back to that target only for uncaptured legacy rows. -import type { Automation } from '../../../../shared/automations/automation-definition' -import { getExecutionHostLabel, toSshExecutionHostId } from '../../../../shared/execution-host' +import type { Automation } from '../../../../../shared/automations/automation-definition' +import { getExecutionHostLabel, toSshExecutionHostId } from '../../../../../shared/execution-host' import type { AutomationHostCatalogEntry } from './automation-host-catalog-types' export type AutomationHostDetailDisplay = { diff --git a/src/renderer/src/components/automations/automation-host-diagnostics.ts b/src/renderer/src/components/automations/hosts/automation-host-diagnostics.ts similarity index 100% rename from src/renderer/src/components/automations/automation-host-diagnostics.ts rename to src/renderer/src/components/automations/hosts/automation-host-diagnostics.ts diff --git a/src/renderer/src/components/automations/automation-host-fetch-target.ts b/src/renderer/src/components/automations/hosts/automation-host-fetch-target.ts similarity index 91% rename from src/renderer/src/components/automations/automation-host-fetch-target.ts rename to src/renderer/src/components/automations/hosts/automation-host-fetch-target.ts index 93ba4f68668..012edc35c73 100644 --- a/src/renderer/src/components/automations/automation-host-fetch-target.ts +++ b/src/renderer/src/components/automations/hosts/automation-host-fetch-target.ts @@ -1,6 +1,6 @@ /** Manual Retry carries the same catalog incarnation as scheduled work so its response can pass the commit fence. */ -import type { AutomationAuthorityRef } from '../../../../shared/automations/ownership/automation-owner-ref' +import type { AutomationAuthorityRef } from '../../../../../shared/automations/ownership/automation-owner-ref' import type { AutomationHostCatalogEntry } from './automation-host-catalog-types' import type { AutomationHostFetchTarget } from './automation-host-scheduler' diff --git a/src/renderer/src/components/automations/automation-host-filter-resolution.ts b/src/renderer/src/components/automations/hosts/automation-host-filter-resolution.ts similarity index 96% rename from src/renderer/src/components/automations/automation-host-filter-resolution.ts rename to src/renderer/src/components/automations/hosts/automation-host-filter-resolution.ts index e7a1c3a3298..37c59e1c21a 100644 --- a/src/renderer/src/components/automations/automation-host-filter-resolution.ts +++ b/src/renderer/src/components/automations/hosts/automation-host-filter-resolution.ts @@ -2,8 +2,8 @@ import { ALL_AUTOMATION_HOSTS_FILTER, automationHostFilterStableKey, type AutomationHostFilter -} from '../../../../shared/automations/ownership/automation-host-filter' -import type { StableAutomationCatalogRef } from '../../../../shared/automations/ownership/automation-owner-ref' +} from '../../../../../shared/automations/ownership/automation-host-filter' +import type { StableAutomationCatalogRef } from '../../../../../shared/automations/ownership/automation-owner-ref' import { automationAuthorityCatalogKey, type AutomationCatalogHydrationEvidence, diff --git a/src/renderer/src/components/automations/automation-host-health.test.ts b/src/renderer/src/components/automations/hosts/automation-host-health.test.ts similarity index 100% rename from src/renderer/src/components/automations/automation-host-health.test.ts rename to src/renderer/src/components/automations/hosts/automation-host-health.test.ts diff --git a/src/renderer/src/components/automations/automation-host-health.ts b/src/renderer/src/components/automations/hosts/automation-host-health.ts similarity index 97% rename from src/renderer/src/components/automations/automation-host-health.ts rename to src/renderer/src/components/automations/hosts/automation-host-health.ts index 3b9ddbe8bdf..4134f7471f7 100644 --- a/src/renderer/src/components/automations/automation-host-health.ts +++ b/src/renderer/src/components/automations/hosts/automation-host-health.ts @@ -1,4 +1,4 @@ -import type { SshConnectionStatus } from '../../../../shared/ssh-types' +import type { SshConnectionStatus } from '../../../../../shared/ssh-types' import type { AutomationAuthorityHealth, AutomationExecutionHealth, diff --git a/src/renderer/src/components/automations/automation-host-invalidation-window-events.ts b/src/renderer/src/components/automations/hosts/automation-host-invalidation-window-events.ts similarity index 91% rename from src/renderer/src/components/automations/automation-host-invalidation-window-events.ts rename to src/renderer/src/components/automations/hosts/automation-host-invalidation-window-events.ts index 5febf048f5f..f56f380c2df 100644 --- a/src/renderer/src/components/automations/automation-host-invalidation-window-events.ts +++ b/src/renderer/src/components/automations/hosts/automation-host-invalidation-window-events.ts @@ -5,7 +5,7 @@ import { automationsChangedWindowDetail, type AutomationsChangedWindowDetail } from '@/lib/automations-changed-window-event' -import type { StableAutomationAuthorityRef } from '../../../../shared/automations/ownership/automation-owner-ref' +import type { StableAutomationAuthorityRef } from '../../../../../shared/automations/ownership/automation-owner-ref' import type { AutomationAuthorityChangeEvent } from './automation-host-invalidation' export function toAutomationAuthorityChangeEvent( diff --git a/src/renderer/src/components/automations/automation-host-invalidation.ts b/src/renderer/src/components/automations/hosts/automation-host-invalidation.ts similarity index 95% rename from src/renderer/src/components/automations/automation-host-invalidation.ts rename to src/renderer/src/components/automations/hosts/automation-host-invalidation.ts index 5975442852b..41cf40b13f9 100644 --- a/src/renderer/src/components/automations/automation-host-invalidation.ts +++ b/src/renderer/src/components/automations/hosts/automation-host-invalidation.ts @@ -1,10 +1,10 @@ /** Invalidate only the scoped entry or unscoped publisher authority. Coalesce event bursts in one microtask so definition/run/usage writes share one refresh and legacy authority request. */ -import { hostStableKey } from '../../../../shared/automations/ownership/automation-owner-key' +import { hostStableKey } from '../../../../../shared/automations/ownership/automation-owner-key' import type { StableAutomationAuthorityRef, StableAutomationCatalogRef -} from '../../../../shared/automations/ownership/automation-owner-ref' +} from '../../../../../shared/automations/ownership/automation-owner-ref' import { automationAuthorityCatalogKey } from './automation-host-catalog-types' import type { AutomationHostCache } from './automation-host-cache' diff --git a/src/renderer/src/components/automations/automation-host-list-rows.test.ts b/src/renderer/src/components/automations/hosts/automation-host-list-rows.test.ts similarity index 98% rename from src/renderer/src/components/automations/automation-host-list-rows.test.ts rename to src/renderer/src/components/automations/hosts/automation-host-list-rows.test.ts index 3ea5c7d8d3a..7c3a41555bf 100644 --- a/src/renderer/src/components/automations/automation-host-list-rows.test.ts +++ b/src/renderer/src/components/automations/hosts/automation-host-list-rows.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import type { Automation } from '../../../../shared/automations/automation-definition' +import type { Automation } from '../../../../../shared/automations/automation-definition' import type { AutomationHostCacheEntry, AutomationHostRow } from './automation-host-cache-types' import type { AutomationHostCatalog, diff --git a/src/renderer/src/components/automations/automation-host-list-rows.ts b/src/renderer/src/components/automations/hosts/automation-host-list-rows.ts similarity index 97% rename from src/renderer/src/components/automations/automation-host-list-rows.ts rename to src/renderer/src/components/automations/hosts/automation-host-list-rows.ts index 49fff53429c..00f6c079052 100644 --- a/src/renderer/src/components/automations/automation-host-list-rows.ts +++ b/src/renderer/src/components/automations/hosts/automation-host-list-rows.ts @@ -1,6 +1,6 @@ /** Keep host origin on every visible row. Until a host in view commits an answer, preserve the caller’s prior rows instead of claiming an empty result. */ -import type { Automation } from '../../../../shared/automations/automation-definition' +import type { Automation } from '../../../../../shared/automations/automation-definition' import type { AutomationHostCacheEntry } from './automation-host-cache-types' import type { AutomationHostCatalog, @@ -17,7 +17,7 @@ import { automationAuthorityRecordKey, automationListRowKey, type AutomationListRow -} from './automation-list-row-identity' +} from '../listing/automation-list-row-identity' export type AutomationHostGroupHost = { entry: AutomationHostCatalogEntry diff --git a/src/renderer/src/components/automations/automation-host-picker-groups.ts b/src/renderer/src/components/automations/hosts/automation-host-picker-groups.ts similarity index 100% rename from src/renderer/src/components/automations/automation-host-picker-groups.ts rename to src/renderer/src/components/automations/hosts/automation-host-picker-groups.ts diff --git a/src/renderer/src/components/automations/automation-host-recovery.test.ts b/src/renderer/src/components/automations/hosts/automation-host-recovery.test.ts similarity index 100% rename from src/renderer/src/components/automations/automation-host-recovery.test.ts rename to src/renderer/src/components/automations/hosts/automation-host-recovery.test.ts diff --git a/src/renderer/src/components/automations/automation-host-recovery.ts b/src/renderer/src/components/automations/hosts/automation-host-recovery.ts similarity index 100% rename from src/renderer/src/components/automations/automation-host-recovery.ts rename to src/renderer/src/components/automations/hosts/automation-host-recovery.ts diff --git a/src/renderer/src/components/automations/automation-host-request-instrumentation.ts b/src/renderer/src/components/automations/hosts/automation-host-request-instrumentation.ts similarity index 94% rename from src/renderer/src/components/automations/automation-host-request-instrumentation.ts rename to src/renderer/src/components/automations/hosts/automation-host-request-instrumentation.ts index ffc9ac610c7..2e3717e8494 100644 --- a/src/renderer/src/components/automations/automation-host-request-instrumentation.ts +++ b/src/renderer/src/components/automations/hosts/automation-host-request-instrumentation.ts @@ -1,7 +1,7 @@ /** Translate scheduler work into counters: legacy requests/dedupe/discards belong to an authority, never one stable host key. */ -import { hostStableKey } from '../../../../shared/automations/ownership/automation-owner-key' -import type { StableAutomationCatalogRef } from '../../../../shared/automations/ownership/automation-owner-ref' +import { hostStableKey } from '../../../../../shared/automations/ownership/automation-owner-key' +import type { StableAutomationCatalogRef } from '../../../../../shared/automations/ownership/automation-owner-ref' import { automationAuthorityCatalogKey, type AutomationHostQuerySupport diff --git a/src/renderer/src/components/automations/automation-host-retry-schedule.ts b/src/renderer/src/components/automations/hosts/automation-host-retry-schedule.ts similarity index 100% rename from src/renderer/src/components/automations/automation-host-retry-schedule.ts rename to src/renderer/src/components/automations/hosts/automation-host-retry-schedule.ts diff --git a/src/renderer/src/components/automations/automation-host-scheduler-plan.ts b/src/renderer/src/components/automations/hosts/automation-host-scheduler-plan.ts similarity index 95% rename from src/renderer/src/components/automations/automation-host-scheduler-plan.ts rename to src/renderer/src/components/automations/hosts/automation-host-scheduler-plan.ts index 3c54f554361..084aa46a14a 100644 --- a/src/renderer/src/components/automations/automation-host-scheduler-plan.ts +++ b/src/renderer/src/components/automations/hosts/automation-host-scheduler-plan.ts @@ -1,6 +1,6 @@ /** Capture fences only for requests that survive dedupe, freshness, in-flight and retry-cooldown checks. */ -import { hostStableKey } from '../../../../shared/automations/ownership/automation-owner-key' +import { hostStableKey } from '../../../../../shared/automations/ownership/automation-owner-key' import type { AutomationHostCache } from './automation-host-cache' import type { AutomationHostRequestFence } from './automation-host-cache-types' import type { AutomationHostFetchTarget } from './automation-host-scheduler' diff --git a/src/renderer/src/components/automations/automation-host-scheduler-queue.ts b/src/renderer/src/components/automations/hosts/automation-host-scheduler-queue.ts similarity index 100% rename from src/renderer/src/components/automations/automation-host-scheduler-queue.ts rename to src/renderer/src/components/automations/hosts/automation-host-scheduler-queue.ts diff --git a/src/renderer/src/components/automations/automation-host-scheduler.test.ts b/src/renderer/src/components/automations/hosts/automation-host-scheduler.test.ts similarity index 97% rename from src/renderer/src/components/automations/automation-host-scheduler.test.ts rename to src/renderer/src/components/automations/hosts/automation-host-scheduler.test.ts index b882f6a87f3..a0856d22542 100644 --- a/src/renderer/src/components/automations/automation-host-scheduler.test.ts +++ b/src/renderer/src/components/automations/hosts/automation-host-scheduler.test.ts @@ -1,13 +1,13 @@ /** Enforce four pooled calls, one legacy authority call per cycle and no run-history fetch to fill missing usage. */ import { describe, expect, it, vi } from 'vitest' -import type { Automation } from '../../../../shared/automations/automation-definition' +import type { Automation } from '../../../../../shared/automations/automation-definition' import type { AutomationAuthorityRef, StableAutomationAuthorityRef, StableAutomationCatalogRef -} from '../../../../shared/automations/ownership/automation-owner-ref' +} from '../../../../../shared/automations/ownership/automation-owner-ref' import { createAutomationHostCache, type AutomationHostCache } from './automation-host-cache' import type { AutomationHostQuerySupport } from './automation-host-catalog-types' import { diff --git a/src/renderer/src/components/automations/automation-host-scheduler.ts b/src/renderer/src/components/automations/hosts/automation-host-scheduler.ts similarity index 95% rename from src/renderer/src/components/automations/automation-host-scheduler.ts rename to src/renderer/src/components/automations/hosts/automation-host-scheduler.ts index 32b0cb5079a..5b0e2574c56 100644 --- a/src/renderer/src/components/automations/automation-host-scheduler.ts +++ b/src/renderer/src/components/automations/hosts/automation-host-scheduler.ts @@ -1,15 +1,15 @@ /** Fetch through four pooled calls, share each legacy authority answer across its entries, and publish only responses that pass the cache fence. */ -import type { Automation } from '../../../../shared/automations/automation-definition' -import type { AutomationListScopeSelector } from '../../../../shared/automations/ownership/automation-list-scope' -import type { LegacyAutomationPartitionContext } from '../../../../shared/automations/ownership/automation-legacy-list-partition' -import { hostStableKey } from '../../../../shared/automations/ownership/automation-owner-key' +import type { Automation } from '../../../../../shared/automations/automation-definition' +import type { AutomationListScopeSelector } from '../../../../../shared/automations/ownership/automation-list-scope' +import type { LegacyAutomationPartitionContext } from '../../../../../shared/automations/ownership/automation-legacy-list-partition' +import { hostStableKey } from '../../../../../shared/automations/ownership/automation-owner-key' import type { AutomationAuthorityRef, AutomationOwnerRef, StableAutomationAuthorityRef, StableAutomationCatalogRef -} from '../../../../shared/automations/ownership/automation-owner-ref' +} from '../../../../../shared/automations/ownership/automation-owner-ref' import { automationAuthorityCatalogKey, type AutomationHostQuerySupport @@ -20,8 +20,8 @@ import { partitionLegacyAutomationHostRows, toScopedAutomationHostRows } from './automation-host-cache-rows' +import { AutomationHostScopeUnsupportedError } from './automation-capability-probe' import { - AutomationHostScopeUnsupportedError, listLegacyAutomations, listScopedAutomations, type ScopedAutomationList diff --git a/src/renderer/src/components/automations/automation-host-scope-descriptors.ts b/src/renderer/src/components/automations/hosts/automation-host-scope-descriptors.ts similarity index 100% rename from src/renderer/src/components/automations/automation-host-scope-descriptors.ts rename to src/renderer/src/components/automations/hosts/automation-host-scope-descriptors.ts diff --git a/src/renderer/src/components/automations/automation-host-status-descriptors.ts b/src/renderer/src/components/automations/hosts/automation-host-status-descriptors.ts similarity index 100% rename from src/renderer/src/components/automations/automation-host-status-descriptors.ts rename to src/renderer/src/components/automations/hosts/automation-host-status-descriptors.ts diff --git a/src/renderer/src/components/automations/automation-notice-recovery-host.ts b/src/renderer/src/components/automations/hosts/automation-notice-recovery-host.ts similarity index 77% rename from src/renderer/src/components/automations/automation-notice-recovery-host.ts rename to src/renderer/src/components/automations/hosts/automation-notice-recovery-host.ts index b16c90ed33d..c17281e0677 100644 --- a/src/renderer/src/components/automations/automation-notice-recovery-host.ts +++ b/src/renderer/src/components/automations/hosts/automation-notice-recovery-host.ts @@ -1,7 +1,7 @@ /** Recover against the refused row’s captured owner or create destination; the list filter may point elsewhere or to All hosts. */ -import { hostStableKey } from '../../../../shared/automations/ownership/automation-owner-key' -import type { AutomationAuthorityRef } from '../../../../shared/automations/ownership/automation-owner-ref' +import { hostStableKey } from '../../../../../shared/automations/ownership/automation-owner-key' +import type { AutomationAuthorityRef } from '../../../../../shared/automations/ownership/automation-owner-ref' import type { AutomationCapturedOwner } from './automation-captured-owner' import type { AutomationHostCatalog, diff --git a/src/renderer/src/components/automations/automation-owner-action-runner.ts b/src/renderer/src/components/automations/hosts/automation-owner-action-runner.ts similarity index 94% rename from src/renderer/src/components/automations/automation-owner-action-runner.ts rename to src/renderer/src/components/automations/hosts/automation-owner-action-runner.ts index 069da14a8f5..e3e5ee0a403 100644 --- a/src/renderer/src/components/automations/automation-owner-action-runner.ts +++ b/src/renderer/src/components/automations/hosts/automation-owner-action-runner.ts @@ -4,30 +4,30 @@ import type { Automation, AutomationCreateInput, AutomationUpdateInput -} from '../../../../shared/automations/automation-definition' +} from '../../../../../shared/automations/automation-definition' import type { AutomationRun, AutomationRunsPage -} from '../../../../shared/automations/history/automation-run' +} from '../../../../../shared/automations/history/automation-run' import { automationOwnerConflictMessage, matchAutomationOwnerConflict, stripAutomationOwnerConflictCode, type AutomationOwnerConflictCode -} from '../../../../shared/automations/ownership/automation-owner-conflict' +} from '../../../../../shared/automations/ownership/automation-owner-conflict' 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 { translate } from '@/i18n/i18n' import type { AutomationActionAvailability, AutomationActionBlock } from './automation-captured-owner' import type { AutomationHostRecoveryAction } from './automation-host-status-descriptors' +import { AutomationHostScopeUnsupportedError } from './automation-capability-probe' import { - AutomationHostScopeUnsupportedError, createAutomationForDestination, deleteAutomationForOwner, deleteOrphanAutomation, diff --git a/src/renderer/src/components/automations/automation-row-action-dispatch.ts b/src/renderer/src/components/automations/hosts/automation-row-action-dispatch.ts similarity index 94% rename from src/renderer/src/components/automations/automation-row-action-dispatch.ts rename to src/renderer/src/components/automations/hosts/automation-row-action-dispatch.ts index f42209f22bd..ccffe685eb5 100644 --- a/src/renderer/src/components/automations/automation-row-action-dispatch.ts +++ b/src/renderer/src/components/automations/hosts/automation-row-action-dispatch.ts @@ -3,13 +3,13 @@ import type { Automation, AutomationUpdateInput -} from '../../../../shared/automations/automation-definition' +} from '../../../../../shared/automations/automation-definition' import type { AutomationRun, AutomationRunsPage -} from '../../../../shared/automations/history/automation-run' -import type { AutomationAuthorityRef } from '../../../../shared/automations/ownership/automation-owner-ref' -import type { AutomationDestination } from '../../../../shared/automations/ownership/automation-owner-precondition' +} from '../../../../../shared/automations/history/automation-run' +import type { AutomationAuthorityRef } from '../../../../../shared/automations/ownership/automation-owner-ref' +import type { AutomationDestination } from '../../../../../shared/automations/ownership/automation-owner-precondition' import { automationActionAvailability, capturedAutomationOwner, diff --git a/src/renderer/src/components/automations/automation-run-context-host-match.ts b/src/renderer/src/components/automations/hosts/automation-run-context-host-match.ts similarity index 89% rename from src/renderer/src/components/automations/automation-run-context-host-match.ts rename to src/renderer/src/components/automations/hosts/automation-run-context-host-match.ts index 72eb4951ef4..1508d24cd76 100644 --- a/src/renderer/src/components/automations/automation-run-context-host-match.ts +++ b/src/renderer/src/components/automations/hosts/automation-run-context-host-match.ts @@ -1,11 +1,11 @@ import type { AutomationHostTarget } from './automation-host-client' -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 { getRepoExecutionHostId, getRepoSshConnectionId, toSshExecutionHostId -} from '../../../../shared/execution-host' +} from '../../../../../shared/execution-host' function getRuntimeTargetHostId(target: AutomationHostTarget | null | undefined): string | null { return target?.kind === 'environment' diff --git a/src/renderer/src/components/automations/automation-scoped-list-client.ts b/src/renderer/src/components/automations/hosts/automation-scoped-list-client.ts similarity index 93% rename from src/renderer/src/components/automations/automation-scoped-list-client.ts rename to src/renderer/src/components/automations/hosts/automation-scoped-list-client.ts index b8e6ee654f4..7bae5db087d 100644 --- a/src/renderer/src/components/automations/automation-scoped-list-client.ts +++ b/src/renderer/src/components/automations/hosts/automation-scoped-list-client.ts @@ -1,31 +1,31 @@ /** Pin runtime pairing revisions and SSH registration generations to captured owners. Validate responses: an old host may ignore selectors and return other hosts’ rows. */ import { callRuntimeRpc } from '@/runtime/rpc/calls/runtime-rpc-call' -import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target' +import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target' import type { Automation, AutomationCreateInput, AutomationUpdateInput -} from '../../../../shared/automations/automation-definition' +} from '../../../../../shared/automations/automation-definition' import type { AutomationRun, AutomationRunsPage -} from '../../../../shared/automations/history/automation-run' +} from '../../../../../shared/automations/history/automation-run' import type { AutomationListResult, AutomationListScopeSelector -} from '../../../../shared/automations/ownership/automation-list-scope' -import { validateAutomationListResponse } from '../../../../shared/automations/ownership/automation-list-response' +} from '../../../../../shared/automations/ownership/automation-list-scope' +import { validateAutomationListResponse } from '../../../../../shared/automations/ownership/automation-list-response' import type { AutomationAuthorityRef, AutomationOwnerRef -} from '../../../../shared/automations/ownership/automation-owner-ref' +} from '../../../../../shared/automations/ownership/automation-owner-ref' /** The one classifier every client shares; re-exported so call sites keep importing it from here. */ import type { AutomationDestination, AutomationOwnerPrecondition -} from '../../../../shared/automations/ownership/automation-owner-precondition' +} from '../../../../../shared/automations/ownership/automation-owner-precondition' import { toRuntimeAutomationCreateInput, toRuntimeAutomationUpdateInput @@ -35,18 +35,13 @@ import { prepareAutomationLaunchSetup, assertOwnerFencingSupported, assertAutomationCreateIdempotencySupported, - AUTOMATION_LIST_HOST_SCOPE_RUNTIME_CAPABILITY, - AUTOMATION_LIST_HOST_SCOPE_UPDATE_REQUIRED_MESSAGE, AutomationHostScopeUnsupportedError, REQUEST_TIMEOUT_MS } from './automation-capability-probe' - -export { - AutomationHostScopeUnsupportedError, - AUTHORITY_CAPABILITY_CONFIRMATION_TTL_MS, - AUTHORITY_CAPABILITY_CONFIRMATION_MAX, - resetAutomationCapabilityProbes -} from './automation-capability-probe' +import { + AUTOMATION_LIST_HOST_SCOPE_RUNTIME_CAPABILITY, + AUTOMATION_LIST_HOST_SCOPE_UPDATE_REQUIRED_MESSAGE +} from '../../../../../shared/automations/automation-runtime-capabilities' export class AutomationListResponseError extends Error { readonly code = 'invalid_response' diff --git a/src/renderer/src/components/automations/automation-target-availability-types.ts b/src/renderer/src/components/automations/hosts/automation-target-availability-types.ts similarity index 100% rename from src/renderer/src/components/automations/automation-target-availability-types.ts rename to src/renderer/src/components/automations/hosts/automation-target-availability-types.ts diff --git a/src/renderer/src/components/automations/automation-target-availability.ts b/src/renderer/src/components/automations/hosts/automation-target-availability.ts similarity index 89% rename from src/renderer/src/components/automations/automation-target-availability.ts rename to src/renderer/src/components/automations/hosts/automation-target-availability.ts index 4331ad20838..9834d615ee7 100644 --- a/src/renderer/src/components/automations/automation-target-availability.ts +++ b/src/renderer/src/components/automations/hosts/automation-target-availability.ts @@ -2,30 +2,29 @@ import { automationHostReselectionMessage, type AutomationCapturedOwner } from './automation-captured-owner' -import type { Automation } from '../../../../shared/automations/automation-definition' -import { parseExecutionHostId } from '../../../../shared/execution-host' +import type { Automation } from '../../../../../shared/automations/automation-definition' +import { parseExecutionHostId } from '../../../../../shared/execution-host' import { setupHostMatchesRunContext, repoHostMatchesRunContext } from './automation-run-context-host-match' -import { evaluateRuntimeCompat } from '../../../../shared/protocol-compat' +import { evaluateRuntimeCompat } from '../../../../../shared/protocol-compat' import { describeRuntimeCompatBlock } from '@/lib/runtime-host-copy' import { translate } from '@/i18n/i18n' import type { Translate } from '@/i18n/use-translate' import { MIN_COMPATIBLE_RUNTIME_SERVER_VERSION, RUNTIME_PROTOCOL_VERSION -} from '../../../../shared/protocol-version' +} from '../../../../../shared/protocol-version' import type { AutomationHostTarget } from './automation-host-client' -import type { SshConnectionState } from '../../../../shared/ssh-types' -import type { ProjectHostSetup } from '../../../../shared/project-types' -import type { Repo } from '../../../../shared/repo-types' -import type { RuntimeEnvironmentStatus } from '../../../../shared/remote-runtime/host-status/runtime-host-status' -import type { Worktree } from '../../../../shared/worktree/types' -import type { RuntimeEnvironmentSshBucket } from '../../store/slices/ssh/runtime-environment-ssh' +import type { SshConnectionState } from '../../../../../shared/ssh-types' +import type { ProjectHostSetup } from '../../../../../shared/project-types' +import type { Repo } from '../../../../../shared/repo-types' +import type { RuntimeEnvironmentStatus } from '../../../../../shared/remote-runtime/host-status/runtime-host-status' +import type { Worktree } from '../../../../../shared/worktree/types' +import type { RuntimeEnvironmentSshBucket } from '../../../store/slices/ssh/runtime-environment-ssh' import type { AutomationTargetAvailability } from './automation-target-availability-types' -export type { AutomationTargetAvailability } from './automation-target-availability-types' type AutomationTargetAvailabilityArgs = { automation: Automation diff --git a/src/renderer/src/components/automations/automation-write-invalidation.ts b/src/renderer/src/components/automations/hosts/automation-write-invalidation.ts similarity index 92% rename from src/renderer/src/components/automations/automation-write-invalidation.ts rename to src/renderer/src/components/automations/hosts/automation-write-invalidation.ts index d774e435bf9..012b54ebb9d 100644 --- a/src/renderer/src/components/automations/automation-write-invalidation.ts +++ b/src/renderer/src/components/automations/hosts/automation-write-invalidation.ts @@ -1,11 +1,11 @@ /** Invalidate immediately from the completed write’s known host instead of waiting for a droppable change event. Uncaptured rows invalidate their authority without guessing a selector. */ -import { toStableCatalogRef } from '../../../../shared/automations/ownership/automation-owner-key' +import { toStableCatalogRef } from '../../../../../shared/automations/ownership/automation-owner-key' import type { AutomationAuthorityRef, StableAutomationAuthorityRef, StableAutomationCatalogRef -} from '../../../../shared/automations/ownership/automation-owner-ref' +} from '../../../../../shared/automations/ownership/automation-owner-ref' import type { AutomationCapturedOwner } from './automation-captured-owner' import type { AutomationAuthorityChangeEvent, diff --git a/src/renderer/src/components/automations/use-automation-desktop-ssh-registrations.ts b/src/renderer/src/components/automations/hosts/use-automation-desktop-ssh-registrations.ts similarity index 86% rename from src/renderer/src/components/automations/use-automation-desktop-ssh-registrations.ts rename to src/renderer/src/components/automations/hosts/use-automation-desktop-ssh-registrations.ts index 43995eb14de..5a649d19da2 100644 --- a/src/renderer/src/components/automations/use-automation-desktop-ssh-registrations.ts +++ b/src/renderer/src/components/automations/hosts/use-automation-desktop-ssh-registrations.ts @@ -1,4 +1,4 @@ -import { useAppStore } from '../../store' +import { useAppStore } from '../../../store/index' /** Use the live store’s registration generations instead of per-mount listTargets IPC. Omit unknown generations so only that host stays view-only; never guess a fence. */ export function useAutomationDesktopSshRegistrations(): ReadonlyMap { diff --git a/src/renderer/src/components/automations/use-automation-host-catalog-readoption.test.tsx b/src/renderer/src/components/automations/hosts/use-automation-host-catalog-readoption.test.tsx similarity index 95% rename from src/renderer/src/components/automations/use-automation-host-catalog-readoption.test.tsx rename to src/renderer/src/components/automations/hosts/use-automation-host-catalog-readoption.test.tsx index e94702866d9..ccf2fb37ec7 100644 --- a/src/renderer/src/components/automations/use-automation-host-catalog-readoption.test.tsx +++ b/src/renderer/src/components/automations/hosts/use-automation-host-catalog-readoption.test.tsx @@ -5,15 +5,15 @@ import { act } from 'react' import { createRoot, type Root } from 'react-dom/client' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { Automation } from '../../../../shared/automations/automation-definition' -import type { AutomationListScopeSelector } from '../../../../shared/automations/ownership/automation-list-scope' +import type { Automation } from '../../../../../shared/automations/automation-definition' +import type { AutomationListScopeSelector } from '../../../../../shared/automations/ownership/automation-list-scope' import type { AppState } from '@/store/types' import type { AutomationHostCatalogView } from './use-automation-host-catalog' import { resetAutomationHostCatalogGenerationsForTests } from './automation-host-catalog-generation' const mocks = vi.hoisted(() => ({ state: {} as Record })) -vi.mock('@/store', () => { +vi.mock('@/store/index', () => { const useAppStore = (selector: (state: Partial) => unknown): unknown => selector(mocks.state as Partial) useAppStore.getState = (): Partial => mocks.state as Partial diff --git a/src/renderer/src/components/automations/use-automation-host-catalog-source-state.ts b/src/renderer/src/components/automations/hosts/use-automation-host-catalog-source-state.ts similarity index 94% rename from src/renderer/src/components/automations/use-automation-host-catalog-source-state.ts rename to src/renderer/src/components/automations/hosts/use-automation-host-catalog-source-state.ts index a658252b09e..8c7195f1a25 100644 --- a/src/renderer/src/components/automations/use-automation-host-catalog-source-state.ts +++ b/src/renderer/src/components/automations/hosts/use-automation-host-catalog-source-state.ts @@ -1,8 +1,8 @@ import { useMemo } from 'react' -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' import { getPairedWebClientEnvironmentId } from '@/lib/paired-web-client-host' -import type { PublicKnownRuntimeEnvironment } from '../../../../shared/remote-runtime/host-catalog/runtime-environments' -import { getManagedOrcadSshTargetId } from '../../../../shared/execution-host/managed-orcad-execution-host' +import type { PublicKnownRuntimeEnvironment } from '../../../../../shared/remote-runtime/host-catalog/runtime-environments' +import { getManagedOrcadSshTargetId } from '../../../../../shared/execution-host/managed-orcad-execution-host' import type { AutomationCatalogRuntimeSource, AutomationCatalogSshSource, diff --git a/src/renderer/src/components/automations/use-automation-host-catalog.test.tsx b/src/renderer/src/components/automations/hosts/use-automation-host-catalog.test.tsx similarity index 97% rename from src/renderer/src/components/automations/use-automation-host-catalog.test.tsx rename to src/renderer/src/components/automations/hosts/use-automation-host-catalog.test.tsx index 66ebd9b17c6..8cecc8d0d16 100644 --- a/src/renderer/src/components/automations/use-automation-host-catalog.test.tsx +++ b/src/renderer/src/components/automations/hosts/use-automation-host-catalog.test.tsx @@ -5,9 +5,9 @@ import { act } from 'react' import { createRoot, type Root } from 'react-dom/client' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { Automation } from '../../../../shared/automations/automation-definition' +import type { Automation } from '../../../../../shared/automations/automation-definition' import type { AppState } from '@/store/types' -import type { Repo } from '../../../../shared/repo-types' +import type { Repo } from '../../../../../shared/repo-types' import type { AutomationHostCatalogView } from './use-automation-host-catalog' const mocks = vi.hoisted(() => ({ @@ -16,7 +16,7 @@ const mocks = vi.hoisted(() => ({ getRuntimeEnvironmentStatus: vi.fn() })) -vi.mock('@/store', () => { +vi.mock('@/store/index', () => { const useAppStore = (selector: (state: Partial) => unknown): unknown => selector(mocks.state as Partial) useAppStore.getState = (): Partial => mocks.state as Partial diff --git a/src/renderer/src/components/automations/use-automation-host-catalog.ts b/src/renderer/src/components/automations/hosts/use-automation-host-catalog.ts similarity index 95% rename from src/renderer/src/components/automations/use-automation-host-catalog.ts rename to src/renderer/src/components/automations/hosts/use-automation-host-catalog.ts index 8ed6fbfbb4f..9eb4f38e3d4 100644 --- a/src/renderer/src/components/automations/use-automation-host-catalog.ts +++ b/src/renderer/src/components/automations/hosts/use-automation-host-catalog.ts @@ -1,10 +1,10 @@ import { useCallback, useEffect, useEffectEvent, useMemo, useRef, useState } from 'react' -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' import { useUiLanguageRevision } from '@/i18n/use-ui-language-revision' -import { getHostDisplayLabelOverrides } from '../../../../shared/host-setting-overrides' -import { getLocalExecutionHostLabel } from '../../../../shared/execution-host' -import type { AutomationHostFilter } from '../../../../shared/automations/ownership/automation-host-filter' -import type { StableAutomationAuthorityRef } from '../../../../shared/automations/ownership/automation-owner-ref' +import { getHostDisplayLabelOverrides } from '../../../../../shared/host-setting-overrides' +import { getLocalExecutionHostLabel } from '../../../../../shared/execution-host' +import type { AutomationHostFilter } from '../../../../../shared/automations/ownership/automation-host-filter' +import type { StableAutomationAuthorityRef } from '../../../../../shared/automations/ownership/automation-owner-ref' import { buildAutomationHostCatalog } from './automation-host-catalog' import { subscribeAutomationHostInvalidation } from './automation-host-invalidation-window-events' import { buildAutomationHostCatalogSource } from './automation-host-catalog-source' @@ -23,7 +23,7 @@ import type { AutomationHostCatalog, AutomationHostCatalogEntry } from './automation-host-catalog-types' -import { automationHostFilterStableKey } from '../../../../shared/automations/ownership/automation-host-filter' +import { automationHostFilterStableKey } from '../../../../../shared/automations/ownership/automation-host-filter' import { foldDesktopHostFilter, resolveAutomationHostFilter, diff --git a/src/renderer/src/components/automations/AutomationListEmptyView.tsx b/src/renderer/src/components/automations/listing/AutomationListEmptyView.tsx similarity index 96% rename from src/renderer/src/components/automations/AutomationListEmptyView.tsx rename to src/renderer/src/components/automations/listing/AutomationListEmptyView.tsx index cb7d0b1ace5..0b888cb16a7 100644 --- a/src/renderer/src/components/automations/AutomationListEmptyView.tsx +++ b/src/renderer/src/components/automations/listing/AutomationListEmptyView.tsx @@ -8,7 +8,7 @@ import { import { recoveryActionLabel, type AutomationHostRecoveryAction -} from './automation-host-status-descriptors' +} from '../hosts/automation-host-status-descriptors' import { useTranslate } from '@/i18n/use-translate' /** Renders whichever empty/partial/failure state the list is in; nothing when rows exist. */ diff --git a/src/renderer/src/components/automations/AutomationListExternalRow.tsx b/src/renderer/src/components/automations/listing/AutomationListExternalRow.tsx similarity index 93% rename from src/renderer/src/components/automations/AutomationListExternalRow.tsx rename to src/renderer/src/components/automations/listing/AutomationListExternalRow.tsx index 026918baa58..b802be4ba44 100644 --- a/src/renderer/src/components/automations/AutomationListExternalRow.tsx +++ b/src/renderer/src/components/automations/listing/AutomationListExternalRow.tsx @@ -20,17 +20,17 @@ import type { ExternalAutomationAction, ExternalAutomationJob, ExternalAutomationManager -} from '../../../../shared/automations/external/external-automation' -import type { SshConnectionState } from '../../../../shared/ssh-types' -import type { ExternalAutomationListEntry } from './external-automation-list-entries' -import type { ExternalAutomationScope } from './external-automation-scope-client' +} from '../../../../../shared/automations/external/external-automation' +import type { SshConnectionState } from '../../../../../shared/ssh-types' +import type { ExternalAutomationListEntry } from '../external/external-automation-list-entries' +import type { ExternalAutomationScope } from '../external/external-automation-scope-client' import { formatExternalDate, getExternalProviderLabel, getExternalTargetKindLabel -} from './external-automation-display' -import { getExternalAutomationScheduleDisplay } from './external-automation-schedule-display' -import { getExternalAutomationActionDisabledMessage } from './external-automation-source-availability' +} from '../external/external-automation-display' +import { getExternalAutomationScheduleDisplay } from '../external/external-automation-schedule-display' +import { getExternalAutomationActionDisabledMessage } from '../external/external-automation-source-availability' import { AUTOMATIONS_TABLE_GRID_CLASS } from './automations-table-layout' import { LIST_TABLE_ROW_CLASS, diff --git a/src/renderer/src/components/automations/AutomationListExternalRows.tsx b/src/renderer/src/components/automations/listing/AutomationListExternalRows.tsx similarity index 85% rename from src/renderer/src/components/automations/AutomationListExternalRows.tsx rename to src/renderer/src/components/automations/listing/AutomationListExternalRows.tsx index 3ed78fc2a69..c3e802ea80a 100644 --- a/src/renderer/src/components/automations/AutomationListExternalRows.tsx +++ b/src/renderer/src/components/automations/listing/AutomationListExternalRows.tsx @@ -1,5 +1,5 @@ import React from 'react' -import type { ExternalAutomationListEntry } from './external-automation-list-entries' +import type { ExternalAutomationListEntry } from '../external/external-automation-list-entries' import { AutomationListExternalRow, type AutomationListExternalRowProps diff --git a/src/renderer/src/components/automations/AutomationListFilterMenu.tsx b/src/renderer/src/components/automations/listing/AutomationListFilterMenu.tsx similarity index 99% rename from src/renderer/src/components/automations/AutomationListFilterMenu.tsx rename to src/renderer/src/components/automations/listing/AutomationListFilterMenu.tsx index cc11fbcad2f..80099a50dc5 100644 --- a/src/renderer/src/components/automations/AutomationListFilterMenu.tsx +++ b/src/renderer/src/components/automations/listing/AutomationListFilterMenu.tsx @@ -23,7 +23,7 @@ import { useTranslate } from '@/i18n/use-translate' import { useBoundedHostRows } from '@/components/host-picker/use-bounded-host-rows' import { HostListSearchField } from '@/components/host-picker/HostListSearchField' import { HostListOverflowNote } from '@/components/host-picker/HostListOverflowNote' -import type { AutomationHostCatalogEntry } from './automation-host-catalog-types' +import type { AutomationHostCatalogEntry } from '../hosts/automation-host-catalog-types' import { countAutomationListFilters, EMPTY_AUTOMATION_LIST_FILTER, diff --git a/src/renderer/src/components/automations/AutomationListHostGroups.tsx b/src/renderer/src/components/automations/listing/AutomationListHostGroups.tsx similarity index 93% rename from src/renderer/src/components/automations/AutomationListHostGroups.tsx rename to src/renderer/src/components/automations/listing/AutomationListHostGroups.tsx index 86e5ad77ff2..3047805434d 100644 --- a/src/renderer/src/components/automations/AutomationListHostGroups.tsx +++ b/src/renderer/src/components/automations/listing/AutomationListHostGroups.tsx @@ -1,11 +1,11 @@ import React from 'react' import { Button } from '@/components/ui/button' -import { AutomationHostLabel, AutomationHostStatusBadges } from './AutomationHostBadges' +import { AutomationHostLabel, AutomationHostStatusBadges } from '../hosts/AutomationHostBadges' import { AutomationListLocalRows, type AutomationListLocalRowsProps } from './AutomationListLocalRows' -import type { AutomationHostVisibleGroup } from './automation-host-list-rows' +import type { AutomationHostVisibleGroup } from '../hosts/automation-host-list-rows' import { resolveAutomationHostGroupEmptyState, type AutomationListEmptyState @@ -14,8 +14,8 @@ import { automationHostRecoveryActions, recoveryActionLabel, type AutomationHostRecoveryAction -} from './automation-host-status-descriptors' -import type { AutomationHostCatalogEntry } from './automation-host-catalog-types' +} from '../hosts/automation-host-status-descriptors' +import type { AutomationHostCatalogEntry } from '../hosts/automation-host-catalog-types' import { useTranslate } from '@/i18n/use-translate' /** Keep status on each host header, including hosts with no rows; unreachable must never read as an empty schedule. */ diff --git a/src/renderer/src/components/automations/AutomationListLastRunCell.tsx b/src/renderer/src/components/automations/listing/AutomationListLastRunCell.tsx similarity index 100% rename from src/renderer/src/components/automations/AutomationListLastRunCell.tsx rename to src/renderer/src/components/automations/listing/AutomationListLastRunCell.tsx diff --git a/src/renderer/src/components/automations/AutomationListLocalRow.tsx b/src/renderer/src/components/automations/listing/AutomationListLocalRow.tsx similarity index 89% rename from src/renderer/src/components/automations/AutomationListLocalRow.tsx rename to src/renderer/src/components/automations/listing/AutomationListLocalRow.tsx index 8c0bd693100..85c2ec0f2b3 100644 --- a/src/renderer/src/components/automations/AutomationListLocalRow.tsx +++ b/src/renderer/src/components/automations/listing/AutomationListLocalRow.tsx @@ -2,14 +2,14 @@ import { capturedAutomationOwner, type AutomationCapturedOwner, type AutomationRowAction -} from './automation-captured-owner' -import type { RuntimeEnvironmentSshBucket } from '../../store/slices/ssh/runtime-environment-ssh' +} from '../hosts/automation-captured-owner' +import type { RuntimeEnvironmentSshBucket } from '../../../store/slices/ssh/runtime-environment-ssh' import React from 'react' import { MoreHorizontal, Pause, Pencil, Play, ShieldCheck, Trash2 } from 'lucide-react' import { ContextMenu, ContextMenuContent, ContextMenuTrigger } from '@/components/ui/context-menu' import { MenuItem, MenuRunItem, MenuSeparator } from './AutomationListRowContextMenuItems' -import { pendingAutomationSetupReviewFromSummary } from './automation-setup-review' -import type { SetupTrustMismatch } from '../../../../shared/worktree/create-types' +import { pendingAutomationSetupReviewFromSummary } from '../authoring/automation-setup-review' +import type { SetupTrustMismatch } from '../../../../../shared/worktree/create-types' import { DropdownMenu, DropdownMenuContent, @@ -21,30 +21,30 @@ import { Button } from '@/components/ui/button' import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip' import { AgentIcon } from '@/components/agent/icons/AgentIcon' import { cn } from '@/lib/utils' -import type { AutomationRun } from '../../../../shared/automations/history/automation-run' -import { getAutomationRunRepoId } from '../../../../shared/automations/history/automation-run-identity' -import { formatUiAutomationSchedule } from './automation-schedule-label' +import type { AutomationRun } from '../../../../../shared/automations/history/automation-run' +import { getAutomationRunRepoId } from '../../../../../shared/automations/history/automation-run-identity' +import { formatUiAutomationSchedule } from '../details/automation-schedule-label' import { getExecutionHostLabel, getLocalExecutionHostLabel, getRepoExecutionHostId -} from '../../../../shared/execution-host' -import type { SshConnectionState } from '../../../../shared/ssh-types' -import type { ProjectHostSetup } from '../../../../shared/project-types' -import type { Repo } from '../../../../shared/repo-types' -import type { Worktree } from '../../../../shared/worktree/types' -import type { RuntimeEnvironmentStatus } from '../../../../shared/remote-runtime/host-status/runtime-host-status' -import type { AutomationHostTarget } from './automation-host-client' +} from '../../../../../shared/execution-host' +import type { SshConnectionState } from '../../../../../shared/ssh-types' +import type { ProjectHostSetup } from '../../../../../shared/project-types' +import type { Repo } from '../../../../../shared/repo-types' +import type { Worktree } from '../../../../../shared/worktree/types' +import type { RuntimeEnvironmentStatus } from '../../../../../shared/remote-runtime/host-status/runtime-host-status' +import type { AutomationHostTarget } from '../hosts/automation-host-client' import { getAutomationRowLastRunSnapshot, getLocalAutomationLastRunSnapshot } from './automation-list-last-run' import { AutomationListLastRunCell } from './AutomationListLastRunCell' -import { formatAutomationDateTimeWithRelative } from './automation-page-parts' -import { getAutomationTargetAvailability } from './automation-target-availability' -import { getAgentLabel } from './automation-draft-model' +import { formatAutomationDateTimeWithRelative } from '../automation-page-parts' +import { getAutomationTargetAvailability } from '../hosts/automation-target-availability' +import { getAgentLabel } from '../authoring/automation-draft-model' import { automationProjectName, type AutomationListRow } from './automation-list-row-identity' -import { formatAutomationUsageSummary } from './automation-usage-model' +import { formatAutomationUsageSummary } from '../runs/automation-usage-model' import { AUTOMATIONS_TABLE_GRID_CLASS } from './automations-table-layout' import { LIST_TABLE_ROW_CLASS, @@ -54,7 +54,7 @@ import { import { isPortaledRowMenuClick, isRowActivationKey } from '@/lib/list-row-interaction' import { AutomationListStatusCell } from './AutomationListStatusCell' import { useIntlLocale, useTranslate } from '@/i18n/use-translate' -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' import { wslMovedProjectForAutomation } from '@/store/repos/wsl-moved-projects' export type AutomationListLocalRowProps = { diff --git a/src/renderer/src/components/automations/AutomationListLocalRows.tsx b/src/renderer/src/components/automations/listing/AutomationListLocalRows.tsx similarity index 100% rename from src/renderer/src/components/automations/AutomationListLocalRows.tsx rename to src/renderer/src/components/automations/listing/AutomationListLocalRows.tsx diff --git a/src/renderer/src/components/automations/AutomationListRowContextMenuItems.tsx b/src/renderer/src/components/automations/listing/AutomationListRowContextMenuItems.tsx similarity index 100% rename from src/renderer/src/components/automations/AutomationListRowContextMenuItems.tsx rename to src/renderer/src/components/automations/listing/AutomationListRowContextMenuItems.tsx diff --git a/src/renderer/src/components/automations/AutomationListSearchField.tsx b/src/renderer/src/components/automations/listing/AutomationListSearchField.tsx similarity index 100% rename from src/renderer/src/components/automations/AutomationListSearchField.tsx rename to src/renderer/src/components/automations/listing/AutomationListSearchField.tsx diff --git a/src/renderer/src/components/automations/AutomationListSortHeader.tsx b/src/renderer/src/components/automations/listing/AutomationListSortHeader.tsx similarity index 100% rename from src/renderer/src/components/automations/AutomationListSortHeader.tsx rename to src/renderer/src/components/automations/listing/AutomationListSortHeader.tsx diff --git a/src/renderer/src/components/automations/AutomationListStatusCell.tsx b/src/renderer/src/components/automations/listing/AutomationListStatusCell.tsx similarity index 100% rename from src/renderer/src/components/automations/AutomationListStatusCell.tsx rename to src/renderer/src/components/automations/listing/AutomationListStatusCell.tsx diff --git a/src/renderer/src/components/automations/AutomationListTableHeader.tsx b/src/renderer/src/components/automations/listing/AutomationListTableHeader.tsx similarity index 100% rename from src/renderer/src/components/automations/AutomationListTableHeader.tsx rename to src/renderer/src/components/automations/listing/AutomationListTableHeader.tsx diff --git a/src/renderer/src/components/automations/AutomationListToolbar.tsx b/src/renderer/src/components/automations/listing/AutomationListToolbar.tsx similarity index 95% rename from src/renderer/src/components/automations/AutomationListToolbar.tsx rename to src/renderer/src/components/automations/listing/AutomationListToolbar.tsx index 312c5e0a669..bbe24069a21 100644 --- a/src/renderer/src/components/automations/AutomationListToolbar.tsx +++ b/src/renderer/src/components/automations/listing/AutomationListToolbar.tsx @@ -4,13 +4,13 @@ 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 type { AutomationHostCatalogEntry } from './automation-host-catalog-types' +import type { AutomationHostCatalogEntry } from '../hosts/automation-host-catalog-types' import type { AutomationListArrowKey } from './automation-list-keyboard-navigation' -import { clampAutomationListSearchQueryInput } from './automation-list-search' +import { clampAutomationListSearchQueryInput } from './automation-list-search-query' import type { AutomationListFilter } from './automation-list-view' import { AutomationListSearchField } from './AutomationListSearchField' import { AutomationListFilterMenu } from './AutomationListFilterMenu' -import type { AutomationTemplate } from './automation-templates' +import type { AutomationTemplate } from '../authoring/automation-templates' type AutomationListToolbarProps = { /** Focus fallback for the list: the controls that produced the rows. */ diff --git a/src/renderer/src/components/automations/AutomationsListPanel.tsx b/src/renderer/src/components/automations/listing/AutomationsListPanel.tsx similarity index 87% rename from src/renderer/src/components/automations/AutomationsListPanel.tsx rename to src/renderer/src/components/automations/listing/AutomationsListPanel.tsx index f468f5a79fa..ac96f41f002 100644 --- a/src/renderer/src/components/automations/AutomationsListPanel.tsx +++ b/src/renderer/src/components/automations/listing/AutomationsListPanel.tsx @@ -1,28 +1,28 @@ -import type { SetupTrustMismatch } from '../../../../shared/worktree/create-types' -import type { RuntimeEnvironmentSshBucket } from '../../store/slices/ssh/runtime-environment-ssh' +import type { SetupTrustMismatch } from '../../../../../shared/worktree/create-types' +import type { RuntimeEnvironmentSshBucket } from '../../../store/slices/ssh/runtime-environment-ssh' import React, { useRef } from 'react' import { cn } from '@/lib/utils' -import type { AutomationRun } from '../../../../shared/automations/history/automation-run' +import type { AutomationRun } from '../../../../../shared/automations/history/automation-run' import type { ExternalAutomationAction, ExternalAutomationJob, ExternalAutomationManager -} from '../../../../shared/automations/external/external-automation' +} from '../../../../../shared/automations/external/external-automation' -import type { SshConnectionState } from '../../../../shared/ssh-types' -import type { ProjectHostSetup } from '../../../../shared/project-types' -import type { Repo } from '../../../../shared/repo-types' -import type { Worktree } from '../../../../shared/worktree/types' -import type { RuntimeEnvironmentStatus } from '../../../../shared/remote-runtime/host-status/runtime-host-status' -import type { AutomationRowAction } from './automation-captured-owner' -import type { AutomationHostTarget } from './automation-host-client' +import type { SshConnectionState } from '../../../../../shared/ssh-types' +import type { ProjectHostSetup } from '../../../../../shared/project-types' +import type { Repo } from '../../../../../shared/repo-types' +import type { Worktree } from '../../../../../shared/worktree/types' +import type { RuntimeEnvironmentStatus } from '../../../../../shared/remote-runtime/host-status/runtime-host-status' +import type { AutomationRowAction } from '../hosts/automation-captured-owner' +import type { AutomationHostTarget } from '../hosts/automation-host-client' import { createAutomationListEnterHandler, getAutomationListArrowNavigationTarget, type AutomationListArrowKey } from './automation-list-keyboard-navigation' import type { AutomationListRow } from './automation-list-row-identity' -import type { AutomationPaneTab } from './automation-page-state' +import type { AutomationPaneTab } from '../automation-page-state' import { AutomationListFilterPills } from './AutomationListFilterMenu' import { isAutomationListFilterActive, @@ -34,23 +34,26 @@ import { import { type AutomationHostFilter, automationHostFilterStableKey -} from '../../../../shared/automations/ownership/automation-host-filter' -import type { AutomationTemplate } from './automation-templates' -import type { ExternalAutomationListEntry } from './external-automation-list-entries' -import type { ExternalAutomationScope } from './external-automation-scope-client' +} from '../../../../../shared/automations/ownership/automation-host-filter' +import type { AutomationTemplate } from '../authoring/automation-templates' +import type { ExternalAutomationListEntry } from '../external/external-automation-list-entries' +import type { ExternalAutomationScope } from '../external/external-automation-scope-client' import { AutomationListLocalRow } from './AutomationListLocalRow' import { AutomationListExternalRow } from './AutomationListExternalRow' -import { AutomationHostFilterNotice, AutomationHostLoadSummary } from './AutomationHostFilterNotice' +import { + AutomationHostFilterNotice, + AutomationHostLoadSummary +} from '../hosts/AutomationHostFilterNotice' import { AutomationListEmptyView } from './AutomationListEmptyView' import { resolveAutomationListEmptyState } from './automation-list-empty-state' import type { AutomationListSearchCounts } from './use-automation-list-search' -import type { AutomationHostCatalogView } from './use-automation-host-catalog' -import type { AutomationHostRecoveryAction } from './automation-host-status-descriptors' -import type { AutomationHostCatalogEntry } from './automation-host-catalog-types' +import type { AutomationHostCatalogView } from '../hosts/use-automation-host-catalog' +import type { AutomationHostRecoveryAction } from '../hosts/automation-host-status-descriptors' +import type { AutomationHostCatalogEntry } from '../hosts/automation-host-catalog-types' import { useAutomationListFocusRecovery } from './use-automation-list-focus-recovery' import { LIST_TABLE_CONTAINER_CLASS } from '@/lib/list-table-layout' import { useTranslate } from '@/i18n/use-translate' -import { AutomationTemplateEmptyState } from './AutomationTemplateEmptyState' +import { AutomationTemplateEmptyState } from '../authoring/AutomationTemplateEmptyState' import { AutomationListTableHeader } from './AutomationListTableHeader' import { AutomationListToolbar } from './AutomationListToolbar' diff --git a/src/renderer/src/components/automations/automation-list-empty-state.ts b/src/renderer/src/components/automations/listing/automation-list-empty-state.ts similarity index 97% rename from src/renderer/src/components/automations/automation-list-empty-state.ts rename to src/renderer/src/components/automations/listing/automation-list-empty-state.ts index b996b136af3..4348ed2ed5e 100644 --- a/src/renderer/src/components/automations/automation-list-empty-state.ts +++ b/src/renderer/src/components/automations/listing/automation-list-empty-state.ts @@ -1,14 +1,14 @@ import { translate } from '@/i18n/i18n' import type { Translate } from '@/i18n/use-translate' -import type { AutomationHostCatalogEntry } from './automation-host-catalog-types' +import type { AutomationHostCatalogEntry } from '../hosts/automation-host-catalog-types' import type { AutomationHostFilterResolution, AutomationHostFilterStatus -} from './automation-host-filter-resolution' +} from '../hosts/automation-host-filter-resolution' import { automationHostRecoveryActions, type AutomationHostRecoveryAction -} from './automation-host-status-descriptors' +} from '../hosts/automation-host-status-descriptors' /** Describe disconnected, unreachable or unhydrated hosts as unknown, never empty; no storage read established that claim. */ diff --git a/src/renderer/src/components/automations/automation-list-focus-recovery.test.ts b/src/renderer/src/components/automations/listing/automation-list-focus-recovery.test.ts similarity index 100% rename from src/renderer/src/components/automations/automation-list-focus-recovery.test.ts rename to src/renderer/src/components/automations/listing/automation-list-focus-recovery.test.ts diff --git a/src/renderer/src/components/automations/automation-list-focus-recovery.ts b/src/renderer/src/components/automations/listing/automation-list-focus-recovery.ts similarity index 100% rename from src/renderer/src/components/automations/automation-list-focus-recovery.ts rename to src/renderer/src/components/automations/listing/automation-list-focus-recovery.ts diff --git a/src/renderer/src/components/automations/automation-list-keyboard-navigation.ts b/src/renderer/src/components/automations/listing/automation-list-keyboard-navigation.ts similarity index 98% rename from src/renderer/src/components/automations/automation-list-keyboard-navigation.ts rename to src/renderer/src/components/automations/listing/automation-list-keyboard-navigation.ts index 3e364851b74..f210f4cd596 100644 --- a/src/renderer/src/components/automations/automation-list-keyboard-navigation.ts +++ b/src/renderer/src/components/automations/listing/automation-list-keyboard-navigation.ts @@ -1,5 +1,5 @@ import type { AutomationListViewItem } from './automation-list-view' -import type { AutomationPaneTab } from './automation-page-state' +import type { AutomationPaneTab } from '../automation-page-state' export type AutomationListArrowKey = 'ArrowUp' | 'ArrowDown' diff --git a/src/renderer/src/components/automations/automation-list-last-run.ts b/src/renderer/src/components/automations/listing/automation-list-last-run.ts similarity index 94% rename from src/renderer/src/components/automations/automation-list-last-run.ts rename to src/renderer/src/components/automations/listing/automation-list-last-run.ts index 6e484d826d1..717a1765cf0 100644 --- a/src/renderer/src/components/automations/automation-list-last-run.ts +++ b/src/renderer/src/components/automations/listing/automation-list-last-run.ts @@ -1,16 +1,16 @@ import { translate } from '@/i18n/i18n' import type { Translate } from '@/i18n/use-translate' -import type { Automation } from '../../../../shared/automations/automation-definition' +import type { Automation } from '../../../../../shared/automations/automation-definition' import type { AutomationRun, AutomationRunStatus -} from '../../../../shared/automations/history/automation-run' -import type { ExternalAutomationJob } from '../../../../shared/automations/external/external-automation' +} from '../../../../../shared/automations/history/automation-run' +import type { ExternalAutomationJob } from '../../../../../shared/automations/external/external-automation' import { formatAutomationDateTime, formatAutomationRelativeTime, getAutomationRunStatusLabel -} from './automation-page-parts' +} from '../automation-page-parts' export type AutomationLastRunTone = | 'failed' diff --git a/src/renderer/src/components/automations/automation-list-row-identity.ts b/src/renderer/src/components/automations/listing/automation-list-row-identity.ts similarity index 85% rename from src/renderer/src/components/automations/automation-list-row-identity.ts rename to src/renderer/src/components/automations/listing/automation-list-row-identity.ts index e58792a7c9c..63ac6231ddc 100644 --- a/src/renderer/src/components/automations/automation-list-row-identity.ts +++ b/src/renderer/src/components/automations/listing/automation-list-row-identity.ts @@ -1,10 +1,10 @@ /** Qualify row IDs by incarnation-free host stableKey so colliding authorities stay distinct and re-pairs preserve React identity/selection. Freshness uses incarnation-bearing ownerKey separately. */ -import type { Automation } from '../../../../shared/automations/automation-definition' -import type { AutomationUsageSummary } from '../../../../shared/automations/history/automation-usage-summary' -import { findAutomationRepo } from '../../../../shared/automations/ownership/automation-repo-target' -import { getAutomationRunRepoId } from '../../../../shared/automations/history/automation-run-identity' -import type { StableAutomationCatalogRef } from '../../../../shared/automations/ownership/automation-owner-ref' +import type { Automation } from '../../../../../shared/automations/automation-definition' +import type { AutomationUsageSummary } from '../../../../../shared/automations/history/automation-usage-summary' +import { findAutomationRepo } from '../../../../../shared/automations/ownership/automation-repo-target' +import { getAutomationRunRepoId } from '../../../../../shared/automations/history/automation-run-identity' +import type { StableAutomationCatalogRef } from '../../../../../shared/automations/ownership/automation-owner-ref' import { getRepoExecutionHostId, getConnectionExecutionHostId, @@ -12,21 +12,21 @@ import { toSshExecutionHostId, parseExecutionHostId, toRuntimeExecutionHostId -} from '../../../../shared/execution-host' +} from '../../../../../shared/execution-host' import { resolveQualifiedFolderWorkspaceResult, type QualifiedFolderHostState -} from '../../../../shared/folder-workspaces/folder-workspace-execution-host' +} from '../../../../../shared/folder-workspaces/folder-workspace-execution-host' import { createRepoRowExecutionHostLookup, resolveWorktreeExecutionHost -} from '../../../../shared/execution-host/worktree-execution-host-resolution' -import type { FolderWorkspace } from '../../../../shared/folder-workspaces/folder-workspace-types' -import type { Repo } from '../../../../shared/repo-types' -import type { Worktree } from '../../../../shared/worktree/types' -import { parseWorkspaceKey } from '../../../../shared/workspace-scope' +} from '../../../../../shared/execution-host/worktree-execution-host-resolution' +import type { FolderWorkspace } from '../../../../../shared/folder-workspaces/folder-workspace-types' +import type { Repo } from '../../../../../shared/repo-types' +import type { Worktree } from '../../../../../shared/worktree/types' +import { parseWorkspaceKey } from '../../../../../shared/workspace-scope' -import { getFolderWorkspaceWorktree } from '../../../../shared/folder-workspaces/folder-workspace-worktree' +import { getFolderWorkspaceWorktree } from '../../../../../shared/folder-workspaces/folder-workspace-worktree' export type AutomationListRow = { /** Authority-qualified and incarnation-free; see the module note. */ diff --git a/src/renderer/src/components/automations/automation-list-search-query.ts b/src/renderer/src/components/automations/listing/automation-list-search-query.ts similarity index 98% rename from src/renderer/src/components/automations/automation-list-search-query.ts rename to src/renderer/src/components/automations/listing/automation-list-search-query.ts index fec6b0f17b8..e2d93ccf61d 100644 --- a/src/renderer/src/components/automations/automation-list-search-query.ts +++ b/src/renderer/src/components/automations/listing/automation-list-search-query.ts @@ -1,4 +1,4 @@ -import { isClipboardTextByteLengthOverLimit } from '../../../../shared/clipboard-text' +import { isClipboardTextByteLengthOverLimit } from '../../../../../shared/clipboard-text' /** Pasted queries above this are rejected so filtering never runs on unbounded input. */ export const AUTOMATION_LIST_SEARCH_QUERY_MAX_BYTES = 2 * 1024 diff --git a/src/renderer/src/components/automations/automation-list-search-rows.ts b/src/renderer/src/components/automations/listing/automation-list-search-rows.ts similarity index 89% rename from src/renderer/src/components/automations/automation-list-search-rows.ts rename to src/renderer/src/components/automations/listing/automation-list-search-rows.ts index 8ebb6566b70..38fbb317321 100644 --- a/src/renderer/src/components/automations/automation-list-search-rows.ts +++ b/src/renderer/src/components/automations/listing/automation-list-search-rows.ts @@ -1,8 +1,8 @@ -import { getAutomationRunRepoId } from '../../../../shared/automations/history/automation-run-identity' -import type { Automation } from '../../../../shared/automations/automation-definition' -import type { Repo } from '../../../../shared/repo-types' +import { getAutomationRunRepoId } from '../../../../../shared/automations/history/automation-run-identity' +import type { Automation } from '../../../../../shared/automations/automation-definition' +import type { Repo } from '../../../../../shared/repo-types' import type { AutomationListRow } from './automation-list-row-identity' -import { getAgentLabel } from './automation-draft-model' +import { getAgentLabel } from '../authoring/automation-draft-model' import { automationListSearchIndexMatches, buildAutomationListSearchFingerprint, @@ -11,8 +11,8 @@ import { type AutomationListSearchFields, type AutomationListSearchIndex } from './automation-list-search' -import { getExternalProviderLabel } from './external-automation-display' -import type { ExternalAutomationListEntry } from './external-automation-list-entries' +import { getExternalProviderLabel } from '../external/external-automation-display' +import type { ExternalAutomationListEntry } from '../external/external-automation-list-entries' /** Row identity is the authority-qualified row key / external key, so reorders invalidate the index. */ export type AutomationListSearchRowSource = { diff --git a/src/renderer/src/components/automations/automation-list-search.ts b/src/renderer/src/components/automations/listing/automation-list-search.ts similarity index 93% rename from src/renderer/src/components/automations/automation-list-search.ts rename to src/renderer/src/components/automations/listing/automation-list-search.ts index f1d3a9926fd..d6836798abd 100644 --- a/src/renderer/src/components/automations/automation-list-search.ts +++ b/src/renderer/src/components/automations/listing/automation-list-search.ts @@ -1,12 +1,3 @@ -export { - AUTOMATION_LIST_SEARCH_QUERY_MAX_BYTES, - clampAutomationListSearchQueryInput, - getActiveAutomationListSearchQuery, - isAutomationListSearchQueryTooLarge, - resolveAutomationListSearchQuery, - type AutomationListSearchQueryResolution -} from './automation-list-search-query' - // Bound indexed fields so lowercasing/includes cannot scale with multi-MB prompts. export const AUTOMATION_LIST_SEARCH_NAME_MAX_CODE_UNITS = 512 export const AUTOMATION_LIST_SEARCH_PROJECT_MAX_CODE_UNITS = 1_024 diff --git a/src/renderer/src/components/automations/automation-list-view.ts b/src/renderer/src/components/automations/listing/automation-list-view.ts similarity index 95% rename from src/renderer/src/components/automations/automation-list-view.ts rename to src/renderer/src/components/automations/listing/automation-list-view.ts index a7090e71d8d..9d41813ad86 100644 --- a/src/renderer/src/components/automations/automation-list-view.ts +++ b/src/renderer/src/components/automations/listing/automation-list-view.ts @@ -1,13 +1,13 @@ -import type { TuiAgent } from '../../../../shared/agent-launch/catalog/tui-agent' -import { hostStableKey } from '../../../../shared/automations/ownership/automation-owner-key' +import type { TuiAgent } from '../../../../../shared/agent-launch/catalog/tui-agent' +import { hostStableKey } from '../../../../../shared/automations/ownership/automation-owner-key' import type { AutomationListRow } from './automation-list-row-identity' -import type { ExternalAutomationListEntry } from './external-automation-list-entries' +import type { ExternalAutomationListEntry } from '../external/external-automation-list-entries' import { getAutomationRowLastRunSnapshot, getExternalAutomationLastRunSnapshot, type AutomationLastRunSnapshot } from './automation-list-last-run' -import type { Translate } from '../../i18n/use-translate' +import type { Translate } from '../../../i18n/use-translate' export type AutomationListStatusFilter = 'all' | 'enabled' | 'paused' export type AutomationListLastRunFilter = 'all' | 'failed' | 'succeeded' | 'never' diff --git a/src/renderer/src/components/automations/automations-table-layout.ts b/src/renderer/src/components/automations/listing/automations-table-layout.ts similarity index 100% rename from src/renderer/src/components/automations/automations-table-layout.ts rename to src/renderer/src/components/automations/listing/automations-table-layout.ts diff --git a/src/renderer/src/components/automations/use-automation-list-focus-recovery.ts b/src/renderer/src/components/automations/listing/use-automation-list-focus-recovery.ts similarity index 100% rename from src/renderer/src/components/automations/use-automation-list-focus-recovery.ts rename to src/renderer/src/components/automations/listing/use-automation-list-focus-recovery.ts diff --git a/src/renderer/src/components/automations/use-automation-list-search.test.tsx b/src/renderer/src/components/automations/listing/use-automation-list-search.test.tsx similarity index 96% rename from src/renderer/src/components/automations/use-automation-list-search.test.tsx rename to src/renderer/src/components/automations/listing/use-automation-list-search.test.tsx index 08bc7892067..bdee9b8dac2 100644 --- a/src/renderer/src/components/automations/use-automation-list-search.test.tsx +++ b/src/renderer/src/components/automations/listing/use-automation-list-search.test.tsx @@ -3,8 +3,8 @@ import { act } from 'react' import { createRoot, type Root } from 'react-dom/client' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { Repo } from '../../../../shared/repo-types' -import { makeAutomation, makeAutomationListRow, REPO_ID } from './automations-page-fixtures' +import type { Repo } from '../../../../../shared/repo-types' +import { makeAutomation, makeAutomationListRow, REPO_ID } from '../automations-page-fixtures' import type { AutomationListRow } from './automation-list-row-identity' import * as searchRows from './automation-list-search-rows' diff --git a/src/renderer/src/components/automations/use-automation-list-search.ts b/src/renderer/src/components/automations/listing/use-automation-list-search.ts similarity index 97% rename from src/renderer/src/components/automations/use-automation-list-search.ts rename to src/renderer/src/components/automations/listing/use-automation-list-search.ts index 207cb9bddb7..06938727b8b 100644 --- a/src/renderer/src/components/automations/use-automation-list-search.ts +++ b/src/renderer/src/components/automations/listing/use-automation-list-search.ts @@ -1,6 +1,6 @@ import { useDeferredValue, useEffect, useMemo, useRef } from 'react' -import type { Repo } from '../../../../shared/repo-types' -import { resolveAutomationListSearchQuery } from './automation-list-search' +import type { Repo } from '../../../../../shared/repo-types' +import { resolveAutomationListSearchQuery } from './automation-list-search-query' import type { AutomationListRow } from './automation-list-row-identity' import { buildAutomationListSearchRowFingerprint, @@ -12,7 +12,7 @@ import { type AutomationListSearchRowSource, type AutomationWorkspaceNameLookup } from './automation-list-search-rows' -import type { ExternalAutomationListEntry } from './external-automation-list-entries' +import type { ExternalAutomationListEntry } from '../external/external-automation-list-entries' /** Counts the empty-state view consumes, so it never recomputes what search already knows. */ export type AutomationListSearchCounts = { diff --git a/src/renderer/src/components/automations/use-automations-page-list-state.ts b/src/renderer/src/components/automations/listing/use-automations-page-list-state.ts similarity index 87% rename from src/renderer/src/components/automations/use-automations-page-list-state.ts rename to src/renderer/src/components/automations/listing/use-automations-page-list-state.ts index bbcf82d7e50..6e59091092c 100644 --- a/src/renderer/src/components/automations/use-automations-page-list-state.ts +++ b/src/renderer/src/components/automations/listing/use-automations-page-list-state.ts @@ -1,17 +1,20 @@ import { useCallback, useMemo } from 'react' -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' import { hostStableKey, ownerKey, toStableCatalogRef -} from '../../../../shared/automations/ownership/automation-owner-key' -import { resolveAutomationRunTarget } from './automation-run-open-target' -import { capturedAutomationOwner, capturedAutomationOwnerKey } from './automation-captured-owner' -import type { AutomationRun } from '../../../../shared/automations/history/automation-run' -import { getWorktreePathBasenameFromId } from '../../../../shared/worktree/id' -import { buildExternalAutomationListEntries } from './external-automation-list-entries' -import { externalAutomationScopeEntries } from './external-automation-scope-gating' -import { externalAutomationUncheckedNotice } from './external-automation-unchecked-hosts' +} from '../../../../../shared/automations/ownership/automation-owner-key' +import { resolveAutomationRunTarget } from '../runs/automation-run-open-target' +import { + capturedAutomationOwner, + capturedAutomationOwnerKey +} from '../hosts/automation-captured-owner' +import type { AutomationRun } from '../../../../../shared/automations/history/automation-run' +import { getWorktreePathBasenameFromId } from '../../../../../shared/worktree/id' +import { buildExternalAutomationListEntries } from '../external/external-automation-list-entries' +import { externalAutomationScopeEntries } from '../external/external-automation-scope-gating' +import { externalAutomationUncheckedNotice } from '../external/external-automation-unchecked-hosts' import { buildAutomationListViewItems, filterAutomationListRows, @@ -20,11 +23,11 @@ import { } from './automation-list-view' import { useIntlLocale } from '@/i18n/use-translate' import { unscopedAutomationListRows } from './automation-list-row-identity' -import { useAutomationHostCatalog } from './use-automation-host-catalog' +import { useAutomationHostCatalog } from '../hosts/use-automation-host-catalog' import { useAutomationListSearch } from './use-automation-list-search' -import { useScopedExternalAutomations } from './use-scoped-external-automations' -import type { AutomationsPageLocalState } from './use-automations-page-local-state' -import type { AutomationsPageStoreState } from './use-automations-page-store-state' +import { useScopedExternalAutomations } from '../external/use-scoped-external-automations' +import type { AutomationsPageLocalState } from '../use-automations-page-local-state' +import type { AutomationsPageStoreState } from '../use-automations-page-store-state' /** Host-qualified rows, external scopes, selection, and list-search projection. */ export function useAutomationsPageListState({ diff --git a/src/renderer/src/components/automations/AutomationRunDetailsPage.tsx b/src/renderer/src/components/automations/runs/AutomationRunDetailsPage.tsx similarity index 93% rename from src/renderer/src/components/automations/AutomationRunDetailsPage.tsx rename to src/renderer/src/components/automations/runs/AutomationRunDetailsPage.tsx index b252a7beef8..c393904acd9 100644 --- a/src/renderer/src/components/automations/AutomationRunDetailsPage.tsx +++ b/src/renderer/src/components/automations/runs/AutomationRunDetailsPage.tsx @@ -4,16 +4,16 @@ import { Button } from '@/components/ui/button' import CommentMarkdown from '@/components/sidebar/CommentMarkdown' import { cn } from '@/lib/utils' import { useIntlLocale, useTranslate } from '@/i18n/use-translate' -import type { Automation } from '../../../../shared/automations/automation-definition' -import type { AutomationRun } from '../../../../shared/automations/history/automation-run' +import type { Automation } from '../../../../../shared/automations/automation-definition' +import type { AutomationRun } from '../../../../../shared/automations/history/automation-run' import { AutomationRunPageFrame } from './AutomationRunPageFrame' import { getAutomationRunContent } from './automation-run-content' import { automationRunErrorText } from './automation-run-error-copy' import type { AutomationRunViewState } from './automation-run-view-state' import type { AutomationRunWorkspaceDisplay } from './automation-run-workspace-display' import { useFullAutomationRun } from './use-full-automation-run' -import { pendingAutomationSetupReview } from './automation-setup-review' -import type { SetupTrustMismatch } from '../../../../shared/worktree/create-types' +import { pendingAutomationSetupReview } from '../authoring/automation-setup-review' +import type { SetupTrustMismatch } from '../../../../../shared/worktree/create-types' import type { SelectedAutomationRunHistoryOutcome } from './use-selected-automation-run-history' import { AutomationRunErrorNotice, @@ -21,7 +21,7 @@ import { formatAutomationDateTimeWithRelative, getAutomationRunStatusLabel, getAutomationRunStatusVariant -} from './automation-page-parts' +} from '../automation-page-parts' export function AutomationRunDetailsPage({ automation, diff --git a/src/renderer/src/components/automations/AutomationRunHistory.tsx b/src/renderer/src/components/automations/runs/AutomationRunHistory.tsx similarity index 96% rename from src/renderer/src/components/automations/AutomationRunHistory.tsx rename to src/renderer/src/components/automations/runs/AutomationRunHistory.tsx index 2a5170c22b9..6fe9129addd 100644 --- a/src/renderer/src/components/automations/AutomationRunHistory.tsx +++ b/src/renderer/src/components/automations/runs/AutomationRunHistory.tsx @@ -2,13 +2,13 @@ import React, { useCallback, useLayoutEffect, useMemo, useRef, useState } from ' import { useVirtualizer } from '@tanstack/react-virtual' import { Badge } from '@/components/ui/badge' import { cn } from '@/lib/utils' -import type { AutomationRun } from '../../../../shared/automations/history/automation-run' -import type { Worktree } from '../../../../shared/worktree/types' +import type { AutomationRun } from '../../../../../shared/automations/history/automation-run' +import type { Worktree } from '../../../../../shared/worktree/types' import { formatAutomationDateTime, getAutomationRunStatusLabel, getAutomationRunStatusVariant -} from './automation-page-parts' +} from '../automation-page-parts' import { formatAutomationCost, formatAutomationTokens, @@ -16,9 +16,9 @@ import { } from './automation-usage-model' import { automationRunOccurrenceLabel, isAutomationRunFolded } from './automation-run-occurrences' import { getAutomationRunWorkspaceDisplay } from './automation-run-workspace-display' -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 { getAutomationRunHistoryArrowTarget, isAutomationRunHistoryArrowKey, diff --git a/src/renderer/src/components/automations/AutomationRunPageFrame.tsx b/src/renderer/src/components/automations/runs/AutomationRunPageFrame.tsx similarity index 100% rename from src/renderer/src/components/automations/AutomationRunPageFrame.tsx rename to src/renderer/src/components/automations/runs/AutomationRunPageFrame.tsx diff --git a/src/renderer/src/components/automations/AutomationRunsDashboard.tsx b/src/renderer/src/components/automations/runs/AutomationRunsDashboard.tsx similarity index 99% rename from src/renderer/src/components/automations/AutomationRunsDashboard.tsx rename to src/renderer/src/components/automations/runs/AutomationRunsDashboard.tsx index 121d4eab838..ada20eae61e 100644 --- a/src/renderer/src/components/automations/AutomationRunsDashboard.tsx +++ b/src/renderer/src/components/automations/runs/AutomationRunsDashboard.tsx @@ -17,7 +17,7 @@ import { Input } from '@/components/ui/input' import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip' import { useTranslate } from '@/i18n/use-translate' import { useUiLanguageRevision } from '@/i18n/use-ui-language-revision' -import type { AutomationListRow } from './automation-list-row-identity' +import type { AutomationListRow } from '../listing/automation-list-row-identity' import { countAutomationRunOutcomes, filterAutomationRunsDashboardEntries, diff --git a/src/renderer/src/components/automations/AutomationRunsDashboardSurface.tsx b/src/renderer/src/components/automations/runs/AutomationRunsDashboardSurface.tsx similarity index 87% rename from src/renderer/src/components/automations/AutomationRunsDashboardSurface.tsx rename to src/renderer/src/components/automations/runs/AutomationRunsDashboardSurface.tsx index 2cfe6edc2a9..2a8b8aa6209 100644 --- a/src/renderer/src/components/automations/AutomationRunsDashboardSurface.tsx +++ b/src/renderer/src/components/automations/runs/AutomationRunsDashboardSurface.tsx @@ -1,12 +1,15 @@ import React from 'react' -import { toRuntimeExecutionHostId, type ExecutionHostId } from '../../../../shared/execution-host' -import type { AutomationListRow } from './automation-list-row-identity' +import { + toRuntimeExecutionHostId, + type ExecutionHostId +} from '../../../../../shared/execution-host' +import type { AutomationListRow } from '../listing/automation-list-row-identity' import type { AutomationRunsDashboardEntry, AutomationRunsDashboardFailure } from './automation-runs-dashboard-model' import { AutomationRunsDashboard } from './AutomationRunsDashboard' -import type { AutomationsPageView } from './automation-page-state' +import type { AutomationsPageView } from '../automation-page-state' export function AutomationRunsDashboardSurface({ rows, diff --git a/src/renderer/src/components/automations/AutomationRunsTable.tsx b/src/renderer/src/components/automations/runs/AutomationRunsTable.tsx similarity index 99% rename from src/renderer/src/components/automations/AutomationRunsTable.tsx rename to src/renderer/src/components/automations/runs/AutomationRunsTable.tsx index 07e7ffacdb8..622ac1e51e5 100644 --- a/src/renderer/src/components/automations/AutomationRunsTable.tsx +++ b/src/renderer/src/components/automations/runs/AutomationRunsTable.tsx @@ -8,7 +8,7 @@ import { formatAutomationDateTimeWithRelative, getAutomationRunStatusLabel, getAutomationRunStatusVariant -} from './automation-page-parts' +} from '../automation-page-parts' const RUN_ROW_HEIGHT_PX = 59 const RUN_ROW_OVERSCAN = 10 diff --git a/src/renderer/src/components/automations/automation-run-actions.ts b/src/renderer/src/components/automations/runs/automation-run-actions.ts similarity index 87% rename from src/renderer/src/components/automations/automation-run-actions.ts rename to src/renderer/src/components/automations/runs/automation-run-actions.ts index 349375c18bb..ec1546678c5 100644 --- a/src/renderer/src/components/automations/automation-run-actions.ts +++ b/src/renderer/src/components/automations/runs/automation-run-actions.ts @@ -1,14 +1,14 @@ -import { capturedAutomationOwner } from './automation-captured-owner' +import { capturedAutomationOwner } from '../hosts/automation-captured-owner' import { toast } from 'sonner' -import type { AutomationRun } from '../../../../shared/automations/history/automation-run' +import type { AutomationRun } from '../../../../../shared/automations/history/automation-run' import { translate } from '@/i18n/i18n' -import { useAppStore } from '@/store' -import { getAutomationTargetAvailability } from './automation-target-availability' -import { runAutomationNowForTarget } from './automation-host-client' -import { dispatchAutomationRunNow } from './automation-row-action-dispatch' +import { useAppStore } from '@/store/index' +import { getAutomationTargetAvailability } from '../hosts/automation-target-availability' +import { runAutomationNowForTarget } from '../hosts/automation-host-client' +import { dispatchAutomationRunNow } from '../hosts/automation-row-action-dispatch' import { waitForAutomationRerunPendingVisibility } from './automation-run-view-state' -import type { AutomationListRow } from './automation-list-row-identity' -import type { AutomationsPageActionContext } from './automations-page-action-context' +import type { AutomationListRow } from '../listing/automation-list-row-identity' +import type { AutomationsPageActionContext } from '../automations-page-action-context' /** Run-now/rerun handlers keyed by the selected row's captured host. */ export function createAutomationRunActions({ diff --git a/src/renderer/src/components/automations/automation-run-completion-evidence.ts b/src/renderer/src/components/automations/runs/automation-run-completion-evidence.ts similarity index 85% rename from src/renderer/src/components/automations/automation-run-completion-evidence.ts rename to src/renderer/src/components/automations/runs/automation-run-completion-evidence.ts index 0e17d6a4dbb..7e9278b9d5f 100644 --- a/src/renderer/src/components/automations/automation-run-completion-evidence.ts +++ b/src/renderer/src/components/automations/runs/automation-run-completion-evidence.ts @@ -1,5 +1,5 @@ -import type { AutomationRun } from '../../../../shared/automations/history/automation-run' -import type { AgentStatusEntry } from '../../../../shared/agent-status/contracts/agent-status-types' +import type { AutomationRun } from '../../../../../shared/automations/history/automation-run' +import type { AgentStatusEntry } from '../../../../../shared/agent-status/contracts/agent-status-types' import type { RetainedAgentEntry } from '@/store/slices/agent-status/agent-status-contract' import { automationRunMatchesPaneKey } from './automation-run-open-target' diff --git a/src/renderer/src/components/automations/automation-run-content.ts b/src/renderer/src/components/automations/runs/automation-run-content.ts similarity index 75% rename from src/renderer/src/components/automations/automation-run-content.ts rename to src/renderer/src/components/automations/runs/automation-run-content.ts index 1e60554de81..dc56d6957d0 100644 --- a/src/renderer/src/components/automations/automation-run-content.ts +++ b/src/renderer/src/components/automations/runs/automation-run-content.ts @@ -1,5 +1,5 @@ -import type { AutomationRun } from '../../../../shared/automations/history/automation-run' -import { getAutomationRunContent as getSharedAutomationRunContent } from '../../../../shared/automations/history/automation-run-content' +import type { AutomationRun } from '../../../../../shared/automations/history/automation-run' +import { getAutomationRunContent as getSharedAutomationRunContent } from '../../../../../shared/automations/history/automation-run-content' import { translate } from '@/i18n/i18n' import type { Translate } from '@/i18n/use-translate' import { automationRunErrorText } from './automation-run-error-copy' diff --git a/src/renderer/src/components/automations/automation-run-error-copy.ts b/src/renderer/src/components/automations/runs/automation-run-error-copy.ts similarity index 96% rename from src/renderer/src/components/automations/automation-run-error-copy.ts rename to src/renderer/src/components/automations/runs/automation-run-error-copy.ts index 0656d23b19e..c7480ce7376 100644 --- a/src/renderer/src/components/automations/automation-run-error-copy.ts +++ b/src/renderer/src/components/automations/runs/automation-run-error-copy.ts @@ -2,8 +2,8 @@ import { translate } from '@/i18n/i18n' import { AUTOMATION_RUN_FAILURE_COPY as EN, type AutomationRunFailureCode -} from '../../../../shared/automations/history/automation-run-failure-copy' -import type { AutomationRun } from '../../../../shared/automations/history/automation-run' +} from '../../../../../shared/automations/history/automation-run-failure-copy' +import type { AutomationRun } from '../../../../../shared/automations/history/automation-run' // One whole sentence per non-ready setup state; unknown states keep the stored English. const SETUP_STATE_COPY: Record string> = { diff --git a/src/renderer/src/components/automations/automation-run-history-keyboard-navigation.test.ts b/src/renderer/src/components/automations/runs/automation-run-history-keyboard-navigation.test.ts similarity index 100% rename from src/renderer/src/components/automations/automation-run-history-keyboard-navigation.test.ts rename to src/renderer/src/components/automations/runs/automation-run-history-keyboard-navigation.test.ts diff --git a/src/renderer/src/components/automations/automation-run-history-keyboard-navigation.ts b/src/renderer/src/components/automations/runs/automation-run-history-keyboard-navigation.ts similarity index 96% rename from src/renderer/src/components/automations/automation-run-history-keyboard-navigation.ts rename to src/renderer/src/components/automations/runs/automation-run-history-keyboard-navigation.ts index 5b61eab7ff0..147d5bcbb00 100644 --- a/src/renderer/src/components/automations/automation-run-history-keyboard-navigation.ts +++ b/src/renderer/src/components/automations/runs/automation-run-history-keyboard-navigation.ts @@ -1,4 +1,4 @@ -import type { AutomationRun } from '../../../../shared/automations/history/automation-run' +import type { AutomationRun } from '../../../../../shared/automations/history/automation-run' import { isImeOwnedKeyboardEvent } from '@/lib/text-input/ime/ime-composition-keyboard-event' export type AutomationRunHistoryArrowKey = 'ArrowUp' | 'ArrowDown' diff --git a/src/renderer/src/components/automations/automation-run-occurrences.ts b/src/renderer/src/components/automations/runs/automation-run-occurrences.ts similarity index 90% rename from src/renderer/src/components/automations/automation-run-occurrences.ts rename to src/renderer/src/components/automations/runs/automation-run-occurrences.ts index c4b148f40cb..09011a19fe4 100644 --- a/src/renderer/src/components/automations/automation-run-occurrences.ts +++ b/src/renderer/src/components/automations/runs/automation-run-occurrences.ts @@ -1,7 +1,7 @@ /** Folded rows retain the first occurrence date; count/latest occurrence must expose continuing failures rather than suggesting one old event. */ -import type { AutomationRun } from '../../../../shared/automations/history/automation-run' -import { formatAutomationDateTime } from './automation-page-parts' +import type { AutomationRun } from '../../../../../shared/automations/history/automation-run' +import { formatAutomationDateTime } from '../automation-page-parts' import { translate } from '@/i18n/i18n' import type { Translate } from '@/i18n/use-translate' diff --git a/src/renderer/src/components/automations/runs/automation-run-open-target.test.ts b/src/renderer/src/components/automations/runs/automation-run-open-target.test.ts new file mode 100644 index 00000000000..52c986924ae --- /dev/null +++ b/src/renderer/src/components/automations/runs/automation-run-open-target.test.ts @@ -0,0 +1,84 @@ +import { describe, expect, it } from 'vitest' +import type { AutomationRun } from '../../../../../shared/automations/history/automation-run' + +import { 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'] + +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('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() + }) +}) diff --git a/src/renderer/src/components/automations/automation-run-open-target.ts b/src/renderer/src/components/automations/runs/automation-run-open-target.ts similarity index 91% rename from src/renderer/src/components/automations/automation-run-open-target.ts rename to src/renderer/src/components/automations/runs/automation-run-open-target.ts index 3ba854dd0a4..8fd6a1d96ef 100644 --- a/src/renderer/src/components/automations/automation-run-open-target.ts +++ b/src/renderer/src/components/automations/runs/automation-run-open-target.ts @@ -1,34 +1,34 @@ -import type { AutomationRun } from '../../../../shared/automations/history/automation-run' -import { makePaneKey, parsePaneKey } from '../../../../shared/workspace-layout/stable-pane-id' +import type { AutomationRun } from '../../../../../shared/automations/history/automation-run' +import { makePaneKey, parsePaneKey } from '../../../../../shared/workspace-layout/stable-pane-id' import { parseRemoteRuntimePtyId, isRemoteRuntimePtyId -} from '../../../../shared/remote-runtime/remote-runtime-pty-id' +} from '../../../../../shared/remote-runtime/remote-runtime-pty-id' import { isWebTerminalSurfaceTabId, toWebTerminalSurfaceTabId -} from '../../../../shared/workspace-layout/terminal-surface-id' -import type { TerminalLayoutSnapshot } from '../../../../shared/workspace-layout/terminal-tab-types' -import { terminalLayoutContainsLeaf } from '../../../../shared/workspace-session/workspace-session-pane-ownership' +} from '../../../../../shared/workspace-layout/terminal-surface-id' +import type { TerminalLayoutSnapshot } from '../../../../../shared/workspace-layout/terminal-tab-types' +import { terminalLayoutContainsLeaf } from '../../../../../shared/workspace-session/workspace-session-pane-ownership' import { getRepoExecutionHostId, parseExecutionHostId, toRuntimeExecutionHostId, type ExecutionHostId -} from '../../../../shared/execution-host' -import type { AutomationAuthorityRef } from '../../../../shared/automations/ownership/automation-owner-ref' +} from '../../../../../shared/execution-host' +import type { AutomationAuthorityRef } from '../../../../../shared/automations/ownership/automation-owner-ref' import type { AppState } from '@/store/types' import { selectFolderWorkspaces, selectWorktreesByRepo } from '@/store/workspaces/catalog/workspace-record-fields' -import { getFolderWorkspaceWorktree } from '../../../../shared/folder-workspaces/folder-workspace-worktree' +import { getFolderWorkspaceWorktree } from '../../../../../shared/folder-workspaces/folder-workspace-worktree' import { resolveExactWorktreeRoute } from '@/lib/workspace/ownership/worktree-owner-route' -import { parseWorkspaceKey } from '../../../../shared/workspace-scope' +import { parseWorkspaceKey } from '../../../../../shared/workspace-scope' import { getAutomationRunViewState } from './automation-run-view-state' import { resolveOwner } from '@/lib/workspace/ownership/resolve-owner' import type { WorktreeOperationRouteState } from '@/lib/workspace/ownership/worktree-operation-route' -import { resolveQualifiedFolderWorkspaceResult } from '../../../../shared/folder-workspaces/folder-workspace-execution-host' +import { resolveQualifiedFolderWorkspaceResult } from '../../../../../shared/folder-workspaces/folder-workspace-execution-host' import { getRuntimeEnvironmentIdForFolderWorkspace } from '@/lib/workspace/ownership/folder-workspace-runtime-owner' export type AutomationRunPaneTarget = { @@ -141,8 +141,6 @@ export function resolveAutomationRunTerminalTarget( } } -export { buildAutomationRunOpenLayout } from './automation-run-pane-layout' - /** The paired server that owns the run's workspace, or null when this client runs it itself. */ export function getAutomationRunOwnerEnvironmentId( state: WorktreeOperationRouteState, diff --git a/src/renderer/src/components/automations/automation-run-pane-layout.ts b/src/renderer/src/components/automations/runs/automation-run-pane-layout.ts similarity index 84% rename from src/renderer/src/components/automations/automation-run-pane-layout.ts rename to src/renderer/src/components/automations/runs/automation-run-pane-layout.ts index 5cf655364a1..516f05afc07 100644 --- a/src/renderer/src/components/automations/automation-run-pane-layout.ts +++ b/src/renderer/src/components/automations/runs/automation-run-pane-layout.ts @@ -1,4 +1,4 @@ -import type { TerminalLayoutSnapshot } from '../../../../shared/workspace-layout/terminal-tab-types' +import type { TerminalLayoutSnapshot } from '../../../../../shared/workspace-layout/terminal-tab-types' import type { AutomationRunPaneTarget } from './automation-run-open-target' export function buildAutomationRunOpenLayout({ diff --git a/src/renderer/src/components/automations/automation-run-view-state.ts b/src/renderer/src/components/automations/runs/automation-run-view-state.ts similarity index 96% rename from src/renderer/src/components/automations/automation-run-view-state.ts rename to src/renderer/src/components/automations/runs/automation-run-view-state.ts index a05ea7e6a4e..9e784026851 100644 --- a/src/renderer/src/components/automations/automation-run-view-state.ts +++ b/src/renderer/src/components/automations/runs/automation-run-view-state.ts @@ -1,5 +1,5 @@ -import type { Automation } from '../../../../shared/automations/automation-definition' -import type { AutomationRun } from '../../../../shared/automations/history/automation-run' +import type { Automation } from '../../../../../shared/automations/automation-definition' +import type { AutomationRun } from '../../../../../shared/automations/history/automation-run' import { translate } from '@/i18n/i18n' export type AutomationRunViewAvailability = diff --git a/src/renderer/src/components/automations/automation-run-workspace-action.ts b/src/renderer/src/components/automations/runs/automation-run-workspace-action.ts similarity index 92% rename from src/renderer/src/components/automations/automation-run-workspace-action.ts rename to src/renderer/src/components/automations/runs/automation-run-workspace-action.ts index 7606afe8169..82764baa8bd 100644 --- a/src/renderer/src/components/automations/automation-run-workspace-action.ts +++ b/src/renderer/src/components/automations/runs/automation-run-workspace-action.ts @@ -1,7 +1,7 @@ import { openExistingStructuredSession } from '@/lib/open-existing-structured-session' -import { ALL_TUI_AGENTS } from '../../../../shared/agent-launch/catalog/tui-agent-display-names' -import { isStructuredAgentSessionIdFor } from '../../../../shared/agent-session/structured-agent-session-create' -import type { AutomationRun } from '../../../../shared/automations/history/automation-run' +import { ALL_TUI_AGENTS } from '../../../../../shared/agent-launch/catalog/tui-agent-display-names' +import { isStructuredAgentSessionIdFor } from '../../../../../shared/agent-session/structured-agent-session-create' +import type { AutomationRun } from '../../../../../shared/automations/history/automation-run' import { toast } from 'sonner' import { translate } from '@/i18n/i18n' import { @@ -10,14 +10,14 @@ import { } from '@/lib/workspace/activation/worktree-activation' import type { ActivateAndRevealResult } from '@/lib/workspace/activation/worktree-activation-outcome' import { activateWslMovedWorkspace } from '@/lib/workspace/activation/wsl-moved-chat-activation' -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' import { activateTerminalTabOnOwner } from '@/lib/workspace/tabs/terminal-tab-owner-activation' import { activateWebRuntimeSessionTab } from '@/runtime/web-session-tabs-sync/actions/web-runtime-session-tab-lifecycle' import { resolveWebSessionVisibleTabId } from '@/runtime/web-session-tabs-sync/navigation/web-session-focus-intent' -import { parsePaneKey } from '../../../../shared/workspace-layout/stable-pane-id' -import { parseWorkspaceKey } from '../../../../shared/workspace-scope' -import { buildAutomationRunOpenLayout } from './automation-run-open-target' -import type { AutomationsPageActionContext } from './automations-page-action-context' +import { parsePaneKey } from '../../../../../shared/workspace-layout/stable-pane-id' +import { parseWorkspaceKey } from '../../../../../shared/workspace-scope' +import { buildAutomationRunOpenLayout } from './automation-run-pane-layout' +import type { AutomationsPageActionContext } from '../automations-page-action-context' let cancelPendingReveal: (() => void) | undefined diff --git a/src/renderer/src/components/automations/automation-run-workspace-display.ts b/src/renderer/src/components/automations/runs/automation-run-workspace-display.ts similarity index 90% rename from src/renderer/src/components/automations/automation-run-workspace-display.ts rename to src/renderer/src/components/automations/runs/automation-run-workspace-display.ts index 7726dd6677a..80023bd47ba 100644 --- a/src/renderer/src/components/automations/automation-run-workspace-display.ts +++ b/src/renderer/src/components/automations/runs/automation-run-workspace-display.ts @@ -1,7 +1,7 @@ import { translate } from '@/i18n/i18n' import type { Translate } from '@/i18n/use-translate' -import type { AutomationRun } from '../../../../shared/automations/history/automation-run' -import type { Worktree } from '../../../../shared/worktree/types' +import type { AutomationRun } from '../../../../../shared/automations/history/automation-run' +import type { Worktree } from '../../../../../shared/worktree/types' export type AutomationRunWorkspaceDisplay = { rowLabel: string diff --git a/src/renderer/src/components/automations/automation-runs-dashboard-model.ts b/src/renderer/src/components/automations/runs/automation-runs-dashboard-model.ts similarity index 93% rename from src/renderer/src/components/automations/automation-runs-dashboard-model.ts rename to src/renderer/src/components/automations/runs/automation-runs-dashboard-model.ts index d575f271feb..cef4501da04 100644 --- a/src/renderer/src/components/automations/automation-runs-dashboard-model.ts +++ b/src/renderer/src/components/automations/runs/automation-runs-dashboard-model.ts @@ -1,10 +1,10 @@ import type { AutomationRun, AutomationRunStatus -} from '../../../../shared/automations/history/automation-run' -import { parseExecutionHostId } from '../../../../shared/execution-host' -import type { AutomationActionNotice } from './automation-row-action-dispatch' -import type { AutomationListRow } from './automation-list-row-identity' +} from '../../../../../shared/automations/history/automation-run' +import { parseExecutionHostId } from '../../../../../shared/execution-host' +import type { AutomationActionNotice } from '../hosts/automation-row-action-dispatch' +import type { AutomationListRow } from '../listing/automation-list-row-identity' export type AutomationRunsDashboardRun = Pick< AutomationRun, diff --git a/src/renderer/src/components/automations/automation-usage-model.ts b/src/renderer/src/components/automations/runs/automation-usage-model.ts similarity index 92% rename from src/renderer/src/components/automations/automation-usage-model.ts rename to src/renderer/src/components/automations/runs/automation-usage-model.ts index a43b4a13ea8..03449a6643a 100644 --- a/src/renderer/src/components/automations/automation-usage-model.ts +++ b/src/renderer/src/components/automations/runs/automation-usage-model.ts @@ -1,7 +1,7 @@ import { getIntlLocale, translate } from '@/i18n/i18n' import type { Translate } from '@/i18n/use-translate' -import type { AutomationUsageSummary } from '../../../../shared/automations/history/automation-usage-summary' -import type { AutomationRunUsage } from '../../../../shared/automations/history/automation-run' +import type { AutomationUsageSummary } from '../../../../../shared/automations/history/automation-usage-summary' +import type { AutomationRunUsage } from '../../../../../shared/automations/history/automation-run' // Keep retained-run summaries shared across owning authorities; only display formatting belongs to the renderer. diff --git a/src/renderer/src/components/automations/use-automation-run-page-state.ts b/src/renderer/src/components/automations/runs/use-automation-run-page-state.ts similarity index 93% rename from src/renderer/src/components/automations/use-automation-run-page-state.ts rename to src/renderer/src/components/automations/runs/use-automation-run-page-state.ts index e35bd264191..dedf4911686 100644 --- a/src/renderer/src/components/automations/use-automation-run-page-state.ts +++ b/src/renderer/src/components/automations/runs/use-automation-run-page-state.ts @@ -6,14 +6,14 @@ import { getAutomationAuthorityTarget, getAutomationHostTargetKey, getAutomationListedTargetFromHostId -} from './automation-host-client' -import { ALL_AUTOMATION_HOSTS_FILTER } from '../../../../shared/automations/ownership/automation-host-filter' +} from '../hosts/automation-host-client' +import { ALL_AUTOMATION_HOSTS_FILTER } from '../../../../../shared/automations/ownership/automation-host-filter' import { canRerunAutomationRun } from './automation-run-view-state' import { getAutomationRunWorkspaceDisplay } from './automation-run-workspace-display' -import type { AutomationsPageListState } from './use-automations-page-list-state' -import type { AutomationsPageLocalState } from './use-automations-page-local-state' -import type { AutomationsPageSetupState } from './use-automations-page-setup-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 { AutomationsPageSetupState } from '../authoring/use-automations-page-setup-state' +import type { AutomationsPageStoreState } from '../use-automations-page-store-state' /** Navigation and terminal affordances for the selected automation run. */ export function useAutomationRunPageState({ diff --git a/src/renderer/src/components/automations/use-automation-runs-dashboard-payload.test.tsx b/src/renderer/src/components/automations/runs/use-automation-runs-dashboard-payload.test.tsx similarity index 92% rename from src/renderer/src/components/automations/use-automation-runs-dashboard-payload.test.tsx rename to src/renderer/src/components/automations/runs/use-automation-runs-dashboard-payload.test.tsx index 63fdfa53b87..bd2e16684ec 100644 --- a/src/renderer/src/components/automations/use-automation-runs-dashboard-payload.test.tsx +++ b/src/renderer/src/components/automations/runs/use-automation-runs-dashboard-payload.test.tsx @@ -3,12 +3,12 @@ import { act } from 'react' import { createRoot, type Root } from 'react-dom/client' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { AutomationRun } from '../../../../shared/automations/history/automation-run' -import { makeAutomationListRow, makeRun } from './automations-page-fixtures' -import * as dispatch from './automation-row-action-dispatch' +import type { AutomationRun } from '../../../../../shared/automations/history/automation-run' +import { makeAutomationListRow, makeRun } from '../automations-page-fixtures' +import * as dispatch from '../hosts/automation-row-action-dispatch' import { useAutomationRunsDashboard } from './use-automation-runs-dashboard' -vi.mock('./automation-row-action-dispatch', async (importOriginal) => ({ +vi.mock('../hosts/automation-row-action-dispatch', async (importOriginal) => ({ ...(await importOriginal()), dispatchAutomationRunHistoryPage: vi.fn(), dispatchAutomationRunHistory: vi.fn() diff --git a/src/renderer/src/components/automations/use-automation-runs-dashboard.test.tsx b/src/renderer/src/components/automations/runs/use-automation-runs-dashboard.test.tsx similarity index 88% rename from src/renderer/src/components/automations/use-automation-runs-dashboard.test.tsx rename to src/renderer/src/components/automations/runs/use-automation-runs-dashboard.test.tsx index e3dbd5c929c..1a4f97193e3 100644 --- a/src/renderer/src/components/automations/use-automation-runs-dashboard.test.tsx +++ b/src/renderer/src/components/automations/runs/use-automation-runs-dashboard.test.tsx @@ -3,14 +3,14 @@ import { act, useCallback } from 'react' import { createRoot, type Root } from 'react-dom/client' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { AutomationAuthorityRef } from '../../../../shared/automations/ownership/automation-owner-ref' -import type { AutomationRunsPage } from '../../../../shared/automations/history/automation-run' -import type { AutomationHostTarget } from './automation-host-client' -import { makeAutomationListRow, makeRun } from './automations-page-fixtures' -import * as dispatch from './automation-row-action-dispatch' +import type { AutomationAuthorityRef } from '../../../../../shared/automations/ownership/automation-owner-ref' +import type { AutomationRunsPage } from '../../../../../shared/automations/history/automation-run' +import type { AutomationHostTarget } from '../hosts/automation-host-client' +import { makeAutomationListRow, makeRun } from '../automations-page-fixtures' +import * as dispatch from '../hosts/automation-row-action-dispatch' import { useAutomationRunsDashboard } from './use-automation-runs-dashboard' -vi.mock('./automation-row-action-dispatch', async (importOriginal) => ({ +vi.mock('../hosts/automation-row-action-dispatch', async (importOriginal) => ({ ...(await importOriginal()), dispatchAutomationRunHistoryPage: vi.fn() })) diff --git a/src/renderer/src/components/automations/use-automation-runs-dashboard.ts b/src/renderer/src/components/automations/runs/use-automation-runs-dashboard.ts similarity index 92% rename from src/renderer/src/components/automations/use-automation-runs-dashboard.ts rename to src/renderer/src/components/automations/runs/use-automation-runs-dashboard.ts index 58d4fcbfdfb..9379449c671 100644 --- a/src/renderer/src/components/automations/use-automation-runs-dashboard.ts +++ b/src/renderer/src/components/automations/runs/use-automation-runs-dashboard.ts @@ -1,17 +1,20 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react' -import type { AutomationAuthorityRef } from '../../../../shared/automations/ownership/automation-owner-ref' -import { ownerKey } from '../../../../shared/automations/ownership/automation-owner-key' -import { capturedAutomationOwner, capturedAutomationOwnerKey } from './automation-captured-owner' +import type { AutomationAuthorityRef } from '../../../../../shared/automations/ownership/automation-owner-ref' +import { ownerKey } from '../../../../../shared/automations/ownership/automation-owner-key' +import { + capturedAutomationOwner, + capturedAutomationOwnerKey +} from '../hosts/automation-captured-owner' import { getAutomationHostTargetKey, listAutomationRunsForTarget, type AutomationHostTarget -} from './automation-host-client' -import type { AutomationListRow } from './automation-list-row-identity' +} from '../hosts/automation-host-client' +import type { AutomationListRow } from '../listing/automation-list-row-identity' import { dispatchAutomationRunHistoryPage, type AutomationDispatchContext -} from './automation-row-action-dispatch' +} from '../hosts/automation-row-action-dispatch' import { buildAutomationRunsDashboardEntries, getAutomationRunsScope, diff --git a/src/renderer/src/components/automations/use-full-automation-run.ts b/src/renderer/src/components/automations/runs/use-full-automation-run.ts similarity index 89% rename from src/renderer/src/components/automations/use-full-automation-run.ts rename to src/renderer/src/components/automations/runs/use-full-automation-run.ts index caf6856dd6d..f534ec145fe 100644 --- a/src/renderer/src/components/automations/use-full-automation-run.ts +++ b/src/renderer/src/components/automations/runs/use-full-automation-run.ts @@ -1,9 +1,9 @@ import { useEffect, useLayoutEffect, useRef, useState } from 'react' -import type { AutomationRun } from '../../../../shared/automations/history/automation-run' -import { automationActionAvailability } from './automation-captured-owner' -import { readFullAutomationRun } from './automation-scoped-list-client' +import type { AutomationRun } from '../../../../../shared/automations/history/automation-run' +import { automationActionAvailability } from '../hosts/automation-captured-owner' +import { readFullAutomationRun } from '../hosts/automation-scoped-list-client' import type { SelectedAutomationRunHistoryOutcome } from './use-selected-automation-run-history' -import { useTranslate } from '../../i18n/use-translate' +import { useTranslate } from '../../../i18n/use-translate' export type FullAutomationRun = { run: AutomationRun diff --git a/src/renderer/src/components/automations/use-selected-automation-run-history.ts b/src/renderer/src/components/automations/runs/use-selected-automation-run-history.ts similarity index 90% rename from src/renderer/src/components/automations/use-selected-automation-run-history.ts rename to src/renderer/src/components/automations/runs/use-selected-automation-run-history.ts index 6f9a96436c2..0bb044be483 100644 --- a/src/renderer/src/components/automations/use-selected-automation-run-history.ts +++ b/src/renderer/src/components/automations/runs/use-selected-automation-run-history.ts @@ -9,30 +9,30 @@ */ import { useEffect, useLayoutEffect, useRef } from 'react' -import type { AutomationRun } from '../../../../shared/automations/history/automation-run' -import type { AutomationAuthorityRef } from '../../../../shared/automations/ownership/automation-owner-ref' +import type { AutomationRun } from '../../../../../shared/automations/history/automation-run' +import type { AutomationAuthorityRef } from '../../../../../shared/automations/ownership/automation-owner-ref' import { capturedAutomationOwner, capturedAutomationOwnerKey, type AutomationCapturedOwner -} from './automation-captured-owner' -import type { AutomationListRow } from './automation-list-row-identity' +} from '../hosts/automation-captured-owner' +import type { AutomationListRow } from '../listing/automation-list-row-identity' import { type AutomationActionNotice, type AutomationDispatchContext, dispatchAutomationRunHistory -} from './automation-row-action-dispatch' +} from '../hosts/automation-row-action-dispatch' import { getAutomationAuthorityTarget, getAutomationTargetFromHostId, listAutomationRunsForTarget, type AutomationHostTarget -} from './automation-host-client' -import { useAppStore } from '@/store' -import { automationRuntimePairingRevision } from './automation-authority-identity' -import { automationAuthorityCatalogKey } from './automation-host-catalog-types' -import { isSameStableAutomationHost } from '../../../../shared/automations/ownership/automation-owner-key' -import { subscribeAutomationHostInvalidation } from './automation-host-invalidation-window-events' +} from '../hosts/automation-host-client' +import { useAppStore } from '@/store/index' +import { automationRuntimePairingRevision } from '../hosts/automation-authority-identity' +import { automationAuthorityCatalogKey } from '../hosts/automation-host-catalog-types' +import { isSameStableAutomationHost } from '../../../../../shared/automations/ownership/automation-owner-key' +import { subscribeAutomationHostInvalidation } from '../hosts/automation-host-invalidation-window-events' export type SelectedAutomationRunNavigation = { automationId: string diff --git a/src/renderer/src/components/automations/use-automation-list-focus-recovery.test.tsx b/src/renderer/src/components/automations/use-automation-list-focus-recovery.test.tsx deleted file mode 100644 index 6dcb1383fec..00000000000 --- a/src/renderer/src/components/automations/use-automation-list-focus-recovery.test.tsx +++ /dev/null @@ -1,88 +0,0 @@ -// @vitest-environment happy-dom - -/** Exercise real DOM focus: the hook must distinguish lost row focus from a user who moved elsewhere. */ - -import { act, useRef } from 'react' -import { createRoot, type Root } from 'react-dom/client' -import { afterEach, beforeEach, describe, expect, it } from 'vitest' -import { useAutomationListFocusRecovery } from './use-automation-list-focus-recovery' - -let container: HTMLDivElement -let root: Root - -beforeEach(() => { - globalThis.IS_REACT_ACT_ENVIRONMENT = true - container = document.createElement('div') - document.body.appendChild(container) - root = createRoot(container) -}) - -afterEach(() => { - act(() => root.unmount()) - container.remove() -}) - -function Harness({ rowKeys }: { rowKeys: readonly string[] }): React.JSX.Element { - const listRef = useRef(null) - const pickerRef = useRef(null) - useAutomationListFocusRecovery({ rowKeys, containerRef: listRef, fallbackRef: pickerRef }) - return ( -
- {/* The header: outside the list container, exactly as the panel lays it out. */} -
-
- -
- {rowKeys.map((rowKey) => ( -
- ))} -
-
- ) -} - -function render(rowKeys: readonly string[]): void { - act(() => { - root.render() - }) -} - -function node(testId: string): HTMLElement { - const found = container.querySelector(`[data-testid="${testId}"]`) - if (!found) { - throw new Error(`no node for ${testId}`) - } - return found -} - -function focus(testId: string): void { - act(() => { - node(testId).focus() - }) -} - -describe('useAutomationListFocusRecovery', () => { - it('leaves focus in the search field when filtering removes the row it was on', () => { - render(['r1', 'r2', 'r3']) - focus('r2') - focus('search') - const search = node('search') - - render(['r1', 'r3']) - - expect(document.activeElement).toBe(search) - }) - - it('still repairs focus lost from the list itself', () => { - render(['r1', 'r2', 'r3']) - focus('r2') - act(() => { - node('r2').blur() - }) - - render(['r1', 'r3']) - - expect(document.activeElement).toBe(node('r3')) - }) -}) diff --git a/src/renderer/src/components/automations/use-automations-page-controller.ts b/src/renderer/src/components/automations/use-automations-page-controller.ts index a31c26e0bf6..132eb3135bb 100644 --- a/src/renderer/src/components/automations/use-automations-page-controller.ts +++ b/src/renderer/src/components/automations/use-automations-page-controller.ts @@ -1,22 +1,22 @@ -import { createAutomationManagementActions } from './automation-management-actions' -import { createAutomationRunActions } from './automation-run-actions' -import { createAutomationRunWorkspaceAction } from './automation-run-workspace-action' -import { createAutomationSaveAction } from './automation-save-action' -import { useAutomationDraftEffects } from './use-automation-draft-effects' -import { useAutomationEditorActions } from './use-automation-editor-actions' -import { useAutomationMigrateAction } from './use-automation-migrate-action' -import { useAutomationRunPageState } from './use-automation-run-page-state' +import { createAutomationManagementActions } from './authoring/automation-management-actions' +import { createAutomationRunActions } from './runs/automation-run-actions' +import { createAutomationRunWorkspaceAction } from './runs/automation-run-workspace-action' +import { createAutomationSaveAction } from './authoring/automation-save-action' +import { useAutomationDraftEffects } from './authoring/use-automation-draft-effects' +import { useAutomationEditorActions } from './authoring/use-automation-editor-actions' +import { useAutomationMigrateAction } from './authoring/use-automation-migrate-action' +import { useAutomationRunPageState } from './runs/use-automation-run-page-state' import { useAutomationsPageEscape } from './use-automations-page-escape' -import { useAutomationsPageListState } from './use-automations-page-list-state' +import { useAutomationsPageListState } from './listing/use-automations-page-list-state' import { useAutomationsPageLocalState } from './use-automations-page-local-state' -import { useAutomationsPageDestinationState } from './use-automations-page-destination-state' -import { useAutomationsPageDestinationForm } from './use-automations-page-destination-form' +import { useAutomationsPageDestinationState } from './authoring/use-automations-page-destination-state' +import { useAutomationsPageDestinationForm } from './authoring/use-automations-page-destination-form' import { useAutomationsPagePresentationState } from './use-automations-page-presentation-state' import { useAutomationsPageRefresh } from './use-automations-page-refresh' -import { useAutomationsPageSetupState } from './use-automations-page-setup-state' +import { useAutomationsPageSetupState } from './authoring/use-automations-page-setup-state' import { useAutomationsPageStoreState } from './use-automations-page-store-state' -import { useExternalAutomationActions } from './use-external-automation-actions' -import { useAutomationRunsDashboard } from './use-automation-runs-dashboard' +import { useExternalAutomationActions } from './external/use-external-automation-actions' +import { useAutomationRunsDashboard } from './runs/use-automation-runs-dashboard' export function useAutomationsPageController() { const store = useAutomationsPageStoreState() diff --git a/src/renderer/src/components/automations/use-automations-page-local-state.ts b/src/renderer/src/components/automations/use-automations-page-local-state.ts index 7589076e4fe..87d4438d963 100644 --- a/src/renderer/src/components/automations/use-automations-page-local-state.ts +++ b/src/renderer/src/components/automations/use-automations-page-local-state.ts @@ -6,24 +6,24 @@ import type { } from '../../../../shared/automations/external/external-automation' import type { OrcaHooks } from '../../../../shared/orca-yaml-hook-types' import { useContextualTour } from '@/components/contextual-tours/use-contextual-tour' -import type { AutomationDraft } from './AutomationEditorDialog' -import { AUTOMATION_DEFAULT_TIME } from './automation-draft-model' -import type { AutomationActionNotice } from './automation-row-action-dispatch' -import type { AutomationHostCatalogEntry } from './automation-host-catalog-types' -import type { AutomationCreateDestination } from './automation-create-destination' -import type { AutomationListRow } from './automation-list-row-identity' +import type { AutomationDraft } from './authoring/AutomationEditorDialog' +import { AUTOMATION_DEFAULT_TIME } from './authoring/automation-draft-model' +import type { AutomationActionNotice } from './hosts/automation-row-action-dispatch' +import type { AutomationHostCatalogEntry } from './hosts/automation-host-catalog-types' +import type { AutomationCreateDestination } from './authoring/automation-create-destination' +import type { AutomationListRow } from './listing/automation-list-row-identity' import { EMPTY_AUTOMATION_LIST_FILTER, type AutomationListFilter, type AutomationListSort -} from './automation-list-view' +} from './listing/automation-list-view' import type { AutomationPaneTab, AutomationRunPageOrigin, AutomationsPageView } from './automation-page-state' -import type { ExternalAutomationScope } from './external-automation-scope-client' -import type { SelectedAutomationRunHistoryOutcome } from './use-selected-automation-run-history' +import type { ExternalAutomationScope } from './external/external-automation-scope-client' +import type { SelectedAutomationRunHistoryOutcome } from './runs/use-selected-automation-run-history' import type { AutomationsPageStoreState } from './use-automations-page-store-state' /** React-owned values for the page; host/catalog state remains in dedicated hooks. */ diff --git a/src/renderer/src/components/automations/use-automations-page-presentation-state.ts b/src/renderer/src/components/automations/use-automations-page-presentation-state.ts index eb694afb229..964f9f783c1 100644 --- a/src/renderer/src/components/automations/use-automations-page-presentation-state.ts +++ b/src/renderer/src/components/automations/use-automations-page-presentation-state.ts @@ -1,4 +1,4 @@ -import { capturedAutomationOwner } from './automation-captured-owner' +import { capturedAutomationOwner } from './hosts/automation-captured-owner' import { useCallback, useEffect, useMemo } from 'react' import { getLocalExecutionHostLabel, @@ -7,10 +7,10 @@ import { } from '../../../../shared/execution-host' import { getHostDisplayLabelOverrides } from '../../../../shared/host-setting-overrides' import type { Repo } from '../../../../shared/repo-types' -import { getAutomationTargetAvailability } from './automation-target-availability' -import type { AutomationsPageDestinationState } from './use-automations-page-destination-state' -import type { AutomationsPageDestinationFormState } from './use-automations-page-destination-form' -import type { AutomationsPageListState } from './use-automations-page-list-state' +import { getAutomationTargetAvailability } from './hosts/automation-target-availability' +import type { AutomationsPageDestinationState } from './authoring/use-automations-page-destination-state' +import type { AutomationsPageDestinationFormState } from './authoring/use-automations-page-destination-form' +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 { useTranslate } from '../../i18n/use-translate' diff --git a/src/renderer/src/components/automations/use-automations-page-refresh.ts b/src/renderer/src/components/automations/use-automations-page-refresh.ts index a0db0e2e6ad..d79192d22aa 100644 --- a/src/renderer/src/components/automations/use-automations-page-refresh.ts +++ b/src/renderer/src/components/automations/use-automations-page-refresh.ts @@ -1,16 +1,16 @@ import { useCallback, useEffect, useRef } from 'react' import { installWindowVisibilityInterval } from '@/lib/window-visibility-interval' -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' import { AUTOMATIONS_CHANGED_EVENT } from '@/lib/automations-changed-window-event' import { getAutomationHostTargetKey, getAutomationListedTargetFromHostId, listAutomationsForTarget -} from './automation-host-client' -import { automationAuthorityCatalogKey } from './automation-host-catalog-types' -import { useSelectedAutomationRunHistory } from './use-selected-automation-run-history' -import type { AutomationsPageDestinationState } from './use-automations-page-destination-state' -import type { AutomationsPageListState } from './use-automations-page-list-state' +} from './hosts/automation-host-client' +import { automationAuthorityCatalogKey } from './hosts/automation-host-catalog-types' +import { useSelectedAutomationRunHistory } from './runs/use-selected-automation-run-history' +import type { AutomationsPageDestinationState } from './authoring/use-automations-page-destination-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' diff --git a/src/renderer/src/components/automations/use-automations-page-store-state.ts b/src/renderer/src/components/automations/use-automations-page-store-state.ts index 4528ee6ea98..84d48ee7467 100644 --- a/src/renderer/src/components/automations/use-automations-page-store-state.ts +++ b/src/renderer/src/components/automations/use-automations-page-store-state.ts @@ -6,7 +6,7 @@ import { import type { Repo } from '../../../../shared/repo-types' import type { Worktree } from '../../../../shared/worktree/types' import { getAgentCatalog } from '@/lib/agent-catalog/agent-catalog' -import { useAppStore } from '@/store' +import { useAppStore } from '@/store/index' import { useRepoMap } from '@/store/repos/use-repository-catalog' import { useWorktreeMap } from '@/store/slices/worktrees/listing/use-worktree-catalog' import { @@ -14,7 +14,7 @@ import { automationRepoForRow, automationWorktreeForRow, type AutomationListRow -} from './automation-list-row-identity' +} from './listing/automation-list-row-identity' import { selectFolderWorkspaces, selectWorktreesByRepo diff --git a/src/renderer/src/components/sidebar/workspace-card/details/WorktreeCardAutomationDetailSection.tsx b/src/renderer/src/components/sidebar/workspace-card/details/WorktreeCardAutomationDetailSection.tsx index ef9afa4cb17..2d20dbdecae 100644 --- a/src/renderer/src/components/sidebar/workspace-card/details/WorktreeCardAutomationDetailSection.tsx +++ b/src/renderer/src/components/sidebar/workspace-card/details/WorktreeCardAutomationDetailSection.tsx @@ -11,7 +11,7 @@ import { getAutomationTargetFromHostId, listAutomationRunsForTarget, listAutomationsForTarget -} from '@/components/automations/automation-host-client' +} from '@/components/automations/hosts/automation-host-client' type WorktreeCardAutomationDetailSectionProps = { provenance: AutomationWorkspaceProvenance diff --git a/src/renderer/src/lib/workspace/activation/worktree-activation-web-runtime.test.ts b/src/renderer/src/lib/workspace/activation/worktree-activation-web-runtime.test.ts index 0b8059af9a2..b3a3f546979 100644 --- a/src/renderer/src/lib/workspace/activation/worktree-activation-web-runtime.test.ts +++ b/src/renderer/src/lib/workspace/activation/worktree-activation-web-runtime.test.ts @@ -17,15 +17,6 @@ import { resetWebRuntimeWakeTerminalRespawnForTests } from '@/runtime/hosted-ter import '../../../runtime/rpc/testing/runtime-environment-bridge-fixture' import '@/runtime/web-session-tabs-sync/host-terminal-count-fixture' import { resetWebSessionTabsSnapshotFreshnessForTests } from '@/runtime/web-session-tabs-sync/tracking-lifecycle' -import { folderWorkspaceKey } from '../../../../../shared/workspace-scope' - -import { createAutomationRunWorkspaceAction } from '../../../components/automations/automation-run-workspace-action' -import { resolveAutomationRunTarget } from '../../../components/automations/automation-run-open-target' -import { makeRun } from '../../../components/automations/automations-page-fixtures' -import { - makeFolderWorkspace, - makeProjectGroup -} from '../../../components/sidebar/workspace-creation/folder/folder-workspace-composer-submit-fixtures' registerWorktreeActivationReset() const originalCreateTab = useAppStore.getState().createTab @@ -41,41 +32,6 @@ afterEach(() => { resetWebSessionTabsSnapshotFreshnessForTests() }) -describe('activateAndRevealWorktree', () => { - it('real historical workspace-only inherited folder enters through the fresh native folder path', () => { - const before = useAppStore.getState() - const folder = makeFolderWorkspace({ - id: 'fresh-history-folder', - projectGroupId: 'fresh-history-group' - }) - const workspaceId = folderWorkspaceKey(folder.id) - seedEmptyActivatableWorktree(makeCreatedAgentWorktree()) - const run = makeRun({ workspaceId, terminalPaneKey: null, terminalPtyId: null }) - useAppStore.setState({ - folderWorkspaces: [folder], - projectGroups: [ - { ...makeProjectGroup(), id: folder.projectGroupId, executionHostId: 'ssh:box' } - ], - unifiedTabsByWorktree: {}, - tabsByWorktree: {}, - terminalLayoutsByTabId: {}, - ptyIdsByTabId: {}, - everActivatedWorktreeIds: new Set() - }) - try { - const runTargetFor = () => - resolveAutomationRunTarget(useAppStore.getState(), run, { kind: 'desktop' }) - expect(runTargetFor().viewState.canOpen).toBe(true) - // SAFETY: only the historical resolver is consumed by this action. - createAutomationRunWorkspaceAction({ list: { runTargetFor } })(run) - expect(useAppStore.getState().activeWorktreeId).toBe(workspaceId) - expect(useAppStore.getState().activeWorkspaceExecutionHostId).toBe('ssh:box') - } finally { - useAppStore.setState(before, true) - } - }) -}) - describe('ensureWorktreeHasInitialTerminal', () => { it('holds the issue command for the first mirrored web runtime tab when none exists yet', () => { ;(globalThis as { __ORCA_WEB_CLIENT__?: boolean }).__ORCA_WEB_CLIENT__ = true diff --git a/src/renderer/src/main.tsx b/src/renderer/src/main.tsx index eb395c16689..4c2439334f4 100644 --- a/src/renderer/src/main.tsx +++ b/src/renderer/src/main.tsx @@ -11,7 +11,7 @@ import { installRendererCrashDiagnostics, recordRendererCrashBreadcrumb } from './lib/crash-diagnostics' -import { installAutomationHostDiagnostic } from './components/automations/automation-host-diagnostics' +import { installAutomationHostDiagnostic } from './components/automations/hosts/automation-host-diagnostics' import { applyCachedPluginAppTheme, applyDocumentTheme, diff --git a/tests/e2e/automation-save-fallback.unit.test.ts b/tests/e2e/automation-save-fallback.unit.test.ts deleted file mode 100644 index 771d663a9db..00000000000 --- a/tests/e2e/automation-save-fallback.unit.test.ts +++ /dev/null @@ -1,97 +0,0 @@ -// @vitest-environment happy-dom - -import { - installAutomationsPageHarness, - mocks -} from '../../src/renderer/src/components/automations/automations-page-test-harness' -import { RUNTIME_REPO_ID } from '../../src/renderer/src/components/automations/automations-page-runtime-fixtures' -import { - createRpcCalls, - holdRuntimeSave, - observeRuntimeIncarnation, - REGISTERED_CHAT_CAPABILITIES -} from '../../src/renderer/src/components/automations/automations-page-actions-test-harness' -import { - closeTestStores, - createStore, - makeRepo, - testState -} from '../../src/main/persistence/persistence-test-harness' -import { AutomationCreate } from '../../src/shared/rpc-contract/automation-params' -import { STRUCTURED_AGENT_SESSION_RUNTIME_CAPABILITY } from '../../src/shared/agent-session/agent-session-runtime-capabilities' -import { mkdtempSync, rmSync } from 'node:fs' -import { tmpdir } from 'node:os' -import { join } from 'node:path' -import { expect, it, vi } from 'vitest' - -vi.mock('../../src/main/telemetry/client', () => ({ track: vi.fn() })) -vi.mock('../../src/main/telemetry/cohort-classifier', () => ({ - getCohortAtEmit: () => ({ nth_repo_added: 2 }) -})) -installAutomationsPageHarness() - -it('settles the actual implicit late-false save with real final-store refusal of invalid Terminal extras', async () => { - const root = mkdtempSync(join(tmpdir(), 'orca-34332-save-')) - testState.dir = root - const disk = createStore() - disk.addRepo(makeRepo({ id: RUNTIME_REPO_ID })) - const before = disk.listAutomations() - const create = vi.spyOn(disk, 'createAutomation') - const held = await holdRuntimeSave({ agentId: 'claude', extraAgentArgs: '--resume x' }) - try { - expect(mocks.editorDialog?.draft).not.toHaveProperty('surface') - observeRuntimeIncarnation( - 'B', - REGISTERED_CHAT_CAPABILITIES.filter((c) => c !== STRUCTURED_AGENT_SESSION_RUNTIME_CAPABILITY) - ) - const previous = mocks.callRuntimeRpc.getMockImplementation() - mocks.callRuntimeRpc.mockImplementation(async (target, method, payload, options) => { - if (method !== 'automation.create') { - return await previous?.(target, method, payload, options) - } - const { - repo, - workspace: _workspace, - destination: _destination, - workspaceMode, - timezone, - ...input - } = AutomationCreate.parse(payload) - expect(repo).toBe(`id:${RUNTIME_REPO_ID}`) - if (workspaceMode !== 'new_per_run') { - throw new Error('Expected actual new_per_run workspace mode') - } - if (typeof timezone !== 'string' || timezone.trim().length === 0) { - throw new Error('Expected actual nonempty timezone') - } - return { - automation: disk.createAutomation({ - ...input, - workspaceMode, - timezone, - projectId: RUNTIME_REPO_ID - }) - } - }) - await held.page.rerender() - await held.release() - expect(createRpcCalls()).toHaveLength(1) - expect(createRpcCalls()[0]?.[2]).not.toHaveProperty('launchSetupPatch') - expect(create).toHaveBeenCalledOnce() - expect(create).toHaveBeenCalledWith(expect.objectContaining({ extraAgentArgs: '--resume x' })) - expect(create.mock.results[0]?.type).toBe('throw') - expect(disk.listAutomations()).toEqual(before) - expect(mocks.toastSuccess).not.toHaveBeenCalled() - expect(mocks.editorDialog?.notice?.message).toContain('--resume') - expect(mocks.editorDialog?.open).toBe(true) - expect(mocks.editorDialog?.isSaving).toBe(false) - disk.flush() - await closeTestStores() - const reloaded = createStore() - expect(reloaded.listAutomations()).toEqual(before) - } finally { - await held.release() - await closeTestStores() - rmSync(root, { recursive: true, force: true }) - } -}) diff --git a/tests/e2e/helpers/automation-chat-renderer-test-harness.ts b/tests/e2e/helpers/automation-chat-renderer-test-harness.ts index 470fc69cff0..dbb079d5899 100644 --- a/tests/e2e/helpers/automation-chat-renderer-test-harness.ts +++ b/tests/e2e/helpers/automation-chat-renderer-test-harness.ts @@ -1,7 +1,7 @@ import { unwrapRuntimeRpcResult } from '../../../src/renderer/src/runtime/rpc/calls/runtime-rpc-result' import type { AutomationRun } from '../../../src/shared/automations/history/automation-run' -import { createAutomationRunWorkspaceAction } from '../../../src/renderer/src/components/automations/automation-run-workspace-action' -import { getAutomationRunViewState } from '../../../src/renderer/src/components/automations/automation-run-view-state' +import { createAutomationRunWorkspaceAction } from '../../../src/renderer/src/components/automations/runs/automation-run-workspace-action' +import { getAutomationRunViewState } from '../../../src/renderer/src/components/automations/runs/automation-run-view-state' import { expect, vi } from 'vitest' import type { RuntimeClientTarget } from '../../../src/shared/runtime-client-target' import type { RuntimeMobileSessionTabsResult } from '../../../src/shared/runtime-types' diff --git a/tests/e2e/helpers/automation-chat-reopen-test-harness.ts b/tests/e2e/helpers/automation-chat-reopen-test-harness.ts index ab44557cad2..effd8d4a48a 100644 --- a/tests/e2e/helpers/automation-chat-reopen-test-harness.ts +++ b/tests/e2e/helpers/automation-chat-reopen-test-harness.ts @@ -15,8 +15,8 @@ import { createTestStore } from '../../../src/renderer/src/store/testing/app-sto import { makeUnifiedTab } from '../../../src/renderer/src/store/slices/tabs/tab-group.test-fixture' import { makeWorktree } from '../../../src/renderer/src/store/slices/worktrees/worktree.test-fixture' import { makeFolderWorkspace } from '../../../src/renderer/src/store/folder-workspaces/folder-workspace.test-fixture' -import { createAutomationRunWorkspaceAction } from '../../../src/renderer/src/components/automations/automation-run-workspace-action' -import { getAutomationRunViewState } from '../../../src/renderer/src/components/automations/automation-run-view-state' +import { createAutomationRunWorkspaceAction } from '../../../src/renderer/src/components/automations/runs/automation-run-workspace-action' +import { getAutomationRunViewState } from '../../../src/renderer/src/components/automations/runs/automation-run-view-state' import { createAutomationRunWriter } from '../../../src/main/automations/automation-run-writer' import { makeRepo } from '../../../src/main/persistence/persistence-test-harness' import { structuredAgentSessionTabId } from '../../../src/shared/agent-session/view/structured-agent-session-projection'