Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

docs(plugins): clarify panel broker and redirect capability contracts

Seraph-xb71436f327f5
diff --git a/docs/spec/07-plugins/03-plugin-api.md b/docs/spec/07-plugins/03-plugin-api.md
index 810d06b57..520a781a9 100644
--- a/docs/spec/07-plugins/03-plugin-api.md
+++ b/docs/spec/07-plugins/03-plugin-api.md
@@ -1154,7 +1154,7 @@ checks; these modes grant no additional network access. Policy refusals are
audited without response bodies or headers.
Before using the option on a potentially older host, query
-`pi.net.getCapabilities(): Promise<{ fetchRedirectModes: string[] }>` and require
+`pi.net.getCapabilities(): Promise<{ fetchRedirectModes: ("follow" | "error" | "manual")[] }>` and require
the desired mode. This read-only query needs no network permission and performs
no network I/O. A missing method, rejected query, or absent mode means
unsupported: do not send the request. Older hosts may silently ignore unknown
@@ -1555,7 +1555,9 @@ which handles these built-in channels before falling back to `onPanelInvoke`:
`plugin.setSettings`, `fs.remove`, and arbitrary Electron IPC are not exposed. A
channel the host does not implement itself is forwarded to the plugin's
`onPanelInvoke(channel, payload)`, so a plugin may define its own panel ↔ main
-channels; a plugin that exports no `onPanelInvoke` gets `UNSUPPORTED` from its own
+channels. Electron main brokers every custom channel call before the handler
+executes in the plugin's child process; the panel never calls the child directly.
+A plugin that exports no `onPanelInvoke` gets `UNSUPPORTED` from its own
process. The `skill.list` / `read` / `create` / `update` / `remove` / `setEnabled`
operations used by the bundled skill manager are plugin-owned `onPanelInvoke`
channels, not general host bridge APIs.
diff --git a/docs/zh-CN/spec/07-plugins/03-plugin-api.md b/docs/zh-CN/spec/07-plugins/03-plugin-api.md
index bac14d512..2878a05b5 100644
--- a/docs/zh-CN/spec/07-plugins/03-plugin-api.md
+++ b/docs/zh-CN/spec/07-plugins/03-plugin-api.md
@@ -993,7 +993,7 @@ pi.net.fetch(input: {
这些模式不会授予额外网络访问权。策略拒绝会被审计,但不记录响应正文或响应头。
在可能较旧的宿主使用该选项前,应查询
-`pi.net.getCapabilities(): Promise<{ fetchRedirectModes: string[] }>`,确认其中包含所需模式。
+`pi.net.getCapabilities(): Promise<{ fetchRedirectModes: ("follow" | "error" | "manual")[] }>`,确认其中包含所需模式。
该只读查询无需网络权限,不执行网络 I/O。方法缺失、查询被拒绝或缺少所需模式都表示不支持,
此时不要发送请求。旧宿主可能静默忽略未知 fetch 选项,所以只传入 `redirect` **不等于能力检测**。
当前源码已实现该查询,较旧宿主可能不会公布它。本次没有引入仅限同源的模式。
@@ -1317,10 +1317,11 @@ window.pluginBridge.on(event, handler)
| `session.getActive` | 无 |
| `ui.revealView` | `ui.view` |
-`plugin.setSettings`、`fs.remove` 和任意 Electron IPC 未暴露。主机自己
-没有实现的通道会被转发到插件的 `onPanelInvoke(channel, payload)`,
-因此插件可以自定义面板 ↔ 插件进程通道;没有导出 `onPanelInvoke` 的插件
-会从自己的进程收到 `UNSUPPORTED`。内置技能管理器使用的 `skill.list` / `read` /
+`plugin.setSettings`、`fs.remove` 和任意 Electron IPC 未暴露。宿主未内置实现的通道会转发给
+插件的 `onPanelInvoke(channel, payload)`,因此插件可以定义自己的面板 ↔ 主进程通道。
+每次自定义通道调用均由 Electron 主进程校验并代理,再由插件子进程执行处理器;面板不能
+直接调用子进程。未导出 `onPanelInvoke` 的插件会从自身进程返回 `UNSUPPORTED`。
+内置技能管理器使用的 `skill.list` / `read` /
`create` / `update` / `remove` / `setEnabled` 是它自己的 `onPanelInvoke` 操作,不是通用宿主桥 API。
### 面板事件(主机 -> 面板)