@downcity/plugins 1.0.216 → 1.0.236
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/chat/Action.d.ts +51 -51
- package/bin/chat/Action.d.ts.map +1 -1
- package/bin/chat/Action.js +109 -108
- package/bin/chat/Action.js.map +1 -1
- package/bin/chat/ChatPlugin.d.ts +7 -7
- package/bin/chat/ChatPlugin.d.ts.map +1 -1
- package/bin/chat/ChatPlugin.js +4 -4
- package/bin/chat/ChatPlugin.js.map +1 -1
- package/bin/chat/Index.d.ts +3 -0
- package/bin/chat/Index.d.ts.map +1 -1
- package/bin/chat/Index.js +1 -0
- package/bin/chat/Index.js.map +1 -1
- package/bin/chat/PROMPT.direct.d.ts +1 -1
- package/bin/chat/PROMPT.direct.d.ts.map +1 -1
- package/bin/chat/PROMPT.direct.js +1 -1
- package/bin/chat/PROMPT.direct.js.map +1 -1
- package/bin/chat/access/ChatAccessActions.js +6 -6
- package/bin/chat/access/ChatAccessActions.js.map +1 -1
- package/bin/chat/access/ChatAccessRuntime.d.ts +4 -4
- package/bin/chat/access/ChatAccessRuntime.d.ts.map +1 -1
- package/bin/chat/access/ChatAccessRuntime.js +1 -1
- package/bin/chat/access/ChatAccessRuntime.js.map +1 -1
- package/bin/chat/access/ChatAccessStore.js +5 -5
- package/bin/chat/access/ChatAccessStore.js.map +1 -1
- package/bin/chat/channels/BaseChatChannel.d.ts +17 -17
- package/bin/chat/channels/BaseChatChannel.d.ts.map +1 -1
- package/bin/chat/channels/BaseChatChannel.js +19 -19
- package/bin/chat/channels/BaseChatChannel.js.map +1 -1
- package/bin/chat/channels/BaseChatChannelQueue.d.ts +6 -6
- package/bin/chat/channels/BaseChatChannelQueue.d.ts.map +1 -1
- package/bin/chat/channels/BaseChatChannelQueue.js +32 -32
- package/bin/chat/channels/BaseChatChannelQueue.js.map +1 -1
- package/bin/chat/channels/BaseChatChannelSupport.d.ts +14 -14
- package/bin/chat/channels/BaseChatChannelSupport.d.ts.map +1 -1
- package/bin/chat/channels/BaseChatChannelSupport.js +13 -13
- package/bin/chat/channels/BaseChatChannelSupport.js.map +1 -1
- package/bin/chat/channels/RuntimeChannel.d.ts +23 -28
- package/bin/chat/channels/RuntimeChannel.d.ts.map +1 -1
- package/bin/chat/channels/RuntimeChannel.js +39 -57
- package/bin/chat/channels/RuntimeChannel.js.map +1 -1
- package/bin/chat/channels/feishu/Feishu.d.ts +7 -7
- package/bin/chat/channels/feishu/Feishu.d.ts.map +1 -1
- package/bin/chat/channels/feishu/Feishu.js +31 -31
- package/bin/chat/channels/feishu/Feishu.js.map +1 -1
- package/bin/chat/channels/feishu/FeishuInbound.js +3 -3
- package/bin/chat/channels/feishu/FeishuInbound.js.map +1 -1
- package/bin/chat/channels/feishu/FeishuMessageHandler.d.ts +10 -10
- package/bin/chat/channels/feishu/FeishuMessageHandler.d.ts.map +1 -1
- package/bin/chat/channels/feishu/FeishuMessageHandler.js +17 -17
- package/bin/chat/channels/feishu/FeishuMessageHandler.js.map +1 -1
- package/bin/chat/channels/feishu/FeishuPlatformClient.d.ts +6 -6
- package/bin/chat/channels/feishu/FeishuPlatformClient.d.ts.map +1 -1
- package/bin/chat/channels/feishu/FeishuPlatformClient.js +9 -9
- package/bin/chat/channels/feishu/FeishuPlatformClient.js.map +1 -1
- package/bin/chat/channels/feishu/FeishuPlatformLookup.d.ts +1 -1
- package/bin/chat/channels/feishu/FeishuPlatformLookup.d.ts.map +1 -1
- package/bin/chat/channels/feishu/FeishuPlatformLookup.js +6 -6
- package/bin/chat/channels/feishu/FeishuPlatformLookup.js.map +1 -1
- package/bin/chat/channels/feishu/FeishuPlatformMessaging.d.ts +2 -2
- package/bin/chat/channels/feishu/FeishuPlatformMessaging.d.ts.map +1 -1
- package/bin/chat/channels/feishu/FeishuPlatformMessaging.js +7 -7
- package/bin/chat/channels/feishu/FeishuPlatformMessaging.js.map +1 -1
- package/bin/chat/channels/feishu/InboundAttachment.d.ts +1 -1
- package/bin/chat/channels/feishu/InboundAttachment.d.ts.map +1 -1
- package/bin/chat/channels/feishu/InboundAttachment.js +5 -5
- package/bin/chat/channels/feishu/InboundAttachment.js.map +1 -1
- package/bin/chat/channels/feishu/PostMessage.js +8 -8
- package/bin/chat/channels/feishu/PostMessage.js.map +1 -1
- package/bin/chat/channels/feishu/ReplyContext.d.ts +1 -1
- package/bin/chat/channels/feishu/ReplyContext.d.ts.map +1 -1
- package/bin/chat/channels/feishu/ReplyContext.js +2 -2
- package/bin/chat/channels/feishu/ReplyContext.js.map +1 -1
- package/bin/chat/channels/feishu/Shared.js +3 -3
- package/bin/chat/channels/feishu/Shared.js.map +1 -1
- package/bin/chat/channels/qq/PROMPT.direct.d.ts +1 -1
- package/bin/chat/channels/qq/PROMPT.direct.d.ts.map +1 -1
- package/bin/chat/channels/qq/PROMPT.direct.js +1 -1
- package/bin/chat/channels/qq/PROMPT.direct.js.map +1 -1
- package/bin/chat/channels/qq/QQ.d.ts +3 -3
- package/bin/chat/channels/qq/QQ.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQ.js +20 -20
- package/bin/chat/channels/qq/QQ.js.map +1 -1
- package/bin/chat/channels/qq/QQEventCapture.d.ts +1 -1
- package/bin/chat/channels/qq/QQEventCapture.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQEventCapture.js +3 -3
- package/bin/chat/channels/qq/QQEventCapture.js.map +1 -1
- package/bin/chat/channels/qq/QQGatewayAuth.d.ts +1 -1
- package/bin/chat/channels/qq/QQGatewayAuth.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQGatewayClient.d.ts +2 -2
- package/bin/chat/channels/qq/QQGatewayClient.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQGatewayClient.js +11 -11
- package/bin/chat/channels/qq/QQGatewayClient.js.map +1 -1
- package/bin/chat/channels/qq/QQGatewayConnection.d.ts +1 -1
- package/bin/chat/channels/qq/QQGatewayConnection.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQGatewaySend.d.ts +2 -2
- package/bin/chat/channels/qq/QQGatewaySend.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQGatewaySend.js +3 -3
- package/bin/chat/channels/qq/QQGatewaySend.js.map +1 -1
- package/bin/chat/channels/qq/QQInbound.js +5 -5
- package/bin/chat/channels/qq/QQInbound.js.map +1 -1
- package/bin/chat/channels/qq/QQInboundDedupe.d.ts +2 -2
- package/bin/chat/channels/qq/QQInboundDedupe.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQInboundDedupe.js +5 -5
- package/bin/chat/channels/qq/QQInboundDedupe.js.map +1 -1
- package/bin/chat/channels/qq/QQMessageHandler.d.ts +9 -9
- package/bin/chat/channels/qq/QQMessageHandler.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQMessageHandler.js +34 -34
- package/bin/chat/channels/qq/QQMessageHandler.js.map +1 -1
- package/bin/chat/channels/qq/QQSendSupport.js +2 -2
- package/bin/chat/channels/qq/QQSendSupport.js.map +1 -1
- package/bin/chat/channels/qq/QQSupport.d.ts +5 -5
- package/bin/chat/channels/qq/QQSupport.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQSupport.js +5 -5
- package/bin/chat/channels/qq/QQSupport.js.map +1 -1
- package/bin/chat/channels/qq/types/QqChannel.d.ts +1 -1
- package/bin/chat/channels/qq/types/QqChannel.d.ts.map +1 -1
- package/bin/chat/channels/telegram/ApiClient.d.ts +2 -2
- package/bin/chat/channels/telegram/ApiClient.d.ts.map +1 -1
- package/bin/chat/channels/telegram/ApiClient.js +6 -6
- package/bin/chat/channels/telegram/ApiClient.js.map +1 -1
- package/bin/chat/channels/telegram/Bot.d.ts +4 -4
- package/bin/chat/channels/telegram/Bot.d.ts.map +1 -1
- package/bin/chat/channels/telegram/Bot.js +14 -14
- package/bin/chat/channels/telegram/Bot.js.map +1 -1
- package/bin/chat/channels/telegram/BotInfo.js +1 -1
- package/bin/chat/channels/telegram/BotInfo.js.map +1 -1
- package/bin/chat/channels/telegram/ReplyContext.js +3 -3
- package/bin/chat/channels/telegram/ReplyContext.js.map +1 -1
- package/bin/chat/channels/telegram/Shared.js +3 -3
- package/bin/chat/channels/telegram/Shared.js.map +1 -1
- package/bin/chat/channels/telegram/StateStore.d.ts +1 -1
- package/bin/chat/channels/telegram/StateStore.d.ts.map +1 -1
- package/bin/chat/channels/telegram/StateStore.js +2 -2
- package/bin/chat/channels/telegram/StateStore.js.map +1 -1
- package/bin/chat/channels/telegram/TelegramInbound.d.ts +3 -3
- package/bin/chat/channels/telegram/TelegramInbound.d.ts.map +1 -1
- package/bin/chat/channels/telegram/TelegramInbound.js +4 -4
- package/bin/chat/channels/telegram/TelegramInbound.js.map +1 -1
- package/bin/chat/channels/telegram/TelegramMessageHandler.d.ts +8 -8
- package/bin/chat/channels/telegram/TelegramMessageHandler.d.ts.map +1 -1
- package/bin/chat/channels/telegram/TelegramMessageHandler.js +25 -25
- package/bin/chat/channels/telegram/TelegramMessageHandler.js.map +1 -1
- package/bin/chat/channels/telegram/TelegramPendingUpdates.d.ts +2 -2
- package/bin/chat/channels/telegram/TelegramPendingUpdates.d.ts.map +1 -1
- package/bin/chat/channels/telegram/TelegramPendingUpdates.js +7 -7
- package/bin/chat/channels/telegram/TelegramPendingUpdates.js.map +1 -1
- package/bin/chat/channels/telegram/TelegramPlatformClient.d.ts +4 -4
- package/bin/chat/channels/telegram/TelegramPlatformClient.d.ts.map +1 -1
- package/bin/chat/channels/telegram/TelegramPlatformClient.js +7 -7
- package/bin/chat/channels/telegram/TelegramPlatformClient.js.map +1 -1
- package/bin/chat/config/ChatPluginConfig.d.ts +67 -0
- package/bin/chat/config/ChatPluginConfig.d.ts.map +1 -0
- package/bin/chat/config/ChatPluginConfig.js +237 -0
- package/bin/chat/config/ChatPluginConfig.js.map +1 -0
- package/bin/chat/runtime/ChannelContextStore.d.ts +21 -21
- package/bin/chat/runtime/ChannelContextStore.d.ts.map +1 -1
- package/bin/chat/runtime/ChannelContextStore.js +74 -74
- package/bin/chat/runtime/ChannelContextStore.js.map +1 -1
- package/bin/chat/runtime/ChatActionExecution.d.ts +23 -23
- package/bin/chat/runtime/ChatActionExecution.d.ts.map +1 -1
- package/bin/chat/runtime/ChatActionExecution.js +70 -70
- package/bin/chat/runtime/ChatActionExecution.js.map +1 -1
- package/bin/chat/runtime/ChatActionInput.js +19 -19
- package/bin/chat/runtime/ChatActionInput.js.map +1 -1
- package/bin/chat/runtime/ChatChannelActions.d.ts +4 -4
- package/bin/chat/runtime/ChatChannelActions.d.ts.map +1 -1
- package/bin/chat/runtime/ChatChannelConfig.d.ts +4 -4
- package/bin/chat/runtime/ChatChannelConfig.d.ts.map +1 -1
- package/bin/chat/runtime/ChatChannelConfig.js +9 -9
- package/bin/chat/runtime/ChatChannelConfig.js.map +1 -1
- package/bin/chat/runtime/ChatChannelCore.d.ts +11 -12
- package/bin/chat/runtime/ChatChannelCore.d.ts.map +1 -1
- package/bin/chat/runtime/ChatChannelCore.js +5 -17
- package/bin/chat/runtime/ChatChannelCore.js.map +1 -1
- package/bin/chat/runtime/ChatChannelLifecycle.d.ts +3 -3
- package/bin/chat/runtime/ChatChannelLifecycle.d.ts.map +1 -1
- package/bin/chat/runtime/ChatChannelLifecycle.js +5 -5
- package/bin/chat/runtime/ChatChannelLifecycle.js.map +1 -1
- package/bin/chat/runtime/ChatHistoryStore.d.ts +11 -11
- package/bin/chat/runtime/ChatHistoryStore.d.ts.map +1 -1
- package/bin/chat/runtime/ChatHistoryStore.js +26 -26
- package/bin/chat/runtime/ChatHistoryStore.js.map +1 -1
- package/bin/chat/runtime/ChatIngressStore.d.ts +4 -4
- package/bin/chat/runtime/ChatIngressStore.d.ts.map +1 -1
- package/bin/chat/runtime/ChatIngressStore.js +2 -2
- package/bin/chat/runtime/ChatIngressStore.js.map +1 -1
- package/bin/chat/runtime/ChatMetaStore.d.ts +19 -19
- package/bin/chat/runtime/ChatMetaStore.d.ts.map +1 -1
- package/bin/chat/runtime/ChatMetaStore.js +27 -27
- package/bin/chat/runtime/ChatMetaStore.js.map +1 -1
- package/bin/chat/runtime/ChatPluginActionRegistry.d.ts.map +1 -1
- package/bin/chat/runtime/ChatPluginActionRegistry.js +53 -59
- package/bin/chat/runtime/ChatPluginActionRegistry.js.map +1 -1
- package/bin/chat/runtime/ChatPluginSystem.d.ts +4 -4
- package/bin/chat/runtime/ChatPluginSystem.d.ts.map +1 -1
- package/bin/chat/runtime/ChatPluginSystem.js +5 -5
- package/bin/chat/runtime/ChatPluginSystem.js.map +1 -1
- package/bin/chat/runtime/ChatQueueReplyDispatch.d.ts +6 -6
- package/bin/chat/runtime/ChatQueueReplyDispatch.d.ts.map +1 -1
- package/bin/chat/runtime/ChatQueueReplyDispatch.js +41 -41
- package/bin/chat/runtime/ChatQueueReplyDispatch.js.map +1 -1
- package/bin/chat/runtime/ChatQueueStore.d.ts +3 -3
- package/bin/chat/runtime/ChatQueueStore.d.ts.map +1 -1
- package/bin/chat/runtime/ChatQueueStore.js +2 -2
- package/bin/chat/runtime/ChatQueueStore.js.map +1 -1
- package/bin/chat/runtime/ChatQueueWorker.d.ts +2 -2
- package/bin/chat/runtime/ChatQueueWorker.d.ts.map +1 -1
- package/bin/chat/runtime/ChatQueueWorker.js +30 -32
- package/bin/chat/runtime/ChatQueueWorker.js.map +1 -1
- package/bin/chat/runtime/ChatQueueWorkerSupport.d.ts +1 -1
- package/bin/chat/runtime/ChatQueueWorkerSupport.js +15 -15
- package/bin/chat/runtime/ChatQueueWorkerSupport.js.map +1 -1
- package/bin/chat/runtime/ChatSendActionInput.js +51 -51
- package/bin/chat/runtime/ChatSendActionInput.js.map +1 -1
- package/bin/chat/runtime/ChatSendMetadata.d.ts +1 -1
- package/bin/chat/runtime/ChatSendMetadata.js +12 -12
- package/bin/chat/runtime/ChatSendMetadata.js.map +1 -1
- package/bin/chat/runtime/ChatSendRegistry.d.ts +1 -1
- package/bin/chat/runtime/ChatSessionDelete.d.ts +7 -7
- package/bin/chat/runtime/ChatSessionDelete.d.ts.map +1 -1
- package/bin/chat/runtime/ChatSessionDelete.js +15 -15
- package/bin/chat/runtime/ChatSessionDelete.js.map +1 -1
- package/bin/chat/runtime/ChatStorage.d.ts +1 -1
- package/bin/chat/runtime/ChatStorage.js +3 -3
- package/bin/chat/runtime/ChatStorage.js.map +1 -1
- package/bin/chat/runtime/ChatkeySend.d.ts +21 -21
- package/bin/chat/runtime/ChatkeySend.d.ts.map +1 -1
- package/bin/chat/runtime/ChatkeySend.js +33 -33
- package/bin/chat/runtime/ChatkeySend.js.map +1 -1
- package/bin/chat/runtime/DirectDispatchParser.d.ts +2 -2
- package/bin/chat/runtime/DirectDispatchParser.js +20 -20
- package/bin/chat/runtime/DirectDispatchParser.js.map +1 -1
- package/bin/chat/runtime/EnqueueDispatch.d.ts +3 -3
- package/bin/chat/runtime/EnqueueDispatch.d.ts.map +1 -1
- package/bin/chat/runtime/InboundAugment.d.ts +3 -3
- package/bin/chat/runtime/InboundAugment.d.ts.map +1 -1
- package/bin/chat/runtime/InboundAugment.js +6 -6
- package/bin/chat/runtime/InboundAugment.js.map +1 -1
- package/bin/chat/runtime/QueuedUserMessage.js +5 -5
- package/bin/chat/runtime/QueuedUserMessage.js.map +1 -1
- package/bin/chat/runtime/ReplyContextFormatter.js +7 -7
- package/bin/chat/runtime/ReplyContextFormatter.js.map +1 -1
- package/bin/chat/runtime/ReplyDispatch.d.ts +7 -7
- package/bin/chat/runtime/ReplyDispatch.d.ts.map +1 -1
- package/bin/chat/runtime/ReplyDispatch.js +3 -3
- package/bin/chat/runtime/ReplyDispatch.js.map +1 -1
- package/bin/chat/runtime/SystemPrompt.d.ts +4 -4
- package/bin/chat/runtime/SystemPrompt.d.ts.map +1 -1
- package/bin/chat/runtime/SystemPrompt.js +10 -10
- package/bin/chat/runtime/SystemPrompt.js.map +1 -1
- package/bin/chat/types/ChannelContext.d.ts +11 -11
- package/bin/chat/types/ChannelContext.d.ts.map +1 -1
- package/bin/chat/types/ChannelContext.js +2 -2
- package/bin/chat/types/ChatCommand.d.ts +31 -31
- package/bin/chat/types/ChatCommand.d.ts.map +1 -1
- package/bin/chat/types/ChatDispatcher.d.ts +3 -3
- package/bin/chat/types/ChatDispatcher.d.ts.map +1 -1
- package/bin/chat/types/ChatHistory.d.ts +2 -2
- package/bin/chat/types/ChatHistory.d.ts.map +1 -1
- package/bin/chat/types/ChatMeta.d.ts +4 -4
- package/bin/chat/types/ChatMeta.d.ts.map +1 -1
- package/bin/chat/types/ChatMeta.js +1 -1
- package/bin/chat/types/ChatPlugin.d.ts +9 -9
- package/bin/chat/types/ChatPlugin.d.ts.map +1 -1
- package/bin/chat/types/ChatPluginActionPayload.d.ts +13 -13
- package/bin/chat/types/ChatPluginActionPayload.d.ts.map +1 -1
- package/bin/chat/types/ChatPluginOptions.d.ts +6 -6
- package/bin/chat/types/ChatPluginOptions.d.ts.map +1 -1
- package/bin/chat/types/ChatPluginResource.d.ts +68 -0
- package/bin/chat/types/ChatPluginResource.d.ts.map +1 -0
- package/bin/chat/types/ChatPluginResource.js +10 -0
- package/bin/chat/types/ChatPluginResource.js.map +1 -0
- package/bin/chat/types/ChatPromptContext.d.ts +8 -8
- package/bin/chat/types/ChatPromptContext.d.ts.map +1 -1
- package/bin/chat/types/ChatQueue.d.ts +2 -2
- package/bin/chat/types/ChatQueue.d.ts.map +1 -1
- package/bin/chat/types/ChatQueueWorker.d.ts +3 -3
- package/bin/chat/types/ChatQueueWorker.d.ts.map +1 -1
- package/bin/chat/types/ChatRuntimeAccount.d.ts +39 -0
- package/bin/chat/types/ChatRuntimeAccount.d.ts.map +1 -0
- package/bin/chat/types/ChatRuntimeAccount.js +10 -0
- package/bin/chat/types/ChatRuntimeAccount.js.map +1 -0
- package/bin/chat/types/DirectDispatch.d.ts +13 -13
- package/bin/chat/types/DirectDispatch.d.ts.map +1 -1
- package/bin/chat/types/DirectDispatch.js +1 -1
- package/bin/chat/types/FeishuInboundAttachment.d.ts +1 -1
- package/bin/chat/types/FeishuInboundAttachment.d.ts.map +1 -1
- package/bin/chat/types/QqInboundDedupe.d.ts +1 -1
- package/bin/chat/types/QqInboundDedupe.d.ts.map +1 -1
- package/bin/chat/types/ReplyContext.d.ts +1 -1
- package/bin/chat/types/ReplyContext.d.ts.map +1 -1
- package/bin/chat.d.ts +4 -3
- package/bin/chat.d.ts.map +1 -1
- package/bin/chat.js +2 -2
- package/bin/chat.js.map +1 -1
- package/bin/contact/Action.d.ts +11 -11
- package/bin/contact/Action.d.ts.map +1 -1
- package/bin/contact/Action.js +27 -27
- package/bin/contact/Action.js.map +1 -1
- package/bin/contact/ContactPlugin.js +33 -33
- package/bin/contact/ContactPlugin.js.map +1 -1
- package/bin/contact/runtime/ChatRuntime.d.ts +2 -2
- package/bin/contact/runtime/ChatRuntime.d.ts.map +1 -1
- package/bin/contact/runtime/ChatRuntime.js +8 -23
- package/bin/contact/runtime/ChatRuntime.js.map +1 -1
- package/bin/contact/runtime/ContactStore.d.ts +8 -8
- package/bin/contact/runtime/ContactStore.d.ts.map +1 -1
- package/bin/contact/runtime/ContactStore.js +24 -24
- package/bin/contact/runtime/ContactStore.js.map +1 -1
- package/bin/contact/runtime/InboxStore.d.ts +6 -6
- package/bin/contact/runtime/InboxStore.d.ts.map +1 -1
- package/bin/contact/runtime/InboxStore.js +16 -16
- package/bin/contact/runtime/InboxStore.js.map +1 -1
- package/bin/contact/runtime/LinkApproval.js +17 -17
- package/bin/contact/runtime/LinkApproval.js.map +1 -1
- package/bin/contact/runtime/LinkCode.d.ts +1 -1
- package/bin/contact/runtime/LinkCode.d.ts.map +1 -1
- package/bin/contact/runtime/LinkCode.js +6 -6
- package/bin/contact/runtime/LinkCode.js.map +1 -1
- package/bin/contact/runtime/LinkStore.d.ts +2 -2
- package/bin/contact/runtime/LinkStore.d.ts.map +1 -1
- package/bin/contact/runtime/LinkStore.js +7 -7
- package/bin/contact/runtime/LinkStore.js.map +1 -1
- package/bin/contact/runtime/Paths.d.ts +14 -14
- package/bin/contact/runtime/Paths.d.ts.map +1 -1
- package/bin/contact/runtime/Paths.js +28 -28
- package/bin/contact/runtime/Paths.js.map +1 -1
- package/bin/contact/runtime/RemoteClient.d.ts +1 -1
- package/bin/contact/runtime/RemoteClient.js +18 -18
- package/bin/contact/runtime/RemoteClient.js.map +1 -1
- package/bin/contact/runtime/ShareBundle.d.ts +3 -3
- package/bin/contact/runtime/ShareBundle.d.ts.map +1 -1
- package/bin/contact/runtime/ShareBundle.js +5 -5
- package/bin/contact/runtime/ShareBundle.js.map +1 -1
- package/bin/contact/types/Contact.d.ts +2 -2
- package/bin/contact/types/Contact.d.ts.map +1 -1
- package/bin/contact/types/ContactApproval.d.ts +2 -2
- package/bin/contact/types/ContactApproval.d.ts.map +1 -1
- package/bin/contact/types/ContactChat.d.ts +1 -1
- package/bin/contact/types/ContactChat.d.ts.map +1 -1
- package/bin/contact/types/ContactLink.d.ts +4 -4
- package/bin/contact/types/ContactLink.d.ts.map +1 -1
- package/bin/image/ImagePlugin.d.ts +3 -3
- package/bin/image/ImagePlugin.d.ts.map +1 -1
- package/bin/image/ImagePlugin.js +25 -10
- package/bin/image/ImagePlugin.js.map +1 -1
- package/bin/image/types/ImagePlugin.d.ts +3 -3
- package/bin/image/types/ImagePlugin.d.ts.map +1 -1
- package/bin/image/types/ImagePlugin.js +1 -1
- package/bin/memory/Action.d.ts +7 -7
- package/bin/memory/Action.d.ts.map +1 -1
- package/bin/memory/Action.js +11 -11
- package/bin/memory/Action.js.map +1 -1
- package/bin/memory/MemoryPlugin.d.ts +3 -3
- package/bin/memory/MemoryPlugin.d.ts.map +1 -1
- package/bin/memory/MemoryPlugin.js +21 -21
- package/bin/memory/MemoryPlugin.js.map +1 -1
- package/bin/memory/runtime/Search.d.ts +3 -3
- package/bin/memory/runtime/Search.d.ts.map +1 -1
- package/bin/memory/runtime/Search.js +2 -2
- package/bin/memory/runtime/Search.js.map +1 -1
- package/bin/memory/runtime/Store.d.ts +2 -2
- package/bin/memory/runtime/Store.d.ts.map +1 -1
- package/bin/memory/runtime/Store.js +1 -1
- package/bin/memory/runtime/Store.js.map +1 -1
- package/bin/memory/runtime/SystemProvider.d.ts +3 -3
- package/bin/memory/runtime/SystemProvider.d.ts.map +1 -1
- package/bin/memory/runtime/SystemProvider.js +1 -1
- package/bin/memory/runtime/SystemProvider.js.map +1 -1
- package/bin/memory/runtime/Writer.d.ts +8 -8
- package/bin/memory/runtime/Writer.d.ts.map +1 -1
- package/bin/memory/runtime/Writer.js +14 -14
- package/bin/memory/runtime/Writer.js.map +1 -1
- package/bin/memory/types/Memory.d.ts +3 -3
- package/bin/memory/types/Memory.d.ts.map +1 -1
- package/bin/skill/Action.d.ts +4 -4
- package/bin/skill/Action.d.ts.map +1 -1
- package/bin/skill/Action.js +9 -9
- package/bin/skill/Action.js.map +1 -1
- package/bin/skill/Plugin.js +16 -16
- package/bin/skill/Plugin.js.map +1 -1
- package/bin/skill/runtime/Discovery.d.ts +2 -2
- package/bin/skill/runtime/Discovery.d.ts.map +1 -1
- package/bin/skill/runtime/Discovery.js +3 -3
- package/bin/skill/runtime/Discovery.js.map +1 -1
- package/bin/skill/runtime/Paths.d.ts +1 -1
- package/bin/skill/runtime/Paths.d.ts.map +1 -1
- package/bin/skill/runtime/Paths.js +6 -6
- package/bin/skill/runtime/Paths.js.map +1 -1
- package/bin/skill/runtime/Store.d.ts +3 -3
- package/bin/skill/runtime/Store.d.ts.map +1 -1
- package/bin/skill/runtime/Store.js +19 -19
- package/bin/skill/runtime/Store.js.map +1 -1
- package/bin/skill/runtime/SystemProvider.d.ts +2 -2
- package/bin/skill/runtime/SystemProvider.d.ts.map +1 -1
- package/bin/skill/runtime/SystemProvider.js +4 -4
- package/bin/skill/runtime/SystemProvider.js.map +1 -1
- package/bin/skill/runtime/Types.d.ts +3 -3
- package/bin/skill/runtime/Types.d.ts.map +1 -1
- package/bin/sound/Plugin.d.ts +5 -5
- package/bin/sound/Plugin.d.ts.map +1 -1
- package/bin/sound/Plugin.js +23 -11
- package/bin/sound/Plugin.js.map +1 -1
- package/bin/task/Action.d.ts +10 -10
- package/bin/task/Action.d.ts.map +1 -1
- package/bin/task/Action.js +31 -31
- package/bin/task/Action.js.map +1 -1
- package/bin/task/PROMPT.d.ts +1 -1
- package/bin/task/PROMPT.d.ts.map +1 -1
- package/bin/task/PROMPT.js +1 -1
- package/bin/task/PROMPT.js.map +1 -1
- package/bin/task/Scheduler.d.ts +2 -2
- package/bin/task/Scheduler.d.ts.map +1 -1
- package/bin/task/Scheduler.js +8 -8
- package/bin/task/Scheduler.js.map +1 -1
- package/bin/task/TaskPlugin.d.ts +3 -3
- package/bin/task/TaskPlugin.d.ts.map +1 -1
- package/bin/task/TaskPlugin.js +23 -20
- package/bin/task/TaskPlugin.js.map +1 -1
- package/bin/task/runtime/Model.d.ts +2 -2
- package/bin/task/runtime/Model.d.ts.map +1 -1
- package/bin/task/runtime/Model.js +11 -11
- package/bin/task/runtime/Model.js.map +1 -1
- package/bin/task/runtime/Paths.d.ts +6 -6
- package/bin/task/runtime/Paths.d.ts.map +1 -1
- package/bin/task/runtime/Paths.js +11 -11
- package/bin/task/runtime/Paths.js.map +1 -1
- package/bin/task/runtime/Runner.d.ts +4 -4
- package/bin/task/runtime/Runner.d.ts.map +1 -1
- package/bin/task/runtime/Runner.js +17 -17
- package/bin/task/runtime/Runner.js.map +1 -1
- package/bin/task/runtime/Store.d.ts +7 -7
- package/bin/task/runtime/Store.d.ts.map +1 -1
- package/bin/task/runtime/Store.js +15 -15
- package/bin/task/runtime/Store.js.map +1 -1
- package/bin/task/runtime/TaskActionExecution.d.ts +12 -12
- package/bin/task/runtime/TaskActionExecution.d.ts.map +1 -1
- package/bin/task/runtime/TaskActionExecution.js +7 -7
- package/bin/task/runtime/TaskActionExecution.js.map +1 -1
- package/bin/task/runtime/TaskActionInput.js +10 -10
- package/bin/task/runtime/TaskActionInput.js.map +1 -1
- package/bin/task/runtime/TaskPluginActionRegistry.js +26 -26
- package/bin/task/runtime/TaskPluginActionRegistry.js.map +1 -1
- package/bin/task/runtime/TaskRunArtifacts.js +4 -4
- package/bin/task/runtime/TaskRunArtifacts.js.map +1 -1
- package/bin/task/runtime/TaskRunChatDispatch.d.ts +2 -2
- package/bin/task/runtime/TaskRunChatDispatch.d.ts.map +1 -1
- package/bin/task/runtime/TaskRunChatDispatch.js +7 -7
- package/bin/task/runtime/TaskRunChatDispatch.js.map +1 -1
- package/bin/task/runtime/TaskRunnerProgress.js +1 -1
- package/bin/task/runtime/TaskRunnerProgress.js.map +1 -1
- package/bin/task/runtime/TaskRunnerRound.d.ts +7 -7
- package/bin/task/runtime/TaskRunnerRound.d.ts.map +1 -1
- package/bin/task/runtime/TaskRunnerRound.js +34 -38
- package/bin/task/runtime/TaskRunnerRound.js.map +1 -1
- package/bin/task/runtime/TaskRunnerScript.d.ts +4 -4
- package/bin/task/runtime/TaskRunnerScript.d.ts.map +1 -1
- package/bin/task/runtime/TaskRunnerScript.js +1 -1
- package/bin/task/runtime/TaskRunnerScript.js.map +1 -1
- package/bin/task/runtime/TaskRunnerSession.d.ts +8 -8
- package/bin/task/runtime/TaskRunnerSession.d.ts.map +1 -1
- package/bin/task/runtime/TaskRunnerSession.js +52 -39
- package/bin/task/runtime/TaskRunnerSession.js.map +1 -1
- package/bin/task/runtime/TaskRunnerTypes.d.ts +5 -5
- package/bin/task/runtime/TaskRunnerTypes.d.ts.map +1 -1
- package/bin/task/types/Task.d.ts +4 -4
- package/bin/task/types/Task.d.ts.map +1 -1
- package/bin/task/types/TaskCommand.d.ts +3 -3
- package/bin/task/types/TaskCommand.d.ts.map +1 -1
- package/bin/web/Plugin.d.ts +2 -2
- package/bin/web/Plugin.d.ts.map +1 -1
- package/bin/web/Plugin.js +3 -3
- package/bin/web/Plugin.js.map +1 -1
- package/bin/workboard/Plugin.d.ts.map +1 -1
- package/bin/workboard/Plugin.js +6 -7
- package/bin/workboard/Plugin.js.map +1 -1
- package/bin/workboard/runtime/Collector.d.ts +2 -2
- package/bin/workboard/runtime/Collector.d.ts.map +1 -1
- package/bin/workboard/runtime/Collector.js +4 -4
- package/bin/workboard/runtime/Collector.js.map +1 -1
- package/bin/workboard/runtime/Normalizer.d.ts +3 -3
- package/bin/workboard/runtime/Normalizer.d.ts.map +1 -1
- package/bin/workboard/runtime/Normalizer.js +11 -11
- package/bin/workboard/runtime/Normalizer.js.map +1 -1
- package/bin/workboard/runtime/SessionSummary.d.ts +5 -5
- package/bin/workboard/runtime/SessionSummary.d.ts.map +1 -1
- package/bin/workboard/runtime/SessionSummary.js +4 -4
- package/bin/workboard/runtime/SessionSummary.js.map +1 -1
- package/bin/workboard/runtime/Store.d.ts +5 -5
- package/bin/workboard/runtime/Store.d.ts.map +1 -1
- package/bin/workboard/runtime/Store.js.map +1 -1
- package/bin/workboard/types/Workboard.d.ts +2 -2
- package/bin/workboard/types/Workboard.d.ts.map +1 -1
- package/bin/workboard/types/Workboard.js +1 -1
- package/package.json +3 -3
- package/scripts/chat-access.test.mjs +2 -2
- package/scripts/chat-channel-config.test.mjs +25 -3
- package/scripts/chat-storage.test.mjs +7 -7
- package/scripts/skill-plugin.test.mjs +4 -4
- package/scripts/sound-plugin.test.mjs +12 -8
- package/scripts/web-plugin.test.mjs +4 -4
- package/src/chat/Action.ts +154 -153
- package/src/chat/ChatPlugin.ts +12 -12
- package/src/chat/Index.ts +12 -0
- package/src/chat/PROMPT.direct.ts +1 -1
- package/src/chat/access/ChatAccessActions.ts +6 -6
- package/src/chat/access/ChatAccessRuntime.ts +5 -5
- package/src/chat/access/ChatAccessStore.ts +5 -5
- package/src/chat/channels/BaseChatChannel.ts +32 -32
- package/src/chat/channels/BaseChatChannelQueue.ts +38 -38
- package/src/chat/channels/BaseChatChannelSupport.ts +25 -25
- package/src/chat/channels/RuntimeChannel.ts +53 -74
- package/src/chat/channels/feishu/Feishu.ts +35 -35
- package/src/chat/channels/feishu/FeishuInbound.ts +3 -3
- package/src/chat/channels/feishu/FeishuMessageHandler.ts +29 -29
- package/src/chat/channels/feishu/FeishuPlatformClient.ts +15 -15
- package/src/chat/channels/feishu/FeishuPlatformLookup.ts +7 -7
- package/src/chat/channels/feishu/FeishuPlatformMessaging.ts +7 -7
- package/src/chat/channels/feishu/InboundAttachment.ts +6 -6
- package/src/chat/channels/feishu/PostMessage.ts +8 -8
- package/src/chat/channels/feishu/ReplyContext.ts +3 -3
- package/src/chat/channels/feishu/Shared.ts +3 -3
- package/src/chat/channels/qq/PROMPT.direct.ts +1 -1
- package/src/chat/channels/qq/QQ.ts +26 -26
- package/src/chat/channels/qq/QQEventCapture.ts +3 -3
- package/src/chat/channels/qq/QQGatewayAuth.ts +1 -1
- package/src/chat/channels/qq/QQGatewayClient.ts +12 -12
- package/src/chat/channels/qq/QQGatewayConnection.ts +1 -1
- package/src/chat/channels/qq/QQGatewaySend.ts +6 -6
- package/src/chat/channels/qq/QQInbound.ts +5 -5
- package/src/chat/channels/qq/QQInboundDedupe.ts +6 -6
- package/src/chat/channels/qq/QQMessageHandler.ts +43 -43
- package/src/chat/channels/qq/QQSendSupport.ts +2 -2
- package/src/chat/channels/qq/QQSupport.ts +10 -10
- package/src/chat/channels/qq/types/QqChannel.ts +1 -1
- package/src/chat/channels/telegram/ApiClient.ts +7 -7
- package/src/chat/channels/telegram/Bot.ts +17 -17
- package/src/chat/channels/telegram/BotInfo.ts +1 -1
- package/src/chat/channels/telegram/ReplyContext.ts +3 -3
- package/src/chat/channels/telegram/Shared.ts +3 -3
- package/src/chat/channels/telegram/StateStore.ts +2 -2
- package/src/chat/channels/telegram/TelegramInbound.ts +4 -4
- package/src/chat/channels/telegram/TelegramMessageHandler.ts +35 -35
- package/src/chat/channels/telegram/TelegramPendingUpdates.ts +9 -9
- package/src/chat/channels/telegram/TelegramPlatformClient.ts +11 -11
- package/src/chat/config/ChatPluginConfig.ts +266 -0
- package/src/chat/runtime/ChannelContextStore.ts +88 -88
- package/src/chat/runtime/ChatActionExecution.ts +87 -87
- package/src/chat/runtime/ChatActionInput.ts +19 -19
- package/src/chat/runtime/ChatChannelActions.ts +4 -4
- package/src/chat/runtime/ChatChannelConfig.ts +14 -14
- package/src/chat/runtime/ChatChannelCore.ts +17 -26
- package/src/chat/runtime/ChatChannelLifecycle.ts +12 -12
- package/src/chat/runtime/ChatHistoryStore.ts +39 -39
- package/src/chat/runtime/ChatIngressStore.ts +6 -6
- package/src/chat/runtime/ChatMetaStore.ts +37 -37
- package/src/chat/runtime/ChatPluginActionRegistry.ts +56 -62
- package/src/chat/runtime/ChatPluginSystem.ts +9 -9
- package/src/chat/runtime/ChatQueueReplyDispatch.ts +47 -47
- package/src/chat/runtime/ChatQueueStore.ts +4 -4
- package/src/chat/runtime/ChatQueueWorker.ts +38 -44
- package/src/chat/runtime/ChatQueueWorkerSupport.ts +18 -18
- package/src/chat/runtime/ChatSendActionInput.ts +53 -53
- package/src/chat/runtime/ChatSendMetadata.ts +15 -15
- package/src/chat/runtime/ChatSendRegistry.ts +1 -1
- package/src/chat/runtime/ChatSessionDelete.ts +19 -19
- package/src/chat/runtime/ChatStorage.ts +3 -3
- package/src/chat/runtime/ChatkeySend.ts +43 -43
- package/src/chat/runtime/DirectDispatchParser.ts +21 -21
- package/src/chat/runtime/EnqueueDispatch.ts +3 -3
- package/src/chat/runtime/InboundAugment.ts +8 -8
- package/src/chat/runtime/QueuedUserMessage.ts +6 -6
- package/src/chat/runtime/ReplyContextFormatter.ts +6 -6
- package/src/chat/runtime/ReplyDispatch.ts +9 -9
- package/src/chat/runtime/SystemPrompt.ts +14 -14
- package/src/chat/types/ChannelContext.ts +11 -11
- package/src/chat/types/ChatCommand.ts +31 -31
- package/src/chat/types/ChatDispatcher.ts +3 -3
- package/src/chat/types/ChatHistory.ts +2 -2
- package/src/chat/types/ChatMeta.ts +4 -4
- package/src/chat/types/ChatPlugin.ts +9 -9
- package/src/chat/types/ChatPluginActionPayload.ts +13 -13
- package/src/chat/types/ChatPluginOptions.ts +6 -6
- package/src/chat/types/ChatPluginResource.ts +95 -0
- package/src/chat/types/ChatPromptContext.ts +8 -8
- package/src/chat/types/ChatQueue.ts +2 -2
- package/src/chat/types/ChatQueueWorker.ts +3 -3
- package/src/chat/types/ChatRuntimeAccount.ts +52 -0
- package/src/chat/types/DirectDispatch.ts +13 -13
- package/src/chat/types/FeishuInboundAttachment.ts +1 -1
- package/src/chat/types/QqInboundDedupe.ts +1 -1
- package/src/chat/types/ReplyContext.ts +1 -1
- package/src/chat.ts +13 -3
- package/src/contact/Action.ts +40 -40
- package/src/contact/ContactPlugin.ts +49 -49
- package/src/contact/runtime/ChatRuntime.ts +10 -26
- package/src/contact/runtime/ContactStore.ts +24 -24
- package/src/contact/runtime/InboxStore.ts +16 -16
- package/src/contact/runtime/LinkApproval.ts +19 -19
- package/src/contact/runtime/LinkCode.ts +7 -7
- package/src/contact/runtime/LinkStore.ts +7 -7
- package/src/contact/runtime/Paths.ts +28 -28
- package/src/contact/runtime/RemoteClient.ts +19 -19
- package/src/contact/runtime/ShareBundle.ts +8 -8
- package/src/contact/types/Contact.ts +2 -2
- package/src/contact/types/ContactApproval.ts +2 -2
- package/src/contact/types/ContactChat.ts +1 -1
- package/src/contact/types/ContactLink.ts +4 -4
- package/src/image/ImagePlugin.ts +32 -16
- package/src/image/types/ImagePlugin.ts +3 -3
- package/src/memory/Action.ts +18 -18
- package/src/memory/MemoryPlugin.ts +25 -25
- package/src/memory/runtime/Search.ts +6 -6
- package/src/memory/runtime/Store.ts +3 -3
- package/src/memory/runtime/SystemProvider.ts +4 -4
- package/src/memory/runtime/Writer.ts +24 -24
- package/src/memory/types/Memory.ts +3 -3
- package/src/skill/Action.ts +10 -10
- package/src/skill/Plugin.ts +16 -16
- package/src/skill/runtime/Discovery.ts +3 -3
- package/src/skill/runtime/Paths.ts +6 -6
- package/src/skill/runtime/Store.ts +19 -19
- package/src/skill/runtime/SystemProvider.ts +5 -5
- package/src/skill/runtime/Types.ts +3 -3
- package/src/sound/Plugin.ts +31 -18
- package/src/task/Action.ts +40 -40
- package/src/task/PROMPT.ts +1 -1
- package/src/task/Scheduler.ts +10 -10
- package/src/task/TaskPlugin.ts +32 -30
- package/src/task/runtime/Model.ts +12 -12
- package/src/task/runtime/Paths.ts +11 -11
- package/src/task/runtime/Runner.ts +21 -21
- package/src/task/runtime/Store.ts +21 -21
- package/src/task/runtime/TaskActionExecution.ts +19 -19
- package/src/task/runtime/TaskActionInput.ts +10 -10
- package/src/task/runtime/TaskPluginActionRegistry.ts +27 -27
- package/src/task/runtime/TaskRunArtifacts.ts +4 -4
- package/src/task/runtime/TaskRunChatDispatch.ts +9 -9
- package/src/task/runtime/TaskRunnerProgress.ts +1 -1
- package/src/task/runtime/TaskRunnerRound.ts +47 -42
- package/src/task/runtime/TaskRunnerScript.ts +5 -5
- package/src/task/runtime/TaskRunnerSession.ts +58 -46
- package/src/task/runtime/TaskRunnerTypes.ts +5 -5
- package/src/task/types/Task.ts +4 -4
- package/src/task/types/TaskCommand.ts +3 -3
- package/src/web/Plugin.ts +5 -5
- package/src/workboard/Plugin.ts +8 -9
- package/src/workboard/runtime/Collector.ts +6 -6
- package/src/workboard/runtime/Normalizer.ts +14 -14
- package/src/workboard/runtime/SessionSummary.ts +9 -9
- package/src/workboard/runtime/Store.ts +6 -6
- package/src/workboard/types/Workboard.ts +2 -2
- package/bin/chat/accounts/ChannelAccountManager.d.ts +0 -61
- package/bin/chat/accounts/ChannelAccountManager.d.ts.map +0 -1
- package/bin/chat/accounts/ChannelAccountManager.js +0 -264
- package/bin/chat/accounts/ChannelAccountManager.js.map +0 -1
- package/bin/chat/accounts/Crypto.d.ts +0 -20
- package/bin/chat/accounts/Crypto.d.ts.map +0 -1
- package/bin/chat/accounts/Crypto.js +0 -75
- package/bin/chat/accounts/Crypto.js.map +0 -1
- package/bin/chat/accounts/Store.d.ts +0 -38
- package/bin/chat/accounts/Store.d.ts.map +0 -1
- package/bin/chat/accounts/Store.js +0 -220
- package/bin/chat/accounts/Store.js.map +0 -1
- package/bin/chat/channels/Configuration.d.ts +0 -27
- package/bin/chat/channels/Configuration.d.ts.map +0 -1
- package/bin/chat/channels/Configuration.js +0 -19
- package/bin/chat/channels/Configuration.js.map +0 -1
- package/bin/chat/channels/ConfigurationRegistry.d.ts +0 -18
- package/bin/chat/channels/ConfigurationRegistry.d.ts.map +0 -1
- package/bin/chat/channels/ConfigurationRegistry.js +0 -31
- package/bin/chat/channels/ConfigurationRegistry.js.map +0 -1
- package/bin/chat/channels/feishu/Configuration.d.ts +0 -17
- package/bin/chat/channels/feishu/Configuration.d.ts.map +0 -1
- package/bin/chat/channels/feishu/Configuration.js +0 -59
- package/bin/chat/channels/feishu/Configuration.js.map +0 -1
- package/bin/chat/channels/qq/Configuration.d.ts +0 -17
- package/bin/chat/channels/qq/Configuration.d.ts.map +0 -1
- package/bin/chat/channels/qq/Configuration.js +0 -59
- package/bin/chat/channels/qq/Configuration.js.map +0 -1
- package/bin/chat/channels/telegram/Configuration.d.ts +0 -17
- package/bin/chat/channels/telegram/Configuration.d.ts.map +0 -1
- package/bin/chat/channels/telegram/Configuration.js +0 -59
- package/bin/chat/channels/telegram/Configuration.js.map +0 -1
- package/bin/chat/types/ChannelAccount.d.ts +0 -226
- package/bin/chat/types/ChannelAccount.d.ts.map +0 -1
- package/bin/chat/types/ChannelAccount.js +0 -9
- package/bin/chat/types/ChannelAccount.js.map +0 -1
- package/bin/chat/types/ChannelConfiguration.d.ts +0 -146
- package/bin/chat/types/ChannelConfiguration.d.ts.map +0 -1
- package/bin/chat/types/ChannelConfiguration.js +0 -9
- package/bin/chat/types/ChannelConfiguration.js.map +0 -1
- package/src/chat/accounts/ChannelAccountManager.ts +0 -314
- package/src/chat/accounts/Crypto.ts +0 -83
- package/src/chat/accounts/Store.ts +0 -287
- package/src/chat/channels/Configuration.ts +0 -35
- package/src/chat/channels/ConfigurationRegistry.ts +0 -43
- package/src/chat/channels/feishu/Configuration.ts +0 -65
- package/src/chat/channels/qq/Configuration.ts +0 -64
- package/src/chat/channels/telegram/Configuration.ts +0 -65
- package/src/chat/types/ChannelAccount.ts +0 -232
- package/src/chat/types/ChannelConfiguration.ts +0 -160
package/src/chat.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* `@downcity/plugins/chat` 独立公开入口。
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
|
-
* - 汇总 ChatPlugin
|
|
5
|
+
* - 汇总 ChatPlugin、Resource Schema、运行渠道与 Chat Access 公开能力。
|
|
6
6
|
* - 不加载其他内建 plugin 的入口模块。
|
|
7
7
|
*/
|
|
8
8
|
|
|
@@ -12,7 +12,6 @@ export {
|
|
|
12
12
|
QqChannel,
|
|
13
13
|
TelegramChannel,
|
|
14
14
|
} from "./chat/channels/RuntimeChannel.js";
|
|
15
|
-
export { ChatChannelAccountManager } from "./chat/accounts/ChannelAccountManager.js";
|
|
16
15
|
export {
|
|
17
16
|
ChatAccessService,
|
|
18
17
|
is_chat_access_channel,
|
|
@@ -22,8 +21,17 @@ export {
|
|
|
22
21
|
export { get_chat_access_db_path } from "./chat/access/ChatAccessStore.js";
|
|
23
22
|
export { CHAT_ACCESS_ACTIONS } from "./chat/types/ChatAccess.js";
|
|
24
23
|
export { clean_chat_storage } from "./chat/runtime/ChatStorage.js";
|
|
24
|
+
export {
|
|
25
|
+
CHAT_PLUGIN_CONFIG_JSON_SCHEMA,
|
|
26
|
+
CHAT_PLUGIN_RESOURCE_JSON_SCHEMA,
|
|
27
|
+
chat_plugin_config_schema,
|
|
28
|
+
chat_plugin_resource_schema,
|
|
29
|
+
get_chat_plugin_resource_json_schema,
|
|
30
|
+
parse_chat_plugin_config,
|
|
31
|
+
parse_chat_plugin_resource,
|
|
32
|
+
resolve_chat_plugin_resource,
|
|
33
|
+
} from "./chat/config/ChatPluginConfig.js";
|
|
25
34
|
|
|
26
|
-
export type { ChatChannelAccountListItem } from "./chat/types/ChannelAccount.js";
|
|
27
35
|
export type {
|
|
28
36
|
ChatStorageCleanInput,
|
|
29
37
|
ChatStorageCleanResult,
|
|
@@ -39,6 +47,8 @@ export type {
|
|
|
39
47
|
ChatChannel,
|
|
40
48
|
ChatPluginOptions,
|
|
41
49
|
} from "./chat/types/ChatPluginOptions.js";
|
|
50
|
+
export type { ChatPluginConfig } from "./chat/config/ChatPluginConfig.js";
|
|
51
|
+
export type { ChatPluginResource } from "./chat/types/ChatPluginResource.js";
|
|
42
52
|
export type {
|
|
43
53
|
ApproveChatAccessRequestInput,
|
|
44
54
|
ChatAccessDecision,
|
package/src/contact/Action.ts
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
* - 业务动作通过 handlers 注入,保持 `ContactPlugin` 类本身更薄。
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type {
|
|
9
|
+
import type { PluginContext } from "@downcity/agent";
|
|
10
10
|
import type { JsonObject, JsonValue } from "@downcity/agent";
|
|
11
11
|
import type { PluginActions } from "@downcity/agent";
|
|
12
|
-
import type {
|
|
13
|
-
import {
|
|
12
|
+
import type { PluginExecutionContext } from "@downcity/agent";
|
|
13
|
+
import { create_action } from "@downcity/agent";
|
|
14
14
|
import { z } from "zod";
|
|
15
15
|
import type {
|
|
16
16
|
ContactApproveCommandPayload,
|
|
@@ -46,55 +46,55 @@ export type ContactActionHandlers = {
|
|
|
46
46
|
* 生成一次性联系码。
|
|
47
47
|
*/
|
|
48
48
|
link: (
|
|
49
|
-
context:
|
|
49
|
+
context: PluginContext,
|
|
50
50
|
payload: ContactLinkCommandPayload,
|
|
51
|
-
|
|
51
|
+
execution_context?: PluginExecutionContext,
|
|
52
52
|
) => Promise<JsonValue>;
|
|
53
53
|
/**
|
|
54
54
|
* 使用联系码建立 contact。
|
|
55
55
|
*/
|
|
56
56
|
approve: (
|
|
57
|
-
context:
|
|
57
|
+
context: PluginContext,
|
|
58
58
|
payload: ContactApproveCommandPayload,
|
|
59
|
-
|
|
59
|
+
execution_context?: PluginExecutionContext,
|
|
60
60
|
) => Promise<JsonValue>;
|
|
61
61
|
/**
|
|
62
62
|
* 检查 contact 或 endpoint 可用性。
|
|
63
63
|
*/
|
|
64
|
-
check: (context:
|
|
64
|
+
check: (context: PluginContext, payload: ContactCheckCommandPayload) => Promise<JsonValue>;
|
|
65
65
|
/**
|
|
66
66
|
* 与 contact 对话或读取对话历史。
|
|
67
67
|
*/
|
|
68
|
-
chat: (context:
|
|
68
|
+
chat: (context: PluginContext, payload: ContactChatCommandPayload) => Promise<JsonValue>;
|
|
69
69
|
/**
|
|
70
70
|
* 向 contact 分享内容。
|
|
71
71
|
*/
|
|
72
|
-
share: (context:
|
|
72
|
+
share: (context: PluginContext, payload: ContactShareCommandPayload) => Promise<JsonValue>;
|
|
73
73
|
/**
|
|
74
74
|
* 处理远端 ping 请求。
|
|
75
75
|
*/
|
|
76
76
|
remotePing: (
|
|
77
|
-
context:
|
|
77
|
+
context: PluginContext,
|
|
78
78
|
payload: { token?: string },
|
|
79
79
|
) => Promise<ContactPingResponse>;
|
|
80
80
|
/**
|
|
81
81
|
* 处理远端 approve 请求。
|
|
82
82
|
*/
|
|
83
83
|
remoteApprove: (
|
|
84
|
-
context:
|
|
84
|
+
context: PluginContext,
|
|
85
85
|
request: ContactApproveLinkRequest,
|
|
86
86
|
) => Promise<ContactApproveLinkResponse>;
|
|
87
87
|
/**
|
|
88
88
|
* 处理远端 confirm 请求。
|
|
89
89
|
*/
|
|
90
90
|
remoteConfirm: (
|
|
91
|
-
context:
|
|
91
|
+
context: PluginContext,
|
|
92
92
|
request: ContactConfirmRequest,
|
|
93
93
|
) => Promise<ContactConfirmResponse>;
|
|
94
94
|
/**
|
|
95
95
|
* 处理远端 share 请求。
|
|
96
96
|
*/
|
|
97
|
-
remoteShare: (context:
|
|
97
|
+
remoteShare: (context: PluginContext, rawPayload: JsonValue) => Promise<JsonValue>;
|
|
98
98
|
};
|
|
99
99
|
|
|
100
100
|
/**
|
|
@@ -102,7 +102,7 @@ export type ContactActionHandlers = {
|
|
|
102
102
|
*/
|
|
103
103
|
export function createContactActions(handlers: ContactActionHandlers): PluginActions {
|
|
104
104
|
return {
|
|
105
|
-
link:
|
|
105
|
+
link: create_action({
|
|
106
106
|
description: "Create a one-time contact link code for another agent to approve.",
|
|
107
107
|
input_schema: {
|
|
108
108
|
zod: z.object({ ttlSeconds: z.number().optional() }),
|
|
@@ -119,7 +119,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
119
119
|
configure(command) {
|
|
120
120
|
command.option("--ttl-seconds <seconds>", "Link expiration in seconds, defaulting to 600.", Number);
|
|
121
121
|
},
|
|
122
|
-
|
|
122
|
+
map_input({ opts }) {
|
|
123
123
|
const payload: JsonObject = {};
|
|
124
124
|
if (typeof opts.ttlSeconds === "number") payload.ttlSeconds = opts.ttlSeconds;
|
|
125
125
|
return payload;
|
|
@@ -130,11 +130,11 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
130
130
|
data: await handlers.link(
|
|
131
131
|
params.context,
|
|
132
132
|
params.input as ContactLinkCommandPayload,
|
|
133
|
-
params.
|
|
133
|
+
params.execution_context,
|
|
134
134
|
),
|
|
135
135
|
}),
|
|
136
136
|
}),
|
|
137
|
-
approve:
|
|
137
|
+
approve: create_action({
|
|
138
138
|
description: "Use a contact link code to establish a peer-to-peer contact.",
|
|
139
139
|
input_schema: {
|
|
140
140
|
zod: z.object({
|
|
@@ -160,7 +160,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
160
160
|
.argument("<code>")
|
|
161
161
|
.option("--name <alias>", "Local contact alias.");
|
|
162
162
|
},
|
|
163
|
-
|
|
163
|
+
map_input({ args, opts }) {
|
|
164
164
|
const code = String(args[0] || "").trim();
|
|
165
165
|
if (!code) throw new Error("Missing link code");
|
|
166
166
|
const payload: JsonObject = { code };
|
|
@@ -173,11 +173,11 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
173
173
|
data: await handlers.approve(
|
|
174
174
|
params.context,
|
|
175
175
|
params.input as unknown as ContactApproveCommandPayload,
|
|
176
|
-
params.
|
|
176
|
+
params.execution_context,
|
|
177
177
|
),
|
|
178
178
|
}),
|
|
179
179
|
}),
|
|
180
|
-
list:
|
|
180
|
+
list: create_action({
|
|
181
181
|
description: "List established contacts.",
|
|
182
182
|
input_schema: {
|
|
183
183
|
zod: z.object({}).passthrough(),
|
|
@@ -186,18 +186,18 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
186
186
|
examples: [{ title: "List contacts", payload: {} }],
|
|
187
187
|
command: {
|
|
188
188
|
description: "List established contacts.",
|
|
189
|
-
|
|
189
|
+
map_input() {
|
|
190
190
|
return {};
|
|
191
191
|
},
|
|
192
192
|
},
|
|
193
193
|
execute: async (params) => ({
|
|
194
194
|
success: true,
|
|
195
195
|
data: {
|
|
196
|
-
contacts: await listContacts(params.context.
|
|
196
|
+
contacts: await listContacts(params.context.workspace_path),
|
|
197
197
|
} as unknown as JsonValue,
|
|
198
198
|
}),
|
|
199
199
|
}),
|
|
200
|
-
check:
|
|
200
|
+
check: create_action({
|
|
201
201
|
description: "Check whether a contact or endpoint is currently online and reachable.",
|
|
202
202
|
input_schema: {
|
|
203
203
|
zod: z.object({
|
|
@@ -223,7 +223,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
223
223
|
.argument("[target]")
|
|
224
224
|
.option("--to <endpoint>", "Directly check an unsaved endpoint.");
|
|
225
225
|
},
|
|
226
|
-
|
|
226
|
+
map_input({ args, opts }) {
|
|
227
227
|
const payload: JsonObject = {};
|
|
228
228
|
const target = String(args[0] || "").trim();
|
|
229
229
|
if (target) payload.target = target;
|
|
@@ -239,7 +239,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
239
239
|
),
|
|
240
240
|
}),
|
|
241
241
|
}),
|
|
242
|
-
chat:
|
|
242
|
+
chat: create_action({
|
|
243
243
|
description: "Chat with a contact in its long-lived conversation thread, or read conversation history.",
|
|
244
244
|
input_schema: {
|
|
245
245
|
zod: z.object({
|
|
@@ -264,7 +264,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
264
264
|
configure(command) {
|
|
265
265
|
command.requiredOption("--to <contact>", "Target contact.").argument("[message...]");
|
|
266
266
|
},
|
|
267
|
-
|
|
267
|
+
map_input({ args, opts }) {
|
|
268
268
|
const payload: JsonObject = {
|
|
269
269
|
to: String(opts.to || "").trim(),
|
|
270
270
|
};
|
|
@@ -281,7 +281,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
281
281
|
),
|
|
282
282
|
}),
|
|
283
283
|
}),
|
|
284
|
-
share:
|
|
284
|
+
share: create_action({
|
|
285
285
|
description: "Share text, links, files, or directories with a contact.",
|
|
286
286
|
input_schema: {
|
|
287
287
|
zod: z.object({
|
|
@@ -316,7 +316,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
316
316
|
.option("--link <url...>", "Links to share.")
|
|
317
317
|
.argument("[paths...]");
|
|
318
318
|
},
|
|
319
|
-
|
|
319
|
+
map_input({ args, opts }) {
|
|
320
320
|
const links = Array.isArray(opts.link)
|
|
321
321
|
? opts.link.map((item) => String(item || "").trim()).filter(Boolean)
|
|
322
322
|
: typeof opts.link === "string"
|
|
@@ -338,7 +338,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
338
338
|
),
|
|
339
339
|
}),
|
|
340
340
|
}),
|
|
341
|
-
inbox:
|
|
341
|
+
inbox: create_action({
|
|
342
342
|
description: "View the contact inbox.",
|
|
343
343
|
input_schema: {
|
|
344
344
|
zod: z.object({}).passthrough(),
|
|
@@ -347,18 +347,18 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
347
347
|
examples: [{ title: "View inbox", payload: {} }],
|
|
348
348
|
command: {
|
|
349
349
|
description: "View the contact inbox.",
|
|
350
|
-
|
|
350
|
+
map_input() {
|
|
351
351
|
return {};
|
|
352
352
|
},
|
|
353
353
|
},
|
|
354
354
|
execute: async (params) => ({
|
|
355
355
|
success: true,
|
|
356
356
|
data: {
|
|
357
|
-
shares: await listContactInboxShares(params.context.
|
|
357
|
+
shares: await listContactInboxShares(params.context.workspace_path),
|
|
358
358
|
} as unknown as JsonValue,
|
|
359
359
|
}),
|
|
360
360
|
}),
|
|
361
|
-
receive:
|
|
361
|
+
receive: create_action({
|
|
362
362
|
description: "Receive a share from the inbox.",
|
|
363
363
|
input_schema: {
|
|
364
364
|
zod: z.object({ shareId: z.string() }),
|
|
@@ -376,7 +376,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
376
376
|
configure(command) {
|
|
377
377
|
command.argument("<shareId>");
|
|
378
378
|
},
|
|
379
|
-
|
|
379
|
+
map_input({ args }) {
|
|
380
380
|
const shareId = String(args[0] || "").trim();
|
|
381
381
|
if (!shareId) throw new Error("Missing shareId");
|
|
382
382
|
return { shareId };
|
|
@@ -385,12 +385,12 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
385
385
|
execute: async (params) => ({
|
|
386
386
|
success: true,
|
|
387
387
|
data: (await receiveShare({
|
|
388
|
-
|
|
388
|
+
project_root: params.context.workspace_path,
|
|
389
389
|
shareId: (params.input as unknown as ContactReceiveCommandPayload).shareId,
|
|
390
390
|
})) as unknown as JsonValue,
|
|
391
391
|
}),
|
|
392
392
|
}),
|
|
393
|
-
remoteping:
|
|
393
|
+
remoteping: create_action({
|
|
394
394
|
description: "Handle a remote ping request (internal endpoint).",
|
|
395
395
|
execute: async (params) => ({
|
|
396
396
|
success: true,
|
|
@@ -400,7 +400,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
400
400
|
)) as unknown as JsonValue,
|
|
401
401
|
}),
|
|
402
402
|
}),
|
|
403
|
-
remoteapprove:
|
|
403
|
+
remoteapprove: create_action({
|
|
404
404
|
description: "Handle a remote approve request (internal endpoint).",
|
|
405
405
|
execute: async (params) => ({
|
|
406
406
|
success: true,
|
|
@@ -410,7 +410,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
410
410
|
)) as unknown as JsonValue,
|
|
411
411
|
}),
|
|
412
412
|
}),
|
|
413
|
-
remoteconfirm:
|
|
413
|
+
remoteconfirm: create_action({
|
|
414
414
|
description: "Handle a remote confirm request (internal endpoint).",
|
|
415
415
|
execute: async (params) => ({
|
|
416
416
|
success: true,
|
|
@@ -420,7 +420,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
420
420
|
)) as unknown as JsonValue,
|
|
421
421
|
}),
|
|
422
422
|
}),
|
|
423
|
-
remotechat:
|
|
423
|
+
remotechat: create_action({
|
|
424
424
|
description: "Handle a remote chat request (internal endpoint).",
|
|
425
425
|
execute: async (params) => {
|
|
426
426
|
const payload = readContactObject(params.input);
|
|
@@ -435,7 +435,7 @@ export function createContactActions(handlers: ContactActionHandlers): PluginAct
|
|
|
435
435
|
};
|
|
436
436
|
},
|
|
437
437
|
}),
|
|
438
|
-
remoteshare:
|
|
438
|
+
remoteshare: create_action({
|
|
439
439
|
description: "Handle a remote share request (internal endpoint).",
|
|
440
440
|
execute: async (params) => ({
|
|
441
441
|
success: true,
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* - `share` 分享文本、链接、文件和目录,并进入对方 inbox。
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import type {
|
|
11
|
-
import type {
|
|
10
|
+
import type { PluginContext } from "@downcity/agent";
|
|
11
|
+
import type { PluginExecutionContext } from "@downcity/agent";
|
|
12
12
|
import type { JsonValue } from "@downcity/agent";
|
|
13
13
|
import type { PluginActions } from "@downcity/agent";
|
|
14
14
|
import { BasePlugin } from "@downcity/agent";
|
|
@@ -82,7 +82,7 @@ import {
|
|
|
82
82
|
} from "./runtime/ContactPayload.js";
|
|
83
83
|
|
|
84
84
|
async function resolveSelfEndpoint(
|
|
85
|
-
context:
|
|
85
|
+
context: PluginContext,
|
|
86
86
|
options: ContactPluginOptions,
|
|
87
87
|
endpointOverride?: string,
|
|
88
88
|
effective_env?: Readonly<Record<string, string>>,
|
|
@@ -91,7 +91,7 @@ async function resolveSelfEndpoint(
|
|
|
91
91
|
if (explicit) return normalizeContactEndpoint(explicit);
|
|
92
92
|
const env = {
|
|
93
93
|
...process.env,
|
|
94
|
-
...context.
|
|
94
|
+
...context.workspace_env,
|
|
95
95
|
...effective_env,
|
|
96
96
|
};
|
|
97
97
|
const runtimePort = Number(process.env.DC_CITY_PORT || env.DC_CITY_PORT || "");
|
|
@@ -110,12 +110,12 @@ async function resolveSelfEndpoint(
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
function hasRuntimePublicEndpointEnv(
|
|
113
|
-
context:
|
|
113
|
+
context: PluginContext,
|
|
114
114
|
effective_env?: Readonly<Record<string, string>>,
|
|
115
115
|
): boolean {
|
|
116
116
|
const env = {
|
|
117
117
|
...process.env,
|
|
118
|
-
...context.
|
|
118
|
+
...context.workspace_env,
|
|
119
119
|
...effective_env,
|
|
120
120
|
};
|
|
121
121
|
return Boolean(
|
|
@@ -124,7 +124,7 @@ function hasRuntimePublicEndpointEnv(
|
|
|
124
124
|
);
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
function getAgentName(context:
|
|
127
|
+
function getAgentName(context: PluginContext): string {
|
|
128
128
|
return String(context.agent_id || "downcity-agent").trim() || "downcity-agent";
|
|
129
129
|
}
|
|
130
130
|
|
|
@@ -164,10 +164,10 @@ export class ContactPlugin extends BasePlugin {
|
|
|
164
164
|
super();
|
|
165
165
|
this.options = options || {};
|
|
166
166
|
this.actions = createContactActions({
|
|
167
|
-
link: async (context, payload,
|
|
168
|
-
(await this.link(context, payload,
|
|
169
|
-
approve: async (context, payload,
|
|
170
|
-
(await this.approve(context, payload,
|
|
167
|
+
link: async (context, payload, execution_context) =>
|
|
168
|
+
(await this.link(context, payload, execution_context)) as unknown as JsonValue,
|
|
169
|
+
approve: async (context, payload, execution_context) =>
|
|
170
|
+
(await this.approve(context, payload, execution_context)) as unknown as JsonValue,
|
|
171
171
|
check: async (context, payload) =>
|
|
172
172
|
(await this.check(context, payload)) as unknown as JsonValue,
|
|
173
173
|
chat: async (context, payload) =>
|
|
@@ -190,9 +190,9 @@ export class ContactPlugin extends BasePlugin {
|
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
private async link(
|
|
193
|
-
context:
|
|
193
|
+
context: PluginContext,
|
|
194
194
|
payload: ContactLinkCommandPayload,
|
|
195
|
-
|
|
195
|
+
execution_context?: PluginExecutionContext,
|
|
196
196
|
) {
|
|
197
197
|
const now = Date.now();
|
|
198
198
|
const ttlSeconds = Math.max(
|
|
@@ -205,17 +205,17 @@ export class ContactPlugin extends BasePlugin {
|
|
|
205
205
|
context,
|
|
206
206
|
this.options,
|
|
207
207
|
payload.endpoint || this.options.endpoint,
|
|
208
|
-
|
|
208
|
+
execution_context?.workspace_env,
|
|
209
209
|
);
|
|
210
210
|
const agentName = getAgentName(context);
|
|
211
211
|
|
|
212
|
-
await saveContactLinkRecord(context.
|
|
212
|
+
await saveContactLinkRecord(context.workspace_path, {
|
|
213
213
|
id: linkId,
|
|
214
214
|
agentName,
|
|
215
215
|
endpoint,
|
|
216
216
|
secretHash: hashContactToken(secret),
|
|
217
|
-
|
|
218
|
-
|
|
217
|
+
created_at: now,
|
|
218
|
+
expires_at: now + ttlSeconds * 1000,
|
|
219
219
|
usedAt: null,
|
|
220
220
|
});
|
|
221
221
|
|
|
@@ -225,8 +225,8 @@ export class ContactPlugin extends BasePlugin {
|
|
|
225
225
|
agentName,
|
|
226
226
|
endpoint,
|
|
227
227
|
secret,
|
|
228
|
-
|
|
229
|
-
|
|
228
|
+
created_at: now,
|
|
229
|
+
expires_at: now + ttlSeconds * 1000,
|
|
230
230
|
});
|
|
231
231
|
return {
|
|
232
232
|
code,
|
|
@@ -235,14 +235,14 @@ export class ContactPlugin extends BasePlugin {
|
|
|
235
235
|
endpoint,
|
|
236
236
|
endpointReachability: classifyContactEndpoint(endpoint),
|
|
237
237
|
notes: buildContactLinkNotes({ endpoint }),
|
|
238
|
-
|
|
238
|
+
expires_at: now + ttlSeconds * 1000,
|
|
239
239
|
};
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
private async approve(
|
|
243
|
-
context:
|
|
243
|
+
context: PluginContext,
|
|
244
244
|
payload: ContactApproveCommandPayload,
|
|
245
|
-
|
|
245
|
+
execution_context?: PluginExecutionContext,
|
|
246
246
|
) {
|
|
247
247
|
const parsed = parseContactLinkCode(payload.code);
|
|
248
248
|
// 关键点(中文):approve 端不使用本机时钟预判过期,避免两台机器时钟不一致时把本来可用的 link 提前拦截。
|
|
@@ -251,7 +251,7 @@ export class ContactPlugin extends BasePlugin {
|
|
|
251
251
|
const targetReachability = classifyContactEndpoint(parsed.endpoint);
|
|
252
252
|
const shouldResolveRequesterEndpoint =
|
|
253
253
|
payload.endpoint ||
|
|
254
|
-
hasRuntimePublicEndpointEnv(context,
|
|
254
|
+
hasRuntimePublicEndpointEnv(context, execution_context?.workspace_env) ||
|
|
255
255
|
targetReachability === "loopback" ||
|
|
256
256
|
targetReachability === "private";
|
|
257
257
|
const requesterEndpointCandidate = shouldResolveRequesterEndpoint
|
|
@@ -259,7 +259,7 @@ export class ContactPlugin extends BasePlugin {
|
|
|
259
259
|
context,
|
|
260
260
|
this.options,
|
|
261
261
|
payload.endpoint || this.options.endpoint,
|
|
262
|
-
|
|
262
|
+
execution_context?.workspace_env,
|
|
263
263
|
)
|
|
264
264
|
: undefined;
|
|
265
265
|
const callbackDecision = buildContactApproveCallbackDecision({
|
|
@@ -293,7 +293,7 @@ export class ContactPlugin extends BasePlugin {
|
|
|
293
293
|
if (!response.success) throw new Error(response.error || "Contact approve failed");
|
|
294
294
|
|
|
295
295
|
const name = String(payload.name || response.agentName || parsed.agentName).trim();
|
|
296
|
-
const contact = await saveContact(context.
|
|
296
|
+
const contact = await saveContact(context.workspace_path, {
|
|
297
297
|
id: createStableContactId(name),
|
|
298
298
|
name,
|
|
299
299
|
endpoint: response.endpoint || parsed.endpoint,
|
|
@@ -301,7 +301,7 @@ export class ContactPlugin extends BasePlugin {
|
|
|
301
301
|
status: "trusted",
|
|
302
302
|
outboundToken: response.tokenForOwner,
|
|
303
303
|
inboundTokenHash: tokenForRequester ? hashContactToken(tokenForRequester) : null,
|
|
304
|
-
|
|
304
|
+
created_at: Date.now(),
|
|
305
305
|
lastSeenAt: Date.now(),
|
|
306
306
|
});
|
|
307
307
|
let confirmed = false;
|
|
@@ -326,7 +326,7 @@ export class ContactPlugin extends BasePlugin {
|
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
328
|
const finalContact = confirmed
|
|
329
|
-
? await saveContact(context.
|
|
329
|
+
? await saveContact(context.workspace_path, {
|
|
330
330
|
...contact,
|
|
331
331
|
reachability: "bidirectional",
|
|
332
332
|
inboundTokenHash: tokenForRequester ? hashContactToken(tokenForRequester) : null,
|
|
@@ -351,12 +351,12 @@ export class ContactPlugin extends BasePlugin {
|
|
|
351
351
|
};
|
|
352
352
|
}
|
|
353
353
|
|
|
354
|
-
private async check(context:
|
|
354
|
+
private async check(context: PluginContext, payload: ContactCheckCommandPayload) {
|
|
355
355
|
const startedAt = Date.now();
|
|
356
356
|
const endpointInput = String(payload.endpoint || "").trim();
|
|
357
357
|
const contact = endpointInput
|
|
358
358
|
? null
|
|
359
|
-
: await findContact(context.
|
|
359
|
+
: await findContact(context.workspace_path, String(payload.target || "").trim());
|
|
360
360
|
const endpoint = endpointInput || contact?.endpoint || "";
|
|
361
361
|
if (!endpoint) throw new Error("contact target or --to endpoint is required");
|
|
362
362
|
if (contact && !contact.outboundToken) {
|
|
@@ -369,7 +369,7 @@ export class ContactPlugin extends BasePlugin {
|
|
|
369
369
|
token: contact?.outboundToken || undefined,
|
|
370
370
|
});
|
|
371
371
|
if (contact && pong.success) {
|
|
372
|
-
await touchContactSeen(context.
|
|
372
|
+
await touchContactSeen(context.workspace_path, contact.id);
|
|
373
373
|
}
|
|
374
374
|
return {
|
|
375
375
|
target: contact?.name || endpoint,
|
|
@@ -391,21 +391,21 @@ export class ContactPlugin extends BasePlugin {
|
|
|
391
391
|
}
|
|
392
392
|
}
|
|
393
393
|
|
|
394
|
-
private async chat(context:
|
|
395
|
-
const contact = await findContact(context.
|
|
394
|
+
private async chat(context: PluginContext, payload: ContactChatCommandPayload) {
|
|
395
|
+
const contact = await findContact(context.workspace_path, payload.to);
|
|
396
396
|
if (!contact) throw new Error(`Contact not found: ${payload.to}`);
|
|
397
397
|
const message = String(payload.message || "").trim();
|
|
398
398
|
if (!message) {
|
|
399
399
|
return {
|
|
400
400
|
contact,
|
|
401
|
-
messages: await readContactMessages(context.
|
|
401
|
+
messages: await readContactMessages(context.workspace_path, contact.id),
|
|
402
402
|
};
|
|
403
403
|
}
|
|
404
404
|
|
|
405
|
-
await appendContactMessage(context.
|
|
405
|
+
await appendContactMessage(context.workspace_path, contact.id, {
|
|
406
406
|
role: "local",
|
|
407
407
|
text: message,
|
|
408
|
-
|
|
408
|
+
created_at: Date.now(),
|
|
409
409
|
});
|
|
410
410
|
const outbound = requireOutboundContact(contact);
|
|
411
411
|
const response = await callContactChat<ContactChatResponse>({
|
|
@@ -414,20 +414,20 @@ export class ContactPlugin extends BasePlugin {
|
|
|
414
414
|
body: {
|
|
415
415
|
senderContactId: contact.id,
|
|
416
416
|
message,
|
|
417
|
-
|
|
417
|
+
created_at: Date.now(),
|
|
418
418
|
} as unknown as JsonValue,
|
|
419
419
|
});
|
|
420
420
|
if (!response.success) throw new Error(response.error || "Contact chat failed");
|
|
421
|
-
await appendContactMessage(context.
|
|
421
|
+
await appendContactMessage(context.workspace_path, contact.id, {
|
|
422
422
|
role: "remote",
|
|
423
423
|
text: response.reply,
|
|
424
|
-
|
|
424
|
+
created_at: Date.now(),
|
|
425
425
|
});
|
|
426
426
|
return response;
|
|
427
427
|
}
|
|
428
428
|
|
|
429
|
-
private async share(context:
|
|
430
|
-
const contact = await findContact(context.
|
|
429
|
+
private async share(context: PluginContext, payload: ContactShareCommandPayload) {
|
|
430
|
+
const contact = await findContact(context.workspace_path, payload.to);
|
|
431
431
|
if (!contact) throw new Error(`Contact not found: ${payload.to}`);
|
|
432
432
|
const outbound = requireOutboundContact(contact);
|
|
433
433
|
const share = await createShareInput({
|
|
@@ -455,7 +455,7 @@ export class ContactPlugin extends BasePlugin {
|
|
|
455
455
|
}
|
|
456
456
|
|
|
457
457
|
private async remotePing(
|
|
458
|
-
context:
|
|
458
|
+
context: PluginContext,
|
|
459
459
|
payload: { token?: string },
|
|
460
460
|
): Promise<ContactPingResponse> {
|
|
461
461
|
const token = String(payload.token || "").trim();
|
|
@@ -466,7 +466,7 @@ export class ContactPlugin extends BasePlugin {
|
|
|
466
466
|
plugin: "contact",
|
|
467
467
|
};
|
|
468
468
|
}
|
|
469
|
-
const contact = await findContactByInboundToken(context.
|
|
469
|
+
const contact = await findContactByInboundToken(context.workspace_path, token);
|
|
470
470
|
return {
|
|
471
471
|
success: true,
|
|
472
472
|
agentName: getAgentName(context),
|
|
@@ -476,11 +476,11 @@ export class ContactPlugin extends BasePlugin {
|
|
|
476
476
|
}
|
|
477
477
|
|
|
478
478
|
private async remoteApprove(
|
|
479
|
-
context:
|
|
479
|
+
context: PluginContext,
|
|
480
480
|
request: ContactApproveLinkRequest,
|
|
481
481
|
): Promise<ContactApproveLinkResponse> {
|
|
482
482
|
return await approveContactLinkRequest({
|
|
483
|
-
|
|
483
|
+
project_root: context.workspace_path,
|
|
484
484
|
ownerAgentName: getAgentName(context),
|
|
485
485
|
ownerEndpoint: await resolveSelfEndpoint(context, this.options),
|
|
486
486
|
request,
|
|
@@ -488,11 +488,11 @@ export class ContactPlugin extends BasePlugin {
|
|
|
488
488
|
}
|
|
489
489
|
|
|
490
490
|
private async remoteConfirm(
|
|
491
|
-
context:
|
|
491
|
+
context: PluginContext,
|
|
492
492
|
request: ContactConfirmRequest,
|
|
493
493
|
): Promise<ContactConfirmResponse> {
|
|
494
494
|
return await confirmContactLinkRequest({
|
|
495
|
-
|
|
495
|
+
project_root: context.workspace_path,
|
|
496
496
|
ownerAgentName: getAgentName(context),
|
|
497
497
|
request,
|
|
498
498
|
verifyCallback: async ({ endpoint, token }) => {
|
|
@@ -505,11 +505,11 @@ export class ContactPlugin extends BasePlugin {
|
|
|
505
505
|
});
|
|
506
506
|
}
|
|
507
507
|
|
|
508
|
-
private async remoteShare(context:
|
|
508
|
+
private async remoteShare(context: PluginContext, rawPayload: JsonValue) {
|
|
509
509
|
const payload = readContactObject(rawPayload);
|
|
510
510
|
const token = readContactString(payload, "token");
|
|
511
511
|
const body = readContactObject(payload.body);
|
|
512
|
-
const contact = await findContactByInboundToken(context.
|
|
512
|
+
const contact = await findContactByInboundToken(context.workspace_path, token);
|
|
513
513
|
if (!contact || contact.status !== "trusted") {
|
|
514
514
|
throw new Error("Invalid contact token");
|
|
515
515
|
}
|
|
@@ -521,7 +521,7 @@ export class ContactPlugin extends BasePlugin {
|
|
|
521
521
|
receivedAt: Date.now(),
|
|
522
522
|
status: "pending" as const,
|
|
523
523
|
};
|
|
524
|
-
await saveContactInboxShare(context.
|
|
524
|
+
await saveContactInboxShare(context.workspace_path, {
|
|
525
525
|
meta,
|
|
526
526
|
payload: share.payload,
|
|
527
527
|
files: Array.isArray(share.files) ? share.files : [],
|