@downcity/plugins 1.0.253 → 1.0.280
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/builtin/BuiltinPluginReadmes.d.ts +14 -0
- package/bin/builtin/BuiltinPluginReadmes.d.ts.map +1 -0
- package/bin/builtin/BuiltinPluginReadmes.js +58 -0
- package/bin/builtin/BuiltinPluginReadmes.js.map +1 -0
- package/bin/builtin/BuiltinPluginTypes.d.ts +48 -0
- package/bin/builtin/BuiltinPluginTypes.d.ts.map +1 -0
- package/bin/builtin/BuiltinPluginTypes.js +161 -0
- package/bin/builtin/BuiltinPluginTypes.js.map +1 -0
- package/bin/builtin/PluginSettingsDefinitions.d.ts +9 -0
- package/bin/builtin/PluginSettingsDefinitions.d.ts.map +1 -0
- package/bin/builtin/PluginSettingsDefinitions.js +41 -0
- package/bin/builtin/PluginSettingsDefinitions.js.map +1 -0
- package/bin/builtin/main/PluginSettingsMain.d.ts +6 -0
- package/bin/builtin/main/PluginSettingsMain.d.ts.map +1 -0
- package/bin/builtin/main/PluginSettingsMain.js +65 -0
- package/bin/builtin/main/PluginSettingsMain.js.map +1 -0
- package/bin/builtin/renderer/PluginSettingsRenderer.d.ts +6 -0
- package/bin/builtin/renderer/PluginSettingsRenderer.d.ts.map +1 -0
- package/bin/builtin/renderer/PluginSettingsRenderer.js +76 -0
- package/bin/builtin/renderer/PluginSettingsRenderer.js.map +1 -0
- package/bin/builtin/types/PluginSettings.d.ts +35 -0
- package/bin/builtin/types/PluginSettings.d.ts.map +1 -0
- package/bin/builtin/types/PluginSettings.js +3 -0
- package/bin/builtin/types/PluginSettings.js.map +1 -0
- package/bin/chat/ChatPlugin.d.ts +12 -28
- package/bin/chat/ChatPlugin.d.ts.map +1 -1
- package/bin/chat/ChatPlugin.js +97 -49
- package/bin/chat/ChatPlugin.js.map +1 -1
- package/bin/chat/access/ChatAccessRuntime.js +1 -1
- package/bin/chat/access/ChatAccessRuntime.js.map +1 -1
- package/bin/chat/access/ChatAccessSchema.d.ts +2 -2
- package/bin/chat/access/ChatAccessSchema.d.ts.map +1 -1
- package/bin/chat/access/ChatAccessSchema.js +3 -3
- package/bin/chat/access/ChatAccessSchema.js.map +1 -1
- package/bin/chat/access/ChatAccessService.d.ts +2 -2
- package/bin/chat/access/ChatAccessService.d.ts.map +1 -1
- package/bin/chat/access/ChatAccessService.js +4 -4
- package/bin/chat/access/ChatAccessService.js.map +1 -1
- package/bin/chat/access/ChatAccessStore.d.ts +3 -3
- package/bin/chat/access/ChatAccessStore.d.ts.map +1 -1
- package/bin/chat/access/ChatAccessStore.js +17 -8
- package/bin/chat/access/ChatAccessStore.js.map +1 -1
- package/bin/chat/channels/BaseChatChannel.d.ts +1 -0
- package/bin/chat/channels/BaseChatChannel.d.ts.map +1 -1
- package/bin/chat/channels/BaseChatChannel.js +2 -0
- package/bin/chat/channels/BaseChatChannel.js.map +1 -1
- package/bin/chat/channels/RuntimeChannel.d.ts +4 -4
- package/bin/chat/channels/RuntimeChannel.d.ts.map +1 -1
- package/bin/chat/channels/RuntimeChannel.js +8 -8
- package/bin/chat/channels/RuntimeChannel.js.map +1 -1
- package/bin/chat/channels/feishu/Feishu.js +1 -1
- package/bin/chat/channels/feishu/Feishu.js.map +1 -1
- package/bin/chat/channels/feishu/FeishuPlatformClient.d.ts +1 -0
- package/bin/chat/channels/feishu/FeishuPlatformClient.d.ts.map +1 -1
- package/bin/chat/channels/feishu/FeishuPlatformClient.js +3 -0
- package/bin/chat/channels/feishu/FeishuPlatformClient.js.map +1 -1
- package/bin/chat/channels/feishu/FeishuPlatformLookup.d.ts +2 -0
- package/bin/chat/channels/feishu/FeishuPlatformLookup.d.ts.map +1 -1
- package/bin/chat/channels/feishu/FeishuPlatformLookup.js +1 -1
- package/bin/chat/channels/feishu/FeishuPlatformLookup.js.map +1 -1
- package/bin/chat/channels/qq/QQ.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQ.js +3 -2
- package/bin/chat/channels/qq/QQ.js.map +1 -1
- package/bin/chat/channels/qq/QQEventCapture.d.ts +1 -1
- package/bin/chat/channels/qq/QQEventCapture.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQEventCapture.js +3 -3
- package/bin/chat/channels/qq/QQEventCapture.js.map +1 -1
- package/bin/chat/channels/qq/QQInboundDedupe.d.ts +1 -1
- package/bin/chat/channels/qq/QQInboundDedupe.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQInboundDedupe.js +1 -1
- package/bin/chat/channels/qq/QQInboundDedupe.js.map +1 -1
- package/bin/chat/channels/qq/QQMessageHandler.d.ts +4 -0
- package/bin/chat/channels/qq/QQMessageHandler.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQMessageHandler.js +2 -0
- package/bin/chat/channels/qq/QQMessageHandler.js.map +1 -1
- package/bin/chat/channels/qq/QQSupport.d.ts +4 -0
- package/bin/chat/channels/qq/QQSupport.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQSupport.js +1 -0
- package/bin/chat/channels/qq/QQSupport.js.map +1 -1
- package/bin/chat/channels/qq/VoiceInput.d.ts +3 -0
- package/bin/chat/channels/qq/VoiceInput.d.ts.map +1 -1
- package/bin/chat/channels/qq/VoiceInput.js +1 -1
- package/bin/chat/channels/qq/VoiceInput.js.map +1 -1
- package/bin/chat/channels/telegram/ApiClient.d.ts +3 -1
- package/bin/chat/channels/telegram/ApiClient.d.ts.map +1 -1
- package/bin/chat/channels/telegram/ApiClient.js +4 -2
- package/bin/chat/channels/telegram/ApiClient.js.map +1 -1
- package/bin/chat/channels/telegram/StateStore.d.ts +1 -1
- package/bin/chat/channels/telegram/StateStore.d.ts.map +1 -1
- package/bin/chat/channels/telegram/StateStore.js +2 -2
- package/bin/chat/channels/telegram/StateStore.js.map +1 -1
- package/bin/chat/channels/telegram/TelegramPlatformClient.d.ts.map +1 -1
- package/bin/chat/channels/telegram/TelegramPlatformClient.js +2 -1
- package/bin/chat/channels/telegram/TelegramPlatformClient.js.map +1 -1
- package/bin/chat/main/ChatPluginMain.d.ts +4 -0
- package/bin/chat/main/ChatPluginMain.d.ts.map +1 -0
- package/bin/chat/main/ChatPluginMain.js +137 -0
- package/bin/chat/main/ChatPluginMain.js.map +1 -0
- package/bin/chat/renderer/ChatPluginRenderer.d.ts +4 -0
- package/bin/chat/renderer/ChatPluginRenderer.d.ts.map +1 -0
- package/bin/chat/renderer/ChatPluginRenderer.js +105 -0
- package/bin/chat/renderer/ChatPluginRenderer.js.map +1 -0
- package/bin/chat/runtime/ChannelContextStore.d.ts +2 -2
- package/bin/chat/runtime/ChannelContextStore.js +20 -20
- package/bin/chat/runtime/ChannelContextStore.js.map +1 -1
- package/bin/chat/runtime/ChatActionExecution.js +6 -6
- package/bin/chat/runtime/ChatActionExecution.js.map +1 -1
- package/bin/chat/runtime/ChatChannelConfig.d.ts.map +1 -1
- package/bin/chat/runtime/ChatChannelConfig.js +7 -12
- package/bin/chat/runtime/ChatChannelConfig.js.map +1 -1
- package/bin/chat/runtime/ChatChannelCore.d.ts +3 -3
- package/bin/chat/runtime/ChatChannelCore.d.ts.map +1 -1
- package/bin/chat/runtime/ChatChannelCore.js +5 -5
- package/bin/chat/runtime/ChatChannelCore.js.map +1 -1
- package/bin/chat/runtime/ChatHistoryStore.d.ts +1 -1
- package/bin/chat/runtime/ChatHistoryStore.js +7 -7
- package/bin/chat/runtime/ChatHistoryStore.js.map +1 -1
- package/bin/chat/runtime/ChatMetaStore.d.ts +1 -1
- package/bin/chat/runtime/ChatMetaStore.js +1 -1
- package/bin/chat/runtime/ChatPluginActionRegistry.d.ts +1 -1
- package/bin/chat/runtime/ChatPluginActionRegistry.d.ts.map +1 -1
- package/bin/chat/runtime/ChatPluginActionRegistry.js +9 -9
- package/bin/chat/runtime/ChatPluginActionRegistry.js.map +1 -1
- package/bin/chat/runtime/ChatQueue.d.ts +3 -38
- package/bin/chat/runtime/ChatQueue.d.ts.map +1 -1
- package/bin/chat/runtime/ChatQueue.js +3 -51
- package/bin/chat/runtime/ChatQueue.js.map +1 -1
- package/bin/chat/runtime/ChatQueueStore.d.ts +5 -16
- package/bin/chat/runtime/ChatQueueStore.d.ts.map +1 -1
- package/bin/chat/runtime/ChatQueueStore.js +8 -22
- package/bin/chat/runtime/ChatQueueStore.js.map +1 -1
- package/bin/chat/runtime/ChatQueueWorker.d.ts +1 -1
- package/bin/chat/runtime/ChatQueueWorker.d.ts.map +1 -1
- package/bin/chat/runtime/ChatQueueWorker.js +1 -2
- package/bin/chat/runtime/ChatQueueWorker.js.map +1 -1
- package/bin/chat/runtime/ChatSessionDelete.d.ts +3 -3
- package/bin/chat/runtime/ChatSessionDelete.js +4 -4
- package/bin/chat/runtime/ChatSessionDelete.js.map +1 -1
- package/bin/chat/runtime/ChatStorage.d.ts +7 -7
- package/bin/chat/runtime/ChatStorage.js +24 -24
- package/bin/chat/runtime/ChatStorage.js.map +1 -1
- package/bin/chat/types/ChatAccess.d.ts +2 -2
- package/bin/chat/types/ChatAccess.d.ts.map +1 -1
- package/bin/chat/types/ChatCommand.d.ts +1 -1
- package/bin/chat/types/ChatPluginChannelConfig.d.ts +57 -0
- package/bin/chat/types/ChatPluginChannelConfig.d.ts.map +1 -0
- package/bin/chat/types/ChatPluginChannelConfig.js +3 -0
- package/bin/chat/types/ChatPluginChannelConfig.js.map +1 -0
- package/bin/chat/types/ChatPluginConfig.d.ts +19 -0
- package/bin/chat/types/ChatPluginConfig.d.ts.map +1 -0
- package/bin/chat/types/ChatPluginConfig.js +3 -0
- package/bin/chat/types/ChatPluginConfig.js.map +1 -0
- package/bin/chat/types/ChatPluginOptions.d.ts +4 -4
- package/bin/chat/types/ChatPluginOptions.d.ts.map +1 -1
- package/bin/chat/types/ChatPluginOptions.js +1 -1
- package/bin/chat/types/ChatPluginProfile.d.ts +39 -0
- package/bin/chat/types/ChatPluginProfile.d.ts.map +1 -0
- package/bin/chat/types/ChatPluginProfile.js +3 -0
- package/bin/chat/types/ChatPluginProfile.js.map +1 -0
- package/bin/chat/types/ChatPluginRenderer.d.ts +17 -0
- package/bin/chat/types/ChatPluginRenderer.d.ts.map +1 -0
- package/bin/chat/types/ChatPluginRenderer.js +3 -0
- package/bin/chat/types/ChatPluginRenderer.js.map +1 -0
- package/bin/chat/types/ChatRuntime.d.ts +11 -0
- package/bin/chat/types/ChatRuntime.d.ts.map +1 -1
- package/bin/chat/types/ChatRuntimeAccount.d.ts +3 -3
- package/bin/chat/types/ChatRuntimeAccount.d.ts.map +1 -1
- package/bin/chat/types/ChatRuntimeAccount.js +2 -2
- package/bin/chat/types/ChatStorage.d.ts +2 -2
- package/bin/chat/types/ChatStorage.d.ts.map +1 -1
- package/bin/chat.d.ts +3 -4
- package/bin/chat.d.ts.map +1 -1
- package/bin/chat.js +1 -2
- package/bin/chat.js.map +1 -1
- package/bin/contact/Action.js +5 -5
- package/bin/contact/Action.js.map +1 -1
- package/bin/contact/ContactPlugin.js +15 -15
- package/bin/contact/ContactPlugin.js.map +1 -1
- package/bin/contact/runtime/ChatRuntime.js +3 -3
- package/bin/contact/runtime/ChatRuntime.js.map +1 -1
- package/bin/contact/runtime/ContactStore.d.ts +8 -8
- package/bin/contact/runtime/ContactStore.d.ts.map +1 -1
- package/bin/contact/runtime/ContactStore.js +20 -20
- package/bin/contact/runtime/ContactStore.js.map +1 -1
- package/bin/contact/runtime/EndpointNotice.js +2 -2
- package/bin/contact/runtime/EndpointNotice.js.map +1 -1
- package/bin/contact/runtime/InboxStore.d.ts +6 -6
- package/bin/contact/runtime/InboxStore.d.ts.map +1 -1
- package/bin/contact/runtime/InboxStore.js +16 -16
- package/bin/contact/runtime/InboxStore.js.map +1 -1
- package/bin/contact/runtime/LinkApproval.js +14 -14
- package/bin/contact/runtime/LinkApproval.js.map +1 -1
- package/bin/contact/runtime/LinkStore.d.ts +2 -2
- package/bin/contact/runtime/LinkStore.d.ts.map +1 -1
- package/bin/contact/runtime/LinkStore.js +5 -5
- package/bin/contact/runtime/LinkStore.js.map +1 -1
- package/bin/contact/runtime/Paths.d.ts +15 -15
- package/bin/contact/runtime/Paths.d.ts.map +1 -1
- package/bin/contact/runtime/Paths.js +29 -29
- package/bin/contact/runtime/Paths.js.map +1 -1
- package/bin/contact/runtime/ShareBundle.d.ts +1 -1
- package/bin/contact/runtime/ShareBundle.d.ts.map +1 -1
- package/bin/contact/runtime/ShareBundle.js +4 -4
- package/bin/contact/runtime/ShareBundle.js.map +1 -1
- package/bin/contact/types/ContactApproval.d.ts +2 -2
- package/bin/contact/types/ContactApproval.d.ts.map +1 -1
- package/bin/image/ImagePlugin.d.ts +1 -4
- package/bin/image/ImagePlugin.d.ts.map +1 -1
- package/bin/image/ImagePlugin.js +26 -34
- package/bin/image/ImagePlugin.js.map +1 -1
- package/bin/image/runtime/ImageResultStorage.d.ts +2 -2
- package/bin/image/runtime/ImageResultStorage.d.ts.map +1 -1
- package/bin/image/runtime/ImageResultStorage.js +15 -38
- package/bin/image/runtime/ImageResultStorage.js.map +1 -1
- package/bin/image/types/ImagePlugin.d.ts +23 -16
- package/bin/image/types/ImagePlugin.d.ts.map +1 -1
- package/bin/image/types/ImagePlugin.js +1 -1
- package/bin/image.d.ts +1 -1
- package/bin/image.d.ts.map +1 -1
- package/bin/index.d.ts +2 -0
- package/bin/index.d.ts.map +1 -1
- package/bin/index.js +1 -0
- package/bin/index.js.map +1 -1
- package/bin/memory/Action.d.ts +27 -36
- package/bin/memory/Action.d.ts.map +1 -1
- package/bin/memory/Action.js +71 -311
- package/bin/memory/Action.js.map +1 -1
- package/bin/memory/MemoryPlugin.d.ts +20 -37
- package/bin/memory/MemoryPlugin.d.ts.map +1 -1
- package/bin/memory/MemoryPlugin.js +241 -233
- package/bin/memory/MemoryPlugin.js.map +1 -1
- package/bin/memory/adapters/FileMemoryStorageAdapter.d.ts +43 -0
- package/bin/memory/adapters/FileMemoryStorageAdapter.d.ts.map +1 -0
- package/bin/memory/adapters/FileMemoryStorageAdapter.js +163 -0
- package/bin/memory/adapters/FileMemoryStorageAdapter.js.map +1 -0
- package/bin/memory/providers/BuiltinMemoryProvider.d.ts +63 -0
- package/bin/memory/providers/BuiltinMemoryProvider.d.ts.map +1 -0
- package/bin/memory/providers/BuiltinMemoryProvider.js +772 -0
- package/bin/memory/providers/BuiltinMemoryProvider.js.map +1 -0
- package/bin/memory/runtime/SystemProvider.d.ts +7 -12
- package/bin/memory/runtime/SystemProvider.d.ts.map +1 -1
- package/bin/memory/runtime/SystemProvider.js +30 -89
- package/bin/memory/runtime/SystemProvider.js.map +1 -1
- package/bin/memory/types/BuiltinMemoryProvider.d.ts +88 -0
- package/bin/memory/types/BuiltinMemoryProvider.d.ts.map +1 -0
- package/bin/memory/types/BuiltinMemoryProvider.js +9 -0
- package/bin/memory/types/BuiltinMemoryProvider.js.map +1 -0
- package/bin/memory/types/Memory.d.ts +255 -408
- package/bin/memory/types/Memory.d.ts.map +1 -1
- package/bin/memory/types/Memory.js +4 -4
- package/bin/memory/types/MemoryStorage.d.ts +35 -0
- package/bin/memory/types/MemoryStorage.d.ts.map +1 -0
- package/bin/memory/types/MemoryStorage.js +10 -0
- package/bin/memory/types/MemoryStorage.js.map +1 -0
- package/bin/memory.d.ts +6 -2
- package/bin/memory.d.ts.map +1 -1
- package/bin/memory.js +3 -1
- package/bin/memory.js.map +1 -1
- package/bin/renderers.d.ts +5 -0
- package/bin/renderers.d.ts.map +1 -0
- package/bin/renderers.js +12 -0
- package/bin/renderers.js.map +1 -0
- package/bin/sound/Plugin.d.ts +2 -5
- package/bin/sound/Plugin.d.ts.map +1 -1
- package/bin/sound/Plugin.js +27 -31
- package/bin/sound/Plugin.js.map +1 -1
- package/bin/sound/types/SoundPlugin.d.ts +22 -15
- package/bin/sound/types/SoundPlugin.d.ts.map +1 -1
- package/bin/sound/types/SoundPlugin.js +2 -2
- package/bin/sound.d.ts +1 -1
- package/bin/sound.d.ts.map +1 -1
- package/bin/task/Action.d.ts +6 -6
- package/bin/task/Action.d.ts.map +1 -1
- package/bin/task/Action.js +21 -21
- package/bin/task/Action.js.map +1 -1
- package/bin/task/PROMPT.d.ts +1 -1
- package/bin/task/PROMPT.d.ts.map +1 -1
- package/bin/task/PROMPT.js +1 -1
- package/bin/task/PROMPT.js.map +1 -1
- package/bin/task/Scheduler.js +8 -8
- package/bin/task/Scheduler.js.map +1 -1
- package/bin/task/TaskPlugin.d.ts +7 -14
- package/bin/task/TaskPlugin.d.ts.map +1 -1
- package/bin/task/TaskPlugin.js +54 -43
- package/bin/task/TaskPlugin.js.map +1 -1
- package/bin/task/runtime/Model.d.ts +1 -5
- package/bin/task/runtime/Model.d.ts.map +1 -1
- package/bin/task/runtime/Model.js +2 -13
- package/bin/task/runtime/Model.js.map +1 -1
- package/bin/task/runtime/Paths.d.ts +7 -7
- package/bin/task/runtime/Paths.d.ts.map +1 -1
- package/bin/task/runtime/Paths.js +11 -11
- package/bin/task/runtime/Paths.js.map +1 -1
- package/bin/task/runtime/Runner.d.ts +1 -1
- package/bin/task/runtime/Runner.d.ts.map +1 -1
- package/bin/task/runtime/Runner.js +4 -5
- package/bin/task/runtime/Runner.js.map +1 -1
- package/bin/task/runtime/Store.d.ts +9 -9
- package/bin/task/runtime/Store.d.ts.map +1 -1
- package/bin/task/runtime/Store.js +17 -17
- package/bin/task/runtime/Store.js.map +1 -1
- package/bin/task/runtime/TaskActionExecution.js +6 -6
- package/bin/task/runtime/TaskActionExecution.js.map +1 -1
- package/bin/task/runtime/TaskPluginActionRegistry.js +1 -1
- package/bin/task/runtime/TaskPluginActionRegistry.js.map +1 -1
- package/bin/task/runtime/TaskRunnerRound.d.ts +0 -1
- package/bin/task/runtime/TaskRunnerRound.d.ts.map +1 -1
- package/bin/task/runtime/TaskRunnerRound.js +8 -3
- package/bin/task/runtime/TaskRunnerRound.js.map +1 -1
- package/bin/task/runtime/TaskRunnerScript.d.ts +0 -4
- package/bin/task/runtime/TaskRunnerScript.d.ts.map +1 -1
- package/bin/task/runtime/TaskRunnerScript.js +0 -1
- package/bin/task/runtime/TaskRunnerScript.js.map +1 -1
- package/bin/task/runtime/TaskRunnerSession.d.ts +2 -3
- package/bin/task/runtime/TaskRunnerSession.d.ts.map +1 -1
- package/bin/task/runtime/TaskRunnerSession.js +2 -4
- package/bin/task/runtime/TaskRunnerSession.js.map +1 -1
- package/bin/task/types/TaskWorkspaceRuntime.d.ts +10 -0
- package/bin/task/types/TaskWorkspaceRuntime.d.ts.map +1 -0
- package/bin/task/types/TaskWorkspaceRuntime.js +3 -0
- package/bin/task/types/TaskWorkspaceRuntime.js.map +1 -0
- package/bin/web/Plugin.d.ts +2 -6
- package/bin/web/Plugin.d.ts.map +1 -1
- package/bin/web/Plugin.js +21 -17
- package/bin/web/Plugin.js.map +1 -1
- package/bin/web/providers/PlaywrightBrowserProvider.d.ts.map +1 -1
- package/bin/web/providers/PlaywrightBrowserProvider.js +59 -14
- package/bin/web/providers/PlaywrightBrowserProvider.js.map +1 -1
- package/bin/web/types/WebPlugin.d.ts +15 -9
- package/bin/web/types/WebPlugin.d.ts.map +1 -1
- package/bin/web.d.ts +1 -1
- package/bin/web.d.ts.map +1 -1
- package/bin/workboard/runtime/Collector.js +1 -1
- package/bin/workboard/runtime/Collector.js.map +1 -1
- package/package.json +29 -19
- package/scripts/chat-access.test.mjs +3 -2
- package/scripts/chat-channel-config.test.mjs +3 -3
- package/scripts/chat-storage.test.mjs +10 -14
- package/scripts/memory-plugin.test.mjs +204 -0
- package/scripts/playwright-browser-provider.test.mjs +260 -0
- package/scripts/plugin-main.test.mjs +101 -0
- package/scripts/plugin-subpaths.test.mjs +36 -0
- package/scripts/sound-plugin.test.mjs +21 -9
- package/scripts/unrestricted-sandbox-approval.test.mjs +1 -1
- package/scripts/web-plugin.test.mjs +43 -186
- package/src/builtin/BuiltinPluginReadmes.ts +58 -0
- package/src/builtin/BuiltinPluginTypes.ts +260 -0
- package/src/builtin/PluginSettingsDefinitions.ts +45 -0
- package/src/builtin/main/PluginSettingsMain.ts +75 -0
- package/src/builtin/renderer/PluginSettingsRenderer.tsx +110 -0
- package/src/builtin/types/PluginSettings.ts +46 -0
- package/src/chat/ChatPlugin.ts +99 -51
- package/src/chat/access/ChatAccessRuntime.ts +1 -1
- package/src/chat/access/ChatAccessSchema.ts +5 -5
- package/src/chat/access/ChatAccessService.ts +4 -4
- package/src/chat/access/ChatAccessStore.ts +17 -9
- package/src/chat/channels/BaseChatChannel.ts +2 -0
- package/src/chat/channels/RuntimeChannel.ts +9 -9
- package/src/chat/channels/feishu/Feishu.ts +1 -1
- package/src/chat/channels/feishu/FeishuPlatformClient.ts +3 -0
- package/src/chat/channels/feishu/FeishuPlatformLookup.ts +3 -1
- package/src/chat/channels/qq/QQ.ts +3 -2
- package/src/chat/channels/qq/QQEventCapture.ts +3 -3
- package/src/chat/channels/qq/QQInboundDedupe.ts +2 -3
- package/src/chat/channels/qq/QQMessageHandler.ts +6 -0
- package/src/chat/channels/qq/QQSupport.ts +5 -0
- package/src/chat/channels/qq/VoiceInput.ts +5 -1
- package/src/chat/channels/telegram/ApiClient.ts +10 -3
- package/src/chat/channels/telegram/StateStore.ts +2 -2
- package/src/chat/channels/telegram/TelegramPlatformClient.ts +2 -1
- package/src/chat/main/ChatPluginMain.ts +163 -0
- package/src/chat/renderer/ChatPluginRenderer.tsx +149 -0
- package/src/chat/runtime/ChannelContextStore.ts +20 -20
- package/src/chat/runtime/ChatActionExecution.ts +6 -6
- package/src/chat/runtime/ChatChannelConfig.ts +7 -14
- package/src/chat/runtime/ChatChannelCore.ts +9 -9
- package/src/chat/runtime/ChatHistoryStore.ts +7 -7
- package/src/chat/runtime/ChatMetaStore.ts +1 -1
- package/src/chat/runtime/ChatPluginActionRegistry.ts +10 -10
- package/src/chat/runtime/ChatQueue.ts +2 -69
- package/src/chat/runtime/ChatQueueStore.ts +10 -26
- package/src/chat/runtime/ChatQueueWorker.ts +2 -5
- package/src/chat/runtime/ChatSessionDelete.ts +4 -4
- package/src/chat/runtime/ChatStorage.ts +24 -24
- package/src/chat/types/ChatAccess.ts +2 -2
- package/src/chat/types/ChatCommand.ts +1 -1
- package/src/chat/types/ChatPluginChannelConfig.ts +63 -0
- package/src/chat/types/ChatPluginConfig.ts +21 -0
- package/src/chat/types/ChatPluginOptions.ts +4 -4
- package/src/chat/types/ChatPluginProfile.ts +52 -0
- package/src/chat/types/ChatPluginRenderer.ts +25 -0
- package/src/chat/types/ChatRuntime.ts +14 -0
- package/src/chat/types/ChatRuntimeAccount.ts +3 -3
- package/src/chat/types/ChatStorage.ts +2 -2
- package/src/chat.ts +6 -14
- package/src/contact/Action.ts +5 -5
- package/src/contact/ContactPlugin.ts +15 -15
- package/src/contact/runtime/ChatRuntime.ts +3 -3
- package/src/contact/runtime/ContactStore.ts +20 -20
- package/src/contact/runtime/EndpointNotice.ts +2 -2
- package/src/contact/runtime/InboxStore.ts +16 -16
- package/src/contact/runtime/LinkApproval.ts +16 -16
- package/src/contact/runtime/LinkStore.ts +5 -5
- package/src/contact/runtime/Paths.ts +29 -29
- package/src/contact/runtime/ShareBundle.ts +5 -5
- package/src/contact/types/ContactApproval.ts +2 -2
- package/src/image/ImagePlugin.ts +30 -33
- package/src/image/runtime/ImageResultStorage.ts +36 -62
- package/src/image/types/ImagePlugin.ts +25 -19
- package/src/image.ts +2 -0
- package/src/index.ts +8 -0
- package/src/memory/Action.ts +106 -377
- package/src/memory/MemoryPlugin.ts +266 -246
- package/src/memory/adapters/FileMemoryStorageAdapter.ts +197 -0
- package/src/memory/providers/BuiltinMemoryProvider.ts +905 -0
- package/src/memory/runtime/SystemProvider.ts +32 -95
- package/src/memory/types/BuiltinMemoryProvider.ts +121 -0
- package/src/memory/types/Memory.ts +329 -456
- package/src/memory/types/MemoryStorage.ts +44 -0
- package/src/memory.ts +49 -24
- package/src/renderers.ts +18 -0
- package/src/sound/Plugin.ts +34 -33
- package/src/sound/types/SoundPlugin.ts +24 -19
- package/src/sound.ts +2 -0
- package/src/task/Action.ts +27 -27
- package/src/task/PROMPT.ts +1 -1
- package/src/task/PROMPT.ts.txt +5 -6
- package/src/task/Scheduler.ts +8 -8
- package/src/task/TaskPlugin.ts +55 -46
- package/src/task/runtime/Model.ts +3 -13
- package/src/task/runtime/Paths.ts +11 -11
- package/src/task/runtime/Runner.ts +5 -6
- package/src/task/runtime/Store.ts +22 -22
- package/src/task/runtime/TaskActionExecution.ts +6 -6
- package/src/task/runtime/TaskPluginActionRegistry.ts +1 -1
- package/src/task/runtime/TaskRunnerRound.ts +13 -4
- package/src/task/runtime/TaskRunnerScript.ts +0 -5
- package/src/task/runtime/TaskRunnerSession.ts +10 -8
- package/src/task/types/TaskWorkspaceRuntime.ts +12 -0
- package/src/web/Plugin.ts +23 -22
- package/src/web/providers/PlaywrightBrowserProvider.ts +93 -17
- package/src/web/types/WebPlugin.ts +16 -13
- package/src/web.ts +1 -0
- package/src/workboard/runtime/Collector.ts +1 -1
- package/tsconfig.json +4 -1
- package/LICENSE +0 -183
- package/bin/chat/Index.d.ts +0 -15
- package/bin/chat/Index.d.ts.map +0 -1
- package/bin/chat/Index.js +0 -11
- package/bin/chat/Index.js.map +0 -1
- package/bin/chat/config/ChatPluginConfig.d.ts +0 -67
- package/bin/chat/config/ChatPluginConfig.d.ts.map +0 -1
- package/bin/chat/config/ChatPluginConfig.js +0 -237
- package/bin/chat/config/ChatPluginConfig.js.map +0 -1
- package/bin/chat/types/ChatPluginResource.d.ts +0 -68
- package/bin/chat/types/ChatPluginResource.d.ts.map +0 -1
- package/bin/chat/types/ChatPluginResource.js +0 -10
- package/bin/chat/types/ChatPluginResource.js.map +0 -1
- package/bin/contact/Index.d.ts +0 -8
- package/bin/contact/Index.d.ts.map +0 -1
- package/bin/contact/Index.js +0 -8
- package/bin/contact/Index.js.map +0 -1
- package/bin/memory/Index.d.ts +0 -9
- package/bin/memory/Index.d.ts.map +0 -1
- package/bin/memory/Index.js +0 -9
- package/bin/memory/Index.js.map +0 -1
- package/bin/memory/runtime/Search.d.ts +0 -19
- package/bin/memory/runtime/Search.d.ts.map +0 -1
- package/bin/memory/runtime/Search.js +0 -262
- package/bin/memory/runtime/Search.js.map +0 -1
- package/bin/memory/runtime/Store.d.ts +0 -42
- package/bin/memory/runtime/Store.d.ts.map +0 -1
- package/bin/memory/runtime/Store.js +0 -94
- package/bin/memory/runtime/Store.js.map +0 -1
- package/bin/memory/runtime/Writer.d.ts +0 -61
- package/bin/memory/runtime/Writer.d.ts.map +0 -1
- package/bin/memory/runtime/Writer.js +0 -274
- package/bin/memory/runtime/Writer.js.map +0 -1
- package/bin/skill/Command.d.ts +0 -29
- package/bin/skill/Command.d.ts.map +0 -1
- package/bin/skill/Command.js +0 -35
- package/bin/skill/Command.js.map +0 -1
- package/bin/task/Index.d.ts +0 -9
- package/bin/task/Index.d.ts.map +0 -1
- package/bin/task/Index.js +0 -9
- package/bin/task/Index.js.map +0 -1
- package/src/chat/Index.ts +0 -36
- package/src/chat/config/ChatPluginConfig.ts +0 -266
- package/src/chat/types/ChatPluginResource.ts +0 -95
- package/src/contact/Index.ts +0 -8
- package/src/memory/Index.ts +0 -9
- package/src/memory/runtime/Search.ts +0 -327
- package/src/memory/runtime/Store.ts +0 -158
- package/src/memory/runtime/Writer.ts +0 -351
- package/src/skill/Command.ts +0 -58
- package/src/task/Index.ts +0 -8
|
@@ -15,6 +15,18 @@ import path from "node:path";
|
|
|
15
15
|
|
|
16
16
|
import { SoundPlugin } from "../bin/index.js";
|
|
17
17
|
|
|
18
|
+
function create_sound_plugin(options = {}) {
|
|
19
|
+
const { list_models, asr, tts, ...profile } = options;
|
|
20
|
+
return new SoundPlugin({
|
|
21
|
+
...profile,
|
|
22
|
+
sound_ai: {
|
|
23
|
+
catalog: async () => ({ all: () => (list_models ? list_models() : []) }),
|
|
24
|
+
asr,
|
|
25
|
+
tts,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
18
30
|
function create_context(root_path) {
|
|
19
31
|
return {
|
|
20
32
|
workspace_path: root_path,
|
|
@@ -37,7 +49,7 @@ function create_tts_message(url = "/workspace/speech.mp3") {
|
|
|
37
49
|
parts: [
|
|
38
50
|
{
|
|
39
51
|
type: "file",
|
|
40
|
-
|
|
52
|
+
media_type: "audio/mpeg",
|
|
41
53
|
filename: "speech.mp3",
|
|
42
54
|
url,
|
|
43
55
|
},
|
|
@@ -46,7 +58,7 @@ function create_tts_message(url = "/workspace/speech.mp3") {
|
|
|
46
58
|
}
|
|
47
59
|
|
|
48
60
|
test("sound.models 只返回 FED 中支持 ASR 或 TTS 的模型", async () => {
|
|
49
|
-
const plugin =
|
|
61
|
+
const plugin = create_sound_plugin({
|
|
50
62
|
list_models: () => [
|
|
51
63
|
{ id: "asr", name: "ASR", modalities: ["asr"] },
|
|
52
64
|
{ id: "tts", name: "TTS", modalities: ["tts"] },
|
|
@@ -76,7 +88,7 @@ test("sound.asr 把本地音频转为 data URL 后直接调用 FED", async () =>
|
|
|
76
88
|
const audio_path = path.join(root_path, "voice.wav");
|
|
77
89
|
await fs.writeFile(audio_path, Buffer.from("audio-test"));
|
|
78
90
|
let received_input;
|
|
79
|
-
const plugin =
|
|
91
|
+
const plugin = create_sound_plugin({
|
|
80
92
|
default_asr_model: "fed-asr",
|
|
81
93
|
asr: async (input) => {
|
|
82
94
|
received_input = input;
|
|
@@ -117,7 +129,7 @@ test("sound.asr 把本地音频转为 data URL 后直接调用 FED", async () =>
|
|
|
117
129
|
test("sound.tts 使用默认参数并返回 AI SDK UIMessage", async () => {
|
|
118
130
|
let received_input;
|
|
119
131
|
const message = create_tts_message();
|
|
120
|
-
const plugin =
|
|
132
|
+
const plugin = create_sound_plugin({
|
|
121
133
|
default_tts_model: "fed-tts",
|
|
122
134
|
language: "zh",
|
|
123
135
|
voice: "alloy",
|
|
@@ -151,7 +163,7 @@ test("sound.tts 使用默认参数并返回 AI SDK UIMessage", async () => {
|
|
|
151
163
|
});
|
|
152
164
|
|
|
153
165
|
test("sound action 不会隐式选择模型或接受非 UIMessage TTS 结果", async () => {
|
|
154
|
-
const plugin =
|
|
166
|
+
const plugin = create_sound_plugin({
|
|
155
167
|
asr: async () => ({ text: "ok" }),
|
|
156
168
|
tts: async () => ({ url: "https://example.com/speech.mp3" }),
|
|
157
169
|
});
|
|
@@ -172,7 +184,7 @@ test("sound action 不会隐式选择模型或接受非 UIMessage TTS 结果", a
|
|
|
172
184
|
});
|
|
173
185
|
|
|
174
186
|
test("sound.asr 只接受一种音频来源", async () => {
|
|
175
|
-
const plugin =
|
|
187
|
+
const plugin = create_sound_plugin({
|
|
176
188
|
asr: async () => ({ text: "ok" }),
|
|
177
189
|
tts: async () => create_tts_message(),
|
|
178
190
|
});
|
|
@@ -186,7 +198,7 @@ test("sound.asr 只接受一种音频来源", async () => {
|
|
|
186
198
|
});
|
|
187
199
|
|
|
188
200
|
test("sound.tts 要求 UIMessage 包含音频 file part", async () => {
|
|
189
|
-
const plugin =
|
|
201
|
+
const plugin = create_sound_plugin({
|
|
190
202
|
asr: async () => ({ text: "ok" }),
|
|
191
203
|
tts: async () => ({
|
|
192
204
|
id: "sound:text-only",
|
|
@@ -204,7 +216,7 @@ test("sound.tts 要求 UIMessage 包含音频 file part", async () => {
|
|
|
204
216
|
|
|
205
217
|
test("auto_asr 必须配置默认 ASR 模型", () => {
|
|
206
218
|
assert.throws(
|
|
207
|
-
() =>
|
|
219
|
+
() => create_sound_plugin({
|
|
208
220
|
auto_asr: true,
|
|
209
221
|
asr: async () => ({ text: "ok" }),
|
|
210
222
|
tts: async () => create_tts_message(),
|
|
@@ -217,7 +229,7 @@ test("auto_asr 把 chat 语音附件转写追加到正文", async () => {
|
|
|
217
229
|
const root_path = await fs.mkdtemp(path.join(os.tmpdir(), "downcity-sound-auto-"));
|
|
218
230
|
const audio_path = path.join(root_path, "message.ogg");
|
|
219
231
|
await fs.writeFile(audio_path, Buffer.from("voice"));
|
|
220
|
-
const plugin =
|
|
232
|
+
const plugin = create_sound_plugin({
|
|
221
233
|
auto_asr: true,
|
|
222
234
|
default_asr_model: "fed-asr",
|
|
223
235
|
asr: async () => ({ text: "hello <world>" }),
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
setShellApprovalModeView,
|
|
23
23
|
startShellSession,
|
|
24
24
|
writeShellSession,
|
|
25
|
-
} from "@downcity/shell/session/ShellActionRuntime.js";
|
|
25
|
+
} from "@downcity/workspace/shell/session/ShellActionRuntime.js";
|
|
26
26
|
|
|
27
27
|
async function create_fixture() {
|
|
28
28
|
const root_path = await fs.mkdtemp(path.join(os.tmpdir(), "downcity-unrestricted-"));
|
|
@@ -1,76 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WebPlugin provider-neutral action 回归测试。
|
|
3
|
-
*
|
|
4
|
-
* 关键点(中文)
|
|
5
|
-
* - Plugin 必须显式注入 provider,不能只注册一段方法论。
|
|
6
|
-
* - 浏览器 action 保持结构化输入输出,并在 lifecycle.stop 时释放 provider。
|
|
7
|
-
* - 缺少某项 provider 时只让对应 action 返回明确失败。
|
|
8
|
-
*/
|
|
1
|
+
/** WebPlugin 配置与运行时上下文能力回归测试。 */
|
|
9
2
|
|
|
10
3
|
import assert from "node:assert/strict";
|
|
11
4
|
import test from "node:test";
|
|
12
|
-
import {
|
|
13
|
-
ComputerUseBrowserProviderAdapter,
|
|
14
|
-
SemanticBrowserProviderAdapter,
|
|
15
|
-
WebPlugin,
|
|
16
|
-
} from "../bin/index.js";
|
|
5
|
+
import { WebPlugin } from "../bin/index.js";
|
|
17
6
|
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
let disposed = false;
|
|
21
|
-
return {
|
|
22
|
-
name: "mock-browser",
|
|
23
|
-
get disposed() { return disposed; },
|
|
24
|
-
async create_session(input) {
|
|
25
|
-
const session_id = "browser-session-1";
|
|
26
|
-
const state = {
|
|
27
|
-
provider: this.name,
|
|
28
|
-
session_id,
|
|
29
|
-
url: input.url || "about:blank",
|
|
30
|
-
title: "Mock page",
|
|
31
|
-
text: "Initial page",
|
|
32
|
-
};
|
|
33
|
-
sessions.set(session_id, state);
|
|
34
|
-
return state;
|
|
35
|
-
},
|
|
36
|
-
async observe(input) {
|
|
37
|
-
const state = sessions.get(input.session_id);
|
|
38
|
-
if (!state) throw new Error(`Browser session not found: ${input.session_id}`);
|
|
39
|
-
return state;
|
|
40
|
-
},
|
|
41
|
-
async act(input) {
|
|
42
|
-
const state = sessions.get(input.session_id);
|
|
43
|
-
if (!state) throw new Error(`Browser session not found: ${input.session_id}`);
|
|
44
|
-
const next = { ...state, text: `acted:${input.action.type}` };
|
|
45
|
-
sessions.set(input.session_id, next);
|
|
46
|
-
return next;
|
|
47
|
-
},
|
|
48
|
-
async extract(input) {
|
|
49
|
-
const state = sessions.get(input.session_id);
|
|
50
|
-
if (!state) throw new Error(`Browser session not found: ${input.session_id}`);
|
|
51
|
-
return {
|
|
52
|
-
provider: this.name,
|
|
53
|
-
session_id: input.session_id,
|
|
54
|
-
url: state.url,
|
|
55
|
-
content: state.text,
|
|
56
|
-
};
|
|
57
|
-
},
|
|
58
|
-
async close_session(input) {
|
|
59
|
-
sessions.delete(input.session_id);
|
|
60
|
-
},
|
|
61
|
-
async dispose() {
|
|
62
|
-
sessions.clear();
|
|
63
|
-
disposed = true;
|
|
64
|
-
},
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
test("WebPlugin 拒绝没有真实能力的空配置", () => {
|
|
69
|
-
assert.throws(() => new WebPlugin({}), /requires at least one provider/);
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
test("WebPlugin 暴露结构化联网与浏览器 actions", () => {
|
|
73
|
-
const plugin = new WebPlugin({ browser: create_browser_provider() });
|
|
7
|
+
test("WebPlugin 允许空配置并暴露稳定 actions", () => {
|
|
8
|
+
const plugin = new WebPlugin();
|
|
74
9
|
assert.deepEqual(Object.keys(plugin.actions), [
|
|
75
10
|
"search",
|
|
76
11
|
"open",
|
|
@@ -82,142 +17,64 @@ test("WebPlugin 暴露结构化联网与浏览器 actions", () => {
|
|
|
82
17
|
"browser_semantic_extract",
|
|
83
18
|
"browser_close_session",
|
|
84
19
|
]);
|
|
85
|
-
assert.
|
|
86
|
-
assert.match(plugin.system(), /deterministic CSS-selector operations/);
|
|
20
|
+
assert.match(plugin.system(), /direct search or document reading/u);
|
|
87
21
|
});
|
|
88
22
|
|
|
89
|
-
test("search 与 open
|
|
90
|
-
const plugin = new WebPlugin(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
23
|
+
test("search 与 open 从 PluginContext 读取宿主 Web 能力", async () => {
|
|
24
|
+
const plugin = new WebPlugin();
|
|
25
|
+
const context = {
|
|
26
|
+
web: {
|
|
27
|
+
async search(input) {
|
|
28
|
+
return {
|
|
29
|
+
provider: "mock-search",
|
|
30
|
+
items: [{ url: "https://example.com", title: input.query }],
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
async open(input) {
|
|
34
|
+
return {
|
|
35
|
+
provider: "mock-reader",
|
|
36
|
+
url: input.url,
|
|
37
|
+
title: "Example",
|
|
38
|
+
content: "Example content",
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
};
|
|
103
43
|
const search_result = await plugin.actions.search.execute({
|
|
104
|
-
context
|
|
44
|
+
context,
|
|
105
45
|
input: { query: "official docs" },
|
|
106
46
|
});
|
|
107
47
|
const open_result = await plugin.actions.open.execute({
|
|
108
|
-
context
|
|
48
|
+
context,
|
|
109
49
|
input: { url: "https://example.com" },
|
|
110
50
|
});
|
|
111
|
-
|
|
112
51
|
assert.equal(search_result.success, true);
|
|
113
52
|
assert.equal(search_result.data.provider, "mock-search");
|
|
114
53
|
assert.equal(open_result.success, true);
|
|
115
54
|
assert.equal(open_result.data.content, "Example content");
|
|
116
55
|
});
|
|
117
56
|
|
|
118
|
-
test("
|
|
119
|
-
const
|
|
120
|
-
const
|
|
121
|
-
const created = await plugin.actions.browser_create_session.execute({
|
|
122
|
-
context: {},
|
|
123
|
-
input: { url: "https://example.com" },
|
|
124
|
-
});
|
|
125
|
-
const session_id = created.data.session_id;
|
|
126
|
-
|
|
127
|
-
const acted = await plugin.actions.browser_act.execute({
|
|
128
|
-
context: {},
|
|
129
|
-
input: { session_id, action: { type: "click", selector: "a" } },
|
|
130
|
-
});
|
|
131
|
-
const extracted = await plugin.actions.browser_extract.execute({
|
|
132
|
-
context: {},
|
|
133
|
-
input: { session_id },
|
|
134
|
-
});
|
|
135
|
-
const closed = await plugin.actions.browser_close_session.execute({
|
|
136
|
-
context: {},
|
|
137
|
-
input: { session_id },
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
assert.equal(created.success, true);
|
|
141
|
-
assert.equal(acted.data.text, "acted:click");
|
|
142
|
-
assert.equal(extracted.data.content, "acted:click");
|
|
143
|
-
assert.deepEqual(closed.data, { session_id, closed: true });
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
test("语义 adapter 复用基础 session 并暴露语义 actions", async () => {
|
|
147
|
-
const base_browser = create_browser_provider();
|
|
148
|
-
const browser = new SemanticBrowserProviderAdapter({
|
|
149
|
-
name: "mock-semantic",
|
|
150
|
-
browser: base_browser,
|
|
151
|
-
semantic_act: async (input) => ({
|
|
152
|
-
...(await base_browser.observe({ session_id: input.session_id })),
|
|
153
|
-
text: `semantic:${input.instruction}`,
|
|
154
|
-
}),
|
|
155
|
-
semantic_extract: async (input) => ({
|
|
156
|
-
provider: "mock-semantic",
|
|
157
|
-
session_id: input.session_id,
|
|
158
|
-
url: "https://example.com",
|
|
159
|
-
content: `semantic-extract:${input.instruction}`,
|
|
160
|
-
}),
|
|
161
|
-
});
|
|
162
|
-
const plugin = new WebPlugin({ browser });
|
|
163
|
-
const created = await plugin.actions.browser_create_session.execute({
|
|
164
|
-
context: {},
|
|
165
|
-
input: { url: "https://example.com" },
|
|
166
|
-
});
|
|
167
|
-
const session_id = created.data.session_id;
|
|
168
|
-
const acted = await plugin.actions.browser_semantic_act.execute({
|
|
169
|
-
context: {},
|
|
170
|
-
input: { session_id, instruction: "click the login button" },
|
|
171
|
-
});
|
|
172
|
-
const extracted = await plugin.actions.browser_semantic_extract.execute({
|
|
57
|
+
test("缺少运行时能力或 CDP 配置时只让对应 action 失败", async () => {
|
|
58
|
+
const plugin = new WebPlugin();
|
|
59
|
+
const search_result = await plugin.actions.search.execute({
|
|
173
60
|
context: {},
|
|
174
|
-
input: {
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
assert.equal(acted.success, true);
|
|
178
|
-
assert.equal(acted.data.text, "semantic:click the login button");
|
|
179
|
-
assert.equal(extracted.data.content, "semantic-extract:extract the account name");
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
test("Computer Use adapter 先获取截图观察再委托模型循环", async () => {
|
|
183
|
-
const base_browser = create_browser_provider();
|
|
184
|
-
const browser = new ComputerUseBrowserProviderAdapter({
|
|
185
|
-
name: "mock-computer-use",
|
|
186
|
-
browser: base_browser,
|
|
187
|
-
run: async ({ instruction, observation }) => ({
|
|
188
|
-
...observation,
|
|
189
|
-
text: `computer-use:${instruction}`,
|
|
190
|
-
screenshot_data_url: observation.screenshot_data_url ?? "data:image/png;base64,mock",
|
|
191
|
-
}),
|
|
61
|
+
input: { query: "test" },
|
|
192
62
|
});
|
|
193
|
-
const
|
|
194
|
-
const created = await plugin.actions.browser_create_session.execute({
|
|
63
|
+
const browser_result = await plugin.actions.browser_create_session.execute({
|
|
195
64
|
context: {},
|
|
196
65
|
input: { url: "https://example.com" },
|
|
197
66
|
});
|
|
198
|
-
const result = await plugin.actions.browser_semantic_act.execute({
|
|
199
|
-
context: {},
|
|
200
|
-
input: {
|
|
201
|
-
session_id: created.data.session_id,
|
|
202
|
-
instruction: "drag the map",
|
|
203
|
-
},
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
assert.equal(result.success, true);
|
|
207
|
-
assert.equal(result.data.text, "computer-use:drag the map");
|
|
208
|
-
assert.match(result.data.screenshot_data_url, /^data:image\/png;base64/);
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
test("未配置的 action 返回明确失败,lifecycle.stop 释放浏览器", async () => {
|
|
212
|
-
const browser = create_browser_provider();
|
|
213
|
-
const plugin = new WebPlugin({ browser });
|
|
214
|
-
const search_result = await plugin.actions.search.execute({
|
|
215
|
-
context: {},
|
|
216
|
-
input: { query: "test" },
|
|
217
|
-
});
|
|
218
67
|
assert.equal(search_result.success, false);
|
|
219
|
-
assert.match(search_result.error, /not configured/);
|
|
68
|
+
assert.match(search_result.error, /not configured/u);
|
|
69
|
+
assert.equal(browser_result.success, false);
|
|
70
|
+
assert.match(browser_result.error, /not configured/u);
|
|
71
|
+
await plugin.lifecycle.stop();
|
|
72
|
+
});
|
|
220
73
|
|
|
221
|
-
|
|
222
|
-
assert.
|
|
74
|
+
test("WebPlugin 只接受公开的浏览器 provider 枚举", () => {
|
|
75
|
+
assert.doesNotThrow(() => new WebPlugin({ browser: "playwright" }));
|
|
76
|
+
assert.throws(
|
|
77
|
+
() => new WebPlugin({ browser: "unknown" }),
|
|
78
|
+
/Unsupported Web browser provider/u,
|
|
79
|
+
);
|
|
223
80
|
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/** Downcity 官方 Plugin 的用户说明内容。 */
|
|
2
|
+
|
|
3
|
+
/** 官方 Plugin 在宿主 Overview 中展示的 Markdown 说明。 */
|
|
4
|
+
export const BUILTIN_PLUGIN_READMES = {
|
|
5
|
+
skill: `# Skill Catalog And Loader
|
|
6
|
+
|
|
7
|
+
Discovers skills available to the Agent, reads their instructions, and adds guidance for selecting the right skill during a task.
|
|
8
|
+
|
|
9
|
+
## What it provides
|
|
10
|
+
|
|
11
|
+
- Lists and inspects installed skills.
|
|
12
|
+
- Loads skill instructions only when they are relevant.
|
|
13
|
+
- Keeps skill discovery separate from the Agent definition.`,
|
|
14
|
+
workboard: `# Workboard Snapshot
|
|
15
|
+
|
|
16
|
+
Collects structured snapshots of Agent runtime activity so work can be inspected and presented consistently.
|
|
17
|
+
|
|
18
|
+
The Plugin owns snapshot collection and normalization; it does not change how an Agent executes a task.`,
|
|
19
|
+
contact: `# Contact
|
|
20
|
+
|
|
21
|
+
Manages trusted relationships with remote Agents and provides the actions required to exchange messages and shared information.
|
|
22
|
+
|
|
23
|
+
Contact state is stored in the current Agent's private Plugin data directory.`,
|
|
24
|
+
task: `# Task
|
|
25
|
+
|
|
26
|
+
Creates and manages reusable Agent tasks, trigger definitions, and execution records.
|
|
27
|
+
|
|
28
|
+
Tasks remain Agent-owned runtime resources and can be scheduled or invoked through the Plugin's actions.`,
|
|
29
|
+
chat: `# Chat
|
|
30
|
+
|
|
31
|
+
Connects an Agent to external conversations through Telegram, Feishu / Lark, and QQ.
|
|
32
|
+
|
|
33
|
+
## Profiles and Channels
|
|
34
|
+
|
|
35
|
+
- Each Profile contains one complete Chat configuration.
|
|
36
|
+
- A Channel type can appear once in the same Profile.
|
|
37
|
+
- Credentials stay in Plugin configuration and are not copied into \`agent.json\`.`,
|
|
38
|
+
memory: `# Memory
|
|
39
|
+
|
|
40
|
+
Provides provider-neutral long-term memory with recall, revision, and deletion capabilities.
|
|
41
|
+
|
|
42
|
+
Memory data belongs to the current Agent and is stored in that Agent's private Plugin runtime directory.`,
|
|
43
|
+
web: `# Web
|
|
44
|
+
|
|
45
|
+
Provides web search, document reading, and optional browser sessions to an Agent.
|
|
46
|
+
|
|
47
|
+
Use Profiles to isolate provider endpoints, credentials, and browser settings for different environments.`,
|
|
48
|
+
image: `# Image
|
|
49
|
+
|
|
50
|
+
Discovers available image models, generates images, and returns structured result metadata.
|
|
51
|
+
|
|
52
|
+
Use Profiles to keep image service endpoints and credentials separate between environments.`,
|
|
53
|
+
sound: `# Sound
|
|
54
|
+
|
|
55
|
+
Discovers speech models and provides automatic speech recognition and text-to-speech actions.
|
|
56
|
+
|
|
57
|
+
Use Profiles to isolate speech service endpoints, models, and credentials.`,
|
|
58
|
+
} as const;
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Downcity 官方 Plugin 注册集合。
|
|
3
|
+
*
|
|
4
|
+
* 本模块负责把官方 Plugin 按应用配置装配成 Agent 独享实例。应用提供
|
|
5
|
+
* Embassy 服务,Plugin 自身只持有明确的服务接口。
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { Plugin } from "@downcity/agent";
|
|
9
|
+
import type { PluginHostContext } from "@downcity/agent";
|
|
10
|
+
import type { PluginMainModule } from "@downcity/plugin";
|
|
11
|
+
import { CHAT_PLUGIN_MAIN } from "@/chat/main/ChatPluginMain.js";
|
|
12
|
+
import {
|
|
13
|
+
IMAGE_PLUGIN_SETTINGS,
|
|
14
|
+
SOUND_PLUGIN_SETTINGS,
|
|
15
|
+
WEB_PLUGIN_SETTINGS,
|
|
16
|
+
} from "@/builtin/PluginSettingsDefinitions.js";
|
|
17
|
+
import { create_plugin_settings_main } from "@/builtin/main/PluginSettingsMain.js";
|
|
18
|
+
import { BUILTIN_PLUGIN_READMES } from "@/builtin/BuiltinPluginReadmes.js";
|
|
19
|
+
import {
|
|
20
|
+
ChatPlugin,
|
|
21
|
+
type ChatPluginConfig,
|
|
22
|
+
type ChatPluginChannelConfig,
|
|
23
|
+
} from "@/chat.js";
|
|
24
|
+
import { FeishuChannel, QqChannel, TelegramChannel } from "@/chat.js";
|
|
25
|
+
import { ContactPlugin } from "@/contact.js";
|
|
26
|
+
import { ImagePlugin } from "@/image.js";
|
|
27
|
+
import {
|
|
28
|
+
MemoryPlugin,
|
|
29
|
+
} from "@/memory.js";
|
|
30
|
+
import { SkillPlugin } from "@/skill.js";
|
|
31
|
+
import { SoundPlugin } from "@/sound.js";
|
|
32
|
+
import { TaskPlugin } from "@/task.js";
|
|
33
|
+
import {
|
|
34
|
+
WebPlugin,
|
|
35
|
+
type WebPluginOptions,
|
|
36
|
+
} from "@/web.js";
|
|
37
|
+
import { WorkboardPlugin } from "@/workboard.js";
|
|
38
|
+
|
|
39
|
+
/** 官方 Plugin definition 的最小结构协议。 */
|
|
40
|
+
export interface BuiltinPluginDefinition {
|
|
41
|
+
/** Plugin 的稳定 ID。 */
|
|
42
|
+
id: string;
|
|
43
|
+
|
|
44
|
+
/** Plugin 的用户可见标题。 */
|
|
45
|
+
title: string;
|
|
46
|
+
|
|
47
|
+
/** Plugin 的用途说明。 */
|
|
48
|
+
description: string;
|
|
49
|
+
|
|
50
|
+
/** 宿主 Overview 展示的完整 Markdown 用户说明。 */
|
|
51
|
+
readme: string;
|
|
52
|
+
|
|
53
|
+
/** 官方 Plugin 是否提供 Agent 能力。 */
|
|
54
|
+
has_agent: boolean;
|
|
55
|
+
|
|
56
|
+
/** 官方 Plugin 是否提供宿主 main。 */
|
|
57
|
+
has_main: boolean;
|
|
58
|
+
|
|
59
|
+
/** 官方 Plugin 是否提供唯一 Mainview。 */
|
|
60
|
+
has_renderer: boolean;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** 官方 Plugin 注册协议。 */
|
|
64
|
+
export interface BuiltinPluginRegistration {
|
|
65
|
+
/** Plugin 的唯一静态定义。 */
|
|
66
|
+
readonly definition: BuiltinPluginDefinition;
|
|
67
|
+
/** 使用 City 读取的 Profile 创建一个 Agent 独享的 Plugin 实例。 */
|
|
68
|
+
create_agent(context: PluginHostContext): Plugin | Promise<Plugin>;
|
|
69
|
+
|
|
70
|
+
/** 可选的宿主 main 生命周期对象。 */
|
|
71
|
+
main?: PluginMainModule;
|
|
72
|
+
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** 创建官方 Plugin 注册集合所需的宿主能力。 */
|
|
76
|
+
export interface BuiltinPluginRegistrationsOptions {
|
|
77
|
+
/** Contact Plugin 对外报告的 HTTP 地址。 */
|
|
78
|
+
contact_http?: {
|
|
79
|
+
/** HTTP 监听地址。 */
|
|
80
|
+
host?: string;
|
|
81
|
+
/** HTTP 监听端口。 */
|
|
82
|
+
port?: number;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** 创建 Downcity 官方 Plugin 注册集合。 */
|
|
88
|
+
export function create_builtin_plugin_registrations(
|
|
89
|
+
options: BuiltinPluginRegistrationsOptions,
|
|
90
|
+
): BuiltinPluginRegistration[] {
|
|
91
|
+
return [
|
|
92
|
+
simple_registration(
|
|
93
|
+
"skill",
|
|
94
|
+
"Skill Catalog And Loader",
|
|
95
|
+
"Lists and reads local skills, and injects discovery guidance.",
|
|
96
|
+
BUILTIN_PLUGIN_READMES.skill,
|
|
97
|
+
() => new SkillPlugin(),
|
|
98
|
+
),
|
|
99
|
+
simple_registration(
|
|
100
|
+
"workboard",
|
|
101
|
+
"Workboard Snapshot",
|
|
102
|
+
"Collects structured Agent runtime activity snapshots.",
|
|
103
|
+
BUILTIN_PLUGIN_READMES.workboard,
|
|
104
|
+
() => new WorkboardPlugin(),
|
|
105
|
+
),
|
|
106
|
+
simple_registration(
|
|
107
|
+
"contact",
|
|
108
|
+
"Contact",
|
|
109
|
+
"Manages trusted relationships and exchanges with remote Agents.",
|
|
110
|
+
BUILTIN_PLUGIN_READMES.contact,
|
|
111
|
+
() => new ContactPlugin({
|
|
112
|
+
host: options.contact_http?.host,
|
|
113
|
+
port: options.contact_http?.port,
|
|
114
|
+
}),
|
|
115
|
+
),
|
|
116
|
+
simple_registration(
|
|
117
|
+
"task",
|
|
118
|
+
"Task",
|
|
119
|
+
"Manages reusable tasks and their trigger runtime.",
|
|
120
|
+
BUILTIN_PLUGIN_READMES.task,
|
|
121
|
+
() => new TaskPlugin(),
|
|
122
|
+
),
|
|
123
|
+
{
|
|
124
|
+
definition: {
|
|
125
|
+
id: "chat",
|
|
126
|
+
title: "Chat",
|
|
127
|
+
description: "Connects Agents to Telegram, Feishu, and QQ channels.",
|
|
128
|
+
readme: BUILTIN_PLUGIN_READMES.chat,
|
|
129
|
+
has_agent: true,
|
|
130
|
+
has_main: true,
|
|
131
|
+
has_renderer: true,
|
|
132
|
+
},
|
|
133
|
+
main: CHAT_PLUGIN_MAIN,
|
|
134
|
+
create_agent(context) {
|
|
135
|
+
const config = context.profile as unknown as ChatPluginConfig;
|
|
136
|
+
return new ChatPlugin({
|
|
137
|
+
queue: config.queue,
|
|
138
|
+
channels: create_chat_channels(config.channels ?? []),
|
|
139
|
+
});
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
definition: {
|
|
144
|
+
id: "memory",
|
|
145
|
+
title: "Memory",
|
|
146
|
+
description: "Provides provider-neutral long-term memory, recall, revision, and deletion.",
|
|
147
|
+
readme: BUILTIN_PLUGIN_READMES.memory,
|
|
148
|
+
has_agent: true,
|
|
149
|
+
has_main: false,
|
|
150
|
+
has_renderer: false,
|
|
151
|
+
},
|
|
152
|
+
create_agent(context) {
|
|
153
|
+
return new MemoryPlugin({ root_path: context.data_path });
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
definition: {
|
|
158
|
+
id: "web",
|
|
159
|
+
title: "Web",
|
|
160
|
+
description: "Provides web search, document reading, and optional browser sessions.",
|
|
161
|
+
readme: BUILTIN_PLUGIN_READMES.web,
|
|
162
|
+
has_agent: true,
|
|
163
|
+
has_main: true,
|
|
164
|
+
has_renderer: true,
|
|
165
|
+
},
|
|
166
|
+
main: create_plugin_settings_main(WEB_PLUGIN_SETTINGS),
|
|
167
|
+
create_agent(context) {
|
|
168
|
+
const config = context.profile as unknown as WebPluginOptions;
|
|
169
|
+
return new WebPlugin(config);
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
definition: {
|
|
174
|
+
id: "image",
|
|
175
|
+
title: "Image",
|
|
176
|
+
description: "Discovers image models, generates images, and reads results.",
|
|
177
|
+
readme: BUILTIN_PLUGIN_READMES.image,
|
|
178
|
+
has_agent: true,
|
|
179
|
+
has_main: true,
|
|
180
|
+
has_renderer: true,
|
|
181
|
+
},
|
|
182
|
+
main: create_plugin_settings_main(IMAGE_PLUGIN_SETTINGS),
|
|
183
|
+
create_agent: (context) => new ImagePlugin({
|
|
184
|
+
...context.profile,
|
|
185
|
+
}),
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
definition: {
|
|
189
|
+
id: "sound",
|
|
190
|
+
title: "Sound",
|
|
191
|
+
description: "Discovers speech models and provides ASR and TTS.",
|
|
192
|
+
readme: BUILTIN_PLUGIN_READMES.sound,
|
|
193
|
+
has_agent: true,
|
|
194
|
+
has_main: true,
|
|
195
|
+
has_renderer: true,
|
|
196
|
+
},
|
|
197
|
+
main: create_plugin_settings_main(SOUND_PLUGIN_SETTINGS),
|
|
198
|
+
create_agent: (context) => new SoundPlugin({
|
|
199
|
+
...context.profile,
|
|
200
|
+
}),
|
|
201
|
+
},
|
|
202
|
+
];
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/** 获取并适配官方 ImagePlugin 所需的 Embassy 图片服务。 */
|
|
206
|
+
/** 创建没有配置协议的简单注册。 */
|
|
207
|
+
function simple_registration(
|
|
208
|
+
id: string,
|
|
209
|
+
title: string,
|
|
210
|
+
description: string,
|
|
211
|
+
readme: string,
|
|
212
|
+
create_agent: () => Plugin,
|
|
213
|
+
): BuiltinPluginRegistration {
|
|
214
|
+
return {
|
|
215
|
+
definition: {
|
|
216
|
+
id,
|
|
217
|
+
title,
|
|
218
|
+
description,
|
|
219
|
+
readme,
|
|
220
|
+
has_agent: true,
|
|
221
|
+
has_main: false,
|
|
222
|
+
has_renderer: false,
|
|
223
|
+
},
|
|
224
|
+
create_agent,
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/** 创建 Chat Resource 对应的运行渠道。 */
|
|
229
|
+
function create_chat_channels(configs: ChatPluginChannelConfig[]) {
|
|
230
|
+
const channel_types = new Set<string>();
|
|
231
|
+
return configs.map((config) => {
|
|
232
|
+
if (channel_types.has(config.type)) {
|
|
233
|
+
throw new Error(`Chat Plugin channel type is duplicated: ${config.type}`);
|
|
234
|
+
}
|
|
235
|
+
channel_types.add(config.type);
|
|
236
|
+
if (config.type === "telegram") {
|
|
237
|
+
return new TelegramChannel({
|
|
238
|
+
id: config.id,
|
|
239
|
+
name: config.name,
|
|
240
|
+
bot_token: config.bot_token,
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
if (config.type === "feishu") {
|
|
244
|
+
return new FeishuChannel({
|
|
245
|
+
id: config.id,
|
|
246
|
+
name: config.name,
|
|
247
|
+
app_id: config.app_id,
|
|
248
|
+
app_secret: config.app_secret,
|
|
249
|
+
domain: config.domain,
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
return new QqChannel({
|
|
253
|
+
id: config.id,
|
|
254
|
+
name: config.name,
|
|
255
|
+
app_id: config.app_id,
|
|
256
|
+
app_secret: config.app_secret,
|
|
257
|
+
sandbox: config.sandbox,
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
}
|