Files
orca/src/preload/api/shell-bridge.ts
T
Neil 3a68805eee fix(wsl): Settings CLI status, CLI repair, interop health and link checks never boot a stopped distro (E9) (#35412)
* fix(wsl): Settings CLI status, startup CLI repair, interop health and link checks never boot a stopped distro (E9)

- cli:getWslInstallStatus: opening Settings takes a settled running read and shows a refreshable
  "not running" status instead of starting the distro; the refresh button passes wakeWslDistro.
- Startup CLI repair re-reads each listed distro (settled) right before its repair spawns and
  defers it otherwise, so a distro stopping mid fan-out is not restarted.
- Interop health: stop-triggered checks no longer trust the stop event's list; every check takes a
  settled read, and again before the root repair.
- shell:pathsExist (chat link and terminal hover existence) refuses a stopped distro's UNC path
  instead of statting it; callers already retry an unverifiable answer.

* docs(wsl): note the missing-kernel availability probe as the known E9 exception

* fix(wsl): shell:pathsExist refuses only the stopped distro's path, not the whole batch

One UNC path in a stopped distro no longer fails the host paths checked with it; the renderer
treats that path alone as unverifiable and retries it.
2026-10-28 18:24:26 -07:00

55 lines
2.2 KiB
TypeScript

import { ipcRenderer } from 'electron'
import type {
ShellOpenExternalEditorRequest,
ShellOpenExternalEditorResult,
ShellOpenLocalPathResult
} from '../../shared/shell-open-types'
import type { ExecutionHostId } from '../../shared/execution-host'
import type { ShellPathExistence } from '../../shared/path-existence-batch'
import type { PreloadApi } from '../api-types'
export const shellApi = {
openPath: (path: string, ownerHostId: ExecutionHostId): Promise<void> =>
ipcRenderer.invoke('shell:openPath', path, ownerHostId),
openInFileManager: (
path: string,
ownerHostId: ExecutionHostId
): Promise<ShellOpenLocalPathResult> =>
ipcRenderer.invoke('shell:openInFileManager', path, ownerHostId),
openInExternalEditor: (
request: ShellOpenExternalEditorRequest
): Promise<ShellOpenExternalEditorResult> =>
ipcRenderer.invoke('shell:openInExternalEditor', request),
openUrl: (url: string): Promise<void> => ipcRenderer.invoke('shell:openUrl', url),
openFilePath: (path: string, ownerHostId: ExecutionHostId): Promise<boolean> =>
ipcRenderer.invoke('shell:openFilePath', path, ownerHostId),
openFileUri: (uri: string, ownerHostId: ExecutionHostId): Promise<void> =>
ipcRenderer.invoke('shell:openFileUri', uri, ownerHostId),
pathsExist: (paths: string[]): Promise<ShellPathExistence[]> =>
ipcRenderer.invoke('shell:pathsExist', paths),
pathExists: (path: string): Promise<boolean> => ipcRenderer.invoke('shell:pathExists', path),
pickAttachment: (): Promise<string | null> => ipcRenderer.invoke('shell:pickAttachment'),
pickAttachments: (): Promise<string[]> => ipcRenderer.invoke('shell:pickAttachments'),
pickImage: (): Promise<string | null> => ipcRenderer.invoke('shell:pickImage'),
pickRepoIconImage: (): Promise<{ dataUrl: string; fileName: string } | null> =>
ipcRenderer.invoke('shell:pickRepoIconImage'),
pickAudio: (): Promise<string | null> => ipcRenderer.invoke('shell:pickAudio'),
pickDirectory: (args: { defaultPath?: string }): Promise<string | null> =>
ipcRenderer.invoke('shell:pickDirectory', args),
copyFile: (args: { srcPath: string; destPath: string }): Promise<void> =>
ipcRenderer.invoke('shell:copyFile', args)
} satisfies PreloadApi['shell']