@downcity/plugins 1.0.215 → 1.0.233
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/chat/Action.d.ts +51 -51
- package/bin/chat/Action.d.ts.map +1 -1
- package/bin/chat/Action.js +109 -108
- package/bin/chat/Action.js.map +1 -1
- package/bin/chat/ChatPlugin.d.ts +7 -7
- package/bin/chat/ChatPlugin.d.ts.map +1 -1
- package/bin/chat/ChatPlugin.js +4 -4
- package/bin/chat/ChatPlugin.js.map +1 -1
- package/bin/chat/Index.d.ts +3 -0
- package/bin/chat/Index.d.ts.map +1 -1
- package/bin/chat/Index.js +1 -0
- package/bin/chat/Index.js.map +1 -1
- package/bin/chat/PROMPT.direct.d.ts +1 -1
- package/bin/chat/PROMPT.direct.d.ts.map +1 -1
- package/bin/chat/PROMPT.direct.js +1 -1
- package/bin/chat/PROMPT.direct.js.map +1 -1
- package/bin/chat/access/ChatAccessActions.js +6 -6
- package/bin/chat/access/ChatAccessActions.js.map +1 -1
- package/bin/chat/access/ChatAccessRuntime.d.ts +4 -4
- package/bin/chat/access/ChatAccessRuntime.d.ts.map +1 -1
- package/bin/chat/access/ChatAccessRuntime.js +1 -1
- package/bin/chat/access/ChatAccessRuntime.js.map +1 -1
- package/bin/chat/access/ChatAccessStore.js +5 -5
- package/bin/chat/access/ChatAccessStore.js.map +1 -1
- package/bin/chat/channels/BaseChatChannel.d.ts +17 -17
- package/bin/chat/channels/BaseChatChannel.d.ts.map +1 -1
- package/bin/chat/channels/BaseChatChannel.js +19 -19
- package/bin/chat/channels/BaseChatChannel.js.map +1 -1
- package/bin/chat/channels/BaseChatChannelQueue.d.ts +6 -6
- package/bin/chat/channels/BaseChatChannelQueue.d.ts.map +1 -1
- package/bin/chat/channels/BaseChatChannelQueue.js +32 -32
- package/bin/chat/channels/BaseChatChannelQueue.js.map +1 -1
- package/bin/chat/channels/BaseChatChannelSupport.d.ts +14 -14
- package/bin/chat/channels/BaseChatChannelSupport.d.ts.map +1 -1
- package/bin/chat/channels/BaseChatChannelSupport.js +13 -13
- package/bin/chat/channels/BaseChatChannelSupport.js.map +1 -1
- package/bin/chat/channels/RuntimeChannel.d.ts +23 -28
- package/bin/chat/channels/RuntimeChannel.d.ts.map +1 -1
- package/bin/chat/channels/RuntimeChannel.js +39 -57
- package/bin/chat/channels/RuntimeChannel.js.map +1 -1
- package/bin/chat/channels/feishu/Feishu.d.ts +7 -7
- package/bin/chat/channels/feishu/Feishu.d.ts.map +1 -1
- package/bin/chat/channels/feishu/Feishu.js +31 -31
- package/bin/chat/channels/feishu/Feishu.js.map +1 -1
- package/bin/chat/channels/feishu/FeishuInbound.js +3 -3
- package/bin/chat/channels/feishu/FeishuInbound.js.map +1 -1
- package/bin/chat/channels/feishu/FeishuMessageHandler.d.ts +10 -10
- package/bin/chat/channels/feishu/FeishuMessageHandler.d.ts.map +1 -1
- package/bin/chat/channels/feishu/FeishuMessageHandler.js +17 -17
- package/bin/chat/channels/feishu/FeishuMessageHandler.js.map +1 -1
- package/bin/chat/channels/feishu/FeishuPlatformClient.d.ts +6 -6
- package/bin/chat/channels/feishu/FeishuPlatformClient.d.ts.map +1 -1
- package/bin/chat/channels/feishu/FeishuPlatformClient.js +9 -9
- package/bin/chat/channels/feishu/FeishuPlatformClient.js.map +1 -1
- package/bin/chat/channels/feishu/FeishuPlatformLookup.d.ts +1 -1
- package/bin/chat/channels/feishu/FeishuPlatformLookup.d.ts.map +1 -1
- package/bin/chat/channels/feishu/FeishuPlatformLookup.js +6 -6
- package/bin/chat/channels/feishu/FeishuPlatformLookup.js.map +1 -1
- package/bin/chat/channels/feishu/FeishuPlatformMessaging.d.ts +2 -2
- package/bin/chat/channels/feishu/FeishuPlatformMessaging.d.ts.map +1 -1
- package/bin/chat/channels/feishu/FeishuPlatformMessaging.js +7 -7
- package/bin/chat/channels/feishu/FeishuPlatformMessaging.js.map +1 -1
- package/bin/chat/channels/feishu/InboundAttachment.d.ts +1 -1
- package/bin/chat/channels/feishu/InboundAttachment.d.ts.map +1 -1
- package/bin/chat/channels/feishu/InboundAttachment.js +5 -5
- package/bin/chat/channels/feishu/InboundAttachment.js.map +1 -1
- package/bin/chat/channels/feishu/PostMessage.js +8 -8
- package/bin/chat/channels/feishu/PostMessage.js.map +1 -1
- package/bin/chat/channels/feishu/ReplyContext.d.ts +1 -1
- package/bin/chat/channels/feishu/ReplyContext.d.ts.map +1 -1
- package/bin/chat/channels/feishu/ReplyContext.js +2 -2
- package/bin/chat/channels/feishu/ReplyContext.js.map +1 -1
- package/bin/chat/channels/feishu/Shared.js +3 -3
- package/bin/chat/channels/feishu/Shared.js.map +1 -1
- package/bin/chat/channels/qq/PROMPT.direct.d.ts +1 -1
- package/bin/chat/channels/qq/PROMPT.direct.d.ts.map +1 -1
- package/bin/chat/channels/qq/PROMPT.direct.js +1 -1
- package/bin/chat/channels/qq/PROMPT.direct.js.map +1 -1
- package/bin/chat/channels/qq/QQ.d.ts +3 -3
- package/bin/chat/channels/qq/QQ.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQ.js +20 -20
- package/bin/chat/channels/qq/QQ.js.map +1 -1
- package/bin/chat/channels/qq/QQEventCapture.d.ts +1 -1
- package/bin/chat/channels/qq/QQEventCapture.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQEventCapture.js +3 -3
- package/bin/chat/channels/qq/QQEventCapture.js.map +1 -1
- package/bin/chat/channels/qq/QQGatewayAuth.d.ts +1 -1
- package/bin/chat/channels/qq/QQGatewayAuth.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQGatewayClient.d.ts +2 -2
- package/bin/chat/channels/qq/QQGatewayClient.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQGatewayClient.js +11 -11
- package/bin/chat/channels/qq/QQGatewayClient.js.map +1 -1
- package/bin/chat/channels/qq/QQGatewayConnection.d.ts +1 -1
- package/bin/chat/channels/qq/QQGatewayConnection.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQGatewaySend.d.ts +2 -2
- package/bin/chat/channels/qq/QQGatewaySend.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQGatewaySend.js +3 -3
- package/bin/chat/channels/qq/QQGatewaySend.js.map +1 -1
- package/bin/chat/channels/qq/QQInbound.js +5 -5
- package/bin/chat/channels/qq/QQInbound.js.map +1 -1
- package/bin/chat/channels/qq/QQInboundDedupe.d.ts +2 -2
- package/bin/chat/channels/qq/QQInboundDedupe.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQInboundDedupe.js +5 -5
- package/bin/chat/channels/qq/QQInboundDedupe.js.map +1 -1
- package/bin/chat/channels/qq/QQMessageHandler.d.ts +9 -9
- package/bin/chat/channels/qq/QQMessageHandler.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQMessageHandler.js +34 -34
- package/bin/chat/channels/qq/QQMessageHandler.js.map +1 -1
- package/bin/chat/channels/qq/QQSendSupport.js +2 -2
- package/bin/chat/channels/qq/QQSendSupport.js.map +1 -1
- package/bin/chat/channels/qq/QQSupport.d.ts +5 -5
- package/bin/chat/channels/qq/QQSupport.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQSupport.js +5 -5
- package/bin/chat/channels/qq/QQSupport.js.map +1 -1
- package/bin/chat/channels/qq/types/QqChannel.d.ts +1 -1
- package/bin/chat/channels/qq/types/QqChannel.d.ts.map +1 -1
- package/bin/chat/channels/telegram/ApiClient.d.ts +2 -2
- package/bin/chat/channels/telegram/ApiClient.d.ts.map +1 -1
- package/bin/chat/channels/telegram/ApiClient.js +6 -6
- package/bin/chat/channels/telegram/ApiClient.js.map +1 -1
- package/bin/chat/channels/telegram/Bot.d.ts +4 -4
- package/bin/chat/channels/telegram/Bot.d.ts.map +1 -1
- package/bin/chat/channels/telegram/Bot.js +14 -14
- package/bin/chat/channels/telegram/Bot.js.map +1 -1
- package/bin/chat/channels/telegram/BotInfo.js +1 -1
- package/bin/chat/channels/telegram/BotInfo.js.map +1 -1
- package/bin/chat/channels/telegram/ReplyContext.js +3 -3
- package/bin/chat/channels/telegram/ReplyContext.js.map +1 -1
- package/bin/chat/channels/telegram/Shared.js +3 -3
- package/bin/chat/channels/telegram/Shared.js.map +1 -1
- package/bin/chat/channels/telegram/StateStore.d.ts +1 -1
- package/bin/chat/channels/telegram/StateStore.d.ts.map +1 -1
- package/bin/chat/channels/telegram/StateStore.js +2 -2
- package/bin/chat/channels/telegram/StateStore.js.map +1 -1
- package/bin/chat/channels/telegram/TelegramInbound.d.ts +3 -3
- package/bin/chat/channels/telegram/TelegramInbound.d.ts.map +1 -1
- package/bin/chat/channels/telegram/TelegramInbound.js +4 -4
- package/bin/chat/channels/telegram/TelegramInbound.js.map +1 -1
- package/bin/chat/channels/telegram/TelegramMessageHandler.d.ts +8 -8
- package/bin/chat/channels/telegram/TelegramMessageHandler.d.ts.map +1 -1
- package/bin/chat/channels/telegram/TelegramMessageHandler.js +25 -25
- package/bin/chat/channels/telegram/TelegramMessageHandler.js.map +1 -1
- package/bin/chat/channels/telegram/TelegramPendingUpdates.d.ts +2 -2
- package/bin/chat/channels/telegram/TelegramPendingUpdates.d.ts.map +1 -1
- package/bin/chat/channels/telegram/TelegramPendingUpdates.js +7 -7
- package/bin/chat/channels/telegram/TelegramPendingUpdates.js.map +1 -1
- package/bin/chat/channels/telegram/TelegramPlatformClient.d.ts +4 -4
- package/bin/chat/channels/telegram/TelegramPlatformClient.d.ts.map +1 -1
- package/bin/chat/channels/telegram/TelegramPlatformClient.js +7 -7
- package/bin/chat/channels/telegram/TelegramPlatformClient.js.map +1 -1
- package/bin/chat/config/ChatPluginConfig.d.ts +67 -0
- package/bin/chat/config/ChatPluginConfig.d.ts.map +1 -0
- package/bin/chat/config/ChatPluginConfig.js +237 -0
- package/bin/chat/config/ChatPluginConfig.js.map +1 -0
- package/bin/chat/runtime/ChannelContextStore.d.ts +21 -21
- package/bin/chat/runtime/ChannelContextStore.d.ts.map +1 -1
- package/bin/chat/runtime/ChannelContextStore.js +74 -74
- package/bin/chat/runtime/ChannelContextStore.js.map +1 -1
- package/bin/chat/runtime/ChatActionExecution.d.ts +23 -23
- package/bin/chat/runtime/ChatActionExecution.d.ts.map +1 -1
- package/bin/chat/runtime/ChatActionExecution.js +70 -70
- package/bin/chat/runtime/ChatActionExecution.js.map +1 -1
- package/bin/chat/runtime/ChatActionInput.js +19 -19
- package/bin/chat/runtime/ChatActionInput.js.map +1 -1
- package/bin/chat/runtime/ChatChannelActions.d.ts +4 -4
- package/bin/chat/runtime/ChatChannelActions.d.ts.map +1 -1
- package/bin/chat/runtime/ChatChannelConfig.d.ts +4 -4
- package/bin/chat/runtime/ChatChannelConfig.d.ts.map +1 -1
- package/bin/chat/runtime/ChatChannelConfig.js +9 -9
- package/bin/chat/runtime/ChatChannelConfig.js.map +1 -1
- package/bin/chat/runtime/ChatChannelCore.d.ts +11 -12
- package/bin/chat/runtime/ChatChannelCore.d.ts.map +1 -1
- package/bin/chat/runtime/ChatChannelCore.js +5 -17
- package/bin/chat/runtime/ChatChannelCore.js.map +1 -1
- package/bin/chat/runtime/ChatChannelLifecycle.d.ts +3 -3
- package/bin/chat/runtime/ChatChannelLifecycle.d.ts.map +1 -1
- package/bin/chat/runtime/ChatChannelLifecycle.js +5 -5
- package/bin/chat/runtime/ChatChannelLifecycle.js.map +1 -1
- package/bin/chat/runtime/ChatHistoryStore.d.ts +11 -11
- package/bin/chat/runtime/ChatHistoryStore.d.ts.map +1 -1
- package/bin/chat/runtime/ChatHistoryStore.js +26 -26
- package/bin/chat/runtime/ChatHistoryStore.js.map +1 -1
- package/bin/chat/runtime/ChatIngressStore.d.ts +4 -4
- package/bin/chat/runtime/ChatIngressStore.d.ts.map +1 -1
- package/bin/chat/runtime/ChatIngressStore.js +2 -2
- package/bin/chat/runtime/ChatIngressStore.js.map +1 -1
- package/bin/chat/runtime/ChatMetaStore.d.ts +19 -19
- package/bin/chat/runtime/ChatMetaStore.d.ts.map +1 -1
- package/bin/chat/runtime/ChatMetaStore.js +27 -27
- package/bin/chat/runtime/ChatMetaStore.js.map +1 -1
- package/bin/chat/runtime/ChatPluginActionRegistry.d.ts.map +1 -1
- package/bin/chat/runtime/ChatPluginActionRegistry.js +53 -59
- package/bin/chat/runtime/ChatPluginActionRegistry.js.map +1 -1
- package/bin/chat/runtime/ChatPluginSystem.d.ts +4 -4
- package/bin/chat/runtime/ChatPluginSystem.d.ts.map +1 -1
- package/bin/chat/runtime/ChatPluginSystem.js +5 -5
- package/bin/chat/runtime/ChatPluginSystem.js.map +1 -1
- package/bin/chat/runtime/ChatQueueReplyDispatch.d.ts +6 -6
- package/bin/chat/runtime/ChatQueueReplyDispatch.d.ts.map +1 -1
- package/bin/chat/runtime/ChatQueueReplyDispatch.js +41 -41
- package/bin/chat/runtime/ChatQueueReplyDispatch.js.map +1 -1
- package/bin/chat/runtime/ChatQueueStore.d.ts +3 -3
- package/bin/chat/runtime/ChatQueueStore.d.ts.map +1 -1
- package/bin/chat/runtime/ChatQueueStore.js +2 -2
- package/bin/chat/runtime/ChatQueueStore.js.map +1 -1
- package/bin/chat/runtime/ChatQueueWorker.d.ts +2 -2
- package/bin/chat/runtime/ChatQueueWorker.d.ts.map +1 -1
- package/bin/chat/runtime/ChatQueueWorker.js +30 -32
- package/bin/chat/runtime/ChatQueueWorker.js.map +1 -1
- package/bin/chat/runtime/ChatQueueWorkerSupport.d.ts +1 -1
- package/bin/chat/runtime/ChatQueueWorkerSupport.js +15 -15
- package/bin/chat/runtime/ChatQueueWorkerSupport.js.map +1 -1
- package/bin/chat/runtime/ChatSendActionInput.js +51 -51
- package/bin/chat/runtime/ChatSendActionInput.js.map +1 -1
- package/bin/chat/runtime/ChatSendMetadata.d.ts +1 -1
- package/bin/chat/runtime/ChatSendMetadata.js +12 -12
- package/bin/chat/runtime/ChatSendMetadata.js.map +1 -1
- package/bin/chat/runtime/ChatSendRegistry.d.ts +1 -1
- package/bin/chat/runtime/ChatSessionDelete.d.ts +7 -7
- package/bin/chat/runtime/ChatSessionDelete.d.ts.map +1 -1
- package/bin/chat/runtime/ChatSessionDelete.js +15 -15
- package/bin/chat/runtime/ChatSessionDelete.js.map +1 -1
- package/bin/chat/runtime/ChatStorage.d.ts +1 -1
- package/bin/chat/runtime/ChatStorage.js +3 -3
- package/bin/chat/runtime/ChatStorage.js.map +1 -1
- package/bin/chat/runtime/ChatkeySend.d.ts +21 -21
- package/bin/chat/runtime/ChatkeySend.d.ts.map +1 -1
- package/bin/chat/runtime/ChatkeySend.js +33 -33
- package/bin/chat/runtime/ChatkeySend.js.map +1 -1
- package/bin/chat/runtime/DirectDispatchParser.d.ts +2 -2
- package/bin/chat/runtime/DirectDispatchParser.js +20 -20
- package/bin/chat/runtime/DirectDispatchParser.js.map +1 -1
- package/bin/chat/runtime/EnqueueDispatch.d.ts +3 -3
- package/bin/chat/runtime/EnqueueDispatch.d.ts.map +1 -1
- package/bin/chat/runtime/InboundAugment.d.ts +3 -3
- package/bin/chat/runtime/InboundAugment.d.ts.map +1 -1
- package/bin/chat/runtime/InboundAugment.js +6 -6
- package/bin/chat/runtime/InboundAugment.js.map +1 -1
- package/bin/chat/runtime/QueuedUserMessage.js +5 -5
- package/bin/chat/runtime/QueuedUserMessage.js.map +1 -1
- package/bin/chat/runtime/ReplyContextFormatter.js +7 -7
- package/bin/chat/runtime/ReplyContextFormatter.js.map +1 -1
- package/bin/chat/runtime/ReplyDispatch.d.ts +7 -7
- package/bin/chat/runtime/ReplyDispatch.d.ts.map +1 -1
- package/bin/chat/runtime/ReplyDispatch.js +3 -3
- package/bin/chat/runtime/ReplyDispatch.js.map +1 -1
- package/bin/chat/runtime/SystemPrompt.d.ts +4 -4
- package/bin/chat/runtime/SystemPrompt.d.ts.map +1 -1
- package/bin/chat/runtime/SystemPrompt.js +10 -10
- package/bin/chat/runtime/SystemPrompt.js.map +1 -1
- package/bin/chat/types/ChannelContext.d.ts +11 -11
- package/bin/chat/types/ChannelContext.d.ts.map +1 -1
- package/bin/chat/types/ChannelContext.js +2 -2
- package/bin/chat/types/ChatCommand.d.ts +31 -31
- package/bin/chat/types/ChatCommand.d.ts.map +1 -1
- package/bin/chat/types/ChatDispatcher.d.ts +3 -3
- package/bin/chat/types/ChatDispatcher.d.ts.map +1 -1
- package/bin/chat/types/ChatHistory.d.ts +2 -2
- package/bin/chat/types/ChatHistory.d.ts.map +1 -1
- package/bin/chat/types/ChatMeta.d.ts +4 -4
- package/bin/chat/types/ChatMeta.d.ts.map +1 -1
- package/bin/chat/types/ChatMeta.js +1 -1
- package/bin/chat/types/ChatPlugin.d.ts +9 -9
- package/bin/chat/types/ChatPlugin.d.ts.map +1 -1
- package/bin/chat/types/ChatPluginActionPayload.d.ts +13 -13
- package/bin/chat/types/ChatPluginActionPayload.d.ts.map +1 -1
- package/bin/chat/types/ChatPluginOptions.d.ts +6 -6
- package/bin/chat/types/ChatPluginOptions.d.ts.map +1 -1
- package/bin/chat/types/ChatPluginResource.d.ts +68 -0
- package/bin/chat/types/ChatPluginResource.d.ts.map +1 -0
- package/bin/chat/types/ChatPluginResource.js +10 -0
- package/bin/chat/types/ChatPluginResource.js.map +1 -0
- package/bin/chat/types/ChatPromptContext.d.ts +8 -8
- package/bin/chat/types/ChatPromptContext.d.ts.map +1 -1
- package/bin/chat/types/ChatQueue.d.ts +2 -2
- package/bin/chat/types/ChatQueue.d.ts.map +1 -1
- package/bin/chat/types/ChatQueueWorker.d.ts +3 -3
- package/bin/chat/types/ChatQueueWorker.d.ts.map +1 -1
- package/bin/chat/types/ChatRuntimeAccount.d.ts +39 -0
- package/bin/chat/types/ChatRuntimeAccount.d.ts.map +1 -0
- package/bin/chat/types/ChatRuntimeAccount.js +10 -0
- package/bin/chat/types/ChatRuntimeAccount.js.map +1 -0
- package/bin/chat/types/DirectDispatch.d.ts +13 -13
- package/bin/chat/types/DirectDispatch.d.ts.map +1 -1
- package/bin/chat/types/DirectDispatch.js +1 -1
- package/bin/chat/types/FeishuInboundAttachment.d.ts +1 -1
- package/bin/chat/types/FeishuInboundAttachment.d.ts.map +1 -1
- package/bin/chat/types/QqInboundDedupe.d.ts +1 -1
- package/bin/chat/types/QqInboundDedupe.d.ts.map +1 -1
- package/bin/chat/types/ReplyContext.d.ts +1 -1
- package/bin/chat/types/ReplyContext.d.ts.map +1 -1
- package/bin/chat.d.ts +4 -3
- package/bin/chat.d.ts.map +1 -1
- package/bin/chat.js +2 -2
- package/bin/chat.js.map +1 -1
- package/bin/contact/Action.d.ts +11 -11
- package/bin/contact/Action.d.ts.map +1 -1
- package/bin/contact/Action.js +27 -27
- package/bin/contact/Action.js.map +1 -1
- package/bin/contact/ContactPlugin.js +33 -33
- package/bin/contact/ContactPlugin.js.map +1 -1
- package/bin/contact/runtime/ChatRuntime.d.ts +2 -2
- package/bin/contact/runtime/ChatRuntime.d.ts.map +1 -1
- package/bin/contact/runtime/ChatRuntime.js +8 -23
- package/bin/contact/runtime/ChatRuntime.js.map +1 -1
- package/bin/contact/runtime/ContactStore.d.ts +8 -8
- package/bin/contact/runtime/ContactStore.d.ts.map +1 -1
- package/bin/contact/runtime/ContactStore.js +24 -24
- package/bin/contact/runtime/ContactStore.js.map +1 -1
- package/bin/contact/runtime/InboxStore.d.ts +6 -6
- package/bin/contact/runtime/InboxStore.d.ts.map +1 -1
- package/bin/contact/runtime/InboxStore.js +16 -16
- package/bin/contact/runtime/InboxStore.js.map +1 -1
- package/bin/contact/runtime/LinkApproval.js +17 -17
- package/bin/contact/runtime/LinkApproval.js.map +1 -1
- package/bin/contact/runtime/LinkCode.d.ts +1 -1
- package/bin/contact/runtime/LinkCode.d.ts.map +1 -1
- package/bin/contact/runtime/LinkCode.js +6 -6
- package/bin/contact/runtime/LinkCode.js.map +1 -1
- package/bin/contact/runtime/LinkStore.d.ts +2 -2
- package/bin/contact/runtime/LinkStore.d.ts.map +1 -1
- package/bin/contact/runtime/LinkStore.js +7 -7
- package/bin/contact/runtime/LinkStore.js.map +1 -1
- package/bin/contact/runtime/Paths.d.ts +14 -14
- package/bin/contact/runtime/Paths.d.ts.map +1 -1
- package/bin/contact/runtime/Paths.js +28 -28
- package/bin/contact/runtime/Paths.js.map +1 -1
- package/bin/contact/runtime/RemoteClient.d.ts +1 -1
- package/bin/contact/runtime/RemoteClient.js +18 -18
- package/bin/contact/runtime/RemoteClient.js.map +1 -1
- package/bin/contact/runtime/ShareBundle.d.ts +3 -3
- package/bin/contact/runtime/ShareBundle.d.ts.map +1 -1
- package/bin/contact/runtime/ShareBundle.js +5 -5
- package/bin/contact/runtime/ShareBundle.js.map +1 -1
- package/bin/contact/types/Contact.d.ts +2 -2
- package/bin/contact/types/Contact.d.ts.map +1 -1
- package/bin/contact/types/ContactApproval.d.ts +2 -2
- package/bin/contact/types/ContactApproval.d.ts.map +1 -1
- package/bin/contact/types/ContactChat.d.ts +1 -1
- package/bin/contact/types/ContactChat.d.ts.map +1 -1
- package/bin/contact/types/ContactLink.d.ts +4 -4
- package/bin/contact/types/ContactLink.d.ts.map +1 -1
- package/bin/image/ImagePlugin.d.ts +3 -3
- package/bin/image/ImagePlugin.d.ts.map +1 -1
- package/bin/image/ImagePlugin.js +25 -10
- package/bin/image/ImagePlugin.js.map +1 -1
- package/bin/image/types/ImagePlugin.d.ts +3 -3
- package/bin/image/types/ImagePlugin.d.ts.map +1 -1
- package/bin/image/types/ImagePlugin.js +1 -1
- package/bin/memory/Action.d.ts +7 -7
- package/bin/memory/Action.d.ts.map +1 -1
- package/bin/memory/Action.js +11 -11
- package/bin/memory/Action.js.map +1 -1
- package/bin/memory/MemoryPlugin.d.ts +3 -3
- package/bin/memory/MemoryPlugin.d.ts.map +1 -1
- package/bin/memory/MemoryPlugin.js +21 -21
- package/bin/memory/MemoryPlugin.js.map +1 -1
- package/bin/memory/runtime/Search.d.ts +3 -3
- package/bin/memory/runtime/Search.d.ts.map +1 -1
- package/bin/memory/runtime/Search.js +2 -2
- package/bin/memory/runtime/Search.js.map +1 -1
- package/bin/memory/runtime/Store.d.ts +2 -2
- package/bin/memory/runtime/Store.d.ts.map +1 -1
- package/bin/memory/runtime/Store.js +1 -1
- package/bin/memory/runtime/Store.js.map +1 -1
- package/bin/memory/runtime/SystemProvider.d.ts +3 -3
- package/bin/memory/runtime/SystemProvider.d.ts.map +1 -1
- package/bin/memory/runtime/SystemProvider.js +1 -1
- package/bin/memory/runtime/SystemProvider.js.map +1 -1
- package/bin/memory/runtime/Writer.d.ts +8 -8
- package/bin/memory/runtime/Writer.d.ts.map +1 -1
- package/bin/memory/runtime/Writer.js +14 -14
- package/bin/memory/runtime/Writer.js.map +1 -1
- package/bin/memory/types/Memory.d.ts +3 -3
- package/bin/memory/types/Memory.d.ts.map +1 -1
- package/bin/skill/Action.d.ts +4 -4
- package/bin/skill/Action.d.ts.map +1 -1
- package/bin/skill/Action.js +9 -9
- package/bin/skill/Action.js.map +1 -1
- package/bin/skill/Plugin.js +16 -16
- package/bin/skill/Plugin.js.map +1 -1
- package/bin/skill/runtime/Discovery.d.ts +2 -2
- package/bin/skill/runtime/Discovery.d.ts.map +1 -1
- package/bin/skill/runtime/Discovery.js +3 -3
- package/bin/skill/runtime/Discovery.js.map +1 -1
- package/bin/skill/runtime/Paths.d.ts +1 -1
- package/bin/skill/runtime/Paths.d.ts.map +1 -1
- package/bin/skill/runtime/Paths.js +6 -6
- package/bin/skill/runtime/Paths.js.map +1 -1
- package/bin/skill/runtime/Store.d.ts +3 -3
- package/bin/skill/runtime/Store.d.ts.map +1 -1
- package/bin/skill/runtime/Store.js +19 -19
- package/bin/skill/runtime/Store.js.map +1 -1
- package/bin/skill/runtime/SystemProvider.d.ts +2 -2
- package/bin/skill/runtime/SystemProvider.d.ts.map +1 -1
- package/bin/skill/runtime/SystemProvider.js +4 -4
- package/bin/skill/runtime/SystemProvider.js.map +1 -1
- package/bin/skill/runtime/Types.d.ts +3 -3
- package/bin/skill/runtime/Types.d.ts.map +1 -1
- package/bin/sound/Plugin.d.ts +5 -5
- package/bin/sound/Plugin.d.ts.map +1 -1
- package/bin/sound/Plugin.js +23 -11
- package/bin/sound/Plugin.js.map +1 -1
- package/bin/task/Action.d.ts +10 -10
- package/bin/task/Action.d.ts.map +1 -1
- package/bin/task/Action.js +31 -31
- package/bin/task/Action.js.map +1 -1
- package/bin/task/PROMPT.d.ts +1 -1
- package/bin/task/PROMPT.d.ts.map +1 -1
- package/bin/task/PROMPT.js +1 -1
- package/bin/task/PROMPT.js.map +1 -1
- package/bin/task/Scheduler.d.ts +2 -2
- package/bin/task/Scheduler.d.ts.map +1 -1
- package/bin/task/Scheduler.js +8 -8
- package/bin/task/Scheduler.js.map +1 -1
- package/bin/task/TaskPlugin.d.ts +3 -3
- package/bin/task/TaskPlugin.d.ts.map +1 -1
- package/bin/task/TaskPlugin.js +23 -20
- package/bin/task/TaskPlugin.js.map +1 -1
- package/bin/task/runtime/Model.d.ts +2 -2
- package/bin/task/runtime/Model.d.ts.map +1 -1
- package/bin/task/runtime/Model.js +11 -11
- package/bin/task/runtime/Model.js.map +1 -1
- package/bin/task/runtime/Paths.d.ts +6 -6
- package/bin/task/runtime/Paths.d.ts.map +1 -1
- package/bin/task/runtime/Paths.js +11 -11
- package/bin/task/runtime/Paths.js.map +1 -1
- package/bin/task/runtime/Runner.d.ts +4 -4
- package/bin/task/runtime/Runner.d.ts.map +1 -1
- package/bin/task/runtime/Runner.js +17 -17
- package/bin/task/runtime/Runner.js.map +1 -1
- package/bin/task/runtime/Store.d.ts +7 -7
- package/bin/task/runtime/Store.d.ts.map +1 -1
- package/bin/task/runtime/Store.js +15 -15
- package/bin/task/runtime/Store.js.map +1 -1
- package/bin/task/runtime/TaskActionExecution.d.ts +12 -12
- package/bin/task/runtime/TaskActionExecution.d.ts.map +1 -1
- package/bin/task/runtime/TaskActionExecution.js +7 -7
- package/bin/task/runtime/TaskActionExecution.js.map +1 -1
- package/bin/task/runtime/TaskActionInput.js +10 -10
- package/bin/task/runtime/TaskActionInput.js.map +1 -1
- package/bin/task/runtime/TaskPluginActionRegistry.js +26 -26
- package/bin/task/runtime/TaskPluginActionRegistry.js.map +1 -1
- package/bin/task/runtime/TaskRunArtifacts.js +4 -4
- package/bin/task/runtime/TaskRunArtifacts.js.map +1 -1
- package/bin/task/runtime/TaskRunChatDispatch.d.ts +2 -2
- package/bin/task/runtime/TaskRunChatDispatch.d.ts.map +1 -1
- package/bin/task/runtime/TaskRunChatDispatch.js +7 -7
- package/bin/task/runtime/TaskRunChatDispatch.js.map +1 -1
- package/bin/task/runtime/TaskRunnerProgress.js +1 -1
- package/bin/task/runtime/TaskRunnerProgress.js.map +1 -1
- package/bin/task/runtime/TaskRunnerRound.d.ts +7 -7
- package/bin/task/runtime/TaskRunnerRound.d.ts.map +1 -1
- package/bin/task/runtime/TaskRunnerRound.js +34 -38
- package/bin/task/runtime/TaskRunnerRound.js.map +1 -1
- package/bin/task/runtime/TaskRunnerScript.d.ts +4 -4
- package/bin/task/runtime/TaskRunnerScript.d.ts.map +1 -1
- package/bin/task/runtime/TaskRunnerScript.js +1 -1
- package/bin/task/runtime/TaskRunnerScript.js.map +1 -1
- package/bin/task/runtime/TaskRunnerSession.d.ts +8 -8
- package/bin/task/runtime/TaskRunnerSession.d.ts.map +1 -1
- package/bin/task/runtime/TaskRunnerSession.js +52 -39
- package/bin/task/runtime/TaskRunnerSession.js.map +1 -1
- package/bin/task/runtime/TaskRunnerTypes.d.ts +5 -5
- package/bin/task/runtime/TaskRunnerTypes.d.ts.map +1 -1
- package/bin/task/types/Task.d.ts +4 -4
- package/bin/task/types/Task.d.ts.map +1 -1
- package/bin/task/types/TaskCommand.d.ts +3 -3
- package/bin/task/types/TaskCommand.d.ts.map +1 -1
- package/bin/web/Plugin.d.ts +2 -2
- package/bin/web/Plugin.d.ts.map +1 -1
- package/bin/web/Plugin.js +3 -3
- package/bin/web/Plugin.js.map +1 -1
- package/bin/workboard/Plugin.d.ts.map +1 -1
- package/bin/workboard/Plugin.js +6 -7
- package/bin/workboard/Plugin.js.map +1 -1
- package/bin/workboard/runtime/Collector.d.ts +2 -2
- package/bin/workboard/runtime/Collector.d.ts.map +1 -1
- package/bin/workboard/runtime/Collector.js +4 -4
- package/bin/workboard/runtime/Collector.js.map +1 -1
- package/bin/workboard/runtime/Normalizer.d.ts +3 -3
- package/bin/workboard/runtime/Normalizer.d.ts.map +1 -1
- package/bin/workboard/runtime/Normalizer.js +11 -11
- package/bin/workboard/runtime/Normalizer.js.map +1 -1
- package/bin/workboard/runtime/SessionSummary.d.ts +5 -5
- package/bin/workboard/runtime/SessionSummary.d.ts.map +1 -1
- package/bin/workboard/runtime/SessionSummary.js +4 -4
- package/bin/workboard/runtime/SessionSummary.js.map +1 -1
- package/bin/workboard/runtime/Store.d.ts +5 -5
- package/bin/workboard/runtime/Store.d.ts.map +1 -1
- package/bin/workboard/runtime/Store.js.map +1 -1
- package/bin/workboard/types/Workboard.d.ts +2 -2
- package/bin/workboard/types/Workboard.d.ts.map +1 -1
- package/bin/workboard/types/Workboard.js +1 -1
- package/package.json +3 -3
- package/scripts/chat-access.test.mjs +2 -2
- package/scripts/chat-channel-config.test.mjs +25 -3
- package/scripts/chat-storage.test.mjs +7 -7
- package/scripts/skill-plugin.test.mjs +4 -4
- package/scripts/sound-plugin.test.mjs +12 -8
- package/scripts/web-plugin.test.mjs +4 -4
- package/src/chat/Action.ts +154 -153
- package/src/chat/ChatPlugin.ts +12 -12
- package/src/chat/Index.ts +12 -0
- package/src/chat/PROMPT.direct.ts +1 -1
- package/src/chat/access/ChatAccessActions.ts +6 -6
- package/src/chat/access/ChatAccessRuntime.ts +5 -5
- package/src/chat/access/ChatAccessStore.ts +5 -5
- package/src/chat/channels/BaseChatChannel.ts +32 -32
- package/src/chat/channels/BaseChatChannelQueue.ts +38 -38
- package/src/chat/channels/BaseChatChannelSupport.ts +25 -25
- package/src/chat/channels/RuntimeChannel.ts +53 -74
- package/src/chat/channels/feishu/Feishu.ts +35 -35
- package/src/chat/channels/feishu/FeishuInbound.ts +3 -3
- package/src/chat/channels/feishu/FeishuMessageHandler.ts +29 -29
- package/src/chat/channels/feishu/FeishuPlatformClient.ts +15 -15
- package/src/chat/channels/feishu/FeishuPlatformLookup.ts +7 -7
- package/src/chat/channels/feishu/FeishuPlatformMessaging.ts +7 -7
- package/src/chat/channels/feishu/InboundAttachment.ts +6 -6
- package/src/chat/channels/feishu/PostMessage.ts +8 -8
- package/src/chat/channels/feishu/ReplyContext.ts +3 -3
- package/src/chat/channels/feishu/Shared.ts +3 -3
- package/src/chat/channels/qq/PROMPT.direct.ts +1 -1
- package/src/chat/channels/qq/QQ.ts +26 -26
- package/src/chat/channels/qq/QQEventCapture.ts +3 -3
- package/src/chat/channels/qq/QQGatewayAuth.ts +1 -1
- package/src/chat/channels/qq/QQGatewayClient.ts +12 -12
- package/src/chat/channels/qq/QQGatewayConnection.ts +1 -1
- package/src/chat/channels/qq/QQGatewaySend.ts +6 -6
- package/src/chat/channels/qq/QQInbound.ts +5 -5
- package/src/chat/channels/qq/QQInboundDedupe.ts +6 -6
- package/src/chat/channels/qq/QQMessageHandler.ts +43 -43
- package/src/chat/channels/qq/QQSendSupport.ts +2 -2
- package/src/chat/channels/qq/QQSupport.ts +10 -10
- package/src/chat/channels/qq/types/QqChannel.ts +1 -1
- package/src/chat/channels/telegram/ApiClient.ts +7 -7
- package/src/chat/channels/telegram/Bot.ts +17 -17
- package/src/chat/channels/telegram/BotInfo.ts +1 -1
- package/src/chat/channels/telegram/ReplyContext.ts +3 -3
- package/src/chat/channels/telegram/Shared.ts +3 -3
- package/src/chat/channels/telegram/StateStore.ts +2 -2
- package/src/chat/channels/telegram/TelegramInbound.ts +4 -4
- package/src/chat/channels/telegram/TelegramMessageHandler.ts +35 -35
- package/src/chat/channels/telegram/TelegramPendingUpdates.ts +9 -9
- package/src/chat/channels/telegram/TelegramPlatformClient.ts +11 -11
- package/src/chat/config/ChatPluginConfig.ts +266 -0
- package/src/chat/runtime/ChannelContextStore.ts +88 -88
- package/src/chat/runtime/ChatActionExecution.ts +87 -87
- package/src/chat/runtime/ChatActionInput.ts +19 -19
- package/src/chat/runtime/ChatChannelActions.ts +4 -4
- package/src/chat/runtime/ChatChannelConfig.ts +14 -14
- package/src/chat/runtime/ChatChannelCore.ts +17 -26
- package/src/chat/runtime/ChatChannelLifecycle.ts +12 -12
- package/src/chat/runtime/ChatHistoryStore.ts +39 -39
- package/src/chat/runtime/ChatIngressStore.ts +6 -6
- package/src/chat/runtime/ChatMetaStore.ts +37 -37
- package/src/chat/runtime/ChatPluginActionRegistry.ts +56 -62
- package/src/chat/runtime/ChatPluginSystem.ts +9 -9
- package/src/chat/runtime/ChatQueueReplyDispatch.ts +47 -47
- package/src/chat/runtime/ChatQueueStore.ts +4 -4
- package/src/chat/runtime/ChatQueueWorker.ts +38 -44
- package/src/chat/runtime/ChatQueueWorkerSupport.ts +18 -18
- package/src/chat/runtime/ChatSendActionInput.ts +53 -53
- package/src/chat/runtime/ChatSendMetadata.ts +15 -15
- package/src/chat/runtime/ChatSendRegistry.ts +1 -1
- package/src/chat/runtime/ChatSessionDelete.ts +19 -19
- package/src/chat/runtime/ChatStorage.ts +3 -3
- package/src/chat/runtime/ChatkeySend.ts +43 -43
- package/src/chat/runtime/DirectDispatchParser.ts +21 -21
- package/src/chat/runtime/EnqueueDispatch.ts +3 -3
- package/src/chat/runtime/InboundAugment.ts +8 -8
- package/src/chat/runtime/QueuedUserMessage.ts +6 -6
- package/src/chat/runtime/ReplyContextFormatter.ts +6 -6
- package/src/chat/runtime/ReplyDispatch.ts +9 -9
- package/src/chat/runtime/SystemPrompt.ts +14 -14
- package/src/chat/types/ChannelContext.ts +11 -11
- package/src/chat/types/ChatCommand.ts +31 -31
- package/src/chat/types/ChatDispatcher.ts +3 -3
- package/src/chat/types/ChatHistory.ts +2 -2
- package/src/chat/types/ChatMeta.ts +4 -4
- package/src/chat/types/ChatPlugin.ts +9 -9
- package/src/chat/types/ChatPluginActionPayload.ts +13 -13
- package/src/chat/types/ChatPluginOptions.ts +6 -6
- package/src/chat/types/ChatPluginResource.ts +95 -0
- package/src/chat/types/ChatPromptContext.ts +8 -8
- package/src/chat/types/ChatQueue.ts +2 -2
- package/src/chat/types/ChatQueueWorker.ts +3 -3
- package/src/chat/types/ChatRuntimeAccount.ts +52 -0
- package/src/chat/types/DirectDispatch.ts +13 -13
- package/src/chat/types/FeishuInboundAttachment.ts +1 -1
- package/src/chat/types/QqInboundDedupe.ts +1 -1
- package/src/chat/types/ReplyContext.ts +1 -1
- package/src/chat.ts +13 -3
- package/src/contact/Action.ts +40 -40
- package/src/contact/ContactPlugin.ts +49 -49
- package/src/contact/runtime/ChatRuntime.ts +10 -26
- package/src/contact/runtime/ContactStore.ts +24 -24
- package/src/contact/runtime/InboxStore.ts +16 -16
- package/src/contact/runtime/LinkApproval.ts +19 -19
- package/src/contact/runtime/LinkCode.ts +7 -7
- package/src/contact/runtime/LinkStore.ts +7 -7
- package/src/contact/runtime/Paths.ts +28 -28
- package/src/contact/runtime/RemoteClient.ts +19 -19
- package/src/contact/runtime/ShareBundle.ts +8 -8
- package/src/contact/types/Contact.ts +2 -2
- package/src/contact/types/ContactApproval.ts +2 -2
- package/src/contact/types/ContactChat.ts +1 -1
- package/src/contact/types/ContactLink.ts +4 -4
- package/src/image/ImagePlugin.ts +32 -16
- package/src/image/types/ImagePlugin.ts +3 -3
- package/src/memory/Action.ts +18 -18
- package/src/memory/MemoryPlugin.ts +25 -25
- package/src/memory/runtime/Search.ts +6 -6
- package/src/memory/runtime/Store.ts +3 -3
- package/src/memory/runtime/SystemProvider.ts +4 -4
- package/src/memory/runtime/Writer.ts +24 -24
- package/src/memory/types/Memory.ts +3 -3
- package/src/skill/Action.ts +10 -10
- package/src/skill/Plugin.ts +16 -16
- package/src/skill/runtime/Discovery.ts +3 -3
- package/src/skill/runtime/Paths.ts +6 -6
- package/src/skill/runtime/Store.ts +19 -19
- package/src/skill/runtime/SystemProvider.ts +5 -5
- package/src/skill/runtime/Types.ts +3 -3
- package/src/sound/Plugin.ts +31 -18
- package/src/task/Action.ts +40 -40
- package/src/task/PROMPT.ts +1 -1
- package/src/task/Scheduler.ts +10 -10
- package/src/task/TaskPlugin.ts +32 -30
- package/src/task/runtime/Model.ts +12 -12
- package/src/task/runtime/Paths.ts +11 -11
- package/src/task/runtime/Runner.ts +21 -21
- package/src/task/runtime/Store.ts +21 -21
- package/src/task/runtime/TaskActionExecution.ts +19 -19
- package/src/task/runtime/TaskActionInput.ts +10 -10
- package/src/task/runtime/TaskPluginActionRegistry.ts +27 -27
- package/src/task/runtime/TaskRunArtifacts.ts +4 -4
- package/src/task/runtime/TaskRunChatDispatch.ts +9 -9
- package/src/task/runtime/TaskRunnerProgress.ts +1 -1
- package/src/task/runtime/TaskRunnerRound.ts +47 -42
- package/src/task/runtime/TaskRunnerScript.ts +5 -5
- package/src/task/runtime/TaskRunnerSession.ts +58 -46
- package/src/task/runtime/TaskRunnerTypes.ts +5 -5
- package/src/task/types/Task.ts +4 -4
- package/src/task/types/TaskCommand.ts +3 -3
- package/src/web/Plugin.ts +5 -5
- package/src/workboard/Plugin.ts +8 -9
- package/src/workboard/runtime/Collector.ts +6 -6
- package/src/workboard/runtime/Normalizer.ts +14 -14
- package/src/workboard/runtime/SessionSummary.ts +9 -9
- package/src/workboard/runtime/Store.ts +6 -6
- package/src/workboard/types/Workboard.ts +2 -2
- package/bin/chat/accounts/ChannelAccountManager.d.ts +0 -61
- package/bin/chat/accounts/ChannelAccountManager.d.ts.map +0 -1
- package/bin/chat/accounts/ChannelAccountManager.js +0 -264
- package/bin/chat/accounts/ChannelAccountManager.js.map +0 -1
- package/bin/chat/accounts/Crypto.d.ts +0 -20
- package/bin/chat/accounts/Crypto.d.ts.map +0 -1
- package/bin/chat/accounts/Crypto.js +0 -75
- package/bin/chat/accounts/Crypto.js.map +0 -1
- package/bin/chat/accounts/Store.d.ts +0 -38
- package/bin/chat/accounts/Store.d.ts.map +0 -1
- package/bin/chat/accounts/Store.js +0 -220
- package/bin/chat/accounts/Store.js.map +0 -1
- package/bin/chat/channels/Configuration.d.ts +0 -27
- package/bin/chat/channels/Configuration.d.ts.map +0 -1
- package/bin/chat/channels/Configuration.js +0 -19
- package/bin/chat/channels/Configuration.js.map +0 -1
- package/bin/chat/channels/ConfigurationRegistry.d.ts +0 -18
- package/bin/chat/channels/ConfigurationRegistry.d.ts.map +0 -1
- package/bin/chat/channels/ConfigurationRegistry.js +0 -31
- package/bin/chat/channels/ConfigurationRegistry.js.map +0 -1
- package/bin/chat/channels/feishu/Configuration.d.ts +0 -17
- package/bin/chat/channels/feishu/Configuration.d.ts.map +0 -1
- package/bin/chat/channels/feishu/Configuration.js +0 -59
- package/bin/chat/channels/feishu/Configuration.js.map +0 -1
- package/bin/chat/channels/qq/Configuration.d.ts +0 -17
- package/bin/chat/channels/qq/Configuration.d.ts.map +0 -1
- package/bin/chat/channels/qq/Configuration.js +0 -59
- package/bin/chat/channels/qq/Configuration.js.map +0 -1
- package/bin/chat/channels/telegram/Configuration.d.ts +0 -17
- package/bin/chat/channels/telegram/Configuration.d.ts.map +0 -1
- package/bin/chat/channels/telegram/Configuration.js +0 -59
- package/bin/chat/channels/telegram/Configuration.js.map +0 -1
- package/bin/chat/types/ChannelAccount.d.ts +0 -226
- package/bin/chat/types/ChannelAccount.d.ts.map +0 -1
- package/bin/chat/types/ChannelAccount.js +0 -9
- package/bin/chat/types/ChannelAccount.js.map +0 -1
- package/bin/chat/types/ChannelConfiguration.d.ts +0 -146
- package/bin/chat/types/ChannelConfiguration.d.ts.map +0 -1
- package/bin/chat/types/ChannelConfiguration.js +0 -9
- package/bin/chat/types/ChannelConfiguration.js.map +0 -1
- package/src/chat/accounts/ChannelAccountManager.ts +0 -314
- package/src/chat/accounts/Crypto.ts +0 -83
- package/src/chat/accounts/Store.ts +0 -287
- package/src/chat/channels/Configuration.ts +0 -35
- package/src/chat/channels/ConfigurationRegistry.ts +0 -43
- package/src/chat/channels/feishu/Configuration.ts +0 -65
- package/src/chat/channels/qq/Configuration.ts +0 -64
- package/src/chat/channels/telegram/Configuration.ts +0 -65
- package/src/chat/types/ChannelAccount.ts +0 -232
- package/src/chat/types/ChannelConfiguration.ts +0 -160
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* - CLI 可以直接复用 ChatAccessService,不依赖运行中 Agent。
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { create_action } from "@downcity/agent";
|
|
10
10
|
import type { PluginActions } from "@downcity/agent";
|
|
11
11
|
import type { JsonValue } from "@downcity/agent";
|
|
12
12
|
import { z } from "zod";
|
|
@@ -19,7 +19,7 @@ const scope_schema = z.enum(["direct", "group", "all"]);
|
|
|
19
19
|
/** 创建 Chat Access Action 集合。 */
|
|
20
20
|
export function create_chat_access_actions(): PluginActions {
|
|
21
21
|
return {
|
|
22
|
-
[CHAT_ACCESS_ACTIONS.snapshot]:
|
|
22
|
+
[CHAT_ACCESS_ACTIONS.snapshot]: create_action({
|
|
23
23
|
description: "Read Chat Access principals, grants, and requests for the current Agent.",
|
|
24
24
|
input_schema: {
|
|
25
25
|
zod: z.object({}).passthrough(),
|
|
@@ -30,7 +30,7 @@ export function create_chat_access_actions(): PluginActions {
|
|
|
30
30
|
data: create_chat_access_service(context).snapshot() as unknown as JsonValue,
|
|
31
31
|
}),
|
|
32
32
|
}),
|
|
33
|
-
[CHAT_ACCESS_ACTIONS.approve]:
|
|
33
|
+
[CHAT_ACCESS_ACTIONS.approve]: create_action({
|
|
34
34
|
description: "Approve a pending Chat Access request.",
|
|
35
35
|
input_schema: {
|
|
36
36
|
zod: z.object({
|
|
@@ -60,7 +60,7 @@ export function create_chat_access_actions(): PluginActions {
|
|
|
60
60
|
};
|
|
61
61
|
},
|
|
62
62
|
}),
|
|
63
|
-
[CHAT_ACCESS_ACTIONS.deny]:
|
|
63
|
+
[CHAT_ACCESS_ACTIONS.deny]: create_action({
|
|
64
64
|
description: "Deny a pending Chat Access request.",
|
|
65
65
|
input_schema: {
|
|
66
66
|
zod: z.object({
|
|
@@ -90,7 +90,7 @@ export function create_chat_access_actions(): PluginActions {
|
|
|
90
90
|
};
|
|
91
91
|
},
|
|
92
92
|
}),
|
|
93
|
-
[CHAT_ACCESS_ACTIONS.set]:
|
|
93
|
+
[CHAT_ACCESS_ACTIONS.set]: create_action({
|
|
94
94
|
description: "Set allow or deny for a known Chat Access principal.",
|
|
95
95
|
input_schema: {
|
|
96
96
|
zod: z.object({
|
|
@@ -123,7 +123,7 @@ export function create_chat_access_actions(): PluginActions {
|
|
|
123
123
|
};
|
|
124
124
|
},
|
|
125
125
|
}),
|
|
126
|
-
[CHAT_ACCESS_ACTIONS.revoke]:
|
|
126
|
+
[CHAT_ACCESS_ACTIONS.revoke]: create_action({
|
|
127
127
|
description: "Revoke Chat Access grants for a known principal.",
|
|
128
128
|
input_schema: {
|
|
129
129
|
zod: z.object({
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* - Channel Adapter、Plugin Action 和 CLI 共享同一个 Service 构造规则。
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type {
|
|
9
|
+
import type { PluginContext } from "@downcity/agent";
|
|
10
10
|
import { ChatAccessService } from "@/chat/access/ChatAccessService.js";
|
|
11
11
|
import { resolveChannelAccount } from "@/chat/runtime/ChatChannelCore.js";
|
|
12
12
|
import type { ChatDispatchChannel } from "@/chat/types/ChatDispatcher.js";
|
|
@@ -15,7 +15,7 @@ const CHANNELS: ChatDispatchChannel[] = ["telegram", "feishu", "qq"];
|
|
|
15
15
|
|
|
16
16
|
/** 解析当前 Agent 各渠道的稳定 Issuer。 */
|
|
17
17
|
export function resolve_chat_access_issuer_map(
|
|
18
|
-
context:
|
|
18
|
+
context: PluginContext,
|
|
19
19
|
): Partial<Record<ChatDispatchChannel, string>> {
|
|
20
20
|
const issuer_by_channel: Partial<Record<ChatDispatchChannel, string>> = {};
|
|
21
21
|
for (const channel of CHANNELS) {
|
|
@@ -26,15 +26,15 @@ export function resolve_chat_access_issuer_map(
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/** 创建当前 Agent 的 ChatAccessService。 */
|
|
29
|
-
export function create_chat_access_service(context:
|
|
29
|
+
export function create_chat_access_service(context: PluginContext): ChatAccessService {
|
|
30
30
|
return new ChatAccessService({
|
|
31
|
-
project_root: context.
|
|
31
|
+
project_root: context.workspace_path,
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
/** 解析指定渠道当前稳定 Issuer。 */
|
|
36
36
|
export function resolve_chat_access_issuer(
|
|
37
|
-
context:
|
|
37
|
+
context: PluginContext,
|
|
38
38
|
channel: ChatDispatchChannel,
|
|
39
39
|
): string {
|
|
40
40
|
return String(resolve_chat_access_issuer_map(context)[channel] || "").trim();
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import Database from "better-sqlite3";
|
|
11
11
|
import fs from "fs-extra";
|
|
12
12
|
import path from "node:path";
|
|
13
|
-
import {
|
|
13
|
+
import { generate_id } from "@downcity/agent";
|
|
14
14
|
import { ensure_chat_access_schema } from "@/chat/access/ChatAccessSchema.js";
|
|
15
15
|
import type {
|
|
16
16
|
ChatAccessEffect,
|
|
@@ -216,7 +216,7 @@ export class ChatAccessStore {
|
|
|
216
216
|
upsert_principal(input: UpsertChatAccessPrincipalInput): ChatAccessPrincipal {
|
|
217
217
|
const existing = this.get_principal_by_identity(input);
|
|
218
218
|
const current_time = now_iso();
|
|
219
|
-
const principal_id = existing?.principal_id || `principal_${
|
|
219
|
+
const principal_id = existing?.principal_id || `principal_${generate_id()}`;
|
|
220
220
|
const first_seen_at = normalize_text(input.first_seen_at) || existing?.first_seen_at || current_time;
|
|
221
221
|
const last_seen_at = normalize_text(input.last_seen_at) || current_time;
|
|
222
222
|
this.database.prepare(`
|
|
@@ -259,7 +259,7 @@ export class ChatAccessStore {
|
|
|
259
259
|
upsert_grant(input: UpsertChatAccessGrantInput): ChatAccessGrant {
|
|
260
260
|
const existing = this.get_grant(input.principal_id, input.scope);
|
|
261
261
|
const current_time = now_iso();
|
|
262
|
-
const grant_id = existing?.grant_id || `grant_${
|
|
262
|
+
const grant_id = existing?.grant_id || `grant_${generate_id()}`;
|
|
263
263
|
this.database.prepare(`
|
|
264
264
|
INSERT INTO chat_access_grants (
|
|
265
265
|
grant_id, principal_id, scope, effect, created_by, created_at, updated_at
|
|
@@ -336,7 +336,7 @@ export class ChatAccessStore {
|
|
|
336
336
|
return { request: updated, created: false };
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
-
const request_id = `req_${
|
|
339
|
+
const request_id = `req_${generate_id()}`;
|
|
340
340
|
this.database.prepare(`
|
|
341
341
|
INSERT INTO chat_access_requests (
|
|
342
342
|
request_id, principal_id, scope, chat_id, chat_type, status,
|
|
@@ -448,7 +448,7 @@ export class ChatAccessStore {
|
|
|
448
448
|
decision, operator, detail_json, created_at
|
|
449
449
|
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
450
450
|
`).run(
|
|
451
|
-
`audit_${
|
|
451
|
+
`audit_${generate_id()}`,
|
|
452
452
|
optional_text(input.principal_id) || null,
|
|
453
453
|
optional_text(input.request_id) || null,
|
|
454
454
|
normalize_text(input.action),
|
|
@@ -15,7 +15,7 @@ import type {
|
|
|
15
15
|
ChatDispatcher,
|
|
16
16
|
} from "@/chat/types/ChatDispatcher.js";
|
|
17
17
|
import type { Logger } from "@downcity/agent";
|
|
18
|
-
import type {
|
|
18
|
+
import type { PluginContext } from "@downcity/agent";
|
|
19
19
|
import { resolveChatQueueStore } from "@/chat/runtime/ChatQueue.js";
|
|
20
20
|
import { deleteChatSessionById } from "@/chat/runtime/ChatSessionDelete.js";
|
|
21
21
|
import {
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
} from "./BaseChatChannelQueue.js";
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
|
-
* Channel
|
|
37
|
+
* Channel chat_key 计算入参。
|
|
38
38
|
*
|
|
39
39
|
* 说明(中文)
|
|
40
40
|
* - chatId 必填;其余字段用于区分 topic/thread/消息上下文。
|
|
@@ -44,12 +44,12 @@ export type ChannelChatKeyParams = {
|
|
|
44
44
|
chatId: string;
|
|
45
45
|
messageThreadId?: number;
|
|
46
46
|
chatType?: string;
|
|
47
|
-
|
|
47
|
+
message_id?: string;
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
export type ChannelSendTextParams = ChannelChatKeyParams & {
|
|
51
51
|
text: string;
|
|
52
|
-
|
|
52
|
+
reply_to_message?: boolean;
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
export type ChannelSendActionParams = ChannelChatKeyParams & {
|
|
@@ -62,7 +62,7 @@ export type ChannelSendActionParams = ChannelChatKeyParams & {
|
|
|
62
62
|
* 入站消息统一结构(跨平台最小公共字段)。
|
|
63
63
|
*
|
|
64
64
|
* 说明(中文)
|
|
65
|
-
* - chatId 是平台原始会话标识(非
|
|
65
|
+
* - chatId 是平台原始会话标识(非 session_id)。
|
|
66
66
|
* - messageThreadId 用于支持 topic / thread 细粒度并发。
|
|
67
67
|
* - 该结构只描述“接收侧”,不包含平台发送参数。
|
|
68
68
|
*/
|
|
@@ -70,9 +70,9 @@ export type IncomingChatMessage = {
|
|
|
70
70
|
chatId: string;
|
|
71
71
|
text: string;
|
|
72
72
|
chatType?: string;
|
|
73
|
-
|
|
73
|
+
message_id?: string;
|
|
74
74
|
messageThreadId?: number;
|
|
75
|
-
|
|
75
|
+
user_id?: string;
|
|
76
76
|
username?: string;
|
|
77
77
|
/**
|
|
78
78
|
* 当前消息接收时间。
|
|
@@ -114,7 +114,7 @@ export type IncomingChatMessage = {
|
|
|
114
114
|
export type IncomingChatAccessParams = {
|
|
115
115
|
chatId: string;
|
|
116
116
|
chatType?: string;
|
|
117
|
-
|
|
117
|
+
user_id?: string;
|
|
118
118
|
username?: string;
|
|
119
119
|
chatTitle?: string;
|
|
120
120
|
};
|
|
@@ -129,18 +129,18 @@ export type IncomingChatAccessResult = ChatAccessDecision;
|
|
|
129
129
|
*/
|
|
130
130
|
export abstract class BaseChatChannel {
|
|
131
131
|
readonly channel: ChatDispatchChannel;
|
|
132
|
-
protected readonly context:
|
|
132
|
+
protected readonly context: PluginContext;
|
|
133
133
|
protected readonly rootPath: string;
|
|
134
134
|
protected readonly logger: Logger;
|
|
135
135
|
private readonly access_notice_sent_at = new Map<string, number>();
|
|
136
136
|
|
|
137
137
|
protected constructor(params: {
|
|
138
138
|
channel: ChatDispatchChannel;
|
|
139
|
-
context:
|
|
139
|
+
context: PluginContext;
|
|
140
140
|
}) {
|
|
141
141
|
this.channel = params.channel;
|
|
142
142
|
this.context = params.context;
|
|
143
|
-
this.rootPath = params.context.
|
|
143
|
+
this.rootPath = params.context.workspace_path;
|
|
144
144
|
this.logger = params.context.logger;
|
|
145
145
|
|
|
146
146
|
const dispatcher: ChatDispatcher = {
|
|
@@ -231,7 +231,7 @@ export abstract class BaseChatChannel {
|
|
|
231
231
|
return create_chat_access_service(this.context).evaluate({
|
|
232
232
|
channel: this.channel,
|
|
233
233
|
issuer,
|
|
234
|
-
subject_id: String(params.
|
|
234
|
+
subject_id: String(params.user_id || "").trim(),
|
|
235
235
|
display_name: String(params.username || "").trim() || undefined,
|
|
236
236
|
chat_id: String(params.chatId || "").trim(),
|
|
237
237
|
chat_type: String(params.chatType || "").trim() || undefined,
|
|
@@ -259,7 +259,7 @@ export abstract class BaseChatChannel {
|
|
|
259
259
|
}
|
|
260
260
|
const displayed_request_id = this.format_access_code(request_id);
|
|
261
261
|
const approval_command = this.format_access_command(
|
|
262
|
-
`
|
|
262
|
+
`city plugin action chat access-approve ${agent_id} --input '{"request_id":"${request_id}"}' --token <token>`,
|
|
263
263
|
);
|
|
264
264
|
return [
|
|
265
265
|
`当前账号尚未获准访问 Agent "${displayed_agent_id}"。`,
|
|
@@ -310,8 +310,8 @@ export abstract class BaseChatChannel {
|
|
|
310
310
|
chatType: normalized.chatType,
|
|
311
311
|
messageThreadId: normalized.messageThreadId,
|
|
312
312
|
text: normalized.text,
|
|
313
|
-
...(typeof normalized.
|
|
314
|
-
? {
|
|
313
|
+
...(typeof normalized.message_id === "string"
|
|
314
|
+
? { message_id: normalized.message_id }
|
|
315
315
|
: {}),
|
|
316
316
|
});
|
|
317
317
|
}
|
|
@@ -348,7 +348,7 @@ export abstract class BaseChatChannel {
|
|
|
348
348
|
action,
|
|
349
349
|
messageThreadId: params.messageThreadId,
|
|
350
350
|
chatType: params.chatType,
|
|
351
|
-
|
|
351
|
+
message_id: params.message_id,
|
|
352
352
|
reactionEmoji: params.reactionEmoji,
|
|
353
353
|
reactionIsBig: params.reactionIsBig,
|
|
354
354
|
});
|
|
@@ -359,20 +359,20 @@ export abstract class BaseChatChannel {
|
|
|
359
359
|
}
|
|
360
360
|
|
|
361
361
|
/**
|
|
362
|
-
* 清理某个
|
|
362
|
+
* 清理某个 session_id 对应的 agent 会话状态。
|
|
363
363
|
*
|
|
364
364
|
* 说明(中文)
|
|
365
365
|
* - 只清理 runtime / context 层状态,不直接删历史文件。
|
|
366
366
|
* - 常用于用户触发“重置对话”类命令。
|
|
367
367
|
*/
|
|
368
|
-
clearChat(
|
|
369
|
-
const key = String(
|
|
368
|
+
clearChat(session_id: string): void {
|
|
369
|
+
const key = String(session_id || "").trim();
|
|
370
370
|
if (!key) return;
|
|
371
371
|
resolveChatQueueStore(this.context).enqueue({
|
|
372
372
|
kind: "control",
|
|
373
373
|
channel: this.channel,
|
|
374
374
|
targetId: key,
|
|
375
|
-
|
|
375
|
+
session_id: key,
|
|
376
376
|
text: "",
|
|
377
377
|
control: { type: "clear" },
|
|
378
378
|
});
|
|
@@ -380,19 +380,19 @@ export abstract class BaseChatChannel {
|
|
|
380
380
|
}
|
|
381
381
|
|
|
382
382
|
/**
|
|
383
|
-
* 按渠道目标清理会话(映射到内部
|
|
383
|
+
* 按渠道目标清理会话(映射到内部 session_id)。
|
|
384
384
|
*/
|
|
385
385
|
protected async clearChatByTarget(params: ChannelChatKeyParams): Promise<void> {
|
|
386
386
|
const chatId = String(params.chatId || "").trim();
|
|
387
387
|
if (!chatId) return;
|
|
388
|
-
const
|
|
388
|
+
const session_id = await resolveChannelSessionId({
|
|
389
389
|
context: this.context,
|
|
390
390
|
channel: this.channel,
|
|
391
391
|
chatId,
|
|
392
392
|
chatType: params.chatType,
|
|
393
393
|
messageThreadId: params.messageThreadId,
|
|
394
394
|
});
|
|
395
|
-
if (!
|
|
395
|
+
if (!session_id) {
|
|
396
396
|
this.logger.info("Skip clear chat: context mapping not found", {
|
|
397
397
|
channel: this.channel,
|
|
398
398
|
chatId,
|
|
@@ -403,13 +403,13 @@ export abstract class BaseChatChannel {
|
|
|
403
403
|
}
|
|
404
404
|
const deleted = await deleteChatSessionById({
|
|
405
405
|
context: this.context,
|
|
406
|
-
|
|
406
|
+
session_id,
|
|
407
407
|
});
|
|
408
408
|
if (!deleted.success) {
|
|
409
409
|
this.logger.warn("Failed to delete chat context by target", {
|
|
410
410
|
channel: this.channel,
|
|
411
411
|
chatId,
|
|
412
|
-
|
|
412
|
+
session_id,
|
|
413
413
|
error: deleted.error || "delete failed",
|
|
414
414
|
});
|
|
415
415
|
return;
|
|
@@ -417,7 +417,7 @@ export abstract class BaseChatChannel {
|
|
|
417
417
|
this.logger.info("Deleted chat context by target", {
|
|
418
418
|
channel: this.channel,
|
|
419
419
|
chatId,
|
|
420
|
-
|
|
420
|
+
session_id,
|
|
421
421
|
removedMeta: deleted.removedMeta,
|
|
422
422
|
removedChatDir: deleted.removedChatDir,
|
|
423
423
|
removedSessionDir: deleted.removedSessionDir,
|
|
@@ -429,8 +429,8 @@ export abstract class BaseChatChannel {
|
|
|
429
429
|
*/
|
|
430
430
|
protected async enqueueAuditMessage(params: {
|
|
431
431
|
chatId: string;
|
|
432
|
-
|
|
433
|
-
|
|
432
|
+
message_id?: string;
|
|
433
|
+
user_id?: string;
|
|
434
434
|
text: string;
|
|
435
435
|
meta?: ChannelUserMessageMeta;
|
|
436
436
|
}): Promise<void> {
|
|
@@ -439,8 +439,8 @@ export abstract class BaseChatChannel {
|
|
|
439
439
|
channel: this.channel,
|
|
440
440
|
chatId: params.chatId,
|
|
441
441
|
text: params.text,
|
|
442
|
-
...(typeof params.
|
|
443
|
-
...(typeof params.
|
|
442
|
+
...(typeof params.message_id === "string" ? { message_id: params.message_id } : {}),
|
|
443
|
+
...(typeof params.user_id === "string" ? { user_id: params.user_id } : {}),
|
|
444
444
|
...(params.meta ? { meta: params.meta } : {}),
|
|
445
445
|
});
|
|
446
446
|
}
|
|
@@ -449,12 +449,12 @@ export abstract class BaseChatChannel {
|
|
|
449
449
|
* 将消息送入会话调度器队列。
|
|
450
450
|
*
|
|
451
451
|
* 返回值语义(中文)
|
|
452
|
-
* -
|
|
452
|
+
* - chat_key: lane 归属键(同 key 串行)。
|
|
453
453
|
* - position: 当前 lane 中排队位置(便于日志与观测)。
|
|
454
454
|
*/
|
|
455
455
|
protected async enqueueMessage(
|
|
456
456
|
msg: IncomingChatMessage,
|
|
457
|
-
): Promise<{
|
|
457
|
+
): Promise<{ chat_key: string; position: number }> {
|
|
458
458
|
return await enqueueExecChannelMessage({
|
|
459
459
|
context: this.context,
|
|
460
460
|
channel: this.channel,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
prepareChatEnqueue,
|
|
15
15
|
} from "@/chat/runtime/EnqueueDispatch.js";
|
|
16
16
|
import type { ChatDispatchChannel } from "@/chat/types/ChatDispatcher.js";
|
|
17
|
-
import type {
|
|
17
|
+
import type { PluginContext } from "@downcity/agent";
|
|
18
18
|
import type { JsonObject } from "@downcity/agent";
|
|
19
19
|
import type { IncomingChatMessage } from "./BaseChatChannel.js";
|
|
20
20
|
import {
|
|
@@ -32,7 +32,7 @@ export interface EnqueueAuditChannelMessageParams {
|
|
|
32
32
|
/**
|
|
33
33
|
* 当前 execution runtime。
|
|
34
34
|
*/
|
|
35
|
-
context:
|
|
35
|
+
context: PluginContext;
|
|
36
36
|
/**
|
|
37
37
|
* 当前渠道。
|
|
38
38
|
*/
|
|
@@ -48,11 +48,11 @@ export interface EnqueueAuditChannelMessageParams {
|
|
|
48
48
|
/**
|
|
49
49
|
* 可选消息 id。
|
|
50
50
|
*/
|
|
51
|
-
|
|
51
|
+
message_id?: string;
|
|
52
52
|
/**
|
|
53
53
|
* 可选用户 id。
|
|
54
54
|
*/
|
|
55
|
-
|
|
55
|
+
user_id?: string;
|
|
56
56
|
/**
|
|
57
57
|
* 可选扩展 meta。
|
|
58
58
|
*/
|
|
@@ -66,7 +66,7 @@ export interface EnqueueExecChannelMessageParams {
|
|
|
66
66
|
/**
|
|
67
67
|
* 当前 execution runtime。
|
|
68
68
|
*/
|
|
69
|
-
context:
|
|
69
|
+
context: PluginContext;
|
|
70
70
|
/**
|
|
71
71
|
* 当前渠道。
|
|
72
72
|
*/
|
|
@@ -92,40 +92,40 @@ export async function enqueueAuditChannelMessage(
|
|
|
92
92
|
const chatType = typeof meta.chatType === "string" ? meta.chatType : undefined;
|
|
93
93
|
const chatTitle =
|
|
94
94
|
typeof meta.chatTitle === "string" ? meta.chatTitle.trim() || undefined : undefined;
|
|
95
|
-
const
|
|
95
|
+
const session_id = await resolveOrCreateChannelSessionId({
|
|
96
96
|
context: params.context,
|
|
97
97
|
channel: params.channel,
|
|
98
98
|
chatId: params.chatId,
|
|
99
99
|
chatType,
|
|
100
100
|
messageThreadId,
|
|
101
101
|
});
|
|
102
|
-
if (!
|
|
102
|
+
if (!session_id) return;
|
|
103
103
|
|
|
104
104
|
const extra = stripUndefinedMeta(meta);
|
|
105
105
|
await appendInboundChannelHistory({
|
|
106
106
|
context: params.context,
|
|
107
107
|
logger: params.context.logger,
|
|
108
108
|
channel: params.channel,
|
|
109
|
-
|
|
109
|
+
session_id,
|
|
110
110
|
chatId: params.chatId,
|
|
111
111
|
ingressKind: "audit",
|
|
112
112
|
text: params.text,
|
|
113
113
|
targetType: chatType,
|
|
114
114
|
threadId: messageThreadId,
|
|
115
|
-
|
|
116
|
-
actorId: params.
|
|
115
|
+
message_id: params.message_id,
|
|
116
|
+
actorId: params.user_id,
|
|
117
117
|
actorName: username,
|
|
118
118
|
extra,
|
|
119
119
|
});
|
|
120
120
|
await updateChannelChatMeta({
|
|
121
121
|
context: params.context,
|
|
122
122
|
channel: params.channel,
|
|
123
|
-
|
|
123
|
+
session_id,
|
|
124
124
|
chatId: params.chatId,
|
|
125
125
|
targetType: chatType,
|
|
126
126
|
threadId: messageThreadId,
|
|
127
|
-
|
|
128
|
-
actorId: params.
|
|
127
|
+
message_id: params.message_id,
|
|
128
|
+
actorId: params.user_id,
|
|
129
129
|
actorName: username,
|
|
130
130
|
chatTitle,
|
|
131
131
|
});
|
|
@@ -135,13 +135,13 @@ export async function enqueueAuditChannelMessage(
|
|
|
135
135
|
input: {
|
|
136
136
|
kind: "audit",
|
|
137
137
|
channel: params.channel,
|
|
138
|
-
|
|
138
|
+
chat_key: session_id,
|
|
139
139
|
chatId: params.chatId,
|
|
140
140
|
text: params.text,
|
|
141
141
|
...(chatType ? { chatType } : {}),
|
|
142
142
|
...(typeof messageThreadId === "number" ? { threadId: messageThreadId } : {}),
|
|
143
|
-
...(typeof params.
|
|
144
|
-
...(typeof params.
|
|
143
|
+
...(typeof params.message_id === "string" ? { message_id: params.message_id } : {}),
|
|
144
|
+
...(typeof params.user_id === "string" ? { actorId: params.user_id } : {}),
|
|
145
145
|
...(typeof username === "string" ? { actorName: username } : {}),
|
|
146
146
|
extra,
|
|
147
147
|
},
|
|
@@ -150,15 +150,15 @@ export async function enqueueAuditChannelMessage(
|
|
|
150
150
|
kind: "audit",
|
|
151
151
|
channel: params.channel,
|
|
152
152
|
targetId: params.chatId,
|
|
153
|
-
|
|
153
|
+
session_id,
|
|
154
154
|
...(typeof preparedAudit.actorId === "string"
|
|
155
155
|
? { actorId: preparedAudit.actorId }
|
|
156
156
|
: {}),
|
|
157
157
|
...(typeof preparedAudit.actorName === "string"
|
|
158
158
|
? { actorName: preparedAudit.actorName }
|
|
159
159
|
: {}),
|
|
160
|
-
...(typeof preparedAudit.
|
|
161
|
-
? {
|
|
160
|
+
...(typeof preparedAudit.message_id === "string"
|
|
161
|
+
? { message_id: preparedAudit.message_id }
|
|
162
162
|
: {}),
|
|
163
163
|
text: preparedAudit.text,
|
|
164
164
|
...(typeof preparedAudit.threadId === "number"
|
|
@@ -187,26 +187,26 @@ export async function enqueueAuditChannelMessage(
|
|
|
187
187
|
*/
|
|
188
188
|
export async function enqueueExecChannelMessage(
|
|
189
189
|
params: EnqueueExecChannelMessageParams,
|
|
190
|
-
): Promise<{
|
|
190
|
+
): Promise<{ chat_key: string; position: number }> {
|
|
191
191
|
const msg = params.message;
|
|
192
192
|
const inboundExtra =
|
|
193
193
|
msg.extra && typeof msg.extra === "object" ? stripUndefinedMeta(msg.extra) : {};
|
|
194
194
|
const mergedExtra: JsonObject = { ...inboundExtra };
|
|
195
195
|
|
|
196
|
-
const
|
|
196
|
+
const chat_key = await resolveOrCreateChannelSessionId({
|
|
197
197
|
context: params.context,
|
|
198
198
|
channel: params.channel,
|
|
199
199
|
chatId: msg.chatId,
|
|
200
200
|
chatType: msg.chatType,
|
|
201
201
|
messageThreadId: msg.messageThreadId,
|
|
202
202
|
});
|
|
203
|
-
if (!
|
|
204
|
-
throw new Error("Failed to resolve
|
|
203
|
+
if (!chat_key) {
|
|
204
|
+
throw new Error("Failed to resolve session_id for incoming chat message");
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
const rawQueuedText = buildQueuedUserMessageWithInfo({
|
|
208
|
-
|
|
209
|
-
|
|
208
|
+
message_id: msg.message_id,
|
|
209
|
+
user_id: msg.user_id,
|
|
210
210
|
username: msg.username,
|
|
211
211
|
receivedAt: msg.receivedAt,
|
|
212
212
|
userTimezone: msg.userTimezone,
|
|
@@ -217,15 +217,15 @@ export async function enqueueExecChannelMessage(
|
|
|
217
217
|
input: {
|
|
218
218
|
kind: "exec",
|
|
219
219
|
channel: params.channel,
|
|
220
|
-
|
|
220
|
+
chat_key,
|
|
221
221
|
chatId: msg.chatId,
|
|
222
222
|
text: rawQueuedText,
|
|
223
223
|
...(msg.chatType ? { chatType: msg.chatType } : {}),
|
|
224
224
|
...(typeof msg.messageThreadId === "number"
|
|
225
225
|
? { threadId: msg.messageThreadId }
|
|
226
226
|
: {}),
|
|
227
|
-
...(typeof msg.
|
|
228
|
-
...(typeof msg.
|
|
227
|
+
...(typeof msg.message_id === "string" ? { message_id: msg.message_id } : {}),
|
|
228
|
+
...(typeof msg.user_id === "string" ? { actorId: msg.user_id } : {}),
|
|
229
229
|
...(typeof msg.username === "string" ? { actorName: msg.username } : {}),
|
|
230
230
|
extra: mergedExtra,
|
|
231
231
|
},
|
|
@@ -238,7 +238,7 @@ export async function enqueueExecChannelMessage(
|
|
|
238
238
|
|
|
239
239
|
await appendExecIngress({
|
|
240
240
|
context: params.context,
|
|
241
|
-
|
|
241
|
+
session_id: chat_key,
|
|
242
242
|
channel: params.channel,
|
|
243
243
|
chatId: msg.chatId,
|
|
244
244
|
text: queuedText,
|
|
@@ -248,8 +248,8 @@ export async function enqueueExecChannelMessage(
|
|
|
248
248
|
...(typeof preparedExec.threadId === "number"
|
|
249
249
|
? { threadId: preparedExec.threadId }
|
|
250
250
|
: {}),
|
|
251
|
-
...(typeof preparedExec.
|
|
252
|
-
? {
|
|
251
|
+
...(typeof preparedExec.message_id === "string"
|
|
252
|
+
? { message_id: preparedExec.message_id }
|
|
253
253
|
: {}),
|
|
254
254
|
...(typeof preparedExec.actorId === "string"
|
|
255
255
|
? { actorId: preparedExec.actorId }
|
|
@@ -263,12 +263,12 @@ export async function enqueueExecChannelMessage(
|
|
|
263
263
|
await updateChannelChatMeta({
|
|
264
264
|
context: params.context,
|
|
265
265
|
channel: params.channel,
|
|
266
|
-
|
|
266
|
+
session_id: chat_key,
|
|
267
267
|
chatId: msg.chatId,
|
|
268
268
|
targetType: msg.chatType,
|
|
269
269
|
threadId: msg.messageThreadId,
|
|
270
|
-
|
|
271
|
-
actorId: msg.
|
|
270
|
+
message_id: msg.message_id,
|
|
271
|
+
actorId: msg.user_id,
|
|
272
272
|
actorName: msg.username,
|
|
273
273
|
chatTitle: msg.chatTitle,
|
|
274
274
|
});
|
|
@@ -277,7 +277,7 @@ export async function enqueueExecChannelMessage(
|
|
|
277
277
|
kind: "exec",
|
|
278
278
|
channel: params.channel,
|
|
279
279
|
targetId: msg.chatId,
|
|
280
|
-
|
|
280
|
+
session_id: chat_key,
|
|
281
281
|
text: queuedText,
|
|
282
282
|
...(typeof preparedExec.chatType === "string"
|
|
283
283
|
? { targetType: preparedExec.chatType }
|
|
@@ -285,8 +285,8 @@ export async function enqueueExecChannelMessage(
|
|
|
285
285
|
...(typeof preparedExec.threadId === "number"
|
|
286
286
|
? { threadId: preparedExec.threadId }
|
|
287
287
|
: {}),
|
|
288
|
-
...(typeof preparedExec.
|
|
289
|
-
? {
|
|
288
|
+
...(typeof preparedExec.message_id === "string"
|
|
289
|
+
? { message_id: preparedExec.message_id }
|
|
290
290
|
: {}),
|
|
291
291
|
...(typeof preparedExec.actorId === "string"
|
|
292
292
|
? { actorId: preparedExec.actorId }
|
|
@@ -305,5 +305,5 @@ export async function enqueueExecChannelMessage(
|
|
|
305
305
|
},
|
|
306
306
|
});
|
|
307
307
|
|
|
308
|
-
return {
|
|
308
|
+
return { chat_key, position: execEnqueued.lanePosition };
|
|
309
309
|
}
|