SDK API Reference
The @openprose/reactor 0.3.0 public surface -- six reasoned entrypoints, one curated front door, and an honest map of what's built and what isn't.
SDK API reference
@openprose/reactor is the Reactor layer of one system, made
programmable. OpenProse is the foundation -- the paradigm where you
declare the outcomes you want kept true, as Markdown contracts. The
CLI is one driver of this SDK; so is the
DevTools replay viewer. This reference documents the surface
both of them sit on, so you can host a reactor from your own code.
One call takes a directory of .prose.md contracts all the way to a booted,
reconciling reactor and hands back one typed handle:
import { reactor } from "@openprose/reactor";
// Compile ./my-project, assemble a durable reactor over ./state, boot to a
// fixpoint (cold nodes render once; warm nodes memo-skip), return a live handle.
const { reactor: r } = await reactor("./my-project", { directory: "./state" });
console.log(r.view.cost); // { fresh, reused, byCause, byNode } -- the hero metric
await r.ingest("source", { data: { "in.txt": textFile("hello") } });That is the front door. Everything deeper is reachable, but it is deliberately one rung down. This page is the map.
Source of truth. Every name, path, and version on these pages is grounded in the
shipped @openprose/reactor@0.3.0 package -- its exports map and its
entrypoint barrels -- not a proposal. If a code example and prose ever disagree,
trust the code; if the docs and the skill disagree, trust the
skill.
The six reasoned entrypoints
The package ships six entrypoints (plus ./package.json). This is not
arbitrary surface area: each split exists for a reason an agent can reason about
before importing. The curated front door is .; the rest are isolation seams you
reach for only when you need what they isolate.
| Entrypoint | What it is | Why it's split out |
|---|---|---|
@openprose/reactor | The front door -- the reactor() facade, the one typed Reactor handle, the assemblers, the substrate factories, observe, and the vocabulary a driver needs. | This is the one obvious door. A deliberate ~45-name curation, not a firehose. Start here. |
@openprose/reactor/agents | The full @openai/agents escape hatch -- the layered render config and the compile-session surface. | Peer-dep isolation. Importing it pulls the optional @openai/agents + zod peers; the keyless core installs neither. It is the full passthrough, not a lossy wrapper. |
@openprose/reactor/adapters | The injection boundary -- substrate backends, the gateway-ingress + cursor toolkit, record/replay, passthrough adapters, and the port contracts a custom backend implements. | The seam you wire custom backends against. Kept distinct so swapping persistence or a gateway is a one-import change. |
@openprose/reactor/run | The offline boundary -- compileProject / runProject (model-bearing). | These deep-import the live agent adapters. Kept off the front door so a keyless inspection/replay build never loads a provider. The facade reaches them by dynamic import. |
@openprose/reactor/run/types | The type-only mirror of the run-phase shapes (incl. the Reactor handle type). | Carries no @openai/agents value import -- so a consumer (the CLI) can type the handle it drives without crossing the offline boundary. |
@openprose/reactor/internals | The engine room -- the reconciler-construction spine and every deep domain shape (receipt / cost / forme / memo / composition / forecast / evidence-plan / projection / canonicalizer), plus the deprecated Reactor*-prefixed port aliases. | The honest deep door for power users re-hosting the reconciler loop by hand. Stable but deep; nothing here was removed from the package, it is simply not on the headline surface. |
Folding . to a curation removes the nodenext resolution cliff for the 90%
path: the root import resolves under legacy node resolution, so the cliff now
bites only the explicit escape-hatch subpaths -- where a power user is already in
a real tsconfig.
Read these pages in order
The front door (.)
The reactor() facade and the one typed Reactor handle: drive (ingest/tick/drain/boot), observe (view/ledger/store), the substrate factories, the wake + ingress constructors, and branded identity.
The agents escape hatch (/agents)
The layered RenderOptions -- harness sugar, the full @openai/agents passthrough, and the agentFactory/runnerFactory backstop -- plus the RenderBackend injection seam and the compile-session surface.
The adapters boundary (/adapters)
The one Substrate primitive, the restart-survival invariant, the gateway-ingress + cursor toolkit, record/replay, and the port contracts a custom backend implements.
The offline boundary (/run + /run/types)
compileProject / runProject (model-bearing, dynamic-import only) and the type-only mirror that lets a driver type the handle without loading a provider.
The engine room (/internals)
The reconciler-construction spine, the nine deep domain shapes, the deprecated port aliases, and the receipt-proof helpers the verify-a-receipt example imports.
Install and prerequisites
The SDK is a published npm package. Install it per-project alongside its optional peers (you only need the peers when you actually render against a model):
npm install @openprose/reactor
# When you render against @openai/agents (the live run path):
npm install @openai/agents zod- Version:
@openprose/reactor@0.3.0. (The CLI is@openprose/reactor-cli@0.2.0and DevTools is@openprose/reactor-devtools@0.2.0; they version independently. The OpenProse language and skill version separately again -- do not attach0.3.0to the language.) - Node:
>=20.0.0. - Peers (optional):
@openai/agents@^0.11.6andzod@^4.0.0. They are marked optional inpeerDependenciesMeta: the keyless inspection/replay surface never loads them. You pull them by importing/agents,/run, or the live render path.
Prefer a local-first install over a global one, and prove the system keyless
before you spend a token. For the full agent-first setup path -- keyless proof,
then init to doctor to compile, then going live, then where contracts live
-- see the OpenProse setup guide.
What's built, and what isn't
In the spirit of the receipts, the honest status. For coding agents onboarding on behalf of a user, this block is the trust mechanism: the SDK does not pretend.
Built and runnable. The render atom, the content-addressed world-model store (with the published-truth / private-workspace split), the compiled canonicalizer with facets, Forme's wiring with diagnostics and acyclicity, postcondition-gated commits with no judge step, the receipt ledger with chain verification, and composition pins are implemented and exercised by a test suite that runs offline -- no model calls in the commit gate. The reconciler's surprise property is enforced as a tested invariant: when an input fingerprint doesn't move, the render body provably never runs.
Deliberately not yet here.
- No benchmark or dollar numbers. We are not going to pretend a structural invariant is a measured speedup. Designing honest long-horizon benchmarks is the help we most want -- these pages assert no performance figure.
- The signer is an explicit null state. In v1, signed means tamper-evident
at the meaning layer and chain-consistent -- not yet a cryptographic byte
hash. The signature is an honest null
(
{ scheme: "none", null_reason: "no-signer-adapter-configured" }). The reservedSignerPortseam means the crypto milestone is a backend swap, not a reshape. - No timestamp or actor on receipts yet. The chain is content-addressed and ordered; wall-clock attribution is named, not shipped.
- The fixpoint is specified and deferred. The topology as a responsibility (an
epoch driver layered over the fixed-topology handle) is designed -- the handle
already exposes
topology+drain+onReceiptfor exactly that loop -- but the driver itself is a reserved, forward-only seam, declared and not built. - Facet inference and ledger compaction are named roadmap, not shipped.
These caveats are surfaced inline where they bite, too: the reconciler and receipts for what "signed" means in v1, world-model and fingerprints for the signer caveat, and CLI configuration for the deferred knobs.
Where to go next
Start with OpenProse
The foundation: declare outcomes in Markdown contracts that run on any Prose-Complete harness. The SDK is the Reactor layer of that one system.
The front door
The hello-world top rung: the reactor() facade and the one typed handle.
The CLI
The reference command-line driver of this SDK -- compile, run, serve, observe.
Author an eval
Drive the reconciler yourself, send us a responsibility the harness can't keep yet, and find the examples, guides, and spec.
The conversation always ends. The responsibility shouldn't have to.
Continuity and ingestion
The self-recheck cadence, the freshness bridge, gateways as external evidence, and durable idempotency cursors.
The front door (`.`)
The curated `@openprose/reactor` entry point -- the reactor() facade, the one typed Reactor handle, the assemblers, the substrate, observe(), and the driver vocabulary.