xing01l/session-import-codex ↗★ 0
dsh-session-import-codex
DeepSeek Harness plugin for importing Codex App Server conversation history
安装
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:xing01l/session-import-codex说明文档
阅读完整 README ↗dsh-session-import-codex
English | 中文
这是一个独立于 DeepSeek Harness 源码树的插件和 PowerShell CLI,用于导入 Codex 对话历史。它通过官方 Codex App Server 稳定历史接口读取对话,把已结束的 turn 转换为经过验证的 Harness session event,通过目标 profile 的公开服务持久化,并按照历史工作目录创建或复用工作区。
首选用法是一次性 CLI。/import-codex 聊天命令继续保留,用于开发调试和按 thread id 导入。
CLI 会导入什么
thread/list在archived: false条件下返回的全部未归档交互式 Codex 对话;- 当前转换器能够表示的 completed、interrupted 和 failed turn;
- 默认只导入 reasoning summary,绝不导入原始 reasoning 内容;
- 目标 session 使用
codex-形式的确定性 id。
仍处于 active 状态的对话会跳过。已存在的目标 id 是幂等空操作。单条源数据异常只会记录失败,不会中止后续批次。
导入器不会读取 Codex rollout 文件、桌面应用状态、SQLite 数据库或私有 JSONL 文件,也不会直接写 Harness 的持久化文件。
从 npm 安装
要求:
- Node.js
^22.19或>=24; - pnpm 10;
- 当前
PATH中存在可用的codex命令; - 已安装的 DeepSeek Harness CLI,或者可从源码目录运行的 Harness CLI。
通过 Harness 安装 npm 包,这会同时更新目标 profile 的依赖与 bundle layer:
dsh plugin --profile web add dsh-session-import-codex
从 Harness 源码目录运行时:
$harnessPath = Read-Host 'Path to your DeepSeek Harness checkout'
Set-Location $harnessPath
pnpm dsh plugin --profile web add dsh-session-import-codex
用户不需要克隆插件源码,也不需要在安装时执行构建;npm tarball 已包含编译好的 lib/ 文件。
从源码开发
克隆并构建插件。锁文件会从公共 npm registry 解析开发依赖,Harness 源码目录不必与插件目录相邻。
git clone git@github.com:xing01l/session-import-codex.git
Set-Location session-import-codex
pnpm install --frozen-lockfile
pnpm build
$pluginPath = (Get-Location).Path
Set-Location $harnessPath
pnpm dsh plugin --profile web add $pluginPath
推荐的 PowerShell 迁移流程
profile 存储目前没有公开的 profile 级写入锁,因此受支持的写入流程是离线迁移:
- 用
Ctrl+C停止目标dsh --profile web进程。 - 先执行 dry run。
- 再执行真实迁移。
- 重启 Web profile。
通过 profile 中从 npm 安装的 bin 验证全部符合条件的对话,不进行写入:
pnpm --dir "$env:USERPROFILE\.dsh\profiles\web" exec dsh-import-codex --profile web --dry-run