diff --git a/AGENTS.md b/AGENTS.md index f4a0b94..7080d09 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -72,28 +72,14 @@ const pageInfo = await this.pageController.getPageInfo() 3. **LLM Processing**: AI returns action plans (page-agent) 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 ### Page Agent (`packages/page-agent/`) -| File | Description | -| ------------------------ | -------------------------------------------- | -| `src/PageAgent.ts` | ⭐ Main class with UI, extends PageAgentCore | -| `src/entry-iife.ts` | IIFE entry (exposes PageAgent class) | -| `src/entry-iife-demo.ts` | IIFE demo entry (auto-init with demo API) | +| File | Description | +| ------------------ | -------------------------------------------- | +| `src/PageAgent.ts` | ⭐ Main class with UI, extends PageAgentCore | +| `src/demo.ts` | IIFE demo entry (auto-init with demo API) | ### Core (`packages/core/`) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 500da7b..473e537 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -122,13 +122,13 @@ npm start - Start and serve a local `iife` script ```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 ```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 diff --git a/package.json b/package.json index de85d57..90afcd0 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "build:website": "npm run build:website --workspace=@page-agent/website", "build:libs": "npm run build --workspaces --if-present", "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", "lint": "eslint .", "prepare": "husky" diff --git a/packages/page-agent/src/demo.ts b/packages/page-agent/src/demo.ts index 9b39a79..21f220d 100644 --- a/packages/page-agent/src/demo.ts +++ b/packages/page-agent/src/demo.ts @@ -41,6 +41,7 @@ setTimeout(() => { // Create agent window.pageAgent = new PageAgent(config) + window.pageAgent.panel.show() console.log('🚀 page-agent.js initialized with config:', window.pageAgent.config) })