
morlay/session-persistence-rdb
40Last commit Aug 14, 2026
session-persistence-rdb DSH plugin
@morlay/session-persistence-rdb provides a persistent session backend for DSH (ctx.sessionPersistence). It implements PersistenceBackend<number> using Drizzle ORM, and supports both SQLite and PostgreSQL databases. The plugin is designed to be used with DSH profiles and requires configuration via settings.yaml.
How to install the session-persistence-rdb DSH plugin
dsh plugin --profile=web add "@morlay/session-persistence-rdb@^0.0.1" --config.@morlay:registry=https://npm.pkg.github.com/Copying does not run this command. Review the repository and version before installing the session-persistence-rdb DSH plugin.
session-persistence-rdb DSH plugin data source
session-persistence-rdb DSH plugin snapshot date: Aug 16, 2026
discovered
What the session-persistence-rdb DSH plugin can do
- Implements PersistenceBackend<number> with Drizzle ORM
- Supports SQLite and PostgreSQL backends
- Configurable via DSH settings.yaml
- Integrates with PersistenceCoordinator and contract test suite
- Published on GitHub Packages
Where the session-persistence-rdb DSH plugin fits
- Persist DSH session data across restarts
- Use SQLite for local development or single-user setups
- Use PostgreSQL for multi-user or production deployments
- Easily switch between database types via configuration
- Leverage existing PersistenceCoordinator for session management
Who the session-persistence-rdb DSH plugin is for
- DSH plugin developers who need session persistence
- Operators deploying DSH with stateful sessions
session-persistence-rdb DSH plugin limitations
- Requires DSH profile with GitHub Packages registry and auth token
- Only supports SQLite and PostgreSQL; no MySQL or other databases
- Configuration must be done in settings.yaml under specific namespace
- settings.yaml does not support !!js expressions (only cordis.patch.yml does)
session-persistence-rdb DSH plugin: from the repository README
Quoted from the morlay/session-persistence-rdb README, the upstream source of the session-persistence-rdb DSH plugin. Copyright remains with the original authors.
RDB(SQLite / PostgreSQL)持久会话后端(`ctx.sessionPersistence`):通过 drizzle 实现 `PersistenceBackend<number>`,复用上游 `PersistenceCoordinator` 与契约测试套件, 支持配置选择 SQLite 或 PostgreSQL 后端。设计细节(表结构、delta 过滤、并发写、 方言差异、仓库结构)见 [docs/design.md](docs/design.md)。 ## 安装 包发布在 GitHub Packages,按包名安装到 dsh profile(示例:web;`dsh plugin add` 把参数原样转发给 pnpm,版本号按发布版本调整)。registry 必须限定在 `@morlay` scope(`--config.@morlay:registry=…`),不要用全局 `--registry`, 否则依赖(`@deepseek-ai/*` 等)也会被指到 GitHub Packages 而解析失败: ```sh dsh plugin --profile=web add "@morlay/session-persistence-rdb@^0.0.1" --config.@morlay:registry=https://npm.pkg.github.com/ ``` GitHub Packages 的 registry 要求认证(公开包也一样):profile 的 `.npmrc` 需为 `npm.pkg.github.com` 配置访问 token(如 `//npm.pkg.github.com/:_authToken=<token>`),详见 [GitHub 文档](https://docs.github.com/packages/working-with-a-github-packages-registry/working-with-the-npm-registry)。 ## 配置 配置写在 `${DSH_HOME}/settings.yaml`,settings namespace 为插件短名 `session-persistence-rdb`(与 cordis 插件 `name` 一致): ```yaml session-persistence-rdb: type: sqlite # path 省略时回落 cordis.patch.yml 的默认($DSH_HOME/sessions/sessions.sqlite, # 由 bundle patch 的 !!js 表达式求值);自定义路径请用绝对路径字符串。 path: /absolute/path/to/sessions.sqlite jou
Read the full READMERepository license: MIT
session-persistence-rdb DSH plugin questions
How do I install session-persistence-rdb plugin?
Run `dsh plugin --profile=web add "@morlay/session-persistence-rdb@^0.0.1" --config.@morlay:registry=https://npm.pkg.github.com/`. Make sure your profile's .npmrc has an auth token for npm.pkg.github.com. See GitHub documentation for setup.
How do I configure the database type?
In your DSH settings.yaml, add a session-persistence-rdb namespace with type: sqlite or type: postgres. For SQLite, you can optionally specify path, journalMode, and busyTimeout. For PostgreSQL, provide a connectionString.
Can I use MySQL or other databases?
No, this plugin only supports SQLite and PostgreSQL. The implementation uses Drizzle ORM which could theoretically support others, but the plugin currently only includes these two backends.
Why do I need a GitHub token to install this plugin?
The package is published on GitHub Packages, which requires authentication even for public packages. You need to configure an auth token in your profile's .npmrc for the registry https://npm.pkg.github.com/.
How do I switch from SQLite to PostgreSQL?
Change the type field in settings.yaml under session-persistence-rdb to postgres and provide a connectionString. The plugin will automatically create tables on first open.