@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
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import type { ChatDispatchChannel } from "@/chat/types/ChatDispatcher.js";
|
|
10
10
|
import type { Logger } from "@downcity/agent";
|
|
11
|
-
import type {
|
|
11
|
+
import type { PluginContext } from "@downcity/agent";
|
|
12
12
|
import type { JsonObject, JsonValue } from "@downcity/agent";
|
|
13
13
|
import {
|
|
14
14
|
resolveSessionIdByChatTarget,
|
|
@@ -31,13 +31,13 @@ export type ChannelUserMessageMeta = {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* 基于渠道目标解析
|
|
34
|
+
* 基于渠道目标解析 session_id 的输入。
|
|
35
35
|
*/
|
|
36
36
|
export interface ChannelSessionTargetParams {
|
|
37
37
|
/**
|
|
38
38
|
* 当前 execution runtime。
|
|
39
39
|
*/
|
|
40
|
-
context:
|
|
40
|
+
context: PluginContext;
|
|
41
41
|
/**
|
|
42
42
|
* 当前渠道。
|
|
43
43
|
*/
|
|
@@ -63,15 +63,15 @@ export interface ChannelChatMetaParams {
|
|
|
63
63
|
/**
|
|
64
64
|
* 当前 execution runtime。
|
|
65
65
|
*/
|
|
66
|
-
context:
|
|
66
|
+
context: PluginContext;
|
|
67
67
|
/**
|
|
68
68
|
* 当前渠道。
|
|
69
69
|
*/
|
|
70
70
|
channel: ChatDispatchChannel;
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
72
|
+
* session_id。
|
|
73
73
|
*/
|
|
74
|
-
|
|
74
|
+
session_id: string;
|
|
75
75
|
/**
|
|
76
76
|
* 平台 chatId。
|
|
77
77
|
*/
|
|
@@ -87,7 +87,7 @@ export interface ChannelChatMetaParams {
|
|
|
87
87
|
/**
|
|
88
88
|
* 可选消息 id。
|
|
89
89
|
*/
|
|
90
|
-
|
|
90
|
+
message_id?: string;
|
|
91
91
|
/**
|
|
92
92
|
* 可选用户 id。
|
|
93
93
|
*/
|
|
@@ -109,7 +109,7 @@ export interface ChannelInboundHistoryParams {
|
|
|
109
109
|
/**
|
|
110
110
|
* 当前 execution runtime。
|
|
111
111
|
*/
|
|
112
|
-
context:
|
|
112
|
+
context: PluginContext;
|
|
113
113
|
/**
|
|
114
114
|
* 日志器。
|
|
115
115
|
*/
|
|
@@ -119,9 +119,9 @@ export interface ChannelInboundHistoryParams {
|
|
|
119
119
|
*/
|
|
120
120
|
channel: ChatDispatchChannel;
|
|
121
121
|
/**
|
|
122
|
-
*
|
|
122
|
+
* session_id。
|
|
123
123
|
*/
|
|
124
|
-
|
|
124
|
+
session_id: string;
|
|
125
125
|
/**
|
|
126
126
|
* 平台 chatId。
|
|
127
127
|
*/
|
|
@@ -145,7 +145,7 @@ export interface ChannelInboundHistoryParams {
|
|
|
145
145
|
/**
|
|
146
146
|
* 可选消息 id。
|
|
147
147
|
*/
|
|
148
|
-
|
|
148
|
+
message_id?: string;
|
|
149
149
|
/**
|
|
150
150
|
* 可选用户 id。
|
|
151
151
|
*/
|
|
@@ -175,7 +175,7 @@ export interface ChannelToolOutboundHistoryParams extends ChannelSessionTargetPa
|
|
|
175
175
|
/**
|
|
176
176
|
* 可选消息 id。
|
|
177
177
|
*/
|
|
178
|
-
|
|
178
|
+
message_id?: string;
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
/**
|
|
@@ -190,7 +190,7 @@ export function stripUndefinedMeta(meta: ChannelUserMessageMeta): JsonObject {
|
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
/**
|
|
193
|
-
* 通过渠道目标解析或创建
|
|
193
|
+
* 通过渠道目标解析或创建 session_id。
|
|
194
194
|
*/
|
|
195
195
|
export async function resolveOrCreateChannelSessionId(
|
|
196
196
|
params: ChannelSessionTargetParams,
|
|
@@ -209,7 +209,7 @@ export async function resolveOrCreateChannelSessionId(
|
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
/**
|
|
212
|
-
* 通过渠道目标解析已有
|
|
212
|
+
* 通过渠道目标解析已有 session_id。
|
|
213
213
|
*/
|
|
214
214
|
export async function resolveChannelSessionId(
|
|
215
215
|
params: ChannelSessionTargetParams,
|
|
@@ -235,12 +235,12 @@ export async function updateChannelChatMeta(
|
|
|
235
235
|
): Promise<void> {
|
|
236
236
|
await upsertChatMetaBySessionId({
|
|
237
237
|
context: params.context,
|
|
238
|
-
|
|
238
|
+
session_id: params.session_id,
|
|
239
239
|
channel: params.channel,
|
|
240
240
|
chatId: params.chatId,
|
|
241
241
|
targetType: params.targetType,
|
|
242
242
|
threadId: params.threadId,
|
|
243
|
-
|
|
243
|
+
message_id: params.message_id,
|
|
244
244
|
actorId: params.actorId,
|
|
245
245
|
actorName: params.actorName,
|
|
246
246
|
chatTitle: params.chatTitle,
|
|
@@ -256,14 +256,14 @@ export async function appendInboundChannelHistory(
|
|
|
256
256
|
try {
|
|
257
257
|
await appendInboundChatHistory({
|
|
258
258
|
context: params.context,
|
|
259
|
-
|
|
259
|
+
session_id: params.session_id,
|
|
260
260
|
channel: params.channel,
|
|
261
261
|
chatId: params.chatId,
|
|
262
262
|
ingressKind: params.ingressKind,
|
|
263
263
|
text: params.text,
|
|
264
264
|
targetType: params.targetType,
|
|
265
265
|
threadId: params.threadId,
|
|
266
|
-
|
|
266
|
+
message_id: params.message_id,
|
|
267
267
|
actorId: params.actorId,
|
|
268
268
|
actorName: params.actorName,
|
|
269
269
|
extra: params.extra,
|
|
@@ -272,7 +272,7 @@ export async function appendInboundChannelHistory(
|
|
|
272
272
|
params.logger.warn("Failed to append inbound chat history", {
|
|
273
273
|
error: String(error),
|
|
274
274
|
channel: params.channel,
|
|
275
|
-
|
|
275
|
+
session_id: params.session_id,
|
|
276
276
|
chatId: params.chatId,
|
|
277
277
|
ingressKind: params.ingressKind,
|
|
278
278
|
});
|
|
@@ -289,13 +289,13 @@ export async function appendToolOutboundChannelHistory(
|
|
|
289
289
|
const text = String(params.text ?? "");
|
|
290
290
|
if (!chatId || !text.trim()) return;
|
|
291
291
|
|
|
292
|
-
const
|
|
293
|
-
if (!
|
|
292
|
+
const session_id = await resolveOrCreateChannelSessionId(params);
|
|
293
|
+
if (!session_id) return;
|
|
294
294
|
|
|
295
295
|
try {
|
|
296
296
|
await appendOutboundChatHistory({
|
|
297
297
|
context: params.context,
|
|
298
|
-
|
|
298
|
+
session_id,
|
|
299
299
|
channel: params.channel,
|
|
300
300
|
chatId,
|
|
301
301
|
text,
|
|
@@ -303,8 +303,8 @@ export async function appendToolOutboundChannelHistory(
|
|
|
303
303
|
...(typeof params.messageThreadId === "number"
|
|
304
304
|
? { threadId: params.messageThreadId }
|
|
305
305
|
: {}),
|
|
306
|
-
...(typeof params.
|
|
307
|
-
? {
|
|
306
|
+
...(typeof params.message_id === "string" && params.message_id
|
|
307
|
+
? { message_id: params.message_id }
|
|
308
308
|
: {}),
|
|
309
309
|
extra: {
|
|
310
310
|
source: "channel_send_tool_text",
|
|
@@ -314,7 +314,7 @@ export async function appendToolOutboundChannelHistory(
|
|
|
314
314
|
params.logger.warn("Failed to append outbound chat history", {
|
|
315
315
|
error: String(error),
|
|
316
316
|
channel: params.channel,
|
|
317
|
-
|
|
317
|
+
session_id,
|
|
318
318
|
chatId,
|
|
319
319
|
});
|
|
320
320
|
}
|
|
@@ -4,14 +4,13 @@
|
|
|
4
4
|
* 关键点(中文)
|
|
5
5
|
* - channel 对象是 ChatPlugin 的运行态配置单元。
|
|
6
6
|
* - env 由 channel 自己读取,ChatPlugin 不理解平台字段。
|
|
7
|
-
* -
|
|
7
|
+
* - Resource 已由宿主解析为构造参数,channel 不访问账号池或其他外部 Store。
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import type {
|
|
11
|
-
import type { StoredChannelAccount } from "@downcity/agent";
|
|
10
|
+
import type { PluginContext } from "@downcity/agent";
|
|
12
11
|
import type { ChatChannelName } from "@/chat/types/ChannelStatus.js";
|
|
13
12
|
import type { ChatChannel } from "@/chat/types/ChatPluginOptions.js";
|
|
14
|
-
import {
|
|
13
|
+
import type { ChatRuntimeAccount } from "@/chat/types/ChatRuntimeAccount.js";
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
16
|
* env 字典。
|
|
@@ -39,13 +38,9 @@ export interface BaseChatChannelOptions {
|
|
|
39
38
|
*/
|
|
40
39
|
env?: ChatChannelEnv;
|
|
41
40
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* 说明(中文)
|
|
45
|
-
* - 仅在需要复用全局账号池时使用。
|
|
46
|
-
* - SDK 主路径推荐直接通过 `env` 传入凭据。
|
|
41
|
+
* Resource 或 SDK 调用方提供的稳定 ID。
|
|
47
42
|
*/
|
|
48
|
-
|
|
43
|
+
id?: string;
|
|
49
44
|
/**
|
|
50
45
|
* 运行态展示名称。
|
|
51
46
|
*/
|
|
@@ -60,36 +55,29 @@ abstract class BaseRuntimeChatChannel implements ChatChannel {
|
|
|
60
55
|
|
|
61
56
|
protected enabled: boolean;
|
|
62
57
|
protected env: ChatChannelEnv;
|
|
63
|
-
protected
|
|
64
|
-
protected
|
|
58
|
+
protected resource_id: string;
|
|
59
|
+
protected display_name: string;
|
|
65
60
|
|
|
66
61
|
protected constructor(options: BaseChatChannelOptions = {}) {
|
|
67
62
|
this.enabled = options.enabled !== false;
|
|
68
63
|
this.env = options.env || {};
|
|
69
|
-
this.
|
|
70
|
-
this.
|
|
64
|
+
this.resource_id = String(options.id || "").trim();
|
|
65
|
+
this.display_name = String(options.name || "").trim();
|
|
71
66
|
}
|
|
72
67
|
|
|
73
|
-
isEnabled(_context:
|
|
68
|
+
isEnabled(_context: PluginContext): boolean {
|
|
74
69
|
return this.enabled;
|
|
75
70
|
}
|
|
76
71
|
|
|
77
|
-
|
|
78
|
-
return this.
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
protected getStoredAccount(): StoredChannelAccount | null {
|
|
82
|
-
if (!this.channelAccountId) return null;
|
|
83
|
-
const account = getStoredChannelAccountSync(this.channelAccountId);
|
|
84
|
-
if (!account || account.channel !== this.name) return null;
|
|
85
|
-
return account;
|
|
72
|
+
getResourceId(_context: PluginContext): string {
|
|
73
|
+
return this.resource_id;
|
|
86
74
|
}
|
|
87
75
|
|
|
88
76
|
protected nowIso(): string {
|
|
89
77
|
return new Date().toISOString();
|
|
90
78
|
}
|
|
91
79
|
|
|
92
|
-
abstract getAccount(context:
|
|
80
|
+
abstract getAccount(context: PluginContext): ChatRuntimeAccount | null;
|
|
93
81
|
}
|
|
94
82
|
|
|
95
83
|
/**
|
|
@@ -102,7 +90,7 @@ export interface TelegramChannelOptions extends BaseChatChannelOptions {
|
|
|
102
90
|
* 说明(中文)
|
|
103
91
|
* - 优先级高于 `env.TELEGRAM_BOT_TOKEN`。
|
|
104
92
|
*/
|
|
105
|
-
|
|
93
|
+
bot_token?: string;
|
|
106
94
|
}
|
|
107
95
|
|
|
108
96
|
/**
|
|
@@ -110,27 +98,24 @@ export interface TelegramChannelOptions extends BaseChatChannelOptions {
|
|
|
110
98
|
*/
|
|
111
99
|
export class TelegramChannel extends BaseRuntimeChatChannel {
|
|
112
100
|
readonly name = "telegram" as const;
|
|
113
|
-
private readonly
|
|
101
|
+
private readonly bot_token?: string;
|
|
114
102
|
|
|
115
103
|
constructor(options: TelegramChannelOptions = {}) {
|
|
116
104
|
super(options);
|
|
117
|
-
this.
|
|
105
|
+
this.bot_token = String(options.bot_token || "").trim() || undefined;
|
|
118
106
|
}
|
|
119
107
|
|
|
120
|
-
getAccount(_context:
|
|
121
|
-
const
|
|
122
|
-
if (storedAccount) return storedAccount;
|
|
123
|
-
|
|
124
|
-
const token = String(this.botToken || this.env.TELEGRAM_BOT_TOKEN || "").trim();
|
|
108
|
+
getAccount(_context: PluginContext): ChatRuntimeAccount | null {
|
|
109
|
+
const token = String(this.bot_token || this.env.TELEGRAM_BOT_TOKEN || "").trim();
|
|
125
110
|
if (!token) return null;
|
|
126
111
|
const now = this.nowIso();
|
|
127
112
|
return {
|
|
128
|
-
id: this.
|
|
113
|
+
id: this.resource_id || "chat-sdk-telegram",
|
|
129
114
|
channel: "telegram",
|
|
130
|
-
name: this.
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
115
|
+
name: this.display_name || "telegram",
|
|
116
|
+
bot_token: token,
|
|
117
|
+
created_at: now,
|
|
118
|
+
updated_at: now,
|
|
134
119
|
};
|
|
135
120
|
}
|
|
136
121
|
}
|
|
@@ -142,11 +127,11 @@ export interface FeishuChannelOptions extends BaseChatChannelOptions {
|
|
|
142
127
|
/**
|
|
143
128
|
* Feishu / Lark App ID。
|
|
144
129
|
*/
|
|
145
|
-
|
|
130
|
+
app_id?: string;
|
|
146
131
|
/**
|
|
147
132
|
* Feishu / Lark App Secret。
|
|
148
133
|
*/
|
|
149
|
-
|
|
134
|
+
app_secret?: string;
|
|
150
135
|
/**
|
|
151
136
|
* Feishu / Lark Open API 域名。
|
|
152
137
|
*/
|
|
@@ -158,37 +143,34 @@ export interface FeishuChannelOptions extends BaseChatChannelOptions {
|
|
|
158
143
|
*/
|
|
159
144
|
export class FeishuChannel extends BaseRuntimeChatChannel {
|
|
160
145
|
readonly name = "feishu" as const;
|
|
161
|
-
private readonly
|
|
162
|
-
private readonly
|
|
146
|
+
private readonly app_id?: string;
|
|
147
|
+
private readonly app_secret?: string;
|
|
163
148
|
private readonly domain?: string;
|
|
164
149
|
|
|
165
150
|
constructor(options: FeishuChannelOptions = {}) {
|
|
166
151
|
super(options);
|
|
167
|
-
this.
|
|
168
|
-
this.
|
|
152
|
+
this.app_id = String(options.app_id || "").trim() || undefined;
|
|
153
|
+
this.app_secret = String(options.app_secret || "").trim() || undefined;
|
|
169
154
|
this.domain = String(options.domain || "").trim() || undefined;
|
|
170
155
|
}
|
|
171
156
|
|
|
172
|
-
getAccount(_context:
|
|
173
|
-
const
|
|
174
|
-
if (storedAccount) return storedAccount;
|
|
175
|
-
|
|
176
|
-
const appId = String(this.appId || this.env.FEISHU_APP_ID || "").trim();
|
|
157
|
+
getAccount(_context: PluginContext): ChatRuntimeAccount | null {
|
|
158
|
+
const appId = String(this.app_id || this.env.FEISHU_APP_ID || "").trim();
|
|
177
159
|
const appSecret = String(
|
|
178
|
-
this.
|
|
160
|
+
this.app_secret || this.env.FEISHU_APP_SECRET || "",
|
|
179
161
|
).trim();
|
|
180
162
|
const domain = String(this.domain || this.env.FEISHU_DOMAIN || "").trim();
|
|
181
163
|
if (!appId || !appSecret) return null;
|
|
182
164
|
const now = this.nowIso();
|
|
183
165
|
return {
|
|
184
|
-
id: this.
|
|
166
|
+
id: this.resource_id || "chat-sdk-feishu",
|
|
185
167
|
channel: "feishu",
|
|
186
|
-
name: this.
|
|
187
|
-
appId,
|
|
188
|
-
appSecret,
|
|
168
|
+
name: this.display_name || "feishu",
|
|
169
|
+
app_id: appId,
|
|
170
|
+
app_secret: appSecret,
|
|
189
171
|
...(domain ? { domain } : {}),
|
|
190
|
-
|
|
191
|
-
|
|
172
|
+
created_at: now,
|
|
173
|
+
updated_at: now,
|
|
192
174
|
};
|
|
193
175
|
}
|
|
194
176
|
}
|
|
@@ -200,11 +182,11 @@ export interface QqChannelOptions extends BaseChatChannelOptions {
|
|
|
200
182
|
/**
|
|
201
183
|
* QQ Bot App ID。
|
|
202
184
|
*/
|
|
203
|
-
|
|
185
|
+
app_id?: string;
|
|
204
186
|
/**
|
|
205
187
|
* QQ Bot App Secret。
|
|
206
188
|
*/
|
|
207
|
-
|
|
189
|
+
app_secret?: string;
|
|
208
190
|
/**
|
|
209
191
|
* 是否使用 QQ 沙箱模式。
|
|
210
192
|
*/
|
|
@@ -216,37 +198,34 @@ export interface QqChannelOptions extends BaseChatChannelOptions {
|
|
|
216
198
|
*/
|
|
217
199
|
export class QqChannel extends BaseRuntimeChatChannel {
|
|
218
200
|
readonly name = "qq" as const;
|
|
219
|
-
private readonly
|
|
220
|
-
private readonly
|
|
201
|
+
private readonly app_id?: string;
|
|
202
|
+
private readonly app_secret?: string;
|
|
221
203
|
private readonly sandbox?: boolean;
|
|
222
204
|
|
|
223
205
|
constructor(options: QqChannelOptions = {}) {
|
|
224
206
|
super(options);
|
|
225
|
-
this.
|
|
226
|
-
this.
|
|
207
|
+
this.app_id = String(options.app_id || "").trim() || undefined;
|
|
208
|
+
this.app_secret = String(options.app_secret || "").trim() || undefined;
|
|
227
209
|
this.sandbox = options.sandbox === true;
|
|
228
210
|
}
|
|
229
211
|
|
|
230
|
-
getAccount(_context:
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
const appId = String(this.appId || this.env.QQ_APP_ID || "").trim();
|
|
235
|
-
const appSecret = String(this.appSecret || this.env.QQ_APP_SECRET || "").trim();
|
|
212
|
+
getAccount(_context: PluginContext): ChatRuntimeAccount | null {
|
|
213
|
+
const appId = String(this.app_id || this.env.QQ_APP_ID || "").trim();
|
|
214
|
+
const appSecret = String(this.app_secret || this.env.QQ_APP_SECRET || "").trim();
|
|
236
215
|
const sandbox =
|
|
237
216
|
this.sandbox === true ||
|
|
238
217
|
String(this.env.QQ_SANDBOX || "").trim().toLowerCase() === "true";
|
|
239
218
|
if (!appId || !appSecret) return null;
|
|
240
219
|
const now = this.nowIso();
|
|
241
220
|
return {
|
|
242
|
-
id: this.
|
|
221
|
+
id: this.resource_id || "chat-sdk-qq",
|
|
243
222
|
channel: "qq",
|
|
244
|
-
name: this.
|
|
245
|
-
appId,
|
|
246
|
-
appSecret,
|
|
223
|
+
name: this.display_name || "qq",
|
|
224
|
+
app_id: appId,
|
|
225
|
+
app_secret: appSecret,
|
|
247
226
|
...(sandbox ? { sandbox: true } : {}),
|
|
248
|
-
|
|
249
|
-
|
|
227
|
+
created_at: now,
|
|
228
|
+
updated_at: now,
|
|
250
229
|
};
|
|
251
230
|
}
|
|
252
231
|
}
|
|
@@ -14,7 +14,7 @@ import type {
|
|
|
14
14
|
ChannelChatKeyParams,
|
|
15
15
|
ChannelSendTextParams,
|
|
16
16
|
} from "@/chat/channels/BaseChatChannel.js";
|
|
17
|
-
import type {
|
|
17
|
+
import type { PluginContext } from "@downcity/agent";
|
|
18
18
|
import type { JsonObject } from "@downcity/agent";
|
|
19
19
|
import type { ChatChannelTestResult } from "@/chat/types/ChannelStatus.js";
|
|
20
20
|
import type { ParsedFeishuAttachmentCommand } from "@/chat/types/FeishuAttachment.js";
|
|
@@ -55,7 +55,7 @@ export class FeishuBot extends BaseChatChannel {
|
|
|
55
55
|
> = new Map();
|
|
56
56
|
|
|
57
57
|
constructor(
|
|
58
|
-
context:
|
|
58
|
+
context: PluginContext,
|
|
59
59
|
appId: string,
|
|
60
60
|
appSecret: string,
|
|
61
61
|
domain: string | undefined,
|
|
@@ -64,7 +64,7 @@ export class FeishuBot extends BaseChatChannel {
|
|
|
64
64
|
this.appId = appId;
|
|
65
65
|
this.appSecret = appSecret;
|
|
66
66
|
this.domain = domain;
|
|
67
|
-
this.dedupeDir = get_feishu_dedupe_dir_path(context.
|
|
67
|
+
this.dedupeDir = get_feishu_dedupe_dir_path(context.workspace_path);
|
|
68
68
|
this.platform = new FeishuPlatformClient({
|
|
69
69
|
context,
|
|
70
70
|
config: {
|
|
@@ -91,13 +91,13 @@ export class FeishuBot extends BaseChatChannel {
|
|
|
91
91
|
params: ChannelSendTextParams,
|
|
92
92
|
): Promise<void> {
|
|
93
93
|
const chatType = typeof params.chatType === "string" ? params.chatType : "p2p";
|
|
94
|
-
const
|
|
95
|
-
typeof params.
|
|
94
|
+
const message_id =
|
|
95
|
+
typeof params.message_id === "string" ? params.message_id : undefined;
|
|
96
96
|
const text = String(params.text ?? "");
|
|
97
|
-
const shouldReplyToMessage = params.
|
|
97
|
+
const shouldReplyToMessage = params.reply_to_message === true;
|
|
98
98
|
|
|
99
|
-
if (shouldReplyToMessage &&
|
|
100
|
-
await this.sendMessage(params.chatId, chatType,
|
|
99
|
+
if (shouldReplyToMessage && message_id && chatType !== "p2p") {
|
|
100
|
+
await this.sendMessage(params.chatId, chatType, message_id, text);
|
|
101
101
|
} else {
|
|
102
102
|
await this.sendChatMessage(params.chatId, chatType, text);
|
|
103
103
|
}
|
|
@@ -222,14 +222,14 @@ export class FeishuBot extends BaseChatChannel {
|
|
|
222
222
|
},
|
|
223
223
|
buildAccessBlockedText: (params) =>
|
|
224
224
|
this.buildAccessBlockedText(params),
|
|
225
|
-
runInChat: async (
|
|
226
|
-
await this.runInChat(
|
|
225
|
+
runInChat: async (chat_key, fn) => {
|
|
226
|
+
await this.runInChat(chat_key, fn);
|
|
227
227
|
},
|
|
228
228
|
handleCommand: async (params) => {
|
|
229
229
|
await this.handleCommand(
|
|
230
230
|
params.chatId,
|
|
231
231
|
params.chatType,
|
|
232
|
-
params.
|
|
232
|
+
params.message_id,
|
|
233
233
|
params.command,
|
|
234
234
|
);
|
|
235
235
|
},
|
|
@@ -237,7 +237,7 @@ export class FeishuBot extends BaseChatChannel {
|
|
|
237
237
|
await this.executeAndReply(
|
|
238
238
|
params.chatId,
|
|
239
239
|
params.chatType,
|
|
240
|
-
params.
|
|
240
|
+
params.message_id,
|
|
241
241
|
params.instructions,
|
|
242
242
|
params.actorId,
|
|
243
243
|
params.actorName,
|
|
@@ -249,7 +249,7 @@ export class FeishuBot extends BaseChatChannel {
|
|
|
249
249
|
await this.sendErrorMessage(
|
|
250
250
|
params.chatId,
|
|
251
251
|
params.chatType,
|
|
252
|
-
params.
|
|
252
|
+
params.message_id,
|
|
253
253
|
params.errorText,
|
|
254
254
|
);
|
|
255
255
|
},
|
|
@@ -262,7 +262,7 @@ export class FeishuBot extends BaseChatChannel {
|
|
|
262
262
|
private async handleCommand(
|
|
263
263
|
chatId: string,
|
|
264
264
|
chatType: string,
|
|
265
|
-
|
|
265
|
+
message_id: string,
|
|
266
266
|
command: string,
|
|
267
267
|
): Promise<void> {
|
|
268
268
|
this.logger.info(`Received Feishu command: ${command}`);
|
|
@@ -300,7 +300,7 @@ Available commands:
|
|
|
300
300
|
responseText = `Unknown command: ${command}\nType /help to view available commands`;
|
|
301
301
|
}
|
|
302
302
|
|
|
303
|
-
await this.sendMessage(chatId, chatType,
|
|
303
|
+
await this.sendMessage(chatId, chatType, message_id, responseText);
|
|
304
304
|
}
|
|
305
305
|
|
|
306
306
|
/**
|
|
@@ -309,7 +309,7 @@ Available commands:
|
|
|
309
309
|
private async executeAndReply(
|
|
310
310
|
chatId: string,
|
|
311
311
|
chatType: string,
|
|
312
|
-
|
|
312
|
+
message_id: string,
|
|
313
313
|
instructions: string,
|
|
314
314
|
actorId?: string,
|
|
315
315
|
actorName?: string,
|
|
@@ -317,18 +317,18 @@ Available commands:
|
|
|
317
317
|
extra?: JsonObject,
|
|
318
318
|
): Promise<void> {
|
|
319
319
|
try {
|
|
320
|
-
const {
|
|
320
|
+
const { chat_key } = await this.enqueueMessage({
|
|
321
321
|
chatId,
|
|
322
322
|
text: instructions,
|
|
323
323
|
chatType,
|
|
324
|
-
|
|
325
|
-
|
|
324
|
+
message_id,
|
|
325
|
+
user_id: actorId,
|
|
326
326
|
username: actorName,
|
|
327
327
|
chatTitle,
|
|
328
328
|
...(extra ? { extra } : {}),
|
|
329
329
|
});
|
|
330
330
|
|
|
331
|
-
this.knownChats.set(
|
|
331
|
+
this.knownChats.set(chat_key, {
|
|
332
332
|
chatId,
|
|
333
333
|
chatType,
|
|
334
334
|
...(chatTitle ? { chatTitle } : {}),
|
|
@@ -337,7 +337,7 @@ Available commands:
|
|
|
337
337
|
await this.sendErrorMessage(
|
|
338
338
|
chatId,
|
|
339
339
|
chatType,
|
|
340
|
-
|
|
340
|
+
message_id,
|
|
341
341
|
`Execution error: ${String(error)}`,
|
|
342
342
|
);
|
|
343
343
|
}
|
|
@@ -349,11 +349,11 @@ Available commands:
|
|
|
349
349
|
async sendMessage(
|
|
350
350
|
chatId: string,
|
|
351
351
|
chatType: string,
|
|
352
|
-
|
|
352
|
+
message_id: string,
|
|
353
353
|
text: string,
|
|
354
354
|
): Promise<void> {
|
|
355
355
|
const parsed = parseFeishuAttachments(text);
|
|
356
|
-
await this.sendParsedMessage(chatId, chatType,
|
|
356
|
+
await this.sendParsedMessage(chatId, chatType, message_id, parsed.segments);
|
|
357
357
|
}
|
|
358
358
|
|
|
359
359
|
/**
|
|
@@ -374,7 +374,7 @@ Available commands:
|
|
|
374
374
|
private async sendParsedMessage(
|
|
375
375
|
chatId: string,
|
|
376
376
|
chatType: string,
|
|
377
|
-
|
|
377
|
+
message_id: string | undefined,
|
|
378
378
|
segments: Array<
|
|
379
379
|
| {
|
|
380
380
|
kind: "text";
|
|
@@ -390,16 +390,16 @@ Available commands:
|
|
|
390
390
|
if (segment.kind === "text") {
|
|
391
391
|
const normalizedText = String(segment.text || "").trim();
|
|
392
392
|
if (!normalizedText) continue;
|
|
393
|
-
await this.sendPlatformMessage(chatId, chatType,
|
|
393
|
+
await this.sendPlatformMessage(chatId, chatType, message_id, "text", {
|
|
394
394
|
text: normalizedText,
|
|
395
395
|
});
|
|
396
396
|
continue;
|
|
397
397
|
}
|
|
398
398
|
|
|
399
399
|
try {
|
|
400
|
-
await this.sendAttachment(chatId, chatType,
|
|
400
|
+
await this.sendAttachment(chatId, chatType, message_id, segment.attachment);
|
|
401
401
|
} catch (error) {
|
|
402
|
-
await this.sendPlatformMessage(chatId, chatType,
|
|
402
|
+
await this.sendPlatformMessage(chatId, chatType, message_id, "text", {
|
|
403
403
|
text: `❌ Failed to send attachment: ${segment.attachment.pathOrUrl}\n${String(error)}`,
|
|
404
404
|
});
|
|
405
405
|
}
|
|
@@ -412,10 +412,10 @@ Available commands:
|
|
|
412
412
|
async sendAttachment(
|
|
413
413
|
chatId: string,
|
|
414
414
|
chatType: string,
|
|
415
|
-
|
|
415
|
+
message_id: string | undefined,
|
|
416
416
|
attachment: ParsedFeishuAttachmentCommand,
|
|
417
417
|
): Promise<void> {
|
|
418
|
-
await this.platform.sendAttachment(chatId, chatType,
|
|
418
|
+
await this.platform.sendAttachment(chatId, chatType, message_id, attachment);
|
|
419
419
|
}
|
|
420
420
|
|
|
421
421
|
/**
|
|
@@ -424,11 +424,11 @@ Available commands:
|
|
|
424
424
|
async sendPlatformMessage(
|
|
425
425
|
chatId: string,
|
|
426
426
|
chatType: string,
|
|
427
|
-
|
|
427
|
+
message_id: string | undefined,
|
|
428
428
|
msgType: FeishuMessagePayloadType,
|
|
429
429
|
content: Record<string, unknown> | string,
|
|
430
430
|
): Promise<void> {
|
|
431
|
-
await this.platform.sendPlatformMessage(chatId, chatType,
|
|
431
|
+
await this.platform.sendPlatformMessage(chatId, chatType, message_id, msgType, content);
|
|
432
432
|
}
|
|
433
433
|
|
|
434
434
|
/**
|
|
@@ -437,10 +437,10 @@ Available commands:
|
|
|
437
437
|
private async sendErrorMessage(
|
|
438
438
|
chatId: string,
|
|
439
439
|
chatType: string,
|
|
440
|
-
|
|
440
|
+
message_id: string,
|
|
441
441
|
errorText: string,
|
|
442
442
|
): Promise<void> {
|
|
443
|
-
await this.sendMessage(chatId, chatType,
|
|
443
|
+
await this.sendMessage(chatId, chatType, message_id, `❌ ${errorText}`);
|
|
444
444
|
}
|
|
445
445
|
|
|
446
446
|
/**
|
|
@@ -452,7 +452,7 @@ Available commands:
|
|
|
452
452
|
}
|
|
453
453
|
|
|
454
454
|
/**
|
|
455
|
-
* 生成
|
|
455
|
+
* 生成 chat_key。
|
|
456
456
|
*/
|
|
457
457
|
private buildChatKey(chatId: string): string {
|
|
458
458
|
return `feishu-chat-${chatId}`;
|
|
@@ -464,7 +464,7 @@ Available commands:
|
|
|
464
464
|
*/
|
|
465
465
|
export async function createFeishuBot(
|
|
466
466
|
config: FeishuConfig,
|
|
467
|
-
context:
|
|
467
|
+
context: PluginContext,
|
|
468
468
|
): Promise<FeishuBot | null> {
|
|
469
469
|
if (!config.enabled || !config.appId || !config.appSecret) {
|
|
470
470
|
return null;
|
|
@@ -19,9 +19,9 @@ export function extractFeishuSenderIdentity(
|
|
|
19
19
|
return { senderId: openId, idType: "open_id" };
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
const
|
|
23
|
-
if (
|
|
24
|
-
return { senderId:
|
|
22
|
+
const user_id = String(data?.sender?.sender_id?.user_id || "").trim();
|
|
23
|
+
if (user_id) {
|
|
24
|
+
return { senderId: user_id, idType: "user_id" };
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
const unionId = String(data?.sender?.sender_id?.union_id || "").trim();
|