Files
orca/src/preload/api/hooks-bridge.ts
T
Neil 62b00c98bd fix(wsl): Settings' issue-command and path checks never start a stopped distro (#35829)
* fix(wsl): Settings' issue-command and path checks never start a stopped distro

Opening the repository and MCP settings sections read .orca/issue-command,
orca.yaml and stat'ed the repo root over \\wsl.localhost, which starts a
stopped distro (E9). The issue-command read (IPC and runtime) now returns
the unreachable result for a stopped distro unless a launch passes
wakeWslDistro, and shell:pathExists is gated like shell:pathsExist, with the
two link-click callers passing wakeWslDistro.

* fix(wsl): never save over an issue command a stopped distro kept unread

A refused read showed an empty, editable field, and typing then saved over
the hidden local override and started the distro. The editor now stays
read-only with a stopped-distro note, skips both saves, and re-reads when
main signals the distro running. Writes are gated too unless the user is
saving their own edit (wakeWslDistro). The MCP section's stopped message no
longer offers a Retry that cannot start the distro.

* fix(wsl): translate the stopped-distro issue command note; listen before reading

Adds the note in every shipped locale, and attaches the editor's running
listener before its read so a distro that starts while the refused read is
in flight still triggers a re-read.

* fix(wsl): keep the issue-command editor and writer tests on their seams

The editor reads window.api optionally, as hosts without a preload do, and
the writer tests spy on the gated write that the handlers now call.
2026-10-29 02:22:36 -07:00

33 lines
1.1 KiB
TypeScript

import { ipcRenderer } from 'electron'
import type { ExecutionHostId } from '../../shared/execution-host'
import type { PreloadApi } from '../api-types'
export const hooksApi = {
check: (args: { repoId: string; hostId?: ExecutionHostId; background?: boolean }) =>
ipcRenderer.invoke('hooks:check', args),
inspectSetupScriptImports: (args: { repoId: string; hostId?: ExecutionHostId }) =>
ipcRenderer.invoke('hooks:inspectSetupScriptImports', args),
readIssueCommand: (args: {
repoId: string
hostId?: ExecutionHostId
wakeWslDistro?: boolean
}): Promise<{
status?: 'ok' | 'error'
localContent: string | null
sharedContent: string | null
effectiveContent: string | null
localFilePath: string
source: 'local' | 'shared' | 'none'
refusedWslDistro?: string
}> => ipcRenderer.invoke('hooks:readIssueCommand', args),
writeIssueCommand: (args: {
repoId: string
content: string
hostId?: ExecutionHostId
wakeWslDistro?: boolean
}): Promise<void> => ipcRenderer.invoke('hooks:writeIssueCommand', args)
} satisfies PreloadApi['hooks']