Bundle
dsh-resume-headless
Headless one-shot session resume for DeepSeek Harness: dsh --profile headless --resume <session-id> "task"
- Source
- EvieHe
- stars
- 1 stars
- License
- MIT
- Updated
- Updated 6 days ago
Readme
# dsh-resume-headless
给 DeepSeek Harness 官方 `headless` profile 加**一次性会话恢复**(one-shot resume)能力的 bundle:
```sh
dsh --profile headless --resume <session-id> "继续任务" # 恢复历史会话,跑完即退出
dsh --profile headless "新任务" # 无 --resume 时行为与官方 headless 完全一致
```
原理:`--resume` 时走核心 API `ctx.agents.resume({ resumeSessionId })`——从持久化
(默认 `$DSH_HOME/sessions`)加载会话、重建历史、**轮次编号接着上次**;否则退回官方
`agents.create()` 新建随机会话。恢复路径、输出契约(stdout 最后一条 assistant 文本、
completed → 0 / 其他 → 1)与官方 headless 一致;会话 id 打印到 stderr(`dsh-session: <id>`)
方便脚本续接。
## 安装
先安装 dsh CLI(`npm i -g @deepseek-ai/dsh`),然后任选一种:
```sh
# npm(推荐)
dsh plugin --profile headless add dsh-resume-headless
# git(源码构建,首次会因 pnpm ≥10 拦截 prepare 失败:
# 把提示的 allowBuilds 键加进 ~/.dsh/profiles/headless/pnpm-workspace.yaml 后重跑)
dsh plugin --profile headless add github:<you>/dsh-resume-headless#v0.1.0
# 本地 checkout
dsh plugin --profile headless add file:.
```
要求:Node `^22.19 || >=24`;只适用于叠加了 `@deepseek-ai/dsh-headless` 的 profile。
## 配置
模型与官方 headless 一样配置:`DEEPSEEK_API_KEY` 环境变量 / `$DSH_HOME/settings.yaml`
(`llm-deepseek.baseURL`)或 OpenAI 兼容网关(patch `llm-pi-ai` 行)。
## 使用
```sh
# 新建会话
dsh --profile headless "run the tests"
# 恢复并继续(会话 id 从上次运行的 stderr `dsh-session:` 行提取)
dsh --profile headless --resume session-xxxx "continue where you left off"
# 恢复不存在的会话 → 响亮失败(exit 1),不会静默新建
```
## 开发 / 发布
```sh
pnpm install
pnpm build # tsdown: src/ → lib/
pnpm typecheck
pnpm pack # 本地产物检查
pnpm publish # 发布到 npm(lib/ 已构建)
```
`lib/` 随仓库提交:git 安装直接使用提交的构建产物,**无需 prepare/allowBuilds 等任何构建权限**;
改动 `src/` 后记得先 `pnpm build` 再提交。发布后给仓库打上 GitHub
[`dsh-plugin`](https://github.com/topics/dsh-plugin) 话题便于被发现。
## 许可
MIT。
Install
dsh plugin --profile web add github:EvieHe/dsh-resume-headless
Profile: web
With the hub plugin installed, ask your agent to install it by name — it resolves the same plan shown here.
dsh plugin --profile web add github:stvlynn/dsh.fish#path:packages/dsh-plugin-hub
install dsh-resume-headless from the hub
- This package builds from source on install. pnpm will ask you to allow its build script — that is permission to run the package’s code on your machine, outside the agent sandbox. Only allow sources you trust.
- This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.