@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
|
@@ -22,118 +22,118 @@ function cleanSegment(input: string, label: string): string {
|
|
|
22
22
|
/**
|
|
23
23
|
* contact 根目录。
|
|
24
24
|
*/
|
|
25
|
-
export function getContactRootPath(
|
|
26
|
-
return path.join(
|
|
25
|
+
export function getContactRootPath(project_root: string): string {
|
|
26
|
+
return path.join(project_root, ".downcity", "contact");
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* contacts 根目录。
|
|
31
31
|
*/
|
|
32
|
-
export function getContactsRootPath(
|
|
33
|
-
return path.join(getContactRootPath(
|
|
32
|
+
export function getContactsRootPath(project_root: string): string {
|
|
33
|
+
return path.join(getContactRootPath(project_root), "contacts");
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* 单个 contact 目录。
|
|
38
38
|
*/
|
|
39
39
|
export function getContactDirectoryPath(
|
|
40
|
-
|
|
40
|
+
project_root: string,
|
|
41
41
|
contactId: string,
|
|
42
42
|
): string {
|
|
43
|
-
return path.join(getContactsRootPath(
|
|
43
|
+
return path.join(getContactsRootPath(project_root), cleanSegment(contactId, "contactId"));
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* 单个 contact 元信息文件。
|
|
48
48
|
*/
|
|
49
|
-
export function getContactJsonPath(
|
|
50
|
-
return path.join(getContactDirectoryPath(
|
|
49
|
+
export function getContactJsonPath(project_root: string, contactId: string): string {
|
|
50
|
+
return path.join(getContactDirectoryPath(project_root, contactId), "contact.json");
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* 单个 contact 的长期对话历史文件。
|
|
55
55
|
*/
|
|
56
56
|
export function getContactMessagesPath(
|
|
57
|
-
|
|
57
|
+
project_root: string,
|
|
58
58
|
contactId: string,
|
|
59
59
|
): string {
|
|
60
|
-
return path.join(getContactDirectoryPath(
|
|
60
|
+
return path.join(getContactDirectoryPath(project_root, contactId), "messages.jsonl");
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
64
|
* link 根目录。
|
|
65
65
|
*/
|
|
66
|
-
export function getContactLinksRootPath(
|
|
67
|
-
return path.join(getContactRootPath(
|
|
66
|
+
export function getContactLinksRootPath(project_root: string): string {
|
|
67
|
+
return path.join(getContactRootPath(project_root), "links");
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
71
|
* 单个 link 记录文件。
|
|
72
72
|
*/
|
|
73
|
-
export function getContactLinkPath(
|
|
74
|
-
return path.join(getContactLinksRootPath(
|
|
73
|
+
export function getContactLinkPath(project_root: string, linkId: string): string {
|
|
74
|
+
return path.join(getContactLinksRootPath(project_root), `${cleanSegment(linkId, "linkId")}.json`);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
/**
|
|
78
78
|
* inbox 根目录。
|
|
79
79
|
*/
|
|
80
|
-
export function getContactInboxRootPath(
|
|
81
|
-
return path.join(getContactRootPath(
|
|
80
|
+
export function getContactInboxRootPath(project_root: string): string {
|
|
81
|
+
return path.join(getContactRootPath(project_root), "inbox");
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
85
|
* 单个 inbox share 目录。
|
|
86
86
|
*/
|
|
87
87
|
export function getContactInboxSharePath(
|
|
88
|
-
|
|
88
|
+
project_root: string,
|
|
89
89
|
shareId: string,
|
|
90
90
|
): string {
|
|
91
|
-
return path.join(getContactInboxRootPath(
|
|
91
|
+
return path.join(getContactInboxRootPath(project_root), cleanSegment(shareId, "shareId"));
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
/**
|
|
95
95
|
* 单个 inbox share 元信息文件。
|
|
96
96
|
*/
|
|
97
97
|
export function getContactInboxShareMetaPath(
|
|
98
|
-
|
|
98
|
+
project_root: string,
|
|
99
99
|
shareId: string,
|
|
100
100
|
): string {
|
|
101
|
-
return path.join(getContactInboxSharePath(
|
|
101
|
+
return path.join(getContactInboxSharePath(project_root, shareId), "meta.json");
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
/**
|
|
105
105
|
* 单个 inbox share payload 文件。
|
|
106
106
|
*/
|
|
107
107
|
export function getContactInboxSharePayloadPath(
|
|
108
|
-
|
|
108
|
+
project_root: string,
|
|
109
109
|
shareId: string,
|
|
110
110
|
): string {
|
|
111
|
-
return path.join(getContactInboxSharePath(
|
|
111
|
+
return path.join(getContactInboxSharePath(project_root, shareId), "payload.json");
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
/**
|
|
115
115
|
* 单个 inbox share 文件根目录。
|
|
116
116
|
*/
|
|
117
117
|
export function getContactInboxShareFilesPath(
|
|
118
|
-
|
|
118
|
+
project_root: string,
|
|
119
119
|
shareId: string,
|
|
120
120
|
): string {
|
|
121
|
-
return path.join(getContactInboxSharePath(
|
|
121
|
+
return path.join(getContactInboxSharePath(project_root, shareId), "files");
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
/**
|
|
125
125
|
* received 根目录。
|
|
126
126
|
*/
|
|
127
|
-
export function getContactReceivedRootPath(
|
|
128
|
-
return path.join(getContactRootPath(
|
|
127
|
+
export function getContactReceivedRootPath(project_root: string): string {
|
|
128
|
+
return path.join(getContactRootPath(project_root), "received");
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
/**
|
|
132
132
|
* 单个 received share 目录。
|
|
133
133
|
*/
|
|
134
134
|
export function getContactReceivedSharePath(
|
|
135
|
-
|
|
135
|
+
project_root: string,
|
|
136
136
|
shareId: string,
|
|
137
137
|
): string {
|
|
138
|
-
return path.join(getContactReceivedRootPath(
|
|
138
|
+
return path.join(getContactReceivedRootPath(project_root), cleanSegment(shareId, "shareId"));
|
|
139
139
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* contact 远端 HTTP 客户端。
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
|
-
* - contact 的 agent-to-agent 调用统一走
|
|
5
|
+
* - contact 的 agent-to-agent 调用统一走 Plugin Action 接口。
|
|
6
6
|
* - 已建联后的敏感调用必须携带 contact token。
|
|
7
7
|
*/
|
|
8
8
|
|
|
@@ -25,24 +25,24 @@ function normalizeEndpoint(endpoint: string): string {
|
|
|
25
25
|
return url.toString().replace(/\/$/, "");
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
function
|
|
28
|
+
function unwrap_plugin_action_envelope<T>(value: T): T {
|
|
29
29
|
if (!isRecord(value)) return value;
|
|
30
30
|
const inner = value.data;
|
|
31
31
|
if (typeof value.success === "boolean" && isRecord(inner)) {
|
|
32
|
-
// 关键点(中文):统一
|
|
32
|
+
// 关键点(中文):统一 Action 路由会包一层 `{ success, data }`。
|
|
33
33
|
return inner as T;
|
|
34
34
|
}
|
|
35
35
|
return value;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
async function
|
|
38
|
+
async function post_plugin_action<T>(params: {
|
|
39
39
|
endpoint: string;
|
|
40
|
-
|
|
40
|
+
action: string;
|
|
41
41
|
body?: JsonValue;
|
|
42
42
|
token?: string;
|
|
43
43
|
wrapBody?: boolean;
|
|
44
44
|
}): Promise<T> {
|
|
45
|
-
const url = new URL("/api/plugins/
|
|
45
|
+
const url = new URL("/api/plugins/action", normalizeEndpoint(params.endpoint)).toString();
|
|
46
46
|
const payloadBody =
|
|
47
47
|
params.wrapBody
|
|
48
48
|
? {
|
|
@@ -66,8 +66,8 @@ async function postPluginCommand<T>(params: {
|
|
|
66
66
|
method: "POST",
|
|
67
67
|
headers,
|
|
68
68
|
body: JSON.stringify({
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
plugin_name: "contact",
|
|
70
|
+
action_name: params.action,
|
|
71
71
|
payload: payloadBody,
|
|
72
72
|
}),
|
|
73
73
|
});
|
|
@@ -78,7 +78,7 @@ async function postPluginCommand<T>(params: {
|
|
|
78
78
|
if (!response.ok) {
|
|
79
79
|
throw new Error(data?.error || data?.message || `HTTP ${response.status}`);
|
|
80
80
|
}
|
|
81
|
-
return
|
|
81
|
+
return unwrap_plugin_action_envelope<T>(data);
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
/**
|
|
@@ -88,9 +88,9 @@ export async function callContactPing<T>(params: {
|
|
|
88
88
|
endpoint: string;
|
|
89
89
|
token?: string;
|
|
90
90
|
}): Promise<T> {
|
|
91
|
-
return await
|
|
91
|
+
return await post_plugin_action<T>({
|
|
92
92
|
endpoint: params.endpoint,
|
|
93
|
-
|
|
93
|
+
action: "remoteping",
|
|
94
94
|
token: params.token,
|
|
95
95
|
});
|
|
96
96
|
}
|
|
@@ -102,9 +102,9 @@ export async function callContactApprove<T>(params: {
|
|
|
102
102
|
endpoint: string;
|
|
103
103
|
body: JsonValue;
|
|
104
104
|
}): Promise<T> {
|
|
105
|
-
return await
|
|
105
|
+
return await post_plugin_action<T>({
|
|
106
106
|
endpoint: params.endpoint,
|
|
107
|
-
|
|
107
|
+
action: "remoteapprove",
|
|
108
108
|
body: params.body,
|
|
109
109
|
});
|
|
110
110
|
}
|
|
@@ -116,9 +116,9 @@ export async function callContactConfirm<T>(params: {
|
|
|
116
116
|
endpoint: string;
|
|
117
117
|
body: JsonValue;
|
|
118
118
|
}): Promise<T> {
|
|
119
|
-
return await
|
|
119
|
+
return await post_plugin_action<T>({
|
|
120
120
|
endpoint: params.endpoint,
|
|
121
|
-
|
|
121
|
+
action: "remoteconfirm",
|
|
122
122
|
body: params.body,
|
|
123
123
|
});
|
|
124
124
|
}
|
|
@@ -131,9 +131,9 @@ export async function callContactChat<T>(params: {
|
|
|
131
131
|
token: string;
|
|
132
132
|
body: JsonValue;
|
|
133
133
|
}): Promise<T> {
|
|
134
|
-
return await
|
|
134
|
+
return await post_plugin_action<T>({
|
|
135
135
|
endpoint: params.endpoint,
|
|
136
|
-
|
|
136
|
+
action: "remotechat",
|
|
137
137
|
token: params.token,
|
|
138
138
|
body: params.body,
|
|
139
139
|
wrapBody: true,
|
|
@@ -148,9 +148,9 @@ export async function callContactShare<T>(params: {
|
|
|
148
148
|
token: string;
|
|
149
149
|
body: JsonValue;
|
|
150
150
|
}): Promise<T> {
|
|
151
|
-
return await
|
|
151
|
+
return await post_plugin_action<T>({
|
|
152
152
|
endpoint: params.endpoint,
|
|
153
|
-
|
|
153
|
+
action: "remoteshare",
|
|
154
154
|
token: params.token,
|
|
155
155
|
body: params.body,
|
|
156
156
|
wrapBody: true,
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import crypto from "node:crypto";
|
|
10
10
|
import fs from "fs-extra";
|
|
11
11
|
import path from "node:path";
|
|
12
|
-
import type {
|
|
12
|
+
import type { PluginContext } from "@downcity/agent";
|
|
13
13
|
import type {
|
|
14
14
|
ContactInboxShareFileInput,
|
|
15
15
|
ContactInboxShareMeta,
|
|
@@ -127,7 +127,7 @@ export async function createShareInput(params: {
|
|
|
127
127
|
/**
|
|
128
128
|
* 当前 agent context。
|
|
129
129
|
*/
|
|
130
|
-
context:
|
|
130
|
+
context: PluginContext;
|
|
131
131
|
/**
|
|
132
132
|
* 发送方 contact id。
|
|
133
133
|
*/
|
|
@@ -172,7 +172,7 @@ export async function createShareInput(params: {
|
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
for (const rawPath of Array.isArray(params.paths) ? params.paths : []) {
|
|
175
|
-
const sourcePath = path.resolve(params.context.
|
|
175
|
+
const sourcePath = path.resolve(params.context.workspace_path, String(rawPath || "").trim());
|
|
176
176
|
const itemRoot = createItemRoot(sourcePath);
|
|
177
177
|
const collected = await collectPathFiles({
|
|
178
178
|
sourcePath,
|
|
@@ -235,7 +235,7 @@ export async function receiveShare(params: {
|
|
|
235
235
|
/**
|
|
236
236
|
* 项目根目录。
|
|
237
237
|
*/
|
|
238
|
-
|
|
238
|
+
project_root: string;
|
|
239
239
|
/**
|
|
240
240
|
* share id。
|
|
241
241
|
*/
|
|
@@ -250,22 +250,22 @@ export async function receiveShare(params: {
|
|
|
250
250
|
*/
|
|
251
251
|
receivedPath: string;
|
|
252
252
|
}> {
|
|
253
|
-
const payload = await readContactInboxSharePayload(params.
|
|
253
|
+
const payload = await readContactInboxSharePayload(params.project_root, params.shareId);
|
|
254
254
|
if (!payload) throw new Error(`Share payload not found: ${params.shareId}`);
|
|
255
255
|
if (payload.kind !== "share") throw new Error(`Unsupported share payload: ${payload.kind}`);
|
|
256
256
|
|
|
257
|
-
const receivedPath = getContactReceivedSharePath(params.
|
|
257
|
+
const receivedPath = getContactReceivedSharePath(params.project_root, params.shareId);
|
|
258
258
|
await fs.ensureDir(receivedPath);
|
|
259
259
|
await fs.writeJson(path.join(receivedPath, "payload.json"), payload, { spaces: 2 });
|
|
260
260
|
|
|
261
|
-
const filesRoot = getInboxShareFilesRoot(params.
|
|
261
|
+
const filesRoot = getInboxShareFilesRoot(params.project_root, params.shareId);
|
|
262
262
|
if (await fs.pathExists(filesRoot)) {
|
|
263
263
|
await fs.copy(filesRoot, path.join(receivedPath, "files"), {
|
|
264
264
|
overwrite: true,
|
|
265
265
|
});
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
-
await markContactInboxShareReceived(params.
|
|
268
|
+
await markContactInboxShareReceived(params.project_root, params.shareId);
|
|
269
269
|
return {
|
|
270
270
|
itemCount: payload.items.length,
|
|
271
271
|
receivedPath,
|
|
@@ -51,7 +51,7 @@ export interface AgentContact {
|
|
|
51
51
|
/**
|
|
52
52
|
* contact 创建时间戳。
|
|
53
53
|
*/
|
|
54
|
-
|
|
54
|
+
created_at: number;
|
|
55
55
|
/**
|
|
56
56
|
* 最近一次成功通信时间戳。
|
|
57
57
|
*/
|
|
@@ -78,5 +78,5 @@ export interface ContactChatMessage {
|
|
|
78
78
|
/**
|
|
79
79
|
* 消息创建时间戳。
|
|
80
80
|
*/
|
|
81
|
-
|
|
81
|
+
created_at: number;
|
|
82
82
|
}
|
|
@@ -43,7 +43,7 @@ export interface ApproveContactLinkRequestInput {
|
|
|
43
43
|
/**
|
|
44
44
|
* 当前 agent 项目根目录,用于读取 link 记录并保存 contact。
|
|
45
45
|
*/
|
|
46
|
-
|
|
46
|
+
project_root: string;
|
|
47
47
|
/**
|
|
48
48
|
* 当前 agent 名称,也就是 link 所属方名称。
|
|
49
49
|
*/
|
|
@@ -121,7 +121,7 @@ export interface ConfirmContactLinkRequestInput {
|
|
|
121
121
|
/**
|
|
122
122
|
* 当前 agent 项目根目录,用于读取 link 记录并更新 contact。
|
|
123
123
|
*/
|
|
124
|
-
|
|
124
|
+
project_root: string;
|
|
125
125
|
/**
|
|
126
126
|
* 当前 agent 名称,也就是 link 所属方名称。
|
|
127
127
|
*/
|
|
@@ -33,11 +33,11 @@ export interface ContactLinkCodePayload {
|
|
|
33
33
|
/**
|
|
34
34
|
* link 创建时间戳。
|
|
35
35
|
*/
|
|
36
|
-
|
|
36
|
+
created_at: number;
|
|
37
37
|
/**
|
|
38
38
|
* link 过期时间戳。
|
|
39
39
|
*/
|
|
40
|
-
|
|
40
|
+
expires_at: number;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
/**
|
|
@@ -63,11 +63,11 @@ export interface ContactLinkRecord {
|
|
|
63
63
|
/**
|
|
64
64
|
* link 创建时间戳。
|
|
65
65
|
*/
|
|
66
|
-
|
|
66
|
+
created_at: number;
|
|
67
67
|
/**
|
|
68
68
|
* link 过期时间戳。
|
|
69
69
|
*/
|
|
70
|
-
|
|
70
|
+
expires_at: number;
|
|
71
71
|
/**
|
|
72
72
|
* link 被使用的时间戳。
|
|
73
73
|
*/
|
package/src/image/ImagePlugin.ts
CHANGED
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
* 关键点(中文)
|
|
5
5
|
* - 对 Agent 暴露 `image_create` / `image_result` 两步式任务 action。
|
|
6
6
|
* - City / provider 的图片能力通过 image_create / image_result 任务函数注入。
|
|
7
|
-
* -
|
|
7
|
+
* - 成功结果返回本地文件 UI Parts,Plugin Action 直接声明应写入的 Assistant Message。
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import fs from "node:fs/promises";
|
|
11
11
|
import path from "node:path";
|
|
12
12
|
import { z } from "zod";
|
|
13
|
-
import {
|
|
13
|
+
import { create_action } from "@downcity/agent";
|
|
14
14
|
import { BasePlugin } from "@downcity/agent";
|
|
15
|
-
import type {
|
|
15
|
+
import type { PluginContext } from "@downcity/agent";
|
|
16
16
|
import type {
|
|
17
17
|
JsonObject,
|
|
18
18
|
JsonValue,
|
|
@@ -234,7 +234,7 @@ async function local_image_to_data_url(input: {
|
|
|
234
234
|
* 归一化单个图片内容片段。
|
|
235
235
|
*/
|
|
236
236
|
async function normalize_image_content_part(
|
|
237
|
-
context:
|
|
237
|
+
context: PluginContext,
|
|
238
238
|
part: ImagePluginContent,
|
|
239
239
|
): Promise<ImagePluginResolvedContent> {
|
|
240
240
|
if (part.type === "text") return part;
|
|
@@ -253,7 +253,7 @@ async function normalize_image_content_part(
|
|
|
253
253
|
};
|
|
254
254
|
}
|
|
255
255
|
const local = await local_image_to_data_url({
|
|
256
|
-
root_path: context.
|
|
256
|
+
root_path: context.workspace_path,
|
|
257
257
|
image_url: url,
|
|
258
258
|
media_type: part.media_type,
|
|
259
259
|
});
|
|
@@ -299,7 +299,7 @@ function copy_resolved_image_input(input: ImagePluginInput): ImagePluginResolved
|
|
|
299
299
|
* 把 Agent 友好的公开输入转成 City 图片任务使用的输入。
|
|
300
300
|
*/
|
|
301
301
|
async function normalize_image_create_input(
|
|
302
|
-
context:
|
|
302
|
+
context: PluginContext,
|
|
303
303
|
input: ImagePluginInput,
|
|
304
304
|
): Promise<ImagePluginResolvedInput> {
|
|
305
305
|
assert_public_image_create_input(input);
|
|
@@ -323,7 +323,7 @@ async function normalize_image_create_input(
|
|
|
323
323
|
* 为图片创建输入解析并补齐插件级默认模型。
|
|
324
324
|
*/
|
|
325
325
|
async function apply_default_image_model(
|
|
326
|
-
context:
|
|
326
|
+
context: PluginContext,
|
|
327
327
|
input: ImagePluginResolvedInput,
|
|
328
328
|
default_model: ImagePluginDefaultModel | undefined,
|
|
329
329
|
): Promise<ImagePluginResolvedInput> {
|
|
@@ -392,6 +392,16 @@ function normalize_image_result(result: ImagePluginResult): ImagePluginResult {
|
|
|
392
392
|
if (!record || !Array.isArray(record.parts)) {
|
|
393
393
|
throw new TypeError("ImagePlugin image provider must return an AI SDK UIMessage");
|
|
394
394
|
}
|
|
395
|
+
for (const part of record.parts) {
|
|
396
|
+
const part_record = to_record(part);
|
|
397
|
+
if (part_record?.type !== "file") continue;
|
|
398
|
+
const url = String(part_record.url || "").trim();
|
|
399
|
+
if (!url || url.startsWith("data:") || HTTP_URL_RE.test(url)) {
|
|
400
|
+
throw new TypeError(
|
|
401
|
+
"ImagePlugin result file parts must be saved locally before returning",
|
|
402
|
+
);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
395
405
|
return result;
|
|
396
406
|
}
|
|
397
407
|
|
|
@@ -525,7 +535,7 @@ export class ImagePlugin extends BasePlugin {
|
|
|
525
535
|
/**
|
|
526
536
|
* 图片插件给模型的使用说明。
|
|
527
537
|
*/
|
|
528
|
-
system(_context:
|
|
538
|
+
system(_context: PluginContext): string {
|
|
529
539
|
return [
|
|
530
540
|
"# Image Plugin",
|
|
531
541
|
"",
|
|
@@ -611,7 +621,7 @@ export class ImagePlugin extends BasePlugin {
|
|
|
611
621
|
* 显式 action 集合。
|
|
612
622
|
*/
|
|
613
623
|
readonly actions = {
|
|
614
|
-
models:
|
|
624
|
+
models: create_action({
|
|
615
625
|
description: "List image-capable models available to ImagePlugin.",
|
|
616
626
|
input_schema: z.object({}).passthrough(),
|
|
617
627
|
execute: async () => {
|
|
@@ -639,7 +649,7 @@ export class ImagePlugin extends BasePlugin {
|
|
|
639
649
|
}
|
|
640
650
|
},
|
|
641
651
|
}),
|
|
642
|
-
image_create:
|
|
652
|
+
image_create: create_action({
|
|
643
653
|
description:
|
|
644
654
|
"Create an async image job only after explicit user confirmation because image creation consumes quota. Use prompt for text-only generation, or content for reference images and edits.",
|
|
645
655
|
input_schema: {
|
|
@@ -711,7 +721,7 @@ export class ImagePlugin extends BasePlugin {
|
|
|
711
721
|
},
|
|
712
722
|
},
|
|
713
723
|
],
|
|
714
|
-
execute: async ({ context, input }: { context:
|
|
724
|
+
execute: async ({ context, input }: { context: PluginContext; input: JsonValue }) => {
|
|
715
725
|
try {
|
|
716
726
|
const normalized_payload = normalize_image_payload(input);
|
|
717
727
|
const normalized_input = await apply_default_image_model(
|
|
@@ -735,7 +745,7 @@ export class ImagePlugin extends BasePlugin {
|
|
|
735
745
|
}
|
|
736
746
|
},
|
|
737
747
|
}),
|
|
738
|
-
image_result:
|
|
748
|
+
image_result: create_action({
|
|
739
749
|
description:
|
|
740
750
|
"Read an async image job. By default reads once; pass until_done=true to block-wait until succeeded/failed or max_wait_ms times out.",
|
|
741
751
|
input_schema: {
|
|
@@ -794,16 +804,22 @@ export class ImagePlugin extends BasePlugin {
|
|
|
794
804
|
message: current.error ?? current.message ?? "image job failed",
|
|
795
805
|
};
|
|
796
806
|
}
|
|
797
|
-
const
|
|
798
|
-
? current.result as unknown as JsonObject
|
|
799
|
-
: current as unknown as JsonObject;
|
|
807
|
+
const { result, ...job } = current;
|
|
800
808
|
return {
|
|
801
809
|
success: true,
|
|
802
|
-
data,
|
|
810
|
+
data: job as unknown as JsonObject,
|
|
803
811
|
message:
|
|
804
812
|
current.status === "succeeded"
|
|
805
813
|
? "image generated"
|
|
806
814
|
: `image job ${current.status}`,
|
|
815
|
+
...(current.status === "succeeded" && result
|
|
816
|
+
? {
|
|
817
|
+
messages: [{
|
|
818
|
+
role: "assistant" as const,
|
|
819
|
+
parts: result.parts,
|
|
820
|
+
}],
|
|
821
|
+
}
|
|
822
|
+
: {}),
|
|
807
823
|
};
|
|
808
824
|
} catch (error) {
|
|
809
825
|
return {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* 关键点(中文)
|
|
5
5
|
* - 这里仅定义图片 plugin 对图片能力的最低层协议,不绑定 city 或任意上游 provider。
|
|
6
6
|
* - 图片成功结果使用 AI SDK UIMessage,保证 session 落盘格式与现有消息系统一致。
|
|
7
|
-
* - 字段保持 JSON 可序列化,便于通过
|
|
7
|
+
* - 字段保持 JSON 可序列化,便于通过 Plugin Action 与 Tool 传递。
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import type { UIMessage } from "ai";
|
|
@@ -12,7 +12,7 @@ import type {
|
|
|
12
12
|
JsonObject,
|
|
13
13
|
JsonValue,
|
|
14
14
|
} from "@downcity/agent";
|
|
15
|
-
import type {
|
|
15
|
+
import type { PluginContext } from "@downcity/agent";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* 图片生成文本内容片段。
|
|
@@ -243,7 +243,7 @@ export interface ImagePluginModelsResult {
|
|
|
243
243
|
*/
|
|
244
244
|
export interface ImagePluginDefaultModelResolverInput {
|
|
245
245
|
/** 当前 Agent 运行上下文,可用于读取项目根目录、会话上下文或宿主状态。 */
|
|
246
|
-
context:
|
|
246
|
+
context: PluginContext;
|
|
247
247
|
/** 已解析后的图片生成输入,可用于根据 prompt、messages、尺寸或质量选择模型。 */
|
|
248
248
|
input: ImagePluginResolvedInput;
|
|
249
249
|
}
|