rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
edwardyh/dsh-seance
从已终止子 Agent 的残留日志中提取碎片,召唤一个只能基于这些碎片回答问题的“幽灵”。不是调试器,不是可观测性面板——只是在删除之前,先听一听。Summon a ghost from the residual logs of a terminated subagent. It can only answer from the fragments it left behind. Not a debugger, not an observability panel—just listen before you delete.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:edwardyh/dsh-seance
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
English | 中文
在删除之前,先听一听。
dsh-seance 从当前项目里已经终止的子 Agent 会话日志中,提取一小撮残留碎片(失败的工具调用、非正常结束、未完成步骤里的最后片段、最后一条用户消息),聚合成一个只能基于这些碎片回答问题的“幽灵”。幽灵没有工具、不能执行任务、不能写入、不会留下任何持久化记录;对话结束即销毁。
它不是调试工具,不是可观测性面板,也不是会话清理器。
The Séance 要做的,只是在删除之前,先点一支蜡烛。
命令面板中唯一的命令:/dsh-seance.summon
命令面板中显示为「招魂」,也可直接输入 /dsh-seance.summon 执行。
执行流程:
ctx.sessionQuery.filterSessions 查询当前工作目录下的会话,筛出 live: false、parentSession != null 且日志仍可读取的候选。user/message 的截断摘要)、结束原因。命令注册在客户端命令面板(ctx.commandUi 的 action 类型),因此不会产生任何宿主 command/run、command/done 日志,也不会把命令结果写进会话。
只提取以下内容:
| 碎片 | 来源 |
|---|---|
| 失败的工具调用 | tool/result 且 message.isError === true 或 data.error 存在 |
| 非正常结束 | turn/end 且 reason.kind 为 interrupted、aborted、blocked、error、max-tokens、forked |
| 未完成步骤里的最后片段 | 最后一个未闭合 step/start 之后到日志末尾的 assistant/message / assistant/attempt 文本 |
| 它最后看到的话 | 最后一条 user/message 的 content 原文(截断;跳过 Current runtime context.、<system-reminder>、时间采样等框架注入行) |
| 位置 | 一行父子链信息(父会话 id 前缀 + 深度) |
明确不提取:完整对话历史、成功的工具结果、system/message 全文、request/header 的完整工具 schema、任何可以重放任务的指令。
硬预算:碎片总长约 800 token(按 4 字符 / token 粗略折算为 3200 字符)。超预算时优先保留靠后的事件;最后一条 user/message 单独预留额度,不会被后面的错误挤掉。碎片按时间顺序排列后作为幽灵的初始化上下文。
幽灵不是一个可持久化的 Agent 会话。本构建里的 ctx.subagents 只有具名 provider(spawn/fork),本地子 Agent 一律经由 ctx.agents.create 落盘,并在父会话追加 subagent/catalog——这与“幽灵不写持久化存储、不新增持久化事实”直接冲突。因此插件用一个更窄的实现来满足同一目标:
ctx.llm.stream(),messages 里只有 碎片 + 当前问题 一条 user 消息;system 是极短的回声提示词(没有记忆、没有工具、不能执行任务、不记得就说不知道);tools、不传 toolHistory、不传 sessionId——没有工具 schema,也没有任何 session 写入;AGENTS.md 或任何全局上下文;如果模型仍然吐出 tool-call-delta,插件会立即报错终止这次回答。
POST /dsh-seance/api 与宿主通信(x-dsh-seance: 1 头 + application/json,跨站请求会被预检挡住)。插件加载时注册的所有东西都挂在 Cordis effect 上:
只用了两个最小原语,均已在 README 注明:
ctx.commandUi.register({ ui: { kind: 'action' } })(来自 @deepseek-ai/dsh-client-ui-commands)——用于让 dsh-seance.summon 出现在命令面板并直接打开对话框;ctx.slots.inject('shell.overlay', ...)——仅在对话框打开时渲染的临时浮层。没有新增侧边栏、活动栏图标、设置页或常驻 webview;没有使用 @deepseek-ai/dsh-client-ui-model-selection 等 UI 服务。
ctx.llm.stream 的一次补全,不是独立的子 Agent 实例;没有独立 session,也没有自己的生命周期。ctx.subagents + external provider 的方案暂停:内置 spawn 走 ctx.agents.create,会落盘子会话并在父会话追加 subagent/catalog,本质上倾向持久化,与“幽灵不写持久化存储”冲突。shell.overlay slot);headless/ACP 没有命令适配器。tools),不是配置出来的。DeepSeek Harness >=0.2.2-rc.1;当前仅在 0.2.2-rc.1 验证过。
plugin_manager 是 Harness 会话内的 Agent 工具,不是 shell 命令。在会话中调用:
plugin_manager install_bundle,target 为包目录的绝对路径(例如 /absolute/path/to/dsh-seance)。安装后 /dsh-seance.summon 出现在命令面板。
npm install dsh-seance
npm install 只把包放进依赖;要在当前 profile 中启用,仍需在 Harness 会话中通过插件管理器安装本地包:
plugin_manager install_bundle,target 指向 node_modules/dsh-seance 的绝对路径。在 Harness 会话中调用:
plugin_manager remove_bundle,target 为 dsh-seance。plugin_manager set_plugin,target 为 include:dsh-seance。宿主侧可以用同源请求直接验证(需要先安装并激活):
curl -s -X POST http://127.0.0.1:<port>/dsh-seance/api \
-H 'content-type: application/json' \
-H 'x-dsh-seance: 1' \
-d '{"op":"candidates","parentSessionId":"<当前会话 id>"}'
单元测试(碎片提取 + 客户端渲染 smoke):
npm test
MIT — see LICENSE.
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek-harness。