Skip to content

feat(deepseek-harness): 接入原生 dsh.compact Harness 命令 - #54

Merged
BytePioneer-AI merged 2 commits into
BytePioneer-AI:mainfrom
omsd512-W:feat/deepseek-slash-commands
Aug 30, 2026
Merged

feat(deepseek-harness): 接入原生 dsh.compact Harness 命令#54
BytePioneer-AI merged 2 commits into
BytePioneer-AI:mainfrom
omsd512-W:feat/deepseek-slash-commands

Conversation

@omsd512-W

@omsd512-W omsd512-W commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

目的

为 DeepSeek Harness adapter 注册首个 Harness 命令 dsh.compact/compactargumentMode: "none"),并通过 DSH 原生命令服务执行,而不是把 /compact 作为普通 Prompt 发给模型。

本 PR 与 #53 独立,基于 upstream main @ 64ae4c3,改动仅位于 packages/adapters/deepseek-harness

协议核对与修正

  • 锁定的 @deepseek-ai/dsh-host-apiproxy0.1.0-rc.6
  • sessions.d.ts 中关于单文本 /... 的 Prompt 命令缝说明与 rc.6 实际实现不一致:实际 sessions.prompt 会进入普通 followup/steer 流程,不能用于执行 /compact
  • DSH 的正式命令入口已经迁移到 Typert Remote:
    • commands/list:读取当前 Agent 的原生命令目录;
    • commands/execute:执行命令并返回 CommandExecution | undefined,同时接受调用方 AbortSignal
  • rc.6 的 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
  • 命令可能包含一次 LLM 摘要请求,因此执行没有 5 秒 unary 超时:adapter 立即接受并发布临时 Turn,后台等待原生结果。
  • 临时 Turn 发布标准生命周期:
    • turn.started
    • item.started(contextCompaction)
    • item.completed
    • turn.completed
  • 临时 Turn 不带 nativeTurnRef,也不写入 #turns / 普通会话历史。
  • turn.cancel 会中止命令专属 AbortController;成功、失败、取消和原生 busy 结果分别投影为对应 Host outcome。
  • Remote 响应 envelope、RPC ID、命令目录和 CommandExecution 均在信任边界进行运行时校验;未知命令返回 undefined 时 fail-closed 为失败 Turn。

DSH 仍会在 mux 中发布 log-only 的 command/*compaction/* 事件;本实现不把这些维护记录重复投影为普通历史 Turn,标准 contextCompaction UI 生命周期由本次原生命令调用的开始与终态驱动。

测试

  • FakeConnection 不再伪造不存在的 sessions.prompt.command 回显。
  • 新增/更新覆盖:
    • 原生目录广告及部署差异;
    • Remote wire envelope 与 RPC ID;
    • rc.6 参数和新版 images: [] 窄兼容;
    • 异步接受、contextCompaction 投影和历史不落盘;
    • 未知命令、参数、未解析命令、busy、取消路径;
    • 命令路径绝不调用 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
  • 本机正在运行的 DSH 实机只读探测:commands/list 返回 compact;不存在的命令安全返回未解析,且验证了新版 images: [] 兼容分支 ✅

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
omsd512-W marked this pull request as ready for review August 29, 2026 22:33
Copilot AI lite review requested due to automatic review settings August 29, 2026 22:33
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@omsd512-W omsd512-W changed the title feat(deepseek-harness): expose dsh.compact as a registered Harness command feat(deepseek-harness): 接入原生 dsh.compact Harness 命令 Aug 29, 2026
@BytePioneer-AI
BytePioneer-AI merged commit fbb2c3a into BytePioneer-AI:main Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants