@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,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import path from "path";
|
|
11
11
|
import type { Logger } from "@downcity/agent";
|
|
12
|
-
import type {
|
|
12
|
+
import type { PluginContext } from "@downcity/agent";
|
|
13
13
|
import type {
|
|
14
14
|
IncomingChatAccessParams,
|
|
15
15
|
IncomingChatAccessResult,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
augmentChatInboundInput,
|
|
25
25
|
buildChatInboundText,
|
|
26
26
|
} from "@/chat/runtime/InboundAugment.js";
|
|
27
|
-
import {
|
|
27
|
+
import { render_chat_message_file_tag } from "@downcity/agent";
|
|
28
28
|
import { parseFeishuInboundMessage } from "./InboundAttachment.js";
|
|
29
29
|
import {
|
|
30
30
|
extractFeishuSenderIdentity,
|
|
@@ -44,7 +44,7 @@ export interface FeishuMessageHandlerOptions {
|
|
|
44
44
|
/**
|
|
45
45
|
* 当前 agent context。
|
|
46
46
|
*/
|
|
47
|
-
context:
|
|
47
|
+
context: PluginContext;
|
|
48
48
|
/**
|
|
49
49
|
* 项目根目录。
|
|
50
50
|
*/
|
|
@@ -54,7 +54,7 @@ export interface FeishuMessageHandlerOptions {
|
|
|
54
54
|
*/
|
|
55
55
|
logger: Logger;
|
|
56
56
|
/**
|
|
57
|
-
* 构建
|
|
57
|
+
* 构建 chat_key。
|
|
58
58
|
*/
|
|
59
59
|
buildChatKey(chatId: string): string;
|
|
60
60
|
/**
|
|
@@ -77,7 +77,7 @@ export interface FeishuMessageHandlerOptions {
|
|
|
77
77
|
* 下载入站附件。
|
|
78
78
|
*/
|
|
79
79
|
downloadIncomingAttachments(params: {
|
|
80
|
-
|
|
80
|
+
message_id: string;
|
|
81
81
|
attachments: ReturnType<typeof parseFeishuInboundMessage>["attachments"];
|
|
82
82
|
}): Promise<FeishuDownloadedAttachment[]>;
|
|
83
83
|
/**
|
|
@@ -101,7 +101,7 @@ export interface FeishuMessageHandlerOptions {
|
|
|
101
101
|
/**
|
|
102
102
|
* 发送入站 ack reaction。
|
|
103
103
|
*/
|
|
104
|
-
sendInboundAckReaction(params: {
|
|
104
|
+
sendInboundAckReaction(params: { message_id: string }): Promise<void>;
|
|
105
105
|
/**
|
|
106
106
|
* 记录已知会话。
|
|
107
107
|
*/
|
|
@@ -126,16 +126,16 @@ export interface FeishuMessageHandlerOptions {
|
|
|
126
126
|
*/
|
|
127
127
|
buildAccessBlockedText(params: { result: IncomingChatAccessResult }): string;
|
|
128
128
|
/**
|
|
129
|
-
* 按
|
|
129
|
+
* 按 chat_key 串行执行。
|
|
130
130
|
*/
|
|
131
|
-
runInChat(
|
|
131
|
+
runInChat(chat_key: string, fn: () => Promise<void>): Promise<void>;
|
|
132
132
|
/**
|
|
133
133
|
* 命令处理。
|
|
134
134
|
*/
|
|
135
135
|
handleCommand(params: {
|
|
136
136
|
chatId: string;
|
|
137
137
|
chatType: string;
|
|
138
|
-
|
|
138
|
+
message_id: string;
|
|
139
139
|
command: string;
|
|
140
140
|
}): Promise<void>;
|
|
141
141
|
/**
|
|
@@ -144,7 +144,7 @@ export interface FeishuMessageHandlerOptions {
|
|
|
144
144
|
executeAndReply(params: {
|
|
145
145
|
chatId: string;
|
|
146
146
|
chatType: string;
|
|
147
|
-
|
|
147
|
+
message_id: string;
|
|
148
148
|
instructions: string;
|
|
149
149
|
actorId?: string;
|
|
150
150
|
actorName?: string;
|
|
@@ -157,7 +157,7 @@ export interface FeishuMessageHandlerOptions {
|
|
|
157
157
|
sendErrorMessage(params: {
|
|
158
158
|
chatId: string;
|
|
159
159
|
chatType: string;
|
|
160
|
-
|
|
160
|
+
message_id: string;
|
|
161
161
|
errorText: string;
|
|
162
162
|
}): Promise<void>;
|
|
163
163
|
}
|
|
@@ -188,10 +188,10 @@ export async function handleFeishuMessage(
|
|
|
188
188
|
const normalizedMessageId = String(message_id || "").trim();
|
|
189
189
|
if (!normalizedMessageId) return;
|
|
190
190
|
if (!actorId) {
|
|
191
|
-
options.logger.warn("飞书消息缺少发送者
|
|
191
|
+
options.logger.warn("飞书消息缺少发送者 user_id/open_id,已忽略", {
|
|
192
192
|
chatId: chat_id,
|
|
193
193
|
chatType: chat_type,
|
|
194
|
-
|
|
194
|
+
message_id: normalizedMessageId,
|
|
195
195
|
});
|
|
196
196
|
return;
|
|
197
197
|
}
|
|
@@ -230,7 +230,7 @@ export async function handleFeishuMessage(
|
|
|
230
230
|
options,
|
|
231
231
|
chatId: chat_id,
|
|
232
232
|
chatType: chat_type,
|
|
233
|
-
|
|
233
|
+
message_id: message_id,
|
|
234
234
|
messageType: message_type,
|
|
235
235
|
content,
|
|
236
236
|
parentMessageId: parent_id,
|
|
@@ -239,7 +239,7 @@ export async function handleFeishuMessage(
|
|
|
239
239
|
await options.sendErrorMessage({
|
|
240
240
|
chatId: chat_id,
|
|
241
241
|
chatType: chat_type,
|
|
242
|
-
|
|
242
|
+
message_id: message_id,
|
|
243
243
|
errorText: `Failed to parse message: ${String(error)}`,
|
|
244
244
|
});
|
|
245
245
|
handled = true;
|
|
@@ -258,7 +258,7 @@ export async function handleFeishuMessage(
|
|
|
258
258
|
actorId,
|
|
259
259
|
chatId: chat_id,
|
|
260
260
|
chatType: chat_type,
|
|
261
|
-
|
|
261
|
+
message_id: message_id,
|
|
262
262
|
...parsedInput,
|
|
263
263
|
});
|
|
264
264
|
handled = handledByAuth;
|
|
@@ -284,7 +284,7 @@ async function parseIncomingMessage(params: {
|
|
|
284
284
|
options: FeishuMessageHandlerOptions;
|
|
285
285
|
chatId: string;
|
|
286
286
|
chatType: string;
|
|
287
|
-
|
|
287
|
+
message_id: string;
|
|
288
288
|
messageType: string;
|
|
289
289
|
content: string;
|
|
290
290
|
parentMessageId?: string;
|
|
@@ -302,7 +302,7 @@ async function parseIncomingMessage(params: {
|
|
|
302
302
|
await params.options.sendErrorMessage({
|
|
303
303
|
chatId: params.chatId,
|
|
304
304
|
chatType: params.chatType,
|
|
305
|
-
|
|
305
|
+
message_id: params.message_id,
|
|
306
306
|
errorText: `Unsupported Feishu message type: ${parsed.unsupportedType}`,
|
|
307
307
|
});
|
|
308
308
|
return {
|
|
@@ -315,7 +315,7 @@ async function parseIncomingMessage(params: {
|
|
|
315
315
|
return {
|
|
316
316
|
userMessage: parsed.text,
|
|
317
317
|
incomingAttachments: await params.options.downloadIncomingAttachments({
|
|
318
|
-
|
|
318
|
+
message_id: params.message_id,
|
|
319
319
|
attachments: parsed.attachments,
|
|
320
320
|
}),
|
|
321
321
|
replyContext: await params.options.resolveReplyContext({
|
|
@@ -335,7 +335,7 @@ async function handleAuthorizedMessage(params: {
|
|
|
335
335
|
actorId: string;
|
|
336
336
|
chatId: string;
|
|
337
337
|
chatType: string;
|
|
338
|
-
|
|
338
|
+
message_id: string;
|
|
339
339
|
userMessage: string;
|
|
340
340
|
incomingAttachments: FeishuDownloadedAttachment[];
|
|
341
341
|
replyContext?: InboundReplyContext;
|
|
@@ -347,7 +347,7 @@ async function handleAuthorizedMessage(params: {
|
|
|
347
347
|
actorId,
|
|
348
348
|
chatId,
|
|
349
349
|
chatType,
|
|
350
|
-
|
|
350
|
+
message_id,
|
|
351
351
|
incomingAttachments,
|
|
352
352
|
replyContext,
|
|
353
353
|
} = params;
|
|
@@ -366,7 +366,7 @@ async function handleAuthorizedMessage(params: {
|
|
|
366
366
|
chatId,
|
|
367
367
|
chatType,
|
|
368
368
|
chatTitle,
|
|
369
|
-
|
|
369
|
+
user_id: actorId,
|
|
370
370
|
username: actorName,
|
|
371
371
|
});
|
|
372
372
|
if (!access_result.allowed) {
|
|
@@ -386,14 +386,14 @@ async function handleAuthorizedMessage(params: {
|
|
|
386
386
|
...(chatTitle ? { chatTitle } : {}),
|
|
387
387
|
});
|
|
388
388
|
|
|
389
|
-
await options.sendInboundAckReaction({
|
|
389
|
+
await options.sendInboundAckReaction({ message_id });
|
|
390
390
|
|
|
391
391
|
await options.runInChat(threadId, async () => {
|
|
392
392
|
if (userMessage.startsWith("/") && incomingAttachments.length === 0) {
|
|
393
393
|
await options.handleCommand({
|
|
394
394
|
chatId,
|
|
395
395
|
chatType,
|
|
396
|
-
|
|
396
|
+
message_id,
|
|
397
397
|
command: userMessage,
|
|
398
398
|
});
|
|
399
399
|
return;
|
|
@@ -401,7 +401,7 @@ async function handleAuthorizedMessage(params: {
|
|
|
401
401
|
|
|
402
402
|
const attachmentLines = incomingAttachments.map((attachment) => {
|
|
403
403
|
const rel = path.relative(options.rootPath, attachment.path);
|
|
404
|
-
return
|
|
404
|
+
return render_chat_message_file_tag({
|
|
405
405
|
type: attachment.type,
|
|
406
406
|
path: rel,
|
|
407
407
|
...(attachment.desc ? { caption: attachment.desc } : {}),
|
|
@@ -421,12 +421,12 @@ async function handleAuthorizedMessage(params: {
|
|
|
421
421
|
channel: "feishu",
|
|
422
422
|
chatId,
|
|
423
423
|
chatType,
|
|
424
|
-
|
|
425
|
-
|
|
424
|
+
chat_key: threadId,
|
|
425
|
+
message_id,
|
|
426
426
|
rootPath: options.rootPath,
|
|
427
427
|
attachmentText:
|
|
428
428
|
attachmentLines.length > 0 ? attachmentLines.join("\n") : undefined,
|
|
429
|
-
|
|
429
|
+
body_text: userMessage ? userMessage.trim() : undefined,
|
|
430
430
|
attachments: incomingAttachments.map((attachment) => ({
|
|
431
431
|
channel: "feishu" as const,
|
|
432
432
|
kind: attachment.type,
|
|
@@ -447,7 +447,7 @@ async function handleAuthorizedMessage(params: {
|
|
|
447
447
|
await options.executeAndReply({
|
|
448
448
|
chatId,
|
|
449
449
|
chatType,
|
|
450
|
-
|
|
450
|
+
message_id,
|
|
451
451
|
instructions,
|
|
452
452
|
actorId,
|
|
453
453
|
actorName,
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* - `FeishuBot` 只调用这里暴露的平台能力,不再直接持有底层 Feishu 连接细节。
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import type {
|
|
10
|
+
import type { PluginContext } from "@downcity/agent";
|
|
11
11
|
import type {
|
|
12
12
|
FeishuConfig,
|
|
13
13
|
FeishuDownloadedAttachment,
|
|
@@ -43,7 +43,7 @@ export interface FeishuPlatformClientOptions {
|
|
|
43
43
|
/**
|
|
44
44
|
* 当前执行上下文。
|
|
45
45
|
*/
|
|
46
|
-
context:
|
|
46
|
+
context: PluginContext;
|
|
47
47
|
/**
|
|
48
48
|
* 飞书渠道配置。
|
|
49
49
|
*/
|
|
@@ -58,9 +58,9 @@ export interface FeishuPlatformClientOptions {
|
|
|
58
58
|
* 飞书平台 client。
|
|
59
59
|
*/
|
|
60
60
|
export class FeishuPlatformClient {
|
|
61
|
-
private readonly context:
|
|
61
|
+
private readonly context: PluginContext;
|
|
62
62
|
private readonly rootPath: string;
|
|
63
|
-
private readonly logger:
|
|
63
|
+
private readonly logger: PluginContext["logger"];
|
|
64
64
|
private readonly appId: string;
|
|
65
65
|
private readonly appSecret: string;
|
|
66
66
|
private readonly domain?: string;
|
|
@@ -78,7 +78,7 @@ export class FeishuPlatformClient {
|
|
|
78
78
|
|
|
79
79
|
constructor(options: FeishuPlatformClientOptions) {
|
|
80
80
|
this.context = options.context;
|
|
81
|
-
this.rootPath = options.context.
|
|
81
|
+
this.rootPath = options.context.workspace_path;
|
|
82
82
|
this.logger = options.context.logger;
|
|
83
83
|
this.appId = options.config.appId;
|
|
84
84
|
this.appSecret = options.config.appSecret;
|
|
@@ -243,12 +243,12 @@ export class FeishuPlatformClient {
|
|
|
243
243
|
/**
|
|
244
244
|
* 给入站消息补一个轻量 ack reaction。
|
|
245
245
|
*/
|
|
246
|
-
async sendInboundAckReaction(params: {
|
|
247
|
-
const
|
|
248
|
-
if (!
|
|
246
|
+
async sendInboundAckReaction(params: { message_id?: string }): Promise<void> {
|
|
247
|
+
const message_id = String(params.message_id || "").trim();
|
|
248
|
+
if (!message_id || !this.client?.im?.v1?.messageReaction?.create) return;
|
|
249
249
|
try {
|
|
250
250
|
await this.client.im.v1.messageReaction.create({
|
|
251
|
-
path: { message_id:
|
|
251
|
+
path: { message_id: message_id },
|
|
252
252
|
data: {
|
|
253
253
|
reaction_type: {
|
|
254
254
|
emoji_type: FEISHU_INBOUND_ACK_REACTION_TYPE,
|
|
@@ -257,7 +257,7 @@ export class FeishuPlatformClient {
|
|
|
257
257
|
});
|
|
258
258
|
} catch (error) {
|
|
259
259
|
this.logger.warn("飞书入站 ack reaction 失败,继续处理消息", {
|
|
260
|
-
|
|
260
|
+
message_id,
|
|
261
261
|
reactionType: FEISHU_INBOUND_ACK_REACTION_TYPE,
|
|
262
262
|
error: String(error),
|
|
263
263
|
});
|
|
@@ -295,7 +295,7 @@ export class FeishuPlatformClient {
|
|
|
295
295
|
* 下载入站附件。
|
|
296
296
|
*/
|
|
297
297
|
async downloadIncomingAttachments(params: {
|
|
298
|
-
|
|
298
|
+
message_id: string;
|
|
299
299
|
attachments: FeishuIncomingAttachmentDescriptor[];
|
|
300
300
|
}): Promise<FeishuDownloadedAttachment[]> {
|
|
301
301
|
return downloadFeishuIncomingAttachments(this.getLookupDeps(), params);
|
|
@@ -307,10 +307,10 @@ export class FeishuPlatformClient {
|
|
|
307
307
|
async sendAttachment(
|
|
308
308
|
chatId: string,
|
|
309
309
|
chatType: string,
|
|
310
|
-
|
|
310
|
+
message_id: string | undefined,
|
|
311
311
|
attachment: ParsedFeishuAttachmentCommand,
|
|
312
312
|
): Promise<void> {
|
|
313
|
-
return sendFeishuAttachment(this.getMessagingDeps(), chatId, chatType,
|
|
313
|
+
return sendFeishuAttachment(this.getMessagingDeps(), chatId, chatType, message_id, attachment);
|
|
314
314
|
}
|
|
315
315
|
|
|
316
316
|
/**
|
|
@@ -319,7 +319,7 @@ export class FeishuPlatformClient {
|
|
|
319
319
|
async sendPlatformMessage(
|
|
320
320
|
chatId: string,
|
|
321
321
|
chatType: string,
|
|
322
|
-
|
|
322
|
+
message_id: string | undefined,
|
|
323
323
|
msgType: FeishuMessagePayloadType,
|
|
324
324
|
content: Record<string, unknown> | string,
|
|
325
325
|
): Promise<void> {
|
|
@@ -327,7 +327,7 @@ export class FeishuPlatformClient {
|
|
|
327
327
|
this.getMessagingDeps(),
|
|
328
328
|
chatId,
|
|
329
329
|
chatType,
|
|
330
|
-
|
|
330
|
+
message_id,
|
|
331
331
|
msgType,
|
|
332
332
|
content,
|
|
333
333
|
);
|
|
@@ -447,7 +447,7 @@ export async function resolveFeishuReplyContext(
|
|
|
447
447
|
const item = Array.isArray(payload?.data?.items) ? payload.data.items[0] : undefined;
|
|
448
448
|
if (!item) return undefined;
|
|
449
449
|
return buildFeishuReplyContext({
|
|
450
|
-
|
|
450
|
+
message_id:
|
|
451
451
|
typeof item.message_id === "string" ? item.message_id : parentMessageId,
|
|
452
452
|
messageType: item.msg_type,
|
|
453
453
|
...(typeof item.body?.content === "string"
|
|
@@ -472,7 +472,7 @@ export async function downloadFeishuIncomingAttachments(
|
|
|
472
472
|
/**
|
|
473
473
|
* 当前消息 ID。
|
|
474
474
|
*/
|
|
475
|
-
|
|
475
|
+
message_id: string;
|
|
476
476
|
/**
|
|
477
477
|
* 待下载附件列表。
|
|
478
478
|
*/
|
|
@@ -489,17 +489,17 @@ export async function downloadFeishuIncomingAttachments(
|
|
|
489
489
|
try {
|
|
490
490
|
const resource = await deps.client.im.v1.messageResource.get({
|
|
491
491
|
path: {
|
|
492
|
-
message_id: params.
|
|
492
|
+
message_id: params.message_id,
|
|
493
493
|
file_key: attachment.resourceKey,
|
|
494
494
|
},
|
|
495
495
|
params: {
|
|
496
|
-
type: attachment.
|
|
496
|
+
type: attachment.resource_type,
|
|
497
497
|
},
|
|
498
498
|
});
|
|
499
499
|
|
|
500
500
|
const fileName = buildFeishuInboundCacheFileName({
|
|
501
501
|
attachment,
|
|
502
|
-
|
|
502
|
+
message_id: params.message_id,
|
|
503
503
|
headers: resource.headers,
|
|
504
504
|
});
|
|
505
505
|
const outPath = path.join(dir, fileName);
|
|
@@ -511,9 +511,9 @@ export async function downloadFeishuIncomingAttachments(
|
|
|
511
511
|
});
|
|
512
512
|
} catch (error) {
|
|
513
513
|
deps.logger.warn("Failed to download incoming Feishu attachment", {
|
|
514
|
-
|
|
514
|
+
message_id: params.message_id,
|
|
515
515
|
resourceKey: attachment.resourceKey,
|
|
516
|
-
|
|
516
|
+
resource_type: attachment.resource_type,
|
|
517
517
|
error: String(error),
|
|
518
518
|
});
|
|
519
519
|
}
|
|
@@ -142,7 +142,7 @@ export async function sendFeishuPlatformMessage(
|
|
|
142
142
|
deps: FeishuMessagingDeps,
|
|
143
143
|
chatId: string,
|
|
144
144
|
chatType: string,
|
|
145
|
-
|
|
145
|
+
message_id: string | undefined,
|
|
146
146
|
msgType: FeishuMessagePayloadType,
|
|
147
147
|
content: Record<string, unknown> | string,
|
|
148
148
|
): Promise<void> {
|
|
@@ -152,10 +152,10 @@ export async function sendFeishuPlatformMessage(
|
|
|
152
152
|
const serializedContent =
|
|
153
153
|
typeof content === "string" ? content : JSON.stringify(content);
|
|
154
154
|
try {
|
|
155
|
-
if (chatType !== "p2p" &&
|
|
155
|
+
if (chatType !== "p2p" && message_id) {
|
|
156
156
|
await deps.client.im.v1.message.reply({
|
|
157
157
|
path: {
|
|
158
|
-
message_id:
|
|
158
|
+
message_id: message_id,
|
|
159
159
|
},
|
|
160
160
|
data: {
|
|
161
161
|
content: serializedContent,
|
|
@@ -194,25 +194,25 @@ export async function sendFeishuAttachment(
|
|
|
194
194
|
deps: FeishuMessagingDeps,
|
|
195
195
|
chatId: string,
|
|
196
196
|
chatType: string,
|
|
197
|
-
|
|
197
|
+
message_id: string | undefined,
|
|
198
198
|
attachment: ParsedFeishuAttachmentCommand,
|
|
199
199
|
): Promise<void> {
|
|
200
200
|
const localPath = await resolveAttachmentLocalPath(deps, attachment.pathOrUrl);
|
|
201
201
|
if (attachment.type === "photo") {
|
|
202
202
|
const imageKey = await uploadImageToFeishu(deps, localPath);
|
|
203
|
-
await sendFeishuPlatformMessage(deps, chatId, chatType,
|
|
203
|
+
await sendFeishuPlatformMessage(deps, chatId, chatType, message_id, "image", {
|
|
204
204
|
image_key: imageKey,
|
|
205
205
|
});
|
|
206
206
|
} else {
|
|
207
207
|
const fileKey = await uploadFileToFeishu(deps, localPath);
|
|
208
|
-
await sendFeishuPlatformMessage(deps, chatId, chatType,
|
|
208
|
+
await sendFeishuPlatformMessage(deps, chatId, chatType, message_id, "file", {
|
|
209
209
|
file_key: fileKey,
|
|
210
210
|
});
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
const caption = String(attachment.caption || "").trim();
|
|
214
214
|
if (caption) {
|
|
215
|
-
await sendFeishuPlatformMessage(deps, chatId, chatType,
|
|
215
|
+
await sendFeishuPlatformMessage(deps, chatId, chatType, message_id, "text", {
|
|
216
216
|
text: caption,
|
|
217
217
|
});
|
|
218
218
|
}
|
|
@@ -84,7 +84,7 @@ function buildDescriptor(
|
|
|
84
84
|
if (messageType === "image" && imageKey) {
|
|
85
85
|
return {
|
|
86
86
|
type: "photo",
|
|
87
|
-
|
|
87
|
+
resource_type: "image",
|
|
88
88
|
resourceKey: imageKey,
|
|
89
89
|
fileName: fileName || "image",
|
|
90
90
|
description: fileName || "image",
|
|
@@ -95,7 +95,7 @@ function buildDescriptor(
|
|
|
95
95
|
if (messageType === "file" && fileKey) {
|
|
96
96
|
return {
|
|
97
97
|
type: "document",
|
|
98
|
-
|
|
98
|
+
resource_type: "file",
|
|
99
99
|
resourceKey: fileKey,
|
|
100
100
|
...(fileName ? { fileName } : {}),
|
|
101
101
|
...(fileName ? { description: fileName } : {}),
|
|
@@ -106,7 +106,7 @@ function buildDescriptor(
|
|
|
106
106
|
if (messageType === "audio" && fileKey) {
|
|
107
107
|
return {
|
|
108
108
|
type: "audio",
|
|
109
|
-
|
|
109
|
+
resource_type: "audio",
|
|
110
110
|
resourceKey: fileKey,
|
|
111
111
|
fileName: fileName || "audio",
|
|
112
112
|
description: fileName || "audio",
|
|
@@ -117,7 +117,7 @@ function buildDescriptor(
|
|
|
117
117
|
if ((messageType === "media" || messageType === "video") && fileKey) {
|
|
118
118
|
return {
|
|
119
119
|
type: "video",
|
|
120
|
-
|
|
120
|
+
resource_type: messageType,
|
|
121
121
|
resourceKey: fileKey,
|
|
122
122
|
fileName: fileName || "video.mp4",
|
|
123
123
|
description: fileName || "video",
|
|
@@ -239,7 +239,7 @@ export function parseFeishuInboundMessage(params: {
|
|
|
239
239
|
*/
|
|
240
240
|
export function buildFeishuInboundCacheFileName(params: {
|
|
241
241
|
attachment: FeishuIncomingAttachmentDescriptor;
|
|
242
|
-
|
|
242
|
+
message_id: string;
|
|
243
243
|
headers?: Record<string, unknown>;
|
|
244
244
|
}): string {
|
|
245
245
|
const headers = params.headers || {};
|
|
@@ -256,6 +256,6 @@ export function buildFeishuInboundCacheFileName(params: {
|
|
|
256
256
|
extFromMimeType(contentType) ||
|
|
257
257
|
defaultExtByAttachmentType(params.attachment);
|
|
258
258
|
const baseWithoutExt = currentExt ? safeBase.slice(0, -currentExt.length) : safeBase;
|
|
259
|
-
const uniq = `${Date.now()}-${String(params.
|
|
259
|
+
const uniq = `${Date.now()}-${String(params.message_id || "").slice(0, 12) || "feishu"}`;
|
|
260
260
|
return `${uniq}-${baseWithoutExt}${ext}`;
|
|
261
261
|
}
|
|
@@ -104,7 +104,7 @@ function buildPostImageDescriptor(params: {
|
|
|
104
104
|
const description = readString(params.description);
|
|
105
105
|
return {
|
|
106
106
|
type: "photo",
|
|
107
|
-
|
|
107
|
+
resource_type: "image",
|
|
108
108
|
resourceKey: params.imageKey,
|
|
109
109
|
fileName: description || "image",
|
|
110
110
|
description: description || "image",
|
|
@@ -117,7 +117,7 @@ function buildPostImageDescriptor(params: {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
function buildPostFileDescriptor(params: {
|
|
120
|
-
|
|
120
|
+
resource_type: "file" | "audio" | "media" | "video";
|
|
121
121
|
resourceKey: string;
|
|
122
122
|
fileName?: string;
|
|
123
123
|
duration?: number;
|
|
@@ -126,12 +126,12 @@ function buildPostFileDescriptor(params: {
|
|
|
126
126
|
const fileName = readString(params.fileName);
|
|
127
127
|
return {
|
|
128
128
|
type:
|
|
129
|
-
params.
|
|
129
|
+
params.resource_type === "audio"
|
|
130
130
|
? "audio"
|
|
131
|
-
: params.
|
|
131
|
+
: params.resource_type === "media" || params.resource_type === "video"
|
|
132
132
|
? "video"
|
|
133
133
|
: "document",
|
|
134
|
-
|
|
134
|
+
resource_type: params.resource_type,
|
|
135
135
|
resourceKey: params.resourceKey,
|
|
136
136
|
...(fileName ? { fileName } : {}),
|
|
137
137
|
...(fileName ? { description: fileName } : {}),
|
|
@@ -217,7 +217,7 @@ function parsePostElement(params: {
|
|
|
217
217
|
if (fileKey) {
|
|
218
218
|
params.attachments.push(
|
|
219
219
|
buildPostFileDescriptor({
|
|
220
|
-
|
|
220
|
+
resource_type:
|
|
221
221
|
tag === "audio"
|
|
222
222
|
? "audio"
|
|
223
223
|
: tag === "file"
|
|
@@ -248,12 +248,12 @@ function parsePostElement(params: {
|
|
|
248
248
|
return "---";
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
-
const
|
|
251
|
+
const fallback_text =
|
|
252
252
|
readString(element.text) ||
|
|
253
253
|
readString(element.title) ||
|
|
254
254
|
readString(element.href) ||
|
|
255
255
|
readString(element.file_name);
|
|
256
|
-
if (
|
|
256
|
+
if (fallback_text) return fallback_text;
|
|
257
257
|
|
|
258
258
|
const fallbackImageKey = readString(element.image_key);
|
|
259
259
|
if (fallbackImageKey) {
|
|
@@ -47,12 +47,12 @@ function describeFeishuMessage(params: {
|
|
|
47
47
|
* 构造 Feishu reply 上下文。
|
|
48
48
|
*/
|
|
49
49
|
export function buildFeishuReplyContext(params: {
|
|
50
|
-
|
|
50
|
+
message_id?: string;
|
|
51
51
|
actorName?: string;
|
|
52
52
|
messageType?: string;
|
|
53
53
|
content?: string;
|
|
54
54
|
}): InboundReplyContext | undefined {
|
|
55
|
-
const
|
|
55
|
+
const message_id = String(params.message_id || "").trim();
|
|
56
56
|
const actorName = String(params.actorName || "").trim();
|
|
57
57
|
const text = describeFeishuMessage({
|
|
58
58
|
messageType: params.messageType,
|
|
@@ -61,7 +61,7 @@ export function buildFeishuReplyContext(params: {
|
|
|
61
61
|
|
|
62
62
|
if (!actorName && !text) return undefined;
|
|
63
63
|
return {
|
|
64
|
-
...(
|
|
64
|
+
...(message_id ? { message_id } : {}),
|
|
65
65
|
...(actorName ? { actorName } : {}),
|
|
66
66
|
...(text ? { text } : {}),
|
|
67
67
|
};
|
|
@@ -2,7 +2,7 @@ import type {
|
|
|
2
2
|
FeishuAttachmentType,
|
|
3
3
|
ParsedFeishuAttachmentCommand,
|
|
4
4
|
} from "@/chat/types/FeishuAttachment.js";
|
|
5
|
-
import {
|
|
5
|
+
import { parse_chat_message_markup } from "@downcity/agent";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Feishu channel 公共工具。
|
|
@@ -43,7 +43,7 @@ export function parseFeishuAttachments(text: string): {
|
|
|
43
43
|
}
|
|
44
44
|
>;
|
|
45
45
|
} {
|
|
46
|
-
const parsed =
|
|
46
|
+
const parsed = parse_chat_message_markup(text);
|
|
47
47
|
const attachments: ParsedFeishuAttachmentCommand[] = parsed.files.map((file) => ({
|
|
48
48
|
type: normalizeAttachmentType(file.type),
|
|
49
49
|
pathOrUrl: String(file.path || "").trim(),
|
|
@@ -87,7 +87,7 @@ export function parseFeishuAttachments(text: string): {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
return {
|
|
90
|
-
text: parsed.
|
|
90
|
+
text: parsed.body_text,
|
|
91
91
|
attachments,
|
|
92
92
|
segments,
|
|
93
93
|
};
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
// Source: src/chat/channels/qq/PROMPT.direct.ts.txt
|
|
7
|
-
const TEXT_MODULE_CONTENT = "# QQ Adapter Instructions (Direct Mode)\n\n## Capability Scope\n\n- Handles message ingress and sending for the official QQ bot gateway over WebSocket.\n- Inbound messages are mapped by the chat plugin runtime to an internal `
|
|
7
|
+
const TEXT_MODULE_CONTENT = "# QQ Adapter Instructions (Direct Mode)\n\n## Capability Scope\n\n- Handles message ingress and sending for the official QQ bot gateway over WebSocket.\n- Inbound messages are mapped by the chat plugin runtime to an internal `session_id`, which is randomly assigned and persisted.\n\n## Usage Constraints\n\n- In direct mode, your assistant text output is automatically sent to the current QQ conversation.\n- QQ outbound replies depend on inbound message context such as `chatType` and `message_id`. For cross-conversation sending, use chat plugin actions instead of writing `chat_key` in direct metadata.\n- Group messages are ingested in full by default and do not require an `@` mention.\n- The adapter filters bot self-loop messages and deduplicates inbound messages to avoid \"replying to itself\" loops.\n";
|
|
8
8
|
|
|
9
9
|
export default TEXT_MODULE_CONTENT;
|