Skip to content

Stores (Pinia)

LLMxRay uses 24 Pinia stores, organized by the store-per-concern pattern. Each store manages a single domain of state.

Core Stores

token-store

File: src/stores/token-store.ts

Manages streaming tokens for each session.

StateTypeDescription
tokensBySessionMap<string, StreamToken[]>Tokens indexed by session ID

Key actions: pushToken, getTokens, getTokenCount, clearTokens, persistTokens, loadTokens

Performance

Uses shallowRef for the token map. With thousands of tokens per session, deep reactivity would be too expensive.

session-store

File: src/stores/session-store.ts

Manages session lifecycle (create, run, finalize, error).

StateTypeDescription
sessionsMap<string, Session>All sessions
activeSessionIdstring | nullCurrently selected session

Computed: activeSession, recentSessionsKey actions: createSession, updateSessionStatus, appendOutput, finalizeSession, setSessionError, cancelSession

conversation-store

File: src/stores/conversation-store.ts

Persisted chat conversations with IndexedDB backing.

StateTypeDescription
conversationsMap<string, Conversation>All conversations
hydratedbooleanWhether data has been loaded from IndexedDB

Computed: activeConversation, recentConversationsKey actions: hydrate, createConversation, addMessage, finalizeMessage, setActiveConversation, renameConversation, deleteConversation

metrics-store

File: src/stores/metrics-store.ts

Performance metrics per session and aggregate.

StateTypeDescription
metricsBySessionMap<string, SessionMetrics>Per-session metrics
aggregateAggregateMetricsCross-session averages
metricsHistorySessionMetrics[]Historical metrics

Key actions: recordMetrics, recalculateAggregate, getMetrics

Feature Stores

comparison-store

File: src/stores/comparison-store.ts

Manages comparison runs with multiple execution slots.

StateTypeDescription
runsMap<string, ComparisonRun>All comparison runs
activeRunIdstring | nullCurrent run

Key actions: createRun, updateExecution, finalizeRun, getExecution

benchmark-store

File: src/stores/benchmark-store.ts

Benchmark execution state and persisted results.

StateTypeDescription
runStateBenchmarkRunStateCurrent execution state
savedResultsBenchmarkResult[]Persisted results from IndexedDB
customSuitesBenchmarkSuite[]User-imported suites

Computed: activeResults, isRunningKey actions: startRun, resumeRun, cancelRun, deleteResult, importCustomSuite, deleteCustomSuite

embedding-store

File: src/stores/embedding-store.ts

Embedding generation and comparison results.

StateTypeDescription
resultsEmbeddingResult[]Generated embeddings
loadingbooleanLoading state

Computed: recentResultsKey actions: embed, cosineSimilarity, comparePair, clearResults, removeResult

rag-store

File: src/stores/rag-store.ts

RAG document management and search.

StateTypeDescription
documentsRagDocument[]Uploaded documents
searchResultsRagSearchResult[]Latest search results
enabledDocumentIdsSet<string>Active documents for search

Computed: readyDocuments, enabledDocumentsKey actions: loadDocuments, addDocument, removeDocument, toggleDocument, search, getContextForQuery

training-store

File: src/stores/training-store.ts

AI training data curation.

StateTypeDescription
pairsAiTrainingPair[]All training pairs
filtersTrainingFiltersActive filter state
selectedIdsSet<string>Selected pairs for bulk ops

Computed: filteredPairs, statsKey actions: loadPairs, updateResponse, toggleAccepted, deletePairs, bulkSetAccepted, bulkAddTag, exportSelected

canvas-ai-store

File: src/stores/canvas-ai-store.ts

Canvas AI assistant state (drafts, insights, suggestions).

StateTypeDescription
draftsMap<string, AiDraft>AI-generated tool drafts
insightsAiInsightsResult | nullLatest improvement suggestions
canvasAiModelstringSelected AI model

Key actions: setDraft, clearDraft, setInsights, clearInsights, setIntent, startRequest, cancelRequest

Infrastructure Stores

model-store

File: src/stores/model-store.ts

Ollama model management and capability detection.

StateTypeDescription
modelsOllamaModel[]Installed models
modelInfoCacheMap<string, ModelInfo>Cached model details

Computed: modelNames, chatModelNames, embeddingModelNamesKey actions: fetchModels, fetchModelInfo, deleteModel, isThinkingModel, isVisionModel, supportsTools

reasoning-store

File: src/stores/reasoning-store.ts

Reasoning chain state for thinking models.

Key actions: addStep, getChain, getSteps, clearChain, setThinking, getThinking

toolcall-store

File: src/stores/toolcall-store.ts

Tool call tracking per session.

Key actions: addToolCall, updateToolCall, getToolCalls, getPendingCalls

tool-workshop-store / tool-definition-store

Files: src/stores/tool-workshop-store.ts, src/stores/tool-definition-store.ts

Tool canvas state and tool schema persistence.

agent-store

File: src/stores/agent-store.ts

Agent graph state per session.

Key actions: initGraph, addNode, addEdge, getGraph

prompt-store

File: src/stores/prompt-store.ts

Prompt anatomy analysis per session.

introspection-store

File: src/stores/introspection-store.ts

Model architecture and attention pattern data.

UI Stores

theme-store

File: src/stores/theme-store.ts

Dark/light/system theme management.

Key actions: setMode, applyTheme

storage-store

File: src/stores/storage-store.ts

IndexedDB storage usage tracking.

Key actions: refresh, refreshIfStale, getDatabaseById

memory-store

File: src/stores/memory-store.ts

Conversation memory and facts.

google-auth-store

File: src/stores/google-auth-store.ts

Google OAuth2 state management.

Key actions: updateClientId, connect, handleOAuthCallback, disconnect, getToken

Released under the Apache 2.0 License.