Skip to content

oracular / inspect

Function: inspect() ​

ts
function inspect(
   state, 
   at, 
   opts?
): Snapshot;

Defined in: evaluate.ts:74

evaluate for every declared intent at once, in config order: the whole engine's view at one moment, as plain data. This is what to log, assert on, or hand to renderInspector from oracular/inspect for a live panel. Read-only.

Parameters ​

ParameterTypeDescription
stateEngineStateThe current state. Not mutated.
atnumberThe time to evaluate at.
opts?EvaluateOptionsReveal overrides and explain filters, applied to every intent.

Returns ​

Snapshot

at and one IntentSnapshot per intent.

Throws ​

TypeError when state is not an engine state, at is not finite, or opts is malformed.

Example ​

ts
for (const { intent, prediction, reveal } of inspect(state, Date.now()).intents) {
  console.log(intent, prediction.p.toFixed(3), reveal ? 'reveal' : '');
}

Released under the MIT License.