[Store]

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

Store

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

Types: frontend/src/store/types.ts.

Conceptual model

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
drawingToolreset cursorOn hydrate
drawingsyesUser annotations

*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, 15s refresh

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

setActivePlugin

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

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

setStatus maps app status to log levels for important transitions.

Legacy dual path

Vanilla state.js remains for legacy shell with the same storage key family. Product AXIS uses Solid store only—do not dual-write new features to state.js unless maintaining legacy.

Invariants

  1. Hydrate never restores lastRun or logs.
  2. Persist strips bars.
  3. Migration from SuperChart keys 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