opensteer 0.8.12 → 0.8.14
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 +147 -273
- package/dist/{chunk-AXTKKAPW.js → chunk-BRUJHMWO.js} +8333 -15566
- package/dist/chunk-BRUJHMWO.js.map +1 -0
- package/dist/cli/bin.cjs +10649 -16706
- package/dist/cli/bin.cjs.map +1 -1
- package/dist/cli/bin.js +2121 -949
- package/dist/cli/bin.js.map +1 -1
- package/dist/index.cjs +7880 -15161
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +267 -684
- package/dist/index.d.ts +267 -684
- package/dist/index.js +145 -192
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/skills/opensteer/SKILL.md +317 -51
- package/skills/opensteer/references/cli-reference.md +68 -212
- package/skills/opensteer/references/request-workflow.md +95 -342
- package/skills/opensteer/references/sdk-reference.md +83 -338
- package/dist/chunk-AXTKKAPW.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,35 @@
|
|
|
1
|
-
import { resolveOpensteerEnvironment, resolveOpensteerRuntimeConfig, createOpensteerSemanticRuntime, OpensteerBrowserManager } from './chunk-
|
|
2
|
-
export { CloudSessionProxy, DEFAULT_OPENSTEER_ENGINE, DEFERRED_MATCH_ATTR_KEYS, ElementPathError, MATCH_ATTRIBUTE_PRIORITY, OPENSTEER_DOM_ACTION_BRIDGE_SYMBOL, OPENSTEER_ENGINE_NAMES, OPENSTEER_FILESYSTEM_WORKSPACE_LAYOUT, OPENSTEER_FILESYSTEM_WORKSPACE_VERSION, OpensteerAttachAmbiguousError, OpensteerBrowserManager, OpensteerCloudClient, OpensteerRuntime, OpensteerSessionRuntime, STABLE_PRIMARY_ATTR_KEYS, assertProviderSupportsEngine, buildArrayFieldPathCandidates, buildDomDescriptorKey, buildDomDescriptorPayload, buildDomDescriptorVersion, buildPathCandidates, buildPathSelectorHint, buildSegmentSelector, clearPersistedSessionRecord, cloneElementPath, cloneReplayElementPath, cloneStructuralElementAnchor, createArtifactStore, createDomDescriptorStore, createDomRuntime, createFilesystemOpensteerWorkspace, createObservationStore, createOpensteerExtractionDescriptorStore, createOpensteerSemanticRuntime, defaultFallbackPolicy, defaultPolicy, defaultRetryPolicy, defaultSettlePolicy, defaultTimeoutPolicy, delayWithSignal, discoverLocalCdpBrowsers, dispatchSemanticOperation,
|
|
1
|
+
import { resolveOpensteerEnvironment, resolveOpensteerRuntimeConfig, createOpensteerSemanticRuntime, OpensteerBrowserManager } from './chunk-BRUJHMWO.js';
|
|
2
|
+
export { CloudSessionProxy, DEFAULT_OPENSTEER_ENGINE, DEFERRED_MATCH_ATTR_KEYS, ElementPathError, MATCH_ATTRIBUTE_PRIORITY, OPENSTEER_DOM_ACTION_BRIDGE_SYMBOL, OPENSTEER_ENGINE_NAMES, OPENSTEER_FILESYSTEM_WORKSPACE_LAYOUT, OPENSTEER_FILESYSTEM_WORKSPACE_VERSION, OpensteerAttachAmbiguousError, OpensteerBrowserManager, OpensteerCloudClient, OpensteerRuntime, OpensteerSessionRuntime, STABLE_PRIMARY_ATTR_KEYS, assertProviderSupportsEngine, buildArrayFieldPathCandidates, buildDomDescriptorKey, buildDomDescriptorPayload, buildDomDescriptorVersion, buildPathCandidates, buildPathSelectorHint, buildSegmentSelector, clearPersistedSessionRecord, cloneElementPath, cloneReplayElementPath, cloneStructuralElementAnchor, createArtifactStore, createDomDescriptorStore, createDomRuntime, createFilesystemOpensteerWorkspace, createObservationStore, createOpensteerExtractionDescriptorStore, createOpensteerSemanticRuntime, defaultFallbackPolicy, defaultPolicy, defaultRetryPolicy, defaultSettlePolicy, defaultTimeoutPolicy, delayWithSignal, discoverLocalCdpBrowsers, dispatchSemanticOperation, hashDomDescriptorName, inspectCdpEndpoint, isCurrentUrlField, isValidCssAttributeKey, listLocalChromeProfiles, manifestToExternalBinaryLocation, normalizeExtractedValue, normalizeObservabilityConfig, normalizeOpensteerEngineName, normalizeOpensteerProviderMode, normalizeWorkspaceId, parseDomDescriptorRecord, parseExtractionDescriptorRecord, readPersistedCloudSessionRecord, readPersistedLocalBrowserSessionRecord, readPersistedSessionRecord, resolveCloudConfig, resolveCloudSessionRecordPath, resolveDomActionBridge, resolveExtractedValueInContext, resolveFilesystemWorkspacePath, resolveLiveSessionRecordPath, resolveLocalSessionRecordPath, resolveOpensteerEngineName, resolveOpensteerProvider, resolveOpensteerRuntimeConfig, runWithPolicyTimeout, sanitizeElementPath, sanitizeReplayElementPath, sanitizeStructuralElementAnchor, settleWithPolicy, shouldKeepAttributeForPath, writePersistedSessionRecord } from './chunk-BRUJHMWO.js';
|
|
3
3
|
|
|
4
4
|
// src/sdk/opensteer.ts
|
|
5
|
+
var SessionCookieJar = class {
|
|
6
|
+
domain;
|
|
7
|
+
cookies;
|
|
8
|
+
constructor(output) {
|
|
9
|
+
if (output.domain !== void 0) {
|
|
10
|
+
this.domain = output.domain;
|
|
11
|
+
}
|
|
12
|
+
this.cookies = output.cookies;
|
|
13
|
+
}
|
|
14
|
+
has(name) {
|
|
15
|
+
return this.cookies.some((cookie) => cookie.name === name);
|
|
16
|
+
}
|
|
17
|
+
get(name) {
|
|
18
|
+
return this.cookies.find((cookie) => cookie.name === name)?.value;
|
|
19
|
+
}
|
|
20
|
+
getAll() {
|
|
21
|
+
return this.cookies;
|
|
22
|
+
}
|
|
23
|
+
serialize() {
|
|
24
|
+
return this.cookies.map((cookie) => `${cookie.name}=${cookie.value}`).join("; ");
|
|
25
|
+
}
|
|
26
|
+
};
|
|
5
27
|
var Opensteer = class {
|
|
6
28
|
runtime;
|
|
7
29
|
browserManager;
|
|
8
30
|
browser;
|
|
31
|
+
dom;
|
|
32
|
+
network;
|
|
9
33
|
constructor(options = {}) {
|
|
10
34
|
const environment = resolveOpensteerEnvironment(options.rootDir);
|
|
11
35
|
const { provider, engineName, ...runtimeOptions } = options;
|
|
@@ -15,41 +39,53 @@ var Opensteer = class {
|
|
|
15
39
|
});
|
|
16
40
|
if (runtimeConfig.provider.mode === "cloud") {
|
|
17
41
|
this.browserManager = void 0;
|
|
42
|
+
this.runtime = createOpensteerSemanticRuntime({
|
|
43
|
+
...provider === void 0 ? {} : { provider },
|
|
44
|
+
...engineName === void 0 ? {} : { engine: engineName },
|
|
45
|
+
environment,
|
|
46
|
+
runtimeOptions
|
|
47
|
+
});
|
|
48
|
+
this.browser = createUnsupportedBrowserController();
|
|
49
|
+
} else {
|
|
50
|
+
this.browserManager = new OpensteerBrowserManager({
|
|
51
|
+
...runtimeOptions.rootDir === void 0 ? {} : { rootDir: runtimeOptions.rootDir },
|
|
52
|
+
...runtimeOptions.rootPath === void 0 ? {} : { rootPath: runtimeOptions.rootPath },
|
|
53
|
+
...runtimeOptions.workspace === void 0 ? {} : { workspace: runtimeOptions.workspace },
|
|
54
|
+
...engineName === void 0 ? {} : { engineName },
|
|
55
|
+
...runtimeOptions.browser === void 0 ? {} : { browser: runtimeOptions.browser },
|
|
56
|
+
...runtimeOptions.launch === void 0 ? {} : { launch: runtimeOptions.launch },
|
|
57
|
+
...runtimeOptions.context === void 0 ? {} : { context: runtimeOptions.context }
|
|
58
|
+
});
|
|
18
59
|
this.runtime = createOpensteerSemanticRuntime({
|
|
19
60
|
...provider === void 0 ? {} : { provider },
|
|
20
61
|
...engineName === void 0 ? {} : { engine: engineName },
|
|
21
62
|
environment,
|
|
22
63
|
runtimeOptions: {
|
|
23
|
-
...runtimeOptions
|
|
64
|
+
...runtimeOptions,
|
|
65
|
+
rootPath: this.browserManager.rootPath,
|
|
66
|
+
cleanupRootOnClose: this.browserManager.cleanupRootOnDisconnect
|
|
24
67
|
}
|
|
25
68
|
});
|
|
26
|
-
this.browser =
|
|
27
|
-
|
|
69
|
+
this.browser = {
|
|
70
|
+
status: () => this.browserManager.status(),
|
|
71
|
+
clone: (input) => this.browserManager.clonePersistentBrowser(input),
|
|
72
|
+
reset: () => this.browserManager.reset(),
|
|
73
|
+
delete: () => this.browserManager.delete()
|
|
74
|
+
};
|
|
28
75
|
}
|
|
29
|
-
this.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
runtimeOptions: {
|
|
43
|
-
...runtimeOptions,
|
|
44
|
-
rootPath: this.browserManager.rootPath,
|
|
45
|
-
cleanupRootOnClose: this.browserManager.cleanupRootOnDisconnect
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
this.browser = {
|
|
49
|
-
status: () => this.browserManager.status(),
|
|
50
|
-
clone: (input) => this.browserManager.clonePersistentBrowser(input),
|
|
51
|
-
reset: () => this.browserManager.reset(),
|
|
52
|
-
delete: () => this.browserManager.delete()
|
|
76
|
+
this.dom = {
|
|
77
|
+
click: (input) => this.click(input),
|
|
78
|
+
hover: (input) => this.hover(input),
|
|
79
|
+
input: (input) => this.input(input),
|
|
80
|
+
scroll: (input) => this.scroll(input)
|
|
81
|
+
};
|
|
82
|
+
this.network = {
|
|
83
|
+
query: (input = {}) => this.queryNetwork(input),
|
|
84
|
+
detail: (recordId) => this.runtime.getNetworkDetail({ recordId }),
|
|
85
|
+
replay: (recordId, overrides = {}) => this.runtime.replayNetwork({
|
|
86
|
+
recordId,
|
|
87
|
+
...overrides
|
|
88
|
+
})
|
|
53
89
|
};
|
|
54
90
|
}
|
|
55
91
|
async open(input = {}) {
|
|
@@ -70,58 +106,56 @@ var Opensteer = class {
|
|
|
70
106
|
async closePage(input = {}) {
|
|
71
107
|
return this.runtime.closePage(input);
|
|
72
108
|
}
|
|
73
|
-
async goto(
|
|
74
|
-
return this.runtime.goto(
|
|
109
|
+
async goto(url, options = {}) {
|
|
110
|
+
return this.runtime.goto({
|
|
111
|
+
url,
|
|
112
|
+
...options
|
|
113
|
+
});
|
|
75
114
|
}
|
|
76
115
|
async evaluate(input) {
|
|
77
116
|
const normalized = typeof input === "string" ? {
|
|
78
117
|
script: input
|
|
79
118
|
} : input;
|
|
80
|
-
|
|
81
|
-
return result.value;
|
|
119
|
+
return (await this.runtime.evaluate(normalized)).value;
|
|
82
120
|
}
|
|
83
121
|
async evaluateJson(input) {
|
|
84
122
|
return this.evaluate(input);
|
|
85
123
|
}
|
|
86
124
|
async addInitScript(input) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
125
|
+
return this.runtime.addInitScript(
|
|
126
|
+
typeof input === "string" ? {
|
|
127
|
+
script: input
|
|
128
|
+
} : input
|
|
129
|
+
);
|
|
91
130
|
}
|
|
92
131
|
async click(input) {
|
|
93
132
|
const { button, clickCount, modifiers, ...target } = input;
|
|
94
|
-
|
|
133
|
+
return this.runtime.click({
|
|
95
134
|
...normalizeTargetOptions(target),
|
|
96
135
|
...button === void 0 ? {} : { button },
|
|
97
136
|
...clickCount === void 0 ? {} : { clickCount },
|
|
98
137
|
...modifiers === void 0 ? {} : { modifiers }
|
|
99
|
-
};
|
|
100
|
-
return this.runtime.click(normalized);
|
|
138
|
+
});
|
|
101
139
|
}
|
|
102
140
|
async hover(input) {
|
|
103
|
-
|
|
104
|
-
return this.runtime.hover(normalized);
|
|
141
|
+
return this.runtime.hover(normalizeTargetOptions(input));
|
|
105
142
|
}
|
|
106
143
|
async input(input) {
|
|
107
|
-
const normalized = normalizeTargetOptions(input);
|
|
108
144
|
return this.runtime.input({
|
|
109
|
-
...
|
|
145
|
+
...normalizeTargetOptions(input),
|
|
110
146
|
text: input.text,
|
|
111
147
|
...input.pressEnter === void 0 ? {} : { pressEnter: input.pressEnter }
|
|
112
148
|
});
|
|
113
149
|
}
|
|
114
150
|
async scroll(input) {
|
|
115
|
-
const normalized = normalizeTargetOptions(input);
|
|
116
151
|
return this.runtime.scroll({
|
|
117
|
-
...
|
|
152
|
+
...normalizeTargetOptions(input),
|
|
118
153
|
direction: input.direction,
|
|
119
154
|
amount: input.amount
|
|
120
155
|
});
|
|
121
156
|
}
|
|
122
157
|
async extract(input) {
|
|
123
|
-
|
|
124
|
-
return result.data;
|
|
158
|
+
return (await this.runtime.extract(input)).data;
|
|
125
159
|
}
|
|
126
160
|
async queryNetwork(input = {}) {
|
|
127
161
|
return this.runtime.queryNetwork(input);
|
|
@@ -131,17 +165,14 @@ var Opensteer = class {
|
|
|
131
165
|
const timeoutAt = Date.now() + (timeoutMs ?? 3e4);
|
|
132
166
|
const pollInterval = pollIntervalMs ?? 100;
|
|
133
167
|
const baseline = new Set(
|
|
134
|
-
(await this.runtime.queryNetwork({
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
})).records.map((record) => record.recordId)
|
|
168
|
+
(await this.runtime.queryNetwork({ ...query, limit: 200 })).records.map(
|
|
169
|
+
(record) => record.recordId
|
|
170
|
+
)
|
|
138
171
|
);
|
|
139
172
|
while (true) {
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
});
|
|
144
|
-
const next = records.find((record) => !baseline.has(record.recordId));
|
|
173
|
+
const next = (await this.runtime.queryNetwork({ ...query, limit: 200 })).records.find(
|
|
174
|
+
(record) => !baseline.has(record.recordId)
|
|
175
|
+
);
|
|
145
176
|
if (next !== void 0) {
|
|
146
177
|
return next;
|
|
147
178
|
}
|
|
@@ -159,8 +190,7 @@ var Opensteer = class {
|
|
|
159
190
|
const timeoutAt = Date.now() + (input.timeoutMs ?? 3e4);
|
|
160
191
|
const pollIntervalMs = input.pollIntervalMs ?? 100;
|
|
161
192
|
while (true) {
|
|
162
|
-
const
|
|
163
|
-
const match = pages.find((page) => {
|
|
193
|
+
const match = (await this.runtime.listPages()).pages.find((page) => {
|
|
164
194
|
if (baseline.has(page.pageRef)) {
|
|
165
195
|
return false;
|
|
166
196
|
}
|
|
@@ -181,131 +211,38 @@ var Opensteer = class {
|
|
|
181
211
|
await delay(pollIntervalMs);
|
|
182
212
|
}
|
|
183
213
|
}
|
|
184
|
-
async snapshot(
|
|
185
|
-
return this.runtime.snapshot(
|
|
186
|
-
}
|
|
187
|
-
async tagNetwork(input) {
|
|
188
|
-
return this.runtime.tagNetwork(input);
|
|
189
|
-
}
|
|
190
|
-
async minimizeNetwork(input) {
|
|
191
|
-
return this.runtime.minimizeNetwork(input);
|
|
192
|
-
}
|
|
193
|
-
async diffNetwork(input) {
|
|
194
|
-
return this.runtime.diffNetwork(input);
|
|
195
|
-
}
|
|
196
|
-
async probeNetwork(input) {
|
|
197
|
-
return this.runtime.probeNetwork(input);
|
|
198
|
-
}
|
|
199
|
-
async reverseDiscover(input = {}) {
|
|
200
|
-
return this.runtime.discoverReverse(input);
|
|
201
|
-
}
|
|
202
|
-
async reverseQuery(input) {
|
|
203
|
-
return this.runtime.queryReverse(input);
|
|
204
|
-
}
|
|
205
|
-
async createReversePackage(input) {
|
|
206
|
-
return this.runtime.createReversePackage(input);
|
|
207
|
-
}
|
|
208
|
-
async runReversePackage(input) {
|
|
209
|
-
return this.runtime.runReversePackage(input);
|
|
210
|
-
}
|
|
211
|
-
async reverseExport(input) {
|
|
212
|
-
return this.runtime.exportReverse(input);
|
|
213
|
-
}
|
|
214
|
-
async reverseReport(input) {
|
|
215
|
-
return this.runtime.getReverseReport(input);
|
|
216
|
-
}
|
|
217
|
-
async getReversePackage(input) {
|
|
218
|
-
return this.runtime.getReversePackage(input);
|
|
214
|
+
async snapshot(mode = "action") {
|
|
215
|
+
return (await this.runtime.snapshot({ mode })).html;
|
|
219
216
|
}
|
|
220
|
-
async
|
|
221
|
-
return
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
return this.runtime.patchReversePackage(input);
|
|
225
|
-
}
|
|
226
|
-
async interactionCapture(input) {
|
|
227
|
-
return this.runtime.captureInteraction(input);
|
|
228
|
-
}
|
|
229
|
-
async getInteraction(input) {
|
|
230
|
-
return this.runtime.getInteraction(input);
|
|
231
|
-
}
|
|
232
|
-
async interactionDiff(input) {
|
|
233
|
-
return this.runtime.diffInteraction(input);
|
|
234
|
-
}
|
|
235
|
-
async interactionReplay(input) {
|
|
236
|
-
return this.runtime.replayInteraction(input);
|
|
237
|
-
}
|
|
238
|
-
async clearNetwork(input = {}) {
|
|
239
|
-
return this.runtime.clearNetwork(input);
|
|
240
|
-
}
|
|
241
|
-
async captureScripts(input = {}) {
|
|
242
|
-
return this.runtime.captureScripts(input);
|
|
243
|
-
}
|
|
244
|
-
async readArtifact(input) {
|
|
245
|
-
return this.runtime.readArtifact(input);
|
|
246
|
-
}
|
|
247
|
-
async beautifyScript(input) {
|
|
248
|
-
return this.runtime.beautifyScript(input);
|
|
249
|
-
}
|
|
250
|
-
async deobfuscateScript(input) {
|
|
251
|
-
return this.runtime.deobfuscateScript(input);
|
|
252
|
-
}
|
|
253
|
-
async sandboxScript(input) {
|
|
254
|
-
return this.runtime.sandboxScript(input);
|
|
255
|
-
}
|
|
256
|
-
async solveCaptcha(input) {
|
|
257
|
-
return this.runtime.solveCaptcha(input);
|
|
258
|
-
}
|
|
259
|
-
async getCookies(input = {}) {
|
|
260
|
-
return this.runtime.getCookies(input);
|
|
261
|
-
}
|
|
262
|
-
async getStorageSnapshot(input = {}) {
|
|
263
|
-
return this.runtime.getStorageSnapshot(input);
|
|
264
|
-
}
|
|
265
|
-
async writeRequestPlan(input) {
|
|
266
|
-
return this.runtime.writeRequestPlan(input);
|
|
267
|
-
}
|
|
268
|
-
async inferRequestPlan(input) {
|
|
269
|
-
return this.runtime.inferRequestPlan(input);
|
|
270
|
-
}
|
|
271
|
-
async getRequestPlan(input) {
|
|
272
|
-
return this.runtime.getRequestPlan(input);
|
|
273
|
-
}
|
|
274
|
-
async listRequestPlans(input = {}) {
|
|
275
|
-
return this.runtime.listRequestPlans(input);
|
|
276
|
-
}
|
|
277
|
-
async writeAuthRecipe(input) {
|
|
278
|
-
return this.runtime.writeAuthRecipe(input);
|
|
279
|
-
}
|
|
280
|
-
async writeRecipe(input) {
|
|
281
|
-
return this.runtime.writeRecipe(input);
|
|
282
|
-
}
|
|
283
|
-
async getAuthRecipe(input) {
|
|
284
|
-
return this.runtime.getAuthRecipe(input);
|
|
285
|
-
}
|
|
286
|
-
async getRecipe(input) {
|
|
287
|
-
return this.runtime.getRecipe(input);
|
|
288
|
-
}
|
|
289
|
-
async listAuthRecipes(input = {}) {
|
|
290
|
-
return this.runtime.listAuthRecipes(input);
|
|
291
|
-
}
|
|
292
|
-
async listRecipes(input = {}) {
|
|
293
|
-
return this.runtime.listRecipes(input);
|
|
217
|
+
async cookies(domain) {
|
|
218
|
+
return new SessionCookieJar(
|
|
219
|
+
await this.runtime.getCookies(domain === void 0 ? {} : { domain })
|
|
220
|
+
);
|
|
294
221
|
}
|
|
295
|
-
async
|
|
296
|
-
|
|
222
|
+
async storage(domain, type = "local") {
|
|
223
|
+
const snapshot = await this.runtime.getStorageSnapshot(domain === void 0 ? {} : { domain });
|
|
224
|
+
const domainSnapshot = pickStorageDomainSnapshot(snapshot, domain);
|
|
225
|
+
if (domainSnapshot === void 0) {
|
|
226
|
+
return {};
|
|
227
|
+
}
|
|
228
|
+
const entries = type === "local" ? domainSnapshot.localStorage : domainSnapshot.sessionStorage;
|
|
229
|
+
return Object.fromEntries(entries.map((entry) => [entry.key, entry.value]));
|
|
297
230
|
}
|
|
298
|
-
async
|
|
299
|
-
return this.runtime.
|
|
231
|
+
async state(domain) {
|
|
232
|
+
return this.runtime.getBrowserState(domain === void 0 ? {} : { domain });
|
|
300
233
|
}
|
|
301
|
-
async
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
...
|
|
234
|
+
async fetch(url, options = {}) {
|
|
235
|
+
const result = await this.runtime.fetch({
|
|
236
|
+
url,
|
|
237
|
+
...options
|
|
305
238
|
});
|
|
239
|
+
if (result.response === void 0) {
|
|
240
|
+
throw new Error(result.note ?? `session.fetch did not produce a response for ${url}`);
|
|
241
|
+
}
|
|
242
|
+
return toResponse(result.response);
|
|
306
243
|
}
|
|
307
|
-
async
|
|
308
|
-
return this.runtime.
|
|
244
|
+
async computerExecute(input) {
|
|
245
|
+
return this.runtime.computerExecute(input);
|
|
309
246
|
}
|
|
310
247
|
async route(input) {
|
|
311
248
|
return this.requireOwnedInstrumentationRuntime("route").route(input);
|
|
@@ -313,9 +250,6 @@ var Opensteer = class {
|
|
|
313
250
|
async interceptScript(input) {
|
|
314
251
|
return this.requireOwnedInstrumentationRuntime("interceptScript").interceptScript(input);
|
|
315
252
|
}
|
|
316
|
-
async computerExecute(input) {
|
|
317
|
-
return this.runtime.computerExecute(input);
|
|
318
|
-
}
|
|
319
253
|
async close() {
|
|
320
254
|
if (this.browserManager === void 0 || this.browserManager.mode === "temporary") {
|
|
321
255
|
return this.runtime.close();
|
|
@@ -328,15 +262,12 @@ var Opensteer = class {
|
|
|
328
262
|
await this.runtime.disconnect();
|
|
329
263
|
}
|
|
330
264
|
requireOwnedInstrumentationRuntime(method) {
|
|
331
|
-
if (
|
|
265
|
+
if (typeof this.runtime.route === "function" && typeof this.runtime.interceptScript === "function") {
|
|
332
266
|
return this.runtime;
|
|
333
267
|
}
|
|
334
268
|
throw new Error(`${method}() is not available for this session runtime.`);
|
|
335
269
|
}
|
|
336
270
|
};
|
|
337
|
-
function isInstrumentableRuntime(runtime) {
|
|
338
|
-
return typeof runtime.route === "function" && typeof runtime.interceptScript === "function";
|
|
339
|
-
}
|
|
340
271
|
function createUnsupportedBrowserController() {
|
|
341
272
|
const fail = async () => {
|
|
342
273
|
throw new Error("browser.* helpers are only available in local mode.");
|
|
@@ -352,7 +283,7 @@ function normalizeTargetOptions(input) {
|
|
|
352
283
|
const hasElement = input.element !== void 0;
|
|
353
284
|
const hasSelector = input.selector !== void 0;
|
|
354
285
|
if (hasElement && hasSelector) {
|
|
355
|
-
throw new Error("Specify exactly one of element, selector, or
|
|
286
|
+
throw new Error("Specify exactly one of element, selector, or persist.");
|
|
356
287
|
}
|
|
357
288
|
if (hasElement) {
|
|
358
289
|
return {
|
|
@@ -360,7 +291,7 @@ function normalizeTargetOptions(input) {
|
|
|
360
291
|
kind: "element",
|
|
361
292
|
element: input.element
|
|
362
293
|
},
|
|
363
|
-
...input.
|
|
294
|
+
...input.persist === void 0 ? {} : { persist: input.persist },
|
|
364
295
|
...input.captureNetwork === void 0 ? {} : { captureNetwork: input.captureNetwork }
|
|
365
296
|
};
|
|
366
297
|
}
|
|
@@ -370,21 +301,43 @@ function normalizeTargetOptions(input) {
|
|
|
370
301
|
kind: "selector",
|
|
371
302
|
selector: input.selector
|
|
372
303
|
},
|
|
373
|
-
...input.
|
|
304
|
+
...input.persist === void 0 ? {} : { persist: input.persist },
|
|
374
305
|
...input.captureNetwork === void 0 ? {} : { captureNetwork: input.captureNetwork }
|
|
375
306
|
};
|
|
376
307
|
}
|
|
377
|
-
if (input.
|
|
378
|
-
throw new Error("Specify exactly one of element, selector, or
|
|
308
|
+
if (input.persist === void 0) {
|
|
309
|
+
throw new Error("Specify exactly one of element, selector, or persist.");
|
|
379
310
|
}
|
|
380
311
|
return {
|
|
381
312
|
target: {
|
|
382
|
-
kind: "
|
|
383
|
-
|
|
313
|
+
kind: "persist",
|
|
314
|
+
name: input.persist
|
|
384
315
|
},
|
|
385
316
|
...input.captureNetwork === void 0 ? {} : { captureNetwork: input.captureNetwork }
|
|
386
317
|
};
|
|
387
318
|
}
|
|
319
|
+
function pickStorageDomainSnapshot(snapshot, domain) {
|
|
320
|
+
if (snapshot.domains.length === 0) {
|
|
321
|
+
return void 0;
|
|
322
|
+
}
|
|
323
|
+
if (domain === void 0) {
|
|
324
|
+
return snapshot.domains[0];
|
|
325
|
+
}
|
|
326
|
+
return snapshot.domains.find((entry) => entry.domain === domain);
|
|
327
|
+
}
|
|
328
|
+
function toResponse(response) {
|
|
329
|
+
return new Response(decodeBody(response), {
|
|
330
|
+
status: response.status,
|
|
331
|
+
statusText: response.statusText,
|
|
332
|
+
headers: Object.fromEntries(response.headers.map((header) => [header.name, header.value]))
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
function decodeBody(response) {
|
|
336
|
+
if (response.body === void 0) {
|
|
337
|
+
return void 0;
|
|
338
|
+
}
|
|
339
|
+
return Uint8Array.from(Buffer.from(response.body.data, "base64"));
|
|
340
|
+
}
|
|
388
341
|
function delay(ms) {
|
|
389
342
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
390
343
|
}
|