Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
fix(plugins): notify the renderer after the startup plugin restore
mai-ming046a49c3a8c4
diff --git a/apps/desktop/electron/main/runtime/lifecycle.ts b/apps/desktop/electron/main/runtime/lifecycle.tsindex d2afdd4cc..b8bd6ac80 100644--- a/apps/desktop/electron/main/runtime/lifecycle.ts+++ b/apps/desktop/electron/main/runtime/lifecycle.ts@@ -277,6 +277,11 @@ export function createRuntimeLifecycle({}}}+ // Renderer-side plugin surfaces — the Extensions page and every plugin+ // `renderer` module — re-read the plugin list only when this event+ // arrives, and the window has already fetched the list by now. Without it+ // a restored plugin keeps no renderer UI until something else changes.+ sendToRenderer(IPC.event.pluginChanged, { reason: "restore" });} catch (error) {logger.app("plugin", "error", "plugin list failed", {data: String(error),diff --git a/docs/spec/07-plugins/05-plugin-lifecycle.md b/docs/spec/07-plugins/05-plugin-lifecycle.mdindex b994fc32e..5e43e8b03 100644--- a/docs/spec/07-plugins/05-plugin-lifecycle.md+++ b/docs/spec/07-plugins/05-plugin-lifecycle.md@@ -146,6 +146,8 @@ On app startup:2. Read the enabled state3. Load only enabled plugins4. Skip a single failed plugin without affecting other plugins or the main app+5. Emit `pluginChanged` (`reason: "restore"`) once the pass is done, so the+ renderer re-reads a plugin list it may have fetched before the restore## 6. Developer modediff --git a/docs/spec/07-plugins/12-plugin-ipc-and-host-services.md b/docs/spec/07-plugins/12-plugin-ipc-and-host-services.mdindex 8618062c3..47a59d8d8 100644--- a/docs/spec/07-plugins/12-plugin-ipc-and-host-services.md+++ b/docs/spec/07-plugins/12-plugin-ipc-and-host-services.md@@ -81,10 +81,11 @@ PluginManagerThe shipped `pluginChanged` event carries a `reason` so the renderer can decidewhat to refetch: `install`, `loadDev`, `enable`, `disable`, `uninstall`, `crash`,-`service`, `market.install`, `market.applyUpdates`, `themes` (runtime+`service`, `restore`, `market.install`, `market.applyUpdates`, `themes` (runtime`themes.upsert` / `themes.remove`). `service` fires on everysupervision transition and is the cheapest of them — only the service list needs-a reload.+a reload. `restore` fires once when startup recovery has loaded the enabled+plugins, so a surface that listed them earlier still sees them.`settingsChanged` (`pi-desktop/app/event/settingsChanged`) carries a settingspatch when the **host** writes app settings outside the renderer path — todaydiff --git a/docs/zh-CN/spec/07-plugins/05-plugin-lifecycle.md b/docs/zh-CN/spec/07-plugins/05-plugin-lifecycle.mdindex 78cc96dd1..472326ac5 100644--- a/docs/zh-CN/spec/07-plugins/05-plugin-lifecycle.md+++ b/docs/zh-CN/spec/07-plugins/05-plugin-lifecycle.md@@ -137,6 +137,8 @@ discovered2. 读取使能状态3.仅加载已启用的插件4. 跳过单个失败的插件而不影响其他插件或主应用程序+5. 这一步跑完后发出 `pluginChanged`(`reason: "restore"`),让渲染器重新读取+ 它可能在恢复完成之前就取过的插件清单## 6. 开发者模式diff --git a/docs/zh-CN/spec/07-plugins/12-plugin-ipc-and-host-services.md b/docs/zh-CN/spec/07-plugins/12-plugin-ipc-and-host-services.mdindex 142483336..4141cc02d 100644--- a/docs/zh-CN/spec/07-plugins/12-plugin-ipc-and-host-services.md+++ b/docs/zh-CN/spec/07-plugins/12-plugin-ipc-and-host-services.md@@ -77,9 +77,10 @@ PluginManager附带的 `pluginChanged` 事件带有 `reason`,以便渲染器可以决定重新获取的内容:`install`、`loadDev`、`enable`、`disable`、`uninstall`、`crash`、-`service`、`market.install`、`market.applyUpdates`。 `service` 在每个+`service`、`restore`、`market.install`、`market.applyUpdates`。 `service` 在每个监管过渡是其中最便宜的——只需要服务列表-重新加载。+重新加载。`restore` 在启动恢复把已启用的插件加载完之后发出一次,+让早于它取过清单的界面仍能看到这些插件。## 4. 1 事件(主机→插件进程)