Preset discovery and registration mechanism in DeepSeek Harness, specifically how shared module directories are handled.
Raw Developer Origin & Technical Request
GitHub Issue
Aug 15, 2026
## 概述(Summary)
在 `~/.dsh/.agent-presets/` 下放置一个**仅作共享模块用途**的目录(内含 `agent.cordis.yml`
与若干 `.mjs` 插件模块,但**没有** `preset.yml`)时,该目录仍会被注册为一个**空名预设**,
出现在新建会话的预设选择列表里。删掉 `preset.yml` **不能**取消注册。
## 环境(Environment)
| 项 | 值 |
|---|---|
| DSH | `0.1.0-rc.6`(`@deepseek-ai/dsh` 全局安装) |
| 相关包 | `@deepseek-ai/dsh-agent-presets` `0.1.0-rc.6`(随 DSH 分发,bundled) |
| OS | Windows 11 |
| Node | v24.14.0 |
## 复现步骤(Steps to Reproduce)
1. 在 `$DSH_HOME/.agent-presets/` 下创建目录 `preset/`(目录名匹配
`PRESET_ID = /^[a-z0-9][a-z0-9-]*$/`)。
2. 目录内放置 `agent.cordis.yml`(合法组合文件)及若干 `.mjs` 插件模块;
**不放** `preset.yml`。
3. 重启 DSH(或依赖热加载)后新建空白会话,查看预设选择列表。
4. 观察:列表中出现一个**显示名为空**的预设选项(其 id 为目录名 `preset`),
且可被选择、可挂载。
## 预期行为(Expected Behavior)
- 没有 `preset.yml` 的目录**不应**注册为可选预设——否则无法用
「共享模块目录 + 相对引用」的方式组织多个预设共用的插件模块,而不污染预设列表;
- 或者:文档明确说明 `preset.yml` 缺失时目录**仍会注册**(只是显示名缺失),
并提供官方的「声明为共享模块、不注册」机制。
## 实际行为(Actual Behavior)
- 目录被注册为预设;`preset.yml` 缺失时显示名为空,仅 id(目录名)可用。
- 现可行的变通方式:目录名必须包含 `PRESET_ID` 正则之外的字符
(如 `preset.modules`,含点号)才能被 `scanRoot` 跳过。该方式依赖目录名
与正则的巧合,不直观、易踩坑,且与「目录名即预设 id」的约定相悖。
## 根因分析(Root Cause)
`lib/types/discovery.js` 的 `scanRoot()` 判定逻辑:
- 目录成为候选的**唯一条件**:`child.isDirectory()` 且 `PRESET_ID.test(child.name)`
(`lib/types/preset.js` 中 `PRESET_ID = /^[a-z0-9][a-z0-9-]*$/`)。
- 注册为预设的**充要条件**:目录内存在 `agent.cordis.yml`(`COMPOSITION_FILE`)
且可加载(`compositionProblem()` 通过)。
- `preset.yml`(`METADATA_FILE`)只是**可选元数据**,提供显示名/描述/排序;
缺失时**不阻止注册**,仅导致显示名为空。
相关源码注释亦确认:目录组成缺失/损坏时是「broken r...
Developer Debate & Comments
No active discussions extracted for this entry yet.
Adjacent Repository Pain Points
Other highly discussed features and pain points extracted from xiaobright/dsh-anchored-standard.
Frequently Asked Questions
Market intelligence mapped to Preset discovery and registration mechanism in DeepSeek Harness, specifically how shared module directories are handled..
What is the technical positioning of Preset discovery and registration mechanism in DeepSeek Harness, specifically how shared module directories are handled.?
How is the developer community reacting to Preset discovery and registration mechanism in DeepSeek Harness, specifically how shared module directories are handled.?
Which technical concepts are associated with Preset discovery and registration mechanism in DeepSeek Harness, specifically how shared module directories are handled.?
Engagement Signals
Cross-Market Term Frequency
Quantifies the cross-market adoption of foundational terms like ~/.dsh/.agent-presets/ and preset.yml by tracking occurrence frequency across active SaaS architectures and enterprise developer debates.
SaaS Metrics