sandersyao/dsh-session-persistence-mysql0

@sandersyao/dsh-session-persistence-mysql

MySQL durable session persistence backend for the DeepSeek Harness

包名
@sandersyao/dsh-session-persistence-mysql
版本
0.1.1-rc.2
许可证
MIT
最近更新
2026年9月1日

安装

此插件尚未提供可验证的 bundle,或兼容性检查未通过。请先阅读仓库说明。 阅读完整 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).

EnvDefaultPurpose
MYSQL_HOST / MYSQL_PORT127.0.0.1 / 3306Write (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_REQUIREDfalseReserved for TLS enforcement (deferred; may be provided by a cloud provider).
MYSQL_POOL_SIZE / MYSQL_POOL_QUEUE_LIMIT10 / 0Pool sizing.
MYSQL_WRITE_BATCH_DELAY_MS200Batching window passed to the coordinator.
MYSQL_PREPARED_CACHE_SIZE5Unpublished-session LRU size.
MYSQL_PACK_CHUNKStrueFold assistant/chunk runs into packed rows.
MYSQL_SCHEMA_AUTO_MIGRATEtrueAuto-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 (default test) overrides MYSQL_DATABASE during tests, and MYSQL_ROOT_PASSWORD is used only by the test harness to create/grant the test DB. See docs/MANUAL_TEST_PLAN.md.