@michengai/dsh-im-connect 0.1.37 → 0.1.39
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 +17 -1
- package/CHANGELOG.zh-CN.md +17 -1
- package/README.en.md +60 -65
- package/README.md +60 -65
- package/SECURITY.md +7 -2
- package/client.js +31 -298
- package/lib/channels/channel-image-download.d.ts +22 -0
- package/lib/channels/channel-image-download.d.ts.map +1 -0
- package/lib/channels/channel-image-download.js +179 -0
- package/lib/channels/channel-image-download.js.map +1 -0
- package/lib/channels/dingtalk-token-cache.d.ts +18 -0
- package/lib/channels/dingtalk-token-cache.d.ts.map +1 -0
- package/lib/channels/dingtalk-token-cache.js +48 -0
- package/lib/channels/dingtalk-token-cache.js.map +1 -0
- package/lib/channels/dingtalk.d.ts +17 -4
- package/lib/channels/dingtalk.d.ts.map +1 -1
- package/lib/channels/dingtalk.js +111 -18
- package/lib/channels/dingtalk.js.map +1 -1
- package/lib/channels/factory.d.ts.map +1 -1
- package/lib/channels/factory.js +6 -3
- package/lib/channels/factory.js.map +1 -1
- package/lib/channels/feishu.d.ts +30 -2
- package/lib/channels/feishu.d.ts.map +1 -1
- package/lib/channels/feishu.js +141 -26
- package/lib/channels/feishu.js.map +1 -1
- package/lib/channels/image-host-policy.d.ts +4 -0
- package/lib/channels/image-host-policy.d.ts.map +1 -0
- package/lib/channels/image-host-policy.js +24 -0
- package/lib/channels/image-host-policy.js.map +1 -0
- package/lib/channels/qq.d.ts +1 -0
- package/lib/channels/qq.d.ts.map +1 -1
- package/lib/channels/qq.js +89 -18
- package/lib/channels/qq.js.map +1 -1
- package/lib/channels/telegram.d.ts.map +1 -1
- package/lib/channels/telegram.js +121 -16
- package/lib/channels/telegram.js.map +1 -1
- package/lib/channels/wecom.d.ts +8 -2
- package/lib/channels/wecom.d.ts.map +1 -1
- package/lib/channels/wecom.js +60 -11
- package/lib/channels/wecom.js.map +1 -1
- package/lib/channels/weixin.d.ts.map +1 -1
- package/lib/channels/weixin.js +169 -17
- package/lib/channels/weixin.js.map +1 -1
- package/lib/client.js +31 -298
- package/lib/engine/gateway.d.ts +2 -0
- package/lib/engine/gateway.d.ts.map +1 -1
- package/lib/engine/gateway.js +48 -11
- package/lib/engine/gateway.js.map +1 -1
- package/lib/engine/image-input.d.ts +8 -0
- package/lib/engine/image-input.d.ts.map +1 -0
- package/lib/engine/image-input.js +31 -0
- package/lib/engine/image-input.js.map +1 -0
- package/lib/engine/router.d.ts.map +1 -1
- package/lib/engine/router.js +29 -19
- package/lib/engine/router.js.map +1 -1
- package/lib/manager.d.ts +0 -10
- package/lib/manager.d.ts.map +1 -1
- package/lib/manager.js +231 -203
- package/lib/manager.js.map +1 -1
- package/package.json +1 -1
- package/src/channels/channel-image-download.ts +154 -0
- package/src/channels/dingtalk-token-cache.ts +39 -0
- package/src/channels/dingtalk.ts +106 -27
- package/src/channels/factory.ts +6 -3
- package/src/channels/feishu.ts +126 -24
- package/src/channels/image-host-policy.ts +21 -0
- package/src/channels/qq.ts +80 -26
- package/src/channels/telegram.ts +105 -16
- package/src/channels/wecom.ts +57 -12
- package/src/channels/weixin.ts +124 -14
- package/src/engine/gateway.ts +35 -6
- package/src/engine/image-input.ts +26 -0
- package/src/engine/router.ts +28 -18
- package/src/manager.ts +116 -84
package/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,23 @@
|
|
|
4
4
|
|
|
5
5
|
The five most recent published versions are listed below. Git tags and GitHub Releases now mirror these entries; historical sections retain links to their original release commits.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## 0.1.39 - 2026-09-09
|
|
8
|
+
|
|
9
|
+
- Remove the unused legacy composer component while preserving the current host composer entry.
|
|
10
|
+
|
|
11
|
+
- Unified settings headings, descriptions, and action layouts; maintenance controls no longer squeeze titles or versions. The layout adapts to native DSH settings without Codex UI.
|
|
12
|
+
- Keep account lists and details side by side in equal-width columns with compact channel rows; fix box sizing that caused horizontal overflow in the native settings dialog.
|
|
13
|
+
|
|
14
|
+
## 0.1.38 - 2026-09-08
|
|
15
|
+
|
|
16
|
+
- Fix #11: move the settings API to `/api/dsh-im-connect`, following the REST prefix used by other DSH plugins. The route uses DSH’s public `connection.requestRejection`, preserving trusted-host, Origin, and authority-bound browser-cookie checks behind reverse proxies. Local requests also require login; unavailable authentication fails closed with retry/upgrade guidance.
|
|
17
|
+
- Keep account, model, pairing, and session routes unchanged; send same-origin credentials explicitly, disable management caching, and cover real Host authentication plus frontend transport regressions.
|
|
18
|
+
|
|
19
|
+
- Add native inbound images for WeChat, WeCom, DingTalk, Feishu, Lark, QQ, and Telegram through DSH Chat's current-session model checks and durable attachment admission; prevent account defaults from overriding Chat's selected model.
|
|
20
|
+
- Route QQ image downloads through the DNS-validated downloader while preserving whole-message budgets, cancellation, and deadlines. Allow administrators to configure additional exact image hosts per account instead of patching region-specific COS/OSS origins.
|
|
21
|
+
- Reuse DingTalk access tokens per account, coalesce concurrent token requests, and invalidate the cache on expiry, stop, or restart.
|
|
22
|
+
- Classify WeChat image failures and retry transient network/server failures within a bounded budget. Never downgrade failed image captions to text commands or retry/deliver stale input after stop.
|
|
23
|
+
- Extend image security, ordering, lifecycle, real host-admission, and durable-storage regression tests. Track live channel and vision-model verification separately from transport fixtures.
|
|
8
24
|
|
|
9
25
|
## 0.1.37 - 2026-09-07
|
|
10
26
|
|
package/CHANGELOG.zh-CN.md
CHANGED
|
@@ -4,7 +4,23 @@
|
|
|
4
4
|
|
|
5
5
|
以下记录最近发布的五个版本。Git 标签与 GitHub Release 现已和这些条目同步;历史条目继续保留原始发布提交链接。
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## 0.1.39 - 2026-09-09
|
|
8
|
+
|
|
9
|
+
- 移除未使用的旧输入框组件,保留当前宿主输入入口。
|
|
10
|
+
|
|
11
|
+
- 统一设置页标题、说明与操作布局,标题及版本不再被维护按钮挤压;适配原生 DSH 设置内容区,无需安装 Codex UI。
|
|
12
|
+
- 账号列表使用紧凑双行渠道条目,左右列表和详情保持等宽布局;修复原生设置弹窗中盒模型导致的横向溢出。
|
|
13
|
+
|
|
14
|
+
## 0.1.38 - 2026-09-08
|
|
15
|
+
|
|
16
|
+
- 修复 #11:设置页管理 API 迁至 `/api/dsh-im-connect`,遵循其他 DSH 插件的 REST 前缀。接口通过 DSH 公开的 `connection.requestRejection`,反向代理下保留可信 Host、Origin 和绑定访问地址的浏览器 Cookie 校验。本机请求也必须登录;认证不可用时安全关闭并提示稍后重试或升级。
|
|
17
|
+
- 保留账号、模型、扫码与会话管理路由;前端显式携带同源凭据,禁止缓存管理数据,并增加真实宿主认证及前端调用回归测试。
|
|
18
|
+
|
|
19
|
+
- 为微信、企业微信、钉钉、飞书、Lark、QQ 和 Telegram 接入原生图片消息,复用 DSH Chat 的当前会话模型判断、附件校验与持久化;修复账号默认模型覆盖 Chat 会话模型的问题。
|
|
20
|
+
- QQ 图片下载统一使用连接时 DNS 校验的安全下载器,保留整条消息大小预算、取消与超时;支持管理员按账号配置额外的精确图片主机,避免为区域 COS/OSS 地址反复修改代码。
|
|
21
|
+
- 钉钉图片下载复用账号级 access token 缓存,合并并发取 token 请求,并在到期、停止或重新连接时失效。
|
|
22
|
+
- 微信图片下载区分失败原因,对瞬时网络/服务端故障进行有限重试;失败时不把图片附言降级为纯文字指令,停止后不继续重试或投递旧消息。
|
|
23
|
+
- 增加图片安全、顺序、生命周期、宿主图片准入和附件持久化回归测试;真实渠道与视觉模型联调状态单独记录,不以自动化夹具替代。
|
|
8
24
|
|
|
9
25
|
## 0.1.37 - 2026-09-07
|
|
10
26
|
|
package/README.en.md
CHANGED
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
|
|
23
23
|
## Features
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
25
|
+
Send tasks to your local DSH through your usual messenger, even when you are away from the computer. Receive replies, answer questions, and handle tool approvals in the same chat.
|
|
26
|
+
|
|
27
|
+
- **Connect familiar platforms**: DingTalk, Feishu, Lark, WeChat, WeCom, QQ, and Telegram.
|
|
28
|
+
- **Configure accounts separately**: each account has its own workspace, model, reasoning effort, permissions, and private-access mode.
|
|
29
|
+
- **Handle task interactions on your phone**: send work, read replies, and answer single- or multiple-choice questions. Approved users can approve or deny tools in private chats.
|
|
30
|
+
- **Keep chat records separate**: each IM chat has its own session under **Channels** in the web workspace.
|
|
31
|
+
- **Connect by QR code or credentials**: use the platform-specific setup in **Settings → IM Assistant**, then control message reception per account.
|
|
32
|
+
- **Control access**: groups trigger through mentions and private chats follow each account’s access settings, as detailed below.
|
|
33
33
|
|
|
34
34
|
## Who can drive the assistant
|
|
35
35
|
|
|
@@ -73,6 +73,18 @@ WeChat is QR-only and DM-only, so the same WeChat account that scanned can talk
|
|
|
73
73
|
|
|
74
74
|
✅ Ready = text in and out works | *WeChat = official iLink only, no reverse-engineered personal protocol | Groups still require an @ mention
|
|
75
75
|
|
|
76
|
+
## Image input
|
|
77
|
+
|
|
78
|
+
Image input follows DSH Chat's model-capability and attachment rules rather than guessing vision support from model names:
|
|
79
|
+
|
|
80
|
+
The receive paths cover WeChat, WeCom, DingTalk, Feishu, Lark, QQ, and Telegram. See the [image-input verification guide](docs/image-input.md) for protocol forms and live checks.
|
|
81
|
+
|
|
82
|
+
- Use the model currently selected for the IM session, not just the global default.
|
|
83
|
+
- When the model declares `image` support, store images as standard DSH attachments and submit image content to the model. Session history keeps image references rather than only local-path text.
|
|
84
|
+
- When the model explicitly excludes image input, tell the sender to switch models instead of silently dropping the image. Missing capability metadata follows Chat's compatibility behavior and is not, by itself, a reason to reject an image.
|
|
85
|
+
- Channel download limits, host attachment size and format limits, DM access rules, and group mention requirements still apply.
|
|
86
|
+
- This is inbound image analysis, not a promise that every channel supports sending images from the bot or generating images.
|
|
87
|
+
|
|
76
88
|
## Screenshots
|
|
77
89
|
|
|
78
90
|
Add accounts under each channel in **Settings → IM Assistant**. Expand a channel, select an account, and configure its workspace, model, permission, private access, and receive state independently on the right:
|
|
@@ -102,13 +114,18 @@ After connecting, drive the local assistant from each IM:
|
|
|
102
114
|
|
|
103
115
|
## DSH product ecosystem
|
|
104
116
|
|
|
105
|
-
|
|
117
|
+
For a ready-to-use workbench, download [DSH Codex Desktop](https://github.com/MichengAI/dsh-codex-desktop/releases). If you already use [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness), install any of these eight plugins individually. The desktop app includes all eight.
|
|
106
118
|
|
|
107
|
-
|
|
|
119
|
+
| Plugin | What you can do |
|
|
108
120
|
| --- | --- |
|
|
109
|
-
| [
|
|
110
|
-
| [
|
|
111
|
-
|
|
|
121
|
+
| [Codex UI](https://github.com/MichengAI/dsh-codex-ui) | Organize projects and conversations, search tasks, and navigate chat turns |
|
|
122
|
+
| [IM Connect](https://github.com/MichengAI/dsh-im-connect) | Send tasks and receive replies through your usual messenger |
|
|
123
|
+
| [Automation](https://github.com/MichengAI/dsh-automation) | Schedule tasks and review each run |
|
|
124
|
+
| [Skills Manager](https://github.com/MichengAI/dsh-skills-manager) | Find, enable, create, and import local skills |
|
|
125
|
+
| [Archive Manager](https://github.com/MichengAI/dsh-archive-manager) | Search, restore, or clean up archived conversations |
|
|
126
|
+
| [Agency Agents](https://github.com/MichengAI/dsh-agency-agents) | Choose and summon specialists for your task |
|
|
127
|
+
| [BTW](https://github.com/MichengAI/dsh-btw) | Ask side questions without interrupting the main task |
|
|
128
|
+
| [Simplify](https://github.com/MichengAI/dsh-simplify) | Use /simplify to improve code within your Git changes |
|
|
112
129
|
|
|
113
130
|
## Prerequisites
|
|
114
131
|
|
|
@@ -119,40 +136,16 @@ This product can be installed independently or used through the desktop app or W
|
|
|
119
136
|
|
|
120
137
|
## Installation
|
|
121
138
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
### Ask another agent to install it
|
|
125
|
-
|
|
126
|
-
This plugin runs inside DeepSeek Harness Web. Copy one of the sentences below into DSH, Codex, or WorkBuddy and let that agent install it into your local `web` profile.
|
|
139
|
+
The installation commands below use the official npm registry.
|
|
127
140
|
|
|
128
|
-
|
|
141
|
+
### Ask an agent to install it (recommended)
|
|
129
142
|
|
|
130
|
-
|
|
131
|
-
Install the latest DSH plugin @michengai/dsh-im-connect into my local web profile using the official npm registry: dsh plugin --profile web add @michengai/dsh-im-connect@latest --registry=https://registry.npmjs.org/. Then run dsh --profile web --dump-config, confirm im-connect is mounted, and remind me to restart DSH Web, hard-refresh the browser, and open Settings → IM Assistant.
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
From source:
|
|
143
|
+
Send the prompt below to any agent that can run terminal commands on your computer. Replace `web` with your actual profile. Once installed, use the plugin in DSH.
|
|
135
144
|
|
|
136
145
|
```text
|
|
137
|
-
Install the DSH plugin
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
| Product | How to use it |
|
|
141
|
-
| --- | --- |
|
|
142
|
-
| DSH | Send one of the sentences above to the current session. |
|
|
143
|
-
| Codex | Send one of the sentences above to Codex and let it install locally. |
|
|
144
|
-
| WorkBuddy | Send one of the sentences above to WorkBuddy; for a source install you can also paste `https://github.com/MichengAI/dsh-im-connect`. |
|
|
145
|
-
|
|
146
|
-
Codex and WorkBuddy only install the plugin. After that, open DSH Web and use **Settings → IM Assistant**.
|
|
147
|
-
|
|
148
|
-
You can also run the same npm command yourself:
|
|
149
|
-
|
|
150
|
-
```powershell
|
|
151
|
-
dsh plugin --profile web add @michengai/dsh-im-connect@latest --registry=https://registry.npmjs.org/
|
|
146
|
+
Install the DSH plugin @michengai/dsh-im-connect into my local web profile by running: dsh plugin --profile web add @michengai/dsh-im-connect@latest --registry=https://registry.npmjs.org/. Then run dsh --profile web --dump-config, confirm the configuration includes im-connect, and explain how to reload DSH and start using the plugin.
|
|
152
147
|
```
|
|
153
148
|
|
|
154
|
-
If `dsh` is not on PATH, replace the leading `dsh` with `npx --yes @deepseek-ai/dsh`.
|
|
155
|
-
|
|
156
149
|
### Install the latest package from the official npm registry
|
|
157
150
|
|
|
158
151
|
Run this from any PowerShell directory:
|
|
@@ -168,31 +161,13 @@ To pin a release, replace `@latest` with a version such as `@0.1.28`.
|
|
|
168
161
|
|
|
169
162
|
The configuration output should contain `im-connect`. Restart DSH Web and hard-refresh the browser. Do not copy client files manually: `dsh plugin add` also applies `cordis.patch.yml`.
|
|
170
163
|
|
|
171
|
-
### Install from source
|
|
172
|
-
|
|
173
|
-
Use this for debugging or unpublished changes. The cloned directory becomes the plugin source path:
|
|
174
|
-
|
|
175
|
-
```powershell
|
|
176
|
-
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
|
177
|
-
$OutputEncoding = [System.Text.Encoding]::UTF8
|
|
178
|
-
Set-Location D:\Repository\deepseek-harness-plugin
|
|
179
|
-
git clone https://github.com/MichengAI/dsh-im-connect.git
|
|
180
|
-
Set-Location .\dsh-im-connect
|
|
181
|
-
npm install
|
|
182
|
-
npm test
|
|
183
|
-
dsh plugin --profile web add .
|
|
184
|
-
dsh --profile web --dump-config
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
Restart DSH Web and hard-refresh the browser. `dsh plugin ... add .` reads the package metadata and `cordis.patch.yml`; do not install by copying `lib` directly.
|
|
188
|
-
|
|
189
164
|
## Updates
|
|
190
165
|
|
|
191
166
|
The settings title shows the installed version and a **Check for updates** button. When a newer release is available, **Update automatically** runs only when the DSH CLI or Desktop update service is available; otherwise, the dialog provides a profile-specific manual command to copy and run.
|
|
192
167
|
|
|
193
168
|
## Usage
|
|
194
169
|
|
|
195
|
-
Open **Settings → IM Assistant**, select **Add account** under the target channel, then choose that account's workspace, model, permission, and private-access mode.
|
|
170
|
+
Open **Settings → IM Assistant**, select **Add account** under the target channel, then choose that account's workspace, model, permission, and private-access mode.
|
|
196
171
|
|
|
197
172
|
| Goal | Action | Notes |
|
|
198
173
|
| --- | --- | --- |
|
|
@@ -215,7 +190,7 @@ DingTalk replies prefer official AI Card streaming and fall back to plain text.
|
|
|
215
190
|
| Item | Current behavior |
|
|
216
191
|
| --- | --- |
|
|
217
192
|
| Access | Groups need no binding, only a mention. Each account can allow only approved users or all DM users; approved-only is the default, and WeChat / Feishu / Lark / QQ QR scanners are added to that account's allowlist automatically |
|
|
218
|
-
| Management API |
|
|
193
|
+
| Management API | Uses `/api/dsh-im-connect`, following the REST prefix used by other DSH plugins. It delegates Host, Origin, and Cookie checks to Host `connection.requestRejection`, including local requests. Unavailable authentication returns 503; mutations retain JSON, client-header, and 1 MiB limits |
|
|
219
194
|
| Secrets | WeChat tokens and other secrets prefer DSH `ctx.credentials`; otherwise they use plaintext `%DSH_HOME%\dsh-im-connect\secrets.json`, restricted to the current user and never safe to sync or share |
|
|
220
195
|
| Account state | `channels.json` stores per-account workspace, model, permission, private access, enablement, and credential refs, not raw secrets |
|
|
221
196
|
| Browser payloads | Never include tokens, secrets, App Secrets, or internal error details |
|
|
@@ -223,14 +198,32 @@ DingTalk replies prefer official AI Card streaming and fall back to plain text.
|
|
|
223
198
|
| Tool approval | Only a user on the current account's allowlist can grant or deny in a DM. Even when all DM users may chat, unapproved users cannot approve tools; approvals cannot cross conversations or come from groups |
|
|
224
199
|
| Interactive questions | Single-choice, multiple-choice, and custom questions return to the originating IM conversation; one conversation handles them in order, and only the initiating user can answer in a group |
|
|
225
200
|
|
|
226
|
-
Do not
|
|
201
|
+
Keep the DSH backend listening on loopback. Remote access should use a controlled HTTPS reverse proxy, the actual authority in the Host's `trustedHosts`, and a login through that authority. Do not spoof localhost or remove authentication to bypass 403. Image-download `additionalImageHosts` does not configure management access; see [management authentication](SECURITY.md#管理面). Permission presets use the same host sandbox-policy values as Chat; `danger-full-access` does not wrap a sandbox.
|
|
227
202
|
|
|
228
203
|
## Secondary development
|
|
229
204
|
|
|
205
|
+
### Install from source
|
|
206
|
+
|
|
207
|
+
Use this for debugging or unpublished changes. The cloned directory becomes the plugin source path:
|
|
208
|
+
|
|
209
|
+
```powershell
|
|
210
|
+
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
|
211
|
+
$OutputEncoding = [System.Text.Encoding]::UTF8
|
|
212
|
+
Set-Location D:\Repository\deepseek-harness-plugin
|
|
213
|
+
git clone https://github.com/MichengAI/dsh-im-connect.git
|
|
214
|
+
Set-Location .\dsh-im-connect
|
|
215
|
+
npm install
|
|
216
|
+
npm test
|
|
217
|
+
dsh plugin --profile web add .
|
|
218
|
+
dsh --profile web --dump-config
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Restart DSH Web and hard-refresh the browser. `dsh plugin ... add .` reads the package metadata and `cordis.patch.yml`; do not install by copying `lib` directly.
|
|
222
|
+
|
|
230
223
|
This repository develops in `src` and builds to `lib`:
|
|
231
224
|
|
|
232
225
|
- [src\index.ts](src/index.ts): host entry, config, and lifecycle.
|
|
233
|
-
- [src\manager.ts](src/manager.ts): channel start/stop,
|
|
226
|
+
- [src\manager.ts](src/manager.ts): channel start/stop, authenticated management API, and credential persistence.
|
|
234
227
|
- [src\engine](src/engine): session routing, slash commands, approval, splitting, and outbound push.
|
|
235
228
|
- [src\channels](src/channels): DingTalk, Feishu, Lark, WeChat, WeCom, QQ, and Telegram adapters.
|
|
236
229
|
- `client.js`: settings page and workspace channel sidebar.
|
|
@@ -249,6 +242,8 @@ When changing channel or session logic, keep the engine platform-agnostic, keep
|
|
|
249
242
|
|
|
250
243
|
## Validation
|
|
251
244
|
|
|
245
|
+
For real management-authentication tests, set `DSH_CONNECTION_CONTRACT_ROOT` to the isolated `@deepseek-ai/dsh-client-connection` package root. The Gateway-coexistence case also uses `DSH_CHAT_CONTRACT_ROOT` from the image contracts. Local runs skip these contracts when unconfigured; CI supplies both. Tests use temporary HTTP servers and credentials, not a live Cloudflare deployment.
|
|
246
|
+
|
|
252
247
|
```powershell
|
|
253
248
|
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
|
254
249
|
$OutputEncoding = [System.Text.Encoding]::UTF8
|
|
@@ -257,8 +252,8 @@ npm test
|
|
|
257
252
|
|
|
258
253
|
`prepublishOnly` runs the tests before publishing.
|
|
259
254
|
|
|
260
|
-
##
|
|
255
|
+
## License
|
|
261
256
|
|
|
262
|
-
|
|
257
|
+
Security guidance is in [SECURITY.md](SECURITY.md).
|
|
263
258
|
|
|
264
259
|
Licensed under [Apache License 2.0](LICENSE).
|
package/README.md
CHANGED
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
|
|
23
23
|
## 功能概览
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
25
|
+
不在电脑前,也能通过常用聊天软件把任务交给本机 DSH,并在同一聊天里接收回复、回答问题和处理工具审批。
|
|
26
|
+
|
|
27
|
+
- **连接常用消息平台**:支持钉钉、飞书、Lark、微信、企业微信、QQ 和 Telegram。
|
|
28
|
+
- **多个账号分别配置**:同一平台可添加多个账号,各自选择工作区、模型、推理强度、权限和私聊准入。
|
|
29
|
+
- **手机上完成任务交互**:下任务、读回复、回答单选或多选问题;已批准用户可在私聊中批准或拒绝工具执行。
|
|
30
|
+
- **聊天记录互不混淆**:每个 IM 聊天对应独立会话,在网页工作区「频道」中回看。
|
|
31
|
+
- **按平台扫码或填写凭据**:在「设置 → IM助理」连接账号,管理消息接收开关。
|
|
32
|
+
- **控制谁能使用**:群聊通过 @ 触发,私聊按账号的准入设置处理,详见下表。
|
|
33
33
|
|
|
34
34
|
## 谁可以驱动助手
|
|
35
35
|
|
|
@@ -73,6 +73,18 @@
|
|
|
73
73
|
|
|
74
74
|
✅ 可用 = 文字收发可用 | *微信 = 只走腾讯官方 iLink,不做逆向个人号 | 群聊都需要 @ 机器人才回复
|
|
75
75
|
|
|
76
|
+
## 图片输入
|
|
77
|
+
|
|
78
|
+
图片输入使用与 DSH Chat 一致的模型能力和附件规则,不按模型名称猜测视觉能力:
|
|
79
|
+
|
|
80
|
+
覆盖微信、企业微信、钉钉、飞书、Lark、QQ 和 Telegram;具体平台消息形式和联调检查见[图片输入验收](docs/image-input.md)。
|
|
81
|
+
|
|
82
|
+
- 以当前 IM 会话实际使用的模型为准,而不是只看全局默认模型。
|
|
83
|
+
- 模型声明支持 `image` 时,将图片保存为 DSH 标准图片附件并提交给模型;会话记录保留图片引用,而不是只有本地文件路径文字。
|
|
84
|
+
- 模型明确不支持图片时,在 IM 提示切换模型,不静默丢图。模型未提供能力元数据时,遵循 Chat 的兼容规则,不仅因元数据缺失而拒绝。
|
|
85
|
+
- 图片仍受渠道下载限制、宿主附件大小与格式限制,以及原有私聊准入和群聊 @ 规则约束。
|
|
86
|
+
- 此功能是用户向机器人发送图片进行分析,不代表所有渠道都支持机器人发送图片或生成图片。
|
|
87
|
+
|
|
76
88
|
## 界面预览
|
|
77
89
|
|
|
78
90
|
在「设置 → IM助理」按渠道添加账号。展开渠道后选择账号,在右侧独立配置工作区、模型、权限、私聊准入和接收状态:
|
|
@@ -102,13 +114,18 @@
|
|
|
102
114
|
|
|
103
115
|
## DSH 产品生态
|
|
104
116
|
|
|
105
|
-
|
|
117
|
+
想直接使用完整工作台,可下载 [DSH Codex Desktop](https://github.com/MichengAI/dsh-codex-desktop/releases);已有 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 环境,可按需独立安装以下 8 个自研插件。桌面端已随附这些插件。
|
|
106
118
|
|
|
107
|
-
|
|
|
119
|
+
| 插件 | 你可以用它做什么 |
|
|
108
120
|
| --- | --- |
|
|
109
|
-
| [
|
|
110
|
-
| [
|
|
111
|
-
|
|
|
121
|
+
| [Codex UI](https://github.com/MichengAI/dsh-codex-ui) | 整理项目与会话、搜索任务、跳转对话轮次 |
|
|
122
|
+
| [IM Connect](https://github.com/MichengAI/dsh-im-connect) | 从微信、飞书、钉钉等消息平台下任务、收回复 |
|
|
123
|
+
| [Automation](https://github.com/MichengAI/dsh-automation) | 按计划执行任务,查看每次运行的结果 |
|
|
124
|
+
| [Skills Manager](https://github.com/MichengAI/dsh-skills-manager) | 统一查找、启停、创建和导入本机技能 |
|
|
125
|
+
| [Archive Manager](https://github.com/MichengAI/dsh-archive-manager) | 搜索、恢复或清理已归档会话 |
|
|
126
|
+
| [Agency Agents](https://github.com/MichengAI/dsh-agency-agents) | 按任务选择并召唤专业角色 |
|
|
127
|
+
| [BTW](https://github.com/MichengAI/dsh-btw) | 在当前上下文中临时旁问,不打断主任务 |
|
|
128
|
+
| [Simplify](https://github.com/MichengAI/dsh-simplify) | 用 /simplify 整理 Git 改动范围内的代码 |
|
|
112
129
|
|
|
113
130
|
## 前置条件
|
|
114
131
|
|
|
@@ -119,40 +136,16 @@
|
|
|
119
136
|
|
|
120
137
|
## 安装
|
|
121
138
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
### 交给其他 Agent 一句话安装
|
|
125
|
-
|
|
126
|
-
本插件运行在 DeepSeek Harness Web 里。把下面其中一句复制到 DSH、Codex 或 WorkBuddy,让它代你安装到本机 `web` profile。
|
|
139
|
+
以下安装命令使用官方 npm 源。
|
|
127
140
|
|
|
128
|
-
|
|
141
|
+
### 让 Agent 帮你安装(推荐)
|
|
129
142
|
|
|
130
|
-
|
|
131
|
-
请把 DSH 插件 @michengai/dsh-im-connect 最新版装进本机 web profile,使用官方 npm 源执行:dsh plugin --profile web add @michengai/dsh-im-connect@latest --registry=https://registry.npmjs.org/。装完执行 dsh --profile web --dump-config,确认已挂载 im-connect,并提醒我重启 DSH Web 后硬刷新浏览器,打开「设置 → IM助理」。
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
从源码安装:
|
|
143
|
+
把下面这段话发给任意能够执行本机终端命令的 Agent。将 `web` 替换为实际使用的 profile;安装完成后,在 DSH 中使用本插件。
|
|
135
144
|
|
|
136
145
|
```text
|
|
137
|
-
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
| 产品 | 怎么用 |
|
|
141
|
-
| --- | --- |
|
|
142
|
-
| DSH | 把上面其中一句发给当前会话。 |
|
|
143
|
-
| Codex | 把上面其中一句发给 Codex,让它在本机执行安装。 |
|
|
144
|
-
| WorkBuddy | 把上面其中一句发给 WorkBuddy;源码安装也可同时粘贴仓库地址 `https://github.com/MichengAI/dsh-im-connect`。 |
|
|
145
|
-
|
|
146
|
-
Codex 和 WorkBuddy 只负责代装;装好后仍要打开 DSH Web 使用「设置 → IM助理」。
|
|
147
|
-
|
|
148
|
-
也可以自己执行同一条 npm 命令:
|
|
149
|
-
|
|
150
|
-
```powershell
|
|
151
|
-
dsh plugin --profile web add @michengai/dsh-im-connect@latest --registry=https://registry.npmjs.org/
|
|
146
|
+
请将 DSH 插件 @michengai/dsh-im-connect 安装到本机 web profile,执行:dsh plugin --profile web add @michengai/dsh-im-connect@latest --registry=https://registry.npmjs.org/。安装后执行 dsh --profile web --dump-config,确认配置包含 im-connect,并告诉我如何重新加载 DSH 和开始使用。
|
|
152
147
|
```
|
|
153
148
|
|
|
154
|
-
未把 `dsh` 装进 PATH 时,把开头的 `dsh` 换成 `npx --yes @deepseek-ai/dsh`。
|
|
155
|
-
|
|
156
149
|
### 从官方 npm 安装最新版
|
|
157
150
|
|
|
158
151
|
在任意 PowerShell 目录执行:
|
|
@@ -168,31 +161,13 @@ dsh --profile web --dump-config
|
|
|
168
161
|
|
|
169
162
|
配置输出中应包含 `im-connect`。安装后重启 DSH Web 并在浏览器硬刷新。不要手工复制客户端文件,`dsh plugin add` 会同时应用 `cordis.patch.yml`。
|
|
170
163
|
|
|
171
|
-
### 从源码安装
|
|
172
|
-
|
|
173
|
-
适用于调试或使用未发布改动。克隆后的本地路径就是插件安装路径:
|
|
174
|
-
|
|
175
|
-
```powershell
|
|
176
|
-
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
|
177
|
-
$OutputEncoding = [System.Text.Encoding]::UTF8
|
|
178
|
-
Set-Location D:\Repository\deepseek-harness-plugin
|
|
179
|
-
git clone https://github.com/MichengAI/dsh-im-connect.git
|
|
180
|
-
Set-Location .\dsh-im-connect
|
|
181
|
-
npm install
|
|
182
|
-
npm test
|
|
183
|
-
dsh plugin --profile web add .
|
|
184
|
-
dsh --profile web --dump-config
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
完成后重启 DSH Web 并硬刷新浏览器。`dsh plugin ... add .` 会读取当前目录的包信息和 `cordis.patch.yml`;不要改为直接复制 `lib` 目录。
|
|
188
|
-
|
|
189
164
|
## 在线更新
|
|
190
165
|
|
|
191
166
|
设置标题会显示当前版本和“检查更新”按钮。发现新版后,只有检测到 DSH CLI 或 Desktop 更新服务时才可使用“自动更新”;其他环境会在弹窗中提供可复制、与当前 Profile 对应的手工更新命令。
|
|
192
167
|
|
|
193
168
|
## 使用
|
|
194
169
|
|
|
195
|
-
打开「设置 → IM
|
|
170
|
+
打开「设置 → IM助理」,在目标渠道点击「添加账号」,并为该账号选择工作区、模型、权限和私聊准入。
|
|
196
171
|
|
|
197
172
|
| 目标 | 操作 | 说明 |
|
|
198
173
|
| --- | --- | --- |
|
|
@@ -215,7 +190,7 @@ dsh --profile web --dump-config
|
|
|
215
190
|
| 项 | 当前行为 |
|
|
216
191
|
| --- | --- |
|
|
217
192
|
| 用户准入 | 群聊不用绑定,只需 @。每个账号可选择「仅已批准用户」或「允许所有私聊用户」;默认仅批准用户可用,微信 / 飞书 / Lark / QQ 扫码者会自动加入该账号白名单 |
|
|
218
|
-
| 管理接口 |
|
|
193
|
+
| 管理接口 | `/api/dsh-im-connect`;通过宿主 `connection.requestRejection` 验证 Host、Origin 和 Cookie,本机也须登录;认证不可用返回 503,写接口保留 JSON、客户端请求头和 1 MiB 限制 |
|
|
219
194
|
| 敏感字段 | 包括微信 token 在内均优先写入 DSH `ctx.credentials`;没有该服务时落到 `%DSH_HOME%\dsh-im-connect\secrets.json`(明文,仅限当前用户,禁止同步或分享) |
|
|
220
195
|
| 账号状态 | `channels.json` 按账号保存工作区、模型、权限、私聊准入、启用状态和凭据引用,不保存明文 Secret |
|
|
221
196
|
| 浏览器回包 | 不返回 token、secret、App Secret 或内部异常详情 |
|
|
@@ -223,14 +198,32 @@ dsh --profile web --dump-config
|
|
|
223
198
|
| 工具批准 | 仅私聊且发送者已在当前账号白名单时生效;即使账号允许所有私聊用户,未批准用户也不能审批工具,且不能跨会话或在群里批准 |
|
|
224
199
|
| 交互问题 | 单选、多选和自定义问题回到发起任务的 IM 会话;同一会话按顺序处理,群聊只接受任务发起者回答 |
|
|
225
200
|
|
|
226
|
-
|
|
201
|
+
DSH 后端保持本机监听;远程访问使用受控 HTTPS 反向代理,并在宿主配置实际访问地址的 `trustedHosts`、通过该地址登录。不要伪装 localhost 或删除认证检查来绕过 403;图片下载的 `additionalImageHosts` 不用于管理接口。详见 [管理面认证](SECURITY.md#管理面)。权限预设与 Chat 使用相同的 Host sandbox-policy;`danger-full-access` 不套沙箱。
|
|
227
202
|
|
|
228
203
|
## 二次开发
|
|
229
204
|
|
|
205
|
+
### 从源码安装
|
|
206
|
+
|
|
207
|
+
适用于调试或使用未发布改动。克隆后的本地路径就是插件安装路径:
|
|
208
|
+
|
|
209
|
+
```powershell
|
|
210
|
+
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
|
211
|
+
$OutputEncoding = [System.Text.Encoding]::UTF8
|
|
212
|
+
Set-Location D:\Repository\deepseek-harness-plugin
|
|
213
|
+
git clone https://github.com/MichengAI/dsh-im-connect.git
|
|
214
|
+
Set-Location .\dsh-im-connect
|
|
215
|
+
npm install
|
|
216
|
+
npm test
|
|
217
|
+
dsh plugin --profile web add .
|
|
218
|
+
dsh --profile web --dump-config
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
完成后重启 DSH Web 并硬刷新浏览器。`dsh plugin ... add .` 会读取当前目录的包信息和 `cordis.patch.yml`;不要改为直接复制 `lib` 目录。
|
|
222
|
+
|
|
230
223
|
本仓库用 `src` 开发,构建到 `lib`:
|
|
231
224
|
|
|
232
225
|
- [src\index.ts](src/index.ts):Host 入口、配置和生命周期。
|
|
233
|
-
- [src\manager.ts](src/manager.ts)
|
|
226
|
+
- [src\manager.ts](src/manager.ts):渠道启停、已认证管理 API、凭据落盘。
|
|
234
227
|
- [src\engine](src/engine):会话路由、斜杠命令、审批、分片和回推。
|
|
235
228
|
- [src\channels](src/channels):钉钉、飞书、Lark、微信、企业微信、QQ、Telegram 适配器。
|
|
236
229
|
- `client.js`:设置页和工作区频道侧栏。
|
|
@@ -249,6 +242,8 @@ dsh plugin --profile web add .
|
|
|
249
242
|
|
|
250
243
|
## 验证
|
|
251
244
|
|
|
245
|
+
真实管理认证测试需要把 `DSH_CONNECTION_CONTRACT_ROOT` 指向隔离安装的 `@deepseek-ai/dsh-client-connection` 包根目录;与 Gateway 共存的用例同时使用图片契约的 `DSH_CHAT_CONTRACT_ROOT`。未配置时本地会跳过对应契约测试,CI 已配置执行。测试使用临时 HTTP 服务和临时凭据,不代表真实 Cloudflare 部署联调。
|
|
246
|
+
|
|
252
247
|
```powershell
|
|
253
248
|
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
|
254
249
|
$OutputEncoding = [System.Text.Encoding]::UTF8
|
|
@@ -257,8 +252,8 @@ npm test
|
|
|
257
252
|
|
|
258
253
|
`prepublishOnly` 会在发布前自动执行测试。
|
|
259
254
|
|
|
260
|
-
##
|
|
255
|
+
## 许可证
|
|
261
256
|
|
|
262
|
-
|
|
257
|
+
安全说明见 [SECURITY.md](SECURITY.md)。
|
|
263
258
|
|
|
264
259
|
本项目采用 [Apache License 2.0](LICENSE)。
|
package/SECURITY.md
CHANGED
|
@@ -20,8 +20,13 @@
|
|
|
20
20
|
|
|
21
21
|
## 管理面
|
|
22
22
|
|
|
23
|
-
-
|
|
24
|
-
-
|
|
23
|
+
- 设置页使用 `/api/dsh-im-connect`。每个请求都先通过宿主公开的 `connection.requestRejection` 认证,再进入插件业务分发。该接口同时执行 Host/trustedHosts、Origin、跨站标记与绑定访问地址的浏览器 Cookie 校验;本机请求同样需要登录。路径前缀、自定义请求头及回环代理来源都不是身份凭据。
|
|
24
|
+
- 该 REST 前缀遵循其他 DSH 插件的 `/api/<插件名>` 约定,并通过具名路径与宿主 Gateway 共存;不注册第二个 `/api` RPC interceptor,也不改变宿主 Gateway。接口仍为 REST JSON,不是 Remote RPC envelope;既有业务路径、GET/POST 方法、参数和成功返回结构不变。
|
|
25
|
+
- 每次请求通过 `ctx.get('connection')` 读取当前活动服务,不缓存认证实例、不暴露 inactive 服务。宿主缺少公开认证接口或服务暂不可用时返回 503,提示稍后重试或升级;认证异常不会降级为匿名本地访问。
|
|
26
|
+
- 反代应保留外部 Host、Cookie 和 Origin,在宿主 `client-connection.trustedHosts` 配置实际访问地址,并通过该地址的 DSH 登录入口取得 Cookie。不要将 Host 改成 localhost 来绕过校验,不接受插件专用 token 或转发头作为认证。公网入口应使用 HTTPS。
|
|
27
|
+
- 管理回包统一 `Cache-Control: no-store`,前端使用同源 Cookie 且禁用缓存。
|
|
28
|
+
- 所有写接口必须使用 `Content-Type: application/json`,并携带 `x-dsh-im-connect-client: 1`;读取和写入均需宿主登录 Cookie。请求体仍按实际接收字节限制为 1 MiB,普通跨站表单不能触发连接、批准、删除或权限修改。
|
|
29
|
+
- 失败返回 JSON `{ "ok": false, "error": "说明" }`:未登录/无效 Cookie 为 401;不可信 Host、跨站请求或写请求缺客户端标记为 403;认证服务不可用为 503。非法 JSON 为 400,超限为 413,非 JSON 写请求为 415;业务路由其余错误码保持原行为。认证失败不会进入业务读写。
|
|
25
30
|
- 待批准列表保存在 `channels.json` 的 `pending`,白名单保存在 `allowlist`。
|
|
26
31
|
- 浏览器回包不返回 token、secret、原始凭据或内部异常详情。
|
|
27
32
|
|