Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
<!-- status: implemented -->
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>host-api · 插件可调用 API 全集</title>
<style>
:root{
--bg:#0e0e0e; --surface:#161616; --surface-2:#1b1b1b; --line:#2a2a2a; --line-2:#353535;
--text:#ededed; --text-2:#b0b0b0; --muted:#7d7d7d; --faint:#5c5c5c;
--ok:#40c977; --ok-bg:rgba(64,201,119,.10);
--warn:#ff8549; --warn-bg:rgba(255,133,73,.10);
--error:#ff6764; --error-bg:rgba(255,103,100,.10);
--host:#4c8dff; --plugin:#c27aff; --slot:#ff8549;
--font:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;
--mono:ui-monospace,"SF Mono","Cascadia Code",Consolas,monospace;
}
*{box-sizing:border-box} html,body{margin:0}
body{background:var(--bg);color:var(--text);font-family:var(--font);font-size:14px;line-height:1.6}
a{color:inherit} code,kbd{font-family:var(--mono);font-size:12px;color:var(--text-2);background:var(--surface-2);padding:1px 5px;border-radius:4px}
pre{font-family:var(--mono);font-size:12.5px;background:var(--surface-2);padding:12px 14px;border-radius:10px;overflow:auto;color:var(--text-2);white-space:pre-wrap}
.plan-nav{display:flex;flex-wrap:wrap;align-items:center;gap:4px;padding:10px 28px;background:#0c0c0c;border-bottom:1px solid var(--line);font-size:13px}
.plan-nav a{color:var(--text-2);text-decoration:none;padding:3px 8px;border-radius:6px}
.plan-nav a:hover{background:var(--surface);color:var(--text)}
.plan-nav a[aria-current="page"]{background:var(--surface);color:var(--text);box-shadow:inset 0 0 0 1px var(--line-2)}
.plan-nav .sep{color:var(--faint);padding:0 2px} .plan-nav .spacer{flex:1}
.top{border-bottom:1px solid var(--line);padding:26px 28px 20px;background:linear-gradient(180deg,#141414,#0e0e0e)}
.top h1{margin:0 0 6px;font-size:21px} .top p{margin:0;color:var(--text-2);max-width:76ch}
.top .meta{margin-top:8px;color:var(--faint);font-size:12.5px}
main{max-width:1080px;margin:0 auto;padding:26px 28px 80px}
section{margin:0 0 36px}
section>h2{display:flex;align-items:baseline;gap:10px;margin:0 0 8px;font-size:16.5px}
section>h2 .n{font-family:var(--mono);font-size:11.5px;color:var(--muted);border:1px solid var(--line-2);border-radius:4px;padding:1px 6px}
section>.lead{margin:0 0 14px;color:var(--text-2);max-width:82ch}
table{width:100%;border-collapse:collapse;font-size:13.5px;margin:0 0 12px}
th,td{text-align:left;padding:8px 10px;border-bottom:1px solid var(--line);vertical-align:top}
th{color:var(--muted);font-weight:500;font-size:12px;text-transform:uppercase;letter-spacing:.03em}
td.id{font-family:var(--mono);font-size:12.5px;color:var(--text-2)}
.pill{display:inline-block;padding:1px 7px;border-radius:99px;font-size:11px;font-family:var(--mono);white-space:nowrap}
.pill.has{color:var(--ok);background:var(--ok-bg)}
.pill.warn{color:var(--warn);background:var(--warn-bg)}
.pill.perm{color:var(--host);background:rgba(76,141,255,.12)}
.callout{margin:12px 0;padding:12px 14px;border-radius:10px;background:var(--surface);border-left:3px solid var(--line-2);color:var(--text-2);font-size:13px}
.callout.warn{border-left-color:var(--warn)}
.callout b{color:var(--text)}
ul,ol{margin:0 0 12px;padding-left:1.35em;color:var(--text-2)}
li{margin:0 0 4px} li b{color:var(--text)}
</style>
</head>
<body>
<p data-aigc-mark="1" style="margin:0 0 8px;font-size:10px;line-height:1.3;color:#6b6560;font-weight:400;">AI生成</p>
<nav class="plan-nav">
<a href="../index.html">插件插槽目录</a><span class="sep">/</span><a href="index.html" aria-current="page">host-api</a>
</nav>
<header class="top">
<h1>host-api · 插件可调用 API 全集</h1>
<div class="meta">status: <b>implemented</b> · 事实源 <code>packages/plugin-sdk/src/index.ts</code> · <code>PluginHostApi</code></div>
</header>
<main>
<section>
<h2><span class="n">0</span>这份目录是什么</h2>
<p class="lead">插件今天<strong>已经能调用</strong>的官方 API 全集。按命名空间一页,每条 API 一节,含<strong>需求描述</strong>与<strong>数据流</strong>。与 <a href="../index.html">插件插槽目录</a>(界面 / render / 运行时)平行,互不覆盖。</p>
<table>
<thead><tr><th>项</th><th>值</th></tr></thead>
<tbody>
<tr><td>条目数</td><td>95(PluginHostApi 方法 + PluginModule 钩子)</td></tr>
<tr><td>事实来源</td><td><code>packages/plugin-sdk/src/index.ts</code> · <code>docs/spec/07-plugins/03-plugin-api.md</code></td></tr>
<tr><td>每命名空间</td><td><code><namespace>.html</code>,锚点 <code>#<api-id></code></td></tr>
<tr><td>状态口径</td><td>条目 <code>implemented</code> 表示 SDK 对外表面已存在;总表草稿状态不改变这一点</td></tr>
</tbody>
</table>
<div class="callout warn"><b>范围:</b>只收录可调用 API 与生命周期钩子。清单声明(contributes.*)不是可调用 API。未实现的设计稿在 <code>runtime/</code> 会话数据契约(session-context / session-compaction / session-model);用量推送已结案——不新增,官方姿势见 <code>usage.listTurns</code> 第 2 节。</div>
</section>
<section>
<h2><span class="n">1</span>应用与外观</h2>
<p class="lead">命名空间 <code>app</code> · 4 条</p>
<table>
<thead><tr><th>API</th><th>一句话</th><th>状态</th><th>页</th></tr></thead>
<tbody>
<tr><td class="id"><a href="app.html#app.getVersion"><code>app.getVersion</code></a></td><td>读宿主应用版本号字符串。</td><td><span class="pill has">implemented</span></td><td><a href="app.html#app.getVersion">详情</a></td></tr>
<tr><td class="id"><a href="app.html#app.getLocale"><code>app.getLocale</code></a></td><td>读当前应用语言标签,供插件自绘界面本地化。</td><td><span class="pill has">implemented</span></td><td><a href="app.html#app.getLocale">详情</a></td></tr>
<tr><td class="id"><a href="app.html#app.getAppearance"><code>app.getAppearance</code></a></td><td>读当前外观:主题偏好、解析后的明暗、语言、插件主题。</td><td><span class="pill has">implemented</span></td><td><a href="app.html#app.getAppearance">详情</a></td></tr>
<tr><td class="id"><a href="app.html#app.setTheme"><code>app.setTheme</code></a></td><td>设置应用主题偏好(内置或已注册插件主题)。</td><td><span class="pill has">implemented</span></td><td><a href="app.html#app.setTheme">详情</a></td></tr>
</tbody>
</table>
</section><section>
<h2><span class="n">2</span>主题运行时</h2>
<p class="lead">命名空间 <code>themes</code> · 4 条</p>
<table>
<thead><tr><th>API</th><th>一句话</th><th>状态</th><th>页</th></tr></thead>
<tbody>
<tr><td class="id"><a href="themes.html#themes.upsert"><code>themes.upsert</code></a></td><td>创建或更新本插件的一条运行时主题。</td><td><span class="pill has">implemented</span></td><td><a href="themes.html#themes.upsert">详情</a></td></tr>
<tr><td class="id"><a href="themes.html#themes.remove"><code>themes.remove</code></a></td><td>删除本插件一条运行时主题。</td><td><span class="pill has">implemented</span></td><td><a href="themes.html#themes.remove">详情</a></td></tr>
<tr><td class="id"><a href="themes.html#themes.list"><code>themes.list</code></a></td><td>列出本插件已注册主题的轻量行。</td><td><span class="pill has">implemented</span></td><td><a href="themes.html#themes.list">详情</a></td></tr>
<tr><td class="id"><a href="themes.html#themes.setVariables"><code>themes.setVariables</code></a></td><td>写入主题的设计令牌变量值。</td><td><span class="pill has">implemented</span></td><td><a href="themes.html#themes.setVariables">详情</a></td></tr>
</tbody>
</table>
</section><section>
<h2><span class="n">3</span>插件自身</h2>
<p class="lead">命名空间 <code>plugin</code> · 5 条</p>
<table>
<thead><tr><th>API</th><th>一句话</th><th>状态</th><th>页</th></tr></thead>
<tbody>
<tr><td class="id"><a href="plugin.html#plugin.getId"><code>plugin.getId</code></a></td><td>同步返回调用插件自己的 id。</td><td><span class="pill has">implemented</span></td><td><a href="plugin.html#plugin.getId">详情</a></td></tr>
<tr><td class="id"><a href="plugin.html#plugin.getManifest"><code>plugin.getManifest</code></a></td><td>同步返回本插件已校验的清单对象。</td><td><span class="pill has">implemented</span></td><td><a href="plugin.html#plugin.getManifest">详情</a></td></tr>
<tr><td class="id"><a href="plugin.html#plugin.getSettings"><code>plugin.getSettings</code></a></td><td>读本插件设置键值。</td><td><span class="pill has">implemented</span></td><td><a href="plugin.html#plugin.getSettings">详情</a></td></tr>
<tr><td class="id"><a href="plugin.html#plugin.setSettings"><code>plugin.setSettings</code></a></td><td>合并写入本插件设置。</td><td><span class="pill has">implemented</span></td><td><a href="plugin.html#plugin.setSettings">详情</a></td></tr>
<tr><td class="id"><a href="plugin.html#plugin.getDataPath"><code>plugin.getDataPath</code></a></td><td>返回本插件私有数据目录绝对路径。</td><td><span class="pill has">implemented</span></td><td><a href="plugin.html#plugin.getDataPath">详情</a></td></tr>
</tbody>
</table>
</section><section>
<h2><span class="n">4</span>命令</h2>
<p class="lead">命名空间 <code>commands</code> · 2 条</p>
<table>
<thead><tr><th>API</th><th>一句话</th><th>状态</th><th>页</th></tr></thead>
<tbody>
<tr><td class="id"><a href="commands.html#commands.register"><code>commands.register</code></a></td><td>注册一条插件命令(命令面板 / 快捷键可触发)。</td><td><span class="pill has">implemented</span></td><td><a href="commands.html#commands.register">详情</a></td></tr>
<tr><td class="id"><a href="commands.html#commands.unregister"><code>commands.unregister</code></a></td><td>注销一条插件命令。</td><td><span class="pill has">implemented</span></td><td><a href="commands.html#commands.unregister">详情</a></td></tr>
</tbody>
</table>
</section><section>
<h2><span class="n">5</span>语音适配</h2>
<p class="lead">命名空间 <code>speech</code> · 2 条</p>
<table>
<thead><tr><th>API</th><th>一句话</th><th>状态</th><th>页</th></tr></thead>
<tbody>
<tr><td class="id"><a href="speech.html#speech.registerAdapter"><code>speech.registerAdapter</code></a></td><td>注册一种语音协议适配器(转写或合成)。</td><td><span class="pill has">implemented</span></td><td><a href="speech.html#speech.registerAdapter">详情</a></td></tr>
<tr><td class="id"><a href="speech.html#speech.unregisterAdapter"><code>speech.unregisterAdapter</code></a></td><td>注销语音适配器。</td><td><span class="pill has">implemented</span></td><td><a href="speech.html#speech.unregisterAdapter">详情</a></td></tr>
</tbody>
</table>
</section><section>
<h2><span class="n">6</span>界面与通知</h2>
<p class="lead">命名空间 <code>ui</code> · 7 条</p>
<table>
<thead><tr><th>API</th><th>一句话</th><th>状态</th><th>页</th></tr></thead>
<tbody>
<tr><td class="id"><a href="ui.html#ui.openPanel"><code>ui.openPanel</code></a></td><td>打开本插件面板窗口(或已声明的 widget 形态)。</td><td><span class="pill has">implemented</span></td><td><a href="ui.html#ui.openPanel">详情</a></td></tr>
<tr><td class="id"><a href="ui.html#ui.closePanel"><code>ui.closePanel</code></a></td><td>关闭本插件面板。</td><td><span class="pill has">implemented</span></td><td><a href="ui.html#ui.closePanel">详情</a></td></tr>
<tr><td class="id"><a href="ui.html#ui.showToast"><code>ui.showToast</code></a></td><td>在宿主界面显示短提示。</td><td><span class="pill has">implemented</span></td><td><a href="ui.html#ui.showToast">详情</a></td></tr>
<tr><td class="id"><a href="ui.html#ui.notify"><code>ui.notify</code></a></td><td>走宿主通知通道提醒用户。</td><td><span class="pill has">implemented</span></td><td><a href="ui.html#ui.notify">详情</a></td></tr>
<tr><td class="id"><a href="ui.html#ui.getNotificationPermission"><code>ui.getNotificationPermission</code></a></td><td>查询通知权限状态。</td><td><span class="pill has">implemented</span></td><td><a href="ui.html#ui.getNotificationPermission">详情</a></td></tr>
<tr><td class="id"><a href="ui.html#ui.requestNotificationPermission"><code>ui.requestNotificationPermission</code></a></td><td>请求通知权限。</td><td><span class="pill has">implemented</span></td><td><a href="ui.html#ui.requestNotificationPermission">详情</a></td></tr>
<tr><td class="id"><a href="ui.html#ui.showNativeNotification"><code>ui.showNativeNotification</code></a></td><td>显示系统原生通知。</td><td><span class="pill has">implemented</span></td><td><a href="ui.html#ui.showNativeNotification">详情</a></td></tr>
</tbody>
</table>
</section><section>
<h2><span class="n">7</span>项目</h2>
<p class="lead">命名空间 <code>project</code> · 1 条</p>
<table>
<thead><tr><th>API</th><th>一句话</th><th>状态</th><th>页</th></tr></thead>
<tbody>
<tr><td class="id"><a href="project.html#project.create"><code>project.create</code></a></td><td>创建或复用一条持久项目记录。</td><td><span class="pill has">implemented</span></td><td><a href="project.html#project.create">详情</a></td></tr>
</tbody>
</table>
</section><section>
<h2><span class="n">8</span>工作区</h2>
<p class="lead">命名空间 <code>workspace</code> · 1 条</p>
<table>
<thead><tr><th>API</th><th>一句话</th><th>状态</th><th>页</th></tr></thead>
<tbody>
<tr><td class="id"><a href="workspace.html#workspace.get"><code>workspace.get</code></a></td><td>读当前工作区主文件夹;无工作区时返回 null。</td><td><span class="pill has">implemented</span></td><td><a href="workspace.html#workspace.get">详情</a></td></tr>
</tbody>
</table>
</section><section>
<h2><span class="n">9</span>桌面受控操作</h2>
<p class="lead">命名空间 <code>desktop</code> · 2 条</p>
<table>
<thead><tr><th>API</th><th>一句话</th><th>状态</th><th>页</th></tr></thead>
<tbody>
<tr><td class="id"><a href="desktop.html#desktop.listOperations"><code>desktop.listOperations</code></a></td><td>列出可调用的受控桌面操作目录。</td><td><span class="pill has">implemented</span></td><td><a href="desktop.html#desktop.listOperations">详情</a></td></tr>
<tr><td class="id"><a href="desktop.html#desktop.invoke"><code>desktop.invoke</code></a></td><td>执行一条受控桌面操作(宿主代办)。</td><td><span class="pill has">implemented</span></td><td><a href="desktop.html#desktop.invoke">详情</a></td></tr>
</tbody>
</table>
</section><section>
<h2><span class="n">10</span>后台音频</h2>
<p class="lead">命名空间 <code>audio</code> · 10 条</p>
<table>
<thead><tr><th>API</th><th>一句话</th><th>状态</th><th>页</th></tr></thead>
<tbody>
<tr><td class="id"><a href="audio.html#audio.getInputDevices"><code>audio.getInputDevices</code></a></td><td>列出可采集的输入设备。本条分支尚无设备后端。</td><td><span class="pill has">implemented</span></td><td><a href="audio.html#audio.getInputDevices">详情</a></td></tr>
<tr><td class="id"><a href="audio.html#audio.openInput"><code>audio.openInput</code></a></td><td>打开一条输入采集流。本条分支尚无设备后端。</td><td><span class="pill has">implemented</span></td><td><a href="audio.html#audio.openInput">详情</a></td></tr>
<tr><td class="id"><a href="audio.html#audio.closeInput"><code>audio.closeInput</code></a></td><td>关闭输入流。本条分支尚无设备后端。</td><td><span class="pill has">implemented</span></td><td><a href="audio.html#audio.closeInput">详情</a></td></tr>
<tr><td class="id"><a href="audio.html#audio.getCaptureState"><code>audio.getCaptureState</code></a></td><td>查询当前采集状态与丢帧数。本条分支尚无设备后端。</td><td><span class="pill has">implemented</span></td><td><a href="audio.html#audio.getCaptureState">详情</a></td></tr>
<tr><td class="id"><a href="audio.html#audio.onInputFrame"><code>audio.onInputFrame</code></a></td><td>注册 PCM16 帧处理函数(同步)。本条分支尚无设备后端。</td><td><span class="pill has">implemented</span></td><td><a href="audio.html#audio.onInputFrame">详情</a></td></tr>
<tr><td class="id"><a href="audio.html#audio.offInputFrame"><code>audio.offInputFrame</code></a></td><td>注销 PCM16 帧处理函数。本条分支尚无设备后端。</td><td><span class="pill has">implemented</span></td><td><a href="audio.html#audio.offInputFrame">详情</a></td></tr>
<tr><td class="id"><a href="audio.html#audio.openOutput"><code>audio.openOutput</code></a></td><td>打开播放队列。本条分支尚无设备后端。</td><td><span class="pill has">implemented</span></td><td><a href="audio.html#audio.openOutput">详情</a></td></tr>
<tr><td class="id"><a href="audio.html#audio.writeOutput"><code>audio.writeOutput</code></a></td><td>把 PCM16 字节排进播放队列。本条分支尚无设备后端。</td><td><span class="pill has">implemented</span></td><td><a href="audio.html#audio.writeOutput">详情</a></td></tr>
<tr><td class="id"><a href="audio.html#audio.stopOutput"><code>audio.stopOutput</code></a></td><td>丢弃排队未播音频(抢话)。本条分支尚无设备后端。</td><td><span class="pill has">implemented</span></td><td><a href="audio.html#audio.stopOutput">详情</a></td></tr>
<tr><td class="id"><a href="audio.html#audio.closeOutput"><code>audio.closeOutput</code></a></td><td>关闭播放队列。本条分支尚无设备后端。</td><td><span class="pill has">implemented</span></td><td><a href="audio.html#audio.closeOutput">详情</a></td></tr>
</tbody>
</table>
</section><section>
<h2><span class="n">11</span>全局快捷键</h2>
<p class="lead">命名空间 <code>keyboard</code> · 3 条</p>
<table>
<thead><tr><th>API</th><th>一句话</th><th>状态</th><th>页</th></tr></thead>
<tbody>
<tr><td class="id"><a href="keyboard.html#keyboard.registerGlobalShortcut"><code>keyboard.registerGlobalShortcut</code></a></td><td>注册系统全局快捷键,映射到本插件命令。</td><td><span class="pill has">implemented</span></td><td><a href="keyboard.html#keyboard.registerGlobalShortcut">详情</a></td></tr>
<tr><td class="id"><a href="keyboard.html#keyboard.unregisterGlobalShortcut"><code>keyboard.unregisterGlobalShortcut</code></a></td><td>注销一条全局快捷键。</td><td><span class="pill has">implemented</span></td><td><a href="keyboard.html#keyboard.unregisterGlobalShortcut">详情</a></td></tr>
<tr><td class="id"><a href="keyboard.html#keyboard.listGlobalShortcuts"><code>keyboard.listGlobalShortcuts</code></a></td><td>列出宿主当前为本插件持有的快捷键。</td><td><span class="pill has">implemented</span></td><td><a href="keyboard.html#keyboard.listGlobalShortcuts">详情</a></td></tr>
</tbody>
</table>
</section><section>
<h2><span class="n">12</span>文件</h2>
<p class="lead">命名空间 <code>fs</code> · 11 条</p>
<table>
<thead><tr><th>API</th><th>一句话</th><th>状态</th><th>页</th></tr></thead>
<tbody>
<tr><td class="id"><a href="fs.html#fs.readText"><code>fs.readText</code></a></td><td>按根相对路径读入整个文本文件。</td><td><span class="pill has">implemented</span></td><td><a href="fs.html#fs.readText">详情</a></td></tr>
<tr><td class="id"><a href="fs.html#fs.stat"><code>fs.stat</code></a></td><td>读一个文件的大小和修改时间,不载入正文。</td><td><span class="pill has">implemented</span></td><td><a href="fs.html#fs.stat">详情</a></td></tr>
<tr><td class="id"><a href="fs.html#fs.readRange"><code>fs.readRange</code></a></td><td>读文件里一段有界字节区间。</td><td><span class="pill has">implemented</span></td><td><a href="fs.html#fs.readRange">详情</a></td></tr>
<tr><td class="id"><a href="fs.html#fs.readPreview"><code>fs.readPreview</code></a></td><td>对已有可读文件做有界分类预览。</td><td><span class="pill has">implemented</span></td><td><a href="fs.html#fs.readPreview">详情</a></td></tr>
<tr><td class="id"><a href="fs.html#fs.openDefault"><code>fs.openDefault</code></a></td><td>用系统默认应用打开一个已有可读文件。</td><td><span class="pill has">implemented</span></td><td><a href="fs.html#fs.openDefault">详情</a></td></tr>
<tr><td class="id"><a href="fs.html#fs.reveal"><code>fs.reveal</code></a></td><td>在系统文件管理器里显示一个已有可读文件。</td><td><span class="pill has">implemented</span></td><td><a href="fs.html#fs.reveal">详情</a></td></tr>
<tr><td class="id"><a href="fs.html#fs.writeText"><code>fs.writeText</code></a></td><td>把文本写入规则根下的路径(新建或覆盖)。</td><td><span class="pill has">implemented</span></td><td><a href="fs.html#fs.writeText">详情</a></td></tr>
<tr><td class="id"><a href="fs.html#fs.glob"><code>fs.glob</code></a></td><td>按 glob 模式列出匹配的相对路径。</td><td><span class="pill has">implemented</span></td><td><a href="fs.html#fs.glob">详情</a></td></tr>
<tr><td class="id"><a href="fs.html#fs.list"><code>fs.list</code></a></td><td>列出一个目录下的条目,便于懒加载目录树。</td><td><span class="pill has">implemented</span></td><td><a href="fs.html#fs.list">详情</a></td></tr>
<tr><td class="id"><a href="fs.html#fs.remove"><code>fs.remove</code></a></td><td>删除规则根下的文件或目录。</td><td><span class="pill has">implemented</span></td><td><a href="fs.html#fs.remove">详情</a></td></tr>
<tr><td class="id"><a href="fs.html#fs.requestDirectory"><code>fs.requestDirectory</code></a></td><td>请用户选一个目录,作为本次运行 userSelected 规则的根。</td><td><span class="pill has">implemented</span></td><td><a href="fs.html#fs.requestDirectory">详情</a></td></tr>
</tbody>
</table>
</section><section>
<h2><span class="n">13</span>Agent 能力</h2>
<p class="lead">命名空间 <code>agent</code> · 3 条</p>
<table>
<thead><tr><th>API</th><th>一句话</th><th>状态</th><th>页</th></tr></thead>
<tbody>
<tr><td class="id"><a href="agent.html#agent.registerTool"><code>agent.registerTool</code></a></td><td>向 Agent 注册可执行工具。</td><td><span class="pill has">implemented</span></td><td><a href="agent.html#agent.registerTool">详情</a></td></tr>
<tr><td class="id"><a href="agent.html#agent.unregisterTool"><code>agent.unregisterTool</code></a></td><td>注销 Agent 工具。</td><td><span class="pill has">implemented</span></td><td><a href="agent.html#agent.unregisterTool">详情</a></td></tr>
<tr><td class="id"><a href="agent.html#agent.complete"><code>agent.complete</code></a></td><td>宿主代发一次性补全(one-shot),可带自定义 system 与消息。</td><td><span class="pill has">implemented</span></td><td><a href="agent.html#agent.complete">详情</a></td></tr>
</tbody>
</table>
</section><section>
<h2><span class="n">14</span>模型目录</h2>
<p class="lead">命名空间 <code>models</code> · 1 条</p>
<table>
<thead><tr><th>API</th><th>一句话</th><th>状态</th><th>页</th></tr></thead>
<tbody>
<tr><td class="id"><a href="models.html#models.list"><code>models.list</code></a></td><td>列出已就绪的模型绑定目录。</td><td><span class="pill has">implemented</span></td><td><a href="models.html#models.list">详情</a></td></tr>
</tbody>
</table>
</section><section>
<h2><span class="n">15</span>会话</h2>
<p class="lead">命名空间 <code>session</code> · 8 条</p>
<table>
<thead><tr><th>API</th><th>一句话</th><th>状态</th><th>页</th></tr></thead>
<tbody>
<tr><td class="id"><a href="session.html#session.getLlmContext"><code>session.getLlmContext</code></a></td><td>读取当前工具会话的 LLM 上下文投影。</td><td><span class="pill has">implemented</span></td><td><a href="session.html#session.getLlmContext">详情</a></td></tr>
<tr><td class="id"><a href="session.html#session.list"><code>session.list</code></a></td><td>分页列出本插件导入的会话。</td><td><span class="pill has">implemented</span></td><td><a href="session.html#session.list">详情</a></td></tr>
<tr><td class="id"><a href="session.html#session.get"><code>session.get</code></a></td><td>读一条本插件会话的元数据。</td><td><span class="pill has">implemented</span></td><td><a href="session.html#session.get">详情</a></td></tr>
<tr><td class="id"><a href="session.html#session.listMessages"><code>session.listMessages</code></a></td><td>分页读取本插件会话的消息。</td><td><span class="pill has">implemented</span></td><td><a href="session.html#session.listMessages">详情</a></td></tr>
<tr><td class="id"><a href="session.html#session.import"><code>session.import</code></a></td><td>把一条外部会话导入为插件拥有的会话。</td><td><span class="pill has">implemented</span></td><td><a href="session.html#session.import">详情</a></td></tr>
<tr><td class="id"><a href="session.html#session.importBatch"><code>session.importBatch</code></a></td><td>批量导入外部会话。</td><td><span class="pill has">implemented</span></td><td><a href="session.html#session.importBatch">详情</a></td></tr>
<tr><td class="id"><a href="session.html#session.rename"><code>session.rename</code></a></td><td>重命名本插件拥有的会话标题。</td><td><span class="pill has">implemented</span></td><td><a href="session.html#session.rename">详情</a></td></tr>
<tr><td class="id"><a href="session.html#session.delete"><code>session.delete</code></a></td><td>回收(trash)或清除(purge)本插件导入的会话。</td><td><span class="pill has">implemented</span></td><td><a href="session.html#session.delete">详情</a></td></tr>
</tbody>
</table>
</section><section>
<h2><span class="n">16</span>用量事实</h2>
<p class="lead">命名空间 <code>usage</code> · 1 条</p>
<table>
<thead><tr><th>API</th><th>一句话</th><th>状态</th><th>页</th></tr></thead>
<tbody>
<tr><td class="id"><a href="usage.html#usage.listTurns"><code>usage.listTurns</code></a></td><td>分页读取已完成 turn 的用量事实行(只读)。</td><td><span class="pill has">implemented</span></td><td><a href="usage.html#usage.listTurns">详情</a></td></tr>
</tbody>
</table>
</section><section>
<h2><span class="n">17</span>后台服务</h2>
<p class="lead">命名空间 <code>services</code> · 2 条</p>
<table>
<thead><tr><th>API</th><th>一句话</th><th>状态</th><th>页</th></tr></thead>
<tbody>
<tr><td class="id"><a href="services.html#services.register"><code>services.register</code></a></td><td>登记常驻后台服务(须在 <code>contributes.services</code> 声明)。</td><td><span class="pill has">implemented</span></td><td><a href="services.html#services.register">详情</a></td></tr>
<tr><td class="id"><a href="services.html#services.unregister"><code>services.unregister</code></a></td><td>注销后台服务,运行中则先停。</td><td><span class="pill has">implemented</span></td><td><a href="services.html#services.unregister">详情</a></td></tr>
</tbody>
</table>
</section><section>
<h2><span class="n">18</span>插件总线</h2>
<p class="lead">命名空间 <code>bus</code> · 2 条</p>
<table>
<thead><tr><th>API</th><th>一句话</th><th>状态</th><th>页</th></tr></thead>
<tbody>
<tr><td class="id"><a href="bus.html#bus.publish"><code>bus.publish</code></a></td><td>向声明过的主题发布消息。</td><td><span class="pill has">implemented</span></td><td><a href="bus.html#bus.publish">详情</a></td></tr>
<tr><td class="id"><a href="bus.html#bus.subscribe"><code>bus.subscribe</code></a></td><td>订阅声明过的主题模式,返回取消函数。</td><td><span class="pill has">implemented</span></td><td><a href="bus.html#bus.subscribe">详情</a></td></tr>
</tbody>
</table>
</section><section>
<h2><span class="n">19</span>剪贴板</h2>
<p class="lead">命名空间 <code>clipboard</code> · 3 条</p>
<table>
<thead><tr><th>API</th><th>一句话</th><th>状态</th><th>页</th></tr></thead>
<tbody>
<tr><td class="id"><a href="clipboard.html#clipboard.readText"><code>clipboard.readText</code></a></td><td>读当前剪贴板文本。</td><td><span class="pill has">implemented</span></td><td><a href="clipboard.html#clipboard.readText">详情</a></td></tr>
<tr><td class="id"><a href="clipboard.html#clipboard.writeText"><code>clipboard.writeText</code></a></td><td>写入剪贴板文本。</td><td><span class="pill has">implemented</span></td><td><a href="clipboard.html#clipboard.writeText">详情</a></td></tr>
<tr><td class="id"><a href="clipboard.html#clipboard.getHistory"><code>clipboard.getHistory</code></a></td><td>读宿主保留的剪贴板历史。</td><td><span class="pill has">implemented</span></td><td><a href="clipboard.html#clipboard.getHistory">详情</a></td></tr>
</tbody>
</table>
</section><section>
<h2><span class="n">20</span>外部打开</h2>
<p class="lead">命名空间 <code>shell</code> · 1 条</p>
<table>
<thead><tr><th>API</th><th>一句话</th><th>状态</th><th>页</th></tr></thead>
<tbody>
<tr><td class="id"><a href="shell.html#shell.openExternal"><code>shell.openExternal</code></a></td><td>用系统默认应用打开外部链接。</td><td><span class="pill has">implemented</span></td><td><a href="shell.html#shell.openExternal">详情</a></td></tr>
</tbody>
</table>
</section><section>
<h2><span class="n">21</span>浏览器访客页</h2>
<p class="lead">命名空间 <code>browser</code> · 13 条</p>
<table>
<thead><tr><th>API</th><th>一句话</th><th>状态</th><th>页</th></tr></thead>
<tbody>
<tr><td class="id"><a href="browser.html#browser.navigate"><code>browser.navigate</code></a></td><td>导航到 URL 或站内 path。</td><td><span class="pill has">implemented</span></td><td><a href="browser.html#browser.navigate">详情</a></td></tr>
<tr><td class="id"><a href="browser.html#browser.action"><code>browser.action</code></a></td><td>对访客页做前进 / 后退 / 刷新 / 停止。</td><td><span class="pill has">implemented</span></td><td><a href="browser.html#browser.action">详情</a></td></tr>
<tr><td class="id"><a href="browser.html#browser.setBounds"><code>browser.setBounds</code></a></td><td>设置访客页在宿主里的矩形区域。</td><td><span class="pill has">implemented</span></td><td><a href="browser.html#browser.setBounds">详情</a></td></tr>
<tr><td class="id"><a href="browser.html#browser.setVisible"><code>browser.setVisible</code></a></td><td>显示或隐藏访客页。</td><td><span class="pill has">implemented</span></td><td><a href="browser.html#browser.setVisible">详情</a></td></tr>
<tr><td class="id"><a href="browser.html#browser.getState"><code>browser.getState</code></a></td><td>读访客页当前状态。</td><td><span class="pill has">implemented</span></td><td><a href="browser.html#browser.getState">详情</a></td></tr>
<tr><td class="id"><a href="browser.html#browser.openExternal"><code>browser.openExternal</code></a></td><td>把当前访客页交给系统浏览器打开。</td><td><span class="pill has">implemented</span></td><td><a href="browser.html#browser.openExternal">详情</a></td></tr>
<tr><td class="id"><a href="browser.html#browser.snapshot"><code>browser.snapshot</code></a></td><td>抓一份可访问性树快照。</td><td><span class="pill has">implemented</span></td><td><a href="browser.html#browser.snapshot">详情</a></td></tr>
<tr><td class="id"><a href="browser.html#browser.screenshot"><code>browser.screenshot</code></a></td><td>截取访客页图像。</td><td><span class="pill has">implemented</span></td><td><a href="browser.html#browser.screenshot">详情</a></td></tr>
<tr><td class="id"><a href="browser.html#browser.click"><code>browser.click</code></a></td><td>按 snapshot 给出的 uid 点击元素。</td><td><span class="pill has">implemented</span></td><td><a href="browser.html#browser.click">详情</a></td></tr>
<tr><td class="id"><a href="browser.html#browser.fill"><code>browser.fill</code></a></td><td>按 uid 向输入框填入文本。</td><td><span class="pill has">implemented</span></td><td><a href="browser.html#browser.fill">详情</a></td></tr>
<tr><td class="id"><a href="browser.html#browser.evaluate"><code>browser.evaluate</code></a></td><td>在访客页执行一个表达式并取回结果。</td><td><span class="pill has">implemented</span></td><td><a href="browser.html#browser.evaluate">详情</a></td></tr>
<tr><td class="id"><a href="browser.html#browser.console"><code>browser.console</code></a></td><td>读访客页控制台消息。</td><td><span class="pill has">implemented</span></td><td><a href="browser.html#browser.console">详情</a></td></tr>
<tr><td class="id"><a href="browser.html#browser.cdp"><code>browser.cdp</code></a></td><td>在白名单内调用一条 CDP 方法。</td><td><span class="pill has">implemented</span></td><td><a href="browser.html#browser.cdp">详情</a></td></tr>
</tbody>
</table>
</section><section>
<h2><span class="n">22</span>网络</h2>
<p class="lead">命名空间 <code>net</code> · 4 条</p>
<table>
<thead><tr><th>API</th><th>一句话</th><th>状态</th><th>页</th></tr></thead>
<tbody>
<tr><td class="id"><a href="net.html#net.fetch"><code>net.fetch</code></a></td><td>宿主代发 HTTP 请求。</td><td><span class="pill has">implemented</span></td><td><a href="net.html#net.fetch">详情</a></td></tr>
<tr><td class="id"><a href="net.html#net.websocket.connect"><code>net.websocket.connect</code></a></td><td>连接 <code>ws://</code> / <code>wss://</code> 端点,返回套接字 id。</td><td><span class="pill has">implemented</span></td><td><a href="net.html#net.websocket.connect">详情</a></td></tr>
<tr><td class="id"><a href="net.html#net.websocket.send"><code>net.websocket.send</code></a></td><td>发送文本或二进制帧。</td><td><span class="pill has">implemented</span></td><td><a href="net.html#net.websocket.send">详情</a></td></tr>
<tr><td class="id"><a href="net.html#net.websocket.close"><code>net.websocket.close</code></a></td><td>关闭套接字。</td><td><span class="pill has">implemented</span></td><td><a href="net.html#net.websocket.close">详情</a></td></tr>
</tbody>
</table>
</section><section>
<h2><span class="n">23</span>事件订阅</h2>
<p class="lead">命名空间 <code>events</code> · 2 条</p>
<table>
<thead><tr><th>API</th><th>一句话</th><th>状态</th><th>页</th></tr></thead>
<tbody>
<tr><td class="id"><a href="events.html#events.on"><code>events.on</code></a></td><td>订阅宿主推送事件。</td><td><span class="pill has">implemented</span></td><td><a href="events.html#events.on">详情</a></td></tr>
<tr><td class="id"><a href="events.html#events.off"><code>events.off</code></a></td><td>取消事件订阅。</td><td><span class="pill has">implemented</span></td><td><a href="events.html#events.off">详情</a></td></tr>
</tbody>
</table>
</section><section>
<h2><span class="n">24</span>插件模块生命周期</h2>
<p class="lead">命名空间 <code>module</code> · 3 条</p>
<table>
<thead><tr><th>API</th><th>一句话</th><th>状态</th><th>页</th></tr></thead>
<tbody>
<tr><td class="id"><a href="module.html#module.onLoad"><code>module.onLoad</code></a></td><td>插件加载/启用时由运行时调用。</td><td><span class="pill has">implemented</span></td><td><a href="module.html#module.onLoad">详情</a></td></tr>
<tr><td class="id"><a href="module.html#module.onUnload"><code>module.onUnload</code></a></td><td>插件停用/卸载前调用,用于清理。</td><td><span class="pill has">implemented</span></td><td><a href="module.html#module.onUnload">详情</a></td></tr>
<tr><td class="id"><a href="module.html#module.onPanelInvoke"><code>module.onPanelInvoke</code></a></td><td>隔离面板页与插件进程之间的固定通道调用入口。</td><td><span class="pill has">implemented</span></td><td><a href="module.html#module.onPanelInvoke">详情</a></td></tr>
</tbody>
</table>
</section>
</main>
</body>
</html>