Skip to content

Backend API

Your backend module runs in an isolated Bun worker thread. The spindle global is automatically available — no imports needed.

For TypeScript support, add this at the top of your backend file:

declare const spindle: import('lumiverse-spindle-types').SpindleAPI

API Surface

Category Permission Description
Events Free Subscribe to Lumiverse lifecycle events
Macros Free Register custom {{macros}} for prompts
Interceptors interceptor Modify the prompt before it reaches the LLM
Context Handlers context_handler Enrich the generation context before assembly
Macro Interceptor macro_interceptor Transform raw templates before macro parsing/dispatch
World Info Interceptor generation Disable world info entries or override their content before activation
Message Content Processor chat_mutation Transform message content before it is written to the database
LLM Tools tools Register function-calling tools + Council-eligible tools
Generation generation Fire LLM generations + inspect connections
Image Generation image_gen Generate images via image gen connection profiles
Images images Read, upload, filter, and delete stored images
Theme app_manipulation Apply CSS variable overrides on top of the user's theme
Storage Free Scoped file storage (extension + per-user)
Shared RPC Pool Free Cross-extension latest-state and on-demand reads across the worker isolation boundary
Ephemeral Storage ephemeral_storage Temporary storage with TTL and quotas
Variables Free Local (chat-scoped) and global variable access
Tokens Free Count text, message arrays, or stored chats against an explicit model or the main/sidecar model
Characters characters CRUD on character cards
Chats chats CRUD on chat sessions + active chat
World Books world_books CRUD on world books and entries
Regex Scripts regex_scripts CRUD on regex scripts (find/replace rules)
Databanks databanks CRUD on databanks and their documents
Personas personas CRUD on personas + active switching + attached world books
Council Free Read the active council members and configuration
Chat Mutation chat_mutation Read and modify chat messages
Event Tracking event_tracking Structured telemetry and analytics
Secure Enclave Free Encrypted secret storage
CORS Proxy cors_proxy Server-side HTTP requests
OAuth oauth OAuth callback handler registration
Logging Free Server console logging
Toast Notifications Free Show success/warning/error/info toasts in the frontend
Text Editor Free Open the full-screen text editor modal with macro highlighting
Modal Free Open a system-themed modal overlay with structured content
Input Prompt Free Present a text input modal and await the user's response
Push Notifications push_notification Send OS-level push notifications to user devices
Frontend Communication Free Message passing to/from frontend
Frontend Process Lifecycle Free Spawn and supervise long-lived frontend-side controllers
Backend Process Lifecycle Free Spawn and supervise isolated backend subprocesses
Commands Free Register custom commands in the command palette (Cmd/Ctrl+K)
Version Free Read the backend and frontend semantic versions