@downcity/plugins 1.0.216 → 1.0.236
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/chat/Action.d.ts +51 -51
- package/bin/chat/Action.d.ts.map +1 -1
- package/bin/chat/Action.js +109 -108
- package/bin/chat/Action.js.map +1 -1
- package/bin/chat/ChatPlugin.d.ts +7 -7
- package/bin/chat/ChatPlugin.d.ts.map +1 -1
- package/bin/chat/ChatPlugin.js +4 -4
- package/bin/chat/ChatPlugin.js.map +1 -1
- package/bin/chat/Index.d.ts +3 -0
- package/bin/chat/Index.d.ts.map +1 -1
- package/bin/chat/Index.js +1 -0
- package/bin/chat/Index.js.map +1 -1
- package/bin/chat/PROMPT.direct.d.ts +1 -1
- package/bin/chat/PROMPT.direct.d.ts.map +1 -1
- package/bin/chat/PROMPT.direct.js +1 -1
- package/bin/chat/PROMPT.direct.js.map +1 -1
- package/bin/chat/access/ChatAccessActions.js +6 -6
- package/bin/chat/access/ChatAccessActions.js.map +1 -1
- package/bin/chat/access/ChatAccessRuntime.d.ts +4 -4
- package/bin/chat/access/ChatAccessRuntime.d.ts.map +1 -1
- package/bin/chat/access/ChatAccessRuntime.js +1 -1
- package/bin/chat/access/ChatAccessRuntime.js.map +1 -1
- package/bin/chat/access/ChatAccessStore.js +5 -5
- package/bin/chat/access/ChatAccessStore.js.map +1 -1
- package/bin/chat/channels/BaseChatChannel.d.ts +17 -17
- package/bin/chat/channels/BaseChatChannel.d.ts.map +1 -1
- package/bin/chat/channels/BaseChatChannel.js +19 -19
- package/bin/chat/channels/BaseChatChannel.js.map +1 -1
- package/bin/chat/channels/BaseChatChannelQueue.d.ts +6 -6
- package/bin/chat/channels/BaseChatChannelQueue.d.ts.map +1 -1
- package/bin/chat/channels/BaseChatChannelQueue.js +32 -32
- package/bin/chat/channels/BaseChatChannelQueue.js.map +1 -1
- package/bin/chat/channels/BaseChatChannelSupport.d.ts +14 -14
- package/bin/chat/channels/BaseChatChannelSupport.d.ts.map +1 -1
- package/bin/chat/channels/BaseChatChannelSupport.js +13 -13
- package/bin/chat/channels/BaseChatChannelSupport.js.map +1 -1
- package/bin/chat/channels/RuntimeChannel.d.ts +23 -28
- package/bin/chat/channels/RuntimeChannel.d.ts.map +1 -1
- package/bin/chat/channels/RuntimeChannel.js +39 -57
- package/bin/chat/channels/RuntimeChannel.js.map +1 -1
- package/bin/chat/channels/feishu/Feishu.d.ts +7 -7
- package/bin/chat/channels/feishu/Feishu.d.ts.map +1 -1
- package/bin/chat/channels/feishu/Feishu.js +31 -31
- package/bin/chat/channels/feishu/Feishu.js.map +1 -1
- package/bin/chat/channels/feishu/FeishuInbound.js +3 -3
- package/bin/chat/channels/feishu/FeishuInbound.js.map +1 -1
- package/bin/chat/channels/feishu/FeishuMessageHandler.d.ts +10 -10
- package/bin/chat/channels/feishu/FeishuMessageHandler.d.ts.map +1 -1
- package/bin/chat/channels/feishu/FeishuMessageHandler.js +17 -17
- package/bin/chat/channels/feishu/FeishuMessageHandler.js.map +1 -1
- package/bin/chat/channels/feishu/FeishuPlatformClient.d.ts +6 -6
- package/bin/chat/channels/feishu/FeishuPlatformClient.d.ts.map +1 -1
- package/bin/chat/channels/feishu/FeishuPlatformClient.js +9 -9
- package/bin/chat/channels/feishu/FeishuPlatformClient.js.map +1 -1
- package/bin/chat/channels/feishu/FeishuPlatformLookup.d.ts +1 -1
- package/bin/chat/channels/feishu/FeishuPlatformLookup.d.ts.map +1 -1
- package/bin/chat/channels/feishu/FeishuPlatformLookup.js +6 -6
- package/bin/chat/channels/feishu/FeishuPlatformLookup.js.map +1 -1
- package/bin/chat/channels/feishu/FeishuPlatformMessaging.d.ts +2 -2
- package/bin/chat/channels/feishu/FeishuPlatformMessaging.d.ts.map +1 -1
- package/bin/chat/channels/feishu/FeishuPlatformMessaging.js +7 -7
- package/bin/chat/channels/feishu/FeishuPlatformMessaging.js.map +1 -1
- package/bin/chat/channels/feishu/InboundAttachment.d.ts +1 -1
- package/bin/chat/channels/feishu/InboundAttachment.d.ts.map +1 -1
- package/bin/chat/channels/feishu/InboundAttachment.js +5 -5
- package/bin/chat/channels/feishu/InboundAttachment.js.map +1 -1
- package/bin/chat/channels/feishu/PostMessage.js +8 -8
- package/bin/chat/channels/feishu/PostMessage.js.map +1 -1
- package/bin/chat/channels/feishu/ReplyContext.d.ts +1 -1
- package/bin/chat/channels/feishu/ReplyContext.d.ts.map +1 -1
- package/bin/chat/channels/feishu/ReplyContext.js +2 -2
- package/bin/chat/channels/feishu/ReplyContext.js.map +1 -1
- package/bin/chat/channels/feishu/Shared.js +3 -3
- package/bin/chat/channels/feishu/Shared.js.map +1 -1
- package/bin/chat/channels/qq/PROMPT.direct.d.ts +1 -1
- package/bin/chat/channels/qq/PROMPT.direct.d.ts.map +1 -1
- package/bin/chat/channels/qq/PROMPT.direct.js +1 -1
- package/bin/chat/channels/qq/PROMPT.direct.js.map +1 -1
- package/bin/chat/channels/qq/QQ.d.ts +3 -3
- package/bin/chat/channels/qq/QQ.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQ.js +20 -20
- 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/QQGatewayAuth.d.ts +1 -1
- package/bin/chat/channels/qq/QQGatewayAuth.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQGatewayClient.d.ts +2 -2
- package/bin/chat/channels/qq/QQGatewayClient.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQGatewayClient.js +11 -11
- package/bin/chat/channels/qq/QQGatewayClient.js.map +1 -1
- package/bin/chat/channels/qq/QQGatewayConnection.d.ts +1 -1
- package/bin/chat/channels/qq/QQGatewayConnection.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQGatewaySend.d.ts +2 -2
- package/bin/chat/channels/qq/QQGatewaySend.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQGatewaySend.js +3 -3
- package/bin/chat/channels/qq/QQGatewaySend.js.map +1 -1
- package/bin/chat/channels/qq/QQInbound.js +5 -5
- package/bin/chat/channels/qq/QQInbound.js.map +1 -1
- package/bin/chat/channels/qq/QQInboundDedupe.d.ts +2 -2
- package/bin/chat/channels/qq/QQInboundDedupe.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQInboundDedupe.js +5 -5
- package/bin/chat/channels/qq/QQInboundDedupe.js.map +1 -1
- package/bin/chat/channels/qq/QQMessageHandler.d.ts +9 -9
- package/bin/chat/channels/qq/QQMessageHandler.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQMessageHandler.js +34 -34
- package/bin/chat/channels/qq/QQMessageHandler.js.map +1 -1
- package/bin/chat/channels/qq/QQSendSupport.js +2 -2
- package/bin/chat/channels/qq/QQSendSupport.js.map +1 -1
- package/bin/chat/channels/qq/QQSupport.d.ts +5 -5
- package/bin/chat/channels/qq/QQSupport.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQSupport.js +5 -5
- package/bin/chat/channels/qq/QQSupport.js.map +1 -1
- package/bin/chat/channels/qq/types/QqChannel.d.ts +1 -1
- package/bin/chat/channels/qq/types/QqChannel.d.ts.map +1 -1
- package/bin/chat/channels/telegram/ApiClient.d.ts +2 -2
- package/bin/chat/channels/telegram/ApiClient.d.ts.map +1 -1
- package/bin/chat/channels/telegram/ApiClient.js +6 -6
- package/bin/chat/channels/telegram/ApiClient.js.map +1 -1
- package/bin/chat/channels/telegram/Bot.d.ts +4 -4
- package/bin/chat/channels/telegram/Bot.d.ts.map +1 -1
- package/bin/chat/channels/telegram/Bot.js +14 -14
- package/bin/chat/channels/telegram/Bot.js.map +1 -1
- package/bin/chat/channels/telegram/BotInfo.js +1 -1
- package/bin/chat/channels/telegram/BotInfo.js.map +1 -1
- package/bin/chat/channels/telegram/ReplyContext.js +3 -3
- package/bin/chat/channels/telegram/ReplyContext.js.map +1 -1
- package/bin/chat/channels/telegram/Shared.js +3 -3
- package/bin/chat/channels/telegram/Shared.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/TelegramInbound.d.ts +3 -3
- package/bin/chat/channels/telegram/TelegramInbound.d.ts.map +1 -1
- package/bin/chat/channels/telegram/TelegramInbound.js +4 -4
- package/bin/chat/channels/telegram/TelegramInbound.js.map +1 -1
- package/bin/chat/channels/telegram/TelegramMessageHandler.d.ts +8 -8
- package/bin/chat/channels/telegram/TelegramMessageHandler.d.ts.map +1 -1
- package/bin/chat/channels/telegram/TelegramMessageHandler.js +25 -25
- package/bin/chat/channels/telegram/TelegramMessageHandler.js.map +1 -1
- package/bin/chat/channels/telegram/TelegramPendingUpdates.d.ts +2 -2
- package/bin/chat/channels/telegram/TelegramPendingUpdates.d.ts.map +1 -1
- package/bin/chat/channels/telegram/TelegramPendingUpdates.js +7 -7
- package/bin/chat/channels/telegram/TelegramPendingUpdates.js.map +1 -1
- package/bin/chat/channels/telegram/TelegramPlatformClient.d.ts +4 -4
- package/bin/chat/channels/telegram/TelegramPlatformClient.d.ts.map +1 -1
- package/bin/chat/channels/telegram/TelegramPlatformClient.js +7 -7
- package/bin/chat/channels/telegram/TelegramPlatformClient.js.map +1 -1
- package/bin/chat/config/ChatPluginConfig.d.ts +67 -0
- package/bin/chat/config/ChatPluginConfig.d.ts.map +1 -0
- package/bin/chat/config/ChatPluginConfig.js +237 -0
- package/bin/chat/config/ChatPluginConfig.js.map +1 -0
- package/bin/chat/runtime/ChannelContextStore.d.ts +21 -21
- package/bin/chat/runtime/ChannelContextStore.d.ts.map +1 -1
- package/bin/chat/runtime/ChannelContextStore.js +74 -74
- package/bin/chat/runtime/ChannelContextStore.js.map +1 -1
- package/bin/chat/runtime/ChatActionExecution.d.ts +23 -23
- package/bin/chat/runtime/ChatActionExecution.d.ts.map +1 -1
- package/bin/chat/runtime/ChatActionExecution.js +70 -70
- package/bin/chat/runtime/ChatActionExecution.js.map +1 -1
- package/bin/chat/runtime/ChatActionInput.js +19 -19
- package/bin/chat/runtime/ChatActionInput.js.map +1 -1
- package/bin/chat/runtime/ChatChannelActions.d.ts +4 -4
- package/bin/chat/runtime/ChatChannelActions.d.ts.map +1 -1
- package/bin/chat/runtime/ChatChannelConfig.d.ts +4 -4
- package/bin/chat/runtime/ChatChannelConfig.d.ts.map +1 -1
- package/bin/chat/runtime/ChatChannelConfig.js +9 -9
- package/bin/chat/runtime/ChatChannelConfig.js.map +1 -1
- package/bin/chat/runtime/ChatChannelCore.d.ts +11 -12
- package/bin/chat/runtime/ChatChannelCore.d.ts.map +1 -1
- package/bin/chat/runtime/ChatChannelCore.js +5 -17
- package/bin/chat/runtime/ChatChannelCore.js.map +1 -1
- package/bin/chat/runtime/ChatChannelLifecycle.d.ts +3 -3
- package/bin/chat/runtime/ChatChannelLifecycle.d.ts.map +1 -1
- package/bin/chat/runtime/ChatChannelLifecycle.js +5 -5
- package/bin/chat/runtime/ChatChannelLifecycle.js.map +1 -1
- package/bin/chat/runtime/ChatHistoryStore.d.ts +11 -11
- package/bin/chat/runtime/ChatHistoryStore.d.ts.map +1 -1
- package/bin/chat/runtime/ChatHistoryStore.js +26 -26
- package/bin/chat/runtime/ChatHistoryStore.js.map +1 -1
- package/bin/chat/runtime/ChatIngressStore.d.ts +4 -4
- package/bin/chat/runtime/ChatIngressStore.d.ts.map +1 -1
- package/bin/chat/runtime/ChatIngressStore.js +2 -2
- package/bin/chat/runtime/ChatIngressStore.js.map +1 -1
- package/bin/chat/runtime/ChatMetaStore.d.ts +19 -19
- package/bin/chat/runtime/ChatMetaStore.d.ts.map +1 -1
- package/bin/chat/runtime/ChatMetaStore.js +27 -27
- package/bin/chat/runtime/ChatMetaStore.js.map +1 -1
- package/bin/chat/runtime/ChatPluginActionRegistry.d.ts.map +1 -1
- package/bin/chat/runtime/ChatPluginActionRegistry.js +53 -59
- package/bin/chat/runtime/ChatPluginActionRegistry.js.map +1 -1
- package/bin/chat/runtime/ChatPluginSystem.d.ts +4 -4
- package/bin/chat/runtime/ChatPluginSystem.d.ts.map +1 -1
- package/bin/chat/runtime/ChatPluginSystem.js +5 -5
- package/bin/chat/runtime/ChatPluginSystem.js.map +1 -1
- package/bin/chat/runtime/ChatQueueReplyDispatch.d.ts +6 -6
- package/bin/chat/runtime/ChatQueueReplyDispatch.d.ts.map +1 -1
- package/bin/chat/runtime/ChatQueueReplyDispatch.js +41 -41
- package/bin/chat/runtime/ChatQueueReplyDispatch.js.map +1 -1
- package/bin/chat/runtime/ChatQueueStore.d.ts +3 -3
- package/bin/chat/runtime/ChatQueueStore.d.ts.map +1 -1
- package/bin/chat/runtime/ChatQueueStore.js +2 -2
- package/bin/chat/runtime/ChatQueueStore.js.map +1 -1
- package/bin/chat/runtime/ChatQueueWorker.d.ts +2 -2
- package/bin/chat/runtime/ChatQueueWorker.d.ts.map +1 -1
- package/bin/chat/runtime/ChatQueueWorker.js +30 -32
- package/bin/chat/runtime/ChatQueueWorker.js.map +1 -1
- package/bin/chat/runtime/ChatQueueWorkerSupport.d.ts +1 -1
- package/bin/chat/runtime/ChatQueueWorkerSupport.js +15 -15
- package/bin/chat/runtime/ChatQueueWorkerSupport.js.map +1 -1
- package/bin/chat/runtime/ChatSendActionInput.js +51 -51
- package/bin/chat/runtime/ChatSendActionInput.js.map +1 -1
- package/bin/chat/runtime/ChatSendMetadata.d.ts +1 -1
- package/bin/chat/runtime/ChatSendMetadata.js +12 -12
- package/bin/chat/runtime/ChatSendMetadata.js.map +1 -1
- package/bin/chat/runtime/ChatSendRegistry.d.ts +1 -1
- package/bin/chat/runtime/ChatSessionDelete.d.ts +7 -7
- package/bin/chat/runtime/ChatSessionDelete.d.ts.map +1 -1
- package/bin/chat/runtime/ChatSessionDelete.js +15 -15
- package/bin/chat/runtime/ChatSessionDelete.js.map +1 -1
- package/bin/chat/runtime/ChatStorage.d.ts +1 -1
- package/bin/chat/runtime/ChatStorage.js +3 -3
- package/bin/chat/runtime/ChatStorage.js.map +1 -1
- package/bin/chat/runtime/ChatkeySend.d.ts +21 -21
- package/bin/chat/runtime/ChatkeySend.d.ts.map +1 -1
- package/bin/chat/runtime/ChatkeySend.js +33 -33
- package/bin/chat/runtime/ChatkeySend.js.map +1 -1
- package/bin/chat/runtime/DirectDispatchParser.d.ts +2 -2
- package/bin/chat/runtime/DirectDispatchParser.js +20 -20
- package/bin/chat/runtime/DirectDispatchParser.js.map +1 -1
- package/bin/chat/runtime/EnqueueDispatch.d.ts +3 -3
- package/bin/chat/runtime/EnqueueDispatch.d.ts.map +1 -1
- package/bin/chat/runtime/InboundAugment.d.ts +3 -3
- package/bin/chat/runtime/InboundAugment.d.ts.map +1 -1
- package/bin/chat/runtime/InboundAugment.js +6 -6
- package/bin/chat/runtime/InboundAugment.js.map +1 -1
- package/bin/chat/runtime/QueuedUserMessage.js +5 -5
- package/bin/chat/runtime/QueuedUserMessage.js.map +1 -1
- package/bin/chat/runtime/ReplyContextFormatter.js +7 -7
- package/bin/chat/runtime/ReplyContextFormatter.js.map +1 -1
- package/bin/chat/runtime/ReplyDispatch.d.ts +7 -7
- package/bin/chat/runtime/ReplyDispatch.d.ts.map +1 -1
- package/bin/chat/runtime/ReplyDispatch.js +3 -3
- package/bin/chat/runtime/ReplyDispatch.js.map +1 -1
- package/bin/chat/runtime/SystemPrompt.d.ts +4 -4
- package/bin/chat/runtime/SystemPrompt.d.ts.map +1 -1
- package/bin/chat/runtime/SystemPrompt.js +10 -10
- package/bin/chat/runtime/SystemPrompt.js.map +1 -1
- package/bin/chat/types/ChannelContext.d.ts +11 -11
- package/bin/chat/types/ChannelContext.d.ts.map +1 -1
- package/bin/chat/types/ChannelContext.js +2 -2
- package/bin/chat/types/ChatCommand.d.ts +31 -31
- package/bin/chat/types/ChatCommand.d.ts.map +1 -1
- package/bin/chat/types/ChatDispatcher.d.ts +3 -3
- package/bin/chat/types/ChatDispatcher.d.ts.map +1 -1
- package/bin/chat/types/ChatHistory.d.ts +2 -2
- package/bin/chat/types/ChatHistory.d.ts.map +1 -1
- package/bin/chat/types/ChatMeta.d.ts +4 -4
- package/bin/chat/types/ChatMeta.d.ts.map +1 -1
- package/bin/chat/types/ChatMeta.js +1 -1
- package/bin/chat/types/ChatPlugin.d.ts +9 -9
- package/bin/chat/types/ChatPlugin.d.ts.map +1 -1
- package/bin/chat/types/ChatPluginActionPayload.d.ts +13 -13
- package/bin/chat/types/ChatPluginActionPayload.d.ts.map +1 -1
- package/bin/chat/types/ChatPluginOptions.d.ts +6 -6
- package/bin/chat/types/ChatPluginOptions.d.ts.map +1 -1
- package/bin/chat/types/ChatPluginResource.d.ts +68 -0
- package/bin/chat/types/ChatPluginResource.d.ts.map +1 -0
- package/bin/chat/types/ChatPluginResource.js +10 -0
- package/bin/chat/types/ChatPluginResource.js.map +1 -0
- package/bin/chat/types/ChatPromptContext.d.ts +8 -8
- package/bin/chat/types/ChatPromptContext.d.ts.map +1 -1
- package/bin/chat/types/ChatQueue.d.ts +2 -2
- package/bin/chat/types/ChatQueue.d.ts.map +1 -1
- package/bin/chat/types/ChatQueueWorker.d.ts +3 -3
- package/bin/chat/types/ChatQueueWorker.d.ts.map +1 -1
- package/bin/chat/types/ChatRuntimeAccount.d.ts +39 -0
- package/bin/chat/types/ChatRuntimeAccount.d.ts.map +1 -0
- package/bin/chat/types/ChatRuntimeAccount.js +10 -0
- package/bin/chat/types/ChatRuntimeAccount.js.map +1 -0
- package/bin/chat/types/DirectDispatch.d.ts +13 -13
- package/bin/chat/types/DirectDispatch.d.ts.map +1 -1
- package/bin/chat/types/DirectDispatch.js +1 -1
- package/bin/chat/types/FeishuInboundAttachment.d.ts +1 -1
- package/bin/chat/types/FeishuInboundAttachment.d.ts.map +1 -1
- package/bin/chat/types/QqInboundDedupe.d.ts +1 -1
- package/bin/chat/types/QqInboundDedupe.d.ts.map +1 -1
- package/bin/chat/types/ReplyContext.d.ts +1 -1
- package/bin/chat/types/ReplyContext.d.ts.map +1 -1
- package/bin/chat.d.ts +4 -3
- package/bin/chat.d.ts.map +1 -1
- package/bin/chat.js +2 -2
- package/bin/chat.js.map +1 -1
- package/bin/contact/Action.d.ts +11 -11
- package/bin/contact/Action.d.ts.map +1 -1
- package/bin/contact/Action.js +27 -27
- package/bin/contact/Action.js.map +1 -1
- package/bin/contact/ContactPlugin.js +33 -33
- package/bin/contact/ContactPlugin.js.map +1 -1
- package/bin/contact/runtime/ChatRuntime.d.ts +2 -2
- package/bin/contact/runtime/ChatRuntime.d.ts.map +1 -1
- package/bin/contact/runtime/ChatRuntime.js +8 -23
- 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 +24 -24
- package/bin/contact/runtime/ContactStore.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 +17 -17
- package/bin/contact/runtime/LinkApproval.js.map +1 -1
- package/bin/contact/runtime/LinkCode.d.ts +1 -1
- package/bin/contact/runtime/LinkCode.d.ts.map +1 -1
- package/bin/contact/runtime/LinkCode.js +6 -6
- package/bin/contact/runtime/LinkCode.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 +7 -7
- package/bin/contact/runtime/LinkStore.js.map +1 -1
- package/bin/contact/runtime/Paths.d.ts +14 -14
- package/bin/contact/runtime/Paths.d.ts.map +1 -1
- package/bin/contact/runtime/Paths.js +28 -28
- package/bin/contact/runtime/Paths.js.map +1 -1
- package/bin/contact/runtime/RemoteClient.d.ts +1 -1
- package/bin/contact/runtime/RemoteClient.js +18 -18
- package/bin/contact/runtime/RemoteClient.js.map +1 -1
- package/bin/contact/runtime/ShareBundle.d.ts +3 -3
- package/bin/contact/runtime/ShareBundle.d.ts.map +1 -1
- package/bin/contact/runtime/ShareBundle.js +5 -5
- package/bin/contact/runtime/ShareBundle.js.map +1 -1
- package/bin/contact/types/Contact.d.ts +2 -2
- package/bin/contact/types/Contact.d.ts.map +1 -1
- package/bin/contact/types/ContactApproval.d.ts +2 -2
- package/bin/contact/types/ContactApproval.d.ts.map +1 -1
- package/bin/contact/types/ContactChat.d.ts +1 -1
- package/bin/contact/types/ContactChat.d.ts.map +1 -1
- package/bin/contact/types/ContactLink.d.ts +4 -4
- package/bin/contact/types/ContactLink.d.ts.map +1 -1
- package/bin/image/ImagePlugin.d.ts +3 -3
- package/bin/image/ImagePlugin.d.ts.map +1 -1
- package/bin/image/ImagePlugin.js +25 -10
- package/bin/image/ImagePlugin.js.map +1 -1
- package/bin/image/types/ImagePlugin.d.ts +3 -3
- package/bin/image/types/ImagePlugin.d.ts.map +1 -1
- package/bin/image/types/ImagePlugin.js +1 -1
- package/bin/memory/Action.d.ts +7 -7
- package/bin/memory/Action.d.ts.map +1 -1
- package/bin/memory/Action.js +11 -11
- package/bin/memory/Action.js.map +1 -1
- package/bin/memory/MemoryPlugin.d.ts +3 -3
- package/bin/memory/MemoryPlugin.d.ts.map +1 -1
- package/bin/memory/MemoryPlugin.js +21 -21
- package/bin/memory/MemoryPlugin.js.map +1 -1
- package/bin/memory/runtime/Search.d.ts +3 -3
- package/bin/memory/runtime/Search.d.ts.map +1 -1
- package/bin/memory/runtime/Search.js +2 -2
- package/bin/memory/runtime/Search.js.map +1 -1
- package/bin/memory/runtime/Store.d.ts +2 -2
- package/bin/memory/runtime/Store.d.ts.map +1 -1
- package/bin/memory/runtime/Store.js +1 -1
- package/bin/memory/runtime/Store.js.map +1 -1
- package/bin/memory/runtime/SystemProvider.d.ts +3 -3
- package/bin/memory/runtime/SystemProvider.d.ts.map +1 -1
- package/bin/memory/runtime/SystemProvider.js +1 -1
- package/bin/memory/runtime/SystemProvider.js.map +1 -1
- package/bin/memory/runtime/Writer.d.ts +8 -8
- package/bin/memory/runtime/Writer.d.ts.map +1 -1
- package/bin/memory/runtime/Writer.js +14 -14
- package/bin/memory/runtime/Writer.js.map +1 -1
- package/bin/memory/types/Memory.d.ts +3 -3
- package/bin/memory/types/Memory.d.ts.map +1 -1
- package/bin/skill/Action.d.ts +4 -4
- package/bin/skill/Action.d.ts.map +1 -1
- package/bin/skill/Action.js +9 -9
- package/bin/skill/Action.js.map +1 -1
- package/bin/skill/Plugin.js +16 -16
- package/bin/skill/Plugin.js.map +1 -1
- package/bin/skill/runtime/Discovery.d.ts +2 -2
- package/bin/skill/runtime/Discovery.d.ts.map +1 -1
- package/bin/skill/runtime/Discovery.js +3 -3
- package/bin/skill/runtime/Discovery.js.map +1 -1
- package/bin/skill/runtime/Paths.d.ts +1 -1
- package/bin/skill/runtime/Paths.d.ts.map +1 -1
- package/bin/skill/runtime/Paths.js +6 -6
- package/bin/skill/runtime/Paths.js.map +1 -1
- package/bin/skill/runtime/Store.d.ts +3 -3
- package/bin/skill/runtime/Store.d.ts.map +1 -1
- package/bin/skill/runtime/Store.js +19 -19
- package/bin/skill/runtime/Store.js.map +1 -1
- package/bin/skill/runtime/SystemProvider.d.ts +2 -2
- package/bin/skill/runtime/SystemProvider.d.ts.map +1 -1
- package/bin/skill/runtime/SystemProvider.js +4 -4
- package/bin/skill/runtime/SystemProvider.js.map +1 -1
- package/bin/skill/runtime/Types.d.ts +3 -3
- package/bin/skill/runtime/Types.d.ts.map +1 -1
- package/bin/sound/Plugin.d.ts +5 -5
- package/bin/sound/Plugin.d.ts.map +1 -1
- package/bin/sound/Plugin.js +23 -11
- package/bin/sound/Plugin.js.map +1 -1
- package/bin/task/Action.d.ts +10 -10
- package/bin/task/Action.d.ts.map +1 -1
- package/bin/task/Action.js +31 -31
- 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.d.ts +2 -2
- package/bin/task/Scheduler.d.ts.map +1 -1
- package/bin/task/Scheduler.js +8 -8
- package/bin/task/Scheduler.js.map +1 -1
- package/bin/task/TaskPlugin.d.ts +3 -3
- package/bin/task/TaskPlugin.d.ts.map +1 -1
- package/bin/task/TaskPlugin.js +23 -20
- package/bin/task/TaskPlugin.js.map +1 -1
- package/bin/task/runtime/Model.d.ts +2 -2
- package/bin/task/runtime/Model.d.ts.map +1 -1
- package/bin/task/runtime/Model.js +11 -11
- package/bin/task/runtime/Model.js.map +1 -1
- package/bin/task/runtime/Paths.d.ts +6 -6
- 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 +4 -4
- package/bin/task/runtime/Runner.d.ts.map +1 -1
- package/bin/task/runtime/Runner.js +17 -17
- package/bin/task/runtime/Runner.js.map +1 -1
- package/bin/task/runtime/Store.d.ts +7 -7
- package/bin/task/runtime/Store.d.ts.map +1 -1
- package/bin/task/runtime/Store.js +15 -15
- package/bin/task/runtime/Store.js.map +1 -1
- package/bin/task/runtime/TaskActionExecution.d.ts +12 -12
- package/bin/task/runtime/TaskActionExecution.d.ts.map +1 -1
- package/bin/task/runtime/TaskActionExecution.js +7 -7
- package/bin/task/runtime/TaskActionExecution.js.map +1 -1
- package/bin/task/runtime/TaskActionInput.js +10 -10
- package/bin/task/runtime/TaskActionInput.js.map +1 -1
- package/bin/task/runtime/TaskPluginActionRegistry.js +26 -26
- package/bin/task/runtime/TaskPluginActionRegistry.js.map +1 -1
- package/bin/task/runtime/TaskRunArtifacts.js +4 -4
- package/bin/task/runtime/TaskRunArtifacts.js.map +1 -1
- package/bin/task/runtime/TaskRunChatDispatch.d.ts +2 -2
- package/bin/task/runtime/TaskRunChatDispatch.d.ts.map +1 -1
- package/bin/task/runtime/TaskRunChatDispatch.js +7 -7
- package/bin/task/runtime/TaskRunChatDispatch.js.map +1 -1
- package/bin/task/runtime/TaskRunnerProgress.js +1 -1
- package/bin/task/runtime/TaskRunnerProgress.js.map +1 -1
- package/bin/task/runtime/TaskRunnerRound.d.ts +7 -7
- package/bin/task/runtime/TaskRunnerRound.d.ts.map +1 -1
- package/bin/task/runtime/TaskRunnerRound.js +34 -38
- package/bin/task/runtime/TaskRunnerRound.js.map +1 -1
- package/bin/task/runtime/TaskRunnerScript.d.ts +4 -4
- package/bin/task/runtime/TaskRunnerScript.d.ts.map +1 -1
- package/bin/task/runtime/TaskRunnerScript.js +1 -1
- package/bin/task/runtime/TaskRunnerScript.js.map +1 -1
- package/bin/task/runtime/TaskRunnerSession.d.ts +8 -8
- package/bin/task/runtime/TaskRunnerSession.d.ts.map +1 -1
- package/bin/task/runtime/TaskRunnerSession.js +52 -39
- package/bin/task/runtime/TaskRunnerSession.js.map +1 -1
- package/bin/task/runtime/TaskRunnerTypes.d.ts +5 -5
- package/bin/task/runtime/TaskRunnerTypes.d.ts.map +1 -1
- package/bin/task/types/Task.d.ts +4 -4
- package/bin/task/types/Task.d.ts.map +1 -1
- package/bin/task/types/TaskCommand.d.ts +3 -3
- package/bin/task/types/TaskCommand.d.ts.map +1 -1
- package/bin/web/Plugin.d.ts +2 -2
- package/bin/web/Plugin.d.ts.map +1 -1
- package/bin/web/Plugin.js +3 -3
- package/bin/web/Plugin.js.map +1 -1
- package/bin/workboard/Plugin.d.ts.map +1 -1
- package/bin/workboard/Plugin.js +6 -7
- package/bin/workboard/Plugin.js.map +1 -1
- package/bin/workboard/runtime/Collector.d.ts +2 -2
- package/bin/workboard/runtime/Collector.d.ts.map +1 -1
- package/bin/workboard/runtime/Collector.js +4 -4
- package/bin/workboard/runtime/Collector.js.map +1 -1
- package/bin/workboard/runtime/Normalizer.d.ts +3 -3
- package/bin/workboard/runtime/Normalizer.d.ts.map +1 -1
- package/bin/workboard/runtime/Normalizer.js +11 -11
- package/bin/workboard/runtime/Normalizer.js.map +1 -1
- package/bin/workboard/runtime/SessionSummary.d.ts +5 -5
- package/bin/workboard/runtime/SessionSummary.d.ts.map +1 -1
- package/bin/workboard/runtime/SessionSummary.js +4 -4
- package/bin/workboard/runtime/SessionSummary.js.map +1 -1
- package/bin/workboard/runtime/Store.d.ts +5 -5
- package/bin/workboard/runtime/Store.d.ts.map +1 -1
- package/bin/workboard/runtime/Store.js.map +1 -1
- package/bin/workboard/types/Workboard.d.ts +2 -2
- package/bin/workboard/types/Workboard.d.ts.map +1 -1
- package/bin/workboard/types/Workboard.js +1 -1
- package/package.json +3 -3
- package/scripts/chat-access.test.mjs +2 -2
- package/scripts/chat-channel-config.test.mjs +25 -3
- package/scripts/chat-storage.test.mjs +7 -7
- package/scripts/skill-plugin.test.mjs +4 -4
- package/scripts/sound-plugin.test.mjs +12 -8
- package/scripts/web-plugin.test.mjs +4 -4
- package/src/chat/Action.ts +154 -153
- package/src/chat/ChatPlugin.ts +12 -12
- package/src/chat/Index.ts +12 -0
- package/src/chat/PROMPT.direct.ts +1 -1
- package/src/chat/access/ChatAccessActions.ts +6 -6
- package/src/chat/access/ChatAccessRuntime.ts +5 -5
- package/src/chat/access/ChatAccessStore.ts +5 -5
- package/src/chat/channels/BaseChatChannel.ts +32 -32
- package/src/chat/channels/BaseChatChannelQueue.ts +38 -38
- package/src/chat/channels/BaseChatChannelSupport.ts +25 -25
- package/src/chat/channels/RuntimeChannel.ts +53 -74
- package/src/chat/channels/feishu/Feishu.ts +35 -35
- package/src/chat/channels/feishu/FeishuInbound.ts +3 -3
- package/src/chat/channels/feishu/FeishuMessageHandler.ts +29 -29
- package/src/chat/channels/feishu/FeishuPlatformClient.ts +15 -15
- package/src/chat/channels/feishu/FeishuPlatformLookup.ts +7 -7
- package/src/chat/channels/feishu/FeishuPlatformMessaging.ts +7 -7
- package/src/chat/channels/feishu/InboundAttachment.ts +6 -6
- package/src/chat/channels/feishu/PostMessage.ts +8 -8
- package/src/chat/channels/feishu/ReplyContext.ts +3 -3
- package/src/chat/channels/feishu/Shared.ts +3 -3
- package/src/chat/channels/qq/PROMPT.direct.ts +1 -1
- package/src/chat/channels/qq/QQ.ts +26 -26
- package/src/chat/channels/qq/QQEventCapture.ts +3 -3
- package/src/chat/channels/qq/QQGatewayAuth.ts +1 -1
- package/src/chat/channels/qq/QQGatewayClient.ts +12 -12
- package/src/chat/channels/qq/QQGatewayConnection.ts +1 -1
- package/src/chat/channels/qq/QQGatewaySend.ts +6 -6
- package/src/chat/channels/qq/QQInbound.ts +5 -5
- package/src/chat/channels/qq/QQInboundDedupe.ts +6 -6
- package/src/chat/channels/qq/QQMessageHandler.ts +43 -43
- package/src/chat/channels/qq/QQSendSupport.ts +2 -2
- package/src/chat/channels/qq/QQSupport.ts +10 -10
- package/src/chat/channels/qq/types/QqChannel.ts +1 -1
- package/src/chat/channels/telegram/ApiClient.ts +7 -7
- package/src/chat/channels/telegram/Bot.ts +17 -17
- package/src/chat/channels/telegram/BotInfo.ts +1 -1
- package/src/chat/channels/telegram/ReplyContext.ts +3 -3
- package/src/chat/channels/telegram/Shared.ts +3 -3
- package/src/chat/channels/telegram/StateStore.ts +2 -2
- package/src/chat/channels/telegram/TelegramInbound.ts +4 -4
- package/src/chat/channels/telegram/TelegramMessageHandler.ts +35 -35
- package/src/chat/channels/telegram/TelegramPendingUpdates.ts +9 -9
- package/src/chat/channels/telegram/TelegramPlatformClient.ts +11 -11
- package/src/chat/config/ChatPluginConfig.ts +266 -0
- package/src/chat/runtime/ChannelContextStore.ts +88 -88
- package/src/chat/runtime/ChatActionExecution.ts +87 -87
- package/src/chat/runtime/ChatActionInput.ts +19 -19
- package/src/chat/runtime/ChatChannelActions.ts +4 -4
- package/src/chat/runtime/ChatChannelConfig.ts +14 -14
- package/src/chat/runtime/ChatChannelCore.ts +17 -26
- package/src/chat/runtime/ChatChannelLifecycle.ts +12 -12
- package/src/chat/runtime/ChatHistoryStore.ts +39 -39
- package/src/chat/runtime/ChatIngressStore.ts +6 -6
- package/src/chat/runtime/ChatMetaStore.ts +37 -37
- package/src/chat/runtime/ChatPluginActionRegistry.ts +56 -62
- package/src/chat/runtime/ChatPluginSystem.ts +9 -9
- package/src/chat/runtime/ChatQueueReplyDispatch.ts +47 -47
- package/src/chat/runtime/ChatQueueStore.ts +4 -4
- package/src/chat/runtime/ChatQueueWorker.ts +38 -44
- package/src/chat/runtime/ChatQueueWorkerSupport.ts +18 -18
- package/src/chat/runtime/ChatSendActionInput.ts +53 -53
- package/src/chat/runtime/ChatSendMetadata.ts +15 -15
- package/src/chat/runtime/ChatSendRegistry.ts +1 -1
- package/src/chat/runtime/ChatSessionDelete.ts +19 -19
- package/src/chat/runtime/ChatStorage.ts +3 -3
- package/src/chat/runtime/ChatkeySend.ts +43 -43
- package/src/chat/runtime/DirectDispatchParser.ts +21 -21
- package/src/chat/runtime/EnqueueDispatch.ts +3 -3
- package/src/chat/runtime/InboundAugment.ts +8 -8
- package/src/chat/runtime/QueuedUserMessage.ts +6 -6
- package/src/chat/runtime/ReplyContextFormatter.ts +6 -6
- package/src/chat/runtime/ReplyDispatch.ts +9 -9
- package/src/chat/runtime/SystemPrompt.ts +14 -14
- package/src/chat/types/ChannelContext.ts +11 -11
- package/src/chat/types/ChatCommand.ts +31 -31
- package/src/chat/types/ChatDispatcher.ts +3 -3
- package/src/chat/types/ChatHistory.ts +2 -2
- package/src/chat/types/ChatMeta.ts +4 -4
- package/src/chat/types/ChatPlugin.ts +9 -9
- package/src/chat/types/ChatPluginActionPayload.ts +13 -13
- package/src/chat/types/ChatPluginOptions.ts +6 -6
- package/src/chat/types/ChatPluginResource.ts +95 -0
- package/src/chat/types/ChatPromptContext.ts +8 -8
- package/src/chat/types/ChatQueue.ts +2 -2
- package/src/chat/types/ChatQueueWorker.ts +3 -3
- package/src/chat/types/ChatRuntimeAccount.ts +52 -0
- package/src/chat/types/DirectDispatch.ts +13 -13
- package/src/chat/types/FeishuInboundAttachment.ts +1 -1
- package/src/chat/types/QqInboundDedupe.ts +1 -1
- package/src/chat/types/ReplyContext.ts +1 -1
- package/src/chat.ts +13 -3
- package/src/contact/Action.ts +40 -40
- package/src/contact/ContactPlugin.ts +49 -49
- package/src/contact/runtime/ChatRuntime.ts +10 -26
- package/src/contact/runtime/ContactStore.ts +24 -24
- package/src/contact/runtime/InboxStore.ts +16 -16
- package/src/contact/runtime/LinkApproval.ts +19 -19
- package/src/contact/runtime/LinkCode.ts +7 -7
- package/src/contact/runtime/LinkStore.ts +7 -7
- package/src/contact/runtime/Paths.ts +28 -28
- package/src/contact/runtime/RemoteClient.ts +19 -19
- package/src/contact/runtime/ShareBundle.ts +8 -8
- package/src/contact/types/Contact.ts +2 -2
- package/src/contact/types/ContactApproval.ts +2 -2
- package/src/contact/types/ContactChat.ts +1 -1
- package/src/contact/types/ContactLink.ts +4 -4
- package/src/image/ImagePlugin.ts +32 -16
- package/src/image/types/ImagePlugin.ts +3 -3
- package/src/memory/Action.ts +18 -18
- package/src/memory/MemoryPlugin.ts +25 -25
- package/src/memory/runtime/Search.ts +6 -6
- package/src/memory/runtime/Store.ts +3 -3
- package/src/memory/runtime/SystemProvider.ts +4 -4
- package/src/memory/runtime/Writer.ts +24 -24
- package/src/memory/types/Memory.ts +3 -3
- package/src/skill/Action.ts +10 -10
- package/src/skill/Plugin.ts +16 -16
- package/src/skill/runtime/Discovery.ts +3 -3
- package/src/skill/runtime/Paths.ts +6 -6
- package/src/skill/runtime/Store.ts +19 -19
- package/src/skill/runtime/SystemProvider.ts +5 -5
- package/src/skill/runtime/Types.ts +3 -3
- package/src/sound/Plugin.ts +31 -18
- package/src/task/Action.ts +40 -40
- package/src/task/PROMPT.ts +1 -1
- package/src/task/Scheduler.ts +10 -10
- package/src/task/TaskPlugin.ts +32 -30
- package/src/task/runtime/Model.ts +12 -12
- package/src/task/runtime/Paths.ts +11 -11
- package/src/task/runtime/Runner.ts +21 -21
- package/src/task/runtime/Store.ts +21 -21
- package/src/task/runtime/TaskActionExecution.ts +19 -19
- package/src/task/runtime/TaskActionInput.ts +10 -10
- package/src/task/runtime/TaskPluginActionRegistry.ts +27 -27
- package/src/task/runtime/TaskRunArtifacts.ts +4 -4
- package/src/task/runtime/TaskRunChatDispatch.ts +9 -9
- package/src/task/runtime/TaskRunnerProgress.ts +1 -1
- package/src/task/runtime/TaskRunnerRound.ts +47 -42
- package/src/task/runtime/TaskRunnerScript.ts +5 -5
- package/src/task/runtime/TaskRunnerSession.ts +58 -46
- package/src/task/runtime/TaskRunnerTypes.ts +5 -5
- package/src/task/types/Task.ts +4 -4
- package/src/task/types/TaskCommand.ts +3 -3
- package/src/web/Plugin.ts +5 -5
- package/src/workboard/Plugin.ts +8 -9
- package/src/workboard/runtime/Collector.ts +6 -6
- package/src/workboard/runtime/Normalizer.ts +14 -14
- package/src/workboard/runtime/SessionSummary.ts +9 -9
- package/src/workboard/runtime/Store.ts +6 -6
- package/src/workboard/types/Workboard.ts +2 -2
- package/bin/chat/accounts/ChannelAccountManager.d.ts +0 -61
- package/bin/chat/accounts/ChannelAccountManager.d.ts.map +0 -1
- package/bin/chat/accounts/ChannelAccountManager.js +0 -264
- package/bin/chat/accounts/ChannelAccountManager.js.map +0 -1
- package/bin/chat/accounts/Crypto.d.ts +0 -20
- package/bin/chat/accounts/Crypto.d.ts.map +0 -1
- package/bin/chat/accounts/Crypto.js +0 -75
- package/bin/chat/accounts/Crypto.js.map +0 -1
- package/bin/chat/accounts/Store.d.ts +0 -38
- package/bin/chat/accounts/Store.d.ts.map +0 -1
- package/bin/chat/accounts/Store.js +0 -220
- package/bin/chat/accounts/Store.js.map +0 -1
- package/bin/chat/channels/Configuration.d.ts +0 -27
- package/bin/chat/channels/Configuration.d.ts.map +0 -1
- package/bin/chat/channels/Configuration.js +0 -19
- package/bin/chat/channels/Configuration.js.map +0 -1
- package/bin/chat/channels/ConfigurationRegistry.d.ts +0 -18
- package/bin/chat/channels/ConfigurationRegistry.d.ts.map +0 -1
- package/bin/chat/channels/ConfigurationRegistry.js +0 -31
- package/bin/chat/channels/ConfigurationRegistry.js.map +0 -1
- package/bin/chat/channels/feishu/Configuration.d.ts +0 -17
- package/bin/chat/channels/feishu/Configuration.d.ts.map +0 -1
- package/bin/chat/channels/feishu/Configuration.js +0 -59
- package/bin/chat/channels/feishu/Configuration.js.map +0 -1
- package/bin/chat/channels/qq/Configuration.d.ts +0 -17
- package/bin/chat/channels/qq/Configuration.d.ts.map +0 -1
- package/bin/chat/channels/qq/Configuration.js +0 -59
- package/bin/chat/channels/qq/Configuration.js.map +0 -1
- package/bin/chat/channels/telegram/Configuration.d.ts +0 -17
- package/bin/chat/channels/telegram/Configuration.d.ts.map +0 -1
- package/bin/chat/channels/telegram/Configuration.js +0 -59
- package/bin/chat/channels/telegram/Configuration.js.map +0 -1
- package/bin/chat/types/ChannelAccount.d.ts +0 -226
- package/bin/chat/types/ChannelAccount.d.ts.map +0 -1
- package/bin/chat/types/ChannelAccount.js +0 -9
- package/bin/chat/types/ChannelAccount.js.map +0 -1
- package/bin/chat/types/ChannelConfiguration.d.ts +0 -146
- package/bin/chat/types/ChannelConfiguration.d.ts.map +0 -1
- package/bin/chat/types/ChannelConfiguration.js +0 -9
- package/bin/chat/types/ChannelConfiguration.js.map +0 -1
- package/src/chat/accounts/ChannelAccountManager.ts +0 -314
- package/src/chat/accounts/Crypto.ts +0 -83
- package/src/chat/accounts/Store.ts +0 -287
- package/src/chat/channels/Configuration.ts +0 -35
- package/src/chat/channels/ConfigurationRegistry.ts +0 -43
- package/src/chat/channels/feishu/Configuration.ts +0 -65
- package/src/chat/channels/qq/Configuration.ts +0 -64
- package/src/chat/channels/telegram/Configuration.ts +0 -65
- package/src/chat/types/ChannelAccount.ts +0 -232
- package/src/chat/types/ChannelConfiguration.ts +0 -160
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
|
|
10
10
|
import path from "node:path";
|
|
11
11
|
import type { JsonObject } from "@downcity/agent";
|
|
12
|
-
import type {
|
|
13
|
-
import type {
|
|
12
|
+
import type { PluginContext } from "@downcity/agent";
|
|
13
|
+
import type { PluginExecutionContext } from "@downcity/agent";
|
|
14
14
|
import type {
|
|
15
15
|
ChatDeleteActionPayload,
|
|
16
16
|
ChatHistoryActionPayload,
|
|
@@ -45,21 +45,21 @@ import {
|
|
|
45
45
|
* 执行 `chat.history_clear` action。
|
|
46
46
|
*/
|
|
47
47
|
export async function execute_chat_history_clear_action(params: {
|
|
48
|
-
context:
|
|
48
|
+
context: PluginContext;
|
|
49
49
|
payload: ChatHistoryClearActionPayload;
|
|
50
50
|
}) {
|
|
51
|
-
const session_id = String(params.payload.
|
|
51
|
+
const session_id = String(params.payload.session_id || "").trim();
|
|
52
52
|
if (!session_id) {
|
|
53
53
|
return {
|
|
54
54
|
success: false,
|
|
55
|
-
error: "Missing
|
|
55
|
+
error: "Missing session_id",
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
-
const cleared = await clear_chat_history(params.context.
|
|
58
|
+
const cleared = await clear_chat_history(params.context.workspace_path, session_id);
|
|
59
59
|
return {
|
|
60
60
|
success: true,
|
|
61
61
|
data: {
|
|
62
|
-
|
|
62
|
+
session_id: session_id,
|
|
63
63
|
cleared,
|
|
64
64
|
},
|
|
65
65
|
};
|
|
@@ -76,15 +76,15 @@ function toChatHistoryView(events: ChatHistoryEventV1[]): JsonObject[] {
|
|
|
76
76
|
* 执行 `chat.context` action。
|
|
77
77
|
*/
|
|
78
78
|
export async function executeChatContextAction(params: {
|
|
79
|
-
context:
|
|
79
|
+
context: PluginContext;
|
|
80
80
|
payload: ChatSessionActionPayload;
|
|
81
|
-
|
|
81
|
+
execution_context?: PluginExecutionContext;
|
|
82
82
|
}) {
|
|
83
83
|
const snapshot = resolveChatSessionSnapshot({
|
|
84
84
|
context: params.context,
|
|
85
|
-
|
|
86
|
-
...(params.payload.
|
|
87
|
-
...(params.payload.
|
|
85
|
+
execution_context: params.execution_context,
|
|
86
|
+
...(params.payload.chat_key ? { chat_key: params.payload.chat_key } : {}),
|
|
87
|
+
...(params.payload.session_id ? { session_id: params.payload.session_id } : {}),
|
|
88
88
|
});
|
|
89
89
|
return {
|
|
90
90
|
success: true,
|
|
@@ -98,7 +98,7 @@ export async function executeChatContextAction(params: {
|
|
|
98
98
|
* 执行 `chat.list` action。
|
|
99
99
|
*/
|
|
100
100
|
export async function executeChatListAction(params: {
|
|
101
|
-
context:
|
|
101
|
+
context: PluginContext;
|
|
102
102
|
payload: ChatListActionPayload;
|
|
103
103
|
}) {
|
|
104
104
|
const rawChannel = String(params.payload.channel || "").trim();
|
|
@@ -124,7 +124,7 @@ export async function executeChatListAction(params: {
|
|
|
124
124
|
.filter((route) => {
|
|
125
125
|
if (!qLower) return true;
|
|
126
126
|
return (
|
|
127
|
-
matches(route.
|
|
127
|
+
matches(route.session_id) ||
|
|
128
128
|
matches(route.chatId) ||
|
|
129
129
|
matches(route.chatTitle) ||
|
|
130
130
|
matches(route.actorName) ||
|
|
@@ -135,8 +135,8 @@ export async function executeChatListAction(params: {
|
|
|
135
135
|
|
|
136
136
|
const total = filtered.length;
|
|
137
137
|
const chats: ChatListItemV1[] = filtered.slice(0, limit).map((route) => ({
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
chat_key: route.session_id,
|
|
139
|
+
session_id: route.session_id,
|
|
140
140
|
channel: route.channel,
|
|
141
141
|
chatId: route.chatId,
|
|
142
142
|
...(route.targetType ? { targetType: route.targetType } : {}),
|
|
@@ -144,15 +144,15 @@ export async function executeChatListAction(params: {
|
|
|
144
144
|
...(route.chatTitle ? { chatTitle: route.chatTitle } : {}),
|
|
145
145
|
...(route.actorName ? { actorName: route.actorName } : {}),
|
|
146
146
|
...(route.actorId ? { actorId: route.actorId } : {}),
|
|
147
|
-
|
|
148
|
-
isoUpdatedAt: new Date(route.
|
|
147
|
+
updated_at: route.updated_at,
|
|
148
|
+
isoUpdatedAt: new Date(route.updated_at).toISOString(),
|
|
149
149
|
}));
|
|
150
150
|
|
|
151
151
|
return {
|
|
152
152
|
success: true,
|
|
153
153
|
data: {
|
|
154
|
-
metaUpdatedAt: meta.
|
|
155
|
-
metaIsoUpdatedAt: new Date(meta.
|
|
154
|
+
metaUpdatedAt: meta.updated_at,
|
|
155
|
+
metaIsoUpdatedAt: new Date(meta.updated_at).toISOString(),
|
|
156
156
|
total,
|
|
157
157
|
count: chats.length,
|
|
158
158
|
chats,
|
|
@@ -164,55 +164,55 @@ export async function executeChatListAction(params: {
|
|
|
164
164
|
* 执行 `chat.info` action。
|
|
165
165
|
*/
|
|
166
166
|
export async function executeChatInfoAction(params: {
|
|
167
|
-
context:
|
|
167
|
+
context: PluginContext;
|
|
168
168
|
payload: ChatInfoActionPayload;
|
|
169
|
-
|
|
169
|
+
execution_context?: PluginExecutionContext;
|
|
170
170
|
}) {
|
|
171
|
-
const explicitSessionId = String(params.payload.
|
|
172
|
-
const explicitChatKey = String(params.payload.
|
|
171
|
+
const explicitSessionId = String(params.payload.session_id || "").trim();
|
|
172
|
+
const explicitChatKey = String(params.payload.chat_key || "").trim();
|
|
173
173
|
const snapshot = resolveChatSessionSnapshot({
|
|
174
174
|
context: params.context,
|
|
175
|
-
|
|
176
|
-
...(explicitSessionId ? {
|
|
177
|
-
...(explicitChatKey ? {
|
|
175
|
+
execution_context: params.execution_context,
|
|
176
|
+
...(explicitSessionId ? { session_id: explicitSessionId } : {}),
|
|
177
|
+
...(explicitChatKey ? { chat_key: explicitChatKey } : {}),
|
|
178
178
|
});
|
|
179
179
|
|
|
180
|
-
const
|
|
181
|
-
const
|
|
182
|
-
if (!
|
|
180
|
+
const session_id = String(explicitSessionId || snapshot.session_id || "").trim();
|
|
181
|
+
const chat_key = String(explicitChatKey || snapshot.chat_key || session_id || "").trim();
|
|
182
|
+
if (!session_id) {
|
|
183
183
|
return {
|
|
184
184
|
success: false,
|
|
185
185
|
error:
|
|
186
|
-
"Missing
|
|
186
|
+
"Missing session_id. Provide --session-id/--chat-key or ensure DC_SESSION_ID/DC_CTX_CHAT_KEY is injected.",
|
|
187
187
|
};
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
const route = await readChatMetaBySessionId({
|
|
191
191
|
context: params.context,
|
|
192
|
-
|
|
192
|
+
session_id,
|
|
193
193
|
});
|
|
194
194
|
|
|
195
195
|
const toPosixRelativePath = (absPath: string): string =>
|
|
196
|
-
path.relative(params.context.
|
|
196
|
+
path.relative(params.context.workspace_path, absPath).split(path.sep).join("/");
|
|
197
197
|
|
|
198
198
|
const channelMetaPath = toPosixRelativePath(
|
|
199
|
-
get_chat_channel_meta_path(params.context.
|
|
199
|
+
get_chat_channel_meta_path(params.context.workspace_path),
|
|
200
200
|
);
|
|
201
201
|
const chatDirPath = toPosixRelativePath(
|
|
202
|
-
get_chat_session_dir_path(params.context.
|
|
202
|
+
get_chat_session_dir_path(params.context.workspace_path, session_id),
|
|
203
203
|
);
|
|
204
204
|
const historyPath = toPosixRelativePath(
|
|
205
|
-
get_chat_history_path(params.context.
|
|
205
|
+
get_chat_history_path(params.context.workspace_path, session_id),
|
|
206
206
|
);
|
|
207
207
|
|
|
208
208
|
return {
|
|
209
209
|
success: true,
|
|
210
210
|
data: {
|
|
211
|
-
|
|
212
|
-
|
|
211
|
+
session_id,
|
|
212
|
+
chat_key,
|
|
213
213
|
context: snapshot,
|
|
214
214
|
route,
|
|
215
|
-
...(route ? { routeIsoUpdatedAt: new Date(route.
|
|
215
|
+
...(route ? { routeIsoUpdatedAt: new Date(route.updated_at).toISOString() } : {}),
|
|
216
216
|
paths: {
|
|
217
217
|
channelMetaPath,
|
|
218
218
|
chatDirPath,
|
|
@@ -226,40 +226,40 @@ export async function executeChatInfoAction(params: {
|
|
|
226
226
|
* 执行 `chat.history` action。
|
|
227
227
|
*/
|
|
228
228
|
export async function executeChatHistoryAction(params: {
|
|
229
|
-
context:
|
|
229
|
+
context: PluginContext;
|
|
230
230
|
payload: ChatHistoryActionPayload;
|
|
231
|
-
|
|
231
|
+
execution_context?: PluginExecutionContext;
|
|
232
232
|
}) {
|
|
233
233
|
const payload = params.payload;
|
|
234
234
|
const snapshot = resolveChatSessionSnapshot({
|
|
235
235
|
context: params.context,
|
|
236
|
-
|
|
237
|
-
...(payload.
|
|
238
|
-
...(payload.
|
|
236
|
+
execution_context: params.execution_context,
|
|
237
|
+
...(payload.chat_key ? { chat_key: payload.chat_key } : {}),
|
|
238
|
+
...(payload.session_id ? { session_id: payload.session_id } : {}),
|
|
239
239
|
});
|
|
240
|
-
const explicitSessionId = String(payload.
|
|
241
|
-
const explicitChatKey = String(payload.
|
|
242
|
-
const
|
|
243
|
-
explicitSessionId || explicitChatKey || snapshot.
|
|
240
|
+
const explicitSessionId = String(payload.session_id || "").trim();
|
|
241
|
+
const explicitChatKey = String(payload.chat_key || "").trim();
|
|
242
|
+
const session_id = String(
|
|
243
|
+
explicitSessionId || explicitChatKey || snapshot.session_id || "",
|
|
244
244
|
).trim();
|
|
245
|
-
if (!
|
|
245
|
+
if (!session_id) {
|
|
246
246
|
return {
|
|
247
247
|
success: false,
|
|
248
248
|
error:
|
|
249
|
-
"Missing
|
|
249
|
+
"Missing session_id. Provide --session-id/--chat-key or ensure DC_SESSION_ID is injected.",
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
const historyResult = await readChatHistory({
|
|
254
254
|
context: params.context,
|
|
255
|
-
|
|
255
|
+
session_id,
|
|
256
256
|
limit: payload.limit,
|
|
257
257
|
direction: payload.direction || "all",
|
|
258
258
|
beforeTs: payload.beforeTs,
|
|
259
259
|
afterTs: payload.afterTs,
|
|
260
260
|
});
|
|
261
261
|
const historyPath = historyResult.historyPath
|
|
262
|
-
.replace(`${params.context.
|
|
262
|
+
.replace(`${params.context.workspace_path}/`, "")
|
|
263
263
|
.split("\\")
|
|
264
264
|
.join("/");
|
|
265
265
|
|
|
@@ -278,39 +278,39 @@ export async function executeChatHistoryAction(params: {
|
|
|
278
278
|
* 执行 `chat.send` action。
|
|
279
279
|
*/
|
|
280
280
|
export async function executeChatSendAction(params: {
|
|
281
|
-
context:
|
|
281
|
+
context: PluginContext;
|
|
282
282
|
payload: ChatSendActionPayload;
|
|
283
|
-
|
|
283
|
+
execution_context?: PluginExecutionContext;
|
|
284
284
|
}) {
|
|
285
|
-
const
|
|
286
|
-
|
|
285
|
+
const chat_key = resolveChatKey({
|
|
286
|
+
chat_key: params.payload.chat_key,
|
|
287
287
|
context: params.context,
|
|
288
|
-
|
|
288
|
+
execution_context: params.execution_context,
|
|
289
289
|
});
|
|
290
|
-
if (!
|
|
290
|
+
if (!chat_key) {
|
|
291
291
|
return {
|
|
292
292
|
success: false,
|
|
293
|
-
error: "Missing
|
|
293
|
+
error: "Missing chat_key",
|
|
294
294
|
};
|
|
295
295
|
}
|
|
296
296
|
|
|
297
297
|
const shouldScheduleInBackground =
|
|
298
|
-
typeof params.payload.
|
|
299
|
-
typeof params.payload.
|
|
298
|
+
typeof params.payload.delay_ms === "number" ||
|
|
299
|
+
typeof params.payload.send_at_ms === "number";
|
|
300
300
|
const result = await sendChatTextByChatKey({
|
|
301
301
|
context: params.context,
|
|
302
|
-
|
|
302
|
+
chat_key,
|
|
303
303
|
text: String(params.payload.text || ""),
|
|
304
|
-
|
|
305
|
-
|
|
304
|
+
delay_ms: params.payload.delay_ms,
|
|
305
|
+
send_at_ms: params.payload.send_at_ms,
|
|
306
306
|
// 关键点(中文):plugin runtime action 面向 CLI/API,定时或延迟发送应立即返回,
|
|
307
307
|
// 由 runtime 在后台内存中继续等待并到点投递,避免 HTTP 请求长时间挂起。
|
|
308
308
|
...(shouldScheduleInBackground ? { nonBlockingDelay: true } : {}),
|
|
309
|
-
|
|
310
|
-
...(typeof params.payload.
|
|
311
|
-
? {
|
|
309
|
+
reply_to_message: params.payload.reply_to_message === true,
|
|
310
|
+
...(typeof params.payload.message_id === "string" && params.payload.message_id.trim()
|
|
311
|
+
? { message_id: params.payload.message_id.trim() }
|
|
312
312
|
: {}),
|
|
313
|
-
|
|
313
|
+
execution_context: params.execution_context,
|
|
314
314
|
});
|
|
315
315
|
if (!result.success) {
|
|
316
316
|
return {
|
|
@@ -321,7 +321,7 @@ export async function executeChatSendAction(params: {
|
|
|
321
321
|
return {
|
|
322
322
|
success: true,
|
|
323
323
|
data: {
|
|
324
|
-
|
|
324
|
+
chat_key: result.chat_key || chat_key,
|
|
325
325
|
},
|
|
326
326
|
};
|
|
327
327
|
}
|
|
@@ -330,28 +330,28 @@ export async function executeChatSendAction(params: {
|
|
|
330
330
|
* 执行 `chat.react` action。
|
|
331
331
|
*/
|
|
332
332
|
export async function executeChatReactAction(params: {
|
|
333
|
-
context:
|
|
333
|
+
context: PluginContext;
|
|
334
334
|
payload: ChatReactActionPayload;
|
|
335
|
-
|
|
335
|
+
execution_context?: PluginExecutionContext;
|
|
336
336
|
}) {
|
|
337
|
-
const
|
|
338
|
-
|
|
337
|
+
const chat_key = resolveChatKey({
|
|
338
|
+
chat_key: params.payload.chat_key,
|
|
339
339
|
context: params.context,
|
|
340
|
-
|
|
340
|
+
execution_context: params.execution_context,
|
|
341
341
|
});
|
|
342
|
-
if (!
|
|
342
|
+
if (!chat_key) {
|
|
343
343
|
return {
|
|
344
344
|
success: false,
|
|
345
|
-
error: "Missing
|
|
345
|
+
error: "Missing chat_key",
|
|
346
346
|
};
|
|
347
347
|
}
|
|
348
348
|
|
|
349
|
-
const
|
|
349
|
+
const message_id = String(params.payload.message_id || "").trim() || undefined;
|
|
350
350
|
const result = await sendChatActionByChatKey({
|
|
351
351
|
context: params.context,
|
|
352
|
-
|
|
352
|
+
chat_key,
|
|
353
353
|
action: "react",
|
|
354
|
-
|
|
354
|
+
message_id,
|
|
355
355
|
reactionEmoji: params.payload.emoji,
|
|
356
356
|
reactionIsBig: params.payload.big === true,
|
|
357
357
|
});
|
|
@@ -364,8 +364,8 @@ export async function executeChatReactAction(params: {
|
|
|
364
364
|
return {
|
|
365
365
|
success: true,
|
|
366
366
|
data: {
|
|
367
|
-
|
|
368
|
-
...(
|
|
367
|
+
chat_key: result.chat_key || chat_key,
|
|
368
|
+
...(message_id ? { message_id } : {}),
|
|
369
369
|
...(typeof params.payload.emoji === "string" && params.payload.emoji.trim()
|
|
370
370
|
? { emoji: params.payload.emoji.trim() }
|
|
371
371
|
: {}),
|
|
@@ -378,15 +378,15 @@ export async function executeChatReactAction(params: {
|
|
|
378
378
|
* 执行 `chat.delete` action。
|
|
379
379
|
*/
|
|
380
380
|
export async function executeChatDeleteAction(params: {
|
|
381
|
-
context:
|
|
381
|
+
context: PluginContext;
|
|
382
382
|
payload: ChatDeleteActionPayload;
|
|
383
|
-
|
|
383
|
+
execution_context?: PluginExecutionContext;
|
|
384
384
|
}) {
|
|
385
385
|
const result = await deleteChatByChatKey({
|
|
386
386
|
context: params.context,
|
|
387
|
-
|
|
388
|
-
...(params.payload.
|
|
389
|
-
...(params.payload.
|
|
387
|
+
execution_context: params.execution_context,
|
|
388
|
+
...(params.payload.chat_key ? { chat_key: params.payload.chat_key } : {}),
|
|
389
|
+
...(params.payload.session_id ? { session_id: params.payload.session_id } : {}),
|
|
390
390
|
});
|
|
391
391
|
if (!result.success) {
|
|
392
392
|
return {
|
|
@@ -397,7 +397,7 @@ export async function executeChatDeleteAction(params: {
|
|
|
397
397
|
return {
|
|
398
398
|
success: true,
|
|
399
399
|
data: {
|
|
400
|
-
|
|
400
|
+
session_id: result.session_id || null,
|
|
401
401
|
deleted: result.deleted === true,
|
|
402
402
|
removedMeta: result.removedMeta === true,
|
|
403
403
|
removedChatDir: result.removedChatDir === true,
|
|
@@ -56,19 +56,19 @@ export function mapChatListCommandInput(
|
|
|
56
56
|
export function mapChatInfoCommandInput(
|
|
57
57
|
input: PluginActionCommandInput,
|
|
58
58
|
): ChatInfoActionPayload {
|
|
59
|
-
const
|
|
60
|
-
const
|
|
59
|
+
const chat_key = getStringOpt(input.opts, "chat_key");
|
|
60
|
+
const session_id = getStringOpt(input.opts, "session_id");
|
|
61
61
|
return {
|
|
62
|
-
...(
|
|
63
|
-
...(
|
|
62
|
+
...(chat_key ? { chat_key } : {}),
|
|
63
|
+
...(session_id ? { session_id } : {}),
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
export function mapChatHistoryCommandInput(
|
|
68
68
|
input: PluginActionCommandInput,
|
|
69
69
|
): ChatHistoryActionPayload {
|
|
70
|
-
const
|
|
71
|
-
const
|
|
70
|
+
const chat_key = getStringOpt(input.opts, "chat_key");
|
|
71
|
+
const session_id = getStringOpt(input.opts, "session_id");
|
|
72
72
|
const direction = readHistoryDirectionOrThrow(
|
|
73
73
|
getStringOpt(input.opts, "direction"),
|
|
74
74
|
);
|
|
@@ -92,8 +92,8 @@ export function mapChatHistoryCommandInput(
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
return {
|
|
95
|
-
...(
|
|
96
|
-
...(
|
|
95
|
+
...(chat_key ? { chat_key } : {}),
|
|
96
|
+
...(session_id ? { session_id } : {}),
|
|
97
97
|
...(typeof limit === "number" ? { limit } : {}),
|
|
98
98
|
...(direction ? { direction } : {}),
|
|
99
99
|
...(typeof beforeTs === "number" ? { beforeTs } : {}),
|
|
@@ -104,22 +104,22 @@ export function mapChatHistoryCommandInput(
|
|
|
104
104
|
export function mapChatReactCommandInput(
|
|
105
105
|
input: PluginActionCommandInput,
|
|
106
106
|
): ChatReactActionPayload {
|
|
107
|
-
const
|
|
108
|
-
|
|
107
|
+
const chat_key = resolveChatKey({
|
|
108
|
+
chat_key: getStringOpt(input.opts, "chat_key"),
|
|
109
109
|
});
|
|
110
|
-
if (!
|
|
110
|
+
if (!chat_key) {
|
|
111
111
|
throw new Error(
|
|
112
|
-
"Missing
|
|
112
|
+
"Missing chat_key. Provide --chat-key or ensure DC_CTX_CHAT_KEY is injected in current shell context.",
|
|
113
113
|
);
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
const emoji = getStringOpt(input.opts, "emoji");
|
|
117
|
-
const
|
|
117
|
+
const message_id = getStringOpt(input.opts, "message_id");
|
|
118
118
|
const big = getBooleanOpt(input.opts, "big");
|
|
119
119
|
return {
|
|
120
|
-
|
|
120
|
+
chat_key,
|
|
121
121
|
...(emoji ? { emoji } : {}),
|
|
122
|
-
...(
|
|
122
|
+
...(message_id ? { message_id } : {}),
|
|
123
123
|
...(big ? { big: true } : {}),
|
|
124
124
|
};
|
|
125
125
|
}
|
|
@@ -127,10 +127,10 @@ export function mapChatReactCommandInput(
|
|
|
127
127
|
export function mapChatDeleteCommandInput(
|
|
128
128
|
input: PluginActionCommandInput,
|
|
129
129
|
): ChatDeleteActionPayload {
|
|
130
|
-
const
|
|
131
|
-
const
|
|
130
|
+
const chat_key = getStringOpt(input.opts, "chat_key");
|
|
131
|
+
const session_id = getStringOpt(input.opts, "session_id");
|
|
132
132
|
return {
|
|
133
|
-
...(
|
|
134
|
-
...(
|
|
133
|
+
...(chat_key ? { chat_key } : {}),
|
|
134
|
+
...(session_id ? { session_id } : {}),
|
|
135
135
|
};
|
|
136
136
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* - 对外只暴露 action 级入口,供 ChatPluginActions 装配使用。
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import type {
|
|
10
|
+
import type { PluginContext } from "@downcity/agent";
|
|
11
11
|
import type { ChatChannelState } from "@/chat/types/ChatRuntime.js";
|
|
12
12
|
import type {
|
|
13
13
|
ChatReconnectActionPayload,
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
*/
|
|
31
31
|
export async function executeChatStatusAction(params: {
|
|
32
32
|
state: ChatChannelState;
|
|
33
|
-
context:
|
|
33
|
+
context: PluginContext;
|
|
34
34
|
payload: ChatStatusActionPayload;
|
|
35
35
|
}) {
|
|
36
36
|
const channels = resolveTargetChannels(params.payload.channel);
|
|
@@ -50,7 +50,7 @@ export async function executeChatStatusAction(params: {
|
|
|
50
50
|
*/
|
|
51
51
|
export async function executeChatTestAction(params: {
|
|
52
52
|
state: ChatChannelState;
|
|
53
|
-
context:
|
|
53
|
+
context: PluginContext;
|
|
54
54
|
payload: ChatTestActionPayload;
|
|
55
55
|
}) {
|
|
56
56
|
const channels = resolveTargetChannels(params.payload.channel);
|
|
@@ -104,7 +104,7 @@ export async function executeChatTestAction(params: {
|
|
|
104
104
|
*/
|
|
105
105
|
export async function executeChatReconnectAction(params: {
|
|
106
106
|
state: ChatChannelState;
|
|
107
|
-
context:
|
|
107
|
+
context: PluginContext;
|
|
108
108
|
payload: ChatReconnectActionPayload;
|
|
109
109
|
}) {
|
|
110
110
|
const targets = resolveTargetChannels(params.payload.channel);
|
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import type { JsonObject } from "@downcity/agent";
|
|
10
|
-
import type {
|
|
11
|
-
import type {
|
|
10
|
+
import type { PluginContext } from "@downcity/agent";
|
|
11
|
+
import type { ChatRuntimeAccount } from "@/chat/types/ChatRuntimeAccount.js";
|
|
12
12
|
import type {
|
|
13
13
|
ChatChannelName,
|
|
14
14
|
ChatChannelStateSnapshot,
|
|
15
15
|
} from "@/chat/types/ChannelStatus.js";
|
|
16
16
|
import type { ChatChannelState } from "@/chat/types/ChatRuntime.js";
|
|
17
|
-
import {
|
|
17
|
+
import { get_chat_plugin_resource_json_schema } from "@/chat/config/ChatPluginConfig.js";
|
|
18
18
|
import {
|
|
19
19
|
getChatChannelBot,
|
|
20
20
|
isChatChannelEnabled,
|
|
@@ -35,31 +35,31 @@ function toJsonObject(input: unknown): JsonObject {
|
|
|
35
35
|
* - 字段命名与 Agent 全局配置保持一致,便于前端直接映射编辑。
|
|
36
36
|
*/
|
|
37
37
|
export function buildChatChannelConfigSummary(
|
|
38
|
-
context:
|
|
38
|
+
context: PluginContext,
|
|
39
39
|
channel: ChatChannelName,
|
|
40
|
-
accountInput?:
|
|
40
|
+
accountInput?: ChatRuntimeAccount | null,
|
|
41
41
|
): Record<string, string | number | boolean | null> {
|
|
42
42
|
const account = accountInput ?? resolveChannelAccount(context, channel);
|
|
43
|
-
const
|
|
43
|
+
const resource_id = resolveChannelAccountId(context, channel);
|
|
44
44
|
const configured = isChannelAccountConfigured(channel, account);
|
|
45
45
|
if (channel === "telegram") {
|
|
46
46
|
return {
|
|
47
47
|
enabled: isChatChannelEnabled(context, channel),
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
resource_id: resource_id || null,
|
|
49
|
+
resource_configured: configured,
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
if (channel === "feishu") {
|
|
53
53
|
return {
|
|
54
54
|
enabled: isChatChannelEnabled(context, channel),
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
resource_id: resource_id || null,
|
|
56
|
+
resource_configured: configured,
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
59
|
return {
|
|
60
60
|
enabled: isChatChannelEnabled(context, channel),
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
resource_id: resource_id || null,
|
|
62
|
+
resource_configured: configured,
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -68,7 +68,7 @@ export function buildChatChannelConfigSummary(
|
|
|
68
68
|
*/
|
|
69
69
|
export function getChatChannelStatus(
|
|
70
70
|
state: ChatChannelState,
|
|
71
|
-
context:
|
|
71
|
+
context: PluginContext,
|
|
72
72
|
channel: ChatChannelName,
|
|
73
73
|
): ChatChannelStateSnapshot {
|
|
74
74
|
const enabled = isChatChannelEnabled(context, channel);
|
|
@@ -97,7 +97,7 @@ export function getChatChannelStatus(
|
|
|
97
97
|
detail: {
|
|
98
98
|
...(runtime?.detail || {}),
|
|
99
99
|
config: buildChatChannelConfigSummary(context, channel, channelAccount),
|
|
100
|
-
|
|
100
|
+
resource_schema: toJsonObject(get_chat_plugin_resource_json_schema(channel)),
|
|
101
101
|
},
|
|
102
102
|
};
|
|
103
103
|
}
|
|
@@ -7,25 +7,24 @@
|
|
|
7
7
|
* - 目标是让 chat platform 子模块共享同一套最小公共基元。
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import type {
|
|
11
|
-
import type {
|
|
10
|
+
import type { PluginContext } from "@downcity/agent";
|
|
11
|
+
import type { ChatRuntimeAccount } from "@/chat/types/ChatRuntimeAccount.js";
|
|
12
12
|
import type { ChatChannelName } from "@/chat/types/ChannelStatus.js";
|
|
13
13
|
import type { ChatChannelState } from "@/chat/types/ChatRuntime.js";
|
|
14
|
-
import { getStoredChannelAccountSync } from "@/chat/accounts/Store.js";
|
|
15
14
|
|
|
16
15
|
const CHAT_CHANNEL_NAMES: ChatChannelName[] = ["telegram", "feishu", "qq"];
|
|
17
16
|
|
|
18
17
|
export type ChatRuntimeBindings = {
|
|
19
|
-
|
|
18
|
+
getResourceId?(context: PluginContext, channel: ChatChannelName): string;
|
|
20
19
|
resolveChannelAccount?(
|
|
21
|
-
context:
|
|
20
|
+
context: PluginContext,
|
|
22
21
|
channel: ChatChannelName,
|
|
23
|
-
):
|
|
24
|
-
isChannelEnabled?(context:
|
|
22
|
+
): ChatRuntimeAccount | null;
|
|
23
|
+
isChannelEnabled?(context: PluginContext, channel: ChatChannelName): boolean;
|
|
25
24
|
};
|
|
26
25
|
|
|
27
26
|
export function resolveChatPluginBindings(
|
|
28
|
-
context:
|
|
27
|
+
context: PluginContext,
|
|
29
28
|
): ChatRuntimeBindings | null {
|
|
30
29
|
const candidate = context.plugins.get("chat") as
|
|
31
30
|
| ChatRuntimeBindings
|
|
@@ -72,11 +71,11 @@ export function resolveTargetChannels(channel?: ChatChannelName): ChatChannelNam
|
|
|
72
71
|
* 读取渠道绑定的 bot account id。
|
|
73
72
|
*/
|
|
74
73
|
export function resolveChannelAccountId(
|
|
75
|
-
context:
|
|
74
|
+
context: PluginContext,
|
|
76
75
|
channel: ChatChannelName,
|
|
77
76
|
): string {
|
|
78
77
|
const plugin = resolveChatPluginBindings(context);
|
|
79
|
-
const explicit = String(plugin?.
|
|
78
|
+
const explicit = String(plugin?.getResourceId?.(context, channel) || "").trim();
|
|
80
79
|
if (explicit) return explicit;
|
|
81
80
|
return "";
|
|
82
81
|
}
|
|
@@ -85,24 +84,16 @@ export function resolveChannelAccountId(
|
|
|
85
84
|
* 解析渠道 account。
|
|
86
85
|
*
|
|
87
86
|
* 关键点(中文)
|
|
88
|
-
* -
|
|
89
|
-
* - 若实例只提供 channelAccountId,再从默认全局账号池读取对应账号。
|
|
87
|
+
* - 账号只通过 ChatPlugin 实例解析,Plugin Core 不访问宿主全局路径或数据库。
|
|
90
88
|
* - 不从项目文件隐式推断运行时账号。
|
|
91
89
|
*/
|
|
92
90
|
export function resolveChannelAccount(
|
|
93
|
-
context:
|
|
91
|
+
context: PluginContext,
|
|
94
92
|
channel: ChatChannelName,
|
|
95
|
-
):
|
|
93
|
+
): ChatRuntimeAccount | null {
|
|
96
94
|
const plugin = resolveChatPluginBindings(context);
|
|
97
95
|
const explicit = plugin?.resolveChannelAccount?.(context, channel);
|
|
98
|
-
|
|
99
|
-
const channelAccountId = resolveChannelAccountId(context, channel);
|
|
100
|
-
const account = channelAccountId
|
|
101
|
-
? getStoredChannelAccountSync(channelAccountId)
|
|
102
|
-
: null;
|
|
103
|
-
if (!account) return null;
|
|
104
|
-
if (account.channel !== channel) return null;
|
|
105
|
-
return account;
|
|
96
|
+
return explicit?.channel === channel ? explicit : null;
|
|
106
97
|
}
|
|
107
98
|
|
|
108
99
|
/**
|
|
@@ -110,20 +101,20 @@ export function resolveChannelAccount(
|
|
|
110
101
|
*/
|
|
111
102
|
export function isChannelAccountConfigured(
|
|
112
103
|
channel: ChatChannelName,
|
|
113
|
-
account:
|
|
104
|
+
account: ChatRuntimeAccount | null,
|
|
114
105
|
): boolean {
|
|
115
106
|
if (!account) return false;
|
|
116
107
|
if (channel === "telegram") {
|
|
117
|
-
return !!String(account.
|
|
108
|
+
return !!String(account.bot_token || "").trim();
|
|
118
109
|
}
|
|
119
|
-
return !!String(account.
|
|
110
|
+
return !!String(account.app_id || "").trim() && !!String(account.app_secret || "").trim();
|
|
120
111
|
}
|
|
121
112
|
|
|
122
113
|
/**
|
|
123
114
|
* 判断指定渠道当前是否启用。
|
|
124
115
|
*/
|
|
125
116
|
export function isChatChannelEnabled(
|
|
126
|
-
context:
|
|
117
|
+
context: PluginContext,
|
|
127
118
|
channel: ChatChannelName,
|
|
128
119
|
): boolean {
|
|
129
120
|
const plugin = resolveChatPluginBindings(context);
|