@yuriai/web 0.2.27-beta.6 → 0.2.27

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 (228) hide show
  1. package/README.md +8 -0
  2. package/dist/assets/{AgentAvatar-Bi1vvWPC.js → AgentAvatar-DNm_jMna.js} +1 -1
  3. package/dist/assets/AssistantContactStatus-BPRpgMFh.js +3 -0
  4. package/dist/assets/{AssistantUnreadBadge-DdJyySwn.js → AssistantUnreadBadge-BssH-RvV.js} +1 -1
  5. package/dist/assets/AssistantView-CxQv-9Ms.js +1 -0
  6. package/dist/assets/{DiagramView-CI4bTtxy.js → DiagramView-DPpG0fwx.js} +1 -1
  7. package/dist/assets/{FadeInOnReveal-BB4qEnAn.js → FadeInOnReveal-S6UbimjB.js} +1 -1
  8. package/dist/assets/{GuiPluginSurface-CguxFUbM.js → GuiPluginSurface-BOf0JA1T.js} +1 -1
  9. package/dist/assets/{GuiPluginWindow-DOJ7wuRH.js → GuiPluginWindow-OrYkfQ4m.js} +1 -1
  10. package/dist/assets/{Icon-t2xvbAyN.js → Icon-BE4mEwzV.js} +1 -1
  11. package/dist/assets/{ImageLoadingPlaceholder-D1L13TK0.js → ImageLoadingPlaceholder-CBFJC_KD.js} +1 -1
  12. package/dist/assets/{LoadingImage-5rY_edNm.js → LoadingImage-NLq7_P-i.js} +1 -1
  13. package/dist/assets/MarkdownRenderer-BaMotAOQ.js +2 -0
  14. package/dist/assets/{MarkdownRendererImpl-cE-0AYRg.js → MarkdownRendererImpl-Cv6UnGG7.js} +1 -1
  15. package/dist/assets/{MarkstreamRendererImpl-BZyqDl82.js → MarkstreamRendererImpl-Rb9O6wkW.js} +1 -1
  16. package/dist/assets/{MobileDetailNavigation-tbfsMfB-.js → MobileDetailNavigation-CK4KbkeS.js} +1 -1
  17. package/dist/assets/{MobileResizableSheet-BeRmT6_x.js → MobileResizableSheet-Deidw1br.js} +1 -1
  18. package/dist/assets/{MobileShareBridge-C3Equ3P_.js → MobileShareBridge-CO_OWEfq.js} +2 -2
  19. package/dist/assets/MobileTabPageHeader-DbC8L6A4.js +2 -0
  20. package/dist/assets/{MultiRunWindow-CAM2XPII.js → MultiRunWindow-DtVW9NTV.js} +1 -1
  21. package/dist/assets/{OnboardingScreen-4ftRerP5.js → OnboardingScreen-C8ld4wO7.js} +1 -1
  22. package/dist/assets/{OverlayScrollbar-CF0PCvQz.js → OverlayScrollbar-B3auC2WH.js} +1 -1
  23. package/dist/assets/{SettingsView-2tk4WH7R.js → SettingsView-Cm7woZWl.js} +15 -15
  24. package/dist/assets/{SettingsWindow-B9zbeJaW.js → SettingsWindow-CdL4PFxW.js} +1 -1
  25. package/dist/assets/{TerminalView-DfxvTHye.js → TerminalView-CwRB6Yyr.js} +1 -1
  26. package/dist/assets/{ToolOutputDialog-CrjDIhru.js → ToolOutputDialog-B4BfmoVH.js} +1 -1
  27. package/dist/assets/{YuriLogo-QvS1ZEHi.js → YuriLogo-BOx0s0Ue.js} +1 -1
  28. package/dist/assets/{appThemeRegistry-Bb_DtiV9.js → appThemeRegistry-B6woJIX5.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-DinGM3tu.js → button-BXxwtxsG.js} +1 -1
  31. package/dist/assets/{capgoAdapter-DufzjXRs.js → capgoAdapter-C5HFS-rx.js} +1 -1
  32. package/dist/assets/{collapsible-Bh1GLNYV.js → collapsible-BEm0787p.js} +1 -1
  33. package/dist/assets/context-menu-DUwvVUDY.js +1 -0
  34. package/dist/assets/{desktopRelayRestore-CoLLVJw8.js → desktopRelayRestore-D1UX7HW2.js} +1 -1
  35. package/dist/assets/device-BcRP6Tjd.js +2 -0
  36. package/dist/assets/{diagram-BmG-7Jb4.js → diagram-DyY8dxjZ.js} +1 -1
  37. package/dist/assets/{dialog-BXssfGXA.js → dialog-CLca6ojn.js} +1 -1
  38. package/dist/assets/dropdown-menu.styles-DGaALKP0.js +1 -0
  39. package/dist/assets/{es-HP_Ise0X.js → es-CrsHvgue.js} +2 -2
  40. package/dist/assets/feishu-Ct1ZxlzQ.svg +6 -0
  41. package/dist/assets/fileMentionAutocompleteState-BZJqfgae.js +2 -0
  42. package/dist/assets/{fileMentionTouchSelection-DSl0tj2r.js → fileMentionTouchSelection-C4dvP8GY.js} +2 -2
  43. package/dist/assets/{fileQueries-5a1jkme2.js → fileQueries-BeXkd3o6.js} +1 -1
  44. package/dist/assets/{fileReferenceActions-CGpBSFq4.js → fileReferenceActions-CrIAce3K.js} +1 -1
  45. package/dist/assets/{fr-D0kJXJ6U.js → fr-CEgiRlfa.js} +2 -2
  46. package/dist/assets/{gitApi-Wo0IZow9.js → gitApi-D2G9ny2O.js} +1 -1
  47. package/dist/assets/{gitApiHttp-De9liKnG.js → gitApiHttp-B7vYwgBh.js} +4 -4
  48. package/dist/assets/{gui-9enrif_1.js → gui-CJjEj3l4.js} +1 -1
  49. package/dist/assets/host-CnVx34Dh.js +1 -0
  50. package/dist/assets/{image-loading-Dq1g_wpm.js → image-loading-D5UhMj7Z.js} +1 -1
  51. package/dist/assets/{input-v8-rVbo-.js → input-D59Q2pm8.js} +1 -1
  52. package/dist/assets/insertionBoundaries-CedfTSM5.js +1 -0
  53. package/dist/assets/{ja-BjHKXazE.js → ja-CX-_p9jZ.js} +2 -2
  54. package/dist/assets/{ko-Llwnl876.js → ko-D5xlLYJM.js} +2 -2
  55. package/dist/assets/main-CxpUooVS.js +2 -0
  56. package/dist/assets/main-Dpm4KxWX.js +169 -0
  57. package/dist/assets/{markdownHeightCache-BVV2dktw.js → markdownHeightCache-D2VWb_4E.js} +1 -1
  58. package/dist/assets/{mcpQueries-BoBrB4a4.js → mcpQueries-DQ3KthDF.js} +1 -1
  59. package/dist/assets/miniChat-CTdj8Ug9.js +2 -0
  60. package/dist/assets/mobile-ChbA3Q8j.js +2 -0
  61. package/dist/assets/{mobileBackNavigation-DMSzAvb6.js → mobileBackNavigation-BJqt3oHk.js} +1 -1
  62. package/dist/assets/{multirun-BhWttsRQ.js → multirun-BILeETbd.js} +1 -1
  63. package/dist/assets/{native-DSvNnKAm.js → native-BYMhr-xH.js} +1 -1
  64. package/dist/assets/{native-config-DjdrW_9n.js → native-config-BIY0Cr-l.js} +1 -1
  65. package/dist/assets/{persistence-CfrHIiIS.js → persistence-CWuLIq1J.js} +2 -2
  66. package/dist/assets/{pl-BOd_idqn.js → pl-BjH81A_q.js} +2 -2
  67. package/dist/assets/projectMeta-B9_Uh8YH.js +1 -0
  68. package/dist/assets/{pt-BR-B8djxMsl.js → pt-BR-Dp5oK2x3.js} +2 -2
  69. package/dist/assets/{queryRuntime-Dkpnq3Z1.js → queryRuntime-CTcigFdj.js} +1 -1
  70. package/dist/assets/queue-abort-optimistic-CS5jTJq-.js +1 -0
  71. package/dist/assets/react-DRe85o5s.js +1 -0
  72. package/dist/assets/readiness-BNIgH81X.js +1 -0
  73. package/dist/assets/renderElectronMiniChatApp-asOqV7FB.js +2 -0
  74. package/dist/assets/renderMobileApp-DAfque7-.js +28 -0
  75. package/dist/assets/runtime-fetch-D0YWp3FJ.js +1 -0
  76. package/dist/assets/{runtime-file-download-CcNIVp7u.js → runtime-file-download-Cf1WxfeW.js} +1 -1
  77. package/dist/assets/{runtime-file-resource-6np6lzoV.js → runtime-file-resource-UJjHUF2C.js} +1 -1
  78. package/dist/assets/runtimeConfig-BX8JirIc.js +2 -0
  79. package/dist/assets/runtimeEndpointReset-CFQgUiUr.js +149 -0
  80. package/dist/assets/scheduledTaskNavigation-EomDNVu2.js +1 -0
  81. package/dist/assets/sessionLookup-BxAaxPOw.js +1 -0
  82. package/dist/assets/{sortable-tabs-strip-yKyqsqut.js → sortable-tabs-strip-DpbW5MqX.js} +1 -1
  83. package/dist/assets/speechSettingsQueries-CC0fusUo.js +4 -0
  84. package/dist/assets/src-BMKjN2ip.css +2 -0
  85. package/dist/assets/{store-CUBymvAC.js → store-CkIHVrmT.js} +4 -3
  86. package/dist/assets/{terminalApi-BblSkqch.js → terminalApi-rl9mZAlB.js} +1 -1
  87. package/dist/assets/{textarea-B39OCNPV.js → textarea-7eTptEtD.js} +1 -1
  88. package/dist/assets/{tooltip-d8TNN4lx.js → tooltip-BPwoSTzO.js} +1 -1
  89. package/dist/assets/types-CUtSV1V8.js +2 -0
  90. package/dist/assets/{uk-BNd7CjVO.js → uk-BEfkaLtM.js} +2 -2
  91. package/dist/assets/{useAppFontEffects-BVoVpJYO.js → useAppFontEffects-Ck2PdQRx.js} +52 -52
  92. package/dist/assets/{useAssistantUIStore-Bp6TxG5E.js → useAssistantUIStore-CfaQV3ID.js} +1 -1
  93. package/dist/assets/useDesktopWindowControlsLayout-DxxOUZj1.js +1 -0
  94. package/dist/assets/useEffectiveDirectory-CNCQfN_x.js +1 -0
  95. package/dist/assets/{useFontPreferences-BFyBjtQ6.js → useFontPreferences-DeqW9nRx.js} +1 -1
  96. package/dist/assets/useMobileNavigationStore-BmVr5a5c.js +17 -0
  97. package/dist/assets/useUIStore-C6CE42oh.js +1 -0
  98. package/dist/assets/{useWorkerHighlightedLines-CPxG8Fya.js → useWorkerHighlightedLines-CN_RGaSw.js} +1 -1
  99. package/dist/assets/{vendor-effect-DV9F8PTZ.js → vendor-effect-X1Hqc7ba.js} +13 -13
  100. package/dist/assets/vendor-opencode-client-cQ47ywrT.js +23 -0
  101. package/dist/assets/{vendor-opencode-plugin-CgKz9Hcy.js → vendor-opencode-plugin-BmdTE4Te.js} +1 -1
  102. package/dist/assets/vendor-opencode-schema-DWT45VBX.js +1 -0
  103. package/dist/assets/vendor-solid-js-D98iXT7C.js +1 -0
  104. package/dist/assets/vendor-zod-DZzbCm1s.js +55 -0
  105. package/dist/assets/{zh-CN-BkTAEOZG.js → zh-CN-DipfA56P.js} +2 -2
  106. package/dist/assets/{zh-TW-x8SfMzfc.js → zh-TW-B7pXMVjt.js} +2 -2
  107. package/dist/index.html +18 -18
  108. package/dist/mini-chat.html +18 -18
  109. package/dist/mobile.html +18 -18
  110. package/package.json +6 -1
  111. package/server/index.js +2 -145
  112. package/server/lib/assistants/DOCUMENTATION.md +69 -11
  113. package/server/lib/assistants/cards.js +1 -1
  114. package/server/lib/assistants/channel-image.js +92 -0
  115. package/server/lib/assistants/channel-image.test.js +76 -0
  116. package/server/lib/assistants/channel-output-store.test.js +41 -0
  117. package/server/lib/assistants/channel-output.integration.test.js +114 -0
  118. package/server/lib/assistants/channel-output.js +90 -0
  119. package/server/lib/assistants/channel-output.test.js +79 -0
  120. package/server/lib/assistants/channels/DOCUMENTATION.md +329 -0
  121. package/server/lib/assistants/channels/PROTOCOLS.md +250 -0
  122. package/server/lib/assistants/channels/dingtalk-chat-adapter.js +645 -0
  123. package/server/lib/assistants/channels/dingtalk-chat-adapter.test.js +423 -0
  124. package/server/lib/assistants/channels/integration.test.js +44 -0
  125. package/server/lib/assistants/channels/routes.js +59 -0
  126. package/server/lib/assistants/channels/routes.test.js +139 -0
  127. package/server/lib/assistants/channels/runtime.js +958 -0
  128. package/server/lib/assistants/channels/runtime.test.js +897 -0
  129. package/server/lib/assistants/channels/sdk-adapters.js +383 -0
  130. package/server/lib/assistants/channels/sdk-adapters.test.js +384 -0
  131. package/server/lib/assistants/channels/store.js +249 -0
  132. package/server/lib/assistants/channels/store.test.js +296 -0
  133. package/server/lib/assistants/channels/transport.js +42 -0
  134. package/server/lib/assistants/channels/transport.test.js +23 -0
  135. package/server/lib/assistants/channels/wecom-chat-adapter.js +703 -0
  136. package/server/lib/assistants/channels/wecom-chat-adapter.test.js +130 -0
  137. package/server/lib/assistants/contact-store.js +9 -3
  138. package/server/lib/assistants/contact-store.test.js +27 -0
  139. package/server/lib/assistants/contact-tools.js +65 -75
  140. package/server/lib/assistants/contact-tools.test.js +114 -22
  141. package/server/lib/assistants/harness.js +79 -34
  142. package/server/lib/assistants/harness.test.js +52 -20
  143. package/server/lib/assistants/message-channel-origin.js +7 -0
  144. package/server/lib/assistants/resource-reference.integration.test.js +284 -0
  145. package/server/lib/assistants/routes.js +14 -4
  146. package/server/lib/assistants/service.js +116 -69
  147. package/server/lib/assistants/service.test.js +31 -17
  148. package/server/lib/assistants/weixin/DOCUMENTATION.md +121 -14
  149. package/server/lib/assistants/weixin/api.js +45 -1
  150. package/server/lib/assistants/weixin/api.test.js +28 -0
  151. package/server/lib/assistants/weixin/chat-adapter.js +113 -0
  152. package/server/lib/assistants/weixin/chat-adapter.test.js +62 -0
  153. package/server/lib/assistants/weixin/inbound.js +149 -0
  154. package/server/lib/assistants/weixin/inbound.test.js +141 -0
  155. package/server/lib/assistants/weixin/media.js +79 -0
  156. package/server/lib/assistants/weixin/media.test.js +66 -0
  157. package/server/lib/assistants/weixin/runtime.js +105 -74
  158. package/server/lib/assistants/weixin/runtime.test.js +192 -4
  159. package/server/lib/assistants/weixin/store.js +16 -8
  160. package/server/lib/assistants/weixin/store.test.js +93 -0
  161. package/server/lib/assistants/weixin/toon.js +49 -0
  162. package/server/lib/assistants/weixin/toon.test.js +25 -0
  163. package/server/lib/assistants/yuri-project.http.test.js +9 -3
  164. package/server/lib/github/DOCUMENTATION.md +9 -8
  165. package/server/lib/llm/bridge-plugin.bundle.js +188 -188
  166. package/server/lib/notifications/DOCUMENTATION.md +6 -0
  167. package/server/lib/notifications/runtime.js +26 -15
  168. package/server/lib/notifications/runtime.test.js +14 -13
  169. package/server/lib/opencode/DOCUMENTATION.md +10 -1
  170. package/server/lib/opencode/auth.d.ts +6 -2
  171. package/server/lib/opencode/core-routes.js +0 -1
  172. package/server/lib/opencode/feature-routes-runtime.js +0 -24
  173. package/server/lib/opencode/location-release.d.ts +5 -1
  174. package/server/lib/opencode/managed-capabilities/scheduled-task.js +1 -1
  175. package/server/lib/opencode/managed-capabilities-runtime.test.js +1 -1
  176. package/server/lib/opencode/native-goal.js +15 -0
  177. package/server/lib/opencode/native-goal.test.js +17 -0
  178. package/server/lib/opencode/settings-helpers.js +0 -6
  179. package/server/lib/opencode/shutdown-runtime.js +0 -2
  180. package/server/lib/projects/project-config.js +3 -6
  181. package/server/lib/scheduled-tasks/DOCUMENTATION.md +10 -35
  182. package/server/lib/scheduled-tasks/managed-tool-route.js +1 -30
  183. package/server/lib/scheduled-tasks/routes.js +0 -26
  184. package/server/lib/scheduled-tasks/runtime.js +33 -257
  185. package/server/lib/scheduled-tasks/runtime.test.js +24 -65
  186. package/server/lib/session-metadata/DOCUMENTATION.md +9 -12
  187. package/server/lib/session-metadata/routes.js +4 -38
  188. package/server/lib/session-metadata/routes.test.js +2 -2
  189. package/dist/assets/AssistantContactStatus-CWq-PDz6.js +0 -3
  190. package/dist/assets/AssistantView-Br1iETTs.js +0 -1
  191. package/dist/assets/MarkdownRenderer-BlGxjOei.js +0 -2
  192. package/dist/assets/MobileTabPageHeader-DQRqAAEf.js +0 -2
  193. package/dist/assets/context-menu-DpbkRkk1.js +0 -1
  194. package/dist/assets/device-BjRYYXNT.js +0 -2
  195. package/dist/assets/host-FR_grJxM.js +0 -1
  196. package/dist/assets/insertionBoundaries-CZz7TWJv.js +0 -1
  197. package/dist/assets/main-Bp9HHqTr.js +0 -2
  198. package/dist/assets/main-DOwAfmxJ.js +0 -169
  199. package/dist/assets/miniChat-BJDgCrfF.js +0 -2
  200. package/dist/assets/mobile-GM9931J_.js +0 -2
  201. package/dist/assets/projectMeta-31PobC-M.js +0 -1
  202. package/dist/assets/react-B9v0P7kT.js +0 -1
  203. package/dist/assets/readiness-CYNnsekT.js +0 -1
  204. package/dist/assets/renderElectronMiniChatApp-N2r999Bf.js +0 -2
  205. package/dist/assets/renderMobileApp-CU1ec6Ak.js +0 -28
  206. package/dist/assets/runtime-fetch-D4ja813o.js +0 -1
  207. package/dist/assets/runtimeConfig-Db7yfo6L.js +0 -2
  208. package/dist/assets/runtimeEndpointReset-DO5WVetV.js +0 -149
  209. package/dist/assets/scheduledTaskNavigation-Bsrhv3Ow.js +0 -1
  210. package/dist/assets/sessionLookup-DRVy7LM1.js +0 -1
  211. package/dist/assets/speechSettingsQueries-DU25rmGc.js +0 -4
  212. package/dist/assets/src-Bckdo2XS.css +0 -2
  213. package/dist/assets/types-BqFQhQTt.js +0 -2
  214. package/dist/assets/useDesktopWindowControlsLayout-CYx1LNO5.js +0 -1
  215. package/dist/assets/useEffectiveDirectory-D8FFE5Yn.js +0 -1
  216. package/dist/assets/useMobileNavigationStore-BHMFeMjo.js +0 -23
  217. package/dist/assets/useUIStore-BbYD420L.js +0 -1
  218. package/dist/assets/vendor-opencode-client-UL_TecvQ.js +0 -12
  219. package/dist/assets/vendor-solid-js-0T254UHG.js +0 -1
  220. package/dist/assets/vendor-zod-Dzk5kdUU.js +0 -39
  221. package/server/lib/session-goal/DOCUMENTATION.md +0 -371
  222. package/server/lib/session-goal/capability.js +0 -57
  223. package/server/lib/session-goal/capability.test.js +0 -33
  224. package/server/lib/session-goal/objectives.js +0 -61
  225. package/server/lib/session-goal/routes.js +0 -274
  226. package/server/lib/session-goal/routes.test.js +0 -211
  227. package/server/lib/session-goal/runtime.js +0 -2452
  228. package/server/lib/session-goal/runtime.test.js +0 -2125
@@ -0,0 +1,250 @@
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 documented outbound REST calls (JSON or multipart) 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
+ - Image output first uploads multipart `image_type=message` and `image` to
54
+ `POST /open-apis/im/v1/images`, then sends `msg_type: image` with
55
+ `content: {"image_key": ...}` and the same durable UUID policy. The app needs
56
+ `im:resource` or `im:resource:upload` in addition to message-send permission.
57
+ Upload failure never counts as a submitted chat message.
58
+ Reference: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/image/create
59
+
60
+ ACK durability: the Chat adapter's normalized `message` path is not awaited by
61
+ the vendor dispatcher, so it cannot gate the ACK. `sdk-adapters.js` therefore
62
+ projects and persists through the public
63
+ `LarkChannel.onRawEvent('im.message.receive_v1')` hook. The hook is installed
64
+ from inside `channelFactory`, i.e. before the adapter calls `channel.connect()`,
65
+ so there is no unguarded boot window and no fallback path. The normalized
66
+ `message` handler registered by the vendor adapter is inert for Yuri (the raw
67
+ gate already owns delivery) and no private `_getChannel()` accessor is used.
68
+
69
+ The vendor dispatcher awaits the raw handler before replying, which is what
70
+ keeps the ACK behind the durable receipt. It also catches handler exceptions, so
71
+ a failed durable write cannot force a non-200 ACK frame; the bridge reports
72
+ `onError` instead, and the runtime aborts/reconnects that lane. Readiness is
73
+ re-armed from the channel's own `reconnected` event (`reconnecting` maps to
74
+ `network_error`), so a successful SDK reconnect never leaves `runtime.ready`
75
+ false.
76
+
77
+ `createLarkAdapter` disables the channel's own stale/dedup/lock/batch pipeline
78
+ (`safety.staleMessageWindowMs` maxed, `chatQueue` off, batch delays 0); Yuri owns
79
+ authorization and receipt dedupe.
80
+
81
+ Boundaries:
82
+
83
+ - Inbound text comes from the vendor normalization. Images/files/audio/video
84
+ are reported as bounded public descriptors (`type`, `name`, `durationMs`) with
85
+ `notDownloaded: true`; `file_key` is never projected or downloaded.
86
+ - The adapter's `Message.attachments` is empty today (the Chat adapter does not
87
+ bridge `NormalizedMessage.resources`), so descriptors are read from the
88
+ vendor's normalized `raw` payload. Acquiring bytes would require the vendor's
89
+ internal `downloadResource` API; Yuri does not do that.
90
+ - The vendor adapter auto-reconnects its WebSocket itself. Yuri's runtime must
91
+ not add a second reconnect loop for Feishu; the bridge maps the channel's
92
+ `reconnecting` event to `onError('network_error')` and its `reconnected`
93
+ event back to `onReady()`, so the UI does not stay `connected` during a gap and
94
+ does not stay `reconnecting` after a successful resume. A 1s monitor reads the
95
+ public `channel.getConnectionStatus()`; when the vendor exhausts its bounded
96
+ reconnect attempts and reports `state: 'failed'`, the bridge reports
97
+ `network_error` and returns from `connect()` so the runtime opens a fresh
98
+ adapter. The bridge deliberately does not map every channel `error` event to a
99
+ transport failure, because that event also covers non-fatal normalization and
100
+ meeting errors; doing so would revoke readiness on a healthy connection.
101
+ - Outbound never retries automatically. `requestJSON` marks HTTP 5xx/timeouts
102
+ during a send as ambiguous so the store records `delivery_unknown`.
103
+ - Aborting during `channel.connect()` is safe: the vendor's `disconnect()` is a
104
+ no-op before the handshake completes, so the bridge closes the channel again
105
+ once the aborted initialize settles. A canceled connect cannot leave a live
106
+ socket behind.
107
+
108
+ ## WeCom smart bot
109
+
110
+ Wire evidence: official `https://github.com/WecomTeam/aibot-node-sdk`,
111
+ `src/client.ts` (`sendMessage`) and `src/ws.ts` (`sendReply`/ACK handling).
112
+ `wecom-chat-adapter.js` implements the Chat SDK contract over its public `WSClient`.
113
+
114
+ - The SDK owns the official WebSocket, authentication, heartbeat, reconnect and
115
+ request-ID ACK matching. No private `wsManager` fields or custom wire are used.
116
+ - `authenticated` establishes readiness; `disconnected`/`reconnecting` revoke it.
117
+ Re-authentication restores readiness. Authentication failure and replacement are
118
+ sticky errors; reconnect exhaustion returns control to Yuri's scheduler.
119
+ - Initialization has a deadline; abort closes the SDK connection and listeners.
120
+ - `sendMessage()` waits for the platform ACK. Only `errcode: 0` advances the
121
+ outbox as sent (platform accepted, not proof the user read it). Nonzero ACKs are
122
+ definite failures; timeout, cancellation or disconnection after submission are
123
+ `delivery_unknown` and are never automatically resent.
124
+ - Native images use public `uploadMedia(buffer, {type:'image', filename})` and
125
+ `sendMediaMessage(chatid, 'image', media_id)` from the installed official SDK.
126
+ The SDK owns init/chunk/finish and the final message ACK; Yuri does not write
127
+ its own chunk framing. Local-WebSocket tests exercise the full SDK upload plus
128
+ final-ACK wait. Real-account acceptance/quotas still require platform testing.
129
+ - A configured owner fixes the private recipient; otherwise the runtime's private
130
+ durable `target.userID` supplies it. Missing recipients fail before sending.
131
+ - Incoming messages preserve `msgid` for durable dedup, use standard Chat `Message`
132
+ and platform voice transcription, and drop groups/disallowed senders. Media
133
+ descriptors are explicitly `notDownloaded`; URLs and AES keys are not projected.
134
+ - Different credentials have independent live clients. The personal-WeChat
135
+ single-entry/rebind rule remains confined to `weixin/`.
136
+ - The previous community adapter was removed because black-box testing proved
137
+ its `postMessage()` resolved before ACK and ignored nonzero ACKs. Regression
138
+ tests now drive the official SDK against a local WebSocket server, including
139
+ successful consecutive sends, nonzero ACKs and cancellation.
140
+
141
+ ## DingTalk
142
+
143
+ Image output uploads multipart `type=image`/`media` to the official legacy
144
+ `https://oapi.dingtalk.com/media/upload` endpoint, then uses the existing private
145
+ batch-send API with `msgKey: sampleImageMsg` and `msgParam: {photoURL: media_id}`.
146
+ The legacy upload API requires the access token in its query; it is ephemeral,
147
+ never persisted/logged or included in a transcript/error. Generated local images
148
+ need no publicly hosted URL. Platform size/format/permission failures remain
149
+ explicit delivery failures rather than a false text-only success. No automatic
150
+ lossy resize, new image dependency or public image-hosting service is introduced.
151
+ References: https://developers.dingtalk.com/document/app/upload-media-files and
152
+ https://open.dingtalk.com/document/orgapp/types-of-messages-sent-by-robots
153
+
154
+ Wire evidence: `dingtalk-stream@2.1.5` `dist/client.mjs` and
155
+ `src/client.ts` of `open-dingtalk/dingtalk-stream-sdk-nodejs`; OpenAPI metadata
156
+ from `@alicloud/dingtalk@2.2.48` (`robot_1_0`, `oauth2_1_0`).
157
+
158
+ - Gateway: `POST https://api.dingtalk.com/v1.0/gateway/connections/open` with
159
+ `{clientId, clientSecret, ua, subscriptions}`; response `{endpoint, ticket}`
160
+ and the SDK dials `${endpoint}?ticket=...`.
161
+ - The SDK owns ping/pong, `SYSTEM/CONNECTED|REGISTERED|disconnect|KEEPALIVE`
162
+ and reconnect (disabled here with `autoReconnect: false`, because Yuri's
163
+ runtime owns reconnect).
164
+ - Readiness: `REGISTERED` is the only authenticated signal. `connect()` waits
165
+ for it with a `INIT_TIMEOUT_MS` deadline. The `onLost` hook and watchdog are
166
+ installed before `client.connect()`, so a disconnect during the handshake is
167
+ never missed. A socket that opens but never registers is reported as
168
+ `network_error`, never `connected`.
169
+ - Session ownership: `createDingtalkSdkAdapter` creates one independent
170
+ `DingTalkChatAdapter` per `clientID+clientSecret+ownerID`. There is no shared
171
+ `this.session` singleton, so multiple bots connect in parallel; a duplicate
172
+ live connect for the same config is rejected with `channel_in_use`. The live
173
+ session map never evicts an active session.
174
+ - Initialization is abortable and bounded. Aborting during the SDK's endpoint
175
+ request closes the session and a late `_connect()` is refused, so the
176
+ underlying socket/timers cannot outlive the aborted connect.
177
+ - CALLBACK ACK: `2.1.5` does not auto-ack callbacks. `socketCallBackResponse`
178
+ is called only after the Yuri delivery promise resolves; failures leave the
179
+ callback unacknowledged for the platform retry. Unauthorized/malformed frames
180
+ are acknowledged and dropped so they cannot retry forever.
181
+ - Outbound: `POST /v1.0/oauth2/accessToken` `{appKey, appSecret}` →
182
+ `{accessToken, expireIn}` (cached until `expireIn - 300s`), then
183
+ `POST /v1.0/robot/oToMessages/batchSend` with
184
+ `{robotCode, userIds: [userID], msgKey: 'sampleText', msgParam}` and
185
+ `x-acs-dingtalk-access-token`. The recipient is `config.ownerID` when configured,
186
+ otherwise the runtime-derived `target.userID`. `invalidStaffIdList`,
187
+ `flowControlledStaffIdList` and `filteredStaffIdList` are all treated as
188
+ definite failures. HTTP 5xx/timeouts during send are ambiguous.
189
+ - Threads: `dingtalk:private:<owner>` / `dingtalk:group:<conversationId>`.
190
+ `isDM()` is true only for the `private` prefix, so a group is never reported as
191
+ a DM. `postMessage` throws `NotImplementedError` for group threads and
192
+ `invalid_response` for any private thread that is not the configured owner.
193
+ - Postables: `renderFormatted`/`messageText` accept standard Chat shapes only —
194
+ string, `{raw}`, `{markdown}` and `{ast}` (via `stringifyMarkdown`). The
195
+ non-standard `{text}` field is not read.
196
+ - Projection: single chat only; `senderStaffId` (fallback `senderId`) must
197
+ equal `ownerID` when configured, and the bot's own `chatbotUserId` is rejected. `audio` uses
198
+ the platform's `recognition` text and marks `metadata.transcript =
199
+ 'platform'`; audio without recognition is `notDownloaded` and carries **no**
200
+ invented transcript. `richText` is flattened to its text items. Other
201
+ non-text messages yield `notDownloaded: true` plus `mediaType` and a bounded
202
+ name. `sessionWebhook`, `robotCode`, `conversationId` and download codes are
203
+ never projected.
204
+ - Unsupported Chat methods (`editMessage`, `deleteMessage`, `fetchMessages`,
205
+ `fetchThread`, `addReaction`, `removeReaction`, `startTyping`) throw the Chat
206
+ SDK `NotImplementedError` instead of pretending to work. `handleWebhook`
207
+ returns 501; this adapter is long-connection only.
208
+
209
+ ## Shared projection and logging
210
+
211
+ - Only `private`/single-chat messages with sender identities are delivered.
212
+ A non-empty `ownerID` restricts this to one sender; empty uses platform access
213
+ controls. Group messages, disallowed senders, bot/app senders and the bot's own
214
+ events are dropped before any download or metadata expansion. Bot context is
215
+ shared, not isolated per sender; administrators must verify platform availability.
216
+ - Inbound metadata is rebuilt from scratch with public fields only. Capability
217
+ or secret handles (Feishu `file_key`, WeCom `aeskey`/`response_url`, DingTalk
218
+ `sessionWebhook`/`robotCode`) are never copied, even when the vendor message
219
+ carries them.
220
+ - Media is never downloaded automatically; every media message is explicitly
221
+ marked `notDownloaded` rather than claiming the content was read.
222
+ - Logging: every vendor logger is replaced with an inert logger
223
+ (`noopLogger()`). Vendor log arguments are never formatted or forwarded, so
224
+ tokens, URLs, IDs, message content and upstream error bodies cannot reach Yuri
225
+ logs through SDK logger objects. SDK errors are mapped to
226
+ `auth_expired`/`invalid_response`/`network_error`/`connection_replaced`
227
+ without forwarding raw upstream messages.
228
+
229
+ ## Known limits
230
+
231
+ - Feishu: one extra normalization per inbound message (the vendor pipeline also
232
+ normalizes). The vendor dispatcher swallows exceptions from raw handlers, so a
233
+ failed durable write cannot force a non-200 ACK frame; the bridge reports
234
+ `onError` and the runtime aborts the lane instead.
235
+ - Feishu: `uuid` is derived from the durable delivery row ID; if the same row is
236
+ re-sent with different text, the platform would dedupe it. Yuri never mutates
237
+ a queued row's text. Neither vendor SDK exposes an idempotent send, which is
238
+ why the bridge uses the documented HTTP call with `uuid`.
239
+ - WeCom: real tenant authentication, proactive-message permissions and actual
240
+ network reconnection remain unverified; local SDK/ACK tests are not tenant tests.
241
+ - DingTalk: no media download, no history fetch, and readiness depends on the
242
+ platform emitting `REGISTERED` within the bounded window. Abort cleanup patches
243
+ the SDK's internal `_connect` because `connect()` awaits an unabortable
244
+ endpoint request before creating the socket.
245
+ - These adapters were validated with unit fixtures and the real SDK runtime
246
+ packages (including the real `WeComFormatConverter`, Feishu `normalize`, Chat
247
+ `Message`/`stringifyMarkdown`, and a real `@agentor/chat-wecom@0.1.3` run over
248
+ an injected fake `WebSocket` for the ACK evidence), not with live
249
+ Feishu/WeCom/DingTalk tenants. Real-account authentication, delivery and
250
+ reconnect behavior still require manual verification.