feat: 增加共享 Agent Browser 调试能力

需求:在 AI 编程会话中让用户与 Agent 共享同一浏览器页面,并查看控制台与网络信息。

实现:新增沙箱浏览器内核、Host API/渲染器面板、OpenCode 工具接入及安全边界测试。
This commit is contained in:
2026-07-31 14:53:36 +08:00
parent 80e8386fa6
commit e97a7ce9df
39 changed files with 6734 additions and 9 deletions

View File

@@ -1,6 +1,10 @@
import { ipcMain } from 'electron';
import { getPort } from '../../utils/config';
import { getHostApiToken } from '../../api/server';
import {
getRendererCapability,
RENDERER_CAPABILITY_HEADER,
} from '../../api/renderer-capability';
type HostApiFetchRequest = {
path: string;
@@ -28,6 +32,7 @@ export function registerHostApiProxyHandlers(): void {
const headers: Record<string, string> = { ...(request.headers || {}) };
// Inject the per-session auth token so the Host API server accepts this request.
headers['Authorization'] = `Bearer ${getHostApiToken()}`;
headers[RENDERER_CAPABILITY_HEADER] = getRendererCapability();
let body: string | undefined;
if (request.body !== undefined && request.body !== null) {