@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,422 +1,442 @@
|
|
|
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
14
|
|
|
10
15
|
import type { Command } from "commander";
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
+
import os from "node:os";
|
|
17
|
+
import path from "node:path";
|
|
18
|
+
import { BasePlugin, create_action } from "@downcity/agent";
|
|
19
|
+
import type {
|
|
20
|
+
JsonObject,
|
|
21
|
+
JsonValue,
|
|
22
|
+
PluginActions,
|
|
23
|
+
PluginContext,
|
|
24
|
+
} from "@downcity/agent";
|
|
16
25
|
import { z } from "zod";
|
|
17
26
|
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
} from "
|
|
29
|
-
import {
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
digest_memory_action,
|
|
28
|
+
forget_memory_action,
|
|
29
|
+
read_memory_action,
|
|
30
|
+
remember_memory_action,
|
|
31
|
+
revise_memory_action,
|
|
32
|
+
search_memory_action,
|
|
33
|
+
status_memory_action,
|
|
34
|
+
} from "@/memory/Action.js";
|
|
35
|
+
import { build_memory_plugin_system_text } from "@/memory/runtime/SystemProvider.js";
|
|
36
|
+
import { BuiltinMemoryProvider } from "@/memory/providers/BuiltinMemoryProvider.js";
|
|
37
|
+
import { FileMemoryStorageAdapter, get_default_file_memory_root_path } from "@/memory/adapters/FileMemoryStorageAdapter.js";
|
|
38
|
+
import type {
|
|
39
|
+
MemoryPluginOptions,
|
|
40
|
+
MemoryProvider,
|
|
41
|
+
MemoryType,
|
|
42
|
+
} from "@/memory/types/Memory.js";
|
|
43
|
+
|
|
44
|
+
const memory_type_schema = z.enum([
|
|
45
|
+
"fact",
|
|
46
|
+
"preference",
|
|
47
|
+
"decision",
|
|
48
|
+
"episode",
|
|
49
|
+
"procedure",
|
|
50
|
+
"document",
|
|
51
|
+
]);
|
|
32
52
|
|
|
33
|
-
|
|
53
|
+
/** 解析正整数 CLI 参数。 */
|
|
54
|
+
function parse_positive_integer(value: string): number {
|
|
34
55
|
const text = String(value || "").trim();
|
|
35
|
-
if (!/^\d
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const num = Number(text);
|
|
39
|
-
if (!Number.isFinite(num) || num < 1) {
|
|
56
|
+
if (!/^\d+$/u.test(text)) throw new Error(`Invalid positive integer: ${value}`);
|
|
57
|
+
const number_value = Number(text);
|
|
58
|
+
if (!Number.isFinite(number_value) || number_value < 1) {
|
|
40
59
|
throw new Error(`Invalid positive integer: ${value}`);
|
|
41
60
|
}
|
|
42
|
-
return
|
|
61
|
+
return number_value;
|
|
43
62
|
}
|
|
44
63
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const num = Number(text);
|
|
51
|
-
if (!Number.isFinite(num)) {
|
|
52
|
-
throw new Error(`Invalid number: ${value}`);
|
|
53
|
-
}
|
|
54
|
-
return num;
|
|
64
|
+
/** 解析任意有限数值 CLI 参数。 */
|
|
65
|
+
function parse_number(value: string): number {
|
|
66
|
+
const number_value = Number(String(value || "").trim());
|
|
67
|
+
if (!Number.isFinite(number_value)) throw new Error(`Invalid number: ${value}`);
|
|
68
|
+
return number_value;
|
|
55
69
|
}
|
|
56
70
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
71
|
+
/** 把 Action JSON 输入归一化为普通对象。 */
|
|
72
|
+
function read_body_object(raw_body: JsonValue): JsonObject {
|
|
73
|
+
return raw_body && typeof raw_body === "object" && !Array.isArray(raw_body)
|
|
74
|
+
? raw_body as JsonObject
|
|
75
|
+
: {};
|
|
62
76
|
}
|
|
63
77
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return typeof
|
|
78
|
+
/** 读取必填或可选字符串字段。 */
|
|
79
|
+
function read_string(body: JsonObject, key: string): string {
|
|
80
|
+
return typeof body[key] === "string" ? String(body[key]) : "";
|
|
67
81
|
}
|
|
68
82
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
83
|
+
/** 读取可选字符串字段。 */
|
|
84
|
+
function read_optional_string(body: JsonObject, key: string): string | undefined {
|
|
85
|
+
const value = read_string(body, key).trim();
|
|
86
|
+
return value || undefined;
|
|
72
87
|
}
|
|
73
88
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return typeof
|
|
89
|
+
/** 读取可选数值字段。 */
|
|
90
|
+
function read_optional_number(body: JsonObject, key: string): number | undefined {
|
|
91
|
+
return typeof body[key] === "number" ? Number(body[key]) : undefined;
|
|
77
92
|
}
|
|
78
93
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return typeof
|
|
94
|
+
/** 读取可选布尔字段。 */
|
|
95
|
+
function read_optional_boolean(body: JsonObject, key: string): boolean | undefined {
|
|
96
|
+
return typeof body[key] === "boolean" ? Boolean(body[key]) : undefined;
|
|
82
97
|
}
|
|
83
98
|
|
|
84
|
-
/**
|
|
85
|
-
|
|
86
|
-
|
|
99
|
+
/** 读取可选 MemoryType 字段。 */
|
|
100
|
+
function read_optional_memory_type(body: JsonObject): MemoryType | undefined {
|
|
101
|
+
const result = memory_type_schema.safeParse(body.memory_type);
|
|
102
|
+
return result.success ? result.data : undefined;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** Agent 长期记忆 Plugin。 */
|
|
87
106
|
export class MemoryPlugin extends BasePlugin {
|
|
88
|
-
/**
|
|
89
|
-
* plugin 名称。
|
|
90
|
-
*/
|
|
107
|
+
/** Plugin 稳定名称。 */
|
|
91
108
|
readonly name = "memory";
|
|
92
109
|
|
|
93
|
-
/**
|
|
94
|
-
|
|
95
|
-
*/
|
|
96
|
-
public runtimeState: MemoryRuntimeState | null = null;
|
|
110
|
+
/** 当前 Plugin 唯一绑定的 Memory Provider。 */
|
|
111
|
+
readonly provider: MemoryProvider;
|
|
97
112
|
|
|
98
|
-
|
|
99
|
-
* 创建 MemoryPlugin。
|
|
100
|
-
*/
|
|
101
|
-
constructor(private readonly options: MemoryPluginOptions = {}) {
|
|
113
|
+
constructor(profile: MemoryPluginOptions = {}) {
|
|
102
114
|
super();
|
|
115
|
+
const root_path = profile.root_path?.trim();
|
|
116
|
+
if (root_path && !path.isAbsolute(root_path)) {
|
|
117
|
+
throw new Error("MemoryPlugin root_path must be absolute");
|
|
118
|
+
}
|
|
119
|
+
this.provider = new BuiltinMemoryProvider({
|
|
120
|
+
create_storage: ({ agent_id }) => new FileMemoryStorageAdapter({
|
|
121
|
+
root_path: root_path || get_default_file_memory_root_path({
|
|
122
|
+
platform_root_path: process.env.DC_PLATFORM_ROOT || path.join(os.homedir(), ".downcity"),
|
|
123
|
+
agent_id,
|
|
124
|
+
}),
|
|
125
|
+
}),
|
|
126
|
+
});
|
|
103
127
|
}
|
|
104
128
|
|
|
105
|
-
/**
|
|
106
|
-
* 当前 plugin 的 system 文本提供器。
|
|
107
|
-
*/
|
|
129
|
+
/** 构建 provider-neutral Memory system 内容。 */
|
|
108
130
|
async system(context: PluginContext): Promise<string> {
|
|
109
|
-
return await
|
|
131
|
+
return await build_memory_plugin_system_text(context, this.provider);
|
|
110
132
|
}
|
|
111
133
|
|
|
112
|
-
/**
|
|
113
|
-
* 当前 plugin 生命周期。
|
|
114
|
-
*/
|
|
134
|
+
/** Provider 生命周期与当前 Agent Plugin 实例保持一致。 */
|
|
115
135
|
readonly lifecycle = {
|
|
116
136
|
start: async (context: PluginContext): Promise<void> => {
|
|
117
|
-
await
|
|
118
|
-
|
|
137
|
+
await this.provider.initialize({
|
|
138
|
+
agent_id: context.agent_id,
|
|
139
|
+
});
|
|
119
140
|
},
|
|
120
141
|
stop: async (): Promise<void> => {
|
|
121
|
-
this.
|
|
142
|
+
await this.provider.dispose();
|
|
122
143
|
},
|
|
123
144
|
};
|
|
124
145
|
|
|
125
|
-
/**
|
|
126
|
-
* 当前 plugin action 定义表。
|
|
127
|
-
*/
|
|
146
|
+
/** Memory 对 Agent 暴露的稳定 Action 集合。 */
|
|
128
147
|
readonly actions: PluginActions = {
|
|
129
148
|
status: create_action({
|
|
130
|
-
description: "
|
|
149
|
+
description: "Inspect the active Memory Provider and its capabilities.",
|
|
131
150
|
input_schema: {
|
|
132
151
|
zod: z.object({}).passthrough(),
|
|
133
|
-
json_schema: { type: "object", properties: {} },
|
|
152
|
+
json_schema: { type: "object", additionalProperties: false, properties: {} },
|
|
134
153
|
},
|
|
135
|
-
examples: [{ title: "View status", payload: {} }],
|
|
154
|
+
examples: [{ title: "View Memory Provider status", payload: {} }],
|
|
136
155
|
command: {
|
|
137
|
-
description: "
|
|
138
|
-
map_input() {
|
|
139
|
-
return {};
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
execute: async (params) => {
|
|
143
|
-
const state = this.getOrCreateRuntimeState(params.context);
|
|
144
|
-
return await statusMemoryAction(params.context, state);
|
|
156
|
+
description: "Inspect the active Memory Provider.",
|
|
157
|
+
map_input: () => ({}),
|
|
145
158
|
},
|
|
159
|
+
execute: async () => await status_memory_action(this.provider),
|
|
146
160
|
}),
|
|
161
|
+
|
|
147
162
|
search: create_action({
|
|
148
|
-
description: "
|
|
163
|
+
description: "Recall scoped long-term memories for a focused query.",
|
|
149
164
|
input_schema: {
|
|
150
165
|
zod: z.object({
|
|
151
166
|
query: z.string(),
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
167
|
+
max_results: z.number().optional(),
|
|
168
|
+
min_score: z.number().optional(),
|
|
169
|
+
include_evidence: z.boolean().optional(),
|
|
155
170
|
}),
|
|
156
171
|
json_schema: {
|
|
157
172
|
type: "object",
|
|
173
|
+
additionalProperties: false,
|
|
158
174
|
required: ["query"],
|
|
159
175
|
properties: {
|
|
160
|
-
query: { type: "string", description: "
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
176
|
+
query: { type: "string", description: "Focused recall query." },
|
|
177
|
+
max_results: { type: "number", description: "Maximum result count." },
|
|
178
|
+
min_score: { type: "number", minimum: 0, maximum: 1 },
|
|
179
|
+
include_evidence: { type: "boolean", description: "Include raw evidence records." },
|
|
164
180
|
},
|
|
165
181
|
},
|
|
166
182
|
},
|
|
167
|
-
examples: [
|
|
168
|
-
{ title: "Search memory", payload: { query: "user preferences" } },
|
|
169
|
-
],
|
|
183
|
+
examples: [{ title: "Recall preferences", payload: { query: "user preferences" } }],
|
|
170
184
|
command: {
|
|
171
|
-
description: "
|
|
185
|
+
description: "Recall scoped long-term memories.",
|
|
172
186
|
configure(command: Command) {
|
|
173
187
|
command
|
|
174
188
|
.argument("<query>")
|
|
175
|
-
.option("--max-results <number>", "Maximum
|
|
176
|
-
.option("--min-score <number>", "Minimum relevance score.",
|
|
177
|
-
.option("--include-
|
|
189
|
+
.option("--max-results <number>", "Maximum result count.", parse_positive_integer)
|
|
190
|
+
.option("--min-score <number>", "Minimum relevance score.", parse_number)
|
|
191
|
+
.option("--include-evidence", "Include raw evidence records.");
|
|
178
192
|
},
|
|
179
193
|
map_input({ args, opts }) {
|
|
180
|
-
|
|
194
|
+
return {
|
|
181
195
|
query: String(args[0] || ""),
|
|
196
|
+
...(typeof opts.maxResults === "number" ? { max_results: opts.maxResults } : {}),
|
|
197
|
+
...(typeof opts.minScore === "number" ? { min_score: opts.minScore } : {}),
|
|
198
|
+
...(opts.includeEvidence === true ? { include_evidence: true } : {}),
|
|
182
199
|
};
|
|
183
|
-
if (typeof opts.maxResults === "number") {
|
|
184
|
-
payload.maxResults = opts.maxResults;
|
|
185
|
-
}
|
|
186
|
-
if (typeof opts.minScore === "number") {
|
|
187
|
-
payload.minScore = opts.minScore;
|
|
188
|
-
}
|
|
189
|
-
if (opts.includeSources === true) {
|
|
190
|
-
payload.includeSources = true;
|
|
191
|
-
}
|
|
192
|
-
return payload;
|
|
193
200
|
},
|
|
194
201
|
},
|
|
195
|
-
execute: async (
|
|
196
|
-
const body =
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
includeSources: readOptionalBoolean(body, "includeSources"),
|
|
202
|
+
execute: async ({ context, input }) => {
|
|
203
|
+
const body = read_body_object(input);
|
|
204
|
+
return await search_memory_action(context, this.provider, {
|
|
205
|
+
query: read_string(body, "query"),
|
|
206
|
+
max_results: read_optional_number(body, "max_results"),
|
|
207
|
+
min_score: read_optional_number(body, "min_score"),
|
|
208
|
+
include_evidence: read_optional_boolean(body, "include_evidence"),
|
|
203
209
|
});
|
|
204
210
|
},
|
|
205
211
|
}),
|
|
212
|
+
|
|
206
213
|
read: create_action({
|
|
207
|
-
description: "Read
|
|
214
|
+
description: "Read one exact memory by memory_id.",
|
|
208
215
|
input_schema: {
|
|
209
216
|
zod: z.object({
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
217
|
+
memory_id: z.string(),
|
|
218
|
+
from_line: z.number().optional(),
|
|
219
|
+
line_count: z.number().optional(),
|
|
213
220
|
}),
|
|
214
221
|
json_schema: {
|
|
215
222
|
type: "object",
|
|
216
|
-
|
|
223
|
+
additionalProperties: false,
|
|
224
|
+
required: ["memory_id"],
|
|
217
225
|
properties: {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
226
|
+
memory_id: { type: "string", description: "Stable logical memory identifier." },
|
|
227
|
+
from_line: { type: "number", minimum: 1 },
|
|
228
|
+
line_count: { type: "number", minimum: 1 },
|
|
221
229
|
},
|
|
222
230
|
},
|
|
223
231
|
},
|
|
224
|
-
examples: [
|
|
225
|
-
{ title: "Read full page", payload: { path: ".downcity/memory/wiki/index.md" } },
|
|
226
|
-
],
|
|
232
|
+
examples: [{ title: "Read a memory", payload: { memory_id: "wiki/user-preferences" } }],
|
|
227
233
|
command: {
|
|
228
|
-
description: "Read
|
|
234
|
+
description: "Read one exact memory.",
|
|
229
235
|
configure(command: Command) {
|
|
230
236
|
command
|
|
231
|
-
.argument("<
|
|
232
|
-
.option("--from <number>", "Starting line, 1-based.",
|
|
233
|
-
.option("--
|
|
237
|
+
.argument("<memory_id>")
|
|
238
|
+
.option("--from-line <number>", "Starting line, 1-based.", parse_positive_integer)
|
|
239
|
+
.option("--line-count <number>", "Maximum line count.", parse_positive_integer);
|
|
234
240
|
},
|
|
235
241
|
map_input({ args, opts }) {
|
|
236
|
-
|
|
237
|
-
|
|
242
|
+
return {
|
|
243
|
+
memory_id: String(args[0] || ""),
|
|
244
|
+
...(typeof opts.fromLine === "number" ? { from_line: opts.fromLine } : {}),
|
|
245
|
+
...(typeof opts.lineCount === "number" ? { line_count: opts.lineCount } : {}),
|
|
238
246
|
};
|
|
239
|
-
if (typeof opts.from === "number") {
|
|
240
|
-
payload.from = opts.from;
|
|
241
|
-
}
|
|
242
|
-
if (typeof opts.lines === "number") {
|
|
243
|
-
payload.lines = opts.lines;
|
|
244
|
-
}
|
|
245
|
-
return payload;
|
|
246
247
|
},
|
|
247
248
|
},
|
|
248
|
-
execute: async (
|
|
249
|
-
const body =
|
|
250
|
-
return await
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
249
|
+
execute: async ({ context, input }) => {
|
|
250
|
+
const body = read_body_object(input);
|
|
251
|
+
return await read_memory_action(context, this.provider, {
|
|
252
|
+
memory_id: read_string(body, "memory_id"),
|
|
253
|
+
from_line: read_optional_number(body, "from_line"),
|
|
254
|
+
line_count: read_optional_number(body, "line_count"),
|
|
254
255
|
});
|
|
255
256
|
},
|
|
256
257
|
}),
|
|
258
|
+
|
|
257
259
|
remember: create_action({
|
|
258
|
-
description: "
|
|
260
|
+
description: "Store a durable fact, preference, decision, episode, procedure, or document.",
|
|
259
261
|
input_schema: {
|
|
260
262
|
zod: z.object({
|
|
261
263
|
content: z.string(),
|
|
262
264
|
topic: z.string().optional(),
|
|
263
|
-
|
|
265
|
+
memory_type: memory_type_schema.optional(),
|
|
264
266
|
source: z.string().optional(),
|
|
265
267
|
}),
|
|
266
268
|
json_schema: {
|
|
267
269
|
type: "object",
|
|
270
|
+
additionalProperties: false,
|
|
268
271
|
required: ["content"],
|
|
269
272
|
properties: {
|
|
270
273
|
content: { type: "string", description: "Content to remember." },
|
|
271
|
-
topic: { type: "string", description: "
|
|
272
|
-
|
|
273
|
-
|
|
274
|
+
topic: { type: "string", description: "Optional organization hint." },
|
|
275
|
+
memory_type: {
|
|
276
|
+
type: "string",
|
|
277
|
+
enum: ["fact", "preference", "decision", "episode", "procedure", "document"],
|
|
278
|
+
},
|
|
279
|
+
source: { type: "string", description: "Optional evidence label." },
|
|
274
280
|
},
|
|
275
281
|
},
|
|
276
282
|
},
|
|
277
|
-
examples: [
|
|
278
|
-
|
|
279
|
-
|
|
283
|
+
examples: [{
|
|
284
|
+
title: "Remember a preference",
|
|
285
|
+
payload: {
|
|
286
|
+
content: "User prefers concise answers.",
|
|
287
|
+
topic: "user-preferences",
|
|
288
|
+
memory_type: "preference",
|
|
289
|
+
},
|
|
290
|
+
}],
|
|
280
291
|
command: {
|
|
281
|
-
description: "
|
|
292
|
+
description: "Store a durable memory.",
|
|
282
293
|
configure(command: Command) {
|
|
283
294
|
command
|
|
284
295
|
.requiredOption("--content <text>", "Content to remember.")
|
|
285
|
-
.option("--topic <topic>", "
|
|
286
|
-
.option("--
|
|
287
|
-
.option("--source <source>", "
|
|
296
|
+
.option("--topic <topic>", "Optional organization hint.")
|
|
297
|
+
.option("--memory-type <type>", "Memory type.")
|
|
298
|
+
.option("--source <source>", "Optional evidence label.");
|
|
288
299
|
},
|
|
289
300
|
map_input({ opts }) {
|
|
290
|
-
|
|
301
|
+
return {
|
|
291
302
|
content: String(opts.content || ""),
|
|
303
|
+
...(typeof opts.topic === "string" ? { topic: opts.topic } : {}),
|
|
304
|
+
...(typeof opts.memoryType === "string" ? { memory_type: opts.memoryType } : {}),
|
|
305
|
+
...(typeof opts.source === "string" ? { source: opts.source } : {}),
|
|
292
306
|
};
|
|
293
|
-
if (typeof opts.topic === "string") {
|
|
294
|
-
payload.topic = String(opts.topic).trim();
|
|
295
|
-
}
|
|
296
|
-
if (typeof opts.wikiPath === "string") {
|
|
297
|
-
payload.path = String(opts.wikiPath).trim();
|
|
298
|
-
}
|
|
299
|
-
if (typeof opts.source === "string") {
|
|
300
|
-
payload.source = String(opts.source).trim();
|
|
301
|
-
}
|
|
302
|
-
return payload;
|
|
303
307
|
},
|
|
304
308
|
},
|
|
305
|
-
execute: async (
|
|
306
|
-
const body =
|
|
307
|
-
return await
|
|
308
|
-
content:
|
|
309
|
-
topic:
|
|
310
|
-
|
|
311
|
-
source:
|
|
309
|
+
execute: async ({ context, input }) => {
|
|
310
|
+
const body = read_body_object(input);
|
|
311
|
+
return await remember_memory_action(context, this.provider, {
|
|
312
|
+
content: read_string(body, "content"),
|
|
313
|
+
topic: read_optional_string(body, "topic"),
|
|
314
|
+
memory_type: read_optional_memory_type(body),
|
|
315
|
+
source: read_optional_string(body, "source"),
|
|
312
316
|
});
|
|
313
317
|
},
|
|
314
318
|
}),
|
|
319
|
+
|
|
315
320
|
digest: create_action({
|
|
316
|
-
description: "Digest a
|
|
321
|
+
description: "Digest a canonical Session transcript into long-term memory.",
|
|
317
322
|
input_schema: {
|
|
318
323
|
zod: z.object({
|
|
319
324
|
session_id: z.string(),
|
|
320
|
-
|
|
325
|
+
max_messages: z.number().optional(),
|
|
321
326
|
}),
|
|
322
327
|
json_schema: {
|
|
323
328
|
type: "object",
|
|
329
|
+
additionalProperties: false,
|
|
324
330
|
required: ["session_id"],
|
|
325
331
|
properties: {
|
|
326
|
-
session_id: { type: "string"
|
|
327
|
-
|
|
332
|
+
session_id: { type: "string" },
|
|
333
|
+
max_messages: { type: "number", minimum: 1 },
|
|
328
334
|
},
|
|
329
335
|
},
|
|
330
336
|
},
|
|
331
|
-
examples: [
|
|
332
|
-
{ title: "Digest session", payload: { session_id: "sess-1" } },
|
|
333
|
-
],
|
|
337
|
+
examples: [{ title: "Digest a Session", payload: { session_id: "sess-1" } }],
|
|
334
338
|
command: {
|
|
335
|
-
description: "Digest a
|
|
339
|
+
description: "Digest a canonical Session transcript.",
|
|
336
340
|
configure(command: Command) {
|
|
337
341
|
command
|
|
338
|
-
.requiredOption("--session-id <session_id>", "Session
|
|
339
|
-
.option("--max-messages <number>", "
|
|
342
|
+
.requiredOption("--session-id <session_id>", "Session identifier.")
|
|
343
|
+
.option("--max-messages <number>", "Maximum message count.", parse_positive_integer);
|
|
340
344
|
},
|
|
341
345
|
map_input({ opts }) {
|
|
342
|
-
|
|
343
|
-
session_id: String(opts.
|
|
346
|
+
return {
|
|
347
|
+
session_id: String(opts.sessionId || ""),
|
|
348
|
+
...(typeof opts.maxMessages === "number" ? { max_messages: opts.maxMessages } : {}),
|
|
344
349
|
};
|
|
345
|
-
if (typeof opts.maxMessages === "number") {
|
|
346
|
-
payload.maxMessages = opts.maxMessages;
|
|
347
|
-
}
|
|
348
|
-
return payload;
|
|
349
350
|
},
|
|
350
351
|
},
|
|
351
|
-
execute: async (
|
|
352
|
-
const body =
|
|
353
|
-
return await
|
|
354
|
-
session_id:
|
|
355
|
-
|
|
352
|
+
execute: async ({ context, input }) => {
|
|
353
|
+
const body = read_body_object(input);
|
|
354
|
+
return await digest_memory_action(context, this.provider, {
|
|
355
|
+
session_id: read_string(body, "session_id"),
|
|
356
|
+
max_messages: read_optional_number(body, "max_messages"),
|
|
356
357
|
});
|
|
357
358
|
},
|
|
358
359
|
}),
|
|
360
|
+
|
|
359
361
|
revise: create_action({
|
|
360
|
-
description: "Revise
|
|
362
|
+
description: "Revise one memory using new evidence.",
|
|
361
363
|
input_schema: {
|
|
362
364
|
zod: z.object({
|
|
363
|
-
|
|
365
|
+
memory_id: z.string(),
|
|
364
366
|
instruction: z.string(),
|
|
365
367
|
evidence: z.string().optional(),
|
|
366
368
|
}),
|
|
367
369
|
json_schema: {
|
|
368
370
|
type: "object",
|
|
369
|
-
|
|
371
|
+
additionalProperties: false,
|
|
372
|
+
required: ["memory_id", "instruction"],
|
|
370
373
|
properties: {
|
|
371
|
-
|
|
372
|
-
instruction: { type: "string"
|
|
373
|
-
evidence: { type: "string"
|
|
374
|
+
memory_id: { type: "string" },
|
|
375
|
+
instruction: { type: "string" },
|
|
376
|
+
evidence: { type: "string" },
|
|
374
377
|
},
|
|
375
378
|
},
|
|
376
379
|
},
|
|
377
|
-
examples: [
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
380
|
+
examples: [{
|
|
381
|
+
title: "Revise a preference",
|
|
382
|
+
payload: {
|
|
383
|
+
memory_id: "wiki/user-preferences",
|
|
384
|
+
instruction: "Replace the old preference with the latest one.",
|
|
381
385
|
},
|
|
382
|
-
],
|
|
386
|
+
}],
|
|
383
387
|
command: {
|
|
384
|
-
description: "Revise
|
|
388
|
+
description: "Revise one memory using new evidence.",
|
|
385
389
|
configure(command: Command) {
|
|
386
390
|
command
|
|
387
|
-
.argument("<
|
|
391
|
+
.argument("<memory_id>")
|
|
388
392
|
.requiredOption("--instruction <text>", "Revision instruction.")
|
|
389
393
|
.option("--evidence <text>", "New evidence.");
|
|
390
394
|
},
|
|
391
395
|
map_input({ args, opts }) {
|
|
392
|
-
|
|
393
|
-
|
|
396
|
+
return {
|
|
397
|
+
memory_id: String(args[0] || ""),
|
|
394
398
|
instruction: String(opts.instruction || ""),
|
|
399
|
+
...(typeof opts.evidence === "string" ? { evidence: opts.evidence } : {}),
|
|
395
400
|
};
|
|
396
|
-
if (typeof opts.evidence === "string") {
|
|
397
|
-
payload.evidence = String(opts.evidence).trim();
|
|
398
|
-
}
|
|
399
|
-
return payload;
|
|
400
401
|
},
|
|
401
402
|
},
|
|
402
|
-
execute: async (
|
|
403
|
-
const body =
|
|
404
|
-
return await
|
|
405
|
-
|
|
406
|
-
instruction:
|
|
407
|
-
evidence:
|
|
403
|
+
execute: async ({ context, input }) => {
|
|
404
|
+
const body = read_body_object(input);
|
|
405
|
+
return await revise_memory_action(context, this.provider, {
|
|
406
|
+
memory_id: read_string(body, "memory_id"),
|
|
407
|
+
instruction: read_string(body, "instruction"),
|
|
408
|
+
evidence: read_optional_string(body, "evidence"),
|
|
408
409
|
});
|
|
409
410
|
},
|
|
410
411
|
}),
|
|
411
|
-
};
|
|
412
412
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
413
|
+
forget: create_action({
|
|
414
|
+
description: "Delete or invalidate one memory by memory_id.",
|
|
415
|
+
input_schema: {
|
|
416
|
+
zod: z.object({ memory_id: z.string() }),
|
|
417
|
+
json_schema: {
|
|
418
|
+
type: "object",
|
|
419
|
+
additionalProperties: false,
|
|
420
|
+
required: ["memory_id"],
|
|
421
|
+
properties: { memory_id: { type: "string" } },
|
|
422
|
+
},
|
|
423
|
+
},
|
|
424
|
+
examples: [{ title: "Forget a memory", payload: { memory_id: "wiki/obsolete" } }],
|
|
425
|
+
command: {
|
|
426
|
+
description: "Delete or invalidate one memory.",
|
|
427
|
+
configure(command: Command) {
|
|
428
|
+
command.argument("<memory_id>");
|
|
429
|
+
},
|
|
430
|
+
map_input({ args }) {
|
|
431
|
+
return { memory_id: String(args[0] || "") };
|
|
432
|
+
},
|
|
433
|
+
},
|
|
434
|
+
execute: async ({ context, input }) => {
|
|
435
|
+
const body = read_body_object(input);
|
|
436
|
+
return await forget_memory_action(context, this.provider, {
|
|
437
|
+
memory_id: read_string(body, "memory_id"),
|
|
438
|
+
});
|
|
439
|
+
},
|
|
440
|
+
}),
|
|
441
|
+
};
|
|
422
442
|
}
|