@zhin.js/core 1.3.2 → 1.3.3

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 (408) hide show
  1. package/README.md +7 -7
  2. package/lib/adapter.d.ts +22 -2
  3. package/lib/adapter.js +71 -1
  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 +94 -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 +0 -1
  41. package/lib/built/component.js +1 -3
  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 +0 -1
  47. package/lib/built/database.js +1 -3
  48. package/lib/built/dispatcher.d.ts +6 -6
  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 +25 -3
  54. package/lib/built/endpoint-lifecycle.d.ts +0 -1
  55. package/lib/built/endpoint-lifecycle.js +0 -1
  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 +0 -1
  68. package/lib/built/inbound-pipeline.d.ts +0 -1
  69. package/lib/built/inbound-pipeline.js +0 -1
  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 +54 -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 +0 -1
  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 +0 -1
  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 +55 -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 +0 -1
  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 +13 -7
  197. package/lib/index.js +11 -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 +0 -1
  213. package/lib/notice.js +0 -1
  214. package/lib/plugin-context.d.ts +0 -1
  215. package/lib/plugin-context.js +0 -1
  216. package/lib/plugin.d.ts +11 -2
  217. package/lib/plugin.js +19 -7
  218. package/lib/prompt.d.ts +0 -1
  219. package/lib/prompt.js +0 -1
  220. package/lib/request.d.ts +0 -1
  221. package/lib/request.js +0 -1
  222. package/lib/tool-zod.d.ts +0 -1
  223. package/lib/tool-zod.js +0 -1
  224. package/lib/types-generator.d.ts +0 -1
  225. package/lib/types-generator.js +0 -1
  226. package/lib/types.d.ts +30 -11
  227. package/lib/types.js +0 -1
  228. package/lib/utils.d.ts +36 -1
  229. package/lib/utils.js +33 -25
  230. package/package.json +15 -8
  231. package/lib/adapter.d.ts.map +0 -1
  232. package/lib/adapter.js.map +0 -1
  233. package/lib/agent-prompt.d.ts.map +0 -1
  234. package/lib/agent-prompt.js.map +0 -1
  235. package/lib/built/adapter-process.d.ts.map +0 -1
  236. package/lib/built/adapter-process.js.map +0 -1
  237. package/lib/built/agent-preset.d.ts.map +0 -1
  238. package/lib/built/agent-preset.js.map +0 -1
  239. package/lib/built/ai-trigger.d.ts.map +0 -1
  240. package/lib/built/ai-trigger.js.map +0 -1
  241. package/lib/built/authorization.d.ts.map +0 -1
  242. package/lib/built/authorization.js.map +0 -1
  243. package/lib/built/command.d.ts.map +0 -1
  244. package/lib/built/command.js.map +0 -1
  245. package/lib/built/common-adapter-tools.d.ts.map +0 -1
  246. package/lib/built/common-adapter-tools.js.map +0 -1
  247. package/lib/built/component.d.ts.map +0 -1
  248. package/lib/built/component.js.map +0 -1
  249. package/lib/built/config.d.ts.map +0 -1
  250. package/lib/built/config.js.map +0 -1
  251. package/lib/built/connect-endpoint-instance.d.ts.map +0 -1
  252. package/lib/built/connect-endpoint-instance.js.map +0 -1
  253. package/lib/built/cron.d.ts +0 -75
  254. package/lib/built/cron.d.ts.map +0 -1
  255. package/lib/built/cron.js +0 -122
  256. package/lib/built/cron.js.map +0 -1
  257. package/lib/built/database.d.ts.map +0 -1
  258. package/lib/built/database.js.map +0 -1
  259. package/lib/built/dispatcher.d.ts.map +0 -1
  260. package/lib/built/dispatcher.js.map +0 -1
  261. package/lib/built/endpoint-commands.d.ts.map +0 -1
  262. package/lib/built/endpoint-commands.js.map +0 -1
  263. package/lib/built/endpoint-lifecycle-service.d.ts.map +0 -1
  264. package/lib/built/endpoint-lifecycle-service.js.map +0 -1
  265. package/lib/built/endpoint-lifecycle.d.ts.map +0 -1
  266. package/lib/built/endpoint-lifecycle.js.map +0 -1
  267. package/lib/built/endpoint-manager.d.ts.map +0 -1
  268. package/lib/built/endpoint-manager.js.map +0 -1
  269. package/lib/built/generated-qrcode.d.ts.map +0 -1
  270. package/lib/built/generated-qrcode.js.map +0 -1
  271. package/lib/built/html-renderer-loader.d.ts.map +0 -1
  272. package/lib/built/html-renderer-loader.js.map +0 -1
  273. package/lib/built/html-segment-fallback.d.ts.map +0 -1
  274. package/lib/built/html-segment-fallback.js.map +0 -1
  275. package/lib/built/html-to-text.d.ts.map +0 -1
  276. package/lib/built/html-to-text.js.map +0 -1
  277. package/lib/built/inbound-pipeline.d.ts.map +0 -1
  278. package/lib/built/inbound-pipeline.js.map +0 -1
  279. package/lib/built/inbound-runner.d.ts.map +0 -1
  280. package/lib/built/inbound-runner.js.map +0 -1
  281. package/lib/built/introspection-format.d.ts.map +0 -1
  282. package/lib/built/introspection-format.js.map +0 -1
  283. package/lib/built/login-assist.d.ts.map +0 -1
  284. package/lib/built/login-assist.js.map +0 -1
  285. package/lib/built/management-command-guard.d.ts.map +0 -1
  286. package/lib/built/management-command-guard.js.map +0 -1
  287. package/lib/built/mcp-mesh-registrar.d.ts +0 -9
  288. package/lib/built/mcp-mesh-registrar.d.ts.map +0 -1
  289. package/lib/built/mcp-mesh-registrar.js +0 -17
  290. package/lib/built/mcp-mesh-registrar.js.map +0 -1
  291. package/lib/built/message-enrich.d.ts.map +0 -1
  292. package/lib/built/message-enrich.js.map +0 -1
  293. package/lib/built/message-filter.d.ts.map +0 -1
  294. package/lib/built/message-filter.js.map +0 -1
  295. package/lib/built/outbound-media-contract.d.ts.map +0 -1
  296. package/lib/built/outbound-media-contract.js.map +0 -1
  297. package/lib/built/outbound-media-utils.d.ts.map +0 -1
  298. package/lib/built/outbound-media-utils.js.map +0 -1
  299. package/lib/built/permission.d.ts.map +0 -1
  300. package/lib/built/permission.js.map +0 -1
  301. package/lib/built/permit-check.d.ts.map +0 -1
  302. package/lib/built/permit-check.js.map +0 -1
  303. package/lib/built/permit-parse.d.ts.map +0 -1
  304. package/lib/built/permit-parse.js.map +0 -1
  305. package/lib/built/platform-permit.d.ts.map +0 -1
  306. package/lib/built/platform-permit.js.map +0 -1
  307. package/lib/built/prepend-quote-context.d.ts.map +0 -1
  308. package/lib/built/prepend-quote-context.js.map +0 -1
  309. package/lib/built/qrcode-segment.d.ts.map +0 -1
  310. package/lib/built/qrcode-segment.js.map +0 -1
  311. package/lib/built/queue-im-field-contract.d.ts.map +0 -1
  312. package/lib/built/queue-im-field-contract.js.map +0 -1
  313. package/lib/built/rich-segments/adapter-policies.d.ts.map +0 -1
  314. package/lib/built/rich-segments/adapter-policies.js.map +0 -1
  315. package/lib/built/rich-segments/base.d.ts.map +0 -1
  316. package/lib/built/rich-segments/base.js.map +0 -1
  317. package/lib/built/rich-segments/builtins.d.ts.map +0 -1
  318. package/lib/built/rich-segments/builtins.js.map +0 -1
  319. package/lib/built/rich-segments/capabilities.d.ts.map +0 -1
  320. package/lib/built/rich-segments/capabilities.js.map +0 -1
  321. package/lib/built/rich-segments/html-segment.d.ts.map +0 -1
  322. package/lib/built/rich-segments/html-segment.js.map +0 -1
  323. package/lib/built/rich-segments/index.d.ts.map +0 -1
  324. package/lib/built/rich-segments/index.js.map +0 -1
  325. package/lib/built/rich-segments/markdown-segment.d.ts.map +0 -1
  326. package/lib/built/rich-segments/markdown-segment.js.map +0 -1
  327. package/lib/built/rich-segments/markdown-to-text.d.ts.map +0 -1
  328. package/lib/built/rich-segments/markdown-to-text.js.map +0 -1
  329. package/lib/built/rich-segments/qrcode-segment.d.ts.map +0 -1
  330. package/lib/built/rich-segments/qrcode-segment.js.map +0 -1
  331. package/lib/built/rich-segments/registry.d.ts.map +0 -1
  332. package/lib/built/rich-segments/registry.js.map +0 -1
  333. package/lib/built/rich-segments/resolve.d.ts.map +0 -1
  334. package/lib/built/rich-segments/resolve.js.map +0 -1
  335. package/lib/built/rich-segments/tts-segment.d.ts.map +0 -1
  336. package/lib/built/rich-segments/tts-segment.js.map +0 -1
  337. package/lib/built/rich-segments/types.d.ts.map +0 -1
  338. package/lib/built/rich-segments/types.js.map +0 -1
  339. package/lib/built/roles.d.ts.map +0 -1
  340. package/lib/built/roles.js.map +0 -1
  341. package/lib/built/runtime-io.d.ts.map +0 -1
  342. package/lib/built/runtime-io.js.map +0 -1
  343. package/lib/built/schema-endpoint-manager.d.ts.map +0 -1
  344. package/lib/built/schema-endpoint-manager.js.map +0 -1
  345. package/lib/built/schema-feature.d.ts.map +0 -1
  346. package/lib/built/schema-feature.js.map +0 -1
  347. package/lib/built/skill.d.ts.map +0 -1
  348. package/lib/built/skill.js.map +0 -1
  349. package/lib/built/speech-loader.d.ts.map +0 -1
  350. package/lib/built/speech-loader.js.map +0 -1
  351. package/lib/built/tool.d.ts.map +0 -1
  352. package/lib/built/tool.js.map +0 -1
  353. package/lib/command.d.ts.map +0 -1
  354. package/lib/command.js.map +0 -1
  355. package/lib/component.d.ts.map +0 -1
  356. package/lib/component.js.map +0 -1
  357. package/lib/endpoint-capabilities.d.ts.map +0 -1
  358. package/lib/endpoint-capabilities.js.map +0 -1
  359. package/lib/endpoint.d.ts.map +0 -1
  360. package/lib/endpoint.js.map +0 -1
  361. package/lib/errors.d.ts.map +0 -1
  362. package/lib/errors.js.map +0 -1
  363. package/lib/host-plugin-registry.d.ts.map +0 -1
  364. package/lib/host-plugin-registry.js.map +0 -1
  365. package/lib/im-session-id.d.ts.map +0 -1
  366. package/lib/im-session-id.js.map +0 -1
  367. package/lib/index.d.ts.map +0 -1
  368. package/lib/index.js.map +0 -1
  369. package/lib/jsx-dev-runtime.d.ts.map +0 -1
  370. package/lib/jsx-dev-runtime.js.map +0 -1
  371. package/lib/jsx-runtime.d.ts.map +0 -1
  372. package/lib/jsx-runtime.js.map +0 -1
  373. package/lib/jsx.d.ts.map +0 -1
  374. package/lib/jsx.js.map +0 -1
  375. package/lib/message-quote.d.ts.map +0 -1
  376. package/lib/message-quote.js.map +0 -1
  377. package/lib/message.d.ts.map +0 -1
  378. package/lib/message.js.map +0 -1
  379. package/lib/models/system-log.d.ts.map +0 -1
  380. package/lib/models/system-log.js.map +0 -1
  381. package/lib/models/user.d.ts.map +0 -1
  382. package/lib/models/user.js.map +0 -1
  383. package/lib/notice.d.ts.map +0 -1
  384. package/lib/notice.js.map +0 -1
  385. package/lib/plugin-context.d.ts.map +0 -1
  386. package/lib/plugin-context.js.map +0 -1
  387. package/lib/plugin.d.ts.map +0 -1
  388. package/lib/plugin.js.map +0 -1
  389. package/lib/prompt.d.ts.map +0 -1
  390. package/lib/prompt.js.map +0 -1
  391. package/lib/request.d.ts.map +0 -1
  392. package/lib/request.js.map +0 -1
  393. package/lib/scheduler/scheduler.d.ts +0 -49
  394. package/lib/scheduler/scheduler.d.ts.map +0 -1
  395. package/lib/scheduler/scheduler.js +0 -352
  396. package/lib/scheduler/scheduler.js.map +0 -1
  397. package/lib/scheduler/types.d.ts +0 -71
  398. package/lib/scheduler/types.d.ts.map +0 -1
  399. package/lib/scheduler/types.js +0 -8
  400. package/lib/scheduler/types.js.map +0 -1
  401. package/lib/tool-zod.d.ts.map +0 -1
  402. package/lib/tool-zod.js.map +0 -1
  403. package/lib/types-generator.d.ts.map +0 -1
  404. package/lib/types-generator.js.map +0 -1
  405. package/lib/types.d.ts.map +0 -1
  406. package/lib/types.js.map +0 -1
  407. package/lib/utils.d.ts.map +0 -1
  408. package/lib/utils.js.map +0 -1
@@ -7,4 +7,3 @@ import type { SendContent } from '../types.js';
7
7
  export declare function coerceHtmlSegmentsToText(content: SendContent): SendContent;
8
8
  /** 注册链尾 before.sendMessage:将未转换的 html 段降级为 text */
9
9
  export declare function registerHtmlSegmentFallback(plugin: Plugin): () => void;
10
- //# sourceMappingURL=html-segment-fallback.d.ts.map
@@ -47,4 +47,3 @@ export function registerHtmlSegmentFallback(plugin) {
47
47
  plugin.root.on('before.sendMessage', handler);
48
48
  return () => plugin.root.off('before.sendMessage', handler);
49
49
  }
50
- //# sourceMappingURL=html-segment-fallback.js.map
@@ -14,4 +14,3 @@ export declare function htmlToPlainTextWithBlockBreaks(html: string, options?: H
14
14
  * HTML 卡片出站回退:块级换行 + 语义标题轻量 markdown 前缀。
15
15
  */
16
16
  export declare function htmlToFallbackText(html: string, options?: HtmlToPlainTextOptions): string;
17
- //# sourceMappingURL=html-to-text.d.ts.map
@@ -163,4 +163,3 @@ export function htmlToFallbackText(html, options) {
163
163
  .replace(/\n{3,}/g, '\n\n')
164
164
  .trim();
165
165
  }
166
- //# sourceMappingURL=html-to-text.js.map
@@ -35,4 +35,3 @@ export declare class InboundMessagePipeline {
35
35
  bridgeNoticeOrRequest(event: string, args: unknown[], directEmit: () => boolean): boolean;
36
36
  private logIncoming;
37
37
  }
38
- //# sourceMappingURL=inbound-pipeline.d.ts.map
@@ -62,4 +62,3 @@ export class InboundMessagePipeline {
62
62
  }));
63
63
  }
64
64
  }
65
- //# sourceMappingURL=inbound-pipeline.js.map
@@ -20,4 +20,3 @@ export interface InboundRunResult {
20
20
  * Agent / 业务逻辑一致。
21
21
  */
22
22
  export declare function runInboundMessage(options: RunInboundMessageOptions): Promise<InboundRunResult>;
23
- //# sourceMappingURL=inbound-runner.d.ts.map
@@ -34,4 +34,3 @@ export async function runInboundMessage(options) {
34
34
  emitAdapterObservers();
35
35
  return { dispatched: !!dispatcher };
36
36
  }
37
- //# sourceMappingURL=inbound-runner.js.map
@@ -0,0 +1,6 @@
1
+ import type { InteractivePolicy } from './interactive-segments/types.js';
2
+ /** 契约测试:adapter 须声明 interactivePolicy */
3
+ export declare function assertAdapterDeclaresInteractivePolicy(adapterClass: {
4
+ interactivePolicy?: InteractivePolicy;
5
+ }): void;
6
+ export type { InteractivePolicy };
@@ -0,0 +1,9 @@
1
+ /** 契约测试:adapter 须声明 interactivePolicy */
2
+ export function assertAdapterDeclaresInteractivePolicy(adapterClass) {
3
+ if (!adapterClass.interactivePolicy) {
4
+ throw new Error('Adapter must declare static interactivePolicy');
5
+ }
6
+ if (adapterClass.interactivePolicy !== 'native' && adapterClass.interactivePolicy !== 'text') {
7
+ throw new Error('interactivePolicy must be "native" or "text"');
8
+ }
9
+ }
@@ -0,0 +1,17 @@
1
+ import type { Message } from '../../message.js';
2
+ import type { MessageElement } from '../../types.js';
3
+ import { type ActionSegmentData } from './types.js';
4
+ export declare function actionSegment(data: ActionSegmentData): MessageElement;
5
+ export declare function getActionFromMessage(message: Message<any>): ActionSegmentData | undefined;
6
+ /** 入站互动 action(按钮点击等),不应计入用户发言/消息统计 */
7
+ export declare function isActionMessage(message: Message<any>): boolean;
8
+ /** 去掉 @bot、XML at 段、首尾空白(QQ 指令预填文本归一化) */
9
+ export declare function stripInteractiveCommandText(raw: string): string;
10
+ /** 从文本降级输入解析 payload(需在 active session 的 fallback.map 中查找) */
11
+ export declare function resolveTextFallbackPayload(raw: string, map: Record<string, string>): string | undefined;
12
+ /**
13
+ * 从用户文本入站解析 interactive payload:
14
+ * 归一化 → 直接匹配 prefix:session:id → fallback 数字映射
15
+ */
16
+ export declare function resolvePayloadFromText(raw: string, map?: Record<string, string>): string | undefined;
17
+ export declare function formatActionAsRaw(data: ActionSegmentData): string;
@@ -0,0 +1,54 @@
1
+ import { ACTION_SEGMENT_TYPE, isActionSegment, } from './types.js';
2
+ export function actionSegment(data) {
3
+ return { type: ACTION_SEGMENT_TYPE, data };
4
+ }
5
+ export function getActionFromMessage(message) {
6
+ for (const item of message.$content ?? []) {
7
+ if (typeof item === 'string')
8
+ continue;
9
+ if (isActionSegment(item))
10
+ return item.data;
11
+ }
12
+ return undefined;
13
+ }
14
+ /** 入站互动 action(按钮点击等),不应计入用户发言/消息统计 */
15
+ export function isActionMessage(message) {
16
+ return getActionFromMessage(message) != null;
17
+ }
18
+ const PAYLOAD_PATTERN = /^[a-z0-9_]+:[^:\s]+:[a-z0-9_-]+$/i;
19
+ /** 去掉 @bot、XML at 段、首尾空白(QQ 指令预填文本归一化) */
20
+ export function stripInteractiveCommandText(raw) {
21
+ let text = raw.trim();
22
+ text = text.replace(/<at\s[^>]*\/>/gi, ' ');
23
+ text = text.replace(/^@\S+\s+/u, '');
24
+ text = text.replace(/\s+/g, ' ').trim();
25
+ return text;
26
+ }
27
+ /** 从文本降级输入解析 payload(需在 active session 的 fallback.map 中查找) */
28
+ export function resolveTextFallbackPayload(raw, map) {
29
+ const trimmed = raw.trim();
30
+ if (map[trimmed])
31
+ return map[trimmed];
32
+ const match = trimmed.match(/^(?:ttt\s+)?(\d)$/i);
33
+ if (match && map[match[1]])
34
+ return map[match[1]];
35
+ return undefined;
36
+ }
37
+ /**
38
+ * 从用户文本入站解析 interactive payload:
39
+ * 归一化 → 直接匹配 prefix:session:id → fallback 数字映射
40
+ */
41
+ export function resolvePayloadFromText(raw, map) {
42
+ const normalized = stripInteractiveCommandText(raw);
43
+ if (!normalized)
44
+ return undefined;
45
+ if (PAYLOAD_PATTERN.test(normalized))
46
+ return normalized;
47
+ if (map && Object.keys(map).length > 0) {
48
+ return resolveTextFallbackPayload(normalized, map);
49
+ }
50
+ return undefined;
51
+ }
52
+ export function formatActionAsRaw(data) {
53
+ return data.payload;
54
+ }
@@ -0,0 +1,10 @@
1
+ import type { ButtonData } from './types.js';
2
+ /** 键盘布局单元:`segment.button()` 产物,仅用于组装 `segment.keyboard()` */
3
+ export declare class ButtonSpec {
4
+ readonly data: ButtonData;
5
+ constructor(data: ButtonData);
6
+ }
7
+ export type KeyboardRowInput = Array<ButtonSpec | ButtonData>;
8
+ export declare function isButtonLike(value: unknown): value is ButtonSpec | ButtonData;
9
+ export declare function normalizeButton(btn: ButtonSpec | ButtonData): ButtonData;
10
+ export declare function normalizeKeyboardRows(rows: KeyboardRowInput[]): ButtonData[][];
@@ -0,0 +1,21 @@
1
+ /** 键盘布局单元:`segment.button()` 产物,仅用于组装 `segment.keyboard()` */
2
+ export class ButtonSpec {
3
+ data;
4
+ constructor(data) {
5
+ this.data = data;
6
+ }
7
+ }
8
+ export function isButtonLike(value) {
9
+ if (value == null || typeof value !== 'object')
10
+ return false;
11
+ if (value instanceof ButtonSpec)
12
+ return true;
13
+ const v = value;
14
+ return typeof v.id === 'string' && typeof v.label === 'string' && typeof v.payload === 'string';
15
+ }
16
+ export function normalizeButton(btn) {
17
+ return btn instanceof ButtonSpec ? btn.data : btn;
18
+ }
19
+ export function normalizeKeyboardRows(rows) {
20
+ return rows.map((row) => row.map(normalizeButton));
21
+ }
@@ -0,0 +1,9 @@
1
+ import type { Message } from '../../message.js';
2
+ import type { MessageMiddleware } from '../../types.js';
3
+ import type { InteractiveHandler, RegisteredInteractiveHandler } from './types.js';
4
+ export declare function registerInteractiveHandler(prefix: string, handler: InteractiveHandler): () => void;
5
+ export declare function getInteractiveHandlers(): readonly RegisteredInteractiveHandler[];
6
+ export declare function resetInteractiveHandlersForTests(): void;
7
+ /** 在根插件上安装一次性 action 路由中间件(幂等) */
8
+ export declare function ensureInteractiveMiddleware(addMiddleware: (mw: MessageMiddleware) => () => void): void;
9
+ export declare function dispatchInteractiveAction(message: Message<any>): Promise<boolean>;
@@ -0,0 +1,58 @@
1
+ import { getActionFromMessage } from './action.js';
2
+ const handlers = [];
3
+ let middlewareInstalled = false;
4
+ function findHandler(payload) {
5
+ let match;
6
+ for (const entry of handlers) {
7
+ if (payload.startsWith(entry.prefix)) {
8
+ if (!match || entry.prefix.length > match.prefix.length) {
9
+ match = entry;
10
+ }
11
+ }
12
+ }
13
+ return match?.handler;
14
+ }
15
+ export function registerInteractiveHandler(prefix, handler) {
16
+ const entry = { prefix, handler };
17
+ handlers.push(entry);
18
+ const dispose = () => {
19
+ const idx = handlers.indexOf(entry);
20
+ if (idx >= 0)
21
+ handlers.splice(idx, 1);
22
+ };
23
+ return dispose;
24
+ }
25
+ export function getInteractiveHandlers() {
26
+ return handlers;
27
+ }
28
+ export function resetInteractiveHandlersForTests() {
29
+ handlers.length = 0;
30
+ middlewareInstalled = false;
31
+ }
32
+ /** 在根插件上安装一次性 action 路由中间件(幂等) */
33
+ export function ensureInteractiveMiddleware(addMiddleware) {
34
+ if (middlewareInstalled)
35
+ return;
36
+ middlewareInstalled = true;
37
+ addMiddleware(async (message, next) => {
38
+ const action = getActionFromMessage(message);
39
+ if (!action)
40
+ return next();
41
+ const handler = findHandler(action.payload);
42
+ if (!handler)
43
+ return next();
44
+ const handled = await handler(message);
45
+ if (handled)
46
+ return;
47
+ return next();
48
+ });
49
+ }
50
+ export async function dispatchInteractiveAction(message) {
51
+ const action = getActionFromMessage(message);
52
+ if (!action)
53
+ return false;
54
+ const handler = findHandler(action.payload);
55
+ if (!handler)
56
+ return false;
57
+ return !!(await handler(message));
58
+ }
@@ -0,0 +1,7 @@
1
+ export * from './types.js';
2
+ export * from './button-spec.js';
3
+ export * from './action.js';
4
+ export * from './resolve.js';
5
+ export * from './handlers.js';
6
+ export { KeyboardSegment, InteractiveSegment } from './keyboard-segment.js';
7
+ export * from './onebot-keyboard.js';
@@ -0,0 +1,7 @@
1
+ export * from './types.js';
2
+ export * from './button-spec.js';
3
+ export * from './action.js';
4
+ export * from './resolve.js';
5
+ export * from './handlers.js';
6
+ export { KeyboardSegment, InteractiveSegment } from './keyboard-segment.js';
7
+ export * from './onebot-keyboard.js';
@@ -0,0 +1,12 @@
1
+ import { type KeyboardSegmentData } from './types.js';
2
+ export declare class KeyboardSegment {
3
+ readonly data: KeyboardSegmentData;
4
+ readonly segmentType: "keyboard";
5
+ constructor(data: KeyboardSegmentData);
6
+ toElement(): {
7
+ type: "keyboard";
8
+ data: KeyboardSegmentData;
9
+ };
10
+ }
11
+ /** @deprecated 使用 {@link KeyboardSegment} */
12
+ export declare const InteractiveSegment: typeof KeyboardSegment;
@@ -0,0 +1,13 @@
1
+ import { KEYBOARD_SEGMENT_TYPE } from './types.js';
2
+ export class KeyboardSegment {
3
+ data;
4
+ segmentType = KEYBOARD_SEGMENT_TYPE;
5
+ constructor(data) {
6
+ this.data = data;
7
+ }
8
+ toElement() {
9
+ return { type: this.segmentType, data: this.data };
10
+ }
11
+ }
12
+ /** @deprecated 使用 {@link KeyboardSegment} */
13
+ export const InteractiveSegment = KeyboardSegment;
@@ -0,0 +1,10 @@
1
+ import type { MessageSegment, SendContent } from '../../types.js';
2
+ import { type KeyboardSegmentData } from './types.js';
3
+ /** OneBot / QQ 系 keyboard 段(各 adapter 在 $sendMessage 中识别) */
4
+ export declare function keyboardToOneBotSegment(data: KeyboardSegmentData): MessageSegment;
5
+ /** @deprecated 使用 {@link keyboardToOneBotSegment} */
6
+ export declare const interactiveToKeyboardSegment: typeof keyboardToOneBotSegment;
7
+ /** 出站前将 core keyboard 段展开为 OneBot keyboard(保留前置 text 等段) */
8
+ export declare function expandKeyboardSegmentsInContent(content: SendContent): SendContent;
9
+ /** @deprecated 使用 {@link expandKeyboardSegmentsInContent} */
10
+ export declare const expandInteractiveSegmentsInContent: typeof expandKeyboardSegmentsInContent;
@@ -0,0 +1,53 @@
1
+ import { isKeyboardSegment } from './types.js';
2
+ import { KeyboardSegment } from './keyboard-segment.js';
3
+ /** OneBot / QQ 系 keyboard 段(各 adapter 在 $sendMessage 中识别) */
4
+ export function keyboardToOneBotSegment(data) {
5
+ return {
6
+ type: 'keyboard',
7
+ data: {
8
+ rows: data.rows.map((row) => row.map((btn) => ({
9
+ label: btn.label,
10
+ data: btn.payload,
11
+ enter: false,
12
+ action_type: 'callback',
13
+ disable: !!btn.disabled,
14
+ }))),
15
+ },
16
+ };
17
+ }
18
+ /** @deprecated 使用 {@link keyboardToOneBotSegment} */
19
+ export const interactiveToKeyboardSegment = keyboardToOneBotSegment;
20
+ function asKeyboardData(item) {
21
+ if (item instanceof KeyboardSegment)
22
+ return item.data;
23
+ if (isKeyboardSegment(item))
24
+ return item.data;
25
+ return null;
26
+ }
27
+ /** 出站前将 core keyboard 段展开为 OneBot keyboard(保留前置 text 等段) */
28
+ export function expandKeyboardSegmentsInContent(content) {
29
+ const items = Array.isArray(content) ? content : [content];
30
+ const out = [];
31
+ for (const item of items) {
32
+ if (typeof item === 'string') {
33
+ out.push(item);
34
+ continue;
35
+ }
36
+ if (typeof item.type !== 'string') {
37
+ continue;
38
+ }
39
+ const data = asKeyboardData(item);
40
+ if (data) {
41
+ out.push(keyboardToOneBotSegment(data));
42
+ continue;
43
+ }
44
+ out.push(item);
45
+ }
46
+ if (out.length === 0)
47
+ return { type: 'text', data: { text: '' } };
48
+ if (out.length === 1)
49
+ return out[0];
50
+ return out;
51
+ }
52
+ /** @deprecated 使用 {@link expandKeyboardSegmentsInContent} */
53
+ export const expandInteractiveSegmentsInContent = expandKeyboardSegmentsInContent;
@@ -0,0 +1,9 @@
1
+ import type { SendContent } from '../../types.js';
2
+ import { type InteractivePolicy } from './types.js';
3
+ export declare function hasKeyboardSegment(content: SendContent | undefined): boolean;
4
+ /** @deprecated 使用 {@link hasKeyboardSegment} */
5
+ export declare const hasInteractiveSegment: typeof hasKeyboardSegment;
6
+ /** 按 Adapter interactivePolicy 将 keyboard 段转为 native 保留或文本降级 */
7
+ export declare function resolveKeyboardSegments(content: SendContent, policy: InteractivePolicy): SendContent;
8
+ /** @deprecated 使用 {@link resolveKeyboardSegments} */
9
+ export declare const resolveInteractiveSegments: typeof resolveKeyboardSegments;
@@ -0,0 +1,84 @@
1
+ import { segment } from '../../utils.js';
2
+ import { KeyboardSegment } from './keyboard-segment.js';
3
+ import { KEYBOARD_SEGMENT_TYPE, isKeyboardSegment, } from './types.js';
4
+ function asKeyboardData(item) {
5
+ if (item instanceof KeyboardSegment)
6
+ return item.data;
7
+ if (isKeyboardSegment(item))
8
+ return item.data;
9
+ return null;
10
+ }
11
+ function toKeyboardElement(data) {
12
+ return { type: KEYBOARD_SEGMENT_TYPE, data };
13
+ }
14
+ function asArray(content) {
15
+ return Array.isArray(content) ? content : [content];
16
+ }
17
+ function packSegments(out) {
18
+ if (out.length === 0)
19
+ return { type: 'text', data: { text: '' } };
20
+ if (out.length === 1)
21
+ return out[0];
22
+ return out;
23
+ }
24
+ function renderKeyboardAsText(data) {
25
+ const lines = [];
26
+ const flat = data.rows.flat();
27
+ if (data.fallback?.hint) {
28
+ lines.push(data.fallback.hint);
29
+ }
30
+ else {
31
+ lines.push('请选择(回复数字):');
32
+ }
33
+ const map = data.fallback?.map ?? {};
34
+ const entries = Object.keys(map).length > 0
35
+ ? Object.entries(map).sort(([a], [b]) => Number(a) - Number(b))
36
+ : flat.map((btn, idx) => [String(idx + 1), btn.payload]);
37
+ for (const [key, payload] of entries) {
38
+ const btn = flat.find((b) => b.payload === payload);
39
+ const label = btn?.label ?? '·';
40
+ lines.push(`${key}. ${label}${btn?.disabled ? ' (不可用)' : ''}`);
41
+ }
42
+ return lines.join('\n');
43
+ }
44
+ export function hasKeyboardSegment(content) {
45
+ if (content == null)
46
+ return false;
47
+ return asArray(content).some((item) => {
48
+ if (typeof item === 'string')
49
+ return false;
50
+ return item instanceof KeyboardSegment || isKeyboardSegment(item);
51
+ });
52
+ }
53
+ /** @deprecated 使用 {@link hasKeyboardSegment} */
54
+ export const hasInteractiveSegment = hasKeyboardSegment;
55
+ /** 按 Adapter interactivePolicy 将 keyboard 段转为 native 保留或文本降级 */
56
+ export function resolveKeyboardSegments(content, policy) {
57
+ if (!hasKeyboardSegment(content))
58
+ return content;
59
+ const items = asArray(content);
60
+ const out = [];
61
+ for (const item of items) {
62
+ if (typeof item === 'string') {
63
+ out.push(item);
64
+ continue;
65
+ }
66
+ const data = item instanceof KeyboardSegment
67
+ ? item.data
68
+ : isKeyboardSegment(item)
69
+ ? item.data
70
+ : null;
71
+ if (!data) {
72
+ out.push(item);
73
+ continue;
74
+ }
75
+ if (policy === 'native') {
76
+ out.push(toKeyboardElement(data));
77
+ continue;
78
+ }
79
+ out.push(segment.text(renderKeyboardAsText(data)));
80
+ }
81
+ return packSegments(out);
82
+ }
83
+ /** @deprecated 使用 {@link resolveKeyboardSegments} */
84
+ export const resolveInteractiveSegments = resolveKeyboardSegments;
@@ -0,0 +1,62 @@
1
+ import type { MessageElement } from '../../types.js';
2
+ export declare const KEYBOARD_SEGMENT_TYPE: "keyboard";
3
+ /** @deprecated 使用 {@link KEYBOARD_SEGMENT_TYPE} */
4
+ export declare const INTERACTIVE_SEGMENT_TYPE: "keyboard";
5
+ export declare const ACTION_SEGMENT_TYPE: "action";
6
+ export type ButtonStyle = 'primary' | 'danger' | 'secondary';
7
+ /** @deprecated 使用 {@link ButtonStyle} */
8
+ export type InteractiveButtonStyle = ButtonStyle;
9
+ /** callback:平台回调 action 入站;command:QQ 指令预填后文本入站 */
10
+ export type ButtonInteractionMode = 'callback' | 'command';
11
+ export interface ButtonCommandOptions {
12
+ /** QQ action.enter — 仅单聊;预填后自动发送 */
13
+ enter?: boolean;
14
+ /** QQ action.reply — 预填时引用原消息 */
15
+ reply?: boolean;
16
+ }
17
+ export interface ButtonData {
18
+ id: string;
19
+ label: string;
20
+ payload: string;
21
+ disabled?: boolean;
22
+ style?: ButtonStyle;
23
+ /** 默认 callback */
24
+ mode?: ButtonInteractionMode;
25
+ command?: ButtonCommandOptions;
26
+ }
27
+ /** @deprecated 使用 {@link ButtonData} */
28
+ export type InteractiveButton = ButtonData;
29
+ export interface KeyboardFallback {
30
+ hint: string;
31
+ map: Record<string, string>;
32
+ }
33
+ /** @deprecated 使用 {@link KeyboardFallback} */
34
+ export type InteractiveFallback = KeyboardFallback;
35
+ export interface KeyboardSegmentData {
36
+ rows: ButtonData[][];
37
+ fallback?: KeyboardFallback;
38
+ }
39
+ /** @deprecated 使用 {@link KeyboardSegmentData} */
40
+ export type InteractiveSegmentData = KeyboardSegmentData;
41
+ export interface ActionSegmentData {
42
+ id: string;
43
+ payload: string;
44
+ sourceMessageId?: string;
45
+ }
46
+ export type InteractivePolicy = 'native' | 'text';
47
+ export declare const DEFAULT_INTERACTIVE_POLICY: InteractivePolicy;
48
+ export type InteractiveHandler = (message: import('../../message.js').Message<any>) => Promise<boolean> | boolean;
49
+ export interface RegisteredInteractiveHandler {
50
+ prefix: string;
51
+ handler: InteractiveHandler;
52
+ }
53
+ export declare function isKeyboardSegment(item: MessageElement): item is MessageElement & {
54
+ type: typeof KEYBOARD_SEGMENT_TYPE;
55
+ data: KeyboardSegmentData;
56
+ };
57
+ /** @deprecated 使用 {@link isKeyboardSegment} */
58
+ export declare const isInteractiveSegment: typeof isKeyboardSegment;
59
+ export declare function isActionSegment(item: MessageElement): item is MessageElement & {
60
+ type: typeof ACTION_SEGMENT_TYPE;
61
+ data: ActionSegmentData;
62
+ };
@@ -0,0 +1,13 @@
1
+ export const KEYBOARD_SEGMENT_TYPE = 'keyboard';
2
+ /** @deprecated 使用 {@link KEYBOARD_SEGMENT_TYPE} */
3
+ export const INTERACTIVE_SEGMENT_TYPE = KEYBOARD_SEGMENT_TYPE;
4
+ export const ACTION_SEGMENT_TYPE = 'action';
5
+ export const DEFAULT_INTERACTIVE_POLICY = 'text';
6
+ export function isKeyboardSegment(item) {
7
+ return item != null && typeof item === 'object' && 'type' in item && item.type === KEYBOARD_SEGMENT_TYPE;
8
+ }
9
+ /** @deprecated 使用 {@link isKeyboardSegment} */
10
+ export const isInteractiveSegment = isKeyboardSegment;
11
+ export function isActionSegment(item) {
12
+ return item != null && typeof item === 'object' && 'type' in item && item.type === ACTION_SEGMENT_TYPE;
13
+ }
@@ -8,4 +8,3 @@ export interface EndpointRow {
8
8
  }
9
9
  export declare function formatEndpointsList(endpoints: EndpointRow[]): string;
10
10
  export declare function endpointHelpText(): string;
11
- //# sourceMappingURL=introspection-format.d.ts.map
@@ -21,8 +21,8 @@ export function endpointHelpText() {
21
21
  ' /endpoint start <adapter> <name>',
22
22
  ' /endpoint stop <adapter> <name>',
23
23
  ' /endpoint cancel — 取消进行中的添加/绑定',
24
+ ' /endpoint sync — 将内存 endpoint 写回 zhin.config',
24
25
  ' /endpoint help',
25
26
  ' /endpoints — 查看运行时在线状态',
26
27
  ].join('\n');
27
28
  }
28
- //# sourceMappingURL=introspection-format.js.map
@@ -58,4 +58,3 @@ declare module '../plugin.js' {
58
58
  }
59
59
  }
60
60
  }
61
- //# sourceMappingURL=login-assist.d.ts.map
@@ -72,4 +72,3 @@ export class LoginAssist {
72
72
  this.pending.clear();
73
73
  }
74
74
  }
75
- //# sourceMappingURL=login-assist.js.map
@@ -5,7 +5,11 @@ import { resolveSenderRoles, type AITriggerConfig } from './ai-trigger.js';
5
5
  import type { Message } from '../message.js';
6
6
  import type { Plugin } from '../plugin.js';
7
7
  export declare const MANAGEMENT_COMMAND_DENIED = "\u26A0\uFE0F \u8BE5\u547D\u4EE4\u4EC5 Endpoint Owner\uFF08master\uFF09\u6216 trusted \u64CD\u4F5C\u5458\u53EF\u7528\u3002";
8
+ /** 运维 / 内省 / Endpoint 管理命令:仅 master 或 trusted 可执行与展示 */
9
+ export declare const MANAGEMENT_OPERATOR_PERMIT: "role(master,trusted)";
10
+ /** Endpoint Owner 私聊专用命令(如 /approve) */
11
+ export declare const OWNER_OPERATOR_PERMIT: "role(master)";
12
+ export declare const OWNER_PRIVATE_PERMITS: readonly ["role(master)", "private(*)"];
8
13
  export declare function resolveManagementCommandRoles(message: Message, root: Plugin, triggerConfig?: AITriggerConfig): ReturnType<typeof resolveSenderRoles>['roles'];
9
14
  /** 通过返回 null;拒绝返回用户可见提示文案 */
10
15
  export declare function rejectUnlessManagementOperator(message: Message, root: Plugin, triggerConfig?: AITriggerConfig): string | null;
11
- //# sourceMappingURL=management-command-guard.d.ts.map
@@ -4,6 +4,11 @@
4
4
  import { mergeAITriggerConfig, resolveSenderRoles, } from './ai-trigger.js';
5
5
  import { hasSenderRole } from './roles.js';
6
6
  export const MANAGEMENT_COMMAND_DENIED = '⚠️ 该命令仅 Endpoint Owner(master)或 trusted 操作员可用。';
7
+ /** 运维 / 内省 / Endpoint 管理命令:仅 master 或 trusted 可执行与展示 */
8
+ export const MANAGEMENT_OPERATOR_PERMIT = 'role(master,trusted)';
9
+ /** Endpoint Owner 私聊专用命令(如 /approve) */
10
+ export const OWNER_OPERATOR_PERMIT = 'role(master)';
11
+ export const OWNER_PRIVATE_PERMITS = [OWNER_OPERATOR_PERMIT, 'private(*)'];
7
12
  export function resolveManagementCommandRoles(message, root, triggerConfig) {
8
13
  const cfg = mergeAITriggerConfig(triggerConfig ?? {});
9
14
  const adapterInstance = root.inject(message.$adapter);
@@ -18,4 +23,3 @@ export function rejectUnlessManagementOperator(message, root, triggerConfig) {
18
23
  }
19
24
  return MANAGEMENT_COMMAND_DENIED;
20
25
  }
21
- //# sourceMappingURL=management-command-guard.js.map
@@ -37,4 +37,3 @@ export declare function createSyntheticMessage(input: SyntheticMessageInput): Ag
37
37
  export declare function commMessageFromHookContext(context: Record<string, unknown>): Message<any> | undefined;
38
38
  /** 兼容 tool parameters 上的 contextKey(endpointId / sceneId / scope 等) */
39
39
  export declare function resolveContextKey(message: Message<any>, key: string): unknown;
40
- //# sourceMappingURL=message-enrich.d.ts.map
@@ -79,4 +79,3 @@ export function resolveContextKey(message, key) {
79
79
  }
80
80
  }
81
81
  }
82
- //# sourceMappingURL=message-enrich.js.map
@@ -174,4 +174,3 @@ export declare class MessageFilterFeature extends Feature<FilterRule> {
174
174
  setDefaultFilterPolicy(policy: FilterAction): void;
175
175
  };
176
176
  }
177
- //# sourceMappingURL=message-filter.d.ts.map
@@ -13,7 +13,6 @@
13
13
  * - 插件通过 `addFilterRule()` 动态注册规则,卸载时自动清理
14
14
  */
15
15
  import { Feature } from '@zhin.js/kernel';
16
- import { getPlugin } from '../plugin.js';
17
16
  // ============================================================================
18
17
  // 规则工厂
19
18
  // ============================================================================
@@ -155,7 +154,7 @@ export class MessageFilterFeature extends Feature {
155
154
  const feature = this;
156
155
  return {
157
156
  addFilterRule(rule) {
158
- const plugin = getPlugin();
157
+ const plugin = this;
159
158
  const dispose = feature.add(rule, plugin.name);
160
159
  plugin.recordFeatureContribution(feature.name, rule.name);
161
160
  plugin.onDispose(dispose);
@@ -238,4 +237,3 @@ export class MessageFilterFeature extends Feature {
238
237
  });
239
238
  }
240
239
  }
241
- //# sourceMappingURL=message-filter.js.map
@@ -0,0 +1,3 @@
1
+ /** 从应用根(ZHIN_PROJECT_ROOT / cwd)解析 optional peer,避免 core 包目录下 dynamic import 失败 */
2
+ export declare function resolveOptionalPeerPackage(packageName: string): string | undefined;
3
+ export declare function importOptionalPeerPackage<T = Record<string, unknown>>(packageName: string): Promise<T>;