@mhfire/dsh-im-bridge 0.1.7 → 0.2.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.
- package/README.en.md +16 -3
- package/README.md +16 -3
- package/cordis.patch.yml +4 -0
- package/lib/client.js +789 -153
- package/lib/client.js.map +1 -0
- package/lib/index.js +570 -0
- package/package.json +34 -3
- package/src/client/PluginCard.module.css +153 -0
- package/src/client/PluginCard.tsx +83 -0
- package/src/client/WecomCard.tsx +135 -0
- package/src/client/card-controller.ts +146 -0
- package/src/client/card-form.ts +293 -0
- package/src/client/css-modules.d.ts +4 -0
- package/src/client/fields.module.css +124 -0
- package/src/client/fields.tsx +112 -0
- package/src/client/index.ts +37 -0
- package/src/client/locales.ts +112 -0
- package/src/index.ts +542 -0
- package/src/{wecom.js → wecom.ts} +98 -56
- package/tsconfig.json +14 -0
- package/tsdown.client.ts +109 -0
- package/tsdown.host.ts +36 -0
- package/src/index.js +0 -401
package/README.en.md
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
WeCom AI Bot ⇄ DeepSeek Harness Agent bridge — a **DSH plugin**.
|
|
6
6
|
|
|
7
|
-
Creates Agents **in-process** inside a dsh profile (no child-process spawn): per-sender durable sessions (the same WeCom user reuses one session with memory), sessions registered with the Web GUI (live view and continue-chat), plus a Settings → Plugins card (`
|
|
7
|
+
Creates Agents **in-process** inside a dsh profile (no child-process spawn): per-sender durable sessions (the same WeCom user reuses one session with memory), sessions registered with the Web GUI (live view and continue-chat), plus a Settings → Plugins card (`botId` / `secret`, allow-list, timeouts, copy, and model overrides, written to `settings.yaml`).
|
|
8
|
+
|
|
9
|
+
The Host half registers the `im-bridge` namespace through `installSettingsSection`. The browser half contributes a card into `settings.plugin.item` under `key: im-bridge`. The card can set `botId` / `secret` on the same user layer as the profile patch. Live fields such as `startHint` apply on the next message; changing credentials still requires a process restart to open the WebSocket.
|
|
8
10
|
|
|
9
11
|
## Install
|
|
10
12
|
|
|
@@ -13,7 +15,7 @@ Creates Agents **in-process** inside a dsh profile (no child-process spawn): per
|
|
|
13
15
|
```powershell
|
|
14
16
|
dsh plugin --profile web add @mhfire/dsh-im-bridge
|
|
15
17
|
# Or pin a version:
|
|
16
|
-
# dsh plugin --profile web add @mhfire/dsh-im-bridge@0.
|
|
18
|
+
# dsh plugin --profile web add @mhfire/dsh-im-bridge@0.2.0
|
|
17
19
|
```
|
|
18
20
|
|
|
19
21
|
In `$DSH_HOME/profiles/web/cordis.patch.yml` (or your profile), supply credentials only (other fields ship as bundle defaults and can be overridden):
|
|
@@ -36,7 +38,7 @@ Install from this repo’s `plugin/` directory or a `file:` path:
|
|
|
36
38
|
dsh plugin --profile web add <package-path>
|
|
37
39
|
```
|
|
38
40
|
|
|
39
|
-
If `botId` / `secret` are missing, the plugin still loads (does not block `dsh web`); logs warn that WeCom connect is skipped. You can fill
|
|
41
|
+
If `botId` / `secret` are missing, the plugin still loads (does not block `dsh web`); logs warn that WeCom connect is skipped. You can also fill them at the top of the Settings → Plugins card (same user layer as the profile patch); the badge becomes “Configured” after save. Changing credentials still requires a **restart** to connect (this release does not hot-reconnect).
|
|
40
42
|
|
|
41
43
|
## Configuration
|
|
42
44
|
|
|
@@ -50,12 +52,23 @@ The bundle `cordis.patch.yml` supplies defaults for every field except `botId` /
|
|
|
50
52
|
| `agentTimeoutSec` | Max seconds per task; also drives progress / ETA |
|
|
51
53
|
| `startHint` | Placeholder text when processing starts |
|
|
52
54
|
| `agentPreset` | Agent preset to mount (default `standard`) |
|
|
55
|
+
| `provider` / `model` | WeCom-only model; **both must be non-empty** to override, otherwise follow the GUI `agent-default-model`. Filling only one warns and falls back. Editable in Settings; applies to later new sender sessions only |
|
|
56
|
+
| `reasoningEffort` | Optional effort when the WeCom override is in effect; ignored otherwise |
|
|
53
57
|
| `persona` / `personaFile` | Bot persona; precedence: `personaFile` → `persona` → packaged default (zh/en via Host `locale.preference`); overrides do not follow language; do not commit secrets |
|
|
54
58
|
| `maxReplyBytes` | Reply size cap in bytes (default 20000) |
|
|
55
59
|
| `deniedMessage` | Reply when the sender is not on `allowFrom` (editable in Settings) |
|
|
56
60
|
| `welcomeMessage` | Welcome text on `enter_chat` (editable in Settings) |
|
|
57
61
|
| `thinking` | Streaming animation. Precedence: tool activity (`toolLabels`) > model stream phase (`reasoningStatus` / `outputStatus` from `assistant/chunk`) > timed `phases` fallback; also `spin` / `reasoningSpin` / `outputSpin` / `eggs` |
|
|
58
62
|
|
|
63
|
+
To give WeCom a different model from the GUI, set both in the profile `cordis.patch.yml`:
|
|
64
|
+
|
|
65
|
+
```yaml
|
|
66
|
+
- id: im-bridge
|
|
67
|
+
config:
|
|
68
|
+
provider: deepseek-official
|
|
69
|
+
model: deepseek-reasoner
|
|
70
|
+
```
|
|
71
|
+
|
|
59
72
|
Behavior:
|
|
60
73
|
|
|
61
74
|
1. `reasoning-delta` → rotating “model thinking” copy + `reasoningSpin`
|
package/README.md
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
企业微信智能机器人 ⇄ DeepSeek Harness Agent 桥接 **DSH 插件**。
|
|
6
6
|
|
|
7
|
-
在 dsh profile 内**进程内**创建 Agent(不再 spawn 子进程):per-sender 持久会话(同一企业微信用户复用同一会话,有上下文记忆),会话与 Web GUI 同进程注册(实时可见、可续聊),并在 Settings → 插件配置页提供配置卡片(`
|
|
7
|
+
在 dsh profile 内**进程内**创建 Agent(不再 spawn 子进程):per-sender 持久会话(同一企业微信用户复用同一会话,有上下文记忆),会话与 Web GUI 同进程注册(实时可见、可续聊),并在 Settings → 插件配置页提供配置卡片(`botId` / `secret`、白名单、超时、提示语、模型覆盖,写入 `settings.yaml`)。
|
|
8
|
+
|
|
9
|
+
Host 通过 `installSettingsSection` 注册 `im-bridge` 命名空间;浏览器半包以 `key: im-bridge` 挂进 `settings.plugin.item`。卡片可填 `botId` / `secret`,与 profile patch 写入同一用户层;改 `startHint` 等热字段后下一轮消息即生效,改凭证仍需重启进程才会连 WebSocket。
|
|
8
10
|
|
|
9
11
|
## 安装
|
|
10
12
|
|
|
@@ -13,7 +15,7 @@
|
|
|
13
15
|
```powershell
|
|
14
16
|
dsh plugin --profile web add @mhfire/dsh-im-bridge
|
|
15
17
|
# 或钉版本:
|
|
16
|
-
# dsh plugin --profile web add @mhfire/dsh-im-bridge@0.
|
|
18
|
+
# dsh plugin --profile web add @mhfire/dsh-im-bridge@0.2.0
|
|
17
19
|
```
|
|
18
20
|
|
|
19
21
|
在 `$DSH_HOME/profiles/web/cordis.patch.yml`(或对应 profile)中补密钥即可(其余项已有 bundle 默认,可按需覆盖):
|
|
@@ -36,7 +38,7 @@ dsh plugin --profile web add @mhfire/dsh-im-bridge
|
|
|
36
38
|
dsh plugin --profile web add <本包路径>
|
|
37
39
|
```
|
|
38
40
|
|
|
39
|
-
未配置 `botId` / `secret` 时插件仍会加载(不阻塞 `dsh web
|
|
41
|
+
未配置 `botId` / `secret` 时插件仍会加载(不阻塞 `dsh web`),日志会提示跳过企微连线;也可在 Settings → 插件配置卡片顶部填写,保存后徽章变为「已配置」,与 profile patch 同一用户层。改凭证仍要**重启**进程才会连接(本版本不做热重连)。
|
|
40
42
|
|
|
41
43
|
## 配置项
|
|
42
44
|
|
|
@@ -50,12 +52,23 @@ bundle 的 `cordis.patch.yml` 已为除 `botId` / `secret` 外的字段提供默
|
|
|
50
52
|
| `agentTimeoutSec` | 单任务最长执行时间(秒),动画进度条/剩余估算的基准 |
|
|
51
53
|
| `startHint` | 开始处理时的占位提示语 |
|
|
52
54
|
| `agentPreset` | Agent 加入的 preset(默认 `standard`) |
|
|
55
|
+
| `provider` / `model` | 企微专用模型;**两者都非空**才覆盖,否则跟随 GUI 的 `agent-default-model`;只填一项会告警并回退。Settings 可编,只影响之后新建的发送者会话 |
|
|
56
|
+
| `reasoningEffort` | 覆盖生效时可选的推理强度;未覆盖模型时忽略 |
|
|
53
57
|
| `persona` / `personaFile` | 机器人「人设」;优先级:`personaFile` → `persona` → 包内默认(按 Host `locale.preference` 选中/英);覆盖不跟语言切换;含敏感信息请勿入库 |
|
|
54
58
|
| `maxReplyBytes` | 回复上限(字节,默认 20000) |
|
|
55
59
|
| `deniedMessage` | 非白名单用户的拒绝文案(Settings 可编) |
|
|
56
60
|
| `welcomeMessage` | 进入会话欢迎语(Settings 可编) |
|
|
57
61
|
| `thinking` | 流式动画。优先级:工具活动(`toolLabels`)> 模型流式阶段(`reasoningStatus` / `outputStatus`,来自 `assistant/chunk`)> 时间轴 `phases` 兜底;另有 `spin` / `reasoningSpin` / `outputSpin` / `eggs` 等 |
|
|
58
62
|
|
|
63
|
+
企微与 GUI 使用不同模型时,在 profile `cordis.patch.yml` 同时填写:
|
|
64
|
+
|
|
65
|
+
```yaml
|
|
66
|
+
- id: im-bridge
|
|
67
|
+
config:
|
|
68
|
+
provider: deepseek-official
|
|
69
|
+
model: deepseek-reasoner
|
|
70
|
+
```
|
|
71
|
+
|
|
59
72
|
`thinking` 行为:
|
|
60
73
|
|
|
61
74
|
1. 收到 `reasoning-delta` → 「模型思考中」类文案轮换 + `reasoningSpin`
|
package/cordis.patch.yml
CHANGED