opensteer 0.8.2 → 0.8.4

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.js CHANGED
@@ -1,5 +1,5 @@
1
- import { resolveOpensteerRuntimeConfig, createOpensteerSemanticRuntime, OpensteerBrowserManager, OpensteerRuntime } from './chunk-X3G6QSCF.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, STABLE_PRIMARY_ATTR_KEYS, buildArrayFieldPathCandidates, buildPathCandidates, buildPathSelectorHint, buildSegmentSelector, cloneElementPath, cloneReplayElementPath, cloneStructuralElementAnchor, createDomRuntime, createFilesystemOpensteerWorkspace, createOpensteerSemanticRuntime, defaultFallbackPolicy, defaultPolicy, defaultRetryPolicy, defaultSettlePolicy, defaultTimeoutPolicy, delayWithSignal, discoverLocalCdpBrowsers, dispatchSemanticOperation, hasPersistedCloudSession, inspectCdpEndpoint, isCurrentUrlField, isValidCssAttributeKey, listLocalChromeProfiles, normalizeExtractedValue, normalizeOpensteerEngineName, normalizeOpensteerExecutionMode, normalizeWorkspaceId, readPersistedCloudSessionRecord, resolveCloudConfig, resolveCloudSessionRecordPath, resolveDomActionBridge, resolveExtractedValueInContext, resolveFilesystemWorkspacePath, resolveOpensteerEngineName, resolveOpensteerExecutionMode, resolveOpensteerRuntimeConfig, runWithPolicyTimeout, sanitizeElementPath, sanitizeReplayElementPath, sanitizeStructuralElementAnchor, settleWithPolicy, shouldKeepAttributeForPath } from './chunk-X3G6QSCF.js';
1
+ import { resolveOpensteerRuntimeConfig, createOpensteerSemanticRuntime, OpensteerBrowserManager } from './chunk-C7GWMSTV.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, buildPathCandidates, buildPathSelectorHint, buildSegmentSelector, clearPersistedSessionRecord, cloneElementPath, cloneReplayElementPath, cloneStructuralElementAnchor, createDomRuntime, createFilesystemOpensteerWorkspace, createOpensteerSemanticRuntime, defaultFallbackPolicy, defaultPolicy, defaultRetryPolicy, defaultSettlePolicy, defaultTimeoutPolicy, delayWithSignal, discoverLocalCdpBrowsers, dispatchSemanticOperation, inspectCdpEndpoint, isCurrentUrlField, isValidCssAttributeKey, listLocalChromeProfiles, normalizeExtractedValue, normalizeOpensteerEngineName, normalizeOpensteerProviderKind, normalizeWorkspaceId, readPersistedCloudSessionRecord, readPersistedLocalBrowserSessionRecord, readPersistedSessionRecord, resolveCloudConfig, resolveCloudSessionRecordPath, resolveDomActionBridge, resolveExtractedValueInContext, resolveFilesystemWorkspacePath, resolveLiveSessionRecordPath, resolveLocalSessionRecordPath, resolveOpensteerEngineName, resolveOpensteerProvider, resolveOpensteerRuntimeConfig, runWithPolicyTimeout, sanitizeElementPath, sanitizeReplayElementPath, sanitizeStructuralElementAnchor, settleWithPolicy, shouldKeepAttributeForPath, writePersistedSessionRecord } from './chunk-C7GWMSTV.js';
3
3
 
4
4
  // src/sdk/opensteer.ts
5
5
  var Opensteer = class {
@@ -7,38 +7,37 @@ var Opensteer = class {
7
7
  browserManager;
8
8
  browser;
9
9
  constructor(options = {}) {
10
+ const { provider, engineName, ...runtimeOptions } = options;
10
11
  const runtimeConfig = resolveOpensteerRuntimeConfig({
11
- ...options.cloud === void 0 ? {} : { cloud: options.cloud },
12
- ...process.env.OPENSTEER_MODE === void 0 ? {} : { environmentMode: process.env.OPENSTEER_MODE }
12
+ ...provider === void 0 ? {} : { provider },
13
+ ...process.env.OPENSTEER_PROVIDER === void 0 ? {} : { environmentProvider: process.env.OPENSTEER_PROVIDER }
13
14
  });
14
- if (runtimeConfig.mode === "cloud") {
15
+ if (runtimeConfig.provider.kind === "cloud") {
15
16
  this.browserManager = void 0;
16
17
  this.runtime = createOpensteerSemanticRuntime({
17
- mode: runtimeConfig.mode,
18
- ...options.cloud === void 0 ? {} : { cloud: options.cloud },
19
- ...options.engineName === void 0 ? {} : { engine: options.engineName },
18
+ ...provider === void 0 ? {} : { provider },
19
+ ...engineName === void 0 ? {} : { engine: engineName },
20
20
  runtimeOptions: {
21
- ...options
21
+ ...runtimeOptions
22
22
  }
23
23
  });
24
24
  this.browser = createUnsupportedBrowserController();
25
25
  return;
26
26
  }
27
27
  this.browserManager = new OpensteerBrowserManager({
28
- ...options.rootDir === void 0 ? {} : { rootDir: options.rootDir },
29
- ...options.rootPath === void 0 ? {} : { rootPath: options.rootPath },
30
- ...options.workspace === void 0 ? {} : { workspace: options.workspace },
31
- ...options.engineName === void 0 ? {} : { engineName: options.engineName },
32
- ...options.browser === void 0 ? {} : { browser: options.browser },
33
- ...options.launch === void 0 ? {} : { launch: options.launch },
34
- ...options.context === void 0 ? {} : { context: options.context }
28
+ ...runtimeOptions.rootDir === void 0 ? {} : { rootDir: runtimeOptions.rootDir },
29
+ ...runtimeOptions.rootPath === void 0 ? {} : { rootPath: runtimeOptions.rootPath },
30
+ ...runtimeOptions.workspace === void 0 ? {} : { workspace: runtimeOptions.workspace },
31
+ ...engineName === void 0 ? {} : { engineName },
32
+ ...runtimeOptions.browser === void 0 ? {} : { browser: runtimeOptions.browser },
33
+ ...runtimeOptions.launch === void 0 ? {} : { launch: runtimeOptions.launch },
34
+ ...runtimeOptions.context === void 0 ? {} : { context: runtimeOptions.context }
35
35
  });
36
36
  this.runtime = createOpensteerSemanticRuntime({
37
- mode: runtimeConfig.mode,
38
- ...options.cloud === void 0 ? {} : { cloud: options.cloud },
39
- ...options.engineName === void 0 ? {} : { engine: options.engineName },
37
+ ...provider === void 0 ? {} : { provider },
38
+ ...engineName === void 0 ? {} : { engine: engineName },
40
39
  runtimeOptions: {
41
- ...options,
40
+ ...runtimeOptions,
42
41
  rootPath: this.browserManager.rootPath,
43
42
  cleanupRootOnClose: this.browserManager.cleanupRootOnDisconnect
44
43
  }
@@ -53,6 +52,9 @@ var Opensteer = class {
53
52
  async open(input = {}) {
54
53
  return this.runtime.open(typeof input === "string" ? { url: input } : input);
55
54
  }
55
+ async info() {
56
+ return this.runtime.info();
57
+ }
56
58
  async listPages(input = {}) {
57
59
  return this.runtime.listPages(input);
58
60
  }
@@ -84,10 +86,6 @@ var Opensteer = class {
84
86
  } : input;
85
87
  return this.runtime.addInitScript(normalized);
86
88
  }
87
- async snapshot(input = {}) {
88
- const mode = typeof input === "string" ? input : input.mode;
89
- return this.runtime.snapshot(mode === void 0 ? {} : { mode });
90
- }
91
89
  async click(input) {
92
90
  const normalized = normalizeTargetOptions(input);
93
91
  return this.runtime.click(normalized);
@@ -167,6 +165,9 @@ var Opensteer = class {
167
165
  await delay(pollIntervalMs);
168
166
  }
169
167
  }
168
+ async snapshot(input = {}) {
169
+ return this.runtime.snapshot(typeof input === "string" ? { mode: input } : input);
170
+ }
170
171
  async saveNetwork(input) {
171
172
  return this.runtime.saveNetwork(input);
172
173
  }
@@ -311,12 +312,15 @@ var Opensteer = class {
311
312
  await this.runtime.disconnect();
312
313
  }
313
314
  requireOwnedInstrumentationRuntime(method) {
314
- if (this.runtime instanceof OpensteerRuntime) {
315
+ if (isInstrumentableRuntime(this.runtime)) {
315
316
  return this.runtime;
316
317
  }
317
- throw new Error(`${method}() is only available on owned local SDK sessions.`);
318
+ throw new Error(`${method}() is not available for this session runtime.`);
318
319
  }
319
320
  };
321
+ function isInstrumentableRuntime(runtime) {
322
+ return typeof runtime.route === "function" && typeof runtime.interceptScript === "function";
323
+ }
320
324
  function createUnsupportedBrowserController() {
321
325
  const fail = async () => {
322
326
  throw new Error("browser.* helpers are only available in local mode.");
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/sdk/opensteer.ts"],"names":[],"mappings":";;;;AAqOO,IAAM,YAAN,MAAgB;AAAA,EACJ,OAAA;AAAA,EACA,cAAA;AAAA,EACR,OAAA;AAAA,EAET,WAAA,CAAY,OAAA,GAA4B,EAAC,EAAG;AAC1C,IAAA,MAAM,gBAAgB,6BAAA,CAA8B;AAAA,MAClD,GAAI,QAAQ,KAAA,KAAU,MAAA,GAAY,EAAC,GAAI,EAAE,KAAA,EAAO,OAAA,CAAQ,KAAA,EAAM;AAAA,MAC9D,GAAI,OAAA,CAAQ,GAAA,CAAI,cAAA,KAAmB,MAAA,GAC/B,EAAC,GACD,EAAE,eAAA,EAAiB,OAAA,CAAQ,GAAA,CAAI,cAAA;AAAe,KACnD,CAAA;AAED,IAAA,IAAI,aAAA,CAAc,SAAS,OAAA,EAAS;AAClC,MAAA,IAAA,CAAK,cAAA,GAAiB,MAAA;AACtB,MAAA,IAAA,CAAK,UAAU,8BAAA,CAA+B;AAAA,QAC5C,MAAM,aAAA,CAAc,IAAA;AAAA,QACpB,GAAI,QAAQ,KAAA,KAAU,MAAA,GAAY,EAAC,GAAI,EAAE,KAAA,EAAO,OAAA,CAAQ,KAAA,EAAM;AAAA,QAC9D,GAAI,QAAQ,UAAA,KAAe,MAAA,GAAY,EAAC,GAAI,EAAE,MAAA,EAAQ,OAAA,CAAQ,UAAA,EAAW;AAAA,QACzE,cAAA,EAAgB;AAAA,UACd,GAAG;AAAA;AACL,OACD,CAAA;AACD,MAAA,IAAA,CAAK,UAAU,kCA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AEA,EAAA,IAAI,WAAA,EAAa;AACf,IAAA,OAAO;AAAA,MACL,MAAA,EAAQ;AAAA,QACN,IAAA,EAAM,UAAA;AAAA,QACN,UAAU,KAAA,CAAM;AAAA,OAClB;AAAA,MACA,GAAI,MAAM,WAAA,KAAgB,MAAA,GAAY,EAAC,GAAI,EAAE,oBAAA,EAAsB,KAAA,CAAM,WAAA,EAAY;AAAA,MACrF,GAAI,MAAM,UAAA,KAAe,MAAA,GAAY,EAAC,GAAI,EAAE,UAAA,EAAY,KAAA,CAAM,UAAA;AAAW,KAC3E;AAAA,EACF;AAEA,EAAA,IAAI,KAAA,CAAM,gBAAgB,MAAA,EAAW;AACnC,IAAA,MAAM,IAAI,MAAM,2DAA2D,CAAA;AAAA,EAC7E;AAEA,EAAA,OAAO;AAAA,IACL,MAAA,EAAQ;AAAA,MACN,IAAA,EAAM,aAAA;AAAA,MACN,aAAa,KAAA,CAAM;AAAA,KACrB;AAAA,IACA,GAAI,MAAM,UAAA,KAAe,MAAA,GAAY,EAAC,GAAI,EAAE,UAAA,EAAY,KAAA,CAAM,UAAA;AAAW,GAC3E;AACF;AAEA,SAAS,MAAM,EAAA,EAA2B;AACxC,EAAA,OAAO,IAAI,OAAA,CAAQ,CAAC,YAAY,UAAA,CAAW,OAAA,EAAS,EAAE,CAAC,CAAA;AACzD","file":"index.js","sourcesContent":["import type {\n OpensteerArtifactReadInput,\n OpensteerArtifactReadOutput,\n CookieRecord,\n OpensteerAddInitScriptInput,\n OpensteerAddInitScriptOutput,\n OpensteerCaptchaSolveInput,\n OpensteerCaptchaSolveOutput,\n OpensteerCaptureScriptsInput,\n OpensteerCaptureScriptsOutput,\n OpensteerGetRecipeInput,\n OpensteerGetAuthRecipeInput,\n OpensteerActionResult,\n OpensteerComputerExecuteInput,\n OpensteerComputerExecuteOutput,\n OpensteerDomExtractOutput,\n OpensteerGetRequestPlanInput,\n OpensteerInferRequestPlanInput,\n OpensteerListRecipesInput,\n OpensteerListRecipesOutput,\n OpensteerListAuthRecipesInput,\n OpensteerListAuthRecipesOutput,\n OpensteerNetworkClearInput,\n OpensteerNetworkClearOutput,\n OpensteerNetworkDiffInput,\n OpensteerNetworkDiffOutput,\n OpensteerNetworkMinimizeInput,\n OpensteerNetworkMinimizeOutput,\n OpensteerNetworkQueryInput,\n OpensteerNetworkQueryOutput,\n OpensteerNetworkSaveInput,\n OpensteerNetworkSaveOutput,\n OpensteerInteractionCaptureInput,\n OpensteerInteractionCaptureOutput,\n OpensteerInteractionDiffInput,\n OpensteerInteractionDiffOutput,\n OpensteerInteractionGetInput,\n OpensteerInteractionGetOutput,\n OpensteerInteractionReplayInput,\n OpensteerInteractionReplayOutput,\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 OpensteerPageSnapshotOutput,\n OpensteerListRequestPlansInput,\n OpensteerListRequestPlansOutput,\n OpensteerRawRequestInput,\n OpensteerRawRequestOutput,\n OpensteerRequestExecuteInput,\n OpensteerRequestExecuteOutput,\n OpensteerRunRecipeInput,\n OpensteerRunRecipeOutput,\n OpensteerRunAuthRecipeInput,\n OpensteerRunAuthRecipeOutput,\n OpensteerScriptBeautifyInput,\n OpensteerScriptBeautifyOutput,\n OpensteerScriptDeobfuscateInput,\n OpensteerScriptDeobfuscateOutput,\n OpensteerScriptSandboxInput,\n OpensteerScriptSandboxOutput,\n OpensteerReverseExportInput,\n OpensteerReverseExportOutput,\n OpensteerReverseDiscoverInput,\n OpensteerReverseDiscoverOutput,\n OpensteerReverseQueryInput,\n OpensteerReverseQueryOutput,\n OpensteerReversePackageCreateInput,\n OpensteerReversePackageCreateOutput,\n OpensteerReversePackageGetInput,\n OpensteerReversePackageGetOutput,\n OpensteerReversePackageListInput,\n OpensteerReversePackageListOutput,\n OpensteerReversePackagePatchInput,\n OpensteerReversePackagePatchOutput,\n OpensteerReversePackageRunInput,\n OpensteerReversePackageRunOutput,\n OpensteerReverseReportInput,\n OpensteerReverseReportOutput,\n OpensteerSessionCloseOutput,\n OpensteerOpenInput,\n OpensteerOpenOutput,\n OpensteerSnapshotMode,\n OpensteerTargetInput,\n OpensteerTransportProbeInput,\n OpensteerTransportProbeOutput,\n OpensteerWriteRecipeInput,\n OpensteerWriteAuthRecipeInput,\n OpensteerWriteRequestPlanInput,\n StorageSnapshot,\n} from \"@opensteer/protocol\";\n\nimport type { AuthRecipeRecord, RecipeRecord, RequestPlanRecord } from \"../registry.js\";\nimport {\n OpensteerBrowserManager,\n type OpensteerBrowserStatus,\n type WorkspaceBrowserManifest,\n} from \"../browser-manager.js\";\nimport { OpensteerRuntime, type OpensteerRuntimeOptions } from \"./runtime.js\";\nimport {\n createOpensteerSemanticRuntime,\n resolveOpensteerRuntimeConfig,\n type OpensteerCloudOptions,\n} from \"./runtime-resolution.js\";\nimport type {\n OpensteerInterceptScriptOptions,\n OpensteerRouteOptions,\n OpensteerRouteRegistration,\n} from \"./instrumentation.js\";\nimport type { OpensteerDisconnectableRuntime } from \"./semantic-runtime.js\";\n\nexport interface OpensteerTargetOptions {\n readonly element?: number;\n readonly selector?: string;\n readonly description?: string;\n readonly networkTag?: string;\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 interface OpensteerExtractOptions {\n readonly description: string;\n readonly schema?: Record<string, unknown>;\n}\n\nexport interface OpensteerWaitForNetworkOptions extends OpensteerNetworkQueryInput {\n readonly timeoutMs?: number;\n readonly pollIntervalMs?: number;\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 OpensteerGotoOptions = OpensteerPageGotoInput;\n\nexport type OpensteerComputerExecuteOptions = OpensteerComputerExecuteInput;\nexport type OpensteerComputerExecuteResult = OpensteerComputerExecuteOutput;\nexport type OpensteerNetworkQueryOptions = OpensteerNetworkQueryInput;\nexport type OpensteerNetworkQueryResult = OpensteerNetworkQueryOutput;\nexport type OpensteerNetworkSaveOptions = OpensteerNetworkSaveInput;\nexport type OpensteerNetworkSaveResult = OpensteerNetworkSaveOutput;\nexport type OpensteerNetworkMinimizeOptions = OpensteerNetworkMinimizeInput;\nexport type OpensteerNetworkMinimizeResult = OpensteerNetworkMinimizeOutput;\nexport type OpensteerNetworkDiffOptions = OpensteerNetworkDiffInput;\nexport type OpensteerNetworkDiffResult = OpensteerNetworkDiffOutput;\nexport type OpensteerNetworkProbeOptions = OpensteerTransportProbeInput;\nexport type OpensteerNetworkProbeResult = OpensteerTransportProbeOutput;\nexport type OpensteerReverseDiscoverOptions = OpensteerReverseDiscoverInput;\nexport type OpensteerReverseDiscoverResult = OpensteerReverseDiscoverOutput;\nexport type OpensteerReverseQueryOptions = OpensteerReverseQueryInput;\nexport type OpensteerReverseQueryResult = OpensteerReverseQueryOutput;\nexport type OpensteerReversePackageCreateOptions = OpensteerReversePackageCreateInput;\nexport type OpensteerReversePackageCreateResult = OpensteerReversePackageCreateOutput;\nexport type OpensteerReversePackageRunOptions = OpensteerReversePackageRunInput;\nexport type OpensteerReversePackageRunResult = OpensteerReversePackageRunOutput;\nexport type OpensteerReverseExportOptions = OpensteerReverseExportInput;\nexport type OpensteerReverseExportResult = OpensteerReverseExportOutput;\nexport type OpensteerReverseReportOptions = OpensteerReverseReportInput;\nexport type OpensteerReverseReportResult = OpensteerReverseReportOutput;\nexport type OpensteerReversePackageGetOptions = OpensteerReversePackageGetInput;\nexport type OpensteerReversePackageGetResult = OpensteerReversePackageGetOutput;\nexport type OpensteerReversePackageListOptions = OpensteerReversePackageListInput;\nexport type OpensteerReversePackageListResult = OpensteerReversePackageListOutput;\nexport type OpensteerReversePackagePatchOptions = OpensteerReversePackagePatchInput;\nexport type OpensteerReversePackagePatchResult = OpensteerReversePackagePatchOutput;\nexport type OpensteerInteractionCaptureOptions = OpensteerInteractionCaptureInput;\nexport type OpensteerInteractionCaptureResult = OpensteerInteractionCaptureOutput;\nexport type OpensteerInteractionGetOptions = OpensteerInteractionGetInput;\nexport type OpensteerInteractionGetResult = OpensteerInteractionGetOutput;\nexport type OpensteerInteractionDiffOptions = OpensteerInteractionDiffInput;\nexport type OpensteerInteractionDiffResult = OpensteerInteractionDiffOutput;\nexport type OpensteerInteractionReplayOptions = OpensteerInteractionReplayInput;\nexport type OpensteerInteractionReplayResult = OpensteerInteractionReplayOutput;\nexport type OpensteerNetworkClearOptions = OpensteerNetworkClearInput;\nexport type OpensteerNetworkClearResult = OpensteerNetworkClearOutput;\nexport type OpensteerRawRequestOptions = OpensteerRawRequestInput;\nexport type OpensteerRawRequestResult = OpensteerRawRequestOutput;\nexport type OpensteerRequestOptions = Omit<OpensteerRequestExecuteInput, \"key\">;\nexport type OpensteerRequestResult = OpensteerRequestExecuteOutput;\nexport type OpensteerCaptureScriptsOptions = OpensteerCaptureScriptsInput;\nexport type OpensteerCaptureScriptsResult = OpensteerCaptureScriptsOutput;\nexport type OpensteerScriptBeautifyOptions = OpensteerScriptBeautifyInput;\nexport type OpensteerScriptBeautifyResult = OpensteerScriptBeautifyOutput;\nexport type OpensteerScriptDeobfuscateOptions = OpensteerScriptDeobfuscateInput;\nexport type OpensteerScriptDeobfuscateResult = OpensteerScriptDeobfuscateOutput;\nexport type OpensteerScriptSandboxOptions = OpensteerScriptSandboxInput;\nexport type OpensteerScriptSandboxResult = OpensteerScriptSandboxOutput;\nexport type OpensteerArtifactReadOptions = OpensteerArtifactReadInput;\nexport type OpensteerArtifactReadResult = OpensteerArtifactReadOutput;\nexport type OpensteerCaptchaSolveOptions = OpensteerCaptchaSolveInput;\nexport type OpensteerCaptchaSolveResult = OpensteerCaptchaSolveOutput;\nexport type OpensteerAddInitScriptOptions = OpensteerAddInitScriptInput;\n\nexport interface OpensteerOptions extends OpensteerRuntimeOptions {\n readonly cloud?: boolean | OpensteerCloudOptions;\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\nexport class Opensteer {\n private readonly runtime: OpensteerDisconnectableRuntime;\n private readonly browserManager: OpensteerBrowserManager | undefined;\n readonly browser: OpensteerBrowserController;\n\n constructor(options: OpensteerOptions = {}) {\n const runtimeConfig = resolveOpensteerRuntimeConfig({\n ...(options.cloud === undefined ? {} : { cloud: options.cloud }),\n ...(process.env.OPENSTEER_MODE === undefined\n ? {}\n : { environmentMode: process.env.OPENSTEER_MODE }),\n });\n\n if (runtimeConfig.mode === \"cloud\") {\n this.browserManager = undefined;\n this.runtime = createOpensteerSemanticRuntime({\n mode: runtimeConfig.mode,\n ...(options.cloud === undefined ? {} : { cloud: options.cloud }),\n ...(options.engineName === undefined ? {} : { engine: options.engineName }),\n runtimeOptions: {\n ...options,\n },\n });\n this.browser = createUnsupportedBrowserController();\n return;\n }\n\n this.browserManager = new OpensteerBrowserManager({\n ...(options.rootDir === undefined ? {} : { rootDir: options.rootDir }),\n ...(options.rootPath === undefined ? {} : { rootPath: options.rootPath }),\n ...(options.workspace === undefined ? {} : { workspace: options.workspace }),\n ...(options.engineName === undefined ? {} : { engineName: options.engineName }),\n ...(options.browser === undefined ? {} : { browser: options.browser }),\n ...(options.launch === undefined ? {} : { launch: options.launch }),\n ...(options.context === undefined ? {} : { context: options.context }),\n });\n this.runtime = createOpensteerSemanticRuntime({\n mode: runtimeConfig.mode,\n ...(options.cloud === undefined ? {} : { cloud: options.cloud }),\n ...(options.engineName === undefined ? {} : { engine: options.engineName }),\n runtimeOptions: {\n ...options,\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 async open(input: string | OpensteerOpenInput = {}): Promise<OpensteerOpenOutput> {\n return this.runtime.open(typeof input === \"string\" ? { url: input } : input);\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(input: string | OpensteerGotoOptions): Promise<OpensteerPageGotoOutput> {\n return this.runtime.goto(typeof input === \"string\" ? { url: input } : input);\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 const result = await this.runtime.evaluate(normalized);\n return result.value;\n }\n\n async evaluateJson(\n input: string | OpensteerPageEvaluateInput,\n ): Promise<OpensteerPageEvaluateOutput[\"value\"]> {\n return this.evaluate(input);\n }\n\n async addInitScript(\n input: string | OpensteerAddInitScriptInput,\n ): Promise<OpensteerAddInitScriptOutput> {\n const normalized =\n typeof input === \"string\"\n ? {\n script: input,\n }\n : input;\n return this.runtime.addInitScript(normalized);\n }\n\n async snapshot(\n input: OpensteerSnapshotMode | { readonly mode?: OpensteerSnapshotMode } = {},\n ): Promise<OpensteerPageSnapshotOutput> {\n const mode = typeof input === \"string\" ? input : input.mode;\n return this.runtime.snapshot(mode === undefined ? {} : { mode });\n }\n\n async click(input: OpensteerTargetOptions): Promise<OpensteerActionResult> {\n const normalized = normalizeTargetOptions(input);\n return this.runtime.click(normalized);\n }\n\n async hover(input: OpensteerTargetOptions): Promise<OpensteerActionResult> {\n const normalized = normalizeTargetOptions(input);\n return this.runtime.hover(normalized);\n }\n\n async input(input: OpensteerInputOptions): Promise<OpensteerActionResult> {\n const normalized = normalizeTargetOptions(input);\n return this.runtime.input({\n ...normalized,\n text: input.text,\n ...(input.pressEnter === undefined ? {} : { pressEnter: input.pressEnter }),\n });\n }\n\n async scroll(input: OpensteerScrollOptions): Promise<OpensteerActionResult> {\n const normalized = normalizeTargetOptions(input);\n return this.runtime.scroll({\n ...normalized,\n direction: input.direction,\n amount: input.amount,\n });\n }\n\n async extract(input: OpensteerExtractOptions): Promise<OpensteerDomExtractOutput[\"data\"]> {\n const result = await this.runtime.extract(input);\n return result.data;\n }\n\n async queryNetwork(\n input: OpensteerNetworkQueryOptions = {},\n ): Promise<OpensteerNetworkQueryResult> {\n return this.runtime.queryNetwork(input);\n }\n\n async waitForNetwork(\n input: OpensteerWaitForNetworkOptions,\n ): Promise<OpensteerNetworkQueryResult[\"records\"][number]> {\n const { timeoutMs, pollIntervalMs, ...query } = input;\n const timeoutAt = Date.now() + (timeoutMs ?? 30_000);\n const pollInterval = pollIntervalMs ?? 100;\n\n while (true) {\n const { records } = await this.runtime.queryNetwork({\n ...query,\n limit: 1,\n });\n if (records[0] !== undefined) {\n return records[0];\n }\n if (Date.now() >= timeoutAt) {\n throw new Error(\"waitForNetwork timed out\");\n }\n await delay(pollInterval);\n }\n }\n\n async waitForResponse(\n input: OpensteerWaitForNetworkOptions,\n ): Promise<OpensteerNetworkQueryResult[\"records\"][number]> {\n return this.waitForNetwork(input);\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 { pages } = await this.runtime.listPages();\n const match = 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 saveNetwork(input: OpensteerNetworkSaveOptions): Promise<OpensteerNetworkSaveResult> {\n return this.runtime.saveNetwork(input);\n }\n\n async minimizeNetwork(\n input: OpensteerNetworkMinimizeOptions,\n ): Promise<OpensteerNetworkMinimizeResult> {\n return this.runtime.minimizeNetwork(input);\n }\n\n async diffNetwork(input: OpensteerNetworkDiffOptions): Promise<OpensteerNetworkDiffResult> {\n return this.runtime.diffNetwork(input);\n }\n\n async probeNetwork(input: OpensteerNetworkProbeOptions): Promise<OpensteerNetworkProbeResult> {\n return this.runtime.probeNetwork(input);\n }\n\n async reverseDiscover(\n input: OpensteerReverseDiscoverOptions = {},\n ): Promise<OpensteerReverseDiscoverResult> {\n return this.runtime.discoverReverse(input);\n }\n\n async reverseQuery(input: OpensteerReverseQueryOptions): Promise<OpensteerReverseQueryResult> {\n return this.runtime.queryReverse(input);\n }\n\n async createReversePackage(\n input: OpensteerReversePackageCreateOptions,\n ): Promise<OpensteerReversePackageCreateResult> {\n return this.runtime.createReversePackage(input);\n }\n\n async runReversePackage(\n input: OpensteerReversePackageRunOptions,\n ): Promise<OpensteerReversePackageRunResult> {\n return this.runtime.runReversePackage(input);\n }\n\n async reverseExport(input: OpensteerReverseExportOptions): Promise<OpensteerReverseExportResult> {\n return this.runtime.exportReverse(input);\n }\n\n async reverseReport(input: OpensteerReverseReportOptions): Promise<OpensteerReverseReportResult> {\n return this.runtime.getReverseReport(input);\n }\n\n async getReversePackage(\n input: OpensteerReversePackageGetOptions,\n ): Promise<OpensteerReversePackageGetResult> {\n return this.runtime.getReversePackage(input);\n }\n\n async listReversePackages(\n input: OpensteerReversePackageListOptions = {},\n ): Promise<OpensteerReversePackageListResult> {\n return this.runtime.listReversePackages(input);\n }\n\n async patchReversePackage(\n input: OpensteerReversePackagePatchOptions,\n ): Promise<OpensteerReversePackagePatchResult> {\n return this.runtime.patchReversePackage(input);\n }\n\n async interactionCapture(\n input: OpensteerInteractionCaptureOptions,\n ): Promise<OpensteerInteractionCaptureResult> {\n return this.runtime.captureInteraction(input);\n }\n\n async getInteraction(\n input: OpensteerInteractionGetOptions,\n ): Promise<OpensteerInteractionGetResult> {\n return this.runtime.getInteraction(input);\n }\n\n async interactionDiff(\n input: OpensteerInteractionDiffOptions,\n ): Promise<OpensteerInteractionDiffResult> {\n return this.runtime.diffInteraction(input);\n }\n\n async interactionReplay(\n input: OpensteerInteractionReplayOptions,\n ): Promise<OpensteerInteractionReplayResult> {\n return this.runtime.replayInteraction(input);\n }\n\n async clearNetwork(\n input: OpensteerNetworkClearOptions = {},\n ): Promise<OpensteerNetworkClearResult> {\n return this.runtime.clearNetwork(input);\n }\n\n async captureScripts(\n input: OpensteerCaptureScriptsOptions = {},\n ): Promise<OpensteerCaptureScriptsResult> {\n return this.runtime.captureScripts(input);\n }\n\n async readArtifact(input: OpensteerArtifactReadOptions): Promise<OpensteerArtifactReadResult> {\n return this.runtime.readArtifact(input);\n }\n\n async beautifyScript(\n input: OpensteerScriptBeautifyOptions,\n ): Promise<OpensteerScriptBeautifyResult> {\n return this.runtime.beautifyScript(input);\n }\n\n async deobfuscateScript(\n input: OpensteerScriptDeobfuscateOptions,\n ): Promise<OpensteerScriptDeobfuscateResult> {\n return this.runtime.deobfuscateScript(input);\n }\n\n async sandboxScript(input: OpensteerScriptSandboxOptions): Promise<OpensteerScriptSandboxResult> {\n return this.runtime.sandboxScript(input);\n }\n\n async solveCaptcha(input: OpensteerCaptchaSolveOptions): Promise<OpensteerCaptchaSolveResult> {\n return this.runtime.solveCaptcha(input);\n }\n\n async getCookies(\n input: { readonly urls?: readonly string[] } = {},\n ): Promise<readonly CookieRecord[]> {\n return this.runtime.getCookies(input);\n }\n\n async getStorageSnapshot(\n input: {\n readonly includeSessionStorage?: boolean;\n readonly includeIndexedDb?: boolean;\n } = {},\n ): Promise<StorageSnapshot> {\n return this.runtime.getStorageSnapshot(input);\n }\n\n async writeRequestPlan(input: OpensteerWriteRequestPlanInput): Promise<RequestPlanRecord> {\n return this.runtime.writeRequestPlan(input);\n }\n\n async inferRequestPlan(input: OpensteerInferRequestPlanInput): Promise<RequestPlanRecord> {\n return this.runtime.inferRequestPlan(input);\n }\n\n async getRequestPlan(input: OpensteerGetRequestPlanInput): Promise<RequestPlanRecord> {\n return this.runtime.getRequestPlan(input);\n }\n\n async listRequestPlans(\n input: OpensteerListRequestPlansInput = {},\n ): Promise<OpensteerListRequestPlansOutput> {\n return this.runtime.listRequestPlans(input);\n }\n\n async writeAuthRecipe(input: OpensteerWriteAuthRecipeInput): Promise<AuthRecipeRecord> {\n return this.runtime.writeAuthRecipe(input);\n }\n\n async writeRecipe(input: OpensteerWriteRecipeInput): Promise<RecipeRecord> {\n return this.runtime.writeRecipe(input);\n }\n\n async getAuthRecipe(input: OpensteerGetAuthRecipeInput): Promise<AuthRecipeRecord> {\n return this.runtime.getAuthRecipe(input);\n }\n\n async getRecipe(input: OpensteerGetRecipeInput): Promise<RecipeRecord> {\n return this.runtime.getRecipe(input);\n }\n\n async listAuthRecipes(\n input: OpensteerListAuthRecipesInput = {},\n ): Promise<OpensteerListAuthRecipesOutput> {\n return this.runtime.listAuthRecipes(input);\n }\n\n async listRecipes(input: OpensteerListRecipesInput = {}): Promise<OpensteerListRecipesOutput> {\n return this.runtime.listRecipes(input);\n }\n\n async runAuthRecipe(input: OpensteerRunAuthRecipeInput): Promise<OpensteerRunAuthRecipeOutput> {\n return this.runtime.runAuthRecipe(input);\n }\n\n async runRecipe(input: OpensteerRunRecipeInput): Promise<OpensteerRunRecipeOutput> {\n return this.runtime.runRecipe(input);\n }\n\n async request(key: string, input: OpensteerRequestOptions = {}): Promise<OpensteerRequestResult> {\n return this.runtime.request({\n key,\n ...input,\n });\n }\n\n async rawRequest(input: OpensteerRawRequestOptions): Promise<OpensteerRawRequestResult> {\n return this.runtime.rawRequest(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 computerExecute(\n input: OpensteerComputerExecuteOptions,\n ): Promise<OpensteerComputerExecuteResult> {\n return this.runtime.computerExecute(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 ): OpensteerRuntime {\n if (this.runtime instanceof OpensteerRuntime) {\n return this.runtime;\n }\n throw new Error(`${method}() is only available on owned local SDK sessions.`);\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 persistAsDescription?: string;\n readonly networkTag?: 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 description.\");\n }\n\n if (hasElement) {\n return {\n target: {\n kind: \"element\",\n element: input.element!,\n },\n ...(input.description === undefined ? {} : { persistAsDescription: input.description }),\n ...(input.networkTag === undefined ? {} : { networkTag: input.networkTag }),\n };\n }\n\n if (hasSelector) {\n return {\n target: {\n kind: \"selector\",\n selector: input.selector!,\n },\n ...(input.description === undefined ? {} : { persistAsDescription: input.description }),\n ...(input.networkTag === undefined ? {} : { networkTag: input.networkTag }),\n };\n }\n\n if (input.description === undefined) {\n throw new Error(\"Specify exactly one of element, selector, or description.\");\n }\n\n return {\n target: {\n kind: \"description\",\n description: input.description,\n },\n ...(input.networkTag === undefined ? {} : { networkTag: input.networkTag }),\n };\n}\n\nfunction delay(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n"]}
1
+ {"version":3,"sources":["../src/sdk/opensteer.ts"],"names":[],"mappings":";;;;AA0OO,IAAM,YAAN,MAAgB;AAAA,EACJ,OAAA;AAAA,EACA,cAAA;AAAA,EACR,OAAA;AAAA,EAET,WAAA,CAAY,OAAA,GAA4B,EAAC,EAAG;AAC1C,IAAA,MAAM,EAAE,QAAA,EAAU,UAAA,EAAY,GAAG,gBAAe,GAAI,OAAA;AACpD,IAAA,MAAM,gBAAgB,6BAAA,CAA8B;AAAA,MAClD,GAAI,QAAA,KAAa,MAAA,GAAY,EAAC,GAAI,EAAE,QAAA,EAAS;AAAA,MAC7C,GAAI,OAAA,CAAQ,GAAA,CAAI,kBAAA,KAAuB,MAAA,GACnC,EAAC,GACD,EAAE,mBAAA,EAAqB,OAAA,CAAQ,GAAA,CAAI,kBAAA;AAAmB,KAC3D,CAAA;AAED,IAAA,IAAI,aAAA,CAAc,QAAA,CAAS,IAAA,KAAS,OAAA,EAAS;AAC3C,MAAA,IAAA,CAAK,cAAA,GAAiB,MAAA;AACtB,MAAA,IAAA,CAAK,UAAU,8BAAA,CAA+B;AAAA,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EAAM,SAAA;AAAA,QACN,SAAS,KAAA,CAAM;AAAA,OACjB;AAAA,MACA,GAAI,MAAM,WAAA,KAAgB,MAAA,GAAY,EAAC,GAAI,EAAE,oBAAA,EAAsB,KAAA,CAAM,WAAA,EAAY;AAAA,MACrF,GAAI,MAAM,UAAA,KAAe,MAAA,GAAY,EAAC,GAAI,EAAE,UAAA,EAAY,KAAA,CAAM,UAAA;AAAW,KAC3E;AAAA,EACF;AAEA,EAAA,IAAI,WAAA,EAAa;AACf,IAAA,OAAO;AAAA,MACL,MAAA,EAAQ;AAAA,QACN,IAAA,EAAM,UAAA;AAAA,QACN,UAAU,KAAA,CAAM;AAAA,OAClB;AAAA,MACA,GAAI,MAAM,WAAA,KAAgB,MAAA,GAAY,EAAC,GAAI,EAAE,oBAAA,EAAsB,KAAA,CAAM,WAAA,EAAY;AAAA,MACrF,GAAI,MAAM,UAAA,KAAe,MAAA,GAAY,EAAC,GAAI,EAAE,UAAA,EAAY,KAAA,CAAM,UAAA;AAAW,KAC3E;AAAA,EACF;AAEA,EAAA,IAAI,KAAA,CAAM,gBAAgB,MAAA,EAAW;AACnC,IAAA,MAAM,IAAI,MAAM,2DAA2D,CAAA;AAAA,EAC7E;AAEA,EAAA,OAAO;AAAA,IACL,MAAA,EAAQ;AAAA,MACN,IAAA,EAAM,aAAA;AAAA,MACN,aAAa,KAAA,CAAM;AAAA,KACrB;AAAA,IACA,GAAI,MAAM,UAAA,KAAe,MAAA,GAAY,EAAC,GAAI,EAAE,UAAA,EAAY,KAAA,CAAM,UAAA;AAAW,GAC3E;AACF;AAEA,SAAS,MAAM,EAAA,EAA2B;AACxC,EAAA,OAAO,IAAI,OAAA,CAAQ,CAAC,YAAY,UAAA,CAAW,OAAA,EAAS,EAAE,CAAC,CAAA;AACzD","file":"index.js","sourcesContent":["import type {\n OpensteerArtifactReadInput,\n OpensteerArtifactReadOutput,\n CookieRecord,\n OpensteerAddInitScriptInput,\n OpensteerAddInitScriptOutput,\n OpensteerCaptchaSolveInput,\n OpensteerCaptchaSolveOutput,\n OpensteerCaptureScriptsInput,\n OpensteerCaptureScriptsOutput,\n OpensteerGetRecipeInput,\n OpensteerGetAuthRecipeInput,\n OpensteerActionResult,\n OpensteerComputerExecuteInput,\n OpensteerComputerExecuteOutput,\n OpensteerDomExtractOutput,\n OpensteerGetRequestPlanInput,\n OpensteerInferRequestPlanInput,\n OpensteerListRecipesInput,\n OpensteerListRecipesOutput,\n OpensteerListAuthRecipesInput,\n OpensteerListAuthRecipesOutput,\n OpensteerNetworkClearInput,\n OpensteerNetworkClearOutput,\n OpensteerNetworkDiffInput,\n OpensteerNetworkDiffOutput,\n OpensteerNetworkMinimizeInput,\n OpensteerNetworkMinimizeOutput,\n OpensteerNetworkQueryInput,\n OpensteerNetworkQueryOutput,\n OpensteerNetworkSaveInput,\n OpensteerNetworkSaveOutput,\n OpensteerInteractionCaptureInput,\n OpensteerInteractionCaptureOutput,\n OpensteerInteractionDiffInput,\n OpensteerInteractionDiffOutput,\n OpensteerInteractionGetInput,\n OpensteerInteractionGetOutput,\n OpensteerInteractionReplayInput,\n OpensteerInteractionReplayOutput,\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 OpensteerPageSnapshotInput,\n OpensteerPageSnapshotOutput,\n OpensteerListRequestPlansInput,\n OpensteerListRequestPlansOutput,\n OpensteerRawRequestInput,\n OpensteerRawRequestOutput,\n OpensteerRequestExecuteInput,\n OpensteerRequestExecuteOutput,\n OpensteerRunRecipeInput,\n OpensteerRunRecipeOutput,\n OpensteerRunAuthRecipeInput,\n OpensteerRunAuthRecipeOutput,\n OpensteerSessionInfo,\n OpensteerScriptBeautifyInput,\n OpensteerScriptBeautifyOutput,\n OpensteerScriptDeobfuscateInput,\n OpensteerScriptDeobfuscateOutput,\n OpensteerScriptSandboxInput,\n OpensteerScriptSandboxOutput,\n OpensteerReverseExportInput,\n OpensteerReverseExportOutput,\n OpensteerReverseDiscoverInput,\n OpensteerReverseDiscoverOutput,\n OpensteerReverseQueryInput,\n OpensteerReverseQueryOutput,\n OpensteerReversePackageCreateInput,\n OpensteerReversePackageCreateOutput,\n OpensteerReversePackageGetInput,\n OpensteerReversePackageGetOutput,\n OpensteerReversePackageListInput,\n OpensteerReversePackageListOutput,\n OpensteerReversePackagePatchInput,\n OpensteerReversePackagePatchOutput,\n OpensteerReversePackageRunInput,\n OpensteerReversePackageRunOutput,\n OpensteerReverseReportInput,\n OpensteerReverseReportOutput,\n OpensteerSessionCloseOutput,\n OpensteerOpenInput,\n OpensteerOpenOutput,\n OpensteerSnapshotMode,\n OpensteerTargetInput,\n OpensteerTransportProbeInput,\n OpensteerTransportProbeOutput,\n OpensteerWriteRecipeInput,\n OpensteerWriteAuthRecipeInput,\n OpensteerWriteRequestPlanInput,\n StorageSnapshot,\n} from \"@opensteer/protocol\";\n\nimport type { AuthRecipeRecord, RecipeRecord, RequestPlanRecord } from \"../registry.js\";\nimport {\n OpensteerBrowserManager,\n type OpensteerBrowserStatus,\n type WorkspaceBrowserManifest,\n} from \"../browser-manager.js\";\nimport { OpensteerRuntime, type OpensteerRuntimeOptions } from \"./runtime.js\";\nimport {\n createOpensteerSemanticRuntime,\n resolveOpensteerRuntimeConfig,\n} from \"./runtime-resolution.js\";\nimport type { OpensteerProviderOptions } from \"../provider/config.js\";\nimport type {\n OpensteerInterceptScriptOptions,\n OpensteerInstrumentableRuntime,\n OpensteerRouteOptions,\n OpensteerRouteRegistration,\n} from \"./instrumentation.js\";\nimport type { OpensteerDisconnectableRuntime } from \"./semantic-runtime.js\";\n\nexport interface OpensteerTargetOptions {\n readonly element?: number;\n readonly selector?: string;\n readonly description?: string;\n readonly networkTag?: string;\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 interface OpensteerExtractOptions {\n readonly description: string;\n readonly schema?: Record<string, unknown>;\n}\n\nexport interface OpensteerWaitForNetworkOptions extends OpensteerNetworkQueryInput {\n readonly timeoutMs?: number;\n readonly pollIntervalMs?: number;\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 OpensteerGotoOptions = OpensteerPageGotoInput;\nexport type OpensteerSnapshotOptions = OpensteerSnapshotMode | OpensteerPageSnapshotInput;\nexport type OpensteerSnapshotResult = OpensteerPageSnapshotOutput;\n\nexport type OpensteerComputerExecuteOptions = OpensteerComputerExecuteInput;\nexport type OpensteerComputerExecuteResult = OpensteerComputerExecuteOutput;\nexport type OpensteerNetworkQueryOptions = OpensteerNetworkQueryInput;\nexport type OpensteerNetworkQueryResult = OpensteerNetworkQueryOutput;\nexport type OpensteerNetworkSaveOptions = OpensteerNetworkSaveInput;\nexport type OpensteerNetworkSaveResult = OpensteerNetworkSaveOutput;\nexport type OpensteerNetworkMinimizeOptions = OpensteerNetworkMinimizeInput;\nexport type OpensteerNetworkMinimizeResult = OpensteerNetworkMinimizeOutput;\nexport type OpensteerNetworkDiffOptions = OpensteerNetworkDiffInput;\nexport type OpensteerNetworkDiffResult = OpensteerNetworkDiffOutput;\nexport type OpensteerNetworkProbeOptions = OpensteerTransportProbeInput;\nexport type OpensteerNetworkProbeResult = OpensteerTransportProbeOutput;\nexport type OpensteerReverseDiscoverOptions = OpensteerReverseDiscoverInput;\nexport type OpensteerReverseDiscoverResult = OpensteerReverseDiscoverOutput;\nexport type OpensteerReverseQueryOptions = OpensteerReverseQueryInput;\nexport type OpensteerReverseQueryResult = OpensteerReverseQueryOutput;\nexport type OpensteerReversePackageCreateOptions = OpensteerReversePackageCreateInput;\nexport type OpensteerReversePackageCreateResult = OpensteerReversePackageCreateOutput;\nexport type OpensteerReversePackageRunOptions = OpensteerReversePackageRunInput;\nexport type OpensteerReversePackageRunResult = OpensteerReversePackageRunOutput;\nexport type OpensteerReverseExportOptions = OpensteerReverseExportInput;\nexport type OpensteerReverseExportResult = OpensteerReverseExportOutput;\nexport type OpensteerReverseReportOptions = OpensteerReverseReportInput;\nexport type OpensteerReverseReportResult = OpensteerReverseReportOutput;\nexport type OpensteerReversePackageGetOptions = OpensteerReversePackageGetInput;\nexport type OpensteerReversePackageGetResult = OpensteerReversePackageGetOutput;\nexport type OpensteerReversePackageListOptions = OpensteerReversePackageListInput;\nexport type OpensteerReversePackageListResult = OpensteerReversePackageListOutput;\nexport type OpensteerReversePackagePatchOptions = OpensteerReversePackagePatchInput;\nexport type OpensteerReversePackagePatchResult = OpensteerReversePackagePatchOutput;\nexport type OpensteerInteractionCaptureOptions = OpensteerInteractionCaptureInput;\nexport type OpensteerInteractionCaptureResult = OpensteerInteractionCaptureOutput;\nexport type OpensteerInteractionGetOptions = OpensteerInteractionGetInput;\nexport type OpensteerInteractionGetResult = OpensteerInteractionGetOutput;\nexport type OpensteerInteractionDiffOptions = OpensteerInteractionDiffInput;\nexport type OpensteerInteractionDiffResult = OpensteerInteractionDiffOutput;\nexport type OpensteerInteractionReplayOptions = OpensteerInteractionReplayInput;\nexport type OpensteerInteractionReplayResult = OpensteerInteractionReplayOutput;\nexport type OpensteerNetworkClearOptions = OpensteerNetworkClearInput;\nexport type OpensteerNetworkClearResult = OpensteerNetworkClearOutput;\nexport type OpensteerRawRequestOptions = OpensteerRawRequestInput;\nexport type OpensteerRawRequestResult = OpensteerRawRequestOutput;\nexport type OpensteerRequestOptions = Omit<OpensteerRequestExecuteInput, \"key\">;\nexport type OpensteerRequestResult = OpensteerRequestExecuteOutput;\nexport type OpensteerCaptureScriptsOptions = OpensteerCaptureScriptsInput;\nexport type OpensteerCaptureScriptsResult = OpensteerCaptureScriptsOutput;\nexport type OpensteerScriptBeautifyOptions = OpensteerScriptBeautifyInput;\nexport type OpensteerScriptBeautifyResult = OpensteerScriptBeautifyOutput;\nexport type OpensteerScriptDeobfuscateOptions = OpensteerScriptDeobfuscateInput;\nexport type OpensteerScriptDeobfuscateResult = OpensteerScriptDeobfuscateOutput;\nexport type OpensteerScriptSandboxOptions = OpensteerScriptSandboxInput;\nexport type OpensteerScriptSandboxResult = OpensteerScriptSandboxOutput;\nexport type OpensteerArtifactReadOptions = OpensteerArtifactReadInput;\nexport type OpensteerArtifactReadResult = OpensteerArtifactReadOutput;\nexport type OpensteerCaptchaSolveOptions = OpensteerCaptchaSolveInput;\nexport type OpensteerCaptchaSolveResult = OpensteerCaptchaSolveOutput;\nexport type OpensteerAddInitScriptOptions = OpensteerAddInitScriptInput;\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\nexport class Opensteer {\n private readonly runtime: OpensteerDisconnectableRuntime;\n private readonly browserManager: OpensteerBrowserManager | undefined;\n readonly browser: OpensteerBrowserController;\n\n constructor(options: OpensteerOptions = {}) {\n const { provider, engineName, ...runtimeOptions } = options;\n const runtimeConfig = resolveOpensteerRuntimeConfig({\n ...(provider === undefined ? {} : { provider }),\n ...(process.env.OPENSTEER_PROVIDER === undefined\n ? {}\n : { environmentProvider: process.env.OPENSTEER_PROVIDER }),\n });\n\n if (runtimeConfig.provider.kind === \"cloud\") {\n this.browserManager = undefined;\n this.runtime = createOpensteerSemanticRuntime({\n ...(provider === undefined ? {} : { provider }),\n ...(engineName === undefined ? {} : { engine: engineName }),\n runtimeOptions: {\n ...runtimeOptions,\n },\n });\n this.browser = createUnsupportedBrowserController();\n return;\n }\n\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 ...(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 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 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(input: string | OpensteerGotoOptions): Promise<OpensteerPageGotoOutput> {\n return this.runtime.goto(typeof input === \"string\" ? { url: input } : input);\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 const result = await this.runtime.evaluate(normalized);\n return result.value;\n }\n\n async evaluateJson(\n input: string | OpensteerPageEvaluateInput,\n ): Promise<OpensteerPageEvaluateOutput[\"value\"]> {\n return this.evaluate(input);\n }\n\n async addInitScript(\n input: string | OpensteerAddInitScriptInput,\n ): Promise<OpensteerAddInitScriptOutput> {\n const normalized =\n typeof input === \"string\"\n ? {\n script: input,\n }\n : input;\n return this.runtime.addInitScript(normalized);\n }\n\n async click(input: OpensteerTargetOptions): Promise<OpensteerActionResult> {\n const normalized = normalizeTargetOptions(input);\n return this.runtime.click(normalized);\n }\n\n async hover(input: OpensteerTargetOptions): Promise<OpensteerActionResult> {\n const normalized = normalizeTargetOptions(input);\n return this.runtime.hover(normalized);\n }\n\n async input(input: OpensteerInputOptions): Promise<OpensteerActionResult> {\n const normalized = normalizeTargetOptions(input);\n return this.runtime.input({\n ...normalized,\n text: input.text,\n ...(input.pressEnter === undefined ? {} : { pressEnter: input.pressEnter }),\n });\n }\n\n async scroll(input: OpensteerScrollOptions): Promise<OpensteerActionResult> {\n const normalized = normalizeTargetOptions(input);\n return this.runtime.scroll({\n ...normalized,\n direction: input.direction,\n amount: input.amount,\n });\n }\n\n async extract(input: OpensteerExtractOptions): Promise<OpensteerDomExtractOutput[\"data\"]> {\n const result = await this.runtime.extract(input);\n return result.data;\n }\n\n async queryNetwork(\n input: OpensteerNetworkQueryOptions = {},\n ): Promise<OpensteerNetworkQueryResult> {\n return this.runtime.queryNetwork(input);\n }\n\n async waitForNetwork(\n input: OpensteerWaitForNetworkOptions,\n ): Promise<OpensteerNetworkQueryResult[\"records\"][number]> {\n const { timeoutMs, pollIntervalMs, ...query } = input;\n const timeoutAt = Date.now() + (timeoutMs ?? 30_000);\n const pollInterval = pollIntervalMs ?? 100;\n\n while (true) {\n const { records } = await this.runtime.queryNetwork({\n ...query,\n limit: 1,\n });\n if (records[0] !== undefined) {\n return records[0];\n }\n if (Date.now() >= timeoutAt) {\n throw new Error(\"waitForNetwork timed out\");\n }\n await delay(pollInterval);\n }\n }\n\n async waitForResponse(\n input: OpensteerWaitForNetworkOptions,\n ): Promise<OpensteerNetworkQueryResult[\"records\"][number]> {\n return this.waitForNetwork(input);\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 { pages } = await this.runtime.listPages();\n const match = 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(input: OpensteerSnapshotOptions = {}): Promise<OpensteerSnapshotResult> {\n return this.runtime.snapshot(typeof input === \"string\" ? { mode: input } : input);\n }\n\n async saveNetwork(input: OpensteerNetworkSaveOptions): Promise<OpensteerNetworkSaveResult> {\n return this.runtime.saveNetwork(input);\n }\n\n async minimizeNetwork(\n input: OpensteerNetworkMinimizeOptions,\n ): Promise<OpensteerNetworkMinimizeResult> {\n return this.runtime.minimizeNetwork(input);\n }\n\n async diffNetwork(input: OpensteerNetworkDiffOptions): Promise<OpensteerNetworkDiffResult> {\n return this.runtime.diffNetwork(input);\n }\n\n async probeNetwork(input: OpensteerNetworkProbeOptions): Promise<OpensteerNetworkProbeResult> {\n return this.runtime.probeNetwork(input);\n }\n\n async reverseDiscover(\n input: OpensteerReverseDiscoverOptions = {},\n ): Promise<OpensteerReverseDiscoverResult> {\n return this.runtime.discoverReverse(input);\n }\n\n async reverseQuery(input: OpensteerReverseQueryOptions): Promise<OpensteerReverseQueryResult> {\n return this.runtime.queryReverse(input);\n }\n\n async createReversePackage(\n input: OpensteerReversePackageCreateOptions,\n ): Promise<OpensteerReversePackageCreateResult> {\n return this.runtime.createReversePackage(input);\n }\n\n async runReversePackage(\n input: OpensteerReversePackageRunOptions,\n ): Promise<OpensteerReversePackageRunResult> {\n return this.runtime.runReversePackage(input);\n }\n\n async reverseExport(input: OpensteerReverseExportOptions): Promise<OpensteerReverseExportResult> {\n return this.runtime.exportReverse(input);\n }\n\n async reverseReport(input: OpensteerReverseReportOptions): Promise<OpensteerReverseReportResult> {\n return this.runtime.getReverseReport(input);\n }\n\n async getReversePackage(\n input: OpensteerReversePackageGetOptions,\n ): Promise<OpensteerReversePackageGetResult> {\n return this.runtime.getReversePackage(input);\n }\n\n async listReversePackages(\n input: OpensteerReversePackageListOptions = {},\n ): Promise<OpensteerReversePackageListResult> {\n return this.runtime.listReversePackages(input);\n }\n\n async patchReversePackage(\n input: OpensteerReversePackagePatchOptions,\n ): Promise<OpensteerReversePackagePatchResult> {\n return this.runtime.patchReversePackage(input);\n }\n\n async interactionCapture(\n input: OpensteerInteractionCaptureOptions,\n ): Promise<OpensteerInteractionCaptureResult> {\n return this.runtime.captureInteraction(input);\n }\n\n async getInteraction(\n input: OpensteerInteractionGetOptions,\n ): Promise<OpensteerInteractionGetResult> {\n return this.runtime.getInteraction(input);\n }\n\n async interactionDiff(\n input: OpensteerInteractionDiffOptions,\n ): Promise<OpensteerInteractionDiffResult> {\n return this.runtime.diffInteraction(input);\n }\n\n async interactionReplay(\n input: OpensteerInteractionReplayOptions,\n ): Promise<OpensteerInteractionReplayResult> {\n return this.runtime.replayInteraction(input);\n }\n\n async clearNetwork(\n input: OpensteerNetworkClearOptions = {},\n ): Promise<OpensteerNetworkClearResult> {\n return this.runtime.clearNetwork(input);\n }\n\n async captureScripts(\n input: OpensteerCaptureScriptsOptions = {},\n ): Promise<OpensteerCaptureScriptsResult> {\n return this.runtime.captureScripts(input);\n }\n\n async readArtifact(input: OpensteerArtifactReadOptions): Promise<OpensteerArtifactReadResult> {\n return this.runtime.readArtifact(input);\n }\n\n async beautifyScript(\n input: OpensteerScriptBeautifyOptions,\n ): Promise<OpensteerScriptBeautifyResult> {\n return this.runtime.beautifyScript(input);\n }\n\n async deobfuscateScript(\n input: OpensteerScriptDeobfuscateOptions,\n ): Promise<OpensteerScriptDeobfuscateResult> {\n return this.runtime.deobfuscateScript(input);\n }\n\n async sandboxScript(input: OpensteerScriptSandboxOptions): Promise<OpensteerScriptSandboxResult> {\n return this.runtime.sandboxScript(input);\n }\n\n async solveCaptcha(input: OpensteerCaptchaSolveOptions): Promise<OpensteerCaptchaSolveResult> {\n return this.runtime.solveCaptcha(input);\n }\n\n async getCookies(\n input: { readonly urls?: readonly string[] } = {},\n ): Promise<readonly CookieRecord[]> {\n return this.runtime.getCookies(input);\n }\n\n async getStorageSnapshot(\n input: {\n readonly includeSessionStorage?: boolean;\n readonly includeIndexedDb?: boolean;\n } = {},\n ): Promise<StorageSnapshot> {\n return this.runtime.getStorageSnapshot(input);\n }\n\n async writeRequestPlan(input: OpensteerWriteRequestPlanInput): Promise<RequestPlanRecord> {\n return this.runtime.writeRequestPlan(input);\n }\n\n async inferRequestPlan(input: OpensteerInferRequestPlanInput): Promise<RequestPlanRecord> {\n return this.runtime.inferRequestPlan(input);\n }\n\n async getRequestPlan(input: OpensteerGetRequestPlanInput): Promise<RequestPlanRecord> {\n return this.runtime.getRequestPlan(input);\n }\n\n async listRequestPlans(\n input: OpensteerListRequestPlansInput = {},\n ): Promise<OpensteerListRequestPlansOutput> {\n return this.runtime.listRequestPlans(input);\n }\n\n async writeAuthRecipe(input: OpensteerWriteAuthRecipeInput): Promise<AuthRecipeRecord> {\n return this.runtime.writeAuthRecipe(input);\n }\n\n async writeRecipe(input: OpensteerWriteRecipeInput): Promise<RecipeRecord> {\n return this.runtime.writeRecipe(input);\n }\n\n async getAuthRecipe(input: OpensteerGetAuthRecipeInput): Promise<AuthRecipeRecord> {\n return this.runtime.getAuthRecipe(input);\n }\n\n async getRecipe(input: OpensteerGetRecipeInput): Promise<RecipeRecord> {\n return this.runtime.getRecipe(input);\n }\n\n async listAuthRecipes(\n input: OpensteerListAuthRecipesInput = {},\n ): Promise<OpensteerListAuthRecipesOutput> {\n return this.runtime.listAuthRecipes(input);\n }\n\n async listRecipes(input: OpensteerListRecipesInput = {}): Promise<OpensteerListRecipesOutput> {\n return this.runtime.listRecipes(input);\n }\n\n async runAuthRecipe(input: OpensteerRunAuthRecipeInput): Promise<OpensteerRunAuthRecipeOutput> {\n return this.runtime.runAuthRecipe(input);\n }\n\n async runRecipe(input: OpensteerRunRecipeInput): Promise<OpensteerRunRecipeOutput> {\n return this.runtime.runRecipe(input);\n }\n\n async request(key: string, input: OpensteerRequestOptions = {}): Promise<OpensteerRequestResult> {\n return this.runtime.request({\n key,\n ...input,\n });\n }\n\n async rawRequest(input: OpensteerRawRequestOptions): Promise<OpensteerRawRequestResult> {\n return this.runtime.rawRequest(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 computerExecute(\n input: OpensteerComputerExecuteOptions,\n ): Promise<OpensteerComputerExecuteResult> {\n return this.runtime.computerExecute(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 (isInstrumentableRuntime(this.runtime)) {\n return this.runtime;\n }\n throw new Error(`${method}() is not available for this session runtime.`);\n }\n}\n\nfunction isInstrumentableRuntime(\n runtime: OpensteerDisconnectableRuntime,\n): runtime is OpensteerDisconnectableRuntime & OpensteerInstrumentableRuntime {\n return (\n typeof (runtime as Partial<OpensteerInstrumentableRuntime>).route === \"function\" &&\n typeof (runtime as Partial<OpensteerInstrumentableRuntime>).interceptScript === \"function\"\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 persistAsDescription?: string;\n readonly networkTag?: 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 description.\");\n }\n\n if (hasElement) {\n return {\n target: {\n kind: \"element\",\n element: input.element!,\n },\n ...(input.description === undefined ? {} : { persistAsDescription: input.description }),\n ...(input.networkTag === undefined ? {} : { networkTag: input.networkTag }),\n };\n }\n\n if (hasSelector) {\n return {\n target: {\n kind: \"selector\",\n selector: input.selector!,\n },\n ...(input.description === undefined ? {} : { persistAsDescription: input.description }),\n ...(input.networkTag === undefined ? {} : { networkTag: input.networkTag }),\n };\n }\n\n if (input.description === undefined) {\n throw new Error(\"Specify exactly one of element, selector, or description.\");\n }\n\n return {\n target: {\n kind: \"description\",\n description: input.description,\n },\n ...(input.networkTag === undefined ? {} : { networkTag: input.networkTag }),\n };\n}\n\nfunction delay(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opensteer",
3
- "version": "0.8.2",
3
+ "version": "0.8.4",
4
4
  "description": "Opensteer browser automation, replay, and reverse-engineering toolkit.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -55,13 +55,15 @@
55
55
  "prettier": "^3.8.1",
56
56
  "sharp": "^0.34.5",
57
57
  "skills": "^1.4.6",
58
+ "ws": "^8.18.0",
59
+ "@opensteer/runtime-core": "0.1.0",
58
60
  "@opensteer/engine-playwright": "0.8.0"
59
61
  },
60
62
  "optionalDependencies": {
61
63
  "webcrack": "^2.15.1"
62
64
  },
63
65
  "peerDependencies": {
64
- "@opensteer/engine-abp": "0.8.0"
66
+ "@opensteer/engine-abp": "0.8.1"
65
67
  },
66
68
  "peerDependenciesMeta": {
67
69
  "@opensteer/engine-abp": {
@@ -70,8 +72,7 @@
70
72
  },
71
73
  "devDependencies": {
72
74
  "@opensteer/browser-core": "0.7.0",
73
- "@opensteer/cloud-contracts": "0.7.0",
74
- "@opensteer/engine-abp": "0.8.0",
75
+ "@opensteer/engine-abp": "0.8.1",
75
76
  "@opensteer/protocol": "0.7.0"
76
77
  },
77
78
  "scripts": {
@@ -6,15 +6,39 @@ argument-hint: "[goal]"
6
6
 
7
7
  # Opensteer
8
8
 
9
+ ## Critical Rules
10
+
11
+ 1. Run `snapshot action` or `snapshot extraction` first. The output is JSON with `{url, title, mode, html, counters}`. **Read the `html` field** — it is a clean filtered DOM with inline `c="N"` attributes marking every element. Do NOT parse the `counters` array for element discovery — it is verbose metadata.
12
+ 2. Use `element` + `persistAsDescription` to act on elements. Use `extract()` with `description` + `schema` to extract data. Do NOT use `page.evaluate()`, CSS selectors, or raw DOM parsing when `extract()` can express the output.
13
+ 3. Array extraction auto-generalizes: provide 1-2 representative rows as templates, and the extractor finds ALL matching rows on the page.
14
+ 4. `persistAsDescription` requires the verbose `opensteer run dom.*` syntax. The short CLI commands (`click`, `input`, etc.) do NOT support it.
15
+ 5. Phase 1 = CLI exploration (snapshot, act, extract). Phase 2 = deterministic scripts using `description` alone. No snapshots in Phase 2.
16
+
9
17
  If invoked directly, treat `$ARGUMENTS` as the concrete browser or replay goal. First decide whether the task is primarily DOM automation, request capture/replay, or workspace browser administration.
10
18
 
11
- Use this skill when a task needs a real browser workflow, persistent workspace browser state, structured DOM extraction, or browser-backed request replay.
19
+ ## Snapshot Output
20
+
21
+ `snapshot action` and `snapshot extraction` return JSON. Read the `html` field:
22
+
23
+ ```json
24
+ {
25
+ "url": "https://example.com/search?q=airpods",
26
+ "title": "Search Results",
27
+ "mode": "extraction",
28
+ "html": "<span c=\"12\">$549.99</span>\n<a c=\"15\" href=\"/p/airpods-max\">\n <div c=\"16\">Apple AirPods Max</div>\n</a>\n<a c=\"18\" href=\"/b/apple\">Apple</a>\n...",
29
+ "counters": [{"element":12,"tagName":"SPAN",...}, ...]
30
+ }
31
+ ```
12
32
 
13
- Choose the reference that matches the job:
33
+ `c="N"` in the HTML = `element: N` in commands and extraction schemas. Read the HTML, find the `c` values, use those numbers.
14
34
 
15
- - CLI exploration and browser admin: [references/cli-reference.md](references/cli-reference.md)
16
- - SDK automation and reusable code: [references/sdk-reference.md](references/sdk-reference.md)
17
- - Request capture, plans, and recipes: [references/request-workflow.md](references/request-workflow.md)
35
+ ## References
36
+
37
+ Most DOM tasks use the CLI reference first (exploration), then the SDK reference (final script). Load both.
38
+
39
+ - [CLI Reference](references/cli-reference.md) — snapshot, act, extract from the terminal
40
+ - [SDK Reference](references/sdk-reference.md) — reusable TypeScript code
41
+ - [Request Workflow](references/request-workflow.md) — capture and replay HTTP requests
18
42
 
19
43
  ## Startup Checks
20
44
 
@@ -30,22 +54,51 @@ Choose the reference that matches the job:
30
54
  - With a workspace, browser mode defaults to `persistent`. `temporary` creates an isolated browser for the current run. `attach` connects to an already-running Chromium browser.
31
55
  - `opensteer browser ...` manages the workspace browser itself. `opensteer close` stops the active session/browser without deleting the workspace. `browser reset` clears cloned browser state. `browser delete` removes workspace browser files.
32
56
  - The short CLI only has special parsing for a few common commands. For advanced semantic operations or fields like `persistAsDescription`, use `opensteer run <semantic-operation> --workspace <id> --input-json <json>`.
57
+ - Prefer CLI `snapshot` during exploration so you can inspect the filtered HTML and `c="N"` counters directly. The SDK also exposes `snapshot()`, but this skill uses the CLI-first workflow and expects deterministic scripts to replay cached descriptors via `description`.
33
58
  - Prefer Opensteer surfaces over raw Playwright so descriptors, extraction payloads, saved network, request plans, recipes, traces, and artifacts stay in the workspace.
34
59
 
35
- ## Workflow Selection
60
+ ## Two-Phase Workflow
61
+
62
+ **Phase 1 — CLI exploration (one-time setup):**
63
+
64
+ ```bash
65
+ opensteer open https://example.com --workspace demo
66
+ opensteer snapshot action --workspace demo
67
+ # → Read html field: <input c="5" placeholder="Search"> <button c="7">Search</button>
36
68
 
37
- - Choose the DOM workflow when the answer must come from the rendered page or a real browser interaction.
38
- - Choose the request workflow when the durable artifact is an HTTP path, request plan, recipe, or reverse-analysis package.
39
- - Many tasks use both: prove the browser flow first, then capture and promote the underlying request path.
69
+ opensteer run dom.input --workspace demo \
70
+ --input-json '{"target":{"kind":"element","element":5},"text":"airpods","pressEnter":true,"persistAsDescription":"search input"}'
71
+
72
+ opensteer snapshot extraction --workspace demo
73
+ # → Read html field: <div c="13">Apple AirPods</div> <span c="14">$189.99</span> ...
74
+
75
+ opensteer extract --workspace demo --description "search results" \
76
+ --schema-json '{"items":[{"name":{"element":13},"price":{"element":14}}]}'
77
+ # → Returns ALL matching rows on the page, not just the 1 template
78
+
79
+ opensteer close --workspace demo
80
+ ```
81
+
82
+ **Phase 2 — Deterministic script (reusable):**
83
+
84
+ 1. Use `description` alone for all interactions — resolves from cached descriptors.
85
+ 2. Use `description + schema` for extraction — caches the extraction descriptor.
86
+ 3. Use bare `description` for extraction replay.
87
+ 4. No snapshot calls needed in scripts. Just descriptions.
40
88
 
41
89
  ## Shared Rules
42
90
 
43
- - Use `snapshot("action")` or `snapshot action` before counter-based `element` targets.
44
- - Re-snapshot after navigation or DOM-changing actions before reusing element counters.
45
- - In the SDK, `selector + description` or `element + description` persists a DOM action descriptor. `description` alone reuses it later.
46
- - In the CLI, the short `click` / `hover` / `input` / `scroll` forms accept exactly one target. Use `opensteer run dom.* --input-json` when you need `persistAsDescription`.
91
+ - The short CLI commands (`click`, `input`, etc.) accept exactly one of `--element`, `--selector`, or `--description`. Use `opensteer run dom.*` with `--input-json` when you need `persistAsDescription`.
47
92
  - For extraction, `description + schema` authors or updates a persisted extraction descriptor. `description` alone replays the stored extraction payload.
48
93
  - Extraction schemas are explicit JSON objects and arrays. Each leaf must be `{ element: N }`, `{ selector: "..." }`, optional `attribute`, or `{ source: "current_url" }`.
49
94
  - Persisted extraction replay is deterministic and snapshot-backed. Do not replace `extract()` with `evaluate()` or custom DOM parsing when the desired output fits the extraction schema.
50
95
  - Use recipes for deterministic setup work. Use auth recipes for auth refresh/setup specifically. They live in separate registries.
96
+ - CSS selectors exist as a low-level escape hatch but are not recommended for reusable scripts. Prefer the descriptor-based workflow.
51
97
  - Do not reach for removed surfaces such as `--name`, `Opensteer.attach()`, cloud/profile-sync helpers, `local-profile`, legacy snapshot browser modes, or `@opensteer/engine-abp`.
98
+
99
+ ## Common Mistakes
100
+
101
+ - Parsing the `counters` JSON array instead of reading the `html` string. Read the HTML — find `c="N"` values.
102
+ - Using `page.evaluate()` or CSS selectors instead of `extract()`. Use extract with element-based schemas.
103
+ - Forgetting to re-snapshot after navigation. Always re-snapshot before targeting new elements.
104
+ - Using short CLI (`click`, `input`) when `persistAsDescription` is needed. Use `opensteer run dom.*`.