dsh-advisor-group 0.0.1
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/LICENSE +15 -0
- package/README.md +98 -0
- package/README.zh.md +103 -0
- package/cordis.patch.yml +10 -0
- package/lib/client.js +1847 -0
- package/lib/index.d.mts +252 -0
- package/lib/index.mjs +3871 -0
- package/package.json +87 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Apache License 2.0
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 dsh-advisor-group contributors
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# dsh-advisor-group
|
|
2
|
+
|
|
3
|
+
> A [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (DSH) plugin that lets the main model consult **multiple expert advisor models** in a retro chat-group card — for professional, long-tail world-knowledge, high-risk, or uncertain questions.
|
|
4
|
+
|
|
5
|
+
[](https://github.com/topics/dsh-plugin)
|
|
6
|
+
|
|
7
|
+
📖 [中文文档 / Chinese: README.zh.md](README.zh.md)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## ✨ Features
|
|
12
|
+
|
|
13
|
+
- **Auto-deepen consultation pipeline** — one `ask_advisors` call runs up to `maxRounds` rounds automatically: each round is a *driver deep-question → advisor A → advisor B (sees A) → advisor C (sees A+B) → …* sequential relay, closed by a driver-generated synthesis conclusion.
|
|
14
|
+
- **Zero-config driver model** — the driver formulation of deep follow-ups reuses the current agent's provider/model, so no extra API key or model setup is needed; it falls back to `discussion.driverModel` when the session header is unavailable.
|
|
15
|
+
- **Three ways to activate** — `@顾问群` mention (force-start), same question repeated 3 times without resolution, or main-model self-assessed confidence below the threshold.
|
|
16
|
+
- **Retro CRT chat cards** — green/amber/blue CRT themes, scanlines, LIVE/DONE headers, auto-expanded thinking panel with auto-scroll; advisor Markdown rendered with a link-protocol whitelist (headings, lists, code, quotes, links, tables).
|
|
17
|
+
- **Provider presets (11 platforms · 26 presets)** — DeepSeek, Moonshot Kimi, Kimi Code, Aliyun Bailian, Zhipu AI, OpenAI, Claude, Gemini, SiliconFlow, AIHubMix, OpenRouter (OpenAI/Anthropic-compatible variants included).
|
|
18
|
+
- **Security-minded by design** — API keys use official `SecretField` semantics (never returned to the browser; `apiKeysByProvider` key history is server-side only), SSRF-guarded diagnostics (https-only / loopback, no IP literals, no redirects), per-boot token auth on `/advisor-group/*` routes, and an atomic **configurable daily consultation cap** (default 50, can be disabled) persisted across restarts.
|
|
19
|
+
- **Runtime toggle** — `toggle_advisor_group` enables/disables the plugin and persists the flag to settings.
|
|
20
|
+
|
|
21
|
+
## ✅ Compatibility
|
|
22
|
+
|
|
23
|
+
| Surface | Status |
|
|
24
|
+
|---|---|
|
|
25
|
+
| Harness | DeepSeek Harness `0.1.2-rc.1` |
|
|
26
|
+
| Node | `^22.19.0 \|\| >=24.0.0` |
|
|
27
|
+
| Platforms | DSH Web (client bundle) + headless host logic |
|
|
28
|
+
|
|
29
|
+
## 📦 Installation
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
# 1. Install the plugin (one package, everything included)
|
|
33
|
+
dsh plugin --profile web add dsh-advisor-group
|
|
34
|
+
|
|
35
|
+
# 2. Restart DSH web
|
|
36
|
+
npx @deepseek-ai/dsh web
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
> **From source (development)**
|
|
40
|
+
> ```sh
|
|
41
|
+
> npm install --legacy-peer-deps --no-audit --no-fund
|
|
42
|
+
> npm run build
|
|
43
|
+
> dsh plugin --profile web add ./dsh-advisor-group-0.1.0.tgz # after npm pack
|
|
44
|
+
> ```
|
|
45
|
+
|
|
46
|
+
## 🚀 Quick start
|
|
47
|
+
|
|
48
|
+
1. Restart DSH web and hard-refresh the browser (`Ctrl+Shift+R`).
|
|
49
|
+
2. Go to **Settings → Plugins → Advisor Group**: configure your advisors (provider route + model; use *获取模型列表* to pull the authoritative model list) and tune `maxRounds`, thresholds, and the UI theme.
|
|
50
|
+
3. Just start a conversation:
|
|
51
|
+
- type `@顾问群` in your question to force a consultation, or
|
|
52
|
+
- ask a professional/uncertain question — the plugin escalates automatically when appropriate.
|
|
53
|
+
|
|
54
|
+
`ask_advisors` tools available to the model: `ask_advisors`, `toggle_advisor_group`.
|
|
55
|
+
|
|
56
|
+
## ⚙️ Configuration
|
|
57
|
+
|
|
58
|
+
| Key | Type | Default | Description |
|
|
59
|
+
|---|---|---|---|
|
|
60
|
+
| `enabled` | boolean | `true` | Enable advisor group |
|
|
61
|
+
| `discussion.maxRounds` | number | `2` | Total rounds of the auto-deepen pipeline (each round = driver question + all advisors in relay) |
|
|
62
|
+
| `discussion.maxAdvisorsPerCall` | number | `3` | Max advisors per call (1–10) |
|
|
63
|
+
| `discussion.autoDeepen` | boolean | `true` | Run the auto-deepen pipeline (driver follow-ups + final synthesis) |
|
|
64
|
+
| `discussion.driverModel` | object | – | Fallback driver model `{provider, model}` when the session header cannot be read |
|
|
65
|
+
| `discussion.advisorTimeoutMs` | number | `600000` | Per-advisor call timeout (ms, 1000–600000), applied to both channels |
|
|
66
|
+
| `quota.enabled` | boolean | `true` | Enable the daily new-consultation cap (cost safety valve) |
|
|
67
|
+
| `quota.maxPerDay` | number | `50` | Max new consultations per UTC day (1–100000); ignored when `quota.enabled` is `false` |
|
|
68
|
+
| `trigger.requireClassifier` | boolean | `true` | Run the pre-classifier before starting |
|
|
69
|
+
| `trigger.allowWebFallback` | boolean | `true` | Allow classifier to recommend web search |
|
|
70
|
+
| `trigger.confidenceThreshold` | number | `0.6` | Escalate when main-model confidence is below this |
|
|
71
|
+
| `ui.theme` | string | `retro-green` | Chat card theme (`retro-green` / `retro-amber` / `retro-blue`) |
|
|
72
|
+
| `ui.showTimestamps` | boolean | `true` | Show timestamps |
|
|
73
|
+
| `ui.autoExpand` | boolean | `true` | Auto-expand card |
|
|
74
|
+
| `advisors` | array | `[]` | Advisor list (provider/model/baseURL/apiKey/apiKeyEnv/protocol…, keys are `role('secret')`) |
|
|
75
|
+
|
|
76
|
+
> `discussion.parallel` and `discussion.stopOnConsensus` are deprecated leftovers kept only for stored-config compatibility.
|
|
77
|
+
|
|
78
|
+
## 🔒 Security & privacy
|
|
79
|
+
|
|
80
|
+
- Direct API keys can be stored in the DSH `settings.yaml` (marked secret, never returned to the browser by `describe`); prefer `apiKeyEnv` (env-var mode) if you don't want keys on disk.
|
|
81
|
+
- `/advisor-group/*` routes use a per-boot shared token for local single-user use — **not** multi-user auth. Add a reverse-proxy auth layer before LAN exposure.
|
|
82
|
+
- Diagnostics endpoints resolve the real key server-side and validate the target URL against an https-only / loopback SSRF guard; DNS-rebinding protection is a documented out-of-scope limitation.
|
|
83
|
+
- The daily consultation cap (configurable via `quota.*`; default 50; can be disabled) is persisted to `$DSH_HOME/storages/advisor-group/daily-guard.json` (UTC day key), so restarts don't reset it.
|
|
84
|
+
- Classifier shadow mode appends one observation sample per non-forced classification (read-only `/advisor-group/shadow`), used for threshold tuning only — never influences behavior.
|
|
85
|
+
- **`advisorTools: 'all'` is an elevated-risk scope.** It exposes every session-visible tool to the advisor models, including writable/execution ones (`pwsh`, `bash`, `write`, config/SSH tools), executed through the official guarded pipeline. Only enable it for advisors you trust (e.g., your own local models), keep them on the direct-http channel, and note that every non-read-only invocation is logged with `console.warn` for audit. Prefer the default `readonly` (read/grep/glob/web_search/web_fetch/scan_discover/list_imported_sessions) or `off`.
|
|
86
|
+
|
|
87
|
+
## 🛠️ Development
|
|
88
|
+
|
|
89
|
+
```sh
|
|
90
|
+
npm install --legacy-peer-deps --no-audit --no-fund
|
|
91
|
+
npm run typecheck
|
|
92
|
+
npm test # 64 tests, incl. provider streaming contracts against a local fake LLM server
|
|
93
|
+
npm run build # tsdown; client bundle must NOT be built with minify: true
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## 📄 License
|
|
97
|
+
|
|
98
|
+
[Apache License 2.0](LICENSE) © 2026 dsh-advisor-group contributors.
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# dsh-advisor-group
|
|
2
|
+
|
|
3
|
+
> [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(DSH)插件:主模型在遇到**专业、长尾世界知识、高风险或不确定**的问题时,召集多位**专家顾问模型**,在复古 CRT 聊天组卡片中真流式对话。
|
|
4
|
+
|
|
5
|
+
[](https://github.com/topics/dsh-plugin)
|
|
6
|
+
|
|
7
|
+
[English: README.md](README.md)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## ✨ 功能特性
|
|
12
|
+
|
|
13
|
+
- **自动深挖咨询流水线**:一次 `ask_advisors` 自动跑满 `maxRounds` 轮——每轮 = *驱动模型深挖追问 → 顾问 A → 顾问 B(看到 A)→ 顾问 C(看到 A+B)→ …* 顺序接力,最后驱动模型产出**综合结论**。
|
|
14
|
+
- **顾问可调用会话工具(2026-09-05)**:顾问模型回答前可调用**当前 DSH 会话可见的工具**(默认只读白名单:read/grep/glob/web_search/web_fetch…)——走官方 `ctx.tools` 完整管线(作用域分发、守卫、前置/后置策略),循环上限 4 轮后强制文字作答;每次调用在卡片 💭 面板实时播报(`🔧 模型请求调用工具…`+结果摘要)。可在设置中切到「全部会话工具」或「关闭」。
|
|
15
|
+
- **停止后可继续**:用户停止或 dsh 重启后,卡片「⏹ 停止」原位变为「▶ 继续聊天」→ `POST /advisor-group/resume` → 从断点续跑(本轮未答的顾问补答、已答的不重问、剩余轮次照常、最终照常生成综合结论);会话快照持久化到 `storages/advisor-group/sessions/<id>.json`(仅存顾问 id/消息/状态,不含任何凭据),跨重启自动恢复。
|
|
16
|
+
- **驱动模型零配置复用**:深挖追问由驱动模型生成,直接复用会话当前 agent 的 provider/model——无需额外配 Key 或模型;会话头不可读时回退 `discussion.driverModel`。
|
|
17
|
+
- **三种触发方式**:`@顾问群` 提及(强制启动)、同一问题重复 3 次未解决、主模型自评置信度低于阈值。
|
|
18
|
+
- **复古 CRT 聊天组卡片**:绿/琥珀/蓝三主题、扫描线、LIVE/DONE 标题、💭 思考面板默认展开自动滚底;顾问正文走轻量 Markdown 渲染(链接协议白名单,支持标题/列表/代码/引用/链接/表格)。
|
|
19
|
+
- **供应商预设(11 平台 · 26 预设)**:DeepSeek、月之暗面 Kimi、Kimi Code、阿里云百炼、智谱 AI、OpenAI、Claude、Gemini、硅基流动、AIHubMix、OpenRouter(含 OpenAI / Anthropic 兼容变体)。
|
|
20
|
+
- **注重安全**:API Key 采用官方 `SecretField` 语义(浏览器永不回显;`apiKeysByProvider` 供应商密钥档案仅存服务端);诊断端点 SSRF 加固(仅 https/loopback、拒绝 IP 字面量与重定向);`/advisor-group/*` 路由启动期 token 鉴权;每日新咨询**可配置原子配额**(默认 50,可关闭),持久化跨重启。
|
|
21
|
+
- **运行时开关**:`toggle_advisor_group` 启停插件并持久化到设置。
|
|
22
|
+
|
|
23
|
+
## ✅ 兼容性
|
|
24
|
+
|
|
25
|
+
| 项目 | 状态 |
|
|
26
|
+
|---|---|
|
|
27
|
+
| Harness | DeepSeek Harness `0.1.2-rc.1` |
|
|
28
|
+
| Node | `^22.19.0 \|\| >=24.0.0` |
|
|
29
|
+
| 平台 | DSH Web(客户端 bundle)+ headless 宿主逻辑 |
|
|
30
|
+
|
|
31
|
+
## 📦 安装
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
# 1. 安装插件(一个包全都有)
|
|
35
|
+
dsh plugin --profile web add dsh-advisor-group
|
|
36
|
+
|
|
37
|
+
# 2. 重启 dsh web
|
|
38
|
+
npx @deepseek-ai/dsh web
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
> **从源码开发安装**
|
|
42
|
+
> ```sh
|
|
43
|
+
> npm install --legacy-peer-deps --no-audit --no-fund
|
|
44
|
+
> npm run build
|
|
45
|
+
> dsh plugin --profile web add ./dsh-advisor-group-0.1.0.tgz # 先 npm pack
|
|
46
|
+
> ```
|
|
47
|
+
|
|
48
|
+
## 🚀 快速开始
|
|
49
|
+
|
|
50
|
+
1. 重启 dsh web 并硬刷新浏览器(`Ctrl+Shift+R`)。
|
|
51
|
+
2. 打开 **设置 → 插件 → 顾问群**:配置顾问(提供商路由 + 模型,用「获取模型列表」拉取权威清单),按需调整 `maxRounds`、阈值与 UI 主题。
|
|
52
|
+
3. 直接开聊:
|
|
53
|
+
- 提问时带 `@顾问群` 强制发起咨询,或
|
|
54
|
+
- 直接提专业/不确定的问题——插件会按需自动升级。
|
|
55
|
+
|
|
56
|
+
模型可用工具:`ask_advisors`、`toggle_advisor_group`。
|
|
57
|
+
|
|
58
|
+
## ⚙️ 配置项
|
|
59
|
+
|
|
60
|
+
| 键 | 类型 | 默认 | 说明 |
|
|
61
|
+
|---|---|---|---|
|
|
62
|
+
| `enabled` | boolean | `true` | 启用顾问群 |
|
|
63
|
+
| `discussion.maxRounds` | number | `2` | 自动深挖流水线总轮数(每轮 = 驱动追问 + 全体顾问接力) |
|
|
64
|
+
| `discussion.maxAdvisorsPerCall` | number | `3` | 单次咨询最大顾问数(1–10) |
|
|
65
|
+
| `discussion.autoDeepen` | boolean | `true` | 启用自动深挖流水线(驱动追问 + 综合结论) |
|
|
66
|
+
| `discussion.driverModel` | object | – | 兜底驱动模型 `{provider, model}`(会话头信息不可读时) |
|
|
67
|
+
| `discussion.advisorTimeoutMs` | number | `600000` | 单顾问调用超时(毫秒,1000–600000),双通道均生效 |
|
|
68
|
+
| `discussion.driverTimeoutMs` | number | `600000` | 驱动模型生成超时(深挖追问/综合结论;毫秒,1000–1200000) |
|
|
69
|
+
| `discussion.advisorTools` | string | `'readonly'` | **未单独设置时的全局默认**顾问工具调用范围:`readonly`(只读白名单 read/grep/glob/web_search/web_fetch…)|`all`(全部会话可见工具,含可写,慎用)|`off`(关闭)。仅直连通道(OpenAI/Anthropic)支持工具调用,DSH 内置通道的顾问需配 `baseURL`/`apiKey`/`apiKeyEnv` 直连(详情见「功能特性」)。 |
|
|
70
|
+
| `advisors[].tools` | string | – | 每个顾问的**单独**工具调用范围覆盖(`readonly`/`all`/`off`;未设置时跟随全局默认);设置卡片上:可直连的顾问显示下拉,DSH 内置通道顾问显示“不可配置”。 |
|
|
71
|
+
| `quota.enabled` | boolean | `true` | 启用每日咨询上限(成本安全阀) |
|
|
72
|
+
| `quota.maxPerDay` | number | `50` | 每日 UTC 日周期内最多新咨询次数(1–100000);`quota.enabled=false` 时不生效 |
|
|
73
|
+
| `trigger.requireClassifier` | boolean | `true` | 发起前先跑前置分类器 |
|
|
74
|
+
| `trigger.allowWebFallback` | boolean | `true` | 分类器建议联网搜索时返回该提示 |
|
|
75
|
+
| `trigger.confidenceThreshold` | number | `0.6` | 主模型置信度低于该值时升级 |
|
|
76
|
+
| `ui.theme` | string | `retro-green` | 卡片主题(retro-green / retro-amber / retro-blue) |
|
|
77
|
+
| `ui.showTimestamps` | boolean | `true` | 显示时间戳 |
|
|
78
|
+
| `ui.autoExpand` | boolean | `true` | 自动展开卡片 |
|
|
79
|
+
| `advisors` | array | `[]` | 顾问列表(provider/model/baseURL/apiKey/apiKeyEnv/protocol…,key 均标 `role('secret')`) |
|
|
80
|
+
|
|
81
|
+
> `discussion.parallel` 与 `discussion.stopOnConsensus` 为弃用遗留项,仅保留以兼容已存配置。
|
|
82
|
+
|
|
83
|
+
## 🔒 安全与隐私
|
|
84
|
+
|
|
85
|
+
- 直连 API Key 可存于 DSH `settings.yaml`(标 secret,官方 `describe` 绝不回传浏览器);不想落盘请用 `apiKeyEnv` 环境变量模式。
|
|
86
|
+
- `/advisor-group/*` 路由为**单机共享 token**(本地单用户使用),不是多用户鉴权;暴露局域网必须外层加反代鉴权。
|
|
87
|
+
- 诊断端点服务端按存档 key 解析真实值再打供应商,并对目标 URL 做 https-only/loopback SSRF 校验;DNS rebinding 记为文档化已知边界。
|
|
88
|
+
- 每日咨询上限(`quota.*` 可配置,默认 50、可关闭)持久化在 `$DSH_HOME/storages/advisor-group/daily-guard.json`(UTC 日切),重启不再归零。
|
|
89
|
+
- 分类器影子模式:每次非强制分类追加一条观测样本(只读 `/advisor-group/shadow`),仅用于阈值调优,绝不干预行为。
|
|
90
|
+
- **`advisorTools: 'all'` 属于高风险作用域**:会把会话可见的**全部工具**(含 `pwsh`/`bash`/`write`、配置/SSH 等可写/执行类)暴露给顾问模型(经官方守卫管线执行)。仅建议为可信的本地模型启用,并保证走 direct-http 通道;每次**非只读**工具调用都会以 `console.warn` 留审计痕迹。默认请用 `readonly`(read/grep/glob/web_search/web_fetch/scan_discover/list_imported_sessions)或 `off`。
|
|
91
|
+
|
|
92
|
+
## 🛠️ 开发
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
npm install --legacy-peer-deps --no-audit --no-fund
|
|
96
|
+
npm run typecheck
|
|
97
|
+
npm test # 64 单测(含本地假 LLM 服务器上的供应商流式契约)
|
|
98
|
+
npm run build # tsdown;客户端 bundle 禁用 minify: true
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## 📄 许可证
|
|
102
|
+
|
|
103
|
+
[Apache License 2.0](LICENSE) © 2026 dsh-advisor-group contributors.
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# dsh-advisor-group bundle layer: register the scaffolded plugin as a bundle row.
|
|
2
|
+
# This file is the `dsh.bundle.patch` layer (see package.json#dsh.bundle.patch).
|
|
3
|
+
# Layer semantics: a YAML array of row verbs; `insert` adds plugin rows to the
|
|
4
|
+
# composed config. A row's `id` must be unique within the layer stack; `name`
|
|
5
|
+
# resolves the plugin module through the installed package (package.json#main).
|
|
6
|
+
- insert:
|
|
7
|
+
# `id`: stable row identifier used by later layers to override this row.
|
|
8
|
+
- id: dsh-advisor-group
|
|
9
|
+
# `name`: the module the loader imports; resolves to this package entry.
|
|
10
|
+
name: dsh-advisor-group
|