dsh-agent-rewind

中文文档
0.5.3发布于 2026/11/03MITES Module零依赖

Session ledger for DeepSeek Harness: named recovery points (checkpoint / rewind / list) over .dsh/memory/checkpoints.md, plus event-driven structural auto-checkpoint.

原始使用文档
文档目录6 节
  1. Why this exists
  2. Install
  3. Tools
  4. Design notes
  5. Retired upstream condition
  6. License

dsh-agent-rewind

Agent-driven session rewind for DeepSeek Harness (DSH): name a recovery point, then let the model fork the session back to it.

Why this exists

DSH has the primitive — ctx.sessions.fork(source, boundary) — but no model-visible way to call it. Every caller today is host or client code:

  • host Service ctx.sessions.fork
  • host Remote session.fork({ sessionId, atSeq? })
  • the Web GUI branch button

So an agent can ask you to branch a session, but it cannot branch one itself, and there is no durable index saying "this is the boundary I want to come back to". This package supplies exactly that, and nothing else.

Install

dsh plugin --profile <profile> add dsh-agent-rewind

Restart DSH afterwards, or install dsh-session-policy which depends on this package.

Tools

ToolParametersBehavior
agent_checkpointlabel!, note?, sessionId?Records a named recovery point: the target session's last completed turn boundary (turn/end seq, inclusive) is appended to <cwd>/.dsh/memory/checkpoints.md. When the file holds more current-format checkpoints than the configured limit (default 200), the oldest are pruned automatically.
agent_rewindsessionId!, label!Looks up the newest checkpoint for that label, verifies it belongs to the session, then forks a child session at that boundary and returns its id.
agent_checkpoint_list—Lists every parseable current-format checkpoint (label / session / seq / note).

No tool surface: on a root session, each closed turn appends an auto-turn line and a failed turn appends auto-error. This is recovery telemetry — a write failure only warns, and never fails turn shutdown.

A checkpoint is meaningful only across turns, so call agent_checkpoint at the start of the turn after the work you want to be able to return to.

Design notes

  • Named checkpoints are not the same thing as @deepseek-ai/dsh-session-checkpoint-policy. That package flushes the event log to durable storage before a model request or a side effect (crash durability). This one records human/agent-chosen named boundaries you can deliberately rewind to.
  • The cold path uses DSH's own buildForkSeed. When a boundary falls inside an open turn, the fork seed must be closed with synthetic events (session/end-seed + step/end + turn/end); slicing the raw prefix instead produces a structurally unclosed session. buildForkSeed is the first-party way to get that right, and it is imported from @deepseek-ai/dsh-session/fork — the same specifier the first-party dsh-api-session-controller uses.
  • Not the same thing as the third-party dsh-rewind package. That one is a human-typed /rewind slash command that restores workspace files from git snapshots. This one is a model-invoked tool that restores a session branch through DSH's native fork. Different mechanism, different caller, different thing restored — they complement each other.
  • The checkpoint line format is a compatibility contract: - [ISO] label | session=<sid> | seq=<n> [| note]. Pruning only ever removes lines that parse as current-format checkpoints; comments, blank lines, legacy lines and prose are preserved in place.

Retired upstream condition

If DSH ever ships a model-visible tool for sessions.fork, this package should be deleted outright rather than adapted. It exists only to open one deliberately-closed door.

License

MIT

版本与发布记录

dsh-agent-rewind 共发布 5 个版本,首次发布于 2026/10/13;过去 12 个月发布了 5 个版本。

版本发布日期距今
0.5.3latest2026/11/03今天
0.5.22026/10/2113 天前
0.5.12026/10/1321 天前
0.5.02026/10/1321 天前
0.0.0-stage2026/10/1321 天前

关于 dsh-agent-rewind 的常见问题

dsh-agent-rewind 是什么?

DeepSeek Harness的会话分类账:在。sh/memory/检查点上命名恢复点(checkpoint / rewind / list)。再加上事件驱动的结构自动检查点。

如何安装 dsh-agent-rewind?

在项目目录运行 npm install dsh-agent-rewind,或使用 pnpm add / yarn add / bun add。

dsh-agent-rewind 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/dsh-agent-rewind 是否存在。

dsh-agent-rewind 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

dsh-agent-rewind 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.15。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

dsh-agent-rewind 可以商用吗?

dsh-agent-rewind 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

dsh-agent-rewind 还在维护吗?

最新版本 0.5.3 发布于 2026/11/03(今天);至今共发布 5 个版本,其中过去 12 个月发布了 5 个;首次发布于 2026/10/13。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。