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

@@ -16,7 +16,9 @@ import { handleLogRoutes } from './routes/logs';
import { handleUsageRoutes } from './routes/usage';
import { handleFileRoutes } from './routes/files';
import { handleMeowaGameAssetsRoutes } from './routes/meowa-game-assets';
import { handleAgentBrowserRoutes } from './routes/agent-browser';
import { sendJson, setCorsHeaders, requireJsonContentType } from './route-utils';
import { rotateRendererCapability } from './renderer-capability';
type RouteHandler = (
req: IncomingMessage,
@@ -31,6 +33,7 @@ const coreRouteHandlers: RouteHandler[] = [
handleAuthRoutes,
handleImageWorkspaceRoutes,
handleWorksRoutes,
handleAgentBrowserRoutes,
handleUserSyncRoutes,
handleOpencodeRoutes,
handleSettingsRoutes,
@@ -62,6 +65,7 @@ export function getHostApiToken(): string {
export function startHostApiServer(ctx: HostApiContext, port = getPort('NIANCODE_HOST_API')): Server {
// Generate a cryptographically random token for this session.
hostApiToken = randomBytes(32).toString('hex');
rotateRendererCapability();
const server = createServer(async (req, res) => {
try {