Repository navigation
Run Workspace outside Cloudflare Workers and add X11 desktop container & GUI automation #274
NannaOlympicBroadcast
started this conversation in
Feature Request
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
Allow
@cloudflare/computer(Workspace, SQLite storage, execution backends, and agent tools) to run standalone in plain Node.js withoutworkerdor a Durable Object binding, and add an X11 desktop container (Dockerfile.desktop) plus end-to-end GUI automation across@cloudflare/computer-rpc,@cloudflare/computerd,workspace.desktop, and@cloudflare/computer/tools/*.Reference branch / patch:
NannaOlympicBroadcast:feat/standalone-and-desktopBackground and motivation
@cloudflare/computerin plain Node.js fails immediately because several modules statically import"cloudflare:workers"(WorkerEntrypoint), requiring callers outsideworkerdto register a custom--importmodule loader hook. Furthermore,new Workspace({ storage })requires a Durable ObjectDurableObjectStoragehandle, and container backends assume a Cloudflare Containers binding./workspacefilesystem.computerdcurrently exposesshell(ExecRPC) andsync(SyncRPC), but has no display server lifecycle management or GUI input/screenshot RPC surface.Goals
WorkerEntrypointdynamically (process.getBuiltinModule("cloudflare:workers")when running inworkerd, with a lightweight fallback class in Node.js) so@cloudflare/computerimports cleanly in Node.js 22+ with no loader hooks.NodeSQLiteStoragebacked by Node's built-innode:sqlite(DatabaseSync), and makeWorkspaceOptions.storageoptional (defaulting to:memory:or accepting a database file path string).getWorkspace(ws)to accept a standaloneWorkspaceinstance directly.ComputerdBackendandDockerContainerBackendunder@cloudflare/computer/backends/computerdso aWorkspacecan connect to any reachablecomputerdHTTP/WebSocket endpoint or manage a local Docker container.ComputerRPCwith adesktopsub-service (DesktopRPC/DesktopRPCServer) supportingstatus,start,stop,screenshot(PNG/JPEG + crop region), mouseclick/doubleClick/tripleClick/rightClick/middleClick/mouseDown/mouseUp/move/drag/scroll, keyboardtype/key,cursorPosition,screenSize,windows,focusWindow,clipboardRead/clipboardWrite, andwait.DesktopControllerin@cloudflare/computerdto superviseXvfb,fluxbox,x11vnc, andwebsockify/noVNCand dispatch X11 operations (import/scrot/ffmpeg,xdotool,wmctrl,xclip/xsel), along withpackages/computerd/Dockerfile.desktop.workspace.desktop(WorkspaceDesktop) andcreateDesktopTool/desktop: trueincreateAITools,createPiTools, andcreateTanStackTools.Example
Verification and compatibility
ContainerBackend, andWorkerShellBackendAPIs remain backward-compatible.NodeSQLiteStoragelazy-loadsnode:sqliteviaprocess.getBuiltinModule("node:sqlite")soworkerdbundles never resolvenode:sqlite.npm test --workspace @cloudflare/computer-rpc -- tests/desktop-wire.test.ts(capnweb wire tests forDesktopRPC)npm test --workspace @cloudflare/computerd -- src/desktop/controller.test.ts(DesktopControllerlifecycle and X11 command tests)npm test --workspace @cloudflare/computer -- src/standalone.test.ts(standaloneNodeSQLiteStorage,ComputerdBackend, end-to-end Docker desktop container test with FUSE sync +noVNC+xtermGUI window focus/typing + PNG screenshot, anddesktoptool tests)npm run check(oxlint,oxfmt --check, andsherif) exits 0.All reactions