@downcity/plugins 1.0.253 → 1.0.280
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/builtin/BuiltinPluginReadmes.d.ts +14 -0
- package/bin/builtin/BuiltinPluginReadmes.d.ts.map +1 -0
- package/bin/builtin/BuiltinPluginReadmes.js +58 -0
- package/bin/builtin/BuiltinPluginReadmes.js.map +1 -0
- package/bin/builtin/BuiltinPluginTypes.d.ts +48 -0
- package/bin/builtin/BuiltinPluginTypes.d.ts.map +1 -0
- package/bin/builtin/BuiltinPluginTypes.js +161 -0
- package/bin/builtin/BuiltinPluginTypes.js.map +1 -0
- package/bin/builtin/PluginSettingsDefinitions.d.ts +9 -0
- package/bin/builtin/PluginSettingsDefinitions.d.ts.map +1 -0
- package/bin/builtin/PluginSettingsDefinitions.js +41 -0
- package/bin/builtin/PluginSettingsDefinitions.js.map +1 -0
- package/bin/builtin/main/PluginSettingsMain.d.ts +6 -0
- package/bin/builtin/main/PluginSettingsMain.d.ts.map +1 -0
- package/bin/builtin/main/PluginSettingsMain.js +65 -0
- package/bin/builtin/main/PluginSettingsMain.js.map +1 -0
- package/bin/builtin/renderer/PluginSettingsRenderer.d.ts +6 -0
- package/bin/builtin/renderer/PluginSettingsRenderer.d.ts.map +1 -0
- package/bin/builtin/renderer/PluginSettingsRenderer.js +76 -0
- package/bin/builtin/renderer/PluginSettingsRenderer.js.map +1 -0
- package/bin/builtin/types/PluginSettings.d.ts +35 -0
- package/bin/builtin/types/PluginSettings.d.ts.map +1 -0
- package/bin/builtin/types/PluginSettings.js +3 -0
- package/bin/builtin/types/PluginSettings.js.map +1 -0
- package/bin/chat/ChatPlugin.d.ts +12 -28
- package/bin/chat/ChatPlugin.d.ts.map +1 -1
- package/bin/chat/ChatPlugin.js +97 -49
- package/bin/chat/ChatPlugin.js.map +1 -1
- package/bin/chat/access/ChatAccessRuntime.js +1 -1
- package/bin/chat/access/ChatAccessRuntime.js.map +1 -1
- package/bin/chat/access/ChatAccessSchema.d.ts +2 -2
- package/bin/chat/access/ChatAccessSchema.d.ts.map +1 -1
- package/bin/chat/access/ChatAccessSchema.js +3 -3
- package/bin/chat/access/ChatAccessSchema.js.map +1 -1
- package/bin/chat/access/ChatAccessService.d.ts +2 -2
- package/bin/chat/access/ChatAccessService.d.ts.map +1 -1
- package/bin/chat/access/ChatAccessService.js +4 -4
- package/bin/chat/access/ChatAccessService.js.map +1 -1
- package/bin/chat/access/ChatAccessStore.d.ts +3 -3
- package/bin/chat/access/ChatAccessStore.d.ts.map +1 -1
- package/bin/chat/access/ChatAccessStore.js +17 -8
- package/bin/chat/access/ChatAccessStore.js.map +1 -1
- package/bin/chat/channels/BaseChatChannel.d.ts +1 -0
- package/bin/chat/channels/BaseChatChannel.d.ts.map +1 -1
- package/bin/chat/channels/BaseChatChannel.js +2 -0
- package/bin/chat/channels/BaseChatChannel.js.map +1 -1
- package/bin/chat/channels/RuntimeChannel.d.ts +4 -4
- package/bin/chat/channels/RuntimeChannel.d.ts.map +1 -1
- package/bin/chat/channels/RuntimeChannel.js +8 -8
- package/bin/chat/channels/RuntimeChannel.js.map +1 -1
- package/bin/chat/channels/feishu/Feishu.js +1 -1
- package/bin/chat/channels/feishu/Feishu.js.map +1 -1
- package/bin/chat/channels/feishu/FeishuPlatformClient.d.ts +1 -0
- package/bin/chat/channels/feishu/FeishuPlatformClient.d.ts.map +1 -1
- package/bin/chat/channels/feishu/FeishuPlatformClient.js +3 -0
- package/bin/chat/channels/feishu/FeishuPlatformClient.js.map +1 -1
- package/bin/chat/channels/feishu/FeishuPlatformLookup.d.ts +2 -0
- package/bin/chat/channels/feishu/FeishuPlatformLookup.d.ts.map +1 -1
- package/bin/chat/channels/feishu/FeishuPlatformLookup.js +1 -1
- package/bin/chat/channels/feishu/FeishuPlatformLookup.js.map +1 -1
- package/bin/chat/channels/qq/QQ.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQ.js +3 -2
- 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/QQInboundDedupe.d.ts +1 -1
- package/bin/chat/channels/qq/QQInboundDedupe.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQInboundDedupe.js +1 -1
- package/bin/chat/channels/qq/QQInboundDedupe.js.map +1 -1
- package/bin/chat/channels/qq/QQMessageHandler.d.ts +4 -0
- package/bin/chat/channels/qq/QQMessageHandler.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQMessageHandler.js +2 -0
- package/bin/chat/channels/qq/QQMessageHandler.js.map +1 -1
- package/bin/chat/channels/qq/QQSupport.d.ts +4 -0
- package/bin/chat/channels/qq/QQSupport.d.ts.map +1 -1
- package/bin/chat/channels/qq/QQSupport.js +1 -0
- package/bin/chat/channels/qq/QQSupport.js.map +1 -1
- package/bin/chat/channels/qq/VoiceInput.d.ts +3 -0
- package/bin/chat/channels/qq/VoiceInput.d.ts.map +1 -1
- package/bin/chat/channels/qq/VoiceInput.js +1 -1
- package/bin/chat/channels/qq/VoiceInput.js.map +1 -1
- package/bin/chat/channels/telegram/ApiClient.d.ts +3 -1
- package/bin/chat/channels/telegram/ApiClient.d.ts.map +1 -1
- package/bin/chat/channels/telegram/ApiClient.js +4 -2
- package/bin/chat/channels/telegram/ApiClient.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/TelegramPlatformClient.d.ts.map +1 -1
- package/bin/chat/channels/telegram/TelegramPlatformClient.js +2 -1
- package/bin/chat/channels/telegram/TelegramPlatformClient.js.map +1 -1
- package/bin/chat/main/ChatPluginMain.d.ts +4 -0
- package/bin/chat/main/ChatPluginMain.d.ts.map +1 -0
- package/bin/chat/main/ChatPluginMain.js +137 -0
- package/bin/chat/main/ChatPluginMain.js.map +1 -0
- package/bin/chat/renderer/ChatPluginRenderer.d.ts +4 -0
- package/bin/chat/renderer/ChatPluginRenderer.d.ts.map +1 -0
- package/bin/chat/renderer/ChatPluginRenderer.js +105 -0
- package/bin/chat/renderer/ChatPluginRenderer.js.map +1 -0
- package/bin/chat/runtime/ChannelContextStore.d.ts +2 -2
- package/bin/chat/runtime/ChannelContextStore.js +20 -20
- package/bin/chat/runtime/ChannelContextStore.js.map +1 -1
- package/bin/chat/runtime/ChatActionExecution.js +6 -6
- package/bin/chat/runtime/ChatActionExecution.js.map +1 -1
- package/bin/chat/runtime/ChatChannelConfig.d.ts.map +1 -1
- package/bin/chat/runtime/ChatChannelConfig.js +7 -12
- package/bin/chat/runtime/ChatChannelConfig.js.map +1 -1
- package/bin/chat/runtime/ChatChannelCore.d.ts +3 -3
- package/bin/chat/runtime/ChatChannelCore.d.ts.map +1 -1
- package/bin/chat/runtime/ChatChannelCore.js +5 -5
- package/bin/chat/runtime/ChatChannelCore.js.map +1 -1
- package/bin/chat/runtime/ChatHistoryStore.d.ts +1 -1
- package/bin/chat/runtime/ChatHistoryStore.js +7 -7
- package/bin/chat/runtime/ChatHistoryStore.js.map +1 -1
- package/bin/chat/runtime/ChatMetaStore.d.ts +1 -1
- package/bin/chat/runtime/ChatMetaStore.js +1 -1
- package/bin/chat/runtime/ChatPluginActionRegistry.d.ts +1 -1
- package/bin/chat/runtime/ChatPluginActionRegistry.d.ts.map +1 -1
- package/bin/chat/runtime/ChatPluginActionRegistry.js +9 -9
- package/bin/chat/runtime/ChatPluginActionRegistry.js.map +1 -1
- package/bin/chat/runtime/ChatQueue.d.ts +3 -38
- package/bin/chat/runtime/ChatQueue.d.ts.map +1 -1
- package/bin/chat/runtime/ChatQueue.js +3 -51
- package/bin/chat/runtime/ChatQueue.js.map +1 -1
- package/bin/chat/runtime/ChatQueueStore.d.ts +5 -16
- package/bin/chat/runtime/ChatQueueStore.d.ts.map +1 -1
- package/bin/chat/runtime/ChatQueueStore.js +8 -22
- package/bin/chat/runtime/ChatQueueStore.js.map +1 -1
- package/bin/chat/runtime/ChatQueueWorker.d.ts +1 -1
- package/bin/chat/runtime/ChatQueueWorker.d.ts.map +1 -1
- package/bin/chat/runtime/ChatQueueWorker.js +1 -2
- package/bin/chat/runtime/ChatQueueWorker.js.map +1 -1
- package/bin/chat/runtime/ChatSessionDelete.d.ts +3 -3
- package/bin/chat/runtime/ChatSessionDelete.js +4 -4
- package/bin/chat/runtime/ChatSessionDelete.js.map +1 -1
- package/bin/chat/runtime/ChatStorage.d.ts +7 -7
- package/bin/chat/runtime/ChatStorage.js +24 -24
- package/bin/chat/runtime/ChatStorage.js.map +1 -1
- package/bin/chat/types/ChatAccess.d.ts +2 -2
- package/bin/chat/types/ChatAccess.d.ts.map +1 -1
- package/bin/chat/types/ChatCommand.d.ts +1 -1
- package/bin/chat/types/ChatPluginChannelConfig.d.ts +57 -0
- package/bin/chat/types/ChatPluginChannelConfig.d.ts.map +1 -0
- package/bin/chat/types/ChatPluginChannelConfig.js +3 -0
- package/bin/chat/types/ChatPluginChannelConfig.js.map +1 -0
- package/bin/chat/types/ChatPluginConfig.d.ts +19 -0
- package/bin/chat/types/ChatPluginConfig.d.ts.map +1 -0
- package/bin/chat/types/ChatPluginConfig.js +3 -0
- package/bin/chat/types/ChatPluginConfig.js.map +1 -0
- package/bin/chat/types/ChatPluginOptions.d.ts +4 -4
- package/bin/chat/types/ChatPluginOptions.d.ts.map +1 -1
- package/bin/chat/types/ChatPluginOptions.js +1 -1
- package/bin/chat/types/ChatPluginProfile.d.ts +39 -0
- package/bin/chat/types/ChatPluginProfile.d.ts.map +1 -0
- package/bin/chat/types/ChatPluginProfile.js +3 -0
- package/bin/chat/types/ChatPluginProfile.js.map +1 -0
- package/bin/chat/types/ChatPluginRenderer.d.ts +17 -0
- package/bin/chat/types/ChatPluginRenderer.d.ts.map +1 -0
- package/bin/chat/types/ChatPluginRenderer.js +3 -0
- package/bin/chat/types/ChatPluginRenderer.js.map +1 -0
- package/bin/chat/types/ChatRuntime.d.ts +11 -0
- package/bin/chat/types/ChatRuntime.d.ts.map +1 -1
- package/bin/chat/types/ChatRuntimeAccount.d.ts +3 -3
- package/bin/chat/types/ChatRuntimeAccount.d.ts.map +1 -1
- package/bin/chat/types/ChatRuntimeAccount.js +2 -2
- package/bin/chat/types/ChatStorage.d.ts +2 -2
- package/bin/chat/types/ChatStorage.d.ts.map +1 -1
- package/bin/chat.d.ts +3 -4
- package/bin/chat.d.ts.map +1 -1
- package/bin/chat.js +1 -2
- package/bin/chat.js.map +1 -1
- package/bin/contact/Action.js +5 -5
- package/bin/contact/Action.js.map +1 -1
- package/bin/contact/ContactPlugin.js +15 -15
- package/bin/contact/ContactPlugin.js.map +1 -1
- package/bin/contact/runtime/ChatRuntime.js +3 -3
- 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 +20 -20
- package/bin/contact/runtime/ContactStore.js.map +1 -1
- package/bin/contact/runtime/EndpointNotice.js +2 -2
- package/bin/contact/runtime/EndpointNotice.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 +14 -14
- package/bin/contact/runtime/LinkApproval.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 +5 -5
- package/bin/contact/runtime/LinkStore.js.map +1 -1
- package/bin/contact/runtime/Paths.d.ts +15 -15
- package/bin/contact/runtime/Paths.d.ts.map +1 -1
- package/bin/contact/runtime/Paths.js +29 -29
- package/bin/contact/runtime/Paths.js.map +1 -1
- package/bin/contact/runtime/ShareBundle.d.ts +1 -1
- package/bin/contact/runtime/ShareBundle.d.ts.map +1 -1
- package/bin/contact/runtime/ShareBundle.js +4 -4
- package/bin/contact/runtime/ShareBundle.js.map +1 -1
- package/bin/contact/types/ContactApproval.d.ts +2 -2
- package/bin/contact/types/ContactApproval.d.ts.map +1 -1
- package/bin/image/ImagePlugin.d.ts +1 -4
- package/bin/image/ImagePlugin.d.ts.map +1 -1
- package/bin/image/ImagePlugin.js +26 -34
- package/bin/image/ImagePlugin.js.map +1 -1
- package/bin/image/runtime/ImageResultStorage.d.ts +2 -2
- package/bin/image/runtime/ImageResultStorage.d.ts.map +1 -1
- package/bin/image/runtime/ImageResultStorage.js +15 -38
- package/bin/image/runtime/ImageResultStorage.js.map +1 -1
- package/bin/image/types/ImagePlugin.d.ts +23 -16
- package/bin/image/types/ImagePlugin.d.ts.map +1 -1
- package/bin/image/types/ImagePlugin.js +1 -1
- package/bin/image.d.ts +1 -1
- package/bin/image.d.ts.map +1 -1
- package/bin/index.d.ts +2 -0
- package/bin/index.d.ts.map +1 -1
- package/bin/index.js +1 -0
- package/bin/index.js.map +1 -1
- package/bin/memory/Action.d.ts +27 -36
- package/bin/memory/Action.d.ts.map +1 -1
- package/bin/memory/Action.js +71 -311
- package/bin/memory/Action.js.map +1 -1
- package/bin/memory/MemoryPlugin.d.ts +20 -37
- package/bin/memory/MemoryPlugin.d.ts.map +1 -1
- package/bin/memory/MemoryPlugin.js +241 -233
- package/bin/memory/MemoryPlugin.js.map +1 -1
- package/bin/memory/adapters/FileMemoryStorageAdapter.d.ts +43 -0
- package/bin/memory/adapters/FileMemoryStorageAdapter.d.ts.map +1 -0
- package/bin/memory/adapters/FileMemoryStorageAdapter.js +163 -0
- package/bin/memory/adapters/FileMemoryStorageAdapter.js.map +1 -0
- package/bin/memory/providers/BuiltinMemoryProvider.d.ts +63 -0
- package/bin/memory/providers/BuiltinMemoryProvider.d.ts.map +1 -0
- package/bin/memory/providers/BuiltinMemoryProvider.js +772 -0
- package/bin/memory/providers/BuiltinMemoryProvider.js.map +1 -0
- package/bin/memory/runtime/SystemProvider.d.ts +7 -12
- package/bin/memory/runtime/SystemProvider.d.ts.map +1 -1
- package/bin/memory/runtime/SystemProvider.js +30 -89
- package/bin/memory/runtime/SystemProvider.js.map +1 -1
- package/bin/memory/types/BuiltinMemoryProvider.d.ts +88 -0
- package/bin/memory/types/BuiltinMemoryProvider.d.ts.map +1 -0
- package/bin/memory/types/BuiltinMemoryProvider.js +9 -0
- package/bin/memory/types/BuiltinMemoryProvider.js.map +1 -0
- package/bin/memory/types/Memory.d.ts +255 -408
- package/bin/memory/types/Memory.d.ts.map +1 -1
- package/bin/memory/types/Memory.js +4 -4
- package/bin/memory/types/MemoryStorage.d.ts +35 -0
- package/bin/memory/types/MemoryStorage.d.ts.map +1 -0
- package/bin/memory/types/MemoryStorage.js +10 -0
- package/bin/memory/types/MemoryStorage.js.map +1 -0
- package/bin/memory.d.ts +6 -2
- package/bin/memory.d.ts.map +1 -1
- package/bin/memory.js +3 -1
- package/bin/memory.js.map +1 -1
- package/bin/renderers.d.ts +5 -0
- package/bin/renderers.d.ts.map +1 -0
- package/bin/renderers.js +12 -0
- package/bin/renderers.js.map +1 -0
- package/bin/sound/Plugin.d.ts +2 -5
- package/bin/sound/Plugin.d.ts.map +1 -1
- package/bin/sound/Plugin.js +27 -31
- package/bin/sound/Plugin.js.map +1 -1
- package/bin/sound/types/SoundPlugin.d.ts +22 -15
- package/bin/sound/types/SoundPlugin.d.ts.map +1 -1
- package/bin/sound/types/SoundPlugin.js +2 -2
- package/bin/sound.d.ts +1 -1
- package/bin/sound.d.ts.map +1 -1
- package/bin/task/Action.d.ts +6 -6
- package/bin/task/Action.d.ts.map +1 -1
- package/bin/task/Action.js +21 -21
- 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.js +8 -8
- package/bin/task/Scheduler.js.map +1 -1
- package/bin/task/TaskPlugin.d.ts +7 -14
- package/bin/task/TaskPlugin.d.ts.map +1 -1
- package/bin/task/TaskPlugin.js +54 -43
- package/bin/task/TaskPlugin.js.map +1 -1
- package/bin/task/runtime/Model.d.ts +1 -5
- package/bin/task/runtime/Model.d.ts.map +1 -1
- package/bin/task/runtime/Model.js +2 -13
- package/bin/task/runtime/Model.js.map +1 -1
- package/bin/task/runtime/Paths.d.ts +7 -7
- 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 +1 -1
- package/bin/task/runtime/Runner.d.ts.map +1 -1
- package/bin/task/runtime/Runner.js +4 -5
- package/bin/task/runtime/Runner.js.map +1 -1
- package/bin/task/runtime/Store.d.ts +9 -9
- package/bin/task/runtime/Store.d.ts.map +1 -1
- package/bin/task/runtime/Store.js +17 -17
- package/bin/task/runtime/Store.js.map +1 -1
- package/bin/task/runtime/TaskActionExecution.js +6 -6
- package/bin/task/runtime/TaskActionExecution.js.map +1 -1
- package/bin/task/runtime/TaskPluginActionRegistry.js +1 -1
- package/bin/task/runtime/TaskPluginActionRegistry.js.map +1 -1
- package/bin/task/runtime/TaskRunnerRound.d.ts +0 -1
- package/bin/task/runtime/TaskRunnerRound.d.ts.map +1 -1
- package/bin/task/runtime/TaskRunnerRound.js +8 -3
- package/bin/task/runtime/TaskRunnerRound.js.map +1 -1
- package/bin/task/runtime/TaskRunnerScript.d.ts +0 -4
- package/bin/task/runtime/TaskRunnerScript.d.ts.map +1 -1
- package/bin/task/runtime/TaskRunnerScript.js +0 -1
- package/bin/task/runtime/TaskRunnerScript.js.map +1 -1
- package/bin/task/runtime/TaskRunnerSession.d.ts +2 -3
- package/bin/task/runtime/TaskRunnerSession.d.ts.map +1 -1
- package/bin/task/runtime/TaskRunnerSession.js +2 -4
- package/bin/task/runtime/TaskRunnerSession.js.map +1 -1
- package/bin/task/types/TaskWorkspaceRuntime.d.ts +10 -0
- package/bin/task/types/TaskWorkspaceRuntime.d.ts.map +1 -0
- package/bin/task/types/TaskWorkspaceRuntime.js +3 -0
- package/bin/task/types/TaskWorkspaceRuntime.js.map +1 -0
- package/bin/web/Plugin.d.ts +2 -6
- package/bin/web/Plugin.d.ts.map +1 -1
- package/bin/web/Plugin.js +21 -17
- package/bin/web/Plugin.js.map +1 -1
- package/bin/web/providers/PlaywrightBrowserProvider.d.ts.map +1 -1
- package/bin/web/providers/PlaywrightBrowserProvider.js +59 -14
- package/bin/web/providers/PlaywrightBrowserProvider.js.map +1 -1
- package/bin/web/types/WebPlugin.d.ts +15 -9
- package/bin/web/types/WebPlugin.d.ts.map +1 -1
- package/bin/web.d.ts +1 -1
- package/bin/web.d.ts.map +1 -1
- package/bin/workboard/runtime/Collector.js +1 -1
- package/bin/workboard/runtime/Collector.js.map +1 -1
- package/package.json +29 -19
- package/scripts/chat-access.test.mjs +3 -2
- package/scripts/chat-channel-config.test.mjs +3 -3
- package/scripts/chat-storage.test.mjs +10 -14
- package/scripts/memory-plugin.test.mjs +204 -0
- package/scripts/playwright-browser-provider.test.mjs +260 -0
- package/scripts/plugin-main.test.mjs +101 -0
- package/scripts/plugin-subpaths.test.mjs +36 -0
- package/scripts/sound-plugin.test.mjs +21 -9
- package/scripts/unrestricted-sandbox-approval.test.mjs +1 -1
- package/scripts/web-plugin.test.mjs +43 -186
- package/src/builtin/BuiltinPluginReadmes.ts +58 -0
- package/src/builtin/BuiltinPluginTypes.ts +260 -0
- package/src/builtin/PluginSettingsDefinitions.ts +45 -0
- package/src/builtin/main/PluginSettingsMain.ts +75 -0
- package/src/builtin/renderer/PluginSettingsRenderer.tsx +110 -0
- package/src/builtin/types/PluginSettings.ts +46 -0
- package/src/chat/ChatPlugin.ts +99 -51
- package/src/chat/access/ChatAccessRuntime.ts +1 -1
- package/src/chat/access/ChatAccessSchema.ts +5 -5
- package/src/chat/access/ChatAccessService.ts +4 -4
- package/src/chat/access/ChatAccessStore.ts +17 -9
- package/src/chat/channels/BaseChatChannel.ts +2 -0
- package/src/chat/channels/RuntimeChannel.ts +9 -9
- package/src/chat/channels/feishu/Feishu.ts +1 -1
- package/src/chat/channels/feishu/FeishuPlatformClient.ts +3 -0
- package/src/chat/channels/feishu/FeishuPlatformLookup.ts +3 -1
- package/src/chat/channels/qq/QQ.ts +3 -2
- package/src/chat/channels/qq/QQEventCapture.ts +3 -3
- package/src/chat/channels/qq/QQInboundDedupe.ts +2 -3
- package/src/chat/channels/qq/QQMessageHandler.ts +6 -0
- package/src/chat/channels/qq/QQSupport.ts +5 -0
- package/src/chat/channels/qq/VoiceInput.ts +5 -1
- package/src/chat/channels/telegram/ApiClient.ts +10 -3
- package/src/chat/channels/telegram/StateStore.ts +2 -2
- package/src/chat/channels/telegram/TelegramPlatformClient.ts +2 -1
- package/src/chat/main/ChatPluginMain.ts +163 -0
- package/src/chat/renderer/ChatPluginRenderer.tsx +149 -0
- package/src/chat/runtime/ChannelContextStore.ts +20 -20
- package/src/chat/runtime/ChatActionExecution.ts +6 -6
- package/src/chat/runtime/ChatChannelConfig.ts +7 -14
- package/src/chat/runtime/ChatChannelCore.ts +9 -9
- package/src/chat/runtime/ChatHistoryStore.ts +7 -7
- package/src/chat/runtime/ChatMetaStore.ts +1 -1
- package/src/chat/runtime/ChatPluginActionRegistry.ts +10 -10
- package/src/chat/runtime/ChatQueue.ts +2 -69
- package/src/chat/runtime/ChatQueueStore.ts +10 -26
- package/src/chat/runtime/ChatQueueWorker.ts +2 -5
- package/src/chat/runtime/ChatSessionDelete.ts +4 -4
- package/src/chat/runtime/ChatStorage.ts +24 -24
- package/src/chat/types/ChatAccess.ts +2 -2
- package/src/chat/types/ChatCommand.ts +1 -1
- package/src/chat/types/ChatPluginChannelConfig.ts +63 -0
- package/src/chat/types/ChatPluginConfig.ts +21 -0
- package/src/chat/types/ChatPluginOptions.ts +4 -4
- package/src/chat/types/ChatPluginProfile.ts +52 -0
- package/src/chat/types/ChatPluginRenderer.ts +25 -0
- package/src/chat/types/ChatRuntime.ts +14 -0
- package/src/chat/types/ChatRuntimeAccount.ts +3 -3
- package/src/chat/types/ChatStorage.ts +2 -2
- package/src/chat.ts +6 -14
- package/src/contact/Action.ts +5 -5
- package/src/contact/ContactPlugin.ts +15 -15
- package/src/contact/runtime/ChatRuntime.ts +3 -3
- package/src/contact/runtime/ContactStore.ts +20 -20
- package/src/contact/runtime/EndpointNotice.ts +2 -2
- package/src/contact/runtime/InboxStore.ts +16 -16
- package/src/contact/runtime/LinkApproval.ts +16 -16
- package/src/contact/runtime/LinkStore.ts +5 -5
- package/src/contact/runtime/Paths.ts +29 -29
- package/src/contact/runtime/ShareBundle.ts +5 -5
- package/src/contact/types/ContactApproval.ts +2 -2
- package/src/image/ImagePlugin.ts +30 -33
- package/src/image/runtime/ImageResultStorage.ts +36 -62
- package/src/image/types/ImagePlugin.ts +25 -19
- package/src/image.ts +2 -0
- package/src/index.ts +8 -0
- package/src/memory/Action.ts +106 -377
- package/src/memory/MemoryPlugin.ts +266 -246
- package/src/memory/adapters/FileMemoryStorageAdapter.ts +197 -0
- package/src/memory/providers/BuiltinMemoryProvider.ts +905 -0
- package/src/memory/runtime/SystemProvider.ts +32 -95
- package/src/memory/types/BuiltinMemoryProvider.ts +121 -0
- package/src/memory/types/Memory.ts +329 -456
- package/src/memory/types/MemoryStorage.ts +44 -0
- package/src/memory.ts +49 -24
- package/src/renderers.ts +18 -0
- package/src/sound/Plugin.ts +34 -33
- package/src/sound/types/SoundPlugin.ts +24 -19
- package/src/sound.ts +2 -0
- package/src/task/Action.ts +27 -27
- package/src/task/PROMPT.ts +1 -1
- package/src/task/PROMPT.ts.txt +5 -6
- package/src/task/Scheduler.ts +8 -8
- package/src/task/TaskPlugin.ts +55 -46
- package/src/task/runtime/Model.ts +3 -13
- package/src/task/runtime/Paths.ts +11 -11
- package/src/task/runtime/Runner.ts +5 -6
- package/src/task/runtime/Store.ts +22 -22
- package/src/task/runtime/TaskActionExecution.ts +6 -6
- package/src/task/runtime/TaskPluginActionRegistry.ts +1 -1
- package/src/task/runtime/TaskRunnerRound.ts +13 -4
- package/src/task/runtime/TaskRunnerScript.ts +0 -5
- package/src/task/runtime/TaskRunnerSession.ts +10 -8
- package/src/task/types/TaskWorkspaceRuntime.ts +12 -0
- package/src/web/Plugin.ts +23 -22
- package/src/web/providers/PlaywrightBrowserProvider.ts +93 -17
- package/src/web/types/WebPlugin.ts +16 -13
- package/src/web.ts +1 -0
- package/src/workboard/runtime/Collector.ts +1 -1
- package/tsconfig.json +4 -1
- package/LICENSE +0 -183
- package/bin/chat/Index.d.ts +0 -15
- package/bin/chat/Index.d.ts.map +0 -1
- package/bin/chat/Index.js +0 -11
- package/bin/chat/Index.js.map +0 -1
- package/bin/chat/config/ChatPluginConfig.d.ts +0 -67
- package/bin/chat/config/ChatPluginConfig.d.ts.map +0 -1
- package/bin/chat/config/ChatPluginConfig.js +0 -237
- package/bin/chat/config/ChatPluginConfig.js.map +0 -1
- package/bin/chat/types/ChatPluginResource.d.ts +0 -68
- package/bin/chat/types/ChatPluginResource.d.ts.map +0 -1
- package/bin/chat/types/ChatPluginResource.js +0 -10
- package/bin/chat/types/ChatPluginResource.js.map +0 -1
- package/bin/contact/Index.d.ts +0 -8
- package/bin/contact/Index.d.ts.map +0 -1
- package/bin/contact/Index.js +0 -8
- package/bin/contact/Index.js.map +0 -1
- package/bin/memory/Index.d.ts +0 -9
- package/bin/memory/Index.d.ts.map +0 -1
- package/bin/memory/Index.js +0 -9
- package/bin/memory/Index.js.map +0 -1
- package/bin/memory/runtime/Search.d.ts +0 -19
- package/bin/memory/runtime/Search.d.ts.map +0 -1
- package/bin/memory/runtime/Search.js +0 -262
- package/bin/memory/runtime/Search.js.map +0 -1
- package/bin/memory/runtime/Store.d.ts +0 -42
- package/bin/memory/runtime/Store.d.ts.map +0 -1
- package/bin/memory/runtime/Store.js +0 -94
- package/bin/memory/runtime/Store.js.map +0 -1
- package/bin/memory/runtime/Writer.d.ts +0 -61
- package/bin/memory/runtime/Writer.d.ts.map +0 -1
- package/bin/memory/runtime/Writer.js +0 -274
- package/bin/memory/runtime/Writer.js.map +0 -1
- package/bin/skill/Command.d.ts +0 -29
- package/bin/skill/Command.d.ts.map +0 -1
- package/bin/skill/Command.js +0 -35
- package/bin/skill/Command.js.map +0 -1
- package/bin/task/Index.d.ts +0 -9
- package/bin/task/Index.d.ts.map +0 -1
- package/bin/task/Index.js +0 -9
- package/bin/task/Index.js.map +0 -1
- package/src/chat/Index.ts +0 -36
- package/src/chat/config/ChatPluginConfig.ts +0 -266
- package/src/chat/types/ChatPluginResource.ts +0 -95
- package/src/contact/Index.ts +0 -8
- package/src/memory/Index.ts +0 -9
- package/src/memory/runtime/Search.ts +0 -327
- package/src/memory/runtime/Store.ts +0 -158
- package/src/memory/runtime/Writer.ts +0 -351
- package/src/skill/Command.ts +0 -58
- package/src/task/Index.ts +0 -8
|
@@ -1,395 +1,403 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* MemoryPlugin:
|
|
2
|
+
* MemoryPlugin:Agent 长期记忆的 provider-neutral facade。
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
4
|
+
* 职责说明(中文)
|
|
5
|
+
* - 对 Agent 暴露稳定的 Memory actions 与 system 使用约束。
|
|
6
|
+
* - 把 Agent/Session 上下文映射为结构化 Memory scope。
|
|
7
|
+
* - 将记忆形成、存储、召回、修订和删除委托给唯一 MemoryProvider。
|
|
8
|
+
*
|
|
9
|
+
* 边界说明(中文)
|
|
10
|
+
* - 不读取或拼接任何物理存储路径。
|
|
11
|
+
* - 不依赖 Workspace FileSystem,也不规定 Markdown、SQLite 或远程服务。
|
|
12
|
+
* - Provider 生命周期跟随当前 Plugin 实例,由 Agent 统一启动和释放。
|
|
8
13
|
*/
|
|
9
|
-
import
|
|
10
|
-
import
|
|
14
|
+
import os from "node:os";
|
|
15
|
+
import path from "node:path";
|
|
16
|
+
import { BasePlugin, create_action } from "@downcity/agent";
|
|
11
17
|
import { z } from "zod";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
18
|
+
import { digest_memory_action, forget_memory_action, read_memory_action, remember_memory_action, revise_memory_action, search_memory_action, status_memory_action, } from "../memory/Action.js";
|
|
19
|
+
import { build_memory_plugin_system_text } from "../memory/runtime/SystemProvider.js";
|
|
20
|
+
import { BuiltinMemoryProvider } from "../memory/providers/BuiltinMemoryProvider.js";
|
|
21
|
+
import { FileMemoryStorageAdapter, get_default_file_memory_root_path } from "../memory/adapters/FileMemoryStorageAdapter.js";
|
|
22
|
+
const memory_type_schema = z.enum([
|
|
23
|
+
"fact",
|
|
24
|
+
"preference",
|
|
25
|
+
"decision",
|
|
26
|
+
"episode",
|
|
27
|
+
"procedure",
|
|
28
|
+
"document",
|
|
29
|
+
]);
|
|
30
|
+
/** 解析正整数 CLI 参数。 */
|
|
31
|
+
function parse_positive_integer(value) {
|
|
17
32
|
const text = String(value || "").trim();
|
|
18
|
-
if (!/^\d
|
|
33
|
+
if (!/^\d+$/u.test(text))
|
|
19
34
|
throw new Error(`Invalid positive integer: ${value}`);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (!Number.isFinite(num) || num < 1) {
|
|
35
|
+
const number_value = Number(text);
|
|
36
|
+
if (!Number.isFinite(number_value) || number_value < 1) {
|
|
23
37
|
throw new Error(`Invalid positive integer: ${value}`);
|
|
24
38
|
}
|
|
25
|
-
return
|
|
39
|
+
return number_value;
|
|
26
40
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
const num = Number(text);
|
|
33
|
-
if (!Number.isFinite(num)) {
|
|
41
|
+
/** 解析任意有限数值 CLI 参数。 */
|
|
42
|
+
function parse_number(value) {
|
|
43
|
+
const number_value = Number(String(value || "").trim());
|
|
44
|
+
if (!Number.isFinite(number_value))
|
|
34
45
|
throw new Error(`Invalid number: ${value}`);
|
|
35
|
-
|
|
36
|
-
return num;
|
|
46
|
+
return number_value;
|
|
37
47
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
48
|
+
/** 把 Action JSON 输入归一化为普通对象。 */
|
|
49
|
+
function read_body_object(raw_body) {
|
|
50
|
+
return raw_body && typeof raw_body === "object" && !Array.isArray(raw_body)
|
|
51
|
+
? raw_body
|
|
52
|
+
: {};
|
|
43
53
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return typeof
|
|
54
|
+
/** 读取必填或可选字符串字段。 */
|
|
55
|
+
function read_string(body, key) {
|
|
56
|
+
return typeof body[key] === "string" ? String(body[key]) : "";
|
|
47
57
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
58
|
+
/** 读取可选字符串字段。 */
|
|
59
|
+
function read_optional_string(body, key) {
|
|
60
|
+
const value = read_string(body, key).trim();
|
|
61
|
+
return value || undefined;
|
|
51
62
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return typeof
|
|
63
|
+
/** 读取可选数值字段。 */
|
|
64
|
+
function read_optional_number(body, key) {
|
|
65
|
+
return typeof body[key] === "number" ? Number(body[key]) : undefined;
|
|
55
66
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return typeof
|
|
67
|
+
/** 读取可选布尔字段。 */
|
|
68
|
+
function read_optional_boolean(body, key) {
|
|
69
|
+
return typeof body[key] === "boolean" ? Boolean(body[key]) : undefined;
|
|
59
70
|
}
|
|
60
|
-
/**
|
|
61
|
-
|
|
62
|
-
|
|
71
|
+
/** 读取可选 MemoryType 字段。 */
|
|
72
|
+
function read_optional_memory_type(body) {
|
|
73
|
+
const result = memory_type_schema.safeParse(body.memory_type);
|
|
74
|
+
return result.success ? result.data : undefined;
|
|
75
|
+
}
|
|
76
|
+
/** Agent 长期记忆 Plugin。 */
|
|
63
77
|
export class MemoryPlugin extends BasePlugin {
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* plugin 名称。
|
|
67
|
-
*/
|
|
78
|
+
/** Plugin 稳定名称。 */
|
|
68
79
|
name = "memory";
|
|
69
|
-
/**
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
runtimeState = null;
|
|
73
|
-
/**
|
|
74
|
-
* 创建 MemoryPlugin。
|
|
75
|
-
*/
|
|
76
|
-
constructor(options = {}) {
|
|
80
|
+
/** 当前 Plugin 唯一绑定的 Memory Provider。 */
|
|
81
|
+
provider;
|
|
82
|
+
constructor(profile = {}) {
|
|
77
83
|
super();
|
|
78
|
-
|
|
84
|
+
const root_path = profile.root_path?.trim();
|
|
85
|
+
if (root_path && !path.isAbsolute(root_path)) {
|
|
86
|
+
throw new Error("MemoryPlugin root_path must be absolute");
|
|
87
|
+
}
|
|
88
|
+
this.provider = new BuiltinMemoryProvider({
|
|
89
|
+
create_storage: ({ agent_id }) => new FileMemoryStorageAdapter({
|
|
90
|
+
root_path: root_path || get_default_file_memory_root_path({
|
|
91
|
+
platform_root_path: process.env.DC_PLATFORM_ROOT || path.join(os.homedir(), ".downcity"),
|
|
92
|
+
agent_id,
|
|
93
|
+
}),
|
|
94
|
+
}),
|
|
95
|
+
});
|
|
79
96
|
}
|
|
80
|
-
/**
|
|
81
|
-
* 当前 plugin 的 system 文本提供器。
|
|
82
|
-
*/
|
|
97
|
+
/** 构建 provider-neutral Memory system 内容。 */
|
|
83
98
|
async system(context) {
|
|
84
|
-
return await
|
|
99
|
+
return await build_memory_plugin_system_text(context, this.provider);
|
|
85
100
|
}
|
|
86
|
-
/**
|
|
87
|
-
* 当前 plugin 生命周期。
|
|
88
|
-
*/
|
|
101
|
+
/** Provider 生命周期与当前 Agent Plugin 实例保持一致。 */
|
|
89
102
|
lifecycle = {
|
|
90
103
|
start: async (context) => {
|
|
91
|
-
await
|
|
92
|
-
|
|
104
|
+
await this.provider.initialize({
|
|
105
|
+
agent_id: context.agent_id,
|
|
106
|
+
});
|
|
93
107
|
},
|
|
94
108
|
stop: async () => {
|
|
95
|
-
this.
|
|
109
|
+
await this.provider.dispose();
|
|
96
110
|
},
|
|
97
111
|
};
|
|
98
|
-
/**
|
|
99
|
-
* 当前 plugin action 定义表。
|
|
100
|
-
*/
|
|
112
|
+
/** Memory 对 Agent 暴露的稳定 Action 集合。 */
|
|
101
113
|
actions = {
|
|
102
114
|
status: create_action({
|
|
103
|
-
description: "
|
|
115
|
+
description: "Inspect the active Memory Provider and its capabilities.",
|
|
104
116
|
input_schema: {
|
|
105
117
|
zod: z.object({}).passthrough(),
|
|
106
|
-
json_schema: { type: "object", properties: {} },
|
|
118
|
+
json_schema: { type: "object", additionalProperties: false, properties: {} },
|
|
107
119
|
},
|
|
108
|
-
examples: [{ title: "View status", payload: {} }],
|
|
120
|
+
examples: [{ title: "View Memory Provider status", payload: {} }],
|
|
109
121
|
command: {
|
|
110
|
-
description: "
|
|
111
|
-
map_input() {
|
|
112
|
-
return {};
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
execute: async (params) => {
|
|
116
|
-
const state = this.getOrCreateRuntimeState(params.context);
|
|
117
|
-
return await statusMemoryAction(params.context, state);
|
|
122
|
+
description: "Inspect the active Memory Provider.",
|
|
123
|
+
map_input: () => ({}),
|
|
118
124
|
},
|
|
125
|
+
execute: async () => await status_memory_action(this.provider),
|
|
119
126
|
}),
|
|
120
127
|
search: create_action({
|
|
121
|
-
description: "
|
|
128
|
+
description: "Recall scoped long-term memories for a focused query.",
|
|
122
129
|
input_schema: {
|
|
123
130
|
zod: z.object({
|
|
124
131
|
query: z.string(),
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
132
|
+
max_results: z.number().optional(),
|
|
133
|
+
min_score: z.number().optional(),
|
|
134
|
+
include_evidence: z.boolean().optional(),
|
|
128
135
|
}),
|
|
129
136
|
json_schema: {
|
|
130
137
|
type: "object",
|
|
138
|
+
additionalProperties: false,
|
|
131
139
|
required: ["query"],
|
|
132
140
|
properties: {
|
|
133
|
-
query: { type: "string", description: "
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
141
|
+
query: { type: "string", description: "Focused recall query." },
|
|
142
|
+
max_results: { type: "number", description: "Maximum result count." },
|
|
143
|
+
min_score: { type: "number", minimum: 0, maximum: 1 },
|
|
144
|
+
include_evidence: { type: "boolean", description: "Include raw evidence records." },
|
|
137
145
|
},
|
|
138
146
|
},
|
|
139
147
|
},
|
|
140
|
-
examples: [
|
|
141
|
-
{ title: "Search memory", payload: { query: "user preferences" } },
|
|
142
|
-
],
|
|
148
|
+
examples: [{ title: "Recall preferences", payload: { query: "user preferences" } }],
|
|
143
149
|
command: {
|
|
144
|
-
description: "
|
|
150
|
+
description: "Recall scoped long-term memories.",
|
|
145
151
|
configure(command) {
|
|
146
152
|
command
|
|
147
153
|
.argument("<query>")
|
|
148
|
-
.option("--max-results <number>", "Maximum
|
|
149
|
-
.option("--min-score <number>", "Minimum relevance score.",
|
|
150
|
-
.option("--include-
|
|
154
|
+
.option("--max-results <number>", "Maximum result count.", parse_positive_integer)
|
|
155
|
+
.option("--min-score <number>", "Minimum relevance score.", parse_number)
|
|
156
|
+
.option("--include-evidence", "Include raw evidence records.");
|
|
151
157
|
},
|
|
152
158
|
map_input({ args, opts }) {
|
|
153
|
-
|
|
159
|
+
return {
|
|
154
160
|
query: String(args[0] || ""),
|
|
161
|
+
...(typeof opts.maxResults === "number" ? { max_results: opts.maxResults } : {}),
|
|
162
|
+
...(typeof opts.minScore === "number" ? { min_score: opts.minScore } : {}),
|
|
163
|
+
...(opts.includeEvidence === true ? { include_evidence: true } : {}),
|
|
155
164
|
};
|
|
156
|
-
if (typeof opts.maxResults === "number") {
|
|
157
|
-
payload.maxResults = opts.maxResults;
|
|
158
|
-
}
|
|
159
|
-
if (typeof opts.minScore === "number") {
|
|
160
|
-
payload.minScore = opts.minScore;
|
|
161
|
-
}
|
|
162
|
-
if (opts.includeSources === true) {
|
|
163
|
-
payload.includeSources = true;
|
|
164
|
-
}
|
|
165
|
-
return payload;
|
|
166
165
|
},
|
|
167
166
|
},
|
|
168
|
-
execute: async (
|
|
169
|
-
const body =
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
includeSources: readOptionalBoolean(body, "includeSources"),
|
|
167
|
+
execute: async ({ context, input }) => {
|
|
168
|
+
const body = read_body_object(input);
|
|
169
|
+
return await search_memory_action(context, this.provider, {
|
|
170
|
+
query: read_string(body, "query"),
|
|
171
|
+
max_results: read_optional_number(body, "max_results"),
|
|
172
|
+
min_score: read_optional_number(body, "min_score"),
|
|
173
|
+
include_evidence: read_optional_boolean(body, "include_evidence"),
|
|
176
174
|
});
|
|
177
175
|
},
|
|
178
176
|
}),
|
|
179
177
|
read: create_action({
|
|
180
|
-
description: "Read
|
|
178
|
+
description: "Read one exact memory by memory_id.",
|
|
181
179
|
input_schema: {
|
|
182
180
|
zod: z.object({
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
181
|
+
memory_id: z.string(),
|
|
182
|
+
from_line: z.number().optional(),
|
|
183
|
+
line_count: z.number().optional(),
|
|
186
184
|
}),
|
|
187
185
|
json_schema: {
|
|
188
186
|
type: "object",
|
|
189
|
-
|
|
187
|
+
additionalProperties: false,
|
|
188
|
+
required: ["memory_id"],
|
|
190
189
|
properties: {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
190
|
+
memory_id: { type: "string", description: "Stable logical memory identifier." },
|
|
191
|
+
from_line: { type: "number", minimum: 1 },
|
|
192
|
+
line_count: { type: "number", minimum: 1 },
|
|
194
193
|
},
|
|
195
194
|
},
|
|
196
195
|
},
|
|
197
|
-
examples: [
|
|
198
|
-
{ title: "Read full page", payload: { path: ".downcity/memory/wiki/index.md" } },
|
|
199
|
-
],
|
|
196
|
+
examples: [{ title: "Read a memory", payload: { memory_id: "wiki/user-preferences" } }],
|
|
200
197
|
command: {
|
|
201
|
-
description: "Read
|
|
198
|
+
description: "Read one exact memory.",
|
|
202
199
|
configure(command) {
|
|
203
200
|
command
|
|
204
|
-
.argument("<
|
|
205
|
-
.option("--from <number>", "Starting line, 1-based.",
|
|
206
|
-
.option("--
|
|
201
|
+
.argument("<memory_id>")
|
|
202
|
+
.option("--from-line <number>", "Starting line, 1-based.", parse_positive_integer)
|
|
203
|
+
.option("--line-count <number>", "Maximum line count.", parse_positive_integer);
|
|
207
204
|
},
|
|
208
205
|
map_input({ args, opts }) {
|
|
209
|
-
|
|
210
|
-
|
|
206
|
+
return {
|
|
207
|
+
memory_id: String(args[0] || ""),
|
|
208
|
+
...(typeof opts.fromLine === "number" ? { from_line: opts.fromLine } : {}),
|
|
209
|
+
...(typeof opts.lineCount === "number" ? { line_count: opts.lineCount } : {}),
|
|
211
210
|
};
|
|
212
|
-
if (typeof opts.from === "number") {
|
|
213
|
-
payload.from = opts.from;
|
|
214
|
-
}
|
|
215
|
-
if (typeof opts.lines === "number") {
|
|
216
|
-
payload.lines = opts.lines;
|
|
217
|
-
}
|
|
218
|
-
return payload;
|
|
219
211
|
},
|
|
220
212
|
},
|
|
221
|
-
execute: async (
|
|
222
|
-
const body =
|
|
223
|
-
return await
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
213
|
+
execute: async ({ context, input }) => {
|
|
214
|
+
const body = read_body_object(input);
|
|
215
|
+
return await read_memory_action(context, this.provider, {
|
|
216
|
+
memory_id: read_string(body, "memory_id"),
|
|
217
|
+
from_line: read_optional_number(body, "from_line"),
|
|
218
|
+
line_count: read_optional_number(body, "line_count"),
|
|
227
219
|
});
|
|
228
220
|
},
|
|
229
221
|
}),
|
|
230
222
|
remember: create_action({
|
|
231
|
-
description: "
|
|
223
|
+
description: "Store a durable fact, preference, decision, episode, procedure, or document.",
|
|
232
224
|
input_schema: {
|
|
233
225
|
zod: z.object({
|
|
234
226
|
content: z.string(),
|
|
235
227
|
topic: z.string().optional(),
|
|
236
|
-
|
|
228
|
+
memory_type: memory_type_schema.optional(),
|
|
237
229
|
source: z.string().optional(),
|
|
238
230
|
}),
|
|
239
231
|
json_schema: {
|
|
240
232
|
type: "object",
|
|
233
|
+
additionalProperties: false,
|
|
241
234
|
required: ["content"],
|
|
242
235
|
properties: {
|
|
243
236
|
content: { type: "string", description: "Content to remember." },
|
|
244
|
-
topic: { type: "string", description: "
|
|
245
|
-
|
|
246
|
-
|
|
237
|
+
topic: { type: "string", description: "Optional organization hint." },
|
|
238
|
+
memory_type: {
|
|
239
|
+
type: "string",
|
|
240
|
+
enum: ["fact", "preference", "decision", "episode", "procedure", "document"],
|
|
241
|
+
},
|
|
242
|
+
source: { type: "string", description: "Optional evidence label." },
|
|
247
243
|
},
|
|
248
244
|
},
|
|
249
245
|
},
|
|
250
|
-
examples: [
|
|
251
|
-
|
|
252
|
-
|
|
246
|
+
examples: [{
|
|
247
|
+
title: "Remember a preference",
|
|
248
|
+
payload: {
|
|
249
|
+
content: "User prefers concise answers.",
|
|
250
|
+
topic: "user-preferences",
|
|
251
|
+
memory_type: "preference",
|
|
252
|
+
},
|
|
253
|
+
}],
|
|
253
254
|
command: {
|
|
254
|
-
description: "
|
|
255
|
+
description: "Store a durable memory.",
|
|
255
256
|
configure(command) {
|
|
256
257
|
command
|
|
257
258
|
.requiredOption("--content <text>", "Content to remember.")
|
|
258
|
-
.option("--topic <topic>", "
|
|
259
|
-
.option("--
|
|
260
|
-
.option("--source <source>", "
|
|
259
|
+
.option("--topic <topic>", "Optional organization hint.")
|
|
260
|
+
.option("--memory-type <type>", "Memory type.")
|
|
261
|
+
.option("--source <source>", "Optional evidence label.");
|
|
261
262
|
},
|
|
262
263
|
map_input({ opts }) {
|
|
263
|
-
|
|
264
|
+
return {
|
|
264
265
|
content: String(opts.content || ""),
|
|
266
|
+
...(typeof opts.topic === "string" ? { topic: opts.topic } : {}),
|
|
267
|
+
...(typeof opts.memoryType === "string" ? { memory_type: opts.memoryType } : {}),
|
|
268
|
+
...(typeof opts.source === "string" ? { source: opts.source } : {}),
|
|
265
269
|
};
|
|
266
|
-
if (typeof opts.topic === "string") {
|
|
267
|
-
payload.topic = String(opts.topic).trim();
|
|
268
|
-
}
|
|
269
|
-
if (typeof opts.wikiPath === "string") {
|
|
270
|
-
payload.path = String(opts.wikiPath).trim();
|
|
271
|
-
}
|
|
272
|
-
if (typeof opts.source === "string") {
|
|
273
|
-
payload.source = String(opts.source).trim();
|
|
274
|
-
}
|
|
275
|
-
return payload;
|
|
276
270
|
},
|
|
277
271
|
},
|
|
278
|
-
execute: async (
|
|
279
|
-
const body =
|
|
280
|
-
return await
|
|
281
|
-
content:
|
|
282
|
-
topic:
|
|
283
|
-
|
|
284
|
-
source:
|
|
272
|
+
execute: async ({ context, input }) => {
|
|
273
|
+
const body = read_body_object(input);
|
|
274
|
+
return await remember_memory_action(context, this.provider, {
|
|
275
|
+
content: read_string(body, "content"),
|
|
276
|
+
topic: read_optional_string(body, "topic"),
|
|
277
|
+
memory_type: read_optional_memory_type(body),
|
|
278
|
+
source: read_optional_string(body, "source"),
|
|
285
279
|
});
|
|
286
280
|
},
|
|
287
281
|
}),
|
|
288
282
|
digest: create_action({
|
|
289
|
-
description: "Digest a
|
|
283
|
+
description: "Digest a canonical Session transcript into long-term memory.",
|
|
290
284
|
input_schema: {
|
|
291
285
|
zod: z.object({
|
|
292
286
|
session_id: z.string(),
|
|
293
|
-
|
|
287
|
+
max_messages: z.number().optional(),
|
|
294
288
|
}),
|
|
295
289
|
json_schema: {
|
|
296
290
|
type: "object",
|
|
291
|
+
additionalProperties: false,
|
|
297
292
|
required: ["session_id"],
|
|
298
293
|
properties: {
|
|
299
|
-
session_id: { type: "string"
|
|
300
|
-
|
|
294
|
+
session_id: { type: "string" },
|
|
295
|
+
max_messages: { type: "number", minimum: 1 },
|
|
301
296
|
},
|
|
302
297
|
},
|
|
303
298
|
},
|
|
304
|
-
examples: [
|
|
305
|
-
{ title: "Digest session", payload: { session_id: "sess-1" } },
|
|
306
|
-
],
|
|
299
|
+
examples: [{ title: "Digest a Session", payload: { session_id: "sess-1" } }],
|
|
307
300
|
command: {
|
|
308
|
-
description: "Digest a
|
|
301
|
+
description: "Digest a canonical Session transcript.",
|
|
309
302
|
configure(command) {
|
|
310
303
|
command
|
|
311
|
-
.requiredOption("--session-id <session_id>", "Session
|
|
312
|
-
.option("--max-messages <number>", "
|
|
304
|
+
.requiredOption("--session-id <session_id>", "Session identifier.")
|
|
305
|
+
.option("--max-messages <number>", "Maximum message count.", parse_positive_integer);
|
|
313
306
|
},
|
|
314
307
|
map_input({ opts }) {
|
|
315
|
-
|
|
316
|
-
session_id: String(opts.
|
|
308
|
+
return {
|
|
309
|
+
session_id: String(opts.sessionId || ""),
|
|
310
|
+
...(typeof opts.maxMessages === "number" ? { max_messages: opts.maxMessages } : {}),
|
|
317
311
|
};
|
|
318
|
-
if (typeof opts.maxMessages === "number") {
|
|
319
|
-
payload.maxMessages = opts.maxMessages;
|
|
320
|
-
}
|
|
321
|
-
return payload;
|
|
322
312
|
},
|
|
323
313
|
},
|
|
324
|
-
execute: async (
|
|
325
|
-
const body =
|
|
326
|
-
return await
|
|
327
|
-
session_id:
|
|
328
|
-
|
|
314
|
+
execute: async ({ context, input }) => {
|
|
315
|
+
const body = read_body_object(input);
|
|
316
|
+
return await digest_memory_action(context, this.provider, {
|
|
317
|
+
session_id: read_string(body, "session_id"),
|
|
318
|
+
max_messages: read_optional_number(body, "max_messages"),
|
|
329
319
|
});
|
|
330
320
|
},
|
|
331
321
|
}),
|
|
332
322
|
revise: create_action({
|
|
333
|
-
description: "Revise
|
|
323
|
+
description: "Revise one memory using new evidence.",
|
|
334
324
|
input_schema: {
|
|
335
325
|
zod: z.object({
|
|
336
|
-
|
|
326
|
+
memory_id: z.string(),
|
|
337
327
|
instruction: z.string(),
|
|
338
328
|
evidence: z.string().optional(),
|
|
339
329
|
}),
|
|
340
330
|
json_schema: {
|
|
341
331
|
type: "object",
|
|
342
|
-
|
|
332
|
+
additionalProperties: false,
|
|
333
|
+
required: ["memory_id", "instruction"],
|
|
343
334
|
properties: {
|
|
344
|
-
|
|
345
|
-
instruction: { type: "string"
|
|
346
|
-
evidence: { type: "string"
|
|
335
|
+
memory_id: { type: "string" },
|
|
336
|
+
instruction: { type: "string" },
|
|
337
|
+
evidence: { type: "string" },
|
|
347
338
|
},
|
|
348
339
|
},
|
|
349
340
|
},
|
|
350
|
-
examples: [
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
341
|
+
examples: [{
|
|
342
|
+
title: "Revise a preference",
|
|
343
|
+
payload: {
|
|
344
|
+
memory_id: "wiki/user-preferences",
|
|
345
|
+
instruction: "Replace the old preference with the latest one.",
|
|
346
|
+
},
|
|
347
|
+
}],
|
|
356
348
|
command: {
|
|
357
|
-
description: "Revise
|
|
349
|
+
description: "Revise one memory using new evidence.",
|
|
358
350
|
configure(command) {
|
|
359
351
|
command
|
|
360
|
-
.argument("<
|
|
352
|
+
.argument("<memory_id>")
|
|
361
353
|
.requiredOption("--instruction <text>", "Revision instruction.")
|
|
362
354
|
.option("--evidence <text>", "New evidence.");
|
|
363
355
|
},
|
|
364
356
|
map_input({ args, opts }) {
|
|
365
|
-
|
|
366
|
-
|
|
357
|
+
return {
|
|
358
|
+
memory_id: String(args[0] || ""),
|
|
367
359
|
instruction: String(opts.instruction || ""),
|
|
360
|
+
...(typeof opts.evidence === "string" ? { evidence: opts.evidence } : {}),
|
|
368
361
|
};
|
|
369
|
-
if (typeof opts.evidence === "string") {
|
|
370
|
-
payload.evidence = String(opts.evidence).trim();
|
|
371
|
-
}
|
|
372
|
-
return payload;
|
|
373
362
|
},
|
|
374
363
|
},
|
|
375
|
-
execute: async (
|
|
376
|
-
const body =
|
|
377
|
-
return await
|
|
378
|
-
|
|
379
|
-
instruction:
|
|
380
|
-
evidence:
|
|
364
|
+
execute: async ({ context, input }) => {
|
|
365
|
+
const body = read_body_object(input);
|
|
366
|
+
return await revise_memory_action(context, this.provider, {
|
|
367
|
+
memory_id: read_string(body, "memory_id"),
|
|
368
|
+
instruction: read_string(body, "instruction"),
|
|
369
|
+
evidence: read_optional_string(body, "evidence"),
|
|
370
|
+
});
|
|
371
|
+
},
|
|
372
|
+
}),
|
|
373
|
+
forget: create_action({
|
|
374
|
+
description: "Delete or invalidate one memory by memory_id.",
|
|
375
|
+
input_schema: {
|
|
376
|
+
zod: z.object({ memory_id: z.string() }),
|
|
377
|
+
json_schema: {
|
|
378
|
+
type: "object",
|
|
379
|
+
additionalProperties: false,
|
|
380
|
+
required: ["memory_id"],
|
|
381
|
+
properties: { memory_id: { type: "string" } },
|
|
382
|
+
},
|
|
383
|
+
},
|
|
384
|
+
examples: [{ title: "Forget a memory", payload: { memory_id: "wiki/obsolete" } }],
|
|
385
|
+
command: {
|
|
386
|
+
description: "Delete or invalidate one memory.",
|
|
387
|
+
configure(command) {
|
|
388
|
+
command.argument("<memory_id>");
|
|
389
|
+
},
|
|
390
|
+
map_input({ args }) {
|
|
391
|
+
return { memory_id: String(args[0] || "") };
|
|
392
|
+
},
|
|
393
|
+
},
|
|
394
|
+
execute: async ({ context, input }) => {
|
|
395
|
+
const body = read_body_object(input);
|
|
396
|
+
return await forget_memory_action(context, this.provider, {
|
|
397
|
+
memory_id: read_string(body, "memory_id"),
|
|
381
398
|
});
|
|
382
399
|
},
|
|
383
400
|
}),
|
|
384
401
|
};
|
|
385
|
-
/**
|
|
386
|
-
* 获取或创建当前实例绑定的 memory plugin state。
|
|
387
|
-
*/
|
|
388
|
-
getOrCreateRuntimeState(context) {
|
|
389
|
-
if (!this.runtimeState) {
|
|
390
|
-
this.runtimeState = createMemoryRuntimeState(context);
|
|
391
|
-
}
|
|
392
|
-
return this.runtimeState;
|
|
393
|
-
}
|
|
394
402
|
}
|
|
395
403
|
//# sourceMappingURL=MemoryPlugin.js.map
|