@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
package/README.md CHANGED
@@ -1,71 +1,72 @@
1
1
  # @zhin.js/core
2
2
 
3
- Zhin.js IM 核心框架包,提供插件系统、Feature 架构、适配器、消息路由与出站发送链。**AI 编排(ZhinAgent、工具安全、MCP)在 [`@zhin.js/agent`](../agent/README.md)**;本包仅 selective re-export `@zhin.js/ai` 的 Provider / Agent 原语供插件直接使用。
3
+ ## Plugin Runtime 子路径
4
4
 
5
- 领域词汇见 [CONTEXT.md](./CONTEXT.md);入站/出站流程见 [消息如何流转](../../docs/essentials/message-flow.md)。
6
-
7
- ## 核心概念
5
+ 新的 owner-aware IM 能力已经并入 Core,作为 Plugin Runtime 的正式领域接口:
8
6
 
9
- ### Plugin(插件)
7
+ - `@zhin.js/core/runtime`
10
8
 
11
- 插件是 Zhin.js 的基本组织单位。每个插件拥有独立的生命周期和上下文,通过 `usePlugin()` Hook 访问框架能力。
9
+ `@zhin.js/adapter`、`@zhin.js/command`、`@zhin.js/component`
10
+ `@zhin.js/middleware` 提供纯 definition、约定发现 provider 和 generation projection;
11
+ Core Runtime 只消费它们发布的 snapshot。
12
+ 旧根入口的 `addCommand`、`addComponent`、`addMiddleware` 暂时作为作者兼容接口保留,后续
13
+ 只向 RuntimeSnapshot 投影,不再维护第二套运行时权威。
12
14
 
13
- ```typescript
14
- import { usePlugin, MessageCommand } from '@zhin.js/core'
15
+ Zhin.js **IM/多通道运行时**包:Plugin、Adapter、**Endpoint**、MessageDispatcher 与统一出站链。**AI 编排(ZhinAgent、工具安全、MCP)在 [`@zhin.js/agent`](../agent/README.md)**;本包仅 selective re-export `@zhin.js/ai` 的 Provider / Agent 原语供插件直接使用。
15
16
 
16
- const { addCommand, addTool, addCron, onMounted, onDispose } = usePlugin()
17
+ 领域词汇见 [CONTEXT.md](./CONTEXT.md);入站/出站流程见 [消息如何流转](../../docs/essentials/message-flow.md)
17
18
 
18
- onMounted(() => console.log('插件已挂载'))
19
- onDispose(() => console.log('插件已卸载'))
19
+ ## 核心概念
20
20
 
21
- addCommand(
22
- new MessageCommand('hello <name:string>')
23
- .desc('打招呼')
24
- .action((_, result) => `Hello, ${result.params.name}!`)
25
- )
26
- ```
21
+ ### Plugin(插件)— Plugin Runtime
27
22
 
28
- 插件名称默认从文件路径推导,也可以显式声明:
23
+ 唯一启动路径:`zhin runtime start`。`plugin.ts` 必须 default-export `definePlugin()`;能力按约定目录发现。
29
24
 
30
25
  ```typescript
31
- // 方式 1: 导出 pluginName 常量
32
- export const pluginName = 'my-awesome-plugin'
33
-
34
- // 方式 2: 使用 definePlugin 声明式 API
35
- import { definePlugin } from '@zhin.js/core'
26
+ // plugin.ts
27
+ import { definePlugin } from '@zhin.js/plugin-runtime'
36
28
 
37
29
  export default definePlugin({
38
- name: 'my-awesome-plugin',
39
- setup(plugin) {
40
- // 在这里使用 plugin 注册命令、工具等
30
+ name: 'hello-bot',
31
+ metadata: { displayName: 'Hello Bot' },
32
+ setup(context) {
33
+ context.lifecycle.add(() => { /* cleanup */ })
41
34
  },
42
35
  })
36
+ ```
37
+
38
+ ```typescript
39
+ // commands/hello/[name].ts
40
+ import { defineCommand } from '@zhin.js/command'
43
41
 
44
- // 方式 3: 手动设置
45
- const plugin = usePlugin()
46
- plugin.setName('my-awesome-plugin')
42
+ export default defineCommand({
43
+ description: '打招呼',
44
+ params: {
45
+ name: { type: 'string' },
46
+ },
47
+ execute({ params }) {
48
+ return `Hello, ${params.name}!`
49
+ },
50
+ })
47
51
  ```
48
52
 
53
+ > **已移除**:`usePlugin()` / `getPlugin()` / `bootstrapNode`(`zhin.js/node`)调用即 throw;唯一入口为 `definePlugin` + `zhin runtime start`。`MessageCommand` / `Plugin.addCommand` 仍 deprecated。见 [public-api-surface](../../docs/contributing/public-api-surface.md)。
54
+
55
+ 本包仍提供 IM 运行时契约(Message / Adapter / Endpoint);创作面在 Feature 包与 `@zhin.js/plugin-runtime`。
56
+
49
57
  ### Feature(特性抽象)
50
58
 
51
- Feature Zhin.js 的核心扩展机制。所有内置功能均继承自 `Feature` 抽象基类,提供统一的注册/注销、插件归属追踪、JSON 序列化和变更事件通知能力。
59
+ 约定式 Feature(Command / Middleware / Component / Adapter…)由独立包提供 definition + 约定发现;Core Runtime 消费 snapshot。
60
+
61
+ 经典 `CommandFeature` / `addCommand` 等仍挂在 `Plugin.prototype`,**已 deprecated**,仅兼容 Agent init / game-kit:
52
62
 
53
63
  ```
54
- Feature (抽象基类)
55
- ├── CommandFeature — 消息命令 addCommand()
56
- ├── ToolFeature — AI 可调用工具 addTool()
57
- ├── SkillFeature — 技能记录 Agent 从 SKILL.md 注入
58
- ├── CronFeature — 定时任务 addCron()
59
- ├── DatabaseFeature — 数据模型 defineModel()
60
- ├── ComponentFeature — 消息组件 addComponent()
61
- ├── ConfigFeature — 插件配置 addConfig()
62
- └── PermissionFeature — 权限管理
64
+ Feature (抽象基类) — legacy 注册表仍在
65
+ ├── CommandFeature — MessageCommand(→ defineCommand)
66
+ ├── ToolFeature — AI 工具(→ defineAgentTool)
67
+ ├──
63
68
  ```
64
69
 
65
- 每个 Feature 都会在 `Plugin.prototype` 上注入对应的扩展方法(如 `addCommand`、`addTool`),插件通过 `usePlugin()` 获取这些方法。
66
-
67
- Feature 支持变更事件监听,依赖方可实时响应 item 的增删:
68
-
69
70
  ```typescript
70
71
  const toolFeature = plugin.inject('tool')
71
72
  const off = toolFeature.on('add', (tool, pluginName) => {
@@ -90,11 +91,56 @@ return segment.html({
90
91
  backgroundColor: '#d8dce3',
91
92
  fileName: 'card.png',
92
93
  })
94
+
95
+ // Markdown 段(QQ 等平台 policy 为 origin 时透传)
96
+ return segment.markdown('# Title\n\nBody')
93
97
  ```
94
98
 
95
- - 安装 **`@zhin.js/plugin-html-renderer`** 时,`before.sendMessage` 自动将 `html` 转为 PNG。
96
- - 未安装或转图失败时,`Adapter.renderSendMessage` 链尾调用 **`coerceHtmlSegmentsToText`**,用 **`htmlToFallbackText`** 剥离纯文本。
97
- - 日志预览为 `[html-card]` + 自动剥离摘要(前 80 字),不 dump 完整 HTML。
99
+ 出站富媒体段(`qrcode` / `html` / `markdown`)在 **`Adapter.renderSendMessage` 首步** 按各 Adapter 的 **`outboundRichSegmentPolicy`** 统一渲染为 `image` / `text` / `origin`:
100
+
101
+ | 渲染模式 | 含义 |
102
+ |---------|------|
103
+ | `image` | 转为 `image` 段(qrcode 生成 PNG;html/markdown 经 `@zhin.js/html-renderer` 动态转图,未安装则降级 text) |
104
+ | `text` | 剥离为纯文本段 |
105
+ | `origin` | 原样透传,由 Endpoint 解释(如 QQ markdown、process 终端二维码) |
106
+
107
+ 默认策略:`qrcode: image`,`html: text`,`markdown: text`。QQ / KOOK 等适配器 override static policy。
108
+
109
+ - 安装 **`@zhin.js/html-renderer`** 且 policy 为 `html: 'image'` 时,core 在首步动态 import 并转 PNG。
110
+ - policy 为 `html: 'text'` 时等价于 **`coerceHtmlSegmentsToText`** / **`htmlToFallbackText`**。
111
+ - 日志预览:`[html-card]`、`[qrcode]`、`[markdown]` + 摘要(前 80 字)。
112
+
113
+ #### 扩展新 Rich Segment(长期方案)
114
+
115
+ 内置 kind 通过 **`richSegmentRegistry`** 注册;optional 能力通过 **`registerRichSegmentCapabilityLoader`** 注入(与 `@zhin.js/html-renderer` 同模式)。
116
+
117
+ ```typescript
118
+ import {
119
+ RichSegment,
120
+ registerRichSegmentKind,
121
+ registerRichSegmentCapabilityLoader,
122
+ RICH_SEGMENT_MODE,
123
+ segment,
124
+ } from '@zhin.js/core';
125
+
126
+ // 1. 内置 capability:speech(@zhin.js/speech)已注册,tts kind 已内置
127
+ // 可选:注册 ffmpeg 等
128
+ registerRichSegmentCapabilityLoader('media-pipeline', async (opts) => {
129
+ const { createMediaPipeline } = await import('@zhin.js/media-pipeline');
130
+ return createMediaPipeline(opts.getConfig?.());
131
+ });
132
+
133
+ // 2. 使用内置 segment.tts(Adapter policy 决定 audio/text/origin)
134
+ // segment.tts({ text: '你好' })
135
+ class MyAdapter extends Adapter {
136
+ static override outboundRichSegmentPolicy = {
137
+ tts: 'audio',
138
+ qrcode: 'image', // 其余 kind 用 registry 默认值
139
+ };
140
+ }
141
+ ```
142
+
143
+ **分工**:Rich Segment 负责「语义段 → 标准 IM 段」;Endpoint `materializeOutboundMedia` 负责「已有 audio/video/file → 平台上传」。
98
144
 
99
145
  ### Adapter(适配器)
100
146
 
@@ -105,20 +151,20 @@ return segment.html({
105
151
  Adapter.register('my-platform', MyAdapter)
106
152
  ```
107
153
 
108
- 每个适配器可以通过 `addTool()` 注册平台特有工具,标准群管操作通过覆写 `IGroupManagement` 方法自动注册。
154
+ 每个适配器可以通过 `addTool()` 注册平台特有工具,标准群管操作通过覆写 `ISceneManagement` 方法自动注册。
109
155
 
110
- **群管理能力自动检测:** 适配器基类声明了 `IGroupManagement` 接口中的可选方法(`kickMember`、`muteMember`、`banMember` 等),子类只需覆写自己平台支持的方法,`start()` 会自动检测哪些方法已实现,生成对应的 Tool 并注册为"群聊管理"Skill。目前所有 9 个 IM 适配器(ICQQ、OneBot11、QQ 官方、Telegram、Discord、KOOK、Slack、钉钉、飞书)均已采用此模式:
156
+ **群管理能力自动检测:** 适配器基类声明了 `ISceneManagement` 接口中的可选方法(`kickMember`、`muteMember`、`banMember` 等),子类只需覆写自己平台支持的方法,`start()` 会自动检测哪些方法已实现,生成对应的 Tool 并注册为"群聊管理"Skill。目前所有 9 个 IM 适配器(ICQQ、OneBot11、QQ 官方、Telegram、Discord、KOOK、Slack、钉钉、飞书)均已采用此模式:
111
157
 
112
158
  ```typescript
113
- class IcqqAdapter extends Adapter<IcqqBot> {
159
+ class IcqqAdapter extends Adapter<IcqqEndpoint> {
114
160
  // 覆写标准群管方法
115
- async kickMember(botId: string, sceneId: string, userId: string) {
116
- const bot = this.bots.get(botId)
117
- if (!bot) throw new Error(`Bot ${botId} 不存在`)
118
- return bot.kickMember(Number(sceneId), Number(userId), false)
161
+ async kickMember(endpointId: string, sceneId: string, userId: string) {
162
+ const endpoint = this.endpoints.get(endpointId)
163
+ if (!endpoint) throw new Error(`Endpoint ${endpointId} 不存在`)
164
+ return endpoint.kickMember(Number(sceneId), Number(userId), false)
119
165
  }
120
- async muteMember(botId: string, sceneId: string, userId: string, duration = 600) { /* ... */ }
121
- async setAdmin(botId: string, sceneId: string, userId: string, enable = true) { /* ... */ }
166
+ async muteMember(endpointId: string, sceneId: string, userId: string, duration = 600) { /* ... */ }
167
+ async setAdmin(endpointId: string, sceneId: string, userId: string, enable = true) { /* ... */ }
122
168
  // ...共覆写 7 个标准方法
123
169
 
124
170
  async start() {
@@ -150,9 +196,9 @@ Core **不包含** ZhinAgent 实现。IM 侧的 AI 对话、工具收集、执
150
196
 
151
197
  | 类别 | 示例导出 |
152
198
  |------|----------|
153
- | Provider | `OpenAIProvider`、`OllamaProvider`、`AnthropicProvider` |
154
- | Agent 原语 | `Agent`、`createAgent`、`ModelRegistry` |
155
- | 会话 / 上下文 | `SessionManager`(遗留)、`ContextRepository`、`ImTranscriptStore`、`ContextManager`、`ConversationMemory` |
199
+ | Provider | `AIProvider` 接口、`createSdkProviderAdapter`(AI SDK 传输) |
200
+ | Agent 原语 | `ModelRegistry`、`agentLoop` |
201
+ | 会话 / 上下文 | `ConversationEventStore`(IM 事实)与 Agent 的 `ContextRepository`(模型会话) |
156
202
  | 压缩 / 限流 / 输出 | `compactSession`、`RateLimiter`、`parseOutput`、`CostTracker` |
157
203
 
158
204
  完整 Agent 能力与配置见 [`@zhin.js/agent`](../agent/README.md) 与 [AI 模块](https://zhin.js.org/advanced/ai)。
@@ -163,25 +209,35 @@ Core **不包含** ZhinAgent 实现。IM 侧的 AI 对话、工具收集、执
163
209
 
164
210
  ```typescript
165
211
  // 插件系统
166
- export { Plugin, usePlugin, getPlugin, definePlugin } from './plugin.js'
212
+ export { Plugin, usePlugin, getPlugin, definePlugin } from './plugin.js' // usePlugin/getPlugin 为 throwing stub
167
213
 
168
214
  // Feature 体系(Cron / Scheduler 来自 @zhin.js/kernel)
169
215
  export { Feature, Cron, Scheduler } from '@zhin.js/kernel'
170
- export { CommandFeature, ToolFeature, SkillFeature, CronFeature, DatabaseFeature, ... } from './built/*.js'
216
+ export { CommandFeature, ToolFeature, SkillFeature, ScheduleFeature, DatabaseFeature, ... } from './built/*.js'
171
217
 
172
218
  // 消息路由
173
219
  export { createMessageDispatcher } from './built/dispatcher.js'
174
220
 
175
- // 适配器与消息
176
- export { Adapter, Message, MessageCommand, Bot, segment, ... } from './'
221
+ // 适配器与消息(MessageCommand 已 deprecated)
222
+ export { Adapter, Message, MessageCommand, Endpoint, segment, ... } from './'
177
223
 
178
- // HTML 出站回退
224
+ // 富媒体出站段
225
+ export {
226
+ resolveRichSegments,
227
+ DEFAULT_OUTBOUND_RICH_SEGMENT_POLICY,
228
+ QrcodeSegment,
229
+ HtmlSegment,
230
+ MarkdownSegment,
231
+ } from './built/rich-segments/index.js'
232
+ export type { RichSegmentKind, RichRenderMode, OutboundRichSegmentPolicy } from './built/rich-segments/types.js'
233
+
234
+ // HTML 出站回退(legacy;policy html:'text' 时等价)
179
235
  export { htmlToFallbackText, coerceHtmlSegmentsToText, registerHtmlSegmentFallback } from './built/*.js'
180
236
 
181
237
  // AI 原语(来自 @zhin.js/ai,非 ZhinAgent)
182
238
  export {
183
- OpenAIProvider, OllamaProvider, Agent, createAgent, ModelRegistry,
184
- SessionManager, ContextManager, ConversationMemory, compactSession, ...
239
+ AIProvider, createSdkProviderAdapter, ModelRegistry,
240
+ ContextRepository, ContextManager, compactSession, ...
185
241
  } from '@zhin.js/ai'
186
242
  ```
187
243
 
package/lib/adapter.d.ts CHANGED
@@ -1,44 +1,73 @@
1
- import { Bot } from "./bot.js";
1
+ import { Endpoint } from "./endpoint.js";
2
+ import { DEFAULT_ENDPOINT_CAPABILITIES, type EndpointCapability } from "./endpoint-capabilities.js";
3
+ import type { EndpointManager } from "./built/endpoint-manager.js";
2
4
  import { Plugin } from "./plugin.js";
3
5
  import { EventEmitter } from "node:events";
4
6
  import { Message } from "./message.js";
5
7
  import { Notice } from "./notice.js";
6
8
  import { Request } from "./request.js";
7
- import { SendOptions } from "./types.js";
9
+ import { EditMessageOptions, SendOptions } from "./types.js";
10
+ import { type OutboundRichSegmentPolicy } from "./built/rich-segments/index.js";
11
+ import { type InteractivePolicy } from "./built/interactive-segments/index.js";
12
+ import { type AiOutboundCapabilities, type AiOutboundExtensionDefinition } from "./built/ai-outbound/index.js";
13
+ import type { Schema } from '@zhin.js/schema';
8
14
  /**
9
15
  * Adapter类:适配器抽象,管理多平台Bot实例。
10
16
  * 负责根据配置启动/关闭各平台机器人,统一异常处理。
11
17
  *
12
18
  * 适配器可以提供 AI 工具,供 AI 服务调用。
13
19
  */
14
- export declare abstract class Adapter<R extends Bot = Bot> extends EventEmitter<Adapter.Lifecycle> {
20
+ export declare abstract class Adapter<R extends Endpoint = Endpoint, const Caps extends readonly EndpointCapability[] = typeof DEFAULT_ENDPOINT_CAPABILITIES> extends EventEmitter<Adapter.Lifecycle> {
15
21
  #private;
16
22
  plugin: Plugin;
17
23
  name: keyof Plugin.Contexts;
18
- config: Adapter.BotConfig<R>[];
19
- /** 当前适配器下所有Bot实例,key为bot名称 */
20
- bots: Map<string, R>;
24
+ config: Adapter.EndpointConfig<R>[];
25
+ endpoints: Map<string, R>;
26
+ private recallMessageHandler;
27
+ /** Adapter 支持的能力上限(子类覆盖) */
28
+ static readonly capabilities: readonly EndpointCapability[];
29
+ /** 出站富媒体段渲染策略(子类 override static) */
30
+ static outboundRichSegmentPolicy: OutboundRichSegmentPolicy;
31
+ /** 交互段出站策略:native 保留按钮段,text 降级为编号文本 */
32
+ static interactivePolicy: InteractivePolicy;
33
+ /** AI 结构化出站能力声明(mentions / richSegments / interactive) */
34
+ static aiOutboundCapabilities: AiOutboundCapabilities;
35
+ /** 平台特有 extensions schema + 解析(对齐各 SDK 文档子集) */
36
+ static aiOutboundExtensions?: readonly AiOutboundExtensionDefinition[];
37
+ protected getInteractivePolicy(): InteractivePolicy;
21
38
  /** 并发上限,0 表示不限制(默认) */
22
39
  static DEFAULT_MAX_CONCURRENT_MESSAGES: number;
23
40
  get maxConcurrentMessages(): number;
24
41
  /** 当前正在处理的消息数 */
25
42
  get pendingMessages(): number;
26
43
  /**
27
- * 构造函数
44
+ * 创建一个适配器运行实例。
45
+ * @param plugin 拥有该适配器的插件实例
28
46
  * @param name 适配器名称(如 'process'、'qq' 等)
29
- * @param botFactory Bot工厂函数或构造器
47
+ * @param config Endpoint 配置列表
30
48
  */
31
- constructor(plugin: Plugin, name: keyof Plugin.Contexts, config: Adapter.BotConfig<R>[]);
49
+ constructor(plugin: Plugin, name: keyof Plugin.Contexts, config: Adapter.EndpointConfig<R>[]);
50
+ /** 入站消息管线(替代 emit override 的隐式管线) */
51
+ private inboundPipeline;
32
52
  /**
33
- * 重写 emit:拦截 message.receive 事件,按架构规定的入站流程处理
34
- * 入站消息链:adapter.emit → dispatcher.dispatch → plugin.dispatch('message.receive') → adapter observers
35
- *
36
- * 以属性 + `EventEmitter.prototype.emit` 调用满足 Node @types 25 对泛型 `emit` 的可赋值检查。
53
+ * 重写 emit:拦截 message.receive/notice.receive/request.receive 事件,
54
+ * 将入站处理委托给 InboundMessagePipeline。
37
55
  */
38
56
  emit: EventEmitter<Adapter.Lifecycle>['emit'];
39
- abstract createBot(config: Adapter.BotConfig<R>): R;
57
+ abstract createEndpoint(config: Adapter.EndpointConfig<R>): R;
40
58
  get logger(): import("@zhin.js/logger").Logger;
41
59
  binding(plugin: Plugin): void;
60
+ /**
61
+ * 同步等待入站管线结束(middleware → dispatcher → 生命周期 → 观察者)。
62
+ * 用于 QQ 等需在被动回复完成后再 ack 交互的平台事件。
63
+ */
64
+ receiveMessageAwait(message: Message): Promise<boolean>;
65
+ /** 运行时 Endpoint 管理(add/remove/edit/start/stop);未实现则 core 尝试 endpointConfigSchema 通用向导 */
66
+ getEndpointManager?(): EndpointManager | null;
67
+ /** 通用 schema 驱动 add/edit 时的字段定义 */
68
+ getEndpointConfigSchema?(): Schema | undefined;
69
+ /** 热连接失败时是否建议重启进程 */
70
+ getEndpointNeedsRestart?(): boolean;
42
71
  /**
43
72
  * 出站富媒体能力(Publisher 按此过滤/降级;各 adapter 可覆盖)。
44
73
  */
@@ -49,20 +78,41 @@ export declare abstract class Adapter<R extends Bot = Bot> extends EventEmitter<
49
78
  file?: boolean;
50
79
  maxAttachmentBytes?: number;
51
80
  };
52
- private renderSendMessage;
81
+ protected getOutboundRichSegmentPolicy(): OutboundRichSegmentPolicy;
82
+ /**
83
+ * 出站两阶段:
84
+ * 1. resolveRichSegments — 语义段 → 标准 IM 段(image/audio/text)
85
+ * 2. Endpoint materializeOutboundMedia — base64/本地路径 → 平台 URL(各 adapter 可选)
86
+ * @see docs/essentials/rich-segment-adapters.md
87
+ */
88
+ protected renderSendMessage(options: SendOptions): Promise<SendOptions>;
53
89
  sendMessage(options: SendOptions): Promise<string>;
90
+ /**
91
+ * `call.recallMessage` 事件链(prompt.ts 超时撤回等)的统一出口:
92
+ * 经 canonical `EndpointControl` 端口撤回。
93
+ */
94
+ private recallEndpointMessage;
95
+ /**
96
+ * 编辑已发送的消息。
97
+ * - 如果 Endpoint 的 control 端口实现了 edit,调用平台编辑 API
98
+ * - 否则 fallback 到发送新消息
99
+ * @returns 消息 ID(编辑时返回原 ID,fallback 时返回新消息 ID)
100
+ */
101
+ editMessage(options: EditMessageOptions): Promise<string>;
54
102
  start(): Promise<void>;
55
103
  /**
56
- * 停止适配器,断开并移除所有Bot实例
57
- * @param plugin 所属插件实例
104
+ * 停止适配器,断开并移除所有 Endpoint 实例
58
105
  */
59
106
  stop(): Promise<void>;
60
107
  }
61
108
  export interface Adapters {
62
109
  }
110
+ /** Per-adapter live Endpoint class map for HandlerContext.$endpoint() typing. */
111
+ export interface AdapterEndpoints {
112
+ }
63
113
  export declare namespace Adapter {
64
114
  type Factory<R extends Adapter = Adapter> = {
65
- new (plugin: Plugin, name: string, config: Adapter.BotConfig<Adapter.InferBot<R>>[]): R;
115
+ new (plugin: Plugin, name: string, config: Adapter.EndpointConfig<Adapter.InferEndpoint<R>>[]): R;
66
116
  };
67
117
  interface Lifecycle {
68
118
  'message.receive': [Message];
@@ -77,10 +127,10 @@ export declare namespace Adapter {
77
127
  * 适配器工厂注册表
78
128
  * 灵感来源于 zhinjs/next 的 Adapter.Registry
79
129
  */
80
- const Registry: Map<string, Factory<Adapter<Bot<{}, {}>>>>;
81
- type InferBot<R extends Adapter = Adapter> = R extends Adapter<infer T> ? T : never;
82
- type BotConfig<T extends Bot> = T extends Bot<infer R> ? R : never;
83
- type BotMessage<T extends Bot> = T extends Bot<infer _L, infer R> ? R : never;
130
+ const Registry: Map<string, Factory<Adapter<Endpoint, readonly EndpointCapability[]>>>;
131
+ type InferEndpoint<R extends Adapter = Adapter> = R extends Adapter<infer T> ? T : never;
132
+ type EndpointConfig<T extends Endpoint> = T extends Endpoint<infer R> ? R : never;
133
+ type EndpointMessage<T extends Endpoint> = T extends Endpoint<infer _L, infer R> ? R : never;
84
134
  /**
85
135
  * 注册适配器工厂
86
136
  *
@@ -93,4 +143,3 @@ export declare namespace Adapter {
93
143
  */
94
144
  function register(name: string, factory: Factory): void;
95
145
  }
96
- //# sourceMappingURL=adapter.d.ts.map