@@ -19,7 +19,7 @@ TypeScript-first React component package scaffold with:
1919
2020- ` npm run typecheck ` : Validate TypeScript.
2121- ` npm run build ` : Build ESM, CJS, and declaration outputs.
22- - ` npm run test:visual ` : Build package and start visual harness server.
22+ - ` npm run test:visual ` : Start the visual harness server.
2323
2424## Sandbox terminal usage
2525
@@ -243,6 +243,96 @@ Terminal primitives support:
243243
244244You can also create a reusable spreadable config with ` createTerminalTheme(...) ` .
245245
246+ ## Filesystem workspace usage
247+
248+ The public filesystem path is built from two layers:
249+
250+ - ` HyperbrowserFileWorkspace ` : ready-to-use Hyperbrowser-backed filesystem browser
251+ - ` FileWorkspace ` : lower-level browser shell when you want to bring your own adapter
252+
253+ Import the packaged stylesheet once in your app entrypoint:
254+
255+ ``` tsx
256+ import " @hyperbrowser/ui/styles.css" ;
257+ ```
258+
259+ ### Basic ` HyperbrowserFileWorkspace ` example
260+
261+ ``` tsx
262+ import { useCallback } from " react" ;
263+ import {
264+ createFileWorkspaceTheme ,
265+ HyperbrowserFileWorkspace ,
266+ type HyperbrowserFilesystemBrowserAuthParams ,
267+ } from " @hyperbrowser/ui" ;
268+ import " @hyperbrowser/ui/styles.css" ;
269+
270+ export function SandboxFiles({
271+ sandboxId ,
272+ }: {
273+ sandboxId: string ;
274+ }) {
275+ const getRuntimeBrowserAuth = useCallback (
276+ async ({
277+ browserAuthEndpoint ,
278+ sandboxId: resolvedSandboxId ,
279+ signal ,
280+ }: HyperbrowserFilesystemBrowserAuthParams ) => {
281+ if (! browserAuthEndpoint ) {
282+ throw new Error (" Sandbox filesystem auth endpoint is unavailable." );
283+ }
284+
285+ const response = await fetch (browserAuthEndpoint , {
286+ method: " POST" ,
287+ signal ,
288+ });
289+
290+ if (! response .ok ) {
291+ throw new Error (
292+ ` Failed to get filesystem auth for sandbox ${resolvedSandboxId ?? sandboxId }. ` ,
293+ );
294+ }
295+
296+ return response .json ();
297+ },
298+ [sandboxId ],
299+ );
300+
301+ const filesystemTheme = createFileWorkspaceTheme (" basic" , {
302+ appearance: " dark" ,
303+ });
304+
305+ return (
306+ <HyperbrowserFileWorkspace
307+ { ... filesystemTheme }
308+ getRuntimeBrowserAuth = { getRuntimeBrowserAuth }
309+ sandboxId = { sandboxId }
310+ style = { { minHeight: 720 }}
311+ title = " Sandbox Files"
312+ workspacePath = " /workspace"
313+ />
314+ );
315+ }
316+ ```
317+
318+ Notes:
319+
320+ - ` getRuntimeBrowserAuth(...) ` receives ` { signal, sandboxId, browserAuthEndpoint } ` .
321+ - ` sandboxId ` is the standard customer path.
322+ - ` runtimeBaseUrl + bootstrapUrl ` is also supported for already-bootstrapped runtime sessions.
323+ - ` apiBaseUrl ` is only needed when you want the library to call the control-plane endpoint directly or when you need a non-default control-plane base.
324+
325+ ### Filesystem theming
326+
327+ Filesystem theming supports:
328+
329+ - ` preset ` : one of ` basic ` , ` atlas ` , ` ledger `
330+ - ` appearance ` : ` "dark" ` or ` "light" `
331+ - ` chromeTheme ` : partial chrome overrides
332+ - ` editorTheme ` : partial editor typography overrides
333+
334+ You can create a reusable spreadable config with ` createFileWorkspaceTheme(...) ` .
335+
246336## VNC component usage
247337
248338` HyperbrowserVncViewer ` renders a noVNC viewer using a Hyperbrowser session token and
0 commit comments