MCPcopy Create free account
hub / github.com/TraderAlice/OpenAlice / listFiles

Function listFiles

ui/src/components/workspace/api.ts:495–505  ·  view source on GitHub ↗
(id: string, relPath: string)

Source from the content-addressed store, hash-verified

493}
494
495export async function listFiles(id: string, relPath: string): Promise<DirListing> {
496 // Electron app mode has a native file transport. Browser/dev/Docker keep the
497 // HTTP path, which is still the right shape for self-hosting and ordinary
498 // browser debugging.
499 const bridge = electronWorkspaceBridge();
500 if (bridge) return bridge.listFiles({ id, path: relPath });
501 const qs = relPath ? `?path=${encodeURIComponent(relPath)}` : '';
502 const res = await fetch(`/api/workspaces/${encodeURIComponent(id)}/files${qs}`);
503 if (!res.ok) throw new Error(`list files failed: ${res.status}`);
504 return (await res.json()) as DirListing;
505}
506
507/**
508 * Read a single UTF-8 text file from inside a workspace. Returns a

Callers 1

refreshFunction · 0.90

Calls 2

electronWorkspaceBridgeFunction · 0.85
fetchFunction · 0.50

Tested by

no test coverage detected