dsh-team-control 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -11
- package/index.js +109 -0
- package/package.json +15 -4
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-team-control
|
|
2
2
|
|
|
3
3
|
把本仓的 **dsh-team sidecar** 暴露为 DSH 模型可调用工具的 Host 插件(bundle)。
|
|
4
4
|
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
- 11 个工具里**只有 `team_create` 标了 `START HERE`**:它的 description 直接给出 5 步顺序、`runtime` 的语义与后果
|
|
12
12
|
(不传 `runtime:"agent"` 就是 worker,成员不会思考)、以及 `teamId` 取自 `result.team.id`;`team_spawn` 写明返回的
|
|
13
13
|
`member.id` 就是后面 `assignee` 要的值;`team_task` 写明简报必须自包含(成员看不到 Lead 的对话)。模型只看工具面就能按序走。
|
|
14
|
-
- 完整配方(字段陷阱、拆任务与并发、症状→修法表)在 skill **`dsh-agent-team`**:[`../skills/dsh-agent-team/SKILL.md`](../skills/dsh-agent-team/SKILL.md)
|
|
15
|
-
|
|
14
|
+
- 完整配方(字段陷阱、拆任务与并发、症状→修法表)在 skill **`dsh-agent-team`**:[`../skills/dsh-agent-team/SKILL.md`](../skills/dsh-agent-team/SKILL.md)。
|
|
15
|
+
本插件启动时把这个目录注册成 skills provider(`name: 'dsh-team'`,rank 600),**装上插件即出现在会话技能目录**,无需 cp;`team_create` 描述末尾也指向它。
|
|
16
16
|
|
|
17
17
|
## 两种成员运行时
|
|
18
18
|
|
|
@@ -56,22 +56,22 @@
|
|
|
56
56
|
|
|
57
57
|
## 安装
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
本包已发布到 npm(`dsh-team-control`),sidecar 由依赖 `dsh-team-control-cli` 一起装上:
|
|
60
60
|
|
|
61
|
-
```
|
|
62
|
-
|
|
61
|
+
```bash
|
|
62
|
+
dsh plugin --profile web add dsh-team-control
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
卸载:`
|
|
65
|
+
装完重启 DSH,工具面出现 11 个 `team_*` 工具;`autoStart` 会自己拉起 sidecar。
|
|
66
|
+
本地开发也可以按绝对路径装:`plugin_manager(action: "install_bundle", target: "<repo>/dsh-plugin")`。
|
|
67
|
+
卸载:`dsh plugin --profile web remove dsh-team-control`。
|
|
68
68
|
|
|
69
69
|
## 配置(`cordis.patch.yml`)
|
|
70
70
|
|
|
71
71
|
```yaml
|
|
72
72
|
- insert:
|
|
73
73
|
- id: dsh-team
|
|
74
|
-
name: '
|
|
74
|
+
name: 'dsh-team-control'
|
|
75
75
|
config:
|
|
76
76
|
baseUrl: http://127.0.0.1:4317
|
|
77
77
|
autoStart: true
|
|
@@ -112,7 +112,7 @@ plugin_manager(action: "install_bundle", target: "C:\\...\\agent-team-plugin\\ds
|
|
|
112
112
|
|
|
113
113
|
## 面板位置
|
|
114
114
|
|
|
115
|
-
本包只提供**工具面**。界面在配套的 [
|
|
115
|
+
本包只提供**工具面**。界面在配套的 [`dsh-team-control-ui`](../dsh-plugin-ui/):一个注册在
|
|
116
116
|
`settings.plugins.tab` 的 React 页面(设置 → 插件 → dsh-team 控制台),经 Host 同源代理读取
|
|
117
117
|
sidecar。独立的 `{baseUrl}/panel` 仍然保留,适合不打开 DSH 时使用。
|
|
118
118
|
|
package/index.js
CHANGED
|
@@ -1692,6 +1692,103 @@ function traceLlmCall(s, options, next) {
|
|
|
1692
1692
|
})();
|
|
1693
1693
|
}
|
|
1694
1694
|
|
|
1695
|
+
// ---- 技能:把包内 `skills/` 注册成 skills provider ----
|
|
1696
|
+
// 装上插件就带 `dsh-agent-team` 技能,不需要用户手动 `cp -r skills/... ~/.dsh/skills/`。
|
|
1697
|
+
// 本地克隆读 `<repo>/skills`;npm 安装读依赖包 `dsh-team-control-cli` 里的 `skills/`(同一份文件)。
|
|
1698
|
+
const SKILL_RANK = 600; // 与官方 BUNDLED_SKILL_RANK 一致:打包来源的标准优先级
|
|
1699
|
+
|
|
1700
|
+
function skillRoots() {
|
|
1701
|
+
const roots = [path.resolve(PKG_DIR, '..', 'skills')];
|
|
1702
|
+
try {
|
|
1703
|
+
const cliPkg = createRequire(import.meta.url).resolve('dsh-team-control-cli/package.json');
|
|
1704
|
+
roots.push(path.join(path.dirname(cliPkg), 'skills'));
|
|
1705
|
+
} catch { /* 本地布局下可能没有该依赖 */ }
|
|
1706
|
+
const seen = new Set();
|
|
1707
|
+
return roots.filter((dir) => {
|
|
1708
|
+
if (seen.has(dir) || !fs.existsSync(dir)) return false;
|
|
1709
|
+
seen.add(dir);
|
|
1710
|
+
return true;
|
|
1711
|
+
});
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1714
|
+
/** 解析 SKILL.md 的 YAML frontmatter(只处理 `key: value` 这一层,够用且零依赖)。 */
|
|
1715
|
+
export function parseSkillFrontmatter(text) {
|
|
1716
|
+
const meta = {};
|
|
1717
|
+
if (!text.startsWith('---')) return meta;
|
|
1718
|
+
const end = text.indexOf('\n---', 3);
|
|
1719
|
+
if (end < 0) return meta;
|
|
1720
|
+
for (const line of text.slice(3, end).split(/\r?\n/)) {
|
|
1721
|
+
const m = /^([A-Za-z0-9_-]+):\s*(.*)$/.exec(line);
|
|
1722
|
+
if (!m) continue;
|
|
1723
|
+
let value = m[2].trim();
|
|
1724
|
+
if (value.length >= 2 && ((value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'")))) {
|
|
1725
|
+
value = value.slice(1, -1);
|
|
1726
|
+
}
|
|
1727
|
+
meta[m[1]] = value === 'true' ? true : value === 'false' ? false : value;
|
|
1728
|
+
}
|
|
1729
|
+
return meta;
|
|
1730
|
+
}
|
|
1731
|
+
|
|
1732
|
+
function stripSkillFrontmatter(text) {
|
|
1733
|
+
if (!text.startsWith('---')) return text;
|
|
1734
|
+
const end = text.indexOf('\n---', 3);
|
|
1735
|
+
if (end < 0) return text;
|
|
1736
|
+
const after = text.indexOf('\n', end + 4);
|
|
1737
|
+
return (after < 0 ? '' : text.slice(after + 1)).replace(/^\r?\n/, '');
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
/** 扫描可用目录,产出 skills 服务的候选条目(纯函数,便于测试)。 */
|
|
1741
|
+
export function discoverTeamSkills() {
|
|
1742
|
+
const out = [];
|
|
1743
|
+
for (const root of skillRoots()) {
|
|
1744
|
+
let entries = [];
|
|
1745
|
+
try { entries = fs.readdirSync(root, { withFileTypes: true }); } catch { continue; }
|
|
1746
|
+
for (const entry of entries) {
|
|
1747
|
+
if (!entry.isDirectory()) continue;
|
|
1748
|
+
const dir = path.join(root, entry.name);
|
|
1749
|
+
const file = path.join(dir, 'SKILL.md');
|
|
1750
|
+
let meta;
|
|
1751
|
+
try { meta = parseSkillFrontmatter(fs.readFileSync(file, 'utf8')); } catch { continue; }
|
|
1752
|
+
const name = String(meta.name || entry.name);
|
|
1753
|
+
if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(name)) continue;
|
|
1754
|
+
out.push({
|
|
1755
|
+
name,
|
|
1756
|
+
description: String(meta.description || ''),
|
|
1757
|
+
...(meta.whenToUse ? { whenToUse: String(meta.whenToUse) } : {}),
|
|
1758
|
+
invocation: { modelInvocable: true, userInvocable: meta['user-invocable'] !== false },
|
|
1759
|
+
source: 'bundled',
|
|
1760
|
+
provider: 'dsh-team',
|
|
1761
|
+
rank: SKILL_RANK,
|
|
1762
|
+
path: file,
|
|
1763
|
+
resourceBase: { kind: 'directory', path: dir },
|
|
1764
|
+
locator: { file, dir },
|
|
1765
|
+
metadata: meta,
|
|
1766
|
+
});
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1769
|
+
return out;
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1772
|
+
/** 读取候选对应的完整正文(frontmatter 已剥离)。 */
|
|
1773
|
+
function loadTeamSkill(candidate) {
|
|
1774
|
+
const file = candidate?.locator?.file ?? candidate?.path;
|
|
1775
|
+
if (!file) return undefined;
|
|
1776
|
+
let text;
|
|
1777
|
+
try { text = fs.readFileSync(file, 'utf8'); } catch { return undefined; }
|
|
1778
|
+
return {
|
|
1779
|
+
name: candidate.name,
|
|
1780
|
+
description: candidate.description,
|
|
1781
|
+
...(candidate.whenToUse ? { whenToUse: candidate.whenToUse } : {}),
|
|
1782
|
+
invocation: candidate.invocation,
|
|
1783
|
+
source: candidate.source,
|
|
1784
|
+
provider: candidate.provider,
|
|
1785
|
+
path: candidate.path,
|
|
1786
|
+
resourceBase: candidate.resourceBase,
|
|
1787
|
+
metadata: candidate.metadata,
|
|
1788
|
+
content: stripSkillFrontmatter(text),
|
|
1789
|
+
};
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1695
1792
|
/** Cordis apply:注册全局工具,接管自动拉起的 sidecar,并把 agent 生命周期桥接到 sidecar。 */
|
|
1696
1793
|
export function apply(ctx, config) {
|
|
1697
1794
|
const s = resolveConfig(config);
|
|
@@ -1709,6 +1806,18 @@ export function apply(ctx, config) {
|
|
|
1709
1806
|
};
|
|
1710
1807
|
}, 'dsh-team.tools()');
|
|
1711
1808
|
|
|
1809
|
+
// 技能:skills 服务在场时把包内 `skills/` 注册成 provider,装上插件就带 `dsh-agent-team` 技能;
|
|
1810
|
+
// 服务缺失(老版本/测试假 ctx)时静默跳过,不影响工具面。
|
|
1811
|
+
if (typeof ctx.inject === 'function') {
|
|
1812
|
+
ctx.inject(['skills'], (scope) => {
|
|
1813
|
+
scope.skills.registerProvider(() => ({
|
|
1814
|
+
name: 'dsh-team',
|
|
1815
|
+
list: async () => discoverTeamSkills(),
|
|
1816
|
+
get: async (candidate) => loadTeamSkill(candidate),
|
|
1817
|
+
}));
|
|
1818
|
+
});
|
|
1819
|
+
}
|
|
1820
|
+
|
|
1712
1821
|
if (s.reportToolCalls) {
|
|
1713
1822
|
ctx.on('tools/execute', (exec, next) => traceToolCall(s, ctx, exec, next));
|
|
1714
1823
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-team-control",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Expose the local dsh-team sidecar as model-facing tools (team_create / team_spawn / team_status / team_task / team_send / team_report_task / team_dispatch / team_scope / team_control / team_report), spawn real DSH sub-agent members for runtime=agent teams, and manage the sidecar lifecycle.",
|
|
6
6
|
"icon": "./icon.svg",
|
|
7
|
-
"keywords": [
|
|
8
|
-
|
|
7
|
+
"keywords": [
|
|
8
|
+
"dsh",
|
|
9
|
+
"deepseek-harness",
|
|
10
|
+
"agent-team",
|
|
11
|
+
"orchestration",
|
|
12
|
+
"tools"
|
|
13
|
+
],
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/hunmer/dsh-team-control.git"
|
|
17
|
+
},
|
|
9
18
|
"homepage": "https://github.com/hunmer/dsh-team-control#readme",
|
|
10
|
-
"bugs": {
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/hunmer/dsh-team-control/issues"
|
|
21
|
+
},
|
|
11
22
|
"license": "MIT",
|
|
12
23
|
"dependencies": {
|
|
13
24
|
"dsh-team-control-cli": "^0.1.0"
|