@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
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* - 本模块不处理配置持久化,也不负责 action 输入输出包装。
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import type {
|
|
10
|
+
import type { PluginContext } from "@downcity/agent";
|
|
11
11
|
import type { ChatChannelState } from "@/chat/types/ChatRuntime.js";
|
|
12
12
|
import type { ChatChannelName } from "@/chat/types/ChannelStatus.js";
|
|
13
13
|
import { createTelegramBot } from "@/chat/channels/telegram/Bot.js";
|
|
@@ -44,7 +44,7 @@ async function createFeishuBotLazy(
|
|
|
44
44
|
*/
|
|
45
45
|
domain: string;
|
|
46
46
|
},
|
|
47
|
-
context:
|
|
47
|
+
context: PluginContext,
|
|
48
48
|
) {
|
|
49
49
|
const module_value = await import("@/chat/channels/feishu/Feishu.js");
|
|
50
50
|
return await module_value.createFeishuBot(options, context);
|
|
@@ -52,12 +52,12 @@ async function createFeishuBotLazy(
|
|
|
52
52
|
|
|
53
53
|
async function startTelegramChannel(
|
|
54
54
|
state: ChatChannelState,
|
|
55
|
-
context:
|
|
55
|
+
context: PluginContext,
|
|
56
56
|
): Promise<void> {
|
|
57
57
|
if (!isChatChannelEnabled(context, "telegram")) return;
|
|
58
58
|
context.logger.info("Telegram channel enabled");
|
|
59
59
|
const account = resolveChannelAccount(context, "telegram");
|
|
60
|
-
const token = String(account?.
|
|
60
|
+
const token = String(account?.bot_token || "").trim();
|
|
61
61
|
if (!token) return;
|
|
62
62
|
state.telegram = createTelegramBot(
|
|
63
63
|
{
|
|
@@ -73,13 +73,13 @@ async function startTelegramChannel(
|
|
|
73
73
|
|
|
74
74
|
async function startFeishuChannel(
|
|
75
75
|
state: ChatChannelState,
|
|
76
|
-
context:
|
|
76
|
+
context: PluginContext,
|
|
77
77
|
): Promise<void> {
|
|
78
78
|
if (!isChatChannelEnabled(context, "feishu")) return;
|
|
79
79
|
context.logger.info("Feishu channel enabled");
|
|
80
80
|
const account = resolveChannelAccount(context, "feishu");
|
|
81
|
-
const appId = String(account?.
|
|
82
|
-
const appSecret = String(account?.
|
|
81
|
+
const appId = String(account?.app_id || "").trim();
|
|
82
|
+
const appSecret = String(account?.app_secret || "").trim();
|
|
83
83
|
if (!appId || !appSecret) return;
|
|
84
84
|
state.feishu = await createFeishuBotLazy(
|
|
85
85
|
{
|
|
@@ -97,13 +97,13 @@ async function startFeishuChannel(
|
|
|
97
97
|
|
|
98
98
|
async function startQQChannel(
|
|
99
99
|
state: ChatChannelState,
|
|
100
|
-
context:
|
|
100
|
+
context: PluginContext,
|
|
101
101
|
): Promise<void> {
|
|
102
102
|
if (!isChatChannelEnabled(context, "qq")) return;
|
|
103
103
|
context.logger.info("QQ chat platform enabled");
|
|
104
104
|
const account = resolveChannelAccount(context, "qq");
|
|
105
|
-
const appId = String(account?.
|
|
106
|
-
const appSecret = String(account?.
|
|
105
|
+
const appId = String(account?.app_id || "").trim();
|
|
106
|
+
const appSecret = String(account?.app_secret || "").trim();
|
|
107
107
|
if (!appId || !appSecret) return;
|
|
108
108
|
state.qq = await createQQBot(
|
|
109
109
|
{
|
|
@@ -124,7 +124,7 @@ async function startQQChannel(
|
|
|
124
124
|
*/
|
|
125
125
|
export async function startSingleChatChannel(
|
|
126
126
|
state: ChatChannelState,
|
|
127
|
-
context:
|
|
127
|
+
context: PluginContext,
|
|
128
128
|
channel: ChatChannelName,
|
|
129
129
|
): Promise<void> {
|
|
130
130
|
if (channel === "telegram") {
|
|
@@ -169,7 +169,7 @@ export async function stopSingleChatChannel(
|
|
|
169
169
|
*/
|
|
170
170
|
export async function startChatChannels(
|
|
171
171
|
state: ChatChannelState,
|
|
172
|
-
context:
|
|
172
|
+
context: PluginContext,
|
|
173
173
|
): Promise<void> {
|
|
174
174
|
if (state.telegram || state.feishu || state.qq) {
|
|
175
175
|
await stopChatChannels(state);
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
* ChatHistoryStore:聊天事件流持久化。
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
|
-
* - 写入 `.downcity/chat/<
|
|
5
|
+
* - 写入 `.downcity/chat/<session_id>/history.jsonl`(append-only)。
|
|
6
6
|
* - 记录 inbound(audit/exec)与 outbound 事件。
|
|
7
7
|
* - 与 session message history 分离,避免审计噪声进入模型上下文。
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import fs from "fs-extra";
|
|
11
11
|
import path from "node:path";
|
|
12
|
-
import {
|
|
13
|
-
import type {
|
|
12
|
+
import { generate_id } from "@downcity/agent";
|
|
13
|
+
import type { PluginContext } from "@downcity/agent";
|
|
14
14
|
import { get_chat_history_path } from "@/chat/runtime/ChatStorage.js";
|
|
15
15
|
import type { JsonObject } from "@downcity/agent";
|
|
16
16
|
import type { ChatDispatchChannel } from "@/chat/types/ChatDispatcher.js";
|
|
@@ -41,31 +41,31 @@ function toOptionalObject(value: JsonObject | undefined): JsonObject | undefined
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
function buildInboundEvent(params: {
|
|
44
|
-
|
|
44
|
+
session_id: string;
|
|
45
45
|
channel: ChatDispatchChannel;
|
|
46
46
|
chatId: string;
|
|
47
47
|
ingressKind: ChatHistoryIngressKind;
|
|
48
48
|
text: string;
|
|
49
49
|
targetType?: string;
|
|
50
50
|
threadId?: number;
|
|
51
|
-
|
|
51
|
+
message_id?: string;
|
|
52
52
|
actorId?: string;
|
|
53
53
|
actorName?: string;
|
|
54
54
|
extra?: JsonObject;
|
|
55
55
|
}): ChatHistoryInboundEventV1 {
|
|
56
56
|
return {
|
|
57
57
|
v: 1,
|
|
58
|
-
id: `chat:${
|
|
58
|
+
id: `chat:${generate_id()}`,
|
|
59
59
|
ts: Date.now(),
|
|
60
60
|
direction: "inbound",
|
|
61
61
|
ingressKind: params.ingressKind,
|
|
62
|
-
|
|
62
|
+
session_id: params.session_id,
|
|
63
63
|
channel: params.channel,
|
|
64
64
|
chatId: params.chatId,
|
|
65
65
|
text: params.text,
|
|
66
66
|
...(params.targetType ? { targetType: params.targetType } : {}),
|
|
67
67
|
...(typeof params.threadId === "number" ? { threadId: params.threadId } : {}),
|
|
68
|
-
...(params.
|
|
68
|
+
...(params.message_id ? { message_id: params.message_id } : {}),
|
|
69
69
|
...(params.actorId ? { actorId: params.actorId } : {}),
|
|
70
70
|
...(params.actorName ? { actorName: params.actorName } : {}),
|
|
71
71
|
...(params.extra ? { extra: params.extra } : {}),
|
|
@@ -73,29 +73,29 @@ function buildInboundEvent(params: {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
function buildOutboundEvent(params: {
|
|
76
|
-
|
|
76
|
+
session_id: string;
|
|
77
77
|
channel: ChatDispatchChannel;
|
|
78
78
|
chatId: string;
|
|
79
79
|
text: string;
|
|
80
80
|
targetType?: string;
|
|
81
81
|
threadId?: number;
|
|
82
|
-
|
|
82
|
+
message_id?: string;
|
|
83
83
|
actorId?: string;
|
|
84
84
|
actorName?: string;
|
|
85
85
|
extra?: JsonObject;
|
|
86
86
|
}): ChatHistoryOutboundEventV1 {
|
|
87
87
|
return {
|
|
88
88
|
v: 1,
|
|
89
|
-
id: `chat:${
|
|
89
|
+
id: `chat:${generate_id()}`,
|
|
90
90
|
ts: Date.now(),
|
|
91
91
|
direction: "outbound",
|
|
92
|
-
|
|
92
|
+
session_id: params.session_id,
|
|
93
93
|
channel: params.channel,
|
|
94
94
|
chatId: params.chatId,
|
|
95
95
|
text: params.text,
|
|
96
96
|
...(params.targetType ? { targetType: params.targetType } : {}),
|
|
97
97
|
...(typeof params.threadId === "number" ? { threadId: params.threadId } : {}),
|
|
98
|
-
...(params.
|
|
98
|
+
...(params.message_id ? { message_id: params.message_id } : {}),
|
|
99
99
|
...(params.actorId ? { actorId: params.actorId } : {}),
|
|
100
100
|
...(params.actorName ? { actorName: params.actorName } : {}),
|
|
101
101
|
...(params.extra ? { extra: params.extra } : {}),
|
|
@@ -112,7 +112,7 @@ function isChatHistoryEventV1(value: unknown): value is ChatHistoryEventV1 {
|
|
|
112
112
|
if (obj.v !== 1) return false;
|
|
113
113
|
if (!isValidHistoryDirection(obj.direction)) return false;
|
|
114
114
|
if (typeof obj.id !== "string" || !obj.id.trim()) return false;
|
|
115
|
-
if (typeof obj.
|
|
115
|
+
if (typeof obj.session_id !== "string" || !obj.session_id.trim()) return false;
|
|
116
116
|
if (typeof obj.channel !== "string" || !obj.channel.trim()) return false;
|
|
117
117
|
if (typeof obj.chatId !== "string" || !obj.chatId.trim()) return false;
|
|
118
118
|
if (typeof obj.text !== "string") return false;
|
|
@@ -132,39 +132,39 @@ function isChatHistoryEventV1(value: unknown): value is ChatHistoryEventV1 {
|
|
|
132
132
|
* - 调用方应在入队前调用,以满足“先审计后执行”链路。
|
|
133
133
|
*/
|
|
134
134
|
export async function appendInboundChatHistory(params: {
|
|
135
|
-
context:
|
|
136
|
-
|
|
135
|
+
context: PluginContext;
|
|
136
|
+
session_id: string;
|
|
137
137
|
channel: ChatDispatchChannel;
|
|
138
138
|
chatId: string;
|
|
139
139
|
ingressKind: ChatHistoryIngressKind;
|
|
140
140
|
text: string;
|
|
141
141
|
targetType?: string;
|
|
142
142
|
threadId?: number;
|
|
143
|
-
|
|
143
|
+
message_id?: string;
|
|
144
144
|
actorId?: string;
|
|
145
145
|
actorName?: string;
|
|
146
146
|
extra?: JsonObject;
|
|
147
147
|
}): Promise<void> {
|
|
148
|
-
const rootPath = normalizeTrimmedString(params.context.
|
|
149
|
-
const
|
|
148
|
+
const rootPath = normalizeTrimmedString(params.context.workspace_path);
|
|
149
|
+
const session_id = normalizeTrimmedString(params.session_id);
|
|
150
150
|
const chatId = normalizeTrimmedString(params.chatId);
|
|
151
|
-
if (!rootPath || !
|
|
151
|
+
if (!rootPath || !session_id || !chatId) return;
|
|
152
152
|
|
|
153
153
|
const event = buildInboundEvent({
|
|
154
|
-
|
|
154
|
+
session_id,
|
|
155
155
|
channel: params.channel,
|
|
156
156
|
chatId,
|
|
157
157
|
ingressKind: params.ingressKind,
|
|
158
158
|
text: String(params.text ?? ""),
|
|
159
159
|
targetType: toOptionalTrimmedString(params.targetType),
|
|
160
160
|
threadId: toOptionalFiniteNumber(params.threadId),
|
|
161
|
-
|
|
161
|
+
message_id: toOptionalTrimmedString(params.message_id),
|
|
162
162
|
actorId: toOptionalTrimmedString(params.actorId),
|
|
163
163
|
actorName: toOptionalTrimmedString(params.actorName),
|
|
164
164
|
extra: toOptionalObject(params.extra),
|
|
165
165
|
});
|
|
166
166
|
|
|
167
|
-
const file = get_chat_history_path(params.context.
|
|
167
|
+
const file = get_chat_history_path(params.context.workspace_path, session_id);
|
|
168
168
|
await fs.ensureDir(path.dirname(file));
|
|
169
169
|
await fs.appendFile(file, JSON.stringify(event) + "\n", "utf8");
|
|
170
170
|
}
|
|
@@ -177,60 +177,60 @@ export async function appendInboundChatHistory(params: {
|
|
|
177
177
|
* - 该函数只做落盘,不影响实际发送链路。
|
|
178
178
|
*/
|
|
179
179
|
export async function appendOutboundChatHistory(params: {
|
|
180
|
-
context:
|
|
181
|
-
|
|
180
|
+
context: PluginContext;
|
|
181
|
+
session_id: string;
|
|
182
182
|
channel: ChatDispatchChannel;
|
|
183
183
|
chatId: string;
|
|
184
184
|
text: string;
|
|
185
185
|
targetType?: string;
|
|
186
186
|
threadId?: number;
|
|
187
|
-
|
|
187
|
+
message_id?: string;
|
|
188
188
|
actorId?: string;
|
|
189
189
|
actorName?: string;
|
|
190
190
|
extra?: JsonObject;
|
|
191
191
|
}): Promise<void> {
|
|
192
|
-
const rootPath = normalizeTrimmedString(params.context.
|
|
193
|
-
const
|
|
192
|
+
const rootPath = normalizeTrimmedString(params.context.workspace_path);
|
|
193
|
+
const session_id = normalizeTrimmedString(params.session_id);
|
|
194
194
|
const chatId = normalizeTrimmedString(params.chatId);
|
|
195
|
-
if (!rootPath || !
|
|
195
|
+
if (!rootPath || !session_id || !chatId) return;
|
|
196
196
|
|
|
197
197
|
const event = buildOutboundEvent({
|
|
198
|
-
|
|
198
|
+
session_id,
|
|
199
199
|
channel: params.channel,
|
|
200
200
|
chatId,
|
|
201
201
|
text: String(params.text ?? ""),
|
|
202
202
|
targetType: toOptionalTrimmedString(params.targetType),
|
|
203
203
|
threadId: toOptionalFiniteNumber(params.threadId),
|
|
204
|
-
|
|
204
|
+
message_id: toOptionalTrimmedString(params.message_id),
|
|
205
205
|
actorId: toOptionalTrimmedString(params.actorId),
|
|
206
206
|
actorName: toOptionalTrimmedString(params.actorName),
|
|
207
207
|
extra: toOptionalObject(params.extra),
|
|
208
208
|
});
|
|
209
209
|
|
|
210
|
-
const file = get_chat_history_path(params.context.
|
|
210
|
+
const file = get_chat_history_path(params.context.workspace_path, session_id);
|
|
211
211
|
await fs.ensureDir(path.dirname(file));
|
|
212
212
|
await fs.appendFile(file, JSON.stringify(event) + "\n", "utf8");
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
/**
|
|
216
|
-
* 读取 chat 历史事件(按
|
|
216
|
+
* 读取 chat 历史事件(按 session_id)。
|
|
217
217
|
*
|
|
218
218
|
* 关键点(中文)
|
|
219
219
|
* - 默认返回最近 N 条(按时间升序)。
|
|
220
220
|
* - 仅做文件读取与过滤,不涉及任何业务 side-effect。
|
|
221
221
|
*/
|
|
222
222
|
export async function readChatHistory(params: {
|
|
223
|
-
context:
|
|
224
|
-
|
|
223
|
+
context: PluginContext;
|
|
224
|
+
session_id: string;
|
|
225
225
|
limit?: number;
|
|
226
226
|
direction?: ChatHistoryDirection | "all";
|
|
227
227
|
beforeTs?: number;
|
|
228
228
|
afterTs?: number;
|
|
229
229
|
}): Promise<{ historyPath: string; events: ChatHistoryEventV1[] }> {
|
|
230
|
-
const rootPath = normalizeTrimmedString(params.context.
|
|
231
|
-
const
|
|
232
|
-
const historyPath = get_chat_history_path(params.context.
|
|
233
|
-
if (!rootPath || !
|
|
230
|
+
const rootPath = normalizeTrimmedString(params.context.workspace_path);
|
|
231
|
+
const session_id = normalizeTrimmedString(params.session_id);
|
|
232
|
+
const historyPath = get_chat_history_path(params.context.workspace_path, session_id);
|
|
233
|
+
if (!rootPath || !session_id) {
|
|
234
234
|
return {
|
|
235
235
|
historyPath,
|
|
236
236
|
events: [],
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* - 只有极少数非 turn 场景才允许显式补写 `session messages`
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import type {
|
|
10
|
+
import type { PluginContext } from "@downcity/agent";
|
|
11
11
|
import type { JsonObject } from "@downcity/agent";
|
|
12
12
|
import type { ChatDispatchChannel } from "@/chat/types/ChatDispatcher.js";
|
|
13
13
|
import { appendInboundChatHistory } from "./ChatHistoryStore.js";
|
|
@@ -38,14 +38,14 @@ export function buildExecIngressExtra(extra?: JsonObject): JsonObject {
|
|
|
38
38
|
* - 可避免 queue / control / transport 在 session 外重复持久化 user 消息。
|
|
39
39
|
*/
|
|
40
40
|
export async function appendExecIngress(params: {
|
|
41
|
-
context:
|
|
42
|
-
|
|
41
|
+
context: PluginContext;
|
|
42
|
+
session_id: string;
|
|
43
43
|
channel: ChatDispatchChannel;
|
|
44
44
|
chatId: string;
|
|
45
45
|
text: string;
|
|
46
46
|
targetType?: string;
|
|
47
47
|
threadId?: number;
|
|
48
|
-
|
|
48
|
+
message_id?: string;
|
|
49
49
|
actorId?: string;
|
|
50
50
|
actorName?: string;
|
|
51
51
|
extra?: JsonObject;
|
|
@@ -53,14 +53,14 @@ export async function appendExecIngress(params: {
|
|
|
53
53
|
const execExtra = buildExecIngressExtra(params.extra);
|
|
54
54
|
await appendInboundChatHistory({
|
|
55
55
|
context: params.context,
|
|
56
|
-
|
|
56
|
+
session_id: params.session_id,
|
|
57
57
|
channel: params.channel,
|
|
58
58
|
chatId: params.chatId,
|
|
59
59
|
ingressKind: "exec",
|
|
60
60
|
text: params.text,
|
|
61
61
|
...(params.targetType ? { targetType: params.targetType } : {}),
|
|
62
62
|
...(typeof params.threadId === "number" ? { threadId: params.threadId } : {}),
|
|
63
|
-
...(params.
|
|
63
|
+
...(params.message_id ? { message_id: params.message_id } : {}),
|
|
64
64
|
...(params.actorId ? { actorId: params.actorId } : {}),
|
|
65
65
|
...(params.actorName ? { actorName: params.actorName } : {}),
|
|
66
66
|
extra: execExtra,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* ChatMetaStore:按
|
|
2
|
+
* ChatMetaStore:按 session_id 维护 chat 路由元信息。
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
5
|
* - 入站消息到达时由 chat plugin runtime 写入
|
|
6
|
-
* - 出站按
|
|
6
|
+
* - 出站按 session_id/chat_key 发送时由 chat plugin runtime 读取
|
|
7
7
|
* - 底层数据落在 `.downcity/channel/meta.json`,由 ChannelContextStore 统一维护
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import type {
|
|
10
|
+
import type { PluginContext } from "@downcity/agent";
|
|
11
11
|
import type { ChatMetaV1 } from "@/chat/types/ChatMeta.js";
|
|
12
12
|
import type { ChatDispatchChannel } from "@/chat/types/ChatDispatcher.js";
|
|
13
13
|
import {
|
|
@@ -18,8 +18,8 @@ import {
|
|
|
18
18
|
upsertChannelSessionRouteBySessionId,
|
|
19
19
|
} from "./ChannelContextStore.js";
|
|
20
20
|
|
|
21
|
-
function normalizeSessionId(
|
|
22
|
-
return String(
|
|
21
|
+
function normalizeSessionId(session_id: string): string {
|
|
22
|
+
return String(session_id || "").trim();
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
function normalizeChatId(chatId: string): string {
|
|
@@ -27,28 +27,28 @@ function normalizeChatId(chatId: string): string {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* 读取指定
|
|
30
|
+
* 读取指定 session_id 的 chat meta。
|
|
31
31
|
*/
|
|
32
32
|
export async function readChatMetaBySessionId(params: {
|
|
33
|
-
context:
|
|
34
|
-
|
|
33
|
+
context: PluginContext;
|
|
34
|
+
session_id: string;
|
|
35
35
|
}): Promise<ChatMetaV1 | null> {
|
|
36
|
-
const
|
|
37
|
-
if (!
|
|
36
|
+
const session_id = normalizeSessionId(params.session_id);
|
|
37
|
+
if (!session_id) return null;
|
|
38
38
|
const route = await readChannelSessionRouteBySessionId({
|
|
39
39
|
context: params.context,
|
|
40
|
-
|
|
40
|
+
session_id,
|
|
41
41
|
});
|
|
42
42
|
if (!route) return null;
|
|
43
43
|
return {
|
|
44
44
|
v: 1,
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
updated_at: route.updated_at,
|
|
46
|
+
session_id: route.session_id,
|
|
47
47
|
channel: route.channel,
|
|
48
48
|
chatId: route.chatId,
|
|
49
49
|
...(route.targetType ? { targetType: route.targetType } : {}),
|
|
50
50
|
...(typeof route.threadId === "number" ? { threadId: route.threadId } : {}),
|
|
51
|
-
...(route.
|
|
51
|
+
...(route.message_id ? { message_id: route.message_id } : {}),
|
|
52
52
|
...(route.actorId ? { actorId: route.actorId } : {}),
|
|
53
53
|
...(route.actorName ? { actorName: route.actorName } : {}),
|
|
54
54
|
...(route.chatTitle ? { chatTitle: route.chatTitle } : {}),
|
|
@@ -56,33 +56,33 @@ export async function readChatMetaBySessionId(params: {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
|
-
* 更新指定
|
|
59
|
+
* 更新指定 session_id 的 chat meta(全量覆盖最近快照)。
|
|
60
60
|
*/
|
|
61
61
|
export async function upsertChatMetaBySessionId(params: {
|
|
62
|
-
context:
|
|
63
|
-
|
|
62
|
+
context: PluginContext;
|
|
63
|
+
session_id: string;
|
|
64
64
|
channel: ChatDispatchChannel;
|
|
65
65
|
chatId: string;
|
|
66
66
|
targetType?: string;
|
|
67
67
|
threadId?: number;
|
|
68
|
-
|
|
68
|
+
message_id?: string;
|
|
69
69
|
actorId?: string;
|
|
70
70
|
actorName?: string;
|
|
71
71
|
chatTitle?: string;
|
|
72
72
|
}): Promise<void> {
|
|
73
|
-
const
|
|
73
|
+
const session_id = normalizeSessionId(params.session_id);
|
|
74
74
|
const chatId = normalizeChatId(params.chatId);
|
|
75
|
-
if (!
|
|
75
|
+
if (!session_id || !chatId) return;
|
|
76
76
|
await upsertChannelSessionRouteBySessionId({
|
|
77
77
|
context: params.context,
|
|
78
|
-
|
|
78
|
+
session_id,
|
|
79
79
|
target: {
|
|
80
80
|
channel: params.channel,
|
|
81
81
|
chatId,
|
|
82
82
|
...(typeof params.targetType === "string" ? { targetType: params.targetType } : {}),
|
|
83
83
|
...(typeof params.threadId === "number" ? { threadId: params.threadId } : {}),
|
|
84
84
|
},
|
|
85
|
-
|
|
85
|
+
message_id: params.message_id,
|
|
86
86
|
actorId: params.actorId,
|
|
87
87
|
actorName: params.actorName,
|
|
88
88
|
chatTitle: params.chatTitle,
|
|
@@ -90,10 +90,10 @@ export async function upsertChatMetaBySessionId(params: {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
|
-
* 通过渠道目标查找已有
|
|
93
|
+
* 通过渠道目标查找已有 session_id。
|
|
94
94
|
*/
|
|
95
95
|
export async function resolveSessionIdByChatTarget(params: {
|
|
96
|
-
context:
|
|
96
|
+
context: PluginContext;
|
|
97
97
|
channel: ChatDispatchChannel;
|
|
98
98
|
chatId: string;
|
|
99
99
|
targetType?: string;
|
|
@@ -113,10 +113,10 @@ export async function resolveSessionIdByChatTarget(params: {
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
/**
|
|
116
|
-
* 通过渠道目标解析或创建
|
|
116
|
+
* 通过渠道目标解析或创建 session_id。
|
|
117
117
|
*/
|
|
118
118
|
export async function resolveOrCreateSessionIdByChatTarget(params: {
|
|
119
|
-
context:
|
|
119
|
+
context: PluginContext;
|
|
120
120
|
channel: ChatDispatchChannel;
|
|
121
121
|
chatId: string;
|
|
122
122
|
targetType?: string;
|
|
@@ -136,21 +136,21 @@ export async function resolveOrCreateSessionIdByChatTarget(params: {
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
/**
|
|
139
|
-
* 删除指定
|
|
139
|
+
* 删除指定 session_id 的 chat meta 映射。
|
|
140
140
|
*
|
|
141
141
|
* 关键点(中文)
|
|
142
|
-
* - 删除后该
|
|
143
|
-
* - 若同一 target 重新收到入站消息,会创建新的
|
|
142
|
+
* - 删除后该 session_id 不再可用于 chat_key 路由发送。
|
|
143
|
+
* - 若同一 target 重新收到入站消息,会创建新的 session_id。
|
|
144
144
|
*/
|
|
145
145
|
export async function removeChatMetaBySessionId(params: {
|
|
146
|
-
context:
|
|
147
|
-
|
|
146
|
+
context: PluginContext;
|
|
147
|
+
session_id: string;
|
|
148
148
|
}): Promise<{
|
|
149
149
|
removed: boolean;
|
|
150
150
|
route: ChatMetaV1 | null;
|
|
151
151
|
}> {
|
|
152
|
-
const
|
|
153
|
-
if (!
|
|
152
|
+
const session_id = normalizeSessionId(params.session_id);
|
|
153
|
+
if (!session_id) {
|
|
154
154
|
return {
|
|
155
155
|
removed: false,
|
|
156
156
|
route: null,
|
|
@@ -158,7 +158,7 @@ export async function removeChatMetaBySessionId(params: {
|
|
|
158
158
|
}
|
|
159
159
|
const result = await removeChannelSessionRouteBySessionId({
|
|
160
160
|
context: params.context,
|
|
161
|
-
|
|
161
|
+
session_id,
|
|
162
162
|
});
|
|
163
163
|
const route = result.route;
|
|
164
164
|
if (!route) {
|
|
@@ -171,13 +171,13 @@ export async function removeChatMetaBySessionId(params: {
|
|
|
171
171
|
removed: result.removed,
|
|
172
172
|
route: {
|
|
173
173
|
v: 1,
|
|
174
|
-
|
|
175
|
-
|
|
174
|
+
updated_at: route.updated_at,
|
|
175
|
+
session_id: route.session_id,
|
|
176
176
|
channel: route.channel,
|
|
177
177
|
chatId: route.chatId,
|
|
178
178
|
...(route.targetType ? { targetType: route.targetType } : {}),
|
|
179
179
|
...(typeof route.threadId === "number" ? { threadId: route.threadId } : {}),
|
|
180
|
-
...(route.
|
|
180
|
+
...(route.message_id ? { message_id: route.message_id } : {}),
|
|
181
181
|
...(route.actorId ? { actorId: route.actorId } : {}),
|
|
182
182
|
...(route.actorName ? { actorName: route.actorName } : {}),
|
|
183
183
|
...(route.chatTitle ? { chatTitle: route.chatTitle } : {}),
|