From fdabc8dde02693fc3816671575d32cb7effb7240 Mon Sep 17 00:00:00 2001 From: Sebastian Herrlinger Date: Wed, 18 Nov 2026 22:26:08 +0100 Subject: [PATCH] docs(codemode): describe the crate's language and Code Mode layers --- packages/codemode-rust/AGENTS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/codemode-rust/AGENTS.md b/packages/codemode-rust/AGENTS.md index e9c311e7bce..c54a7a7a28d 100644 --- a/packages/codemode-rust/AGENTS.md +++ b/packages/codemode-rust/AGENTS.md @@ -16,6 +16,7 @@ In scope: - The language subset needed by the nine reference benchmark programs (`conformance/cases/bench-*`), the plugin reducer example, and the other conformance cases. - Pipeline: parse → compile to bytecode → stack VM. Values cross the host boundary as JSON copies (`serde_json::Value`), never shared. +- Two layers, as the reference's `src/language/` and `src/codemode/`: `crates/psychoscript/src/language/` (compiler, VM, runtime, stdlib, host functions and their crossing, snapshots) knows nothing about tools and asks the layer embedding it through `host::Embedder`; `src/codemode/` (tools, schemas, catalog, `search`, OpenAPI, hooks, the `Runtime`) builds on it. `tests/language_boundary.rs` fails when a language file names Code Mode. - Host API in `crates/psychoscript/src/lib.rs`, the Rust form of the reference's README API: schema-described tools (sync or futures) at dotted paths with namespaces, OpenAPI tools (`openapi::from_spec` over a host `HttpClient`), the catalog and `search`, hooks, extensions with `import`/`require`, their module names and constructible globals, runs that pick some of the runtime's extensions (`RunOptions`), programs (`Runtime::program`), suspending and resuming runs (`Suspender`, `Runtime::resume`, idempotent and durable tools, extension `snapshot` hooks), JSON bindings, limits (`timeout_ms`, `max_tool_calls`, `max_output_bytes`), `console.log` captured into `logs`. - Parity runs both ways: add no language feature or host API the reference lacks. Rust-native forms of reference APIs (futures for Effects, a blocking `execute`) are fine. - `conformance/catalog.json` is generated by `bun conformance/catalog.ts` from the reference; never edit it by hand.