@zhin.js/core 1.1.33 → 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 (380) hide show
  1. package/README.md +140 -61
  2. package/lib/adapter.d.ts +72 -23
  3. package/lib/adapter.js +222 -58
  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 +9 -0
  63. package/lib/built/html-segment-fallback.js +49 -0
  64. package/lib/built/html-to-text.d.ts +4 -1
  65. package/lib/built/html-to-text.js +47 -16
  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 +67 -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 -21
  209. package/lib/index.js +53 -28
  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 -85
  269. package/lib/types.js +0 -1
  270. package/lib/utils.d.ts +68 -1
  271. package/lib/utils.js +73 -11
  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-to-text.d.ts.map +0 -1
  306. package/lib/built/html-to-text.js.map +0 -1
  307. package/lib/built/inbound-runner.d.ts.map +0 -1
  308. package/lib/built/inbound-runner.js.map +0 -1
  309. package/lib/built/login-assist.d.ts.map +0 -1
  310. package/lib/built/login-assist.js.map +0 -1
  311. package/lib/built/message-filter.d.ts.map +0 -1
  312. package/lib/built/message-filter.js.map +0 -1
  313. package/lib/built/permission.d.ts.map +0 -1
  314. package/lib/built/permission.js.map +0 -1
  315. package/lib/built/prepend-quote-context.d.ts +0 -33
  316. package/lib/built/prepend-quote-context.d.ts.map +0 -1
  317. package/lib/built/prepend-quote-context.js +0 -129
  318. package/lib/built/prepend-quote-context.js.map +0 -1
  319. package/lib/built/queue-im-field-contract.d.ts.map +0 -1
  320. package/lib/built/queue-im-field-contract.js.map +0 -1
  321. package/lib/built/roles.d.ts.map +0 -1
  322. package/lib/built/roles.js.map +0 -1
  323. package/lib/built/runtime-io.d.ts.map +0 -1
  324. package/lib/built/runtime-io.js.map +0 -1
  325. package/lib/built/schema-feature.d.ts.map +0 -1
  326. package/lib/built/schema-feature.js.map +0 -1
  327. package/lib/built/skill.d.ts.map +0 -1
  328. package/lib/built/skill.js.map +0 -1
  329. package/lib/built/tool.d.ts.map +0 -1
  330. package/lib/built/tool.js.map +0 -1
  331. package/lib/command.d.ts.map +0 -1
  332. package/lib/command.js.map +0 -1
  333. package/lib/component.d.ts.map +0 -1
  334. package/lib/component.js.map +0 -1
  335. package/lib/errors.d.ts.map +0 -1
  336. package/lib/errors.js.map +0 -1
  337. package/lib/index.d.ts.map +0 -1
  338. package/lib/index.js.map +0 -1
  339. package/lib/jsx-dev-runtime.d.ts.map +0 -1
  340. package/lib/jsx-dev-runtime.js.map +0 -1
  341. package/lib/jsx-runtime.d.ts.map +0 -1
  342. package/lib/jsx-runtime.js.map +0 -1
  343. package/lib/jsx.d.ts.map +0 -1
  344. package/lib/jsx.js.map +0 -1
  345. package/lib/message-quote.d.ts +0 -11
  346. package/lib/message-quote.d.ts.map +0 -1
  347. package/lib/message-quote.js +0 -91
  348. package/lib/message-quote.js.map +0 -1
  349. package/lib/message.d.ts.map +0 -1
  350. package/lib/message.js.map +0 -1
  351. package/lib/models/system-log.d.ts.map +0 -1
  352. package/lib/models/system-log.js.map +0 -1
  353. package/lib/models/user.d.ts.map +0 -1
  354. package/lib/models/user.js.map +0 -1
  355. package/lib/notice.d.ts.map +0 -1
  356. package/lib/notice.js.map +0 -1
  357. package/lib/plugin.d.ts.map +0 -1
  358. package/lib/plugin.js.map +0 -1
  359. package/lib/prompt.d.ts.map +0 -1
  360. package/lib/prompt.js.map +0 -1
  361. package/lib/request.d.ts.map +0 -1
  362. package/lib/request.js.map +0 -1
  363. package/lib/scheduler/scheduler.d.ts +0 -49
  364. package/lib/scheduler/scheduler.d.ts.map +0 -1
  365. package/lib/scheduler/scheduler.js +0 -352
  366. package/lib/scheduler/scheduler.js.map +0 -1
  367. package/lib/scheduler/types.d.ts +0 -71
  368. package/lib/scheduler/types.d.ts.map +0 -1
  369. package/lib/scheduler/types.js +0 -8
  370. package/lib/scheduler/types.js.map +0 -1
  371. package/lib/tool-zod.d.ts.map +0 -1
  372. package/lib/tool-zod.js.map +0 -1
  373. package/lib/types-generator.d.ts +0 -6
  374. package/lib/types-generator.d.ts.map +0 -1
  375. package/lib/types-generator.js +0 -72
  376. package/lib/types-generator.js.map +0 -1
  377. package/lib/types.d.ts.map +0 -1
  378. package/lib/types.js.map +0 -1
  379. package/lib/utils.d.ts.map +0 -1
  380. package/lib/utils.js.map +0 -1
@@ -0,0 +1,67 @@
1
+ import { KeyboardSegment } from '../../interactive-segments/keyboard-segment.js';
2
+ const ONEBOT_KEYBOARD_SCHEMA = {
3
+ type: 'object',
4
+ properties: {
5
+ rows: {
6
+ type: 'array',
7
+ items: {
8
+ type: 'array',
9
+ items: {
10
+ type: 'object',
11
+ properties: {
12
+ label: { type: 'string' },
13
+ payload: { type: 'string' },
14
+ id: { type: 'string' },
15
+ },
16
+ required: ['label', 'payload'],
17
+ },
18
+ },
19
+ },
20
+ },
21
+ required: ['rows'],
22
+ };
23
+ function toKeyboardSegment(ext) {
24
+ if (!ext || typeof ext !== 'object')
25
+ return null;
26
+ const obj = ext;
27
+ const rowsRaw = obj.rows;
28
+ if (!Array.isArray(rowsRaw))
29
+ return null;
30
+ const rows = [];
31
+ for (const row of rowsRaw) {
32
+ if (!Array.isArray(row))
33
+ continue;
34
+ const buttons = [];
35
+ for (const btn of row) {
36
+ if (!btn || typeof btn !== 'object')
37
+ continue;
38
+ const b = btn;
39
+ const label = typeof b.label === 'string' ? b.label : '';
40
+ const payload = typeof b.payload === 'string' ? b.payload : '';
41
+ if (!label || !payload)
42
+ continue;
43
+ buttons.push({
44
+ id: typeof b.id === 'string' ? b.id : payload,
45
+ label,
46
+ payload,
47
+ disabled: b.disabled === true,
48
+ });
49
+ }
50
+ if (buttons.length)
51
+ rows.push(buttons);
52
+ }
53
+ if (!rows.length)
54
+ return null;
55
+ return new KeyboardSegment({ rows }).toElement();
56
+ }
57
+ export const ONEBOT_KEYBOARD_AI_OUTBOUND_EXTENSION = {
58
+ key: 'onebot.keyboard',
59
+ schema: ONEBOT_KEYBOARD_SCHEMA,
60
+ examples: [
61
+ '{"extensions":{"onebot.keyboard":{"rows":[[{"label":"确认","payload":"ok","id":"ok"}]]}}}',
62
+ ],
63
+ toMessageElements(ext, _ctx) {
64
+ const seg = toKeyboardSegment(ext);
65
+ return seg ? [seg] : [];
66
+ },
67
+ };
@@ -0,0 +1,3 @@
1
+ import type { AiOutboundExtensionDefinition } from '../types.js';
2
+ export declare const QQ_MARKDOWN_AI_OUTBOUND_EXTENSION: AiOutboundExtensionDefinition;
3
+ export declare const QQ_AI_OUTBOUND_EXTENSIONS: readonly AiOutboundExtensionDefinition[];
@@ -0,0 +1,23 @@
1
+ const QQ_MARKDOWN_SCHEMA = {
2
+ type: 'object',
3
+ properties: {
4
+ content: { type: 'string' },
5
+ },
6
+ required: ['content'],
7
+ };
8
+ export const QQ_MARKDOWN_AI_OUTBOUND_EXTENSION = {
9
+ key: 'qq.markdown',
10
+ schema: QQ_MARKDOWN_SCHEMA,
11
+ examples: ['{"extensions":{"qq.markdown":{"content":"# Title\\nBody"}}}'],
12
+ toMessageElements(ext, _ctx) {
13
+ if (!ext || typeof ext !== 'object')
14
+ return [];
15
+ const content = ext.content;
16
+ if (typeof content !== 'string' || !content.trim())
17
+ return [];
18
+ return [{ type: 'markdown', data: { content: content.trim() } }];
19
+ },
20
+ };
21
+ export const QQ_AI_OUTBOUND_EXTENSIONS = [
22
+ QQ_MARKDOWN_AI_OUTBOUND_EXTENSION,
23
+ ];
@@ -0,0 +1,9 @@
1
+ export * from './types.js';
2
+ export * from './parse.js';
3
+ export * from './plain-mention-rewrite.js';
4
+ export * from './resolve.js';
5
+ export * from './prompt.js';
6
+ export * from './structured-detect.js';
7
+ export * from './adapter-access.js';
8
+ export * from './extensions/onebot-keyboard.js';
9
+ export * from './extensions/qq-message.js';
@@ -0,0 +1,9 @@
1
+ export * from './types.js';
2
+ export * from './parse.js';
3
+ export * from './plain-mention-rewrite.js';
4
+ export * from './resolve.js';
5
+ export * from './prompt.js';
6
+ export * from './structured-detect.js';
7
+ export * from './adapter-access.js';
8
+ export * from './extensions/onebot-keyboard.js';
9
+ export * from './extensions/qq-message.js';
@@ -0,0 +1,13 @@
1
+ import type { Segment } from '../segment-contract/types.js';
2
+ import type { ZhinAiOutboundPayload } from './types.js';
3
+ /** 解析单条 outbound segment(canonical type/data 形态)。 */
4
+ export declare function parseOutboundSegment(raw: unknown): Segment | null;
5
+ /** 去掉嵌入 JSON 候选末尾的 markdown 围栏(模型常见 ```json … ``` 误输出)。 */
6
+ export declare function trimTrailingMarkdownFence(raw: string): string;
7
+ export declare function unwrapAiOutboundJsonCandidate(raw: string): string;
8
+ /** Extract an embedded AI outbound JSON object from mixed prose. */
9
+ export declare function extractEmbeddedAiOutboundJson(plain: string): {
10
+ prose: string;
11
+ jsonRaw: string;
12
+ } | null;
13
+ export declare function parseAiOutboundJson(raw: string): ZhinAiOutboundPayload | null;
@@ -0,0 +1,104 @@
1
+ import { isCanonicalSegment } from '../segment-contract/assert.js';
2
+ function isPlainObject(value) {
3
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
4
+ }
5
+ /** 解析单条 outbound segment(canonical type/data 形态)。 */
6
+ export function parseOutboundSegment(raw) {
7
+ if (!isPlainObject(raw))
8
+ return null;
9
+ const type = typeof raw.type === 'string' && raw.type.trim() ? raw.type.trim() : undefined;
10
+ if (!type)
11
+ return null;
12
+ const data = isPlainObject(raw.data) ? raw.data : {};
13
+ const platform = isPlainObject(raw.platform) ? raw.platform : undefined;
14
+ const segment = platform ? { type, data, platform } : { type, data };
15
+ return isCanonicalSegment(segment) ? segment : null;
16
+ }
17
+ /** 去掉嵌入 JSON 候选末尾的 markdown 围栏(模型常见 ```json … ``` 误输出)。 */
18
+ export function trimTrailingMarkdownFence(raw) {
19
+ let s = raw.trim();
20
+ if (s.endsWith('```'))
21
+ s = s.slice(0, -3).trimEnd();
22
+ return s;
23
+ }
24
+ export function unwrapAiOutboundJsonCandidate(raw) {
25
+ const trimmed = raw.trim();
26
+ const fenced = readMarkdownFence(trimmed);
27
+ if (fenced && fenced.full)
28
+ return fenced.body.trim();
29
+ if (fenced && trimmed.indexOf('{') >= 0) {
30
+ return trimTrailingMarkdownFence(fenced.body.trim());
31
+ }
32
+ return trimTrailingMarkdownFence(trimmed);
33
+ }
34
+ /** Extract an embedded AI outbound JSON object from mixed prose. */
35
+ export function extractEmbeddedAiOutboundJson(plain) {
36
+ const trimmed = plain.trim();
37
+ if (!trimmed.includes('{'))
38
+ return null;
39
+ const fenced = readMarkdownFence(trimmed);
40
+ if (fenced) {
41
+ const jsonRaw = trimTrailingMarkdownFence(fenced.body.trim());
42
+ const payload = parseAiOutboundJson(jsonRaw);
43
+ if (payload?.mentions?.length && payload.text?.trim()) {
44
+ const prose = trimmed.slice(0, fenced.start).trim();
45
+ return { prose, jsonRaw };
46
+ }
47
+ }
48
+ let idx = trimmed.indexOf('{');
49
+ while (idx >= 0) {
50
+ const jsonRaw = trimTrailingMarkdownFence(trimmed.slice(idx).trim());
51
+ const payload = parseAiOutboundJson(jsonRaw);
52
+ if (payload?.mentions?.length && payload.text?.trim()) {
53
+ return { prose: trimmed.slice(0, idx).trim(), jsonRaw };
54
+ }
55
+ idx = trimmed.indexOf('{', idx + 1);
56
+ }
57
+ return null;
58
+ }
59
+ function readMarkdownFence(text) {
60
+ const start = text.indexOf('```');
61
+ if (start < 0)
62
+ return null;
63
+ let bodyStart = start + 3;
64
+ const langEnd = text.indexOf('\n', bodyStart);
65
+ if (langEnd >= 0) {
66
+ const lang = text.slice(bodyStart, langEnd).trim().toLowerCase();
67
+ if (lang === '' || lang === 'json')
68
+ bodyStart = langEnd + 1;
69
+ }
70
+ const end = text.indexOf('```', bodyStart);
71
+ if (end < 0)
72
+ return null;
73
+ return { start, body: text.slice(bodyStart, end), full: start === 0 && text.slice(end + 3).trim() === '' };
74
+ }
75
+ export function parseAiOutboundJson(raw) {
76
+ const candidate = unwrapAiOutboundJsonCandidate(raw);
77
+ if (!candidate.startsWith('{'))
78
+ return null;
79
+ try {
80
+ const parsed = JSON.parse(candidate);
81
+ const text = typeof parsed.text === 'string' ? parsed.text.trim() : undefined;
82
+ const mentionsRaw = parsed.mentions;
83
+ const mentions = Array.isArray(mentionsRaw)
84
+ ? mentionsRaw.map((m) => String(m).trim()).filter(Boolean)
85
+ : undefined;
86
+ const segmentsRaw = parsed.segments;
87
+ const segments = Array.isArray(segmentsRaw)
88
+ ? segmentsRaw
89
+ .map((item) => parseOutboundSegment(item))
90
+ .filter((s) => s != null)
91
+ : undefined;
92
+ const extensions = parsed.extensions != null && typeof parsed.extensions === 'object' && !Array.isArray(parsed.extensions)
93
+ ? parsed.extensions
94
+ : undefined;
95
+ if (!text && !mentions?.length && !segments?.length && !extensions)
96
+ return null;
97
+ if (mentions?.length && !text)
98
+ return null;
99
+ return { text, mentions, segments, extensions };
100
+ }
101
+ catch {
102
+ return null;
103
+ }
104
+ }
@@ -0,0 +1,6 @@
1
+ import type { AiOutboundMentionResolver, ZhinAiOutboundPayload } from './types.js';
2
+ /**
3
+ * 从正文中提取 cell roster 可识别的假 @(@researcher / @210723495 等),
4
+ * 剥离后返回等效 ZhinAiOutboundPayload。
5
+ */
6
+ export declare function rewritePlainTextMentions(plainText: string, mentionResolver: AiOutboundMentionResolver): ZhinAiOutboundPayload | null;
@@ -0,0 +1,37 @@
1
+ const PLAIN_MENTION_PATTERN = /@([\w-]+)/g;
2
+ /**
3
+ * 从正文中提取 cell roster 可识别的假 @(@researcher / @210723495 等),
4
+ * 剥离后返回等效 ZhinAiOutboundPayload。
5
+ */
6
+ export function rewritePlainTextMentions(plainText, mentionResolver) {
7
+ const trimmed = plainText.trim();
8
+ if (!trimmed)
9
+ return null;
10
+ const mentions = [];
11
+ let rewritten = trimmed;
12
+ for (const match of trimmed.matchAll(PLAIN_MENTION_PATTERN)) {
13
+ const token = match[1];
14
+ if (!token)
15
+ continue;
16
+ const endpointKey = mentionResolver(token);
17
+ if (!endpointKey)
18
+ continue;
19
+ const ref = token;
20
+ if (!mentions.includes(ref))
21
+ mentions.push(ref);
22
+ }
23
+ if (mentions.length === 0)
24
+ return null;
25
+ rewritten = trimmed.replace(PLAIN_MENTION_PATTERN, (full, token) => {
26
+ const endpointKey = mentionResolver(token);
27
+ return endpointKey ? '' : full;
28
+ });
29
+ rewritten = rewritten
30
+ .replace(/[ \t]+\n/g, '\n')
31
+ .replace(/\n{3,}/g, '\n\n')
32
+ .replace(/^\s+|\s+$/g, '')
33
+ .trim();
34
+ if (!rewritten)
35
+ return null;
36
+ return { mentions, text: rewritten };
37
+ }
@@ -0,0 +1,11 @@
1
+ import type { AiOutboundCapabilities, AiOutboundExtensionDefinition } from './types.js';
2
+ export declare const AI_OUTBOUND_JSON_EXAMPLE = "{\"mentions\":[\"researcher\",\"210723495\"],\"text\":\"\u6B63\u6587\"}";
3
+ export declare function buildCoreAiOutboundPromptHint(capabilities?: AiOutboundCapabilities): string;
4
+ export declare function buildAiOutboundPromptHint(input: {
5
+ capabilities?: AiOutboundCapabilities;
6
+ extensions?: readonly AiOutboundExtensionDefinition[];
7
+ rosterLines?: string[];
8
+ forceJsonOnly?: boolean;
9
+ }): string;
10
+ /** Detect whether inbound text explicitly requests a structured handoff. */
11
+ export declare function detectInboundHandoffIntent(content: string): boolean;
@@ -0,0 +1,44 @@
1
+ export const AI_OUTBOUND_JSON_EXAMPLE = '{"mentions":["researcher","210723495"],"text":"正文"}';
2
+ export function buildCoreAiOutboundPromptHint(capabilities) {
3
+ const lines = [
4
+ 'When your reply must @ peers, send rich media, buttons, or delegate — output JSON only (no Markdown wrapper):',
5
+ AI_OUTBOUND_JSON_EXAMPLE,
6
+ 'mentions: peer endpoint ID or pipelineRole; text: message body.',
7
+ 'Do NOT write "@researcher" in plain text — the framework converts JSON mentions to real platform @ segments.',
8
+ ];
9
+ if (capabilities?.richSegments?.length) {
10
+ lines.push(`Rich segments (optional "segments" array): ${capabilities.richSegments.join(', ')}.`);
11
+ }
12
+ if (capabilities?.interactive === 'native') {
13
+ lines.push('Interactive buttons: use extensions field per adapter schema.');
14
+ }
15
+ return lines.join('\n');
16
+ }
17
+ export function buildAiOutboundPromptHint(input) {
18
+ const lines = [];
19
+ if (input.rosterLines?.length) {
20
+ lines.push(...input.rosterLines);
21
+ }
22
+ lines.push(buildCoreAiOutboundPromptHint(input.capabilities));
23
+ if (input.extensions?.length) {
24
+ lines.push('Adapter extensions (optional "extensions" object):');
25
+ for (const ext of input.extensions) {
26
+ lines.push(`- ${ext.key}: see platform schema`);
27
+ if (ext.examples[0])
28
+ lines.push(` example: ${ext.examples[0]}`);
29
+ }
30
+ }
31
+ if (input.forceJsonOnly) {
32
+ lines.push('MUST reply with JSON only when @ peers or handoff — no Markdown body with plain "@role" text.');
33
+ }
34
+ return lines.join('\n');
35
+ }
36
+ /** Detect whether inbound text explicitly requests a structured handoff. */
37
+ export function detectInboundHandoffIntent(content) {
38
+ const t = content.trim();
39
+ if (!t)
40
+ return false;
41
+ if (t.includes('@'))
42
+ return true;
43
+ return /依次|自我介绍|叫大家|请各位|handoff|delegate/i.test(t);
44
+ }
@@ -0,0 +1,4 @@
1
+ import type { MessageElement } from '../../types.js';
2
+ import type { AiOutboundParseContext, ZhinAiOutboundPayload } from './types.js';
3
+ /** 将 ZhinAiOutboundPayload 转为 MessageElement[](canonical segments + extensions)。 */
4
+ export declare function resolveAiOutboundToMessageElements(payload: ZhinAiOutboundPayload, ctx: AiOutboundParseContext): Promise<MessageElement[] | null>;
@@ -0,0 +1,64 @@
1
+ import { segmentsForImDelivery } from '../segment-contract/delivery.js';
2
+ function buildMentionSegments(endpointKeys, text, ctx) {
3
+ const segments = [];
4
+ for (const endpointKey of endpointKeys) {
5
+ const target = ctx.atIdResolver?.(endpointKey) ?? endpointKey;
6
+ segments.push({ type: 'mention', data: { target } });
7
+ }
8
+ const body = text.trim();
9
+ segments.push({
10
+ type: 'text',
11
+ data: { text: body.startsWith(' ') ? body : ` ${body}` },
12
+ });
13
+ return segments;
14
+ }
15
+ function resolveMentionEndpointIds(mentions, ctx) {
16
+ if (!mentions?.length) {
17
+ return { ok: false, error: 'mentions 不能为空' };
18
+ }
19
+ if (!ctx.mentionResolver) {
20
+ return { ok: false, error: 'mentionResolver 未配置' };
21
+ }
22
+ const endpointKeys = [];
23
+ for (const ref of mentions) {
24
+ const resolved = ctx.mentionResolver(ref);
25
+ if (!resolved) {
26
+ return { ok: false, error: `未知 peer "${ref}"` };
27
+ }
28
+ if (!endpointKeys.includes(resolved))
29
+ endpointKeys.push(resolved);
30
+ }
31
+ return { ok: true, endpointKeys };
32
+ }
33
+ /** 将 ZhinAiOutboundPayload 转为 MessageElement[](canonical segments + extensions)。 */
34
+ export async function resolveAiOutboundToMessageElements(payload, ctx) {
35
+ const segments = [];
36
+ if (payload.mentions?.length) {
37
+ const resolved = resolveMentionEndpointIds(payload.mentions, ctx);
38
+ if (!resolved.ok)
39
+ return null;
40
+ const text = payload.text?.trim() ?? '';
41
+ if (!text)
42
+ return null;
43
+ segments.push(...buildMentionSegments(resolved.endpointKeys, text, ctx));
44
+ }
45
+ else if (payload.text?.trim()) {
46
+ segments.push({ type: 'text', data: { text: payload.text.trim() } });
47
+ }
48
+ if (payload.segments?.length) {
49
+ segments.push(...payload.segments);
50
+ }
51
+ const parts = segments.length
52
+ ? segmentsForImDelivery(segments)
53
+ : [];
54
+ if (payload.extensions && ctx.extensions?.length) {
55
+ for (const def of ctx.extensions) {
56
+ const ext = payload.extensions[def.key];
57
+ if (ext == null || !def.toMessageElements)
58
+ continue;
59
+ const extSegments = await def.toMessageElements(ext, ctx);
60
+ parts.push(...(Array.isArray(extSegments) ? extSegments : [extSegments]));
61
+ }
62
+ }
63
+ return parts.length ? parts : null;
64
+ }
@@ -0,0 +1,3 @@
1
+ import type { StructuredOutboundDetectInput } from './types.js';
2
+ /** structured_only:满足任一即进入结构化出站模式。 */
3
+ export declare function isStructuredOutboundRequired(input: StructuredOutboundDetectInput): boolean;
@@ -0,0 +1,6 @@
1
+ /** structured_only:满足任一即进入结构化出站模式。 */
2
+ export function isStructuredOutboundRequired(input) {
3
+ return Boolean(input.toolRequiresStructured
4
+ || input.inboundHandoffIntent
5
+ || input.adapterHasExtensions);
6
+ }
@@ -0,0 +1,58 @@
1
+ import type { Message } from '../../message.js';
2
+ import type { MessageElement } from '../../types.js';
3
+ import type { InteractivePolicy } from '../interactive-segments/types.js';
4
+ import type { Segment } from '../segment-contract/types.js';
5
+ /** AI 结构化出站 payload — 平台无关 DSL(Adapter extensions 承载平台特有段)。 */
6
+ export interface ZhinAiOutboundPayload {
7
+ text?: string;
8
+ mentions?: string[];
9
+ segments?: Segment[];
10
+ extensions?: Record<string, unknown>;
11
+ }
12
+ /**
13
+ * @deprecated 使用 canonical `Segment`(`type` + `data` + 可选 `platform`)。
14
+ * 历史 `kind` → `type`;`mode` 已删除。
15
+ */
16
+ export interface AiOutboundSegment {
17
+ kind: string;
18
+ mode?: string;
19
+ data?: Record<string, unknown>;
20
+ }
21
+ export interface AiOutboundCapabilities {
22
+ mentions?: boolean;
23
+ richSegments?: readonly string[];
24
+ interactive?: InteractivePolicy;
25
+ }
26
+ export interface AiOutboundExtensionDefinition {
27
+ /** 平台扩展字段名,如 qq.ark / onebot.keyboard */
28
+ key: string;
29
+ /** JSON Schema 子集,对齐平台 SDK 文档 */
30
+ schema: Record<string, unknown>;
31
+ examples: readonly string[];
32
+ toMessageElements?: (ext: unknown, ctx: AiOutboundParseContext) => MessageElement[] | Promise<MessageElement[]>;
33
+ }
34
+ export interface AiOutboundMentionResolver {
35
+ (ref: string): string | undefined;
36
+ }
37
+ export interface AiOutboundAtIdResolver {
38
+ (endpointKey: string): string;
39
+ }
40
+ /** 解析 AI 出站 JSON 时的上下文。 */
41
+ export interface AiOutboundParseContext {
42
+ message: Message;
43
+ /** 将 peer ref(role/endpoint/primary)解析为 endpointKey */
44
+ mentionResolver?: AiOutboundMentionResolver;
45
+ /** 将 endpointKey 解析为 platform @ id */
46
+ atIdResolver?: AiOutboundAtIdResolver;
47
+ /** Adapter 声明的 extensions(运行时从 Adapter 静态属性注入) */
48
+ extensions?: readonly AiOutboundExtensionDefinition[];
49
+ }
50
+ export interface StructuredOutboundDetectInput {
51
+ /** 工具链要求结构化出站。 */
52
+ toolRequiresStructured?: boolean;
53
+ /** 用户入站含 handoff / @ 意图 */
54
+ inboundHandoffIntent?: boolean;
55
+ /** Adapter 声明 extensions 且非空 */
56
+ adapterHasExtensions?: boolean;
57
+ }
58
+ export declare const DEFAULT_AI_OUTBOUND_CAPABILITIES: AiOutboundCapabilities;
@@ -0,0 +1,5 @@
1
+ export const DEFAULT_AI_OUTBOUND_CAPABILITIES = {
2
+ mentions: true,
3
+ richSegments: ['qrcode', 'html', 'markdown', 'tts'],
4
+ interactive: 'text',
5
+ };
@@ -37,8 +37,6 @@ export interface AITriggerConfig {
37
37
  masters?: string[];
38
38
  /** 全局 trusted(trigger 级) */
39
39
  trusted?: string[];
40
- /** 是否在 AI 入参前拉取 $quote_id 对应消息正文(默认 true) */
41
- resolveQuotedMessages?: boolean;
42
40
  }
43
41
  /**
44
42
  * AI 触发检查结果
@@ -49,8 +47,8 @@ export interface AITriggerResult {
49
47
  }
50
48
  /** shouldTriggerAI 可选参数(如适配器提供的平台 @ ID) */
51
49
  export interface AITriggerOptions {
52
- /** 用于 @ 匹配的 bot 标识符(默认仅 message.$bot) */
53
- botAtIds?: string[];
50
+ /** 用于 @ 匹配的 Endpoint 标识符(默认仅 message.$endpoint) */
51
+ endpointAtIds?: string[];
54
52
  }
55
53
  /** 发送者角色解析结果 */
56
54
  export interface SenderRolesResult {
@@ -59,38 +57,41 @@ export interface SenderRolesResult {
59
57
  }
60
58
  export declare const DEFAULT_AI_TRIGGER_CONFIG: Required<AITriggerConfig>;
61
59
  /**
62
- * 收集用于 @ 匹配的 bot 标识符
60
+ * 收集用于 @ 匹配的 Endpoint 标识符
63
61
  */
64
- export declare function collectBotAtIds<T extends object>(message: Message<T>, extraIds?: string[]): string[];
62
+ export declare function collectEndpointAtIds<T extends object>(message: Message<T>, extraIds?: string[]): string[];
65
63
  /**
66
- * 检查消息是否 @ 了机器人
64
+ * 检查消息是否 @ 了 Endpoint
67
65
  */
68
- export declare function isAtBot<T extends object>(message: Message<T>, botAtIds?: string[]): boolean;
66
+ export declare function isAtEndpoint<T extends object>(message: Message<T>, endpointAtIds?: string[]): boolean;
69
67
  /**
70
68
  * 提取消息文本内容(保留富媒体信息)
71
69
  * 使用 segment.toString 将 MessageElement 转为 XML 格式
72
70
  */
73
71
  export declare function extractTextContent<T extends object>(message: Message<T>): string;
72
+ /**
73
+ * 为群/频道消息构建发送者前缀(与 sender-extra.ts buildSenderPrefix 格式对齐)
74
+ * 私聊消息返回 null
75
+ */
76
+ export declare function buildSenderPrefixForMessage<T extends object>(message: Message<T>, roles: SenderRole[]): string | null;
74
77
  /**
75
78
  * 解析 AI 回复中的富媒体内容
76
79
  * 将字符串中的 XML-like 标签解析为 MessageElement
77
80
  */
78
81
  export declare function parseRichMediaContent(content: string): MessageElement[];
79
82
  /**
80
- * 移除 @ 机器人的部分
83
+ * 移除 @ Endpoint 的部分
81
84
  */
82
- export declare function removeAtBot<T extends object>(message: Message<T>, botAtIds?: string[]): MessageElement[];
83
- /** Bot 配置(adapter bots[].$config) */
84
- export interface BotConfigRoles {
85
+ export declare function removeAtEndpoint<T extends object>(message: Message<T>, endpointAtIds?: string[]): MessageElement[];
86
+ /** Endpoint 配置(adapter endpoints[].$config) */
87
+ export interface EndpointConfigRoles {
85
88
  master?: unknown;
86
89
  trusted?: unknown;
87
90
  }
88
91
  /**
89
- * 解析发送者角色集合(IM 群角色 + trigger + bots[].$config)
92
+ * 解析发送者角色集合(IM 群角色 + trigger + endpoints[].$config)
90
93
  */
91
- export declare function resolveSenderRoles<T extends object>(message: Message<T>, config: AITriggerConfig, botConfig?: BotConfigRoles | Record<string, unknown> | null): SenderRolesResult;
92
- /** 从 IM 消息生成 sessionId(platform:botId:type:sceneId) */
93
- export declare function resolveIMSessionIdFromMessage<T extends object>(message: Message<T>): string;
94
+ export declare function resolveSenderRoles<T extends object>(message: Message<T>, config: AITriggerConfig, endpointConfig?: EndpointConfigRoles | Record<string, unknown> | null): SenderRolesResult;
94
95
  /**
95
96
  * 检查消息是否应该触发 AI
96
97
  */
@@ -99,4 +100,3 @@ export declare function shouldTriggerAI<T extends object>(message: Message<T>, c
99
100
  * 合并配置
100
101
  */
101
102
  export declare function mergeAITriggerConfig(config: AITriggerConfig): Required<AITriggerConfig>;
102
- //# sourceMappingURL=ai-trigger.d.ts.map