项目简介
Page Agent 是一个内置在网页中的 GUI 智能体,通过文本 DOM 操作来控制界面。无需截图、多模态模型或浏览器扩展,支持自定义 LLM。可通过脚本标签或 npm 包轻松集成到任意网页中。
README 预览
# Page Agent\n\n\n \n \n\n\n[](https://opensource.org/licenses/MIT) [](http://www.typescriptlang.org/) [](https://bundlephobia.com/package/page-agent) [](https://www.npmjs.com/package/page-agent) [](https://github.com/alibaba/page-agent)\n\nThe GUI Agent Living in Your Webpage. Control web interfaces with natural language.\n\n🌐 **English** | [中文](./docs/README-zh.md)\n\n🚀 Demo | 📖 Docs | 📢 HN Discussion | 𝕏 Follow on X\n\n\n\nhttps://github.com/user-attachments/assets/a1f2eae2-13fb-4aae-98cf-a3fc1620a6c2\n\n---\n\n## ✨ Features\n\n- **🎯 Easy integration**\n - No need for `browser extension` / `python` / `headless browser`.\n - Just in-page javascript. Everything happens in your web page.\n- **📖 Text-based DOM manipulation**\n - No screenshots. No multi-modal LLMs or special permissions needed.\n- **🧠 Bring your own LLMs**\n- **🐙 Optional [chrome extension](https://alibaba.github.io/page-agent/docs/features/chrome-extension) for multi-page tasks.**\n - And an [MCP Server (Beta)](https://alibaba.github.io/page-agent/docs/features/mcp-server) to control it from outside\n\n## 💡 Use Cases\n\n- **SaaS AI Copilot** — Ship an AI copilot in your product in lines of code. No backend rewrite.\n- **Smart Form Filling** — Turn 20-click workflows into one sentence. Perfect for ERP, CRM, and admin systems.\n- **Accessibility** — Make any web app accessible through natural language. Voice commands, screen readers, zero barrier.\n- **Multi-page Agent** — Extend your own web agent's reach across browser tabs [chrome extension](https://alibaba.github.io/page-agent/docs/features/chrome-extension).\n- **MCP** - Allow your agent clients to control your browser.\n\n## 🚀 Quick Start\n\n### One-line integration\n\nFastest way to try PageAgent with our free Demo LLM:\n\n```html\n\n```\n\n> **⚠️ For technical evaluation only.** This demo CDN uses our free [testing LLM API](https://alibaba.github.io/page-agent/docs/features/models#free-testing-api). By using it, you ag
常见问题 (5)
故障排除如何修复在使用 esbuild drop console 的 Vite 生产构建中出现的 'TypeError: debug is not a function' 错误?
此问题影响 page-agent / @page-agent/llms 1.12.1。该包通过 var debug = console.debug.bind(...) 绑定了一个本地日志记录器。当 esbuild 使用 drop: ['console'] 时,该表达式会被重写为 var debug = void 0,因此后续在生产环境中调用 debug(...) 会失败。设置 globalThis.debug 无效,因为 debug 是模块局部变量。
永久修复方案:将 page-agent 和 @page-agent/llms 升级到包含 issue #621 修复的版本,该修复将日志记录器包装在函数中,而不是直接存储绑定后的 console.debug。
临时使用者变通方案:禁用打包时的 console 删除。在 vite.config.ts 中:
export default defineConfig({
esbuild: {
drop: []
}
})
如果该选项由 VitePress 或其他预设注入,可使用 Vite 插件强制覆盖:
function keepConsole() {
return {
name: 'keep-console',
configResolved(config: any) {
if (config.esbuild && typeof config.esbuild === 'object') {
config.esbuild.drop = []
}
}
}
}
export default defineConfig({
plugins: [keepConsole()]
})
或者,使用安全的包装器修补 dist/lib/page-agent-llms.js:
var debug = (...args) => {
if (typeof console !== 'undefined' && typeof console.debug === 'function') {
console.debug(chalk.gray('[LLM]'), ...args)
}
}
验证构建输出中不再包含 debug=void 0:
grep -n "debug=void 0" dist/assets/*.js故障排除为什么当 Page Agent 在搜索框中输入时,Bing 搜索建议会失败?
在 Chrome 152/macOS 上的 Page Agent 1.12.2 中,inputTextElement() 在输入 weather tomorrow 等文本后会强制输入框失去焦点,导致 Bing 无法显示其建议。该问题已通过 PR fix(page-controller): preserve input focus 修复。请将 Page Agent 升级到包含该 PR 的版本,或从合并了 page-controller 焦点修复的源码进行构建。inputTextElement() 运行后,输入框应保持焦点,从而使 Bing 建议能够正常显示。作为临时解决方法,可在自动输入文本后显式重新聚焦搜索框,并触发 input 事件。
故障排除如何修复因 MV3 service worker 处于非活动状态而导致浏览器扩展无响应并忽略消息的问题?
此问题发生在 v1.7.1 中:当 Manifest V3 service worker 在扩展程序更新后停滞时,Chrome/Brave 可能会在更新期间清除已注册的 alarms,导致后台 worker 无法正确重启。作为临时解决方法,请打开 brave://extensions(或 chrome://extensions),找到该扩展程序,点击 Reload 按钮,然后重新打开代理聊天。如果仍然卡住,请将该扩展程序关闭后再开启,或重启浏览器。永久修复方案是将扩展程序升级到包含 stalled-worker 健康检查以及 service-worker alarm/更新修复的版本。
故障排除如何修复自定义 MiniMax M3 模型在 v1.10.0 中无法正常工作的问题?
升级到包含 refactor(llms): rewrite model patching and deprecate temperature 修复的版本,或从最新的 main 分支构建。该故障是由 MiniMax M3 更改其参数 schema 导致的;更新后的模型补丁会发送与当前 schema 匹配的参数。升级后,请移除任何手动配置的 temperature 设置,因为它已被弃用。如果你通过 OpenRouter 使用 M3,工具调用仍可能失败,因为该模型有时会返回无效的 int/string 格式;该问题必须由模型/提供商修复,因此请使用受支持的模型或直接访问 MiniMax 作为临时解决方案。
故障排除为什么 wait 工具在 AbortSignal 被中止时不会立即 reject?
此问题由核心 PR fix(core): make wait honor abort during setup 修复,该 PR 关闭了 issue #553。此前,wait 在定时器启动前读取页面更新计时时可能会忽略中止操作。请将核心包升级到包含此修复的版本;升级后,中止信号会在设置阶段立即中断 wait,而不再等待定时器启动。可通过向 wait 传入一个已中止的 AbortController.signal 进行验证。