@yuriai/web 0.2.27-beta.3 → 0.2.27-beta.8

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 (198) hide show
  1. package/README.md +17 -0
  2. package/dist/assets/{AgentAvatar-kIN4sZMz.js → AgentAvatar-BJ42lGZD.js} +1 -1
  3. package/dist/assets/AssistantContactStatus-dtkObamV.js +3 -0
  4. package/dist/assets/AssistantUnreadBadge-QwhBfXpC.js +1 -0
  5. package/dist/assets/AssistantView-D7ryIKL0.js +1 -0
  6. package/dist/assets/{DiagramView-DK0iXm9b.js → DiagramView-ERrGEBDp.js} +1 -1
  7. package/dist/assets/{FadeInOnReveal-BJA9Za3T.js → FadeInOnReveal-Bu2GvaM9.js} +1 -1
  8. package/dist/assets/GuiPluginSurface-MzQgEZNr.js +1 -0
  9. package/dist/assets/{GuiPluginWindow-l4FYY6S-.js → GuiPluginWindow-DZMmlQzx.js} +1 -1
  10. package/dist/assets/Icon-Dj4CCqCP.js +1 -0
  11. package/dist/assets/{ImageLoadingPlaceholder-DCWssLJG.js → ImageLoadingPlaceholder-BnFXgUuO.js} +1 -1
  12. package/dist/assets/{LoadingImage-C_Hryaqe.js → LoadingImage-PBnivDKv.js} +1 -1
  13. package/dist/assets/{MarkdownRenderer-Y6uQXIFH.js → MarkdownRenderer-BajF4gUU.js} +2 -2
  14. package/dist/assets/{MarkdownRendererImpl-qKp1tQrP.js → MarkdownRendererImpl-CfyXL4rg.js} +1 -1
  15. package/dist/assets/{MarkstreamRendererImpl-B_JTod0h.js → MarkstreamRendererImpl-BGadklK1.js} +1 -1
  16. package/dist/assets/MobileDetailNavigation-DqajQdB4.js +1 -0
  17. package/dist/assets/{MobileResizableSheet-F1zSUD1S.js → MobileResizableSheet-BvdUgwA3.js} +1 -1
  18. package/dist/assets/{MobileShareBridge-F70fkIfS.js → MobileShareBridge-3oPoYnry.js} +2 -2
  19. package/dist/assets/MobileTabPageHeader-B6cRyIRH.js +2 -0
  20. package/dist/assets/{MultiRunWindow-D8m6R_4x.js → MultiRunWindow-yhs0Ih5_.js} +1 -1
  21. package/dist/assets/{OnboardingScreen-BAsPVV_W.js → OnboardingScreen-Bi1VWFQC.js} +1 -1
  22. package/dist/assets/{OverlayScrollbar-wiRM4AGj.js → OverlayScrollbar-BBDwGvGO.js} +1 -1
  23. package/dist/assets/{SettingsView-izzjIckv.js → SettingsView-BSf-SJUA.js} +15 -15
  24. package/dist/assets/{SettingsWindow-CSuHDq_c.js → SettingsWindow-BvSXVMTm.js} +1 -1
  25. package/dist/assets/TerminalView-DhL01N7e.js +8 -0
  26. package/dist/assets/{ToolOutputDialog-DJs9w1_J.js → ToolOutputDialog-C8lnH4Ky.js} +1 -1
  27. package/dist/assets/{YuriLogo-aBS6wlYU.js → YuriLogo-D8asj1CS.js} +1 -1
  28. package/dist/assets/{appThemeRegistry-BY5rY9-W.js → appThemeRegistry-C-maYSdv.js} +1 -1
  29. package/dist/assets/{assistant-attachment-cache-B9iHLlm2.js → assistant-attachment-cache-B_qRvy-k.js} +1 -1
  30. package/dist/assets/{button-Dt6Ygbc7.js → button-vXOdzd8x.js} +1 -1
  31. package/dist/assets/{capgoAdapter-MQ1qpf60.js → capgoAdapter-DJ_h2x5D.js} +1 -1
  32. package/dist/assets/{collapsible-Dm7OHk7m.js → collapsible-DwDQs3Wa.js} +1 -1
  33. package/dist/assets/context-menu-BabBujQ-.js +1 -0
  34. package/dist/assets/{desktopRelayRestore-CoLLVJw8.js → desktopRelayRestore-D1UX7HW2.js} +1 -1
  35. package/dist/assets/{diagram-DWZaG3_v.js → diagram-HwgrQxY5.js} +1 -1
  36. package/dist/assets/{dialog-CjQeHVOc.js → dialog-Dnf626tb.js} +1 -1
  37. package/dist/assets/dropdown-menu.styles-CBc_a-Nv.js +1 -0
  38. package/dist/assets/es-BQkO-Odr.js +15 -0
  39. package/dist/assets/feishu-Ct1ZxlzQ.svg +6 -0
  40. package/dist/assets/{fileMentionTouchSelection-D7QtVxjI.js → fileMentionTouchSelection-CKPnEetl.js} +1 -1
  41. package/dist/assets/{fileQueries-5a1jkme2.js → fileQueries-BeXkd3o6.js} +1 -1
  42. package/dist/assets/{fileReferenceActions-BAoEu4z8.js → fileReferenceActions-g7KZLi_G.js} +1 -1
  43. package/dist/assets/fr-C852roK5.js +13 -0
  44. package/dist/assets/gitApi-CVq5oKCd.js +370 -0
  45. package/dist/assets/gitApiHttp-BYOIbYIh.js +7 -0
  46. package/dist/assets/{gui-9enrif_1.js → gui-M_Rbwkyu.js} +1 -1
  47. package/dist/assets/host-BW3FEJdU.js +1 -0
  48. package/dist/assets/{image-loading-Dq1g_wpm.js → image-loading-D5UhMj7Z.js} +1 -1
  49. package/dist/assets/{input-Dq4usRDa.js → input-BtM712b1.js} +1 -1
  50. package/dist/assets/insertionBoundaries-Dx3WAY6i.js +1 -0
  51. package/dist/assets/ja-BqC39qK6.js +15 -0
  52. package/dist/assets/ko-BMaChAWh.js +15 -0
  53. package/dist/assets/main-9uP2z1qT.js +2 -0
  54. package/dist/assets/main-Mey7bCWf.js +169 -0
  55. package/dist/assets/{markdownHeightCache-C1u0bWDL.js → markdownHeightCache-Bf8iisO4.js} +1 -1
  56. package/dist/assets/{mcpQueries-D2IxTr4k.js → mcpQueries-DpXqegX5.js} +1 -1
  57. package/dist/assets/miniChat-DqZvVkme.js +2 -0
  58. package/dist/assets/mobile-DXAWjYcN.js +2 -0
  59. package/dist/assets/{mobileBackNavigation-vpCg1S7j.js → mobileBackNavigation-DZcI7aZg.js} +1 -1
  60. package/dist/assets/{multirun-DT-dFXud.js → multirun-hzspPepd.js} +1 -1
  61. package/dist/assets/{native-De1DIkLZ.js → native-H7K64Ulc.js} +1 -1
  62. package/dist/assets/{native-config-ncdoz9Wl.js → native-config-CddZtLQ1.js} +1 -1
  63. package/dist/assets/{persistence-JyLTFv27.js → persistence-BT8045Ue.js} +1 -1
  64. package/dist/assets/pl-Ubs8p28T.js +15 -0
  65. package/dist/assets/projectMeta-CEf0QPmD.js +1 -0
  66. package/dist/assets/pt-BR-8rAOjJrs.js +15 -0
  67. package/dist/assets/{queryRuntime-Dkpnq3Z1.js → queryRuntime-CTcigFdj.js} +1 -1
  68. package/dist/assets/react-DRe85o5s.js +1 -0
  69. package/dist/assets/readiness-Dyr7314z.js +1 -0
  70. package/dist/assets/renderElectronMiniChatApp-DoOq8Cuo.js +2 -0
  71. package/dist/assets/renderMobileApp-TTxtOb8b.js +28 -0
  72. package/dist/assets/runtime-fetch-D0YWp3FJ.js +1 -0
  73. package/dist/assets/{runtime-file-download-CcNIVp7u.js → runtime-file-download-Cf1WxfeW.js} +1 -1
  74. package/dist/assets/{runtime-file-resource-6np6lzoV.js → runtime-file-resource-UJjHUF2C.js} +1 -1
  75. package/dist/assets/runtimeConfig-B8VHHNxj.js +2 -0
  76. package/dist/assets/runtimeEndpointReset-BC6XWntz.js +149 -0
  77. package/dist/assets/scheduledTaskNavigation-Zm87Nydi.js +1 -0
  78. package/dist/assets/sessionLookup-De53jDwM.js +1 -0
  79. package/dist/assets/sortable-tabs-strip-D4pVoodN.js +1 -0
  80. package/dist/assets/speechSettingsQueries-RlCLMBtr.js +4 -0
  81. package/dist/assets/src-lE4uqaHS.css +2 -0
  82. package/dist/assets/store-ME7oHni1.js +15 -0
  83. package/dist/assets/{terminalApi-B5o8UqWA.js → terminalApi-BSaclMDJ.js} +1 -1
  84. package/dist/assets/{textarea-vtIQM2iP.js → textarea-B98rsLs7.js} +1 -1
  85. package/dist/assets/{tooltip-BpG2mxrT.js → tooltip-B9810jbK.js} +1 -1
  86. package/dist/assets/{types-CNTgeeM1.js → types-DFf9vd1b.js} +1 -1
  87. package/dist/assets/{uk-B_JwElWz.js → uk-LzwzUApL.js} +4 -4
  88. package/dist/assets/{useAppFontEffects-BguV1Hfa.js → useAppFontEffects-D2C1sBYM.js} +59 -57
  89. package/dist/assets/{useAssistantUIStore-C9FPlYQz.js → useAssistantUIStore-TUN_ycy5.js} +1 -1
  90. package/dist/assets/useDesktopWindowControlsLayout-BjKaHN0x.js +1 -0
  91. package/dist/assets/{useEffectiveDirectory-Ci6Z13kj.js → useEffectiveDirectory-TEvyiQSC.js} +1 -1
  92. package/dist/assets/{useFontPreferences-DMiP_Yy-.js → useFontPreferences-BlhlCJCX.js} +1 -1
  93. package/dist/assets/useMobileNavigationStore-DTvJV9s-.js +23 -0
  94. package/dist/assets/useUIStore-DRx6OgCp.js +1 -0
  95. package/dist/assets/{useWorkerHighlightedLines-HKhuYGSj.js → useWorkerHighlightedLines-D093jNsH.js} +1 -1
  96. package/dist/assets/{vendor-codemirror-search-ZqtrPLjU.js → vendor-codemirror-search-DiPwvA-6.js} +2 -2
  97. package/dist/assets/vendor-opencode-client-ZeOZ4Efz.js +23 -0
  98. package/dist/assets/{vendor-opencode-plugin-Bw7Q6Nv9.js → vendor-opencode-plugin-BBOP6WNx.js} +1 -1
  99. package/dist/assets/{vendor-replit-codemirror-vim-DDj0dSVY.js → vendor-replit-codemirror-vim-DCdAdxvE.js} +3 -3
  100. package/dist/assets/{vendor-solid-js-0T254UHG.js → vendor-solid-js-9wmPZH9g.js} +1 -1
  101. package/dist/assets/zh-CN-D-FVCeks.js +15 -0
  102. package/dist/assets/zh-TW-B9iH_NXL.js +15 -0
  103. package/dist/index.html +17 -17
  104. package/dist/mini-chat.html +17 -17
  105. package/dist/mobile.html +17 -17
  106. package/package.json +8 -3
  107. package/server/lib/assistants/DOCUMENTATION.md +33 -1
  108. package/server/lib/assistants/channels/DOCUMENTATION.md +291 -0
  109. package/server/lib/assistants/channels/PROTOCOLS.md +228 -0
  110. package/server/lib/assistants/channels/dingtalk-chat-adapter.js +633 -0
  111. package/server/lib/assistants/channels/dingtalk-chat-adapter.test.js +415 -0
  112. package/server/lib/assistants/channels/integration.test.js +44 -0
  113. package/server/lib/assistants/channels/routes.js +47 -0
  114. package/server/lib/assistants/channels/routes.test.js +105 -0
  115. package/server/lib/assistants/channels/runtime.js +867 -0
  116. package/server/lib/assistants/channels/runtime.test.js +723 -0
  117. package/server/lib/assistants/channels/sdk-adapters.js +371 -0
  118. package/server/lib/assistants/channels/sdk-adapters.test.js +367 -0
  119. package/server/lib/assistants/channels/store.js +246 -0
  120. package/server/lib/assistants/channels/store.test.js +286 -0
  121. package/server/lib/assistants/channels/transport.js +41 -0
  122. package/server/lib/assistants/channels/transport.test.js +23 -0
  123. package/server/lib/assistants/channels/wecom-chat-adapter.js +689 -0
  124. package/server/lib/assistants/channels/wecom-chat-adapter.test.js +109 -0
  125. package/server/lib/assistants/contracts.js +1 -0
  126. package/server/lib/assistants/message-channel-origin.js +7 -0
  127. package/server/lib/assistants/routes.js +14 -1
  128. package/server/lib/assistants/service.js +23 -7
  129. package/server/lib/assistants/service.test.js +151 -0
  130. package/server/lib/assistants/weixin/DOCUMENTATION.md +147 -8
  131. package/server/lib/assistants/weixin/api.js +2 -0
  132. package/server/lib/assistants/weixin/chat-adapter.js +107 -0
  133. package/server/lib/assistants/weixin/chat-adapter.test.js +62 -0
  134. package/server/lib/assistants/weixin/inbound.js +147 -0
  135. package/server/lib/assistants/weixin/inbound.test.js +121 -0
  136. package/server/lib/assistants/weixin/media.js +79 -0
  137. package/server/lib/assistants/weixin/media.test.js +66 -0
  138. package/server/lib/assistants/weixin/routes.js +4 -3
  139. package/server/lib/assistants/weixin/routes.test.js +30 -0
  140. package/server/lib/assistants/weixin/runtime.js +157 -66
  141. package/server/lib/assistants/weixin/runtime.test.js +372 -6
  142. package/server/lib/assistants/weixin/store.js +20 -3
  143. package/server/lib/assistants/weixin/store.test.js +72 -0
  144. package/server/lib/assistants/weixin/toon.js +49 -0
  145. package/server/lib/assistants/weixin/toon.test.js +25 -0
  146. package/server/lib/github/DOCUMENTATION.md +9 -8
  147. package/server/lib/llm/bridge-plugin.bundle.js +188 -188
  148. package/server/lib/opencode/DOCUMENTATION.md +2 -1
  149. package/server/lib/opencode/npm-registry.js +7 -21
  150. package/server/lib/opencode/npm-registry.test.js +36 -5
  151. package/server/lib/opencode/plugin-icon.d.ts +2 -0
  152. package/server/lib/opencode/plugin-icon.js +43 -0
  153. package/server/lib/opencode/plugin-icon.test.js +41 -0
  154. package/server/lib/opencode/plugin-routes.js +3 -1
  155. package/server/lib/opencode/plugin-routes.test.js +13 -0
  156. package/dist/assets/AssistantView-C2KQZ6a4.js +0 -3
  157. package/dist/assets/GuiPluginSurface-Dz2CdSUA.js +0 -1
  158. package/dist/assets/Icon-BP1sfnHn.js +0 -1
  159. package/dist/assets/MobileDetailNavigation-B3rUx5Ve.js +0 -1
  160. package/dist/assets/MobileTabPageHeader-0esgB2TO.js +0 -2
  161. package/dist/assets/TerminalView-BtM5-BVx.js +0 -8
  162. package/dist/assets/dropdown-menu.styles-PdxueXzN.js +0 -1
  163. package/dist/assets/es-BjI1GHJ5.js +0 -15
  164. package/dist/assets/fr-Bs7ndHkb.js +0 -13
  165. package/dist/assets/gitApi-BxQmH8Wg.js +0 -10
  166. package/dist/assets/gitApiHttp-DHrRqnYh.js +0 -7
  167. package/dist/assets/host-D1EpSUMR.js +0 -1
  168. package/dist/assets/insertionBoundaries-CKQL85zy.js +0 -1
  169. package/dist/assets/ja-DkdV26EW.js +0 -15
  170. package/dist/assets/ko-B0qoC5da.js +0 -15
  171. package/dist/assets/main-CNwFqQQd.js +0 -2
  172. package/dist/assets/main-DPhcXanT.js +0 -169
  173. package/dist/assets/miniChat-CF2vb25D.js +0 -2
  174. package/dist/assets/mobile-C24qSj44.js +0 -2
  175. package/dist/assets/pl-D27Y_GBs.js +0 -15
  176. package/dist/assets/projectMeta-CG8NLahh.js +0 -1
  177. package/dist/assets/pt-BR-DbocEu4b.js +0 -15
  178. package/dist/assets/react-CURmDhtB.js +0 -1
  179. package/dist/assets/readiness-DSJs_3v4.js +0 -1
  180. package/dist/assets/renderElectronMiniChatApp-ChZCxxH6.js +0 -2
  181. package/dist/assets/renderMobileApp-CRv3Il6P.js +0 -28
  182. package/dist/assets/runtime-fetch-D4ja813o.js +0 -1
  183. package/dist/assets/runtimeConfig-CZrflo-r.js +0 -2
  184. package/dist/assets/runtimeEndpointReset-Cx3RE97b.js +0 -149
  185. package/dist/assets/scheduledTaskNavigation-rhgnZaaj.js +0 -1
  186. package/dist/assets/sessionChangeSummary-CVUA1AFw.js +0 -1
  187. package/dist/assets/sessionLookup-C3_vQwLe.js +0 -1
  188. package/dist/assets/sortable-tabs-strip-C1QmKFdb.js +0 -1
  189. package/dist/assets/speechSettingsQueries-BSQ-2JTv.js +0 -4
  190. package/dist/assets/src-NKCZI3Lg.css +0 -2
  191. package/dist/assets/store-DvN2L3vf.js +0 -15
  192. package/dist/assets/useDesktopWindowControlsLayout-CwgkVw9f.js +0 -1
  193. package/dist/assets/useMobileNavigationStore-TCj7ZnhV.js +0 -418
  194. package/dist/assets/useUIStore-DI7va1HH.js +0 -1
  195. package/dist/assets/vendor-opencode-client-UL_TecvQ.js +0 -12
  196. package/dist/assets/zh-CN-DhFFdHQu.js +0 -15
  197. package/dist/assets/zh-TW-BvehppXO.js +0 -15
  198. /package/dist/assets/{sessionChangeSummary-8C8nv-EP.css → sessionLookup-8C8nv-EP.css} +0 -0
@@ -0,0 +1,228 @@
1
+ # Enterprise channel protocol boundaries
2
+
3
+ This directory integrates the vendor-maintained Chat SDK adapters instead of
4
+ maintaining a second platform wire implementation. Platform framing, WebSocket
5
+ handshakes, protobuf, ping/pong and reconnect stay in the SDKs below; Yuri owns
6
+ authorization, projection, durable receipts, outbound ordering and error
7
+ classification.
8
+
9
+ ## SDK inventory
10
+
11
+ | Provider | Package | Version | Role |
12
+ | --- | --- | --- | --- |
13
+ | Chat contract | `chat` | `4.44.0` | `Message` / `Author` / `Attachment` / `Adapter` / `NotImplementedError` |
14
+ | Feishu | `@larksuite/vercel-chat-adapter` | `0.3.0` | Chat SDK adapter wrapping `@larksuite/channel` |
15
+ | Feishu wire | `@larksuite/channel` | `0.7.1` | WebSocket long connection, 23-type normalization, resource download |
16
+ | WeCom | `@wecom/aibot-node-sdk` | `1.0.7` | Official smart-bot WebSocket and awaited send ACK; Yuri Chat Adapter extension |
17
+ | DingTalk | `dingtalk-stream` | `2.1.5` | Gateway open, WebSocket, ping/pong, subscription registration |
18
+
19
+ `@larksuite/channel` is a direct dependency of `packages/web` (`0.7.1`).
20
+ `sdk-adapters.js` imports `createLarkChannel`/`normalize` statically; there is no
21
+ runtime resolution fallback.
22
+
23
+ `transport.js` remains the owner of the small HTTP helpers
24
+ (`channelError`, `requestJSON`, `officialURL`). Channel adapters use
25
+ `requestJSON` for the two documented outbound REST calls and do **not** use the
26
+ removed `socketLoop`; no adapter opens a raw WebSocket or decodes protobuf.
27
+
28
+ ## Feishu
29
+
30
+ Wire evidence: `@larksuite/channel@0.7.1` and
31
+ `@larksuiteoapi/node-sdk@1.76.0` (`lib/index.js`), plus the official Go SDK
32
+ `larksuite/oapi-sdk-go@v3_main` (`ws/client_transport.go`).
33
+
34
+ - Bootstrap: `POST https://open.feishu.cn/callback/ws/endpoint` with
35
+ `{AppID, AppSecret}`; response carries `URL` and
36
+ `ClientConfig {PingInterval, ReconnectCount, ReconnectInterval, ReconnectNonce}`.
37
+ The SDK dials the returned `wss://` URL; query holds `device_id`/`service_id`.
38
+ - Frames are `pbbp2.Frame` protobuf: `1 SeqID uint64`, `2 LogID uint64`,
39
+ `3 service int32`, `4 method int32`, `5 headers`, `6 payloadEncoding`,
40
+ `7 payloadType`, `8 payload`, `9 LogIDNew`; each header is
41
+ `1 key`/`2 value`. `method` is `0 control` / `1 data`.
42
+ - Heartbeat: control frame with header `type=ping`; `pong` payload is JSON that
43
+ updates interval/reconnect settings. `ping` frames received from the peer are
44
+ not answered by the client.
45
+ - Delivery ACK: the official dispatcher replies with the same frame headers plus
46
+ `biz_rt` and a JSON payload (`{code:200}`), and only after awaited handlers.
47
+ - Outbound: `POST /open-apis/im/v1/messages?receive_id_type=open_id` with
48
+ `msg_type: text`, `content: {"text": ...}`. `uuid` dedupes for one hour and is
49
+ capped at 50 characters (official API documentation); `outboundUuid()` keeps
50
+ short row IDs verbatim and hashes longer ones to 40 hex characters.
51
+ `tenant_access_token/internal` uses `{app_id, app_secret}` and caches until
52
+ `expire - 180s`.
53
+
54
+ ACK durability: the Chat adapter's normalized `message` path is not awaited by
55
+ the vendor dispatcher, so it cannot gate the ACK. `sdk-adapters.js` therefore
56
+ projects and persists through the public
57
+ `LarkChannel.onRawEvent('im.message.receive_v1')` hook. The hook is installed
58
+ from inside `channelFactory`, i.e. before the adapter calls `channel.connect()`,
59
+ so there is no unguarded boot window and no fallback path. The normalized
60
+ `message` handler registered by the vendor adapter is inert for Yuri (the raw
61
+ gate already owns delivery) and no private `_getChannel()` accessor is used.
62
+
63
+ The vendor dispatcher awaits the raw handler before replying, which is what
64
+ keeps the ACK behind the durable receipt. It also catches handler exceptions, so
65
+ a failed durable write cannot force a non-200 ACK frame; the bridge reports
66
+ `onError` instead, and the runtime aborts/reconnects that lane. Readiness is
67
+ re-armed from the channel's own `reconnected` event (`reconnecting` maps to
68
+ `network_error`), so a successful SDK reconnect never leaves `runtime.ready`
69
+ false.
70
+
71
+ `createLarkAdapter` disables the channel's own stale/dedup/lock/batch pipeline
72
+ (`safety.staleMessageWindowMs` maxed, `chatQueue` off, batch delays 0); Yuri owns
73
+ authorization and receipt dedupe.
74
+
75
+ Boundaries:
76
+
77
+ - Inbound text comes from the vendor normalization. Images/files/audio/video
78
+ are reported as bounded public descriptors (`type`, `name`, `durationMs`) with
79
+ `notDownloaded: true`; `file_key` is never projected or downloaded.
80
+ - The adapter's `Message.attachments` is empty today (the Chat adapter does not
81
+ bridge `NormalizedMessage.resources`), so descriptors are read from the
82
+ vendor's normalized `raw` payload. Acquiring bytes would require the vendor's
83
+ internal `downloadResource` API; Yuri does not do that.
84
+ - The vendor adapter auto-reconnects its WebSocket itself. Yuri's runtime must
85
+ not add a second reconnect loop for Feishu; the bridge maps the channel's
86
+ `reconnecting` event to `onError('network_error')` and its `reconnected`
87
+ event back to `onReady()`, so the UI does not stay `connected` during a gap and
88
+ does not stay `reconnecting` after a successful resume. A 1s monitor reads the
89
+ public `channel.getConnectionStatus()`; when the vendor exhausts its bounded
90
+ reconnect attempts and reports `state: 'failed'`, the bridge reports
91
+ `network_error` and returns from `connect()` so the runtime opens a fresh
92
+ adapter. The bridge deliberately does not map every channel `error` event to a
93
+ transport failure, because that event also covers non-fatal normalization and
94
+ meeting errors; doing so would revoke readiness on a healthy connection.
95
+ - Outbound never retries automatically. `requestJSON` marks HTTP 5xx/timeouts
96
+ during a send as ambiguous so the store records `delivery_unknown`.
97
+ - Aborting during `channel.connect()` is safe: the vendor's `disconnect()` is a
98
+ no-op before the handshake completes, so the bridge closes the channel again
99
+ once the aborted initialize settles. A canceled connect cannot leave a live
100
+ socket behind.
101
+
102
+ ## WeCom smart bot
103
+
104
+ Wire evidence: official `https://github.com/WecomTeam/aibot-node-sdk`,
105
+ `src/client.ts` (`sendMessage`) and `src/ws.ts` (`sendReply`/ACK handling).
106
+ `wecom-chat-adapter.js` implements the Chat SDK contract over its public `WSClient`.
107
+
108
+ - The SDK owns the official WebSocket, authentication, heartbeat, reconnect and
109
+ request-ID ACK matching. No private `wsManager` fields or custom wire are used.
110
+ - `authenticated` establishes readiness; `disconnected`/`reconnecting` revoke it.
111
+ Re-authentication restores readiness. Authentication failure and replacement are
112
+ sticky errors; reconnect exhaustion returns control to Yuri's scheduler.
113
+ - Initialization has a deadline; abort closes the SDK connection and listeners.
114
+ - `sendMessage()` waits for the platform ACK. Only `errcode: 0` advances the
115
+ outbox as sent (platform accepted, not proof the user read it). Nonzero ACKs are
116
+ definite failures; timeout, cancellation or disconnection after submission are
117
+ `delivery_unknown` and are never automatically resent.
118
+ - A configured owner fixes the private recipient; otherwise the runtime's private
119
+ durable `target.userID` supplies it. Missing recipients fail before sending.
120
+ - Incoming messages preserve `msgid` for durable dedup, use standard Chat `Message`
121
+ and platform voice transcription, and drop groups/disallowed senders. Media
122
+ descriptors are explicitly `notDownloaded`; URLs and AES keys are not projected.
123
+ - Different credentials have independent live clients. The personal-WeChat
124
+ single-entry/rebind rule remains confined to `weixin/`.
125
+ - The previous community adapter was removed because black-box testing proved
126
+ its `postMessage()` resolved before ACK and ignored nonzero ACKs. Regression
127
+ tests now drive the official SDK against a local WebSocket server, including
128
+ successful consecutive sends, nonzero ACKs and cancellation.
129
+
130
+ ## DingTalk
131
+
132
+ Wire evidence: `dingtalk-stream@2.1.5` `dist/client.mjs` and
133
+ `src/client.ts` of `open-dingtalk/dingtalk-stream-sdk-nodejs`; OpenAPI metadata
134
+ from `@alicloud/dingtalk@2.2.48` (`robot_1_0`, `oauth2_1_0`).
135
+
136
+ - Gateway: `POST https://api.dingtalk.com/v1.0/gateway/connections/open` with
137
+ `{clientId, clientSecret, ua, subscriptions}`; response `{endpoint, ticket}`
138
+ and the SDK dials `${endpoint}?ticket=...`.
139
+ - The SDK owns ping/pong, `SYSTEM/CONNECTED|REGISTERED|disconnect|KEEPALIVE`
140
+ and reconnect (disabled here with `autoReconnect: false`, because Yuri's
141
+ runtime owns reconnect).
142
+ - Readiness: `REGISTERED` is the only authenticated signal. `connect()` waits
143
+ for it with a `INIT_TIMEOUT_MS` deadline. The `onLost` hook and watchdog are
144
+ installed before `client.connect()`, so a disconnect during the handshake is
145
+ never missed. A socket that opens but never registers is reported as
146
+ `network_error`, never `connected`.
147
+ - Session ownership: `createDingtalkSdkAdapter` creates one independent
148
+ `DingTalkChatAdapter` per `clientID+clientSecret+ownerID`. There is no shared
149
+ `this.session` singleton, so multiple bots connect in parallel; a duplicate
150
+ live connect for the same config is rejected with `channel_in_use`. The live
151
+ session map never evicts an active session.
152
+ - Initialization is abortable and bounded. Aborting during the SDK's endpoint
153
+ request closes the session and a late `_connect()` is refused, so the
154
+ underlying socket/timers cannot outlive the aborted connect.
155
+ - CALLBACK ACK: `2.1.5` does not auto-ack callbacks. `socketCallBackResponse`
156
+ is called only after the Yuri delivery promise resolves; failures leave the
157
+ callback unacknowledged for the platform retry. Unauthorized/malformed frames
158
+ are acknowledged and dropped so they cannot retry forever.
159
+ - Outbound: `POST /v1.0/oauth2/accessToken` `{appKey, appSecret}` →
160
+ `{accessToken, expireIn}` (cached until `expireIn - 300s`), then
161
+ `POST /v1.0/robot/oToMessages/batchSend` with
162
+ `{robotCode, userIds: [userID], msgKey: 'sampleText', msgParam}` and
163
+ `x-acs-dingtalk-access-token`. The recipient is `config.ownerID` when configured,
164
+ otherwise the runtime-derived `target.userID`. `invalidStaffIdList`,
165
+ `flowControlledStaffIdList` and `filteredStaffIdList` are all treated as
166
+ definite failures. HTTP 5xx/timeouts during send are ambiguous.
167
+ - Threads: `dingtalk:private:<owner>` / `dingtalk:group:<conversationId>`.
168
+ `isDM()` is true only for the `private` prefix, so a group is never reported as
169
+ a DM. `postMessage` throws `NotImplementedError` for group threads and
170
+ `invalid_response` for any private thread that is not the configured owner.
171
+ - Postables: `renderFormatted`/`messageText` accept standard Chat shapes only —
172
+ string, `{raw}`, `{markdown}` and `{ast}` (via `stringifyMarkdown`). The
173
+ non-standard `{text}` field is not read.
174
+ - Projection: single chat only; `senderStaffId` (fallback `senderId`) must
175
+ equal `ownerID` when configured, and the bot's own `chatbotUserId` is rejected. `audio` uses
176
+ the platform's `recognition` text and marks `metadata.transcript =
177
+ 'platform'`; audio without recognition is `notDownloaded` and carries **no**
178
+ invented transcript. `richText` is flattened to its text items. Other
179
+ non-text messages yield `notDownloaded: true` plus `mediaType` and a bounded
180
+ name. `sessionWebhook`, `robotCode`, `conversationId` and download codes are
181
+ never projected.
182
+ - Unsupported Chat methods (`editMessage`, `deleteMessage`, `fetchMessages`,
183
+ `fetchThread`, `addReaction`, `removeReaction`, `startTyping`) throw the Chat
184
+ SDK `NotImplementedError` instead of pretending to work. `handleWebhook`
185
+ returns 501; this adapter is long-connection only.
186
+
187
+ ## Shared projection and logging
188
+
189
+ - Only `private`/single-chat messages with sender identities are delivered.
190
+ A non-empty `ownerID` restricts this to one sender; empty uses platform access
191
+ controls. Group messages, disallowed senders, bot/app senders and the bot's own
192
+ events are dropped before any download or metadata expansion. Bot context is
193
+ shared, not isolated per sender; administrators must verify platform availability.
194
+ - Inbound metadata is rebuilt from scratch with public fields only. Capability
195
+ or secret handles (Feishu `file_key`, WeCom `aeskey`/`response_url`, DingTalk
196
+ `sessionWebhook`/`robotCode`) are never copied, even when the vendor message
197
+ carries them.
198
+ - Media is never downloaded automatically; every media message is explicitly
199
+ marked `notDownloaded` rather than claiming the content was read.
200
+ - Logging: every vendor logger is replaced with an inert logger
201
+ (`noopLogger()`). Vendor log arguments are never formatted or forwarded, so
202
+ tokens, URLs, IDs, message content and upstream error bodies cannot reach Yuri
203
+ logs through SDK logger objects. SDK errors are mapped to
204
+ `auth_expired`/`invalid_response`/`network_error`/`connection_replaced`
205
+ without forwarding raw upstream messages.
206
+
207
+ ## Known limits
208
+
209
+ - Feishu: one extra normalization per inbound message (the vendor pipeline also
210
+ normalizes). The vendor dispatcher swallows exceptions from raw handlers, so a
211
+ failed durable write cannot force a non-200 ACK frame; the bridge reports
212
+ `onError` and the runtime aborts the lane instead.
213
+ - Feishu: `uuid` is derived from the durable delivery row ID; if the same row is
214
+ re-sent with different text, the platform would dedupe it. Yuri never mutates
215
+ a queued row's text. Neither vendor SDK exposes an idempotent send, which is
216
+ why the bridge uses the documented HTTP call with `uuid`.
217
+ - WeCom: real tenant authentication, proactive-message permissions and actual
218
+ network reconnection remain unverified; local SDK/ACK tests are not tenant tests.
219
+ - DingTalk: no media download, no history fetch, and readiness depends on the
220
+ platform emitting `REGISTERED` within the bounded window. Abort cleanup patches
221
+ the SDK's internal `_connect` because `connect()` awaits an unabortable
222
+ endpoint request before creating the socket.
223
+ - These adapters were validated with unit fixtures and the real SDK runtime
224
+ packages (including the real `WeComFormatConverter`, Feishu `normalize`, Chat
225
+ `Message`/`stringifyMarkdown`, and a real `@agentor/chat-wecom@0.1.3` run over
226
+ an injected fake `WebSocket` for the ACK evidence), not with live
227
+ Feishu/WeCom/DingTalk tenants. Real-account authentication, delivery and
228
+ reconnect behavior still require manual verification.