From 2fa7068646bd81bd938484a5aaf2ee9bdec7f8a1 Mon Sep 17 00:00:00 2001 From: Neil Date: Thu, 12 Nov 2026 15:32:30 -0800 Subject: [PATCH] refactor: organize sidebar inputs by concrete owners --- config/recurring-timer-baseline.txt | 2 +- .../scripts/ci/sharding/ci-shard-timings.json | 38 ++++++------ config/tsconfig.tc.web.json | 12 ++-- .../external-conversation-links.ts | 2 +- src/main/ipc/runtime.ts | 2 +- .../runtime-workspace-view-change-events.ts | 10 +-- .../workspace-view-collapse-writes.ts | 4 +- .../orca-runtime-agent-transitions.ts | 4 +- .../require-sidebar-inputs-enabled.ts} | 0 .../mobile-relay-host-catalog.test.ts | 2 +- src/main/runtime/orca-runtime.ts | 14 ++--- .../client-ui-set-collapsed.test.ts | 2 +- .../mobile-project-sections.ts | 6 +- .../methods/sidebar-inputs/sidebar-inputs.ts | 4 +- .../sidebar-inputs/cached-scan.test.ts | 10 --- .../desktop-sidebar-facts.test.ts | 12 ++-- .../{ => catalog}/desktop-sidebar-facts.ts | 26 ++++---- .../mobile-project-sections-snapshot.ts | 2 +- .../orca-runtime-project-catalog.test.ts | 24 ++++---- .../sidebar-project-catalog.test.ts | 6 +- .../{ => catalog}/sidebar-project-catalog.ts | 10 +-- .../{ => feed}/sidebar-inputs-feed-log.ts | 0 .../sidebar-inputs-feed-pages.test.ts | 2 +- .../{ => feed}/sidebar-inputs-feed-pages.ts | 2 +- .../{ => feed}/sidebar-inputs-feed-pins.ts | 2 +- .../{ => feed}/sidebar-inputs-feed.test.ts | 61 +------------------ .../{ => feed}/sidebar-inputs-feed.ts | 2 +- .../sidebar-inputs-feed.test-fixture.ts | 6 +- .../orca-runtime-sidebar-inputs-feed.test.ts | 4 +- .../orca-runtime-sidebar-temporal.ts | 19 +++--- .../repo-icon-data-urls.test.ts | 42 +------------ .../{ => repo-icons}/repo-icon-data-urls.ts | 10 +-- .../repo-icon-remote-fetch.ts | 2 +- .../testing}/repo-icon-image-fixture.ts | 0 .../sidebar-inputs-feed-domains.ts | 12 ++-- .../orca-runtime-closed-tab-retention.test.ts | 12 ++-- .../orca-runtime-sort-stamps.test.ts | 18 +++--- .../orca-runtime-terminal-use.test.ts | 36 +++-------- ...ca-runtime-windowless-terminal-activity.ts | 31 +++++----- .../orca-runtime-workspace-unread.test.ts | 26 ++++---- .../sidebar-retention-owner.test.ts | 6 +- .../{ => temporal}/sidebar-retention-owner.ts | 10 +-- .../sort-stamps-producer.test.ts | 32 +++++----- .../{ => temporal}/sort-stamps-producer.ts | 14 ++--- .../{ => temporal}/terminal-use-producer.ts | 4 +- .../{ => temporal}/workspace-viewers.test.ts | 0 .../{ => temporal}/workspace-viewers.ts | 6 +- ...runtime-detected-checkouts-live-content.ts | 10 +-- ...a-runtime-workspace-activity-facts.test.ts | 8 +-- .../orca-runtime-workspace-activity-facts.ts | 10 +-- .../orca-runtime-workspace-review-facts.ts | 2 +- .../workspace-activity-facts-producer.test.ts | 6 +- .../workspace-activity-facts-producer.ts | 14 ++--- .../workspace-live-content-producer.ts | 4 +- .../detected-checkouts-producer.ts | 14 ++--- .../paired-server-rows-producer.test.ts | 29 ++------- .../paired-server-rows-producer.ts | 22 +++---- .../workspace-git-identity.test.ts | 2 +- .../workspace-git-identity.ts | 10 +-- .../workspace-rows-producer.test.ts | 51 ++++------------ .../workspace-rows-producer.ts | 26 ++++---- .../workspace-activity-records-twins.test.ts} | 8 +-- .../metadata/workspace-activity-records.ts} | 18 +++--- ...ist-parity-project-catalog.test-fixture.ts | 2 +- .../sidebar-list-parity.test-fixture.ts | 2 +- .../sidebar-feed-reader.test.ts | 26 +------- tests/e2e/sidebar-repo-icons.spec.ts | 2 +- 67 files changed, 318 insertions(+), 499 deletions(-) rename src/main/runtime/{sidebar-inputs => client/settings}/runtime-workspace-view-change-events.ts (73%) rename src/main/runtime/{sidebar-inputs => client/settings}/workspace-view-collapse-writes.ts (92%) rename src/main/runtime/{sidebar-inputs/require-switched-on.ts => construction/require-sidebar-inputs-enabled.ts} (100%) rename src/main/runtime/sidebar-inputs/{ => catalog}/desktop-sidebar-facts.test.ts (90%) rename src/main/runtime/sidebar-inputs/{ => catalog}/desktop-sidebar-facts.ts (77%) rename src/main/runtime/sidebar-inputs/{ => catalog}/mobile-project-sections-snapshot.ts (91%) rename src/main/runtime/sidebar-inputs/{ => catalog}/orca-runtime-project-catalog.test.ts (74%) rename src/main/runtime/sidebar-inputs/{ => catalog}/sidebar-project-catalog.test.ts (94%) rename src/main/runtime/sidebar-inputs/{ => catalog}/sidebar-project-catalog.ts (71%) rename src/main/runtime/sidebar-inputs/{ => feed}/sidebar-inputs-feed-log.ts (100%) rename src/main/runtime/sidebar-inputs/{ => feed}/sidebar-inputs-feed-pages.test.ts (96%) rename src/main/runtime/sidebar-inputs/{ => feed}/sidebar-inputs-feed-pages.ts (97%) rename src/main/runtime/sidebar-inputs/{ => feed}/sidebar-inputs-feed-pins.ts (94%) rename src/main/runtime/sidebar-inputs/{ => feed}/sidebar-inputs-feed.test.ts (83%) rename src/main/runtime/sidebar-inputs/{ => feed}/sidebar-inputs-feed.ts (99%) rename src/main/runtime/sidebar-inputs/{ => feed/testing}/sidebar-inputs-feed.test-fixture.ts (96%) rename src/main/runtime/sidebar-inputs/{ => repo-icons}/repo-icon-data-urls.test.ts (60%) rename src/main/runtime/sidebar-inputs/{ => repo-icons}/repo-icon-data-urls.ts (95%) rename src/main/runtime/sidebar-inputs/{ => repo-icons}/repo-icon-remote-fetch.ts (96%) rename src/main/runtime/sidebar-inputs/{ => repo-icons/testing}/repo-icon-image-fixture.ts (100%) rename src/main/runtime/sidebar-inputs/{ => temporal}/orca-runtime-closed-tab-retention.test.ts (90%) rename src/main/runtime/sidebar-inputs/{ => temporal}/orca-runtime-sort-stamps.test.ts (87%) rename src/main/runtime/sidebar-inputs/{ => temporal}/orca-runtime-terminal-use.test.ts (67%) rename src/main/runtime/sidebar-inputs/{ => temporal}/orca-runtime-windowless-terminal-activity.ts (76%) rename src/main/runtime/sidebar-inputs/{ => temporal}/orca-runtime-workspace-unread.test.ts (87%) rename src/main/runtime/sidebar-inputs/{ => temporal}/sidebar-retention-owner.test.ts (92%) rename src/main/runtime/sidebar-inputs/{ => temporal}/sidebar-retention-owner.ts (94%) rename src/main/runtime/sidebar-inputs/{ => temporal}/sort-stamps-producer.test.ts (91%) rename src/main/runtime/sidebar-inputs/{ => temporal}/sort-stamps-producer.ts (95%) rename src/main/runtime/sidebar-inputs/{ => temporal}/terminal-use-producer.ts (91%) rename src/main/runtime/sidebar-inputs/{ => temporal}/workspace-viewers.test.ts (100%) rename src/main/runtime/sidebar-inputs/{ => temporal}/workspace-viewers.ts (90%) rename src/main/runtime/sidebar-inputs/{ => workspace-facts}/orca-runtime-detected-checkouts-live-content.ts (78%) rename src/main/runtime/sidebar-inputs/{ => workspace-facts}/orca-runtime-workspace-activity-facts.test.ts (91%) rename src/main/runtime/sidebar-inputs/{ => workspace-facts}/orca-runtime-workspace-activity-facts.ts (94%) rename src/main/runtime/sidebar-inputs/{ => workspace-facts}/orca-runtime-workspace-review-facts.ts (92%) rename src/main/runtime/sidebar-inputs/{ => workspace-facts}/workspace-activity-facts-producer.test.ts (95%) rename src/main/runtime/sidebar-inputs/{ => workspace-facts}/workspace-activity-facts-producer.ts (93%) rename src/main/runtime/sidebar-inputs/{ => workspace-facts}/workspace-live-content-producer.ts (89%) rename src/main/runtime/sidebar-inputs/{ => workspace-rows}/detected-checkouts-producer.ts (83%) rename src/main/runtime/sidebar-inputs/{ => workspace-rows}/paired-server-rows-producer.test.ts (90%) rename src/main/runtime/sidebar-inputs/{ => workspace-rows}/paired-server-rows-producer.ts (91%) rename src/main/runtime/sidebar-inputs/{ => workspace-rows}/workspace-git-identity.test.ts (98%) rename src/main/runtime/sidebar-inputs/{ => workspace-rows}/workspace-git-identity.ts (93%) rename src/main/runtime/sidebar-inputs/{ => workspace-rows}/workspace-rows-producer.test.ts (81%) rename src/main/runtime/sidebar-inputs/{ => workspace-rows}/workspace-rows-producer.ts (88%) rename src/main/runtime/{sidebar-inputs/sort-stamp-records-twins.test.ts => workspaces/metadata/workspace-activity-records-twins.test.ts} (92%) rename src/main/runtime/{sidebar-inputs/sort-stamp-records.ts => workspaces/metadata/workspace-activity-records.ts} (89%) diff --git a/config/recurring-timer-baseline.txt b/config/recurring-timer-baseline.txt index e48c4c98f18..5f4975db9c9 100644 --- a/config/recurring-timer-baseline.txt +++ b/config/recurring-timer-baseline.txt @@ -55,7 +55,7 @@ 1 src/main/runtime/rpc/transports/websocket/remote-runtime-server-heartbeat.ts 1 src/main/runtime/rpc/server/runtime-metadata-ownership-watch.ts 1 src/main/runtime/rpc/transports/unix-socket-transport.ts -1 src/main/runtime/sidebar-inputs/paired-server-rows-producer.ts +1 src/main/runtime/sidebar-inputs/workspace-rows/paired-server-rows-producer.ts 1 src/main/runtime/terminal/input/agent-prompt-permission-hold.ts 1 src/main/runtime/terminal/output/terminal-derived-agent-facts.ts 1 src/main/runtime/terminal/wait/terminal-idle-polls.ts diff --git a/config/scripts/ci/sharding/ci-shard-timings.json b/config/scripts/ci/sharding/ci-shard-timings.json index 525576adfe7..fa4f818bf9d 100644 --- a/config/scripts/ci/sharding/ci-shard-timings.json +++ b/config/scripts/ci/sharding/ci-shard-timings.json @@ -3545,30 +3545,30 @@ "src/main/runtime/session-tabs/session-tabs-windowed-main-change.test.ts": 4444, "src/main/runtime/orchestration/terminal-authority/settled-worker-process-replacement.test.ts": 5013, "src/main/runtime/sidebar-inputs/cached-scan.test.ts": 106, - "src/main/runtime/sidebar-inputs/desktop-sidebar-facts.test.ts": 378, - "src/main/runtime/sidebar-inputs/orca-runtime-closed-tab-retention.test.ts": 5233, - "src/main/runtime/sidebar-inputs/orca-runtime-project-catalog.test.ts": 4975, + "src/main/runtime/sidebar-inputs/catalog/desktop-sidebar-facts.test.ts": 378, + "src/main/runtime/sidebar-inputs/temporal/orca-runtime-closed-tab-retention.test.ts": 5233, + "src/main/runtime/sidebar-inputs/catalog/orca-runtime-project-catalog.test.ts": 4975, "src/main/runtime/sidebar-inputs/orca-runtime-sidebar-inputs-feed.test.ts": 3968, - "src/main/runtime/sidebar-inputs/orca-runtime-sort-stamps.test.ts": 3799, - "src/main/runtime/sidebar-inputs/orca-runtime-terminal-use.test.ts": 4460, - "src/main/runtime/sidebar-inputs/orca-runtime-workspace-activity-facts.test.ts": 3633, - "src/main/runtime/sidebar-inputs/orca-runtime-workspace-unread.test.ts": 4608, - "src/main/runtime/sidebar-inputs/paired-server-rows-producer.test.ts": 340, - "src/main/runtime/sidebar-inputs/repo-icon-data-urls.test.ts": 250, + "src/main/runtime/sidebar-inputs/temporal/orca-runtime-sort-stamps.test.ts": 3799, + "src/main/runtime/sidebar-inputs/temporal/orca-runtime-terminal-use.test.ts": 4460, + "src/main/runtime/sidebar-inputs/workspace-facts/orca-runtime-workspace-activity-facts.test.ts": 3633, + "src/main/runtime/sidebar-inputs/temporal/orca-runtime-workspace-unread.test.ts": 4608, + "src/main/runtime/sidebar-inputs/workspace-rows/paired-server-rows-producer.test.ts": 340, + "src/main/runtime/sidebar-inputs/repo-icons/repo-icon-data-urls.test.ts": 250, "src/main/runtime/sidebar-inputs/repo-icon-remote-fetch.test.ts": 101, "src/main/runtime/sidebar-inputs/sidebar-clock.test.ts": 45, "src/main/runtime/sidebar-inputs/sidebar-inputs-feed-announcements.test.ts": 1954, "src/main/runtime/sidebar-inputs/sidebar-inputs-feed-domains.test.ts": 496, - "src/main/runtime/sidebar-inputs/sidebar-inputs-feed-pages.test.ts": 162, - "src/main/runtime/sidebar-inputs/sidebar-inputs-feed.test.ts": 387, - "src/main/runtime/sidebar-inputs/sidebar-project-catalog.test.ts": 416, - "src/main/runtime/sidebar-inputs/sidebar-retention-owner.test.ts": 77, - "src/main/runtime/sidebar-inputs/sort-stamp-records-twins.test.ts": 246, - "src/main/runtime/sidebar-inputs/sort-stamps-producer.test.ts": 813, - "src/main/runtime/sidebar-inputs/workspace-activity-facts-producer.test.ts": 696, - "src/main/runtime/sidebar-inputs/workspace-git-identity.test.ts": 50, - "src/main/runtime/sidebar-inputs/workspace-rows-producer.test.ts": 4181, - "src/main/runtime/sidebar-inputs/workspace-viewers.test.ts": 65, + "src/main/runtime/sidebar-inputs/feed/sidebar-inputs-feed-pages.test.ts": 162, + "src/main/runtime/sidebar-inputs/feed/sidebar-inputs-feed.test.ts": 387, + "src/main/runtime/sidebar-inputs/catalog/sidebar-project-catalog.test.ts": 416, + "src/main/runtime/sidebar-inputs/temporal/sidebar-retention-owner.test.ts": 77, + "src/main/runtime/workspaces/metadata/workspace-activity-records-twins.test.ts": 246, + "src/main/runtime/sidebar-inputs/temporal/sort-stamps-producer.test.ts": 813, + "src/main/runtime/sidebar-inputs/workspace-facts/workspace-activity-facts-producer.test.ts": 696, + "src/main/runtime/sidebar-inputs/workspace-rows/workspace-git-identity.test.ts": 50, + "src/main/runtime/sidebar-inputs/workspace-rows/workspace-rows-producer.test.ts": 4181, + "src/main/runtime/sidebar-inputs/temporal/workspace-viewers.test.ts": 65, "src/main/runtime/terminal/output/stale-title-display-surfaces.test.ts": 4456, "src/main/runtime/agent-session/lifecycle/structured-agent-cli-writers.test.ts": 140, "src/main/runtime/agent-session/lifecycle/structured-agent-session-history-close-race.test.ts": 5020, diff --git a/config/tsconfig.tc.web.json b/config/tsconfig.tc.web.json index 82e91423858..b0f23d98c71 100644 --- a/config/tsconfig.tc.web.json +++ b/config/tsconfig.tc.web.json @@ -43,13 +43,13 @@ "../src/main/source-control/hosted-review-provider-read.ts", "../src/main/persistence/profile-state-cutover-fixture.ts", "../src/main/runtime/sidebar-inputs/sidebar-clock.ts", - "../src/main/runtime/sidebar-inputs/sidebar-retention-owner.ts", + "../src/main/runtime/sidebar-inputs/temporal/sidebar-retention-owner.ts", "../src/main/runtime/sidebar-inputs/producer-revision.ts", - "../src/main/runtime/sidebar-inputs/sidebar-inputs-feed.ts", - "../src/main/runtime/sidebar-inputs/sidebar-inputs-feed-log.ts", - "../src/main/runtime/sidebar-inputs/sidebar-inputs-feed-pages.ts", - "../src/main/runtime/sidebar-inputs/sidebar-inputs-feed-pins.ts", - "../src/main/runtime/sidebar-inputs/sidebar-inputs-feed.test-fixture.ts", + "../src/main/runtime/sidebar-inputs/feed/sidebar-inputs-feed.ts", + "../src/main/runtime/sidebar-inputs/feed/sidebar-inputs-feed-log.ts", + "../src/main/runtime/sidebar-inputs/feed/sidebar-inputs-feed-pages.ts", + "../src/main/runtime/sidebar-inputs/feed/sidebar-inputs-feed-pins.ts", + "../src/main/runtime/sidebar-inputs/feed/testing/sidebar-inputs-feed.test-fixture.ts", "../src/main/jira/adf-markdown.ts", "../src/main/jira/adf-text-marks.ts", "../src/main/jira/adf-media-destination.ts", diff --git a/src/main/external-conversations/external-conversation-links.ts b/src/main/external-conversations/external-conversation-links.ts index 6b79d4863d9..6d41d06eb2a 100644 --- a/src/main/external-conversations/external-conversation-links.ts +++ b/src/main/external-conversations/external-conversation-links.ts @@ -17,7 +17,7 @@ import { readWorkspaceRecord, writeWorkspaceRecord, type WorkspaceRecordStore -} from '../runtime/sidebar-inputs/sort-stamp-records' +} from '../runtime/workspaces/metadata/workspace-activity-records' import { CONNECTOR_AGENTS } from './connector-agents' import type { ConversationKey } from './external-conversation-types' diff --git a/src/main/ipc/runtime.ts b/src/main/ipc/runtime.ts index 8ce59e83b5e..16fda71e5a8 100644 --- a/src/main/ipc/runtime.ts +++ b/src/main/ipc/runtime.ts @@ -16,7 +16,7 @@ import { ORCHESTRATION_CONTRACT_VERSION } from '../../shared/orchestration/orche import { ALL_RPC_METHODS } from '../runtime/rpc/methods/rpc-method-registry' import { DesktopRuntimeSenderLifecycle } from './desktop-runtime-sender-lifecycle' import { toWorkspaceLifecycleResult } from '../ephemeral-vm/workspace-lifecycle-result' -import { publishMobileProjectSections } from '../runtime/sidebar-inputs/mobile-project-sections-snapshot' +import { publishMobileProjectSections } from '../runtime/sidebar-inputs/catalog/mobile-project-sections-snapshot' function boundTerminalFitRestore(pending: Promise): Promise { let timer: ReturnType | undefined diff --git a/src/main/runtime/sidebar-inputs/runtime-workspace-view-change-events.ts b/src/main/runtime/client/settings/runtime-workspace-view-change-events.ts similarity index 73% rename from src/main/runtime/sidebar-inputs/runtime-workspace-view-change-events.ts rename to src/main/runtime/client/settings/runtime-workspace-view-change-events.ts index a8974d1839e..275a24b3159 100644 --- a/src/main/runtime/sidebar-inputs/runtime-workspace-view-change-events.ts +++ b/src/main/runtime/client/settings/runtime-workspace-view-change-events.ts @@ -1,9 +1,9 @@ import { isDeepStrictEqual } from 'node:util' -import type { RuntimeClientEvent } from '../../../shared/runtime-client-events' -import type { GlobalSettings } from '../../../shared/global-settings-types' -import type { PersistedUIState } from '../../../shared/persisted-ui-state-types' -import { ALL_WORKSPACE_VIEW_UI_FIELDS } from '../../../shared/workspace-view/workspace-view-ui-fields' -import type { RuntimeStore } from '../construction/runtime-store-contract' +import type { RuntimeClientEvent } from '../../../../shared/runtime-client-events' +import type { GlobalSettings } from '../../../../shared/global-settings-types' +import type { PersistedUIState } from '../../../../shared/persisted-ui-state-types' +import { ALL_WORKSPACE_VIEW_UI_FIELDS } from '../../../../shared/workspace-view/workspace-view-ui-fields' +import type { RuntimeStore } from '../../construction/runtime-store-contract' /** The settings a phone's workspace list mirrors: Card layout, card style and pinned placement. */ const WORKSPACE_VIEW_SETTINGS: readonly (keyof GlobalSettings)[] = [ diff --git a/src/main/runtime/sidebar-inputs/workspace-view-collapse-writes.ts b/src/main/runtime/client/settings/workspace-view-collapse-writes.ts similarity index 92% rename from src/main/runtime/sidebar-inputs/workspace-view-collapse-writes.ts rename to src/main/runtime/client/settings/workspace-view-collapse-writes.ts index 4b2f55b5bc4..97fcb617f51 100644 --- a/src/main/runtime/sidebar-inputs/workspace-view-collapse-writes.ts +++ b/src/main/runtime/client/settings/workspace-view-collapse-writes.ts @@ -1,8 +1,8 @@ -import type { PersistedUIState } from '../../../shared/persisted-ui-state-types' +import type { PersistedUIState } from '../../../../shared/persisted-ui-state-types' import type { SetCollapsedRequest, SetCollapsedResult -} from '../../../shared/rpc-contract/workspace-view-collapse-params' +} from '../../../../shared/rpc-contract/workspace-view-collapse-params' // Far above writers x sections in use; an evicted entry only lets a very old retry apply again. const MAX_TRACKED_WRITES = 4096 diff --git a/src/main/runtime/construction/orca-runtime-agent-transitions.ts b/src/main/runtime/construction/orca-runtime-agent-transitions.ts index cc3f80fe66e..09fff63ea4c 100644 --- a/src/main/runtime/construction/orca-runtime-agent-transitions.ts +++ b/src/main/runtime/construction/orca-runtime-agent-transitions.ts @@ -7,9 +7,9 @@ import { HEADLESS_RUNTIME_WINDOW_ID } from '../../../shared/runtime-session-cont import { parsePaneKey } from '../../../shared/workspace-layout/stable-pane-id' import { parseWorkspaceKey } from '../../../shared/workspace-scope' import { getRepoIdFromWorktreeId } from '../../../shared/worktree/id' -import { OrcaRuntimeWithWindowlessTerminalActivity } from '../sidebar-inputs/orca-runtime-windowless-terminal-activity' +import { OrcaRuntimeWithWindowlessTerminalActivity } from '../sidebar-inputs/temporal/orca-runtime-windowless-terminal-activity' import { getRuntimeDesktopSurface } from './runtime-desktop-surface' -import type { AgentStatusStoreView } from '../sidebar-inputs/workspace-activity-facts-producer' +import type { AgentStatusStoreView } from '../sidebar-inputs/workspace-facts/workspace-activity-facts-producer' import { subscribeHookStatusTitles } from '../terminal/layout/hook-status-title-subscription' import { resolveTerminalWorkerDispatch, diff --git a/src/main/runtime/sidebar-inputs/require-switched-on.ts b/src/main/runtime/construction/require-sidebar-inputs-enabled.ts similarity index 100% rename from src/main/runtime/sidebar-inputs/require-switched-on.ts rename to src/main/runtime/construction/require-sidebar-inputs-enabled.ts diff --git a/src/main/runtime/mobile-desktop-relay/mobile-relay-host-catalog.test.ts b/src/main/runtime/mobile-desktop-relay/mobile-relay-host-catalog.test.ts index 0c0a0ebeee0..aa953d2563c 100644 --- a/src/main/runtime/mobile-desktop-relay/mobile-relay-host-catalog.test.ts +++ b/src/main/runtime/mobile-desktop-relay/mobile-relay-host-catalog.test.ts @@ -11,7 +11,7 @@ import type { SshConnectionState } from '../../../shared/ssh-types' import type { MobileDesktopRelayHosts } from './mobile-desktop-relay-hosts' import { MobileRelayHostCatalog } from './mobile-relay-host-catalog' -import { PairedServerRowsProducer } from '../sidebar-inputs/paired-server-rows-producer' +import { PairedServerRowsProducer } from '../sidebar-inputs/workspace-rows/paired-server-rows-producer' function answer(capable: boolean): RuntimeStatus { return { diff --git a/src/main/runtime/orca-runtime.ts b/src/main/runtime/orca-runtime.ts index 05885f295b9..9c545bc77d2 100644 --- a/src/main/runtime/orca-runtime.ts +++ b/src/main/runtime/orca-runtime.ts @@ -4,7 +4,7 @@ import type { RuntimeLinearCommandSurface } from './integrations/linear/runtime- import { installRuntimeLinearCommandSurface } from './integrations/linear/runtime-linear-command-surface' import { publishNativeChatPreferenceChanges } from './agent-session/launch/runtime-native-chat-preference-events' import { publishSettingsChanges } from './client/settings/runtime-settings-change-events' -import { publishWorkspaceViewChanges } from './sidebar-inputs/runtime-workspace-view-change-events' +import { publishWorkspaceViewChanges } from './client/settings/runtime-workspace-view-change-events' import { OrcaRuntimeWithSidebarTemporal, sidebarFactsRuntime @@ -49,15 +49,15 @@ import { installStructuredAgentAvailability as installAvailability, type StructuredAgentAvailabilityReader as AvailabilityReader } from './agent-session/launch/structured-agent-availability' -import { PairedServerRowsProducer } from './sidebar-inputs/paired-server-rows-producer' -import { RepoIconDataUrls } from './sidebar-inputs/repo-icon-data-urls' -import { WorkspaceRowsProducer } from './sidebar-inputs/workspace-rows-producer' +import { PairedServerRowsProducer } from './sidebar-inputs/workspace-rows/paired-server-rows-producer' +import { RepoIconDataUrls } from './sidebar-inputs/repo-icons/repo-icon-data-urls' +import { WorkspaceRowsProducer } from './sidebar-inputs/workspace-rows/workspace-rows-producer' import { getMainHttpClient } from '../network/http-client' import { getRuntimeDesktopSurface } from './construction/runtime-desktop-surface' -import { CollapseWriteOrder } from './sidebar-inputs/workspace-view-collapse-writes' -import { SidebarInputsFeed } from './sidebar-inputs/sidebar-inputs-feed' +import { CollapseWriteOrder } from './client/settings/workspace-view-collapse-writes' +import { SidebarInputsFeed } from './sidebar-inputs/feed/sidebar-inputs-feed' import { sidebarInputsFeedDomains } from './sidebar-inputs/sidebar-inputs-feed-domains' -import { requireSwitchedOn } from './sidebar-inputs/require-switched-on' +import { requireSwitchedOn } from './construction/require-sidebar-inputs-enabled' import { HEADLESS_RUNTIME_WINDOW_ID } from '../../shared/runtime-session-contracts' import { getHostDisplayLabelOverrides } from '../../shared/host-setting-overrides' import type { OrchestrationDb } from './orchestration/db/orchestration-db' diff --git a/src/main/runtime/rpc/methods/client-state/client-ui-set-collapsed.test.ts b/src/main/runtime/rpc/methods/client-state/client-ui-set-collapsed.test.ts index 5d37d90602e..2d9df273538 100644 --- a/src/main/runtime/rpc/methods/client-state/client-ui-set-collapsed.test.ts +++ b/src/main/runtime/rpc/methods/client-state/client-ui-set-collapsed.test.ts @@ -2,7 +2,7 @@ import { describe, expect, it } from 'vitest' import { getDefaultUIState } from '../../../../../shared/constants' import type { PersistedUIState } from '../../../../../shared/persisted-ui-state-types' import type { OrcaRuntimeService } from '../../../orca-runtime' -import { CollapseWriteOrder } from '../../../sidebar-inputs/workspace-view-collapse-writes' +import { CollapseWriteOrder } from '../../../client/settings/workspace-view-collapse-writes' import type { RpcRequest } from '../../core' import { RpcDispatcher } from '../../dispatcher' import type { RpcDispatchStreamingOptions } from '../../dispatch/dispatcher-stream-options' diff --git a/src/main/runtime/rpc/methods/mobile-delivery/mobile-project-sections.ts b/src/main/runtime/rpc/methods/mobile-delivery/mobile-project-sections.ts index 8e8993e9ca9..1626ebaa04f 100644 --- a/src/main/runtime/rpc/methods/mobile-delivery/mobile-project-sections.ts +++ b/src/main/runtime/rpc/methods/mobile-delivery/mobile-project-sections.ts @@ -1,9 +1,9 @@ import { defineMethod } from '../../core' import { MOBILE_PROJECT_SECTIONS_METHOD } from '../../../../../shared/mobile-project-sections-contract' import { ORCA_SIDEBAR_INPUTS_IS_MAIN } from '../../../../../shared/sidebar-inputs-switch' -import { readMobileProjectSections } from '../../../sidebar-inputs/mobile-project-sections-snapshot' -import { requireSwitchedOn } from '../../../sidebar-inputs/require-switched-on' -import { readSidebarProjectCatalog } from '../../../sidebar-inputs/sidebar-project-catalog' +import { readMobileProjectSections } from '../../../sidebar-inputs/catalog/mobile-project-sections-snapshot' +import { requireSwitchedOn } from '../../../construction/require-sidebar-inputs-enabled' +import { readSidebarProjectCatalog } from '../../../sidebar-inputs/catalog/sidebar-project-catalog' export const MOBILE_PROJECT_SECTIONS_METHODS = [ defineMethod({ diff --git a/src/main/runtime/rpc/methods/sidebar-inputs/sidebar-inputs.ts b/src/main/runtime/rpc/methods/sidebar-inputs/sidebar-inputs.ts index 6b397c6b061..1608ffd8344 100644 --- a/src/main/runtime/rpc/methods/sidebar-inputs/sidebar-inputs.ts +++ b/src/main/runtime/rpc/methods/sidebar-inputs/sidebar-inputs.ts @@ -1,12 +1,12 @@ import { defineMethod } from '../../core' -import { requireSwitchedOn } from '../../../sidebar-inputs/require-switched-on' +import { requireSwitchedOn } from '../../../construction/require-sidebar-inputs-enabled' import { readRuntimeDesktopSidebarFacts } from '../../../sidebar-inputs/sidebar-inputs-feed-domains' import { isHostOwnPhone } from '../../callers/host-own-phone' import { SidebarInputsReadParams } from '../../../../../shared/sidebar-list/sidebar-inputs-feed-contract' import { SidebarSessionBeginParams } from '../../../../../shared/rpc-contract/sidebar-session-params' import { RepoIconDataUrlsParams } from '../../../../../shared/sidebar-list/repo-icon-data-urls-contract' import { SetCollapsedParams } from '../../../../../shared/rpc-contract/workspace-view-collapse-params' -import { setCollapsedSection } from '../../../sidebar-inputs/workspace-view-collapse-writes' +import { setCollapsedSection } from '../../../client/settings/workspace-view-collapse-writes' import { ClientWorkspaceViewParams } from '../../../../../shared/rpc-contract/client-workspace-view-params' // Registered only with ORCA_SIDEBAR_INPUTS=main, so the producers below always exist. diff --git a/src/main/runtime/sidebar-inputs/cached-scan.test.ts b/src/main/runtime/sidebar-inputs/cached-scan.test.ts index 6f2164f914f..651c2493d4a 100644 --- a/src/main/runtime/sidebar-inputs/cached-scan.test.ts +++ b/src/main/runtime/sidebar-inputs/cached-scan.test.ts @@ -40,16 +40,6 @@ describe('CachedScan', () => { expect(pending).toHaveLength(0) }) - it('scans for a first reader and serves later readers from the cache', async () => { - const { cache, pending, finish } = scanner(false) - const ready = cache.ready() - expect(pending).toHaveLength(1) - await finish() - await ready - await cache.ready() - expect(pending).toHaveLength(0) - }) - it('runs no scan without demand, but makes the next reader scan again', async () => { const { cache, pending, finish } = scanner(false) const first = cache.ready() diff --git a/src/main/runtime/sidebar-inputs/desktop-sidebar-facts.test.ts b/src/main/runtime/sidebar-inputs/catalog/desktop-sidebar-facts.test.ts similarity index 90% rename from src/main/runtime/sidebar-inputs/desktop-sidebar-facts.test.ts rename to src/main/runtime/sidebar-inputs/catalog/desktop-sidebar-facts.test.ts index 2d9c480cf5e..69ed5649795 100644 --- a/src/main/runtime/sidebar-inputs/desktop-sidebar-facts.test.ts +++ b/src/main/runtime/sidebar-inputs/catalog/desktop-sidebar-facts.test.ts @@ -1,11 +1,11 @@ // Runs on plain Node, as orcad does: the reader imports no Electron. import { describe, expect, it } from 'vitest' -import type { FolderWorkspace } from '../../../shared/folder-workspaces/folder-workspace-types' -import type { ProjectGroup } from '../../../shared/project-group-types' -import type { Repo } from '../../../shared/repo-types' -import type { ExecutionHostId } from '../../../shared/execution-host' -import type { ManualRepoOrderEntry } from '../../../shared/ui-chrome-types' -import type { WorktreeMeta } from '../../../shared/worktree/meta-types' +import type { FolderWorkspace } from '../../../../shared/folder-workspaces/folder-workspace-types' +import type { ProjectGroup } from '../../../../shared/project-group-types' +import type { Repo } from '../../../../shared/repo-types' +import type { ExecutionHostId } from '../../../../shared/execution-host' +import type { ManualRepoOrderEntry } from '../../../../shared/ui-chrome-types' +import type { WorktreeMeta } from '../../../../shared/worktree/meta-types' import { readDesktopSidebarFacts, type DesktopSidebarFactSources } from './desktop-sidebar-facts' function repo(id: string, connectionId: string | null = null): Repo { diff --git a/src/main/runtime/sidebar-inputs/desktop-sidebar-facts.ts b/src/main/runtime/sidebar-inputs/catalog/desktop-sidebar-facts.ts similarity index 77% rename from src/main/runtime/sidebar-inputs/desktop-sidebar-facts.ts rename to src/main/runtime/sidebar-inputs/catalog/desktop-sidebar-facts.ts index 7e1a45f8a1a..85c0be95bf6 100644 --- a/src/main/runtime/sidebar-inputs/desktop-sidebar-facts.ts +++ b/src/main/runtime/sidebar-inputs/catalog/desktop-sidebar-facts.ts @@ -6,22 +6,22 @@ import { toRuntimeExecutionHostId, toSshExecutionHostId, type ExecutionHostId -} from '../../../shared/execution-host' -import { applyManualRepoOrder } from '../../../shared/manual-repo-order' -import type { DesktopSidebarFacts } from '../../../shared/sidebar-list/desktop-sidebar-facts' -import type { GlobalSettings } from '../../../shared/global-settings-types' -import { getHostDisplayLabelOverrides } from '../../../shared/host-setting-overrides' -import type { SshConnectionState, SshTarget } from '../../../shared/ssh-types' -import type { WslHostStatus } from '../../../shared/wsl-host-types' -import type { PersistedUIState } from '../../../shared/persisted-ui-state-types' -import type { WorkspaceSessionState } from '../../../shared/workspace-session/workspace-session-state-types' -import { folderWorkspaceKey } from '../../../shared/workspace-scope' -import { readAllWorktreeMetaForHost } from '../../persistence/host-qualified-worktree-meta' -import type { RuntimeStore } from '../construction/runtime-store-contract' +} from '../../../../shared/execution-host' +import { applyManualRepoOrder } from '../../../../shared/manual-repo-order' +import type { DesktopSidebarFacts } from '../../../../shared/sidebar-list/desktop-sidebar-facts' +import type { GlobalSettings } from '../../../../shared/global-settings-types' +import { getHostDisplayLabelOverrides } from '../../../../shared/host-setting-overrides' +import type { SshConnectionState, SshTarget } from '../../../../shared/ssh-types' +import type { WslHostStatus } from '../../../../shared/wsl-host-types' +import type { PersistedUIState } from '../../../../shared/persisted-ui-state-types' +import type { WorkspaceSessionState } from '../../../../shared/workspace-session/workspace-session-state-types' +import { folderWorkspaceKey } from '../../../../shared/workspace-scope' +import { readAllWorktreeMetaForHost } from '../../../persistence/host-qualified-worktree-meta' +import type { RuntimeStore } from '../../construction/runtime-store-contract' import { runtimeVisibleFolderWorkspaces, runtimeVisibleRepos -} from '../workspaces/catalog/runtime-visible-catalog' +} from '../../workspaces/catalog/runtime-visible-catalog' export type DesktopSidebarFactSources = { store: Pick< diff --git a/src/main/runtime/sidebar-inputs/mobile-project-sections-snapshot.ts b/src/main/runtime/sidebar-inputs/catalog/mobile-project-sections-snapshot.ts similarity index 91% rename from src/main/runtime/sidebar-inputs/mobile-project-sections-snapshot.ts rename to src/main/runtime/sidebar-inputs/catalog/mobile-project-sections-snapshot.ts index 4bf73533fd2..866972e4ab3 100644 --- a/src/main/runtime/sidebar-inputs/mobile-project-sections-snapshot.ts +++ b/src/main/runtime/sidebar-inputs/catalog/mobile-project-sections-snapshot.ts @@ -2,7 +2,7 @@ import { isDeepStrictEqual } from 'node:util' import type { MobileProjectSectionCatalog, MobileProjectSectionsResult -} from '../../../shared/mobile-project-sections-contract' +} from '../../../../shared/mobile-project-sections-contract' // Retain the last catalog after window close; stale grouping is better than none. let latestCatalog: MobileProjectSectionCatalog | null = null diff --git a/src/main/runtime/sidebar-inputs/orca-runtime-project-catalog.test.ts b/src/main/runtime/sidebar-inputs/catalog/orca-runtime-project-catalog.test.ts similarity index 74% rename from src/main/runtime/sidebar-inputs/orca-runtime-project-catalog.test.ts rename to src/main/runtime/sidebar-inputs/catalog/orca-runtime-project-catalog.test.ts index f0a73cdf853..998279420df 100644 --- a/src/main/runtime/sidebar-inputs/orca-runtime-project-catalog.test.ts +++ b/src/main/runtime/sidebar-inputs/catalog/orca-runtime-project-catalog.test.ts @@ -1,27 +1,27 @@ // Runs on plain Node, as orcad does: the catalog comes from main's own store, no window publishes it. import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { ProjectGroup } from '../../../shared/project-group-types' +import type { ProjectGroup } from '../../../../shared/project-group-types' -import type { Repo } from '../../../shared/repo-types' +import type { Repo } from '../../../../shared/repo-types' -import type { RuntimeClientEvent } from '../../../shared/runtime-client-events' +import type { RuntimeClientEvent } from '../../../../shared/runtime-client-events' -import { readSidebarFeedDomains } from '../../../shared/sidebar-list/sidebar-feed-domains' +import { readSidebarFeedDomains } from '../../../../shared/sidebar-list/sidebar-feed-domains' -import '../../../shared/mobile-project-sections-contract' -import { OrcaRuntimeService } from '../orca-runtime' +import '../../../../shared/mobile-project-sections-contract' +import { OrcaRuntimeService } from '../../orca-runtime' -import '../rpc/methods/rpc-method-registry' -import type { RuntimeStore } from '../construction/runtime-store-contract' +import '../../rpc/methods/rpc-method-registry' +import type { RuntimeStore } from '../../construction/runtime-store-contract' -import { requireSwitchedOn } from './require-switched-on' +import { requireSwitchedOn } from '../../construction/require-sidebar-inputs-enabled' -import { TestPhone } from './sidebar-inputs-feed.test-fixture' +import { TestPhone } from '../feed/testing/sidebar-inputs-feed.test-fixture' -import { partialRuntimeStore } from '../orca-runtime-tests/runtime-store-partial-fixture' +import { partialRuntimeStore } from '../../orca-runtime-tests/runtime-store-partial-fixture' -vi.mock('../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true })) +vi.mock('../../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true })) function group(id: string): ProjectGroup { return { diff --git a/src/main/runtime/sidebar-inputs/sidebar-project-catalog.test.ts b/src/main/runtime/sidebar-inputs/catalog/sidebar-project-catalog.test.ts similarity index 94% rename from src/main/runtime/sidebar-inputs/sidebar-project-catalog.test.ts rename to src/main/runtime/sidebar-inputs/catalog/sidebar-project-catalog.test.ts index 683fa4c9f32..3749ba7f5fa 100644 --- a/src/main/runtime/sidebar-inputs/sidebar-project-catalog.test.ts +++ b/src/main/runtime/sidebar-inputs/catalog/sidebar-project-catalog.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest' -import type { ProjectGroup } from '../../../shared/project-group-types' -import { projectHostSetupProjectionFromRepos } from '../../../shared/project-host-setup-projection' -import type { Repo } from '../../../shared/repo-types' +import type { ProjectGroup } from '../../../../shared/project-group-types' +import { projectHostSetupProjectionFromRepos } from '../../../../shared/project-host-setup-projection' +import type { Repo } from '../../../../shared/repo-types' import { readSidebarProjectCatalog, type SidebarProjectCatalogStore diff --git a/src/main/runtime/sidebar-inputs/sidebar-project-catalog.ts b/src/main/runtime/sidebar-inputs/catalog/sidebar-project-catalog.ts similarity index 71% rename from src/main/runtime/sidebar-inputs/sidebar-project-catalog.ts rename to src/main/runtime/sidebar-inputs/catalog/sidebar-project-catalog.ts index 75f69e9de39..f1a84a8d659 100644 --- a/src/main/runtime/sidebar-inputs/sidebar-project-catalog.ts +++ b/src/main/runtime/sidebar-inputs/catalog/sidebar-project-catalog.ts @@ -1,15 +1,15 @@ -import type { MobileProjectSectionCatalog } from '../../../shared/mobile-project-sections-contract' -import type { PersistedUIState } from '../../../shared/persisted-ui-state-types' +import type { MobileProjectSectionCatalog } from '../../../../shared/mobile-project-sections-contract' +import type { PersistedUIState } from '../../../../shared/persisted-ui-state-types' import { buildSidebarProjectCatalog, type PairedServerCatalog -} from '../../../shared/sidebar-list/sidebar-project-catalog' -import type { RuntimeStore } from '../construction/runtime-store-contract' +} from '../../../../shared/sidebar-list/sidebar-project-catalog' +import type { RuntimeStore } from '../../construction/runtime-store-contract' import { runtimeVisibleProjectGroups, runtimeVisibleProjectHostSetups, runtimeVisibleRepos -} from '../workspaces/catalog/runtime-visible-catalog' +} from '../../workspaces/catalog/runtime-visible-catalog' export type SidebarProjectCatalogStore = Pick< RuntimeStore, diff --git a/src/main/runtime/sidebar-inputs/sidebar-inputs-feed-log.ts b/src/main/runtime/sidebar-inputs/feed/sidebar-inputs-feed-log.ts similarity index 100% rename from src/main/runtime/sidebar-inputs/sidebar-inputs-feed-log.ts rename to src/main/runtime/sidebar-inputs/feed/sidebar-inputs-feed-log.ts diff --git a/src/main/runtime/sidebar-inputs/sidebar-inputs-feed-pages.test.ts b/src/main/runtime/sidebar-inputs/feed/sidebar-inputs-feed-pages.test.ts similarity index 96% rename from src/main/runtime/sidebar-inputs/sidebar-inputs-feed-pages.test.ts rename to src/main/runtime/sidebar-inputs/feed/sidebar-inputs-feed-pages.test.ts index 4352ef4ed23..1edbc41e6a5 100644 --- a/src/main/runtime/sidebar-inputs/sidebar-inputs-feed-pages.test.ts +++ b/src/main/runtime/sidebar-inputs/feed/sidebar-inputs-feed-pages.test.ts @@ -4,7 +4,7 @@ import { SIDEBAR_INPUTS_PAGE_MIN_BYTES, SIDEBAR_INPUTS_SCHEMA_VERSION, SIDEBAR_INPUTS_SEMANTICS_VERSION -} from '../../../shared/sidebar-list/sidebar-inputs-feed-contract' +} from '../../../../shared/sidebar-list/sidebar-inputs-feed-contract' import { feedEntityFromJson, paginateFeedChanges, diff --git a/src/main/runtime/sidebar-inputs/sidebar-inputs-feed-pages.ts b/src/main/runtime/sidebar-inputs/feed/sidebar-inputs-feed-pages.ts similarity index 97% rename from src/main/runtime/sidebar-inputs/sidebar-inputs-feed-pages.ts rename to src/main/runtime/sidebar-inputs/feed/sidebar-inputs-feed-pages.ts index 0567299dad6..ff2636e1048 100644 --- a/src/main/runtime/sidebar-inputs/sidebar-inputs-feed-pages.ts +++ b/src/main/runtime/sidebar-inputs/feed/sidebar-inputs-feed-pages.ts @@ -1,4 +1,4 @@ -import type { SidebarInputsDomainChange } from '../../../shared/sidebar-list/sidebar-inputs-feed-contract' +import type { SidebarInputsDomainChange } from '../../../../shared/sidebar-list/sidebar-inputs-feed-contract' /** One published entity: its value and that value's JSON, which the feed diffs and measures. */ export type FeedEntity = { value: unknown; json: string; bytes: number } diff --git a/src/main/runtime/sidebar-inputs/sidebar-inputs-feed-pins.ts b/src/main/runtime/sidebar-inputs/feed/sidebar-inputs-feed-pins.ts similarity index 94% rename from src/main/runtime/sidebar-inputs/sidebar-inputs-feed-pins.ts rename to src/main/runtime/sidebar-inputs/feed/sidebar-inputs-feed-pins.ts index 25fc7500d27..d7812d7fee1 100644 --- a/src/main/runtime/sidebar-inputs/sidebar-inputs-feed-pins.ts +++ b/src/main/runtime/sidebar-inputs/feed/sidebar-inputs-feed-pins.ts @@ -1,4 +1,4 @@ -import type { SidebarInputsReadResult } from '../../../shared/sidebar-list/sidebar-inputs-feed-contract' +import type { SidebarInputsReadResult } from '../../../../shared/sidebar-list/sidebar-inputs-feed-contract' /** A multi-page batch stays readable this long after its last page read. */ export const FEED_PIN_IDLE_MS = 30_000 diff --git a/src/main/runtime/sidebar-inputs/sidebar-inputs-feed.test.ts b/src/main/runtime/sidebar-inputs/feed/sidebar-inputs-feed.test.ts similarity index 83% rename from src/main/runtime/sidebar-inputs/sidebar-inputs-feed.test.ts rename to src/main/runtime/sidebar-inputs/feed/sidebar-inputs-feed.test.ts index 0583d3a351e..e5ca73f4f67 100644 --- a/src/main/runtime/sidebar-inputs/sidebar-inputs-feed.test.ts +++ b/src/main/runtime/sidebar-inputs/feed/sidebar-inputs-feed.test.ts @@ -2,12 +2,12 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import type { SidebarInputsChangedEvent, SidebarInputsReadResult -} from '../../../shared/sidebar-list/sidebar-inputs-feed-contract' -import '../../../shared/sidebar-list/sidebar-inputs-feed-installer' +} from '../../../../shared/sidebar-list/sidebar-inputs-feed-contract' +import '../../../../shared/sidebar-list/sidebar-inputs-feed-installer' import { SidebarInputsFeed } from './sidebar-inputs-feed' import { FEED_LOG_MAX_REVISIONS } from './sidebar-inputs-feed-log' import { FEED_PIN_IDLE_MS, FEED_PIN_MAX_BATCHES } from './sidebar-inputs-feed-pins' -import { TestPhone, testDomain, truthOf } from './sidebar-inputs-feed.test-fixture' +import { TestPhone, testDomain, truthOf } from './testing/sidebar-inputs-feed.test-fixture' // Three ~100 KiB entities: a snapshot of them spans two 256 KiB pages. const BIG = 'x'.repeat(100 * 1024) @@ -127,26 +127,6 @@ describe('sidebar inputs feed', () => { expect(phone.view()).toEqual(host.truth()) }) - it('serves two phones from one session, which ends with the last of them', async () => { - const host = makeHost() - const first = new TestPhone(host.feed, 'conn-1') - const second = new TestPhone(host.feed, 'conn-2') - first.refresh() - second.refresh() - await Promise.all([first.settle(), second.settle()]) - expect(host.rows.reads()).toBe(1) - - first.disconnect() - host.rows.set('a', 2) - await flush() - second.notice(host.lastEvent()) - await second.settle() - expect(second.view()).toEqual(host.truth()) - - second.disconnect() - expect(host.rows.watchers()).toBe(0) - }) - it('replaces everything after a runtime restart, whose generation is new', async () => { const host = makeHost() const phone = new TestPhone(host.feed, 'conn-1') @@ -201,41 +181,6 @@ describe('sidebar inputs feed', () => { expect(phone.view().rows).toEqual({ a: 1 }) }) - it('re-reads a failed domain on the next read without retrying on its own', async () => { - const host = makeHost() - const phone = new TestPhone(host.feed, 'conn-1') - phone.refresh() - await phone.settle() - host.rows.fail(true) - host.rows.set('a', 2) - await flush() - const failedReads = host.rows.reads() - await vi.advanceTimersByTimeAsync(10_000) - expect(host.rows.reads()).toBe(failedReads) - - host.rows.fail(false) - phone.refresh() - await phone.settle() - expect(host.rows.reads()).toBe(failedReads + 1) - expect(phone.view()).toEqual(host.truth()) - }) - - it('re-reads a failed domain with the next flush another domain causes', async () => { - const host = makeHost() - const phone = new TestPhone(host.feed, 'conn-1') - phone.refresh() - await phone.settle() - host.rows.fail(true) - host.rows.set('a', 2) - await flush() - host.rows.fail(false) - host.view.set('sort', 'recent') - await flush() - phone.notice(host.lastEvent()) - await phone.settle() - expect(phone.view()).toEqual(host.truth()) - }) - it('bounds pinned batches, evicting the oldest', async () => { const host = makeHost({ a: BIG, b: BIG, c: BIG }) host.feed.acquire('conn-1') diff --git a/src/main/runtime/sidebar-inputs/sidebar-inputs-feed.ts b/src/main/runtime/sidebar-inputs/feed/sidebar-inputs-feed.ts similarity index 99% rename from src/main/runtime/sidebar-inputs/sidebar-inputs-feed.ts rename to src/main/runtime/sidebar-inputs/feed/sidebar-inputs-feed.ts index f419c881664..782664780c5 100644 --- a/src/main/runtime/sidebar-inputs/sidebar-inputs-feed.ts +++ b/src/main/runtime/sidebar-inputs/feed/sidebar-inputs-feed.ts @@ -7,7 +7,7 @@ import { type SidebarInputsChangedEvent, type SidebarInputsReadParams, type SidebarInputsReadResult -} from '../../../shared/sidebar-list/sidebar-inputs-feed-contract' +} from '../../../../shared/sidebar-list/sidebar-inputs-feed-contract' import { feedEntityFromJson, paginateFeedChanges, diff --git a/src/main/runtime/sidebar-inputs/sidebar-inputs-feed.test-fixture.ts b/src/main/runtime/sidebar-inputs/feed/testing/sidebar-inputs-feed.test-fixture.ts similarity index 96% rename from src/main/runtime/sidebar-inputs/sidebar-inputs-feed.test-fixture.ts rename to src/main/runtime/sidebar-inputs/feed/testing/sidebar-inputs-feed.test-fixture.ts index 8cb4904671c..a3598c8c04d 100644 --- a/src/main/runtime/sidebar-inputs/sidebar-inputs-feed.test-fixture.ts +++ b/src/main/runtime/sidebar-inputs/feed/testing/sidebar-inputs-feed.test-fixture.ts @@ -1,7 +1,7 @@ import type { SidebarInputsChangedEvent, SidebarInputsReadResult -} from '../../../shared/sidebar-list/sidebar-inputs-feed-contract' +} from '../../../../../shared/sidebar-list/sidebar-inputs-feed-contract' import { INITIAL_SIDEBAR_INPUTS_FEED_STATE, refreshSidebarInputs, @@ -10,12 +10,12 @@ import { type SidebarInputsFeedRequest, type SidebarInputsFeedState, type SidebarInputsFeedStep -} from '../../../shared/sidebar-list/sidebar-inputs-feed-installer' +} from '../../../../../shared/sidebar-list/sidebar-inputs-feed-installer' import type { SidebarInputsFeed, SidebarInputsFeedChange, SidebarInputsFeedDomain -} from './sidebar-inputs-feed' +} from '../sidebar-inputs-feed' /** A domain whose entities a test edits; counts its reads and live watchers. */ export function testDomain(name: string, initial: Record = {}) { diff --git a/src/main/runtime/sidebar-inputs/orca-runtime-sidebar-inputs-feed.test.ts b/src/main/runtime/sidebar-inputs/orca-runtime-sidebar-inputs-feed.test.ts index 72934993a12..10241c9befa 100644 --- a/src/main/runtime/sidebar-inputs/orca-runtime-sidebar-inputs-feed.test.ts +++ b/src/main/runtime/sidebar-inputs/orca-runtime-sidebar-inputs-feed.test.ts @@ -2,8 +2,8 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import type { RuntimeClientEvent } from '../../../shared/runtime-client-events' import { OrcaRuntimeService } from '../orca-runtime' -import { requireSwitchedOn } from './require-switched-on' -import { TestPhone } from './sidebar-inputs-feed.test-fixture' +import { requireSwitchedOn } from '../construction/require-sidebar-inputs-enabled' +import { TestPhone } from './feed/testing/sidebar-inputs-feed.test-fixture' vi.mock('../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true })) diff --git a/src/main/runtime/sidebar-inputs/orca-runtime-sidebar-temporal.ts b/src/main/runtime/sidebar-inputs/orca-runtime-sidebar-temporal.ts index 78c56efe1d5..2609f99f409 100644 --- a/src/main/runtime/sidebar-inputs/orca-runtime-sidebar-temporal.ts +++ b/src/main/runtime/sidebar-inputs/orca-runtime-sidebar-temporal.ts @@ -1,6 +1,6 @@ import { getRepoRegistrationHostIds } from '../../../shared/repo-host-identity' import { isRemoteRuntimePtyId } from '../../../shared/remote-runtime/remote-runtime-pty-id' -import { OrcaRuntimeWithDetectedCheckoutsAndLiveContent } from './orca-runtime-detected-checkouts-live-content' +import { OrcaRuntimeWithDetectedCheckoutsAndLiveContent } from './workspace-facts/orca-runtime-detected-checkouts-live-content' import type { OrcaRuntimeWithAgentTransitions } from '../construction/orca-runtime-agent-transitions' import { ORCA_SIDEBAR_INPUTS_IS_MAIN } from '../../../shared/sidebar-inputs-switch' import { DEFAULT_HIDE_SLEEPING_WORKSPACES } from '../../../shared/constants' @@ -12,15 +12,18 @@ import { type ExecutionHostId } from '../../../shared/execution-host' import type { SidebarTemporalSnapshot } from '../../../shared/sidebar-list/sidebar-temporal-snapshot' -import type { WorkspaceRowsProducer } from './workspace-rows-producer' -import { SidebarRetentionOwner, type SidebarRetentionCandidates } from './sidebar-retention-owner' -import type { AgentStatusStoreView } from './workspace-activity-facts-producer' -import { SortStampsProducer } from './sort-stamps-producer' -import { writeUnreadFlag } from './sort-stamp-records' -import { WorkspaceViewers } from './workspace-viewers' +import type { WorkspaceRowsProducer } from './workspace-rows/workspace-rows-producer' +import { + SidebarRetentionOwner, + type SidebarRetentionCandidates +} from './temporal/sidebar-retention-owner' +import type { AgentStatusStoreView } from './workspace-facts/workspace-activity-facts-producer' +import { SortStampsProducer } from './temporal/sort-stamps-producer' +import { writeUnreadFlag } from '../workspaces/metadata/workspace-activity-records' +import { WorkspaceViewers } from './temporal/workspace-viewers' import { clientRaisesUnreadFlagItself } from '../../../shared/workspace-unread-raise-capability' import type { RuntimeCapability } from '../../../shared/protocol-version' -import { TerminalUseProducer } from './terminal-use-producer' +import { TerminalUseProducer } from './temporal/terminal-use-producer' import { parseWorkspaceKey } from '../../../shared/workspace-scope' import { getRepoIdFromWorktreeId, worktreeIdentityKey } from '../../../shared/worktree/id' import { diff --git a/src/main/runtime/sidebar-inputs/repo-icon-data-urls.test.ts b/src/main/runtime/sidebar-inputs/repo-icons/repo-icon-data-urls.test.ts similarity index 60% rename from src/main/runtime/sidebar-inputs/repo-icon-data-urls.test.ts rename to src/main/runtime/sidebar-inputs/repo-icons/repo-icon-data-urls.test.ts index 69c65af6928..fb397039a24 100644 --- a/src/main/runtime/sidebar-inputs/repo-icon-data-urls.test.ts +++ b/src/main/runtime/sidebar-inputs/repo-icons/repo-icon-data-urls.test.ts @@ -1,9 +1,9 @@ import { describe, expect, it, vi } from 'vitest' -import type { RepoIcon } from '../../../shared/repo-icon' -import type { Repo } from '../../../shared/repo-types' +import type { RepoIcon } from '../../../../shared/repo-icon' +import type { Repo } from '../../../../shared/repo-types' import { RepoIconDataUrls, repoIconId, type RepoIconPngEncoder } from './repo-icon-data-urls' import type { RepoIconFetch } from './repo-icon-remote-fetch' -import { pngHeader } from './repo-icon-image-fixture' +import { pngHeader } from './testing/repo-icon-image-fixture' const AVATAR: RepoIcon = { type: 'image', @@ -34,42 +34,6 @@ function setup( return { icons, fetch, advance: (ms: number) => (now += ms) } } -describe('RepoIconDataUrls caps', () => { - it('runs at most four fetches at once', async () => { - const releases: (() => void)[] = [] - let active = 0 - let peak = 0 - const avatars = Array.from({ length: 10 }, (_, index): RepoIcon => ({ - ...AVATAR, - src: `https://github.com/owner${index}.png` - })) - const { icons } = setup( - avatars.map((icon, index) => repo(`r${index}`, icon)), - { - fetch: () => { - active += 1 - peak = Math.max(peak, active) - return new Promise((resolve) => - releases.push(() => { - active -= 1 - resolve(pngResponse()) - }) - ) - } - } - ) - - const reply = icons.read(avatars.map((icon) => repoIconId(icon)!)) - for (let settled = 0; settled < avatars.length; settled += 1) { - await vi.waitFor(() => expect(releases.length).toBeGreaterThan(settled)) - releases[settled]() - } - - expect((await reply).icons.every((icon) => icon.dataUrl !== null)).toBe(true) - expect(peak).toBe(4) - }) -}) - describe('RepoIconDataUrls cache', () => { it('retries a failed fetch after five minutes, a success only after an hour', async () => { let fail = true diff --git a/src/main/runtime/sidebar-inputs/repo-icon-data-urls.ts b/src/main/runtime/sidebar-inputs/repo-icons/repo-icon-data-urls.ts similarity index 95% rename from src/main/runtime/sidebar-inputs/repo-icon-data-urls.ts rename to src/main/runtime/sidebar-inputs/repo-icons/repo-icon-data-urls.ts index 3616ca7ddad..03af6dc31b6 100644 --- a/src/main/runtime/sidebar-inputs/repo-icon-data-urls.ts +++ b/src/main/runtime/sidebar-inputs/repo-icons/repo-icon-data-urls.ts @@ -1,18 +1,18 @@ import { createHash } from 'node:crypto' -import type { RepoIcon } from '../../../shared/repo-icon' -import type { Repo } from '../../../shared/repo-types' -import { readRasterImageDimensions } from '../../../shared/file-preview/raster-image-dimensions' +import type { RepoIcon } from '../../../../shared/repo-icon' +import type { Repo } from '../../../../shared/repo-types' +import { readRasterImageDimensions } from '../../../../shared/file-preview/raster-image-dimensions' import { MAX_REPO_ICON_DATA_URL_BYTES, repoIconFeedKey, type RepoIconDataUrlsReply -} from '../../../shared/sidebar-list/repo-icon-data-urls-contract' +} from '../../../../shared/sidebar-list/repo-icon-data-urls-contract' import { fetchRemoteRepoIcon, type FetchedRepoIcon, type RepoIconFetch } from './repo-icon-remote-fetch' -import type { RuntimeDesktopSurface } from '../construction/runtime-desktop-surface' +import type { RuntimeDesktopSurface } from '../../construction/runtime-desktop-surface' export type RepoIconPngEncoder = NonNullable diff --git a/src/main/runtime/sidebar-inputs/repo-icon-remote-fetch.ts b/src/main/runtime/sidebar-inputs/repo-icons/repo-icon-remote-fetch.ts similarity index 96% rename from src/main/runtime/sidebar-inputs/repo-icon-remote-fetch.ts rename to src/main/runtime/sidebar-inputs/repo-icons/repo-icon-remote-fetch.ts index 525672eb455..e63f430b3b8 100644 --- a/src/main/runtime/sidebar-inputs/repo-icon-remote-fetch.ts +++ b/src/main/runtime/sidebar-inputs/repo-icons/repo-icon-remote-fetch.ts @@ -1,4 +1,4 @@ -import { isKnownRasterImageMimeType } from '../../../shared/file-preview/raster-image-preview-limits' +import { isKnownRasterImageMimeType } from '../../../../shared/file-preview/raster-image-preview-limits' export const REPO_ICON_FETCH_MAX_BYTES = 64 * 1024 export const REPO_ICON_FETCH_MAX_REDIRECTS = 3 diff --git a/src/main/runtime/sidebar-inputs/repo-icon-image-fixture.ts b/src/main/runtime/sidebar-inputs/repo-icons/testing/repo-icon-image-fixture.ts similarity index 100% rename from src/main/runtime/sidebar-inputs/repo-icon-image-fixture.ts rename to src/main/runtime/sidebar-inputs/repo-icons/testing/repo-icon-image-fixture.ts diff --git a/src/main/runtime/sidebar-inputs/sidebar-inputs-feed-domains.ts b/src/main/runtime/sidebar-inputs/sidebar-inputs-feed-domains.ts index ff0304fd5fa..a9a145b663a 100644 --- a/src/main/runtime/sidebar-inputs/sidebar-inputs-feed-domains.ts +++ b/src/main/runtime/sidebar-inputs/sidebar-inputs-feed-domains.ts @@ -12,15 +12,15 @@ import { } from '../../persistence/profile-save-domains' import type { PersistedUIState } from '../../../shared/persisted-ui-state-types' import type { OrcaRuntimeWithSidebarTemporal } from './orca-runtime-sidebar-temporal' -import type { PairedServerRowsProducer } from './paired-server-rows-producer' +import type { PairedServerRowsProducer } from './workspace-rows/paired-server-rows-producer' import type { WorkspaceLifecycleQueue } from '../workspaces/lifecycle/workspace-lifecycle-queue' -import type { WorkspaceRowsProducer } from './workspace-rows-producer' -import type { RepoIconDataUrls } from './repo-icon-data-urls' -import type { SidebarInputsFeedDomain } from './sidebar-inputs-feed' -import { readDesktopSidebarFacts } from './desktop-sidebar-facts' +import type { WorkspaceRowsProducer } from './workspace-rows/workspace-rows-producer' +import type { RepoIconDataUrls } from './repo-icons/repo-icon-data-urls' +import type { SidebarInputsFeedDomain } from './feed/sidebar-inputs-feed' +import { readDesktopSidebarFacts } from './catalog/desktop-sidebar-facts' import { readStoreInstallationId } from '../hosts/platform-probe/host-descriptor' import { getCanonicalUserDataPath } from '../../persistence/loading-store/user-data-path' -import { readSidebarProjectCatalog } from './sidebar-project-catalog' +import { readSidebarProjectCatalog } from './catalog/sidebar-project-catalog' import { buildPairedServerReviewFacts, buildWorkspaceReviewFacts diff --git a/src/main/runtime/sidebar-inputs/orca-runtime-closed-tab-retention.test.ts b/src/main/runtime/sidebar-inputs/temporal/orca-runtime-closed-tab-retention.test.ts similarity index 90% rename from src/main/runtime/sidebar-inputs/orca-runtime-closed-tab-retention.test.ts rename to src/main/runtime/sidebar-inputs/temporal/orca-runtime-closed-tab-retention.test.ts index 2aa077a1cc8..3c8d6281719 100644 --- a/src/main/runtime/sidebar-inputs/orca-runtime-closed-tab-retention.test.ts +++ b/src/main/runtime/sidebar-inputs/temporal/orca-runtime-closed-tab-retention.test.ts @@ -1,12 +1,12 @@ // Runs on plain Node, as orcad does: main's "Hide sleeping" retention reads the runtime's own facts. import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { OrcaRuntimeService } from '../orca-runtime' -import type { RuntimeStore } from '../construction/runtime-store-contract' -import type { PersistedUIState } from '../../../shared/persisted-ui-state-types' -import type { ResolvedWorktreeSnapshot } from '../workspaces/catalog/runtime-resolved-worktree-cache' -import type { ResolvedWorktree } from '../workspaces/catalog/runtime-worktree-path-identity' +import { OrcaRuntimeService } from '../../orca-runtime' +import type { RuntimeStore } from '../../construction/runtime-store-contract' +import type { PersistedUIState } from '../../../../shared/persisted-ui-state-types' +import type { ResolvedWorktreeSnapshot } from '../../workspaces/catalog/runtime-resolved-worktree-cache' +import type { ResolvedWorktree } from '../../workspaces/catalog/runtime-worktree-path-identity' -vi.mock('../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true })) +vi.mock('../../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true })) const repo = { id: 'repo-1', path: '/r', displayName: 'r', badgeColor: 'blue', addedAt: 1 } const WT = 'repo-1::/r/a' diff --git a/src/main/runtime/sidebar-inputs/orca-runtime-sort-stamps.test.ts b/src/main/runtime/sidebar-inputs/temporal/orca-runtime-sort-stamps.test.ts similarity index 87% rename from src/main/runtime/sidebar-inputs/orca-runtime-sort-stamps.test.ts rename to src/main/runtime/sidebar-inputs/temporal/orca-runtime-sort-stamps.test.ts index d98754c6e70..cfa81181c6e 100644 --- a/src/main/runtime/sidebar-inputs/orca-runtime-sort-stamps.test.ts +++ b/src/main/runtime/sidebar-inputs/temporal/orca-runtime-sort-stamps.test.ts @@ -1,22 +1,22 @@ // Runs on plain Node, as orcad does: a paired server stamps its own rows through this same wiring. import { describe, expect, it, vi } from 'vitest' -import { HEADLESS_RUNTIME_WINDOW_ID } from '../../../shared/runtime-session-contracts' -import type { WorktreeMeta } from '../../../shared/worktree/meta-types' -import type { FolderWorkspace } from '../../../shared/folder-workspaces/folder-workspace-types' -import { AgentHookServer } from '../../agent-hooks/server/agent-hook-server' -import { OrcaRuntimeService } from '../orca-runtime' -import { folderWorkspaceKey } from '../../../shared/workspace-scope' +import { HEADLESS_RUNTIME_WINDOW_ID } from '../../../../shared/runtime-session-contracts' +import type { WorktreeMeta } from '../../../../shared/worktree/meta-types' +import type { FolderWorkspace } from '../../../../shared/folder-workspaces/folder-workspace-types' +import { AgentHookServer } from '../../../agent-hooks/server/agent-hook-server' +import { OrcaRuntimeService } from '../../orca-runtime' +import { folderWorkspaceKey } from '../../../../shared/workspace-scope' import { hostWorktreeTarget, type HostWorktreeTarget -} from '../../../shared/worktree/host-qualified-identity' +} from '../../../../shared/worktree/host-qualified-identity' import { partialRuntimeStore, storeRepo, storeWorktreeMeta -} from '../orca-runtime-tests/runtime-store-partial-fixture' +} from '../../orca-runtime-tests/runtime-store-partial-fixture' -vi.mock('../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true })) +vi.mock('../../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true })) const WT = 'repo-1::/tmp/worktree-a' const FOLDER_ID = 'fw-1' diff --git a/src/main/runtime/sidebar-inputs/orca-runtime-terminal-use.test.ts b/src/main/runtime/sidebar-inputs/temporal/orca-runtime-terminal-use.test.ts similarity index 67% rename from src/main/runtime/sidebar-inputs/orca-runtime-terminal-use.test.ts rename to src/main/runtime/sidebar-inputs/temporal/orca-runtime-terminal-use.test.ts index 87c015fd692..96077a93e50 100644 --- a/src/main/runtime/sidebar-inputs/orca-runtime-terminal-use.test.ts +++ b/src/main/runtime/sidebar-inputs/temporal/orca-runtime-terminal-use.test.ts @@ -1,22 +1,22 @@ // Runs on plain Node, as orcad does: the host that owns a workspace records its terminal use. import { describe, expect, it, vi } from 'vitest' -import { HEADLESS_RUNTIME_WINDOW_ID } from '../../../shared/runtime-session-contracts' -import type { WorktreeMeta } from '../../../shared/worktree/meta-types' +import { HEADLESS_RUNTIME_WINDOW_ID } from '../../../../shared/runtime-session-contracts' +import type { WorktreeMeta } from '../../../../shared/worktree/meta-types' import { WORKSPACE_CLEANUP_IDLE_MS, getPersistedWorkspaceCleanupActivityAt, isWorkspaceOldForCleanup -} from '../../../shared/workspace-cleanup/workspace-cleanup' -import { OrcaRuntimeService } from '../orca-runtime' -import type { HostWorktreeTarget } from '../../../shared/worktree/host-qualified-identity' +} from '../../../../shared/workspace-cleanup/workspace-cleanup' +import { OrcaRuntimeService } from '../../orca-runtime' +import type { HostWorktreeTarget } from '../../../../shared/worktree/host-qualified-identity' import { partialRuntimeStore, storeRepo, storeWorktreeMeta, type PartialRuntimeStore -} from '../orca-runtime-tests/runtime-store-partial-fixture' +} from '../../orca-runtime-tests/runtime-store-partial-fixture' -vi.mock('../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true })) +vi.mock('../../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true })) const WT = 'repo-1::/tmp/phone-only' const DAY_MS = 24 * 60 * 60 * 1000 @@ -24,7 +24,6 @@ const DAY_MS = 24 * 60 * 60 * 1000 function createHeadlessRuntime(ptyId = 'pty-1') { // Untouched for 45 days: no agent ran, so no Recent stamp moved. const meta: Record = { [WT]: storeWorktreeMeta({ lastActivityAt: 1 }) } - const writes: Partial[] = [] const repo = storeRepo({ id: 'repo-1', path: '/tmp/repo-1', connectionId: null }) const store: PartialRuntimeStore = { // An unstamped row's writes resolve their host from its repo's only registration. @@ -34,7 +33,6 @@ function createHeadlessRuntime(ptyId = 'pty-1') { getWorktreeMeta: (id: string) => meta[id], getAllWorktreeMeta: () => meta, setWorktreeMeta: ({ id }: HostWorktreeTarget, updates: Partial) => { - writes.push(updates) meta[id] = { ...meta[id], ...updates } return meta[id] } @@ -54,7 +52,7 @@ function createHeadlessRuntime(ptyId = 'pty-1') { } ] }) - return { runtime, meta, writes } + return { runtime, meta } } describe('host-written terminal use', () => { @@ -81,22 +79,4 @@ describe('host-written terminal use', () => { vi.useRealTimers() } }) - - it('app-written launch input never counts', () => { - const launch = createHeadlessRuntime() - launch.runtime.terminalRunFacts.recordInput('pty-1', 'launch', 'claude\r', 1_000) - expect(launch.writes).toEqual([]) - }) - - it("a paired server's terminal is not this host's to record", () => { - const mirrored = createHeadlessRuntime('remote:server-pty') - mirrored.runtime.terminalRunFacts.recordInput('remote:server-pty', 'driving', 'ls\r', 1_000) - expect(mirrored.writes).toEqual([]) - }) - - it('output never counts as use', () => { - const { runtime, writes } = createHeadlessRuntime() - runtime.onPtyData('pty-1', 'lots of output\r\n', 1) - expect(writes.filter((w) => 'lastTerminalUseAt' in w)).toEqual([]) - }) }) diff --git a/src/main/runtime/sidebar-inputs/orca-runtime-windowless-terminal-activity.ts b/src/main/runtime/sidebar-inputs/temporal/orca-runtime-windowless-terminal-activity.ts similarity index 76% rename from src/main/runtime/sidebar-inputs/orca-runtime-windowless-terminal-activity.ts rename to src/main/runtime/sidebar-inputs/temporal/orca-runtime-windowless-terminal-activity.ts index c3da1236aa6..521c4e85757 100644 --- a/src/main/runtime/sidebar-inputs/orca-runtime-windowless-terminal-activity.ts +++ b/src/main/runtime/sidebar-inputs/temporal/orca-runtime-windowless-terminal-activity.ts @@ -1,23 +1,26 @@ -import { OrcaRuntimeWithWslMoveTerminalFacts } from '../workspaces/metadata/runtime-wsl-move-terminal-facts' -import { HEADLESS_RUNTIME_WINDOW_ID } from '../../../shared/runtime-session-contracts' -import { ORCA_SIDEBAR_INPUTS_IS_MAIN } from '../../../shared/sidebar-inputs-switch' -import { isRemoteRuntimePtyId } from '../../../shared/remote-runtime/remote-runtime-pty-id' -import type { RuntimeTerminalSplit } from '../../../shared/runtime-terminal-contracts' -import { parseExecutionHostId } from '../../../shared/execution-host' -import { isRestoreSpawnIntent } from '../../../shared/terminal/pty/admission/spawn-admission-contract' -import { parseWorkspaceKey } from '../../../shared/workspace-scope' -import { getRepoIdFromWorktreeId } from '../../../shared/worktree/id' -import { readWorkspaceRecord, writeWorkspaceRecord } from './sort-stamp-records' -import { createKeyedTrailingEdgeCoalescer } from '../client/events/keyed-trailing-edge-coalescer' +import { OrcaRuntimeWithWslMoveTerminalFacts } from '../../workspaces/metadata/runtime-wsl-move-terminal-facts' +import { HEADLESS_RUNTIME_WINDOW_ID } from '../../../../shared/runtime-session-contracts' +import { ORCA_SIDEBAR_INPUTS_IS_MAIN } from '../../../../shared/sidebar-inputs-switch' +import { isRemoteRuntimePtyId } from '../../../../shared/remote-runtime/remote-runtime-pty-id' +import type { RuntimeTerminalSplit } from '../../../../shared/runtime-terminal-contracts' +import { parseExecutionHostId } from '../../../../shared/execution-host' +import { isRestoreSpawnIntent } from '../../../../shared/terminal/pty/admission/spawn-admission-contract' +import { parseWorkspaceKey } from '../../../../shared/workspace-scope' +import { getRepoIdFromWorktreeId } from '../../../../shared/worktree/id' +import { + readWorkspaceRecord, + writeWorkspaceRecord +} from '../../workspaces/metadata/workspace-activity-records' +import { createKeyedTrailingEdgeCoalescer } from '../../client/events/keyed-trailing-edge-coalescer' import { agentPaneWorkspace, type AgentPaneWorkspace -} from '../../agent-hooks/observations/agent-transition-detector' -import type { RuntimePtyWorktreeRecord } from '../terminal/records/runtime-terminal-state-records' +} from '../../../agent-hooks/observations/agent-transition-detector' +import type { RuntimePtyWorktreeRecord } from '../../terminal/records/runtime-terminal-state-records' import { isWslMoveProjectBlocked, wslMoveProjectRefForWorkspace -} from '../../persistence/moving-wsl-projects/quiescence/wsl-move-scope-guard' +} from '../../../persistence/moving-wsl-projects/quiescence/wsl-move-scope-guard' type Runtime = OrcaRuntimeWithWslMoveTerminalFacts diff --git a/src/main/runtime/sidebar-inputs/orca-runtime-workspace-unread.test.ts b/src/main/runtime/sidebar-inputs/temporal/orca-runtime-workspace-unread.test.ts similarity index 87% rename from src/main/runtime/sidebar-inputs/orca-runtime-workspace-unread.test.ts rename to src/main/runtime/sidebar-inputs/temporal/orca-runtime-workspace-unread.test.ts index 483a8f12c04..a4fe58ddac1 100644 --- a/src/main/runtime/sidebar-inputs/orca-runtime-workspace-unread.test.ts +++ b/src/main/runtime/sidebar-inputs/temporal/orca-runtime-workspace-unread.test.ts @@ -1,15 +1,15 @@ // Runs on plain Node, as orcad does: a host with no window raises and clears its own unread flags. import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { HEADLESS_RUNTIME_WINDOW_ID } from '../../../shared/runtime-session-contracts' -import { folderWorkspaceKey } from '../../../shared/workspace-scope' -import { AgentHookServer } from '../../agent-hooks/server/agent-hook-server' -import { OrcaRuntimeService } from '../orca-runtime' -import { RpcDispatcher } from '../rpc/dispatcher' -import type { RpcDispatchStreamingOptions } from '../rpc/dispatch/dispatcher-stream-options' -import { SESSION_TAB_METHODS } from '../rpc/methods/session-tabs/session-tabs' -import { SIDEBAR_INPUT_METHODS } from '../rpc/methods/sidebar-inputs/sidebar-inputs' -import type { HostWorktreeTarget } from '../../../shared/worktree/host-qualified-identity' +import { HEADLESS_RUNTIME_WINDOW_ID } from '../../../../shared/runtime-session-contracts' +import { folderWorkspaceKey } from '../../../../shared/workspace-scope' +import { AgentHookServer } from '../../../agent-hooks/server/agent-hook-server' +import { OrcaRuntimeService } from '../../orca-runtime' +import { RpcDispatcher } from '../../rpc/dispatcher' +import type { RpcDispatchStreamingOptions } from '../../rpc/dispatch/dispatcher-stream-options' +import { SESSION_TAB_METHODS } from '../../rpc/methods/session-tabs/session-tabs' +import { SIDEBAR_INPUT_METHODS } from '../../rpc/methods/sidebar-inputs/sidebar-inputs' +import type { HostWorktreeTarget } from '../../../../shared/worktree/host-qualified-identity' import { partialRuntimeStore, storeFolderWorkspace, @@ -17,11 +17,11 @@ import { storeRepo, storeWorktreeMeta, type PartialRuntimeStore -} from '../orca-runtime-tests/runtime-store-partial-fixture' -import type { WorktreeMeta } from '../../../shared/worktree/meta-types' -import type { FolderWorkspace } from '../../../shared/folder-workspaces/folder-workspace-types' +} from '../../orca-runtime-tests/runtime-store-partial-fixture' +import type { WorktreeMeta } from '../../../../shared/worktree/meta-types' +import type { FolderWorkspace } from '../../../../shared/folder-workspaces/folder-workspace-types' -vi.mock('../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true })) +vi.mock('../../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true })) const WT = 'repo-1::/tmp/worktree-a' const SSH_WT = 'repo-ssh::/home/me/worktree-b' diff --git a/src/main/runtime/sidebar-inputs/sidebar-retention-owner.test.ts b/src/main/runtime/sidebar-inputs/temporal/sidebar-retention-owner.test.ts similarity index 92% rename from src/main/runtime/sidebar-inputs/sidebar-retention-owner.test.ts rename to src/main/runtime/sidebar-inputs/temporal/sidebar-retention-owner.test.ts index 6947e928472..02b08b4604b 100644 --- a/src/main/runtime/sidebar-inputs/sidebar-retention-owner.test.ts +++ b/src/main/runtime/sidebar-inputs/temporal/sidebar-retention-owner.test.ts @@ -1,7 +1,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { Worktree } from '../../../shared/worktree/types' -import { getWorktreeHostIdentity } from '../../../shared/worktree/host-qualified-identity' -import { SidebarClock } from './sidebar-clock' +import type { Worktree } from '../../../../shared/worktree/types' +import { getWorktreeHostIdentity } from '../../../../shared/worktree/host-qualified-identity' +import { SidebarClock } from '../sidebar-clock' import { SidebarRetentionOwner } from './sidebar-retention-owner' function worktree(id: string, overrides: Partial = {}): Worktree { diff --git a/src/main/runtime/sidebar-inputs/sidebar-retention-owner.ts b/src/main/runtime/sidebar-inputs/temporal/sidebar-retention-owner.ts similarity index 94% rename from src/main/runtime/sidebar-inputs/sidebar-retention-owner.ts rename to src/main/runtime/sidebar-inputs/temporal/sidebar-retention-owner.ts index 61944831894..81ff76d2026 100644 --- a/src/main/runtime/sidebar-inputs/sidebar-retention-owner.ts +++ b/src/main/runtime/sidebar-inputs/temporal/sidebar-retention-owner.ts @@ -1,17 +1,17 @@ -import { ProducerRevision } from './producer-revision' +import { ProducerRevision } from '../producer-revision' import { getWorktreeIdFromHostIdentity, type HostScopedWorktreeKey -} from '../../../shared/worktree/host-qualified-identity' +} from '../../../../shared/worktree/host-qualified-identity' import { createSleepingSweepRetentionState, updateSleepingSweepRetention -} from '../../../shared/sidebar-list/sleeping-sweep-retention' +} from '../../../../shared/sidebar-list/sleeping-sweep-retention' import type { SidebarRetention, SidebarTemporalSnapshot -} from '../../../shared/sidebar-list/sidebar-temporal-snapshot' -import type { SidebarClock } from './sidebar-clock' +} from '../../../../shared/sidebar-list/sidebar-temporal-snapshot' +import type { SidebarClock } from '../sidebar-clock' /** This host's activity by bare id, read for each listed row: its session names no host. */ export type SidebarRetentionCandidates = { diff --git a/src/main/runtime/sidebar-inputs/sort-stamps-producer.test.ts b/src/main/runtime/sidebar-inputs/temporal/sort-stamps-producer.test.ts similarity index 91% rename from src/main/runtime/sidebar-inputs/sort-stamps-producer.test.ts rename to src/main/runtime/sidebar-inputs/temporal/sort-stamps-producer.test.ts index d6d91090e99..90449414a14 100644 --- a/src/main/runtime/sidebar-inputs/sort-stamps-producer.test.ts +++ b/src/main/runtime/sidebar-inputs/temporal/sort-stamps-producer.test.ts @@ -1,23 +1,23 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { AgentHookServer } from '../../agent-hooks/server/agent-hook-server' -import type { AgentStatusStoreView } from './workspace-activity-facts-producer' +import { AgentHookServer } from '../../../agent-hooks/server/agent-hook-server' +import type { AgentStatusStoreView } from '../workspace-facts/workspace-activity-facts-producer' -import '../../../shared/agent-status/contracts/agent-status-subject' -import type { RuntimeClientEvent } from '../../../shared/runtime-client-events' -import type { TerminalSideEffectFact } from '../../../shared/terminal/output/terminal-side-effect-facts' -import type { ExecutionHostId } from '../../../shared/execution-host' -import type { Repo } from '../../../shared/repo-types' -import '../../../shared/sidebar-list/sort-stamps' -import type { SmartStampFields } from '../../../shared/sidebar-list/sort-stamps' -import '../../../shared/agent-status/lifecycle/agent-transitions.test-fixture' -import type { AgentTransitionStep } from '../../../shared/agent-status/lifecycle/agent-transitions.test-fixture' -import { AgentTransitionDetector } from '../../agent-hooks/observations/agent-transition-detector' -import '../../../shared/sidebar-list/stamp-order' +import '../../../../shared/agent-status/contracts/agent-status-subject' +import type { RuntimeClientEvent } from '../../../../shared/runtime-client-events' +import type { TerminalSideEffectFact } from '../../../../shared/terminal/output/terminal-side-effect-facts' +import type { ExecutionHostId } from '../../../../shared/execution-host' +import type { Repo } from '../../../../shared/repo-types' +import '../../../../shared/sidebar-list/sort-stamps' +import type { SmartStampFields } from '../../../../shared/sidebar-list/sort-stamps' +import '../../../../shared/agent-status/lifecycle/agent-transitions.test-fixture' +import type { AgentTransitionStep } from '../../../../shared/agent-status/lifecycle/agent-transitions.test-fixture' +import { AgentTransitionDetector } from '../../../agent-hooks/observations/agent-transition-detector' +import '../../../../shared/sidebar-list/stamp-order' import { SortStampsProducer, type StoredTierEvidence } from './sort-stamps-producer' -import type { SortStampsStore } from './sort-stamp-records' +import type { SortStampsStore } from '../../workspaces/metadata/workspace-activity-records' -vi.mock('../../telemetry/client', () => ({ track: vi.fn() })) -vi.mock('../../telemetry/cohort-classifier', () => ({ getCohortAtEmit: vi.fn(() => ({})) })) +vi.mock('../../../telemetry/client', () => ({ track: vi.fn() })) +vi.mock('../../../telemetry/cohort-classifier', () => ({ getCohortAtEmit: vi.fn(() => ({})) })) const WT = 'repo-1::/tmp/a' const FOLDER_ID = '11111111-1111-4111-8111-111111111111' diff --git a/src/main/runtime/sidebar-inputs/sort-stamps-producer.ts b/src/main/runtime/sidebar-inputs/temporal/sort-stamps-producer.ts similarity index 95% rename from src/main/runtime/sidebar-inputs/sort-stamps-producer.ts rename to src/main/runtime/sidebar-inputs/temporal/sort-stamps-producer.ts index 62ac2330c75..114a69ca6fd 100644 --- a/src/main/runtime/sidebar-inputs/sort-stamps-producer.ts +++ b/src/main/runtime/sidebar-inputs/temporal/sort-stamps-producer.ts @@ -1,9 +1,9 @@ -import { parseExecutionHostId, type ExecutionHostId } from '../../../shared/execution-host' -import type { RuntimeClientEvent } from '../../../shared/runtime-client-events' +import { parseExecutionHostId, type ExecutionHostId } from '../../../../shared/execution-host' +import type { RuntimeClientEvent } from '../../../../shared/runtime-client-events' import type { AgentPhase, AgentTransition -} from '../../../shared/agent-status/lifecycle/agent-transitions' +} from '../../../../shared/agent-status/lifecycle/agent-transitions' import { classifySortStampEvent, enterAgentPaneState, @@ -11,15 +11,15 @@ import { REST_PANE, type AgentPaneState, type SortStampEvent -} from '../../../shared/sidebar-list/sort-stamps' -import type { TerminalSideEffectBatch } from '../../../shared/terminal/output/terminal-side-effect-facts' +} from '../../../../shared/sidebar-list/sort-stamps' +import type { TerminalSideEffectBatch } from '../../../../shared/terminal/output/terminal-side-effect-facts' import { agentPaneWorkspace, sameAgentPaneWorkspace, type AgentPaneChange, type AgentPaneWorkspace, type AgentTransitionDetector -} from '../../agent-hooks/observations/agent-transition-detector' +} from '../../../agent-hooks/observations/agent-transition-detector' import { listTieredWorkspaces, readSortStamps, @@ -27,7 +27,7 @@ import { writeSortStamps, writeUnreadFlag, type SortStampsStore -} from './sort-stamp-records' +} from '../../workspaces/metadata/workspace-activity-records' /** What the startup reconcile asks of the host, once its hook rows and PTYs have settled. */ export type StoredTierEvidence = { diff --git a/src/main/runtime/sidebar-inputs/terminal-use-producer.ts b/src/main/runtime/sidebar-inputs/temporal/terminal-use-producer.ts similarity index 91% rename from src/main/runtime/sidebar-inputs/terminal-use-producer.ts rename to src/main/runtime/sidebar-inputs/temporal/terminal-use-producer.ts index 91f894f9d0b..75103173dab 100644 --- a/src/main/runtime/sidebar-inputs/terminal-use-producer.ts +++ b/src/main/runtime/sidebar-inputs/temporal/terminal-use-producer.ts @@ -2,8 +2,8 @@ import { readWorkspaceRecord, writeWorkspaceRecord, type WorkspaceRecordStore -} from './sort-stamp-records' -import type { AgentPaneWorkspace } from '../../agent-hooks/observations/agent-transition-detector' +} from '../../workspaces/metadata/workspace-activity-records' +import type { AgentPaneWorkspace } from '../../../agent-hooks/observations/agent-transition-detector' /** At most one write per workspace per minute; cleanup judges idleness in days. */ export const TERMINAL_USE_THROTTLE_MS = 60_000 diff --git a/src/main/runtime/sidebar-inputs/workspace-viewers.test.ts b/src/main/runtime/sidebar-inputs/temporal/workspace-viewers.test.ts similarity index 100% rename from src/main/runtime/sidebar-inputs/workspace-viewers.test.ts rename to src/main/runtime/sidebar-inputs/temporal/workspace-viewers.test.ts diff --git a/src/main/runtime/sidebar-inputs/workspace-viewers.ts b/src/main/runtime/sidebar-inputs/temporal/workspace-viewers.ts similarity index 90% rename from src/main/runtime/sidebar-inputs/workspace-viewers.ts rename to src/main/runtime/sidebar-inputs/temporal/workspace-viewers.ts index 4224d6e29e9..3d7a38f27ca 100644 --- a/src/main/runtime/sidebar-inputs/workspace-viewers.ts +++ b/src/main/runtime/sidebar-inputs/temporal/workspace-viewers.ts @@ -1,6 +1,6 @@ -import { parsePaneKey } from '../../../shared/workspace-layout/stable-pane-id' -import { worktreeIdentityKey } from '../../../shared/worktree/id' -import type { ClientWorkspaceView } from '../../../shared/rpc-contract/client-workspace-view-params' +import { parsePaneKey } from '../../../../shared/workspace-layout/stable-pane-id' +import { worktreeIdentityKey } from '../../../../shared/worktree/id' +import type { ClientWorkspaceView } from '../../../../shared/rpc-contract/client-workspace-view-params' type ClientView = { workspaceKeys: Set; tabIds: Set; presentUntil: number } diff --git a/src/main/runtime/sidebar-inputs/orca-runtime-detected-checkouts-live-content.ts b/src/main/runtime/sidebar-inputs/workspace-facts/orca-runtime-detected-checkouts-live-content.ts similarity index 78% rename from src/main/runtime/sidebar-inputs/orca-runtime-detected-checkouts-live-content.ts rename to src/main/runtime/sidebar-inputs/workspace-facts/orca-runtime-detected-checkouts-live-content.ts index 1808afd6342..7d2351b852f 100644 --- a/src/main/runtime/sidebar-inputs/orca-runtime-detected-checkouts-live-content.ts +++ b/src/main/runtime/sidebar-inputs/workspace-facts/orca-runtime-detected-checkouts-live-content.ts @@ -1,9 +1,9 @@ import { OrcaRuntimeWithWorkspaceReviewFacts } from './orca-runtime-workspace-review-facts' -import { isFolderRepo } from '../../../shared/repo-kind' -import { worktreeIdsEqual } from '../../../shared/worktree/id' -import type { WorkspaceLiveContent } from '../../../shared/sidebar-list/workspace-live-content' -import { runtimeVisibleRepos } from '../workspaces/catalog/runtime-visible-catalog' -import { DetectedCheckoutsProducer } from './detected-checkouts-producer' +import { isFolderRepo } from '../../../../shared/repo-kind' +import { worktreeIdsEqual } from '../../../../shared/worktree/id' +import type { WorkspaceLiveContent } from '../../../../shared/sidebar-list/workspace-live-content' +import { runtimeVisibleRepos } from '../../workspaces/catalog/runtime-visible-catalog' +import { DetectedCheckoutsProducer } from '../workspace-rows/detected-checkouts-producer' import { WorkspaceLiveContentProducer } from './workspace-live-content-producer' /** Two producers published for readers still to come: detected checkouts and live terminal content. */ diff --git a/src/main/runtime/sidebar-inputs/orca-runtime-workspace-activity-facts.test.ts b/src/main/runtime/sidebar-inputs/workspace-facts/orca-runtime-workspace-activity-facts.test.ts similarity index 91% rename from src/main/runtime/sidebar-inputs/orca-runtime-workspace-activity-facts.test.ts rename to src/main/runtime/sidebar-inputs/workspace-facts/orca-runtime-workspace-activity-facts.test.ts index e356416d19a..aa6175a5699 100644 --- a/src/main/runtime/sidebar-inputs/orca-runtime-workspace-activity-facts.test.ts +++ b/src/main/runtime/sidebar-inputs/workspace-facts/orca-runtime-workspace-activity-facts.test.ts @@ -1,10 +1,10 @@ // Runs on plain Node, as orcad does: the producer and its runtime wiring import no Electron. import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { RuntimeMobileSessionTabsSnapshot } from '../../../shared/runtime-session-contracts' -import { AgentHookServer } from '../../agent-hooks/server/agent-hook-server' -import { OrcaRuntimeService } from '../orca-runtime' +import type { RuntimeMobileSessionTabsSnapshot } from '../../../../shared/runtime-session-contracts' +import { AgentHookServer } from '../../../agent-hooks/server/agent-hook-server' +import { OrcaRuntimeService } from '../../orca-runtime' -vi.mock('../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true })) +vi.mock('../../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true })) const WT = 'repo-1::/tmp/worktree-a' const LEAF = '22222222-2222-4222-8222-222222222222' diff --git a/src/main/runtime/sidebar-inputs/orca-runtime-workspace-activity-facts.ts b/src/main/runtime/sidebar-inputs/workspace-facts/orca-runtime-workspace-activity-facts.ts similarity index 94% rename from src/main/runtime/sidebar-inputs/orca-runtime-workspace-activity-facts.ts rename to src/main/runtime/sidebar-inputs/workspace-facts/orca-runtime-workspace-activity-facts.ts index 48ea2cbac3f..a70b7cd0f48 100644 --- a/src/main/runtime/sidebar-inputs/orca-runtime-workspace-activity-facts.ts +++ b/src/main/runtime/sidebar-inputs/workspace-facts/orca-runtime-workspace-activity-facts.ts @@ -1,11 +1,11 @@ -import { OrcaRuntimeWithAgentTransitions } from '../construction/orca-runtime-agent-transitions' -import type { PtyLivenessVerdict } from '../../../shared/terminal/pty/lifecycle/pty-liveness-verdict' +import { OrcaRuntimeWithAgentTransitions } from '../../construction/orca-runtime-agent-transitions' +import type { PtyLivenessVerdict } from '../../../../shared/terminal/pty/lifecycle/pty-liveness-verdict' import type { WorkspaceActivityFactsSnapshot, WorkspaceTerminalLiveness -} from '../../../shared/sidebar-list/workspace-activity-facts' -import { worktreeIdentityKey } from '../../../shared/worktree/id' -import { SidebarClock } from './sidebar-clock' +} from '../../../../shared/sidebar-list/workspace-activity-facts' +import { worktreeIdentityKey } from '../../../../shared/worktree/id' +import { SidebarClock } from '../sidebar-clock' import { WorkspaceActivityFactsProducer, type WorkspaceSurfaceActivity diff --git a/src/main/runtime/sidebar-inputs/orca-runtime-workspace-review-facts.ts b/src/main/runtime/sidebar-inputs/workspace-facts/orca-runtime-workspace-review-facts.ts similarity index 92% rename from src/main/runtime/sidebar-inputs/orca-runtime-workspace-review-facts.ts rename to src/main/runtime/sidebar-inputs/workspace-facts/orca-runtime-workspace-review-facts.ts index 2d92705e667..21101b009e4 100644 --- a/src/main/runtime/sidebar-inputs/orca-runtime-workspace-review-facts.ts +++ b/src/main/runtime/sidebar-inputs/workspace-facts/orca-runtime-workspace-review-facts.ts @@ -2,7 +2,7 @@ import { OrcaRuntimeWithWorkspaceActivityFacts } from './orca-runtime-workspace- import { buildWorkspaceReviewFacts, type WorkspaceReviewFactsSnapshot -} from '../../../shared/sidebar-list/workspace-review-facts' +} from '../../../../shared/sidebar-list/workspace-review-facts' /** Read host-persisted PR facts on demand; windows save cache updates within a second, while orcad uses its existing profile. */ export abstract class OrcaRuntimeWithWorkspaceReviewFacts extends OrcaRuntimeWithWorkspaceActivityFacts { diff --git a/src/main/runtime/sidebar-inputs/workspace-activity-facts-producer.test.ts b/src/main/runtime/sidebar-inputs/workspace-facts/workspace-activity-facts-producer.test.ts similarity index 95% rename from src/main/runtime/sidebar-inputs/workspace-activity-facts-producer.test.ts rename to src/main/runtime/sidebar-inputs/workspace-facts/workspace-activity-facts-producer.test.ts index e956f8c0519..02f5c9a7322 100644 --- a/src/main/runtime/sidebar-inputs/workspace-activity-facts-producer.test.ts +++ b/src/main/runtime/sidebar-inputs/workspace-facts/workspace-activity-facts-producer.test.ts @@ -1,7 +1,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest' -import { SidebarClock } from './sidebar-clock' -import { AgentHookServer } from '../../agent-hooks/server/agent-hook-server' -import { AGENT_STATUS_STALE_AFTER_MS } from '../../../shared/agent-status/contracts/agent-status-freshness' +import { SidebarClock } from '../sidebar-clock' +import { AgentHookServer } from '../../../agent-hooks/server/agent-hook-server' +import { AGENT_STATUS_STALE_AFTER_MS } from '../../../../shared/agent-status/contracts/agent-status-freshness' import { WorkspaceActivityFactsProducer, type WorkspaceSurfaceActivity diff --git a/src/main/runtime/sidebar-inputs/workspace-activity-facts-producer.ts b/src/main/runtime/sidebar-inputs/workspace-facts/workspace-activity-facts-producer.ts similarity index 93% rename from src/main/runtime/sidebar-inputs/workspace-activity-facts-producer.ts rename to src/main/runtime/sidebar-inputs/workspace-facts/workspace-activity-facts-producer.ts index 21445f85287..8fc4c62b004 100644 --- a/src/main/runtime/sidebar-inputs/workspace-activity-facts-producer.ts +++ b/src/main/runtime/sidebar-inputs/workspace-facts/workspace-activity-facts-producer.ts @@ -1,12 +1,12 @@ -import { ProducerRevision } from './producer-revision' +import { ProducerRevision } from '../producer-revision' import { AGENT_STATUS_STALE_AFTER_MS, isFreshNonDoneAgentStatus, agentStatusEvidenceObservedAt -} from '../../../shared/agent-status/contracts/agent-status-freshness' -import type { AgentStatusIpcPayload } from '../../../shared/agent-status/contracts/agent-status-ipc-payload' +} from '../../../../shared/agent-status/contracts/agent-status-freshness' +import type { AgentStatusIpcPayload } from '../../../../shared/agent-status/contracts/agent-status-ipc-payload' -import { resolveAgentStatusWorktreeId } from '../../../shared/agent-status/identity/agent-status-worktree-attribution' +import { resolveAgentStatusWorktreeId } from '../../../../shared/agent-status/identity/agent-status-worktree-attribution' import { IDLE_WORKSPACE_ACTIVITY, isIdleWorkspaceActivity, @@ -16,9 +16,9 @@ import { type LiveAgentWorktreeStatus, type WorkspaceActivityFacts, type WorkspaceActivityFactsSnapshot -} from '../../../shared/sidebar-list/workspace-activity-facts' -import type { AgentHookServer } from '../../agent-hooks/server/agent-hook-server' -import type { SidebarClock } from './sidebar-clock' +} from '../../../../shared/sidebar-list/workspace-activity-facts' +import type { AgentHookServer } from '../../../agent-hooks/server/agent-hook-server' +import type { SidebarClock } from '../sidebar-clock' export type WorkspaceSurfaceActivity = Omit diff --git a/src/main/runtime/sidebar-inputs/workspace-live-content-producer.ts b/src/main/runtime/sidebar-inputs/workspace-facts/workspace-live-content-producer.ts similarity index 89% rename from src/main/runtime/sidebar-inputs/workspace-live-content-producer.ts rename to src/main/runtime/sidebar-inputs/workspace-facts/workspace-live-content-producer.ts index 04fbdfb4587..9052036b3b9 100644 --- a/src/main/runtime/sidebar-inputs/workspace-live-content-producer.ts +++ b/src/main/runtime/sidebar-inputs/workspace-facts/workspace-live-content-producer.ts @@ -1,8 +1,8 @@ import { workspaceLiveContentEqual, type WorkspaceLiveContent -} from '../../../shared/sidebar-list/workspace-live-content' -import { ProducerRevision } from './producer-revision' +} from '../../../../shared/sidebar-list/workspace-live-content' +import { ProducerRevision } from '../producer-revision' /** Refresh live terminal content through the activity producer's per-workspace funnel, including PTY binds, exits and verdicts. */ export class WorkspaceLiveContentProducer { diff --git a/src/main/runtime/sidebar-inputs/detected-checkouts-producer.ts b/src/main/runtime/sidebar-inputs/workspace-rows/detected-checkouts-producer.ts similarity index 83% rename from src/main/runtime/sidebar-inputs/detected-checkouts-producer.ts rename to src/main/runtime/sidebar-inputs/workspace-rows/detected-checkouts-producer.ts index 9063b79539c..86849dad45e 100644 --- a/src/main/runtime/sidebar-inputs/detected-checkouts-producer.ts +++ b/src/main/runtime/sidebar-inputs/workspace-rows/detected-checkouts-producer.ts @@ -1,10 +1,10 @@ -import type { RuntimeClientEvent } from '../../../shared/runtime-client-events' -import type { Repo } from '../../../shared/repo-types' -import type { DetectedWorktreeListResult } from '../../../shared/worktree/types' -import { getRepoExecutionHostId } from '../../../shared/execution-host' -import { getRepoHostIdentityForParts } from '../../../shared/repo-host-identity' -import { CachedScan } from './cached-scan' -import { ProducerRevision } from './producer-revision' +import type { RuntimeClientEvent } from '../../../../shared/runtime-client-events' +import type { Repo } from '../../../../shared/repo-types' +import type { DetectedWorktreeListResult } from '../../../../shared/worktree/types' +import { getRepoExecutionHostId } from '../../../../shared/execution-host' +import { getRepoHostIdentityForParts } from '../../../../shared/repo-host-identity' +import { CachedScan } from '../cached-scan' +import { ProducerRevision } from '../producer-revision' export type DetectedCheckoutsSources = { /** The git repos to list, as worktree.detectedList resolves them. */ diff --git a/src/main/runtime/sidebar-inputs/paired-server-rows-producer.test.ts b/src/main/runtime/sidebar-inputs/workspace-rows/paired-server-rows-producer.test.ts similarity index 90% rename from src/main/runtime/sidebar-inputs/paired-server-rows-producer.test.ts rename to src/main/runtime/sidebar-inputs/workspace-rows/paired-server-rows-producer.test.ts index 74c44787ec7..ce0623ebf26 100644 --- a/src/main/runtime/sidebar-inputs/paired-server-rows-producer.test.ts +++ b/src/main/runtime/sidebar-inputs/workspace-rows/paired-server-rows-producer.test.ts @@ -1,12 +1,12 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { RUNTIME_PROTOCOL_VERSION } from '../../../shared/protocol-version' +import { RUNTIME_PROTOCOL_VERSION } from '../../../../shared/protocol-version' import { runtimeEnvironmentStatusFromSnapshot, type RuntimeHostStatusSnapshot -} from '../../../shared/remote-runtime/host-status/runtime-host-status' -import type { RuntimeRpcResponse } from '../../../shared/runtime-rpc-envelope' -import type { SshConnectionState } from '../../../shared/ssh-types' -import type { MobileDesktopRelayHosts } from '../mobile-desktop-relay/mobile-desktop-relay-hosts' +} from '../../../../shared/remote-runtime/host-status/runtime-host-status' +import type { RuntimeRpcResponse } from '../../../../shared/runtime-rpc-envelope' +import type { SshConnectionState } from '../../../../shared/ssh-types' +import type { MobileDesktopRelayHosts } from '../../mobile-desktop-relay/mobile-desktop-relay-hosts' import { PairedServerRowsProducer } from './paired-server-rows-producer' function snapshot(environmentId: string, live: boolean): RuntimeHostStatusSnapshot { @@ -271,23 +271,4 @@ describe('PairedServerRowsProducer', () => { rows: [{ worktreeId: 'current' }] }) }) - - it('opens a new watch once the old one ends with its transport, even without a close notice', () => { - const { hosts, watches, publishStatus } = fakeHosts([{ id: 'box', live: true }]) - const producer = new PairedServerRowsProducer({ - hasDemand: () => true, - hostLabelOverrides: () => new Map() - }) - producer.attach(hosts) - const first = watches.get('box') - publishStatus() - expect(watches.get('box')).toBe(first) - - if (first) { - first.ended = true - } - publishStatus() - expect(watches.get('box')).not.toBe(first) - expect(first?.closed).toBe(true) - }) }) diff --git a/src/main/runtime/sidebar-inputs/paired-server-rows-producer.ts b/src/main/runtime/sidebar-inputs/workspace-rows/paired-server-rows-producer.ts similarity index 91% rename from src/main/runtime/sidebar-inputs/paired-server-rows-producer.ts rename to src/main/runtime/sidebar-inputs/workspace-rows/paired-server-rows-producer.ts index 9c247699650..7de266282f2 100644 --- a/src/main/runtime/sidebar-inputs/paired-server-rows-producer.ts +++ b/src/main/runtime/sidebar-inputs/workspace-rows/paired-server-rows-producer.ts @@ -1,28 +1,28 @@ -import { ProducerRevision } from './producer-revision' -import { toRuntimeExecutionHostId, type ExecutionHostId } from '../../../shared/execution-host' -import { describePairedServerHosts } from '../../../shared/remote-runtime/host-catalog/paired-server-hosts' -import type { MobileRelayServerWorktreeRow } from '../../../shared/remote-runtime/relay/mobile-relay-hosts-contract' +import { ProducerRevision } from '../producer-revision' +import { toRuntimeExecutionHostId, type ExecutionHostId } from '../../../../shared/execution-host' +import { describePairedServerHosts } from '../../../../shared/remote-runtime/host-catalog/paired-server-hosts' +import type { MobileRelayServerWorktreeRow } from '../../../../shared/remote-runtime/relay/mobile-relay-hosts-contract' import { normalizePairedServerRow, type PairedServerRowsSnapshot -} from '../../../shared/sidebar-list/paired-server-rows' +} from '../../../../shared/sidebar-list/paired-server-rows' import type { MobileDesktopRelayHostListing, MobileDesktopRelayHosts, MobileDesktopRelayHostWatch -} from '../mobile-desktop-relay/mobile-desktop-relay-hosts' +} from '../../mobile-desktop-relay/mobile-desktop-relay-hosts' import { describeRelayHosts, relayHostFence -} from '../mobile-desktop-relay/mobile-relay-host-descriptions' -import type { ServerWorktreeRows } from '../mobile-desktop-relay/mobile-relay-host-catalog' +} from '../../mobile-desktop-relay/mobile-relay-host-descriptions' +import type { ServerWorktreeRows } from '../../mobile-desktop-relay/mobile-relay-host-catalog' import { SERVER_WORKTREE_LIMIT, WorktreePsReplySchema, stampServerWorktreeRows -} from '../mobile-desktop-relay/server-worktree-fetch' -import type { PairedServerCatalog } from '../../../shared/sidebar-list/sidebar-project-catalog' -import { fetchPairedServerCatalog } from '../../../shared/sidebar-list/paired-server-catalog' +} from '../../mobile-desktop-relay/server-worktree-fetch' +import type { PairedServerCatalog } from '../../../../shared/sidebar-list/sidebar-project-catalog' +import { fetchPairedServerCatalog } from '../../../../shared/sidebar-list/paired-server-catalog' // Owner-approved fallback for changes a server announces no event for (status-only, older servers). export const FALLBACK_REFRESH_MS = 30_000 diff --git a/src/main/runtime/sidebar-inputs/workspace-git-identity.test.ts b/src/main/runtime/sidebar-inputs/workspace-rows/workspace-git-identity.test.ts similarity index 98% rename from src/main/runtime/sidebar-inputs/workspace-git-identity.test.ts rename to src/main/runtime/sidebar-inputs/workspace-rows/workspace-git-identity.test.ts index 3ee40cb8eee..8c33945d36e 100644 --- a/src/main/runtime/sidebar-inputs/workspace-git-identity.test.ts +++ b/src/main/runtime/sidebar-inputs/workspace-rows/workspace-git-identity.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import { getRepoHostIdentityForParts } from '../../../shared/repo-host-identity' +import { getRepoHostIdentityForParts } from '../../../../shared/repo-host-identity' import { WorkspaceGitIdentity, type ScannedIdentityRow } from './workspace-git-identity' const REPO = getRepoHostIdentityForParts('repo-1', 'local') diff --git a/src/main/runtime/sidebar-inputs/workspace-git-identity.ts b/src/main/runtime/sidebar-inputs/workspace-rows/workspace-git-identity.ts similarity index 93% rename from src/main/runtime/sidebar-inputs/workspace-git-identity.ts rename to src/main/runtime/sidebar-inputs/workspace-rows/workspace-git-identity.ts index 8d7cbff00ba..46daa4abd6d 100644 --- a/src/main/runtime/sidebar-inputs/workspace-git-identity.ts +++ b/src/main/runtime/sidebar-inputs/workspace-rows/workspace-git-identity.ts @@ -1,21 +1,21 @@ -import type { Worktree } from '../../../shared/worktree/types' +import type { Worktree } from '../../../../shared/worktree/types' import { composeWorktreeHostIdentity, hostWorktreeTarget, type HostScopedWorktreeKey, type HostWorktreeTarget -} from '../../../shared/worktree/host-qualified-identity' -import type { HOSTED_REVIEW_LINK_KEYS } from '../../../shared/worktree/hosted-review-links' +} from '../../../../shared/worktree/host-qualified-identity' +import type { HOSTED_REVIEW_LINK_KEYS } from '../../../../shared/worktree/hosted-review-links' import { branchHostedReviewOwner, hostedReviewClearUpdates, type HostedReviewClearUpdates, type HostedReviewOwner -} from '../../../shared/worktree/hosted-review-branch-ownership' +} from '../../../../shared/worktree/hosted-review-branch-ownership' import { getRepoHostIdentityForParts, type HostScopedRepoKey -} from '../../../shared/repo-host-identity' +} from '../../../../shared/repo-host-identity' type IdentityRow = Pick< Worktree, diff --git a/src/main/runtime/sidebar-inputs/workspace-rows-producer.test.ts b/src/main/runtime/sidebar-inputs/workspace-rows/workspace-rows-producer.test.ts similarity index 81% rename from src/main/runtime/sidebar-inputs/workspace-rows-producer.test.ts rename to src/main/runtime/sidebar-inputs/workspace-rows/workspace-rows-producer.test.ts index eca8e46ff60..e16c02b632a 100644 --- a/src/main/runtime/sidebar-inputs/workspace-rows-producer.test.ts +++ b/src/main/runtime/sidebar-inputs/workspace-rows/workspace-rows-producer.test.ts @@ -1,32 +1,32 @@ // Runs on plain Node, as orcad does: rows come from the runtime's own listing and store. import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { Repo } from '../../../shared/repo-types' +import type { Repo } from '../../../../shared/repo-types' -import type { RuntimeClientEvent } from '../../../shared/runtime-client-events' +import type { RuntimeClientEvent } from '../../../../shared/runtime-client-events' -import { OrcaRuntimeService } from '../orca-runtime' +import { OrcaRuntimeService } from '../../orca-runtime' -import type { ResolvedWorktreeSnapshot } from '../workspaces/catalog/runtime-resolved-worktree-cache' +import type { ResolvedWorktreeSnapshot } from '../../workspaces/catalog/runtime-resolved-worktree-cache' -import type { RuntimeStore } from '../construction/runtime-store-contract' +import type { RuntimeStore } from '../../construction/runtime-store-contract' -import type { ResolvedWorktree } from '../workspaces/catalog/runtime-worktree-path-identity' +import type { ResolvedWorktree } from '../../workspaces/catalog/runtime-worktree-path-identity' -import { requireSwitchedOn } from './require-switched-on' +import { requireSwitchedOn } from '../../construction/require-sidebar-inputs-enabled' -import { TestPhone } from './sidebar-inputs-feed.test-fixture' +import { TestPhone } from '../feed/testing/sidebar-inputs-feed.test-fixture' import type { ResolvedWorktreeRepoScans, ResolvedWorktreeScanJoin -} from '../workspaces/catalog/resolved-worktree-scan-join' +} from '../../workspaces/catalog/resolved-worktree-scan-join' -import { composeWorktreeHostIdentity } from '../../../shared/worktree/host-qualified-identity' +import { composeWorktreeHostIdentity } from '../../../../shared/worktree/host-qualified-identity' -import { getRepoHostIdentityForParts } from '../../../shared/repo-host-identity' +import { getRepoHostIdentityForParts } from '../../../../shared/repo-host-identity' -vi.mock('../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true })) +vi.mock('../../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true })) const localRepo: Repo = { id: 'repo-1', @@ -118,7 +118,6 @@ function setup(repos: Repo[] = [localRepo, sshRepo]) { let scans = 0 // A new object per scan that really ran git; a cached scan repeats the last one. let gitRun: object = {} - let freshGitRuns = true let scanGate: Promise | null = null // The real listing cache and visibility filter run; only the scan and merge are stubbed. class Probe extends OrcaRuntimeService { @@ -129,7 +128,7 @@ function setup(repos: Repo[] = [localRepo, sshRepo]) { protected override async scanResolvedWorktreeRepos(): Promise { scans += 1 await scanGate - gitRun = freshGitRuns ? {} : gitRun + gitRun = {} return new Map() } @@ -162,10 +161,6 @@ function setup(repos: Repo[] = [localRepo, sshRepo]) { runtime, setWorktreeMeta, scans: () => scans, - /** Whether the next scans run git again or answer from the scan cache. */ - setFreshGitRuns: (fresh: boolean) => { - freshGitRuns = fresh - }, /** Holds every scan until the returned release runs. */ holdScans(): () => void { let release = (): void => {} @@ -281,24 +276,4 @@ describe('WorkspaceRowsProducer', () => { expect(rows.snapshot()?.rows['local|repo-1::/r/a']).toMatchObject({ displayName: 'b' }) detach() }) - - it('keeps a PR linked after a branch switch that a cached rescan did not see yet', async () => { - const { runtime, rows, listing, write, setWorktreeMeta, setFreshGitRuns } = setup() - const detach = rows.revision.onChange(() => {}) - listing.worktrees[0] = { ...listing.worktrees[0], instanceId: 'i-1' } - await rows.settled() - // `git checkout -b b`; the scan cache still answers with branch a. - setFreshGitRuns(false) - listing.worktrees[0] = { ...listing.worktrees[0], linkedPR: 9 } - write(['worktreeMeta']) - runtime.emit({ type: 'worktreesChanged', repoId: 'repo-1' }) - await rows.settled() - // Git runs again and reports the new branch: the new branch's PR stays. - setFreshGitRuns(true) - listing.worktrees[0] = { ...listing.worktrees[0], branch: 'refs/heads/b' } - runtime.emit({ type: 'worktreesChanged', repoId: 'repo-1' }) - await rows.settled() - expect(setWorktreeMeta).not.toHaveBeenCalled() - detach() - }) }) diff --git a/src/main/runtime/sidebar-inputs/workspace-rows-producer.ts b/src/main/runtime/sidebar-inputs/workspace-rows/workspace-rows-producer.ts similarity index 88% rename from src/main/runtime/sidebar-inputs/workspace-rows-producer.ts rename to src/main/runtime/sidebar-inputs/workspace-rows/workspace-rows-producer.ts index 0418b5c04f5..6ba75841871 100644 --- a/src/main/runtime/sidebar-inputs/workspace-rows-producer.ts +++ b/src/main/runtime/sidebar-inputs/workspace-rows/workspace-rows-producer.ts @@ -1,26 +1,26 @@ -import type { RuntimeClientEvent } from '../../../shared/runtime-client-events' +import type { RuntimeClientEvent } from '../../../../shared/runtime-client-events' import { buildWorkspaceRows, type WorkspaceRowsSnapshot -} from '../../../shared/sidebar-list/workspace-rows' -import { composeWorktreeHostIdentity } from '../../../shared/worktree/host-qualified-identity' -import type { ResolvedWorktree } from '../workspaces/catalog/runtime-worktree-path-identity' -import type { ResolvedWorktreeSnapshot } from '../workspaces/catalog/runtime-resolved-worktree-cache' -import type { RuntimeStore } from '../construction/runtime-store-contract' -import type { GlobalSettings } from '../../../shared/global-settings-types' -import { runtimeVisibleFolderWorkspaces } from '../workspaces/catalog/runtime-visible-catalog' +} from '../../../../shared/sidebar-list/workspace-rows' +import { composeWorktreeHostIdentity } from '../../../../shared/worktree/host-qualified-identity' +import type { ResolvedWorktree } from '../../workspaces/catalog/runtime-worktree-path-identity' +import type { ResolvedWorktreeSnapshot } from '../../workspaces/catalog/runtime-resolved-worktree-cache' +import type { RuntimeStore } from '../../construction/runtime-store-contract' +import type { GlobalSettings } from '../../../../shared/global-settings-types' +import { runtimeVisibleFolderWorkspaces } from '../../workspaces/catalog/runtime-visible-catalog' import type { ResolvedWorktreeRepoScans, ResolvedWorktreeScanJoin -} from '../workspaces/catalog/resolved-worktree-scan-join' +} from '../../workspaces/catalog/resolved-worktree-scan-join' import { savedWorkspaceCatalog, WORKTREE_METADATA_DOMAINS -} from '../../persistence/profile-save-domains' -import { ProducerRevision } from './producer-revision' +} from '../../../persistence/profile-save-domains' +import { ProducerRevision } from '../producer-revision' import { WorkspaceGitIdentity } from './workspace-git-identity' -import { CachedScan } from './cached-scan' -import type { WorkspaceLifecycleQueue } from '../workspaces/lifecycle/workspace-lifecycle-queue' +import { CachedScan } from '../cached-scan' +import type { WorkspaceLifecycleQueue } from '../../workspaces/lifecycle/workspace-lifecycle-queue' // The settings the visibility filter reads: the defaults, and the layouts that classify a checkout. const VISIBILITY_SETTINGS = [ diff --git a/src/main/runtime/sidebar-inputs/sort-stamp-records-twins.test.ts b/src/main/runtime/workspaces/metadata/workspace-activity-records-twins.test.ts similarity index 92% rename from src/main/runtime/sidebar-inputs/sort-stamp-records-twins.test.ts rename to src/main/runtime/workspaces/metadata/workspace-activity-records-twins.test.ts index bc58ceffa3e..b3f1646c874 100644 --- a/src/main/runtime/sidebar-inputs/sort-stamp-records-twins.test.ts +++ b/src/main/runtime/workspaces/metadata/workspace-activity-records-twins.test.ts @@ -1,11 +1,11 @@ import { describe, expect, it } from 'vitest' -import type { ExecutionHostId } from '../../../shared/execution-host' -import type { Repo } from '../../../shared/repo-types' +import type { ExecutionHostId } from '../../../../shared/execution-host' +import type { Repo } from '../../../../shared/repo-types' import { hostWorktreeTarget, type HostWorktreeTarget -} from '../../../shared/worktree/host-qualified-identity' -import { readSortStamps, writeSortStamps, writeUnreadFlag } from './sort-stamp-records' +} from '../../../../shared/worktree/host-qualified-identity' +import { readSortStamps, writeSortStamps, writeUnreadFlag } from './workspace-activity-records' const WT = 'dup::/wt' type Row = { lastActivityAt: number; isUnread?: boolean; hostId?: ExecutionHostId } diff --git a/src/main/runtime/sidebar-inputs/sort-stamp-records.ts b/src/main/runtime/workspaces/metadata/workspace-activity-records.ts similarity index 89% rename from src/main/runtime/sidebar-inputs/sort-stamp-records.ts rename to src/main/runtime/workspaces/metadata/workspace-activity-records.ts index b3df494b5f8..04b68467014 100644 --- a/src/main/runtime/sidebar-inputs/sort-stamp-records.ts +++ b/src/main/runtime/workspaces/metadata/workspace-activity-records.ts @@ -1,19 +1,19 @@ -import { getRepoRegistrationHostIds } from '../../../shared/repo-host-identity' -import type { AgentPaneWorkspace } from '../../agent-hooks/observations/agent-transition-detector' -import { LOCAL_EXECUTION_HOST_ID, type ExecutionHostId } from '../../../shared/execution-host' -import { getRepoIdFromWorktreeId } from '../../../shared/worktree/id' +import { getRepoRegistrationHostIds } from '../../../../shared/repo-host-identity' +import type { AgentPaneWorkspace } from '../../../agent-hooks/observations/agent-transition-detector' +import { LOCAL_EXECUTION_HOST_ID, type ExecutionHostId } from '../../../../shared/execution-host' +import { getRepoIdFromWorktreeId } from '../../../../shared/worktree/id' import type { SmartStampFields, SmartTier, SortStamps -} from '../../../shared/sidebar-list/sort-stamps' -import { folderWorkspaceKey, parseWorkspaceKey } from '../../../shared/workspace-scope' -import type { Repo } from '../../../shared/repo-types' +} from '../../../../shared/sidebar-list/sort-stamps' +import { folderWorkspaceKey, parseWorkspaceKey } from '../../../../shared/workspace-scope' +import type { Repo } from '../../../../shared/repo-types' import { hostWorktreeTarget, type HostWorktreeTarget -} from '../../../shared/worktree/host-qualified-identity' -import { resolveWorktreeMetaOwner } from '../../persistence/host-qualified-worktree-meta' +} from '../../../../shared/worktree/host-qualified-identity' +import { resolveWorktreeMetaOwner } from '../../../persistence/host-qualified-worktree-meta' type StampedRecord = { lastActivityAt: number diff --git a/src/renderer/src/components/sidebar/worktree-list/parity/sidebar-list-parity-project-catalog.test-fixture.ts b/src/renderer/src/components/sidebar/worktree-list/parity/sidebar-list-parity-project-catalog.test-fixture.ts index 3349678a8f9..5750d59a214 100644 --- a/src/renderer/src/components/sidebar/worktree-list/parity/sidebar-list-parity-project-catalog.test-fixture.ts +++ b/src/renderer/src/components/sidebar/worktree-list/parity/sidebar-list-parity-project-catalog.test-fixture.ts @@ -12,7 +12,7 @@ import type { RuntimeRpcResponse } from '../../../../../../shared/runtime-rpc-en import { buildSidebarProjectCatalog } from '../../../../../../shared/sidebar-list/sidebar-project-catalog' import { fetchPairedServerCatalog } from '../../../../../../shared/sidebar-list/paired-server-catalog' import { group, mainWt, repo } from './sidebar-list-golden-factories.test-fixture' -import type { SidebarInputsFeedDomain } from '../../../../../../main/runtime/sidebar-inputs/sidebar-inputs-feed' +import type { SidebarInputsFeedDomain } from '../../../../../../main/runtime/sidebar-inputs/feed/sidebar-inputs-feed' const ENVIRONMENT_ID = 'env-1' const SERVER_HOST_ID = toRuntimeExecutionHostId(ENVIRONMENT_ID) diff --git a/src/renderer/src/components/sidebar/worktree-list/parity/sidebar-list-parity.test-fixture.ts b/src/renderer/src/components/sidebar/worktree-list/parity/sidebar-list-parity.test-fixture.ts index 6527995cac8..cb32ec0e884 100644 --- a/src/renderer/src/components/sidebar/worktree-list/parity/sidebar-list-parity.test-fixture.ts +++ b/src/renderer/src/components/sidebar/worktree-list/parity/sidebar-list-parity.test-fixture.ts @@ -39,7 +39,7 @@ import { readWindowPairedServerHosts, readWindowPairedServerRows } from '@/components/sidebar/worktree-list/parity/sidebar-paired-server-rows.test-fixture' -import type { SidebarInputsFeedDomain } from '../../../../../../main/runtime/sidebar-inputs/sidebar-inputs-feed' +import type { SidebarInputsFeedDomain } from '../../../../../../main/runtime/sidebar-inputs/feed/sidebar-inputs-feed' import type { SidebarFeedDomains } from '../../../../../../shared/sidebar-list/sidebar-feed-domains' import { buildSidebarFeedCatalog } from '../../../../../../shared/sidebar-list/sidebar-feed-catalog' import { diff --git a/src/shared/sidebar-feed-client/sidebar-feed-reader.test.ts b/src/shared/sidebar-feed-client/sidebar-feed-reader.test.ts index 82c5a73d8ab..1bd8ba065b3 100644 --- a/src/shared/sidebar-feed-client/sidebar-feed-reader.test.ts +++ b/src/shared/sidebar-feed-client/sidebar-feed-reader.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it, vi } from 'vitest' -import { SidebarInputsFeed } from '../../main/runtime/sidebar-inputs/sidebar-inputs-feed' -import { testDomain } from '../../main/runtime/sidebar-inputs/sidebar-inputs-feed.test-fixture' +import { SidebarInputsFeed } from '../../main/runtime/sidebar-inputs/feed/sidebar-inputs-feed' +import { testDomain } from '../../main/runtime/sidebar-inputs/feed/testing/sidebar-inputs-feed.test-fixture' import type { SidebarInputsChangedEvent, SidebarInputsReadParams @@ -113,28 +113,6 @@ describe('SidebarFeedReader', () => { } }) - it('stops retrying a host that keeps failing, and when the screen lets go', async () => { - vi.useFakeTimers() - try { - const host = hostWithFeed() - host.transport.mockRejectedValue(new Error('Request timed out: sidebarInputs.read')) - host.reader.refresh() - await vi.advanceTimersByTimeAsync(10 * 60_000) - const attempts = host.transport.mock.calls.length - expect(attempts).toBeGreaterThan(1) - expect(attempts).toBeLessThan(10) - - // A fresh trigger gets a fresh budget, which disposal cancels. - host.reader.refresh() - await vi.advanceTimersByTimeAsync(0) - host.reader.dispose() - await vi.advanceTimersByTimeAsync(10 * 60_000) - expect(host.transport.mock.calls.length).toBe(attempts + 1) - } finally { - vi.useRealTimers() - } - }) - it('stays bounded when a batch’s first page answers but a later page keeps failing', async () => { vi.useFakeTimers() try { diff --git a/tests/e2e/sidebar-repo-icons.spec.ts b/tests/e2e/sidebar-repo-icons.spec.ts index 60d4fb0634e..65c12386cd1 100644 --- a/tests/e2e/sidebar-repo-icons.spec.ts +++ b/tests/e2e/sidebar-repo-icons.spec.ts @@ -3,7 +3,7 @@ import { z } from 'zod' import { test, expect } from './helpers/orca-app' import { SIDEBAR_INPUTS_BUILD } from './helpers/sidebar-inputs-build' import { waitForActiveWorktree, waitForSessionReady } from './helpers/store' -import { repoIconId } from '../../src/main/runtime/sidebar-inputs/repo-icon-data-urls' +import { repoIconId } from '../../src/main/runtime/sidebar-inputs/repo-icons/repo-icon-data-urls' import { readRasterImageDimensions } from '../../src/shared/file-preview/raster-image-dimensions' test.skip(