@downcity/plugins 1.0.173 → 1.0.193

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 (301) hide show
  1. package/bin/BuiltinPlugins.d.ts +4 -9
  2. package/bin/BuiltinPlugins.d.ts.map +1 -1
  3. package/bin/BuiltinPlugins.js +4 -8
  4. package/bin/BuiltinPlugins.js.map +1 -1
  5. package/bin/chat/Action.d.ts +8 -2
  6. package/bin/chat/Action.d.ts.map +1 -1
  7. package/bin/chat/Action.js +9 -5
  8. package/bin/chat/Action.js.map +1 -1
  9. package/bin/chat/ChatPlugin.d.ts +2 -22
  10. package/bin/chat/ChatPlugin.d.ts.map +1 -1
  11. package/bin/chat/ChatPlugin.js +2 -21
  12. package/bin/chat/ChatPlugin.js.map +1 -1
  13. package/bin/chat/Index.d.ts +1 -1
  14. package/bin/chat/Index.d.ts.map +1 -1
  15. package/bin/chat/channels/BaseChatChannel.js +1 -1
  16. package/bin/chat/channels/BaseChatChannel.js.map +1 -1
  17. package/bin/chat/channels/Configuration.d.ts +1 -1
  18. package/bin/chat/channels/Configuration.js +1 -1
  19. package/bin/chat/channels/RuntimeChannel.d.ts +2 -3
  20. package/bin/chat/channels/RuntimeChannel.d.ts.map +1 -1
  21. package/bin/chat/channels/RuntimeChannel.js +0 -8
  22. package/bin/chat/channels/RuntimeChannel.js.map +1 -1
  23. package/bin/chat/channels/feishu/Feishu.d.ts.map +1 -1
  24. package/bin/chat/channels/feishu/Feishu.js +2 -1
  25. package/bin/chat/channels/feishu/Feishu.js.map +1 -1
  26. package/bin/chat/runtime/ChannelContextStore.d.ts.map +1 -1
  27. package/bin/chat/runtime/ChannelContextStore.js +13 -12
  28. package/bin/chat/runtime/ChannelContextStore.js.map +1 -1
  29. package/bin/chat/runtime/ChatActionExecution.d.ts +26 -1
  30. package/bin/chat/runtime/ChatActionExecution.d.ts.map +1 -1
  31. package/bin/chat/runtime/ChatActionExecution.js +31 -3
  32. package/bin/chat/runtime/ChatActionExecution.js.map +1 -1
  33. package/bin/chat/runtime/ChatActionInput.d.ts +1 -2
  34. package/bin/chat/runtime/ChatActionInput.d.ts.map +1 -1
  35. package/bin/chat/runtime/ChatActionInput.js +1 -27
  36. package/bin/chat/runtime/ChatActionInput.js.map +1 -1
  37. package/bin/chat/runtime/ChatChannelActions.d.ts +2 -66
  38. package/bin/chat/runtime/ChatChannelActions.d.ts.map +1 -1
  39. package/bin/chat/runtime/ChatChannelActions.js +3 -195
  40. package/bin/chat/runtime/ChatChannelActions.js.map +1 -1
  41. package/bin/chat/runtime/ChatChannelConfig.d.ts +2 -23
  42. package/bin/chat/runtime/ChatChannelConfig.d.ts.map +1 -1
  43. package/bin/chat/runtime/ChatChannelConfig.js +3 -116
  44. package/bin/chat/runtime/ChatChannelConfig.js.map +1 -1
  45. package/bin/chat/runtime/ChatChannelCore.d.ts +0 -14
  46. package/bin/chat/runtime/ChatChannelCore.d.ts.map +1 -1
  47. package/bin/chat/runtime/ChatChannelCore.js +1 -1
  48. package/bin/chat/runtime/ChatChannelCore.js.map +1 -1
  49. package/bin/chat/runtime/ChatChannelFacade.d.ts +1 -1
  50. package/bin/chat/runtime/ChatChannelFacade.d.ts.map +1 -1
  51. package/bin/chat/runtime/ChatChannelFacade.js +1 -1
  52. package/bin/chat/runtime/ChatChannelFacade.js.map +1 -1
  53. package/bin/chat/runtime/ChatHistoryStore.d.ts.map +1 -1
  54. package/bin/chat/runtime/ChatHistoryStore.js +4 -3
  55. package/bin/chat/runtime/ChatHistoryStore.js.map +1 -1
  56. package/bin/chat/runtime/ChatPluginActionRegistry.d.ts.map +1 -1
  57. package/bin/chat/runtime/ChatPluginActionRegistry.js +27 -89
  58. package/bin/chat/runtime/ChatPluginActionRegistry.js.map +1 -1
  59. package/bin/chat/runtime/ChatPluginSystem.d.ts +3 -2
  60. package/bin/chat/runtime/ChatPluginSystem.d.ts.map +1 -1
  61. package/bin/chat/runtime/ChatPluginSystem.js +5 -5
  62. package/bin/chat/runtime/ChatPluginSystem.js.map +1 -1
  63. package/bin/chat/runtime/ChatQueueStore.d.ts +1 -1
  64. package/bin/chat/runtime/ChatQueueStore.js +2 -2
  65. package/bin/chat/runtime/ChatQueueStore.js.map +1 -1
  66. package/bin/chat/runtime/ChatQueueWorker.js +1 -1
  67. package/bin/chat/runtime/ChatQueueWorker.js.map +1 -1
  68. package/bin/chat/runtime/ChatSessionDelete.d.ts.map +1 -1
  69. package/bin/chat/runtime/ChatSessionDelete.js +11 -20
  70. package/bin/chat/runtime/ChatSessionDelete.js.map +1 -1
  71. package/bin/chat/runtime/ChatStorage.d.ts +32 -0
  72. package/bin/chat/runtime/ChatStorage.d.ts.map +1 -0
  73. package/bin/chat/runtime/ChatStorage.js +158 -0
  74. package/bin/chat/runtime/ChatStorage.js.map +1 -0
  75. package/bin/chat/runtime/SystemPrompt.d.ts +3 -2
  76. package/bin/chat/runtime/SystemPrompt.d.ts.map +1 -1
  77. package/bin/chat/runtime/SystemPrompt.js +4 -5
  78. package/bin/chat/runtime/SystemPrompt.js.map +1 -1
  79. package/bin/chat/types/ChannelConfiguration.d.ts +2 -2
  80. package/bin/chat/types/ChatPluginActionPayload.d.ts +7 -45
  81. package/bin/chat/types/ChatPluginActionPayload.d.ts.map +1 -1
  82. package/bin/chat/types/ChatPluginOptions.d.ts +0 -21
  83. package/bin/chat/types/ChatPluginOptions.d.ts.map +1 -1
  84. package/bin/chat/types/ChatStorage.d.ts +36 -0
  85. package/bin/chat/types/ChatStorage.d.ts.map +1 -0
  86. package/bin/chat/types/ChatStorage.js +9 -0
  87. package/bin/chat/types/ChatStorage.js.map +1 -0
  88. package/bin/contact/Action.d.ts +3 -2
  89. package/bin/contact/Action.d.ts.map +1 -1
  90. package/bin/contact/Action.js +2 -2
  91. package/bin/contact/Action.js.map +1 -1
  92. package/bin/contact/ContactPlugin.d.ts.map +1 -1
  93. package/bin/contact/ContactPlugin.js +17 -14
  94. package/bin/contact/ContactPlugin.js.map +1 -1
  95. package/bin/contact/runtime/ChatRuntime.js +1 -1
  96. package/bin/contact/runtime/ChatRuntime.js.map +1 -1
  97. package/bin/contact/types/ContactPluginOptions.d.ts +4 -0
  98. package/bin/contact/types/ContactPluginOptions.d.ts.map +1 -1
  99. package/bin/index.d.ts +5 -5
  100. package/bin/index.d.ts.map +1 -1
  101. package/bin/index.js +2 -2
  102. package/bin/index.js.map +1 -1
  103. package/bin/memory/Action.d.ts.map +1 -1
  104. package/bin/memory/Action.js +16 -4
  105. package/bin/memory/Action.js.map +1 -1
  106. package/bin/memory/runtime/Store.d.ts.map +1 -1
  107. package/bin/memory/runtime/Store.js +0 -22
  108. package/bin/memory/runtime/Store.js.map +1 -1
  109. package/bin/memory/runtime/Writer.d.ts +1 -1
  110. package/bin/memory/runtime/Writer.d.ts.map +1 -1
  111. package/bin/memory/runtime/Writer.js +2 -4
  112. package/bin/memory/runtime/Writer.js.map +1 -1
  113. package/bin/skill/Command.d.ts +3 -11
  114. package/bin/skill/Command.d.ts.map +1 -1
  115. package/bin/skill/Command.js +3 -31
  116. package/bin/skill/Command.js.map +1 -1
  117. package/bin/skill/PROMPT.d.ts +1 -1
  118. package/bin/skill/PROMPT.d.ts.map +1 -1
  119. package/bin/skill/PROMPT.js +1 -1
  120. package/bin/skill/PROMPT.js.map +1 -1
  121. package/bin/skill/Plugin.d.ts +3 -2
  122. package/bin/skill/Plugin.d.ts.map +1 -1
  123. package/bin/skill/Plugin.js +37 -129
  124. package/bin/skill/Plugin.js.map +1 -1
  125. package/bin/skill/runtime/Prompt.d.ts +11 -2
  126. package/bin/skill/runtime/Prompt.d.ts.map +1 -1
  127. package/bin/skill/runtime/Prompt.js +93 -8
  128. package/bin/skill/runtime/Prompt.js.map +1 -1
  129. package/bin/skill/runtime/SystemProvider.d.ts +2 -1
  130. package/bin/skill/runtime/SystemProvider.d.ts.map +1 -1
  131. package/bin/skill/runtime/SystemProvider.js +4 -9
  132. package/bin/skill/runtime/SystemProvider.js.map +1 -1
  133. package/bin/skill/types/SkillPlugin.d.ts +6 -18
  134. package/bin/skill/types/SkillPlugin.d.ts.map +1 -1
  135. package/bin/skill/types/SkillPlugin.js +2 -2
  136. package/bin/sound/Plugin.d.ts +69 -0
  137. package/bin/sound/Plugin.d.ts.map +1 -0
  138. package/bin/sound/Plugin.js +623 -0
  139. package/bin/sound/Plugin.js.map +1 -0
  140. package/bin/sound/types/SoundPlugin.d.ts +150 -0
  141. package/bin/sound/types/SoundPlugin.d.ts.map +1 -0
  142. package/bin/sound/types/SoundPlugin.js +10 -0
  143. package/bin/sound/types/SoundPlugin.js.map +1 -0
  144. package/bin/task/Action.d.ts +2 -0
  145. package/bin/task/Action.d.ts.map +1 -1
  146. package/bin/task/Action.js +6 -0
  147. package/bin/task/Action.js.map +1 -1
  148. package/bin/task/runtime/Runner.d.ts +4 -0
  149. package/bin/task/runtime/Runner.d.ts.map +1 -1
  150. package/bin/task/runtime/Runner.js +15 -11
  151. package/bin/task/runtime/Runner.js.map +1 -1
  152. package/bin/task/runtime/TaskActionExecution.d.ts +2 -0
  153. package/bin/task/runtime/TaskActionExecution.d.ts.map +1 -1
  154. package/bin/task/runtime/TaskActionExecution.js +1 -0
  155. package/bin/task/runtime/TaskActionExecution.js.map +1 -1
  156. package/bin/task/runtime/TaskPluginActionRegistry.d.ts.map +1 -1
  157. package/bin/task/runtime/TaskPluginActionRegistry.js +1 -0
  158. package/bin/task/runtime/TaskPluginActionRegistry.js.map +1 -1
  159. package/bin/task/runtime/TaskRunChatDispatch.js +1 -1
  160. package/bin/task/runtime/TaskRunChatDispatch.js.map +1 -1
  161. package/bin/task/runtime/TaskRunnerRound.d.ts.map +1 -1
  162. package/bin/task/runtime/TaskRunnerRound.js +19 -26
  163. package/bin/task/runtime/TaskRunnerRound.js.map +1 -1
  164. package/bin/task/runtime/TaskRunnerSession.d.ts +6 -2
  165. package/bin/task/runtime/TaskRunnerSession.d.ts.map +1 -1
  166. package/bin/task/runtime/TaskRunnerSession.js +93 -72
  167. package/bin/task/runtime/TaskRunnerSession.js.map +1 -1
  168. package/bin/task/runtime/TaskRunnerTypes.d.ts +4 -4
  169. package/bin/task/runtime/TaskRunnerTypes.d.ts.map +1 -1
  170. package/bin/task/types/TaskPluginOptions.d.ts.map +1 -1
  171. package/bin/web/PROMPT.d.ts +1 -1
  172. package/bin/web/PROMPT.d.ts.map +1 -1
  173. package/bin/web/PROMPT.js +2 -2
  174. package/bin/web/PROMPT.js.map +1 -1
  175. package/bin/web/Plugin.d.ts +1 -21
  176. package/bin/web/Plugin.d.ts.map +1 -1
  177. package/bin/web/Plugin.js +14 -79
  178. package/bin/web/Plugin.js.map +1 -1
  179. package/bin/web/runtime/Prompt.d.ts +14 -0
  180. package/bin/web/runtime/Prompt.d.ts.map +1 -0
  181. package/bin/web/runtime/Prompt.js +77 -0
  182. package/bin/web/runtime/Prompt.js.map +1 -0
  183. package/bin/web/types/WebPlugin.d.ts +40 -29
  184. package/bin/web/types/WebPlugin.d.ts.map +1 -1
  185. package/bin/web/types/WebPlugin.js +11 -3
  186. package/bin/web/types/WebPlugin.js.map +1 -1
  187. package/bin/workboard/runtime/Collector.js +1 -1
  188. package/bin/workboard/runtime/Collector.js.map +1 -1
  189. package/bin/workboard/runtime/Normalizer.js +1 -1
  190. package/bin/workboard/runtime/Normalizer.js.map +1 -1
  191. package/bin/workboard/runtime/SessionSummary.d.ts.map +1 -1
  192. package/bin/workboard/runtime/SessionSummary.js +11 -38
  193. package/bin/workboard/runtime/SessionSummary.js.map +1 -1
  194. package/package.json +8 -4
  195. package/scripts/chat-access.test.mjs +1 -1
  196. package/scripts/chat-channel-config.test.mjs +15 -64
  197. package/scripts/chat-storage.test.mjs +92 -0
  198. package/scripts/skill-plugin.test.mjs +93 -0
  199. package/scripts/sound-plugin.test.mjs +250 -0
  200. package/scripts/web-plugin.test.mjs +85 -0
  201. package/src/BuiltinPlugins.ts +7 -17
  202. package/src/chat/Action.ts +16 -5
  203. package/src/chat/ChatPlugin.ts +6 -35
  204. package/src/chat/Index.ts +0 -1
  205. package/src/chat/channels/BaseChatChannel.ts +1 -1
  206. package/src/chat/channels/Configuration.ts +1 -1
  207. package/src/chat/channels/RuntimeChannel.ts +2 -14
  208. package/src/chat/channels/feishu/Feishu.ts +2 -1
  209. package/src/chat/runtime/ChannelContextStore.ts +16 -12
  210. package/src/chat/runtime/ChatActionExecution.ts +48 -3
  211. package/src/chat/runtime/ChatActionInput.ts +0 -31
  212. package/src/chat/runtime/ChatChannelActions.ts +3 -254
  213. package/src/chat/runtime/ChatChannelConfig.ts +4 -133
  214. package/src/chat/runtime/ChatChannelCore.ts +1 -15
  215. package/src/chat/runtime/ChatChannelFacade.ts +0 -4
  216. package/src/chat/runtime/ChatHistoryStore.ts +4 -3
  217. package/src/chat/runtime/ChatPluginActionRegistry.ts +26 -98
  218. package/src/chat/runtime/ChatPluginSystem.ts +9 -3
  219. package/src/chat/runtime/ChatQueueStore.ts +2 -2
  220. package/src/chat/runtime/ChatQueueWorker.ts +1 -1
  221. package/src/chat/runtime/ChatSessionDelete.ts +11 -21
  222. package/src/chat/runtime/ChatStorage.ts +203 -0
  223. package/src/chat/runtime/SystemPrompt.ts +8 -3
  224. package/src/chat/types/ChannelConfiguration.ts +2 -2
  225. package/src/chat/types/ChatPluginActionPayload.ts +8 -49
  226. package/src/chat/types/ChatPluginOptions.ts +0 -22
  227. package/src/chat/types/ChatStorage.ts +37 -0
  228. package/src/contact/Action.ts +9 -1
  229. package/src/contact/ContactPlugin.ts +38 -14
  230. package/src/contact/runtime/ChatRuntime.ts +1 -1
  231. package/src/contact/types/ContactPluginOptions.ts +6 -0
  232. package/src/index.ts +16 -14
  233. package/src/memory/Action.ts +19 -4
  234. package/src/memory/runtime/Store.ts +0 -27
  235. package/src/memory/runtime/Writer.ts +2 -5
  236. package/src/skill/Command.ts +3 -33
  237. package/src/skill/PROMPT.ts +1 -1
  238. package/src/skill/PROMPT.ts.txt +5 -1
  239. package/src/skill/Plugin.ts +49 -156
  240. package/src/skill/runtime/Prompt.ts +109 -9
  241. package/src/skill/runtime/SystemProvider.ts +5 -9
  242. package/src/skill/types/SkillPlugin.ts +6 -18
  243. package/src/sound/Plugin.ts +699 -0
  244. package/src/sound/types/SoundPlugin.ts +163 -0
  245. package/src/task/Action.ts +8 -0
  246. package/src/task/runtime/Runner.ts +19 -13
  247. package/src/task/runtime/TaskActionExecution.ts +3 -0
  248. package/src/task/runtime/TaskPluginActionRegistry.ts +1 -0
  249. package/src/task/runtime/TaskRunChatDispatch.ts +1 -1
  250. package/src/task/runtime/TaskRunnerRound.ts +20 -38
  251. package/src/task/runtime/TaskRunnerSession.ts +108 -72
  252. package/src/task/runtime/TaskRunnerTypes.ts +4 -4
  253. package/src/task/types/TaskPluginOptions.ts +1 -0
  254. package/src/web/PROMPT.ts +2 -2
  255. package/src/web/PROMPT.ts.txt +4 -2
  256. package/src/web/Plugin.ts +20 -90
  257. package/src/web/runtime/Prompt.ts +99 -0
  258. package/src/web/types/WebPlugin.ts +42 -29
  259. package/src/workboard/runtime/Collector.ts +1 -1
  260. package/src/workboard/runtime/Normalizer.ts +1 -1
  261. package/src/workboard/runtime/SessionSummary.ts +11 -42
  262. package/bin/asr/Plugin.d.ts +0 -63
  263. package/bin/asr/Plugin.d.ts.map +0 -1
  264. package/bin/asr/Plugin.js +0 -280
  265. package/bin/asr/Plugin.js.map +0 -1
  266. package/bin/asr/types/AsrPlugin.d.ts +0 -114
  267. package/bin/asr/types/AsrPlugin.d.ts.map +0 -1
  268. package/bin/asr/types/AsrPlugin.js +0 -10
  269. package/bin/asr/types/AsrPlugin.js.map +0 -1
  270. package/bin/chat/runtime/ChatSession.d.ts +0 -97
  271. package/bin/chat/runtime/ChatSession.d.ts.map +0 -1
  272. package/bin/chat/runtime/ChatSession.js +0 -91
  273. package/bin/chat/runtime/ChatSession.js.map +0 -1
  274. package/bin/chat/runtime/ChatSessionContextComposer.d.ts +0 -45
  275. package/bin/chat/runtime/ChatSessionContextComposer.d.ts.map +0 -1
  276. package/bin/chat/runtime/ChatSessionContextComposer.js +0 -60
  277. package/bin/chat/runtime/ChatSessionContextComposer.js.map +0 -1
  278. package/bin/chat/runtime/ChatSessionTypes.d.ts +0 -30
  279. package/bin/chat/runtime/ChatSessionTypes.d.ts.map +0 -1
  280. package/bin/chat/runtime/ChatSessionTypes.js +0 -9
  281. package/bin/chat/runtime/ChatSessionTypes.js.map +0 -1
  282. package/bin/tts/Plugin.d.ts +0 -49
  283. package/bin/tts/Plugin.d.ts.map +0 -1
  284. package/bin/tts/Plugin.js +0 -247
  285. package/bin/tts/Plugin.js.map +0 -1
  286. package/bin/tts/types/TtsPlugin.d.ts +0 -122
  287. package/bin/tts/types/TtsPlugin.d.ts.map +0 -1
  288. package/bin/tts/types/TtsPlugin.js +0 -10
  289. package/bin/tts/types/TtsPlugin.js.map +0 -1
  290. package/bin/web/runtime/Install.d.ts +0 -19
  291. package/bin/web/runtime/Install.d.ts.map +0 -1
  292. package/bin/web/runtime/Install.js +0 -178
  293. package/bin/web/runtime/Install.js.map +0 -1
  294. package/src/asr/Plugin.ts +0 -322
  295. package/src/asr/types/AsrPlugin.ts +0 -118
  296. package/src/chat/runtime/ChatSession.ts +0 -168
  297. package/src/chat/runtime/ChatSessionContextComposer.ts +0 -106
  298. package/src/chat/runtime/ChatSessionTypes.ts +0 -32
  299. package/src/tts/Plugin.ts +0 -284
  300. package/src/tts/types/TtsPlugin.ts +0 -129
  301. package/src/web/runtime/Install.ts +0 -241
package/src/web/PROMPT.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * 源文件:由同路径 `*.ts.txt` 生成。
4
4
  */
5
5
 
6
- // Source: src/web/PROMPT.ts.txt
7
- const TEXT_MODULE_CONTENT = "# Web Plugin\n\nThis plugin injects general web-access methodology. It does not choose a provider and does not guarantee that any specific web tool exists.\n\nIf web-related dependencies are needed, use the `web` plugin's `install` action to install capabilities such as `web-access`, `agent-browser`, or related skill/CLI dependencies. Installation only prepares capabilities; it does not mean the runtime must use a specific provider.\n\nWhen a task needs internet access, verification, webpage reading, webpage interaction, or browser use, choose the path based on the currently available tools, skills, and user goal.\n\n## General Principles\n\n- Goal-driven: think like a human. Define the success criteria first, then choose the starting point most likely to reach them directly.\n- Evidence at every step: each result is evidence. When a path stops making progress, switch methods instead of repeatedly retrying the wrong approach.\n- Prefer primary sources: search engines are for discovery. Conclusions should usually trace back to official sites, official platforms, original pages, official docs, or source code.\n- Stop when done: once the goal is reached, do not spend extra steps just to look more complete.\n- Capability self-check: do not assume that a web skill or tool exists. Prefer capabilities explicitly available in the current system/tool list or in already looked-up skills.\n\n## Tool Selection\n\n- To discover sources or map keyword context: prefer currently available search tools or web-access-style skills.\n- For a known URL where you need page text or a direct answer: prefer currently available fetch/read tools.\n- For a known URL where you need raw HTML, meta tags, JSON-LD, or similar structured content: prefer currently available HTTP/curl/shell capabilities.\n- For logged-in state, dynamic rendering, site navigation, complex interactions, or anti-bot pages: prefer currently available browser, Chrome, agent-browser, or computer-use capabilities.\n- Jina-style markdown preprocessing may help for article-like pages and save tokens, but do not blindly trust it for dashboards, product pages, or complex layouts.\n\n## Browser Strategy\n\n- Once in the browser layer, understand the page structure before choosing the next action.\n- Programmatic methods are faster but more likely to trigger anti-bot behavior. GUI interaction is slower but more deterministic. If programmatic access is blocked, fall back to GUI.\n- Prefer links generated by the page itself. Do not manually guess or trim internal URL parameters.\n- Operate only tabs you created. Do not disturb the user's existing tabs. Close tabs you created when the task is done.\n- When encountering a login wall, first decide whether it actually blocks the goal. Ask the user to log in only when the target cannot be reached otherwise.\n\n## Parallelism And Verification\n\n- Independent research targets may be split and run in parallel. Targets with dependencies should not be parallelized blindly.\n- Verification tasks should return to primary sources. Do not use multiple secondary reports to circularly confirm each other.\n\n## Relationship To Skills And Tools\n\n- If the current environment has a `web-access` skill, web search, scraping, and verification tasks may prefer its instructions.\n- If the current environment has `agent-browser`, browser, or Chrome capabilities, dynamic pages and logged-in tasks may prefer them.\n- If necessary web capability is missing, state that directly. Do not pretend you have accessed the web.\n\n## Available Action\n\n- `install`: prepare web-related skill/CLI dependencies.\n\nExample:\n\n```ts\nplugin_call({\n plugin: \"web\",\n action: \"install\",\n payload: {\n target: \"agent-browser\",\n scope: \"user\",\n },\n});\n```\n";
6
+ // Source: src/web/PROMPT.ts
7
+ const TEXT_MODULE_CONTENT = "# Web Plugin\n\nThis plugin injects general web-access methodology. It does not choose a provider and does not guarantee that any specific web tool exists.\n\nIf web-related dependencies are needed, use the `web` plugin's `install` action to receive instructions for capabilities such as `web-access` and `agent-browser`. The action never executes commands, accesses the network, installs dependencies, or changes files. Follow the returned prompt with the available plugin and Shell capabilities.\n\nWhen a task needs internet access, verification, webpage reading, webpage interaction, or browser use, choose the path based on the currently available tools, skills, and user goal.\n\n## General Principles\n\n- Goal-driven: think like a human. Define the success criteria first, then choose the starting point most likely to reach them directly.\n- Evidence at every step: each result is evidence. When a path stops making progress, switch methods instead of repeatedly retrying the wrong approach.\n- Prefer primary sources: search engines are for discovery. Conclusions should usually trace back to official sites, official platforms, original pages, official docs, or source code.\n- Stop when done: once the goal is reached, do not spend extra steps just to look more complete.\n- Capability self-check: do not assume that a web skill or tool exists. Prefer capabilities explicitly available in the current system/tool list or in already looked-up skills.\n\n## Tool Selection\n\n- To discover sources or map keyword context: prefer currently available search tools or web-access-style skills.\n- For a known URL where you need page text or a direct answer: prefer currently available fetch/read tools.\n- For a known URL where you need raw HTML, meta tags, JSON-LD, or similar structured content: prefer currently available HTTP/curl/shell capabilities.\n- For logged-in state, dynamic rendering, site navigation, complex interactions, or anti-bot pages: prefer currently available browser, Chrome, agent-browser, or computer-use capabilities.\n- Jina-style markdown preprocessing may help for article-like pages and save tokens, but do not blindly trust it for dashboards, product pages, or complex layouts.\n\n## Browser Strategy\n\n- Once in the browser layer, understand the page structure before choosing the next action.\n- Programmatic methods are faster but more likely to trigger anti-bot behavior. GUI interaction is slower but more deterministic. If programmatic access is blocked, fall back to GUI.\n- Prefer links generated by the page itself. Do not manually guess or trim internal URL parameters.\n- Operate only tabs you created. Do not disturb the user's existing tabs. Close tabs you created when the task is done.\n- When encountering a login wall, first decide whether it actually blocks the goal. Ask the user to log in only when the target cannot be reached otherwise.\n\n## Parallelism And Verification\n\n- Independent research targets may be split and run in parallel. Targets with dependencies should not be parallelized blindly.\n- Verification tasks should return to primary sources. Do not use multiple secondary reports to circularly confirm each other.\n\n## Relationship To Skills And Tools\n\n- If the current environment has a `web-access` skill, web search, scraping, and verification tasks may prefer its instructions.\n- If the current environment has `agent-browser`, browser, or Chrome capabilities, dynamic pages and logged-in tasks may prefer them.\n- If necessary web capability is missing, state that directly. Do not pretend you have accessed the web.\n\n## Available Action\n\n- `install`: return installation instructions for web-related Skills and CLIs without executing them.\n\nExample:\n\n```ts\nplugin_call({\n plugin: \"web\",\n action: \"install\",\n payload: {\n target: \"agent-browser\",\n scope: \"user\",\n },\n});\n```\n\nAfter calling `install`, follow `data.prompt`. Skill installation is delegated to the `skill.install` instruction action so that the active SkillPlugin scan roots remain the source of truth. After running the instructed Shell commands, verify Skills with `skill.list` and read them with `skill.lookup`.\n";
8
8
 
9
9
  export default TEXT_MODULE_CONTENT;
@@ -2,7 +2,7 @@
2
2
 
3
3
  This plugin injects general web-access methodology. It does not choose a provider and does not guarantee that any specific web tool exists.
4
4
 
5
- If web-related dependencies are needed, use the `web` plugin's `install` action to install capabilities such as `web-access`, `agent-browser`, or related skill/CLI dependencies. Installation only prepares capabilities; it does not mean the runtime must use a specific provider.
5
+ If web-related dependencies are needed, use the `web` plugin's `install` action to receive instructions for capabilities such as `web-access` and `agent-browser`. The action never executes commands, accesses the network, installs dependencies, or changes files. Follow the returned prompt with the available plugin and Shell capabilities.
6
6
 
7
7
  When a task needs internet access, verification, webpage reading, webpage interaction, or browser use, choose the path based on the currently available tools, skills, and user goal.
8
8
 
@@ -43,7 +43,7 @@ When a task needs internet access, verification, webpage reading, webpage intera
43
43
 
44
44
  ## Available Action
45
45
 
46
- - `install`: prepare web-related skill/CLI dependencies.
46
+ - `install`: return installation instructions for web-related Skills and CLIs without executing them.
47
47
 
48
48
  Example:
49
49
 
@@ -57,3 +57,5 @@ plugin_call({
57
57
  },
58
58
  });
59
59
  ```
60
+
61
+ After calling `install`, follow `data.prompt`. Skill installation is delegated to the `skill.install` instruction action so that the active SkillPlugin scan roots remain the source of truth. After running the instructed Shell commands, verify Skills with `skill.list` and read them with `skill.lookup`.
package/src/web/Plugin.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * 关键点(中文)
5
5
  * - web plugin 不选择 provider,也不持久化 provider 运行态。
6
- * - install action 只负责准备联网相关 skill / CLI 依赖。
6
+ * - install action 只返回联网能力安装提示,不执行命令或修改文件。
7
7
  * - 它只通过 `system()` 注入联网研究与浏览器使用方法论。
8
8
  * - 具体执行能力由当前 agent 已注册的 tools、skills 或外部 plugin 决定。
9
9
  */
@@ -12,13 +12,11 @@ import { BasePlugin } from "@downcity/agent";
12
12
  import { createAction } from "@downcity/agent";
13
13
  import { z } from "zod";
14
14
  import type { AgentContext } from "@downcity/agent";
15
- import type {
16
- JsonObject,
17
- JsonValue,
18
- } from "@downcity/agent";
15
+ import type { JsonObject, JsonValue, PluginActionResult } from "@downcity/agent";
19
16
  import { WEB_PLUGIN_PROMPT } from "@/web/WebPromptAssets.js";
20
- import { installWebPluginTargets } from "@/web/runtime/Install.js";
17
+ import { render_web_install_prompt } from "@/web/runtime/Prompt.js";
21
18
  import type { WebPluginInstallPayload } from "@/web/types/WebPlugin.js";
19
+ import { WEB_PLUGIN_ACTIONS } from "@/web/types/WebPlugin.js";
22
20
 
23
21
  /**
24
22
  * 读取字符串选项。
@@ -33,17 +31,6 @@ function get_string_opt(
33
31
  return trimmed || undefined;
34
32
  }
35
33
 
36
- /**
37
- * 读取布尔选项。
38
- */
39
- function get_boolean_opt(
40
- opts: Record<string, JsonValue>,
41
- key: string,
42
- ): boolean | undefined {
43
- const value = opts[key];
44
- return typeof value === "boolean" ? value : undefined;
45
- }
46
-
47
34
  /**
48
35
  * 读取安装目标。
49
36
  */
@@ -88,64 +75,17 @@ export class WebPlugin extends BasePlugin {
88
75
  readonly description =
89
76
  "Injects web research and browser-use methodology for agents.";
90
77
 
91
- /**
92
- * setup 面板:只准备联网相关依赖,不做 provider 配置。
93
- */
94
- readonly setup = {
95
- mode: "install" as const,
96
- title: "Install web capabilities",
97
- description:
98
- "安装 web-access、agent-browser 等联网相关 skill / CLI 依赖;不改变 agent 的运行时默认选择。",
99
- fields: [
100
- {
101
- key: "target",
102
- label: "联网能力",
103
- type: "select" as const,
104
- required: true,
105
- options: [
106
- {
107
- label: "web-access",
108
- value: "web-access",
109
- hint: "通用搜索、抓取与资料核实 skill",
110
- },
111
- {
112
- label: "agent-browser",
113
- value: "agent-browser",
114
- hint: "浏览器自动化 skill,并准备 agent-browser CLI",
115
- },
116
- {
117
- label: "全部",
118
- value: "all",
119
- hint: "同时准备 web-access 和 agent-browser",
120
- },
121
- ],
122
- },
123
- {
124
- key: "scope",
125
- label: "安装位置",
126
- type: "select" as const,
127
- required: true,
128
- options: [
129
- { label: "用户目录", value: "user", hint: "用户级 skill / 全局 CLI" },
130
- { label: "项目目录", value: "project", hint: "项目级 skill / devDependency" },
131
- ],
132
- },
133
- ],
134
- primaryAction: "install",
135
- };
136
-
137
78
  /**
138
79
  * WebPlugin 对外 action。
139
80
  */
140
81
  readonly actions = {
141
- install: createAction({
142
- description: "Install web-related skill / CLI dependencies (web-access, agent-browser).",
82
+ [WEB_PLUGIN_ACTIONS.install]: createAction({
83
+ description:
84
+ "Return instructions for installing web-related Skills and CLIs. This action does not install anything.",
143
85
  input_schema: {
144
86
  zod: z.object({
145
87
  target: z.enum(["web-access", "agent-browser", "all"]).optional(),
146
88
  scope: z.enum(["user", "project"]).optional(),
147
- yes: z.boolean().optional(),
148
- agent: z.string().optional(),
149
89
  }),
150
90
  json_schema: {
151
91
  type: "object",
@@ -153,32 +93,29 @@ export class WebPlugin extends BasePlugin {
153
93
  target: {
154
94
  type: "string",
155
95
  enum: ["web-access", "agent-browser", "all"],
156
- description: "Web capability to install.",
96
+ description: "Web capability to receive installation instructions for.",
157
97
  },
158
98
  scope: {
159
99
  type: "string",
160
100
  enum: ["user", "project"],
161
- description: "Installation scope.",
101
+ description: "Installation scope for the agent-browser CLI.",
162
102
  },
163
- yes: { type: "boolean", description: "Skip confirmation." },
164
- agent: { type: "string", description: "Target agent for skill installer." },
165
103
  },
166
104
  },
167
105
  },
168
106
  examples: [
169
107
  {
170
- title: "Install all web capabilities for user",
108
+ title: "Get user-level installation instructions for all web capabilities",
171
109
  payload: { target: "all", scope: "user" },
172
110
  },
173
111
  ],
174
112
  command: {
175
- description: "Install web-related skill / CLI dependencies.",
113
+ description:
114
+ "Return web capability installation instructions without executing them.",
176
115
  configure(command) {
177
116
  command
178
117
  .option("--target <target>", "web-access、agent-browser 或 all")
179
- .option("--scope <scope>", "安装位置:user 或 project")
180
- .option("-y, --yes", "跳过确认(默认 true)", true)
181
- .option("--agent <agent>", "skill installer 目标 agent");
118
+ .option("--scope <scope>", "agent-browser CLI 安装位置:user 或 project");
182
119
  },
183
120
  mapInput({ opts }): JsonObject {
184
121
  return {
@@ -188,25 +125,18 @@ export class WebPlugin extends BasePlugin {
188
125
  ...(get_install_scope_opt(opts)
189
126
  ? { scope: get_install_scope_opt(opts) }
190
127
  : {}),
191
- ...(typeof get_boolean_opt(opts, "yes") === "boolean"
192
- ? { yes: get_boolean_opt(opts, "yes") }
193
- : {}),
194
- ...(get_string_opt(opts, "agent") ? { agent: get_string_opt(opts, "agent") } : {}),
195
128
  } satisfies JsonObject;
196
129
  },
197
130
  },
198
- execute: async ({ context, input }) => {
199
- const data = await installWebPluginTargets({
200
- context,
201
- payload:
202
- input && typeof input === "object" && !Array.isArray(input)
203
- ? (input as WebPluginInstallPayload)
204
- : undefined,
205
- });
131
+ execute({ input }): PluginActionResult<JsonObject> {
132
+ const result = render_web_install_prompt(
133
+ input as WebPluginInstallPayload | undefined,
134
+ );
206
135
  return {
207
136
  success: true,
208
- data,
209
- message: "web dependencies installed",
137
+ data: result,
138
+ message:
139
+ "Web capability installation instructions ready; no commands were executed and no files were changed.",
210
140
  };
211
141
  },
212
142
  }),
@@ -0,0 +1,99 @@
1
+ /**
2
+ * WebPlugin 安装提示词渲染器。
3
+ *
4
+ * 关键点(中文)
5
+ * - 只生成 Agent 可执行的操作说明,不执行命令、访问网络或修改文件。
6
+ * - Skill 安装委托给 SkillPlugin,避免重复维护扫描根与安装位置规则。
7
+ * - agent-browser CLI 仅根据请求的作用域提供 Shell 命令候选。
8
+ */
9
+
10
+ import type {
11
+ WebPluginInstallInstructions,
12
+ WebPluginInstallPayload,
13
+ WebPluginInstallScope,
14
+ WebPluginInstallTarget,
15
+ } from "@/web/types/WebPlugin.js";
16
+
17
+ /**
18
+ * 归一化联网能力目标。
19
+ */
20
+ function resolve_install_target(
21
+ target: WebPluginInstallPayload["target"],
22
+ ): WebPluginInstallTarget {
23
+ return target === "agent-browser" || target === "all"
24
+ ? target
25
+ : "web-access";
26
+ }
27
+
28
+ /**
29
+ * 归一化 CLI 安装作用域。
30
+ */
31
+ function resolve_install_scope(
32
+ scope: WebPluginInstallPayload["scope"],
33
+ ): WebPluginInstallScope {
34
+ return scope === "project" ? "project" : "user";
35
+ }
36
+
37
+ /**
38
+ * 渲染单个 Skill 的安装工作流。
39
+ */
40
+ function render_skill_install_step(skill_name: string): string {
41
+ return [
42
+ `- Call \`plugin_call({ plugin: "skill", action: "install", payload: { spec: "${skill_name}" } })\`.`,
43
+ " Follow the returned scan-aware Shell instructions. The WebPlugin has not installed this Skill.",
44
+ ].join("\n");
45
+ }
46
+
47
+ /**
48
+ * 渲染 agent-browser CLI 的安装提示。
49
+ */
50
+ function render_agent_browser_cli_step(scope: WebPluginInstallScope): string {
51
+ if (scope === "project") {
52
+ return [
53
+ "- Inspect the project lockfile and use its existing package manager to install `agent-browser` as a devDependency:",
54
+ " - pnpm: `pnpm add -D agent-browser`",
55
+ " - npm: `npm install -D agent-browser`",
56
+ " - yarn: `yarn add -D agent-browser`",
57
+ "- Verify the project-local CLI with the matching package-manager command, for example `pnpm exec agent-browser --help`.",
58
+ ].join("\n");
59
+ }
60
+
61
+ return [
62
+ "- Install the CLI globally with `npm install -g agent-browser`.",
63
+ "- Verify it with `agent-browser --help`.",
64
+ ].join("\n");
65
+ }
66
+
67
+ /**
68
+ * 生成 web install action 返回的纯提示词。
69
+ */
70
+ export function render_web_install_prompt(
71
+ payload: WebPluginInstallPayload | null | undefined,
72
+ ): WebPluginInstallInstructions {
73
+ const target = resolve_install_target(payload?.target);
74
+ const scope = resolve_install_scope(payload?.scope);
75
+ const skill_names =
76
+ target === "all" ? ["web-access", "agent-browser"] : [target];
77
+ const skill_steps = skill_names.map(render_skill_install_step).join("\n");
78
+ const cli_steps =
79
+ target === "agent-browser" || target === "all"
80
+ ? ["", "## agent-browser CLI", render_agent_browser_cli_step(scope)]
81
+ : [];
82
+
83
+ const prompt = [
84
+ "# Install Web Capabilities Instructions",
85
+ "",
86
+ "This action only returns instructions. It has not executed commands, accessed the network, installed dependencies, or changed files.",
87
+ "",
88
+ "## Skills",
89
+ skill_steps,
90
+ ...cli_steps,
91
+ "",
92
+ "## Verification",
93
+ "After completing the Shell steps, call `plugin_call({ plugin: \"skill\", action: \"list\", payload: {} })` and confirm every requested Skill is discoverable.",
94
+ "Call `skill.lookup` for each installed Skill before using it.",
95
+ "If the `skill` plugin is unavailable, configure it before installing a Skill; do not guess an unscanned destination.",
96
+ ].join("\n");
97
+
98
+ return { kind: "instructions", target, scope, prompt };
99
+ }
@@ -3,63 +3,76 @@
3
3
  *
4
4
  * 关键点(中文)
5
5
  * - web plugin 只注入联网方法论,不维护 provider 运行态。
6
- * - install action 仅用于准备联网相关 skill 与工具依赖。
7
- * - target 表示要准备的联网能力,不表示 agent 运行时默认选择。
6
+ * - install action 只返回安装提示,不执行命令或修改文件。
7
+ * - target 表示需要安装说明的联网能力,不表示 agent 运行时默认选择。
8
8
  */
9
9
 
10
- import type { JsonValue } from "@downcity/agent";
10
+ import type { JsonObject } from "@downcity/agent";
11
11
 
12
12
  /**
13
- * WebPlugin 可安装目标。
13
+ * WebPlugin action 名称常量。
14
+ */
15
+ export const WEB_PLUGIN_ACTIONS = {
16
+ /**
17
+ * 返回联网能力的安装操作提示。
18
+ */
19
+ install: "install",
20
+ } as const;
21
+
22
+ /**
23
+ * WebPlugin 安装提示目标。
14
24
  */
15
25
  export type WebPluginInstallTarget = "web-access" | "agent-browser" | "all";
16
26
 
17
27
  /**
18
- * WebPlugin 安装作用域。
28
+ * agent-browser CLI 安装作用域。
19
29
  */
20
30
  export type WebPluginInstallScope = "user" | "project";
21
31
 
22
32
  /**
23
- * WebPlugin install action 输入。
33
+ * WebPlugin install 提示 action 输入。
24
34
  */
25
35
  export interface WebPluginInstallPayload {
26
36
  /**
27
- * 要准备的联网能力。
37
+ * 需要获取安装说明的联网能力。
28
38
  *
29
39
  * 说明(中文)
30
- * - `web-access`:安装 web-access skill。
31
- * - `agent-browser`:安装 agent-browser skill,并准备 agent-browser CLI 包。
32
- * - `all`:同时准备以上能力。
33
- * - 默认值为 `web-access`,避免默认安装额外 CLI。
40
+ * - `web-access`:返回 web-access Skill 的安装工作流。
41
+ * - `agent-browser`:返回 agent-browser Skill CLI 的安装工作流。
42
+ * - `all`:返回以上全部能力的安装工作流。
43
+ * - 默认值为 `web-access`。
34
44
  */
35
45
  target?: WebPluginInstallTarget;
36
46
  /**
37
- * 安装作用域。
47
+ * agent-browser CLI 的安装作用域。
38
48
  *
39
49
  * 说明(中文)
40
- * - `user`:安装到用户级 skill / npm 全局环境。
41
- * - `project`:安装到当前项目级 skill / devDependency。
42
- * - 默认值为 `user`,避免默认修改项目依赖。
50
+ * - `user`:提示 Agent CLI 安装到 npm 全局环境。
51
+ * - `project`:提示 Agent 使用项目已有的包管理器安装 devDependency。
52
+ * - Skill 安装位置由 SkillPlugin 的扫描配置决定,不受此字段控制。
53
+ * - 默认值为 `user`。
43
54
  */
44
55
  scope?: WebPluginInstallScope;
56
+ }
57
+
58
+ /**
59
+ * WebPlugin install action 返回的安装提示数据。
60
+ */
61
+ export interface WebPluginInstallInstructions extends JsonObject {
45
62
  /**
46
- * 是否跳过安装确认。
47
- *
48
- * 说明(中文)
49
- * - 会透传给底层 skill installer。
50
- * - 默认值为 `true`,适合 agent 自动执行。
63
+ * 标识当前结果只包含操作说明。
51
64
  */
52
- yes?: boolean;
65
+ kind: "instructions";
53
66
  /**
54
- * skill installer 的目标 agent 名称。
55
- *
56
- * 说明(中文)
57
- * - 留空时不向底层 skill installer 传递 `--agent`。
58
- * - 只有需要显式指定 installer 目标时才传入。
67
+ * 已归一化的联网能力目标。
68
+ */
69
+ target: WebPluginInstallTarget;
70
+ /**
71
+ * 已归一化的 agent-browser CLI 安装作用域。
59
72
  */
60
- agent?: string;
73
+ scope: WebPluginInstallScope;
61
74
  /**
62
- * 允许保留额外 JSON 字段,便于未来扩展安装器参数。
75
+ * 提供给 Agent 执行的完整安装说明。
63
76
  */
64
- [key: string]: JsonValue | undefined;
77
+ prompt: string;
65
78
  }
@@ -29,7 +29,7 @@ export async function collectWorkboardSnapshot(
29
29
  context: AgentContext,
30
30
  ): Promise<WorkboardSnapshot> {
31
31
  const collectedAt = new Date().toISOString();
32
- const executingSessionIds = new Set(context.session.listExecutingSessionIds());
32
+ const executingSessionIds = new Set(context.sessions.list_executing_session_ids());
33
33
  const sessions = await listWorkboardSessionSummaries({
34
34
  context,
35
35
  limit: WORKBOARD_RECENT_LIMIT + Math.max(executingSessionIds.size, 1),
@@ -92,7 +92,7 @@ export function toWorkboardAgentSummary(params: {
92
92
  });
93
93
 
94
94
  return {
95
- name: String(params.context.config.id || "").trim() || "agent",
95
+ name: String(params.context.agent_id || "").trim() || "agent",
96
96
  running: true,
97
97
  statusText,
98
98
  collectedAt: params.collectedAt,
@@ -6,8 +6,6 @@
6
6
  * - 这里只读取消息数量、更新时间与执行中状态,不暴露消息内容。
7
7
  */
8
8
 
9
- import fs from "fs-extra";
10
- import path from "node:path";
11
9
  import type { AgentContext } from "@downcity/agent";
12
10
 
13
11
  /**
@@ -49,44 +47,15 @@ export async function listWorkboardSessionSummaries(params: {
49
47
  */
50
48
  executingSessionIds?: Set<string>;
51
49
  }): Promise<WorkboardSessionSummary[]> {
52
- const root_dir = params.context.paths.getDowncitySessionRootDirPath();
53
- if (!(await fs.pathExists(root_dir))) return [];
54
-
55
- const entries = await fs.readdir(root_dir, { withFileTypes: true });
56
- const items: WorkboardSessionSummary[] = [];
57
-
58
- for (const entry of entries) {
59
- if (!entry.isDirectory()) continue;
60
- const session_id = decodeMaybe(entry.name);
61
- if (!session_id) continue;
62
- const messages_path = path.join(
63
- params.context.paths.getDowncitySessionDirPath(session_id),
64
- "messages",
65
- "messages.jsonl",
66
- );
67
- const stat = await fs.stat(messages_path).catch(() => null);
68
- items.push({
69
- sessionId: session_id,
70
- messageCount: await countJsonlLines(messages_path),
71
- ...(stat ? { updatedAt: stat.mtimeMs } : {}),
72
- ...(params.executingSessionIds?.has(session_id) ? { executing: true } : {}),
73
- });
74
- }
75
-
76
- items.sort((a, b) => (b.updatedAt || 0) - (a.updatedAt || 0));
77
- return items.slice(0, Math.max(1, params.limit));
78
- }
79
-
80
- async function countJsonlLines(file_path: string): Promise<number> {
81
- const raw = await fs.readFile(file_path, "utf-8").catch(() => "");
82
- if (!raw) return 0;
83
- return raw.split("\n").filter((line) => line.trim()).length;
84
- }
85
-
86
- function decodeMaybe(value: string): string {
87
- try {
88
- return decodeURIComponent(String(value || "")).trim();
89
- } catch {
90
- return String(value || "").trim();
91
- }
50
+ const page = await params.context.sessions.list({
51
+ limit: Math.max(1, params.limit),
52
+ });
53
+ return page.items.map((item) => ({
54
+ sessionId: item.sessionId,
55
+ messageCount: item.messageCount,
56
+ ...(typeof item.updatedAt === "number" ? { updatedAt: item.updatedAt } : {}),
57
+ ...(item.executing || params.executingSessionIds?.has(item.sessionId)
58
+ ? { executing: true }
59
+ : {}),
60
+ }));
92
61
  }
@@ -1,63 +0,0 @@
1
- /**
2
- * AsrPlugin:语音转写插件。
3
- *
4
- * 关键点(中文)
5
- * - ASR 能力通过 constructor 注入,推荐传入 `city.ai.asr`。
6
- * - plugin 不负责本地模型、Python 依赖、provider 或项目配置。
7
- * - `auto: true` 时会在 chat 入站阶段自动转写 voice/audio 附件,并把结果写入正文。
8
- */
9
- import { BasePlugin } from "@downcity/agent";
10
- import type { AgentContext } from "@downcity/agent";
11
- import type { JsonObject, JsonValue } from "@downcity/agent";
12
- import type { AsrPluginOptions } from "../asr/types/AsrPlugin.js";
13
- /**
14
- * Agent ASR 插件。
15
- */
16
- export declare class AsrPlugin extends BasePlugin {
17
- /**
18
- * 当前 plugin 稳定名称。
19
- */
20
- readonly name: string;
21
- /**
22
- * 插件标题。
23
- */
24
- readonly title: string;
25
- /**
26
- * 插件说明。
27
- */
28
- readonly description: string;
29
- private readonly asr;
30
- private readonly auto;
31
- private readonly language?;
32
- constructor(options: AsrPluginOptions);
33
- /**
34
- * ASR 插件给模型的使用说明。
35
- */
36
- system(_context: AgentContext): string;
37
- /**
38
- * 执行一次 ASR 转写。
39
- */
40
- private transcribe;
41
- /**
42
- * 自动增强 chat 入站消息。
43
- */
44
- private auto_transcribe_inbound;
45
- /**
46
- * pipeline / action 扩展点。
47
- */
48
- readonly hooks: {
49
- pipeline: {
50
- "chat.augmentInbound": (({ context, value }: {
51
- context: AgentContext;
52
- value: JsonValue;
53
- }) => Promise<JsonValue>)[];
54
- };
55
- };
56
- /**
57
- * 显式 action 集合。
58
- */
59
- readonly actions: {
60
- transcribe: import("@downcity/agent").PluginAction<JsonValue, JsonObject>;
61
- };
62
- }
63
- //# sourceMappingURL=Plugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/asr/Plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACV,MAAM,iBAAiB,CAAC;AAMzB,OAAO,KAAK,EAEV,gBAAgB,EAEjB,MAAM,0BAA0B,CAAC;AAoGlC;;GAEG;AACH,qBAAa,SAAU,SAAQ,UAAU;IACvC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA0B;IAC9C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAU;IAC/B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAS;gBAEvB,OAAO,EAAE,gBAAgB;IAsBrC;;OAEG;IACH,MAAM,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM;IA4BtC;;OAEG;YACW,UAAU;IAQxB;;OAEG;YACW,uBAAuB;IAqCrC;;OAEG;IACH,QAAQ,CAAC,KAAK;;yDAGmB;gBAAE,OAAO,EAAE,YAAY,CAAC;gBAAC,KAAK,EAAE,SAAS,CAAA;aAAE;;MAK1E;IAEF;;OAEG;IACH,QAAQ,CAAC,OAAO;;MAkDd;CACH"}