@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,501 @@
1
+ import { isDeepStrictEqual } from 'node:util';
2
+ import { createEndpointOperation } from '@zhin.js/adapter';
3
+ import { EndpointDeliveryError, isMediaRef } from '@zhin.js/im-contract';
4
+ import { untrustedContent } from './contracts.js';
5
+ import { receiptFromEndpointError } from './outbound-delivery-runtime.js';
6
+ /** One producer, one sending pump, and one replaceable candidate rather than a queue per token. */
7
+ export function createCoreReplyStream(context) {
8
+ const cancellation = new AbortController();
9
+ const signal = AbortSignal.any([context.endpoint.signal, cancellation.signal]);
10
+ const groups = new Map();
11
+ const confirmed = new Map();
12
+ const maxBufferedBytes = context.options.maxBufferedBytes ?? 1024 * 1024;
13
+ let receipt = { status: 'suppressed' };
14
+ let failure;
15
+ let pending, pumping, terminal;
16
+ let revision = -1, cancelled = false, finished = false, settled = false, released = false, submitted = false, lastSubmission = 0;
17
+ const parts = () => [...confirmed.values()].map(part => ({ ...(part.message ? { message: part.message } : {}) }));
18
+ const decorate = (value) => ({ ...value, ...(parts().length ? { parts: parts(), message: parts().find(part => part.message)?.message } : {}) });
19
+ const release = () => {
20
+ if (released)
21
+ return;
22
+ released = true;
23
+ context.endpoint.signal.removeEventListener('abort', onAbort);
24
+ context.release();
25
+ };
26
+ const fail = (value) => {
27
+ if (failure)
28
+ return;
29
+ failure = value;
30
+ receipt = decorate(value);
31
+ pending = undefined;
32
+ // Local teardown cannot replace the original delivery evidence or prevent cancellation.
33
+ for (const state of groups.values()) {
34
+ try {
35
+ state.physical?.native.cancel();
36
+ }
37
+ catch { /* No external operation is retried. */ }
38
+ }
39
+ };
40
+ const remember = (key, part, content) => {
41
+ confirmed.set(key, Object.freeze({ key, segments: content ?? [], ...(part.message ? { message: part.message } : {}) }));
42
+ };
43
+ const prepareSegments = (segments) => context.options.prepare
44
+ ? createEndpointOperation({ signal }).prepare(() => context.options.prepare(segments, signal)) : Promise.resolve(segments);
45
+ const mediaTrust = context.options.mediaTrust;
46
+ const prepare = async (segments) => {
47
+ const prepared = await prepareSegments(segments);
48
+ return mediaTrust ? untrustedContent([...prepared], mediaTrust) : prepared;
49
+ };
50
+ const wait = async () => {
51
+ if (!lastSubmission)
52
+ return;
53
+ for (;;) {
54
+ const remaining = (context.streaming.minIntervalMs ?? 0) - (Date.now() - lastSubmission);
55
+ if (remaining <= 0)
56
+ return;
57
+ await new Promise((resolve, reject) => {
58
+ // Node clamps larger delays to 1 ms; keep the original deadline across timer chunks.
59
+ const timer = setTimeout(done, Math.min(remaining, 2_147_483_647));
60
+ function done() { signal.removeEventListener('abort', abort); resolve(); }
61
+ function abort() { clearTimeout(timer); signal.removeEventListener('abort', abort); reject(new EndpointDeliveryError('endpoint_inactive', 'Reply stream ended', 'not_sent')); }
62
+ signal.addEventListener('abort', abort, { once: true });
63
+ if (signal.aborted)
64
+ abort();
65
+ });
66
+ }
67
+ };
68
+ const external = async (call) => {
69
+ await wait();
70
+ signal.throwIfAborted();
71
+ context.endpoint.assertActive();
72
+ context.options.beforeSubmit?.();
73
+ lastSubmission = Date.now();
74
+ submitted = true;
75
+ try {
76
+ return await createEndpointOperation({ signal }).run(call);
77
+ }
78
+ finally {
79
+ submitted = false;
80
+ }
81
+ };
82
+ const finishPhysical = async (physical, text, conversation) => {
83
+ try {
84
+ return { ack: await external(() => physical.native.finish(text)) };
85
+ }
86
+ catch (error) {
87
+ let ack;
88
+ try {
89
+ ack = physical.native.lastAcknowledgement;
90
+ }
91
+ catch { /* A local inspection must preserve the original close error. */ }
92
+ if (!ack || ack.status !== 'sent' || typeof ack.messageId !== 'string' || !ack.messageId.trim() || typeof ack.acceptedText !== 'string'
93
+ || !text.startsWith(ack.acceptedText) || !ack.acceptedText.startsWith(physical.accepted)
94
+ || physical.message && (ack.messageId !== physical.message.id || ack.acceptedText === physical.accepted))
95
+ throw error;
96
+ // Persist a verified body update through normal delivery, while keeping the close failure terminal.
97
+ return { ack, failure: receiptFromEndpointError(error, true, conversation) };
98
+ }
99
+ };
100
+ const sendAtomic = async (group, state) => {
101
+ if (!group.complete || state.done)
102
+ return;
103
+ const content = await prepare(group.segments);
104
+ let index = 0;
105
+ const result = await context.deliver(content, {
106
+ send: async (request) => ({ result: await external(() => context.endpoint.send({ ...request, signal })) }),
107
+ history: () => 'create', confirmed: (part, value) => remember(`${group.key}/${index++}`, part, value),
108
+ });
109
+ if (result.status !== 'sent') {
110
+ fail(result);
111
+ return;
112
+ }
113
+ state.done = true;
114
+ receipt = decorate(failure ?? { status: 'sent' });
115
+ };
116
+ const sendText = async (group, state) => {
117
+ if (state.done)
118
+ return;
119
+ const prepared = await prepare(group.segments);
120
+ let continueContainer = true;
121
+ while (continueContainer && !cancelled && !failure) {
122
+ continueContainer = false;
123
+ let ack;
124
+ let closeFailure;
125
+ let history = 'skip';
126
+ let physicalKey = `${group.key}/${state.containers}`;
127
+ let confirmedPart = 0;
128
+ let renderedLength = state.consumed;
129
+ const result = await context.deliver(prepared, {
130
+ send: async (request) => {
131
+ const projection = streamText(request.payload);
132
+ if (!projection)
133
+ throw new EndpointDeliveryError('unsupported_stream_payload', 'Incremental middleware produced an incompatible message', 'rejected');
134
+ const full = projection.text;
135
+ renderedLength = full.length;
136
+ if (!full.startsWith(state.accepted))
137
+ throw new EndpointDeliveryError('stream_prefix_changed', 'A published source prefix cannot be rewritten', 'rejected');
138
+ if (!state.physical && state.consumed === full.length && state.consumed > 0) {
139
+ state.done = group.complete;
140
+ ack = { status: 'buffered', acceptedText: '' };
141
+ return {};
142
+ }
143
+ if (state.unsupported) {
144
+ ack = { status: 'buffered', acceptedText: '' };
145
+ if (!group.complete)
146
+ return {};
147
+ history = 'create';
148
+ state.done = true;
149
+ return { result: await external(() => context.endpoint.send({ ...request, signal })) };
150
+ }
151
+ const originOffset = state.consumed;
152
+ const remaining = full.slice(originOffset);
153
+ const prefix = state.consumed ? [] : projection.prefix;
154
+ const prefixKey = JSON.stringify(prefix);
155
+ if (!state.physical) {
156
+ if (!state.consumed) {
157
+ const reply = projection.prefix.find(segment => segment.type === 'reply');
158
+ const data = reply?.data;
159
+ state.replyTo = typeof data?.message_id === 'string' ? data.message_id : undefined;
160
+ }
161
+ const native = context.streaming.open({ conversation: request.conversation, format: projection.format,
162
+ prefix, source: context.options.source, locale: request.locale, signal,
163
+ ...(state.consumed ? { continuation: { precedingText: full.slice(0, state.consumed),
164
+ ...(state.replyTo ? { replyTo: state.replyTo } : {}) } } : {}),
165
+ });
166
+ if (!native) {
167
+ if (state.consumed)
168
+ throw new EndpointDeliveryError('stream_continuation_unsupported', 'A confirmed reply cannot fall back by replaying its source prefix', 'not_sent');
169
+ state.unsupported = true;
170
+ ack = { status: 'buffered', acceptedText: '' };
171
+ if (!group.complete)
172
+ return {};
173
+ history = 'create';
174
+ state.done = true;
175
+ return { result: await external(() => context.endpoint.send({ ...request, signal })) };
176
+ }
177
+ state.physical = { key: physicalKey, native, format: projection.format, prefixKey, accepted: '', revision: 0, closed: false };
178
+ }
179
+ const physical = state.physical;
180
+ if (physical.format !== projection.format || physical.prefixKey !== prefixKey) {
181
+ throw new EndpointDeliveryError('stream_projection_changed', 'A physical stream cannot change its format or addressing prefix', 'rejected');
182
+ }
183
+ physicalKey = physical.key;
184
+ const close = group.complete;
185
+ const text = remaining;
186
+ if (!close && text === physical.accepted) {
187
+ ack = { status: 'buffered', acceptedText: physical.accepted };
188
+ return {};
189
+ }
190
+ if (close) {
191
+ const completed = await finishPhysical(physical, text, request.conversation);
192
+ ack = completed.ack;
193
+ closeFailure = completed.failure;
194
+ }
195
+ else
196
+ ack = await external(() => physical.native.write(text));
197
+ if (!text.startsWith(ack.acceptedText) || !ack.acceptedText.startsWith(physical.accepted)) {
198
+ throw new EndpointDeliveryError('stream_ack_invalid', 'Endpoint returned an invalid confirmed prefix', 'unknown');
199
+ }
200
+ if (ack.status === 'buffered' && ack.acceptedText !== physical.accepted) {
201
+ throw new EndpointDeliveryError('stream_ack_invalid', 'A buffered update cannot confirm new content', 'unknown');
202
+ }
203
+ if (ack.status === 'sent' && !ack.messageId?.trim())
204
+ throw new EndpointDeliveryError('delivery_unconfirmed', 'Stream returned no confirmed message identity', 'unknown');
205
+ if (ack.status === 'sent' && physical.message && physical.message.id !== ack.messageId) {
206
+ throw new EndpointDeliveryError('stream_identity_changed', 'A physical stream changed its message identity', 'unknown');
207
+ }
208
+ if (close && ack.status !== 'sent')
209
+ throw new EndpointDeliveryError('delivery_unconfirmed', 'Final reply was not confirmed as a saved message', 'unknown');
210
+ physical.accepted = ack.acceptedText;
211
+ state.accepted = full.slice(0, state.consumed) + ack.acceptedText;
212
+ if (ack.status === 'sent') {
213
+ history = physical.message ? { revision: physical.revision + 1 } : 'create';
214
+ physical.revision += 1;
215
+ physical.message = { conversation: request.conversation, id: ack.messageId };
216
+ }
217
+ if (!closeFailure && close && !ack.exhausted && ack.acceptedText === text) {
218
+ physical.closed = true;
219
+ state.consumed += ack.acceptedText.length;
220
+ state.physical = undefined;
221
+ state.containers += 1;
222
+ state.done = group.complete && state.consumed === full.length;
223
+ }
224
+ else if (!closeFailure && ack.exhausted) {
225
+ if (!ack.acceptedText.length)
226
+ throw new EndpointDeliveryError('stream_capacity_exhausted', 'No source progress is possible in this container', 'not_sent');
227
+ if (close) {
228
+ physical.closed = true;
229
+ state.consumed += ack.acceptedText.length;
230
+ state.physical = undefined;
231
+ state.containers += 1;
232
+ state.done = group.complete && state.consumed === full.length;
233
+ }
234
+ continueContainer = !state.done;
235
+ }
236
+ const confirmedContent = [...(originOffset ? [] : projection.prefix),
237
+ projection.format === 'text' ? { type: 'text', data: { text: ack.acceptedText } }
238
+ : { type: 'markdown', data: { content: ack.acceptedText } }];
239
+ return ack.status === 'sent' ? { result: ack.messageId,
240
+ ...(ack.contentUnavailable || !ack.confirmedContent && projection.format === 'markdown' && (originOffset > 0 || ack.exhausted)
241
+ ? { contentUnavailable: true }
242
+ : { confirmedContent: ack.confirmedContent ?? confirmedContent }),
243
+ } : {};
244
+ },
245
+ history: () => history,
246
+ confirmed: (part, value) => remember(confirmedPart++ ? `${physicalKey}/${confirmedPart}` : physicalKey, part, value),
247
+ });
248
+ if (closeFailure) {
249
+ fail(closeFailure);
250
+ return;
251
+ }
252
+ if (result.status !== 'sent' && (!ack || result.failure)) {
253
+ fail(result);
254
+ return;
255
+ }
256
+ if (result.status === 'sent')
257
+ receipt = decorate(failure ?? { status: 'sent' });
258
+ if (ack?.exhausted && state.physical && !state.physical.closed) {
259
+ // Finish this exact accepted prefix before attempting another physical container.
260
+ const physical = state.physical;
261
+ const body = physical.accepted;
262
+ const result = await context.deliver(prepared, {
263
+ send: async (request) => {
264
+ const projection = streamText(request.payload);
265
+ if (!projection)
266
+ throw new EndpointDeliveryError('unsupported_stream_payload', 'Cannot close transformed reply', 'rejected');
267
+ if (!projection.text.startsWith(state.accepted) || projection.format !== physical.format
268
+ || JSON.stringify(state.consumed ? [] : projection.prefix) !== physical.prefixKey) {
269
+ throw new EndpointDeliveryError('stream_projection_changed', 'Container completion changed previously accepted content or addressing', 'rejected');
270
+ }
271
+ const completed = await finishPhysical(physical, body, request.conversation);
272
+ const end = completed.ack;
273
+ closeFailure = completed.failure;
274
+ if (end.acceptedText !== body || end.status !== 'sent' || !end.messageId)
275
+ throw new EndpointDeliveryError('delivery_unconfirmed', 'Container completion is unconfirmed', 'unknown');
276
+ if (physical.message && end.messageId !== physical.message.id)
277
+ throw new EndpointDeliveryError('stream_identity_changed', 'Container completion changed its message identity', 'unknown');
278
+ return { result: end.messageId,
279
+ ...(end.contentUnavailable || !end.confirmedContent && projection.format === 'markdown'
280
+ ? { contentUnavailable: true }
281
+ : { confirmedContent: end.confirmedContent ?? [...(state.consumed ? [] : projection.prefix),
282
+ projection.format === 'text' ? { type: 'text', data: { text: body } } : { type: 'markdown', data: { content: body } }] }),
283
+ };
284
+ },
285
+ history: () => physical.message ? { revision: physical.revision + 1 } : 'create',
286
+ confirmed: (part, value) => remember(physical.key, part, value),
287
+ });
288
+ if (closeFailure) {
289
+ fail(closeFailure);
290
+ return;
291
+ }
292
+ if (result.status !== 'sent') {
293
+ fail(result);
294
+ return;
295
+ }
296
+ receipt = decorate({ status: 'sent' });
297
+ physical.closed = true;
298
+ state.consumed += body.length;
299
+ state.physical = undefined;
300
+ state.containers += 1;
301
+ state.done = group.complete && state.consumed === renderedLength;
302
+ continueContainer = state.consumed < renderedLength;
303
+ }
304
+ }
305
+ };
306
+ const pump = async () => {
307
+ try {
308
+ while (pending && !cancelled && !failure) {
309
+ await wait();
310
+ if (cancelled)
311
+ break;
312
+ const current = pending;
313
+ pending = undefined;
314
+ const candidates = replyGroups(current);
315
+ // Validate the entire published prefix before a newly inserted group can submit anything.
316
+ for (const state of groups.values()) {
317
+ if (!state.committed)
318
+ continue;
319
+ const { position, source } = state.committed, candidate = candidates[position];
320
+ if (!candidate || candidate.key !== source.key || candidate.format !== source.format
321
+ || state.done && !isDeepStrictEqual(candidate.segments, source.segments)) {
322
+ throw new EndpointDeliveryError('stream_prefix_changed', 'A published reply group cannot be rewritten, removed or reordered', 'rejected');
323
+ }
324
+ }
325
+ for (const [position, group] of candidates.entries()) {
326
+ if (cancelled || failure)
327
+ break;
328
+ const state = groups.get(group.key) ?? { consumed: 0, containers: 0, accepted: '' };
329
+ groups.set(group.key, state);
330
+ if (group.format)
331
+ await sendText(group, state);
332
+ else
333
+ await sendAtomic(group, state);
334
+ if (state.done || state.physical)
335
+ state.committed = { position, source: group };
336
+ if (!group.complete)
337
+ break;
338
+ }
339
+ }
340
+ }
341
+ catch (error) {
342
+ if (!cancelled)
343
+ fail(receiptFromEndpointError(error, submitted));
344
+ }
345
+ finally {
346
+ pumping = undefined;
347
+ if (cancelled || finished || failure)
348
+ release();
349
+ else if (pending)
350
+ start();
351
+ }
352
+ };
353
+ const start = () => { pumping ??= pump(); };
354
+ const admit = (snapshot) => {
355
+ if (semanticSnapshotBytes(snapshot) > maxBufferedBytes) {
356
+ fail({ status: 'failed', failure: { code: 'stream_buffer_limit', message: 'Reply snapshot exceeds the configured resource limit', retryable: false,
357
+ ...(submitted ? { deliveryUnknown: true } : {}) } });
358
+ cancellation.abort();
359
+ if (!pumping)
360
+ release();
361
+ return;
362
+ }
363
+ revision = snapshot.revision;
364
+ pending = snapshot;
365
+ start();
366
+ };
367
+ const update = (snapshot) => {
368
+ if (cancelled || finished || failure || snapshot.revision <= revision)
369
+ return;
370
+ admit(snapshot);
371
+ };
372
+ const cancel = () => {
373
+ if (settled)
374
+ return terminal ?? Promise.resolve(receipt);
375
+ if (!cancelled) {
376
+ cancelled = true;
377
+ pending = undefined;
378
+ fail({ status: 'failed', failure: { code: 'cancelled', message: 'Reply stream cancelled', retryable: false,
379
+ ...(submitted ? { deliveryUnknown: true } : {}) } });
380
+ cancellation.abort();
381
+ release();
382
+ }
383
+ return Promise.resolve(receipt);
384
+ };
385
+ const onAbort = () => { void cancel(); };
386
+ context.endpoint.signal.addEventListener('abort', onAbort, { once: true });
387
+ if (context.endpoint.signal.aborted)
388
+ void cancel();
389
+ return Object.freeze({
390
+ minIntervalMs: context.streaming.minIntervalMs,
391
+ get receipt() { return receipt; }, get confirmed() { return Object.freeze([...confirmed.values()]); },
392
+ update,
393
+ finish(snapshot) {
394
+ if (terminal)
395
+ return terminal;
396
+ if (cancelled || failure)
397
+ return Promise.resolve(receipt);
398
+ if (snapshot.messages.some(message => !message.complete || message.segments.some(segment => !segment.complete))) {
399
+ fail({ status: 'failed', failure: { code: 'incomplete_reply', message: 'Final reply contains incomplete content', retryable: false,
400
+ ...(submitted ? { deliveryUnknown: true } : {}) } });
401
+ cancellation.abort();
402
+ finished = true;
403
+ settled = true;
404
+ release();
405
+ return Promise.resolve(receipt);
406
+ }
407
+ if (snapshot.revision >= revision)
408
+ admit(snapshot);
409
+ finished = true;
410
+ terminal = (async () => {
411
+ await pumping;
412
+ if (!failure && pending) {
413
+ start();
414
+ await pumping;
415
+ }
416
+ for (const state of groups.values())
417
+ if (!failure && !state.done && state.physical) {
418
+ fail({ status: 'failed', failure: { code: 'incomplete_reply', message: 'Final reply did not close all content', retryable: false } });
419
+ break;
420
+ }
421
+ settled = true;
422
+ release();
423
+ return decorate(receipt);
424
+ })();
425
+ return terminal;
426
+ }, cancel,
427
+ });
428
+ }
429
+ function semanticSnapshotBytes(snapshot) {
430
+ return Buffer.byteLength(JSON.stringify(snapshot, (key, value) => key === 'media' && isMediaRef(value)
431
+ && (value.kind === 'base64' || value.value.startsWith('data:')) ? { ...value, value: '[inline media]' } : value));
432
+ }
433
+ function streamText(payload) {
434
+ const segments = typeof payload === 'string' ? [{ type: 'text', data: { text: payload } }]
435
+ : Array.isArray(payload) ? payload : [];
436
+ const prefix = [], text = [];
437
+ let format;
438
+ for (const segment of segments) {
439
+ if (!format && (segment.type === 'reply' || segment.type === 'mention')) {
440
+ prefix.push(segment);
441
+ continue;
442
+ }
443
+ if (segment.type !== 'text' && segment.type !== 'markdown' || format && format !== segment.type)
444
+ return undefined;
445
+ format = segment.type;
446
+ const data = segment.data;
447
+ const value = segment.type === 'text' ? data.text : data.content;
448
+ if (typeof value !== 'string')
449
+ return undefined;
450
+ text.push(value);
451
+ }
452
+ return format ? { format, text: text.join(''), prefix } : undefined;
453
+ }
454
+ function replyGroups(snapshot) {
455
+ const groups = [];
456
+ for (const message of snapshot.messages) {
457
+ // Rendered buttons are canonical keyboards and must remain attached to their logical body.
458
+ if (message.segments.some(segment => segment.value.type === 'keyboard')) {
459
+ const complete = message.complete && message.segments.every(segment => segment.complete);
460
+ groups.push({ key: `${message.key}/interactive`, segments: message.segments.map(segment => segment.value), complete });
461
+ if (!complete)
462
+ break;
463
+ continue;
464
+ }
465
+ let prefix = [], current;
466
+ const flush = (closed) => { if (current) {
467
+ groups.push({ ...current, complete: closed && current.complete });
468
+ current = undefined;
469
+ } };
470
+ for (const segment of message.segments) {
471
+ const value = segment.value;
472
+ if (value.type === 'text' || value.type === 'markdown') {
473
+ if (current && current.format !== value.type)
474
+ flush(true);
475
+ current ??= { key: `${message.key}/${segment.key}`, segments: prefix, format: value.type, complete: true };
476
+ prefix = [];
477
+ current.segments.push(value);
478
+ current.complete &&= segment.complete;
479
+ }
480
+ else {
481
+ flush(true);
482
+ if (value.type === 'mention' || value.type === 'reply')
483
+ prefix.push(value);
484
+ else {
485
+ groups.push({ key: `${message.key}/${segment.key}`, segments: [...prefix, value], complete: segment.complete });
486
+ prefix = [];
487
+ }
488
+ }
489
+ if (!segment.complete) {
490
+ flush(false);
491
+ return groups;
492
+ }
493
+ }
494
+ flush(message.complete);
495
+ if (prefix.length && message.complete)
496
+ groups.push({ key: `${message.key}/prefix`, segments: prefix, complete: true });
497
+ if (!message.complete)
498
+ break;
499
+ }
500
+ return groups;
501
+ }
@@ -3,4 +3,4 @@
3
3
  * @module zhin.js/core/runtime
4
4
  */
5
5
  export { outboundMessageToken } from './im-runtime.js';
6
- export { Message, type ComponentCall, type ConversationAddress, type IncomingContext, type IncomingMessage, type MessageDispatchResult, type OutboundMessageService, type MessageSenderRef, type OutboundEnvelope, type RawContent, type SendContent, type SendRequest, } from './contracts.js';
6
+ export { Message, type MessageBase, type ComponentCall, type ConversationAddress, type IncomingContext, type IncomingMessage, type MessageDispatchResult, type OutboundMessageService, type MessageSenderRef, type OutboundEnvelope, type RawContent, type SendContent, type SendRequest, } from './contracts.js';
package/lib/request.d.ts CHANGED
@@ -1,41 +1,32 @@
1
- import type { MaybePromise } from './types.js';
2
- import type { Adapters } from './adapter.js';
3
- import type { RequestKind } from './side-event/types.js';
4
- import type { SideEventBase } from './side-event/base.js';
1
+ import type { MessageSenderRef } from './plugin-runtime/im/contracts.js';
2
+ import type { ComposedRequestName } from './side-event/types.js';
3
+ import { RuntimeSideEvent, type IncomingSideEvent, type SideEventBase, type EndpointEventContext } from './side-event/base.js';
5
4
  export type { RequestKind, ComposedRequestName } from './side-event/types.js';
6
- /**
7
- * 请求基础结构 — 继承 SideEventBase,附加审批方法。
8
- *
9
- * @example
10
- * ```typescript
11
- * const request = Request.from(rawEvent, {
12
- * $id: rawEvent.flag,
13
- * $adapter: 'icqq',
14
- * $endpoint: endpointKey,
15
- * $type: 'request',
16
- * $scene_id: groupId,
17
- * $scene_type: 'group',
18
- * $sub_type: 'invite',
19
- * $actor: { id: userId, name: '邀请者' },
20
- * $comment: '请求加群消息',
21
- * $timestamp: Date.now(),
22
- * $approve: async (remark?) => { await api.approve(flag, remark); },
23
- * $reject: async (reason?) => { await api.reject(flag, reason); },
24
- * });
25
- * // formatSideEventName(request) === 'request.group.invite'
26
- * this.adapter.emit('request.receive', request);
27
- * ```
28
- */
5
+ export interface IncomingRequest extends IncomingSideEvent {
6
+ readonly type: 'request';
7
+ readonly name: ComposedRequestName;
8
+ readonly actor: MessageSenderRef;
9
+ readonly comment?: string;
10
+ readonly $approve: (remark?: string) => void | Promise<void>;
11
+ readonly $reject: (reason?: string) => void | Promise<void>;
12
+ }
29
13
  export interface RequestBase extends SideEventBase {
30
- $adapter: keyof Adapters;
31
- $type: RequestKind;
32
- /** 主参与者(必填) */
33
- $actor: NonNullable<SideEventBase['$actor']>;
34
- $comment?: string;
35
- $approve(remark?: string): MaybePromise<void>;
36
- $reject(reason?: string): MaybePromise<void>;
14
+ readonly type: 'request';
15
+ readonly name: ComposedRequestName;
16
+ readonly actor: MessageSenderRef;
17
+ readonly comment?: string;
18
+ readonly $approve: (remark?: string) => Promise<void>;
19
+ readonly $reject: (reason?: string) => Promise<void>;
37
20
  }
38
21
  export type Request<T extends object = {}> = RequestBase & T;
39
- export declare namespace Request {
40
- function from<T extends object>(input: T, format: RequestBase): Request<T>;
22
+ /** @internal Actions are bound by the ingress operation, never retained across generations. */
23
+ export declare class RuntimeRequest extends RuntimeSideEvent implements RequestBase {
24
+ readonly type: 'request';
25
+ readonly name: ComposedRequestName;
26
+ readonly actor: MessageSenderRef;
27
+ readonly comment?: string;
28
+ readonly $approve: RequestBase['$approve'];
29
+ readonly $reject: RequestBase['$reject'];
30
+ constructor(input: IncomingRequest, context: EndpointEventContext);
41
31
  }
32
+ export declare const Request: typeof RuntimeRequest;
package/lib/request.js CHANGED
@@ -1,7 +1,15 @@
1
- export var Request;
2
- (function (Request) {
3
- function from(input, format) {
4
- return Object.assign(input, format);
1
+ import { RuntimeSideEvent } from './side-event/base.js';
2
+ /** @internal Actions are bound by the ingress operation, never retained across generations. */
3
+ export class RuntimeRequest extends RuntimeSideEvent {
4
+ comment;
5
+ $approve;
6
+ $reject;
7
+ constructor(input, context) {
8
+ super(input, context);
9
+ this.comment = input.comment;
10
+ this.$approve = async (remark) => { await input.$approve(remark); };
11
+ this.$reject = async (reason) => { await input.$reject(reason); };
12
+ Object.freeze(this);
5
13
  }
6
- Request.from = from;
7
- })(Request || (Request = {}));
14
+ }
15
+ export const Request = RuntimeRequest;