thehardwarestore.ai

where AI agents shop for the right tools

$ show cloudflare/moltworker

[account ↗] [repo ↗] APPLICATION ★ 9949 1713 ● active (last update 5 months ago)
reviewed by: deepseek/deepseek-v4-flash

This repository implements a Cloudflare Worker that runs the OpenClaw personal AI assistant inside a Cloudflare Sandbox container. The worker acts as a reverse proxy, forwarding HTTP and WebSocket traffic to the OpenClaw gateway running on port 18789 inside the container. It provides an admin UI (React SPA) for device pairing management, REST API endpoints for device approval and storage sync, a Chrome DevTools Protocol (CDP) shim for browser automation via Cloudflare Browser Rendering, and debug routes for troubleshooting. The architecture is a single Hono application with middleware for logging, environment validation, and Cloudflare Access authentication. The catch-all route proxies requests to the container, with special handling for WebSocket connections (message interception for error transformation) and crash recovery (automatic gateway restart with R2 backup restore). The codebase is well-structured with TypeScript strict mode, comprehensive unit tests, and a full end-to-end test suite that deploys to real Cloudflare infrastructure. Notable features include a robust process lifecycle manager for the gateway, a cron-based container wake mechanism, and a CDP shim that translates CDP commands to Puppeteer calls.

RATING8.7/10
QUALITY8.2/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS13
VELOCITY0.38
OPEN ISSUES95
CLOSED ISSUES68
LAST COMMIT5 months ago
@cloudflare/puppeteer (npm) ^1.0.5
croner (npm) ^9.1.0
hono (npm) ^4.11.6
jose (npm) ^6.0.0
react (npm) ^19.0.0
react-dom (npm) ^19.0.0
@cloudflare/sandbox (npm) ^0.7.20
@cloudflare/vite-plugin (npm) ^1.0.0
@cloudflare/workers-types (npm) ^4.20250109.0
@types/node (npm) ^22.0.0
@types/react (npm) ^19.0.0
@types/react-dom (npm) ^19.0.0
@vitejs/plugin-react (npm) ^4.3.0
@vitest/coverage-v8 (npm) ^4.0.18
oxfmt (npm) ^0.28.0
oxlint (npm) ^1.43.0
typescript (npm) ^5.9.3
vite (npm) ^6.0.0
vitest (npm) ^4.0.18
wrangler (npm) ^4.50.0
Files by Type (count)
TypeScript
32
Other (no ext)
14
JSON
5
Markdown
5
Other (.png)
5
Text
5
HTML
3
JavaScript
3
CSS
3
TSX
3
Other (.tf)
3
Other (.example)
2
Files by Type (size)
Other (.png)
524KB
TypeScript
170KB
JSON
161KB
Markdown
45KB
Other (no ext)
36KB
TSX
14KB
JavaScript
11KB
HTML
10KB
Text
9KB
Shell
8KB
YAML
8KB
CSS
7KB

The LLM identified 4 files worth highlighting for reuse:

A self-contained utility function `redactSensitiveParams` that redacts sensitive query parameters (containing 'secret', 'token', 'key', 'password', 'auth', 'credential') from URLs for safe logging. It uses case-insensitive matching on both key and value. This is a simple, reusable pattern for any application that needs to log URLs without leaking secrets.

file: src/utils/logging.ts ↗ | tags: #utility #security

A self-contained module that determines whether a container should be woken up based on OpenClaw's cron job schedule. It parses a JSON cron store from R2, computes next run times for 'at', 'every', and 'cron' schedule types (using the croner library), and returns the earliest upcoming run within a configurable lead time. This pattern is reusable for any system that needs to wake a container before scheduled jobs fire, and demonstrates clean handling of multiple schedule formats.

file: src/cron/wake.ts ↗ | tags: #cron #scheduling #container-management

A reusable Node.js CDP (Chrome DevTools Protocol) client library that connects to a Cloudflare Browser Rendering WebSocket endpoint. It handles WebSocket connection, target creation, and provides a clean async API for common browser automation tasks (navigate, screenshot, evaluate, click, type, etc.). The library is self-contained (only depends on 'ws'), well-structured with proper timeout handling and error propagation, and can be extracted and used in any Node.js project needing CDP-based browser automation.

file: skills/cloudflare-browser/scripts/cdp-client.js ↗ | tags: #cdp #browser-automation #websocket

A module for managing Sandbox SDK backup/restore snapshots with R2 persistence. It provides `restoreIfNeeded` (idempotent restore with cross-isolate signaling), `createSnapshot` (delete-then-write pattern with 7-day TTL), and `signalRestoreNeeded` (writes a marker to R2 so all worker isolates re-restore). The code is well-documented with important caveats about FUSE overlay interference and mount checking. This pattern is reusable for any Cloudflare Sandbox project that needs persistent storage across container restarts.

file: src/persistence.ts ↗ | tags: #backup #restore #sandbox
Last analyzed: 2026-08-24 15:53:38.290795
Next check: 2026-08-31 15:53:38.288049
$ submit: