@oya-ai/browser 1.0.99 → 1.0.102
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/index.cjs +6 -3
- package/dist/index.d.cts +38 -5
- package/dist/index.d.ts +38 -5
- package/dist/index.js +6 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -258,9 +258,12 @@ var Browser = class {
|
|
|
258
258
|
await this.command("navigate", { url }, NAVIGATE_TIMEOUT_MS);
|
|
259
259
|
if (this.autoCaptcha) assertCaptchaCleared(await this.solveCaptcha());
|
|
260
260
|
}
|
|
261
|
-
/**
|
|
262
|
-
|
|
263
|
-
|
|
261
|
+
/**
|
|
262
|
+
* The page, written as markdown (the default), TOON or JSONL, plus its blocks and
|
|
263
|
+
* the numbered elements to act on.
|
|
264
|
+
*/
|
|
265
|
+
async analyze(options = {}) {
|
|
266
|
+
return this.command("analyze", options.format ? { format: options.format } : {});
|
|
264
267
|
}
|
|
265
268
|
/** Only the visible elements, which is what an agent almost always wants. */
|
|
266
269
|
async elements() {
|
package/dist/index.d.cts
CHANGED
|
@@ -96,10 +96,40 @@ interface Element {
|
|
|
96
96
|
/** Action of the enclosing form. */
|
|
97
97
|
formName?: string;
|
|
98
98
|
}
|
|
99
|
+
/** How `analyze()` writes the page: markdown (the default) or toon (toonformat.dev). */
|
|
100
|
+
type PageFormat = 'markdown' | 'toon' | 'jsonl';
|
|
101
|
+
/** What `analyze()` accepts. */
|
|
102
|
+
interface AnalyzeOptions {
|
|
103
|
+
/** How the page is written: markdown (the default) or toon. */
|
|
104
|
+
format?: PageFormat;
|
|
105
|
+
}
|
|
106
|
+
/** One block of a page, in reading order: a heading, paragraph, list item, table row, image or element. */
|
|
107
|
+
interface Block {
|
|
108
|
+
/** The element's id, for interactive elements; act on it with click and type. */
|
|
109
|
+
id?: number;
|
|
110
|
+
/** The part of the page it is in: nav, main, form/…, dialog, or empty. */
|
|
111
|
+
region: string;
|
|
112
|
+
/** What it is: h1-h6, text, item, row, header, quote, code, image, or an element kind (link, button, input:email…). */
|
|
113
|
+
kind: string;
|
|
114
|
+
/** Its text, or an element's name. */
|
|
115
|
+
text?: string;
|
|
116
|
+
/** Where a link goes, or what a field holds now. */
|
|
117
|
+
target?: string;
|
|
118
|
+
/** An element's state: checked, disabled, required, off-screen, hint… */
|
|
119
|
+
state?: string;
|
|
120
|
+
}
|
|
99
121
|
/** The page as `analyze()` sees it. */
|
|
100
122
|
interface Analysis {
|
|
101
|
-
/** The page
|
|
102
|
-
|
|
123
|
+
/** The format `page` is written in. */
|
|
124
|
+
format?: PageFormat;
|
|
125
|
+
/** The page, written in `format`. */
|
|
126
|
+
page?: string;
|
|
127
|
+
/** The page as markdown; present when the format is markdown (the default). */
|
|
128
|
+
markdown?: string;
|
|
129
|
+
/** The page's facts: url, title, scroll, and when they apply panelScroll, modal, covered, truncated. */
|
|
130
|
+
facts?: Record<string, string | number>;
|
|
131
|
+
/** The page as data: every block in reading order, whatever the format. */
|
|
132
|
+
blocks?: Block[];
|
|
103
133
|
/** Every numbered element, visible or not. */
|
|
104
134
|
elements: Element[];
|
|
105
135
|
/** The window size, in CSS pixels. */
|
|
@@ -1077,8 +1107,11 @@ declare class Browser {
|
|
|
1077
1107
|
private command;
|
|
1078
1108
|
/** Navigates, then clears any CAPTCHA when `captcha: 'auto'` was asked for. */
|
|
1079
1109
|
goto(url: string): Promise<void>;
|
|
1080
|
-
/**
|
|
1081
|
-
|
|
1110
|
+
/**
|
|
1111
|
+
* The page, written as markdown (the default), TOON or JSONL, plus its blocks and
|
|
1112
|
+
* the numbered elements to act on.
|
|
1113
|
+
*/
|
|
1114
|
+
analyze(options?: AnalyzeOptions): Promise<Analysis>;
|
|
1082
1115
|
/** Only the visible elements, which is what an agent almost always wants. */
|
|
1083
1116
|
elements(): Promise<Element[]>;
|
|
1084
1117
|
/** Clicks an element by its id from `analyze()`. */
|
|
@@ -1319,4 +1352,4 @@ declare class Oya {
|
|
|
1319
1352
|
private waitUntilConnected;
|
|
1320
1353
|
}
|
|
1321
1354
|
|
|
1322
|
-
export { type Activity, type Analysis, type AttentionRequest, Browser, type BrowserDetail, type BrowserInfo, type CaptchaResult, type CaptchaSolver, type Config, type ConfigUpdate, type ControlCredential, type ControlEvent, type ControlOverview, type ControlRole, type ControlSession, type Element, type FileValue, type Fingerprint, type Health, type HumanInputAction, type LlmProvider, MAX_FILE_BYTES, type MfaConfig, type MfaResult, Oya, OyaError, type OyaOptions, type PersonaInfo, type PersonaPrefs, type PlayResult, type Playbook, type PlaybookSummary, type ProjectSettings, type Provider, type ProxyCreate, type ProxyInfo, Run, type RunData, type RunInfo, type RunResult, type SiteCredentials, type StartOptions, type StartResult, type StopResult, type SubmitOptions, Oya as default, file };
|
|
1355
|
+
export { type Activity, type Analysis, type AnalyzeOptions, type AttentionRequest, type Block, Browser, type BrowserDetail, type BrowserInfo, type CaptchaResult, type CaptchaSolver, type Config, type ConfigUpdate, type ControlCredential, type ControlEvent, type ControlOverview, type ControlRole, type ControlSession, type Element, type FileValue, type Fingerprint, type Health, type HumanInputAction, type LlmProvider, MAX_FILE_BYTES, type MfaConfig, type MfaResult, Oya, OyaError, type OyaOptions, type PageFormat, type PersonaInfo, type PersonaPrefs, type PlayResult, type Playbook, type PlaybookSummary, type ProjectSettings, type Provider, type ProxyCreate, type ProxyInfo, Run, type RunData, type RunInfo, type RunResult, type SiteCredentials, type StartOptions, type StartResult, type StopResult, type SubmitOptions, Oya as default, file };
|
package/dist/index.d.ts
CHANGED
|
@@ -96,10 +96,40 @@ interface Element {
|
|
|
96
96
|
/** Action of the enclosing form. */
|
|
97
97
|
formName?: string;
|
|
98
98
|
}
|
|
99
|
+
/** How `analyze()` writes the page: markdown (the default) or toon (toonformat.dev). */
|
|
100
|
+
type PageFormat = 'markdown' | 'toon' | 'jsonl';
|
|
101
|
+
/** What `analyze()` accepts. */
|
|
102
|
+
interface AnalyzeOptions {
|
|
103
|
+
/** How the page is written: markdown (the default) or toon. */
|
|
104
|
+
format?: PageFormat;
|
|
105
|
+
}
|
|
106
|
+
/** One block of a page, in reading order: a heading, paragraph, list item, table row, image or element. */
|
|
107
|
+
interface Block {
|
|
108
|
+
/** The element's id, for interactive elements; act on it with click and type. */
|
|
109
|
+
id?: number;
|
|
110
|
+
/** The part of the page it is in: nav, main, form/…, dialog, or empty. */
|
|
111
|
+
region: string;
|
|
112
|
+
/** What it is: h1-h6, text, item, row, header, quote, code, image, or an element kind (link, button, input:email…). */
|
|
113
|
+
kind: string;
|
|
114
|
+
/** Its text, or an element's name. */
|
|
115
|
+
text?: string;
|
|
116
|
+
/** Where a link goes, or what a field holds now. */
|
|
117
|
+
target?: string;
|
|
118
|
+
/** An element's state: checked, disabled, required, off-screen, hint… */
|
|
119
|
+
state?: string;
|
|
120
|
+
}
|
|
99
121
|
/** The page as `analyze()` sees it. */
|
|
100
122
|
interface Analysis {
|
|
101
|
-
/** The page
|
|
102
|
-
|
|
123
|
+
/** The format `page` is written in. */
|
|
124
|
+
format?: PageFormat;
|
|
125
|
+
/** The page, written in `format`. */
|
|
126
|
+
page?: string;
|
|
127
|
+
/** The page as markdown; present when the format is markdown (the default). */
|
|
128
|
+
markdown?: string;
|
|
129
|
+
/** The page's facts: url, title, scroll, and when they apply panelScroll, modal, covered, truncated. */
|
|
130
|
+
facts?: Record<string, string | number>;
|
|
131
|
+
/** The page as data: every block in reading order, whatever the format. */
|
|
132
|
+
blocks?: Block[];
|
|
103
133
|
/** Every numbered element, visible or not. */
|
|
104
134
|
elements: Element[];
|
|
105
135
|
/** The window size, in CSS pixels. */
|
|
@@ -1077,8 +1107,11 @@ declare class Browser {
|
|
|
1077
1107
|
private command;
|
|
1078
1108
|
/** Navigates, then clears any CAPTCHA when `captcha: 'auto'` was asked for. */
|
|
1079
1109
|
goto(url: string): Promise<void>;
|
|
1080
|
-
/**
|
|
1081
|
-
|
|
1110
|
+
/**
|
|
1111
|
+
* The page, written as markdown (the default), TOON or JSONL, plus its blocks and
|
|
1112
|
+
* the numbered elements to act on.
|
|
1113
|
+
*/
|
|
1114
|
+
analyze(options?: AnalyzeOptions): Promise<Analysis>;
|
|
1082
1115
|
/** Only the visible elements, which is what an agent almost always wants. */
|
|
1083
1116
|
elements(): Promise<Element[]>;
|
|
1084
1117
|
/** Clicks an element by its id from `analyze()`. */
|
|
@@ -1319,4 +1352,4 @@ declare class Oya {
|
|
|
1319
1352
|
private waitUntilConnected;
|
|
1320
1353
|
}
|
|
1321
1354
|
|
|
1322
|
-
export { type Activity, type Analysis, type AttentionRequest, Browser, type BrowserDetail, type BrowserInfo, type CaptchaResult, type CaptchaSolver, type Config, type ConfigUpdate, type ControlCredential, type ControlEvent, type ControlOverview, type ControlRole, type ControlSession, type Element, type FileValue, type Fingerprint, type Health, type HumanInputAction, type LlmProvider, MAX_FILE_BYTES, type MfaConfig, type MfaResult, Oya, OyaError, type OyaOptions, type PersonaInfo, type PersonaPrefs, type PlayResult, type Playbook, type PlaybookSummary, type ProjectSettings, type Provider, type ProxyCreate, type ProxyInfo, Run, type RunData, type RunInfo, type RunResult, type SiteCredentials, type StartOptions, type StartResult, type StopResult, type SubmitOptions, Oya as default, file };
|
|
1355
|
+
export { type Activity, type Analysis, type AnalyzeOptions, type AttentionRequest, type Block, Browser, type BrowserDetail, type BrowserInfo, type CaptchaResult, type CaptchaSolver, type Config, type ConfigUpdate, type ControlCredential, type ControlEvent, type ControlOverview, type ControlRole, type ControlSession, type Element, type FileValue, type Fingerprint, type Health, type HumanInputAction, type LlmProvider, MAX_FILE_BYTES, type MfaConfig, type MfaResult, Oya, OyaError, type OyaOptions, type PageFormat, type PersonaInfo, type PersonaPrefs, type PlayResult, type Playbook, type PlaybookSummary, type ProjectSettings, type Provider, type ProxyCreate, type ProxyInfo, Run, type RunData, type RunInfo, type RunResult, type SiteCredentials, type StartOptions, type StartResult, type StopResult, type SubmitOptions, Oya as default, file };
|
package/dist/index.js
CHANGED
|
@@ -226,9 +226,12 @@ var Browser = class {
|
|
|
226
226
|
await this.command("navigate", { url }, NAVIGATE_TIMEOUT_MS);
|
|
227
227
|
if (this.autoCaptcha) assertCaptchaCleared(await this.solveCaptcha());
|
|
228
228
|
}
|
|
229
|
-
/**
|
|
230
|
-
|
|
231
|
-
|
|
229
|
+
/**
|
|
230
|
+
* The page, written as markdown (the default), TOON or JSONL, plus its blocks and
|
|
231
|
+
* the numbered elements to act on.
|
|
232
|
+
*/
|
|
233
|
+
async analyze(options = {}) {
|
|
234
|
+
return this.command("analyze", options.format ? { format: options.format } : {});
|
|
232
235
|
}
|
|
233
236
|
/** Only the visible elements, which is what an agent almost always wants. */
|
|
234
237
|
async elements() {
|
package/package.json
CHANGED