@downcity/plugins 1.0.254 → 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/MemoryPlugin.d.ts +1 -1
- package/bin/memory/MemoryPlugin.d.ts.map +1 -1
- package/bin/memory/MemoryPlugin.js +17 -7
- package/bin/memory/MemoryPlugin.js.map +1 -1
- package/bin/memory/types/Memory.d.ts +10 -4
- package/bin/memory/types/Memory.d.ts.map +1 -1
- package/bin/memory.d.ts +1 -1
- package/bin/memory.d.ts.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 -20
- 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 +9 -32
- package/scripts/playwright-browser-provider.test.mjs +260 -0
- package/scripts/plugin-main.test.mjs +101 -0
- package/scripts/plugin-subpaths.test.mjs +28 -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/MemoryPlugin.ts +17 -5
- package/src/memory/types/Memory.ts +11 -4
- package/src/memory.ts +1 -0
- 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 -11
- package/bin/memory/Index.d.ts.map +0 -1
- package/bin/memory/Index.js +0 -11
- package/bin/memory/Index.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 -14
- package/src/skill/Command.ts +0 -58
- package/src/task/Index.ts +0 -8
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
5
|
* - Chat Plugin 是 channel meta、chat history 与渠道缓存路径的唯一所有者。
|
|
6
|
-
* - PluginContext
|
|
6
|
+
* - PluginContext 提供 Agent 数据根,Chat 不再写入项目目录。
|
|
7
7
|
* - CLI 离线维护通过本模块操作 Chat 存储,不复制内部 JSON 结构。
|
|
8
8
|
*/
|
|
9
9
|
|
|
@@ -28,27 +28,27 @@ function normalize_thread_id(input: unknown): number | undefined {
|
|
|
28
28
|
return Math.trunc(value);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
function
|
|
32
|
-
return path.
|
|
31
|
+
function get_chat_data_path(data_path: string): string {
|
|
32
|
+
return path.resolve(data_path);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
/** 返回 Chat 渠道路由目录。 */
|
|
36
|
-
export function get_chat_channel_dir_path(
|
|
37
|
-
return path.join(
|
|
36
|
+
export function get_chat_channel_dir_path(data_path: string): string {
|
|
37
|
+
return path.join(get_chat_data_path(data_path), "channel");
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/** 返回 Chat 渠道路由文件。 */
|
|
41
|
-
export function get_chat_channel_meta_path(
|
|
42
|
-
return path.join(get_chat_channel_dir_path(
|
|
41
|
+
export function get_chat_channel_meta_path(data_path: string): string {
|
|
42
|
+
return path.join(get_chat_channel_dir_path(data_path), "meta.json");
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
/** 返回单个 Chat 会话的事件目录。 */
|
|
46
46
|
export function get_chat_session_dir_path(
|
|
47
|
-
|
|
47
|
+
data_path: string,
|
|
48
48
|
session_id: string,
|
|
49
49
|
): string {
|
|
50
50
|
return path.join(
|
|
51
|
-
|
|
51
|
+
get_chat_data_path(data_path),
|
|
52
52
|
"chat",
|
|
53
53
|
encodeURIComponent(normalize_text(session_id)),
|
|
54
54
|
);
|
|
@@ -56,21 +56,21 @@ export function get_chat_session_dir_path(
|
|
|
56
56
|
|
|
57
57
|
/** 返回单个 Chat 会话的事件流文件。 */
|
|
58
58
|
export function get_chat_history_path(
|
|
59
|
-
|
|
59
|
+
data_path: string,
|
|
60
60
|
session_id: string,
|
|
61
61
|
): string {
|
|
62
|
-
return path.join(get_chat_session_dir_path(
|
|
62
|
+
return path.join(get_chat_session_dir_path(data_path, session_id), "history.jsonl");
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
/** 返回飞书渠道的消息去重目录。 */
|
|
66
|
-
export function get_feishu_dedupe_dir_path(
|
|
67
|
-
return path.join(
|
|
66
|
+
export function get_feishu_dedupe_dir_path(data_path: string): string {
|
|
67
|
+
return path.join(get_chat_data_path(data_path), ".cache", "feishu", "dedupe");
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
async function read_channel_meta(
|
|
71
|
-
|
|
71
|
+
data_path: string,
|
|
72
72
|
): Promise<Partial<ChannelContextMetaFileV1>> {
|
|
73
|
-
const raw = await fs.readJson(get_chat_channel_meta_path(
|
|
73
|
+
const raw = await fs.readJson(get_chat_channel_meta_path(data_path)).catch(() => null);
|
|
74
74
|
return raw && typeof raw === "object"
|
|
75
75
|
? raw as Partial<ChannelContextMetaFileV1>
|
|
76
76
|
: {};
|
|
@@ -124,7 +124,7 @@ function resolve_session_id(
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
async function remove_route(
|
|
127
|
-
|
|
127
|
+
data_path: string,
|
|
128
128
|
meta: Partial<ChannelContextMetaFileV1>,
|
|
129
129
|
session_id: string,
|
|
130
130
|
): Promise<boolean> {
|
|
@@ -143,9 +143,9 @@ async function remove_route(
|
|
|
143
143
|
removed = true;
|
|
144
144
|
}
|
|
145
145
|
if (!removed) return false;
|
|
146
|
-
await fs.ensureDir(get_chat_channel_dir_path(
|
|
146
|
+
await fs.ensureDir(get_chat_channel_dir_path(data_path));
|
|
147
147
|
await fs.writeJson(
|
|
148
|
-
get_chat_channel_meta_path(
|
|
148
|
+
get_chat_channel_meta_path(data_path),
|
|
149
149
|
{
|
|
150
150
|
...meta,
|
|
151
151
|
v: 1,
|
|
@@ -162,10 +162,10 @@ async function remove_route(
|
|
|
162
162
|
* 清空单个 Chat 会话的事件历史。
|
|
163
163
|
*/
|
|
164
164
|
export async function clear_chat_history(
|
|
165
|
-
|
|
165
|
+
data_path: string,
|
|
166
166
|
session_id: string,
|
|
167
167
|
): Promise<boolean> {
|
|
168
|
-
const history_path = get_chat_history_path(
|
|
168
|
+
const history_path = get_chat_history_path(data_path, session_id);
|
|
169
169
|
const existed = await fs.pathExists(history_path);
|
|
170
170
|
if (existed) await fs.remove(history_path);
|
|
171
171
|
return existed;
|
|
@@ -181,8 +181,8 @@ export async function clear_chat_history(
|
|
|
181
181
|
export async function clean_chat_storage(
|
|
182
182
|
input: ChatStorageCleanInput,
|
|
183
183
|
): Promise<ChatStorageCleanResult> {
|
|
184
|
-
const
|
|
185
|
-
const meta = await read_channel_meta(
|
|
184
|
+
const data_path = path.resolve(normalize_text(input.data_path) || ".");
|
|
185
|
+
const meta = await read_channel_meta(data_path);
|
|
186
186
|
const session_id = resolve_session_id(meta, input);
|
|
187
187
|
if (!session_id) {
|
|
188
188
|
return {
|
|
@@ -191,10 +191,10 @@ export async function clean_chat_storage(
|
|
|
191
191
|
removed_route: false,
|
|
192
192
|
};
|
|
193
193
|
}
|
|
194
|
-
const chat_dir_path = get_chat_session_dir_path(
|
|
194
|
+
const chat_dir_path = get_chat_session_dir_path(data_path, session_id);
|
|
195
195
|
const removed_chat_dir = await fs.pathExists(chat_dir_path);
|
|
196
196
|
if (removed_chat_dir) await fs.remove(chat_dir_path);
|
|
197
|
-
const removed_route = await remove_route(
|
|
197
|
+
const removed_route = await remove_route(data_path, meta, session_id);
|
|
198
198
|
return {
|
|
199
199
|
session_id,
|
|
200
200
|
removed_chat_dir,
|
|
@@ -208,8 +208,8 @@ export interface RevokeChatAccessGrantInput {
|
|
|
208
208
|
|
|
209
209
|
/** ChatAccessService 构造参数。 */
|
|
210
210
|
export interface ChatAccessServiceOptions {
|
|
211
|
-
/** 当前 Agent
|
|
212
|
-
|
|
211
|
+
/** 当前 Agent private runtime directory 私有数据根目录。 */
|
|
212
|
+
data_path: string;
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
/** 直接设置 Principal Grant 的输入。 */
|
|
@@ -76,7 +76,7 @@ export type ChatHistoryRequest = {
|
|
|
76
76
|
* Chat 会话列表请求。
|
|
77
77
|
*
|
|
78
78
|
* 关键点(中文)
|
|
79
|
-
* - 仅列出当前
|
|
79
|
+
* - 仅列出当前 Agent private runtime directory 已记录的 chat context(来自其数据目录的 `channel/meta.json`)。
|
|
80
80
|
* - 不会向外部平台拉取“全部会话”,因为平台侧通常需要额外权限且成本高。
|
|
81
81
|
*/
|
|
82
82
|
export type ChatListRequest = {
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/** Chat Plugin profile 中的渠道配置类型。 */
|
|
2
|
+
|
|
3
|
+
/** Telegram Bot 渠道配置。 */
|
|
4
|
+
export interface TelegramPluginChannelConfig {
|
|
5
|
+
/** profile 内稳定渠道 ID。 */
|
|
6
|
+
id: string;
|
|
7
|
+
/** 渠道判别字段。 */
|
|
8
|
+
type: "telegram";
|
|
9
|
+
/** 用户可见渠道名称。 */
|
|
10
|
+
name: string;
|
|
11
|
+
/** Telegram Bot API Token。 */
|
|
12
|
+
bot_token: string;
|
|
13
|
+
/** 可选 Telegram username。 */
|
|
14
|
+
username?: string;
|
|
15
|
+
/** 可选 Telegram Bot 用户 ID。 */
|
|
16
|
+
bot_user_id?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Feishu / Lark Bot 渠道配置。 */
|
|
20
|
+
export interface FeishuPluginChannelConfig {
|
|
21
|
+
/** profile 内稳定渠道 ID。 */
|
|
22
|
+
id: string;
|
|
23
|
+
/** 渠道判别字段。 */
|
|
24
|
+
type: "feishu";
|
|
25
|
+
/** 用户可见渠道名称。 */
|
|
26
|
+
name: string;
|
|
27
|
+
/** Feishu / Lark App ID。 */
|
|
28
|
+
app_id: string;
|
|
29
|
+
/** Feishu / Lark App Secret。 */
|
|
30
|
+
app_secret: string;
|
|
31
|
+
/** 可选 Open API Domain。 */
|
|
32
|
+
domain?: string;
|
|
33
|
+
/** 可选 Bot 身份。 */
|
|
34
|
+
identity?: string;
|
|
35
|
+
/** 可选 Bot 用户 ID。 */
|
|
36
|
+
bot_user_id?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** QQ Bot 渠道配置。 */
|
|
40
|
+
export interface QqPluginChannelConfig {
|
|
41
|
+
/** profile 内稳定渠道 ID。 */
|
|
42
|
+
id: string;
|
|
43
|
+
/** 渠道判别字段。 */
|
|
44
|
+
type: "qq";
|
|
45
|
+
/** 用户可见渠道名称。 */
|
|
46
|
+
name: string;
|
|
47
|
+
/** QQ Bot App ID。 */
|
|
48
|
+
app_id: string;
|
|
49
|
+
/** QQ Bot App Secret。 */
|
|
50
|
+
app_secret: string;
|
|
51
|
+
/** 是否使用 QQ 沙箱环境。 */
|
|
52
|
+
sandbox?: boolean;
|
|
53
|
+
/** 可选 Bot 身份。 */
|
|
54
|
+
identity?: string;
|
|
55
|
+
/** 可选 Bot 用户 ID。 */
|
|
56
|
+
bot_user_id?: string;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Chat Plugin profile 支持的完整渠道配置。 */
|
|
60
|
+
export type ChatPluginChannelConfig =
|
|
61
|
+
| TelegramPluginChannelConfig
|
|
62
|
+
| FeishuPluginChannelConfig
|
|
63
|
+
| QqPluginChannelConfig;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Chat Plugin 的完整 profile 类型。 */
|
|
2
|
+
|
|
3
|
+
import type { ChatPluginChannelConfig } from "@/chat/types/ChatPluginChannelConfig.js";
|
|
4
|
+
|
|
5
|
+
/** Chat 消息队列与合并策略。 */
|
|
6
|
+
export interface ChatPluginQueueConfig {
|
|
7
|
+
/** 同时执行的最大 Chat lane 数。 */
|
|
8
|
+
max_concurrency?: number;
|
|
9
|
+
/** 合并连续入站消息的防抖窗口,单位为毫秒。 */
|
|
10
|
+
merge_debounce_ms?: number;
|
|
11
|
+
/** 入站消息等待合并的最长时间,单位为毫秒。 */
|
|
12
|
+
merge_max_wait_ms?: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Chat Plugin 的完整结构化 profile。 */
|
|
16
|
+
export interface ChatPluginConfig {
|
|
17
|
+
/** 可选的消息队列与合并策略。 */
|
|
18
|
+
queue?: ChatPluginQueueConfig;
|
|
19
|
+
/** 当前 profile 拥有的消息渠道。 */
|
|
20
|
+
channels?: ChatPluginChannelConfig[];
|
|
21
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
5
|
* - ChatPlugin 只接收 queue 行为与 channels 列表。
|
|
6
|
-
* - 每个 channel 对象自己负责 env
|
|
6
|
+
* - 每个 channel 对象自己负责 env、凭据与运行账号解析。
|
|
7
7
|
* - 这样 ChatPlugin 不再理解 Telegram、Feishu、QQ 的具体配置字段。
|
|
8
8
|
*/
|
|
9
9
|
|
|
@@ -25,9 +25,9 @@ export interface ChatChannel {
|
|
|
25
25
|
*/
|
|
26
26
|
isEnabled(context: PluginContext): boolean;
|
|
27
27
|
/**
|
|
28
|
-
* 当前 channel
|
|
28
|
+
* 当前 channel 的稳定 ID。
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
get_channel_id(context: PluginContext): string;
|
|
31
31
|
/**
|
|
32
32
|
* 解析当前 channel 的运行态账号。
|
|
33
33
|
*/
|
|
@@ -50,7 +50,7 @@ export interface ChatPluginOptions {
|
|
|
50
50
|
* 当前 agent 持有的 chat channels。
|
|
51
51
|
*
|
|
52
52
|
* 说明(中文)
|
|
53
|
-
* - 每个 channel 对象自己负责 env
|
|
53
|
+
* - 每个 channel 对象自己负责 env、凭据与运行账号解析。
|
|
54
54
|
* - 未传入时不启用任何 chat channel。
|
|
55
55
|
*/
|
|
56
56
|
channels?: ChatChannel[];
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** Chat Plugin Mainview 使用的 Profile 公开配置类型。 */
|
|
2
|
+
|
|
3
|
+
/** Mainview 可见的 Chat 队列配置。 */
|
|
4
|
+
export interface ChatPluginPublicQueueConfig {
|
|
5
|
+
/** 同时处理的最大 Chat 任务数量。 */
|
|
6
|
+
max_concurrency?: number;
|
|
7
|
+
|
|
8
|
+
/** 合并连续入站消息前等待的毫秒数。 */
|
|
9
|
+
merge_debounce_ms?: number;
|
|
10
|
+
|
|
11
|
+
/** 一组入站消息允许等待合并的最大毫秒数。 */
|
|
12
|
+
merge_max_wait_ms?: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Mainview 可见的单个 Chat Channel。 */
|
|
16
|
+
export interface ChatPluginPublicChannelConfig {
|
|
17
|
+
/** Channel 在当前 Profile 内的稳定 ID。 */
|
|
18
|
+
id: string;
|
|
19
|
+
|
|
20
|
+
/** Channel 类型。 */
|
|
21
|
+
type: "telegram" | "feishu" | "qq";
|
|
22
|
+
|
|
23
|
+
/** 用户可见名称。 */
|
|
24
|
+
name: string;
|
|
25
|
+
|
|
26
|
+
/** Telegram Bot Token;读取时不返回已有值。 */
|
|
27
|
+
bot_token?: string;
|
|
28
|
+
|
|
29
|
+
/** 飞书或 QQ App ID。 */
|
|
30
|
+
app_id?: string;
|
|
31
|
+
|
|
32
|
+
/** 飞书或 QQ App Secret;读取时不返回已有值。 */
|
|
33
|
+
app_secret?: string;
|
|
34
|
+
|
|
35
|
+
/** 飞书 API Domain。 */
|
|
36
|
+
domain?: string;
|
|
37
|
+
|
|
38
|
+
/** QQ 是否使用沙箱环境。 */
|
|
39
|
+
sandbox?: boolean;
|
|
40
|
+
|
|
41
|
+
/** 当前 Channel 是否已经保存凭据。 */
|
|
42
|
+
secret_configured: boolean;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Mainview 可见的完整 Chat Profile。 */
|
|
46
|
+
export interface ChatPluginPublicProfile {
|
|
47
|
+
/** Chat 队列行为。 */
|
|
48
|
+
queue: ChatPluginPublicQueueConfig;
|
|
49
|
+
|
|
50
|
+
/** 当前 Profile 拥有的全部 Channel。 */
|
|
51
|
+
channels: ChatPluginPublicChannelConfig[];
|
|
52
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Chat Plugin React Mainview 的内部组件属性类型。 */
|
|
2
|
+
|
|
3
|
+
import type { PluginRendererUiComponents } from "@downcity/plugin/react";
|
|
4
|
+
import type { ChatPluginPublicChannelConfig } from "./ChatPluginProfile.js";
|
|
5
|
+
|
|
6
|
+
/** 单个 Chat Channel 编辑分组的属性。 */
|
|
7
|
+
export interface ChatPluginChannelEditorProps {
|
|
8
|
+
/** 当前 Channel 草稿。 */
|
|
9
|
+
readonly channel: ChatPluginPublicChannelConfig;
|
|
10
|
+
|
|
11
|
+
/** 当前 Profile 中已经被其他 Channel 使用的类型。 */
|
|
12
|
+
readonly used_types: ReadonlySet<ChatPluginPublicChannelConfig["type"]>;
|
|
13
|
+
|
|
14
|
+
/** 当前 Mainview 使用的宿主 UI Components。 */
|
|
15
|
+
readonly components: Pick<
|
|
16
|
+
PluginRendererUiComponents,
|
|
17
|
+
"Button" | "Group" | "Input" | "Row" | "Select" | "Switch"
|
|
18
|
+
>;
|
|
19
|
+
|
|
20
|
+
/** 替换当前 Channel 草稿。 */
|
|
21
|
+
update(channel: ChatPluginPublicChannelConfig): void;
|
|
22
|
+
|
|
23
|
+
/** 删除当前 Channel 草稿。 */
|
|
24
|
+
remove(): void;
|
|
25
|
+
}
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
import type { FeishuBot } from "@/chat/channels/feishu/Feishu.js";
|
|
10
10
|
import type { QQBot } from "@/chat/channels/qq/QQ.js";
|
|
11
11
|
import type { TelegramBot } from "@/chat/channels/telegram/Bot.js";
|
|
12
|
+
import type { ChatQueueWorker } from "@/chat/runtime/ChatQueueWorker.js";
|
|
13
|
+
import type { ChatQueueStore } from "@/chat/runtime/ChatQueueStore.js";
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* `ChatPlugin` 实例持有的渠道状态。
|
|
@@ -31,3 +33,15 @@ export type ChatChannelState = {
|
|
|
31
33
|
*/
|
|
32
34
|
qq: QQBot | null;
|
|
33
35
|
};
|
|
36
|
+
|
|
37
|
+
/** ChatPlugin 在单个 Workspace 中持有的全部长期运行态。 */
|
|
38
|
+
export interface ChatWorkspaceRuntime {
|
|
39
|
+
/** 当前 Workspace 的渠道连接状态。 */
|
|
40
|
+
readonly channel_state: ChatChannelState;
|
|
41
|
+
|
|
42
|
+
/** 当前 Workspace 的消息队列存储。 */
|
|
43
|
+
readonly queue_store: ChatQueueStore;
|
|
44
|
+
|
|
45
|
+
/** 当前 Workspace 的消息队列消费 worker。 */
|
|
46
|
+
readonly queue_worker: ChatQueueWorker;
|
|
47
|
+
}
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
5
|
* - 该类型只用于 Channel Adapter 消费宿主已解析的构造参数。
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
6
|
+
* - 它不表达存储、账号池或独立配置查询能力。
|
|
7
|
+
* - 生命周期字段仅用于现有状态与访问控制逻辑,不表达独立持久化领域。
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import type { ChatChannelName } from "@/chat/types/ChannelStatus.js";
|
|
11
11
|
|
|
12
12
|
/** 一个 Channel 启动所需的完整运行时账号快照。 */
|
|
13
13
|
export interface ChatRuntimeAccount {
|
|
14
|
-
/**
|
|
14
|
+
/** Plugin profile 或 SDK 调用方提供的稳定 Channel ID。 */
|
|
15
15
|
id: string;
|
|
16
16
|
|
|
17
17
|
/** 账号对应的 Chat Channel 类型。 */
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
* 清理单个 Chat 会话存储的输入。
|
|
11
11
|
*/
|
|
12
12
|
export interface ChatStorageCleanInput {
|
|
13
|
-
/** 当前 Agent
|
|
14
|
-
|
|
13
|
+
/** 当前 Agent private runtime directory 内部数据根目录。 */
|
|
14
|
+
data_path: string;
|
|
15
15
|
/** 已知的 Session 标识;提供时优先使用。 */
|
|
16
16
|
session_id?: string;
|
|
17
17
|
/** Chat 渠道名称;未提供 Session 标识时用于解析目标会话。 */
|
package/src/chat.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* `@downcity/plugins/chat` 独立公开入口。
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
|
-
* - 汇总 ChatPlugin
|
|
5
|
+
* - 汇总 ChatPlugin、运行渠道与 Chat Access 公开能力。
|
|
6
6
|
* - 不加载其他内建 plugin 的入口模块。
|
|
7
7
|
*/
|
|
8
8
|
|
|
@@ -21,17 +21,6 @@ export {
|
|
|
21
21
|
export { get_chat_access_db_path } from "./chat/access/ChatAccessStore.js";
|
|
22
22
|
export { CHAT_ACCESS_ACTIONS } from "./chat/types/ChatAccess.js";
|
|
23
23
|
export { clean_chat_storage } from "./chat/runtime/ChatStorage.js";
|
|
24
|
-
export {
|
|
25
|
-
CHAT_PLUGIN_CONFIG_JSON_SCHEMA,
|
|
26
|
-
CHAT_PLUGIN_RESOURCE_JSON_SCHEMA,
|
|
27
|
-
chat_plugin_config_schema,
|
|
28
|
-
chat_plugin_resource_schema,
|
|
29
|
-
get_chat_plugin_resource_json_schema,
|
|
30
|
-
parse_chat_plugin_config,
|
|
31
|
-
parse_chat_plugin_resource,
|
|
32
|
-
resolve_chat_plugin_resource,
|
|
33
|
-
} from "./chat/config/ChatPluginConfig.js";
|
|
34
|
-
|
|
35
24
|
export type {
|
|
36
25
|
ChatStorageCleanInput,
|
|
37
26
|
ChatStorageCleanResult,
|
|
@@ -47,8 +36,11 @@ export type {
|
|
|
47
36
|
ChatChannel,
|
|
48
37
|
ChatPluginOptions,
|
|
49
38
|
} from "./chat/types/ChatPluginOptions.js";
|
|
50
|
-
export type {
|
|
51
|
-
|
|
39
|
+
export type {
|
|
40
|
+
ChatPluginConfig,
|
|
41
|
+
ChatPluginQueueConfig,
|
|
42
|
+
} from "./chat/types/ChatPluginConfig.js";
|
|
43
|
+
export type { ChatPluginChannelConfig } from "./chat/types/ChatPluginChannelConfig.js";
|
|
52
44
|
export type {
|
|
53
45
|
ApproveChatAccessRequestInput,
|
|
54
46
|
ChatAccessDecision,
|
package/src/contact/Action.ts
CHANGED
|
@@ -130,7 +130,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
130
130
|
data: await handlers.link(
|
|
131
131
|
params.context,
|
|
132
132
|
params.input as ContactLinkCommandPayload,
|
|
133
|
-
params.
|
|
133
|
+
params.execution.snapshot,
|
|
134
134
|
),
|
|
135
135
|
}),
|
|
136
136
|
}),
|
|
@@ -173,7 +173,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
173
173
|
data: await handlers.approve(
|
|
174
174
|
params.context,
|
|
175
175
|
params.input as unknown as ContactApproveCommandPayload,
|
|
176
|
-
params.
|
|
176
|
+
params.execution.snapshot,
|
|
177
177
|
),
|
|
178
178
|
}),
|
|
179
179
|
}),
|
|
@@ -193,7 +193,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
193
193
|
execute: async (params) => ({
|
|
194
194
|
success: true,
|
|
195
195
|
data: {
|
|
196
|
-
contacts: await listContacts(params.context.
|
|
196
|
+
contacts: await listContacts(params.context.data_path),
|
|
197
197
|
} as unknown as JsonValue,
|
|
198
198
|
}),
|
|
199
199
|
}),
|
|
@@ -354,7 +354,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
354
354
|
execute: async (params) => ({
|
|
355
355
|
success: true,
|
|
356
356
|
data: {
|
|
357
|
-
shares: await listContactInboxShares(params.context.
|
|
357
|
+
shares: await listContactInboxShares(params.context.data_path),
|
|
358
358
|
} as unknown as JsonValue,
|
|
359
359
|
}),
|
|
360
360
|
}),
|
|
@@ -385,7 +385,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
385
385
|
execute: async (params) => ({
|
|
386
386
|
success: true,
|
|
387
387
|
data: (await receiveShare({
|
|
388
|
-
|
|
388
|
+
data_path: params.context.data_path,
|
|
389
389
|
shareId: (params.input as unknown as ContactReceiveCommandPayload).shareId,
|
|
390
390
|
})) as unknown as JsonValue,
|
|
391
391
|
}),
|
|
@@ -209,7 +209,7 @@ export class ContactPlugin extends BasePlugin {
|
|
|
209
209
|
);
|
|
210
210
|
const agentName = getAgentName(context);
|
|
211
211
|
|
|
212
|
-
await saveContactLinkRecord(context.
|
|
212
|
+
await saveContactLinkRecord(context.data_path, {
|
|
213
213
|
id: linkId,
|
|
214
214
|
agentName,
|
|
215
215
|
endpoint,
|
|
@@ -293,7 +293,7 @@ export class ContactPlugin extends BasePlugin {
|
|
|
293
293
|
if (!response.success) throw new Error(response.error || "Contact approve failed");
|
|
294
294
|
|
|
295
295
|
const name = String(payload.name || response.agentName || parsed.agentName).trim();
|
|
296
|
-
const contact = await saveContact(context.
|
|
296
|
+
const contact = await saveContact(context.data_path, {
|
|
297
297
|
id: createStableContactId(name),
|
|
298
298
|
name,
|
|
299
299
|
endpoint: response.endpoint || parsed.endpoint,
|
|
@@ -326,7 +326,7 @@ export class ContactPlugin extends BasePlugin {
|
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
328
|
const finalContact = confirmed
|
|
329
|
-
? await saveContact(context.
|
|
329
|
+
? await saveContact(context.data_path, {
|
|
330
330
|
...contact,
|
|
331
331
|
reachability: "bidirectional",
|
|
332
332
|
inboundTokenHash: tokenForRequester ? hashContactToken(tokenForRequester) : null,
|
|
@@ -356,7 +356,7 @@ export class ContactPlugin extends BasePlugin {
|
|
|
356
356
|
const endpointInput = String(payload.endpoint || "").trim();
|
|
357
357
|
const contact = endpointInput
|
|
358
358
|
? null
|
|
359
|
-
: await findContact(context.
|
|
359
|
+
: await findContact(context.data_path, String(payload.target || "").trim());
|
|
360
360
|
const endpoint = endpointInput || contact?.endpoint || "";
|
|
361
361
|
if (!endpoint) throw new Error("contact target or --to endpoint is required");
|
|
362
362
|
if (contact && !contact.outboundToken) {
|
|
@@ -369,7 +369,7 @@ export class ContactPlugin extends BasePlugin {
|
|
|
369
369
|
token: contact?.outboundToken || undefined,
|
|
370
370
|
});
|
|
371
371
|
if (contact && pong.success) {
|
|
372
|
-
await touchContactSeen(context.
|
|
372
|
+
await touchContactSeen(context.data_path, contact.id);
|
|
373
373
|
}
|
|
374
374
|
return {
|
|
375
375
|
target: contact?.name || endpoint,
|
|
@@ -392,17 +392,17 @@ export class ContactPlugin extends BasePlugin {
|
|
|
392
392
|
}
|
|
393
393
|
|
|
394
394
|
private async chat(context: PluginContext, payload: ContactChatCommandPayload) {
|
|
395
|
-
const contact = await findContact(context.
|
|
395
|
+
const contact = await findContact(context.data_path, payload.to);
|
|
396
396
|
if (!contact) throw new Error(`Contact not found: ${payload.to}`);
|
|
397
397
|
const message = String(payload.message || "").trim();
|
|
398
398
|
if (!message) {
|
|
399
399
|
return {
|
|
400
400
|
contact,
|
|
401
|
-
messages: await readContactMessages(context.
|
|
401
|
+
messages: await readContactMessages(context.data_path, contact.id),
|
|
402
402
|
};
|
|
403
403
|
}
|
|
404
404
|
|
|
405
|
-
await appendContactMessage(context.
|
|
405
|
+
await appendContactMessage(context.data_path, contact.id, {
|
|
406
406
|
role: "local",
|
|
407
407
|
text: message,
|
|
408
408
|
created_at: Date.now(),
|
|
@@ -418,7 +418,7 @@ export class ContactPlugin extends BasePlugin {
|
|
|
418
418
|
} as unknown as JsonValue,
|
|
419
419
|
});
|
|
420
420
|
if (!response.success) throw new Error(response.error || "Contact chat failed");
|
|
421
|
-
await appendContactMessage(context.
|
|
421
|
+
await appendContactMessage(context.data_path, contact.id, {
|
|
422
422
|
role: "remote",
|
|
423
423
|
text: response.reply,
|
|
424
424
|
created_at: Date.now(),
|
|
@@ -427,7 +427,7 @@ export class ContactPlugin extends BasePlugin {
|
|
|
427
427
|
}
|
|
428
428
|
|
|
429
429
|
private async share(context: PluginContext, payload: ContactShareCommandPayload) {
|
|
430
|
-
const contact = await findContact(context.
|
|
430
|
+
const contact = await findContact(context.data_path, payload.to);
|
|
431
431
|
if (!contact) throw new Error(`Contact not found: ${payload.to}`);
|
|
432
432
|
const outbound = requireOutboundContact(contact);
|
|
433
433
|
const share = await createShareInput({
|
|
@@ -466,7 +466,7 @@ export class ContactPlugin extends BasePlugin {
|
|
|
466
466
|
plugin: "contact",
|
|
467
467
|
};
|
|
468
468
|
}
|
|
469
|
-
const contact = await findContactByInboundToken(context.
|
|
469
|
+
const contact = await findContactByInboundToken(context.data_path, token);
|
|
470
470
|
return {
|
|
471
471
|
success: true,
|
|
472
472
|
agentName: getAgentName(context),
|
|
@@ -480,7 +480,7 @@ export class ContactPlugin extends BasePlugin {
|
|
|
480
480
|
request: ContactApproveLinkRequest,
|
|
481
481
|
): Promise<ContactApproveLinkResponse> {
|
|
482
482
|
return await approveContactLinkRequest({
|
|
483
|
-
|
|
483
|
+
data_path: context.data_path,
|
|
484
484
|
ownerAgentName: getAgentName(context),
|
|
485
485
|
ownerEndpoint: await resolveSelfEndpoint(context, this.options),
|
|
486
486
|
request,
|
|
@@ -492,7 +492,7 @@ export class ContactPlugin extends BasePlugin {
|
|
|
492
492
|
request: ContactConfirmRequest,
|
|
493
493
|
): Promise<ContactConfirmResponse> {
|
|
494
494
|
return await confirmContactLinkRequest({
|
|
495
|
-
|
|
495
|
+
data_path: context.data_path,
|
|
496
496
|
ownerAgentName: getAgentName(context),
|
|
497
497
|
request,
|
|
498
498
|
verifyCallback: async ({ endpoint, token }) => {
|
|
@@ -509,7 +509,7 @@ export class ContactPlugin extends BasePlugin {
|
|
|
509
509
|
const payload = readContactObject(rawPayload);
|
|
510
510
|
const token = readContactString(payload, "token");
|
|
511
511
|
const body = readContactObject(payload.body);
|
|
512
|
-
const contact = await findContactByInboundToken(context.
|
|
512
|
+
const contact = await findContactByInboundToken(context.data_path, token);
|
|
513
513
|
if (!contact || contact.status !== "trusted") {
|
|
514
514
|
throw new Error("Invalid contact token");
|
|
515
515
|
}
|
|
@@ -521,7 +521,7 @@ export class ContactPlugin extends BasePlugin {
|
|
|
521
521
|
receivedAt: Date.now(),
|
|
522
522
|
status: "pending" as const,
|
|
523
523
|
};
|
|
524
|
-
await saveContactInboxShare(context.
|
|
524
|
+
await saveContactInboxShare(context.data_path, {
|
|
525
525
|
meta,
|
|
526
526
|
payload: share.payload,
|
|
527
527
|
files: Array.isArray(share.files) ? share.files : [],
|
|
@@ -30,7 +30,7 @@ export async function receiveContactChatMessage(params: {
|
|
|
30
30
|
*/
|
|
31
31
|
message: string;
|
|
32
32
|
}): Promise<ContactChatResponse> {
|
|
33
|
-
const contact = await findContactByInboundToken(params.context.
|
|
33
|
+
const contact = await findContactByInboundToken(params.context.data_path, params.token);
|
|
34
34
|
if (!contact || contact.status !== "trusted") {
|
|
35
35
|
return {
|
|
36
36
|
success: false,
|
|
@@ -41,7 +41,7 @@ export async function receiveContactChatMessage(params: {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
const now = Date.now();
|
|
44
|
-
await appendContactMessage(params.context.
|
|
44
|
+
await appendContactMessage(params.context.data_path, contact.id, {
|
|
45
45
|
role: "remote",
|
|
46
46
|
text: params.message,
|
|
47
47
|
created_at: now,
|
|
@@ -53,7 +53,7 @@ export async function receiveContactChatMessage(params: {
|
|
|
53
53
|
});
|
|
54
54
|
const result = await turn.finished;
|
|
55
55
|
const reply = result.text.trim();
|
|
56
|
-
await appendContactMessage(params.context.
|
|
56
|
+
await appendContactMessage(params.context.data_path, contact.id, {
|
|
57
57
|
role: "local",
|
|
58
58
|
text: reply,
|
|
59
59
|
created_at: Date.now(),
|