dsh-dingtalk 0.1.0 → 0.1.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.
Files changed (3) hide show
  1. package/README.en.md +116 -0
  2. package/README.md +17 -1
  3. package/package.json +60 -59
package/README.en.md ADDED
@@ -0,0 +1,116 @@
1
+ # dsh-dingtalk
2
+
3
+ [![Awesome DSH Plugin](https://awesome-dsh-plugin.com/badge.svg)](https://awesome-dsh-plugin.com)
4
+
5
+ DeepSeek Harness DingTalk group robot notification plugin: lets the agent **push Markdown / plain-text messages to a DingTalk group one-way**. Pure plugin implementation, zero core changes, works out of the box.
6
+
7
+ Pure Node implementation, **cross-platform** (one codebase for Windows / macOS / Linux), depends only on `node:crypto` and the built-in `fetch` — no runtime dependencies, no native binaries.
8
+
9
+ ## Tools
10
+
11
+ | Tool | Purpose |
12
+ |---|---|
13
+ | `dingtalk_notify` | Send a **Markdown** message to the configured DingTalk group (`title` heading + `text` Markdown body) |
14
+ | `dingtalk_text` | Send a **plain-text** message to the configured DingTalk group (`content`) |
15
+
16
+ Example:
17
+
18
+ > Send a message to the DingTalk group: title "Build complete", body "Pipeline #123 passed ✅".
19
+
20
+ ## Installation
21
+
22
+ ```sh
23
+ dsh plugin --profile web add dsh-dingtalk
24
+ ```
25
+
26
+ After installing, restart `dsh web`. The plugin ships with an empty config and **won't crash startup**; calling any `dingtalk_*` tool before configuration returns a clear Chinese configuration hint.
27
+
28
+ ## Step 1: Get the webhook and signing secret
29
+
30
+ Use DingTalk's **custom robot** method — **no enterprise app or admin permission needed**:
31
+
32
+ 1. Open the target DingTalk group → **Group settings** → **Smart group assistant** → **Add robot** → **Custom (connect a custom service via Webhook)**
33
+ 2. The robot name is arbitrary; under **Security settings, check "Sign" (加签)**, then finish
34
+ 3. Copy two things:
35
+ - **Webhook URL**: like `https://oapi.dingtalk.com/robot/send?access_token=xxxx`
36
+ - **Signing secret (secret)**: like `SECxxxx` (only appears after checking "Sign")
37
+
38
+ > For security settings it's recommended to check only "Sign". If you also check "Custom keywords", the robot validates whether the message contains the keyword — that's DingTalk server-side behavior, not handled by this plugin (see "Known limitations").
39
+
40
+ ## Configuration
41
+
42
+ In your profile's `cordis.patch.yml` (under `$DSH_HOME/profiles/<name>/`), override the `tool-dingtalk` line, then restart:
43
+
44
+ ```yaml
45
+ - id: tool-dingtalk
46
+ config:
47
+ webhook: https://oapi.dingtalk.com/robot/send?access_token=你的token
48
+ secret: SEC你的加签密钥 # 可选,但强烈建议;也可用环境变量 DSH_DINGTALK_SECRET
49
+ ```
50
+
51
+ ### Full configuration
52
+
53
+ | Field | Default | Description |
54
+ |---|---|---|
55
+ | `webhook` | required | Full webhook URL of the robot (`?access_token=...`) |
56
+ | `secret` | empty | Signing secret; when omitted, falls back to the `DSH_DINGTALK_SECRET` env var. Empty = no signing |
57
+ | `timeoutMs` | `10000` | Request timeout in milliseconds (1000–60000) |
58
+
59
+ ### Store the secret in an environment variable
60
+
61
+ If you don't want to write the secret into YAML, write only `webhook` and set an environment variable:
62
+
63
+ ```sh
64
+ # Windows PowerShell
65
+ $env:DSH_DINGTALK_SECRET = "SEC你的加签密钥"
66
+ # 或系统环境变量里加一条 DSH_DINGTALK_SECRET
67
+ ```
68
+
69
+ An explicit `secret` in YAML takes precedence over the environment variable.
70
+
71
+ ## Security notes
72
+
73
+ - **The webhook is the key to group notifications**: anyone who knows it can post to the group. Don't commit `cordis.patch.yml` to any Git repo; for the `secret`, prefer the `DSH_DINGTALK_SECRET` env var.
74
+ - This plugin is **one-way notification only** (agent → DingTalk group); it never reads messages from the group and has no two-way bot capability.
75
+ - This plugin performs no outbound telemetry; the `secret` is used in memory only to compute an HMAC signature, which is appended to the URL and sent to DingTalk's official endpoint.
76
+
77
+ ## Signing algorithm (matches the official one)
78
+
79
+ When a `secret` is present, the request URL appends `timestamp` (millisecond timestamp) and `sign`:
80
+
81
+ ```text
82
+ stringToSign = timestamp + "
83
+ " + secret
84
+ sign = urlencode(base64(HmacSHA256(secret, stringToSign)))
85
+ ```
86
+
87
+ Identical to this plugin's `computeDingTalkSign`, equivalent to `urllib.parse.quote_plus(base64(...))` in the official Python example.
88
+
89
+ ## Known limitations
90
+
91
+ - **One-way notification only**: no support for enterprise self-built apps, no receiving group messages / two-way bots (@robot replies, etc.); these are v0.2+ directions.
92
+ - **No automatic workaround for custom keyword validation**: if the robot checks "Custom keywords" on DingTalk's side, messages must contain the keyword or DingTalk returns an error (errcode 310000 can also appear for this reason). This plugin attributes 310000 to signing; please also check the keyword setting.
93
+ - **No settings page**: v0.1 is a "node half-body"; configuration only via `cordis.patch.yml` (+ env var). A Web settings page is planned for v0.2+.
94
+ - **Message types**: currently only Markdown (`dingtalk_notify`) and plain text (`dingtalk_text`); image / Link / FeedCard / ActionCard etc. come later.
95
+ - **Markdown rendering**: DingTalk robot Markdown syntax differs slightly from standard Markdown (e.g., headings, links); write according to DingTalk's syntax.
96
+
97
+ ## Error code reference
98
+
99
+ | errcode | Meaning | Suggestion |
100
+ |---|---|---|
101
+ | `0` | Success | — |
102
+ | `310000` | Signing validation failed (see the keyword note above) | Check that `secret` is correct and matches the robot's "Sign" setting |
103
+ | `120001` | `access_token` expired | Re-copy the webhook URL from the DingTalk group and overwrite `webhook` |
104
+ | other | Server error | Check the returned `errmsg` |
105
+
106
+ ## Development
107
+
108
+ ```sh
109
+ pnpm install
110
+ pnpm run build # tsc → lib/
111
+ pnpm test # 构建 + node --test(加签算法/配置解析/客户端封装/注册与中文报错)
112
+ ```
113
+
114
+ ## License
115
+
116
+ MIT. This is a community plugin, not affiliated with DeepSeek or DingTalk; `@deepseek-ai/*` is an officially reserved namespace.
package/README.md CHANGED
@@ -1,5 +1,14 @@
1
+ [English](README.en.md)
2
+
1
3
  # dsh-dingtalk
2
4
 
5
+ > **让 agent 在钉钉群里说话**:Markdown / 纯文本通知,加签安全,零依赖。
6
+
7
+ ![npm version](https://img.shields.io/npm/v/dsh-dingtalk?label=npm&color=blue) ![npm downloads](https://img.shields.io/npm/dm/dsh-dingtalk) ![license](https://img.shields.io/npm/l/dsh-dingtalk) ![stars](https://img.shields.io/github/stars/STARDUSTLC666/dsh-dingtalk?style=social)
8
+
9
+ [![Awesome DSH Plugin](https://awesome-dsh-plugin.com/badge.svg)](https://awesome-dsh-plugin.com)
10
+
11
+
3
12
  DeepSeek Harness 钉钉群机器人通知插件:让 agent 能**单向推送 Markdown / 纯文本消息到钉钉群**。纯插件实现,零核心改动,安装即可用。
4
13
 
5
14
  纯 Node 实现,**全平台通用**(Windows / macOS / Linux 同一份代码),只依赖 `node:crypto` 与内置 `fetch`,无运行时依赖、无原生二进制。
@@ -84,7 +93,7 @@ sign = urlencode(base64(HmacSHA256(secret, stringToSign)))
84
93
 
85
94
  与本插件 `computeDingTalkSign` 一致,等价于官方 Python 示例的 `urllib.parse.quote_plus(base64(...))`。
86
95
 
87
- ## 已知限制(v0.1)
96
+ ## 已知限制
88
97
 
89
98
  - **仅单向通知**:不支持企业自建应用、不支持接收群消息 / 双向机器人(@机器人 回复等),这些是 v0.2+ 的方向。
90
99
  - **不支持自定义关键词校验的自动规避**:如果机器人在钉钉侧勾选了「自定义关键词」,消息必须包含关键词,否则钉钉返回错误(errcode 310000 也可能因此出现)。本插件把 310000 归因于加签,请同时检查关键词设置。
@@ -112,3 +121,10 @@ pnpm test # 构建 + node --test(加签算法/配置解析/客户端封
112
121
  ## 协议
113
122
 
114
123
  MIT。这是一个社区插件,与 DeepSeek 官方及钉钉官方无关;`@deepseek-ai/*` 为官方保留命名空间。
124
+
125
+ ## 相关插件
126
+
127
+ - [dsh-calendar](https://github.com/STARDUSTLC666/dsh-calendar) — CalDAV 日历五件套
128
+ - [dsh-dingtalk](https://github.com/STARDUSTLC666/dsh-dingtalk) — 钉钉群通知(零依赖)
129
+ - [dsh-email](https://github.com/STARDUSTLC666/dsh-email) — 邮件六件套 + Web 设置页
130
+
package/package.json CHANGED
@@ -1,59 +1,60 @@
1
- {
2
- "name": "dsh-dingtalk",
3
- "version": "0.1.0",
4
- "description": "钉钉群机器人单向通知工具(DeepSeek Harness 插件):agent 推送 Markdown / 纯文本消息到钉钉群,支持加签安全模式。",
5
- "type": "module",
6
- "main": "lib/index.js",
7
- "types": "lib/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "types": "./lib/index.d.ts",
11
- "default": "./lib/index.js"
12
- },
13
- "./client": "./lib/client.js",
14
- "./cordis.patch.yml": "./cordis.patch.yml",
15
- "./package.json": "./package.json"
16
- },
17
- "files": [
18
- "lib",
19
- "cordis.patch.yml",
20
- "README.md"
21
- ],
22
- "scripts": {
23
- "build": "tsc",
24
- "prepare": "tsc",
25
- "prepublishOnly": "pnpm run build",
26
- "test": "pnpm run build && node --test \"test/*.test.mjs\""
27
- },
28
- "keywords": [
29
- "dsh-plugin",
30
- "deepseek-harness",
31
- "dsh",
32
- "dingtalk",
33
- "dingtalk-robot",
34
- "webhook"
35
- ],
36
- "author": "dsh-community",
37
- "license": "MIT",
38
- "packageManager": "pnpm@11.7.0",
39
- "engines": {
40
- "node": ">=20"
41
- },
42
- "dsh": {
43
- "bundle": {
44
- "patch": "./cordis.patch.yml"
45
- }
46
- },
47
- "devDependencies": {
48
- "@types/node": "^26.2.0",
49
- "typescript": "^5.7.3"
50
- },
51
- "repository": {
52
- "url": "https://github.com/STARDUSTLC666/dsh-dingtalk",
53
- "type": "git"
54
- },
55
- "bugs": {
56
- "url": "https://github.com/STARDUSTLC666/dsh-dingtalk/issues"
57
- },
58
- "homepage": "https://github.com/STARDUSTLC666/dsh-dingtalk#readme"
59
- }
1
+ {
2
+ "name": "dsh-dingtalk",
3
+ "version": "0.1.1",
4
+ "description": "钉钉群机器人单向通知工具(DeepSeek Harness 插件):agent 推送 Markdown / 纯文本消息到钉钉群,支持加签安全模式。",
5
+ "type": "module",
6
+ "main": "lib/index.js",
7
+ "types": "lib/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./lib/index.d.ts",
11
+ "default": "./lib/index.js"
12
+ },
13
+ "./client": "./lib/client.js",
14
+ "./cordis.patch.yml": "./cordis.patch.yml",
15
+ "./package.json": "./package.json"
16
+ },
17
+ "files": [
18
+ "lib",
19
+ "cordis.patch.yml",
20
+ "README.md",
21
+ "README.en.md"
22
+ ],
23
+ "scripts": {
24
+ "build": "tsc",
25
+ "prepare": "tsc",
26
+ "prepublishOnly": "pnpm run build",
27
+ "test": "pnpm run build && node --test \"test/*.test.mjs\""
28
+ },
29
+ "keywords": [
30
+ "dsh-plugin",
31
+ "deepseek-harness",
32
+ "dsh",
33
+ "dingtalk",
34
+ "dingtalk-robot",
35
+ "webhook"
36
+ ],
37
+ "author": "stardustlc",
38
+ "license": "MIT",
39
+ "packageManager": "pnpm@11.7.0",
40
+ "engines": {
41
+ "node": ">=20"
42
+ },
43
+ "dsh": {
44
+ "bundle": {
45
+ "patch": "./cordis.patch.yml"
46
+ }
47
+ },
48
+ "devDependencies": {
49
+ "@types/node": "^26.2.0",
50
+ "typescript": "^5.7.3"
51
+ },
52
+ "repository": {
53
+ "url": "git+https://github.com/STARDUSTLC666/dsh-dingtalk.git",
54
+ "type": "git"
55
+ },
56
+ "bugs": {
57
+ "url": "https://github.com/STARDUSTLC666/dsh-dingtalk/issues"
58
+ },
59
+ "homepage": "https://github.com/STARDUSTLC666/dsh-dingtalk#readme"
60
+ }