yangyongzhen/dsh-session-export

将DeepSeek Harness会话导出为Markdown格式,用于审阅、博客撰写和审计。dsh插件。

Project Overview项目介绍

This is a native plugin built exclusively for DeepSeek Harness that automatically exports agent conversation sessions to formatted Markdown files. The plugin listens to DSH’s session event stream, and triggers an automatic export after a configurable debounce period once a conversation turn ends. By default, exported files are saved to $DSH_HOME/exports with a session ID in the filename, and it flushes any unexported sessions on process exit, including for one-off headless tasks, so no conversation data is lost. Its rendering logic is written as modular pure functions, so other DSH plugins can import and reuse this functionality directly.

Two types of users benefit most from this plugin: content creators and developers who regularly work with DeepSeek Harness sessions. Content creators can automatically capture and save full conversation records for later review, blogging, or auditing without having to manually copy and paste content. Developers building other DSH plugins can leverage the existing rendering pipeline to add export functionality to their own work instead of building it from scratch. Installing the plugin can be done two ways: check out the repository locally and add it via the file path, or install it directly from the remote Git repository. It supports all three DSH profile types: web, tui, and headless.

After installation, users can configure several options via their DSH profile configuration, including the plugin enable toggle, custom output directory, debounce wait time in milliseconds, maximum character length for tool call results, and whether to include injected messages. Each exported Markdown file includes full session metadata, model information, token usage statistics, turn-by-turn conversation content, tool call records, and a full list of errors encountered during the session. To verify the plugin is installed correctly, users can run dsh --profile <name> --dump-config to check that it appears in the configuration tree, then run a test headless task to confirm the export file is generated correctly.

这是一个专为 DeepSeek Harness 开发的原生插件,核心功能是将 DSH 的 Agent 会话自动导出为格式规整的 Markdown 文件,方便用户进行会话复盘、内容整理、博客撰写或安全审计。它通过监听 session/event 事件流,在每个对话回合结束等待设定的静默时间后自动触发导出。默认导出路径为 $DSH_HOME/exports/session-<id>.md,进程退出(包括无界面一次性任务)时会同步刷新未导出的会话,保证记录不丢失。

对需要长期积累整理 Agent 会话内容的开发者、内容创作者来说,这个插件可以省去手动复制保存会话的麻烦,全自动完成全流程记录留存。开发者还可以复用它的纯函数模块化渲染能力,为自己开发的其他 DSH 插件快速添加会话导出功能。安装方式支持本地检出后本地路径安装,也支持直接从 Git 仓库远程安装,适配 web、tui、headless 三种 DSH 运行 profile。

用户可以通过 DSH 的 profile 配置文件修改插件选项,包括总开关、导出目录、静默等待时间、工具内容截断长度、是否包含注入消息等。导出内容包含会话基础信息、模型与 token 消耗统计、每个回合的提问、工具调用、模型回复、结束原因,以及全会话错误汇总。开发需要 pnpm 依赖管理,安装完成后可通过 DSH 配置转储命令验证安装是否成功。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 2 warnings2 项注意
  • No license declared - all rights reserved by default; ask the author before commercial use or redistribution未声明开源许可证 —— 默认「保留所有权利」,商用或再分发前先问作者
  • Only 3 stars - very few users, little community feedback星标只有 3,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add https://gitcode.com/qq8864/dsh-session-export.git

把 yangyongzhen/dsh-session-export 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-session-export

DeepSeek Harness 会话导出与复盘插件:把 agent 会话自动导出为 Markdown 文件,供复盘、写博客、审计使用。

  • 监听 session/event 事件流,turn 结束并静默 debounceMs 后自动导出
  • 输出 $DSH_HOME/exports/session-<id>.md(默认 ~/.dsh/exports/)
  • 进程退出(含 headless 一次性任务)时同步 flush 未导出的会话,不丢记录
  • 渲染纯函数模块化导出,其他插件可复用

安装

# 本地 checkout 安装(推荐,免构建)
dsh plugin --profile <web|tui|headless> add file:/path/to/dsh-session-export

# 或从 Git 仓库直接安装
dsh plugin --profile <web|tui|headless> add https://gitcode.com/qq8864/dsh-session-export.git

配置

通过 profile 的 cordis.patch.yml 或 --patch overlay 覆盖:

- id: session-export
  config:
    enabled: true            # 总开关,false 关闭自动导出
    outDir: ~/exports        # 导出目录,默认 $DSH_HOME/exports
    debounceMs: 1000         # turn/end 后的静默等待(毫秒)
    maxResultChars: 2000     # 工具参数/结果的截断长度
    includeInjected: false   # true 时包含注入消息(上下文快照、skill 目录等)

导出内容

# 会话导出
- 会话 ID / 创建时间 / 工作目录 / Agent 预设 / 导出时间
- 模型(provider/model)与统计:turn/step/工具调用次数、token 消耗(含缓存读写)、耗时

## Turn N / Step N.t      回合与步骤结构
### 用户 / 目标            直接提示词与目标延续(注入消息默认过滤)
#### 工具调用:name        工具名 + 参数 JSON
#### 工具结果              返回内容(截断)
### 助手                   模型文本 + 该步 token 明细
> Turn N 结束:完成        回合结束原因(完成/出错/被中断/达到上限…)
## 错误记录                全部回合错误汇总

作为库使用

渲染管线独立于运行时,其他插件可直接复用:

import { renderSessionMarkdown, summarizeStats } from 'dsh-session-export';
// 或按包路径导入:dsh-session-export 的 lib/markdown.js

const md = renderSessionMarkdown(session.events, { sessionId: session.id }, 2000, false);

开发

pnpm install
pnpm run build        # tsc -> lib/

验证

  • dsh --profile <name> --dump-config 确认插件进入配置树
  • headless 冒烟:dsh --profile headless "一句话介绍你自己" 后检查 $DSH_HOME/exports/
← 上一个 Prev dsh-ima-copilot 下一个 Next dsh-btw-plugin →