@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
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import type { Logger } from "@downcity/agent";
|
|
11
|
-
import type {
|
|
11
|
+
import type { PluginContext } from "@downcity/agent";
|
|
12
12
|
import type { ChatQueueWorkerConfig } from "@/chat/types/ChatQueueWorker.js";
|
|
13
13
|
import type { ChatQueueItem } from "@/chat/types/ChatQueue.js";
|
|
14
14
|
import type { SessionMutation } from "@downcity/agent";
|
|
@@ -17,9 +17,6 @@ import {
|
|
|
17
17
|
getSharedChatQueueStore,
|
|
18
18
|
} from "./ChatQueue.js";
|
|
19
19
|
import { getChatSender } from "./ChatSendRegistry.js";
|
|
20
|
-
import {
|
|
21
|
-
pickLastSuccessfulChatSendText,
|
|
22
|
-
} from "@downcity/agent";
|
|
23
20
|
import {
|
|
24
21
|
buildChannelErrorText,
|
|
25
22
|
collectInitialBurstItems,
|
|
@@ -42,15 +39,15 @@ type LaneState = {
|
|
|
42
39
|
};
|
|
43
40
|
|
|
44
41
|
type TurnObservation = {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
turn_id: string;
|
|
43
|
+
session_id: string;
|
|
44
|
+
message_id?: string;
|
|
48
45
|
typing: { stop: () => void };
|
|
49
46
|
};
|
|
50
47
|
|
|
51
48
|
export class ChatQueueWorker {
|
|
52
49
|
private readonly logger: Logger;
|
|
53
|
-
private readonly context:
|
|
50
|
+
private readonly context: PluginContext;
|
|
54
51
|
private readonly config: ChatQueueWorkerConfig;
|
|
55
52
|
private readonly queueStore: ChatQueueStorePort;
|
|
56
53
|
|
|
@@ -63,7 +60,7 @@ export class ChatQueueWorker {
|
|
|
63
60
|
|
|
64
61
|
constructor(params: {
|
|
65
62
|
logger: Logger;
|
|
66
|
-
context:
|
|
63
|
+
context: PluginContext;
|
|
67
64
|
queueStore?: ChatQueueStorePort;
|
|
68
65
|
config?: Partial<ChatQueueWorkerConfig>;
|
|
69
66
|
}) {
|
|
@@ -134,7 +131,7 @@ export class ChatQueueWorker {
|
|
|
134
131
|
|
|
135
132
|
private async kick(): Promise<void> {
|
|
136
133
|
if (this.stopped) return;
|
|
137
|
-
while (this.runningTotal < this.config.
|
|
134
|
+
while (this.runningTotal < this.config.max_concurrency) {
|
|
138
135
|
const lane = this.pickNextRunnableLane();
|
|
139
136
|
if (!lane) return;
|
|
140
137
|
|
|
@@ -170,8 +167,8 @@ export class ChatQueueWorker {
|
|
|
170
167
|
* - 只对支持显式取消的 runtime 生效(主要是 ACP)。
|
|
171
168
|
* - 失败不影响正常排队;worker 仍会走串行兜底。
|
|
172
169
|
*/
|
|
173
|
-
private async requestTurnCancelIfSupported(
|
|
174
|
-
const sessionKey = String(
|
|
170
|
+
private async requestTurnCancelIfSupported(session_id: string): Promise<void> {
|
|
171
|
+
const sessionKey = String(session_id || "").trim();
|
|
175
172
|
if (!sessionKey) return;
|
|
176
173
|
try {
|
|
177
174
|
// ACP executor removed; cancel is no longer supported through session executor port.
|
|
@@ -187,7 +184,7 @@ export class ChatQueueWorker {
|
|
|
187
184
|
const control = item.control;
|
|
188
185
|
if (!control) return false;
|
|
189
186
|
if (control.type === "clear") {
|
|
190
|
-
this.queueStore.clear(item.
|
|
187
|
+
this.queueStore.clear(item.session_id);
|
|
191
188
|
return true;
|
|
192
189
|
}
|
|
193
190
|
return false;
|
|
@@ -222,8 +219,8 @@ export class ChatQueueWorker {
|
|
|
222
219
|
...(typeof item.targetType === "string" && item.targetType
|
|
223
220
|
? { chatType: item.targetType }
|
|
224
221
|
: {}),
|
|
225
|
-
...(typeof item.
|
|
226
|
-
? {
|
|
222
|
+
...(typeof item.message_id === "string" && item.message_id
|
|
223
|
+
? { message_id: item.message_id }
|
|
227
224
|
: {}),
|
|
228
225
|
});
|
|
229
226
|
} catch {
|
|
@@ -251,9 +248,9 @@ export class ChatQueueWorker {
|
|
|
251
248
|
* - 若 direct 未送达,则立刻回退到普通 channel 文本发送。
|
|
252
249
|
*/
|
|
253
250
|
private async dispatchAssistantStepMessage(params: {
|
|
254
|
-
|
|
251
|
+
session_id: string;
|
|
255
252
|
text: string;
|
|
256
|
-
|
|
253
|
+
message_id?: string;
|
|
257
254
|
}): Promise<boolean> {
|
|
258
255
|
const stepText = String(params.text || "").trim();
|
|
259
256
|
if (!stepText) return false;
|
|
@@ -261,7 +258,7 @@ export class ChatQueueWorker {
|
|
|
261
258
|
const dispatchedDirectly = await dispatchAssistantTextDirect({
|
|
262
259
|
logger: this.logger,
|
|
263
260
|
context: this.context,
|
|
264
|
-
|
|
261
|
+
session_id: params.session_id,
|
|
265
262
|
assistantText: stepText,
|
|
266
263
|
phase: "step",
|
|
267
264
|
});
|
|
@@ -272,9 +269,9 @@ export class ChatQueueWorker {
|
|
|
272
269
|
return await dispatchTextToChannel({
|
|
273
270
|
logger: this.logger,
|
|
274
271
|
context: this.context,
|
|
275
|
-
|
|
272
|
+
session_id: params.session_id,
|
|
276
273
|
text: stepText,
|
|
277
|
-
|
|
274
|
+
message_id: params.message_id,
|
|
278
275
|
phase: "step",
|
|
279
276
|
});
|
|
280
277
|
}
|
|
@@ -290,8 +287,8 @@ export class ChatQueueWorker {
|
|
|
290
287
|
return;
|
|
291
288
|
}
|
|
292
289
|
|
|
293
|
-
const serviceContext = this.requireContext(first.
|
|
294
|
-
this.ensureLaneSessionSubscription(lane, first.
|
|
290
|
+
const serviceContext = this.requireContext(first.session_id);
|
|
291
|
+
this.ensureLaneSessionSubscription(lane, first.session_id);
|
|
295
292
|
|
|
296
293
|
let clearRequested = false;
|
|
297
294
|
const initialBurstItems = await collectInitialBurstItems({
|
|
@@ -315,16 +312,16 @@ export class ChatQueueWorker {
|
|
|
315
312
|
}
|
|
316
313
|
|
|
317
314
|
if (clearRequested) {
|
|
318
|
-
this.queueStore.clear(first.
|
|
315
|
+
this.queueStore.clear(first.session_id);
|
|
319
316
|
}
|
|
320
317
|
}
|
|
321
318
|
|
|
322
319
|
private ensureLaneSessionSubscription(
|
|
323
320
|
lane: LaneState,
|
|
324
|
-
|
|
321
|
+
session_id: string,
|
|
325
322
|
): void {
|
|
326
323
|
if (lane.unsubscribeSessionEvents) return;
|
|
327
|
-
const session = this.requireContext(
|
|
324
|
+
const session = this.requireContext(session_id);
|
|
328
325
|
lane.unsubscribeSessionEvents = session.subscribe((event) => {
|
|
329
326
|
void this.handleLaneSessionEvent(lane, event);
|
|
330
327
|
});
|
|
@@ -358,13 +355,13 @@ export class ChatQueueWorker {
|
|
|
358
355
|
|
|
359
356
|
try {
|
|
360
357
|
await this.dispatchAssistantStepMessage({
|
|
361
|
-
|
|
358
|
+
session_id: observation.session_id,
|
|
362
359
|
text: segment_text,
|
|
363
|
-
|
|
360
|
+
message_id: observation.message_id,
|
|
364
361
|
});
|
|
365
362
|
} catch (error) {
|
|
366
363
|
this.logger.warn("ChatQueueWorker assistant step dispatch failed", {
|
|
367
|
-
|
|
364
|
+
session_id: observation.session_id,
|
|
368
365
|
error: String(error),
|
|
369
366
|
});
|
|
370
367
|
}
|
|
@@ -384,9 +381,9 @@ export class ChatQueueWorker {
|
|
|
384
381
|
return;
|
|
385
382
|
}
|
|
386
383
|
const observation: TurnObservation = {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
384
|
+
turn_id: turn.id,
|
|
385
|
+
session_id: item.session_id,
|
|
386
|
+
message_id: item.message_id,
|
|
390
387
|
typing: this.startTypingHeartbeat(item),
|
|
391
388
|
};
|
|
392
389
|
params.lane.turnObservers.set(turn.id, observation);
|
|
@@ -412,15 +409,15 @@ export class ChatQueueWorker {
|
|
|
412
409
|
} catch (error) {
|
|
413
410
|
const channelErrorText = buildChannelErrorText(error);
|
|
414
411
|
this.logger.error("ChatQueueWorker prompt submit failed", {
|
|
415
|
-
|
|
412
|
+
session_id: item.session_id,
|
|
416
413
|
error: String(error),
|
|
417
414
|
});
|
|
418
415
|
await dispatchTextToChannel({
|
|
419
416
|
logger: this.logger,
|
|
420
417
|
context: this.context,
|
|
421
|
-
|
|
418
|
+
session_id: item.session_id,
|
|
422
419
|
text: channelErrorText,
|
|
423
|
-
|
|
420
|
+
message_id: item.message_id,
|
|
424
421
|
phase: "error",
|
|
425
422
|
});
|
|
426
423
|
}
|
|
@@ -430,29 +427,26 @@ export class ChatQueueWorker {
|
|
|
430
427
|
observation: TurnObservation,
|
|
431
428
|
result: AgentSessionTurnResult,
|
|
432
429
|
): Promise<void> {
|
|
433
|
-
|
|
434
|
-
result.assistantMessage?.metadata?.extra?.stopReason || "",
|
|
435
|
-
).trim();
|
|
436
|
-
if (stopReason === "cancelled") {
|
|
430
|
+
if (String(result.error || "").trim().toLowerCase() === "cancelled") {
|
|
437
431
|
return;
|
|
438
432
|
}
|
|
439
433
|
|
|
440
434
|
if (!result.success) {
|
|
441
435
|
const resultErrorText =
|
|
442
|
-
|
|
436
|
+
result.text ||
|
|
443
437
|
result.error ||
|
|
444
438
|
"Execution failed";
|
|
445
439
|
const channelErrorText = buildChannelErrorText(resultErrorText);
|
|
446
440
|
this.logger.error("ChatQueueWorker turn finished with failure", {
|
|
447
|
-
|
|
441
|
+
session_id: observation.session_id,
|
|
448
442
|
error: result.error || resultErrorText,
|
|
449
443
|
});
|
|
450
444
|
await dispatchTextToChannel({
|
|
451
445
|
logger: this.logger,
|
|
452
446
|
context: this.context,
|
|
453
|
-
|
|
447
|
+
session_id: observation.session_id,
|
|
454
448
|
text: channelErrorText,
|
|
455
|
-
|
|
449
|
+
message_id: observation.message_id,
|
|
456
450
|
phase: "error",
|
|
457
451
|
});
|
|
458
452
|
return;
|
|
@@ -465,7 +459,7 @@ export class ChatQueueWorker {
|
|
|
465
459
|
* 关键点(中文)
|
|
466
460
|
* - 在使用点显式校验,避免隐藏依赖来源。
|
|
467
461
|
*/
|
|
468
|
-
private requireContext(
|
|
469
|
-
return this.context.sessions.runtime(
|
|
462
|
+
private requireContext(session_id: string) {
|
|
463
|
+
return this.context.sessions.runtime(session_id);
|
|
470
464
|
}
|
|
471
465
|
}
|
|
@@ -21,31 +21,31 @@ const BURST_MERGE_POLL_INTERVAL_MS = 20;
|
|
|
21
21
|
export function normalizeChatQueueWorkerConfig(
|
|
22
22
|
input?: Partial<ChatQueueWorkerConfig>,
|
|
23
23
|
): ChatQueueWorkerConfig {
|
|
24
|
-
const
|
|
25
|
-
typeof input?.
|
|
26
|
-
? Math.max(1, Math.min(32, Math.floor(input.
|
|
24
|
+
const max_concurrency =
|
|
25
|
+
typeof input?.max_concurrency === "number" && Number.isFinite(input.max_concurrency)
|
|
26
|
+
? Math.max(1, Math.min(32, Math.floor(input.max_concurrency)))
|
|
27
27
|
: 2;
|
|
28
28
|
|
|
29
|
-
const
|
|
30
|
-
typeof input?.
|
|
31
|
-
Number.isFinite(input.
|
|
32
|
-
? Math.max(0, Math.min(60_000, Math.floor(input.
|
|
29
|
+
const merge_debounce_ms =
|
|
30
|
+
typeof input?.merge_debounce_ms === "number" &&
|
|
31
|
+
Number.isFinite(input.merge_debounce_ms)
|
|
32
|
+
? Math.max(0, Math.min(60_000, Math.floor(input.merge_debounce_ms)))
|
|
33
33
|
: DEFAULT_MERGE_DEBOUNCE_MS;
|
|
34
34
|
|
|
35
|
-
const
|
|
36
|
-
typeof input?.
|
|
37
|
-
Number.isFinite(input.
|
|
38
|
-
? Math.max(0, Math.min(120_000, Math.floor(input.
|
|
35
|
+
const merge_max_wait_ms =
|
|
36
|
+
typeof input?.merge_max_wait_ms === "number" &&
|
|
37
|
+
Number.isFinite(input.merge_max_wait_ms)
|
|
38
|
+
? Math.max(0, Math.min(120_000, Math.floor(input.merge_max_wait_ms)))
|
|
39
39
|
: DEFAULT_MERGE_MAX_WAIT_MS;
|
|
40
40
|
|
|
41
|
-
return {
|
|
41
|
+
return { max_concurrency, merge_debounce_ms, merge_max_wait_ms };
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* 判断是否启用“启动前消息合并”。
|
|
46
46
|
*/
|
|
47
47
|
export function isBurstMergeEnabled(config: ChatQueueWorkerConfig): boolean {
|
|
48
|
-
return config.
|
|
48
|
+
return config.merge_debounce_ms > 0 && config.merge_max_wait_ms > 0;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
/**
|
|
@@ -91,7 +91,7 @@ export function buildChannelErrorText(error: unknown): string {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
/**
|
|
94
|
-
* 等待一小段时间,让同 lane
|
|
94
|
+
* 等待一小段时间,让同 lane 的连续消息尽量在一次队列处理前合并。
|
|
95
95
|
*/
|
|
96
96
|
export async function collectInitialBurstItems(params: {
|
|
97
97
|
laneKey: string;
|
|
@@ -110,11 +110,11 @@ export async function collectInitialBurstItems(params: {
|
|
|
110
110
|
const now = Date.now();
|
|
111
111
|
const idleMs = now - lastInboundAt;
|
|
112
112
|
const elapsedMs = now - startedAt;
|
|
113
|
-
if (idleMs >= params.config.
|
|
114
|
-
if (elapsedMs >= params.config.
|
|
113
|
+
if (idleMs >= params.config.merge_debounce_ms) break;
|
|
114
|
+
if (elapsedMs >= params.config.merge_max_wait_ms) break;
|
|
115
115
|
|
|
116
|
-
const remainingDebounceMs = params.config.
|
|
117
|
-
const remainingMaxWaitMs = params.config.
|
|
116
|
+
const remainingDebounceMs = params.config.merge_debounce_ms - idleMs;
|
|
117
|
+
const remainingMaxWaitMs = params.config.merge_max_wait_ms - elapsedMs;
|
|
118
118
|
const sleepMs = Math.max(
|
|
119
119
|
1,
|
|
120
120
|
Math.min(
|
|
@@ -12,8 +12,8 @@ import type { JsonObject, JsonValue } from "@downcity/agent";
|
|
|
12
12
|
import type { PluginActionCommandInput } from "@downcity/agent";
|
|
13
13
|
import type { ChatSendActionPayload } from "@/chat/types/ChatPluginActionPayload.js";
|
|
14
14
|
import {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
build_chat_message_text,
|
|
16
|
+
parse_chat_message_markup,
|
|
17
17
|
} from "@downcity/agent";
|
|
18
18
|
import { parseChatSendOptionsFromMetadata } from "@/chat/runtime/ChatSendMetadata.js";
|
|
19
19
|
import {
|
|
@@ -101,43 +101,43 @@ function parseChatSendTextProtocol(params: {
|
|
|
101
101
|
explicitReplyToMessage?: boolean;
|
|
102
102
|
explicitMessageId?: string;
|
|
103
103
|
}): ChatSendActionPayload {
|
|
104
|
-
const parsed =
|
|
104
|
+
const parsed = parse_chat_message_markup(normalizeChatSendText(params.rawText));
|
|
105
105
|
const metadataOptions = parseChatSendOptionsFromMetadata({
|
|
106
106
|
metadata: parsed.metadata,
|
|
107
107
|
strict: true,
|
|
108
108
|
});
|
|
109
109
|
|
|
110
|
-
const
|
|
110
|
+
const delay_ms =
|
|
111
111
|
typeof params.explicitDelayMs === "number"
|
|
112
112
|
? params.explicitDelayMs
|
|
113
|
-
: metadataOptions.
|
|
114
|
-
const
|
|
113
|
+
: metadataOptions.delay_ms;
|
|
114
|
+
const send_at_ms =
|
|
115
115
|
typeof params.explicitSendAtMs === "number"
|
|
116
116
|
? params.explicitSendAtMs
|
|
117
|
-
: metadataOptions.
|
|
118
|
-
if (typeof
|
|
117
|
+
: metadataOptions.send_at_ms;
|
|
118
|
+
if (typeof delay_ms === "number" && typeof send_at_ms === "number") {
|
|
119
119
|
throw new Error("`delay` and `time` cannot be used together.");
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
const
|
|
123
|
-
|
|
122
|
+
const chat_key = resolveChatKey({
|
|
123
|
+
chat_key: params.explicitChatKey || metadataOptions.chat_key,
|
|
124
124
|
});
|
|
125
|
-
const
|
|
126
|
-
params.explicitMessageId || metadataOptions.
|
|
125
|
+
const message_id = String(
|
|
126
|
+
params.explicitMessageId || metadataOptions.message_id || "",
|
|
127
127
|
).trim();
|
|
128
|
-
const
|
|
128
|
+
const reply_to_message =
|
|
129
129
|
params.explicitReplyToMessage === true ||
|
|
130
|
-
metadataOptions.
|
|
130
|
+
metadataOptions.reply_to_message === true;
|
|
131
131
|
|
|
132
132
|
return {
|
|
133
|
-
text:
|
|
133
|
+
text: build_chat_message_text({
|
|
134
134
|
segments: parsed.segments,
|
|
135
135
|
}),
|
|
136
|
-
...(
|
|
137
|
-
...(typeof
|
|
138
|
-
...(typeof
|
|
139
|
-
...(
|
|
140
|
-
...(
|
|
136
|
+
...(chat_key ? { chat_key } : {}),
|
|
137
|
+
...(typeof delay_ms === "number" ? { delay_ms } : {}),
|
|
138
|
+
...(typeof send_at_ms === "number" ? { send_at_ms } : {}),
|
|
139
|
+
...(reply_to_message ? { reply_to_message: true } : {}),
|
|
140
|
+
...(message_id ? { message_id } : {}),
|
|
141
141
|
};
|
|
142
142
|
}
|
|
143
143
|
|
|
@@ -177,39 +177,39 @@ export async function mapChatSendCommandInput(
|
|
|
177
177
|
|
|
178
178
|
const delayRaw = getStringOpt(input.opts, "delay");
|
|
179
179
|
const timeRaw = getStringOpt(input.opts, "time");
|
|
180
|
-
const
|
|
181
|
-
const
|
|
182
|
-
const
|
|
180
|
+
const reply_to_message = getBooleanOpt(input.opts, "reply");
|
|
181
|
+
const message_id = getStringOpt(input.opts, "message_id");
|
|
182
|
+
const delay_ms = delayRaw
|
|
183
183
|
? parseNonNegativeIntOptionOrThrow(delayRaw, "delay")
|
|
184
184
|
: undefined;
|
|
185
|
-
const
|
|
186
|
-
if (typeof
|
|
185
|
+
const send_at_ms = timeRaw ? parseSendTimeOptionOrThrow(timeRaw, "time") : undefined;
|
|
186
|
+
if (typeof delay_ms === "number" && typeof send_at_ms === "number") {
|
|
187
187
|
throw new Error("`--delay` and `--time` cannot be used together.");
|
|
188
188
|
}
|
|
189
189
|
const payload = parseChatSendTextProtocol({
|
|
190
190
|
rawText: text,
|
|
191
|
-
explicitChatKey: getStringOpt(input.opts, "
|
|
192
|
-
...(typeof
|
|
193
|
-
...(typeof
|
|
194
|
-
...(
|
|
195
|
-
...(
|
|
191
|
+
explicitChatKey: getStringOpt(input.opts, "chat_key"),
|
|
192
|
+
...(typeof delay_ms === "number" ? { explicitDelayMs: delay_ms } : {}),
|
|
193
|
+
...(typeof send_at_ms === "number" ? { explicitSendAtMs: send_at_ms } : {}),
|
|
194
|
+
...(reply_to_message ? { explicitReplyToMessage: true } : {}),
|
|
195
|
+
...(message_id ? { explicitMessageId: message_id } : {}),
|
|
196
196
|
});
|
|
197
|
-
const
|
|
198
|
-
|
|
197
|
+
const chat_key = resolveChatKey({
|
|
198
|
+
chat_key: payload.chat_key,
|
|
199
199
|
});
|
|
200
|
-
if (!
|
|
200
|
+
if (!chat_key) {
|
|
201
201
|
throw new Error(
|
|
202
|
-
"Missing
|
|
202
|
+
"Missing chat_key. Provide --chat-key or ensure DC_CTX_CHAT_KEY is injected in current shell context.",
|
|
203
203
|
);
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
return {
|
|
207
207
|
text: payload.text,
|
|
208
|
-
|
|
209
|
-
...(typeof payload.
|
|
210
|
-
...(typeof payload.
|
|
211
|
-
...(payload.
|
|
212
|
-
...(payload.
|
|
208
|
+
chat_key,
|
|
209
|
+
...(typeof payload.delay_ms === "number" ? { delay_ms: payload.delay_ms } : {}),
|
|
210
|
+
...(typeof payload.send_at_ms === "number" ? { send_at_ms: payload.send_at_ms } : {}),
|
|
211
|
+
...(payload.reply_to_message === true ? { reply_to_message: true } : {}),
|
|
212
|
+
...(payload.message_id ? { message_id: payload.message_id } : {}),
|
|
213
213
|
};
|
|
214
214
|
}
|
|
215
215
|
|
|
@@ -221,9 +221,9 @@ export function mapChatSendApiInput(body: JsonValue): ChatSendActionPayload {
|
|
|
221
221
|
throw new Error("Invalid JSON body");
|
|
222
222
|
}
|
|
223
223
|
const payload = body as JsonObject;
|
|
224
|
-
const delayRaw = payload.
|
|
225
|
-
const timeRaw = payload.
|
|
226
|
-
const replyRaw = payload.
|
|
224
|
+
const delayRaw = payload.delay_ms ?? payload.delay;
|
|
225
|
+
const timeRaw = payload.send_at_ms ?? payload.sendAt ?? payload.time;
|
|
226
|
+
const replyRaw = payload.reply_to_message ?? payload.reply;
|
|
227
227
|
const delayText =
|
|
228
228
|
typeof delayRaw === "string" || typeof delayRaw === "number"
|
|
229
229
|
? String(delayRaw).trim()
|
|
@@ -232,24 +232,24 @@ export function mapChatSendApiInput(body: JsonValue): ChatSendActionPayload {
|
|
|
232
232
|
typeof timeRaw === "string" || typeof timeRaw === "number"
|
|
233
233
|
? String(timeRaw).trim()
|
|
234
234
|
: "";
|
|
235
|
-
const
|
|
236
|
-
? parseNonNegativeIntOptionOrThrow(delayText, "
|
|
235
|
+
const delay_ms = delayText
|
|
236
|
+
? parseNonNegativeIntOptionOrThrow(delayText, "delay_ms")
|
|
237
237
|
: undefined;
|
|
238
|
-
const
|
|
239
|
-
? parseSendTimeOptionOrThrow(timeText, "
|
|
238
|
+
const send_at_ms = timeText
|
|
239
|
+
? parseSendTimeOptionOrThrow(timeText, "send_at_ms")
|
|
240
240
|
: undefined;
|
|
241
|
-
if (typeof
|
|
242
|
-
throw new Error("`
|
|
241
|
+
if (typeof delay_ms === "number" && typeof send_at_ms === "number") {
|
|
242
|
+
throw new Error("`delay_ms` and `send_at_ms` cannot be used together.");
|
|
243
243
|
}
|
|
244
244
|
return parseChatSendTextProtocol({
|
|
245
245
|
rawText: String(payload.text ?? ""),
|
|
246
246
|
explicitChatKey:
|
|
247
|
-
typeof payload.
|
|
248
|
-
...(typeof
|
|
249
|
-
...(typeof
|
|
247
|
+
typeof payload.chat_key === "string" ? payload.chat_key.trim() : undefined,
|
|
248
|
+
...(typeof delay_ms === "number" ? { explicitDelayMs: delay_ms } : {}),
|
|
249
|
+
...(typeof send_at_ms === "number" ? { explicitSendAtMs: send_at_ms } : {}),
|
|
250
250
|
...(replyRaw === true ? { explicitReplyToMessage: true } : {}),
|
|
251
|
-
...(typeof payload.
|
|
252
|
-
? { explicitMessageId: String(payload.
|
|
251
|
+
...(typeof payload.message_id === "string" || typeof payload.message_id === "number"
|
|
252
|
+
? { explicitMessageId: String(payload.message_id).trim() }
|
|
253
253
|
: {}),
|
|
254
254
|
});
|
|
255
255
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Chat send frontmatter metadata 解析工具。
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
|
-
* - frontmatter 中的字段语义与
|
|
5
|
+
* - frontmatter 中的字段语义与 Chat send action 输入保持一致。
|
|
6
6
|
* - direct 模式也复用同一解析逻辑,避免 metadata 协议分叉。
|
|
7
7
|
*/
|
|
8
8
|
|
|
@@ -133,38 +133,38 @@ export function parseChatSendOptionsFromMetadata(params: {
|
|
|
133
133
|
: {};
|
|
134
134
|
const strict = params.strict === true;
|
|
135
135
|
|
|
136
|
-
const
|
|
137
|
-
pickMetadataValue(metadata, ["
|
|
136
|
+
const chat_key = normalizeText(
|
|
137
|
+
pickMetadataValue(metadata, ["chat_key", "chat-key"]),
|
|
138
138
|
);
|
|
139
|
-
const
|
|
140
|
-
pickMetadataValue(metadata, ["
|
|
139
|
+
const delay_ms = parseNonNegativeInt(
|
|
140
|
+
pickMetadataValue(metadata, ["delay_ms", "delay-ms", "delay"]),
|
|
141
141
|
"delay",
|
|
142
142
|
strict,
|
|
143
143
|
);
|
|
144
|
-
const
|
|
145
|
-
pickMetadataValue(metadata, ["
|
|
144
|
+
const send_at_ms = parseSendAtMs(
|
|
145
|
+
pickMetadataValue(metadata, ["send_at_ms", "send-at-ms", "sendAt", "send-at", "time"]),
|
|
146
146
|
"time",
|
|
147
147
|
strict,
|
|
148
148
|
);
|
|
149
|
-
if (typeof
|
|
149
|
+
if (typeof delay_ms === "number" && typeof send_at_ms === "number") {
|
|
150
150
|
throw new Error("`delay` and `time` cannot be used together.");
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
const explicitMessageId = parseOptionalMessageId(
|
|
154
|
-
pickMetadataValue(metadata, ["
|
|
154
|
+
pickMetadataValue(metadata, ["message_id", "message-id"]),
|
|
155
155
|
);
|
|
156
156
|
const replyRaw = pickMetadataValue(metadata, ["reply"]);
|
|
157
157
|
const replyAsBoolean = parseBoolean(replyRaw);
|
|
158
158
|
const replyAsMessageId =
|
|
159
159
|
explicitMessageId || (replyAsBoolean === undefined ? parseOptionalMessageId(replyRaw) : undefined);
|
|
160
|
-
const
|
|
160
|
+
const reply_to_message =
|
|
161
161
|
replyAsBoolean === true || typeof replyAsMessageId === "string";
|
|
162
162
|
|
|
163
163
|
return {
|
|
164
|
-
...(
|
|
165
|
-
...(typeof
|
|
166
|
-
...(typeof
|
|
167
|
-
...(
|
|
168
|
-
...(typeof replyAsMessageId === "string" ? {
|
|
164
|
+
...(chat_key ? { chat_key } : {}),
|
|
165
|
+
...(typeof delay_ms === "number" ? { delay_ms } : {}),
|
|
166
|
+
...(typeof send_at_ms === "number" ? { send_at_ms } : {}),
|
|
167
|
+
...(reply_to_message ? { reply_to_message: true } : {}),
|
|
168
|
+
...(typeof replyAsMessageId === "string" ? { message_id: replyAsMessageId } : {}),
|
|
169
169
|
};
|
|
170
170
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* ChatSessionDelete:按
|
|
2
|
+
* ChatSessionDelete:按 session_id 彻底删除 chat 会话数据。
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
5
|
* - 删除路由映射(`.downcity/channel/meta.json`)
|
|
6
|
-
* - 删除 chat 审计目录(`.downcity/chat/<
|
|
7
|
-
* - 删除 core session 目录(`.downcity/agents/<
|
|
6
|
+
* - 删除 chat 审计目录(`.downcity/chat/<session_id>/`)
|
|
7
|
+
* - 删除 core session 目录(`.downcity/agents/<agent_id>/sessions/<session_id>/`)
|
|
8
8
|
* - 清理运行中 agent 与队列,避免残留任务继续执行
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type {
|
|
11
|
+
import type { PluginContext } from "@downcity/agent";
|
|
12
12
|
import { resolveChatQueueStore } from "@/chat/runtime/ChatQueue.js";
|
|
13
13
|
import { clean_chat_storage } from "@/chat/runtime/ChatStorage.js";
|
|
14
14
|
|
|
15
|
-
function normalizeSessionId(
|
|
16
|
-
return String(
|
|
15
|
+
function normalizeSessionId(session_id: string): string {
|
|
16
|
+
return String(session_id || "").trim();
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -23,39 +23,39 @@ function normalizeSessionId(sessionId: string): string {
|
|
|
23
23
|
* - 幂等:目标不存在时返回 success + deleted=false,避免上层重试复杂化。
|
|
24
24
|
*/
|
|
25
25
|
export async function deleteChatSessionById(params: {
|
|
26
|
-
context:
|
|
27
|
-
|
|
26
|
+
context: PluginContext;
|
|
27
|
+
session_id: string;
|
|
28
28
|
}): Promise<{
|
|
29
29
|
success: boolean;
|
|
30
|
-
|
|
30
|
+
session_id: string;
|
|
31
31
|
deleted: boolean;
|
|
32
32
|
removedMeta: boolean;
|
|
33
33
|
removedChatDir: boolean;
|
|
34
34
|
removedSessionDir: boolean;
|
|
35
35
|
error?: string;
|
|
36
36
|
}> {
|
|
37
|
-
const
|
|
38
|
-
if (!
|
|
37
|
+
const session_id = normalizeSessionId(params.session_id);
|
|
38
|
+
if (!session_id) {
|
|
39
39
|
return {
|
|
40
40
|
success: false,
|
|
41
|
-
|
|
41
|
+
session_id: "",
|
|
42
42
|
deleted: false,
|
|
43
43
|
removedMeta: false,
|
|
44
44
|
removedChatDir: false,
|
|
45
45
|
removedSessionDir: false,
|
|
46
|
-
error: "Missing
|
|
46
|
+
error: "Missing session_id",
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
try {
|
|
51
51
|
// 关键点(中文):先停执行,再删文件,避免删除过程中仍有任务写入。
|
|
52
|
-
resolveChatQueueStore(params.context).clear(
|
|
52
|
+
resolveChatQueueStore(params.context).clear(session_id);
|
|
53
53
|
|
|
54
54
|
const chat_result = await clean_chat_storage({
|
|
55
|
-
root_path: params.context.
|
|
56
|
-
session_id:
|
|
55
|
+
root_path: params.context.workspace_path,
|
|
56
|
+
session_id: session_id,
|
|
57
57
|
});
|
|
58
|
-
const removed_session_dir = await params.context.sessions.remove(
|
|
58
|
+
const removed_session_dir = await params.context.sessions.remove(session_id);
|
|
59
59
|
|
|
60
60
|
const deleted =
|
|
61
61
|
chat_result.removed_route ||
|
|
@@ -64,7 +64,7 @@ export async function deleteChatSessionById(params: {
|
|
|
64
64
|
|
|
65
65
|
return {
|
|
66
66
|
success: true,
|
|
67
|
-
|
|
67
|
+
session_id,
|
|
68
68
|
deleted,
|
|
69
69
|
removedMeta: chat_result.removed_route,
|
|
70
70
|
removedChatDir: chat_result.removed_chat_dir,
|
|
@@ -73,7 +73,7 @@ export async function deleteChatSessionById(params: {
|
|
|
73
73
|
} catch (error) {
|
|
74
74
|
return {
|
|
75
75
|
success: false,
|
|
76
|
-
|
|
76
|
+
session_id,
|
|
77
77
|
deleted: false,
|
|
78
78
|
removedMeta: false,
|
|
79
79
|
removedChatDir: false,
|