opensteer 0.9.4 → 0.9.6

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.
Files changed (33) hide show
  1. package/dist/{chunk-ZRF7WMS3.js → chunk-3I3A5OLB.js} +3 -3
  2. package/dist/{chunk-ZRF7WMS3.js.map → chunk-3I3A5OLB.js.map} +1 -1
  3. package/dist/{chunk-GSCQQKZZ.js → chunk-3XBQRZZC.js} +221 -6
  4. package/dist/chunk-3XBQRZZC.js.map +1 -0
  5. package/dist/{chunk-GEUHKPC2.js → chunk-BVRIPCWA.js} +878 -572
  6. package/dist/chunk-BVRIPCWA.js.map +1 -0
  7. package/dist/chunk-L4NF74KI.js +458 -0
  8. package/dist/chunk-L4NF74KI.js.map +1 -0
  9. package/dist/cli/bin.cjs +1313 -494
  10. package/dist/cli/bin.cjs.map +1 -1
  11. package/dist/cli/bin.js +235 -108
  12. package/dist/cli/bin.js.map +1 -1
  13. package/dist/index.cjs +1152 -647
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +37 -460
  16. package/dist/index.d.ts +37 -460
  17. package/dist/index.js +3 -4
  18. package/dist/local-view/serve-entry.cjs +5354 -4
  19. package/dist/local-view/serve-entry.cjs.map +1 -1
  20. package/dist/local-view/serve-entry.js +1 -1
  21. package/dist/opensteer-UGA6YBRN.js +6 -0
  22. package/dist/{opensteer-PJI7VUIT.js.map → opensteer-UGA6YBRN.js.map} +1 -1
  23. package/dist/{session-control-M3JD7ZKA.js → session-control-U3L5H2ZI.js} +3 -3
  24. package/dist/{session-control-M3JD7ZKA.js.map → session-control-U3L5H2ZI.js.map} +1 -1
  25. package/package.json +7 -7
  26. package/skills/opensteer/SKILL.md +134 -94
  27. package/dist/chunk-GEUHKPC2.js.map +0 -1
  28. package/dist/chunk-GSCQQKZZ.js.map +0 -1
  29. package/dist/chunk-HQCMXRBE.js +0 -335
  30. package/dist/chunk-HQCMXRBE.js.map +0 -1
  31. package/dist/chunk-KCINASQC.js +0 -3
  32. package/dist/chunk-KCINASQC.js.map +0 -1
  33. package/dist/opensteer-PJI7VUIT.js +0 -6
@@ -1,335 +0,0 @@
1
- import { resolveOpensteerEnvironment, resolveOpensteerRuntimeConfig, createOpensteerSemanticRuntime } from './chunk-GEUHKPC2.js';
2
- import { OpensteerBrowserManager } from './chunk-GSCQQKZZ.js';
3
-
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
- };
27
- var Opensteer = class {
28
- runtime;
29
- browserManager;
30
- browser;
31
- dom;
32
- network;
33
- constructor(options = {}) {
34
- const environment = resolveOpensteerEnvironment(options.rootDir);
35
- const { provider, engineName, ...runtimeOptions } = options;
36
- const runtimeConfig = resolveOpensteerRuntimeConfig({
37
- ...provider === void 0 ? {} : { provider },
38
- environment
39
- });
40
- if (runtimeConfig.provider.mode === "cloud") {
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
- environment,
56
- ...runtimeOptions.browser === void 0 ? {} : { browser: runtimeOptions.browser },
57
- ...runtimeOptions.launch === void 0 ? {} : { launch: runtimeOptions.launch },
58
- ...runtimeOptions.context === void 0 ? {} : { context: runtimeOptions.context }
59
- });
60
- this.runtime = createOpensteerSemanticRuntime({
61
- ...provider === void 0 ? {} : { provider },
62
- ...engineName === void 0 ? {} : { engine: engineName },
63
- environment,
64
- runtimeOptions: {
65
- ...runtimeOptions,
66
- rootPath: this.browserManager.rootPath,
67
- cleanupRootOnClose: this.browserManager.cleanupRootOnDisconnect
68
- }
69
- });
70
- this.browser = {
71
- status: () => this.browserManager.status(),
72
- clone: (input) => this.browserManager.clonePersistentBrowser(input),
73
- reset: () => this.browserManager.reset(),
74
- delete: () => this.browserManager.delete()
75
- };
76
- }
77
- this.dom = {
78
- click: (input) => this.click(input),
79
- hover: (input) => this.hover(input),
80
- input: (input) => this.input(input),
81
- scroll: (input) => this.scroll(input)
82
- };
83
- this.network = {
84
- query: (input = {}) => this.runtime.queryNetwork(input),
85
- detail: (recordId, options2) => this.runtime.getNetworkDetail({ recordId, ...options2 })
86
- };
87
- }
88
- async open(input = {}) {
89
- return this.runtime.open(typeof input === "string" ? { url: input } : input);
90
- }
91
- async info() {
92
- return this.runtime.info();
93
- }
94
- async listPages(input = {}) {
95
- return this.runtime.listPages(input);
96
- }
97
- async newPage(input = {}) {
98
- return this.runtime.newPage(input);
99
- }
100
- async activatePage(input) {
101
- return this.runtime.activatePage(input);
102
- }
103
- async closePage(input = {}) {
104
- return this.runtime.closePage(input);
105
- }
106
- async goto(url, options = {}) {
107
- return this.runtime.goto({
108
- url,
109
- ...options
110
- });
111
- }
112
- async evaluate(input) {
113
- const normalized = typeof input === "string" ? {
114
- script: input
115
- } : input;
116
- return (await this.runtime.evaluate(normalized)).value;
117
- }
118
- async addInitScript(input) {
119
- return this.runtime.addInitScript(
120
- typeof input === "string" ? {
121
- script: input
122
- } : input
123
- );
124
- }
125
- async click(input) {
126
- const { button, clickCount, modifiers, ...target } = input;
127
- return this.runtime.click({
128
- ...normalizeTargetOptions(target),
129
- ...button === void 0 ? {} : { button },
130
- ...clickCount === void 0 ? {} : { clickCount },
131
- ...modifiers === void 0 ? {} : { modifiers }
132
- });
133
- }
134
- async hover(input) {
135
- return this.runtime.hover(normalizeTargetOptions(input));
136
- }
137
- async input(input) {
138
- return this.runtime.input({
139
- ...normalizeTargetOptions(input),
140
- text: input.text,
141
- ...input.pressEnter === void 0 ? {} : { pressEnter: input.pressEnter }
142
- });
143
- }
144
- async scroll(input) {
145
- return this.runtime.scroll({
146
- ...normalizeTargetOptions(input),
147
- direction: input.direction,
148
- amount: input.amount
149
- });
150
- }
151
- async extract(input) {
152
- return (await this.runtime.extract(input)).data;
153
- }
154
- async waitForPage(input = {}) {
155
- const baseline = new Set((await this.runtime.listPages()).pages.map((page) => page.pageRef));
156
- const timeoutAt = Date.now() + (input.timeoutMs ?? 3e4);
157
- const pollIntervalMs = input.pollIntervalMs ?? 100;
158
- while (true) {
159
- const match = (await this.runtime.listPages()).pages.find((page) => {
160
- if (baseline.has(page.pageRef)) {
161
- return false;
162
- }
163
- if (input.openerPageRef !== void 0 && page.openerPageRef !== input.openerPageRef) {
164
- return false;
165
- }
166
- if (input.urlIncludes !== void 0 && !page.url.includes(input.urlIncludes)) {
167
- return false;
168
- }
169
- return true;
170
- });
171
- if (match !== void 0) {
172
- return match;
173
- }
174
- if (Date.now() >= timeoutAt) {
175
- throw new Error("waitForPage timed out");
176
- }
177
- await delay(pollIntervalMs);
178
- }
179
- }
180
- async snapshot(mode = "action") {
181
- return (await this.runtime.snapshot({ mode })).html;
182
- }
183
- async cookies(domain) {
184
- return new SessionCookieJar(
185
- await this.runtime.getCookies(domain === void 0 ? {} : { domain })
186
- );
187
- }
188
- async storage(domain, type = "local") {
189
- const snapshot = await this.runtime.getStorageSnapshot(domain === void 0 ? {} : { domain });
190
- const domainSnapshot = pickStorageDomainSnapshot(snapshot, domain);
191
- if (domainSnapshot === void 0) {
192
- return {};
193
- }
194
- const entries = type === "local" ? domainSnapshot.localStorage : domainSnapshot.sessionStorage;
195
- return Object.fromEntries(entries.map((entry) => [entry.key, entry.value]));
196
- }
197
- async state(domain) {
198
- return this.runtime.getBrowserState(domain === void 0 ? {} : { domain });
199
- }
200
- async fetch(url, options = {}) {
201
- const input = buildFetchInput(url, options);
202
- const result = await this.runtime.fetch(input);
203
- if (result.response === void 0) {
204
- throw new Error(result.note ?? `session.fetch did not produce a response for ${url}`);
205
- }
206
- return toResponse(result.response);
207
- }
208
- async computerExecute(input) {
209
- return this.runtime.computerExecute(input);
210
- }
211
- async route(input) {
212
- return this.requireOwnedInstrumentationRuntime("route").route(input);
213
- }
214
- async interceptScript(input) {
215
- return this.requireOwnedInstrumentationRuntime("interceptScript").interceptScript(input);
216
- }
217
- async close() {
218
- if (this.browserManager === void 0 || this.browserManager.mode === "temporary") {
219
- return this.runtime.close();
220
- }
221
- const output = await this.runtime.close();
222
- await this.browserManager.close();
223
- return output;
224
- }
225
- async disconnect() {
226
- await this.runtime.disconnect();
227
- }
228
- requireOwnedInstrumentationRuntime(method) {
229
- if (typeof this.runtime.route === "function" && typeof this.runtime.interceptScript === "function") {
230
- return this.runtime;
231
- }
232
- throw new Error(`${method}() is not available for this session runtime.`);
233
- }
234
- };
235
- function createUnsupportedBrowserController() {
236
- const fail = async () => {
237
- throw new Error("browser.* helpers are only available in local mode.");
238
- };
239
- return {
240
- status: fail,
241
- clone: fail,
242
- reset: fail,
243
- delete: fail
244
- };
245
- }
246
- function normalizeTargetOptions(input) {
247
- const hasElement = input.element !== void 0;
248
- const hasSelector = input.selector !== void 0;
249
- if (hasElement && hasSelector) {
250
- throw new Error("Specify exactly one of element, selector, or persist.");
251
- }
252
- if (hasElement) {
253
- return {
254
- target: {
255
- kind: "element",
256
- element: input.element
257
- },
258
- ...input.persist === void 0 ? {} : { persist: input.persist },
259
- ...input.captureNetwork === void 0 ? {} : { captureNetwork: input.captureNetwork }
260
- };
261
- }
262
- if (hasSelector) {
263
- return {
264
- target: {
265
- kind: "selector",
266
- selector: input.selector
267
- },
268
- ...input.persist === void 0 ? {} : { persist: input.persist },
269
- ...input.captureNetwork === void 0 ? {} : { captureNetwork: input.captureNetwork }
270
- };
271
- }
272
- if (input.persist === void 0) {
273
- throw new Error("Specify exactly one of element, selector, or persist.");
274
- }
275
- return {
276
- target: {
277
- kind: "persist",
278
- persist: input.persist
279
- },
280
- ...input.captureNetwork === void 0 ? {} : { captureNetwork: input.captureNetwork }
281
- };
282
- }
283
- function pickStorageDomainSnapshot(snapshot, domain) {
284
- if (snapshot.domains.length === 0) {
285
- return void 0;
286
- }
287
- if (domain === void 0) {
288
- return snapshot.domains[0];
289
- }
290
- return snapshot.domains.find((entry) => entry.domain === domain);
291
- }
292
- function buildFetchInput(url, options) {
293
- const { body, ...rest } = options;
294
- return {
295
- url,
296
- ...rest,
297
- ...body === void 0 ? {} : { body: normalizeFetchBody(body, rest.headers) }
298
- };
299
- }
300
- function normalizeFetchBody(body, headers) {
301
- if (typeof body !== "string") {
302
- return body;
303
- }
304
- const contentType = findHeaderValue(headers, "content-type");
305
- return contentType === void 0 ? { text: body } : { text: body, contentType };
306
- }
307
- function findHeaderValue(headers, headerName) {
308
- if (headers === void 0) {
309
- return void 0;
310
- }
311
- const match = Object.entries(headers).find(
312
- ([name]) => name.toLowerCase() === headerName.toLowerCase()
313
- );
314
- return match === void 0 ? void 0 : String(match[1]);
315
- }
316
- function toResponse(response) {
317
- return new Response(decodeBody(response), {
318
- status: response.status,
319
- statusText: response.statusText,
320
- headers: Object.fromEntries(response.headers.map((header) => [header.name, header.value]))
321
- });
322
- }
323
- function decodeBody(response) {
324
- if (response.body === void 0) {
325
- return void 0;
326
- }
327
- return Uint8Array.from(Buffer.from(response.body.data, "base64"));
328
- }
329
- function delay(ms) {
330
- return new Promise((resolve) => setTimeout(resolve, ms));
331
- }
332
-
333
- export { Opensteer };
334
- //# sourceMappingURL=chunk-HQCMXRBE.js.map
335
- //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AY,QAAA,CAAS,UAAA;AAAA,IACrB,OAAA,EAAS,MAAA,CAAO,WAAA,CAAY,QAAA,CAAS,QAAQ,GAAA,CAAI,CAAC,MAAA,KAAW,CAAC,MAAA,CAAO,IAAA,EAAM,MAAA,CAAO,KAAK,CAAC,CAAC;AAAA,GAC1F,CAAA;AACH;AAEA,SAAS,WAAW,QAAA,EAAkE;AACpF,EAAA,IAAI,QAAA,CAAS,SAAS,MAAA,EAAW;AAC/B,IAAA,OAAO,MAAA;AAAA,EACT;AACA,EAAA,OAAO,UAAA,CAAW,KAAK,MAAA,CAAO,IAAA,CAAK,SAAS,IAAA,CAAK,IAAA,EAAM,QAAQ,CAAC,CAAA;AAClE;AAEA,SAAS,MAAM,EAAA,EAA2B;AACxC,EAAA,OAAO,IAAI,OAAA,CAAQ,CAAC,YAAY,UAAA,CAAW,OAAA,EAAS,EAAE,CAAC,CAAA;AACzD","file":"chunk-HQCMXRBE.js","sourcesContent":["import type {\n CookieRecord,\n OpensteerCookieQueryOutput,\n OpensteerActionResult,\n OpensteerAddInitScriptInput,\n OpensteerAddInitScriptOutput,\n OpensteerComputerExecuteInput,\n OpensteerComputerExecuteOutput,\n OpensteerComputerKeyModifier,\n OpensteerComputerMouseButton,\n OpensteerNetworkDetailOutput,\n OpensteerNetworkQueryInput,\n OpensteerNetworkQueryOutput,\n OpensteerOpenInput,\n OpensteerOpenOutput,\n OpensteerPageActivateInput,\n OpensteerPageActivateOutput,\n OpensteerPageCloseInput,\n OpensteerPageCloseOutput,\n OpensteerPageEvaluateInput,\n OpensteerPageEvaluateOutput,\n OpensteerPageGotoInput,\n OpensteerPageGotoOutput,\n OpensteerPageListInput,\n OpensteerPageListOutput,\n OpensteerPageNewInput,\n OpensteerPageNewOutput,\n OpensteerRequestBodyInput,\n OpensteerRequestResponseResult,\n OpensteerSessionCloseOutput,\n OpensteerSessionFetchInput,\n OpensteerSessionInfo,\n OpensteerSnapshotMode,\n OpensteerStateQueryOutput,\n OpensteerStorageArea,\n OpensteerStorageDomainSnapshot,\n OpensteerTargetInput,\n} from \"@opensteer/protocol\";\n\nimport {\n OpensteerBrowserManager,\n type OpensteerBrowserStatus,\n type WorkspaceBrowserManifest,\n} from \"../browser-manager.js\";\nimport { resolveOpensteerEnvironment } from \"../env.js\";\nimport type { OpensteerProviderOptions } from \"../provider/config.js\";\nimport type {\n OpensteerInterceptScriptOptions,\n OpensteerInstrumentableRuntime,\n OpensteerRouteOptions,\n OpensteerRouteRegistration,\n} from \"./instrumentation.js\";\nimport type { OpensteerRuntimeOptions } from \"./runtime.js\";\nimport {\n createOpensteerSemanticRuntime,\n resolveOpensteerRuntimeConfig,\n} from \"./runtime-resolution.js\";\nimport type { OpensteerDisconnectableRuntime } from \"./semantic-runtime.js\";\n\nexport interface OpensteerTargetOptions {\n readonly element?: number;\n readonly selector?: string;\n readonly persist?: string;\n readonly captureNetwork?: string;\n}\n\nexport interface OpensteerClickOptions extends OpensteerTargetOptions {\n readonly button?: OpensteerComputerMouseButton;\n readonly clickCount?: number;\n readonly modifiers?: readonly OpensteerComputerKeyModifier[];\n}\n\nexport interface OpensteerInputOptions extends OpensteerTargetOptions {\n readonly text: string;\n readonly pressEnter?: boolean;\n}\n\nexport interface OpensteerScrollOptions extends OpensteerTargetOptions {\n readonly direction: \"up\" | \"down\" | \"left\" | \"right\";\n readonly amount: number;\n}\n\nexport type OpensteerExtractOptions =\n | {\n readonly persist: string;\n readonly schema?: Record<string, unknown>;\n }\n | {\n readonly persist?: string;\n readonly schema: Record<string, unknown>;\n };\n\nexport interface OpensteerWaitForPageOptions {\n readonly openerPageRef?: string;\n readonly urlIncludes?: string;\n readonly timeoutMs?: number;\n readonly pollIntervalMs?: number;\n}\n\nexport type OpensteerAddInitScriptOptions = OpensteerAddInitScriptInput;\nexport type OpensteerGotoOptions = Omit<OpensteerPageGotoInput, \"url\">;\nexport type OpensteerNetworkQueryOptions = OpensteerNetworkQueryInput;\nexport type OpensteerNetworkQueryResult = OpensteerNetworkQueryOutput;\nexport type OpensteerNetworkDetailResult = OpensteerNetworkDetailOutput;\nexport type OpensteerFetchOptions = Omit<OpensteerSessionFetchInput, \"url\" | \"body\"> & {\n readonly body?: string | OpensteerRequestBodyInput;\n};\nexport type OpensteerComputerExecuteOptions = OpensteerComputerExecuteInput;\nexport type OpensteerStorageMap = Readonly<Record<string, string>>;\nexport type OpensteerBrowserState = OpensteerStateQueryOutput;\n\nexport interface OpensteerCookieJar {\n readonly domain?: string;\n has(name: string): boolean;\n get(name: string): string | undefined;\n getAll(): readonly CookieRecord[];\n serialize(): string;\n}\n\nexport interface OpensteerDomController {\n click(input: OpensteerClickOptions): Promise<OpensteerActionResult>;\n hover(input: OpensteerTargetOptions): Promise<OpensteerActionResult>;\n input(input: OpensteerInputOptions): Promise<OpensteerActionResult>;\n scroll(input: OpensteerScrollOptions): Promise<OpensteerActionResult>;\n}\n\nexport interface OpensteerNetworkController {\n query(input?: OpensteerNetworkQueryOptions): Promise<OpensteerNetworkQueryResult>;\n detail(\n recordId: string,\n options?: { readonly probe?: boolean },\n ): Promise<OpensteerNetworkDetailResult>;\n}\n\nexport interface OpensteerOptions extends OpensteerRuntimeOptions {\n readonly provider?: OpensteerProviderOptions;\n}\n\nexport interface OpensteerBrowserCloneOptions {\n readonly sourceUserDataDir: string;\n readonly sourceProfileDirectory?: string;\n}\n\nexport interface OpensteerBrowserController {\n status(): Promise<OpensteerBrowserStatus>;\n clone(input: OpensteerBrowserCloneOptions): Promise<WorkspaceBrowserManifest>;\n reset(): Promise<void>;\n delete(): Promise<void>;\n}\n\nclass SessionCookieJar implements OpensteerCookieJar {\n readonly domain?: string;\n private readonly cookies: readonly CookieRecord[];\n\n constructor(output: OpensteerCookieQueryOutput) {\n if (output.domain !== undefined) {\n this.domain = output.domain;\n }\n this.cookies = output.cookies;\n }\n\n has(name: string): boolean {\n return this.cookies.some((cookie) => cookie.name === name);\n }\n\n get(name: string): string | undefined {\n return this.cookies.find((cookie) => cookie.name === name)?.value;\n }\n\n getAll(): readonly CookieRecord[] {\n return this.cookies;\n }\n\n serialize(): string {\n return this.cookies.map((cookie) => `${cookie.name}=${cookie.value}`).join(\"; \");\n }\n}\n\nexport class Opensteer {\n private readonly runtime: OpensteerDisconnectableRuntime;\n private readonly browserManager: OpensteerBrowserManager | undefined;\n readonly browser: OpensteerBrowserController;\n readonly dom: OpensteerDomController;\n readonly network: OpensteerNetworkController;\n\n constructor(options: OpensteerOptions = {}) {\n const environment = resolveOpensteerEnvironment(options.rootDir);\n const { provider, engineName, ...runtimeOptions } = options;\n const runtimeConfig = resolveOpensteerRuntimeConfig({\n ...(provider === undefined ? {} : { provider }),\n environment,\n });\n\n if (runtimeConfig.provider.mode === \"cloud\") {\n this.browserManager = undefined;\n this.runtime = createOpensteerSemanticRuntime({\n ...(provider === undefined ? {} : { provider }),\n ...(engineName === undefined ? {} : { engine: engineName }),\n environment,\n runtimeOptions,\n });\n this.browser = createUnsupportedBrowserController();\n } else {\n this.browserManager = new OpensteerBrowserManager({\n ...(runtimeOptions.rootDir === undefined ? {} : { rootDir: runtimeOptions.rootDir }),\n ...(runtimeOptions.rootPath === undefined ? {} : { rootPath: runtimeOptions.rootPath }),\n ...(runtimeOptions.workspace === undefined ? {} : { workspace: runtimeOptions.workspace }),\n ...(engineName === undefined ? {} : { engineName }),\n environment,\n ...(runtimeOptions.browser === undefined ? {} : { browser: runtimeOptions.browser }),\n ...(runtimeOptions.launch === undefined ? {} : { launch: runtimeOptions.launch }),\n ...(runtimeOptions.context === undefined ? {} : { context: runtimeOptions.context }),\n });\n this.runtime = createOpensteerSemanticRuntime({\n ...(provider === undefined ? {} : { provider }),\n ...(engineName === undefined ? {} : { engine: engineName }),\n environment,\n runtimeOptions: {\n ...runtimeOptions,\n rootPath: this.browserManager.rootPath,\n cleanupRootOnClose: this.browserManager.cleanupRootOnDisconnect,\n },\n });\n this.browser = {\n status: () => this.browserManager!.status(),\n clone: (input) => this.browserManager!.clonePersistentBrowser(input),\n reset: () => this.browserManager!.reset(),\n delete: () => this.browserManager!.delete(),\n };\n }\n\n this.dom = {\n click: (input) => this.click(input),\n hover: (input) => this.hover(input),\n input: (input) => this.input(input),\n scroll: (input) => this.scroll(input),\n };\n\n this.network = {\n query: (input = {}) => this.runtime.queryNetwork(input),\n detail: (recordId, options) => this.runtime.getNetworkDetail({ recordId, ...options }),\n };\n }\n\n async open(input: string | OpensteerOpenInput = {}): Promise<OpensteerOpenOutput> {\n return this.runtime.open(typeof input === \"string\" ? { url: input } : input);\n }\n\n async info(): Promise<OpensteerSessionInfo> {\n return this.runtime.info();\n }\n\n async listPages(input: OpensteerPageListInput = {}): Promise<OpensteerPageListOutput> {\n return this.runtime.listPages(input);\n }\n\n async newPage(input: OpensteerPageNewInput = {}): Promise<OpensteerPageNewOutput> {\n return this.runtime.newPage(input);\n }\n\n async activatePage(input: OpensteerPageActivateInput): Promise<OpensteerPageActivateOutput> {\n return this.runtime.activatePage(input);\n }\n\n async closePage(input: OpensteerPageCloseInput = {}): Promise<OpensteerPageCloseOutput> {\n return this.runtime.closePage(input);\n }\n\n async goto(url: string, options: OpensteerGotoOptions = {}): Promise<OpensteerPageGotoOutput> {\n return this.runtime.goto({\n url,\n ...options,\n });\n }\n\n async evaluate(\n input: string | OpensteerPageEvaluateInput,\n ): Promise<OpensteerPageEvaluateOutput[\"value\"]> {\n const normalized =\n typeof input === \"string\"\n ? {\n script: input,\n }\n : input;\n return (await this.runtime.evaluate(normalized)).value;\n }\n\n async addInitScript(\n input: string | OpensteerAddInitScriptInput,\n ): Promise<OpensteerAddInitScriptOutput> {\n return this.runtime.addInitScript(\n typeof input === \"string\"\n ? {\n script: input,\n }\n : input,\n );\n }\n\n async click(input: OpensteerClickOptions): Promise<OpensteerActionResult> {\n const { button, clickCount, modifiers, ...target } = input;\n return this.runtime.click({\n ...normalizeTargetOptions(target),\n ...(button === undefined ? {} : { button }),\n ...(clickCount === undefined ? {} : { clickCount }),\n ...(modifiers === undefined ? {} : { modifiers }),\n });\n }\n\n async hover(input: OpensteerTargetOptions): Promise<OpensteerActionResult> {\n return this.runtime.hover(normalizeTargetOptions(input));\n }\n\n async input(input: OpensteerInputOptions): Promise<OpensteerActionResult> {\n return this.runtime.input({\n ...normalizeTargetOptions(input),\n text: input.text,\n ...(input.pressEnter === undefined ? {} : { pressEnter: input.pressEnter }),\n });\n }\n\n async scroll(input: OpensteerScrollOptions): Promise<OpensteerActionResult> {\n return this.runtime.scroll({\n ...normalizeTargetOptions(input),\n direction: input.direction,\n amount: input.amount,\n });\n }\n\n async extract(input: OpensteerExtractOptions): Promise<unknown> {\n return (await this.runtime.extract(input)).data;\n }\n\n async waitForPage(\n input: OpensteerWaitForPageOptions = {},\n ): Promise<OpensteerPageListOutput[\"pages\"][number]> {\n const baseline = new Set((await this.runtime.listPages()).pages.map((page) => page.pageRef));\n const timeoutAt = Date.now() + (input.timeoutMs ?? 30_000);\n const pollIntervalMs = input.pollIntervalMs ?? 100;\n\n while (true) {\n const match = (await this.runtime.listPages()).pages.find((page) => {\n if (baseline.has(page.pageRef)) {\n return false;\n }\n if (input.openerPageRef !== undefined && page.openerPageRef !== input.openerPageRef) {\n return false;\n }\n if (input.urlIncludes !== undefined && !page.url.includes(input.urlIncludes)) {\n return false;\n }\n return true;\n });\n if (match !== undefined) {\n return match;\n }\n if (Date.now() >= timeoutAt) {\n throw new Error(\"waitForPage timed out\");\n }\n await delay(pollIntervalMs);\n }\n }\n\n async snapshot(mode: OpensteerSnapshotMode = \"action\"): Promise<string> {\n return (await this.runtime.snapshot({ mode })).html;\n }\n\n async cookies(domain?: string): Promise<OpensteerCookieJar> {\n return new SessionCookieJar(\n await this.runtime.getCookies(domain === undefined ? {} : { domain }),\n );\n }\n\n async storage(\n domain?: string,\n type: OpensteerStorageArea = \"local\",\n ): Promise<OpensteerStorageMap> {\n const snapshot = await this.runtime.getStorageSnapshot(domain === undefined ? {} : { domain });\n const domainSnapshot = pickStorageDomainSnapshot(snapshot, domain);\n if (domainSnapshot === undefined) {\n return {};\n }\n const entries = type === \"local\" ? domainSnapshot.localStorage : domainSnapshot.sessionStorage;\n return Object.fromEntries(entries.map((entry) => [entry.key, entry.value]));\n }\n\n async state(domain?: string): Promise<OpensteerBrowserState> {\n return this.runtime.getBrowserState(domain === undefined ? {} : { domain });\n }\n\n async fetch(url: string, options: OpensteerFetchOptions = {}): Promise<Response> {\n const input = buildFetchInput(url, options);\n const result = await this.runtime.fetch(input);\n if (result.response === undefined) {\n throw new Error(result.note ?? `session.fetch did not produce a response for ${url}`);\n }\n return toResponse(result.response);\n }\n\n async computerExecute(\n input: OpensteerComputerExecuteOptions,\n ): Promise<OpensteerComputerExecuteOutput> {\n return this.runtime.computerExecute(input);\n }\n\n async route(input: OpensteerRouteOptions): Promise<OpensteerRouteRegistration> {\n return this.requireOwnedInstrumentationRuntime(\"route\").route(input);\n }\n\n async interceptScript(\n input: OpensteerInterceptScriptOptions,\n ): Promise<OpensteerRouteRegistration> {\n return this.requireOwnedInstrumentationRuntime(\"interceptScript\").interceptScript(input);\n }\n\n async close(): Promise<OpensteerSessionCloseOutput> {\n if (this.browserManager === undefined || this.browserManager.mode === \"temporary\") {\n return this.runtime.close();\n }\n\n const output = await this.runtime.close();\n await this.browserManager.close();\n return output;\n }\n\n async disconnect(): Promise<void> {\n await this.runtime.disconnect();\n }\n\n private requireOwnedInstrumentationRuntime(\n method: \"route\" | \"interceptScript\",\n ): OpensteerInstrumentableRuntime {\n if (\n typeof (this.runtime as Partial<OpensteerInstrumentableRuntime>).route === \"function\" &&\n typeof (this.runtime as Partial<OpensteerInstrumentableRuntime>).interceptScript ===\n \"function\"\n ) {\n return this.runtime as OpensteerDisconnectableRuntime & OpensteerInstrumentableRuntime;\n }\n throw new Error(`${method}() is not available for this session runtime.`);\n }\n}\n\nfunction createUnsupportedBrowserController(): OpensteerBrowserController {\n const fail = async (): Promise<never> => {\n throw new Error(\"browser.* helpers are only available in local mode.\");\n };\n\n return {\n status: fail,\n clone: fail,\n reset: fail,\n delete: fail,\n };\n}\n\nfunction normalizeTargetOptions(input: OpensteerTargetOptions): {\n readonly target: OpensteerTargetInput;\n readonly persist?: string;\n readonly captureNetwork?: string;\n} {\n const hasElement = input.element !== undefined;\n const hasSelector = input.selector !== undefined;\n if (hasElement && hasSelector) {\n throw new Error(\"Specify exactly one of element, selector, or persist.\");\n }\n\n if (hasElement) {\n return {\n target: {\n kind: \"element\",\n element: input.element,\n },\n ...(input.persist === undefined ? {} : { persist: input.persist }),\n ...(input.captureNetwork === undefined ? {} : { captureNetwork: input.captureNetwork }),\n };\n }\n\n if (hasSelector) {\n return {\n target: {\n kind: \"selector\",\n selector: input.selector,\n },\n ...(input.persist === undefined ? {} : { persist: input.persist }),\n ...(input.captureNetwork === undefined ? {} : { captureNetwork: input.captureNetwork }),\n };\n }\n\n if (input.persist === undefined) {\n throw new Error(\"Specify exactly one of element, selector, or persist.\");\n }\n\n return {\n target: {\n kind: \"persist\",\n persist: input.persist,\n },\n ...(input.captureNetwork === undefined ? {} : { captureNetwork: input.captureNetwork }),\n };\n}\n\nfunction pickStorageDomainSnapshot(\n snapshot: {\n readonly domains: readonly OpensteerStorageDomainSnapshot[];\n },\n domain: string | undefined,\n): OpensteerStorageDomainSnapshot | undefined {\n if (snapshot.domains.length === 0) {\n return undefined;\n }\n if (domain === undefined) {\n return snapshot.domains[0];\n }\n return snapshot.domains.find((entry) => entry.domain === domain);\n}\n\nfunction buildFetchInput(url: string, options: OpensteerFetchOptions): OpensteerSessionFetchInput {\n const { body, ...rest } = options;\n return {\n url,\n ...rest,\n ...(body === undefined ? {} : { body: normalizeFetchBody(body, rest.headers) }),\n };\n}\n\nfunction normalizeFetchBody(\n body: string | OpensteerRequestBodyInput,\n headers: OpensteerSessionFetchInput[\"headers\"],\n): OpensteerRequestBodyInput {\n if (typeof body !== \"string\") {\n return body;\n }\n\n const contentType = findHeaderValue(headers, \"content-type\");\n return contentType === undefined ? { text: body } : { text: body, contentType };\n}\n\nfunction findHeaderValue(\n headers: OpensteerSessionFetchInput[\"headers\"],\n headerName: string,\n): string | undefined {\n if (headers === undefined) {\n return undefined;\n }\n\n const match = Object.entries(headers).find(\n ([name]) => name.toLowerCase() === headerName.toLowerCase(),\n );\n return match === undefined ? undefined : String(match[1]);\n}\n\nfunction toResponse(response: OpensteerRequestResponseResult): Response {\n return new Response(decodeBody(response), {\n status: response.status,\n statusText: response.statusText,\n headers: Object.fromEntries(response.headers.map((header) => [header.name, header.value])),\n });\n}\n\nfunction decodeBody(response: OpensteerRequestResponseResult): Uint8Array | undefined {\n if (response.body === undefined) {\n return undefined;\n }\n return Uint8Array.from(Buffer.from(response.body.data, \"base64\"));\n}\n\nfunction delay(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n"]}
@@ -1,3 +0,0 @@
1
-
2
- //# sourceMappingURL=chunk-KCINASQC.js.map
3
- //# sourceMappingURL=chunk-KCINASQC.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-KCINASQC.js"}
@@ -1,6 +0,0 @@
1
- export { Opensteer } from './chunk-HQCMXRBE.js';
2
- import './chunk-GEUHKPC2.js';
3
- import './chunk-GSCQQKZZ.js';
4
- import './chunk-T5P2QGZ3.js';
5
- //# sourceMappingURL=opensteer-PJI7VUIT.js.map
6
- //# sourceMappingURL=opensteer-PJI7VUIT.js.map