fix(plugins): 内置清单终审 15 → 13 —— kbtree/multimodal 翻案加回

## 翻案依据(逐方法对照公开 SDK,非方法名 grep)

初判把 kbtree/multimodal 归入"只用公开 SDK",错了。两边的
s.Knowledge() / s.LLM() **同名但接口面不同**:

- kbtree 需要 KnowledgeAPI.Subtree/CategoryCounts/SearchIn/Categories
  与 KnowledgeTreeView/KnowledgeCategoryCount 类型 —— 公开 KnowledgeAPI
  只有 Search/Add/List,树视图类型公开面根本没有
- multimodal 需要 LLMAPI.Chat + LLMMessage/LLMContentBlock ——
  公开 LLMAPI 只有 ListSources/SetSource/CurrentSource,没有 Chat

外置它们 = OCR/看图/转写、知识树浏览静默失效。

## 最终内置 13 个

  cli webui agentcli healthcheck pluginmgr seq remotedevice
  clawhubadapter kbtree multimodal cfgmgr skillmgr seemedia

外置 5 个(SDK 仓 example/ 已提供工程并已部署验证):
  cmd localuse mcp(本轮)+ ai_image files(此前)+ timer(更早)

## 文档同步(中英 6 份)

数量 11 → 13;判定标准小节补「终审翻案」与教训:
**判外置与否必须逐方法对照公开接口,同名方法不等于同面。**

验证:go build/vet/test 全绿;生产实例已部署新内核 + 新插件包,
四个按需插件经 plugin_start 拉起、工具全部注册(cmd_run /
local_screensee / mcp_* / files_edit_line 实核)。
This commit is contained in:
root
2026-10-19 22:09:09 +08:00
parent 835688c94a
commit 2aab90c508
7 changed files with 50 additions and 17 deletions

View File

@ -43,10 +43,20 @@ package plugins
//
// 反例(已外置,因为它们只要公开能力):
// cmd 仅 internal/plugin 的 RegisterFactory → 换成 NewPluginFactory 即可
// kbtree 仅 s.Knowledge() + s.Settings()
// localuse 仅 RegisterTool + Settings
// mcp 仅 RegisterTool + Settings
// multimodal 仅 RegisterTool + Settings
// mcp 仅 RegisterTool + Settings + RegisterStage
//
// ★ 终审翻案(2026-10-19,逐方法对照公开 SDK 后加回两个):
// kbtree KnowledgeAPI.Subtree/CategoryCounts/SearchIn/Categories ——
// 公开 KnowledgeAPI 只有 Search/Add/List,且公开 SDK 没有
// KnowledgeTreeView/KnowledgeCategoryCount 类型 ⇒ 必须内置
// multimodal LLMAPI.Chat + LLMMessage/LLMContentBlock(多模态消息)——
// 公开 LLMAPI 只有 ListSources/SetSource/CurrentSource,
// 没有 Chat,也没有消息类型 ⇒ 必须内置
// (agentcli 的 EventPublish 同理,见上)
//
// 教训:判「只用公开 SDK」不能只 grep 方法名前缀,要**逐方法对照公开接口**。
// s.Knowledge() / s.LLM() 两边同名,但接口面不同;粗看就会误判成可外置。
//
// ## ★ agentcli 为什么不能外置(2026-10-19 核实)
//
@ -87,6 +97,8 @@ import (
_ "github.com/JianFeeeee/HomeAgent/internal/plugins/clawhubadapter"
_ "github.com/JianFeeeee/HomeAgent/internal/plugins/cli"
_ "github.com/JianFeeeee/HomeAgent/internal/plugins/healthcheck"
_ "github.com/JianFeeeee/HomeAgent/internal/plugins/kbtree"
_ "github.com/JianFeeeee/HomeAgent/internal/plugins/multimodal"
_ "github.com/JianFeeeee/HomeAgent/internal/plugins/pluginmgr"
_ "github.com/JianFeeeee/HomeAgent/internal/plugins/remotedevice"
_ "github.com/JianFeeeee/HomeAgent/internal/plugins/seemedia"