Compare commits

...

8 Commits

Author SHA1 Message Date
Simon 785a2d194e chore(version): bump version to 1.0.0-beta.5 2026-01-22 15:17:19 +08:00
Simon 391e70dca4 feat: update historical event types 2026-01-22 15:16:15 +08:00
Simon 3ffcd6482d refactor: rename AgentStep to AgentStepEventErrorEvent to AgentErrorEvent 2026-01-22 14:59:35 +08:00
Simon 0cd04db40f fix: rebuild lock 2026-01-22 14:12:37 +08:00
Simon 23f1818503 docs: update README for clarity and integration details 2026-01-21 20:15:33 +08:00
Simon 5fdb49fecb fix(sync-version): update version check to use pkgJson.version 2026-01-21 19:20:23 +08:00
Simon fe1893a382 fix: rebuild lock 2026-01-21 19:04:26 +08:00
Simon 8c1c1ed9fe fix: correct prettier extension recommendation 2026-01-21 19:01:27 +08:00
17 changed files with 608 additions and 604 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
{ {
"recommendations": ["dbaeumer.vscode-eslint", "prettier.prettier-vscode"] "recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
} }
+14 -16
View File
@@ -20,34 +20,38 @@
## ✨ Features ## ✨ Features
- **🎯 轻松集成** - **🎯 轻松集成**
- 无需 Python,无需无头浏览器,无需浏览器插件。纯页面内脚本。
- **🔐 端侧运行** - **🔐 端侧运行**
- **🧠 HTML 脱水** - **🧠 HTML 脱水**
- **💬 自然语言接口** - **💬 自然语言接口**
- **🎨 HITL 交互界面** - **🎨 HITL 交互界面**
## 🗺️ Roadmap 以及 😉
👉 [**Roadmap**](https://github.com/alibaba/page-agent/issues/96) - **🧪 实验性的 Chrome 扩展,支持跨页面控制** - `-b feat/ext`
👉 [**🗺️ Roadmap**](https://github.com/alibaba/page-agent/issues/96)
## 🚀 快速开始 ## 🚀 快速开始
### 快速体验 (With Testing LLM) ### 一行代码集成
最快的体验方式 通过我们免费的 Demo LLM 快速体验 PageAgent
```html ```html
<script <script
src="https://registry.npmmirror.com/page-agent/1.0.0-beta.4/files/dist/iife/page-agent.demo.js" src="https://registry.npmmirror.com/page-agent/1.0.0-beta.5/files/dist/iife/page-agent.demo.js"
crossorigin="true" crossorigin="true"
></script> ></script>
``` ```
> ⚠️ **仅用于技术评估。** Demo 模型有速率限制和使用限制,生产环境请使用 NPM 方式 > - **⚠️ 仅用于技术评估。** Demo LLM 有速率和使用限制,可能随时变更
> - **🌷 建议使用自己的 LLM API。**
| 镜像 | URL | | 镜像 | URL |
| ------ | ----------------------------------------------------------------------------------------- | | ------ | ----------------------------------------------------------------------------------------- |
| Global | https://cdn.jsdelivr.net/npm/page-agent@1.0.0-beta.4/dist/iife/page-agent.demo.js | | Global | https://cdn.jsdelivr.net/npm/page-agent@1.0.0-beta.5/dist/iife/page-agent.demo.js |
| China | https://registry.npmmirror.com/page-agent/1.0.0-beta.4/files/dist/iife/page-agent.demo.js | | China | https://registry.npmmirror.com/page-agent/1.0.0-beta.5/files/dist/iife/page-agent.demo.js |
### NPM 安装 ### NPM 安装
@@ -86,15 +90,9 @@ packages/
## 🤝 贡献 ## 🤝 贡献
欢迎社区贡献!以下是参与方式: 欢迎社区贡献!请参阅 [CONTRIBUTING.md](CONTRIBUTING.md) 了解环境配置和本地开发说明。
1. Fork 并 clone。`git clone https://github.com/alibaba/page-agent.git && cd page-agent` 请在贡献前阅读[行为准则](CODE_OF_CONDUCT.md)。
2. 安装依赖: `npm install`
3. 启动开发: `npm start`
更多详情请参阅 [CONTRIBUTING.md](CONTRIBUTING.md)。
请在贡献前阅读我们的[行为准则](CODE_OF_CONDUCT.md)。
## 👏 致谢 ## 👏 致谢
+15 -17
View File
@@ -19,35 +19,39 @@ The GUI Agent Living in Your Webpage. Control web interfaces with natural langua
## ✨ Features ## ✨ Features
- **🎯 Easy Integration** - Transform your webpage into an agent with a single script tag. - **🎯 Easy Integration**
- No python. No headless browser. No browser extension. Just in-page scripts.
- **🔐 Client-Side Processing** - **🔐 Client-Side Processing**
- **🧠 DOM Extraction** - **🧠 DOM Extraction**
- **💬 Natural Language Interface** - **💬 Natural Language Interface**
- **🎨 UI with Human in the loop** - **🎨 UI with Human in the loop**
## 🗺️ Roadmap And 😉
👉 [**Roadmap**](https://github.com/alibaba/page-agent/issues/96) - **🧪 `cross-page` control with an experimental chrome extension** - `-b feat/ext`
👉 [**🗺️ Roadmap**](https://github.com/alibaba/page-agent/issues/96)
## 🚀 Quick Start ## 🚀 Quick Start
### Quick Try (With Testing LLM) ### One-line integration
Fastest way to try PageAgent: Fastest way to try PageAgent with our free Demo LLM:
```html ```html
<script <script
src="https://cdn.jsdelivr.net/npm/page-agent@1.0.0-beta.4/dist/iife/page-agent.demo.js" src="https://cdn.jsdelivr.net/npm/page-agent@1.0.0-beta.5/dist/iife/page-agent.demo.js"
crossorigin="true" crossorigin="true"
></script> ></script>
``` ```
> ⚠️ **For technical evaluation only.** Demo model has rate limits and usage restrictions. Use NPM for production. > - **⚠️ For technical evaluation only.** Demo LLM has rate limits and usage restrictions. May change without notice.
> - **🌷 Bring your own LLM API.**
| Mirrors | URL | | Mirrors | URL |
| ------- | ----------------------------------------------------------------------------------------- | | ------- | ----------------------------------------------------------------------------------------- |
| Global | https://cdn.jsdelivr.net/npm/page-agent@1.0.0-beta.4/dist/iife/page-agent.demo.js | | Global | https://cdn.jsdelivr.net/npm/page-agent@1.0.0-beta.5/dist/iife/page-agent.demo.js |
| China | https://registry.npmmirror.com/page-agent/1.0.0-beta.4/files/dist/iife/page-agent.demo.js | | China | https://registry.npmmirror.com/page-agent/1.0.0-beta.5/files/dist/iife/page-agent.demo.js |
### NPM Installation ### NPM Installation
@@ -84,15 +88,9 @@ packages/
## 🤝 Contributing ## 🤝 Contributing
We welcome contributions from the community! Here's how to get started: We welcome contributions from the community! Follow our instructions in [CONTRIBUTING.md](CONTRIBUTING.md) for environment setup and local development.
1. Fork and clone. `git clone https://github.com/alibaba/page-agent.git && cd page-agent` Please read [Code of Conduct](CODE_OF_CONDUCT.md) before contributing.
2. Install dependencies: `npm install`
3. Start development: `npm start`
More details in [CONTRIBUTING.md](CONTRIBUTING.md).
Please read our [Code of Conduct](CODE_OF_CONDUCT.md) before contributing.
## 👏 Acknowledgments ## 👏 Acknowledgments
+525 -539
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "root", "name": "root",
"private": true, "private": true,
"version": "1.0.0-beta.4", "version": "1.0.0-beta.5",
"type": "module", "type": "module",
"workspaces": [ "workspaces": [
"packages/page-controller", "packages/page-controller",
+3 -3
View File
@@ -1,7 +1,7 @@
{ {
"name": "@page-agent/core", "name": "@page-agent/core",
"private": false, "private": false,
"version": "1.0.0-beta.4", "version": "1.0.0-beta.5",
"type": "module", "type": "module",
"main": "./dist/esm/page-agent-core.js", "main": "./dist/esm/page-agent-core.js",
"module": "./dist/esm/page-agent-core.js", "module": "./dist/esm/page-agent-core.js",
@@ -45,7 +45,7 @@
"dependencies": { "dependencies": {
"chalk": "^5.6.2", "chalk": "^5.6.2",
"zod": "^4.3.5", "zod": "^4.3.5",
"@page-agent/llms": "1.0.0-beta.4", "@page-agent/llms": "1.0.0-beta.5",
"@page-agent/page-controller": "1.0.0-beta.4" "@page-agent/page-controller": "1.0.0-beta.5"
} }
} }
+4 -6
View File
@@ -15,7 +15,7 @@ import {
AgentActivity, AgentActivity,
AgentReflection, AgentReflection,
AgentStatus, AgentStatus,
AgentStep, AgentStepEvent,
ExecutionResult, ExecutionResult,
HistoricalEvent, HistoricalEvent,
MacroToolInput, MacroToolInput,
@@ -99,8 +99,7 @@ export class PageAgentCore extends EventTarget {
this.emitActivity({ type: 'retrying', attempt, maxAttempts }) this.emitActivity({ type: 'retrying', attempt, maxAttempts })
// Also push to history for panel rendering // Also push to history for panel rendering
this.history.push({ this.history.push({
type: 'error', type: 'retry',
errorType: 'retry',
message: `LLM retry attempt ${attempt} of ${maxAttempts}`, message: `LLM retry attempt ${attempt} of ${maxAttempts}`,
attempt, attempt,
maxAttempts, maxAttempts,
@@ -114,7 +113,6 @@ export class PageAgentCore extends EventTarget {
// Also push to history for panel rendering // Also push to history for panel rendering
this.history.push({ this.history.push({
type: 'error', type: 'error',
errorType: 'error',
message, message,
rawResponse: (error as InvokeError).rawResponse, rawResponse: (error as InvokeError).rawResponse,
}) })
@@ -256,7 +254,7 @@ export class PageAgentCore extends EventTarget {
next_goal: input.next_goal, next_goal: input.next_goal,
} }
const actionName = Object.keys(input.action)[0] const actionName = Object.keys(input.action)[0]
const action: AgentStep['action'] = { const action: AgentStepEvent['action'] = {
name: actionName, name: actionName,
input: input.action[actionName], input: input.action[actionName],
output: output, output: output,
@@ -269,7 +267,7 @@ export class PageAgentCore extends EventTarget {
action, action,
usage: result.usage, usage: result.usage,
rawResponse: result.rawResponse, rawResponse: result.rawResponse,
} as AgentStep) } as AgentStepEvent)
this.#emitHistoryChange() this.#emitHistoryChange()
console.log(chalk.green('Step finished:'), actionName) console.log(chalk.green('Step finished:'), actionName)
+20 -8
View File
@@ -33,7 +33,7 @@ export interface MacroToolResult {
/** /**
* A single agent step with reflection and action * A single agent step with reflection and action
*/ */
export interface AgentStep { export interface AgentStepEvent {
type: 'step' type: 'step'
stepIndex: number stepIndex: number
reflection: Partial<AgentReflection> reflection: Partial<AgentReflection>
@@ -69,21 +69,33 @@ export interface UserTakeoverEvent {
} }
/** /**
* Error event (retry or error from LLM) * Retry event - LLM call is being retried
*/ */
export interface ErrorEvent { export interface RetryEvent {
type: 'error' type: 'retry'
errorType: 'retry' | 'error' message: string
attempt: number
maxAttempts: number
}
/**
* Error event - fatal error from LLM or execution
*/
export interface AgentErrorEvent {
type: 'error'
message: string message: string
attempt?: number
maxAttempts?: number
rawResponse?: unknown rawResponse?: unknown
} }
/** /**
* Union type for all history events * Union type for all history events
*/ */
export type HistoricalEvent = AgentStep | ObservationEvent | UserTakeoverEvent | ErrorEvent export type HistoricalEvent =
| AgentStepEvent
| ObservationEvent
| UserTakeoverEvent
| RetryEvent
| AgentErrorEvent
/** /**
* Agent execution status * Agent execution status
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@page-agent/llms", "name": "@page-agent/llms",
"version": "1.0.0-beta.4", "version": "1.0.0-beta.5",
"type": "module", "type": "module",
"main": "./dist/lib/page-agent-llms.js", "main": "./dist/lib/page-agent-llms.js",
"module": "./dist/lib/page-agent-llms.js", "module": "./dist/lib/page-agent-llms.js",
+5 -5
View File
@@ -1,7 +1,7 @@
{ {
"name": "page-agent", "name": "page-agent",
"private": false, "private": false,
"version": "1.0.0-beta.4", "version": "1.0.0-beta.5",
"type": "module", "type": "module",
"main": "./dist/esm/page-agent.js", "main": "./dist/esm/page-agent.js",
"module": "./dist/esm/page-agent.js", "module": "./dist/esm/page-agent.js",
@@ -46,9 +46,9 @@
"dependencies": { "dependencies": {
"chalk": "^5.6.2", "chalk": "^5.6.2",
"zod": "^4.3.5", "zod": "^4.3.5",
"@page-agent/llms": "1.0.0-beta.4", "@page-agent/llms": "1.0.0-beta.5",
"@page-agent/page-controller": "1.0.0-beta.4", "@page-agent/page-controller": "1.0.0-beta.5",
"@page-agent/core": "1.0.0-beta.4", "@page-agent/core": "1.0.0-beta.5",
"@page-agent/ui": "1.0.0-beta.4" "@page-agent/ui": "1.0.0-beta.5"
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@page-agent/page-controller", "name": "@page-agent/page-controller",
"version": "1.0.0-beta.4", "version": "1.0.0-beta.5",
"type": "module", "type": "module",
"main": "./dist/lib/page-controller.js", "main": "./dist/lib/page-controller.js",
"module": "./dist/lib/page-controller.js", "module": "./dist/lib/page-controller.js",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@page-agent/ui", "name": "@page-agent/ui",
"version": "1.0.0-beta.4", "version": "1.0.0-beta.5",
"type": "module", "type": "module",
"main": "./dist/lib/page-agent-ui.js", "main": "./dist/lib/page-agent-ui.js",
"module": "./dist/lib/page-agent-ui.js", "module": "./dist/lib/page-agent-ui.js",
+7
View File
@@ -608,6 +608,13 @@ export class Panel {
) )
} else if (event.type === 'user_takeover') { } else if (event.type === 'user_takeover') {
cards.push(createCard({ icon: '👤', content: 'User takeover', meta, type: 'input' })) cards.push(createCard({ icon: '👤', content: 'User takeover', meta, type: 'input' }))
} else if (event.type === 'retry') {
const retryInfo = `${event.message || 'Retrying'} (${event.attempt}/${event.maxAttempts})`
cards.push(createCard({ icon: '🔄', content: retryInfo, meta, type: 'observation' }))
} else if (event.type === 'error') {
cards.push(
createCard({ icon: '❌', content: event.message || 'Error', meta, type: 'observation' })
)
} }
return cards return cards
+6 -1
View File
@@ -33,7 +33,7 @@ export interface PanelAgentAdapter extends EventTarget {
/** History of agent events */ /** History of agent events */
readonly history: readonly { readonly history: readonly {
type: 'step' | 'observation' | 'user_takeover' | 'error' type: 'step' | 'observation' | 'user_takeover' | 'retry' | 'error'
stepIndex?: number stepIndex?: number
/** For 'step' type */ /** For 'step' type */
reflection?: { reflection?: {
@@ -49,6 +49,11 @@ export interface PanelAgentAdapter extends EventTarget {
} }
/** For 'observation' type */ /** For 'observation' type */
content?: string content?: string
/** For 'retry' type */
attempt?: number
maxAttempts?: number
/** For 'retry' and 'error' types */
message?: string
}[] }[]
/** Current task being executed */ /** Current task being executed */
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "@page-agent/website", "name": "@page-agent/website",
"private": true, "private": true,
"version": "1.0.0-beta.4", "version": "1.0.0-beta.5",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite --host 0.0.0.0", "dev": "vite --host 0.0.0.0",
+2 -2
View File
@@ -1,8 +1,8 @@
// Demo build (auto-init with demo LLM, for quick testing) // Demo build (auto-init with demo LLM, for quick testing)
export const CDN_DEMO_URL = export const CDN_DEMO_URL =
'https://cdn.jsdelivr.net/npm/page-agent@1.0.0-beta.4/dist/iife/page-agent.demo.js' 'https://cdn.jsdelivr.net/npm/page-agent@1.0.0-beta.5/dist/iife/page-agent.demo.js'
export const CDN_DEMO_CN_URL = export const CDN_DEMO_CN_URL =
'https://registry.npmmirror.com/page-agent/1.0.0-beta.4/files/dist/iife/page-agent.demo.js' 'https://registry.npmmirror.com/page-agent/1.0.0-beta.5/files/dist/iife/page-agent.demo.js'
// Demo LLM for website testing // Demo LLM for website testing
export const DEMO_MODEL = 'PAGE-AGENT-FREE-TESTING-RANDOM' export const DEMO_MODEL = 'PAGE-AGENT-FREE-TESTING-RANDOM'
+1 -1
View File
@@ -79,7 +79,7 @@ for (const pkg of packages) {
let pkgChanged = false let pkgChanged = false
// Update package version // Update package version
if (oldVersion !== newVersion) { if (pkgJson.version !== newVersion) {
pkgJson.version = newVersion pkgJson.version = newVersion
pkgChanged = true pkgChanged = true
} }