DeepSeek Harness Plugin

xiguazhiPrince/dsh-session-map

Stars ★ 0 Downloads (30d) 1,922 Category Sessions & Messages Added 2026-10-17 npm @xiguazhiprince/dsh-session-map

Session map: a fork-tree canvas over DSH sessions, and a Settings page that clones a Git repository into a new workspace. The canvas is reachable from a session-header toggle and two right-side tabs, and from a conversation tab that is off by default; it starts on the current session's own tree, growing downward, with wheel pan, Ctrl/⌘-wheel zoom, a subagent-session filter and a per-session overview of turns, steps, model time, tool time, output tokens and running state. The clone page takes a repository address and a remembered parent directory with a native folder picker, offers a per-clone shallow switch (off by default), runs git clone on the host, and registers the cloned directory as a workspace.

Install

# from npm (prebuilt)

dsh plugin --profile web add @xiguazhiprince/dsh-session-map

# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)

dsh plugin --profile web add github:xiguazhiPrince/dsh-session-map

Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).

README

This plugin publishes its README in Chinese only.

会话图谱 · BTW 分叉 · 技能与指令面板 · MCP 管理 · Git 工具窗口 · 用量统计 —— 把 DSH 里的分叉、能力和代码状态收进同一个界面。

DSH 的会话会从某一轮分叉出去,可左侧栏只是一张平铺列表。这个插件把「从哪一句话分出来」画成一张图,也把日常最费手的技能查看、AGENTS.md 管理和 Git 操作搬进同一套界面。

功能

引用文件预览里的选中文本

右侧栏打开的文件 tab(Markdown / 代码 / 纯文本预览)里选中一段文本,选区上方会浮出「引用到对话」——点一下把 宿主机绝对路径 + 起止行号 + 源码原文 插进当前会话的输入框,接着补问题即可发送。

  • 首行永远是来源坐标:/Users/me/repo/README.md:86-88(单行写 :86);
  • Markdown / 纯文本 → 空行后接 Markdown 引用块,内容是源码原文(**、缩进都保留),发出去会被识别成原生引用卡片;
  • 代码 → 围栏代码块,信息行同样是绝对路径:起止行,正文是源码行;
  • Markdown 预览的行号由「源码投影 → 选区匹配」得到(它渲染的是 HTML,DOM 本身给不出行号);匹配不到时降级为只写路径;
  • 内容只是「酌情」的摘要:单次引用上限 100 字,超出会在行边界截断、把行号范围收窄到实际引用的行,并注明原文总字数;
  • 插入块以一行 --- 收尾:空行 + 分割线 + 空行,光标停在分割线下面隔一行处,接着写自己的问题即可。

入口:右侧栏文件预览里拖选文本。规格见 引用到对话规格。

MCP 管理

会话标签栏「MCP」页管理当前 profile 的原生 dsh-mcp-client 服务器:stdio / HTTP 增删改与启停、Authorization / OAuth 登录、导入导出、诊断,以及可搜索的工具列表(含参数摘要)。写入 cordis.patch.yml。

收编:管理块之外手写的 dsh-mcp-client 行(比如直接编辑 cordis.patch.yml 加的服务器)会被自动发现——列表上方出现「检测到 N 台未纳管的服务器」横幅,确认后一行命令把它们移入管理块:原文照搬、配置含 !!js 表达式一字不动、行 ID 保持、服务不断线;与已纳管行同名的会被带原因跳过。

入口:会话 →「MCP」标签。装完或改配置后需重启该 profile 并刷新页面。

用量统计

Settings →「用量统计」把本机全部会话日志汇总成一张 GitHub 风格的贡献热力图,外加几张汇总表。数据只在本机计算,不上传。

  • 热力图:每天一格,颜色按四分位分档(和 GitHub 一样,一天写几万行不会把其余日子压成浅色)。可以切换指标(AI 改动行数 / Token / 对话轮次 / Agent 运行时长)和来源(全部 / 主会话 / 子代理)。图下给出最活跃月份、最活跃的一天、最长连续天数和当前连续天数。
  • 概览:会话数、对话轮次、Agent 运行时长、Token(输入 · 输出)、缓存命中和工具调用失败率,再加一天中按小时分布的活跃时段。
  • 明细:按项目、模型、工具、文件类型分别列表,最后附上统计口径说明。
  • 口径:改动行数来自 edit / write 工具结果里的 diff(Myers 逐行比对)。分叉会话继承的前缀不重复计入。通过 bash 改的文件没有 diff 记录,所以不计入。
  • 速度:第一次打开要读完全部日志(约 300 MB 的 zstd 日志需要 6 秒左右,扫描在后台分片进行,不阻塞 DSH)。读到的结果按文件缓存在 $DSH_HOME/session-map/usage-stats.v<规则版本>.json(目前是 v2),之后只重读有变化的会话;统计规则改变时版本号加一,旧缓存自动作废。

规格见 用量统计规格。

安装

从 npm 安装(预构建,无安装期脚本):

# 装进 dsh web 启动的 web profile
dsh plugin --profile web add @xiguazhiprince/dsh-session-map

或直接从 GitHub main 安装(最新功能都在这里):

dsh plugin --profile web add github:xiguazhiPrince/dsh-session-map

装完重启该 profile 的进程并刷新页面,插件才会加载(profile 的 bundle 列表在启动时读取)。profile 名要已经存在于 $DSH_HOME/profiles 下;想新建可以先用模板派生:dsh myweb --from-default-profile web。

版本提醒:npm 上最新是 0.9.0——Conversation → MCP 管理、用量统计、引用文件预览选中文本、Git 工具窗口、技能页、指令页与 BTW 都已上架。GitHub main 可能比 npm 领先若干提交,想第一时间试新功能再从 GitHub 装。

本地开发

pnpm install
pnpm build      # 产出 lib/index.js 与 lib/client.js
pnpm typecheck
pnpm test

改了 src/ 记得先 pnpm build 再提交——lib/ 也是仓库内容的一部分。更深入的功能规格与安全设计见 docs;界面约定见 界面视觉规范。

许可证

MIT

Content from the project README on GitHub ↗

Links

More in this category

View the whole category →

Community comments

Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.