@nexum-hub/browser 0.0.0-stage → 0.0.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/README.md +22 -2
- package/browser-extension/assets.js +654 -0
- package/browser-extension/build.mjs +111 -0
- package/browser-extension/clipboard.js +397 -0
- package/browser-extension/connection.js +880 -0
- package/browser-extension/dist/development/assets.js +654 -0
- package/browser-extension/dist/development/clipboard.js +397 -0
- package/browser-extension/dist/development/connection.js +880 -0
- package/browser-extension/dist/development/errors.js +106 -0
- package/browser-extension/dist/development/evaluate.js +160 -0
- package/browser-extension/dist/development/frames.js +256 -0
- package/browser-extension/dist/development/keyboard.js +167 -0
- package/browser-extension/dist/development/manifest.json +35 -0
- package/browser-extension/dist/development/native-node.js +85 -0
- package/browser-extension/dist/development/page-data.js +497 -0
- package/browser-extension/dist/development/page.js +772 -0
- package/browser-extension/dist/development/profile.js +2 -0
- package/browser-extension/dist/development/router.js +5961 -0
- package/browser-extension/dist/development/site-source.js +149 -0
- package/browser-extension/dist/development/transport.js +405 -0
- package/browser-extension/dist/development/visual.js +976 -0
- package/browser-extension/dist/development/worker.js +24 -0
- package/browser-extension/dist/production/assets.js +654 -0
- package/browser-extension/dist/production/clipboard.js +397 -0
- package/browser-extension/dist/production/connection.js +880 -0
- package/browser-extension/dist/production/errors.js +106 -0
- package/browser-extension/dist/production/evaluate.js +160 -0
- package/browser-extension/dist/production/frames.js +256 -0
- package/browser-extension/dist/production/keyboard.js +167 -0
- package/browser-extension/dist/production/manifest.json +35 -0
- package/browser-extension/dist/production/native-node.js +85 -0
- package/browser-extension/dist/production/page-data.js +497 -0
- package/browser-extension/dist/production/page.js +772 -0
- package/browser-extension/dist/production/profile.js +2 -0
- package/browser-extension/dist/production/router.js +5961 -0
- package/browser-extension/dist/production/site-source.js +149 -0
- package/browser-extension/dist/production/transport.js +405 -0
- package/browser-extension/dist/production/visual.js +976 -0
- package/browser-extension/dist/production/worker.js +24 -0
- package/browser-extension/errors.js +106 -0
- package/browser-extension/evaluate.js +160 -0
- package/browser-extension/frames.js +256 -0
- package/browser-extension/keyboard.js +167 -0
- package/browser-extension/native-node.js +85 -0
- package/browser-extension/page-data.js +497 -0
- package/browser-extension/page.js +772 -0
- package/browser-extension/release-info.json +21 -0
- package/browser-extension/route-manifest.json +807 -0
- package/browser-extension/router.js +5961 -0
- package/browser-extension/site-source.js +149 -0
- package/browser-extension/transport.js +405 -0
- package/browser-extension/visual.js +976 -0
- package/browser-extension/worker.js +24 -0
- package/dist/client/index.d.ts +6 -0
- package/dist/client/index.js +894 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/routes.d.ts +6 -0
- package/dist/client/routes.js +777 -0
- package/dist/client/routes.js.map +1 -0
- package/dist/client/serialize.d.ts +16 -0
- package/dist/client/serialize.js +355 -0
- package/dist/client/serialize.js.map +1 -0
- package/dist/client/types.d.ts +1342 -0
- package/dist/client/types.js +2 -0
- package/dist/client/types.js.map +1 -0
- package/dist/extension/artifacts.d.ts +60 -0
- package/dist/extension/artifacts.js +493 -0
- package/dist/extension/artifacts.js.map +1 -0
- package/dist/extension/assets.d.ts +10 -0
- package/dist/extension/assets.js +90 -0
- package/dist/extension/assets.js.map +1 -0
- package/dist/extension/batch.d.ts +6 -0
- package/dist/extension/batch.js +138 -0
- package/dist/extension/batch.js.map +1 -0
- package/dist/extension/files.d.ts +16 -0
- package/dist/extension/files.js +594 -0
- package/dist/extension/files.js.map +1 -0
- package/dist/extension/index.d.ts +3 -0
- package/dist/extension/index.js +623 -0
- package/dist/extension/index.js.map +1 -0
- package/dist/extension/protocol.d.ts +81 -0
- package/dist/extension/protocol.js +475 -0
- package/dist/extension/protocol.js.map +1 -0
- package/dist/extension/scope.d.ts +55 -0
- package/dist/extension/scope.js +563 -0
- package/dist/extension/scope.js.map +1 -0
- package/dist/extension/service.d.ts +113 -0
- package/dist/extension/service.js +905 -0
- package/dist/extension/service.js.map +1 -0
- package/docs/README.md +10 -0
- package/docs/api.md +1375 -0
- package/docs/connection.md +9 -0
- package/docs/lifecycle.md +17 -0
- package/docs/usage.md +75 -0
- package/implementation.json +2962 -0
- package/instructions/README.md +8 -0
- package/package.json +80 -4
- package/scripts/discover.js +12 -0
- package/scripts/screenshot.js +9 -0
- package/skills/browser-control/SKILL.md +12 -0
|
@@ -0,0 +1,777 @@
|
|
|
1
|
+
const string = { type: "string", maxLength: 65536 };
|
|
2
|
+
const id = { type: "string", minLength: 1, maxLength: 256 };
|
|
3
|
+
const bool = { type: "boolean" };
|
|
4
|
+
const number = { type: "number" };
|
|
5
|
+
const integer = { type: "integer" };
|
|
6
|
+
const timeout = { type: "number", minimum: 0 };
|
|
7
|
+
const enumOf = (...values) => ({ enum: values });
|
|
8
|
+
const array = (items, maxItems = 128) => ({
|
|
9
|
+
type: "array",
|
|
10
|
+
items,
|
|
11
|
+
maxItems,
|
|
12
|
+
});
|
|
13
|
+
const object = (properties, required = []) => ({
|
|
14
|
+
type: "object",
|
|
15
|
+
properties,
|
|
16
|
+
required,
|
|
17
|
+
additionalProperties: false,
|
|
18
|
+
});
|
|
19
|
+
const optionalObject = (properties) => object(properties);
|
|
20
|
+
const point = object({ x: number, y: number }, ["x", "y"]);
|
|
21
|
+
const rect = object({
|
|
22
|
+
x: number,
|
|
23
|
+
y: number,
|
|
24
|
+
width: { type: "number", exclusiveMinimum: 0 },
|
|
25
|
+
height: { type: "number", exclusiveMinimum: 0 },
|
|
26
|
+
}, ["x", "y", "width", "height"]);
|
|
27
|
+
const modifiers = array(enumOf("Alt", "Control", "ControlOrMeta", "Meta", "Shift"), 5);
|
|
28
|
+
const navigation = optionalObject({
|
|
29
|
+
timeoutMs: timeout,
|
|
30
|
+
waitUntil: enumOf("load", "domcontentloaded", "networkidle", "commit"),
|
|
31
|
+
});
|
|
32
|
+
const timed = optionalObject({ timeoutMs: timeout });
|
|
33
|
+
const targetProperties = {
|
|
34
|
+
browserId: id,
|
|
35
|
+
bootId: id,
|
|
36
|
+
browserSessionId: id,
|
|
37
|
+
generation: { type: "integer", minimum: 1 },
|
|
38
|
+
tabId: id,
|
|
39
|
+
controlEpoch: { ...id, pattern: "^[^\\u0000\\r\\n]+$" },
|
|
40
|
+
pageVersion: { type: "integer", minimum: 0 },
|
|
41
|
+
};
|
|
42
|
+
const browserTarget = object(targetProperties, [
|
|
43
|
+
"browserId",
|
|
44
|
+
"bootId",
|
|
45
|
+
"browserSessionId",
|
|
46
|
+
"generation",
|
|
47
|
+
]);
|
|
48
|
+
const tabTarget = object(targetProperties, [
|
|
49
|
+
"browserId",
|
|
50
|
+
"bootId",
|
|
51
|
+
"browserSessionId",
|
|
52
|
+
"generation",
|
|
53
|
+
"tabId",
|
|
54
|
+
]);
|
|
55
|
+
const matcher = {
|
|
56
|
+
anyOf: [
|
|
57
|
+
object({ kind: { const: "text" }, value: string, exact: bool }, [
|
|
58
|
+
"kind",
|
|
59
|
+
"value",
|
|
60
|
+
]),
|
|
61
|
+
object({
|
|
62
|
+
kind: { const: "regexp" },
|
|
63
|
+
source: { type: "string", maxLength: 1024 },
|
|
64
|
+
flags: { type: "string", pattern: "^[dgimsuvy]*$" },
|
|
65
|
+
}, ["kind", "source", "flags"]),
|
|
66
|
+
],
|
|
67
|
+
};
|
|
68
|
+
const queryRef = { $ref: "#/definitions/LocatorData" };
|
|
69
|
+
const locatorData = {
|
|
70
|
+
anyOf: [
|
|
71
|
+
object({ kind: { const: "selector" }, selector: string }, [
|
|
72
|
+
"kind",
|
|
73
|
+
"selector",
|
|
74
|
+
]),
|
|
75
|
+
object({ kind: { const: "role" }, role: id, name: matcher, exact: bool }, [
|
|
76
|
+
"kind",
|
|
77
|
+
"role",
|
|
78
|
+
]),
|
|
79
|
+
object({ kind: enumOf("label", "placeholder", "text"), matcher }, [
|
|
80
|
+
"kind",
|
|
81
|
+
"matcher",
|
|
82
|
+
]),
|
|
83
|
+
object({ kind: { const: "testId" }, value: string }, ["kind", "value"]),
|
|
84
|
+
object({ kind: { const: "descendant" }, root: queryRef, query: queryRef }, [
|
|
85
|
+
"kind",
|
|
86
|
+
"root",
|
|
87
|
+
"query",
|
|
88
|
+
]),
|
|
89
|
+
object({ kind: enumOf("and", "or"), left: queryRef, right: queryRef }, [
|
|
90
|
+
"kind",
|
|
91
|
+
"left",
|
|
92
|
+
"right",
|
|
93
|
+
]),
|
|
94
|
+
object({
|
|
95
|
+
kind: { const: "position" },
|
|
96
|
+
query: queryRef,
|
|
97
|
+
at: {
|
|
98
|
+
anyOf: [enumOf("first", "last"), { type: "integer", minimum: 0 }],
|
|
99
|
+
},
|
|
100
|
+
}, ["kind", "query", "at"]),
|
|
101
|
+
object({
|
|
102
|
+
kind: { const: "filter" },
|
|
103
|
+
query: queryRef,
|
|
104
|
+
has: queryRef,
|
|
105
|
+
hasNot: queryRef,
|
|
106
|
+
hasText: matcher,
|
|
107
|
+
hasNotText: matcher,
|
|
108
|
+
visible: bool,
|
|
109
|
+
}, ["kind", "query"]),
|
|
110
|
+
object({
|
|
111
|
+
kind: { const: "ref" },
|
|
112
|
+
ref: id,
|
|
113
|
+
pageVersion: { type: "integer", minimum: 0 },
|
|
114
|
+
}, ["kind", "ref", "pageVersion"]),
|
|
115
|
+
],
|
|
116
|
+
};
|
|
117
|
+
const locator = object({ target: tabTarget, framePath: array(string, 8), query: queryRef }, ["target", "framePath", "query"]);
|
|
118
|
+
const fileSource = {
|
|
119
|
+
anyOf: [
|
|
120
|
+
object({ path: string, name: id, mimeType: id }, ["path"]),
|
|
121
|
+
object({ data: {}, name: id, mimeType: id }, ["data", "name"]),
|
|
122
|
+
],
|
|
123
|
+
};
|
|
124
|
+
const files = array(fileSource, 128);
|
|
125
|
+
const fileChooserFiles = {
|
|
126
|
+
anyOf: [string, array({ anyOf: [string, fileSource] }, 128)],
|
|
127
|
+
};
|
|
128
|
+
const selection = {
|
|
129
|
+
anyOf: [
|
|
130
|
+
string,
|
|
131
|
+
object({
|
|
132
|
+
index: { type: "integer", minimum: 0 },
|
|
133
|
+
label: string,
|
|
134
|
+
value: string,
|
|
135
|
+
}),
|
|
136
|
+
],
|
|
137
|
+
};
|
|
138
|
+
const selections = { anyOf: [selection, array(selection)] };
|
|
139
|
+
const click = optionalObject({
|
|
140
|
+
button: enumOf("left", "right", "middle"),
|
|
141
|
+
clickCount: { type: "integer", minimum: 1, maximum: 3 },
|
|
142
|
+
position: point,
|
|
143
|
+
modifiers,
|
|
144
|
+
timeoutMs: timeout,
|
|
145
|
+
});
|
|
146
|
+
const screenshot = optionalObject({
|
|
147
|
+
clip: rect,
|
|
148
|
+
fullPage: bool,
|
|
149
|
+
quality: { type: "integer", minimum: 0, maximum: 100 },
|
|
150
|
+
maxEdgePx: { type: "integer", minimum: 1 },
|
|
151
|
+
});
|
|
152
|
+
const axState = optionalObject({ disableDiffing: bool });
|
|
153
|
+
const axPoint = { anyOf: [integer, point] };
|
|
154
|
+
const axIndex = { anyOf: [{ type: "null" }, integer] };
|
|
155
|
+
const duration = { type: "number", minimum: 0, maximum: 30 };
|
|
156
|
+
const clipboardEntry = {
|
|
157
|
+
anyOf: [
|
|
158
|
+
object({ mimeType: id, text: string }, ["mimeType", "text"]),
|
|
159
|
+
object({ mimeType: id, data: {} }, ["mimeType", "data"]),
|
|
160
|
+
],
|
|
161
|
+
};
|
|
162
|
+
const clipboardItems = array(object({
|
|
163
|
+
entries: array(clipboardEntry, 32),
|
|
164
|
+
presentationStyle: enumOf("unspecified", "inline", "attachment"),
|
|
165
|
+
}, ["entries"]), 32);
|
|
166
|
+
const waitCondition = {
|
|
167
|
+
allOf: [
|
|
168
|
+
{
|
|
169
|
+
anyOf: [
|
|
170
|
+
object({
|
|
171
|
+
kind: { const: "element" },
|
|
172
|
+
selector: string,
|
|
173
|
+
state: enumOf("attached", "detached", "visible", "hidden"),
|
|
174
|
+
timeoutMs: timeout,
|
|
175
|
+
pollingMs: { type: "number", minimum: 1 },
|
|
176
|
+
}, ["kind", "selector"]),
|
|
177
|
+
object({
|
|
178
|
+
kind: { const: "selector" },
|
|
179
|
+
value: string,
|
|
180
|
+
state: enumOf("attached", "detached", "visible", "hidden"),
|
|
181
|
+
timeoutMs: timeout,
|
|
182
|
+
pollingMs: { type: "number", minimum: 1 },
|
|
183
|
+
}, ["kind", "value"]),
|
|
184
|
+
object({
|
|
185
|
+
kind: enumOf("text", "url"),
|
|
186
|
+
value: string,
|
|
187
|
+
timeoutMs: timeout,
|
|
188
|
+
pollingMs: { type: "number", minimum: 1 },
|
|
189
|
+
}, ["kind", "value"]),
|
|
190
|
+
object({
|
|
191
|
+
kind: { const: "navigation" },
|
|
192
|
+
url: string,
|
|
193
|
+
waitUntil: enumOf("load", "domcontentloaded", "networkidle", "commit"),
|
|
194
|
+
timeoutMs: timeout,
|
|
195
|
+
pollingMs: { type: "number", minimum: 1 },
|
|
196
|
+
}, ["kind"]),
|
|
197
|
+
object({
|
|
198
|
+
kind: { const: "state" },
|
|
199
|
+
state: enumOf("load", "domcontentloaded", "networkidle"),
|
|
200
|
+
timeoutMs: timeout,
|
|
201
|
+
pollingMs: { type: "number", minimum: 1 },
|
|
202
|
+
}, ["kind", "state"]),
|
|
203
|
+
],
|
|
204
|
+
},
|
|
205
|
+
],
|
|
206
|
+
};
|
|
207
|
+
const cdpTarget = {
|
|
208
|
+
anyOf: [
|
|
209
|
+
object({ sessionId: id }, ["sessionId"]),
|
|
210
|
+
object({ targetId: id }, ["targetId"]),
|
|
211
|
+
],
|
|
212
|
+
};
|
|
213
|
+
const routes = [];
|
|
214
|
+
function route(path, properties = {}, required = []) {
|
|
215
|
+
routes.push({
|
|
216
|
+
path,
|
|
217
|
+
inputSchema: {
|
|
218
|
+
$schema: "http://json-schema.org/draft-07/schema#",
|
|
219
|
+
...object(properties, required),
|
|
220
|
+
...(Object.hasOwn(properties, "locator")
|
|
221
|
+
? { definitions: { LocatorData: locatorData } }
|
|
222
|
+
: {}),
|
|
223
|
+
},
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
function browser(path, properties = {}, required = []) {
|
|
227
|
+
route(path, { target: browserTarget, ...properties }, [
|
|
228
|
+
"target",
|
|
229
|
+
...required,
|
|
230
|
+
]);
|
|
231
|
+
}
|
|
232
|
+
function tab(path, properties = {}, required = []) {
|
|
233
|
+
route(path, { target: tabTarget, ...properties }, ["target", ...required]);
|
|
234
|
+
}
|
|
235
|
+
function located(path, properties = {}, required = []) {
|
|
236
|
+
route(path, { locator, ...properties }, ["locator", ...required]);
|
|
237
|
+
}
|
|
238
|
+
route("browsers.list");
|
|
239
|
+
route("browsers.get", { id }, ["id"]);
|
|
240
|
+
route("browsers.getDefault");
|
|
241
|
+
route("browsers.getForUrl", { url: string }, ["url"]);
|
|
242
|
+
route("documentation.get", { name: string }, ["name"]);
|
|
243
|
+
browser("browsers.documentation");
|
|
244
|
+
browser("browsers.nameSession", { name: string }, ["name"]);
|
|
245
|
+
browser("browsers.history", {
|
|
246
|
+
options: optionalObject({
|
|
247
|
+
from: string,
|
|
248
|
+
to: string,
|
|
249
|
+
queries: array(string, 4),
|
|
250
|
+
limit: { type: "integer", minimum: 1, maximum: 20 },
|
|
251
|
+
}),
|
|
252
|
+
});
|
|
253
|
+
browser("browsers.downloads", {
|
|
254
|
+
options: optionalObject({
|
|
255
|
+
limit: { type: "integer", minimum: 0, maximum: 2147483647 },
|
|
256
|
+
}),
|
|
257
|
+
});
|
|
258
|
+
browser("tabs.list");
|
|
259
|
+
browser("tabs.get", { id }, ["id"]);
|
|
260
|
+
browser("tabs.new", { url: string, options: optionalObject({ active: bool }) });
|
|
261
|
+
browser("tabs.selected");
|
|
262
|
+
browser("tabs.select", { id }, ["id"]);
|
|
263
|
+
browser("tabs.content", {
|
|
264
|
+
options: object({
|
|
265
|
+
urls: array(string, 8),
|
|
266
|
+
contentType: enumOf("html", "text", "domSnapshot"),
|
|
267
|
+
timeoutMs: { type: "number", minimum: 0, maximum: 30000 },
|
|
268
|
+
}, ["urls", "contentType"]),
|
|
269
|
+
}, ["options"]);
|
|
270
|
+
browser("user.openTabs");
|
|
271
|
+
browser("user.claimTab", {
|
|
272
|
+
tab: {
|
|
273
|
+
anyOf: [
|
|
274
|
+
id,
|
|
275
|
+
object({
|
|
276
|
+
id,
|
|
277
|
+
lastOpened: string,
|
|
278
|
+
providerTabId: id,
|
|
279
|
+
tabGroup: id,
|
|
280
|
+
title: string,
|
|
281
|
+
url: string,
|
|
282
|
+
}, ["id"]),
|
|
283
|
+
],
|
|
284
|
+
},
|
|
285
|
+
}, ["tab"]);
|
|
286
|
+
browser("user.getTabContext", {
|
|
287
|
+
tab: {
|
|
288
|
+
anyOf: [
|
|
289
|
+
id,
|
|
290
|
+
object({
|
|
291
|
+
id,
|
|
292
|
+
lastOpened: string,
|
|
293
|
+
providerTabId: id,
|
|
294
|
+
tabGroup: id,
|
|
295
|
+
title: string,
|
|
296
|
+
url: string,
|
|
297
|
+
}, ["id"]),
|
|
298
|
+
],
|
|
299
|
+
},
|
|
300
|
+
});
|
|
301
|
+
for (const name of ["goBack", "forward", "reload"])
|
|
302
|
+
tab(`tab.${name}`, { options: navigation });
|
|
303
|
+
tab("tab.navigate", { url: string, options: navigation }, ["url"]);
|
|
304
|
+
for (const name of [
|
|
305
|
+
"close",
|
|
306
|
+
"title",
|
|
307
|
+
"url",
|
|
308
|
+
"markDeliverable",
|
|
309
|
+
"markHandoff",
|
|
310
|
+
"getJsDialog",
|
|
311
|
+
])
|
|
312
|
+
tab(`tab.${name}`);
|
|
313
|
+
tab("tab.requestUserTakeover", {
|
|
314
|
+
reason: enumOf("authentication", "captcha", "user_requested", "other"),
|
|
315
|
+
});
|
|
316
|
+
tab("tab.screenshot", { options: screenshot });
|
|
317
|
+
tab("tab.snapshot", {
|
|
318
|
+
options: optionalObject({
|
|
319
|
+
maxBytes: { type: "integer", minimum: 1 },
|
|
320
|
+
root: id,
|
|
321
|
+
frame: string,
|
|
322
|
+
}),
|
|
323
|
+
});
|
|
324
|
+
tab("tab.click", { ref: id, options: click }, ["ref"]);
|
|
325
|
+
tab("tab.fill", { ref: id, text: string, options: timed }, ["ref", "text"]);
|
|
326
|
+
tab("tab.press", { key: string, options: optionalObject({ timeoutMs: timeout, modifiers }) }, ["key"]);
|
|
327
|
+
tab("tab.selectOption", { ref: id, values: selections }, ["ref", "values"]);
|
|
328
|
+
tab("tab.scroll", {
|
|
329
|
+
options: optionalObject({
|
|
330
|
+
x: number,
|
|
331
|
+
y: number,
|
|
332
|
+
ref: id,
|
|
333
|
+
behavior: enumOf("auto", "smooth"),
|
|
334
|
+
}),
|
|
335
|
+
}, ["options"]);
|
|
336
|
+
tab("tab.hover", { ref: id, options: timed }, ["ref"]);
|
|
337
|
+
tab("tab.focus", { ref: id }, ["ref"]);
|
|
338
|
+
tab("tab.waitFor", { condition: waitCondition }, ["condition"]);
|
|
339
|
+
tab("tab.evaluate", { expression: string, args: {} }, ["expression"]);
|
|
340
|
+
for (const name of ["keyboardDown", "keyboardUp"])
|
|
341
|
+
tab(`tab.${name}`, { key: string }, ["key"]);
|
|
342
|
+
tab("tab.frame", { selector: string }, ["selector"]);
|
|
343
|
+
tab("tab.dialogAccept", { text: string });
|
|
344
|
+
tab("tab.dialogDismiss");
|
|
345
|
+
tab("tab.contentExport", {
|
|
346
|
+
options: object({ format: enumOf("html", "markdown", "text") }, ["format"]),
|
|
347
|
+
}, ["options"]);
|
|
348
|
+
tab("tab.setFiles", { ref: id, files }, ["ref", "files"]);
|
|
349
|
+
tab("tab.downloads");
|
|
350
|
+
tab("tab.saveDownload", { id, path: string }, ["id"]);
|
|
351
|
+
tab("tab.setViewport", {
|
|
352
|
+
size: object({
|
|
353
|
+
width: { type: "integer", minimum: 1 },
|
|
354
|
+
height: { type: "integer", minimum: 1 },
|
|
355
|
+
}, ["width", "height"]),
|
|
356
|
+
}, ["size"]);
|
|
357
|
+
tab("tab.resetViewport");
|
|
358
|
+
const logs = optionalObject({
|
|
359
|
+
filter: string,
|
|
360
|
+
levels: array(enumOf("debug", "info", "log", "warn", "error", "warning"), 6),
|
|
361
|
+
limit: { type: "integer", minimum: 1, maximum: 1000 },
|
|
362
|
+
since: number,
|
|
363
|
+
});
|
|
364
|
+
tab("dev.logs", { options: logs });
|
|
365
|
+
tab("tab.devLogs", { options: logs });
|
|
366
|
+
tab("content.export");
|
|
367
|
+
tab("content.exportGsuite", { type: enumOf("pdf", "md", "xlsx", "csv", "docx", "pptx") }, ["type"]);
|
|
368
|
+
tab("content.exportYouTubeTranscript");
|
|
369
|
+
tab("tab.exportFile", {
|
|
370
|
+
options: object({ format: enumOf("pdf", "html", "markdown") }, ["format"]),
|
|
371
|
+
}, ["options"]);
|
|
372
|
+
for (const name of ["read", "readText"])
|
|
373
|
+
tab(`clipboard.${name}`);
|
|
374
|
+
tab("clipboard.write", { items: clipboardItems }, ["items"]);
|
|
375
|
+
tab("clipboard.writeText", { text: string }, ["text"]);
|
|
376
|
+
tab("ax.click", {
|
|
377
|
+
element: axPoint,
|
|
378
|
+
options: optionalObject({
|
|
379
|
+
clickCount: { type: "integer", minimum: 1 },
|
|
380
|
+
duration,
|
|
381
|
+
key: string,
|
|
382
|
+
mouseButton: enumOf("left", "right", "middle", "l", "r", "m"),
|
|
383
|
+
}),
|
|
384
|
+
}, ["element"]);
|
|
385
|
+
tab("ax.drag", { from: point, to: point }, ["from", "to"]);
|
|
386
|
+
for (const name of ["get", "write"])
|
|
387
|
+
tab(`ax.${name}`, {
|
|
388
|
+
mode: enumOf("state", "screenshot", "both"),
|
|
389
|
+
options: axState,
|
|
390
|
+
});
|
|
391
|
+
tab("ax.snapshot", { options: axState });
|
|
392
|
+
tab("ax.paste", {
|
|
393
|
+
elementIndex: axIndex,
|
|
394
|
+
text: string,
|
|
395
|
+
options: optionalObject({ format: enumOf("text", "md", "html") }),
|
|
396
|
+
}, ["elementIndex", "text"]);
|
|
397
|
+
tab("ax.performSecondaryAction", { elementIndex: integer, action: string }, [
|
|
398
|
+
"elementIndex",
|
|
399
|
+
"action",
|
|
400
|
+
]);
|
|
401
|
+
tab("ax.pressKey", { elementIndex: axIndex, key: string, options: optionalObject({ duration }) }, ["elementIndex", "key"]);
|
|
402
|
+
tab("ax.scroll", {
|
|
403
|
+
element: axPoint,
|
|
404
|
+
direction: enumOf("up", "down", "left", "right", "u", "d", "l", "r"),
|
|
405
|
+
pages: { type: "number", exclusiveMinimum: 0 },
|
|
406
|
+
}, ["element", "direction"]);
|
|
407
|
+
tab("ax.selectText", {
|
|
408
|
+
elementIndex: integer,
|
|
409
|
+
text: string,
|
|
410
|
+
options: optionalObject({
|
|
411
|
+
prefix: string,
|
|
412
|
+
selectionType: enumOf("text", "cursor_before", "cursor_after"),
|
|
413
|
+
suffix: string,
|
|
414
|
+
}),
|
|
415
|
+
}, ["elementIndex", "text"]);
|
|
416
|
+
tab("ax.setValue", { elementIndex: integer, value: string }, [
|
|
417
|
+
"elementIndex",
|
|
418
|
+
"value",
|
|
419
|
+
]);
|
|
420
|
+
tab("ax.typeText", { elementIndex: axIndex, text: string }, [
|
|
421
|
+
"elementIndex",
|
|
422
|
+
"text",
|
|
423
|
+
]);
|
|
424
|
+
for (const name of ["click", "doubleClick"])
|
|
425
|
+
tab(`cua.${name}`, {
|
|
426
|
+
options: object({
|
|
427
|
+
x: number,
|
|
428
|
+
y: number,
|
|
429
|
+
keypress: array(string, 8),
|
|
430
|
+
...(name === "click" ? { button: { enum: [1, 2, 3, 4, 5] } } : {}),
|
|
431
|
+
}, ["x", "y"]),
|
|
432
|
+
}, ["options"]);
|
|
433
|
+
tab("cua.downloadMedia", { options: object({ x: number, y: number, timeoutMs: timeout }, ["x", "y"]) }, ["options"]);
|
|
434
|
+
tab("cua.drag", {
|
|
435
|
+
options: object({ path: array(point, 1024), keys: array(string, 8) }, [
|
|
436
|
+
"path",
|
|
437
|
+
]),
|
|
438
|
+
}, ["options"]);
|
|
439
|
+
tab("cua.keypress", { options: object({ keys: array(string, 8), duration }, ["keys"]) }, ["options"]);
|
|
440
|
+
tab("cua.move", {
|
|
441
|
+
options: object({ x: number, y: number, keys: array(string, 8) }, [
|
|
442
|
+
"x",
|
|
443
|
+
"y",
|
|
444
|
+
]),
|
|
445
|
+
}, ["options"]);
|
|
446
|
+
tab("cua.scroll", {
|
|
447
|
+
options: object({
|
|
448
|
+
x: number,
|
|
449
|
+
y: number,
|
|
450
|
+
scrollX: number,
|
|
451
|
+
scrollY: number,
|
|
452
|
+
keypress: array(string, 8),
|
|
453
|
+
}, ["x", "y", "scrollX", "scrollY"]),
|
|
454
|
+
}, ["options"]);
|
|
455
|
+
tab("cua.type", { options: object({ text: string }, ["text"]) }, ["options"]);
|
|
456
|
+
for (const name of ["click", "doubleClick"])
|
|
457
|
+
tab(`dom.${name}`, { options: object({ node_id: id }, ["node_id"]) }, [
|
|
458
|
+
"options",
|
|
459
|
+
]);
|
|
460
|
+
tab("dom.downloadMedia", { options: object({ node_id: id, timeoutMs: timeout }, ["node_id"]) }, ["options"]);
|
|
461
|
+
tab("dom.getVisibleTree");
|
|
462
|
+
tab("dom.keypress", { options: object({ keys: array(string, 8) }, ["keys"]) }, [
|
|
463
|
+
"options",
|
|
464
|
+
]);
|
|
465
|
+
tab("dom.scroll", { options: object({ node_id: id, x: number, y: number }, ["x", "y"]) }, ["options"]);
|
|
466
|
+
tab("dom.type", { options: object({ text: string }, ["text"]) }, ["options"]);
|
|
467
|
+
tab("dom.fill", { nodeId: id, text: string }, ["nodeId", "text"]);
|
|
468
|
+
tab("playwright.domSnapshot");
|
|
469
|
+
for (const name of ["elementInfo", "elementScreenshot"])
|
|
470
|
+
tab(`playwright.${name}`, {
|
|
471
|
+
options: object({ x: number, y: number, includeNonInteractable: bool }, [
|
|
472
|
+
"x",
|
|
473
|
+
"y",
|
|
474
|
+
]),
|
|
475
|
+
}, ["options"]);
|
|
476
|
+
tab("playwright.evaluate", { expression: string, arg: {}, options: timed }, [
|
|
477
|
+
"expression",
|
|
478
|
+
]);
|
|
479
|
+
tab("playwright.waitForLoadState", {
|
|
480
|
+
options: optionalObject({
|
|
481
|
+
state: enumOf("load", "domcontentloaded", "networkidle"),
|
|
482
|
+
timeoutMs: timeout,
|
|
483
|
+
}),
|
|
484
|
+
});
|
|
485
|
+
tab("playwright.waitForTimeout", { timeoutMs: timeout }, ["timeoutMs"]);
|
|
486
|
+
tab("playwright.waitForURL", { url: string, options: navigation }, ["url"]);
|
|
487
|
+
for (const name of ["snapshot", "click", "fill", "waitFor"]) {
|
|
488
|
+
const fields = { framePath: array(string, 8) };
|
|
489
|
+
const required = ["framePath"];
|
|
490
|
+
if (name === "snapshot")
|
|
491
|
+
fields.options = optionalObject({
|
|
492
|
+
maxBytes: { type: "integer", minimum: 1 },
|
|
493
|
+
});
|
|
494
|
+
if (name === "click" || name === "fill") {
|
|
495
|
+
fields.ref = id;
|
|
496
|
+
fields.options = timed;
|
|
497
|
+
required.push("ref");
|
|
498
|
+
}
|
|
499
|
+
if (name === "fill") {
|
|
500
|
+
fields.text = string;
|
|
501
|
+
required.push("text");
|
|
502
|
+
}
|
|
503
|
+
if (name === "waitFor") {
|
|
504
|
+
fields.condition = waitCondition;
|
|
505
|
+
required.push("condition");
|
|
506
|
+
}
|
|
507
|
+
tab(`frame.${name}`, fields, required);
|
|
508
|
+
}
|
|
509
|
+
for (const name of [
|
|
510
|
+
"all",
|
|
511
|
+
"allTextContents",
|
|
512
|
+
"check",
|
|
513
|
+
"click",
|
|
514
|
+
"count",
|
|
515
|
+
"dblclick",
|
|
516
|
+
"downloadMedia",
|
|
517
|
+
"getAttribute",
|
|
518
|
+
"innerText",
|
|
519
|
+
"isEnabled",
|
|
520
|
+
"isVisible",
|
|
521
|
+
"press",
|
|
522
|
+
"pressSequentially",
|
|
523
|
+
"selectOption",
|
|
524
|
+
"setChecked",
|
|
525
|
+
"textContent",
|
|
526
|
+
"type",
|
|
527
|
+
"uncheck",
|
|
528
|
+
"waitFor",
|
|
529
|
+
"fill",
|
|
530
|
+
"evaluate",
|
|
531
|
+
"evaluateAll",
|
|
532
|
+
]) {
|
|
533
|
+
const fields = {}, required = [];
|
|
534
|
+
if ([
|
|
535
|
+
"allTextContents",
|
|
536
|
+
"check",
|
|
537
|
+
"downloadMedia",
|
|
538
|
+
"getAttribute",
|
|
539
|
+
"innerText",
|
|
540
|
+
"textContent",
|
|
541
|
+
"uncheck",
|
|
542
|
+
"fill",
|
|
543
|
+
"evaluate",
|
|
544
|
+
"evaluateAll",
|
|
545
|
+
].includes(name))
|
|
546
|
+
fields.options = timed;
|
|
547
|
+
if (name === "click" || name === "dblclick")
|
|
548
|
+
fields.options = click;
|
|
549
|
+
if (["fill", "press", "pressSequentially", "type"].includes(name)) {
|
|
550
|
+
fields.value = string;
|
|
551
|
+
required.push("value");
|
|
552
|
+
}
|
|
553
|
+
if (name === "press")
|
|
554
|
+
fields.options = optionalObject({ timeoutMs: timeout, modifiers });
|
|
555
|
+
if (name === "type")
|
|
556
|
+
fields.options = optionalObject({
|
|
557
|
+
timeoutMs: timeout,
|
|
558
|
+
delayMs: { type: "number", minimum: 0 },
|
|
559
|
+
});
|
|
560
|
+
if (name === "pressSequentially")
|
|
561
|
+
fields.options = timed;
|
|
562
|
+
if (name === "getAttribute") {
|
|
563
|
+
fields.name = string;
|
|
564
|
+
required.push("name");
|
|
565
|
+
}
|
|
566
|
+
if (name === "selectOption") {
|
|
567
|
+
fields.value = selections;
|
|
568
|
+
fields.options = timed;
|
|
569
|
+
required.push("value");
|
|
570
|
+
}
|
|
571
|
+
if (name === "setChecked") {
|
|
572
|
+
fields.checked = bool;
|
|
573
|
+
fields.options = timed;
|
|
574
|
+
required.push("checked");
|
|
575
|
+
}
|
|
576
|
+
if (name === "waitFor") {
|
|
577
|
+
fields.options = object({
|
|
578
|
+
state: enumOf("attached", "detached", "visible", "hidden"),
|
|
579
|
+
timeoutMs: timeout,
|
|
580
|
+
}, ["state"]);
|
|
581
|
+
required.push("options");
|
|
582
|
+
}
|
|
583
|
+
if (name === "evaluate" || name === "evaluateAll") {
|
|
584
|
+
fields.expression = string;
|
|
585
|
+
fields.arg = {};
|
|
586
|
+
required.push("expression");
|
|
587
|
+
}
|
|
588
|
+
located(`locator.${name}`, fields, required);
|
|
589
|
+
}
|
|
590
|
+
route("waiters.arm", {
|
|
591
|
+
target: tabTarget,
|
|
592
|
+
event: enumOf("navigation", "download", "filechooser"),
|
|
593
|
+
timeoutMs: timeout,
|
|
594
|
+
url: string,
|
|
595
|
+
waitUntil: enumOf("load", "domcontentloaded", "networkidle", "commit"),
|
|
596
|
+
}, ["target", "event"]);
|
|
597
|
+
route("waiters.get", { id }, ["id"]);
|
|
598
|
+
route("waiters.cancel", { id }, ["id"]);
|
|
599
|
+
for (const name of ["accept", "dismiss"])
|
|
600
|
+
tab(`dialogs.${name}`, {
|
|
601
|
+
dialogId: id,
|
|
602
|
+
pageVersion: { type: "integer", minimum: 0 },
|
|
603
|
+
...(name === "accept" ? { text: string } : {}),
|
|
604
|
+
}, ["dialogId", "pageVersion"]);
|
|
605
|
+
tab("downloads.path", { downloadId: id, options: timed }, ["downloadId"]);
|
|
606
|
+
tab("fileChoosers.setFiles", {
|
|
607
|
+
chooserId: id,
|
|
608
|
+
pageVersion: { type: "integer", minimum: 0 },
|
|
609
|
+
files: fileChooserFiles,
|
|
610
|
+
options: timed,
|
|
611
|
+
}, ["chooserId", "pageVersion", "files"]);
|
|
612
|
+
for (const level of ["browser", "tab"]) {
|
|
613
|
+
const register = level === "browser" ? browser : tab;
|
|
614
|
+
register(`capabilities.${level}List`);
|
|
615
|
+
register(`capabilities.${level}Get`, { id }, ["id"]);
|
|
616
|
+
}
|
|
617
|
+
for (const name of ["get", "set"])
|
|
618
|
+
browser(`visibility.${name}`, name === "set" ? { visible: bool } : {}, name === "set" ? ["visible"] : []);
|
|
619
|
+
browser("viewport.set", {
|
|
620
|
+
options: object({
|
|
621
|
+
tabId: id,
|
|
622
|
+
width: { type: "integer", minimum: 1 },
|
|
623
|
+
height: { type: "integer", minimum: 1 },
|
|
624
|
+
}, ["width", "height"]),
|
|
625
|
+
}, ["options"]);
|
|
626
|
+
browser("viewport.reset", { tabId: id });
|
|
627
|
+
browser("management.windows.list");
|
|
628
|
+
browser("management.windows.getAll", {
|
|
629
|
+
options: optionalObject({ populate: bool }),
|
|
630
|
+
});
|
|
631
|
+
browser("management.windows.create", {
|
|
632
|
+
options: optionalObject({
|
|
633
|
+
tabId: id,
|
|
634
|
+
focused: bool,
|
|
635
|
+
left: integer,
|
|
636
|
+
top: integer,
|
|
637
|
+
width: { type: "integer", minimum: 1 },
|
|
638
|
+
height: { type: "integer", minimum: 1 },
|
|
639
|
+
}),
|
|
640
|
+
});
|
|
641
|
+
browser("management.windows.update", {
|
|
642
|
+
id,
|
|
643
|
+
options: optionalObject({
|
|
644
|
+
focused: bool,
|
|
645
|
+
state: enumOf("normal", "minimized", "maximized", "fullscreen"),
|
|
646
|
+
left: integer,
|
|
647
|
+
top: integer,
|
|
648
|
+
width: { type: "integer", minimum: 1 },
|
|
649
|
+
height: { type: "integer", minimum: 1 },
|
|
650
|
+
}),
|
|
651
|
+
}, ["id", "options"]);
|
|
652
|
+
browser("management.tabs.query", {
|
|
653
|
+
options: optionalObject({
|
|
654
|
+
windowId: id,
|
|
655
|
+
url: { anyOf: [string, array(string, 128)] },
|
|
656
|
+
active: bool,
|
|
657
|
+
pinned: bool,
|
|
658
|
+
groupId: id,
|
|
659
|
+
}),
|
|
660
|
+
});
|
|
661
|
+
browser("management.tabs.get", { id }, ["id"]);
|
|
662
|
+
browser("management.tabs.move", {
|
|
663
|
+
id,
|
|
664
|
+
options: object({ index: { type: "integer", minimum: -1 }, windowId: id }, [
|
|
665
|
+
"index",
|
|
666
|
+
]),
|
|
667
|
+
}, ["id", "options"]);
|
|
668
|
+
browser("management.tabs.update", { id, options: optionalObject({ pinned: bool, muted: bool }) }, ["id", "options"]);
|
|
669
|
+
browser("management.tabs.group", {
|
|
670
|
+
options: object({
|
|
671
|
+
tabIds: array(id, 128),
|
|
672
|
+
groupId: id,
|
|
673
|
+
createProperties: optionalObject({ windowId: id }),
|
|
674
|
+
}, ["tabIds"]),
|
|
675
|
+
}, ["options"]);
|
|
676
|
+
browser("management.tabs.ungroup", { ids: array(id, 128) }, ["ids"]);
|
|
677
|
+
browser("management.tabs.close", { id }, ["id"]);
|
|
678
|
+
browser("management.tabGroups.query", {
|
|
679
|
+
options: optionalObject({
|
|
680
|
+
windowId: id,
|
|
681
|
+
title: string,
|
|
682
|
+
color: id,
|
|
683
|
+
collapsed: bool,
|
|
684
|
+
}),
|
|
685
|
+
});
|
|
686
|
+
browser("management.tabGroups.get", { id }, ["id"]);
|
|
687
|
+
browser("management.tabGroups.update", {
|
|
688
|
+
id,
|
|
689
|
+
options: optionalObject({ title: string, color: id, collapsed: bool }),
|
|
690
|
+
}, ["id", "options"]);
|
|
691
|
+
browser("management.tabGroups.move", {
|
|
692
|
+
id,
|
|
693
|
+
options: object({ index: { type: "integer", minimum: -1 }, windowId: id }, [
|
|
694
|
+
"index",
|
|
695
|
+
]),
|
|
696
|
+
}, ["id", "options"]);
|
|
697
|
+
browser("management.bookmarks.search", {
|
|
698
|
+
query: {
|
|
699
|
+
anyOf: [
|
|
700
|
+
string,
|
|
701
|
+
optionalObject({ query: string, title: string, url: string }),
|
|
702
|
+
],
|
|
703
|
+
},
|
|
704
|
+
}, ["query"]);
|
|
705
|
+
browser("management.bookmarks.getTree");
|
|
706
|
+
browser("management.bookmarks.create", {
|
|
707
|
+
options: optionalObject({
|
|
708
|
+
parentId: id,
|
|
709
|
+
index: { type: "integer", minimum: 0 },
|
|
710
|
+
title: string,
|
|
711
|
+
url: string,
|
|
712
|
+
}),
|
|
713
|
+
});
|
|
714
|
+
browser("management.bookmarks.update", { id, options: optionalObject({ title: string, url: string }) }, ["id", "options"]);
|
|
715
|
+
browser("management.bookmarks.move", {
|
|
716
|
+
id,
|
|
717
|
+
options: optionalObject({
|
|
718
|
+
parentId: id,
|
|
719
|
+
index: { type: "integer", minimum: 0 },
|
|
720
|
+
}),
|
|
721
|
+
}, ["id", "options"]);
|
|
722
|
+
browser("management.bookmarks.remove", { id }, ["id"]);
|
|
723
|
+
browser("management.getAuditTrail", {
|
|
724
|
+
options: optionalObject({
|
|
725
|
+
limit: { type: "integer", minimum: 1, maximum: 100 },
|
|
726
|
+
cursor: string,
|
|
727
|
+
}),
|
|
728
|
+
});
|
|
729
|
+
tab("pageAssets.list");
|
|
730
|
+
tab("pageAssets.download", { urls: array(string, 128) }, ["urls"]);
|
|
731
|
+
tab("pageAssets.bundle", {
|
|
732
|
+
options: object({
|
|
733
|
+
inventoryId: id,
|
|
734
|
+
assetIds: array(id, 128),
|
|
735
|
+
kinds: array(enumOf("font", "image", "stylesheet", "video"), 4),
|
|
736
|
+
}, ["inventoryId"]),
|
|
737
|
+
}, ["options"]);
|
|
738
|
+
tab("webmcp.listTools");
|
|
739
|
+
tab("webmcp.fetchTools");
|
|
740
|
+
tab("webmcp.invokeTool", {
|
|
741
|
+
name: string,
|
|
742
|
+
args: {},
|
|
743
|
+
tool: object({
|
|
744
|
+
documentRevision: id,
|
|
745
|
+
registrationRevision: id,
|
|
746
|
+
name: string,
|
|
747
|
+
description: string,
|
|
748
|
+
inputSchema: { type: "object" },
|
|
749
|
+
annotations: { type: "object" },
|
|
750
|
+
}, ["documentRevision", "registrationRevision", "name", "inputSchema"]),
|
|
751
|
+
}, ["name", "args", "tool"]);
|
|
752
|
+
tab("cdp.send", {
|
|
753
|
+
method: id,
|
|
754
|
+
params: { type: "object" },
|
|
755
|
+
options: optionalObject({ target: cdpTarget, timeoutMs: timeout }),
|
|
756
|
+
}, ["method"]);
|
|
757
|
+
tab("cdp.events", { cursor: string });
|
|
758
|
+
tab("cdp.cursor");
|
|
759
|
+
tab("cdp.readEvents", {
|
|
760
|
+
options: optionalObject({
|
|
761
|
+
afterSequence: { type: "integer", minimum: 0 },
|
|
762
|
+
limit: { type: "integer", minimum: 1, maximum: 1000 },
|
|
763
|
+
methods: array(id, 128),
|
|
764
|
+
target: cdpTarget,
|
|
765
|
+
timeoutMs: timeout,
|
|
766
|
+
}),
|
|
767
|
+
});
|
|
768
|
+
function freeze(value) {
|
|
769
|
+
if (value && typeof value === "object") {
|
|
770
|
+
for (const child of Object.values(value))
|
|
771
|
+
freeze(child);
|
|
772
|
+
Object.freeze(value);
|
|
773
|
+
}
|
|
774
|
+
return value;
|
|
775
|
+
}
|
|
776
|
+
export const browserRoutes = freeze(routes);
|
|
777
|
+
//# sourceMappingURL=routes.js.map
|