@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/memory/Action.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import type { UIDataTypes, UIMessagePart, UITools } from "ai";
|
|
11
11
|
import { isTextUIPart } from "ai";
|
|
12
12
|
import type { PluginActionResult } from "@downcity/agent";
|
|
13
|
-
import type {
|
|
13
|
+
import type { PluginContext } from "@downcity/agent";
|
|
14
14
|
import type { JsonValue } from "@downcity/agent";
|
|
15
15
|
import type { SessionMessage } from "@downcity/agent";
|
|
16
16
|
import type {
|
|
@@ -141,7 +141,7 @@ function toWikiMemoryPath(value: string): string {
|
|
|
141
141
|
* status action。
|
|
142
142
|
*/
|
|
143
143
|
export async function statusMemoryAction(
|
|
144
|
-
context:
|
|
144
|
+
context: PluginContext,
|
|
145
145
|
state: MemoryRuntimeState,
|
|
146
146
|
): Promise<PluginActionResult<JsonValue>> {
|
|
147
147
|
try {
|
|
@@ -162,7 +162,7 @@ export async function statusMemoryAction(
|
|
|
162
162
|
* search action。
|
|
163
163
|
*/
|
|
164
164
|
export async function searchMemoryAction(
|
|
165
|
-
context:
|
|
165
|
+
context: PluginContext,
|
|
166
166
|
state: MemoryRuntimeState,
|
|
167
167
|
payload: MemorySearchPayload,
|
|
168
168
|
): Promise<PluginActionResult<JsonValue>> {
|
|
@@ -184,7 +184,7 @@ export async function searchMemoryAction(
|
|
|
184
184
|
* read action。
|
|
185
185
|
*/
|
|
186
186
|
export async function readMemoryAction(
|
|
187
|
-
context:
|
|
187
|
+
context: PluginContext,
|
|
188
188
|
payload: MemoryReadPayload,
|
|
189
189
|
): Promise<PluginActionResult<JsonValue>> {
|
|
190
190
|
try {
|
|
@@ -202,7 +202,7 @@ export async function readMemoryAction(
|
|
|
202
202
|
* remember action。
|
|
203
203
|
*/
|
|
204
204
|
export async function rememberMemoryAction(
|
|
205
|
-
context:
|
|
205
|
+
context: PluginContext,
|
|
206
206
|
options: MemoryPluginOptions,
|
|
207
207
|
payload: MemoryRememberPayload,
|
|
208
208
|
): Promise<PluginActionResult<JsonValue>> {
|
|
@@ -221,7 +221,7 @@ export async function rememberMemoryAction(
|
|
|
221
221
|
}));
|
|
222
222
|
const revised = readReviseResult(
|
|
223
223
|
await options.revise({
|
|
224
|
-
rootPath: context.
|
|
224
|
+
rootPath: context.workspace_path,
|
|
225
225
|
path: targetPath,
|
|
226
226
|
currentContent: current.text,
|
|
227
227
|
instruction: "Integrate this new memory into the wiki page. Deduplicate and keep it concise.",
|
|
@@ -270,19 +270,19 @@ export async function rememberMemoryAction(
|
|
|
270
270
|
* digest action。
|
|
271
271
|
*/
|
|
272
272
|
export async function digestMemoryAction(
|
|
273
|
-
context:
|
|
273
|
+
context: PluginContext,
|
|
274
274
|
options: MemoryPluginOptions,
|
|
275
275
|
payload: MemoryDigestPayload,
|
|
276
276
|
): Promise<PluginActionResult<JsonValue>> {
|
|
277
277
|
try {
|
|
278
|
-
const
|
|
279
|
-
if (!
|
|
280
|
-
throw new Error("
|
|
278
|
+
const session_id = String(payload.session_id || "").trim();
|
|
279
|
+
if (!session_id) {
|
|
280
|
+
throw new Error("session_id is required");
|
|
281
281
|
}
|
|
282
282
|
const maxMessages = Number.isFinite(payload.maxMessages)
|
|
283
283
|
? Math.max(1, Math.floor(payload.maxMessages as number))
|
|
284
284
|
: 30;
|
|
285
|
-
const snapshot = await context.sessions.runtime(
|
|
285
|
+
const snapshot = await context.sessions.runtime(session_id).context();
|
|
286
286
|
const total = snapshot.messages.length;
|
|
287
287
|
const start = Math.max(0, total - maxMessages);
|
|
288
288
|
const messages = snapshot.messages.slice(start);
|
|
@@ -298,16 +298,16 @@ export async function digestMemoryAction(
|
|
|
298
298
|
"",
|
|
299
299
|
transcript,
|
|
300
300
|
].join("\n");
|
|
301
|
-
const source = await writeSessionSource(context,
|
|
301
|
+
const source = await writeSessionSource(context, session_id, sourceText);
|
|
302
302
|
|
|
303
303
|
if (options.digest) {
|
|
304
304
|
const wikiIndex = await readWikiIndex(context);
|
|
305
305
|
const digested = readDigestPages(
|
|
306
306
|
await options.digest({
|
|
307
|
-
rootPath: context.
|
|
307
|
+
rootPath: context.workspace_path,
|
|
308
308
|
sourceText,
|
|
309
309
|
sourcePath: source.path,
|
|
310
|
-
|
|
310
|
+
session_id,
|
|
311
311
|
wikiIndex,
|
|
312
312
|
}),
|
|
313
313
|
);
|
|
@@ -319,7 +319,7 @@ export async function digestMemoryAction(
|
|
|
319
319
|
const response: MemoryDigestResponse = {
|
|
320
320
|
sourcePath: source.path,
|
|
321
321
|
wikiPaths,
|
|
322
|
-
|
|
322
|
+
message_count: lines.length,
|
|
323
323
|
mode: "digested",
|
|
324
324
|
summary: digested.summary,
|
|
325
325
|
};
|
|
@@ -335,7 +335,7 @@ export async function digestMemoryAction(
|
|
|
335
335
|
const response: MemoryDigestResponse = {
|
|
336
336
|
sourcePath: source.path,
|
|
337
337
|
wikiPaths: [written.path],
|
|
338
|
-
|
|
338
|
+
message_count: lines.length,
|
|
339
339
|
mode: "archived",
|
|
340
340
|
};
|
|
341
341
|
return { success: true, data: response as unknown as JsonValue };
|
|
@@ -351,7 +351,7 @@ export async function digestMemoryAction(
|
|
|
351
351
|
* revise action。
|
|
352
352
|
*/
|
|
353
353
|
export async function reviseMemoryAction(
|
|
354
|
-
context:
|
|
354
|
+
context: PluginContext,
|
|
355
355
|
options: MemoryPluginOptions,
|
|
356
356
|
payload: MemoryRevisePayload,
|
|
357
357
|
): Promise<PluginActionResult<JsonValue>> {
|
|
@@ -372,7 +372,7 @@ export async function reviseMemoryAction(
|
|
|
372
372
|
}));
|
|
373
373
|
const revised = readReviseResult(
|
|
374
374
|
await options.revise({
|
|
375
|
-
rootPath: context.
|
|
375
|
+
rootPath: context.workspace_path,
|
|
376
376
|
path: targetPath,
|
|
377
377
|
currentContent: current.text,
|
|
378
378
|
instruction,
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
|
|
10
10
|
import type { Command } from "commander";
|
|
11
11
|
import type { JsonObject, JsonValue } from "@downcity/agent";
|
|
12
|
-
import type {
|
|
12
|
+
import type { PluginContext } from "@downcity/agent";
|
|
13
13
|
import type { PluginActions } from "@downcity/agent";
|
|
14
14
|
import { BasePlugin } from "@downcity/agent";
|
|
15
|
-
import {
|
|
15
|
+
import { create_action } from "@downcity/agent";
|
|
16
16
|
import { z } from "zod";
|
|
17
17
|
import {
|
|
18
18
|
digestMemoryAction,
|
|
@@ -105,7 +105,7 @@ export class MemoryPlugin extends BasePlugin {
|
|
|
105
105
|
/**
|
|
106
106
|
* 当前 plugin 的 system 文本提供器。
|
|
107
107
|
*/
|
|
108
|
-
async system(context:
|
|
108
|
+
async system(context: PluginContext): Promise<string> {
|
|
109
109
|
return await buildMemoryPluginSystemText(context);
|
|
110
110
|
}
|
|
111
111
|
|
|
@@ -113,8 +113,8 @@ export class MemoryPlugin extends BasePlugin {
|
|
|
113
113
|
* 当前 plugin 生命周期。
|
|
114
114
|
*/
|
|
115
115
|
readonly lifecycle = {
|
|
116
|
-
start: async (context:
|
|
117
|
-
await ensureMemoryDirectories(context.
|
|
116
|
+
start: async (context: PluginContext): Promise<void> => {
|
|
117
|
+
await ensureMemoryDirectories(context.workspace_path);
|
|
118
118
|
this.getOrCreateRuntimeState(context);
|
|
119
119
|
},
|
|
120
120
|
stop: async (): Promise<void> => {
|
|
@@ -126,7 +126,7 @@ export class MemoryPlugin extends BasePlugin {
|
|
|
126
126
|
* 当前 plugin action 定义表。
|
|
127
127
|
*/
|
|
128
128
|
readonly actions: PluginActions = {
|
|
129
|
-
status:
|
|
129
|
+
status: create_action({
|
|
130
130
|
description: "View memory wiki status (wiki/source/working).",
|
|
131
131
|
input_schema: {
|
|
132
132
|
zod: z.object({}).passthrough(),
|
|
@@ -135,7 +135,7 @@ export class MemoryPlugin extends BasePlugin {
|
|
|
135
135
|
examples: [{ title: "View status", payload: {} }],
|
|
136
136
|
command: {
|
|
137
137
|
description: "View memory wiki status (wiki/source/working).",
|
|
138
|
-
|
|
138
|
+
map_input() {
|
|
139
139
|
return {};
|
|
140
140
|
},
|
|
141
141
|
},
|
|
@@ -144,7 +144,7 @@ export class MemoryPlugin extends BasePlugin {
|
|
|
144
144
|
return await statusMemoryAction(params.context, state);
|
|
145
145
|
},
|
|
146
146
|
}),
|
|
147
|
-
search:
|
|
147
|
+
search: create_action({
|
|
148
148
|
description: "Search memory wiki, optionally extending into the source layer.",
|
|
149
149
|
input_schema: {
|
|
150
150
|
zod: z.object({
|
|
@@ -176,7 +176,7 @@ export class MemoryPlugin extends BasePlugin {
|
|
|
176
176
|
.option("--min-score <number>", "Minimum relevance score.", parseNumber)
|
|
177
177
|
.option("--include-sources", "Also search the raw source layer.");
|
|
178
178
|
},
|
|
179
|
-
|
|
179
|
+
map_input({ args, opts }) {
|
|
180
180
|
const payload: JsonObject = {
|
|
181
181
|
query: String(args[0] || ""),
|
|
182
182
|
};
|
|
@@ -203,7 +203,7 @@ export class MemoryPlugin extends BasePlugin {
|
|
|
203
203
|
});
|
|
204
204
|
},
|
|
205
205
|
}),
|
|
206
|
-
read:
|
|
206
|
+
read: create_action({
|
|
207
207
|
description: "Read a memory wiki/source file excerpt.",
|
|
208
208
|
input_schema: {
|
|
209
209
|
zod: z.object({
|
|
@@ -232,7 +232,7 @@ export class MemoryPlugin extends BasePlugin {
|
|
|
232
232
|
.option("--from <number>", "Starting line, 1-based.", parsePositiveInteger)
|
|
233
233
|
.option("--lines <number>", "Number of lines to read.", parsePositiveInteger);
|
|
234
234
|
},
|
|
235
|
-
|
|
235
|
+
map_input({ args, opts }) {
|
|
236
236
|
const payload: JsonObject = {
|
|
237
237
|
path: String(args[0] || ""),
|
|
238
238
|
};
|
|
@@ -254,7 +254,7 @@ export class MemoryPlugin extends BasePlugin {
|
|
|
254
254
|
});
|
|
255
255
|
},
|
|
256
256
|
}),
|
|
257
|
-
remember:
|
|
257
|
+
remember: create_action({
|
|
258
258
|
description: "Record facts, preferences, or decisions into memory wiki.",
|
|
259
259
|
input_schema: {
|
|
260
260
|
zod: z.object({
|
|
@@ -286,7 +286,7 @@ export class MemoryPlugin extends BasePlugin {
|
|
|
286
286
|
.option("--wiki-path <path>", "Target wiki page path.")
|
|
287
287
|
.option("--source <source>", "Source note.");
|
|
288
288
|
},
|
|
289
|
-
|
|
289
|
+
map_input({ opts }) {
|
|
290
290
|
const payload: JsonObject = {
|
|
291
291
|
content: String(opts.content || ""),
|
|
292
292
|
};
|
|
@@ -312,35 +312,35 @@ export class MemoryPlugin extends BasePlugin {
|
|
|
312
312
|
});
|
|
313
313
|
},
|
|
314
314
|
}),
|
|
315
|
-
digest:
|
|
315
|
+
digest: create_action({
|
|
316
316
|
description: "Digest a session into memory wiki.",
|
|
317
317
|
input_schema: {
|
|
318
318
|
zod: z.object({
|
|
319
|
-
|
|
319
|
+
session_id: z.string(),
|
|
320
320
|
maxMessages: z.number().optional(),
|
|
321
321
|
}),
|
|
322
322
|
json_schema: {
|
|
323
323
|
type: "object",
|
|
324
|
-
required: ["
|
|
324
|
+
required: ["session_id"],
|
|
325
325
|
properties: {
|
|
326
|
-
|
|
326
|
+
session_id: { type: "string", description: "Session ID." },
|
|
327
327
|
maxMessages: { type: "number", description: "Message extraction window." },
|
|
328
328
|
},
|
|
329
329
|
},
|
|
330
330
|
},
|
|
331
331
|
examples: [
|
|
332
|
-
{ title: "Digest session", payload: {
|
|
332
|
+
{ title: "Digest session", payload: { session_id: "sess-1" } },
|
|
333
333
|
],
|
|
334
334
|
command: {
|
|
335
335
|
description: "Digest a session into memory wiki.",
|
|
336
336
|
configure(command: Command) {
|
|
337
337
|
command
|
|
338
|
-
.requiredOption("--session-id <
|
|
338
|
+
.requiredOption("--session-id <session_id>", "Session ID.")
|
|
339
339
|
.option("--max-messages <number>", "Message extraction window.", parsePositiveInteger);
|
|
340
340
|
},
|
|
341
|
-
|
|
341
|
+
map_input({ opts }) {
|
|
342
342
|
const payload: JsonObject = {
|
|
343
|
-
|
|
343
|
+
session_id: String(opts.session_id || ""),
|
|
344
344
|
};
|
|
345
345
|
if (typeof opts.maxMessages === "number") {
|
|
346
346
|
payload.maxMessages = opts.maxMessages;
|
|
@@ -351,12 +351,12 @@ export class MemoryPlugin extends BasePlugin {
|
|
|
351
351
|
execute: async (params) => {
|
|
352
352
|
const body = readBodyObject(params.input);
|
|
353
353
|
return await digestMemoryAction(params.context, this.options, {
|
|
354
|
-
|
|
354
|
+
session_id: readString(body, "session_id"),
|
|
355
355
|
maxMessages: readOptionalNumber(body, "maxMessages"),
|
|
356
356
|
});
|
|
357
357
|
},
|
|
358
358
|
}),
|
|
359
|
-
revise:
|
|
359
|
+
revise: create_action({
|
|
360
360
|
description: "Revise a memory wiki page based on new evidence.",
|
|
361
361
|
input_schema: {
|
|
362
362
|
zod: z.object({
|
|
@@ -388,7 +388,7 @@ export class MemoryPlugin extends BasePlugin {
|
|
|
388
388
|
.requiredOption("--instruction <text>", "Revision instruction.")
|
|
389
389
|
.option("--evidence <text>", "New evidence.");
|
|
390
390
|
},
|
|
391
|
-
|
|
391
|
+
map_input({ args, opts }) {
|
|
392
392
|
const payload: JsonObject = {
|
|
393
393
|
path: String(args[0] || ""),
|
|
394
394
|
instruction: String(opts.instruction || ""),
|
|
@@ -413,7 +413,7 @@ export class MemoryPlugin extends BasePlugin {
|
|
|
413
413
|
/**
|
|
414
414
|
* 获取或创建当前实例绑定的 memory plugin state。
|
|
415
415
|
*/
|
|
416
|
-
private getOrCreateRuntimeState(context:
|
|
416
|
+
private getOrCreateRuntimeState(context: PluginContext): MemoryRuntimeState {
|
|
417
417
|
if (!this.runtimeState) {
|
|
418
418
|
this.runtimeState = createMemoryRuntimeState(context);
|
|
419
419
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import fs from "node:fs/promises";
|
|
10
|
-
import type {
|
|
10
|
+
import type { PluginContext } from "@downcity/agent";
|
|
11
11
|
import type {
|
|
12
12
|
MemorySearchPayload,
|
|
13
13
|
MemorySearchResponse,
|
|
@@ -148,7 +148,7 @@ function chunkMarkdown(content: string): Array<{
|
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
async function readMemoryChunks(
|
|
151
|
-
context:
|
|
151
|
+
context: PluginContext,
|
|
152
152
|
options: { includeSources?: boolean },
|
|
153
153
|
): Promise<Array<{
|
|
154
154
|
path: string;
|
|
@@ -157,7 +157,7 @@ async function readMemoryChunks(
|
|
|
157
157
|
endLine: number;
|
|
158
158
|
text: string;
|
|
159
159
|
}>> {
|
|
160
|
-
const files = await listMemorySourceFiles(context.
|
|
160
|
+
const files = await listMemorySourceFiles(context.workspace_path, options);
|
|
161
161
|
const out: Array<{
|
|
162
162
|
path: string;
|
|
163
163
|
source: "wiki" | "source" | "working";
|
|
@@ -184,11 +184,11 @@ async function readMemoryChunks(
|
|
|
184
184
|
* 收集当前 memory Markdown 状态。
|
|
185
185
|
*/
|
|
186
186
|
export async function collectMemoryStatus(
|
|
187
|
-
context:
|
|
187
|
+
context: PluginContext,
|
|
188
188
|
state: MemoryRuntimeState,
|
|
189
189
|
): Promise<MemoryStatusResponse> {
|
|
190
190
|
void state;
|
|
191
|
-
const files = await listMemorySourceFiles(context.
|
|
191
|
+
const files = await listMemorySourceFiles(context.workspace_path, {
|
|
192
192
|
includeSources: true,
|
|
193
193
|
});
|
|
194
194
|
const sourceCounts: MemorySourceStat[] = [
|
|
@@ -224,7 +224,7 @@ export async function collectMemoryStatus(
|
|
|
224
224
|
* 执行检索。
|
|
225
225
|
*/
|
|
226
226
|
export async function searchMemory(
|
|
227
|
-
context:
|
|
227
|
+
context: PluginContext,
|
|
228
228
|
state: MemoryRuntimeState,
|
|
229
229
|
payload: MemorySearchPayload,
|
|
230
230
|
): Promise<MemorySearchResponse> {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import type { Dirent } from "node:fs";
|
|
11
11
|
import fsp from "node:fs/promises";
|
|
12
12
|
import path from "node:path";
|
|
13
|
-
import type {
|
|
13
|
+
import type { PluginContext } from "@downcity/agent";
|
|
14
14
|
import type {
|
|
15
15
|
MemoryDefaults,
|
|
16
16
|
MemorySourceType,
|
|
@@ -150,9 +150,9 @@ export async function listMemorySourceFiles(
|
|
|
150
150
|
* 创建一个新的 memory plugin state。
|
|
151
151
|
*/
|
|
152
152
|
export function createMemoryRuntimeState(
|
|
153
|
-
context:
|
|
153
|
+
context: PluginContext,
|
|
154
154
|
): MemoryRuntimeState {
|
|
155
155
|
return {
|
|
156
|
-
rootPath: context.
|
|
156
|
+
rootPath: context.workspace_path,
|
|
157
157
|
};
|
|
158
158
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import fs from "node:fs/promises";
|
|
11
11
|
import path from "node:path";
|
|
12
|
-
import type {
|
|
12
|
+
import type { PluginContext } from "@downcity/agent";
|
|
13
13
|
|
|
14
14
|
const MAX_SYSTEM_MEMORY_ITEMS = 6;
|
|
15
15
|
const MAX_SYSTEM_MEMORY_ITEM_CHARS = 260;
|
|
@@ -52,9 +52,9 @@ function extractStableLines(content: string): string[] {
|
|
|
52
52
|
* 从 wiki 中提取少量稳定记忆。
|
|
53
53
|
*/
|
|
54
54
|
export async function readStableSystemMemory(
|
|
55
|
-
context:
|
|
55
|
+
context: PluginContext,
|
|
56
56
|
): Promise<string[]> {
|
|
57
|
-
const wikiRoot = path.join(context.
|
|
57
|
+
const wikiRoot = path.join(context.workspace_path, ".downcity", "memory", "wiki");
|
|
58
58
|
const candidates = [
|
|
59
59
|
"index.md",
|
|
60
60
|
"user-preferences.md",
|
|
@@ -88,7 +88,7 @@ export async function readStableSystemMemory(
|
|
|
88
88
|
* 构建 memory plugin 的 system 文本。
|
|
89
89
|
*/
|
|
90
90
|
export async function buildMemoryPluginSystemText(
|
|
91
|
-
context:
|
|
91
|
+
context: PluginContext,
|
|
92
92
|
): Promise<string> {
|
|
93
93
|
const stableMemory = await readStableSystemMemory(context);
|
|
94
94
|
return [
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import fs from "node:fs/promises";
|
|
11
11
|
import path from "node:path";
|
|
12
|
-
import type {
|
|
12
|
+
import type { PluginContext } from "@downcity/agent";
|
|
13
13
|
import type {
|
|
14
14
|
MemoryReadPayload,
|
|
15
15
|
MemoryReadResponse,
|
|
@@ -56,11 +56,11 @@ function normalizeMarkdownPath(value: string): string {
|
|
|
56
56
|
return clean.toLowerCase().endsWith(".md") ? clean : `${clean}.md`;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
function resolveWikiPath(context:
|
|
59
|
+
function resolveWikiPath(context: PluginContext, requestedPath?: string, title?: string): {
|
|
60
60
|
absPath: string;
|
|
61
61
|
relPath: string;
|
|
62
62
|
} {
|
|
63
|
-
const memoryRoot = path.join(context.
|
|
63
|
+
const memoryRoot = path.join(context.workspace_path, ".downcity", "memory");
|
|
64
64
|
const wikiRoot = path.join(memoryRoot, "wiki");
|
|
65
65
|
const normalized = normalizeMarkdownPath(requestedPath || slugify(title || "inbox"));
|
|
66
66
|
const withoutPrefix = normalized
|
|
@@ -72,17 +72,17 @@ function resolveWikiPath(context: AgentContext, requestedPath?: string, title?:
|
|
|
72
72
|
}
|
|
73
73
|
return {
|
|
74
74
|
absPath,
|
|
75
|
-
relPath: toRelPath(context.
|
|
75
|
+
relPath: toRelPath(context.workspace_path, absPath),
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
function resolveAllowedReadPath(context:
|
|
79
|
+
function resolveAllowedReadPath(context: PluginContext, relPath: string): string {
|
|
80
80
|
const normalized = relPath.replace(/\\/g, "/").replace(/^\/+/, "").trim();
|
|
81
81
|
if (!normalized) {
|
|
82
82
|
throw new Error("path is required");
|
|
83
83
|
}
|
|
84
|
-
const absPath = path.resolve(context.
|
|
85
|
-
const memoryRoot = path.resolve(path.join(context.
|
|
84
|
+
const absPath = path.resolve(context.workspace_path, normalized);
|
|
85
|
+
const memoryRoot = path.resolve(path.join(context.workspace_path, ".downcity", "memory"));
|
|
86
86
|
const isMemoryPath = isWithin(memoryRoot, absPath);
|
|
87
87
|
if (!isMemoryPath) {
|
|
88
88
|
throw new Error("path is not allowed");
|
|
@@ -180,7 +180,7 @@ export async function ensureMemoryDirectories(rootPath: string): Promise<void> {
|
|
|
180
180
|
* 读取指定记忆文件(支持行区间)。
|
|
181
181
|
*/
|
|
182
182
|
export async function readMemory(
|
|
183
|
-
context:
|
|
183
|
+
context: PluginContext,
|
|
184
184
|
payload: MemoryReadPayload,
|
|
185
185
|
): Promise<MemoryReadResponse> {
|
|
186
186
|
const requestedPath = String(payload.path || "").trim();
|
|
@@ -188,7 +188,7 @@ export async function readMemory(
|
|
|
188
188
|
throw new Error("path is required");
|
|
189
189
|
}
|
|
190
190
|
const absPath = resolveAllowedReadPath(context, requestedPath);
|
|
191
|
-
const relPath = toRelPath(context.
|
|
191
|
+
const relPath = toRelPath(context.workspace_path, absPath);
|
|
192
192
|
const exists = await fs
|
|
193
193
|
.access(absPath)
|
|
194
194
|
.then(() => true)
|
|
@@ -212,8 +212,8 @@ export async function readMemory(
|
|
|
212
212
|
/**
|
|
213
213
|
* 读取 wiki index 内容。
|
|
214
214
|
*/
|
|
215
|
-
export async function readWikiIndex(context:
|
|
216
|
-
const indexPath = path.join(context.
|
|
215
|
+
export async function readWikiIndex(context: PluginContext): Promise<string> {
|
|
216
|
+
const indexPath = path.join(context.workspace_path, ".downcity", "memory", "wiki", "index.md");
|
|
217
217
|
return await readTextIfExists(indexPath);
|
|
218
218
|
}
|
|
219
219
|
|
|
@@ -221,12 +221,12 @@ export async function readWikiIndex(context: AgentContext): Promise<string> {
|
|
|
221
221
|
* 归档手动 source。
|
|
222
222
|
*/
|
|
223
223
|
export async function appendManualSource(
|
|
224
|
-
context:
|
|
224
|
+
context: PluginContext,
|
|
225
225
|
content: string,
|
|
226
226
|
source?: string,
|
|
227
227
|
): Promise<{ path: string; writtenChars: number }> {
|
|
228
228
|
const absPath = path.join(
|
|
229
|
-
context.
|
|
229
|
+
context.workspace_path,
|
|
230
230
|
".downcity",
|
|
231
231
|
"memory",
|
|
232
232
|
"sources",
|
|
@@ -237,7 +237,7 @@ export async function appendManualSource(
|
|
|
237
237
|
const entry = buildSourceEntry(content, source);
|
|
238
238
|
await fs.appendFile(absPath, `\n${entry}`, "utf-8");
|
|
239
239
|
return {
|
|
240
|
-
path: toRelPath(context.
|
|
240
|
+
path: toRelPath(context.workspace_path, absPath),
|
|
241
241
|
writtenChars: entry.length,
|
|
242
242
|
};
|
|
243
243
|
}
|
|
@@ -246,13 +246,13 @@ export async function appendManualSource(
|
|
|
246
246
|
* 写入 session source。
|
|
247
247
|
*/
|
|
248
248
|
export async function writeSessionSource(
|
|
249
|
-
context:
|
|
250
|
-
|
|
249
|
+
context: PluginContext,
|
|
250
|
+
session_id: string,
|
|
251
251
|
content: string,
|
|
252
252
|
): Promise<{ path: string; writtenChars: number }> {
|
|
253
|
-
const safeSessionId = slugify(
|
|
253
|
+
const safeSessionId = slugify(session_id);
|
|
254
254
|
const absPath = path.join(
|
|
255
|
-
context.
|
|
255
|
+
context.workspace_path,
|
|
256
256
|
".downcity",
|
|
257
257
|
"memory",
|
|
258
258
|
"sources",
|
|
@@ -261,12 +261,12 @@ export async function writeSessionSource(
|
|
|
261
261
|
);
|
|
262
262
|
const text = [
|
|
263
263
|
"---",
|
|
264
|
-
`title: ${JSON.stringify(`Session ${
|
|
264
|
+
`title: ${JSON.stringify(`Session ${session_id}`)}`,
|
|
265
265
|
`date: ${dateStamp()}`,
|
|
266
266
|
'tags: ["memory-source", "session"]',
|
|
267
267
|
"---",
|
|
268
268
|
"",
|
|
269
|
-
`# Session ${
|
|
269
|
+
`# Session ${session_id}`,
|
|
270
270
|
"",
|
|
271
271
|
content.trim(),
|
|
272
272
|
"",
|
|
@@ -274,7 +274,7 @@ export async function writeSessionSource(
|
|
|
274
274
|
await fs.mkdir(path.dirname(absPath), { recursive: true });
|
|
275
275
|
await fs.writeFile(absPath, text, "utf-8");
|
|
276
276
|
return {
|
|
277
|
-
path: toRelPath(context.
|
|
277
|
+
path: toRelPath(context.workspace_path, absPath),
|
|
278
278
|
writtenChars: text.length,
|
|
279
279
|
};
|
|
280
280
|
}
|
|
@@ -283,7 +283,7 @@ export async function writeSessionSource(
|
|
|
283
283
|
* 写入完整 wiki page。
|
|
284
284
|
*/
|
|
285
285
|
export async function writeWikiPage(
|
|
286
|
-
context:
|
|
286
|
+
context: PluginContext,
|
|
287
287
|
draft: MemoryWikiPageDraft,
|
|
288
288
|
): Promise<{ path: string; writtenChars: number }> {
|
|
289
289
|
const resolved = resolveWikiPath(context, draft.path, draft.title);
|
|
@@ -300,7 +300,7 @@ export async function writeWikiPage(
|
|
|
300
300
|
* 追加写入 wiki page。
|
|
301
301
|
*/
|
|
302
302
|
export async function appendWikiPage(
|
|
303
|
-
context:
|
|
303
|
+
context: PluginContext,
|
|
304
304
|
payload: {
|
|
305
305
|
path?: string;
|
|
306
306
|
title?: string;
|
|
@@ -335,7 +335,7 @@ export async function appendWikiPage(
|
|
|
335
335
|
* 使用 fallback 方式修订 wiki page。
|
|
336
336
|
*/
|
|
337
337
|
export async function appendMemoryRevision(
|
|
338
|
-
context:
|
|
338
|
+
context: PluginContext,
|
|
339
339
|
payload: MemoryRevisePayload,
|
|
340
340
|
): Promise<MemoryReviseResponse> {
|
|
341
341
|
const written = await appendWikiPage(context, {
|
|
@@ -77,7 +77,7 @@ export interface MemoryDigestHandlerInput {
|
|
|
77
77
|
/**
|
|
78
78
|
* 触发 digest 的 session id。
|
|
79
79
|
*/
|
|
80
|
-
|
|
80
|
+
session_id?: string;
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
83
|
* 当前 wiki index 内容,方便模型决定更新哪些页面。
|
|
@@ -372,7 +372,7 @@ export interface MemoryDigestPayload {
|
|
|
372
372
|
/**
|
|
373
373
|
* 目标 session id。
|
|
374
374
|
*/
|
|
375
|
-
|
|
375
|
+
session_id: string;
|
|
376
376
|
|
|
377
377
|
/**
|
|
378
378
|
* 可选最大提取消息条数。
|
|
@@ -397,7 +397,7 @@ export interface MemoryDigestResponse {
|
|
|
397
397
|
/**
|
|
398
398
|
* 参与 digest 的消息条数。
|
|
399
399
|
*/
|
|
400
|
-
|
|
400
|
+
message_count: number;
|
|
401
401
|
|
|
402
402
|
/**
|
|
403
403
|
* 当前 digest 模式。
|
package/src/skill/Action.ts
CHANGED
|
@@ -68,10 +68,10 @@ function findSkill(skills: SkillDefinition[], name: string): SkillDefinition | n
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
function getSkills(
|
|
71
|
-
|
|
71
|
+
project_root: string,
|
|
72
72
|
options?: SkillPluginOptions | null,
|
|
73
73
|
): SkillDefinition[] {
|
|
74
|
-
const root = path.resolve(
|
|
74
|
+
const root = path.resolve(project_root);
|
|
75
75
|
return discoverSkillsSync(root, options);
|
|
76
76
|
}
|
|
77
77
|
|
|
@@ -79,11 +79,11 @@ function getSkills(
|
|
|
79
79
|
* 在“已学会(本地可发现)”技能里做精确匹配。
|
|
80
80
|
*/
|
|
81
81
|
export function findLearnedSkillExact(
|
|
82
|
-
|
|
82
|
+
project_root: string,
|
|
83
83
|
query: string,
|
|
84
84
|
options?: SkillPluginOptions | null,
|
|
85
85
|
): SkillSummary | null {
|
|
86
|
-
const skills = getSkills(
|
|
86
|
+
const skills = getSkills(project_root, options);
|
|
87
87
|
const target = findSkillExact(skills, query);
|
|
88
88
|
return target ? toSkillSummary(target) : null;
|
|
89
89
|
}
|
|
@@ -92,7 +92,7 @@ export function findLearnedSkillExact(
|
|
|
92
92
|
* 在“已学会(本地可发现)”技能里做模糊搜索。
|
|
93
93
|
*/
|
|
94
94
|
export function searchLearnedSkills(
|
|
95
|
-
|
|
95
|
+
project_root: string,
|
|
96
96
|
query: string,
|
|
97
97
|
limit: number = 10,
|
|
98
98
|
options?: SkillPluginOptions | null,
|
|
@@ -100,7 +100,7 @@ export function searchLearnedSkills(
|
|
|
100
100
|
const q = String(query || "").trim().toLowerCase();
|
|
101
101
|
if (!q) return [];
|
|
102
102
|
|
|
103
|
-
const skills = getSkills(
|
|
103
|
+
const skills = getSkills(project_root, options);
|
|
104
104
|
const matched = skills.filter((item) => {
|
|
105
105
|
const id = item.id.toLowerCase();
|
|
106
106
|
const name = item.name.toLowerCase();
|
|
@@ -115,10 +115,10 @@ export function searchLearnedSkills(
|
|
|
115
115
|
* 列出当前项目下可发现的全部 skill。
|
|
116
116
|
*/
|
|
117
117
|
export function listSkills(
|
|
118
|
-
|
|
118
|
+
project_root: string,
|
|
119
119
|
options?: SkillPluginOptions | null,
|
|
120
120
|
): SkillListResponse {
|
|
121
|
-
const skills = getSkills(
|
|
121
|
+
const skills = getSkills(project_root, options).map(toSkillSummary);
|
|
122
122
|
return {
|
|
123
123
|
success: true,
|
|
124
124
|
skills,
|
|
@@ -132,7 +132,7 @@ export async function lookupSkill(params: {
|
|
|
132
132
|
/**
|
|
133
133
|
* 项目根目录。
|
|
134
134
|
*/
|
|
135
|
-
|
|
135
|
+
project_root: string;
|
|
136
136
|
/**
|
|
137
137
|
* skill lookup 请求。
|
|
138
138
|
*/
|
|
@@ -142,7 +142,7 @@ export async function lookupSkill(params: {
|
|
|
142
142
|
*/
|
|
143
143
|
options?: SkillPluginOptions | null;
|
|
144
144
|
}): Promise<SkillLookupResponse> {
|
|
145
|
-
const root = path.resolve(params.
|
|
145
|
+
const root = path.resolve(params.project_root);
|
|
146
146
|
const skills = getSkills(root, params.options);
|
|
147
147
|
const target = findSkill(skills, params.request.name);
|
|
148
148
|
if (!target) {
|