Repository navigation
fix(plugins): 修复 EssentialCommands !func 兼容性并清理 HelloPlugin 调试输出 (LANG-391) - #2967
Merged
Merged
Conversation
…G-391) Co-authored-by: multica-agent <github@multica.ai>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
背景与根因
EssentialCommands的!func命令报ActionCallError: KeyError: 'manifest':plugins/misc/EssentialCommands/components/commands/func.py假设self.plugin.list_tools()返回的列表项中包含'manifest'键(tool['manifest']),但 Core 的LIST_TOOLS动作返回的是平铺结构(name / label / description / spec),导致读取tool['manifest']时抛出KeyError。LIST_TOOLS还会返回 MCP / 技能 / 内置工具,这类条目只有name / source / source_id等字段,没有label / description / spec。在旧实现下同样会抛出KeyError。func.py中兼容平铺字典、MCP/内置/技能工具以及嵌套manifest结构,安全解析name、description(支持多语言字典回退与字符串)与llm_prompt;同步对同插件下的cmd.py和plugin.py增加容错保护。HelloPlugin的!info命令含有调试print:plugins/misc/HelloPlugin/components/commands/info.py:32包含调试输出print(f"发起者ID…")。作为示例插件容易被照抄,且在中文 Windows 环境下会因子进程输出编码引起 stdio 协议管道断连。print,确保!info正常返回且不向 stdout 打印。版本更新:
plugins/RELEASING.md规范,bumpEssentialCommands版本至0.1.12,bumpHelloPlugin版本至0.1.6,并通过python plugins/scripts/check_catalog.py --write更新plugins/catalog.json。验证证据
!func执行时必现KeyError: 'manifest';!info执行时 stdout 输出了'发起者ID10001发送者ID10001消息类型LauncherTypes.PERSON\n'。!func支持包含平铺插件工具、内置工具(如exec)、技能工具、MCP 工具等各种数据结构,在zh_Hans和en_US下均正常列出且不抛异常。!info正常返回查询结果,stdout 捕获结果为空字符串""。plugins/misc/EssentialCommands/tests/test_shared_runtime.py:5 个测试全部通过(含新增的平铺工具/MCP/内置工具兼容性回归测试与cmd/plugin测试)。plugins/misc/HelloPlugin/tests/test_shared_runtime.py:3 个测试全部通过(含新增的!info无 stdout 输出回归测试)。langbot-plugin==0.7.4和0.7.23下两套测试均 100% 通过。python plugins/scripts/check_catalog.py与python plugins/scripts/test_repository.py(15 个测试)全部通过。plugins/scripts/package_plugin.py成功构建两个插件的.lbpkg打包产物。