Commit graph

7 commits

Author SHA1 Message Date
Sebastian Herrlinger
34d2637981 feat(codemode): move long stretches of a run's compute to a worker thread, keeping host code on the executor 2026-11-19 03:32:56 +01:00
Sebastian Herrlinger
c01c31121e feat(codemode): keep unpaired surrogates in namespace paths, error names, RegExp sources, bindings, metadata and durable data 2026-11-19 03:11:19 +01:00
Sebastian Herrlinger
9257f8889f feat(codemode): keep unpaired surrogates in the result and the logs (Data, HostString) 2026-11-19 02:53:56 +01:00
Sebastian Herrlinger
6d7e96a399 refactor(codemode): make the Rust crate the language layer only
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.
2026-11-19 01:54:11 +01:00
Sebastian Herrlinger
88e9f8d5e3 test(codemode): check libm-dependent pow and hypot cases on Linux only 2026-11-18 18:56:12 +01:00
kommander
e336bbafd1 feat(codemode): add schema tools, search, hooks, async host calls and extensions to the Rust port
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.
2026-11-18 18:54:08 +01:00
Sebastian
f71cdee242 feat(codemode): add embeddable Rust port 2026-11-18 18:53:56 +01:00