docs: update documentation to include llms package
This commit is contained in:
23
AGENTS.md
23
AGENTS.md
@@ -9,6 +9,7 @@ This is a **monorepo** with npm workspaces containing **two main packages**:
|
|||||||
|
|
||||||
And other internal packages:
|
And other internal packages:
|
||||||
|
|
||||||
|
- **LLMs** (`packages/llms/`) - LLM client with reflection-before-action mental model.
|
||||||
- **Page Controller** (`packages/page-controller/`) - DOM operations and element interactions. Independent of LLM.
|
- **Page Controller** (`packages/page-controller/`) - DOM operations and element interactions. Independent of LLM.
|
||||||
- **UI** (`packages/ui/`) - Panel, SimulatorMask, and i18n. Decoupled from PageAgent.
|
- **UI** (`packages/ui/`) - Panel, SimulatorMask, and i18n. Decoupled from PageAgent.
|
||||||
|
|
||||||
@@ -37,8 +38,7 @@ packages/
|
|||||||
├── page-agent/ # npm: "page-agent" ⭐ MAIN
|
├── page-agent/ # npm: "page-agent" ⭐ MAIN
|
||||||
│ ├── src/
|
│ ├── src/
|
||||||
│ │ ├── PageAgent.ts # Main AI agent class
|
│ │ ├── PageAgent.ts # Main AI agent class
|
||||||
│ │ ├── tools/ # LLM tool definitions
|
│ │ └── tools/ # LLM tool definitions
|
||||||
│ │ └── llms/ # LLM integration
|
|
||||||
│ ├── vite.config.js # Library build (ES + UMD)
|
│ ├── vite.config.js # Library build (ES + UMD)
|
||||||
│ └── package.json
|
│ └── package.json
|
||||||
├── website/ # npm: "@page-agent/website" (private) ⭐ MAIN
|
├── website/ # npm: "@page-agent/website" (private) ⭐ MAIN
|
||||||
@@ -47,6 +47,11 @@ packages/
|
|||||||
│
|
│
|
||||||
│ # ...internal packages below...
|
│ # ...internal packages below...
|
||||||
│
|
│
|
||||||
|
├── llms/ # npm: "@page-agent/llms"
|
||||||
|
│ └── src/ # LLM client (reflection-before-action model)
|
||||||
|
│ ├── index.ts
|
||||||
|
│ ├── types.ts # MacroToolInput, AgentBrain, LLMConfig
|
||||||
|
│ └── OpenAI*.ts # OpenAI-compatible clients
|
||||||
├── page-controller/ # npm: "@page-agent/page-controller"
|
├── page-controller/ # npm: "@page-agent/page-controller"
|
||||||
│ └── src/ # DOM operations
|
│ └── src/ # DOM operations
|
||||||
│ ├── PageController.ts
|
│ ├── PageController.ts
|
||||||
@@ -66,6 +71,7 @@ packages/
|
|||||||
// internal deps (topological order)
|
// internal deps (topological order)
|
||||||
"packages/page-controller",
|
"packages/page-controller",
|
||||||
"packages/ui",
|
"packages/ui",
|
||||||
|
"packages/llms",
|
||||||
"packages/page-agent",
|
"packages/page-agent",
|
||||||
"packages/website"
|
"packages/website"
|
||||||
],
|
],
|
||||||
@@ -74,7 +80,8 @@ packages/
|
|||||||
### Module Boundaries (Critical)
|
### Module Boundaries (Critical)
|
||||||
|
|
||||||
- **Website** (`packages/website/`): CAN import from `page-agent` for demos. Alias `@/` → `website/src/`
|
- **Website** (`packages/website/`): CAN import from `page-agent` for demos. Alias `@/` → `website/src/`
|
||||||
- **Page Agent** (`packages/page-agent/`): The core lib. Imports from `@page-agent/page-controller` and `@page-agent/ui`.
|
- **Page Agent** (`packages/page-agent/`): The core lib. Imports from `@page-agent/llms`, `@page-agent/page-controller` and `@page-agent/ui`.
|
||||||
|
- **LLMs** (`packages/llms/`): LLM client with MacroToolInput contract. No dependency on page-agent.
|
||||||
- **UI** (`packages/ui/`): Panel, Mask, i18n. No dependency on page-agent.
|
- **UI** (`packages/ui/`): Panel, Mask, i18n. No dependency on page-agent.
|
||||||
- **Page Controller** (`packages/page-controller/`): Pure DOM operations. No LLM or UI dependency.
|
- **Page Controller** (`packages/page-controller/`): Pure DOM operations. No LLM or UI dependency.
|
||||||
|
|
||||||
@@ -130,9 +137,17 @@ Query params configure `PageAgentConfig` automatically in `src/entry.ts`.
|
|||||||
| `src/PageAgent.ts` | ⭐ Main AI agent class orchestrating tools and LLM |
|
| `src/PageAgent.ts` | ⭐ Main AI agent class orchestrating tools and LLM |
|
||||||
| `src/umd.ts` | CDN/UMD entry point with auto-initialization |
|
| `src/umd.ts` | CDN/UMD entry point with auto-initialization |
|
||||||
| `src/tools/` | Tool definitions that call PageController methods |
|
| `src/tools/` | Tool definitions that call PageController methods |
|
||||||
| `src/llms/` | LLM integration and communication layer |
|
|
||||||
| `vite.config.js` | Library build configuration (ES + UMD) |
|
| `vite.config.js` | Library build configuration (ES + UMD) |
|
||||||
|
|
||||||
|
### LLMs (`packages/llms/`)
|
||||||
|
|
||||||
|
| File | Description |
|
||||||
|
|------|-------------|
|
||||||
|
| `src/index.ts` | ⭐ LLM class with retry logic |
|
||||||
|
| `src/types.ts` | MacroToolInput, AgentBrain, LLMConfig definitions |
|
||||||
|
| `src/OpenAILenientClient.ts` | OpenAI-compatible client with lenient parsing |
|
||||||
|
| `src/utils.ts` | Zod-to-OpenAI conversion, model patches |
|
||||||
|
|
||||||
### Page Controller (`packages/page-controller/`)
|
### Page Controller (`packages/page-controller/`)
|
||||||
|
|
||||||
| File | Description |
|
| File | Description |
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ PageAgent adopts a simplified monorepo structure:
|
|||||||
```
|
```
|
||||||
packages/
|
packages/
|
||||||
├── page-agent/ # AI agent (npm: page-agent)
|
├── page-agent/ # AI agent (npm: page-agent)
|
||||||
|
├── llms/ # LLM 客户端 (npm: @page-agent/llms)
|
||||||
├── page-controller/ # DOM 操作 (npm: @page-agent/page-controller)
|
├── page-controller/ # DOM 操作 (npm: @page-agent/page-controller)
|
||||||
├── ui/ # 面板 & 蒙层 & 模拟鼠标 (npm: @page-agent/ui)
|
├── ui/ # 面板 & 蒙层 & 模拟鼠标 (npm: @page-agent/ui)
|
||||||
└── website/ # 文档站点
|
└── website/ # 文档站点
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ PageAgent adopts a simplified monorepo structure:
|
|||||||
```
|
```
|
||||||
packages/
|
packages/
|
||||||
├── page-agent/ # AI agent (npm: page-agent)
|
├── page-agent/ # AI agent (npm: page-agent)
|
||||||
|
├── llms/ # LLM client (npm: @page-agent/llms)
|
||||||
├── page-controller/ # DOM operations (npm: @page-agent/page-controller)
|
├── page-controller/ # DOM operations (npm: @page-agent/page-controller)
|
||||||
├── ui/ # Panel & Mask & Mouse Animation (npm: @page-agent/ui)
|
├── ui/ # Panel & Mask & Mouse Animation (npm: @page-agent/ui)
|
||||||
└── website/ # Demo & Documentation site
|
└── website/ # Demo & Documentation site
|
||||||
|
|||||||
Reference in New Issue
Block a user