Plugin CLIs by absolute path in runtime context
插件 CLI 通过运行时上下文给出绝对路径
CLI app plugins such as Feishu, WeCom, DingTalk, and Tencent Meeting install a vendor CLI outside PATH. The upstream guides, the CLIs' own messages, and the DingTalk and WeCom skill scripts call it by name. The model must run the plugin's installation, not another installation or none, and the harness should not change how model commands run to make that happen.
English
Problem
CLI app plugins such as Feishu, WeCom, DingTalk, and Tencent Meeting install a vendor CLI outside PATH. The upstream guides, the CLIs' own messages, and the DingTalk and WeCom skill scripts call it by name. The model must run the plugin's installation, not another installation or none, and the harness should not change how model commands run to make that happen.
Decision
Each app plugin registers its CLI's absolute path with ctx.cliAccounts, the Service of @deepseek-ai/dsh-cli-account. The Service registers required runtime context at the PLUGIN_CLIS context order, without interpolation, that tells the model to run the CLI by that path. For a skill whose scripts call the CLI by name, which applies to DingTalk and WeCom, the context also tells the model to prefix only the commands that run those scripts with PATH="<directory>:$PATH", and never to export PATH or run the CLI by name. On Windows, where the shipped compositions mount tool-pwsh instead of tool-bash, the text uses PowerShell syntax: the call operator, & '<path>', and the prefix $env:PATH = '<directory>;' + $env:PATH. Skills tell the model to use the path from the current runtime context. The plugin's own sign-in, status, and sign-out commands spawn the same path through the Service's command runner.
The harness changes no command environment: Bash, PowerShell, the sandbox, persistent terminals, and hooks run as they do without these plugins. Tencent Meeting registers its platform executable, dist/tmeet-<platform>. The DingTalk context contributes nothing until dws and its skills are installed. No load-time check requires commands to run on the Host; when a composition runs commands over SSH, a command fails when it reaches the missing path.
Alternatives considered
A private PATH. Shell executors and the plugin backend put each plugin's bin directory first on PATH, and a system-prompt section listed the plugin CLIs. This needed a path prefix in every shell request, a prepared environment for backend commands, a Host-runtime check, and a tmeet symlink for Tencent Meeting. Persistent terminals and hooks did not get the prefix, and it hid a CLI of the same name that the user installed.
Paths in skill text. The model sees a skill's text only after loading it, compaction can reduce that text to a summary, and history keeps the old path after an upgrade. Static skill files would also have to be generated at run time.
One shared registry and one combined entry. Rewriting shell-env or adding a package for it states the rule once, but adds a service and its documentation for four callers. Other runtime contexts, such as the working directory and the sandbox policy, are registered by the package that owns the fact; a separate entry per plugin only repeats one sentence.
A Host check. Shipped profiles always run commands on the Host. The check would only move an SSH composition's failure from first use to load, at the cost of a runsOnHost member on the subprocess and shell services.
A hint after a failed bare-name command. Appending the path to the tool result when a command cannot find a registered name would correct the model after the failure, but no evidence yet shows that the context text alone is insufficient.
Consequences
The model, not PATH, maps each name to its path. Counted on 2026-10-23, the upstream guides call the CLIs by name on 3,004 lines for DingTalk, 2,542 for Feishu, 321 for WeCom, and 248 for Tencent Meeting, and 33 DingTalk scripts call dws by name. A command that still uses the bare name runs the installation that PATH resolves, or fails because none is found; nothing rewrites it. The script sentence forbids exporting PATH and running the CLI by name because, in real-model runs, a sentence that only asked for the prefix on script commands led the model to export PATH and then run the CLI by name. Approval details, tool cards, and job lists show the full path.
A CLI that the user installed under the same name is no longer hidden, and persistent terminals and hooks need no PATH handling. Runtime context stays out of the cached system prompt and is admitted again after compaction; installing, enabling, or disabling a plugin appends one runtime-context snapshot. The text's dialect follows the Host platform with the same test the compositions use to choose the shell tool, so a composition that mounts the other shell on a platform gets the wrong syntax.
Unit tests in the kit pin the text, required status, literal paths, readiness, and removal on disposal; each plugin's recorded Session snapshot pins its rendered context.
中文
Problem
飞书、企业微信、钉钉、腾讯会议等 CLI 应用插件把厂商 CLI 装在 PATH 之外。上游指南、CLI 自己的提示信息,以及钉钉和企业微信 skill 里的脚本,都按名称调用 CLI。模型必须运行插件安装的那一份,而不是别的安装或者找不到,同时 harness 不应为此改变模型命令的运行方式。
Decision
每个应用插件把 CLI 的绝对路径注册到 @deepseek-ai/dsh-cli-account 的 Service ctx.cliAccounts。这个 Service 在 PLUGIN_CLIS 上下文顺序处注册一条必需、不做变量插值的运行时上下文,让模型按这个路径运行 CLI。skill 里的脚本按名称调用 CLI 时(钉钉和企业微信属于这种情况),这条上下文还让模型只在运行这些脚本的命令前加上 PATH="<目录>:$PATH",并且不要导出 PATH,也不要按名称运行 CLI。在 Windows 上,内置组合挂载 tool-pwsh 而不是 tool-bash,文本改用 PowerShell 语法:调用运算符 & '<路径>',以及前缀 $env:PATH = '<目录>;' + $env:PATH。skill 让模型使用当前运行时上下文给出的路径。插件自己的登录、状态和登出命令通过这个 Service 的命令执行器启动同一路径。
harness 不改变任何命令的环境:Bash、PowerShell、沙箱、持久终端和 hook 的运行方式与没有这些插件时相同。腾讯会议直接注册各平台的可执行文件 dist/tmeet-<平台>。钉钉的上下文在 dws 和钉钉 skill 安装完成前不贡献任何内容。加载时不检查命令是否在 Host 上运行;组合把命令放到 SSH 远端运行时,命令在访问不存在的路径时失败。
Alternatives considered
私有 PATH。 Shell 执行器和插件后端把各插件的 bin 目录放到 PATH 最前面,再由一段系统提示词列出插件 CLI。这需要在每个 shell 请求里加路径前缀、为后端命令准备环境、检查 runtime 是否在 Host 上,并为腾讯会议建一个 tmeet 符号链接。持久终端和 hook 拿不到这个前缀,而且它会遮住用户自己安装的同名 CLI。
把路径写进 skill 正文。 模型要加载 skill 之后才看得到正文,压缩可能把正文缩成摘要,升级之后历史里留的还是旧路径。静态的 skill 文件也要改成运行时生成。
一个共享注册表、合成一条上下文。 改造 shell-env 或为此新建一个包,可以只写一次规则,但要为四个调用方增加一个服务及其文档。工作目录、沙箱策略等其他运行时上下文都由掌握该事实的包自己注册;每个插件各一条,只是重复一句话。
检查是否在 Host 上。 发布的 profile 总在 Host 上运行命令。这个检查只会把 SSH 组合的失败从首次使用提前到加载,代价是 subprocess 和 shell 服务上多一个 runsOnHost 成员。
按名称调用失败后追加提示。 命令找不到已注册的名称时在工具结果里追加路径,可以在失败后纠正模型,但目前没有证据表明仅靠上下文文字不够。
Consequences
把名称换成路径的是模型,不再是 PATH。按 2026-10-23 的统计,上游指南按名称调用 CLI 的行数为:钉钉 3,004 行、飞书 2,542 行、企业微信 321 行、腾讯会议 248 行;钉钉还有 33 个脚本按名称调用 dws。仍用名称的命令会运行 PATH 解析到的那份安装,或者因为找不到而失败;没有任何机制改写它。脚本那句话之所以禁止导出 PATH 和按名称运行 CLI,是因为在真实模型的运行中,只要求给脚本命令加前缀的写法会让模型先导出 PATH、再按名称运行 CLI。审批详情、工具卡和任务列表显示完整路径。
用户自己安装的同名 CLI 不再被遮住,持久终端和 hook 也不需要处理 PATH。运行时上下文不进入缓存的系统提示词,压缩后会重新提交;安装、启用或停用插件时追加一份运行时上下文快照。文字的写法按 Host 平台选择,判断条件与组合选择 shell 工具的条件相同;因此某个平台上的组合如果挂载了另一种 shell,得到的写法就不对。
kit 的单元测试固定了文字、必需状态、路径原样保留、就绪条件和释放时移除;每个插件的录制会话快照固定了它渲染出的上下文。