mirror of
https://gitcode.com/JianFeeeee/HomeAgent.git
synced 2026-11-01 06:47:29 +00:00
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:
@ -318,7 +318,7 @@ VM built-ins: `json.encode` / `json.decode` / `log` / `http_get` / `http_post`.
|
||||
|
||||
| Method | Registration Mechanism | Compilation | Usage |
|
||||
|--------|----------------------|-------------|-------|
|
||||
| Built-in | `init()` → `RegisterFactory` | `internal/plugins/` compiled into kernel | webui/cli/agentcli etc. (11 total; see the criteria section below) |
|
||||
| Built-in | `init()` → `RegisterFactory` | `internal/plugins/` compiled into kernel | webui/cli/agentcli etc. (13 total; see the criteria section below) |
|
||||
| External subprocess plugin | Handshake + stdio JSON-RPC reverse registration | `hmapdev build` → `plugin.bin` (ordinary Go binary) | qq/browser/files etc. |
|
||||
| Lua script plugin | Execute `main.lua` to register tools | No compilation, takes effect after restart/reload | luademo etc. |
|
||||
| SKILL plugin | Parse `SKILL.md` | Markdown definition | Loaded via clawhubadapter |
|
||||
@ -372,7 +372,19 @@ Counter-examples (externalized, because public capabilities suffice):
|
||||
| Plugin | Actual dependencies |
|
||||
|---|---|
|
||||
| timer | RegisterTool + Settings + InjectText (public) |
|
||||
| ai_image / files / cmd / kbtree / localuse / mcp / multimodal | RegisterTool + Settings (+ public APIs such as s.Knowledge()) |
|
||||
| ai_image / files / cmd / localuse / mcp | RegisterTool + Settings (+ public RegisterStage) |
|
||||
|
||||
> ★ Reversal on final review (2026-10-19, method-by-method comparison against
|
||||
> the public SDK brought two back): **kbtree** needs
|
||||
> `KnowledgeAPI.Subtree/CategoryCounts/SearchIn/Categories` — the public
|
||||
> `KnowledgeAPI` only has `Search/Add/List`, and the public SDK lacks the
|
||||
> `KnowledgeTreeView`/`KnowledgeCategoryCount` types. **multimodal** needs
|
||||
> `LLMAPI.Chat` + `LLMMessage`/`LLMContentBlock` — the public `LLMAPI` only
|
||||
> has `ListSources/SetSource/CurrentSource`. Both were initially misjudged as
|
||||
> "public-only" because `s.Knowledge()`/`s.LLM()` exist on both sides **with
|
||||
> the same names but different surfaces**. Lesson: externalization decisions
|
||||
> require method-by-method comparison against the public interface, not name
|
||||
> matching.
|
||||
|
||||
> ⚠️ Both copies existing at once is forbidden: `loadOne` checks the built-in
|
||||
> factory table first and never looks at the external `plugin.bin` if it hits
|
||||
@ -641,7 +653,7 @@ internal/
|
||||
│ ├── registry.go — Registry + lifecycle
|
||||
│ ├── dynamic.go — Load-channel dispatch (proc / lua / skill); .so only remains to error loudly
|
||||
│ └── manifest.go — plugin.json metadata
|
||||
├── plugins/ — Built-in plugin implementations (11; see "Which Plugins Stay Built-in")
|
||||
├── plugins/ — Built-in plugin implementations (13; see "Which Plugins Stay Built-in")
|
||||
│ ├── all.go — Blank imports (**the single authoritative list**; edit only this)
|
||||
│ ├── webui/ — HTTP server + embedded SPA
|
||||
│ ├── cli/ — Unix socket CLI
|
||||
@ -655,7 +667,7 @@ internal/
|
||||
│ ├── seemedia/ — Direct media view
|
||||
│ ├── seq/ — Sequence orchestration
|
||||
│ ├── data/ plugin_data/ — Plugin static assets (non-Go, shipped with the kernel)
|
||||
│ ├── kbtree/ cmd/ localuse/ mcp/ multimodal/ ai_image/ files/
|
||||
│ ├── cmd/ localuse/ mcp/ ai_image/ files/
|
||||
│ │ — Source remains but **not listed in all.go**: externalized
|
||||
│ │ on 2026-10-19 as .hmap packages (projects in the SDK repo's
|
||||
│ │ example/); directories to be removed once external projects stabilize
|
||||
|
||||
Reference in New Issue
Block a user