Files
orca/src/main/runtime/runtime-file-command-surface.ts
T
241fb9ed9d perf(terminal): batch file-link checks on their owning host (#20463)
* 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>
2026-09-13 16:27:06 -07:00

76 lines
3.5 KiB
TypeScript

import type { RuntimeFileCommands } from './orca-runtime-files'
type RuntimeFileCommandName =
| 'listMobileFiles'
| 'searchMobileFilePaths'
| 'searchQuickOpenFilePaths'
| 'openMobileFile'
| 'openMobileDiff'
| 'readMobileFile'
| 'resolveTerminalPath'
| 'readTerminalArtifactFile'
| 'readTerminalArtifactPreview'
| 'writeTerminalArtifactFile'
| 'revokeTerminalFileGrantsForClient'
| 'readFileExplorerDir'
| 'watchFileExplorer'
| 'readFileExplorerPreview'
| 'readFileExplorerChunk'
| 'readDocPreviewFile'
| 'writeFileExplorerFile'
| 'writeFileExplorerFileBase64'
| 'writeFileExplorerFileBase64Chunk'
| 'createFileExplorerFile'
| 'createFileExplorerDir'
| 'createFileExplorerDirNoClobber'
| 'commitFileExplorerUpload'
| 'renameFileExplorerPath'
| 'copyFileExplorerPath'
| 'deleteFileExplorerPath'
| 'searchRuntimeFiles'
| 'listRuntimeFiles'
| 'listRuntimeMarkdownDocuments'
| 'pathsExistRuntimeFiles'
| 'statRuntimeFile'
export type RuntimeFileCommandSurface = Pick<RuntimeFileCommands, RuntimeFileCommandName>
export function installRuntimeFileCommandSurface(
target: RuntimeFileCommandSurface,
commands: RuntimeFileCommands
): void {
Object.assign(target, {
listMobileFiles: commands.listMobileFiles.bind(commands),
searchMobileFilePaths: commands.searchMobileFilePaths.bind(commands),
searchQuickOpenFilePaths: commands.searchQuickOpenFilePaths.bind(commands),
openMobileFile: commands.openMobileFile.bind(commands),
openMobileDiff: commands.openMobileDiff.bind(commands),
readMobileFile: commands.readMobileFile.bind(commands),
resolveTerminalPath: commands.resolveTerminalPath.bind(commands),
readTerminalArtifactFile: commands.readTerminalArtifactFile.bind(commands),
readTerminalArtifactPreview: commands.readTerminalArtifactPreview.bind(commands),
writeTerminalArtifactFile: commands.writeTerminalArtifactFile.bind(commands),
revokeTerminalFileGrantsForClient: commands.revokeTerminalFileGrantsForClient.bind(commands),
readFileExplorerDir: commands.readFileExplorerDir.bind(commands),
watchFileExplorer: commands.watchFileExplorer.bind(commands),
readFileExplorerPreview: commands.readFileExplorerPreview.bind(commands),
readFileExplorerChunk: commands.readFileExplorerChunk.bind(commands),
readDocPreviewFile: commands.readDocPreviewFile.bind(commands),
writeFileExplorerFile: commands.writeFileExplorerFile.bind(commands),
writeFileExplorerFileBase64: commands.writeFileExplorerFileBase64.bind(commands),
writeFileExplorerFileBase64Chunk: commands.writeFileExplorerFileBase64Chunk.bind(commands),
createFileExplorerFile: commands.createFileExplorerFile.bind(commands),
createFileExplorerDir: commands.createFileExplorerDir.bind(commands),
createFileExplorerDirNoClobber: commands.createFileExplorerDirNoClobber.bind(commands),
commitFileExplorerUpload: commands.commitFileExplorerUpload.bind(commands),
renameFileExplorerPath: commands.renameFileExplorerPath.bind(commands),
copyFileExplorerPath: commands.copyFileExplorerPath.bind(commands),
deleteFileExplorerPath: commands.deleteFileExplorerPath.bind(commands),
searchRuntimeFiles: commands.searchRuntimeFiles.bind(commands),
listRuntimeFiles: commands.listRuntimeFiles.bind(commands),
listRuntimeMarkdownDocuments: commands.listRuntimeMarkdownDocuments.bind(commands),
pathsExistRuntimeFiles: commands.pathsExistRuntimeFiles.bind(commands),
statRuntimeFile: commands.statRuntimeFile.bind(commands)
} satisfies RuntimeFileCommandSurface)
}