The crate becomes the Rust implementation of the reference's language layer (`src/language/`): its public API is
the Rust form of `Language` (`Runtime::make` with `globals(run)`, modules, limits and translation; `HostFunction`
for `Host.fn` with sync, async and sync-thenable types, idempotent, constructible and takes-functions;
`DurableFunction`; `Namespace`; `Failure` for `Host.fail` and `Host.missing`; `Run` with its metadata; programs,
suspend and resume; snapshots). Code Mode (tools, schemas, the catalog, `search`, OpenAPI, hooks, max tool calls,
extensions) is removed, and the language files move from `src/language/` to `src/`.
Host calls follow the reference's language runtime: arguments cross under the runtime's translation (functions and
promises fail the call unless dropped or awaited), a function from a result crosses back only to a function that
takes functions, async and durable calls start at the next handover, sync work can block (`Returned::Block`) or
stay pending (`Returned::Pending`), and a suspend is refused while a call that can't be detached runs. Namespace
paths carry their root label, and their `keys` may fail. Snapshots save the run's metadata and its calls by global
path, and restart them by resolving that path again.
The replays define the generators' host globals (`conformance/reference.rs` shares `tools` with
`conformance/reference.ts`): the cases, `host.json`, `boundary.json` and `streaming.json`. `tests/host.rs` mirrors
the reference's `test/language.test.ts`; the API tests are ported, and the Code Mode tests are removed.
tools() in bench/src/main.rs registers the JSON Schemas the reference's Effect Schemas render to, so the tool fan-out footnote and the plugin-event note no longer say the Rust side skips validation.
It read the CPU and memory from /proc, sizes with GNU stat, peak RSS with GNU time and cold starts with bash 5's $EPOCHREALTIME. On macOS it now asks sysctl, BSD stat and time, and times cold starts with perl's clock around each run.
localeCompare used a case-folding heuristic that disagreed with the
reference on 634 of 4,841 sampled pairs (accents, punctuation, canonical
equivalence, scripts). It now uses ICU4X's root collation, which the
reference's host uses for its en-US default, and agrees on all of them.
Dependency: icu_collator 2.4 with compiled data (pure Rust, Unicode's
ICU4X). It adds 1,247,048 bytes to the stripped embed example
(4,785,968 -> 6,033,016; bench/RESULTS.md (d) updated); nearly all of that is the root collation table,
so generating data for the root locale alone saves under 1 KB.
Schema::validated compiles its document into a validator once, so checking a
value does no keyword lookups and builds a path only when it fails. A failed
host call is boxed, so a successful one stays small in the inbox; synchronous
tools share one context; a program compiles when it is made and borrows its
source; the run id is made on first use.
The benchmark tools now declare the reference's schemas, so tool fan-out
also validates each input and output, as the reference does.
Tools take validating or render-only JSON Schemas (the Rust form of Effect
Schemas and the reference's JsonSchema), render byte-identical TypeScript
signatures, and report InvalidToolInput and InvalidToolOutput. Namespaces,
freeform tools, the catalog, toolExpression, searchSignature and the BM25
search built-in follow tool-runtime.ts; conformance/catalog.ts regenerates
the expectations from the reference.
Tools and extension globals may return futures. execute_async runs on any
executor; execute drives it with a small built-in block_on, and a shared
timer thread enforces timeouts while host work is pending. Dropping a run
cancels its calls, which after hooks see as interrupted.
Extensions cross values as copies both ways, including functions in results,
errors, maps and sets, and programs load them with import, require and
import() by Node module name. Runtime::program adds the reference's
program API with run ids.
Runs fmt, Clippy and the tests including conformance; regenerates every
conformance expectation from the reference and fails on a diff; runs the
test262 parity check; and runs the benchmarks into the job summary without
gating. The toolchain is pinned in rust-toolchain.toml with a minimal
profile, and every cargo call is --locked.
The workflow file itself follows in a separate commit.
Each bench program gets an equivalent, differently written variant in
bench/variants/, run next to its original on both implementations, with the
variant / original ratio per side. A plugin-event benchmark runs the
conformance reducer with a git.status tool as a 226-byte and a 3 KB source.
RESULTS.md labels medians, mins and means, computes speed-ups from medians
only, and notes that the reference tools validate through Effect Schema.