diff --git a/.github/workflows/macos-updater-tests.yml b/.github/workflows/macos-updater-tests.yml index f0faf98cbc9..22c01e524ac 100644 --- a/.github/workflows/macos-updater-tests.yml +++ b/.github/workflows/macos-updater-tests.yml @@ -19,7 +19,7 @@ on: - 'src/main/providers/shell-launch/macos/tcc-login-shell*' - 'src/shared/process-observation/tables/process-table-snapshot*' - 'src/shared/process-observation/darwin/darwin-process-table-capture*' - - 'src/shared/update-status-types.ts' + - 'src/shared/updater/update-status-types.ts' - 'pnpm-lock.yaml' workflow_dispatch: diff --git a/config/main-sync-fs-baseline.txt b/config/main-sync-fs-baseline.txt index 81866e3e87d..32044607970 100644 --- a/config/main-sync-fs-baseline.txt +++ b/config/main-sync-fs-baseline.txt @@ -575,8 +575,8 @@ 5 src/shared/agent-hook-listener/transport/endpoint-publication.ts 4 src/shared/agent-launch/startup/omp-fresh-config.ts 2 src/shared/desktop-distribution/appimage/appimage-cache-identity.ts -2 src/shared/bundled-web-client-manifest.ts -3 src/shared/bundled-web-client-root.ts +2 src/shared/web-client/bundled-web-client-manifest.ts +3 src/shared/web-client/bundled-web-client-root.ts 5 src/shared/shell/command-resolution/cli-fs-reads.ts 3 src/shared/shell/launch/cli-runtime-pairing-inputs.ts 9 src/shared/agent-hook-listener/providers/codex/codex-rollout-jsonl-cursor.ts diff --git a/config/scripts/build/mobile-web-app/mobile-web-bundle-manifest.mjs b/config/scripts/build/mobile-web-app/mobile-web-bundle-manifest.mjs index ad84a39bd02..ea5d9b54ed4 100644 --- a/config/scripts/build/mobile-web-app/mobile-web-bundle-manifest.mjs +++ b/config/scripts/build/mobile-web-app/mobile-web-bundle-manifest.mjs @@ -70,7 +70,11 @@ export function hashedAsset(bytes, extension) { } } -function readIntegerConstant(source, name, file = 'src/shared/protocol-version.ts') { +function readIntegerConstant( + source, + name, + file = 'src/shared/remote-runtime/protocol/protocol-version.ts' +) { const match = new RegExp(`export const ${name} = (\\d+)`).exec(source) if (!match) { throw new Error(`[mobile-web-bundle-manifest] ${name} not found in ${file}`) @@ -80,7 +84,10 @@ function readIntegerConstant(source, name, file = 'src/shared/protocol-version.t // Parse TS protocol source: packaging runs bare Node before build outputs exist. export async function readProtocolWindow() { - const source = await readFile(join(projectDir, 'src', 'shared', 'protocol-version.ts'), 'utf8') + const source = await readFile( + join(projectDir, 'src', 'shared', 'remote-runtime', 'protocol', 'protocol-version.ts'), + 'utf8' + ) return { runtimeProtocolVersion: readIntegerConstant(source, 'RUNTIME_PROTOCOL_VERSION'), minCompatibleRuntimeProtocolVersion: readIntegerConstant( diff --git a/config/scripts/development/profile-seeding/dev-profile-seed.test.mjs b/config/scripts/development/profile-seeding/dev-profile-seed.test.mjs index 7f1cfa3b4c3..1e3bb874e2b 100644 --- a/config/scripts/development/profile-seeding/dev-profile-seed.test.mjs +++ b/config/scripts/development/profile-seeding/dev-profile-seed.test.mjs @@ -4,7 +4,7 @@ import { DatabaseSync } from 'node:sqlite' import { tmpdir } from 'node:os' import path from 'node:path' import { afterEach, describe, expect, it } from 'vitest' -import { createDefaultLocalOrcaProfile } from '../../../../src/shared/orca-profiles' +import { createDefaultLocalOrcaProfile } from '../../../../src/shared/orca-profiles/orca-profiles' import { seedDevProfile } from './dev-profile-seed.mjs' const roots = [] diff --git a/config/scripts/test-runtime/environment/vitest-host-ports-setup.ts b/config/scripts/test-runtime/environment/vitest-host-ports-setup.ts index dbf82f6ad55..bf19a3e8048 100644 --- a/config/scripts/test-runtime/environment/vitest-host-ports-setup.ts +++ b/config/scripts/test-runtime/environment/vitest-host-ports-setup.ts @@ -2,7 +2,10 @@ import process from 'node:process' import { homedir, tmpdir } from 'node:os' import { join } from 'node:path' import { afterAll, beforeEach } from 'vitest' -import { setAppEnvironment, type AppEnvironment } from '../../../../src/shared/app-environment' +import { + setAppEnvironment, + type AppEnvironment +} from '../../../../src/shared/app-lifecycle/app-environment' import { setSecretStore } from '../../../../src/shared/secure-storage/secret-store' // The harness owns its directory even when a suite replaces the fs module. diff --git a/config/scripts/workflow/source-routing/pr-code-change-scope.mjs b/config/scripts/workflow/source-routing/pr-code-change-scope.mjs index d92fd31c2b4..2fd64e552c2 100644 --- a/config/scripts/workflow/source-routing/pr-code-change-scope.mjs +++ b/config/scripts/workflow/source-routing/pr-code-change-scope.mjs @@ -207,13 +207,13 @@ const CROSS_VERSION_WIRE_PREFIXES = [ 'config/scripts/check-runtime-launcher-protocol-ratchet', 'config/scripts/daemon-protocol/admission/check-runtime-launcher-protocol-ratchet', 'src/main/daemon/protocol/daemon-protocol-version.ts', - 'src/shared/protocol-version', + 'src/shared/remote-runtime/protocol/protocol-version', 'src/shared/terminal/stream/terminal-stream-protocol', 'src/shared/browser/client-hosting/browser-client-host-protocol', 'src/shared/browser/network/tunnels/browser-network-tunnel-protocol', // Both released/current WebSocket transports must accept web upgrade marker (cross-version-web-upgrade-marker). 'src/main/runtime/rpc/transports/websocket/ws-transport.ts', - 'src/shared/web-origin-security.ts', + 'src/shared/remote-runtime/pairing/web-origin-security.ts', 'src/shared/browser/client-hosting/browser-client-host-placement', 'src/shared/agent-launch/contracts/agent-launch-intent', 'src/shared/rpc-contract/agent-launch/agent-launch-params', @@ -294,7 +294,7 @@ const CROSS_VERSION_WIRE_PREFIXES = [ 'src/shared/agent-launch/choices/structured-native-chat-launch-route.ts', 'src/renderer/src/lib/agent-session/launch/routing/agent-launch-routing.ts', 'src/renderer/src/runtime/rpc/targets/paired-host-client-capabilities.ts', - 'src/shared/electron-remote-runtime-client-capabilities.ts', + 'src/shared/remote-runtime/protocol/electron-remote-runtime-client-capabilities.ts', 'src/shared/remote-runtime/remote-runtime-client-capabilities.ts', // An older app opening a newer orchestration database (orchestration-delivery-downgrade). 'src/main/runtime/orchestration/db/', diff --git a/mobile/README.md b/mobile/README.md index 9714fd59025..a842718acfe 100644 --- a/mobile/README.md +++ b/mobile/README.md @@ -232,7 +232,7 @@ Mobile and desktop talk over a versioned protocol. Because mobile updates lag de Constants live in two files (Metro can't resolve outside `mobile/`): -- `src/shared/protocol-version.ts` — `DESKTOP_PROTOCOL_VERSION`, `MIN_COMPATIBLE_MOBILE_VERSION` +- `src/shared/remote-runtime/protocol/protocol-version.ts` — `DESKTOP_PROTOCOL_VERSION`, `MIN_COMPATIBLE_MOBILE_VERSION` - `mobile/src/transport/connection/protocol-version.ts` — `MOBILE_PROTOCOL_VERSION`, `MIN_COMPATIBLE_DESKTOP_VERSION` Today all four are set so `evaluateCompat` always returns `{ kind: 'ok' }` — nothing blocks. The wire format is in place to flip a switch when needed. diff --git a/mobile/scripts/mock-server-forked-chats-scenario.ts b/mobile/scripts/mock-server-forked-chats-scenario.ts index 92ebbc0015c..8324b40cd18 100644 --- a/mobile/scripts/mock-server-forked-chats-scenario.ts +++ b/mobile/scripts/mock-server-forked-chats-scenario.ts @@ -2,7 +2,7 @@ import { structuredAgentSessionTabId } from '../../src/shared/agent-session/view import { DESKTOP_PROTOCOL_VERSION, MIN_COMPATIBLE_MOBILE_VERSION -} from '../../src/shared/protocol-version' +} from '../../src/shared/remote-runtime/protocol/protocol-version' import type { RuntimeMobileSessionTabsResult } from '../../src/shared/remote-runtime/session-graph/runtime-session-contracts' import type { RuntimeWorktreeAgentRow, diff --git a/mobile/scripts/mock-server-rpc-handlers.ts b/mobile/scripts/mock-server-rpc-handlers.ts index 182b86e46a3..0b2ca6f4dbd 100644 --- a/mobile/scripts/mock-server-rpc-handlers.ts +++ b/mobile/scripts/mock-server-rpc-handlers.ts @@ -2,7 +2,7 @@ import type { WebSocket } from 'ws' import { DESKTOP_PROTOCOL_VERSION, MIN_COMPATIBLE_MOBILE_VERSION -} from '../../src/shared/protocol-version' +} from '../../src/shared/remote-runtime/protocol/protocol-version' import { applyTerminalQuickCommandMutation, type TerminalQuickCommandMutation diff --git a/mobile/src/app-update/app-update-source.ts b/mobile/src/app-update/app-update-source.ts index 3fe41b7a1ab..fbd735f51f2 100644 --- a/mobile/src/app-update/app-update-source.ts +++ b/mobile/src/app-update/app-update-source.ts @@ -2,7 +2,7 @@ import { compareAppVersions, isPrereleaseAppVersion, isValidAppVersion -} from '../../../src/shared/app-version' +} from '../../../src/shared/app-lifecycle/identity/app-version' export type AppUpdateCheckResult = | { kind: 'available'; version: string; url: string } diff --git a/mobile/src/app-update/github-release-update-source.ts b/mobile/src/app-update/github-release-update-source.ts index 32e87c089d0..336b95a8301 100644 --- a/mobile/src/app-update/github-release-update-source.ts +++ b/mobile/src/app-update/github-release-update-source.ts @@ -1,5 +1,5 @@ import { z } from 'zod' -import { compareAppVersions } from '../../../src/shared/app-version' +import { compareAppVersions } from '../../../src/shared/app-lifecycle/identity/app-version' import type { AppUpdateCheckResult, AppUpdateSource } from './app-update-source' import { isNewerReleaseVersion } from './app-update-source' diff --git a/mobile/src/session/agent-launch/mobile-new-tab-agent-loader.test.ts b/mobile/src/session/agent-launch/mobile-new-tab-agent-loader.test.ts deleted file mode 100644 index c85923d2ee5..00000000000 --- a/mobile/src/session/agent-launch/mobile-new-tab-agent-loader.test.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { describe, expect, it, vi } from 'vitest' -import type { RpcClient } from '../../transport/rpc/rpc-client-contract' -import '../../../../src/shared/protocol-version' - -import { loadMobileAgentLaunchContext, newTabAgentOptionsFrom } from './mobile-new-tab-agent-loader' - -async function loadOptions( - args: Parameters[0] -): Promise { - const context = await loadMobileAgentLaunchContext(args) - return newTabAgentOptionsFrom(context.settings, context.detectedAgents) -} - -function createClient( - handler: (method: string, params?: unknown) => Promise -): RpcClient & { sendRequest: ReturnType } { - return { - sendRequest: vi.fn(handler), - subscribe: vi.fn(() => () => {}) - } as unknown as RpcClient & { sendRequest: ReturnType } -} - -describe('mobile new-tab agent loading', () => { - it('does not fall back to probing locally when an older host refuses the folder catalog', async () => { - const client = createClient(async (method) => { - if (method === 'settings.get') { - return { ok: true, result: { settings: {} } } - } - return { ok: false, error: { code: 'method_not_found', message: 'Unknown method' } } - }) - await expect(loadOptions({ client, worktreeId: 'folder:fw-1' })).rejects.toThrow( - 'Unknown method' - ) - expect(client.sendRequest.mock.calls.some(([method]) => method.startsWith('preflight.'))).toBe( - false - ) - }) -}) diff --git a/mobile/src/session/agent-launch/mobile-new-tab-agent-loader.ts b/mobile/src/session/agent-launch/mobile-new-tab-agent-loader.ts index 5ce7cdbbb04..c4bc4eb52d1 100644 --- a/mobile/src/session/agent-launch/mobile-new-tab-agent-loader.ts +++ b/mobile/src/session/agent-launch/mobile-new-tab-agent-loader.ts @@ -1,5 +1,5 @@ import { getRepoIdFromWorktreeId } from '../../../../src/shared/worktree/id' -import '../../../../src/shared/protocol-version' +import '../../../../src/shared/remote-runtime/protocol/protocol-version' import { PREFLIGHT_OTHER_RUNTIME_REFUSAL_RUNTIME_CAPABILITY, WORKSPACE_ON_OTHER_RUNTIME diff --git a/mobile/src/session/tabs/use-mobile-session-tab-reconciliation.ts b/mobile/src/session/tabs/use-mobile-session-tab-reconciliation.ts index 77a14ac14bb..44bf3260ec1 100644 --- a/mobile/src/session/tabs/use-mobile-session-tab-reconciliation.ts +++ b/mobile/src/session/tabs/use-mobile-session-tab-reconciliation.ts @@ -3,7 +3,7 @@ import { startRuntimeCapabilityProbe } from '../../transport/connection/runtime- import { supportsMobileQuickCommands } from '../../terminal/quick-commands/quick-commands' import { terminalQuickCommandAgentPromptMaxLength } from '../../../../src/shared/terminal/quick-commands/terminal-quick-command-prompt-limit' import { MOBILE_AI_VAULT_CAPABILITY } from '../../agent-history/agent-history-capability' -import '../../../../src/shared/protocol-version' +import '../../../../src/shared/remote-runtime/protocol/protocol-version' import { TERMINAL_QUERY_REPLY_INPUT_RUNTIME_CAPABILITY } from '../../../../src/shared/terminal/runtime-policy/terminal-runtime-capabilities' import { PROGRAM_STATUS_RUNTIME_CAPABILITY } from '../../../../src/shared/program-status/protocol' import { structuredAgentSessionHostSupport } from '../native-chat/agent-session/mobile-structured-agent-session-host-support' diff --git a/mobile/src/source-control/review/github-operations/github-work-item-operation.ts b/mobile/src/source-control/review/github-operations/github-work-item-operation.ts index 4d8a7dea0d6..63dbd227f0a 100644 --- a/mobile/src/source-control/review/github-operations/github-work-item-operation.ts +++ b/mobile/src/source-control/review/github-operations/github-work-item-operation.ts @@ -1,7 +1,7 @@ import type { RpcClient } from '../../../transport/rpc/rpc-client-contract' import type { SendRequestOptions } from '../../../transport/rpc/unvalidated-rpc-request-port' import type { GitHubRepositoryIdentity as GitHubOwnerRepo } from '../../../../../src/shared/github/repositories/repository-identity' -import { hasReachedAppVersion } from '../../../../../src/shared/app-version' +import { hasReachedAppVersion } from '../../../../../src/shared/app-lifecycle/identity/app-version' import { GITHUB_EXACT_OPERATION_UNSUPPORTED, matchesGitHubWorkItemTarget, diff --git a/mobile/src/terminal/quick-commands/quick-commands.ts b/mobile/src/terminal/quick-commands/quick-commands.ts index 57903e9445f..3b90a890706 100644 --- a/mobile/src/terminal/quick-commands/quick-commands.ts +++ b/mobile/src/terminal/quick-commands/quick-commands.ts @@ -6,7 +6,7 @@ import { supportsTerminalAgentQuickCommand } from '../../../../src/shared/terminal/quick-commands/terminal-quick-commands' import '../../../../src/shared/terminal/quick-commands/terminal-quick-command-prompt-limit' -import '../../../../src/shared/protocol-version' +import '../../../../src/shared/remote-runtime/protocol/protocol-version' import { TERMINAL_QUICK_COMMANDS_RUNTIME_CAPABILITY } from '../../../../src/shared/terminal/quick-commands/terminal-quick-command-capabilities' import { TUI_AGENT_DISPLAY_NAMES as MOBILE_TUI_AGENT_LABELS } from '../../../../src/shared/agent-launch/catalog/tui-agent-display-names' diff --git a/mobile/src/terminal/session/creation/use-mobile-session-terminal-create-actions.ts b/mobile/src/terminal/session/creation/use-mobile-session-terminal-create-actions.ts index 95c39a2a08f..35a51cb71a1 100644 --- a/mobile/src/terminal/session/creation/use-mobile-session-terminal-create-actions.ts +++ b/mobile/src/terminal/session/creation/use-mobile-session-terminal-create-actions.ts @@ -36,7 +36,7 @@ import { } from '../../../session/tabs/pending-session-selection' import { releaseTerminalCreateLock } from './terminal-create-lock' import { placeCreatedSessionTab } from '../../../../../src/shared/session-tab-placement' -import '../../../../../src/shared/protocol-version' +import '../../../../../src/shared/remote-runtime/protocol/protocol-version' import { SESSION_TABS_SPLIT_GROUP_PLACEMENT_RUNTIME_CAPABILITY } from '../../../../../src/shared/remote-runtime/protocol/session-tabs-runtime-capabilities' export function useMobileSessionTerminalCreateActions(scope: MobileSessionAttachmentsModel) { diff --git a/mobile/src/transport/connection/mobile-runtime-client-capabilities.ts b/mobile/src/transport/connection/mobile-runtime-client-capabilities.ts index 96e5aac5566..a118a24b5cb 100644 --- a/mobile/src/transport/connection/mobile-runtime-client-capabilities.ts +++ b/mobile/src/transport/connection/mobile-runtime-client-capabilities.ts @@ -13,7 +13,7 @@ import { STRUCTURED_AGENT_SESSION_RUNTIME_CAPABILITY } from '../../../../src/shared/agent-session/agent-session-runtime-capabilities' import { AGENT_SESSION_CURRENT_REQUESTS_CLIENT_CAPABILITY } from '../../../../src/shared/agent-session/requests/agent-session-current-requests-capability' -import '../../../../src/shared/protocol-version' +import '../../../../src/shared/remote-runtime/protocol/protocol-version' import { AGENT_STATUS_RESTORED_UNCONFIRMED_RUNTIME_CAPABILITY, SESSION_TABS_SPLIT_GROUP_PLACEMENT_RUNTIME_CAPABILITY diff --git a/src/cli/agents/agent-hooks.test.ts b/src/cli/agents/agent-hooks.test.ts index f99fbd6033c..d2a764fcf31 100644 --- a/src/cli/agents/agent-hooks.test.ts +++ b/src/cli/agents/agent-hooks.test.ts @@ -4,7 +4,7 @@ import type * as fs from 'node:fs' import { tmpdir } from 'node:os' import { join } from 'node:path' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { createDefaultLocalOrcaProfile } from '../../shared/orca-profiles' +import { createDefaultLocalOrcaProfile } from '../../shared/orca-profiles/orca-profiles' import { getOrcaProfileDataFile, getOrcaProfileStateDatabaseFile diff --git a/src/cli/agents/agent-hooks.ts b/src/cli/agents/agent-hooks.ts index eb1a438fe86..8b4a3c36b36 100644 --- a/src/cli/agents/agent-hooks.ts +++ b/src/cli/agents/agent-hooks.ts @@ -7,7 +7,7 @@ import type { RuntimeClient } from '../runtime/client' import type { RuntimeRpcSuccess } from '../../shared/remote-runtime/rpc/runtime-rpc-envelope' import { getDefaultUserDataPath } from '../runtime/profile/metadata' import type { AgentHookInstallStatus } from '../../shared/agent-hook-listener/configuration/agent-hook-types' -import { DEFAULT_LOCAL_ORCA_PROFILE_ID } from '../../shared/orca-profiles' +import { DEFAULT_LOCAL_ORCA_PROFILE_ID } from '../../shared/orca-profiles/orca-profiles' import type { GlobalSettings } from '../../shared/global-settings-types' import type { ProfileStateOfflineLocation } from '../../main/persistence/profile-state/offline-access/profile-state-offline-settings' diff --git a/src/cli/profiles/profile-state.test.ts b/src/cli/profiles/profile-state.test.ts index e410c225277..69bf38fc1e7 100644 --- a/src/cli/profiles/profile-state.test.ts +++ b/src/cli/profiles/profile-state.test.ts @@ -8,7 +8,7 @@ import { openProfileStateDatabase, openProfileStateDatabaseReadOnly } from '../../main/persistence/profile-state/database/profile-state-database' -import { profileStateDatabaseFile } from '../../shared/profile-state-storage-paths' +import { profileStateDatabaseFile } from '../../shared/orca-profiles/profile-state-storage-paths' import { exportProfileStateJson, importProfileStateJson diff --git a/src/cli/profiles/profile-state.ts b/src/cli/profiles/profile-state.ts index 7dd4d5aeebe..18c1118c073 100644 --- a/src/cli/profiles/profile-state.ts +++ b/src/cli/profiles/profile-state.ts @@ -17,7 +17,7 @@ import { type ProfileStateExportsResult, type ProfileStateRollbackResult, type ProfileStateRecoverySelector -} from '../../shared/profile-state-recovery-command' +} from '../../shared/orca-profiles/profile-state-recovery-command' import { canLaunchProfileStateRecovery, launchProfileStateRecovery diff --git a/src/cli/runtime/app-launch/electron-sandbox-switch.ts b/src/cli/runtime/app-launch/electron-sandbox-switch.ts index 6710498b1e4..8c681ba3718 100644 --- a/src/cli/runtime/app-launch/electron-sandbox-switch.ts +++ b/src/cli/runtime/app-launch/electron-sandbox-switch.ts @@ -1,7 +1,7 @@ import { existsSync } from 'node:fs' import { dirname, join } from 'node:path' import { runProcessSync } from '@orca/process-host' -import { ELECTRON_NO_SANDBOX_REQUEST_ENV } from '../../../shared/electron-no-sandbox-request' +import { ELECTRON_NO_SANDBOX_REQUEST_ENV } from '../../../shared/app-lifecycle/launch/electron-no-sandbox-request' const USER_NAMESPACE_PROBE_TIMEOUT_MS = 2_000 diff --git a/src/cli/runtime/client-environment-usage.test.ts b/src/cli/runtime/client-environment-usage.test.ts deleted file mode 100644 index 5a340ed231b..00000000000 --- a/src/cli/runtime/client-environment-usage.test.ts +++ /dev/null @@ -1,84 +0,0 @@ -import '../../shared/remote-runtime/host-store/environment-store-worker-test-fixture' -import type * as nodeFs from 'node:fs' -import { mkdtempSync, rmSync } from 'node:fs' -import { tmpdir } from 'node:os' -import { join } from 'node:path' -import { afterEach, expect, it, vi } from 'vitest' -import { RuntimeClient } from './client' -import { addEnvironmentFromPairingCode } from './pairing/environments' -import { encodePairingOffer } from '../../shared/remote-runtime/pairing/pairing' -import { RUNTIME_PROTOCOL_VERSION } from '../../shared/protocol-version' - -const mocks = vi.hoisted(() => { - const state: { unownedPath: string | null } = { unownedPath: null } - return { remote: vi.fn(), remotePreflight: vi.fn(), state } -}) - -vi.mock('./connection/websocket-transport', () => ({ - sendWebSocketRequest: mocks.remote, - sendWebSocketRequestWithStatusPreflight: mocks.remotePreflight -})) - -// A profile directory owned by another account refuses chmod even though it stays readable. -vi.mock('node:fs', async (importOriginal) => { - const actual = await importOriginal() - const chmodSync: typeof actual.chmodSync = (path, mode) => { - if (path === mocks.state.unownedPath) { - throw Object.assign(new Error(`EPERM: operation not permitted, chmod '${path}'`), { - code: 'EPERM' - }) - } - actual.chmodSync(path, mode) - } - return { ...actual, default: { ...actual, chmodSync }, chmodSync } -}) - -const roots: string[] = [] - -afterEach(() => { - vi.restoreAllMocks() - mocks.state.unownedPath = null - for (const root of roots.splice(0)) { - rmSync(root, { recursive: true, force: true }) - } -}) - -function success(result: unknown) { - return { id: 'request-1', ok: true, result, _meta: { runtimeId: 'runtime-remote' } } -} - -// Windows hardens the profile through ACLs, not chmod, so this EPERM cannot be injected there. -const posixIt = process.platform === 'win32' ? it.skip : it - -posixIt('returns remote replies when the saved environment store cannot be updated', async () => { - const root = mkdtempSync(join(tmpdir(), 'cli-env-usage-')) - roots.push(root) - const pairingCode = encodePairingOffer({ - v: 2, - endpoint: 'ws://127.0.0.1:6768', - deviceToken: 'fixture-token', - publicKeyB64: Buffer.from(new Uint8Array(32).fill(1)).toString('base64'), - scope: 'runtime' - }) - await addEnvironmentFromPairingCode(root, { name: 'workstation', pairingCode }) - mocks.state.unownedPath = root - vi.spyOn(console, 'warn').mockImplementation(() => {}) - mocks.remote.mockResolvedValue(success({ server: 'remote' })) - mocks.remotePreflight.mockImplementation( - async (_connection, _method, _params, _timeoutMs, validateStatus) => { - validateStatus( - success({ - runtimeProtocolVersion: RUNTIME_PROTOCOL_VERSION, - minCompatibleRuntimeClientVersion: RUNTIME_PROTOCOL_VERSION - }) - ) - return success({ worktrees: [] }) - } - ) - const client = new RuntimeClient(root, 5_000, null, 'workstation') - - // Last-used bookkeeping is best effort; it must not fail a command whose reply already arrived. - await expect(client.call('status.get')).resolves.toMatchObject({ result: { server: 'remote' } }) - await expect(client.call('worktree.list')).resolves.toMatchObject({ result: { worktrees: [] } }) - // Proves the store write really failed, so the replies above survived it rather than skipped it. -}) diff --git a/src/cli/runtime/client-recovery.test.ts b/src/cli/runtime/client-recovery.test.ts index 24047df7b38..fb7a819957a 100644 --- a/src/cli/runtime/client-recovery.test.ts +++ b/src/cli/runtime/client-recovery.test.ts @@ -4,7 +4,7 @@ import { mkdtempSync, writeFileSync } from 'node:fs' import { tmpdir } from 'node:os' import { join } from 'node:path' import { afterEach, describe, expect, it, vi } from 'vitest' -import '../../shared/protocol-version' +import '../../shared/remote-runtime/protocol/protocol-version' import '../orchestration/recovery/orchestration-mutation-recovery' import { reportCliError } from '../output/cli-error' import { RuntimeClient } from './client' diff --git a/src/cli/runtime/client.test.ts b/src/cli/runtime/client.test.ts index 47160c73eec..591541fbaac 100644 --- a/src/cli/runtime/client.test.ts +++ b/src/cli/runtime/client.test.ts @@ -4,7 +4,7 @@ import { tmpdir } from 'node:os' import { join } from 'node:path' import { createServer, type Socket } from 'node:net' import { afterEach, describe, expect, it, onTestFinished, vi } from 'vitest' -import '../../shared/protocol-version' +import '../../shared/remote-runtime/protocol/protocol-version' import { RuntimeClient } from './client' import { launchOrcaApp } from './launch' import '../output/cli-error' diff --git a/src/cli/runtime/client.ts b/src/cli/runtime/client.ts index 916ee6f0cb4..4838d16fec2 100644 --- a/src/cli/runtime/client.ts +++ b/src/cli/runtime/client.ts @@ -16,7 +16,7 @@ import { openLocalOrca } from './app-launch/open-local-orca' import { getDefaultUserDataPath, readMetadata } from './profile/metadata' import { getCliStatus, getOfflineRuntimeAdmission } from './status/status' import type { OfflineRuntimeAdmission } from './status/status' -import { projectRemoteAppStatus } from '../../shared/cli-app-status-projection' +import { projectRemoteAppStatus } from '../../shared/remote-runtime/session-graph/cli-app-status-projection' import { sendRequest } from './connection/transport' import { attachMutationRecovery, isRequestUnsent } from './connection/client-error-recovery' import { RuntimeClientError, RuntimeRpcFailureError } from './connection/types' diff --git a/src/cli/runtime/connection/remote-runtime-compat-gate.ts b/src/cli/runtime/connection/remote-runtime-compat-gate.ts index c63e1662280..c544b33f10e 100644 --- a/src/cli/runtime/connection/remote-runtime-compat-gate.ts +++ b/src/cli/runtime/connection/remote-runtime-compat-gate.ts @@ -6,7 +6,7 @@ import { import { MIN_COMPATIBLE_RUNTIME_SERVER_VERSION, RUNTIME_PROTOCOL_VERSION -} from '../../../shared/protocol-version' +} from '../../../shared/remote-runtime/protocol/protocol-version' import type { RuntimeRequestSelection, RuntimeOrchestrationEnvelope, diff --git a/src/cli/runtime/launch.ts b/src/cli/runtime/launch.ts index 8487c0b850d..752e67ca46c 100644 --- a/src/cli/runtime/launch.ts +++ b/src/cli/runtime/launch.ts @@ -10,8 +10,8 @@ import { pinServeUserDataPath, resolveLaunchUserDataPath } from './profile/launch-user-data-path' -import { foregroundServeIsolatedProfileSwitches } from '../../shared/electron-isolated-profile-switches' -import { headlessServeOzonePlatformSwitches } from '../../shared/headless-serve-ozone-platform' +import { foregroundServeIsolatedProfileSwitches } from '../../shared/app-lifecycle/launch/electron-isolated-profile-switches' +import { headlessServeOzonePlatformSwitches } from '../../shared/app-lifecycle/launch/headless-serve-ozone-platform' import { getMacAppBundlePath } from './serve/updates/mac-app-update-bundle' import { getPlatformUserDataPath } from './profile/metadata' import { isSameUserDataPath } from '../../shared/remote-runtime/serve-supervisor/serve-user-data-path' @@ -21,7 +21,7 @@ import { superviseForegroundServe } from './serve/updates/serve-update-supervisor' import { RuntimeClientError } from './connection/types' -import { BACKGROUND_OPEN_ARG } from '../../shared/background-open-argv' +import { BACKGROUND_OPEN_ARG } from '../../shared/app-lifecycle/launch/background-open-argv' import { getExecutableAppArgs, resolveAppRoot, @@ -32,7 +32,7 @@ import { SERVE_RUNTIME_ELECTRON, SERVE_RUNTIME_ENV } from '../../shared/remote-runtime/serve-supervisor/orcad-local-serve-selection' -import { findBundledWebClientRoot } from '../../shared/bundled-web-client-root' +import { findBundledWebClientRoot } from '../../shared/web-client/bundled-web-client-root' import { resolveLocalServeRuntime, serveWithOrcad } from './serve/startup/serve-orcad-launch' import { findAppSpeechRecognizerDir } from './app-launch/serve-speech-recognizer' import { diff --git a/src/cli/runtime/offline-admission-commands.test.ts b/src/cli/runtime/offline-admission-commands.test.ts index b7cbc4aa051..e3400910707 100644 --- a/src/cli/runtime/offline-admission-commands.test.ts +++ b/src/cli/runtime/offline-admission-commands.test.ts @@ -4,7 +4,7 @@ import { createServer, type Socket } from 'node:net' import { tmpdir } from 'node:os' import { join } from 'node:path' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { setAppEnvironment } from '../../shared/app-environment' +import { setAppEnvironment } from '../../shared/app-lifecycle/app-environment' import type * as ProcessHost from '@orca/process-host' import { main } from '../index' diff --git a/src/cli/runtime/orca-app-executable.ts b/src/cli/runtime/orca-app-executable.ts index a276b7c87fd..4fb54dddfe1 100644 --- a/src/cli/runtime/orca-app-executable.ts +++ b/src/cli/runtime/orca-app-executable.ts @@ -1,5 +1,5 @@ import { resolve } from 'node:path' -import { ELECTRON_NO_SANDBOX_REQUEST_ENV } from '../../shared/electron-no-sandbox-request' +import { ELECTRON_NO_SANDBOX_REQUEST_ENV } from '../../shared/app-lifecycle/launch/electron-no-sandbox-request' import { needsElectronNoSandbox } from './app-launch/electron-sandbox-switch' import { serverOnlyServeMessage } from './app-launch/serve-app-launcher' import { SERVE_SUPERVISOR_APP_ROOT_ENV } from './serve/supervision/serve-supervisor-relocation' diff --git a/src/cli/runtime/profile/profile-state-recovery-launch.ts b/src/cli/runtime/profile/profile-state-recovery-launch.ts index 6dd5ece315b..63dcff1a6cb 100644 --- a/src/cli/runtime/profile/profile-state-recovery-launch.ts +++ b/src/cli/runtime/profile/profile-state-recovery-launch.ts @@ -6,7 +6,7 @@ import { profileStateRecoveryResponseSchema, type ProfileStateRecoveryRequest, type ProfileStateRollbackResult -} from '../../../shared/profile-state-recovery-command' +} from '../../../shared/orca-profiles/profile-state-recovery-command' import { getExecutableAppArgs, resolveAppRoot, diff --git a/src/cli/runtime/serve/startup/serve-electron-preflight.ts b/src/cli/runtime/serve/startup/serve-electron-preflight.ts index 5597e69d5e8..3aac9837e4e 100644 --- a/src/cli/runtime/serve/startup/serve-electron-preflight.ts +++ b/src/cli/runtime/serve/startup/serve-electron-preflight.ts @@ -1,7 +1,7 @@ import { runProcessSync } from '@orca/process-host' import type { RuntimeMetadata } from '../../../../shared/remote-runtime/bootstrap/runtime-bootstrap' import type { RuntimeRpcFailure } from '../../../../shared/remote-runtime/rpc/runtime-rpc-envelope' -import { SINGLE_INSTANCE_ALREADY_RUNNING_EXIT_CODE } from '../../../../shared/single-instance-exit-code' +import { SINGLE_INSTANCE_ALREADY_RUNNING_EXIT_CODE } from '../../../../shared/app-lifecycle/launch/single-instance-exit-code' import { clearServeAbortPark, isServeAbortParkActive, diff --git a/src/cli/runtime/serve/supervision/serve-supervised-service.ts b/src/cli/runtime/serve/supervision/serve-supervised-service.ts index 91524ba5c98..350fa6a86a9 100644 --- a/src/cli/runtime/serve/supervision/serve-supervised-service.ts +++ b/src/cli/runtime/serve/supervision/serve-supervised-service.ts @@ -1,4 +1,4 @@ -import { SINGLE_INSTANCE_ALREADY_RUNNING_EXIT_CODE } from '../../../../shared/single-instance-exit-code' +import { SINGLE_INSTANCE_ALREADY_RUNNING_EXIT_CODE } from '../../../../shared/app-lifecycle/launch/single-instance-exit-code' import { ORCAD_EXIT_TERMINALS_NOT_DURABLE } from '../../../../shared/remote-runtime/serve-supervisor/serve-supervised-terminal-durability' import { orcadStaleLockReclaimCommand } from '../../../../shared/remote-runtime/orcad-lifecycle/orcad-stale-lock-reclaim' import { diff --git a/src/cli/runtime/serve/updates/serve-update-supervisor.ts b/src/cli/runtime/serve/updates/serve-update-supervisor.ts index 06d6648c2c5..5f5a8fc9deb 100644 --- a/src/cli/runtime/serve/updates/serve-update-supervisor.ts +++ b/src/cli/runtime/serve/updates/serve-update-supervisor.ts @@ -10,7 +10,7 @@ import { import { QUIT_RENDERER_ACK_TIMEOUT_MS, WILL_QUIT_TEARDOWN_DEADLINE_MS -} from '../../../../shared/quit-teardown-deadline' +} from '../../../../shared/app-lifecycle/shutdown/quit-teardown-deadline' import { serveSignalExitError } from '../startup/serve-signal-exit-diagnostic' import { waitForMacBundleVersion } from './mac-app-update-bundle' import { diff --git a/src/cli/runtime/status/status.ts b/src/cli/runtime/status/status.ts index 34c885274cd..a23bf342d1d 100644 --- a/src/cli/runtime/status/status.ts +++ b/src/cli/runtime/status/status.ts @@ -9,7 +9,7 @@ import { } from '../../../shared/remote-runtime/bootstrap/runtime-bootstrap' import { tryReadMetadata } from '../profile/metadata' import { sendRequest } from '../connection/transport' -import { resolveDesktopWindowStatus } from '../../../shared/cli-app-status-projection' +import { resolveDesktopWindowStatus } from '../../../shared/remote-runtime/session-graph/cli-app-status-projection' import { RuntimeClientError, RuntimeRpcFailureError } from '../connection/types' import type { RuntimeRpcResponse, diff --git a/src/cli/terminals/terminal-send.ts b/src/cli/terminals/terminal-send.ts index 2f421de127b..f43662f2afb 100644 --- a/src/cli/terminals/terminal-send.ts +++ b/src/cli/terminals/terminal-send.ts @@ -1,5 +1,5 @@ import type { RuntimeTerminalSend } from '../../shared/terminal/runtime/runtime-terminal-send-contract' -import '../../shared/protocol-version' +import '../../shared/remote-runtime/protocol/protocol-version' import { TERMINAL_PROMPT_DELIVERY_RUNTIME_CAPABILITY } from '../../shared/terminal/runtime-policy/terminal-runtime-capabilities' import type { CommandHandler } from '../dispatch/dispatch' import { formatTerminalSend, terminalSendWarnings } from './terminal-format' diff --git a/src/cli/terminals/terminal.test.ts b/src/cli/terminals/terminal.test.ts index 4737a2f9bc0..dbc3f89c3ec 100644 --- a/src/cli/terminals/terminal.test.ts +++ b/src/cli/terminals/terminal.test.ts @@ -1,7 +1,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest' import { RuntimeClient } from '../runtime/client' import type { CliStatusResult } from '../../shared/remote-runtime/session-graph/runtime-session-contracts' -import '../../shared/protocol-version' +import '../../shared/remote-runtime/protocol/protocol-version' import { TERMINAL_PROMPT_DELIVERY_RUNTIME_CAPABILITY } from '../../shared/terminal/runtime-policy/terminal-runtime-capabilities' import { TERMINAL_HANDLERS } from './terminal' diff --git a/src/cli/terminals/terminal.ts b/src/cli/terminals/terminal.ts index 187dd7d57e7..6f744f3dee9 100644 --- a/src/cli/terminals/terminal.ts +++ b/src/cli/terminals/terminal.ts @@ -38,7 +38,7 @@ import { isSupportedWindowsShellOverride, listSupportedWindowsShellOverrides } from '../../shared/shell/launch/windows-terminal-shell' -import '../../shared/protocol-version' +import '../../shared/remote-runtime/protocol/protocol-version' import { TERMINAL_CREATE_SHELL_SELECTION_RUNTIME_CAPABILITY, TERMINAL_SPLIT_RETRY_RUNTIME_CAPABILITY diff --git a/src/main/acp/launch/acp-launch-registry.ts b/src/main/acp/launch/acp-launch-registry.ts index eb647a816bb..6718f2b65f3 100644 --- a/src/main/acp/launch/acp-launch-registry.ts +++ b/src/main/acp/launch/acp-launch-registry.ts @@ -5,7 +5,7 @@ import { OPENCODE_ACP_DIALECT } from '../acp-dialects/opencode-dialect' import { directoryAccountBinding } from './acp-account-binding' import { openCodeAcpAccountBinding } from '../../opencode/accounts/opencode-structured-account-home' import { scrubOpenCodeAcpEnvironment } from '../../opencode/acp/opencode-acp-environment' -import { compareAppVersions } from '../../../shared/app-version' +import { compareAppVersions } from '../../../shared/app-lifecycle/identity/app-version' import { readGrokModelCatalog } from '../acp-dialects/grok-model-catalog' import { OPENCODE_MODEL_LISTING_ARGS, diff --git a/src/main/acp/launch/acp-visuals-skill.ts b/src/main/acp/launch/acp-visuals-skill.ts index 331817a6609..139ac10bfde 100644 --- a/src/main/acp/launch/acp-visuals-skill.ts +++ b/src/main/acp/launch/acp-visuals-skill.ts @@ -1,6 +1,6 @@ // ACP has no standard skill delivery; use each agent's per-process configuration. -import { hasReachedAppVersion } from '../../../shared/app-version' +import { hasReachedAppVersion } from '../../../shared/app-lifecycle/identity/app-version' import type { NativeChatVisualsSkillLocation } from '../../native-chat/conversation-files/native-chat-visuals-skill-location' export type AcpVisualsSkillInput = { diff --git a/src/main/acp/turns/acp-message-execution-options.ts b/src/main/acp/turns/acp-message-execution-options.ts index 50620a8b9e5..0364a9e729e 100644 --- a/src/main/acp/turns/acp-message-execution-options.ts +++ b/src/main/acp/turns/acp-message-execution-options.ts @@ -5,7 +5,7 @@ import { } from '../../../shared/agent-session/failures/agent-session-failure' import type { AgentSessionExecutionOptions } from '../../../shared/agent-session/options/protocol/agent-session-execution-options' import { AgentSessionOptionRejectedError } from '../../native-chat/agent-session-wire/options/structured-agent-session-option-error' -import { compareAppVersions } from '../../../shared/app-version' +import { compareAppVersions } from '../../../shared/app-lifecycle/identity/app-version' import { AcpAgentError } from '../transport/acp-errors' import { AcpModelCommandRefusedError } from './acp-model-command' import type { AcpStructuredSession } from '../session/acp-structured-session-contract' diff --git a/src/main/agent-launch/agent-launch-mode.ts b/src/main/agent-launch/agent-launch-mode.ts index 275be699883..18b7c6d3c67 100644 --- a/src/main/agent-launch/agent-launch-mode.ts +++ b/src/main/agent-launch/agent-launch-mode.ts @@ -5,7 +5,7 @@ import type { AgentLaunchModeReason, AgentLaunchModeReceipt } from '../../shared/agent-launch/contracts/agent-launch-intent' -import { RUNTIME_CAPABILITIES } from '../../shared/protocol-version' +import { RUNTIME_CAPABILITIES } from '../../shared/remote-runtime/protocol/protocol-version' import { STRUCTURED_AGENT_RUNTIME_METADATA } from '../runtime/agent-session/installation/structured-agent-runtime-metadata' import { nativeChatPreferenceFor, diff --git a/src/main/agent-launch/preflight/agent-cli-version-probe.ts b/src/main/agent-launch/preflight/agent-cli-version-probe.ts index 84dc4ba53d8..4993c4e2320 100644 --- a/src/main/agent-launch/preflight/agent-cli-version-probe.ts +++ b/src/main/agent-launch/preflight/agent-cli-version-probe.ts @@ -2,7 +2,10 @@ import { assertStructuredAgentResolutionCurrent, type StructuredAgentResolutionOperation } from '../../native-chat/agent-launch/structured-agent-command-resolution' -import { compareAppVersions, parseCliVersion } from '../../../shared/app-version' +import { + compareAppVersions, + parseCliVersion +} from '../../../shared/app-lifecycle/identity/app-version' import { runProcess } from '@orca/process-host' import type { ProcessSpec } from '@orca/process-host/process-spec' diff --git a/src/main/ai-vault/scanners/opencode/reader-transport/opencode-wsl-runtime-preparation.test.ts b/src/main/ai-vault/scanners/opencode/reader-transport/opencode-wsl-runtime-preparation.test.ts index e4c55153c3a..33b051741aa 100644 --- a/src/main/ai-vault/scanners/opencode/reader-transport/opencode-wsl-runtime-preparation.test.ts +++ b/src/main/ai-vault/scanners/opencode/reader-transport/opencode-wsl-runtime-preparation.test.ts @@ -15,7 +15,7 @@ const mocks = vi.hoisted(() => ({ bundles: vi.fn((platform: string) => [`C:/relay/${platform}`]) })) vi.mock('node:fs', () => ({ existsSync: mocks.exists })) -vi.mock('../../../../../shared/app-environment', () => ({ +vi.mock('../../../../../shared/app-lifecycle/app-environment', () => ({ getAppEnvironment: () => ({ getAppPath: () => 'C:/app', getPath: () => 'C:/profile' diff --git a/src/main/ai-vault/scanners/opencode/reader-transport/opencode-wsl-runtime-preparation.ts b/src/main/ai-vault/scanners/opencode/reader-transport/opencode-wsl-runtime-preparation.ts index 5bedf9542ef..bea226199f3 100644 --- a/src/main/ai-vault/scanners/opencode/reader-transport/opencode-wsl-runtime-preparation.ts +++ b/src/main/ai-vault/scanners/opencode/reader-transport/opencode-wsl-runtime-preparation.ts @@ -1,7 +1,7 @@ import { randomBytes } from 'node:crypto' import { existsSync } from 'node:fs' import { basename, join } from 'node:path' -import { getAppEnvironment } from '../../../../../shared/app-environment' +import { getAppEnvironment } from '../../../../../shared/app-lifecycle/app-environment' import { waitForPromiseWithSignal } from '../../../../../shared/concurrency/abort-signal-reason' import type { ServerTarget } from '../../../../../shared/node-runtime/node-runtime-pin' import { OPENCODE_SQLITE_READER_FILENAME } from '../../../../../shared/remote-runtime/orcad-distribution/remote-bundle-artifacts' diff --git a/src/main/antigravity/antigravity-host-acp.ts b/src/main/antigravity/antigravity-host-acp.ts index 8d1e25dde56..c6e53207c18 100644 --- a/src/main/antigravity/antigravity-host-acp.ts +++ b/src/main/antigravity/antigravity-host-acp.ts @@ -10,7 +10,10 @@ import { type AgentSessionAccountHome } from '../../shared/agent-session/lifecycle/accounts/agent-session-account-home' import { ANTIGRAVITY_ACP_HOME } from '../../shared/agent-session/lifecycle/provider-handles/antigravity-session-origin' -import { compareAppVersions, isValidAppVersion } from '../../shared/app-version' +import { + compareAppVersions, + isValidAppVersion +} from '../../shared/app-lifecycle/identity/app-version' import { initializeAntigravityAcp } from './antigravity-acp-runtime-probe' import { createAntigravityHostCredentialBackend, diff --git a/src/main/antigravity/native-account-host.test.ts b/src/main/antigravity/native-account-host.test.ts deleted file mode 100644 index d8196fed83b..00000000000 --- a/src/main/antigravity/native-account-host.test.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { expect, it, vi } from 'vitest' -import { join } from 'node:path' -import { - getAntigravityAccountService, - setAntigravityNativeCredentialChangeListener -} from './native-account-host' -import { createAntigravityHostCredentialBackend } from './native-credential-backend' -import { createEncryptedAntigravityAccountStore } from './native-account-store' -import { credential, harness, refreshedWithoutIdToken } from './native-account-test-fixtures' -import { parseAntigravityWindowsSnapshot } from './native-windows-token-decode' -import './native-wsl-credentials' - -void process.platform - -vi.mock('./native-credential-backend', () => ({ createAntigravityHostCredentialBackend: vi.fn() })) -vi.mock('./native-account-store', () => ({ createEncryptedAntigravityAccountStore: vi.fn() })) -vi.mock('./native-wsl-credentials', () => ({ createAntigravityWslCredentialBackend: vi.fn() })) -vi.mock('../wsl/discovery/wsl-default-distro', () => ({ - resolveWslDefaultDistro: async () => 'Ubuntu' -})) -vi.mock('../../shared/app-environment', () => ({ - getAppEnvironment: () => ({ getPath: () => '/task/home' }) -})) - -it('reports new credentials and verified account switches, but not baseline reads or sign-out', async () => { - const h = harness() - const parse = vi.fn(parseAntigravityWindowsSnapshot) - h.backend.parse = parse - vi.mocked(createAntigravityHostCredentialBackend).mockReturnValue(h.backend) - vi.mocked(createEncryptedAntigravityAccountStore).mockReturnValue(h.store) - const changed = vi.fn() - setAntigravityNativeCredentialChangeListener(changed) - const service = await getAntigravityAccountService({ runtime: 'host' }) - expect(createEncryptedAntigravityAccountStore).toHaveBeenCalledWith( - join('/task/home', 'antigravity-accounts', 'vault'), - parse - ) - expect(await getAntigravityAccountService({ runtime: 'host' })).toBe(service) - expect(createAntigravityHostCredentialBackend).toHaveBeenCalledTimes(1) - - const a = (await service.addCurrentAccount()).activeAccountId! - await service.listAccounts() - expect(changed).not.toHaveBeenCalled() - - h.setNative(null) - await service.listAccounts() - expect(changed).not.toHaveBeenCalled() - - h.setNative(credential('b')) - await service.addCurrentAccount() - expect(changed).toHaveBeenCalledTimes(1) - await service.selectAccount(a) - expect(parse).toHaveBeenCalledWith(credential('a')) - expect(changed).toHaveBeenCalledTimes(2) - await service.listAccounts() - expect(changed).toHaveBeenCalledTimes(2) - - // Signing in again to the same account issues a new grant, which must clear a sign-in hold. - h.setNative(credential('a', 2)) - await service.listAccounts() - expect(changed).toHaveBeenCalledTimes(3) - - h.setNative(refreshedWithoutIdToken(3, 'refresh-2')) - await service.listAccounts() - expect(changed).toHaveBeenCalledTimes(3) -}) diff --git a/src/main/antigravity/native-account-host.ts b/src/main/antigravity/native-account-host.ts index fd004ab4ba0..8e2fd05683f 100644 --- a/src/main/antigravity/native-account-host.ts +++ b/src/main/antigravity/native-account-host.ts @@ -1,5 +1,5 @@ import { join } from 'node:path' -import { getAppEnvironment } from '../../shared/app-environment' +import { getAppEnvironment } from '../../shared/app-lifecycle/app-environment' import type { AntigravityAccountTarget } from '../../shared/agent-accounts/antigravity/antigravity-account-types' import { createEncryptedAntigravityAccountStore } from './native-account-store' import type { AntigravityNativeCredential } from './native-credential-codec' diff --git a/src/main/antigravity/native-account-launch.ts b/src/main/antigravity/native-account-launch.ts index 384b1e778fe..00ea3f6522e 100644 --- a/src/main/antigravity/native-account-launch.ts +++ b/src/main/antigravity/native-account-launch.ts @@ -1,6 +1,6 @@ import { existsSync } from 'node:fs' import { resolve } from 'node:path' -import { getAppEnvironment } from '../../shared/app-environment' +import { getAppEnvironment } from '../../shared/app-lifecycle/app-environment' import { recognizeAgentProcessFromCommandLine } from '../../shared/agent-status/process/agent-process-recognition' import { isAntigravityFileStorageHost } from './native-credential-backend' import { createEncryptedAntigravityAccountStore } from './native-account-store' diff --git a/src/main/artifacts/artifact-cloud-service.test.ts b/src/main/artifacts/artifact-cloud-service.test.ts index 9f794b2763c..a816bc1b8a4 100644 --- a/src/main/artifacts/artifact-cloud-service.test.ts +++ b/src/main/artifacts/artifact-cloud-service.test.ts @@ -8,7 +8,7 @@ vi.mock('electron', () => ({ safeStorage: { isEncryptionAvailable: () => false } })) -import type { OrcaProfileCloudSummary } from '../../shared/orca-profiles' +import type { OrcaProfileCloudSummary } from '../../shared/orca-profiles/orca-profiles' import { ensureActiveOrcaProfile } from '../orca-profiles/profile-index-store' import { linkOrcaProfileToCloud, diff --git a/src/main/automations/ownership/orcad-fenced-automation.ts b/src/main/automations/ownership/orcad-fenced-automation.ts index 3578b85e420..9435db318e4 100644 --- a/src/main/automations/ownership/orcad-fenced-automation.ts +++ b/src/main/automations/ownership/orcad-fenced-automation.ts @@ -1,4 +1,4 @@ -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import type { Automation } from '../../../shared/automations/automation-definition' import type { SshTarget } from '../../../shared/remote-runtime/ssh/ssh-types' import type { Store } from '../../persistence/loading-store/store' diff --git a/src/main/backend/backend-entry.ts b/src/main/backend/backend-entry.ts index 6cc9025ed9d..54eb8cb9fbe 100644 --- a/src/main/backend/backend-entry.ts +++ b/src/main/backend/backend-entry.ts @@ -5,7 +5,7 @@ import { BACKEND_CAPABILITIES } from '../../shared/backend/backend-service-contract' import { BackendPortRpc } from '../../shared/backend/backend-port-rpc' -import { setAppEnvironment } from '../../shared/app-environment' +import { setAppEnvironment } from '../../shared/app-lifecycle/app-environment' import { agentTokenUsageSchema } from '../../shared/telemetry/schemas/telemetry-agent-token-usage-schema' import { backendMessagePort, type BackendNativePort } from './backend-message-port' import { createDesktopBackendEnvironment } from './node-service-environment' diff --git a/src/main/backend/core-runtime-activation.ts b/src/main/backend/core-runtime-activation.ts index 493670336de..b5f9c0fc56e 100644 --- a/src/main/backend/core-runtime-activation.ts +++ b/src/main/backend/core-runtime-activation.ts @@ -4,7 +4,7 @@ import type { BackendCoreProfileShutdown } from './core-profile-shutdown' import { prepareBackendDaemon } from './core-daemon-startup' import { prepareWorktreeRemovalsForStore } from '../workspaces/removal/worktree-removal-records-load' import { worktreeRemovalLifetime } from '../workspaces/removal/worktree-removal-lifetime' -import { getAppEnvironment } from '../../shared/app-environment' +import { getAppEnvironment } from '../../shared/app-lifecycle/app-environment' import { describeOrcadBindExposure, resolveOrcadBindHost diff --git a/src/main/backend/core-runtime.ts b/src/main/backend/core-runtime.ts index ca230571f42..f267f790418 100644 --- a/src/main/backend/core-runtime.ts +++ b/src/main/backend/core-runtime.ts @@ -1,4 +1,4 @@ -import { getAppEnvironment } from '../../shared/app-environment' +import { getAppEnvironment } from '../../shared/app-lifecycle/app-environment' import { startOrcadWithHost } from '../orcad/host-lifecycle/orcad-lifecycle' import type { OrcadHandle, OrcadOptions } from '../orcad/serve-startup/orcad-start-contract' import { activateBackendServices } from './service-composition' diff --git a/src/main/backend/node-service-environment.ts b/src/main/backend/node-service-environment.ts index efda3ffe7b5..8e38115a9cf 100644 --- a/src/main/backend/node-service-environment.ts +++ b/src/main/backend/node-service-environment.ts @@ -1,4 +1,4 @@ -import type { AppEnvironment } from '../../shared/app-environment' +import type { AppEnvironment } from '../../shared/app-lifecycle/app-environment' import type { BackendBootstrap } from '../../shared/backend/backend-service-contract' export function createDesktopBackendEnvironment(config: BackendBootstrap) { diff --git a/src/main/browser/sessions/profiles/browser-session-persisted-profile-validation.ts b/src/main/browser/sessions/profiles/browser-session-persisted-profile-validation.ts index 9678f3d5148..ca9de6180e1 100644 --- a/src/main/browser/sessions/profiles/browser-session-persisted-profile-validation.ts +++ b/src/main/browser/sessions/profiles/browser-session-persisted-profile-validation.ts @@ -1,4 +1,4 @@ -import { getOrcaProfileBrowserSessionPartition } from '../../../../shared/orca-profiles' +import { getOrcaProfileBrowserSessionPartition } from '../../../../shared/orca-profiles/orca-profiles' import type { BrowserSessionProfile } from '../../../../shared/browser/workspaces/browser-workspace-types' const BROWSER_SESSION_PROFILE_ID_RE = diff --git a/src/main/browser/sessions/profiles/browser-session-registry.test.ts b/src/main/browser/sessions/profiles/browser-session-registry.test.ts index d08240e66d5..9350ba8dc63 100644 --- a/src/main/browser/sessions/profiles/browser-session-registry.test.ts +++ b/src/main/browser/sessions/profiles/browser-session-registry.test.ts @@ -68,7 +68,7 @@ import { import { setBrowserNetworkProxySettingsResolver } from '../proxy/browser-session-proxy' import { handleElectronProxyLogin } from '../../../network/electron-proxy-credentials' import { applyProxySettingsToSession } from '../../../network/proxy-settings' -import { DEFAULT_LOCAL_ORCA_PROFILE_ID } from '../../../../shared/orca-profiles' +import { DEFAULT_LOCAL_ORCA_PROFILE_ID } from '../../../../shared/orca-profiles/orca-profiles' describe('BrowserSessionRegistry', () => { let profileDirectory: string @@ -149,25 +149,6 @@ describe('BrowserSessionRegistry', () => { expect(navigate).toHaveBeenCalledTimes(1) }) - it('rejects and rolls back a runtime profile when its proxy cannot be applied', async () => { - const before = browserSessionRegistry.listProfiles().length - const proxySession = sessionFromPartitionMock() - proxySession.setProxy.mockRejectedValue(new Error('proxy unavailable')) - sessionFromPartitionMock.mockReturnValue(proxySession) - setBrowserNetworkProxySettingsResolver(() => ({ - httpProxyUrl: 'socks5://127.0.0.1:1080', - httpProxyBypassRules: '' - })) - - await expect(browserSessionRegistry.createProfile('isolated', 'Proxy Failure')).rejects.toThrow( - 'proxy unavailable' - ) - - expect(browserSessionRegistry.listProfiles()).toHaveLength(before) - expect(proxySession.setPermissionRequestHandler).toHaveBeenLastCalledWith(null) - expect(proxySession.setPermissionCheckHandler).toHaveBeenLastCalledWith(null) - }) - it('retires credentials when profile creation and proxy rollback both fail', async () => { const proxySession = sessionFromPartitionMock() proxySession.setProxy diff --git a/src/main/browser/sessions/profiles/browser-session-registry.ts b/src/main/browser/sessions/profiles/browser-session-registry.ts index dfca95217b5..5e1ce6020d2 100644 --- a/src/main/browser/sessions/profiles/browser-session-registry.ts +++ b/src/main/browser/sessions/profiles/browser-session-registry.ts @@ -7,7 +7,7 @@ import { DEFAULT_LOCAL_ORCA_PROFILE_ID, getOrcaProfileBrowserDefaultPartition, getOrcaProfileBrowserSessionPartition -} from '../../../../shared/orca-profiles' +} from '../../../../shared/orca-profiles/orca-profiles' import type { BrowserSessionProfile, BrowserSessionProfileScope diff --git a/src/main/claude-accounts/profiles/wsl/claude-profile-wsl-router.ts b/src/main/claude-accounts/profiles/wsl/claude-profile-wsl-router.ts index 9a749821aa0..509666496e9 100644 --- a/src/main/claude-accounts/profiles/wsl/claude-profile-wsl-router.ts +++ b/src/main/claude-accounts/profiles/wsl/claude-profile-wsl-router.ts @@ -1,7 +1,7 @@ import { existsSync } from 'node:fs' import { lstat, readFile } from 'node:fs/promises' import { join, posix } from 'node:path' -import { getAppEnvironment } from '../../../../shared/app-environment' +import { getAppEnvironment } from '../../../../shared/app-lifecycle/app-environment' import { CLAUDE_INJECTED_CONFIG_DIR_ENV, CLAUDE_PROFILE_POINTER_ENV, diff --git a/src/main/claude-accounts/runtime-auth-service.ts b/src/main/claude-accounts/runtime-auth-service.ts index 614a41b04f2..2690874d731 100644 --- a/src/main/claude-accounts/runtime-auth-service.ts +++ b/src/main/claude-accounts/runtime-auth-service.ts @@ -1,5 +1,5 @@ import { join } from 'node:path' -import { getAppEnvironment } from '../../shared/app-environment' +import { getAppEnvironment } from '../../shared/app-lifecycle/app-environment' import { toWindowsWslPath } from '../../shared/file-access/wsl-paths' import { resolveLocalAccountRuntimeTarget } from '../../shared/agent-accounts/local-account-runtime' import type { Store } from '../persistence/loading-store/store' diff --git a/src/main/claude/agent-view/agent-view-service.ts b/src/main/claude/agent-view/agent-view-service.ts index 145e9c81e06..64ee0357ab5 100644 --- a/src/main/claude/agent-view/agent-view-service.ts +++ b/src/main/claude/agent-view/agent-view-service.ts @@ -1,6 +1,6 @@ import { homedir } from 'node:os' import { join, resolve } from 'node:path' -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import type { GlobalSettings } from '../../../shared/global-settings-types' import { isAgentStatusHooksEnabledForAgent } from '../../../shared/agent-hook-listener/configuration/agent-status-hooks-setting' import { getAgentLaunchExecutableName } from '../../../shared/agent-launch/startup/agent-command-line-intent' diff --git a/src/main/claude/cli-capabilities/claude-hook-event-versions.ts b/src/main/claude/cli-capabilities/claude-hook-event-versions.ts index 27910729429..158b1423bc0 100644 --- a/src/main/claude/cli-capabilities/claude-hook-event-versions.ts +++ b/src/main/claude/cli-capabilities/claude-hook-event-versions.ts @@ -1,4 +1,7 @@ -import { hasReachedAppVersion, isValidAppVersion } from '../../../shared/app-version' +import { + hasReachedAppVersion, + isValidAppVersion +} from '../../../shared/app-lifecycle/identity/app-version' import { runProcess } from '@orca/process-host' import path from 'node:path' diff --git a/src/main/claude/hook-service.ts b/src/main/claude/hook-service.ts index b741945d9fb..0bf48c92a0f 100644 --- a/src/main/claude/hook-service.ts +++ b/src/main/claude/hook-service.ts @@ -1,5 +1,5 @@ import { rmSync } from 'node:fs' -import { getAppEnvironment } from '../../shared/app-environment' +import { getAppEnvironment } from '../../shared/app-lifecycle/app-environment' import { listClaudeProfileHomes, listClaudeProfileHomesAsync diff --git a/src/main/cli/cli-installer.ts b/src/main/cli/cli-installer.ts index e0a383d7e76..389cd7c3326 100644 --- a/src/main/cli/cli-installer.ts +++ b/src/main/cli/cli-installer.ts @@ -1,6 +1,6 @@ import { mkdir, unlink } from 'node:fs/promises' import { dirname } from 'node:path' -import type { CliInstallStatus } from '../../shared/cli-install-types' +import type { CliInstallStatus } from '../../shared/cli/cli-install-types' import { pruneAppImageExtractedRoots, removeAppImageInstalledPayloads diff --git a/src/main/cli/command-paths/cli-path-registration.ts b/src/main/cli/command-paths/cli-path-registration.ts index e0a8d02846a..0168067bc7c 100644 --- a/src/main/cli/command-paths/cli-path-registration.ts +++ b/src/main/cli/command-paths/cli-path-registration.ts @@ -1,4 +1,4 @@ -import type { CliInstallStatus } from '../../../shared/cli-install-types' +import type { CliInstallStatus } from '../../../shared/cli/cli-install-types' import { CliCommandInstallation } from '../installation/cli-command-installation' import { isWindowsUserPathPermissionError } from '../installation/cli-install-errors' import { samePathEntry, splitPathEntries } from './cli-install-path-format' diff --git a/src/main/cli/installation/cli-command-filesystem-transaction.ts b/src/main/cli/installation/cli-command-filesystem-transaction.ts index f378e4279e9..550b45a4543 100644 --- a/src/main/cli/installation/cli-command-filesystem-transaction.ts +++ b/src/main/cli/installation/cli-command-filesystem-transaction.ts @@ -1,7 +1,7 @@ import { createHash, randomUUID } from 'node:crypto' import { lstat, mkdir, readdir, readFile, readlink, rename, rmdir, stat } from 'node:fs/promises' import { basename, dirname, join } from 'node:path' -import type { CliInstallStatus } from '../../../shared/cli-install-types' +import type { CliInstallStatus } from '../../../shared/cli/cli-install-types' import { isPermissionError } from '../../filesystem/permission-errors' import { isMissingError } from './cli-install-errors' import { quotePosixShellDoubleQuotedApostrophe } from '../../../shared/shell/launch/shell-argument-quoting' diff --git a/src/main/cli/installation/cli-command-inspection.ts b/src/main/cli/installation/cli-command-inspection.ts index 1b64464cbda..5920a642811 100644 --- a/src/main/cli/installation/cli-command-inspection.ts +++ b/src/main/cli/installation/cli-command-inspection.ts @@ -1,7 +1,7 @@ import { existsSync } from 'node:fs' import { lstat, readFile, readlink } from 'node:fs/promises' import { basename, dirname, resolve } from 'node:path' -import type { CliInstallMethod, CliInstallStatus } from '../../../shared/cli-install-types' +import type { CliInstallMethod, CliInstallStatus } from '../../../shared/cli/cli-install-types' import { isAppImageExtractedLauncherPath } from '../appimage/appimage-extracted-root' import { DEV_COMMAND_NAME, DEV_LAUNCHER_DIR } from './cli-install-constants' import { diff --git a/src/main/cli/installation/cli-command-installation.ts b/src/main/cli/installation/cli-command-installation.ts index 3b9d511c650..7f097518b1b 100644 --- a/src/main/cli/installation/cli-command-installation.ts +++ b/src/main/cli/installation/cli-command-installation.ts @@ -1,6 +1,6 @@ import { link, readlink, rmdir, symlink, unlink, writeFile } from 'node:fs/promises' import { basename, dirname, join, resolve } from 'node:path' -import type { CliInstallStatus } from '../../../shared/cli-install-types' +import type { CliInstallStatus } from '../../../shared/cli/cli-install-types' import { ensureAppImageExtractedRoot, isAppImageExtractedLauncherPath, diff --git a/src/main/cli/installation/cli-install-location.ts b/src/main/cli/installation/cli-install-location.ts index 4751f04462d..a9ddf6b191b 100644 --- a/src/main/cli/installation/cli-install-location.ts +++ b/src/main/cli/installation/cli-install-location.ts @@ -1,8 +1,8 @@ import { existsSync } from 'node:fs' import { homedir } from 'node:os' import { basename, dirname, join } from 'node:path' -import { getAppEnvironment } from '../../../shared/app-environment' -import type { CliInstallStatus } from '../../../shared/cli-install-types' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' +import type { CliInstallStatus } from '../../../shared/cli/cli-install-types' import { hasAppImagePathEnvironment, resolveAppImageRuntimeIdentity diff --git a/src/main/cli/installation/cli-installer-contracts.ts b/src/main/cli/installation/cli-installer-contracts.ts index de131ff37a8..d501eda3497 100644 --- a/src/main/cli/installation/cli-installer-contracts.ts +++ b/src/main/cli/installation/cli-installer-contracts.ts @@ -1,4 +1,4 @@ -import type { CliInstallMethod } from '../../../shared/cli-install-types' +import type { CliInstallMethod } from '../../../shared/cli/cli-install-types' import type { WindowsUserPathReadResult } from '../command-paths/windows-user-path-registry' export type CliInstallerOptions = { diff --git a/src/main/cli/launchers/orca-cli-child-path.ts b/src/main/cli/launchers/orca-cli-child-path.ts index 82d10f4b835..5a70fcf6b6f 100644 --- a/src/main/cli/launchers/orca-cli-child-path.ts +++ b/src/main/cli/launchers/orca-cli-child-path.ts @@ -1,6 +1,6 @@ // PTY and structured children must reach this app's CLI regardless of global registration. import { delimiter, dirname, join } from 'node:path' -import { getAppEnvironment, hasAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment, hasAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { readInheritedPath } from '../../ipc/pty/host-env/path' import { resolvePathEnvKey } from '../../pty/environment/windows-path-segment-merge' import { ensureLinuxTerminalOrcaCliShimDir } from './linux-terminal-orca-cli-shim' diff --git a/src/main/cli/wsl/wsl-cli-installer.ts b/src/main/cli/wsl/wsl-cli-installer.ts index b2c33e1cc4c..7516238fc7e 100644 --- a/src/main/cli/wsl/wsl-cli-installer.ts +++ b/src/main/cli/wsl/wsl-cli-installer.ts @@ -1,4 +1,4 @@ -import type { CliInstallStatus } from '../../../shared/cli-install-types' +import type { CliInstallStatus } from '../../../shared/cli/cli-install-types' import { getDefaultWslDistro } from '../../wsl/discovery/distro-catalog' import { runWslProcess } from '../../wsl/execution/wsl-runner' import { describeWslProcessFailure } from '../../wsl/execution/wsl-process-failure' diff --git a/src/main/cli/wsl/wsl-cli-registration-command.ts b/src/main/cli/wsl/wsl-cli-registration-command.ts index 8f2d42b6fcc..bd57803cc3c 100644 --- a/src/main/cli/wsl/wsl-cli-registration-command.ts +++ b/src/main/cli/wsl/wsl-cli-registration-command.ts @@ -1,4 +1,4 @@ -import type { CliInstallStatus } from '../../../shared/cli-install-types' +import type { CliInstallStatus } from '../../../shared/cli/cli-install-types' import { buildManagedLegacyRemoveCommand, buildRegistrationLockPrelude, diff --git a/src/main/cli/wsl/wsl-cli-registration-reconciliation.ts b/src/main/cli/wsl/wsl-cli-registration-reconciliation.ts index a95e44ce239..7a3ec528dbd 100644 --- a/src/main/cli/wsl/wsl-cli-registration-reconciliation.ts +++ b/src/main/cli/wsl/wsl-cli-registration-reconciliation.ts @@ -1,4 +1,4 @@ -import type { CliInstallState, CliInstallStatus } from '../../../shared/cli-install-types' +import type { CliInstallState, CliInstallStatus } from '../../../shared/cli/cli-install-types' import { listWslDistrosAsync } from '../../wsl/discovery/distro-catalog' import { deferUntilWslDistroRunning, diff --git a/src/main/cli/wsl/wsl-cli-status.ts b/src/main/cli/wsl/wsl-cli-status.ts index e17c69badd5..3c05e4908fe 100644 --- a/src/main/cli/wsl/wsl-cli-status.ts +++ b/src/main/cli/wsl/wsl-cli-status.ts @@ -1,4 +1,4 @@ -import type { CliInstallStatus } from '../../../shared/cli-install-types' +import type { CliInstallStatus } from '../../../shared/cli/cli-install-types' import { getBridgePathFromCommandPath, getPosixDirname } from './wsl-cli-scripts' import { quotePosixShellDoubleQuotedApostrophe } from '../../../shared/shell/launch/shell-argument-quoting' diff --git a/src/main/cli/wsl/wsl-managed-cli.ts b/src/main/cli/wsl/wsl-managed-cli.ts index 80d4119ea44..d9d366a3dcb 100644 --- a/src/main/cli/wsl/wsl-managed-cli.ts +++ b/src/main/cli/wsl/wsl-managed-cli.ts @@ -1,7 +1,7 @@ import { createHash } from 'node:crypto' import { existsSync } from 'node:fs' import { join } from 'node:path' -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { windowsPowerShellPath } from '@orca/process-host/windows-system-binary' import { writeShellWrapperFiles } from '../../pty/shell-startup/shell-wrapper-file-writer' import { diff --git a/src/main/codex-accounts/managed-homes/codex-managed-home-path.ts b/src/main/codex-accounts/managed-homes/codex-managed-home-path.ts index 43afa9b364b..2a490964bda 100644 --- a/src/main/codex-accounts/managed-homes/codex-managed-home-path.ts +++ b/src/main/codex-accounts/managed-homes/codex-managed-home-path.ts @@ -1,6 +1,6 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs' import { join, resolve } from 'node:path' -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { buildPosixStdoutFence } from '../../../shared/shell/launch/posix-stdout-fence' import { quotePosixShell } from '../../../shared/shell/launch/shell-argument-quoting' import { parseWslUncPath, toWindowsWslPath } from '../../../shared/file-access/wsl-paths' diff --git a/src/main/codex-accounts/runtime-home/runtime-home-service-paths.ts b/src/main/codex-accounts/runtime-home/runtime-home-service-paths.ts index e7c4d06fec9..3fd75f40b0c 100644 --- a/src/main/codex-accounts/runtime-home/runtime-home-service-paths.ts +++ b/src/main/codex-accounts/runtime-home/runtime-home-service-paths.ts @@ -7,7 +7,7 @@ import { symlinkSync, unlinkSync } from 'node:fs' -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { dirname, isAbsolute, join, resolve } from 'node:path' import { getOrcaManagedCodexHomePath, diff --git a/src/main/computer/sidecar-transport/sidecar-client.test.ts b/src/main/computer/sidecar-transport/sidecar-client.test.ts index 8d395f20739..504a6d50241 100644 --- a/src/main/computer/sidecar-transport/sidecar-client.test.ts +++ b/src/main/computer/sidecar-transport/sidecar-client.test.ts @@ -24,7 +24,7 @@ vi.mock('node:fs', async (importOriginal) => ({ existsSync: existsSyncMock })) -vi.mock('../../../shared/app-environment', () => ({ +vi.mock('../../../shared/app-lifecycle/app-environment', () => ({ hasAppEnvironment: () => appEnvironment.current !== null, getAppEnvironment: () => appEnvironment.current })) diff --git a/src/main/connector-cloud/connector-cloud-install.ts b/src/main/connector-cloud/connector-cloud-install.ts index 33dd0195a1d..c3525197457 100644 --- a/src/main/connector-cloud/connector-cloud-install.ts +++ b/src/main/connector-cloud/connector-cloud-install.ts @@ -1,5 +1,5 @@ import { hostname } from 'node:os' -import { getAppEnvironment } from '../../shared/app-environment' +import { getAppEnvironment } from '../../shared/app-lifecycle/app-environment' import { admitConnectorAgent, CONNECTOR_AGENTS } from '../external-conversations/connector-agents' import { runtimeConversationHost } from '../external-conversations/external-conversation-seam' import { getOrcaCloudAuthConfig } from '../orca-profiles/cloud-auth/profile-cloud-auth-config' diff --git a/src/main/daemon/endpoint/identity/daemon-incarnation-evidence-types.ts b/src/main/daemon/endpoint/identity/daemon-incarnation-evidence-types.ts index 232649b6203..cd5cda8890d 100644 --- a/src/main/daemon/endpoint/identity/daemon-incarnation-evidence-types.ts +++ b/src/main/daemon/endpoint/identity/daemon-incarnation-evidence-types.ts @@ -5,7 +5,7 @@ import type { DaemonProcessGoneReason, DaemonProcessPresentReason, DaemonProcessUnknownReason -} from '../../../../shared/daemon-audit-eligibility' +} from '../../../../shared/terminal/daemon/daemon-audit-eligibility' export const WINDOWS_CREATION_TIME_TOLERANCE_MS = 10_000 diff --git a/src/main/daemon/endpoint/publication/testing/daemon-socket-endpoint-path.test.ts b/src/main/daemon/endpoint/publication/testing/daemon-socket-endpoint-path.test.ts index d71ec6b55e6..49ea239ddc9 100644 --- a/src/main/daemon/endpoint/publication/testing/daemon-socket-endpoint-path.test.ts +++ b/src/main/daemon/endpoint/publication/testing/daemon-socket-endpoint-path.test.ts @@ -11,7 +11,7 @@ import { createServer, type Server, type Socket } from 'node:net' import { tmpdir } from 'node:os' import { dirname, join } from 'node:path' import { afterEach, describe, expect, it } from 'vitest' -import { setAppEnvironment } from '../../../../../shared/app-environment' +import { setAppEnvironment } from '../../../../../shared/app-lifecycle/app-environment' import { DaemonClient } from '../../../transport/client/daemon-client' import { checkDaemonHealthWithCoverage } from '../../../health/daemon-health' import { createOutOfProcessLauncher } from '../../../launch/daemon-out-of-process-launcher' diff --git a/src/main/daemon/executable-host/macos/macos-daemon-fork-reason.ts b/src/main/daemon/executable-host/macos/macos-daemon-fork-reason.ts index 7d04928073f..050c47512fc 100644 --- a/src/main/daemon/executable-host/macos/macos-daemon-fork-reason.ts +++ b/src/main/daemon/executable-host/macos/macos-daemon-fork-reason.ts @@ -1,4 +1,4 @@ -import type { ForkFallbackValue } from '../../../../shared/daemon-tcc-denial-capture' +import type { ForkFallbackValue } from '../../../../shared/terminal/daemon/daemon-tcc-denial-capture' export type MacDaemonForkReason = Exclude diff --git a/src/main/daemon/executable-host/macos/macos-daemon-launchd.ts b/src/main/daemon/executable-host/macos/macos-daemon-launchd.ts index 9f5f4639924..d46df74a07e 100644 --- a/src/main/daemon/executable-host/macos/macos-daemon-launchd.ts +++ b/src/main/daemon/executable-host/macos/macos-daemon-launchd.ts @@ -1,7 +1,7 @@ import { writeFile } from 'node:fs/promises' import { join } from 'node:path' import { setTimeout as delay } from 'node:timers/promises' -import { getAppEnvironment } from '../../../../shared/app-environment' +import { getAppEnvironment } from '../../../../shared/app-lifecycle/app-environment' import { LOCAL_BUILD_COMPATIBILITY_CONTRACT } from '../../../../shared/remote-runtime/orcad-distribution/local-build-compatibility-contract' import { NODE_RUNTIME_DARWIN_MINIMUM_OS } from '../../../../shared/node-runtime/node-runtime-pin' import { runProcess } from '@orca/process-host' diff --git a/src/main/daemon/executable-host/macos/macos-retired-daemon-recovery.ts b/src/main/daemon/executable-host/macos/macos-retired-daemon-recovery.ts index 0bddae2b647..b4ccb63ac6a 100644 --- a/src/main/daemon/executable-host/macos/macos-retired-daemon-recovery.ts +++ b/src/main/daemon/executable-host/macos/macos-retired-daemon-recovery.ts @@ -1,5 +1,5 @@ import { lstat } from 'node:fs/promises' -import { getAppEnvironment } from '../../../../shared/app-environment' +import { getAppEnvironment } from '../../../../shared/app-lifecycle/app-environment' import { captureDescendantSnapshot } from '../../../pty/process-retirement/pty-descendant-termination' import { endpointIsProvenDead, diff --git a/src/main/daemon/executable-host/macos/testing/macos-daemon-launchd.test.ts b/src/main/daemon/executable-host/macos/testing/macos-daemon-launchd.test.ts index 4422d64ff2e..567cef789e5 100644 --- a/src/main/daemon/executable-host/macos/testing/macos-daemon-launchd.test.ts +++ b/src/main/daemon/executable-host/macos/testing/macos-daemon-launchd.test.ts @@ -43,7 +43,7 @@ vi.mock('node:timers/promises', async (importOriginal) => { } }) vi.mock('@orca/process-host', () => ({ runProcess: runProcessMock })) -vi.mock('../../../../../shared/app-environment', () => ({ +vi.mock('../../../../../shared/app-lifecycle/app-environment', () => ({ hasAppEnvironment: () => true, getAppEnvironment: () => ({ getAppPath: () => '/Applications/Orca.app/Contents/Resources/app.asar', @@ -71,7 +71,6 @@ vi.mock('../../../transport/client/daemon-client', () => ({ import { launchMacDaemonFromStableBundle } from '../macos-daemon-launchd' import { macDaemonJobLabel } from '../macos-daemon-job-label' import type { DaemonChildSpawnOptions } from '../../../launch/daemon-launched-child-spawn' -import { PROTOCOL_VERSION } from '../../../protocol/daemon-protocol-version' const ok: ProcessResult = { code: 0, signal: null, stdout: '', stderr: '', timedOut: false } const running = { ...ok, stdout: 'gui/501/x = {\n\tstate = running\n}\n' } @@ -247,23 +246,6 @@ it('launches the copied helper on plain Node and leaves no inherited credentials expect(await exists(copyDir)).toBe(true) }) -it.each([ - ['running', running], - ['unverifiable', { ...ok, code: 1, stderr: 'Operation not permitted' }] -])('never starts beside an earlier job that reads %s', async (_state, print) => { - launchctl.print = [print] - // Keep retirement inside its budget so bootstrap and readiness still fit. - const error = await launchFailure(Date.now() + 20_000) - expect(error).toBeInstanceOf(Error) - expect(launchctlCalls('bootstrap')).toHaveLength(0) - expect(launchctlCalls('bootout')).toHaveLength(0) - expect(recoverMock).toHaveBeenCalledExactlyOnceWith( - state.root, - options.runtimeDir, - PROTOCOL_VERSION - ) -}) - it.each([ ['declined', async () => false], [ @@ -313,13 +295,3 @@ it('waits out a silent job that is still running and never forks beside it', asy expect(launchctlCalls('bootout')).toHaveLength(0) expect(await exists(copyDir)).toBe(true) }) - -it('reports a failure too late for the fork to fit the startup gate instead of forking', async () => { - materializeMock.mockImplementation(async () => { - vi.spyOn(Date, 'now').mockReturnValue(deadline + 1) - throw new Error('Could not copy the macOS terminal host') - }) - const deadline = Date.now() + 25_000 - const error = await launchFailure(deadline) - expect(error).toHaveProperty('message', 'Could not copy the macOS terminal host') -}) diff --git a/src/main/daemon/executable-host/windows/daemon-host-relocation.ts b/src/main/daemon/executable-host/windows/daemon-host-relocation.ts index 047b5a33994..54618b4d01a 100644 --- a/src/main/daemon/executable-host/windows/daemon-host-relocation.ts +++ b/src/main/daemon/executable-host/windows/daemon-host-relocation.ts @@ -1,7 +1,7 @@ import { createHash, randomBytes } from 'node:crypto' import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync } from 'node:fs' import { join, win32 as winPath } from 'node:path' -import { getAppEnvironment } from '../../../../shared/app-environment' +import { getAppEnvironment } from '../../../../shared/app-lifecycle/app-environment' import { buildDaemonHostManifest, daemonHostFitsPathBudget, diff --git a/src/main/daemon/executable-host/windows/testing/daemon-host-current-version-reclaim.test.ts b/src/main/daemon/executable-host/windows/testing/daemon-host-current-version-reclaim.test.ts index 14fb00d8759..a3a460be70b 100644 --- a/src/main/daemon/executable-host/windows/testing/daemon-host-current-version-reclaim.test.ts +++ b/src/main/daemon/executable-host/windows/testing/daemon-host-current-version-reclaim.test.ts @@ -2,7 +2,7 @@ import { existsSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node: import os from 'node:os' import { dirname, join } from 'node:path' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { setAppEnvironment } from '../../../../../shared/app-environment' +import { setAppEnvironment } from '../../../../../shared/app-lifecycle/app-environment' import { daemonHostStagingName } from '../daemon-host-reclaim' import { buildInstallFixture } from './daemon-host-relocation.test-fixture' import { diff --git a/src/main/daemon/executable-host/windows/testing/daemon-host-entry-layout.test.ts b/src/main/daemon/executable-host/windows/testing/daemon-host-entry-layout.test.ts index de33031618b..3a924899ff7 100644 --- a/src/main/daemon/executable-host/windows/testing/daemon-host-entry-layout.test.ts +++ b/src/main/daemon/executable-host/windows/testing/daemon-host-entry-layout.test.ts @@ -2,7 +2,7 @@ import { cpSync, existsSync, mkdtempSync, rmSync } from 'node:fs' import os from 'node:os' import { dirname, join } from 'node:path' import { afterEach, beforeEach, describe, expect, it } from 'vitest' -import { setAppEnvironment } from '../../../../../shared/app-environment' +import { setAppEnvironment } from '../../../../../shared/app-lifecycle/app-environment' import { buildInstallFixture } from './daemon-host-relocation.test-fixture' import { getRelocatedDaemonHost, materializeRelocatedDaemonHost } from '../daemon-host-relocation' diff --git a/src/main/daemon/executable-host/windows/testing/daemon-host-file-hash-cache.test.ts b/src/main/daemon/executable-host/windows/testing/daemon-host-file-hash-cache.test.ts index 5b194326579..6756e02640f 100644 --- a/src/main/daemon/executable-host/windows/testing/daemon-host-file-hash-cache.test.ts +++ b/src/main/daemon/executable-host/windows/testing/daemon-host-file-hash-cache.test.ts @@ -3,7 +3,7 @@ import { mkdtempSync, readFileSync, rmSync, statSync, utimesSync, writeFileSync import os from 'node:os' import { dirname, join } from 'node:path' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { setAppEnvironment } from '../../../../../shared/app-environment' +import { setAppEnvironment } from '../../../../../shared/app-lifecycle/app-environment' import { resetDaemonHostFileHashCacheForTests } from '../daemon-host-file-hash-cache' import { buildInstallFixture } from './daemon-host-relocation.test-fixture' import { getRelocatedDaemonHost, materializeRelocatedDaemonHost } from '../daemon-host-relocation' diff --git a/src/main/daemon/executable-host/windows/testing/daemon-host-process-package.test.ts b/src/main/daemon/executable-host/windows/testing/daemon-host-process-package.test.ts index a2582efae97..bae27ec629f 100644 --- a/src/main/daemon/executable-host/windows/testing/daemon-host-process-package.test.ts +++ b/src/main/daemon/executable-host/windows/testing/daemon-host-process-package.test.ts @@ -12,7 +12,7 @@ import os from 'node:os' import { dirname, join } from 'node:path' import { runProcessSync } from '@orca/process-host' import { afterEach, beforeEach, describe, expect, it } from 'vitest' -import { setAppEnvironment } from '../../../../../shared/app-environment' +import { setAppEnvironment } from '../../../../../shared/app-lifecycle/app-environment' import { buildInstallFixture } from './daemon-host-relocation.test-fixture' import { getDaemonHostRootDir, diff --git a/src/main/daemon/executable-host/windows/testing/daemon-host-profile-isolation.test.ts b/src/main/daemon/executable-host/windows/testing/daemon-host-profile-isolation.test.ts index eb1ce3a22f9..5ff891fdf0d 100644 --- a/src/main/daemon/executable-host/windows/testing/daemon-host-profile-isolation.test.ts +++ b/src/main/daemon/executable-host/windows/testing/daemon-host-profile-isolation.test.ts @@ -2,7 +2,7 @@ import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync import os from 'node:os' import { dirname, join } from 'node:path' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { setAppEnvironment } from '../../../../../shared/app-environment' +import { setAppEnvironment } from '../../../../../shared/app-lifecycle/app-environment' import { daemonHostStagingName } from '../daemon-host-reclaim' import { buildInstallFixture } from './daemon-host-relocation.test-fixture' import { diff --git a/src/main/daemon/executable-host/windows/testing/daemon-host-relocation.test.ts b/src/main/daemon/executable-host/windows/testing/daemon-host-relocation.test.ts index fc1d7a8fb7a..1d43b8cfd97 100644 --- a/src/main/daemon/executable-host/windows/testing/daemon-host-relocation.test.ts +++ b/src/main/daemon/executable-host/windows/testing/daemon-host-relocation.test.ts @@ -13,7 +13,10 @@ import os from 'node:os' import { dirname, join } from 'node:path' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { setAppEnvironment, type AppEnvironment } from '../../../../../shared/app-environment' +import { + setAppEnvironment, + type AppEnvironment +} from '../../../../../shared/app-lifecycle/app-environment' const hostApp = { isPackaged: true, diff --git a/src/main/daemon/health/daemon-async-io-probe.ts b/src/main/daemon/health/daemon-async-io-probe.ts index 550e1a1aa2b..28c3877864c 100644 --- a/src/main/daemon/health/daemon-async-io-probe.ts +++ b/src/main/daemon/health/daemon-async-io-probe.ts @@ -1,6 +1,6 @@ import { stat } from 'node:fs' import { performance } from 'node:perf_hooks' -import type { DaemonAsyncIoHealth } from '../../../shared/daemon-async-io-health' +import type { DaemonAsyncIoHealth } from '../../../shared/terminal/daemon/daemon-async-io-health' const DAEMON_ASYNC_IO_TIMEOUT_MS = 5_000 const HEALTH_CACHE_MS = 30_000 diff --git a/src/main/daemon/launch/daemon-launch-paths.ts b/src/main/daemon/launch/daemon-launch-paths.ts index f4a8b642309..36daffebf77 100644 --- a/src/main/daemon/launch/daemon-launch-paths.ts +++ b/src/main/daemon/launch/daemon-launch-paths.ts @@ -1,7 +1,7 @@ import { existsSync } from 'node:fs' import { connect } from 'node:net' import { join } from 'node:path' -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { ensurePrivateDir } from '../endpoint/publication/daemon-private-file-modes' import { scheduleTerminalHistoryPermissionRepair } from '../history/storage/terminal-history-permission-repair' import { getDaemonLogFilePath } from '../../observability/logs-directory' diff --git a/src/main/daemon/launch/daemon-launched-child-spawn.ts b/src/main/daemon/launch/daemon-launched-child-spawn.ts index a4c103b1e6c..a644b24e51c 100644 --- a/src/main/daemon/launch/daemon-launched-child-spawn.ts +++ b/src/main/daemon/launch/daemon-launched-child-spawn.ts @@ -1,7 +1,7 @@ import { forkProcess, type ForkSpec } from '@orca/process-host/fork-process' import { spawnProcess } from '@orca/process-host' import type { ChildProcess } from 'node:child_process' -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { removeChromiumDisabledSessionBus } from '../../pty/shell-startup/chromium-session-bus-env' import { hostMallocTunablesDaemonEnv } from '../../memory/host-malloc-tunables' import { diff --git a/src/main/daemon/launch/daemon-out-of-process-launcher.ts b/src/main/daemon/launch/daemon-out-of-process-launcher.ts index 4ad0199cbf8..1d12eebf0dc 100644 --- a/src/main/daemon/launch/daemon-out-of-process-launcher.ts +++ b/src/main/daemon/launch/daemon-out-of-process-launcher.ts @@ -1,5 +1,5 @@ import { randomUUID } from 'node:crypto' -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { childProcessHasExited } from '@orca/process-host/process-tree-termination' import type { DaemonReplaceReason } from '../../../shared/telemetry/daemon-lifecycle-telemetry' import { DaemonClient } from '../transport/client/daemon-client' diff --git a/src/main/daemon/launch/daemon-replacement-preflight.ts b/src/main/daemon/launch/daemon-replacement-preflight.ts index c440beee2f4..ba71bb2df9c 100644 --- a/src/main/daemon/launch/daemon-replacement-preflight.ts +++ b/src/main/daemon/launch/daemon-replacement-preflight.ts @@ -1,4 +1,4 @@ -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import type { DaemonReplaceReason } from '../../../shared/telemetry/daemon-lifecycle-telemetry' import { migrateLegacyDaemonScope } from '../process-scopes/daemon-cgroup-scope' import { isDaemonStaleForCurrentBundle } from './daemon-bundle-staleness' diff --git a/src/main/daemon/launch/testing/daemon-launcher-driver-fixture.ts b/src/main/daemon/launch/testing/daemon-launcher-driver-fixture.ts index 47f46bc8a55..3f16caf0e15 100644 --- a/src/main/daemon/launch/testing/daemon-launcher-driver-fixture.ts +++ b/src/main/daemon/launch/testing/daemon-launcher-driver-fixture.ts @@ -50,7 +50,7 @@ export async function buildDaemonLauncherDriver( ): Promise { await build({ stdin: { - contents: `\n import { mkdirSync } from 'node:fs'\n import { join } from 'node:path'\n import { createOutOfProcessLauncher } from './src/main/daemon/launch/daemon-out-of-process-launcher'\n import { getDaemonSocketPath, getDaemonTokenPath } from './src/main/daemon/launch/daemon-spawner'\n import { setAppEnvironment } from './src/shared/app-environment'\n const [userData, appPath, version] = process.argv.slice(2)\n setAppEnvironment({\n getPath: () => userData, getAppPath: () => appPath, getVersion: () => version,\n isPackaged: () => true, onWillQuit() {}, exit: code => process.exit(code),\n getAppMetrics: () => []\n })\n const runtimeDir = join(userData, 'daemon')\n mkdirSync(runtimeDir, { recursive: true, mode: 0o700 })\n createOutOfProcessLauncher(runtimeDir)(getDaemonSocketPath(runtimeDir), getDaemonTokenPath(runtimeDir))\n .then(handle => {\n console.log(JSON.stringify({ adopted: handle.adopted === true, mode: handle.mode ?? null }))\n process.stdin.on('end', () => process.exit(0))\n process.stdin.resume()\n })\n .catch(error => { console.error(error); process.exit(1) })\n `, + contents: `\n import { mkdirSync } from 'node:fs'\n import { join } from 'node:path'\n import { createOutOfProcessLauncher } from './src/main/daemon/launch/daemon-out-of-process-launcher'\n import { getDaemonSocketPath, getDaemonTokenPath } from './src/main/daemon/launch/daemon-spawner'\n import { setAppEnvironment } from './src/shared/app-lifecycle/app-environment'\n const [userData, appPath, version] = process.argv.slice(2)\n setAppEnvironment({\n getPath: () => userData, getAppPath: () => appPath, getVersion: () => version,\n isPackaged: () => true, onWillQuit() {}, exit: code => process.exit(code),\n getAppMetrics: () => []\n })\n const runtimeDir = join(userData, 'daemon')\n mkdirSync(runtimeDir, { recursive: true, mode: 0o700 })\n createOutOfProcessLauncher(runtimeDir)(getDaemonSocketPath(runtimeDir), getDaemonTokenPath(runtimeDir))\n .then(handle => {\n console.log(JSON.stringify({ adopted: handle.adopted === true, mode: handle.mode ?? null }))\n process.stdin.on('end', () => process.exit(0))\n process.stdin.resume()\n })\n .catch(error => { console.error(error); process.exit(1) })\n `, resolveDir: process.cwd(), loader: 'ts' }, diff --git a/src/main/daemon/launch/testing/daemon-out-of-process-launcher-host-prune.test.ts b/src/main/daemon/launch/testing/daemon-out-of-process-launcher-host-prune.test.ts index 0f1e71b8cad..58c04d8a408 100644 --- a/src/main/daemon/launch/testing/daemon-out-of-process-launcher-host-prune.test.ts +++ b/src/main/daemon/launch/testing/daemon-out-of-process-launcher-host-prune.test.ts @@ -3,7 +3,7 @@ import { existsSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node: import os from 'node:os' import { dirname, join } from 'node:path' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { setAppEnvironment } from '../../../../shared/app-environment' +import { setAppEnvironment } from '../../../../shared/app-lifecycle/app-environment' import { daemonHostStagingName } from '../../executable-host/windows/daemon-host-reclaim' import { buildInstallFixture } from '../../executable-host/windows/testing/daemon-host-relocation.test-fixture' import { diff --git a/src/main/daemon/observability/daemon-adoption-telemetry-event.ts b/src/main/daemon/observability/daemon-adoption-telemetry-event.ts index 1a70faf0d02..9e297dadb16 100644 --- a/src/main/daemon/observability/daemon-adoption-telemetry-event.ts +++ b/src/main/daemon/observability/daemon-adoption-telemetry-event.ts @@ -1,7 +1,7 @@ import { existsSync } from 'node:fs' import { homedir } from 'node:os' import { join } from 'node:path' -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { classifyDaemonAppVersionMatch, classifyDaemonPtyCwd, diff --git a/src/main/daemon/observability/daemon-async-io-telemetry-event.ts b/src/main/daemon/observability/daemon-async-io-telemetry-event.ts index 08c000d1ea2..bf871259227 100644 --- a/src/main/daemon/observability/daemon-async-io-telemetry-event.ts +++ b/src/main/daemon/observability/daemon-async-io-telemetry-event.ts @@ -1,8 +1,8 @@ // Telemetry must never fail a health read, so every error stops here. -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { classifyDaemonAppVersionMatch } from '../../../shared/telemetry/daemon-adoption-telemetry' -import type { DaemonAsyncIoHealth } from '../../../shared/daemon-async-io-health' +import type { DaemonAsyncIoHealth } from '../../../shared/terminal/daemon/daemon-async-io-health' import type { DAEMON_ASYNC_IO_STALL_DURATION_BUCKETS } from '../../../shared/telemetry/schemas/telemetry-daemon-event-schemas' import { track } from '../../telemetry/client' import type { DaemonEndpointIdentity } from '../protocol/daemon-hello-protocol' diff --git a/src/main/daemon/observability/daemon-audit-classifier.ts b/src/main/daemon/observability/daemon-audit-classifier.ts index ed0ed314bd9..acb0144a25b 100644 --- a/src/main/daemon/observability/daemon-audit-classifier.ts +++ b/src/main/daemon/observability/daemon-audit-classifier.ts @@ -4,7 +4,7 @@ import type { DaemonEvidenceSource, DaemonAuditFailureTrigger, DaemonAuditGoneReason -} from '../../../shared/daemon-audit-eligibility' +} from '../../../shared/terminal/daemon/daemon-audit-eligibility' import type { DaemonEvidenceSources, DaemonProcessEvidence, diff --git a/src/main/daemon/permissions/tcc-denial-capture.ts b/src/main/daemon/permissions/tcc-denial-capture.ts index 4f6fefdd231..c38466ef466 100644 --- a/src/main/daemon/permissions/tcc-denial-capture.ts +++ b/src/main/daemon/permissions/tcc-denial-capture.ts @@ -10,7 +10,7 @@ import { bucketHelperAge, type FullDiskAccessValue, type HelperOrigin -} from '../../../shared/daemon-tcc-denial-capture' +} from '../../../shared/terminal/daemon/daemon-tcc-denial-capture' import { LOCAL_BUILD_COMPATIBILITY_CONTRACT } from '../../../shared/remote-runtime/orcad-distribution/local-build-compatibility-contract' import type { DeveloperPermissionStatus } from '../../../shared/developer-permissions-types' import type { EventProps } from '../../../shared/telemetry/telemetry-event-classification' diff --git a/src/main/daemon/permissions/tcc-denial-folder-state.ts b/src/main/daemon/permissions/tcc-denial-folder-state.ts index 4294a0e8437..33623b90323 100644 --- a/src/main/daemon/permissions/tcc-denial-folder-state.ts +++ b/src/main/daemon/permissions/tcc-denial-folder-state.ts @@ -7,7 +7,7 @@ import type { FolderFlag, IcloudManaged, VolumeType -} from '../../../shared/daemon-tcc-denial-capture' +} from '../../../shared/terminal/daemon/daemon-tcc-denial-capture' const PROBE_TIMEOUT_MS = 1_500 // sys/stat.h SF_DATALESS: the entry's contents live in a file provider, not on disk. diff --git a/src/main/daemon/permissions/tcc-denial-log-verdict.ts b/src/main/daemon/permissions/tcc-denial-log-verdict.ts index 7eb4c6e20db..86eb33dac37 100644 --- a/src/main/daemon/permissions/tcc-denial-log-verdict.ts +++ b/src/main/daemon/permissions/tcc-denial-log-verdict.ts @@ -11,8 +11,8 @@ import type { RequirementFailure, TccService, YesNo -} from '../../../shared/daemon-tcc-denial-capture' -import { TCC_AUTH_REASONS } from '../../../shared/daemon-tcc-denial-capture' +} from '../../../shared/terminal/daemon/daemon-tcc-denial-capture' +import { TCC_AUTH_REASONS } from '../../../shared/terminal/daemon/daemon-tcc-denial-capture' // A prompted request logs its attribution long before its result; 30 s keeps both in one window. const LOG_LOOKBACK_MS = 30_000 diff --git a/src/main/daemon/permissions/tcc-denial-signature-checks.ts b/src/main/daemon/permissions/tcc-denial-signature-checks.ts index 68c93cc42f2..65b02c8d41b 100644 --- a/src/main/daemon/permissions/tcc-denial-signature-checks.ts +++ b/src/main/daemon/permissions/tcc-denial-signature-checks.ts @@ -1,7 +1,7 @@ // Whether the live helper and its on-disk copy still carry the app's signature at a denial. import type { runProcess } from '@orca/process-host' -import type { SignatureCheck } from '../../../shared/daemon-tcc-denial-capture' +import type { SignatureCheck } from '../../../shared/terminal/daemon/daemon-tcc-denial-capture' const CODESIGN = '/usr/bin/codesign' const CODESIGN_TIMEOUT_MS = 5_000 diff --git a/src/main/daemon/providers/adapter/daemon-pty-adapter.ts b/src/main/daemon/providers/adapter/daemon-pty-adapter.ts index 45f95d42b42..d21c347c7f7 100644 --- a/src/main/daemon/providers/adapter/daemon-pty-adapter.ts +++ b/src/main/daemon/providers/adapter/daemon-pty-adapter.ts @@ -30,7 +30,7 @@ import type { AutomaticWorkRequestType } from '../../admission/daemon-automatic- import type { DaemonAsyncIoHealth, DaemonAsyncIoStatus -} from '../../../../shared/daemon-async-io-health' +} from '../../../../shared/terminal/daemon/daemon-async-io-health' import { observeDaemonAsyncIoHealth } from '../../observability/daemon-async-io-telemetry-event' import { sameEndpointIdentity } from '../../endpoint/identity/daemon-endpoint-incarnation' diff --git a/src/main/daemon/providers/adapter/daemon-pty-connection-lifecycle.ts b/src/main/daemon/providers/adapter/daemon-pty-connection-lifecycle.ts index 17a5682b972..46808836b02 100644 --- a/src/main/daemon/providers/adapter/daemon-pty-connection-lifecycle.ts +++ b/src/main/daemon/providers/adapter/daemon-pty-connection-lifecycle.ts @@ -6,7 +6,7 @@ import { import type { DaemonAuditTrigger, DaemonEvidenceSource -} from '../../../../shared/daemon-audit-eligibility' +} from '../../../../shared/terminal/daemon/daemon-audit-eligibility' import { exactDaemonIncarnationForPidRecord, sameEndpointIdentity diff --git a/src/main/daemon/providers/adapter/daemon-pty-runtime-state.ts b/src/main/daemon/providers/adapter/daemon-pty-runtime-state.ts index 69473513fb2..db85deb5e1f 100644 --- a/src/main/daemon/providers/adapter/daemon-pty-runtime-state.ts +++ b/src/main/daemon/providers/adapter/daemon-pty-runtime-state.ts @@ -9,7 +9,7 @@ import type { import type { DaemonAuditTrigger, DaemonEvidenceSource -} from '../../../../shared/daemon-audit-eligibility' +} from '../../../../shared/terminal/daemon/daemon-audit-eligibility' import { CheckpointSessionQueue } from '../checkpointing/daemon-checkpoint-session-queue' import { SNAPSHOT_SERIALIZER_FIDELITY_DAEMON_PROTOCOL_VERSION, diff --git a/src/main/daemon/providers/lifecycle/testing/daemon-init-fresh-import.ts b/src/main/daemon/providers/lifecycle/testing/daemon-init-fresh-import.ts index 7512b08ed7d..fa5bb2a3954 100644 --- a/src/main/daemon/providers/lifecycle/testing/daemon-init-fresh-import.ts +++ b/src/main/daemon/providers/lifecycle/testing/daemon-init-fresh-import.ts @@ -1,5 +1,8 @@ import { vi } from 'vitest' -import { setAppEnvironment, type AppEnvironment } from '../../../../../shared/app-environment' +import { + setAppEnvironment, + type AppEnvironment +} from '../../../../../shared/app-lifecycle/app-environment' import type { DaemonInitMockState } from './daemon-init-mock-types' export async function importFreshDaemonInit(state: DaemonInitMockState) { diff --git a/src/main/daemon/providers/routing/daemon-newer-protocol-hold.ts b/src/main/daemon/providers/routing/daemon-newer-protocol-hold.ts index 47e7726fc35..ff47e6ab71a 100644 --- a/src/main/daemon/providers/routing/daemon-newer-protocol-hold.ts +++ b/src/main/daemon/providers/routing/daemon-newer-protocol-hold.ts @@ -1,7 +1,7 @@ import type { NewerDaemonHeldScreen, NewerDaemonReopenResult -} from '../../../../shared/newer-daemon-hold' +} from '../../../../shared/terminal/daemon/newer-daemon-hold' import { coldRestorePayloadFromInfo } from '../../history/restoration/cold-restore-payload-cache' import { classifyDaemonGeneration, diff --git a/src/main/daemon/providers/routing/daemon-router-newer-daemon-hold.ts b/src/main/daemon/providers/routing/daemon-router-newer-daemon-hold.ts index 298d3e47a3a..ac48959f66b 100644 --- a/src/main/daemon/providers/routing/daemon-router-newer-daemon-hold.ts +++ b/src/main/daemon/providers/routing/daemon-router-newer-daemon-hold.ts @@ -1,4 +1,4 @@ -import { NEWER_DAEMON_HOLD_ERROR } from '../../../../shared/newer-daemon-hold' +import { NEWER_DAEMON_HOLD_ERROR } from '../../../../shared/terminal/daemon/newer-daemon-hold' import type { PtySpawnOptions } from '../../../providers/pty/provider-contract' import { isHoldingForNewerProtocolDaemon } from './daemon-newer-protocol-hold' import type { DaemonPtyAdapter } from '../adapter/daemon-pty-adapter' diff --git a/src/main/daemon/providers/routing/testing/daemon-pty-router-newer-daemon-hold.test.ts b/src/main/daemon/providers/routing/testing/daemon-pty-router-newer-daemon-hold.test.ts deleted file mode 100644 index fd1b3c30bdf..00000000000 --- a/src/main/daemon/providers/routing/testing/daemon-pty-router-newer-daemon-hold.test.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { describe, expect, it, vi } from 'vitest' - -const hold = vi.hoisted(() => ({ holding: false })) -vi.mock('../daemon-newer-protocol-hold', () => ({ - isHoldingForNewerProtocolDaemon: () => hold.holding -})) -import { NEWER_DAEMON_HOLD_ERROR } from '../../../../../shared/newer-daemon-hold' -import { createAdapter } from './daemon-pty-router-test-fixture' -import { DaemonPtyRouter } from '../daemon-pty-router' - -function setup(opts: { holding: boolean; restorable?: string[]; currentSessions?: string[] }) { - const current = createAdapter('current', opts.currentSessions ?? []) - const legacy = createAdapter('legacy', ['legacy-session']) - const restorable = new Set(opts.restorable ?? []) - Object.assign(current, { hasRestorableHistory: vi.fn((id: string) => restorable.has(id)) }) - hold.holding = opts.holding - const router = new DaemonPtyRouter({ current, legacy: [legacy] }) - return { current, legacy, router, release: () => (hold.holding = false) } -} - -const SPAWN = { cols: 80, rows: 24 } - -describe('DaemonPtyRouter newer-daemon hold', () => { - // Mobile and runtime restore can re-materialize an existing ID with its agent command. - it('refuses an agent-launching re-materialize of that id the same way', async () => { - const { current, router } = setup({ holding: true, restorable: ['newer-session'] }) - await expect( - router.spawn({ - ...SPAWN, - sessionId: 'newer-session', - command: 'claude --resume c1', - launchAgent: 'claude' - }) - ).rejects.toThrow(NEWER_DAEMON_HOLD_ERROR) - expect(current.spawn).not.toHaveBeenCalled() - }) - - it('holds when the adopted inventory cannot answer', async () => { - const { legacy, router } = setup({ holding: true, restorable: ['newer-session'] }) - vi.mocked(legacy.listProcesses).mockRejectedValue(new Error('timeout')) - await expect(router.spawn({ ...SPAWN, sessionId: 'newer-session' })).rejects.toThrow( - NEWER_DAEMON_HOLD_ERROR - ) - }) -}) diff --git a/src/main/emulator/android/scrcpy-server-download.test.ts b/src/main/emulator/android/scrcpy-server-download.test.ts index f6c28e7e327..eacd2101ca4 100644 --- a/src/main/emulator/android/scrcpy-server-download.test.ts +++ b/src/main/emulator/android/scrcpy-server-download.test.ts @@ -6,7 +6,7 @@ import { PassThrough } from 'node:stream' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' const state = vi.hoisted(() => ({ root: '', get: vi.fn() })) -vi.mock('../../../shared/app-environment', () => ({ +vi.mock('../../../shared/app-lifecycle/app-environment', () => ({ getAppEnvironment: () => ({ getPath: () => state.root }) })) vi.mock('node:https', () => ({ get: state.get })) diff --git a/src/main/emulator/android/scrcpy-server-download.ts b/src/main/emulator/android/scrcpy-server-download.ts index dc8e5248cc0..0f55509d0e7 100644 --- a/src/main/emulator/android/scrcpy-server-download.ts +++ b/src/main/emulator/android/scrcpy-server-download.ts @@ -3,7 +3,7 @@ import { dirname, join } from 'node:path' import { get } from 'node:https' import { pipeline } from 'node:stream/promises' import type { IncomingMessage } from 'node:http' -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { EmulatorError } from '../emulator-errors' import { emulatorFailureText } from '../../../shared/emulator-failure-copy' import { emulatorProbe, emulatorProbeError } from '../emulator-probe' diff --git a/src/main/emulator/serve-sim-execution.ts b/src/main/emulator/serve-sim-execution.ts index e0103f8000a..cdec79cf466 100644 --- a/src/main/emulator/serve-sim-execution.ts +++ b/src/main/emulator/serve-sim-execution.ts @@ -2,7 +2,7 @@ import { runProcess } from '@orca/process-host' import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs' import { platform, tmpdir } from 'node:os' import { delimiter, join } from 'node:path' -import { getAppEnvironment } from '../../shared/app-environment' +import { getAppEnvironment } from '../../shared/app-lifecycle/app-environment' import { EmulatorError } from './emulator-errors' import { materializeServeSimRuntime } from './serve-sim-runtime-materializer' diff --git a/src/main/ephemeral-vm/runtime-resume-pairing.ts b/src/main/ephemeral-vm/runtime-resume-pairing.ts index 83b4b483847..ad9fe373f03 100644 --- a/src/main/ephemeral-vm/runtime-resume-pairing.ts +++ b/src/main/ephemeral-vm/runtime-resume-pairing.ts @@ -6,7 +6,7 @@ import { import type { PairedRuntimeConnection } from '../../shared/remote-runtime/pairing/paired-runtime-connection' import { sendRemoteRuntimeRequestOnSocket } from '../../shared/remote-runtime/requests/remote-runtime-request-socket' import { RemoteRuntimeClientError } from '../../shared/remote-runtime/remote-runtime-client-error' -import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../shared/electron-remote-runtime-client-capabilities' +import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../shared/remote-runtime/protocol/electron-remote-runtime-client-capabilities' const SAVED_PAIRING_PROBE_TIMEOUT_MS = 10_000 diff --git a/src/main/ephemeral-vm/workspace-resume-paired-lost-contact.test.ts b/src/main/ephemeral-vm/workspace-resume-paired-lost-contact.test.ts index 0ceef6285bb..09ea1636479 100644 --- a/src/main/ephemeral-vm/workspace-resume-paired-lost-contact.test.ts +++ b/src/main/ephemeral-vm/workspace-resume-paired-lost-contact.test.ts @@ -68,7 +68,7 @@ import { } from '../../shared/remote-runtime/host-store/runtime-environment-store' import { getPreferredPairedRuntimeConnection } from '../../shared/remote-runtime/host-catalog/runtime-environments' import { sendRemoteRuntimeRequestOnSocket } from '../../shared/remote-runtime/requests/remote-runtime-request-socket' -import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../shared/electron-remote-runtime-client-capabilities' +import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../shared/remote-runtime/protocol/electron-remote-runtime-client-capabilities' import { runtimeHostStatusError } from '../../shared/remote-runtime/host-status/runtime-host-status' import type { RuntimeStatus } from '../../shared/remote-runtime/session-graph/runtime-session-contracts' import { DeviceRegistry } from '../runtime/rpc/server/pairing/device-registry' diff --git a/src/main/host/electron-app-environment.ts b/src/main/host/electron-app-environment.ts index f2689fd0ad8..2cf7351338e 100644 --- a/src/main/host/electron-app-environment.ts +++ b/src/main/host/electron-app-environment.ts @@ -1,5 +1,9 @@ import { app } from 'electron' -import type { AppEnvironment, AppPathName, AppProcessMetric } from '../../shared/app-environment' +import type { + AppEnvironment, + AppPathName, + AppProcessMetric +} from '../../shared/app-lifecycle/app-environment' export class ElectronAppEnvironment implements AppEnvironment { getPath(name: AppPathName): string { diff --git a/src/main/index.ts b/src/main/index.ts index 74530f11a93..7fe62bf6768 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -38,7 +38,7 @@ import { readProfileStateCopySavedTimes } from './persistence/profile-state/startup/profile-state-startup-recovery-dialog' import { profileStateDesktopRecoveryArgs } from './startup/profile-startup/profile-state-recovery-preflight' -import { profileStateRepairSectionApproval } from '../shared/profile-state-recovery-command' +import { profileStateRepairSectionApproval } from '../shared/orca-profiles/profile-state-recovery-command' import { prepareEarlyMainUiLanguage, translateMain } from './i18n/main-i18n' import { ProfileStateRecoveryRequiredError } from './persistence/profile-state/recovery/profile-state-recovery-required' import { getProfileUserDataPath } from './orca-profiles/profile-storage-paths' @@ -53,7 +53,10 @@ import { installWindowsIsolatedSpawner } from './startup/windows-startup/windows import { dropE2eSpawnLogOutsideE2e } from './startup/testing/e2e-spawn-log-env' import type { MainWindowOpenOptions } from './window/main-window/main-window-contracts' import type { DesktopActivationRequest } from './startup/serve-launch/serve-desktop-activation' -import { argvRequestsBackgroundOpen, BACKGROUND_OPEN_ARG } from '../shared/background-open-argv' +import { + argvRequestsBackgroundOpen, + BACKGROUND_OPEN_ARG +} from '../shared/app-lifecycle/launch/background-open-argv' import { setBackgroundWindowOpener } from './window/activation/background-window-open' // Before anything spawns, so no daemon, PTY or agent inherits it outside e2e. diff --git a/src/main/ipc/app.ts b/src/main/ipc/app.ts index 48cc7d326fc..6c6d2544137 100644 --- a/src/main/ipc/app.ts +++ b/src/main/ipc/app.ts @@ -5,7 +5,7 @@ import { existsSync } from 'node:fs' import path from 'node:path' import { pathToFileURL } from 'node:url' import { app, BrowserWindow, dialog, ipcMain, type IpcMainInvokeEvent } from 'electron' -import type { AppIdentity } from '../../shared/app-identity' +import type { AppIdentity } from '../../shared/app-lifecycle/identity/app-identity' import type { MarkdownDocument } from '../../shared/file-listing/file-document' import type { FloatingTerminalCwdRequest } from '../../shared/ui-chrome-types' import { relaunchApp, runBeforeRelaunchCleanup } from '../startup/quit/app-relaunch' diff --git a/src/main/ipc/browser/desktop-browser-bridge-wiring.ts b/src/main/ipc/browser/desktop-browser-bridge-wiring.ts index f91d7e82033..680d2de954c 100644 --- a/src/main/ipc/browser/desktop-browser-bridge-wiring.ts +++ b/src/main/ipc/browser/desktop-browser-bridge-wiring.ts @@ -9,7 +9,7 @@ import { isDesktopBrowserBridgeMethod, isHostReachableDocument } from '../../../shared/browser/client-hosting/desktop-browser-bridge-protocol' -import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../shared/electron-remote-runtime-client-capabilities' +import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../shared/remote-runtime/protocol/electron-remote-runtime-client-capabilities' import '../../../shared/remote-runtime/requests/remote-runtime-request-socket' import { subscribeRemoteRuntimeTransport } from '../../../shared/remote-runtime/requests/remote-runtime-subscription-transport' import { resolveEnvironment } from '../../../shared/remote-runtime/host-store/runtime-environment-store' diff --git a/src/main/ipc/cli.ts b/src/main/ipc/cli.ts index d87d5dfb28f..06b219df86b 100644 --- a/src/main/ipc/cli.ts +++ b/src/main/ipc/cli.ts @@ -1,5 +1,5 @@ import { ipcMain } from 'electron' -import type { CliInstallStatus } from '../../shared/cli-install-types' +import type { CliInstallStatus } from '../../shared/cli/cli-install-types' import { resolveAppImageCacheKey } from '../../shared/desktop-distribution/appimage/appimage-cache-identity' import { CliInstaller } from '../cli/cli-installer' import { runKeyedSerializedOperation } from '../../shared/concurrency/keyed-serialized-operations' diff --git a/src/main/ipc/custom-app-icon.ts b/src/main/ipc/custom-app-icon.ts index f2af3d0254d..510631f57ea 100644 --- a/src/main/ipc/custom-app-icon.ts +++ b/src/main/ipc/custom-app-icon.ts @@ -1,6 +1,9 @@ import { BrowserWindow, ipcMain } from 'electron' import type { Store } from '../persistence/loading-store/store' -import { CUSTOM_APP_ICON_ID, type CustomAppIconImportResult } from '../../shared/app-icon' +import { + CUSTOM_APP_ICON_ID, + type CustomAppIconImportResult +} from '../../shared/app-lifecycle/identity/app-icon' import { translateMain } from '../i18n/main-i18n' import { showSingleFlightOpenDialog } from './single-flight-open-dialog' import { applyAppIcon } from '../window/desktop-integration/app-icon' diff --git a/src/main/ipc/desktop-renderer-runtime-capabilities.ts b/src/main/ipc/desktop-renderer-runtime-capabilities.ts index 7e514582f07..0e27319e736 100644 --- a/src/main/ipc/desktop-renderer-runtime-capabilities.ts +++ b/src/main/ipc/desktop-renderer-runtime-capabilities.ts @@ -1,6 +1,6 @@ import { GIT_REVERT_CONFLICT_CLIENT_CAPABILITY } from '../../shared/git/commands/git-commit-action' import { GIT_GRAPH_TAB_CAPABILITY } from '../../shared/source-control/runtime/git-graph-capabilities' -import type { RuntimeCapability } from '../../shared/protocol-version' +import type { RuntimeCapability } from '../../shared/remote-runtime/protocol/protocol-version' import { REPO_SEARCH_QUALIFIED_REFS_RUNTIME_CAPABILITY } from '../../shared/remote-runtime/protocol/worktree-runtime-capabilities' import { STRUCTURED_AGENT_SESSION_RENDERER_CLIENT_CAPABILITIES } from '../../shared/agent-session/structured-agent-session-renderer-client-capabilities' import { diff --git a/src/main/ipc/floating-workspace-directory.ts b/src/main/ipc/floating-workspace-directory.ts index 3e2fb097c56..fbbc8a234b0 100644 --- a/src/main/ipc/floating-workspace-directory.ts +++ b/src/main/ipc/floating-workspace-directory.ts @@ -1,7 +1,7 @@ import { constants as fsConstants, realpathSync } from 'node:fs' import { access, mkdir, realpath, stat } from 'node:fs/promises' import path from 'node:path' -import { getAppEnvironment } from '../../shared/app-environment' +import { getAppEnvironment } from '../../shared/app-lifecycle/app-environment' import type { GlobalSettings } from '../../shared/global-settings-types' import type { FloatingTerminalCwdRequest } from '../../shared/ui-chrome-types' import type { Store } from '../persistence/loading-store/store' diff --git a/src/main/ipc/profiles/orca-profile-auth-status-broadcast.ts b/src/main/ipc/profiles/orca-profile-auth-status-broadcast.ts index efee902a662..821ad7dbba2 100644 --- a/src/main/ipc/profiles/orca-profile-auth-status-broadcast.ts +++ b/src/main/ipc/profiles/orca-profile-auth-status-broadcast.ts @@ -3,7 +3,7 @@ import { ORCA_PROFILE_AUTH_STATUS_CHANGED_CHANNEL, ORCA_PROFILE_SIGN_IN_PROGRESS_CHANGED_CHANNEL, type OrcaCloudSignInProgress -} from '../../../shared/orca-profiles' +} from '../../../shared/orca-profiles/orca-profiles' function broadcast(channel: string, ...args: unknown[]): void { for (const window of BrowserWindow.getAllWindows()) { diff --git a/src/main/ipc/profiles/orca-profile-org-members-handlers.ts b/src/main/ipc/profiles/orca-profile-org-members-handlers.ts index 153e95a94ac..86124fa30db 100644 --- a/src/main/ipc/profiles/orca-profile-org-members-handlers.ts +++ b/src/main/ipc/profiles/orca-profile-org-members-handlers.ts @@ -8,7 +8,7 @@ import type { OrcaProfileOrgMemberRemoveArgs, OrcaProfileOrgMembersListArgs, OrcaProfileOrgMembersListResult -} from '../../../shared/orca-profiles' +} from '../../../shared/orca-profiles/orca-profiles' import { getProfileUserDataPath } from '../../orca-profiles/profile-storage-paths' import { changeOrcaProfileOrgMemberRole, diff --git a/src/main/ipc/profiles/orca-profile-project-transfer-args.ts b/src/main/ipc/profiles/orca-profile-project-transfer-args.ts index 2d6a3a18241..990a3395538 100644 --- a/src/main/ipc/profiles/orca-profile-project-transfer-args.ts +++ b/src/main/ipc/profiles/orca-profile-project-transfer-args.ts @@ -1,4 +1,4 @@ -import type { TransferOrcaProfileProjectArgs } from '../../../shared/orca-profiles' +import type { TransferOrcaProfileProjectArgs } from '../../../shared/orca-profiles/orca-profiles' export function transferProjectArgsFromUnknown(args: unknown): TransferOrcaProfileProjectArgs { if ( diff --git a/src/main/ipc/profiles/orca-profiles.ts b/src/main/ipc/profiles/orca-profiles.ts index 62a30b5a677..38869243588 100644 --- a/src/main/ipc/profiles/orca-profiles.ts +++ b/src/main/ipc/profiles/orca-profiles.ts @@ -21,7 +21,7 @@ import type { SelectOrcaProfileOrgArgs, SelectOrcaProfileOrgResult, SignOutCurrentOrcaProfileResult -} from '../../../shared/orca-profiles' +} from '../../../shared/orca-profiles/orca-profiles' import { createLocalOrcaProfile, getOrcaProfileListState, diff --git a/src/main/ipc/pty/delivery/debug-snapshot.ts b/src/main/ipc/pty/delivery/debug-snapshot.ts index 84fbdbb7795..bd27d0891b9 100644 --- a/src/main/ipc/pty/delivery/debug-snapshot.ts +++ b/src/main/ipc/pty/delivery/debug-snapshot.ts @@ -1,4 +1,4 @@ -import { getAppEnvironment } from '../../../../shared/app-environment' +import { getAppEnvironment } from '../../../../shared/app-lifecycle/app-environment' import { type PtyMainDeliveryDiagnostics, type PtyPerPtyDeliveryDiagnostics, diff --git a/src/main/ipc/pty/host-env/opencode-hook-installation.test.ts b/src/main/ipc/pty/host-env/opencode-hook-installation.test.ts index 99bed2cf87a..63f5ffded63 100644 --- a/src/main/ipc/pty/host-env/opencode-hook-installation.test.ts +++ b/src/main/ipc/pty/host-env/opencode-hook-installation.test.ts @@ -6,7 +6,7 @@ import { buildPtyHostEnv } from './assembly' import type { BuildPtyHostEnvOptions } from './types' const fixture = vi.hoisted(() => ({ userData: '', guestOverlay: '' })) -vi.mock('../../../../shared/app-environment', () => ({ +vi.mock('../../../../shared/app-lifecycle/app-environment', () => ({ getAppEnvironment: () => ({ getPath: () => fixture.userData, onWillQuit: vi.fn() }) })) vi.mock('../../../agent-hooks/server/agent-hook-server', () => ({ diff --git a/src/main/ipc/pty/ipc/newer-daemon-hold.ts b/src/main/ipc/pty/ipc/newer-daemon-hold.ts index ddfa2fda762..a738c6f99d1 100644 --- a/src/main/ipc/pty/ipc/newer-daemon-hold.ts +++ b/src/main/ipc/pty/ipc/newer-daemon-hold.ts @@ -1,7 +1,7 @@ import type { NewerDaemonHeldScreen, NewerDaemonReopenResult -} from '../../../../shared/newer-daemon-hold' +} from '../../../../shared/terminal/daemon/newer-daemon-hold' import { readNewerDaemonHeldScreen, reopenNewerDaemonTerminals diff --git a/src/main/ipc/pty/ipc/painted-cold-restore-ack.ts b/src/main/ipc/pty/ipc/painted-cold-restore-ack.ts index 618618fd120..bbe1e1a5361 100644 --- a/src/main/ipc/pty/ipc/painted-cold-restore-ack.ts +++ b/src/main/ipc/pty/ipc/painted-cold-restore-ack.ts @@ -1,4 +1,7 @@ -import type { PaintedRestoreAck, PaintedRestorePane } from '../../../../shared/painted-restore-ack' +import type { + PaintedRestoreAck, + PaintedRestorePane +} from '../../../../shared/terminal/replay/painted-restore-ack' import { ORCA_LAYOUT_OWNER_IS_MAIN } from '../../../../shared/layout-owner-switch' import { tryGetProviderForPty } from '../provider/registry' diff --git a/src/main/ipc/pty/ipc/resize-visibility.ts b/src/main/ipc/pty/ipc/resize-visibility.ts index 13808808d33..05c29ac6c3c 100644 --- a/src/main/ipc/pty/ipc/resize-visibility.ts +++ b/src/main/ipc/pty/ipc/resize-visibility.ts @@ -30,7 +30,7 @@ import { applyCumulativeAck } from '../delivery/accounting' import { sendModelRestoreNeededMarker } from '../delivery/payload' import { isMainWindowPtyIpcEvent } from './write-input' import { acknowledgePaintedColdRestore } from './painted-cold-restore-ack' -import type { PaintedRestoreAck } from '../../../../shared/painted-restore-ack' +import type { PaintedRestoreAck } from '../../../../shared/terminal/replay/painted-restore-ack' import type { PtyIpcSession } from '../session' export function installPtyResizeVisibilityIpc(session: PtyIpcSession): void { diff --git a/src/main/ipc/pty/provider/local-configure.ts b/src/main/ipc/pty/provider/local-configure.ts index 9675381a44d..eddc35a3d1a 100644 --- a/src/main/ipc/pty/provider/local-configure.ts +++ b/src/main/ipc/pty/provider/local-configure.ts @@ -1,6 +1,6 @@ import { getClaudeAgentViewService } from '../../../claude/agent-view/agent-view-service' import { inheritOmpLaunchEnvironment } from '../host-env/omp-launch-environment' -import { getAppEnvironment } from '../../../../shared/app-environment' +import { getAppEnvironment } from '../../../../shared/app-lifecycle/app-environment' import type { OrcaRuntimeService } from '../../../runtime/orca-runtime' import type { GlobalSettings } from '../../../../shared/global-settings-types' import { isAgentStatusHooksEnabled } from '../../../../shared/agent-hook-listener/configuration/agent-status-hooks-setting' diff --git a/src/main/ipc/pty/pty-management-async-io-health.test.ts b/src/main/ipc/pty/pty-management-async-io-health.test.ts index 86296e921e8..f2d09ab9d8c 100644 --- a/src/main/ipc/pty/pty-management-async-io-health.test.ts +++ b/src/main/ipc/pty/pty-management-async-io-health.test.ts @@ -1,5 +1,5 @@ import { beforeEach, expect, it, vi } from 'vitest' -import type { DaemonAsyncIoStatus } from '../../../shared/daemon-async-io-health' +import type { DaemonAsyncIoStatus } from '../../../shared/terminal/daemon/daemon-async-io-health' const { handlers, provider, adapter, restart } = vi.hoisted(() => ({ handlers: new Map Promise>(), diff --git a/src/main/ipc/pty/pty-management.ts b/src/main/ipc/pty/pty-management.ts index 60e8582599a..7fc68b4fa9e 100644 --- a/src/main/ipc/pty/pty-management.ts +++ b/src/main/ipc/pty/pty-management.ts @@ -30,7 +30,7 @@ import type { MacDaemonTccAttributionHealth } from '../../daemon/permissions/dae import type { DaemonEndpointIdentity } from '../../daemon/protocol/daemon-hello-protocol' import { sameEndpointIdentity } from '../../daemon/endpoint/identity/daemon-endpoint-incarnation' import type { DaemonSessionInfo } from '../../daemon/protocol/daemon-session-info' -import type { DaemonAsyncIoStatus } from '../../../shared/daemon-async-io-health' +import type { DaemonAsyncIoStatus } from '../../../shared/terminal/daemon/daemon-async-io-health' // Poll beyond the daemon's 5s SIGTERM-to-SIGKILL ladder to avoid false refusal reports. // A window, not an attempt count: a wedged generation fails each listing only after the request timeout. diff --git a/src/main/ipc/pty/register-handlers.ts b/src/main/ipc/pty/register-handlers.ts index 9c9b722c5f9..afda45b92b0 100644 --- a/src/main/ipc/pty/register-handlers.ts +++ b/src/main/ipc/pty/register-handlers.ts @@ -1,6 +1,6 @@ import { createLocalPtyStartupPromises } from './local-startup-promises' -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import type { OrcaRuntimeService } from '../../runtime/orca-runtime' import type { Store } from '../../persistence/loading-store/store' import type { GlobalSettings } from '../../../shared/global-settings-types' diff --git a/src/main/ipc/pty/spawn-host-env.ts b/src/main/ipc/pty/spawn-host-env.ts index 005dfeb6ee7..071b834d3b8 100644 --- a/src/main/ipc/pty/spawn-host-env.ts +++ b/src/main/ipc/pty/spawn-host-env.ts @@ -1,6 +1,6 @@ import { getClaudeAgentViewService } from '../../claude/agent-view/agent-view-service' import type { AgentProviderSessionMetadata } from '../../../shared/agent-session/lifecycle/agent-session-resume' -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import type { GlobalSettings } from '../../../shared/global-settings-types' import { stampRuntimeSourceEnv } from '../../../shared/remote-runtime/host-catalog/runtime-source-env' import { SETUP_AGENT_SEQUENCE_SETUP_SCRIPT_ENV } from '../../../shared/agent-launch/startup/setup-agent-sequencing' diff --git a/src/main/ipc/pty/spawn-options-assembly.ts b/src/main/ipc/pty/spawn-options-assembly.ts index cb8c3e99062..2a308056697 100644 --- a/src/main/ipc/pty/spawn-options-assembly.ts +++ b/src/main/ipc/pty/spawn-options-assembly.ts @@ -1,7 +1,7 @@ import { withClaudeAgentViewPlugin } from '../../../shared/agent-hook-listener/providers/claude/view/claude-agent-view-launch' import { resolveStartupShell } from '../../../shared/agent-launch/startup/tui-agent-startup-shell' import { resolveLocalWindowsAgentStartupShell } from '../../../shared/shell/launch/windows-terminal-shell' -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import type { GlobalSettings } from '../../../shared/global-settings-types' import { isTuiAgent } from '../../../shared/agent-launch/catalog/tui-agent-config' import { withCodexTerminalServerIsolationEnv } from '../../../shared/agent-launch/startup/codex-terminal-server-isolation' diff --git a/src/main/ipc/renderer-shutdown-checkpoint.ts b/src/main/ipc/renderer-shutdown-checkpoint.ts index 1a8f736c51b..60b79dad201 100644 --- a/src/main/ipc/renderer-shutdown-checkpoint.ts +++ b/src/main/ipc/renderer-shutdown-checkpoint.ts @@ -14,7 +14,7 @@ import { isWslMoveWindowWriteHeld } from '../persistence/moving-wsl-projects/qui import { windowViewSaveForMain, type ReconnectFactsFor } from '../persistence/window-save-view' import { reportWindowSaveDrift } from '../persistence/window-save-divergence' import { ORCA_LAYOUT_OWNER_IS_MAIN } from '../../shared/layout-owner-switch' -import { formatShutdownCheckpointFailureReason } from '../../shared/renderer-shutdown-events' +import { formatShutdownCheckpointFailureReason } from '../../shared/app-lifecycle/shutdown/renderer-shutdown-events' type StageBeforeUnloadSyncArgs = { sessions: { state: WorkspaceSessionState; hostId?: ExecutionHostId }[] diff --git a/src/main/ipc/runtime-environments/browser-hosting/runtime-environment-browser-client-host-handler.test.ts b/src/main/ipc/runtime-environments/browser-hosting/runtime-environment-browser-client-host-handler.test.ts index 9b3536287ed..fbc06dd6fed 100644 --- a/src/main/ipc/runtime-environments/browser-hosting/runtime-environment-browser-client-host-handler.test.ts +++ b/src/main/ipc/runtime-environments/browser-hosting/runtime-environment-browser-client-host-handler.test.ts @@ -1,6 +1,6 @@ import '../../../../shared/remote-runtime/host-store/environment-store-worker-test-fixture' import { beforeEach, describe, expect, it, vi } from 'vitest' -import '../../../../shared/protocol-version' +import '../../../../shared/remote-runtime/protocol/protocol-version' import { BROWSER_CLIENT_AUTOMATION_RUNTIME_CAPABILITY, BROWSER_CLIENT_HOST_RUNTIME_CAPABILITY, diff --git a/src/main/ipc/runtime-environments/connections/runtime-environment-request-connections.ts b/src/main/ipc/runtime-environments/connections/runtime-environment-request-connections.ts index 27a823d16ca..db0e04463e7 100644 --- a/src/main/ipc/runtime-environments/connections/runtime-environment-request-connections.ts +++ b/src/main/ipc/runtime-environments/connections/runtime-environment-request-connections.ts @@ -3,7 +3,7 @@ import { runtimeEnvironmentConnectionPairingKey as getPairingKey } from './runti import type { RuntimeEnvironmentCall } from '../requests/runtime-environment-call' import type { PairedRuntimeConnection } from '../../../../shared/remote-runtime/pairing/paired-runtime-connection' import type { RuntimeStatus } from '../../../../shared/remote-runtime/session-graph/runtime-session-contracts' -import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../../shared/electron-remote-runtime-client-capabilities' +import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../../shared/remote-runtime/protocol/electron-remote-runtime-client-capabilities' import type { RuntimeOrchestrationEnvelope, RuntimeRequestGuard, diff --git a/src/main/ipc/runtime-environments/pairing/runtime-environment-pairing-verification.ts b/src/main/ipc/runtime-environments/pairing/runtime-environment-pairing-verification.ts index 60162307c2e..be5436bb131 100644 --- a/src/main/ipc/runtime-environments/pairing/runtime-environment-pairing-verification.ts +++ b/src/main/ipc/runtime-environments/pairing/runtime-environment-pairing-verification.ts @@ -17,7 +17,7 @@ import { import { RemoteRuntimeClientError } from '../../../../shared/remote-runtime/remote-runtime-client-error' import { exchangeRemotePairingTicket } from '../../../../shared/remote-runtime/pairing/remote-pairing-ticket-exchange' import { sendRemoteRuntimeRequestOnSocket } from '../../../../shared/remote-runtime/requests/remote-runtime-request-socket' -import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../../shared/electron-remote-runtime-client-capabilities' +import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../../shared/remote-runtime/protocol/electron-remote-runtime-client-capabilities' import { getPreferredPairingOffer, isEphemeralVmRuntimeEnvironment, diff --git a/src/main/ipc/runtime-environments/requests/orchestration-environment-transport.ts b/src/main/ipc/runtime-environments/requests/orchestration-environment-transport.ts index 021f3e616a7..9e5cac1b4ed 100644 --- a/src/main/ipc/runtime-environments/requests/orchestration-environment-transport.ts +++ b/src/main/ipc/runtime-environments/requests/orchestration-environment-transport.ts @@ -1,4 +1,4 @@ -import { getAppEnvironment } from '../../../../shared/app-environment' +import { getAppEnvironment } from '../../../../shared/app-lifecycle/app-environment' import { getPreferredPairedRuntimeConnection } from '../../../../shared/remote-runtime/host-catalog/runtime-environments' import { listEnvironments, diff --git a/src/main/ipc/runtime-environments/requests/runtime-environment-abortable-requests.ts b/src/main/ipc/runtime-environments/requests/runtime-environment-abortable-requests.ts index 120162ac2c5..81be9d89f4a 100644 --- a/src/main/ipc/runtime-environments/requests/runtime-environment-abortable-requests.ts +++ b/src/main/ipc/runtime-environments/requests/runtime-environment-abortable-requests.ts @@ -1,5 +1,5 @@ import type { PairedRuntimeConnection } from '../../../../shared/remote-runtime/pairing/paired-runtime-connection' -import type { RuntimeCapability } from '../../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../../shared/remote-runtime/protocol/protocol-version' import { sendRemoteRuntimeRequestOnSocket } from '../../../../shared/remote-runtime/requests/remote-runtime-request-socket' import type { RuntimeRequestGuard, diff --git a/src/main/ipc/runtime-environments/requests/runtime-environment-runtime-pinned-send.ts b/src/main/ipc/runtime-environments/requests/runtime-environment-runtime-pinned-send.ts index 8582ea84c31..838d229f6b2 100644 --- a/src/main/ipc/runtime-environments/requests/runtime-environment-runtime-pinned-send.ts +++ b/src/main/ipc/runtime-environments/requests/runtime-environment-runtime-pinned-send.ts @@ -3,7 +3,7 @@ import { sendRemoteRuntimeRequestOnSocket } from '../../../../shared/remote-runt import { sendRemoteRuntimeRequestAbortable } from './runtime-environment-abortable-requests' import type { RuntimeRpcResponse } from '../../../../shared/remote-runtime/rpc/runtime-rpc-envelope' import type { KnownRuntimeEnvironment } from '../../../../shared/remote-runtime/host-catalog/runtime-environments' -import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../../shared/electron-remote-runtime-client-capabilities' +import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../../shared/remote-runtime/protocol/electron-remote-runtime-client-capabilities' import { sendRemoteRuntimeSharedControlRequestOnRuntime } from '../connections/runtime-environment-request-connections' import type { RuntimeEnvironmentCall } from './runtime-environment-call' import { runtimeEnvironmentChangedFailure } from './runtime-environment-revision-guard' diff --git a/src/main/ipc/runtime-environments/requests/runtime-environment-subscription-routing.ts b/src/main/ipc/runtime-environments/requests/runtime-environment-subscription-routing.ts index 5378af91f1a..a05c6f58b1f 100644 --- a/src/main/ipc/runtime-environments/requests/runtime-environment-subscription-routing.ts +++ b/src/main/ipc/runtime-environments/requests/runtime-environment-subscription-routing.ts @@ -6,7 +6,7 @@ import { } from '../../../../shared/remote-runtime/host-catalog/runtime-environment-subscription-setup' import { assertCrewSourceCurrent } from '../subscriptions/runtime-environment-subscription-setup' import { getPreferredPairedRuntimeConnection } from '../../../../shared/remote-runtime/host-catalog/runtime-environments' -import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../../shared/electron-remote-runtime-client-capabilities' +import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../../shared/remote-runtime/protocol/electron-remote-runtime-client-capabilities' import { resolveEnvironment } from '../../../../shared/remote-runtime/host-store/runtime-environment-store' import { resolveManagedRuntimeEnvironment, diff --git a/src/main/ipc/runtime-environments/requests/runtime-environment-support-routing.ts b/src/main/ipc/runtime-environments/requests/runtime-environment-support-routing.ts index 0c99ac9d93f..62d2fdbc17f 100644 --- a/src/main/ipc/runtime-environments/requests/runtime-environment-support-routing.ts +++ b/src/main/ipc/runtime-environments/requests/runtime-environment-support-routing.ts @@ -13,7 +13,7 @@ import { } from '../../../../shared/remote-runtime/host-catalog/runtime-environments' import { resolveEnvironment } from '../../../../shared/remote-runtime/host-store/runtime-environment-store' import { recordRuntimeEnvironmentUsage } from '../../../../shared/remote-runtime/host-store/runtime-environment-usage-record' -import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../../shared/electron-remote-runtime-client-capabilities' +import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../../shared/remote-runtime/protocol/electron-remote-runtime-client-capabilities' import '../../../../shared/remote-runtime/requests/remote-runtime-request-socket' import { subscribeRemoteRuntimeTransport } from '../../../../shared/remote-runtime/requests/remote-runtime-subscription-transport' import type { RemoteRuntimeTransportSubscription } from '../../../../shared/remote-runtime/requests/remote-runtime-subscription-contract' diff --git a/src/main/ipc/runtime-environments/requests/runtime-environment-transport-routing.ts b/src/main/ipc/runtime-environments/requests/runtime-environment-transport-routing.ts index 2f71fbdead5..dff0fcdc14c 100644 --- a/src/main/ipc/runtime-environments/requests/runtime-environment-transport-routing.ts +++ b/src/main/ipc/runtime-environments/requests/runtime-environment-transport-routing.ts @@ -4,7 +4,7 @@ import { } from './runtime-environment-usage-response' import { getRuntimeEnvironmentStatus } from '../status/runtime-environment-status-probe' import { getPreferredPairedRuntimeConnection } from '../../../../shared/remote-runtime/host-catalog/runtime-environments' -import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../../shared/electron-remote-runtime-client-capabilities' +import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../../shared/remote-runtime/protocol/electron-remote-runtime-client-capabilities' import { resolveEnvironment } from '../../../../shared/remote-runtime/host-store/runtime-environment-store' import { prepareFencedRuntimeRequest } from './runtime-environment-request-preparation' import { diff --git a/src/main/ipc/runtime-environments/status/runtime-environment-status-connection.test.ts b/src/main/ipc/runtime-environments/status/runtime-environment-status-connection.test.ts index 27b14b273e0..1a3a81cb3f5 100644 --- a/src/main/ipc/runtime-environments/status/runtime-environment-status-connection.test.ts +++ b/src/main/ipc/runtime-environments/status/runtime-environment-status-connection.test.ts @@ -5,7 +5,7 @@ import { join } from 'node:path' import { afterEach, expect, it, vi } from 'vitest' import { encodePairingOffer } from '../../../../shared/remote-runtime/pairing/pairing' import { addEnvironmentFromPairingCode } from '../../../../shared/remote-runtime/host-store/runtime-environment-store' -import '../../../../shared/protocol-version' +import '../../../../shared/remote-runtime/protocol/protocol-version' import { REMOTE_RUNTIME_SHARED_CONTROL_CAPABILITY } from '../../../../shared/remote-runtime/protocol/host-runtime-capabilities' import { createSharedControlTestServer, diff --git a/src/main/ipc/runtime-environments/status/runtime-environment-status-diagnostics.ts b/src/main/ipc/runtime-environments/status/runtime-environment-status-diagnostics.ts index 7e81c942ee2..0938efd11d0 100644 --- a/src/main/ipc/runtime-environments/status/runtime-environment-status-diagnostics.ts +++ b/src/main/ipc/runtime-environments/status/runtime-environment-status-diagnostics.ts @@ -1,5 +1,5 @@ import type { RuntimeRpcResponse } from '../../../../shared/remote-runtime/rpc/runtime-rpc-envelope' -import '../../../../shared/protocol-version' +import '../../../../shared/remote-runtime/protocol/protocol-version' import { REMOTE_RUNTIME_SHARED_CONTROL_CAPABILITY } from '../../../../shared/remote-runtime/protocol/host-runtime-capabilities' import { getRemoteRuntimeSharedControlDiagnostics } from '../connections/runtime-environment-request-connections' diff --git a/src/main/ipc/runtime-environments/status/runtime-environment-status-owner.ts b/src/main/ipc/runtime-environments/status/runtime-environment-status-owner.ts index 2173783be2f..1bea9015aa2 100644 --- a/src/main/ipc/runtime-environments/status/runtime-environment-status-owner.ts +++ b/src/main/ipc/runtime-environments/status/runtime-environment-status-owner.ts @@ -1,8 +1,8 @@ import { getRuntimeDesktopSurface } from '../../../runtime/construction/runtime-desktop-surface' import { sendRemoteRuntimeRequestOnSocket } from '../../../../shared/remote-runtime/requests/remote-runtime-request-socket' -import '../../../../shared/protocol-version' +import '../../../../shared/remote-runtime/protocol/protocol-version' import { REMOTE_RUNTIME_SHARED_CONTROL_CAPABILITY } from '../../../../shared/remote-runtime/protocol/host-runtime-capabilities' -import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../../shared/electron-remote-runtime-client-capabilities' +import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../../shared/remote-runtime/protocol/electron-remote-runtime-client-capabilities' import { getPreferredPairedRuntimeConnection, type KnownRuntimeEnvironment diff --git a/src/main/ipc/runtime-environments/status/runtime-environment-status-retirement.test.ts b/src/main/ipc/runtime-environments/status/runtime-environment-status-retirement.test.ts index dd8a903e2ed..72cb3fe5f09 100644 --- a/src/main/ipc/runtime-environments/status/runtime-environment-status-retirement.test.ts +++ b/src/main/ipc/runtime-environments/status/runtime-environment-status-retirement.test.ts @@ -9,7 +9,7 @@ import { refreshManagedOrcadPairing } from '../../../../shared/remote-runtime/host-store/runtime-environment-managed-orcad-store' import { pairingCode } from '../runtime-environments-ipc-test-harness' -import '../../../../shared/protocol-version' +import '../../../../shared/remote-runtime/protocol/protocol-version' import { REMOTE_RUNTIME_SHARED_CONTROL_CAPABILITY } from '../../../../shared/remote-runtime/protocol/host-runtime-capabilities' import { advanceRuntimeEnvironmentCapabilityIncarnation, @@ -103,22 +103,6 @@ async function repairMidProbe(now: number, keyByte = 1): Promise { advanceRuntimeEnvironmentCapabilityIncarnation(envId) } -it('answers from the successor owner when the probe itself re-paired the server', async () => { - mocks.request.mockImplementationOnce(async () => { - await repairMidProbe(2) - return { - id: 'status', - ok: false, - error: { code: 'unauthorized', message: 'refused' }, - _meta: { runtimeId: 'old-host' } - } - }) - mocks.request.mockResolvedValueOnce(response()) - await expect( - getRuntimeEnvironmentStatus(directory, envId, undefined, { reconnect: true }) - ).resolves.toMatchObject({ ok: true }) -}) - it.each([ ['a pairing under another host key', async () => await repairMidProbe(2, 2), true], ['a caller pinned to the old pairing', async () => await repairMidProbe(2), false] diff --git a/src/main/ipc/settings.ts b/src/main/ipc/settings.ts index 479eb8d85b7..c0aa510d6d7 100644 --- a/src/main/ipc/settings.ts +++ b/src/main/ipc/settings.ts @@ -25,7 +25,7 @@ import { applyBrowserSessionProxies } from '../browser/sessions/proxy/browser-se import { applyProxyToElectronUpdaterSession } from '../updater/lifecycle/electron-updater-proxy-session' import { browserSessionRegistry } from '../browser/sessions/profiles/browser-session-registry' import { sanitizeNetworkSettings } from './network-settings-sanitization' -import { normalizeAppIconId } from '../../shared/app-icon' +import { normalizeAppIconId } from '../../shared/app-lifecycle/identity/app-icon' import { normalizeUiLanguage } from '../../shared/ui-language' import { applyAppIcon } from '../window/desktop-integration/app-icon' import { registerCustomAppIconHandlers } from './custom-app-icon' @@ -45,7 +45,7 @@ import { import { computerAwakeSettingsForMode, normalizeComputerAwakeMode -} from '../../shared/computer-awake-mode' +} from '../../shared/app-lifecycle/computer-awake-mode' import { resolveAiVaultSearchSettings } from '../../shared/ai-vault/search/ai-vault-search-settings' import { applySessionSearchSettingsChange } from '../ai-vault-search/session-search-enablement' import { getRuntimeEnvironmentRegistryRoot } from './runtime-environments/catalog/runtime-environment-registry-root' diff --git a/src/main/ipc/shell-editor-ssh-host.ts b/src/main/ipc/shell-editor-ssh-host.ts index 885d64b1d50..e13d5e2bce0 100644 --- a/src/main/ipc/shell-editor-ssh-host.ts +++ b/src/main/ipc/shell-editor-ssh-host.ts @@ -1,4 +1,4 @@ -import { getAppEnvironment } from '../../shared/app-environment' +import { getAppEnvironment } from '../../shared/app-lifecycle/app-environment' import { parseExecutionHostId, toSshExecutionHostId } from '../../shared/execution-host' import { getManagedOrcadFenceEnvironmentId } from '../../shared/remote-runtime/ssh/managed-orcad-ssh-owner' import { listEnvironments } from '../../shared/remote-runtime/host-store/runtime-environment-store' diff --git a/src/main/ipc/ssh/ssh-host-launch-session-note.ts b/src/main/ipc/ssh/ssh-host-launch-session-note.ts index 89a87ac5228..ea02d1aa8c8 100644 --- a/src/main/ipc/ssh/ssh-host-launch-session-note.ts +++ b/src/main/ipc/ssh/ssh-host-launch-session-note.ts @@ -1,5 +1,5 @@ /** Flag macOS managed servers that outlive their launching SSH session. */ -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { listEnvironments } from '../../../shared/remote-runtime/host-store/runtime-environment-store' import { readManagedOrcadLaunchSshSession } from '../../managed-server/lifecycle/orcad-managed-launch-session' import { knownSshHostPlatform } from '../../ssh/remote-host/ssh-host-platform-memo' diff --git a/src/main/ipc/ssh/ssh-host-server-connect.ts b/src/main/ipc/ssh/ssh-host-server-connect.ts index e6306314d08..fd2186a7340 100644 --- a/src/main/ipc/ssh/ssh-host-server-connect.ts +++ b/src/main/ipc/ssh/ssh-host-server-connect.ts @@ -1,4 +1,4 @@ -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import type { SshConnectionState, SshManagedServerLinkedProject, diff --git a/src/main/ipc/ssh/ssh-host-server-on-connect-wiring.ts b/src/main/ipc/ssh/ssh-host-server-on-connect-wiring.ts index 0eb6bdf8236..296a3ce0064 100644 --- a/src/main/ipc/ssh/ssh-host-server-on-connect-wiring.ts +++ b/src/main/ipc/ssh/ssh-host-server-on-connect-wiring.ts @@ -1,4 +1,4 @@ -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { getManagedOrcadFenceEnvironmentId, managedOrcadServerName diff --git a/src/main/ipc/ssh/ssh-host-user-disconnect.ts b/src/main/ipc/ssh/ssh-host-user-disconnect.ts index dd8838032e5..9e28e4951d6 100644 --- a/src/main/ipc/ssh/ssh-host-user-disconnect.ts +++ b/src/main/ipc/ssh/ssh-host-user-disconnect.ts @@ -1,4 +1,4 @@ -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { getManagedOrcadFenceEnvironmentId } from '../../../shared/remote-runtime/ssh/managed-orcad-ssh-owner' import { listEnvironments } from '../../../shared/remote-runtime/host-store/runtime-environment-store' import { diff --git a/src/main/ipc/ssh/ssh.ts b/src/main/ipc/ssh/ssh.ts index 365bde2c5b1..5d3105ca6dc 100644 --- a/src/main/ipc/ssh/ssh.ts +++ b/src/main/ipc/ssh/ssh.ts @@ -69,7 +69,7 @@ import { disposeOrcadManagedTunnels } from '../../managed-server/lifecycle/orcad import { retainUnretainedOrcadMigrationSources } from '../../persistence/migrating-orcad-catalog/retained-source/orcad-migration-source-retention' import { reconcileManagedOrcadSshTargets } from '../../persistence/migrating-orcad-catalog/retained-source/orcad-retained-source' import { installOrcadMigrationScrollbackRetention } from '../../persistence/migrating-orcad-catalog/terminal-history/orcad-migration-scrollback-retention-wiring' -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { registerLegacyRelayBridgeIpc } from '../../ssh/legacy-relay/bridge/legacy-relay-bridge-ipc' import { onLastBridgedTerminalExit, diff --git a/src/main/local-builds/local-build-candidate.ts b/src/main/local-builds/local-build-candidate.ts index 6ff9e90eaf7..a042eb73001 100644 --- a/src/main/local-builds/local-build-candidate.ts +++ b/src/main/local-builds/local-build-candidate.ts @@ -10,7 +10,7 @@ import { parseLocalBuildCompatibility, type LocalBuildCompatibility } from '../../shared/remote-runtime/orcad-distribution/local-build-compatibility' -import { isValidAppVersion } from '../../shared/app-version' +import { isValidAppVersion } from '../../shared/app-lifecycle/identity/app-version' const MAX_MANIFEST_BYTES = 256 * 1024 const MAX_COMPATIBILITY_BYTES = 64 * 1024 diff --git a/src/main/local-builds/local-build-switch.ts b/src/main/local-builds/local-build-switch.ts index 3cfc2ffcda4..9165d69f18d 100644 --- a/src/main/local-builds/local-build-switch.ts +++ b/src/main/local-builds/local-build-switch.ts @@ -1,7 +1,7 @@ import { app, dialog, type BrowserWindow } from 'electron' import { translateMain } from '../i18n/main-i18n' import { SCHEMA_VERSION } from '../../shared/constants' -import { compareAppVersions } from '../../shared/app-version' +import { compareAppVersions } from '../../shared/app-lifecycle/identity/app-version' import { assertLocalBuildCompatibility } from './local-build-compatibility' import { loadLocalBuildCandidate, type LocalBuildCandidate } from './local-build-candidate' diff --git a/src/main/managed-data-accounts/service.ts b/src/main/managed-data-accounts/service.ts index b91633f366d..388cbd68fc7 100644 --- a/src/main/managed-data-accounts/service.ts +++ b/src/main/managed-data-accounts/service.ts @@ -2,7 +2,7 @@ import { randomUUID } from 'node:crypto' import { existsSync, lstatSync, mkdirSync, readFileSync, realpathSync, rmSync } from 'node:fs' import { join, resolve, sep } from 'node:path' import { z } from 'zod' -import { getAppEnvironment } from '../../shared/app-environment' +import { getAppEnvironment } from '../../shared/app-lifecycle/app-environment' import { writeSecureFile } from '../../shared/secure-storage/secure-file' import type { ManagedDataAccountProvider, diff --git a/src/main/managed-server/activation/orcad-host-version-admission.ts b/src/main/managed-server/activation/orcad-host-version-admission.ts index 0c16051d522..39644d5a4dc 100644 --- a/src/main/managed-server/activation/orcad-host-version-admission.ts +++ b/src/main/managed-server/activation/orcad-host-version-admission.ts @@ -1,5 +1,5 @@ /** Reject activation over state a newer host build may already have migrated. */ -import { compareAppVersions } from '../../../shared/app-version' +import { compareAppVersions } from '../../../shared/app-lifecycle/identity/app-version' import type { OrcadActivationRecord } from './orcad-activation-record' export type OrcadHostVersionRefusal = 'host-newer' diff --git a/src/main/managed-server/host-state/orcad-windows-host-preparation.ts b/src/main/managed-server/host-state/orcad-windows-host-preparation.ts index b97c90b99fa..2d62e0bd82b 100644 --- a/src/main/managed-server/host-state/orcad-windows-host-preparation.ts +++ b/src/main/managed-server/host-state/orcad-windows-host-preparation.ts @@ -1,6 +1,6 @@ // Stage pinned Node and a content-addressed host script so Windows operations share verified bytes without replacing running clients' code. import { join } from 'node:path' -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import type { NodeRuntimeTarget } from '../../../shared/node-runtime/node-runtime-pin' import { ensureRemoteOrcadNodeRuntime } from '../install/orcad-remote-node-runtime' import { diff --git a/src/main/managed-server/install/orcad-remote-deploy.ts b/src/main/managed-server/install/orcad-remote-deploy.ts index 0fecc044dfe..9db028b6a2e 100644 --- a/src/main/managed-server/install/orcad-remote-deploy.ts +++ b/src/main/managed-server/install/orcad-remote-deploy.ts @@ -11,7 +11,7 @@ import type { OrcadActivationVerdict } from '../activation/orcad-activation-gate import type { OrcadTerminalCensus } from '../../../shared/remote-runtime/orcad-lifecycle/orcad-terminal-census' import type { RemoteHostPlatform } from '../../ssh/remote-host/ssh-remote-platform' import { installOrcadBundle } from './orcad-remote-install' -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import type { NodeRuntimeTarget } from '../../../shared/node-runtime/node-runtime-pin' import { ORCAD_STARTUP_READINESS_TIMEOUT_MS } from '../../../shared/remote-runtime/orcad-distribution/orcad-profile-preflight' import { materializeOrcadArtifact } from '../../orcad/artifact-slots/orcad-artifact-materializer' diff --git a/src/main/managed-server/lifecycle/orcad-managed-update-decision.ts b/src/main/managed-server/lifecycle/orcad-managed-update-decision.ts index 4ca74175829..fcc7b13c435 100644 --- a/src/main/managed-server/lifecycle/orcad-managed-update-decision.ts +++ b/src/main/managed-server/lifecycle/orcad-managed-update-decision.ts @@ -1,4 +1,7 @@ -import { compareAppVersions, isValidAppVersion } from '../../../shared/app-version' +import { + compareAppVersions, + isValidAppVersion +} from '../../../shared/app-lifecycle/identity/app-version' import type { OrcadActivationRecord } from '../activation/orcad-activation-record' import { refuseOrcadHostDowngrade, diff --git a/src/main/managed-server/lifecycle/orcad-runtime-deployment.ts b/src/main/managed-server/lifecycle/orcad-runtime-deployment.ts index bda69fced55..d6459b9b095 100644 --- a/src/main/managed-server/lifecycle/orcad-runtime-deployment.ts +++ b/src/main/managed-server/lifecycle/orcad-runtime-deployment.ts @@ -1,5 +1,5 @@ // Target claims preserve environment identity so interrupted deploys resume the same registration. -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { randomUUID } from 'node:crypto' import { assertRuntimeEnvironmentNotReconciling } from '../../../shared/remote-runtime/host-catalog/runtime-environment-reconciliation-record' import { listEnvironments } from '../../../shared/remote-runtime/host-store/runtime-environment-store' diff --git a/src/main/managed-server/lifecycle/orcad-runtime-maintenance.ts b/src/main/managed-server/lifecycle/orcad-runtime-maintenance.ts index 448d7e85e20..6d983f79698 100644 --- a/src/main/managed-server/lifecycle/orcad-runtime-maintenance.ts +++ b/src/main/managed-server/lifecycle/orcad-runtime-maintenance.ts @@ -1,4 +1,4 @@ -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { redactRuntimeEnvironment } from '../../../shared/remote-runtime/host-catalog/runtime-environments' import type { OrcadManagedDeployResult, diff --git a/src/main/managed-server/lifecycle/orcad-runtime-status.ts b/src/main/managed-server/lifecycle/orcad-runtime-status.ts index a7d9f88bd81..7fcc1f7c767 100644 --- a/src/main/managed-server/lifecycle/orcad-runtime-status.ts +++ b/src/main/managed-server/lifecycle/orcad-runtime-status.ts @@ -9,7 +9,7 @@ import { import { currentManagedOrcadUpdateDeferral } from './orcad-managed-update-deferrals' import { findIncompleteManagedOrcadMigration } from './orcad-managed-migration-status' import { collectManagedTerminalCensus } from './orcad-terminal-census-client' -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { bundledManagedOrcadVersion } from './orcad-managed-auto-update' import { availableManagedOrcadUpdate } from './orcad-managed-update-decision' diff --git a/src/main/managed-server/lifecycle/orcad-terminal-census-client.ts b/src/main/managed-server/lifecycle/orcad-terminal-census-client.ts index ba32a3da217..78ae9040d1c 100644 --- a/src/main/managed-server/lifecycle/orcad-terminal-census-client.ts +++ b/src/main/managed-server/lifecycle/orcad-terminal-census-client.ts @@ -1,6 +1,6 @@ /** Unknown failures, including older hosts without census support, stay unverifiable and never mean zero live terminals. */ import { ORCAD_TERMINAL_CENSUS_RUNTIME_CAPABILITY } from '../../../shared/remote-runtime/protocol/orcad-runtime-capabilities' -import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../shared/electron-remote-runtime-client-capabilities' +import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../shared/remote-runtime/protocol/electron-remote-runtime-client-capabilities' import type { PairedRuntimeConnection } from '../../../shared/remote-runtime/pairing/paired-runtime-connection' import { getPreferredPairedRuntimeConnection, diff --git a/src/main/managed-server/migration/catalog/orcad-migration-request.ts b/src/main/managed-server/migration/catalog/orcad-migration-request.ts index 2f46364d013..f1a73be82a0 100644 --- a/src/main/managed-server/migration/catalog/orcad-migration-request.ts +++ b/src/main/managed-server/migration/catalog/orcad-migration-request.ts @@ -1,7 +1,7 @@ import { AUTOMATION_EXTRA_AGENT_ARGS_RUNTIME_CAPABILITY } from '../../../../shared/automations/automation-runtime-capabilities' import { pairedRuntimeConnectionFromOffer } from '../../../../shared/remote-runtime/pairing/paired-runtime-connection' import type { parsePairingCode } from '../../../../shared/remote-runtime/pairing/pairing' -import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../../shared/electron-remote-runtime-client-capabilities' +import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../../shared/remote-runtime/protocol/electron-remote-runtime-client-capabilities' import { ORCAD_MIGRATION_CATALOG_RUNTIME_CAPABILITY } from '../../../../shared/remote-runtime/protocol/orcad-runtime-capabilities' import { sendRemoteRuntimeRequestOnSocket } from '../../../../shared/remote-runtime/requests/remote-runtime-request-socket' import type { RuntimeRpcResponse } from '../../../../shared/remote-runtime/rpc/runtime-rpc-envelope' diff --git a/src/main/memory/collector.ts b/src/main/memory/collector.ts index 11d7a52d285..20c1fb4e5ee 100644 --- a/src/main/memory/collector.ts +++ b/src/main/memory/collector.ts @@ -1,7 +1,7 @@ import { execFile } from 'node:child_process' import { promisify } from 'node:util' import os from 'node:os' -import { getAppEnvironment, type AppEnvironment } from '../../shared/app-environment' +import { getAppEnvironment, type AppEnvironment } from '../../shared/app-lifecycle/app-environment' import type { AppMemory, MemorySnapshot, diff --git a/src/main/menu/register-app-menu.ts b/src/main/menu/register-app-menu.ts index 2cc6e576a4b..cce852bfb6a 100644 --- a/src/main/menu/register-app-menu.ts +++ b/src/main/menu/register-app-menu.ts @@ -2,7 +2,7 @@ import { BrowserWindow, Menu, app } from 'electron' import { formatKeybindingList } from '../../shared/keybindings/formatting' import { getEffectiveKeybindingsForAction } from '../../shared/keybindings/effective' import type { KeybindingActionId, KeybindingOverrides } from '../../shared/keybindings/types' -import type { UpdateCheckOptions } from '../../shared/update-status-types' +import type { UpdateCheckOptions } from '../../shared/updater/update-status-types' import { translateMain } from '../i18n/main-i18n' import { createAppMenuSelectionItem, resolveNativeEditTarget } from './app-menu-selection-item' import { createAppMenuQuitItems, type AppMenuQuitHandlers } from './app-menu-quit-item' diff --git a/src/main/mimo/hook-service.test.ts b/src/main/mimo/hook-service.test.ts index 904263d6f3a..4c762819f50 100644 --- a/src/main/mimo/hook-service.test.ts +++ b/src/main/mimo/hook-service.test.ts @@ -12,7 +12,7 @@ import { } from 'node:fs' import { tmpdir } from 'node:os' import { join } from 'node:path' -import { setAppEnvironment } from '../../shared/app-environment' +import { setAppEnvironment } from '../../shared/app-lifecycle/app-environment' const { getPathMock } = vi.hoisted(() => ({ getPathMock: vi.fn<(name: string) => string>() diff --git a/src/main/mimo/hook-service.ts b/src/main/mimo/hook-service.ts index 63e419bce9d..e89a86c7c46 100644 --- a/src/main/mimo/hook-service.ts +++ b/src/main/mimo/hook-service.ts @@ -1,4 +1,4 @@ -import { getAppEnvironment } from '../../shared/app-environment' +import { getAppEnvironment } from '../../shared/app-lifecycle/app-environment' import { isAbsolute, join } from 'node:path' import { homedir } from 'node:os' import { diff --git a/src/main/native-chat/conversation-files/native-chat-visuals-skill-location.ts b/src/main/native-chat/conversation-files/native-chat-visuals-skill-location.ts index 5afc5b201af..b64234e5ef4 100644 --- a/src/main/native-chat/conversation-files/native-chat-visuals-skill-location.ts +++ b/src/main/native-chat/conversation-files/native-chat-visuals-skill-location.ts @@ -2,7 +2,7 @@ import { access } from 'node:fs/promises' import { join } from 'node:path' -import { getAppEnvironment, hasAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment, hasAppEnvironment } from '../../../shared/app-lifecycle/app-environment' const PLUGIN_DIR_NAME = 'native-chat-visuals' export const NATIVE_CHAT_VISUALS_SKILL_NAME = 'orca-chat-visuals' diff --git a/src/main/native-chat/paste-files/native-chat-paste-files.ts b/src/main/native-chat/paste-files/native-chat-paste-files.ts index 4ca4e8b5919..eff37f13be7 100644 --- a/src/main/native-chat/paste-files/native-chat-paste-files.ts +++ b/src/main/native-chat/paste-files/native-chat-paste-files.ts @@ -2,7 +2,7 @@ import { lstat, realpath, stat } from 'node:fs/promises' import path from 'node:path' -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { NATIVE_CHAT_PASTE_FOLDER } from '../../../shared/native-chat/input/composer/native-chat-paste-folder' const MAX_RESTORED_PASTES = 256 diff --git a/src/main/notifications/desktop-away-state.ts b/src/main/notifications/desktop-away-state.ts index 139f75e5404..3517a83e1ed 100644 --- a/src/main/notifications/desktop-away-state.ts +++ b/src/main/notifications/desktop-away-state.ts @@ -1,4 +1,4 @@ -import { DESKTOP_AWAY_SECONDS } from '../../shared/desktop-away-threshold' +import { DESKTOP_AWAY_SECONDS } from '../../shared/app-lifecycle/presence/desktop-away-threshold' type IdleMonitor = { getSystemIdleState(threshold: number): string diff --git a/src/main/notifications/desktop-presence-reporter.ts b/src/main/notifications/desktop-presence-reporter.ts index 9591197c5a8..c677ad11c5a 100644 --- a/src/main/notifications/desktop-presence-reporter.ts +++ b/src/main/notifications/desktop-presence-reporter.ts @@ -1,7 +1,7 @@ import { DESKTOP_PRESENCE_REPORT_INTERVAL_MS, NOTIFICATIONS_DESKTOP_PRESENCE_RUNTIME_CAPABILITY -} from '../../shared/desktop-client-presence' +} from '../../shared/app-lifecycle/presence/desktop-client-presence' import { getRuntimeEnvironmentStatusSnapshots } from '../ipc/runtime-environments/connections/runtime-environment-request-connections' import { listReadySharedControlSockets, diff --git a/src/main/observability/logs-directory.ts b/src/main/observability/logs-directory.ts index 97490ed4639..d8a55affb3f 100644 --- a/src/main/observability/logs-directory.ts +++ b/src/main/observability/logs-directory.ts @@ -1,4 +1,4 @@ -import { getAppEnvironment, hasAppEnvironment } from '../../shared/app-environment' +import { getAppEnvironment, hasAppEnvironment } from '../../shared/app-lifecycle/app-environment' import { homedir, platform } from 'node:os' import { join } from 'node:path' diff --git a/src/main/opencode/acp/opencode-acp-environment.ts b/src/main/opencode/acp/opencode-acp-environment.ts index ae6bb71aeec..b52ed14191e 100644 --- a/src/main/opencode/acp/opencode-acp-environment.ts +++ b/src/main/opencode/acp/opencode-acp-environment.ts @@ -1,5 +1,5 @@ import { restoreOrStripOverlayEnv } from '../../../shared/agent-launch/startup/agent-overlay-env' -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { isOpenCodeLegacySharedConfigDir } from '../status-hooks/legacy-shared-config-dir' const ORCA_ENV_PREFIXES = ['ORCA_OPENCODE_', 'ORCA_DATA_ACCOUNT_'] diff --git a/src/main/opencode/model-launch/opencode-model-version-policy.ts b/src/main/opencode/model-launch/opencode-model-version-policy.ts index 06cbf670923..c0523faaff4 100644 --- a/src/main/opencode/model-launch/opencode-model-version-policy.ts +++ b/src/main/opencode/model-launch/opencode-model-version-policy.ts @@ -1,4 +1,4 @@ -import { compareAppVersions } from '../../../shared/app-version' +import { compareAppVersions } from '../../../shared/app-lifecycle/identity/app-version' import { OPENCODE_NATIVE_PROMPT_VERSIONS } from '../../../shared/agent-launch/startup/opencode-cli-version' // Real-CLI-verified floors, capped to their major: a new major may change the model route. diff --git a/src/main/opencode/startup-prompts/opencode-startup-prompt-installer.test.ts b/src/main/opencode/startup-prompts/opencode-startup-prompt-installer.test.ts index d3c547263f9..bab712825a6 100644 --- a/src/main/opencode/startup-prompts/opencode-startup-prompt-installer.test.ts +++ b/src/main/opencode/startup-prompts/opencode-startup-prompt-installer.test.ts @@ -10,7 +10,7 @@ import { } from 'node:fs' import { tmpdir } from 'node:os' import { join } from 'node:path' -import { setAppEnvironment } from '../../../shared/app-environment' +import { setAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { createOpenCodeStartupPromptInstaller, installOpenCodeStartupPromptForLaunch diff --git a/src/main/opencode/status-hooks/hook-service-startup-refresh.test.ts b/src/main/opencode/status-hooks/hook-service-startup-refresh.test.ts index 0480fb1e0da..04c380d38d7 100644 --- a/src/main/opencode/status-hooks/hook-service-startup-refresh.test.ts +++ b/src/main/opencode/status-hooks/hook-service-startup-refresh.test.ts @@ -2,7 +2,7 @@ import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs' import { tmpdir } from 'node:os' import { join } from 'node:path' -import { setAppEnvironment } from '../../../shared/app-environment' +import { setAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { OpenCodeHookService } from './hook-service' import { resolveOpenCodeConfigDirectory } from '../../../shared/agent-launch/plugins/opencode/opencode-config-directory' diff --git a/src/main/opencode/status-hooks/hook-service.test.ts b/src/main/opencode/status-hooks/hook-service.test.ts index 99dfa9219bd..61cf0102951 100644 --- a/src/main/opencode/status-hooks/hook-service.test.ts +++ b/src/main/opencode/status-hooks/hook-service.test.ts @@ -11,7 +11,7 @@ import { } from 'node:fs' import { tmpdir } from 'node:os' import { join } from 'node:path' -import { setAppEnvironment } from '../../../shared/app-environment' +import { setAppEnvironment } from '../../../shared/app-lifecycle/app-environment' const { getPathMock } = vi.hoisted(() => ({ getPathMock: vi.fn<(name: string) => string>() diff --git a/src/main/opencode/status-hooks/hook-service.ts b/src/main/opencode/status-hooks/hook-service.ts index 1cbcebb7b40..e7a464c3cbe 100644 --- a/src/main/opencode/status-hooks/hook-service.ts +++ b/src/main/opencode/status-hooks/hook-service.ts @@ -1,4 +1,4 @@ -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { join } from 'node:path' import { existsSync, diff --git a/src/main/opencode/status-hooks/overlay-dir-gc.test.ts b/src/main/opencode/status-hooks/overlay-dir-gc.test.ts index e23a238a438..34b22139300 100644 --- a/src/main/opencode/status-hooks/overlay-dir-gc.test.ts +++ b/src/main/opencode/status-hooks/overlay-dir-gc.test.ts @@ -10,7 +10,7 @@ import { import { tmpdir } from 'node:os' import { join } from 'node:path' import { afterEach, beforeEach, expect, it, vi } from 'vitest' -import { setAppEnvironment } from '../../../shared/app-environment' +import { setAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { OPENCODE_OVERLAY_MANIFEST_FILE } from './opencode-overlay-manifest' import { OPENCODE_DIR_GC_MIN_AGE_MS, sweepOrphanedOpenCodeDirs } from './overlay-dir-gc' diff --git a/src/main/opencode/text-tasks/wsl/opencode-wsl-text-task.ts b/src/main/opencode/text-tasks/wsl/opencode-wsl-text-task.ts index b100432a35d..6dbde2457ec 100644 --- a/src/main/opencode/text-tasks/wsl/opencode-wsl-text-task.ts +++ b/src/main/opencode/text-tasks/wsl/opencode-wsl-text-task.ts @@ -1,7 +1,7 @@ import { randomBytes } from 'node:crypto' import { existsSync } from 'node:fs' import { join } from 'node:path' -import { getAppEnvironment } from '../../../../shared/app-environment' +import { getAppEnvironment } from '../../../../shared/app-lifecycle/app-environment' import { waitForPromiseWithSignal } from '../../../../shared/concurrency/abort-signal-reason' import { OPENCODE_WSL_TEXT_TASK_FILENAME } from '../../../../shared/remote-runtime/orcad-distribution/remote-bundle-artifacts' import { SearchSubprocessLineAccumulator } from '../../../../shared/search-subprocess-lines' diff --git a/src/main/orca-profiles/catalog/profile-project-presence.ts b/src/main/orca-profiles/catalog/profile-project-presence.ts index 0ecead33774..b3905ad3779 100644 --- a/src/main/orca-profiles/catalog/profile-project-presence.ts +++ b/src/main/orca-profiles/catalog/profile-project-presence.ts @@ -1,7 +1,7 @@ import type { FindOrcaProfileProjectsByPathArgs, FindOrcaProfileProjectsByPathResult -} from '../../../shared/orca-profiles' +} from '../../../shared/orca-profiles/orca-profiles' import { getOrcaProfileListState } from '../profile-index-store' import { readProfileState } from '../project-transfer/profile-project-state-file' import { repoPhysicalKey } from '../project-transfer/profile-project-worktree-identity' diff --git a/src/main/orca-profiles/cloud-auth/profile-artifact-cloud-cleanup.ts b/src/main/orca-profiles/cloud-auth/profile-artifact-cloud-cleanup.ts index e616a653968..ed02346822c 100644 --- a/src/main/orca-profiles/cloud-auth/profile-artifact-cloud-cleanup.ts +++ b/src/main/orca-profiles/cloud-auth/profile-artifact-cloud-cleanup.ts @@ -1,6 +1,9 @@ import { existsSync, readFileSync, rmSync } from 'node:fs' import { join } from 'node:path' -import type { OrcaProfileCloudSummary, OrcaProfileSummary } from '../../../shared/orca-profiles' +import type { + OrcaProfileCloudSummary, + OrcaProfileSummary +} from '../../../shared/orca-profiles/orca-profiles' import { bestEffortFsyncDirectorySync, writeDurableSecureJsonFile diff --git a/src/main/orca-profiles/cloud-auth/profile-cloud-auth-status.ts b/src/main/orca-profiles/cloud-auth/profile-cloud-auth-status.ts index 1cbbb8e9936..5c975df71c5 100644 --- a/src/main/orca-profiles/cloud-auth/profile-cloud-auth-status.ts +++ b/src/main/orca-profiles/cloud-auth/profile-cloud-auth-status.ts @@ -1,4 +1,4 @@ -import type { OrcaProfileAuthStatus } from '../../../shared/orca-profiles' +import type { OrcaProfileAuthStatus } from '../../../shared/orca-profiles/orca-profiles' import type { ActiveOrcaProfileState } from '../profile-index-store' import { getOrcaCloudAuthConfig, isOrcaCloudDevAuthEnabled } from './profile-cloud-auth-config' import { readCloudSession } from '../cloud-session/profile-cloud-session-owner' diff --git a/src/main/orca-profiles/cloud-auth/profile-cloud-capability-refresh.ts b/src/main/orca-profiles/cloud-auth/profile-cloud-capability-refresh.ts index 3f21ba08b5e..f42bbf9ffaa 100644 --- a/src/main/orca-profiles/cloud-auth/profile-cloud-capability-refresh.ts +++ b/src/main/orca-profiles/cloud-auth/profile-cloud-capability-refresh.ts @@ -1,4 +1,4 @@ -import type { RefreshCurrentOrcaProfileAuthResult } from '../../../shared/orca-profiles' +import type { RefreshCurrentOrcaProfileAuthResult } from '../../../shared/orca-profiles/orca-profiles' import { getOrcaCloudAuthConfig, isOrcaCloudDevAuthEnabled } from './profile-cloud-auth-config' import { getOrcaProfileAuthStatusFromProfile } from './profile-cloud-auth-status' import { refreshOrcaCloudCapabilities } from './profile-cloud-client' diff --git a/src/main/orca-profiles/cloud-auth/profile-cloud-client.ts b/src/main/orca-profiles/cloud-auth/profile-cloud-client.ts index 86a46fa48d7..14e05db4d46 100644 --- a/src/main/orca-profiles/cloud-auth/profile-cloud-client.ts +++ b/src/main/orca-profiles/cloud-auth/profile-cloud-client.ts @@ -2,7 +2,7 @@ import type { OrcaCloudCapabilities, OrcaCloudOrgSummary, OrcaProfileCloudSummary -} from '../../../shared/orca-profiles' +} from '../../../shared/orca-profiles/orca-profiles' import type { OrcaCloudAuthConfig } from './profile-cloud-auth-config' import type { OrcaCloudSession } from '../cloud-session/profile-cloud-session-store' import type { OrcaCloudSessionExchangeResponse } from '../cloud-session/profile-cloud-session-exchange' diff --git a/src/main/orca-profiles/cloud-auth/profile-cloud-dev-auth.ts b/src/main/orca-profiles/cloud-auth/profile-cloud-dev-auth.ts index c78fa932196..6cc357430dc 100644 --- a/src/main/orca-profiles/cloud-auth/profile-cloud-dev-auth.ts +++ b/src/main/orca-profiles/cloud-auth/profile-cloud-dev-auth.ts @@ -1,5 +1,8 @@ import { randomUUID } from 'node:crypto' -import type { OrcaCloudCapabilities, OrcaCloudOrgSummary } from '../../../shared/orca-profiles' +import type { + OrcaCloudCapabilities, + OrcaCloudOrgSummary +} from '../../../shared/orca-profiles/orca-profiles' import type { OrcaCloudSessionExchangeResponse } from '../cloud-session/profile-cloud-session-exchange' const DEV_SESSION_TTL_MS = 7 * 24 * 60 * 60 * 1000 diff --git a/src/main/orca-profiles/cloud-auth/profile-cloud-dev-service.ts b/src/main/orca-profiles/cloud-auth/profile-cloud-dev-service.ts index 595d53b5dbe..400fb57470e 100644 --- a/src/main/orca-profiles/cloud-auth/profile-cloud-dev-service.ts +++ b/src/main/orca-profiles/cloud-auth/profile-cloud-dev-service.ts @@ -1,7 +1,7 @@ import type { CreateCloudLinkedOrcaProfileArgs, OrcaProfileListState -} from '../../../shared/orca-profiles' +} from '../../../shared/orca-profiles/orca-profiles' import type { ActiveOrcaProfileState } from '../profile-index-store' import { createCloudLinkedOrcaProfileRecord, linkOrcaProfileToCloud } from './profile-cloud-index' import { readCloudSession, signInCloudSession } from '../cloud-session/profile-cloud-session-owner' diff --git a/src/main/orca-profiles/cloud-auth/profile-cloud-index.ts b/src/main/orca-profiles/cloud-auth/profile-cloud-index.ts index 8bf434a320a..d78f7399a5f 100644 --- a/src/main/orca-profiles/cloud-auth/profile-cloud-index.ts +++ b/src/main/orca-profiles/cloud-auth/profile-cloud-index.ts @@ -4,7 +4,7 @@ import type { OrcaProfileCloudSummary, OrcaProfileListState, OrcaProfileSummary -} from '../../../shared/orca-profiles' +} from '../../../shared/orca-profiles/orca-profiles' import { loadOrCreateProfileIndex, writeProfileIndex } from '../profile-index-store' import { getOrcaProfileDirectory, getOrcaProfileIndexPath } from '../profile-storage-paths' import { diff --git a/src/main/orca-profiles/cloud-auth/profile-cloud-service-connect-overlap.test.ts b/src/main/orca-profiles/cloud-auth/profile-cloud-service-connect-overlap.test.ts index 1f9db6ecc9e..68f9f3d615c 100644 --- a/src/main/orca-profiles/cloud-auth/profile-cloud-service-connect-overlap.test.ts +++ b/src/main/orca-profiles/cloud-auth/profile-cloud-service-connect-overlap.test.ts @@ -6,7 +6,7 @@ import type { OrcaCloudCapabilities, OrcaCloudOrgSummary, OrcaProfileCloudSummary -} from '../../../shared/orca-profiles' +} from '../../../shared/orca-profiles/orca-profiles' const { beginOrcaCloudPkceFlowMock, diff --git a/src/main/orca-profiles/cloud-auth/profile-cloud-service-sign-out-connect-race.test.ts b/src/main/orca-profiles/cloud-auth/profile-cloud-service-sign-out-connect-race.test.ts index d88825a2b2c..f3ab0e053dc 100644 --- a/src/main/orca-profiles/cloud-auth/profile-cloud-service-sign-out-connect-race.test.ts +++ b/src/main/orca-profiles/cloud-auth/profile-cloud-service-sign-out-connect-race.test.ts @@ -6,7 +6,7 @@ import type { OrcaCloudCapabilities, OrcaCloudOrgSummary, OrcaProfileCloudSummary -} from '../../../shared/orca-profiles' +} from '../../../shared/orca-profiles/orca-profiles' const { beginOrcaCloudPkceFlowMock, diff --git a/src/main/orca-profiles/cloud-auth/profile-cloud-service.ts b/src/main/orca-profiles/cloud-auth/profile-cloud-service.ts index 9de520ed49d..52a0b1e0005 100644 --- a/src/main/orca-profiles/cloud-auth/profile-cloud-service.ts +++ b/src/main/orca-profiles/cloud-auth/profile-cloud-service.ts @@ -5,7 +5,7 @@ import type { OrcaProfileAuthStatus, SelectOrcaProfileOrgResult, SignOutCurrentOrcaProfileResult -} from '../../../shared/orca-profiles' +} from '../../../shared/orca-profiles/orca-profiles' import { ensureActiveOrcaProfile } from '../profile-index-store' import { getOrcaCloudAuthConfig, isOrcaCloudDevAuthEnabled } from './profile-cloud-auth-config' import { diff --git a/src/main/orca-profiles/cloud-auth/profile-cloud-sign-in-progress.ts b/src/main/orca-profiles/cloud-auth/profile-cloud-sign-in-progress.ts index a9d1428f488..520b841b699 100644 --- a/src/main/orca-profiles/cloud-auth/profile-cloud-sign-in-progress.ts +++ b/src/main/orca-profiles/cloud-auth/profile-cloud-sign-in-progress.ts @@ -1,4 +1,4 @@ -import type { OrcaCloudSignInProgress } from '../../../shared/orca-profiles' +import type { OrcaCloudSignInProgress } from '../../../shared/orca-profiles/orca-profiles' type ProgressListener = (progress: OrcaCloudSignInProgress | null) => void diff --git a/src/main/orca-profiles/cloud-org/profile-cloud-dev-org-members.ts b/src/main/orca-profiles/cloud-org/profile-cloud-dev-org-members.ts index 87c0369f275..2899b05a1ea 100644 --- a/src/main/orca-profiles/cloud-org/profile-cloud-dev-org-members.ts +++ b/src/main/orca-profiles/cloud-org/profile-cloud-dev-org-members.ts @@ -7,7 +7,7 @@ import type { OrcaProfileOrgMemberMutationResult, OrcaProfileOrgMemberRemoveArgs, OrcaProfileOrgInviteRevokeArgs -} from '../../../shared/orca-profiles' +} from '../../../shared/orca-profiles/orca-profiles' // With no dev-auth server, this roster mirrors real membership states and mutation results. type DevOrgRoster = { diff --git a/src/main/orca-profiles/cloud-org/profile-cloud-org-members-client.ts b/src/main/orca-profiles/cloud-org/profile-cloud-org-members-client.ts index 25812395718..aad9a4b1e2c 100644 --- a/src/main/orca-profiles/cloud-org/profile-cloud-org-members-client.ts +++ b/src/main/orca-profiles/cloud-org/profile-cloud-org-members-client.ts @@ -3,7 +3,7 @@ import type { OrcaOrgMembersRoster, OrcaOrgPendingInvite, OrcaOrgRole -} from '../../../shared/orca-profiles' +} from '../../../shared/orca-profiles/orca-profiles' import type { OrcaCloudAuthConfig } from '../cloud-auth/profile-cloud-auth-config' import type { OrcaCloudSession } from '../cloud-session/profile-cloud-session-store' import { OrcaCloudRequestError } from '../cloud-auth/profile-cloud-client' diff --git a/src/main/orca-profiles/cloud-org/profile-cloud-org-members-service.ts b/src/main/orca-profiles/cloud-org/profile-cloud-org-members-service.ts index 36ff5517c9c..6a010f1dd08 100644 --- a/src/main/orca-profiles/cloud-org/profile-cloud-org-members-service.ts +++ b/src/main/orca-profiles/cloud-org/profile-cloud-org-members-service.ts @@ -5,7 +5,7 @@ import type { OrcaProfileOrgMemberMutationResult, OrcaProfileOrgMemberRemoveArgs, OrcaProfileOrgMembersListResult -} from '../../../shared/orca-profiles' +} from '../../../shared/orca-profiles/orca-profiles' import type { ActiveOrcaProfileState } from '../profile-index-store' import { ensureActiveOrcaProfile } from '../profile-index-store' import type { OrcaCloudAuthConfig } from '../cloud-auth/profile-cloud-auth-config' diff --git a/src/main/orca-profiles/cloud-org/profile-cloud-org-selection.ts b/src/main/orca-profiles/cloud-org/profile-cloud-org-selection.ts index bfd7a0514fc..86f0b16ab25 100644 --- a/src/main/orca-profiles/cloud-org/profile-cloud-org-selection.ts +++ b/src/main/orca-profiles/cloud-org/profile-cloud-org-selection.ts @@ -2,7 +2,7 @@ import type { OrcaCloudAuthConfig } from '../cloud-auth/profile-cloud-auth-confi import { OrcaCloudRequestError, selectOrcaCloudOrg } from '../cloud-auth/profile-cloud-client' import { forceRefreshOrcaCloudSession } from '../cloud-session/profile-cloud-session-refresh' import type { ActiveOrcaProfileState } from '../profile-index-store' -import type { OrcaProfileListState } from '../../../shared/orca-profiles' +import type { OrcaProfileListState } from '../../../shared/orca-profiles/orca-profiles' import { beginCloudSessionRelink, commitCloudSessionRelink, diff --git a/src/main/orca-profiles/cloud-session/profile-cloud-session-exchange.ts b/src/main/orca-profiles/cloud-session/profile-cloud-session-exchange.ts index f678e898eb7..824f679f942 100644 --- a/src/main/orca-profiles/cloud-session/profile-cloud-session-exchange.ts +++ b/src/main/orca-profiles/cloud-session/profile-cloud-session-exchange.ts @@ -2,7 +2,7 @@ import type { OrcaCloudCapabilities, OrcaCloudOrgSummary, OrcaProfileCloudSummary -} from '../../../shared/orca-profiles' +} from '../../../shared/orca-profiles/orca-profiles' export type OrcaCloudSessionExchangeResponse = { accessToken: string diff --git a/src/main/orca-profiles/cloud-session/profile-cloud-session-owner.ts b/src/main/orca-profiles/cloud-session/profile-cloud-session-owner.ts index d7e573beba7..ee271485479 100644 --- a/src/main/orca-profiles/cloud-session/profile-cloud-session-owner.ts +++ b/src/main/orca-profiles/cloud-session/profile-cloud-session-owner.ts @@ -3,7 +3,7 @@ import type { OrcaCloudOrgSummary, OrcaProfileCloudSummary, OrcaProfileListState -} from '../../../shared/orca-profiles' +} from '../../../shared/orca-profiles/orca-profiles' import { linkOrcaProfileToCloud } from '../cloud-auth/profile-cloud-index' import { getOrcaProfileListState, loadOrCreateProfileIndex } from '../profile-index-store' import type { OrcaCloudSessionExchangeResponse } from './profile-cloud-session-exchange' diff --git a/src/main/orca-profiles/cloud-session/profile-cloud-session-store.ts b/src/main/orca-profiles/cloud-session/profile-cloud-session-store.ts index 00772a2cccd..fc2696864ba 100644 --- a/src/main/orca-profiles/cloud-session/profile-cloud-session-store.ts +++ b/src/main/orca-profiles/cloud-session/profile-cloud-session-store.ts @@ -6,7 +6,7 @@ import type { OrcaCloudCapabilities, OrcaCloudOrgSummary, OrcaCloudSessionPersistence -} from '../../../shared/orca-profiles' +} from '../../../shared/orca-profiles/orca-profiles' import { getOrcaProfileDirectory } from '../profile-storage-paths' import { allowsPlaintextOrcaCloudSession } from '../cloud-auth/profile-cloud-auth-config' diff --git a/src/main/orca-profiles/profile-index-store.test.ts b/src/main/orca-profiles/profile-index-store.test.ts index 350264598f6..69e848a17c8 100644 --- a/src/main/orca-profiles/profile-index-store.test.ts +++ b/src/main/orca-profiles/profile-index-store.test.ts @@ -17,7 +17,7 @@ import { DEFAULT_LOCAL_ORCA_PROFILE_ID, ORCA_PROFILE_INDEX_SCHEMA_VERSION, type OrcaProfileIndex -} from '../../shared/orca-profiles' +} from '../../shared/orca-profiles/orca-profiles' const testState = { dir: '' } diff --git a/src/main/orca-profiles/profile-index-store.ts b/src/main/orca-profiles/profile-index-store.ts index 1b2b79d90fa..a91d06dca0c 100644 --- a/src/main/orca-profiles/profile-index-store.ts +++ b/src/main/orca-profiles/profile-index-store.ts @@ -22,7 +22,7 @@ import { type OrcaProfileIndex, type OrcaProfileListState, type OrcaProfileSummary -} from '../../shared/orca-profiles' +} from '../../shared/orca-profiles/orca-profiles' import { getOrcaProfileDataFile, getOrcaProfileDirectory, diff --git a/src/main/orca-profiles/profile-storage-paths.ts b/src/main/orca-profiles/profile-storage-paths.ts index d5b83c27fd3..dbd230bbf8f 100644 --- a/src/main/orca-profiles/profile-storage-paths.ts +++ b/src/main/orca-profiles/profile-storage-paths.ts @@ -1,8 +1,8 @@ -import { getAppEnvironment } from '../../shared/app-environment' +import { getAppEnvironment } from '../../shared/app-lifecycle/app-environment' import { getOrcaProfileDataFile as getSharedOrcaProfileDataFile, getOrcaProfileStateDatabaseFile as getSharedOrcaProfileStateDatabaseFile -} from '../../shared/profile-state-storage-paths' +} from '../../shared/orca-profiles/profile-state-storage-paths' import { hasProfileStateDatabaseFiles } from '../persistence/profile-state/database/profile-state-storage-classification' import { join } from 'node:path' diff --git a/src/main/orca-profiles/project-transfer/profile-active-transfer-worker.test.ts b/src/main/orca-profiles/project-transfer/profile-active-transfer-worker.test.ts index b9cc5df598e..6ce6c777469 100644 --- a/src/main/orca-profiles/project-transfer/profile-active-transfer-worker.test.ts +++ b/src/main/orca-profiles/project-transfer/profile-active-transfer-worker.test.ts @@ -3,7 +3,7 @@ import { tmpdir } from 'node:os' import { join } from 'node:path' import { describe, expect, it, vi } from 'vitest' import { getDefaultPersistedState } from '../../../shared/constants' -import { ORCA_PROFILE_INDEX_SCHEMA_VERSION } from '../../../shared/orca-profiles' +import { ORCA_PROFILE_INDEX_SCHEMA_VERSION } from '../../../shared/orca-profiles/orca-profiles' import { createWorkerMaintenanceFixture } from '../../persistence/loading-store/profile-writing/profile-state-maintenance-fixture' import { ProfileStateSqliteAuthority } from '../../persistence/profile-state/profile-state-sqlite-authority' import { transferActiveProfileProject } from './profile-active-transfer' diff --git a/src/main/orca-profiles/project-transfer/profile-active-transfer.ts b/src/main/orca-profiles/project-transfer/profile-active-transfer.ts index 7734fe4a100..854afb9310d 100644 --- a/src/main/orca-profiles/project-transfer/profile-active-transfer.ts +++ b/src/main/orca-profiles/project-transfer/profile-active-transfer.ts @@ -1,7 +1,7 @@ import type { TransferOrcaProfileProjectArgs, TransferOrcaProfileProjectResult -} from '../../../shared/orca-profiles' +} from '../../../shared/orca-profiles/orca-profiles' import type { Store } from '../../persistence/loading-store/store' import { transferOrcaProfileProject } from './profile-project-transfer' import { hasOrcaProfileStateDatabase } from '../profile-storage-paths' diff --git a/src/main/orca-profiles/project-transfer/profile-project-transfer-migration.test.ts b/src/main/orca-profiles/project-transfer/profile-project-transfer-migration.test.ts index 5d0073e9382..848b35e934a 100644 --- a/src/main/orca-profiles/project-transfer/profile-project-transfer-migration.test.ts +++ b/src/main/orca-profiles/project-transfer/profile-project-transfer-migration.test.ts @@ -3,7 +3,7 @@ import { tmpdir } from 'node:os' import { join } from 'node:path' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { getDefaultPersistedState } from '../../../shared/constants' -import { ORCA_PROFILE_INDEX_SCHEMA_VERSION } from '../../../shared/orca-profiles' +import { ORCA_PROFILE_INDEX_SCHEMA_VERSION } from '../../../shared/orca-profiles/orca-profiles' import type { Repo } from '../../../shared/repository/repo-types' import * as profileStateDocuments from '../../persistence/profile-state/documents/profile-state-documents' import { openProfileStateDatabase } from '../../persistence/profile-state/database/profile-state-database' diff --git a/src/main/orca-profiles/project-transfer/profile-project-transfer.test.ts b/src/main/orca-profiles/project-transfer/profile-project-transfer.test.ts index af2851946d8..e3366f2545e 100644 --- a/src/main/orca-profiles/project-transfer/profile-project-transfer.test.ts +++ b/src/main/orca-profiles/project-transfer/profile-project-transfer.test.ts @@ -6,7 +6,7 @@ import { getDefaultPersistedState } from '../../../shared/constants' import { ORCA_PROFILE_INDEX_SCHEMA_VERSION, type OrcaProfileIndex -} from '../../../shared/orca-profiles' +} from '../../../shared/orca-profiles/orca-profiles' import type { PersistedState } from '../../../shared/persisted-state-types' import type { Repo } from '../../../shared/repository/repo-types' import { diff --git a/src/main/orca-profiles/project-transfer/profile-project-transfer.ts b/src/main/orca-profiles/project-transfer/profile-project-transfer.ts index 3e872ff2938..b8c2ca296cd 100644 --- a/src/main/orca-profiles/project-transfer/profile-project-transfer.ts +++ b/src/main/orca-profiles/project-transfer/profile-project-transfer.ts @@ -1,7 +1,7 @@ import type { TransferOrcaProfileProjectArgs, TransferOrcaProfileProjectResult -} from '../../../shared/orca-profiles' +} from '../../../shared/orca-profiles/orca-profiles' import { getOrcaProfileListState, readProfileIndex } from '../profile-index-store' import { getOrcaProfileIndexPath } from '../profile-storage-paths' import { diff --git a/src/main/orcad/artifact-slots/orcad-artifact-materializer.test.ts b/src/main/orcad/artifact-slots/orcad-artifact-materializer.test.ts index 81a48cb397f..f6d63e33b80 100644 --- a/src/main/orcad/artifact-slots/orcad-artifact-materializer.test.ts +++ b/src/main/orcad/artifact-slots/orcad-artifact-materializer.test.ts @@ -33,7 +33,7 @@ import { hasAppEnvironment, setAppEnvironment, type AppEnvironment -} from '../../../shared/app-environment' +} from '../../../shared/app-lifecycle/app-environment' import { assembleOrcadArtifact, getOrcadTemplateCandidates, diff --git a/src/main/orcad/artifact-slots/orcad-artifact-materializer.ts b/src/main/orcad/artifact-slots/orcad-artifact-materializer.ts index 4fa5bc8b586..67a189e9ad2 100644 --- a/src/main/orcad/artifact-slots/orcad-artifact-materializer.ts +++ b/src/main/orcad/artifact-slots/orcad-artifact-materializer.ts @@ -2,7 +2,7 @@ import { randomUUID } from 'node:crypto' import { existsSync } from 'node:fs' import { chmod, copyFile, mkdir, readFile, rename, rm, utimes, writeFile } from 'node:fs/promises' import { dirname, join } from 'node:path' -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { waitForPromiseWithSignal } from '../../../shared/concurrency/abort-signal-reason' import { ORCAD_MOBILE_WEB_DIR, diff --git a/src/main/orcad/browser-providers/electron/electron-serve-browser-process.ts b/src/main/orcad/browser-providers/electron/electron-serve-browser-process.ts index b7161911aeb..1ce00d0ffdb 100644 --- a/src/main/orcad/browser-providers/electron/electron-serve-browser-process.ts +++ b/src/main/orcad/browser-providers/electron/electron-serve-browser-process.ts @@ -19,8 +19,8 @@ import { spawnProcess } from '@orca/process-host' import { isProcessAlive } from '../../../../shared/remote-runtime/serve-supervisor/serve-bundle-coordination' import { removeTree } from '../../../../shared/file-write/windows-transient-lock-removal' import { BROWSER_SIDECAR_OWNER_ENV } from '../../../../shared/browser/runtime/browser-sidecar-lifetime' -import { electronIsolatedProfileSwitches } from '../../../../shared/electron-isolated-profile-switches' -import { headlessServeOzonePlatformSwitches } from '../../../../shared/headless-serve-ozone-platform' +import { electronIsolatedProfileSwitches } from '../../../../shared/app-lifecycle/launch/electron-isolated-profile-switches' +import { headlessServeOzonePlatformSwitches } from '../../../../shared/app-lifecycle/launch/headless-serve-ozone-platform' import { sendOrcadSidecarRequest } from '../orcad-sidecar-runtime-client' import { browserWaitRequestTimeoutMs } from '../../../../shared/browser/automation/browser-wait-timeout' import { electronServeEnvironment } from './electron-serve-browser-environment' diff --git a/src/main/orcad/diagnostics/orcad-observability.test.ts b/src/main/orcad/diagnostics/orcad-observability.test.ts index bca26152fbb..df902aea24f 100644 --- a/src/main/orcad/diagnostics/orcad-observability.test.ts +++ b/src/main/orcad/diagnostics/orcad-observability.test.ts @@ -2,7 +2,7 @@ import { existsSync, mkdtempSync, readFileSync, rmSync } from 'node:fs' import { tmpdir } from 'node:os' import { join } from 'node:path' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { setAppEnvironment } from '../../../shared/app-environment' +import { setAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { createStructuredAgentSessionLogger } from '../../native-chat/agent-session-wire/host/structured-agent-session-logger' import { installOrcadObservability } from './orcad-observability' diff --git a/src/main/orcad/host-lifecycle/idle-exit/orcad-managed-idle-exit-host.ts b/src/main/orcad/host-lifecycle/idle-exit/orcad-managed-idle-exit-host.ts index 38b38726b6f..8ba264de065 100644 --- a/src/main/orcad/host-lifecycle/idle-exit/orcad-managed-idle-exit-host.ts +++ b/src/main/orcad/host-lifecycle/idle-exit/orcad-managed-idle-exit-host.ts @@ -1,4 +1,4 @@ -import { getAppEnvironment } from '../../../../shared/app-environment' +import { getAppEnvironment } from '../../../../shared/app-lifecycle/app-environment' import type { RuntimeRpcClientActivity } from '../../../runtime/rpc/server/runtime-rpc' import type { OrcadIdleExitEvidence } from './orcad-idle-exit-monitor' import { diff --git a/src/main/orcad/host-lifecycle/orcad-lifecycle.ts b/src/main/orcad/host-lifecycle/orcad-lifecycle.ts index a86aaea14c9..5b19c7fc4e0 100644 --- a/src/main/orcad/host-lifecycle/orcad-lifecycle.ts +++ b/src/main/orcad/host-lifecycle/orcad-lifecycle.ts @@ -18,7 +18,7 @@ import { } from './orcad-unexpected-exit' import { ORCAD_BUNDLED_LAUNCHER_ENV } from '../runtime-launch/orcad-bundled-runtime' import { resolveOrcadExitCode } from '../serve-startup/orcad-exit-code' -import { SINGLE_INSTANCE_ALREADY_RUNNING_EXIT_CODE } from '../../../shared/single-instance-exit-code' +import { SINGLE_INSTANCE_ALREADY_RUNNING_EXIT_CODE } from '../../../shared/app-lifecycle/launch/single-instance-exit-code' import { recordAgentSessionRuntimeEnd } from '../../runtime/agent-session/records/agent-session-runtime-end-record' import type { collectLocalSavedStructuredAgentSessionIds } from '../../runtime/agent-session/lifecycle/saved-structured-agent-session-restoration' import type { AgentSessionRecordStoreStartupOpen } from '../../runtime/agent-session/records/local-agent-session-record-store-startup-open' diff --git a/src/main/orcad/host-lifecycle/orcad-lock-yield.test.ts b/src/main/orcad/host-lifecycle/orcad-lock-yield.test.ts index a3354a130a3..99ccf79f4d0 100644 --- a/src/main/orcad/host-lifecycle/orcad-lock-yield.test.ts +++ b/src/main/orcad/host-lifecycle/orcad-lock-yield.test.ts @@ -15,7 +15,7 @@ import { readOrcadInstanceLockRecord } from '../instance-lock/orcad-instance-loc import { installOrcadShutdownSignals, startOrcadWithHost } from './orcad-lifecycle' import { ORCAD_LOCK_HEARTBEAT_MS } from '../instance-lock/orcad-lock-clone-machine' import { orcadRunFailed } from './orcad-unexpected-exit' -import { SINGLE_INSTANCE_ALREADY_RUNNING_EXIT_CODE } from '../../../shared/single-instance-exit-code' +import { SINGLE_INSTANCE_ALREADY_RUNNING_EXIT_CODE } from '../../../shared/app-lifecycle/launch/single-instance-exit-code' import { _resetPendingWorktreeRemovalsForTests } from '../../workspaces/removal/worktree-background-removal' const roots: string[] = [] diff --git a/src/main/orcad/host-runtime/orcad-app-paths.ts b/src/main/orcad/host-runtime/orcad-app-paths.ts index 12ae8f27342..edc291934be 100644 --- a/src/main/orcad/host-runtime/orcad-app-paths.ts +++ b/src/main/orcad/host-runtime/orcad-app-paths.ts @@ -3,7 +3,7 @@ import { realpathSync } from 'node:fs' import { homedir, tmpdir } from 'node:os' import { dirname, join, resolve } from 'node:path' import process from 'node:process' -import type { AppPathName } from '../../../shared/app-environment' +import type { AppPathName } from '../../../shared/app-lifecycle/app-environment' // Empty exported paths remain unset. function env(name: string): string | null { diff --git a/src/main/orcad/host-runtime/orcad-desktop-push.ts b/src/main/orcad/host-runtime/orcad-desktop-push.ts index ec1a3fe3803..211193feb31 100644 --- a/src/main/orcad/host-runtime/orcad-desktop-push.ts +++ b/src/main/orcad/host-runtime/orcad-desktop-push.ts @@ -1,5 +1,5 @@ import process from 'node:process' -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { DesktopPushService } from '../../runtime/push/desktop-push-service' import { resolvePushGatewayOrigin } from '../../runtime/push/push-gateway-origin' import type { OrcaRuntimeService } from '../../runtime/orca-runtime' diff --git a/src/main/orcad/host-runtime/orcad-host-adapters.ts b/src/main/orcad/host-runtime/orcad-host-adapters.ts index 6ff1b22ffdb..eb06fe4c50e 100644 --- a/src/main/orcad/host-runtime/orcad-host-adapters.ts +++ b/src/main/orcad/host-runtime/orcad-host-adapters.ts @@ -2,7 +2,10 @@ import { readFileSync } from 'node:fs' import { join } from 'node:path' import process from 'node:process' import { ORCAD_CLI_PACKAGE_FILENAME } from '../../../shared/remote-runtime/orcad-distribution/orcad-artifacts' -import { setAppEnvironment, type AppEnvironment } from '../../../shared/app-environment' +import { + setAppEnvironment, + type AppEnvironment +} from '../../../shared/app-lifecycle/app-environment' import { createNodeServiceEnvironment } from '../../backend/node-service-environment' import { setSecretStore } from '../../../shared/secure-storage/secret-store' import { resolveOrcadInstallRoot, resolveOrcadPath } from './orcad-app-paths' diff --git a/src/main/orcad/host-runtime/orcad-managed-agent-hooks.ts b/src/main/orcad/host-runtime/orcad-managed-agent-hooks.ts index efbe72ef3df..7827e1c028e 100644 --- a/src/main/orcad/host-runtime/orcad-managed-agent-hooks.ts +++ b/src/main/orcad/host-runtime/orcad-managed-agent-hooks.ts @@ -1,5 +1,5 @@ import { getClaudeAgentViewService } from '../../claude/agent-view/agent-view-service' -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { startCodexHooks } from '../../codex/hooks/reconciliation/codex-hook-reconcile' import { adoptLoginShellAgentHomes } from '../../agent-hooks/installation/agent-home-login-shell' import { hydrateAgentCliShellPath } from '../../agent-hooks/installation/local-agent-cli-presence' diff --git a/src/main/orcad/native-runtime/orcad-packaged-node-pty.integration.test.ts b/src/main/orcad/native-runtime/orcad-packaged-node-pty.integration.test.ts index 1f6170f225f..66c4f6ee085 100644 --- a/src/main/orcad/native-runtime/orcad-packaged-node-pty.integration.test.ts +++ b/src/main/orcad/native-runtime/orcad-packaged-node-pty.integration.test.ts @@ -31,7 +31,7 @@ describe.skipIf(skip)('packaged node-pty under the pinned Node', () => { stdin: { contents: ` import { LocalPtyProvider } from './src/main/providers/local-pty/local-pty-provider' - import { setAppEnvironment } from './src/shared/app-environment' + import { setAppEnvironment } from './src/shared/app-lifecycle/app-environment' import { getCmdExePath } from './src/shared/shell/launch/windows-batch-spawn' const loaded = require('fs').realpathSync(require.resolve('node-pty')) if (!loaded.startsWith(require('fs').realpathSync(${JSON.stringify(packageDir)}))) throw new Error('node-pty resolved outside the package: ' + loaded) diff --git a/src/main/orcad/profile-state/serve-profile-ssh-targets.ts b/src/main/orcad/profile-state/serve-profile-ssh-targets.ts index 8db9b6ef718..ab4a75e6736 100644 --- a/src/main/orcad/profile-state/serve-profile-ssh-targets.ts +++ b/src/main/orcad/profile-state/serve-profile-ssh-targets.ts @@ -1,7 +1,7 @@ import { readFileSync } from 'node:fs' import { join } from 'node:path' -import { DEFAULT_LOCAL_ORCA_PROFILE_ID } from '../../../shared/orca-profiles' -import { PROFILE_STATE_DATABASE_FILE_NAME } from '../../../shared/profile-state-storage-paths' +import { DEFAULT_LOCAL_ORCA_PROFILE_ID } from '../../../shared/orca-profiles/orca-profiles' +import { PROFILE_STATE_DATABASE_FILE_NAME } from '../../../shared/orca-profiles/profile-state-storage-paths' import { getActiveProfileStateLocation } from '../../persistence/profile-state/offline-access/profile-state-active-location' import { readProfileStateDomain } from '../../persistence/profile-state/documents/profile-state-domain-reader' import { classifyProfileStateStorage } from '../../persistence/profile-state/database/profile-state-storage-classification' diff --git a/src/main/orcad/serve-startup/orcad-command-arguments.ts b/src/main/orcad/serve-startup/orcad-command-arguments.ts index b035c1fa4bf..ffd748b152e 100644 --- a/src/main/orcad/serve-startup/orcad-command-arguments.ts +++ b/src/main/orcad/serve-startup/orcad-command-arguments.ts @@ -4,7 +4,7 @@ import { ORCAD_LOOPBACK_BIND_HOST } from '../../../shared/remote-runtime/orcad-l import { getServeOptionValidationError } from '../../../shared/remote-runtime/serve-supervisor/serve-option-validation' import { existsSync } from 'node:fs' import { join, resolve } from 'node:path' -import { WEB_CLIENT_INDEX_FILENAME } from '../../../shared/bundled-web-client-root' +import { WEB_CLIENT_INDEX_FILENAME } from '../../../shared/web-client/bundled-web-client-root' export const ORCAD_USAGE = `orcad — the Orca runtime served without Electron. diff --git a/src/main/orcad/serve-startup/orcad-exit-code.ts b/src/main/orcad/serve-startup/orcad-exit-code.ts index 0ed67e787c3..b1485a70159 100644 --- a/src/main/orcad/serve-startup/orcad-exit-code.ts +++ b/src/main/orcad/serve-startup/orcad-exit-code.ts @@ -3,7 +3,7 @@ import { OrcadBundledRuntimeError } from '../runtime-launch/orcad-bundled-runtim import { OrcadInstanceLockError } from '../instance-lock/orcad-data-root-privacy' import { ProfileStateAccessError } from '../../persistence/profile-state/access/profile-state-access-error' import { ORCAD_EXIT_CONFIGURATION } from './orcad-configuration-exit' -import { SINGLE_INSTANCE_ALREADY_RUNNING_EXIT_CODE } from '../../../shared/single-instance-exit-code' +import { SINGLE_INSTANCE_ALREADY_RUNNING_EXIT_CODE } from '../../../shared/app-lifecycle/launch/single-instance-exit-code' import { ORCAD_EXIT_TERMINALS_NOT_DURABLE } from '../../../shared/remote-runtime/serve-supervisor/serve-supervised-terminal-durability' import { OrcadTerminalsNotDurableError } from './orcad-serve-supervision' diff --git a/src/main/orcad/testing/daemon-processes/orcad-daemon-session-client-fixture.ts b/src/main/orcad/testing/daemon-processes/orcad-daemon-session-client-fixture.ts index a798a35fa2d..c53f0ebeeee 100644 --- a/src/main/orcad/testing/daemon-processes/orcad-daemon-session-client-fixture.ts +++ b/src/main/orcad/testing/daemon-processes/orcad-daemon-session-client-fixture.ts @@ -6,7 +6,7 @@ export type DaemonSessionClientResult = { pid: number; isReattach: boolean; outp export async function buildDaemonSessionClient(outfile: string): Promise { await build({ stdin: { - contents: `\n import { DaemonPtyAdapter } from './src/main/daemon/providers/adapter/daemon-pty-adapter'\n import { getDaemonPidPath, getDaemonSocketPath, getDaemonTokenPath } from './src/main/daemon/launch/daemon-spawner'\n import { setAppEnvironment } from './src/shared/app-environment'\n const [op, runtimeDir, sessionId, marker, cwd] = process.argv.slice(2)\n setAppEnvironment({\n getPath: () => cwd, getAppPath: () => cwd, getVersion: () => 'test', isPackaged: () => true,\n onWillQuit() {}, exit: code => process.exit(code), getAppMetrics: () => []\n })\n const adapter = new DaemonPtyAdapter({\n socketPath: getDaemonSocketPath(runtimeDir), tokenPath: getDaemonTokenPath(runtimeDir),\n pidPath: getDaemonPidPath(runtimeDir), profileScope: runtimeDir, runtimeDir\n })\n let output = ''\n adapter.onData(event => { if (event.id === sessionId) output += event.data })\n const deadline = setTimeout(() => { console.error('timed out; output: ' + output); process.exit(98) }, 20_000)\n ;(async () => {\n const win32 = process.platform === 'win32'\n const spawned = await adapter.spawn(op === 'create'\n ? { sessionId, cols: 80, rows: 24, cwd, shellOverride: win32 ? 'cmd.exe' : '/bin/sh' }\n : { sessionId, cols: 80, rows: 24 })\n // Both shells echo what is typed, so the typed form must not already read as the marker.\n const typed = win32 ? 'echo ORCA_^SERVE_' + marker : "printf 'ORCA_SERVE_%s\\\\n' " + marker\n adapter.write(spawned.id, typed + "\\r")\n while (!output.includes('ORCA_SERVE_' + marker)) await new Promise(r => setTimeout(r, 50))\n clearTimeout(deadline)\n await adapter.disconnectOnly()\n console.log(JSON.stringify({ pid: spawned.pid, isReattach: spawned.isReattach === true, output: true }))\n process.exit(0)\n })().catch(error => { console.error(error); process.exit(1) })\n `, + contents: `\n import { DaemonPtyAdapter } from './src/main/daemon/providers/adapter/daemon-pty-adapter'\n import { getDaemonPidPath, getDaemonSocketPath, getDaemonTokenPath } from './src/main/daemon/launch/daemon-spawner'\n import { setAppEnvironment } from './src/shared/app-lifecycle/app-environment'\n const [op, runtimeDir, sessionId, marker, cwd] = process.argv.slice(2)\n setAppEnvironment({\n getPath: () => cwd, getAppPath: () => cwd, getVersion: () => 'test', isPackaged: () => true,\n onWillQuit() {}, exit: code => process.exit(code), getAppMetrics: () => []\n })\n const adapter = new DaemonPtyAdapter({\n socketPath: getDaemonSocketPath(runtimeDir), tokenPath: getDaemonTokenPath(runtimeDir),\n pidPath: getDaemonPidPath(runtimeDir), profileScope: runtimeDir, runtimeDir\n })\n let output = ''\n adapter.onData(event => { if (event.id === sessionId) output += event.data })\n const deadline = setTimeout(() => { console.error('timed out; output: ' + output); process.exit(98) }, 20_000)\n ;(async () => {\n const win32 = process.platform === 'win32'\n const spawned = await adapter.spawn(op === 'create'\n ? { sessionId, cols: 80, rows: 24, cwd, shellOverride: win32 ? 'cmd.exe' : '/bin/sh' }\n : { sessionId, cols: 80, rows: 24 })\n // Both shells echo what is typed, so the typed form must not already read as the marker.\n const typed = win32 ? 'echo ORCA_^SERVE_' + marker : "printf 'ORCA_SERVE_%s\\\\n' " + marker\n adapter.write(spawned.id, typed + "\\r")\n while (!output.includes('ORCA_SERVE_' + marker)) await new Promise(r => setTimeout(r, 50))\n clearTimeout(deadline)\n await adapter.disconnectOnly()\n console.log(JSON.stringify({ pid: spawned.pid, isReattach: spawned.isReattach === true, output: true }))\n process.exit(0)\n })().catch(error => { console.error(error); process.exit(1) })\n `, resolveDir: process.cwd(), loader: 'ts' }, diff --git a/src/main/orcad/testing/serve-lifecycle/orcad-serve-parity.integration.test.ts b/src/main/orcad/testing/serve-lifecycle/orcad-serve-parity.integration.test.ts index fff49cd8023..4e26b9e30cc 100644 --- a/src/main/orcad/testing/serve-lifecycle/orcad-serve-parity.integration.test.ts +++ b/src/main/orcad/testing/serve-lifecycle/orcad-serve-parity.integration.test.ts @@ -18,7 +18,7 @@ import { import { findBundledWebClientRoot, WEB_CLIENT_INDEX_FILENAME -} from '../../../../shared/bundled-web-client-root' +} from '../../../../shared/web-client/bundled-web-client-root' import { orcadServeArgs } from '../../../../shared/remote-runtime/serve-supervisor/orcad-serve-argv' import { orcadManagedStopRequestPath } from '../../host-lifecycle/managed-stop/orcad-managed-stop-request' import { readWorktreeRemovalRecords } from '../../../workspaces/removal/worktree-removal-records' diff --git a/src/main/persistence/applying-settings/settings-update.ts b/src/main/persistence/applying-settings/settings-update.ts index 50bd18fafd6..4494b487887 100644 --- a/src/main/persistence/applying-settings/settings-update.ts +++ b/src/main/persistence/applying-settings/settings-update.ts @@ -23,11 +23,11 @@ import { normalizeTaskProviderSettings } from '../../../shared/work-items/task-p import { normalizeOpenInApplications } from '../../../shared/open-in-applications' import { normalizeTerminalShortcutPolicy } from '../../../shared/keybindings/effective' import { normalizeSourceControlGroupOrder } from '../../../shared/source-control/listing/source-control-group-order' -import { normalizeAppIconId } from '../../../shared/app-icon' +import { normalizeAppIconId } from '../../../shared/app-lifecycle/identity/app-icon' import { normalizeUiLanguage } from '../../../shared/ui-language' import { normalizeWorktreeVisibilityDefaults } from '../../../shared/worktree/visibility/external-worktree-visibility' import { normalizePRBotAuthorOverrides } from '../../../shared/source-control/review-comments/pr-bot-author-overrides' -import { normalizeMachineName } from '../../../shared/machine-name' +import { normalizeMachineName } from '../../../shared/remote-runtime/host-metadata/machine-name' import { normalizeWorkspaceCleanupRules } from '../../../shared/workspace-cleanup/workspace-cleanup-policy' import type { PersistedState } from '../../../shared/persisted-state-types' import { diff --git a/src/main/persistence/loading-store/profile-loading/normalize-loaded-global-settings.ts b/src/main/persistence/loading-store/profile-loading/normalize-loaded-global-settings.ts index 02ff591ede4..d9c150c8e7b 100644 --- a/src/main/persistence/loading-store/profile-loading/normalize-loaded-global-settings.ts +++ b/src/main/persistence/loading-store/profile-loading/normalize-loaded-global-settings.ts @@ -6,7 +6,7 @@ import { normalizeTerminalQuickCommands } from '../../../../shared/terminal/quic import { normalizeOpenInApplications } from '../../../../shared/open-in-applications' import { normalizeTerminalShortcutPolicy } from '../../../../shared/keybindings/effective' -import { normalizeAppIconId } from '../../../../shared/app-icon' +import { normalizeAppIconId } from '../../../../shared/app-lifecycle/identity/app-icon' import { normalizeTerminalCustomThemes } from '../../../../shared/terminal-themes/terminal-custom-themes' import { normalizePluginOwnedSettings } from '../../../../shared/plugins/capabilities/plugin-owned-settings' import { @@ -22,7 +22,7 @@ import { stripRetiredGlobalSettings } from '../../applying-settings/terminal-settings-migrations' import { readLegacySidekickFlag } from '../../applying-settings/onboarding-normalization' -import { normalizeMachineName } from '../../../../shared/machine-name' +import { normalizeMachineName } from '../../../../shared/remote-runtime/host-metadata/machine-name' import { normalizeWorkspaceCleanupRules } from '../../../../shared/workspace-cleanup/workspace-cleanup-policy' import { replaceRetiredSpeechModelId } from '../../../speech/model-catalog' import type { PersistedState } from '../../../../shared/persisted-state-types' diff --git a/src/main/persistence/loading-store/user-data-path.ts b/src/main/persistence/loading-store/user-data-path.ts index bbbd5af3d1a..4f936808ebf 100644 --- a/src/main/persistence/loading-store/user-data-path.ts +++ b/src/main/persistence/loading-store/user-data-path.ts @@ -1,4 +1,4 @@ -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { copyFileSync, existsSync, mkdirSync, rmSync } from 'node:fs' import { dirname, join, resolve } from 'node:path' import { hardenExistingSecureFile } from '../../../shared/secure-storage/secure-file' diff --git a/src/main/persistence/migrating-orcad-catalog/source/catalog/orcad-source-visibility.ts b/src/main/persistence/migrating-orcad-catalog/source/catalog/orcad-source-visibility.ts index 2614833a35f..fa004c4d5e9 100644 --- a/src/main/persistence/migrating-orcad-catalog/source/catalog/orcad-source-visibility.ts +++ b/src/main/persistence/migrating-orcad-catalog/source/catalog/orcad-source-visibility.ts @@ -1,4 +1,4 @@ -import { getAppEnvironment } from '../../../../../shared/app-environment' +import { getAppEnvironment } from '../../../../../shared/app-lifecycle/app-environment' import { getRepoExecutionHostId, parseExecutionHostId } from '../../../../../shared/execution-host' import type { FolderWorkspace } from '../../../../../shared/folder-workspaces/folder-workspace-types' diff --git a/src/main/persistence/persistence-test-harness.ts b/src/main/persistence/persistence-test-harness.ts index 69e7c697207..870402dabe9 100644 --- a/src/main/persistence/persistence-test-harness.ts +++ b/src/main/persistence/persistence-test-harness.ts @@ -18,7 +18,7 @@ import { getDataFile, initDataPath } from './loading-store/user-data-path' import type { StoreRuntimeOptions } from './loading-store/store-runtime-state' import { ProfileStateSqliteAuthority } from './profile-state/profile-state-sqlite-authority' import { openProfileStateDatabaseReadOnly } from './profile-state/database/profile-state-database' -import { profileStateDatabaseFile } from '../../shared/profile-state-storage-paths' +import { profileStateDatabaseFile } from '../../shared/orca-profiles/profile-state-storage-paths' import { exportProfileStateJson } from './profile-state/documents/profile-state-documents' export const testState = { dir: '' } diff --git a/src/main/persistence/profile-state-cutover-soak.test.ts b/src/main/persistence/profile-state-cutover-soak.test.ts index 13f6c526f4c..5fc98f740f8 100644 --- a/src/main/persistence/profile-state-cutover-soak.test.ts +++ b/src/main/persistence/profile-state-cutover-soak.test.ts @@ -10,7 +10,7 @@ import { type ProfileStateStoreFactoryResult } from './profile-state/startup/profile-state-store-factory' import './profile-state/database/profile-state-database' -import { profileStateDatabaseFile } from '../../shared/profile-state-storage-paths' +import { profileStateDatabaseFile } from '../../shared/orca-profiles/profile-state-storage-paths' vi.mock('electron', () => ({ app: { diff --git a/src/main/persistence/profile-state/database/profile-state-database-export-crash.test.ts b/src/main/persistence/profile-state/database/profile-state-database-export-crash.test.ts index 27a711eff1e..b2e229c5780 100644 --- a/src/main/persistence/profile-state/database/profile-state-database-export-crash.test.ts +++ b/src/main/persistence/profile-state/database/profile-state-database-export-crash.test.ts @@ -12,7 +12,7 @@ import { openProfileStateDatabase, openProfileStateDatabaseReadOnly } from './profile-state-database' -import { profileStateDatabaseFile } from '../../../../shared/profile-state-storage-paths' +import { profileStateDatabaseFile } from '../../../../shared/orca-profiles/profile-state-storage-paths' import { writeProfileStateDatabaseSnapshotAsync } from './profile-state-database-snapshot' const temporaryDirectories: string[] = [] diff --git a/src/main/persistence/profile-state/database/profile-state-database-snapshot.test.ts b/src/main/persistence/profile-state/database/profile-state-database-snapshot.test.ts index 931f0b4965c..9dcfc764566 100644 --- a/src/main/persistence/profile-state/database/profile-state-database-snapshot.test.ts +++ b/src/main/persistence/profile-state/database/profile-state-database-snapshot.test.ts @@ -6,7 +6,7 @@ import { openProfileStateDatabase, openProfileStateDatabaseReadOnly } from './profile-state-database' -import { profileStateDatabaseFile } from '../../../../shared/profile-state-storage-paths' +import { profileStateDatabaseFile } from '../../../../shared/orca-profiles/profile-state-storage-paths' import { exportProfileStateJson, importProfileStateJson diff --git a/src/main/persistence/profile-state/database/profile-state-database.ts b/src/main/persistence/profile-state/database/profile-state-database.ts index 4767f25110f..1819c4a3663 100644 --- a/src/main/persistence/profile-state/database/profile-state-database.ts +++ b/src/main/persistence/profile-state/database/profile-state-database.ts @@ -11,7 +11,7 @@ import { } from './profile-state-database-schema' import { existsSync, mkdirSync } from 'node:fs' import { dirname } from 'node:path' -import '../../../../shared/profile-state-storage-paths' +import '../../../../shared/orca-profiles/profile-state-storage-paths' import { ProfileStateDatabaseOpenError } from './profile-state-database-errors' import { verifyEmptyProfileStateSchema, diff --git a/src/main/persistence/profile-state/document-parts/profile-state-document-parts.test.ts b/src/main/persistence/profile-state/document-parts/profile-state-document-parts.test.ts index 46ad555a5fa..f6dd910864f 100644 --- a/src/main/persistence/profile-state/document-parts/profile-state-document-parts.test.ts +++ b/src/main/persistence/profile-state/document-parts/profile-state-document-parts.test.ts @@ -8,7 +8,7 @@ import { openProfileStateDatabase, openProfileStateDatabaseReadOnly } from '../database/profile-state-database' -import { profileStateDatabaseFile } from '../../../../shared/profile-state-storage-paths' +import { profileStateDatabaseFile } from '../../../../shared/orca-profiles/profile-state-storage-paths' import { writeProfileStateDomains } from '../documents/profile-state-domain-writes' import { readProfileStateDomainsWithRevisionFromDatabase } from '../documents/profile-state-domain-reader' import { hashProfileStatePayload, isRecord } from '../documents/profile-state-document-validation' diff --git a/src/main/persistence/profile-state/documents/profile-state-documents.test.ts b/src/main/persistence/profile-state/documents/profile-state-documents.test.ts index 26f9858d8e0..b8970083f64 100644 --- a/src/main/persistence/profile-state/documents/profile-state-documents.test.ts +++ b/src/main/persistence/profile-state/documents/profile-state-documents.test.ts @@ -6,7 +6,7 @@ import { exportProfileStateJson, importProfileStateJson } from './profile-state- import { readProfileStateDocuments } from './profile-state-document-reader' import { readProfileStateRevision } from '../database/profile-state-revision' import { openProfileStateDatabase } from '../database/profile-state-database' -import { profileStateDatabaseFile } from '../../../../shared/profile-state-storage-paths' +import { profileStateDatabaseFile } from '../../../../shared/orca-profiles/profile-state-storage-paths' const temporaryDirectories: string[] = [] diff --git a/src/main/persistence/profile-state/documents/profile-state-domain-writes.test.ts b/src/main/persistence/profile-state/documents/profile-state-domain-writes.test.ts index 3b07dd01d8f..a1d10d3fc73 100644 --- a/src/main/persistence/profile-state/documents/profile-state-domain-writes.test.ts +++ b/src/main/persistence/profile-state/documents/profile-state-domain-writes.test.ts @@ -5,7 +5,7 @@ import { afterEach, describe, expect, it } from 'vitest' import { exportProfileStateJson, importProfileStateJson } from './profile-state-documents' import { readProfileStateRevision } from '../database/profile-state-revision' import { openProfileStateDatabase } from '../database/profile-state-database' -import { profileStateDatabaseFile } from '../../../../shared/profile-state-storage-paths' +import { profileStateDatabaseFile } from '../../../../shared/orca-profiles/profile-state-storage-paths' import { writeProfileStateDomains } from './profile-state-domain-writes' import { buildProfileStateCutoverFixture } from '../../profile-state-cutover-fixture' diff --git a/src/main/persistence/profile-state/offline-access/profile-state-active-location.ts b/src/main/persistence/profile-state/offline-access/profile-state-active-location.ts index 0c1dfddedf1..f2287d6c013 100644 --- a/src/main/persistence/profile-state/offline-access/profile-state-active-location.ts +++ b/src/main/persistence/profile-state/offline-access/profile-state-active-location.ts @@ -3,9 +3,9 @@ import { join } from 'node:path' import { getOrcaProfileDataFile, getOrcaProfileStateDatabaseFile -} from '../../../../shared/profile-state-storage-paths' +} from '../../../../shared/orca-profiles/profile-state-storage-paths' import type { ProfileStateOfflineLocation } from './profile-state-offline-settings' -import { ProfileStateRecoveryCommandError } from '../../../../shared/profile-state-recovery-command' +import { ProfileStateRecoveryCommandError } from '../../../../shared/orca-profiles/profile-state-recovery-command' export function getActiveProfileStateLocation( userDataPath: string, diff --git a/src/main/persistence/profile-state/recovery/profile-state-recovery-command.ts b/src/main/persistence/profile-state/recovery/profile-state-recovery-command.ts index cfdd5d27374..154e5a31180 100644 --- a/src/main/persistence/profile-state/recovery/profile-state-recovery-command.ts +++ b/src/main/persistence/profile-state/recovery/profile-state-recovery-command.ts @@ -4,7 +4,7 @@ import { type ProfileStateRecoverySelector, type ProfileStateExportsResult, type ProfileStateRollbackResult -} from '../../../../shared/profile-state-recovery-command' +} from '../../../../shared/orca-profiles/profile-state-recovery-command' import { getActiveProfileStateLocation } from '../offline-access/profile-state-active-location' import { profileStateJsonExportPath, diff --git a/src/main/persistence/profile-state/recovery/profile-state-section-repair.test.ts b/src/main/persistence/profile-state/recovery/profile-state-section-repair.test.ts index 458f9ac9d8a..00a37a39993 100644 --- a/src/main/persistence/profile-state/recovery/profile-state-section-repair.test.ts +++ b/src/main/persistence/profile-state/recovery/profile-state-section-repair.test.ts @@ -14,7 +14,7 @@ import { writeProfileStateDomains } from '../documents/profile-state-domain-writ import { migrateProfileStateToSqlite } from '../startup/profile-state-migration' import { rollbackProfileState } from './profile-state-recovery-command' import { ProfileStateRecoveryRequiredError } from './profile-state-recovery-required' -import type { ProfileStateRecoverySelector } from '../../../../shared/profile-state-recovery-command' +import type { ProfileStateRecoverySelector } from '../../../../shared/orca-profiles/profile-state-recovery-command' const roots: string[] = [] const profileId = 'section-repair' diff --git a/src/main/persistence/profile-state/recovery/profile-state-section-repair.ts b/src/main/persistence/profile-state/recovery/profile-state-section-repair.ts index 63b80c06d33..d28a7c8f48e 100644 --- a/src/main/persistence/profile-state/recovery/profile-state-section-repair.ts +++ b/src/main/persistence/profile-state/recovery/profile-state-section-repair.ts @@ -5,7 +5,7 @@ import { ProfileStateRecoveryCommandError, profileStateRepairSectionApproval, type ProfileStateRecoveryRepairSection -} from '../../../../shared/profile-state-recovery-command' +} from '../../../../shared/orca-profiles/profile-state-recovery-command' import type { ProfileStateMaintenance } from '../access/profile-state-access' import { profileHasPendingProjectMove } from '../../../orca-profiles/project-transfer/profile-project-move-record' import '../automation-runs/profile-state-automation-runs' diff --git a/src/main/persistence/profile-state/startup/profile-state-authority-bootstrap.test.ts b/src/main/persistence/profile-state/startup/profile-state-authority-bootstrap.test.ts index b2899c99123..dadda57c540 100644 --- a/src/main/persistence/profile-state/startup/profile-state-authority-bootstrap.test.ts +++ b/src/main/persistence/profile-state/startup/profile-state-authority-bootstrap.test.ts @@ -12,7 +12,7 @@ import { dirname, join } from 'node:path' import { afterEach, describe, expect, it, vi } from 'vitest' import Database from '../../../sqlite/sync-database' import '../database/profile-state-database' -import { profileStateDatabaseFile } from '../../../../shared/profile-state-storage-paths' +import { profileStateDatabaseFile } from '../../../../shared/orca-profiles/profile-state-storage-paths' import '../documents/profile-state-document-validation' diff --git a/src/main/pi/managed-extensions/titlebar-extension-service.ts b/src/main/pi/managed-extensions/titlebar-extension-service.ts index 55897241f6c..b6c0284bfb6 100644 --- a/src/main/pi/managed-extensions/titlebar-extension-service.ts +++ b/src/main/pi/managed-extensions/titlebar-extension-service.ts @@ -2,7 +2,7 @@ import { materializeOmpFreshConfig } from '../../../shared/agent-launch/startup/ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs' import { homedir } from 'node:os' import { join } from 'node:path' -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { createHash } from 'node:crypto' import { ORCA_PI_AGENT_STATUS_EXTENSION_FILE, diff --git a/src/main/pi/rpc/background-work/rpc-background-work-bridge.ts b/src/main/pi/rpc/background-work/rpc-background-work-bridge.ts index 62d1f03edba..8442d8d716c 100644 --- a/src/main/pi/rpc/background-work/rpc-background-work-bridge.ts +++ b/src/main/pi/rpc/background-work/rpc-background-work-bridge.ts @@ -1,7 +1,7 @@ import { randomUUID } from 'node:crypto' import { mkdir, readdir, readFile, rename, rm, writeFile } from 'node:fs/promises' import { join } from 'node:path' -import { getAppEnvironment } from '../../../../shared/app-environment' +import { getAppEnvironment } from '../../../../shared/app-lifecycle/app-environment' import { inspectProcessLiveness } from '../../../daemon/endpoint/identity/daemon-process-inspection' import { PI_BACKGROUND_WORK_BRIDGE_FILE, diff --git a/src/main/pi/rpc/launch/rpc-launch-resolution.ts b/src/main/pi/rpc/launch/rpc-launch-resolution.ts index 64859934334..cd1501a3753 100644 --- a/src/main/pi/rpc/launch/rpc-launch-resolution.ts +++ b/src/main/pi/rpc/launch/rpc-launch-resolution.ts @@ -10,7 +10,7 @@ import { import { agentSessionProviderHandleKey } from '../../../../shared/agent-session/lifecycle/provider-handles/agent-session-provider-handle-encoding' import { requireLegacyAgentSessionAccountHome } from '../../../../shared/agent-session/lifecycle/accounts/agent-session-account-home' import type { resolveCliCommand } from '../../../../shared/shell/command-resolution/node-cli-command-resolution' -import { hasReachedAppVersion } from '../../../../shared/app-version' +import { hasReachedAppVersion } from '../../../../shared/app-lifecycle/identity/app-version' import { checkAgentCliVersion, type AgentCliVersionCheck, diff --git a/src/main/plugins/catalog/plugin-auto-updater.ts b/src/main/plugins/catalog/plugin-auto-updater.ts index 17e09f9f69f..75d7ffb4e21 100644 --- a/src/main/plugins/catalog/plugin-auto-updater.ts +++ b/src/main/plugins/catalog/plugin-auto-updater.ts @@ -1,4 +1,4 @@ -import { compareAppVersions } from '../../../shared/app-version' +import { compareAppVersions } from '../../../shared/app-lifecycle/identity/app-version' import { pluginUpdateGrowsAccess } from '../../../shared/plugins/approval/plugin-update-access-growth' import type { PluginAutoUpdateState, diff --git a/src/main/plugins/cli/plugin-cli-update.ts b/src/main/plugins/cli/plugin-cli-update.ts index 1351c9925df..1f44e8b8edd 100644 --- a/src/main/plugins/cli/plugin-cli-update.ts +++ b/src/main/plugins/cli/plugin-cli-update.ts @@ -1,4 +1,7 @@ -import { compareAppVersions, isValidAppVersion } from '../../../shared/app-version' +import { + compareAppVersions, + isValidAppVersion +} from '../../../shared/app-lifecycle/identity/app-version' import { PLUGIN_APPROVAL_REQUIRED_CODE, PLUGIN_NOT_FOUND_CODE, diff --git a/src/main/plugins/installation/plugin-git-ref-resolution.ts b/src/main/plugins/installation/plugin-git-ref-resolution.ts index 42097aa97bf..4dcda9bfa6c 100644 --- a/src/main/plugins/installation/plugin-git-ref-resolution.ts +++ b/src/main/plugins/installation/plugin-git-ref-resolution.ts @@ -1,7 +1,10 @@ import { mkdtemp, rm } from 'node:fs/promises' import { tmpdir } from 'node:os' import { join } from 'node:path' -import { compareAppVersions, isValidAppVersion } from '../../../shared/app-version' +import { + compareAppVersions, + isValidAppVersion +} from '../../../shared/app-lifecycle/identity/app-version' import { isSafePluginGitRef } from '../../../shared/plugins/installation/plugin-git-install-input' import { isAllowedPluginGitUrl } from '../../../shared/plugins/installation/plugin-install-lockfile' import { diff --git a/src/main/power/agent-awake-service.ts b/src/main/power/agent-awake-service.ts index af8c25d6d78..e84de28c44d 100644 --- a/src/main/power/agent-awake-service.ts +++ b/src/main/power/agent-awake-service.ts @@ -3,7 +3,7 @@ import { normalizeComputerAwakeMode, type ComputerAwakeMode, type ComputerAwakeStatus -} from '../../shared/computer-awake-mode' +} from '../../shared/app-lifecycle/computer-awake-mode' import { LinuxLidSleepAssertion } from './linux-lid-sleep-assertion' import { MacosSystemSleepAssertion } from './macos-system-sleep-assertion' import { AgentAwakeStatusLease, type AgentAwakeStatus } from './agent-awake-status-lease' diff --git a/src/main/pty/history/terminal-history-paths.ts b/src/main/pty/history/terminal-history-paths.ts index ac20d5cad22..8d0d03d9554 100644 --- a/src/main/pty/history/terminal-history-paths.ts +++ b/src/main/pty/history/terminal-history-paths.ts @@ -1,6 +1,6 @@ import { existsSync, readdirSync } from 'node:fs' import { join } from 'node:path' -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' const HISTORY_DIR_NAME = 'terminal-history' const HISTORY_DIR_NAME_WSL = 'terminal-history-wsl' diff --git a/src/main/pty/process-retirement/orca-chromium-process-pids.ts b/src/main/pty/process-retirement/orca-chromium-process-pids.ts index d944161eea6..c2a78fbcefc 100644 --- a/src/main/pty/process-retirement/orca-chromium-process-pids.ts +++ b/src/main/pty/process-retirement/orca-chromium-process-pids.ts @@ -1,4 +1,4 @@ -import { getAppEnvironment, hasAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment, hasAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { recordCoalescedDurableCrashBreadcrumb } from '../../crash-reporting/breadcrumbs/durable-crash-breadcrumb' /** diff --git a/src/main/pty/process-retirement/refused-tree-kill-root-termination.test.ts b/src/main/pty/process-retirement/refused-tree-kill-root-termination.test.ts index c4bc907c5e9..071d7ab90e0 100644 --- a/src/main/pty/process-retirement/refused-tree-kill-root-termination.test.ts +++ b/src/main/pty/process-retirement/refused-tree-kill-root-termination.test.ts @@ -17,7 +17,7 @@ import { hasAppEnvironment, setAppEnvironment, type AppEnvironment -} from '../../../shared/app-environment' +} from '../../../shared/app-lifecycle/app-environment' import { installMainProcessTreeKillGate } from './own-chromium-tree-kill-guard' import { setProcessTreeKillGate } from '@orca/process-host/process-tree-kill-gate' import { resetSelfInitiatedTreeKillLogForTest } from '../../crash-reporting/process-exits/self-initiated-tree-kill-log' diff --git a/src/main/pty/process-retirement/windows-live-tree-kill.win32.test.ts b/src/main/pty/process-retirement/windows-live-tree-kill.win32.test.ts index 24ae3832165..60985e14433 100644 --- a/src/main/pty/process-retirement/windows-live-tree-kill.win32.test.ts +++ b/src/main/pty/process-retirement/windows-live-tree-kill.win32.test.ts @@ -4,7 +4,10 @@ import { join } from 'node:path' import { spawn, ChildProcess } from 'node:child_process' import { subscribe, unsubscribe } from 'node:diagnostics_channel' import { afterAll, afterEach, beforeEach, describe, expect, it } from 'vitest' -import { setAppEnvironment, type AppEnvironment } from '../../../shared/app-environment' +import { + setAppEnvironment, + type AppEnvironment +} from '../../../shared/app-lifecycle/app-environment' import { setProcessTreeKillGate } from '@orca/process-host/process-tree-kill-gate' import { signalProcessTree } from '@orca/process-host/process-tree-termination' import { windowsSystem32Binary } from '@orca/process-host/windows-system-binary' diff --git a/src/main/pty/scrollback/terminal-scrollback-snapshots.ts b/src/main/pty/scrollback/terminal-scrollback-snapshots.ts index cb3b51ebb1e..0b2b0849ebc 100644 --- a/src/main/pty/scrollback/terminal-scrollback-snapshots.ts +++ b/src/main/pty/scrollback/terminal-scrollback-snapshots.ts @@ -2,7 +2,7 @@ import { createHash } from 'node:crypto' import { mkdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from 'node:fs' import { mkdir, rename, rm, writeFile } from 'node:fs/promises' import { dirname, join } from 'node:path' -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import type { WorkspaceSessionState } from '../../../shared/workspace-session/workspace-session-state-types' import { TERMINAL_SCROLLBACK_STORE_BYTE_LIMIT } from '../../../shared/terminal/replay/terminal-scrollback-limits' import { errorMessage } from '../../../shared/errors/error-message' diff --git a/src/main/rate-limits/providers/antigravity/antigravity-usage-fetcher.ts b/src/main/rate-limits/providers/antigravity/antigravity-usage-fetcher.ts index 2c468da7da6..1dedf4172e0 100644 --- a/src/main/rate-limits/providers/antigravity/antigravity-usage-fetcher.ts +++ b/src/main/rate-limits/providers/antigravity/antigravity-usage-fetcher.ts @@ -10,7 +10,10 @@ import { } from '../../../wsl/discovery/wsl-default-distro' import { runWslProcess } from '../../../wsl/execution/wsl-runner' import { isWslDistroRunningForBackgroundWork } from '../../../wsl/discovery/wsl-background-distro-gate' -import { hasReachedAppVersion, parseCliVersion } from '../../../../shared/app-version' +import { + hasReachedAppVersion, + parseCliVersion +} from '../../../../shared/app-lifecycle/identity/app-version' import { resolveCommandOnLocalPath } from '../../../ipc/command-path/command-path-resolver' import { hostShellEnvironment } from '../../../runtime/agent-session/environment/structured-agent-shell-environment' import type { diff --git a/src/main/ripgrep/bundled-ripgrep-path.ts b/src/main/ripgrep/bundled-ripgrep-path.ts index 4525f739737..b2b4fed24a5 100644 --- a/src/main/ripgrep/bundled-ripgrep-path.ts +++ b/src/main/ripgrep/bundled-ripgrep-path.ts @@ -1,7 +1,7 @@ import { createHash } from 'node:crypto' import { existsSync, readFileSync, realpathSync } from 'node:fs' import { join } from 'node:path' -import { getAppEnvironment, hasAppEnvironment } from '../../shared/app-environment' +import { getAppEnvironment, hasAppEnvironment } from '../../shared/app-lifecycle/app-environment' import { quotePosixShell } from '../../shared/shell/launch/shell-argument-quoting' import { BUNDLED_RIPGREP_PACKAGE_BIN_DIR, diff --git a/src/main/ripgrep/bundled-ripgrep-real.test.ts b/src/main/ripgrep/bundled-ripgrep-real.test.ts index 8b08f9ad6fa..0d2a3a09241 100644 --- a/src/main/ripgrep/bundled-ripgrep-real.test.ts +++ b/src/main/ripgrep/bundled-ripgrep-real.test.ts @@ -2,7 +2,7 @@ import { copyFileSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'nod import { tmpdir } from 'node:os' import { dirname, join } from 'node:path' import { afterEach, beforeEach, describe, expect, it } from 'vitest' -import { getAppEnvironment, setAppEnvironment } from '../../shared/app-environment' +import { getAppEnvironment, setAppEnvironment } from '../../shared/app-lifecycle/app-environment' import { bundledRipgrepBinaryName } from '../../shared/ripgrep/bundled-ripgrep' import { bundledRipgrepCommand, resetBundledRipgrepPathCacheForTests } from './bundled-ripgrep-path' import { spawnBundledRipgrep } from './bundled-ripgrep-spawn' diff --git a/src/main/runtime/agent-session/environment/runtime-account-controller.ts b/src/main/runtime/agent-session/environment/runtime-account-controller.ts index 6a7e79e6331..f27ffe548dc 100644 --- a/src/main/runtime/agent-session/environment/runtime-account-controller.ts +++ b/src/main/runtime/agent-session/environment/runtime-account-controller.ts @@ -1,5 +1,5 @@ import type { ClaudeAccountService } from '../../../claude-accounts/service' -import { hasAppEnvironment } from '../../../../shared/app-environment' +import { hasAppEnvironment } from '../../../../shared/app-lifecycle/app-environment' import { getManagedDataAccountService } from '../../../managed-data-accounts/service' import type { ClaudeAccountSignIn, diff --git a/src/main/runtime/agent-session/environment/structured-session-child-env.ts b/src/main/runtime/agent-session/environment/structured-session-child-env.ts index f1946fa108a..fb853cc2a25 100644 --- a/src/main/runtime/agent-session/environment/structured-session-child-env.ts +++ b/src/main/runtime/agent-session/environment/structured-session-child-env.ts @@ -4,7 +4,10 @@ * Empty remote selectors to mask the parent env; explicit flags still work, and login profiles can re-export selectors. * Omit pane identity: hooks and mobile status assume a live PTY leaf. Resolve worker identity at every spawn, including recovery and clear. */ -import { getAppEnvironment, hasAppEnvironment } from '../../../../shared/app-environment' +import { + getAppEnvironment, + hasAppEnvironment +} from '../../../../shared/app-lifecycle/app-environment' import { ORCA_AGENT_SESSION_ID_ENV, ORCA_AGENT_SESSION_SPAWN_TOKEN_ENV diff --git a/src/main/runtime/agent-state-rules/agent-state-rules-live-update.ts b/src/main/runtime/agent-state-rules/agent-state-rules-live-update.ts index c8b412ecd0d..ee66c975be6 100644 --- a/src/main/runtime/agent-state-rules/agent-state-rules-live-update.ts +++ b/src/main/runtime/agent-state-rules/agent-state-rules-live-update.ts @@ -1,9 +1,9 @@ import { readFile } from 'node:fs/promises' import { join } from 'node:path' -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { readFetchResponseTextWithinLimit } from '../../../shared/fetch-response-body' import type { GlobalSettings } from '../../../shared/global-settings-types' -import { getVersionChannel, MAIN_RELEASE_REPO } from '../../../shared/release-channel' +import { getVersionChannel, MAIN_RELEASE_REPO } from '../../../shared/updater/release-channel' import { getMainHttpClient } from '../../network/http-client' import { writePluginFileAtomically } from '../../plugins/installation/plugin-atomic-file-write' import { diff --git a/src/main/runtime/client/settings/runtime-client-settings.ts b/src/main/runtime/client/settings/runtime-client-settings.ts index ae85e582bdc..f0ca343e159 100644 --- a/src/main/runtime/client/settings/runtime-client-settings.ts +++ b/src/main/runtime/client/settings/runtime-client-settings.ts @@ -1,6 +1,6 @@ import { publishedLegacyChatPermissionMode } from '../../../../shared/agent-launch/permissions/agent-chat-permission-mode' import { getClaudeAgentViewService } from '../../../claude/agent-view/agent-view-service' -import { getAppEnvironment } from '../../../../shared/app-environment' +import { getAppEnvironment } from '../../../../shared/app-lifecycle/app-environment' import { isArtifactSharingEnabled } from '../../../../shared/artifacts/artifact-sharing-gate' import { isAgentSkillSharingEnabled } from '../../../../shared/skills/sharing/agent-skill-sharing-gate' import { applyPRBotAuthorOverride } from '../../../../shared/source-control/review-comments/pr-bot-author-overrides' diff --git a/src/main/runtime/construction/dark-switch-runtime-capabilities.ts b/src/main/runtime/construction/dark-switch-runtime-capabilities.ts index 6e8617558a1..1e9971525ef 100644 --- a/src/main/runtime/construction/dark-switch-runtime-capabilities.ts +++ b/src/main/runtime/construction/dark-switch-runtime-capabilities.ts @@ -1,4 +1,4 @@ -import type { RuntimeCapability } from '../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../shared/remote-runtime/protocol/protocol-version' import { ORCA_LAYOUT_OWNER_IS_MAIN } from '../../../shared/layout-owner-switch' import { ORCA_SIDEBAR_INPUTS_IS_MAIN } from '../../../shared/sidebar-inputs-switch' import { diff --git a/src/main/runtime/construction/runtime-construction.ts b/src/main/runtime/construction/runtime-construction.ts index a8550753700..8ad4d20268a 100644 --- a/src/main/runtime/construction/runtime-construction.ts +++ b/src/main/runtime/construction/runtime-construction.ts @@ -44,7 +44,7 @@ import { type RuntimeSkillCommandSurface, installRuntimeSkillCommandSurface } from '../integrations/skill/runtime-skill-command-contract' -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { RuntimeClientSettingsController } from '../client/settings/runtime-client-settings' import { RuntimeSessionSearchSettingsController } from '../integrations/ai-vault/runtime-session-search-settings' import { RuntimeAutomationController } from '../integrations/automations/runtime-automation-controller' diff --git a/src/main/runtime/hosts/identity/runtime-environment-identity-verification.ts b/src/main/runtime/hosts/identity/runtime-environment-identity-verification.ts index b44c2affedf..3162dd26574 100644 --- a/src/main/runtime/hosts/identity/runtime-environment-identity-verification.ts +++ b/src/main/runtime/hosts/identity/runtime-environment-identity-verification.ts @@ -4,7 +4,7 @@ import { } from '../../../../shared/remote-runtime/host-catalog/runtime-environments' import { sendRemoteRuntimeRequestOnSocket } from '../../../../shared/remote-runtime/requests/remote-runtime-request-socket' import { verifyRemotePairingRuntimeStatus } from '../../../../shared/remote-runtime/pairing/remote-pairing-verification' -import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../../shared/electron-remote-runtime-client-capabilities' +import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../../shared/remote-runtime/protocol/electron-remote-runtime-client-capabilities' import type { RuntimeStatus } from '../../../../shared/remote-runtime/session-graph/runtime-session-contracts' import type { PairedRuntimeConnection } from '../../../../shared/remote-runtime/pairing/paired-runtime-connection' diff --git a/src/main/runtime/hosts/management/remote-server-updater.ts b/src/main/runtime/hosts/management/remote-server-updater.ts index 08f6ce63870..df63584e5bc 100644 --- a/src/main/runtime/hosts/management/remote-server-updater.ts +++ b/src/main/runtime/hosts/management/remote-server-updater.ts @@ -2,7 +2,7 @@ import type { RemoteServerUpdateInstallResult, RemoteServerUpdaterSnapshot } from '../../../../shared/remote-runtime/host-catalog/remote-server-update' -import type { UpdateCheckOptions } from '../../../../shared/update-status-types' +import type { UpdateCheckOptions } from '../../../../shared/updater/update-status-types' type RemoteServerUpdaterAdapter = { getSnapshot: (runtimeId: string) => RemoteServerUpdaterSnapshot diff --git a/src/main/runtime/hosts/platform-probe/runtime-machine-name.ts b/src/main/runtime/hosts/platform-probe/runtime-machine-name.ts index 82873afa676..07d9ea32b33 100644 --- a/src/main/runtime/hosts/platform-probe/runtime-machine-name.ts +++ b/src/main/runtime/hosts/platform-probe/runtime-machine-name.ts @@ -1,6 +1,6 @@ import os from 'node:os' import { runProcess } from '@orca/process-host' -import { normalizeMachineName } from '../../../../shared/machine-name' +import { normalizeMachineName } from '../../../../shared/remote-runtime/host-metadata/machine-name' import { withTimeout } from '../../../../shared/concurrency/promise-timeout-fallback' const MACOS_COMPUTER_NAME = '/usr/sbin/scutil' diff --git a/src/main/runtime/hosts/runtime-status.ts b/src/main/runtime/hosts/runtime-status.ts index 7197955f00f..28e93d542c7 100644 --- a/src/main/runtime/hosts/runtime-status.ts +++ b/src/main/runtime/hosts/runtime-status.ts @@ -21,7 +21,7 @@ import { MIN_COMPATIBLE_RUNTIME_CLIENT_VERSION, RUNTIME_CAPABILITIES, RUNTIME_PROTOCOL_VERSION -} from '../../../shared/protocol-version' +} from '../../../shared/remote-runtime/protocol/protocol-version' import { MANAGED_SERVER_RUNTIME_CAPABILITY, diff --git a/src/main/runtime/mobile-desktop-relay/mobile-desktop-relay-link.ts b/src/main/runtime/mobile-desktop-relay/mobile-desktop-relay-link.ts index d58aa8935a5..cdd36510f46 100644 --- a/src/main/runtime/mobile-desktop-relay/mobile-desktop-relay-link.ts +++ b/src/main/runtime/mobile-desktop-relay/mobile-desktop-relay-link.ts @@ -1,5 +1,5 @@ import type { RemoteRuntimePassthroughSocket } from '../../../shared/remote-runtime/remote-runtime-passthrough-socket' -import type { RuntimeCapability } from '../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../shared/remote-runtime/protocol/protocol-version' import { RemoteRuntimeClientError } from '../../../shared/remote-runtime/remote-runtime-client-error' import { PHONE_RELAY_OPEN_BUDGET_MS, diff --git a/src/main/runtime/mobile-desktop-relay/mobile-relay-host-catalog.integration.test.ts b/src/main/runtime/mobile-desktop-relay/mobile-relay-host-catalog.integration.test.ts index 12157a3ba63..c7f9a915f0d 100644 --- a/src/main/runtime/mobile-desktop-relay/mobile-relay-host-catalog.integration.test.ts +++ b/src/main/runtime/mobile-desktop-relay/mobile-relay-host-catalog.integration.test.ts @@ -9,7 +9,7 @@ import { z } from 'zod' import { DELEGATED_MOBILE_DEVICES_RUNTIME_CAPABILITY } from '../../../shared/delegated-mobile-device-contract' import { parsePairingCode } from '../../../shared/remote-runtime/pairing/pairing' import type { PairingOffer } from '../../../shared/remote-runtime/pairing/mobile-relay-pairing-offer' -import { RUNTIME_PROTOCOL_VERSION } from '../../../shared/protocol-version' +import { RUNTIME_PROTOCOL_VERSION } from '../../../shared/remote-runtime/protocol/protocol-version' import { sendRemoteRuntimeRequestOnSocket } from '../../../shared/remote-runtime/requests/remote-runtime-request-socket' import { runtimeEnvironmentStatusFromSnapshot, 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 17ff85e6dda..ace4d220bf9 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 @@ -1,6 +1,6 @@ import { describe, expect, it, vi } from 'vitest' import { DELEGATED_MOBILE_DEVICES_RUNTIME_CAPABILITY } from '../../../shared/delegated-mobile-device-contract' -import { RUNTIME_PROTOCOL_VERSION } from '../../../shared/protocol-version' +import { RUNTIME_PROTOCOL_VERSION } from '../../../shared/remote-runtime/protocol/protocol-version' import { runtimeEnvironmentStatusFromSnapshot, type RuntimeHostStatusSnapshot diff --git a/src/main/runtime/mobile-desktop-relay/on-demand-server-worktree-rows.test.ts b/src/main/runtime/mobile-desktop-relay/on-demand-server-worktree-rows.test.ts index b5db98800b4..146778ae743 100644 --- a/src/main/runtime/mobile-desktop-relay/on-demand-server-worktree-rows.test.ts +++ b/src/main/runtime/mobile-desktop-relay/on-demand-server-worktree-rows.test.ts @@ -1,7 +1,7 @@ // Run the catalog contract against per-request fetching instead of main-owned live rows. import { describe, expect, it, vi } from 'vitest' import { DELEGATED_MOBILE_DEVICES_RUNTIME_CAPABILITY } from '../../../shared/delegated-mobile-device-contract' -import { RUNTIME_PROTOCOL_VERSION } from '../../../shared/protocol-version' +import { RUNTIME_PROTOCOL_VERSION } from '../../../shared/remote-runtime/protocol/protocol-version' import { runtimeEnvironmentStatusFromSnapshot, type RuntimeHostStatusSnapshot diff --git a/src/main/runtime/orchestration/federation/orchestration-peer-capability-cache.ts b/src/main/runtime/orchestration/federation/orchestration-peer-capability-cache.ts index dca56957d2c..ef294bbbc5e 100644 --- a/src/main/runtime/orchestration/federation/orchestration-peer-capability-cache.ts +++ b/src/main/runtime/orchestration/federation/orchestration-peer-capability-cache.ts @@ -1,4 +1,4 @@ -import type { RuntimeCapability } from '../../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../../shared/remote-runtime/protocol/protocol-version' import type { RuntimeStatus } from '../../../../shared/remote-runtime/session-graph/runtime-session-contracts' import { BoundedMap } from '../../../../shared/collections/bounded-map' diff --git a/src/main/runtime/orchestration/federation/synchronization/federation-sync-test-harness.ts b/src/main/runtime/orchestration/federation/synchronization/federation-sync-test-harness.ts index b2b857a37f0..7dd98222b30 100644 --- a/src/main/runtime/orchestration/federation/synchronization/federation-sync-test-harness.ts +++ b/src/main/runtime/orchestration/federation/synchronization/federation-sync-test-harness.ts @@ -5,7 +5,7 @@ import '../../db/messages/mailbox-routing-page' import '../../db/dispatch-row-writer' import '../../db/attempt-outcome-projection' import { ORCHESTRATION_LEGACY_RUN_ID as LEGACY_RUN_ID } from '../../../../../shared/orchestration/orchestration-rpc-contract' -import '../../../../../shared/protocol-version' +import '../../../../../shared/remote-runtime/protocol/protocol-version' import { ORCHESTRATION_FEDERATION_LIFECYCLE_SETTLEMENT_RUNTIME_CAPABILITY } from '../../../../../shared/orchestration/orchestration-runtime-capabilities' import { OrcaRuntimeService } from '../../../orca-runtime' diff --git a/src/main/runtime/orchestration/legacy-remote-home/federation-sync-capability.ts b/src/main/runtime/orchestration/legacy-remote-home/federation-sync-capability.ts index 492bb77b09f..3fb5090c022 100644 --- a/src/main/runtime/orchestration/legacy-remote-home/federation-sync-capability.ts +++ b/src/main/runtime/orchestration/legacy-remote-home/federation-sync-capability.ts @@ -1,12 +1,12 @@ import type { RuntimeStatus } from '../../../../shared/remote-runtime/session-graph/runtime-session-contracts' -import '../../../../shared/protocol-version' +import '../../../../shared/remote-runtime/protocol/protocol-version' import { ORCHESTRATION_FEDERATION_LIFECYCLE_SETTLEMENT_PROTOCOL_VERSION, ORCHESTRATION_FEDERATION_LIFECYCLE_SETTLEMENT_RUNTIME_CAPABILITY, ORCHESTRATION_FEDERATION_RELEASE_ARCHIVE_RUNTIME_CAPABILITY, ORCHESTRATION_WORKER_AUTO_RELEASE_RUNTIME_CAPABILITY } from '../../../../shared/orchestration/orchestration-runtime-capabilities' -import type { RuntimeCapability } from '../../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../../shared/remote-runtime/protocol/protocol-version' import { STRUCTURED_WORKER_HANDLE_PREFIX } from '../../../../shared/orchestration/workers/structured-worker-handle' import type { FederationRuntime } from '../federation/federation-runtime' import type { FederatedDispatchRow } from '../db/orchestration-records' diff --git a/src/main/runtime/orchestration/legacy-remote-home/federation-sync.ts b/src/main/runtime/orchestration/legacy-remote-home/federation-sync.ts index a0198ce8ca5..4e857e930d0 100644 --- a/src/main/runtime/orchestration/legacy-remote-home/federation-sync.ts +++ b/src/main/runtime/orchestration/legacy-remote-home/federation-sync.ts @@ -2,7 +2,7 @@ import { federationRelayPrefix } from '../federation/relay/federation-relay-pref import { federationRelayWireItem } from '../legacy-remote/federation-relay-wire' import type { FederationRuntime } from '../federation/federation-runtime' import type { FederatedLifecycleSettlement } from '../legacy-remote/federation-lifecycle-settlement' -import '../../../../shared/protocol-version' +import '../../../../shared/remote-runtime/protocol/protocol-version' import { ORCHESTRATION_FEDERATION_LIFECYCLE_SETTLEMENT_PROTOCOL_VERSION } from '../../../../shared/orchestration/orchestration-runtime-capabilities' import { OrchestrationError } from '../orchestration-error' import { diff --git a/src/main/runtime/orchestration/mailbox/routing/structured-session-mail-target.test.ts b/src/main/runtime/orchestration/mailbox/routing/structured-session-mail-target.test.ts index fcff5a1eca4..f57918ecd35 100644 --- a/src/main/runtime/orchestration/mailbox/routing/structured-session-mail-target.test.ts +++ b/src/main/runtime/orchestration/mailbox/routing/structured-session-mail-target.test.ts @@ -9,7 +9,7 @@ import { hasAppEnvironment, setAppEnvironment, type AppEnvironment -} from '../../../../../shared/app-environment' +} from '../../../../../shared/app-lifecycle/app-environment' import type { AgentSessionLease, AgentSessionRecord @@ -33,12 +33,6 @@ vi.mock( const { OrcaRuntimeWithGetPtyRecordForPaneKey } = await import('./terminal-pane-mail-routing') const { OrchestrationDb } = await import('../../db/orchestration-db') const { resolveOrcaSessionParty } = await import('../../addressing/orchestration-party') -const { - mintStructuredWorkerHandle, - mintStructuredWorkerPaneKey, - structuredWorkerIdentities, - structuredWorkerProcessIncarnation -} = await import('../../terminal-authority/structured-sessions/structured-worker-identity') const CHAT = testOrcaSessionId('4a1f6c2e-8b3d-4e7a-9c15-0d2b6e8f1a37') const CHAT_ADDRESS = formatOrcaSessionAddress(CHAT) @@ -117,30 +111,6 @@ afterEach(() => { db.close() }) -describe('the idle edge of a structured session', () => { - it('re-derives and delivers the mailboxes the session owns, and nothing while it works', () => { - installStore(chatRecord()) - const runId = chatCoordinatedRun() - db.insertMessage({ - from: 'term_worker', - to: `run:${runId}`, - subject: 'done', - runId, - type: 'status' - }) - const delivered: string[] = [] - const runtime = probe({ - deliverPendingMessagesForHandle: (handle: string) => delivered.push(handle), - notifyStructuredSessionJournalActivity: vi.fn(), - cancelMessageWaiters: vi.fn() - }) - runtime.onStructuredSessionStatusForMail({ sessionId: CHAT, status: 'working' }) - expect(delivered).toEqual([]) - runtime.onStructuredSessionStatusForMail({ sessionId: CHAT, status: 'idle' }) - expect(delivered).toEqual([`run:${runId}`]) - }) -}) - describe('the idle edge after a restart, before any orchestration call', () => { let userData: string let previousEnvironment: AppEnvironment | null @@ -178,26 +148,6 @@ describe('the idle edge after a restart, before any orchestration call', () => { }) } - it('opens an existing orchestration database itself, so mail stored before the restart is redriven', () => { - // An idle edge after restart must open the orchestration DB rather than silently read its null field. - installStore(chatRecord()) - const stored = new OrchestrationDb(join(userData, 'orchestration.db')) - const runId = stored.createRun({ - objective: 'o', - coordinatorHandle: null, - coordinatorPaneKey: null, - coordinatorOrcaSessionId: CHAT - }).id - stored.close() - const delivered: string[] = [] - const runtime = restarted(delivered) - - runtime.onStructuredSessionStatusForMail({ sessionId: CHAT, status: 'idle' }) - - expect(delivered).toEqual([`run:${runId}`]) - runtime.getOrchestrationDb().close() - }) - it('creates no database for a profile that never orchestrated, and says nothing', () => { installStore(chatRecord()) const warn = vi.spyOn(console, 'warn').mockImplementation(() => {}) @@ -298,72 +248,3 @@ describe('a coordinator chat continued by /clear', () => { expect(db.getMessageById(direct.id)).toMatchObject({ to_handle: CHAT_ADDRESS, read: 0 }) }) }) - -describe('a structured worker continued by /clear', () => { - const WORKER = testOrcaSessionId('9c2e4a61-3f7b-4d8e-b105-6a2d8e4f1c93') - const WORKER_SUCCESSOR = testOrcaSessionId('clear-a1b2c3d4e5f60718293a4b5c6d7e8f9012345678') - - afterEach(() => { - structuredWorkerIdentities.clear() - }) - - /** A worker minted for WORKER, whose conversation `/clear` continued in WORKER_SUCCESSOR. */ - function clearedWorker(): { handle: string; paneKey: string } { - const store = installStore(null) - const minted = agentSessionRecordFixture( - agentSessionLeaseFixture({ sessionId: WORKER, runtimeKind: 'native' }) - ) - store.records.set(WORKER, { - ...minted, - conversationCommand: { - command: 'clear', - state: 'completed', - replacementSessionId: WORKER_SUCCESSOR, - operationId: 'op-worker', - callerKey: 'caller', - phase: 'committed' - } - }) - store.records.set( - WORKER_SUCCESSOR, - agentSessionRecordFixture( - agentSessionLeaseFixture({ sessionId: WORKER_SUCCESSOR, runtimeKind: 'native' }) - ) - ) - const identity = structuredWorkerIdentities.register({ - handle: mintStructuredWorkerHandle(), - sessionId: WORKER, - agent: 'codex', - paneKey: mintStructuredWorkerPaneKey(WORKER), - processIncarnation: structuredWorkerProcessIncarnation(WORKER), - worktreeId: 'wt_1', - hostScope: { kind: 'local', hostId: 'local' } - }) - return { handle: identity.handle, paneKey: identity.paneKey } - } - - it("delivers the worker's dispatch mailbox and a Run it coordinates to the live successor", () => { - const { handle, paneKey } = clearedWorker() - const dispatch = db.createDispatchContext({ - taskId: db.createTask({ runId: chatCoordinatedRun(), spec: 'work' }).id, - assigneeHandle: handle, - assigneePaneKey: paneKey, - processIncarnation: structuredWorkerProcessIncarnation(WORKER), - creator: { kind: 'system' }, - maxDepth: Number.MAX_SAFE_INTEGER - }) - expect(probe().target(`dispatch:${dispatch.id}`)).toEqual({ - sessionId: WORKER_SUCCESSOR, - dispatchId: dispatch.id - }) - const workerRun = db.createRun({ - objective: 'o', - coordinatorHandle: handle, - coordinatorPaneKey: paneKey - }).id - expect(probe().target(`run:${workerRun}`)).toEqual({ - sessionId: WORKER_SUCCESSOR, - dispatchId: null - }) - }) -}) diff --git a/src/main/runtime/orchestration/terminal-authority/structured-sessions/structured-chat-coordinator-mail-rig.test-fixture.ts b/src/main/runtime/orchestration/terminal-authority/structured-sessions/structured-chat-coordinator-mail-rig.test-fixture.ts index 81ab65c5f8e..fa458953319 100644 --- a/src/main/runtime/orchestration/terminal-authority/structured-sessions/structured-chat-coordinator-mail-rig.test-fixture.ts +++ b/src/main/runtime/orchestration/terminal-authority/structured-sessions/structured-chat-coordinator-mail-rig.test-fixture.ts @@ -7,7 +7,7 @@ import { join } from 'node:path' import { afterEach, beforeEach, expect, vi } from 'vitest' import type { AgentJournalRenderItem } from '../../../../../shared/agent-session/journal/agent-session-journal-types' import { computeAgentSessionPayloadFingerprint } from '../../../../../shared/agent-session/lifecycle/operations/agent-session-mutation-envelope' -import '../../../../../shared/protocol-version' +import '../../../../../shared/remote-runtime/protocol/protocol-version' import { ORCHESTRATION_CONTRACT_VERSION } from '../../../../../shared/orchestration/orchestration-runtime-capabilities' import type { StructuredAgentSessionHost } from '../../../../native-chat/agent-session-wire/host/structured-agent-session-host' import { activeProviderContext } from '../../../../../shared/agent-session/agent-session-provider-context' diff --git a/src/main/runtime/orchestration/workers/launch/orchestration-cli-command.ts b/src/main/runtime/orchestration/workers/launch/orchestration-cli-command.ts index b02155aeacb..dfddc15f382 100644 --- a/src/main/runtime/orchestration/workers/launch/orchestration-cli-command.ts +++ b/src/main/runtime/orchestration/workers/launch/orchestration-cli-command.ts @@ -4,7 +4,10 @@ import { parseOrcaSessionAddress } from '../../../../../shared/agent-session/ide import type { ProjectExecutionRuntimeResolution } from '../../../../../shared/execution-host/project-execution-runtime' import { isWslUncPath } from '../../../../../shared/file-access/wsl-paths' import { splitWorktreeIdForFilesystem } from '../../../../../shared/worktree/id' -import { getAppEnvironment, hasAppEnvironment } from '../../../../../shared/app-environment' +import { + getAppEnvironment, + hasAppEnvironment +} from '../../../../../shared/app-lifecycle/app-environment' export type OrchestrationCliCommand = 'orca' | 'orca-dev' | 'orca-ide' diff --git a/src/main/runtime/push/notifications/desktop-client-presence-tracker.ts b/src/main/runtime/push/notifications/desktop-client-presence-tracker.ts index 3d86054abb9..4535a10c69e 100644 --- a/src/main/runtime/push/notifications/desktop-client-presence-tracker.ts +++ b/src/main/runtime/push/notifications/desktop-client-presence-tracker.ts @@ -1,4 +1,4 @@ -import { DESKTOP_PRESENCE_TTL_MS } from '../../../../shared/desktop-client-presence' +import { DESKTOP_PRESENCE_TTL_MS } from '../../../../shared/app-lifecycle/presence/desktop-client-presence' export class DesktopClientPresenceTracker { private readonly reports = new Map() diff --git a/src/main/runtime/push/push-policy-pipeline.integration.test.ts b/src/main/runtime/push/push-policy-pipeline.integration.test.ts index 69440439c0c..36427b9e8cb 100644 --- a/src/main/runtime/push/push-policy-pipeline.integration.test.ts +++ b/src/main/runtime/push/push-policy-pipeline.integration.test.ts @@ -8,7 +8,7 @@ import { RuntimeMobileNotificationController } from './notifications/runtime-mob import { setRuntimeDesktopSurface } from '../construction/runtime-desktop-surface' import { RuntimeSubscriptionRegistry } from '../client/runtime-subscription-registry' import { reportDesktopPresence } from '../rpc/methods/notifications/notifications' -import { DESKTOP_PRESENCE_TTL_MS } from '../../../shared/desktop-client-presence' +import { DESKTOP_PRESENCE_TTL_MS } from '../../../shared/app-lifecycle/presence/desktop-client-presence' import { DesktopPushService } from './desktop-push-service' import { PushUnregisterOutbox } from './push-unregister-outbox' import { createPushHostKeypair } from './push-host-challenge-fixtures' diff --git a/src/main/runtime/rpc/callers/runtime-client-capabilities.ts b/src/main/runtime/rpc/callers/runtime-client-capabilities.ts index ba9b747fde1..f360c4eff88 100644 --- a/src/main/runtime/rpc/callers/runtime-client-capabilities.ts +++ b/src/main/runtime/rpc/callers/runtime-client-capabilities.ts @@ -1,4 +1,4 @@ -import type { RuntimeCapability } from '../../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../../shared/remote-runtime/protocol/protocol-version' export function parseRuntimeClientCapabilities(value: unknown): readonly RuntimeCapability[] { if (!Array.isArray(value) || value.length > 64) { diff --git a/src/main/runtime/rpc/core.ts b/src/main/runtime/rpc/core.ts index 206cb1a985e..ce6423494e7 100644 --- a/src/main/runtime/rpc/core.ts +++ b/src/main/runtime/rpc/core.ts @@ -10,7 +10,7 @@ import type { PairingGetEndpointsResult, PairingProvisionRelayParams } from '../../../shared/remote-runtime/relay/mobile-relay-credential-contract' -import type { RuntimeCapability } from '../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../shared/remote-runtime/protocol/protocol-version' import type { MobileRelayHostsListResult, MobileRelayHostWorktreesResult diff --git a/src/main/runtime/rpc/methods/automations/automations.ts b/src/main/runtime/rpc/methods/automations/automations.ts index ba5898a8711..c94926bb437 100644 --- a/src/main/runtime/rpc/methods/automations/automations.ts +++ b/src/main/runtime/rpc/methods/automations/automations.ts @@ -1,4 +1,4 @@ -import '../../../../../shared/protocol-version' +import '../../../../../shared/remote-runtime/protocol/protocol-version' import { AUTOMATION_OWNER_FENCING_RUNTIME_CAPABILITY } from '../../../../../shared/automations/automation-runtime-capabilities' import type { AutomationOwnerPrecondition } from '../../../../../shared/automations/ownership/automation-owner-precondition' import { remoteRpcContentBudget } from '../../../../../shared/remote-runtime/rpc/remote-rpc-content-budget' diff --git a/src/main/runtime/rpc/methods/browser/browser-client-file-channel.ts b/src/main/runtime/rpc/methods/browser/browser-client-file-channel.ts index 6901c078021..2c177a1faa0 100644 --- a/src/main/runtime/rpc/methods/browser/browser-client-file-channel.ts +++ b/src/main/runtime/rpc/methods/browser/browser-client-file-channel.ts @@ -3,7 +3,7 @@ import { BrowserClientFileChannelReadParams, BrowserClientFileChannelWriteParams } from '../../../../../shared/browser/client-hosting/browser-client-file-channel-protocol' -import '../../../../../shared/protocol-version' +import '../../../../../shared/remote-runtime/protocol/protocol-version' import { BROWSER_CLIENT_HOST_RUNTIME_CAPABILITY } from '../../../../../shared/browser/runtime/browser-runtime-capabilities' import { getBrowserClientDownloadTransferStore } from '../../../browser/downloads/browser-client-download-transfer-store' import { getBrowserHostLeaseRegistry } from '../../../browser-host/leases/browser-host-lease-registry-instance' diff --git a/src/main/runtime/rpc/methods/browser/browser-client-host-attach-adoption.test.ts b/src/main/runtime/rpc/methods/browser/browser-client-host-attach-adoption.test.ts index 310922f3088..c9d068e7e4c 100644 --- a/src/main/runtime/rpc/methods/browser/browser-client-host-attach-adoption.test.ts +++ b/src/main/runtime/rpc/methods/browser/browser-client-host-attach-adoption.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it, vi } from 'vitest' -import '../../../../../shared/protocol-version' +import '../../../../../shared/remote-runtime/protocol/protocol-version' import { BROWSER_CLIENT_HOST_RUNTIME_CAPABILITY } from '../../../../../shared/browser/runtime/browser-runtime-capabilities' import type { BrowserClientHostedPageInventory } from '../../../../../shared/browser/client-hosting/browser-client-host-protocol' import { getBrowserHostLeaseRegistry } from '../../../browser-host/leases/browser-host-lease-registry-instance' diff --git a/src/main/runtime/rpc/methods/browser/browser-client-host-reconciliation.test.ts b/src/main/runtime/rpc/methods/browser/browser-client-host-reconciliation.test.ts index 0ffc484867b..6873cad0e30 100644 --- a/src/main/runtime/rpc/methods/browser/browser-client-host-reconciliation.test.ts +++ b/src/main/runtime/rpc/methods/browser/browser-client-host-reconciliation.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it, vi } from 'vitest' -import '../../../../../shared/protocol-version' +import '../../../../../shared/remote-runtime/protocol/protocol-version' import { BROWSER_CLIENT_HOST_RUNTIME_CAPABILITY } from '../../../../../shared/browser/runtime/browser-runtime-capabilities' import { getBrowserHostLeaseRegistry } from '../../../browser-host/leases/browser-host-lease-registry-instance' import type { OrcaRuntimeService } from '../../../orca-runtime' diff --git a/src/main/runtime/rpc/methods/browser/browser-client-host.test.ts b/src/main/runtime/rpc/methods/browser/browser-client-host.test.ts index f61c5ceb0c4..e89a8db7908 100644 --- a/src/main/runtime/rpc/methods/browser/browser-client-host.test.ts +++ b/src/main/runtime/rpc/methods/browser/browser-client-host.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it, vi } from 'vitest' -import '../../../../../shared/protocol-version' +import '../../../../../shared/remote-runtime/protocol/protocol-version' import { BROWSER_CLIENT_HOST_RUNTIME_CAPABILITY } from '../../../../../shared/browser/runtime/browser-runtime-capabilities' import { getBrowserHostLeaseRegistry } from '../../../browser-host/leases/browser-host-lease-registry-instance' import type { OrcaRuntimeService } from '../../../orca-runtime' diff --git a/src/main/runtime/rpc/methods/browser/browser-client-host.ts b/src/main/runtime/rpc/methods/browser/browser-client-host.ts index 741503b483f..ab4f830aa93 100644 --- a/src/main/runtime/rpc/methods/browser/browser-client-host.ts +++ b/src/main/runtime/rpc/methods/browser/browser-client-host.ts @@ -1,6 +1,6 @@ import { requireCommandResultIdentity } from './browser-client-host-command-result-identity' import { BROWSER_PAGE_INITIALIZATION_ACTION_METHODS } from './browser-page-initialization-action' -import '../../../../../shared/protocol-version' +import '../../../../../shared/remote-runtime/protocol/protocol-version' import { BROWSER_CLIENT_HOST_RUNTIME_CAPABILITY, BROWSER_CLIENT_PAGE_METADATA_RUNTIME_CAPABILITY diff --git a/src/main/runtime/rpc/methods/browser/browser-client-page-metadata.test.ts b/src/main/runtime/rpc/methods/browser/browser-client-page-metadata.test.ts index a40469b7abe..727ae81f7ba 100644 --- a/src/main/runtime/rpc/methods/browser/browser-client-page-metadata.test.ts +++ b/src/main/runtime/rpc/methods/browser/browser-client-page-metadata.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it, vi } from 'vitest' -import '../../../../../shared/protocol-version' +import '../../../../../shared/remote-runtime/protocol/protocol-version' import { BROWSER_CLIENT_HOST_RUNTIME_CAPABILITY, BROWSER_CLIENT_PAGE_METADATA_RUNTIME_CAPABILITY diff --git a/src/main/runtime/rpc/methods/browser/browser-network-tunnel.test.ts b/src/main/runtime/rpc/methods/browser/browser-network-tunnel.test.ts index e8156a211e3..3c1ca43b863 100644 --- a/src/main/runtime/rpc/methods/browser/browser-network-tunnel.test.ts +++ b/src/main/runtime/rpc/methods/browser/browser-network-tunnel.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it, vi } from 'vitest' -import '../../../../../shared/protocol-version' +import '../../../../../shared/remote-runtime/protocol/protocol-version' import { BROWSER_CLIENT_HOST_RUNTIME_CAPABILITY, BROWSER_NETWORK_EXECUTION_HOSTS_RUNTIME_CAPABILITY, diff --git a/src/main/runtime/rpc/methods/browser/browser-network-tunnel.ts b/src/main/runtime/rpc/methods/browser/browser-network-tunnel.ts index a73beead7ef..a3a4b10725e 100644 --- a/src/main/runtime/rpc/methods/browser/browser-network-tunnel.ts +++ b/src/main/runtime/rpc/methods/browser/browser-network-tunnel.ts @@ -9,7 +9,7 @@ import { browserNetworkExecutionHostKey } from '../../../../../shared/browser/cl import type { BrowserNetworkExecutionRouteResolver } from '../../../../browser/network/execution-routes/browser-network-execution-route-contract' import { resolveBrowserNetworkExecutionRoute } from '../../../../browser/network/execution-routes/browser-network-execution-route-dispatch' import { BrowserNetworkTunnelAttachParams } from '../../../../../shared/browser/client-hosting/browser-client-host-protocol' -import '../../../../../shared/protocol-version' +import '../../../../../shared/remote-runtime/protocol/protocol-version' import { BROWSER_CLIENT_HOST_RUNTIME_CAPABILITY, BROWSER_NETWORK_EXECUTION_HOSTS_RUNTIME_CAPABILITY, diff --git a/src/main/runtime/rpc/methods/client-events/runtime-client-capabilities.ts b/src/main/runtime/rpc/methods/client-events/runtime-client-capabilities.ts index 1e509eea001..ef5b699d460 100644 --- a/src/main/runtime/rpc/methods/client-events/runtime-client-capabilities.ts +++ b/src/main/runtime/rpc/methods/client-events/runtime-client-capabilities.ts @@ -1,4 +1,4 @@ -import type { RuntimeCapability } from '../../../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../../../shared/remote-runtime/protocol/protocol-version' import { defineMethod } from '../../core' import { ClientCapabilitiesUpdate } from '../../../../../shared/rpc-contract/host-management/runtime-client-capabilities-params' diff --git a/src/main/runtime/rpc/methods/history/ai-vault.test.ts b/src/main/runtime/rpc/methods/history/ai-vault.test.ts index 7c1a825ce8d..69eea95bc78 100644 --- a/src/main/runtime/rpc/methods/history/ai-vault.test.ts +++ b/src/main/runtime/rpc/methods/history/ai-vault.test.ts @@ -16,7 +16,7 @@ import type { import type { AiVaultServiceScanOptions } from '../../../../ai-vault/scan-service/session-scanner-service-protocol' -import '../../../../../shared/protocol-version' +import '../../../../../shared/remote-runtime/protocol/protocol-version' import '../../../../../shared/ai-vault/contracts/ai-vault-runtime-capabilities' const { scanAiVaultSessionsInService, resolveAiVaultSessionTitlesInService } = vi.hoisted(() => ({ @@ -39,16 +39,10 @@ vi.mock( import { AI_VAULT_METHODS } from './ai-vault' import '../../../../../shared/rpc-contract/ai-vault/ai-vault-params' -import { agentSessionRefusalError } from '../../../../../shared/agent-session/failures/agent-session-wire-refusals' - -import { recordStructuredAgentSessionHostInstallRefusal } from '../../../agent-session/structured-agent-session-host-refusal' import '../../../../native-chat/agent-session-wire/host/structured-agent-session-registry' import '../../../../ai-vault/structured-sessions/structured-session-ownership.test-support' -import { - listAiVaultSessions, - resetAiVaultSessionListCacheForTests -} from '../../../../ai-vault/listing/cached-session-list' +import { resetAiVaultSessionListCacheForTests } from '../../../../ai-vault/listing/cached-session-list' function makeRequest(method: string, params?: unknown): RpcRequest { return { id: 'req-1', authToken: 'tok', method, params } @@ -99,58 +93,6 @@ function makeDispatcher(): RpcDispatcher { return new RpcDispatcher({ runtime, methods: AI_VAULT_METHODS }) } -// Chat-host refusal must not disable transcript history or terminal resume; other host failures still propagate. -describe('aiVault methods without a structured host', () => { - const refusal = agentSessionRefusalError( - 'agent_session_journal_unreadable', - { reason: 'journalCorrupt' }, - 'Unable to load this chat.' - ) - - beforeEach(() => { - resetAiVaultSessionListCacheForTests() - scanAiVaultSessionsInService.mockReset() - scanAiVaultSessionsInService.mockResolvedValue(makeResult()) - recordStructuredAgentSessionHostInstallRefusal(refusal) - }) - - afterEach(() => { - recordStructuredAgentSessionHostInstallRefusal(null) - resetAiVaultSessionListCacheForTests() - }) - - function refusedDispatcher(installError: Error): RpcDispatcher { - // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the two aiVault handlers read only these runtime members. - const runtime = { - getRuntimeId: () => 'test-runtime', - ensureStructuredAgentSessionHost: vi.fn().mockRejectedValue(installError), - listAiVaultSessions: ( - args?: Parameters[0], - signal?: AbortSignal - ) => listAiVaultSessions(args, { signal }), - prepareAiVaultSessionResume: vi.fn().mockResolvedValue({ useRealCodexHome: true }) - } as unknown as OrcaRuntimeService - return new RpcDispatcher({ runtime, methods: AI_VAULT_METHODS }) - } - - it('lists and prepares a resume while chats are refused', async () => { - const dispatcher = refusedDispatcher(refusal) - - await expect( - dispatcher.dispatch(makeRequest('aiVault.listSessions', { limit: 500 })) - ).resolves.toMatchObject({ ok: true, result: makeResult() }) - await expect( - dispatcher.dispatch( - makeRequest('aiVault.prepareSessionResume', { - agent: 'codex', - filePath: '/managed/sessions/rollout-a.jsonl', - codexHome: '/managed' - }) - ) - ).resolves.toMatchObject({ ok: true, result: { useRealCodexHome: true } }) - }) -}) - describe('aiVault.listSessions handler + shared cache', () => { beforeEach(() => { resetAiVaultSessionListCacheForTests() diff --git a/src/main/runtime/rpc/methods/mobile-delivery/bundled-mobile-web-bundle.ts b/src/main/runtime/rpc/methods/mobile-delivery/bundled-mobile-web-bundle.ts index 3cc62c1c7f9..479915fe142 100644 --- a/src/main/runtime/rpc/methods/mobile-delivery/bundled-mobile-web-bundle.ts +++ b/src/main/runtime/rpc/methods/mobile-delivery/bundled-mobile-web-bundle.ts @@ -1,7 +1,10 @@ import { existsSync } from 'node:fs' import { readFile } from 'node:fs/promises' import { join } from 'node:path' -import { getAppEnvironment, hasAppEnvironment } from '../../../../../shared/app-environment' +import { + getAppEnvironment, + hasAppEnvironment +} from '../../../../../shared/app-lifecycle/app-environment' import { InstalledMobileWebBundleManifestSchema, type MobileWebBundleManifest diff --git a/src/main/runtime/rpc/methods/orchestration/worker/testing/worker-release.test-support.ts b/src/main/runtime/rpc/methods/orchestration/worker/testing/worker-release.test-support.ts index 89d2dc17c3f..a94de3a83ab 100644 --- a/src/main/runtime/rpc/methods/orchestration/worker/testing/worker-release.test-support.ts +++ b/src/main/runtime/rpc/methods/orchestration/worker/testing/worker-release.test-support.ts @@ -20,7 +20,7 @@ import { hasAppEnvironment, setAppEnvironment, type AppEnvironment -} from '../../../../../../../shared/app-environment' +} from '../../../../../../../shared/app-lifecycle/app-environment' import { getWorkerTerminalAutoReleaseScheduler } from '../../../../../orchestration/terminal-authority/release/worker-terminal-auto-release-scheduler' type WorkerStartOptions = { terminal?: string; agent?: TuiAgent } diff --git a/src/main/runtime/rpc/methods/projects/repo-search-ref-projection.ts b/src/main/runtime/rpc/methods/projects/repo-search-ref-projection.ts index fe568e137fe..a4149e92126 100644 --- a/src/main/runtime/rpc/methods/projects/repo-search-ref-projection.ts +++ b/src/main/runtime/rpc/methods/projects/repo-search-ref-projection.ts @@ -1,6 +1,6 @@ -import '../../../../../shared/protocol-version' +import '../../../../../shared/remote-runtime/protocol/protocol-version' import { REPO_SEARCH_QUALIFIED_REFS_RUNTIME_CAPABILITY } from '../../../../../shared/remote-runtime/protocol/worktree-runtime-capabilities' -import type { RuntimeCapability } from '../../../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../../../shared/remote-runtime/protocol/protocol-version' import type { RuntimeRepoSearchRefs } from '../../../../../shared/worktree/catalog/runtime-worktree-contracts' import { isQualifiedBaseRef } from '../../../../git/refs/resolution/base-ref-search-selector' diff --git a/src/main/runtime/rpc/methods/session-tabs/session-tab-agent-status-projection.ts b/src/main/runtime/rpc/methods/session-tabs/session-tab-agent-status-projection.ts index aa6e6641331..284c85f55ed 100644 --- a/src/main/runtime/rpc/methods/session-tabs/session-tab-agent-status-projection.ts +++ b/src/main/runtime/rpc/methods/session-tabs/session-tab-agent-status-projection.ts @@ -1,7 +1,7 @@ import { AGENT_SESSION_BOUNDARY_RUNTIME_CAPABILITY } from '../../../../../shared/agent-session/agent-session-runtime-capabilities' -import '../../../../../shared/protocol-version' +import '../../../../../shared/remote-runtime/protocol/protocol-version' import { AGENT_STATUS_RESTORED_UNCONFIRMED_RUNTIME_CAPABILITY } from '../../../../../shared/remote-runtime/protocol/session-tabs-runtime-capabilities' -import type { RuntimeCapability } from '../../../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../../../shared/remote-runtime/protocol/protocol-version' import type { RuntimeMobileSessionAgentTab } from '../../../../../shared/remote-runtime/session-graph/runtime-mobile-session-tab-contracts' import type { RuntimeMobileSessionTabsResult, diff --git a/src/main/runtime/rpc/methods/session-tabs/session-tab-browser-placement-projection.ts b/src/main/runtime/rpc/methods/session-tabs/session-tab-browser-placement-projection.ts index 38d01e0c86f..bf885cf336b 100644 --- a/src/main/runtime/rpc/methods/session-tabs/session-tab-browser-placement-projection.ts +++ b/src/main/runtime/rpc/methods/session-tabs/session-tab-browser-placement-projection.ts @@ -1,5 +1,5 @@ -import type { RuntimeCapability } from '../../../../../shared/protocol-version' -import '../../../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../../../shared/remote-runtime/protocol/protocol-version' +import '../../../../../shared/remote-runtime/protocol/protocol-version' import { BROWSER_CLIENT_HOST_RUNTIME_CAPABILITY } from '../../../../../shared/browser/runtime/browser-runtime-capabilities' import type { TabGroupLayoutNode } from '../../../../../shared/tab-types' import type { RuntimeMobileSessionClientTab } from '../../../../../shared/remote-runtime/session-graph/runtime-mobile-session-tab-contracts' diff --git a/src/main/runtime/rpc/methods/session-tabs/session-tab-close-methods.ts b/src/main/runtime/rpc/methods/session-tabs/session-tab-close-methods.ts index 3f170ff6be8..ee8bba8a943 100644 --- a/src/main/runtime/rpc/methods/session-tabs/session-tab-close-methods.ts +++ b/src/main/runtime/rpc/methods/session-tabs/session-tab-close-methods.ts @@ -1,5 +1,5 @@ import { withSpan } from '../../../../observability/tracer' -import '../../../../../shared/protocol-version' +import '../../../../../shared/remote-runtime/protocol/protocol-version' import { SESSION_TAB_CLOSE_INTENT_RUNTIME_CAPABILITY } from '../../../../../shared/remote-runtime/protocol/session-tabs-runtime-capabilities' import { defineMethod } from '../../core' import { diff --git a/src/main/runtime/rpc/methods/session-tabs/session-tabs-inventory-census-race.test.ts b/src/main/runtime/rpc/methods/session-tabs/session-tabs-inventory-census-race.test.ts index 6b6b23366c6..161671a1b18 100644 --- a/src/main/runtime/rpc/methods/session-tabs/session-tabs-inventory-census-race.test.ts +++ b/src/main/runtime/rpc/methods/session-tabs/session-tabs-inventory-census-race.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it, vi } from 'vitest' -import '../../../../../shared/protocol-version' +import '../../../../../shared/remote-runtime/protocol/protocol-version' import { SESSION_TABS_AUTHORITATIVE_INVENTORY_RUNTIME_CAPABILITY } from '../../../../../shared/remote-runtime/protocol/session-tabs-runtime-capabilities' import type { RuntimeMobileSessionTabsSnapshot, @@ -194,50 +194,6 @@ async function createRuntimeHarness(initialSnapshots: RuntimeMobileSessionTabsSn } } -function createHarness() { - const census = deferredInventory() - const emit = vi.fn<(event: unknown) => void>() - const unsubscribe = vi.fn<() => void>() - const cleanup = vi.fn<() => void>() - let changeSequence = 0 - let listener: - | ((value: RuntimeMobileSessionTabsResult, changeSequence: number) => void) - | undefined - const runtime = { - supportsAuthoritativeSessionTabsInventory: vi.fn(() => true), - listAllMobileSessionTabsInventory: vi.fn(() => census.promise), - listAllMobileSessionTabsInventoryWithChangeSequence: vi.fn(async () => { - return await census.promise - }), - onMobileSessionTabsChanged: vi.fn( - (nextListener: (value: RuntimeMobileSessionTabsResult, changeSequence: number) => void) => { - listener = nextListener - return unsubscribe - } - ), - registerSubscriptionCleanup: vi.fn((_id: string, nextCleanup: () => void) => - cleanup.mockImplementation(nextCleanup) - ), - cleanupSubscription: vi.fn() - } as unknown as OrcaRuntimeService - - return { - census, - cleanup, - context: { - runtime, - connectionId: 'conn-census-race', - requestId: 'req-census-race', - clientCapabilities: [SESSION_TABS_AUTHORITATIVE_INVENTORY_RUNTIME_CAPABILITY] - }, - emit, - deliver: (value: RuntimeMobileSessionTabsResult, sequence: number) => - listener?.(value, sequence), - publish: (value: RuntimeMobileSessionTabsResult) => listener?.(value, ++changeSequence), - unsubscribe - } -} - describe.skipIf(runningBaselineOracle)('real runtime session tabs census boundary', () => { it('replays a change between frame construction and census promise settlement', async () => { const existing = runtimeSnapshot('wt-existing', 1) @@ -413,34 +369,6 @@ describe.skipIf(runningBaselineOracle)('real runtime session tabs census boundar ]) }) - it('keeps a newer immediate change when an older coalesced callback arrives last', async () => { - const harness = await createRuntimeHarness() - const scheduled = runtimeSnapshot('wt-census-race', 1) - const immediate = runtimeSnapshot('wt-census-race', 2) - - await harness.publish([scheduled], false) - harness.atBoundary(async () => { - harness.internals.mobileSessionTabsByWorktree.set(immediate.worktree, immediate) - harness.internals.emitMobileSessionTabsSnapshot(immediate) - harness.internals.mobileSessionTabsNotifyCoalescer.flushAll() - await harness.senderFramesDelivered() - }) - harness.census.resolve(completePtyInventory()) - await harness.pending - - expect(harness.emit.mock.calls.map(([event]) => event)).toEqual([ - expect.objectContaining({ - type: 'snapshots', - snapshots: [expect.objectContaining({ snapshotVersion: scheduled.snapshotVersion })] - }), - expect.objectContaining({ - type: 'updated', - worktree: immediate.worktree, - snapshotVersion: immediate.snapshotVersion - }) - ]) - }) - it('preserves caller-only follow intent when a later shared snapshot is buffered', async () => { const runtime = new OrcaRuntimeService() await runtime.syncWindowGraph(0, { tabs: [], leaves: [], mobileSessionTabs: [] }) @@ -535,120 +463,6 @@ describe.skipIf(runningBaselineOracle)('real runtime session tabs census boundar }) describe('session tabs inventory census boundary', () => { - it('delivers a post-boundary projected-state change without a new snapshot revision', async () => { - const harness = createHarness() - const pendingTab = { - ...terminalTab('derived'), - status: 'pending-handle' as const, - terminal: null - } - const initial = snapshot(2, [pendingTab]) - const ready = snapshot(2, [terminalTab('derived')]) - const pending = subscribeSessionTabsInventory(harness.context, harness.emit) - - await Promise.resolve() - harness.census.resolve({ snapshots: [initial], authoritative: true, changeSequence: 0 }) - await pending - harness.deliver(ready, 1) - - expect(harness.emit.mock.calls.map(([event]) => event)).toEqual([ - { type: 'snapshots', snapshots: [initial], authoritative: true }, - { type: 'updated', ...ready } - ]) - }) - - it('bounds non-structural initialization churn to the latest projected state', async () => { - const harness = createHarness() - const pending = subscribeSessionTabsInventory(harness.context, harness.emit) - - await Promise.resolve() - harness.census.resolve({ snapshots: [], authoritative: true, changeSequence: 0 }) - queueMicrotask(() => { - for (let version = 1; version <= 1_000; version += 1) { - harness.publish(snapshot(version, [terminalTab('stable')])) - } - }) - await pending - - expect(harness.emit.mock.calls.map(([event]) => event)).toEqual([ - { type: 'snapshots', snapshots: [], authoritative: true }, - { type: 'updated', ...snapshot(1_000, [terminalTab('stable')]) } - ]) - }) - - it('bounds repeated follow intent to the latest caller request', async () => { - const harness = createHarness() - const pending = subscribeSessionTabsInventory(harness.context, harness.emit) - - await Promise.resolve() - harness.census.resolve({ snapshots: [], authoritative: true, changeSequence: 0 }) - queueMicrotask(() => { - for (let version = 1; version <= 1_000; version += 1) { - harness.publish({ - ...snapshot(version, [terminalTab(`followed-${version}`)]), - navigationIntent: 'follow' - }) - } - }) - await pending - - expect(harness.emit.mock.calls.map(([event]) => event)).toEqual([ - { type: 'snapshots', snapshots: [], authoritative: true }, - { - type: 'updated', - ...snapshot(1_000, [terminalTab('followed-1000')]), - navigationIntent: 'follow' - } - ]) - }) - - it('restarts the census when structural churn fills the bounded buffer', async () => { - const firstCensus = deferredInventory() - const secondCensus = deferredInventory() - const emit = vi.fn<(event: unknown) => void>() - let listener: - | ((value: RuntimeMobileSessionTabsResult, changeSequence: number) => void) - | undefined - const collect = vi - .fn() - .mockImplementationOnce(() => firstCensus.promise) - .mockImplementationOnce(() => secondCensus.promise) - const runtime = { - supportsAuthoritativeSessionTabsInventory: vi.fn(() => true), - listAllMobileSessionTabsInventoryWithChangeSequence: collect, - onMobileSessionTabsChanged: vi.fn( - (nextListener: (value: RuntimeMobileSessionTabsResult, sequence: number) => void) => { - listener = nextListener - return vi.fn() - } - ), - registerSubscriptionCleanup: vi.fn(), - cleanupSubscription: vi.fn() - } as unknown as OrcaRuntimeService - const pending = subscribeSessionTabsInventory( - { - runtime, - connectionId: 'conn-structural-churn', - requestId: 'req-structural-churn' - }, - emit - ) - - await Promise.resolve() - for (let sequence = 1; sequence <= 300; sequence += 1) { - listener?.(snapshot(sequence, sequence % 2 === 0 ? [terminalTab('stable')] : []), sequence) - } - firstCensus.resolve({ snapshots: [], authoritative: true, changeSequence: 0 }) - await vi.waitFor(() => expect(collect).toHaveBeenCalledTimes(2)) - const settled = snapshot(300, [terminalTab('stable')]) - secondCensus.resolve({ snapshots: [settled], authoritative: true, changeSequence: 300 }) - await pending - - expect(emit.mock.calls.map(([event]) => event)).toEqual([ - { type: 'snapshots', snapshots: [settled] } - ]) - }) - it('fails before publication after repeated structural buffer overflow', async () => { const censuses = [deferredInventory(), deferredInventory(), deferredInventory()] const emit = vi.fn<(event: unknown) => void>() diff --git a/src/main/runtime/rpc/methods/session-tabs/session-tabs-inventory.ts b/src/main/runtime/rpc/methods/session-tabs/session-tabs-inventory.ts index 11c9c361f18..caf6e8f6f0f 100644 --- a/src/main/runtime/rpc/methods/session-tabs/session-tabs-inventory.ts +++ b/src/main/runtime/rpc/methods/session-tabs/session-tabs-inventory.ts @@ -6,7 +6,7 @@ import { } from './session-tabs-inventory-collection' export { listSessionTabsInventory } from './session-tabs-inventory-collection' import { isDeepStrictEqual } from 'node:util' -import '../../../../../shared/protocol-version' +import '../../../../../shared/remote-runtime/protocol/protocol-version' import type { RuntimeMobileSessionTabsResult } from '../../../../../shared/remote-runtime/session-graph/runtime-session-contracts' import type { RpcContext } from '../../core' import { createSessionTabsStreamDelta } from './session-tabs-sender-delta' diff --git a/src/main/runtime/rpc/methods/session-tabs/session-tabs-retirement-proof-delta.test.ts b/src/main/runtime/rpc/methods/session-tabs/session-tabs-retirement-proof-delta.test.ts index cfe8c298f1d..1eac4eb13df 100644 --- a/src/main/runtime/rpc/methods/session-tabs/session-tabs-retirement-proof-delta.test.ts +++ b/src/main/runtime/rpc/methods/session-tabs/session-tabs-retirement-proof-delta.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it, vi } from 'vitest' import type { OrcaRuntimeService } from '../../../orca-runtime' -import '../../../../../shared/protocol-version' +import '../../../../../shared/remote-runtime/protocol/protocol-version' import { SESSION_TABS_RETIREMENT_PROOF_DELTA_RUNTIME_CAPABILITY } from '../../../../../shared/remote-runtime/protocol/session-tabs-runtime-capabilities' import type { RuntimeMobileSessionRetiredTerminalSurface, diff --git a/src/main/runtime/rpc/methods/session-tabs/session-tabs-retirement-proof-delta.ts b/src/main/runtime/rpc/methods/session-tabs/session-tabs-retirement-proof-delta.ts index f3b78941ed6..d2c0e673024 100644 --- a/src/main/runtime/rpc/methods/session-tabs/session-tabs-retirement-proof-delta.ts +++ b/src/main/runtime/rpc/methods/session-tabs/session-tabs-retirement-proof-delta.ts @@ -1,6 +1,6 @@ -import '../../../../../shared/protocol-version' +import '../../../../../shared/remote-runtime/protocol/protocol-version' import { SESSION_TABS_RETIREMENT_PROOF_DELTA_RUNTIME_CAPABILITY } from '../../../../../shared/remote-runtime/protocol/session-tabs-runtime-capabilities' -import type { RuntimeCapability } from '../../../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../../../shared/remote-runtime/protocol/protocol-version' import type { RuntimeMobileSessionRetiredTerminalSurface } from '../../../../../shared/remote-runtime/session-graph/runtime-session-contracts' import { retirementProofKey as proofKey } from '../../../../../shared/workspace-layout/terminal-surfaces/terminal-retirement-proof-ledger' diff --git a/src/main/runtime/rpc/methods/session-tabs/session-tabs-sender-delta.ts b/src/main/runtime/rpc/methods/session-tabs/session-tabs-sender-delta.ts index 5a92069a0c3..d813b394b3d 100644 --- a/src/main/runtime/rpc/methods/session-tabs/session-tabs-sender-delta.ts +++ b/src/main/runtime/rpc/methods/session-tabs/session-tabs-sender-delta.ts @@ -1,4 +1,4 @@ -import type { RuntimeCapability } from '../../../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../../../shared/remote-runtime/protocol/protocol-version' import { createSessionTabsRetirementProofDelta } from './session-tabs-retirement-proof-delta' import type { AgentSenderPublication } from '../../../../../shared/orchestration/mailbox/agent-sender-associations' import type { RuntimeMobileSessionRetiredTerminalSurface } from '../../../../../shared/remote-runtime/session-graph/runtime-session-contracts' diff --git a/src/main/runtime/rpc/methods/session-tabs/session-tabs-tab-delta-stream.test.ts b/src/main/runtime/rpc/methods/session-tabs/session-tabs-tab-delta-stream.test.ts index ba5f6885e7c..0767b71fe8a 100644 --- a/src/main/runtime/rpc/methods/session-tabs/session-tabs-tab-delta-stream.test.ts +++ b/src/main/runtime/rpc/methods/session-tabs/session-tabs-tab-delta-stream.test.ts @@ -3,7 +3,7 @@ import { RUNTIME_CLIENT_CAPABILITY_METHODS } from '../client-events/runtime-clie import { visibleSnapshot } from './session-tabs-snapshot.test-fixture' import { describe, expect, it, vi } from 'vitest' import type { OrcaRuntimeService } from '../../../orca-runtime' -import '../../../../../shared/protocol-version' +import '../../../../../shared/remote-runtime/protocol/protocol-version' import { SESSION_TABS_RETIREMENT_PROOF_DELTA_RUNTIME_CAPABILITY, SESSION_TABS_TAB_DELTA_RUNTIME_CAPABILITY diff --git a/src/main/runtime/rpc/methods/session-tabs/session-tabs.ts b/src/main/runtime/rpc/methods/session-tabs/session-tabs.ts index 43566a00312..b7e9edb88e5 100644 --- a/src/main/runtime/rpc/methods/session-tabs/session-tabs.ts +++ b/src/main/runtime/rpc/methods/session-tabs/session-tabs.ts @@ -20,7 +20,7 @@ import { SESSION_TAB_MUTATION_METHODS } from './session-tab-mutation-methods' import { createSessionTabsStreamDelta } from './session-tabs-sender-delta' import { prepareStructuredTabsIfSupported } from './structured-session-tab-restore' import { assertLegacyAiVaultResumeCommandAllowed } from '../../../../ai-vault/structured-sessions/structured-session-ownership' -import '../../../../../shared/protocol-version' +import '../../../../../shared/remote-runtime/protocol/protocol-version' import { SESSION_TABS_SPLIT_GROUP_PLACEMENT_RUNTIME_CAPABILITY } from '../../../../../shared/remote-runtime/protocol/session-tabs-runtime-capabilities' import { createSessionTabsTabDeltaEncoder } from '../../../../../shared/session-tabs-tab-delta' import { diff --git a/src/main/runtime/rpc/methods/skills/skills.ts b/src/main/runtime/rpc/methods/skills/skills.ts index ecbf1f010bc..496656ed146 100644 --- a/src/main/runtime/rpc/methods/skills/skills.ts +++ b/src/main/runtime/rpc/methods/skills/skills.ts @@ -1,6 +1,6 @@ import { defineMethod } from '../../core' import type { z } from 'zod' -import { getAppEnvironment } from '../../../../../shared/app-environment' +import { getAppEnvironment } from '../../../../../shared/app-lifecycle/app-environment' import { SkillDeleteRequestSchema } from '../../../../../shared/skills/deletion/skill-delete-contract' import { BundledSkillAutoUpdateRequestSchema, diff --git a/src/main/runtime/rpc/methods/structured-sessions/structured-agent-session-policy.ts b/src/main/runtime/rpc/methods/structured-sessions/structured-agent-session-policy.ts index 48111d90c3b..124a10119bc 100644 --- a/src/main/runtime/rpc/methods/structured-sessions/structured-agent-session-policy.ts +++ b/src/main/runtime/rpc/methods/structured-sessions/structured-agent-session-policy.ts @@ -8,7 +8,7 @@ import { STRUCTURED_AGENT_SESSION_CLIENT_LAUNCH_MODE_CAPABILITY, STRUCTURED_AGENT_SESSION_RUNTIME_CAPABILITY } from '../../../../../shared/agent-session/agent-session-runtime-capabilities' -import type { RuntimeCapability } from '../../../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../../../shared/remote-runtime/protocol/protocol-version' import { AGENT_SESSION_OPTIONAL_MODEL_CLIENT_CAPABILITY } from '../../../../../shared/agent-session/options/protocol/agent-session-optional-model-capability' import { nativeChatPreferenceFor } from '../../../../../shared/agent-launch/choices/structured-native-chat-launch-route' import { isAgentSessionHandleProvider } from '../../../../../shared/agent-session/lifecycle/provider-handles/agent-session-provider-handle' diff --git a/src/main/runtime/rpc/methods/structured-sessions/structured-codex-session-rpc-test-harness.ts b/src/main/runtime/rpc/methods/structured-sessions/structured-codex-session-rpc-test-harness.ts index 686a95d05dc..89232d3b39d 100644 --- a/src/main/runtime/rpc/methods/structured-sessions/structured-codex-session-rpc-test-harness.ts +++ b/src/main/runtime/rpc/methods/structured-sessions/structured-codex-session-rpc-test-harness.ts @@ -15,7 +15,7 @@ import { AGENT_SESSION_PENDING_SEND_RESULT_RUNTIME_CAPABILITY, STRUCTURED_AGENT_SESSION_RUNTIME_CAPABILITY } from '../../../../../shared/agent-session/agent-session-runtime-capabilities' -import type { RuntimeCapability } from '../../../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../../../shared/remote-runtime/protocol/protocol-version' import { attachFingerprintFields } from '../../../../native-chat/agent-session-wire/acquisition/structured-agent-session-attach' import type { OrcaRuntimeService } from '../../../orca-runtime' import type { RpcRequest, RpcResponse } from '../../core' diff --git a/src/main/runtime/rpc/methods/workspace-layout/workspace-layout-apply.test.ts b/src/main/runtime/rpc/methods/workspace-layout/workspace-layout-apply.test.ts deleted file mode 100644 index 0af8a730d3b..00000000000 --- a/src/main/runtime/rpc/methods/workspace-layout/workspace-layout-apply.test.ts +++ /dev/null @@ -1,106 +0,0 @@ -import '../../../../../shared/protocol-version' -import '../../../../../shared/workspace-layout/published-layout/layout-intents-capability' -import { afterEach, describe, expect, it, vi } from 'vitest' - -import type { WorkspaceSessionState } from '../../../../../shared/workspace-session/workspace-session-state-types' - -import type { ExecutionHostId } from '../../../../../shared/execution-host' - -import type { LayoutApplyOutcome } from '../../../../../shared/workspace-layout/workspace-layout-command-types' - -import '../../../../../shared/workspace-layout/client-views/workspace-layout-client-visibility' -import '../../server/runtime-rpc-mobile-method-allowlist' -import { OrcaRuntimeService } from '../../../orca-runtime' - -import '../../core' -import './workspace-layout' -import '../rpc-method-registry' -import { - partialRuntimeStore, - type PartialRuntimeStore -} from '../../../orca-runtime-tests/runtime-store-partial-fixture' - -// Pin a window-owned build even under `ORCA_LAYOUT_OWNER=main`, so the default registry omits layout commands. -vi.mock('../../../../../shared/layout-owner-switch', () => ({ ORCA_LAYOUT_OWNER_IS_MAIN: false })) - -const frozen = vi.hoisted(() => ({ workspaces: new Set() })) -vi.mock( - '../../../../persistence/moving-wsl-projects/quiescence/wsl-move-scope-guard', - async (importOriginal) => ({ - ...(await importOriginal()), - isWslMoveWorkspaceSessionFrozen: (workspace: string) => frozen.workspaces.has(workspace) - }) -) - -const WORKTREE = 'repo-1::/work/one' -const SPLIT = { - type: 'splitPane', - workspace: WORKTREE, - tabId: 'tab-1', - leafId: 'leaf-1', - direction: 'vertical' -} as const - -function sessionListing(tabId: string): WorkspaceSessionState { - return { - activeRepoId: null, - activeWorktreeId: WORKTREE, - activeTabId: tabId, - tabsByWorktree: { - [WORKTREE]: [ - { - id: tabId, - ptyId: null, - worktreeId: WORKTREE, - title: 'Terminal', - customTitle: null, - color: null, - sortOrder: 0, - createdAt: 1 - } - ] - }, - terminalLayoutsByTabId: {} - } -} - -afterEach(() => { - frozen.workspaces.clear() -}) - -describe('layout.apply', () => { - it('names the stream position of the frame its write produced, sent before the reply', async () => { - let session = sessionListing('tab-1') - const written = new Set<(hostId: ExecutionHostId | null) => void>() - const order: string[] = [] - const store: PartialRuntimeStore = { - getRepo: () => undefined, - getWorkspaceSessionHostIds: () => ['local'], - getWorkspaceSession: () => session, - onWorkspaceSessionWritten: (listener: (hostId: ExecutionHostId | null) => void) => { - written.add(listener) - return () => written.delete(listener) - }, - applyLayoutCommand: vi.fn(async (): Promise => { - session = { ...session, activeTabId: null, tabsByWorktree: {} } - written.forEach((listener) => listener('local')) - return { ok: true, result: { leafId: 'minted' } } - }) - } - const runtime = new OrcaRuntimeService(partialRuntimeStore(store)) - const sent: number[] = [] - const { seq } = runtime.subscribeWorkspaceLayouts((event) => { - order.push('frame') - sent.push(event.seq!) - }) - - const reply = await runtime.applyLayoutCommand(SPLIT).then((value) => { - order.push('reply') - return value - }) - - expect(sent).toEqual([seq + 1]) - expect(reply.frameSeq).toBe(seq + 1) - expect(order).toEqual(['frame', 'reply']) - }) -}) diff --git a/src/main/runtime/rpc/methods/workspace-layout/workspace-layout.ts b/src/main/runtime/rpc/methods/workspace-layout/workspace-layout.ts index 89ac1a7d7bf..f56744c28f1 100644 --- a/src/main/runtime/rpc/methods/workspace-layout/workspace-layout.ts +++ b/src/main/runtime/rpc/methods/workspace-layout/workspace-layout.ts @@ -14,7 +14,7 @@ import { import { LayoutReopenHeldPanesParams } from '../../../../../shared/rpc-contract/workspace-layout/workspace-layout-held-panes-params' import type { WorkspaceLayoutStreamFrame } from '../../../../../shared/workspace-layout/published-layout/workspace-layout-stream-frames' import { defineMethod, defineStreamingMethod } from '../../core' -import { getAppEnvironment } from '../../../../../shared/app-environment' +import { getAppEnvironment } from '../../../../../shared/app-lifecycle/app-environment' import { listEnvironments } from '../../../../../shared/remote-runtime/host-store/runtime-environment-store' let layoutSubscriptionSeq = 0 diff --git a/src/main/runtime/rpc/methods/workspaces/worktree-catalog-snapshot-method.test.ts b/src/main/runtime/rpc/methods/workspaces/worktree-catalog-snapshot-method.test.ts index b30266efacd..dab1e4a4054 100644 --- a/src/main/runtime/rpc/methods/workspaces/worktree-catalog-snapshot-method.test.ts +++ b/src/main/runtime/rpc/methods/workspaces/worktree-catalog-snapshot-method.test.ts @@ -2,7 +2,7 @@ import { describe, expect, it, vi } from 'vitest' import type { OrcaRuntimeService } from '../../../orca-runtime' import { RpcDispatcher } from '../../dispatcher' import { WORKTREE_METHODS } from './worktree' -import '../../../../../shared/protocol-version' +import '../../../../../shared/remote-runtime/protocol/protocol-version' import '../../../../../shared/remote-runtime/protocol/worktree-runtime-capabilities' import type { RuntimeWorktreePsResult, @@ -103,22 +103,4 @@ describe('worktree.ps row deltas', () => { ]) expect(delta).not.toHaveProperty('worktrees') }) - - it('answers a full catalog to callers that did not opt in or hold an unknown base', async () => { - const dispatcher = new RpcDispatcher({ - runtime: runtimeReturning(catalog(a), catalog(a, b), catalog(a, b, c)), - methods: WORKTREE_METHODS - }) - const base = await poll(dispatcher, { limit: 10_000, afterSnapshotId: null }) - - const optedOut = await poll(dispatcher, { limit: 10_000, afterSnapshotId: base.snapshotId }) - const unknownBase = await poll(dispatcher, { - limit: 10_000, - afterSnapshotId: 'evicted', - acceptRowDelta: true - }) - - expect(optedOut.worktrees).toHaveLength(2) - expect(unknownBase.worktrees).toHaveLength(3) - }) }) diff --git a/src/main/runtime/rpc/methods/workspaces/worktree-rm-cli.integration.test.ts b/src/main/runtime/rpc/methods/workspaces/worktree-rm-cli.integration.test.ts index 238642b14e5..e733e7e9345 100644 --- a/src/main/runtime/rpc/methods/workspaces/worktree-rm-cli.integration.test.ts +++ b/src/main/runtime/rpc/methods/workspaces/worktree-rm-cli.integration.test.ts @@ -15,7 +15,7 @@ import type { WorktreeMeta } from '../../../../../shared/worktree/meta-types' import type { Repo } from '../../../../../shared/repository/repo-types' import type { HostWorktreeTarget } from '../../../../../shared/worktree/host-qualified-identity' -import * as appEnvironment from '../../../../../shared/app-environment' +import * as appEnvironment from '../../../../../shared/app-lifecycle/app-environment' import type { SshTarget } from '../../../../../shared/remote-runtime/ssh/ssh-types' import { getRuntimeMetadataPath } from '../../../../../shared/remote-runtime/bootstrap/runtime-bootstrap' diff --git a/src/main/runtime/rpc/methods/workspaces/worktree-runtime-routing.test.ts b/src/main/runtime/rpc/methods/workspaces/worktree-runtime-routing.test.ts index fdabeb8abf3..26ea12540a0 100644 --- a/src/main/runtime/rpc/methods/workspaces/worktree-runtime-routing.test.ts +++ b/src/main/runtime/rpc/methods/workspaces/worktree-runtime-routing.test.ts @@ -4,54 +4,10 @@ import { RpcDispatcher } from '../../dispatcher' import type { RpcRequest } from '../../core' import type { OrcaRuntimeService } from '../../../orca-runtime' import { WORKTREE_METHODS } from './worktree' -import '../../../../../shared/protocol-version' +import '../../../../../shared/remote-runtime/protocol/protocol-version' import '../../../../../shared/remote-runtime/protocol/worktree-runtime-capabilities' -import '../../../../../shared/electron-remote-runtime-client-capabilities' - -describe('worktree explicit acknowledgement RPC', () => { - it.each([false, true])( - 'publishes a captured read only after metadata succeeds: %s', - async (fails) => { - const acknowledgement = { - reads: [{ sessionId: 'session-1', observedCursor: { epoch: 'journal-1', sequence: 5 } }] - } - const publish = vi.fn() - let captured = false - // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the fixture supplies every runtime method this request reaches. - const runtime = { - getRuntimeId: () => 'test-runtime', - prepareWorkspaceAttentionAcknowledgement: async () => { - captured = true - return acknowledgement - }, - updateManagedWorktreeMeta: async () => { - expect(captured).toBe(true) - expect(publish).not.toHaveBeenCalled() - if (fails) { - throw new Error('metadata write failed') - } - return { id: 'wt-1' } - }, - acknowledgeNotificationAttention: publish - } as unknown as OrcaRuntimeService - - const response = await new RpcDispatcher({ runtime, methods: WORKTREE_METHODS }).dispatch({ - id: 'req-read', - authToken: 'tok', - method: 'worktree.set', - params: { worktree: 'id:wt-1', isUnread: false, acknowledgeAttention: true } - }) - - expect(response).toMatchObject({ ok: !fails }) - if (fails) { - expect(publish).not.toHaveBeenCalled() - } else { - expect(publish).toHaveBeenCalledExactlyOnceWith(acknowledgement) - } - } - ) -}) +import '../../../../../shared/remote-runtime/protocol/electron-remote-runtime-client-capabilities' describe('worktree.rm host qualification', () => { function makeRuntime(repoHostIds: (string | undefined)[] = ['local']): OrcaRuntimeService { diff --git a/src/main/runtime/rpc/mobile/e2ee/mobile-e2ee-v2-compressed-frame.ts b/src/main/runtime/rpc/mobile/e2ee/mobile-e2ee-v2-compressed-frame.ts index 55095361f6a..1a37b6d67cd 100644 --- a/src/main/runtime/rpc/mobile/e2ee/mobile-e2ee-v2-compressed-frame.ts +++ b/src/main/runtime/rpc/mobile/e2ee/mobile-e2ee-v2-compressed-frame.ts @@ -5,7 +5,7 @@ import { compressedFramesDisabled, encodeCompressedFrame } from '../../../../../shared/remote-runtime/e2ee/paired-e2ee-compressed-frame' -import type { RuntimeCapability } from '../../../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../../../shared/remote-runtime/protocol/protocol-version' import type { DesktopMobileE2EEV2OutboundItem } from './mobile-e2ee-v2-desktop-outbound' import type { RpcBinarySendOptions } from '../../transports/rpc-binary-sender' diff --git a/src/main/runtime/rpc/mobile/mobile-socket-wiring.ts b/src/main/runtime/rpc/mobile/mobile-socket-wiring.ts index 2d506891c55..edf30340c71 100644 --- a/src/main/runtime/rpc/mobile/mobile-socket-wiring.ts +++ b/src/main/runtime/rpc/mobile/mobile-socket-wiring.ts @@ -9,7 +9,7 @@ import type { E2EEKeypair } from '../server/pairing/e2ee-keypair' import { E2EEChannel } from './e2ee/e2ee-channel' import type { E2EEAuthenticatedDevice } from '../server/mobile-e2ee-authenticated-device' import { createMobileE2EEOutboundMemoryBudget } from './e2ee/mobile-e2ee-outbound-memory-budget' -import type { RuntimeCapability } from '../../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../../shared/remote-runtime/protocol/protocol-version' import type { RpcBinarySender } from '../transports/rpc-binary-sender' import type { NetworkSourceClass } from '../transports/websocket/source-admission/network-source-class' diff --git a/src/main/runtime/rpc/server/runtime-rpc-test-harness.ts b/src/main/runtime/rpc/server/runtime-rpc-test-harness.ts index 8f5aee91f0f..637becc91a4 100644 --- a/src/main/runtime/rpc/server/runtime-rpc-test-harness.ts +++ b/src/main/runtime/rpc/server/runtime-rpc-test-harness.ts @@ -1,6 +1,6 @@ import { createConnection, type Socket } from 'node:net' import type { OrchestrationDb } from '../../orchestration/db/orchestration-db' -import '../../../../shared/protocol-version' +import '../../../../shared/remote-runtime/protocol/protocol-version' import { ORCHESTRATION_CONTRACT_VERSION } from '../../../../shared/orchestration/orchestration-runtime-capabilities' import { createRootDispatch } from '../../orchestration/db/root-dispatch-test-fixture' diff --git a/src/main/runtime/rpc/transports/websocket/static-web-client-handler.ts b/src/main/runtime/rpc/transports/websocket/static-web-client-handler.ts index 5b189ac4ca7..97a3f84f46e 100644 --- a/src/main/runtime/rpc/transports/websocket/static-web-client-handler.ts +++ b/src/main/runtime/rpc/transports/websocket/static-web-client-handler.ts @@ -2,7 +2,7 @@ import { createReadStream } from 'node:fs' import { stat } from 'node:fs/promises' import type { IncomingMessage, RequestListener, ServerResponse } from 'node:http' import { basename, extname, isAbsolute, posix, relative, resolve } from 'node:path' -import { readBundledWebClientFiles } from '../../../../../shared/bundled-web-client-manifest' +import { readBundledWebClientFiles } from '../../../../../shared/web-client/bundled-web-client-manifest' const STATIC_WEB_ALLOWED_PATHS = new Set(['/web-index.html']) const STATIC_WEB_ALLOWED_PREFIXES = ['/assets/', '/cmaps/', '/standard_fonts/', '/wasm/'] diff --git a/src/main/runtime/session-lifecycle/projection/orca-runtime-mobile-markdown-tab-routes.test.ts b/src/main/runtime/session-lifecycle/projection/orca-runtime-mobile-markdown-tab-routes.test.ts index 9768b28d760..3a2eae8e353 100644 --- a/src/main/runtime/session-lifecycle/projection/orca-runtime-mobile-markdown-tab-routes.test.ts +++ b/src/main/runtime/session-lifecycle/projection/orca-runtime-mobile-markdown-tab-routes.test.ts @@ -9,7 +9,7 @@ import type { ExecutionHostId } from '../../../../shared/execution-host' import { hashMarkdownContent } from '../../../../shared/mobile-markdown-document' import type { RuntimeMobileSessionMarkdownTab } from '../../../../shared/remote-runtime/session-graph/runtime-mobile-session-tab-contracts' import '../../../../shared/remote-runtime/remote-runtime-client-error' -import '../../../../shared/protocol-version' +import '../../../../shared/remote-runtime/protocol/protocol-version' import { FILE_MUTATION_OWNERSHIP_RUNTIME_CAPABILITY } from '../../../../shared/file-access/files-runtime-capabilities' import { FILE_WRITE_DISK_PRECONDITION_RUNTIME_CAPABILITY, diff --git a/src/main/runtime/session-lifecycle/projection/restored-pane-materialize.ts b/src/main/runtime/session-lifecycle/projection/restored-pane-materialize.ts index 84da6199ba7..81845badef9 100644 --- a/src/main/runtime/session-lifecycle/projection/restored-pane-materialize.ts +++ b/src/main/runtime/session-lifecycle/projection/restored-pane-materialize.ts @@ -25,7 +25,7 @@ import { } from '../../terminal/recovery/restored-pane-start' import { isPublishedHeld, reopenHeldPanes } from '../../terminal/recovery/held-pane-reopen' import { reopenNewerDaemonTerminals } from '../../../daemon/providers/routing/daemon-newer-protocol-hold' -import type { NewerDaemonReopenResult } from '../../../../shared/newer-daemon-hold' +import type { NewerDaemonReopenResult } from '../../../../shared/terminal/daemon/newer-daemon-hold' import type { WorkspaceLayoutStream } from '../../terminal/surface/workspace-layout-stream' import { getDaemonHistoryDir } from '../../../daemon/launch/daemon-launch-paths' import { HistoryReader } from '../../../daemon/history/restoration/history-reader' diff --git a/src/main/runtime/session-tabs/structured-workspace-authority.ts b/src/main/runtime/session-tabs/structured-workspace-authority.ts index 8ce677a0d5d..9c58b9f5622 100644 --- a/src/main/runtime/session-tabs/structured-workspace-authority.ts +++ b/src/main/runtime/session-tabs/structured-workspace-authority.ts @@ -18,7 +18,7 @@ import { splitWorktreeIdForFilesystem } from '../../../shared/worktree/id' import { beginWatcherInstall } from '../../workspaces/removal/watcher-removal-gate' import { areWorktreePathsEqual } from '../../git/worktrees/catalog/worktree-path-comparison' import { resolveFloatingWorkspacePath } from '../../persistence/restoring-sessions/floating-workspace-normalization' -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { resolveLocalProjectRuntimeForRepo } from '../../workspaces/execution-host/local-project-runtime-resolution' import { localWorktreePathPresence } from '../../workspaces/catalog/local-worktree-path-presence' import { 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 1979902ea1c..afc9686f243 100644 --- a/src/main/runtime/sidebar-inputs/orca-runtime-sidebar-temporal.ts +++ b/src/main/runtime/sidebar-inputs/orca-runtime-sidebar-temporal.ts @@ -22,7 +22,7 @@ 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/worktree/metadata/workspace-unread-raise-capability' -import type { RuntimeCapability } from '../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../shared/remote-runtime/protocol/protocol-version' import { TerminalUseProducer } from './temporal/terminal-use-producer' import { parseWorkspaceKey } from '../../../shared/workspace/identity/workspace-scope' import { getRepoIdFromWorktreeId, worktreeIdentityKey } from '../../../shared/worktree/id' diff --git a/src/main/runtime/sidebar-inputs/workspace-rows/paired-server-rows-producer.test.ts b/src/main/runtime/sidebar-inputs/workspace-rows/paired-server-rows-producer.test.ts index 631216fa2f1..2b3003c6881 100644 --- a/src/main/runtime/sidebar-inputs/workspace-rows/paired-server-rows-producer.test.ts +++ b/src/main/runtime/sidebar-inputs/workspace-rows/paired-server-rows-producer.test.ts @@ -1,15 +1,5 @@ -import '../../../../shared/remote-runtime/host-store/environment-store-worker-test-fixture' -import { mkdtempSync, rmSync } from 'node:fs' -import { tmpdir } from 'node:os' -import { join } from 'node:path' -import { encodePairingOffer } from '../../../../shared/remote-runtime/pairing/pairing' -import { - addEnvironmentFromPairingCode, - resolveEnvironment, - updateEnvironmentFromPairingCode -} from '../../../../shared/remote-runtime/host-store/runtime-environment-store' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { RUNTIME_PROTOCOL_VERSION } from '../../../../shared/protocol-version' +import { RUNTIME_PROTOCOL_VERSION } from '../../../../shared/remote-runtime/protocol/protocol-version' import { runtimeEnvironmentStatusFromSnapshot, type RuntimeHostStatusSnapshot @@ -153,49 +143,6 @@ describe('PairedServerRowsProducer', () => { vi.useRealTimers() }) - it.each([10, 100])( - 'coalesces %i status invalidations without publishing unchanged facts', - async (count) => { - const h = fakeHosts([{ id: 'box', live: false }]) - const producer = new PairedServerRowsProducer({ - hasDemand: () => false, - hostLabelOverrides: () => new Map() - }) - const original = h.hosts.list - const list = vi.spyOn(h.hosts, 'list') - const detach = producer.attach(h.hosts) - await producer.sync() - await vi.advanceTimersByTimeAsync(0) - const before = producer.revision.value - let release!: () => void - const gate = new Promise((resolve) => { - release = resolve - }) - list.mockImplementationOnce(async () => { - await gate - return original() - }) - list.mockClear() - h.publishStatus() - for (let i = 0; i < count; i++) { - h.publishStatus() - } - release() - await vi.advanceTimersByTimeAsync(0) - expect(list.mock.calls.length).toBeLessThanOrEqual(2) - expect(producer.revision.value).toBe(before) - h.state.servers = [{ id: 'renamed', live: false }] - h.publishStatus() - await vi.advanceTimersByTimeAsync(0) - expect((await producer.snapshot()).servers.map((server) => server.host?.label)).toEqual([ - 'renamed' - ]) - expect(producer.revision.value).toBeGreaterThan(before) - detach() - list.mockRestore() - } - ) - it.each([10, 100])( 'keeps other hosts confirmed on a same-health publication across %i hosts', async (count) => { @@ -222,29 +169,6 @@ describe('PairedServerRowsProducer', () => { } ) - it('runs one more fetch for a change that lands while a fetch is in flight', async () => { - const { hosts, call, watches } = fakeHosts([{ id: 'box', live: true }]) - let answer: (response: RuntimeRpcResponse) => void = () => {} - call.mockReturnValueOnce(new Promise((resolve) => (answer = resolve))) - call.mockResolvedValueOnce(psReply([row('new')])) - const producer = new PairedServerRowsProducer({ - hasDemand: () => true, - hostLabelOverrides: () => new Map() - }) - producer.attach(hosts) - await producer.sync() - await vi.advanceTimersByTimeAsync(0) - watches.get('box')?.onChange() - watches.get('box')?.onChange() - watches.get('box')?.onChange() - answer(psReply([row('old')])) - await vi.advanceTimersByTimeAsync(0) - - expect((await rowsOf(producer, 'runtime:box'))?.rows.map((entry) => entry.worktreeId)).toEqual([ - 'new' - ]) - }) - it('keeps the last rows as unverifiable when the server loses contact or stops answering', async () => { const { hosts, call, watches, state, publishStatus } = fakeHosts([{ id: 'box', live: true }]) call.mockResolvedValueOnce(psReply([row('a')])) @@ -412,57 +336,3 @@ it('closes a delayed watch from a detached provider without resurrecting its hos detachNext() } }) - -it('publishes a fresh complete listing after a pairing changes between its store reads', async () => { - const root = mkdtempSync(join(tmpdir(), 'orca-paired-listing-')) - const code = (seed: number) => - encodePairingOffer({ - v: 2, - publicKeyB64: Buffer.alloc(32, seed).toString('base64'), - deviceToken: `synthetic-${seed}`, - endpoint: 'wss://pairing.example.com/runtime' - }) - const saved = await addEnvironmentFromPairingCode(root, { - name: 'Box', - pairingCode: code(1), - now: 100 - }) - const h = fakeHosts([{ id: saved.id, live: false }]) - const original = h.hosts.list - const producer = new PairedServerRowsProducer({ - hasDemand: () => false, - hostLabelOverrides: () => new Map() - }) - const detach = producer.attach(h.hosts) - try { - await producer.sync() - await new Promise((resolve) => setImmediate(resolve)) - const listing = async () => { - const record = await resolveEnvironment(root, saved.id) - const result = await original() - return { - ...result, - environments: result.environments.map((environment) => ({ - ...environment, - name: `Pairing ${record.pairingRevision}` - })) - } - } - vi.spyOn(h.hosts, 'list') - .mockImplementation(listing) - .mockImplementationOnce(async () => { - const stale = await listing() - await updateEnvironmentFromPairingCode(root, saved.id, { pairingCode: code(2), now: 200 }) - await resolveEnvironment(root, saved.id) - return stale - }) - const published: string[][] = [] - await producer.withPreparedSnapshot((snapshot) => { - published.push(snapshot.servers.map((server) => server.host!.label)) - }) - expect(published).toEqual([['Pairing 200']]) - } finally { - detach() - rmSync(root, { recursive: true, force: true }) - } -}) diff --git a/src/main/runtime/terminal/launch/claude-agent-teams-shim-env.ts b/src/main/runtime/terminal/launch/claude-agent-teams-shim-env.ts index 1ba43c07512..8d8ea34c82d 100644 --- a/src/main/runtime/terminal/launch/claude-agent-teams-shim-env.ts +++ b/src/main/runtime/terminal/launch/claude-agent-teams-shim-env.ts @@ -8,7 +8,10 @@ import { isDirectClaudeCommand, type ClaudeAgentTeamsMode } from '../../../../shared/agent-launch/startup/claude-agent-teams-tmux-compat' -import { getAppEnvironment, hasAppEnvironment } from '../../../../shared/app-environment' +import { + getAppEnvironment, + hasAppEnvironment +} from '../../../../shared/app-lifecycle/app-environment' import { getOrcaCliCommandNameForPlatform } from '../../../../shared/orca-cli-command-name' import { getBundledLauncherPath } from '../../../cli/packaged-assets/bundled-cli-launcher-path' import { resolvePathEnvKey } from '../../../pty/environment/windows-path-segment-merge' diff --git a/src/main/runtime/terminal/recovery/held-pane-reopen-layout-owner.test.ts b/src/main/runtime/terminal/recovery/held-pane-reopen-layout-owner.test.ts index c03e8e0bf97..55afa1114ef 100644 --- a/src/main/runtime/terminal/recovery/held-pane-reopen-layout-owner.test.ts +++ b/src/main/runtime/terminal/recovery/held-pane-reopen-layout-owner.test.ts @@ -1,6 +1,6 @@ // Reopen replaces a newer terminal service, then binds the held pane and clears its published status. import { beforeEach, describe, expect, it, vi } from 'vitest' -import { NEWER_DAEMON_HOLD_ERROR } from '../../../../shared/newer-daemon-hold' +import { NEWER_DAEMON_HOLD_ERROR } from '../../../../shared/terminal/daemon/newer-daemon-hold' import { LOCAL_EXECUTION_HOST_ID, type ExecutionHostId } from '../../../../shared/execution-host' import type * as DaemonHoldModule from '../../../daemon/providers/routing/daemon-newer-protocol-hold' import { committingSpawn } from '../../orca-runtime-tests/bind-first-pane.test-fixture' diff --git a/src/main/runtime/terminal/recovery/held-pane-reopen.ts b/src/main/runtime/terminal/recovery/held-pane-reopen.ts index e18158bdd86..67296a3d7a2 100644 --- a/src/main/runtime/terminal/recovery/held-pane-reopen.ts +++ b/src/main/runtime/terminal/recovery/held-pane-reopen.ts @@ -1,6 +1,6 @@ // For paired desktop Reopen, stop held newer services, then start still-held panes; main's frames carry the result. -import type { NewerDaemonReopenResult } from '../../../../shared/newer-daemon-hold' +import type { NewerDaemonReopenResult } from '../../../../shared/terminal/daemon/newer-daemon-hold' import type { PublishedWorkspaceLayout } from '../../../../shared/workspace-layout/published-layout/workspace-layout-published' import type { RestoredPane } from './restored-pane-start' diff --git a/src/main/runtime/terminal/surface/pane-start-statuses.ts b/src/main/runtime/terminal/surface/pane-start-statuses.ts index f716070473a..a1dbc5cca93 100644 --- a/src/main/runtime/terminal/surface/pane-start-statuses.ts +++ b/src/main/runtime/terminal/surface/pane-start-statuses.ts @@ -1,6 +1,6 @@ // Start facts are live-only and expire on a new binding; failures persist until another start unless a later bind supersedes them. -import { NEWER_DAEMON_HOLD_ERROR } from '../../../../shared/newer-daemon-hold' +import { NEWER_DAEMON_HOLD_ERROR } from '../../../../shared/terminal/daemon/newer-daemon-hold' import type { PaneResumeOutcome, PaneStartStatus, diff --git a/src/main/runtime/workspaces/persisted-surfaces/orchestration-database-binding.ts b/src/main/runtime/workspaces/persisted-surfaces/orchestration-database-binding.ts index 35cf4ef56be..bb1e0f9a6af 100644 --- a/src/main/runtime/workspaces/persisted-surfaces/orchestration-database-binding.ts +++ b/src/main/runtime/workspaces/persisted-surfaces/orchestration-database-binding.ts @@ -1,5 +1,5 @@ import { orchestrationDbFile } from '../../orchestration/db/orchestration-db-file' -import { getAppEnvironment } from '../../../../shared/app-environment' +import { getAppEnvironment } from '../../../../shared/app-lifecycle/app-environment' import { OrcaRuntimeWithPtyForegroundProcessReads } from '../../client/runtime-client-state' import { getWorkerTerminalAutoReleaseScheduler } from '../../orchestration/terminal-authority/release/worker-terminal-auto-release-scheduler' import type { OrchestrationDb } from '../../orchestration/db/orchestration-db' diff --git a/src/main/skills/runtime-transfer/skill-remote-installation.ts b/src/main/skills/runtime-transfer/skill-remote-installation.ts index 6f7075ec3ca..1105e26bfb0 100644 --- a/src/main/skills/runtime-transfer/skill-remote-installation.ts +++ b/src/main/skills/runtime-transfer/skill-remote-installation.ts @@ -1,4 +1,4 @@ -import type { RuntimeCapability } from '../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../shared/remote-runtime/protocol/protocol-version' import type { RuntimeRpcResponse } from '../../../shared/remote-runtime/rpc/runtime-rpc-envelope' import { SkillBundleInstallProgressSchema, diff --git a/src/main/speech/model-manager.ts b/src/main/speech/model-manager.ts index 91669203878..13da82801cf 100644 --- a/src/main/speech/model-manager.ts +++ b/src/main/speech/model-manager.ts @@ -14,7 +14,7 @@ import { import { SpeechModelDownloadTransport } from './speech-model-download-transport' import { hasSpeechModelFiles } from './speech-model-files' import type { OpenSpeechDownloadRequest } from './speech-model-download-response' -import { getAppEnvironment } from '../../shared/app-environment' +import { getAppEnvironment } from '../../shared/app-lifecycle/app-environment' import { removeModelDownloadStaging } from './speech-model-download-cleanup' import { previousSpeechModelDir, swapInSpeechModelDir } from './speech-model-dir-swap' diff --git a/src/main/speech/stt-worker-paths.ts b/src/main/speech/stt-worker-paths.ts index 4a860d0f770..ff94d7f36ea 100644 --- a/src/main/speech/stt-worker-paths.ts +++ b/src/main/speech/stt-worker-paths.ts @@ -1,5 +1,5 @@ import { join } from 'node:path' -import { getAppEnvironment } from '../../shared/app-environment' +import { getAppEnvironment } from '../../shared/app-lifecycle/app-environment' import { hasSpeechEnginePackage, SPEECH_RECOGNIZER_DIR_ENV diff --git a/src/main/ssh/host-server/managed-server-update-deps.ts b/src/main/ssh/host-server/managed-server-update-deps.ts index 1774201fcb8..6a9999d7957 100644 --- a/src/main/ssh/host-server/managed-server-update-deps.ts +++ b/src/main/ssh/host-server/managed-server-update-deps.ts @@ -1,4 +1,4 @@ -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import type { ManagedServerUpdateDeps } from './managed-server-update-check' import { autoUpdateManagedOrcadEnvironment } from '../../managed-server/lifecycle/orcad-managed-auto-update' import { requireManagedOrcadTargetStore } from '../../managed-server/lifecycle/orcad-managed-runtime-context' diff --git a/src/main/ssh/hostile-host-test-support/ssh-hostile-host-test-harness.ts b/src/main/ssh/hostile-host-test-support/ssh-hostile-host-test-harness.ts index 8dc97d691c2..2df9f41ccc9 100644 --- a/src/main/ssh/hostile-host-test-support/ssh-hostile-host-test-harness.ts +++ b/src/main/ssh/hostile-host-test-support/ssh-hostile-host-test-harness.ts @@ -2,7 +2,7 @@ import { mkdtempSync, readFileSync } from 'node:fs' import { tmpdir } from 'node:os' import { join } from 'node:path' -import { setAppEnvironment } from '../../../shared/app-environment' +import { setAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { removeTreeSync } from '../../../shared/file-write/windows-transient-lock-removal' import type { SshTarget } from '../../../shared/remote-runtime/ssh/ssh-types' import { SshConnection } from '../connection/ssh-connection' diff --git a/src/main/startup/cli-launch/cli-launch-redirect.ts b/src/main/startup/cli-launch/cli-launch-redirect.ts index d65041c4adf..04b3ed517a0 100644 --- a/src/main/startup/cli-launch/cli-launch-redirect.ts +++ b/src/main/startup/cli-launch/cli-launch-redirect.ts @@ -2,7 +2,7 @@ import { existsSync } from 'node:fs' import { posix, resolve, win32 } from 'node:path' import { runProcessSync } from '@orca/process-host' import { CLI_BOOLEAN_FLAGS, findCliCommandIndex } from '../../../shared/cli-argument-boundary' -import { ELECTRON_NO_SANDBOX_REQUEST_ENV } from '../../../shared/electron-no-sandbox-request' +import { ELECTRON_NO_SANDBOX_REQUEST_ENV } from '../../../shared/app-lifecycle/launch/electron-no-sandbox-request' import { CLI_COMMAND_NAMES } from './cli-command-names' import { reexecHeadlessServeOnX11IfNeeded } from '../serve-launch/headless-serve-x11-reexec' import { argvRequestsServeMode, VALUE_TAKING_FLAGS } from '../serve-launch/serve-mode-argv' diff --git a/src/main/startup/configure-process.ts b/src/main/startup/configure-process.ts index 0d3ecba0239..1c78f159086 100644 --- a/src/main/startup/configure-process.ts +++ b/src/main/startup/configure-process.ts @@ -12,7 +12,7 @@ import { DISABLED_CHROMIUM_FEATURES } from './chromium-policy/disabled-chromium- import { readHttp1CompatibilityMarker } from './network-compatibility/http1-compatibility-marker' import { checkServeUserDataPath } from './serve-launch/serve-user-data-path-guard' import { stampRuntimeSourceEnv } from '../../shared/remote-runtime/host-catalog/runtime-source-env' -import { isLinuxWaylandSession } from '../../shared/linux-wayland-session' +import { isLinuxWaylandSession } from '../../shared/app-lifecycle/launch/linux-wayland-session' import { hasMissingProfileStateDatabaseWithRetainedAuthority, readActiveProfileId, diff --git a/src/main/startup/main-process-observers.ts b/src/main/startup/main-process-observers.ts index 0f64439777c..155621f9dfc 100644 --- a/src/main/startup/main-process-observers.ts +++ b/src/main/startup/main-process-observers.ts @@ -2,7 +2,7 @@ import { BackendSupervisor } from '../backend-desktop/backend-supervisor' import { app, powerMonitor } from 'electron' import { join } from 'node:path' import { AgentAwakeService } from '../power/agent-awake-service' -import { normalizeComputerAwakeMode } from '../../shared/computer-awake-mode' +import { normalizeComputerAwakeMode } from '../../shared/app-lifecycle/computer-awake-mode' import { registerSystemResumeBroadcast } from '../power/system-resume-broadcast' import { recordWakeSignal } from '../power/wake-signal-clock' import { readDesktopAwayState } from '../notifications/desktop-away-state' diff --git a/src/main/startup/main-process-preflight-failure.ts b/src/main/startup/main-process-preflight-failure.ts index 66462e23346..7333d289aca 100644 --- a/src/main/startup/main-process-preflight-failure.ts +++ b/src/main/startup/main-process-preflight-failure.ts @@ -3,7 +3,7 @@ import { prepareEarlyMainUiLanguage, translateMain } from '../i18n/main-i18n' import { formatProfileStateStartupFailure } from '../persistence/profile-state/startup/profile-state-startup-failure' import { isBackgroundLaunch } from '../window/activation/foreground-activation-policy' import { mainProcessState as state } from './main-process-state' -import { SINGLE_INSTANCE_ALREADY_RUNNING_EXIT_CODE } from '../../shared/single-instance-exit-code' +import { SINGLE_INSTANCE_ALREADY_RUNNING_EXIT_CODE } from '../../shared/app-lifecycle/launch/single-instance-exit-code' import { acquireDesktopProfileInstanceLock } from './profile-startup/desktop-profile-instance-lock' /** False when orcad holds the profile; unlike a second desktop, nothing else would say why. */ diff --git a/src/main/startup/main-process-preflight.ts b/src/main/startup/main-process-preflight.ts index ce45f998488..bd39b6a9ae9 100644 --- a/src/main/startup/main-process-preflight.ts +++ b/src/main/startup/main-process-preflight.ts @@ -62,8 +62,8 @@ import { logSingleInstanceLockBypass, logSingleInstanceLockFailure } from './profile-startup/single-instance-lock' -import { SINGLE_INSTANCE_ALREADY_RUNNING_EXIT_CODE } from '../../shared/single-instance-exit-code' -import { setAppEnvironment } from '../../shared/app-environment' +import { SINGLE_INSTANCE_ALREADY_RUNNING_EXIT_CODE } from '../../shared/app-lifecycle/launch/single-instance-exit-code' +import { setAppEnvironment } from '../../shared/app-lifecycle/app-environment' import { ElectronAppEnvironment } from '../host/electron-app-environment' import { installMainProcessTreeKillGate } from '../pty/process-retirement/own-chromium-tree-kill-guard' import { setSecretStore } from '../../shared/secure-storage/secret-store' diff --git a/src/main/startup/main-process-ready-foundation.ts b/src/main/startup/main-process-ready-foundation.ts index 33a6011ebdd..99f1a200e7f 100644 --- a/src/main/startup/main-process-ready-foundation.ts +++ b/src/main/startup/main-process-ready-foundation.ts @@ -14,7 +14,7 @@ import { import { browserSiteDisplayController } from '../browser/site-settings/display/browser-site-display-controller' import { ensureActiveOrcaProfile } from '../orca-profiles/profile-index-store' import { getCanonicalUserDataPath } from '../persistence/loading-store/user-data-path' -import { getAppEnvironment } from '../../shared/app-environment' +import { getAppEnvironment } from '../../shared/app-lifecycle/app-environment' import { loadWslMoveFence } from '../persistence/moving-wsl-projects/quiescence/wsl-move-scope-guard' import { startWslMoveStartup } from '../persistence/moving-wsl-projects/startup/wsl-move-startup' import { startWslHostsPolicyLiveUpdates } from '../wsl/host-lifecycle/wsl-hosts-policy-live-update' diff --git a/src/main/startup/main-window/main-window-actions.ts b/src/main/startup/main-window/main-window-actions.ts index 0e98ebcba58..57be462c046 100644 --- a/src/main/startup/main-window/main-window-actions.ts +++ b/src/main/startup/main-window/main-window-actions.ts @@ -9,7 +9,7 @@ import { type WebContents } from 'electron' import { isNativeBrowserPopupWindow } from '../../browser/guest-lifecycle/popups/presentation/native-browser-popup-windows' -import type { UpdateCheckOptions } from '../../../shared/update-status-types' +import type { UpdateCheckOptions } from '../../../shared/updater/update-status-types' import type { AppMenuQuitHandlers } from '../../menu/app-menu-quit-item' import type { createWebContentsTimedFlag } from './web-contents-timed-flag' import { recordCrashBreadcrumb } from '../../crash-reporting/breadcrumbs/crash-breadcrumb-store' diff --git a/src/main/startup/main-window/main-window-controller.ts b/src/main/startup/main-window/main-window-controller.ts index 560856022c7..49cb19923d3 100644 --- a/src/main/startup/main-window/main-window-controller.ts +++ b/src/main/startup/main-window/main-window-controller.ts @@ -46,7 +46,7 @@ import { applyServeDesktopWindowActivationPolicy } from '../../window/activation/foreground-activation-policy' import type { MainWindowOpenOptions } from '../../window/main-window/main-window-contracts' -import { argvRequestsBackgroundOpen } from '../../../shared/background-open-argv' +import { argvRequestsBackgroundOpen } from '../../../shared/app-lifecycle/launch/background-open-argv' const TRAY_CREATE_FALLBACK_MS = 12_000 const AGENT_STATE_CRASH_BREADCRUMB_MIN_INTERVAL_MS = 30_000 diff --git a/src/main/startup/profile-startup/dev-instance-identity.ts b/src/main/startup/profile-startup/dev-instance-identity.ts index 96baec5733a..125b24133f2 100644 --- a/src/main/startup/profile-startup/dev-instance-identity.ts +++ b/src/main/startup/profile-startup/dev-instance-identity.ts @@ -1,6 +1,6 @@ import { createHash } from 'node:crypto' import path from 'node:path' -import type { AppIdentity } from '../../../shared/app-identity' +import type { AppIdentity } from '../../../shared/app-lifecycle/identity/app-identity' const BASE_APP_NAME = 'Orca' const BASE_APP_USER_MODEL_ID = 'com.stablyai.orca' diff --git a/src/main/startup/profile-startup/profile-state-recovery-preflight.test.ts b/src/main/startup/profile-startup/profile-state-recovery-preflight.test.ts index 0c0cd88d412..8dc2bd1f17b 100644 --- a/src/main/startup/profile-startup/profile-state-recovery-preflight.test.ts +++ b/src/main/startup/profile-startup/profile-state-recovery-preflight.test.ts @@ -14,7 +14,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { PROFILE_STATE_RECOVERY_FLAG, PROFILE_STATE_RECOVERY_RESULT_PREFIX -} from '../../../shared/profile-state-recovery-command' +} from '../../../shared/orca-profiles/profile-state-recovery-command' import { acquireProfileStateRuntimeAdmission } from '../../persistence/profile-state/access/profile-state-access' import { profileStateJsonExportPath } from '../../persistence/profile-state/legacy-json/profile-state-export-path' import { diff --git a/src/main/startup/profile-startup/profile-state-recovery-preflight.ts b/src/main/startup/profile-startup/profile-state-recovery-preflight.ts index 2f57764585f..46aa3104cbf 100644 --- a/src/main/startup/profile-startup/profile-state-recovery-preflight.ts +++ b/src/main/startup/profile-startup/profile-state-recovery-preflight.ts @@ -10,7 +10,7 @@ import { profileStateRecoveryRequestSchema, type ProfileStateRecoveryRequest, type ProfileStateRecoveryResponse -} from '../../../shared/profile-state-recovery-command' +} from '../../../shared/orca-profiles/profile-state-recovery-command' import { prepareEarlyMainUiLanguage, translateMain } from '../../i18n/main-i18n' import { acquireProfileStateMaintenance } from '../../persistence/profile-state/access/profile-state-access' import { rollbackProfileState } from '../../persistence/profile-state/recovery/profile-state-recovery-command' diff --git a/src/main/startup/quit/app-relaunch.ts b/src/main/startup/quit/app-relaunch.ts index 539552a568f..ea653bf8a8e 100644 --- a/src/main/startup/quit/app-relaunch.ts +++ b/src/main/startup/quit/app-relaunch.ts @@ -3,7 +3,7 @@ import type { CrashReportBreadcrumbData } from '../../../shared/crash-reporting/ import { recordDurableCrashBreadcrumb } from '../../crash-reporting/breadcrumbs/durable-crash-breadcrumb' import { runWithLaunchPath } from '../shell-environment/hydrate-shell-path' import { getWindowsAdministratorRelaunchOptions } from '../../windows/windows-administrator-restart' -import { BACKGROUND_OPEN_ARG } from '../../../shared/background-open-argv' +import { BACKGROUND_OPEN_ARG } from '../../../shared/app-lifecycle/launch/background-open-argv' export type AppRelaunchReason = | 'admin-restart' diff --git a/src/main/startup/quit/main-process-quit-pending-writer.test.ts b/src/main/startup/quit/main-process-quit-pending-writer.test.ts index a5b3442ba0e..c2127141428 100644 --- a/src/main/startup/quit/main-process-quit-pending-writer.test.ts +++ b/src/main/startup/quit/main-process-quit-pending-writer.test.ts @@ -8,7 +8,7 @@ import { createSqliteTestStore, readPersistedStateJson } from '../../persistence/persistence-test-harness' -import { WILL_QUIT_TEARDOWN_DEADLINE_MS } from '../../../shared/quit-teardown-deadline' +import { WILL_QUIT_TEARDOWN_DEADLINE_MS } from '../../../shared/app-lifecycle/shutdown/quit-teardown-deadline' const settled = () => vi.fn(async () => {}) const idle = () => vi.fn() @@ -141,18 +141,6 @@ async function startQuit( return { app, admission, store, state } } -it('quits at the teardown deadline without releasing admission while the writer is pending', async () => { - const { app, admission, store, state } = await startQuit(() => new Promise(() => {})) - await vi.advanceTimersByTimeAsync(WILL_QUIT_TEARDOWN_DEADLINE_MS - 1) - expect(app.quit).not.toHaveBeenCalled() - await vi.advanceTimersByTimeAsync(1) - expect(app.quit).toHaveBeenCalledOnce() - expect(store.flushFinalOrThrowAsync).toHaveBeenCalledOnce() - expect(store.freezeWritesAsync).not.toHaveBeenCalled() - expect(admission.release).not.toHaveBeenCalled() - expect(state.profileStateAdmission).toBe(admission) -}) - it('checkpoints pane state during a held synchronous deletion, then saves later metadata before releasing ownership', async () => { const directory = await mkdtemp(join(tmpdir(), 'orca-quit-checkpoint-')) const { Store } = await import('../../persistence/loading-store/store') diff --git a/src/main/startup/quit/quit-teardown-deadline.test.ts b/src/main/startup/quit/quit-teardown-deadline.test.ts deleted file mode 100644 index ef76d1cc0db..00000000000 --- a/src/main/startup/quit/quit-teardown-deadline.test.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { afterEach, describe, expect, it, vi } from 'vitest' -import { settleTeardownWithinDeadline } from './quit-teardown-deadline' -import { WILL_QUIT_TEARDOWN_DEADLINE_MS } from '../../../shared/quit-teardown-deadline' - -describe('settleTeardownWithinDeadline', () => { - afterEach(() => { - vi.useRealTimers() - }) - - it('resolves as soon as all teardowns settle, including rejections', async () => { - vi.useFakeTimers() - let resolved = false - const pending = settleTeardownWithinDeadline([ - { name: 'daemon', promise: Promise.resolve() }, - { name: 'runtime-rpc', promise: Promise.reject(new Error('daemon disconnect failed')) } - ]).then(() => { - resolved = true - }) - await vi.advanceTimersByTimeAsync(0) - await pending - expect(resolved).toBe(true) - expect(vi.getTimerCount()).toBe(0) - }) - - it('reports the teardowns still pending at the deadline', async () => { - vi.useFakeTimers() - const pending = settleTeardownWithinDeadline([ - { name: 'daemon', promise: Promise.resolve() }, - { name: 'runtime-rpc', promise: new Promise(() => {}) } - ]) - await vi.advanceTimersByTimeAsync(WILL_QUIT_TEARDOWN_DEADLINE_MS - 1) - let resolved = false - void pending.then(() => { - resolved = true - }) - expect(resolved).toBe(false) - await vi.advanceTimersByTimeAsync(1) - await expect(pending).resolves.toEqual(['runtime-rpc']) - expect(vi.getTimerCount()).toBe(0) - }) -}) diff --git a/src/main/startup/quit/quit-teardown-deadline.ts b/src/main/startup/quit/quit-teardown-deadline.ts index 6a93833fb0a..d90ce460956 100644 --- a/src/main/startup/quit/quit-teardown-deadline.ts +++ b/src/main/startup/quit/quit-teardown-deadline.ts @@ -1,4 +1,4 @@ -import { WILL_QUIT_TEARDOWN_DEADLINE_MS } from '../../../shared/quit-teardown-deadline' +import { WILL_QUIT_TEARDOWN_DEADLINE_MS } from '../../../shared/app-lifecycle/shutdown/quit-teardown-deadline' export type NamedQuitTeardown = { name: string diff --git a/src/main/startup/serve-launch/headless-serve-x11-reexec.ts b/src/main/startup/serve-launch/headless-serve-x11-reexec.ts index e6782cfb9d0..6fc3e83d608 100644 --- a/src/main/startup/serve-launch/headless-serve-x11-reexec.ts +++ b/src/main/startup/serve-launch/headless-serve-x11-reexec.ts @@ -2,7 +2,7 @@ import { app } from 'electron' import { HEADLESS_SERVE_OZONE_PLATFORM_SWITCH, hasExplicitOzonePlatform -} from '../../../shared/headless-serve-ozone-platform' +} from '../../../shared/app-lifecycle/launch/headless-serve-ozone-platform' export type HeadlessServeX11ReexecOptions = { isServeMode: boolean diff --git a/src/main/startup/serve-launch/main-process-serve.ts b/src/main/startup/serve-launch/main-process-serve.ts index 03e3370fa4e..f3cb1d91362 100644 --- a/src/main/startup/serve-launch/main-process-serve.ts +++ b/src/main/startup/serve-launch/main-process-serve.ts @@ -1,7 +1,7 @@ import { app } from 'electron' import { notifyServeSupervisorReady } from '../../updater/serve-update-handoff' import { clearServeAbortPark } from '../../../shared/remote-runtime/serve-supervisor/serve-abort-park' -import { findBundledWebClientRoot } from '../../../shared/bundled-web-client-root' +import { findBundledWebClientRoot } from '../../../shared/web-client/bundled-web-client-root' import { buildServePairingReadiness, servePublishMode } from '../../server/serve-pairing-readiness' import { mainProcessState as state } from '../main-process-state' import type { ServeOptions } from './serve-options' diff --git a/src/main/startup/uninstall/agent-hooks-uninstall-preflight.ts b/src/main/startup/uninstall/agent-hooks-uninstall-preflight.ts index 8ad2fe9a29f..91921d6f33e 100644 --- a/src/main/startup/uninstall/agent-hooks-uninstall-preflight.ts +++ b/src/main/startup/uninstall/agent-hooks-uninstall-preflight.ts @@ -1,6 +1,6 @@ import { app } from 'electron' import type { AgentHookInstallStatus } from '../../../shared/agent-hook-listener/configuration/agent-hook-types' -import { setAppEnvironment } from '../../../shared/app-environment' +import { setAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { ElectronAppEnvironment } from '../../host/electron-app-environment' import { ensureWindowsAppDataPath } from '../windows-startup/windows-app-data-path' diff --git a/src/main/stats/collector.ts b/src/main/stats/collector.ts index c826334e4fe..99412cb6e27 100644 --- a/src/main/stats/collector.ts +++ b/src/main/stats/collector.ts @@ -1,5 +1,5 @@ import { join } from 'node:path' -import { getAppEnvironment } from '../../shared/app-environment' +import { getAppEnvironment } from '../../shared/app-lifecycle/app-environment' import type { StatsSummary } from '../../shared/diagnostics/process-stats-types' import type { StatsEvent, StatsAggregates, StatsFile } from './types' import { loadStatsFile, STATS_SCHEMA_VERSION } from './stats-file-loader' diff --git a/src/main/telemetry/posthog-transport.ts b/src/main/telemetry/posthog-transport.ts index 58aa81b7bd0..8ff0511023b 100644 --- a/src/main/telemetry/posthog-transport.ts +++ b/src/main/telemetry/posthog-transport.ts @@ -1,6 +1,6 @@ import { arch as osArch, platform as osPlatform, release as osRelease } from 'node:os' import type * as PostHogSdk from 'posthog-node' -import { getAppEnvironment } from '../../shared/app-environment' +import { getAppEnvironment } from '../../shared/app-lifecycle/app-environment' import { getMainHttpClient } from '../network/http-client' import type { CommonProps, EventName } from '../../shared/telemetry/telemetry-event-classification' import type { ConsentState } from './consent' diff --git a/src/main/updater/lifecycle/main-window-updater.ts b/src/main/updater/lifecycle/main-window-updater.ts index c634b515e72..5ad1e82b75d 100644 --- a/src/main/updater/lifecycle/main-window-updater.ts +++ b/src/main/updater/lifecycle/main-window-updater.ts @@ -3,15 +3,15 @@ import type { BrowserWindow, IpcMainInvokeEvent } from 'electron' import type { ReleaseBuildListResult, UpdateCheckOptions -} from '../../../shared/update-status-types' -import { RELEASE_CHANNELS, type ReleaseChannel } from '../../../shared/release-channel' +} from '../../../shared/updater/update-status-types' +import { RELEASE_CHANNELS, type ReleaseChannel } from '../../../shared/updater/release-channel' import { getTrustedUIRendererWindow, isTrustedUIRenderer } from '../../ipc/ui' import type { Store } from '../../persistence/loading-store/store' import { logStartupMilestone } from '../../startup/diagnostics/startup-diagnostics' import { applyProxyToElectronUpdaterSession } from './electron-updater-proxy-session' import { updaterErrorMessage } from './updater-coded-error' -import { updaterCodedMessage } from '../../../shared/updater-failure-copy' -import { normalizeUpdateDelayDays } from '../../../shared/update-delay' +import { updaterCodedMessage } from '../../../shared/updater/updater-failure-copy' +import { normalizeUpdateDelayDays } from '../../../shared/updater/update-delay' import { checkForUpdatesFromMenu, dismissAvailableUpdate, diff --git a/src/main/updater/lifecycle/updater-check-failure.ts b/src/main/updater/lifecycle/updater-check-failure.ts index eb41038989e..02821ad3aab 100644 --- a/src/main/updater/lifecycle/updater-check-failure.ts +++ b/src/main/updater/lifecycle/updater-check-failure.ts @@ -2,7 +2,7 @@ import { isBenignCheckFailure } from '../releases/updater-fallback' import { ReleaseFeedPreflightError } from './updater-state' import type { CheckFailureSource } from './updater-state' import { UpdaterReleaseFeed } from '../releases/updater-release-feed' -import { updaterCodedMessage } from '../../../shared/updater-failure-copy' +import { updaterCodedMessage } from '../../../shared/updater/updater-failure-copy' export abstract class UpdaterCheckFailure extends UpdaterReleaseFeed { protected isRetryableReleaseFeedPreflightFailure(sourceError: unknown): boolean { diff --git a/src/main/updater/lifecycle/updater-check-state.ts b/src/main/updater/lifecycle/updater-check-state.ts index 2f6f3ac541d..7c6b6b03801 100644 --- a/src/main/updater/lifecycle/updater-check-state.ts +++ b/src/main/updater/lifecycle/updater-check-state.ts @@ -1,11 +1,11 @@ import { writeMainThreadDiagnosticMarker } from '../../diagnostics/main-thread-churn-probe' -import { isWindowsSignatureCheckUnavailableFailure } from '../../../shared/updater-windows-signature-check' +import { isWindowsSignatureCheckUnavailableFailure } from '../../../shared/updater/updater-windows-signature-check' import { recordUpdaterLifecycle } from '../updater-lifecycle-diagnostics' import { getRetainedLinuxPackageManualInstallStatus } from '../linux-package/linux-package-downloaded-status' -import type { UpdateCheckOptions, UpdateStatus } from '../../../shared/update-status-types' +import type { UpdateCheckOptions, UpdateStatus } from '../../../shared/updater/update-status-types' import type { UpdateCheckVariant } from './updater-types' import { UpdaterStatus } from './updater-status' -import type { UpdaterCodedMessage } from '../../../shared/updater-failure-copy' +import type { UpdaterCodedMessage } from '../../../shared/updater/updater-failure-copy' import { AUTO_UPDATE_CHECK_INTERVAL_MS, AUTO_UPDATE_RETRY_INTERVAL_MS, diff --git a/src/main/updater/lifecycle/updater-coded-error.ts b/src/main/updater/lifecycle/updater-coded-error.ts index b88276fed24..5cefd01ddd2 100644 --- a/src/main/updater/lifecycle/updater-coded-error.ts +++ b/src/main/updater/lifecycle/updater-coded-error.ts @@ -3,7 +3,7 @@ import { type UpdaterCodedMessage, type UpdaterFailureCode, type UpdaterFailureParams -} from '../../../shared/updater-failure-copy' +} from '../../../shared/updater/updater-failure-copy' import { errorMessage } from '../../../shared/errors/error-message' /** Thrown inside main only; handlers copy its code onto the status or IPC result. */ diff --git a/src/main/updater/lifecycle/updater-download-install.ts b/src/main/updater/lifecycle/updater-download-install.ts index 9c27b5f4e49..ca757bd9098 100644 --- a/src/main/updater/lifecycle/updater-download-install.ts +++ b/src/main/updater/lifecycle/updater-download-install.ts @@ -6,7 +6,7 @@ import { } from '../mac-install/updater-mac-install' import { recordUpdaterLifecycle } from '../updater-lifecycle-diagnostics' import { isExternallyManagedLinuxInstall } from '../linux-package/linux-update-package-type' -import { updaterCodedMessage } from '../../../shared/updater-failure-copy' +import { updaterCodedMessage } from '../../../shared/updater/updater-failure-copy' import { QUIT_AND_INSTALL_DELAY_MS } from './updater-state' import { UpdaterRemoteStatus } from './updater-remote-status' import { prepareThisProcessShipItStaging } from '../mac-install/shipit-leftover-recovery' diff --git a/src/main/updater/lifecycle/updater-install-execution.ts b/src/main/updater/lifecycle/updater-install-execution.ts index a8f068c7cab..37e34d624a6 100644 --- a/src/main/updater/lifecycle/updater-install-execution.ts +++ b/src/main/updater/lifecycle/updater-install-execution.ts @@ -10,7 +10,7 @@ import { getMacUpdateRunningInstances } from '../mac-install/macos-update-runnin import { commitServeSupervisorPark } from './serve-supervisor-install-park' import { armUpdateInstallExitWatchdog } from '../update-install-exit-watchdog' import { getLinuxPackageType } from '../linux-package/linux-update-package-type' -import { updaterCodedMessage } from '../../../shared/updater-failure-copy' +import { updaterCodedMessage } from '../../../shared/updater/updater-failure-copy' import { recordUpdaterLifecycle } from '../updater-lifecycle-diagnostics' import { requestServeUpdateHandoff, failServeUpdateHandoff } from '../serve-update-handoff' import { UpdaterMacInstallPreflight } from '../mac-install/updater-mac-install-preflight' diff --git a/src/main/updater/lifecycle/updater-install-support.ts b/src/main/updater/lifecycle/updater-install-support.ts index f64a89155ee..6646e7a78d8 100644 --- a/src/main/updater/lifecycle/updater-install-support.ts +++ b/src/main/updater/lifecycle/updater-install-support.ts @@ -2,13 +2,16 @@ import { app } from 'electron' import { isWindowsSignatureCheckUnavailableFailure, isWindowsSignatureMismatchFailure -} from '../../../shared/updater-windows-signature-check' +} from '../../../shared/updater/updater-windows-signature-check' import { redactLinuxPackageInstallText } from '../linux-package/linux-package-install-diagnostic' import { getTrackedLinuxPackageArtifact } from '../linux-package/linux-package-update-recovery' import { recordUpdaterLifecycle } from '../updater-lifecycle-diagnostics' import { disarmUpdateInstallExitWatchdog } from '../update-install-exit-watchdog' import { resetMacInstallState } from '../mac-install/updater-mac-install' -import type { LinuxPackageInstallRecovery, UpdateStatus } from '../../../shared/update-status-types' +import type { + LinuxPackageInstallRecovery, + UpdateStatus +} from '../../../shared/updater/update-status-types' import { compareVersions } from '../releases/updater-fallback' import { PRE_QUIT_CLEANUP_TIMEOUT_MS, REQUIRED_PRE_QUIT_CLEANUP_TIMEOUT_MS } from './updater-state' import { UpdaterCheckState } from './updater-check-state' diff --git a/src/main/updater/lifecycle/updater-menu-checks.ts b/src/main/updater/lifecycle/updater-menu-checks.ts index 07869462959..e6bd6826aee 100644 --- a/src/main/updater/lifecycle/updater-menu-checks.ts +++ b/src/main/updater/lifecycle/updater-menu-checks.ts @@ -1,7 +1,7 @@ import { app } from 'electron' import { isMacInstallRequested } from '../mac-install/updater-mac-install' -import type { UpdateCheckOptions } from '../../../shared/update-status-types' -import type { ReleaseChannel } from '../../../shared/release-channel' +import type { UpdateCheckOptions } from '../../../shared/updater/update-status-types' +import type { ReleaseChannel } from '../../../shared/updater/release-channel' import { UpdaterScheduling } from './updater-scheduling' export abstract class UpdaterMenuChecks extends UpdaterScheduling { diff --git a/src/main/updater/lifecycle/updater-remote-status.ts b/src/main/updater/lifecycle/updater-remote-status.ts index dd91f2046ca..d2f41cd9be5 100644 --- a/src/main/updater/lifecycle/updater-remote-status.ts +++ b/src/main/updater/lifecycle/updater-remote-status.ts @@ -1,5 +1,5 @@ import { app } from 'electron' -import type { UpdateCheckOptions, UpdateStatus } from '../../../shared/update-status-types' +import type { UpdateCheckOptions, UpdateStatus } from '../../../shared/updater/update-status-types' import type { RemoteServerUpdateInstallResult, RemoteServerUpdaterSnapshot, diff --git a/src/main/updater/lifecycle/updater-setup.ts b/src/main/updater/lifecycle/updater-setup.ts index b511cf4b500..0226f151b5a 100644 --- a/src/main/updater/lifecycle/updater-setup.ts +++ b/src/main/updater/lifecycle/updater-setup.ts @@ -1,12 +1,12 @@ import { app, powerMonitor } from 'electron' import type { BrowserWindow } from 'electron' -import type { ReleaseBuild, ReleaseChannel } from '../../../shared/release-channel' +import type { ReleaseBuild, ReleaseChannel } from '../../../shared/updater/release-channel' import type { ReleaseBuildListOptions } from '../releases/updater-release-build-cache' import type { LinuxPackageInstallInstructions, UpdateCheckOptions, UpdateStatus -} from '../../../shared/update-status-types' +} from '../../../shared/updater/update-status-types' import type { RemoteServerUpdateInstallResult, RemoteServerUpdaterSnapshot, diff --git a/src/main/updater/lifecycle/updater-state.ts b/src/main/updater/lifecycle/updater-state.ts index d599b42842c..186ebb56c85 100644 --- a/src/main/updater/lifecycle/updater-state.ts +++ b/src/main/updater/lifecycle/updater-state.ts @@ -6,8 +6,8 @@ import type { UpdateCheckOptions, UpdateSource, UpdateStatus -} from '../../../shared/update-status-types' -import type { ReleaseChannel } from '../../../shared/release-channel' +} from '../../../shared/updater/update-status-types' +import type { ReleaseChannel } from '../../../shared/updater/release-channel' import type { PrimaryEventSuppression, UpdateCheckVariant } from './updater-types' export const AUTO_UPDATE_CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000 diff --git a/src/main/updater/lifecycle/updater-status.ts b/src/main/updater/lifecycle/updater-status.ts index 772e50d651d..995a9a0a9cc 100644 --- a/src/main/updater/lifecycle/updater-status.ts +++ b/src/main/updater/lifecycle/updater-status.ts @@ -1,6 +1,6 @@ import { loadElectronAutoUpdater, type ElectronAutoUpdater } from '../electron-updater-loader' import { statusesEqual } from '../releases/updater-fallback' -import type { UpdateCheckOptions, UpdateStatus } from '../../../shared/update-status-types' +import type { UpdateCheckOptions, UpdateStatus } from '../../../shared/updater/update-status-types' import { UpdaterState as BaseUpdaterState } from './updater-state' export abstract class UpdaterStatus extends BaseUpdaterState { diff --git a/src/main/updater/linux-package/linux-package-downloaded-status.ts b/src/main/updater/linux-package/linux-package-downloaded-status.ts index 2f8abee5d06..d0fad8b6377 100644 --- a/src/main/updater/linux-package/linux-package-downloaded-status.ts +++ b/src/main/updater/linux-package/linux-package-downloaded-status.ts @@ -1,4 +1,4 @@ -import type { UpdateStatus } from '../../../shared/update-status-types' +import type { UpdateStatus } from '../../../shared/updater/update-status-types' import { captureLinuxPackageArtifact, clearTrackedLinuxPackageArtifact, @@ -6,7 +6,7 @@ import { } from './linux-package-update-recovery' import { getLinuxPackageType } from './linux-update-package-type' import type { LinuxPackageArtifact } from './linux-package-update-recovery' -import { updaterCodedMessage } from '../../../shared/updater-failure-copy' +import { updaterCodedMessage } from '../../../shared/updater/updater-failure-copy' export function createLinuxPackageManualInstallStatus( artifact: Pick diff --git a/src/main/updater/linux-package/linux-package-install-command.ts b/src/main/updater/linux-package/linux-package-install-command.ts index c2b6e07d87d..3c70af1a5bd 100644 --- a/src/main/updater/linux-package/linux-package-install-command.ts +++ b/src/main/updater/linux-package/linux-package-install-command.ts @@ -1,7 +1,7 @@ import { quotePosixShellDoubleQuotedApostrophe } from '../../../shared/shell/launch/shell-argument-quoting' import { statSync } from 'node:fs' import path from 'node:path' -import type { LinuxRootPackageType } from '../../../shared/update-status-types' +import type { LinuxRootPackageType } from '../../../shared/updater/update-status-types' // User-writable PATH entries cannot be trusted for privileged package installation. const TRUSTED_EXECUTABLE_DIRECTORIES = ['/usr/bin', '/bin', '/usr/sbin', '/sbin'] diff --git a/src/main/updater/linux-package/linux-package-update-recovery.test.ts b/src/main/updater/linux-package/linux-package-update-recovery.test.ts index b0c94fea8a5..613cdcecbba 100644 --- a/src/main/updater/linux-package/linux-package-update-recovery.test.ts +++ b/src/main/updater/linux-package/linux-package-update-recovery.test.ts @@ -4,7 +4,7 @@ import os from 'node:os' import path from 'node:path' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import type * as NodeFs from 'node:fs' -import type { LinuxPackageInstallRecovery } from '../../../shared/update-status-types' +import type { LinuxPackageInstallRecovery } from '../../../shared/updater/update-status-types' import type { LinuxPackageArtifact } from './linux-package-update-recovery' import type * as RecoveryModule from './linux-package-update-recovery' @@ -116,17 +116,6 @@ describe('captureLinuxPackageArtifact', () => { expect(recovery.getTrackedLinuxPackageArtifact()?.path).toBe(downloadedFile) }) - it('ignores entries for other files and formats', () => { - capture({ - files: [ - { url: 'orca.AppImage', sha512: 'other-appimage-digest' }, - { url: 'orca-arm64.deb', sha512: 'other-arch-digest' }, - { url: 'orca.deb', sha512: SHA512 } - ] - }) - expect(recovery.getTrackedLinuxPackageArtifact()?.sha512).toBe(SHA512) - }) - it('refuses an ambiguous basename with two different digests', () => { capture({ files: [ diff --git a/src/main/updater/linux-package/linux-package-update-recovery.ts b/src/main/updater/linux-package/linux-package-update-recovery.ts index ab087fc63e0..9c7f6faf9ab 100644 --- a/src/main/updater/linux-package/linux-package-update-recovery.ts +++ b/src/main/updater/linux-package/linux-package-update-recovery.ts @@ -6,7 +6,7 @@ import path from 'node:path' import type { LinuxPackageInstallRecovery, LinuxRootPackageType -} from '../../../shared/update-status-types' +} from '../../../shared/updater/update-status-types' import { getLinuxRootPackageType } from './linux-update-package-type' import { buildLinuxPackageInstallCommand } from './linux-package-install-command' diff --git a/src/main/updater/linux-package/linux-update-package-type.ts b/src/main/updater/linux-package/linux-update-package-type.ts index b5e9cb1b511..e9bd8d16af0 100644 --- a/src/main/updater/linux-package/linux-update-package-type.ts +++ b/src/main/updater/linux-package/linux-update-package-type.ts @@ -2,7 +2,7 @@ import { readFileSync } from 'node:fs' import path from 'node:path' import { app } from 'electron' import { hasTrustedPackageManagerFor } from './linux-package-install-command' -import type { LinuxRootPackageType } from '../../../shared/update-status-types' +import type { LinuxRootPackageType } from '../../../shared/updater/update-status-types' export type LinuxPackageType = LinuxRootPackageType | 'non-root' | 'unusable' diff --git a/src/main/updater/linux-package/updater-package-recovery.ts b/src/main/updater/linux-package/updater-package-recovery.ts index 42a2cc215a0..ef66127d957 100644 --- a/src/main/updater/linux-package/updater-package-recovery.ts +++ b/src/main/updater/linux-package/updater-package-recovery.ts @@ -11,13 +11,13 @@ import { import type { LinuxPackageInstallInstructions, LinuxPackageInstallRecovery -} from '../../../shared/update-status-types' +} from '../../../shared/updater/update-status-types' import { UpdaterInstallSupport } from '../lifecycle/updater-install-support' import { updaterCodedMessage, updaterFailureText, type UpdaterFailureCode -} from '../../../shared/updater-failure-copy' +} from '../../../shared/updater/updater-failure-copy' const LINUX_PACKAGE_RECOVERY_CODES: Record< LinuxPackageRecoveryUnavailableReason, diff --git a/src/main/updater/mac-install/mac-browser-sidecar-recovery.ts b/src/main/updater/mac-install/mac-browser-sidecar-recovery.ts index c9b3d822046..97a7c787f3c 100644 --- a/src/main/updater/mac-install/mac-browser-sidecar-recovery.ts +++ b/src/main/updater/mac-install/mac-browser-sidecar-recovery.ts @@ -2,7 +2,7 @@ import { lstat, readFile } from 'node:fs/promises' import { setTimeout as delay } from 'node:timers/promises' import { runProcess } from '@orca/process-host' import { getRuntimeMetadataPath } from '../../../shared/remote-runtime/bootstrap/runtime-bootstrap' -import type { UpdateInstallBlocker } from '../../../shared/update-status-types' +import type { UpdateInstallBlocker } from '../../../shared/updater/update-status-types' import { getMacUpdateRunningInstances } from './macos-update-running-instances' type ProcessRow = { diff --git a/src/main/updater/mac-install/updater-mac-install.ts b/src/main/updater/mac-install/updater-mac-install.ts index fe128edd511..06773de7965 100644 --- a/src/main/updater/mac-install/updater-mac-install.ts +++ b/src/main/updater/mac-install/updater-mac-install.ts @@ -1,6 +1,6 @@ import { app, autoUpdater as nativeUpdater } from 'electron' import { homedir } from 'node:os' -import type { UpdateStatus } from '../../../shared/update-status-types' +import type { UpdateStatus } from '../../../shared/updater/update-status-types' import { macCoordinationRoot } from '../../../shared/remote-runtime/serve-supervisor/serve-bundle-coordination' import { recordUpdaterLifecycle } from '../updater-lifecycle-diagnostics' import { commitServeSupervisorParkOnQuit } from '../lifecycle/serve-supervisor-install-park' diff --git a/src/main/updater/releases/updater-build-selection.ts b/src/main/updater/releases/updater-build-selection.ts index f842dbeb517..b0f668883ae 100644 --- a/src/main/updater/releases/updater-build-selection.ts +++ b/src/main/updater/releases/updater-build-selection.ts @@ -7,13 +7,13 @@ import { requiresManualDevChannelInstall, type ReleaseBuild, type ReleaseChannel -} from '../../../shared/release-channel' +} from '../../../shared/updater/release-channel' import { compareVersions } from './updater-fallback' -import { profileStateBuildCompatibilityError } from '../../../shared/profile-state-build-compatibility' +import { profileStateBuildCompatibilityError } from '../../../shared/updater/profile-state-build-compatibility' import { listReleaseBuilds, resolveTargetBuild } from './updater-release-builds' import { ReleaseBuildListCache, type ReleaseBuildListOptions } from './updater-release-build-cache' import { UpdaterMenuChecks } from '../lifecycle/updater-menu-checks' -import { updaterCodedMessage } from '../../../shared/updater-failure-copy' +import { updaterCodedMessage } from '../../../shared/updater/updater-failure-copy' import { updaterErrorMessage } from '../lifecycle/updater-coded-error' export abstract class UpdaterBuildSelection extends UpdaterMenuChecks { diff --git a/src/main/updater/releases/updater-changelog.ts b/src/main/updater/releases/updater-changelog.ts index dbe199bddb7..1ca14d55c9a 100644 --- a/src/main/updater/releases/updater-changelog.ts +++ b/src/main/updater/releases/updater-changelog.ts @@ -1,5 +1,5 @@ import { net } from 'electron' -import type { ChangelogData } from '../../../shared/update-status-types' +import type { ChangelogData } from '../../../shared/updater/update-status-types' import { compareVersions } from './updater-fallback' type ChangelogEntry = { diff --git a/src/main/updater/releases/updater-fallback.ts b/src/main/updater/releases/updater-fallback.ts index e707afe005a..37382b42f63 100644 --- a/src/main/updater/releases/updater-fallback.ts +++ b/src/main/updater/releases/updater-fallback.ts @@ -1,9 +1,9 @@ -import type { UpdateStatus } from '../../../shared/update-status-types' +import type { UpdateStatus } from '../../../shared/updater/update-status-types' import { compareAppVersions, isPrereleaseAppVersion, isValidAppVersion -} from '../../../shared/app-version' +} from '../../../shared/app-lifecycle/identity/app-version' export const compareVersions = compareAppVersions export const isPrereleaseVersion = isPrereleaseAppVersion diff --git a/src/main/updater/releases/updater-release-build-cache.test.ts b/src/main/updater/releases/updater-release-build-cache.test.ts deleted file mode 100644 index 3c561f38135..00000000000 --- a/src/main/updater/releases/updater-release-build-cache.test.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { describe, expect, it, vi } from 'vitest' -import type { ReleaseBuild } from '../../../shared/release-channel' -import { ReleaseBuildListCache } from './updater-release-build-cache' - -const build = (tag: string): ReleaseBuild => ({ - tag, - version: tag.slice(1), - channel: 'hourly', - name: null, - publishedAt: null, - releaseUrl: `https://github.com/stablyai/orca-hourly/releases/tag/${tag}`, - installerUrl: null -}) - -const TTL_MS = 5 * 60_000 - -function createCache(load = vi.fn().mockResolvedValue([build('v1.4.160-hourly.202607281400')])) { - let now = 1_000_000 - const cache = new ReleaseBuildListCache(load, TTL_MS, () => now) - return { cache, load, advance: (ms: number) => (now += ms) } -} - -describe('ReleaseBuildListCache', () => { - it('shares one in-flight load between concurrent callers', async () => { - const { cache, load } = createCache() - - const [first, second] = await Promise.all([cache.list('hourly'), cache.list('hourly')]) - - expect(load).toHaveBeenCalledTimes(1) - expect(second).toBe(first) - }) - - it('does not cache a failed load', async () => { - const load = vi - .fn() - .mockRejectedValueOnce(new Error('GitHub rate limit reached.')) - .mockResolvedValueOnce([build('v1.4.160-hourly.202607281400')]) - const { cache } = createCache(load) - - await expect(cache.list('hourly')).rejects.toThrow(/rate limit/) - await expect(cache.list('hourly')).resolves.toHaveLength(1) - expect(load).toHaveBeenCalledTimes(2) - }) - - it('keeps a forced reload that replaced a failing entry', async () => { - let failFirst: (error: Error) => void = () => {} - const load = vi - .fn() - .mockReturnValueOnce( - new Promise((_resolve, reject) => { - failFirst = reject - }) - ) - .mockResolvedValueOnce([build('v1.4.160-hourly.202607281400')]) - const { cache } = createCache(load) - - const failing = cache.list('hourly') - const forced = cache.list('hourly', { force: true }) - failFirst(new Error('timed out')) - await expect(failing).rejects.toThrow(/timed out/) - await forced - - await cache.list('hourly') - expect(load).toHaveBeenCalledTimes(2) - }) -}) diff --git a/src/main/updater/releases/updater-release-build-cache.ts b/src/main/updater/releases/updater-release-build-cache.ts index 950f57f9b93..302ea1d4ff0 100644 --- a/src/main/updater/releases/updater-release-build-cache.ts +++ b/src/main/updater/releases/updater-release-build-cache.ts @@ -1,4 +1,4 @@ -import type { ReleaseBuild, ReleaseChannel } from '../../../shared/release-channel' +import type { ReleaseBuild, ReleaseChannel } from '../../../shared/updater/release-channel' const DEFAULT_TTL_MS = 5 * 60_000 diff --git a/src/main/updater/releases/updater-release-builds.ts b/src/main/updater/releases/updater-release-builds.ts index 2915bf27e92..b659f62634b 100644 --- a/src/main/updater/releases/updater-release-builds.ts +++ b/src/main/updater/releases/updater-release-builds.ts @@ -8,7 +8,7 @@ import { sortReleaseBuildsNewestFirst, type ReleaseBuild, type ReleaseChannel -} from '../../../shared/release-channel' +} from '../../../shared/updater/release-channel' import { parseRetryAfterHeaderMs } from '../../../shared/retry-after-header' import { getGhRateLimitBlockedUntilMs, diff --git a/src/main/updater/releases/updater-release-delay.ts b/src/main/updater/releases/updater-release-delay.ts index 54af9728deb..7c3dcf24df4 100644 --- a/src/main/updater/releases/updater-release-delay.ts +++ b/src/main/updater/releases/updater-release-delay.ts @@ -1,6 +1,6 @@ import { compareVersions } from './updater-fallback' -import { updateDelayDaysToMs } from '../../../shared/update-delay' -import type { DelayedUpdate } from '../../../shared/update-status-types' +import { updateDelayDaysToMs } from '../../../shared/updater/update-delay' +import type { DelayedUpdate } from '../../../shared/updater/update-status-types' import { AUTO_UPDATE_CHECK_INTERVAL_MS } from '../lifecycle/updater-state' // Absorbs clock skew between this host and GitHub's feed timestamps. diff --git a/src/main/updater/releases/updater-release-feed.ts b/src/main/updater/releases/updater-release-feed.ts index 10cb808b25e..89702a2d5e0 100644 --- a/src/main/updater/releases/updater-release-feed.ts +++ b/src/main/updater/releases/updater-release-feed.ts @@ -5,7 +5,7 @@ import { } from './updater-prerelease-feed' import { getReleaseDownloadUrl } from './updater-release-readiness' import { toDelayedUpdate } from './updater-release-delay' -import { updateDelayDaysToMs } from '../../../shared/update-delay' +import { updateDelayDaysToMs } from '../../../shared/updater/update-delay' import { isMissingUpdateManifestFailure, isPrereleaseVersion } from './updater-fallback' import type { CheckFailureSource } from '../lifecycle/updater-state' import type { UpdateCheckVariant } from '../lifecycle/updater-types' diff --git a/src/main/updater/releases/updater-system-requirement.ts b/src/main/updater/releases/updater-system-requirement.ts index 2575cb776b0..af6a9352bf6 100644 --- a/src/main/updater/releases/updater-system-requirement.ts +++ b/src/main/updater/releases/updater-system-requirement.ts @@ -1,6 +1,6 @@ import { release } from 'node:os' import type { UpdateInfo } from 'electron-updater' -import type { UnsupportedSystemUpdate } from '../../../shared/update-status-types' +import type { UnsupportedSystemUpdate } from '../../../shared/updater/update-status-types' import { macosVersionForDarwinFloor } from '../../../shared/updater/requirements/macos-darwin-floor' import { compareVersions } from './updater-fallback' diff --git a/src/main/updater/updater-events.test.ts b/src/main/updater/updater-events.test.ts index 267b7bb98dc..a0b125c51db 100644 --- a/src/main/updater/updater-events.test.ts +++ b/src/main/updater/updater-events.test.ts @@ -1,5 +1,5 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' -import type { UpdateStatus } from '../../shared/update-status-types' +import type { UpdateStatus } from '../../shared/updater/update-status-types' import type { registerAutoUpdaterHandlers } from './updater-events' const { @@ -155,18 +155,6 @@ describe('registerAutoUpdaterHandlers linux package artifact tracking', () => { } } - it('starts unpacking a downloaded AppImage update without holding up the ready status', async () => { - getLinuxPackageTypeMock.mockReturnValue('non-root') - getLinuxRootPackageTypeMock.mockReturnValue(null) - preExtractUpdateMock.mockReturnValue(new Promise(() => {})) - const appImagePath = '/home/tester/.cache/orca-updater/pending/Orca-1.0.61.AppImage' - const { context, emit } = await register() - emit('update-downloaded', downloadedEvent({ downloadedFile: appImagePath })) - - expect(preExtractUpdateMock).toHaveBeenCalledWith(appImagePath, expect.any(Function)) - expect(context.sendStatus).toHaveBeenCalledWith(expect.objectContaining({ version: '1.0.61' })) - }) - it.each([ ['missing', [{ url: 'orca-ide_1.0.61_amd64.deb' }]], ['malformed', [{ url: 'orca-ide_1.0.61_amd64.deb', sha512: 'not-a-digest' }]] diff --git a/src/main/updater/updater-handler-context.ts b/src/main/updater/updater-handler-context.ts index 88f16032819..20197759865 100644 --- a/src/main/updater/updater-handler-context.ts +++ b/src/main/updater/updater-handler-context.ts @@ -1,4 +1,4 @@ -import type { UpdateStatus } from '../../shared/update-status-types' +import type { UpdateStatus } from '../../shared/updater/update-status-types' import type { ElectronAutoUpdater } from './electron-updater-loader' export type UpdaterHandlerContext = { diff --git a/src/main/updater/updater-linux-package-recovery-actions.test.ts b/src/main/updater/updater-linux-package-recovery-actions.test.ts index 472312c340c..5452a7a1c3c 100644 --- a/src/main/updater/updater-linux-package-recovery-actions.test.ts +++ b/src/main/updater/updater-linux-package-recovery-actions.test.ts @@ -1,6 +1,6 @@ import type { getReleaseDownloadUrl } from './releases/updater-release-readiness' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { UpdateStatus } from '../../shared/update-status-types' +import type { UpdateStatus } from '../../shared/updater/update-status-types' import type * as UpdaterModule from './updater-service' import { loadUpdaterModule, warmUpdaterModule } from './testing/updater-test-module-loader' import { updaterMainWindow } from './testing/updater-test-main-window' diff --git a/src/main/updater/updater-service.ts b/src/main/updater/updater-service.ts index 093d33abddb..f227676dada 100644 --- a/src/main/updater/updater-service.ts +++ b/src/main/updater/updater-service.ts @@ -3,13 +3,13 @@ import type { LinuxPackageInstallInstructions, UpdateCheckOptions, UpdateStatus -} from '../../shared/update-status-types' +} from '../../shared/updater/update-status-types' import type { RemoteServerUpdateInstallResult, RemoteServerUpdaterSnapshot, RemoteServerUpdateSupport } from '../../shared/remote-runtime/host-catalog/remote-server-update' -import type { ReleaseBuild, ReleaseChannel } from '../../shared/release-channel' +import type { ReleaseBuild, ReleaseChannel } from '../../shared/updater/release-channel' import type { ReleaseBuildListOptions } from './releases/updater-release-build-cache' import { UpdaterSetup, type UpdaterSetupOptions } from './lifecycle/updater-setup' import type { UpdateInstallMode } from './lifecycle/updater-state' diff --git a/src/main/updater/updater.check-settlement.test.ts b/src/main/updater/updater.check-settlement.test.ts index b09ef151071..ff1197b0d49 100644 --- a/src/main/updater/updater.check-settlement.test.ts +++ b/src/main/updater/updater.check-settlement.test.ts @@ -1,12 +1,12 @@ import type { getReleaseDownloadUrl } from './releases/updater-release-readiness' -import type { UpdateStatus } from '../../shared/update-status-types' +import type { UpdateStatus } from '../../shared/updater/update-status-types' import { beforeEach, describe, expect, it, vi } from 'vitest' import { loadUpdaterModule, warmUpdaterModule } from './testing/updater-test-module-loader' import { updaterMainWindow } from './testing/updater-test-main-window' const { autoUpdaterMock, - fetchChangelogMock, + fetchNewerReleaseTagsMock, moduleFactories, resetUpdaterMocks @@ -253,56 +253,4 @@ describe('updater', () => { }) expect(setLastUpdateCheckAt).toHaveBeenCalledTimes(1) }) - - it('ignores a stale update-available event after a silent background settle', async () => { - vi.useFakeTimers() - fetchNewerReleaseTagsMock.mockResolvedValue({ tags: [], state: 'no-newer' }) - autoUpdaterMock.checkForUpdates.mockResolvedValue(undefined) - const sendMock = vi.fn() - const mainWindow = updaterMainWindow(sendMock) - - const { setupAutoUpdater } = await loadUpdaterModule() - - setupAutoUpdater(mainWindow, { - getLastUpdateCheckAt: () => null, - setLastUpdateCheckAt: vi.fn() - }) - - await vi.waitFor(() => { - expect(autoUpdaterMock.checkForUpdates).toHaveBeenCalledTimes(1) - }) - await vi.advanceTimersByTimeAsync(1000) - - autoUpdaterMock.emit('update-available', { version: '1.0.61' }) - await vi.advanceTimersByTimeAsync(0) - - expect(fetchChangelogMock).not.toHaveBeenCalled() - expect(sendMock).not.toHaveBeenCalledWith( - 'updater:status', - expect.objectContaining({ state: 'available', version: '1.0.61' }) - ) - }) - - it('ignores a stale checking-for-update event after a silent manual settle', async () => { - vi.useFakeTimers() - fetchNewerReleaseTagsMock.mockResolvedValue({ tags: [], state: 'no-newer' }) - autoUpdaterMock.checkForUpdates.mockResolvedValue(undefined) - const sendMock = vi.fn() - const mainWindow = updaterMainWindow(sendMock) - - const { setupAutoUpdater, checkForUpdatesFromMenu } = await loadUpdaterModule() - - setupAutoUpdater(mainWindow, { getLastUpdateCheckAt: () => Date.now() }) - checkForUpdatesFromMenu() - - await vi.waitFor(() => { - expect(autoUpdaterMock.checkForUpdates).toHaveBeenCalledTimes(1) - }) - await vi.advanceTimersByTimeAsync(1000) - - sendMock.mockClear() - autoUpdaterMock.emit('checking-for-update') - - expect(sendMock).not.toHaveBeenCalled() - }) }) diff --git a/src/main/updater/updater.linux-externally-managed.test.ts b/src/main/updater/updater.linux-externally-managed.test.ts index 618267cf292..474adaf4dca 100644 --- a/src/main/updater/updater.linux-externally-managed.test.ts +++ b/src/main/updater/updater.linux-externally-managed.test.ts @@ -3,7 +3,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' import type * as UpdaterModule from './updater-service' import { loadUpdaterModule, warmUpdaterModule } from './testing/updater-test-module-loader' import { updaterMainWindow } from './testing/updater-test-main-window' -import type { LinuxRootPackageType, UpdateStatus } from '../../shared/update-status-types' +import type { LinuxRootPackageType, UpdateStatus } from '../../shared/updater/update-status-types' const { autoUpdaterMock, diff --git a/src/main/updater/updater.wsl-move-install-hold-driver.test.ts b/src/main/updater/updater.wsl-move-install-hold-driver.test.ts index 37d3b302e21..5d103b2fea2 100644 --- a/src/main/updater/updater.wsl-move-install-hold-driver.test.ts +++ b/src/main/updater/updater.wsl-move-install-hold-driver.test.ts @@ -9,7 +9,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { join } from 'node:path' import { tmpdir } from 'node:os' import type * as UpdaterModule from './updater-service' -import type { UpdateStatus } from '../../shared/update-status-types' +import type { UpdateStatus } from '../../shared/updater/update-status-types' import { WSL_HOSTS_INTERNAL_GATE_ENV } from '../../shared/remote-runtime/wsl-hosts/wsl-host-internal-gate' import type { WslMoveResult } from '../../shared/wsl-move/wsl-move-driver-types' import { loadUpdaterModule, warmUpdaterModule } from './testing/updater-test-module-loader' diff --git a/src/main/window/clipboard/clipboard-image-temp-file.ts b/src/main/window/clipboard/clipboard-image-temp-file.ts index 01a02c7fb0a..a7ac1ec7b88 100644 --- a/src/main/window/clipboard/clipboard-image-temp-file.ts +++ b/src/main/window/clipboard/clipboard-image-temp-file.ts @@ -3,7 +3,7 @@ import path from 'node:path' import { randomUUID } from 'node:crypto' import { SshHostNotServedError } from '../../providers/ssh-host-not-served-error' -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { assertClipboardImageByteLengthWithinLimit } from '../../../shared/clipboard/clipboard-image' import { agentSessionPastedImageName, diff --git a/src/main/window/clipboard/clipboard-text-publisher.ts b/src/main/window/clipboard/clipboard-text-publisher.ts index 0df6ab9cc5d..35885c56385 100644 --- a/src/main/window/clipboard/clipboard-text-publisher.ts +++ b/src/main/window/clipboard/clipboard-text-publisher.ts @@ -7,7 +7,7 @@ import { CLIPBOARD_TEXT_WRITE_TOO_LARGE_ERROR } from '../../../shared/clipboard/clipboard-text' import { CLIPBOARD_IMAGE_MAX_BASE64_CHARS } from '../../../shared/clipboard/clipboard-image' -import { isLinuxWaylandSession } from '../../../shared/linux-wayland-session' +import { isLinuxWaylandSession } from '../../../shared/app-lifecycle/launch/linux-wayland-session' import { writeClipboardTextAndVerify } from './clipboard-text-write-verify' import { stageClipboardPublisher } from './clipboard-publisher-executable' import { envWithoutAppImageRuntime } from '../../pty/shell-startup/appimage-terminal-env' diff --git a/src/main/window/createMainWindow.ts b/src/main/window/createMainWindow.ts index 7def08851be..ff6caabd4f5 100644 --- a/src/main/window/createMainWindow.ts +++ b/src/main/window/createMainWindow.ts @@ -7,7 +7,10 @@ import { getAppIconPath } from './desktop-integration/app-icon' import { browserManager } from '../browser/guest-lifecycle/manager/browser-manager' import { getBrowserClientHostId } from '../browser/client-hosts/lifecycle/browser-client-host-id' import { formatBrowserClientHostIdArgument } from '../../shared/browser/client-hosting/browser-client-host-id-argument' -import { formatWindowMaterialArgument, resolveWindowMaterial } from '../../shared/window-material' +import { + formatWindowMaterialArgument, + resolveWindowMaterial +} from '../../shared/app-lifecycle/windows/window-material' import { windowMaterialOptions } from './presentation/window-material-options' import { rememberWindowMaterial } from './presentation/window-material-suppression' import { markSystemSessionEnding } from '../crash-reporting/process-exits/expected-teardown-state' @@ -32,7 +35,7 @@ import { wslHostsWindowArguments } from '../wsl/host-lifecycle/wsl-host-gate' import { formatHiddenWindowFramePumpArgument, shouldPumpHiddenWindowFrames -} from '../../shared/hidden-window-frame-pump' +} from '../../shared/app-lifecycle/windows/hidden-window-frame-pump' import { forceRepaint, installMacosVisibilityRepaint, diff --git a/src/main/window/desktop-integration/app-icon.ts b/src/main/window/desktop-integration/app-icon.ts index 3c4b3e7cf52..4849320c69d 100644 --- a/src/main/window/desktop-integration/app-icon.ts +++ b/src/main/window/desktop-integration/app-icon.ts @@ -15,7 +15,7 @@ import { CUSTOM_APP_ICON_ID, normalizeAppIconId, type BuiltInAppIconId -} from '../../../shared/app-icon' +} from '../../../shared/app-lifecycle/identity/app-icon' import { getCustomAppIconPath, hasCustomAppIcon } from './custom-app-icon' const APP_ICON_PATHS = { diff --git a/src/main/window/desktop-integration/custom-app-icon.ts b/src/main/window/desktop-integration/custom-app-icon.ts index c6baecb98ed..44e893bd970 100644 --- a/src/main/window/desktop-integration/custom-app-icon.ts +++ b/src/main/window/desktop-integration/custom-app-icon.ts @@ -8,7 +8,7 @@ import { CUSTOM_APP_ICON_MIN_SIDE, type CustomAppIconImportFailureCode, type CustomAppIconImportResult -} from '../../../shared/app-icon' +} from '../../../shared/app-lifecycle/identity/app-icon' import { readRasterImageDimensions } from '../../../shared/file-preview/raster-image-dimensions' import { getCanonicalUserDataPath } from '../../persistence/loading-store/user-data-path' diff --git a/src/main/window/main-window/main-window-close-lifecycle.ts b/src/main/window/main-window/main-window-close-lifecycle.ts index 049667850b8..20d7941e834 100644 --- a/src/main/window/main-window/main-window-close-lifecycle.ts +++ b/src/main/window/main-window/main-window-close-lifecycle.ts @@ -1,5 +1,5 @@ import { ipcMain, Menu, Notification, type BrowserWindow } from 'electron' -import { QUIT_RENDERER_ACK_TIMEOUT_MS } from '../../../shared/quit-teardown-deadline' +import { QUIT_RENDERER_ACK_TIMEOUT_MS } from '../../../shared/app-lifecycle/shutdown/quit-teardown-deadline' import { translateMain } from '../../i18n/main-i18n' import type { Store } from '../../persistence/loading-store/store' import { resolveWindowCloseAction } from './window-close-decision' diff --git a/src/main/window/presentation/window-material-options.ts b/src/main/window/presentation/window-material-options.ts index 9bf2d84454c..70a929e2e76 100644 --- a/src/main/window/presentation/window-material-options.ts +++ b/src/main/window/presentation/window-material-options.ts @@ -1,5 +1,5 @@ import type { BrowserWindowConstructorOptions } from 'electron' -import type { WindowMaterial } from '../../../shared/window-material' +import type { WindowMaterial } from '../../../shared/app-lifecycle/windows/window-material' type WindowMaterialOptions = Pick< BrowserWindowConstructorOptions, diff --git a/src/main/window/presentation/window-material-suppression.ts b/src/main/window/presentation/window-material-suppression.ts index f0a9cc5d397..c7c53af19e0 100644 --- a/src/main/window/presentation/window-material-suppression.ts +++ b/src/main/window/presentation/window-material-suppression.ts @@ -1,5 +1,5 @@ import type { BrowserWindow } from 'electron' -import type { WindowMaterial } from '../../../shared/window-material' +import type { WindowMaterial } from '../../../shared/app-lifecycle/windows/window-material' import { MAC_BLUR_VIBRANCY } from './window-material-options' const createdMaterials = new WeakMap() diff --git a/src/main/window/renderer-relays/native-unload-coordinator.ts b/src/main/window/renderer-relays/native-unload-coordinator.ts index f8b0c1348ec..71f3bc1be8e 100644 --- a/src/main/window/renderer-relays/native-unload-coordinator.ts +++ b/src/main/window/renderer-relays/native-unload-coordinator.ts @@ -3,7 +3,7 @@ import { ipcMain, type BrowserWindow, type WebContents } from 'electron' import { QUIT_RENDERER_ACK_TIMEOUT_MS, WILL_QUIT_TEARDOWN_DEADLINE_MS -} from '../../../shared/quit-teardown-deadline' +} from '../../../shared/app-lifecycle/shutdown/quit-teardown-deadline' type BeforeReload = (options: { webContentsId: number; ignoreCache: boolean }) => void /** saved: durable; failed: renderer refused (cancel); unreachable: reload as before; superseded: document already gone. */ diff --git a/src/main/window/visibility/hidden-window-frame-pump.ts b/src/main/window/visibility/hidden-window-frame-pump.ts index 1f7fb1a7b44..06288ce38a3 100644 --- a/src/main/window/visibility/hidden-window-frame-pump.ts +++ b/src/main/window/visibility/hidden-window-frame-pump.ts @@ -1,4 +1,4 @@ -import { HIDDEN_WINDOW_FRAME_PUMP_STOP_CHANNEL } from '../../../shared/hidden-window-frame-pump' +import { HIDDEN_WINDOW_FRAME_PUMP_STOP_CHANNEL } from '../../../shared/app-lifecycle/windows/hidden-window-frame-pump' type FramePumpWindow = { on(event: 'show', listener: () => void): unknown diff --git a/src/main/windows/windows-administrator-restart.ts b/src/main/windows/windows-administrator-restart.ts index 9985d2fc31b..17965116cd8 100644 --- a/src/main/windows/windows-administrator-restart.ts +++ b/src/main/windows/windows-administrator-restart.ts @@ -4,7 +4,7 @@ import { app } from 'electron' import { quoteWindowsArgument } from '@orca/process-host/windows-command-line' import { getBundledLauncherPath } from '../cli/packaged-assets/bundled-cli-launcher-path' import { getWindowsAdministratorStatus } from './windows-administrator-status' -import { BACKGROUND_OPEN_ARG } from '../../shared/background-open-argv' +import { BACKGROUND_OPEN_ARG } from '../../shared/app-lifecycle/launch/background-open-argv' const RESTART_LOCAL_TERMINALS_ARG = '--orca-restart-local-terminals-as-administrator' diff --git a/src/main/windows/windows-administrator-status.ts b/src/main/windows/windows-administrator-status.ts index ba9a01fc318..8684231b2e2 100644 --- a/src/main/windows/windows-administrator-status.ts +++ b/src/main/windows/windows-administrator-status.ts @@ -1,6 +1,6 @@ import { join } from 'node:path' import { runProcess } from '@orca/process-host' -import { getAppEnvironment } from '../../shared/app-environment' +import { getAppEnvironment } from '../../shared/app-lifecycle/app-environment' import { getBundledLauncherPath } from '../cli/packaged-assets/bundled-cli-launcher-path' let status: Promise | undefined diff --git a/src/main/worker-threads/forked-child-entry-path.ts b/src/main/worker-threads/forked-child-entry-path.ts index 3fdbb0e57fc..de89d574305 100644 --- a/src/main/worker-threads/forked-child-entry-path.ts +++ b/src/main/worker-threads/forked-child-entry-path.ts @@ -1,6 +1,6 @@ import { existsSync } from 'node:fs' import { join } from 'node:path' -import { getAppEnvironment, hasAppEnvironment } from '../../shared/app-environment' +import { getAppEnvironment, hasAppEnvironment } from '../../shared/app-lifecycle/app-environment' /** Plain-Node entries import this module; the build guard rejects literal Electron requires. */ export function resolveForkedChildEntryPath( diff --git a/src/main/worker-threads/worker-thread-entry-path.ts b/src/main/worker-threads/worker-thread-entry-path.ts index b269fd6dd62..93995fa9d4e 100644 --- a/src/main/worker-threads/worker-thread-entry-path.ts +++ b/src/main/worker-threads/worker-thread-entry-path.ts @@ -1,5 +1,5 @@ import { basename, dirname, join } from 'node:path' -import { getAppEnvironment, hasAppEnvironment } from '../../shared/app-environment' +import { getAppEnvironment, hasAppEnvironment } from '../../shared/app-lifecycle/app-environment' /** Keep this reachable from plain-Node entries; the build guard rejects Electron imports here. */ export type WorkerEntryLayout = { diff --git a/src/main/workspace-hooks/hook-orca-cli-env.ts b/src/main/workspace-hooks/hook-orca-cli-env.ts index ef5df6a49a6..e1bbce30c60 100644 --- a/src/main/workspace-hooks/hook-orca-cli-env.ts +++ b/src/main/workspace-hooks/hook-orca-cli-env.ts @@ -1,4 +1,4 @@ -import { getAppEnvironment, hasAppEnvironment } from '../../shared/app-environment' +import { getAppEnvironment, hasAppEnvironment } from '../../shared/app-lifecycle/app-environment' import { toLinuxPath } from '../../shared/file-access/wsl-paths' import { prependOrcaCliDirToChildPath } from '../cli/launchers/orca-cli-child-path' import { getManagedWslCliDir, getWslCliCommandName } from '../cli/wsl/wsl-managed-cli' diff --git a/src/main/wsl/execution/relay-bundle-paths.ts b/src/main/wsl/execution/relay-bundle-paths.ts index 20de15826ff..0c046406b46 100644 --- a/src/main/wsl/execution/relay-bundle-paths.ts +++ b/src/main/wsl/execution/relay-bundle-paths.ts @@ -1,5 +1,5 @@ import { join } from 'node:path' -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import type { RelayPlatform } from '../../ssh/remote-host/ssh-remote-platform' function currentAppPath(): string | undefined { diff --git a/src/main/wsl/host-lifecycle/wsl-host-client-declaration.ts b/src/main/wsl/host-lifecycle/wsl-host-client-declaration.ts index d72321e41a3..ba83f53e306 100644 --- a/src/main/wsl/host-lifecycle/wsl-host-client-declaration.ts +++ b/src/main/wsl/host-lifecycle/wsl-host-client-declaration.ts @@ -1,5 +1,5 @@ /** R39: each ready control socket to a WSL host says which Orca installation it belongs to. */ -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { ORCAD_DECLARE_CLIENT_METHOD } from '../../../shared/remote-runtime/orcad-lifecycle/orcad-peer-desktops-contract' import { resolveEnvironment } from '../../../shared/remote-runtime/host-store/runtime-environment-store' import type { RuntimeRpcResponse } from '../../../shared/remote-runtime/rpc/runtime-rpc-envelope' diff --git a/src/main/wsl/host-lifecycle/wsl-host-client-instance.ts b/src/main/wsl/host-lifecycle/wsl-host-client-instance.ts index 72147df7b8a..d9a23b381e4 100644 --- a/src/main/wsl/host-lifecycle/wsl-host-client-instance.ts +++ b/src/main/wsl/host-lifecycle/wsl-host-client-instance.ts @@ -1,6 +1,6 @@ /** R39: names this Orca installation to a WSL host's server, so desktops sharing one server tell apart. */ import { createHash } from 'node:crypto' -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' let cached: string | null = null diff --git a/src/main/wsl/host-lifecycle/wsl-hosts-policy-live-update.ts b/src/main/wsl/host-lifecycle/wsl-hosts-policy-live-update.ts index dc7c5adb8f0..663e12e9f42 100644 --- a/src/main/wsl/host-lifecycle/wsl-hosts-policy-live-update.ts +++ b/src/main/wsl/host-lifecycle/wsl-hosts-policy-live-update.ts @@ -1,8 +1,8 @@ import { join } from 'node:path' -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { readFetchResponseTextWithinLimit } from '../../../shared/fetch-response-body' import { readNodeFileSyncWithinLimit } from '../../../shared/file-content/node-bounded-file-reader' -import { getVersionChannel, MAIN_RELEASE_REPO } from '../../../shared/release-channel' +import { getVersionChannel, MAIN_RELEASE_REPO } from '../../../shared/updater/release-channel' import { isWslHostsInternalGateOpen } from '../../../shared/remote-runtime/wsl-hosts/wsl-host-internal-gate' import { parseWslHostsPolicy, diff --git a/src/main/wsl/orcad/__tests__/wsl-orcad-midturn-stop-lane.ts b/src/main/wsl/orcad/__tests__/wsl-orcad-midturn-stop-lane.ts index 04981cd1a7b..1e76ff60f38 100644 --- a/src/main/wsl/orcad/__tests__/wsl-orcad-midturn-stop-lane.ts +++ b/src/main/wsl/orcad/__tests__/wsl-orcad-midturn-stop-lane.ts @@ -10,7 +10,7 @@ import type { AgentSessionHistoryResult, AgentSessionSubscribeEvent } from '../../../../shared/agent-session/agent-session-wire' -import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../../shared/electron-remote-runtime-client-capabilities' +import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../../shared/remote-runtime/protocol/electron-remote-runtime-client-capabilities' import type { PairedRuntimeConnection } from '../../../../shared/remote-runtime/pairing/paired-runtime-connection' import '../../../../shared/remote-runtime/requests/remote-runtime-request-socket' import { subscribeRemoteRuntimeTransport } from '../../../../shared/remote-runtime/requests/remote-runtime-subscription-transport' diff --git a/src/main/wsl/orcad/__tests__/wsl-orcad-scripted-provider-chat.ts b/src/main/wsl/orcad/__tests__/wsl-orcad-scripted-provider-chat.ts index 67023565190..4bc675f7ea9 100644 --- a/src/main/wsl/orcad/__tests__/wsl-orcad-scripted-provider-chat.ts +++ b/src/main/wsl/orcad/__tests__/wsl-orcad-scripted-provider-chat.ts @@ -3,7 +3,7 @@ import { expect, vi } from 'vitest' import { z } from 'zod' import type { AgentJournalRenderItem } from '../../../../shared/agent-session/journal/agent-session-journal-types' import type { AgentSessionSubscribeEvent } from '../../../../shared/agent-session/agent-session-wire' -import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../../shared/electron-remote-runtime-client-capabilities' +import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../../shared/remote-runtime/protocol/electron-remote-runtime-client-capabilities' import '../../../../shared/remote-runtime/requests/remote-runtime-request-socket' import { subscribeRemoteRuntimeTransport } from '../../../../shared/remote-runtime/requests/remote-runtime-subscription-transport' import { quotePosixShell } from '../../../../shared/shell/launch/shell-argument-quoting' diff --git a/src/main/wsl/orcad/__tests__/wsl-orcad-structured-chat-contract.ts b/src/main/wsl/orcad/__tests__/wsl-orcad-structured-chat-contract.ts index 2aebf199ad0..eaa78f09971 100644 --- a/src/main/wsl/orcad/__tests__/wsl-orcad-structured-chat-contract.ts +++ b/src/main/wsl/orcad/__tests__/wsl-orcad-structured-chat-contract.ts @@ -8,7 +8,7 @@ import type { AgentSessionSubscribeEvent } from '../../../../shared/agent-session/agent-session-wire' import type { PairedRuntimeConnection } from '../../../../shared/remote-runtime/pairing/paired-runtime-connection' -import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../../shared/electron-remote-runtime-client-capabilities' +import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../../shared/remote-runtime/protocol/electron-remote-runtime-client-capabilities' import '../../../../shared/remote-runtime/requests/remote-runtime-request-socket' import { subscribeRemoteRuntimeTransport } from '../../../../shared/remote-runtime/requests/remote-runtime-subscription-transport' import type { RemoteRuntimeTransportSubscription } from '../../../../shared/remote-runtime/requests/remote-runtime-subscription-contract' diff --git a/src/main/wsl/orcad/wsl-orcad-deploy-app-update.test.ts b/src/main/wsl/orcad/wsl-orcad-deploy-app-update.test.ts index 06252bebd44..79e3def493f 100644 --- a/src/main/wsl/orcad/wsl-orcad-deploy-app-update.test.ts +++ b/src/main/wsl/orcad/wsl-orcad-deploy-app-update.test.ts @@ -44,7 +44,7 @@ vi.mock('../../managed-server/activation/orcad-running-version-adoption', () => adoptRunningOrcadVersion: mocks.adoptRunning })) -vi.mock('../../../shared/app-environment', () => ({ +vi.mock('../../../shared/app-lifecycle/app-environment', () => ({ getAppEnvironment: () => ({ getVersion: () => '1.5.0', getPath: () => '/user-data' }) })) vi.mock('../../ssh/remote-exec/remote-exec-command', () => ({ execCommand: mocks.exec })) diff --git a/src/main/wsl/orcad/wsl-orcad-deploy.test.ts b/src/main/wsl/orcad/wsl-orcad-deploy.test.ts index 682a54a6756..aea1fdcd91a 100644 --- a/src/main/wsl/orcad/wsl-orcad-deploy.test.ts +++ b/src/main/wsl/orcad/wsl-orcad-deploy.test.ts @@ -46,7 +46,7 @@ vi.mock('../../managed-server/activation/orcad-running-version-adoption', () => adoptRunningOrcadVersion: mocks.adoptRunning })) -vi.mock('../../../shared/app-environment', () => ({ +vi.mock('../../../shared/app-lifecycle/app-environment', () => ({ getAppEnvironment: () => ({ getVersion: () => '1.5.0', getPath: () => '/user-data' }) })) vi.mock('../../ssh/remote-exec/remote-exec-command', () => ({ execCommand: mocks.exec })) diff --git a/src/main/wsl/orcad/wsl-orcad-deploy.ts b/src/main/wsl/orcad/wsl-orcad-deploy.ts index 64969c537f2..d611057f2b6 100644 --- a/src/main/wsl/orcad/wsl-orcad-deploy.ts +++ b/src/main/wsl/orcad/wsl-orcad-deploy.ts @@ -1,7 +1,7 @@ import type { WslHostDeferredUpdate } from '../../../shared/remote-runtime/wsl-hosts/wsl-host-types' import type { WslOrcadLaunch, WslOrcadDeployOptions } from './wsl-orcad-launch-contract' /** D1/D2b/D8 reuse SSH installation, activation journals/fences and admission over wsl.exe. C5 pairs through the reported loopback port. */ -import { getAppEnvironment } from '../../../shared/app-environment' +import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { ORCAD_MANAGED_REMOTE_PORT } from '../../../shared/remote-runtime/orcad-lifecycle/orcad-managed-runtime' import type { ServeReadiness } from '../../server/serve-readiness' diff --git a/src/main/wsl/orcad/wsl-orcad-real-distro-idle-release-lane.test.ts b/src/main/wsl/orcad/wsl-orcad-real-distro-idle-release-lane.test.ts index 34e1efcd43a..2251ee69763 100644 --- a/src/main/wsl/orcad/wsl-orcad-real-distro-idle-release-lane.test.ts +++ b/src/main/wsl/orcad/wsl-orcad-real-distro-idle-release-lane.test.ts @@ -11,8 +11,8 @@ import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest' vi.mock('electron', () => ({ app: { getAppPath: () => process.cwd() } })) -import { setAppEnvironment } from '../../../shared/app-environment' -import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../shared/electron-remote-runtime-client-capabilities' +import { setAppEnvironment } from '../../../shared/app-lifecycle/app-environment' +import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../shared/remote-runtime/protocol/electron-remote-runtime-client-capabilities' import { ORCAD_E2E_IDLE_TIMEOUT_ENV } from '../../../shared/remote-runtime/orcad-lifecycle/orcad-idle-exit' import { pairedRuntimeConnectionFromOffer } from '../../../shared/remote-runtime/pairing/paired-runtime-connection' import { parsePairingCode } from '../../../shared/remote-runtime/pairing/pairing' diff --git a/src/main/wsl/orcad/wsl-orcad-real-distro-lane.test.ts b/src/main/wsl/orcad/wsl-orcad-real-distro-lane.test.ts index 7e083893ecc..45b3ca9226b 100644 --- a/src/main/wsl/orcad/wsl-orcad-real-distro-lane.test.ts +++ b/src/main/wsl/orcad/wsl-orcad-real-distro-lane.test.ts @@ -10,8 +10,8 @@ import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest' vi.mock('electron', () => ({ app: { getAppPath: () => process.cwd() } })) import { runProcess } from '@orca/process-host' -import { setAppEnvironment } from '../../../shared/app-environment' -import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../shared/electron-remote-runtime-client-capabilities' +import { setAppEnvironment } from '../../../shared/app-lifecycle/app-environment' +import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../shared/remote-runtime/protocol/electron-remote-runtime-client-capabilities' import { pairedRuntimeConnectionFromOffer } from '../../../shared/remote-runtime/pairing/paired-runtime-connection' import { parsePairingCode } from '../../../shared/remote-runtime/pairing/pairing' import { sendRemoteRuntimeRequestOnSocket } from '../../../shared/remote-runtime/requests/remote-runtime-request-socket' diff --git a/src/main/wsl/orcad/wsl-orcad-update-move-hold-driver.test.ts b/src/main/wsl/orcad/wsl-orcad-update-move-hold-driver.test.ts index afc564d3b6f..89a1a9c66d0 100644 --- a/src/main/wsl/orcad/wsl-orcad-update-move-hold-driver.test.ts +++ b/src/main/wsl/orcad/wsl-orcad-update-move-hold-driver.test.ts @@ -7,7 +7,7 @@ */ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { fakeAppEnvironment } from '../../../../config/scripts/test-runtime/environment/vitest-host-ports-setup' -import { setAppEnvironment } from '../../../shared/app-environment' +import { setAppEnvironment } from '../../../shared/app-lifecycle/app-environment' import { WSL_HOSTS_INTERNAL_GATE_ENV } from '../../../shared/remote-runtime/wsl-hosts/wsl-host-internal-gate' import { ORCAD_UPDATE_WSL_MOVE_RUNNING_CODE } from '../../../shared/remote-runtime/wsl-hosts/wsl-host-types' import type { WslMoveResult } from '../../../shared/wsl-move/wsl-move-driver-types' diff --git a/src/preload/api/agent-status/agent-awake-bridge.ts b/src/preload/api/agent-status/agent-awake-bridge.ts index c916a71d1e6..1959baa97d6 100644 --- a/src/preload/api/agent-status/agent-awake-bridge.ts +++ b/src/preload/api/agent-status/agent-awake-bridge.ts @@ -1,5 +1,5 @@ import { ipcRenderer } from 'electron' -import type { ComputerAwakeStatus } from '../../../shared/computer-awake-mode' +import type { ComputerAwakeStatus } from '../../../shared/app-lifecycle/computer-awake-mode' import type { PreloadApi } from '../../api-types' export const agentAwakeApi = { diff --git a/src/preload/api/agent-status/agent-status-api.ts b/src/preload/api/agent-status/agent-status-api.ts index d6ac9bd64ea..ddd35370738 100644 --- a/src/preload/api/agent-status/agent-status-api.ts +++ b/src/preload/api/agent-status/agent-status-api.ts @@ -6,7 +6,7 @@ import type { } from '../../../shared/agent-status/contracts/agent-status-ipc-payload' import type { AgentInterruptInferenceRequest } from '../../../shared/agent-status/lifecycle/agent-interrupt-intent' import type { AgentQuestionAnsweredInferenceRequest } from '../../../shared/agent-status/lifecycle/agent-question-answered-intent' -import type { ComputerAwakeStatus } from '../../../shared/computer-awake-mode' +import type { ComputerAwakeStatus } from '../../../shared/app-lifecycle/computer-awake-mode' import type { AgentListPublication } from '../../../shared/agent-status/presentation/agent-list-status' export type AgentStatusApi = { diff --git a/src/preload/api/app-api.ts b/src/preload/api/app-api.ts index 6cf0e1c6585..f6853c3bdc6 100644 --- a/src/preload/api/app-api.ts +++ b/src/preload/api/app-api.ts @@ -1,6 +1,6 @@ import type { UiLanguageDetection } from '../../shared/ui-locale' -import type { WindowMaterial } from '../../shared/window-material' -import type { AppIdentity } from '../../shared/app-identity' +import type { WindowMaterial } from '../../shared/app-lifecycle/windows/window-material' +import type { AppIdentity } from '../../shared/app-lifecycle/identity/app-identity' import type { MacosUpgradeSupport } from '../../shared/updater/requirements/macos-upgrade-support' import type { E2EConfig } from '../../shared/e2e-config' import type { ExecutionHostId } from '../../shared/execution-host' diff --git a/src/preload/api/app-bridge.ts b/src/preload/api/app-bridge.ts index 8d804b1e04b..bcaf921ed42 100644 --- a/src/preload/api/app-bridge.ts +++ b/src/preload/api/app-bridge.ts @@ -1,5 +1,5 @@ import { ipcRenderer } from 'electron' -import type { AppIdentity } from '../../shared/app-identity' +import type { AppIdentity } from '../../shared/app-lifecycle/identity/app-identity' import type { MacosUpgradeSupport } from '../../shared/updater/requirements/macos-upgrade-support' import type { FloatingTerminalCwdRequest } from '../../shared/ui-chrome-types' import type { MacCapturedDigitRowChord } from '../../shared/keybindings/macos-symbolic-hotkeys' diff --git a/src/preload/api/cli-install/cli-bridge.ts b/src/preload/api/cli-install/cli-bridge.ts index 5b780534fd3..fdcfc2228a0 100644 --- a/src/preload/api/cli-install/cli-bridge.ts +++ b/src/preload/api/cli-install/cli-bridge.ts @@ -1,5 +1,5 @@ import { ipcRenderer } from 'electron' -import type { CliInstallStatus } from '../../../shared/cli-install-types' +import type { CliInstallStatus } from '../../../shared/cli/cli-install-types' import type { PreloadApi } from '../../api-types' export const cliApi = { diff --git a/src/preload/api/cli-install/cli-install-api.ts b/src/preload/api/cli-install/cli-install-api.ts index e01b7e18249..2881dc0f974 100644 --- a/src/preload/api/cli-install/cli-install-api.ts +++ b/src/preload/api/cli-install/cli-install-api.ts @@ -1,4 +1,4 @@ -import type { CliInstallStatus } from '../../../shared/cli-install-types' +import type { CliInstallStatus } from '../../../shared/cli/cli-install-types' export type CliApi = { getInstallStatus: () => Promise diff --git a/src/preload/api/platform-bridge.ts b/src/preload/api/platform-bridge.ts index 534cd0d80cc..0eb3860fff9 100644 --- a/src/preload/api/platform-bridge.ts +++ b/src/preload/api/platform-bridge.ts @@ -1,5 +1,5 @@ import { getLinuxDisplayServer } from '../renderer/renderer-runtime' -import { parseWindowMaterialArgument } from '../../shared/window-material' +import { parseWindowMaterialArgument } from '../../shared/app-lifecycle/windows/window-material' import type { PreloadApi } from '../api-types' type PlatformInfo = ReturnType diff --git a/src/preload/api/profiles/orca-profile-api.ts b/src/preload/api/profiles/orca-profile-api.ts index 21c5f4262e8..9b8e2fc4972 100644 --- a/src/preload/api/profiles/orca-profile-api.ts +++ b/src/preload/api/profiles/orca-profile-api.ts @@ -24,7 +24,7 @@ import type { SwitchOrcaProfileResult, TransferOrcaProfileProjectArgs, TransferOrcaProfileProjectResult -} from '../../../shared/orca-profiles' +} from '../../../shared/orca-profiles/orca-profiles' export type OrcaProfileApi = { list: () => Promise diff --git a/src/preload/api/profiles/orca-profiles-bridge.ts b/src/preload/api/profiles/orca-profiles-bridge.ts index 0a005e384c3..f62d17acbf1 100644 --- a/src/preload/api/profiles/orca-profiles-bridge.ts +++ b/src/preload/api/profiles/orca-profiles-bridge.ts @@ -7,7 +7,7 @@ import { type OrcaProfileListResult, type SwitchOrcaProfileResult, type TransferOrcaProfileProjectResult -} from '../../../shared/orca-profiles' +} from '../../../shared/orca-profiles/orca-profiles' import { prepareAndInvokeAppRestart } from '../../renderer/restart/renderer-restart-wiring' import { awaitBeforeUnloadCheckpoint } from '../../renderer/renderer-runtime' diff --git a/src/preload/api/terminal/pty-api.ts b/src/preload/api/terminal/pty-api.ts index b22414759cd..e6f3eaf8e37 100644 --- a/src/preload/api/terminal/pty-api.ts +++ b/src/preload/api/terminal/pty-api.ts @@ -1,5 +1,5 @@ import type { RuntimeTerminalAttention } from '../../../shared/terminal/runtime/runtime-terminal-contracts' -import type { PaintedRestorePane } from '../../../shared/painted-restore-ack' +import type { PaintedRestorePane } from '../../../shared/terminal/replay/painted-restore-ack' import type { PtyFencedTerminationRequest, PtyFencedTerminationOutcome @@ -46,7 +46,7 @@ import type { CodexSharedServerStatus } from '../../../shared/agent-launch/start import type { NewerDaemonHeldScreen, NewerDaemonReopenResult -} from '../../../shared/newer-daemon-hold' +} from '../../../shared/terminal/daemon/newer-daemon-hold' export type PtyApi = { spawn: (opts: { diff --git a/src/preload/api/terminal/pty-bridge-session-control.ts b/src/preload/api/terminal/pty-bridge-session-control.ts index bdfb4ea5969..c57181a33ac 100644 --- a/src/preload/api/terminal/pty-bridge-session-control.ts +++ b/src/preload/api/terminal/pty-bridge-session-control.ts @@ -1,5 +1,5 @@ import type { RuntimeTerminalAttention } from '../../../shared/terminal/runtime/runtime-terminal-contracts' -import type { PaintedRestorePane } from '../../../shared/painted-restore-ack' +import type { PaintedRestorePane } from '../../../shared/terminal/replay/painted-restore-ack' import type { PtyFencedTerminationRequest, PtyFencedTerminationOutcome diff --git a/src/preload/api/terminal/pty-bridge-stream-and-serialization.ts b/src/preload/api/terminal/pty-bridge-stream-and-serialization.ts index 7b6793e2913..426826191f1 100644 --- a/src/preload/api/terminal/pty-bridge-stream-and-serialization.ts +++ b/src/preload/api/terminal/pty-bridge-stream-and-serialization.ts @@ -8,7 +8,7 @@ import type { CodexSharedServerStatus } from '../../../shared/agent-launch/start import type { NewerDaemonHeldScreen, NewerDaemonReopenResult -} from '../../../shared/newer-daemon-hold' +} from '../../../shared/terminal/daemon/newer-daemon-hold' export const ptyStreamAndSerializationApi = { inspectProcess: ( diff --git a/src/preload/api/terminal/pty-management-api.ts b/src/preload/api/terminal/pty-management-api.ts index bef8c8ea533..a9442fe107b 100644 --- a/src/preload/api/terminal/pty-management-api.ts +++ b/src/preload/api/terminal/pty-management-api.ts @@ -1,5 +1,5 @@ import type { DaemonPtyCwdClass } from '../../../shared/telemetry/daemon-adoption-telemetry' -import type { DaemonAsyncIoStatus } from '../../../shared/daemon-async-io-health' +import type { DaemonAsyncIoStatus } from '../../../shared/terminal/daemon/daemon-async-io-health' // Mirrors DaemonSessionInfo; preload cannot import main-only daemon protocol types. export type PtyManagementSession = { diff --git a/src/preload/api/updater/updater-api.ts b/src/preload/api/updater/updater-api.ts index 8630691d70b..f2ec6c50d75 100644 --- a/src/preload/api/updater/updater-api.ts +++ b/src/preload/api/updater/updater-api.ts @@ -3,8 +3,8 @@ import type { ReleaseBuildListResult, UpdateCheckOptions, UpdateStatus -} from '../../../shared/update-status-types' -import type { ReleaseChannel } from '../../../shared/release-channel' +} from '../../../shared/updater/update-status-types' +import type { ReleaseChannel } from '../../../shared/updater/release-channel' export type UpdaterApi = { getVersion: () => Promise diff --git a/src/preload/api/updater/updater-bridge.ts b/src/preload/api/updater/updater-bridge.ts index 3f393615e9b..5445ad0fe61 100644 --- a/src/preload/api/updater/updater-bridge.ts +++ b/src/preload/api/updater/updater-bridge.ts @@ -1,5 +1,5 @@ import { ipcRenderer } from 'electron' -import type { UpdateStatus } from '../../../shared/update-status-types' +import type { UpdateStatus } from '../../../shared/updater/update-status-types' import { prepareAndInvokeUpdaterInstall } from '../../renderer/restart/renderer-restart-wiring' import { awaitBeforeUnloadCheckpoint, updaterQuitAbortRelay } from '../../renderer/renderer-runtime' import type { PreloadApi } from '../../api-types' diff --git a/src/preload/api/window-ui/app-icon-api.ts b/src/preload/api/window-ui/app-icon-api.ts index c3a48f85be3..f2e4d0583b6 100644 --- a/src/preload/api/window-ui/app-icon-api.ts +++ b/src/preload/api/window-ui/app-icon-api.ts @@ -1,4 +1,4 @@ -import type { CustomAppIconImportResult } from '../../../shared/app-icon' +import type { CustomAppIconImportResult } from '../../../shared/app-lifecycle/identity/app-icon' export type AppIconApi = { importCustom: () => Promise diff --git a/src/preload/index.ts b/src/preload/index.ts index 7e08844088a..8c17a317e30 100644 --- a/src/preload/index.ts +++ b/src/preload/index.ts @@ -1,5 +1,5 @@ import { contextBridge, ipcRenderer } from 'electron' -import { HIDDEN_WINDOW_FRAME_PUMP_STOP_CHANNEL } from '../shared/hidden-window-frame-pump' +import { HIDDEN_WINDOW_FRAME_PUMP_STOP_CHANNEL } from '../shared/app-lifecycle/windows/hidden-window-frame-pump' import { installHiddenWindowFramePump } from './renderer/hidden-window-frame-pump' import type { PreloadApi } from './api-types' import { installBrowserFindListener } from './renderer/renderer-runtime' diff --git a/src/preload/renderer/hidden-window-frame-pump.ts b/src/preload/renderer/hidden-window-frame-pump.ts index 015ae7ff6b2..eaebd5cac83 100644 --- a/src/preload/renderer/hidden-window-frame-pump.ts +++ b/src/preload/renderer/hidden-window-frame-pump.ts @@ -1,7 +1,7 @@ import { HIDDEN_WINDOW_FRAME_PUMP_INTERVAL_MS, hasHiddenWindowFramePumpArgument -} from '../../shared/hidden-window-frame-pump' +} from '../../shared/app-lifecycle/windows/hidden-window-frame-pump' // Near-black so the single damaged frame is indistinguishable even if the window were visible. const FLIP_COLOR = 'rgb(1, 1, 1)' diff --git a/src/preload/renderer/renderer-runtime.ts b/src/preload/renderer/renderer-runtime.ts index 5ffe46e0241..e4f8cc4d53c 100644 --- a/src/preload/renderer/renderer-runtime.ts +++ b/src/preload/renderer/renderer-runtime.ts @@ -5,16 +5,16 @@ import { prepareAndInvokeAppRestart, registerRendererRestartIpcRelays } from './restart/renderer-restart-wiring' -import { createUpdaterQuitAbortRelay } from '../../shared/renderer-restart-preparation' +import { createUpdaterQuitAbortRelay } from '../../shared/app-lifecycle/shutdown/renderer-restart-preparation' import { formatShutdownCheckpointFailureReason, ORCA_NATIVE_UNLOAD_FAILED_EVENT, publishShutdownCheckpointFailureReason -} from '../../shared/renderer-shutdown-events' +} from '../../shared/app-lifecycle/shutdown/renderer-shutdown-events' import { ORCA_APP_RESTART_ABORTED_EVENT, ORCA_UPDATER_QUIT_AND_INSTALL_ABORTED_EVENT -} from '../../shared/updater-renderer-events' +} from '../../shared/updater/updater-renderer-events' export async function awaitBeforeUnloadCheckpoint(): Promise { const result = (await ipcRenderer.invoke('app:await-before-unload-checkpoint')) as { ok?: unknown diff --git a/src/preload/renderer/restart/app-restart-checkpoint-routing.test.ts b/src/preload/renderer/restart/app-restart-checkpoint-routing.test.ts index 2a9d6fdee60..631ffde85c2 100644 --- a/src/preload/renderer/restart/app-restart-checkpoint-routing.test.ts +++ b/src/preload/renderer/restart/app-restart-checkpoint-routing.test.ts @@ -1,6 +1,5 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import type { PreloadApi } from '../../api-types' -import { ORCA_APP_RESTART_STARTED_EVENT } from '../../../shared/updater-renderer-events' const { exposeInMainWorld, invoke, on, removeListener, send, sendSync, getPathForFile } = vi.hoisted(() => ({ @@ -69,61 +68,4 @@ describe('native preload destructive app actions', () => { 'Failed to persist renderer state before unload.' ) }) - - it('awaits renderer durability before profile maintenance and preserves its result', async () => { - const api = await loadApi() - const started = vi.fn() - eventTarget.addEventListener(ORCA_APP_RESTART_STARTED_EVENT, started) - let finishCheckpoint = (_result: { ok: boolean }): void => {} - const checkpoint = new Promise((resolve) => { - finishCheckpoint = resolve - }) - const result = { status: 'relaunching' } - invoke.mockImplementation((channel: string) => - channel === 'app:await-before-unload-checkpoint' ? checkpoint : Promise.resolve(result) - ) - - const switching = api.orcaProfiles.switchProfile({ profileId: 'target' }) - await vi.waitFor(() => - expect(invoke).toHaveBeenCalledWith('app:await-before-unload-checkpoint') - ) - expect(started).toHaveBeenCalledOnce() - expect(invoke).not.toHaveBeenCalledWith('orcaProfiles:switch', expect.anything()) - finishCheckpoint({ ok: true }) - await expect(switching).resolves.toBe(result) - expect(invoke).toHaveBeenLastCalledWith('orcaProfiles:switch', { profileId: 'target' }) - }) - - it.each([ - { durable: { ok: true }, reply: true }, - { durable: { ok: false }, reply: false } - ])( - 'answers a main-initiated reload only with the durable save verdict', - async ({ durable, reply }) => { - await loadApi() - const prepare = on.mock.calls.find( - ([channel]) => channel === 'app:prepare-native-unload' - )?.[1] - let finishCheckpoint = (_result: { ok: boolean }): void => {} - invoke.mockImplementation( - () => - new Promise((resolve) => { - finishCheckpoint = resolve - }) - ) - - prepare({}, 'reload-1') - await vi.waitFor(() => - expect(invoke).toHaveBeenCalledWith('app:await-before-unload-checkpoint') - ) - expect(send).not.toHaveBeenCalledWith('app:native-unload-prepared', expect.anything()) - finishCheckpoint(durable) - await vi.waitFor(() => - expect(send).toHaveBeenCalledWith('app:native-unload-prepared', { - requestId: 'reload-1', - ok: reply - }) - ) - } - ) }) diff --git a/src/preload/renderer/restart/renderer-restart-wiring.test.ts b/src/preload/renderer/restart/renderer-restart-wiring.test.ts index dd382790100..51b68f9f1c6 100644 --- a/src/preload/renderer/restart/renderer-restart-wiring.test.ts +++ b/src/preload/renderer/restart/renderer-restart-wiring.test.ts @@ -1,13 +1,7 @@ import { describe, expect, it, vi } from 'vitest' -import { - ORCA_APP_RESTART_ABORTED_EVENT, - ORCA_UPDATER_QUIT_AND_INSTALL_STARTED_EVENT -} from '../../../shared/updater-renderer-events' -import { - prepareAndInvokeAppRestart, - prepareAndInvokeUpdaterInstall -} from './renderer-restart-wiring' +import { ORCA_APP_RESTART_ABORTED_EVENT } from '../../../shared/updater/updater-renderer-events' +import { prepareAndInvokeAppRestart } from './renderer-restart-wiring' describe('renderer restart wiring', () => { it('refuses overlapping preparation without abandoning the accepted restart', async () => { @@ -27,43 +21,4 @@ describe('renderer restart wiring', () => { await expect(first).resolves.toBe(true) expect(invoke).toHaveBeenCalledOnce() }) - - it('marks preparation before invoking main and aborts on IPC failure', async () => { - const eventTarget = new EventTarget() - const calls: string[] = [] - eventTarget.addEventListener(ORCA_UPDATER_QUIT_AND_INSTALL_STARTED_EVENT, () => { - calls.push('prepared') - }) - const relay = { - markPrepared: () => calls.push('marked'), - abort: () => calls.push('aborted') - } - const invoke = vi.fn(async () => { - calls.push('invoked') - throw new Error('IPC failed') - }) - - await expect( - prepareAndInvokeUpdaterInstall(eventTarget, relay, invoke, async () => { - calls.push('checkpoint-flushed') - }) - ).rejects.toThrow('IPC failed') - - expect(calls).toEqual(['prepared', 'checkpoint-flushed', 'marked', 'invoked', 'aborted']) - }) - - it('never installs the update when the shutdown checkpoint fails to persist', async () => { - const eventTarget = new EventTarget() - const invoke = vi.fn(() => Promise.resolve()) - const relay = { markPrepared: vi.fn(), abort: vi.fn() } - - await expect( - prepareAndInvokeUpdaterInstall(eventTarget, relay, invoke, () => - Promise.reject(new Error('Failed to persist renderer state before unload.')) - ) - ).rejects.toThrow('Failed to persist renderer state before unload.') - - expect(invoke).not.toHaveBeenCalled() - expect(relay.markPrepared).not.toHaveBeenCalled() - }) }) diff --git a/src/preload/renderer/restart/renderer-restart-wiring.ts b/src/preload/renderer/restart/renderer-restart-wiring.ts index eeed8069f01..ff12c5f7bfa 100644 --- a/src/preload/renderer/restart/renderer-restart-wiring.ts +++ b/src/preload/renderer/restart/renderer-restart-wiring.ts @@ -1,16 +1,16 @@ import type { IpcRenderer } from 'electron' -import { ORCA_RENDERER_UNLOAD_PREVENTED_EVENT } from '../../../shared/renderer-shutdown-events' +import { ORCA_RENDERER_UNLOAD_PREVENTED_EVENT } from '../../../shared/app-lifecycle/shutdown/renderer-shutdown-events' import { prepareRendererForAppRestart, type UpdaterQuitAbortRelay -} from '../../../shared/renderer-restart-preparation' -import type { UpdateStatus } from '../../../shared/update-status-types' +} from '../../../shared/app-lifecycle/shutdown/renderer-restart-preparation' +import type { UpdateStatus } from '../../../shared/updater/update-status-types' import { ORCA_APP_RESTART_ABORTED_EVENT, ORCA_APP_RESTART_STARTED_EVENT, ORCA_UPDATER_QUIT_AND_INSTALL_ABORTED_EVENT, ORCA_UPDATER_QUIT_AND_INSTALL_STARTED_EVENT -} from '../../../shared/updater-renderer-events' +} from '../../../shared/updater/updater-renderer-events' type AppRestartState = { committed: boolean; pending: boolean } const appRestartStates = new WeakMap() diff --git a/src/renderer/src/app-shell/AppRootSurfaces.tsx b/src/renderer/src/app-shell/AppRootSurfaces.tsx index 8bb0e71ede1..35f98418b86 100644 --- a/src/renderer/src/app-shell/AppRootSurfaces.tsx +++ b/src/renderer/src/app-shell/AppRootSurfaces.tsx @@ -21,7 +21,7 @@ import { WslMoveDialogHost } from '../components/wsl-move/WslMoveDialog' import { MacosUpdateRequirementHost } from '../components/macos-update-requirement/MacosUpdateRequirementHost' import { shouldRenderPetOverlay } from '../components/pet/pet-overlay-visibility' import { useAppStore } from '../store/index' -import type { UpdateStatus } from '../../../shared/update-status-types' +import type { UpdateStatus } from '../../../shared/updater/update-status-types' import { useLazyModalMounts } from './use-lazy-modal-mounts' import { AppNotificationCards } from './AppNotificationCards' import { usePreloadWorktreeJumpPalette, WorktreeJumpPalette } from './worktree-jump-palette-preload' diff --git a/src/renderer/src/app-shell/appearance/window-material-runtime.ts b/src/renderer/src/app-shell/appearance/window-material-runtime.ts index 26652aed987..ebea93ec630 100644 --- a/src/renderer/src/app-shell/appearance/window-material-runtime.ts +++ b/src/renderer/src/app-shell/appearance/window-material-runtime.ts @@ -1,4 +1,7 @@ -import type { WindowMaterial, WindowMaterialHost } from '../../../../shared/window-material' +import type { + WindowMaterial, + WindowMaterialHost +} from '../../../../shared/app-lifecycle/windows/window-material' import { getRendererAppPlatform } from '../platform/renderer-app-platform' let material: WindowMaterial | undefined diff --git a/src/renderer/src/app-shell/platform/client-environment-info.ts b/src/renderer/src/app-shell/platform/client-environment-info.ts index 3e4f5cef314..6fd527e18b7 100644 --- a/src/renderer/src/app-shell/platform/client-environment-info.ts +++ b/src/renderer/src/app-shell/platform/client-environment-info.ts @@ -1,7 +1,7 @@ import { formatClientEnvironmentFooter, type ClientEnvironmentInfo -} from '../../../../shared/client-environment-info' +} from '../../../../shared/feedback/client-environment-info' import { getRendererAppPlatform } from './renderer-app-platform' export async function resolveClientEnvironmentInfo(): Promise { diff --git a/src/renderer/src/app-shell/shutdown-checkpoint-persist.ts b/src/renderer/src/app-shell/shutdown-checkpoint-persist.ts index fc68ea42f6f..56e4c74f3ce 100644 --- a/src/renderer/src/app-shell/shutdown-checkpoint-persist.ts +++ b/src/renderer/src/app-shell/shutdown-checkpoint-persist.ts @@ -1,5 +1,5 @@ import type { PersistedUIState } from '../../../shared/persisted-ui-state-types' -import { formatShutdownCheckpointFailureReason } from '../../../shared/renderer-shutdown-events' +import { formatShutdownCheckpointFailureReason } from '../../../shared/app-lifecycle/shutdown/renderer-shutdown-events' import type { WorkspaceSessionHostSnapshot } from '../lib/workspace/persistence/workspace-session-host-persistence' import { recordRendererCrashBreadcrumb } from '../diagnostics/crash-reporting/crash-breadcrumb-recorder' diff --git a/src/renderer/src/app-shell/shutdown/shutdown-checkpoint-failure-toast.ts b/src/renderer/src/app-shell/shutdown/shutdown-checkpoint-failure-toast.ts index 8f08f58b14d..5fcce2217dd 100644 --- a/src/renderer/src/app-shell/shutdown/shutdown-checkpoint-failure-toast.ts +++ b/src/renderer/src/app-shell/shutdown/shutdown-checkpoint-failure-toast.ts @@ -1,6 +1,6 @@ import { toast } from 'sonner' import { translate } from '@/i18n/i18n' -import { consumeShutdownCheckpointFailureReason } from '../../../../shared/renderer-shutdown-events' +import { consumeShutdownCheckpointFailureReason } from '../../../../shared/app-lifecycle/shutdown/renderer-shutdown-events' export function showShutdownCheckpointFailureToast( canceledAction: 'quit' | 'reload' = 'quit' diff --git a/src/renderer/src/app-shell/shutdown/shutdown-checkpoint-guard.ts b/src/renderer/src/app-shell/shutdown/shutdown-checkpoint-guard.ts index 37eff4da062..1c70392abad 100644 --- a/src/renderer/src/app-shell/shutdown/shutdown-checkpoint-guard.ts +++ b/src/renderer/src/app-shell/shutdown/shutdown-checkpoint-guard.ts @@ -4,7 +4,7 @@ import { ORCA_RENDERER_SHUTDOWN_CHECKPOINT_FAILED_EVENT, ORCA_RENDERER_UNLOAD_PREVENTED_EVENT, publishShutdownCheckpointFailureReason -} from '../../../../shared/renderer-shutdown-events' +} from '../../../../shared/app-lifecycle/shutdown/renderer-shutdown-events' import { recordRendererCrashBreadcrumb } from '../../diagnostics/crash-reporting/crash-breadcrumb-recorder' export type ShutdownCheckpointGuard = { diff --git a/src/renderer/src/app-shell/startup/lazy-chunk-recovery-reload.ts b/src/renderer/src/app-shell/startup/lazy-chunk-recovery-reload.ts index 52984e70057..31dce902da6 100644 --- a/src/renderer/src/app-shell/startup/lazy-chunk-recovery-reload.ts +++ b/src/renderer/src/app-shell/startup/lazy-chunk-recovery-reload.ts @@ -1,9 +1,9 @@ -import { prepareRendererForAppRestart } from '../../../../shared/renderer-restart-preparation' -import { ORCA_RENDERER_UNLOAD_PREVENTED_EVENT } from '../../../../shared/renderer-shutdown-events' +import { prepareRendererForAppRestart } from '../../../../shared/app-lifecycle/shutdown/renderer-restart-preparation' +import { ORCA_RENDERER_UNLOAD_PREVENTED_EVENT } from '../../../../shared/app-lifecycle/shutdown/renderer-shutdown-events' import { ORCA_APP_RESTART_ABORTED_EVENT, ORCA_APP_RESTART_STARTED_EVENT -} from '../../../../shared/updater-renderer-events' +} from '../../../../shared/updater/updater-renderer-events' // Bare reloads are vetoed by dirty tabs; restart preparation backs them up first. diff --git a/src/renderer/src/app-shell/updates/update-check-click-options.ts b/src/renderer/src/app-shell/updates/update-check-click-options.ts index a8fbca696dc..59081407c79 100644 --- a/src/renderer/src/app-shell/updates/update-check-click-options.ts +++ b/src/renderer/src/app-shell/updates/update-check-click-options.ts @@ -1,4 +1,4 @@ -import type { UpdateCheckOptions } from '../../../../shared/update-status-types' +import type { UpdateCheckOptions } from '../../../../shared/updater/update-status-types' import { translate } from '@/i18n/i18n' import { getShortcutPlatform } from '../../lib/keyboard/shortcut-platform' diff --git a/src/renderer/src/app-shell/updates/updater-beforeunload.ts b/src/renderer/src/app-shell/updates/updater-beforeunload.ts index d728bf22506..b594783a792 100644 --- a/src/renderer/src/app-shell/updates/updater-beforeunload.ts +++ b/src/renderer/src/app-shell/updates/updater-beforeunload.ts @@ -3,8 +3,8 @@ import { ORCA_APP_RESTART_STARTED_EVENT, ORCA_UPDATER_QUIT_AND_INSTALL_ABORTED_EVENT, ORCA_UPDATER_QUIT_AND_INSTALL_STARTED_EVENT -} from '../../../../shared/updater-renderer-events' -import { ORCA_RENDERER_SHUTDOWN_CHECKPOINT_ABORTED_EVENT } from '../../../../shared/renderer-shutdown-events' +} from '../../../../shared/updater/updater-renderer-events' +import { ORCA_RENDERER_SHUTDOWN_CHECKPOINT_ABORTED_EVENT } from '../../../../shared/app-lifecycle/shutdown/renderer-shutdown-events' let intentionalAppRestartInProgress = false diff --git a/src/renderer/src/app-shell/updates/updater-message-copy.ts b/src/renderer/src/app-shell/updates/updater-message-copy.ts index 7d1cca61568..8a07a056936 100644 --- a/src/renderer/src/app-shell/updates/updater-message-copy.ts +++ b/src/renderer/src/app-shell/updates/updater-message-copy.ts @@ -1,9 +1,9 @@ import { translate } from '@/i18n/i18n' -import type { LinuxPackageCommandUnavailableReason } from '../../../../shared/update-status-types' +import type { LinuxPackageCommandUnavailableReason } from '../../../../shared/updater/update-status-types' import { UPDATER_FAILURE_COPY, type UpdaterFailureCode -} from '../../../../shared/updater-failure-copy' +} from '../../../../shared/updater/updater-failure-copy' type Param = (name: string) => string | null type CountParam = (name: string) => number | null diff --git a/src/renderer/src/app-shell/use-app-session-persistence.ts b/src/renderer/src/app-shell/use-app-session-persistence.ts index ed3066625a4..55fcd901e87 100644 --- a/src/renderer/src/app-shell/use-app-session-persistence.ts +++ b/src/renderer/src/app-shell/use-app-session-persistence.ts @@ -30,12 +30,12 @@ import { import { ORCA_APP_RESTART_ABORTED_EVENT, ORCA_UPDATER_QUIT_AND_INSTALL_ABORTED_EVENT -} from '../../../shared/updater-renderer-events' +} from '../../../shared/updater/updater-renderer-events' import { ORCA_NATIVE_UNLOAD_FAILED_EVENT, ORCA_RENDERER_SHUTDOWN_CHECKPOINT_ABORTED_EVENT, ORCA_RENDERER_UNLOAD_PREVENTED_EVENT -} from '../../../shared/renderer-shutdown-events' +} from '../../../shared/app-lifecycle/shutdown/renderer-shutdown-events' // Capture unchanged-skipping resume records each minute to bound hard-kill loss. const SLEEPING_AGENT_RESUME_CAPTURE_INTERVAL_MS = 60_000 diff --git a/src/renderer/src/components/LinuxPackageInstallRecoveryCard.tsx b/src/renderer/src/components/LinuxPackageInstallRecoveryCard.tsx index 978cd18b89b..2cb05c67841 100644 --- a/src/renderer/src/components/LinuxPackageInstallRecoveryCard.tsx +++ b/src/renderer/src/components/LinuxPackageInstallRecoveryCard.tsx @@ -3,7 +3,7 @@ import { toast } from 'sonner' import type { LinuxPackageInstallInstructions, LinuxPackageInstallRecovery -} from '../../../shared/update-status-types' +} from '../../../shared/updater/update-status-types' import { UpdateErrorCardContent } from './UpdateErrorCardContent' import { translate } from '@/i18n/i18n' import { useTranslate } from '@/i18n/use-translate' diff --git a/src/renderer/src/components/UpdateCard.error-card.test.tsx b/src/renderer/src/components/UpdateCard.error-card.test.tsx index 839bb14ed30..e200d641e9a 100644 --- a/src/renderer/src/components/UpdateCard.error-card.test.tsx +++ b/src/renderer/src/components/UpdateCard.error-card.test.tsx @@ -1,7 +1,10 @@ // @vitest-environment happy-dom import { act, cleanup, fireEvent, render, screen, type RenderResult } from '@testing-library/react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { LinuxPackageInstallRecovery, UpdateStatus } from '../../../shared/update-status-types' +import type { + LinuxPackageInstallRecovery, + UpdateStatus +} from '../../../shared/updater/update-status-types' import { useAppStore } from '../store' import { UpdateCard } from './UpdateCard' import { NotificationCardStack } from './NotificationCardStack' @@ -94,24 +97,6 @@ afterEach(() => { useAppStore.setState(useAppStore.getInitialState(), true) }) -describe('UpdateCard Windows signature failures', () => { - it('does not offer the rejected version as a manual publisher-check bypass', () => { - const message = - 'New version 1.4.200 is not signed by the application owner: publisherNames: Orca' - renderAfterAvailableStatus() - - act(() => useAppStore.getState().setUpdateStatus({ state: 'error', message })) - - expect(screen.getByText("Update Wasn't Installed")).toBeTruthy() - expect(screen.getByText(/Don't install this download/)).toBeTruthy() - expect(screen.queryByText(message)).toBeNull() - - fireEvent.click(screen.getByRole('button', { name: 'Check official releases' })) - expect(openUrl).toHaveBeenCalledWith('https://github.com/stablyai/orca/releases') - expect(openUrl).not.toHaveBeenCalledWith(expect.stringContaining('/tag/')) - }) -}) - async function flushActions(): Promise { await act(async () => { for (let i = 0; i < 8; i += 1) { diff --git a/src/renderer/src/components/UpdateCard.tsx b/src/renderer/src/components/UpdateCard.tsx index f32f72c6e5d..04f86a8f3af 100644 --- a/src/renderer/src/components/UpdateCard.tsx +++ b/src/renderer/src/components/UpdateCard.tsx @@ -1,6 +1,6 @@ import { useCallback, useEffect, useRef, useState } from 'react' import { X } from 'lucide-react' -import type { ChangelogData } from '../../../shared/update-status-types' +import type { ChangelogData } from '../../../shared/updater/update-status-types' import { usePrefersReducedMotion } from '@/hooks/usePrefersReducedMotion' import { useAppStore } from '../store/index' import { Card } from './ui/card' diff --git a/src/renderer/src/components/UpdateErrorCardContent.tsx b/src/renderer/src/components/UpdateErrorCardContent.tsx index 9e6feffc17c..8367bfcb120 100644 --- a/src/renderer/src/components/UpdateErrorCardContent.tsx +++ b/src/renderer/src/components/UpdateErrorCardContent.tsx @@ -9,7 +9,7 @@ import { RotateCw, ShieldAlert } from 'lucide-react' -import type { UpdateInstallBlocker } from '../../../shared/update-status-types' +import type { UpdateInstallBlocker } from '../../../shared/updater/update-status-types' import { Button } from './ui/button' import { useTranslate } from '@/i18n/use-translate' diff --git a/src/renderer/src/components/artifacts/useArtifactPagination.ts b/src/renderer/src/components/artifacts/useArtifactPagination.ts index 2e768b877f2..6d42e719f78 100644 --- a/src/renderer/src/components/artifacts/useArtifactPagination.ts +++ b/src/renderer/src/components/artifacts/useArtifactPagination.ts @@ -4,7 +4,7 @@ import type { ArtifactListItem, ArtifactListPage } from '../../../../shared/artifacts/artifacts' -import type { OrcaProfileAuthStatus } from '../../../../shared/orca-profiles' +import type { OrcaProfileAuthStatus } from '../../../../shared/orca-profiles/orca-profiles' import { translate } from '@/i18n/i18n' import { callRuntimeRpc } from '@/runtime/rpc/calls/runtime-rpc-call' import { useAppStore } from '@/store' diff --git a/src/renderer/src/components/automations/hosts/automation-capability-probe.ts b/src/renderer/src/components/automations/hosts/automation-capability-probe.ts index a2a5c345482..fb57eb89678 100644 --- a/src/renderer/src/components/automations/hosts/automation-capability-probe.ts +++ b/src/renderer/src/components/automations/hosts/automation-capability-probe.ts @@ -12,7 +12,7 @@ import { } from '../../../../../shared/automations/automation-runtime-capabilities' import { getRuntimeEnvironmentStatus } from '@/runtime/rpc/compatibility/runtime-compatibility-probe' import type { AutomationAuthorityRef } from '../../../../../shared/automations/ownership/automation-owner-ref' -import type { RuntimeCapability } from '../../../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../../../shared/remote-runtime/protocol/protocol-version' import { EXTRA_AGENT_ARGS_HOST_UPDATE_REQUIRED, hasExtraAgentArgs diff --git a/src/renderer/src/components/automations/hosts/automation-target-availability.ts b/src/renderer/src/components/automations/hosts/automation-target-availability.ts index 0e7c7a50855..2c0e6b120aa 100644 --- a/src/renderer/src/components/automations/hosts/automation-target-availability.ts +++ b/src/renderer/src/components/automations/hosts/automation-target-availability.ts @@ -15,7 +15,7 @@ import type { Translate } from '@/i18n/use-translate' import { MIN_COMPATIBLE_RUNTIME_SERVER_VERSION, RUNTIME_PROTOCOL_VERSION -} from '../../../../../shared/protocol-version' +} from '../../../../../shared/remote-runtime/protocol/protocol-version' import type { AutomationHostTarget } from './automation-host-client' import type { SshConnectionState } from '../../../../../shared/remote-runtime/ssh/ssh-types' import type { ProjectHostSetup } from '../../../../../shared/project/project-types' diff --git a/src/renderer/src/components/browser-pane/client-hosted-browser-unavailable-notice.tsx b/src/renderer/src/components/browser-pane/client-hosted-browser-unavailable-notice.tsx index b629966cec6..7507b63a58b 100644 --- a/src/renderer/src/components/browser-pane/client-hosted-browser-unavailable-notice.tsx +++ b/src/renderer/src/components/browser-pane/client-hosted-browser-unavailable-notice.tsx @@ -13,7 +13,7 @@ import { ReopenBrowserPageOnServerButton, reopenOnServerCaveat } from './ReopenBrowserPageOnServerButton' -import '../../../../shared/protocol-version' +import '../../../../shared/remote-runtime/protocol/protocol-version' import { BROWSER_SCREENCAST_RUNTIME_CAPABILITY } from '../../../../shared/browser/runtime/browser-runtime-capabilities' /** No guest exists here to retry; offer reopening on a capable server when hosting is unavailable or belongs to another desktop. */ diff --git a/src/renderer/src/components/browser-pane/host-guest/browser-page-partition.ts b/src/renderer/src/components/browser-pane/host-guest/browser-page-partition.ts index e9e416cddf3..4e080a13ed5 100644 --- a/src/renderer/src/components/browser-pane/host-guest/browser-page-partition.ts +++ b/src/renderer/src/components/browser-pane/host-guest/browser-page-partition.ts @@ -1,6 +1,6 @@ import type { BrowserSessionProfile } from '../../../../../shared/browser/workspaces/browser-workspace-types' import { ORCA_BROWSER_PARTITION } from '../../../../../shared/browser/browser-session-partition' -import { getOrcaProfileBrowserDefaultPartition } from '../../../../../shared/orca-profiles' +import { getOrcaProfileBrowserDefaultPartition } from '../../../../../shared/orca-profiles/orca-profiles' import { unadmittedBrowserPartition } from '../../../../../shared/browser/profiles/browser-profile-scope' export function resolveBrowserPagePartition({ diff --git a/src/renderer/src/components/browser-pane/stream-remote/remote-browser-page-pane.tsx b/src/renderer/src/components/browser-pane/stream-remote/remote-browser-page-pane.tsx index 086f7b54a45..0bc97445954 100644 --- a/src/renderer/src/components/browser-pane/stream-remote/remote-browser-page-pane.tsx +++ b/src/renderer/src/components/browser-pane/stream-remote/remote-browser-page-pane.tsx @@ -1,6 +1,6 @@ import { useCallback, useEffect, useRef, useState } from 'react' import { useAppStore } from '@/store/index' -import '../../../../../shared/protocol-version' +import '../../../../../shared/remote-runtime/protocol/protocol-version' import { BROWSER_CERTIFICATE_TRUST_RUNTIME_CAPABILITY } from '../../../../../shared/browser/runtime/browser-runtime-capabilities' import type { BrowserPage as BrowserPageState } from '../../../../../shared/browser/workspaces/browser-workspace-types' import { runtimeEnvironmentSupportsCapability } from '@/runtime/rpc/compatibility/runtime-capability-proof' diff --git a/src/renderer/src/components/feature-tips/feature-tip-cli-install-action.ts b/src/renderer/src/components/feature-tips/feature-tip-cli-install-action.ts index dbf4364808a..7bd8b9fe633 100644 --- a/src/renderer/src/components/feature-tips/feature-tip-cli-install-action.ts +++ b/src/renderer/src/components/feature-tips/feature-tip-cli-install-action.ts @@ -1,4 +1,4 @@ -import type { CliInstallStatus } from '../../../../shared/cli-install-types' +import type { CliInstallStatus } from '../../../../shared/cli/cli-install-types' export type FeatureTipCliInstallResult = | { kind: 'installed'; status: CliInstallStatus } diff --git a/src/renderer/src/components/feature-tips/feature-tip-startup-gate.ts b/src/renderer/src/components/feature-tips/feature-tip-startup-gate.ts index 0fe1de387c7..9a86a6b1854 100644 --- a/src/renderer/src/components/feature-tips/feature-tip-startup-gate.ts +++ b/src/renderer/src/components/feature-tips/feature-tip-startup-gate.ts @@ -6,7 +6,7 @@ import { type FeatureTipSeenId } from '../../../../shared/feature-education/feature-tips' import { resolveAiVaultSearchSettings } from '../../../../shared/ai-vault/search/ai-vault-search-settings' -import type { CliInstallStatus } from '../../../../shared/cli-install-types' +import type { CliInstallStatus } from '../../../../shared/cli/cli-install-types' import type { FeatureInteractionState } from '../../../../shared/feature-education/interactions/feature-interactions' import type { GlobalSettings } from '../../../../shared/global-settings-types' import type { ChatUiLaunchTipVariant } from '../../../../shared/native-chat/chat-ui-launch-tip-audience' diff --git a/src/renderer/src/components/feature-wall/tour/KeepAwakeCard.tsx b/src/renderer/src/components/feature-wall/tour/KeepAwakeCard.tsx index 9fcaf918d96..12d8af3dce7 100644 --- a/src/renderer/src/components/feature-wall/tour/KeepAwakeCard.tsx +++ b/src/renderer/src/components/feature-wall/tour/KeepAwakeCard.tsx @@ -9,7 +9,7 @@ import { useTranslate } from '@/i18n/use-translate' import { computerAwakeSettingsForMode, normalizeComputerAwakeMode -} from '../../../../../shared/computer-awake-mode' +} from '../../../../../shared/app-lifecycle/computer-awake-mode' export function KeepAwakeCard(props: { settings: GlobalSettings diff --git a/src/renderer/src/components/machine-identity/MachineNameField.tsx b/src/renderer/src/components/machine-identity/MachineNameField.tsx index b06956b453c..d98889bedef 100644 --- a/src/renderer/src/components/machine-identity/MachineNameField.tsx +++ b/src/renderer/src/components/machine-identity/MachineNameField.tsx @@ -2,7 +2,7 @@ import { useAppStore } from '../../store/index' import { useTranslate } from '@/i18n/use-translate' import { isWebClientLocation } from '@/app-shell/platform/web-client-location' import { cn } from '@/lib/class-names' -import { MACHINE_NAME_MAX_LENGTH } from '../../../../shared/machine-name' +import { MACHINE_NAME_MAX_LENGTH } from '../../../../shared/remote-runtime/host-metadata/machine-name' import { DebouncedSettingsTextInput } from '../settings/form-controls/DebouncedSettingsTextInput' import { usePublishedMachineName } from './use-published-machine-name' diff --git a/src/renderer/src/components/machine-identity/use-published-machine-name.ts b/src/renderer/src/components/machine-identity/use-published-machine-name.ts index c97e31ee99a..5933010e1e6 100644 --- a/src/renderer/src/components/machine-identity/use-published-machine-name.ts +++ b/src/renderer/src/components/machine-identity/use-published-machine-name.ts @@ -1,5 +1,5 @@ import { useEffect, useState } from 'react' -import { normalizeMachineName } from '../../../../shared/machine-name' +import { normalizeMachineName } from '../../../../shared/remote-runtime/host-metadata/machine-name' /** Saved overrides already reached main; query runtime only for the detected name to avoid stale echoes. */ export function usePublishedMachineName(savedOverride: string): string | null { diff --git a/src/renderer/src/components/macos-update-requirement/MacosUpdateRequirementDialog.tsx b/src/renderer/src/components/macos-update-requirement/MacosUpdateRequirementDialog.tsx index f129adeea49..ddb01f4e678 100644 --- a/src/renderer/src/components/macos-update-requirement/MacosUpdateRequirementDialog.tsx +++ b/src/renderer/src/components/macos-update-requirement/MacosUpdateRequirementDialog.tsx @@ -4,7 +4,7 @@ import { isVenturaRequirement, type MacosUpgradeSupport } from '../../../../shared/updater/requirements/macos-upgrade-support' -import type { UnsupportedSystemUpdate } from '../../../../shared/update-status-types' +import type { UnsupportedSystemUpdate } from '../../../../shared/updater/update-status-types' import { Button } from '@/components/ui/button' import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible' import { diff --git a/src/renderer/src/components/macos-update-requirement/MacosUpdateRequirementNotice.tsx b/src/renderer/src/components/macos-update-requirement/MacosUpdateRequirementNotice.tsx index 6b72af15f00..76ce780c174 100644 --- a/src/renderer/src/components/macos-update-requirement/MacosUpdateRequirementNotice.tsx +++ b/src/renderer/src/components/macos-update-requirement/MacosUpdateRequirementNotice.tsx @@ -1,6 +1,6 @@ import { useEffect, useState, type JSX } from 'react' import type { MacosUpgradeSupport } from '../../../../shared/updater/requirements/macos-upgrade-support' -import type { UnsupportedSystemUpdate } from '../../../../shared/update-status-types' +import type { UnsupportedSystemUpdate } from '../../../../shared/updater/update-status-types' import { openAppHttpLink } from '@/lib/browser/navigation/app-http-link-open' import { useAppStore } from '@/store' import { MacosUpdateRequirementDialog } from './MacosUpdateRequirementDialog' diff --git a/src/renderer/src/components/maintenance/update-card/UpdateAvailableCardContent.tsx b/src/renderer/src/components/maintenance/update-card/UpdateAvailableCardContent.tsx index 1723f04f41d..bb2f402c5cc 100644 --- a/src/renderer/src/components/maintenance/update-card/UpdateAvailableCardContent.tsx +++ b/src/renderer/src/components/maintenance/update-card/UpdateAvailableCardContent.tsx @@ -1,5 +1,5 @@ import { X } from 'lucide-react' -import type { ChangelogData } from '../../../../../shared/update-status-types' +import type { ChangelogData } from '../../../../../shared/updater/update-status-types' import { Button } from '../../ui/button' import { useTranslate } from '@/i18n/use-translate' import { openAppHttpLink } from '@/lib/browser/navigation/app-http-link-open' diff --git a/src/renderer/src/components/maintenance/update-card/UpdateCardStateContent.tsx b/src/renderer/src/components/maintenance/update-card/UpdateCardStateContent.tsx index 4d993263ab7..96b2c3d29d6 100644 --- a/src/renderer/src/components/maintenance/update-card/UpdateCardStateContent.tsx +++ b/src/renderer/src/components/maintenance/update-card/UpdateCardStateContent.tsx @@ -3,8 +3,8 @@ import type { ChangelogData, LinuxPackageInstallRecovery, UpdateStatus -} from '../../../../../shared/update-status-types' -import { getReleaseNotesUrlForVersion } from '../../../../../shared/release-channel' +} from '../../../../../shared/updater/update-status-types' +import { getReleaseNotesUrlForVersion } from '../../../../../shared/updater/release-channel' import { UpdateErrorCardContent, type UpdateErrorCardModel } from '../../UpdateErrorCardContent' import { LinuxPackageInstallRecoveryCard } from '../../LinuxPackageInstallRecoveryCard' import { useTranslate } from '@/i18n/use-translate' diff --git a/src/renderer/src/components/maintenance/update-card/UpdateDownloadCardContent.tsx b/src/renderer/src/components/maintenance/update-card/UpdateDownloadCardContent.tsx index 02f3deaf0af..b4e0efeac94 100644 --- a/src/renderer/src/components/maintenance/update-card/UpdateDownloadCardContent.tsx +++ b/src/renderer/src/components/maintenance/update-card/UpdateDownloadCardContent.tsx @@ -1,6 +1,6 @@ import { Minus } from 'lucide-react' -import type { ChangelogData } from '../../../../../shared/update-status-types' -import { getReleaseNotesUrlForVersion } from '../../../../../shared/release-channel' +import type { ChangelogData } from '../../../../../shared/updater/update-status-types' +import { getReleaseNotesUrlForVersion } from '../../../../../shared/updater/release-channel' import { Button } from '../../ui/button' import { Progress } from '../../ui/progress' import { useTranslate } from '@/i18n/use-translate' diff --git a/src/renderer/src/components/maintenance/update-card/update-card-error-model.ts b/src/renderer/src/components/maintenance/update-card/update-card-error-model.ts index 89c9b62d9b3..eed274dc380 100644 --- a/src/renderer/src/components/maintenance/update-card/update-card-error-model.ts +++ b/src/renderer/src/components/maintenance/update-card/update-card-error-model.ts @@ -1,12 +1,12 @@ // @protected-copy: update signature and publisher warnings. import { getUpdateInstallBlockGuidance } from './update-install-block-guidance' -import type { UpdateStatus } from '../../../../../shared/update-status-types' +import type { UpdateStatus } from '../../../../../shared/updater/update-status-types' import type { UpdateErrorCardModel } from '../../UpdateErrorCardContent' import { isWindowsSignatureCheckUnavailableFailure, isWindowsSignatureMismatchFailure -} from '../../../../../shared/updater-windows-signature-check' -import { getReleaseNotesUrlForVersion } from '../../../../../shared/release-channel' +} from '../../../../../shared/updater/updater-windows-signature-check' +import { getReleaseNotesUrlForVersion } from '../../../../../shared/updater/release-channel' import { translate } from '@/i18n/i18n' import type { Translate } from '@/i18n/use-translate' import { updaterMessageText } from '@/app-shell/updates/updater-message-copy' diff --git a/src/renderer/src/components/maintenance/update-card/update-card-visibility.ts b/src/renderer/src/components/maintenance/update-card/update-card-visibility.ts index a10d4866ed1..55d7ffc2e28 100644 --- a/src/renderer/src/components/maintenance/update-card/update-card-visibility.ts +++ b/src/renderer/src/components/maintenance/update-card/update-card-visibility.ts @@ -1,6 +1,6 @@ import { translate } from '@/i18n/i18n' import type { Translate } from '@/i18n/use-translate' -import type { UpdateStatus } from '../../../../../shared/update-status-types' +import type { UpdateStatus } from '../../../../../shared/updater/update-status-types' export function isUpdateCardVisible({ status, diff --git a/src/renderer/src/components/maintenance/update-card/update-install-block-guidance.ts b/src/renderer/src/components/maintenance/update-card/update-install-block-guidance.ts index 3535bf1034b..f093ef3244d 100644 --- a/src/renderer/src/components/maintenance/update-card/update-install-block-guidance.ts +++ b/src/renderer/src/components/maintenance/update-card/update-install-block-guidance.ts @@ -1,6 +1,6 @@ import { translate } from '@/i18n/i18n' import type { Translate } from '@/i18n/use-translate' -import type { UpdateInstallBlock } from '../../../../../shared/update-status-types' +import type { UpdateInstallBlock } from '../../../../../shared/updater/update-status-types' export function getUpdateInstallBlockGuidance( block: UpdateInstallBlock, diff --git a/src/renderer/src/components/plugins/list/plugin-list-entries.ts b/src/renderer/src/components/plugins/list/plugin-list-entries.ts index 764aa305102..1f7a0b76fa0 100644 --- a/src/renderer/src/components/plugins/list/plugin-list-entries.ts +++ b/src/renderer/src/components/plugins/list/plugin-list-entries.ts @@ -8,7 +8,7 @@ import { pluginCatalogReleaseTypes, type PluginCatalogType } from '../../../../../shared/plugins/catalog/plugin-catalog-release' -import { compareAppVersions } from '../../../../../shared/app-version' +import { compareAppVersions } from '../../../../../shared/app-lifecycle/identity/app-version' import { gitRepositoryOwnerLabel, splitQualifiedPluginKey diff --git a/src/renderer/src/components/ports/WorkspacePortScanner.test.tsx b/src/renderer/src/components/ports/WorkspacePortScanner.test.tsx index bdd80d2afe5..11cec75dc2c 100644 --- a/src/renderer/src/components/ports/WorkspacePortScanner.test.tsx +++ b/src/renderer/src/components/ports/WorkspacePortScanner.test.tsx @@ -8,19 +8,19 @@ import { toRuntimeExecutionHostId } from '../../../../shared/execution-host' import { MIN_COMPATIBLE_RUNTIME_CLIENT_VERSION, RUNTIME_PROTOCOL_VERSION -} from '../../../../shared/protocol-version' +} from '../../../../shared/remote-runtime/protocol/protocol-version' import type { WorkspacePortScanResult } from '../../../../shared/workspace/ports/workspace-ports' import { clearRuntimeCompatibilityCache, markRuntimeEnvironmentCompatible } from '@/runtime/rpc/compatibility/runtime-compatibility-cache' -import { getWorkspacePortsByWorktreeId } from '@/lib/workspace-ports/workspace-port-groups' + import { useAppStore } from '@/store' import { WorkspacePortScanner } from './WorkspacePortScanner' const localScan = vi.fn() const runtimeEnvironmentCall = vi.fn() -const remoteScanKey = 'environment:env-1:all' + const remoteWorktreeId = 'repo-1::/remote/repo' let container: HTMLDivElement | null = null let root: Root | null = null @@ -52,35 +52,6 @@ const liveScan: WorkspacePortScanResult = { ] } -function addRemoteWorkspace(environmentId: string): void { - const state = useAppStore.getState() - const repoId = `repo-${environmentId}` - const path = `/remote/${environmentId}` - useAppStore.setState({ - repos: [ - ...state.repos, - { - id: repoId, - path, - displayName: environmentId, - connectionId: null, - executionHostId: toRuntimeExecutionHostId(environmentId) - } - ] as never, - worktreesByRepo: { - ...state.worktreesByRepo, - [repoId]: [ - { - id: `${repoId}::${path}`, - repoId, - path, - displayName: 'main' - } - ] - } as never - }) -} - function removeAllWorktrees(): void { const state = useAppStore.getState() useAppStore.setState({ @@ -90,12 +61,6 @@ function removeAllWorktrees(): void { }) } -function getPublishedRemoteWorktreePorts() { - return getWorkspacePortsByWorktreeId(useAppStore.getState().workspacePortScan?.result).get( - remoteWorktreeId - ) -} - const compatibleStatus = { runtimeId: 'env-1', graphStatus: 'ready', @@ -191,70 +156,6 @@ afterEach(() => { }) describe('WorkspacePortScanner', () => { - it('keeps an unchanged host scan when another execution host is added', async () => { - let env1Attempts = 0 - runtimeEnvironmentCall.mockImplementation(({ selector, method }) => { - if (method !== 'workspacePorts.scan') { - return Promise.resolve({ ok: false, error: { code: 'method_not_found', message: method } }) - } - if (selector !== 'env-1') { - return Promise.resolve({ ok: true, result: emptyScan }) - } - env1Attempts += 1 - return Promise.resolve({ ok: true, result: liveScan }) - }) - - await act(async () => { - root?.render() - await flushPromises() - }) - expect(useAppStore.getState().workspacePortScansByKey[remoteScanKey]).toBe(liveScan) - - markRuntimeEnvironmentCompatible('env-2') - await act(async () => { - addRemoteWorkspace('env-2') - await flushPromises() - }) - - expect(env1Attempts).toBe(1) - expect(runtimeEnvironmentCall).toHaveBeenCalledTimes(2) - expect(runtimeEnvironmentCall).toHaveBeenLastCalledWith({ - selector: 'env-2', - method: 'workspacePorts.scan', - params: {}, - timeoutMs: 15_000 - }) - expect(getPublishedRemoteWorktreePorts()).toHaveLength(1) - }) - - // Late manual publishes can re-add pruned hosts; the next poll must remove their ports/unavailable notices again. - it('drops a stale host re-added after pruning on the next poll', async () => { - await act(async () => { - root?.render() - await flushPromises() - }) - - const staleKey = 'environment:env-removed:all' - act(() => { - const state = useAppStore.getState() - state.replaceWorkspacePortScans( - { - ...state.workspacePortScansByKey, - [staleKey]: { ...emptyScan, unavailableReason: 'gone' } - }, - state.workspacePortScan - ) - }) - expect(useAppStore.getState().workspacePortScansByKey[staleKey]).toBeDefined() - - await act(async () => { - vi.advanceTimersByTime(30_000) - await flushPromises() - }) - - expect(useAppStore.getState().workspacePortScansByKey[staleKey]).toBeUndefined() - }) - it('clears ports immediately when the final worktree is removed', async () => { runtimeEnvironmentCall.mockImplementation(({ method }) => { if (method === 'workspacePorts.scan') { diff --git a/src/renderer/src/components/settings/agents/behavior/AgentAwakeSetting.tsx b/src/renderer/src/components/settings/agents/behavior/AgentAwakeSetting.tsx index 1b5eea973b8..c6238b7fc2b 100644 --- a/src/renderer/src/components/settings/agents/behavior/AgentAwakeSetting.tsx +++ b/src/renderer/src/components/settings/agents/behavior/AgentAwakeSetting.tsx @@ -12,7 +12,7 @@ import { computerAwakeSettingsForMode, normalizeComputerAwakeMode, type ComputerAwakeMode -} from '../../../../../../shared/computer-awake-mode' +} from '../../../../../../shared/app-lifecycle/computer-awake-mode' import { useTranslate } from '../../../../i18n/use-translate' type AgentAwakeSettingProps = { diff --git a/src/renderer/src/components/settings/agents/behavior/agent-awake-copy.ts b/src/renderer/src/components/settings/agents/behavior/agent-awake-copy.ts index a681bcea513..880361528e5 100644 --- a/src/renderer/src/components/settings/agents/behavior/agent-awake-copy.ts +++ b/src/renderer/src/components/settings/agents/behavior/agent-awake-copy.ts @@ -1,6 +1,6 @@ import { translate } from '@/i18n/i18n' import type { Translate } from '@/i18n/use-translate' -import type { ComputerAwakeMode } from '../../../../../../shared/computer-awake-mode' +import type { ComputerAwakeMode } from '../../../../../../shared/app-lifecycle/computer-awake-mode' import { searchKeywords } from '../../search/settings-search-keywords' const AGENT_AWAKE_TITLE_KEY = 'auto.components.settings.agent-awake-copy.modeTitle' diff --git a/src/renderer/src/components/settings/appearance/AppIconSelector.tsx b/src/renderer/src/components/settings/appearance/AppIconSelector.tsx index b8ddd54f61f..1012141abae 100644 --- a/src/renderer/src/components/settings/appearance/AppIconSelector.tsx +++ b/src/renderer/src/components/settings/appearance/AppIconSelector.tsx @@ -16,7 +16,7 @@ import { type AppIconId, type BuiltInAppIconId, type CustomAppIconImportFailureCode -} from '../../../../../shared/app-icon' +} from '../../../../../shared/app-lifecycle/identity/app-icon' import { Button } from '../../ui/button' import { Tooltip, TooltipContent, TooltipTrigger } from '../../ui/tooltip' import { useTranslate, type Translate } from '@/i18n/use-translate' diff --git a/src/renderer/src/components/settings/appearance/AppearancePane.tsx b/src/renderer/src/components/settings/appearance/AppearancePane.tsx index 384005f190c..73a279f6c20 100644 --- a/src/renderer/src/components/settings/appearance/AppearancePane.tsx +++ b/src/renderer/src/components/settings/appearance/AppearancePane.tsx @@ -33,7 +33,7 @@ import { TerminalAppearanceSection } from '../terminal/appearance/TerminalAppear import type { UseTerminalConfigImportReturn } from '../terminal/configuration/useTerminalConfigImport' import type { UseWarpThemeImportReturn } from '../terminal/themes/useWarpThemeImport' import { AppIconSelector } from './AppIconSelector' -import { normalizeAppIconId } from '../../../../../shared/app-icon' +import { normalizeAppIconId } from '../../../../../shared/app-lifecycle/identity/app-icon' import { getRendererAppPlatform } from '@/app-shell/platform/renderer-app-platform' import { isWebClientLocation } from '@/app-shell/platform/web-client-location' import { SHOW_UI_LANGUAGE_SETTING } from '@/i18n/supported-languages' diff --git a/src/renderer/src/components/settings/appearance/WindowMaterialSetting.tsx b/src/renderer/src/components/settings/appearance/WindowMaterialSetting.tsx index 4835fbd440a..72be2467262 100644 --- a/src/renderer/src/components/settings/appearance/WindowMaterialSetting.tsx +++ b/src/renderer/src/components/settings/appearance/WindowMaterialSetting.tsx @@ -8,7 +8,7 @@ import { windowMaterialPreference, type WindowMaterial, type WindowMaterialHost -} from '../../../../../shared/window-material' +} from '../../../../../shared/app-lifecycle/windows/window-material' import { Button } from '../../ui/button' import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../../ui/select' import { SettingsRow } from '../form-controls/SettingsFormControls' diff --git a/src/renderer/src/components/settings/cli/install/CliSection.tsx b/src/renderer/src/components/settings/cli/install/CliSection.tsx index 0df47b98d3a..a663520c6cf 100644 --- a/src/renderer/src/components/settings/cli/install/CliSection.tsx +++ b/src/renderer/src/components/settings/cli/install/CliSection.tsx @@ -2,7 +2,7 @@ import { LOCAL_EXECUTION_HOST_ID } from '../../../../../../shared/execution-host import { useCallback, useEffect, useMemo, useState } from 'react' import { FolderOpen, RefreshCw } from 'lucide-react' import { toast } from 'sonner' -import type { CliInstallStatus } from '../../../../../../shared/cli-install-types' +import type { CliInstallStatus } from '../../../../../../shared/cli/cli-install-types' import type { GlobalSettings } from '../../../../../../shared/global-settings-types' import { ORCA_CLI_SKILL_NAME } from '@/lib/skills/installation/agent-feature-skill-names' import { diff --git a/src/renderer/src/components/settings/cli/install/WslCliRegistration.tsx b/src/renderer/src/components/settings/cli/install/WslCliRegistration.tsx index d2c7c20d82e..4c402bff36f 100644 --- a/src/renderer/src/components/settings/cli/install/WslCliRegistration.tsx +++ b/src/renderer/src/components/settings/cli/install/WslCliRegistration.tsx @@ -1,7 +1,7 @@ import { useCallback, useEffect, useState } from 'react' import { RefreshCw } from 'lucide-react' import { toast } from 'sonner' -import type { CliInstallStatus } from '../../../../../../shared/cli-install-types' +import type { CliInstallStatus } from '../../../../../../shared/cli/cli-install-types' import { useWindowsTerminalCapabilities } from '@/runtime/hosts/capabilities/windows-terminal-capabilities' import { useMountedRef } from '@/hooks/useMountedRef' import { Button } from '../../../ui/button' diff --git a/src/renderer/src/components/settings/cli/install/cli-install-failure.ts b/src/renderer/src/components/settings/cli/install/cli-install-failure.ts index 7db9352e797..f6b021d6e1b 100644 --- a/src/renderer/src/components/settings/cli/install/cli-install-failure.ts +++ b/src/renderer/src/components/settings/cli/install/cli-install-failure.ts @@ -1,4 +1,4 @@ -import type { CliInstallStatus } from '../../../../../../shared/cli-install-types' +import type { CliInstallStatus } from '../../../../../../shared/cli/cli-install-types' import { formatCliUserFacingDetail } from '@/lib/cli/cli-user-facing-detail' // Why: Electron re-wraps a rejected `ipcMain.handle` as diff --git a/src/renderer/src/components/settings/cli/install/use-cli-registration-actions.ts b/src/renderer/src/components/settings/cli/install/use-cli-registration-actions.ts index f0e71b21c79..a835728952d 100644 --- a/src/renderer/src/components/settings/cli/install/use-cli-registration-actions.ts +++ b/src/renderer/src/components/settings/cli/install/use-cli-registration-actions.ts @@ -1,6 +1,6 @@ import { useCallback, useState, type MutableRefObject } from 'react' import { toast } from 'sonner' -import type { CliInstallStatus } from '../../../../../../shared/cli-install-types' +import type { CliInstallStatus } from '../../../../../../shared/cli/cli-install-types' import { translate } from '@/i18n/i18n' import { readCliInstallFailure, diff --git a/src/renderer/src/components/settings/runtime-environments/catalog/runtime-environment-host-details.ts b/src/renderer/src/components/settings/runtime-environments/catalog/runtime-environment-host-details.ts index 8426d3bda00..822a3b87796 100644 --- a/src/renderer/src/components/settings/runtime-environments/catalog/runtime-environment-host-details.ts +++ b/src/renderer/src/components/settings/runtime-environments/catalog/runtime-environment-host-details.ts @@ -8,7 +8,7 @@ import { describeRuntimeCompatBlock } from '@/runtime/hosts/display/runtime-host import { MIN_COMPATIBLE_RUNTIME_SERVER_VERSION, RUNTIME_PROTOCOL_VERSION -} from '../../../../../../shared/protocol-version' +} from '../../../../../../shared/remote-runtime/protocol/protocol-version' import { PROJECT_HOST_SETUP_RUNTIME_CAPABILITY, WORKSPACE_RUN_CONTEXT_RUNTIME_CAPABILITY diff --git a/src/renderer/src/components/settings/runtime-environments/server-rows/runtime-server-list.tsx b/src/renderer/src/components/settings/runtime-environments/server-rows/runtime-server-list.tsx index 510da8a1c71..00e01ef3645 100644 --- a/src/renderer/src/components/settings/runtime-environments/server-rows/runtime-server-list.tsx +++ b/src/renderer/src/components/settings/runtime-environments/server-rows/runtime-server-list.tsx @@ -6,7 +6,7 @@ import { } from '../../../../../../shared/remote-runtime/host-catalog/runtime-environments' import type { ManagedOrcadPreloadApi } from '../../../../../../preload/api/runtime/managed-orcad-api' import type { RemoteServerUpdateEntry } from '@/runtime/hosts/updates/remote-server-update-coordinator' -import type { UpdateCheckOptions } from '../../../../../../shared/update-status-types' +import type { UpdateCheckOptions } from '../../../../../../shared/updater/update-status-types' import { useTranslate } from '@/i18n/use-translate' import { duplicatePairedServerNames } from '@/lib/workspace/ownership/duplicate-paired-servers' import { LoadingSpinner } from '../../../LoadingSpinner' diff --git a/src/renderer/src/components/settings/runtime-environments/server-rows/runtime-server-row-menu.tsx b/src/renderer/src/components/settings/runtime-environments/server-rows/runtime-server-row-menu.tsx index 24893c072be..b38c065f574 100644 --- a/src/renderer/src/components/settings/runtime-environments/server-rows/runtime-server-row-menu.tsx +++ b/src/renderer/src/components/settings/runtime-environments/server-rows/runtime-server-row-menu.tsx @@ -13,7 +13,7 @@ import { getUpdateCheckClickOptions, getUpdateCheckHint } from '@/app-shell/updates/update-check-click-options' -import type { UpdateCheckOptions } from '../../../../../../shared/update-status-types' +import type { UpdateCheckOptions } from '../../../../../../shared/updater/update-status-types' import { DropdownMenuItem, DropdownMenuSeparator } from '../../../ui/dropdown-menu' type RuntimeServerRowMenuProps = { diff --git a/src/renderer/src/components/settings/runtime-environments/server-rows/runtime-server-row.tsx b/src/renderer/src/components/settings/runtime-environments/server-rows/runtime-server-row.tsx index f7c97556eb8..c879b00614a 100644 --- a/src/renderer/src/components/settings/runtime-environments/server-rows/runtime-server-row.tsx +++ b/src/renderer/src/components/settings/runtime-environments/server-rows/runtime-server-row.tsx @@ -7,7 +7,7 @@ import { import type { SshTarget } from '../../../../../../shared/remote-runtime/ssh/ssh-types' import type { ManagedOrcadPreloadApi } from '../../../../../../preload/api/runtime/managed-orcad-api' import type { RemoteServerUpdateEntry } from '@/runtime/hosts/updates/remote-server-update-coordinator' -import type { UpdateCheckOptions } from '../../../../../../shared/update-status-types' +import type { UpdateCheckOptions } from '../../../../../../shared/updater/update-status-types' import { getRuntimeServerProblemLine, getRuntimeServerRoute } from './runtime-server-row-meta' import { useIntlLocale, useTranslate } from '@/i18n/use-translate' import { cn } from '@/lib/class-names' diff --git a/src/renderer/src/components/settings/updates/GeneralUpdateSettingsSection.tsx b/src/renderer/src/components/settings/updates/GeneralUpdateSettingsSection.tsx index 5195ff81df9..c8ac1ab51a1 100644 --- a/src/renderer/src/components/settings/updates/GeneralUpdateSettingsSection.tsx +++ b/src/renderer/src/components/settings/updates/GeneralUpdateSettingsSection.tsx @@ -18,8 +18,8 @@ import { ReleaseChannelSection } from './ReleaseChannelSection' import { UpdateDelaySetting } from './UpdateDelaySetting' import { formatUpdateDelayDate } from './update-delay-copy' import { useNow } from '@/hooks/use-now' -import { isDelayedUpdatePending } from '../../../../../shared/update-delay' -import { getReleaseNotesUrlForVersion } from '../../../../../shared/release-channel' +import { isDelayedUpdatePending } from '../../../../../shared/updater/update-delay' +import { getReleaseNotesUrlForVersion } from '../../../../../shared/updater/release-channel' import { openAppHttpLinkFromAnchor } from '@/lib/browser/navigation/app-http-link-open' export function GeneralUpdateSettingsSection({ diff --git a/src/renderer/src/components/settings/updates/ReleaseBuildPicker.tsx b/src/renderer/src/components/settings/updates/ReleaseBuildPicker.tsx index 02ad3e45925..8df369ba819 100644 --- a/src/renderer/src/components/settings/updates/ReleaseBuildPicker.tsx +++ b/src/renderer/src/components/settings/updates/ReleaseBuildPicker.tsx @@ -14,7 +14,10 @@ import { getIntlLocale } from '@/i18n/i18n' import { useIntlLocale, useTranslate } from '@/i18n/use-translate' import { useUiLanguageRevision } from '@/i18n/use-ui-language-revision' import { cn } from '@/lib/class-names' -import { parseDevBuildStamp, type ReleaseBuild } from '../../../../../shared/release-channel' +import { + parseDevBuildStamp, + type ReleaseBuild +} from '../../../../../shared/updater/release-channel' function formatBuildLabel(build: ReleaseBuild, intlLocale: string = getIntlLocale()): string { if (build.name) { diff --git a/src/renderer/src/components/settings/updates/ReleaseChannelSection.tsx b/src/renderer/src/components/settings/updates/ReleaseChannelSection.tsx index 31bd08a01fe..869d0fddca9 100644 --- a/src/renderer/src/components/settings/updates/ReleaseChannelSection.tsx +++ b/src/renderer/src/components/settings/updates/ReleaseChannelSection.tsx @@ -13,7 +13,7 @@ import { Badge } from '../../ui/badge' import { useTranslate } from '@/i18n/use-translate' import { updaterMessageText } from '@/app-shell/updates/updater-message-copy' import { errorMessage } from '../../../../../shared/errors/error-message' -import type { UpdaterCodedMessage } from '../../../../../shared/updater-failure-copy' +import type { UpdaterCodedMessage } from '../../../../../shared/updater/updater-failure-copy' import { getShortcutPlatform } from '@/lib/keyboard/shortcut-platform' import { DEV_CHANNEL_PLATFORM_LABEL, @@ -26,7 +26,7 @@ import { type DedicatedRepoChannel, type ReleaseBuild, type ReleaseChannel -} from '../../../../../shared/release-channel' +} from '../../../../../shared/updater/release-channel' const CHANNEL_DESCRIPTIONS: Record = { stable: 'Shipped releases. What everyone else is running.', diff --git a/src/renderer/src/components/settings/updates/UpdateDelaySetting.fixture.tsx b/src/renderer/src/components/settings/updates/UpdateDelaySetting.fixture.tsx index e5233fa1a70..24a8322fd6a 100644 --- a/src/renderer/src/components/settings/updates/UpdateDelaySetting.fixture.tsx +++ b/src/renderer/src/components/settings/updates/UpdateDelaySetting.fixture.tsx @@ -1,6 +1,6 @@ import { defineFixture } from '../../../component-fixtures/component-fixture' import { getDefaultSettings } from '../../../../../shared/constants' -import type { UpdateStatus } from '../../../../../shared/update-status-types' +import type { UpdateStatus } from '../../../../../shared/updater/update-status-types' import { GeneralUpdateSettingsSection } from './GeneralUpdateSettingsSection' const DAY_MS = 24 * 60 * 60 * 1000 diff --git a/src/renderer/src/components/settings/updates/UpdateDelaySetting.tsx b/src/renderer/src/components/settings/updates/UpdateDelaySetting.tsx index 6e6c16bfa4c..0d70e035b5e 100644 --- a/src/renderer/src/components/settings/updates/UpdateDelaySetting.tsx +++ b/src/renderer/src/components/settings/updates/UpdateDelaySetting.tsx @@ -14,13 +14,13 @@ import { useIntlLocale, useTranslate, type Translate } from '@/i18n/use-translat import { formatUiRelativeTime } from '@/i18n/relative-time-format' import { uiNumberFormat } from '@/i18n/ui-intl-formatters' import { openAppHttpLinkFromAnchor } from '@/lib/browser/navigation/app-http-link-open' -import type { DelayedUpdate, UpdateStatus } from '../../../../../shared/update-status-types' -import { getReleaseNotesUrlForVersion } from '../../../../../shared/release-channel' +import type { DelayedUpdate, UpdateStatus } from '../../../../../shared/updater/update-status-types' +import { getReleaseNotesUrlForVersion } from '../../../../../shared/updater/release-channel' import { isDelayedUpdatePending, normalizeUpdateDelayDays, UPDATE_DELAY_DAY_OPTIONS -} from '../../../../../shared/update-delay' +} from '../../../../../shared/updater/update-delay' import { formatUpdateDelayDate, getUpdateDelayDescription, diff --git a/src/renderer/src/components/sidebar/sidebar-feedback/SidebarFeedbackDialog.tsx b/src/renderer/src/components/sidebar/sidebar-feedback/SidebarFeedbackDialog.tsx index ea438db8d89..b5cb8e4645b 100644 --- a/src/renderer/src/components/sidebar/sidebar-feedback/SidebarFeedbackDialog.tsx +++ b/src/renderer/src/components/sidebar/sidebar-feedback/SidebarFeedbackDialog.tsx @@ -19,7 +19,7 @@ import { extractImageFilesFromDataTransfer, hasAttachableFeedbackImage } from '@/components/sidebar/sidebar-feedback/feedback-image-attachments' -import { stripClientEnvironmentFooter } from '../../../../../shared/client-environment-info' +import { stripClientEnvironmentFooter } from '../../../../../shared/feedback/client-environment-info' import { FEEDBACK_PAYLOAD_TOO_LARGE_STATUS } from '../../../../../shared/feedback/feedback-image-limits' import { SidebarFeedbackImageAttachments } from './SidebarFeedbackImageAttachments' import { useSidebarFeedbackEnvironmentPrefill } from './use-sidebar-feedback-environment-prefill' diff --git a/src/renderer/src/components/sidebar/sidebar-feedback/use-sidebar-feedback-environment-prefill.ts b/src/renderer/src/components/sidebar/sidebar-feedback/use-sidebar-feedback-environment-prefill.ts index 21f77937969..e078fc60680 100644 --- a/src/renderer/src/components/sidebar/sidebar-feedback/use-sidebar-feedback-environment-prefill.ts +++ b/src/renderer/src/components/sidebar/sidebar-feedback/use-sidebar-feedback-environment-prefill.ts @@ -3,7 +3,7 @@ import { resolveClientEnvironmentInfo } from '@/app-shell/platform/client-enviro import { appendClientEnvironmentFooter, type ClientEnvironmentInfo -} from '../../../../../shared/client-environment-info' +} from '../../../../../shared/feedback/client-environment-info' type FeedbackSelection = { feedback: string diff --git a/src/renderer/src/components/status-bar/CaffeinateStatusSegment.tsx b/src/renderer/src/components/status-bar/CaffeinateStatusSegment.tsx index fa871e15a64..00886f2ea6e 100644 --- a/src/renderer/src/components/status-bar/CaffeinateStatusSegment.tsx +++ b/src/renderer/src/components/status-bar/CaffeinateStatusSegment.tsx @@ -23,7 +23,7 @@ import { computerAwakeSettingsForMode, normalizeComputerAwakeMode, type ComputerAwakeStatus -} from '../../../../shared/computer-awake-mode' +} from '../../../../shared/app-lifecycle/computer-awake-mode' import { STATUS_BAR_CONTEXT_MENU_EXEMPT_PROPS } from './composition/status-bar-context-menu-policy' const INACTIVE_STATUS: ComputerAwakeStatus = { diff --git a/src/renderer/src/components/status-bar/updates/UpdateStatusSegment.test.tsx b/src/renderer/src/components/status-bar/updates/UpdateStatusSegment.test.tsx index 6bf26b862b9..ab0853dc182 100644 --- a/src/renderer/src/components/status-bar/updates/UpdateStatusSegment.test.tsx +++ b/src/renderer/src/components/status-bar/updates/UpdateStatusSegment.test.tsx @@ -1,7 +1,7 @@ // @vitest-environment happy-dom import { act, cleanup, fireEvent, render, screen } from '@testing-library/react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { UpdateStatus } from '../../../../../shared/update-status-types' +import type { UpdateStatus } from '../../../../../shared/updater/update-status-types' import { useAppStore } from '../../../store/index' import { UpdateCard } from '../../UpdateCard' import { TooltipProvider } from '../../ui/tooltip' diff --git a/src/renderer/src/components/terminal-pane/errors/TerminalErrorToast.tsx b/src/renderer/src/components/terminal-pane/errors/TerminalErrorToast.tsx index 764ed8907df..9a18ee1b9c1 100644 --- a/src/renderer/src/components/terminal-pane/errors/TerminalErrorToast.tsx +++ b/src/renderer/src/components/terminal-pane/errors/TerminalErrorToast.tsx @@ -13,7 +13,7 @@ import { useTranslate } from '@/i18n/use-translate' import { Button } from '@/components/ui/button' import { CopyTextButton } from '@/components/clipboard/CopyTextButton' import { isAgentLaunchOnlyError } from '../launch-outcome/agent-launch-pane-notice-text' -import { hasClientEnvironmentFooter } from '../../../../../shared/client-environment-info' +import { hasClientEnvironmentFooter } from '../../../../../shared/feedback/client-environment-info' import { failedSpawnEnvironmentFooter, withoutTerminalSpawnIssueRequest diff --git a/src/renderer/src/components/terminal-pane/errors/terminal-error-display.ts b/src/renderer/src/components/terminal-pane/errors/terminal-error-display.ts index a32726e614d..ecec836f0de 100644 --- a/src/renderer/src/components/terminal-pane/errors/terminal-error-display.ts +++ b/src/renderer/src/components/terminal-pane/errors/terminal-error-display.ts @@ -6,7 +6,7 @@ import { isFolderWorkspacePathError } from '../../../lib/workspace/paths/folder-workspace-path-status' import { agentLaunchErrorText } from '../launch-outcome/agent-launch-pane-notice-text' -import { stripClientEnvironmentFooter } from '../../../../../shared/client-environment-info' +import { stripClientEnvironmentFooter } from '../../../../../shared/feedback/client-environment-info' import { localizeTerminalSpawnHints } from './terminal-spawn-error-display' import { localizeWslDistroHoldText } from '../../../runtime/hosts/wsl/wsl-distro-hold-copy' import { diff --git a/src/renderer/src/components/terminal-pane/launch-outcome/agent-launch-pane-notice-text.ts b/src/renderer/src/components/terminal-pane/launch-outcome/agent-launch-pane-notice-text.ts index 3da2f7cf1de..5c58794907b 100644 --- a/src/renderer/src/components/terminal-pane/launch-outcome/agent-launch-pane-notice-text.ts +++ b/src/renderer/src/components/terminal-pane/launch-outcome/agent-launch-pane-notice-text.ts @@ -1,7 +1,7 @@ import { translate } from '@/i18n/i18n' import type { Translate } from '@/i18n/use-translate' import type { AgentLaunchPaneOutcome } from '../../../../../shared/agent-launch/contracts/agent-launch-pane-verdict' -import { stripClientEnvironmentFooter } from '../../../../../shared/client-environment-info' +import { stripClientEnvironmentFooter } from '../../../../../shared/feedback/client-environment-info' import type { TerminalTab } from '../../../../../shared/workspace-layout/terminal-tab-types' import { tuiAgentDisplayName } from '../../../../../shared/agent-launch/catalog/tui-agent-display-names' import { joinSentences } from '../../../../../shared/text/sentence-joining' diff --git a/src/renderer/src/components/terminal-pane/layout/close/pending-runtime-pane-close-test-fixture.ts b/src/renderer/src/components/terminal-pane/layout/close/pending-runtime-pane-close-test-fixture.ts index 4d07d07535f..ebd21e04e2e 100644 --- a/src/renderer/src/components/terminal-pane/layout/close/pending-runtime-pane-close-test-fixture.ts +++ b/src/renderer/src/components/terminal-pane/layout/close/pending-runtime-pane-close-test-fixture.ts @@ -2,7 +2,7 @@ import { vi } from 'vitest' import { MIN_COMPATIBLE_RUNTIME_CLIENT_VERSION, RUNTIME_PROTOCOL_VERSION -} from '../../../../../../shared/protocol-version' +} from '../../../../../../shared/remote-runtime/protocol/protocol-version' import { preparePendingSplitClose } from './pending-split-close-test-fixture' import { flushPtySideEffects } from '../../pty-transport/ipc/pty-transport-test-harness' diff --git a/src/renderer/src/components/terminal-pane/parking/retention/paired-runtime-parking-capabilities.ts b/src/renderer/src/components/terminal-pane/parking/retention/paired-runtime-parking-capabilities.ts index 67a6658671e..1a42d5e7523 100644 --- a/src/renderer/src/components/terminal-pane/parking/retention/paired-runtime-parking-capabilities.ts +++ b/src/renderer/src/components/terminal-pane/parking/retention/paired-runtime-parking-capabilities.ts @@ -1,4 +1,4 @@ -import '../../../../../../shared/protocol-version' +import '../../../../../../shared/remote-runtime/protocol/protocol-version' import { readRecordChanges } from '@/store/keyed-record-change-reads' import { TERMINAL_PAIRED_PARKING_RUNTIME_CAPABILITY } from '../../../../../../shared/terminal/runtime-policy/terminal-runtime-capabilities' import { diff --git a/src/renderer/src/components/terminal-pane/pty-connection/output-restore/remote-park-reveal-unverifiable-retry.test.ts b/src/renderer/src/components/terminal-pane/pty-connection/output-restore/remote-park-reveal-unverifiable-retry.test.ts index ae7ce1a6c4e..b6b26c04aaa 100644 --- a/src/renderer/src/components/terminal-pane/pty-connection/output-restore/remote-park-reveal-unverifiable-retry.test.ts +++ b/src/renderer/src/components/terminal-pane/pty-connection/output-restore/remote-park-reveal-unverifiable-retry.test.ts @@ -1,6 +1,6 @@ import type * as React from 'react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import '../../../../../../shared/protocol-version' +import '../../../../../../shared/remote-runtime/protocol/protocol-version' import { TERMINAL_PAIRED_PARKING_RUNTIME_CAPABILITY } from '../../../../../../shared/terminal/runtime-policy/terminal-runtime-capabilities' import { createDeferred, flushAsyncTicks } from '../test-fixtures/pty-connection-test-async' import { diff --git a/src/renderer/src/components/terminal-pane/pty-connection/reattach/deferred-session-reattach-connect.ts b/src/renderer/src/components/terminal-pane/pty-connection/reattach/deferred-session-reattach-connect.ts index 53883f981dc..29c66e22b90 100644 --- a/src/renderer/src/components/terminal-pane/pty-connection/reattach/deferred-session-reattach-connect.ts +++ b/src/renderer/src/components/terminal-pane/pty-connection/reattach/deferred-session-reattach-connect.ts @@ -14,7 +14,7 @@ import type { HeldPaneReopenOutcome } from '../../session-restore/newer-daemon/n import { holdForNewerDaemon } from '../spawn/newer-daemon-hold-pane' import { holdForStoppedWslDistro, wslRestoreStartArgs } from '../spawn/wsl-distro-stopped-hold-pane' import { parseWslDistroHold } from '../../../../../../shared/remote-runtime/wsl-hosts/wsl-distro-stopped-hold' -import { NEWER_DAEMON_HOLD_ERROR } from '../../../../../../shared/newer-daemon-hold' +import { NEWER_DAEMON_HOLD_ERROR } from '../../../../../../shared/terminal/daemon/newer-daemon-hold' import { PANE_NOT_LIVE_ERROR } from '../../../../../../shared/pane-attach-only-view' import { ORCA_LAYOUT_OWNER_IS_MAIN } from '../../../../../../shared/layout-owner-switch' import { holdInPlaceResumeUntilSettled } from '../startup/in-place-resume-hold' diff --git a/src/renderer/src/components/terminal-pane/pty-connection/reattach/paired-parked-terminal-restore.ts b/src/renderer/src/components/terminal-pane/pty-connection/reattach/paired-parked-terminal-restore.ts index ef7feeb78ab..70531e48af7 100644 --- a/src/renderer/src/components/terminal-pane/pty-connection/reattach/paired-parked-terminal-restore.ts +++ b/src/renderer/src/components/terminal-pane/pty-connection/reattach/paired-parked-terminal-restore.ts @@ -1,5 +1,5 @@ import { useAppStore } from '@/store/index' -import '../../../../../../shared/protocol-version' +import '../../../../../../shared/remote-runtime/protocol/protocol-version' import { TERMINAL_PAIRED_PARKING_RUNTIME_CAPABILITY } from '../../../../../../shared/terminal/runtime-policy/terminal-runtime-capabilities' import { getRemoteRuntimePtyEnvironmentId } from '@/runtime/hosted-terminals/identity/remote-runtime-pty-owner' import { diff --git a/src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport.ts b/src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport.ts index afcaf325569..729c838ae59 100644 --- a/src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport.ts +++ b/src/renderer/src/components/terminal-pane/pty-transport/remote-runtime/remote-runtime-pty-transport.ts @@ -64,7 +64,7 @@ import type { RuntimeTerminalShow } from '../../../../../../shared/terminal/runtime/runtime-terminal-contracts' import type { RuntimeTerminalSend } from '../../../../../../shared/terminal/runtime/runtime-terminal-send-contract' -import { SAVED_RESUME_ORIGIN_RUNTIME_CAPABILITY } from '../../../../../../shared/protocol-version' +import { SAVED_RESUME_ORIGIN_RUNTIME_CAPABILITY } from '../../../../../../shared/remote-runtime/protocol/protocol-version' import { TERMINAL_CREATE_IDEMPOTENCY_RUNTIME_CAPABILITY } from '../../../../../../shared/terminal/runtime-policy/terminal-runtime-capabilities' import { agentResumeHostAuthorityCapability } from '../../../../runtime/hosted-terminals/creation/agent-launch/agent-resume-host-authority-capability' import { diff --git a/src/renderer/src/components/unexpected-signout/unexpected-signout-visibility.ts b/src/renderer/src/components/unexpected-signout/unexpected-signout-visibility.ts index e611d487946..64de882a56a 100644 --- a/src/renderer/src/components/unexpected-signout/unexpected-signout-visibility.ts +++ b/src/renderer/src/components/unexpected-signout/unexpected-signout-visibility.ts @@ -1,4 +1,4 @@ -import type { OrcaProfileAuthStatus } from '../../../../shared/orca-profiles' +import type { OrcaProfileAuthStatus } from '../../../../shared/orca-profiles/orca-profiles' export type UnexpectedSignoutGate = { authStatus: OrcaProfileAuthStatus | null diff --git a/src/renderer/src/components/window-close-request-coordinator.test.ts b/src/renderer/src/components/window-close-request-coordinator.test.ts index ae6208454e2..2f9bbb58810 100644 --- a/src/renderer/src/components/window-close-request-coordinator.test.ts +++ b/src/renderer/src/components/window-close-request-coordinator.test.ts @@ -1,16 +1,10 @@ // @vitest-environment happy-dom import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { toast } from 'sonner' -import { - consumeShutdownCheckpointFailureReason, - publishShutdownCheckpointFailureReason -} from '../../../shared/renderer-shutdown-events' +import { consumeShutdownCheckpointFailureReason } from '../../../shared/app-lifecycle/shutdown/renderer-shutdown-events' import { - dispatchWindowCloseRequest, - isWindowCloseCheckpointInProgress, prepareWindowCloseCheckpoint, - registerWindowCloseGuard, setWindowCloseRequestHandler } from './window-close-request-coordinator' @@ -22,10 +16,6 @@ describe('window-close-request-coordinator', () => { const awaitBeforeUnloadCheckpoint = vi.fn(() => Promise.resolve()) const unregisterFns: (() => void)[] = [] - const addGuard = (guard: () => boolean | Promise): void => { - unregisterFns.push(registerWindowCloseGuard(guard)) - } - beforeEach(() => { confirmWindowClose.mockClear() cancelWindowClose.mockClear() @@ -44,41 +34,6 @@ describe('window-close-request-coordinator', () => { consumeShutdownCheckpointFailureReason() }) - it('runs the Terminal-less close checkpoint in the degradable close scope', async () => { - const beforeUnload = vi.fn((event: Event) => { - expect(isWindowCloseCheckpointInProgress()).toBe(true) - event.preventDefault() - }) - window.addEventListener('beforeunload', beforeUnload, { once: true }) - - await dispatchWindowCloseRequest({ isQuitting: true }) - - expect(beforeUnload).toHaveBeenCalledTimes(1) - expect(confirmWindowClose).not.toHaveBeenCalled() - expect(cancelWindowClose).toHaveBeenCalledTimes(1) - expect(toast.error).not.toHaveBeenCalled() - expect(isWindowCloseCheckpointInProgress()).toBe(false) - }) - - it('surfaces the checkpoint failure reason when the Terminal-less close is vetoed', async () => { - window.addEventListener( - 'beforeunload', - (event) => { - publishShutdownCheckpointFailureReason('sendSync payload rejected') - event.preventDefault() - }, - { once: true } - ) - - await dispatchWindowCloseRequest({ isQuitting: true }) - - expect(confirmWindowClose).not.toHaveBeenCalled() - expect(toast.error).toHaveBeenCalledWith( - 'Quit canceled: the session snapshot could not be saved (sendSync payload rejected).' - ) - expect(consumeShutdownCheckpointFailureReason()).toBeNull() - }) - it('counts one failed write once when a second close overlaps it', async () => { awaitBeforeUnloadCheckpoint.mockRejectedValueOnce(new Error('disk full')) @@ -92,58 +47,4 @@ describe('window-close-request-coordinator', () => { // A later attempt stages its own write, which clears the failure. await expect(prepareWindowCloseCheckpoint()).resolves.toBe(true) }) - - it('cancels a close once when its staged checkpoint fails to reach disk, then closes anyway', async () => { - vi.spyOn(console, 'error').mockImplementation(() => {}) - awaitBeforeUnloadCheckpoint.mockRejectedValue(new Error('disk full')) - const aborted = vi.fn() - window.addEventListener('orca:renderer-shutdown-checkpoint-aborted', aborted) - - await dispatchWindowCloseRequest({ isQuitting: true }) - - expect(confirmWindowClose).not.toHaveBeenCalled() - expect(cancelWindowClose).toHaveBeenCalledTimes(1) - expect(aborted).toHaveBeenCalledTimes(1) - expect(toast.error).toHaveBeenCalledWith( - 'Quit canceled: the session snapshot could not be saved (disk full).' - ) - - await dispatchWindowCloseRequest({ isQuitting: true }) - - expect(confirmWindowClose).toHaveBeenCalledTimes(1) - expect(aborted).toHaveBeenCalledTimes(1) - window.removeEventListener('orca:renderer-shutdown-checkpoint-aborted', aborted) - }) - - it('cancels the close — no confirm, no handler — when a guard vetoes', async () => { - const handler = vi.fn() - setWindowCloseRequestHandler(handler) - addGuard(() => false) - - await dispatchWindowCloseRequest({ isQuitting: true }) - - expect(confirmWindowClose).not.toHaveBeenCalled() - expect(cancelWindowClose).toHaveBeenCalledTimes(1) - expect(handler).not.toHaveBeenCalled() - expect(toast.error).not.toHaveBeenCalled() - }) - - it('ignores a re-entrant close request while a guard is still pending', async () => { - let resolveGuard: (value: boolean) => void = () => {} - const guard = vi.fn( - () => - new Promise((resolve) => { - resolveGuard = resolve - }) - ) - addGuard(guard) - - const first = dispatchWindowCloseRequest({ isQuitting: true }) - await dispatchWindowCloseRequest({ isQuitting: true }) - expect(guard).toHaveBeenCalledTimes(1) - - resolveGuard(true) - await first - expect(confirmWindowClose).toHaveBeenCalledTimes(1) - }) }) diff --git a/src/renderer/src/components/window-close-request-coordinator.ts b/src/renderer/src/components/window-close-request-coordinator.ts index 6119cc66155..e27a39d8692 100644 --- a/src/renderer/src/components/window-close-request-coordinator.ts +++ b/src/renderer/src/components/window-close-request-coordinator.ts @@ -5,7 +5,7 @@ import { formatShutdownCheckpointFailureReason, ORCA_RENDERER_SHUTDOWN_CHECKPOINT_ABORTED_EVENT, publishShutdownCheckpointFailureReason -} from '../../../shared/renderer-shutdown-events' +} from '../../../shared/app-lifecycle/shutdown/renderer-shutdown-events' export type WindowCloseRequestHandler = (data: { isQuitting: boolean }) => void diff --git a/src/renderer/src/hooks/agent-auto-ack-presence.ts b/src/renderer/src/hooks/agent-auto-ack-presence.ts index 3cbcad45e7e..ad67737ad7c 100644 --- a/src/renderer/src/hooks/agent-auto-ack-presence.ts +++ b/src/renderer/src/hooks/agent-auto-ack-presence.ts @@ -1,4 +1,4 @@ -import { DESKTOP_AWAY_SECONDS } from '../../../shared/desktop-away-threshold' +import { DESKTOP_AWAY_SECONDS } from '../../../shared/app-lifecycle/presence/desktop-away-threshold' import { addAppKeyListener, removeAppKeyListener } from '@/lib/keyboard/app-keyboard-router' // Only trusted renderer input stamps presence; main’s below-idle-threshold answer applies to that scan and must not extend the presence window again. diff --git a/src/renderer/src/hooks/agent-hook-turn-end-capability.ts b/src/renderer/src/hooks/agent-hook-turn-end-capability.ts index fde6186609f..d500568ce25 100644 --- a/src/renderer/src/hooks/agent-hook-turn-end-capability.ts +++ b/src/renderer/src/hooks/agent-hook-turn-end-capability.ts @@ -4,7 +4,7 @@ import { parseRemoteRuntimePtyId } from '../../../shared/remote-runtime/remote-runtime-pty-id' import { lastVerifiedRuntimeStatus } from '../../../shared/remote-runtime/host-status/runtime-host-status' -import '../../../shared/protocol-version' +import '../../../shared/remote-runtime/protocol/protocol-version' import { AGENT_STATUS_TURN_END_RUNTIME_CAPABILITY } from '../../../shared/terminal/runtime-policy/terminal-runtime-capabilities' import type { HostTurnEndFacts } from '../../../shared/agent-status/contracts/agent-status-types' diff --git a/src/renderer/src/hooks/ipc-events/updater-status-ipc-bridge.ts b/src/renderer/src/hooks/ipc-events/updater-status-ipc-bridge.ts index 6cbd6809123..ff9964f6313 100644 --- a/src/renderer/src/hooks/ipc-events/updater-status-ipc-bridge.ts +++ b/src/renderer/src/hooks/ipc-events/updater-status-ipc-bridge.ts @@ -1,4 +1,4 @@ -import type { UpdateStatus } from '../../../../shared/update-status-types' +import type { UpdateStatus } from '../../../../shared/updater/update-status-types' import { useAppStore } from '../../store' /** Installs updater listeners in their historical snapshot-before-push order. */ diff --git a/src/renderer/src/hooks/useDetectedAgents.host-reconnect.test.tsx b/src/renderer/src/hooks/useDetectedAgents.host-reconnect.test.tsx index d55a7510db0..502ee340523 100644 --- a/src/renderer/src/hooks/useDetectedAgents.host-reconnect.test.tsx +++ b/src/renderer/src/hooks/useDetectedAgents.host-reconnect.test.tsx @@ -8,7 +8,7 @@ import { useDetectedAgents, type UseDetectedAgentsResult } from './useDetectedAg import { MIN_COMPATIBLE_RUNTIME_CLIENT_VERSION, RUNTIME_PROTOCOL_VERSION -} from '../../../shared/protocol-version' +} from '../../../shared/remote-runtime/protocol/protocol-version' import type { PublicKnownRuntimeEnvironment } from '../../../shared/remote-runtime/host-catalog/runtime-environments' import type { RuntimeStatus } from '../../../shared/remote-runtime/session-graph/runtime-session-contracts' import { clearRuntimeCompatibilityCache as clearRuntimeCompatibilityCacheForTests } from '@/runtime/rpc/compatibility/runtime-compatibility-cache' diff --git a/src/renderer/src/hooks/useDetectedAgents.re-pair.test.tsx b/src/renderer/src/hooks/useDetectedAgents.re-pair.test.tsx index a777dde05b9..b6d88ca4a54 100644 --- a/src/renderer/src/hooks/useDetectedAgents.re-pair.test.tsx +++ b/src/renderer/src/hooks/useDetectedAgents.re-pair.test.tsx @@ -8,7 +8,7 @@ import { useDetectedAgents, type UseDetectedAgentsResult } from './useDetectedAg import { MIN_COMPATIBLE_RUNTIME_CLIENT_VERSION, RUNTIME_PROTOCOL_VERSION -} from '../../../shared/protocol-version' +} from '../../../shared/remote-runtime/protocol/protocol-version' import type { PublicKnownRuntimeEnvironment } from '../../../shared/remote-runtime/host-catalog/runtime-environments' import { clearRuntimeCompatibilityCache as clearRuntimeCompatibilityCacheForTests } from '@/runtime/rpc/compatibility/runtime-compatibility-cache' diff --git a/src/renderer/src/hooks/useDetectedAgents.test.tsx b/src/renderer/src/hooks/useDetectedAgents.test.tsx index 975e7b81c8f..9c0222389df 100644 --- a/src/renderer/src/hooks/useDetectedAgents.test.tsx +++ b/src/renderer/src/hooks/useDetectedAgents.test.tsx @@ -12,7 +12,7 @@ import { import { MIN_COMPATIBLE_RUNTIME_CLIENT_VERSION, RUNTIME_PROTOCOL_VERSION -} from '../../../shared/protocol-version' +} from '../../../shared/remote-runtime/protocol/protocol-version' import { clearRuntimeCompatibilityCache as clearRuntimeCompatibilityCacheForTests } from '@/runtime/rpc/compatibility/runtime-compatibility-cache' import { FLOATING_TERMINAL_WORKTREE_ID } from '../../../shared/constants' @@ -237,57 +237,6 @@ afterEach(async () => { roots.length = 0 }) -describe('useDetectedAgents (ssh call site)', () => { - it('fires remote detection once on mount and does not thrash after an empty result', async () => { - const root = await renderProbe({ kind: 'ssh', connectionId: 'ssh-1' }) - - // Empty detection is settled rather than null, preventing repeat probes on the same surface. - expect(detectRemoteAgents).toHaveBeenCalledTimes(1) - expect(useAppStore.getState().remoteDetectedAgentIds['ssh-1']).toEqual([]) - - await act(async () => { - root.render(createElement(HookProbe, { target: { kind: 'ssh', connectionId: 'ssh-1' } })) - }) - await flushEffects() - - expect(detectRemoteAgents).toHaveBeenCalledTimes(1) - }) - - it('retries a cached empty SSH result when the launch surface is reopened', async () => { - const firstRoot = await renderProbe({ kind: 'ssh', connectionId: 'ssh-1' }) - - expect(detectRemoteAgents).toHaveBeenCalledTimes(1) - expect(useAppStore.getState().remoteDetectedAgentIds['ssh-1']).toEqual([]) - - await act(async () => { - firstRoot.unmount() - }) - roots.splice(roots.indexOf(firstRoot), 1) - detectRemoteAgents.mockResolvedValueOnce(['kilo']) - - await renderProbe({ kind: 'ssh', connectionId: 'ssh-1' }) - - expect(detectRemoteAgents).toHaveBeenCalledTimes(2) - expect(useAppStore.getState().remoteDetectedAgentIds['ssh-1']).toEqual(['kilo']) - }) - - it('refreshes a non-empty SSH cache when a new launch surface opens', async () => { - useAppStore.setState({ remoteDetectedAgentIds: { 'ssh-1': ['claude'] } }) - detectRemoteAgents.mockResolvedValueOnce(['claude', 'devin']) - - const root = await renderProbe({ kind: 'ssh', connectionId: 'ssh-1' }) - - expect(detectRemoteAgents).toHaveBeenCalledTimes(1) - expect(useAppStore.getState().remoteDetectedAgentIds['ssh-1']).toEqual(['claude', 'devin']) - - await act(async () => { - root.render(createElement(HookProbe, { target: { kind: 'ssh', connectionId: 'ssh-1' } })) - }) - await flushEffects() - expect(detectRemoteAgents).toHaveBeenCalledTimes(1) - }) -}) - describe('useDetectedAgents (unresolved target)', () => { it('does not fall back to detecting or refreshing the local client', async () => { await renderProbe(undefined) @@ -301,153 +250,3 @@ describe('useDetectedAgents (unresolved target)', () => { expect(runtimeEnvironmentCall).not.toHaveBeenCalled() }) }) - -describe('useDetectedAgents (runtime call site)', () => { - it('refreshes a non-empty runtime cache when a new launch surface opens', async () => { - useAppStore.setState({ runtimeDetectedAgentIds: { 'env-1': ['claude'] } }) - runtimeEnvironmentCall.mockImplementation(({ method }: { method: string }) => { - const result = - method === 'status.get' - ? { - runtimeId: 'remote-runtime', - rendererGraphEpoch: 1, - graphStatus: 'ready', - authoritativeWindowId: null, - liveTabCount: 0, - liveLeafCount: 0, - runtimeProtocolVersion: RUNTIME_PROTOCOL_VERSION, - minCompatibleRuntimeClientVersion: MIN_COMPATIBLE_RUNTIME_CLIENT_VERSION - } - : { - agents: ['claude', 'devin'], - addedPathSegments: [], - shellHydrationOk: true, - pathSource: 'shell_hydrate', - pathFailureReason: 'none' - } - return Promise.resolve({ - id: method, - ok: true, - result, - _meta: { runtimeId: 'remote-runtime' } - }) - }) - - const root = await renderProbe({ kind: 'runtime', environmentId: 'env-1' }) - - expect( - runtimeEnvironmentCall.mock.calls.filter( - ([{ method }]) => method === 'preflight.refreshAgents' - ) - ).toHaveLength(1) - expect(useAppStore.getState().runtimeDetectedAgentIds['env-1']).toEqual(['claude', 'devin']) - - await act(async () => { - root.render(createElement(HookProbe, { target: { kind: 'runtime', environmentId: 'env-1' } })) - }) - await flushEffects() - expect( - runtimeEnvironmentCall.mock.calls.filter( - ([{ method }]) => method === 'preflight.refreshAgents' - ) - ).toHaveLength(1) - }) - - it('does not re-probe after an explicit refresh finds no agents', async () => { - useAppStore.setState({ - runtimeDetectedAgentIds: { 'env-1': ['claude'] }, - isDetectingRuntimeAgents: { 'env-1': false } - }) - let detectCalls = 0 - let refreshCalls = 0 - runtimeEnvironmentCall.mockImplementation(({ method }: { method: string }) => { - let result: unknown - if (method === 'status.get') { - result = { - runtimeId: 'remote-runtime', - rendererGraphEpoch: 1, - graphStatus: 'ready', - authoritativeWindowId: null, - liveTabCount: 0, - liveLeafCount: 0, - runtimeProtocolVersion: RUNTIME_PROTOCOL_VERSION, - minCompatibleRuntimeClientVersion: MIN_COMPATIBLE_RUNTIME_CLIENT_VERSION - } - } else if (method === 'preflight.refreshAgents') { - refreshCalls += 1 - result = { - agents: [], - addedPathSegments: [], - shellHydrationOk: true, - pathSource: 'shell_hydrate', - pathFailureReason: 'none' - } - } else { - detectCalls += 1 - result = ['claude'] - } - return Promise.resolve({ - id: method, - ok: true, - result, - _meta: { runtimeId: 'remote-runtime' } - }) - }) - - const root = await renderProbe({ kind: 'runtime', environmentId: 'env-1' }) - await flushEffects() - - expect(refreshCalls).toBe(1) - expect(detectCalls).toBe(0) - expect(useAppStore.getState().runtimeDetectedAgentIds['env-1']).toEqual([]) - - await act(async () => { - root.render(createElement(HookProbe, { target: { kind: 'runtime', environmentId: 'env-1' } })) - }) - await flushEffects() - expect(refreshCalls).toBe(1) - }) - - it('retries a cached empty runtime result when the launch surface is reopened', async () => { - let detectCalls = 0 - runtimeEnvironmentCall.mockImplementation(({ method }: { method: string }) => { - let result: unknown - if (method === 'status.get') { - result = { - runtimeId: 'remote-runtime', - rendererGraphEpoch: 1, - graphStatus: 'ready', - authoritativeWindowId: null, - liveTabCount: 0, - liveLeafCount: 0, - runtimeProtocolVersion: RUNTIME_PROTOCOL_VERSION, - minCompatibleRuntimeClientVersion: MIN_COMPATIBLE_RUNTIME_CLIENT_VERSION - } - } else { - detectCalls += 1 - result = detectCalls === 1 ? [] : ['kilo'] - } - return Promise.resolve({ - id: method, - ok: true, - result, - _meta: { runtimeId: 'remote-runtime' } - }) - }) - - const firstRoot = await renderProbe({ kind: 'runtime', environmentId: 'env-1' }) - - expect(detectCalls).toBe(1) - expect(useAppStore.getState().runtimeDetectedAgentIds['env-1']).toEqual([]) - - await act(async () => { - firstRoot.unmount() - }) - roots.splice(roots.indexOf(firstRoot), 1) - - await renderProbe({ kind: 'runtime', environmentId: 'env-1' }) - - expect(detectCalls).toBe(2) - expect(useAppStore.getState().runtimeDetectedAgentIds['env-1']).toEqual(['kilo']) - }) -}) diff --git a/src/renderer/src/lib/browser/navigation/browser-link-session.ts b/src/renderer/src/lib/browser/navigation/browser-link-session.ts index be2a8ee0628..75f2424a27d 100644 --- a/src/renderer/src/lib/browser/navigation/browser-link-session.ts +++ b/src/renderer/src/lib/browser/navigation/browser-link-session.ts @@ -4,7 +4,7 @@ import type { ExecutionHostId } from '../../../../../shared/execution-host' import { LOCAL_EXECUTION_HOST_ID, parseExecutionHostId } from '../../../../../shared/execution-host' import '../../../../../shared/constants' import { ORCA_BROWSER_PARTITION } from '../../../../../shared/browser/browser-session-partition' -import { getOrcaProfileBrowserDefaultPartition } from '../../../../../shared/orca-profiles' +import { getOrcaProfileBrowserDefaultPartition } from '../../../../../shared/orca-profiles/orca-profiles' import { resolveNewBrowserTabProfile } from '@/store/slices/browser/profiles/browser-new-tab-profile' function createPartitionResolver( diff --git a/src/renderer/src/lib/browser/workspace/workspace-browser-route-eligibility.ts b/src/renderer/src/lib/browser/workspace/workspace-browser-route-eligibility.ts index 756a3aece0a..9afecedef59 100644 --- a/src/renderer/src/lib/browser/workspace/workspace-browser-route-eligibility.ts +++ b/src/renderer/src/lib/browser/workspace/workspace-browser-route-eligibility.ts @@ -1,6 +1,6 @@ import { parseExecutionHostId } from '../../../../../shared/execution-host' import { FLOATING_TERMINAL_WORKTREE_ID } from '../../../../../shared/constants' -import '../../../../../shared/protocol-version' +import '../../../../../shared/remote-runtime/protocol/protocol-version' import { BROWSER_SCREENCAST_RUNTIME_CAPABILITY } from '../../../../../shared/browser/runtime/browser-runtime-capabilities' import { getWorkspaceClientCreationActionPolicy, diff --git a/src/renderer/src/lib/skills/installation/agent-skill-cli-prerequisite.ts b/src/renderer/src/lib/skills/installation/agent-skill-cli-prerequisite.ts index 97462ca2798..b5fd93c330d 100644 --- a/src/renderer/src/lib/skills/installation/agent-skill-cli-prerequisite.ts +++ b/src/renderer/src/lib/skills/installation/agent-skill-cli-prerequisite.ts @@ -1,5 +1,5 @@ import { toast } from 'sonner' -import type { CliInstallStatus } from '../../../../../shared/cli-install-types' +import type { CliInstallStatus } from '../../../../../shared/cli/cli-install-types' import { translate } from '@/i18n/i18n' import { formatCliUserFacingDetail } from '@/lib/cli/cli-user-facing-detail' diff --git a/src/renderer/src/lib/work-items/github/github-work-item-target-compatibility.test.ts b/src/renderer/src/lib/work-items/github/github-work-item-target-compatibility.test.ts deleted file mode 100644 index ef303798214..00000000000 --- a/src/renderer/src/lib/work-items/github/github-work-item-target-compatibility.test.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { - RUNTIME_PROTOCOL_VERSION, - MIN_COMPATIBLE_RUNTIME_CLIENT_VERSION -} from '../../../../../shared/protocol-version' -import { afterEach, beforeEach, expect, it, vi } from 'vitest' -import { callGitHubTargetOperation } from './github-work-item-target-request' -import '@/runtime/rpc/calls/runtime-rpc-call' -import { clearRuntimeCompatibilityCache } from '@/runtime/rpc/compatibility/runtime-compatibility-cache' -import { replaceRuntimeEnvironmentRevisions } from '@/runtime/rpc/environment-revisions/runtime-environment-revision' -import { GITHUB_EXACT_WORK_ITEM_TARGET_RUNTIME_CAPABILITY as capability } from '../../../../../shared/source-control/runtime/source-control-runtime-capabilities' - -vi.mock('@/store/index', () => ({ useAppStore: { getState: () => ({ repos: [] }) } })) -const ownerRepo = { owner: 'fork', repo: 'widgets', host: 'github.corp' } -let runtime = 'a' -let capable = true -const writes: unknown[] = [] -let afterProbe: () => void = () => {} -const call = vi.fn(async (request) => { - // The actual callRuntimeRpc must carry the captured revision/runtime through its compatibility await. - if (request.expectedEnvironmentRuntimeId && request.expectedEnvironmentRuntimeId !== runtime) { - return { - ok: false, - error: { code: 'runtime_environment_changed', message: 'Connection changed' } - } - } - const result = - request.method === 'status.get' - ? { - runtimeProtocolVersion: RUNTIME_PROTOCOL_VERSION, - minCompatibleRuntimeClientVersion: MIN_COMPATIBLE_RUNTIME_CLIENT_VERSION, - runtimeId: runtime, - capabilities: capable ? [capability] : [] - } - : (writes.push(request.params), { ok: true }) - if (request.method === 'status.get') { - afterProbe() - } - return { ok: true, result, _meta: { runtimeId: runtime } } -}) -function update() { - return callGitHubTargetOperation({ - target: { kind: 'environment', environmentId: 'paired' }, - ownerRepo, - method: 'github.updateIssue', - params: { repo: 'clone', number: 93, updates: { body: 'edit' } }, - local: async () => { - throw new Error('wrong transport') - } - }) -} -beforeEach(() => { - writes.length = 0 - runtime = 'a' - capable = true - afterProbe = () => {} - call.mockClear() - clearRuntimeCompatibilityCache() - replaceRuntimeEnvironmentRevisions([{ id: 'paired', createdAt: 1, pairingRevision: 1 }]) - vi.stubGlobal('window', { api: { runtimeEnvironments: { call } } }) -}) -afterEach(() => vi.unstubAllGlobals()) -it('rejects re-pairing between probe and send, before any destination effect', async () => { - afterProbe = () => - replaceRuntimeEnvironmentRevisions([{ id: 'paired', createdAt: 1, pairingRevision: 2 }], { - retired: ['paired'], - sameHost: [] - }) - await expect(update()).rejects.toThrow() - expect(writes).toEqual([]) -}) diff --git a/src/renderer/src/lib/workspace/creation/project-host-setup-options.ts b/src/renderer/src/lib/workspace/creation/project-host-setup-options.ts index 7564bea8293..1872e3f4945 100644 --- a/src/renderer/src/lib/workspace/creation/project-host-setup-options.ts +++ b/src/renderer/src/lib/workspace/creation/project-host-setup-options.ts @@ -10,7 +10,7 @@ import { getHostHealthUnavailableDetail } from './project-host-health-detail' import { isHostLocalProjectId } from '../../../../../shared/project/host-setup/project-host-setup-projection' import { isEphemeralVmRuntimeEnvironment } from '../../../../../shared/remote-runtime/host-catalog/runtime-environments' import { isMergedAwayExecutionHost } from '../../../../../shared/execution-host/managed-orcad-execution-host' -import '../../../../../shared/protocol-version' +import '../../../../../shared/remote-runtime/protocol/protocol-version' import { PROJECT_HOST_SETUP_RUNTIME_CAPABILITY, WORKSPACE_RUN_CONTEXT_RUNTIME_CAPABILITY diff --git a/src/renderer/src/lib/workspace/creation/setup/folder-setup-support.ts b/src/renderer/src/lib/workspace/creation/setup/folder-setup-support.ts index b3148319601..57301a97b9c 100644 --- a/src/renderer/src/lib/workspace/creation/setup/folder-setup-support.ts +++ b/src/renderer/src/lib/workspace/creation/setup/folder-setup-support.ts @@ -5,7 +5,7 @@ import { } from '../../../../../../shared/execution-host' import { isFolderRepo } from '../../../../../../shared/repository/repo-kind' import type { WorkspaceHookOwner } from '../../../../../../shared/workspace-setup/hooks/workspace-hook-owner' -import type { RuntimeCapability } from '../../../../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../../../../shared/remote-runtime/protocol/protocol-version' import { WORKTREE_FOLDER_SETUP_RUNTIME_CAPABILITY } from '../../../../../../shared/remote-runtime/protocol/worktree-runtime-capabilities' import { runtimeEnvironmentSupportsCapability } from '@/runtime/rpc/compatibility/runtime-capability-proof' diff --git a/src/renderer/src/lib/workspace/creation/surface-policy/client-creation-action-policy.ts b/src/renderer/src/lib/workspace/creation/surface-policy/client-creation-action-policy.ts index c397f67acb6..f3182ad0375 100644 --- a/src/renderer/src/lib/workspace/creation/surface-policy/client-creation-action-policy.ts +++ b/src/renderer/src/lib/workspace/creation/surface-policy/client-creation-action-policy.ts @@ -1,5 +1,5 @@ import { FLOATING_TERMINAL_WORKTREE_ID } from '../../../../../../shared/constants' -import '../../../../../../shared/protocol-version' +import '../../../../../../shared/remote-runtime/protocol/protocol-version' import { BROWSER_SCREENCAST_RUNTIME_CAPABILITY } from '../../../../../../shared/browser/runtime/browser-runtime-capabilities' import { isPairedWebClientWindow } from '../../../../app-shell/chrome/desktop-window-chrome' import { runtimeEnvironmentIdOrLocalUnlessTwin } from '../../ownership/worktree-runtime-owner' diff --git a/src/renderer/src/runtime/browser/creation/web-runtime-browser-link-open.test.ts b/src/renderer/src/runtime/browser/creation/web-runtime-browser-link-open.test.ts index cdb258ed003..6df30fc0196 100644 --- a/src/renderer/src/runtime/browser/creation/web-runtime-browser-link-open.test.ts +++ b/src/renderer/src/runtime/browser/creation/web-runtime-browser-link-open.test.ts @@ -3,9 +3,9 @@ import type * as BrowserFocusModule from '@/components/browser-pane/host-guest/i import '../../../store/testing/app-store-test-fixture' import { getDefaultSettings } from '../../../../../shared/constants' import '../../../../../shared/remote-runtime/protocol/session-tabs-runtime-capabilities' -import '../../../../../shared/protocol-version' +import '../../../../../shared/remote-runtime/protocol/protocol-version' import '../../../lib/browser/navigation/http-link-in-group-availability' -import { createWebRuntimeSessionBrowserTab } from './web-runtime-browser-creation' +import './web-runtime-browser-creation' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { useAppStore } from '../../../store/index' import * as workspaceBrowserTabOpen from '../../../lib/browser/workspace/workspace-browser-tab-open' @@ -128,25 +128,6 @@ describe('runtime link opens through staging and materialization', () => { expect(requestBrowserFocus).not.toHaveBeenCalled() }) - it('a delivery callback failure cannot unwind a page that already materialized', async () => { - const call = installRuntimeTransport() - const creating = createWebRuntimeSessionBrowserTab({ - worktreeId: WT, - environmentId: ENV, - url: 'https://example.com/link', - placementPreference: 'server', - selectWorktree: false, - clientTargetGroupId: G2, - onMaterialized: () => { - throw new Error('Delivery failed') - } - }) - pendingCreates[0]!.resolve('delivered-page') - await expect(creating).rejects.toThrow('Delivery failed') - expect(wrapperForRemotePage('delivered-page')).toBeDefined() - expect(call.mock.calls.some(([request]) => request.method === 'browser.tabClose')).toBe(false) - }) - it('a newer link clears pending focus intent and suppresses stale success without claiming cancellation', async () => { const creating = open() const owner = captureWebSessionIntentOwner(ENV) diff --git a/src/renderer/src/runtime/ephemeral-vm/ephemeral-vm-workspace-target.ts b/src/renderer/src/runtime/ephemeral-vm/ephemeral-vm-workspace-target.ts index b5482f3719c..c61488fff4b 100644 --- a/src/renderer/src/runtime/ephemeral-vm/ephemeral-vm-workspace-target.ts +++ b/src/renderer/src/runtime/ephemeral-vm/ephemeral-vm-workspace-target.ts @@ -12,7 +12,7 @@ import { getEphemeralVmRecipeResultProjectRoot } from '../../../../shared/remote-runtime/ephemeral-vm-recipes/ephemeral-vm-recipes' import type { EphemeralVmRecipeResultWarning } from '../../../../shared/remote-runtime/ephemeral-vm-recipes/ephemeral-vm-recipe-diagnostics' -import '../../../../shared/protocol-version' +import '../../../../shared/remote-runtime/protocol/protocol-version' import { PROJECT_HOST_SETUP_RUNTIME_CAPABILITY, WORKTREE_PROVISIONED_ROOT_RUNTIME_CAPABILITY diff --git a/src/renderer/src/runtime/files/imports/runtime-file-import-pairing-revision.test.ts b/src/renderer/src/runtime/files/imports/runtime-file-import-pairing-revision.test.ts index 83588cb6ce4..b9194621810 100644 --- a/src/renderer/src/runtime/files/imports/runtime-file-import-pairing-revision.test.ts +++ b/src/renderer/src/runtime/files/imports/runtime-file-import-pairing-revision.test.ts @@ -14,7 +14,7 @@ import { FILE_MUTATION_OWNERSHIP_RUNTIME_CAPABILITY } from '../../../../../share import { MIN_COMPATIBLE_RUNTIME_CLIENT_VERSION, RUNTIME_PROTOCOL_VERSION -} from '../../../../../shared/protocol-version' +} from '../../../../../shared/remote-runtime/protocol/protocol-version' const ENVIRONMENT_ID = 'env-repaired' const CAPTURED_REVISION = 41 diff --git a/src/renderer/src/runtime/files/mutations/runtime-file-write-disk-precondition.test.ts b/src/renderer/src/runtime/files/mutations/runtime-file-write-disk-precondition.test.ts index 2b11191c7d5..add1669a39f 100644 --- a/src/renderer/src/runtime/files/mutations/runtime-file-write-disk-precondition.test.ts +++ b/src/renderer/src/runtime/files/mutations/runtime-file-write-disk-precondition.test.ts @@ -4,14 +4,14 @@ import { FILE_MUTATION_OWNERSHIP_RUNTIME_CAPABILITY } from '../../../../../share import { MIN_COMPATIBLE_RUNTIME_CLIENT_VERSION, RUNTIME_PROTOCOL_VERSION -} from '../../../../../shared/protocol-version' +} from '../../../../../shared/remote-runtime/protocol/protocol-version' import { FILE_WRITE_DISK_PRECONDITION_RUNTIME_CAPABILITY, FILE_WRITE_IDENTICAL_RUNTIME_CAPABILITY } from '../../../../../shared/file-write/file-write-disk-precondition' import { getDiskBaselineSignature } from '../../../../../shared/file-write/disk-baseline-signature' import { advanceRuntimeEnvironmentConnectionGeneration } from '@/store/slices/runtime-status/runtime-status-connection-generation' -import { replaceRuntimeEnvironmentRevisions } from '../../rpc/environment-revisions/runtime-environment-revision' + import { installRuntimeFileClientEnvironment, runtimeEnvironmentCall, @@ -100,26 +100,4 @@ describe('writeRuntimeFile disk precondition', () => { ).rejects.toThrow('Runtime connection changed') expect(writeCalls()).toHaveLength(0) }) - - it('does not take a re-paired host holding the text as proof a lost write landed', async () => { - replaceRuntimeEnvironmentRevisions([{ id: 'env-1', createdAt: 1, pairingRevision: 1 }]) - serveHost({ enforcesPrecondition: true, diskContent: 'edited' }) - runtimeEnvironmentCall.mockImplementation(async () => { - // The reply is lost, and the environment id is re-paired to another machine meanwhile. - replaceRuntimeEnvironmentRevisions([{ id: 'env-1', createdAt: 1, pairingRevision: 2 }]) - return { - id: 'rpc', - ok: false, - error: { - code: 'runtime_timeout', - message: 'Timed out waiting for the remote Orca runtime' - }, - _meta: { runtimeId: 'remote-runtime' } - } - }) - - await expect( - writeRuntimeFile(remoteContext, '/remote/repo/file.ts', 'edited', undefined, precondition) - ).rejects.toThrow('Timed out') - }) }) diff --git a/src/renderer/src/runtime/files/runtime-file-client-test-harness.ts b/src/renderer/src/runtime/files/runtime-file-client-test-harness.ts index 7a90a3ac937..55693adbac2 100644 --- a/src/renderer/src/runtime/files/runtime-file-client-test-harness.ts +++ b/src/renderer/src/runtime/files/runtime-file-client-test-harness.ts @@ -7,7 +7,7 @@ import { FILE_MUTATION_OWNERSHIP_RUNTIME_CAPABILITY } from '../../../../shared/f import { MIN_COMPATIBLE_RUNTIME_CLIENT_VERSION, RUNTIME_PROTOCOL_VERSION -} from '../../../../shared/protocol-version' +} from '../../../../shared/remote-runtime/protocol/protocol-version' /** One stub stands in for many differently shaped preload methods, so arguments stay open. */ export type PreloadStub = Mock<(...args: never[]) => unknown> diff --git a/src/renderer/src/runtime/hosted-terminals/creation/agent-launch/agent-resume-host-authority-capability.ts b/src/renderer/src/runtime/hosted-terminals/creation/agent-launch/agent-resume-host-authority-capability.ts index e7d77ce5ede..e9297dbd227 100644 --- a/src/renderer/src/runtime/hosted-terminals/creation/agent-launch/agent-resume-host-authority-capability.ts +++ b/src/renderer/src/runtime/hosted-terminals/creation/agent-launch/agent-resume-host-authority-capability.ts @@ -15,7 +15,7 @@ import { AGENT_SESSION_KIRO_RESUME_RUNTIME_CAPABILITY } from '../../../../../../shared/agent-session/lifecycle/resume/agent-session-resume-runtime-capabilities' import { AGENT_SESSION_OMP_RESUME_PATH_RUNTIME_CAPABILITY } from '../../../../../../shared/agent-session/agent-session-runtime-capabilities' -import type { RuntimeCapability } from '../../../../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../../../../shared/remote-runtime/protocol/protocol-version' // New resumable enum members can make older hosts return invalid_argument instead of legacy fallback, killing panes. Probe per-agent capability; exhaustive Record requires an explicit gate or deliberate undefined for additions. const RESUME_HOST_AUTHORITY_CAPABILITY_BY_AGENT = { diff --git a/src/renderer/src/runtime/hosted-terminals/creation/agent-launch/remote-agent-session-launch.ts b/src/renderer/src/runtime/hosted-terminals/creation/agent-launch/remote-agent-session-launch.ts index 42728d3c4ad..827220105b1 100644 --- a/src/renderer/src/runtime/hosted-terminals/creation/agent-launch/remote-agent-session-launch.ts +++ b/src/renderer/src/runtime/hosted-terminals/creation/agent-launch/remote-agent-session-launch.ts @@ -1,5 +1,5 @@ import { AGENT_SESSION_HOST_AUTHORITY_RUNTIME_CAPABILITY } from '../../../../../../shared/agent-session/agent-session-runtime-capabilities' -import type { RuntimeCapability } from '../../../../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../../../../shared/remote-runtime/protocol/protocol-version' import { RuntimeRpcCallError } from '../../../rpc/calls/runtime-rpc-result' import { runtimeEnvironmentSupportsCapability } from '../../../rpc/compatibility/runtime-capability-proof' import { isRuntimeCompatBlockError } from '../../../rpc/compatibility/runtime-protocol-compat' diff --git a/src/renderer/src/runtime/hosted-terminals/creation/terminal-create-contracts.ts b/src/renderer/src/runtime/hosted-terminals/creation/terminal-create-contracts.ts index fbdd295a4b6..dd45f280432 100644 --- a/src/renderer/src/runtime/hosted-terminals/creation/terminal-create-contracts.ts +++ b/src/renderer/src/runtime/hosted-terminals/creation/terminal-create-contracts.ts @@ -10,7 +10,7 @@ import type { StartupCommandDelivery } from '../../../../../shared/agent-launch/ import type { RuntimeTerminalCreate } from '../../../../../shared/terminal/runtime/runtime-terminal-create-contract' import type { TuiAgent } from '../../../../../shared/agent-launch/catalog/tui-agent' import type { SessionOptionValue } from '../../../../../shared/native-chat/input/native-chat-session-options' -import type { RuntimeCapability } from '../../../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../../../shared/remote-runtime/protocol/protocol-version' export type WebRuntimeTerminalCreateOutcome = | { status: 'created' } diff --git a/src/renderer/src/runtime/hosted-terminals/restoration/remote-restore-spawn-intent.ts b/src/renderer/src/runtime/hosted-terminals/restoration/remote-restore-spawn-intent.ts index eb347b5e3ea..f032f04317a 100644 --- a/src/renderer/src/runtime/hosted-terminals/restoration/remote-restore-spawn-intent.ts +++ b/src/renderer/src/runtime/hosted-terminals/restoration/remote-restore-spawn-intent.ts @@ -1,5 +1,5 @@ import type { RestoreSpawnIntent } from '../../../../../shared/terminal/pty/admission/spawn-admission-contract' -import '../../../../../shared/protocol-version' +import '../../../../../shared/remote-runtime/protocol/protocol-version' import { TERMINAL_SPAWN_INTENT_RUNTIME_CAPABILITY } from '../../../../../shared/terminal/runtime-policy/terminal-runtime-capabilities' import { runtimeEnvironmentSupportsCapability } from '../../rpc/compatibility/runtime-capability-proof' diff --git a/src/renderer/src/runtime/hosts/capabilities/local-runtime-capabilities.ts b/src/renderer/src/runtime/hosts/capabilities/local-runtime-capabilities.ts index cee2a00b0e1..55f5d6167b7 100644 --- a/src/renderer/src/runtime/hosts/capabilities/local-runtime-capabilities.ts +++ b/src/renderer/src/runtime/hosts/capabilities/local-runtime-capabilities.ts @@ -1,4 +1,4 @@ -import type { RuntimeCapability } from '../../../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../../../shared/remote-runtime/protocol/protocol-version' type LocalRuntimeCapabilityObservation = | { state: 'unlearned' | 'pending' | 'unavailable' } diff --git a/src/renderer/src/runtime/hosts/updates/remote-server-restart-wait.ts b/src/renderer/src/runtime/hosts/updates/remote-server-restart-wait.ts index 1a2069ab34b..dcb1dc3f251 100644 --- a/src/renderer/src/runtime/hosts/updates/remote-server-restart-wait.ts +++ b/src/renderer/src/runtime/hosts/updates/remote-server-restart-wait.ts @@ -1,4 +1,4 @@ -import { hasReachedAppVersion } from '../../../../../shared/app-version' +import { hasReachedAppVersion } from '../../../../../shared/app-lifecycle/identity/app-version' import type { RemoteServerUpdateInstallResult, RemoteServerUpdaterSnapshot diff --git a/src/renderer/src/runtime/hosts/updates/remote-server-update-coordinator.ts b/src/renderer/src/runtime/hosts/updates/remote-server-update-coordinator.ts index 2d84073cf25..f2b5702d79e 100644 --- a/src/renderer/src/runtime/hosts/updates/remote-server-update-coordinator.ts +++ b/src/renderer/src/runtime/hosts/updates/remote-server-update-coordinator.ts @@ -4,7 +4,7 @@ import { isPerfPrereleaseAppVersion, isPrereleaseAppVersion, isValidAppVersion -} from '../../../../../shared/app-version' +} from '../../../../../shared/app-lifecycle/identity/app-version' import { REMOTE_SERVER_UPDATE_CAPABILITY, type RemoteServerUpdateInstallResult, @@ -17,7 +17,7 @@ import { type PublicKnownRuntimeEnvironment } from '../../../../../shared/remote-runtime/host-catalog/runtime-environments' import type { RuntimeStatus } from '../../../../../shared/remote-runtime/session-graph/runtime-session-contracts' -import type { UpdateCheckOptions } from '../../../../../shared/update-status-types' +import type { UpdateCheckOptions } from '../../../../../shared/updater/update-status-types' import { waitForReplacementRuntime } from './remote-server-restart-wait' import { remoteServerUpdateErrorMessage } from './remote-server-update-errors' import { pollRemoteServerUpdater } from './remote-server-updater-polling' diff --git a/src/renderer/src/runtime/native-chat/host-capabilities/structured-agent-session-host-capability.ts b/src/renderer/src/runtime/native-chat/host-capabilities/structured-agent-session-host-capability.ts index f737997e15f..534229b32a0 100644 --- a/src/renderer/src/runtime/native-chat/host-capabilities/structured-agent-session-host-capability.ts +++ b/src/renderer/src/runtime/native-chat/host-capabilities/structured-agent-session-host-capability.ts @@ -16,7 +16,7 @@ import { AGENT_SESSION_QUEUED_MESSAGES_RUNTIME_CAPABILITY, AGENT_SESSION_REWIND_RECOVERY_CAPABILITY } from '../../../../../shared/agent-session/agent-session-runtime-capabilities' -import type { RuntimeCapability } from '../../../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../../../shared/remote-runtime/protocol/protocol-version' import type { RuntimeClientTarget } from '../../../../../shared/remote-runtime/host-catalog/runtime-client-target' import { ensureLocalRuntimeCapabilities, diff --git a/src/renderer/src/runtime/native-chat/host-capabilities/structured-agent-session-host-support.ts b/src/renderer/src/runtime/native-chat/host-capabilities/structured-agent-session-host-support.ts index a1d9280e2dd..0cb7940d602 100644 --- a/src/renderer/src/runtime/native-chat/host-capabilities/structured-agent-session-host-support.ts +++ b/src/renderer/src/runtime/native-chat/host-capabilities/structured-agent-session-host-support.ts @@ -26,7 +26,7 @@ import { import '../../rpc/subscriptions/runtime-rpc-subscribe' import '../requests/structured-agent-session-request-timeouts' import type { RuntimeClientTarget } from '../../../../../shared/remote-runtime/host-catalog/runtime-client-target' -import type { RuntimeCapability } from '../../../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../../../shared/remote-runtime/protocol/protocol-version' import type { StructuredAgentSessionHostCapabilityState } from '../../../../../shared/agent-session/structured-agent-session-host-capability' /** Read a capability through the runtime's existing status cache. A failed/unknown diff --git a/src/renderer/src/runtime/repository-gitlab/gitlab-owner-api.ts b/src/renderer/src/runtime/repository-gitlab/gitlab-owner-api.ts index 2267c6454c9..7521c0fa8d0 100644 --- a/src/renderer/src/runtime/repository-gitlab/gitlab-owner-api.ts +++ b/src/renderer/src/runtime/repository-gitlab/gitlab-owner-api.ts @@ -1,4 +1,4 @@ -import type { RuntimeCapability } from '../../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../../shared/remote-runtime/protocol/protocol-version' import { createRuntimeGitLabApi, RuntimeCapabilityMissingError, diff --git a/src/renderer/src/runtime/repository-gitlab/runtime-gitlab-api.ts b/src/renderer/src/runtime/repository-gitlab/runtime-gitlab-api.ts index dde266ae7c5..16e4d3d371e 100644 --- a/src/renderer/src/runtime/repository-gitlab/runtime-gitlab-api.ts +++ b/src/renderer/src/runtime/repository-gitlab/runtime-gitlab-api.ts @@ -5,7 +5,7 @@ import { GITLAB_READY_FOR_REVIEW_RUNTIME_CAPABILITY, GITLAB_READY_FOR_REVIEW_UPDATE_REQUIRED_MESSAGE } from '../../../../shared/source-control/runtime/source-control-runtime-capabilities' -import type { RuntimeCapability } from '../../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../../shared/remote-runtime/protocol/protocol-version' import { GITLAB_WEB_RPC_METHODS, type WebGitLabRuntimeMethod diff --git a/src/renderer/src/runtime/rpc/compatibility/runtime-capability-proof.ts b/src/renderer/src/runtime/rpc/compatibility/runtime-capability-proof.ts index 22cf8c3365e..06445c76d7e 100644 --- a/src/renderer/src/runtime/rpc/compatibility/runtime-capability-proof.ts +++ b/src/renderer/src/runtime/rpc/compatibility/runtime-capability-proof.ts @@ -1,4 +1,4 @@ -import type { RuntimeCapability } from '../../../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../../../shared/remote-runtime/protocol/protocol-version' import { captureRuntimeEnvironmentRequestRevision, getRuntimeEnvironmentRevision, diff --git a/src/renderer/src/runtime/rpc/compatibility/runtime-compatibility-cache.ts b/src/renderer/src/runtime/rpc/compatibility/runtime-compatibility-cache.ts index a5c37941ea5..7c343a5e703 100644 --- a/src/renderer/src/runtime/rpc/compatibility/runtime-compatibility-cache.ts +++ b/src/renderer/src/runtime/rpc/compatibility/runtime-compatibility-cache.ts @@ -1,4 +1,4 @@ -import type { RuntimeCapability } from '../../../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../../../shared/remote-runtime/protocol/protocol-version' import type { RuntimeStatus } from '../../../../../shared/remote-runtime/session-graph/runtime-session-contracts' import { isRuntimeStatusCompatible } from './runtime-protocol-compat' diff --git a/src/renderer/src/runtime/rpc/compatibility/runtime-protocol-compat.ts b/src/renderer/src/runtime/rpc/compatibility/runtime-protocol-compat.ts index de30463516d..b538d1770dc 100644 --- a/src/renderer/src/runtime/rpc/compatibility/runtime-protocol-compat.ts +++ b/src/renderer/src/runtime/rpc/compatibility/runtime-protocol-compat.ts @@ -3,7 +3,7 @@ import { describeRuntimeCompatBlock } from '@/runtime/hosts/display/runtime-host import { MIN_COMPATIBLE_RUNTIME_SERVER_VERSION, RUNTIME_PROTOCOL_VERSION -} from '../../../../../shared/protocol-version' +} from '../../../../../shared/remote-runtime/protocol/protocol-version' import type { RuntimeStatus } from '../../../../../shared/remote-runtime/session-graph/runtime-session-contracts' /** Marker on the compat-gate block error. Tagged as a `.code` on a plain Error diff --git a/src/renderer/src/runtime/rpc/compatibility/runtime-target-capability.ts b/src/renderer/src/runtime/rpc/compatibility/runtime-target-capability.ts index 9e6aa4ad462..cb5b0bf64cc 100644 --- a/src/renderer/src/runtime/rpc/compatibility/runtime-target-capability.ts +++ b/src/renderer/src/runtime/rpc/compatibility/runtime-target-capability.ts @@ -1,4 +1,4 @@ -import type { RuntimeCapability } from '../../../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../../../shared/remote-runtime/protocol/protocol-version' import type { RuntimeClientTarget } from '../../../../../shared/remote-runtime/host-catalog/runtime-client-target' import { ensureLocalRuntimeCapabilities } from '../../hosts/capabilities/local-runtime-capabilities' import { runtimeEnvironmentSupportsCapability } from './runtime-capability-proof' diff --git a/src/renderer/src/runtime/rpc/targets/paired-host-client-capabilities.ts b/src/renderer/src/runtime/rpc/targets/paired-host-client-capabilities.ts index 66da6d89128..91f57922537 100644 --- a/src/renderer/src/runtime/rpc/targets/paired-host-client-capabilities.ts +++ b/src/renderer/src/runtime/rpc/targets/paired-host-client-capabilities.ts @@ -1,7 +1,7 @@ -import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../../../shared/electron-remote-runtime-client-capabilities' +import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../../../shared/remote-runtime/protocol/electron-remote-runtime-client-capabilities' import { remoteRuntimeClientCapabilities } from '../../../../../shared/remote-runtime/remote-runtime-client-capabilities' import { isWebClientLocation } from '@/app-shell/platform/web-client-location' -import { WEB_RUNTIME_CLIENT_CAPABILITIES } from '../../../../../shared/web-runtime-client-capabilities' +import { WEB_RUNTIME_CLIENT_CAPABILITIES } from '../../../../../shared/remote-runtime/protocol/web-runtime-client-capabilities' /** What this client tells a paired host it can do, exactly as its handshake sends it: the desktop's * transports add the shared remote base to the Electron list; the browser client sends its own. */ diff --git a/src/renderer/src/runtime/rpc/testing/runtime-compatibility-test-fixture.ts b/src/renderer/src/runtime/rpc/testing/runtime-compatibility-test-fixture.ts index ebc089b4575..a85fd9f46bb 100644 --- a/src/renderer/src/runtime/rpc/testing/runtime-compatibility-test-fixture.ts +++ b/src/renderer/src/runtime/rpc/testing/runtime-compatibility-test-fixture.ts @@ -7,7 +7,7 @@ import { MIN_COMPATIBLE_RUNTIME_CLIENT_VERSION, RUNTIME_CAPABILITIES, RUNTIME_PROTOCOL_VERSION -} from '../../../../../shared/protocol-version' +} from '../../../../../shared/remote-runtime/protocol/protocol-version' export type RuntimeEnvironmentCallRequest = { method: string diff --git a/src/renderer/src/runtime/skills/bundled/runtime-bundled-skills-client.test.ts b/src/renderer/src/runtime/skills/bundled/runtime-bundled-skills-client.test.ts deleted file mode 100644 index 02ebdb25c62..00000000000 --- a/src/renderer/src/runtime/skills/bundled/runtime-bundled-skills-client.test.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { beforeEach, describe, expect, it, vi } from 'vitest' -import { autoUpdateBundledSkillsOnTarget } from './runtime-bundled-skills-client' -import { clearRuntimeCompatibilityCache } from '../../rpc/compatibility/runtime-compatibility-cache' -import { replaceRuntimeEnvironmentRevisions } from '../../rpc/environment-revisions/runtime-environment-revision' -import { BUNDLED_ORCA_SKILL_AUTO_UPDATE_CAPABILITY } from '../../../../../shared/skills/capabilities/skill-install-capability' -import { - MIN_COMPATIBLE_RUNTIME_CLIENT_VERSION, - RUNTIME_PROTOCOL_VERSION -} from '../../../../../shared/protocol-version' - -const ENVIRONMENT_ID = 'server-1' -const target = { kind: 'environment' as const, environmentId: ENVIRONMENT_ID } - -type CallArgs = { - selector: string - method: string - params?: unknown - expectedEnvironmentPairingRevision?: number - expectedEnvironmentRuntimeId?: string -} -const call = vi.fn<(args: CallArgs) => unknown>() - -function setPairingRevision(pairingRevision: number): void { - replaceRuntimeEnvironmentRevisions([{ id: ENVIRONMENT_ID, createdAt: 1, pairingRevision }]) -} - -function status(runtimeId: string) { - return { - id: 'status', - ok: true, - result: { - runtimeId, - runtimeProtocolVersion: RUNTIME_PROTOCOL_VERSION, - minCompatibleRuntimeClientVersion: MIN_COMPATIBLE_RUNTIME_CLIENT_VERSION, - capabilities: [BUNDLED_ORCA_SKILL_AUTO_UPDATE_CAPABILITY] - }, - _meta: { runtimeId } - } -} - -beforeEach(() => { - clearRuntimeCompatibilityCache() - setPairingRevision(41) - call.mockReset() - vi.stubGlobal('window', { api: { runtimeEnvironments: { call } } }) -}) - -describe('silent skill update on a paired server', () => { - it('sends the update only to the runtime and pairing that answered the capability check', async () => { - call.mockImplementation(async (args) => - args.method === 'status.get' - ? status('runtime-a') - : { id: 'u', ok: true, result: { scope: 'global', skills: [] }, _meta: {} } - ) - - await autoUpdateBundledSkillsOnTarget(target, ['orca-cli'], { recordOnly: true }) - - expect(call).toHaveBeenCalledWith( - expect.objectContaining({ - method: 'skills.autoUpdateBundledOrca', - params: { names: ['orca-cli'], recordOnly: true }, - expectedEnvironmentPairingRevision: 41, - expectedEnvironmentRuntimeId: 'runtime-a' - }) - ) - }) - - it('never sends the update when the server is re-paired while the capability check awaits', async () => { - call.mockImplementation(async (args) => { - if (args.method === 'status.get') { - // Another host takes over this saved server before its status answer arrives. - setPairingRevision(42) - return status('runtime-b') - } - return { id: 'u', ok: true, result: { scope: 'global', skills: [] }, _meta: {} } - }) - - await expect(autoUpdateBundledSkillsOnTarget(target, ['orca-cli'])).rejects.toThrow() - expect(call).not.toHaveBeenCalledWith( - expect.objectContaining({ method: 'skills.autoUpdateBundledOrca' }) - ) - }) -}) diff --git a/src/renderer/src/runtime/workspace-layout/server/server-held-panes.ts b/src/renderer/src/runtime/workspace-layout/server/server-held-panes.ts index 36c10d08a86..51052ef7ac7 100644 --- a/src/renderer/src/runtime/workspace-layout/server/server-held-panes.ts +++ b/src/renderer/src/runtime/workspace-layout/server/server-held-panes.ts @@ -1,6 +1,6 @@ // Show server frame status=held in the existing newer-build banner. Reopen asks server main; desktop starts nothing and subsequent cleared/bound frames show recovery. -import type { NewerDaemonReopenResult } from '../../../../../shared/newer-daemon-hold' +import type { NewerDaemonReopenResult } from '../../../../../shared/terminal/daemon/newer-daemon-hold' import { isTerminalLeafId, makePaneKey diff --git a/src/renderer/src/store/slices/agent-inventory/detected-agents.test.ts b/src/renderer/src/store/slices/agent-inventory/detected-agents.test.ts index a1c3e10697b..1914a4cd1e8 100644 --- a/src/renderer/src/store/slices/agent-inventory/detected-agents.test.ts +++ b/src/renderer/src/store/slices/agent-inventory/detected-agents.test.ts @@ -8,7 +8,7 @@ import { createRuntimeDetectedAgentsSlice } from './runtime-detected-agents' import { MIN_COMPATIBLE_RUNTIME_CLIENT_VERSION, RUNTIME_PROTOCOL_VERSION -} from '../../../../../shared/protocol-version' +} from '../../../../../shared/remote-runtime/protocol/protocol-version' import { clearRuntimeCompatibilityCache as clearRuntimeCompatibilityCacheForTests } from '@/runtime/rpc/compatibility/runtime-compatibility-cache' const detectAgents = vi.fn() @@ -141,38 +141,6 @@ describe('createDetectedAgentsSlice remote detection', () => { }) }) - it('does not restore an SSH cache entry after it is cleared mid-detection', async () => { - const store = createTestStore() - let resolveRemote: (ids: string[]) => void = () => {} - detectRemoteAgents.mockReturnValueOnce( - new Promise((resolve) => { - resolveRemote = resolve - }) - ) - - const pending = store.getState().ensureRemoteDetectedAgents('ssh-1') - store.getState().clearRemoteDetectedAgents('ssh-1') - resolveRemote(['claude']) - - await expect(pending).resolves.toEqual(['claude']) - expect(store.getState().remoteDetectedAgentIds).not.toHaveProperty('ssh-1') - expect(store.getState().isDetectingRemoteAgents).not.toHaveProperty('ssh-1') - }) - - it('re-runs remote detection after an empty result instead of pinning it', async () => { - const store = createTestStore() - // Retry empty detections so later installs/PATH fixes appear without reconnect; [] truthiness must not cache misses. - detectRemoteAgents.mockResolvedValueOnce([]) - - await expect(store.getState().ensureRemoteDetectedAgents('ssh-1')).resolves.toEqual([]) - expect(store.getState().remoteDetectedAgentIds['ssh-1']).toEqual([]) - - detectRemoteAgents.mockResolvedValueOnce(['kilo']) - - await expect(store.getState().ensureRemoteDetectedAgents('ssh-1')).resolves.toEqual(['kilo']) - expect(store.getState().remoteDetectedAgentIds['ssh-1']).toEqual(['kilo']) - }) - it.each([false, true])( 'follows an automatic host refresh with one explicit request (automatic fails: %s)', async (fails) => { diff --git a/src/renderer/src/store/slices/orca-profiles/create-orca-profiles-slice.ts b/src/renderer/src/store/slices/orca-profiles/create-orca-profiles-slice.ts index 8bf623831b0..6a5f5e7eef3 100644 --- a/src/renderer/src/store/slices/orca-profiles/create-orca-profiles-slice.ts +++ b/src/renderer/src/store/slices/orca-profiles/create-orca-profiles-slice.ts @@ -8,7 +8,7 @@ import type { SwitchOrcaProfileResult, TransferOrcaProfileProjectArgs, TransferOrcaProfileProjectResult -} from '../../../../../shared/orca-profiles' +} from '../../../../../shared/orca-profiles/orca-profiles' import type { AppState } from '../../types' import { createOrcaProfilesAuthActions, diff --git a/src/renderer/src/store/slices/orca-profiles/orca-profiles-auth-actions.ts b/src/renderer/src/store/slices/orca-profiles/orca-profiles-auth-actions.ts index 5908658f551..1ca4f235ec4 100644 --- a/src/renderer/src/store/slices/orca-profiles/orca-profiles-auth-actions.ts +++ b/src/renderer/src/store/slices/orca-profiles/orca-profiles-auth-actions.ts @@ -7,7 +7,7 @@ import type { RefreshCurrentOrcaProfileAuthResult, SelectOrcaProfileOrgResult, SignOutCurrentOrcaProfileResult -} from '../../../../../shared/orca-profiles' +} from '../../../../../shared/orca-profiles/orca-profiles' import type { AppState } from '../../types' export type OrcaProfilesAuthActions = { diff --git a/src/renderer/src/store/slices/runtime-host-updates/remote-server-updates.ts b/src/renderer/src/store/slices/runtime-host-updates/remote-server-updates.ts index 134817908cd..e168ee10ecd 100644 --- a/src/renderer/src/store/slices/runtime-host-updates/remote-server-updates.ts +++ b/src/renderer/src/store/slices/runtime-host-updates/remote-server-updates.ts @@ -4,7 +4,7 @@ import type { RemoteServerUpdaterSnapshot } from '../../../../../shared/remote-r import { isListedRemoteServer } from '../../../../../shared/remote-runtime/host-catalog/runtime-environments' import type { RuntimeRpcResponse } from '../../../../../shared/remote-runtime/rpc/runtime-rpc-envelope' import type { RuntimeStatus } from '../../../../../shared/remote-runtime/session-graph/runtime-session-contracts' -import type { UpdateCheckOptions } from '../../../../../shared/update-status-types' +import type { UpdateCheckOptions } from '../../../../../shared/updater/update-status-types' import { unwrapRuntimeRpcResult } from '@/runtime/rpc/calls/runtime-rpc-result' import { checkingRemoteServerUpdateEntry, diff --git a/src/renderer/src/store/slices/ui/ui-slice-contract-preferences.ts b/src/renderer/src/store/slices/ui/ui-slice-contract-preferences.ts index 347caa13d8d..43a36b86eca 100644 --- a/src/renderer/src/store/slices/ui/ui-slice-contract-preferences.ts +++ b/src/renderer/src/store/slices/ui/ui-slice-contract-preferences.ts @@ -21,8 +21,8 @@ import type { AutomationHostFilter } from '../../../../../shared/automations/own import type { WorkspaceStatusDefinition } from '../../../../../shared/worktree/types' import type { WorkspacePortScanResult } from '../../../../../shared/workspace/ports/workspace-ports' import type { CustomPet } from '../../../../../shared/pet-types' -import type { ReleaseChannel } from '../../../../../shared/release-channel' -import type { ChangelogData, UpdateStatus } from '../../../../../shared/update-status-types' +import type { ReleaseChannel } from '../../../../../shared/updater/release-channel' +import type { ChangelogData, UpdateStatus } from '../../../../../shared/updater/update-status-types' import type { StatusBarUsageMode } from '../../../../../shared/status-bar/status-bar-usage-mode' import type { PersistedUIWriteBaseline } from './persisted-ui-write-baseline' import type { UISliceCore } from './ui-slice-contract-core' diff --git a/src/renderer/src/store/slices/ui/ui-slice-hydration-actions.ts b/src/renderer/src/store/slices/ui/ui-slice-hydration-actions.ts index b1fcdb25dc6..c60c49eb414 100644 --- a/src/renderer/src/store/slices/ui/ui-slice-hydration-actions.ts +++ b/src/renderer/src/store/slices/ui/ui-slice-hydration-actions.ts @@ -38,7 +38,7 @@ import { normalizeUsagePercentageDisplay } from '../../../../../shared/agent-usa import { normalizeStatusBarUsageMode } from '../../../../../shared/status-bar/status-bar-usage-mode' import { normalizeBrowserPageZoomLevel } from '../../../../../shared/browser/site-settings/browser-page-zoom' import { normalizeKagiSessionLink } from '../../../../../shared/browser/navigation/browser-url' -import { isReleaseChannel } from '../../../../../shared/release-channel' +import { isReleaseChannel } from '../../../../../shared/updater/release-channel' import { filterSetupScriptPromptDismissalsToValidRepos, sanitizeSetupScriptPromptDismissals diff --git a/src/renderer/src/store/terminals/quick-commands/terminal-quick-command-hosts.ts b/src/renderer/src/store/terminals/quick-commands/terminal-quick-command-hosts.ts index f0b2668bd4b..56ef4e90ef5 100644 --- a/src/renderer/src/store/terminals/quick-commands/terminal-quick-command-hosts.ts +++ b/src/renderer/src/store/terminals/quick-commands/terminal-quick-command-hosts.ts @@ -8,7 +8,7 @@ import { type TerminalQuickCommandMutation } from '../../../../../shared/terminal/quick-commands/terminal-quick-commands' import { parseExecutionHostId, type ExecutionHostId } from '../../../../../shared/execution-host' -import '../../../../../shared/protocol-version' +import '../../../../../shared/remote-runtime/protocol/protocol-version' import { TERMINAL_QUICK_COMMANDS_RUNTIME_CAPABILITY } from '../../../../../shared/terminal/quick-commands/terminal-quick-command-capabilities' import { callRuntimeRpc } from '@/runtime/rpc/calls/runtime-rpc-call' import { runtimeEnvironmentSupportsCapability } from '@/runtime/rpc/compatibility/runtime-capability-proof' diff --git a/src/renderer/src/web/preload-api/web-jira-filter-state-api.ts b/src/renderer/src/web/preload-api/web-jira-filter-state-api.ts index cc98eab3040..083dfdd9aba 100644 --- a/src/renderer/src/web/preload-api/web-jira-filter-state-api.ts +++ b/src/renderer/src/web/preload-api/web-jira-filter-state-api.ts @@ -8,7 +8,7 @@ import { JIRA_STATUS_FILTER_UPDATE_REQUIRED, type JiraQuickFilterState } from '../../../../shared/jira/jira-quick-filters' -import type { RuntimeCapability } from '../../../../shared/protocol-version' +import type { RuntimeCapability } from '../../../../shared/remote-runtime/protocol/protocol-version' import type { JiraSavedFilterState } from '../../../../shared/jira/jira-saved-filters' import { callRuntimeResult, getRemoteRuntimeStatus } from './web-runtime-calls' import { assertActiveEnvironment, requireActiveEnvironment } from './web-runtime-session' diff --git a/src/renderer/src/web/preload-api/web-orca-profiles-api.ts b/src/renderer/src/web/preload-api/web-orca-profiles-api.ts index 16ff0d1c356..8e4949e4b6b 100644 --- a/src/renderer/src/web/preload-api/web-orca-profiles-api.ts +++ b/src/renderer/src/web/preload-api/web-orca-profiles-api.ts @@ -2,7 +2,7 @@ import type { PreloadApi } from '../../../../preload/api-types' import { DEFAULT_LOCAL_ORCA_PROFILE_ID, createDefaultLocalOrcaProfile -} from '../../../../shared/orca-profiles' +} from '../../../../shared/orca-profiles/orca-profiles' import { noopUnsubscribe } from './web-storage' export function createWebOrcaProfilesApi(): Partial { diff --git a/src/renderer/src/web/preload-api/web-settings-api.ts b/src/renderer/src/web/preload-api/web-settings-api.ts index 52f19de32be..1d816a485c9 100644 --- a/src/renderer/src/web/preload-api/web-settings-api.ts +++ b/src/renderer/src/web/preload-api/web-settings-api.ts @@ -3,7 +3,7 @@ import { legacyMatchTerminalSidebarWrite } from '../../../../shared/plugin-theme import { computerAwakeSettingsForMode, normalizeComputerAwakeMode -} from '../../../../shared/computer-awake-mode' +} from '../../../../shared/app-lifecycle/computer-awake-mode' import { normalizeTerminalCursorStyleDefault } from '../../../../shared/terminal/appearance/terminal-cursor-style-settings' import { mergeSettings, stripRetiredWebChatSettings } from './web-preference-normalization' import { diff --git a/src/renderer/src/web/web-preload-api-runtime-environment.test.ts b/src/renderer/src/web/web-preload-api-runtime-environment.test.ts index 6356db0242a..7230bd47896 100644 --- a/src/renderer/src/web/web-preload-api-runtime-environment.test.ts +++ b/src/renderer/src/web/web-preload-api-runtime-environment.test.ts @@ -1,6 +1,6 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import type { RuntimeRpcResponse } from '../../../shared/remote-runtime/rpc/runtime-rpc-envelope' -import { MIN_COMPATIBLE_RUNTIME_SERVER_VERSION } from '../../../shared/protocol-version' +import { MIN_COMPATIBLE_RUNTIME_SERVER_VERSION } from '../../../shared/remote-runtime/protocol/protocol-version' import { encodePairingCode, installBrowserGlobals, diff --git a/src/renderer/src/web/web-runtime-auth-verdict.ts b/src/renderer/src/web/web-runtime-auth-verdict.ts index 7911b26c37d..21b800e473c 100644 --- a/src/renderer/src/web/web-runtime-auth-verdict.ts +++ b/src/renderer/src/web/web-runtime-auth-verdict.ts @@ -1,5 +1,5 @@ import type { PairedE2EEAuthReply } from '../../../shared/remote-runtime/e2ee/paired-e2ee-client-handshake' -import { INSECURE_WEB_ORIGIN_AUTH_CODE } from '../../../shared/web-origin-security' +import { INSECURE_WEB_ORIGIN_AUTH_CODE } from '../../../shared/remote-runtime/pairing/web-origin-security' import type { WebRuntimeAuthFailureReason } from './web-runtime-client-error' import type { WebRuntimeAuthPlan, diff --git a/src/renderer/src/web/web-runtime-client.test.ts b/src/renderer/src/web/web-runtime-client.test.ts index 884d1fc9d35..81024676b0a 100644 --- a/src/renderer/src/web/web-runtime-client.test.ts +++ b/src/renderer/src/web/web-runtime-client.test.ts @@ -13,7 +13,7 @@ import { encryptBytes as encryptSharedBytes } from '../../../shared/remote-runtime/e2ee/node/e2ee-crypto' import type { RuntimeRpcResponse } from '../../../shared/remote-runtime/rpc/runtime-rpc-envelope' -import '../../../shared/protocol-version' +import '../../../shared/remote-runtime/protocol/protocol-version' const fakeSockets: FakeWebSocket[] = [] @@ -112,48 +112,6 @@ describe('WebRuntimeClient', () => { } }) - it('ignores messages from a stale socket after reconnect creates a replacement', async () => { - vi.useFakeTimers() - const timerWindow = window as unknown as { - setTimeout: typeof setTimeout - clearTimeout: typeof clearTimeout - } - timerWindow.setTimeout = setTimeout - timerWindow.clearTimeout = clearTimeout - // Pin the one-sided reconnect jitter to zero so the redial lands on its exact backoff step. - const random = vi.spyOn(Math, 'random').mockReturnValue(0) - const client = new WebRuntimeClient( - pairedRuntimeConnectionFromOffer({ - v: 2, - endpoint: 'ws://127.0.0.1:6768', - deviceToken: 'token', - publicKeyB64: Buffer.alloc(32).toString('base64') - }) - ) - - try { - const staleSocket = fakeSockets[0]! - - await vi.advanceTimersByTimeAsync(12_000) - await vi.advanceTimersByTimeAsync(500) - - const replacementSocket = fakeSockets[1]! - replacementSocket.readyState = FakeWebSocket.OPEN - replacementSocket.onopen?.() - - expect(replacementSocket.send).toHaveBeenCalledTimes(1) - - staleSocket.onmessage?.({ data: JSON.stringify({ type: 'e2ee_ready' }) }) - await Promise.resolve() - - expect(replacementSocket.send).toHaveBeenCalledTimes(1) - } finally { - client.close() - random.mockRestore() - vi.useRealTimers() - } - }) - it('retires a socket whose handshake expires without waiting for the browser close event', async () => { vi.useFakeTimers() const timerWindow = window as unknown as { @@ -201,209 +159,6 @@ describe('WebRuntimeClient', () => { } }) - it('retains and retries a shared local subscription when remote unwatch returns failure', async () => { - const client = new WebRuntimeClient( - pairedRuntimeConnectionFromOffer({ - v: 2, - endpoint: 'ws://127.0.0.1:6768', - deviceToken: 'token', - publicKeyB64: Buffer.alloc(32).toString('base64') - }) - ) - const localHandle = { unsubscribe: vi.fn(), sendBinary: vi.fn() } - const internals = client as unknown as { - subscribeOnCurrentConnection: WebRuntimeClient['subscribe'] - } - const subscribeOnCurrentConnection = vi - .spyOn(internals, 'subscribeOnCurrentConnection') - .mockResolvedValue(localHandle) - const unwatch = vi - .spyOn(client, 'call') - .mockResolvedValueOnce({ - id: 'unwatch-failed', - ok: false, - error: { code: 'teardown_failed', message: 'remote unwatch failed' } - }) - .mockResolvedValueOnce({ - id: 'unwatch-retry', - ok: true, - result: { unsubscribed: true }, - _meta: { runtimeId: 'runtime-web-test' } - }) - const warn = vi.spyOn(console, 'warn').mockImplementation(() => {}) - - try { - const subscription = await client.subscribe( - 'files.watch', - { worktree: 'wt-1' }, - { onResponse: vi.fn() } - ) - const wrappedCallbacks = subscribeOnCurrentConnection.mock.calls[0]?.[2] - wrappedCallbacks?.onResponse({ - id: 'watch', - ok: true, - streaming: true, - result: { type: 'ready', subscriptionId: 'files-watch-failing-unwatch' }, - _meta: { runtimeId: 'runtime-web-test' } - } as RuntimeRpcResponse & { streaming: true }) - - subscription.unsubscribe() - - expect(unwatch).toHaveBeenCalledWith( - 'files.unwatch', - { subscriptionId: 'files-watch-failing-unwatch' }, - { timeoutMs: 5_000 } - ) - await vi.waitFor(() => expect(warn).toHaveBeenCalledTimes(1)) - expect(localHandle.unsubscribe).not.toHaveBeenCalled() - expect(warn).toHaveBeenCalledWith( - 'Failed to unwatch remote file subscription:', - expect.objectContaining({ message: 'teardown_failed: remote unwatch failed' }) - ) - - await client.subscribe('files.watch', { worktree: 'wt-1' }, { onResponse: vi.fn() }) - expect(unwatch).toHaveBeenCalledTimes(2) - expect(localHandle.unsubscribe).toHaveBeenCalledTimes(1) - expect(subscribeOnCurrentConnection).toHaveBeenCalledTimes(2) - } finally { - client.close() - warn.mockRestore() - } - }) - - it('retries every failed same-root teardown before opening a replacement watch', async () => { - const client = new WebRuntimeClient( - pairedRuntimeConnectionFromOffer({ - v: 2, - endpoint: 'ws://127.0.0.1:6768', - deviceToken: 'token', - publicKeyB64: Buffer.alloc(32).toString('base64') - }) - ) - const handles = Array.from({ length: 3 }, () => ({ - unsubscribe: vi.fn(), - sendBinary: vi.fn() - })) - const internals = client as unknown as { - subscribeOnCurrentConnection: WebRuntimeClient['subscribe'] - } - const subscribeOnCurrentConnection = vi - .spyOn(internals, 'subscribeOnCurrentConnection') - .mockResolvedValueOnce(handles[0]) - .mockResolvedValueOnce(handles[1]) - .mockResolvedValueOnce(handles[2]) - const unwatch = vi - .spyOn(client, 'call') - .mockRejectedValueOnce(new Error('first teardown failed')) - .mockRejectedValueOnce(new Error('second teardown failed')) - .mockResolvedValue({ - id: 'unwatch-retry', - ok: true, - result: { unsubscribed: true }, - _meta: { runtimeId: 'runtime-web-test' } - }) - const warn = vi.spyOn(console, 'warn').mockImplementation(() => {}) - try { - const first = await client.subscribe( - 'files.watch', - { worktree: 'wt-1' }, - { onResponse: vi.fn() } - ) - const second = await client.subscribe( - 'files.watch', - { worktree: 'wt-1' }, - { onResponse: vi.fn() } - ) - for (const [index, subscriptionId] of ['watch-a', 'watch-b'].entries()) { - subscribeOnCurrentConnection.mock.calls[index]?.[2].onResponse({ - id: subscriptionId, - ok: true, - streaming: true, - result: { type: 'ready', subscriptionId }, - _meta: { runtimeId: 'runtime-web-test' } - } as RuntimeRpcResponse & { streaming: true }) - } - first.unsubscribe() - second.unsubscribe() - await vi.waitFor(() => expect(warn).toHaveBeenCalledTimes(2)) - - await client.subscribe('files.watch', { worktree: 'wt-1' }, { onResponse: vi.fn() }) - - expect(unwatch).toHaveBeenCalledTimes(4) - expect(handles[0].unsubscribe).toHaveBeenCalledTimes(1) - expect(handles[1].unsubscribe).toHaveBeenCalledTimes(1) - expect(subscribeOnCurrentConnection).toHaveBeenCalledTimes(3) - } finally { - client.close() - warn.mockRestore() - } - }) - - it('retains a stopped pre-ready file watch until its cancellation id arrives', async () => { - vi.useFakeTimers() - const timerWindow = window as unknown as { - setTimeout: typeof setTimeout - clearTimeout: typeof clearTimeout - } - timerWindow.setTimeout = setTimeout - timerWindow.clearTimeout = clearTimeout - const client = new WebRuntimeClient( - pairedRuntimeConnectionFromOffer({ - v: 2, - endpoint: 'ws://127.0.0.1:6768', - deviceToken: 'token', - publicKeyB64: Buffer.alloc(32).toString('base64') - }) - ) - const localHandle = { unsubscribe: vi.fn(), sendBinary: vi.fn() } - const internals = client as unknown as { - subscribeOnCurrentConnection: WebRuntimeClient['subscribe'] - } - const subscribeOnCurrentConnection = vi - .spyOn(internals, 'subscribeOnCurrentConnection') - .mockResolvedValue(localHandle) - const unwatch = vi.spyOn(client, 'call').mockResolvedValue({ - id: 'unwatch', - ok: true, - result: { unsubscribed: true }, - _meta: { runtimeId: 'runtime-web-test' } - }) - - try { - const subscription = await client.subscribe( - 'files.watch', - { worktree: 'wt-1' }, - { onResponse: vi.fn() } - ) - - subscription.unsubscribe() - expect(unwatch).not.toHaveBeenCalled() - expect(localHandle.unsubscribe).not.toHaveBeenCalled() - - await vi.advanceTimersByTimeAsync(300_000) - expect(localHandle.unsubscribe).not.toHaveBeenCalled() - - const wrappedCallbacks = subscribeOnCurrentConnection.mock.calls[0]?.[2] - wrappedCallbacks?.onResponse({ - id: 'watch', - ok: true, - streaming: true, - result: { type: 'starting', subscriptionId: 'files-watch-pending' }, - _meta: { runtimeId: 'runtime-web-test' } - } as RuntimeRpcResponse & { streaming: true }) - - expect(unwatch).toHaveBeenCalledWith( - 'files.unwatch', - { subscriptionId: 'files-watch-pending' }, - { timeoutMs: 5_000 } - ) - await vi.waitFor(() => expect(localHandle.unsubscribe).toHaveBeenCalledTimes(1)) - } finally { - client.close() - vi.useRealTimers() - } - }) - it('receives encrypted subscription binary frames over a paired web socket', async () => { vi.stubGlobal('WebSocket', WebSocket) const serverKeys = generateKeyPair() diff --git a/src/renderer/src/web/web-runtime-connection-frame-router.ts b/src/renderer/src/web/web-runtime-connection-frame-router.ts index d08864a1018..ce6fcff4d9d 100644 --- a/src/renderer/src/web/web-runtime-connection-frame-router.ts +++ b/src/renderer/src/web/web-runtime-connection-frame-router.ts @@ -6,7 +6,7 @@ import type { PairedE2EEAuthReply, PairedE2EEClientHandshake } from '../../../shared/remote-runtime/e2ee/paired-e2ee-client-handshake' -import { WEB_RUNTIME_CLIENT_CAPABILITIES } from '../../../shared/web-runtime-client-capabilities' +import { WEB_RUNTIME_CLIENT_CAPABILITIES } from '../../../shared/remote-runtime/protocol/web-runtime-client-capabilities' import type { WebRuntimeAuthPlan } from './web-runtime-credential-source' import type { WebRuntimeTransportSubscription } from './web-runtime-subscription-contract' diff --git a/src/renderer/src/web/web-runtime-connection-transport.ts b/src/renderer/src/web/web-runtime-connection-transport.ts index 92324f877b6..61811f7de2a 100644 --- a/src/renderer/src/web/web-runtime-connection-transport.ts +++ b/src/renderer/src/web/web-runtime-connection-transport.ts @@ -13,7 +13,7 @@ import { import type { WebRuntimeAuthPlan } from './web-runtime-credential-source' import { WebRuntimeConnectionTimers } from './web-runtime-connection-timers' import type { PairedE2EEClientHandshake } from '../../../shared/remote-runtime/e2ee/paired-e2ee-client-handshake' -import { withWebClientUpgradeMarker } from '../../../shared/web-origin-security' +import { withWebClientUpgradeMarker } from '../../../shared/remote-runtime/pairing/web-origin-security' import type { WebRuntimeTransportSubscription } from './web-runtime-subscription-contract' import { WebRuntimeSubscriptionRegistry } from './web-runtime-subscription-registry' import { WebRuntimeRequestRegistry } from './web-runtime-request-registry' diff --git a/src/shared/agent-launch/catalog/agent-cli-installation-problem.ts b/src/shared/agent-launch/catalog/agent-cli-installation-problem.ts index 2ef26f9c055..a1cf43f7f8f 100644 --- a/src/shared/agent-launch/catalog/agent-cli-installation-problem.ts +++ b/src/shared/agent-launch/catalog/agent-cli-installation-problem.ts @@ -1,4 +1,4 @@ -import { isValidAppVersion } from '../../app-version' +import { isValidAppVersion } from '../../app-lifecycle/identity/app-version' import type { CodexInstallationProblem } from '../startup/codex-cli-installation' import type { TuiAgent } from './tui-agent' import { isTuiAgent } from './tui-agent-config' diff --git a/src/shared/agent-launch/startup/codex-cli-installation.ts b/src/shared/agent-launch/startup/codex-cli-installation.ts index 8b281d7c597..7006f36f3a4 100644 --- a/src/shared/agent-launch/startup/codex-cli-installation.ts +++ b/src/shared/agent-launch/startup/codex-cli-installation.ts @@ -1,4 +1,4 @@ -import { isValidAppVersion, parseCliVersion } from '../../app-version' +import { isValidAppVersion, parseCliVersion } from '../../app-lifecycle/identity/app-version' export const CODEX_MINIMUM_SUPPORTED_VERSION = '0.136.0' diff --git a/src/shared/agent-launch/startup/opencode-cli-version.ts b/src/shared/agent-launch/startup/opencode-cli-version.ts index 0b12d482401..69158d0d05b 100644 --- a/src/shared/agent-launch/startup/opencode-cli-version.ts +++ b/src/shared/agent-launch/startup/opencode-cli-version.ts @@ -1,4 +1,4 @@ -import { compareAppVersions, isValidAppVersion } from '../../app-version' +import { compareAppVersions, isValidAppVersion } from '../../app-lifecycle/identity/app-version' // These releases drop a bare --prompt (submitted before agent/model load); 2.0.19 fixed it upstream. export const OPENCODE_NATIVE_PROMPT_VERSIONS = [ diff --git a/src/shared/agent-session/failures/agent-session-failure-details.ts b/src/shared/agent-session/failures/agent-session-failure-details.ts index 7f8ef05d5d8..4a3e9145b02 100644 --- a/src/shared/agent-session/failures/agent-session-failure-details.ts +++ b/src/shared/agent-session/failures/agent-session-failure-details.ts @@ -1,6 +1,6 @@ // Readers for fact details that stand alone, apart from the fact's own shape. -import { isValidAppVersion } from '../../app-version' +import { isValidAppVersion } from '../../app-lifecycle/identity/app-version' /** Which of Orca's checks an image failed. A new one needs a sentence before it compiles. */ export const AGENT_SESSION_ATTACHMENT_PROBLEM_REASONS = [ diff --git a/src/shared/app-environment.ts b/src/shared/app-lifecycle/app-environment.ts similarity index 100% rename from src/shared/app-environment.ts rename to src/shared/app-lifecycle/app-environment.ts diff --git a/src/shared/computer-awake-mode.ts b/src/shared/app-lifecycle/computer-awake-mode.ts similarity index 100% rename from src/shared/computer-awake-mode.ts rename to src/shared/app-lifecycle/computer-awake-mode.ts diff --git a/src/shared/app-icon.ts b/src/shared/app-lifecycle/identity/app-icon.ts similarity index 100% rename from src/shared/app-icon.ts rename to src/shared/app-lifecycle/identity/app-icon.ts diff --git a/src/shared/app-identity.ts b/src/shared/app-lifecycle/identity/app-identity.ts similarity index 100% rename from src/shared/app-identity.ts rename to src/shared/app-lifecycle/identity/app-identity.ts diff --git a/src/shared/app-version.ts b/src/shared/app-lifecycle/identity/app-version.ts similarity index 100% rename from src/shared/app-version.ts rename to src/shared/app-lifecycle/identity/app-version.ts diff --git a/src/shared/background-open-argv.ts b/src/shared/app-lifecycle/launch/background-open-argv.ts similarity index 100% rename from src/shared/background-open-argv.ts rename to src/shared/app-lifecycle/launch/background-open-argv.ts diff --git a/src/shared/electron-isolated-profile-switches.ts b/src/shared/app-lifecycle/launch/electron-isolated-profile-switches.ts similarity index 100% rename from src/shared/electron-isolated-profile-switches.ts rename to src/shared/app-lifecycle/launch/electron-isolated-profile-switches.ts diff --git a/src/shared/electron-no-sandbox-request.ts b/src/shared/app-lifecycle/launch/electron-no-sandbox-request.ts similarity index 100% rename from src/shared/electron-no-sandbox-request.ts rename to src/shared/app-lifecycle/launch/electron-no-sandbox-request.ts diff --git a/src/shared/headless-serve-ozone-platform.ts b/src/shared/app-lifecycle/launch/headless-serve-ozone-platform.ts similarity index 100% rename from src/shared/headless-serve-ozone-platform.ts rename to src/shared/app-lifecycle/launch/headless-serve-ozone-platform.ts diff --git a/src/shared/linux-wayland-session.test.ts b/src/shared/app-lifecycle/launch/linux-wayland-session.test.ts similarity index 100% rename from src/shared/linux-wayland-session.test.ts rename to src/shared/app-lifecycle/launch/linux-wayland-session.test.ts diff --git a/src/shared/linux-wayland-session.ts b/src/shared/app-lifecycle/launch/linux-wayland-session.ts similarity index 100% rename from src/shared/linux-wayland-session.ts rename to src/shared/app-lifecycle/launch/linux-wayland-session.ts diff --git a/src/shared/single-instance-exit-code.ts b/src/shared/app-lifecycle/launch/single-instance-exit-code.ts similarity index 100% rename from src/shared/single-instance-exit-code.ts rename to src/shared/app-lifecycle/launch/single-instance-exit-code.ts diff --git a/src/shared/desktop-away-threshold.ts b/src/shared/app-lifecycle/presence/desktop-away-threshold.ts similarity index 100% rename from src/shared/desktop-away-threshold.ts rename to src/shared/app-lifecycle/presence/desktop-away-threshold.ts diff --git a/src/shared/desktop-client-presence.ts b/src/shared/app-lifecycle/presence/desktop-client-presence.ts similarity index 100% rename from src/shared/desktop-client-presence.ts rename to src/shared/app-lifecycle/presence/desktop-client-presence.ts diff --git a/src/shared/quit-teardown-deadline.ts b/src/shared/app-lifecycle/shutdown/quit-teardown-deadline.ts similarity index 100% rename from src/shared/quit-teardown-deadline.ts rename to src/shared/app-lifecycle/shutdown/quit-teardown-deadline.ts diff --git a/src/shared/renderer-restart-preparation.ts b/src/shared/app-lifecycle/shutdown/renderer-restart-preparation.ts similarity index 97% rename from src/shared/renderer-restart-preparation.ts rename to src/shared/app-lifecycle/shutdown/renderer-restart-preparation.ts index 2143c34d968..7cc476e7528 100644 --- a/src/shared/renderer-restart-preparation.ts +++ b/src/shared/app-lifecycle/shutdown/renderer-restart-preparation.ts @@ -1,13 +1,13 @@ import { ORCA_EDITOR_PREPARE_HOT_EXIT_EVENT, type EditorPrepareHotExitDetail -} from './editor-save-events' +} from '../../editor-save-events' import { consumeShutdownCheckpointFailureReason, ORCA_RENDERER_SHUTDOWN_CHECKPOINT_ABORTED_EVENT, ORCA_RENDERER_SHUTDOWN_CHECKPOINT_FAILED_EVENT } from './renderer-shutdown-events' -import type { UpdateStatus } from './update-status-types' +import type { UpdateStatus } from '../../updater/update-status-types' export type AppRestartPrepOptions = { startedEventName: string diff --git a/src/shared/renderer-shutdown-events.ts b/src/shared/app-lifecycle/shutdown/renderer-shutdown-events.ts similarity index 100% rename from src/shared/renderer-shutdown-events.ts rename to src/shared/app-lifecycle/shutdown/renderer-shutdown-events.ts diff --git a/src/shared/hidden-window-frame-pump.ts b/src/shared/app-lifecycle/windows/hidden-window-frame-pump.ts similarity index 100% rename from src/shared/hidden-window-frame-pump.ts rename to src/shared/app-lifecycle/windows/hidden-window-frame-pump.ts diff --git a/src/shared/window-material.ts b/src/shared/app-lifecycle/windows/window-material.ts similarity index 100% rename from src/shared/window-material.ts rename to src/shared/app-lifecycle/windows/window-material.ts diff --git a/src/shared/browser/client-hosting/browser-client-hosting-eligibility.ts b/src/shared/browser/client-hosting/browser-client-hosting-eligibility.ts index d664c75ea4a..895c6f1223c 100644 --- a/src/shared/browser/client-hosting/browser-client-hosting-eligibility.ts +++ b/src/shared/browser/client-hosting/browser-client-hosting-eligibility.ts @@ -1,4 +1,4 @@ -import '../../protocol-version' +import '../../remote-runtime/protocol/protocol-version' import { BROWSER_CLIENT_AUTOMATION_RUNTIME_CAPABILITY, BROWSER_CLIENT_HOST_RUNTIME_CAPABILITY, diff --git a/src/shared/cli-install-types.ts b/src/shared/cli/cli-install-types.ts similarity index 100% rename from src/shared/cli-install-types.ts rename to src/shared/cli/cli-install-types.ts diff --git a/src/shared/default-global-settings.ts b/src/shared/default-global-settings.ts index f55738b2b24..c4487646d83 100644 --- a/src/shared/default-global-settings.ts +++ b/src/shared/default-global-settings.ts @@ -5,7 +5,7 @@ import { DEFAULT_TERMINAL_FONT_WEIGHT_BOLD } from './terminal/appearance/termina import { getDefaultTerminalQuickCommands } from './terminal/quick-commands/terminal-quick-commands' import { TASK_PROVIDERS } from './work-items/task-providers' import { getDefaultSourceControlAiSettings } from './source-control/ai/settings/source-control-ai-settings' -import { DEFAULT_APP_ICON_ID } from './app-icon' +import { DEFAULT_APP_ICON_ID } from './app-lifecycle/identity/app-icon' import { DEFAULT_OPEN_IN_APPLICATIONS } from './open-in-applications' import { DEFAULT_NATIVE_CHAT_IDLE_STOP_MINUTES } from './native-chat/native-chat-idle-stop' import { DEFAULT_BROWSER_MEMORY_SAVER_HOURS } from './browser/guest-lifecycle/browser-memory-saver' diff --git a/src/shared/electron-isolated-profile-switches.test.ts b/src/shared/electron-isolated-profile-switches.test.ts deleted file mode 100644 index 495f1c3a6f9..00000000000 --- a/src/shared/electron-isolated-profile-switches.test.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { foregroundServeIsolatedProfileSwitches } from './electron-isolated-profile-switches' - -describe('foregroundServeIsolatedProfileSwitches', () => { - it('needs the profile itself to be isolated, not only HOME', () => { - expect(foregroundServeIsolatedProfileSwitches({ ORCA_E2E_USER_DATA_DIR: '/tmp/e2e' })).toEqual([ - '--password-store=basic', - '--use-mock-keychain' - ]) - // A HOME override alone still serves the user's real profile, whose secrets need the keychain. - expect(foregroundServeIsolatedProfileSwitches({ ORCA_E2E_HOME_DIR: '/tmp/e2e-home' })).toEqual( - [] - ) - expect(foregroundServeIsolatedProfileSwitches({})).toEqual([]) - }) -}) diff --git a/src/shared/execution-host/runtime-execution-host-health.ts b/src/shared/execution-host/runtime-execution-host-health.ts index 4e82dfc4253..900c4b09ce6 100644 --- a/src/shared/execution-host/runtime-execution-host-health.ts +++ b/src/shared/execution-host/runtime-execution-host-health.ts @@ -5,7 +5,7 @@ import { import { MIN_COMPATIBLE_RUNTIME_SERVER_VERSION, RUNTIME_PROTOCOL_VERSION -} from '../protocol-version' +} from '../remote-runtime/protocol/protocol-version' import type { RuntimeStatus } from '../remote-runtime/session-graph/runtime-session-contracts' import type { ExecutionHostHealth } from './execution-host-health' diff --git a/src/shared/client-environment-info.ts b/src/shared/feedback/client-environment-info.ts similarity index 100% rename from src/shared/client-environment-info.ts rename to src/shared/feedback/client-environment-info.ts diff --git a/src/shared/global-settings-base.ts b/src/shared/global-settings-base.ts index 37dfc49b923..0414a3789e6 100644 --- a/src/shared/global-settings-base.ts +++ b/src/shared/global-settings-base.ts @@ -19,7 +19,7 @@ import type { TerminalScrollSettings } from './terminal/appearance/terminal-scro import type { WorktreeDeletionPreferences } from './worktree/removal/worktree-deletion-preferences' import type { AgentPermissionGlobalSettings } from './agent-launch/permissions/tui-agent-permission-choice' import type { TerminalColorOverrideGlobalSettings } from './terminal-themes/terminal-color-overrides' -import type { WindowMaterialSettings } from './window-material' +import type { WindowMaterialSettings } from './app-lifecycle/windows/window-material' import type { EditorSaveSettings } from './editor-save-settings' import type { NestedWorkerDepthSettings } from './orchestration/workers/nested-worker-depth' import type { SshRemoteControlSettings } from './remote-runtime/ssh/ssh-remote-control-settings' diff --git a/src/shared/global-settings-types.ts b/src/shared/global-settings-types.ts index 6bfd0bba61f..eb752754e12 100644 --- a/src/shared/global-settings-types.ts +++ b/src/shared/global-settings-types.ts @@ -9,7 +9,7 @@ import type { VoiceSettings } from './speech/speech-types' import type { AiVaultSearchSettings } from './ai-vault/search/ai-vault-search-settings' import type { GitLabProjectSettings } from './gitlab-types' import type { TaskProvider } from './work-items/task-providers' -import type { AppIconId } from './app-icon' +import type { AppIconId } from './app-lifecycle/identity/app-icon' import type { SourceControlAiSettings } from './source-control/ai/settings/source-control-ai-settings-types' import type { ClaudeAgentTeamsMode } from './agent-launch/startup/claude-agent-teams-tmux-compat' import type { TerminalCustomTheme } from './terminal-themes/terminal-custom-themes' @@ -17,7 +17,7 @@ import type { UiLanguage } from './ui-language' import type { GlobalWindowsRuntimeDefault } from './execution-host/project-runtime-preference' import type { PersistedNativeChatSessionOptions } from './native-chat/input/native-chat-session-options' import type { AgentChatPermissionMode } from './agent-launch/permissions/agent-chat-permission-mode' -import type { ComputerAwakeMode } from './computer-awake-mode' +import type { ComputerAwakeMode } from './app-lifecycle/computer-awake-mode' import type { CommitMessageAiSettings } from './source-control/ai/generation/commit-message-ai-types' import type { HostSettingOverrides } from './execution-host/host-setting-overrides' import type { diff --git a/src/shared/orca-cli-command-name.ts b/src/shared/orca-cli-command-name.ts index 8f612b1720b..246047c8972 100644 --- a/src/shared/orca-cli-command-name.ts +++ b/src/shared/orca-cli-command-name.ts @@ -1,4 +1,4 @@ -import { getAppEnvironment, hasAppEnvironment } from './app-environment' +import { getAppEnvironment, hasAppEnvironment } from './app-lifecycle/app-environment' export function getOrcaCliCommandNameForPlatform(platform: NodeJS.Platform): string { if (platform === 'linux') { diff --git a/src/shared/orca-profiles.ts b/src/shared/orca-profiles/orca-profiles.ts similarity index 98% rename from src/shared/orca-profiles.ts rename to src/shared/orca-profiles/orca-profiles.ts index ae71bbe75f8..046b3fd9e49 100644 --- a/src/shared/orca-profiles.ts +++ b/src/shared/orca-profiles/orca-profiles.ts @@ -1,6 +1,6 @@ -import './constants' -import { ORCA_BROWSER_PARTITION } from './browser/browser-session-partition' -import type { ExecutionHostId } from './execution-host' +import '../constants' +import { ORCA_BROWSER_PARTITION } from '../browser/browser-session-partition' +import type { ExecutionHostId } from '../execution-host' export const ORCA_PROFILE_INDEX_SCHEMA_VERSION = 1 export const DEFAULT_LOCAL_ORCA_PROFILE_ID = 'local-default' diff --git a/src/shared/profile-state-recovery-command.ts b/src/shared/orca-profiles/profile-state-recovery-command.ts similarity index 100% rename from src/shared/profile-state-recovery-command.ts rename to src/shared/orca-profiles/profile-state-recovery-command.ts diff --git a/src/shared/profile-state-storage-paths.ts b/src/shared/orca-profiles/profile-state-storage-paths.ts similarity index 100% rename from src/shared/profile-state-storage-paths.ts rename to src/shared/orca-profiles/profile-state-storage-paths.ts diff --git a/src/shared/persisted-ui-state-types.ts b/src/shared/persisted-ui-state-types.ts index 5f1be9061d9..b7b1639a089 100644 --- a/src/shared/persisted-ui-state-types.ts +++ b/src/shared/persisted-ui-state-types.ts @@ -2,7 +2,7 @@ import type { GitHistoryRefs } from './git/history/git-history-types' import type { JiraQuickFilterState } from './jira/jira-quick-filters' import type { BrowserDevToolsDockLayout } from './browser/devtools/browser-devtools-dock' import type { JiraSavedFilterState } from './jira/jira-saved-filters' -import type { ReleaseChannel } from './release-channel' +import type { ReleaseChannel } from './updater/release-channel' import type { WorkspaceCleanupUIState } from './workspace-cleanup/workspace-cleanup' import type { FeatureTipSeenId } from './feature-education/feature-tips' import type { ContextualTourId } from './feature-education/contextual-tours/contextual-tours' diff --git a/src/shared/remote-runtime/control/remote-runtime-shared-control-types.ts b/src/shared/remote-runtime/control/remote-runtime-shared-control-types.ts index d5819687089..e913b9e6452 100644 --- a/src/shared/remote-runtime/control/remote-runtime-shared-control-types.ts +++ b/src/shared/remote-runtime/control/remote-runtime-shared-control-types.ts @@ -1,7 +1,7 @@ import type { RuntimeRpcResponse } from '../rpc/runtime-rpc-envelope' import type { RemoteRuntimeClientError } from '../remote-runtime-client-error' import type { RemoteRuntimePreparedRequest } from '../requests/remote-runtime-prepared-request-admission' -import type { RuntimeCapability } from '../../protocol-version' +import type { RuntimeCapability } from '../protocol/protocol-version' import type { RemoteRuntimeSocketDeathCause, RemoteRuntimeSocketLivenessOptions diff --git a/src/shared/remote-runtime/host-catalog/remote-server-update.ts b/src/shared/remote-runtime/host-catalog/remote-server-update.ts index 6dd3a13e6b8..ac82f321842 100644 --- a/src/shared/remote-runtime/host-catalog/remote-server-update.ts +++ b/src/shared/remote-runtime/host-catalog/remote-server-update.ts @@ -1,4 +1,4 @@ -import type { UpdateStatus } from '../../update-status-types' +import type { UpdateStatus } from '../../updater/update-status-types' export const REMOTE_SERVER_UPDATE_CAPABILITY = 'updater.remote-control.v1' as const diff --git a/src/shared/machine-name.ts b/src/shared/remote-runtime/host-metadata/machine-name.ts similarity index 100% rename from src/shared/machine-name.ts rename to src/shared/remote-runtime/host-metadata/machine-name.ts diff --git a/src/shared/remote-runtime/pairing/remote-pairing-verification.ts b/src/shared/remote-runtime/pairing/remote-pairing-verification.ts index e7a86a32b7a..306cb93e5af 100644 --- a/src/shared/remote-runtime/pairing/remote-pairing-verification.ts +++ b/src/shared/remote-runtime/pairing/remote-pairing-verification.ts @@ -2,7 +2,7 @@ import { evaluateRuntimeCompat } from '../protocol/protocol-compat' import { MIN_COMPATIBLE_RUNTIME_SERVER_VERSION, RUNTIME_PROTOCOL_VERSION -} from '../../protocol-version' +} from '../protocol/protocol-version' import type { PublicKnownRuntimeEnvironment } from '../host-catalog/runtime-environments' import type { RuntimeStatus } from '../session-graph/runtime-session-contracts' diff --git a/src/shared/web-origin-security.ts b/src/shared/remote-runtime/pairing/web-origin-security.ts similarity index 100% rename from src/shared/web-origin-security.ts rename to src/shared/remote-runtime/pairing/web-origin-security.ts diff --git a/src/shared/electron-remote-runtime-client-capabilities.ts b/src/shared/remote-runtime/protocol/electron-remote-runtime-client-capabilities.ts similarity index 73% rename from src/shared/electron-remote-runtime-client-capabilities.ts rename to src/shared/remote-runtime/protocol/electron-remote-runtime-client-capabilities.ts index f707b000ade..0ff4ee82b05 100644 --- a/src/shared/electron-remote-runtime-client-capabilities.ts +++ b/src/shared/remote-runtime/protocol/electron-remote-runtime-client-capabilities.ts @@ -1,23 +1,23 @@ -import { GIT_REVERT_CONFLICT_CLIENT_CAPABILITY } from './git/commands/git-commit-action' -import { GIT_GRAPH_TAB_CAPABILITY } from './source-control/runtime/git-graph-capabilities' -import { STRUCTURED_AGENT_SESSION_RENDERER_CLIENT_CAPABILITIES } from './agent-session/structured-agent-session-renderer-client-capabilities' -import { TERMINAL_IMAGE_VIEWER_CAPABILITY } from './terminal/images/terminal-image-viewer-capability' -import { BROWSER_CLIENT_HOST_REQUEST_CAPABILITY } from './browser/client-hosting/browser-client-host-request-protocol' +import { GIT_REVERT_CONFLICT_CLIENT_CAPABILITY } from '../../git/commands/git-commit-action' +import { GIT_GRAPH_TAB_CAPABILITY } from '../../source-control/runtime/git-graph-capabilities' +import { STRUCTURED_AGENT_SESSION_RENDERER_CLIENT_CAPABILITIES } from '../../agent-session/structured-agent-session-renderer-client-capabilities' +import { TERMINAL_IMAGE_VIEWER_CAPABILITY } from '../../terminal/images/terminal-image-viewer-capability' +import { BROWSER_CLIENT_HOST_REQUEST_CAPABILITY } from '../../browser/client-hosting/browser-client-host-request-protocol' import { STRUCTURED_CHAT_START_TELEMETRY_CLIENT_CAPABILITY, STRUCTURED_CHAT_PROMPT_TELEMETRY_CLIENT_CAPABILITY -} from './agent-session/requests/structured-chat-dispatch-telemetry' +} from '../../agent-session/requests/structured-chat-dispatch-telemetry' import { NATIVE_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from './protocol-version' import { AGENT_STATUS_RESTORED_UNCONFIRMED_RUNTIME_CAPABILITY, SESSION_TABS_RETIREMENT_PROOF_DELTA_RUNTIME_CAPABILITY, SESSION_TABS_TAB_DELTA_RUNTIME_CAPABILITY -} from './remote-runtime/protocol/session-tabs-runtime-capabilities' -import { WORKTREE_BACKGROUND_REMOVAL_RUNTIME_CAPABILITY } from './remote-runtime/protocol/worktree-runtime-capabilities' +} from './session-tabs-runtime-capabilities' +import { WORKTREE_BACKGROUND_REMOVAL_RUNTIME_CAPABILITY } from './worktree-runtime-capabilities' import { BROWSER_CLIENT_HOST_RUNTIME_CAPABILITY, BROWSER_CLIENT_PAGE_METADATA_RUNTIME_CAPABILITY -} from './browser/runtime/browser-runtime-capabilities' +} from '../../browser/runtime/browser-runtime-capabilities' // Electron clients can decode client-hosted page placement; becoming a page // host still requires the separate authenticated browser-client lease. diff --git a/src/shared/remote-runtime/protocol/mobile-runtime-capabilities.ts b/src/shared/remote-runtime/protocol/mobile-runtime-capabilities.ts index 7278bc45989..4a8fb92b1ed 100644 --- a/src/shared/remote-runtime/protocol/mobile-runtime-capabilities.ts +++ b/src/shared/remote-runtime/protocol/mobile-runtime-capabilities.ts @@ -1,4 +1,4 @@ -import { NOTIFICATIONS_DESKTOP_PRESENCE_RUNTIME_CAPABILITY } from '../../desktop-client-presence' +import { NOTIFICATIONS_DESKTOP_PRESENCE_RUNTIME_CAPABILITY } from '../../app-lifecycle/presence/desktop-client-presence' import { MOBILE_RELAY_RUNTIME_CAPABILITIES } from '../../mobile-desktop-relay-contract' // Hosts without this capability have no notifications.registerPush RPC. diff --git a/src/shared/remote-runtime/protocol/protocol-compat.test.ts b/src/shared/remote-runtime/protocol/protocol-compat.test.ts index 4faa14b66f3..53a785a1907 100644 --- a/src/shared/remote-runtime/protocol/protocol-compat.test.ts +++ b/src/shared/remote-runtime/protocol/protocol-compat.test.ts @@ -9,7 +9,7 @@ import { MIN_COMPATIBLE_MOBILE_VERSION, MIN_COMPATIBLE_RUNTIME_SERVER_VERSION, RUNTIME_PROTOCOL_VERSION -} from '../../protocol-version' +} from './protocol-version' const MOBILE_V = 1 diff --git a/src/shared/protocol-version.ts b/src/shared/remote-runtime/protocol/protocol-version.ts similarity index 63% rename from src/shared/protocol-version.ts rename to src/shared/remote-runtime/protocol/protocol-version.ts index 1cd38bf9979..7d0c87f0e13 100644 --- a/src/shared/protocol-version.ts +++ b/src/shared/remote-runtime/protocol/protocol-version.ts @@ -1,47 +1,47 @@ import { PROJECT_GROUP_UPDATE_MANY_RUNTIME_CAPABILITY, PROJECT_ROOT_ORDER_RUNTIME_CAPABILITY -} from './project/groups/project-group-order-capability' -import { EMULATOR_RUNTIME_CAPABILITIES } from './remote-runtime/protocol/emulator-runtime-capabilities' -import { ACCOUNT_RUNTIME_CAPABILITIES } from './remote-runtime/protocol/account-runtime-capabilities' -import * as agentLaunchCapabilities from './agent-launch/contracts/agent-launch-runtime-capability' +} from '../../project/groups/project-group-order-capability' +import { EMULATOR_RUNTIME_CAPABILITIES } from './emulator-runtime-capabilities' +import { ACCOUNT_RUNTIME_CAPABILITIES } from './account-runtime-capabilities' +import * as agentLaunchCapabilities from '../../agent-launch/contracts/agent-launch-runtime-capability' import { AGENT_SESSION_BOUNDARY_RUNTIME_CAPABILITY, AGENT_SESSION_RUNTIME_CAPABILITIES -} from './agent-session/agent-session-runtime-capabilities' -import { AI_VAULT_RUNTIME_CAPABILITIES } from './ai-vault/contracts/ai-vault-runtime-capabilities' +} from '../../agent-session/agent-session-runtime-capabilities' +import { AI_VAULT_RUNTIME_CAPABILITIES } from '../../ai-vault/contracts/ai-vault-runtime-capabilities' import { AUTOMATION_RUNTIME_CAPABILITIES, AUTOMATION_RUNTIME_CLIENT_CAPABILITIES -} from './automations/automation-runtime-capabilities' -import { BROWSER_RUNTIME_CAPABILITIES } from './browser/runtime/browser-runtime-capabilities' +} from '../../automations/automation-runtime-capabilities' +import { BROWSER_RUNTIME_CAPABILITIES } from '../../browser/runtime/browser-runtime-capabilities' import { DEVICE_KEY_RUNTIME_CAPABILITIES, E2EE_V2_TOKEN_CAPABILITIES_RUNTIME_CAPABILITY -} from './remote-runtime/pairing/device-key-capability' -import { PAIRING_TICKET_EXCHANGE_RUNTIME_CAPABILITIES } from './remote-runtime/pairing/ticket-exchange-capability' -import { FILES_RUNTIME_CAPABILITIES } from './file-access/files-runtime-capabilities' -import { HOST_RUNTIME_CAPABILITIES } from './remote-runtime/protocol/host-runtime-capabilities' -import { MOBILE_RUNTIME_CAPABILITIES } from './remote-runtime/protocol/mobile-runtime-capabilities' -import { ORCAD_RUNTIME_CAPABILITIES } from './remote-runtime/protocol/orcad-runtime-capabilities' -import { ORCHESTRATION_RUNTIME_CAPABILITIES } from './orchestration/orchestration-runtime-capabilities' -import { PREFLIGHT_RUNTIME_CAPABILITIES } from './remote-runtime/protocol/preflight-runtime-capabilities' +} from '../pairing/device-key-capability' +import { PAIRING_TICKET_EXCHANGE_RUNTIME_CAPABILITIES } from '../pairing/ticket-exchange-capability' +import { FILES_RUNTIME_CAPABILITIES } from '../../file-access/files-runtime-capabilities' +import { HOST_RUNTIME_CAPABILITIES } from './host-runtime-capabilities' +import { MOBILE_RUNTIME_CAPABILITIES } from './mobile-runtime-capabilities' +import { ORCAD_RUNTIME_CAPABILITIES } from './orcad-runtime-capabilities' +import { ORCHESTRATION_RUNTIME_CAPABILITIES } from '../../orchestration/orchestration-runtime-capabilities' +import { PREFLIGHT_RUNTIME_CAPABILITIES } from './preflight-runtime-capabilities' import { SESSION_TAB_CLOSE_INTENT_RUNTIME_CAPABILITY, SESSION_TABS_RUNTIME_CAPABILITIES -} from './remote-runtime/protocol/session-tabs-runtime-capabilities' -import { SKILL_RUNTIME_CAPABILITIES } from './skills/capabilities/skill-install-capability' -import { SOURCE_CONTROL_RUNTIME_CAPABILITIES } from './source-control/runtime/source-control-runtime-capabilities' -import { TASK_SOURCE_RUNTIME_CAPABILITIES } from './work-items/task-source-runtime-capabilities' -import { TERMINAL_RUNTIME_CAPABILITIES } from './terminal/runtime-policy/terminal-runtime-capabilities' -import { WORKSPACE_PORTS_RUNTIME_CAPABILITIES } from './remote-runtime/protocol/workspace-ports-runtime-capabilities' +} from './session-tabs-runtime-capabilities' +import { SKILL_RUNTIME_CAPABILITIES } from '../../skills/capabilities/skill-install-capability' +import { SOURCE_CONTROL_RUNTIME_CAPABILITIES } from '../../source-control/runtime/source-control-runtime-capabilities' +import { TASK_SOURCE_RUNTIME_CAPABILITIES } from '../../work-items/task-source-runtime-capabilities' +import { TERMINAL_RUNTIME_CAPABILITIES } from '../../terminal/runtime-policy/terminal-runtime-capabilities' +import { WORKSPACE_PORTS_RUNTIME_CAPABILITIES } from './workspace-ports-runtime-capabilities' import { REPO_SEARCH_QUALIFIED_REFS_RUNTIME_CAPABILITY, WORKTREE_GITHUB_PR_SUPPRESSION_RUNTIME_CAPABILITY, WORKTREE_RUNTIME_CAPABILITIES, WORKTREE_VISIBILITY_DEFAULTS_RUNTIME_CAPABILITY, WORKTREE_VISIBILITY_SOURCE_DEFAULTS_RUNTIME_CAPABILITY -} from './remote-runtime/protocol/worktree-runtime-capabilities' +} from './worktree-runtime-capabilities' // Runtime protocol ranges permit app-version drift across desktop/server/CLI/mobile. Bump for removed methods/required params, // changed field meaning (units/nullability), framing or auth; optional fields, new methods and ignorable events are additive. diff --git a/src/shared/web-runtime-client-capabilities.ts b/src/shared/remote-runtime/protocol/web-runtime-client-capabilities.ts similarity index 75% rename from src/shared/web-runtime-client-capabilities.ts rename to src/shared/remote-runtime/protocol/web-runtime-client-capabilities.ts index 4b1fe2e0efd..783ad0900ed 100644 --- a/src/shared/web-runtime-client-capabilities.ts +++ b/src/shared/remote-runtime/protocol/web-runtime-client-capabilities.ts @@ -1,24 +1,24 @@ -import { GIT_REVERT_CONFLICT_CLIENT_CAPABILITY } from './git/commands/git-commit-action' -import { GIT_GRAPH_TAB_CAPABILITY } from './source-control/runtime/git-graph-capabilities' -import { STRUCTURED_AGENT_SESSION_RENDERER_CLIENT_CAPABILITIES } from './agent-session/structured-agent-session-renderer-client-capabilities' -import { AGENT_SESSION_BOUNDARY_RUNTIME_CAPABILITY } from './agent-session/agent-session-runtime-capabilities' +import { GIT_REVERT_CONFLICT_CLIENT_CAPABILITY } from '../../git/commands/git-commit-action' +import { GIT_GRAPH_TAB_CAPABILITY } from '../../source-control/runtime/git-graph-capabilities' +import { STRUCTURED_AGENT_SESSION_RENDERER_CLIENT_CAPABILITIES } from '../../agent-session/structured-agent-session-renderer-client-capabilities' +import { AGENT_SESSION_BOUNDARY_RUNTIME_CAPABILITY } from '../../agent-session/agent-session-runtime-capabilities' import { AGENT_STATUS_RESTORED_UNCONFIRMED_RUNTIME_CAPABILITY, SESSION_TAB_CLOSE_INTENT_RUNTIME_CAPABILITY, SESSION_TABS_RETIREMENT_PROOF_DELTA_RUNTIME_CAPABILITY, SESSION_TABS_SPLIT_GROUP_PLACEMENT_RUNTIME_CAPABILITY -} from './remote-runtime/protocol/session-tabs-runtime-capabilities' +} from './session-tabs-runtime-capabilities' import { REPO_SEARCH_QUALIFIED_REFS_RUNTIME_CAPABILITY, WORKTREE_BACKGROUND_REMOVAL_RUNTIME_CAPABILITY, WORKTREE_GITHUB_PR_SUPPRESSION_RUNTIME_CAPABILITY, WORKTREE_VISIBILITY_DEFAULTS_RUNTIME_CAPABILITY, WORKTREE_VISIBILITY_SOURCE_DEFAULTS_RUNTIME_CAPABILITY -} from './remote-runtime/protocol/worktree-runtime-capabilities' +} from './worktree-runtime-capabilities' import { TERMINAL_QUICK_COMMAND_LARGE_LISTS_RUNTIME_CAPABILITY, TERMINAL_QUICK_COMMAND_LONG_PROMPTS_RUNTIME_CAPABILITY -} from './terminal/quick-commands/terminal-quick-command-capabilities' +} from '../../terminal/quick-commands/terminal-quick-command-capabilities' /** What the browser client advertises in its handshake with the host it is paired to. */ export const WEB_RUNTIME_CLIENT_CAPABILITIES = [ diff --git a/src/shared/remote-runtime/remote-runtime-client-capabilities.ts b/src/shared/remote-runtime/remote-runtime-client-capabilities.ts index 2d2fdef02ac..23337a145c7 100644 --- a/src/shared/remote-runtime/remote-runtime-client-capabilities.ts +++ b/src/shared/remote-runtime/remote-runtime-client-capabilities.ts @@ -15,7 +15,7 @@ import { SESSION_TAB_CLOSE_INTENT_RUNTIME_CAPABILITY, SESSION_TABS_AUTHORITATIVE_INVENTORY_RUNTIME_CAPABILITY } from './protocol/session-tabs-runtime-capabilities' -import type { RuntimeCapability } from '../protocol-version' +import type { RuntimeCapability } from './protocol/protocol-version' import { TERMINAL_QUICK_COMMAND_LARGE_LISTS_RUNTIME_CAPABILITY, TERMINAL_QUICK_COMMAND_LONG_PROMPTS_RUNTIME_CAPABILITY diff --git a/src/shared/remote-runtime/remote-runtime-passthrough-socket.ts b/src/shared/remote-runtime/remote-runtime-passthrough-socket.ts index 8e9318d515a..956d9d108c6 100644 --- a/src/shared/remote-runtime/remote-runtime-passthrough-socket.ts +++ b/src/shared/remote-runtime/remote-runtime-passthrough-socket.ts @@ -1,6 +1,6 @@ import WebSocket from 'ws' import type { PairedRuntimeConnection } from './pairing/paired-runtime-connection' -import type { RuntimeCapability } from '../protocol-version' +import type { RuntimeCapability } from './protocol/protocol-version' import { formatRemoteRuntimeCloseMessage, sendRemoteRuntimeTokenAuth diff --git a/src/shared/remote-runtime/requests/remote-runtime-request-connection.ts b/src/shared/remote-runtime/requests/remote-runtime-request-connection.ts index e2a2471df46..caa1dd62f47 100644 --- a/src/shared/remote-runtime/requests/remote-runtime-request-connection.ts +++ b/src/shared/remote-runtime/requests/remote-runtime-request-connection.ts @@ -32,7 +32,7 @@ import { openRemoteRuntimeWebSocket } from './remote-runtime-request-websocket' import * as sealedFrame from '../remote-runtime-sealed-frame' import { sendRemoteRuntimeTokenAuth } from '../remote-runtime-client-handshake' import { remoteRuntimeClientCapabilities } from '../remote-runtime-client-capabilities' -import type { RuntimeCapability } from '../../protocol-version' +import type { RuntimeCapability } from '../protocol/protocol-version' type ConnectionState = 'closed' | 'awaiting_ready' | 'awaiting_authenticated' | 'ready' const IDLE_CLOSE_MS = 60_000 diff --git a/src/shared/remote-runtime/requests/remote-runtime-request-socket.ts b/src/shared/remote-runtime/requests/remote-runtime-request-socket.ts index edd9fecd13c..61c199a6a81 100644 --- a/src/shared/remote-runtime/requests/remote-runtime-request-socket.ts +++ b/src/shared/remote-runtime/requests/remote-runtime-request-socket.ts @@ -1,7 +1,7 @@ import WebSocket from 'ws' import { abortSignalReason, throwIfSignalAborted } from '../../concurrency/abort-signal-reason' import type { PairedRuntimeConnection } from '../pairing/paired-runtime-connection' -import type { RuntimeCapability } from '../../protocol-version' +import type { RuntimeCapability } from '../protocol/protocol-version' import { remoteRuntimeClientCapabilities } from '../remote-runtime-client-capabilities' import { formatRemoteRuntimeCloseMessage, diff --git a/src/shared/remote-runtime/requests/remote-runtime-subscription-contract.ts b/src/shared/remote-runtime/requests/remote-runtime-subscription-contract.ts index f780f1a0d83..44b656d40c8 100644 --- a/src/shared/remote-runtime/requests/remote-runtime-subscription-contract.ts +++ b/src/shared/remote-runtime/requests/remote-runtime-subscription-contract.ts @@ -1,5 +1,5 @@ import type { RemoteRuntimeClientError } from '../remote-runtime-client-error' -import type { RuntimeCapability } from '../../protocol-version' +import type { RuntimeCapability } from '../protocol/protocol-version' import type { RuntimeRpcResponse } from '../rpc/runtime-rpc-envelope' import type { RemoteRuntimeSocketLivenessOptions } from '../remote-runtime-socket-liveness' import type { diff --git a/src/shared/cli-app-status-projection.ts b/src/shared/remote-runtime/session-graph/cli-app-status-projection.ts similarity index 88% rename from src/shared/cli-app-status-projection.ts rename to src/shared/remote-runtime/session-graph/cli-app-status-projection.ts index 057a3614bd0..1ce04260bae 100644 --- a/src/shared/cli-app-status-projection.ts +++ b/src/shared/remote-runtime/session-graph/cli-app-status-projection.ts @@ -1,7 +1,4 @@ -import type { - CliStatusResult, - RuntimeStatus -} from './remote-runtime/session-graph/runtime-session-contracts' +import type { CliStatusResult, RuntimeStatus } from './runtime-session-contracts' export function resolveDesktopWindowStatus( status: RuntimeStatus diff --git a/src/shared/remote-runtime/session-graph/runtime-session-contracts.ts b/src/shared/remote-runtime/session-graph/runtime-session-contracts.ts index b5e402a5bec..18f37c8dc12 100644 --- a/src/shared/remote-runtime/session-graph/runtime-session-contracts.ts +++ b/src/shared/remote-runtime/session-graph/runtime-session-contracts.ts @@ -8,7 +8,7 @@ import type { AgentStatusOrchestrationContext } from '../../agent-status/contrac import type { RemoteServerUpdateSupport } from '../host-catalog/remote-server-update' import type { RemoteRuntimeSharedConnectionDiagnostics } from '../control/remote-runtime-shared-control-types' import type { RuntimeHostConnectionState } from '../host-status/runtime-host-connection-state' -import type { RuntimeCapability } from '../../protocol-version' +import type { RuntimeCapability } from '../protocol/protocol-version' import type { RuntimeBrowserUnavailableReason, RuntimeDegradation diff --git a/src/shared/renderer-restart-preparation.test.ts b/src/shared/renderer-restart-preparation.test.ts deleted file mode 100644 index 0c5001bbfc8..00000000000 --- a/src/shared/renderer-restart-preparation.test.ts +++ /dev/null @@ -1,37 +0,0 @@ -// @vitest-environment happy-dom -import { describe, expect, it } from 'vitest' - -import { prepareRendererForAppRestart } from './renderer-restart-preparation' - -describe('prepareRendererForAppRestart', () => { - it('waits for the durable checkpoint write before the restart proceeds', async () => { - const eventTarget = new EventTarget() - const order: string[] = [] - let releaseCheckpoint!: () => void - eventTarget.addEventListener('beforeunload', () => order.push('staged')) - - const prepared = prepareRendererForAppRestart(eventTarget, { - startedEventName: 'restart-started', - abortedEventName: 'restart-aborted', - awaitCheckpoint: () => - new Promise((resolve) => { - order.push('awaiting-flush') - releaseCheckpoint = () => { - order.push('flushed') - resolve() - } - }) - }) - let settled = false - void prepared.then(() => { - settled = true - }) - - await Promise.resolve() - expect(settled).toBe(false) - - releaseCheckpoint() - await prepared - expect(order).toEqual(['staged', 'awaiting-flush', 'flushed']) - }) -}) diff --git a/src/shared/rpc-contract/client-ui/client-settings-params.ts b/src/shared/rpc-contract/client-ui/client-settings-params.ts index a8302ba6db0..21d85641f94 100644 --- a/src/shared/rpc-contract/client-ui/client-settings-params.ts +++ b/src/shared/rpc-contract/client-ui/client-settings-params.ts @@ -7,7 +7,7 @@ import { normalizeTuiAgentArgsRecord, normalizeTuiAgentEnvRecord } from '../../agent-launch/choices/tui-agent-launch-defaults' -import { MACHINE_NAME_MAX_LENGTH } from '../../machine-name' +import { MACHINE_NAME_MAX_LENGTH } from '../../remote-runtime/host-metadata/machine-name' import { normalizePRBotAuthorOverrides } from '../../source-control/review-comments/pr-bot-author-overrides' import { WorktreeVisibilityDefaultsUpdate } from '../workspaces/worktree-visibility-defaults-params' import { WorkspaceCleanupRulesParam } from '../workspace-cleanup/workspace-cleanup-policy-params' diff --git a/src/shared/rpc-contract/client-ui/client-ui-params.ts b/src/shared/rpc-contract/client-ui/client-ui-params.ts index 87e0a1be2b4..0835a6dbb50 100644 --- a/src/shared/rpc-contract/client-ui/client-ui-params.ts +++ b/src/shared/rpc-contract/client-ui/client-ui-params.ts @@ -12,8 +12,8 @@ import { ACTIVITY_GROUP_BY_VALUES, THREAD_READ_FILTER_VALUES } from '../../agents-view-thread-filters' -import { isReleaseChannel } from '../../release-channel' -import type { ReleaseChannel } from '../../release-channel' +import { isReleaseChannel } from '../../updater/release-channel' +import type { ReleaseChannel } from '../../updater/release-channel' import { ClientUiWorkspaceFilterFields } from './client-ui-workspace-filter-fields-params' import { TaskResumeState } from './task-resume-state-params' import { WorkspaceCleanup } from '../workspace-cleanup/workspace-cleanup-ui-params' diff --git a/src/shared/telemetry/schemas/telemetry-daemon-event-schemas.ts b/src/shared/telemetry/schemas/telemetry-daemon-event-schemas.ts index 2c64a58d6aa..20957d73005 100644 --- a/src/shared/telemetry/schemas/telemetry-daemon-event-schemas.ts +++ b/src/shared/telemetry/schemas/telemetry-daemon-event-schemas.ts @@ -14,7 +14,7 @@ import { DAEMON_AUDIT_STATE_VALUES, DAEMON_AUDIT_TRIGGER_VALUES, DAEMON_EVIDENCE_SOURCE_VALUES -} from '../../daemon-audit-eligibility' +} from '../../terminal/daemon/daemon-audit-eligibility' import { DAEMON_ADOPTED_APP_VERSION_MATCH, DAEMON_CODE_IDENTITY_VALUES, @@ -41,7 +41,7 @@ import { TCC_SERVICE_VALUES, VOLUME_TYPE_VALUES, YES_NO_VALUES -} from '../../daemon-tcc-denial-capture' +} from '../../terminal/daemon/daemon-tcc-denial-capture' import { errorClassSchema, settingsChangedKeySchema } from './telemetry-property-schemas' // Enum-only start-failure signals diagnose fleet outages without sending raw stderr (v1.4.129-rc.1). diff --git a/src/shared/daemon-async-io-health.ts b/src/shared/terminal/daemon/daemon-async-io-health.ts similarity index 100% rename from src/shared/daemon-async-io-health.ts rename to src/shared/terminal/daemon/daemon-async-io-health.ts diff --git a/src/shared/daemon-audit-eligibility.ts b/src/shared/terminal/daemon/daemon-audit-eligibility.ts similarity index 100% rename from src/shared/daemon-audit-eligibility.ts rename to src/shared/terminal/daemon/daemon-audit-eligibility.ts diff --git a/src/shared/daemon-tcc-denial-capture.ts b/src/shared/terminal/daemon/daemon-tcc-denial-capture.ts similarity index 100% rename from src/shared/daemon-tcc-denial-capture.ts rename to src/shared/terminal/daemon/daemon-tcc-denial-capture.ts diff --git a/src/shared/newer-daemon-hold.ts b/src/shared/terminal/daemon/newer-daemon-hold.ts similarity index 100% rename from src/shared/newer-daemon-hold.ts rename to src/shared/terminal/daemon/newer-daemon-hold.ts diff --git a/src/shared/painted-restore-ack.ts b/src/shared/terminal/replay/painted-restore-ack.ts similarity index 100% rename from src/shared/painted-restore-ack.ts rename to src/shared/terminal/replay/painted-restore-ack.ts diff --git a/src/shared/profile-state-build-compatibility.test.ts b/src/shared/updater/profile-state-build-compatibility.test.ts similarity index 100% rename from src/shared/profile-state-build-compatibility.test.ts rename to src/shared/updater/profile-state-build-compatibility.test.ts diff --git a/src/shared/profile-state-build-compatibility.ts b/src/shared/updater/profile-state-build-compatibility.ts similarity index 89% rename from src/shared/profile-state-build-compatibility.ts rename to src/shared/updater/profile-state-build-compatibility.ts index 84081b3f3e4..f7a9c096673 100644 --- a/src/shared/profile-state-build-compatibility.ts +++ b/src/shared/updater/profile-state-build-compatibility.ts @@ -1,4 +1,4 @@ -import { hasReachedAppVersion } from './app-version' +import { hasReachedAppVersion } from '../app-lifecycle/identity/app-version' // v1.4.214 is the first stable release containing the SQLite profile cutover. export const SQLITE_PROFILE_RELEASE_FLOOR = '1.4.214' diff --git a/src/shared/release-channel.test.ts b/src/shared/updater/release-channel.test.ts similarity index 100% rename from src/shared/release-channel.test.ts rename to src/shared/updater/release-channel.test.ts diff --git a/src/shared/release-channel.ts b/src/shared/updater/release-channel.ts similarity index 99% rename from src/shared/release-channel.ts rename to src/shared/updater/release-channel.ts index bb375524e2f..742f175a5b3 100644 --- a/src/shared/release-channel.ts +++ b/src/shared/updater/release-channel.ts @@ -1,4 +1,4 @@ -import { compareAppVersions, isValidAppVersion } from './app-version' +import { compareAppVersions, isValidAppVersion } from '../app-lifecycle/identity/app-version' export type ReleaseChannel = 'stable' | 'rc' | 'hourly' | 'daily' | 'adhoc' diff --git a/src/shared/update-delay.ts b/src/shared/updater/update-delay.ts similarity index 100% rename from src/shared/update-delay.ts rename to src/shared/updater/update-delay.ts diff --git a/src/shared/update-status-types.ts b/src/shared/updater/update-status-types.ts similarity index 100% rename from src/shared/update-status-types.ts rename to src/shared/updater/update-status-types.ts diff --git a/src/shared/updater-failure-copy.ts b/src/shared/updater/updater-failure-copy.ts similarity index 100% rename from src/shared/updater-failure-copy.ts rename to src/shared/updater/updater-failure-copy.ts diff --git a/src/shared/updater-renderer-events.ts b/src/shared/updater/updater-renderer-events.ts similarity index 100% rename from src/shared/updater-renderer-events.ts rename to src/shared/updater/updater-renderer-events.ts diff --git a/src/shared/updater-windows-signature-check.ts b/src/shared/updater/updater-windows-signature-check.ts similarity index 100% rename from src/shared/updater-windows-signature-check.ts rename to src/shared/updater/updater-windows-signature-check.ts diff --git a/src/shared/bundled-web-client-manifest.test.ts b/src/shared/web-client/bundled-web-client-manifest.test.ts similarity index 100% rename from src/shared/bundled-web-client-manifest.test.ts rename to src/shared/web-client/bundled-web-client-manifest.test.ts diff --git a/src/shared/bundled-web-client-manifest.ts b/src/shared/web-client/bundled-web-client-manifest.ts similarity index 100% rename from src/shared/bundled-web-client-manifest.ts rename to src/shared/web-client/bundled-web-client-manifest.ts diff --git a/src/shared/bundled-web-client-root.ts b/src/shared/web-client/bundled-web-client-root.ts similarity index 100% rename from src/shared/bundled-web-client-root.ts rename to src/shared/web-client/bundled-web-client-root.ts diff --git a/src/shared/worktree/metadata/workspace-unread-raise-capability.ts b/src/shared/worktree/metadata/workspace-unread-raise-capability.ts index 36fbcc9f563..e48184ffd14 100644 --- a/src/shared/worktree/metadata/workspace-unread-raise-capability.ts +++ b/src/shared/worktree/metadata/workspace-unread-raise-capability.ts @@ -1,5 +1,5 @@ -import '../../protocol-version' -import type { RuntimeCapability } from '../../protocol-version' +import '../../remote-runtime/protocol/protocol-version' +import type { RuntimeCapability } from '../../remote-runtime/protocol/protocol-version' import { BROWSER_CLIENT_HOST_RUNTIME_CAPABILITY } from '../../browser/runtime/browser-runtime-capabilities' // Raise unread on exactly one side: capable hosts own it, and capable clients defer to them. Legacy hosts and client-hosted pages need client-side raising. diff --git a/tests/e2e/__mocks__/structured-attention-read-surfaces.ts b/tests/e2e/__mocks__/structured-attention-read-surfaces.ts index c3f100cb8f6..6bc67bdb8e5 100644 --- a/tests/e2e/__mocks__/structured-attention-read-surfaces.ts +++ b/tests/e2e/__mocks__/structured-attention-read-surfaces.ts @@ -1,5 +1,5 @@ import { vi } from 'vitest' -import { RUNTIME_CAPABILITIES } from '../../../src/shared/protocol-version' +import { RUNTIME_CAPABILITIES } from '../../../src/shared/remote-runtime/protocol/protocol-version' import type { NotificationsApi } from '../../../src/preload/api/desktop-permissions/os-permission-api' const transport = vi.hoisted(() => ({ diff --git a/tests/e2e/cross-version-wire/cross-version-agent-session-model-options.unit.test.ts b/tests/e2e/cross-version-wire/cross-version-agent-session-model-options.unit.test.ts index a28c73a7122..94bb0b10cc0 100644 --- a/tests/e2e/cross-version-wire/cross-version-agent-session-model-options.unit.test.ts +++ b/tests/e2e/cross-version-wire/cross-version-agent-session-model-options.unit.test.ts @@ -1,7 +1,7 @@ import { afterEach, beforeAll, describe, expect, it } from 'vitest' import { AGENT_SESSION_OPTIONAL_MODEL_CLIENT_CAPABILITY } from '../../../src/shared/agent-session/options/protocol/agent-session-optional-model-capability' import { STRUCTURED_AGENT_SESSION_RUNTIME_CAPABILITY } from '../../../src/shared/agent-session/agent-session-runtime-capabilities' -import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../src/shared/electron-remote-runtime-client-capabilities' +import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../src/shared/remote-runtime/protocol/electron-remote-runtime-client-capabilities' import { remoteRuntimeClientCapabilities } from '../../../src/shared/remote-runtime/remote-runtime-client-capabilities' import { resolveBaselineReleaseRef } from './release-checkout' import { callBuild } from './structured-agent-session-surface-execution' diff --git a/tests/e2e/cross-version-wire/cross-version-registered-agents.unit.test.ts b/tests/e2e/cross-version-wire/cross-version-registered-agents.unit.test.ts index 4232f303301..41d356fed40 100644 --- a/tests/e2e/cross-version-wire/cross-version-registered-agents.unit.test.ts +++ b/tests/e2e/cross-version-wire/cross-version-registered-agents.unit.test.ts @@ -8,7 +8,7 @@ import '../../../src/shared/agent-session/lifecycle/records/agent-session-record import '../../../src/shared/agent-session/lifecycle/records/agent-session-record-stored-form' import '../../../src/shared/agent-session/lifecycle/agent-session-record' import '../../../src/shared/agent-session/lifecycle/provider-handles/agent-session-provider-handle-encoding' -import '../../../src/shared/protocol-version' +import '../../../src/shared/remote-runtime/protocol/protocol-version' import { STRUCTURED_AGENT_SESSION_REGISTERED_AGENTS_RUNTIME_CAPABILITY } from '../../../src/shared/agent-session/structured-agent-session-surface-capabilities' import '../../../src/shared/agent-session/agent-session-runtime-capabilities' import type { RuntimeMobileSessionTabsSnapshot } from '../../../src/shared/remote-runtime/session-graph/runtime-session-contracts' diff --git a/tests/e2e/cross-version-wire/paired-agent-session-option-persistence.unit.test.ts b/tests/e2e/cross-version-wire/paired-agent-session-option-persistence.unit.test.ts index 86a9db1c3f0..492b262f85e 100644 --- a/tests/e2e/cross-version-wire/paired-agent-session-option-persistence.unit.test.ts +++ b/tests/e2e/cross-version-wire/paired-agent-session-option-persistence.unit.test.ts @@ -2,7 +2,7 @@ import { afterEach, expect, it, vi } from 'vitest' import { sendRemoteRuntimeRequestOnSocket } from '../../../src/shared/remote-runtime/requests/remote-runtime-request-socket' import { parsePairingCode } from '../../../src/shared/remote-runtime/pairing/pairing' import { pairedRuntimeConnectionFromOffer } from '../../../src/shared/remote-runtime/pairing/paired-runtime-connection' -import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../src/shared/electron-remote-runtime-client-capabilities' +import { ELECTRON_REMOTE_RUNTIME_CLIENT_CAPABILITIES } from '../../../src/shared/remote-runtime/protocol/electron-remote-runtime-client-capabilities' import { OrcaRuntimeService } from '../../../src/main/runtime/orca-runtime' import { OrcaRuntimeRpcServer } from '../../../src/main/runtime/rpc/server/runtime-rpc' import { RuntimeClientSettingsController } from '../../../src/main/runtime/client/settings/runtime-client-settings' diff --git a/tests/e2e/cross-version-wire/release-checkout.unit.test.ts b/tests/e2e/cross-version-wire/release-checkout.unit.test.ts index c161109fb4f..dc1d01afc4e 100644 --- a/tests/e2e/cross-version-wire/release-checkout.unit.test.ts +++ b/tests/e2e/cross-version-wire/release-checkout.unit.test.ts @@ -459,7 +459,10 @@ describe('release checkout module importer', () => { // This module exists only in the working tree; resolving it would silently run current code as the old build. await expect( - importReleaseCheckoutModule(checkout, '/src/shared/protocol-version.ts') + importReleaseCheckoutModule( + checkout, + '/src/shared/remote-runtime/protocol/protocol-version.ts' + ) ).rejects.toThrow() }) }) diff --git a/tests/e2e/cross-version-wire/runtime-source-fence-downgrade.unit.test.ts b/tests/e2e/cross-version-wire/runtime-source-fence-downgrade.unit.test.ts index 09eb9ab3783..2616fccd4e4 100644 --- a/tests/e2e/cross-version-wire/runtime-source-fence-downgrade.unit.test.ts +++ b/tests/e2e/cross-version-wire/runtime-source-fence-downgrade.unit.test.ts @@ -8,7 +8,7 @@ import { tmpdir } from 'node:os' import { join } from 'node:path' import { afterAll, beforeAll, describe, expect, it } from 'vitest' import { z } from 'zod' -import { RUNTIME_CAPABILITIES } from '../../../src/shared/protocol-version' +import { RUNTIME_CAPABILITIES } from '../../../src/shared/remote-runtime/protocol/protocol-version' import { RUNTIME_SOURCE_FENCE_RUNTIME_CAPABILITY } from '../../../src/shared/remote-runtime/protocol/host-runtime-capabilities' import { publishHostDescriptor } from '../../../src/main/runtime/hosts/platform-probe/host-descriptor' import type { RuntimeMetadata } from '../../../src/shared/remote-runtime/bootstrap/runtime-bootstrap' diff --git a/tests/e2e/cross-version-wire/versioned-agent-session-wire.ts b/tests/e2e/cross-version-wire/versioned-agent-session-wire.ts index 0f55dd9df3a..87ca9c751b3 100644 --- a/tests/e2e/cross-version-wire/versioned-agent-session-wire.ts +++ b/tests/e2e/cross-version-wire/versioned-agent-session-wire.ts @@ -163,7 +163,7 @@ function capabilityStrings(module: Record): readonly string[] { async function loadWorkingTreeBuild(): Promise { const [protocol, dispatcher, methodRegistry] = await Promise.all([ - import('../../../src/shared/protocol-version'), + import('../../../src/shared/remote-runtime/protocol/protocol-version'), import('../../../src/main/runtime/rpc/dispatcher'), import('../../../src/main/runtime/rpc/methods/rpc-method-registry') ]) diff --git a/tests/e2e/cross-version-wire/wsl-host-desktop-downgrade.unit.test.ts b/tests/e2e/cross-version-wire/wsl-host-desktop-downgrade.unit.test.ts index cfa317f4c21..a57f54d5993 100644 --- a/tests/e2e/cross-version-wire/wsl-host-desktop-downgrade.unit.test.ts +++ b/tests/e2e/cross-version-wire/wsl-host-desktop-downgrade.unit.test.ts @@ -5,7 +5,7 @@ import { beforeAll, describe, expect, it } from 'vitest' import { AGENT_SESSION_ACCOUNT_ENV_RUNTIME_CAPABILITY } from '../../../src/shared/agent-session/agent-session-create-capabilities' -import { RUNTIME_CAPABILITIES } from '../../../src/shared/protocol-version' +import { RUNTIME_CAPABILITIES } from '../../../src/shared/remote-runtime/protocol/protocol-version' import { readWslHostWindowsDriveRefusal } from '../../../src/shared/remote-runtime/wsl-hosts/wsl-host-windows-drive-refusal' import type { RpcAnyMethodDeclaration, RpcRequest } from '../../../src/main/runtime/rpc/core' import type { mapRuntimeError } from '../../../src/main/runtime/rpc/responses/rpc-response' diff --git a/tests/e2e/helpers/paired-mobile-client.ts b/tests/e2e/helpers/paired-mobile-client.ts index 8252d6060f6..4c833b008fc 100644 --- a/tests/e2e/helpers/paired-mobile-client.ts +++ b/tests/e2e/helpers/paired-mobile-client.ts @@ -10,7 +10,7 @@ import type { } from '../../../src/shared/remote-runtime/requests/remote-runtime-subscription-contract' import type { RuntimeRpcResponse } from '../../../src/shared/remote-runtime/rpc/runtime-rpc-envelope' import { openRemoteRuntimePassthroughSocket } from '../../../src/shared/remote-runtime/remote-runtime-passthrough-socket' -import type { RuntimeCapability } from '../../../src/shared/protocol-version' +import type { RuntimeCapability } from '../../../src/shared/remote-runtime/protocol/protocol-version' import { decodeBrowserScreencastFrame, type BrowserScreencastFrame diff --git a/tests/e2e/helpers/paired-terminal-cold-activation-oracle.ts b/tests/e2e/helpers/paired-terminal-cold-activation-oracle.ts index 24839830579..183e46899ac 100644 --- a/tests/e2e/helpers/paired-terminal-cold-activation-oracle.ts +++ b/tests/e2e/helpers/paired-terminal-cold-activation-oracle.ts @@ -1,5 +1,5 @@ import type { Page } from '@stablyai/playwright-test' -import '../../../src/shared/protocol-version' +import '../../../src/shared/remote-runtime/protocol/protocol-version' import { TERMINAL_PAIRED_PARKING_RUNTIME_CAPABILITY } from '../../../src/shared/terminal/runtime-policy/terminal-runtime-capabilities' import { toWebTerminalSurfaceTabId } from '../../../src/shared/workspace-layout/terminal-surface-id' import { expect } from './orca-app' diff --git a/tests/e2e/helpers/paired-terminal-parking-oracle.ts b/tests/e2e/helpers/paired-terminal-parking-oracle.ts index a5996ea8a94..b534b0f5806 100644 --- a/tests/e2e/helpers/paired-terminal-parking-oracle.ts +++ b/tests/e2e/helpers/paired-terminal-parking-oracle.ts @@ -1,6 +1,6 @@ import type { Page } from '@stablyai/playwright-test' import type { RuntimeTerminalRead } from '../../../src/shared/terminal/runtime/runtime-terminal-contracts' -import '../../../src/shared/protocol-version' +import '../../../src/shared/remote-runtime/protocol/protocol-version' import { TERMINAL_PAIRED_PARKING_RUNTIME_CAPABILITY } from '../../../src/shared/terminal/runtime-policy/terminal-runtime-capabilities' import { toHostSessionTabId, diff --git a/tests/e2e/helpers/paired-terminal-title-fanout-oracle.ts b/tests/e2e/helpers/paired-terminal-title-fanout-oracle.ts index d579f5e7d53..7135a80b352 100644 --- a/tests/e2e/helpers/paired-terminal-title-fanout-oracle.ts +++ b/tests/e2e/helpers/paired-terminal-title-fanout-oracle.ts @@ -1,6 +1,6 @@ import type { Page } from '@stablyai/playwright-test' import type { RuntimeTerminalRead } from '../../../src/shared/terminal/runtime/runtime-terminal-contracts' -import '../../../src/shared/protocol-version' +import '../../../src/shared/remote-runtime/protocol/protocol-version' import { TERMINAL_PAIRED_PARKING_RUNTIME_CAPABILITY } from '../../../src/shared/terminal/runtime-policy/terminal-runtime-capabilities' import { expect } from './orca-app' diff --git a/tests/e2e/helpers/persisted-profile-state.ts b/tests/e2e/helpers/persisted-profile-state.ts index a27635dfd8e..281120f057c 100644 --- a/tests/e2e/helpers/persisted-profile-state.ts +++ b/tests/e2e/helpers/persisted-profile-state.ts @@ -1,5 +1,5 @@ import { join } from 'node:path' -import { DEFAULT_LOCAL_ORCA_PROFILE_ID } from '../../../src/shared/orca-profiles' +import { DEFAULT_LOCAL_ORCA_PROFILE_ID } from '../../../src/shared/orca-profiles/orca-profiles' import { acquireProfileStateMaintenance, acquireProfileStateRuntimeAdmission diff --git a/tests/e2e/helpers/wsl-moved-host-profile.ts b/tests/e2e/helpers/wsl-moved-host-profile.ts index 01e6995fedd..1b17e38ff24 100644 --- a/tests/e2e/helpers/wsl-moved-host-profile.ts +++ b/tests/e2e/helpers/wsl-moved-host-profile.ts @@ -6,7 +6,7 @@ import { execFileSync } from 'node:child_process' import { mkdirSync, writeFileSync } from 'node:fs' import path from 'node:path' import { makeTerminalScrollbackSnapshotRef } from '../../../src/main/pty/scrollback/terminal-scrollback-snapshots' -import { DEFAULT_LOCAL_ORCA_PROFILE_ID } from '../../../src/shared/orca-profiles' +import { DEFAULT_LOCAL_ORCA_PROFILE_ID } from '../../../src/shared/orca-profiles/orca-profiles' import { ORCAD_MIGRATION_MANIFEST_VERSION } from '../../../src/shared/orcad-migration/orcad-migration-manifest-validation' import { mutateStoppedProfileState } from './persisted-profile-state' diff --git a/tests/e2e/layout-compat-old-phone-on-new-server.spec.ts b/tests/e2e/layout-compat-old-phone-on-new-server.spec.ts index 5c397e4d883..4a799b26667 100644 --- a/tests/e2e/layout-compat-old-phone-on-new-server.spec.ts +++ b/tests/e2e/layout-compat-old-phone-on-new-server.spec.ts @@ -13,7 +13,7 @@ import { readUntil, sessionTabsBaseline } from './helpers/layout-compat-baseline' -import type { RuntimeCapability } from '../../src/shared/protocol-version' +import type { RuntimeCapability } from '../../src/shared/remote-runtime/protocol/protocol-version' import type { RuntimeMobileSessionTabsResult } from '../../src/shared/remote-runtime/session-graph/runtime-session-contracts' import type { RuntimeTerminalListResult } from '../../src/shared/terminal/runtime/runtime-terminal-contracts' import type { RuntimeWorktreePsSummary } from '../../src/shared/worktree/catalog/runtime-worktree-contracts' diff --git a/tests/e2e/paired-remote-terminal-serve-restart-binding.spec.ts b/tests/e2e/paired-remote-terminal-serve-restart-binding.spec.ts index bb2c78c30da..b06f472f6a1 100644 --- a/tests/e2e/paired-remote-terminal-serve-restart-binding.spec.ts +++ b/tests/e2e/paired-remote-terminal-serve-restart-binding.spec.ts @@ -5,9 +5,9 @@ import type { ElectronApplication, Page } from '@stablyai/playwright-test' import { getHistorySessionDirName } from '../../src/main/daemon/history/storage/history-paths' import { LOG_HEADER_BYTES } from '../../src/main/daemon/history/storage/terminal-history-log' import '../../src/main/persistence/profile-state/database/profile-state-database' -import { profileStateDatabaseFile } from '../../src/shared/profile-state-storage-paths' +import { profileStateDatabaseFile } from '../../src/shared/orca-profiles/profile-state-storage-paths' import { ProfileStateSqliteAuthority } from '../../src/main/persistence/profile-state/profile-state-sqlite-authority' -import { DEFAULT_LOCAL_ORCA_PROFILE_ID } from '../../src/shared/orca-profiles' +import { DEFAULT_LOCAL_ORCA_PROFILE_ID } from '../../src/shared/orca-profiles/orca-profiles' import type { RuntimeMobileSessionTabsResult } from '../../src/shared/remote-runtime/session-graph/runtime-session-contracts' import { toRemoteRuntimePtyId } from '../../src/shared/remote-runtime/remote-runtime-pty-id' import { toWebTerminalSurfaceTabId } from '../../src/shared/workspace-layout/terminal-surface-id' diff --git a/tests/e2e/paired-remote-terminal-truncated-tail-first-paint.spec.ts b/tests/e2e/paired-remote-terminal-truncated-tail-first-paint.spec.ts index a1b5ae946ec..484af6b5ca8 100644 --- a/tests/e2e/paired-remote-terminal-truncated-tail-first-paint.spec.ts +++ b/tests/e2e/paired-remote-terminal-truncated-tail-first-paint.spec.ts @@ -3,7 +3,7 @@ import os from 'node:os' import path from 'node:path' import type { Page } from '@stablyai/playwright-test' import type { RuntimeTerminalRead } from '../../src/shared/terminal/runtime/runtime-terminal-contracts' -import '../../src/shared/protocol-version' +import '../../src/shared/remote-runtime/protocol/protocol-version' import { TERMINAL_PAIRED_PARKING_RUNTIME_CAPABILITY } from '../../src/shared/terminal/runtime-policy/terminal-runtime-capabilities' import { toWebTerminalSurfaceTabId } from '../../src/shared/workspace-layout/terminal-surface-id' import { expect, test } from './helpers/orca-app' diff --git a/tests/e2e/persisted-session-production-upgrade.spec.ts b/tests/e2e/persisted-session-production-upgrade.spec.ts index 5daa6923c0c..937bc0f22db 100644 --- a/tests/e2e/persisted-session-production-upgrade.spec.ts +++ b/tests/e2e/persisted-session-production-upgrade.spec.ts @@ -6,7 +6,7 @@ import { type Page, type TestInfo } from '@stablyai/playwright-test' -import { DEFAULT_LOCAL_ORCA_PROFILE_ID } from '../../src/shared/orca-profiles' +import { DEFAULT_LOCAL_ORCA_PROFILE_ID } from '../../src/shared/orca-profiles/orca-profiles' import { forwardElectronProcessLogs, test, expect } from './helpers/orca-app' @@ -24,7 +24,7 @@ import { readProfileStateSnapshot } from '../../src/main/persistence/profile-sta import { acquireProfileStateMaintenance } from '../../src/main/persistence/profile-state/access/profile-state-access' import { rollbackProfileState } from '../../src/main/persistence/profile-state/recovery/profile-state-recovery-command' import { profileStateJsonExportPaths } from '../../src/main/persistence/profile-state/legacy-json/profile-state-export-path' -import type { ProfileStateRecoverySelector } from '../../src/shared/profile-state-recovery-command' +import type { ProfileStateRecoverySelector } from '../../src/shared/orca-profiles/profile-state-recovery-command' // This fixture captures a legacy production schema boundary; the test runs the current build. diff --git a/tests/e2e/profile-state-automatic-backup-recovery.spec.ts b/tests/e2e/profile-state-automatic-backup-recovery.spec.ts index 5119be96079..5747850f804 100644 --- a/tests/e2e/profile-state-automatic-backup-recovery.spec.ts +++ b/tests/e2e/profile-state-automatic-backup-recovery.spec.ts @@ -1,7 +1,7 @@ import { existsSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync } from 'node:fs' import path from 'node:path' import type { ElectronApplication } from '@stablyai/playwright-test' -import { DEFAULT_LOCAL_ORCA_PROFILE_ID } from '../../src/shared/orca-profiles' +import { DEFAULT_LOCAL_ORCA_PROFILE_ID } from '../../src/shared/orca-profiles/orca-profiles' import { runProcess } from '@orca/process-host' import { openProfileStateDatabaseReadOnly } from '../../src/main/persistence/profile-state/database/profile-state-database' import { readProfileStateSnapshot } from '../../src/main/persistence/profile-state/documents/profile-state-documents' diff --git a/tests/e2e/ssh-orcad-browser-routing.spec.ts b/tests/e2e/ssh-orcad-browser-routing.spec.ts index 82b9a1684d0..397c5809dd2 100644 --- a/tests/e2e/ssh-orcad-browser-routing.spec.ts +++ b/tests/e2e/ssh-orcad-browser-routing.spec.ts @@ -19,7 +19,7 @@ import { } from './helpers/ssh-remote-only-browser-fixture' import { createRetentionFixtureDirectory } from './helpers/host-created-terminal-retention-oracle' import { toSshExecutionHostId } from '../../src/shared/execution-host' -import { DEFAULT_LOCAL_ORCA_PROFILE_ID } from '../../src/shared/orca-profiles' +import { DEFAULT_LOCAL_ORCA_PROFILE_ID } from '../../src/shared/orca-profiles/orca-profiles' import { deriveBrowserRoutePartition } from '../../src/main/browser/routing/partitions/browser-route-identity' import { sshExecutionHostStorageIdentity } from '../../src/main/browser/routing/identity/browser-execution-host-storage-identity' import { reconnect } from './helpers/orcad-convert-flow' diff --git a/tests/e2e/terminal-tab-level-binding-upgrade.spec.ts b/tests/e2e/terminal-tab-level-binding-upgrade.spec.ts index 84f79c4d55e..016aff63f74 100644 --- a/tests/e2e/terminal-tab-level-binding-upgrade.spec.ts +++ b/tests/e2e/terminal-tab-level-binding-upgrade.spec.ts @@ -7,7 +7,7 @@ import { existsSync, readFileSync, writeFileSync } from 'node:fs' import path from 'node:path' import type { ElectronApplication, Page } from '@stablyai/playwright-test' -import { DEFAULT_LOCAL_ORCA_PROFILE_ID } from '../../src/shared/orca-profiles' +import { DEFAULT_LOCAL_ORCA_PROFILE_ID } from '../../src/shared/orca-profiles/orca-profiles' import type { WorkspaceSessionState } from '../../src/shared/workspace-session/workspace-session-state-types' import { openProfileStateDatabaseReadOnly } from '../../src/main/persistence/profile-state/database/profile-state-database' import { readProfileStateSnapshot } from '../../src/main/persistence/profile-state/documents/profile-state-documents'