Store

AXIS Solid store: AppState shape, activePlugins, persistence rules, logging, and alignment helpers.

This page

The Solid store is the control-plane nexus of AXIS. Plugins read configuration from it; UI binds reactively; persistence snapshots a safe subset to pynescript.axis.v1.

Abstract

ExportRole
store / setStorecreateStore<AppState>
persistDebounced localStorage write
setActivePluginKinded selection + flat field mirrors
appendLog / status helpersOperator-visible telemetry
STORAGE_KEYpynescript.axis.v1
MCPsrc/mcp/dispatch.ts reads/writes allowlisted store paths; snapshots redact secrets

Types: src/store/types.ts.

Conceptual model

Diagram

Rendering…

AppState map

FieldPersistenceNotes
barsnoSession history
symbol, interval, exchangeyesMarket context
source, engineyesFlat mirrors
endpointyesServer engine base URL
activePluginsyesCanonical four-tuple
pluginsConfigyesPer-plugin fields
scripts, panesyesIndicator list + layout
livepartialstreamId important
themeyesdark/light
editor, watchlist, panelsyesChrome geometry
stream.statusyes/volatileConnection hint
status, statusMessage, lastRunMsyes*UX; ok to restore
lastRunnoForced null on hydrate
logsnoForced empty
profilerEnabledyesEditor profiler (line % when engine provides profile)
inlineDebugEnabledyesEnd-of-line Debug chips from last-run logs
debugPinsEnabledyesChart pin markers + editor pin gutter
editorRulerEnabledyes80-col guide (default on)
editorWrapEnabledyesSoft line wrap (default on; stats strip wrap toggle)
panelChrome / alertsPanel / layerPanel / dataViewPanelyesDock chrome (side-by-side left/right)
pineTablesLocationyesPer-script Pine table placement (chart default / bottom Tables panel)
chartLayout / savedLayoutsyesMulti-chart grid + named layouts
compareprefs yesSecond-symbol overlay (bars ephemeral)
drawingToolreset cursorOn hydrate
drawings / drawingPrefs / drawingUiyesUser annotations + toolbar prefs
selectedDrawingIdnoEphemeral selection

*Status fields may restore but boot also appends fresh logs.

Defaults (product)

Representative defaults from store:

KeyDefault
symbolBTCUSDT
interval1d
source / active sourcebinance-rest
streambinance-ws
engineserver
storagelocal
endpointdemo/API host or localhost depending on build era
editor width460 docked open
watchlistmajors on Main, 15s refresh; named lists persist

Treat demo endpoints as overridable—operators should set local URLs in desk topology.

setActivePlugin

text
setActivePlugin(kind, id):
  activePlugins[kind] = id
  if source → source = id
  if engine → engine = id
  if stream → live.streamId = id
  persist()

Prevents registry/store split brain (architecture overview).

Logging

text
appendLog(level, message, source?)
levels: info | ok | warn | error
MAX_LOGS = 500

setStatus maps app status to log levels for important transitions.

Legacy path (removed)

The pre-Solid vanilla state.js shell was removed in 2.21.0 (see legacy shell). Product AXIS uses the Solid store only — there is no dual-write target anymore.

Invariants

  1. Hydrate never restores lastRun or logs.
  2. Persist strips bars.
  3. Key migration is read-repair (state namespaces).
  4. pluginsConfig keys prefer `${'{'}kind{'}'}:${'{'}id{'}'}`.
  5. Store is not a plugin registry—ids must exist in registry to function at runtime.

Failure modes

ModeBehavior
JSON parse failDefaults
localStorage throwsNo-op persist
Unknown plugin idUI may show id; run/load fails at getActive*
Oversized drawingsQuota risk—export/clear

Testing notes

  • Import tests/setup.ts for localStorage stubs
  • Unit coverage includes store + migration patterns
  • Do not require real IDB in pure store tests

See also