# cohub 子代理 preset 的 **profile patch 声明片段**（供 profile 的 cordis.patch.yml 使用）
#
# 为什么需要这个文件：新版宿主（0.2.1-rc.5 实测）对 profile 里的 agent preset 采用
# `@deepseek-ai/dsh-agent-preset` **声明行**注册，而不是扫描 ~/.dsh/.agent-presets/ 目录。
# 因此只把 presets/<id>/ 复制进用户目录不够 —— 还必须在 profile 的 cordis.patch.yml
# 里以 `- insert: { id: preset-<id>, ... }` 的形式声明，否则 delegate 传
# agentPreset: '<id>' 时 presets.mount 找不到，cohub 会 fail-soft 降级为继承父 preset。
#
# 用法：把下面的 `- insert:` 段原样追加到目标 profile 的 cordis.patch.yml 顶层
# （与既有的 preset-co-orchestrator / preset-cohub-cordis /
# preset-cohub-subagent-readonly / preset-cohub-subagent-write 同级）。
# 本文件本身不被 installShippedPresets 安装（它只复制 presets/ 下的**目录**）。
#
# 源文件（plugins 段与之一一对应，改一处必须同时改另一处）：
#   packages/dsh-cohub/presets/cohub-subagent-readonly-net/agent.cordis.yml
#   packages/dsh-cohub/presets/cohub-subagent-write-shell/agent.cordis.yml
# 与既有两条声明的差异仅在 tool-web 的 fetch 开关，其余工具行逐行照抄。
- insert:
    - id: preset-cohub-subagent-readonly-net
      name: '@deepseek-ai/dsh-agent-preset'
      config:
        id: cohub-subagent-readonly-net
        name: "CoHub 子代理·只读+联网（cohub-subagent-readonly-net）"
        description: "cohub 编排体系的联网只读子代理专用 preset：co-librarian / co-observer
          / co-planner / co-council 使用；在 readonly 基础上接通外网抓取（web 检索类工具可用），
          仍无写盘、无 Shell、无委派类工具。"
        order: 12
        plugins:
          # ── 身份（精简：子代理不需要调度纪律，技能指令已由任务书 brief 注入）──
          - id: persona
            name: '@deepseek-ai/dsh-persona'
            config:
              # 字段名必须是 prefix（required）/ suffix；旧版 text 字段会让整行挂载失败。
              prefix: |-
                你是 cohub 编排体系的专职子代理——只负责完成当前这一件具体任务。
                不要试图调度、委派或拆分给其他代理；你的技能指令已由任务书注入，不要调用 skill 工具加载 co-orchestrator。
                事实与证据优先：结论前置，证据用 path:line 形式。

          # ── 技能 ────────────────────────────────────────────────────────────
          - id: tool-skill
            name: '@deepseek-ai/dsh-tool-skill'

          # ── 任务面板 ────────────────────────────────────────────────────────
          - id: tool-todo
            name: '@deepseek-ai/dsh-tool-todo'
            config:
              allowParallelInProgress: true

          # ── 文件（只读）/ 搜索 / 外网（联网）────────────────────────────────
          # write / edit 显式关掉 —— 与 readonly 版一致，只读保证的硬边界。
          - id: tool-fs
            name: '@deepseek-ai/dsh-tool-fs'
            config:
              write: false
              edit: false

          - id: tool-fs-search
            name: '@deepseek-ai/dsh-tool-fs-search'
            config:
              sampleOverCapGlobResults: false

          # ★ 与 readonly 的唯一差异：fetch 打开（readonly 为 false）。
          - id: tool-web
            name: '@deepseek-ai/dsh-tool-web'
            config:
              fetch: true

          - id: skill-filesystem
            name: '@deepseek-ai/dsh-skill-filesystem'

          # 不挂：delegation / delegation-subagents / tool-subagent* / tool-workflow /
          # tool-goal / tool-ask-user / tool-jobs / tool-cordis / mcp-github。
          # 不挂 shell：联网代理不需要执行命令（真正的只读保证）。

          # ── 上下文压缩（参数照 co-orchestrator 现有值）─────────────────────
          - id: compaction
            name: cordis:group
            group: true
            isolate:
              compaction: true
              toolResultPruner: true
            config:
              - id: compaction-basic
                name: '@deepseek-ai/dsh-compaction-basic'
                config:
                  thresholdRatio: 0.5

              - id: command-compact
                name: '@deepseek-ai/dsh-command-compact'

              - id: tool-result-pruner
                name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
                config:
                  thresholdChars: 8192
                  headChars: 4096
                  tailChars: 1024

- insert:
    - id: preset-cohub-subagent-write-shell
      name: '@deepseek-ai/dsh-agent-preset'
      config:
        id: cohub-subagent-write-shell
        name: "CoHub 子代理·读写+Shell（cohub-subagent-write-shell）"
        description: "cohub 编排体系的全能实施类子代理专用 preset：co-fixer / co-designer
          / co-cordis 使用；文件读写 + Shell + 外网抓取，但不含任何委派类工具。"
        order: 13
        plugins:
          # ── 身份（精简）─────────────────────────────────────────────────────
          - id: persona
            name: '@deepseek-ai/dsh-persona'
            config:
              # 字段名必须是 prefix（required）/ suffix；旧版 text 字段会让整行挂载失败。
              prefix: |-
                你是 cohub 编排体系的专职子代理——只负责完成当前这一件具体任务。
                不要试图调度、委派或拆分给其他代理；你的技能指令已由任务书注入，不要调用 skill 工具加载 co-orchestrator。
                事实与证据优先：结论前置，证据用 path:line 形式。

          # ── 技能 ────────────────────────────────────────────────────────────
          - id: tool-skill
            name: '@deepseek-ai/dsh-tool-skill'

          # ── 任务面板 ────────────────────────────────────────────────────────
          - id: tool-todo
            name: '@deepseek-ai/dsh-tool-todo'
            config:
              allowParallelInProgress: true

          # ── 文件（读写）/ 搜索 / 外网（联网）────────────────────────────────
          - id: tool-fs
            name: '@deepseek-ai/dsh-tool-fs'

          - id: tool-fs-search
            name: '@deepseek-ai/dsh-tool-fs-search'
            config:
              sampleOverCapGlobResults: false

          # ★ 相对 cohub-subagent-write 的唯一差异：fetch 打开（write 为 false）。
          - id: tool-web
            name: '@deepseek-ai/dsh-tool-web'
            config:
              fetch: true

          - id: skill-filesystem
            name: '@deepseek-ai/dsh-skill-filesystem'

          # ── Shell（平台互斥，写法照 co-orchestrator）────────────────────────
          - id: tool-bash
            name: '@deepseek-ai/dsh-tool-bash'
            disabled: !!js process.platform === 'win32'

          - id: tool-pwsh
            name: '@deepseek-ai/dsh-tool-pwsh'
            disabled: !!js process.platform !== 'win32'

          # 不挂（见文件头）：delegation / delegation-subagents / tool-subagent* /
          # tool-workflow / tool-goal / tool-ask-user / tool-jobs / tool-cordis / mcp-github。

          # ── 上下文压缩（参数照 co-orchestrator 现有值）─────────────────────
          - id: compaction
            name: cordis:group
            group: true
            isolate:
              compaction: true
              toolResultPruner: true
            config:
              - id: compaction-basic
                name: '@deepseek-ai/dsh-compaction-basic'
                config:
                  thresholdRatio: 0.5

              - id: command-compact
                name: '@deepseek-ai/dsh-command-compact'

              - id: tool-result-pruner
                name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
                config:
                  thresholdChars: 8192
                  headChars: 4096
                  tailChars: 1024
