dshbase

插件目录 / Automation / dsh-subagent-cwd

dsh-subagent-cwd

已验证 · 实测可装 lynx-gt

✓ 持续维护 基于 7 个官方 DSH 包

查看 GitHub ↗ ← 返回插件目录

3Stars
0Forks
0未关闭 issue
JavaScript语言
2026-08-15最近推送
跨平台平台

功能简介

DeepSeek Harness子代理委派增强

✅
我们的评价
可用 — 实测通过,早期项目

DeepSeek Harness子代理委派增强 实测能干净安装、正常启动。早期项目,但功能可用。

「已验证」表示我们的自动化 CI 在干净 profile 里实际执行了 dsh plugin add 并启动成功——仅此而已。功能描述与版本兼容性均为作者声明。这不是安全审计,也不代表对第三方代码的背书。

README

dsh-subagent-cwd

Enhanced subagent delegation tools for DeepSeek Harness (dsh)
with per-call working-directory control.

Everything in dsh-subagent-tools (per-call model / provider /
persona / toolFilter overrides, @preset: references, provider/model composite ids) plus a per-call
cwd parameter — shipped with the two small provider patches that make cwd actually work.

| English | 中文 |

awesome · DSH plugin

Choose one of the two packages — not both

Package Per-call model/provider/persona/toolFilter @preset: cwd Patches
dsh-subagent-tools ✅ ✅ ❌ none (bundle only)
dsh-subagent-cwd (this) ✅ ✅ ✅ 2 provider patches

Install either one. Both expose the same tool surface (subagent / subagent_fork) and colliding
installations would fight over the tool names.

Why cwd needs patches (and the other features don't)

SubagentStartRequest has no cwd field, and the in-process drive layer builds child session meta purely
from childSessionMeta(parent, ...) — a per-call cwd is never forwarded. Two code paths create in-process
children, and both must be patched or you hit the classic trap where the foreground path honors cwd
while the background path silently ignores it:

Path Package to patch File
Foreground (one-shot) @deepseek-ai/dsh-subagent-in-process-driver lib/index.js
Background (continuable) @deepseek-ai/dsh-subagent lib/index.js (the BUNDLE — not lib/types/continuation.js!)

The second one is a bundle trap: package.json main/exports point at lib/index.js, which contains an
inline copy of the continuation manager. Patching the source-shaped lib/types/continuation.js has no
effect
— always patch and verify the bundle.

persona × preset coexistence (patch v2)

When preset and persona are given TOGETHER (e.g.
subagent(preset: "@preset:router-standard", persona: "@preset:翻译员")), the old patch registered the
per-call persona as the deployment:persona section, which router-style presets then deleted by name on
every assemble (applyPersona strips every section whose name matches /persona/i) — the role persona was
silently lost.

Patch v2 (install.ps1 hunk 3 / hunk 5, three-state: raw / old-patch / new-patch all upgrade) instead:

  • skips the deployment:persona registration when preset AND persona are both given;
  • registers the per-call persona AFTER recompose as delegation:role (order 1, no "persona" in the
    name), which the router's filter cannot reach — so the preset's own reasoning persona and the delegated
    role persona COEXIST.

Passing only persona (no preset) keeps the old behavior: plain deployment:persona shadowing.

The patch v2 hunks (3–5) are currently implemented only in install.ps1 (Windows).
The POSIX install.sh preset hunks will be added in a follow-up; on Linux the preset
parameter is accepted but does not recompose until that lands.

⚠️ Limitation: persona is lost under router-style presets

Even with patch v2 in place, when a subagent/member uses a router-style preset (e.g.
@preset:dsh-router-standard), the per-call persona still does NOT reach the system
prompt. This is a mechanism-level behavior of router-style presets: their
system-prompt/assemble hook deletes every section whose name matches /persona/i and
injects the preset's own dynamic persona. As a result only the preset's built-in dynamic
persona takes effect; your custom role persona is silently dropped.

Workarounds:

  • a) Use a non-router-style preset (e.g. standard) so the persona parameter is honored;
  • b) Inject the role definition through the message layer instead (first-turn prompt
    prefix / task-message prefix, e.g. the stitching mechanism used by agent-teams), which
    does not depend on cwd;
  • c) Or accept that the persona parameter is a no-op under router-style presets (the
    preset's own dynamic persona takes over).

Installation

# 1. install the plugin (npm / git / local)
dsh plugin --profile web add dsh-subagent-cwd

# 2. apply the two provider patches (required for `cwd`)
powershell -ExecutionPolicy Bypass -File patches\install.ps1    # Windows
# or: ./patches/install.sh                                       # POSIX

# 3. Web sessions: also run the preset adapter (see below)
powershell -ExecutionPolicy Bypass -File install-preset.ps1     # Windows
# or: ./install-preset.sh                                       # POSIX

Restart dsh --profile web and start a NEW session.

Web sessions need the preset adapter

In the web profile, agent tools are provided by the mounted agent preset
(the default standard preset composes subagent / subagent_fork pointing at
@deepseek-ai/dsh-tool-subagent), not by the host plane — a bundle patch is
invisible to Web sessions. install-preset.ps1 / install-preset.sh copies
standard to $DSH_HOME/.agent-presets/standard-plus, rewrites its delegation
rows to point at this package, and switches the default preset. Presets are read
at session creation, so you must start a NEW session (live sessions cannot
switch). Revert: pick standard in the UI (General > Agent preset) and delete
standard-plus.

headless and other non-web profiles do not need the preset adapter.

Upgrading dsh

A dsh upgrade rewrites node_modules and wipes both patches. After every upgrade:

# re-run the installer (it is idempotent; it also detects version-mismatched anchors)
powershell -ExecutionPolicy Bypass -File patches\install.ps1

If the installer reports "anchor not found", the target packages changed shape — check for a new
dsh-subagent-cwd release or file an issue.

Uninstall

powershell -ExecutionPolicy Bypass -File patches\uninstall.ps1   # Windows
# or: ./patches/uninstall.sh                                     # POSIX
dsh plugin --profile web remove dsh-subagent-cwd

Example

Let a subagent work in a directory without the repo's AGENTS.md injected:
  subagent(description="Summarize this file", prompt="...", cwd="D:\\projects\\scratch\\notes")

Design

  • The tool surface is a bundle. The shipped tool-subagent /
    tool-subagent-fork rows are disabled and replaced by this package's rows;
    no official package file is modified for the tool surface itself.
  • cwd is the one capability that cannot stay a bundle-only feature.
    SubagentStartRequest has no cwd field, so a per-call cwd must be forwarded
    by the in-process subagent providers. That needs the two small patches (one
    hunk each) in patches/ — idempotent, backed up on first run, and
    node --check-verified. This is the entire reason this package exists
    separately from dsh-subagent-tools.
  • Version contract: peerDependencies pin the public dsh packages
    (^0.1.0-rc.6). The patches target the same version; a dsh upgrade rewrites
    the dsh installation's node_modules and wipes both patches — re-run
    patches/install.ps1 / install.sh after every upgrade (see Upgrading dsh).
    The bundle itself lives in the profile's own node_modules and survives an
    upgrade, but a changed public API will make peerDependencies refuse to load.

Verified

Tested against a stock dsh 0.1.0-rc.6 install on Windows (headless + web):

  • Everything dsh-subagent-tools verifies (per-call model/provider/persona/
    toolFilter, @preset:, presetHints) ✅
  • cwd on the foreground path ✅ — the child's pwd and its sandbox
    workspace both switch to the requested directory
  • cwd on the continuable (background) path ✅ — background children honor
    the same directory (the classic "foreground works, background silently
    ignores cwd" trap does not occur)
  • toolFilter scoping ✅
  • patches/install.ps1 and patches/uninstall.ps1 round-trip ✅ (backup,
    apply, node --check, restore, re-verify)

Limitations

  • Patches target rc.6 only. The two patches match exact anchors in the
    rc.6 bundle; a dsh upgrade invalidates them until re-run (or a new release).
  • @preset: depends on the local preset layout — same caveat as
    dsh-subagent-tools.
  • Web sessions need the preset adapter (install-preset.ps1) for the same
    reason as dsh-subagent-tools.

License

MIT

安装

🧩 让 Agent 自动装(推荐)

装一次目录插件,之后本站所有插件都能让 DeepSeek Harness 自动找、自动装:

dsh plugin add dshbase-catalog

然后对 agent 说「帮我装 dsh-subagent-cwd」,它会在目录里找到并自动安装。文档:dshbase-catalog · 已验证场景包。

该插件是 GitHub 源码(未发 npm)——直接从仓库装:

Web profile:

dsh plugin --profile web add github:lynx-gt/dsh-subagent-cwd

Headless(CLI)profile:

dsh plugin --profile headless add github:lynx-gt/dsh-subagent-cwd

实测报告

验证通过:从 GitHub 源码完成 L1 安装 + L2 加载 + L3 运行(dsh 0.1.0-rc.6)。

使用场景

自动化一项重复工作——调度、串联任务或响应事件——不用你亲手启动。

适合谁

有周期性工作、想 cron 式无人值守而非手动触发的人。

二次开发建议

触发器和任务模板是缝——加事件驱动或文件监听触发,以及更丰富的流程编排。

安全:尚未扫描——我们的每日静态扫描将很快覆盖它。

分享徽章

Automation 里更多

浏览全部 7797 个插件 →