@zhin.js/core 1.3.2 → 1.3.4

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 (416) hide show
  1. package/README.md +7 -7
  2. package/lib/adapter.d.ts +22 -2
  3. package/lib/adapter.js +72 -2
  4. package/lib/agent-prompt.d.ts +0 -1
  5. package/lib/agent-prompt.js +0 -1
  6. package/lib/built/adapter-process.d.ts +0 -1
  7. package/lib/built/adapter-process.js +0 -1
  8. package/lib/built/agent-preset.d.ts +0 -1
  9. package/lib/built/agent-preset.js +0 -1
  10. package/lib/built/ai-access.d.ts +36 -0
  11. package/lib/built/ai-access.js +46 -0
  12. package/lib/built/ai-outbound/adapter-access.d.ts +3 -0
  13. package/lib/built/ai-outbound/adapter-access.js +9 -0
  14. package/lib/built/ai-outbound/extensions/onebot-keyboard.d.ts +2 -0
  15. package/lib/built/ai-outbound/extensions/onebot-keyboard.js +67 -0
  16. package/lib/built/ai-outbound/extensions/qq-message.d.ts +3 -0
  17. package/lib/built/ai-outbound/extensions/qq-message.js +23 -0
  18. package/lib/built/ai-outbound/index.d.ts +9 -0
  19. package/lib/built/ai-outbound/index.js +9 -0
  20. package/lib/built/ai-outbound/parse.d.ts +13 -0
  21. package/lib/built/ai-outbound/parse.js +108 -0
  22. package/lib/built/ai-outbound/plain-mention-rewrite.d.ts +6 -0
  23. package/lib/built/ai-outbound/plain-mention-rewrite.js +37 -0
  24. package/lib/built/ai-outbound/prompt.d.ts +11 -0
  25. package/lib/built/ai-outbound/prompt.js +44 -0
  26. package/lib/built/ai-outbound/resolve.d.ts +4 -0
  27. package/lib/built/ai-outbound/resolve.js +64 -0
  28. package/lib/built/ai-outbound/structured-detect.d.ts +3 -0
  29. package/lib/built/ai-outbound/structured-detect.js +7 -0
  30. package/lib/built/ai-outbound/types.d.ts +60 -0
  31. package/lib/built/ai-outbound/types.js +5 -0
  32. package/lib/built/ai-trigger.d.ts +5 -1
  33. package/lib/built/ai-trigger.js +3 -7
  34. package/lib/built/authorization.d.ts +0 -1
  35. package/lib/built/authorization.js +0 -1
  36. package/lib/built/command.d.ts +0 -1
  37. package/lib/built/command.js +1 -3
  38. package/lib/built/common-adapter-tools.d.ts +25 -26
  39. package/lib/built/common-adapter-tools.js +48 -49
  40. package/lib/built/component.d.ts +1 -3
  41. package/lib/built/component.js +2 -4
  42. package/lib/built/config.d.ts +4 -1
  43. package/lib/built/config.js +26 -5
  44. package/lib/built/connect-endpoint-instance.d.ts +0 -1
  45. package/lib/built/connect-endpoint-instance.js +3 -2
  46. package/lib/built/database.d.ts +1 -3
  47. package/lib/built/database.js +2 -4
  48. package/lib/built/dispatcher.d.ts +7 -7
  49. package/lib/built/dispatcher.js +20 -8
  50. package/lib/built/endpoint-commands.d.ts +0 -1
  51. package/lib/built/endpoint-commands.js +6 -9
  52. package/lib/built/endpoint-lifecycle-service.d.ts +2 -1
  53. package/lib/built/endpoint-lifecycle-service.js +26 -3
  54. package/lib/built/endpoint-lifecycle.d.ts +0 -1
  55. package/lib/built/endpoint-lifecycle.js +4 -4
  56. package/lib/built/endpoint-manager.d.ts +0 -1
  57. package/lib/built/endpoint-manager.js +0 -1
  58. package/lib/built/generated-qrcode.d.ts +0 -1
  59. package/lib/built/generated-qrcode.js +0 -1
  60. package/lib/built/generic-segment-mapper.d.ts +6 -0
  61. package/lib/built/generic-segment-mapper.js +232 -0
  62. package/lib/built/html-renderer-loader.d.ts +2 -1
  63. package/lib/built/html-renderer-loader.js +6 -2
  64. package/lib/built/html-segment-fallback.d.ts +0 -1
  65. package/lib/built/html-segment-fallback.js +0 -1
  66. package/lib/built/html-to-text.d.ts +0 -1
  67. package/lib/built/html-to-text.js +15 -15
  68. package/lib/built/inbound-pipeline.d.ts +1 -2
  69. package/lib/built/inbound-pipeline.js +1 -2
  70. package/lib/built/inbound-runner.d.ts +0 -1
  71. package/lib/built/inbound-runner.js +0 -1
  72. package/lib/built/interactive-segment-contract.d.ts +6 -0
  73. package/lib/built/interactive-segment-contract.js +9 -0
  74. package/lib/built/interactive-segments/action.d.ts +17 -0
  75. package/lib/built/interactive-segments/action.js +69 -0
  76. package/lib/built/interactive-segments/button-spec.d.ts +10 -0
  77. package/lib/built/interactive-segments/button-spec.js +21 -0
  78. package/lib/built/interactive-segments/handlers.d.ts +9 -0
  79. package/lib/built/interactive-segments/handlers.js +58 -0
  80. package/lib/built/interactive-segments/index.d.ts +7 -0
  81. package/lib/built/interactive-segments/index.js +7 -0
  82. package/lib/built/interactive-segments/keyboard-segment.d.ts +12 -0
  83. package/lib/built/interactive-segments/keyboard-segment.js +13 -0
  84. package/lib/built/interactive-segments/onebot-keyboard.d.ts +10 -0
  85. package/lib/built/interactive-segments/onebot-keyboard.js +53 -0
  86. package/lib/built/interactive-segments/resolve.d.ts +9 -0
  87. package/lib/built/interactive-segments/resolve.js +84 -0
  88. package/lib/built/interactive-segments/types.d.ts +62 -0
  89. package/lib/built/interactive-segments/types.js +13 -0
  90. package/lib/built/introspection-format.d.ts +0 -1
  91. package/lib/built/introspection-format.js +1 -1
  92. package/lib/built/login-assist.d.ts +0 -1
  93. package/lib/built/login-assist.js +0 -1
  94. package/lib/built/management-command-guard.d.ts +5 -1
  95. package/lib/built/management-command-guard.js +5 -1
  96. package/lib/built/message-enrich.d.ts +1 -2
  97. package/lib/built/message-enrich.js +0 -1
  98. package/lib/built/message-filter.d.ts +0 -1
  99. package/lib/built/message-filter.js +1 -3
  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 +0 -1
  103. package/lib/built/outbound-media-contract.js +0 -1
  104. package/lib/built/outbound-media-utils.d.ts +0 -1
  105. package/lib/built/outbound-media-utils.js +0 -1
  106. package/lib/built/permission.d.ts +0 -1
  107. package/lib/built/permission.js +1 -3
  108. package/lib/built/permit-check.d.ts +1 -2
  109. package/lib/built/permit-check.js +0 -1
  110. package/lib/built/permit-parse.d.ts +0 -1
  111. package/lib/built/permit-parse.js +0 -1
  112. package/lib/built/platform-permit.d.ts +5 -6
  113. package/lib/built/platform-permit.js +11 -12
  114. package/lib/built/prepend-quote-context.d.ts +0 -1
  115. package/lib/built/prepend-quote-context.js +0 -1
  116. package/lib/built/qrcode-segment.d.ts +0 -1
  117. package/lib/built/qrcode-segment.js +0 -1
  118. package/lib/built/queue-im-field-contract.d.ts +6 -1
  119. package/lib/built/queue-im-field-contract.js +10 -1
  120. package/lib/built/rich-segments/adapter-policies.d.ts +1 -2
  121. package/lib/built/rich-segments/adapter-policies.js +0 -1
  122. package/lib/built/rich-segments/base.d.ts +0 -1
  123. package/lib/built/rich-segments/base.js +0 -1
  124. package/lib/built/rich-segments/builtins.d.ts +0 -1
  125. package/lib/built/rich-segments/builtins.js +0 -1
  126. package/lib/built/rich-segments/capabilities.d.ts +0 -1
  127. package/lib/built/rich-segments/capabilities.js +0 -1
  128. package/lib/built/rich-segments/html-segment.d.ts +1 -2
  129. package/lib/built/rich-segments/html-segment.js +0 -1
  130. package/lib/built/rich-segments/index.d.ts +0 -1
  131. package/lib/built/rich-segments/index.js +0 -1
  132. package/lib/built/rich-segments/markdown-segment.d.ts +1 -2
  133. package/lib/built/rich-segments/markdown-segment.js +0 -1
  134. package/lib/built/rich-segments/markdown-to-text.d.ts +0 -1
  135. package/lib/built/rich-segments/markdown-to-text.js +0 -1
  136. package/lib/built/rich-segments/qrcode-segment.d.ts +1 -2
  137. package/lib/built/rich-segments/qrcode-segment.js +0 -1
  138. package/lib/built/rich-segments/registry.d.ts +0 -1
  139. package/lib/built/rich-segments/registry.js +0 -1
  140. package/lib/built/rich-segments/resolve.d.ts +1 -2
  141. package/lib/built/rich-segments/resolve.js +0 -1
  142. package/lib/built/rich-segments/tts-segment.d.ts +1 -2
  143. package/lib/built/rich-segments/tts-segment.js +0 -1
  144. package/lib/built/rich-segments/types.d.ts +0 -1
  145. package/lib/built/rich-segments/types.js +0 -1
  146. package/lib/built/roles.d.ts +0 -1
  147. package/lib/built/roles.js +0 -1
  148. package/lib/built/runtime-io.d.ts +0 -1
  149. package/lib/built/runtime-io.js +0 -1
  150. package/lib/built/schedule.d.ts +54 -0
  151. package/lib/built/schedule.js +112 -0
  152. package/lib/built/schema-endpoint-manager.d.ts +0 -1
  153. package/lib/built/schema-endpoint-manager.js +0 -1
  154. package/lib/built/schema-feature.d.ts +0 -1
  155. package/lib/built/schema-feature.js +1 -3
  156. package/lib/built/segment-contract/assert.d.ts +4 -0
  157. package/lib/built/segment-contract/assert.js +30 -0
  158. package/lib/built/segment-contract/delivery.d.ts +5 -0
  159. package/lib/built/segment-contract/delivery.js +40 -0
  160. package/lib/built/segment-contract/image.d.ts +5 -0
  161. package/lib/built/segment-contract/image.js +10 -0
  162. package/lib/built/segment-contract/index.d.ts +8 -0
  163. package/lib/built/segment-contract/index.js +7 -0
  164. package/lib/built/segment-contract/media.d.ts +8 -0
  165. package/lib/built/segment-contract/media.js +39 -0
  166. package/lib/built/segment-contract/mention.d.ts +10 -0
  167. package/lib/built/segment-contract/mention.js +26 -0
  168. package/lib/built/segment-contract/preview.d.ts +3 -0
  169. package/lib/built/segment-contract/preview.js +159 -0
  170. package/lib/built/segment-contract/types.d.ts +70 -0
  171. package/lib/built/segment-contract/types.js +5 -0
  172. package/lib/built/segment-contract/validate.d.ts +138 -0
  173. package/lib/built/segment-contract/validate.js +124 -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 +2 -1
  177. package/lib/built/speech-loader.js +6 -2
  178. package/lib/built/tool.d.ts +0 -1
  179. package/lib/built/tool.js +1 -3
  180. package/lib/command.d.ts +12 -7
  181. package/lib/command.js +38 -16
  182. package/lib/component.d.ts +0 -1
  183. package/lib/component.js +28 -12
  184. package/lib/endpoint-capabilities.d.ts +3 -1
  185. package/lib/endpoint-capabilities.js +0 -1
  186. package/lib/endpoint.d.ts +0 -1
  187. package/lib/endpoint.js +0 -1
  188. package/lib/errors.d.ts +0 -1
  189. package/lib/errors.js +0 -1
  190. package/lib/host-plugin-registry.d.ts +0 -1
  191. package/lib/host-plugin-registry.js +0 -1
  192. package/lib/im-scene.d.ts +29 -0
  193. package/lib/im-scene.js +77 -0
  194. package/lib/im-session-id.d.ts +25 -12
  195. package/lib/im-session-id.js +35 -17
  196. package/lib/index.d.ts +14 -7
  197. package/lib/index.js +12 -6
  198. package/lib/jsx-dev-runtime.d.ts +0 -1
  199. package/lib/jsx-dev-runtime.js +0 -1
  200. package/lib/jsx-runtime.d.ts +0 -1
  201. package/lib/jsx-runtime.js +0 -1
  202. package/lib/jsx.d.ts +0 -1
  203. package/lib/jsx.js +0 -1
  204. package/lib/message-quote.d.ts +1 -2
  205. package/lib/message-quote.js +2 -3
  206. package/lib/message.d.ts +7 -5
  207. package/lib/message.js +16 -1
  208. package/lib/models/system-log.d.ts +0 -1
  209. package/lib/models/system-log.js +0 -1
  210. package/lib/models/user.d.ts +0 -1
  211. package/lib/models/user.js +0 -1
  212. package/lib/notice.d.ts +15 -59
  213. package/lib/notice.js +1 -4
  214. package/lib/plugin-context.d.ts +0 -1
  215. package/lib/plugin-context.js +0 -1
  216. package/lib/plugin.d.ts +13 -6
  217. package/lib/plugin.js +31 -15
  218. package/lib/prompt.d.ts +0 -1
  219. package/lib/prompt.js +0 -1
  220. package/lib/request.d.ts +16 -60
  221. package/lib/request.js +0 -4
  222. package/lib/side-event/base.d.ts +45 -0
  223. package/lib/side-event/base.js +30 -0
  224. package/lib/side-event/index.d.ts +3 -0
  225. package/lib/side-event/index.js +3 -0
  226. package/lib/side-event/normalize.d.ts +40 -0
  227. package/lib/side-event/normalize.js +117 -0
  228. package/lib/side-event/types.d.ts +25 -0
  229. package/lib/side-event/types.js +55 -0
  230. package/lib/tool-zod.d.ts +0 -1
  231. package/lib/tool-zod.js +0 -1
  232. package/lib/types-generator.d.ts +0 -1
  233. package/lib/types-generator.js +0 -1
  234. package/lib/types.d.ts +30 -11
  235. package/lib/types.js +0 -1
  236. package/lib/utils.d.ts +36 -1
  237. package/lib/utils.js +33 -25
  238. package/package.json +15 -8
  239. package/lib/adapter.d.ts.map +0 -1
  240. package/lib/adapter.js.map +0 -1
  241. package/lib/agent-prompt.d.ts.map +0 -1
  242. package/lib/agent-prompt.js.map +0 -1
  243. package/lib/built/adapter-process.d.ts.map +0 -1
  244. package/lib/built/adapter-process.js.map +0 -1
  245. package/lib/built/agent-preset.d.ts.map +0 -1
  246. package/lib/built/agent-preset.js.map +0 -1
  247. package/lib/built/ai-trigger.d.ts.map +0 -1
  248. package/lib/built/ai-trigger.js.map +0 -1
  249. package/lib/built/authorization.d.ts.map +0 -1
  250. package/lib/built/authorization.js.map +0 -1
  251. package/lib/built/command.d.ts.map +0 -1
  252. package/lib/built/command.js.map +0 -1
  253. package/lib/built/common-adapter-tools.d.ts.map +0 -1
  254. package/lib/built/common-adapter-tools.js.map +0 -1
  255. package/lib/built/component.d.ts.map +0 -1
  256. package/lib/built/component.js.map +0 -1
  257. package/lib/built/config.d.ts.map +0 -1
  258. package/lib/built/config.js.map +0 -1
  259. package/lib/built/connect-endpoint-instance.d.ts.map +0 -1
  260. package/lib/built/connect-endpoint-instance.js.map +0 -1
  261. package/lib/built/cron.d.ts +0 -75
  262. package/lib/built/cron.d.ts.map +0 -1
  263. package/lib/built/cron.js +0 -122
  264. package/lib/built/cron.js.map +0 -1
  265. package/lib/built/database.d.ts.map +0 -1
  266. package/lib/built/database.js.map +0 -1
  267. package/lib/built/dispatcher.d.ts.map +0 -1
  268. package/lib/built/dispatcher.js.map +0 -1
  269. package/lib/built/endpoint-commands.d.ts.map +0 -1
  270. package/lib/built/endpoint-commands.js.map +0 -1
  271. package/lib/built/endpoint-lifecycle-service.d.ts.map +0 -1
  272. package/lib/built/endpoint-lifecycle-service.js.map +0 -1
  273. package/lib/built/endpoint-lifecycle.d.ts.map +0 -1
  274. package/lib/built/endpoint-lifecycle.js.map +0 -1
  275. package/lib/built/endpoint-manager.d.ts.map +0 -1
  276. package/lib/built/endpoint-manager.js.map +0 -1
  277. package/lib/built/generated-qrcode.d.ts.map +0 -1
  278. package/lib/built/generated-qrcode.js.map +0 -1
  279. package/lib/built/html-renderer-loader.d.ts.map +0 -1
  280. package/lib/built/html-renderer-loader.js.map +0 -1
  281. package/lib/built/html-segment-fallback.d.ts.map +0 -1
  282. package/lib/built/html-segment-fallback.js.map +0 -1
  283. package/lib/built/html-to-text.d.ts.map +0 -1
  284. package/lib/built/html-to-text.js.map +0 -1
  285. package/lib/built/inbound-pipeline.d.ts.map +0 -1
  286. package/lib/built/inbound-pipeline.js.map +0 -1
  287. package/lib/built/inbound-runner.d.ts.map +0 -1
  288. package/lib/built/inbound-runner.js.map +0 -1
  289. package/lib/built/introspection-format.d.ts.map +0 -1
  290. package/lib/built/introspection-format.js.map +0 -1
  291. package/lib/built/login-assist.d.ts.map +0 -1
  292. package/lib/built/login-assist.js.map +0 -1
  293. package/lib/built/management-command-guard.d.ts.map +0 -1
  294. package/lib/built/management-command-guard.js.map +0 -1
  295. package/lib/built/mcp-mesh-registrar.d.ts +0 -9
  296. package/lib/built/mcp-mesh-registrar.d.ts.map +0 -1
  297. package/lib/built/mcp-mesh-registrar.js +0 -17
  298. package/lib/built/mcp-mesh-registrar.js.map +0 -1
  299. package/lib/built/message-enrich.d.ts.map +0 -1
  300. package/lib/built/message-enrich.js.map +0 -1
  301. package/lib/built/message-filter.d.ts.map +0 -1
  302. package/lib/built/message-filter.js.map +0 -1
  303. package/lib/built/outbound-media-contract.d.ts.map +0 -1
  304. package/lib/built/outbound-media-contract.js.map +0 -1
  305. package/lib/built/outbound-media-utils.d.ts.map +0 -1
  306. package/lib/built/outbound-media-utils.js.map +0 -1
  307. package/lib/built/permission.d.ts.map +0 -1
  308. package/lib/built/permission.js.map +0 -1
  309. package/lib/built/permit-check.d.ts.map +0 -1
  310. package/lib/built/permit-check.js.map +0 -1
  311. package/lib/built/permit-parse.d.ts.map +0 -1
  312. package/lib/built/permit-parse.js.map +0 -1
  313. package/lib/built/platform-permit.d.ts.map +0 -1
  314. package/lib/built/platform-permit.js.map +0 -1
  315. package/lib/built/prepend-quote-context.d.ts.map +0 -1
  316. package/lib/built/prepend-quote-context.js.map +0 -1
  317. package/lib/built/qrcode-segment.d.ts.map +0 -1
  318. package/lib/built/qrcode-segment.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/rich-segments/adapter-policies.d.ts.map +0 -1
  322. package/lib/built/rich-segments/adapter-policies.js.map +0 -1
  323. package/lib/built/rich-segments/base.d.ts.map +0 -1
  324. package/lib/built/rich-segments/base.js.map +0 -1
  325. package/lib/built/rich-segments/builtins.d.ts.map +0 -1
  326. package/lib/built/rich-segments/builtins.js.map +0 -1
  327. package/lib/built/rich-segments/capabilities.d.ts.map +0 -1
  328. package/lib/built/rich-segments/capabilities.js.map +0 -1
  329. package/lib/built/rich-segments/html-segment.d.ts.map +0 -1
  330. package/lib/built/rich-segments/html-segment.js.map +0 -1
  331. package/lib/built/rich-segments/index.d.ts.map +0 -1
  332. package/lib/built/rich-segments/index.js.map +0 -1
  333. package/lib/built/rich-segments/markdown-segment.d.ts.map +0 -1
  334. package/lib/built/rich-segments/markdown-segment.js.map +0 -1
  335. package/lib/built/rich-segments/markdown-to-text.d.ts.map +0 -1
  336. package/lib/built/rich-segments/markdown-to-text.js.map +0 -1
  337. package/lib/built/rich-segments/qrcode-segment.d.ts.map +0 -1
  338. package/lib/built/rich-segments/qrcode-segment.js.map +0 -1
  339. package/lib/built/rich-segments/registry.d.ts.map +0 -1
  340. package/lib/built/rich-segments/registry.js.map +0 -1
  341. package/lib/built/rich-segments/resolve.d.ts.map +0 -1
  342. package/lib/built/rich-segments/resolve.js.map +0 -1
  343. package/lib/built/rich-segments/tts-segment.d.ts.map +0 -1
  344. package/lib/built/rich-segments/tts-segment.js.map +0 -1
  345. package/lib/built/rich-segments/types.d.ts.map +0 -1
  346. package/lib/built/rich-segments/types.js.map +0 -1
  347. package/lib/built/roles.d.ts.map +0 -1
  348. package/lib/built/roles.js.map +0 -1
  349. package/lib/built/runtime-io.d.ts.map +0 -1
  350. package/lib/built/runtime-io.js.map +0 -1
  351. package/lib/built/schema-endpoint-manager.d.ts.map +0 -1
  352. package/lib/built/schema-endpoint-manager.js.map +0 -1
  353. package/lib/built/schema-feature.d.ts.map +0 -1
  354. package/lib/built/schema-feature.js.map +0 -1
  355. package/lib/built/skill.d.ts.map +0 -1
  356. package/lib/built/skill.js.map +0 -1
  357. package/lib/built/speech-loader.d.ts.map +0 -1
  358. package/lib/built/speech-loader.js.map +0 -1
  359. package/lib/built/tool.d.ts.map +0 -1
  360. package/lib/built/tool.js.map +0 -1
  361. package/lib/command.d.ts.map +0 -1
  362. package/lib/command.js.map +0 -1
  363. package/lib/component.d.ts.map +0 -1
  364. package/lib/component.js.map +0 -1
  365. package/lib/endpoint-capabilities.d.ts.map +0 -1
  366. package/lib/endpoint-capabilities.js.map +0 -1
  367. package/lib/endpoint.d.ts.map +0 -1
  368. package/lib/endpoint.js.map +0 -1
  369. package/lib/errors.d.ts.map +0 -1
  370. package/lib/errors.js.map +0 -1
  371. package/lib/host-plugin-registry.d.ts.map +0 -1
  372. package/lib/host-plugin-registry.js.map +0 -1
  373. package/lib/im-session-id.d.ts.map +0 -1
  374. package/lib/im-session-id.js.map +0 -1
  375. package/lib/index.d.ts.map +0 -1
  376. package/lib/index.js.map +0 -1
  377. package/lib/jsx-dev-runtime.d.ts.map +0 -1
  378. package/lib/jsx-dev-runtime.js.map +0 -1
  379. package/lib/jsx-runtime.d.ts.map +0 -1
  380. package/lib/jsx-runtime.js.map +0 -1
  381. package/lib/jsx.d.ts.map +0 -1
  382. package/lib/jsx.js.map +0 -1
  383. package/lib/message-quote.d.ts.map +0 -1
  384. package/lib/message-quote.js.map +0 -1
  385. package/lib/message.d.ts.map +0 -1
  386. package/lib/message.js.map +0 -1
  387. package/lib/models/system-log.d.ts.map +0 -1
  388. package/lib/models/system-log.js.map +0 -1
  389. package/lib/models/user.d.ts.map +0 -1
  390. package/lib/models/user.js.map +0 -1
  391. package/lib/notice.d.ts.map +0 -1
  392. package/lib/notice.js.map +0 -1
  393. package/lib/plugin-context.d.ts.map +0 -1
  394. package/lib/plugin-context.js.map +0 -1
  395. package/lib/plugin.d.ts.map +0 -1
  396. package/lib/plugin.js.map +0 -1
  397. package/lib/prompt.d.ts.map +0 -1
  398. package/lib/prompt.js.map +0 -1
  399. package/lib/request.d.ts.map +0 -1
  400. package/lib/request.js.map +0 -1
  401. package/lib/scheduler/scheduler.d.ts +0 -49
  402. package/lib/scheduler/scheduler.d.ts.map +0 -1
  403. package/lib/scheduler/scheduler.js +0 -352
  404. package/lib/scheduler/scheduler.js.map +0 -1
  405. package/lib/scheduler/types.d.ts +0 -71
  406. package/lib/scheduler/types.d.ts.map +0 -1
  407. package/lib/scheduler/types.js +0 -8
  408. package/lib/scheduler/types.js.map +0 -1
  409. package/lib/tool-zod.d.ts.map +0 -1
  410. package/lib/tool-zod.js.map +0 -1
  411. package/lib/types-generator.d.ts.map +0 -1
  412. package/lib/types-generator.js.map +0 -1
  413. package/lib/types.d.ts.map +0 -1
  414. package/lib/types.js.map +0 -1
  415. package/lib/utils.d.ts.map +0 -1
  416. package/lib/utils.js.map +0 -1
@@ -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
+ /** 检测入站是否含 handoff / @ 意图(协作群 structured_only 信号)。 */
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
+ /** 检测入站是否含 handoff / @ 意图(协作群 structured_only 信号)。 */
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(endpointIds, text, ctx) {
3
+ const segments = [];
4
+ for (const endpointId of endpointIds) {
5
+ const target = ctx.atIdResolver?.(endpointId) ?? endpointId;
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 endpointIds = [];
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 (!endpointIds.includes(resolved))
29
+ endpointIds.push(resolved);
30
+ }
31
+ return { ok: true, endpointIds };
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.endpointIds, 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,7 @@
1
+ /** structured_only:满足任一即进入结构化出站模式。 */
2
+ export function isStructuredOutboundRequired(input) {
3
+ return Boolean(input.collaborationCell
4
+ || input.toolRequiresStructured
5
+ || input.inboundHandoffIntent
6
+ || input.adapterHasExtensions);
7
+ }
@@ -0,0 +1,60 @@
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
+ (endpointId: string): string;
39
+ }
40
+ /** 解析 AI 出站 JSON 时的上下文。 */
41
+ export interface AiOutboundParseContext {
42
+ message: Message;
43
+ /** 将 peer ref(role/endpoint/primary)解析为 endpointId */
44
+ mentionResolver?: AiOutboundMentionResolver;
45
+ /** 将 endpointId 解析为 platform @ id */
46
+ atIdResolver?: AiOutboundAtIdResolver;
47
+ /** Adapter 声明的 extensions(运行时从 Adapter 静态属性注入) */
48
+ extensions?: readonly AiOutboundExtensionDefinition[];
49
+ }
50
+ export interface StructuredOutboundDetectInput {
51
+ /** 协作 Cell 活跃且可能 @ peer */
52
+ collaborationCell?: boolean;
53
+ /** 工具链要求结构化出站(如 group_delegate message JSON) */
54
+ toolRequiresStructured?: boolean;
55
+ /** 用户入站含 handoff / @ 意图 */
56
+ inboundHandoffIntent?: boolean;
57
+ /** Adapter 声明 extensions 且非空 */
58
+ adapterHasExtensions?: boolean;
59
+ }
60
+ 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
+ };
@@ -39,6 +39,11 @@ export interface AITriggerConfig {
39
39
  trusted?: string[];
40
40
  /** 是否在 AI 入参前拉取 $quote_id 对应消息正文(默认 true) */
41
41
  resolveQuotedMessages?: boolean;
42
+ /**
43
+ * 协作单元内 peer Bot 入站策略(ADR 0023)。
44
+ * mention-only:仅被 @ 时触发;off:与普通人消息相同规则。
45
+ */
46
+ peerMode?: 'mention-only' | 'off';
42
47
  }
43
48
  /**
44
49
  * AI 触发检查结果
@@ -97,4 +102,3 @@ export declare function shouldTriggerAI<T extends object>(message: Message<T>, c
97
102
  * 合并配置
98
103
  */
99
104
  export declare function mergeAITriggerConfig(config: AITriggerConfig): Required<AITriggerConfig>;
100
- //# sourceMappingURL=ai-trigger.d.ts.map
@@ -9,6 +9,7 @@
9
9
  * 4. 关键词触发 - 非群/频道场景下匹配关键词时触发
10
10
  */
11
11
  import { segment } from "../utils.js";
12
+ import { readMentionSegmentTarget } from './segment-contract/mention.js';
12
13
  import { normalizeSenderRoles, } from './roles.js';
13
14
  // ============================================================================
14
15
  // 默认配置
@@ -26,6 +27,7 @@ export const DEFAULT_AI_TRIGGER_CONFIG = {
26
27
  masters: [],
27
28
  trusted: [],
28
29
  resolveQuotedMessages: true,
30
+ peerMode: 'mention-only',
29
31
  };
30
32
  // ============================================================================
31
33
  // 工具函数
@@ -35,12 +37,7 @@ function normalizeAtIds(endpointAtIds) {
35
37
  return [...new Set(ids.map((id) => String(id)).filter(Boolean))];
36
38
  }
37
39
  function segmentAtUserId(seg) {
38
- const { data } = seg;
39
- if (!data || typeof data !== 'object')
40
- return '';
41
- const record = data;
42
- const raw = record.user_id ?? record.qq ?? record.id;
43
- return raw == null ? '' : String(raw);
40
+ return readMentionSegmentTarget(seg);
44
41
  }
45
42
  function isAtSegmentForEndpoint(seg, endpointIds) {
46
43
  if (seg.type !== 'at' && seg.type !== 'mention')
@@ -233,4 +230,3 @@ export function shouldTriggerAI(message, config, options) {
233
230
  export function mergeAITriggerConfig(config) {
234
231
  return { ...DEFAULT_AI_TRIGGER_CONFIG, ...config };
235
232
  }
236
- //# sourceMappingURL=ai-trigger.js.map
@@ -8,4 +8,3 @@ import { type SenderRolesResult } from './ai-trigger.js';
8
8
  * 从 ConfigFeature + Message 重算发送者角色(含群角色与 master/trusted)
9
9
  */
10
10
  export declare function resolveSubjectRoles(plugin: Plugin, message: Message<any>): SenderRolesResult;
11
- //# sourceMappingURL=authorization.d.ts.map
@@ -50,4 +50,3 @@ export function resolveSubjectRoles(plugin, message) {
50
50
  const endpointConfig = readEndpointConfig(plugin, message);
51
51
  return resolveSenderRoles(message, triggerConfig, endpointConfig);
52
52
  }
53
- //# sourceMappingURL=authorization.js.map
@@ -67,4 +67,3 @@ export declare class CommandFeature extends Feature<MessageCommand<RegisteredAda
67
67
  addCommand<T extends RegisteredAdapter>(command: MessageCommand<T>): () => void;
68
68
  };
69
69
  }
70
- //# sourceMappingURL=command.d.ts.map
@@ -19,7 +19,6 @@ export function compareCommandPatterns(a, b) {
19
19
  const tokB = b.trim().split(/\s+/).length;
20
20
  return tokB - tokA;
21
21
  }
22
- import { getPlugin } from "../plugin.js";
23
22
  /**
24
23
  * 命令服务 Feature
25
24
  */
@@ -92,7 +91,7 @@ export class CommandFeature extends Feature {
92
91
  const feature = this;
93
92
  return {
94
93
  addCommand(command) {
95
- const plugin = getPlugin();
94
+ const plugin = this;
96
95
  const dispose = feature.add(command, plugin.name);
97
96
  plugin.recordFeatureContribution(feature.name, command.pattern);
98
97
  plugin.onDispose(dispose);
@@ -101,4 +100,3 @@ export class CommandFeature extends Feature {
101
100
  };
102
101
  }
103
102
  }
104
- //# sourceMappingURL=command.js.map
@@ -1,36 +1,36 @@
1
1
  /**
2
- * Group Management — 方法规范与 Tool 工厂
2
+ * Scene Management — 方法规范与 Tool 工厂
3
3
  *
4
4
  * 设计理念:
5
- * 各 IM 平台在适配器内自行实现群管方法(kickMember、muteMember 等),
5
+ * 各 IM 平台在适配器内自行实现场景治理方法(removeMember、muteMember 等),
6
6
  * 并自行注册 Tool;平台说明使用包内 `skills/<adapter>/SKILL.md`。
7
7
  *
8
8
  * 使用方式(在各适配器 start 或注册方法中):
9
9
  *
10
- * import { createGroupManagementTools, GROUP_MANAGEMENT_SKILL_KEYWORDS, GROUP_MANAGEMENT_SKILL_TAGS } from 'zhin.js';
11
- * const tools = createGroupManagementTools(this, this.name);
10
+ * import { createSceneManagementTools, SCENE_MANAGEMENT_SKILL_KEYWORDS, SCENE_MANAGEMENT_SKILL_TAGS } from 'zhin.js';
11
+ * const tools = createSceneManagementTools(this, this.name);
12
12
  * tools.forEach(t => this.addTool(t));
13
13
  * // 另:包内 skills/<name>/SKILL.md 供 Agent 发现
14
14
  */
15
15
  import type { Tool } from '../types.js';
16
16
  /**
17
- * 群管理能力接口。
17
+ * 场景治理能力接口。
18
18
  * Adapter 基类通过此接口声明方法签名,子类选择性覆写。
19
19
  */
20
- export interface IGroupManagement {
21
- kickMember?(endpointId: string, sceneId: string, userId: string): Promise<any>;
20
+ export interface ISceneManagement {
21
+ removeMember?(endpointId: string, sceneId: string, userId: string): Promise<any>;
22
22
  muteMember?(endpointId: string, sceneId: string, userId: string, duration?: number): Promise<any>;
23
23
  setMemberNickname?(endpointId: string, sceneId: string, userId: string, nickname: string): Promise<any>;
24
- setAdmin?(endpointId: string, sceneId: string, userId: string, enable?: boolean): Promise<any>;
24
+ setModerator?(endpointId: string, sceneId: string, userId: string, enable?: boolean): Promise<any>;
25
25
  listMembers?(endpointId: string, sceneId: string): Promise<any>;
26
26
  banMember?(endpointId: string, sceneId: string, userId: string, reason?: string): Promise<any>;
27
27
  unbanMember?(endpointId: string, sceneId: string, userId: string): Promise<any>;
28
- setGroupName?(endpointId: string, sceneId: string, name: string): Promise<any>;
29
- muteAll?(endpointId: string, sceneId: string, enable?: boolean): Promise<any>;
30
- getGroupInfo?(endpointId: string, sceneId: string): Promise<any>;
28
+ renameScene?(endpointId: string, sceneId: string, name: string): Promise<any>;
29
+ setSceneMuted?(endpointId: string, sceneId: string, enable?: boolean): Promise<any>;
30
+ getSceneInfo?(endpointId: string, sceneId: string): Promise<any>;
31
31
  }
32
- export interface GroupMethodSpec {
33
- method: keyof IGroupManagement;
32
+ export interface SceneManagementMethodSpec {
33
+ method: keyof ISceneManagement;
34
34
  toolSuffix: string;
35
35
  description: string;
36
36
  keywords: string[];
@@ -43,20 +43,19 @@ export interface GroupMethodSpec {
43
43
  extraRequired?: string[];
44
44
  preExecutable?: boolean;
45
45
  }
46
- export declare const GROUP_METHOD_SPECS: GroupMethodSpec[];
47
- export declare const GROUP_MANAGEMENT_SKILL_TAGS: string[];
48
- export declare const GROUP_MANAGEMENT_SKILL_KEYWORDS: string[];
49
- export interface GroupManagementToolFactory<T> {
50
- (spec: GroupMethodSpec, prefix: string, execute: (args: Record<string, any>) => Promise<any>): T;
46
+ export declare const SCENE_MANAGEMENT_METHOD_SPECS: SceneManagementMethodSpec[];
47
+ export declare const SCENE_MANAGEMENT_SKILL_TAGS: string[];
48
+ export declare const SCENE_MANAGEMENT_SKILL_KEYWORDS: string[];
49
+ export interface SceneManagementToolFactory<T> {
50
+ (spec: SceneManagementMethodSpec, prefix: string, execute: (args: Record<string, any>) => Promise<any>): T;
51
51
  }
52
- export declare function defaultQqGroupPermitResolver(adapterPrefix: string): (logicalPerm: string) => string;
53
- export interface CreateGroupManagementToolsOptions {
54
- /** 将 GROUP_METHOD_SPECS 逻辑 perm(group_admin/group_owner)映射为 platform(...) 字符串 */
52
+ export declare function defaultScenePermitResolver(adapterPrefix: string): (logicalPerm: string) => string;
53
+ export interface CreateSceneManagementToolsOptions {
54
+ /** 将 SCENE_MANAGEMENT_METHOD_SPECS 逻辑 perm(scene_admin/scene_owner)映射为 platform(...) 字符串 */
55
55
  permitResolver?: (logicalPerm: string) => string | undefined;
56
- /** 是否注册默认 QQ 系 group checker(默认 true) */
56
+ /** 是否注册默认 QQ 系 scene checker(默认 true) */
57
57
  registerChecker?: boolean;
58
58
  }
59
- export declare function createGroupManagementTools(adapter: IGroupManagement, prefix: string, options?: CreateGroupManagementToolsOptions): Tool[];
60
- export declare function createGroupManagementToolsRaw<T>(adapter: IGroupManagement, prefix: string, factory: GroupManagementToolFactory<T>): T[];
61
- export declare function buildMethodArgs(method: keyof IGroupManagement, endpointId: string, sceneId: string, rest: Record<string, any>): any[];
62
- //# sourceMappingURL=common-adapter-tools.d.ts.map
59
+ export declare function createSceneManagementTools(adapter: ISceneManagement, prefix: string, options?: CreateSceneManagementToolsOptions): Tool[];
60
+ export declare function createSceneManagementToolsRaw<T>(adapter: ISceneManagement, prefix: string, factory: SceneManagementToolFactory<T>): T[];
61
+ export declare function buildSceneMethodArgs(method: keyof ISceneManagement, endpointId: string, sceneId: string, rest: Record<string, any>): any[];
@@ -1,25 +1,25 @@
1
1
  /**
2
- * Group Management — 方法规范与 Tool 工厂
2
+ * Scene Management — 方法规范与 Tool 工厂
3
3
  *
4
4
  * 设计理念:
5
- * 各 IM 平台在适配器内自行实现群管方法(kickMember、muteMember 等),
5
+ * 各 IM 平台在适配器内自行实现场景治理方法(removeMember、muteMember 等),
6
6
  * 并自行注册 Tool;平台说明使用包内 `skills/<adapter>/SKILL.md`。
7
7
  *
8
8
  * 使用方式(在各适配器 start 或注册方法中):
9
9
  *
10
- * import { createGroupManagementTools, GROUP_MANAGEMENT_SKILL_KEYWORDS, GROUP_MANAGEMENT_SKILL_TAGS } from 'zhin.js';
11
- * const tools = createGroupManagementTools(this, this.name);
10
+ * import { createSceneManagementTools, SCENE_MANAGEMENT_SKILL_KEYWORDS, SCENE_MANAGEMENT_SKILL_TAGS } from 'zhin.js';
11
+ * const tools = createSceneManagementTools(this, this.name);
12
12
  * tools.forEach(t => this.addTool(t));
13
13
  * // 另:包内 skills/<name>/SKILL.md 供 Agent 发现
14
14
  */
15
- import { registerDefaultGroupPlatformPermitChecker } from './platform-permit.js';
16
- export const GROUP_METHOD_SPECS = [
15
+ import { registerDefaultScenePlatformPermitChecker } from './platform-permit.js';
16
+ export const SCENE_MANAGEMENT_METHOD_SPECS = [
17
17
  {
18
- method: 'kickMember',
19
- toolSuffix: 'kick_member',
20
- description: '将成员踢出群/服务器。适用于严重违规、广告号等需要移除的场景。踢出后该成员将无法再进入群聊(部分平台可重新邀请)。如果只需要用户名而没有 user_id,请先调用 list_members 查询',
18
+ method: 'removeMember',
19
+ toolSuffix: 'remove_member',
20
+ description: '将成员移出当前 IM 场景。适用于严重违规、广告号等需要移除的场景。如果只需要用户名而没有 user_id,请先调用 list_members 查询',
21
21
  keywords: ['踢', 'kick', '移除', '踢出'],
22
- permit: 'group_admin',
22
+ permit: 'scene_admin',
23
23
  extraParams: {
24
24
  user_id: { type: 'string', description: '目标用户 ID(如果只有昵称,先用 list_members 查询获取)' },
25
25
  },
@@ -30,7 +30,7 @@ export const GROUP_METHOD_SPECS = [
30
30
  toolSuffix: 'mute_member',
31
31
  description: '禁言或解除禁言群成员。适用于违规发言、刷屏、骚扰他人等需要临时限制发言的场景。duration 单位为秒,传 0 表示解除禁言。默认禁言 10 分钟(600秒)。如果只有昵称而没有 user_id,请先调用 list_members 查询',
32
32
  keywords: ['禁言', 'mute', '静音', '解除禁言', '解禁', '闭嘴'],
33
- permit: 'group_admin',
33
+ permit: 'scene_admin',
34
34
  extraParams: {
35
35
  user_id: { type: 'string', description: '目标用户 ID(如果只有昵称,先用 list_members 查询获取)' },
36
36
  duration: { type: 'number', description: '禁言时长(秒),0=解除禁言,默认600(10分钟)。常用值:60=1分钟, 600=10分钟, 3600=1小时, 86400=1天', default: 600 },
@@ -42,7 +42,7 @@ export const GROUP_METHOD_SPECS = [
42
42
  toolSuffix: 'set_nickname',
43
43
  description: '设置群成员的群昵称/名片。仅修改群内显示名称,不影响用户的全局昵称。如果只有昵称而没有 user_id,请先调用 list_members 查询',
44
44
  keywords: ['昵称', '名片', 'nickname', 'card', '改名片'],
45
- permit: 'group_admin',
45
+ permit: 'scene_admin',
46
46
  extraParams: {
47
47
  user_id: { type: 'string', description: '目标用户 ID(如果只有昵称,先用 list_members 查询获取)' },
48
48
  nickname: { type: 'string', description: '新的群昵称/名片' },
@@ -50,11 +50,11 @@ export const GROUP_METHOD_SPECS = [
50
50
  extraRequired: ['user_id', 'nickname'],
51
51
  },
52
52
  {
53
- method: 'setAdmin',
54
- toolSuffix: 'set_admin',
55
- description: '设置或取消群管理员。注意:此操作需要群主权限,普通管理员无法执行。enable=true 为设置管理员,enable=false 为取消管理员。如果只有昵称而没有 user_id,请先调用 list_members 查询',
53
+ method: 'setModerator',
54
+ toolSuffix: 'set_moderator',
55
+ description: '设置或取消场景管理员。注意:此操作通常需要场景所有者权限。enable=true 为设置管理员,enable=false 为取消管理员。如果只有昵称而没有 user_id,请先调用 list_members 查询',
56
56
  keywords: ['管理员', 'admin', '设置管理', '取消管理', '提升管理', '撤销管理'],
57
- permit: 'group_owner',
57
+ permit: 'scene_owner',
58
58
  extraParams: {
59
59
  user_id: { type: 'string', description: '目标用户 ID(如果只有昵称,先用 list_members 查询获取)' },
60
60
  enable: { type: 'boolean', description: 'true=设置为管理员,false=取消管理员身份', default: true },
@@ -74,7 +74,7 @@ export const GROUP_METHOD_SPECS = [
74
74
  toolSuffix: 'ban_member',
75
75
  description: '永久封禁成员(拉入黑名单)。与踢人(kick)不同,封禁后该成员无法再加入群聊。适用于恶意用户、严重违规等需要永久禁止的场景。如果只有昵称而没有 user_id,请先调用 list_members 查询',
76
76
  keywords: ['封禁', 'ban', '拉黑', '黑名单'],
77
- permit: 'group_admin',
77
+ permit: 'scene_admin',
78
78
  extraParams: {
79
79
  user_id: { type: 'string', description: '目标用户 ID(如果只有昵称,先用 list_members 查询获取)' },
80
80
  reason: { type: 'string', description: '封禁原因(将记录在封禁日志中)' },
@@ -86,37 +86,37 @@ export const GROUP_METHOD_SPECS = [
86
86
  toolSuffix: 'unban_member',
87
87
  description: '解除封禁,将成员从黑名单中移除。解除后该成员可以重新加入群聊。如果只有昵称而没有 user_id,请先调用 list_members 查询',
88
88
  keywords: ['解封', 'unban', '解除封禁', '移出黑名单'],
89
- permit: 'group_admin',
89
+ permit: 'scene_admin',
90
90
  extraParams: {
91
91
  user_id: { type: 'string', description: '目标用户 ID(如果只有昵称,先用 list_members 查询获取)' },
92
92
  },
93
93
  extraRequired: ['user_id'],
94
94
  },
95
95
  {
96
- method: 'setGroupName',
97
- toolSuffix: 'set_group_name',
98
- description: '修改群/服务器名称。修改后所有成员立即可见新群名',
96
+ method: 'renameScene',
97
+ toolSuffix: 'rename_scene',
98
+ description: '修改 IM 场景名称。修改后所有成员立即可见新名称',
99
99
  keywords: ['群名', '改名', 'group name', '修改群名'],
100
- permit: 'group_admin',
100
+ permit: 'scene_admin',
101
101
  extraParams: {
102
102
  name: { type: 'string', description: '新群名称' },
103
103
  },
104
104
  extraRequired: ['name'],
105
105
  },
106
106
  {
107
- method: 'muteAll',
108
- toolSuffix: 'mute_all',
109
- description: '开启或关闭全员禁言。开启后除管理员外所有成员都无法发言。适用于紧急维护、重要通知、聊天秩序混乱等场景。enable=true 开启,enable=false 解除',
107
+ method: 'setSceneMuted',
108
+ toolSuffix: 'set_scene_muted',
109
+ description: '开启或关闭场景全员禁言。开启后除管理员外所有成员都无法发言。适用于紧急维护、重要通知、聊天秩序混乱等场景。enable=true 开启,enable=false 解除',
110
110
  keywords: ['全员禁言', 'mute all', '全体禁言', '全体解禁'],
111
- permit: 'group_admin',
111
+ permit: 'scene_admin',
112
112
  extraParams: {
113
113
  enable: { type: 'boolean', description: 'true=开启全员禁言,false=解除全员禁言', default: true },
114
114
  },
115
115
  },
116
116
  {
117
- method: 'getGroupInfo',
118
- toolSuffix: 'get_group_info',
119
- description: '获取群/服务器基本信息,包括群名、群主、成员数量、创建时间等。用于了解群聊概况',
117
+ method: 'getSceneInfo',
118
+ toolSuffix: 'get_scene_info',
119
+ description: '获取 IM 场景基本信息,包括名称、所有者、成员数量、创建时间等。用于了解场景概况',
120
120
  keywords: ['群信息', 'group info', '群资料', '群详情'],
121
121
  extraParams: {},
122
122
  preExecutable: true,
@@ -125,12 +125,12 @@ export const GROUP_METHOD_SPECS = [
125
125
  // ============================================================================
126
126
  // Skill 常量(群管相关 SKILL.md 与文档可复用 keywords/tags)
127
127
  // ============================================================================
128
- export const GROUP_MANAGEMENT_SKILL_TAGS = ['group', 'management', 'im', 'admin'];
129
- export const GROUP_MANAGEMENT_SKILL_KEYWORDS = [
130
- '群管理', '踢人', '禁言', '封禁', '管理员', '群名',
128
+ export const SCENE_MANAGEMENT_SKILL_TAGS = ['scene', 'management', 'im', 'admin'];
129
+ export const SCENE_MANAGEMENT_SKILL_KEYWORDS = [
130
+ '场景治理', '群管理', '踢人', '禁言', '封禁', '管理员', '群名',
131
131
  '成员', 'kick', 'mute', 'ban', 'admin', 'members',
132
132
  ];
133
- export function defaultQqGroupPermitResolver(adapterPrefix) {
133
+ export function defaultScenePermitResolver(adapterPrefix) {
134
134
  return (logicalPerm) => `platform(${adapterPrefix},${logicalPerm})`;
135
135
  }
136
136
  function resolveSpecPermit(specPerm, prefix, permitResolver) {
@@ -139,12 +139,12 @@ function resolveSpecPermit(specPerm, prefix, permitResolver) {
139
139
  const resolved = permitResolver(specPerm);
140
140
  return resolved ? [resolved] : undefined;
141
141
  }
142
- export function createGroupManagementTools(adapter, prefix, options = {}) {
143
- const permitResolver = options.permitResolver ?? defaultQqGroupPermitResolver(prefix);
142
+ export function createSceneManagementTools(adapter, prefix, options = {}) {
143
+ const permitResolver = options.permitResolver ?? defaultScenePermitResolver(prefix);
144
144
  if (options.registerChecker !== false) {
145
- registerDefaultGroupPlatformPermitChecker(prefix);
145
+ registerDefaultScenePlatformPermitChecker(prefix);
146
146
  }
147
- return createGroupManagementToolsRaw(adapter, prefix, (spec, prefix, execute) => {
147
+ return createSceneManagementToolsRaw(adapter, prefix, (spec, prefix, execute) => {
148
148
  const specPermissions = resolveSpecPermit(spec.permit, prefix, permitResolver);
149
149
  return {
150
150
  name: `${prefix}_${spec.toolSuffix}`,
@@ -153,13 +153,13 @@ export function createGroupManagementTools(adapter, prefix, options = {}) {
153
153
  type: 'object',
154
154
  properties: {
155
155
  endpoint_id: { type: 'string', description: 'Endpoint ID', contextKey: 'endpointId' },
156
- scene_id: { type: 'string', description: '群/服务器 ID', contextKey: 'sceneId' },
156
+ scene_id: { type: 'string', description: 'IM 场景 ID', contextKey: 'sceneId' },
157
157
  ...Object.fromEntries(Object.entries(spec.extraParams)),
158
158
  },
159
159
  required: ['endpoint_id', 'scene_id', ...(spec.extraRequired ?? [])],
160
160
  },
161
161
  execute,
162
- tags: ['group', 'management', prefix],
162
+ tags: ['scene', 'management', prefix],
163
163
  keywords: spec.keywords,
164
164
  ...(specPermissions ? { permissions: specPermissions } : {}),
165
165
  scopes: ['group', 'channel'],
@@ -167,16 +167,16 @@ export function createGroupManagementTools(adapter, prefix, options = {}) {
167
167
  };
168
168
  });
169
169
  }
170
- export function createGroupManagementToolsRaw(adapter, prefix, factory) {
170
+ export function createSceneManagementToolsRaw(adapter, prefix, factory) {
171
171
  const tools = [];
172
- for (const spec of GROUP_METHOD_SPECS) {
172
+ for (const spec of SCENE_MANAGEMENT_METHOD_SPECS) {
173
173
  const fn = adapter[spec.method];
174
174
  if (typeof fn !== 'function')
175
175
  continue;
176
176
  const boundFn = fn.bind(adapter);
177
177
  const execute = async (args) => {
178
178
  const { endpoint_id, scene_id, ...rest } = args;
179
- const methodArgs = buildMethodArgs(spec.method, endpoint_id, scene_id, rest);
179
+ const methodArgs = buildSceneMethodArgs(spec.method, endpoint_id, scene_id, rest);
180
180
  return boundFn.apply(adapter, methodArgs);
181
181
  };
182
182
  tools.push(factory(spec, prefix, execute));
@@ -186,19 +186,18 @@ export function createGroupManagementToolsRaw(adapter, prefix, factory) {
186
186
  // ============================================================================
187
187
  // 参数映射(method → 有序参数列表)
188
188
  // ============================================================================
189
- export function buildMethodArgs(method, endpointId, sceneId, rest) {
189
+ export function buildSceneMethodArgs(method, endpointId, sceneId, rest) {
190
190
  switch (method) {
191
- case 'kickMember': return [endpointId, sceneId, rest.user_id];
191
+ case 'removeMember': return [endpointId, sceneId, rest.user_id];
192
192
  case 'muteMember': return [endpointId, sceneId, rest.user_id, rest.duration ?? 600];
193
193
  case 'setMemberNickname': return [endpointId, sceneId, rest.user_id, rest.nickname];
194
- case 'setAdmin': return [endpointId, sceneId, rest.user_id, rest.enable ?? true];
194
+ case 'setModerator': return [endpointId, sceneId, rest.user_id, rest.enable ?? true];
195
195
  case 'listMembers': return [endpointId, sceneId];
196
196
  case 'banMember': return [endpointId, sceneId, rest.user_id, rest.reason];
197
197
  case 'unbanMember': return [endpointId, sceneId, rest.user_id];
198
- case 'setGroupName': return [endpointId, sceneId, rest.name];
199
- case 'muteAll': return [endpointId, sceneId, rest.enable ?? true];
200
- case 'getGroupInfo': return [endpointId, sceneId];
198
+ case 'renameScene': return [endpointId, sceneId, rest.name];
199
+ case 'setSceneMuted': return [endpointId, sceneId, rest.enable ?? true];
200
+ case 'getSceneInfo': return [endpointId, sceneId];
201
201
  default: return [endpointId, sceneId, ...Object.values(rest)];
202
202
  }
203
203
  }
204
- //# sourceMappingURL=common-adapter-tools.js.map
@@ -2,9 +2,8 @@
2
2
  * ComponentFeature
3
3
  * 管理所有插件注册的组件,继承自 Feature 抽象类
4
4
  */
5
- import { Feature, FeatureJSON } from "@zhin.js/kernel";
5
+ import { Feature, FeatureJSON, type PluginLike } from '@zhin.js/kernel';
6
6
  import { Component } from "../component.js";
7
- import type { PluginLike } from '@zhin.js/kernel';
8
7
  /**
9
8
  * ComponentContext 扩展方法类型
10
9
  */
@@ -66,4 +65,3 @@ export declare class ComponentFeature extends Feature<Component<any>> {
66
65
  addComponent<T extends Component<any>>(component: T): () => void;
67
66
  };
68
67
  }
69
- //# sourceMappingURL=component.d.ts.map