Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Environment:AI QL Tuui Pinia

From Leeroopedia
Knowledge Sources
Domains Vue, State_Management, Frontend
Last Updated 2026-10-24 20:38 GMT

Overview

Vue 3 state management environment using Pinia stores with a state persistence plugin for maintaining application state across sessions via localforage.

Description

tuui uses Pinia (>= 3.0.4) as its state management solution with pinia-plugin-state-persistence (>= 1.11.0) for automatic state persistence. Stores manage MCP server registry, chat messages, agent configuration, MCPB user config values, chat history (via localforage), UI layout state, locale, and snackbar notifications. The persistence plugin ensures state survives page reloads and app restarts.

Usage

Use this environment for any implementation that defines or consumes Pinia stores in src/renderer/store/. All renderer-side state management requires Pinia.

System Requirements

Category Requirement Notes
Runtime Chromium (bundled with Electron) Renderer process only
Storage Browser IndexedDB / localStorage Used by persistence plugin and localforage

Dependencies

NPM Packages

  • `pinia` >= 3.0.4
  • `pinia-plugin-state-persistence` >= 1.11.0
  • `localforage` >= 1.10.0 (for chat history store)
  • `vue` >= 3.5.34 (peer dependency)

Store Files

  • `src/renderer/store/mcp.ts` — MCP servers registry (349 lines)
  • `src/renderer/store/message.ts` — Chat message and tool loop (223 lines)
  • `src/renderer/store/agent.ts` — Agent config and tool selection (135 lines)
  • `src/renderer/store/dxt.ts` — MCPB user config values (38 lines)
  • `src/renderer/store/chatbot.ts` — LLM chatbot provider configs (122 lines)
  • `src/renderer/store/history.ts` — Chat history via localforage (91 lines)
  • `src/renderer/store/prompt.ts` — MCP prompts store (123 lines)
  • `src/renderer/store/resource.ts` — MCP resources store (128 lines)
  • `src/renderer/store/snackbar.ts` — Global snackbar notifications (51 lines)
  • `src/renderer/store/stdio.ts` — User stdio server configs (40 lines)
  • `src/renderer/store/layout.ts` — Layout UI state (28 lines)
  • `src/renderer/store/locale.ts` — UI locale/language (47 lines)

Credentials

No credentials required for Pinia itself. The chatbotStore holds LLM API keys from the config file, persisted via the persistence plugin.

Quick Install

npm install pinia@^3.0.4 pinia-plugin-state-persistence@^1.11.0 localforage@^1.10.0

Code Evidence

Pinia store definition pattern from `src/renderer/store/mcp.ts` (example):

import { defineStore } from 'pinia'
export const useMcpStore = defineStore('mcp', () => {
  // Composition API store
})

Vue app bootstrap with Pinia from `src/renderer/main.ts`:

import { createApp } from 'vue'
import { createPinia } from 'pinia'
// Pinia installed before app mount

Common Errors

Error Message Cause Solution
`getActivePinia was called with no active Pinia` Store called outside component setup Ensure Pinia is installed and app is mounted
State not persisting Persistence plugin not registered Verify pinia-plugin-state-persistence is installed in plugin chain

Compatibility Notes

  • Composition API stores: All stores use the setup/composition syntax (defineStore('name', () => {...})), not the options API.
  • Persistence: State is persisted automatically; chat history uses localforage (IndexedDB) separately.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment