Repository navigation
feat(memory): 在菜单中展示记忆管理并隐藏鉴权 DMN 命令 - #5
Merged
Merged
Conversation
Amrita 的菜单管理器会跳过没有 metadata 的插件,plugin-memory 一直没定义 __plugin_meta__,所以 /memory 从不进菜单,与 --sudo 无关。顺便 bump 到 0.7.1。
Reviewer's guide (collapsed on small PRs)Reviewer's Guide本 PR 通过在插件入口定义 Flow diagram for memory plugin menu visibilityflowchart TD
A["Load amrita_plugin_memory"] --> B["Read __plugin_meta__"]
B --> C["generate_menu"]
C --> D{metadata and matcher_grouping exist}
D -->|yes| E["Show Amrita长期记忆"]
E --> F["Show 记忆管理"]
D -->|no| G["Skip plugin"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
菜单与 usage 里不再出现 dmn;调用时先校验超级用户或 lp.admin, 不通过直接回「未知选项」,避免暴露管理入口。README 同步说明。
JohnRichard4096
approved these changes
Oct 18, 2026
sourcery-ai
Bot
dismissed
their stale review
October 18, 2026 04:35
Sourcery withdrew this approval because the latest commits introduced blocking findings.
Member
|
@sourcery-ai title |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
/memory从未出现在菜单里,带不带--sudo都一样。原因
Amrita 的菜单管理器从
nonebot.get_loaded_plugins()收集数据,generate_menu的第一道判断是:plugin-memory 没有定义
__plugin_meta__,plugin.metadata恒为None,整个插件在任何可见性判断之前就被跳过。--sudo只作用于show_if的权限节点,管不到这一层,所以开不开都看不到。matchers.py里的MatcherData本身没问题,缺的是外层插件元数据。改动
amrita_plugin_memory/__init__.py补__plugin_meta__:名称、描述、用法、homepage、type="application"、supported_adapters={"~onebot.v11"}验证
本地 pyright 0 errors,ruff check / format 均通过。合并后菜单的模块列表里会出现「Amrita长期记忆」,其下是「记忆管理」一条。
补充:dmn 收为隐藏管理选项
按讨论,
/memory dmn(含run、触发)不做成独立菜单项,也不出现在 usage 提示里:MatcherData的 description 与 usage 移除 dmn,菜单里只剩 list / search / delete / memolp.admin权限节点;不通过直接回「未知选项:dmn」,不暴露这是管理入口_trigger_dmn去掉自身鉴权,改为调用前必须已校验,避免双份判断口径不一致Summary by Sourcery
Expose the memory plugin in Amrita’s menu while securing and hiding its manual subconscious scheduling command.
New Features:
Bug Fixes:
Enhancements:
Documentation: