Skip to content
Concepts

Concepts

Cloudflare computerd 0.2.1 and the native apply_patch engine source for Local and the Computer container

@fungi.computer/cordyceps bundles Cloudflare’s pinned computerd daemon with its vendored DOFS and computer-rpc sources, and ships the source and builder of the native fungi-apply-patch engine behind the apply_patch tool. Local runs the daemon in shim mode for an attached folder and runs its own build of the engine in its project root; the Computer container copies and starts the same daemon as its workspace daemon and compiles the engine for its own platform.

fungi-apply-patch reads one Codex-format patch on stdin and applies it inside its working directory. It wraps the pinned upstream Codex codex-apply-patch crate (native/apply-patch/pin.mjs) with Fungi’s rooted, bounded host (native/apply-patch/main.rs): paths stay inside the working directory, input and changes are bounded to 128 KiB, a context mismatch exits 23 and a malformed patch exits 24.

The package ships the engine’s source, never a prebuilt binary, so every consumer gets an executable for its own platform:

  • compile.mjs compiles one target inside a prepared builder (Node, rustup with the pinned Rust toolchain, a C toolchain and network access). It verifies the pinned Codex release archive’s SHA256, builds with the upstream lock unchanged (--locked), remaps build paths, strips debug information, and writes fungi-apply-patch plus build.json, the license and notice texts of every crate compiled into it.
  • fungi-apply-patch-build --out <dir> [--target <platform>] (build.mjs) builds for a host. Linux targets build in a digest-pinned Ubuntu 22.04 container (glibc 2.35 floor), and macOS targets cross-build from Linux in a pinned cargo-zigbuild container, each as an ordinary docker build --output (docker/). A macOS host builds its own target natively through rustup. One immutable artifact per pin, wrapper and target is shared under ${XDG_CACHE_HOME:-~/.cache}/fungi/native-patch/; concurrent misses serialize on proper-lockfile, publication is atomic, and a cache hit verifies its checksums before restoring the executable and notices. A mismatch is refused rather than silently reused or rebuilt under the same pin.
  • The Computer image’s Dockerfile copies this directory and runs compile.mjs in a builder stage, so the image’s engine always matches the image’s platform.
TERMINAL
pnpm --filter @fungi.computer/cordyceps build:native
  • The package composes vendored sources. scripts/build.mjs bundles the pinned upstream/computerd, upstream/dofs, and upstream/rpc trees. upstream/PROVENANCE.md records the source revision and Botanical changes.
  • Local uses the shim. Local selects FUSE_MOUNT=shim, binds the daemon to an available port, and connects through loopback. Its host-side folder is synchronized with the in-memory virtual filesystem.
  • The Computer container owns runtime startup. Its image copies the bundle to /opt/fungi/computerd.cjs; the container init process starts it alongside the terminal service. The configured FUSE backend and container privileges determine whether the mount succeeds.

Run pnpm run build, pnpm run pack and pnpm run stranger in this package. The maintained stranger proof installs only package tarballs into a fresh npm consumer, checks the exact shipped files, runs the public runtime fixture and compiles every JavaScript entrypoint with strict NodeNext and no library-check skip. This qualification does not publish npm releases or push a repository split.

See LICENSE for the license and the package manifest for its public repository destination.