@zhin.js/core 1.5.15 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (328) hide show
  1. package/README.md +78 -195
  2. package/lib/ai-completion-contract.d.ts +135 -0
  3. package/lib/ai-completion-contract.js +69 -0
  4. package/lib/built/ai-access.d.ts +2 -21
  5. package/lib/built/ai-access.js +1 -46
  6. package/lib/built/ai-outbound/index.d.ts +0 -2
  7. package/lib/built/ai-outbound/index.js +0 -2
  8. package/lib/built/ai-outbound/prompt.d.ts +2 -0
  9. package/lib/built/ai-outbound/prompt.js +2 -0
  10. package/lib/built/ai-outbound/types.d.ts +1 -10
  11. package/lib/built/ai-trigger.d.ts +39 -78
  12. package/lib/built/ai-trigger.js +3 -254
  13. package/lib/built/common-adapter-tools.d.ts +21 -6
  14. package/lib/built/common-adapter-tools.js +28 -17
  15. package/lib/built/generic-segment-mapper.js +4 -1
  16. package/lib/built/html-segment-fallback.d.ts +6 -7
  17. package/lib/built/html-segment-fallback.js +1 -16
  18. package/lib/built/html-to-text.d.ts +0 -3
  19. package/lib/built/html-to-text.js +131 -40
  20. package/lib/built/interaction-messages.d.ts +1 -0
  21. package/lib/built/interaction-messages.js +30 -0
  22. package/lib/built/interactive-segments/action.d.ts +3 -4
  23. package/lib/built/interactive-segments/action.js +2 -5
  24. package/lib/built/interactive-segments/index.d.ts +0 -2
  25. package/lib/built/interactive-segments/index.js +0 -2
  26. package/lib/built/interactive-segments/keyboard-segment.d.ts +0 -1
  27. package/lib/built/interactive-segments/keyboard-segment.js +0 -1
  28. package/lib/built/interactive-segments/onebot-keyboard.d.ts +0 -1
  29. package/lib/built/interactive-segments/onebot-keyboard.js +0 -2
  30. package/lib/built/interactive-segments/resolve.d.ts +2 -3
  31. package/lib/built/interactive-segments/resolve.js +21 -14
  32. package/lib/built/interactive-segments/types.d.ts +2 -7
  33. package/lib/built/interactive-segments/types.js +22 -2
  34. package/lib/built/login-assist.d.ts +13 -11
  35. package/lib/built/login-assist.js +32 -26
  36. package/lib/built/message-enrich.d.ts +24 -27
  37. package/lib/built/message-enrich.js +53 -49
  38. package/lib/built/outbound-content-arrays.d.ts +4 -0
  39. package/lib/built/outbound-content-arrays.js +32 -0
  40. package/lib/built/outbound-media-trust.d.ts +46 -0
  41. package/lib/built/outbound-media-trust.js +245 -0
  42. package/lib/built/outbound-media-utils.d.ts +5 -3
  43. package/lib/built/outbound-media-utils.js +5 -3
  44. package/lib/built/readable-link.d.ts +4 -0
  45. package/lib/built/readable-link.js +32 -0
  46. package/lib/built/rich-segments/markdown-to-text.d.ts +1 -2
  47. package/lib/built/rich-segments/markdown-to-text.js +141 -17
  48. package/lib/built/roles.d.ts +141 -12
  49. package/lib/built/roles.js +253 -52
  50. package/lib/built/segment-contract/assert.js +8 -2
  51. package/lib/built/segment-contract/delivery.js +1 -0
  52. package/lib/built/segment-contract/index.d.ts +3 -3
  53. package/lib/built/segment-contract/index.js +2 -2
  54. package/lib/built/segment-contract/json-schema.d.ts +39 -5
  55. package/lib/built/segment-contract/json-schema.js +207 -24
  56. package/lib/built/segment-contract/preview.js +8 -1
  57. package/lib/built/segment-contract/text.js +1 -1
  58. package/lib/built/segment-contract/types.d.ts +2 -2
  59. package/lib/built/segment-contract/validate.d.ts +1553 -224
  60. package/lib/built/segment-contract/validate.js +39 -3
  61. package/lib/built/tool-access.d.ts +5 -0
  62. package/lib/built/tool-access.js +17 -0
  63. package/lib/built/user-interaction.d.ts +5 -4
  64. package/lib/built/user-interaction.js +64 -52
  65. package/lib/errors.d.ts +1 -18
  66. package/lib/errors.js +1 -26
  67. package/lib/feature/command-public-api.d.ts +5 -0
  68. package/lib/feature/command-public-api.js +5 -0
  69. package/lib/feature/command.d.ts +2 -0
  70. package/lib/feature/command.js +1 -0
  71. package/lib/feature/component.d.ts +1 -0
  72. package/lib/feature/component.js +1 -0
  73. package/lib/feature/handler.d.ts +13 -7
  74. package/lib/feature/handler.js +2 -1
  75. package/lib/feature/middleware-public-api.d.ts +6 -0
  76. package/lib/feature/middleware-public-api.js +6 -0
  77. package/lib/feature/middleware.d.ts +22 -2
  78. package/lib/feature/middleware.js +7 -2
  79. package/lib/im-scene.d.ts +4 -3
  80. package/lib/im-scene.js +9 -9
  81. package/lib/im-session-id.d.ts +20 -12
  82. package/lib/im-session-id.js +8 -8
  83. package/lib/index.d.ts +19 -48
  84. package/lib/index.js +14 -41
  85. package/lib/jsx/intrinsic-elements.d.ts +83 -0
  86. package/lib/jsx/message-renderer.d.ts +13 -0
  87. package/lib/jsx/message-renderer.js +128 -0
  88. package/lib/jsx/message-tags.d.ts +133 -0
  89. package/lib/jsx/message-tags.js +50 -0
  90. package/lib/jsx-dev-runtime.d.ts +2 -2
  91. package/lib/jsx-dev-runtime.js +1 -2
  92. package/lib/jsx-runtime.d.ts +2 -12
  93. package/lib/jsx-runtime.js +1 -10
  94. package/lib/jsx.d.ts +6 -30
  95. package/lib/jsx.js +3 -93
  96. package/lib/message.d.ts +0 -40
  97. package/lib/message.js +1 -27
  98. package/lib/models/system-log.d.ts +0 -2
  99. package/lib/models/system-log.js +1 -8
  100. package/lib/models/user.d.ts +0 -2
  101. package/lib/models/user.js +1 -7
  102. package/lib/notice.d.ts +38 -33
  103. package/lib/notice.js +23 -7
  104. package/lib/plugin-runtime/im/command-feedback.d.ts +59 -0
  105. package/lib/plugin-runtime/im/command-feedback.js +148 -0
  106. package/lib/plugin-runtime/im/contracts.d.ts +217 -32
  107. package/lib/plugin-runtime/im/contracts.js +141 -23
  108. package/lib/plugin-runtime/im/conversation-runtime.d.ts +42 -0
  109. package/lib/plugin-runtime/im/conversation-runtime.js +451 -0
  110. package/lib/plugin-runtime/im/endpoint-runtime.d.ts +89 -0
  111. package/lib/plugin-runtime/im/endpoint-runtime.js +381 -0
  112. package/lib/plugin-runtime/im/feature-gate.d.ts +21 -0
  113. package/lib/plugin-runtime/im/feature-gate.js +88 -0
  114. package/lib/plugin-runtime/im/host/component-host-installer.d.ts +2 -0
  115. package/lib/plugin-runtime/im/host/component-host-installer.js +14 -0
  116. package/lib/plugin-runtime/im/host/conversation-migration.d.ts +5 -0
  117. package/lib/plugin-runtime/im/host/conversation-migration.js +75 -0
  118. package/lib/plugin-runtime/im/host/database-config.d.ts +10 -0
  119. package/lib/plugin-runtime/im/host/database-config.js +114 -0
  120. package/lib/plugin-runtime/im/host/database-host-installer.d.ts +29 -0
  121. package/lib/plugin-runtime/im/host/database-host-installer.js +442 -0
  122. package/lib/plugin-runtime/im/host/database-state.d.ts +9 -0
  123. package/lib/plugin-runtime/im/host/database-state.js +91 -0
  124. package/lib/plugin-runtime/im/host/index.d.ts +8 -0
  125. package/lib/plugin-runtime/im/host/index.js +8 -0
  126. package/lib/plugin-runtime/im/host/locale-host-installer.d.ts +3 -0
  127. package/lib/plugin-runtime/im/host/locale-host-installer.js +60 -0
  128. package/lib/plugin-runtime/im/host/outbound-host-installer.d.ts +8 -0
  129. package/lib/plugin-runtime/im/host/outbound-host-installer.js +153 -0
  130. package/lib/plugin-runtime/im/host/sender-enrichment.d.ts +34 -0
  131. package/lib/plugin-runtime/im/host/sender-enrichment.js +82 -0
  132. package/lib/plugin-runtime/im/im-runtime.d.ts +40 -111
  133. package/lib/plugin-runtime/im/im-runtime.js +234 -1059
  134. package/lib/plugin-runtime/im/inbound-dedup.d.ts +84 -0
  135. package/lib/plugin-runtime/im/inbound-dedup.js +322 -0
  136. package/lib/plugin-runtime/im/inbound-origin.d.ts +150 -0
  137. package/lib/plugin-runtime/im/inbound-origin.js +183 -0
  138. package/lib/plugin-runtime/im/inbound-runtime.d.ts +59 -0
  139. package/lib/plugin-runtime/im/inbound-runtime.js +478 -0
  140. package/lib/plugin-runtime/im/inbound-spine.d.ts +196 -0
  141. package/lib/plugin-runtime/im/inbound-spine.js +335 -0
  142. package/lib/plugin-runtime/im/index.d.ts +15 -4
  143. package/lib/plugin-runtime/im/index.js +11 -4
  144. package/lib/plugin-runtime/im/interaction-runtime.d.ts +50 -0
  145. package/lib/plugin-runtime/im/interaction-runtime.js +390 -0
  146. package/lib/plugin-runtime/im/interactive-router.d.ts +81 -0
  147. package/lib/plugin-runtime/im/interactive-router.js +382 -0
  148. package/lib/plugin-runtime/im/message-diagnostics.d.ts +70 -0
  149. package/lib/plugin-runtime/im/message-diagnostics.js +182 -0
  150. package/lib/plugin-runtime/im/message-dispatcher.d.ts +18 -4
  151. package/lib/plugin-runtime/im/message-dispatcher.js +138 -20
  152. package/lib/plugin-runtime/im/message-events.d.ts +85 -0
  153. package/lib/plugin-runtime/im/message-events.js +113 -0
  154. package/lib/plugin-runtime/im/outbound-delivery-runtime.d.ts +39 -0
  155. package/lib/plugin-runtime/im/outbound-delivery-runtime.js +450 -0
  156. package/lib/plugin-runtime/im/outbound-renderer.d.ts +52 -3
  157. package/lib/plugin-runtime/im/outbound-renderer.js +188 -8
  158. package/lib/plugin-runtime/im/outbound-segments.d.ts +29 -5
  159. package/lib/plugin-runtime/im/outbound-segments.js +130 -36
  160. package/lib/plugin-runtime/im/progressive-reply.d.ts +58 -0
  161. package/lib/plugin-runtime/im/progressive-reply.js +501 -0
  162. package/lib/plugin-runtime/im/public-api.d.ts +1 -1
  163. package/lib/request.d.ts +27 -36
  164. package/lib/request.js +14 -6
  165. package/lib/side-event/base.d.ts +64 -44
  166. package/lib/side-event/base.js +72 -19
  167. package/lib/side-event/index.d.ts +1 -1
  168. package/lib/side-event/index.js +1 -1
  169. package/lib/side-event/normalize.d.ts +7 -38
  170. package/lib/side-event/normalize.js +4 -109
  171. package/lib/side-event/scene-events.d.ts +40 -0
  172. package/lib/side-event/scene-events.js +147 -0
  173. package/lib/side-event/types.d.ts +4 -13
  174. package/lib/side-event/types.js +1 -55
  175. package/lib/system-event.d.ts +17 -12
  176. package/lib/system-event.js +8 -6
  177. package/lib/types.d.ts +23 -167
  178. package/lib/utils.d.ts +50 -33
  179. package/lib/utils.js +12 -185
  180. package/lib/venue/contracts.d.ts +21 -0
  181. package/lib/venue/contracts.js +3 -0
  182. package/lib/venue/floor-controller.d.ts +11 -0
  183. package/lib/venue/floor-controller.js +63 -0
  184. package/lib/venue/index.d.ts +13 -0
  185. package/lib/venue/index.js +11 -0
  186. package/lib/venue/membership-port.d.ts +23 -0
  187. package/lib/venue/membership-port.js +141 -0
  188. package/lib/venue/projector.d.ts +38 -0
  189. package/lib/venue/projector.js +45 -0
  190. package/lib/venue/registry.d.ts +16 -0
  191. package/lib/venue/registry.js +63 -0
  192. package/lib/venue/router.d.ts +19 -0
  193. package/lib/venue/router.js +101 -0
  194. package/lib/venue/send-limiter.d.ts +17 -0
  195. package/lib/venue/send-limiter.js +73 -0
  196. package/lib/venue/validator.d.ts +6 -0
  197. package/lib/venue/validator.js +160 -0
  198. package/package.json +24 -50
  199. package/lib/adapter.d.ts +0 -145
  200. package/lib/adapter.js +0 -377
  201. package/lib/built/adapter-process.d.ts +0 -58
  202. package/lib/built/adapter-process.js +0 -128
  203. package/lib/built/agent-preset.d.ts +0 -64
  204. package/lib/built/agent-preset.js +0 -79
  205. package/lib/built/ai-outbound/adapter-access.d.ts +0 -3
  206. package/lib/built/ai-outbound/adapter-access.js +0 -9
  207. package/lib/built/ai-outbound/extensions/qq-message.d.ts +0 -3
  208. package/lib/built/ai-outbound/extensions/qq-message.js +0 -23
  209. package/lib/built/authorization.d.ts +0 -10
  210. package/lib/built/authorization.js +0 -76
  211. package/lib/built/command.d.ts +0 -72
  212. package/lib/built/command.js +0 -105
  213. package/lib/built/component.d.ts +0 -67
  214. package/lib/built/component.js +0 -97
  215. package/lib/built/config.d.ts +0 -98
  216. package/lib/built/config.js +0 -372
  217. package/lib/built/connect-endpoint-instance.d.ts +0 -17
  218. package/lib/built/connect-endpoint-instance.js +0 -42
  219. package/lib/built/database.d.ts +0 -68
  220. package/lib/built/database.js +0 -106
  221. package/lib/built/dispatcher.d.ts +0 -141
  222. package/lib/built/dispatcher.js +0 -383
  223. package/lib/built/endpoint-commands.d.ts +0 -3
  224. package/lib/built/endpoint-commands.js +0 -99
  225. package/lib/built/endpoint-lifecycle-service.d.ts +0 -28
  226. package/lib/built/endpoint-lifecycle-service.js +0 -242
  227. package/lib/built/endpoint-lifecycle.d.ts +0 -27
  228. package/lib/built/endpoint-lifecycle.js +0 -36
  229. package/lib/built/endpoint-manager.d.ts +0 -34
  230. package/lib/built/html-renderer-loader.d.ts +0 -13
  231. package/lib/built/html-renderer-loader.js +0 -33
  232. package/lib/built/inbound-pipeline.d.ts +0 -37
  233. package/lib/built/inbound-pipeline.js +0 -63
  234. package/lib/built/inbound-runner.d.ts +0 -22
  235. package/lib/built/inbound-runner.js +0 -34
  236. package/lib/built/interactive-segment-contract.d.ts +0 -6
  237. package/lib/built/interactive-segment-contract.js +0 -9
  238. package/lib/built/interactive-segments/fallback-store.d.ts +0 -29
  239. package/lib/built/interactive-segments/fallback-store.js +0 -63
  240. package/lib/built/interactive-segments/handlers.d.ts +0 -16
  241. package/lib/built/interactive-segments/handlers.js +0 -74
  242. package/lib/built/introspection-format.d.ts +0 -10
  243. package/lib/built/introspection-format.js +0 -28
  244. package/lib/built/management-command-guard.d.ts +0 -15
  245. package/lib/built/management-command-guard.js +0 -25
  246. package/lib/built/message-filter.d.ts +0 -176
  247. package/lib/built/message-filter.js +0 -239
  248. package/lib/built/optional-peer-import.d.ts +0 -3
  249. package/lib/built/optional-peer-import.js +0 -33
  250. package/lib/built/outbound-media-contract.d.ts +0 -22
  251. package/lib/built/outbound-media-contract.js +0 -10
  252. package/lib/built/permission.d.ts +0 -51
  253. package/lib/built/permission.js +0 -99
  254. package/lib/built/permit-check.d.ts +0 -7
  255. package/lib/built/permit-check.js +0 -35
  256. package/lib/built/permit-parse.d.ts +0 -16
  257. package/lib/built/permit-parse.js +0 -32
  258. package/lib/built/platform-permit.d.ts +0 -20
  259. package/lib/built/platform-permit.js +0 -91
  260. package/lib/built/queue-im-field-contract.d.ts +0 -32
  261. package/lib/built/queue-im-field-contract.js +0 -67
  262. package/lib/built/rich-segments/adapter-policies.d.ts +0 -9
  263. package/lib/built/rich-segments/adapter-policies.js +0 -27
  264. package/lib/built/rich-segments/base.d.ts +0 -11
  265. package/lib/built/rich-segments/base.js +0 -24
  266. package/lib/built/rich-segments/builtins.d.ts +0 -4
  267. package/lib/built/rich-segments/builtins.js +0 -40
  268. package/lib/built/rich-segments/capabilities.d.ts +0 -6
  269. package/lib/built/rich-segments/capabilities.js +0 -38
  270. package/lib/built/rich-segments/html-segment.d.ts +0 -15
  271. package/lib/built/rich-segments/html-segment.js +0 -62
  272. package/lib/built/rich-segments/index.d.ts +0 -13
  273. package/lib/built/rich-segments/index.js +0 -13
  274. package/lib/built/rich-segments/markdown-segment.d.ts +0 -14
  275. package/lib/built/rich-segments/markdown-segment.js +0 -58
  276. package/lib/built/rich-segments/qrcode-segment.d.ts +0 -18
  277. package/lib/built/rich-segments/qrcode-segment.js +0 -73
  278. package/lib/built/rich-segments/registry.d.ts +0 -16
  279. package/lib/built/rich-segments/registry.js +0 -52
  280. package/lib/built/rich-segments/resolve.d.ts +0 -5
  281. package/lib/built/rich-segments/resolve.js +0 -87
  282. package/lib/built/rich-segments/tts-segment.d.ts +0 -13
  283. package/lib/built/rich-segments/tts-segment.js +0 -51
  284. package/lib/built/rich-segments/types.d.ts +0 -79
  285. package/lib/built/rich-segments/types.js +0 -17
  286. package/lib/built/runtime-io.d.ts +0 -9
  287. package/lib/built/runtime-io.js +0 -67
  288. package/lib/built/schedule.d.ts +0 -54
  289. package/lib/built/schedule.js +0 -112
  290. package/lib/built/schema-endpoint-manager.d.ts +0 -17
  291. package/lib/built/schema-endpoint-manager.js +0 -73
  292. package/lib/built/schema-feature.d.ts +0 -77
  293. package/lib/built/schema-feature.js +0 -130
  294. package/lib/built/skill.d.ts +0 -120
  295. package/lib/built/skill.js +0 -151
  296. package/lib/built/speech-loader.d.ts +0 -14
  297. package/lib/built/speech-loader.js +0 -32
  298. package/lib/built/tool.d.ts +0 -151
  299. package/lib/built/tool.js +0 -388
  300. package/lib/command.d.ts +0 -50
  301. package/lib/command.js +0 -106
  302. package/lib/component.d.ts +0 -26
  303. package/lib/component.js +0 -583
  304. package/lib/endpoint-capabilities.d.ts +0 -46
  305. package/lib/endpoint-capabilities.js +0 -55
  306. package/lib/endpoint.d.ts +0 -19
  307. package/lib/endpoint.js +0 -3
  308. package/lib/host-plugin-registry.d.ts +0 -8
  309. package/lib/host-plugin-registry.js +0 -12
  310. package/lib/plugin-context.d.ts +0 -27
  311. package/lib/plugin-context.js +0 -64
  312. package/lib/plugin-runtime/im/interactive.d.ts +0 -26
  313. package/lib/plugin-runtime/im/interactive.js +0 -46
  314. package/lib/plugin-runtime/im/login-assist-host.d.ts +0 -6
  315. package/lib/plugin-runtime/im/login-assist-host.js +0 -6
  316. package/lib/plugin-runtime/im/message-bus.d.ts +0 -38
  317. package/lib/plugin-runtime/im/message-bus.js +0 -40
  318. package/lib/plugin-runtime/im/service-tokens.d.ts +0 -18
  319. package/lib/plugin-runtime/im/service-tokens.js +0 -13
  320. package/lib/plugin.d.ts +0 -268
  321. package/lib/plugin.js +0 -583
  322. package/lib/schema-interaction.d.ts +0 -117
  323. package/lib/schema-interaction.js +0 -247
  324. package/lib/side-event/dispatch.d.ts +0 -15
  325. package/lib/side-event/dispatch.js +0 -140
  326. package/lib/tool-zod.d.ts +0 -43
  327. package/lib/tool-zod.js +0 -184
  328. /package/lib/{built/endpoint-manager.js → jsx/intrinsic-elements.js} +0 -0
@@ -0,0 +1,148 @@
1
+ import { readOperationInputResources } from '@zhin.js/feature-kit';
2
+ import { Fragment, jsx } from '@zhin.js/jsx';
3
+ import { formatCompact, getLogger } from '@zhin.js/logger';
4
+ import { createToken, createMessages, resolveLocale } from '@zhin.js/plugin-runtime';
5
+ import { resolveOutboundInteractivePolicy, resolveOutboundMarkdownPolicy, resolveOutboundSupportedSegments } from './outbound-segments.js';
6
+ /** Explicitly provide this resource in Root setup; descendant bindings are not selected. */
7
+ export const commandFeedbackToken = createToken('zhin.im.command-feedback');
8
+ const logger = getLogger('command');
9
+ function feedbackFrom(result) {
10
+ const identity = { command: result.command, owner: result.owner };
11
+ if (result.status === 'invalid')
12
+ return Object.freeze({ ...identity, status: 'invalid',
13
+ issues: Object.freeze((result.issues ?? []).map(issue => Object.freeze({ ...issue }))), help: result.help });
14
+ if (result.status === 'denied')
15
+ return Object.freeze({ ...identity, status: 'denied',
16
+ ...(result.denial ? { permit: result.denial.permit, reason: result.denial.reason } : {}) });
17
+ if (result.status === 'limited')
18
+ return Object.freeze({ ...identity, status: 'limited',
19
+ ...(result.limit ? { limit: Object.freeze({ ...result.limit }) } : {}) });
20
+ return undefined;
21
+ }
22
+ const feedbackMessages = createMessages({
23
+ denied: { 'zh-CN': '没有权限执行此指令。', en: 'You do not have permission to run this command.' },
24
+ deniedBecause: { 'zh-CN': '无法执行此指令:{reason}', en: 'This command cannot run here: {reason}' },
25
+ cooldown: { 'zh-CN': '此指令仍在冷却,请稍后再试。', en: 'This command is on cooldown. Try again later.' },
26
+ wait: { 'zh-CN': '此指令仍在冷却,约 {seconds} 秒后再试。', en: 'This command is on cooldown. Try again in about {seconds} seconds.' },
27
+ busy: { 'zh-CN': '你的上一条同类指令仍在处理中,请等待执行完成,避免重复触发。', en: 'Your previous command is still running. Wait for it to finish before trying again.' },
28
+ capacity: { 'zh-CN': '当前繁忙,本次指令未被接纳,请稍后再试。', en: 'The service is busy. This command was not accepted; try again later.' },
29
+ identity: { 'zh-CN': '当前缺少可信身份或有效执行上下文,本次指令未被接纳。请管理员检查适配器及当前运行状态。', en: 'This command was not accepted because a trusted identity or valid execution context is missing. Ask an administrator to check the adapter and runtime.' },
30
+ });
31
+ function explainsDenial(permit) {
32
+ return typeof permit === 'string' && /^(platform|platform-role|platform-permission|bot|bot-role|bot-permission):/u.test(permit);
33
+ }
34
+ function defaultFeedback(feedback, locale) {
35
+ if (feedback.status === 'invalid') {
36
+ return [...feedback.issues.map(issue => issue.message), feedback.help].filter(Boolean).join('\n');
37
+ }
38
+ // Platform / Bot conditions say what is missing (e.g. 「机器人不是本群管理员」); zhin role and
39
+ // conversation conditions keep the generic sentence.
40
+ if (feedback.status === 'denied')
41
+ return feedback.reason && explainsDenial(feedback.permit)
42
+ ? feedbackMessages(locale, 'deniedBecause', { reason: feedback.reason }) : feedbackMessages(locale, 'denied');
43
+ const reason = feedback.limit?.reason;
44
+ const waitMs = feedback.limit?.retryAfterMs;
45
+ return reason === 'cooldown'
46
+ ? typeof waitMs === 'number' && waitMs > 0
47
+ ? feedbackMessages(locale, 'wait', { seconds: Math.ceil(waitMs / 1000) }) : feedbackMessages(locale, 'cooldown')
48
+ : reason === 'busy' ? feedbackMessages(locale, 'busy')
49
+ : reason === 'capacity' ? feedbackMessages(locale, 'capacity')
50
+ : feedbackMessages(locale, 'identity');
51
+ }
52
+ /** @internal Resolve once from the operation snapshot; never redispatch or send from here. */
53
+ export async function renderCommandFeedback(result, message, snapshot) {
54
+ const feedback = feedbackFrom(result);
55
+ if (!feedback)
56
+ return undefined;
57
+ const renderer = snapshot.resources.get(snapshot.root)?.get(commandFeedbackToken.id);
58
+ if (typeof renderer === 'function') {
59
+ const conversation = Object.freeze({
60
+ endpoint: Object.freeze({ id: message.conversation.endpoint.id, adapter: message.conversation.endpoint.adapter }),
61
+ kind: message.conversation.kind, id: message.conversation.id,
62
+ ...(message.conversation.parent ? { parent: Object.freeze({
63
+ kind: message.conversation.parent.kind, id: message.conversation.parent.id,
64
+ }) } : {}),
65
+ ...(message.conversation.threadId !== undefined ? { threadId: message.conversation.threadId } : {}),
66
+ });
67
+ const context = Object.freeze({ conversation, locale: resolveLocale(message.locale),
68
+ ...(message.sender ? { sender: Object.freeze({ id: message.sender.id,
69
+ ...(message.sender.name !== undefined ? { name: message.sender.name } : {}),
70
+ ...(message.sender.platform ? { platform: Object.freeze({ standing: message.sender.platform.standing,
71
+ ...(message.sender.platform.roles ? { roles: Object.freeze(message.sender.platform.roles.map(role => Object.freeze({ ...role }))) } : {}),
72
+ ...(message.sender.platform.permissions ? { permissions: Object.freeze([...message.sender.platform.permissions]) } : {}) }) } : {}),
73
+ ...(message.sender.chatRole ? { chatRole: message.sender.chatRole } : {}),
74
+ ...(message.sender.chatRoleLevels ? { chatRoleLevels: message.sender.chatRoleLevels } : {}) }) } : {}),
75
+ ...(message.clientAdapter !== undefined ? { clientAdapter: message.clientAdapter } : {}),
76
+ generation: snapshot.generation });
77
+ try {
78
+ const content = await renderer(feedback, context);
79
+ if (content !== undefined)
80
+ return { content, owner: snapshot.root };
81
+ }
82
+ catch {
83
+ // Renderer failures contain user-controlled data; record only the failure category.
84
+ logger.warn(formatCompact({ op: 'command_feedback_error', generation: snapshot.generation, status: feedback.status }));
85
+ }
86
+ }
87
+ return { content: defaultFeedback(feedback, resolveLocale(message.locale)), owner: result.owner };
88
+ }
89
+ export const commandMenuPresentationToken = createToken('zhin.command-menu-presentation', 'Root-selected command menu presentation; framework pagination remains unchanged');
90
+ /** The current Root owns both the selected presenter and the resulting content. */
91
+ export async function presentCommandMenu(page, fallback, snapshot, conversation) {
92
+ const presenter = snapshot.resources.get(snapshot.root)?.get(commandMenuPresentationToken.id);
93
+ if (!presenter)
94
+ return fallback;
95
+ try {
96
+ const view = Object.freeze({
97
+ endpoint: Object.freeze({ id: conversation.endpoint.id, adapter: conversation.endpoint.adapter }),
98
+ kind: conversation.kind, id: conversation.id,
99
+ ...(conversation.parent ? { parent: Object.freeze({ kind: conversation.parent.kind, id: conversation.parent.id }) } : {}),
100
+ ...(conversation.threadId !== undefined ? { threadId: conversation.threadId } : {}),
101
+ });
102
+ const content = await presenter(Object.freeze({ page, conversation: view, generation: snapshot.generation }));
103
+ return content === undefined ? fallback : content;
104
+ }
105
+ catch {
106
+ // A presentation failure must not expose content, re-run commands or cause a second send.
107
+ logger.warn(formatCompact({ op: 'command_menu_presentation', status: 'fallback', reason: 'presenter_failed', generation: snapshot.generation }));
108
+ return fallback;
109
+ }
110
+ }
111
+ const menuMessages = createMessages({
112
+ page: { 'zh-CN': '**指令菜单** · 第 {page}/{pages} 页', en: '**Command menu** · Page {page}/{pages}' },
113
+ previous: { 'zh-CN': '上一页', en: 'Previous' },
114
+ next: { 'zh-CN': '下一页', en: 'Next' },
115
+ });
116
+ /** IM-only presentation: Command remains independent of JSX, adapters and callback registries. */
117
+ export async function commandMenuReply(result, { commands, snapshot, conversation, prefix }) {
118
+ // Only validated menus carry this metadata; other command return values stay opaque.
119
+ const menu = result.menu;
120
+ if (!menu)
121
+ return result.value;
122
+ const content = await presentCommandMenu(menu, result.value, snapshot, conversation);
123
+ if (menu.pages <= 1)
124
+ return content;
125
+ const endpoint = conversation.endpoint.id;
126
+ const supported = resolveOutboundSupportedSegments(endpoint, snapshot);
127
+ if (resolveOutboundMarkdownPolicy(endpoint, snapshot) !== 'native'
128
+ || resolveOutboundInteractivePolicy(endpoint, snapshot) !== 'native'
129
+ || supported && (!supported.includes('markdown') || !supported.includes('keyboard')))
130
+ return content;
131
+ const button = (page, label, disabled) => jsx('button', {
132
+ label, disabled, style: disabled ? 'secondary' : 'primary',
133
+ onClick: async (message) => {
134
+ if (disabled)
135
+ return [];
136
+ const input = `${menu.keyword}${menu.pluginKey ? ` ${menu.pluginKey}` : ''} --page ${page}`;
137
+ const next = await commands.dispatch({ input: input, source: message, commandPrefix: prefix, snapshot: snapshot, locale: menu.locale, operation: readOperationInputResources(message, snapshot) });
138
+ return commandMenuReply(next, { commands: commands, snapshot: snapshot, conversation: message.conversation, prefix: prefix });
139
+ },
140
+ });
141
+ return [content,
142
+ { type: 'markdown', data: { content: menuMessages(menu.locale, 'page', { page: menu.page, pages: menu.pages }) } },
143
+ jsx(Fragment, { children: [
144
+ button(menu.page - 1, menuMessages(menu.locale, 'previous'), menu.page === 1),
145
+ button(menu.page + 1, menuMessages(menu.locale, 'next'), menu.page === menu.pages),
146
+ ] }),
147
+ ];
148
+ }
@@ -1,9 +1,74 @@
1
- import type { PluginId } from '@zhin.js/plugin-runtime';
2
- import type { ConversationRef, DeliveryReceipt, MessageRef } from '@zhin.js/im-contract';
1
+ import type { EndpointChildLease, EndpointControl, EndpointManagement } from '@zhin.js/adapter';
2
+ import type { JSXElement } from '@zhin.js/jsx';
3
+ import { type CommandMenuPage } from '@zhin.js/command';
4
+ import { type PluginId, type RuntimeSnapshot, type SnapshotLease, type SnapshotReader, type Locale } from '@zhin.js/plugin-runtime';
5
+ import { operationInputBinding, operationInputSignal, operationInputResources, operationSession, type OperationSession, type OperationResourceView, type CapabilityOperationFactory } from '@zhin.js/feature-kit';
6
+ import type { ConversationRef, DeliveryReceipt, MessageRef, PlatformStanding, SelfProfilePort } from '@zhin.js/im-contract';
7
+ import type { ChatRole, ChatRoleLevels } from '../../built/roles.js';
8
+ import type { MessageOrigin } from './inbound-origin.js';
9
+ import type { CoreReplyStream, OpenReplyStreamOptions } from './progressive-reply.js';
3
10
  import type { MediaRef, Segment } from '../../built/segment-contract/types.js';
11
+ import type { OutboundMediaTrust } from '../../built/outbound-media-trust.js';
4
12
  export type { MediaRef, Segment };
13
+ /** Internal send binding retained by one inbound operation; never a wire/config field. */
14
+ export declare const operationEndpoint: unique symbol;
15
+ export interface OperationEndpointSource {
16
+ readonly [operationEndpoint]?: EndpointChildLease;
17
+ }
18
+ /** Capture while the source Message/event is active, before handing work to an asynchronous owner. */
19
+ export interface CaptureEndpointOperationInput {
20
+ /** Canonical complete source address; never an account alias. */
21
+ readonly target: ConversationRef;
22
+ /** Actual source Client, checked against the selected account incarnation. */
23
+ readonly client: unknown;
24
+ /** Lifetime of the work that is retaining the source operation. */
25
+ readonly signal?: AbortSignal;
26
+ /** Author supplied by trusted composition or the owner-bound Host facade. */
27
+ readonly requester?: PluginId;
28
+ }
29
+ /** Retained execution authority for one concrete Client; consumers must release it in finally. */
30
+ export interface CapturedEndpointOperation {
31
+ readonly target: ConversationRef;
32
+ readonly signal: AbortSignal;
33
+ /** The same guarded semantic ports as ordinary calls, pinned to the retained Client. */
34
+ readonly control?: EndpointControl;
35
+ readonly management?: EndpointManagement;
36
+ /** Current account facts and approved mutations, under the same retained operation. */
37
+ readonly profile?: SelfProfilePort;
38
+ /** Uses the ordinary renderer/middleware/delivery pipeline with the captured author. */
39
+ send(content: SendContent, options?: Readonly<{
40
+ locale?: Locale;
41
+ signal?: AbortSignal;
42
+ }>): Promise<DeliveryReceipt>;
43
+ openReplyStream?(options?: OpenReplyStreamOptions): CoreReplyStream | undefined;
44
+ /** Stops new calls and releases source/Root leases after accepted calls drain; never stops the account. */
45
+ release(): void;
46
+ }
47
+ /** Core-only trusted operation binding; never read from message metadata. */
48
+ export declare const interactionOperationScope: unique symbol;
49
+ export interface InteractionOperationScope {
50
+ readonly snapshot: RuntimeSnapshot;
51
+ readonly owner: PluginId;
52
+ /** Explicit stop/source/caller lifetime; not an HMR replacement notification. */
53
+ readonly signal?: AbortSignal;
54
+ /** Pin one actual source Client and independently owned snapshot until the question settles. */
55
+ readonly retain?: () => CapturedEndpointOperation;
56
+ }
57
+ /** Trusted composition port. Only Core supplies the controlled message and real held lease. */
58
+ export interface ImOperationResourcesInput {
59
+ readonly lease: SnapshotLease;
60
+ readonly snapshots: SnapshotReader;
61
+ readonly message: RuntimeMessage;
62
+ readonly owner: PluginId;
63
+ readonly signal: AbortSignal;
64
+ }
65
+ export interface ImOperationResourcesPort {
66
+ open(input: ImOperationResourcesInput): OperationResourceView | undefined;
67
+ }
68
+ export declare const imOperationResourcesToken: import("@zhin.js/plugin-runtime").Token<ImOperationResourcesPort>;
5
69
  declare const componentCallBrand: "zhin.component-call/1";
6
70
  declare const rawContentBrand: "zhin.raw-content/1";
71
+ declare const untrustedContentBrand: "zhin.untrusted-content/1";
7
72
  export interface ComponentCall<TProps = unknown> {
8
73
  readonly $content: typeof componentCallBrand;
9
74
  readonly name: string;
@@ -13,23 +78,48 @@ export interface RawContent<TPayload = unknown> {
13
78
  readonly $content: typeof rawContentBrand;
14
79
  readonly payload: TPayload;
15
80
  }
81
+ /**
82
+ * Content whose media does not come from plugin code: Agent model output, or values a user controls.
83
+ * The renderer holds its media to the untrusted-source policy (`built/outbound-media-trust.ts`) before
84
+ * outbound middleware and the Endpoint see it; its text is never template-compiled.
85
+ */
86
+ export interface UntrustedContent {
87
+ readonly $content: typeof untrustedContentBrand;
88
+ readonly content: SendContent;
89
+ readonly trust: OutboundMediaTrust;
90
+ }
16
91
  /**
17
92
  * 出站内容:纯文本 / canonical Segment(一等公民,媒体与富文本的统一表达)/
18
- * ComponentCall / RawContent,可任意嵌套数组。
93
+ * 惰性 JSXElement / ComponentCall / RawContent / UntrustedContent,可任意嵌套数组。
19
94
  */
20
- export type SendContent = string | Segment | ComponentCall | RawContent | readonly SendContent[];
95
+ export type SendContent = string | Segment | JSXElement | ComponentCall | RawContent | UntrustedContent | readonly SendContent[];
96
+ /**
97
+ * Mark content as coming from an untrusted source (ADR 0056 §2): its media may only be http(s) URLs,
98
+ * bounded inline data, platform file tokens, or local paths that `trust.authorizePath` admits (or that
99
+ * trusted code built with {@link trustedMediaRef}). Anything else is replaced by a visible notice and logged.
100
+ */
101
+ export declare function untrustedContent(content: SendContent, trust: OutboundMediaTrust): UntrustedContent;
102
+ export declare function isUntrustedContent(value: unknown): value is UntrustedContent;
21
103
  export declare function component<TProps>(name: string, props: TProps): ComponentCall<TProps>;
22
104
  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;
105
+ export declare function isComponentCall(value: unknown): value is ComponentCall;
106
+ export declare function isRawContent(value: unknown): value is RawContent;
25
107
  /** canonical Segment 一等公民判定(与 ComponentCall/RawContent 的 $content brand 互斥)。 */
26
108
  export declare function isSegmentContent(value: unknown): value is Segment;
27
109
  export interface MessageSenderRef {
28
110
  readonly id: string;
29
111
  readonly name?: string;
30
- readonly roles?: readonly string[];
112
+ /** Normalized platform standing (ADR 0056 §1); the Runtime drops it in private chats. */
113
+ readonly platform?: PlatformStanding;
114
+ /** Highest zhin chat role effective in this conversation (ADR 0056 §2). Set by the Runtime only. */
115
+ readonly chatRole?: ChatRole;
116
+ /** Per role, the topmost level it is held at on this conversation's chain. Set by the Runtime only. */
117
+ readonly chatRoleLevels?: ChatRoleLevels;
31
118
  }
32
119
  export interface IncomingMessage {
120
+ /** Original SDK message callback object; operation-only, not a persistence field. */
121
+ readonly event?: unknown;
122
+ readonly platformSentAt?: number;
33
123
  readonly conversation: ConversationRef;
34
124
  readonly message?: MessageRef;
35
125
  readonly content: string;
@@ -64,7 +154,9 @@ export interface IncomingContext {
64
154
  /** 消息是否 @了机器人。 */
65
155
  readonly mentioned?: boolean;
66
156
  }
67
- export interface SendRequest {
157
+ export interface SendRequest extends OperationEndpointSource {
158
+ /** Language captured by the sending operation; absent for explicit sends without a user. */
159
+ readonly locale?: Locale;
68
160
  readonly conversation: ConversationRef;
69
161
  readonly requester: PluginId;
70
162
  readonly content: SendContent;
@@ -99,43 +191,134 @@ export interface OutboundMessageService {
99
191
  }
100
192
  export interface MessageDispatchResult {
101
193
  readonly matched: boolean;
194
+ readonly status?: 'unmatched' | 'invalid' | 'denied' | 'limited' | 'executed';
195
+ readonly limit?: import('@zhin.js/command').CommandExecutionLimit;
196
+ readonly issues?: readonly Readonly<{
197
+ field: string;
198
+ message: string;
199
+ }>[];
200
+ readonly help?: string;
102
201
  readonly command?: string;
103
202
  readonly owner?: PluginId;
104
203
  readonly value?: unknown;
204
+ readonly menu?: CommandMenuPage;
105
205
  }
106
- export declare class Message {
107
- #private;
108
- readonly conversation: ConversationRef;
109
- readonly content: string;
206
+ /** Canonical message value delivered to inbound middleware and handlers. */
207
+ export interface MessageBase extends Omit<IncomingMessage, 'event' | 'platformSentAt'> {
208
+ /** Language resolved from the sender and project when this operation began. */
209
+ readonly locale: Locale;
210
+ /** Effective chat command environment; undefined means no resolved environment. */
211
+ readonly commandPrefix?: string;
212
+ readonly commandMenu?: string;
213
+ /** Read-only reference to an installed command, using this operation's actual prefix. */
214
+ formatCommand(localPath: string, owner?: PluginId): string | undefined;
110
215
  readonly generation: number;
111
- readonly sender?: MessageSenderRef | undefined;
112
216
  readonly metadata: Readonly<Record<string, unknown>>;
217
+ readonly id?: string;
218
+ readonly clientAdapter?: string;
113
219
  /**
114
- * 结构化段视图(与 `content` 纯文本视图同源,见 IncomingMessage.segments)。
115
- * Command dispatcher 优先使用此字段,以支持 mention、image 等结构化参数。
220
+ * 入站来源(self / member / peer_bot / human),仅由 InboundRuntime 可信判定写入;
221
+ * 合成消息(Console / Sandbox / 定时任务)为 undefined。绝不从 metadata / 正文读取。
116
222
  */
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;
223
+ readonly origin?: MessageOrigin;
224
+ readonly $client: unknown;
225
+ readonly $reply: (content: SendContent) => Promise<DeliveryReceipt>;
226
+ readonly $replyFrom: (requester: PluginId, content: SendContent) => Promise<DeliveryReceipt>;
227
+ readonly $sendTo: (conversation: ConversationAddress, content: SendContent) => Promise<DeliveryReceipt>;
228
+ readonly $replyToPrivate: (content: SendContent, from?: boolean | {
229
+ readonly kind: 'group' | 'channel';
230
+ readonly id: string;
231
+ }) => Promise<DeliveryReceipt>;
232
+ readonly $replyToGroup: (groupId: string, content: SendContent) => Promise<DeliveryReceipt>;
233
+ readonly $replyToChannel: (channelId: string, guildId: string, content: SendContent, threadId?: string) => Promise<DeliveryReceipt>;
234
+ }
235
+ /** Captured once from the actual inbound Endpoint operation, never from message metadata. */
236
+ export type RuntimeMessageSessionBinding = Omit<OperationSession<string>, 'reply'>;
237
+ /** Immutable facts shared by every author-bound view of one received message. */
238
+ export interface RuntimeMessageFacts {
239
+ readonly conversation: ConversationRef;
240
+ readonly content: string;
241
+ readonly sender?: MessageSenderRef;
242
+ readonly metadata?: Readonly<Record<string, unknown>>;
243
+ readonly segments?: readonly Segment[];
244
+ readonly message?: MessageRef;
245
+ readonly endpointId?: string;
246
+ readonly mentioned?: boolean;
122
247
  readonly replyTo?: {
123
248
  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?: {
249
+ };
250
+ }
251
+ /** Presentation resolved for an author view without changing its transport identity. */
252
+ export interface RuntimeMessagePresentation {
253
+ readonly locale?: Locale;
254
+ readonly commands?: Readonly<{
255
+ prefix: string;
256
+ menu?: string;
257
+ }>;
258
+ readonly resolveCommands?: (message: RuntimeMessage) => Readonly<{
259
+ prefix: string;
260
+ menu?: string;
261
+ }>;
262
+ }
263
+ /** Captured execution authority; its callbacks delegate to Core's existing operation lease. */
264
+ export interface RuntimeMessageOperation {
265
+ readonly generation: number;
266
+ readonly reply: (content: SendContent, requester?: PluginId, targetConversation?: ConversationAddress) => Promise<DeliveryReceipt>;
267
+ readonly client?: () => unknown;
268
+ readonly clientAdapter?: string;
269
+ readonly requester?: PluginId;
270
+ readonly snapshot?: RuntimeSnapshot;
271
+ readonly assertActive?: () => void;
272
+ readonly origin?: MessageOrigin;
273
+ /** Explicit Root stop, source-account and caller lifetime, never generation replacement alone. */
274
+ readonly signal?: AbortSignal;
275
+ readonly captureInteraction?: (owner: PluginId) => CapturedEndpointOperation;
276
+ readonly session?: RuntimeMessageSessionBinding;
277
+ readonly createOperationResources?: (input: Readonly<{
278
+ message: RuntimeMessage;
279
+ owner: PluginId;
280
+ signal: AbortSignal;
281
+ }>) => OperationResourceView | undefined;
282
+ readonly registerOperationView?: (view: object, owner: PluginId) => void;
283
+ readonly presentation?: RuntimeMessagePresentation;
284
+ }
285
+ /** Canonical runtime message with optional plugin-owned extensions. */
286
+ export type Message<T extends object = {}> = MessageBase & T;
287
+ /** @internal Generation-scoped implementation of the public Message contract. */
288
+ export declare class RuntimeMessage implements MessageBase {
289
+ #private;
290
+ readonly locale: Locale;
291
+ readonly commandPrefix?: string;
292
+ readonly commandMenu?: string;
293
+ readonly conversation: ConversationRef;
294
+ readonly content: string;
295
+ readonly generation: number;
296
+ readonly sender?: MessageSenderRef;
297
+ readonly metadata: Readonly<Record<string, unknown>>;
298
+ readonly segments?: readonly Segment[];
299
+ readonly message?: MessageRef;
300
+ readonly endpointId?: string;
301
+ readonly mentioned?: boolean;
302
+ readonly replyTo?: {
135
303
  readonly id: string;
136
- } | undefined, client?: () => unknown, clientAdapter?: string | undefined);
304
+ };
305
+ readonly clientAdapter?: string;
306
+ readonly origin?: MessageOrigin;
307
+ /** Core owns these immutable facts; author rebinding shares them and the captured operation. */
308
+ constructor(facts: RuntimeMessageFacts, operation: RuntimeMessageOperation);
309
+ /** The same captured data, with reply authority rebound by operationInputBinding. */
310
+ [operationSession](): OperationSession<string> | undefined;
311
+ /** @internal A frozen view whose sends retain the current author's exact operation. */
312
+ [operationInputBinding](owner: PluginId, snapshot: RuntimeSnapshot): RuntimeMessage;
313
+ /** @internal Metadata fields cannot replace this actual leased operation factory. */
314
+ [operationInputResources](snapshot: RuntimeSnapshot): CapabilityOperationFactory | undefined;
315
+ /** @internal Explicit operation cancellation; replacement alone does not end accepted work. */
316
+ [operationInputSignal](): AbortSignal | undefined;
317
+ /** @internal The command/handler author's actual leased operation. */
318
+ [interactionOperationScope](): InteractionOperationScope | undefined;
137
319
  /** 平台原生消息 id(`message` 未提供时为 undefined)。 */
138
320
  get id(): string | undefined;
321
+ formatCommand(localPath: string, owner?: PluginId): string | undefined;
139
322
  readonly $reply: (content: SendContent) => Promise<DeliveryReceipt>;
140
323
  /**
141
324
  * Platform-native Client that received this message. The getter is
@@ -188,4 +371,6 @@ export declare class Message {
188
371
  */
189
372
  readonly $replyToChannel: (channelId: string, guildId: string, content: SendContent, threadId?: string) => Promise<DeliveryReceipt>;
190
373
  }
374
+ /** Constructor for canonical runtime Message values. */
375
+ export declare const Message: typeof RuntimeMessage;
191
376
  export declare function createOutboundEnvelope(request: Omit<OutboundEnvelope, 'payload' | '$client' | 'replace'>, initialPayload: unknown, resolveClient?: () => unknown): OutboundEnvelope;