feat(host-cloudflare): adopt dynamic-worker engine, retire QuickJS
Summary
Cloudflare Worker Loaders (Dynamic Workers) reached open beta on 2026-03-24, lifting the closed-beta constraint that kept apps/host-cloudflare on the interim QuickJS-WASM substrate. This swaps the engine seam to the dynamic-worker executor (the same one apps/cloud uses) behind the existing CodeExecutor seam, the "one-Layer change" the prior code comment described, and retires QuickJS entirely for this host.
What changed
wrangler.jsonc: add theworker_loadersLOADERbinding.config.ts: addLOADER: WorkerLoadertoCloudflareEnv; bump@cloudflare/workers-typesto the version carrying theWorkerLoadertype.execution.ts:makeCloudflareCodeExecutorProvider(loader)wrapsmakeDynamicWorkerExecutor; the executor stack layer threads the loader.app.ts/session-durable-object.ts: passenv.LOADERexplicitly (the host's per-request binding pattern, not cloud's ambientcloudflare:workersenv); drop the QuickJS preload.- Remove QuickJS:
quickjs.ts, the vendoredquickjs-engine.wasm, the vendor-wasm script, and theruntime-quickjs/quickjs-emscriptendeps. - Docs: refresh the stale README seam table (engine row + the DO-backed MCP session row) and the closed-beta comments.
Why
The dynamic-worker runtime gains capability QuickJS could not provide: structured-clone fidelity at the tool boundary (Blob/File/Uint8Array, Date/Map/Set), nodejs_compat, configurable outbound, and isolate-level isolation. It also converges host-cloudflare onto the same single engine as cloud.
Verification
- Gates:
typecheck(0 errors),lint(0),format:check(clean). apps/host-cloudflaretests: 3 files / 13 tests pass on real workerd + Miniflare (unstable_dev) with theLOADERbinding, covering/api/executions, MCPexecute, DO session survival, and a newBuffer/nodejs_compatcapability test (impossible on QuickJS, so it doubles as a regression guard).- e2e
--project cloudflare:browser-approvaland the newly-wiredmcp-execute(OAuth-connect then run code in the sandbox) pass.
Note on the e2e suite
scenarios/microsoft-graph-full.test.ts times out at its 300s limit in this environment, but this is pre-existing and unrelated: it does not touch the engine seam (it fetches and parses the full ~37MB Graph spec over the network), and it times out identically with this change reverted. Removing the QuickJS WASM module from the main isolate only reduces its memory footprint.
Deployment requirement
Worker Loaders open beta requires a paid Workers plan.
Closes #12
Summary by cubic
Cloudflare 호스트의 실행 엔진을 QuickJS‑WASM에서 동적 워커 엔진(Worker Loaders)로 전환했습니다. 구조화된 복제와 nodejs_compat를 지원하며, LOADER 누락 시 부팅 단계에서 명확한 오류로 가드합니다.
-
⚠️ Breaking Changes
- Cloudflare Workers 유료 플랜 필요.
wrangler.jsonc에worker_loaders바인딩 추가:[{ "binding": "LOADER" }].- 환경 타입에
LOADER: WorkerLoader필요. - QuickJS 관련 자산/의존성 제거:
scripts/vendor-quickjs-wasm.ts,src/quickjs-engine.wasm,src/quickjs.ts,@executor-js/runtime-quickjs,quickjs-emscripten-core,@jitl/quickjs-wasmfile-release-sync. - 엔진 패키지 교체:
@executor-js/runtime-dynamic-worker.@cloudflare/workers-types최신으로 상향.
-
How to test
wrangler.jsonc에worker_loaders바인딩 추가 후 배포 또는 로컬 실행(wrangler unstable_dev또는wrangler dev).- 기본 실행 확인:
POST /api/executions에export default 6 * 7전송 → 결과42. - Node 호환 확인:
export default Buffer.from("hello").toString("base64")→aGVsbG8=응답. - MCP 경로 확인: 세션 생성 후
tools/list와tools/call로execute가 동적 워커 엔진에서 실행되는지 확인.
Summary by CodeRabbit
-
새 기능
- Cloudflare 배포가 동적 Worker 로더 기반 실행 방식으로 전환되었습니다.
- MCP 세션이 Durable Object에 저장되어 워커 교체 후에도 유지됩니다.
- Cloudflare Worker에서 Node API 사용 테스트가 추가되었습니다.
-
버그 수정
- QuickJS 사전 로딩 및 WASM 의존성이 제거되어 배포/실행 흐름이 단순해졌습니다.
- Cloudflare 실행 환경 설정이 최신 Worker 바인딩과 호환되도록 업데이트되었습니다.