sandersyao/dsh-session-persistence-mysql ↗★ 0
@sandersyao/dsh-session-persistence-mysql
MySQL durable session persistence backend for the DeepSeek Harness
安装
此插件尚未提供可验证的 bundle,或兼容性检查未通过。请先阅读仓库说明。 阅读完整 README ↗
说明文档
阅读完整 README ↗Install & usage
import { MysqlSessionPersistence } from '@sandersyao/dsh-session-persistence-mysql'
await ctx.plugin(MysqlSessionPersistence, {
connection: { tablePrefix: process.env.MYSQL_TABLE_PREFIX },
})
// ctx.sessionPersistence is now MySQL-backed.
Configuration
Credentials, table prefix and pool tuning come from environment variables / a .env file (see .env.example). The plugin Config is fully optional — environment is the source of truth for credentials (never hard-code a password).
| Env | Default | Purpose |
|---|---|---|
MYSQL_HOST / MYSQL_PORT | 127.0.0.1 / 3306 | Write (primary) host. |
MYSQL_USER / MYSQL_PASSWORD | — (required) | Least-privilege DB user. |
MYSQL_DATABASE | — (required) | Target database. |
MYSQL_TABLE_PREFIX | — (required) | Table prefix; validated against ^[A-Za-z0-9_]+$. |
MYSQL_READ_HOST / MYSQL_READ_USER / MYSQL_READ_PASSWORD | (empty) | Read replica for read/write split; empty reuses the write connection (same-store mode). |
MYSQL_SSL_REQUIRED | false | Reserved for TLS enforcement (deferred; may be provided by a cloud provider). |
MYSQL_POOL_SIZE / MYSQL_POOL_QUEUE_LIMIT | 10 / 0 | Pool sizing. |
MYSQL_WRITE_BATCH_DELAY_MS | 200 | Batching window passed to the coordinator. |
MYSQL_PREPARED_CACHE_SIZE | 5 | Unpublished-session LRU size. |
MYSQL_PACK_CHUNKS | true | Fold assistant/chunk runs into packed rows. |
MYSQL_SCHEMA_AUTO_MIGRATE | true | Auto-migrate schema on startup; false only validates. |
ENCRYPTION_KEY | (empty) | Reserved for application-level field encryption (deferred; empty = plaintext). |
Test isolation. Automated tests (
vitest) run against a separate database to avoid touching the production one:MYSQL_TEST_DATABASE(defaulttest) overridesMYSQL_DATABASEduring tests, andMYSQL_ROOT_PASSWORDis used only by the test harness to create/grant the test DB. Seedocs/MANUAL_TEST_PLAN.md.