@agent-os/backend-in-memory
Purpose
Section titled “Purpose”In-memory backend instance for runtime contract tests and local backend parity checks.
Invariant
Section titled “Invariant”Runtime Tags are the backend contract. The in-memory backend implements the same Ledger, Scheduler, Dispatch, Resources, Quota, Admission, LlmTransport, AttachedStreams, and MaterializedProjections Tag surface without importing Cloudflare or SQL substrate APIs.
The in-memory backend accepts only pure ReadonlyArray<AnyDurableTrigger>
registrations. It does not accept backend-bound trigger factories and does not
model custom app-owned SQL tables. Materialized projection declarations are
backend-neutral and are mirrored here for contract tests and local product
spikes.
For pure trigger parity tests, the in-memory backend mirrors durable trigger
claim, cancel, and redrive semantics: expired claims become claimable again,
cancelTrigger respects each trigger’s cancellation declaration, and
claim-token checks prevent duplicate terminal facts. It does not model
Cloudflare isolate eviction.
Minimal Usage
Section titled “Minimal Usage”Create an in-memory runtime backend in tests.
import { createInMemoryRuntimeBackend } from "@agent-os/backend-in-memory";Verification
Section titled “Verification”cd packages/backends/in-memorybun run test