Skip to content

Extension API Reference

This is the complete reference for the Luker Extension API, intended for plugin developers. All APIs are exposed through Luker.getContext(). The reference is split into the following pages:

PageWhat's covered
Chat & StateChat data, the unified Messages API, chat persistence, Chat State, Floor State, Character State, chat lifecycle, swipe API, extension prompts, media helpers
CharactersCharacter cards, V2/legacy Proxy semantics, tags, import / export, per-character sidecar state
World InfoLorebook CRUD, activation scanning, character auxiliary world books
Presets & Promptscontext.presets.*, buildPresetAwarePromptMessages, resolveWorldInfoForMessages, envelope inspection, reasoning helpers, settings views
GenerationgenerateTask, tool registration, generateRaw / generateQuietPrompt, service classes, connection profiles
Slash CommandsRegistering and executing slash commands, named/unnamed arguments, enums
Macros & VariablesMacro registration, built-in macro reference, substituteParams, local & global variables
UI & PopupsPopups, loaders, templates, message formatting
IterationStudioShared popup framework for AI-driven iterative editing — conversation, sessions, diff preview, approve/reject lifecycle. Adapters supply the artifact shape + tools
Plugin IntegrationRegex runtime, search tools, extension API registry, event system, i18n, settings storage, debug & scraper registration, tokenization, utilities, symbols & constants
Low-Level EndpointsRaw HTTP routes (advanced / debugging only)

Global Entry Point

js
const context = Luker.getContext();
AliasDescription
Luker.getContext()Recommended
SillyTavern.getContext()Compatibility alias
st.getContext()Compatibility alias

New plugins should use Luker.getContext() exclusively. Compatibility aliases are retained only for the migration period.

Namespace Quick Reference

For quickly finding where an API lives, the context object groups related APIs into namespaces:

NamespaceContents
context.presetslist, getSelected, getLive, getStored, save, resolve, readExtensions, writeExtensions, state.*
context.connectionProfileslist, resolve (deprecated for direct use)
context.variables.localget, set, add, inc, dec, del, has
context.variables.globalget, set, add, inc, dec, del, has
context.swipeleft, right, to, show, hide, refresh, isAllowed, state
context.symbolsignore (the IGNORE_SYMBOL sentinel)
context.constantsunset (the UNSET_VALUE sentinel)
context.macrosregister, registerAlias, registry, engine, category, envBuilder
context.loadershow, hide, active, get, isBlocking, ToastMode, Handle

API Differences from SillyTavern

Luker is built on SillyTavern but has the following major API-level differences:

AreaSillyTavernLuker
Chat persistenceFull-file overwritePatch-first (RFC 6902 incremental updates)
Chat-bound statechat_metadata onlyNew Chat State mechanism + Floor State
Per-character sidecar stateNonegetCharacterState / setCharacterState (separate from card JSON)
Preset managementDirect import of internal modulesUnified context.presets.* API
Prompt assemblyManual concatenation requiredbuildPresetAwarePromptMessages()
World Info simulationNonesimulateWorldInfoActivation()
Character auxiliary world booksNonegetCharaAuxWorlds()
Generation hooksBasic eventsNew fine-grained hooks such as GENERATION_CONTEXT_READY, GENERATION_BEFORE_WORLD_INFO_SCAN, etc.
Event orderingRegistration orderSupports priority, pluginOrder, makeFirst/makeLast
Regex runtimeNo plugin APIregisterManagedRegexProvider()
Search toolsNo plugin APILuker.searchTools global API
Function callingBasic ToolManagerPlain-text mode support + connection-level toggle + sendOpenAIRequest preset override
Connection configSingle global configcontext.presets.resolve() supports per-preset connection resolution
Macro engineString substitutionStructured macros.register() with handler context, args, categories
Character objectPlain V1/V2 fieldsProxy with V2 canonicalization and legacy-write deprecation warnings

IMPORTANT

Prefer the APIs provided by Luker.getContext() over calling the underlying HTTP endpoints directly. The Context API encapsulates patch-first semantics, conflict handling, and retry logic; calling endpoints directly requires you to handle these details yourself.

Built upon SillyTavern