diff --git a/config/scripts/check-focus-read-ratchet.test.mjs b/config/scripts/check-focus-read-ratchet.test.mjs
index 22f2d2ddad9..738c0f5b168 100644
--- a/config/scripts/check-focus-read-ratchet.test.mjs
+++ b/config/scripts/check-focus-read-ratchet.test.mjs
@@ -95,7 +95,7 @@ describe('countFocusSettingReads', () => {
expect(readers.namesFor('src/renderer/src/b.ts').has('ownerTarget')).toBe(false)
expect(
countFocusSettingReads(
- 'const t = runtimeTargetForOwnerHostId(getSettingsFocusedExecutionHostId(s))',
+ 'const t = ipcOrRuntimeTargetForHostId(getSettingsFocusedExecutionHostId(s))',
readers.namesFor('src/renderer/src/a.ts')
)
).toBe(1)
diff --git a/src/renderer/src/attention/agent-subject-read-actions.ts b/src/renderer/src/attention/agent-subject-read-actions.ts
index 908cd3877a6..1b7f91566d8 100644
--- a/src/renderer/src/attention/agent-subject-read-actions.ts
+++ b/src/renderer/src/attention/agent-subject-read-actions.ts
@@ -1,5 +1,5 @@
import type { AgentJournalCursor } from '../../../shared/agent-session-journal-types'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
export type StructuredSubjectRead = {
sessionId: string
diff --git a/src/renderer/src/attention/notification-subject-owner.ts b/src/renderer/src/attention/notification-subject-owner.ts
index 5bccc301e7a..9f43bf2f18a 100644
--- a/src/renderer/src/attention/notification-subject-owner.ts
+++ b/src/renderer/src/attention/notification-subject-owner.ts
@@ -16,7 +16,7 @@ import {
findIndexedProjectGroupOwner,
getCatalogOwnerHostId
} from '@/lib/worktree-runtime-owner-index'
-import type { WorktreeRuntimeOwnerState } from '@/lib/worktree-runtime-owner'
+import type { WorktreeRuntimeOwnerState } from '@/lib/worktree-runtime-owner-state'
type SubjectOwnerState = WorktreeRuntimeOwnerState &
Partial<
diff --git a/src/renderer/src/components/NewWorkspaceComposerCard.tsx b/src/renderer/src/components/NewWorkspaceComposerCard.tsx
index 1f62bbd9749..91e4ba46e58 100644
--- a/src/renderer/src/components/NewWorkspaceComposerCard.tsx
+++ b/src/renderer/src/components/NewWorkspaceComposerCard.tsx
@@ -13,7 +13,7 @@ import {
} from '@/components/sidebar/AddRemoteHostDialog'
import { lazyWithRetry } from '@/lib/lazy-with-retry'
import type * as SetProjectLocationDialogModule from '@/components/new-workspace/SetProjectLocationDialog'
-import { unwrapRuntimeRpcResult } from '@/runtime/runtime-rpc-client'
+import { unwrapRuntimeRpcResult } from '@/runtime/runtime-rpc-result'
import { withUiConnectTimeout } from '@/ssh/ssh-connect-ui-timeout'
import { isSshConnectInFlight, trackSshConnect } from '@/ssh/ssh-connect-in-flight'
import { translate } from '@/i18n/i18n'
diff --git a/src/renderer/src/components/artifacts/ArtifactsPage.test.tsx b/src/renderer/src/components/artifacts/ArtifactsPage.test.tsx
index de37ab0401c..6c3461ab1a1 100644
--- a/src/renderer/src/components/artifacts/ArtifactsPage.test.tsx
+++ b/src/renderer/src/components/artifacts/ArtifactsPage.test.tsx
@@ -47,9 +47,7 @@ vi.mock('@/components/ui/tooltip', () => ({
TooltipContent: ({ children }: { children: ReactNode }) =>
{children}
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: mocks.rpc
-}))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: mocks.rpc }))
vi.mock('@/store', () => ({
useAppStore: Object.assign(
diff --git a/src/renderer/src/components/automations/automation-extra-agent-args-capability.test.ts b/src/renderer/src/components/automations/automation-extra-agent-args-capability.test.ts
index b407da4d64a..fb2dcd5b260 100644
--- a/src/renderer/src/components/automations/automation-extra-agent-args-capability.test.ts
+++ b/src/renderer/src/components/automations/automation-extra-agent-args-capability.test.ts
@@ -11,9 +11,9 @@ const getRuntimeEnvironmentStatus = vi.fn()
vi.mock('@/runtime/runtime-rpc-client', () => ({
callRuntimeRpc: (...args: unknown[]) => callRuntimeRpc(...args),
- getRuntimeEnvironmentStatus: (...args: unknown[]) => getRuntimeEnvironmentStatus(...args),
- hasRuntimeRpcErrorCode: () => false
+ getRuntimeEnvironmentStatus: (...args: unknown[]) => getRuntimeEnvironmentStatus(...args)
}))
+vi.mock('@/runtime/runtime-rpc-result', () => ({ hasRuntimeRpcErrorCode: () => false }))
const RUNTIME = { kind: 'runtime', environmentId: 'env-1', pairingRevision: 4 } as const
const OWNER = { authority: RUNTIME, selector: { kind: 'self' } } as const
diff --git a/src/renderer/src/components/automations/automation-host-cache-error.ts b/src/renderer/src/components/automations/automation-host-cache-error.ts
index 41e7323e414..14017cb1245 100644
--- a/src/renderer/src/components/automations/automation-host-cache-error.ts
+++ b/src/renderer/src/components/automations/automation-host-cache-error.ts
@@ -7,7 +7,7 @@
* retry budget, while an unreachable or slow host must.
*/
-import { hasRuntimeRpcErrorCode } from '@/runtime/runtime-rpc-client'
+import { hasRuntimeRpcErrorCode } from '@/runtime/runtime-rpc-result'
import {
AUTOMATION_OWNER_CONFLICT_CODES,
stripAutomationOwnerConflictCode
diff --git a/src/renderer/src/components/automations/automation-host-client.test.ts b/src/renderer/src/components/automations/automation-host-client.test.ts
index a8a3eea7da1..d2da4c40b01 100644
--- a/src/renderer/src/components/automations/automation-host-client.test.ts
+++ b/src/renderer/src/components/automations/automation-host-client.test.ts
@@ -9,9 +9,7 @@ import {
} from './automation-host-client'
import { callRuntimeRpc } from '@/runtime/runtime-rpc-client'
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: vi.fn()
-}))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: vi.fn() }))
const mockApi = {
automations: {
diff --git a/src/renderer/src/components/automations/automation-host-diagnostics.test.ts b/src/renderer/src/components/automations/automation-host-diagnostics.test.ts
index 3c13a79ec85..71768183dbc 100644
--- a/src/renderer/src/components/automations/automation-host-diagnostics.test.ts
+++ b/src/renderer/src/components/automations/automation-host-diagnostics.test.ts
@@ -42,9 +42,9 @@ const getRuntimeEnvironmentStatus = vi.fn()
// injects a transport, so this mock stands in for a paired host that answers.
vi.mock('@/runtime/runtime-rpc-client', () => ({
callRuntimeRpc: (...args: unknown[]) => callRuntimeRpc(...args),
- getRuntimeEnvironmentStatus: (...args: unknown[]) => getRuntimeEnvironmentStatus(...args),
- hasRuntimeRpcErrorCode: () => false
+ getRuntimeEnvironmentStatus: (...args: unknown[]) => getRuntimeEnvironmentStatus(...args)
}))
+vi.mock('@/runtime/runtime-rpc-result', () => ({ hasRuntimeRpcErrorCode: () => false }))
const RUNTIME_AUTHORITY: AutomationAuthorityRef = {
kind: 'runtime',
diff --git a/src/renderer/src/components/automations/automation-host-scale-gates.test.ts b/src/renderer/src/components/automations/automation-host-scale-gates.test.ts
index 5bec80e92fa..cd444419504 100644
--- a/src/renderer/src/components/automations/automation-host-scale-gates.test.ts
+++ b/src/renderer/src/components/automations/automation-host-scale-gates.test.ts
@@ -41,9 +41,9 @@ const getRuntimeEnvironmentStatus = vi.fn()
vi.mock('@/runtime/runtime-rpc-client', () => ({
callRuntimeRpc: (...args: unknown[]) => callRuntimeRpc(...args),
- getRuntimeEnvironmentStatus: (...args: unknown[]) => getRuntimeEnvironmentStatus(...args),
- hasRuntimeRpcErrorCode: () => false
+ getRuntimeEnvironmentStatus: (...args: unknown[]) => getRuntimeEnvironmentStatus(...args)
}))
+vi.mock('@/runtime/runtime-rpc-result', () => ({ hasRuntimeRpcErrorCode: () => false }))
// 10 authorities x 5 entries = 50 hosts; 50 hosts x 20 = 1,000 automations.
// Half the authorities are old servers, because the legacy fan-out is where the
diff --git a/src/renderer/src/components/automations/automation-scoped-list-client.test.ts b/src/renderer/src/components/automations/automation-scoped-list-client.test.ts
index 43319886180..d3f3cacb27c 100644
--- a/src/renderer/src/components/automations/automation-scoped-list-client.test.ts
+++ b/src/renderer/src/components/automations/automation-scoped-list-client.test.ts
@@ -11,11 +11,7 @@ const getRuntimeEnvironmentStatus = vi.fn()
vi.mock('@/runtime/runtime-rpc-client', () => ({
callRuntimeRpc: (...args: unknown[]) => callRuntimeRpc(...args),
- getRuntimeEnvironmentStatus: (...args: unknown[]) => getRuntimeEnvironmentStatus(...args),
- // Why: the real matcher is exercised in runtime-rpc-result's own tests; here it only needs to be honest about the tail token.
- hasRuntimeRpcErrorCode: (error: unknown, code: string) =>
- typeof (error as { message?: unknown })?.message === 'string' &&
- (error as { message: string }).message.trimEnd().endsWith(`: ${code}`)
+ getRuntimeEnvironmentStatus: (...args: unknown[]) => getRuntimeEnvironmentStatus(...args)
}))
const DESKTOP = { kind: 'desktop' } as const
diff --git a/src/renderer/src/components/automations/automation-scoped-list-client.ts b/src/renderer/src/components/automations/automation-scoped-list-client.ts
index 445dc4f50f1..604f5031f6e 100644
--- a/src/renderer/src/components/automations/automation-scoped-list-client.ts
+++ b/src/renderer/src/components/automations/automation-scoped-list-client.ts
@@ -9,7 +9,8 @@
* that would attribute other hosts' automations to the selected one.
*/
-import { callRuntimeRpc, type RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import { callRuntimeRpc } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import type {
Automation,
AutomationCreateInput,
diff --git a/src/renderer/src/components/automations/automations-page-test-harness.tsx b/src/renderer/src/components/automations/automations-page-test-harness.tsx
index fc94b173286..0a19dc67931 100644
--- a/src/renderer/src/components/automations/automations-page-test-harness.tsx
+++ b/src/renderer/src/components/automations/automations-page-test-harness.tsx
@@ -164,10 +164,7 @@ vi.mock('@/store/selectors', () => ({
vi.mock('@/runtime/runtime-rpc-client', () => ({
callRuntimeRpc: (...args: unknown[]) => mocks.callRuntimeRpc(...args),
- getRuntimeEnvironmentStatus: (...args: unknown[]) => mocks.getRuntimeEnvironmentStatus(...args),
- // Matches the real matcher's contract: the code is a `: ` message tail.
- hasRuntimeRpcErrorCode: (error: unknown, code: string) =>
- error instanceof Error && error.message.trimEnd().endsWith(`: ${code}`)
+ getRuntimeEnvironmentStatus: (...args: unknown[]) => mocks.getRuntimeEnvironmentStatus(...args)
}))
vi.mock('sonner', () => ({
diff --git a/src/renderer/src/components/automations/use-automation-host-catalog-readoption.test.tsx b/src/renderer/src/components/automations/use-automation-host-catalog-readoption.test.tsx
index 3c64eb45922..652d0a6045e 100644
--- a/src/renderer/src/components/automations/use-automation-host-catalog-readoption.test.tsx
+++ b/src/renderer/src/components/automations/use-automation-host-catalog-readoption.test.tsx
@@ -35,9 +35,9 @@ vi.mock('@/store', () => {
vi.mock('@/runtime/runtime-rpc-client', () => ({
callRuntimeRpc: (_target: unknown, _method: string, params: unknown) =>
listScoped(params as { selector: AutomationListScopeSelector }),
- getRuntimeEnvironmentStatus: vi.fn(),
- hasRuntimeRpcErrorCode: () => false
+ getRuntimeEnvironmentStatus: vi.fn()
}))
+vi.mock('@/runtime/runtime-rpc-result', () => ({ hasRuntimeRpcErrorCode: () => false }))
import { useAutomationHostCatalog } from './use-automation-host-catalog'
diff --git a/src/renderer/src/components/automations/use-automation-host-catalog.test.tsx b/src/renderer/src/components/automations/use-automation-host-catalog.test.tsx
index 5e8e789b794..74b59a4184e 100644
--- a/src/renderer/src/components/automations/use-automation-host-catalog.test.tsx
+++ b/src/renderer/src/components/automations/use-automation-host-catalog.test.tsx
@@ -33,9 +33,9 @@ vi.mock('@/store', () => {
vi.mock('@/runtime/runtime-rpc-client', () => ({
callRuntimeRpc: (...args: unknown[]) => mocks.callRuntimeRpc(...args),
- getRuntimeEnvironmentStatus: (...args: unknown[]) => mocks.getRuntimeEnvironmentStatus(...args),
- hasRuntimeRpcErrorCode: () => false
+ getRuntimeEnvironmentStatus: (...args: unknown[]) => mocks.getRuntimeEnvironmentStatus(...args)
}))
+vi.mock('@/runtime/runtime-rpc-result', () => ({ hasRuntimeRpcErrorCode: () => false }))
import { useAutomationHostCatalog } from './use-automation-host-catalog'
diff --git a/src/renderer/src/components/browser-pane/assemble-chrome/browser-workspace-pane.retention-props.test.tsx b/src/renderer/src/components/browser-pane/assemble-chrome/browser-workspace-pane.retention-props.test.tsx
index 9c4c171d5a6..9799a3dce74 100644
--- a/src/renderer/src/components/browser-pane/assemble-chrome/browser-workspace-pane.retention-props.test.tsx
+++ b/src/renderer/src/components/browser-pane/assemble-chrome/browser-workspace-pane.retention-props.test.tsx
@@ -32,9 +32,7 @@ vi.mock('@/store', () => ({
}
}))
-vi.mock('@/lib/worktree-runtime-owner', () => ({
- getRuntimeEnvironmentIdForWorktree: () => null
-}))
+vi.mock('@/lib/worktree-runtime-owner', () => ({ getRuntimeEnvironmentIdForWorktree: () => null }))
vi.mock('@/components/contextual-tours/use-contextual-tour', () => ({
useContextualTour: () => {}
diff --git a/src/renderer/src/components/browser-pane/stream-remote/remote-browser-page-input-model.ts b/src/renderer/src/components/browser-pane/stream-remote/remote-browser-page-input-model.ts
index 2745413ca9b..e40dcaef0fd 100644
--- a/src/renderer/src/components/browser-pane/stream-remote/remote-browser-page-input-model.ts
+++ b/src/renderer/src/components/browser-pane/stream-remote/remote-browser-page-input-model.ts
@@ -1,6 +1,6 @@
import type { BrowserScreencastFrameMetadata } from '../../../../../shared/browser-screencast-protocol'
import type { BrowserTabInfo } from '../../../../../shared/runtime-types'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target'
import type {
RemoteBrowserOperationToken,
RemoteBrowserStreamToken,
diff --git a/src/renderer/src/components/browser-pane/stream-remote/remote-browser-page-session.ts b/src/renderer/src/components/browser-pane/stream-remote/remote-browser-page-session.ts
index c8def15b1d6..6a3aca03443 100644
--- a/src/renderer/src/components/browser-pane/stream-remote/remote-browser-page-session.ts
+++ b/src/renderer/src/components/browser-pane/stream-remote/remote-browser-page-session.ts
@@ -1,4 +1,4 @@
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target'
import { ORCA_BROWSER_BLANK_URL } from '../../../../../shared/constants'
import type { BrowserTabInfo } from '../../../../../shared/runtime-types'
import { isRemoteBrowserPageMissingError } from './remote-browser-stream-errors'
diff --git a/src/renderer/src/components/browser-pane/stream-remote/remote-browser-stream-errors.ts b/src/renderer/src/components/browser-pane/stream-remote/remote-browser-stream-errors.ts
index 111f094a4fd..4304f16de67 100644
--- a/src/renderer/src/components/browser-pane/stream-remote/remote-browser-stream-errors.ts
+++ b/src/renderer/src/components/browser-pane/stream-remote/remote-browser-stream-errors.ts
@@ -1,4 +1,4 @@
-import { RuntimeRpcCallError } from '@/runtime/runtime-rpc-client'
+import { RuntimeRpcCallError } from '@/runtime/runtime-rpc-result'
import { BROWSER_UNAVAILABLE_ERROR_CODE } from '../../../../../shared/runtime-session-contracts'
import {
remoteBrowserStreamLostNotice,
diff --git a/src/renderer/src/components/browser-pane/stream-remote/remote-browser-stream-lifecycle.ts b/src/renderer/src/components/browser-pane/stream-remote/remote-browser-stream-lifecycle.ts
index 64c5f2e433a..8938ff2d3ba 100644
--- a/src/renderer/src/components/browser-pane/stream-remote/remote-browser-stream-lifecycle.ts
+++ b/src/renderer/src/components/browser-pane/stream-remote/remote-browser-stream-lifecycle.ts
@@ -1,4 +1,4 @@
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target'
import type { RuntimeStatus } from '../../../../../shared/runtime-types'
import { RemoteBrowserPageSession } from './remote-browser-page-session'
import { openRemoteBrowserScreencastStream } from './remote-browser-screencast-subscription'
diff --git a/src/renderer/src/components/browser-pane/stream-remote/use-remote-browser-page-lifecycle.ts b/src/renderer/src/components/browser-pane/stream-remote/use-remote-browser-page-lifecycle.ts
index 41839c8396c..b09d9d47f2e 100644
--- a/src/renderer/src/components/browser-pane/stream-remote/use-remote-browser-page-lifecycle.ts
+++ b/src/renderer/src/components/browser-pane/stream-remote/use-remote-browser-page-lifecycle.ts
@@ -6,7 +6,8 @@ import type {
RemoteBrowserOperationToken,
RemoteBrowserViewportSize
} from './remote-browser-stream-tokens'
-import { callRuntimeRpc, type RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import { callRuntimeRpc } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target'
import { toRuntimeWorktreeSelector } from '@/runtime/runtime-worktree-selector'
import type { BrowserScreencastFrameMetadata } from '../../../../../shared/browser-screencast-protocol'
import type { BrowserPage as BrowserPageState } from '../../../../../shared/browser-workspace-types'
diff --git a/src/renderer/src/components/browser-pane/workspace-doc/workspace-doc-page-pane.test.tsx b/src/renderer/src/components/browser-pane/workspace-doc/workspace-doc-page-pane.test.tsx
index 15f7bc82017..219e3727a07 100644
--- a/src/renderer/src/components/browser-pane/workspace-doc/workspace-doc-page-pane.test.tsx
+++ b/src/renderer/src/components/browser-pane/workspace-doc/workspace-doc-page-pane.test.tsx
@@ -22,9 +22,7 @@ const mocks = vi.hoisted(() => ({
vi.mock('@/store', () => ({
useAppStore: (selector: (state: unknown) => unknown) => selector(mocks.storeState)
}))
-vi.mock('@/lib/worktree-runtime-owner', () => ({
- getRuntimeEnvironmentIdForWorktree: () => null
-}))
+vi.mock('@/lib/worktree-runtime-owner', () => ({ getRuntimeEnvironmentIdForWorktree: () => null }))
vi.mock('./HtmlDocPreview', () => ({
HtmlDocPreview: ({ holdsGuestFocus }: { holdsGuestFocus?: boolean }) => {
mocks.handedFocus.push(holdsGuestFocus)
diff --git a/src/renderer/src/components/connect-dialog-outside-dismiss.test.tsx b/src/renderer/src/components/connect-dialog-outside-dismiss.test.tsx
index 684499accce..7cd3f3dd12a 100644
--- a/src/renderer/src/components/connect-dialog-outside-dismiss.test.tsx
+++ b/src/renderer/src/components/connect-dialog-outside-dismiss.test.tsx
@@ -28,8 +28,6 @@ vi.mock('@/store', () => ({
}
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({}))
-
let root: Root | null = null
beforeEach(() => {
diff --git a/src/renderer/src/components/editor/ExternalFileChangeBanner.test.tsx b/src/renderer/src/components/editor/ExternalFileChangeBanner.test.tsx
index 45e387d25a4..4510f942ba1 100644
--- a/src/renderer/src/components/editor/ExternalFileChangeBanner.test.tsx
+++ b/src/renderer/src/components/editor/ExternalFileChangeBanner.test.tsx
@@ -15,7 +15,7 @@ vi.mock('@/store', () => ({
vi.mock('@/runtime/runtime-file-read-client', () => ({
readRuntimeFileContent: readRuntimeFileContentMock
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({}))
+
vi.mock('@/lib/connection-context', () => ({
// Why: the floating workspace is always client-local; other owners are still loading.
getConnectionIdForFile: (worktreeId: string) =>
diff --git a/src/renderer/src/components/editor/ExternalFileChangeCompareDialog.test.tsx b/src/renderer/src/components/editor/ExternalFileChangeCompareDialog.test.tsx
index 0b6e6b91a73..a6c97b71619 100644
--- a/src/renderer/src/components/editor/ExternalFileChangeCompareDialog.test.tsx
+++ b/src/renderer/src/components/editor/ExternalFileChangeCompareDialog.test.tsx
@@ -13,7 +13,7 @@ const mocks = vi.hoisted(() => ({
vi.mock('@/runtime/runtime-file-read-client', () => ({
readRuntimeFileContent: mocks.readRuntimeFileContent
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({}))
+
vi.mock('@/lib/connection-context', () => ({
getConnectionIdForFile: mocks.getConnectionIdForFile
}))
diff --git a/src/renderer/src/components/editor/editor-dropped-file-open.ts b/src/renderer/src/components/editor/editor-dropped-file-open.ts
index 4d0358e0d37..4c915939706 100644
--- a/src/renderer/src/components/editor/editor-dropped-file-open.ts
+++ b/src/renderer/src/components/editor/editor-dropped-file-open.ts
@@ -4,13 +4,11 @@ import { isPathInsideWorktree, toWorktreeRelativePath } from '@/lib/terminal-lin
import { useAppStore } from '@/store'
import { getConnectionId } from '@/lib/connection-context'
import { joinPath } from '@/lib/path'
-import type { WorktreeRuntimeOwnerState } from '@/lib/worktree-runtime-owner'
+import type { WorktreeRuntimeOwnerState } from '@/lib/worktree-runtime-owner-state'
import { importExternalPathsToRuntime } from '@/runtime/runtime-file-import-client'
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
-import {
- runtimeTargetEnvironmentId,
- type RuntimeClientTarget
-} from '@/runtime/runtime-client-target'
+import { runtimeTargetEnvironmentId } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { translate } from '@/i18n/i18n'
import { captureWorktreeSshMutationExpectation } from '@/lib/ssh-mutation-expectation'
import { statUserOpenedPath } from '@/lib/user-opened-local-path'
diff --git a/src/renderer/src/components/editor/editor-restored-tab-conflict-scan.test.ts b/src/renderer/src/components/editor/editor-restored-tab-conflict-scan.test.ts
index f2ebd52ce76..96007652eb9 100644
--- a/src/renderer/src/components/editor/editor-restored-tab-conflict-scan.test.ts
+++ b/src/renderer/src/components/editor/editor-restored-tab-conflict-scan.test.ts
@@ -15,7 +15,7 @@ const mocks = vi.hoisted(() => ({
vi.mock('@/runtime/runtime-file-read-client', () => ({
readRuntimeFileContent: mocks.readRuntimeFileContent
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({}))
+
vi.mock('@/lib/connection-context', () => ({
getConnectionIdForFile: mocks.getConnectionIdForFile
}))
diff --git a/src/renderer/src/components/editor/rich-markdown-async-image-paste.test.ts b/src/renderer/src/components/editor/rich-markdown-async-image-paste.test.ts
index ea4e9aae2f4..4446a69bdfb 100644
--- a/src/renderer/src/components/editor/rich-markdown-async-image-paste.test.ts
+++ b/src/renderer/src/components/editor/rich-markdown-async-image-paste.test.ts
@@ -25,7 +25,7 @@ vi.mock('@/store', () => ({
}))
}
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({}))
+
vi.mock('sonner', () => ({ toast: { error: vi.fn(), info: vi.fn() } }))
type ImportResult = Awaited>
diff --git a/src/renderer/src/components/editor/rich-markdown-async-image-table.test.ts b/src/renderer/src/components/editor/rich-markdown-async-image-table.test.ts
index 174519a7638..b3a17b7c83f 100644
--- a/src/renderer/src/components/editor/rich-markdown-async-image-table.test.ts
+++ b/src/renderer/src/components/editor/rich-markdown-async-image-table.test.ts
@@ -19,7 +19,7 @@ vi.mock('@/store', () => ({
}))
}
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({}))
+
vi.mock('sonner', () => ({ toast: { error: vi.fn(), info: vi.fn() } }))
type ImportResult = Awaited>
diff --git a/src/renderer/src/components/editor/rich-markdown-editor-config.ts b/src/renderer/src/components/editor/rich-markdown-editor-config.ts
index c96102fc7f2..d317290a5d0 100644
--- a/src/renderer/src/components/editor/rich-markdown-editor-config.ts
+++ b/src/renderer/src/components/editor/rich-markdown-editor-config.ts
@@ -27,7 +27,7 @@ import {
createRichMarkdownImageResolverContext,
setRichMarkdownImageResolverContext
} from './rich-markdown-image-context'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { getRichMarkdownSpellcheckAttribute } from './rich-markdown-spellcheck'
import type { MutableRefObject, Dispatch, SetStateAction } from 'react'
import type { DiffComment } from '../../../../shared/diff-comment-types'
diff --git a/src/renderer/src/components/editor/rich-markdown-image-context.ts b/src/renderer/src/components/editor/rich-markdown-image-context.ts
index f20a57fe37e..71d3ea130b9 100644
--- a/src/renderer/src/components/editor/rich-markdown-image-context.ts
+++ b/src/renderer/src/components/editor/rich-markdown-image-context.ts
@@ -1,6 +1,6 @@
import type { Editor } from '@tiptap/core'
import { getConnectionId } from '@/lib/connection-context'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
export type RichMarkdownImageRuntimeContext = Omit & {
diff --git a/src/renderer/src/components/editor/rich-markdown-image-insert-code-block.test.ts b/src/renderer/src/components/editor/rich-markdown-image-insert-code-block.test.ts
index 8a8198e51af..6b96d4e1dac 100644
--- a/src/renderer/src/components/editor/rich-markdown-image-insert-code-block.test.ts
+++ b/src/renderer/src/components/editor/rich-markdown-image-insert-code-block.test.ts
@@ -30,8 +30,6 @@ vi.mock('@/store', () => ({
}
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({}))
-
vi.mock('sonner', () => ({
toast: { error: vi.fn(), info: vi.fn() }
}))
diff --git a/src/renderer/src/components/editor/rich-markdown-image-insert.test.ts b/src/renderer/src/components/editor/rich-markdown-image-insert.test.ts
index 526da451f90..b7f036159ca 100644
--- a/src/renderer/src/components/editor/rich-markdown-image-insert.test.ts
+++ b/src/renderer/src/components/editor/rich-markdown-image-insert.test.ts
@@ -22,8 +22,6 @@ vi.mock('@/store', () => ({
}
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({}))
-
vi.mock('sonner', () => ({
toast: { error: vi.fn(), info: vi.fn() }
}))
diff --git a/src/renderer/src/components/editor/rich-markdown-paste-image.test.ts b/src/renderer/src/components/editor/rich-markdown-paste-image.test.ts
index 28365250b6c..ed674a8d338 100644
--- a/src/renderer/src/components/editor/rich-markdown-paste-image.test.ts
+++ b/src/renderer/src/components/editor/rich-markdown-paste-image.test.ts
@@ -22,8 +22,6 @@ vi.mock('@/store', () => ({
}
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({}))
-
vi.mock('sonner', () => ({
toast: { error: vi.fn(), info: vi.fn() }
}))
diff --git a/src/renderer/src/components/editor/useEditorPanelFileContentLoader.ts b/src/renderer/src/components/editor/useEditorPanelFileContentLoader.ts
index eaa3ef6248a..72b69b33f0a 100644
--- a/src/renderer/src/components/editor/useEditorPanelFileContentLoader.ts
+++ b/src/renderer/src/components/editor/useEditorPanelFileContentLoader.ts
@@ -5,8 +5,8 @@ import { useAppStore } from '@/store'
import { getDiskBaselineSignature } from './diff-content-signature'
import { getRuntimeFileReadScope } from '@/runtime/runtime-file-routing'
import { readEditorCsvFileContent } from './csv/csv-file-content'
-import { RuntimeRpcCallError } from '@/runtime/runtime-rpc-client'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import { RuntimeRpcCallError } from '@/runtime/runtime-rpc-result'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { requireRuntimeTargetForFileOwner } from '@/lib/file-owner-runtime-target'
import { findWorkspaceFileRoute } from '@/lib/runtime-workspace-file-route'
import { selectWorktreeHostConnectionPhase } from '@/lib/worktree-host-connection-phase'
diff --git a/src/renderer/src/components/editor/useLocalImagePick.test.tsx b/src/renderer/src/components/editor/useLocalImagePick.test.tsx
index 4138b14727e..1976c3b138a 100644
--- a/src/renderer/src/components/editor/useLocalImagePick.test.tsx
+++ b/src/renderer/src/components/editor/useLocalImagePick.test.tsx
@@ -21,7 +21,7 @@ vi.mock('@/store', () => ({
}))
}
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({}))
+
vi.mock('sonner', () => ({ toast: { error: vi.fn(), info: vi.fn() } }))
type ImportResult = Awaited>
diff --git a/src/renderer/src/components/editor/useRichMarkdownProgrammaticSync.ts b/src/renderer/src/components/editor/useRichMarkdownProgrammaticSync.ts
index 1719183d297..e43b767d069 100644
--- a/src/renderer/src/components/editor/useRichMarkdownProgrammaticSync.ts
+++ b/src/renderer/src/components/editor/useRichMarkdownProgrammaticSync.ts
@@ -10,7 +10,7 @@ import {
createRichMarkdownImageResolverContext,
setRichMarkdownImageResolverContext
} from './rich-markdown-image-context'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import type { RichMarkdownEditorCodec } from './rich-markdown-source-transport'
type RichMarkdownProgrammaticSyncOptions = {
diff --git a/src/renderer/src/components/floating-terminal/use-floating-terminal-create-actions.ts b/src/renderer/src/components/floating-terminal/use-floating-terminal-create-actions.ts
index 51e9ece5675..23f87a7ea90 100644
--- a/src/renderer/src/components/floating-terminal/use-floating-terminal-create-actions.ts
+++ b/src/renderer/src/components/floating-terminal/use-floating-terminal-create-actions.ts
@@ -13,7 +13,7 @@ import { FLOATING_TERMINAL_WORKTREE_ID } from '../../../../shared/constants'
import type { FloatingWorkspaceChromeModel } from './use-floating-workspace-chrome-model'
import type { FloatingTerminalPanelLocalState } from './use-floating-terminal-panel-local-state'
import type { FloatingTerminalPanelStoreState } from './use-floating-terminal-panel-store-state'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
const LOCAL_TARGET: RuntimeClientTarget = { kind: 'local' }
diff --git a/src/renderer/src/components/github-item-dialog/land-pull-request/pr-reviewers-request-actions.ts b/src/renderer/src/components/github-item-dialog/land-pull-request/pr-reviewers-request-actions.ts
index c74849ed6cc..d4b333da03c 100644
--- a/src/renderer/src/components/github-item-dialog/land-pull-request/pr-reviewers-request-actions.ts
+++ b/src/renderer/src/components/github-item-dialog/land-pull-request/pr-reviewers-request-actions.ts
@@ -14,7 +14,7 @@ import type {
} from '../../../../../shared/github/pull-request-types'
import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types'
import type { TaskSourceContext } from '../../../../../shared/task-source-context'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target'
import { translate } from '@/i18n/i18n'
type ReviewerRequestArgs = {
diff --git a/src/renderer/src/components/github-project/ProjectCell.tsx b/src/renderer/src/components/github-project/ProjectCell.tsx
index 96d071e3cf5..6e2459a2a3f 100644
--- a/src/renderer/src/components/github-project/ProjectCell.tsx
+++ b/src/renderer/src/components/github-project/ProjectCell.tsx
@@ -1,4 +1,4 @@
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import React from 'react'
import { TYPE_FIELD_DATA_TYPE } from './columns'
import type {
diff --git a/src/renderer/src/components/github-project/ProjectCellIdentity.tsx b/src/renderer/src/components/github-project/ProjectCellIdentity.tsx
index 2159cdf85da..4b45d09be18 100644
--- a/src/renderer/src/components/github-project/ProjectCellIdentity.tsx
+++ b/src/renderer/src/components/github-project/ProjectCellIdentity.tsx
@@ -1,4 +1,4 @@
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import React from 'react'
import { FileText, GitPullRequest, Lock } from 'lucide-react'
import { translate } from '@/i18n/i18n'
diff --git a/src/renderer/src/components/github-project/ProjectCellIssueType.tsx b/src/renderer/src/components/github-project/ProjectCellIssueType.tsx
index 99f63244cb3..f78707fdedc 100644
--- a/src/renderer/src/components/github-project/ProjectCellIssueType.tsx
+++ b/src/renderer/src/components/github-project/ProjectCellIssueType.tsx
@@ -1,4 +1,4 @@
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import React, { useEffect, useMemo, useState } from 'react'
import { useShallow } from 'zustand/react/shallow'
import { CircleDot } from 'lucide-react'
diff --git a/src/renderer/src/components/github-project/ProjectCellRepositoryEditors.tsx b/src/renderer/src/components/github-project/ProjectCellRepositoryEditors.tsx
index c61a4c54c60..b2abc92b535 100644
--- a/src/renderer/src/components/github-project/ProjectCellRepositoryEditors.tsx
+++ b/src/renderer/src/components/github-project/ProjectCellRepositoryEditors.tsx
@@ -1,4 +1,4 @@
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import React, { useMemo, useState } from 'react'
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
import { useRepoAssigneesBySlug, useRepoLabelsBySlug } from '@/hooks/useGitHubSlugMetadata'
diff --git a/src/renderer/src/components/github-project/ProjectItemSlugDialog.tsx b/src/renderer/src/components/github-project/ProjectItemSlugDialog.tsx
index 2c37c715c27..7e6e63974d9 100644
--- a/src/renderer/src/components/github-project/ProjectItemSlugDialog.tsx
+++ b/src/renderer/src/components/github-project/ProjectItemSlugDialog.tsx
@@ -7,7 +7,7 @@
// Files, Checks, and review-thread tabs hidden. This component is that
// simplified surface; it also routes every write through slug-addressed
// mutation helpers and patches the Project table cache on success.
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import React from 'react'
import * as VisuallyHidden from 'radix-ui/visually-hidden'
import { Sheet, SheetContent, SheetDescription, SheetTitle } from '@/components/ui/sheet'
diff --git a/src/renderer/src/components/github-project/ProjectPicker.tsx b/src/renderer/src/components/github-project/ProjectPicker.tsx
index 738595cd977..a01e4a57640 100644
--- a/src/renderer/src/components/github-project/ProjectPicker.tsx
+++ b/src/renderer/src/components/github-project/ProjectPicker.tsx
@@ -1,4 +1,4 @@
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import React, { useCallback, useEffect, useMemo, useState } from 'react'
import { ChevronDown } from 'lucide-react'
import { toast } from 'sonner'
diff --git a/src/renderer/src/components/github-project/ProjectRow.tsx b/src/renderer/src/components/github-project/ProjectRow.tsx
index cf5e6b070a2..852c1d6c405 100644
--- a/src/renderer/src/components/github-project/ProjectRow.tsx
+++ b/src/renderer/src/components/github-project/ProjectRow.tsx
@@ -1,4 +1,4 @@
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import React from 'react'
import { ExternalLink, Play } from 'lucide-react'
import { HoverCard, HoverCardContent, HoverCardTrigger } from '@/components/ui/hover-card'
diff --git a/src/renderer/src/components/github-project/ProjectViewList.tsx b/src/renderer/src/components/github-project/ProjectViewList.tsx
index 5611188038b..96a8f324aa4 100644
--- a/src/renderer/src/components/github-project/ProjectViewList.tsx
+++ b/src/renderer/src/components/github-project/ProjectViewList.tsx
@@ -23,7 +23,7 @@ import type {
GitHubProjectSortDirection,
GitHubProjectTable
} from '../../../../shared/github/project-types'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { translate } from '@/i18n/i18n'
type SortOverride = { fieldId: string; direction: GitHubProjectSortDirection }
diff --git a/src/renderer/src/components/github-project/project-picker-runtime.ts b/src/renderer/src/components/github-project/project-picker-runtime.ts
index d97576ce65a..94050a8d50c 100644
--- a/src/renderer/src/components/github-project/project-picker-runtime.ts
+++ b/src/renderer/src/components/github-project/project-picker-runtime.ts
@@ -1,4 +1,4 @@
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { callRuntimeRpc } from '@/runtime/runtime-rpc-client'
import { githubProjectHost } from '../../../../shared/github/project-identity'
import type { GitHubProjectOwnerType } from '../../../../shared/github/project-types'
diff --git a/src/renderer/src/components/github-project/slug-dialog/AssigneesEditor.tsx b/src/renderer/src/components/github-project/slug-dialog/AssigneesEditor.tsx
index 7a4a3fee9de..c0b6c76c9aa 100644
--- a/src/renderer/src/components/github-project/slug-dialog/AssigneesEditor.tsx
+++ b/src/renderer/src/components/github-project/slug-dialog/AssigneesEditor.tsx
@@ -1,4 +1,4 @@
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target'
import React, { useMemo, useState } from 'react'
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
import { cn } from '@/lib/utils'
diff --git a/src/renderer/src/components/github-project/slug-dialog/Comments.tsx b/src/renderer/src/components/github-project/slug-dialog/Comments.tsx
index 88f326adc58..1c392be6388 100644
--- a/src/renderer/src/components/github-project/slug-dialog/Comments.tsx
+++ b/src/renderer/src/components/github-project/slug-dialog/Comments.tsx
@@ -1,4 +1,4 @@
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target'
import React, { useState } from 'react'
import { Send } from 'lucide-react'
import { toast } from 'sonner'
diff --git a/src/renderer/src/components/github-project/slug-dialog/LabelsEditor.tsx b/src/renderer/src/components/github-project/slug-dialog/LabelsEditor.tsx
index a807fef6362..57cd91f4931 100644
--- a/src/renderer/src/components/github-project/slug-dialog/LabelsEditor.tsx
+++ b/src/renderer/src/components/github-project/slug-dialog/LabelsEditor.tsx
@@ -1,4 +1,4 @@
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target'
import React, { useState } from 'react'
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
import { cn } from '@/lib/utils'
diff --git a/src/renderer/src/components/github-project/slug-dialog/SlugDialogBody.tsx b/src/renderer/src/components/github-project/slug-dialog/SlugDialogBody.tsx
index f3420d1af9f..45ee227c4a4 100644
--- a/src/renderer/src/components/github-project/slug-dialog/SlugDialogBody.tsx
+++ b/src/renderer/src/components/github-project/slug-dialog/SlugDialogBody.tsx
@@ -1,5 +1,5 @@
/* oxlint-disable react-doctor/no-adjust-state-on-prop-change -- Why: slug dialog details are loaded through GitHub IPC and must clear stale request state before each lookup. */
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target'
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { CircleDot, ExternalLink, GitPullRequest, LoaderCircle, X } from 'lucide-react'
import { toast } from 'sonner'
diff --git a/src/renderer/src/components/github-project/useProjectPickerBrowse.ts b/src/renderer/src/components/github-project/useProjectPickerBrowse.ts
index 4bc6360ce29..097316cf1d8 100644
--- a/src/renderer/src/components/github-project/useProjectPickerBrowse.ts
+++ b/src/renderer/src/components/github-project/useProjectPickerBrowse.ts
@@ -1,4 +1,4 @@
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { useCallback, useLayoutEffect, useRef, useState } from 'react'
import { useMountedRef } from '@/hooks/useMountedRef'
import type { GitHubProjectSummary } from '../../../../shared/github/project-types'
diff --git a/src/renderer/src/components/github-project/useProjectViewTable.ts b/src/renderer/src/components/github-project/useProjectViewTable.ts
index bf2f5f35d8f..912150506ca 100644
--- a/src/renderer/src/components/github-project/useProjectViewTable.ts
+++ b/src/renderer/src/components/github-project/useProjectViewTable.ts
@@ -1,4 +1,4 @@
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'
import { toast } from 'sonner'
import { useMountedRef } from '@/hooks/useMountedRef'
diff --git a/src/renderer/src/components/github/PRFilterDropdowns.tsx b/src/renderer/src/components/github/PRFilterDropdowns.tsx
index 8159f74c622..4a3c161049b 100644
--- a/src/renderer/src/components/github/PRFilterDropdowns.tsx
+++ b/src/renderer/src/components/github/PRFilterDropdowns.tsx
@@ -19,7 +19,7 @@ import type {
GitHubAssignableUser,
GitHubOwnerRepo
} from '../../../../shared/github/pull-request-types'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import type { ParsedTaskQuery } from '../../../../shared/task-query'
import { translate } from '@/i18n/i18n'
diff --git a/src/renderer/src/components/github/github-rate-limit-display.tsx b/src/renderer/src/components/github/github-rate-limit-display.tsx
index ae921d39ff3..265fe75075e 100644
--- a/src/renderer/src/components/github/github-rate-limit-display.tsx
+++ b/src/renderer/src/components/github/github-rate-limit-display.tsx
@@ -3,7 +3,7 @@ import { Gauge, RefreshCw } from 'lucide-react'
import { cn } from '@/lib/utils'
import { installWindowVisibilityInterval } from '@/lib/window-visibility-interval'
import { callRuntimeRpc } from '@/runtime/runtime-rpc-client'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import type {
GetRateLimitResult,
GitHubRateLimitSnapshot
diff --git a/src/renderer/src/components/github/github-work-item-edit-mutations.ts b/src/renderer/src/components/github/github-work-item-edit-mutations.ts
index 0726d309deb..5e816631bb4 100644
--- a/src/renderer/src/components/github/github-work-item-edit-mutations.ts
+++ b/src/renderer/src/components/github/github-work-item-edit-mutations.ts
@@ -1,6 +1,6 @@
import { useAppStore } from '@/store'
import { callRuntimeRpc } from '@/runtime/runtime-rpc-client'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import {
getGitHubRepoRoutingTarget,
getGitHubRuntimeRepoId,
diff --git a/src/renderer/src/components/gitlab/gitlab-rate-limit-display.tsx b/src/renderer/src/components/gitlab/gitlab-rate-limit-display.tsx
index 41cf6eb0712..cb6b9c4edad 100644
--- a/src/renderer/src/components/gitlab/gitlab-rate-limit-display.tsx
+++ b/src/renderer/src/components/gitlab/gitlab-rate-limit-display.tsx
@@ -4,7 +4,7 @@ import { Button } from '@/components/ui/button'
import { cn } from '@/lib/utils'
import { installWindowVisibilityInterval } from '@/lib/window-visibility-interval'
import { callRuntimeRpc } from '@/runtime/runtime-rpc-client'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import type {
GetGitLabRateLimitResult,
GitLabRateLimitSnapshot
diff --git a/src/renderer/src/components/native-chat/NativeChatAgentMessageSenders.tsx b/src/renderer/src/components/native-chat/NativeChatAgentMessageSenders.tsx
index 7dfc3973d98..68b86d117f8 100644
--- a/src/renderer/src/components/native-chat/NativeChatAgentMessageSenders.tsx
+++ b/src/renderer/src/components/native-chat/NativeChatAgentMessageSenders.tsx
@@ -2,7 +2,7 @@ import { Fragment } from 'react'
import { Button } from '@/components/ui/button'
import { translate } from '@/i18n/i18n'
import { openAgentMessageSender } from '@/lib/open-agent-message-sender'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { useNativeChatVisualOwner } from './native-chat-visual-owner'
import {
agentMessageSendersShown,
diff --git a/src/renderer/src/components/native-chat/NativeChatInterruptedContinue.test.tsx b/src/renderer/src/components/native-chat/NativeChatInterruptedContinue.test.tsx
index 126e3f7da04..854c3b5d308 100644
--- a/src/renderer/src/components/native-chat/NativeChatInterruptedContinue.test.tsx
+++ b/src/renderer/src/components/native-chat/NativeChatInterruptedContinue.test.tsx
@@ -40,7 +40,7 @@ import type {
AgentJournalRenderItem,
AgentJournalSubmission
} from '../../../../shared/agent-session-journal-types'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import {
NativeChatInterruptedContinueButton,
useNativeChatInterruptedContinuation
diff --git a/src/renderer/src/components/native-chat/NativeChatInterruptedContinue.tsx b/src/renderer/src/components/native-chat/NativeChatInterruptedContinue.tsx
index bd37b1e0670..80ea26fde68 100644
--- a/src/renderer/src/components/native-chat/NativeChatInterruptedContinue.tsx
+++ b/src/renderer/src/components/native-chat/NativeChatInterruptedContinue.tsx
@@ -5,7 +5,7 @@ import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip
import { translate } from '@/i18n/i18n'
import { callStructuredAgentSession } from '@/runtime/structured-agent-session-client'
import { useStructuredAgentSessionHostCapabilityState } from '@/runtime/structured-agent-session-host-capability'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import type {
AgentJournalRenderItem,
AgentJournalSubmission
diff --git a/src/renderer/src/components/native-chat/StructuredAgentSessionAttentionBridge.tsx b/src/renderer/src/components/native-chat/StructuredAgentSessionAttentionBridge.tsx
index 7d1211a1e0e..847256473bb 100644
--- a/src/renderer/src/components/native-chat/StructuredAgentSessionAttentionBridge.tsx
+++ b/src/renderer/src/components/native-chat/StructuredAgentSessionAttentionBridge.tsx
@@ -9,7 +9,7 @@ import {
import { findStructuredAgentSessionReadOwner } from './structured-agent-session-read-owner'
import { structuredAttentionReadObservation } from './structured-attention-read-observation'
import { useAppStore } from '@/store'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import {
structuredAgentSessionOwnerForTab,
structuredAgentSessionTargetForHost
diff --git a/src/renderer/src/components/native-chat/StructuredAgentSessionPaneOverlayLayer.test.tsx b/src/renderer/src/components/native-chat/StructuredAgentSessionPaneOverlayLayer.test.tsx
index 19b4bb24a3a..a95dfee553a 100644
--- a/src/renderer/src/components/native-chat/StructuredAgentSessionPaneOverlayLayer.test.tsx
+++ b/src/renderer/src/components/native-chat/StructuredAgentSessionPaneOverlayLayer.test.tsx
@@ -39,8 +39,6 @@ vi.mock('@/lib/worktree-runtime-owner', () => ({
state.runtimeEnvironmentId ? `runtime:${state.runtimeEnvironmentId}` : 'local'
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({}))
-
vi.mock('./NativeChatView', async () => {
const { useEffect } = await import('react')
return {
diff --git a/src/renderer/src/components/native-chat/StructuredAgentSessionStatusBridge.tsx b/src/renderer/src/components/native-chat/StructuredAgentSessionStatusBridge.tsx
index 56e93c60e60..c4290d70c17 100644
--- a/src/renderer/src/components/native-chat/StructuredAgentSessionStatusBridge.tsx
+++ b/src/renderer/src/components/native-chat/StructuredAgentSessionStatusBridge.tsx
@@ -32,7 +32,7 @@ import { agentMainAgentVerdict } from '../../../../shared/agent-main-agent-verdi
import { useStructuredAgentSessionLaunchLifecycle } from '@/lib/structured-agent-session-launch-registry'
import { useStructuredAgentSessionLaunchFailedAt } from '@/lib/structured-agent-session-launch-failed-at'
import { useAppStore } from '@/store'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import {
structuredAgentSessionOwnerForTab,
structuredAgentSessionTargetForHost
diff --git a/src/renderer/src/components/native-chat/native-chat-agent-message-sender-host.test.tsx b/src/renderer/src/components/native-chat/native-chat-agent-message-sender-host.test.tsx
index f91e5b594b3..e9ad1d40456 100644
--- a/src/renderer/src/components/native-chat/native-chat-agent-message-sender-host.test.tsx
+++ b/src/renderer/src/components/native-chat/native-chat-agent-message-sender-host.test.tsx
@@ -9,7 +9,7 @@ import type { AgentSessionStatusEvent } from '../../../../shared/agent-session-w
import type { AgentMessageSource } from '../../../../shared/agent-session-message-source'
import { testOrcaSessionId } from '../../../../shared/orca-session-address-test-fixture'
import type { Tab } from '../../../../shared/tab-types'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import {
AGENT_SESSION_STATUS_FEED_RUNTIME_CAPABILITY,
MIN_COMPATIBLE_RUNTIME_CLIENT_VERSION,
diff --git a/src/renderer/src/components/native-chat/native-chat-agent-message-sender-label.ts b/src/renderer/src/components/native-chat/native-chat-agent-message-sender-label.ts
index 9c0032a7190..14559acef25 100644
--- a/src/renderer/src/components/native-chat/native-chat-agent-message-sender-label.ts
+++ b/src/renderer/src/components/native-chat/native-chat-agent-message-sender-label.ts
@@ -8,7 +8,7 @@ import {
resolveStructuredAgentSessionOwner,
executionHostIdForStructuredTarget
} from '@/runtime/structured-agent-session-owner'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import type { AgentMessageSender } from '../../../../shared/agent-session-message-source'
import type { Tab } from '../../../../shared/tab-types'
import { getKnownExecutionHostIdForWorktree } from '@/lib/worktree-runtime-owner'
diff --git a/src/renderer/src/components/native-chat/native-chat-claude-sign-in.ts b/src/renderer/src/components/native-chat/native-chat-claude-sign-in.ts
index 64fbc7aa3b4..28c0da23ad5 100644
--- a/src/renderer/src/components/native-chat/native-chat-claude-sign-in.ts
+++ b/src/renderer/src/components/native-chat/native-chat-claude-sign-in.ts
@@ -2,7 +2,7 @@ import { createContext, useCallback, useContext, useMemo, useRef, useState } fro
import { translate } from '@/i18n/i18n'
import { useAppStore } from '@/store'
import { signInToClaudeAccount } from '@/lib/claude-account-sign-in'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
/** The chat failures a sign-in to the selected Claude account fixes. */
const SIGN_IN_FAILURE_KINDS: ReadonlySet = new Set([
diff --git a/src/renderer/src/components/native-chat/native-chat-image-runtime-context.ts b/src/renderer/src/components/native-chat/native-chat-image-runtime-context.ts
index 27fad000546..c7d17b6c7f8 100644
--- a/src/renderer/src/components/native-chat/native-chat-image-runtime-context.ts
+++ b/src/renderer/src/components/native-chat/native-chat-image-runtime-context.ts
@@ -1,10 +1,8 @@
import { useAppStore } from '@/store'
import type { AppState } from '@/store/types'
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
-import {
- runtimeTargetForOwnerEnvironment,
- type RuntimeClientTarget
-} from '@/runtime/runtime-client-target'
+import { runtimeTargetForOwnerEnvironment } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import {
resolveWorktreeOperationRouteResult,
type WorktreeOperationRouteResolution
diff --git a/src/renderer/src/components/native-chat/native-chat-retire-persisted-model.test.ts b/src/renderer/src/components/native-chat/native-chat-retire-persisted-model.test.ts
index 4ba320a2f42..1f440248274 100644
--- a/src/renderer/src/components/native-chat/native-chat-retire-persisted-model.test.ts
+++ b/src/renderer/src/components/native-chat/native-chat-retire-persisted-model.test.ts
@@ -20,9 +20,7 @@ vi.mock('../../store', () => ({
selector({ agentStatusByPaneKey: {} })
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: mocks.callRuntimeRpc
-}))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: mocks.callRuntimeRpc }))
vi.mock('./native-chat-pty-session-options', () => ({
createNativeChatPtySessionOptions: mocks.createNativeChatPtySessionOptions
diff --git a/src/renderer/src/components/native-chat/native-chat-runtime-owner.ts b/src/renderer/src/components/native-chat/native-chat-runtime-owner.ts
index a85739ae36c..2d8cd668731 100644
--- a/src/renderer/src/components/native-chat/native-chat-runtime-owner.ts
+++ b/src/renderer/src/components/native-chat/native-chat-runtime-owner.ts
@@ -1,7 +1,5 @@
-import {
- getRuntimeEnvironmentIdForWorktree,
- type WorktreeRuntimeOwnerState
-} from '@/lib/worktree-runtime-owner'
+import { getRuntimeEnvironmentIdForWorktree } from '@/lib/worktree-runtime-owner'
+import type { WorktreeRuntimeOwnerState } from '@/lib/worktree-runtime-owner-state'
import type { AppState } from '@/store/types'
import {
createNativeChatTabOwnerSelector,
diff --git a/src/renderer/src/components/native-chat/native-chat-session-option-settings-write.ts b/src/renderer/src/components/native-chat/native-chat-session-option-settings-write.ts
index fa4fb3d14a9..9ec482508c8 100644
--- a/src/renderer/src/components/native-chat/native-chat-session-option-settings-write.ts
+++ b/src/renderer/src/components/native-chat/native-chat-session-option-settings-write.ts
@@ -1,5 +1,6 @@
import type { NativeChatSessionOptionSettingsMutation } from '../../../../shared/native-chat-session-options'
-import { callRuntimeRpc, type RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import { callRuntimeRpc } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
/**
* The executing runtime applies deltas to its latest record. This keeps paired-runtime
diff --git a/src/renderer/src/components/native-chat/native-chat-session-transport.test.ts b/src/renderer/src/components/native-chat/native-chat-session-transport.test.ts
index 1627f5e3e35..aa624c53abd 100644
--- a/src/renderer/src/components/native-chat/native-chat-session-transport.test.ts
+++ b/src/renderer/src/components/native-chat/native-chat-session-transport.test.ts
@@ -2,9 +2,9 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'
import type { NativeChatMessage } from '../../../../shared/native-chat-types'
import {
clearRuntimeCompatibilityCacheForTests,
- markRuntimeEnvironmentCompatible,
- RuntimeRpcCallError
+ markRuntimeEnvironmentCompatible
} from '@/runtime/runtime-rpc-client'
+import { RuntimeRpcCallError } from '@/runtime/runtime-rpc-result'
import { RUNTIME_COMPAT_BLOCK_CODE } from '@/runtime/runtime-protocol-compat'
import {
getNativeChatSessionTransport,
diff --git a/src/renderer/src/components/native-chat/native-chat-session-transport.ts b/src/renderer/src/components/native-chat/native-chat-session-transport.ts
index 112e7cdc3e0..645afa8affb 100644
--- a/src/renderer/src/components/native-chat/native-chat-session-transport.ts
+++ b/src/renderer/src/components/native-chat/native-chat-session-transport.ts
@@ -1,10 +1,8 @@
import type { NativeChatApi, NativeChatAppendedMessages } from '../../../../preload/api-types'
import { isWebClientLocation } from '@/lib/web-client-location'
-import {
- callRuntimeRpc,
- RuntimeRpcCallError,
- type RuntimeClientTarget
-} from '@/runtime/runtime-rpc-client'
+import { callRuntimeRpc } from '@/runtime/runtime-rpc-client'
+import { RuntimeRpcCallError } from '@/runtime/runtime-rpc-result'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { isRuntimeCompatBlockError } from '@/runtime/runtime-protocol-compat'
import {
parseRuntimeNativeChatReadSessionResult,
diff --git a/src/renderer/src/components/native-chat/native-chat-skill-discovery-context.ts b/src/renderer/src/components/native-chat/native-chat-skill-discovery-context.ts
index fc1e47ee3c1..45fc152a4dd 100644
--- a/src/renderer/src/components/native-chat/native-chat-skill-discovery-context.ts
+++ b/src/renderer/src/components/native-chat/native-chat-skill-discovery-context.ts
@@ -1,7 +1,7 @@
import type { AppState } from '../../store/types'
import type { SkillDiscoveryTarget } from '../../../../shared/skills'
import { parseExecutionHostId } from '../../../../shared/execution-host'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import {
getExplicitRuntimeEnvironmentIdForWorktree,
getExecutionHostIdForWorktree
diff --git a/src/renderer/src/components/native-chat/native-chat-view-types.ts b/src/renderer/src/components/native-chat/native-chat-view-types.ts
index 81063ac59b9..4e1d66581fb 100644
--- a/src/renderer/src/components/native-chat/native-chat-view-types.ts
+++ b/src/renderer/src/components/native-chat/native-chat-view-types.ts
@@ -1,6 +1,6 @@
import type { AgentType } from '../../../../shared/agent-status-types'
import type { TuiAgent } from '../../../../shared/tui-agent'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import type { NativeChatSession } from '../../../../shared/native-chat-types'
import type { NativeChatContextMenuActions } from './use-native-chat-context-menu'
diff --git a/src/renderer/src/components/native-chat/native-chat-visual-owner.tsx b/src/renderer/src/components/native-chat/native-chat-visual-owner.tsx
index ed8ee927d64..d8a99778e28 100644
--- a/src/renderer/src/components/native-chat/native-chat-visual-owner.tsx
+++ b/src/renderer/src/components/native-chat/native-chat-visual-owner.tsx
@@ -1,5 +1,5 @@
import { createContext, useContext, useMemo, type ReactNode } from 'react'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { useNativeChatTabOwnerWorktreeId } from './use-native-chat-tab-owner'
/** The structured chat a transcript belongs to: where its visuals are read and what owns them. */
diff --git a/src/renderer/src/components/native-chat/native-chat-visual-read-client.ts b/src/renderer/src/components/native-chat/native-chat-visual-read-client.ts
index ea526211297..9d78ec3d9e9 100644
--- a/src/renderer/src/components/native-chat/native-chat-visual-read-client.ts
+++ b/src/renderer/src/components/native-chat/native-chat-visual-read-client.ts
@@ -5,7 +5,7 @@
// cached; the next mount or retry asks again.
import { callRuntimeRpc } from '@/runtime/runtime-rpc-client'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import {
AGENT_SESSION_VISUAL_READ_ERRORS,
type AgentSessionReadVisualResult,
diff --git a/src/renderer/src/components/native-chat/structured-agent-session-legacy-outbox.ts b/src/renderer/src/components/native-chat/structured-agent-session-legacy-outbox.ts
index 79b626f0570..1c9795af1e4 100644
--- a/src/renderer/src/components/native-chat/structured-agent-session-legacy-outbox.ts
+++ b/src/renderer/src/components/native-chat/structured-agent-session-legacy-outbox.ts
@@ -11,7 +11,7 @@ import type {
} from '../../../../shared/agent-session-journal-types'
import type { AgentSessionWriteNoticePart } from '../../../../shared/agent-session-write-notice-copy'
import { agentSessionWriteNotDoneParts } from '../../../../shared/agent-session-refusal-notice'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { readStructuredAgentSessionConversationOutline } from '@/runtime/structured-agent-session-client'
import { agentSessionWriteNoticeText } from './agent-session-write-notice-text'
import { handBackStructuredAgentSessionMessage } from './structured-agent-session-message-hand-back'
diff --git a/src/renderer/src/components/native-chat/structured-agent-session-message-sender.ts b/src/renderer/src/components/native-chat/structured-agent-session-message-sender.ts
index b554778544e..ee2e478141d 100644
--- a/src/renderer/src/components/native-chat/structured-agent-session-message-sender.ts
+++ b/src/renderer/src/components/native-chat/structured-agent-session-message-sender.ts
@@ -15,7 +15,7 @@ import {
agentSessionWriteNotDoneParts
} from '../../../../shared/agent-session-refusal-notice'
import type { AgentSessionWriteFailure } from '../../../../shared/agent-session-write-failure'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import {
attemptStructuredAgentSessionSend,
forgetStructuredAgentSessionFence,
diff --git a/src/renderer/src/components/native-chat/structured-agent-session-older-page-read.ts b/src/renderer/src/components/native-chat/structured-agent-session-older-page-read.ts
index 57303498bcd..eb5bb8841d5 100644
--- a/src/renderer/src/components/native-chat/structured-agent-session-older-page-read.ts
+++ b/src/renderer/src/components/native-chat/structured-agent-session-older-page-read.ts
@@ -7,7 +7,7 @@ import {
type StructuredAgentSessionAction,
type StructuredAgentSessionState
} from '../../../../shared/structured-agent-session-reducer'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { callStructuredAgentSession } from '@/runtime/structured-agent-session-client'
import type { NativeChatOlderPageResult } from './native-chat-pagination'
diff --git a/src/renderer/src/components/native-chat/structured-agent-session-prompt-response.ts b/src/renderer/src/components/native-chat/structured-agent-session-prompt-response.ts
index 1a6d849bf18..3293f904440 100644
--- a/src/renderer/src/components/native-chat/structured-agent-session-prompt-response.ts
+++ b/src/renderer/src/components/native-chat/structured-agent-session-prompt-response.ts
@@ -1,4 +1,4 @@
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { supportsStructuredAgentSessionQuestionAnswers } from '@/runtime/structured-agent-session-client'
import {
legacyAgentSessionSelectedOptionId,
diff --git a/src/renderer/src/components/native-chat/structured-agent-session-queued-edit-lease.ts b/src/renderer/src/components/native-chat/structured-agent-session-queued-edit-lease.ts
index 2fa00e5d07e..4e7971b4ea2 100644
--- a/src/renderer/src/components/native-chat/structured-agent-session-queued-edit-lease.ts
+++ b/src/renderer/src/components/native-chat/structured-agent-session-queued-edit-lease.ts
@@ -3,7 +3,7 @@
// that fails is only logged; nothing here ever blocks typing, Save or Cancel.
import { callStructuredAgentSession } from '@/runtime/structured-agent-session-client'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import type {
AgentSessionQueuedMessageEditHoldParams,
AgentSessionQueuedMessageEditHoldResult
diff --git a/src/renderer/src/components/native-chat/structured-agent-session-read-owner-registry.ts b/src/renderer/src/components/native-chat/structured-agent-session-read-owner-registry.ts
index 00d93bdd8f8..f401dc27408 100644
--- a/src/renderer/src/components/native-chat/structured-agent-session-read-owner-registry.ts
+++ b/src/renderer/src/components/native-chat/structured-agent-session-read-owner-registry.ts
@@ -1,4 +1,4 @@
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import type { StructuredAgentSessionReadOwner } from './structured-agent-session-read-owner'
const owners = new Map()
diff --git a/src/renderer/src/components/native-chat/structured-agent-session-read-owner.ts b/src/renderer/src/components/native-chat/structured-agent-session-read-owner.ts
index ac45d2c0cbf..cafdfc8f5fe 100644
--- a/src/renderer/src/components/native-chat/structured-agent-session-read-owner.ts
+++ b/src/renderer/src/components/native-chat/structured-agent-session-read-owner.ts
@@ -13,7 +13,7 @@ import {
type StructuredAgentSessionAction,
type StructuredAgentSessionState
} from '../../../../shared/structured-agent-session-reducer'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { callStructuredAgentSession } from '@/runtime/structured-agent-session-client'
import { NATIVE_CHAT_INITIAL_LIMIT, type NativeChatOlderPageResult } from './native-chat-pagination'
import {
diff --git a/src/renderer/src/components/native-chat/structured-agent-session-read-transport.ts b/src/renderer/src/components/native-chat/structured-agent-session-read-transport.ts
index 683fbd2cf83..db659ffce2f 100644
--- a/src/renderer/src/components/native-chat/structured-agent-session-read-transport.ts
+++ b/src/renderer/src/components/native-chat/structured-agent-session-read-transport.ts
@@ -9,7 +9,7 @@ import {
import type { AgentSessionRefusalReference } from '../../../../shared/agent-session-wire-refusals'
import { readAgentSessionErrorRefusal } from '../../../../shared/agent-session-write-failure'
import { subscribeRuntimeHostContactRegained } from '@/runtime/runtime-host-contact-regained'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { subscribeStructuredAgentSession } from '@/runtime/structured-agent-session-client'
// A stream hands its failure over as the raw `{ code, message }` payload; `String()` of that is `[object Object]`.
diff --git a/src/renderer/src/components/native-chat/structured-agent-session-send-attempt.ts b/src/renderer/src/components/native-chat/structured-agent-session-send-attempt.ts
index 1a74b96786e..076ce047444 100644
--- a/src/renderer/src/components/native-chat/structured-agent-session-send-attempt.ts
+++ b/src/renderer/src/components/native-chat/structured-agent-session-send-attempt.ts
@@ -18,10 +18,8 @@ import {
type StructuredAgentSessionSendAnswer,
type StructuredAgentSessionSendEvidence
} from '../../../../shared/structured-agent-session-send-evidence'
-import {
- ensureRuntimeEnvironmentCompatible,
- type RuntimeClientTarget
-} from '@/runtime/runtime-rpc-client'
+import { ensureRuntimeEnvironmentCompatible } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { RuntimeRpcCallError } from '@/runtime/runtime-rpc-result'
import { isRuntimeCompatBlockError } from '@/runtime/runtime-protocol-compat'
import {
diff --git a/src/renderer/src/components/native-chat/structured-agent-session-send-runtime.ts b/src/renderer/src/components/native-chat/structured-agent-session-send-runtime.ts
index fe8cfafa58c..0684572b684 100644
--- a/src/renderer/src/components/native-chat/structured-agent-session-send-runtime.ts
+++ b/src/renderer/src/components/native-chat/structured-agent-session-send-runtime.ts
@@ -6,7 +6,7 @@ import {
import type { AgentSessionWriteNoticePart } from '../../../../shared/agent-session-write-notice-copy'
import type { AgentSessionWriteFailure } from '../../../../shared/agent-session-write-failure'
import { dispatchWasWithdrawn } from '../../../../shared/structured-agent-session-dispatch-rejection'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { agentSessionWriteNoticeText } from './agent-session-write-notice-text'
import { nativeChatRewindReasonCopy } from './native-chat-rewind-copy'
import { handBackStructuredAgentSessionMessage } from './structured-agent-session-message-hand-back'
diff --git a/src/renderer/src/components/native-chat/structured-attention-dispatch.ts b/src/renderer/src/components/native-chat/structured-attention-dispatch.ts
index 23a106d1587..4ccc39fba68 100644
--- a/src/renderer/src/components/native-chat/structured-attention-dispatch.ts
+++ b/src/renderer/src/components/native-chat/structured-attention-dispatch.ts
@@ -26,7 +26,7 @@
* later. Unread and delivery otherwise share the existing `resolveAgentAttention` decision.
*/
import { notificationSourceForOwner } from '../../../../shared/notification-source'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { resolveNotificationTabOwner } from '@/attention/notification-subject-owner'
import type {
AgentSessionPromptAttention,
diff --git a/src/renderer/src/components/native-chat/use-host-model-catalog-upgrade.ts b/src/renderer/src/components/native-chat/use-host-model-catalog-upgrade.ts
index b2305ec7eca..416bdbce0f9 100644
--- a/src/renderer/src/components/native-chat/use-host-model-catalog-upgrade.ts
+++ b/src/renderer/src/components/native-chat/use-host-model-catalog-upgrade.ts
@@ -11,7 +11,7 @@ import {
settleStructuredAgentSessionBuiltinCatalog,
type StructuredAgentSessionOptionState
} from '../../../../shared/structured-agent-session-options'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { callStructuredAgentSession } from '@/runtime/structured-agent-session-client'
import { recordHostModelCatalogSnapshot } from '@/runtime/host-model-catalog-snapshots'
import { structuredAgentSessionHostKey } from '@/runtime/structured-agent-session-host-capability'
diff --git a/src/renderer/src/components/native-chat/use-native-chat-host-outage.test.tsx b/src/renderer/src/components/native-chat/use-native-chat-host-outage.test.tsx
index 3659c640bdc..9fb6bd0e72f 100644
--- a/src/renderer/src/components/native-chat/use-native-chat-host-outage.test.tsx
+++ b/src/renderer/src/components/native-chat/use-native-chat-host-outage.test.tsx
@@ -9,7 +9,7 @@ import type {
RuntimeHostStatusSnapshot
} from '../../../../shared/runtime-host-status'
import type { RuntimeStatus } from '../../../../shared/runtime-types'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import {
NATIVE_CHAT_HOST_RECONNECTING_GRACE_MS,
useNativeChatHostOutage
diff --git a/src/renderer/src/components/native-chat/use-native-chat-host-outage.ts b/src/renderer/src/components/native-chat/use-native-chat-host-outage.ts
index 3ee18d5fa93..899ba1e4fea 100644
--- a/src/renderer/src/components/native-chat/use-native-chat-host-outage.ts
+++ b/src/renderer/src/components/native-chat/use-native-chat-host-outage.ts
@@ -7,7 +7,7 @@ import {
runtimeHostConnectionStateForEntry,
type RuntimeHostConnectionState
} from '@/runtime/runtime-host-connection-state'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
export type NativeChatHostOutageKind = 'reconnecting' | 'offline'
diff --git a/src/renderer/src/components/native-chat/use-native-chat-rewind-host.ts b/src/renderer/src/components/native-chat/use-native-chat-rewind-host.ts
index 9a1fe3bf0a6..fa16461f46a 100644
--- a/src/renderer/src/components/native-chat/use-native-chat-rewind-host.ts
+++ b/src/renderer/src/components/native-chat/use-native-chat-rewind-host.ts
@@ -1,5 +1,5 @@
import { useCallback, type RefObject } from 'react'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { useStructuredAgentSessionRewindBlockedReason } from './StructuredAgentSessionStatusBridge'
import type { NativeChatComposerHandle } from './NativeChatComposer'
import type { NativeChatRewindHost } from './use-native-chat-rewind'
diff --git a/src/renderer/src/components/native-chat/use-structured-agent-session-hold.ts b/src/renderer/src/components/native-chat/use-structured-agent-session-hold.ts
index f484f500a56..96fb0fd814d 100644
--- a/src/renderer/src/components/native-chat/use-structured-agent-session-hold.ts
+++ b/src/renderer/src/components/native-chat/use-structured-agent-session-hold.ts
@@ -14,7 +14,7 @@
import { useEffect, useRef } from 'react'
import { structuredAgentSessionHolderId } from '../../../../shared/structured-agent-session-holder'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { callStructuredAgentSession } from '@/runtime/structured-agent-session-client'
export function useStructuredAgentSessionHold(args: {
diff --git a/src/renderer/src/components/native-chat/use-structured-agent-session-host-label.ts b/src/renderer/src/components/native-chat/use-structured-agent-session-host-label.ts
index 39e540d50df..8a10c589a39 100644
--- a/src/renderer/src/components/native-chat/use-structured-agent-session-host-label.ts
+++ b/src/renderer/src/components/native-chat/use-structured-agent-session-host-label.ts
@@ -1,6 +1,6 @@
import { selectExecutionHostDisplayLabel } from '@/lib/execution-host-display-label'
import { executionHostIdForStructuredTarget } from '@/runtime/structured-agent-session-owner'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { useAppStore } from '../../store'
/** What Orca calls the chat's host; null for a paired server this client has no name for, whose
diff --git a/src/renderer/src/components/native-chat/use-structured-agent-session-mutate.ts b/src/renderer/src/components/native-chat/use-structured-agent-session-mutate.ts
index bfccacad093..dc4e7722b3f 100644
--- a/src/renderer/src/components/native-chat/use-structured-agent-session-mutate.ts
+++ b/src/renderer/src/components/native-chat/use-structured-agent-session-mutate.ts
@@ -19,7 +19,7 @@ import {
} from '../../../../shared/agent-session-write-failure'
import { structuredAgentSessionPayloadFingerprint } from '../../../../shared/structured-agent-session-mutation'
import { structuredSessionOperationId } from './structured-agent-session-operation-id'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { RuntimeRpcCallError } from '@/runtime/runtime-rpc-result'
import {
callStructuredAgentSession,
diff --git a/src/renderer/src/components/native-chat/use-structured-agent-session-option-state.ts b/src/renderer/src/components/native-chat/use-structured-agent-session-option-state.ts
index f0ba077a3c6..0ef2f039727 100644
--- a/src/renderer/src/components/native-chat/use-structured-agent-session-option-state.ts
+++ b/src/renderer/src/components/native-chat/use-structured-agent-session-option-state.ts
@@ -11,7 +11,7 @@ import {
createStructuredAgentSessionOptionState,
type StructuredAgentSessionOptionState
} from '../../../../shared/structured-agent-session-options'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { callStructuredAgentSession } from '@/runtime/structured-agent-session-client'
import { readHostModelCatalogSnapshot } from '@/runtime/host-model-catalog-snapshots'
import {
diff --git a/src/renderer/src/components/native-chat/use-structured-agent-session-options.first-frame.test.tsx b/src/renderer/src/components/native-chat/use-structured-agent-session-options.first-frame.test.tsx
index 7c7db057029..41f5dacd44a 100644
--- a/src/renderer/src/components/native-chat/use-structured-agent-session-options.first-frame.test.tsx
+++ b/src/renderer/src/components/native-chat/use-structured-agent-session-options.first-frame.test.tsx
@@ -20,7 +20,7 @@ vi.mock('@/lib/structured-agent-session-launch-options', () => ({
import type { AgentType } from '../../../../shared/agent-status-types'
import type { AgentSessionModelCatalogResult } from '../../../../shared/agent-session-wire'
import type { SessionOptionDescriptor } from '../../../../shared/native-chat-session-options'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import {
preloadHostModelCatalogSnapshots,
resetHostModelCatalogSnapshotsForTests
diff --git a/src/renderer/src/components/native-chat/use-structured-agent-session-options.ts b/src/renderer/src/components/native-chat/use-structured-agent-session-options.ts
index 58006138e97..d86825b7c90 100644
--- a/src/renderer/src/components/native-chat/use-structured-agent-session-options.ts
+++ b/src/renderer/src/components/native-chat/use-structured-agent-session-options.ts
@@ -17,7 +17,7 @@ import {
type StructuredAgentSessionOptionState
} from '../../../../shared/structured-agent-session-options'
import { structuredAgentSessionOptionView } from '../../../../shared/structured-agent-session-option-view'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { callStructuredAgentSession } from '@/runtime/structured-agent-session-client'
import { enqueueSessionOptionSettingsWrite } from './native-chat-session-option-settings-write'
import { encodeStructuredAgentSessionOptionValue } from '../../../../shared/structured-agent-session-option-codec'
diff --git a/src/renderer/src/components/native-chat/use-structured-agent-session-paired-runtime.test.tsx b/src/renderer/src/components/native-chat/use-structured-agent-session-paired-runtime.test.tsx
index d9ea6637bbc..d5c45895abd 100644
--- a/src/renderer/src/components/native-chat/use-structured-agent-session-paired-runtime.test.tsx
+++ b/src/renderer/src/components/native-chat/use-structured-agent-session-paired-runtime.test.tsx
@@ -38,7 +38,7 @@ import {
RUNTIME_CAPABILITIES
} from '../../../../shared/protocol-version'
import { setLocalRuntimeCapabilitiesForTests } from '@/runtime/local-runtime-capabilities'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { resetStructuredAgentSessionReadOwnersForTests } from './structured-agent-session-read-owner'
import {
useStructuredAgentSession,
diff --git a/src/renderer/src/components/native-chat/use-structured-agent-session-queued-edit.ts b/src/renderer/src/components/native-chat/use-structured-agent-session-queued-edit.ts
index 08181e3c459..79fec4cd94d 100644
--- a/src/renderer/src/components/native-chat/use-structured-agent-session-queued-edit.ts
+++ b/src/renderer/src/components/native-chat/use-structured-agent-session-queued-edit.ts
@@ -4,7 +4,7 @@
import { useCallback, useEffect, useRef, useState } from 'react'
import { toast } from 'sonner'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { structuredAgentSessionHostKey } from '@/runtime/structured-agent-session-host-capability'
import type {
AgentSessionQueuedMessage,
diff --git a/src/renderer/src/components/native-chat/use-structured-agent-session-rail-outline.ts b/src/renderer/src/components/native-chat/use-structured-agent-session-rail-outline.ts
index d8120736c54..e45c9a01129 100644
--- a/src/renderer/src/components/native-chat/use-structured-agent-session-rail-outline.ts
+++ b/src/renderer/src/components/native-chat/use-structured-agent-session-rail-outline.ts
@@ -11,7 +11,7 @@
import { useEffect, useState } from 'react'
import type { AgentSessionConversationOutline } from '../../../../shared/agent-session-conversation-outline'
import type { StructuredAgentSessionState } from '../../../../shared/structured-agent-session-reducer'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { readStructuredAgentSessionConversationOutline } from '@/runtime/structured-agent-session-client'
import type { NativeChatRailOutlineEntry } from './native-chat-message-rail-items'
import { selectStructuredRailOutline } from './structured-agent-session-rail-outline'
diff --git a/src/renderer/src/components/native-chat/use-structured-agent-session-read.ts b/src/renderer/src/components/native-chat/use-structured-agent-session-read.ts
index b57268f1848..d32cea85101 100644
--- a/src/renderer/src/components/native-chat/use-structured-agent-session-read.ts
+++ b/src/renderer/src/components/native-chat/use-structured-agent-session-read.ts
@@ -1,7 +1,7 @@
import { useEffect, useMemo, useRef, useSyncExternalStore } from 'react'
import { notifyStructuredAttentionView } from '@/attention/agent-subject-read-actions'
import { structuredAttentionReadObservation } from './structured-attention-read-observation'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import {
getStructuredAgentSessionReadOwner,
type StructuredAgentSessionReadSnapshot
diff --git a/src/renderer/src/components/native-chat/use-structured-agent-session-rewind.ts b/src/renderer/src/components/native-chat/use-structured-agent-session-rewind.ts
index 9f86b1e0b12..9369c57f86f 100644
--- a/src/renderer/src/components/native-chat/use-structured-agent-session-rewind.ts
+++ b/src/renderer/src/components/native-chat/use-structured-agent-session-rewind.ts
@@ -1,6 +1,6 @@
import { useMemo } from 'react'
import type { AgentSessionRewindResult } from '../../../../shared/agent-session-rewind'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { useStructuredAgentSessionHostRecoversRewindOnSend } from '@/runtime/structured-agent-session-host-capability'
import type { StructuredAgentSessionWrite } from './use-structured-agent-session-mutate'
import {
diff --git a/src/renderer/src/components/native-chat/use-structured-agent-session-sends.ts b/src/renderer/src/components/native-chat/use-structured-agent-session-sends.ts
index 04f72d1224b..911b4bff408 100644
--- a/src/renderer/src/components/native-chat/use-structured-agent-session-sends.ts
+++ b/src/renderer/src/components/native-chat/use-structured-agent-session-sends.ts
@@ -1,7 +1,7 @@
import { useCallback, useEffect, useSyncExternalStore } from 'react'
import type { AgentJournalSubmission } from '../../../../shared/agent-session-journal-types'
import type { StructuredAgentSessionAttachment } from '../../../../shared/structured-agent-session-send-mutation'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import {
structuredAgentSessionQueueRequest,
type StructuredAgentSessionQueueDelivery
diff --git a/src/renderer/src/components/native-chat/use-structured-agent-session-stop.ts b/src/renderer/src/components/native-chat/use-structured-agent-session-stop.ts
index f74e247d88a..55b04fdd27a 100644
--- a/src/renderer/src/components/native-chat/use-structured-agent-session-stop.ts
+++ b/src/renderer/src/components/native-chat/use-structured-agent-session-stop.ts
@@ -1,4 +1,4 @@
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { useStructuredAgentSessionHostStopsConversation } from '@/runtime/structured-agent-session-host-capability'
import { agentStopDisplayStatus } from '../../../../shared/agent-stop-display-status'
import type { StructuredAgentSessionMutate } from './use-structured-agent-session-mutate'
diff --git a/src/renderer/src/components/native-chat/use-structured-agent-session-transport.ts b/src/renderer/src/components/native-chat/use-structured-agent-session-transport.ts
index 47ca68a5db7..109760de4e7 100644
--- a/src/renderer/src/components/native-chat/use-structured-agent-session-transport.ts
+++ b/src/renderer/src/components/native-chat/use-structured-agent-session-transport.ts
@@ -1,5 +1,5 @@
import { useEffect, useRef } from 'react'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { useStructuredAgentSessionHold } from './use-structured-agent-session-hold'
import { useStructuredAgentSessionMutate } from './use-structured-agent-session-mutate'
import { useStructuredAgentSessionRead } from './use-structured-agent-session-read'
diff --git a/src/renderer/src/components/native-chat/use-structured-agent-session.ts b/src/renderer/src/components/native-chat/use-structured-agent-session.ts
index 608bf683791..b471167ca5f 100644
--- a/src/renderer/src/components/native-chat/use-structured-agent-session.ts
+++ b/src/renderer/src/components/native-chat/use-structured-agent-session.ts
@@ -4,7 +4,7 @@ import { useStructuredAgentSessionCommandWrite } from './use-structured-agent-se
import { structuredAgentSessionNewSendsQueue } from './structured-agent-session-queue-request'
import type { AgentType } from '../../../../shared/agent-status-types'
import type { AgentSessionCancelResult } from '../../../../shared/agent-session-wire'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { structuredAgentLabel } from '@/lib/structured-agent-session-launch-label'
import { useStructuredLegacyLaunchStop } from '@/lib/structured-agent-session-legacy-launch-stop'
import { supportsStructuredAgentSessionPromptCancel } from '@/runtime/structured-agent-session-client'
diff --git a/src/renderer/src/components/native-chat/use-structured-native-chat-pane-commands.ts b/src/renderer/src/components/native-chat/use-structured-native-chat-pane-commands.ts
index 06bc0d47126..384f9e7cb4f 100644
--- a/src/renderer/src/components/native-chat/use-structured-native-chat-pane-commands.ts
+++ b/src/renderer/src/components/native-chat/use-structured-native-chat-pane-commands.ts
@@ -4,7 +4,7 @@ import { formatShortcutLabel } from '@/hooks/useShortcutLabel'
import { getShortcutPlatform } from '@/lib/shortcut-platform'
import { isOrcaSessionId } from '../../../../shared/orca-session-address'
import { resolveStructuredSessionOrcaSessionId } from '../../runtime/structured-session-orca-session-id'
-import type { RuntimeClientTarget } from '../../runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import type { NativeChatComposerHandle } from './NativeChatComposer'
import { useNativeChatPasteBridge } from './use-native-chat-paste-bridge'
import {
diff --git a/src/renderer/src/components/ports/WorkspacePortScanner.tsx b/src/renderer/src/components/ports/WorkspacePortScanner.tsx
index 197a60249c6..0fe218d98c0 100644
--- a/src/renderer/src/components/ports/WorkspacePortScanner.tsx
+++ b/src/renderer/src/components/ports/WorkspacePortScanner.tsx
@@ -1,14 +1,14 @@
import { useCallback, useEffect, useMemo, useRef } from 'react'
import { useAppStore } from '@/store'
import { getHasAnyWorktreesFromState } from '@/store/selectors'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import {
mergeWorkspacePortScans,
WORKSPACE_PORT_ALL_HOSTS_SCAN_KEY,
scanWorkspacePortsForTarget,
workspacePortScanKeyForTarget
} from '@/lib/workspace-port-actions'
-import { runtimeTargetForExecutionHostId } from '@/runtime/runtime-client-target'
+import { runtimeRpcTargetForAuthorityKey } from '@/runtime/runtime-client-target'
import { installWindowVisibilityInterval, isWindowVisible } from '@/lib/window-visibility-interval'
import {
reconcileTransientPortScanFailures,
@@ -55,7 +55,7 @@ export function WorkspacePortScanner({ enabled = true }: { enabled?: boolean }):
const scanTargets = useMemo(
() =>
buildExecutionHostRegistry({ repos, settings })
- .map((host) => runtimeTargetForExecutionHostId(host.id))
+ .map((host) => runtimeRpcTargetForAuthorityKey(host.id))
.filter((target): target is NonNullable => target !== null),
[repos, settings]
)
diff --git a/src/renderer/src/components/pull-request-page/actions/merge-actions.ts b/src/renderer/src/components/pull-request-page/actions/merge-actions.ts
index 27bd98d963c..58b299ea282 100644
--- a/src/renderer/src/components/pull-request-page/actions/merge-actions.ts
+++ b/src/renderer/src/components/pull-request-page/actions/merge-actions.ts
@@ -1,6 +1,6 @@
import { toast } from 'sonner'
import { callRuntimeRpc } from '@/runtime/runtime-rpc-client'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target'
import { notifyWorkItemDetailsMutation } from '@/components/github/github-work-item-comment-mutations'
import { runPullRequestStateUpdate } from '@/components/github/github-work-item-edit-mutations'
import { getGitHubRuntimeRepoId } from '@/lib/github-source-runtime-context'
diff --git a/src/renderer/src/components/pull-request-page/reviewers/request-actions.ts b/src/renderer/src/components/pull-request-page/reviewers/request-actions.ts
index 1f6f1cfeaba..1b5965cbef3 100644
--- a/src/renderer/src/components/pull-request-page/reviewers/request-actions.ts
+++ b/src/renderer/src/components/pull-request-page/reviewers/request-actions.ts
@@ -14,7 +14,7 @@ import type {
} from '../../../../../shared/github/pull-request-types'
import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types'
import type { TaskSourceContext } from '../../../../../shared/task-source-context'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target'
const MAX_REQUESTED_REVIEWERS = 15
diff --git a/src/renderer/src/components/quick-open-file-navigation.test.ts b/src/renderer/src/components/quick-open-file-navigation.test.ts
index 28d423608a2..c3ddc6f1aee 100644
--- a/src/renderer/src/components/quick-open-file-navigation.test.ts
+++ b/src/renderer/src/components/quick-open-file-navigation.test.ts
@@ -41,9 +41,7 @@ vi.mock('./right-sidebar/file-explorer-operation-owner', () => ({
assertCurrent: mocks.assertCurrent
})
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: mocks.rpc
-}))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: mocks.rpc }))
vi.mock('@/store/slices/editor/focus/editor-focus-reveal', () => ({
scheduleEditorLineReveal: mocks.reveal
}))
diff --git a/src/renderer/src/components/right-sidebar/create-pull-request-dialog-field-model.ts b/src/renderer/src/components/right-sidebar/create-pull-request-dialog-field-model.ts
index 7f3533ca5da..d85953cec01 100644
--- a/src/renderer/src/components/right-sidebar/create-pull-request-dialog-field-model.ts
+++ b/src/renderer/src/components/right-sidebar/create-pull-request-dialog-field-model.ts
@@ -1,5 +1,5 @@
import type { AppState } from '@/store'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import type {
RuntimeGeneratePullRequestFieldsOverrides,
RuntimeGitContext
diff --git a/src/renderer/src/components/right-sidebar/file-explorer-operation-owner.ts b/src/renderer/src/components/right-sidebar/file-explorer-operation-owner.ts
index 9c6358c9b62..1e6c96d21de 100644
--- a/src/renderer/src/components/right-sidebar/file-explorer-operation-owner.ts
+++ b/src/renderer/src/components/right-sidebar/file-explorer-operation-owner.ts
@@ -13,7 +13,7 @@ import {
getExplicitRuntimeEnvironmentIdForWorktree,
getRuntimeEnvironmentIdForWorktree
} from '@/lib/worktree-runtime-owner'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import type { FileExplorerOperationOwner } from './file-explorer-types'
import {
getFloatingWorkspaceOperationRoute,
diff --git a/src/renderer/src/components/right-sidebar/git-status-refresh.ts b/src/renderer/src/components/right-sidebar/git-status-refresh.ts
index 96e5817421f..dcbb5feb9d2 100644
--- a/src/renderer/src/components/right-sidebar/git-status-refresh.ts
+++ b/src/renderer/src/components/right-sidebar/git-status-refresh.ts
@@ -8,7 +8,7 @@ import {
storeCachedAutomaticPushTargetUpstreamStatus
} from './push-target-upstream-refresh-cache'
import type { GitStatusResult, GitUpstreamStatus } from '../../../../shared/git-status-types'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import type { GitPushTarget } from '../../../../shared/worktree/types'
import {
beginAutomaticUpstreamRefresh,
diff --git a/src/renderer/src/components/right-sidebar/hosted-review-github-actions.ts b/src/renderer/src/components/right-sidebar/hosted-review-github-actions.ts
index 66731e5638e..6ea84e93e2b 100644
--- a/src/renderer/src/components/right-sidebar/hosted-review-github-actions.ts
+++ b/src/renderer/src/components/right-sidebar/hosted-review-github-actions.ts
@@ -5,11 +5,8 @@ import {
GITHUB_MARK_PR_READY_RUNTIME_CAPABILITY,
GITHUB_MARK_PR_READY_UPDATE_REQUIRED_MESSAGE
} from '../../../../shared/protocol-version'
-import {
- assertRuntimeEnvironmentCapability,
- callRuntimeRpc,
- type RuntimeClientTarget
-} from '@/runtime/runtime-rpc-client'
+import { assertRuntimeEnvironmentCapability, callRuntimeRpc } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
type GitHubPRRepo = PRInfo['prRepo']
diff --git a/src/renderer/src/components/right-sidebar/local-workspace-ports-panel.tsx b/src/renderer/src/components/right-sidebar/local-workspace-ports-panel.tsx
index cbe76d4ab30..ab32cc0073d 100644
--- a/src/renderer/src/components/right-sidebar/local-workspace-ports-panel.tsx
+++ b/src/renderer/src/components/right-sidebar/local-workspace-ports-panel.tsx
@@ -4,7 +4,7 @@ import { toast } from 'sonner'
import { useAppStore } from '@/store'
import { useActiveWorktree, useRepoById } from '@/store/selectors'
import { cn } from '@/lib/utils'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import {
killWorkspacePortForTarget,
openWorkspacePortInBrowser,
diff --git a/src/renderer/src/components/right-sidebar/ports-panel-host.ts b/src/renderer/src/components/right-sidebar/ports-panel-host.ts
index 48b4d1561a4..91853b59eb8 100644
--- a/src/renderer/src/components/right-sidebar/ports-panel-host.ts
+++ b/src/renderer/src/components/right-sidebar/ports-panel-host.ts
@@ -1,10 +1,7 @@
import { resolveOwner } from '@/lib/resolve-owner'
import type { WorktreeOperationRouteState } from '@/lib/worktree-operation-route'
-import {
- hostRouteForAuthority,
- type HostRoute,
- type RuntimeClientTarget
-} from '@/runtime/runtime-client-target'
+import { hostRouteForAuthority, type HostRoute } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { isRuntimeOwnedSshTargetId, parseExecutionHostId } from '../../../../shared/execution-host'
import {
authorityKey,
diff --git a/src/renderer/src/components/right-sidebar/push-target-upstream-refresh-cache.ts b/src/renderer/src/components/right-sidebar/push-target-upstream-refresh-cache.ts
index a9bec776e2e..959ab460e11 100644
--- a/src/renderer/src/components/right-sidebar/push-target-upstream-refresh-cache.ts
+++ b/src/renderer/src/components/right-sidebar/push-target-upstream-refresh-cache.ts
@@ -1,5 +1,5 @@
import type { GitStatusResult, GitUpstreamStatus } from '../../../../shared/git-status-types'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import type { GitPushTarget } from '../../../../shared/worktree/types'
const AUTOMATIC_PUSH_TARGET_UPSTREAM_REFRESH_TTL_MS = 60_000
diff --git a/src/renderer/src/components/right-sidebar/source-control/ai/controller-types.ts b/src/renderer/src/components/right-sidebar/source-control/ai/controller-types.ts
index 521eb003597..32f00e18e24 100644
--- a/src/renderer/src/components/right-sidebar/source-control/ai/controller-types.ts
+++ b/src/renderer/src/components/right-sidebar/source-control/ai/controller-types.ts
@@ -6,7 +6,7 @@ import type {
} from '../../../../../../shared/git-status-types'
import type { GlobalSettings } from '../../../../../../shared/global-settings-types'
import type { Repo } from '../../../../../../shared/repo-types'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target'
export type SourceControlAiStoreSnapshot = Pick &
WorktreeAgentInventoryState
diff --git a/src/renderer/src/components/right-sidebar/source-control/commit/source-control-discard-editor-owner.test.tsx b/src/renderer/src/components/right-sidebar/source-control/commit/source-control-discard-editor-owner.test.tsx
index af0c81be226..bdc5717423e 100644
--- a/src/renderer/src/components/right-sidebar/source-control/commit/source-control-discard-editor-owner.test.tsx
+++ b/src/renderer/src/components/right-sidebar/source-control/commit/source-control-discard-editor-owner.test.tsx
@@ -1,9 +1,7 @@
// @vitest-environment happy-dom
import { act, renderHook } from '@testing-library/react'
-import {
- runtimeTargetForOwnerEnvironment,
- type RuntimeClientTarget
-} from '@/runtime/runtime-client-target'
+import { runtimeTargetForOwnerEnvironment } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target'
import { beforeEach, expect, it, vi } from 'vitest'
import type { EditorPathMutationTarget } from '@/components/editor/editor-autosave'
diff --git a/src/renderer/src/components/right-sidebar/source-control/commit/use-bulk-actions.ts b/src/renderer/src/components/right-sidebar/source-control/commit/use-bulk-actions.ts
index 0788cf99b32..c4361375637 100644
--- a/src/renderer/src/components/right-sidebar/source-control/commit/use-bulk-actions.ts
+++ b/src/renderer/src/components/right-sidebar/source-control/commit/use-bulk-actions.ts
@@ -1,6 +1,6 @@
import { useCallback, useMemo, useState } from 'react'
import { requireGitOwnerTarget } from '../../worktree-git-owner-target'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target'
import { toast } from 'sonner'
import { getConnectionId } from '@/lib/connection-context'
import { translate } from '@/i18n/i18n'
diff --git a/src/renderer/src/components/right-sidebar/source-control/commit/use-discard-confirmation.ts b/src/renderer/src/components/right-sidebar/source-control/commit/use-discard-confirmation.ts
index dc4c90543f5..559b8b2a6d5 100644
--- a/src/renderer/src/components/right-sidebar/source-control/commit/use-discard-confirmation.ts
+++ b/src/renderer/src/components/right-sidebar/source-control/commit/use-discard-confirmation.ts
@@ -1,6 +1,6 @@
import { useCallback, useState } from 'react'
import { requireGitOwnerTarget } from '../../worktree-git-owner-target'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target'
import { toast } from 'sonner'
import { getConnectionId } from '@/lib/connection-context'
import { basename } from '@/lib/path'
diff --git a/src/renderer/src/components/right-sidebar/source-control/commit/use-entry-mutations.ts b/src/renderer/src/components/right-sidebar/source-control/commit/use-entry-mutations.ts
index 079059b116b..ff7d92a5280 100644
--- a/src/renderer/src/components/right-sidebar/source-control/commit/use-entry-mutations.ts
+++ b/src/renderer/src/components/right-sidebar/source-control/commit/use-entry-mutations.ts
@@ -1,6 +1,6 @@
import { useCallback } from 'react'
import { requireGitOwnerTarget } from '../../worktree-git-owner-target'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target'
import {
notifyEditorExternalFileChange,
requestEditorSaveQuiesce
diff --git a/src/renderer/src/components/right-sidebar/source-control/listing/operation-target.ts b/src/renderer/src/components/right-sidebar/source-control/listing/operation-target.ts
index a9179b381aa..7b7ddbde3a8 100644
--- a/src/renderer/src/components/right-sidebar/source-control/listing/operation-target.ts
+++ b/src/renderer/src/components/right-sidebar/source-control/listing/operation-target.ts
@@ -1,5 +1,5 @@
import type { RuntimeGitContext } from '@/runtime/runtime-git-client-context'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target'
import { requireGitOwnerTarget } from '../../worktree-git-owner-target'
import type { GitConflictOperation } from '../../../../../../shared/git-status-types'
import type { GitPushTarget } from '../../../../../../shared/worktree/types'
diff --git a/src/renderer/src/components/right-sidebar/source-control/listing/use-submodule-status.ts b/src/renderer/src/components/right-sidebar/source-control/listing/use-submodule-status.ts
index e9a1fb9cc7e..7cfa43c8e12 100644
--- a/src/renderer/src/components/right-sidebar/source-control/listing/use-submodule-status.ts
+++ b/src/renderer/src/components/right-sidebar/source-control/listing/use-submodule-status.ts
@@ -1,6 +1,6 @@
import { useCallback, useEffect, useState } from 'react'
import { requireGitOwnerTarget } from '../../worktree-git-owner-target'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target'
import type { GitStatusEntry } from '../../../../../../shared/git-status-types'
import { getConnectionId } from '@/lib/connection-context'
import { getRuntimeGitSubmoduleStatus } from '@/runtime/runtime-git-status-client'
diff --git a/src/renderer/src/components/right-sidebar/source-control/listing/use-worktree-context.ts b/src/renderer/src/components/right-sidebar/source-control/listing/use-worktree-context.ts
index 3cb377fbeb4..27d45f607aa 100644
--- a/src/renderer/src/components/right-sidebar/source-control/listing/use-worktree-context.ts
+++ b/src/renderer/src/components/right-sidebar/source-control/listing/use-worktree-context.ts
@@ -1,7 +1,7 @@
import { useMemo } from 'react'
import { getConnectionId } from '@/lib/connection-context'
import { getLocalProjectExecutionRuntimeContext } from '@/lib/local-preflight-context'
-import { runtimeTargetForOwnerHostId } from '@/runtime/runtime-client-target'
+import { ipcOrRuntimeTargetForHostId } from '@/runtime/runtime-client-target'
import { resolveSourceControlLaunchPlatform } from '@/lib/source-control-launch-platform'
import { getWorktreeGitIdentityDisplay } from '@/lib/worktree-git-identity-display'
import { useAppStore } from '@/store'
@@ -111,7 +111,7 @@ export function useSourceControlWorktreeContext() {
const activeRepoTarget = useMemo(
() =>
activeRepoId
- ? runtimeTargetForOwnerHostId(
+ ? ipcOrRuntimeTargetForHostId(
getRepoExecutionHostId({
connectionId: activeRepoConnectionId,
executionHostId: activeRepoExecutionHostId
diff --git a/src/renderer/src/components/right-sidebar/source-control/sync/use-branch-compare.ts b/src/renderer/src/components/right-sidebar/source-control/sync/use-branch-compare.ts
index fbd55bc2180..3637d305ae5 100644
--- a/src/renderer/src/components/right-sidebar/source-control/sync/use-branch-compare.ts
+++ b/src/renderer/src/components/right-sidebar/source-control/sync/use-branch-compare.ts
@@ -1,6 +1,6 @@
import { useCallback, useEffect, useRef } from 'react'
import { requireGitOwnerTarget } from '../../worktree-git-owner-target'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target'
import { installWindowVisibilityInterval } from '@/lib/window-visibility-interval'
import { getConnectionId } from '@/lib/connection-context'
import { getRuntimeGitBranchCompare } from '@/runtime/runtime-git-diff-client'
diff --git a/src/renderer/src/components/right-sidebar/source-control/sync/use-git-history-commit-actions.ts b/src/renderer/src/components/right-sidebar/source-control/sync/use-git-history-commit-actions.ts
index ee1f1fbd268..79506eba581 100644
--- a/src/renderer/src/components/right-sidebar/source-control/sync/use-git-history-commit-actions.ts
+++ b/src/renderer/src/components/right-sidebar/source-control/sync/use-git-history-commit-actions.ts
@@ -1,6 +1,6 @@
import { useCallback, useEffect, useRef } from 'react'
import { requireGitOwnerTarget } from '../../worktree-git-owner-target'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target'
import { toast } from 'sonner'
import { useAppStore } from '@/store'
import { getRuntimeGitCommitCompare } from '@/runtime/runtime-git-diff-client'
diff --git a/src/renderer/src/components/right-sidebar/source-control/sync/use-git-history.ts b/src/renderer/src/components/right-sidebar/source-control/sync/use-git-history.ts
index e09d54566c0..a08d5fa67af 100644
--- a/src/renderer/src/components/right-sidebar/source-control/sync/use-git-history.ts
+++ b/src/renderer/src/components/right-sidebar/source-control/sync/use-git-history.ts
@@ -1,6 +1,6 @@
import { useCallback, useEffect, useRef, useState, type RefObject } from 'react'
import { requireGitOwnerTarget } from '../../worktree-git-owner-target'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target'
import { getConnectionId } from '@/lib/connection-context'
import { getRuntimeGitHistory } from '@/runtime/runtime-git-status-client'
import type { GitHistoryPanelState } from './git-history-panel'
diff --git a/src/renderer/src/components/right-sidebar/source-control/sync/use-status-refresh.ts b/src/renderer/src/components/right-sidebar/source-control/sync/use-status-refresh.ts
index 406077ea349..96bea306bb0 100644
--- a/src/renderer/src/components/right-sidebar/source-control/sync/use-status-refresh.ts
+++ b/src/renderer/src/components/right-sidebar/source-control/sync/use-status-refresh.ts
@@ -1,5 +1,5 @@
import { useCallback, useEffect } from 'react'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target'
import { toast } from 'sonner'
import { getConnectionId } from '@/lib/connection-context'
import { getLocalPathOpenOwnerForRoute, isLocalPathOpenBlocked } from '@/lib/local-path-open-guard'
diff --git a/src/renderer/src/components/right-sidebar/use-create-pull-request-field-generation.ts b/src/renderer/src/components/right-sidebar/use-create-pull-request-field-generation.ts
index f1264b0b809..9ea065809cb 100644
--- a/src/renderer/src/components/right-sidebar/use-create-pull-request-field-generation.ts
+++ b/src/renderer/src/components/right-sidebar/use-create-pull-request-field-generation.ts
@@ -1,5 +1,5 @@
import { useCallback, useEffect, type Dispatch, type RefObject, type SetStateAction } from 'react'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { getConnectionId } from '@/lib/connection-context'
import { useAppStore, type AppState } from '@/store'
import {
diff --git a/src/renderer/src/components/right-sidebar/use-source-control-git-history.test.tsx b/src/renderer/src/components/right-sidebar/use-source-control-git-history.test.tsx
index 2f29a28cde9..5a78dded7b2 100644
--- a/src/renderer/src/components/right-sidebar/use-source-control-git-history.test.tsx
+++ b/src/renderer/src/components/right-sidebar/use-source-control-git-history.test.tsx
@@ -1,7 +1,7 @@
// @vitest-environment happy-dom
import { act } from 'react'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import type { Root } from 'react-dom/client'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
diff --git a/src/renderer/src/components/right-sidebar/useSourceControlSubmoduleStatus.test.tsx b/src/renderer/src/components/right-sidebar/useSourceControlSubmoduleStatus.test.tsx
index 254d6099e30..2cd45679ce0 100644
--- a/src/renderer/src/components/right-sidebar/useSourceControlSubmoduleStatus.test.tsx
+++ b/src/renderer/src/components/right-sidebar/useSourceControlSubmoduleStatus.test.tsx
@@ -1,7 +1,7 @@
// @vitest-environment happy-dom
import { act } from 'react'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
const LOCAL_TARGET: RuntimeClientTarget = { kind: 'local' }
import { createRoot, type Root } from 'react-dom/client'
diff --git a/src/renderer/src/components/right-sidebar/worktree-git-owner-target.ts b/src/renderer/src/components/right-sidebar/worktree-git-owner-target.ts
index 83e151057d3..c58cd10c687 100644
--- a/src/renderer/src/components/right-sidebar/worktree-git-owner-target.ts
+++ b/src/renderer/src/components/right-sidebar/worktree-git-owner-target.ts
@@ -1,9 +1,7 @@
import { useMemo } from 'react'
import { runtimeTargetForWorkspaceOwner } from '@/lib/resolve-owner'
-import {
- runtimeTargetForOwnerEnvironment,
- type RuntimeClientTarget
-} from '@/runtime/runtime-client-target'
+import { runtimeTargetForOwnerEnvironment } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { useAppStore } from '@/store'
import type { AppState } from '@/store/types'
import { UNRESOLVED_GIT_HOST_ERROR } from '@/store/slices/editor/actions/git-operation-target'
diff --git a/src/renderer/src/components/settings/AccountsPane.owner-scope.test.tsx b/src/renderer/src/components/settings/AccountsPane.owner-scope.test.tsx
index ea023b66c40..e70e566e634 100644
--- a/src/renderer/src/components/settings/AccountsPane.owner-scope.test.tsx
+++ b/src/renderer/src/components/settings/AccountsPane.owner-scope.test.tsx
@@ -6,7 +6,7 @@ import type {
ClaudeManagedAccountSummary,
ClaudeRateLimitAccountsState
} from '../../../../shared/managed-account-types'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { AccountsPane } from './AccountsPane'
import type { SettingsHostScope } from './settings-host-scope'
diff --git a/src/renderer/src/components/settings/AccountsPane.tsx b/src/renderer/src/components/settings/AccountsPane.tsx
index 33c41b27501..119991af345 100644
--- a/src/renderer/src/components/settings/AccountsPane.tsx
+++ b/src/renderer/src/components/settings/AccountsPane.tsx
@@ -41,7 +41,7 @@ import {
} from './provider-account-visibility'
import { GrokAccountsSection } from './GrokAccountsSection'
import { AntigravityAccountsSection } from './AntigravityAccountsSection'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { runtimeTargetEnvironmentId } from '@/runtime/runtime-client-target'
import { CursorAccountsSection } from './CursorAccountsSection'
import { ZcodePlanAccountsSection } from './ZcodePlanAccountsSection'
diff --git a/src/renderer/src/components/settings/AntigravityAccountsSection.tsx b/src/renderer/src/components/settings/AntigravityAccountsSection.tsx
index 2ec75d9af66..e14cecdd8e9 100644
--- a/src/renderer/src/components/settings/AntigravityAccountsSection.tsx
+++ b/src/renderer/src/components/settings/AntigravityAccountsSection.tsx
@@ -3,7 +3,8 @@ import { Loader2 } from 'lucide-react'
import { translate } from '@/i18n/i18n'
import { AgentIcon } from '@/lib/agent-catalog'
import { callAntigravityAccounts } from '@/runtime/runtime-antigravity-accounts-client'
-import { callRuntimeRpc, type RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import { callRuntimeRpc } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import type {
AntigravityAccountState,
AntigravityAccountTarget
diff --git a/src/renderer/src/components/settings/CommitMessageAiPane.tsx b/src/renderer/src/components/settings/CommitMessageAiPane.tsx
index 78f19cc3afc..73e2cbc56bb 100644
--- a/src/renderer/src/components/settings/CommitMessageAiPane.tsx
+++ b/src/renderer/src/components/settings/CommitMessageAiPane.tsx
@@ -1,7 +1,7 @@
import { useRef } from 'react'
import type React from 'react'
import type { GlobalSettings } from '../../../../shared/global-settings-types'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import type { TuiAgent } from '../../../../shared/tui-agent'
import type {
SourceControlAiSettingsPatch,
diff --git a/src/renderer/src/components/settings/GitProviderApiBudgetPane.tsx b/src/renderer/src/components/settings/GitProviderApiBudgetPane.tsx
index de03b0bfce1..04168d54abb 100644
--- a/src/renderer/src/components/settings/GitProviderApiBudgetPane.tsx
+++ b/src/renderer/src/components/settings/GitProviderApiBudgetPane.tsx
@@ -4,7 +4,7 @@ import { matchesSettingsSearch } from './settings-search'
import { GitHubRateLimitPanel } from '../github/github-rate-limit-display'
import { GitLabRateLimitPanel } from '../gitlab/gitlab-rate-limit-display'
import { translate } from '@/i18n/i18n'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
type GitProviderApiBudgetPaneProps = {
settingsSearchQuery?: string
diff --git a/src/renderer/src/components/settings/ManagedDataAccountsSection.tsx b/src/renderer/src/components/settings/ManagedDataAccountsSection.tsx
index 181a572a594..a9b36ad9ac8 100644
--- a/src/renderer/src/components/settings/ManagedDataAccountsSection.tsx
+++ b/src/renderer/src/components/settings/ManagedDataAccountsSection.tsx
@@ -1,6 +1,7 @@
import { useEffect, useState } from 'react'
import { translate } from '@/i18n/i18n'
-import { callRuntimeRpc, type RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import { callRuntimeRpc } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import type {
ManagedDataAccountProvider,
ManagedDataAccountsState
diff --git a/src/renderer/src/components/settings/NativeChatQueueFollowUpsSetting.tsx b/src/renderer/src/components/settings/NativeChatQueueFollowUpsSetting.tsx
index b9f3a4b01a6..4bdfd09dc3f 100644
--- a/src/renderer/src/components/settings/NativeChatQueueFollowUpsSetting.tsx
+++ b/src/renderer/src/components/settings/NativeChatQueueFollowUpsSetting.tsx
@@ -1,6 +1,6 @@
import type { GlobalSettings } from '../../../../shared/global-settings-types'
import { translate } from '@/i18n/i18n'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { useStructuredAgentSessionHostQueuesMessages } from '@/runtime/structured-agent-session-host-capability'
import { Label } from '../ui/label'
import { SettingsSwitch } from './SettingsFormControls'
diff --git a/src/renderer/src/components/settings/RepositoryForkSyncSection.tsx b/src/renderer/src/components/settings/RepositoryForkSyncSection.tsx
index 485cf1df003..533b8e545a0 100644
--- a/src/renderer/src/components/settings/RepositoryForkSyncSection.tsx
+++ b/src/renderer/src/components/settings/RepositoryForkSyncSection.tsx
@@ -8,7 +8,7 @@ import { Button } from '../ui/button'
import { SearchableSetting } from './SearchableSetting'
import { SettingsSegmentedControl } from './SettingsFormControls'
import { syncRuntimeGitForkDefaultBranch } from '../../runtime/runtime-git-sync-client'
-import { runtimeTargetForOwnerHostId } from '@/runtime/runtime-client-target'
+import { ipcOrRuntimeTargetForHostId } from '@/runtime/runtime-client-target'
import { UNRESOLVED_GIT_HOST_ERROR } from '@/store/slices/editor/actions/git-operation-target'
import { getRepoExecutionHostId } from '../../../../shared/execution-host'
import { translate } from '@/i18n/i18n'
@@ -126,7 +126,7 @@ export function RepositoryForkSyncSection({
syncInFlightRef.current = true
setSyncing(true)
try {
- const target = runtimeTargetForOwnerHostId(getRepoExecutionHostId(repo))
+ const target = ipcOrRuntimeTargetForHostId(getRepoExecutionHostId(repo))
if (!target) {
throw new Error(UNRESOLVED_GIT_HOST_ERROR)
}
diff --git a/src/renderer/src/components/settings/RepositoryGitHubAccountSection.inventory-lifetime.test.tsx b/src/renderer/src/components/settings/RepositoryGitHubAccountSection.inventory-lifetime.test.tsx
index 907e7203d27..b9d5d2e32ee 100644
--- a/src/renderer/src/components/settings/RepositoryGitHubAccountSection.inventory-lifetime.test.tsx
+++ b/src/renderer/src/components/settings/RepositoryGitHubAccountSection.inventory-lifetime.test.tsx
@@ -25,9 +25,7 @@ vi.mock('../../store', () => {
return { useAppStore }
})
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: vi.fn()
-}))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: vi.fn() }))
vi.mock('./repository-github-account', async (importOriginal) => ({
...(await importOriginal()),
diff --git a/src/renderer/src/components/settings/RepositoryGitHubAccountSection.test.tsx b/src/renderer/src/components/settings/RepositoryGitHubAccountSection.test.tsx
index b5b911ce621..aa2aa251f42 100644
--- a/src/renderer/src/components/settings/RepositoryGitHubAccountSection.test.tsx
+++ b/src/renderer/src/components/settings/RepositoryGitHubAccountSection.test.tsx
@@ -33,9 +33,7 @@ vi.mock('../../store', () => {
return { useAppStore }
})
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: vi.fn()
-}))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: vi.fn() }))
vi.mock('./repository-github-account', async (importOriginal) => ({
...(await importOriginal()),
diff --git a/src/renderer/src/components/settings/RepositoryIconPicker.github-avatar-refresh.test.tsx b/src/renderer/src/components/settings/RepositoryIconPicker.github-avatar-refresh.test.tsx
index d3b0fb9bc87..0f37c4c1271 100644
--- a/src/renderer/src/components/settings/RepositoryIconPicker.github-avatar-refresh.test.tsx
+++ b/src/renderer/src/components/settings/RepositoryIconPicker.github-avatar-refresh.test.tsx
@@ -6,9 +6,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import type { Repo } from '../../../../shared/repo-types'
import { RepositoryIconPicker } from './RepositoryIconPicker'
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: vi.fn()
-}))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: vi.fn() }))
vi.mock('./RepositoryIconColorSection', () => ({
RepositoryIconColorSection: () => null
diff --git a/src/renderer/src/components/settings/SettingsHostScopePicker.tsx b/src/renderer/src/components/settings/SettingsHostScopePicker.tsx
index ca075c8b208..cbb521743ea 100644
--- a/src/renderer/src/components/settings/SettingsHostScopePicker.tsx
+++ b/src/renderer/src/components/settings/SettingsHostScopePicker.tsx
@@ -8,10 +8,8 @@ import {
import { translate } from '@/i18n/i18n'
import { getLocalExecutionHostLabel } from '../../../../shared/execution-host'
import type { PublicKnownRuntimeEnvironment } from '../../../../shared/runtime-environments'
-import {
- runtimeTargetEnvironmentId,
- type RuntimeClientTarget
-} from '@/runtime/runtime-client-target'
+import { runtimeTargetEnvironmentId } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import type { SettingsHostScope } from './settings-host-scope'
const LOCAL_VALUE = 'local'
diff --git a/src/renderer/src/components/settings/accounts-pane-account-actions.ts b/src/renderer/src/components/settings/accounts-pane-account-actions.ts
index 9cc98c29d1f..11cf16f6926 100644
--- a/src/renderer/src/components/settings/accounts-pane-account-actions.ts
+++ b/src/renderer/src/components/settings/accounts-pane-account-actions.ts
@@ -1,6 +1,6 @@
import type { Dispatch, SetStateAction } from 'react'
import type { GlobalSettings } from '../../../../shared/global-settings-types'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import type { FeatureInteractionId } from '../../../../shared/feature-interaction-catalog'
import type {
ClaudeRateLimitAccountsState,
diff --git a/src/renderer/src/components/settings/accounts-pane-types.ts b/src/renderer/src/components/settings/accounts-pane-types.ts
index 2f5def9b661..84fdc137329 100644
--- a/src/renderer/src/components/settings/accounts-pane-types.ts
+++ b/src/renderer/src/components/settings/accounts-pane-types.ts
@@ -12,7 +12,7 @@ import type {
import type { CodexConfigSyncStatus } from '../../../../shared/codex-config-sync-types'
import type { FeatureInteractionId } from '../../../../shared/feature-interaction-catalog'
import type { ProviderAccountRuntimeView } from './provider-account-visibility'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import type { SettingsHostScope } from './settings-host-scope'
export type AccountsPaneProps = {
diff --git a/src/renderer/src/components/settings/provider-account-scope.ts b/src/renderer/src/components/settings/provider-account-scope.ts
index 7d48f6872f5..aa15e117e16 100644
--- a/src/renderer/src/components/settings/provider-account-scope.ts
+++ b/src/renderer/src/components/settings/provider-account-scope.ts
@@ -2,7 +2,7 @@ import { translate } from '@/i18n/i18n'
import { getLocalExecutionHostLabel } from '../../../../shared/execution-host'
import type { GlobalSettings } from '../../../../shared/global-settings-types'
import { defaultScopeHost } from '@/lib/default-creation-host'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
/** Which host a provider card or budget belongs to, and how to change it. */
export type ProviderHostScope = {
diff --git a/src/renderer/src/components/settings/repository-github-account.ts b/src/renderer/src/components/settings/repository-github-account.ts
index 3dbdb3d67ba..47bf7d31a33 100644
--- a/src/renderer/src/components/settings/repository-github-account.ts
+++ b/src/renderer/src/components/settings/repository-github-account.ts
@@ -5,7 +5,8 @@ import type {
GhAccountBindingValidationResult
} from '../../../../shared/github/auth-types'
import { ghAccountBindingsEqual } from '../../../../shared/github/account-binding'
-import { callRuntimeRpc, type RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import { callRuntimeRpc } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
const LOCAL_GH_ACCOUNT_IPC_TIMEOUT_MS = 30_000
diff --git a/src/renderer/src/components/settings/repository-icon-github.test.ts b/src/renderer/src/components/settings/repository-icon-github.test.ts
index 3abb42ae89d..bf75c418f8f 100644
--- a/src/renderer/src/components/settings/repository-icon-github.test.ts
+++ b/src/renderer/src/components/settings/repository-icon-github.test.ts
@@ -6,9 +6,7 @@ import {
resolveRepositoryGitHubAvatar
} from './repository-icon-github'
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: vi.fn()
-}))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: vi.fn() }))
const apiMocks = {
repoSlug: vi.fn(),
diff --git a/src/renderer/src/components/settings/repository-icon-github.ts b/src/renderer/src/components/settings/repository-icon-github.ts
index 8cd881bf7b3..8e60b4f6fdb 100644
--- a/src/renderer/src/components/settings/repository-icon-github.ts
+++ b/src/renderer/src/components/settings/repository-icon-github.ts
@@ -2,7 +2,8 @@ import type { GitHubRepositoryIdentity } from '../../../../shared/github/pull-re
import type { Repo } from '../../../../shared/repo-types'
import { githubAvatarIcon, githubAvatarSlug, type RepoIcon } from '../../../../shared/repo-icon'
import { githubRepoIdentityKey } from '../../../../shared/github/repository-identity-key'
-import { callRuntimeRpc, type RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import { callRuntimeRpc } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
type ResolveRepositoryGitHubAvatarOptions = {
forceLive?: boolean
diff --git a/src/renderer/src/components/settings/settings-host-scope.ts b/src/renderer/src/components/settings/settings-host-scope.ts
index abe743f9a6a..a4ea3dc0608 100644
--- a/src/renderer/src/components/settings/settings-host-scope.ts
+++ b/src/renderer/src/components/settings/settings-host-scope.ts
@@ -1,4 +1,4 @@
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
/** Host whose accounts, agents and terminal capabilities Settings shows; chosen in the page. */
export type SettingsHostScope = {
diff --git a/src/renderer/src/components/settings/use-runtime-environment-catalog.ts b/src/renderer/src/components/settings/use-runtime-environment-catalog.ts
index 6db8a8f7e0c..1d6184b03a4 100644
--- a/src/renderer/src/components/settings/use-runtime-environment-catalog.ts
+++ b/src/renderer/src/components/settings/use-runtime-environment-catalog.ts
@@ -10,7 +10,7 @@ import {
import { toast } from 'sonner'
import { useMountedRef } from '@/hooks/useMountedRef'
import { translate } from '@/i18n/i18n'
-import { unwrapRuntimeRpcResult } from '@/runtime/runtime-rpc-client'
+import { unwrapRuntimeRpcResult } from '@/runtime/runtime-rpc-result'
import { extractRuntimeTransportDiagnostics } from '@/runtime/runtime-status-probe-diagnostics'
import { useAppStore } from '@/store'
import {
diff --git a/src/renderer/src/components/settings/use-runtime-environment-connection-actions.ts b/src/renderer/src/components/settings/use-runtime-environment-connection-actions.ts
index 2174c3633c6..0e3874e004d 100644
--- a/src/renderer/src/components/settings/use-runtime-environment-connection-actions.ts
+++ b/src/renderer/src/components/settings/use-runtime-environment-connection-actions.ts
@@ -1,7 +1,7 @@
import { useState, type Dispatch, type MutableRefObject, type SetStateAction } from 'react'
import { toast } from 'sonner'
import { translate } from '@/i18n/i18n'
-import { unwrapRuntimeRpcResult } from '@/runtime/runtime-rpc-client'
+import { unwrapRuntimeRpcResult } from '@/runtime/runtime-rpc-result'
import { extractRuntimeTransportDiagnostics } from '@/runtime/runtime-status-probe-diagnostics'
import { useAppStore } from '@/store'
import { describeRuntimeCompatBlock } from '../../../../shared/protocol-compat'
diff --git a/src/renderer/src/components/settings/use-settings-store-model.ts b/src/renderer/src/components/settings/use-settings-store-model.ts
index c0141caa22e..a11dd278d1c 100644
--- a/src/renderer/src/components/settings/use-settings-store-model.ts
+++ b/src/renderer/src/components/settings/use-settings-store-model.ts
@@ -32,7 +32,7 @@ import {
removeSettingsProjectFromAllHosts
} from './settings-project-list'
import { resolveSettingsHostScope } from './settings-host-scope'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { defaultScopeHost } from '@/lib/default-creation-host'
export function useSettingsStoreModel() {
diff --git a/src/renderer/src/components/sidebar/HostSectionHeaderMenu.tsx b/src/renderer/src/components/sidebar/HostSectionHeaderMenu.tsx
index 31d2fab5b91..dfa36a44962 100644
--- a/src/renderer/src/components/sidebar/HostSectionHeaderMenu.tsx
+++ b/src/renderer/src/components/sidebar/HostSectionHeaderMenu.tsx
@@ -27,10 +27,8 @@ import { translate } from '@/i18n/i18n'
import { sshConnectVerb } from '@/ssh/ssh-connect-verb'
import { parseExecutionHostId } from '../../../../shared/execution-host'
import { describeRuntimeCompatBlock } from '../../../../shared/protocol-compat'
-import {
- clearRuntimeCompatibilityCache,
- unwrapRuntimeRpcResult
-} from '@/runtime/runtime-rpc-client'
+import { clearRuntimeCompatibilityCache } from '@/runtime/runtime-rpc-client'
+import { unwrapRuntimeRpcResult } from '@/runtime/runtime-rpc-result'
import type { RuntimeStatus } from '../../../../shared/runtime-types'
import type { HostHeaderRow } from './host-section-rows'
import { buildHostHeaderMenuModel } from './host-header-menu-items'
diff --git a/src/renderer/src/components/sidebar/WorktreeCard.affiliate-list-mode.test.tsx b/src/renderer/src/components/sidebar/WorktreeCard.affiliate-list-mode.test.tsx
index bc581ee2213..508893c9fdb 100644
--- a/src/renderer/src/components/sidebar/WorktreeCard.affiliate-list-mode.test.tsx
+++ b/src/renderer/src/components/sidebar/WorktreeCard.affiliate-list-mode.test.tsx
@@ -69,8 +69,6 @@ vi.mock('@/lib/sidebar-worktree-activation', () => ({
activateWorktreeFromSidebar: testDoubles.activateWorktreeFromSidebar
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({}))
-
vi.mock('./use-worktree-activity-status', () => ({
useWorktreeActivityStatus: () => 'idle'
}))
diff --git a/src/renderer/src/components/sidebar/WorktreeCard.compact-hover.test.tsx b/src/renderer/src/components/sidebar/WorktreeCard.compact-hover.test.tsx
index 603db9f484b..b1e4887f1f4 100644
--- a/src/renderer/src/components/sidebar/WorktreeCard.compact-hover.test.tsx
+++ b/src/renderer/src/components/sidebar/WorktreeCard.compact-hover.test.tsx
@@ -95,8 +95,6 @@ vi.mock('@/lib/sidebar-worktree-activation', () => ({
activateWorktreeFromSidebar: vi.fn()
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({}))
-
vi.mock('./use-worktree-activity-status', () => ({
useWorktreeActivityStatus: () => 'active'
}))
diff --git a/src/renderer/src/components/sidebar/WorktreeCard.compact-ports-hover-independence.test.tsx b/src/renderer/src/components/sidebar/WorktreeCard.compact-ports-hover-independence.test.tsx
index 6c0d9f61504..33f1aee30eb 100644
--- a/src/renderer/src/components/sidebar/WorktreeCard.compact-ports-hover-independence.test.tsx
+++ b/src/renderer/src/components/sidebar/WorktreeCard.compact-ports-hover-independence.test.tsx
@@ -109,8 +109,6 @@ vi.mock('@/lib/sidebar-worktree-activation', () => ({
activateWorktreeFromSidebar: vi.fn()
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({}))
-
vi.mock('./use-worktree-activity-status', () => ({
useWorktreeActivityStatus: () => 'active'
}))
diff --git a/src/renderer/src/components/sidebar/WorktreeList.card-memo-stability.test.tsx b/src/renderer/src/components/sidebar/WorktreeList.card-memo-stability.test.tsx
index 9905a6ee83e..f6b491f3a5b 100644
--- a/src/renderer/src/components/sidebar/WorktreeList.card-memo-stability.test.tsx
+++ b/src/renderer/src/components/sidebar/WorktreeList.card-memo-stability.test.tsx
@@ -111,9 +111,7 @@ vi.mock('@/lib/worktree-activation', () => ({
activateAndRevealWorktree: vi.fn()
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: vi.fn()
-}))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: vi.fn() }))
vi.mock('./WorktreeCardAgents', () => ({
default: () => Agent row
,
diff --git a/src/renderer/src/components/sidebar/WorktreeList.lineage-agent-expansion-coupling.test.tsx b/src/renderer/src/components/sidebar/WorktreeList.lineage-agent-expansion-coupling.test.tsx
index 2cc44556170..096a2856998 100644
--- a/src/renderer/src/components/sidebar/WorktreeList.lineage-agent-expansion-coupling.test.tsx
+++ b/src/renderer/src/components/sidebar/WorktreeList.lineage-agent-expansion-coupling.test.tsx
@@ -134,9 +134,7 @@ vi.mock('@/lib/worktree-activation', () => ({
activateAndRevealWorktree: vi.fn()
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: vi.fn()
-}))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: vi.fn() }))
vi.mock('./CacheTimer', () => ({
default: () => null,
diff --git a/src/renderer/src/components/sidebar/WorktreeList.lineage-child-real-card.test.tsx b/src/renderer/src/components/sidebar/WorktreeList.lineage-child-real-card.test.tsx
index 0359deca32e..a2035b9d404 100644
--- a/src/renderer/src/components/sidebar/WorktreeList.lineage-child-real-card.test.tsx
+++ b/src/renderer/src/components/sidebar/WorktreeList.lineage-child-real-card.test.tsx
@@ -128,9 +128,7 @@ vi.mock('@/lib/worktree-activation', () => ({
activateAndRevealWorktree: vi.fn()
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: vi.fn()
-}))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: vi.fn() }))
vi.mock('./CacheTimer', () => ({
default: () => null,
diff --git a/src/renderer/src/components/sidebar/WorktreeList.status-lane-lineage-drop.test.tsx b/src/renderer/src/components/sidebar/WorktreeList.status-lane-lineage-drop.test.tsx
index 5133e63d75d..2bcf76136d6 100644
--- a/src/renderer/src/components/sidebar/WorktreeList.status-lane-lineage-drop.test.tsx
+++ b/src/renderer/src/components/sidebar/WorktreeList.status-lane-lineage-drop.test.tsx
@@ -129,9 +129,7 @@ vi.mock('@/lib/worktree-activation', () => ({
activateAndRevealWorktree: vi.fn()
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: vi.fn()
-}))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: vi.fn() }))
vi.mock('./CacheTimer', () => ({
default: () => null,
diff --git a/src/renderer/src/components/sidebar/add-repo-runtime-owner.ts b/src/renderer/src/components/sidebar/add-repo-runtime-owner.ts
index c929eed87ae..bb2fd782246 100644
--- a/src/renderer/src/components/sidebar/add-repo-runtime-owner.ts
+++ b/src/renderer/src/components/sidebar/add-repo-runtime-owner.ts
@@ -4,10 +4,8 @@ import {
toSshExecutionHostId,
type ExecutionHostId
} from '../../../../shared/execution-host'
-import {
- runtimeTargetForOwnerEnvironment,
- type RuntimeClientTarget
-} from '@/runtime/runtime-client-target'
+import { runtimeTargetForOwnerEnvironment } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
export type CapturedRuntimeOwner = string | null | undefined
diff --git a/src/renderer/src/components/sidebar/use-delete-worktree-status-hydration.ts b/src/renderer/src/components/sidebar/use-delete-worktree-status-hydration.ts
index cabd75816c9..10b40339032 100644
--- a/src/renderer/src/components/sidebar/use-delete-worktree-status-hydration.ts
+++ b/src/renderer/src/components/sidebar/use-delete-worktree-status-hydration.ts
@@ -2,7 +2,7 @@ import { useEffect, useRef, useState } from 'react'
import { useAppStore } from '@/store'
import { getConnectionId } from '@/lib/connection-context'
import { runtimeTargetForWorkspaceOwner } from '@/lib/resolve-owner'
-import { runtimeTargetForOwnerHostId } from '@/runtime/runtime-client-target'
+import { ipcOrRuntimeTargetForHostId } from '@/runtime/runtime-client-target'
import { getRuntimeGitStatus } from '@/runtime/runtime-git-status-client'
import { findRepoForHost } from '@/store/slices/repo-host-identity'
import type { Repo } from '../../../../shared/repo-types'
@@ -62,7 +62,7 @@ export function useDeleteWorktreeStatusHydration({
? findRepoForHost(repos, target.repoId, { hostId: target.hostId })
: undefined
const ownerTarget = target.hostId
- ? runtimeTargetForOwnerHostId(target.hostId)
+ ? ipcOrRuntimeTargetForHostId(target.hostId)
: runtimeTargetForWorkspaceOwner(currentState, { workspaceId: target.id })
if (!ownerTarget) {
setStatusByIdentity((current) => new Map(current).set(identity, null))
diff --git a/src/renderer/src/components/sidebar/use-server-ssh-projects.ts b/src/renderer/src/components/sidebar/use-server-ssh-projects.ts
index 729f70dd919..a100dd77c93 100644
--- a/src/renderer/src/components/sidebar/use-server-ssh-projects.ts
+++ b/src/renderer/src/components/sidebar/use-server-ssh-projects.ts
@@ -4,7 +4,7 @@ import {
useStructuredAgentSessionHostCapabilityState,
type StructuredAgentSessionHostCapabilityState
} from '@/runtime/structured-agent-session-host-capability'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
export type ServerSshProjects = {
state: StructuredAgentSessionHostCapabilityState
diff --git a/src/renderer/src/components/sidebar/useAddRepoCloneFlow.test.ts b/src/renderer/src/components/sidebar/useAddRepoCloneFlow.test.ts
index cfab8648d34..38ef53e739c 100644
--- a/src/renderer/src/components/sidebar/useAddRepoCloneFlow.test.ts
+++ b/src/renderer/src/components/sidebar/useAddRepoCloneFlow.test.ts
@@ -64,9 +64,7 @@ vi.mock('@/store', () => {
return { useAppStore }
})
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: mocks.callRuntimeRpc
-}))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: mocks.callRuntimeRpc }))
vi.mock('sonner', () => ({
toast: {
diff --git a/src/renderer/src/components/sidebar/useCreateProjectDefaults.test.ts b/src/renderer/src/components/sidebar/useCreateProjectDefaults.test.ts
index 0ae37847477..27865e63077 100644
--- a/src/renderer/src/components/sidebar/useCreateProjectDefaults.test.ts
+++ b/src/renderer/src/components/sidebar/useCreateProjectDefaults.test.ts
@@ -44,9 +44,7 @@ vi.mock('@/runtime/runtime-server-directory-browser', () => ({
browseRuntimeServerDirectory: mocks.browseRuntimeServerDirectory
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: mocks.callRuntimeRpc
-}))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: mocks.callRuntimeRpc }))
import { useCreateProjectDefaults } from './useCreateProjectDefaults'
diff --git a/src/renderer/src/components/sidebar/useCreateRepo.default-checkout.test.ts b/src/renderer/src/components/sidebar/useCreateRepo.default-checkout.test.ts
index a5df1d5d188..58677cbd3a1 100644
--- a/src/renderer/src/components/sidebar/useCreateRepo.default-checkout.test.ts
+++ b/src/renderer/src/components/sidebar/useCreateRepo.default-checkout.test.ts
@@ -75,9 +75,7 @@ vi.mock('sonner', () => ({
}
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: mocks.callRuntimeRpc
-}))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: mocks.callRuntimeRpc }))
const STATE_NAME = 0
const STATE_PARENT_PATH = 1
diff --git a/src/renderer/src/components/skills/SkillsPage.tsx b/src/renderer/src/components/skills/SkillsPage.tsx
index a7f3d03943a..5b83e5ccca1 100644
--- a/src/renderer/src/components/skills/SkillsPage.tsx
+++ b/src/renderer/src/components/skills/SkillsPage.tsx
@@ -4,10 +4,10 @@ import { readIpcErrorDetail } from '@/lib/ipc-error'
import { cn } from '@/lib/utils'
import { useAppStore } from '@/store'
import { discoverSkillsForRuntimeTarget } from '@/runtime/runtime-skills-client'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { useActiveSkillDiscoveryRuntimeTarget } from '@/hooks/use-active-skill-discovery-runtime-target'
import { useMountedRef } from '@/hooks/useMountedRef'
-import { getRuntimeTargetHostId } from '@/store/runtime-target-host'
+import { getRuntimeTargetHostId } from '@/runtime/runtime-client-target'
import { UNRESOLVED_OWNER_HOST_ID } from '../../../../shared/execution-host'
import type { DiscoveredSkill, SkillDiscoveryResult } from '../../../../shared/skills'
import { MAX_SKILL_DELETE_BATCH } from '../../../../shared/skill-delete-contract'
diff --git a/src/renderer/src/components/skills/use-skill-delete-flow.ts b/src/renderer/src/components/skills/use-skill-delete-flow.ts
index 1ca6f6035de..3d88d89effb 100644
--- a/src/renderer/src/components/skills/use-skill-delete-flow.ts
+++ b/src/renderer/src/components/skills/use-skill-delete-flow.ts
@@ -14,7 +14,7 @@ import {
previewSkillDeletionOnRuntimeTarget,
runtimeTargetSupportsSkillDelete
} from '../../runtime/runtime-skills-client'
-import type { RuntimeClientTarget } from '../../runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import {
skillDeleteActionLabel,
skillDeleteBlockedLines,
diff --git a/src/renderer/src/components/skills/use-skill-discovery-host-label.ts b/src/renderer/src/components/skills/use-skill-discovery-host-label.ts
index 5386ac92214..071e7406d90 100644
--- a/src/renderer/src/components/skills/use-skill-discovery-host-label.ts
+++ b/src/renderer/src/components/skills/use-skill-discovery-host-label.ts
@@ -1,4 +1,4 @@
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { useAppStore } from '@/store'
import { translate } from '@/i18n/i18n'
diff --git a/src/renderer/src/components/status-bar/PortsStatusSegment.host-routing.test.tsx b/src/renderer/src/components/status-bar/PortsStatusSegment.host-routing.test.tsx
index b1ac9941e7c..ea6362c5a2c 100644
--- a/src/renderer/src/components/status-bar/PortsStatusSegment.host-routing.test.tsx
+++ b/src/renderer/src/components/status-bar/PortsStatusSegment.host-routing.test.tsx
@@ -58,10 +58,7 @@ vi.mock('@/lib/worktree-runtime-owner', () => ({
vi.mock('@/runtime/runtime-rpc-client', async () => {
return {
callRuntimeRpc: vi.fn(),
- assertRuntimeEnvironmentCapability: vi.fn(),
- RuntimeRpcCallError: class RuntimeRpcCallError extends Error {
- code?: string
- }
+ assertRuntimeEnvironmentCapability: vi.fn()
}
})
diff --git a/src/renderer/src/components/status-bar/claude-status-sign-in.test.tsx b/src/renderer/src/components/status-bar/claude-status-sign-in.test.tsx
index 13d77a5ce84..08f8a13c2e0 100644
--- a/src/renderer/src/components/status-bar/claude-status-sign-in.test.tsx
+++ b/src/renderer/src/components/status-bar/claude-status-sign-in.test.tsx
@@ -47,7 +47,7 @@ vi.mock('@/runtime/runtime-provider-accounts-client', () => ({
})),
selectClaudeProviderAccount
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({}))
+
vi.mock('@/lib/windows-terminal-capabilities', () => ({
useWindowsTerminalCapabilities: () => ({ wslDistros: [], isLoading: false }),
getWindowsTerminalCapabilityOwnerKey: () => 'local'
diff --git a/src/renderer/src/components/status-bar/codex-status-sign-in.test.tsx b/src/renderer/src/components/status-bar/codex-status-sign-in.test.tsx
index b1b4df3eed1..dc9e8a7def1 100644
--- a/src/renderer/src/components/status-bar/codex-status-sign-in.test.tsx
+++ b/src/renderer/src/components/status-bar/codex-status-sign-in.test.tsx
@@ -94,8 +94,6 @@ vi.mock('@/runtime/runtime-provider-accounts-client', () => ({
selectClaudeProviderAccount: vi.fn(async () => ({ accounts: [], activeAccountId: null }))
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({}))
-
vi.mock('@/lib/windows-terminal-capabilities', () => ({
useWindowsTerminalCapabilities: () => ({ wslDistros: [], isLoading: false }),
getWindowsTerminalCapabilityOwnerKey: () => 'local'
diff --git a/src/renderer/src/components/status-bar/ports-status-popover-rows.test.tsx b/src/renderer/src/components/status-bar/ports-status-popover-rows.test.tsx
index 0ed7dec1817..1ddc96b3cd6 100644
--- a/src/renderer/src/components/status-bar/ports-status-popover-rows.test.tsx
+++ b/src/renderer/src/components/status-bar/ports-status-popover-rows.test.tsx
@@ -44,12 +44,10 @@ vi.mock('@/lib/worktree-activation', () => ({
activateAndRevealWorktree: activateAndRevealWorktreeMock
}))
-vi.mock('@/lib/worktree-runtime-owner', () => ({
- getExecutionHostIdForWorktree: () => 'local'
-}))
+vi.mock('@/lib/worktree-runtime-owner', () => ({ getExecutionHostIdForWorktree: () => 'local' }))
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: vi.fn(),
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: vi.fn() }))
+vi.mock('@/runtime/runtime-rpc-result', () => ({
RuntimeRpcCallError: class RuntimeRpcCallError extends Error {
code?: string
}
diff --git a/src/renderer/src/components/status-bar/runtime-environment-explicit-connect.ts b/src/renderer/src/components/status-bar/runtime-environment-explicit-connect.ts
index 14376914f50..c913630c3e3 100644
--- a/src/renderer/src/components/status-bar/runtime-environment-explicit-connect.ts
+++ b/src/renderer/src/components/status-bar/runtime-environment-explicit-connect.ts
@@ -3,7 +3,7 @@ import type { ExecutionHostId } from '../../../../shared/execution-host'
import type { RuntimeStatus } from '../../../../shared/runtime-types'
import { refreshRuntimeProjectWorktreesAndLineage } from '@/hooks/runtime-project-refresh-scheduler'
import { translate } from '@/i18n/i18n'
-import { unwrapRuntimeRpcResult } from '@/runtime/runtime-rpc-client'
+import { unwrapRuntimeRpcResult } from '@/runtime/runtime-rpc-result'
import { useAppStore } from '../../store'
export async function connectRuntimeEnvironmentAndRecordStatus(
diff --git a/src/renderer/src/components/status-bar/use-workspace-space-git-refresh-action.ts b/src/renderer/src/components/status-bar/use-workspace-space-git-refresh-action.ts
index 654636c2189..f19c8c0489f 100644
--- a/src/renderer/src/components/status-bar/use-workspace-space-git-refresh-action.ts
+++ b/src/renderer/src/components/status-bar/use-workspace-space-git-refresh-action.ts
@@ -1,6 +1,6 @@
import { useCallback } from 'react'
import type { GitStatusResult } from '../../../../shared/git-status-types'
-import { runtimeTargetForOwnerHostId } from '@/runtime/runtime-client-target'
+import { ipcOrRuntimeTargetForHostId } from '@/runtime/runtime-client-target'
import type { WorkspaceSpaceWorktree } from '../../../../shared/workspace-space-types'
import { getWorkspaceSpaceWorktreeIdentity } from './workspace-space-delete-selection'
import { useAppStore } from '../../store'
@@ -49,7 +49,7 @@ export function useWorkspaceSpaceGitRefreshAction(bindings: WorkspaceSpaceManage
})
// Why: a scan row without a host id came from this app's own scan.
const ownerTarget = worktree.executionHostId
- ? runtimeTargetForOwnerHostId(worktree.executionHostId)
+ ? ipcOrRuntimeTargetForHostId(worktree.executionHostId)
: ({ kind: 'local' } as const)
return (
diff --git a/src/renderer/src/components/tab-group/useTabGroupCreationCommands.local-shell.test.ts b/src/renderer/src/components/tab-group/useTabGroupCreationCommands.local-shell.test.ts
index e07c2293d88..a6714e864a4 100644
--- a/src/renderer/src/components/tab-group/useTabGroupCreationCommands.local-shell.test.ts
+++ b/src/renderer/src/components/tab-group/useTabGroupCreationCommands.local-shell.test.ts
@@ -21,7 +21,9 @@ const mocks = vi.hoisted(() => ({
vi.mock('react', async () => await stubHeadlessReact())
vi.mock('@/lib/worktree-runtime-owner', () => ({
- getRuntimeEnvironmentIdForWorktree: mocks.getRuntimeEnvironmentIdForWorktree,
+ getRuntimeEnvironmentIdForWorktree: mocks.getRuntimeEnvironmentIdForWorktree
+}))
+vi.mock('@/lib/runtime-session-mirror-owners', () => ({
getRuntimeSessionMirrorEnvironmentIds: () => []
}))
diff --git a/src/renderer/src/components/tab-group/useTabGroupTabCloseCommands.structured-session.test.ts b/src/renderer/src/components/tab-group/useTabGroupTabCloseCommands.structured-session.test.ts
index 2334b475802..97f3c345be3 100644
--- a/src/renderer/src/components/tab-group/useTabGroupTabCloseCommands.structured-session.test.ts
+++ b/src/renderer/src/components/tab-group/useTabGroupTabCloseCommands.structured-session.test.ts
@@ -63,17 +63,13 @@ vi.mock('../../runtime/web-runtime-session-environment', () => ({
isWebRuntimeSessionActive: vi.fn(() => false)
}))
-vi.mock('@/lib/worktree-runtime-owner', () => ({
- getRuntimeEnvironmentIdForWorktree: () => null
-}))
+vi.mock('@/lib/worktree-runtime-owner', () => ({ getRuntimeEnvironmentIdForWorktree: () => null }))
vi.mock('@/runtime/remote-browser-tab-ownership', () => ({
browserWorkspaceHasRemoteOwner: () => false
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: mocks.callRuntimeRpc
-}))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: mocks.callRuntimeRpc }))
vi.mock('@/runtime/structured-agent-session-close', () => ({
closeStructuredAgentSession: mocks.closeStructuredAgentSession
diff --git a/src/renderer/src/components/task-page-github-reviewer-actions.ts b/src/renderer/src/components/task-page-github-reviewer-actions.ts
index 11c2cdcee92..05e2b725f5b 100644
--- a/src/renderer/src/components/task-page-github-reviewer-actions.ts
+++ b/src/renderer/src/components/task-page-github-reviewer-actions.ts
@@ -2,7 +2,7 @@ import type { Dispatch, SetStateAction } from 'react'
import { translate } from '@/i18n/i18n'
import { callRuntimeRpc } from '@/runtime/runtime-rpc-client'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import type { TaskPageGitHubMutationIntent } from '@/components/task-page-github-work-item-mutation-patches'
import {
normalizeGitHubReviewerLogins,
diff --git a/src/renderer/src/components/terminal-pane/ipc-pty-opencode-model.test.ts b/src/renderer/src/components/terminal-pane/ipc-pty-opencode-model.test.ts
index 631d965b91b..62357295875 100644
--- a/src/renderer/src/components/terminal-pane/ipc-pty-opencode-model.test.ts
+++ b/src/renderer/src/components/terminal-pane/ipc-pty-opencode-model.test.ts
@@ -4,10 +4,7 @@ import { callRuntimeRpc } from '../../runtime/runtime-rpc-client'
import { spawnIpcPty } from './ipc-pty-spawn-request'
import type { IpcPtyTransportOptions } from './pty-transport-types'
-vi.mock('../../runtime/runtime-rpc-client', async () => ({
- callRuntimeRpc: vi.fn(),
- RuntimeRpcCallError: (await import('../../runtime/runtime-rpc-result')).RuntimeRpcCallError
-}))
+vi.mock('../../runtime/runtime-rpc-client', () => ({ callRuntimeRpc: vi.fn() }))
const spawn = vi.fn(async () => ({ id: 'pty_host', isReattach: true }))
const options = (): IpcPtyTransportOptions => ({
worktreeId: 'folder:private',
diff --git a/src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts b/src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
index b5d21bfd26a..1ad1d6cb03e 100644
--- a/src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
+++ b/src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
@@ -47,7 +47,7 @@ import type {
} from './pty-transport-types'
import { createPtyOutputProcessor } from './pty-output-processor'
import { isSshSessionGoneError } from './pty-connection/pty-connect-limits'
-import { RuntimeRpcCallError, unwrapRuntimeRpcResult } from '../../runtime/runtime-rpc-client'
+import { RuntimeRpcCallError, unwrapRuntimeRpcResult } from '../../runtime/runtime-rpc-result'
import {
getRemoteRuntimePtyEnvironmentId,
getRemoteRuntimeTerminalHandle,
diff --git a/src/renderer/src/components/terminal-pane/terminal-ctrl-arrow-conpty.ts b/src/renderer/src/components/terminal-pane/terminal-ctrl-arrow-conpty.ts
index d59026604b7..65fd2bfaa71 100644
--- a/src/renderer/src/components/terminal-pane/terminal-ctrl-arrow-conpty.ts
+++ b/src/renderer/src/components/terminal-pane/terminal-ctrl-arrow-conpty.ts
@@ -2,10 +2,8 @@ import type { ExecutionHostId } from '../../../../shared/execution-host'
import { LOCAL_EXECUTION_HOST_ID } from '../../../../shared/execution-host'
import { isRemoteRuntimePtyId } from '../../../../shared/remote-runtime-pty-id'
import { getConnectionIdFromState } from '@/lib/connection-context'
-import {
- getExecutionHostIdForWorktree,
- type WorktreeRuntimeOwnerState
-} from '@/lib/worktree-runtime-owner'
+import { getExecutionHostIdForWorktree } from '@/lib/worktree-runtime-owner'
+import type { WorktreeRuntimeOwnerState } from '@/lib/worktree-runtime-owner-state'
import { isLocalNativeWindowsConpty } from '@/lib/pane-manager/windows-pty-compatibility'
import type { PaneCwdMap } from './resolve-split-cwd'
import type { PtyTransport } from './pty-transport-types'
diff --git a/src/renderer/src/components/terminal-pane/terminal-fit-restore.test.ts b/src/renderer/src/components/terminal-pane/terminal-fit-restore.test.ts
index e526b64f3c9..6d9028b5b13 100644
--- a/src/renderer/src/components/terminal-pane/terminal-fit-restore.test.ts
+++ b/src/renderer/src/components/terminal-pane/terminal-fit-restore.test.ts
@@ -6,9 +6,7 @@ import {
} from '@/runtime/runtime-terminal-stream'
import { restoreTerminalFitToDesktop, restoreTerminalFitsToDesktop } from './terminal-fit-restore'
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: vi.fn()
-}))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: vi.fn() }))
vi.mock('@/runtime/runtime-terminal-stream', () => ({
getRemoteRuntimePtyEnvironmentId: vi.fn(),
diff --git a/src/renderer/src/components/terminal-pane/terminal-host-workspace-file.ts b/src/renderer/src/components/terminal-pane/terminal-host-workspace-file.ts
index cfccbf5b5b4..8a1b756d1a2 100644
--- a/src/renderer/src/components/terminal-pane/terminal-host-workspace-file.ts
+++ b/src/renderer/src/components/terminal-pane/terminal-host-workspace-file.ts
@@ -1,9 +1,6 @@
import { callHostRoute } from '@/runtime/host-route-call'
-import {
- hostRouteForAuthority,
- runtimeTargetEnvironmentId,
- type RuntimeClientTarget
-} from '@/runtime/runtime-client-target'
+import { hostRouteForAuthority, runtimeTargetEnvironmentId } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
import { statRuntimePath } from '@/runtime/runtime-file-metadata-client'
import { isRemoteRuntimeFileOperation } from '@/runtime/runtime-file-routing'
diff --git a/src/renderer/src/components/terminal-workspace-keydown.test.ts b/src/renderer/src/components/terminal-workspace-keydown.test.ts
index a253c9b4e65..09167292355 100644
--- a/src/renderer/src/components/terminal-workspace-keydown.test.ts
+++ b/src/renderer/src/components/terminal-workspace-keydown.test.ts
@@ -50,9 +50,7 @@ vi.mock('./terminal/terminal-tab-actions', () => ({ closeTerminalTab: mocks.clos
vi.mock('@/runtime/structured-agent-session-close', () => ({
closeStructuredAgentSession: mocks.closeStructuredAgentSession
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: mocks.callRuntimeRpc
-}))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: mocks.callRuntimeRpc }))
vi.mock('@/lib/structured-agent-session-launch', () => ({
cancelStructuredAgentLaunch: mocks.cancelStructuredAgentLaunch
}))
diff --git a/src/renderer/src/hooks/composer-state/github-provider-selection.ts b/src/renderer/src/hooks/composer-state/github-provider-selection.ts
index 9c303d76205..e4ccacf7ae0 100644
--- a/src/renderer/src/hooks/composer-state/github-provider-selection.ts
+++ b/src/renderer/src/hooks/composer-state/github-provider-selection.ts
@@ -39,7 +39,7 @@ import {
getLinkedItemDisplayName
} from '@/components/sidebar/folder-workspace-composer-helpers'
import { shouldApplyWorkspaceSourceAutoName } from '../../../../shared/new-workspace/workspace-source'
-import { runtimeTargetForOwnerHostId } from '@/runtime/runtime-client-target'
+import { ipcOrRuntimeTargetForHostId } from '@/runtime/runtime-client-target'
import { getRepoExecutionHostId } from '../../../../shared/execution-host'
import { resolveGitHubPrStartPointForRepo } from '@/lib/github-pr-start-point'
import { getForkPushWarning } from '../fork-push-warning'
@@ -136,7 +136,7 @@ export function useGitHubProviderSelection(input: GitHubProviderSelectionInput)
const resolvePrBase = resolveGitHubPrStartPointForRepo({
repoId: runRepo.id,
prNumber: identity.number,
- target: runtimeTargetForOwnerHostId(getRepoExecutionHostId(runRepo)),
+ target: ipcOrRuntimeTargetForHostId(getRepoExecutionHostId(runRepo)),
...(normalizedItem.branchName ? { headRefName: normalizedItem.branchName } : {}),
...(normalizedItem.baseRefName ? { baseRefName: normalizedItem.baseRefName } : {}),
...(normalizedItem.isCrossRepository !== undefined
diff --git a/src/renderer/src/hooks/composer-state/github-submit-resolution.ts b/src/renderer/src/hooks/composer-state/github-submit-resolution.ts
index cca31412cdb..a82a948bb20 100644
--- a/src/renderer/src/hooks/composer-state/github-submit-resolution.ts
+++ b/src/renderer/src/hooks/composer-state/github-submit-resolution.ts
@@ -34,7 +34,7 @@ import { useCallback } from 'react'
import { resolveGitHubWorkItemIdentity } from '@/lib/github-work-item-identity'
import { getLinkedWorkItemProvider } from '@/lib/new-workspace'
import { resolveGitHubPrStartPointForRepo } from '@/lib/github-pr-start-point'
-import { runtimeTargetForOwnerHostId } from '@/runtime/runtime-client-target'
+import { ipcOrRuntimeTargetForHostId } from '@/runtime/runtime-client-target'
import { getRepoExecutionHostId } from '../../../../shared/execution-host'
import {
getSmartGitHubSubmitResolution,
@@ -105,7 +105,7 @@ export function useGitHubSubmitResolution(input: GitHubSubmitResolutionInput) {
(await resolveGitHubPrStartPointForRepo({
repoId: selectedRepo.id,
prNumber: startPointIdentity.number,
- target: runtimeTargetForOwnerHostId(getRepoExecutionHostId(selectedRepo)),
+ target: ipcOrRuntimeTargetForHostId(getRepoExecutionHostId(selectedRepo)),
...(startPointSelection.item.branchName
? { headRefName: startPointSelection.item.branchName }
: {}),
@@ -199,7 +199,7 @@ export function useGitHubSubmitResolution(input: GitHubSubmitResolutionInput) {
? await resolveGitHubPrStartPointForRepo({
repoId: selectedRepo.id,
prNumber: itemIdentity.number,
- target: runtimeTargetForOwnerHostId(getRepoExecutionHostId(selectedRepo)),
+ target: ipcOrRuntimeTargetForHostId(getRepoExecutionHostId(selectedRepo)),
...(item.branchName ? { headRefName: item.branchName } : {}),
...(item.baseRefName ? { baseRefName: item.baseRefName } : {}),
...(item.isCrossRepository !== undefined
diff --git a/src/renderer/src/hooks/composer-state/runtime-target-model.ts b/src/renderer/src/hooks/composer-state/runtime-target-model.ts
index f767256fa43..5d7ea6afeaa 100644
--- a/src/renderer/src/hooks/composer-state/runtime-target-model.ts
+++ b/src/renderer/src/hooks/composer-state/runtime-target-model.ts
@@ -1,4 +1,4 @@
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import type { RefObject } from 'react'
import type { ExecutionHostId, ParsedExecutionHost } from '../../../../shared/execution-host'
import type { Repo } from '../../../../shared/repo-types'
diff --git a/src/renderer/src/hooks/composer-state/runtime-target-selection.ts b/src/renderer/src/hooks/composer-state/runtime-target-selection.ts
index 3a2cb98e48b..65dbc84bd39 100644
--- a/src/renderer/src/hooks/composer-state/runtime-target-selection.ts
+++ b/src/renderer/src/hooks/composer-state/runtime-target-selection.ts
@@ -1,4 +1,4 @@
-import { runtimeTargetForOwnerHostId } from '@/runtime/runtime-client-target'
+import { ipcOrRuntimeTargetForHostId } from '@/runtime/runtime-client-target'
import type { ComposerRuntimeTargetSelectionInput } from './composer-target-input-contracts'
import { useEffect, useMemo, useRef } from 'react'
@@ -221,7 +221,7 @@ export function useComposerRuntimeTargetSelection(input: ComposerRuntimeTargetSe
: null
const selectedRepoTarget = useMemo(
- () => (selectedRepo ? runtimeTargetForOwnerHostId(getRepoExecutionHostId(selectedRepo)) : null),
+ () => (selectedRepo ? ipcOrRuntimeTargetForHostId(getRepoExecutionHostId(selectedRepo)) : null),
[selectedRepo]
)
diff --git a/src/renderer/src/hooks/installed-agent-skill-discovery.test.ts b/src/renderer/src/hooks/installed-agent-skill-discovery.test.ts
index 73616fb065b..42dbb3c5ce3 100644
--- a/src/renderer/src/hooks/installed-agent-skill-discovery.test.ts
+++ b/src/renderer/src/hooks/installed-agent-skill-discovery.test.ts
@@ -1,6 +1,6 @@
import { afterEach, describe, expect, it, vi } from 'vitest'
import type { SkillDiscoveryResult, SkillDiscoveryTarget } from '../../../shared/skills'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
const discoverSkillsForRuntimeTarget = vi.hoisted(() =>
vi.fn<
diff --git a/src/renderer/src/hooks/installed-agent-skill-discovery.ts b/src/renderer/src/hooks/installed-agent-skill-discovery.ts
index 192219a98e0..872d9045bee 100644
--- a/src/renderer/src/hooks/installed-agent-skill-discovery.ts
+++ b/src/renderer/src/hooks/installed-agent-skill-discovery.ts
@@ -3,7 +3,7 @@ import type {
SkillDiscoveryTarget,
SkillSourceKind
} from '../../../shared/skills'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { discoverSkillsForRuntimeTarget } from '@/runtime/runtime-skills-client'
import { INSTALLED_AGENT_SKILLS_CHANGED_EVENT } from './installed-agent-skills-change-event'
import {
diff --git a/src/renderer/src/hooks/ipc-events/browser-state-capture-paint-hold.test.ts b/src/renderer/src/hooks/ipc-events/browser-state-capture-paint-hold.test.ts
index 90cf727326d..0d22ac5aa8e 100644
--- a/src/renderer/src/hooks/ipc-events/browser-state-capture-paint-hold.test.ts
+++ b/src/renderer/src/hooks/ipc-events/browser-state-capture-paint-hold.test.ts
@@ -3,9 +3,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest'
vi.mock('../../store', () => ({
useAppStore: { getState: () => ({}) }
}))
-vi.mock('@/lib/worktree-runtime-owner', () => ({
- getRuntimeEnvironmentIdForWorktree: () => null
-}))
+vi.mock('@/lib/worktree-runtime-owner', () => ({ getRuntimeEnvironmentIdForWorktree: () => null }))
vi.mock('@/components/browser-pane/describe-page/live-browser-url-registry', () => ({
rememberLiveBrowserUrl: vi.fn()
}))
diff --git a/src/renderer/src/hooks/ipc-events/browser-state-open-link-profile.test.ts b/src/renderer/src/hooks/ipc-events/browser-state-open-link-profile.test.ts
index 9db3d4ee5f5..3ddfc0d0766 100644
--- a/src/renderer/src/hooks/ipc-events/browser-state-open-link-profile.test.ts
+++ b/src/renderer/src/hooks/ipc-events/browser-state-open-link-profile.test.ts
@@ -10,9 +10,7 @@ const { createBrowserTabMock, storeState } = vi.hoisted(() => ({
vi.mock('../../store', () => ({
useAppStore: { getState: () => storeState.value }
}))
-vi.mock('@/lib/worktree-runtime-owner', () => ({
- getRuntimeEnvironmentIdForWorktree: () => null
-}))
+vi.mock('@/lib/worktree-runtime-owner', () => ({ getRuntimeEnvironmentIdForWorktree: () => null }))
vi.mock('@/components/browser-pane/describe-page/live-browser-url-registry', () => ({
rememberLiveBrowserUrl: vi.fn()
}))
diff --git a/src/renderer/src/hooks/ipc-events/tab-lifecycle-ipc-bridge.test.ts b/src/renderer/src/hooks/ipc-events/tab-lifecycle-ipc-bridge.test.ts
index 3d7b89795ba..99955b12767 100644
--- a/src/renderer/src/hooks/ipc-events/tab-lifecycle-ipc-bridge.test.ts
+++ b/src/renderer/src/hooks/ipc-events/tab-lifecycle-ipc-bridge.test.ts
@@ -8,9 +8,7 @@ const mocks = vi.hoisted(() => {
vi.mock('../../store', () => ({ useAppStore: { getState: () => mocks.state } }))
vi.mock('@/lib/focus-terminal-tab-surface', () => ({ focusTerminalTabSurface: vi.fn() }))
-vi.mock('@/lib/worktree-runtime-owner', () => ({
- getRuntimeEnvironmentIdForWorktree: () => null
-}))
+vi.mock('@/lib/worktree-runtime-owner', () => ({ getRuntimeEnvironmentIdForWorktree: () => null }))
vi.mock('@/runtime/web-runtime-terminal-creation', () => ({
createWebRuntimeSessionTerminal: vi.fn().mockResolvedValue({ status: 'failed', message: '' })
}))
diff --git a/src/renderer/src/hooks/use-active-skill-discovery-runtime-target.ts b/src/renderer/src/hooks/use-active-skill-discovery-runtime-target.ts
index f5edafed206..9a08f3159a0 100644
--- a/src/renderer/src/hooks/use-active-skill-discovery-runtime-target.ts
+++ b/src/renderer/src/hooks/use-active-skill-discovery-runtime-target.ts
@@ -1,9 +1,7 @@
import { useMemo } from 'react'
import { getSingleFocusedRuntimeEnvironmentId } from '@/lib/single-runtime-legacy-owner'
-import {
- runtimeTargetForOwnerEnvironment,
- type RuntimeClientTarget
-} from '@/runtime/runtime-client-target'
+import { runtimeTargetForOwnerEnvironment } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { useAppStore } from '@/store'
/** Distinguishes "not known yet" from "known to be the local host", without
diff --git a/src/renderer/src/hooks/useActiveProjectSkillRuntime.ts b/src/renderer/src/hooks/useActiveProjectSkillRuntime.ts
index 2d82512b9ce..0efe927c3bf 100644
--- a/src/renderer/src/hooks/useActiveProjectSkillRuntime.ts
+++ b/src/renderer/src/hooks/useActiveProjectSkillRuntime.ts
@@ -3,7 +3,7 @@ import { useShallow } from 'zustand/react/shallow'
import type { ProjectExecutionRuntimeResolution } from '../../../shared/project-execution-runtime'
import type { SkillDiscoveryTarget } from '../../../shared/skills'
import { useActiveSkillDiscoveryRuntimeTarget } from './use-active-skill-discovery-runtime-target'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import {
getGlobalWindowsExecutionRuntimeContext,
getLocalProjectExecutionRuntimeContext
diff --git a/src/renderer/src/hooks/useAgentDetectionTarget.ts b/src/renderer/src/hooks/useAgentDetectionTarget.ts
index 81bb7ff6b90..ea069a5cd66 100644
--- a/src/renderer/src/hooks/useAgentDetectionTarget.ts
+++ b/src/renderer/src/hooks/useAgentDetectionTarget.ts
@@ -3,9 +3,9 @@ import { useAppStore } from '@/store'
import { getConnectionIdFromState } from '@/lib/connection-owner-resolution'
import {
getExplicitRuntimeEnvironmentIdForWorktree,
- getExecutionHostIdForWorktree,
- type WorktreeRuntimeOwnerState
+ getExecutionHostIdForWorktree
} from '@/lib/worktree-runtime-owner'
+import type { WorktreeRuntimeOwnerState } from '@/lib/worktree-runtime-owner-state'
import { getResolvedExecutionHostIdForWorktree } from '@/lib/resolved-worktree-execution-host'
import { parseExecutionHostId } from '../../../shared/execution-host'
import { parseWorkspaceKey } from '../../../shared/workspace-scope'
diff --git a/src/renderer/src/hooks/useGitHubRepoMetadata.ts b/src/renderer/src/hooks/useGitHubRepoMetadata.ts
index cb08e0a198d..613ed955278 100644
--- a/src/renderer/src/hooks/useGitHubRepoMetadata.ts
+++ b/src/renderer/src/hooks/useGitHubRepoMetadata.ts
@@ -1,5 +1,5 @@
import { callRuntimeRpc } from '@/runtime/runtime-rpc-client'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import type {
GitHubAssignableUser,
GitHubOwnerRepo
diff --git a/src/renderer/src/hooks/useGitHubSlugMetadata.test.tsx b/src/renderer/src/hooks/useGitHubSlugMetadata.test.tsx
index b1702dd176f..c3c4f1d7cb2 100644
--- a/src/renderer/src/hooks/useGitHubSlugMetadata.test.tsx
+++ b/src/renderer/src/hooks/useGitHubSlugMetadata.test.tsx
@@ -14,9 +14,7 @@ const apiMocks = vi.hoisted(() => ({
listAssignableUsersBySlug: vi.fn()
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: vi.fn()
-}))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: vi.fn() }))
const roots: Root[] = []
diff --git a/src/renderer/src/hooks/useGitHubSlugMetadata.ts b/src/renderer/src/hooks/useGitHubSlugMetadata.ts
index 84649cee136..69668e7458d 100644
--- a/src/renderer/src/hooks/useGitHubSlugMetadata.ts
+++ b/src/renderer/src/hooks/useGitHubSlugMetadata.ts
@@ -1,5 +1,5 @@
import { callRuntimeRpc } from '@/runtime/runtime-rpc-client'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import type { GitHubAssignableUser } from '../../../shared/github/pull-request-types'
import type {
ListAssignableUsersBySlugResult,
diff --git a/src/renderer/src/hooks/useIssueMetadata.test.tsx b/src/renderer/src/hooks/useIssueMetadata.test.tsx
index 95191363322..6486d8edad5 100644
--- a/src/renderer/src/hooks/useIssueMetadata.test.tsx
+++ b/src/renderer/src/hooks/useIssueMetadata.test.tsx
@@ -26,9 +26,7 @@ vi.mock('@/runtime/runtime-linear-project-client', () => ({
linearTeamMembers: linearMocks.linearTeamMembers
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: runtimeMocks.callRuntimeRpc
-}))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: runtimeMocks.callRuntimeRpc }))
const roots: Root[] = []
diff --git a/src/renderer/src/lib/activate-ai-vault-structured-session.ts b/src/renderer/src/lib/activate-ai-vault-structured-session.ts
index d33614b8c21..a0ab352ce5c 100644
--- a/src/renderer/src/lib/activate-ai-vault-structured-session.ts
+++ b/src/renderer/src/lib/activate-ai-vault-structured-session.ts
@@ -5,11 +5,8 @@ import { activateAndRevealWorktree } from './worktree-activation'
import { activateStructuredAgentSessionById } from './structured-agent-session-tab-activation'
import { useAppStore } from '@/store'
import { getRuntimeEnvironmentIdForWorktree } from './worktree-runtime-owner'
-import {
- callRuntimeRpc,
- runtimeEnvironmentSupportsCapability,
- type RuntimeClientTarget
-} from '@/runtime/runtime-rpc-client'
+import { callRuntimeRpc, runtimeEnvironmentSupportsCapability } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { runtimeTargetForOwnerEnvironment } from '@/runtime/runtime-client-target'
import { toRuntimeWorktreeSelector } from '@/runtime/runtime-worktree-selector'
import { refreshLocalStructuredSessionWorktreeTabs } from '@/runtime/local-structured-session-tabs-sync/inventory-refresh'
diff --git a/src/renderer/src/lib/active-agent-note-send-explicit-target.test.ts b/src/renderer/src/lib/active-agent-note-send-explicit-target.test.ts
index aa02b12dcbb..09cc11338f5 100644
--- a/src/renderer/src/lib/active-agent-note-send-explicit-target.test.ts
+++ b/src/renderer/src/lib/active-agent-note-send-explicit-target.test.ts
@@ -37,8 +37,8 @@ vi.mock('@/store', () => ({
)
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: testState.callRuntimeRpc,
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: testState.callRuntimeRpc }))
+vi.mock('@/runtime/runtime-rpc-result', () => ({
RuntimeRpcCallError: testState.RuntimeRpcCallError
}))
diff --git a/src/renderer/src/lib/active-agent-note-send-focused-session.test.ts b/src/renderer/src/lib/active-agent-note-send-focused-session.test.ts
index 82f1a6674fd..26d62378275 100644
--- a/src/renderer/src/lib/active-agent-note-send-focused-session.test.ts
+++ b/src/renderer/src/lib/active-agent-note-send-focused-session.test.ts
@@ -33,8 +33,8 @@ vi.mock('@/store', () => ({
)
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: testState.callRuntimeRpc,
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: testState.callRuntimeRpc }))
+vi.mock('@/runtime/runtime-rpc-result', () => ({
RuntimeRpcCallError: testState.RuntimeRpcCallError
}))
diff --git a/src/renderer/src/lib/active-agent-note-send-runtime-error-codes.test.ts b/src/renderer/src/lib/active-agent-note-send-runtime-error-codes.test.ts
index baa41a7d139..939c5ce13a3 100644
--- a/src/renderer/src/lib/active-agent-note-send-runtime-error-codes.test.ts
+++ b/src/renderer/src/lib/active-agent-note-send-runtime-error-codes.test.ts
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest'
-import { hasRuntimeRpcErrorCode, RuntimeRpcCallError } from '@/runtime/runtime-rpc-client'
+import { hasRuntimeRpcErrorCode, RuntimeRpcCallError } from '@/runtime/runtime-rpc-result'
import {
isRuntimeTerminalNotWritable,
isRuntimeTerminalUnavailable,
diff --git a/src/renderer/src/lib/active-agent-note-send-target-detection.test.ts b/src/renderer/src/lib/active-agent-note-send-target-detection.test.ts
index 7519612ba32..14d3705e676 100644
--- a/src/renderer/src/lib/active-agent-note-send-target-detection.test.ts
+++ b/src/renderer/src/lib/active-agent-note-send-target-detection.test.ts
@@ -41,8 +41,8 @@ vi.mock('@/store', () => ({
)
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: testState.callRuntimeRpc,
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: testState.callRuntimeRpc }))
+vi.mock('@/runtime/runtime-rpc-result', () => ({
RuntimeRpcCallError: testState.RuntimeRpcCallError
}))
diff --git a/src/renderer/src/lib/active-agent-note-send.ts b/src/renderer/src/lib/active-agent-note-send.ts
index 95e803ddcf5..4ac97a980f2 100644
--- a/src/renderer/src/lib/active-agent-note-send.ts
+++ b/src/renderer/src/lib/active-agent-note-send.ts
@@ -1,8 +1,6 @@
import type { RuntimeTerminalWait } from '../../../shared/runtime-types'
-import {
- runtimeTargetForOwnerEnvironment,
- type RuntimeClientTarget
-} from '@/runtime/runtime-client-target'
+import { runtimeTargetForOwnerEnvironment } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { useAppStore } from '@/store'
import { callRuntimeRpc } from '@/runtime/runtime-rpc-client'
import { getRuntimeEnvironmentIdForWorktree } from '@/lib/worktree-runtime-owner'
diff --git a/src/renderer/src/lib/active-agent-note-target.ts b/src/renderer/src/lib/active-agent-note-target.ts
index 414da293ff8..1e23c7a0d0a 100644
--- a/src/renderer/src/lib/active-agent-note-target.ts
+++ b/src/renderer/src/lib/active-agent-note-target.ts
@@ -1,8 +1,6 @@
import type { RuntimeTerminalListResult } from '../../../shared/runtime-types'
-import {
- runtimeTargetForOwnerEnvironment,
- type RuntimeClientTarget
-} from '@/runtime/runtime-client-target'
+import { runtimeTargetForOwnerEnvironment } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { toHostSessionTabId } from '../../../shared/terminal-surface-id'
import {
AGENT_STATUS_STALE_AFTER_MS,
@@ -10,10 +8,8 @@ import {
} from '../../../shared/agent-status-types'
import type { AppState } from '@/store/types'
import { callRuntimeRpc } from '@/runtime/runtime-rpc-client'
-import {
- getRuntimeEnvironmentIdForWorktree,
- type WorktreeRuntimeOwnerState
-} from '@/lib/worktree-runtime-owner'
+import { getRuntimeEnvironmentIdForWorktree } from '@/lib/worktree-runtime-owner'
+import type { WorktreeRuntimeOwnerState } from '@/lib/worktree-runtime-owner-state'
import { toRuntimeWorktreeSelector } from '@/runtime/runtime-worktree-selector'
import { isTerminalLeafId, makePaneKey } from '../../../shared/stable-pane-id'
import type { TerminalLayoutSnapshot } from '../../../shared/terminal-tab-types'
diff --git a/src/renderer/src/lib/active-agent-terminal-send-readiness.ts b/src/renderer/src/lib/active-agent-terminal-send-readiness.ts
index eab15eb5c7a..aa22b1250d8 100644
--- a/src/renderer/src/lib/active-agent-terminal-send-readiness.ts
+++ b/src/renderer/src/lib/active-agent-terminal-send-readiness.ts
@@ -1,8 +1,9 @@
import type { RuntimeTerminalAgentStatus } from '../../../shared/runtime-types'
import { hasRuntimeRpcErrorCode } from '../../../shared/runtime-rpc-error-code'
import type { ActiveAgentNotesSendFailureCode } from './active-agent-note-send-result'
-import { callRuntimeRpc, RuntimeRpcCallError } from '@/runtime/runtime-rpc-client'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import { callRuntimeRpc } from '@/runtime/runtime-rpc-client'
+import { RuntimeRpcCallError } from '@/runtime/runtime-rpc-result'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import {
runtimeFailureCode,
TERMINAL_RUNTIME_FAILURE_CODES
diff --git a/src/renderer/src/lib/adopt-agent-background-session-tab.ts b/src/renderer/src/lib/adopt-agent-background-session-tab.ts
index ec604137645..c590767a887 100644
--- a/src/renderer/src/lib/adopt-agent-background-session-tab.ts
+++ b/src/renderer/src/lib/adopt-agent-background-session-tab.ts
@@ -5,7 +5,7 @@ import { bindAutomationTerminal } from '@/lib/automation-terminal-ownership'
import { createBrowserUuid } from '@/lib/browser-uuid'
import { retireProvider, retireUnownedTerminal } from '@/lib/retire-unowned-background-terminal'
import { isTerminalTabPresent } from '@/store/slices/terminal-tab-retirement'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
type Store = ReturnType
type RegisterArgs = Parameters
diff --git a/src/renderer/src/lib/agent-launch-caller-permissions.test.ts b/src/renderer/src/lib/agent-launch-caller-permissions.test.ts
index 66d4fbf1c0c..2d9bda0ce4e 100644
--- a/src/renderer/src/lib/agent-launch-caller-permissions.test.ts
+++ b/src/renderer/src/lib/agent-launch-caller-permissions.test.ts
@@ -51,7 +51,8 @@ vi.mock('@/runtime/local-runtime-capabilities', () => ({
}))
// A launch the host delivers waits on its reply; these tests read only what was sent.
const callRuntimeRpc = vi.hoisted(() => vi.fn(() => new Promise(() => {})))
-vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc, RuntimeRpcCallError: Error }))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc }))
+vi.mock('@/runtime/runtime-rpc-result', () => ({ RuntimeRpcCallError: Error }))
function launchesThroughHost(profile: AgentLaunchCallerProfile): boolean {
return newTabPromptLaunchesThroughHost({
diff --git a/src/renderer/src/lib/agent-launch-caller-placement.test.ts b/src/renderer/src/lib/agent-launch-caller-placement.test.ts
index d74ef4acb94..85f3827649f 100644
--- a/src/renderer/src/lib/agent-launch-caller-placement.test.ts
+++ b/src/renderer/src/lib/agent-launch-caller-placement.test.ts
@@ -51,7 +51,8 @@ vi.mock('@/runtime/local-runtime-capabilities', () => ({
}))
// A launch the host delivers waits on its reply; these tests read only what was sent.
const callRuntimeRpc = vi.hoisted(() => vi.fn(() => new Promise(() => {})))
-vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc, RuntimeRpcCallError: Error }))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc }))
+vi.mock('@/runtime/runtime-rpc-result', () => ({ RuntimeRpcCallError: Error }))
function launchesThroughHost(profile: AgentLaunchCallerProfile): boolean {
return newTabPromptLaunchesThroughHost({
diff --git a/src/renderer/src/lib/agent-launch-caller-prompt-transport.test.ts b/src/renderer/src/lib/agent-launch-caller-prompt-transport.test.ts
index 3aa6ff6b02b..b69f2bb6611 100644
--- a/src/renderer/src/lib/agent-launch-caller-prompt-transport.test.ts
+++ b/src/renderer/src/lib/agent-launch-caller-prompt-transport.test.ts
@@ -61,7 +61,8 @@ const callRuntimeRpc = vi.hoisted(() =>
receipt: { mode: 'terminal', preferred: 'terminal', reason: 'user_default', detail: 'x' }
}))
)
-vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc, RuntimeRpcCallError: Error }))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc }))
+vi.mock('@/runtime/runtime-rpc-result', () => ({ RuntimeRpcCallError: Error }))
/** What the window's own launch command carries; a launch started by the host queues none. */
function commandCarries(text: string): boolean {
diff --git a/src/renderer/src/lib/agent-launch-through-host.ts b/src/renderer/src/lib/agent-launch-through-host.ts
index 59b8e202cd4..3ce247f9555 100644
--- a/src/renderer/src/lib/agent-launch-through-host.ts
+++ b/src/renderer/src/lib/agent-launch-through-host.ts
@@ -17,7 +17,8 @@ import {
isAgentLaunchPaneSpawnHeld
} from '@/lib/agent-launch-pane-spawn-hold'
import { seedNativeChatAppliedSessionOptions } from '@/components/native-chat/native-chat-session-option-cache'
-import { callRuntimeRpc, RuntimeRpcCallError } from '@/runtime/runtime-rpc-client'
+import { callRuntimeRpc } from '@/runtime/runtime-rpc-client'
+import { RuntimeRpcCallError } from '@/runtime/runtime-rpc-result'
import { createAgentSessionOperationId } from '@/runtime/agent-session-operation-id'
import { isAgentLaunchResult } from '../../../shared/agent-launch-intent'
import { AGENT_LAUNCH_TAB_CLOSED_CODE } from '../../../shared/agent-launch-tab-closed'
diff --git a/src/renderer/src/lib/automation-session-observer.test.ts b/src/renderer/src/lib/automation-session-observer.test.ts
index 2e1488abbf4..350392f09b3 100644
--- a/src/renderer/src/lib/automation-session-observer.test.ts
+++ b/src/renderer/src/lib/automation-session-observer.test.ts
@@ -36,9 +36,7 @@ vi.mock('@/components/terminal-pane/pty-data-sidecar-subscriptions', () => ({
subscribeToPtyData: mockSubscribeToPtyData
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: mockCallRuntimeRpc
-}))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: mockCallRuntimeRpc }))
vi.mock('@/runtime/remote-runtime-terminal-multiplexer', () => ({
getRemoteRuntimeTerminalMultiplexer: () => ({ subscribeTerminal: mockSubscribeTerminal })
diff --git a/src/renderer/src/lib/codex-pane-selection-lane.ts b/src/renderer/src/lib/codex-pane-selection-lane.ts
index 0bd22831924..a6284dac938 100644
--- a/src/renderer/src/lib/codex-pane-selection-lane.ts
+++ b/src/renderer/src/lib/codex-pane-selection-lane.ts
@@ -1,5 +1,5 @@
import type { AppState } from '@/store'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { parseRemoteRuntimePtyId } from '@/runtime/runtime-terminal-stream'
import {
getCodexSelectionLaneKey,
diff --git a/src/renderer/src/lib/codex-session-restart.ts b/src/renderer/src/lib/codex-session-restart.ts
index e5d42d51ade..4f8289e6154 100644
--- a/src/renderer/src/lib/codex-session-restart.ts
+++ b/src/renderer/src/lib/codex-session-restart.ts
@@ -23,7 +23,7 @@ import {
resolveCodexPaneSelectionLane
} from './codex-pane-selection-lane'
import type { CodexAccountSelectionTarget } from '../../../shared/codex-selection-lane'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import type { TuiAgent } from '../../../shared/tui-agent'
// Why: prompt integrations such as Starship can outlast the daemon's 300ms
diff --git a/src/renderer/src/lib/create-untitled-markdown.test.ts b/src/renderer/src/lib/create-untitled-markdown.test.ts
index c888e048389..20f6f91e900 100644
--- a/src/renderer/src/lib/create-untitled-markdown.test.ts
+++ b/src/renderer/src/lib/create-untitled-markdown.test.ts
@@ -9,7 +9,7 @@ import {
type RuntimeEnvironmentCallRequest
} from '@/runtime/runtime-compatibility-test-fixture'
import { clearRuntimeCompatibilityCacheForTests } from '@/runtime/runtime-rpc-client'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
const LOCAL: RuntimeClientTarget = { kind: 'local' }
diff --git a/src/renderer/src/lib/create-untitled-markdown.ts b/src/renderer/src/lib/create-untitled-markdown.ts
index 8ce85b3f327..7427924d7fa 100644
--- a/src/renderer/src/lib/create-untitled-markdown.ts
+++ b/src/renderer/src/lib/create-untitled-markdown.ts
@@ -1,4 +1,4 @@
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import {
createRuntimePath,
deleteRuntimePath,
diff --git a/src/renderer/src/lib/default-creation-host.ts b/src/renderer/src/lib/default-creation-host.ts
index 4633e3905e6..b1f586187da 100644
--- a/src/renderer/src/lib/default-creation-host.ts
+++ b/src/renderer/src/lib/default-creation-host.ts
@@ -1,10 +1,8 @@
import type { GlobalSettings } from '../../../shared/global-settings-types'
import type { TaskSourceContext } from '../../../shared/task-source-context'
import { getSettingsFocusedExecutionHostId } from '../../../shared/execution-host'
-import {
- runtimeTargetForOwnerHostId,
- type RuntimeClientTarget
-} from '@/runtime/runtime-client-target'
+import { ipcOrRuntimeTargetForHostId } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { taskSourceRuntimeTarget } from './task-source-runtime-target'
type DefaultHostSettings = Pick | null | undefined
@@ -12,7 +10,7 @@ type DefaultHostSettings = Pick |
// Projects the shared primitive; the exported readers below are the sanctioned ways to reach it.
function readDefaultHost(settings: DefaultHostSettings): RuntimeClientTarget {
return (
- runtimeTargetForOwnerHostId(getSettingsFocusedExecutionHostId(settings)) ?? { kind: 'local' }
+ ipcOrRuntimeTargetForHostId(getSettingsFocusedExecutionHostId(settings)) ?? { kind: 'local' }
)
}
diff --git a/src/renderer/src/lib/editor-file-operation-owner.ts b/src/renderer/src/lib/editor-file-operation-owner.ts
index ecf2fa6f859..d451f3cce02 100644
--- a/src/renderer/src/lib/editor-file-operation-owner.ts
+++ b/src/renderer/src/lib/editor-file-operation-owner.ts
@@ -2,10 +2,8 @@ import { parseExecutionHostId, type ExecutionHostId } from '../../../shared/exec
import { FLOATING_TERMINAL_WORKTREE_ID } from '../../../shared/constants'
import { parseWorkspaceKey } from '../../../shared/workspace-scope'
import type { AppState } from '@/store/types'
-import {
- runtimeTargetForOwnerEnvironment,
- type RuntimeClientTarget
-} from '@/runtime/runtime-client-target'
+import { runtimeTargetForOwnerEnvironment } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { findFolderWorkspaceOwner } from './folder-workspace-runtime-owner'
import {
assertWorktreeOperationGenerationSnapshotCurrent,
@@ -14,10 +12,10 @@ import {
} from './worktree-operation-generation'
import {
getFloatingWorkspaceOperationRoute,
- resolveExplicitWorktreeOperationRouteResult,
resolveWorktreeOperationRoute,
type WorktreeOperationRoute
} from './worktree-operation-route'
+import { resolveExplicitWorktreeOperationRouteResult } from './worktree-operation-catalog-route'
export type EditorFileOperationProvenance = {
generation: WorktreeOperationGenerationSnapshot
diff --git a/src/renderer/src/lib/ephemeral-vm-workspace-target.test.ts b/src/renderer/src/lib/ephemeral-vm-workspace-target.test.ts
index 1408fcbe206..3c4282db862 100644
--- a/src/renderer/src/lib/ephemeral-vm-workspace-target.test.ts
+++ b/src/renderer/src/lib/ephemeral-vm-workspace-target.test.ts
@@ -5,9 +5,7 @@ import {
} from './ephemeral-vm-workspace-target'
import type { ProjectHostSetupResult } from '../../../shared/project-types'
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- assertRuntimeEnvironmentCapability: vi.fn()
-}))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ assertRuntimeEnvironmentCapability: vi.fn() }))
import { assertRuntimeEnvironmentCapability } from '@/runtime/runtime-rpc-client'
diff --git a/src/renderer/src/lib/file-owner-runtime-target.ts b/src/renderer/src/lib/file-owner-runtime-target.ts
index e39ba815517..dadf687cac6 100644
--- a/src/renderer/src/lib/file-owner-runtime-target.ts
+++ b/src/renderer/src/lib/file-owner-runtime-target.ts
@@ -1,7 +1,5 @@
-import {
- runtimeTargetForOwnerEnvironment,
- type RuntimeClientTarget
-} from '@/runtime/runtime-client-target'
+import { runtimeTargetForOwnerEnvironment } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { runtimeTargetForWorkspaceOwner, resolveOwner } from './resolve-owner'
import type { WorktreeOperationRouteState } from './worktree-operation-route'
diff --git a/src/renderer/src/lib/github-pr-start-point.ts b/src/renderer/src/lib/github-pr-start-point.ts
index 6c6bf7c41ab..cdbae2ab230 100644
--- a/src/renderer/src/lib/github-pr-start-point.ts
+++ b/src/renderer/src/lib/github-pr-start-point.ts
@@ -1,5 +1,5 @@
import { callRuntimeRpc } from '@/runtime/runtime-rpc-client'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import type { GitHubPrStartPoint } from '../../../shared/worktree/types'
export type GitHubPrStartPointInput = {
diff --git a/src/renderer/src/lib/github-source-runtime-context.test.ts b/src/renderer/src/lib/github-source-runtime-context.test.ts
index 942b446bc69..1d33b495a54 100644
--- a/src/renderer/src/lib/github-source-runtime-context.test.ts
+++ b/src/renderer/src/lib/github-source-runtime-context.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest'
import type { TaskSourceContext } from '../../../shared/task-source-context'
-import type { RuntimeClientTarget } from '../runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import {
canUseGitHubRepoContext,
getGitHubRepoRoutingTarget,
diff --git a/src/renderer/src/lib/github-source-runtime-context.ts b/src/renderer/src/lib/github-source-runtime-context.ts
index 94430f1124b..468c8932a0b 100644
--- a/src/renderer/src/lib/github-source-runtime-context.ts
+++ b/src/renderer/src/lib/github-source-runtime-context.ts
@@ -1,10 +1,8 @@
import type { ParsedExecutionHost } from '../../../shared/execution-host'
import { parseExecutionHostId } from '../../../shared/execution-host'
import type { TaskSourceContext } from '../../../shared/task-source-context'
-import {
- runtimeTargetForOwnerEnvironment,
- type RuntimeClientTarget
-} from '@/runtime/runtime-client-target'
+import { runtimeTargetForOwnerEnvironment } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { taskSourceRuntimeTarget } from './task-source-runtime-target'
import {
getExplicitRuntimeOwnerEnvironmentId,
diff --git a/src/renderer/src/lib/launch-structured-agent-session.ts b/src/renderer/src/lib/launch-structured-agent-session.ts
index 3b2d0c778f2..0d0e4e26f85 100644
--- a/src/renderer/src/lib/launch-structured-agent-session.ts
+++ b/src/renderer/src/lib/launch-structured-agent-session.ts
@@ -19,7 +19,7 @@ import {
structuredAgentSessionFocusOwner,
structuredAgentSessionTargetForHost
} from '@/runtime/structured-agent-session-owner'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import type { ExecutionHostId } from '../../../shared/execution-host'
import { createBrowserUuid } from '@/lib/browser-uuid'
import {
diff --git a/src/renderer/src/lib/launch-work-item-direct-preflight.ts b/src/renderer/src/lib/launch-work-item-direct-preflight.ts
index 7bc3fde1176..5bac642102b 100644
--- a/src/renderer/src/lib/launch-work-item-direct-preflight.ts
+++ b/src/renderer/src/lib/launch-work-item-direct-preflight.ts
@@ -1,9 +1,9 @@
import { getSetupConfig } from '@/lib/new-workspace'
import { checkRuntimeHooks } from '@/runtime/runtime-hooks-client'
import { resolveGitHubPrStartPointForRepo } from '@/lib/github-pr-start-point'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { getRepoExecutionHostId, type ExecutionHostId } from '../../../shared/execution-host'
-import { runtimeTargetForOwnerHostId } from '@/runtime/runtime-client-target'
+import { ipcOrRuntimeTargetForHostId } from '@/runtime/runtime-client-target'
import type { Repo } from '../../../shared/repo-types'
import type { OrcaHooks, RepoHookSettings } from '../../../shared/orca-yaml-hook-types'
import type { SetupDecision } from '../../../shared/worktree/create-types'
@@ -79,6 +79,6 @@ export function resolveDirectLaunchOwnerRow(
return null
}
const executionHostId = getRepoExecutionHostId(rows[0])
- const target = runtimeTargetForOwnerHostId(executionHostId)
+ const target = ipcOrRuntimeTargetForHostId(executionHostId)
return target ? { repo: rows[0], executionHostId, target } : null
}
diff --git a/src/renderer/src/lib/launch-work-item-direct.test.ts b/src/renderer/src/lib/launch-work-item-direct.test.ts
index 6874e4f9d31..d1b9c032132 100644
--- a/src/renderer/src/lib/launch-work-item-direct.test.ts
+++ b/src/renderer/src/lib/launch-work-item-direct.test.ts
@@ -69,9 +69,7 @@ vi.mock('@/runtime/runtime-hooks-client', () => ({
checkRuntimeHooks: hostMocks.checkRuntimeHooks
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: hostMocks.callRuntimeRpc
-}))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: hostMocks.callRuntimeRpc }))
vi.mock('@/lib/new-workspace', () => ({
CLIENT_PLATFORM: 'win32',
diff --git a/src/renderer/src/lib/local-file-access.ts b/src/renderer/src/lib/local-file-access.ts
index 8e982324235..c35695f7370 100644
--- a/src/renderer/src/lib/local-file-access.ts
+++ b/src/renderer/src/lib/local-file-access.ts
@@ -3,7 +3,7 @@ import type { LocalFileAccess } from '../../../shared/local-file-access'
import type { OpenFile } from '@/store/slices/editor'
import { getConnectionIdForFile } from './connection-context'
import { getRuntimeTargetForFileOwner } from './file-owner-runtime-target'
-import type { WorktreeRuntimeOwnerState } from './worktree-runtime-owner'
+import type { WorktreeRuntimeOwnerState } from './worktree-runtime-owner-state'
const USER_FILE_ACCESS: LocalFileAccess = { kind: 'user-file' }
const CHAT_IMAGE_ACCESS: LocalFileAccess = { kind: 'chat-image' }
diff --git a/src/renderer/src/lib/markdown-document-templates.ts b/src/renderer/src/lib/markdown-document-templates.ts
index 9979845559c..cba05e7f49b 100644
--- a/src/renderer/src/lib/markdown-document-templates.ts
+++ b/src/renderer/src/lib/markdown-document-templates.ts
@@ -1,5 +1,5 @@
import type { DirEntry } from '../../../shared/filesystem-entry-types'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
import { readRuntimeDirectory } from '@/runtime/runtime-file-mutation-client'
import { readRuntimeFileContent } from '@/runtime/runtime-file-read-client'
diff --git a/src/renderer/src/lib/open-agent-message-sender.ts b/src/renderer/src/lib/open-agent-message-sender.ts
index 5ee15133945..6305a5cfb4c 100644
--- a/src/renderer/src/lib/open-agent-message-sender.ts
+++ b/src/renderer/src/lib/open-agent-message-sender.ts
@@ -10,11 +10,9 @@ import type {
OrchestrationPartyLocationResult
} from '../../../shared/orchestration-caller-status'
import { useAppStore } from '@/store'
-import {
- callRuntimeRpc,
- RuntimeRpcCallError,
- type RuntimeClientTarget
-} from '@/runtime/runtime-rpc-client'
+import { callRuntimeRpc } from '@/runtime/runtime-rpc-client'
+import { RuntimeRpcCallError } from '@/runtime/runtime-rpc-result'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { isRuntimeCompatBlockError } from '@/runtime/runtime-protocol-compat'
import {
focusRendererTerminalHandle,
diff --git a/src/renderer/src/lib/open-mobile-emulator-tab.test.ts b/src/renderer/src/lib/open-mobile-emulator-tab.test.ts
index 97cd8b114fc..d69909cbacf 100644
--- a/src/renderer/src/lib/open-mobile-emulator-tab.test.ts
+++ b/src/renderer/src/lib/open-mobile-emulator-tab.test.ts
@@ -27,9 +27,7 @@ vi.mock('@/store', () => ({
}
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: vi.fn()
-}))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: vi.fn() }))
vi.mock('sonner', () => ({
toast: {
diff --git a/src/renderer/src/lib/paired-web-client-host.test.ts b/src/renderer/src/lib/paired-web-client-host.test.ts
index 08254e9dc7b..2cc371aa3af 100644
--- a/src/renderer/src/lib/paired-web-client-host.test.ts
+++ b/src/renderer/src/lib/paired-web-client-host.test.ts
@@ -1,8 +1,6 @@
import { afterEach, describe, expect, it, vi } from 'vitest'
-import {
- getRuntimeEnvironmentIdForWorktree,
- type WorktreeRuntimeOwnerState
-} from './worktree-runtime-owner'
+import { getRuntimeEnvironmentIdForWorktree } from './worktree-runtime-owner'
+import type { WorktreeRuntimeOwnerState } from './worktree-runtime-owner-state'
import { resolveWorktreeOperationRoute } from './worktree-operation-route'
import { resolveTerminalHostOwnership } from './terminal-worktree-route'
import { folderWorkspaceKey } from '../../../shared/workspace-scope'
diff --git a/src/renderer/src/lib/repo-runtime-owner.ts b/src/renderer/src/lib/repo-runtime-owner.ts
index e8b35695ea3..4550e890666 100644
--- a/src/renderer/src/lib/repo-runtime-owner.ts
+++ b/src/renderer/src/lib/repo-runtime-owner.ts
@@ -5,10 +5,8 @@ import {
} from '../../../shared/execution-host'
import type { GlobalSettings } from '../../../shared/global-settings-types'
import type { Repo } from '../../../shared/repo-types'
-import {
- runtimeTargetForOwnerHostId,
- type RuntimeClientTarget
-} from '@/runtime/runtime-client-target'
+import { ipcOrRuntimeTargetForHostId } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
export type RepoRuntimeOwnerState = {
repos?: readonly Pick[]
@@ -44,7 +42,7 @@ export function runtimeTargetForRepoOwner(
repoId: string | null | undefined
): RuntimeClientTarget | null {
const repo = repoId ? findRepoOwner(state, repoId) : null
- return repo ? runtimeTargetForOwnerHostId(getRepoExecutionHostId(repo)) : null
+ return repo ? ipcOrRuntimeTargetForHostId(getRepoExecutionHostId(repo)) : null
}
export function getRuntimeEnvironmentIdForRepo(
diff --git a/src/renderer/src/lib/repo-slug-cache.ts b/src/renderer/src/lib/repo-slug-cache.ts
index d8a5554bfda..302e423a73c 100644
--- a/src/renderer/src/lib/repo-slug-cache.ts
+++ b/src/renderer/src/lib/repo-slug-cache.ts
@@ -2,7 +2,7 @@
// repo-slug-index.ts) so store slices can import the sync lookup without pulling
// in repo-slug-index's `@/store` dependency, which would form an import cycle.
import type { Repo } from '../../../shared/repo-types'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { runtimeTargetForRepoOwner } from './repo-runtime-owner'
import {
githubHostFromIdentityKey,
diff --git a/src/renderer/src/lib/resolve-owner.ts b/src/renderer/src/lib/resolve-owner.ts
index e58b4ab046b..b8529aa2ac2 100644
--- a/src/renderer/src/lib/resolve-owner.ts
+++ b/src/renderer/src/lib/resolve-owner.ts
@@ -25,7 +25,8 @@ import {
} from './worktree-operation-route'
import { getNestedSshTargetIdForFolderWorkspace } from './folder-workspace-runtime-owner'
import { parseWorkspaceKey } from '../../../shared/workspace-scope'
-import { hostRouteForAuthority, type RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import { hostRouteForAuthority } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
/** A worktree id, a `folder:` workspace key, or the floating workspace; `hostId` when the row names one. */
export type WorkspaceOwnerRef = { workspaceId: string; hostId?: ExecutionHostId }
diff --git a/src/renderer/src/lib/resolved-worktree-execution-host.test.ts b/src/renderer/src/lib/resolved-worktree-execution-host.test.ts
index a155e4f94d0..557ef80d4a4 100644
--- a/src/renderer/src/lib/resolved-worktree-execution-host.test.ts
+++ b/src/renderer/src/lib/resolved-worktree-execution-host.test.ts
@@ -4,7 +4,7 @@ import {
getActiveWorkspaceOwnerTarget,
getResolvedExecutionHostIdForWorktree
} from './resolved-worktree-execution-host'
-import type { WorktreeRuntimeOwnerState } from './worktree-runtime-owner'
+import type { WorktreeRuntimeOwnerState } from './worktree-runtime-owner-state'
describe('getResolvedExecutionHostIdForWorktree', () => {
it('keeps missing workspace ownership unresolved', () => {
diff --git a/src/renderer/src/lib/resolved-worktree-execution-host.ts b/src/renderer/src/lib/resolved-worktree-execution-host.ts
index 24852e03be1..22c972a42d7 100644
--- a/src/renderer/src/lib/resolved-worktree-execution-host.ts
+++ b/src/renderer/src/lib/resolved-worktree-execution-host.ts
@@ -15,11 +15,9 @@ import {
findIndexedWorktreeOwner,
findIndexedWorktreeOwnerForHost
} from './worktree-runtime-owner-index'
-import type { WorktreeRuntimeOwnerState } from './worktree-runtime-owner'
-import {
- runtimeTargetForExecutionHostId,
- type RuntimeClientTarget
-} from '@/runtime/runtime-client-target'
+import type { WorktreeRuntimeOwnerState } from './worktree-runtime-owner-state'
+import { runtimeRpcTargetForAuthorityKey } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
function getResolvedFolderHost(
state: WorktreeRuntimeOwnerState,
@@ -107,5 +105,5 @@ export function getActiveWorkspaceOwnerTarget(
return null
}
const hostId = getResolvedExecutionHostIdForWorktree(state, state.activeWorktreeId)
- return hostId ? runtimeTargetForExecutionHostId(hostId) : null
+ return hostId ? runtimeRpcTargetForAuthorityKey(hostId) : null
}
diff --git a/src/renderer/src/lib/resume-sleeping-agent-session-execution-host-scope.test.ts b/src/renderer/src/lib/resume-sleeping-agent-session-execution-host-scope.test.ts
index a9d0846c3af..7e372ad8eea 100644
--- a/src/renderer/src/lib/resume-sleeping-agent-session-execution-host-scope.test.ts
+++ b/src/renderer/src/lib/resume-sleeping-agent-session-execution-host-scope.test.ts
@@ -23,7 +23,7 @@ import {
agentResumeOriginNamesAnotherExecutionHost,
sleepingRecordNamesAnotherExecutionHost
} from './sleeping-record-execution-host-scope'
-import type { WorktreeRuntimeOwnerState } from './worktree-runtime-owner'
+import type { WorktreeRuntimeOwnerState } from './worktree-runtime-owner-state'
const initialAppStoreState = useAppStore.getState()
diff --git a/src/renderer/src/lib/retire-unowned-background-terminal.ts b/src/renderer/src/lib/retire-unowned-background-terminal.ts
index 40a0b0afb60..c73e024efa5 100644
--- a/src/renderer/src/lib/retire-unowned-background-terminal.ts
+++ b/src/renderer/src/lib/retire-unowned-background-terminal.ts
@@ -1,5 +1,6 @@
import { useAppStore } from '@/store'
-import { callRuntimeRpc, type RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import { callRuntimeRpc } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { isTerminalTabPresent } from '@/store/slices/terminal-tab-retirement'
export async function retireUnownedTerminal(args: {
diff --git a/src/renderer/src/lib/runtime-workspace-file-route.ts b/src/renderer/src/lib/runtime-workspace-file-route.ts
index af30b70fefd..bc3804245f5 100644
--- a/src/renderer/src/lib/runtime-workspace-file-route.ts
+++ b/src/renderer/src/lib/runtime-workspace-file-route.ts
@@ -11,7 +11,7 @@ import {
getExecutionHostIdForWorktree,
getExplicitRuntimeEnvironmentIdForWorktree
} from './worktree-runtime-owner'
-import { resolveExplicitWorktreeOperationRouteResult } from './worktree-operation-route'
+import { resolveExplicitWorktreeOperationRouteResult } from './worktree-operation-catalog-route'
export type RuntimeWorkspaceFileRoute = {
worktreeId: string
diff --git a/src/renderer/src/lib/setup-script-prompt.test.ts b/src/renderer/src/lib/setup-script-prompt.test.ts
index b85c0baa66f..d5af70de16b 100644
--- a/src/renderer/src/lib/setup-script-prompt.test.ts
+++ b/src/renderer/src/lib/setup-script-prompt.test.ts
@@ -11,7 +11,7 @@ import {
inspectSetupScriptPromptState,
isSetupScriptPromptDismissed
} from './setup-script-prompt'
-import { RuntimeRpcCallError } from '@/runtime/runtime-rpc-client'
+import { RuntimeRpcCallError } from '@/runtime/runtime-rpc-result'
function makeRepo(overrides: Partial = {}): Repo {
return {
diff --git a/src/renderer/src/lib/sleeping-record-execution-host-scope.ts b/src/renderer/src/lib/sleeping-record-execution-host-scope.ts
index 8581a690f65..8c4a9f95f35 100644
--- a/src/renderer/src/lib/sleeping-record-execution-host-scope.ts
+++ b/src/renderer/src/lib/sleeping-record-execution-host-scope.ts
@@ -4,10 +4,8 @@ import {
toSshExecutionHostId,
type ExecutionHostId
} from '../../../shared/execution-host'
-import {
- getKnownExecutionHostIdForWorktree,
- type WorktreeRuntimeOwnerState
-} from './worktree-runtime-owner'
+import { getKnownExecutionHostIdForWorktree } from './worktree-runtime-owner'
+import type { WorktreeRuntimeOwnerState } from './worktree-runtime-owner-state'
/**
* Does this record's `--resume` locator belong to a different machine than the one the resume would
diff --git a/src/renderer/src/lib/startup-draft-input-kind.test.ts b/src/renderer/src/lib/startup-draft-input-kind.test.ts
index 16a38cb9a79..0f4dc8ffcba 100644
--- a/src/renderer/src/lib/startup-draft-input-kind.test.ts
+++ b/src/renderer/src/lib/startup-draft-input-kind.test.ts
@@ -22,9 +22,7 @@ vi.mock('@/store', () => ({
}
}))
-vi.mock('./worktree-runtime-owner', () => ({
- getRuntimeEnvironmentIdForWorktree: () => null
-}))
+vi.mock('./worktree-runtime-owner', () => ({ getRuntimeEnvironmentIdForWorktree: () => null }))
vi.mock('./agent-draft-readiness', () => ({
waitForAgentDraftInputReady: async () => true
diff --git a/src/renderer/src/lib/structured-agent-session-host-admission.ts b/src/renderer/src/lib/structured-agent-session-host-admission.ts
index b09be516ef7..93f7c8c00bf 100644
--- a/src/renderer/src/lib/structured-agent-session-host-admission.ts
+++ b/src/renderer/src/lib/structured-agent-session-host-admission.ts
@@ -2,7 +2,7 @@ import type { TuiAgent } from '../../../shared/tui-agent'
import { isDefinitiveAgentSessionCreateRefusal } from '../../../shared/agent-session-definitive-refusal'
import { parseStructuredLaunchSeedOptions } from '../../../shared/native-chat-session-option-defaults'
import { hasRuntimeRpcErrorCode } from '../../../shared/runtime-rpc-error-code'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { callStructuredAgentSession } from '@/runtime/structured-agent-session-client'
/** The host answers a worktree selector it cannot resolve yet with this rather than a verdict. */
diff --git a/src/renderer/src/lib/structured-agent-session-launch-admission.ts b/src/renderer/src/lib/structured-agent-session-launch-admission.ts
index 3d55f8ee71c..d44f0ea4ca8 100644
--- a/src/renderer/src/lib/structured-agent-session-launch-admission.ts
+++ b/src/renderer/src/lib/structured-agent-session-launch-admission.ts
@@ -21,7 +21,7 @@ import type {
} from '@/lib/structured-agent-launch-settlement'
import type { StructuredPromptDeliveryResult } from '@/lib/structured-agent-session-launch-prompt'
import type { LaunchAgentInNewTabArgs } from '@/lib/launch-agent-in-new-tab'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { toRuntimeWorktreeSelector } from '@/runtime/runtime-worktree-selector'
/** What a host's "no" opens instead: the terminal the launch would have opened had it known. */
diff --git a/src/renderer/src/lib/structured-agent-session-launch-callers.ts b/src/renderer/src/lib/structured-agent-session-launch-callers.ts
index 718abe0d9dc..0733941e683 100644
--- a/src/renderer/src/lib/structured-agent-session-launch-callers.ts
+++ b/src/renderer/src/lib/structured-agent-session-launch-callers.ts
@@ -4,7 +4,7 @@ import type {
StructuredPromptDeliveryResult
} from '@/lib/structured-agent-session-launch-prompt'
import type { StructuredAgentSessionResumeSource } from '../../../shared/structured-agent-session-create'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import type { ExecutionHostId } from '../../../shared/execution-host'
import type { StructuredLaunchAttempt } from './structured-agent-session-launch-request'
import type { AgentLaunchRequestId } from './agent-launch-request-id'
diff --git a/src/renderer/src/lib/structured-agent-session-launch-options.ts b/src/renderer/src/lib/structured-agent-session-launch-options.ts
index 5f5bde375d0..0973945555e 100644
--- a/src/renderer/src/lib/structured-agent-session-launch-options.ts
+++ b/src/renderer/src/lib/structured-agent-session-launch-options.ts
@@ -26,7 +26,7 @@ import {
agentSessionThrownFailure,
type AgentSessionWriteFailure
} from '../../../shared/agent-session-write-failure'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
/** The options a launch starts with, replaced whole so readers can compare by identity. */
export type StructuredLaunchSelection = {
diff --git a/src/renderer/src/lib/structured-agent-session-launch-prompt.ts b/src/renderer/src/lib/structured-agent-session-launch-prompt.ts
index c8b9db609e1..5b13f2423bc 100644
--- a/src/renderer/src/lib/structured-agent-session-launch-prompt.ts
+++ b/src/renderer/src/lib/structured-agent-session-launch-prompt.ts
@@ -14,7 +14,7 @@ import {
import { noteStructuredAgentSessionFence } from '@/components/native-chat/structured-agent-session-send-attempt'
import { publishStructuredAgentSessionSends } from '@/components/native-chat/structured-agent-session-pending-sends'
import { agentSessionWriteNoticeText } from '@/components/native-chat/agent-session-write-notice-text'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
export type StructuredPromptDeliveryResult = {
delivered: boolean
diff --git a/src/renderer/src/lib/structured-agent-session-provisional-tab.ts b/src/renderer/src/lib/structured-agent-session-provisional-tab.ts
index cdff8ac9936..ab416b89298 100644
--- a/src/renderer/src/lib/structured-agent-session-provisional-tab.ts
+++ b/src/renderer/src/lib/structured-agent-session-provisional-tab.ts
@@ -23,7 +23,7 @@ import {
resolveStructuredAgentSessionOwner,
structuredAgentSessionTargetForHost
} from '@/runtime/structured-agent-session-owner'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
type LocalProvisionalLaunch = StructuredAgentLaunchHandle & { tab: Tab }
diff --git a/src/renderer/src/lib/structured-agent-session-tab-activation.test.ts b/src/renderer/src/lib/structured-agent-session-tab-activation.test.ts
index 2c9b4804a34..866669438ae 100644
--- a/src/renderer/src/lib/structured-agent-session-tab-activation.test.ts
+++ b/src/renderer/src/lib/structured-agent-session-tab-activation.test.ts
@@ -13,13 +13,9 @@ vi.mock('@/store', () => ({
useAppStore: { getState: () => mocks.state }
}))
-vi.mock('./worktree-runtime-owner', () => ({
- getRuntimeEnvironmentIdForWorktree: () => 'env-1'
-}))
+vi.mock('./worktree-runtime-owner', () => ({ getRuntimeEnvironmentIdForWorktree: () => 'env-1' }))
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: mocks.callRuntimeRpc
-}))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: mocks.callRuntimeRpc }))
vi.mock('@/runtime/runtime-worktree-selector', () => ({
toRuntimeWorktreeSelector: (worktreeId: string) => `id:${worktreeId}`
diff --git a/src/renderer/src/lib/structured-agent-session-tab-activation.ts b/src/renderer/src/lib/structured-agent-session-tab-activation.ts
index 3613525017d..02854e825b5 100644
--- a/src/renderer/src/lib/structured-agent-session-tab-activation.ts
+++ b/src/renderer/src/lib/structured-agent-session-tab-activation.ts
@@ -1,6 +1,7 @@
import { getRuntimeEnvironmentIdForWorktree } from './worktree-runtime-owner'
import { useAppStore } from '@/store'
-import { callRuntimeRpc, type RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import { callRuntimeRpc } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { runtimeTargetForOwnerEnvironment } from '@/runtime/runtime-client-target'
import {
executionHostIdForStructuredTarget,
diff --git a/src/renderer/src/lib/task-source-runtime-target.ts b/src/renderer/src/lib/task-source-runtime-target.ts
index de56ee53782..92556e0e1f5 100644
--- a/src/renderer/src/lib/task-source-runtime-target.ts
+++ b/src/renderer/src/lib/task-source-runtime-target.ts
@@ -1,6 +1,6 @@
import { parseExecutionHostId } from '../../../shared/execution-host'
import type { TaskSourceContext } from '../../../shared/task-source-context'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
/**
* Transport to a row-less source's host; a source that names no server runs on this app. The
diff --git a/src/renderer/src/lib/terminal-worktree-route.ts b/src/renderer/src/lib/terminal-worktree-route.ts
index 06e43c23075..338c8d4a4a0 100644
--- a/src/renderer/src/lib/terminal-worktree-route.ts
+++ b/src/renderer/src/lib/terminal-worktree-route.ts
@@ -5,9 +5,9 @@ import { parseWorkspaceKey } from '../../../shared/workspace-scope'
import type { AppState } from '@/store/types'
import {
getExplicitRuntimeEnvironmentIdForWorktree,
- getRuntimeEnvironmentIdForWorktree,
- type WorktreeRuntimeOwnerState
+ getRuntimeEnvironmentIdForWorktree
} from './worktree-runtime-owner'
+import type { WorktreeRuntimeOwnerState } from './worktree-runtime-owner-state'
import { resolveWorktreeOperationRouteResult } from './worktree-operation-route'
import { getSingleFocusedRuntimeEnvironmentId } from './single-runtime-legacy-owner'
diff --git a/src/renderer/src/lib/windows-terminal-capability-read.ts b/src/renderer/src/lib/windows-terminal-capability-read.ts
index 345181452c0..77710056ed9 100644
--- a/src/renderer/src/lib/windows-terminal-capability-read.ts
+++ b/src/renderer/src/lib/windows-terminal-capability-read.ts
@@ -1,4 +1,5 @@
-import { callRuntimeRpc, type RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import { callRuntimeRpc } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import type { RuntimeStatus } from '../../../shared/runtime-types'
import type { WindowsTerminalCapabilities } from './windows-terminal-capabilities'
diff --git a/src/renderer/src/lib/workspace-port-actions.ts b/src/renderer/src/lib/workspace-port-actions.ts
index cf745d3e25f..b2bb5f30ffa 100644
--- a/src/renderer/src/lib/workspace-port-actions.ts
+++ b/src/renderer/src/lib/workspace-port-actions.ts
@@ -1,11 +1,8 @@
import { activateAndRevealWorktree } from '@/lib/worktree-activation'
import type { useAppStore } from '@/store'
-import {
- assertRuntimeEnvironmentCapability,
- callRuntimeRpc,
- RuntimeRpcCallError,
- type RuntimeClientTarget
-} from '@/runtime/runtime-rpc-client'
+import { assertRuntimeEnvironmentCapability, callRuntimeRpc } from '@/runtime/runtime-rpc-client'
+import { RuntimeRpcCallError } from '@/runtime/runtime-rpc-result'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { toRuntimeWorktreeSelector } from '@/runtime/runtime-worktree-selector'
import type {
WorkspacePort,
diff --git a/src/renderer/src/lib/workspace-port-host-scoped-scan.test.ts b/src/renderer/src/lib/workspace-port-host-scoped-scan.test.ts
index d25eb023da6..2cf50fedb75 100644
--- a/src/renderer/src/lib/workspace-port-host-scoped-scan.test.ts
+++ b/src/renderer/src/lib/workspace-port-host-scoped-scan.test.ts
@@ -10,7 +10,7 @@ vi.mock('@/runtime/runtime-rpc-client', async (importOriginal) => ({
runtimeEnvironmentSupportsCapability: supportsCapability
}))
-import { RuntimeRpcCallError } from '@/runtime/runtime-rpc-client'
+import { RuntimeRpcCallError } from '@/runtime/runtime-rpc-result'
import {
killWorkspacePortOnExecutionHost,
scanWorkspacePortsOnExecutionHost,
diff --git a/src/renderer/src/lib/workspace-port-scan-client.ts b/src/renderer/src/lib/workspace-port-scan-client.ts
index 8d9f4a4b619..0c652d279a6 100644
--- a/src/renderer/src/lib/workspace-port-scan-client.ts
+++ b/src/renderer/src/lib/workspace-port-scan-client.ts
@@ -1,9 +1,6 @@
-import {
- callRuntimeRpc,
- runtimeEnvironmentSupportsCapability,
- RuntimeRpcCallError,
- type RuntimeClientTarget
-} from '@/runtime/runtime-rpc-client'
+import { callRuntimeRpc, runtimeEnvironmentSupportsCapability } from '@/runtime/runtime-rpc-client'
+import { RuntimeRpcCallError } from '@/runtime/runtime-rpc-result'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { callHostRoute } from '@/runtime/host-route-call'
import type { HostRoute } from '@/runtime/runtime-client-target'
import { toRuntimeWorktreeSelector } from '@/runtime/runtime-worktree-selector'
diff --git a/src/renderer/src/lib/workspace-port-scan-publish.test.ts b/src/renderer/src/lib/workspace-port-scan-publish.test.ts
index f1fc4fb16bf..fe7558aae40 100644
--- a/src/renderer/src/lib/workspace-port-scan-publish.test.ts
+++ b/src/renderer/src/lib/workspace-port-scan-publish.test.ts
@@ -9,7 +9,9 @@ vi.mock('@/lib/worktree-activation', () => ({
vi.mock('@/runtime/runtime-rpc-client', () => ({
callRuntimeRpc: vi.fn(),
- assertRuntimeEnvironmentCapability: vi.fn(),
+ assertRuntimeEnvironmentCapability: vi.fn()
+}))
+vi.mock('@/runtime/runtime-rpc-result', () => ({
RuntimeRpcCallError: class RuntimeRpcCallError extends Error {
code?: string
}
diff --git a/src/renderer/src/lib/workspace-terminal-host-authority.ts b/src/renderer/src/lib/workspace-terminal-host-authority.ts
index ee69b88848e..8533da44e2b 100644
--- a/src/renderer/src/lib/workspace-terminal-host-authority.ts
+++ b/src/renderer/src/lib/workspace-terminal-host-authority.ts
@@ -6,9 +6,9 @@ import type { SshConnectionState } from '../../../shared/ssh-types'
import { isWebRuntimeSessionActive } from '@/runtime/web-runtime-session-environment'
import {
getExecutionHostIdForWorktree,
- getRuntimeEnvironmentIdForWorktree,
- type WorktreeRuntimeOwnerState
+ getRuntimeEnvironmentIdForWorktree
} from '@/lib/worktree-runtime-owner'
+import type { WorktreeRuntimeOwnerState } from '@/lib/worktree-runtime-owner-state'
/**
* Who holds a workspace's terminals right now, in the same three-verdict vocabulary the renderer
diff --git a/src/renderer/src/lib/worktree-activation-store-contract.ts b/src/renderer/src/lib/worktree-activation-store-contract.ts
index 8d1f3aa9151..32a3f622c6c 100644
--- a/src/renderer/src/lib/worktree-activation-store-contract.ts
+++ b/src/renderer/src/lib/worktree-activation-store-contract.ts
@@ -6,7 +6,7 @@ import type {
AgentProviderSessionMetadata,
SleepingAgentLaunchConfig
} from '../../../shared/agent-session-resume'
-import type { WorktreeRuntimeOwnerState } from '@/lib/worktree-runtime-owner'
+import type { WorktreeRuntimeOwnerState } from '@/lib/worktree-runtime-owner-state'
import type { AgentStartedTelemetry } from '@/lib/worktree-startup-payload'
import type { ClosedTerminalTabTombstonesByTabId } from '../../../shared/closed-terminal-tab-tombstones'
diff --git a/src/renderer/src/lib/worktree-creation-flow-startup.ts b/src/renderer/src/lib/worktree-creation-flow-startup.ts
index c44f513a331..581dd643178 100644
--- a/src/renderer/src/lib/worktree-creation-flow-startup.ts
+++ b/src/renderer/src/lib/worktree-creation-flow-startup.ts
@@ -1,5 +1,5 @@
import { useAppStore } from '@/store'
-import { runtimeTargetForOwnerHostId } from '@/runtime/runtime-client-target'
+import { ipcOrRuntimeTargetForHostId } from '@/runtime/runtime-client-target'
import { runtimeTargetForRepoOwner } from '@/lib/repo-runtime-owner'
import type { WorktreeStartupPayload } from '@/lib/worktree-startup-payload'
import type {
@@ -42,7 +42,7 @@ export function getWorktreeCreationIndeterminate(request: WorktreeCreationReques
}
// Why: progress follows the host the workspace is created on, not the focused one.
const target = request.executionHostId
- ? runtimeTargetForOwnerHostId(request.executionHostId)
+ ? ipcOrRuntimeTargetForHostId(request.executionHostId)
: runtimeTargetForRepoOwner(useAppStore.getState(), request.repoId)
return target?.kind !== 'local'
}
diff --git a/src/renderer/src/lib/worktree-creation-structured-session.ts b/src/renderer/src/lib/worktree-creation-structured-session.ts
index d9cb4a07d0b..886185f0684 100644
--- a/src/renderer/src/lib/worktree-creation-structured-session.ts
+++ b/src/renderer/src/lib/worktree-creation-structured-session.ts
@@ -9,7 +9,7 @@ import { buildWorktreeCreationStartupOpt } from '@/lib/worktree-creation-flow-st
import { ensureWebRuntimeWorktreeTerminalAfterWake } from '@/lib/web-runtime-worktree-terminal-after-wake'
import { ensureWorktreeHasInitialTerminal } from '@/lib/worktree-initial-terminal-seeding'
import { mountCreatedWorktreeStartupTabsInBackground } from '@/lib/worktree-creation-background-mount'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
export type WorktreeCreationStructuredSessionResult = {
accepted: boolean
diff --git a/src/renderer/src/lib/worktree-operation-route.ts b/src/renderer/src/lib/worktree-operation-route.ts
index be50836e38c..add9637e9dc 100644
--- a/src/renderer/src/lib/worktree-operation-route.ts
+++ b/src/renderer/src/lib/worktree-operation-route.ts
@@ -21,8 +21,6 @@ import {
type FolderWorkspaceRuntimeOwnerState
} from './folder-workspace-runtime-owner'
-export { resolveExplicitWorktreeOperationRouteResult } from './worktree-operation-catalog-route'
-
export type WorktreeOperationRoute = {
executionHostId: ExecutionHostId | null
runtimeEnvironmentId: string | null
diff --git a/src/renderer/src/lib/worktree-row-open-in-owner.ts b/src/renderer/src/lib/worktree-row-open-in-owner.ts
index ad4c29285d5..e87a9b24967 100644
--- a/src/renderer/src/lib/worktree-row-open-in-owner.ts
+++ b/src/renderer/src/lib/worktree-row-open-in-owner.ts
@@ -2,7 +2,7 @@ import { parseExecutionHostId } from '../../../shared/execution-host'
import type { Worktree } from '../../../shared/worktree/types'
import { getResolvedExecutionHostIdForWorktree } from './resolved-worktree-execution-host'
import { getRuntimeEnvironmentIdForWorktree } from './worktree-runtime-owner'
-import type { WorktreeRuntimeOwnerState } from './worktree-runtime-owner'
+import type { WorktreeRuntimeOwnerState } from './worktree-runtime-owner-state'
import {
resolveStrictWorktreeOperationRouteResultForHost,
type WorktreeOperationRouteState
diff --git a/src/renderer/src/lib/worktree-runtime-owner.test.ts b/src/renderer/src/lib/worktree-runtime-owner.test.ts
index afa8a280115..a501b53aba5 100644
--- a/src/renderer/src/lib/worktree-runtime-owner.test.ts
+++ b/src/renderer/src/lib/worktree-runtime-owner.test.ts
@@ -4,10 +4,10 @@ import {
getExplicitRuntimeEnvironmentIdForWorktree,
getExecutionHostIdForWorktree,
getKnownExecutionHostIdForWorktree,
- getRuntimeEnvironmentIdForWorktree,
- getRuntimeSessionMirrorEnvironmentIds,
- type WorktreeRuntimeOwnerState
+ getRuntimeEnvironmentIdForWorktree
} from './worktree-runtime-owner'
+import { getRuntimeSessionMirrorEnvironmentIds } from './runtime-session-mirror-owners'
+import type { WorktreeRuntimeOwnerState } from './worktree-runtime-owner-state'
const state: WorktreeRuntimeOwnerState = {
settings: { activeRuntimeEnvironmentId: 'focused-env' },
diff --git a/src/renderer/src/lib/worktree-runtime-owner.ts b/src/renderer/src/lib/worktree-runtime-owner.ts
index 9b0df03cc37..a66cd6e9e84 100644
--- a/src/renderer/src/lib/worktree-runtime-owner.ts
+++ b/src/renderer/src/lib/worktree-runtime-owner.ts
@@ -26,12 +26,10 @@ import {
import {
getFloatingWorkspaceOperationRoute,
resolveActiveWorkspaceRoute,
- resolveExplicitWorktreeOperationRouteResult,
resolveWorktreeOperationRouteResult
} from './worktree-operation-route'
+import { resolveExplicitWorktreeOperationRouteResult } from './worktree-operation-catalog-route'
import type { WorktreeRuntimeOwnerState } from './worktree-runtime-owner-state'
-export type { WorktreeRuntimeOwnerState } from './worktree-runtime-owner-state'
-export { getRuntimeSessionMirrorEnvironmentIds } from './runtime-session-mirror-owners'
function getExplicitRuntimeEnvironmentIdFromHost(
executionHostId: string | null | undefined
diff --git a/src/renderer/src/lib/worktree-sort-order-host-split.test.ts b/src/renderer/src/lib/worktree-sort-order-host-split.test.ts
index 5bc20ca4f0c..9df953b13a7 100644
--- a/src/renderer/src/lib/worktree-sort-order-host-split.test.ts
+++ b/src/renderer/src/lib/worktree-sort-order-host-split.test.ts
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest'
-import type { WorktreeRuntimeOwnerState } from './worktree-runtime-owner'
+import type { WorktreeRuntimeOwnerState } from './worktree-runtime-owner-state'
import { splitWorktreeSortOrderByHost } from './worktree-sort-order-host-split'
const state: WorktreeRuntimeOwnerState = {
diff --git a/src/renderer/src/lib/worktree-sort-order-host-split.ts b/src/renderer/src/lib/worktree-sort-order-host-split.ts
index 008f7486274..b313d56b618 100644
--- a/src/renderer/src/lib/worktree-sort-order-host-split.ts
+++ b/src/renderer/src/lib/worktree-sort-order-host-split.ts
@@ -1,8 +1,6 @@
import { LOCAL_EXECUTION_HOST_ID, toRuntimeExecutionHostId } from '../../../shared/execution-host'
-import {
- getRuntimeEnvironmentIdForWorktree,
- type WorktreeRuntimeOwnerState
-} from './worktree-runtime-owner'
+import { getRuntimeEnvironmentIdForWorktree } from './worktree-runtime-owner'
+import type { WorktreeRuntimeOwnerState } from './worktree-runtime-owner-state'
export type WorktreeSortOrderHostGroup = {
hostId: string
diff --git a/src/renderer/src/lib/worktree-sort-order-persistence.test.ts b/src/renderer/src/lib/worktree-sort-order-persistence.test.ts
index 150194a572b..f2702b8dd2d 100644
--- a/src/renderer/src/lib/worktree-sort-order-persistence.test.ts
+++ b/src/renderer/src/lib/worktree-sort-order-persistence.test.ts
@@ -1,11 +1,9 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { callRuntimeRpc } from '@/runtime/runtime-rpc-client'
-import type { WorktreeRuntimeOwnerState } from './worktree-runtime-owner'
+import type { WorktreeRuntimeOwnerState } from './worktree-runtime-owner-state'
import { persistWorktreeSortOrderByHost } from './worktree-sort-order-persistence'
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: vi.fn()
-}))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: vi.fn() }))
const localPersistSortOrder = vi.fn()
const runtimeCall = vi.mocked(callRuntimeRpc)
diff --git a/src/renderer/src/lib/worktree-sort-order-persistence.ts b/src/renderer/src/lib/worktree-sort-order-persistence.ts
index 28e2d8d3556..f85b051a881 100644
--- a/src/renderer/src/lib/worktree-sort-order-persistence.ts
+++ b/src/renderer/src/lib/worktree-sort-order-persistence.ts
@@ -1,6 +1,6 @@
import { callRuntimeRpc } from '@/runtime/runtime-rpc-client'
import { parseExecutionHostId } from '../../../shared/execution-host'
-import type { WorktreeRuntimeOwnerState } from './worktree-runtime-owner'
+import type { WorktreeRuntimeOwnerState } from './worktree-runtime-owner-state'
import { splitWorktreeSortOrderByHost } from './worktree-sort-order-host-split'
function ignoreSortOrderPersistenceFailure(promise: Promise): void {
diff --git a/src/renderer/src/runtime/agent-session-create-operation.ts b/src/renderer/src/runtime/agent-session-create-operation.ts
index 6d92cd40346..d758347b0f2 100644
--- a/src/renderer/src/runtime/agent-session-create-operation.ts
+++ b/src/renderer/src/runtime/agent-session-create-operation.ts
@@ -1,6 +1,6 @@
import type { RuntimeCreateAgentSessionRequest } from '../../../shared/agent-session-host-authority'
import { createAgentSessionOperationId } from './agent-session-operation-id'
-import { RuntimeRpcCallError } from './runtime-rpc-client'
+import { RuntimeRpcCallError } from './runtime-rpc-result'
const MAX_AMBIGUOUS_CREATE_ATTEMPTS = 2
diff --git a/src/renderer/src/runtime/agent-session-operation-id.test.ts b/src/renderer/src/runtime/agent-session-operation-id.test.ts
index da77ba14998..d60f2b5a040 100644
--- a/src/renderer/src/runtime/agent-session-operation-id.test.ts
+++ b/src/renderer/src/runtime/agent-session-operation-id.test.ts
@@ -1,7 +1,7 @@
import { describe, expect, it, vi } from 'vitest'
import { createAgentSessionOperationId } from './agent-session-operation-id'
import { createAgentSessionCreateOperation } from './agent-session-create-operation'
-import { RuntimeRpcCallError } from './runtime-rpc-client'
+import { RuntimeRpcCallError } from './runtime-rpc-result'
describe('createAgentSessionOperationId', () => {
it('combines the request time with a cryptographically generated nonce', () => {
diff --git a/src/renderer/src/runtime/client-hosted-browser-close-intent-replay.ts b/src/renderer/src/runtime/client-hosted-browser-close-intent-replay.ts
index 23405e38c43..129b9964538 100644
--- a/src/renderer/src/runtime/client-hosted-browser-close-intent-replay.ts
+++ b/src/renderer/src/runtime/client-hosted-browser-close-intent-replay.ts
@@ -1,4 +1,5 @@
-import { callRuntimeRpc, hasRuntimeRpcErrorCode } from './runtime-rpc-client'
+import { callRuntimeRpc } from './runtime-rpc-client'
+import { hasRuntimeRpcErrorCode } from './runtime-rpc-result'
import {
listClientHostedBrowserCloseIntents,
type ClientHostedBrowserCloseIntentsByEnvironment
diff --git a/src/renderer/src/runtime/close-mirrored-editor-tab.ts b/src/renderer/src/runtime/close-mirrored-editor-tab.ts
index 0077671b38f..5b879b824a7 100644
--- a/src/renderer/src/runtime/close-mirrored-editor-tab.ts
+++ b/src/renderer/src/runtime/close-mirrored-editor-tab.ts
@@ -1,7 +1,5 @@
-import {
- getRuntimeEnvironmentIdForWorktree,
- type WorktreeRuntimeOwnerState
-} from '@/lib/worktree-runtime-owner'
+import { getRuntimeEnvironmentIdForWorktree } from '@/lib/worktree-runtime-owner'
+import type { WorktreeRuntimeOwnerState } from '@/lib/worktree-runtime-owner-state'
import { recordWebSessionCloseIntent } from './web-session-close-intent'
import { toHostSessionTabId } from '../../../shared/terminal-surface-id'
import type { OpenFile } from '@/store/slices/editor'
diff --git a/src/renderer/src/runtime/forge-credential-target.ts b/src/renderer/src/runtime/forge-credential-target.ts
index b08275c22b6..077b612fff4 100644
--- a/src/renderer/src/runtime/forge-credential-target.ts
+++ b/src/renderer/src/runtime/forge-credential-target.ts
@@ -4,7 +4,7 @@ import type { Repo } from '../../../shared/repo-types'
import type { Worktree } from '../../../shared/worktree/types'
import type { TaskSourceContext } from '../../../shared/task-source-context'
import { translate } from '@/i18n/i18n'
-import type { RuntimeClientTarget } from './runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
export type ForgeRepoSelector = {
repoPath: string
diff --git a/src/renderer/src/runtime/host-model-catalog-snapshots-sync.ts b/src/renderer/src/runtime/host-model-catalog-snapshots-sync.ts
index 5054ddd518c..5904db69238 100644
--- a/src/renderer/src/runtime/host-model-catalog-snapshots-sync.ts
+++ b/src/renderer/src/runtime/host-model-catalog-snapshots-sync.ts
@@ -21,7 +21,7 @@ import {
subscribeLocalRuntimeCapabilitiesKnown
} from './local-runtime-capabilities'
import { localStructuredChatsInUse } from './local-structured-chats'
-import type { RuntimeClientTarget } from './runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { subscribeRuntimeHostContactRegained } from './runtime-host-contact-regained'
// The settings that change which account (or binary) a new chat lists under, as the host reads them.
diff --git a/src/renderer/src/runtime/host-model-catalog-snapshots.ts b/src/renderer/src/runtime/host-model-catalog-snapshots.ts
index 6280686030c..928f440a31e 100644
--- a/src/renderer/src/runtime/host-model-catalog-snapshots.ts
+++ b/src/renderer/src/runtime/host-model-catalog-snapshots.ts
@@ -1,5 +1,5 @@
import type { AgentSessionModelCatalogResult } from '../../../shared/agent-session-wire'
-import type { RuntimeClientTarget } from './runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { callStructuredAgentSession } from './structured-agent-session-client'
import { structuredAgentSessionHostKey } from './structured-agent-session-host-capability'
diff --git a/src/renderer/src/runtime/local-structured-session-reveal-visibility.test.ts b/src/renderer/src/runtime/local-structured-session-reveal-visibility.test.ts
index ab0e1d4a1c3..26add475059 100644
--- a/src/renderer/src/runtime/local-structured-session-reveal-visibility.test.ts
+++ b/src/renderer/src/runtime/local-structured-session-reveal-visibility.test.ts
@@ -13,7 +13,7 @@
import { afterEach, describe, expect, it } from 'vitest'
import { UNPUBLISHED_WORKTREE_PUBLICATION_EPOCH } from '../../../shared/runtime-types'
import type { RuntimeMobileSessionTabsResult } from '../../../shared/runtime-types'
-import type { WorktreeRuntimeOwnerState } from '../lib/worktree-runtime-owner'
+import type { WorktreeRuntimeOwnerState } from '../lib/worktree-runtime-owner-state'
import { applyLocalStructuredSessionTabSnapshots } from './local-structured-session-tabs-sync/snapshot-apply'
import { resetLocalStructuredSessionVersionForTests } from './local-structured-session-tabs-sync/inventory-generation-fence'
import type { WebSessionTabsSyncState } from './web-session-tabs-sync/state'
diff --git a/src/renderer/src/runtime/local-structured-session-tab-retirement.ts b/src/renderer/src/runtime/local-structured-session-tab-retirement.ts
index 1a51a220c65..f5c535c3193 100644
--- a/src/renderer/src/runtime/local-structured-session-tab-retirement.ts
+++ b/src/renderer/src/runtime/local-structured-session-tab-retirement.ts
@@ -1,4 +1,4 @@
-import type { WorktreeRuntimeOwnerState } from '../lib/worktree-runtime-owner'
+import type { WorktreeRuntimeOwnerState } from '../lib/worktree-runtime-owner-state'
import { folderWorkspaceKey } from '../../../shared/workspace-scope'
import type { WebSessionTabsSyncState } from './web-session-tabs-sync/state'
diff --git a/src/renderer/src/runtime/local-structured-session-tabs-sync.test.ts b/src/renderer/src/runtime/local-structured-session-tabs-sync.test.ts
index 2b143051e2b..4ffb406a501 100644
--- a/src/renderer/src/runtime/local-structured-session-tabs-sync.test.ts
+++ b/src/renderer/src/runtime/local-structured-session-tabs-sync.test.ts
@@ -5,7 +5,7 @@ import { STRUCTURED_AGENT_SESSION_RUNTIME_CAPABILITY } from '../../../shared/pro
import type { RuntimeMobileSessionTabsResult } from '../../../shared/runtime-types'
import type { Tab } from '../../../shared/tab-types'
import type { WorkspaceSessionState } from '../../../shared/workspace-session-state-types'
-import type { WorktreeRuntimeOwnerState } from '../lib/worktree-runtime-owner'
+import type { WorktreeRuntimeOwnerState } from '../lib/worktree-runtime-owner-state'
import { buildPersistedUnifiedTabSessionData } from '../lib/workspace-session-unified-tabs'
import { buildHydratedTabState } from '../store/slices/tabs-hydration'
import { applyLocalStructuredSessionTabSnapshots } from './local-structured-session-tabs-sync/snapshot-apply'
diff --git a/src/renderer/src/runtime/local-structured-session-tabs-sync/snapshot-apply.ts b/src/renderer/src/runtime/local-structured-session-tabs-sync/snapshot-apply.ts
index 34b9f8a70af..9ece006f78b 100644
--- a/src/renderer/src/runtime/local-structured-session-tabs-sync/snapshot-apply.ts
+++ b/src/renderer/src/runtime/local-structured-session-tabs-sync/snapshot-apply.ts
@@ -3,7 +3,7 @@ import type {
RuntimeMobileSessionTabsResult
} from '../../../../shared/runtime-types'
import { markStructuredAgentSessionLaunchesPublished } from '../../lib/structured-agent-session-launch-publication'
-import type { WorktreeRuntimeOwnerState } from '../../lib/worktree-runtime-owner'
+import type { WorktreeRuntimeOwnerState } from '../../lib/worktree-runtime-owner-state'
import { getExecutionHostIdForWorktree } from '../../lib/worktree-runtime-owner'
import { applyWebSessionTabsSnapshot } from '../web-session-tabs-sync/snapshot-api'
import { applyWebSessionTabsStorePatch } from '../web-session-tabs-sync/store-patch'
diff --git a/src/renderer/src/runtime/paired-host-structured-launch-bookkeeping.test.ts b/src/renderer/src/runtime/paired-host-structured-launch-bookkeeping.test.ts
index cf94a9cd989..6ea3a350702 100644
--- a/src/renderer/src/runtime/paired-host-structured-launch-bookkeeping.test.ts
+++ b/src/renderer/src/runtime/paired-host-structured-launch-bookkeeping.test.ts
@@ -2,7 +2,7 @@
import { beforeEach, describe, expect, it, vi } from 'vitest'
import type { RuntimeMobileSessionTabsResult } from '../../../shared/runtime-types'
-import type { RuntimeClientTarget } from './runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
const mocks = vi.hoisted(() => ({
closeSession:
diff --git a/src/renderer/src/runtime/remote-agent-session-launch.test.ts b/src/renderer/src/runtime/remote-agent-session-launch.test.ts
index b126f162c85..4b828d3b475 100644
--- a/src/renderer/src/runtime/remote-agent-session-launch.test.ts
+++ b/src/renderer/src/runtime/remote-agent-session-launch.test.ts
@@ -4,18 +4,20 @@ const mocks = vi.hoisted(() => ({
supportsCapability: vi.fn()
}))
-vi.mock('./runtime-rpc-client', () => ({
+vi.mock('./runtime-rpc-result', () => ({
RuntimeRpcCallError: class RuntimeRpcCallError extends Error {
code: string
constructor(response: { error: { code: string; message: string } }) {
super(response.error.message)
this.code = response.error.code
}
- },
+ }
+}))
+vi.mock('./runtime-rpc-client', () => ({
runtimeEnvironmentSupportsCapability: mocks.supportsCapability
}))
-import { RuntimeRpcCallError } from './runtime-rpc-client'
+import { RuntimeRpcCallError } from './runtime-rpc-result'
import { runRemoteAgentSessionLaunch } from './remote-agent-session-launch'
import { agentResumeHostAuthorityCapability } from './agent-resume-host-authority-capability'
diff --git a/src/renderer/src/runtime/remote-agent-session-launch.ts b/src/renderer/src/runtime/remote-agent-session-launch.ts
index b00c6cbbdab..b85d104b399 100644
--- a/src/renderer/src/runtime/remote-agent-session-launch.ts
+++ b/src/renderer/src/runtime/remote-agent-session-launch.ts
@@ -1,6 +1,7 @@
import { AGENT_SESSION_HOST_AUTHORITY_CAPABILITY } from '../../../shared/agent-session-host-authority'
import type { RuntimeCapability } from '../../../shared/protocol-version'
-import { RuntimeRpcCallError, runtimeEnvironmentSupportsCapability } from './runtime-rpc-client'
+import { RuntimeRpcCallError } from './runtime-rpc-result'
+import { runtimeEnvironmentSupportsCapability } from './runtime-rpc-client'
import { isRuntimeCompatBlockError } from './runtime-protocol-compat'
export async function runRemoteAgentSessionLaunch(args: {
diff --git a/src/renderer/src/runtime/remote-host-file-open-repro.test.ts b/src/renderer/src/runtime/remote-host-file-open-repro.test.ts
index b57372662e5..a7df001b1f6 100644
--- a/src/renderer/src/runtime/remote-host-file-open-repro.test.ts
+++ b/src/renderer/src/runtime/remote-host-file-open-repro.test.ts
@@ -31,7 +31,7 @@ import {
} from '@/components/editor/editor-panel-content-types'
import { shouldRetryFileLoadError } from '@/components/editor/useEditorPanelFileLoadRetry'
import { readRuntimeFileContent } from './runtime-file-read-client'
-import type { RuntimeClientTarget } from './runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
// Mirrors src/main/ipc/filesystem-auth.ts PATH_ACCESS_DENIED_MESSAGE.
const PATH_ACCESS_DENIED_MESSAGE =
diff --git a/src/renderer/src/runtime/remote-runtime-terminal-color-push.test.ts b/src/renderer/src/runtime/remote-runtime-terminal-color-push.test.ts
index f598397177e..fcfd9b513ba 100644
--- a/src/renderer/src/runtime/remote-runtime-terminal-color-push.test.ts
+++ b/src/renderer/src/runtime/remote-runtime-terminal-color-push.test.ts
@@ -3,7 +3,7 @@ import type { RuntimeHostStatusSnapshot } from '../../../shared/runtime-host-sta
import type { RuntimeStatus } from '../../../shared/runtime-types'
import type { TerminalOscColorQueryReplyColors } from '../../../shared/terminal-osc-color-reply'
import { createRemoteRuntimeTerminalColorPush } from './remote-runtime-terminal-color-push'
-import { RuntimeRpcCallError } from './runtime-rpc-client'
+import { RuntimeRpcCallError } from './runtime-rpc-result'
const DARK = { foreground: '#ffffff', background: '#282c34' }
const LIGHT = { foreground: '#2e3434', background: '#ffffff' }
diff --git a/src/renderer/src/runtime/remote-runtime-terminal-color-push.ts b/src/renderer/src/runtime/remote-runtime-terminal-color-push.ts
index 43e998183cb..3553d4004a2 100644
--- a/src/renderer/src/runtime/remote-runtime-terminal-color-push.ts
+++ b/src/renderer/src/runtime/remote-runtime-terminal-color-push.ts
@@ -1,7 +1,8 @@
import type { RuntimeHostStatusSnapshot } from '../../../shared/runtime-host-status'
import type { TerminalOscColorQueryReplyColors } from '../../../shared/terminal-osc-color-reply'
import { colorQueryReplyColorsEqual } from '../../../shared/pty-owner-color-query-colors'
-import { callRuntimeRpc, RuntimeRpcCallError } from './runtime-rpc-client'
+import { callRuntimeRpc } from './runtime-rpc-client'
+import { RuntimeRpcCallError } from './runtime-rpc-result'
type PushCall = (
environmentId: string,
diff --git a/src/renderer/src/runtime/remote-runtime-terminal-response-controller.ts b/src/renderer/src/runtime/remote-runtime-terminal-response-controller.ts
index a51b6ca9ae4..67f3115eb67 100644
--- a/src/renderer/src/runtime/remote-runtime-terminal-response-controller.ts
+++ b/src/renderer/src/runtime/remote-runtime-terminal-response-controller.ts
@@ -11,7 +11,7 @@ import {
rejectPendingSnapshotRequest
} from './remote-runtime-terminal-snapshot-state'
import type { TerminalMultiplexEvent } from './remote-runtime-terminal-multiplexer-types'
-import { unwrapRuntimeRpcResult } from './runtime-rpc-client'
+import { unwrapRuntimeRpcResult } from './runtime-rpc-result'
type SubscribedCapabilities = {
ackOutputSourceRanges: boolean
diff --git a/src/renderer/src/runtime/remote-worktree-sleep.ts b/src/renderer/src/runtime/remote-worktree-sleep.ts
index 15dc1a3098e..14f269e70bc 100644
--- a/src/renderer/src/runtime/remote-worktree-sleep.ts
+++ b/src/renderer/src/runtime/remote-worktree-sleep.ts
@@ -1,4 +1,5 @@
-import { callRuntimeRpc, RuntimeRpcCallError } from './runtime-rpc-client'
+import { callRuntimeRpc } from './runtime-rpc-client'
+import { RuntimeRpcCallError } from './runtime-rpc-result'
import { toRuntimeWorktreeSelector } from './runtime-worktree-selector'
import type { RuntimeWorktreeTerminalSleepResult } from '../../../shared/runtime-types'
diff --git a/src/renderer/src/runtime/resume-host-automatic-restores.test.ts b/src/renderer/src/runtime/resume-host-automatic-restores.test.ts
index e85f8138d20..8a6a0878391 100644
--- a/src/renderer/src/runtime/resume-host-automatic-restores.test.ts
+++ b/src/renderer/src/runtime/resume-host-automatic-restores.test.ts
@@ -5,7 +5,10 @@ const { callRuntimeRpc, runtimeEnvironmentSupportsCapability } = vi.hoisted(() =
runtimeEnvironmentSupportsCapability: vi.fn()
}))
-vi.mock('./runtime-rpc-client', () => ({ callRuntimeRpc, runtimeEnvironmentSupportsCapability }))
+vi.mock('./runtime-rpc-client', () => ({
+ callRuntimeRpc,
+ runtimeEnvironmentSupportsCapability
+}))
import {
canResumeHostAutomaticRestores,
diff --git a/src/renderer/src/runtime/runtime-antigravity-accounts-client.ts b/src/renderer/src/runtime/runtime-antigravity-accounts-client.ts
index c3c926452e9..db73a8406f1 100644
--- a/src/renderer/src/runtime/runtime-antigravity-accounts-client.ts
+++ b/src/renderer/src/runtime/runtime-antigravity-accounts-client.ts
@@ -3,7 +3,7 @@ import type {
AntigravityAccountTarget
} from '../../../shared/antigravity-account-types'
import { ANTIGRAVITY_ACCOUNTS_RUNTIME_CAPABILITY } from '../../../shared/protocol-version'
-import type { RuntimeClientTarget } from './runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { assertRuntimeEnvironmentCapability, callRuntimeRpc } from './runtime-rpc-client'
export async function callAntigravityAccounts(
diff --git a/src/renderer/src/runtime/runtime-client-target.test.ts b/src/renderer/src/runtime/runtime-client-target.test.ts
index 93101dbdeac..b9b3cf0810e 100644
--- a/src/renderer/src/runtime/runtime-client-target.test.ts
+++ b/src/renderer/src/runtime/runtime-client-target.test.ts
@@ -2,24 +2,24 @@ import { describe, expect, it } from 'vitest'
import { UNRESOLVED_OWNER_HOST_ID } from '../../../shared/execution-host'
import {
hostRouteForAuthority,
- runtimeTargetForExecutionHostId,
+ runtimeRpcTargetForAuthorityKey,
runtimeTargetForOwnerEnvironment,
- runtimeTargetForOwnerHostId
+ ipcOrRuntimeTargetForHostId
} from './runtime-client-target'
-describe('runtimeTargetForExecutionHostId', () => {
+describe('runtimeRpcTargetForAuthorityKey', () => {
it('keeps the answers for plain host ids', () => {
- expect(runtimeTargetForExecutionHostId('local')).toEqual({ kind: 'local' })
- expect(runtimeTargetForExecutionHostId('runtime:env%2Fa')).toEqual({
+ expect(runtimeRpcTargetForAuthorityKey('local')).toEqual({ kind: 'local' })
+ expect(runtimeRpcTargetForAuthorityKey('runtime:env%2Fa')).toEqual({
kind: 'environment',
environmentId: 'env/a'
})
- expect(runtimeTargetForExecutionHostId('ssh:box')).toBeNull()
- expect(runtimeTargetForExecutionHostId(UNRESOLVED_OWNER_HOST_ID)).toBeNull()
+ expect(runtimeRpcTargetForAuthorityKey('ssh:box')).toBeNull()
+ expect(runtimeRpcTargetForAuthorityKey(UNRESOLVED_OWNER_HOST_ID)).toBeNull()
})
it('routes a nested SSH key to the server that owns the target', () => {
- expect(runtimeTargetForExecutionHostId('nested:env-a/box')).toEqual({
+ expect(runtimeRpcTargetForAuthorityKey('nested:env-a/box')).toEqual({
kind: 'environment',
environmentId: 'env-a'
})
@@ -52,13 +52,13 @@ describe('owner transports', () => {
})
it('routes local and direct SSH owners through this app and never dials the sentinel', () => {
- expect(runtimeTargetForOwnerHostId('local')).toEqual({ kind: 'local' })
- expect(runtimeTargetForOwnerHostId('ssh:box')).toEqual({ kind: 'local' })
- expect(runtimeTargetForOwnerHostId('runtime:env%2Fa')).toEqual({
+ expect(ipcOrRuntimeTargetForHostId('local')).toEqual({ kind: 'local' })
+ expect(ipcOrRuntimeTargetForHostId('ssh:box')).toEqual({ kind: 'local' })
+ expect(ipcOrRuntimeTargetForHostId('runtime:env%2Fa')).toEqual({
kind: 'environment',
environmentId: 'env/a'
})
- expect(runtimeTargetForOwnerHostId(UNRESOLVED_OWNER_HOST_ID)).toBeNull()
- expect(runtimeTargetForOwnerHostId(undefined)).toBeNull()
+ expect(ipcOrRuntimeTargetForHostId(UNRESOLVED_OWNER_HOST_ID)).toBeNull()
+ expect(ipcOrRuntimeTargetForHostId(undefined)).toBeNull()
})
})
diff --git a/src/renderer/src/runtime/runtime-client-target.ts b/src/renderer/src/runtime/runtime-client-target.ts
index a31f3b203e0..e5507045881 100644
--- a/src/renderer/src/runtime/runtime-client-target.ts
+++ b/src/renderer/src/runtime/runtime-client-target.ts
@@ -1,4 +1,9 @@
-import { parseRoutableExecutionHostId, type ExecutionHostId } from '../../../shared/execution-host'
+import {
+ LOCAL_EXECUTION_HOST_ID,
+ parseRoutableExecutionHostId,
+ toRuntimeExecutionHostId,
+ type ExecutionHostId
+} from '../../../shared/execution-host'
import {
parseHostAuthorityKey,
type HostAuthority,
@@ -6,8 +11,6 @@ import {
} from '../../../shared/host-authority'
import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
-export type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
-
/** Transport to an owner's runtime environment; `null` is this app (local or direct SSH). */
export function runtimeTargetForOwnerEnvironment(
environmentId: string | null
@@ -16,6 +19,13 @@ export function runtimeTargetForOwnerEnvironment(
return ownerId ? { kind: 'environment', environmentId: ownerId } : { kind: 'local' }
}
+/** The host id a transport dials: the server's runtime host, or this app. */
+export function getRuntimeTargetHostId(target: RuntimeClientTarget): ExecutionHostId {
+ return target.kind === 'environment'
+ ? toRuntimeExecutionHostId(target.environmentId)
+ : LOCAL_EXECUTION_HOST_ID
+}
+
/** The server a transport dials, or `null` for this app. */
export function runtimeTargetEnvironmentId(target: RuntimeClientTarget): string | null {
return target.kind === 'environment' ? target.environmentId : null
@@ -26,7 +36,7 @@ export function runtimeTargetEnvironmentId(target: RuntimeClientTarget): string
* rows (this app serves no SSH route, so its IPC refuses those). `null` when the id names no
* routable host.
*/
-export function runtimeTargetForOwnerHostId(
+export function ipcOrRuntimeTargetForHostId(
hostId: ExecutionHostId | null | undefined
): RuntimeClientTarget | null {
const parsed = parseRoutableExecutionHostId(hostId)
@@ -42,7 +52,7 @@ export function runtimeTargetForOwnerHostId(
* RPC target for a dispatchable host; direct SSH and the unresolved-owner sentinel have none. A
* nested authority key routes to the server that owns the SSH target.
*/
-export function runtimeTargetForExecutionHostId(
+export function runtimeRpcTargetForAuthorityKey(
hostId: HostAuthorityKey
): RuntimeClientTarget | null {
const authority = parseHostAuthorityKey(hostId)
diff --git a/src/renderer/src/runtime/runtime-file-client-types.ts b/src/renderer/src/runtime/runtime-file-client-types.ts
index b1929218b8d..be5d00b3a3e 100644
--- a/src/renderer/src/runtime/runtime-file-client-types.ts
+++ b/src/renderer/src/runtime/runtime-file-client-types.ts
@@ -1,4 +1,4 @@
-import type { RuntimeClientTarget } from './runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import type { LocalFileAccess } from '../../../shared/local-file-access'
export type RuntimeReadableFileContent = {
diff --git a/src/renderer/src/runtime/runtime-file-range-client.ts b/src/renderer/src/runtime/runtime-file-range-client.ts
index 08c2dd9bf9e..632ed6afd4f 100644
--- a/src/renderer/src/runtime/runtime-file-range-client.ts
+++ b/src/renderer/src/runtime/runtime-file-range-client.ts
@@ -2,7 +2,8 @@ import type { RuntimeFileReadChunkResult } from '../../../shared/runtime-types'
import { validateFileRangeRequest } from '../../../shared/file-range-read'
import type { RuntimeFileReadArgs } from './runtime-file-client-types'
import { assertExternalSshReadOwnership, canReadRelativeRuntimeFile } from './runtime-file-routing'
-import { callRuntimeRpc, RuntimeRpcCallError } from './runtime-rpc-client'
+import { callRuntimeRpc } from './runtime-rpc-client'
+import { RuntimeRpcCallError } from './runtime-rpc-result'
import { toRuntimeWorktreeSelector } from './runtime-worktree-selector'
function rangeReadTarget(args: RuntimeFileReadArgs) {
diff --git a/src/renderer/src/runtime/runtime-file-read-client.ts b/src/renderer/src/runtime/runtime-file-read-client.ts
index 37e99b6ec69..e27cb343f56 100644
--- a/src/renderer/src/runtime/runtime-file-read-client.ts
+++ b/src/renderer/src/runtime/runtime-file-read-client.ts
@@ -3,7 +3,8 @@ import type {
RuntimeFileReadChunkResult,
RuntimeFileReadResult
} from '../../../shared/runtime-types'
-import { callRuntimeRpc, RuntimeRpcCallError } from './runtime-rpc-client'
+import { callRuntimeRpc } from './runtime-rpc-client'
+import { RuntimeRpcCallError } from './runtime-rpc-result'
import type {
RuntimeFileDownloadResult,
RuntimeFileOperationArgs,
diff --git a/src/renderer/src/runtime/runtime-file-routing.ts b/src/renderer/src/runtime/runtime-file-routing.ts
index 57260254a9a..50562368847 100644
--- a/src/renderer/src/runtime/runtime-file-routing.ts
+++ b/src/renderer/src/runtime/runtime-file-routing.ts
@@ -3,7 +3,7 @@ import {
relativePathInsideRoot
} from '../../../shared/cross-platform-path'
import { normalizeRelativePath } from '@/lib/path'
-import type { RuntimeClientTarget } from './runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { toRuntimeWorktreeSelector } from './runtime-worktree-selector'
import type { RuntimeFileOperationArgs } from './runtime-file-client-types'
diff --git a/src/renderer/src/runtime/runtime-file-search-client.ts b/src/renderer/src/runtime/runtime-file-search-client.ts
index 153a9f476a9..1fb25b4ffec 100644
--- a/src/renderer/src/runtime/runtime-file-search-client.ts
+++ b/src/renderer/src/runtime/runtime-file-search-client.ts
@@ -16,7 +16,8 @@ import {
searchLegacyQuickOpenInventory,
validateLegacyQuickOpenRecentCandidates
} from './runtime-legacy-quick-open-inventory'
-import { callRuntimeRpc, RuntimeRpcCallError } from './runtime-rpc-client'
+import { callRuntimeRpc } from './runtime-rpc-client'
+import { RuntimeRpcCallError } from './runtime-rpc-result'
import { toRuntimeWorktreeSelector } from './runtime-worktree-selector'
const QUICK_OPEN_REMOTE_UPDATE_REQUIRED_MESSAGE =
diff --git a/src/renderer/src/runtime/runtime-file-watch-client.ts b/src/renderer/src/runtime/runtime-file-watch-client.ts
index 9a0737b3a4e..32085bcfac4 100644
--- a/src/renderer/src/runtime/runtime-file-watch-client.ts
+++ b/src/renderer/src/runtime/runtime-file-watch-client.ts
@@ -1,7 +1,8 @@
import type { FsChangedPayload } from '../../../shared/filesystem-entry-types'
import type { RuntimeRpcResponse } from '../../../shared/runtime-rpc-envelope'
import type { RuntimeFileOperationArgs } from './runtime-file-client-types'
-import { callRuntimeRpc, unwrapRuntimeRpcResult } from './runtime-rpc-client'
+import { callRuntimeRpc } from './runtime-rpc-client'
+import { unwrapRuntimeRpcResult } from './runtime-rpc-result'
import { toRuntimeWorktreeSelector } from './runtime-worktree-selector'
type RuntimeFileWatchEvent =
diff --git a/src/renderer/src/runtime/runtime-git-client-context.ts b/src/renderer/src/runtime/runtime-git-client-context.ts
index 736402f7433..0369b920ea3 100644
--- a/src/renderer/src/runtime/runtime-git-client-context.ts
+++ b/src/renderer/src/runtime/runtime-git-client-context.ts
@@ -7,7 +7,7 @@ import type { GlobalSettings } from '../../../shared/global-settings-types'
import type { HostedReviewProvider } from '../../../shared/hosted-review'
import type { ResolvedSourceControlAiGenerationParams } from '../../../shared/source-control-ai'
import { splitWorktreeIdForFilesystem } from '../../../shared/worktree/id'
-import type { RuntimeClientTarget } from './runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
export type RuntimeGenerateCommitMessageResult =
| { success: true; message: string; agentLabel?: string }
diff --git a/src/renderer/src/runtime/runtime-hooks-client.ts b/src/renderer/src/runtime/runtime-hooks-client.ts
index 31d235c7f16..f24af0e6ade 100644
--- a/src/renderer/src/runtime/runtime-hooks-client.ts
+++ b/src/renderer/src/runtime/runtime-hooks-client.ts
@@ -2,11 +2,12 @@ import type { OrcaHooks } from '../../../shared/orca-yaml-hook-types'
import type { ExecutionHostId } from '../../../shared/execution-host'
import type { SetupScriptImportCandidate } from '../../../shared/setup-script-imports'
import { callRuntimeRpc } from './runtime-rpc-client'
-import { runtimeTargetForOwnerHostId, type RuntimeClientTarget } from './runtime-client-target'
+import { ipcOrRuntimeTargetForHostId } from './runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
/** The repo's own host: a server's runtime, or this app (with `hostId`) for local and SSH repos. */
function getHookInspectionTarget(hostId: ExecutionHostId): RuntimeClientTarget {
- const target = runtimeTargetForOwnerHostId(hostId)
+ const target = ipcOrRuntimeTargetForHostId(hostId)
if (!target) {
throw new Error('The project host is unresolved.')
}
diff --git a/src/renderer/src/runtime/runtime-jira-client.ts b/src/renderer/src/runtime/runtime-jira-client.ts
index 3b1b928ecbd..69e55312b3b 100644
--- a/src/renderer/src/runtime/runtime-jira-client.ts
+++ b/src/renderer/src/runtime/runtime-jira-client.ts
@@ -16,7 +16,8 @@ import type {
JiraViewer
} from '../../../shared/jira-types'
import { searchLocalJiraIssues } from './local-jira-search-cancellation'
-import { callRuntimeRpc, RuntimeRpcCallError } from './runtime-rpc-client'
+import { callRuntimeRpc } from './runtime-rpc-client'
+import { RuntimeRpcCallError } from './runtime-rpc-result'
import { isRuntimeProviderSearchQueryWithinLimit } from './runtime-provider-search-bounds'
import { readRuntimeJiraPayload } from './runtime-jira-payload-stream'
import { getJiraRuntimeTarget, type RuntimeJiraSettings } from './runtime-jira-target'
diff --git a/src/renderer/src/runtime/runtime-jira-payload-stream.ts b/src/renderer/src/runtime/runtime-jira-payload-stream.ts
index 1a7f8e194f0..3e6bac78e69 100644
--- a/src/renderer/src/runtime/runtime-jira-payload-stream.ts
+++ b/src/renderer/src/runtime/runtime-jira-payload-stream.ts
@@ -3,7 +3,7 @@ import {
isJiraPayloadStreamMessage,
JIRA_PAYLOAD_MAX_CHARS
} from '../../../shared/jira-payload-stream'
-import { RuntimeRpcCallError } from './runtime-rpc-client'
+import { RuntimeRpcCallError } from './runtime-rpc-result'
type RuntimeJiraPayloadTarget = { kind: 'environment'; environmentId: string }
diff --git a/src/renderer/src/runtime/runtime-jira-target.ts b/src/renderer/src/runtime/runtime-jira-target.ts
index c7874b68a90..b110b1f2589 100644
--- a/src/renderer/src/runtime/runtime-jira-target.ts
+++ b/src/renderer/src/runtime/runtime-jira-target.ts
@@ -1,4 +1,4 @@
-import type { RuntimeClientTarget } from './runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { rowLessSourceTarget, type RowLessSource } from '@/lib/default-creation-host'
export type RuntimeJiraSettings = RowLessSource
diff --git a/src/renderer/src/runtime/runtime-layout-client.test.ts b/src/renderer/src/runtime/runtime-layout-client.test.ts
index d8bc84ee5e8..b28173419b5 100644
--- a/src/renderer/src/runtime/runtime-layout-client.test.ts
+++ b/src/renderer/src/runtime/runtime-layout-client.test.ts
@@ -5,7 +5,7 @@ import {
EMPTY_WORKSPACE_LAYOUT_CACHE,
type WorkspaceLayoutCache
} from '../store/workspace-layout-cache'
-import type { RuntimeClientTarget } from './runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { subscribeRuntimeLayout, type RuntimeLayoutStreamStatus } from './runtime-layout-client'
type FakeStream = {
diff --git a/src/renderer/src/runtime/runtime-layout-client.ts b/src/renderer/src/runtime/runtime-layout-client.ts
index 3434cf24d03..01e6eab01df 100644
--- a/src/renderer/src/runtime/runtime-layout-client.ts
+++ b/src/renderer/src/runtime/runtime-layout-client.ts
@@ -8,7 +8,7 @@ import {
type WorkspaceLayoutChangeFrame,
type WorkspaceLayoutStreamFrame
} from '../../../shared/workspace-layout/workspace-layout-stream-frames'
-import type { RuntimeClientTarget } from './runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { subscribeRuntimeRpc } from './runtime-rpc-subscribe'
/** `retrying`: waiting to reopen a lost stream. `refused`: the host answered that it will never
diff --git a/src/renderer/src/runtime/runtime-legacy-quick-open-inventory.ts b/src/renderer/src/runtime/runtime-legacy-quick-open-inventory.ts
index c7be91dd89e..e45487d79be 100644
--- a/src/renderer/src/runtime/runtime-legacy-quick-open-inventory.ts
+++ b/src/renderer/src/runtime/runtime-legacy-quick-open-inventory.ts
@@ -9,7 +9,8 @@ import {
shouldExcludeQuickOpenRelPath
} from '../../../shared/quick-open-filter'
import { QuickOpenPathRanker } from '../../../shared/quick-open-path-search'
-import { callRuntimeRpc, type RuntimeClientTarget } from './runtime-rpc-client'
+import { callRuntimeRpc } from './runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { createRuntimeRpcAbortError } from './abortable-runtime-environment-call'
import { getRuntimeEnvironmentRevision } from './runtime-environment-revision'
import { MAX_TIMER_DELAY_MS } from '../../../shared/timer-delay'
diff --git a/src/renderer/src/runtime/runtime-linear-client.ts b/src/renderer/src/runtime/runtime-linear-client.ts
index e4576172d07..b4199affe47 100644
--- a/src/renderer/src/runtime/runtime-linear-client.ts
+++ b/src/renderer/src/runtime/runtime-linear-client.ts
@@ -7,7 +7,7 @@ import type {
LinearWorkspaceSelection
} from '../../../shared/linear/workspace-types'
import { callRuntimeRpc, runtimeEnvironmentSupportsCapability } from './runtime-rpc-client'
-import type { RuntimeClientTarget } from './runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { rowLessSourceTarget, type RowLessSource } from '@/lib/default-creation-host'
import { isRuntimeProviderSearchQueryWithinLimit } from './runtime-provider-search-bounds'
import type { LinearIssueAttributeFilter } from '../../../shared/linear/issue-attribute-filter'
diff --git a/src/renderer/src/runtime/runtime-path-existence-batch.ts b/src/renderer/src/runtime/runtime-path-existence-batch.ts
index 280bcb4817c..08cff9c47ed 100644
--- a/src/renderer/src/runtime/runtime-path-existence-batch.ts
+++ b/src/renderer/src/runtime/runtime-path-existence-batch.ts
@@ -8,11 +8,8 @@ import type { RuntimeFileOperationArgs } from './runtime-file-client-types'
import { assertLocalFilesystemFallbackAllowed, getRemoteFileArgs } from './runtime-file-routing'
import { isMissingRuntimePathError, runtimePathExists } from './runtime-file-metadata-client'
import { captureRuntimeEnvironmentRequestRevision } from './runtime-environment-revision'
-import {
- callRuntimeRpc,
- runtimeEnvironmentSupportsCapability,
- RuntimeRpcCallError
-} from './runtime-rpc-client'
+import { callRuntimeRpc, runtimeEnvironmentSupportsCapability } from './runtime-rpc-client'
+import { RuntimeRpcCallError } from './runtime-rpc-result'
export async function runtimePathsExist(
context: RuntimeFileOperationArgs,
diff --git a/src/renderer/src/runtime/runtime-provider-accounts-client.ts b/src/renderer/src/runtime/runtime-provider-accounts-client.ts
index 6db5a4cc603..394858ab44b 100644
--- a/src/renderer/src/runtime/runtime-provider-accounts-client.ts
+++ b/src/renderer/src/runtime/runtime-provider-accounts-client.ts
@@ -4,7 +4,9 @@ import type {
} from '../../../shared/managed-account-types'
import type { RateLimitState } from '../../../shared/rate-limit-types'
import type { RuntimeRpcResponse } from '../../../shared/runtime-rpc-envelope'
-import { callRuntimeRpc, RuntimeRpcCallError, type RuntimeClientTarget } from './runtime-rpc-client'
+import { callRuntimeRpc } from './runtime-rpc-client'
+import { RuntimeRpcCallError } from './runtime-rpc-result'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
// Mirrors OrcaRuntime.getAccountsSnapshot() / the accounts.subscribe payload.
export type ProviderAccountsSnapshot = {
diff --git a/src/renderer/src/runtime/runtime-repo-client.ts b/src/renderer/src/runtime/runtime-repo-client.ts
index 56214db1c92..d043f83853d 100644
--- a/src/renderer/src/runtime/runtime-repo-client.ts
+++ b/src/renderer/src/runtime/runtime-repo-client.ts
@@ -1,13 +1,14 @@
import type { BaseRefSearchResult } from '../../../shared/repo-types'
import { legacyBaseRefSearchResult } from '../../../shared/base-ref-search-result'
import { callRuntimeRpc } from './runtime-rpc-client'
-import { runtimeTargetForOwnerHostId, type RuntimeClientTarget } from './runtime-client-target'
+import { ipcOrRuntimeTargetForHostId } from './runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { isRuntimeRepoRefSearchQueryWithinLimit } from './runtime-repo-search-bounds'
import type { ExecutionHostId } from '../../../shared/execution-host'
/** The repo's own host: a server's runtime, or this app (with `hostId`) for local and SSH repos. */
function repoHostTarget(hostId: ExecutionHostId): RuntimeClientTarget {
- const target = runtimeTargetForOwnerHostId(hostId)
+ const target = ipcOrRuntimeTargetForHostId(hostId)
if (!target) {
throw new Error('The project host is unresolved.')
}
diff --git a/src/renderer/src/runtime/runtime-rpc-client.test.ts b/src/renderer/src/runtime/runtime-rpc-client.test.ts
index 72122a2b40b..d41a6764155 100644
--- a/src/renderer/src/runtime/runtime-rpc-client.test.ts
+++ b/src/renderer/src/runtime/runtime-rpc-client.test.ts
@@ -5,10 +5,9 @@ import {
assertRuntimeEnvironmentCapability,
clearRecentRuntimeCompatibilityFailure,
clearRuntimeCompatibilityCacheForTests,
- runtimeEnvironmentSupportsCapability,
- RuntimeRpcCallError,
- unwrapRuntimeRpcResult
+ runtimeEnvironmentSupportsCapability
} from './runtime-rpc-client'
+import { RuntimeRpcCallError, unwrapRuntimeRpcResult } from './runtime-rpc-result'
import {
MIN_COMPATIBLE_RUNTIME_CLIENT_VERSION,
RUNTIME_PROTOCOL_VERSION
diff --git a/src/renderer/src/runtime/runtime-rpc-client.ts b/src/renderer/src/runtime/runtime-rpc-client.ts
index a2fa5f173c8..fcbd6213651 100644
--- a/src/renderer/src/runtime/runtime-rpc-client.ts
+++ b/src/renderer/src/runtime/runtime-rpc-client.ts
@@ -8,14 +8,7 @@ import { createRuntimeRpcAbortError } from './abortable-runtime-environment-call
import { callRuntimeEnvironmentWithRevision } from './runtime-rpc-environment-call'
import { unwrapRuntimeRpcResult } from './runtime-rpc-result'
import { captureRuntimeEnvironmentRequestRevision } from './runtime-environment-revision'
-import type { RuntimeClientTarget } from './runtime-client-target'
-
-export { type RuntimeClientTarget } from './runtime-client-target'
-export {
- hasRuntimeRpcErrorCode,
- RuntimeRpcCallError,
- unwrapRuntimeRpcResult
-} from './runtime-rpc-result'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
const RUNTIME_COMPATIBILITY_CACHE_MAX = 32
const RECENT_RUNTIME_COMPATIBILITY_FAILURE_TTL_MS = 60_000
diff --git a/src/renderer/src/runtime/runtime-rpc-subscribe.ts b/src/renderer/src/runtime/runtime-rpc-subscribe.ts
index ffe8e389409..6668423659b 100644
--- a/src/renderer/src/runtime/runtime-rpc-subscribe.ts
+++ b/src/renderer/src/runtime/runtime-rpc-subscribe.ts
@@ -1,5 +1,5 @@
import type { RuntimeRpcResponse } from '../../../shared/runtime-rpc-envelope'
-import type { RuntimeClientTarget } from './runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { subscribeRuntimeEnvironment } from './runtime-environment-pairing-refresh'
import { getRuntimeEnvironmentRevision } from './runtime-environment-revision'
diff --git a/src/renderer/src/runtime/runtime-skills-client.ts b/src/renderer/src/runtime/runtime-skills-client.ts
index 33cade9ef55..0060c02a9f3 100644
--- a/src/renderer/src/runtime/runtime-skills-client.ts
+++ b/src/renderer/src/runtime/runtime-skills-client.ts
@@ -11,9 +11,9 @@ import type { SkillDiscoveryResult, SkillDiscoveryTarget } from '../../../shared
import {
assertRuntimeEnvironmentCapability,
callRuntimeRpc,
- runtimeEnvironmentSupportsCapability,
- type RuntimeClientTarget
+ runtimeEnvironmentSupportsCapability
} from './runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
const SKILL_DISCOVERY_TIMEOUT_MS = 15_000
diff --git a/src/renderer/src/runtime/runtime-status-probe-diagnostics.ts b/src/renderer/src/runtime/runtime-status-probe-diagnostics.ts
index 1b866e73a8a..6f42496b987 100644
--- a/src/renderer/src/runtime/runtime-status-probe-diagnostics.ts
+++ b/src/renderer/src/runtime/runtime-status-probe-diagnostics.ts
@@ -1,5 +1,5 @@
import type { RemoteRuntimeSharedConnectionDiagnostics } from '../../../shared/remote-runtime-shared-control-types'
-import { RuntimeRpcCallError } from './runtime-rpc-client'
+import { RuntimeRpcCallError } from './runtime-rpc-result'
export function extractRuntimeTransportDiagnostics(
error: unknown
diff --git a/src/renderer/src/runtime/runtime-terminal-artifact-read.ts b/src/renderer/src/runtime/runtime-terminal-artifact-read.ts
index bba09589a4d..0ddc09bbbeb 100644
--- a/src/renderer/src/runtime/runtime-terminal-artifact-read.ts
+++ b/src/renderer/src/runtime/runtime-terminal-artifact-read.ts
@@ -1,7 +1,8 @@
import type { RuntimeFilePreviewResult, RuntimeFileReadResult } from '../../../shared/runtime-types'
-import type { RuntimeClientTarget } from './runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import type { RuntimeReadableFileContent } from './runtime-file-client-types'
-import { callRuntimeRpc, RuntimeRpcCallError } from './runtime-rpc-client'
+import { callRuntimeRpc } from './runtime-rpc-client'
+import { RuntimeRpcCallError } from './runtime-rpc-result'
import { toRuntimeWorktreeSelector } from './runtime-worktree-selector'
/** Reads a host file outside every workspace through the grant its host issued for it. */
diff --git a/src/renderer/src/runtime/runtime-terminal-stream.ts b/src/renderer/src/runtime/runtime-terminal-stream.ts
index 844cc160b5f..f6a2e827b0f 100644
--- a/src/renderer/src/runtime/runtime-terminal-stream.ts
+++ b/src/renderer/src/runtime/runtime-terminal-stream.ts
@@ -1,4 +1,4 @@
-import { RuntimeRpcCallError } from './runtime-rpc-client'
+import { RuntimeRpcCallError } from './runtime-rpc-result'
import { getRemoteRuntimeTerminalMultiplexer } from './remote-runtime-terminal-multiplexer'
import { parseRemoteRuntimePtyId } from '../../../shared/remote-runtime-pty-id'
diff --git a/src/renderer/src/runtime/runtime-workspace-attachment-capabilities.ts b/src/renderer/src/runtime/runtime-workspace-attachment-capabilities.ts
index 3f8702205c3..5fe1d3b4e2a 100644
--- a/src/renderer/src/runtime/runtime-workspace-attachment-capabilities.ts
+++ b/src/renderer/src/runtime/runtime-workspace-attachment-capabilities.ts
@@ -3,7 +3,8 @@ import {
WORKTREE_LINKED_ITEMS_RUNTIME_CAPABILITY,
WORKTREE_LINKED_ITEMS_DELTA_RUNTIME_CAPABILITY
} from '../../../shared/workspace-attachment-capabilities'
-import { assertRuntimeEnvironmentCapability, type RuntimeClientTarget } from './runtime-rpc-client'
+import { assertRuntimeEnvironmentCapability } from './runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { translate } from '@/i18n/i18n'
export async function assertWorkspaceAttachmentWriteCapability(
diff --git a/src/renderer/src/runtime/structured-agent-session-client.ts b/src/renderer/src/runtime/structured-agent-session-client.ts
index 2913fe7598a..eb12f827567 100644
--- a/src/renderer/src/runtime/structured-agent-session-client.ts
+++ b/src/renderer/src/runtime/structured-agent-session-client.ts
@@ -16,11 +16,8 @@ import {
type RuntimeCapability
} from '../../../shared/protocol-version'
import { AGENT_SESSION_CREATE_MESSAGE_RUNTIME_CAPABILITY } from '../../../shared/agent-session-create-capabilities'
-import {
- callRuntimeRpc,
- runtimeEnvironmentSupportsCapability,
- type RuntimeClientTarget
-} from './runtime-rpc-client'
+import { callRuntimeRpc, runtimeEnvironmentSupportsCapability } from './runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import {
ensureLocalRuntimeCapabilities,
readLocalRuntimeCapabilitiesOrUnknown
diff --git a/src/renderer/src/runtime/structured-agent-session-close.ts b/src/renderer/src/runtime/structured-agent-session-close.ts
index d11094379dd..a5f75098094 100644
--- a/src/renderer/src/runtime/structured-agent-session-close.ts
+++ b/src/renderer/src/runtime/structured-agent-session-close.ts
@@ -1,8 +1,6 @@
import { STRUCTURED_AGENT_SESSION_RUNTIME_CAPABILITY } from '../../../shared/protocol-version'
-import {
- runtimeEnvironmentSupportsCapability,
- type RuntimeClientTarget
-} from './runtime-rpc-client'
+import { runtimeEnvironmentSupportsCapability } from './runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { callStructuredAgentSession } from './structured-agent-session-client'
export async function closeStructuredAgentSession(
diff --git a/src/renderer/src/runtime/structured-agent-session-host-capability.test.tsx b/src/renderer/src/runtime/structured-agent-session-host-capability.test.tsx
index 7c8a0d4e342..890320e3a9e 100644
--- a/src/renderer/src/runtime/structured-agent-session-host-capability.test.tsx
+++ b/src/renderer/src/runtime/structured-agent-session-host-capability.test.tsx
@@ -15,9 +15,7 @@ const mocks = vi.hoisted(() => ({
contactRegained: new Map void>()
}))
-vi.mock('./runtime-rpc-client', () => ({
- runtimeEnvironmentSupportsCapability: mocks.supports
-}))
+vi.mock('./runtime-rpc-client', () => ({ runtimeEnvironmentSupportsCapability: mocks.supports }))
vi.mock('./runtime-host-contact-regained', () => ({
subscribeRuntimeHostContactRegained: (environmentId: string, listener: () => void) => {
diff --git a/src/renderer/src/runtime/structured-agent-session-host-capability.ts b/src/renderer/src/runtime/structured-agent-session-host-capability.ts
index 30c1b40553a..e10d12804cf 100644
--- a/src/renderer/src/runtime/structured-agent-session-host-capability.ts
+++ b/src/renderer/src/runtime/structured-agent-session-host-capability.ts
@@ -7,7 +7,7 @@ import {
AGENT_SESSION_REWIND_RECOVERY_CAPABILITY,
type RuntimeCapability
} from '../../../shared/protocol-version'
-import type { RuntimeClientTarget } from './runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import {
ensureLocalRuntimeCapabilities,
readLocalRuntimeCapabilitiesOrUnknown
diff --git a/src/renderer/src/runtime/structured-agent-session-owner.ts b/src/renderer/src/runtime/structured-agent-session-owner.ts
index 0ccb2bbf120..bd3dcc09a7b 100644
--- a/src/renderer/src/runtime/structured-agent-session-owner.ts
+++ b/src/renderer/src/runtime/structured-agent-session-owner.ts
@@ -5,13 +5,12 @@ import {
type ExecutionHostId
} from '../../../shared/execution-host'
import type { Tab } from '../../../shared/tab-types'
-import {
- getExecutionHostIdForWorktree,
- type WorktreeRuntimeOwnerState
-} from '@/lib/worktree-runtime-owner'
+import { getExecutionHostIdForWorktree } from '@/lib/worktree-runtime-owner'
+import type { WorktreeRuntimeOwnerState } from '@/lib/worktree-runtime-owner-state'
import { resolveIndexedWorktreeOwner } from '@/lib/worktree-runtime-owner-index'
import { LOCAL_STRUCTURED_SESSION_OWNER } from './local-structured-session-owner'
-import { runtimeTargetForExecutionHostId, type RuntimeClientTarget } from './runtime-client-target'
+import { runtimeRpcTargetForAuthorityKey } from './runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
/**
* The one mapping from a chat's owning host to the runtime that serves it. Null for an owner no
@@ -21,7 +20,7 @@ export function structuredAgentSessionTargetForHost(
executionHostId: string | null | undefined
): RuntimeClientTarget | null {
const host = parseExecutionHostId(executionHostId)
- return host ? runtimeTargetForExecutionHostId(host.id) : null
+ return host ? runtimeRpcTargetForAuthorityKey(host.id) : null
}
/**
diff --git a/src/renderer/src/runtime/structured-agent-session-status-feed.ts b/src/renderer/src/runtime/structured-agent-session-status-feed.ts
index e0c14dc5772..82b741d2b59 100644
--- a/src/renderer/src/runtime/structured-agent-session-status-feed.ts
+++ b/src/renderer/src/runtime/structured-agent-session-status-feed.ts
@@ -12,10 +12,8 @@ import {
type AgentSessionStatusSnapshot
} from '../../../shared/agent-session-status-snapshot-fold'
import { AGENT_SESSION_STATUS_FEED_RUNTIME_CAPABILITY } from '../../../shared/protocol-version'
-import {
- runtimeEnvironmentSupportsCapability,
- type RuntimeClientTarget
-} from './runtime-rpc-client'
+import { runtimeEnvironmentSupportsCapability } from './runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { subscribeStructuredAgentSessionStatus } from './structured-agent-session-client'
export type StructuredAgentSessionStatusSnapshot = AgentSessionStatusSnapshot
diff --git a/src/renderer/src/runtime/structured-agent-session-tab-retirement.test.ts b/src/renderer/src/runtime/structured-agent-session-tab-retirement.test.ts
index 749a72d9c04..3882bc504c7 100644
--- a/src/renderer/src/runtime/structured-agent-session-tab-retirement.test.ts
+++ b/src/renderer/src/runtime/structured-agent-session-tab-retirement.test.ts
@@ -1,6 +1,6 @@
import { beforeEach, describe, expect, it, vi } from 'vitest'
import type { RuntimeMobileSessionTabsResult } from '../../../shared/runtime-types'
-import type { RuntimeClientTarget } from './runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
const mocks = vi.hoisted(() => ({
closeSession:
@@ -37,9 +37,7 @@ vi.mock('@/components/native-chat/structured-agent-session-message-sender', () =
vi.mock('./structured-agent-session-close', () => ({
closeStructuredAgentSession: mocks.closeSession
}))
-vi.mock('./runtime-rpc-client', () => ({
- callRuntimeRpc: mocks.callRuntime
-}))
+vi.mock('./runtime-rpc-client', () => ({ callRuntimeRpc: mocks.callRuntime }))
vi.mock('./local-session-tab-close-owner', () => ({
withLocalSessionTabCloseOwner: async (
_worktreeId: string,
diff --git a/src/renderer/src/runtime/structured-agent-session-tab-retirement.ts b/src/renderer/src/runtime/structured-agent-session-tab-retirement.ts
index 649d5e79b9d..23b7b4cae65 100644
--- a/src/renderer/src/runtime/structured-agent-session-tab-retirement.ts
+++ b/src/renderer/src/runtime/structured-agent-session-tab-retirement.ts
@@ -21,7 +21,8 @@ import {
import { clearWebSessionCloseIntent, recordWebSessionCloseIntent } from './web-session-close-intent'
import type { WebSessionIntentOwner } from './web-session-intent-owner'
import { captureWebSessionIntentOwner } from './web-runtime-session-environment'
-import { callRuntimeRpc, type RuntimeClientTarget } from './runtime-rpc-client'
+import { callRuntimeRpc } from './runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { toRuntimeWorktreeSelector } from './runtime-worktree-selector'
const inFlightRetirements = new Map>()
diff --git a/src/renderer/src/runtime/structured-agent-session-turn-completion-feed.ts b/src/renderer/src/runtime/structured-agent-session-turn-completion-feed.ts
index 3fc1eb65e42..a30a146ccf0 100644
--- a/src/renderer/src/runtime/structured-agent-session-turn-completion-feed.ts
+++ b/src/renderer/src/runtime/structured-agent-session-turn-completion-feed.ts
@@ -13,10 +13,8 @@
import type { AgentSessionTurnCompletionEvent } from '../../../shared/agent-session-wire'
import type { AgentSessionAttentionEdge } from '../../../shared/agent-session-attention'
import { AGENT_SESSION_TURN_COMPLETION_RUNTIME_CAPABILITY } from '../../../shared/protocol-version'
-import {
- runtimeEnvironmentSupportsCapability,
- type RuntimeClientTarget
-} from './runtime-rpc-client'
+import { runtimeEnvironmentSupportsCapability } from './runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { subscribeStructuredAgentSessionTurnCompletions } from './structured-agent-session-client'
export type StructuredAgentSessionTurnCompletionListener = (edge: AgentSessionAttentionEdge) => void
diff --git a/src/renderer/src/runtime/structured-session-orca-session-id.ts b/src/renderer/src/runtime/structured-session-orca-session-id.ts
index 2cff705daa5..a86cfc696fb 100644
--- a/src/renderer/src/runtime/structured-session-orca-session-id.ts
+++ b/src/renderer/src/runtime/structured-session-orca-session-id.ts
@@ -1,6 +1,8 @@
import { formatOrcaSessionAddress, isOrcaSessionId } from '../../../shared/orca-session-address'
import type { OrchestrationSessionAddressResult } from '../../../shared/orchestration-caller-status'
-import { callRuntimeRpc, RuntimeRpcCallError, type RuntimeClientTarget } from './runtime-rpc-client'
+import { callRuntimeRpc } from './runtime-rpc-client'
+import { RuntimeRpcCallError } from './runtime-rpc-result'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
/**
* A chat's Orca session ID: its `/clear` root's, which the host derives from the session records.
diff --git a/src/renderer/src/runtime/structured-session-tab-inventory.ts b/src/renderer/src/runtime/structured-session-tab-inventory.ts
index 30e0aad531c..88fec6b60f1 100644
--- a/src/renderer/src/runtime/structured-session-tab-inventory.ts
+++ b/src/renderer/src/runtime/structured-session-tab-inventory.ts
@@ -1,6 +1,6 @@
import type { RuntimeMobileSessionTabsResult } from '../../../shared/runtime-types'
import { refreshLocalStructuredSessionTabs } from './local-structured-session-tabs-sync/inventory-refresh'
-import type { RuntimeClientTarget } from './runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { callRuntimeRpc } from './runtime-rpc-client'
import { isSessionTabsListAllResult } from './web-session-tabs-sync/tracking'
diff --git a/src/renderer/src/runtime/use-host-structured-agent.ts b/src/renderer/src/runtime/use-host-structured-agent.ts
index 3c83d25f010..abeb9d0768a 100644
--- a/src/renderer/src/runtime/use-host-structured-agent.ts
+++ b/src/renderer/src/runtime/use-host-structured-agent.ts
@@ -8,7 +8,7 @@ import {
readHostStructuredAgentsForRuntime,
subscribeHostStructuredAgents
} from './host-structured-agents'
-import type { RuntimeClientTarget } from './runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
/** Whether a chat may carry images: what its session's options report said, else what its host
* registered for the agent, else what every build has always sent the agents it ships. An unlisted
diff --git a/src/renderer/src/runtime/use-worktree-runtime-target.ts b/src/renderer/src/runtime/use-worktree-runtime-target.ts
index 07abb555f1f..b108567f005 100644
--- a/src/renderer/src/runtime/use-worktree-runtime-target.ts
+++ b/src/renderer/src/runtime/use-worktree-runtime-target.ts
@@ -4,11 +4,11 @@ import { getExecutionHostIdForWorktree } from '@/lib/worktree-runtime-owner'
import { getRuntimeTargetForFileOwner } from '@/lib/file-owner-runtime-target'
import { getActiveWorkspaceOwnerTarget } from '@/lib/resolved-worktree-execution-host'
import {
- runtimeTargetForExecutionHostId,
+ runtimeRpcTargetForAuthorityKey,
runtimeTargetEnvironmentId,
- runtimeTargetForOwnerEnvironment,
- type RuntimeClientTarget
+ runtimeTargetForOwnerEnvironment
} from './runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
/**
* Runtime target that owns `worktreeId`, which is not always the globally
@@ -19,7 +19,7 @@ export function useWorktreeRuntimeTarget(
worktreeId: string | null | undefined
): RuntimeClientTarget | null {
const executionHostId = useAppStore((state) => getExecutionHostIdForWorktree(state, worktreeId))
- return useMemo(() => runtimeTargetForExecutionHostId(executionHostId), [executionHostId])
+ return useMemo(() => runtimeRpcTargetForAuthorityKey(executionHostId), [executionHostId])
}
/**
diff --git a/src/renderer/src/runtime/web-runtime-browser-capability-cleanup.test.ts b/src/renderer/src/runtime/web-runtime-browser-capability-cleanup.test.ts
index a4b11ce53e9..96e06d16ccd 100644
--- a/src/renderer/src/runtime/web-runtime-browser-capability-cleanup.test.ts
+++ b/src/renderer/src/runtime/web-runtime-browser-capability-cleanup.test.ts
@@ -40,9 +40,7 @@ vi.mock('@/lib/feature-education-telemetry', () => ({
trackTerminalPaneSplit: vi.fn()
}))
-vi.mock('@/lib/worktree-runtime-owner', () => ({
- getRuntimeEnvironmentIdForWorktree: vi.fn()
-}))
+vi.mock('@/lib/worktree-runtime-owner', () => ({ getRuntimeEnvironmentIdForWorktree: vi.fn() }))
vi.mock('@/lib/agent-launch-prompt-delivery', () => ({
deliverLaunchPromptToAgentTab: vi.fn(),
diff --git a/src/renderer/src/runtime/web-runtime-browser-creation-failure.ts b/src/renderer/src/runtime/web-runtime-browser-creation-failure.ts
index 36a774ad5f8..0b52148ab50 100644
--- a/src/renderer/src/runtime/web-runtime-browser-creation-failure.ts
+++ b/src/renderer/src/runtime/web-runtime-browser-creation-failure.ts
@@ -1,5 +1,5 @@
import { useAppStore } from '../store'
-import { hasRuntimeRpcErrorCode } from './runtime-rpc-client'
+import { hasRuntimeRpcErrorCode } from './runtime-rpc-result'
import { clearWebSessionFocusIntentIfMatches } from './web-session-focus-intent'
import {
claimWebSessionBrowserPlacementGroupCleanup,
diff --git a/src/renderer/src/runtime/web-runtime-browser-creation.ts b/src/renderer/src/runtime/web-runtime-browser-creation.ts
index abb119fe915..57c60aa6409 100644
--- a/src/renderer/src/runtime/web-runtime-browser-creation.ts
+++ b/src/renderer/src/runtime/web-runtime-browser-creation.ts
@@ -3,7 +3,7 @@ import type { RuntimeRpcResponse } from '../../../shared/runtime-rpc-envelope'
import type { BrowserTabCreateResult } from '../../../shared/runtime-types'
import { translate } from '../i18n/i18n'
import { useAppStore } from '../store'
-import { hasRuntimeRpcErrorCode, unwrapRuntimeRpcResult } from './runtime-rpc-client'
+import { hasRuntimeRpcErrorCode, unwrapRuntimeRpcResult } from './runtime-rpc-result'
import { toRuntimeWorktreeSelector } from './runtime-worktree-selector'
import { hasMaterializedWebRuntimeBrowserPage } from './web-runtime-browser-materialization'
import { waitForWebRuntimeBrowserPageMaterialization } from './web-runtime-browser-materialization-wait'
diff --git a/src/renderer/src/runtime/web-runtime-session-snapshot.ts b/src/renderer/src/runtime/web-runtime-session-snapshot.ts
index e2805054be2..5d9899bcea4 100644
--- a/src/renderer/src/runtime/web-runtime-session-snapshot.ts
+++ b/src/renderer/src/runtime/web-runtime-session-snapshot.ts
@@ -7,7 +7,7 @@ import {
listRemoteRuntimeSessionTabsDeduped
} from './remote-runtime-session-tabs-inflight'
import { getRuntimeEnvironmentRevision } from './runtime-environment-revision'
-import { unwrapRuntimeRpcResult } from './runtime-rpc-client'
+import { unwrapRuntimeRpcResult } from './runtime-rpc-result'
import { toRuntimeWorktreeSelector } from './runtime-worktree-selector'
import { captureRuntimeEnvironmentCall } from './web-runtime-session-environment'
import { throwIfE2eWebRuntimeBrowserReconciliationFails } from './web-runtime-browser-creation-e2e-fault'
diff --git a/src/renderer/src/runtime/web-runtime-session-tab-lifecycle.ts b/src/renderer/src/runtime/web-runtime-session-tab-lifecycle.ts
index 69dcd50706e..f308587fd54 100644
--- a/src/renderer/src/runtime/web-runtime-session-tab-lifecycle.ts
+++ b/src/renderer/src/runtime/web-runtime-session-tab-lifecycle.ts
@@ -4,7 +4,7 @@ import type {
RuntimeSessionTabCloseReason
} from '../../../shared/runtime-types'
import { useAppStore } from '../store'
-import { hasRuntimeRpcErrorCode, unwrapRuntimeRpcResult } from './runtime-rpc-client'
+import { hasRuntimeRpcErrorCode, unwrapRuntimeRpcResult } from './runtime-rpc-result'
import { toRuntimeWorktreeSelector } from './runtime-worktree-selector'
import {
clearWebSessionCloseIntent,
diff --git a/src/renderer/src/runtime/web-runtime-session-tab-move.ts b/src/renderer/src/runtime/web-runtime-session-tab-move.ts
index d33d04a74c1..62509918103 100644
--- a/src/renderer/src/runtime/web-runtime-session-tab-move.ts
+++ b/src/renderer/src/runtime/web-runtime-session-tab-move.ts
@@ -4,7 +4,7 @@ import type {
RuntimeMobileSessionTabMoveResult
} from '../../../shared/runtime-types'
import { useAppStore } from '../store'
-import { unwrapRuntimeRpcResult } from './runtime-rpc-client'
+import { unwrapRuntimeRpcResult } from './runtime-rpc-result'
import { toRuntimeWorktreeSelector } from './runtime-worktree-selector'
import {
clearWebSessionReorderIntent,
diff --git a/src/renderer/src/runtime/web-runtime-terminal-actions.ts b/src/renderer/src/runtime/web-runtime-terminal-actions.ts
index 33b88f8f105..c0bfab771ea 100644
--- a/src/renderer/src/runtime/web-runtime-terminal-actions.ts
+++ b/src/renderer/src/runtime/web-runtime-terminal-actions.ts
@@ -6,7 +6,7 @@ import type { TerminalPaneLayoutNode } from '../../../shared/terminal-tab-types'
import type { PaneLayoutEditIntent } from '../../../shared/rpc-contract/session-tabs-schemas-params'
import { getRuntimeEnvironmentIdForWorktree } from '../lib/worktree-runtime-owner'
import { useAppStore } from '../store'
-import { unwrapRuntimeRpcResult } from './runtime-rpc-client'
+import { unwrapRuntimeRpcResult } from './runtime-rpc-result'
import { parseRemoteRuntimePtyId } from './runtime-terminal-stream'
import { toRuntimeWorktreeSelector } from './runtime-worktree-selector'
import { isWebTerminalSurfaceTabId, toHostSessionTabId } from '../../../shared/terminal-surface-id'
diff --git a/src/renderer/src/runtime/web-runtime-terminal-buffer-actions.ts b/src/renderer/src/runtime/web-runtime-terminal-buffer-actions.ts
index 8759f2feaeb..35e42346a59 100644
--- a/src/renderer/src/runtime/web-runtime-terminal-buffer-actions.ts
+++ b/src/renderer/src/runtime/web-runtime-terminal-buffer-actions.ts
@@ -1,4 +1,4 @@
-import { unwrapRuntimeRpcResult } from './runtime-rpc-client'
+import { unwrapRuntimeRpcResult } from './runtime-rpc-result'
import { parseRemoteRuntimePtyId } from './runtime-terminal-stream'
import { isWebRuntimeSessionActive } from './web-runtime-session-environment'
diff --git a/src/renderer/src/runtime/web-runtime-terminal-create-operation.ts b/src/renderer/src/runtime/web-runtime-terminal-create-operation.ts
index 9a8ef12d857..bd46cc8eff1 100644
--- a/src/renderer/src/runtime/web-runtime-terminal-create-operation.ts
+++ b/src/renderer/src/runtime/web-runtime-terminal-create-operation.ts
@@ -11,7 +11,7 @@ import {
withAgentSessionCreateOperationId
} from './agent-session-create-operation'
import { runRemoteAgentSessionLaunch } from './remote-agent-session-launch'
-import { unwrapRuntimeRpcResult } from './runtime-rpc-client'
+import { unwrapRuntimeRpcResult } from './runtime-rpc-result'
import { toRuntimeWorktreeSelector } from './runtime-worktree-selector'
import { resolveWebRuntimeSessionEnvironmentId } from './web-runtime-session-workspace-routing'
import { recordWebSessionFocusIntent } from './web-session-focus-intent'
diff --git a/src/renderer/src/runtime/web-runtime-worktree-activation.ts b/src/renderer/src/runtime/web-runtime-worktree-activation.ts
index e542283c53d..ba97603c652 100644
--- a/src/renderer/src/runtime/web-runtime-worktree-activation.ts
+++ b/src/renderer/src/runtime/web-runtime-worktree-activation.ts
@@ -1,6 +1,6 @@
import type { RuntimeRpcResponse } from '../../../shared/runtime-rpc-envelope'
import { useAppStore } from '../store'
-import { unwrapRuntimeRpcResult } from './runtime-rpc-client'
+import { unwrapRuntimeRpcResult } from './runtime-rpc-result'
import { toRuntimeWorktreeSelector } from './runtime-worktree-selector'
import {
captureRuntimeEnvironmentCall,
diff --git a/src/renderer/src/store/adopt-from-endpoint.test.ts b/src/renderer/src/store/adopt-from-endpoint.test.ts
index 1634de3dab3..1b26d5efdc1 100644
--- a/src/renderer/src/store/adopt-from-endpoint.test.ts
+++ b/src/renderer/src/store/adopt-from-endpoint.test.ts
@@ -3,7 +3,7 @@ import type { FolderWorkspace } from '../../../shared/folder-workspace-types'
import type { ProjectGroup } from '../../../shared/project-group-types'
import type { ProjectHostSetup } from '../../../shared/project-types'
import type { Repo } from '../../../shared/repo-types'
-import type { RuntimeClientTarget } from '../runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { adoptFromEndpoint } from './adopt-from-endpoint'
import { getFolderWorkspaceHostId } from './folder-workspaces/folder-workspace-catalog'
diff --git a/src/renderer/src/store/adopt-from-endpoint.ts b/src/renderer/src/store/adopt-from-endpoint.ts
index 4a7b37fc4d0..07b8ec6978d 100644
--- a/src/renderer/src/store/adopt-from-endpoint.ts
+++ b/src/renderer/src/store/adopt-from-endpoint.ts
@@ -14,8 +14,8 @@ import {
type ExecutionHostId
} from '../../../shared/execution-host'
import { normalizeProjectHostSetupRow } from '../../../shared/project-catalog-row-normalization'
-import type { RuntimeClientTarget } from '../runtime/runtime-client-target'
-import { getRuntimeTargetHostId } from './runtime-target-host'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
+import { getRuntimeTargetHostId } from '../runtime/runtime-client-target'
export type FetchedRepo = { kind: 'repo'; row: Repo }
export type FetchedProjectGroup = { kind: 'projectGroup'; row: ProjectGroup }
diff --git a/src/renderer/src/store/folder-workspaces/folder-workspace-catalog.ts b/src/renderer/src/store/folder-workspaces/folder-workspace-catalog.ts
index c334c7d309a..dc84a9545f3 100644
--- a/src/renderer/src/store/folder-workspaces/folder-workspace-catalog.ts
+++ b/src/renderer/src/store/folder-workspaces/folder-workspace-catalog.ts
@@ -11,7 +11,8 @@ import {
import { folderWorkspaceKey, parseWorkspaceKey } from '../../../../shared/workspace-scope'
import { catalogOwnsHost, getProjectGroupHostId } from '../slices/project-group-owner-routing'
import type { FolderWorkspaceUpdateTicket } from '../slices/folder-workspace-update-coordinator'
-import { callRuntimeRpc, type RuntimeClientTarget } from '../../runtime/runtime-rpc-client'
+import { callRuntimeRpc } from '../../runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import type {
FolderWorkspaceUpdateCoordinatorInstance,
FolderWorkspaceUpdateField
@@ -20,7 +21,7 @@ import {
folderWorkspaceUpdateInvalidatesPathStatus,
mergeFolderWorkspaceUpdateResponse
} from './folder-workspace-routing'
-import { getRuntimeTargetHostId } from '../runtime-target-host'
+import { getRuntimeTargetHostId } from '../../runtime/runtime-client-target'
import { adoptFromEndpoint } from '../adopt-from-endpoint'
import { mergeByIdentity, unchangedMergeSource } from '../catalog-identity'
diff --git a/src/renderer/src/store/folder-workspaces/folder-workspace-mutations.ts b/src/renderer/src/store/folder-workspaces/folder-workspace-mutations.ts
index fb55f9b71b3..f4db448c241 100644
--- a/src/renderer/src/store/folder-workspaces/folder-workspace-mutations.ts
+++ b/src/renderer/src/store/folder-workspaces/folder-workspace-mutations.ts
@@ -8,7 +8,10 @@ import {
assertRuntimeEnvironmentCapability,
callRuntimeRpc
} from '../../runtime/runtime-rpc-client'
-import { runtimeTargetForOwnerEnvironment } from '../../runtime/runtime-client-target'
+import {
+ runtimeTargetForOwnerEnvironment,
+ getRuntimeTargetHostId
+} from '../../runtime/runtime-client-target'
import { folderWorkspaceKey } from '../../../../shared/workspace-scope'
import { formatFolderWorkspaceCreateError } from '../../lib/folder-workspace-path-status'
import {
@@ -17,7 +20,6 @@ import {
} from '@/lib/folder-workspace-runtime-owner'
import { FolderWorkspaceUpdateCoordinator } from '../slices/folder-workspace-update-coordinator'
import type { FolderWorkspaceUpdates, RepoSlice } from '../repos/repo-state'
-import { getRuntimeTargetHostId } from '../runtime-target-host'
import { adoptFromEndpoint } from '../adopt-from-endpoint'
import {
folderWorkspaceOwnerTarget,
diff --git a/src/renderer/src/store/folder-workspaces/folder-workspace-routing.ts b/src/renderer/src/store/folder-workspaces/folder-workspace-routing.ts
index b2351a7c768..f4a78a70d10 100644
--- a/src/renderer/src/store/folder-workspaces/folder-workspace-routing.ts
+++ b/src/renderer/src/store/folder-workspaces/folder-workspace-routing.ts
@@ -1,9 +1,7 @@
import type { FolderWorkspace } from '../../../../shared/folder-workspace-types'
import type { FolderWorkspacePathStatusRequest } from '../../../../shared/folder-workspace-path-status'
-import {
- runtimeTargetForOwnerEnvironment,
- type RuntimeClientTarget
-} from '../../runtime/runtime-client-target'
+import { runtimeTargetForOwnerEnvironment } from '../../runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { runtimeTargetForWorkspaceOwner } from '@/lib/resolve-owner'
import type { WorktreeOperationRouteState } from '@/lib/worktree-operation-route'
import type { ExecutionHostId } from '../../../../shared/execution-host'
diff --git a/src/renderer/src/store/github/cache-identity.ts b/src/renderer/src/store/github/cache-identity.ts
index a186f81bd11..2d62d265ed9 100644
--- a/src/renderer/src/store/github/cache-identity.ts
+++ b/src/renderer/src/store/github/cache-identity.ts
@@ -12,7 +12,7 @@ import {
} from '../../../../shared/execution-host'
import { getGitHubPRCacheKey, getGitHubRepoCacheKey } from '../slices/github-cache-key'
import type { AppState } from '../types'
-import type { RuntimeClientTarget } from '../../runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import type { CacheEntry } from './cache-model'
function queryOverrideKeyPart(queryOverride: string | undefined): string {
diff --git a/src/renderer/src/store/github/pull-request-execution.ts b/src/renderer/src/store/github/pull-request-execution.ts
index 40f4d94eff9..eeb454322e9 100644
--- a/src/renderer/src/store/github/pull-request-execution.ts
+++ b/src/renderer/src/store/github/pull-request-execution.ts
@@ -1,5 +1,5 @@
import type { StateCreator } from 'zustand'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import type { AppState } from '../types'
import type { GitHubSlice } from './slice-types'
import type { Repo } from '../../../../shared/repo-types'
diff --git a/src/renderer/src/store/github/repository-routing.ts b/src/renderer/src/store/github/repository-routing.ts
index cc711d39902..97c917ff8bc 100644
--- a/src/renderer/src/store/github/repository-routing.ts
+++ b/src/renderer/src/store/github/repository-routing.ts
@@ -5,10 +5,8 @@ import type {
GitHubPRRefreshReason
} from '../../../../shared/github/pull-request-refresh-types'
import type { Repo } from '../../../../shared/repo-types'
-import {
- runtimeTargetForOwnerEnvironment,
- type RuntimeClientTarget
-} from '../../runtime/runtime-client-target'
+import { runtimeTargetForOwnerEnvironment } from '../../runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { getGitHubRepoLookupIndex } from '../slices/github-repo-lookup-index'
import {
LOCAL_EXECUTION_HOST_ID,
diff --git a/src/renderer/src/store/github/slice-types.ts b/src/renderer/src/store/github/slice-types.ts
index d321c83e25d..7e87321cb5b 100644
--- a/src/renderer/src/store/github/slice-types.ts
+++ b/src/renderer/src/store/github/slice-types.ts
@@ -26,7 +26,7 @@ import type {
} from '../../../../shared/github/project-result-types'
import type { GetProjectViewTableArgs } from '../../../../shared/github/project-request-types'
import type { TaskSourceContext } from '../../../../shared/task-source-context'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import type {
CacheEntry,
FetchOptions,
diff --git a/src/renderer/src/store/github/work-item-routing.ts b/src/renderer/src/store/github/work-item-routing.ts
index 6b3f40107ff..d0ba72f8c58 100644
--- a/src/renderer/src/store/github/work-item-routing.ts
+++ b/src/renderer/src/store/github/work-item-routing.ts
@@ -12,13 +12,14 @@ import {
type ExecutionHostId
} from '../../../../shared/execution-host'
import { classifyGitHubUnavailable } from '../../../../shared/github/api-availability'
-import { callRuntimeRpc, RuntimeRpcCallError } from '../../runtime/runtime-rpc-client'
+import { callRuntimeRpc } from '../../runtime/runtime-rpc-client'
+import { RuntimeRpcCallError } from '../../runtime/runtime-rpc-result'
import { getHostlessSourceRepoOwnerEnvironmentId } from '@/lib/repo-runtime-owner'
import {
runtimeTargetForOwnerEnvironment,
- runtimeTargetForOwnerHostId,
- type RuntimeClientTarget
+ ipcOrRuntimeTargetForHostId
} from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { workItemsCacheKey } from './cache-identity'
import {
findRepoForGitHubOwner,
@@ -154,7 +155,7 @@ export function getGitHubSourceTarget(
)
}
return (
- (repo ? runtimeTargetForOwnerHostId(getRepoExecutionHostId(repo)) : null) ?? { kind: 'local' }
+ (repo ? ipcOrRuntimeTargetForHostId(getRepoExecutionHostId(repo)) : null) ?? { kind: 'local' }
)
}
diff --git a/src/renderer/src/store/host-catalog-fencing.ts b/src/renderer/src/store/host-catalog-fencing.ts
index b89a8bbe293..dbe1b94c426 100644
--- a/src/renderer/src/store/host-catalog-fencing.ts
+++ b/src/renderer/src/store/host-catalog-fencing.ts
@@ -1,5 +1,6 @@
import type { AppState } from './types'
-import type { HostRoute, RuntimeClientTarget } from '../runtime/runtime-client-target'
+import type { HostRoute } from '../runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { parseExecutionHostId } from '../../../shared/execution-host'
import {
getRuntimeEnvironmentRevision,
@@ -12,7 +13,7 @@ import {
} from './slices/runtime-environment-ssh'
import { getLocalSshTargetConnectionGeneration } from './slices/ssh'
import { getRuntimeEnvironmentConnectionGeneration } from './slices/runtime-status'
-import { getRuntimeTargetHostId } from './runtime-target-host'
+import { getRuntimeTargetHostId } from '../runtime/runtime-client-target'
/**
* Who answered: pairing, runtime incarnation (connection generation) and, for an SSH place, that
diff --git a/src/renderer/src/store/project-groups/project-group-catalog.ts b/src/renderer/src/store/project-groups/project-group-catalog.ts
index ce87bd5d70a..fbd168ac963 100644
--- a/src/renderer/src/store/project-groups/project-group-catalog.ts
+++ b/src/renderer/src/store/project-groups/project-group-catalog.ts
@@ -1,7 +1,8 @@
import type { ProjectGroup } from '../../../../shared/project-group-types'
-import { callRuntimeRpc, type RuntimeClientTarget } from '../../runtime/runtime-rpc-client'
+import { callRuntimeRpc } from '../../runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { catalogOwnsHost, getProjectGroupHostId } from '../slices/project-group-owner-routing'
-import { getRuntimeTargetHostId } from '../runtime-target-host'
+import { getRuntimeTargetHostId } from '../../runtime/runtime-client-target'
import { adoptFromEndpoint } from '../adopt-from-endpoint'
import { mergeByIdentity, unchangedMergeSource } from '../catalog-identity'
import type { ExecutionHostId } from '../../../../shared/execution-host'
diff --git a/src/renderer/src/store/project-groups/project-group-mutations.ts b/src/renderer/src/store/project-groups/project-group-mutations.ts
index d25a367cd5b..fd7fb969ceb 100644
--- a/src/renderer/src/store/project-groups/project-group-mutations.ts
+++ b/src/renderer/src/store/project-groups/project-group-mutations.ts
@@ -11,7 +11,7 @@ import {
} from '../slices/project-group-owner-routing'
import { findRepoForHost, repoMatchesHostIdentity } from '../slices/repo-host-identity'
import { callRuntimeRpc } from '../../runtime/runtime-rpc-client'
-import { runtimeTargetForOwnerHostId } from '../../runtime/runtime-client-target'
+import { ipcOrRuntimeTargetForHostId } from '../../runtime/runtime-client-target'
import { getRepoExecutionHostId } from '../../../../shared/execution-host'
import type { ProjectRemovalFailure, RepoSlice } from '../repos/repo-state'
import { mergeProjectCompatibilityForHostRepoChange } from '../repos/repo-catalog-identity'
@@ -33,7 +33,7 @@ export function createProjectGroupMutationActions(
createProjectGroup: async (name, hostId) => {
try {
// Why: a new group lands on the host of the project that seeds it, not the focused one.
- const target = runtimeTargetForOwnerHostId(hostId)
+ const target = ipcOrRuntimeTargetForHostId(hostId)
if (!target) {
return null
}
@@ -237,7 +237,7 @@ export function createProjectGroupMutationActions(
moveProjectToGroup: async (projectId, groupId, order, hostId) => {
try {
const repo = findRepoForHost(get().repos, projectId, { settings: get().settings, hostId })
- const target = repo ? runtimeTargetForOwnerHostId(getRepoExecutionHostId(repo)) : null
+ const target = repo ? ipcOrRuntimeTargetForHostId(getRepoExecutionHostId(repo)) : null
if (!target) {
return false
}
diff --git a/src/renderer/src/store/projects/project-host-routing.ts b/src/renderer/src/store/projects/project-host-routing.ts
index cb1626cedc0..ef51b1a86c5 100644
--- a/src/renderer/src/store/projects/project-host-routing.ts
+++ b/src/renderer/src/store/projects/project-host-routing.ts
@@ -19,9 +19,9 @@ import {
import { parseExecutionHostId } from '../../../../shared/execution-host'
import {
assertRuntimeEnvironmentCapability,
- callRuntimeRpc,
- type RuntimeClientTarget
+ callRuntimeRpc
} from '../../runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { adoptFromEndpoint } from '../adopt-from-endpoint'
export function getProjectSetupRuntimeTarget(
diff --git a/src/renderer/src/store/repos/all-host-repo-catalog-actions.ts b/src/renderer/src/store/repos/all-host-repo-catalog-actions.ts
index ab2ff4d473c..f9b8989cf3e 100644
--- a/src/renderer/src/store/repos/all-host-repo-catalog-actions.ts
+++ b/src/renderer/src/store/repos/all-host-repo-catalog-actions.ts
@@ -31,7 +31,7 @@ import {
reconcileReadoptedSshWorktreeState,
reconcileSupersededSshRepos
} from './repo-catalog-merge'
-import { getRuntimeTargetHostId } from '../runtime-target-host'
+import { getRuntimeTargetHostId } from '../../runtime/runtime-client-target'
import { mergeFetchedProjectCompatibilityForHost } from '../projects/project-compatibility-host-merge'
import { scheduleSafeAutoForkSync } from './safe-auto-fork-sync'
diff --git a/src/renderer/src/store/repos/converted-ssh-browser-pages.test.ts b/src/renderer/src/store/repos/converted-ssh-browser-pages.test.ts
index 5451a6667ae..e5863f7337a 100644
--- a/src/renderer/src/store/repos/converted-ssh-browser-pages.test.ts
+++ b/src/renderer/src/store/repos/converted-ssh-browser-pages.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest'
import type { BrowserPage } from '../../../../shared/browser-workspace-types'
-import type { WorktreeRuntimeOwnerState } from '../../lib/worktree-runtime-owner'
+import type { WorktreeRuntimeOwnerState } from '../../lib/worktree-runtime-owner-state'
import { buildBrowserPage } from '../slices/browser-page-records'
import { preserveConvertedSshBrowserPages } from './converted-ssh-browser-pages'
diff --git a/src/renderer/src/store/repos/converted-ssh-browser-pages.ts b/src/renderer/src/store/repos/converted-ssh-browser-pages.ts
index b9fc1848d3a..485123c20e6 100644
--- a/src/renderer/src/store/repos/converted-ssh-browser-pages.ts
+++ b/src/renderer/src/store/repos/converted-ssh-browser-pages.ts
@@ -1,9 +1,7 @@
import type { BrowserPageConversionOrigin } from '../../../../shared/browser-workspace-types'
import { toSshExecutionHostId } from '../../../../shared/execution-host'
-import {
- getKnownExecutionHostIdForWorktree,
- type WorktreeRuntimeOwnerState
-} from '../../lib/worktree-runtime-owner'
+import { getKnownExecutionHostIdForWorktree } from '../../lib/worktree-runtime-owner'
+import type { WorktreeRuntimeOwnerState } from '../../lib/worktree-runtime-owner-state'
import type { AppState } from '../types'
function preserveLocalUrlOrigin(
diff --git a/src/renderer/src/store/repos/owner-routing.ts b/src/renderer/src/store/repos/owner-routing.ts
index ffda021b1df..b92df864cf1 100644
--- a/src/renderer/src/store/repos/owner-routing.ts
+++ b/src/renderer/src/store/repos/owner-routing.ts
@@ -5,7 +5,7 @@ import {
assertRuntimeEnvironmentCapability,
callRuntimeRpc
} from '../../runtime/runtime-rpc-client'
-import type { RuntimeClientTarget } from '../../runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { translate } from '@/i18n/i18n'
export function getRuntimeEnvironmentDisplayName(state: AppState, environmentId: string): string {
diff --git a/src/renderer/src/store/repos/repo-catalog-merge.ts b/src/renderer/src/store/repos/repo-catalog-merge.ts
index 6eb69e52c29..ce6b6134b58 100644
--- a/src/renderer/src/store/repos/repo-catalog-merge.ts
+++ b/src/renderer/src/store/repos/repo-catalog-merge.ts
@@ -7,11 +7,11 @@ import { reconcileReadoptedSshRepoRows } from '../slices/superseded-ssh-repo-row
import type { SshRepoReconciliation } from '../slices/superseded-ssh-repo-rows'
import { reconcileReadoptedSshWorktreesByRepo } from '../slices/readopted-ssh-worktree-rows'
import { callRuntimeRpc } from '../../runtime/runtime-rpc-client'
-import type { RuntimeClientTarget } from '../../runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { getRepoExecutionHostId } from '../../../../shared/execution-host'
import type { RepoSlice } from './repo-state'
import { adoptFromEndpoint } from '../adopt-from-endpoint'
-import { getRuntimeTargetHostId } from '../runtime-target-host'
+import { getRuntimeTargetHostId } from '../../runtime/runtime-client-target'
import { fetchProjectHostSetupCompatibility } from '../projects/project-host-routing'
import { mergeFetchedReposForHost } from './repo-catalog-identity'
import {
diff --git a/src/renderer/src/store/repos/repo-removal.ts b/src/renderer/src/store/repos/repo-removal.ts
index bcbc8aaeda2..edc55efaf8c 100644
--- a/src/renderer/src/store/repos/repo-removal.ts
+++ b/src/renderer/src/store/repos/repo-removal.ts
@@ -6,8 +6,9 @@ import { getRepoIdFromWorktreeId } from '../../../../shared/worktree/id'
import { getWorktreeIdFromVisitKey, getWorktreeVisitKey } from '@/lib/worktree-visit-recency'
import { omitSparsePresetsForRepos } from '../slices/sparse-presets'
import { repoMatchesHostIdentity } from '../slices/repo-host-identity'
-import { callRuntimeRpc, hasRuntimeRpcErrorCode } from '../../runtime/runtime-rpc-client'
-import { runtimeTargetForOwnerHostId } from '../../runtime/runtime-client-target'
+import { callRuntimeRpc } from '../../runtime/runtime-rpc-client'
+import { hasRuntimeRpcErrorCode } from '../../runtime/runtime-rpc-result'
+import { ipcOrRuntimeTargetForHostId } from '../../runtime/runtime-client-target'
import { toRuntimeWorktreeSelector } from '../../runtime/runtime-worktree-selector'
import { translate } from '@/i18n/i18n'
import { getRepoExecutionHostId, LOCAL_EXECUTION_HOST_ID } from '../../../../shared/execution-host'
@@ -96,7 +97,7 @@ export function createRepoRemovalActions(
)
const vmServerDestroyed = vmDestroy !== false && (await vmDestroy)
// Why: derive the target from the owner row's host so an SSH host removal never routes repo.rm to the focused runtime.
- const target = runtimeTargetForOwnerHostId(ownerHostId)
+ const target = ipcOrRuntimeTargetForHostId(ownerHostId)
if (!target) {
throw new Error('The project host is unresolved. Refresh and retry.')
}
diff --git a/src/renderer/src/store/repos/runtime-repo-catalog-actions.ts b/src/renderer/src/store/repos/runtime-repo-catalog-actions.ts
index a797b7584c7..5b2ce12be0f 100644
--- a/src/renderer/src/store/repos/runtime-repo-catalog-actions.ts
+++ b/src/renderer/src/store/repos/runtime-repo-catalog-actions.ts
@@ -19,7 +19,7 @@ import {
reconcileReadoptedSshWorktreeState,
reconcileSupersededSshRepos
} from './repo-catalog-merge'
-import { getRuntimeTargetHostId } from '../runtime-target-host'
+import { getRuntimeTargetHostId } from '../../runtime/runtime-client-target'
import { mergeFetchedProjectCompatibilityForHost } from '../projects/project-compatibility-host-merge'
import { scheduleSafeAutoForkSync } from './safe-auto-fork-sync'
diff --git a/src/renderer/src/store/repos/safe-auto-fork-sync.ts b/src/renderer/src/store/repos/safe-auto-fork-sync.ts
index 05e120cf3ba..7cb423b9a56 100644
--- a/src/renderer/src/store/repos/safe-auto-fork-sync.ts
+++ b/src/renderer/src/store/repos/safe-auto-fork-sync.ts
@@ -2,7 +2,7 @@ import type { Repo } from '../../../../shared/repo-types'
import { syncRuntimeGitForkDefaultBranch } from '../../runtime/runtime-git-sync-client'
import { getRepoExecutionHostId } from '../../../../shared/execution-host'
import { getRepoMainWorktreeId } from '../../../../shared/worktree/id'
-import { runtimeTargetForOwnerHostId } from '../../runtime/runtime-client-target'
+import { ipcOrRuntimeTargetForHostId } from '../../runtime/runtime-client-target'
export const SAFE_AUTO_FORK_SYNC_COOLDOWN_MS = 10 * 60 * 1000
@@ -46,7 +46,7 @@ export function scheduleSafeAutoForkSync(repos: readonly Repo[]): void {
) {
continue
}
- const target = runtimeTargetForOwnerHostId(getRepoExecutionHostId(repo))
+ const target = ipcOrRuntimeTargetForHostId(getRepoExecutionHostId(repo))
if (!target) {
continue
}
diff --git a/src/renderer/src/store/runtime-target-host.ts b/src/renderer/src/store/runtime-target-host.ts
deleted file mode 100644
index 5c13e5af3bc..00000000000
--- a/src/renderer/src/store/runtime-target-host.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import {
- LOCAL_EXECUTION_HOST_ID,
- toRuntimeExecutionHostId,
- type ExecutionHostId
-} from '../../../shared/execution-host'
-import type { RuntimeClientTarget } from '../runtime/runtime-rpc-client'
-
-export function getRuntimeTargetHostId(target: RuntimeClientTarget): ExecutionHostId {
- return target.kind === 'environment'
- ? toRuntimeExecutionHostId(target.environmentId)
- : LOCAL_EXECUTION_HOST_ID
-}
diff --git a/src/renderer/src/store/slices/browser/browser-remote-close.ts b/src/renderer/src/store/slices/browser/browser-remote-close.ts
index 1bc03c1257f..311d415c345 100644
--- a/src/renderer/src/store/slices/browser/browser-remote-close.ts
+++ b/src/renderer/src/store/slices/browser/browser-remote-close.ts
@@ -1,4 +1,4 @@
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target'
import { callRuntimeRpc } from '@/runtime/runtime-rpc-client'
import { isBrowserPageDefinitivelyGone } from '@/runtime/client-hosted-browser-close-intent-replay'
import { isDurableClientHostedBrowserHandle } from '@/runtime/client-hosted-browser-close-intents'
diff --git a/src/renderer/src/store/slices/commit-message-generation.ts b/src/renderer/src/store/slices/commit-message-generation.ts
index 76ec6692098..08c34159742 100644
--- a/src/renderer/src/store/slices/commit-message-generation.ts
+++ b/src/renderer/src/store/slices/commit-message-generation.ts
@@ -1,6 +1,6 @@
import type { StateCreator } from 'zustand'
import type { AppState } from '../types'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
export type CommitMessageGenerationContext = {
worktreeId: string
diff --git a/src/renderer/src/store/slices/editor/actions/git-operation-target.ts b/src/renderer/src/store/slices/editor/actions/git-operation-target.ts
index 7f586d5c27c..14b308891ad 100644
--- a/src/renderer/src/store/slices/editor/actions/git-operation-target.ts
+++ b/src/renderer/src/store/slices/editor/actions/git-operation-target.ts
@@ -1,7 +1,7 @@
import { toast } from 'sonner'
import type { AppState } from '../../../types'
import { runtimeTargetForWorkspaceOwner } from '@/lib/resolve-owner'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target'
import type { GitRuntimeOperationOptions } from '../types/git-runtime-operation'
export const UNRESOLVED_GIT_HOST_ERROR =
diff --git a/src/renderer/src/store/slices/editor/types/git-runtime-operation.ts b/src/renderer/src/store/slices/editor/types/git-runtime-operation.ts
index 84df4842900..88a73847440 100644
--- a/src/renderer/src/store/slices/editor/types/git-runtime-operation.ts
+++ b/src/renderer/src/store/slices/editor/types/git-runtime-operation.ts
@@ -1,4 +1,4 @@
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target'
export type GitRuntimeOperationOptions = {
/** The worktree owner's transport; absent resolves it from the worktree's rows. */
diff --git a/src/renderer/src/store/slices/github-project-row-owner.ts b/src/renderer/src/store/slices/github-project-row-owner.ts
index fd3c3a46d3e..a2fb91cc707 100644
--- a/src/renderer/src/store/slices/github-project-row-owner.ts
+++ b/src/renderer/src/store/slices/github-project-row-owner.ts
@@ -1,6 +1,6 @@
import type { GlobalSettings } from '../../../../shared/global-settings-types'
import type { Repo } from '../../../../shared/repo-types'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { runtimeTargetForRepoOwner } from '@/lib/repo-runtime-owner'
import { lookupReposBySlugFromCache } from '@/lib/repo-slug-cache'
diff --git a/src/renderer/src/store/slices/hosted-review-cache-race.test.ts b/src/renderer/src/store/slices/hosted-review-cache-race.test.ts
index 71f2e66043c..05a7e06485a 100644
--- a/src/renderer/src/store/slices/hosted-review-cache-race.test.ts
+++ b/src/renderer/src/store/slices/hosted-review-cache-race.test.ts
@@ -9,9 +9,7 @@ const runtimeRpc = vi.hoisted(() => ({
callRuntimeRpc: vi.fn()
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: runtimeRpc.callRuntimeRpc
-}))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: runtimeRpc.callRuntimeRpc }))
const mockApi = {
hostedReview: {
diff --git a/src/renderer/src/store/slices/hosted-review-cache-state.ts b/src/renderer/src/store/slices/hosted-review-cache-state.ts
index 9d43cf4b6c3..a00ce7dca28 100644
--- a/src/renderer/src/store/slices/hosted-review-cache-state.ts
+++ b/src/renderer/src/store/slices/hosted-review-cache-state.ts
@@ -7,10 +7,8 @@ import type {
} from '../../../../shared/hosted-review'
import type { Repo } from '../../../../shared/repo-types'
import { getRepoExecutionHostId } from '../../../../shared/execution-host'
-import {
- runtimeTargetForOwnerHostId,
- type RuntimeClientTarget
-} from '@/runtime/runtime-client-target'
+import { ipcOrRuntimeTargetForHostId } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
export type HostedReviewCacheEntry = {
data: T | null
@@ -220,7 +218,7 @@ export function hostedReviewRepoOwnerTarget(
repo: Pick | undefined
): RuntimeClientTarget {
return (
- (repo ? runtimeTargetForOwnerHostId(getRepoExecutionHostId(repo)) : null) ?? { kind: 'local' }
+ (repo ? ipcOrRuntimeTargetForHostId(getRepoExecutionHostId(repo)) : null) ?? { kind: 'local' }
)
}
diff --git a/src/renderer/src/store/slices/hosted-review-cache.test.ts b/src/renderer/src/store/slices/hosted-review-cache.test.ts
index b7116fbc844..88b51431d1a 100644
--- a/src/renderer/src/store/slices/hosted-review-cache.test.ts
+++ b/src/renderer/src/store/slices/hosted-review-cache.test.ts
@@ -13,9 +13,7 @@ const runtimeRpc = vi.hoisted(() => ({
callRuntimeRpc: vi.fn()
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: runtimeRpc.callRuntimeRpc
-}))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: runtimeRpc.callRuntimeRpc }))
const mockApi = {
hostedReview: {
diff --git a/src/renderer/src/store/slices/hosted-review-request-lifetime.test.ts b/src/renderer/src/store/slices/hosted-review-request-lifetime.test.ts
index 344c6f36649..8d58d547993 100644
--- a/src/renderer/src/store/slices/hosted-review-request-lifetime.test.ts
+++ b/src/renderer/src/store/slices/hosted-review-request-lifetime.test.ts
@@ -10,9 +10,7 @@ import {
} from './hosted-review-request-state'
const runtimeRpc = vi.hoisted(() => ({ callRuntimeRpc: vi.fn() }))
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: runtimeRpc.callRuntimeRpc
-}))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: runtimeRpc.callRuntimeRpc }))
const forBranch = vi.fn()
type TestState = Pick<
diff --git a/src/renderer/src/store/slices/hosted-review.test.ts b/src/renderer/src/store/slices/hosted-review.test.ts
index a0906f30bb1..897cfeff50d 100644
--- a/src/renderer/src/store/slices/hosted-review.test.ts
+++ b/src/renderer/src/store/slices/hosted-review.test.ts
@@ -11,9 +11,7 @@ const runtimeRpc = vi.hoisted(() => ({
callRuntimeRpc: vi.fn()
}))
-vi.mock('@/runtime/runtime-rpc-client', () => ({
- callRuntimeRpc: runtimeRpc.callRuntimeRpc
-}))
+vi.mock('@/runtime/runtime-rpc-client', () => ({ callRuntimeRpc: runtimeRpc.callRuntimeRpc }))
const mockApi = {
hostedReview: {
diff --git a/src/renderer/src/store/slices/project-group-owner-routing.ts b/src/renderer/src/store/slices/project-group-owner-routing.ts
index 101b65d5373..c8360581915 100644
--- a/src/renderer/src/store/slices/project-group-owner-routing.ts
+++ b/src/renderer/src/store/slices/project-group-owner-routing.ts
@@ -7,10 +7,8 @@ import {
type ExecutionHostId
} from '../../../../shared/execution-host'
import { findIndexedProjectGroupOwner } from '@/lib/worktree-runtime-owner-index'
-import {
- runtimeTargetForOwnerHostId,
- type RuntimeClientTarget
-} from '@/runtime/runtime-client-target'
+import { ipcOrRuntimeTargetForHostId } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
type ProjectGroupHostParts = Pick
type ProjectGroupOwnerRecord = Pick
@@ -74,5 +72,5 @@ export function runtimeTargetForProjectGroupOwner(
hostId?: ExecutionHostId
): RuntimeClientTarget | null {
const owner = findIndexedProjectGroupOwner(state.projectGroups, groupId, hostId)
- return owner ? runtimeTargetForOwnerHostId(hostId ?? getProjectGroupHostId(owner)) : null
+ return owner ? ipcOrRuntimeTargetForHostId(hostId ?? getProjectGroupHostId(owner)) : null
}
diff --git a/src/renderer/src/store/slices/pull-request-generation.ts b/src/renderer/src/store/slices/pull-request-generation.ts
index 5be6c7bf778..2d168515154 100644
--- a/src/renderer/src/store/slices/pull-request-generation.ts
+++ b/src/renderer/src/store/slices/pull-request-generation.ts
@@ -1,6 +1,6 @@
import type { StateCreator } from 'zustand'
import type { AppState } from '../types'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { resolveGeneratedFields } from './pull-request-generation-auto-submit'
export type PullRequestFieldName = 'base' | 'title' | 'body' | 'draft'
diff --git a/src/renderer/src/store/slices/remote-server-updates.ts b/src/renderer/src/store/slices/remote-server-updates.ts
index 07210ee7f97..ec2e5ffc7b4 100644
--- a/src/renderer/src/store/slices/remote-server-updates.ts
+++ b/src/renderer/src/store/slices/remote-server-updates.ts
@@ -5,7 +5,7 @@ import { isUserManagedRuntimeEnvironment } from '../../../../shared/runtime-envi
import type { RuntimeRpcResponse } from '../../../../shared/runtime-rpc-envelope'
import type { RuntimeStatus } from '../../../../shared/runtime-types'
import type { UpdateCheckOptions } from '../../../../shared/update-status-types'
-import { unwrapRuntimeRpcResult } from '@/runtime/runtime-rpc-client'
+import { unwrapRuntimeRpcResult } from '@/runtime/runtime-rpc-result'
import {
checkingRemoteServerUpdateEntry,
inspectRemoteServerUpdate,
diff --git a/src/renderer/src/store/slices/runtime-detected-agents-pairing.test.ts b/src/renderer/src/store/slices/runtime-detected-agents-pairing.test.ts
index a6471360636..42069d66027 100644
--- a/src/renderer/src/store/slices/runtime-detected-agents-pairing.test.ts
+++ b/src/renderer/src/store/slices/runtime-detected-agents-pairing.test.ts
@@ -2,7 +2,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'
import type { PublicKnownRuntimeEnvironment } from '../../../../shared/runtime-environments'
import type { TuiAgent } from '../../../../shared/tui-agent'
import type * as RuntimeRpcClientModule from '@/runtime/runtime-rpc-client'
-import { RuntimeRpcCallError } from '@/runtime/runtime-rpc-client'
+import { RuntimeRpcCallError } from '@/runtime/runtime-rpc-result'
const rpc = vi.hoisted(() => ({ call: vi.fn(), supports: vi.fn(), status: vi.fn() }))
vi.mock('@/runtime/runtime-rpc-client', async (original) => ({
diff --git a/src/renderer/src/store/slices/runtime-detected-agents.ts b/src/renderer/src/store/slices/runtime-detected-agents.ts
index f190c2a9f51..386bed3e2e3 100644
--- a/src/renderer/src/store/slices/runtime-detected-agents.ts
+++ b/src/renderer/src/store/slices/runtime-detected-agents.ts
@@ -4,10 +4,10 @@ import type { TuiAgent } from '../../../../shared/tui-agent'
import {
callRuntimeRpc,
getRuntimeEnvironmentStatus,
- RuntimeRpcCallError,
runtimeEnvironmentSupportsCapability
} from '@/runtime/runtime-rpc-client'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import { RuntimeRpcCallError } from '@/runtime/runtime-rpc-result'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
import { getConnectionIdFromState } from '@/lib/connection-owner-resolution'
import { captureRuntimeEnvironmentRequestRevision } from '@/runtime/runtime-environment-revision'
import { PREFLIGHT_WORKSPACE_SCOPED_RUNTIME_CAPABILITY } from '../../../../shared/protocol-version'
diff --git a/src/renderer/src/store/slices/runtime-status-refresh.ts b/src/renderer/src/store/slices/runtime-status-refresh.ts
index cd67ec82147..11697f1eb64 100644
--- a/src/renderer/src/store/slices/runtime-status-refresh.ts
+++ b/src/renderer/src/store/slices/runtime-status-refresh.ts
@@ -1,7 +1,7 @@
import type { RuntimeEnvironmentStatus } from './runtime-status'
import type { RuntimeHostStatusSnapshot } from '../../../../shared/runtime-host-status'
import type { RuntimeStatus } from '../../../../shared/runtime-types'
-import { unwrapRuntimeRpcResult } from '@/runtime/runtime-rpc-client'
+import { unwrapRuntimeRpcResult } from '@/runtime/runtime-rpc-result'
import { getRuntimeEnvironmentRevision } from '@/runtime/runtime-environment-revision'
import { extractRuntimeTransportDiagnostics } from '@/runtime/runtime-status-probe-diagnostics'
diff --git a/src/renderer/src/store/slices/runtime-status-skill-cache-eviction.test.ts b/src/renderer/src/store/slices/runtime-status-skill-cache-eviction.test.ts
index 9804b8a6e12..6554ca73d01 100644
--- a/src/renderer/src/store/slices/runtime-status-skill-cache-eviction.test.ts
+++ b/src/renderer/src/store/slices/runtime-status-skill-cache-eviction.test.ts
@@ -1,7 +1,7 @@
import { afterEach, describe, expect, it, vi } from 'vitest'
import type { PublicKnownRuntimeEnvironment } from '../../../../shared/runtime-environments'
import type { SkillDiscoveryResult } from '../../../../shared/skills'
-import type { RuntimeClientTarget } from '@/runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
const discoverSkillsForRuntimeTarget = vi.hoisted(() =>
vi.fn<(runtimeTarget: RuntimeClientTarget) => Promise>()
diff --git a/src/renderer/src/store/slices/settings.ts b/src/renderer/src/store/slices/settings.ts
index 12835039f67..c599601f643 100644
--- a/src/renderer/src/store/slices/settings.ts
+++ b/src/renderer/src/store/slices/settings.ts
@@ -5,9 +5,9 @@ import type { GlobalSettings } from '../../../../shared/global-settings-types'
import { toast } from 'sonner'
import {
clearRuntimeCompatibilityCache,
- markRuntimeEnvironmentCompatible,
- unwrapRuntimeRpcResult
+ markRuntimeEnvironmentCompatible
} from '@/runtime/runtime-rpc-client'
+import { unwrapRuntimeRpcResult } from '@/runtime/runtime-rpc-result'
import { assertRuntimeStatusCompatible } from '@/runtime/runtime-protocol-compat'
import type { RuntimeStatus } from '../../../../shared/runtime-types'
import { normalizeTerminalQuickCommands } from '../../../../shared/terminal-quick-commands'
diff --git a/src/renderer/src/store/slices/store-sleep-runtime-convergence.test.ts b/src/renderer/src/store/slices/store-sleep-runtime-convergence.test.ts
index 04f2795d1b8..84950711a67 100644
--- a/src/renderer/src/store/slices/store-sleep-runtime-convergence.test.ts
+++ b/src/renderer/src/store/slices/store-sleep-runtime-convergence.test.ts
@@ -2,10 +2,8 @@ import { describe, it, expect, vi, beforeEach } from 'vitest'
import type * as AgentStatusModule from '@/lib/agent-status'
import { getDefaultSettings } from '../../../../shared/constants'
import { createCompatibleRuntimeStatusResponseIfNeeded } from '../../runtime/runtime-compatibility-test-fixture'
-import {
- clearRuntimeCompatibilityCacheForTests,
- RuntimeRpcCallError
-} from '../../runtime/runtime-rpc-client'
+import { clearRuntimeCompatibilityCacheForTests } from '../../runtime/runtime-rpc-client'
+import { RuntimeRpcCallError } from '../../runtime/runtime-rpc-result'
import {
createTestStore,
makeRuntimeOwnedWorktree,
diff --git a/src/renderer/src/store/slices/terminal-tab-retirement.ts b/src/renderer/src/store/slices/terminal-tab-retirement.ts
index 0310c65ba7d..32bc223c317 100644
--- a/src/renderer/src/store/slices/terminal-tab-retirement.ts
+++ b/src/renderer/src/store/slices/terminal-tab-retirement.ts
@@ -1,10 +1,8 @@
import { isRemoteRuntimePtyId } from '../../../../shared/remote-runtime-pty-id'
import type { SleepingAgentSessionRecord } from '../../../../shared/agent-session-resume'
import type { AppState } from '../types'
-import {
- getRuntimeEnvironmentIdForWorktree,
- type WorktreeRuntimeOwnerState
-} from '@/lib/worktree-runtime-owner'
+import { getRuntimeEnvironmentIdForWorktree } from '@/lib/worktree-runtime-owner'
+import type { WorktreeRuntimeOwnerState } from '@/lib/worktree-runtime-owner-state'
import { parseRemoteRuntimePtyId } from '@/runtime/runtime-terminal-stream'
import { resolveTerminalHostOwnership } from '@/lib/terminal-worktree-route'
import { FLOATING_TERMINAL_WORKTREE_ID } from '../../../../shared/constants'
diff --git a/src/renderer/src/store/slices/worktrees/create/create-worktree.ts b/src/renderer/src/store/slices/worktrees/create/create-worktree.ts
index 42df8ef91f9..1357ce7b53b 100644
--- a/src/renderer/src/store/slices/worktrees/create/create-worktree.ts
+++ b/src/renderer/src/store/slices/worktrees/create/create-worktree.ts
@@ -1,4 +1,4 @@
-import { runtimeTargetForExecutionHostId } from '@/runtime/runtime-client-target'
+import { runtimeRpcTargetForAuthorityKey } from '@/runtime/runtime-client-target'
import { repoHostId } from '../listing/worktree-host-ownership'
import {
isUnresolvedOwnerHostId,
@@ -16,9 +16,9 @@ import {
} from '../../../../../../shared/new-workspace/worktree-create-retry-policy'
import {
assertRuntimeEnvironmentCapability,
- callRuntimeRpc,
- type RuntimeClientTarget
+ callRuntimeRpc
} from '../../../../runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target'
import { runtimeTargetForRepoOwner } from '@/lib/repo-runtime-owner'
import { WORKTREE_LINKED_WORK_ITEM_CONTEXT_RUNTIME_CAPABILITY } from '../../../../../../shared/protocol-version'
import { showLocalBaseRefUpdateSuggestionToast } from '@/components/sidebar/local-base-ref-suggestion-toast'
@@ -190,7 +190,7 @@ export function createCreateWorktree(
}
// Direct SSH still uses desktop IPC; paired runtimes use their captured environment.
const target = options?.executionHostId
- ? (runtimeTargetForExecutionHostId(options.executionHostId) ?? { kind: 'local' as const })
+ ? (runtimeRpcTargetForAuthorityKey(options.executionHostId) ?? { kind: 'local' as const })
: runtimeTargetForRepoOwner(get(), repoId)
if (!target) {
throw new Error('The project host is unresolved. Choose a host and retry.')
diff --git a/src/renderer/src/store/slices/worktrees/create/runtime-provisioned-root-adoption.ts b/src/renderer/src/store/slices/worktrees/create/runtime-provisioned-root-adoption.ts
index 9abf665cde9..b30b6d5e21a 100644
--- a/src/renderer/src/store/slices/worktrees/create/runtime-provisioned-root-adoption.ts
+++ b/src/renderer/src/store/slices/worktrees/create/runtime-provisioned-root-adoption.ts
@@ -1,5 +1,5 @@
import type { CreateWorktreeResult } from '../../../../../../shared/worktree/create-types'
-import type { RuntimeClientTarget } from '../../../../runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target'
import { callRuntimeRpc } from '../../../../runtime/runtime-rpc-client'
import {
buildRuntimeWorktreeCreateParams,
diff --git a/src/renderer/src/store/slices/worktrees/listing/detected-worktree-provider-request.ts b/src/renderer/src/store/slices/worktrees/listing/detected-worktree-provider-request.ts
index b8a18357029..bc3a9328d35 100644
--- a/src/renderer/src/store/slices/worktrees/listing/detected-worktree-provider-request.ts
+++ b/src/renderer/src/store/slices/worktrees/listing/detected-worktree-provider-request.ts
@@ -1,8 +1,6 @@
import { callRuntimeRpc } from '../../../../runtime/runtime-rpc-client'
-import {
- runtimeTargetForOwnerHostId,
- type RuntimeClientTarget
-} from '../../../../runtime/runtime-client-target'
+import { ipcOrRuntimeTargetForHostId } from '../../../../runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target'
import { getEnvironmentSshStateGeneration } from '../../runtime-environment-ssh'
import { getRuntimeEnvironmentConnectionGeneration } from '../../runtime-status'
import {
@@ -26,7 +24,7 @@ import { isWorktreeScanFailureKind } from '../../../../../../shared/worktree-sca
/** The listing host is the one the caller asked about, never the focused one. */
export function detectedWorktreeTarget(executionHostId: ExecutionHostId): RuntimeClientTarget {
- const target = runtimeTargetForOwnerHostId(executionHostId)
+ const target = ipcOrRuntimeTargetForHostId(executionHostId)
if (!target) {
throw new Error('The workspace host is unresolved.')
}
diff --git a/src/renderer/src/store/slices/worktrees/listing/fetch-worktrees.ts b/src/renderer/src/store/slices/worktrees/listing/fetch-worktrees.ts
index d9a5f50cdc0..5ccd922d9b8 100644
--- a/src/renderer/src/store/slices/worktrees/listing/fetch-worktrees.ts
+++ b/src/renderer/src/store/slices/worktrees/listing/fetch-worktrees.ts
@@ -1,4 +1,4 @@
-import { runtimeTargetForOwnerHostId } from '@/runtime/runtime-client-target'
+import { ipcOrRuntimeTargetForHostId } from '@/runtime/runtime-client-target'
import type {
DirectSshWorktreeFetchOptions,
WorktreeFetchOptions,
@@ -130,7 +130,7 @@ export function createFetchWorktrees(
// Direct SSH lineage requires its own qualified authority result.
// Bulk runtime callers apply one final host-wide snapshot after all repo merges.
if (!directSshAuthority && !options?.suppressRemoteLineageRefresh) {
- await refreshRemoteWorktreeLineageBestEffort(runtimeTargetForOwnerHostId(hostId), set, get)
+ await refreshRemoteWorktreeLineageBestEffort(ipcOrRuntimeTargetForHostId(hostId), set, get)
}
return directCallerAuthority ? refresh.providerResult! : refresh.result.authoritative
} catch (err) {
diff --git a/src/renderer/src/store/slices/worktrees/listing/runtime-worktree-rpc-errors.ts b/src/renderer/src/store/slices/worktrees/listing/runtime-worktree-rpc-errors.ts
index d95393554a1..fe6e28b4989 100644
--- a/src/renderer/src/store/slices/worktrees/listing/runtime-worktree-rpc-errors.ts
+++ b/src/renderer/src/store/slices/worktrees/listing/runtime-worktree-rpc-errors.ts
@@ -1,4 +1,4 @@
-import { hasRuntimeRpcErrorCode, RuntimeRpcCallError } from '../../../../runtime/runtime-rpc-client'
+import { hasRuntimeRpcErrorCode, RuntimeRpcCallError } from '../../../../runtime/runtime-rpc-result'
export function isRuntimeMethodNotFoundError(error: unknown): boolean {
return error instanceof RuntimeRpcCallError && error.code === 'method_not_found'
diff --git a/src/renderer/src/store/slices/worktrees/listing/worktree-owner-target.ts b/src/renderer/src/store/slices/worktrees/listing/worktree-owner-target.ts
index d7eb8814b6a..e2a5b17dcbc 100644
--- a/src/renderer/src/store/slices/worktrees/listing/worktree-owner-target.ts
+++ b/src/renderer/src/store/slices/worktrees/listing/worktree-owner-target.ts
@@ -1,6 +1,6 @@
import type { ExecutionHostId } from '../../../../../../shared/execution-host'
import { runtimeTargetForWorkspaceOwner } from '@/lib/resolve-owner'
-import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target'
import type { AppState } from '../../../types'
import { WORKTREE_REMOVAL_AMBIGUOUS_ERROR } from './worktree-slice-constants'
diff --git a/src/renderer/src/store/slices/worktrees/listing/worktree-slice-types.ts b/src/renderer/src/store/slices/worktrees/listing/worktree-slice-types.ts
index 77b740054ed..99e0cea5c54 100644
--- a/src/renderer/src/store/slices/worktrees/listing/worktree-slice-types.ts
+++ b/src/renderer/src/store/slices/worktrees/listing/worktree-slice-types.ts
@@ -12,7 +12,7 @@ import type { DirectSshAuthority } from '../../../../../../shared/ssh-types'
import type { HostQualifiedDetectedWorktreeResult } from '../../../../../../shared/detected-worktree-provider-contract'
import type { ProjectHostSetup } from '../../../../../../shared/project-types'
import type { WorktreeLineage } from '../../../../../../shared/worktree/lineage-types'
-import type { RuntimeClientTarget } from '../../../../runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target'
export type WorktreeSliceGet = Parameters>[1]
export type WorktreeSliceSet = Parameters>[0]
diff --git a/src/renderer/src/store/slices/worktrees/metadata/hosted-review-push-target.ts b/src/renderer/src/store/slices/worktrees/metadata/hosted-review-push-target.ts
index 59166f2a00b..8b8923dd2e7 100644
--- a/src/renderer/src/store/slices/worktrees/metadata/hosted-review-push-target.ts
+++ b/src/renderer/src/store/slices/worktrees/metadata/hosted-review-push-target.ts
@@ -1,5 +1,5 @@
import { callRuntimeRpc } from '../../../../runtime/runtime-rpc-client'
-import type { RuntimeClientTarget } from '../../../../runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target'
import { isPositiveHostedReviewNumber } from '../../../../../../shared/hosted-review'
import type {
GitHubPrStartPoint,
diff --git a/src/renderer/src/store/slices/worktrees/metadata/worktree-lineage-actions.ts b/src/renderer/src/store/slices/worktrees/metadata/worktree-lineage-actions.ts
index 89cc0abc12c..f1fc7b98505 100644
--- a/src/renderer/src/store/slices/worktrees/metadata/worktree-lineage-actions.ts
+++ b/src/renderer/src/store/slices/worktrees/metadata/worktree-lineage-actions.ts
@@ -1,10 +1,8 @@
import type { WorktreeSlice } from '../../worktree-helpers'
import type { WorktreeSliceGet, WorktreeSliceSet } from '../listing/worktree-slice-types'
import { parseExecutionHostId } from '../../../../../../shared/execution-host'
-import {
- runtimeTargetForOwnerEnvironment,
- type RuntimeClientTarget
-} from '../../../../runtime/runtime-client-target'
+import { runtimeTargetForOwnerEnvironment } from '../../../../runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target'
import {
applyWorktreeLineageUpdate,
refreshWorktreeLineageForTarget,
diff --git a/src/renderer/src/store/slices/worktrees/metadata/worktree-lineage-readiness.ts b/src/renderer/src/store/slices/worktrees/metadata/worktree-lineage-readiness.ts
index 12fd6d3008e..47d79512e0b 100644
--- a/src/renderer/src/store/slices/worktrees/metadata/worktree-lineage-readiness.ts
+++ b/src/renderer/src/store/slices/worktrees/metadata/worktree-lineage-readiness.ts
@@ -1,5 +1,5 @@
import type { AppState } from '../../../types'
-import type { RuntimeClientTarget } from '../../../../runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target'
import { getRuntimeEnvironmentRevision } from '../../../../runtime/runtime-environment-revision'
import { getRuntimeEnvironmentConnectionGeneration } from '../../runtime-status-connection-generation'
diff --git a/src/renderer/src/store/slices/worktrees/metadata/worktree-lineage-refresh.ts b/src/renderer/src/store/slices/worktrees/metadata/worktree-lineage-refresh.ts
index 3c8c7fc9311..9cdcf91c3c6 100644
--- a/src/renderer/src/store/slices/worktrees/metadata/worktree-lineage-refresh.ts
+++ b/src/renderer/src/store/slices/worktrees/metadata/worktree-lineage-refresh.ts
@@ -6,8 +6,8 @@ import type {
} from '../../../../../../shared/worktree/lineage-types'
import type { Worktree } from '../../../../../../shared/worktree/types'
import { callRuntimeRpc } from '../../../../runtime/runtime-rpc-client'
-import type { RuntimeClientTarget } from '../../../../runtime/runtime-client-target'
-import { getRuntimeTargetHostId } from '../../../runtime-target-host'
+import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target'
+import { getRuntimeTargetHostId } from '../../../../runtime/runtime-client-target'
import { toRuntimeWorktreeSelector } from '../../../../runtime/runtime-worktree-selector'
import { worktreeWorkspaceKey } from '../../../../../../shared/workspace-scope'
import type { ExecutionHostId } from '../../../../../../shared/execution-host'
diff --git a/src/renderer/src/store/slices/worktrees/metadata/worktree-meta-persist.test.ts b/src/renderer/src/store/slices/worktrees/metadata/worktree-meta-persist.test.ts
index d6f8258b47d..6b21f60afd4 100644
--- a/src/renderer/src/store/slices/worktrees/metadata/worktree-meta-persist.test.ts
+++ b/src/renderer/src/store/slices/worktrees/metadata/worktree-meta-persist.test.ts
@@ -1,5 +1,5 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
-import type { RuntimeClientTarget } from '../../../../runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target'
import { WORKTREE_GITHUB_PR_SUPPRESSION_RUNTIME_CAPABILITY } from '../../../../../../shared/protocol-version'
import {
WORKTREE_LINKED_ITEMS_RUNTIME_CAPABILITY,
diff --git a/src/renderer/src/store/slices/worktrees/metadata/worktree-meta-persist.ts b/src/renderer/src/store/slices/worktrees/metadata/worktree-meta-persist.ts
index dbc151d4918..32b7754cf69 100644
--- a/src/renderer/src/store/slices/worktrees/metadata/worktree-meta-persist.ts
+++ b/src/renderer/src/store/slices/worktrees/metadata/worktree-meta-persist.ts
@@ -14,7 +14,7 @@ import {
} from '../../../../../../shared/protocol-version'
import { toRuntimeWorktreeSelector } from '../../../../runtime/runtime-worktree-selector'
import { translate } from '@/i18n/i18n'
-import type { RuntimeClientTarget } from '../../../../runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target'
import type { WorktreeMeta } from '../../../../../../shared/worktree/meta-types'
import type { ExecutionHostId } from '../../../../../../shared/execution-host'
import { encodePushTargetClearForRuntimeRpc } from './hosted-review-link-mutation'
diff --git a/src/renderer/src/store/slices/worktrees/teardown/dispatch-worktree-removal.ts b/src/renderer/src/store/slices/worktrees/teardown/dispatch-worktree-removal.ts
index f8b78d97a5b..81f8975c2b6 100644
--- a/src/renderer/src/store/slices/worktrees/teardown/dispatch-worktree-removal.ts
+++ b/src/renderer/src/store/slices/worktrees/teardown/dispatch-worktree-removal.ts
@@ -1,7 +1,8 @@
import { showNestedWorktreePreservedBranchesToast } from '@/components/sidebar/nested-worktree-preserved-branches-toast'
import { parseExecutionHostId, type ExecutionHostId } from '../../../../../../shared/execution-host'
import type { RemoveWorktreeResult } from '../../../../../../shared/worktree/create-types'
-import { callRuntimeRpc, type RuntimeClientTarget } from '../../../../runtime/runtime-rpc-client'
+import { callRuntimeRpc } from '../../../../runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target'
import { toRuntimeWorktreeSelector } from '../../../../runtime/runtime-worktree-selector'
import type { RemoveWorktreeOptions } from '../../worktree-removal-options'
import type { WorktreeSliceGet } from '../listing/worktree-slice-types'
diff --git a/src/renderer/src/store/slices/worktrees/teardown/host-qualified-worktree-removal.ts b/src/renderer/src/store/slices/worktrees/teardown/host-qualified-worktree-removal.ts
index ac74780e653..5e396658d8e 100644
--- a/src/renderer/src/store/slices/worktrees/teardown/host-qualified-worktree-removal.ts
+++ b/src/renderer/src/store/slices/worktrees/teardown/host-qualified-worktree-removal.ts
@@ -7,7 +7,7 @@
import type { WorktreeSliceGet, WorktreeSliceSet } from '../listing/worktree-slice-types'
import type { RemoveWorktreeResult } from '../../../../../../shared/worktree/create-types'
import type { WorktreeSlice } from '../../worktree-helpers'
-import type { RuntimeClientTarget } from '../../../../runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target'
import type { ExecutionHostId } from '../../../../../../shared/execution-host'
import {
getWorktreeOperationOwnerHostIds,
diff --git a/src/renderer/src/store/slices/worktrees/teardown/missing-worktree-terminal-teardown.ts b/src/renderer/src/store/slices/worktrees/teardown/missing-worktree-terminal-teardown.ts
index 30004fc06fe..3cd15d078c0 100644
--- a/src/renderer/src/store/slices/worktrees/teardown/missing-worktree-terminal-teardown.ts
+++ b/src/renderer/src/store/slices/worktrees/teardown/missing-worktree-terminal-teardown.ts
@@ -1,4 +1,5 @@
-import { callRuntimeRpc, type RuntimeClientTarget } from '../../../../runtime/runtime-rpc-client'
+import { callRuntimeRpc } from '../../../../runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target'
import type { DetectedWorktreeListResult } from '../../../../../../shared/worktree/types'
import { isRuntimeMethodNotFoundError } from '../listing/runtime-worktree-rpc-errors'
diff --git a/src/renderer/src/store/slices/worktrees/teardown/preserved-branch-cleanup-target.ts b/src/renderer/src/store/slices/worktrees/teardown/preserved-branch-cleanup-target.ts
index 5d22e979762..86e84d77d3e 100644
--- a/src/renderer/src/store/slices/worktrees/teardown/preserved-branch-cleanup-target.ts
+++ b/src/renderer/src/store/slices/worktrees/teardown/preserved-branch-cleanup-target.ts
@@ -1,4 +1,4 @@
-import type { RuntimeClientTarget } from '../../../../runtime/runtime-rpc-client'
+import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target'
import type { PreservedBranchCleanup } from '../../../../../../shared/preserved-branch-cleanup'
export const preservedBranchRuntimeTargetByCleanupKey = new Map<
diff --git a/src/renderer/src/web/preload-api/web-jira-api.ts b/src/renderer/src/web/preload-api/web-jira-api.ts
index 3f235e85430..58e7e87959a 100644
--- a/src/renderer/src/web/preload-api/web-jira-api.ts
+++ b/src/renderer/src/web/preload-api/web-jira-api.ts
@@ -1,6 +1,6 @@
import type { PreloadApi } from '../../../../preload/api-types'
import { readRuntimeJiraPayload } from '../../runtime/runtime-jira-payload-stream'
-import { RuntimeRpcCallError } from '../../runtime/runtime-rpc-client'
+import { RuntimeRpcCallError } from '../../runtime/runtime-rpc-result'
import { callRuntimeResult } from './web-runtime-calls'
import { requireActiveEnvironment } from './web-runtime-session'
diff --git a/tests/e2e/structured-session-tab-close-stale-frame.unit.test.ts b/tests/e2e/structured-session-tab-close-stale-frame.unit.test.ts
index 9c7973b1a54..0ecadc703a5 100644
--- a/tests/e2e/structured-session-tab-close-stale-frame.unit.test.ts
+++ b/tests/e2e/structured-session-tab-close-stale-frame.unit.test.ts
@@ -9,7 +9,7 @@
import { afterEach, describe, expect, it, onTestFinished, vi } from 'vitest'
import type * as RuntimeRpcClient from '../../src/renderer/src/runtime/runtime-rpc-client'
-import type { RuntimeClientTarget } from '../../src/renderer/src/runtime/runtime-client-target'
+import type { RuntimeClientTarget } from '../../src/shared/runtime-client-target'
import type { RuntimeMobileSessionTabsResult } from '../../src/shared/runtime-types'
import { OrcaRuntimeService } from '../../src/main/runtime/orca-runtime'
import { setStructuredAgentSessionHost } from '../../src/main/native-chat/agent-session-wire/structured-agent-session-registry'