From ad9b1a30a43c7ca13d917cde2f5b375870d84ccf Mon Sep 17 00:00:00 2001 From: Neil Date: Sun, 18 Oct 2026 08:27:36 -0700 Subject: [PATCH] refactor(ipc): import ipc helpers from their owning modules, not re-export shims Deletes local-agent-install-dir-detection, notification-burst-cooldown, terminal-git-credential-guard and tui-agent-detection-commands (pure re-export modules) and the re-export lines in seven more ipc modules; importers and test mocks name the real modules. --- .../managed-hook-detection-commands.ts | 2 +- src/main/ipc/feedback-image-attachments.test.ts | 4 +++- src/main/ipc/feedback-image-attachments.ts | 7 ------- src/main/ipc/feedback-request.ts | 2 -- src/main/ipc/feedback.test.ts | 6 ++---- src/main/ipc/feedback.ts | 17 +++++++---------- src/main/ipc/freebuff-detection.test.ts | 2 +- .../ipc/local-agent-install-dir-detection.ts | 1 - src/main/ipc/notification-burst-cooldown.ts | 1 - src/main/ipc/parcel-watcher-process.ts | 11 ----------- .../parcel-watcher-root-path-rewrite.test.ts | 4 ++-- src/main/ipc/plugins.ts | 1 - ...flight-agent-detection-no-subprocess.test.ts | 4 ++-- ...ending-data-drain-queue-differential.test.ts | 3 ++- .../ipc/pty-pending-data-drain-queue.test.ts | 10 +++++----- src/main/ipc/pty-pending-data-drain-queue.ts | 2 -- ...ng-data-drain-scheduler-differential.test.ts | 10 +++++----- src/main/ipc/pty/delivery/accounting.ts | 2 +- src/main/ipc/pty/delivery/flush.ts | 2 +- src/main/ipc/pty/delivery/pending.ts | 2 +- src/main/ipc/pty/host-env/assembly.ts | 6 +++--- src/main/ipc/pty/host-env/opencode-config.ts | 3 ++- src/main/ipc/pty/host-env/pi-agent.ts | 2 -- src/main/ipc/pty/session.ts | 3 ++- .../ipc/qoder-desktop-execution-host.test.ts | 2 +- src/main/ipc/runtime-watcher-process-pool.ts | 2 -- .../ipc/terminal-git-credential-guard.test.ts | 2 +- src/main/ipc/terminal-git-credential-guard.ts | 4 ---- .../ipc/tui-agent-detection-commands.test.ts | 2 +- src/main/ipc/tui-agent-detection-commands.ts | 1 - ...tree-git-common-watch-reconciliation.test.ts | 3 ++- .../notification-delivery-service.ts | 2 +- .../plugin-dev-watcher-unknown-identity.test.ts | 6 ++---- src/main/plugins/plugin-dev-watcher.test.ts | 12 ++++++------ src/main/plugins/plugin-dev-watcher.ts | 8 +++----- .../preflight/agent-command-detection.test.ts | 2 +- src/main/preflight/agent-command-detection.ts | 2 +- src/main/preflight/agent-detection.ts | 2 +- src/main/runtime/file-watcher-host.test.ts | 2 +- src/main/runtime/file-watcher-host.ts | 6 +++--- 40 files changed, 64 insertions(+), 101 deletions(-) delete mode 100644 src/main/ipc/local-agent-install-dir-detection.ts delete mode 100644 src/main/ipc/notification-burst-cooldown.ts delete mode 100644 src/main/ipc/terminal-git-credential-guard.ts delete mode 100644 src/main/ipc/tui-agent-detection-commands.ts diff --git a/src/main/agent-hooks/managed-hook-detection-commands.ts b/src/main/agent-hooks/managed-hook-detection-commands.ts index 0d3ee8280d59..be8fb74ea177 100644 --- a/src/main/agent-hooks/managed-hook-detection-commands.ts +++ b/src/main/agent-hooks/managed-hook-detection-commands.ts @@ -6,7 +6,7 @@ import { import { MANAGED_AGENT_HOOK_TARGETS } from '../../shared/managed-agent-hook-targets' import { normalizeDisabledTuiAgents } from '../../shared/tui-agent-selection' import type { GlobalSettings } from '../../shared/global-settings-types' -import type { TuiAgentDetectionCommand } from '../ipc/tui-agent-detection-commands' +import type { TuiAgentDetectionCommand } from '../../shared/tui-agent-detection-commands' import { parseClaudeCliVersion } from '../claude/claude-hook-event-versions' export type ManagedHookDetectionSettings = Partial< diff --git a/src/main/ipc/feedback-image-attachments.test.ts b/src/main/ipc/feedback-image-attachments.test.ts index bacc97f68068..230cd1a50c00 100644 --- a/src/main/ipc/feedback-image-attachments.test.ts +++ b/src/main/ipc/feedback-image-attachments.test.ts @@ -2,7 +2,9 @@ import { describe, expect, it } from 'vitest' import { MAX_FEEDBACK_IMAGE_BYTES, MAX_FEEDBACK_IMAGE_COUNT, - MAX_FEEDBACK_IMAGE_TOTAL_BYTES, + MAX_FEEDBACK_IMAGE_TOTAL_BYTES +} from '../../shared/feedback-image-limits' +import { appendFeedbackImagesToFormData, feedbackImageFilename, isSupportedFeedbackImageContentType, diff --git a/src/main/ipc/feedback-image-attachments.ts b/src/main/ipc/feedback-image-attachments.ts index 7f7435a16a37..d8d00ff1877f 100644 --- a/src/main/ipc/feedback-image-attachments.ts +++ b/src/main/ipc/feedback-image-attachments.ts @@ -15,13 +15,6 @@ const FEEDBACK_IMAGE_EXTENSIONS: Record = { 'image/gif': 'gif' } -export { - MAX_FEEDBACK_IMAGE_BYTES, - MAX_FEEDBACK_IMAGE_COUNT, - MAX_FEEDBACK_IMAGE_TOTAL_BYTES -} from '../../shared/feedback-image-limits' -export type { FeedbackImageAttachment } from '../../shared/feedback-submit-contract' - export const MAX_FEEDBACK_IMAGE_RESPONSE_BYTES = 64 * 1024 export const FEEDBACK_IMAGE_FORM_FIELD = 'feedbackImage' diff --git a/src/main/ipc/feedback-request.ts b/src/main/ipc/feedback-request.ts index 9d95b2360f07..4bbb8c08cbf5 100644 --- a/src/main/ipc/feedback-request.ts +++ b/src/main/ipc/feedback-request.ts @@ -36,8 +36,6 @@ export type FeedbackSubmitBody = { images?: FeedbackImageAttachment[] } -export type { FeedbackRequestFailure } from '../../shared/feedback-submit-contract' - export async function postFeedback( url: string, body: FeedbackSubmitBody, diff --git a/src/main/ipc/feedback.test.ts b/src/main/ipc/feedback.test.ts index 7feabb986076..58d60c50a049 100644 --- a/src/main/ipc/feedback.test.ts +++ b/src/main/ipc/feedback.test.ts @@ -16,10 +16,8 @@ vi.mock('electron', () => ({ net: { fetch: (...args: unknown[]) => fetchMock(...args) } })) -import { - MAX_FEEDBACK_IMAGE_RESPONSE_BYTES, - MAX_FEEDBACK_IMAGE_TOTAL_BYTES -} from './feedback-image-attachments' +import { MAX_FEEDBACK_IMAGE_RESPONSE_BYTES } from './feedback-image-attachments' +import { MAX_FEEDBACK_IMAGE_TOTAL_BYTES } from '../../shared/feedback-image-limits' import { registerFeedbackHandlers, submitFeedback } from './feedback' function okResponse(): Response { diff --git a/src/main/ipc/feedback.ts b/src/main/ipc/feedback.ts index 0e138f339b90..b747751091a7 100644 --- a/src/main/ipc/feedback.ts +++ b/src/main/ipc/feedback.ts @@ -1,10 +1,12 @@ import os from 'node:os' import { app, ipcMain } from 'electron' -import { - readFeedbackImagesDelivered, - validateFeedbackImages, - type FeedbackImageAttachment -} from './feedback-image-attachments' +import { readFeedbackImagesDelivered, validateFeedbackImages } from './feedback-image-attachments' +import type { + FeedbackImageAttachment, + FeedbackRequestFailure, + FeedbackSubmitArgs, + FeedbackSubmitResult +} from '../../shared/feedback-submit-contract' import { errorFailure, FEEDBACK_API_URL, @@ -15,11 +17,6 @@ import { type FeedbackSubmissionType, type FeedbackSubmitBody } from './feedback-request' -import type { - FeedbackRequestFailure, - FeedbackSubmitArgs, - FeedbackSubmitResult -} from '../../shared/feedback-submit-contract' export type { FeedbackDiagnosticBundleAttachment, diff --git a/src/main/ipc/freebuff-detection.test.ts b/src/main/ipc/freebuff-detection.test.ts index 6c74e6409b5f..2bc6d1cd7dcb 100644 --- a/src/main/ipc/freebuff-detection.test.ts +++ b/src/main/ipc/freebuff-detection.test.ts @@ -3,7 +3,7 @@ import { getTuiAgentDetectionProbeCommands, KNOWN_TUI_AGENT_DETECTION_COMMANDS, resolveDetectedTuiAgentIds -} from './tui-agent-detection-commands' +} from '../../shared/tui-agent-detection-commands' describe('Freebuff detection', () => { it.each(['darwin', 'linux', 'win32', 'wsl'] as const)( diff --git a/src/main/ipc/local-agent-install-dir-detection.ts b/src/main/ipc/local-agent-install-dir-detection.ts deleted file mode 100644 index 7493affdb47e..000000000000 --- a/src/main/ipc/local-agent-install-dir-detection.ts +++ /dev/null @@ -1 +0,0 @@ -export { detectCommandsInInstallDirs } from '../../shared/local-agent-install-dir-detection' diff --git a/src/main/ipc/notification-burst-cooldown.ts b/src/main/ipc/notification-burst-cooldown.ts deleted file mode 100644 index 91e879a7e473..000000000000 --- a/src/main/ipc/notification-burst-cooldown.ts +++ /dev/null @@ -1 +0,0 @@ -export { reserveNotificationCooldown } from '../../shared/notification-burst-cooldown' diff --git a/src/main/ipc/parcel-watcher-process.ts b/src/main/ipc/parcel-watcher-process.ts index 74e2c3ffa694..303c68230bcf 100644 --- a/src/main/ipc/parcel-watcher-process.ts +++ b/src/main/ipc/parcel-watcher-process.ts @@ -9,17 +9,6 @@ import type { } from './parcel-watcher-process-subscription' import { RuntimeWatcherProcessPool } from './runtime-watcher-process-pool' -export type { - WatcherProcessCallback, - WatcherProcessHooks, - WatcherProcessSubscription -} from './parcel-watcher-process-subscription' -export type { - WatcherProcessDeliveryOptions, - WatcherProcessEvent, - WatcherProcessSubscribeOptions -} from './parcel-watcher-process-protocol' - const sharedWatcherProcessSupervisor = new WatcherProcessSupervisor() // Why: healthy roots share one child; only fault quarantine scales to four, // containing a failed shard without paying that RSS cost during normal use. diff --git a/src/main/ipc/parcel-watcher-root-path-rewrite.test.ts b/src/main/ipc/parcel-watcher-root-path-rewrite.test.ts index ed5cd02c977e..67f74faa363f 100644 --- a/src/main/ipc/parcel-watcher-root-path-rewrite.test.ts +++ b/src/main/ipc/parcel-watcher-root-path-rewrite.test.ts @@ -51,9 +51,9 @@ import { resetRuntimeWatcherProcessForTest, resetWatcherProcessForTest, subscribeViaRuntimeWatcherProcess, - subscribeViaWatcherProcess, - type WatcherProcessEvent + subscribeViaWatcherProcess } from './parcel-watcher-process' +import type { WatcherProcessEvent } from './parcel-watcher-process-protocol' describe('watcher-process root path rewrite', () => { let root: AliasedWatcherRoot | null = null diff --git a/src/main/ipc/plugins.ts b/src/main/ipc/plugins.ts index eac8b09eaef0..95ab73556df9 100644 --- a/src/main/ipc/plugins.ts +++ b/src/main/ipc/plugins.ts @@ -69,7 +69,6 @@ const logsArgsSchema = z.object({ pluginKey: z.string().min(1) }) // Why re-exported: moved to ../plugins/plugin-client-list so the runtime RPC can reach // it without ipcMain. Existing importers of this path keep working. -export { listPluginsForClients } from '../plugins/plugin-client-list' import { listPluginsForClients } from '../plugins/plugin-client-list' export function canRemoveInstalledPlugin( diff --git a/src/main/ipc/preflight-agent-detection-no-subprocess.test.ts b/src/main/ipc/preflight-agent-detection-no-subprocess.test.ts index f95645041a90..ed72de1a8247 100644 --- a/src/main/ipc/preflight-agent-detection-no-subprocess.test.ts +++ b/src/main/ipc/preflight-agent-detection-no-subprocess.test.ts @@ -53,7 +53,7 @@ vi.mock('../azure-devops/client', () => ({ vi.mock('../gitea/client', () => ({ getGiteaAuthStatus: getGiteaAuthStatusMock })) // Isolate the subprocess-spawn assertion from the fs-based install-dir fallback. -vi.mock('./local-agent-install-dir-detection', () => ({ +vi.mock('../../shared/local-agent-install-dir-detection', () => ({ detectCommandsInInstallDirs: detectCommandsInInstallDirsMock })) @@ -67,7 +67,7 @@ import { _resetPreflightCache, detectInstalledAgents } from './preflight' import { getTuiAgentDetectionProbeCommands, KNOWN_TUI_AGENT_DETECTION_COMMANDS -} from './tui-agent-detection-commands' +} from '../../shared/tui-agent-detection-commands' describe('#9297: local agent detection spawns zero where/which subprocesses', () => { const originalPlatform = process.platform diff --git a/src/main/ipc/pty-pending-data-drain-queue-differential.test.ts b/src/main/ipc/pty-pending-data-drain-queue-differential.test.ts index a36c0a24a5b5..6272e88c184b 100644 --- a/src/main/ipc/pty-pending-data-drain-queue-differential.test.ts +++ b/src/main/ipc/pty-pending-data-drain-queue-differential.test.ts @@ -1,5 +1,6 @@ import { describe, expect, it } from 'vitest' -import { PtyPendingDataDrainQueue, type PendingPtyData } from './pty-pending-data-drain-queue' +import { PtyPendingDataDrainQueue } from './pty-pending-data-drain-queue' +import type { PendingPtyData } from './pty-pending-data-drain-contract' const CHUNK_CHARS = 4 const MAX_WRITES = 2 diff --git a/src/main/ipc/pty-pending-data-drain-queue.test.ts b/src/main/ipc/pty-pending-data-drain-queue.test.ts index c1773c64ff14..d59e6b51072e 100644 --- a/src/main/ipc/pty-pending-data-drain-queue.test.ts +++ b/src/main/ipc/pty-pending-data-drain-queue.test.ts @@ -1,9 +1,9 @@ import { describe, expect, it } from 'vitest' -import { - PtyPendingDataDrainQueue, - type PendingPtyData, - type PtyPendingDataDrainSelection -} from './pty-pending-data-drain-queue' +import { PtyPendingDataDrainQueue } from './pty-pending-data-drain-queue' +import type { + PendingPtyData, + PtyPendingDataDrainSelection +} from './pty-pending-data-drain-contract' function pending(data: string): PendingPtyData { return { data } diff --git a/src/main/ipc/pty-pending-data-drain-queue.ts b/src/main/ipc/pty-pending-data-drain-queue.ts index 378dc23de0d7..11f60444cf05 100644 --- a/src/main/ipc/pty-pending-data-drain-queue.ts +++ b/src/main/ipc/pty-pending-data-drain-queue.ts @@ -1,7 +1,5 @@ import type * as Contract from './pty-pending-data-drain-contract' -export type * from './pty-pending-data-drain-contract' - type LinkedLaneName = Contract.PtyPendingDataDrainDisposition type NodeLaneName = LinkedLaneName | 'none' | 'selected' diff --git a/src/main/ipc/pty-pending-data-drain-scheduler-differential.test.ts b/src/main/ipc/pty-pending-data-drain-scheduler-differential.test.ts index c8db5b24c853..faf4a1604e0a 100644 --- a/src/main/ipc/pty-pending-data-drain-scheduler-differential.test.ts +++ b/src/main/ipc/pty-pending-data-drain-scheduler-differential.test.ts @@ -1,9 +1,9 @@ import { describe, expect, it } from 'vitest' -import { - PtyPendingDataDrainQueue, - type PendingPtyData, - type PtyPendingDataDrainSelection -} from './pty-pending-data-drain-queue' +import { PtyPendingDataDrainQueue } from './pty-pending-data-drain-queue' +import type { + PendingPtyData, + PtyPendingDataDrainSelection +} from './pty-pending-data-drain-contract' const CHUNK_CHARS = 4 const MAX_WRITES = 2 diff --git a/src/main/ipc/pty/delivery/accounting.ts b/src/main/ipc/pty/delivery/accounting.ts index 703ccdc29dfc..54e900e441f8 100644 --- a/src/main/ipc/pty/delivery/accounting.ts +++ b/src/main/ipc/pty/delivery/accounting.ts @@ -12,7 +12,7 @@ import { PTY_RENDERER_TOTAL_IN_FLIGHT_HIGH_WATER_CHARS } from './constants' import type { PtyIpcSession } from '../session' -import type { PendingPtyData } from '../../pty-pending-data-drain-queue' +import type { PendingPtyData } from '../../pty-pending-data-drain-contract' export function getRendererInFlightCharsForPty(session: PtyIpcSession, id: string): number { const accounting = session.rendererDeliveryAccountingByPty.get(id) diff --git a/src/main/ipc/pty/delivery/flush.ts b/src/main/ipc/pty/delivery/flush.ts index 8de4463bb353..6c8853440c60 100644 --- a/src/main/ipc/pty/delivery/flush.ts +++ b/src/main/ipc/pty/delivery/flush.ts @@ -2,7 +2,7 @@ import { recordHiddenRendererPtyDataDrop, shouldDropHiddenRendererPtyData } from '../../pty-hidden-delivery-gate' -import type { PendingPtyData } from '../../pty-pending-data-drain-queue' +import type { PendingPtyData } from '../../pty-pending-data-drain-contract' import { activeRendererPtys } from './visibility-state' import { PTY_BATCH_DRAIN_CONTINUE_MS, diff --git a/src/main/ipc/pty/delivery/pending.ts b/src/main/ipc/pty/delivery/pending.ts index a0ba6e8ea641..eb4b95dbd0a9 100644 --- a/src/main/ipc/pty/delivery/pending.ts +++ b/src/main/ipc/pty/delivery/pending.ts @@ -12,7 +12,7 @@ import { redactPtyIdForDiagnostics } from '../../../../shared/pty-delivery-diagn import { recordCrashBreadcrumb } from '../../../crash-reporting/crash-breadcrumb-store' import { terminalOutputBacklogCapChars } from '../../../../shared/terminal-scrollback-policy' import { isHiddenPtyDeliveryGateEnabled } from '../../pty-hidden-delivery-gate' -import type { PendingPtyData } from '../../pty-pending-data-drain-queue' +import type { PendingPtyData } from '../../pty-pending-data-drain-contract' import { DROPPED_QUERY_SALVAGE_MAX_CHARS } from './constants' import type { PtyIpcSession } from '../session' diff --git a/src/main/ipc/pty/host-env/assembly.ts b/src/main/ipc/pty/host-env/assembly.ts index 25538cd8ad5b..62b576a5031e 100644 --- a/src/main/ipc/pty/host-env/assembly.ts +++ b/src/main/ipc/pty/host-env/assembly.ts @@ -4,7 +4,7 @@ import { detectExplicitPiAgentKindFromCommand, isPiCompatibleAgentType } from '../../../../shared/pi-agent-kind' -import { applyTerminalGitCredentialPromptGuard } from '../../terminal-git-credential-guard' +import { applyTerminalGitCredentialPromptGuard } from '../../../../shared/terminal-git-credential-guard' import { ensureOpenCodeStartupPromptForLaunch } from '../../../opencode/opencode-startup-prompt-installer' import { mimoCodeHookService } from '../../../mimo/hook-service' import { agentHookServer } from '../../../agent-hooks/server' @@ -27,9 +27,9 @@ import { isMimoLaunchCommand, resolveMimocodeSourceHome, resolvePiAgentSourceDir, - resolveScopedPiAgentSourceDir, - restoreOrStripOverlayEnv + resolveScopedPiAgentSourceDir } from './pi-agent' +import { restoreOrStripOverlayEnv } from '../../../../shared/agent-overlay-env' import { AGENT_HOOK_RUNTIME_ENV_KEYS } from './spawn-env-keys' import { applyManagedDataAccountEnvironment } from '../../../managed-data-accounts/launch-environment' import { applyOpenCodeStatusPluginEnv, captureOpenCodeSourceConfig } from './opencode-config' diff --git a/src/main/ipc/pty/host-env/opencode-config.ts b/src/main/ipc/pty/host-env/opencode-config.ts index 74aa1e46625b..279470de4eee 100644 --- a/src/main/ipc/pty/host-env/opencode-config.ts +++ b/src/main/ipc/pty/host-env/opencode-config.ts @@ -3,7 +3,8 @@ import { isOpenCodeLegacySharedConfigDir } from '../../../opencode/legacy-shared-config-dir' import { openCode2HookService, openCodeHookService } from '../../../opencode/hook-service' -import { resolveOpenCodeSourceConfigDir, restoreOrStripOverlayEnv } from './pi-agent' +import { resolveOpenCodeSourceConfigDir } from './pi-agent' +import { restoreOrStripOverlayEnv } from '../../../../shared/agent-overlay-env' import { selectOpenCodeHookAgent } from '../../../../shared/opencode-launch-command' import { isTuiAgentEnabled } from '../../../../shared/tui-agent-selection' import { resolveOpenCodeConfigDirectory } from '../../../../shared/opencode-config-directory' diff --git a/src/main/ipc/pty/host-env/pi-agent.ts b/src/main/ipc/pty/host-env/pi-agent.ts index f2945940a575..cdf489740ea4 100644 --- a/src/main/ipc/pty/host-env/pi-agent.ts +++ b/src/main/ipc/pty/host-env/pi-agent.ts @@ -151,8 +151,6 @@ export function getInheritedAgentSessionStampEnvKeysToDelete( ] } -export { restoreOrStripOverlayEnv } from '../../../../shared/agent-overlay-env' - export function isMimoLaunchCommand(launchCommand: string | undefined): boolean { return getAgentLaunchExecutableName(launchCommand) === 'mimo' } diff --git a/src/main/ipc/pty/session.ts b/src/main/ipc/pty/session.ts index 63d97259ce92..98a759b898e4 100644 --- a/src/main/ipc/pty/session.ts +++ b/src/main/ipc/pty/session.ts @@ -10,7 +10,8 @@ import type { } from '../../../shared/pty-renderer-delivery-health' import type { PtyRendererDeliveryDebugSnapshot } from './delivery/debug' import { PtyProducerFlowController } from '../pty-producer-flow-control' -import { PtyPendingDataDrainQueue, type PendingPtyData } from '../pty-pending-data-drain-queue' +import { PtyPendingDataDrainQueue } from '../pty-pending-data-drain-queue' +import type { PendingPtyData } from '../pty-pending-data-drain-contract' import { activeRendererPtys } from './delivery/visibility-state' import { isHiddenPtyDeliveryGateEnabled, diff --git a/src/main/ipc/qoder-desktop-execution-host.test.ts b/src/main/ipc/qoder-desktop-execution-host.test.ts index a74622c362b8..395441de47c2 100644 --- a/src/main/ipc/qoder-desktop-execution-host.test.ts +++ b/src/main/ipc/qoder-desktop-execution-host.test.ts @@ -11,7 +11,7 @@ import { buildAgentResumeStartupPlan } from '../../shared/tui-agent-startup' import type { PtySpawnIpcArgs } from './pty/ipc/spawn-types' vi.mock('./preflight-command-exec', () => ({ isCommandOnPath: vi.fn() })) -vi.mock('./local-agent-install-dir-detection', () => ({ +vi.mock('../../shared/local-agent-install-dir-detection', () => ({ detectCommandsInInstallDirs: () => new Set() })) vi.mock('./preflight-wsl-agent-detection', () => ({ diff --git a/src/main/ipc/runtime-watcher-process-pool.ts b/src/main/ipc/runtime-watcher-process-pool.ts index 66957d4e7e8f..20fd52da7f52 100644 --- a/src/main/ipc/runtime-watcher-process-pool.ts +++ b/src/main/ipc/runtime-watcher-process-pool.ts @@ -20,8 +20,6 @@ import { type RuntimeWatcherProcessPoolOptions } from './runtime-watcher-pool-state' -export type { RuntimeWatcherProcessPoolOptions } from './runtime-watcher-pool-state' - // Why: extra ~50 MiB processes are justified only when quarantine isolates a fault. const DEFAULT_MAX_SHARED_SUPERVISORS = 1 const DEFAULT_MAX_QUARANTINE_SUPERVISORS = 4 diff --git a/src/main/ipc/terminal-git-credential-guard.test.ts b/src/main/ipc/terminal-git-credential-guard.test.ts index bf1f7e1da051..fc5af9a9db08 100644 --- a/src/main/ipc/terminal-git-credential-guard.test.ts +++ b/src/main/ipc/terminal-git-credential-guard.test.ts @@ -2,7 +2,7 @@ import { describe, expect, it } from 'vitest' import { applyTerminalGitCredentialPromptGuard, TERMINAL_GIT_CREDENTIAL_GUARD_POLICY_ENV -} from './terminal-git-credential-guard' +} from '../../shared/terminal-git-credential-guard' function expectGuarded(env: Record): void { expect(env.GIT_TERMINAL_PROMPT).toBe('0') diff --git a/src/main/ipc/terminal-git-credential-guard.ts b/src/main/ipc/terminal-git-credential-guard.ts deleted file mode 100644 index 0a4e45588c0d..000000000000 --- a/src/main/ipc/terminal-git-credential-guard.ts +++ /dev/null @@ -1,4 +0,0 @@ -export { - applyTerminalGitCredentialPromptGuard, - TERMINAL_GIT_CREDENTIAL_GUARD_POLICY_ENV -} from '../../shared/terminal-git-credential-guard' diff --git a/src/main/ipc/tui-agent-detection-commands.test.ts b/src/main/ipc/tui-agent-detection-commands.test.ts index 4d1ca7790120..1f7f152efcd1 100644 --- a/src/main/ipc/tui-agent-detection-commands.test.ts +++ b/src/main/ipc/tui-agent-detection-commands.test.ts @@ -3,7 +3,7 @@ import { getTuiAgentDetectionProbeCommands, KNOWN_TUI_AGENT_DETECTION_COMMANDS, resolveDetectedTuiAgentIds -} from './tui-agent-detection-commands' +} from '../../shared/tui-agent-detection-commands' describe('tui agent detection commands', () => { it.each(['darwin', 'linux', 'win32', 'wsl'] as const)( diff --git a/src/main/ipc/tui-agent-detection-commands.ts b/src/main/ipc/tui-agent-detection-commands.ts deleted file mode 100644 index 88d65c1fa34a..000000000000 --- a/src/main/ipc/tui-agent-detection-commands.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../../shared/tui-agent-detection-commands' diff --git a/src/main/ipc/worktree-git-common-watch-reconciliation.test.ts b/src/main/ipc/worktree-git-common-watch-reconciliation.test.ts index 464ecf828b5d..d71337cb0553 100644 --- a/src/main/ipc/worktree-git-common-watch-reconciliation.test.ts +++ b/src/main/ipc/worktree-git-common-watch-reconciliation.test.ts @@ -1,6 +1,7 @@ import { join, resolve } from 'node:path' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { subscribeViaWatcherProcess, type WatcherProcessCallback } from './parcel-watcher-process' +import { subscribeViaWatcherProcess } from './parcel-watcher-process' +import type { WatcherProcessCallback } from './parcel-watcher-process-subscription' import { startGitCommonPolling } from './worktree-git-common-polling' import { startGitCommonNarrowWatch } from './worktree-git-common-narrow-watch' import { createGitCommonWatchReconciliation } from './worktree-git-common-watch-reconciliation' diff --git a/src/main/notifications/notification-delivery-service.ts b/src/main/notifications/notification-delivery-service.ts index 3150006aaa64..979f92f96b24 100644 --- a/src/main/notifications/notification-delivery-service.ts +++ b/src/main/notifications/notification-delivery-service.ts @@ -14,7 +14,7 @@ import type { import type { OrcaRuntimeService } from '../runtime/orca-runtime' import { buildNotificationOptions } from '../ipc/notification-options' import { translateMain } from '../i18n/main-i18n' -import { reserveNotificationCooldown } from '../ipc/notification-burst-cooldown' +import { reserveNotificationCooldown } from '../../shared/notification-burst-cooldown' export type NotificationDeliveryDependencies = { readNotificationSettings: () => NotificationSettings diff --git a/src/main/plugins/plugin-dev-watcher-unknown-identity.test.ts b/src/main/plugins/plugin-dev-watcher-unknown-identity.test.ts index 416577b4cc8c..0883273b85a1 100644 --- a/src/main/plugins/plugin-dev-watcher-unknown-identity.test.ts +++ b/src/main/plugins/plugin-dev-watcher-unknown-identity.test.ts @@ -4,10 +4,8 @@ import { mkdir, rename, rm, stat, symlink } from 'node:fs/promises' import type * as FsPromises from 'node:fs/promises' import { join } from 'node:path' import { afterEach, beforeEach, expect, it, vi } from 'vitest' -import { - subscribeViaWatcherProcess, - type WatcherProcessCallback -} from '../ipc/parcel-watcher-process' +import { subscribeViaWatcherProcess } from '../ipc/parcel-watcher-process' +import type { WatcherProcessCallback } from '../ipc/parcel-watcher-process-subscription' import { createAliasedWatcherRoot, removeAliasedWatcherRoot, diff --git a/src/main/plugins/plugin-dev-watcher.test.ts b/src/main/plugins/plugin-dev-watcher.test.ts index ebc921604d3f..e90d3e87a436 100644 --- a/src/main/plugins/plugin-dev-watcher.test.ts +++ b/src/main/plugins/plugin-dev-watcher.test.ts @@ -4,12 +4,12 @@ import type * as Fs from 'node:fs' import { mkdir, realpath, rename, rm, stat, symlink, writeFile } from 'node:fs/promises' import type * as FsPromises from 'node:fs/promises' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { - subscribeViaWatcherProcess, - type WatcherProcessCallback, - type WatcherProcessHooks, - type WatcherProcessSubscribeOptions -} from '../ipc/parcel-watcher-process' +import { subscribeViaWatcherProcess } from '../ipc/parcel-watcher-process' +import type { + WatcherProcessCallback, + WatcherProcessHooks +} from '../ipc/parcel-watcher-process-subscription' +import type { WatcherProcessSubscribeOptions } from '../ipc/parcel-watcher-process-protocol' import { createAliasedWatcherRoot as createNativeAliasedWatcherRoot, removeAliasedWatcherRoot, diff --git a/src/main/plugins/plugin-dev-watcher.ts b/src/main/plugins/plugin-dev-watcher.ts index 4534bf490f50..6f1a3c322504 100644 --- a/src/main/plugins/plugin-dev-watcher.ts +++ b/src/main/plugins/plugin-dev-watcher.ts @@ -1,11 +1,9 @@ import { realpathSync, statSync, type BigIntStats } from 'node:fs' import { realpath, stat } from 'node:fs/promises' import { basename, dirname, resolve } from 'node:path' -import { - subscribeViaWatcherProcess, - type WatcherProcessSubscribeOptions, - type WatcherProcessSubscription -} from '../ipc/parcel-watcher-process' +import { subscribeViaWatcherProcess } from '../ipc/parcel-watcher-process' +import type { WatcherProcessSubscribeOptions } from '../ipc/parcel-watcher-process-protocol' +import type { WatcherProcessSubscription } from '../ipc/parcel-watcher-process-subscription' import { resolveWatcherRootPaths } from '../ipc/watcher-event-root-path-rewrite' import { watcherDirectoryIdentity } from '../ipc/watcher-directory-identity' diff --git a/src/main/preflight/agent-command-detection.test.ts b/src/main/preflight/agent-command-detection.test.ts index 550f78aa9cbb..821a34ede116 100644 --- a/src/main/preflight/agent-command-detection.test.ts +++ b/src/main/preflight/agent-command-detection.test.ts @@ -11,7 +11,7 @@ const { detectInstallDirs, guestMounts } = vi.hoisted(() => { } }) -vi.mock('../ipc/local-agent-install-dir-detection', () => ({ +vi.mock('../../shared/local-agent-install-dir-detection', () => ({ detectCommandsInInstallDirs: detectInstallDirs })) vi.mock('../ipc/preflight-command-exec', () => ({ diff --git a/src/main/preflight/agent-command-detection.ts b/src/main/preflight/agent-command-detection.ts index bb1b7de45e9a..500d52921b6d 100644 --- a/src/main/preflight/agent-command-detection.ts +++ b/src/main/preflight/agent-command-detection.ts @@ -1,6 +1,6 @@ import { SshHostNotServedError } from '../providers/ssh-host-not-served-error' import { detectWslCommandsOnPath } from '../ipc/preflight-wsl-agent-detection' -import { detectCommandsInInstallDirs } from '../ipc/local-agent-install-dir-detection' +import { detectCommandsInInstallDirs } from '../../shared/local-agent-install-dir-detection' import { getPreflightWslTarget, type PreflightRuntimeContext diff --git a/src/main/preflight/agent-detection.ts b/src/main/preflight/agent-detection.ts index ac4b2a51e433..56730c6be9eb 100644 --- a/src/main/preflight/agent-detection.ts +++ b/src/main/preflight/agent-detection.ts @@ -38,7 +38,7 @@ import { getTuiAgentDetectionProbeCommands, KNOWN_TUI_AGENT_DETECTION_COMMANDS, resolveDetectedTuiAgentIds -} from '../ipc/tui-agent-detection-commands' +} from '../../shared/tui-agent-detection-commands' import { invalidateWslGuestEnvironment } from '../wsl/wsl-guest-environment' import { prunePreflightWslCache } from '../preflight-wsl-cache' import { detectAgentCommandsOnHost } from './agent-command-detection' diff --git a/src/main/runtime/file-watcher-host.test.ts b/src/main/runtime/file-watcher-host.test.ts index f924d86db04e..57ac22ec93e8 100644 --- a/src/main/runtime/file-watcher-host.test.ts +++ b/src/main/runtime/file-watcher-host.test.ts @@ -4,7 +4,7 @@ import type { WatcherProcessCallback, WatcherProcessHooks, WatcherProcessSubscription -} from '../ipc/parcel-watcher-process' +} from '../ipc/parcel-watcher-process-subscription' import { WatcherProcessFailure } from '../ipc/parcel-watcher-process-failure' import { WATCHER_IGNORE_DIRS, diff --git a/src/main/runtime/file-watcher-host.ts b/src/main/runtime/file-watcher-host.ts index e7f1d29e41de..97ef4f321581 100644 --- a/src/main/runtime/file-watcher-host.ts +++ b/src/main/runtime/file-watcher-host.ts @@ -2,10 +2,10 @@ import type { FsChangeEvent } from '../../shared/filesystem-entry-types' import { forgetRuntimeWatcherProcessRoot, resetRuntimeWatcherProcessForTest, - subscribeViaRuntimeWatcherProcess, - type WatcherProcessEvent, - type WatcherProcessSubscription + subscribeViaRuntimeWatcherProcess } from '../ipc/parcel-watcher-process' +import type { WatcherProcessEvent } from '../ipc/parcel-watcher-process-protocol' +import type { WatcherProcessSubscription } from '../ipc/parcel-watcher-process-subscription' import { isWatcherProcessFailure, type WatcherProcessFailure