zan-browser 1.3.28 → 1.3.30
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/dist/ai.d.ts +11 -4
- package/dist/ai.d.ts.map +1 -1
- package/dist/ai.js +177 -104
- package/dist/ai.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/observer.d.ts +1 -1
- package/dist/observer.d.ts.map +1 -1
- package/dist/observer.js +257 -143
- package/dist/observer.js.map +1 -1
- package/dist/session.d.ts +6 -2
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +111 -43
- package/dist/session.js.map +1 -1
- package/dist/types.d.ts +32 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/ai.d.ts
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
|
-
import type { ObserveResult,
|
|
1
|
+
import type { ObserveResult, AgentCompletion, SeedValue, PageLink } from "./types";
|
|
2
2
|
export declare class AIClient {
|
|
3
3
|
private client;
|
|
4
4
|
private model;
|
|
5
5
|
constructor(apiKey: string, model?: string);
|
|
6
|
-
decideFromObservation(goal: string, observation: ObserveResult,
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
decideFromObservation(goal: string, observation: ObserveResult, trajectory: Array<{
|
|
7
|
+
role: "assistant" | "user";
|
|
8
|
+
content: string;
|
|
9
|
+
}>, step: number, maxSteps: number, seedValues?: SeedValue[]): Promise<AgentCompletion>;
|
|
10
|
+
decideFromScreenshot(goal: string, screenshotBase64: string, trajectory: Array<{
|
|
11
|
+
role: "assistant" | "user";
|
|
12
|
+
content: string;
|
|
13
|
+
}>, step: number, maxSteps: number, seedValues?: SeedValue[]): Promise<AgentCompletion>;
|
|
14
|
+
scrapePageContent(goal: string, pageContent: string, seedValues?: SeedValue[], availableLinks?: PageLink[]): Promise<{
|
|
9
15
|
found: boolean;
|
|
10
16
|
data: Record<string, unknown> | null;
|
|
11
17
|
nextUrl: string | null;
|
|
12
18
|
reasoning: string;
|
|
13
19
|
}>;
|
|
20
|
+
private parseCompletion;
|
|
14
21
|
private parseAction;
|
|
15
22
|
}
|
|
16
23
|
//# sourceMappingURL=ai.d.ts.map
|
package/dist/ai.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../src/ai.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../src/ai.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAe,eAAe,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAyDhG,qBAAa,QAAQ;IACnB,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,KAAK,CAAS;gBAEV,MAAM,EAAE,MAAM,EAAE,KAAK,SAAgB;IAM3C,qBAAqB,CACzB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,aAAa,EAC1B,UAAU,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,WAAW,GAAG,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,EAClE,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,SAAS,EAAE,GACvB,OAAO,CAAC,eAAe,CAAC;IAgDrB,oBAAoB,CACxB,IAAI,EAAE,MAAM,EACZ,gBAAgB,EAAE,MAAM,EACxB,UAAU,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,WAAW,GAAG,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,EAClE,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,SAAS,EAAE,GACvB,OAAO,CAAC,eAAe,CAAC;IAkDrB,iBAAiB,CACrB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,SAAS,EAAE,EACxB,cAAc,CAAC,EAAE,QAAQ,EAAE,GAC1B,OAAO,CAAC;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;QAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAiD/G,OAAO,CAAC,eAAe;IA+BvB,OAAO,CAAC,WAAW;CAqCpB"}
|
package/dist/ai.js
CHANGED
|
@@ -6,8 +6,58 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.AIClient = void 0;
|
|
7
7
|
const sdk_1 = __importDefault(require("@anthropic-ai/sdk"));
|
|
8
8
|
const DEFAULT_MODEL = "claude-sonnet-4-6";
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const SYSTEM_PROMPT = `You are a precise browser automation agent that interacts with websites through structured commands.
|
|
10
|
+
Your role is to:
|
|
11
|
+
1. Analyze the provided webpage elements and structure
|
|
12
|
+
2. Plan actions to accomplish the given task
|
|
13
|
+
3. Respond with valid JSON containing your action and state assessment
|
|
14
|
+
|
|
15
|
+
INPUT STRUCTURE:
|
|
16
|
+
Elements use this format:
|
|
17
|
+
id[:]<element_type attr1="val" attr2="val">text</element_type>
|
|
18
|
+
_[:] Non-interactive text context
|
|
19
|
+
|
|
20
|
+
IDs: B=button, L=link, I=input, S=select, O=option, F=image, M=misc
|
|
21
|
+
|
|
22
|
+
CRITICAL: Never use an ID that is not explicitly shown in the current elements.
|
|
23
|
+
CRITICAL: Never invent URLs. Only use hrefs from the elements list.
|
|
24
|
+
|
|
25
|
+
RESPONSE FORMAT:
|
|
26
|
+
You must ALWAYS respond with valid JSON in this exact format (no markdown, no backticks):
|
|
27
|
+
{
|
|
28
|
+
"state": {
|
|
29
|
+
"previous_goal_status": "success" | "failure" | "unknown",
|
|
30
|
+
"previous_goal_eval": "evaluation of whether the previous action achieved its goal",
|
|
31
|
+
"page_summary": "brief description of the current page",
|
|
32
|
+
"relevant_interactions": [{"id": "B1", "reason": "why this element matters"}],
|
|
33
|
+
"memory": "important information to remember across steps",
|
|
34
|
+
"next_goal": "what you plan to do next"
|
|
35
|
+
},
|
|
36
|
+
"action": { ... one of the actions below ... }
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
ACTIONS (choose exactly one):
|
|
40
|
+
- goto: {"type": "goto", "url": "https://...", "reason": "why"} — navigate to URL (ONLY from element hrefs)
|
|
41
|
+
- click: {"type": "click", "elementId": "B1", "reason": "why"}
|
|
42
|
+
- fill: {"type": "fill", "elementId": "I1", "value": "text", "reason": "why"}
|
|
43
|
+
- press_key: {"type": "press_key", "key": "Enter", "reason": "why"}
|
|
44
|
+
- scroll_down: {"type": "scroll", "direction": "down", "reason": "why"}
|
|
45
|
+
- scroll_up: {"type": "scroll", "direction": "up", "reason": "why"}
|
|
46
|
+
- scrape: {"type": "scrape", "reason": "why"} — data is visible on page, extract it
|
|
47
|
+
- done: {"type": "done", "reason": "why", "data": {}} — task complete, return extracted data
|
|
48
|
+
- impossible: {"type": "impossible", "reason": "why this cannot be done"}
|
|
49
|
+
|
|
50
|
+
NAVIGATION & ERROR HANDLING:
|
|
51
|
+
- If no suitable elements exist, use scroll or goto to find them
|
|
52
|
+
- If stuck, try alternative approaches
|
|
53
|
+
- Handle popups/cookies by accepting or closing them
|
|
54
|
+
- Use scroll to find elements you are looking for
|
|
55
|
+
|
|
56
|
+
TASK COMPLETION:
|
|
57
|
+
- Use done action as soon as the task is complete
|
|
58
|
+
- Include all relevant data in the done action
|
|
59
|
+
- If running out of steps, speed up and use done
|
|
60
|
+
- relevant_interactions should have at most 3 items`;
|
|
11
61
|
class AIClient {
|
|
12
62
|
client;
|
|
13
63
|
model;
|
|
@@ -15,116 +65,104 @@ class AIClient {
|
|
|
15
65
|
this.client = new sdk_1.default({ apiKey });
|
|
16
66
|
this.model = model;
|
|
17
67
|
}
|
|
18
|
-
// Decide the next action given the observed DOM state
|
|
19
|
-
async decideFromObservation(goal, observation,
|
|
20
|
-
const historyText = history.length > 0
|
|
21
|
-
? `\nPREVIOUS STEPS:\n${history.slice(-5).join("\n")}`
|
|
22
|
-
: "";
|
|
68
|
+
// Decide the next action given the observed DOM state — Notte-style prompt
|
|
69
|
+
async decideFromObservation(goal, observation, trajectory, step, maxSteps, seedValues) {
|
|
23
70
|
const seedContext = seedValues && seedValues.length > 0
|
|
24
71
|
? `\nINPUT VALUES TO USE:\n${seedValues.map(s => `- ${s.paramName} (${s.description}): use "${s.exampleValue}" when filling any relevant input field`).join("\n")}`
|
|
25
72
|
: "";
|
|
26
|
-
const
|
|
27
|
-
|
|
73
|
+
const userMessage = `<WEBSITE_CONTENT_BEGIN>
|
|
74
|
+
* Current url: ${observation.currentUrl}
|
|
75
|
+
* Current page title: ${observation.pageTitle}
|
|
76
|
+
* Current step: ${step}/${maxSteps}
|
|
28
77
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
CURRENT PAGE STATE:
|
|
78
|
+
[Interaction elements and context]
|
|
79
|
+
[Start of page]
|
|
33
80
|
${observation.text}
|
|
81
|
+
[End of page]
|
|
82
|
+
<WEBSITE_CONTENT_END>
|
|
34
83
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
{
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"amount": 300 (optional for scroll, pixels),
|
|
51
|
-
"ms": 1000 (required for wait),
|
|
52
|
-
"url": "https://..." (required for navigate — use when the current page clearly doesn't have the data and a more specific URL would),
|
|
53
|
-
"reason": "why this action"
|
|
54
|
-
}`;
|
|
84
|
+
Given the previous information, start by reflecting on your last action. Then, summarize the current page and list immediately relevant available interactions (max of 3).
|
|
85
|
+
Absolutely do not under any circumstance use any id that is not explicitly found in the page.
|
|
86
|
+
From there, select your next goal, and in turn, your next action.`;
|
|
87
|
+
// Build messages: task first, then trajectory history (last 8), then current observation
|
|
88
|
+
const messages = [
|
|
89
|
+
{ role: "user", content: `TASK: ${goal}${seedContext}` },
|
|
90
|
+
{ role: "assistant", content: `I'll help you accomplish this task. Let me analyze the page and take the appropriate actions.` },
|
|
91
|
+
];
|
|
92
|
+
// Add trajectory history (last 8 steps)
|
|
93
|
+
const recentTrajectory = trajectory.slice(-16); // 8 pairs = 16 entries
|
|
94
|
+
for (const entry of recentTrajectory) {
|
|
95
|
+
messages.push({ role: entry.role, content: entry.content });
|
|
96
|
+
}
|
|
97
|
+
// Current observation
|
|
98
|
+
messages.push({ role: "user", content: userMessage });
|
|
55
99
|
const response = await this.client.messages.create({
|
|
56
100
|
model: this.model,
|
|
57
|
-
max_tokens:
|
|
58
|
-
|
|
101
|
+
max_tokens: 1024,
|
|
102
|
+
system: SYSTEM_PROMPT,
|
|
103
|
+
messages,
|
|
59
104
|
});
|
|
60
105
|
const text = response.content[0].type === "text" ? response.content[0].text : "";
|
|
61
|
-
return this.
|
|
106
|
+
return this.parseCompletion(text);
|
|
62
107
|
}
|
|
63
|
-
async decideFromScreenshot(goal, screenshotBase64,
|
|
64
|
-
const historyText = history.length > 0
|
|
65
|
-
? `\nPREVIOUS STEPS:\n${history.slice(-3).join("\n")}`
|
|
66
|
-
: "";
|
|
108
|
+
async decideFromScreenshot(goal, screenshotBase64, trajectory, step, maxSteps, seedValues) {
|
|
67
109
|
const seedContext = seedValues && seedValues.length > 0
|
|
68
110
|
? `\nINPUT VALUES TO USE:\n${seedValues.map(s => `- ${s.paramName} (${s.description}): use "${s.exampleValue}" when filling any relevant input field`).join("\n")}`
|
|
69
111
|
: "";
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
Decide the SINGLE next action.
|
|
73
|
-
|
|
74
|
-
GOAL: ${goal}
|
|
75
|
-
${historyText}${seedContext}
|
|
112
|
+
const userMessage = `The DOM observer couldn't identify enough elements — you're seeing a screenshot instead.
|
|
113
|
+
Current step: ${step}/${maxSteps}
|
|
76
114
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
"reason": "why"
|
|
90
|
-
}`;
|
|
91
|
-
const response = await this.client.messages.create({
|
|
92
|
-
model: this.model,
|
|
93
|
-
max_tokens: 256,
|
|
94
|
-
messages: [
|
|
115
|
+
Decide the SINGLE next action. Use the same JSON response format.`;
|
|
116
|
+
const messages = [
|
|
117
|
+
{ role: "user", content: `TASK: ${goal}${seedContext}` },
|
|
118
|
+
{ role: "assistant", content: `I'll help you accomplish this task. Let me analyze the page and take the appropriate actions.` },
|
|
119
|
+
];
|
|
120
|
+
const recentTrajectory = trajectory.slice(-8);
|
|
121
|
+
for (const entry of recentTrajectory) {
|
|
122
|
+
messages.push({ role: entry.role, content: entry.content });
|
|
123
|
+
}
|
|
124
|
+
messages.push({
|
|
125
|
+
role: "user",
|
|
126
|
+
content: [
|
|
95
127
|
{
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
media_type: "image/jpeg",
|
|
103
|
-
data: screenshotBase64,
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
{ type: "text", text: prompt },
|
|
107
|
-
],
|
|
128
|
+
type: "image",
|
|
129
|
+
source: {
|
|
130
|
+
type: "base64",
|
|
131
|
+
media_type: "image/jpeg",
|
|
132
|
+
data: screenshotBase64,
|
|
133
|
+
},
|
|
108
134
|
},
|
|
135
|
+
{ type: "text", text: userMessage },
|
|
109
136
|
],
|
|
110
137
|
});
|
|
138
|
+
const response = await this.client.messages.create({
|
|
139
|
+
model: this.model,
|
|
140
|
+
max_tokens: 1024,
|
|
141
|
+
system: SYSTEM_PROMPT,
|
|
142
|
+
messages,
|
|
143
|
+
});
|
|
111
144
|
const text = response.content[0].type === "text" ? response.content[0].text : "";
|
|
112
|
-
return this.
|
|
145
|
+
return this.parseCompletion(text);
|
|
113
146
|
}
|
|
114
147
|
// ─── Intelligent content scrape — Notte-style page understanding ─────────────
|
|
115
|
-
|
|
116
|
-
// Returns structured data if found on the page, or the next URL to follow.
|
|
117
|
-
async scrapePageContent(goal, pageContent, seedValues) {
|
|
148
|
+
async scrapePageContent(goal, pageContent, seedValues, availableLinks) {
|
|
118
149
|
const seedContext = seedValues && seedValues.length > 0
|
|
119
150
|
? `\nCONCRETE EXAMPLE INPUTS:\n${seedValues.map((s) => `- ${s.paramName}: "${s.exampleValue}"`).join("\n")}`
|
|
120
151
|
: "";
|
|
152
|
+
const linksSection = availableLinks && availableLinks.length > 0
|
|
153
|
+
? `\nAVAILABLE LINKS ON THIS PAGE:\n${availableLinks.map((l, i) => `[${i}] ${l.text} → ${l.href}`).join("\n")}`
|
|
154
|
+
: "";
|
|
155
|
+
const linkInstruction = availableLinks && availableLinks.length > 0
|
|
156
|
+
? "IMPORTANT: Only return a nextUrl that exists in the AVAILABLE LINKS list above — do NOT invent or guess URLs."
|
|
157
|
+
: "If no, look for links or navigation that would lead to the data and return the most relevant URL to visit next.";
|
|
121
158
|
const prompt = `The user wants: ${goal}${seedContext}
|
|
122
159
|
|
|
123
160
|
Here is the visible content of a web page:
|
|
124
161
|
${pageContent}
|
|
162
|
+
${linksSection}
|
|
125
163
|
|
|
126
164
|
Does this page contain the data the user is looking for? If yes, extract it as structured JSON.
|
|
127
|
-
|
|
165
|
+
${linkInstruction}
|
|
128
166
|
|
|
129
167
|
Respond with JSON only (no markdown):
|
|
130
168
|
{
|
|
@@ -134,7 +172,7 @@ Respond with JSON only (no markdown):
|
|
|
134
172
|
"reasoning": "brief explanation"
|
|
135
173
|
}`;
|
|
136
174
|
const response = await this.client.messages.create({
|
|
137
|
-
model: "claude-sonnet-4-6",
|
|
175
|
+
model: "claude-sonnet-4-6",
|
|
138
176
|
max_tokens: 2000,
|
|
139
177
|
messages: [{ role: "user", content: prompt }],
|
|
140
178
|
});
|
|
@@ -148,33 +186,68 @@ Respond with JSON only (no markdown):
|
|
|
148
186
|
}
|
|
149
187
|
}
|
|
150
188
|
// ─── Private ─────────────────────────────────────────────────────────────────
|
|
151
|
-
|
|
189
|
+
parseCompletion(raw) {
|
|
152
190
|
try {
|
|
153
191
|
const cleaned = raw.replace(/```json\n?/g, "").replace(/```\n?/g, "").trim();
|
|
154
192
|
const parsed = JSON.parse(cleaned);
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
return { type: "navigate", url: parsed.url ?? "", reason: parsed.reason ?? "" };
|
|
166
|
-
case "screenshot":
|
|
167
|
-
return { type: "screenshot", reason: parsed.reason ?? "need visual confirmation" };
|
|
168
|
-
case "done":
|
|
169
|
-
return { type: "done", reason: parsed.reason ?? "" };
|
|
170
|
-
case "impossible":
|
|
171
|
-
return { type: "impossible", reason: parsed.reason ?? "could not achieve goal" };
|
|
172
|
-
default:
|
|
173
|
-
return { type: "impossible", reason: `unknown action type: ${parsed.type}` };
|
|
174
|
-
}
|
|
193
|
+
const state = parsed.state ?? {
|
|
194
|
+
previous_goal_status: "unknown",
|
|
195
|
+
previous_goal_eval: "",
|
|
196
|
+
page_summary: "",
|
|
197
|
+
relevant_interactions: [],
|
|
198
|
+
memory: "",
|
|
199
|
+
next_goal: "",
|
|
200
|
+
};
|
|
201
|
+
const action = this.parseAction(parsed.action ?? parsed);
|
|
202
|
+
return { state, action };
|
|
175
203
|
}
|
|
176
204
|
catch {
|
|
177
|
-
return {
|
|
205
|
+
return {
|
|
206
|
+
state: {
|
|
207
|
+
previous_goal_status: "unknown",
|
|
208
|
+
previous_goal_eval: "failed to parse response",
|
|
209
|
+
page_summary: "",
|
|
210
|
+
relevant_interactions: [],
|
|
211
|
+
memory: "",
|
|
212
|
+
next_goal: "",
|
|
213
|
+
},
|
|
214
|
+
action: { type: "impossible", reason: `failed to parse AI response: ${raw.slice(0, 100)}` },
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
parseAction(parsed) {
|
|
219
|
+
if (!parsed || typeof parsed !== "object") {
|
|
220
|
+
return { type: "impossible", reason: "invalid action object" };
|
|
221
|
+
}
|
|
222
|
+
const type = parsed.type;
|
|
223
|
+
const reason = parsed.reason ?? "";
|
|
224
|
+
switch (type) {
|
|
225
|
+
case "click":
|
|
226
|
+
return { type: "click", elementId: (parsed.elementId ?? parsed.id ?? ""), reason };
|
|
227
|
+
case "fill":
|
|
228
|
+
return { type: "fill", elementId: (parsed.elementId ?? parsed.id ?? ""), value: (parsed.value ?? ""), reason };
|
|
229
|
+
case "scroll":
|
|
230
|
+
case "scroll_down":
|
|
231
|
+
return { type: "scroll", direction: parsed.direction ?? "down", amount: parsed.amount, reason };
|
|
232
|
+
case "scroll_up":
|
|
233
|
+
return { type: "scroll", direction: "up", reason };
|
|
234
|
+
case "wait":
|
|
235
|
+
return { type: "wait", ms: parsed.ms ?? 1000, reason };
|
|
236
|
+
case "goto":
|
|
237
|
+
case "navigate":
|
|
238
|
+
return { type: "navigate", url: (parsed.url ?? ""), reason };
|
|
239
|
+
case "press_key":
|
|
240
|
+
return { type: "press_key", key: (parsed.key ?? ""), reason };
|
|
241
|
+
case "scrape":
|
|
242
|
+
return { type: "scrape", reason };
|
|
243
|
+
case "screenshot":
|
|
244
|
+
return { type: "screenshot", reason: reason || "need visual confirmation" };
|
|
245
|
+
case "done":
|
|
246
|
+
return { type: "done", reason, data: parsed.data };
|
|
247
|
+
case "impossible":
|
|
248
|
+
return { type: "impossible", reason: reason || "could not achieve goal" };
|
|
249
|
+
default:
|
|
250
|
+
return { type: "impossible", reason: `unknown action type: ${type}` };
|
|
178
251
|
}
|
|
179
252
|
}
|
|
180
253
|
}
|
package/dist/ai.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai.js","sourceRoot":"","sources":["../src/ai.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA0C;AAG1C,MAAM,aAAa,GAAG,mBAAmB,CAAC;AAE1C,
|
|
1
|
+
{"version":3,"file":"ai.js","sourceRoot":"","sources":["../src/ai.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA0C;AAG1C,MAAM,aAAa,GAAG,mBAAmB,CAAC;AAE1C,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oDAmD8B,CAAC;AAErD,MAAa,QAAQ;IACX,MAAM,CAAY;IAClB,KAAK,CAAS;IAEtB,YAAY,MAAc,EAAE,KAAK,GAAG,aAAa;QAC/C,IAAI,CAAC,MAAM,GAAG,IAAI,aAAS,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;QACxC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,2EAA2E;IAC3E,KAAK,CAAC,qBAAqB,CACzB,IAAY,EACZ,WAA0B,EAC1B,UAAkE,EAClE,IAAY,EACZ,QAAgB,EAChB,UAAwB;QAExB,MAAM,WAAW,GACf,UAAU,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC;YACjC,CAAC,CAAC,2BAA2B,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,WAAW,WAAW,CAAC,CAAC,YAAY,yCAAyC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YACnK,CAAC,CAAC,EAAE,CAAC;QAET,MAAM,WAAW,GAAG;iBACP,WAAW,CAAC,UAAU;wBACf,WAAW,CAAC,SAAS;kBAC3B,IAAI,IAAI,QAAQ;;;;EAIhC,WAAW,CAAC,IAAI;;;;;;kEAM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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { RensanBrowser } from "./browser";
|
|
2
2
|
export { Session } from "./session";
|
|
3
|
-
export type { ObservedElement, ObserveResult, CapturedRequest, SeedValue, AgentAction, ActResult, FindDataResult, SessionConfig, AIConfig, BrowserConfig, Screenshot, ElementType, } from "./types";
|
|
3
|
+
export type { ObservedElement, ObserveResult, CapturedRequest, SeedValue, PageLink, AgentAction, AgentState, AgentCompletion, RelevantInteraction, ActResult, FindDataResult, SessionConfig, AIConfig, BrowserConfig, Screenshot, ElementType, } from "./types";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EACV,eAAe,EACf,aAAa,EACb,eAAe,EACf,SAAS,EACT,WAAW,EACX,SAAS,EACT,cAAc,EACd,aAAa,EACb,QAAQ,EACR,aAAa,EACb,UAAU,EACV,WAAW,GACZ,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EACV,eAAe,EACf,aAAa,EACb,eAAe,EACf,SAAS,EACT,QAAQ,EACR,WAAW,EACX,UAAU,EACV,eAAe,EACf,mBAAmB,EACnB,SAAS,EACT,cAAc,EACd,aAAa,EACb,QAAQ,EACR,aAAa,EACb,UAAU,EACV,WAAW,GACZ,MAAM,SAAS,CAAC"}
|
package/dist/observer.d.ts
CHANGED
package/dist/observer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observer.d.ts","sourceRoot":"","sources":["../src/observer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAmB,aAAa,EAAe,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"observer.d.ts","sourceRoot":"","sources":["../src/observer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAmB,aAAa,EAAe,MAAM,SAAS,CAAC;AAmD3E,qBAAa,QAAQ;IACnB,OAAO,CAAC,IAAI,CAAO;gBAEP,IAAI,EAAE,IAAI;IAIhB,OAAO,IAAI,OAAO,CAAC,aAAa,CAAC;IAySjC,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IA0B5E,OAAO,CAAC,WAAW;IAgBnB,OAAO,CAAC,iBAAiB;CAoB1B"}
|