dsh-im-union 0.0.0-stage → 0.0.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 (95) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/LICENSE +28 -0
  3. package/README.en.md +26 -0
  4. package/README.md +25 -2
  5. package/SECURITY.md +20 -0
  6. package/THIRD_PARTY_NOTICES.md +27 -0
  7. package/client.js +525 -0
  8. package/cordis.patch.yml +4 -0
  9. package/dsh.plugin.json +17 -0
  10. package/lib/admin/api.d.ts +37 -0
  11. package/lib/admin/api.js +127 -0
  12. package/lib/channels/discord.d.ts +128 -0
  13. package/lib/channels/discord.js +462 -0
  14. package/lib/channels/feishu.d.ts +135 -0
  15. package/lib/channels/feishu.js +201 -0
  16. package/lib/channels/meta.d.ts +29 -0
  17. package/lib/channels/meta.js +75 -0
  18. package/lib/channels/registry.d.ts +12 -0
  19. package/lib/channels/registry.js +27 -0
  20. package/lib/channels/telegram.d.ts +116 -0
  21. package/lib/channels/telegram.js +393 -0
  22. package/lib/channels/types.d.ts +110 -0
  23. package/lib/channels/types.js +1 -0
  24. package/lib/channels/wecom.d.ts +113 -0
  25. package/lib/channels/wecom.js +445 -0
  26. package/lib/channels/weixin-qr.d.ts +25 -0
  27. package/lib/channels/weixin-qr.js +88 -0
  28. package/lib/channels/weixin.d.ts +95 -0
  29. package/lib/channels/weixin.js +514 -0
  30. package/lib/client.js +525 -0
  31. package/lib/credentials/vault.d.ts +16 -0
  32. package/lib/credentials/vault.js +114 -0
  33. package/lib/engine/account-manager.d.ts +65 -0
  34. package/lib/engine/account-manager.js +239 -0
  35. package/lib/engine/commands.d.ts +41 -0
  36. package/lib/engine/commands.js +204 -0
  37. package/lib/engine/gateway.d.ts +91 -0
  38. package/lib/engine/gateway.js +338 -0
  39. package/lib/engine/interactions.d.ts +65 -0
  40. package/lib/engine/interactions.js +254 -0
  41. package/lib/engine/media.d.ts +50 -0
  42. package/lib/engine/media.js +77 -0
  43. package/lib/engine/router.d.ts +38 -0
  44. package/lib/engine/router.js +56 -0
  45. package/lib/host-compat/fs-api.d.ts +2 -0
  46. package/lib/host-compat/fs-api.js +34 -0
  47. package/lib/host-compat/interaction.d.ts +62 -0
  48. package/lib/host-compat/interaction.js +58 -0
  49. package/lib/host-compat/services.d.ts +45 -0
  50. package/lib/host-compat/services.js +68 -0
  51. package/lib/host-compat/session-api.d.ts +80 -0
  52. package/lib/host-compat/session-api.js +240 -0
  53. package/lib/host-compat/session-source.d.ts +17 -0
  54. package/lib/host-compat/session-source.js +8 -0
  55. package/lib/host-compat/settings-compat.d.ts +31 -0
  56. package/lib/host-compat/settings-compat.js +153 -0
  57. package/lib/index.d.ts +8 -0
  58. package/lib/index.js +227 -0
  59. package/lib/types.d.ts +63 -0
  60. package/lib/types.js +6 -0
  61. package/locale/de.json +1 -0
  62. package/locale/en.json +1 -0
  63. package/locale/es.json +1 -0
  64. package/locale/fr.json +1 -0
  65. package/locale/it.json +1 -0
  66. package/locale/ja.json +1 -0
  67. package/locale/ko.json +1 -0
  68. package/locale/ru.json +1 -0
  69. package/locale/zh.json +1 -0
  70. package/package.json +113 -4
  71. package/src/admin/api.ts +162 -0
  72. package/src/channels/discord.ts +556 -0
  73. package/src/channels/feishu.ts +282 -0
  74. package/src/channels/meta.ts +97 -0
  75. package/src/channels/registry.ts +46 -0
  76. package/src/channels/telegram.ts +476 -0
  77. package/src/channels/types.ts +115 -0
  78. package/src/channels/wecom.ts +518 -0
  79. package/src/channels/weixin-qr.ts +95 -0
  80. package/src/channels/weixin.ts +545 -0
  81. package/src/credentials/vault.ts +133 -0
  82. package/src/engine/account-manager.ts +284 -0
  83. package/src/engine/commands.ts +233 -0
  84. package/src/engine/gateway.ts +388 -0
  85. package/src/engine/interactions.ts +311 -0
  86. package/src/engine/media.ts +106 -0
  87. package/src/engine/router.ts +78 -0
  88. package/src/host-compat/fs-api.ts +35 -0
  89. package/src/host-compat/interaction.ts +132 -0
  90. package/src/host-compat/services.ts +113 -0
  91. package/src/host-compat/session-api.ts +305 -0
  92. package/src/host-compat/session-source.ts +25 -0
  93. package/src/host-compat/settings-compat.ts +179 -0
  94. package/src/index.ts +236 -0
  95. package/src/types.ts +73 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,23 @@
1
+ # Changelog
2
+
3
+ 本项目版本号遵循语义化版本;发布面与宿主兼容矩阵见 `scripts/hosts.mjs`(README 管理块同源)。
4
+
5
+ ## 0.0.1(首发占位,tag=next)
6
+
7
+ 预发布占位版本,非推荐安装线;语义为「协议层与跨版本骨架完成、真机验收进行中」。
8
+
9
+ ### Added
10
+
11
+ - 跨版本窄腰(host-compat):services 能力探测冻结 / settings-compat 三态代际分派(gen1/gen2/gen3)/ session-api(宿主 @Remote request-object 主形 + 位置参回退)/ interaction(waterfall 返回即接管)/ fs-api
12
+ - 会话引擎:每聊天串行队列、follow-before-prompt 投递状态机(assistant/message 按 step 聚合 → 流式快照)、turn/end 六因映射、看门狗兜底
13
+ - 命令面板 15 命令(/help /status /new /stop /steer /models /model /reasoning /presets /preset /workspace(s) /session(s) /menu),能力缺位=降级文案不抛
14
+ - P0 五渠道协议层(净室重实现):微信 iLink(官方 ClawBot 协议:长轮询/context_token/AES-128-ECB CDN 全链/typing/扫码绑定)、Telegram(Bot API 长轮询+编辑流式+Markdown 回退链)、Discord(Gateway v10+Thread 模型+表格转竖排)、飞书(官方 SDK 长连接+逐步消息)、企业微信智能机器人(长连接 aibot 协议+stream 编辑流式)
15
+ - 审批与交互提问 IM 闭环(once-settle 状态机、发起者限定、fail-closed、5 分钟取消)
16
+ - 图片输入公共层(宿主 capability 元数据判视觉、三重预算、渠道图片下载)
17
+ - 多账号管理:AccountManager(原子文件态、secret 单向入库、暂停/恢复/白名单/诊断)+ 管理 API(requestRejection/Host/Origin/Cookie 三查、零凭据回包)+ client 半账号 CRUD 面板(九语)
18
+ - 门禁四件套:typecheck / 单测 164 项 / dist 冒烟 / hosts:check 单源下发;peer 全枚举 0.1.2-rc.1..0.2.1-rc.1(11 tag)
19
+
20
+ ### Known (intentionally pre-release)
21
+
22
+ - 各渠道真机 round-trip 验收进行中(T1.10)
23
+ - 飞书流式卡片档/QR 创建机器人、企微原生进度显示、微信设置页扫码 UI 流为后续迭代
package/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 dsh-im-union contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ---
24
+
25
+ This project is a clean-room reimplementation of capabilities popularized by
26
+ xmanrui/dsh-im (MIT) and MichengAI/dsh-im-connect (Apache-2.0). No source code
27
+ was copied from either project; see THIRD_PARTY_NOTICES.md for attribution of
28
+ protocol knowledge and external SDK dependencies.
package/README.en.md ADDED
@@ -0,0 +1,26 @@
1
+ # dsh-im-union
2
+
3
+ A union IM bridge for DeepSeek Harness — a clean-room reimplementation merging the capability sets of xmanrui/dsh-im and MichengAI/dsh-im-connect, with no source copied from either.
4
+
5
+ <!-- host-compat:begin — generated by scripts/sync-hosts.mjs from scripts/hosts.mjs; DO NOT EDIT -->
6
+ - **Supported DSH hosts:** `0.1.2-rc.1` `0.1.5-rc.1` `0.1.5-rc.2` `0.1.5-rc.3` `0.1.7-rc.1` `0.1.7-rc.2` `0.2.0-rc.1` `0.2.0-rc.2` `0.2.1-alpha.2` `0.2.1-alpha.3` `0.2.1-rc.1` (11 rc/alpha releases across lines 0.1.2 / 0.1.5 / 0.1.7 / 0.2.0 / 0.2.1)
7
+ <!-- host-compat:end -->
8
+
9
+ ## Status
10
+
11
+ Under development (M0 cross-version skeleton). See `tasks.md` for phasing.
12
+
13
+ ## Install (npm package available after M1)
14
+
15
+ ```sh
16
+ dsh plugin --profile web add dsh-im-union@latest --registry=https://registry.npmjs.org/
17
+ ```
18
+
19
+ ## Development
20
+
21
+ ```sh
22
+ npm install
23
+ npm run typecheck
24
+ npm test
25
+ node scripts/sync-hosts.mjs --write
26
+ ```
package/README.md CHANGED
@@ -1,3 +1,26 @@
1
- # Temporary Holding Version
1
+ # dsh-im-union
2
+
3
+ DeepSeek Harness 的 IM 联合桥——净室重写,能力合集来自社区两仓(xmanrui/dsh-im 与 MichengAI/dsh-im-connect),不复制其源码。
4
+
5
+ <!-- host-compat:begin — generated by scripts/sync-hosts.mjs from scripts/hosts.mjs; DO NOT EDIT -->
6
+ - **支持的 DSH 宿主:** `0.1.2-rc.1` `0.1.5-rc.1` `0.1.5-rc.2` `0.1.5-rc.3` `0.1.7-rc.1` `0.1.7-rc.2` `0.2.0-rc.1` `0.2.0-rc.2` `0.2.1-alpha.2` `0.2.1-alpha.3` `0.2.1-rc.1`(覆盖 0.1.2 / 0.1.5 / 0.1.7 / 0.2.0 / 0.2.1 共 11 个 rc/alpha)
7
+ <!-- host-compat:end -->
2
8
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
9
+ ## 状态
10
+
11
+ 开发中(M0 跨版本骨架)。能力分期见根目录 `tasks.md`。
12
+
13
+ ## 安装(M1 后提供 npm 包)
14
+
15
+ ```sh
16
+ dsh plugin --profile web add dsh-im-union@latest --registry=https://registry.npmjs.org/
17
+ ```
18
+
19
+ ## 开发
20
+
21
+ ```sh
22
+ npm install
23
+ npm run typecheck
24
+ npm test
25
+ node scripts/sync-hosts.mjs --write # 宿主版本声明单源下发
26
+ ```
package/SECURITY.md ADDED
@@ -0,0 +1,20 @@
1
+ # Security policy (dsh-im-union)
2
+
3
+ 不可让渡红线(实现与评审均以此为准):
4
+
5
+ 1. **凭据存储**:宿主 `ctx.credentials` 为主存储;仅当宿主无该服务时回退到
6
+ profile 目录下的文件 vault(原子写 tmp+rename、POSIX 0600 / Windows 继承 ACL)。
7
+ vault 文件损坏时抛错,**绝不覆盖唯一副本**。secret 单向提交给宿主,任何
8
+ RPC/HTTP 响应与状态接口不回传 token、secret、原始用户标识或内部异常细节。
9
+ 2. **管理 API**:`/api/dsh-im-union` 每个请求先过宿主 `connection.requestRejection`
10
+ (Host/trustedHosts + Origin + 登录 Cookie 三查);`connection` 服务缺失时返回
11
+ 503,**不降级为匿名可用**。写请求要求 `Content-Type: application/json` +
12
+ 客户端标识头,body 上限 1 MiB;响应携带 `Cache-Control: no-store`。
13
+ 3. **工具审批**:审批只在任务发起的原聊天闭环处理;群聊仅接受任务发起者回复;
14
+ 永不回退网页端处理;审批消息发送失败按拒绝处理;5 分钟无回复取消动作;
15
+ 任何路径不自动恢复 allowAllUsers / 开放响应模式。
16
+ 4. **入站准入**:先验 userId;私聊白名单为空即拒;群聊仅响应显式 @ 本机器人。
17
+ 5. **投递语义**:平台接受 ≠ 已送达(Receipt);发送结果不确定时不自动重发,
18
+ 宁可漏发不双发。
19
+
20
+ 漏洞报告:仓库 GitHub Security Advisory。
@@ -0,0 +1,27 @@
1
+ # Third-party notices
2
+
3
+ dsh-im-union is a clean-room reimplementation. No source code is copied from the
4
+ projects below; capability inventory and public protocol knowledge informed
5
+ this design, and the listed upstream SDKs are consumed as external npm
6
+ dependencies only.
7
+
8
+ ## Prior art (capability references, code NOT derived from)
9
+
10
+ - xmanrui/dsh-im — MIT License. Itself derives some protocol adapters from
11
+ Tencent/openclaw-weixin (MIT), DingTalk-Real-AI/dingtalk-openclaw-connector,
12
+ and @wecom/wecom-openclaw-cli (ISC); we re-implement against the same public
13
+ platform APIs without porting any of that code.
14
+ - MichengAI/dsh-im-connect — Apache License 2.0 (includes the §3 patent grant
15
+ with retaliation termination; no code ported).
16
+
17
+ ## Runtime npm dependencies (consumed as-is, licenses per their packages)
18
+
19
+ - @larksuiteoapi/node-sdk (MIT) — Feishu/Lark bot long-connection SDK
20
+ - dingtalk-stream (MIT) — DingTalk Stream mode SDK
21
+ - @wecom/aibot-node-sdk — WeCom intelligent-bot WebSocket SDK
22
+ - @tencent-connect/qqbot-connector — QQ bot QR pairing helper (declared
23
+ UNLICENSED upstream; used as an external dependency only, never vendored)
24
+ - qrcode (MIT) — QR rendering for scan-to-bind flows
25
+
26
+ P1/P2 additions will be listed here as they land (Baileys, @matrix-org/olm,
27
+ imapflow/nodemailer, sharp — none are dependencies at M0).