mirror of
https://github.com/stablyai/orca.git
synced 2026-11-17 11:24:37 +00:00
The host's files.readDocPreview sends a preview file in one RPC reply, capped at 512 KiB for text, so Open in Orca Browser failed for larger HTML on managed runtimes. Add files.readDocPreviewChunk, which runs the same grant authorization and size caps per range, and page through it after a file_too_large reply. Hosts without the method keep today's 413.
84 lines
3.9 KiB
TypeScript
84 lines
3.9 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'
|
|
| 'readChatImagePreview'
|
|
| 'readFileExplorerChunk'
|
|
| 'readDocPreviewFile'
|
|
| 'readDocPreviewChunk'
|
|
| 'writeFileExplorerFile'
|
|
| 'writeFileExplorerFileBase64'
|
|
| 'writeFileExplorerFileBase64Chunk'
|
|
| 'createFileExplorerFile'
|
|
| 'createFileExplorerDir'
|
|
| 'createFileExplorerDirNoClobber'
|
|
| 'commitFileExplorerUpload'
|
|
| 'replaceFileExplorerFileWithUpload'
|
|
| 'renameFileExplorerPath'
|
|
| 'copyFileExplorerPath'
|
|
| 'deleteFileExplorerPath'
|
|
| 'searchRuntimeFiles'
|
|
| 'listRuntimeFiles'
|
|
| 'listRuntimeMarkdownDocuments'
|
|
| 'pathsExistRuntimeFiles'
|
|
| 'statRuntimeFile'
|
|
| 'stagedFileSaves'
|
|
|
|
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),
|
|
readChatImagePreview: commands.readChatImagePreview.bind(commands),
|
|
readFileExplorerChunk: commands.readFileExplorerChunk.bind(commands),
|
|
readDocPreviewFile: commands.readDocPreviewFile.bind(commands),
|
|
readDocPreviewChunk: commands.readDocPreviewChunk.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),
|
|
replaceFileExplorerFileWithUpload: commands.replaceFileExplorerFileWithUpload.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),
|
|
stagedFileSaves: commands.stagedFileSaves
|
|
} satisfies RuntimeFileCommandSurface)
|
|
}
|