DSH HUB
HomePlugin StorePlugin PacksCommunityRankingsResourcesPublish Guide
Plugin source
Back to catalog

flg1217 /

dsh-subagent-codebuddy

Verified

CodeBuddy CLI ACP 子代理插件:dsh subagent provider + subagent_codebuddy 工具

★ 1 Stars0 Forks0 IssuesN/A Community rating0 Confirmed installs
View on GitHub
READMESource: master@753ba1dd

dsh-subagent-codebuddy

CodeBuddy Code CLI 子代理插件 — DeepSeek Harness (dsh) 的独立推理子代理提供方 把腾讯 CodeBuddy CLI 接入 dsh:每个子代理是 dsh 进程内的独立会话(可并行、可续聊),每次 LLM 调用经适配器 spawn CodeBuddy 执行。完全遵循 dsh 官方扩展机制,零源码改动。

一、这是什么

dsh-subagent-codebuddy 以 LLM 适配器架构(对齐 dsh-llm-agy)把 CodeBuddy 注册为 dsh 子代理提供方:

能力 说明
独立推理子代理 注册 codebuddy provider 路由与 subagent_codebuddy 委派工具
进程内会话管理 每个子代理是 dsh 内 child agent——可并行创建、send_message 续聊,互不干扰
上下文由 dsh 管理 每次调用把该子代理的完整历史序列化进 prompt,不依赖 CodeBuddy 存储
工具步骤回传 文本与工具步骤(tool/call + tool/result)在 dsh 会话与 CodeBuddy 进程间双向翻译

与"ACP 直接子代理"方案的区别:子代理是 dsh 进程内 agent,上下文连续性由 dsh 会话管理,不存在 CodeBuddy 按 cwd 自动续上下文造成的跨任务串味(实测 codebuddy --acp 按工作目录自动续上一会话、参数无法隔离,故本插件不走 ACP)。

二、核心功能

1. 子代理提供方(provider 路由 codebuddy)

subagent_codebuddy 工具 → dsh 子代理 → CodebuddyLlmAdapter → codebuddy -p --output-format stream-json。CodeBuddy 拥有自己的系统提示词、工具面、模型与权限执行;dsh 负责子代理生命周期与上下文。

2. 图片输入(粘贴/引用 → 本地路径)

用户消息里的图片块由序列化层落盘为临时文件,prompt 中给出本地路径,CodeBuddy 自行读取看图。

3. 长上下文保护(Windows 命令行 32K 限制)

prompt 超过阈值(26K 字符)自动写入临时任务文件,命令行只给短引用,CodeBuddy 完整读取任务描述。

三、快速开始

系统要求

  • dsh >= 0.1.0-rc.6
  • CodeBuddy CLI 已安装并登录(子进程继承登录态)

安装插件

方式一(推荐,lib/ 已随仓库提交,免构建):

node scripts/link-profile.mjs            # 默认装配进 web profile
# 或等价于:dsh plugin --profile web add <本仓库目录>

方式二(发布仓库安装):

dsh plugin --profile web add https://github.com/flg1217/dsh-subagent-codebuddy

无论哪种方式,安装后都要在 profile 的 cordis.patch.yml 加入插件行:

- insert:
    - id: subagent-codebuddy
      name: '@dsh-external/dsh-subagent-codebuddy'
      config:
        command: codebuddy
        model: deepseek-v4-flash
        permissionMode: bypassPermissions
        providerName: codebuddy
        toolName: subagent_codebuddy

完成后重启 dsh web,重开会话,工具列表出现 subagent_codebuddy。

配置项

键 默认 含义
command codebuddy 可执行文件(Windows 自动解析 npm cmd-shim → node <真实CLI>)
model deepseek-v4-flash CodeBuddy 模型 ID(--model <id>)
permissionMode bypassPermissions --permission-mode:子代理工具调用自动放行
extraArgs [] 追加的 CodeBuddy 参数
providerName codebuddy LLM provider 路由名
toolName subagent_codebuddy 模型可见工具名
registerSubagentTools true 是否注册委派工具

四、典型用法

  • 委派设计任务:主代理把前端/UI 任务委派给 subagent_codebuddy(continuable,可复用作图长线会话)。
  • 并行调研:拆分独立任务到多个 CodeBuddy 子代理并行执行,结果互不干扰。
  • 保守权限:默认 bypassPermissions 全自动;如要更保守,改 acceptEdits 或 plan。

五、工作原理

tool-subagent(provider: spawn, backgroundMode: continuable)
  └─ 子代理 = dsh 进程内 child agent(会话可常驻,send_message 可续聊)
       └─ 每次 LLM 调用 → CodebuddyLlmAdapter → spawn `codebuddy -p --output-format stream-json`
            └─ 翻译文本与工具步骤(tool/call + tool/result)回 dsh 会话
  • 子代理会话生命周期由 dsh 提供;每次调用把该子代理自己的完整历史序列化进 prompt。
  • CodeBuddy 的模型、网络与配额由 CodeBuddy 侧负责,插件只做 LLM 适配桥接。

六、参与开发

pnpm install        # 安装 typescript + vitest
pnpm build          # tsc 编译 → lib/(产物随仓库提交,免构建安装)
pnpm test           # vitest 单元测试(serialize 等)
pnpm typecheck      # tsc --noEmit

提交前检查:git status 无遗留文件;lib/ 与测试同步更新。发布仅 git push(不做 npm publish):

git add -A && git commit -m "feat/fix: ..." && git push origin master

七、许可证

MIT

—/ 5

No ratings yet

Verified DSH bundle

Commit 753ba1dd6931

Community comments

No comments yet. Be the first to write one.

DSH HUB

A community index for DSH plugins. Not an official GitHub or DeepSeek AI product.

CommunityResourcesAPIAbout