@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
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
5
|
* - Chat Plugin 是 channel meta、chat history 与渠道缓存路径的唯一所有者。
|
|
6
|
-
* -
|
|
6
|
+
* - PluginContext 只提供项目根目录,不暴露任何 Chat 领域路径。
|
|
7
7
|
* - CLI 离线维护通过本模块操作 Chat 存储,不复制内部 JSON 结构。
|
|
8
8
|
*/
|
|
9
9
|
|
|
@@ -117,7 +117,7 @@ function resolve_session_id(
|
|
|
117
117
|
if (mapped) return mapped;
|
|
118
118
|
for (const route of Object.values(meta.routesBySessionId || {})) {
|
|
119
119
|
if (route && matches_target(route, input)) {
|
|
120
|
-
return normalize_text(route.
|
|
120
|
+
return normalize_text(route.session_id);
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
return "";
|
|
@@ -149,7 +149,7 @@ async function remove_route(
|
|
|
149
149
|
{
|
|
150
150
|
...meta,
|
|
151
151
|
v: 1,
|
|
152
|
-
|
|
152
|
+
updated_at: Date.now(),
|
|
153
153
|
routesBySessionId: routes_by_session_id,
|
|
154
154
|
sessionIdByTargetKey: session_id_by_target_key,
|
|
155
155
|
},
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Send text to a target chat using
|
|
2
|
+
* Send text to a target chat using chat_key.
|
|
3
3
|
*
|
|
4
4
|
* 设计动机(中文)
|
|
5
|
-
* - Task runner / scheduler 需要在“非当前对话上下文”向指定
|
|
6
|
-
* - 复用现有 dispatcher 与 chat meta(尤其 QQ 的被动回复依赖
|
|
5
|
+
* - Task runner / scheduler 需要在“非当前对话上下文”向指定 chat_key 投递消息
|
|
6
|
+
* - 复用现有 dispatcher 与 chat meta(尤其 QQ 的被动回复依赖 message_id)
|
|
7
7
|
*
|
|
8
8
|
* 注意
|
|
9
9
|
* - 这里是运行时内部能力(不是 tool);tool `chat_contact_send` 也会复用本实现
|
|
@@ -14,7 +14,7 @@ import type {
|
|
|
14
14
|
ChatDispatchAction,
|
|
15
15
|
ChatDispatchChannel,
|
|
16
16
|
} from "@/chat/types/ChatDispatcher.js";
|
|
17
|
-
import type {
|
|
17
|
+
import type { PluginContext } from "@downcity/agent";
|
|
18
18
|
import { readChatMetaBySessionId } from "./ChatMetaStore.js";
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -22,21 +22,21 @@ import { readChatMetaBySessionId } from "./ChatMetaStore.js";
|
|
|
22
22
|
*
|
|
23
23
|
* 规则(中文)
|
|
24
24
|
* - 仅使用 chat plugin runtime 维护的 session 路由映射。
|
|
25
|
-
* - 不再支持 legacy
|
|
25
|
+
* - 不再支持 legacy chat_key 字符串解析回退。
|
|
26
26
|
*/
|
|
27
27
|
export async function resolveDispatchTargetByChatKey(params: {
|
|
28
|
-
context:
|
|
29
|
-
|
|
28
|
+
context: PluginContext;
|
|
29
|
+
chat_key: string;
|
|
30
30
|
}): Promise<{
|
|
31
31
|
channel: ChatDispatchChannel;
|
|
32
32
|
chatId: string;
|
|
33
33
|
chatType?: string;
|
|
34
34
|
messageThreadId?: number;
|
|
35
|
-
|
|
35
|
+
message_id?: string;
|
|
36
36
|
} | null> {
|
|
37
37
|
const storedMeta = await readChatMetaBySessionId({
|
|
38
38
|
context: params.context,
|
|
39
|
-
|
|
39
|
+
session_id: params.chat_key,
|
|
40
40
|
});
|
|
41
41
|
const channel = storedMeta?.channel;
|
|
42
42
|
const chatId = String(storedMeta?.chatId || "").trim();
|
|
@@ -51,9 +51,9 @@ export async function resolveDispatchTargetByChatKey(params: {
|
|
|
51
51
|
Number.isFinite(storedMeta.threadId)
|
|
52
52
|
? storedMeta.threadId
|
|
53
53
|
: undefined;
|
|
54
|
-
const
|
|
55
|
-
typeof storedMeta?.
|
|
56
|
-
? storedMeta.
|
|
54
|
+
const message_id =
|
|
55
|
+
typeof storedMeta?.message_id === "string" && storedMeta.message_id
|
|
56
|
+
? storedMeta.message_id
|
|
57
57
|
: undefined;
|
|
58
58
|
|
|
59
59
|
return {
|
|
@@ -61,36 +61,36 @@ export async function resolveDispatchTargetByChatKey(params: {
|
|
|
61
61
|
chatId,
|
|
62
62
|
...(typeof chatType === "string" && chatType ? { chatType } : {}),
|
|
63
63
|
...(typeof messageThreadId === "number" ? { messageThreadId } : {}),
|
|
64
|
-
...(typeof
|
|
64
|
+
...(typeof message_id === "string" && message_id ? { message_id } : {}),
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
|
-
* 按
|
|
69
|
+
* 按 chat_key 发送文本到对应平台。
|
|
70
70
|
*
|
|
71
71
|
* 流程(中文)
|
|
72
|
-
* 1) 通过
|
|
73
|
-
* 2) 从 chat meta 回填 chatType/threadId/
|
|
72
|
+
* 1) 通过 session_id 读取映射并定位 channel dispatcher
|
|
73
|
+
* 2) 从 chat meta 回填 chatType/threadId/message_id
|
|
74
74
|
* 3) 合并参数后调用 dispatcher 发送
|
|
75
75
|
*/
|
|
76
76
|
export async function sendTextByChatKey(params: {
|
|
77
|
-
context:
|
|
78
|
-
|
|
77
|
+
context: PluginContext;
|
|
78
|
+
chat_key: string;
|
|
79
79
|
text: string;
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
reply_to_message?: boolean;
|
|
81
|
+
message_id?: string;
|
|
82
82
|
}): Promise<{ success: boolean; error?: string }> {
|
|
83
83
|
const context = params.context;
|
|
84
|
-
const
|
|
84
|
+
const chat_key = String(params.chat_key || "").trim();
|
|
85
85
|
const text = String(params.text ?? "");
|
|
86
|
-
if (!
|
|
86
|
+
if (!chat_key) return { success: false, error: "Missing chat_key" };
|
|
87
87
|
if (!text.trim()) return { success: true };
|
|
88
88
|
|
|
89
|
-
const target = await resolveDispatchTargetByChatKey({ context,
|
|
89
|
+
const target = await resolveDispatchTargetByChatKey({ context, chat_key });
|
|
90
90
|
if (!target) {
|
|
91
91
|
return {
|
|
92
92
|
success: false,
|
|
93
|
-
error: `Unsupported
|
|
93
|
+
error: `Unsupported session_id for dispatch: ${chat_key}`,
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
96
|
|
|
@@ -107,16 +107,16 @@ export async function sendTextByChatKey(params: {
|
|
|
107
107
|
|
|
108
108
|
const chatType = target.chatType;
|
|
109
109
|
const messageThreadId = target.messageThreadId;
|
|
110
|
-
const explicitMessageId = String(params.
|
|
111
|
-
const
|
|
112
|
-
const shouldReplyToMessage = params.
|
|
110
|
+
const explicitMessageId = String(params.message_id || "").trim();
|
|
111
|
+
const message_id = explicitMessageId || target.message_id;
|
|
112
|
+
const shouldReplyToMessage = params.reply_to_message === true;
|
|
113
113
|
|
|
114
114
|
if (channel === "qq") {
|
|
115
|
-
if (!chatType || !
|
|
115
|
+
if (!chatType || !message_id) {
|
|
116
116
|
return {
|
|
117
117
|
success: false,
|
|
118
118
|
error:
|
|
119
|
-
"QQ requires chatType +
|
|
119
|
+
"QQ requires chatType + message_id to send a reply. Ask the target user to send a message first so Downcity can record latest chat meta.",
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
122
|
}
|
|
@@ -126,37 +126,37 @@ export async function sendTextByChatKey(params: {
|
|
|
126
126
|
text,
|
|
127
127
|
...(typeof messageThreadId === "number" ? { messageThreadId } : {}),
|
|
128
128
|
...(typeof chatType === "string" && chatType ? { chatType } : {}),
|
|
129
|
-
...(typeof
|
|
130
|
-
...(shouldReplyToMessage ? {
|
|
129
|
+
...(typeof message_id === "string" && message_id ? { message_id } : {}),
|
|
130
|
+
...(shouldReplyToMessage ? { reply_to_message: true } : {}),
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
/**
|
|
135
|
-
* 按
|
|
135
|
+
* 按 chat_key 发送平台动作(typing/react)。
|
|
136
136
|
*
|
|
137
137
|
* 流程(中文)
|
|
138
|
-
* 1) 通过
|
|
139
|
-
* 2) 合并目标元信息与显式参数(显式
|
|
138
|
+
* 1) 通过 session_id 读取映射并定位 channel dispatcher
|
|
139
|
+
* 2) 合并目标元信息与显式参数(显式 message_id 优先)
|
|
140
140
|
* 3) 调用 dispatcher.sendAction
|
|
141
141
|
*/
|
|
142
142
|
export async function sendActionByChatKey(params: {
|
|
143
|
-
context:
|
|
144
|
-
|
|
143
|
+
context: PluginContext;
|
|
144
|
+
chat_key: string;
|
|
145
145
|
action: ChatDispatchAction;
|
|
146
|
-
|
|
146
|
+
message_id?: string;
|
|
147
147
|
reactionEmoji?: string;
|
|
148
148
|
reactionIsBig?: boolean;
|
|
149
149
|
}): Promise<{ success: boolean; error?: string }> {
|
|
150
150
|
const context = params.context;
|
|
151
|
-
const
|
|
152
|
-
if (!
|
|
151
|
+
const chat_key = String(params.chat_key || "").trim();
|
|
152
|
+
if (!chat_key) return { success: false, error: "Missing chat_key" };
|
|
153
153
|
if (!params.action) return { success: false, error: "Missing action" };
|
|
154
154
|
|
|
155
|
-
const target = await resolveDispatchTargetByChatKey({ context,
|
|
155
|
+
const target = await resolveDispatchTargetByChatKey({ context, chat_key });
|
|
156
156
|
if (!target) {
|
|
157
157
|
return {
|
|
158
158
|
success: false,
|
|
159
|
-
error: `Unsupported
|
|
159
|
+
error: `Unsupported session_id for dispatch: ${chat_key}`,
|
|
160
160
|
};
|
|
161
161
|
}
|
|
162
162
|
|
|
@@ -168,7 +168,7 @@ export async function sendActionByChatKey(params: {
|
|
|
168
168
|
};
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
const
|
|
171
|
+
const message_id = String(params.message_id || "").trim() || target.message_id;
|
|
172
172
|
return dispatcher.sendAction({
|
|
173
173
|
chatId: target.chatId,
|
|
174
174
|
action: params.action,
|
|
@@ -178,7 +178,7 @@ export async function sendActionByChatKey(params: {
|
|
|
178
178
|
...(typeof target.chatType === "string" && target.chatType
|
|
179
179
|
? { chatType: target.chatType }
|
|
180
180
|
: {}),
|
|
181
|
-
...(typeof
|
|
181
|
+
...(typeof message_id === "string" && message_id ? { message_id } : {}),
|
|
182
182
|
...(typeof params.reactionEmoji === "string" && params.reactionEmoji.trim()
|
|
183
183
|
? { reactionEmoji: params.reactionEmoji.trim() }
|
|
184
184
|
: {}),
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
5
|
* - 默认把 assistant 文本原样当作用户可见正文发送。
|
|
6
|
-
* - frontmatter metadata 语义与
|
|
6
|
+
* - frontmatter metadata 语义与 Chat send action 保持一致。
|
|
7
7
|
* - 额外保留 `react` 字段用于 direct 模式贴表情。
|
|
8
8
|
*/
|
|
9
9
|
|
|
@@ -14,8 +14,8 @@ import type {
|
|
|
14
14
|
ResolvedDirectTextPayload,
|
|
15
15
|
} from "@/chat/types/DirectDispatch.js";
|
|
16
16
|
import {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
build_chat_message_text,
|
|
18
|
+
parse_chat_message_markup,
|
|
19
19
|
} from "@downcity/agent";
|
|
20
20
|
import { parseChatSendOptionsFromMetadata } from "@/chat/runtime/ChatSendMetadata.js";
|
|
21
21
|
import type { ChatMessageSegment } from "@downcity/agent";
|
|
@@ -72,24 +72,24 @@ function resolveTextPlan(params: {
|
|
|
72
72
|
metadata: params.metadata,
|
|
73
73
|
strict: false,
|
|
74
74
|
});
|
|
75
|
-
const
|
|
76
|
-
const text =
|
|
75
|
+
const chat_key = normalizeText(sendOptions.chat_key || params.fallbackChatKey);
|
|
76
|
+
const text = build_chat_message_text({
|
|
77
77
|
segments: params.segments,
|
|
78
78
|
});
|
|
79
|
-
if (!
|
|
79
|
+
if (!chat_key || !text) return null;
|
|
80
80
|
|
|
81
81
|
return {
|
|
82
82
|
text,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
...(typeof sendOptions.
|
|
86
|
-
? {
|
|
83
|
+
chat_key,
|
|
84
|
+
reply_to_message: sendOptions.reply_to_message === true,
|
|
85
|
+
...(typeof sendOptions.message_id === "string" && sendOptions.message_id
|
|
86
|
+
? { message_id: sendOptions.message_id }
|
|
87
87
|
: {}),
|
|
88
|
-
...(typeof sendOptions.
|
|
89
|
-
? {
|
|
88
|
+
...(typeof sendOptions.delay_ms === "number"
|
|
89
|
+
? { delay_ms: sendOptions.delay_ms }
|
|
90
90
|
: {}),
|
|
91
|
-
...(typeof sendOptions.
|
|
92
|
-
? {
|
|
91
|
+
...(typeof sendOptions.send_at_ms === "number"
|
|
92
|
+
? { send_at_ms: sendOptions.send_at_ms }
|
|
93
93
|
: {}),
|
|
94
94
|
};
|
|
95
95
|
}
|
|
@@ -104,17 +104,17 @@ function resolveReactionPlans(params: {
|
|
|
104
104
|
metadata: params.metadata,
|
|
105
105
|
strict: false,
|
|
106
106
|
});
|
|
107
|
-
const
|
|
108
|
-
const
|
|
109
|
-
if (!
|
|
107
|
+
const chat_key = normalizeText(sendOptions.chat_key || params.fallbackChatKey);
|
|
108
|
+
const message_id = normalizeText(sendOptions.message_id);
|
|
109
|
+
if (!chat_key) return out;
|
|
110
110
|
|
|
111
111
|
for (const react of params.reacts) {
|
|
112
112
|
const emoji = normalizeText(react.emoji);
|
|
113
113
|
if (!emoji) continue;
|
|
114
114
|
out.push({
|
|
115
115
|
emoji,
|
|
116
|
-
|
|
117
|
-
...(
|
|
116
|
+
chat_key,
|
|
117
|
+
...(message_id ? { message_id } : {}),
|
|
118
118
|
big: react.big === true,
|
|
119
119
|
});
|
|
120
120
|
}
|
|
@@ -125,7 +125,7 @@ function resolveReactionPlans(params: {
|
|
|
125
125
|
* 从 assistant 文本中解析 direct 出站执行计划。
|
|
126
126
|
*
|
|
127
127
|
* 协议(中文)
|
|
128
|
-
* - frontmatter metadata:与
|
|
128
|
+
* - frontmatter metadata:与 Chat send action 输入保持一致。
|
|
129
129
|
* - 附件统一使用 `<file type=\"document|photo|voice|audio|video\">path</file>`。
|
|
130
130
|
* - `react` 仍仅用于 direct 模式的反应动作。
|
|
131
131
|
*/
|
|
@@ -137,7 +137,7 @@ export function parseDirectDispatchAssistantText(params: {
|
|
|
137
137
|
const fallbackChatKey = normalizeText(params.fallbackChatKey);
|
|
138
138
|
if (!normalizeText(source) || !fallbackChatKey) return null;
|
|
139
139
|
|
|
140
|
-
const parsed =
|
|
140
|
+
const parsed = parse_chat_message_markup(source);
|
|
141
141
|
const reacts = parseReactionsFromMetadata(parsed.metadata);
|
|
142
142
|
const textPlan = resolveTextPlan({
|
|
143
143
|
fallbackChatKey,
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* - service 通过这里暴露 queue 生命周期,不直接散落调用细节。
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type {
|
|
9
|
+
import type { PluginContext } from "@downcity/agent";
|
|
10
10
|
import type {
|
|
11
11
|
ChatEnqueueEffectInput,
|
|
12
12
|
ChatEnqueuePipelineInput,
|
|
@@ -22,7 +22,7 @@ function normalizeText(value: string): string {
|
|
|
22
22
|
* 入队前增强。
|
|
23
23
|
*/
|
|
24
24
|
export async function prepareChatEnqueue(params: {
|
|
25
|
-
context:
|
|
25
|
+
context: PluginContext;
|
|
26
26
|
input: ChatEnqueuePipelineInput;
|
|
27
27
|
}): Promise<ChatEnqueuePipelineInput> {
|
|
28
28
|
const normalized: ChatEnqueuePipelineInput = {
|
|
@@ -39,7 +39,7 @@ export async function prepareChatEnqueue(params: {
|
|
|
39
39
|
* 入队后通知。
|
|
40
40
|
*/
|
|
41
41
|
export async function emitChatEnqueueEffect(params: {
|
|
42
|
-
context:
|
|
42
|
+
context: PluginContext;
|
|
43
43
|
input: ChatEnqueueEffectInput;
|
|
44
44
|
}): Promise<void> {
|
|
45
45
|
await params.context.plugins.effect(
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
5
|
* - chat plugin runtime 先构造基础输入,再交给 plugin pipeline 做增强。
|
|
6
|
-
* - 最终拼装顺序固定为:attachmentText -> pluginSections ->
|
|
6
|
+
* - 最终拼装顺序固定为:attachmentText -> pluginSections -> body_text。
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type {
|
|
9
|
+
import type { PluginContext } from "@downcity/agent";
|
|
10
10
|
import type { ChatInboundAugmentInput } from "@/chat/types/ChatPlugin.js";
|
|
11
11
|
import type { JsonValue } from "@downcity/agent";
|
|
12
12
|
import { CHAT_PLUGIN_POINTS } from "@/chat/runtime/PluginPoints.js";
|
|
@@ -20,19 +20,19 @@ function normalizeText(value: string | undefined): string | undefined {
|
|
|
20
20
|
* 执行 chat 入站增强 pipeline。
|
|
21
21
|
*/
|
|
22
22
|
export async function augmentChatInboundInput(params: {
|
|
23
|
-
context:
|
|
23
|
+
context: PluginContext;
|
|
24
24
|
input: ChatInboundAugmentInput;
|
|
25
25
|
}): Promise<ChatInboundAugmentInput> {
|
|
26
26
|
const normalized: ChatInboundAugmentInput = {
|
|
27
27
|
...params.input,
|
|
28
28
|
...(params.input.chatType ? { chatType: params.input.chatType } : {}),
|
|
29
|
-
...(params.input.
|
|
30
|
-
...(params.input.
|
|
29
|
+
...(params.input.chat_key ? { chat_key: params.input.chat_key } : {}),
|
|
30
|
+
...(params.input.message_id ? { message_id: params.input.message_id } : {}),
|
|
31
31
|
...(normalizeText(params.input.attachmentText)
|
|
32
32
|
? { attachmentText: normalizeText(params.input.attachmentText) }
|
|
33
33
|
: {}),
|
|
34
|
-
...(normalizeText(params.input.
|
|
35
|
-
? {
|
|
34
|
+
...(normalizeText(params.input.body_text)
|
|
35
|
+
? { body_text: normalizeText(params.input.body_text) }
|
|
36
36
|
: {}),
|
|
37
37
|
pluginSections: Array.isArray(params.input.pluginSections)
|
|
38
38
|
? params.input.pluginSections.map((item) => String(item || "").trim()).filter(Boolean)
|
|
@@ -55,7 +55,7 @@ export function buildChatInboundText(input: ChatInboundAugmentInput): string {
|
|
|
55
55
|
...(Array.isArray(input.pluginSections)
|
|
56
56
|
? input.pluginSections.map((item) => normalizeText(item)).filter(Boolean)
|
|
57
57
|
: []),
|
|
58
|
-
normalizeText(input.
|
|
58
|
+
normalizeText(input.body_text),
|
|
59
59
|
]
|
|
60
60
|
.filter(Boolean)
|
|
61
61
|
.join("\n\n")
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
|
|
10
10
|
import type { QueuedUserInfoInput } from "@/chat/types/ChatPromptContext.js";
|
|
11
11
|
import {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
format_date_time_in_timezone,
|
|
13
|
+
resolve_runtime_timezone,
|
|
14
14
|
} from "@downcity/agent";
|
|
15
15
|
|
|
16
16
|
function normalizeInfoValue(value: unknown): string {
|
|
@@ -36,15 +36,15 @@ function normalizeReceivedAtIso(input: unknown): string {
|
|
|
36
36
|
export function buildQueuedUserMessageWithInfo(params: {
|
|
37
37
|
text: string;
|
|
38
38
|
} & QueuedUserInfoInput): string {
|
|
39
|
-
const runtimeTimezone =
|
|
39
|
+
const runtimeTimezone = resolve_runtime_timezone();
|
|
40
40
|
const receivedAtIso = normalizeReceivedAtIso(params.receivedAt);
|
|
41
41
|
const receivedAtDate = new Date(receivedAtIso);
|
|
42
42
|
const infoLines = [
|
|
43
|
-
`message_id: ${normalizeInfoValue(params.
|
|
44
|
-
`user_id: ${normalizeInfoValue(params.
|
|
43
|
+
`message_id: ${normalizeInfoValue(params.message_id || "unknown")}`,
|
|
44
|
+
`user_id: ${normalizeInfoValue(params.user_id || "unknown")}`,
|
|
45
45
|
`username: ${normalizeInfoValue(params.username || "unknown")}`,
|
|
46
46
|
`received_at: ${normalizeInfoValue(receivedAtIso)}`,
|
|
47
|
-
`received_at_local: ${normalizeInfoValue(
|
|
47
|
+
`received_at_local: ${normalizeInfoValue(format_date_time_in_timezone(receivedAtDate, runtimeTimezone))}`,
|
|
48
48
|
`runtime_timezone: ${normalizeInfoValue(runtimeTimezone)}`,
|
|
49
49
|
];
|
|
50
50
|
if (normalizeInfoValue(params.userTimezone)) {
|
|
@@ -29,19 +29,19 @@ export function buildReplyContextInstruction(params: {
|
|
|
29
29
|
const replyContext = params.replyContext;
|
|
30
30
|
if (!replyContext) return body;
|
|
31
31
|
|
|
32
|
-
const
|
|
32
|
+
const message_id = normalizeReplyValue(replyContext.message_id);
|
|
33
33
|
const actorName = normalizeReplyValue(replyContext.actorName);
|
|
34
34
|
const quoteText = normalizeReplyValue(replyContext.quoteText);
|
|
35
35
|
const replyText = normalizeReplyValue(replyContext.text);
|
|
36
36
|
const normalizedQuote =
|
|
37
37
|
quoteText && quoteText !== replyText ? quoteText : undefined;
|
|
38
38
|
|
|
39
|
-
if (!
|
|
39
|
+
if (!message_id && !actorName && !normalizedQuote && !replyText) {
|
|
40
40
|
return body;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
const lines: string[] = ["<reply_context>"];
|
|
44
|
-
if (
|
|
44
|
+
if (message_id) lines.push(`reply_message_id: ${message_id}`);
|
|
45
45
|
if (actorName) lines.push(`reply_actor_name: ${actorName}`);
|
|
46
46
|
if (normalizedQuote) {
|
|
47
47
|
lines.push("reply_quote:");
|
|
@@ -69,15 +69,15 @@ export function buildReplyContextExtra(
|
|
|
69
69
|
): JsonObject | undefined {
|
|
70
70
|
if (!replyContext) return undefined;
|
|
71
71
|
|
|
72
|
-
const
|
|
72
|
+
const message_id = normalizeReplyValue(replyContext.message_id);
|
|
73
73
|
const actorName = normalizeReplyValue(replyContext.actorName);
|
|
74
74
|
const text = normalizeReplyValue(replyContext.text);
|
|
75
75
|
const quoteText = normalizeReplyValue(replyContext.quoteText);
|
|
76
|
-
if (!
|
|
76
|
+
if (!message_id && !actorName && !text && !quoteText) return undefined;
|
|
77
77
|
|
|
78
78
|
return {
|
|
79
79
|
hasReplyContext: true,
|
|
80
|
-
...(
|
|
80
|
+
...(message_id ? { replyMessageId: message_id } : {}),
|
|
81
81
|
...(actorName ? { replyActorName: actorName } : {}),
|
|
82
82
|
...(text ? { replyText: text } : {}),
|
|
83
83
|
...(quoteText ? { replyQuoteText: quoteText } : {}),
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* - 仅服务 agent 执行生命周期,不覆盖手动 `chat send`。
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type {
|
|
9
|
+
import type { PluginContext } from "@downcity/agent";
|
|
10
10
|
import type { ChatReplyDispatchInput, ChatReplyEffectInput } from "@/chat/types/ChatPlugin.js";
|
|
11
11
|
import type { JsonValue } from "@downcity/agent";
|
|
12
12
|
import type { ChatDispatchChannel } from "@/chat/types/ChatDispatcher.js";
|
|
@@ -21,7 +21,7 @@ function normalizeText(value: string | undefined): string {
|
|
|
21
21
|
* 回复前文本增强。
|
|
22
22
|
*/
|
|
23
23
|
export async function prepareChatReplyText(params: {
|
|
24
|
-
context:
|
|
24
|
+
context: PluginContext;
|
|
25
25
|
input: ChatReplyDispatchInput;
|
|
26
26
|
}): Promise<string> {
|
|
27
27
|
const input = {
|
|
@@ -45,7 +45,7 @@ export async function prepareChatReplyText(params: {
|
|
|
45
45
|
* 回复后事件分发。
|
|
46
46
|
*/
|
|
47
47
|
export async function emitChatReplyEffect(params: {
|
|
48
|
-
context:
|
|
48
|
+
context: PluginContext;
|
|
49
49
|
input: ChatReplyEffectInput;
|
|
50
50
|
}): Promise<void> {
|
|
51
51
|
await params.context.plugins.effect(
|
|
@@ -55,24 +55,24 @@ export async function emitChatReplyEffect(params: {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
-
* 基于
|
|
58
|
+
* 基于 chat_key 补齐回复目标上下文。
|
|
59
59
|
*/
|
|
60
60
|
export async function resolveChatReplyTarget(params: {
|
|
61
|
-
context:
|
|
62
|
-
|
|
61
|
+
context: PluginContext;
|
|
62
|
+
chat_key: string;
|
|
63
63
|
}): Promise<{
|
|
64
64
|
channel?: ChatDispatchChannel;
|
|
65
65
|
chatId?: string;
|
|
66
|
-
|
|
66
|
+
message_id?: string;
|
|
67
67
|
}> {
|
|
68
68
|
const target = await resolveDispatchTargetByChatKey({
|
|
69
69
|
context: params.context,
|
|
70
|
-
|
|
70
|
+
chat_key: params.chat_key,
|
|
71
71
|
});
|
|
72
72
|
if (!target) return {};
|
|
73
73
|
return {
|
|
74
74
|
channel: target.channel,
|
|
75
75
|
chatId: target.chatId,
|
|
76
|
-
...(target.
|
|
76
|
+
...(target.message_id ? { message_id: target.message_id } : {}),
|
|
77
77
|
};
|
|
78
78
|
}
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* - 统一从 request context + ChatMetaStore 读取当前 chat 元信息。
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import type {
|
|
11
|
-
import type {
|
|
10
|
+
import type { PluginContext } from "@downcity/agent";
|
|
11
|
+
import type { PluginExecutionContext } from "@downcity/agent";
|
|
12
12
|
import type { ChatEnvironmentPromptInput } from "@/chat/types/ChatPromptContext.js";
|
|
13
13
|
import { readChatMetaBySessionId } from "@/chat/runtime/ChatMetaStore.js";
|
|
14
14
|
|
|
@@ -24,21 +24,21 @@ function normalizePromptValue(value: unknown, fallback: string): string {
|
|
|
24
24
|
* - 非 chat session 或尚未建立 chat route 时返回 `null`。
|
|
25
25
|
*/
|
|
26
26
|
export async function resolveCurrentChatEnvironmentPromptInput(
|
|
27
|
-
context:
|
|
28
|
-
|
|
27
|
+
context: PluginContext,
|
|
28
|
+
execution_context?: PluginExecutionContext,
|
|
29
29
|
): Promise<ChatEnvironmentPromptInput | null> {
|
|
30
|
-
const
|
|
31
|
-
if (!
|
|
30
|
+
const session_id = String(execution_context?.session_id || "").trim();
|
|
31
|
+
if (!session_id) return null;
|
|
32
32
|
|
|
33
33
|
const meta = await readChatMetaBySessionId({
|
|
34
34
|
context,
|
|
35
|
-
|
|
35
|
+
session_id,
|
|
36
36
|
}).catch(() => null);
|
|
37
37
|
if (!meta?.channel || !meta.chatId) return null;
|
|
38
38
|
|
|
39
39
|
return {
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
session_id: meta.session_id,
|
|
41
|
+
chat_key: meta.session_id,
|
|
42
42
|
channel: meta.channel,
|
|
43
43
|
chatId: meta.chatId,
|
|
44
44
|
...(meta.targetType ? { chatType: meta.targetType } : {}),
|
|
@@ -55,8 +55,8 @@ export function buildChatEnvironmentPrompt(input: ChatEnvironmentPromptInput): s
|
|
|
55
55
|
"# Current Chat Environment",
|
|
56
56
|
"以下字段只描述当前 chat 会话环境与路由,不是用户身份信息:",
|
|
57
57
|
`- channel: ${normalizePromptValue(input.channel, "unknown")}`,
|
|
58
|
-
`- session_id: ${normalizePromptValue(input.
|
|
59
|
-
`- chat_key: ${normalizePromptValue(input.
|
|
58
|
+
`- session_id: ${normalizePromptValue(input.session_id, "unknown")}`,
|
|
59
|
+
`- chat_key: ${normalizePromptValue(input.chat_key, "unknown")}`,
|
|
60
60
|
`- chat_id: ${normalizePromptValue(input.chatId, "unknown")}`,
|
|
61
61
|
`- chat_type: ${normalizePromptValue(input.chatType, "unknown")}`,
|
|
62
62
|
`- thread_id: ${normalizePromptValue(
|
|
@@ -77,12 +77,12 @@ export function buildChatEnvironmentPrompt(input: ChatEnvironmentPromptInput): s
|
|
|
77
77
|
* 读取并渲染当前请求的 chat 环境 prompt。
|
|
78
78
|
*/
|
|
79
79
|
export async function buildCurrentChatEnvironmentPrompt(
|
|
80
|
-
context:
|
|
81
|
-
|
|
80
|
+
context: PluginContext,
|
|
81
|
+
execution_context?: PluginExecutionContext,
|
|
82
82
|
): Promise<string> {
|
|
83
83
|
const input = await resolveCurrentChatEnvironmentPromptInput(
|
|
84
84
|
context,
|
|
85
|
-
|
|
85
|
+
execution_context,
|
|
86
86
|
);
|
|
87
87
|
if (!input) return "";
|
|
88
88
|
return buildChatEnvironmentPrompt(input);
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* ChannelContext 类型定义。
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
|
-
* - 描述渠道目标(platform target)与内部
|
|
6
|
-
* - 映射由 chat plugin runtime 维护,
|
|
5
|
+
* - 描述渠道目标(platform target)与内部 session_id 的映射结构。
|
|
6
|
+
* - 映射由 chat plugin runtime 维护,session_id 对外保持稳定但不可推导。
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import type { ChatDispatchChannel } from "./ChatDispatcher.js";
|
|
@@ -31,7 +31,7 @@ export type ChannelContextTarget = {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* `
|
|
34
|
+
* `session_id -> 渠道目标` 路由条目。
|
|
35
35
|
*/
|
|
36
36
|
export type ChannelContextRouteV1 = {
|
|
37
37
|
/**
|
|
@@ -39,9 +39,9 @@ export type ChannelContextRouteV1 = {
|
|
|
39
39
|
*/
|
|
40
40
|
v: 1;
|
|
41
41
|
/**
|
|
42
|
-
* 内部
|
|
42
|
+
* 内部 session_id(随机生成,不可推导)。
|
|
43
43
|
*/
|
|
44
|
-
|
|
44
|
+
session_id: string;
|
|
45
45
|
/**
|
|
46
46
|
* 渠道类型(telegram/feishu/qq)。
|
|
47
47
|
*/
|
|
@@ -59,9 +59,9 @@ export type ChannelContextRouteV1 = {
|
|
|
59
59
|
*/
|
|
60
60
|
threadId?: number;
|
|
61
61
|
/**
|
|
62
|
-
* 最近入站/出站相关
|
|
62
|
+
* 最近入站/出站相关 message_id(用于回复语义补全)。
|
|
63
63
|
*/
|
|
64
|
-
|
|
64
|
+
message_id?: string;
|
|
65
65
|
/**
|
|
66
66
|
* 最近触发该会话的用户 ID。
|
|
67
67
|
*/
|
|
@@ -81,7 +81,7 @@ export type ChannelContextRouteV1 = {
|
|
|
81
81
|
/**
|
|
82
82
|
* 路由条目更新时间(毫秒时间戳)。
|
|
83
83
|
*/
|
|
84
|
-
|
|
84
|
+
updated_at: number;
|
|
85
85
|
};
|
|
86
86
|
|
|
87
87
|
/**
|
|
@@ -95,16 +95,16 @@ export type ChannelContextMetaFileV1 = {
|
|
|
95
95
|
/**
|
|
96
96
|
* 文件更新时间(毫秒时间戳)。
|
|
97
97
|
*/
|
|
98
|
-
|
|
98
|
+
updated_at: number;
|
|
99
99
|
/**
|
|
100
|
-
* 目标键 ->
|
|
100
|
+
* 目标键 -> session_id 映射索引。
|
|
101
101
|
*
|
|
102
102
|
* 说明(中文)
|
|
103
103
|
* - 目标键由 `channel/chatId/targetType/threadId` 归一化后拼接。
|
|
104
104
|
*/
|
|
105
105
|
sessionIdByTargetKey: Record<string, string>;
|
|
106
106
|
/**
|
|
107
|
-
*
|
|
107
|
+
* session_id -> 路由信息映射索引。
|
|
108
108
|
*/
|
|
109
109
|
routesBySessionId: Record<string, ChannelContextRouteV1>;
|
|
110
110
|
};
|