Skip to content

Editor API Reference

Technical reference for the sandbox API available to custom algorithms in the Eigenvue editor.

Creates a visualization step. Each call adds one frame to the animation.

step(input: UserStepInput): void
FieldTypeRequiredConstraints
titlestringYesNon-empty, ≤ 200 characters
explanationstringYesAny string
stateRecord<string, unknown>YesMust be JSON-serializable, ≤ 1 MB per step
visualActionsVisualAction[]YesArray of objects, each with a string type property
isTerminalbooleanNoDefault: false. Must be true on the last step
phasestringNoOptional grouping label
  • "Step limit exceeded" — more than 500 step() calls (configurable)
  • "title must be a non-empty string" — empty title
  • "title exceeds 200 characters" — title too long
  • "explanation must be a string" — non-string explanation
  • "state is not JSON-serializable" — state contains functions, circular refs, etc.
  • "state size exceeds limit" — serialized state > 1 MB
  • "visualActions must be an array" — non-array visual actions
  • "must be an object with a string type property" — malformed visual action

Create a deep copy of a JSON-serializable value via JSON.parse(JSON.stringify(value)).

utils.deepClone<T>(value: T): T

Throws if the value is not JSON-serializable (functions, circular references).

Generate an array of sequential numbers.

utils.range(start: number, end: number, step?: number): number[]
ParameterDefaultDescription
startFirst value (inclusive)
endLast value (exclusive)
step1Increment between values

Examples:

utils.range(0, 5) // [0, 1, 2, 3, 4]
utils.range(2, 10, 3) // [2, 5, 8]
utils.range(5, 0, -1) // [5, 4, 3, 2, 1]

Throws if step is 0. Safety limit: 100,000 elements.

Create a 2D array with specified dimensions.

utils.createMatrix<T>(rows: number, cols: number, fill?: T): T[][]
ParameterDefaultDescription
rowsNumber of rows
colsNumber of columns
fill0Initial value for every cell

Invariant: Each row is an independent array (no shared references).

Shuffle an array in place using the Fisher-Yates algorithm with a seeded PRNG.

utils.shuffle<T>(array: T[], seed?: number): T[]
ParameterDefaultDescription
arrayThe array to shuffle (mutated in place)
seed42Integer seed for the PRNG

Determinism guarantee: Same seed + same input → same output.

Generate a deterministic random integer.

utils.randomInt(min: number, max: number, seed?: number): number
ParameterDefaultDescription
minMinimum value (inclusive)
maxMaximum value (inclusive)
seed42Integer seed for the PRNG

Invariant: min ≤ result ≤ max. Same seed → same result.

Format a number with fixed decimal places.

utils.formatNumber(value: number, decimals?: number): string
ParameterDefaultDescription
valueThe number to format
decimals2Number of decimal places

A captured console is available. Logs are collected (not sent to the browser console).

console.log(...args: unknown[]): void
console.warn(...args: unknown[]): void
console.error(...args: unknown[]): void
console.info(...args: unknown[]): void

Actions by layout. Unrecognized actions are silently ignored.

ActionProperties
highlightElementindex, color?
movePointerid, to
highlightRangefrom, to, color?
dimRangefrom, to
markFoundindex
markNotFound
showMessagetext, messageType?
ActionProperties
highlightElementindex, color?
compareElementsi, j, result
swapElementsi, j
highlightRangefrom, to
dimRangefrom, to
showMessagetext, messageType?
ActionProperties
visitNodenodeId, color?
highlightEdgefrom, to, color?
updateNodeValuenodeId, value
showMessagetext, messageType?
ActionProperties
activateNeuronlayer, index, value
propagateSignalfromLayer, toLayer
showGradientlayer, values
showMessagetext, messageType?
ActionProperties
highlightTokenindex, color?
showAttentionWeightsqueryIdx, weights
showMessagetext, messageType?
ActionProperties
applyGategate details
showStateVectorstate vector data
collapseStatecollapse details
showMessagetext, messageType?
LimitDefaultDescription
Execution timeout5,000 msMaximum wall-clock time
Step count500Maximum step() calls
State size (per step)1 MBMaximum serialized state
Total payload10 MBTotal size of all steps
Blocked APIsfetch, XMLHttpRequest, WebSocket, EventSource, BroadcastChannel, importScripts, indexedDB, caches, navigator, RTCPeerConnection, RTCDataChannel