npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mars.liu/dsh-graft

v0.2.4

Published

Graft, forward and fork DSH sessions: read a slice of one session's log, export it, fork a session at a turn boundary, or forward a selected portion into another session (or a brand-new one) as a self-contained graft message. Agent tools: graft_sessions/g

Readme

dsh-graft 🌱

嫁接:把一段会话变成另一段会话的养分。DeepSeek Harness 插件,双半区:

  • Node 半区(6 个 agent 工具):切片读取 / 导出 / 原生分叉 / 转发;
  • Browser 半区(client.js):会话页面里的 🌱 嫁接模式——鼠标点选轮次, 一键把选中内容发送到另一个会话或全新会话。

网页端:嫁接模式

  1. 会话标题栏点紧凑的 🌱 图标进入选择模式(旁边的徽标显示已选轮次数);
  2. 每个已完成轮次的收尾动作行(复制 / 分支按钮所在的那一行)出现 + #N 小按钮, 点一下选入(变成 ✓ #N),再点取消。最新轮次常显,较早轮次的动作行与 复制 / 分支一样悬停时浮现;
  3. Composer 卡片顶部贴出嫁接工具条,在下拉里选目标:任一已有会话, 或 「+ 新会话(当前工作区)」(窄屏下拉自动换到独立一行);
  4. 点 「发送嫁接」——选中内容打包成带 <graft source=…> 标注的一条消息 注入目标会话。发往已有会话时停留在原处,标题栏给出「已发送」提示; 发往新会话时在当前工作区开新会话并跳转过去。

打包的是会话日志里的真实往来:只保留 source.kind === 'user' 的用户消息与 助手正文,宿主注入的运行时上下文、system-reminder、工具调用不进 transcript。 范围取自浏览器已加载的历史窗口,因此很早以前、尚未回滚加载的轮次只会带上 窗口内的那部分。

实现:client.js 手写为 client module 系统的闭包工厂格式,零构建步骤; 只依赖 shell 预载的 react,通过 package.json 的 dsh.client 声明被宿主 扫描加载,支持 client-module HMR(改完无需重装)。

选点按钮注册在 conversation.chat.assistant-actions——list 型槽位,与宿主自带 的 feedback 按钮按 id/order 并存。早先用的 conversation.chat.turnTail 是 chain 型单赢家槽位:宿主 deliverables(「本次产出」文件徽章)注册在前,有文件 产出的轮次永远由它当选,graft 的按钮被挤掉(0.2.4 迁移的根因)。list 槽位没有 选举问题;轮次号由 messageId 从会话事件窗口的 assistant/message 记录反查得到。

工具

| 工具 | 作用 | |---|---| | graft_sessions | 列出会话(id / 标题 / cwd / 更新时间 / 血统),用于选取 id(支持无歧义前缀) | | graft_search | 跨会话全文搜索(session.search) | | graft_read | 读取会话日志切片,参数:fromSeq/toSeq/search/role/last | | graft_export | 同样的切片导出为 .md / .json(默认 $DSH_HOME/exports/) | | graft_fork | 在轮次边界分叉新会话(宿主原生 session.fork) | | graft_forward | 切片 → 打包 → session.prompt 注入目标会话;newSession.cwd 可顺手建新会话 |

设计

零依赖、纯 Node 半区(inject: ['tools', 'sessionController'])。所有读写都走宿主 ctx.sessionController 的 Session API——不直接碰磁盘上的 session.jsonl(.zstd), 因此对冷会话、热会话、zstd 压缩都天然正确,也不会绕过宿主的边界检查。

安装

# 从 npm 安装
dsh plugin --profile web add @mars.liu/dsh-graft

# 或本地开发目录安装
dsh plugin --profile web add /Users/mars/jobs/dsh-graft

安装后重启宿主(client 模块图在启动时扫描)。已装的情况下改了源码, 把改动文件同步进 profile 的 node_modules/dsh-graft/ 即可,HMR 会热重载。

典型用法

graft_read   { session: "7314db70", fromSeq: 7, toSeq: 60 }   # 预览片段
graft_export { session: "7314db70", search: "fork", role: "assistant" }
graft_forward{ session: "7314db70", newSession: { cwd: "/tmp/x", title: "继续讨论" },
               instruction: "基于这份记录继续设计" }
graft_fork   { session: "7314db70", atSeq: 88 }

License

MIT