Goal
Make the default agentCommands() graph loadable on Cloudflare Workers and browsers without nodejs_compat — a true zero-node:-builtin bundle. Today the full command inventory runs on workerd with nodejs_compat (verified on real workerd, 2026-09-08), but the eager node: imports below mean the ordinary entry cannot load when compatibility_flags = [].
This is the sibling of #669 (portable-by-default agentCommands / injectable regexExecutor, which removes node:worker_threads) and #671 (the two contracts/ leaks). #669 gets the default entry onto workerd-with-compat; this issue removes the remaining Node builtins so no compat flag is needed.
Node builtins in the createAgentCommands graph (beyond #669/#671)
Verified against current src (all reached from plugins/composition.ts):
node:crypto
commands/bytes/checksums/index.ts:3 — createHash (sha256sum/sha1sum/md5sum/cksum).
commands/bytes/compression/files.ts:1 — randomUUID.
commands/metadata/mktemp.ts:1 — randomInt (mktemp).
node:zlib
commands/bytes/compression/gunzip.ts:5 — createInflateRaw.
commands/bytes/compression/stream.ts:4 — createGzip.
commands/archive/stream.ts:1 — createGunzip, createGzip (tar gz).
node:stream / node:stream/promises
commands/bytes/compression/stream.ts:1-2 — Readable, PassThrough, pipeline.
node:perf_hooks / node:timers
commands/timeout/scheduler.ts:1-2 — performance, setTimeout/clearTimeout.
node:worker_threads (expr BRE path)
Portable replacements (all have Workers/browser-standard equivalents)
Acceptance
- Bundle the default entry with
esbuild --conditions=workerd,worker,browser and assert zero node: specifiers.
- Load and run representative commands (
sha256sum, gzip/zcat, tar, mktemp, timeout, expr) on real workerd with compatibility_flags = [].
- Preserve current budgets, cancellation, gzip-bomb caps, and explicit unsupported-mode errors; no unbounded native fallbacks.
- Where a portable primitive forces a tradeoff (e.g. async digest, restricted zlib), document it rather than weakening a guarantee.
Depends on / pairs with #669 and #671.
Goal
Make the default
agentCommands()graph loadable on Cloudflare Workers and browsers withoutnodejs_compat— a true zero-node:-builtin bundle. Today the full command inventory runs on workerd withnodejs_compat(verified on real workerd, 2026-09-08), but the eagernode:imports below mean the ordinary entry cannot load whencompatibility_flags = [].This is the sibling of #669 (portable-by-default
agentCommands/ injectableregexExecutor, which removesnode:worker_threads) and #671 (the twocontracts/leaks). #669 gets the default entry onto workerd-with-compat; this issue removes the remaining Node builtins so no compat flag is needed.Node builtins in the
createAgentCommandsgraph (beyond #669/#671)Verified against current
src(all reached fromplugins/composition.ts):node:cryptocommands/bytes/checksums/index.ts:3—createHash(sha256sum/sha1sum/md5sum/cksum).commands/bytes/compression/files.ts:1—randomUUID.commands/metadata/mktemp.ts:1—randomInt(mktemp).node:zlibcommands/bytes/compression/gunzip.ts:5—createInflateRaw.commands/bytes/compression/stream.ts:4—createGzip.commands/archive/stream.ts:1—createGunzip,createGzip(targz).node:stream/node:stream/promisescommands/bytes/compression/stream.ts:1-2—Readable,PassThrough,pipeline.node:perf_hooks/node:timerscommands/timeout/scheduler.ts:1-2—performance,setTimeout/clearTimeout.node:worker_threads(expr BRE path)commands/expr/bre-worker.ts:1—isMainThread(in addition to the regex executor covered by safe-bash: make agentCommands portable by default with optional regexExecutor injection #669).Portable replacements (all have Workers/browser-standard equivalents)
node:cryptocreateHash→ Web Cryptocrypto.subtle.digest(async; checksums already stream, so a digest accumulator fits) or a small pure-JS hash for md5/cksum where subtle has no algorithm.randomUUID→ globalcrypto.randomUUID().randomInt→crypto.getRandomValues.node:zlib→ a portable inflate/deflate (pure-JS such as fflate, or wasm) behind the existing bounded/streaming interfaces; keep the current gzip-bomb output-budget checks.node:stream→ Web Streams (TransformStream/ReadableStream, already globals in workerd/browsers), matching the safe-bash: documented@poe-platform/safe-bash/browserWorkers entry fails to start without nodejs_compat — contracts/io.ts imports node:stream/web, contracts/path.ts imports node:path #671 fix incontracts/io.ts.node:perf_hooks→ globalperformance;node:timers→ globalsetTimeout/clearTimeout(the code already has a scheduler-binding indirection).Acceptance
esbuild --conditions=workerd,worker,browserand assert zeronode:specifiers.sha256sum,gzip/zcat,tar,mktemp,timeout,expr) on real workerd withcompatibility_flags = [].Depends on / pairs with #669 and #671.