morlay/better-session--packages-session-rdb ↗★ 0
@morlay/session-rdb
DeepSeek Harness 的关系型数据库持久化会话后端:实现会话持久化与分支服务提供商
AI 分析
核心用途是使用 SQLite 或 PostgreSQL 替代默认的 JSONL 存储,提供更可靠的会话持久化和分支读写。适合需要企业级数据库存储 DSH 会话历史的用户。
安装
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:morlay/better-session#8ec5bcec558e8e419ae563d81367c7fb6637bbf3&path:packages/session-rdb说明文档
阅读完整 README ↗配置
配置写在 ${DSH_HOME}/settings.yaml,settings namespace 为插件短名
session-rdb(与 cordis 插件 name 一致):
session-rdb:
type: sqlite
# path 省略时回落 cordis.patch.yml 的默认($DSH_HOME/sessions/sessions.sqlite,
# 由 bundle patch 的 !!js 表达式求值);自定义路径请用绝对路径字符串。
path: /absolute/path/to/sessions.sqlite
journalMode: wal
busyTimeout: 5000
settings.yaml 是纯 YAML(settings-local 用
yaml库解析),不支持!!jsJS 表达式——!!js dshHomePath(...)会被当作字面字符串。!!js只在cordis.patch.yml(bundle patch 层,loader 求值)有效。
字段即 Config 判别联合(见下);未写出的字段回落到 bundle patch / cordis.yml 的 config 默认值。PostgreSQL:
session-rdb:
type: postgres
connectionString: postgres://user:pass@localhost:5432/sessions
Config 类型:
type Config =
| {
type: "sqlite";
/** SQLite 数据库文件路径;`:memory:` 用于测试。 */
path: string;
/** journal_mode:`wal`(默认)/ `delete` / `truncate` / `persist`。 */
journalMode?: "wal" | "delete" | "truncate" | "persist";
/** 写锁竞争等待毫秒数(默认 5000)。 */
busyTimeout?: number;
}
| {
type: "postgres";
/** node-postgres 连接串;首次打开自动建表并写入 store 身份。 */
connectionString: string;
};