@downcity/plugins 1.0.52 → 1.0.57

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 (329) hide show
  1. package/bin/BuiltinPlugins.d.ts +2 -3
  2. package/bin/BuiltinPlugins.d.ts.map +1 -1
  3. package/bin/BuiltinPlugins.js +2 -6
  4. package/bin/BuiltinPlugins.js.map +1 -1
  5. package/bin/asr/Plugin.d.ts +67 -8
  6. package/bin/asr/Plugin.d.ts.map +1 -1
  7. package/bin/asr/Plugin.js +229 -461
  8. package/bin/asr/Plugin.js.map +1 -1
  9. package/bin/asr/types/AsrPlugin.d.ts +114 -0
  10. package/bin/asr/types/AsrPlugin.d.ts.map +1 -0
  11. package/bin/asr/types/AsrPlugin.js +10 -0
  12. package/bin/asr/types/AsrPlugin.js.map +1 -0
  13. package/bin/auth/Plugin.d.ts +1 -2
  14. package/bin/auth/Plugin.d.ts.map +1 -1
  15. package/bin/auth/Plugin.js +2 -2
  16. package/bin/auth/Plugin.js.map +1 -1
  17. package/bin/chat/ChatPlugin.d.ts +1 -2
  18. package/bin/chat/ChatPlugin.d.ts.map +1 -1
  19. package/bin/chat/ChatPlugin.js +3 -12
  20. package/bin/chat/ChatPlugin.js.map +1 -1
  21. package/bin/chat/PROMPT.direct.d.ts +1 -1
  22. package/bin/chat/PROMPT.direct.d.ts.map +1 -1
  23. package/bin/chat/PROMPT.direct.js +1 -1
  24. package/bin/chat/PROMPT.direct.js.map +1 -1
  25. package/bin/chat/channels/qq/PROMPT.direct.d.ts +1 -1
  26. package/bin/chat/channels/qq/PROMPT.direct.d.ts.map +1 -1
  27. package/bin/chat/channels/qq/PROMPT.direct.js +1 -1
  28. package/bin/chat/channels/qq/PROMPT.direct.js.map +1 -1
  29. package/bin/chat/channels/telegram/Bot.d.ts +6 -0
  30. package/bin/chat/channels/telegram/Bot.d.ts.map +1 -1
  31. package/bin/chat/channels/telegram/Bot.js +24 -0
  32. package/bin/chat/channels/telegram/Bot.js.map +1 -1
  33. package/bin/chat/channels/telegram/TelegramPlatformClient.d.ts +14 -0
  34. package/bin/chat/channels/telegram/TelegramPlatformClient.d.ts.map +1 -1
  35. package/bin/chat/channels/telegram/TelegramPlatformClient.js +39 -5
  36. package/bin/chat/channels/telegram/TelegramPlatformClient.js.map +1 -1
  37. package/bin/contact/ContactPlugin.d.ts +1 -2
  38. package/bin/contact/ContactPlugin.d.ts.map +1 -1
  39. package/bin/contact/ContactPlugin.js +2 -2
  40. package/bin/contact/ContactPlugin.js.map +1 -1
  41. package/bin/contact/PROMPT.d.ts +1 -1
  42. package/bin/contact/PROMPT.d.ts.map +1 -1
  43. package/bin/contact/PROMPT.js +1 -1
  44. package/bin/contact/PROMPT.js.map +1 -1
  45. package/bin/image/ImagePlugin.d.ts +61 -0
  46. package/bin/image/ImagePlugin.d.ts.map +1 -0
  47. package/bin/image/ImagePlugin.js +207 -0
  48. package/bin/image/ImagePlugin.js.map +1 -0
  49. package/bin/image/types/ImagePlugin.d.ts +136 -0
  50. package/bin/image/types/ImagePlugin.d.ts.map +1 -0
  51. package/bin/image/types/ImagePlugin.js +10 -0
  52. package/bin/image/types/ImagePlugin.js.map +1 -0
  53. package/bin/index.d.ts +4 -0
  54. package/bin/index.d.ts.map +1 -1
  55. package/bin/index.js +1 -0
  56. package/bin/index.js.map +1 -1
  57. package/bin/shell/ShellPlugin.d.ts +1 -2
  58. package/bin/shell/ShellPlugin.d.ts.map +1 -1
  59. package/bin/shell/ShellPlugin.js +2 -2
  60. package/bin/shell/ShellPlugin.js.map +1 -1
  61. package/bin/skill/Action.d.ts +8 -3
  62. package/bin/skill/Action.d.ts.map +1 -1
  63. package/bin/skill/Action.js +9 -11
  64. package/bin/skill/Action.js.map +1 -1
  65. package/bin/skill/Command.d.ts +1 -1
  66. package/bin/skill/Command.d.ts.map +1 -1
  67. package/bin/skill/Command.js +3 -10
  68. package/bin/skill/Command.js.map +1 -1
  69. package/bin/skill/Config.d.ts +9 -9
  70. package/bin/skill/Config.d.ts.map +1 -1
  71. package/bin/skill/Config.js +36 -24
  72. package/bin/skill/Config.js.map +1 -1
  73. package/bin/skill/PROMPT.d.ts +1 -1
  74. package/bin/skill/PROMPT.d.ts.map +1 -1
  75. package/bin/skill/PROMPT.js +1 -1
  76. package/bin/skill/PROMPT.js.map +1 -1
  77. package/bin/skill/Plugin.d.ts +2 -2
  78. package/bin/skill/Plugin.d.ts.map +1 -1
  79. package/bin/skill/Plugin.js +20 -37
  80. package/bin/skill/Plugin.js.map +1 -1
  81. package/bin/skill/runtime/Discovery.d.ts +3 -3
  82. package/bin/skill/runtime/Discovery.d.ts.map +1 -1
  83. package/bin/skill/runtime/Discovery.js +37 -14
  84. package/bin/skill/runtime/Discovery.js.map +1 -1
  85. package/bin/skill/runtime/Paths.d.ts +5 -5
  86. package/bin/skill/runtime/Paths.d.ts.map +1 -1
  87. package/bin/skill/runtime/Paths.js +23 -33
  88. package/bin/skill/runtime/Paths.js.map +1 -1
  89. package/bin/skill/runtime/Prompt.d.ts +2 -2
  90. package/bin/skill/runtime/Prompt.d.ts.map +1 -1
  91. package/bin/skill/runtime/Prompt.js +3 -8
  92. package/bin/skill/runtime/Prompt.js.map +1 -1
  93. package/bin/skill/runtime/SystemProvider.d.ts +2 -2
  94. package/bin/skill/runtime/SystemProvider.d.ts.map +1 -1
  95. package/bin/skill/runtime/SystemProvider.js +2 -2
  96. package/bin/skill/runtime/SystemProvider.js.map +1 -1
  97. package/bin/skill/types/SkillPlugin.d.ts +34 -12
  98. package/bin/skill/types/SkillPlugin.d.ts.map +1 -1
  99. package/bin/skill/types/SkillPlugin.js +2 -1
  100. package/bin/skill/types/SkillPlugin.js.map +1 -1
  101. package/bin/skill/types/SkillRoot.d.ts +1 -1
  102. package/bin/task/Action.js +2 -2
  103. package/bin/task/Action.js.map +1 -1
  104. package/bin/task/PROMPT.d.ts +1 -1
  105. package/bin/task/PROMPT.d.ts.map +1 -1
  106. package/bin/task/PROMPT.js +1 -1
  107. package/bin/task/PROMPT.js.map +1 -1
  108. package/bin/task/TaskPlugin.d.ts +1 -2
  109. package/bin/task/TaskPlugin.d.ts.map +1 -1
  110. package/bin/task/TaskPlugin.js +2 -2
  111. package/bin/task/TaskPlugin.js.map +1 -1
  112. package/bin/tts/Plugin.d.ts +53 -7
  113. package/bin/tts/Plugin.d.ts.map +1 -1
  114. package/bin/tts/Plugin.js +197 -474
  115. package/bin/tts/Plugin.js.map +1 -1
  116. package/bin/tts/types/TtsPlugin.d.ts +63 -102
  117. package/bin/tts/types/TtsPlugin.d.ts.map +1 -1
  118. package/bin/tts/types/TtsPlugin.js +4 -3
  119. package/bin/tts/types/TtsPlugin.js.map +1 -1
  120. package/bin/web/PROMPT.d.ts +1 -1
  121. package/bin/web/PROMPT.d.ts.map +1 -1
  122. package/bin/web/PROMPT.js +1 -1
  123. package/bin/web/PROMPT.js.map +1 -1
  124. package/bin/web/Plugin.d.ts +66 -6
  125. package/bin/web/Plugin.d.ts.map +1 -1
  126. package/bin/web/Plugin.js +130 -447
  127. package/bin/web/Plugin.js.map +1 -1
  128. package/bin/web/WebPromptAssets.d.ts +1 -9
  129. package/bin/web/WebPromptAssets.d.ts.map +1 -1
  130. package/bin/web/WebPromptAssets.js +1 -11
  131. package/bin/web/WebPromptAssets.js.map +1 -1
  132. package/bin/web/runtime/Install.d.ts +19 -0
  133. package/bin/web/runtime/Install.d.ts.map +1 -0
  134. package/bin/web/runtime/Install.js +178 -0
  135. package/bin/web/runtime/Install.js.map +1 -0
  136. package/bin/web/types/WebPlugin.d.ts +37 -109
  137. package/bin/web/types/WebPlugin.d.ts.map +1 -1
  138. package/bin/web/types/WebPlugin.js +5 -7
  139. package/bin/web/types/WebPlugin.js.map +1 -1
  140. package/bin/workboard/Plugin.d.ts +1 -2
  141. package/bin/workboard/Plugin.d.ts.map +1 -1
  142. package/bin/workboard/Plugin.js +2 -2
  143. package/bin/workboard/Plugin.js.map +1 -1
  144. package/package.json +2 -2
  145. package/src/BuiltinPlugins.ts +3 -10
  146. package/src/asr/Plugin.ts +264 -484
  147. package/src/asr/types/AsrPlugin.ts +118 -0
  148. package/src/auth/Plugin.ts +2 -3
  149. package/src/chat/ChatPlugin.ts +3 -14
  150. package/src/chat/PROMPT.direct.ts +1 -1
  151. package/src/chat/PROMPT.direct.ts.txt +5 -7
  152. package/src/chat/channels/qq/PROMPT.direct.ts +1 -1
  153. package/src/chat/channels/qq/PROMPT.direct.ts.txt +1 -1
  154. package/src/chat/channels/telegram/Bot.ts +22 -0
  155. package/src/chat/channels/telegram/TelegramPlatformClient.ts +42 -6
  156. package/src/contact/ContactPlugin.ts +2 -3
  157. package/src/contact/PROMPT.ts +1 -1
  158. package/src/contact/PROMPT.ts.txt +12 -12
  159. package/src/image/ImagePlugin.ts +268 -0
  160. package/src/image/types/ImagePlugin.ts +157 -0
  161. package/src/index.ts +25 -0
  162. package/src/shell/ShellPlugin.ts +2 -3
  163. package/src/skill/Action.ts +20 -9
  164. package/src/skill/Command.ts +3 -13
  165. package/src/skill/Config.ts +41 -34
  166. package/src/skill/PROMPT.ts +1 -1
  167. package/src/skill/PROMPT.ts.txt +14 -2
  168. package/src/skill/Plugin.ts +205 -214
  169. package/src/skill/runtime/Discovery.ts +43 -17
  170. package/src/skill/runtime/Paths.ts +24 -35
  171. package/src/skill/runtime/Prompt.ts +4 -10
  172. package/src/skill/runtime/SystemProvider.ts +4 -4
  173. package/src/skill/types/SkillPlugin.ts +39 -12
  174. package/src/skill/types/SkillRoot.ts +1 -1
  175. package/src/task/Action.ts +2 -2
  176. package/src/task/PROMPT.ts +1 -1
  177. package/src/task/PROMPT.ts.txt +10 -10
  178. package/src/task/TaskPlugin.ts +2 -3
  179. package/src/tts/Plugin.ts +225 -493
  180. package/src/tts/types/TtsPlugin.ts +67 -102
  181. package/src/web/PROMPT.ts +1 -1
  182. package/src/web/PROMPT.ts.txt +32 -6
  183. package/src/web/Plugin.ts +119 -454
  184. package/src/web/WebPromptAssets.ts +1 -13
  185. package/src/web/runtime/Install.ts +241 -0
  186. package/src/web/types/WebPlugin.ts +37 -113
  187. package/src/workboard/Plugin.ts +2 -3
  188. package/bin/asr/Config.d.ts +0 -43
  189. package/bin/asr/Config.d.ts.map +0 -1
  190. package/bin/asr/Config.js +0 -107
  191. package/bin/asr/Config.js.map +0 -1
  192. package/bin/asr/Dependency.d.ts +0 -77
  193. package/bin/asr/Dependency.d.ts.map +0 -1
  194. package/bin/asr/Dependency.js +0 -238
  195. package/bin/asr/Dependency.js.map +0 -1
  196. package/bin/asr/InboundAugment.d.ts +0 -17
  197. package/bin/asr/InboundAugment.d.ts.map +0 -1
  198. package/bin/asr/InboundAugment.js +0 -47
  199. package/bin/asr/InboundAugment.js.map +0 -1
  200. package/bin/asr/ModelCatalog.d.ts +0 -29
  201. package/bin/asr/ModelCatalog.d.ts.map +0 -1
  202. package/bin/asr/ModelCatalog.js +0 -25
  203. package/bin/asr/ModelCatalog.js.map +0 -1
  204. package/bin/tts/Dependency.d.ts +0 -90
  205. package/bin/tts/Dependency.d.ts.map +0 -1
  206. package/bin/tts/Dependency.js +0 -344
  207. package/bin/tts/Dependency.js.map +0 -1
  208. package/bin/tts/PluginSupport.d.ts +0 -25
  209. package/bin/tts/PluginSupport.d.ts.map +0 -1
  210. package/bin/tts/PluginSupport.js +0 -72
  211. package/bin/tts/PluginSupport.js.map +0 -1
  212. package/bin/tts/runtime/Catalog.d.ts +0 -21
  213. package/bin/tts/runtime/Catalog.d.ts.map +0 -1
  214. package/bin/tts/runtime/Catalog.js +0 -90
  215. package/bin/tts/runtime/Catalog.js.map +0 -1
  216. package/bin/tts/runtime/DependencyInstaller.d.ts +0 -143
  217. package/bin/tts/runtime/DependencyInstaller.d.ts.map +0 -1
  218. package/bin/tts/runtime/DependencyInstaller.js +0 -261
  219. package/bin/tts/runtime/DependencyInstaller.js.map +0 -1
  220. package/bin/tts/runtime/Installer.d.ts +0 -89
  221. package/bin/tts/runtime/Installer.d.ts.map +0 -1
  222. package/bin/tts/runtime/Installer.js +0 -188
  223. package/bin/tts/runtime/Installer.js.map +0 -1
  224. package/bin/tts/runtime/Paths.d.ts +0 -20
  225. package/bin/tts/runtime/Paths.d.ts.map +0 -1
  226. package/bin/tts/runtime/Paths.js +0 -32
  227. package/bin/tts/runtime/Paths.js.map +0 -1
  228. package/bin/tts/runtime/Synthesizer.d.ts +0 -44
  229. package/bin/tts/runtime/Synthesizer.d.ts.map +0 -1
  230. package/bin/tts/runtime/Synthesizer.js +0 -363
  231. package/bin/tts/runtime/Synthesizer.js.map +0 -1
  232. package/bin/tts/types/Tts.d.ts +0 -91
  233. package/bin/tts/types/Tts.d.ts.map +0 -1
  234. package/bin/tts/types/Tts.js +0 -9
  235. package/bin/tts/types/Tts.js.map +0 -1
  236. package/bin/voice/Config.d.ts +0 -43
  237. package/bin/voice/Config.d.ts.map +0 -1
  238. package/bin/voice/Config.js +0 -104
  239. package/bin/voice/Config.js.map +0 -1
  240. package/bin/voice/Dependency.d.ts +0 -77
  241. package/bin/voice/Dependency.d.ts.map +0 -1
  242. package/bin/voice/Dependency.js +0 -237
  243. package/bin/voice/Dependency.js.map +0 -1
  244. package/bin/voice/InboundAugment.d.ts +0 -17
  245. package/bin/voice/InboundAugment.d.ts.map +0 -1
  246. package/bin/voice/InboundAugment.js +0 -47
  247. package/bin/voice/InboundAugment.js.map +0 -1
  248. package/bin/voice/ModelCatalog.d.ts +0 -29
  249. package/bin/voice/ModelCatalog.d.ts.map +0 -1
  250. package/bin/voice/ModelCatalog.js +0 -25
  251. package/bin/voice/ModelCatalog.js.map +0 -1
  252. package/bin/voice/runtime/Catalog.d.ts +0 -18
  253. package/bin/voice/runtime/Catalog.d.ts.map +0 -1
  254. package/bin/voice/runtime/Catalog.js +0 -61
  255. package/bin/voice/runtime/Catalog.js.map +0 -1
  256. package/bin/voice/runtime/DependencyInstaller.d.ts +0 -145
  257. package/bin/voice/runtime/DependencyInstaller.d.ts.map +0 -1
  258. package/bin/voice/runtime/DependencyInstaller.js +0 -309
  259. package/bin/voice/runtime/DependencyInstaller.js.map +0 -1
  260. package/bin/voice/runtime/Installer.d.ts +0 -94
  261. package/bin/voice/runtime/Installer.d.ts.map +0 -1
  262. package/bin/voice/runtime/Installer.js +0 -200
  263. package/bin/voice/runtime/Installer.js.map +0 -1
  264. package/bin/voice/runtime/Paths.d.ts +0 -8
  265. package/bin/voice/runtime/Paths.d.ts.map +0 -1
  266. package/bin/voice/runtime/Paths.js +0 -26
  267. package/bin/voice/runtime/Paths.js.map +0 -1
  268. package/bin/voice/runtime/Transcriber.d.ts +0 -57
  269. package/bin/voice/runtime/Transcriber.d.ts.map +0 -1
  270. package/bin/voice/runtime/Transcriber.js +0 -329
  271. package/bin/voice/runtime/Transcriber.js.map +0 -1
  272. package/bin/voice/types/Voice.d.ts +0 -58
  273. package/bin/voice/types/Voice.d.ts.map +0 -1
  274. package/bin/voice/types/Voice.js +0 -9
  275. package/bin/voice/types/Voice.js.map +0 -1
  276. package/bin/voice/types/VoicePlugin.d.ts +0 -190
  277. package/bin/voice/types/VoicePlugin.d.ts.map +0 -1
  278. package/bin/voice/types/VoicePlugin.js +0 -9
  279. package/bin/voice/types/VoicePlugin.js.map +0 -1
  280. package/bin/web/Dependency.d.ts +0 -10
  281. package/bin/web/Dependency.d.ts.map +0 -1
  282. package/bin/web/Dependency.js +0 -10
  283. package/bin/web/Dependency.js.map +0 -1
  284. package/bin/web/PROMPT.agent-browser.d.ts +0 -7
  285. package/bin/web/PROMPT.agent-browser.d.ts.map +0 -1
  286. package/bin/web/PROMPT.agent-browser.js +0 -8
  287. package/bin/web/PROMPT.agent-browser.js.map +0 -1
  288. package/bin/web/PROMPT.web-access.d.ts +0 -7
  289. package/bin/web/PROMPT.web-access.d.ts.map +0 -1
  290. package/bin/web/PROMPT.web-access.js +0 -8
  291. package/bin/web/PROMPT.web-access.js.map +0 -1
  292. package/bin/web/runtime/Config.d.ts +0 -21
  293. package/bin/web/runtime/Config.d.ts.map +0 -1
  294. package/bin/web/runtime/Config.js +0 -79
  295. package/bin/web/runtime/Config.js.map +0 -1
  296. package/bin/web/runtime/Source.d.ts +0 -29
  297. package/bin/web/runtime/Source.d.ts.map +0 -1
  298. package/bin/web/runtime/Source.js +0 -209
  299. package/bin/web/runtime/Source.js.map +0 -1
  300. package/src/asr/Config.ts +0 -138
  301. package/src/asr/Dependency.ts +0 -336
  302. package/src/asr/InboundAugment.ts +0 -59
  303. package/src/asr/ModelCatalog.ts +0 -43
  304. package/src/tts/Dependency.ts +0 -473
  305. package/src/tts/PluginSupport.ts +0 -85
  306. package/src/tts/runtime/Catalog.ts +0 -97
  307. package/src/tts/runtime/DependencyInstaller.ts +0 -436
  308. package/src/tts/runtime/Installer.ts +0 -297
  309. package/src/tts/runtime/Paths.ts +0 -39
  310. package/src/tts/runtime/Synthesizer.ts +0 -480
  311. package/src/tts/types/Tts.ts +0 -99
  312. package/src/voice/Config.ts +0 -135
  313. package/src/voice/Dependency.ts +0 -329
  314. package/src/voice/InboundAugment.ts +0 -59
  315. package/src/voice/ModelCatalog.ts +0 -43
  316. package/src/voice/runtime/Catalog.ts +0 -68
  317. package/src/voice/runtime/DependencyInstaller.ts +0 -505
  318. package/src/voice/runtime/Installer.ts +0 -324
  319. package/src/voice/runtime/Paths.ts +0 -26
  320. package/src/voice/runtime/Transcriber.ts +0 -467
  321. package/src/voice/types/Voice.ts +0 -68
  322. package/src/voice/types/VoicePlugin.ts +0 -194
  323. package/src/web/Dependency.ts +0 -17
  324. package/src/web/PROMPT.agent-browser.ts +0 -9
  325. package/src/web/PROMPT.agent-browser.ts.txt +0 -17
  326. package/src/web/PROMPT.web-access.ts +0 -9
  327. package/src/web/PROMPT.web-access.ts.txt +0 -13
  328. package/src/web/runtime/Config.ts +0 -105
  329. package/src/web/runtime/Source.ts +0 -257
package/src/asr/Plugin.ts CHANGED
@@ -1,510 +1,290 @@
1
1
  /**
2
- * ASR Plugin。
2
+ * AsrPlugin:语音转写插件。
3
3
  *
4
4
  * 关键点(中文)
5
- * - ASR Plugin 现在自己内聚转写依赖,不再暴露独立依赖端口心智。
6
- * - 具体模型、依赖安装、命令模板等实现细节全部收敛到 plugin 内部 dependency helper。
7
- * - 当前作为 chat 入站消息增强中间件接入语音转写。
5
+ * - ASR 能力通过 constructor 注入,推荐传入 `city.ai.asr`。
6
+ * - plugin 不负责本地模型、Python 依赖、provider 或项目配置。
7
+ * - `auto: true` 时会在 chat 入站阶段自动转写 voice/audio 附件,并把结果写入正文。
8
8
  */
9
9
 
10
- import type { AgentRuntime } from "@downcity/agent/internal/types/runtime/agent/AgentRuntime.js";
10
+ import path from "node:path";
11
11
  import { BasePlugin } from "@downcity/agent/internal/plugin/core/BasePlugin.js";
12
- import type { Plugin } from "@downcity/agent/internal/plugin/types/Plugin.js";
13
- import type { VoicePluginConfig } from "@/voice/types/VoicePlugin.js";
12
+ import type { AgentContext } from "@downcity/agent/internal/types/runtime/agent/AgentContext.js";
13
+ import type {
14
+ JsonObject,
15
+ JsonValue,
16
+ } from "@downcity/agent/internal/types/common/Json.js";
14
17
  import { CHAT_PLUGIN_POINTS } from "@/chat/runtime/PluginPoints.js";
15
- import { isPluginEnabled } from "@downcity/agent/internal/plugin/core/Activation.js";
16
- import { writeProjectPluginEnabled } from "@downcity/agent/internal/plugin/core/ProjectConfigStore.js";
17
- import {
18
- listVoiceModels,
19
- resolveVoicePluginModelId,
20
- } from "@/asr/ModelCatalog.js";
21
- import {
22
- getBooleanOpt,
23
- getStringOpt,
24
- readVoicePluginConfig,
25
- toJsonObject,
26
- writeVoicePluginConfig,
27
- } from "@/asr/Config.js";
28
- import { augmentAsrInboundMessage } from "@/asr/InboundAugment.js";
29
- import {
30
- checkVoiceTranscriber,
31
- installVoiceTranscriber,
32
- readVoiceTranscriberConfig,
33
- transcribeWithVoiceDependency,
34
- writeVoiceTranscriberConfig,
35
- } from "@/asr/Dependency.js";
18
+ import type {
19
+ ChatInboundAugmentInput,
20
+ ChatPluginAttachment,
21
+ } from "@/chat/types/ChatPlugin.js";
22
+ import type {
23
+ AsrPluginInput,
24
+ AsrPluginOptions,
25
+ AsrPluginResult,
26
+ } from "@/asr/types/AsrPlugin.js";
36
27
 
37
- function createAsrPluginDefinition(plugin: Plugin): Plugin {
28
+ const DEFAULT_ASR_PLUGIN_NAME = "asr";
29
+ const DEFAULT_ASR_PLUGIN_TITLE = "ASR";
30
+ const DEFAULT_ASR_PLUGIN_DESCRIPTION =
31
+ "Transcribe voice and audio attachments through an injected ASR function.";
32
+
33
+ /**
34
+ * 判断值是否为普通对象。
35
+ */
36
+ function to_record(value: unknown): Record<string, unknown> | null {
37
+ if (!value || typeof value !== "object" || Array.isArray(value)) return null;
38
+ return value as Record<string, unknown>;
39
+ }
40
+
41
+ /**
42
+ * XML 文本转义。
43
+ */
44
+ function escape_xml_text(value: string): string {
45
+ return String(value || "")
46
+ .replace(/&/g, "&amp;")
47
+ .replace(/</g, "&lt;")
48
+ .replace(/>/g, "&gt;");
49
+ }
50
+
51
+ /**
52
+ * XML 属性转义。
53
+ */
54
+ function escape_xml_attr(value: string): string {
55
+ return escape_xml_text(value).replace(/"/g, "&quot;");
56
+ }
57
+
58
+ /**
59
+ * 归一化 action payload。
60
+ */
61
+ function normalize_asr_payload(payload: JsonValue | undefined): AsrPluginInput {
62
+ const record = to_record(payload ?? {});
63
+ if (!record) {
64
+ throw new TypeError("AsrPlugin.transcribe payload must be an object");
65
+ }
66
+ const audio_path =
67
+ typeof record.audio_path === "string"
68
+ ? record.audio_path.trim()
69
+ : "";
70
+ const url = typeof record.url === "string" ? record.url.trim() : "";
71
+ const data_url = typeof record.data_url === "string" ? record.data_url.trim() : "";
72
+ if (!audio_path && !url && !data_url) {
73
+ throw new Error("AsrPlugin.transcribe requires audio_path, url, or data_url");
74
+ }
38
75
  return {
39
- name: "asr",
40
- title: "Automatic Speech Recognition",
41
- description:
42
- "Detects voice and audio attachments in inbound chat messages, runs transcription through the configured ASR dependency, and appends readable text so the agent can work with spoken input like normal message content.",
43
- config: {
44
- plugin: "asr",
45
- scope: "project",
46
- defaultValue: {
47
- injectPrompt: true,
48
- augmentMessage: true,
49
- provider: "local",
50
- modelId: "SenseVoiceSmall",
51
- },
52
- },
53
- setup: {
54
- mode: "install-configure",
55
- title: "安装语音识别",
56
- description: "选择模型后即可完成依赖安装与当前配置写入。",
57
- fields: [
58
- {
59
- key: "modelId",
60
- label: "模型",
61
- type: "select",
62
- required: true,
63
- sourceAction: "models",
64
- },
65
- {
66
- key: "installDeps",
67
- label: "安装 Python 依赖",
68
- type: "checkbox",
69
- },
70
- ],
71
- primaryAction: "install",
72
- statusAction: "status",
73
- },
74
- usage: {
75
- title: "配置语音识别",
76
- description: "设置当前 agent 如何把语音内容转成文本并注入对话链路。",
77
- fields: [
78
- {
79
- key: "injectPrompt",
80
- label: "注入 Prompt 提示",
81
- type: "boolean",
82
- trueLabel: "开启",
83
- falseLabel: "关闭",
84
- description: "开启后会把 ASR 使用约束注入到 agent 的系统提示词。",
85
- },
86
- {
87
- key: "augmentMessage",
88
- label: "自动增强消息",
89
- type: "boolean",
90
- trueLabel: "开启",
91
- falseLabel: "关闭",
92
- description: "开启后,入站语音消息会先自动转写再交给 agent。",
93
- },
94
- {
95
- key: "modelId",
96
- label: "默认模型",
97
- type: "select",
98
- sourceAction: "models",
99
- },
100
- {
101
- key: "language",
102
- label: "默认语言提示",
103
- type: "string",
104
- placeholder: "auto / zh / en",
105
- },
106
- {
107
- key: "timeoutMs",
108
- label: "超时(毫秒)",
109
- type: "number",
110
- placeholder: "60000",
111
- },
112
- ],
113
- saveAction: "configure",
114
- statusAction: "status",
115
- },
116
- async availability(context) {
117
- if (!isPluginEnabled({ plugin, context })) {
118
- return {
119
- enabled: false,
120
- available: false,
121
- reasons: ["asr plugin disabled in project config"],
122
- };
76
+ ...(record as AsrPluginInput),
77
+ ...(audio_path ? { audio_path } : {}),
78
+ ...(url ? { url } : {}),
79
+ ...(data_url ? { data_url } : {}),
80
+ };
81
+ }
82
+
83
+ /**
84
+ * 校验 ASR 返回结果。
85
+ */
86
+ function normalize_asr_result(result: AsrPluginResult): AsrPluginResult {
87
+ const record = to_record(result);
88
+ if (!record || typeof record.text !== "string") {
89
+ throw new TypeError("AsrPlugin asr function must return { text: string }");
90
+ }
91
+ return {
92
+ ...record,
93
+ text: record.text.trim(),
94
+ } as AsrPluginResult;
95
+ }
96
+
97
+ /**
98
+ * 生成相对展示路径。
99
+ */
100
+ function to_display_src(root_path: string, attachment: ChatPluginAttachment): string {
101
+ const raw =
102
+ typeof attachment.path === "string" && attachment.path.trim()
103
+ ? attachment.path.trim()
104
+ : attachment.fileName || attachment.attachmentId || attachment.kind;
105
+ const normalized_root = path.resolve(root_path);
106
+ const normalized_raw = path.isAbsolute(raw) ? path.resolve(raw) : raw;
107
+ if (path.isAbsolute(normalized_raw) && normalized_raw.startsWith(`${normalized_root}${path.sep}`)) {
108
+ return normalized_raw.slice(normalized_root.length + 1);
109
+ }
110
+ return raw;
111
+ }
112
+
113
+ /**
114
+ * 把语音转写结果写入 bodyText。
115
+ */
116
+ function append_voice_text(input: ChatInboundAugmentInput, voice_blocks: string[]): ChatInboundAugmentInput {
117
+ const current = String(input.bodyText || "").trim();
118
+ const addition = voice_blocks.map((item) => item.trim()).filter(Boolean).join("\n\n");
119
+ if (!addition) return input;
120
+ return {
121
+ ...input,
122
+ bodyText: [current, addition].filter(Boolean).join("\n\n"),
123
+ };
124
+ }
125
+
126
+ /**
127
+ * Agent ASR 插件。
128
+ */
129
+ export class AsrPlugin extends BasePlugin {
130
+ /**
131
+ * 当前 plugin 稳定名称。
132
+ */
133
+ readonly name: string;
134
+
135
+ /**
136
+ * 插件标题。
137
+ */
138
+ readonly title: string;
139
+
140
+ /**
141
+ * 插件说明。
142
+ */
143
+ readonly description: string;
144
+
145
+ private readonly asr: AsrPluginOptions["asr"];
146
+ private readonly auto: boolean;
147
+ private readonly language?: string;
148
+
149
+ constructor(options: AsrPluginOptions) {
150
+ super();
151
+ const name = String(options.name || DEFAULT_ASR_PLUGIN_NAME).trim();
152
+ if (!name) {
153
+ throw new Error("AsrPlugin requires a non-empty name");
154
+ }
155
+ if (typeof options.asr !== "function") {
156
+ throw new Error("AsrPlugin requires an asr function");
123
157
  }
124
- const dependencyStatus = await checkVoiceTranscriber(context);
125
- return {
126
- enabled: true,
127
- available: dependencyStatus.available,
128
- reasons: dependencyStatus.reasons,
129
- };
130
- },
131
- hooks: {
158
+ this.name = name;
159
+ this.title = String(options.title || DEFAULT_ASR_PLUGIN_TITLE).trim();
160
+ this.description = String(
161
+ options.description || DEFAULT_ASR_PLUGIN_DESCRIPTION,
162
+ ).trim();
163
+ this.asr = options.asr;
164
+ this.auto = options.auto === true;
165
+ this.language =
166
+ typeof options.language === "string" && options.language.trim()
167
+ ? options.language.trim()
168
+ : undefined;
169
+ }
170
+
171
+ /**
172
+ * ASR 插件给模型的使用说明。
173
+ */
174
+ system(_context: AgentContext): string {
175
+ return [
176
+ "# ASR Plugin",
177
+ "",
178
+ "Use this plugin when the user asks to transcribe, recognize, or understand voice/audio content.",
179
+ this.auto
180
+ ? "Inbound voice/audio chat attachments are automatically transcribed into `<voice src=\"...\">...</voice>` blocks in the user text."
181
+ : "Automatic inbound voice transcription is disabled; call the plugin explicitly when transcription is needed.",
182
+ "",
183
+ "Call through `plugin_call`:",
184
+ "",
185
+ "```ts",
186
+ "plugin_call({",
187
+ ` plugin: "${this.name}",`,
188
+ ' action: "transcribe",',
189
+ " payload: {",
190
+ ' audio_path: "...",',
191
+ " },",
192
+ "});",
193
+ "```",
194
+ "",
195
+ "Payload rules:",
196
+ "- Provide one of `audio_path`, `url`, or `data_url`.",
197
+ "- Optional fields: `language`, `media_type`, `file_name`, `provider_options`.",
198
+ "- Do not invent transcript text. If transcription fails, report the failure clearly.",
199
+ ].join("\n");
200
+ }
201
+
202
+ /**
203
+ * 执行一次 ASR 转写。
204
+ */
205
+ private async transcribe(input: AsrPluginInput): Promise<AsrPluginResult> {
206
+ const result = await this.asr({
207
+ ...(this.language ? { language: this.language } : {}),
208
+ ...input,
209
+ });
210
+ return normalize_asr_result(result);
211
+ }
212
+
213
+ /**
214
+ * 自动增强 chat 入站消息。
215
+ */
216
+ private async auto_transcribe_inbound(params: {
217
+ context: AgentContext;
218
+ value: JsonValue;
219
+ }): Promise<JsonValue> {
220
+ if (!this.auto) return params.value;
221
+ const input = params.value as unknown as ChatInboundAugmentInput;
222
+ const voice_attachments = (Array.isArray(input.attachments) ? input.attachments : []).filter(
223
+ (item) =>
224
+ (item.kind === "voice" || item.kind === "audio") &&
225
+ typeof item.path === "string" &&
226
+ item.path.trim(),
227
+ );
228
+ if (voice_attachments.length === 0) {
229
+ return input as unknown as JsonValue;
230
+ }
231
+
232
+ const voice_blocks: string[] = [];
233
+ for (const attachment of voice_attachments) {
234
+ try {
235
+ const result = await this.transcribe({
236
+ audio_path: String(attachment.path || "").trim(),
237
+ ...(attachment.contentType ? { media_type: attachment.contentType } : {}),
238
+ ...(attachment.fileName ? { file_name: attachment.fileName } : {}),
239
+ });
240
+ if (!result.text) continue;
241
+ const src = to_display_src(params.context.rootPath, attachment);
242
+ voice_blocks.push(
243
+ `<voice src="${escape_xml_attr(src)}">${escape_xml_text(result.text)}</voice>`,
244
+ );
245
+ } catch {
246
+ // 关键点(中文):自动转写失败不阻塞主消息链路。
247
+ }
248
+ }
249
+
250
+ return append_voice_text(input, voice_blocks) as unknown as JsonValue;
251
+ }
252
+
253
+ /**
254
+ * pipeline / action 扩展点。
255
+ */
256
+ readonly hooks = {
132
257
  pipeline: {
133
258
  [CHAT_PLUGIN_POINTS.augmentInbound]: [
134
- async ({ context, value }) => {
135
- return await augmentAsrInboundMessage({ context, value });
259
+ async ({ context, value }: { context: AgentContext; value: JsonValue }) => {
260
+ return await this.auto_transcribe_inbound({ context, value });
136
261
  },
137
262
  ],
138
263
  },
139
- },
140
- actions: {
141
- status: {
142
- allowWhenDisabled: true,
143
- command: {
144
- description: "查看 asr plugin 当前状态",
145
- mapInput() {
146
- return {};
147
- },
148
- },
149
- execute: async ({ context }) => {
150
- const config = readVoicePluginConfig(context);
151
- const availability = await plugin.availability!(context);
152
- const transcriberConfig = readVoiceTranscriberConfig(context);
153
- return {
154
- success: true,
155
- data: {
156
- plugin: toJsonObject(config) || {},
157
- availability: {
158
- enabled: availability.enabled,
159
- available: availability.available,
160
- reasons: availability.reasons,
161
- },
162
- transcriber:
163
- toJsonObject((transcriberConfig || null) as Record<string, unknown> | null),
164
- },
165
- };
166
- },
167
- },
168
- install: {
169
- allowWhenDisabled: true,
170
- command: {
171
- description: "安装 asr 转写依赖",
172
- configure(command) {
173
- command
174
- .argument("[models...]")
175
- .option("--active-model <modelId>", "安装完成后设为当前模型")
176
- .option("--models-dir <path>", "模型目录(可选)")
177
- .option("--python <bin>", "Python 可执行文件(默认 python3)")
178
- .option("--no-install-deps", "跳过依赖安装")
179
- .option("--force", "强制覆盖已存在资源")
180
- .option("--hf-token <token>", "HuggingFace token(可选)");
181
- },
182
- mapInput({ args, opts }) {
183
- return {
184
- modelIds: args,
185
- ...(getStringOpt(opts, "activeModel")
186
- ? { activeModel: getStringOpt(opts, "activeModel") }
187
- : {}),
188
- ...(getStringOpt(opts, "modelsDir")
189
- ? { modelsDir: getStringOpt(opts, "modelsDir") }
190
- : {}),
191
- ...(getStringOpt(opts, "python")
192
- ? { pythonBin: getStringOpt(opts, "python") }
193
- : {}),
194
- installDeps: getBooleanOpt(opts, "installDeps", true),
195
- force: getBooleanOpt(opts, "force", false),
196
- ...(getStringOpt(opts, "hfToken")
197
- ? { hfToken: getStringOpt(opts, "hfToken") }
198
- : {}),
199
- };
200
- },
201
- },
202
- execute: async ({ context, payload }) => {
203
- const result = await installVoiceTranscriber({
204
- context,
205
- input:
206
- payload && typeof payload === "object" && !Array.isArray(payload)
207
- ? payload
208
- : undefined,
209
- });
210
- return {
211
- success: result.success,
212
- ...(result.message ? { message: result.message } : {}),
213
- ...(result.details !== undefined ? { data: result.details } : {}),
214
- ...(result.success ? {} : { error: result.message || "install failed" }),
215
- };
216
- },
217
- },
218
- configure: {
219
- allowWhenDisabled: true,
220
- execute: async ({ context, payload }) => {
221
- const payloadObject =
222
- payload && typeof payload === "object" && !Array.isArray(payload)
223
- ? (payload as Partial<VoicePluginConfig> & Record<string, unknown>)
224
- : {};
225
- const { enabled: _ignoredEnabled, ...patch } = payloadObject;
226
- const current = readVoicePluginConfig(context);
227
- const next = {
228
- ...current,
229
- ...(patch as Partial<VoicePluginConfig>),
230
- } satisfies VoicePluginConfig;
231
- await writeVoicePluginConfig({
232
- agentState: context,
233
- value: next,
234
- });
235
- return {
236
- success: true,
237
- data: {
238
- plugin: toJsonObject(next) || {},
239
- },
240
- };
241
- },
242
- },
243
- on: {
244
- allowWhenDisabled: true,
245
- command: {
246
- description: "启用 asr plugin,并可选安装转写依赖",
247
- configure(command) {
248
- command
249
- .argument("[models...]")
250
- .option("--active-model <modelId>", "安装完成后设为当前模型")
251
- .option("--models-dir <path>", "模型目录(可选)")
252
- .option("--python <bin>", "Python 可执行文件(默认 python3)")
253
- .option("--no-install", "仅启用 plugin,不安装依赖")
254
- .option("--no-install-deps", "跳过依赖安装")
255
- .option("--force", "强制覆盖已存在资源")
256
- .option("--hf-token <token>", "HuggingFace token(可选)")
257
- .option("--no-inject-prompt", "关闭 prompt 注入")
258
- .option("--no-augment-message", "关闭消息增强");
259
- },
260
- mapInput({ args, opts }) {
261
- return {
262
- modelIds: args,
263
- ...(getStringOpt(opts, "activeModel")
264
- ? { activeModel: getStringOpt(opts, "activeModel") }
265
- : {}),
266
- ...(getStringOpt(opts, "modelsDir")
267
- ? { modelsDir: getStringOpt(opts, "modelsDir") }
268
- : {}),
269
- ...(getStringOpt(opts, "python")
270
- ? { pythonBin: getStringOpt(opts, "python") }
271
- : {}),
272
- install: getBooleanOpt(opts, "install", true),
273
- installDeps: getBooleanOpt(opts, "installDeps", true),
274
- force: getBooleanOpt(opts, "force", false),
275
- injectPrompt: getBooleanOpt(opts, "injectPrompt", true),
276
- augmentMessage: getBooleanOpt(opts, "augmentMessage", true),
277
- ...(getStringOpt(opts, "hfToken")
278
- ? { hfToken: getStringOpt(opts, "hfToken") }
279
- : {}),
280
- };
281
- },
282
- },
283
- execute: async ({ context, payload }) => {
284
- await writeProjectPluginEnabled({
285
- pluginName: "asr",
286
- enabled: true,
287
- context,
288
- });
289
- const nextConfig = {
290
- ...readVoicePluginConfig(context),
291
- injectPrompt:
292
- typeof (payload as { injectPrompt?: unknown }).injectPrompt === "boolean"
293
- ? ((payload as { injectPrompt?: boolean }).injectPrompt as boolean)
294
- : true,
295
- augmentMessage:
296
- typeof (payload as { augmentMessage?: unknown }).augmentMessage === "boolean"
297
- ? ((payload as { augmentMessage?: boolean }).augmentMessage as boolean)
298
- : true,
299
- };
300
- await writeVoicePluginConfig({
301
- agentState: context,
302
- value: nextConfig,
303
- });
304
- if ((payload as { install?: unknown }).install !== false) {
305
- const installResult = await installVoiceTranscriber({
306
- context,
307
- input:
308
- payload && typeof payload === "object" && !Array.isArray(payload)
309
- ? payload
310
- : undefined,
311
- });
312
- if (!installResult.success) {
313
- return {
314
- success: false,
315
- error: installResult.message || "asr dependency install failed",
316
- message: installResult.message || "asr dependency install failed",
317
- };
318
- }
319
- }
320
- return {
321
- success: true,
322
- data: {
323
- plugin: toJsonObject(nextConfig) || {},
324
- transcriber: toJsonObject(readVoiceTranscriberConfig(context)) || {},
325
- },
326
- };
327
- },
328
- },
329
- off: {
330
- command: {
331
- description: "关闭 asr plugin",
332
- mapInput() {
333
- return {};
334
- },
335
- },
336
- execute: async ({ context }) => {
337
- await writeProjectPluginEnabled({
338
- pluginName: "asr",
339
- enabled: false,
340
- context,
341
- });
342
- return {
343
- success: true,
344
- data: {
345
- plugin: toJsonObject(readVoicePluginConfig(context) as Record<string, unknown>) || {},
346
- },
347
- };
348
- },
349
- },
350
- use: {
351
- command: {
352
- description: "切换 asr 当前转写模型",
353
- configure(command) {
354
- command.argument("<modelId>");
355
- },
356
- mapInput({ args }) {
357
- const modelId = String(args[0] || "").trim();
358
- if (!modelId) {
359
- throw new Error("modelId is required");
360
- }
361
- return {
362
- modelId,
363
- };
364
- },
365
- },
366
- execute: async ({ context, payload }) => {
367
- const modelId = String((payload as { modelId?: unknown }).modelId || "").trim();
368
- const resolvedModelId = resolveVoicePluginModelId(modelId);
369
- if (!resolvedModelId) {
370
- return {
371
- success: false,
372
- error: `Unsupported asr model: ${modelId}`,
373
- message: `Unsupported asr model: ${modelId}`,
374
- };
375
- }
376
- const transcriberConfig = await writeVoiceTranscriberConfig({
377
- context,
378
- value: {
379
- ...readVoiceTranscriberConfig(context),
380
- modelId: resolvedModelId,
381
- },
382
- });
383
- return {
384
- success: true,
385
- data: {
386
- transcriber: toJsonObject(transcriberConfig as Record<string, unknown>) || {},
387
- },
388
- };
389
- },
390
- },
264
+ };
265
+
266
+ /**
267
+ * 显式 action 集合。
268
+ */
269
+ readonly actions = {
391
270
  transcribe: {
392
- command: {
393
- description: "转写本地音频文件",
394
- configure(command) {
395
- command
396
- .argument("<audioPath>")
397
- .option("--language <code>", "语言提示(可选,例如 zh / en)");
398
- },
399
- mapInput({ args, opts }) {
400
- const audioPath = String(args[0] || "").trim();
401
- if (!audioPath) {
402
- throw new Error("audioPath is required");
403
- }
271
+ execute: async ({ payload }: { payload: JsonValue }) => {
272
+ try {
273
+ const input = normalize_asr_payload(payload);
274
+ const result = await this.transcribe(input);
404
275
  return {
405
- audioPath,
406
- ...(getStringOpt(opts, "language")
407
- ? { language: getStringOpt(opts, "language") }
408
- : {}),
276
+ success: true,
277
+ data: result as unknown as JsonObject,
278
+ message: "audio transcribed",
409
279
  };
410
- },
411
- },
412
- execute: async ({ context, payload }) => {
413
- const pluginStatus = await plugin.availability!(context);
414
- if (!pluginStatus.enabled || !pluginStatus.available) {
280
+ } catch (error) {
415
281
  return {
416
282
  success: false,
417
- error: pluginStatus.reasons.join("; "),
418
- message: pluginStatus.reasons.join("; "),
283
+ error: String(error),
284
+ message: String(error),
419
285
  };
420
286
  }
421
- const result = await transcribeWithVoiceDependency({
422
- context,
423
- audioPath: String((payload as { audioPath?: unknown }).audioPath || ""),
424
- language:
425
- typeof (payload as { language?: unknown }).language === "string"
426
- ? String((payload as { language?: unknown }).language || "")
427
- : undefined,
428
- });
429
- return {
430
- success: result.success,
431
- ...(result !== undefined ? { data: result } : {}),
432
- ...(result.success ? {} : { error: result.error || "transcribe failed" }),
433
- ...(result.success ? {} : { message: result.error || "transcribe failed" }),
434
- };
435
- },
436
- },
437
- models: {
438
- allowWhenDisabled: true,
439
- command: {
440
- description: "列出内置 asr 支持的模型目录",
441
- mapInput() {
442
- return {};
443
- },
444
- },
445
- execute: async () => {
446
- return {
447
- success: true,
448
- data: {
449
- models: listVoiceModels(),
450
- },
451
- };
452
287
  },
453
288
  },
454
- doctor: {
455
- command: {
456
- description: "检查 asr plugin 与转写依赖可用性",
457
- mapInput() {
458
- return {};
459
- },
460
- },
461
- execute: async ({ context }) => {
462
- const availability = await plugin.availability!(context);
463
- const dependencyStatus = await checkVoiceTranscriber(context);
464
- return {
465
- success: true,
466
- data: {
467
- availability: {
468
- enabled: availability.enabled,
469
- available: availability.available,
470
- reasons: availability.reasons,
471
- },
472
- transcriberStatus: {
473
- available: dependencyStatus.available,
474
- reasons: dependencyStatus.reasons,
475
- ...(dependencyStatus.details !== undefined
476
- ? { details: dependencyStatus.details }
477
- : {}),
478
- },
479
- },
480
- message: availability.available
481
- ? "asr plugin is available"
482
- : availability.reasons.join("; ") || "asr plugin is not available",
483
- };
484
- },
485
- },
486
- },
487
- system(context) {
488
- const config = readVoicePluginConfig(context);
489
- if (!isPluginEnabled({ plugin, context }) || config.injectPrompt !== true) {
490
- return "";
491
- }
492
- return [
493
- "# ASR Plugin",
494
- "Audio attachments may be transcribed before agent execution.",
495
- ].join("\n");
496
- },
497
289
  };
498
290
  }
499
-
500
- /**
501
- * AsrPlugin:语音识别插件。
502
- */
503
- export class AsrPlugin extends BasePlugin {
504
- readonly name = "asr";
505
-
506
- constructor(agent: AgentRuntime | null = null) {
507
- super(agent);
508
- Object.assign(this, createAsrPluginDefinition(this));
509
- }
510
- }