browserclaw-agent 0.3.0 → 0.3.2
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 +21 -0
- package/README.md +218 -0
- package/dist/advisor.d.ts +8 -0
- package/dist/advisor.d.ts.map +1 -0
- package/dist/{judge.js → advisor.js} +14 -14
- package/dist/advisor.js.map +1 -0
- package/dist/agent-loop.d.ts +2 -1
- package/dist/agent-loop.d.ts.map +1 -1
- package/dist/agent-loop.js +61 -84
- package/dist/agent-loop.js.map +1 -1
- package/dist/answer-validator.d.ts +15 -0
- package/dist/answer-validator.d.ts.map +1 -0
- package/dist/answer-validator.js +94 -0
- package/dist/answer-validator.js.map +1 -0
- package/dist/llm.d.ts +1 -1
- package/dist/llm.d.ts.map +1 -1
- package/dist/llm.js +13 -13
- package/dist/llm.js.map +1 -1
- package/dist/session-manager.d.ts.map +1 -1
- package/dist/session-manager.js +51 -32
- package/dist/session-manager.js.map +1 -1
- package/dist/skill-generator.d.ts.map +1 -1
- package/dist/skill-generator.js +3 -1
- package/dist/skill-generator.js.map +1 -1
- package/dist/skills/page-state.js +1 -1
- package/dist/skills/page-state.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +3 -2
- package/dist/judge.d.ts +0 -8
- package/dist/judge.d.ts.map +0 -1
- package/dist/judge.js.map +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Idan Rubin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# browserclaw-agent
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://browserclaw.org"><img src="https://img.shields.io/badge/Live-browserclaw.org-orange" alt="Live" /></a>
|
|
5
|
+
<a href="https://www.npmjs.com/package/browserclaw-agent"><img src="https://img.shields.io/npm/v/browserclaw-agent.svg" alt="npm" /></a>
|
|
6
|
+
<a href="./LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License: MIT" /></a>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
The AI agent for [browserclaw](https://github.com/idan-rubin/browserclaw).
|
|
10
|
+
|
|
11
|
+
## Layered, not bundled
|
|
12
|
+
|
|
13
|
+
Three separate layers, not one monolith:
|
|
14
|
+
|
|
15
|
+
- ⚡ **LLM** — the electricity. Your choice: Claude, GPT, Gemini, local. No lock-in.
|
|
16
|
+
- 😎 **The agent** — the driver. Reasoning, obstacle recovery, learned skills. _That's this project._
|
|
17
|
+
- 🏎️ **[BrowserClaw](https://github.com/idan-rubin/browserclaw)** — the vehicle. Snapshots, element refs, browser control. Standalone npm library.
|
|
18
|
+
|
|
19
|
+
browser-use welds these into one package. We keep them as separate, swappable layers — drop the library into your own agent, pair this agent with any LLM, or run the whole stack as-is.
|
|
20
|
+
|
|
21
|
+
## vs browser-use
|
|
22
|
+
|
|
23
|
+
**Different lineage, different design.** [OpenClaw](https://openclaw.ai) took the [Playwright MCP](https://github.com/microsoft/playwright-mcp) approach — Microsoft's snapshot-and-ref pattern — implemented it locally, and refined it into [browserclaw](https://github.com/idan-rubin/browserclaw), a standalone npm library. This agent rides on that library. browser-use rolled its own Python stack as one bundled package.
|
|
24
|
+
|
|
25
|
+
| | browserclaw | browser-use |
|
|
26
|
+
| :-------------------------- | :----------------: | :----------------: |
|
|
27
|
+
| Standalone browser library | :white_check_mark: | :x: |
|
|
28
|
+
| Works with any agent | :white_check_mark: | :heavy_minus_sign: |
|
|
29
|
+
| Auto-learns skills per site | :white_check_mark: | :x: |
|
|
30
|
+
| Solves anti-bot in OSS | :white_check_mark: | :heavy_minus_sign: |
|
|
31
|
+
| TypeScript / Node | :white_check_mark: | :x: |
|
|
32
|
+
|
|
33
|
+
:white_check_mark: = Yes  :heavy_minus_sign: = Partial  :x: = No
|
|
34
|
+
|
|
35
|
+
## What the agent does
|
|
36
|
+
|
|
37
|
+
The agent reads an accessibility snapshot of the page, decides what to do next, and executes the action. Up to 100 steps per run. It maintains a memory scratchpad across steps and evaluates whether each action succeeded before deciding the next move.
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
snapshot → LLM → action → repeat
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Built-in skills
|
|
44
|
+
|
|
45
|
+
When the agent hits common obstacles, built-in skills take over automatically — no prompting needed:
|
|
46
|
+
|
|
47
|
+
- **Anti-bot bypass** — Detects and solves "hold to verify" overlays and press-and-hold challenges via CDP
|
|
48
|
+
- **Cloudflare Turnstile** — Solves "Verify you are human" checkboxes by locating and clicking the Turnstile iframe via CDP
|
|
49
|
+
- **Popup dismissal** — Closes cookie banners, consent dialogs, and modals using multi-strategy detection
|
|
50
|
+
- **Loop detection** — Detects when the agent is stuck repeating the same action and nudges it toward a different approach
|
|
51
|
+
- **Tab manager** — Detects and switches to new tabs opened during automation
|
|
52
|
+
|
|
53
|
+
### Skill catalog
|
|
54
|
+
|
|
55
|
+
Every successful run generates a skill file — steps and tips for that domain, stored in MinIO. On the next run against the same domain, the agent loads the skill as a playbook instead of exploring from scratch. If the new run completes in fewer steps, the skill is replaced. One domain, one skill, always improving.
|
|
56
|
+
|
|
57
|
+
The first user to automate a domain pays the exploration cost. Every subsequent run benefits from the learned playbook — and refines it further.
|
|
58
|
+
|
|
59
|
+
## Quick start
|
|
60
|
+
|
|
61
|
+
### Local (dev mode)
|
|
62
|
+
|
|
63
|
+
Chrome opens on your desktop. No containers, no VNC.
|
|
64
|
+
|
|
65
|
+
**Requires:** Node.js 22+, Chrome installed
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
cd src/Services/Browser
|
|
69
|
+
cp .env.example .env.local
|
|
70
|
+
# Set LLM_PROVIDER and at least one API key (see LLM providers below)
|
|
71
|
+
npm install
|
|
72
|
+
npm run dev
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Start a run:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
curl -X POST http://localhost:5040/api/v1/sessions \
|
|
79
|
+
-H "Content-Type: application/json" \
|
|
80
|
+
-d '{"prompt": "Find apartments in NYC under $3000"}'
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Stream progress:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
curl http://localhost:5040/api/v1/sessions/{id}/stream
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Docker (full stack)
|
|
90
|
+
|
|
91
|
+
Runs the frontend, browser service (headless Chrome + VNC), MinIO (skill storage), and Traefik. Same setup as [browserclaw.org](https://browserclaw.org).
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
git clone https://github.com/idan-rubin/browserclaw-agent.git
|
|
95
|
+
cd browserclaw-agent
|
|
96
|
+
cp src/Services/Browser/.env.example src/Services/Browser/.env.local
|
|
97
|
+
# Set LLM_PROVIDER and at least one API key
|
|
98
|
+
# Set BROWSER_INTERNAL_TOKEN to a random secret (used for frontend → browser service auth):
|
|
99
|
+
echo "BROWSER_INTERNAL_TOKEN=$(openssl rand -hex 32)" >> .env
|
|
100
|
+
docker compose up
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Open [localhost](http://localhost).
|
|
104
|
+
|
|
105
|
+
### LLM providers
|
|
106
|
+
|
|
107
|
+
Add at least one API key to `.env.local` and set `LLM_PROVIDER`:
|
|
108
|
+
|
|
109
|
+
| Provider | Env var | `LLM_PROVIDER` | Free tier |
|
|
110
|
+
| ----------------------------- | -------------------- | -------------- | ----------------- |
|
|
111
|
+
| Groq | `GROQ_API_KEY` | `groq` | Yes |
|
|
112
|
+
| Google Gemini | `GEMINI_API_KEY` | `gemini` | Yes |
|
|
113
|
+
| OpenAI | `OPENAI_API_KEY` | `openai` | No |
|
|
114
|
+
| OpenAI (ChatGPT subscription) | `OPENAI_OAUTH_TOKEN` | `openai-oauth` | No (subscription) |
|
|
115
|
+
| Anthropic | `ANTHROPIC_API_KEY` | `anthropic` | No |
|
|
116
|
+
|
|
117
|
+
Set `LLM_MODEL` to override the default model for your provider.
|
|
118
|
+
|
|
119
|
+
### Other features
|
|
120
|
+
|
|
121
|
+
- **BYOK** — Users can pass their own LLM API key per session for multi-tenant deployments
|
|
122
|
+
- **User interaction** — The agent can pause mid-run to ask for information (MFA codes, credentials)
|
|
123
|
+
- **SSE streaming** — Real-time step-by-step progress events
|
|
124
|
+
- **Content moderation** — Rejects harmful prompts before execution
|
|
125
|
+
- **SSRF protection** — Private network access blocked by default
|
|
126
|
+
|
|
127
|
+
## Bring your own agent
|
|
128
|
+
|
|
129
|
+
Don't want this agent? Use the [browserclaw](https://github.com/idan-rubin/browserclaw) library directly with any LLM.
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
npm install browserclaw
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Requires Chrome, Brave, Edge, or Chromium installed on your machine.
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
import { BrowserClaw } from "browserclaw";
|
|
139
|
+
|
|
140
|
+
const browser = await BrowserClaw.launch({ headless: false });
|
|
141
|
+
const page = await browser.open("https://example.com");
|
|
142
|
+
|
|
143
|
+
const { snapshot, refs } = await page.snapshot();
|
|
144
|
+
// snapshot: text tree of the page
|
|
145
|
+
// refs: { "e1": { role: "link", name: "More info" }, ... }
|
|
146
|
+
|
|
147
|
+
await page.click("e1");
|
|
148
|
+
await page.type("e3", "hello");
|
|
149
|
+
await browser.stop();
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
`snapshot()` returns a text representation of the page with numbered refs. Pass it to any LLM, get back a ref, call the action. Here's a minimal agent loop:
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
import { BrowserClaw } from "browserclaw";
|
|
156
|
+
import Anthropic from "@anthropic-ai/sdk";
|
|
157
|
+
|
|
158
|
+
const client = new Anthropic();
|
|
159
|
+
const browser = await BrowserClaw.launch({ headless: false });
|
|
160
|
+
const page = await browser.open("https://news.ycombinator.com");
|
|
161
|
+
const history = [];
|
|
162
|
+
|
|
163
|
+
for (let step = 0; step < 20; step++) {
|
|
164
|
+
const { snapshot } = await page.snapshot();
|
|
165
|
+
const response = await client.messages.create({
|
|
166
|
+
model: "claude-sonnet-4-20250514",
|
|
167
|
+
max_tokens: 1024,
|
|
168
|
+
system:
|
|
169
|
+
"You control a browser. Given a page snapshot, return JSON: { action, ref?, text?, url?, reasoning }. Actions: click, type, navigate, done.",
|
|
170
|
+
messages: [
|
|
171
|
+
...history,
|
|
172
|
+
{
|
|
173
|
+
role: "user",
|
|
174
|
+
content: `Task: Find the top 3 AI posts.\n\nPage:\n${snapshot}`,
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
const action = JSON.parse(response.content[0].text);
|
|
180
|
+
history.push(
|
|
181
|
+
{ role: "user", content: `Page:\n${snapshot}` },
|
|
182
|
+
{ role: "assistant", content: JSON.stringify(action) },
|
|
183
|
+
);
|
|
184
|
+
if (action.action === "done") break;
|
|
185
|
+
|
|
186
|
+
switch (action.action) {
|
|
187
|
+
case "click":
|
|
188
|
+
await page.click(action.ref);
|
|
189
|
+
break;
|
|
190
|
+
case "type":
|
|
191
|
+
await page.type(action.ref, action.text);
|
|
192
|
+
break;
|
|
193
|
+
case "navigate":
|
|
194
|
+
await page.goto(action.url);
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
await browser.stop();
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Swap Anthropic for OpenAI, Groq, Gemini, or a local model. See the full [browserclaw API docs](https://github.com/idan-rubin/browserclaw) for `fill()`, `select()`, `drag()`, `screenshot()`, `pdf()`, `waitFor()`, and more.
|
|
202
|
+
|
|
203
|
+
## Why browserclaw?
|
|
204
|
+
|
|
205
|
+
- **Built for TypeScript** — native to the JS ecosystem. First-class Node.js support, not a Python port.
|
|
206
|
+
- **Accessibility tree, not DOM** — snapshots use the browser's accessibility tree — the same structure screen readers use. Semantic roles, names, and states instead of raw tags and attributes. Cleaner, smaller, and more meaningful to an LLM.
|
|
207
|
+
- **Layered, not bundled** — the engine, the agent, and the LLM are separate, swappable pieces. See the [comparison above](#vs-browser-use).
|
|
208
|
+
- **Gets smarter with use** — the skill catalog learns from every successful run. Other browser agents start from scratch each time. browserclaw-agent builds a playbook per domain and improves it on every run.
|
|
209
|
+
- **Handles the real world** — Cloudflare Turnstile, press-and-hold anti-bot overlays, cookie banners, tab management — handled automatically via CDP. These are the things that make browser agents fail in production.
|
|
210
|
+
|
|
211
|
+
## Read more
|
|
212
|
+
|
|
213
|
+
- [The Intelligence Gap](https://mrrubin.substack.com/p/the-knowledge-gap-why-ai-browser) — why AI browser agents keep failing, and what we're doing about it
|
|
214
|
+
|
|
215
|
+
## Built with
|
|
216
|
+
|
|
217
|
+
- [BrowserClaw](https://github.com/idan-rubin/browserclaw) — the browser automation library
|
|
218
|
+
- [OpenClaw](https://github.com/openclaw/openclaw) — the community behind it
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AgentLoopResult } from './types.js';
|
|
2
|
+
interface AdvisorReview {
|
|
3
|
+
success: boolean;
|
|
4
|
+
reasoning: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function advisorReview(prompt: string, result: AgentLoopResult): Promise<AdvisorReview>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=advisor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advisor.d.ts","sourceRoot":"","sources":["../src/advisor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAGlD,UAAU,aAAa;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AA2CD,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,CAAC,CAanG"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { llmJson } from './llm.js';
|
|
2
2
|
import { logger } from './logger.js';
|
|
3
|
-
const
|
|
3
|
+
const ADVISOR_PROMPT = `You are a quality advisor for browser automation runs. You review the agent's completed trace and flag quality issues as advisory notes — you do NOT gate success.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Review for:
|
|
6
6
|
1. Did the agent's actions actually achieve the goal, or did it just claim success?
|
|
7
7
|
2. Is the answer grounded in data from actual page snapshots, or does it contain fabricated/hallucinated data?
|
|
8
8
|
3. Did the agent get blocked by a login wall, paywall, CAPTCHA, or error page and report success anyway?
|
|
@@ -12,11 +12,11 @@ Be initially doubtful of the agent's self-reported success. Check for:
|
|
|
12
12
|
Respond with JSON:
|
|
13
13
|
{
|
|
14
14
|
"success": true/false,
|
|
15
|
-
"reasoning": "
|
|
15
|
+
"reasoning": "one-paragraph quality note — what you'd tell a reviewer to check"
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
Set success=false
|
|
19
|
-
function
|
|
18
|
+
Set success=false when you'd want a human reviewer to double-check the answer. Callers treat this as advisory metadata, not a blocking verdict.`;
|
|
19
|
+
function buildAdvisorMessage(prompt, result) {
|
|
20
20
|
let message = `Task: ${prompt}\n`;
|
|
21
21
|
message += `Agent reported: ${result.success ? 'SUCCESS' : 'FAILURE'}\n`;
|
|
22
22
|
if (result.answer !== undefined) {
|
|
@@ -39,19 +39,19 @@ function buildJudgeMessage(prompt, result) {
|
|
|
39
39
|
}
|
|
40
40
|
return message;
|
|
41
41
|
}
|
|
42
|
-
export async function
|
|
42
|
+
export async function advisorReview(prompt, result) {
|
|
43
43
|
try {
|
|
44
|
-
const
|
|
45
|
-
system:
|
|
46
|
-
message:
|
|
44
|
+
const review = await llmJson({
|
|
45
|
+
system: ADVISOR_PROMPT,
|
|
46
|
+
message: buildAdvisorMessage(prompt, result),
|
|
47
47
|
maxTokens: 256,
|
|
48
48
|
});
|
|
49
|
-
logger.info({
|
|
50
|
-
return
|
|
49
|
+
logger.info({ advisor_ran: true, quality_ok: review.success }, 'Advisor review');
|
|
50
|
+
return review;
|
|
51
51
|
}
|
|
52
52
|
catch {
|
|
53
|
-
logger.warn({
|
|
54
|
-
return { success:
|
|
53
|
+
logger.warn({ advisor_failed: true }, 'Advisor review failed — treating run as clean');
|
|
54
|
+
return { success: true, reasoning: 'Advisor review unavailable' };
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
//# sourceMappingURL=
|
|
57
|
+
//# sourceMappingURL=advisor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advisor.js","sourceRoot":"","sources":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M,KAAK,EAAE,EAAE,CAAC;YAClE,IAAI,IAAI,iBAAiB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;QAClE,CAAC;QACD,OAAO,IAAI,GAAG,IAAI,IAAI,CAAC;IACzB,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,MAAc,EAAE,MAAuB;IACzE,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,OAAO,CAAgB;YAC1C,MAAM,EAAE,cAAc;YACtB,OAAO,EAAE,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC;YAC5C,SAAS,EAAE,GAAG;SACf,CAAC,CAAC;QACH,MAAM,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,OAAO,EAAE,EAAE,gBAAgB,CAAC,CAAC;QACjF,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,CAAC,IAAI,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,EAAE,+CAA+C,CAAC,CAAC;QACvF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,4BAA4B,EAAE,CAAC;IACpE,CAAC;AACH,CAAC"}
|
package/dist/agent-loop.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export interface AgentLoopOptions {
|
|
|
45
45
|
} | undefined>>;
|
|
46
46
|
buildTask?: (prompt: string) => string | Promise<string>;
|
|
47
47
|
getLesson?: (prompt: string) => Promise<TaskLesson | null>;
|
|
48
|
+
getSkill?: (domain: string) => Promise<CatalogSkill | null>;
|
|
48
49
|
config?: Partial<AgentConfig>;
|
|
49
50
|
}
|
|
50
51
|
export interface UserChatHooks {
|
|
@@ -53,5 +54,5 @@ export interface UserChatHooks {
|
|
|
53
54
|
/** Per-session random token used to wrap user-interjection content so the LLM can't confuse user data for system instructions. */
|
|
54
55
|
nonce: string;
|
|
55
56
|
}
|
|
56
|
-
export declare function runAgentLoop(prompt: string, pageOrHolder: CrawlPage | PageHolder, emit: (event: string, data: unknown) => void, signal: AbortSignal, waitForUser?: () => Promise<string>, browser?: BrowserClaw,
|
|
57
|
+
export declare function runAgentLoop(prompt: string, pageOrHolder: CrawlPage | PageHolder, emit: (event: string, data: unknown) => void, signal: AbortSignal, waitForUser?: () => Promise<string>, browser?: BrowserClaw, initialDomainSkill?: CatalogSkill | null, maxSteps?: number, userChat?: UserChatHooks, options?: AgentLoopOptions): Promise<AgentLoopResult>;
|
|
57
58
|
//# sourceMappingURL=agent-loop.d.ts.map
|
package/dist/agent-loop.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-loop.d.ts","sourceRoot":"","sources":["../src/agent-loop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"agent-loop.d.ts","sourceRoot":"","sources":["../src/agent-loop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAa1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAG9C,OAAO,KAAK,EAAE,WAAW,EAAa,eAAe,EAAiB,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACnH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAY/C;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,WAAW,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAiC5F;AA+qBD,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAsB1D;AAMD,wBAAgB,8BAA8B,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAI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