feat(plugin): hide the core system plugin from plugin lists

builtin.core only contributes the default theme and cannot be turned off,
so listing it as a plugin was noise. The plugins page, plugin list and
the plugin doctor fallback now use Registry.ListVisible; Info and
market comparisons still see every plugin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
NwflowerandClaude Opus 5.5 committed 2026-12-01 03:05:54 -07:00
1 parent 974389f56b
commit aabe0cf29f
6 files changed
+49 -10

No files matched your search

+2 -2
View File
@@ -106,7 +106,7 @@ flowchart TB
扩展点先由内置功能使用一遍再对外开放。内置功能分两类,判断标准是用户关掉它之后,是「少了一项功能」还是「已有功能坏掉」:
- **核心** `builtin.core`:只保留客体无关的默认主题(主题 id 为 `builtin.theme.default`)。它是**系统插件**:始终启用,不能停用或卸载,插件页显示为一行「始终启用」,不参与「使用中」检查。
- **核心** `builtin.core`:只保留客体无关的默认主题(主题 id 为 `builtin.theme.default`)。它是**系统插件**:始终启用,不能停用或卸载,不出现在插件页与 `plugin list` 中(按 ID 查询仍可见),不参与「使用中」检查。
- **macOS 客体插件** `builtin.guest.macos`:注册代码位于 `internal/macos/guest`,静态声明 reims 驱动(驱动 id 仍为 `builtin.driver.reims-macos`)、宿主体检、启动准备、WHPX 降级、Win10 冷重启和安装引导。它是可停用插件,过渡期默认启用以保留升级行为;仍有归属 VM 时由「使用中」检查阻止停用。安装引导保留独立应用级开关。启动准备暂经 `vm.beforeStart`,下一步改由驱动自己执行,见 [guest-plugin-migration.md](guest-plugin-migration.md) 步骤 2。
- **可选内置扩展**:Guest Tools 传输服务、剪贴板互通、宿主输入服务、虚拟机窗口安装引导。经同一注册表注册、可独立启停、停用后零残留,停用即真正停止(不被其他调用方重新拉起)。首批示例为默认开启的剪贴板互通(见 §5.4)。
@@ -396,7 +396,7 @@ UI 槽位采用「声明即占有」:宿主预定义 `vm.toolbar`、`vm.card`
| 入口 | 内容 |
| :--- | :--- |
| CLI | `reims-go plugin list / search / install <zip\|id> / update [id] / pack <dir> / link <dir> / enable [--approve-high-risk] / disable / remove [--purge] / info / doctor [--json] [dir\|zip\|id] / locale <init\|check> / run <id> <command>`;`vm create --driver <id>` |
| 应用设置 → 插件 | 提供「已安装 / 插件市场」双视图(市场索引惰性加载):核心置顶、显示「始终启用」且无开关;其余显示来源与信任标签、权限摘要、安全扫描报告入口、启用开关、故障状态与日志入口;本地包导入前先展示三段式静态安全报告并执行硬门禁拦截 |
| 应用设置 → 插件 | 提供「已安装 / 插件市场」双视图(市场索引惰性加载):系统插件(核心)不列出;其余显示来源与信任标签、权限摘要、安全扫描报告入口、启用开关、故障状态与日志入口;本地包导入前先展示三段式静态安全报告并执行硬门禁拦截 |
| 插件设置页 | 由 `settings` Schema 渲染,复用现有设置控件,标注生效时机 |
| VM 页面 | 按能力位显隐操作;`vm.toolbar` 菜单项支持 `when` 条件;`vm.card` 展示驱动或插件提供的键值信息 |
| 创建向导 | 先选驱动,再按驱动 `CreateSchema` 渲染专属表单 |
+2 -5
View File
@@ -365,11 +365,8 @@ export const PluginsPage: React.FC<Props> = ({
return name.includes(q) || desc.includes(q) || p.id.toLowerCase().includes(q)
}
// The always-on core goes first; the optional builtins keep backend order.
const builtins = useMemo(
() => plugins.filter((p) => p.source === 'builtin').sort((a, b) => Number(!!b.system) - Number(!!a.system)),
[plugins],
)
// System plugins are part of the host and never listed; builtins keep backend order.
const builtins = useMemo(() => plugins.filter((p) => p.source === 'builtin'), [plugins])
const external = useMemo(() => plugins.filter((p) => p.source !== 'builtin'), [plugins])
const filteredBuiltins = useMemo(() => builtins.filter(matchesFilter), [builtins, q, locale])
const filteredExternal = useMemo(() => external.filter(matchesFilter), [external, q, locale])
+1 -1
View File
@@ -578,7 +578,7 @@ func (a *App) ListPlugins() []plugin.PluginInfo {
if mgr == nil {
return nil
}
return mgr.LocalizePluginInfos(mgr.Registry().List())
return mgr.LocalizePluginInfos(mgr.Registry().ListVisible())
}
func (a *App) InstallPluginArchive(archivePath string) (*plugin.PluginInfo, error) {
+2 -2
View File
@@ -165,7 +165,7 @@ func cmdPlugin(cfg *config.Config, loc i18n.Locale, args []string) error {
return err
}
defer mgr.Close()
list := mgr.LocalizePluginInfos(mgr.Registry().List())
list := mgr.LocalizePluginInfos(mgr.Registry().ListVisible())
if *asJSON {
enc := json.NewEncoder(os.Stdout)
enc.SetIndent("", " ")
@@ -509,7 +509,7 @@ func cmdPlugin(cfg *config.Config, loc i18n.Locale, args []string) error {
fmt.Println("[]")
return nil
}
for _, info := range mgr.Registry().List() {
for _, info := range mgr.Registry().ListVisible() {
fmt.Printf("[ok] %s@%s (%s, state=%s)\n", info.ID, info.Version, info.Source, info.State)
}
return nil
+28
View File
@@ -143,3 +143,31 @@ func TestGuestToolsInputBridgeEnvGating(t *testing.T) {
t.Fatalf("with input plugin disabled: unexpected input bridge env %v", env)
}
}
// The core plugin is the host itself: user-facing lists leave it out, while
// lookups by ID and the full registry listing still see it.
func TestCorePluginHiddenFromVisibleList(t *testing.T) {
reg := plugin.NewRegistry(nil)
if err := RegisterAll(reg, HostCallbacks{}, nil); err != nil {
t.Fatalf("RegisterAll: %v", err)
}
reg.Reconcile(context.Background())
has := func(list []plugin.PluginInfo, id string) bool {
for _, p := range list {
if p.ID == id {
return true
}
}
return false
}
visible := reg.ListVisible()
if has(visible, IDCore) {
t.Fatal("ListVisible must not include the core plugin")
}
if !has(visible, IDGuestTools) || len(visible) != len(reg.List())-1 {
t.Fatalf("ListVisible = %d plugins, List = %d", len(visible), len(reg.List()))
}
if info, ok := reg.Info(IDCore); !ok || !info.System {
t.Fatalf("Info(core) = %+v, %v", info, ok)
}
}
+14
View File
@@ -1431,6 +1431,20 @@ func (r *Registry) List() []PluginInfo {
return out
}
// ListVisible is List without system plugins. A system plugin is part of the
// host itself (always on, nothing to configure), so plugin lists shown to
// users leave it out; Info still returns it by ID.
func (r *Registry) ListVisible() []PluginInfo {
all := r.List()
out := all[:0]
for _, p := range all {
if !p.System {
out = append(out, p)
}
}
return out
}
func (r *Registry) entryToInfoLocked(e *pluginEntry) PluginInfo {
m := e.def.Manifest
perms := make([]PermissionSpec, 0, len(m.Permissions))