Metakit / API

@doeixd/metakit/interpreter

Effect-native Interpreter service and composable middleware layers (@doeixd/metakit/interpreter).

Provides Interpreter as an Effect Context.Reference (defaulting to the in-memory evaluator, mirroring Solver in @doeixd/metakit/prove), so applications supply foreign operations (Operation.define), tracing spans, audit observers, or foreign-op allowlists once via Effect Layers instead of threading { foreign } options through every call site.

Functions

allowEvaluate rule, one of policy.rules, using the current Interpreter; a rule of another policy throws.
evalExprEvaluate expr against env using the current Interpreter.
judgePartially evaluate boolean expr against partial using the current Interpreter.
layerProvide an in-memory Interpreter configured with optional foreign implementations.
makeMemoryBackendConstruct an in-memory InterpreterBackend with optional ambient foreign implementations.
preparePrepare expr into a preplanned, CSP-safe closure tree bound to the current Interpreter backend's foreign table, with ArtifactFingerprint and EvidenceKey…
residualizeResidualize expr against partial using the current Interpreter.
runExecute a transition (returning the next State) using the current Interpreter.
runFnExecute a Fn with contract checking (runChecked) using the current Interpreter.
stepExecute a transition step (returning { state, emitted }) using the current Interpreter.
withAllowlistSandbox layer: restricts the current Interpreter's foreign implementations (including any caller-supplied step options) to only those whose exact id@version…
withForeignMerge additional foreign operation implementations onto the current Interpreter.
withObserverMiddleware layer that notifies observer after every interpreter operation, measuring elapsed duration using Effect's Clock.
withTracingWrap the current Interpreter so every operation emits an Effect.withSpan.

Values

foreignRead the foreign operation implementations registered on the current Interpreter.
InterpreterThe ambient MetaKit interpreter in the Effect context. Defaults to memoryBackend; override with Interpreter.layer(...) or middleware layers (withForeign,…
memoryBackendDefault in-memory backend (no foreign operations registered).

Interfaces

InterpreterBackendImplementation contract for a MetaKit interpreter backend.
MemoryBackendOptions
PreparedPlan
PrepareOptions
StepOutputResult of executing one transition step.

Types

InterpreterEventStructured observation emitted by withObserver.
InterpreterObserverCallback invoked by withObserver for every interpreter operation.