@page-agent/llms 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +2 -1
- package/package.json +1 -1
- package/README.md +0 -41
package/LICENSE
CHANGED
package/package.json
CHANGED
package/README.md
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# @page-agent/llms
|
|
2
|
-
|
|
3
|
-
LLM client with a **reflection-before-action** mental model for page-agent.
|
|
4
|
-
|
|
5
|
-
## Why This Package Exists
|
|
6
|
-
|
|
7
|
-
The LLM module and the agent logic are inherently coupled. This package exists not to decouple them, but to **define the interface contract** between the LLM and the agent.
|
|
8
|
-
|
|
9
|
-
The core abstraction is the `MacroToolInput` — a structured output format that **forces the model to reflect before acting**.
|
|
10
|
-
|
|
11
|
-
## The Reflection-Before-Action Model
|
|
12
|
-
|
|
13
|
-
Every tool call must first output its reasoning state before the actual action:
|
|
14
|
-
|
|
15
|
-
```typescript
|
|
16
|
-
interface MacroToolInput {
|
|
17
|
-
// Reflection (mandatory before any action)
|
|
18
|
-
evaluation_previous_goal?: string // How well did the previous action work?
|
|
19
|
-
memory?: string // Key information to remember
|
|
20
|
-
next_goal?: string // What to accomplish next
|
|
21
|
-
|
|
22
|
-
// Action (the actual operation)
|
|
23
|
-
action: Record<string, any>
|
|
24
|
-
}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
This design ensures that:
|
|
28
|
-
|
|
29
|
-
1. **The model evaluates its previous action** before deciding the next step
|
|
30
|
-
2. **Working memory is explicitly maintained** across conversation turns
|
|
31
|
-
3. **Goals are clearly stated**, making the agent's reasoning transparent and debuggable
|
|
32
|
-
|
|
33
|
-
## Key Components
|
|
34
|
-
|
|
35
|
-
| Export | Description |
|
|
36
|
-
|--------|-------------|
|
|
37
|
-
| `LLM` | Main LLM client class with retry logic |
|
|
38
|
-
| `MacroToolInput` | The reflection-before-action input schema |
|
|
39
|
-
| `AgentBrain` | Agent's thinking state (eval, memory, goal) |
|
|
40
|
-
| `LLMConfig` | Configuration for LLM connection |
|
|
41
|
-
| `parseLLMConfig` | Parse and apply defaults to config |
|