Back to marketplace

better-session

Agent & Workflow

morlay/better-session

Branch-based session editing for DeepSeek Harness, enabling in-place editing, retry, and forking of conversations without modifying upstream code.

  • dsh-plugin
  • session
  • session-branch
  • session-persistence
GitHub Stars
6GitHub
Views
0DSH Plugin Hub
Forks
1GitHub
Open issues
1GitHub Issues
Manifest version
0.0.11@morlay/better-session
Latest push
Sep 1, 2026GitHub
License
MITTypeScript
Plugin type
HostRuns in the DSH Host

Verification and compatibility

This section shows evidence collected by the catalog. Undeclared information is labeled as unknown.

Runtime verified
01Exact source: npm · @morlay/better-session@0.0.1102Validated: Sep 2, 202603Verified Harness: 0.1.0-rc.7
Current-version compatibility
Verified on the catalog Harness version
Declared Harness range
Not declared
Declared platforms
Not declared
Profiles
web
Build approval
No requirement detected
Permissions
Not declared
External services
Not declared
Telemetry
Unknown
No known risk flags found

This is not a security endorsement. Review source, permissions, and configuration before installing.

View evidence and scope

Verification covers only the named source, version, and Harness environment. It does not guarantee future compatibility.

  • @morlay/better-session@0.0.11
  • The plugin completed a load check in an isolated environment.

README

View source

better-session

DeepSeek Harness 的分支式会话编辑 monorepo:在不修改上游 @deepseek-ai/* 代码的前提下,为会话提供 就地编辑 / 重试 / 分支 (rewind / retry / fork)闭环——GUI 里直接编辑用户消息、重试任意回合, 重写同一会话(session id 不变),只有分支才派生新 id。

快速开始

1. 安装(发布后)

一个 bundle 包装齐全部依赖组件:

dsh plugin --profile web add "@morlay/better-session"

安装 @morlay/better-session 会自动带上子包(@morlay/session-branch@morlay/session-rdb@morlay/ui-conversation-message-actions),并由 bundle 的 patch 自动装配:

  • ctx.sessionPersistence ← RDB(SQLite / PostgreSQL)持久化后端
  • ctx.sessionBranch ← rewind / fork 数据层
  • ctx.sessionEditor ← edit / retry / fork 编排(HTTP:/session-editor
  • conversation.chat.node ← 渲染替换(user 消息行内编辑 / 重试按钮)

2. 使用

装配后即可在 GUI 会话中:

  • 编辑 user 消息 → 就地重写并重放(重新生成回复)
  • 重试 任意闭合回合 → 就地重放该回合输入(带确认弹窗)
  • 分支(fork)→ 从任意闭合边界派生新会话

也可以直接调用服务:

// 编排层(host)
await ctx.sessionEditor.retry({ action: "retry", sessionId, turn: 2, cascade: "truncate" });
// 数据层
await ctx.sessionBranch.rewind(sessionId, 5);
await ctx.sessionBranch.forkFrom(sourceId, { atSeq: 6, childSessionId });

3. 配置(rdb)

$DSH_HOME/settings.yaml

session-rdb:
  type: sqlite # 或 postgres + connectionString
  path: /abs/path/to/sessions.sqlite

本地开发(monorepo)

just dep      # 安装依赖
just build    # 构建全部包(tsdown)
just test     # vitest(含 PostgreSQL 契约测试,需 TEST_PG_URL)
just lint     # oxlint
just dev      # build + setup-dsh + 启动 web(dsh --profile web,DSH_HOME=.dsh-store)

包一览

职责文档
@morlay/session-branch契约层:SessionBranchProvider 抽象 + SessionBranch 服务 + 版本树投影README
@morlay/session-rdb实现层:RDB 持久化(PersistenceBackend)+ 分支 provider(SessionBranchProvider)双服务README
@morlay/ui-conversation-message-actions编排层 + UI:edit / retry / fork 编排 + conversation.chat.node 渲染替换README
@morlay/better-sessionprofile 聚合 bundle:装配以上全部 + 官方 web-app本文件

设计要点

  • 不改上游代码:全部在插件层实现。
  • 就地编辑:edit / retry / reroll 用 rewind 截断 + append 重写同一 会话(session id 不变、版本树单根);只有 fork 创建新 id。
  • rewind 支持 live 会话:GUI 打开中的会话也能就地编辑(截断 RDB 与 内存 log、同步 coordinator cursor、重置 agent 轮次游标)。
  • ignorable 版本效果:分支版本事件不进 canonical log,非 branch 读者 安全跳过。

Comments

0
Newest first