@downcity/plugins 1.0.215 → 1.0.233
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
|
|
|
10
10
|
import type { Logger } from "@downcity/agent";
|
|
11
|
-
import type {
|
|
11
|
+
import type { PluginContext } from "@downcity/agent";
|
|
12
12
|
import type {
|
|
13
13
|
ChannelChatKeyParams,
|
|
14
14
|
IncomingChatAccessParams,
|
|
@@ -38,7 +38,7 @@ export type QqMessageActor = {
|
|
|
38
38
|
/**
|
|
39
39
|
* QQ 用户 ID / openid。
|
|
40
40
|
*/
|
|
41
|
-
|
|
41
|
+
user_id?: string;
|
|
42
42
|
/**
|
|
43
43
|
* QQ 用户展示名。
|
|
44
44
|
*/
|
|
@@ -52,7 +52,7 @@ export interface QQMessageHandlerOptions {
|
|
|
52
52
|
/**
|
|
53
53
|
* 当前 agent context。
|
|
54
54
|
*/
|
|
55
|
-
context:
|
|
55
|
+
context: PluginContext;
|
|
56
56
|
/**
|
|
57
57
|
* 项目根目录。
|
|
58
58
|
*/
|
|
@@ -66,7 +66,7 @@ export interface QQMessageHandlerOptions {
|
|
|
66
66
|
*/
|
|
67
67
|
getBotUserId(): string;
|
|
68
68
|
/**
|
|
69
|
-
* 计算 channel
|
|
69
|
+
* 计算 channel chat_key。
|
|
70
70
|
*/
|
|
71
71
|
getChatKey(params: ChannelChatKeyParams): string;
|
|
72
72
|
/** 入站 Chat Access 判定。 */
|
|
@@ -90,15 +90,15 @@ export interface QQMessageHandlerOptions {
|
|
|
90
90
|
*/
|
|
91
91
|
shouldSkipDuplicatedInboundMessage(
|
|
92
92
|
eventType: string,
|
|
93
|
-
|
|
93
|
+
message_id: string | undefined,
|
|
94
94
|
): Promise<boolean>;
|
|
95
95
|
/**
|
|
96
96
|
* Audit 队列写入。
|
|
97
97
|
*/
|
|
98
98
|
enqueueAuditMessage(params: {
|
|
99
99
|
chatId: string;
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
message_id?: string;
|
|
101
|
+
user_id?: string;
|
|
102
102
|
text: string;
|
|
103
103
|
meta?: ChannelUserMessageMeta;
|
|
104
104
|
}): Promise<void>;
|
|
@@ -108,7 +108,7 @@ export interface QQMessageHandlerOptions {
|
|
|
108
108
|
handleCommand(params: {
|
|
109
109
|
chatId: string;
|
|
110
110
|
chatType: string;
|
|
111
|
-
|
|
111
|
+
message_id: string;
|
|
112
112
|
command: string;
|
|
113
113
|
}): Promise<void>;
|
|
114
114
|
/**
|
|
@@ -117,7 +117,7 @@ export interface QQMessageHandlerOptions {
|
|
|
117
117
|
executeAndReply(params: {
|
|
118
118
|
chatId: string;
|
|
119
119
|
chatType: string;
|
|
120
|
-
|
|
120
|
+
message_id: string;
|
|
121
121
|
instructions: string;
|
|
122
122
|
actor?: QqMessageActor;
|
|
123
123
|
chatTitle?: string;
|
|
@@ -140,15 +140,15 @@ export async function handleQqGroupMessage(
|
|
|
140
140
|
): Promise<void> {
|
|
141
141
|
const eventType = String(params.eventType || "").trim();
|
|
142
142
|
const data = params.data;
|
|
143
|
-
const
|
|
143
|
+
const message_id =
|
|
144
144
|
typeof data.id === "string" ? data.id.trim() : String(data.id || "").trim();
|
|
145
|
-
if (!
|
|
145
|
+
if (!message_id) return;
|
|
146
146
|
|
|
147
147
|
const groupId = resolveQqGroupChatId(data);
|
|
148
148
|
if (!groupId) {
|
|
149
149
|
options.logger.warn("QQ 群消息缺少 groupId,已忽略", {
|
|
150
150
|
eventType: eventType || EventType.GROUP_MESSAGE_CREATE,
|
|
151
|
-
|
|
151
|
+
message_id,
|
|
152
152
|
});
|
|
153
153
|
return;
|
|
154
154
|
}
|
|
@@ -168,19 +168,19 @@ export async function handleQqC2CMessage(
|
|
|
168
168
|
options: QQMessageHandlerOptions,
|
|
169
169
|
data: QQMessageData,
|
|
170
170
|
): Promise<void> {
|
|
171
|
-
const
|
|
171
|
+
const message_id =
|
|
172
172
|
typeof data.id === "string" ? data.id.trim() : String(data.id || "").trim();
|
|
173
|
-
if (!
|
|
173
|
+
if (!message_id) return;
|
|
174
174
|
|
|
175
175
|
const actor = extractQqAuthorIdentity(data.author, data);
|
|
176
176
|
const chatId = resolveQqC2cChatId({
|
|
177
177
|
data,
|
|
178
|
-
|
|
178
|
+
actor_user_id: actor.user_id,
|
|
179
179
|
});
|
|
180
180
|
if (!chatId) {
|
|
181
|
-
options.logger.warn("QQ C2C 消息缺少
|
|
181
|
+
options.logger.warn("QQ C2C 消息缺少 user_id,已忽略", {
|
|
182
182
|
eventType: EventType.C2C_MESSAGE_CREATE,
|
|
183
|
-
|
|
183
|
+
message_id,
|
|
184
184
|
});
|
|
185
185
|
return;
|
|
186
186
|
}
|
|
@@ -201,13 +201,13 @@ export async function handleQqChannelMessage(
|
|
|
201
201
|
options: QQMessageHandlerOptions,
|
|
202
202
|
data: QQMessageData,
|
|
203
203
|
): Promise<void> {
|
|
204
|
-
const { id:
|
|
205
|
-
if (!channelId || !
|
|
204
|
+
const { id: message_id, channel_id: channelId, content, author } = data;
|
|
205
|
+
if (!channelId || !message_id) return;
|
|
206
206
|
const chatType = "channel";
|
|
207
207
|
if (
|
|
208
208
|
await options.shouldSkipDuplicatedInboundMessage(
|
|
209
209
|
EventType.AT_MESSAGE_CREATE,
|
|
210
|
-
|
|
210
|
+
message_id,
|
|
211
211
|
)
|
|
212
212
|
) {
|
|
213
213
|
return;
|
|
@@ -226,15 +226,15 @@ export async function handleQqChannelMessage(
|
|
|
226
226
|
chatId: channelId,
|
|
227
227
|
chatType,
|
|
228
228
|
chatTitle,
|
|
229
|
-
|
|
229
|
+
user_id: actor.user_id,
|
|
230
230
|
username: actor.username,
|
|
231
231
|
});
|
|
232
232
|
if (!access_result.allowed) return;
|
|
233
233
|
|
|
234
234
|
const botUserId = options.getBotUserId();
|
|
235
|
-
if (actor.
|
|
235
|
+
if (actor.user_id && botUserId && actor.user_id === botUserId) {
|
|
236
236
|
options.logger.debug("忽略机器人自身消息(channel)", {
|
|
237
|
-
|
|
237
|
+
message_id,
|
|
238
238
|
channelId,
|
|
239
239
|
botUserId,
|
|
240
240
|
});
|
|
@@ -247,7 +247,7 @@ export async function handleQqChannelMessage(
|
|
|
247
247
|
await options.handleCommand({
|
|
248
248
|
chatId: channelId,
|
|
249
249
|
chatType: "channel",
|
|
250
|
-
|
|
250
|
+
message_id,
|
|
251
251
|
command: userMessage,
|
|
252
252
|
});
|
|
253
253
|
return;
|
|
@@ -257,8 +257,8 @@ export async function handleQqChannelMessage(
|
|
|
257
257
|
context: options.context,
|
|
258
258
|
rootPath: options.rootPath,
|
|
259
259
|
chatId: channelId,
|
|
260
|
-
|
|
261
|
-
|
|
260
|
+
chat_key: options.getChatKey({ chatId: channelId, chatType }),
|
|
261
|
+
message_id,
|
|
262
262
|
userMessage,
|
|
263
263
|
attachments: incomingAttachments,
|
|
264
264
|
getAuthToken: () => options.getAuthToken(),
|
|
@@ -268,7 +268,7 @@ export async function handleQqChannelMessage(
|
|
|
268
268
|
await options.executeAndReply({
|
|
269
269
|
chatId: channelId,
|
|
270
270
|
chatType: "channel",
|
|
271
|
-
|
|
271
|
+
message_id,
|
|
272
272
|
instructions,
|
|
273
273
|
actor,
|
|
274
274
|
chatTitle,
|
|
@@ -290,24 +290,24 @@ async function handleQqInboundMessage(
|
|
|
290
290
|
): Promise<void> {
|
|
291
291
|
const eventType = String(params.eventType || "").trim();
|
|
292
292
|
const chatId = String(params.chatId || "").trim();
|
|
293
|
-
const
|
|
293
|
+
const message_id =
|
|
294
294
|
typeof params.data.id === "string"
|
|
295
295
|
? params.data.id.trim()
|
|
296
296
|
: String(params.data.id || "").trim();
|
|
297
|
-
if (!chatId || !
|
|
297
|
+
if (!chatId || !message_id) return;
|
|
298
298
|
|
|
299
|
-
if (await options.shouldSkipDuplicatedInboundMessage(eventType,
|
|
299
|
+
if (await options.shouldSkipDuplicatedInboundMessage(eventType, message_id)) {
|
|
300
300
|
return;
|
|
301
301
|
}
|
|
302
302
|
|
|
303
303
|
const actor = params.actor || extractQqAuthorIdentity(params.data.author, params.data);
|
|
304
304
|
const chatType = params.chatType;
|
|
305
|
-
if (!actor.
|
|
306
|
-
options.logger.warn("QQ 入站消息缺少发送者
|
|
305
|
+
if (!actor.user_id) {
|
|
306
|
+
options.logger.warn("QQ 入站消息缺少发送者 user_id,已忽略", {
|
|
307
307
|
eventType,
|
|
308
308
|
chatId,
|
|
309
309
|
chatType,
|
|
310
|
-
|
|
310
|
+
message_id,
|
|
311
311
|
});
|
|
312
312
|
return;
|
|
313
313
|
}
|
|
@@ -318,7 +318,7 @@ async function handleQqInboundMessage(
|
|
|
318
318
|
actorName: actor.username,
|
|
319
319
|
});
|
|
320
320
|
const isGroup = chatType === "group";
|
|
321
|
-
const
|
|
321
|
+
const chat_key = options.getChatKey({ chatId, chatType });
|
|
322
322
|
const rawContent = String(params.data.content || "");
|
|
323
323
|
const incomingAttachments = extractQqInboundAttachments(params.data);
|
|
324
324
|
const hasIncomingAttachment = incomingAttachments.length > 0;
|
|
@@ -331,7 +331,7 @@ async function handleQqInboundMessage(
|
|
|
331
331
|
chatId,
|
|
332
332
|
chatType,
|
|
333
333
|
chatTitle,
|
|
334
|
-
|
|
334
|
+
user_id: actor.user_id,
|
|
335
335
|
username: actor.username,
|
|
336
336
|
});
|
|
337
337
|
if (!access_result.allowed) {
|
|
@@ -348,8 +348,8 @@ async function handleQqInboundMessage(
|
|
|
348
348
|
const enqueueAudit = async (opts: { reason: string; kind?: string }): Promise<void> => {
|
|
349
349
|
await options.enqueueAuditMessage({
|
|
350
350
|
chatId,
|
|
351
|
-
|
|
352
|
-
|
|
351
|
+
message_id,
|
|
352
|
+
user_id: actor.user_id,
|
|
353
353
|
text: buildQqAuditText({
|
|
354
354
|
rawContent,
|
|
355
355
|
cleanedText,
|
|
@@ -366,12 +366,12 @@ async function handleQqInboundMessage(
|
|
|
366
366
|
});
|
|
367
367
|
};
|
|
368
368
|
|
|
369
|
-
if (actor.
|
|
369
|
+
if (actor.user_id && botUserId && actor.user_id === botUserId) {
|
|
370
370
|
if (isGroup) {
|
|
371
371
|
await enqueueAudit({ reason: "bot_originated" });
|
|
372
372
|
}
|
|
373
373
|
options.logger.debug("忽略机器人自身消息", {
|
|
374
|
-
|
|
374
|
+
message_id,
|
|
375
375
|
chatId,
|
|
376
376
|
chatType,
|
|
377
377
|
botUserId,
|
|
@@ -396,7 +396,7 @@ async function handleQqInboundMessage(
|
|
|
396
396
|
await options.handleCommand({
|
|
397
397
|
chatId,
|
|
398
398
|
chatType,
|
|
399
|
-
|
|
399
|
+
message_id,
|
|
400
400
|
command: cleanedText,
|
|
401
401
|
});
|
|
402
402
|
return;
|
|
@@ -411,8 +411,8 @@ async function handleQqInboundMessage(
|
|
|
411
411
|
context: options.context,
|
|
412
412
|
rootPath: options.rootPath,
|
|
413
413
|
chatId,
|
|
414
|
-
|
|
415
|
-
|
|
414
|
+
chat_key,
|
|
415
|
+
message_id,
|
|
416
416
|
userMessage: cleanedText,
|
|
417
417
|
attachments: incomingAttachments,
|
|
418
418
|
getAuthToken: () => options.getAuthToken(),
|
|
@@ -425,7 +425,7 @@ async function handleQqInboundMessage(
|
|
|
425
425
|
await options.executeAndReply({
|
|
426
426
|
chatId,
|
|
427
427
|
chatType,
|
|
428
|
-
|
|
428
|
+
message_id,
|
|
429
429
|
instructions,
|
|
430
430
|
actor,
|
|
431
431
|
chatTitle,
|
|
@@ -75,9 +75,9 @@ export function isRetryableQqSendFailure(errorText: string): boolean {
|
|
|
75
75
|
*/
|
|
76
76
|
export async function waitBeforeQqSendRetry(attempt: number): Promise<void> {
|
|
77
77
|
const safeAttempt = Number.isFinite(attempt) && attempt > 0 ? Math.trunc(attempt) : 1;
|
|
78
|
-
const
|
|
78
|
+
const delay_ms = Math.min(4000, 600 * 2 ** (safeAttempt - 1));
|
|
79
79
|
const jitterMs = Math.floor(Math.random() * 180);
|
|
80
|
-
await sleepMs(
|
|
80
|
+
await sleepMs(delay_ms + jitterMs);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
/**
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { buildChatInboundText, augmentChatInboundInput } from "@/chat/runtime/InboundAugment.js";
|
|
10
|
-
import type {
|
|
10
|
+
import type { PluginContext } from "@downcity/agent";
|
|
11
11
|
import type { JsonObject } from "@downcity/agent";
|
|
12
12
|
import type { QQMessageData, QQReadyUser } from "@/chat/channels/qq/types/QqChannel.js";
|
|
13
13
|
import type { QqIncomingAttachment } from "@/chat/types/QqVoice.js";
|
|
@@ -52,7 +52,7 @@ export interface BuildQqInboundInstructionsParams {
|
|
|
52
52
|
/**
|
|
53
53
|
* 当前执行上下文。
|
|
54
54
|
*/
|
|
55
|
-
context:
|
|
55
|
+
context: PluginContext;
|
|
56
56
|
/**
|
|
57
57
|
* 项目根目录。
|
|
58
58
|
*/
|
|
@@ -64,11 +64,11 @@ export interface BuildQqInboundInstructionsParams {
|
|
|
64
64
|
/**
|
|
65
65
|
* chat queue key。
|
|
66
66
|
*/
|
|
67
|
-
|
|
67
|
+
chat_key: string;
|
|
68
68
|
/**
|
|
69
69
|
* 当前消息 id。
|
|
70
70
|
*/
|
|
71
|
-
|
|
71
|
+
message_id: string;
|
|
72
72
|
/**
|
|
73
73
|
* 用户文本。
|
|
74
74
|
*/
|
|
@@ -185,11 +185,11 @@ export function resolveQqGroupChatId(data: QQMessageData): string {
|
|
|
185
185
|
*/
|
|
186
186
|
export function resolveQqC2cChatId(params: {
|
|
187
187
|
data: QQMessageData;
|
|
188
|
-
|
|
188
|
+
actor_user_id?: string;
|
|
189
189
|
}): string {
|
|
190
|
-
const { data,
|
|
190
|
+
const { data, actor_user_id } = params;
|
|
191
191
|
return [
|
|
192
|
-
|
|
192
|
+
actor_user_id,
|
|
193
193
|
data.user_openid,
|
|
194
194
|
data.openid,
|
|
195
195
|
data.author_id,
|
|
@@ -252,10 +252,10 @@ export async function buildQqInboundInstructions(
|
|
|
252
252
|
input: {
|
|
253
253
|
channel: "qq",
|
|
254
254
|
chatId: params.chatId,
|
|
255
|
-
|
|
256
|
-
|
|
255
|
+
chat_key: params.chat_key,
|
|
256
|
+
message_id: params.message_id,
|
|
257
257
|
rootPath: params.rootPath,
|
|
258
|
-
|
|
258
|
+
body_text: text || undefined,
|
|
259
259
|
attachments: resolvedAttachments,
|
|
260
260
|
},
|
|
261
261
|
}),
|
|
@@ -40,9 +40,9 @@ export class TelegramApiClient {
|
|
|
40
40
|
private readonly rootPath: string;
|
|
41
41
|
private readonly logger: Logger;
|
|
42
42
|
|
|
43
|
-
constructor(opts: { botToken: string;
|
|
43
|
+
constructor(opts: { botToken: string; project_root: string; logger: Logger }) {
|
|
44
44
|
this.botToken = opts.botToken;
|
|
45
|
-
this.rootPath = opts.
|
|
45
|
+
this.rootPath = opts.project_root;
|
|
46
46
|
this.logger = opts.logger;
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -134,7 +134,7 @@ export class TelegramApiClient {
|
|
|
134
134
|
throw error;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
const
|
|
137
|
+
const delay_ms =
|
|
138
138
|
TELEGRAM_SEND_RETRY_DELAYS_MS[attempt] ||
|
|
139
139
|
TELEGRAM_SEND_RETRY_DELAYS_MS[
|
|
140
140
|
TELEGRAM_SEND_RETRY_DELAYS_MS.length - 1
|
|
@@ -142,10 +142,10 @@ export class TelegramApiClient {
|
|
|
142
142
|
this.logger.warn("Telegram send failed, retrying", {
|
|
143
143
|
method,
|
|
144
144
|
attempt: attempt + 1,
|
|
145
|
-
retryInMs:
|
|
145
|
+
retryInMs: delay_ms,
|
|
146
146
|
error: String(error),
|
|
147
147
|
});
|
|
148
|
-
await sleep(
|
|
148
|
+
await sleep(delay_ms);
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
|
|
@@ -344,7 +344,7 @@ export class TelegramApiClient {
|
|
|
344
344
|
*/
|
|
345
345
|
async setMessageReaction(
|
|
346
346
|
chatId: string,
|
|
347
|
-
|
|
347
|
+
message_id: number,
|
|
348
348
|
opts?: { emoji?: string; isBig?: boolean },
|
|
349
349
|
): Promise<void> {
|
|
350
350
|
const emoji =
|
|
@@ -353,7 +353,7 @@ export class TelegramApiClient {
|
|
|
353
353
|
: "👍";
|
|
354
354
|
await this.requestJson("setMessageReaction", {
|
|
355
355
|
chat_id: chatId,
|
|
356
|
-
message_id:
|
|
356
|
+
message_id: message_id,
|
|
357
357
|
reaction: [{ type: "emoji", emoji }],
|
|
358
358
|
...(opts?.isBig === true ? { is_big: true } : {}),
|
|
359
359
|
});
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* 关键点(中文)
|
|
5
5
|
* - `TelegramBot` 只保留入站授权、命令分发、消息入队与回复编排。
|
|
6
6
|
* - polling、runtime 状态、webhook 清理、自愈重试已下沉到 `TelegramPlatformClient`。
|
|
7
|
-
* -
|
|
7
|
+
* - chat_key / audit / mention 清理 / 附件保存已下沉到 `TelegramInbound`。
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { BaseChatChannel } from "@/chat/channels/BaseChatChannel.js";
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
type TelegramUpdate,
|
|
23
23
|
type TelegramUser,
|
|
24
24
|
} from "./Shared.js";
|
|
25
|
-
import type {
|
|
25
|
+
import type { PluginContext } from "@downcity/agent";
|
|
26
26
|
import type { JsonObject } from "@downcity/agent";
|
|
27
27
|
import type { ChatChannelTestResult } from "@/chat/types/ChannelStatus.js";
|
|
28
28
|
import {
|
|
@@ -50,7 +50,7 @@ export class TelegramBot extends BaseChatChannel {
|
|
|
50
50
|
private startTask: Promise<void> | null = null;
|
|
51
51
|
private startupGeneration = 0;
|
|
52
52
|
|
|
53
|
-
constructor(context:
|
|
53
|
+
constructor(context: PluginContext, botToken: string) {
|
|
54
54
|
super({ channel: "telegram", context });
|
|
55
55
|
this.botToken = botToken;
|
|
56
56
|
this.platform = new TelegramPlatformClient({
|
|
@@ -99,8 +99,8 @@ export class TelegramBot extends BaseChatChannel {
|
|
|
99
99
|
params: ChannelSendTextParams,
|
|
100
100
|
): Promise<void> {
|
|
101
101
|
const replyToMessageId =
|
|
102
|
-
params.
|
|
103
|
-
? parseTelegramMessageId(params.
|
|
102
|
+
params.reply_to_message === true
|
|
103
|
+
? parseTelegramMessageId(params.message_id)
|
|
104
104
|
: undefined;
|
|
105
105
|
await this.sendMessage(params.chatId, params.text, {
|
|
106
106
|
messageThreadId: params.messageThreadId,
|
|
@@ -122,13 +122,13 @@ export class TelegramBot extends BaseChatChannel {
|
|
|
122
122
|
}
|
|
123
123
|
if (params.action !== "react") return;
|
|
124
124
|
|
|
125
|
-
const
|
|
126
|
-
if (!
|
|
125
|
+
const message_id = parseTelegramMessageId(params.message_id);
|
|
126
|
+
if (!message_id) {
|
|
127
127
|
throw new Error(
|
|
128
|
-
"Telegram reaction requires a numeric
|
|
128
|
+
"Telegram reaction requires a numeric message_id. Provide --message-id or ensure chat meta has latest message_id.",
|
|
129
129
|
);
|
|
130
130
|
}
|
|
131
|
-
await this.platform.setMessageReaction(params.chatId,
|
|
131
|
+
await this.platform.setMessageReaction(params.chatId, message_id, {
|
|
132
132
|
emoji: params.reactionEmoji,
|
|
133
133
|
isBig: params.reactionIsBig === true,
|
|
134
134
|
});
|
|
@@ -240,8 +240,8 @@ export class TelegramBot extends BaseChatChannel {
|
|
|
240
240
|
enqueueAuditMessage: async (params) => {
|
|
241
241
|
await this.enqueueAuditMessage(params);
|
|
242
242
|
},
|
|
243
|
-
runInChat: async (
|
|
244
|
-
await this.runInChat(
|
|
243
|
+
runInChat: async (chat_key, fn) => {
|
|
244
|
+
await this.runInChat(chat_key, fn);
|
|
245
245
|
},
|
|
246
246
|
handleCommand: async (params) => {
|
|
247
247
|
await this.handleCommand(
|
|
@@ -257,7 +257,7 @@ export class TelegramBot extends BaseChatChannel {
|
|
|
257
257
|
params.instructions,
|
|
258
258
|
params.from,
|
|
259
259
|
params.chatTitle,
|
|
260
|
-
params.
|
|
260
|
+
params.message_id,
|
|
261
261
|
params.chatType,
|
|
262
262
|
params.messageThreadId,
|
|
263
263
|
params.receivedAt,
|
|
@@ -328,22 +328,22 @@ export class TelegramBot extends BaseChatChannel {
|
|
|
328
328
|
instructions: string,
|
|
329
329
|
from?: TelegramUser,
|
|
330
330
|
chatTitle?: string,
|
|
331
|
-
|
|
331
|
+
message_id?: string,
|
|
332
332
|
chatType?: NonNullable<TelegramUpdate["message"]>["chat"]["type"],
|
|
333
333
|
messageThreadId?: number,
|
|
334
334
|
receivedAt?: string,
|
|
335
335
|
extra?: JsonObject,
|
|
336
336
|
): Promise<void> {
|
|
337
337
|
try {
|
|
338
|
-
const
|
|
338
|
+
const user_id = from?.id ? String(from.id) : undefined;
|
|
339
339
|
const username = from?.username ? String(from.username) : undefined;
|
|
340
340
|
await this.enqueueMessage({
|
|
341
341
|
chatId,
|
|
342
342
|
text: instructions,
|
|
343
343
|
chatType,
|
|
344
|
-
|
|
344
|
+
message_id,
|
|
345
345
|
messageThreadId,
|
|
346
|
-
|
|
346
|
+
user_id,
|
|
347
347
|
username,
|
|
348
348
|
receivedAt,
|
|
349
349
|
chatTitle,
|
|
@@ -393,7 +393,7 @@ export class TelegramBot extends BaseChatChannel {
|
|
|
393
393
|
*/
|
|
394
394
|
export function createTelegramBot(
|
|
395
395
|
config: TelegramConfig,
|
|
396
|
-
context:
|
|
396
|
+
context: PluginContext,
|
|
397
397
|
): TelegramBot | null {
|
|
398
398
|
if (!config.enabled || !config.botToken || config.botToken === "${}") {
|
|
399
399
|
return null;
|
|
@@ -70,8 +70,8 @@ export class TelegramBotInfoProvider implements ChatChannelBotInfoProvider {
|
|
|
70
70
|
const fullName = [firstName, lastName].filter(Boolean).join(" ").trim();
|
|
71
71
|
|
|
72
72
|
const name = pickFirstNonEmpty([
|
|
73
|
-
username ? `@${username.replace(/^@+/, "")}` : "",
|
|
74
73
|
fullName,
|
|
74
|
+
username ? `@${username.replace(/^@+/, "")}` : "",
|
|
75
75
|
botUserId ? `Telegram Bot ${botUserId.slice(-6)}` : "",
|
|
76
76
|
"Telegram Bot",
|
|
77
77
|
]);
|
|
@@ -57,7 +57,7 @@ export function extractTelegramReplyContext(
|
|
|
57
57
|
const replied = message?.reply_to_message;
|
|
58
58
|
if (!replied) return undefined;
|
|
59
59
|
|
|
60
|
-
const
|
|
60
|
+
const message_id =
|
|
61
61
|
typeof replied.message_id === "number" && Number.isFinite(replied.message_id)
|
|
62
62
|
? String(replied.message_id)
|
|
63
63
|
: undefined;
|
|
@@ -66,9 +66,9 @@ export function extractTelegramReplyContext(
|
|
|
66
66
|
const quoteText =
|
|
67
67
|
typeof message?.quote?.text === "string" ? message.quote.text.trim() : undefined;
|
|
68
68
|
|
|
69
|
-
if (!
|
|
69
|
+
if (!message_id && !actorName && !text && !quoteText) return undefined;
|
|
70
70
|
return {
|
|
71
|
-
...(
|
|
71
|
+
...(message_id ? { message_id } : {}),
|
|
72
72
|
...(actorName ? { actorName } : {}),
|
|
73
73
|
...(text ? { text } : {}),
|
|
74
74
|
...(quoteText ? { quoteText } : {}),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import {
|
|
2
|
+
import { parse_chat_message_markup } from "@downcity/agent";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Telegram 集成配置。
|
|
@@ -257,7 +257,7 @@ export function parseTelegramAttachments(text: string): {
|
|
|
257
257
|
}
|
|
258
258
|
>;
|
|
259
259
|
} {
|
|
260
|
-
const parsed =
|
|
260
|
+
const parsed = parse_chat_message_markup(text);
|
|
261
261
|
const attachments: Array<{
|
|
262
262
|
type: TelegramAttachmentType;
|
|
263
263
|
pathOrUrl: string;
|
|
@@ -336,7 +336,7 @@ export function parseTelegramAttachments(text: string): {
|
|
|
336
336
|
});
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
-
return { text: parsed.
|
|
339
|
+
return { text: parsed.body_text, attachments, segments };
|
|
340
340
|
}
|
|
341
341
|
|
|
342
342
|
function formatActorName(name: string): string {
|
|
@@ -19,8 +19,8 @@ import type { JsonObject } from "@downcity/agent";
|
|
|
19
19
|
export class TelegramStateStore {
|
|
20
20
|
private readonly lastUpdateIdFile: string;
|
|
21
21
|
|
|
22
|
-
constructor(
|
|
23
|
-
const dir = path.join(
|
|
22
|
+
constructor(project_root: string) {
|
|
23
|
+
const dir = path.join(project_root, ".downcity", ".cache", "telegram");
|
|
24
24
|
this.lastUpdateIdFile = path.join(dir, "lastUpdateId.json");
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* TelegramInbound:Telegram 入站辅助逻辑。
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
|
-
* - 只负责消息 ID 解析、
|
|
5
|
+
* - 只负责消息 ID 解析、chat_key 构造、审计文本、mention 清理、附件保存。
|
|
6
6
|
* - 不承担授权、命令分发、消息入队等主流程职责。
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import type { TelegramAttachmentType, TelegramUpdate } from "./Shared.js";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* 构建 lane 维度
|
|
12
|
+
* 构建 lane 维度 chat_key。
|
|
13
13
|
*/
|
|
14
14
|
export function buildTelegramChatKey(
|
|
15
15
|
chatId: string,
|
|
@@ -28,8 +28,8 @@ export function buildTelegramChatKey(
|
|
|
28
28
|
/**
|
|
29
29
|
* 解析 Telegram 消息 ID。
|
|
30
30
|
*/
|
|
31
|
-
export function parseTelegramMessageId(
|
|
32
|
-
const raw = String(
|
|
31
|
+
export function parseTelegramMessageId(message_id?: string): number | undefined {
|
|
32
|
+
const raw = String(message_id || "").trim();
|
|
33
33
|
if (!raw || !/^\d+$/.test(raw)) return undefined;
|
|
34
34
|
const parsed = Number.parseInt(raw, 10);
|
|
35
35
|
if (!Number.isFinite(parsed) || Number.isNaN(parsed) || parsed <= 0) {
|