@xmanrui/dsh-im 4.38.2 → 5.0.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 +10 -2
- package/README.md +10 -2
- package/lib/client.js +7 -4
- package/lib/index.js +311 -306
- package/package.json +4 -3
- package/plugin-src/host/injected-context.mjs +13 -1
- package/plugin-src/host/modern-harness-api.mjs +10 -4
- package/src/channels/matrix/matrix-api.mjs +34 -0
- package/src/channels/matrix/matrix-config-store.mjs +50 -2
- package/src/channels/matrix/matrix-normalize.mjs +106 -14
- package/src/channels/matrix/matrix-room-history.mjs +240 -8
- package/src/channels/matrix/matrix-runtime.mjs +563 -3
- package/src/channels/qq/qq-bridge.mjs +147 -1
- package/src/channels/qq/state-store.mjs +89 -0
- package/src/channels/shared/context-enhancement.mjs +2 -0
- package/src/channels/shared/conversation/ambient-provider.mjs +115 -0
- package/src/channels/shared/conversation/context-builder.mjs +148 -0
- package/src/channels/shared/conversation/reply-context.mjs +95 -0
- package/src/channels/shared/conversation/root-context.mjs +101 -0
- package/src/channels/shared/conversation/route.mjs +71 -0
- package/src/channels/shared/conversation/semantic-message.mjs +75 -0
- package/src/channels/shared/conversation/trigger-policy.mjs +80 -0
- package/src/channels/shared/conversation-state-store.mjs +95 -1
- package/src/channels/shared/deferred-delivery-coordinator.mjs +5 -1
- package/src/channels/shared/harness-approval.mjs +19 -0
- package/src/channels/shared/harness-client.mjs +9 -1
- package/src/channels/shared/i18n-en/shared-a.mjs +2 -0
- package/src/channels/shared/i18n-en/shared-b.mjs +2 -0
- package/src/channels/shared/injected-context.mjs +64 -2
- package/src/channels/shared/prompt-failure-tracker.mjs +65 -0
- package/src/channels/shared/speaker-label.mjs +46 -0
- package/src/channels/shared/text-harness-bridge.mjs +504 -33
- package/src/channels/wecom/wecom-cards.mjs +1 -1
package/README.en.md
CHANGED
|
@@ -30,6 +30,12 @@
|
|
|
30
30
|
<img src="https://img.shields.io/badge/iMessage-34C759?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI%2BPHBhdGggZmlsbD0iI2ZmZiIgZD0iTTEyIDNDNS45MjUgMyAxIDcuMDI5IDEgMTJjMCAyLjc1MSAxLjUxNCA1LjIxNCAzLjkwMSA2Ljg2NS4yOTEgMS41MjYtLjE3NCAyLjY0OC0xLjI1OCAzLjY0IDIuMDQ3LjAyNSAzLjQ0Mi0uNTA5IDQuNjQzLTEuNThBMTMuMiAxMy4yIDAgMCAwIDEyIDIxYzYuMDc1IDAgMTEtNC4wMjkgMTEtOVMxOC4wNzUgMyAxMiAzWiIvPjwvc3ZnPg%3D%3D" alt="iMessage">
|
|
31
31
|
</p>
|
|
32
32
|
|
|
33
|
+
<p>
|
|
34
|
+
<a href="https://trendshift.io/repositories/169119#achievements">
|
|
35
|
+
<img src="https://trendshift.io/api/badge/trendshift/repositories/169119/daily?language=JavaScript" alt="DSH-IM — Trendshift #3 JavaScript Repository Of The Day" width="420">
|
|
36
|
+
</a>
|
|
37
|
+
</p>
|
|
38
|
+
|
|
33
39
|
<p><a href="README.md">简体中文</a> · <strong>English</strong></p>
|
|
34
40
|
</div>
|
|
35
41
|
|
|
@@ -120,7 +126,7 @@ dsh plugin --profile web add -w @xmanrui/dsh-im
|
|
|
120
126
|
|
|
121
127
|
Restart `dsh web`, refresh the browser, then open **Settings → IM Bot**. The top-level IM Bot entry uses `order: 21` to follow **Agent Presets**, and the Plugins page no longer retains the old entry. Upgrading preserves existing bots, credentials, workspaces, Agent Presets, and Session bindings.
|
|
122
128
|
|
|
123
|
-
Local `dsh web` and DSH Desktop reuse the current Host's internal services by default:
|
|
129
|
+
Local `dsh web` and DSH Desktop reuse the current Host's internal services by default: the Typert Gateway invokes the Session and Workspace controllers. No Harness address or loopback HTTP connection is required. Desktop's compatibility, extended-window, and advanced modes do not require browser access or LAN access to be enabled. An explicit channel `harnessBaseUrl` is retained only for legacy remote HTTP/WebSocket Harness endpoints; failed internal calls never silently switch to another Host.
|
|
124
130
|
|
|
125
131
|
To try the latest code before it is published to npm, use the GitHub-source installer instead:
|
|
126
132
|
|
|
@@ -276,7 +282,9 @@ Startup configuration validation failures also include `file`, `field`, and `iss
|
|
|
276
282
|
|
|
277
283
|
## Local development
|
|
278
284
|
|
|
279
|
-
The latest dsh-im follows the latest DSH, with DSH `0.2.
|
|
285
|
+
The latest dsh-im follows the latest DSH, with DSH `0.2.1-rc.2` (Session format V4) as this update's supported baseline. New features and fixes do not add compatibility branches for older DSH versions; existing unrelated compatibility code remains in place. Older hosts should use the corresponding historical plugin release. `package.json` declares only the host versions actually verified for this build, without promising support for untested future releases. After upgrading the plugin, restart the Host and refresh the settings page so both sides use the same plugin build.
|
|
286
|
+
|
|
287
|
+
DSH `0.2.1-rc.2` requires an explicit caller `peer` on internal Gateway requests. The shared adapter creates it through Host Connection, reuses it for unary and streaming calls across all channels, and disposes it when the plugin unloads. Live WeChat and QQ tests verified replies in both new and existing sessions.
|
|
280
288
|
|
|
281
289
|
Source details, guidance, and quoted replies now use the V4 `plugin:dsh-im` source kind, fixing `SessionFormatError: format v4 message requires a producer-owned source kind`. Message ordering, user text, and session-level guidance deduplication retain their existing behavior. The host owns historical Session migration.
|
|
282
290
|
|
package/README.md
CHANGED
|
@@ -31,6 +31,12 @@
|
|
|
31
31
|
<img src="https://img.shields.io/badge/iMessage-34C759?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI%2BPHBhdGggZmlsbD0iI2ZmZiIgZD0iTTEyIDNDNS45MjUgMyAxIDcuMDI5IDEgMTJjMCAyLjc1MSAxLjUxNCA1LjIxNCAzLjkwMSA2Ljg2NS4yOTEgMS41MjYtLjE3NCAyLjY0OC0xLjI1OCAzLjY0IDIuMDQ3LjAyNSAzLjQ0Mi0uNTA5IDQuNjQzLTEuNThBMTMuMiAxMy4yIDAgMCAwIDEyIDIxYzYuMDc1IDAgMTEtNC4wMjkgMTEtOVMxOC4wNzUgMyAxMiAzWiIvPjwvc3ZnPg%3D%3D" alt="iMessage">
|
|
32
32
|
</p>
|
|
33
33
|
|
|
34
|
+
<p>
|
|
35
|
+
<a href="https://trendshift.io/repositories/169119#achievements">
|
|
36
|
+
<img src="https://trendshift.io/api/badge/trendshift/repositories/169119/daily?language=JavaScript" alt="DSH-IM — Trendshift JavaScript 日榜第 3 名" width="420">
|
|
37
|
+
</a>
|
|
38
|
+
</p>
|
|
39
|
+
|
|
34
40
|
<p><strong>简体中文</strong> · <a href="README.en.md">English</a></p>
|
|
35
41
|
</div>
|
|
36
42
|
|
|
@@ -123,7 +129,7 @@ dsh plugin --profile web add -w @xmanrui/dsh-im
|
|
|
123
129
|
|
|
124
130
|
重启 `dsh web`、刷新浏览器,然后打开「设置 → IM机器人」。IM机器人使用 `order: 21`,尽量排在一级设置菜单的「Agent 预设」之后;插件页面不再保留旧入口。从旧版升级不会改变已有机器人、凭据、工作区、Agent Preset 或会话绑定。
|
|
125
131
|
|
|
126
|
-
本机 `dsh web` 和 DSH Desktop 默认直接复用当前 Host
|
|
132
|
+
本机 `dsh web` 和 DSH Desktop 默认直接复用当前 Host 的内部服务:通过 Typert Gateway 调用 Session Controller 和 Workspace Controller,不需要配置 Harness 地址,也不绕行本机 HTTP 端口。Desktop 的兼容模式、扩展窗口和增强模式均无需开启“允许在浏览器中打开”或局域网访问。渠道配置中显式设置的 `harnessBaseUrl` 仅保留给旧版远程 HTTP/WebSocket Harness;内部调用失败不会自动改连其他 Host。
|
|
127
133
|
|
|
128
134
|
如需试用尚未发布到 npm 的最新代码,可以改用 GitHub 源安装器:
|
|
129
135
|
|
|
@@ -279,7 +285,9 @@ Web 与机器人可同时处理同一审批,先提交的「批准一次」或
|
|
|
279
285
|
|
|
280
286
|
## 本地开发
|
|
281
287
|
|
|
282
|
-
最新版 dsh-im 跟随最新版 DSH,本次支持基线为 DSH `0.2.
|
|
288
|
+
最新版 dsh-im 跟随最新版 DSH,本次支持基线为 DSH `0.2.1-rc.2`(Session 格式 v4)。后续功能和修复不再增加旧版 DSH 的兼容分支,已有其他兼容逻辑暂时保留;旧宿主请使用对应的历史插件版本。`package.json` 只声明当前实际验证的宿主版本,不承诺未经验证的未来版本。升级插件后重启 Host 并刷新设置页,使 Host 和客户端使用同一版插件。
|
|
289
|
+
|
|
290
|
+
DSH `0.2.1-rc.2` 要求内部网关请求携带调用方 `peer`。所有渠道共用的适配层通过 Host Connection 创建并复用该身份,同时用于普通调用和流式调用,在插件卸载时释放。微信和 QQ 的新会话、已有会话收发已完成真机验证。
|
|
283
291
|
|
|
284
292
|
上下文增强中的来源信息、引导词和引用回复使用 v4 的 `plugin:dsh-im` 来源字段,修复了它们触发的 `SessionFormatError: format v4 message requires a producer-owned source kind`。消息顺序、用户正文和会话级引导词去重沿用原有机制,历史会话由宿主负责迁移。
|
|
285
293
|
|
package/lib/client.js
CHANGED
|
@@ -595,7 +595,7 @@ var React40 = __toESM(require("react"), 1);
|
|
|
595
595
|
// package.json
|
|
596
596
|
var package_default = {
|
|
597
597
|
name: "@xmanrui/dsh-im",
|
|
598
|
-
version: "
|
|
598
|
+
version: "5.0.0",
|
|
599
599
|
icon: "./assets/logo-plugin-message-link-gradient.webp",
|
|
600
600
|
description: "\u628A\u5FAE\u4FE1\u3001\u98DE\u4E66\u3001\u4F01\u5FAE\u3001\u9489\u9489\u3001QQ\u3001Telegram\u3001WhatsApp\u3001Slack\u3001Discord\u3001Matrix\u63A5\u5165DSH\u3002 Connect Telegram, WhatsApp, Slack, Discord, Matrix, WeChat, Feishu, WeCom, DingTalk, and QQ to DSH.",
|
|
601
601
|
keywords: [
|
|
@@ -682,9 +682,10 @@ var package_default = {
|
|
|
682
682
|
platform: "web"
|
|
683
683
|
},
|
|
684
684
|
compatibility: {
|
|
685
|
-
dsh: "0.2.
|
|
685
|
+
dsh: "0.2.1-rc.2",
|
|
686
686
|
dshReleases: {
|
|
687
|
-
"0.2.0-rc.2": "compatible"
|
|
687
|
+
"0.2.0-rc.2": "compatible",
|
|
688
|
+
"0.2.1-rc.2": "compatible"
|
|
688
689
|
},
|
|
689
690
|
profiles: [
|
|
690
691
|
"web"
|
|
@@ -3519,7 +3520,9 @@ var INJECTED_CONTEXT_TAGS = Object.freeze({
|
|
|
3519
3520
|
guidanceOpen: "<dsh_im_source_guidance>",
|
|
3520
3521
|
guidanceClose: "</dsh_im_source_guidance>",
|
|
3521
3522
|
replyOpen: "<dsh_im_reply_to>",
|
|
3522
|
-
replyClose: "</dsh_im_reply_to>"
|
|
3523
|
+
replyClose: "</dsh_im_reply_to>",
|
|
3524
|
+
contextOpen: "<dsh_im_context>",
|
|
3525
|
+
contextClose: "</dsh_im_context>"
|
|
3523
3526
|
});
|
|
3524
3527
|
var CONTEXT_ENHANCEMENT_GUIDANCE_MAX_LENGTH = 8e3;
|
|
3525
3528
|
var CONTEXT_GROUP_GUIDANCE_EXAMPLE = `\u4EC5\u4F9D\u636E\u5F53\u524D\u6D88\u606F\u7684 <dsh_im_source> \u4E2D\u5B9E\u9645\u63D0\u4F9B\u7684\u5B57\u6BB5\u7406\u89E3\u6765\u6E90\uFF1B\u6CA1\u6709\u63D0\u4F9B\u7684\u5B57\u6BB5\u4E0D\u8981\u731C\u6D4B\u6216\u8865\u5168\u3002
|