@zhin.js/core 1.1.34 → 1.1.35

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 (386) hide show
  1. package/README.md +121 -65
  2. package/lib/adapter.d.ts +72 -23
  3. package/lib/adapter.js +222 -62
  4. package/lib/built/adapter-process.d.ts +20 -5
  5. package/lib/built/adapter-process.js +54 -7
  6. package/lib/built/agent-preset.d.ts +1 -2
  7. package/lib/built/agent-preset.js +1 -2
  8. package/lib/built/ai-access.d.ts +36 -0
  9. package/lib/built/ai-access.js +46 -0
  10. package/lib/built/ai-outbound/adapter-access.d.ts +3 -0
  11. package/lib/built/ai-outbound/adapter-access.js +9 -0
  12. package/lib/built/ai-outbound/extensions/onebot-keyboard.d.ts +2 -0
  13. package/lib/built/ai-outbound/extensions/onebot-keyboard.js +67 -0
  14. package/lib/built/ai-outbound/extensions/qq-message.d.ts +3 -0
  15. package/lib/built/ai-outbound/extensions/qq-message.js +23 -0
  16. package/lib/built/ai-outbound/index.d.ts +9 -0
  17. package/lib/built/ai-outbound/index.js +9 -0
  18. package/lib/built/ai-outbound/parse.d.ts +13 -0
  19. package/lib/built/ai-outbound/parse.js +104 -0
  20. package/lib/built/ai-outbound/plain-mention-rewrite.d.ts +6 -0
  21. package/lib/built/ai-outbound/plain-mention-rewrite.js +37 -0
  22. package/lib/built/ai-outbound/prompt.d.ts +11 -0
  23. package/lib/built/ai-outbound/prompt.js +44 -0
  24. package/lib/built/ai-outbound/resolve.d.ts +4 -0
  25. package/lib/built/ai-outbound/resolve.js +64 -0
  26. package/lib/built/ai-outbound/structured-detect.d.ts +3 -0
  27. package/lib/built/ai-outbound/structured-detect.js +6 -0
  28. package/lib/built/ai-outbound/types.d.ts +58 -0
  29. package/lib/built/ai-outbound/types.js +5 -0
  30. package/lib/built/ai-trigger.d.ts +17 -17
  31. package/lib/built/ai-trigger.js +65 -70
  32. package/lib/built/authorization.d.ts +10 -0
  33. package/lib/built/authorization.js +76 -0
  34. package/lib/built/command.d.ts +9 -5
  35. package/lib/built/command.js +20 -7
  36. package/lib/built/common-adapter-tools.d.ts +35 -29
  37. package/lib/built/common-adapter-tools.js +83 -67
  38. package/lib/built/component.d.ts +1 -3
  39. package/lib/built/component.js +2 -4
  40. package/lib/built/config.d.ts +4 -5
  41. package/lib/built/config.js +26 -9
  42. package/lib/built/connect-endpoint-instance.d.ts +17 -0
  43. package/lib/built/connect-endpoint-instance.js +42 -0
  44. package/lib/built/database.d.ts +5 -3
  45. package/lib/built/database.js +10 -4
  46. package/lib/built/dispatcher.d.ts +10 -8
  47. package/lib/built/dispatcher.js +31 -9
  48. package/lib/built/endpoint-commands.d.ts +3 -0
  49. package/lib/built/endpoint-commands.js +99 -0
  50. package/lib/built/endpoint-lifecycle-service.d.ts +28 -0
  51. package/lib/built/endpoint-lifecycle-service.js +242 -0
  52. package/lib/built/endpoint-lifecycle.d.ts +27 -0
  53. package/lib/built/endpoint-lifecycle.js +36 -0
  54. package/lib/built/endpoint-manager.d.ts +34 -0
  55. package/lib/built/endpoint-manager.js +1 -0
  56. package/lib/built/generated-qrcode.d.ts +24 -0
  57. package/lib/built/generated-qrcode.js +45 -0
  58. package/lib/built/generic-segment-mapper.d.ts +4 -0
  59. package/lib/built/generic-segment-mapper.js +190 -0
  60. package/lib/built/html-renderer-loader.d.ts +13 -0
  61. package/lib/built/html-renderer-loader.js +33 -0
  62. package/lib/built/html-segment-fallback.d.ts +2 -2
  63. package/lib/built/html-segment-fallback.js +0 -1
  64. package/lib/built/html-to-text.d.ts +0 -1
  65. package/lib/built/html-to-text.js +15 -15
  66. package/lib/built/inbound-pipeline.d.ts +37 -0
  67. package/lib/built/inbound-pipeline.js +63 -0
  68. package/lib/built/inbound-runner.d.ts +0 -1
  69. package/lib/built/inbound-runner.js +0 -3
  70. package/lib/built/interactive-segment-contract.d.ts +6 -0
  71. package/lib/built/interactive-segment-contract.js +9 -0
  72. package/lib/built/interactive-segments/action.d.ts +17 -0
  73. package/lib/built/interactive-segments/action.js +69 -0
  74. package/lib/built/interactive-segments/button-spec.d.ts +10 -0
  75. package/lib/built/interactive-segments/button-spec.js +21 -0
  76. package/lib/built/interactive-segments/fallback-store.d.ts +29 -0
  77. package/lib/built/interactive-segments/fallback-store.js +63 -0
  78. package/lib/built/interactive-segments/handlers.d.ts +16 -0
  79. package/lib/built/interactive-segments/handlers.js +74 -0
  80. package/lib/built/interactive-segments/index.d.ts +8 -0
  81. package/lib/built/interactive-segments/index.js +8 -0
  82. package/lib/built/interactive-segments/keyboard-segment.d.ts +11 -0
  83. package/lib/built/interactive-segments/keyboard-segment.js +12 -0
  84. package/lib/built/interactive-segments/onebot-keyboard.d.ts +7 -0
  85. package/lib/built/interactive-segments/onebot-keyboard.js +51 -0
  86. package/lib/built/interactive-segments/resolve.d.ts +15 -0
  87. package/lib/built/interactive-segments/resolve.js +110 -0
  88. package/lib/built/interactive-segments/types.d.ts +50 -0
  89. package/lib/built/interactive-segments/types.js +9 -0
  90. package/lib/built/introspection-format.d.ts +10 -0
  91. package/lib/built/introspection-format.js +28 -0
  92. package/lib/built/login-assist.d.ts +43 -9
  93. package/lib/built/login-assist.js +113 -11
  94. package/lib/built/management-command-guard.d.ts +15 -0
  95. package/lib/built/management-command-guard.js +25 -0
  96. package/lib/built/message-enrich.d.ts +38 -0
  97. package/lib/built/message-enrich.js +75 -0
  98. package/lib/built/message-filter.d.ts +4 -5
  99. package/lib/built/message-filter.js +5 -7
  100. package/lib/built/optional-peer-import.d.ts +3 -0
  101. package/lib/built/optional-peer-import.js +33 -0
  102. package/lib/built/outbound-media-contract.d.ts +22 -0
  103. package/lib/built/outbound-media-contract.js +10 -0
  104. package/lib/built/outbound-media-utils.d.ts +9 -0
  105. package/lib/built/outbound-media-utils.js +62 -0
  106. package/lib/built/permission.d.ts +3 -7
  107. package/lib/built/permission.js +39 -52
  108. package/lib/built/permit-check.d.ts +7 -0
  109. package/lib/built/permit-check.js +35 -0
  110. package/lib/built/permit-parse.d.ts +16 -0
  111. package/lib/built/permit-parse.js +32 -0
  112. package/lib/built/platform-permit.d.ts +20 -0
  113. package/lib/built/platform-permit.js +91 -0
  114. package/lib/built/queue-im-field-contract.d.ts +7 -2
  115. package/lib/built/queue-im-field-contract.js +13 -4
  116. package/lib/built/rich-segments/adapter-policies.d.ts +9 -0
  117. package/lib/built/rich-segments/adapter-policies.js +27 -0
  118. package/lib/built/rich-segments/base.d.ts +11 -0
  119. package/lib/built/rich-segments/base.js +24 -0
  120. package/lib/built/rich-segments/builtins.d.ts +4 -0
  121. package/lib/built/rich-segments/builtins.js +40 -0
  122. package/lib/built/rich-segments/capabilities.d.ts +6 -0
  123. package/lib/built/rich-segments/capabilities.js +38 -0
  124. package/lib/built/rich-segments/html-segment.d.ts +15 -0
  125. package/lib/built/rich-segments/html-segment.js +62 -0
  126. package/lib/built/rich-segments/index.d.ts +13 -0
  127. package/lib/built/rich-segments/index.js +13 -0
  128. package/lib/built/rich-segments/markdown-segment.d.ts +14 -0
  129. package/lib/built/rich-segments/markdown-segment.js +58 -0
  130. package/lib/built/rich-segments/markdown-to-text.d.ts +3 -0
  131. package/lib/built/rich-segments/markdown-to-text.js +27 -0
  132. package/lib/built/rich-segments/qrcode-segment.d.ts +18 -0
  133. package/lib/built/rich-segments/qrcode-segment.js +73 -0
  134. package/lib/built/rich-segments/registry.d.ts +16 -0
  135. package/lib/built/rich-segments/registry.js +52 -0
  136. package/lib/built/rich-segments/resolve.d.ts +5 -0
  137. package/lib/built/rich-segments/resolve.js +87 -0
  138. package/lib/built/rich-segments/tts-segment.d.ts +13 -0
  139. package/lib/built/rich-segments/tts-segment.js +51 -0
  140. package/lib/built/rich-segments/types.d.ts +79 -0
  141. package/lib/built/rich-segments/types.js +17 -0
  142. package/lib/built/roles.d.ts +4 -5
  143. package/lib/built/roles.js +4 -5
  144. package/lib/built/runtime-io.d.ts +0 -1
  145. package/lib/built/runtime-io.js +0 -1
  146. package/lib/built/schedule.d.ts +54 -0
  147. package/lib/built/schedule.js +112 -0
  148. package/lib/built/schema-endpoint-manager.d.ts +17 -0
  149. package/lib/built/schema-endpoint-manager.js +73 -0
  150. package/lib/built/schema-feature.d.ts +0 -1
  151. package/lib/built/schema-feature.js +1 -3
  152. package/lib/built/segment-contract/assert.d.ts +7 -0
  153. package/lib/built/segment-contract/assert.js +39 -0
  154. package/lib/built/segment-contract/delivery.d.ts +5 -0
  155. package/lib/built/segment-contract/delivery.js +40 -0
  156. package/lib/built/segment-contract/image.d.ts +5 -0
  157. package/lib/built/segment-contract/image.js +10 -0
  158. package/lib/built/segment-contract/index.d.ts +10 -0
  159. package/lib/built/segment-contract/index.js +9 -0
  160. package/lib/built/segment-contract/json-schema.d.ts +28 -0
  161. package/lib/built/segment-contract/json-schema.js +128 -0
  162. package/lib/built/segment-contract/media.d.ts +12 -0
  163. package/lib/built/segment-contract/media.js +22 -0
  164. package/lib/built/segment-contract/mention.d.ts +10 -0
  165. package/lib/built/segment-contract/mention.js +26 -0
  166. package/lib/built/segment-contract/preview.d.ts +3 -0
  167. package/lib/built/segment-contract/preview.js +159 -0
  168. package/lib/built/segment-contract/text.d.ts +7 -0
  169. package/lib/built/segment-contract/text.js +34 -0
  170. package/lib/built/segment-contract/types.d.ts +58 -0
  171. package/lib/built/segment-contract/types.js +1 -0
  172. package/lib/built/segment-contract/validate.d.ts +229 -0
  173. package/lib/built/segment-contract/validate.js +174 -0
  174. package/lib/built/skill.d.ts +0 -1
  175. package/lib/built/skill.js +0 -1
  176. package/lib/built/speech-loader.d.ts +14 -0
  177. package/lib/built/speech-loader.js +32 -0
  178. package/lib/built/tool.d.ts +14 -13
  179. package/lib/built/tool.js +30 -25
  180. package/lib/built/user-interaction.d.ts +30 -0
  181. package/lib/built/user-interaction.js +248 -0
  182. package/lib/command.d.ts +19 -11
  183. package/lib/command.js +42 -11
  184. package/lib/component.d.ts +0 -1
  185. package/lib/component.js +30 -14
  186. package/lib/endpoint-capabilities.d.ts +46 -0
  187. package/lib/endpoint-capabilities.js +55 -0
  188. package/lib/endpoint.d.ts +19 -0
  189. package/lib/endpoint.js +3 -0
  190. package/lib/errors.d.ts +2 -3
  191. package/lib/errors.js +4 -5
  192. package/lib/feature/adapter.d.ts +2 -0
  193. package/lib/feature/adapter.js +2 -0
  194. package/lib/feature/command.d.ts +2 -0
  195. package/lib/feature/command.js +2 -0
  196. package/lib/feature/component.d.ts +2 -0
  197. package/lib/feature/component.js +2 -0
  198. package/lib/feature/handler.d.ts +52 -0
  199. package/lib/feature/handler.js +26 -0
  200. package/lib/feature/middleware.d.ts +2 -0
  201. package/lib/feature/middleware.js +2 -0
  202. package/lib/host-plugin-registry.d.ts +8 -0
  203. package/lib/host-plugin-registry.js +12 -0
  204. package/lib/im-scene.d.ts +29 -0
  205. package/lib/im-scene.js +75 -0
  206. package/lib/im-session-id.d.ts +39 -0
  207. package/lib/im-session-id.js +47 -0
  208. package/lib/index.d.ts +59 -25
  209. package/lib/index.js +53 -31
  210. package/lib/jsx-dev-runtime.d.ts +0 -1
  211. package/lib/jsx-dev-runtime.js +0 -1
  212. package/lib/jsx-runtime.d.ts +1 -1
  213. package/lib/jsx-runtime.js +0 -1
  214. package/lib/jsx.d.ts +19 -22
  215. package/lib/jsx.js +0 -1
  216. package/lib/message.d.ts +16 -10
  217. package/lib/message.js +16 -13
  218. package/lib/models/system-log.d.ts +0 -1
  219. package/lib/models/system-log.js +0 -1
  220. package/lib/models/user.d.ts +0 -1
  221. package/lib/models/user.js +0 -1
  222. package/lib/notice.d.ts +16 -59
  223. package/lib/notice.js +1 -4
  224. package/lib/plugin-context.d.ts +27 -0
  225. package/lib/plugin-context.js +64 -0
  226. package/lib/plugin-runtime/im/contracts.d.ts +191 -0
  227. package/lib/plugin-runtime/im/contracts.js +169 -0
  228. package/lib/plugin-runtime/im/im-runtime.d.ts +177 -0
  229. package/lib/plugin-runtime/im/im-runtime.js +1204 -0
  230. package/lib/plugin-runtime/im/index.d.ts +9 -0
  231. package/lib/plugin-runtime/im/index.js +9 -0
  232. package/lib/plugin-runtime/im/interactive.d.ts +26 -0
  233. package/lib/plugin-runtime/im/interactive.js +46 -0
  234. package/lib/plugin-runtime/im/login-assist-host.d.ts +6 -0
  235. package/lib/plugin-runtime/im/login-assist-host.js +6 -0
  236. package/lib/plugin-runtime/im/message-bus.d.ts +38 -0
  237. package/lib/plugin-runtime/im/message-bus.js +40 -0
  238. package/lib/plugin-runtime/im/message-dispatcher.d.ts +18 -0
  239. package/lib/plugin-runtime/im/message-dispatcher.js +107 -0
  240. package/lib/plugin-runtime/im/outbound-renderer.d.ts +7 -0
  241. package/lib/plugin-runtime/im/outbound-renderer.js +70 -0
  242. package/lib/plugin-runtime/im/outbound-segments.d.ts +72 -0
  243. package/lib/plugin-runtime/im/outbound-segments.js +220 -0
  244. package/lib/plugin-runtime/im/public-api.d.ts +6 -0
  245. package/lib/plugin-runtime/im/public-api.js +6 -0
  246. package/lib/plugin-runtime/im/service-tokens.d.ts +18 -0
  247. package/lib/plugin-runtime/im/service-tokens.js +13 -0
  248. package/lib/plugin.d.ts +34 -24
  249. package/lib/plugin.js +119 -224
  250. package/lib/request.d.ts +17 -61
  251. package/lib/request.js +0 -4
  252. package/lib/{prompt.d.ts → schema-interaction.d.ts} +6 -7
  253. package/lib/{prompt.js → schema-interaction.js} +20 -17
  254. package/lib/side-event/base.d.ts +52 -0
  255. package/lib/side-event/base.js +30 -0
  256. package/lib/side-event/dispatch.d.ts +15 -0
  257. package/lib/side-event/dispatch.js +140 -0
  258. package/lib/side-event/index.d.ts +4 -0
  259. package/lib/side-event/index.js +4 -0
  260. package/lib/side-event/normalize.d.ts +42 -0
  261. package/lib/side-event/normalize.js +121 -0
  262. package/lib/side-event/types.d.ts +23 -0
  263. package/lib/side-event/types.js +55 -0
  264. package/lib/system-event.d.ts +15 -0
  265. package/lib/system-event.js +7 -0
  266. package/lib/tool-zod.d.ts +18 -3
  267. package/lib/tool-zod.js +140 -54
  268. package/lib/types.d.ts +44 -95
  269. package/lib/types.js +0 -1
  270. package/lib/utils.d.ts +61 -13
  271. package/lib/utils.js +66 -25
  272. package/package.json +98 -10
  273. package/lib/adapter.d.ts.map +0 -1
  274. package/lib/adapter.js.map +0 -1
  275. package/lib/agent-prompt.d.ts +0 -37
  276. package/lib/agent-prompt.d.ts.map +0 -1
  277. package/lib/agent-prompt.js +0 -2
  278. package/lib/agent-prompt.js.map +0 -1
  279. package/lib/bot.d.ts +0 -38
  280. package/lib/bot.d.ts.map +0 -1
  281. package/lib/bot.js +0 -2
  282. package/lib/bot.js.map +0 -1
  283. package/lib/built/adapter-process.d.ts.map +0 -1
  284. package/lib/built/adapter-process.js.map +0 -1
  285. package/lib/built/agent-preset.d.ts.map +0 -1
  286. package/lib/built/agent-preset.js.map +0 -1
  287. package/lib/built/ai-trigger.d.ts.map +0 -1
  288. package/lib/built/ai-trigger.js.map +0 -1
  289. package/lib/built/command.d.ts.map +0 -1
  290. package/lib/built/command.js.map +0 -1
  291. package/lib/built/common-adapter-tools.d.ts.map +0 -1
  292. package/lib/built/common-adapter-tools.js.map +0 -1
  293. package/lib/built/component.d.ts.map +0 -1
  294. package/lib/built/component.js.map +0 -1
  295. package/lib/built/config.d.ts.map +0 -1
  296. package/lib/built/config.js.map +0 -1
  297. package/lib/built/cron.d.ts +0 -75
  298. package/lib/built/cron.d.ts.map +0 -1
  299. package/lib/built/cron.js +0 -122
  300. package/lib/built/cron.js.map +0 -1
  301. package/lib/built/database.d.ts.map +0 -1
  302. package/lib/built/database.js.map +0 -1
  303. package/lib/built/dispatcher.d.ts.map +0 -1
  304. package/lib/built/dispatcher.js.map +0 -1
  305. package/lib/built/html-segment-fallback.d.ts.map +0 -1
  306. package/lib/built/html-segment-fallback.js.map +0 -1
  307. package/lib/built/html-to-text.d.ts.map +0 -1
  308. package/lib/built/html-to-text.js.map +0 -1
  309. package/lib/built/inbound-runner.d.ts.map +0 -1
  310. package/lib/built/inbound-runner.js.map +0 -1
  311. package/lib/built/login-assist.d.ts.map +0 -1
  312. package/lib/built/login-assist.js.map +0 -1
  313. package/lib/built/mcp-mesh-registrar.d.ts +0 -9
  314. package/lib/built/mcp-mesh-registrar.d.ts.map +0 -1
  315. package/lib/built/mcp-mesh-registrar.js +0 -17
  316. package/lib/built/mcp-mesh-registrar.js.map +0 -1
  317. package/lib/built/message-filter.d.ts.map +0 -1
  318. package/lib/built/message-filter.js.map +0 -1
  319. package/lib/built/permission.d.ts.map +0 -1
  320. package/lib/built/permission.js.map +0 -1
  321. package/lib/built/prepend-quote-context.d.ts +0 -35
  322. package/lib/built/prepend-quote-context.d.ts.map +0 -1
  323. package/lib/built/prepend-quote-context.js +0 -131
  324. package/lib/built/prepend-quote-context.js.map +0 -1
  325. package/lib/built/queue-im-field-contract.d.ts.map +0 -1
  326. package/lib/built/queue-im-field-contract.js.map +0 -1
  327. package/lib/built/roles.d.ts.map +0 -1
  328. package/lib/built/roles.js.map +0 -1
  329. package/lib/built/runtime-io.d.ts.map +0 -1
  330. package/lib/built/runtime-io.js.map +0 -1
  331. package/lib/built/schema-feature.d.ts.map +0 -1
  332. package/lib/built/schema-feature.js.map +0 -1
  333. package/lib/built/skill.d.ts.map +0 -1
  334. package/lib/built/skill.js.map +0 -1
  335. package/lib/built/tool.d.ts.map +0 -1
  336. package/lib/built/tool.js.map +0 -1
  337. package/lib/command.d.ts.map +0 -1
  338. package/lib/command.js.map +0 -1
  339. package/lib/component.d.ts.map +0 -1
  340. package/lib/component.js.map +0 -1
  341. package/lib/errors.d.ts.map +0 -1
  342. package/lib/errors.js.map +0 -1
  343. package/lib/index.d.ts.map +0 -1
  344. package/lib/index.js.map +0 -1
  345. package/lib/jsx-dev-runtime.d.ts.map +0 -1
  346. package/lib/jsx-dev-runtime.js.map +0 -1
  347. package/lib/jsx-runtime.d.ts.map +0 -1
  348. package/lib/jsx-runtime.js.map +0 -1
  349. package/lib/jsx.d.ts.map +0 -1
  350. package/lib/jsx.js.map +0 -1
  351. package/lib/message-quote.d.ts +0 -11
  352. package/lib/message-quote.d.ts.map +0 -1
  353. package/lib/message-quote.js +0 -91
  354. package/lib/message-quote.js.map +0 -1
  355. package/lib/message.d.ts.map +0 -1
  356. package/lib/message.js.map +0 -1
  357. package/lib/models/system-log.d.ts.map +0 -1
  358. package/lib/models/system-log.js.map +0 -1
  359. package/lib/models/user.d.ts.map +0 -1
  360. package/lib/models/user.js.map +0 -1
  361. package/lib/notice.d.ts.map +0 -1
  362. package/lib/notice.js.map +0 -1
  363. package/lib/plugin.d.ts.map +0 -1
  364. package/lib/plugin.js.map +0 -1
  365. package/lib/prompt.d.ts.map +0 -1
  366. package/lib/prompt.js.map +0 -1
  367. package/lib/request.d.ts.map +0 -1
  368. package/lib/request.js.map +0 -1
  369. package/lib/scheduler/scheduler.d.ts +0 -49
  370. package/lib/scheduler/scheduler.d.ts.map +0 -1
  371. package/lib/scheduler/scheduler.js +0 -352
  372. package/lib/scheduler/scheduler.js.map +0 -1
  373. package/lib/scheduler/types.d.ts +0 -71
  374. package/lib/scheduler/types.d.ts.map +0 -1
  375. package/lib/scheduler/types.js +0 -8
  376. package/lib/scheduler/types.js.map +0 -1
  377. package/lib/tool-zod.d.ts.map +0 -1
  378. package/lib/tool-zod.js.map +0 -1
  379. package/lib/types-generator.d.ts +0 -6
  380. package/lib/types-generator.d.ts.map +0 -1
  381. package/lib/types-generator.js +0 -72
  382. package/lib/types-generator.js.map +0 -1
  383. package/lib/types.d.ts.map +0 -1
  384. package/lib/types.js.map +0 -1
  385. package/lib/utils.d.ts.map +0 -1
  386. package/lib/utils.js.map +0 -1
@@ -0,0 +1,191 @@
1
+ import type { PluginId } from '@zhin.js/plugin-runtime';
2
+ import type { ConversationRef, DeliveryReceipt, MessageRef } from '@zhin.js/im-contract';
3
+ import type { MediaRef, Segment } from '../../built/segment-contract/types.js';
4
+ export type { MediaRef, Segment };
5
+ declare const componentCallBrand: "zhin.component-call/1";
6
+ declare const rawContentBrand: "zhin.raw-content/1";
7
+ export interface ComponentCall<TProps = unknown> {
8
+ readonly $content: typeof componentCallBrand;
9
+ readonly name: string;
10
+ readonly props: TProps;
11
+ }
12
+ export interface RawContent<TPayload = unknown> {
13
+ readonly $content: typeof rawContentBrand;
14
+ readonly payload: TPayload;
15
+ }
16
+ /**
17
+ * 出站内容:纯文本 / canonical Segment(一等公民,媒体与富文本的统一表达)/
18
+ * ComponentCall / RawContent,可任意嵌套数组。
19
+ */
20
+ export type SendContent = string | Segment | ComponentCall | RawContent | readonly SendContent[];
21
+ export declare function component<TProps>(name: string, props: TProps): ComponentCall<TProps>;
22
+ export declare function raw<TPayload>(payload: TPayload): RawContent<TPayload>;
23
+ export declare function isComponentCall(value: SendContent): value is ComponentCall;
24
+ export declare function isRawContent(value: SendContent): value is RawContent;
25
+ /** canonical Segment 一等公民判定(与 ComponentCall/RawContent 的 $content brand 互斥)。 */
26
+ export declare function isSegmentContent(value: unknown): value is Segment;
27
+ export interface MessageSenderRef {
28
+ readonly id: string;
29
+ readonly name?: string;
30
+ readonly roles?: readonly string[];
31
+ }
32
+ export interface IncomingMessage {
33
+ readonly conversation: ConversationRef;
34
+ readonly message?: MessageRef;
35
+ readonly content: string;
36
+ readonly segments?: readonly Segment[];
37
+ readonly sender?: MessageSenderRef;
38
+ /** Endpoint 实例名(如 ICQQ uin、sandbox bot name),区别于 conversation.endpoint.id(CapabilityId)。 */
39
+ readonly endpointId?: string;
40
+ /** 消息是否 @了机器人。 */
41
+ readonly mentioned?: boolean;
42
+ /** 引用/回复的原始消息。 */
43
+ readonly replyTo?: {
44
+ readonly id: string;
45
+ };
46
+ readonly metadata?: Readonly<Record<string, unknown>>;
47
+ }
48
+ /**
49
+ * 入站消息上下文快照 — 由 reply 闭包捕获,沿出站链路传递到模板编译。
50
+ * 定时任务 / 跨通道发送时整个 incoming 为 undefined。
51
+ */
52
+ export interface IncomingContext {
53
+ readonly sender?: MessageSenderRef;
54
+ /** 收到的消息纯文本内容。 */
55
+ readonly content: string;
56
+ /** 结构化消息段(图片、@、引用等)。 */
57
+ readonly segments?: readonly Segment[];
58
+ /** 平台原生消息 ID。 */
59
+ readonly messageId?: string;
60
+ /** 消息到达时间戳(ms)。 */
61
+ readonly timestamp: number;
62
+ /** Endpoint 实例名(如 ICQQ uin、sandbox bot name)。 */
63
+ readonly endpointId?: string;
64
+ /** 消息是否 @了机器人。 */
65
+ readonly mentioned?: boolean;
66
+ }
67
+ export interface SendRequest {
68
+ readonly conversation: ConversationRef;
69
+ readonly requester: PluginId;
70
+ readonly content: SendContent;
71
+ /** Incoming message context (absent for scheduled / cross-channel sends). */
72
+ readonly incoming?: IncomingContext;
73
+ }
74
+ /**
75
+ * Host 侧未锚定 endpoint 的会话地址(Console RPC / OutboundHost 入参);
76
+ * ImRuntime 解析 adapter/endpointKey 后锚定为完整 ConversationRef。
77
+ */
78
+ export type ConversationAddress = Omit<ConversationRef, 'endpoint'>;
79
+ export interface OutboundEnvelope {
80
+ readonly conversation: ConversationRef;
81
+ readonly requester: PluginId;
82
+ readonly generation: number;
83
+ readonly payload: unknown;
84
+ /** Native platform Client for the Endpoint selected by `conversation`. */
85
+ readonly $client: unknown;
86
+ /** Literal adapter name used to validate adapter-bound middleware. */
87
+ readonly clientAdapter?: string;
88
+ replace(payload: unknown): void;
89
+ }
90
+ /** @public Stable IM gateway contract resolved through `outboundMessageToken`. */
91
+ export interface OutboundMessageService {
92
+ send(request: SendRequest): Promise<DeliveryReceipt>;
93
+ /**
94
+ * 注册 interactive action 回跳 handler(prefix 最长匹配;返回注销函数)。
95
+ * 平台 callback 的 action 段、'text' 端点的数字回跳与指令预填直出
96
+ * payload 都会路由到这里。
97
+ */
98
+ registerInteractiveHandler(prefix: string, handler: (message: Message) => Promise<boolean> | boolean): () => void;
99
+ }
100
+ export interface MessageDispatchResult {
101
+ readonly matched: boolean;
102
+ readonly command?: string;
103
+ readonly owner?: PluginId;
104
+ readonly value?: unknown;
105
+ }
106
+ export declare class Message {
107
+ #private;
108
+ readonly conversation: ConversationRef;
109
+ readonly content: string;
110
+ readonly generation: number;
111
+ readonly sender?: MessageSenderRef | undefined;
112
+ readonly metadata: Readonly<Record<string, unknown>>;
113
+ /**
114
+ * 结构化段视图(与 `content` 纯文本视图同源,见 IncomingMessage.segments)。
115
+ * Command dispatcher 优先使用此字段,以支持 mention、image 等结构化参数。
116
+ */
117
+ readonly segments?: readonly Segment[] | undefined;
118
+ /** 结构化入站消息身份(平台原生 message id 经 MessageRef 传递)。 */
119
+ readonly message?: MessageRef | undefined;
120
+ readonly endpointId?: string | undefined;
121
+ readonly mentioned?: boolean | undefined;
122
+ readonly replyTo?: {
123
+ readonly id: string;
124
+ } | undefined;
125
+ readonly clientAdapter?: string | undefined;
126
+ /** @internal Constructed only by the generation-owned IM Runtime. */
127
+ constructor(conversation: ConversationRef, content: string, generation: number, reply: (content: SendContent, requester?: PluginId, targetConversation?: ConversationAddress) => Promise<DeliveryReceipt>, sender?: MessageSenderRef | undefined, metadata?: Readonly<Record<string, unknown>>,
128
+ /**
129
+ * 结构化段视图(与 `content` 纯文本视图同源,见 IncomingMessage.segments)。
130
+ * Command dispatcher 优先使用此字段,以支持 mention、image 等结构化参数。
131
+ */
132
+ segments?: readonly Segment[] | undefined,
133
+ /** 结构化入站消息身份(平台原生 message id 经 MessageRef 传递)。 */
134
+ message?: MessageRef | undefined, endpointId?: string | undefined, mentioned?: boolean | undefined, replyTo?: {
135
+ readonly id: string;
136
+ } | undefined, client?: () => unknown, clientAdapter?: string | undefined);
137
+ /** 平台原生消息 id(`message` 未提供时为 undefined)。 */
138
+ get id(): string | undefined;
139
+ readonly $reply: (content: SendContent) => Promise<DeliveryReceipt>;
140
+ /**
141
+ * Platform-native Client that received this message. The getter is
142
+ * generation-scoped; retaining the returned Client after dispatch is invalid.
143
+ */
144
+ get $client(): unknown;
145
+ readonly $replyFrom: (requester: PluginId, content: SendContent) => Promise<DeliveryReceipt>;
146
+ /**
147
+ * 向同 Endpoint 的另一个通道发送消息(通用)。
148
+ *
149
+ * ```ts
150
+ * await message.$sendTo({ kind: 'channel', id: 'ch-1', parent: { kind: 'channel', id: 'guild-1' } }, '频道通知');
151
+ * ```
152
+ */
153
+ readonly $sendTo: (conversation: ConversationAddress, content: SendContent) => Promise<DeliveryReceipt>;
154
+ /**
155
+ * 私信当前消息的发送者(同 Endpoint)。
156
+ *
157
+ * @param content 消息内容
158
+ * @param from 会话上下文:
159
+ * - `true` — 用当前群/频道作为 parent(要求当前不在私聊中)
160
+ * - `{ kind, id }` — 显式指定 parent(群或子频道)
161
+ * - 省略 — 直接私信
162
+ *
163
+ * ```ts
164
+ * await message.$replyToPrivate('直接私信');
165
+ * await message.$replyToPrivate('群临时私信', true);
166
+ * await message.$replyToPrivate('频道私信', { kind: 'channel', id: '子频道ID' });
167
+ * ```
168
+ */
169
+ readonly $replyToPrivate: (content: SendContent, from?: boolean | {
170
+ readonly kind: 'group' | 'channel';
171
+ readonly id: string;
172
+ }) => Promise<DeliveryReceipt>;
173
+ /**
174
+ * 向指定群发送消息(同 Endpoint)。
175
+ *
176
+ * ```ts
177
+ * await message.$replyToGroup('67890', '群通知');
178
+ * ```
179
+ */
180
+ readonly $replyToGroup: (groupId: string, content: SendContent) => Promise<DeliveryReceipt>;
181
+ /**
182
+ * 向指定频道/子频道发送消息(同 Endpoint)。
183
+ *
184
+ * ```ts
185
+ * await message.$replyToChannel('channel-1', 'guild-1', '频道通知');
186
+ * await message.$replyToChannel('channel-1', 'guild-1', '话题回复', 'thread-1');
187
+ * ```
188
+ */
189
+ readonly $replyToChannel: (channelId: string, guildId: string, content: SendContent, threadId?: string) => Promise<DeliveryReceipt>;
190
+ }
191
+ export declare function createOutboundEnvelope(request: Omit<OutboundEnvelope, 'payload' | '$client' | 'replace'>, initialPayload: unknown, resolveClient?: () => unknown): OutboundEnvelope;
@@ -0,0 +1,169 @@
1
+ const componentCallBrand = 'zhin.component-call/1';
2
+ const rawContentBrand = 'zhin.raw-content/1';
3
+ export function component(name, props) {
4
+ if (!name.trim())
5
+ throw new TypeError('Component name cannot be empty');
6
+ return Object.freeze({ $content: componentCallBrand, name, props });
7
+ }
8
+ export function raw(payload) {
9
+ return Object.freeze({ $content: rawContentBrand, payload });
10
+ }
11
+ export function isComponentCall(value) {
12
+ return !Array.isArray(value)
13
+ && typeof value === 'object'
14
+ && value !== null
15
+ && '$content' in value
16
+ && value.$content === componentCallBrand;
17
+ }
18
+ export function isRawContent(value) {
19
+ return !Array.isArray(value)
20
+ && typeof value === 'object'
21
+ && value !== null
22
+ && '$content' in value
23
+ && value.$content === rawContentBrand;
24
+ }
25
+ /** canonical Segment 一等公民判定(与 ComponentCall/RawContent 的 $content brand 互斥)。 */
26
+ export function isSegmentContent(value) {
27
+ return !Array.isArray(value)
28
+ && typeof value === 'object'
29
+ && value !== null
30
+ && !('$content' in value)
31
+ && typeof value.type === 'string'
32
+ && typeof value.data === 'object'
33
+ && value.data !== null;
34
+ }
35
+ export class Message {
36
+ conversation;
37
+ content;
38
+ generation;
39
+ sender;
40
+ metadata;
41
+ segments;
42
+ message;
43
+ endpointId;
44
+ mentioned;
45
+ replyTo;
46
+ clientAdapter;
47
+ #resolveClient;
48
+ /** @internal Constructed only by the generation-owned IM Runtime. */
49
+ constructor(conversation, content, generation, reply, sender, metadata = Object.freeze({}),
50
+ /**
51
+ * 结构化段视图(与 `content` 纯文本视图同源,见 IncomingMessage.segments)。
52
+ * Command dispatcher 优先使用此字段,以支持 mention、image 等结构化参数。
53
+ */
54
+ segments,
55
+ /** 结构化入站消息身份(平台原生 message id 经 MessageRef 传递)。 */
56
+ message, endpointId, mentioned, replyTo, client = () => {
57
+ throw new Error('Message has no Endpoint Client context');
58
+ }, clientAdapter) {
59
+ this.conversation = conversation;
60
+ this.content = content;
61
+ this.generation = generation;
62
+ this.sender = sender;
63
+ this.metadata = metadata;
64
+ this.segments = segments;
65
+ this.message = message;
66
+ this.endpointId = endpointId;
67
+ this.mentioned = mentioned;
68
+ this.replyTo = replyTo;
69
+ this.clientAdapter = clientAdapter;
70
+ this.#resolveClient = client;
71
+ this.$reply = (content) => reply(content);
72
+ this.$replyFrom = (requester, content) => reply(content, requester);
73
+ this.$sendTo = (target, content) => reply(content, undefined, target);
74
+ this.$replyToPrivate = (content, from) => {
75
+ if (!sender)
76
+ throw new Error('Cannot $replyToPrivate: message has no sender');
77
+ let parent;
78
+ if (from === true) {
79
+ if (conversation.kind !== 'group' && conversation.kind !== 'channel') {
80
+ throw new Error('Cannot $replyToPrivate with from=true: current conversation must be a group or channel');
81
+ }
82
+ parent = { kind: conversation.kind, id: conversation.id };
83
+ }
84
+ else if (from != null && typeof from === 'object') {
85
+ parent = from;
86
+ }
87
+ return reply(content, undefined, {
88
+ kind: 'private',
89
+ id: sender.id,
90
+ ...(parent ? { parent } : {}),
91
+ });
92
+ };
93
+ this.$replyToGroup = (groupId, content) => {
94
+ return reply(content, undefined, { kind: 'group', id: groupId });
95
+ };
96
+ this.$replyToChannel = (channelId, guildId, content, threadId) => {
97
+ return reply(content, undefined, {
98
+ kind: 'channel',
99
+ id: channelId,
100
+ parent: { kind: 'channel', id: guildId },
101
+ ...(threadId ? { threadId } : {}),
102
+ });
103
+ };
104
+ Object.freeze(this);
105
+ }
106
+ /** 平台原生消息 id(`message` 未提供时为 undefined)。 */
107
+ get id() {
108
+ return this.message?.id;
109
+ }
110
+ $reply;
111
+ /**
112
+ * Platform-native Client that received this message. The getter is
113
+ * generation-scoped; retaining the returned Client after dispatch is invalid.
114
+ */
115
+ get $client() {
116
+ return this.#resolveClient();
117
+ }
118
+ $replyFrom;
119
+ /**
120
+ * 向同 Endpoint 的另一个通道发送消息(通用)。
121
+ *
122
+ * ```ts
123
+ * await message.$sendTo({ kind: 'channel', id: 'ch-1', parent: { kind: 'channel', id: 'guild-1' } }, '频道通知');
124
+ * ```
125
+ */
126
+ $sendTo;
127
+ /**
128
+ * 私信当前消息的发送者(同 Endpoint)。
129
+ *
130
+ * @param content 消息内容
131
+ * @param from 会话上下文:
132
+ * - `true` — 用当前群/频道作为 parent(要求当前不在私聊中)
133
+ * - `{ kind, id }` — 显式指定 parent(群或子频道)
134
+ * - 省略 — 直接私信
135
+ *
136
+ * ```ts
137
+ * await message.$replyToPrivate('直接私信');
138
+ * await message.$replyToPrivate('群临时私信', true);
139
+ * await message.$replyToPrivate('频道私信', { kind: 'channel', id: '子频道ID' });
140
+ * ```
141
+ */
142
+ $replyToPrivate;
143
+ /**
144
+ * 向指定群发送消息(同 Endpoint)。
145
+ *
146
+ * ```ts
147
+ * await message.$replyToGroup('67890', '群通知');
148
+ * ```
149
+ */
150
+ $replyToGroup;
151
+ /**
152
+ * 向指定频道/子频道发送消息(同 Endpoint)。
153
+ *
154
+ * ```ts
155
+ * await message.$replyToChannel('channel-1', 'guild-1', '频道通知');
156
+ * await message.$replyToChannel('channel-1', 'guild-1', '话题回复', 'thread-1');
157
+ * ```
158
+ */
159
+ $replyToChannel;
160
+ }
161
+ export function createOutboundEnvelope(request, initialPayload, resolveClient = () => undefined) {
162
+ let payload = initialPayload;
163
+ return Object.freeze({
164
+ ...request,
165
+ get payload() { return payload; },
166
+ get $client() { return resolveClient(); },
167
+ replace(next) { payload = next; },
168
+ });
169
+ }
@@ -0,0 +1,177 @@
1
+ import { Scope, generationAdmissionBinder, type GenerationAdmissionGate, type PluginId, type RuntimeSnapshot, type SnapshotLease, type SnapshotReader } from '@zhin.js/plugin-runtime';
2
+ import { MessageBus } from './message-bus.js';
3
+ import { type AdapterOperation, type EndpointManagement, type EndpointManagementCapability, type AdapterEndpointPhase, type EndpointContentResolveContext, type EndpointEvent, type EndpointEventGateway } from '@zhin.js/adapter';
4
+ import { type ConversationEventStore, type ConversationContextBlock, type ConversationReference, type ConversationResolution, type ConversationRef, type DeliveryReceipt, type EndpointCapabilities, type MessageRef } from '@zhin.js/im-contract';
5
+ import { Message, type ConversationAddress, type IncomingMessage, type OutboundMessageService, type MessageSenderRef, type SendRequest } from './contracts.js';
6
+ import { LoginAssist } from '../../built/login-assist.js';
7
+ import type { UserInteraction } from '@zhin.js/interaction';
8
+ import { OutboundRenderer } from './outbound-renderer.js';
9
+ import { type RuntimeInteractiveHandler } from './interactive.js';
10
+ /** @public Stable inbound and outbound IM gateway token for Adapter integrations. */
11
+ export declare const outboundMessageToken: import("@zhin.js/plugin-runtime").Token<OutboundMessageService>;
12
+ /** Generation-owned ingress hooks before ordinary dispatch and after it misses. */
13
+ export interface IngressRoute {
14
+ preRoute?(message: Message, lease: SnapshotLease, requester: PluginId, conversationSequence: number | undefined): Promise<boolean>;
15
+ /** A live pre-route handoff that must run before handlers and commands. */
16
+ shouldRouteBeforeDispatch?(message: Message): boolean;
17
+ route(message: Message, lease: SnapshotLease, requester: PluginId, conversationSequence: number | undefined): Promise<boolean>;
18
+ }
19
+ export declare const ingressRouteToken: import("@zhin.js/plugin-runtime").Token<IngressRoute>;
20
+ /** Console 实时消息事件(SSE 推送源;content 仅为截断预览,不含完整原始段)。 */
21
+ export interface RuntimeMessageEvent {
22
+ readonly direction: 'inbound' | 'outbound';
23
+ readonly conversation: ConversationRef;
24
+ /** inbound:发送者。 */
25
+ readonly sender?: MessageSenderRef;
26
+ /** outbound:发起方插件。 */
27
+ readonly requester?: PluginId;
28
+ /** 预览文本,截断至 200 字。 */
29
+ readonly contentPreview: string;
30
+ readonly messageId?: string;
31
+ readonly timestamp: number;
32
+ }
33
+ export declare const messagePreviewLimit = 200;
34
+ export interface ImRuntimeOptions {
35
+ /**
36
+ * 全局静态命令前缀(如 `'/'`)。缺省时按适配器实例 config 的
37
+ * `commandPrefix` 解析(`endpoints[i]` 可逐项覆盖),默认 `''` 无前缀。
38
+ */
39
+ readonly commandPrefix?: string;
40
+ readonly renderer?: OutboundRenderer;
41
+ readonly conversationEvents?: ConversationEventStore;
42
+ /** Process-root ingress claim (pending interaction, authentication challenge, etc.). */
43
+ readonly inboundClaim?: (message: Message) => boolean | Promise<boolean>;
44
+ /**
45
+ * 入站 sender 增强:在构造 Message 前,将框架级角色(master / trusted)
46
+ * 合并到 sender.roles,使整个下游链路(命令分发、agent ingress 等)都能读到完整角色。
47
+ *
48
+ * 返回增强后的 sender(可原样返回)。缺省时 sender 保留适配器给出的平台角色。
49
+ */
50
+ readonly enrichSender?: (sender: MessageSenderRef | undefined, conversation: IncomingMessage['conversation'], snapshot: RuntimeSnapshot) => MessageSenderRef | undefined;
51
+ }
52
+ export declare class ImRuntime implements OutboundMessageService {
53
+ #private;
54
+ conversationEvents: ConversationEventStore;
55
+ constructor(options?: ImRuntimeOptions);
56
+ /** Process composition replaces the bootstrap memory store after required DB activation. */
57
+ replaceConversationEventStore(store: ConversationEventStore): void;
58
+ /** Pins all nested IM operations to the snapshot current at operation ingress. */
59
+ runWithSnapshotView<T>(operation: () => Promise<T>): Promise<T>;
60
+ resolveConversationReference(lease: SnapshotLease, reference: ConversationReference, context: EndpointContentResolveContext): Promise<ConversationResolution>;
61
+ readConversationContext(conversation: ConversationRef, consumer: string, throughSequence: number, limit?: number, excludeMessageId?: string): Promise<Readonly<{
62
+ blocks: readonly ConversationContextBlock[];
63
+ cursor: number;
64
+ }>>;
65
+ commitConversationContext(conversation: ConversationRef, consumer: string, cursor: number): Promise<void>;
66
+ attach(snapshots: SnapshotReader): void;
67
+ readonly permissionHost: import("@zhin.js/permission").PermissionHost;
68
+ readonly messageBus: MessageBus;
69
+ readonly loginAssist: LoginAssist;
70
+ install(resources: Scope): void;
71
+ /** The sole Adapter ingress, also installed as endpointEventGatewayToken. */
72
+ readonly endpointEvents: EndpointEventGateway & {
73
+ [generationAdmissionBinder](gate: GenerationAdmissionGate): EndpointEventGateway;
74
+ };
75
+ [generationAdmissionBinder](gate: GenerationAdmissionGate): OutboundMessageService;
76
+ /**
77
+ * 注册 interactive action 回跳 handler(prefix 最长匹配;返回注销函数)。
78
+ * 在 Command dispatch 之前路由:action 段 / 数字回跳 / 指令预填 payload。
79
+ */
80
+ registerInteractiveHandler(prefix: string, handler: RuntimeInteractiveHandler): () => void;
81
+ /**
82
+ * User interaction bound to this conversation.
83
+ * `bind.subjectId` waits for that user (e.g. master) instead of the message sender.
84
+ */
85
+ createInteraction(message: Message, bind?: {
86
+ readonly subjectId: string;
87
+ }): UserInteraction | undefined;
88
+ /**
89
+ * 订阅消息事件(入站 dispatch 完成后 / 出站发送成功后回调)。
90
+ * 返回注销函数。listener 抛错不会阻断消息链路。
91
+ */
92
+ onMessage(listener: (event: RuntimeMessageEvent) => void): () => void;
93
+ send(request: SendRequest): Promise<DeliveryReceipt>;
94
+ /** Sends through the exact generation lease that admitted the current operation. */
95
+ sendWithSnapshotLease(lease: SnapshotLease, request: SendRequest): Promise<DeliveryReceipt>;
96
+ receiveEndpointEvent(event: EndpointEvent, admission?: GenerationAdmissionGate): Promise<unknown>;
97
+ /** Console `endpoint.list` — empty until Adapter Feature projection is ready. */
98
+ listEndpoints(): readonly {
99
+ readonly id: string;
100
+ readonly name: string;
101
+ readonly adapter: string;
102
+ readonly owner: string;
103
+ readonly connected: boolean;
104
+ readonly status: 'online' | 'offline';
105
+ readonly phase: AdapterEndpointPhase;
106
+ readonly operations: readonly AdapterOperation[];
107
+ readonly managementCapabilities: readonly EndpointManagementCapability[];
108
+ }[];
109
+ /** Exact operation capabilities for one concrete live Endpoint. */
110
+ endpointCapabilities(input: {
111
+ readonly adapter: string;
112
+ readonly endpointKey: string;
113
+ }): EndpointCapabilities | undefined;
114
+ /**
115
+ * Console `GET /api/stats` 同源计数:非 root 插件节点 + AdapterIndex endpoints。
116
+ * 供命令 / 状态卡等在 Plugin Runtime 下读取(legacy `root.adapters` / `root.children` 已不存在)。
117
+ */
118
+ inventory(): Readonly<{
119
+ plugins: number;
120
+ endpoints: {
121
+ readonly total: number;
122
+ readonly online: number;
123
+ };
124
+ }>;
125
+ getEndpoint(adapter: string, endpointKey: string): {
126
+ readonly name: string;
127
+ readonly adapter: string;
128
+ readonly connected: boolean;
129
+ readonly status: 'online' | 'offline';
130
+ readonly phase: AdapterEndpointPhase;
131
+ readonly operations: readonly AdapterOperation[];
132
+ readonly managementCapabilities: readonly EndpointManagementCapability[];
133
+ } | null;
134
+ sendEndpointMessage(input: {
135
+ readonly adapter: string;
136
+ readonly endpointKey: string;
137
+ readonly conversation: ConversationAddress;
138
+ readonly content: unknown;
139
+ }): Promise<{
140
+ messageId: string;
141
+ }>;
142
+ /** Activity-feedback: add a message reaction when the live Endpoint supports it. */
143
+ addEndpointReaction(input: {
144
+ readonly adapter: string;
145
+ readonly endpointKey: string;
146
+ readonly message: MessageRef;
147
+ readonly emoji: string;
148
+ readonly sceneType?: string;
149
+ readonly channelId?: string;
150
+ }): Promise<string | null>;
151
+ removeEndpointReaction(input: {
152
+ readonly adapter: string;
153
+ readonly endpointKey: string;
154
+ readonly message: MessageRef;
155
+ readonly reactionId: string;
156
+ }): Promise<void>;
157
+ /** Activity-feedback autoRemove: recall a previously sent status message. */
158
+ recallEndpointMessage(input: {
159
+ readonly adapter: string;
160
+ readonly endpointKey: string;
161
+ readonly message: MessageRef;
162
+ }): Promise<void>;
163
+ editEndpointMessage(input: {
164
+ readonly adapter: string;
165
+ readonly endpointKey: string;
166
+ readonly message: MessageRef;
167
+ readonly content: unknown;
168
+ }): Promise<string | null>;
169
+ setEndpointTyping(input: {
170
+ readonly adapter: string;
171
+ readonly endpointKey: string;
172
+ readonly conversation: ConversationRef;
173
+ readonly active?: boolean;
174
+ }): Promise<void>;
175
+ /** Run one management operation while the Endpoint generation stays leased. */
176
+ withEndpointManagement<T>(adapter: string, endpointKey: string, run: (management: EndpointManagement) => T | Promise<T>): Promise<T | null>;
177
+ }