fix: demo not showing panel; docs updated
This commit is contained in:
18
AGENTS.md
18
AGENTS.md
@@ -72,28 +72,14 @@ const pageInfo = await this.pageController.getPageInfo()
|
|||||||
3. **LLM Processing**: AI returns action plans (page-agent)
|
3. **LLM Processing**: AI returns action plans (page-agent)
|
||||||
4. **Indexed Operations**: PageAgent calls PageController by element index
|
4. **Indexed Operations**: PageAgent calls PageController by element index
|
||||||
|
|
||||||
### IIFE Builds (`packages/page-agent/dist/iife/`)
|
|
||||||
|
|
||||||
Two IIFE builds for script tag usage:
|
|
||||||
|
|
||||||
| Build | File | Description |
|
|
||||||
| ----- | -------------------- | -------------------------------- |
|
|
||||||
| Demo | `page-agent.demo.js` | Auto-init with built-in test API |
|
|
||||||
| Full | `page-agent.js` | Exposes `PageAgent` class only |
|
|
||||||
|
|
||||||
Demo build supports query params (e.g., `?model=gpt-4&lang=en-US`).
|
|
||||||
|
|
||||||
Build with `npm run build:iife --workspace=page-agent`.
|
|
||||||
|
|
||||||
## Key Files Reference
|
## Key Files Reference
|
||||||
|
|
||||||
### Page Agent (`packages/page-agent/`)
|
### Page Agent (`packages/page-agent/`)
|
||||||
|
|
||||||
| File | Description |
|
| File | Description |
|
||||||
| ------------------------ | -------------------------------------------- |
|
| ------------------ | -------------------------------------------- |
|
||||||
| `src/PageAgent.ts` | ⭐ Main class with UI, extends PageAgentCore |
|
| `src/PageAgent.ts` | ⭐ Main class with UI, extends PageAgentCore |
|
||||||
| `src/entry-iife.ts` | IIFE entry (exposes PageAgent class) |
|
| `src/demo.ts` | IIFE demo entry (auto-init with demo API) |
|
||||||
| `src/entry-iife-demo.ts` | IIFE demo entry (auto-init with demo API) |
|
|
||||||
|
|
||||||
### Core (`packages/core/`)
|
### Core (`packages/core/`)
|
||||||
|
|
||||||
|
|||||||
@@ -122,13 +122,13 @@ npm start
|
|||||||
- Start and serve a local `iife` script
|
- Start and serve a local `iife` script
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm run dev:iife # Serving IIFE with auto rebuild at http://localhost:5174/page-agent.js
|
npm run dev:demo # Serving IIFE with auto rebuild at http://localhost:5174/page-agent.demo.js
|
||||||
```
|
```
|
||||||
|
|
||||||
- Add a new bookmark
|
- Add a new bookmark
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
javascript:(function(){var s=document.createElement('script');s.src=`http://localhost:5174/page-agent.js?t=${Math.random()}`;s.onload=()=>console.log(%27PageAgent ready!%27);document.head.appendChild(s);})();
|
javascript:(function(){var s=document.createElement('script');s.src=`http://localhost:5174/page-agent.demo.js?t=${Math.random()}`;s.onload=()=>console.log(%27PageAgent ready!%27);document.head.appendChild(s);})();
|
||||||
```
|
```
|
||||||
|
|
||||||
- Click the bookmark on any page to load Page-Agent
|
- Click the bookmark on any page to load Page-Agent
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
"build:website": "npm run build:website --workspace=@page-agent/website",
|
"build:website": "npm run build:website --workspace=@page-agent/website",
|
||||||
"build:libs": "npm run build --workspaces --if-present",
|
"build:libs": "npm run build --workspaces --if-present",
|
||||||
"build": "npm run build:libs && npm run build:website",
|
"build": "npm run build:libs && npm run build:website",
|
||||||
"dev:iife": "npm run dev:iife --workspace=page-agent",
|
"dev:demo": "npm run dev:demo --workspace=page-agent",
|
||||||
"version": "node scripts/sync-version.js",
|
"version": "node scripts/sync-version.js",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"prepare": "husky"
|
"prepare": "husky"
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ setTimeout(() => {
|
|||||||
|
|
||||||
// Create agent
|
// Create agent
|
||||||
window.pageAgent = new PageAgent(config)
|
window.pageAgent = new PageAgent(config)
|
||||||
|
window.pageAgent.panel.show()
|
||||||
|
|
||||||
console.log('🚀 page-agent.js initialized with config:', window.pageAgent.config)
|
console.log('🚀 page-agent.js initialized with config:', window.pageAgent.config)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user