@yangdcm/dsh-expert-team 1.1.0

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.
Files changed (52) hide show
  1. package/LICENSE +21 -0
  2. package/README.en.md +141 -0
  3. package/README.md +135 -0
  4. package/client.js +2473 -0
  5. package/cordis.patch.yml +24 -0
  6. package/lib/artifact-writer.js +379 -0
  7. package/lib/command-parse.js +181 -0
  8. package/lib/command.js +5100 -0
  9. package/lib/dispatch-ledger.js +229 -0
  10. package/lib/index.js +15 -0
  11. package/lib/interception.js +266 -0
  12. package/lib/lead-toolface.js +179 -0
  13. package/lib/log-parse.js +181 -0
  14. package/lib/loop-guard.js +165 -0
  15. package/lib/metrics/collect.js +70 -0
  16. package/lib/metrics/render.js +100 -0
  17. package/lib/metrics/session-usage.js +319 -0
  18. package/lib/metrics/timing.js +188 -0
  19. package/lib/metrics/token-usage.js +352 -0
  20. package/lib/metrics/tokens.js +271 -0
  21. package/lib/routes/shared.js +83 -0
  22. package/lib/settings.js +289 -0
  23. package/lib/tier.js +190 -0
  24. package/lib/validate.js +681 -0
  25. package/lib/vocab.js +121 -0
  26. package/lib/write-tracer.js +58 -0
  27. package/package.json +119 -0
  28. package/presets/expert-team/agent.cordis.yml +542 -0
  29. package/presets/expert-team/preset.yml +3 -0
  30. package/skills/expert-team/SKILL.md +328 -0
  31. package/skills/expert-team/assets/templates/AUTHORITY.md +32 -0
  32. package/skills/expert-team/assets/templates/PLAN.md +27 -0
  33. package/skills/expert-team/assets/templates/RESEARCH.md +13 -0
  34. package/skills/expert-team/assets/templates/RETRO.md +24 -0
  35. package/skills/expert-team/assets/templates/REVIEW.md +10 -0
  36. package/skills/expert-team/assets/templates/ROSTER.json +6 -0
  37. package/skills/expert-team/assets/templates/SPEC.md +62 -0
  38. package/skills/expert-team/assets/templates/STATE.json +10 -0
  39. package/skills/expert-team/assets/templates/SUMMARY.md +25 -0
  40. package/skills/expert-team/assets/templates/TASK.md +23 -0
  41. package/skills/expert-team/assets/templates/TASKS.json +3 -0
  42. package/skills/expert-team/assets/templates/TEST.md +9 -0
  43. package/skills/expert-team/assets/templates//344/273/273/345/212/241/347/234/213/346/235/277.md +23 -0
  44. package/skills/expert-team/references/EFFICIENCY.md +79 -0
  45. package/skills/expert-team/references/LOGGING.md +82 -0
  46. package/skills/expert-team/references/PERSIST.md +57 -0
  47. package/skills/expert-team/references/PIPELINE.md +58 -0
  48. package/skills/expert-team/references/ROLES.md +297 -0
  49. package/skills/expert-team/references/WORKSPACE.md +123 -0
  50. package/skills/expert-team/references/workflow.team.js +97 -0
  51. package/skills/expert-team/scripts/scan-authority.mjs +114 -0
  52. package/skills/expert-team/scripts/scan-single-source.mjs +292 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 yangdcm
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.en.md ADDED
@@ -0,0 +1,141 @@
1
+ # expert-team · dsh-expert-team
2
+
3
+ English | [中文](README.md)
4
+
5
+ [![npm](https://img.shields.io/npm/v/@yangdcm/dsh-expert-team)](https://www.npmjs.com/package/@yangdcm/dsh-expert-team)
6
+ [![license](https://img.shields.io/npm/l/@yangdcm/dsh-expert-team)](LICENSE)
7
+ [![CI](https://github.com/yangdcm/dsh-expert-team/actions/workflows/ci.yml/badge.svg)](https://github.com/yangdcm/dsh-expert-team/actions/workflows/ci.yml)
8
+
9
+ > **One sentence in, a gated team delivery out.** `/team build a payments module with login`
10
+ > assembles a 12-role expert team and runs
11
+ > clarify → research → design → spec-review → plan-approval → implement → review → test → deliver,
12
+ > with implementers editing your workspace directly and every hand-off persisted as a reviewable artifact.
13
+
14
+ A plugin for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (dsh).
15
+ **Zero runtime dependencies, no build step, no install hooks.**
16
+
17
+ ![Quality-gate violations surfaced live](docs/images/panel-gate.png)
18
+ ![Members, models and task detail](docs/images/panel-live.png)
19
+ ![Phase progress and artifact preview](docs/images/panel-flow.png)
20
+
21
+ <sub>Real screenshots of the overlay: the gate-violation banner, the roster (who is running, on which model), and task/artifact detail.</sub>
22
+
23
+ ---
24
+
25
+ ## What it solves
26
+
27
+ A single agent doing large work fails in three predictable ways: **context drift** (long tasks wander),
28
+ **self-review** (nobody verifies independently), and **rework that never converges**. The team attacks
29
+ all three:
30
+
31
+ | Mechanism | How |
32
+ |---|---|
33
+ | **Role separation** | 12 roles, each with its own persona, tool boundary (`toolFilter`) and delegation depth (`maxDepth: 1`). PM/architect only read and write planning artifacts, reviewers are read-only, only implementers touch code |
34
+ | **Phase gating** | 9 phases; every hand-off travels as *structured return value + artifact file*, not as chat history |
35
+ | **Quality gates enforced in code** | State-machine consistency is enforced by the plugin (not requested in a prompt): unfinished tasks cannot be marked completed, quality findings must be adjudicated by qa/reviewer, coverage gaps and rework over budget are flagged. Violations appear **live** in the overlay and in `/team status` |
36
+ | **Convergence and accounting** | Per-run token/time/first-runnable/closing-budget metrics; `/team learn` distils cross-run lessons and re-injects them before the next run starts |
37
+
38
+ ## Roles and phases
39
+
40
+ **12 roles**: pm · architect · researcher · ui · backend · frontend · dba · sec · reviewer · qa · devops · docs.
41
+ The roster is trimmed per task; small jobs start only the roles they need.
42
+
43
+ **9 phases**: `clarify → research → design → spec-review → plan-approval → implement → review → test → deliver`
44
+ (`/team --tier` picks a quick / standard / strict pipeline).
45
+
46
+ ## Install
47
+
48
+ **Requirements**
49
+
50
+ - `dsh web` (developed and verified against **0.1.5-rc.1**; earlier versions are untested)
51
+ - Node.js ≥ 20
52
+ - The 12 role tools (`subagent_pm`, `subagent_architect`, …) require a session running the
53
+ **「专家团模式」 ("Expert Team mode")** preset. Without it the team falls back to the generic
54
+ `subagent` tool with personas written into the prompt — nothing breaks, you just lose the
55
+ config-level boundary guarantees.
56
+
57
+ **Option 1 — plugin market (recommended)**
58
+
59
+ `dsh web` → **Settings → Plugin market** → search for "专家团" / "expert team" → install → refresh.
60
+
61
+ **Option 2 — CLI**
62
+
63
+ ```sh
64
+ dsh plugin --profile web add @yangdcm/dsh-expert-team
65
+ # then restart dsh web so the new bundle joins the composition
66
+ ```
67
+
68
+ **Option 3 — from source (development)**
69
+
70
+ ```sh
71
+ cd ~/.dsh/profiles/web
72
+ # package.json: add "@yangdcm/dsh-expert-team": "file:<absolute path to this package>" to dependencies
73
+ # package.json: add "@yangdcm/dsh-expert-team" to dsh.profile.bundles
74
+ pnpm install && dsh web
75
+ ```
76
+
77
+ > The first `/team` run idempotently bootstraps the `expert-team` skill and the
78
+ > 「专家团模式」 preset into `$DSH_HOME/skills/` and `$DSH_HOME/.agent-presets/`.
79
+
80
+ ## Quick start
81
+
82
+ ```
83
+ /team build a payments module with login # one-shot: assemble, deliver, report
84
+ /team --persist refactor the orders module # persistent live team; members stay commandable, resumable across sessions
85
+ /team --no-code review the existing API # artifacts only (plan/review/test), no code changes
86
+ /team --confirm <task> # scaffold the run but do not dispatch until you click "execute"
87
+ /team status # phases, roster, model plan and live gate violations
88
+ /team resume <run-id> # resume a run in a later session
89
+ ```
90
+
91
+ `/team help` lists the full surface (`/team canvas` visual canvas, `/team codeindex` code index,
92
+ `/team learn` self-learning, `/team limit` quota, `/team settle` cold-start settlement, …).
93
+
94
+ **Where output lands**
95
+
96
+ - `<your workspace>/team/<run-id>/` — artifacts: `SPEC / PLAN / TASKS / ROSTER / STATE / REVIEW / TEST / SUMMARY / RUN.log.md`
97
+ - `$DSH_HOME/expert-team/` — machine-local preferences and cross-project lessons: `settings.json`, `session-runs.json`, `LEARNINGS.md`
98
+
99
+ ## Layout
100
+
101
+ ```
102
+ cordis.patch.yml the only composition contribution: one host-plane /team command row
103
+ lib/command.js /team command: parse + scaffold workspace + install skill + launch + 11 overlay routes
104
+ lib/validate.js pure validators for state machine, quality gates and capacity limits
105
+ lib/tier.js single source of truth for pipeline tiers
106
+ lib/metrics/ token accounting, first-runnable timing, closing budget, METRICS rendering
107
+ lib/routes/ shared route plumbing (uniform 405/500/JSON handling)
108
+ client.js the overlay panel (module-loader bundle; requires only 'react')
109
+ skills/expert-team/ the orchestration "brain": SKILL.md + references/ + artifact templates
110
+ presets/expert-team/ the 「专家团模式」 preset: 12 role subagent tool instances
111
+ ```
112
+
113
+ The orchestration protocol lives in the skill rather than in code, so the team protocol can evolve
114
+ without a package release.
115
+
116
+ ## Development
117
+
118
+ ```sh
119
+ npm run test:all # 75 test files, zero dependencies, no install needed (this is what CI runs)
120
+ npm run rename <name> # re-brand a fork: syncs 4 spellings of the package name across 13 files
121
+ npm run check:name # verify no placeholder package name is left behind
122
+ ```
123
+
124
+ `npm run gate` (`gate:preset` / `gate:sync` / `gate:evidence` / `gate:bypass` / `gate:mutation`) is a
125
+ **developer-machine-only** set: `gate:sync` diffs the self-installed copies under your local
126
+ `$DSH_HOME`, and `gate:preset` borrows the Config schemas shipped inside your local dsh install
127
+ (the dsh path is auto-detected; override with `DSH_INSTALL`). Neither runs in CI.
128
+
129
+ ## Known limitations
130
+
131
+ - **The local HTTP routes do not yet validate Origin/Host**: the 11 overlay routes (including
132
+ `/file`, which can only read workspace files) currently check the HTTP method only. Keep `dsh web`
133
+ bound to `127.0.0.1`; same-origin hardening is planned.
134
+ - **Web profile only**: the overlay and routes need `webServer`. The command and artifacts still work without it.
135
+ - **Preset drift**: the bundled 「专家团模式」 is a copy of the official `standard` preset plus the role
136
+ tools; upstream preset restructuring needs a matching update here.
137
+ - Calls `git status --porcelain` (read-only) to judge artifact freshness.
138
+
139
+ ## License
140
+
141
+ MIT © yangdcm
package/README.md ADDED
@@ -0,0 +1,135 @@
1
+ # 专家团 · dsh-expert-team
2
+
3
+ [English](README.en.md) | 中文
4
+
5
+ [![npm](https://img.shields.io/npm/v/@yangdcm/dsh-expert-team)](https://www.npmjs.com/package/@yangdcm/dsh-expert-team)
6
+ [![license](https://img.shields.io/npm/l/@yangdcm/dsh-expert-team)](LICENSE)
7
+ [![CI](https://github.com/yangdcm/dsh-expert-team/actions/workflows/ci.yml/badge.svg)](https://github.com/yangdcm/dsh-expert-team/actions/workflows/ci.yml)
8
+
9
+ > **一句话组队交付**:`/team 做一个带登录的支付模块` —— 自动组建 12 角色专家团,走
10
+ > 澄清 → 调研 → 设计 → 规格评审 → 方案确认 → 实现 → 审查 → 测试 → 交付 的门控流水线,
11
+ > 实现者直接改你工作区的代码,全程留痕成可复核的工件。
12
+
13
+ 装在 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 上的 dsh 插件,
14
+ **零运行时依赖、无构建步骤、无安装钩子**。
15
+
16
+ ![质量门禁违规实时可见](docs/images/panel-gate.png)
17
+ ![成员模型与任务详情](docs/images/panel-live.png)
18
+ ![阶段推进与工件预览](docs/images/panel-flow.png)
19
+
20
+ <sub>截图即真实浮层:门禁违规横幅、角色编制(谁在跑、用哪个模型)、任务详情与工件预览。</sub>
21
+
22
+ ---
23
+
24
+ ## 它解决什么
25
+
26
+ 单个 agent 干大活有三个固定失败模式:**上下文漂移**(长任务越做越偏)、**自己批自己**
27
+ (没人独立验证)、**返工不收敛**(同一个问题来回改)。专家团用四件事对付它们:
28
+
29
+ | 机制 | 做法 |
30
+ |---|---|
31
+ | **角色分工** | 12 个角色各带独立人设、工具边界(`toolFilter`)、委派深度(`maxDepth: 1`);产品/架构只读写计划工件,审查/安全只读,实现者才动代码 |
32
+ | **阶段门控** | 9 个阶段,每次交接走「结构化返回值 + 工件文件」双通道,不靠聊天记录传状态 |
33
+ | **质量门禁** | 状态机一致性由**插件代码强制**(不是提示词请求):任务未完成不能标 completed、质量问题必须由 qa/reviewer 裁决、覆盖率缺口、超轮次返工——违规**实时**显示在浮层并计入 `/team status` |
34
+ | **收敛与记账** | 每 run 记 token/耗时/首产物时间/收尾预算;`/team learn` 跨 run 蒸馏经验并在下次开工前回注 |
35
+
36
+ ## 角色与阶段
37
+
38
+ **12 角色**:产品(pm) · 架构(architect) · 调研(researcher) · 界面设计(ui) · 后端(backend) ·
39
+ 前端(frontend) · 数据(dba) · 安全审计(sec) · 评审(reviewer) · 测试(qa) · 运维(devops) · 文档(docs)。
40
+ 按任务复杂度裁剪:小活只起需要的角色。
41
+
42
+ **9 阶段**:`澄清 → 调研 → 设计 → 规格评审 → 方案确认 → 实现 → 审查 → 测试 → 交付`
43
+ (`/team --tier 快速档|标准档|严格档` 控制流程档位)。
44
+
45
+ ## 安装
46
+
47
+ **要求**
48
+
49
+ - `dsh web`(本包在 **0.1.5-rc.1** 上开发与验证;更早版本未经测试)
50
+ - Node.js ≥ 20
51
+ - 会话使用 **「专家团模式」** preset 时,12 个角色工具(`subagent_pm` / `subagent_architect` / …)才可用;
52
+ 否则自动退回通用 `subagent`(角色人设写进 prompt),功能不丢、只是少了配置层的边界保证
53
+
54
+ **方式一:插件市场(推荐)**
55
+
56
+ `dsh web` → **设置 → 插件市场** → 搜索「专家团」→ 一键安装 → 刷新页面。
57
+
58
+ **方式二:命令行**
59
+
60
+ ```sh
61
+ dsh plugin --profile web add @yangdcm/dsh-expert-team
62
+ # 然后重启 dsh web,使新 bundle 进入组合
63
+ ```
64
+
65
+ **方式三:从源码(开发/未发布时)**
66
+
67
+ ```sh
68
+ cd ~/.dsh/profiles/web
69
+ # package.json:dependencies 加 "@yangdcm/dsh-expert-team": "file:<本包绝对路径>"
70
+ # package.json:dsh.profile.bundles 加 "@yangdcm/dsh-expert-team"
71
+ pnpm install && dsh web
72
+ ```
73
+
74
+ > 首次 `/team` 会幂等地把 `expert-team` skill 与「专家团模式」preset 自举到
75
+ > `$DSH_HOME/skills/` 与 `$DSH_HOME/.agent-presets/`。
76
+
77
+ ## 快速上手
78
+
79
+ ```
80
+ /team 做一个带登录的支付模块 # 一句话组队(一次性,自动组队并交付)
81
+ /team --persist 重构订单模块 # 持久化活团队:成员可反复指挥、跨会话恢复
82
+ /team --no-code 评审现有 API 设计 # 只产出计划/评审/测试工件,不改代码
83
+ /team --confirm 大改版需求 # 先建 run、不自动派工,浮层点「执行」才开工
84
+ /team status # 所有 run 的阶段、成员、模型计划、实时违规
85
+ /team resume <run-id> # 跨会话恢复
86
+ ```
87
+
88
+ 完整命令(`/team canvas` 可视化画布、`/team codeindex` 代码索引、`/team learn` 自学习、
89
+ `/team limit` 配额、`/team settle` 冷启动清算……)见 `/team help`。
90
+
91
+ **产物落在哪**
92
+
93
+ - `<你的工作区>/team/<run-id>/` —— `SPEC / PLAN / TASKS / ROSTER / STATE / REVIEW / TEST / SUMMARY / RUN.log.md` 等工件
94
+ - `$DSH_HOME/expert-team/` —— 本机偏好与跨项目经验:`settings.json`、`session-runs.json`、`LEARNINGS.md`
95
+
96
+ ## 插件结构
97
+
98
+ ```
99
+ cordis.patch.yml 唯一的组合贡献:一个 host 面的 /team 命令行
100
+ lib/command.js /team 命令:解析 + 建工作区 + 装 skill + 触发团队 + 11 条浮层路由
101
+ lib/validate.js 状态机/质量门禁/容量上限的纯函数校验器
102
+ lib/tier.js 流程档位词表的唯一真源
103
+ lib/metrics/ token 记账、首产物耗时、收尾预算、METRICS 渲染
104
+ lib/routes/ 路由层共享件(统一 405/500/JSON 处理)
105
+ client.js 客户端浮层(模块加载器 bundle,仅 require('react'))
106
+ skills/expert-team/ 编排「大脑」:SKILL.md + references/ + 工件模板
107
+ presets/expert-team/ 「专家团模式」preset:12 个角色 subagent 工具实例
108
+ ```
109
+
110
+ 编排协议几乎全在 skill 里而非代码里 —— 这样团队协议可以随 skill 更新,不必改包。
111
+
112
+ ## 开发
113
+
114
+ ```sh
115
+ npm run test:all # 75 个测试文件,零依赖、无需 install(CI 跑的就是它)
116
+ npm run rename <新包名> # fork 后改名:自动同步 13 个文件里 4 种包名写法
117
+ npm run check:name # 检查占位包名残留
118
+ ```
119
+
120
+ `npm run gate`(`gate:preset` / `gate:sync` / `gate:evidence` / `gate:bypass` / `gate:mutation`)
121
+ 是**开发机专用**门禁:`gate:sync` 比对本机 `$DSH_HOME` 下的自举副本,`gate:preset` 借用本机
122
+ dsh 安装里插件自带的 Config schema(dsh 路径自动探测,可用 `DSH_INSTALL` 覆盖),因此**不在 CI 里跑**。
123
+
124
+ ## 已知限制
125
+
126
+ - **本地 HTTP 路由尚未做同源/Host 校验**:浮层用的 11 条路由(含只能读工作区文件的 `/file`)
127
+ 目前只校验 HTTP 方法。请把 dsh web 保持监听 `127.0.0.1`;同源加固在计划中。
128
+ - **仅 web profile**:浮层与路由依赖 `webServer`;无浮层时命令与工件仍然可用。
129
+ - **preset 漂移**:随包的「专家团模式」是官方 `standard` preset 的拷贝 + 角色工具,
130
+ 宿主若调整内置 preset 结构,需要同步更新。
131
+ - 会调用 `git status --porcelain`(只读)用于工件新鲜度判断。
132
+
133
+ ## License
134
+
135
+ MIT © yangdcm