@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.
- package/bin/BuiltinPlugins.d.ts +4 -9
- package/bin/BuiltinPlugins.d.ts.map +1 -1
- package/bin/BuiltinPlugins.js +4 -8
- package/bin/BuiltinPlugins.js.map +1 -1
- package/bin/chat/Action.d.ts +8 -2
- package/bin/chat/Action.d.ts.map +1 -1
- package/bin/chat/Action.js +9 -5
- package/bin/chat/Action.js.map +1 -1
- package/bin/chat/ChatPlugin.d.ts +2 -22
- package/bin/chat/ChatPlugin.d.ts.map +1 -1
- package/bin/chat/ChatPlugin.js +2 -21
- package/bin/chat/ChatPlugin.js.map +1 -1
- package/bin/chat/Index.d.ts +1 -1
- package/bin/chat/Index.d.ts.map +1 -1
- package/bin/chat/channels/BaseChatChannel.js +1 -1
- package/bin/chat/channels/BaseChatChannel.js.map +1 -1
- package/bin/chat/channels/Configuration.d.ts +1 -1
- package/bin/chat/channels/Configuration.js +1 -1
- package/bin/chat/channels/RuntimeChannel.d.ts +2 -3
- package/bin/chat/channels/RuntimeChannel.d.ts.map +1 -1
- package/bin/chat/channels/RuntimeChannel.js +0 -8
- package/bin/chat/channels/RuntimeChannel.js.map +1 -1
- package/bin/chat/channels/feishu/Feishu.d.ts.map +1 -1
- package/bin/chat/channels/feishu/Feishu.js +2 -1
- package/bin/chat/channels/feishu/Feishu.js.map +1 -1
- package/bin/chat/runtime/ChannelContextStore.d.ts.map +1 -1
- package/bin/chat/runtime/ChannelContextStore.js +13 -12
- package/bin/chat/runtime/ChannelContextStore.js.map +1 -1
- package/bin/chat/runtime/ChatActionExecution.d.ts +26 -1
- package/bin/chat/runtime/ChatActionExecution.d.ts.map +1 -1
- package/bin/chat/runtime/ChatActionExecution.js +31 -3
- package/bin/chat/runtime/ChatActionExecution.js.map +1 -1
- package/bin/chat/runtime/ChatActionInput.d.ts +1 -2
- package/bin/chat/runtime/ChatActionInput.d.ts.map +1 -1
- package/bin/chat/runtime/ChatActionInput.js +1 -27
- package/bin/chat/runtime/ChatActionInput.js.map +1 -1
- package/bin/chat/runtime/ChatChannelActions.d.ts +2 -66
- package/bin/chat/runtime/ChatChannelActions.d.ts.map +1 -1
- package/bin/chat/runtime/ChatChannelActions.js +3 -195
- package/bin/chat/runtime/ChatChannelActions.js.map +1 -1
- package/bin/chat/runtime/ChatChannelConfig.d.ts +2 -23
- package/bin/chat/runtime/ChatChannelConfig.d.ts.map +1 -1
- package/bin/chat/runtime/ChatChannelConfig.js +3 -116
- package/bin/chat/runtime/ChatChannelConfig.js.map +1 -1
- package/bin/chat/runtime/ChatChannelCore.d.ts +0 -14
- package/bin/chat/runtime/ChatChannelCore.d.ts.map +1 -1
- package/bin/chat/runtime/ChatChannelCore.js +1 -1
- package/bin/chat/runtime/ChatChannelCore.js.map +1 -1
- package/bin/chat/runtime/ChatChannelFacade.d.ts +1 -1
- package/bin/chat/runtime/ChatChannelFacade.d.ts.map +1 -1
- package/bin/chat/runtime/ChatChannelFacade.js +1 -1
- package/bin/chat/runtime/ChatChannelFacade.js.map +1 -1
- package/bin/chat/runtime/ChatHistoryStore.d.ts.map +1 -1
- package/bin/chat/runtime/ChatHistoryStore.js +4 -3
- package/bin/chat/runtime/ChatHistoryStore.js.map +1 -1
- package/bin/chat/runtime/ChatPluginActionRegistry.d.ts.map +1 -1
- package/bin/chat/runtime/ChatPluginActionRegistry.js +27 -89
- package/bin/chat/runtime/ChatPluginActionRegistry.js.map +1 -1
- package/bin/chat/runtime/ChatPluginSystem.d.ts +3 -2
- package/bin/chat/runtime/ChatPluginSystem.d.ts.map +1 -1
- package/bin/chat/runtime/ChatPluginSystem.js +5 -5
- package/bin/chat/runtime/ChatPluginSystem.js.map +1 -1
- package/bin/chat/runtime/ChatQueueStore.d.ts +1 -1
- package/bin/chat/runtime/ChatQueueStore.js +2 -2
- package/bin/chat/runtime/ChatQueueStore.js.map +1 -1
- package/bin/chat/runtime/ChatQueueWorker.js +1 -1
- package/bin/chat/runtime/ChatQueueWorker.js.map +1 -1
- package/bin/chat/runtime/ChatSessionDelete.d.ts.map +1 -1
- package/bin/chat/runtime/ChatSessionDelete.js +11 -20
- package/bin/chat/runtime/ChatSessionDelete.js.map +1 -1
- package/bin/chat/runtime/ChatStorage.d.ts +32 -0
- package/bin/chat/runtime/ChatStorage.d.ts.map +1 -0
- package/bin/chat/runtime/ChatStorage.js +158 -0
- package/bin/chat/runtime/ChatStorage.js.map +1 -0
- package/bin/chat/runtime/SystemPrompt.d.ts +3 -2
- package/bin/chat/runtime/SystemPrompt.d.ts.map +1 -1
- package/bin/chat/runtime/SystemPrompt.js +4 -5
- package/bin/chat/runtime/SystemPrompt.js.map +1 -1
- package/bin/chat/types/ChannelConfiguration.d.ts +2 -2
- package/bin/chat/types/ChatPluginActionPayload.d.ts +7 -45
- package/bin/chat/types/ChatPluginActionPayload.d.ts.map +1 -1
- package/bin/chat/types/ChatPluginOptions.d.ts +0 -21
- package/bin/chat/types/ChatPluginOptions.d.ts.map +1 -1
- package/bin/chat/types/ChatStorage.d.ts +36 -0
- package/bin/chat/types/ChatStorage.d.ts.map +1 -0
- package/bin/chat/types/ChatStorage.js +9 -0
- package/bin/chat/types/ChatStorage.js.map +1 -0
- package/bin/contact/Action.d.ts +3 -2
- package/bin/contact/Action.d.ts.map +1 -1
- package/bin/contact/Action.js +2 -2
- package/bin/contact/Action.js.map +1 -1
- package/bin/contact/ContactPlugin.d.ts.map +1 -1
- package/bin/contact/ContactPlugin.js +17 -14
- package/bin/contact/ContactPlugin.js.map +1 -1
- package/bin/contact/runtime/ChatRuntime.js +1 -1
- package/bin/contact/runtime/ChatRuntime.js.map +1 -1
- package/bin/contact/types/ContactPluginOptions.d.ts +4 -0
- package/bin/contact/types/ContactPluginOptions.d.ts.map +1 -1
- package/bin/index.d.ts +5 -5
- package/bin/index.d.ts.map +1 -1
- package/bin/index.js +2 -2
- package/bin/index.js.map +1 -1
- package/bin/memory/Action.d.ts.map +1 -1
- package/bin/memory/Action.js +16 -4
- package/bin/memory/Action.js.map +1 -1
- package/bin/memory/runtime/Store.d.ts.map +1 -1
- package/bin/memory/runtime/Store.js +0 -22
- package/bin/memory/runtime/Store.js.map +1 -1
- package/bin/memory/runtime/Writer.d.ts +1 -1
- package/bin/memory/runtime/Writer.d.ts.map +1 -1
- package/bin/memory/runtime/Writer.js +2 -4
- package/bin/memory/runtime/Writer.js.map +1 -1
- package/bin/skill/Command.d.ts +3 -11
- package/bin/skill/Command.d.ts.map +1 -1
- package/bin/skill/Command.js +3 -31
- package/bin/skill/Command.js.map +1 -1
- package/bin/skill/PROMPT.d.ts +1 -1
- package/bin/skill/PROMPT.d.ts.map +1 -1
- package/bin/skill/PROMPT.js +1 -1
- package/bin/skill/PROMPT.js.map +1 -1
- package/bin/skill/Plugin.d.ts +3 -2
- package/bin/skill/Plugin.d.ts.map +1 -1
- package/bin/skill/Plugin.js +37 -129
- package/bin/skill/Plugin.js.map +1 -1
- package/bin/skill/runtime/Prompt.d.ts +11 -2
- package/bin/skill/runtime/Prompt.d.ts.map +1 -1
- package/bin/skill/runtime/Prompt.js +93 -8
- package/bin/skill/runtime/Prompt.js.map +1 -1
- package/bin/skill/runtime/SystemProvider.d.ts +2 -1
- package/bin/skill/runtime/SystemProvider.d.ts.map +1 -1
- package/bin/skill/runtime/SystemProvider.js +4 -9
- package/bin/skill/runtime/SystemProvider.js.map +1 -1
- package/bin/skill/types/SkillPlugin.d.ts +6 -18
- package/bin/skill/types/SkillPlugin.d.ts.map +1 -1
- package/bin/skill/types/SkillPlugin.js +2 -2
- package/bin/sound/Plugin.d.ts +69 -0
- package/bin/sound/Plugin.d.ts.map +1 -0
- package/bin/sound/Plugin.js +623 -0
- package/bin/sound/Plugin.js.map +1 -0
- package/bin/sound/types/SoundPlugin.d.ts +150 -0
- package/bin/sound/types/SoundPlugin.d.ts.map +1 -0
- package/bin/sound/types/SoundPlugin.js +10 -0
- package/bin/sound/types/SoundPlugin.js.map +1 -0
- package/bin/task/Action.d.ts +2 -0
- package/bin/task/Action.d.ts.map +1 -1
- package/bin/task/Action.js +6 -0
- package/bin/task/Action.js.map +1 -1
- package/bin/task/runtime/Runner.d.ts +4 -0
- package/bin/task/runtime/Runner.d.ts.map +1 -1
- package/bin/task/runtime/Runner.js +15 -11
- package/bin/task/runtime/Runner.js.map +1 -1
- package/bin/task/runtime/TaskActionExecution.d.ts +2 -0
- package/bin/task/runtime/TaskActionExecution.d.ts.map +1 -1
- package/bin/task/runtime/TaskActionExecution.js +1 -0
- package/bin/task/runtime/TaskActionExecution.js.map +1 -1
- package/bin/task/runtime/TaskPluginActionRegistry.d.ts.map +1 -1
- package/bin/task/runtime/TaskPluginActionRegistry.js +1 -0
- package/bin/task/runtime/TaskPluginActionRegistry.js.map +1 -1
- package/bin/task/runtime/TaskRunChatDispatch.js +1 -1
- package/bin/task/runtime/TaskRunChatDispatch.js.map +1 -1
- package/bin/task/runtime/TaskRunnerRound.d.ts.map +1 -1
- package/bin/task/runtime/TaskRunnerRound.js +19 -26
- package/bin/task/runtime/TaskRunnerRound.js.map +1 -1
- package/bin/task/runtime/TaskRunnerSession.d.ts +6 -2
- package/bin/task/runtime/TaskRunnerSession.d.ts.map +1 -1
- package/bin/task/runtime/TaskRunnerSession.js +93 -72
- package/bin/task/runtime/TaskRunnerSession.js.map +1 -1
- package/bin/task/runtime/TaskRunnerTypes.d.ts +4 -4
- package/bin/task/runtime/TaskRunnerTypes.d.ts.map +1 -1
- package/bin/task/types/TaskPluginOptions.d.ts.map +1 -1
- package/bin/web/PROMPT.d.ts +1 -1
- package/bin/web/PROMPT.d.ts.map +1 -1
- package/bin/web/PROMPT.js +2 -2
- package/bin/web/PROMPT.js.map +1 -1
- package/bin/web/Plugin.d.ts +1 -21
- package/bin/web/Plugin.d.ts.map +1 -1
- package/bin/web/Plugin.js +14 -79
- package/bin/web/Plugin.js.map +1 -1
- package/bin/web/runtime/Prompt.d.ts +14 -0
- package/bin/web/runtime/Prompt.d.ts.map +1 -0
- package/bin/web/runtime/Prompt.js +77 -0
- package/bin/web/runtime/Prompt.js.map +1 -0
- package/bin/web/types/WebPlugin.d.ts +40 -29
- package/bin/web/types/WebPlugin.d.ts.map +1 -1
- package/bin/web/types/WebPlugin.js +11 -3
- package/bin/web/types/WebPlugin.js.map +1 -1
- package/bin/workboard/runtime/Collector.js +1 -1
- package/bin/workboard/runtime/Collector.js.map +1 -1
- package/bin/workboard/runtime/Normalizer.js +1 -1
- package/bin/workboard/runtime/Normalizer.js.map +1 -1
- package/bin/workboard/runtime/SessionSummary.d.ts.map +1 -1
- package/bin/workboard/runtime/SessionSummary.js +11 -38
- package/bin/workboard/runtime/SessionSummary.js.map +1 -1
- package/package.json +8 -4
- package/scripts/chat-access.test.mjs +1 -1
- package/scripts/chat-channel-config.test.mjs +15 -64
- package/scripts/chat-storage.test.mjs +92 -0
- package/scripts/skill-plugin.test.mjs +93 -0
- package/scripts/sound-plugin.test.mjs +250 -0
- package/scripts/web-plugin.test.mjs +85 -0
- package/src/BuiltinPlugins.ts +7 -17
- package/src/chat/Action.ts +16 -5
- package/src/chat/ChatPlugin.ts +6 -35
- package/src/chat/Index.ts +0 -1
- package/src/chat/channels/BaseChatChannel.ts +1 -1
- package/src/chat/channels/Configuration.ts +1 -1
- package/src/chat/channels/RuntimeChannel.ts +2 -14
- package/src/chat/channels/feishu/Feishu.ts +2 -1
- package/src/chat/runtime/ChannelContextStore.ts +16 -12
- package/src/chat/runtime/ChatActionExecution.ts +48 -3
- package/src/chat/runtime/ChatActionInput.ts +0 -31
- package/src/chat/runtime/ChatChannelActions.ts +3 -254
- package/src/chat/runtime/ChatChannelConfig.ts +4 -133
- package/src/chat/runtime/ChatChannelCore.ts +1 -15
- package/src/chat/runtime/ChatChannelFacade.ts +0 -4
- package/src/chat/runtime/ChatHistoryStore.ts +4 -3
- package/src/chat/runtime/ChatPluginActionRegistry.ts +26 -98
- package/src/chat/runtime/ChatPluginSystem.ts +9 -3
- package/src/chat/runtime/ChatQueueStore.ts +2 -2
- package/src/chat/runtime/ChatQueueWorker.ts +1 -1
- package/src/chat/runtime/ChatSessionDelete.ts +11 -21
- package/src/chat/runtime/ChatStorage.ts +203 -0
- package/src/chat/runtime/SystemPrompt.ts +8 -3
- package/src/chat/types/ChannelConfiguration.ts +2 -2
- package/src/chat/types/ChatPluginActionPayload.ts +8 -49
- package/src/chat/types/ChatPluginOptions.ts +0 -22
- package/src/chat/types/ChatStorage.ts +37 -0
- package/src/contact/Action.ts +9 -1
- package/src/contact/ContactPlugin.ts +38 -14
- package/src/contact/runtime/ChatRuntime.ts +1 -1
- package/src/contact/types/ContactPluginOptions.ts +6 -0
- package/src/index.ts +16 -14
- package/src/memory/Action.ts +19 -4
- package/src/memory/runtime/Store.ts +0 -27
- package/src/memory/runtime/Writer.ts +2 -5
- package/src/skill/Command.ts +3 -33
- package/src/skill/PROMPT.ts +1 -1
- package/src/skill/PROMPT.ts.txt +5 -1
- package/src/skill/Plugin.ts +49 -156
- package/src/skill/runtime/Prompt.ts +109 -9
- package/src/skill/runtime/SystemProvider.ts +5 -9
- package/src/skill/types/SkillPlugin.ts +6 -18
- package/src/sound/Plugin.ts +699 -0
- package/src/sound/types/SoundPlugin.ts +163 -0
- package/src/task/Action.ts +8 -0
- package/src/task/runtime/Runner.ts +19 -13
- package/src/task/runtime/TaskActionExecution.ts +3 -0
- package/src/task/runtime/TaskPluginActionRegistry.ts +1 -0
- package/src/task/runtime/TaskRunChatDispatch.ts +1 -1
- package/src/task/runtime/TaskRunnerRound.ts +20 -38
- package/src/task/runtime/TaskRunnerSession.ts +108 -72
- package/src/task/runtime/TaskRunnerTypes.ts +4 -4
- package/src/task/types/TaskPluginOptions.ts +1 -0
- package/src/web/PROMPT.ts +2 -2
- package/src/web/PROMPT.ts.txt +4 -2
- package/src/web/Plugin.ts +20 -90
- package/src/web/runtime/Prompt.ts +99 -0
- package/src/web/types/WebPlugin.ts +42 -29
- package/src/workboard/runtime/Collector.ts +1 -1
- package/src/workboard/runtime/Normalizer.ts +1 -1
- package/src/workboard/runtime/SessionSummary.ts +11 -42
- package/bin/asr/Plugin.d.ts +0 -63
- package/bin/asr/Plugin.d.ts.map +0 -1
- package/bin/asr/Plugin.js +0 -280
- package/bin/asr/Plugin.js.map +0 -1
- package/bin/asr/types/AsrPlugin.d.ts +0 -114
- package/bin/asr/types/AsrPlugin.d.ts.map +0 -1
- package/bin/asr/types/AsrPlugin.js +0 -10
- package/bin/asr/types/AsrPlugin.js.map +0 -1
- package/bin/chat/runtime/ChatSession.d.ts +0 -97
- package/bin/chat/runtime/ChatSession.d.ts.map +0 -1
- package/bin/chat/runtime/ChatSession.js +0 -91
- package/bin/chat/runtime/ChatSession.js.map +0 -1
- package/bin/chat/runtime/ChatSessionContextComposer.d.ts +0 -45
- package/bin/chat/runtime/ChatSessionContextComposer.d.ts.map +0 -1
- package/bin/chat/runtime/ChatSessionContextComposer.js +0 -60
- package/bin/chat/runtime/ChatSessionContextComposer.js.map +0 -1
- package/bin/chat/runtime/ChatSessionTypes.d.ts +0 -30
- package/bin/chat/runtime/ChatSessionTypes.d.ts.map +0 -1
- package/bin/chat/runtime/ChatSessionTypes.js +0 -9
- package/bin/chat/runtime/ChatSessionTypes.js.map +0 -1
- package/bin/tts/Plugin.d.ts +0 -49
- package/bin/tts/Plugin.d.ts.map +0 -1
- package/bin/tts/Plugin.js +0 -247
- package/bin/tts/Plugin.js.map +0 -1
- package/bin/tts/types/TtsPlugin.d.ts +0 -122
- package/bin/tts/types/TtsPlugin.d.ts.map +0 -1
- package/bin/tts/types/TtsPlugin.js +0 -10
- package/bin/tts/types/TtsPlugin.js.map +0 -1
- package/bin/web/runtime/Install.d.ts +0 -19
- package/bin/web/runtime/Install.d.ts.map +0 -1
- package/bin/web/runtime/Install.js +0 -178
- package/bin/web/runtime/Install.js.map +0 -1
- package/src/asr/Plugin.ts +0 -322
- package/src/asr/types/AsrPlugin.ts +0 -118
- package/src/chat/runtime/ChatSession.ts +0 -168
- package/src/chat/runtime/ChatSessionContextComposer.ts +0 -106
- package/src/chat/runtime/ChatSessionTypes.ts +0 -32
- package/src/tts/Plugin.ts +0 -284
- package/src/tts/types/TtsPlugin.ts +0 -129
- 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
|
|
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
|
|
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;
|
package/src/web/PROMPT.ts.txt
CHANGED
|
@@ -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
|
|
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`:
|
|
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
|
|
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 {
|
|
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:
|
|
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
|
|
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: "
|
|
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:
|
|
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
|
|
199
|
-
const
|
|
200
|
-
|
|
201
|
-
|
|
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:
|
|
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
|
|
7
|
-
* - target
|
|
6
|
+
* - install action 只返回安装提示,不执行命令或修改文件。
|
|
7
|
+
* - target 表示需要安装说明的联网能力,不表示 agent 运行时默认选择。
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import type {
|
|
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
|
-
*
|
|
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
|
|
31
|
-
* - `agent-browser
|
|
32
|
-
* - `all
|
|
33
|
-
* - 默认值为 `web-access
|
|
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
|
|
41
|
-
* - `project
|
|
42
|
-
* -
|
|
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
|
-
|
|
65
|
+
kind: "instructions";
|
|
53
66
|
/**
|
|
54
|
-
*
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
* -
|
|
67
|
+
* 已归一化的联网能力目标。
|
|
68
|
+
*/
|
|
69
|
+
target: WebPluginInstallTarget;
|
|
70
|
+
/**
|
|
71
|
+
* 已归一化的 agent-browser CLI 安装作用域。
|
|
59
72
|
*/
|
|
60
|
-
|
|
73
|
+
scope: WebPluginInstallScope;
|
|
61
74
|
/**
|
|
62
|
-
*
|
|
75
|
+
* 提供给 Agent 执行的完整安装说明。
|
|
63
76
|
*/
|
|
64
|
-
|
|
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.
|
|
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.
|
|
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
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
}
|
package/bin/asr/Plugin.d.ts
DELETED
|
@@ -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
|
package/bin/asr/Plugin.d.ts.map
DELETED
|
@@ -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"}
|