Support OpenClaw as an agent template
Problem
ClawLess currently only supports GitClaw as the agent runtime. Users who want to use OpenClaw — the popular open-source personal AI assistant — have no way to run it inside ClawLess.
Proposal
Add OpenClaw as a first-class template option. On startup, users should be able to choose between GitClaw and OpenClaw before the container boots.
Requirements
- Template picker at startup — simple UI to select which agent to run
- OpenClaw gateway running inside WebContainer with chat interface in the terminal
- Streaming responses — token-by-token rendering, not waiting for full response
- File visibility — files the agent creates/modifies should appear in the left file tree
- Tool activity indicators — show when the agent is reading/writing files or executing commands
Challenges to solve
- OpenClaw has native dependencies (sharp, playwright-core, node-pty, sqlite-vec, node-llama-cpp) that won't run in WebContainer's WASM sandbox — need stubbing strategy
- OpenClaw's native TUI uses WebSocket auth with ed25519 crypto signatures which are broken in WebContainer — need alternative chat interface
- crypto.generateKeyPairSync('ed25519') is broken in WebContainer — device identity must be pre-generated
- OpenClaw's default workspace path (~/.openclaw/workspace) differs from ClawLess's file tree root (~/workspace) — needs config alignment
- ESM/CJS interop issues when stubbing packages — Node's cjs-module-lexer can't detect named exports from stub proxies
Acceptance criteria
- User can choose GitClaw or OpenClaw at startup
- GitClaw continues to work exactly as before
- OpenClaw gateway boots successfully inside WebContainer
- User can chat with OpenClaw and see streaming responses
- Files created by OpenClaw appear in the file tree
- Template system is generic enough to support future agent templates
Good feature request. A few thoughts on the proposed approach:
WebContainer compatibility is the core challenge
OpenClaw's native dependencies (node-pty, sharp, playwright-core, sqlite-vec, node-llama-cpp) rely on OS-level binaries and native Node addons. WebContainer runs a WASM Node.js environment without a real OS underneath, so these will fail to install or run as-is. The stubbing strategy mentioned in the issue body is the right framing — each dependency needs a no-op or partial WASM-compatible shim.
A practical path forward:
node-ptycan be replaced with a WebContainer-native process spawning approach (WebContainer already providesspawn).sharpandplaywright-corecan likely be stubbed with modules that throw a descriptive error when called — most agent workflows won't trigger image processing or browser automation.node-llama-cppandsqlite-vecare the hardest: they require native binaries. The agent would need to route LLM calls to a remote API instead.
Template picker UI
The proposed startup UI to choose between GitClaw and OpenClaw is a good UX pattern. Consider storing the selection in localStorage so repeat users don't have to pick every time.
Streaming responses
Token-by-token streaming to the terminal is feasible using xterm.write() in a ReadableStream consumer loop. Worth prototyping this as a separate PR once the compatibility shims are established.
Assigning @shreyas-lyzr to track this.
This is a substantial feature request. Some implementation notes to help prioritize the work:
Native dependency stubbing is the hardest part. node-pty, node-llama-cpp, and sqlite-vec all require native binaries that WebContainer's WASM sandbox cannot run. A proxy/stub strategy (returning plausible no-ops or errors) is the right approach, but you'll need to intercept at require/import time. Using a custom Vite plugin to alias these packages to stub modules before bundling is cleaner than runtime shimming.
Ed25519 / WebCrypto: crypto.generateKeyPairSync('ed25519') is indeed broken in WebContainer. Pre-generating a static keypair at build time and hardcoding the device identity as a constant is the simplest workaround for a sandboxed demo environment. Document clearly that this identity is not secure.
Template picker UI: A modal or overlay at boot time (before startGitclaw/startOpenClaw is called) is the cleanest integration point. The container should not boot until the user selects a template, so the picker should gate the ContainerManager.boot() call.
Workspace path alignment: Pass OPENCLAW_WORKSPACE or equivalent env var to point OpenClaw at ~/workspace on first boot. Check if OpenClaw respects an env override before patching its config files directly.
Assigned to @shreyas-lyzr — would be good to start with a spike that just gets the OpenClaw gateway booting in the container (even with stubs) before wiring up the full UI.