宿主 API 参考

插件通过 window.host 调用灵核内核能力,所有方法返回 Promise。

async host.reload(id)

重载/打开指定插件窗口。参数:插件 id。

await window.host.reload('com.example.hello');
async host.listPlugins()

返回已安装插件列表(含 features、permissions、state)。

const plugins = await window.host.listPlugins();
async host.setEnabled(id, enabled)

启用或禁用插件。

await window.host.setEnabled('com.example.hello', true);
async host.uninstall(id)

卸载插件。

async host.status()

获取内核状态与版本信息。

const s = await window.host.status();
console.log(s.hostVersion);
async host.revealPlugin(id)

在文件管理器中显示插件目录。

async host.exportPlugin(id)

导出插件为 .kpkg 分发包,返回保存路径。

完整权限列表与状态说明见 权限模型文档。