feat(deepseek-harness): 接入原生 dsh.compact Harness 命令 - #54
Merged
BytePioneer-AI merged 2 commits intoAug 30, 2026
Merged
Conversation
Register a DeepSeek Harness command catalog (dsh.compact, argumentMode none) and route execution through the native prompt command seam: sessions.prompt with a single /compact text block, requiring the command slot in the response and publishing a temporary projection Turn lifecycle that is not persisted into ordinary history.
修复 /compact 被当作普通 prompt 提交给模型的问题,并补齐异步压缩投影、取消、原生目录校验及真实 wire 测试。
omsd512-W
marked this pull request as ready for review
August 29, 2026 22:33
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
目的
为 DeepSeek Harness adapter 注册首个 Harness 命令
dsh.compact(/compact,argumentMode: "none"),并通过 DSH 原生命令服务执行,而不是把/compact作为普通 Prompt 发给模型。本 PR 与 #53 独立,基于 upstream
main@64ae4c3,改动仅位于packages/adapters/deepseek-harness。协议核对与修正
@deepseek-ai/dsh-host-apiproxy为0.1.0-rc.6。sessions.d.ts中关于单文本/...的 Prompt 命令缝说明与 rc.6 实际实现不一致:实际sessions.prompt会进入普通 followup/steer 流程,不能用于执行/compact。commands/list:读取当前 Agent 的原生命令目录;commands/execute:执行命令并返回CommandExecution | undefined,同时接受调用方AbortSignal。commands/execute参数为agentId + line;较新的 DSH 增加必填images。adapter 先按锁定协议发送,仅在收到 Typert Gateway 精确的“缺少 images 字段”错误时,以images: []重试一次。实现
commands/list广告无参数的compact时,目录才发布静态白名单命令dsh.compact。execute仍只接受dsh.compact,拒绝未知 ID 和所有参数,不提供任意原生命令透传。/compact通过 Connection 的正式 Remote envelope 发送到POST /api/commands/execute,不再调用sessions.prompt。turn.starteditem.started(contextCompaction)item.completedturn.completednativeTurnRef,也不写入#turns/ 普通会话历史。turn.cancel会中止命令专属AbortController;成功、失败、取消和原生 busy 结果分别投影为对应 Host outcome。CommandExecution均在信任边界进行运行时校验;未知命令返回undefined时 fail-closed 为失败 Turn。DSH 仍会在 mux 中发布 log-only 的
command/*与compaction/*事件;本实现不把这些维护记录重复投影为普通历史 Turn,标准contextCompactionUI 生命周期由本次原生命令调用的开始与终态驱动。测试
sessions.prompt.command回显。images: []窄兼容;contextCompaction投影和历史不落盘;sessions.prompt。验证结果:
npm run typecheck✅npx vitest run --config tests/vitest.config.js packages/adapters/deepseek-harness:2 files / 30 tests passed ✅npx prettier --check packages/adapters/deepseek-harness✅npx eslint packages/adapters/deepseek-harness✅node tools/check-boundaries.mjs✅commands/list返回compact;不存在的命令安全返回未解析,且验证了新版images: []兼容分支 ✅