@downcity/plugins 1.0.216 → 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
package/src/chat/Action.ts
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* Chat command services.
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
|
-
* - chat 语义(
|
|
5
|
+
* - chat 语义(chat_key 与 session_id 映射)统一收口在本模块
|
|
6
6
|
* - Session 运行上下文由 action 入口显式传入
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type {
|
|
10
|
-
import type {
|
|
9
|
+
import type { PluginContext } from "@downcity/agent";
|
|
10
|
+
import type { PluginExecutionContext } from "@downcity/agent";
|
|
11
11
|
import {
|
|
12
12
|
sendActionByChatKey,
|
|
13
13
|
sendTextByChatKey,
|
|
@@ -51,22 +51,23 @@ function readEnvNumber(name: string): number | undefined {
|
|
|
51
51
|
*
|
|
52
52
|
* 优先级(中文)
|
|
53
53
|
* 1) 显式参数
|
|
54
|
-
* 2) 显式
|
|
54
|
+
* 2) 显式 PluginExecutionContext
|
|
55
55
|
* 3) 环境变量回退
|
|
56
56
|
*/
|
|
57
57
|
export function resolveChatSessionSnapshot(input?: {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
context?:
|
|
61
|
-
|
|
58
|
+
session_id?: string;
|
|
59
|
+
chat_key?: string;
|
|
60
|
+
context?: PluginContext;
|
|
61
|
+
execution_context?: PluginExecutionContext;
|
|
62
62
|
}): ChatSessionSnapshot {
|
|
63
|
-
const
|
|
63
|
+
const execution_context = input?.execution_context;
|
|
64
64
|
|
|
65
|
-
const explicitSessionId = String(input?.
|
|
66
|
-
const explicitChatKey = String(input?.
|
|
65
|
+
const explicitSessionId = String(input?.session_id || "").trim();
|
|
66
|
+
const explicitChatKey = String(input?.chat_key || "").trim();
|
|
67
67
|
const requestSessionId =
|
|
68
|
-
typeof
|
|
69
|
-
|
|
68
|
+
typeof execution_context?.session_id === "string" &&
|
|
69
|
+
execution_context.session_id.trim()
|
|
70
|
+
? execution_context.session_id.trim()
|
|
70
71
|
: undefined;
|
|
71
72
|
const envSessionId = readEnvString("DC_SESSION_ID");
|
|
72
73
|
const envChatKey = readEnvString("DC_CTX_CHAT_KEY");
|
|
@@ -79,116 +80,116 @@ export function resolveChatSessionSnapshot(input?: {
|
|
|
79
80
|
const chatType =
|
|
80
81
|
readEnvString("DC_CTX_TARGET_TYPE") ||
|
|
81
82
|
readEnvString("DC_CTX_CHAT_TYPE");
|
|
82
|
-
const
|
|
83
|
+
const user_id =
|
|
83
84
|
readEnvString("DC_CTX_ACTOR_ID") ||
|
|
84
85
|
readEnvString("DC_CTX_USER_ID");
|
|
85
|
-
const
|
|
86
|
-
const
|
|
86
|
+
const message_id = readEnvString("DC_CTX_MESSAGE_ID");
|
|
87
|
+
const session_id =
|
|
87
88
|
explicitSessionId ||
|
|
88
89
|
requestSessionId ||
|
|
89
90
|
envSessionId ||
|
|
90
91
|
explicitChatKey ||
|
|
91
92
|
envChatKey;
|
|
92
|
-
const
|
|
93
|
+
const chat_key =
|
|
93
94
|
explicitChatKey ||
|
|
94
|
-
mapSessionIdToChatKey(
|
|
95
|
+
mapSessionIdToChatKey(session_id) ||
|
|
95
96
|
envChatKey;
|
|
96
97
|
|
|
97
98
|
const snapshot: ChatSessionSnapshot = {
|
|
98
|
-
...(
|
|
99
|
-
...(
|
|
99
|
+
...(session_id ? { session_id } : {}),
|
|
100
|
+
...(chat_key ? { chat_key } : {}),
|
|
100
101
|
channel,
|
|
101
102
|
chatId,
|
|
102
103
|
messageThreadId,
|
|
103
104
|
chatType,
|
|
104
|
-
|
|
105
|
-
|
|
105
|
+
user_id,
|
|
106
|
+
message_id,
|
|
106
107
|
};
|
|
107
108
|
|
|
108
109
|
return snapshot;
|
|
109
110
|
}
|
|
110
111
|
|
|
111
112
|
/**
|
|
112
|
-
* 将
|
|
113
|
+
* 将 session_id 映射为可发送的 chat_key。
|
|
113
114
|
*
|
|
114
115
|
* 关键点(中文)
|
|
115
|
-
* - 当前实现下:chat plugin runtime 内部把
|
|
116
|
-
* - 不再依赖字符串规则推导(
|
|
116
|
+
* - 当前实现下:chat plugin runtime 内部把 session_id 视作可发送 chat_key。
|
|
117
|
+
* - 不再依赖字符串规则推导(session_id 可为随机值)。
|
|
117
118
|
*/
|
|
118
|
-
export function mapSessionIdToChatKey(
|
|
119
|
-
const key = String(
|
|
119
|
+
export function mapSessionIdToChatKey(session_id?: string): string | undefined {
|
|
120
|
+
const key = String(session_id || "").trim();
|
|
120
121
|
if (!key) return undefined;
|
|
121
122
|
return key;
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
/**
|
|
125
|
-
* 提取最终
|
|
126
|
+
* 提取最终 session_id。
|
|
126
127
|
*/
|
|
127
|
-
export function
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
context?:
|
|
131
|
-
|
|
128
|
+
export function resolve_session_id(input?: {
|
|
129
|
+
session_id?: string;
|
|
130
|
+
chat_key?: string;
|
|
131
|
+
context?: PluginContext;
|
|
132
|
+
execution_context?: PluginExecutionContext;
|
|
132
133
|
}): string | undefined {
|
|
133
134
|
const snapshot = resolveChatSessionSnapshot({
|
|
134
|
-
|
|
135
|
-
|
|
135
|
+
session_id: input?.session_id,
|
|
136
|
+
chat_key: input?.chat_key,
|
|
136
137
|
context: input?.context,
|
|
137
|
-
|
|
138
|
+
execution_context: input?.execution_context,
|
|
138
139
|
});
|
|
139
|
-
const key = String(snapshot.
|
|
140
|
+
const key = String(snapshot.session_id || "").trim();
|
|
140
141
|
return key ? key : undefined;
|
|
141
142
|
}
|
|
142
143
|
|
|
143
144
|
/**
|
|
144
|
-
* 提取最终
|
|
145
|
+
* 提取最终 chat_key(用于发送路径)。
|
|
145
146
|
*/
|
|
146
147
|
export function resolveChatKey(input?: {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
context?:
|
|
150
|
-
|
|
148
|
+
chat_key?: string;
|
|
149
|
+
session_id?: string;
|
|
150
|
+
context?: PluginContext;
|
|
151
|
+
execution_context?: PluginExecutionContext;
|
|
151
152
|
}): string | undefined {
|
|
152
153
|
const snapshot = resolveChatSessionSnapshot({
|
|
153
|
-
|
|
154
|
-
|
|
154
|
+
chat_key: input?.chat_key,
|
|
155
|
+
session_id: input?.session_id,
|
|
155
156
|
context: input?.context,
|
|
156
|
-
|
|
157
|
+
execution_context: input?.execution_context,
|
|
157
158
|
});
|
|
158
|
-
const key = String(snapshot.
|
|
159
|
+
const key = String(snapshot.chat_key || "").trim();
|
|
159
160
|
return key ? key : undefined;
|
|
160
161
|
}
|
|
161
162
|
|
|
162
163
|
/**
|
|
163
|
-
* 解析当前发送应绑定的 reply
|
|
164
|
+
* 解析当前发送应绑定的 reply message_id。
|
|
164
165
|
*
|
|
165
166
|
* 关键点(中文)
|
|
166
|
-
* - 只有显式 reply 且未手动传入
|
|
167
|
-
* - 仅在目标
|
|
168
|
-
* -
|
|
167
|
+
* - 只有显式 reply 且未手动传入 message_id 时才尝试补全。
|
|
168
|
+
* - 仅在目标 chat_key 与当前显式请求上下文一致时,才复用 `DC_CTX_MESSAGE_ID`。
|
|
169
|
+
* - 这样可把一次处理固定到触发它的那条消息,避免处理中被后续新消息覆盖。
|
|
169
170
|
*/
|
|
170
171
|
function resolveReplyMessageIdForChatSend(params: {
|
|
171
|
-
|
|
172
|
-
context:
|
|
173
|
-
|
|
172
|
+
chat_key: string;
|
|
173
|
+
context: PluginContext;
|
|
174
|
+
reply_to_message: boolean;
|
|
174
175
|
explicitMessageId?: string;
|
|
175
|
-
|
|
176
|
+
execution_context?: PluginExecutionContext;
|
|
176
177
|
}): string | undefined {
|
|
177
178
|
const explicitMessageId =
|
|
178
179
|
typeof params.explicitMessageId === "string" && params.explicitMessageId.trim()
|
|
179
180
|
? params.explicitMessageId.trim()
|
|
180
181
|
: undefined;
|
|
181
182
|
if (explicitMessageId) return explicitMessageId;
|
|
182
|
-
if (params.
|
|
183
|
+
if (params.reply_to_message !== true) return undefined;
|
|
183
184
|
|
|
184
185
|
const snapshot = resolveChatSessionSnapshot({
|
|
185
186
|
context: params.context,
|
|
186
|
-
|
|
187
|
+
execution_context: params.execution_context,
|
|
187
188
|
});
|
|
188
|
-
const snapshotChatKey = String(snapshot.
|
|
189
|
-
const snapshotMessageId = String(snapshot.
|
|
189
|
+
const snapshotChatKey = String(snapshot.chat_key || "").trim();
|
|
190
|
+
const snapshotMessageId = String(snapshot.message_id || "").trim();
|
|
190
191
|
if (!snapshotChatKey || !snapshotMessageId) return undefined;
|
|
191
|
-
return snapshotChatKey === params.
|
|
192
|
+
return snapshotChatKey === params.chat_key ? snapshotMessageId : undefined;
|
|
192
193
|
}
|
|
193
194
|
|
|
194
195
|
/**
|
|
@@ -223,17 +224,17 @@ export function normalizeChatSendText(raw: string): string {
|
|
|
223
224
|
* 发送前延迟。
|
|
224
225
|
*
|
|
225
226
|
* 关键点(中文)
|
|
226
|
-
* - 支持延迟毫秒(
|
|
227
|
+
* - 支持延迟毫秒(delay_ms)或绝对时间(send_at_ms)
|
|
227
228
|
* - 超长等待按分片 setTimeout,避免超出 Node 单次定时器上限
|
|
228
229
|
*/
|
|
229
230
|
function resolveTargetWaitMs(params: {
|
|
230
|
-
|
|
231
|
-
|
|
231
|
+
delay_ms: number;
|
|
232
|
+
send_at_ms?: number;
|
|
232
233
|
}): number {
|
|
233
|
-
const
|
|
234
|
-
const
|
|
234
|
+
const delay_ms = params.delay_ms;
|
|
235
|
+
const send_at_ms = params.send_at_ms;
|
|
235
236
|
const rawWaitMs =
|
|
236
|
-
typeof
|
|
237
|
+
typeof send_at_ms === "number" ? Math.max(0, send_at_ms - Date.now()) : delay_ms;
|
|
237
238
|
if (!Number.isFinite(rawWaitMs) || Number.isNaN(rawWaitMs) || rawWaitMs <= 0) return 0;
|
|
238
239
|
return Math.trunc(rawWaitMs);
|
|
239
240
|
}
|
|
@@ -252,25 +253,25 @@ async function waitByTimeoutChunks(waitMs: number): Promise<void> {
|
|
|
252
253
|
}
|
|
253
254
|
|
|
254
255
|
async function waitBeforeSend(params: {
|
|
255
|
-
|
|
256
|
-
|
|
256
|
+
delay_ms: number;
|
|
257
|
+
send_at_ms?: number;
|
|
257
258
|
}): Promise<void> {
|
|
258
259
|
await waitByTimeoutChunks(resolveTargetWaitMs(params));
|
|
259
260
|
}
|
|
260
261
|
|
|
261
262
|
/**
|
|
262
|
-
* 按
|
|
263
|
+
* 按 chat_key 发送文本。
|
|
263
264
|
*
|
|
264
265
|
* 关键点(中文)
|
|
265
266
|
* - chat plugin runtime 不关心具体平台;由 runtime sender 做 channel 分发。
|
|
266
267
|
* - 返回统一结构,便于上层链路做可观测与错误汇总。
|
|
267
268
|
*/
|
|
268
269
|
export async function sendChatTextByChatKey(params: {
|
|
269
|
-
context:
|
|
270
|
-
|
|
270
|
+
context: PluginContext;
|
|
271
|
+
chat_key: string;
|
|
271
272
|
text: string;
|
|
272
|
-
|
|
273
|
-
|
|
273
|
+
delay_ms?: number;
|
|
274
|
+
send_at_ms?: number;
|
|
274
275
|
/**
|
|
275
276
|
* 延迟发送是否异步调度(不阻塞当前调用)。
|
|
276
277
|
*
|
|
@@ -279,43 +280,43 @@ export async function sendChatTextByChatKey(params: {
|
|
|
279
280
|
* - 默认 false,保持 CLI/API 的阻塞行为不变。
|
|
280
281
|
*/
|
|
281
282
|
nonBlockingDelay?: boolean;
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
283
|
+
reply_to_message?: boolean;
|
|
284
|
+
message_id?: string;
|
|
285
|
+
execution_context?: PluginExecutionContext;
|
|
285
286
|
}): Promise<ChatSendResponse> {
|
|
286
|
-
const
|
|
287
|
+
const chat_key = String(params.chat_key || "").trim();
|
|
287
288
|
const text = normalizeChatSendText(String(params.text ?? ""));
|
|
288
|
-
const
|
|
289
|
-
typeof params.
|
|
290
|
-
? Math.max(0, Math.trunc(params.
|
|
289
|
+
const delay_ms =
|
|
290
|
+
typeof params.delay_ms === "number" && Number.isFinite(params.delay_ms)
|
|
291
|
+
? Math.max(0, Math.trunc(params.delay_ms))
|
|
291
292
|
: 0;
|
|
292
|
-
const
|
|
293
|
-
typeof params.
|
|
294
|
-
? Math.max(0, Math.trunc(params.
|
|
293
|
+
const send_at_ms =
|
|
294
|
+
typeof params.send_at_ms === "number" && Number.isFinite(params.send_at_ms)
|
|
295
|
+
? Math.max(0, Math.trunc(params.send_at_ms))
|
|
295
296
|
: undefined;
|
|
296
|
-
if (!
|
|
297
|
+
if (!chat_key) {
|
|
297
298
|
return {
|
|
298
299
|
success: false,
|
|
299
|
-
error: "Missing
|
|
300
|
+
error: "Missing chat_key",
|
|
300
301
|
};
|
|
301
302
|
}
|
|
302
|
-
if (
|
|
303
|
+
if (delay_ms > 0 && typeof send_at_ms === "number") {
|
|
303
304
|
return {
|
|
304
305
|
success: false,
|
|
305
|
-
|
|
306
|
-
error: "
|
|
306
|
+
chat_key,
|
|
307
|
+
error: "delay_ms and send_at_ms cannot be used together",
|
|
307
308
|
};
|
|
308
309
|
}
|
|
309
310
|
|
|
310
|
-
const
|
|
311
|
-
const
|
|
311
|
+
const reply_to_message = params.reply_to_message === true;
|
|
312
|
+
const message_id = resolveReplyMessageIdForChatSend({
|
|
312
313
|
context: params.context,
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
explicitMessageId: params.
|
|
316
|
-
|
|
314
|
+
chat_key,
|
|
315
|
+
reply_to_message,
|
|
316
|
+
explicitMessageId: params.message_id,
|
|
317
|
+
execution_context: params.execution_context,
|
|
317
318
|
});
|
|
318
|
-
const targetWaitMs = resolveTargetWaitMs({
|
|
319
|
+
const targetWaitMs = resolveTargetWaitMs({ delay_ms, send_at_ms });
|
|
319
320
|
if (params.nonBlockingDelay === true && targetWaitMs > 0) {
|
|
320
321
|
// 关键点(中文):异步调度延迟发送,让调用方可立即结束当前 run。
|
|
321
322
|
void (async () => {
|
|
@@ -323,162 +324,162 @@ export async function sendChatTextByChatKey(params: {
|
|
|
323
324
|
await waitByTimeoutChunks(targetWaitMs);
|
|
324
325
|
const delayed = await sendTextByChatKey({
|
|
325
326
|
context: params.context,
|
|
326
|
-
|
|
327
|
+
chat_key,
|
|
327
328
|
text,
|
|
328
|
-
|
|
329
|
-
...(
|
|
329
|
+
reply_to_message,
|
|
330
|
+
...(message_id ? { message_id } : {}),
|
|
330
331
|
});
|
|
331
332
|
if (!delayed.success) {
|
|
332
333
|
params.context.logger.warn("Delayed chat send failed", {
|
|
333
|
-
|
|
334
|
+
chat_key,
|
|
334
335
|
error: delayed.error || "chat send failed",
|
|
335
336
|
});
|
|
336
337
|
}
|
|
337
338
|
} catch (error) {
|
|
338
339
|
params.context.logger.warn("Delayed chat send failed", {
|
|
339
|
-
|
|
340
|
+
chat_key,
|
|
340
341
|
error: String(error),
|
|
341
342
|
});
|
|
342
343
|
}
|
|
343
344
|
})();
|
|
344
345
|
return {
|
|
345
346
|
success: true,
|
|
346
|
-
|
|
347
|
+
chat_key,
|
|
347
348
|
};
|
|
348
349
|
}
|
|
349
350
|
|
|
350
|
-
await waitBeforeSend({
|
|
351
|
+
await waitBeforeSend({ delay_ms, send_at_ms });
|
|
351
352
|
|
|
352
353
|
const result = await sendTextByChatKey({
|
|
353
354
|
context: params.context,
|
|
354
|
-
|
|
355
|
+
chat_key,
|
|
355
356
|
text,
|
|
356
|
-
|
|
357
|
-
...(
|
|
357
|
+
reply_to_message,
|
|
358
|
+
...(message_id ? { message_id } : {}),
|
|
358
359
|
});
|
|
359
360
|
return {
|
|
360
361
|
success: Boolean(result.success),
|
|
361
|
-
|
|
362
|
+
chat_key,
|
|
362
363
|
...(result.success ? {} : { error: result.error || "chat send failed" }),
|
|
363
364
|
};
|
|
364
365
|
}
|
|
365
366
|
|
|
366
367
|
/**
|
|
367
|
-
* 按
|
|
368
|
+
* 按 chat_key 发送平台动作(typing/react)。
|
|
368
369
|
*
|
|
369
370
|
* 关键点(中文)
|
|
370
|
-
* - 动作分发与文本发送复用同一
|
|
371
|
+
* - 动作分发与文本发送复用同一 chat_key 解析与 channel dispatcher。
|
|
371
372
|
*/
|
|
372
373
|
export async function sendChatActionByChatKey(params: {
|
|
373
|
-
context:
|
|
374
|
-
|
|
374
|
+
context: PluginContext;
|
|
375
|
+
chat_key: string;
|
|
375
376
|
action: ChatDispatchAction;
|
|
376
|
-
|
|
377
|
+
message_id?: string;
|
|
377
378
|
reactionEmoji?: string;
|
|
378
379
|
reactionIsBig?: boolean;
|
|
379
380
|
}): Promise<ChatReactResponse> {
|
|
380
|
-
const
|
|
381
|
-
if (!
|
|
381
|
+
const chat_key = String(params.chat_key || "").trim();
|
|
382
|
+
if (!chat_key) {
|
|
382
383
|
return {
|
|
383
384
|
success: false,
|
|
384
|
-
error: "Missing
|
|
385
|
+
error: "Missing chat_key",
|
|
385
386
|
};
|
|
386
387
|
}
|
|
387
388
|
|
|
388
389
|
const result = await sendActionByChatKey({
|
|
389
390
|
context: params.context,
|
|
390
|
-
|
|
391
|
+
chat_key,
|
|
391
392
|
action: params.action,
|
|
392
|
-
|
|
393
|
+
message_id: params.message_id,
|
|
393
394
|
reactionEmoji: params.reactionEmoji,
|
|
394
395
|
reactionIsBig: params.reactionIsBig,
|
|
395
396
|
});
|
|
396
|
-
const
|
|
397
|
+
const message_id = String(params.message_id || "").trim();
|
|
397
398
|
return {
|
|
398
399
|
success: Boolean(result.success),
|
|
399
|
-
|
|
400
|
-
...(
|
|
400
|
+
chat_key,
|
|
401
|
+
...(message_id ? { message_id } : {}),
|
|
401
402
|
...(result.success ? {} : { error: result.error || "chat action failed" }),
|
|
402
403
|
};
|
|
403
404
|
}
|
|
404
405
|
|
|
405
406
|
/**
|
|
406
|
-
* 按
|
|
407
|
+
* 按 session_id 发送文本。
|
|
407
408
|
*
|
|
408
409
|
* 关键点(中文)
|
|
409
|
-
* -
|
|
410
|
+
* - session_id -> chat_key 映射关系只在 chat plugin runtime 内部维护。
|
|
410
411
|
*/
|
|
411
412
|
export async function sendChatTextBySessionId(params: {
|
|
412
|
-
context:
|
|
413
|
-
|
|
413
|
+
context: PluginContext;
|
|
414
|
+
session_id: string;
|
|
414
415
|
text: string;
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
}): Promise<{ success: boolean;
|
|
420
|
-
const
|
|
421
|
-
if (!
|
|
416
|
+
delay_ms?: number;
|
|
417
|
+
send_at_ms?: number;
|
|
418
|
+
reply_to_message?: boolean;
|
|
419
|
+
message_id?: string;
|
|
420
|
+
}): Promise<{ success: boolean; session_id: string; error?: string }> {
|
|
421
|
+
const session_id = String(params.session_id || "").trim();
|
|
422
|
+
if (!session_id) {
|
|
422
423
|
return {
|
|
423
424
|
success: false,
|
|
424
|
-
|
|
425
|
-
error: "Missing
|
|
425
|
+
session_id: "",
|
|
426
|
+
error: "Missing session_id",
|
|
426
427
|
};
|
|
427
428
|
}
|
|
428
429
|
|
|
429
430
|
const result = await sendChatTextByChatKey({
|
|
430
431
|
context: params.context,
|
|
431
|
-
|
|
432
|
+
chat_key: session_id,
|
|
432
433
|
text: params.text,
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
...(typeof params.
|
|
437
|
-
? {
|
|
434
|
+
delay_ms: params.delay_ms,
|
|
435
|
+
send_at_ms: params.send_at_ms,
|
|
436
|
+
reply_to_message: params.reply_to_message === true,
|
|
437
|
+
...(typeof params.message_id === "string" && params.message_id.trim()
|
|
438
|
+
? { message_id: params.message_id.trim() }
|
|
438
439
|
: {}),
|
|
439
440
|
});
|
|
440
441
|
return {
|
|
441
442
|
success: Boolean(result.success),
|
|
442
|
-
|
|
443
|
+
session_id,
|
|
443
444
|
...(result.success ? {} : { error: result.error || "chat send failed" }),
|
|
444
445
|
};
|
|
445
446
|
}
|
|
446
447
|
|
|
447
448
|
/**
|
|
448
|
-
* 按
|
|
449
|
+
* 按 chat_key/session_id 彻底删除 chat 会话。
|
|
449
450
|
*
|
|
450
451
|
* 关键点(中文)
|
|
451
|
-
* -
|
|
452
|
+
* - chat_key 与 session_id 在 chat plugin runtime 内部等价使用。
|
|
452
453
|
* - 删除包含:路由映射 + chat 审计目录 + session 目录 + 渠道状态清理。
|
|
453
454
|
*/
|
|
454
455
|
export async function deleteChatByChatKey(params: {
|
|
455
|
-
context:
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
456
|
+
context: PluginContext;
|
|
457
|
+
chat_key?: string;
|
|
458
|
+
session_id?: string;
|
|
459
|
+
execution_context?: PluginExecutionContext;
|
|
459
460
|
}): Promise<ChatDeleteResponse> {
|
|
460
|
-
const
|
|
461
|
+
const chat_key = resolveChatKey({
|
|
461
462
|
context: params.context,
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
463
|
+
chat_key: params.chat_key,
|
|
464
|
+
session_id: params.session_id,
|
|
465
|
+
execution_context: params.execution_context,
|
|
465
466
|
});
|
|
466
|
-
const
|
|
467
|
-
if (!
|
|
467
|
+
const session_id = String(chat_key || "").trim();
|
|
468
|
+
if (!session_id) {
|
|
468
469
|
return {
|
|
469
470
|
success: false,
|
|
470
471
|
error:
|
|
471
|
-
"Missing
|
|
472
|
+
"Missing chat_key/session_id. Provide --chat-key or --session-id, or ensure DC_CTX_CHAT_KEY/DC_SESSION_ID is injected.",
|
|
472
473
|
};
|
|
473
474
|
}
|
|
474
475
|
|
|
475
476
|
const result = await deleteChatSessionById({
|
|
476
477
|
context: params.context,
|
|
477
|
-
|
|
478
|
+
session_id,
|
|
478
479
|
});
|
|
479
480
|
return {
|
|
480
481
|
success: result.success,
|
|
481
|
-
|
|
482
|
+
session_id: result.session_id,
|
|
482
483
|
deleted: result.deleted,
|
|
483
484
|
removedMeta: result.removedMeta,
|
|
484
485
|
removedChatDir: result.removedChatDir,
|
package/src/chat/ChatPlugin.ts
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
import { BasePlugin } from "@downcity/agent";
|
|
12
12
|
import type { PluginActions } from "@downcity/agent";
|
|
13
|
-
import type {
|
|
14
|
-
import type {
|
|
13
|
+
import type { PluginContext } from "@downcity/agent";
|
|
14
|
+
import type { PluginExecutionContext } from "@downcity/agent";
|
|
15
15
|
import type { ChatChannelState } from "@/chat/types/ChatRuntime.js";
|
|
16
16
|
import type { ChatQueueWorkerConfig } from "@/chat/types/ChatQueueWorker.js";
|
|
17
17
|
import type {
|
|
@@ -89,10 +89,10 @@ export class ChatPlugin extends BasePlugin {
|
|
|
89
89
|
* 当前 plugin 的 system 文本构建器。
|
|
90
90
|
*/
|
|
91
91
|
readonly system = async (
|
|
92
|
-
context:
|
|
93
|
-
|
|
92
|
+
context: PluginContext,
|
|
93
|
+
execution_context?: PluginExecutionContext,
|
|
94
94
|
): Promise<string> => {
|
|
95
|
-
return await buildChatPluginSystem(context,
|
|
95
|
+
return await buildChatPluginSystem(context, execution_context);
|
|
96
96
|
};
|
|
97
97
|
|
|
98
98
|
/**
|
|
@@ -103,7 +103,7 @@ export class ChatPlugin extends BasePlugin {
|
|
|
103
103
|
/**
|
|
104
104
|
* 启动当前实例的 queue worker。
|
|
105
105
|
*/
|
|
106
|
-
private startQueueWorker(context:
|
|
106
|
+
private startQueueWorker(context: PluginContext): void {
|
|
107
107
|
if (this.queueWorker) return;
|
|
108
108
|
const worker = new ChatQueueWorker({
|
|
109
109
|
logger: context.logger,
|
|
@@ -153,7 +153,7 @@ export class ChatPlugin extends BasePlugin {
|
|
|
153
153
|
* 读取 queue worker 配置。
|
|
154
154
|
*/
|
|
155
155
|
getQueueWorkerConfig(
|
|
156
|
-
context:
|
|
156
|
+
context: PluginContext,
|
|
157
157
|
): Partial<ChatQueueWorkerConfig> | undefined {
|
|
158
158
|
void context;
|
|
159
159
|
return this.options.queue;
|
|
@@ -162,25 +162,25 @@ export class ChatPlugin extends BasePlugin {
|
|
|
162
162
|
/**
|
|
163
163
|
* 判断指定渠道是否启用。
|
|
164
164
|
*/
|
|
165
|
-
isChannelEnabled(context:
|
|
165
|
+
isChannelEnabled(context: PluginContext, channel: ChatChannelName): boolean {
|
|
166
166
|
return this.getChannel(channel)?.isEnabled(context) === true;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
/**
|
|
170
170
|
* 读取指定渠道的显式账户 ID。
|
|
171
171
|
*/
|
|
172
|
-
|
|
173
|
-
context:
|
|
172
|
+
getResourceId(
|
|
173
|
+
context: PluginContext,
|
|
174
174
|
channel: ChatChannelName,
|
|
175
175
|
): string {
|
|
176
|
-
return String(this.getChannel(channel)?.
|
|
176
|
+
return String(this.getChannel(channel)?.getResourceId(context) || "").trim();
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
/**
|
|
180
180
|
* 解析指定渠道当前应使用的账户。
|
|
181
181
|
*/
|
|
182
182
|
resolveChannelAccount(
|
|
183
|
-
context:
|
|
183
|
+
context: PluginContext,
|
|
184
184
|
channel: ChatChannelName,
|
|
185
185
|
) {
|
|
186
186
|
return this.getChannel(channel)?.getAccount(context) || null;
|
package/src/chat/Index.ts
CHANGED
|
@@ -11,6 +11,16 @@ export {
|
|
|
11
11
|
QqChannel,
|
|
12
12
|
TelegramChannel,
|
|
13
13
|
} from "./channels/RuntimeChannel.js";
|
|
14
|
+
export {
|
|
15
|
+
CHAT_PLUGIN_CONFIG_JSON_SCHEMA,
|
|
16
|
+
CHAT_PLUGIN_RESOURCE_JSON_SCHEMA,
|
|
17
|
+
chat_plugin_config_schema,
|
|
18
|
+
chat_plugin_resource_schema,
|
|
19
|
+
get_chat_plugin_resource_json_schema,
|
|
20
|
+
parse_chat_plugin_config,
|
|
21
|
+
parse_chat_plugin_resource,
|
|
22
|
+
resolve_chat_plugin_resource,
|
|
23
|
+
} from "./config/ChatPluginConfig.js";
|
|
14
24
|
export type {
|
|
15
25
|
BaseChatChannelOptions,
|
|
16
26
|
ChatChannelEnv,
|
|
@@ -22,3 +32,5 @@ export type {
|
|
|
22
32
|
ChatChannel,
|
|
23
33
|
ChatPluginOptions,
|
|
24
34
|
} from "./types/ChatPluginOptions.js";
|
|
35
|
+
export type { ChatPluginConfig } from "./config/ChatPluginConfig.js";
|
|
36
|
+
export type { ChatPluginResource } from "./types/ChatPluginResource.js";
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
// Source: src/chat/PROMPT.direct.ts.txt
|
|
7
|
-
const TEXT_MODULE_CONTENT = "# Chat Plugin Instructions\n\n## User-Visible Reply Rules\n\n- In the current mode, your direct assistant output is sent as a message to the user's corresponding channel.\n\n## Output Protocol\n\n- For a normal reply, output plain text directly. Optional frontmatter metadata may appear at the very top of the text. Field semantics match the chat plugin direct-send protocol:\n\n- `delay` / `
|
|
7
|
+
const TEXT_MODULE_CONTENT = "# Chat Plugin Instructions\n\n## User-Visible Reply Rules\n\n- In the current mode, your direct assistant output is sent as a message to the user's corresponding channel.\n\n## Output Protocol\n\n- For a normal reply, output plain text directly. Optional frontmatter metadata may appear at the very top of the text. Field semantics match the chat plugin direct-send protocol:\n\n- `delay` / `delay_ms`: delay before sending, in milliseconds.\n- `time` / `sendAt` / `send_at_ms`: scheduled send time.\n- `reply`: whether to send with reply semantics.\n- `message_id`: target `message_id`, recommended for group chats.\n- `react`: send an emoji reaction.\n - Single string: `react: \"thumbs up\"`\n - Or an object/array: `emoji/big`\n - When `message_id` is set, `react` reuses that message as the target first.\n- Attachments use `<file type=\"...\">path</file>` and support `document/photo/voice/audio/video`.\n- Attachment paths must be relative paths accessible inside the project. For multiple attachments, output multiple `<file>` tags.\n\n### Example\n\n```text\n---\nreply: true\nmessageId: \"128\"\nreact:\n - emoji: \"done\"\n---\nHere is today's report.\n<file type=\"document\">reports/daily.md</file>\n```\n\n### Protocol Constraints\n\n- Frontmatter must be at the very beginning of the text and wrapped with `---`.\n- Except for `<file>` attachment tags, do not use angle-bracket syntax for control parameters.\n\n## Cross-Protocol Or Cross-Platform Operations\n\n- For replies inside the current conversation, prefer outputting text directly. The system will send it to the current channel automatically.\n- When a task needs cross-conversation, cross-platform, or complex routing, use chat plugin actions.\n- If `plugin_call` is available, call `plugin_call({ plugin: \"chat\", action: \"send\", payload })` or `plugin_call({ plugin: \"chat\", action: \"react\", payload })`.\n- Metadata applies only to direct outbound messages in the current conversation. Do not use metadata for cross-chat routing.\n- If cross-chat routing parameters are unclear, first read the current chat context or call chat plugin query actions instead of guessing.\n\n## Inbound Message Structure\n\n- Each queued user message contains an `<info>...</info>` metadata block plus the user text.\n- `<info>` keeps only user/request metadata such as `user_id`, `username`, `message_id`, and `received_at`.\n- The current chat routing environment, such as `channel`, `session_id`, `chat_key`, and `chat_id`, is injected separately through the system prompt and is no longer mixed into `<info>`.\n- Do not echo `<info>` back to the user.\n";
|
|
8
8
|
|
|
9
9
|
export default TEXT_MODULE_CONTENT;
|