mirror of
https://github.com/stablyai/orca.git
synced 2026-10-06 08:02:28 +00:00
* perf(terminal): batch file-link existence checks on their owning host * test(relay): allow additive filesystem capabilities * fix(web): keep terminal file links working under batched existence checks createShellApi omitted pathsExist, so withFallback answered the new batch call with a truthy proxy resolving to undefined and the whole hover batch rejected — dropping every link on lines with an out-of-worktree path. * test(web): assert the shim without type assertions --------- Co-authored-by: m4air <m4air@Mac.localdomain> Co-authored-by: m4air <m4air@m4airs-MacBook-Air.local> Co-authored-by: Neil <neil@stably.ai>
45 lines
1.8 KiB
TypeScript
45 lines
1.8 KiB
TypeScript
import { ipcRenderer } from 'electron'
|
|
import type {
|
|
ShellOpenExternalEditorRequest,
|
|
ShellOpenExternalEditorResult,
|
|
ShellOpenLocalPathResult
|
|
} from '../../shared/shell-open-types'
|
|
import type { PreloadApi } from '../api-types'
|
|
|
|
export const shellApi = {
|
|
openPath: (path: string): Promise<void> => ipcRenderer.invoke('shell:openPath', path),
|
|
|
|
openInFileManager: (path: string): Promise<ShellOpenLocalPathResult> =>
|
|
ipcRenderer.invoke('shell:openInFileManager', path),
|
|
|
|
openInExternalEditor: (
|
|
request: ShellOpenExternalEditorRequest
|
|
): Promise<ShellOpenExternalEditorResult> =>
|
|
ipcRenderer.invoke('shell:openInExternalEditor', request),
|
|
|
|
openUrl: (url: string): Promise<void> => ipcRenderer.invoke('shell:openUrl', url),
|
|
|
|
openFilePath: (path: string): Promise<boolean> => ipcRenderer.invoke('shell:openFilePath', path),
|
|
|
|
openFileUri: (uri: string): Promise<void> => ipcRenderer.invoke('shell:openFileUri', uri),
|
|
|
|
pathsExist: (paths: string[]): Promise<boolean[]> =>
|
|
ipcRenderer.invoke('shell:pathsExist', paths),
|
|
pathExists: (path: string): Promise<boolean> => ipcRenderer.invoke('shell:pathExists', path),
|
|
|
|
pickAttachment: (): Promise<string | null> => ipcRenderer.invoke('shell:pickAttachment'),
|
|
|
|
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']
|