Registry / storage / koishi-plugin-chatluna-storage-service

koishi-plugin-chatluna-storage-service

JSON →
library1.0.7jsnpmunverified

Storage service plugin for ChatLuna, providing persistent storage for conversation history and presets. Current stable version is 1.0.7, release cadence irregular. Integrates with the Koishi bot framework (peer dependency ^4.18.9) and the ChatLuna ecosystem. Unlike generic storage solutions, it is purpose-built for chatbot conversation contexts, supporting preset actions and seamless integration with ChatLuna's plugin architecture. Requires Node.js >=18.0.0 and ships TypeScript types.

npm install koishi-plugin-chatluna-storage-service
INSTALL
IMPORT
SIG · KOISHI-PLUGIN-CHAT
K
koishi-plugin-chatluna-storage-service
storagejavascriptv1.0.7
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

StorageService
import { StorageService } from 'koishi-plugin-chatluna-storage-service'
const StorageService = require('koishi-plugin-chatluna-storage-service')
ESM-only; CommonJS require will fail. Use dynamic import() if needed in CJS.
default (plugin)
app.plugin(require('koishi-plugin-chatluna-storage-service'))
app.use(require('koishi-plugin-chatluna-storage-service').default)
Koishi plugins are installed via app.plugin(). The plugin is the default export.
Config
import type { Config } from 'koishi-plugin-chatluna-storage-service'
import { Config } from 'koishi-plugin-chatluna-storage-service'
Config is a TypeScript type, not a runtime value. Use 'import type' to avoid side effects.

Shows how to install and configure the ChatLuna Storage Service plugin in a Koishi bot.

import { Context } from 'koishi' import ChatLunaStorageService from 'koishi-plugin-chatluna-storage-service' export function apply(ctx: Context) { ctx.plugin(ChatLunaStorageService, { // configuration options }) } // Or using koishi.conf // plugins: // 'koishi-plugin-chatluna-storage-service': {}
Debug
Known issues
breakingVersion 1.0.0 changed the storage API, making existing persisted data incompatible. Migrate using provided script.
fix
Run `npx chatluna-storage-migrate` before upgrading.
affects: <1.0.0
deprecatedThe `presetActions` option is deprecated in v1.0.5 and will be removed in v2.0. Use the new `actions` config instead.
fix
Replace `presetActions` with `actions` in plugin config.
affects: >=1.0.5 <2.0.0
gotchaThe plugin requires the ChatLuna core plugin to be loaded first. Order of plugin installation matters.
fix
Ensure `chatluna` plugin is loaded before `koishi-plugin-chatluna-storage-service` in your Koishi configuration.
affects: >=1.0.0
gotchaUsing dynamic import() inside a Koishi plugin can cause race conditions with storage initialization.
fix
Import statically at the top of the file or use Koishi's `ctx.plugin()` with the module directly.
affects: >=1.0.0
deprecatedSupport for Node.js versions below 18 is dropped in v1.0.0.
fix
Upgrade Node.js to 18.0.0 or later.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'koishi-plugin-chatluna-storage-service'
Package not installed or installed as dev dependency instead of regular dependency.
fix
Run `npm install koishi-plugin-chatluna-storage-service --save`
TypeError: ctx.plugin is not a function
Attempting to use the plugin outside of a Koishi plugin context.
fix
Ensure the code is inside a Koishi plugin definition, e.g., `export function apply(ctx: Context) { ... }`
Cannot find name 'StorageService'
Missing TypeScript type import or incorrect import path.
fix
Use `import { StorageService } from 'koishi-plugin-chatluna-storage-service';`
Module '"koishi-plugin-chatluna-storage-service"' has no default export
Using CommonJS `require()` or outdated TypeScript import syntax.
fix
Use ES Module import syntax, e.g., `import ChatLunaStorageService from 'koishi-plugin-chatluna-storage-service'`
Upgrade
Version history
1.0.7latest on npm
Audit
Dependencies
koishirequiredpeer dependency — Koishi framework required to use plugin
Agent activity
12 hits · last 30 days
node
10
OpenAI (training)
1
Resources
koishi-plugin-chatluna-storage-service — npm install koishi-plugin-chatluna-storage-service · libregistry