@hedeqiang/dsh-nl2sql 0.10.0 → 0.11.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/CHANGELOG.md +30 -2
- package/README.en.md +33 -5
- package/README.md +32 -12
- package/channels/dingtalk.js +574 -0
- package/channels/http.js +63 -0
- package/channels/index.js +138 -0
- package/channels/lark.js +1208 -0
- package/channels/message.js +284 -0
- package/channels/telegram.js +679 -0
- package/channels/wecom.js +585 -0
- package/cordis.patch.yml +3 -3
- package/docs/CHANNELS.md +184 -0
- package/im.js +6 -509
- package/index.js +27 -18
- package/lark-bot.js +7 -604
- package/lib/client.js +1162 -199
- package/package.json +14 -9
- package/service/access.js +116 -22
- package/service/admin.js +29 -13
- package/service/bots.js +665 -0
- package/service/channels.js +379 -0
- package/service/datasources.js +31 -8
- package/service/push.js +7 -158
- package/service/shared.js +1 -1
- package/service/lark-actions.js +0 -223
- package/service/lark.js +0 -250
package/CHANGELOG.md
CHANGED
|
@@ -4,9 +4,37 @@
|
|
|
4
4
|
|
|
5
5
|
## [未发布]
|
|
6
6
|
|
|
7
|
+
## [0.11.2] - 2026-11-12
|
|
8
|
+
|
|
9
|
+
### 改进
|
|
10
|
+
- 看板:每个图表显示所属数据源(数据源已删除时提示);看板含多个数据源时显示「包含数据源」,并可切换「全部数据源 / 仅当前数据源」(按浏览器记住);只看当前数据源时拖拽排序不会打乱被隐藏的图表。
|
|
11
|
+
- 文档:README 改为以 npm 安装为主(插件页「添加插件」或 `dsh plugin add`),补充升级、卸载和从源码安装说明。
|
|
12
|
+
- 推送大结果时不再静默省略:消息中会注明「共 N 行,消息中显示前 M 行」。飞书卡片表格最多 50 行(客户端内分页),Telegram 20 行,企业微信、钉钉 10 行。
|
|
13
|
+
- 飞书应用机器人、Telegram 会把超出显示范围的结果作为完整数据 Excel 附件随消息发送(可在发送对话框取消,Agent 工具参数 `attachFull`);附件失败不影响消息本身,会在推送记录中提示。
|
|
14
|
+
|
|
15
|
+
## [0.11.1] - 2026-11-12
|
|
16
|
+
|
|
17
|
+
### 修复
|
|
18
|
+
- 中文界面下渠道类型、配置说明、推荐问题等显示为英文:读取 Harness 语言设置的方式有误(LocaleSnapshot 的 `active` 字段),已修正并加了回归测试。
|
|
19
|
+
|
|
20
|
+
### 新增
|
|
21
|
+
- GitHub Actions 发布流程:推送 `v*` 版本标签后自动检查、打包,并通过 npm 可信发布(OIDC,带来源证明)发布到 npm,同时创建 GitHub Release。
|
|
22
|
+
|
|
23
|
+
## [0.11.0] - 2026-11-12
|
|
24
|
+
|
|
25
|
+
### 新增
|
|
26
|
+
- 渠道架构:IM 平台改为适配器(`channels/`),统一的消息模型、能力声明、表单定义和机器人接口,详见 [docs/CHANNELS.md](docs/CHANNELS.md)。
|
|
27
|
+
- 新平台:Telegram(推送、长轮询机器人、按钮)、企业微信(群机器人推送;智能机器人长连接问答与推送)、钉钉(自定义机器人推送;企业内部应用机器人 Stream 模式问答与推送)。以上新平台仅用模拟服务测试,尚未在真实账号上验证。
|
|
28
|
+
- 成员身份支持多平台(`identities`),机器人按渠道配置,可同时运行多个。
|
|
29
|
+
- 页面:「渠道」按平台分组、两步添加(选平台与类型 → 按表单填写),能力标签、配置步骤、选择群聊、测试;成员页「机器人」总览;成员身份编辑;设置「渠道与机器人」。
|
|
30
|
+
- 问答页「试试这些问题」支持「换一批」;删除单条历史记录;「最近的提问」可删除并支持「显示更多」。
|
|
31
|
+
|
|
32
|
+
### 兼容
|
|
33
|
+
- 旧的飞书渠道、机器人配置、成员字段和设置在首次加载时自动迁移;旧的 RPC 与数据格式继续可用。
|
|
34
|
+
|
|
35
|
+
## [0.10.0] - 2026-11-12
|
|
36
|
+
|
|
7
37
|
### 新增
|
|
8
|
-
- 问答页「试试这些问题」支持「换一批」:问题池混合指标库、👍 问题、已验证样例和表结构模板,分页轮换。
|
|
9
|
-
- 删除单条历史记录:历史页每行可删除;问答页「最近的提问」可删除(同一问题的多次记录一起删除),并支持「显示更多」。
|
|
10
38
|
- 飞书回复卡片上的交互按钮:按维度拆分、为什么变化、明细、固定到看板(经长连接回传,服务端校验权限)。
|
|
11
39
|
- 业务知识「建议」:从 👍 反馈、重复出现的查询、常用聚合和取值映射中自动生成样例、指标、备注和词表建议,人工确认后采纳。
|
|
12
40
|
- 开源准备:MIT 许可证、README、贡献指南、安全策略、CI。
|
package/README.en.md
CHANGED
|
@@ -11,8 +11,10 @@ An enterprise NL2SQL plugin for DeepSeek Harness: connect databases, ask in plai
|
|
|
11
11
|
- **Asking:** in a Harness conversation through the `nl2sql_*` tools; results render as ECharts charts or tables.
|
|
12
12
|
- **Drill-down and "why did it change":** split by a dimension, show rows, rank dimensions by their contribution to a change.
|
|
13
13
|
- **Metric library and business knowledge:** glossary, governed metrics (`nl2sql_metric`), column notes, verified examples; import / export; accuracy evaluation against the examples.
|
|
14
|
-
- **Dashboards:** multiple boards, global filters, drag-to-reorder, three widths, snapshots, Excel export.
|
|
15
|
-
- **
|
|
14
|
+
- **Dashboards:** multiple boards, global filters, drag-to-reorder, three widths, snapshots, Excel export; a board may mix data sources — each chart shows its source and the board can be scoped to the current source.
|
|
15
|
+
- **Large results in IM:** messages say how many rows are shown; Lark app bots and Telegram attach the full data as Excel.
|
|
16
|
+
- **Channels:** Lark / Feishu, Telegram, WeCom and DingTalk through pluggable adapters ([docs/CHANNELS.md](docs/CHANNELS.md)); push Markdown and results (native charts, images or tables per platform), and @-mention bots that need no public URL.
|
|
17
|
+
- **Automation:** scheduled reports, metric alerts (threshold / change / anomaly / missing), schema change detection.
|
|
16
18
|
- **Safety:**
|
|
17
19
|
- read-only admission with per-dialect lexing, read-only transactions, server-side timeouts, streamed truncation;
|
|
18
20
|
- table / column access policies with masking, full-scan guard;
|
|
@@ -21,14 +23,40 @@ An enterprise NL2SQL plugin for DeepSeek Harness: connect databases, ask in plai
|
|
|
21
23
|
|
|
22
24
|
## Install
|
|
23
25
|
|
|
24
|
-
Requires DeepSeek Harness (desktop or `dsh web`).
|
|
26
|
+
Requires DeepSeek Harness 0.2 or later (desktop or `dsh web`). Published on npm as [`@hedeqiang/dsh-nl2sql`](https://www.npmjs.com/package/@hedeqiang/dsh-nl2sql).
|
|
27
|
+
|
|
28
|
+
[](https://www.npmjs.com/package/@hedeqiang/dsh-nl2sql)
|
|
29
|
+
|
|
30
|
+
**In Harness (recommended)**
|
|
31
|
+
|
|
32
|
+
1. Sidebar → **Plugins** → **Add plugin**.
|
|
33
|
+
2. Enter `@hedeqiang/dsh-nl2sql` (optionally with a version, e.g. `@hedeqiang/dsh-nl2sql@0.11.1`), install and enable it.
|
|
34
|
+
3. **Data Q&A** appears in the sidebar, and the Data Q&A preset is available for new conversations.
|
|
35
|
+
|
|
36
|
+
You can also ask the Harness agent: "install the plugin @hedeqiang/dsh-nl2sql".
|
|
37
|
+
|
|
38
|
+
**Command line**
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
dsh plugin --profile desktop add @hedeqiang/dsh-nl2sql # desktop app profile; dsh web uses "web" by default
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Then enable it on the **Plugins** page (or restart Harness).
|
|
45
|
+
|
|
46
|
+
**Upgrade:** update it from the plugin's details on the **Plugins** page, or run `dsh plugin --profile desktop update @hedeqiang/dsh-nl2sql`, then re-enable the plugin. Configuration and data live in `~/.dsh/nl2sql` and survive upgrades; older configuration is migrated on first load.
|
|
47
|
+
|
|
48
|
+
**Uninstall:** remove it on the **Plugins** page or with `dsh plugin --profile desktop remove @hedeqiang/dsh-nl2sql`. Data in `~/.dsh/nl2sql` is kept; delete the directory if you no longer need it. Database passwords live in the Harness credential store.
|
|
49
|
+
|
|
50
|
+
> All dependencies (mysql2, pg, ssh2, echarts, @resvg/resvg-js, @larksuiteoapi/node-sdk) ship prebuilt; no install scripts need to run.
|
|
51
|
+
|
|
52
|
+
**From source (development)**
|
|
25
53
|
|
|
26
54
|
```bash
|
|
27
|
-
git clone
|
|
55
|
+
git clone https://github.com/hedeqiang/dsh-nl2sql.git && cd dsh-nl2sql
|
|
28
56
|
pnpm install --ignore-scripts
|
|
29
57
|
```
|
|
30
58
|
|
|
31
|
-
|
|
59
|
+
Enter the directory's absolute path in **Plugins** → **Add plugin** (it is linked, so re-enabling the plugin picks up code changes), or ask the agent to install the directory with the plugin manager.
|
|
32
60
|
|
|
33
61
|
## Use
|
|
34
62
|
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# dsh-nl2sql · 数据问答
|
|
2
2
|
|
|
3
|
-
[DeepSeek Harness](https://github.com/deepseek-ai) 的企业级 NL2SQL 插件:连接数据库,用自然语言提问,Agent 写只读 SQL
|
|
3
|
+
[DeepSeek Harness](https://github.com/deepseek-ai) 的企业级 NL2SQL 插件:连接数据库,用自然语言提问,Agent 写只读 SQL、执行并在对话中画图;结果可以固定到看板、推送到飞书 / Telegram / 企业微信 / 钉钉,还能在群里直接 @机器人提问。
|
|
4
4
|
|
|
5
5
|
[English](README.en.md)
|
|
6
6
|
|
|
@@ -16,9 +16,11 @@
|
|
|
16
16
|
|
|
17
17
|
**看板与推送**
|
|
18
18
|
- 多看板、全局筛选(时间范围 / 维度)、拖拽排序、三档宽度、快照、Excel 导出。
|
|
19
|
-
-
|
|
19
|
+
- 一个看板可以放多个数据源的图表:每个图表标注所属数据源,可切换「全部数据源 / 仅当前数据源」。
|
|
20
|
+
- 推送大结果时注明「共 N 行,显示前 M 行」;飞书应用机器人和 Telegram 会附带完整数据 Excel。
|
|
21
|
+
- IM 渠道:飞书 / Lark、Telegram、企业微信、钉钉(推送 Markdown 与结果,图表按平台能力用原生图表、图片或表格);架构见 [docs/CHANNELS.md](docs/CHANNELS.md),新增平台只需实现一个适配器。
|
|
20
22
|
- 定时报告(基于 Harness 定时任务)、指标告警(阈值 / 环比 / 异常 / 无数据)、表结构变更检测。
|
|
21
|
-
-
|
|
23
|
+
- 群聊 @机器人提问:飞书长连接、Telegram 长轮询、企业微信智能机器人长连接、钉钉 Stream 模式,都不需要公网地址。
|
|
22
24
|
|
|
23
25
|
**安全与治理**
|
|
24
26
|
- 只读执行:按方言词法检查语句(MySQL / PostgreSQL / SQLite / ES),只读事务,PostgreSQL 使用扩展协议拒绝多语句,服务端超时,大结果流式截断。
|
|
@@ -28,22 +30,40 @@
|
|
|
28
30
|
|
|
29
31
|
## 安装
|
|
30
32
|
|
|
31
|
-
需要 DeepSeek Harness
|
|
33
|
+
需要 DeepSeek Harness 0.2 及以上(桌面版或 `dsh web`)。插件已发布到 npm:[`@hedeqiang/dsh-nl2sql`](https://www.npmjs.com/package/@hedeqiang/dsh-nl2sql)。
|
|
34
|
+
|
|
35
|
+
[](https://www.npmjs.com/package/@hedeqiang/dsh-nl2sql)
|
|
36
|
+
|
|
37
|
+
**方式一:在 Harness 里添加(推荐)**
|
|
38
|
+
|
|
39
|
+
1. 打开左侧栏 **插件** → **添加插件**。
|
|
40
|
+
2. 输入包名 `@hedeqiang/dsh-nl2sql`(可加版本,如 `@hedeqiang/dsh-nl2sql@0.11.1`),确认安装并启用。
|
|
41
|
+
3. 左侧栏出现 **数据问答**,新建对话时也可以选择「数据问答」预设。
|
|
42
|
+
|
|
43
|
+
也可以直接对 Harness 的 Agent 说:「安装插件 @hedeqiang/dsh-nl2sql」。
|
|
44
|
+
|
|
45
|
+
**方式二:命令行**
|
|
32
46
|
|
|
33
47
|
```bash
|
|
34
|
-
#
|
|
35
|
-
git clone <this repo> dsh-nl2sql && cd dsh-nl2sql
|
|
36
|
-
pnpm install --ignore-scripts # 依赖:mysql2、pg、ssh2、echarts、@larksuiteoapi/node-sdk、@resvg/resvg-js
|
|
48
|
+
dsh plugin --profile desktop add @hedeqiang/dsh-nl2sql # 桌面版的 profile 名为 desktop;dsh web 默认为 web
|
|
37
49
|
```
|
|
38
50
|
|
|
39
|
-
然后在
|
|
51
|
+
然后在 **插件** 页启用它(或重启 Harness)。
|
|
40
52
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
53
|
+
**升级**:在 **插件** 页的插件详情中更新,或执行 `dsh plugin --profile desktop update @hedeqiang/dsh-nl2sql`,然后重新启用插件。配置和数据保存在 `~/.dsh/nl2sql`,升级不会丢失;旧版本的配置会在首次加载时自动迁移。
|
|
54
|
+
|
|
55
|
+
**卸载**:在 **插件** 页移除,或 `dsh plugin --profile desktop remove @hedeqiang/dsh-nl2sql`。卸载不会删除 `~/.dsh/nl2sql` 中的数据;不再需要时可手动删除该目录,数据库密码等凭据在 Harness 凭据库中,可在设置中清除。
|
|
56
|
+
|
|
57
|
+
> 依赖(mysql2、pg、ssh2、echarts、@resvg/resvg-js、@larksuiteoapi/node-sdk)都使用预编译包,安装时不需要运行构建脚本。
|
|
58
|
+
|
|
59
|
+
**从源码安装(开发)**
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
git clone https://github.com/hedeqiang/dsh-nl2sql.git && cd dsh-nl2sql
|
|
63
|
+
pnpm install --ignore-scripts
|
|
44
64
|
```
|
|
45
65
|
|
|
46
|
-
|
|
66
|
+
在 **插件** → **添加插件** 中填入本目录的绝对路径(以链接方式安装,改代码后重新启用插件即可生效),或让 Agent 用插件管理器安装该目录。
|
|
47
67
|
|
|
48
68
|
## 使用
|
|
49
69
|
|