opensteer 0.6.7 → 0.6.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -463,8 +463,12 @@ __export(index_exports, {
463
463
  clearPersistentProfileSingletons: () => clearPersistentProfileSingletons,
464
464
  cloneElementPath: () => cloneElementPath,
465
465
  closeTab: () => closeTab,
466
+ cloudActionMethods: () => cloudActionMethods,
467
+ cloudErrorCodes: () => cloudErrorCodes,
466
468
  cloudNotLaunchedError: () => cloudNotLaunchedError,
467
469
  cloudSessionContractVersion: () => cloudSessionContractVersion,
470
+ cloudSessionSourceTypes: () => cloudSessionSourceTypes,
471
+ cloudSessionStatuses: () => cloudSessionStatuses,
468
472
  cloudUnsupportedMethodError: () => cloudUnsupportedMethodError,
469
473
  collectLocalSelectorCacheEntries: () => collectLocalSelectorCacheEntries,
470
474
  countArrayItemsWithPath: () => countArrayItemsWithPath,
@@ -489,6 +493,10 @@ __export(index_exports, {
489
493
  getPageHtml: () => getPageHtml,
490
494
  getPageTitle: () => getPageTitle,
491
495
  importCookies: () => importCookies,
496
+ isCloudActionMethod: () => isCloudActionMethod,
497
+ isCloudErrorCode: () => isCloudErrorCode,
498
+ isCloudSessionSourceType: () => isCloudSessionSourceType,
499
+ isCloudSessionStatus: () => isCloudSessionStatus,
492
500
  listLocalChromeProfiles: () => listLocalChromeProfiles,
493
501
  listTabs: () => listTabs,
494
502
  markInteractiveElements: () => markInteractiveElements,
@@ -4586,6 +4594,47 @@ async function markInteractiveElements(page, {
4586
4594
  "search",
4587
4595
  "searchbox"
4588
4596
  ]);
4597
+ function isExplicitlyHidden(el, style) {
4598
+ if (el.hasAttribute("hidden")) {
4599
+ return true;
4600
+ }
4601
+ if (el.getAttribute("aria-hidden") === "true") {
4602
+ return true;
4603
+ }
4604
+ if (style.display === "none") {
4605
+ return true;
4606
+ }
4607
+ if (style.visibility === "hidden" || style.visibility === "collapse") {
4608
+ return true;
4609
+ }
4610
+ const opacity = Number.parseFloat(style.opacity);
4611
+ return Number.isFinite(opacity) && opacity <= 0;
4612
+ }
4613
+ function hasVisibleOutOfFlowChild(el) {
4614
+ const children = el.children;
4615
+ for (let i = 0; i < children.length; i++) {
4616
+ const child = children[i];
4617
+ const childStyle = window.getComputedStyle(child);
4618
+ if (childStyle.position !== "fixed" && childStyle.position !== "absolute") {
4619
+ continue;
4620
+ }
4621
+ const childRect = child.getBoundingClientRect();
4622
+ if (childRect.width > 0 && childRect.height > 0) {
4623
+ return true;
4624
+ }
4625
+ }
4626
+ return false;
4627
+ }
4628
+ function isHiddenByOwnRect(el, style) {
4629
+ if (style.display === "contents") {
4630
+ return false;
4631
+ }
4632
+ const rect = el.getBoundingClientRect();
4633
+ if (rect.width > 0 && rect.height > 0) {
4634
+ return false;
4635
+ }
4636
+ return !hasVisibleOutOfFlowChild(el);
4637
+ }
4589
4638
  const roots = [document];
4590
4639
  while (roots.length) {
4591
4640
  const root = roots.pop();
@@ -4601,42 +4650,7 @@ async function markInteractiveElements(page, {
4601
4650
  continue;
4602
4651
  }
4603
4652
  const style = window.getComputedStyle(el);
4604
- let hidden = false;
4605
- if (el.hasAttribute("hidden")) {
4606
- hidden = true;
4607
- } else if (el.getAttribute("aria-hidden") === "true") {
4608
- hidden = true;
4609
- } else if (style.display === "none") {
4610
- hidden = true;
4611
- } else if (style.visibility === "hidden" || style.visibility === "collapse") {
4612
- hidden = true;
4613
- }
4614
- if (!hidden) {
4615
- const opacity = Number.parseFloat(style.opacity);
4616
- if (Number.isFinite(opacity) && opacity <= 0) {
4617
- hidden = true;
4618
- }
4619
- }
4620
- if (!hidden) {
4621
- const rect = el.getBoundingClientRect();
4622
- if (rect.width <= 0 || rect.height <= 0) {
4623
- hidden = true;
4624
- const children = el.children;
4625
- for (let i = 0; i < children.length; i++) {
4626
- const childStyle = window.getComputedStyle(
4627
- children[i]
4628
- );
4629
- if (childStyle.position !== "fixed" && childStyle.position !== "absolute") {
4630
- continue;
4631
- }
4632
- const childRect = children[i].getBoundingClientRect();
4633
- if (childRect.width > 0 && childRect.height > 0) {
4634
- hidden = false;
4635
- break;
4636
- }
4637
- }
4638
- }
4639
- }
4653
+ const hidden = isExplicitlyHidden(el, style) || isHiddenByOwnRect(el, style);
4640
4654
  if (hidden) {
4641
4655
  el.setAttribute(hiddenAttr, "1");
4642
4656
  el.removeAttribute(markAttribute2);
@@ -9016,7 +9030,99 @@ function stripPositionClauses2(path5) {
9016
9030
  }
9017
9031
 
9018
9032
  // src/cloud/contracts.ts
9033
+ var cloudActionMethods = [
9034
+ "goto",
9035
+ "snapshot",
9036
+ "screenshot",
9037
+ "state",
9038
+ "click",
9039
+ "dblclick",
9040
+ "rightclick",
9041
+ "hover",
9042
+ "input",
9043
+ "select",
9044
+ "scroll",
9045
+ "tabs",
9046
+ "newTab",
9047
+ "switchTab",
9048
+ "closeTab",
9049
+ "getCookies",
9050
+ "setCookie",
9051
+ "clearCookies",
9052
+ "pressKey",
9053
+ "type",
9054
+ "getElementText",
9055
+ "getElementValue",
9056
+ "getElementAttributes",
9057
+ "getElementBoundingBox",
9058
+ "getHtml",
9059
+ "getTitle",
9060
+ "uploadFile",
9061
+ "exportCookies",
9062
+ "importCookies",
9063
+ "waitForText",
9064
+ "extract",
9065
+ "extractFromPlan",
9066
+ "clearCache"
9067
+ ];
9068
+ var cloudErrorCodes = [
9069
+ "CLOUD_AUTH_FAILED",
9070
+ "CLOUD_SESSION_NOT_FOUND",
9071
+ "CLOUD_SESSION_CLOSED",
9072
+ "CLOUD_UNSUPPORTED_METHOD",
9073
+ "CLOUD_INVALID_REQUEST",
9074
+ "CLOUD_MODEL_NOT_ALLOWED",
9075
+ "CLOUD_ACTION_FAILED",
9076
+ "CLOUD_CAPACITY_EXHAUSTED",
9077
+ "CLOUD_RUNTIME_UNAVAILABLE",
9078
+ "CLOUD_RUNTIME_MISMATCH",
9079
+ "CLOUD_SESSION_STALE",
9080
+ "CLOUD_CONTROL_PLANE_ERROR",
9081
+ "CLOUD_CONTRACT_MISMATCH",
9082
+ "CLOUD_PROXY_UNAVAILABLE",
9083
+ "CLOUD_PROXY_REQUIRED",
9084
+ "CLOUD_BILLING_LIMIT_REACHED",
9085
+ "CLOUD_RATE_LIMITED",
9086
+ "CLOUD_BROWSER_PROFILE_NOT_FOUND",
9087
+ "CLOUD_BROWSER_PROFILE_BUSY",
9088
+ "CLOUD_BROWSER_PROFILE_DISABLED",
9089
+ "CLOUD_BROWSER_PROFILE_PROXY_UNAVAILABLE",
9090
+ "CLOUD_BROWSER_PROFILE_SYNC_FAILED",
9091
+ "CLOUD_INTERNAL"
9092
+ ];
9093
+ var cloudSessionStatuses = [
9094
+ "provisioning",
9095
+ "active",
9096
+ "closing",
9097
+ "closed",
9098
+ "failed"
9099
+ ];
9019
9100
  var cloudSessionContractVersion = "v3";
9101
+ var cloudSessionSourceTypes = [
9102
+ "agent-thread",
9103
+ "agent-run",
9104
+ "project-agent-run",
9105
+ "local-cloud",
9106
+ "manual"
9107
+ ];
9108
+ var cloudActionMethodSet = new Set(cloudActionMethods);
9109
+ var cloudErrorCodeSet = new Set(cloudErrorCodes);
9110
+ var cloudSessionSourceTypeSet = new Set(
9111
+ cloudSessionSourceTypes
9112
+ );
9113
+ var cloudSessionStatusSet = new Set(cloudSessionStatuses);
9114
+ function isCloudActionMethod(value) {
9115
+ return typeof value === "string" && cloudActionMethodSet.has(value);
9116
+ }
9117
+ function isCloudErrorCode(value) {
9118
+ return typeof value === "string" && cloudErrorCodeSet.has(value);
9119
+ }
9120
+ function isCloudSessionSourceType(value) {
9121
+ return typeof value === "string" && cloudSessionSourceTypeSet.has(value);
9122
+ }
9123
+ function isCloudSessionStatus(value) {
9124
+ return typeof value === "string" && cloudSessionStatusSet.has(value);
9125
+ }
9020
9126
 
9021
9127
  // src/cloud/action-ws-client.ts
9022
9128
  var import_ws2 = __toESM(require("ws"), 1);
@@ -9047,6 +9153,13 @@ function cloudNotLaunchedError() {
9047
9153
  );
9048
9154
  }
9049
9155
 
9156
+ // src/cloud/ws-url.ts
9157
+ function withTokenQuery(wsUrl, token) {
9158
+ const url = new URL(wsUrl);
9159
+ url.searchParams.set("token", token);
9160
+ return url.toString();
9161
+ }
9162
+
9050
9163
  // src/cloud/action-ws-client.ts
9051
9164
  var ActionWsClient = class _ActionWsClient {
9052
9165
  ws;
@@ -9175,11 +9288,6 @@ function rawDataToUtf8(raw) {
9175
9288
  if (Array.isArray(raw)) return Buffer.concat(raw).toString("utf8");
9176
9289
  return raw.toString("utf8");
9177
9290
  }
9178
- function withTokenQuery(wsUrl, token) {
9179
- const url = new URL(wsUrl);
9180
- url.searchParams.set("token", token);
9181
- return url.toString();
9182
- }
9183
9291
 
9184
9292
  // src/cloud/local-cache-sync.ts
9185
9293
  var import_fs4 = __toESM(require("fs"), 1);
@@ -9319,7 +9427,7 @@ function dedupeNewest(entries) {
9319
9427
  var import_playwright2 = require("playwright");
9320
9428
  var CloudCdpClient = class {
9321
9429
  async connect(args) {
9322
- const endpoint = withTokenQuery2(args.wsUrl, args.token);
9430
+ const endpoint = withTokenQuery(args.wsUrl, args.token);
9323
9431
  let browser;
9324
9432
  try {
9325
9433
  browser = await import_playwright2.chromium.connectOverCDP(endpoint);
@@ -9371,11 +9479,6 @@ function isInternalOrEmptyUrl(url) {
9371
9479
  if (url === "about:blank") return true;
9372
9480
  return url.startsWith("chrome://") || url.startsWith("devtools://") || url.startsWith("edge://");
9373
9481
  }
9374
- function withTokenQuery2(wsUrl, token) {
9375
- const url = new URL(wsUrl);
9376
- url.searchParams.set("token", token);
9377
- return url.toString();
9378
- }
9379
9482
 
9380
9483
  // src/utils/strip-trailing-slashes.ts
9381
9484
  function stripTrailingSlashes(value) {
@@ -9412,10 +9515,7 @@ async function parseCloudHttpError(response) {
9412
9515
  return new OpensteerCloudError(code, message, response.status, body?.details);
9413
9516
  }
9414
9517
  function toCloudErrorCode(code) {
9415
- if (code === "CLOUD_AUTH_FAILED" || code === "CLOUD_SESSION_NOT_FOUND" || code === "CLOUD_SESSION_CLOSED" || code === "CLOUD_UNSUPPORTED_METHOD" || code === "CLOUD_INVALID_REQUEST" || code === "CLOUD_MODEL_NOT_ALLOWED" || code === "CLOUD_ACTION_FAILED" || code === "CLOUD_INTERNAL" || code === "CLOUD_CAPACITY_EXHAUSTED" || code === "CLOUD_RUNTIME_UNAVAILABLE" || code === "CLOUD_RUNTIME_MISMATCH" || code === "CLOUD_SESSION_STALE" || code === "CLOUD_CONTRACT_MISMATCH" || code === "CLOUD_CONTROL_PLANE_ERROR" || code === "CLOUD_PROXY_UNAVAILABLE" || code === "CLOUD_PROXY_REQUIRED" || code === "CLOUD_BILLING_LIMIT_REACHED" || code === "CLOUD_RATE_LIMITED" || code === "CLOUD_BROWSER_PROFILE_NOT_FOUND" || code === "CLOUD_BROWSER_PROFILE_BUSY" || code === "CLOUD_BROWSER_PROFILE_DISABLED" || code === "CLOUD_BROWSER_PROFILE_PROXY_UNAVAILABLE" || code === "CLOUD_BROWSER_PROFILE_SYNC_FAILED") {
9416
- return code;
9417
- }
9418
- return "CLOUD_TRANSPORT_ERROR";
9518
+ return isCloudErrorCode(code) ? code : "CLOUD_TRANSPORT_ERROR";
9419
9519
  }
9420
9520
 
9421
9521
  // src/cloud/session-client.ts
@@ -9522,7 +9622,12 @@ function parseCreateResponse(body, status) {
9522
9622
  status,
9523
9623
  "cloudSession"
9524
9624
  ),
9525
- state: requireString(cloudSessionRoot, "state", status, "cloudSession"),
9625
+ state: requireSessionStatus(
9626
+ cloudSessionRoot,
9627
+ "state",
9628
+ status,
9629
+ "cloudSession"
9630
+ ),
9526
9631
  createdAt: requireNumber(cloudSessionRoot, "createdAt", status, "cloudSession"),
9527
9632
  sourceType: requireSourceType(cloudSessionRoot, "sourceType", status, "cloudSession"),
9528
9633
  sourceRef: optionalString(cloudSessionRoot, "sourceRef", status, "cloudSession"),
@@ -9610,7 +9715,21 @@ function optionalNumber(source, field, status, parent) {
9610
9715
  }
9611
9716
  function requireSourceType(source, field, status, parent) {
9612
9717
  const value = source[field];
9613
- if (value === "agent-thread" || value === "agent-run" || value === "local-cloud" || value === "manual") {
9718
+ if (isCloudSessionSourceType(value)) {
9719
+ return value;
9720
+ }
9721
+ throw new OpensteerCloudError(
9722
+ "CLOUD_CONTRACT_MISMATCH",
9723
+ `Invalid cloud session create response: ${formatFieldPath(
9724
+ field,
9725
+ parent
9726
+ )} must be one of ${formatAllowedValues(cloudSessionSourceTypes)}.`,
9727
+ status
9728
+ );
9729
+ }
9730
+ function requireSessionStatus(source, field, status, parent) {
9731
+ const value = source[field];
9732
+ if (isCloudSessionStatus(value)) {
9614
9733
  return value;
9615
9734
  }
9616
9735
  throw new OpensteerCloudError(
@@ -9618,13 +9737,26 @@ function requireSourceType(source, field, status, parent) {
9618
9737
  `Invalid cloud session create response: ${formatFieldPath(
9619
9738
  field,
9620
9739
  parent
9621
- )} must be one of "agent-thread", "agent-run", "local-cloud", or "manual".`,
9740
+ )} must be one of ${formatAllowedValues(cloudSessionStatuses)}.`,
9622
9741
  status
9623
9742
  );
9624
9743
  }
9625
9744
  function formatFieldPath(field, parent) {
9626
9745
  return parent ? `"${parent}.${field}"` : `"${field}"`;
9627
9746
  }
9747
+ function formatAllowedValues(values) {
9748
+ if (values.length === 0) {
9749
+ return "";
9750
+ }
9751
+ if (values.length === 1) {
9752
+ return `"${values[0]}"`;
9753
+ }
9754
+ if (values.length === 2) {
9755
+ return `"${values[0]}" or "${values[1]}"`;
9756
+ }
9757
+ const quotedValues = values.map((value) => `"${value}"`);
9758
+ return `${quotedValues.slice(0, -1).join(", ")}, or ${quotedValues[quotedValues.length - 1]}`;
9759
+ }
9628
9760
  function zeroImportResponse() {
9629
9761
  return {
9630
9762
  imported: 0,
@@ -15075,8 +15207,12 @@ function sleep7(ms) {
15075
15207
  clearPersistentProfileSingletons,
15076
15208
  cloneElementPath,
15077
15209
  closeTab,
15210
+ cloudActionMethods,
15211
+ cloudErrorCodes,
15078
15212
  cloudNotLaunchedError,
15079
15213
  cloudSessionContractVersion,
15214
+ cloudSessionSourceTypes,
15215
+ cloudSessionStatuses,
15080
15216
  cloudUnsupportedMethodError,
15081
15217
  collectLocalSelectorCacheEntries,
15082
15218
  countArrayItemsWithPath,
@@ -15101,6 +15237,10 @@ function sleep7(ms) {
15101
15237
  getPageHtml,
15102
15238
  getPageTitle,
15103
15239
  importCookies,
15240
+ isCloudActionMethod,
15241
+ isCloudErrorCode,
15242
+ isCloudSessionSourceType,
15243
+ isCloudSessionStatus,
15104
15244
  listLocalChromeProfiles,
15105
15245
  listTabs,
15106
15246
  markInteractiveElements,
package/dist/index.d.cts CHANGED
@@ -2,8 +2,8 @@ import * as playwright from 'playwright';
2
2
  import { Page, BrowserContext, ElementHandle, Cookie, Browser } from 'playwright';
3
3
  import { a as OpensteerConfig, L as LaunchOptions, b as OpensteerLocalProfileDescriptor, c as OpensteerRealBrowserOptions, G as GotoOptions, S as SnapshotOptions, d as StateResult, e as ScreenshotOptions, f as ClickOptions, A as ActionResult, H as HoverOptions, I as InputOptions, g as SelectOptions, h as ScrollOptions, T as TabInfo, C as CookieParam, B as BaseActionOptions, i as BoundingBox, F as FileUploadOptions, E as ExtractOptions, j as ExtractFromPlanOptions, k as ExtractionRunResult, l as OpensteerCursorState, m as OpensteerAgentConfig, n as OpensteerAgentInstance, o as ElementPath, p as SnapshotMode, q as AiResolveCallback, r as AiExtractCallback, O as OpensteerAuthScheme, s as OpensteerAgentProvider, t as OpensteerAgentAction, u as OpensteerAgentResult, v as OpensteerAgentUsage, w as OpensteerCursorStyle, x as OpensteerCursorConfig, y as OpensteerAgentExecuteOptions, z as OpensteerBrowserConfig } from './types-Cr10igF3.cjs';
4
4
  export { D as ActionWaitOptions, J as AiExtractArgs, K as AiExtractResult, M as AiResolveArgs, N as AiResolveCallbackResult, P as AiResolveResult, Q as AttributeMatchClause, R as ContextHop, U as DomPath, V as ExtractSchema, W as ExtractSchemaField, X as ExtractSchemaValue, Y as ExtractionFieldPlan, Z as ExtractionPlan, _ as MatchClause, $ as MatchOperator, a0 as OpensteerAgentMode, a1 as OpensteerAgentModelConfig, a2 as OpensteerCloudAnnouncePolicy, a3 as OpensteerCloudBrowserProfileOptions, a4 as OpensteerCloudConfig, a5 as OpensteerCloudOptions, a6 as OpensteerCursorColor, a7 as OpensteerCursorProfile, a8 as OpensteerLocalBrowserMode, a9 as OpensteerStorageConfig, aa as PathNode, ab as PathNodePosition, ac as PositionMatchClause } from './types-Cr10igF3.cjs';
5
- import { A as ActionFailure, e as ActionFailureCode, C as CloudErrorCode, f as CloudActionFailureDetails, g as CloudSessionCreateRequest, h as CloudSessionCreateResponse, i as CloudSelectorCacheImportRequest, j as CloudSelectorCacheImportResponse, k as CloudActionMethod, l as CloudSelectorCacheImportEntry } from './browser-profile-client-Biu6DyT6.cjs';
6
- export { m as ActionFailureBlocker, n as ActionFailureClassificationSource, o as ActionFailureDetails, p as BrowserProfileArchiveFormat, q as BrowserProfileClient, c as BrowserProfileCreateRequest, d as BrowserProfileDescriptor, a as BrowserProfileListRequest, b as BrowserProfileListResponse, r as BrowserProfileProxyPolicy, B as BrowserProfileStatus, s as CloudActionFailure, t as CloudActionRequest, u as CloudActionResponse, v as CloudActionSuccess, w as CloudBrowserProfileLaunchPreference, x as CloudFingerprintMode, y as CloudSessionContractVersion, z as CloudSessionLaunchConfig, D as CloudSessionSourceType, E as CloudSessionSummary, F as cloudSessionContractVersion } from './browser-profile-client-Biu6DyT6.cjs';
5
+ import { A as ActionFailure, e as ActionFailureCode, C as CloudErrorCode, f as CloudActionFailureDetails, g as CloudSessionCreateRequest, h as CloudSessionCreateResponse, i as CloudSelectorCacheImportRequest, j as CloudSelectorCacheImportResponse, k as CloudActionMethod, l as CloudSelectorCacheImportEntry } from './browser-profile-client-CGXc0-P9.cjs';
6
+ export { m as ActionFailureBlocker, n as ActionFailureClassificationSource, o as ActionFailureDetails, p as BrowserProfileArchiveFormat, q as BrowserProfileClient, c as BrowserProfileCreateRequest, d as BrowserProfileDescriptor, a as BrowserProfileListRequest, b as BrowserProfileListResponse, r as BrowserProfileProxyPolicy, B as BrowserProfileStatus, s as CloudActionFailure, t as CloudActionRequest, u as CloudActionResponse, v as CloudActionSuccess, w as CloudBrowserContextConfig, x as CloudBrowserExtensionConfig, y as CloudBrowserLaunchConfig, z as CloudBrowserProfileLaunchPreference, D as CloudFingerprintMode, E as CloudFingerprintPreference, F as CloudGeolocation, G as CloudProxyMode, H as CloudProxyPreference, I as CloudProxyProtocol, J as CloudSessionContractVersion, K as CloudSessionLaunchConfig, L as CloudSessionSourceType, M as CloudSessionStatus, N as CloudSessionSummary, O as CloudSessionVisibilityScope, P as CloudViewport, Q as cloudActionMethods, R as cloudErrorCodes, S as cloudSessionContractVersion, T as cloudSessionSourceTypes, U as cloudSessionStatuses, V as isCloudActionMethod, W as isCloudErrorCode, X as isCloudSessionSourceType, Y as isCloudSessionStatus } from './browser-profile-client-CGXc0-P9.cjs';
7
7
 
8
8
  interface RegistryEntry {
9
9
  file: string;
package/dist/index.d.ts CHANGED
@@ -2,8 +2,8 @@ import * as playwright from 'playwright';
2
2
  import { Page, BrowserContext, ElementHandle, Cookie, Browser } from 'playwright';
3
3
  import { a as OpensteerConfig, L as LaunchOptions, b as OpensteerLocalProfileDescriptor, c as OpensteerRealBrowserOptions, G as GotoOptions, S as SnapshotOptions, d as StateResult, e as ScreenshotOptions, f as ClickOptions, A as ActionResult, H as HoverOptions, I as InputOptions, g as SelectOptions, h as ScrollOptions, T as TabInfo, C as CookieParam, B as BaseActionOptions, i as BoundingBox, F as FileUploadOptions, E as ExtractOptions, j as ExtractFromPlanOptions, k as ExtractionRunResult, l as OpensteerCursorState, m as OpensteerAgentConfig, n as OpensteerAgentInstance, o as ElementPath, p as SnapshotMode, q as AiResolveCallback, r as AiExtractCallback, O as OpensteerAuthScheme, s as OpensteerAgentProvider, t as OpensteerAgentAction, u as OpensteerAgentResult, v as OpensteerAgentUsage, w as OpensteerCursorStyle, x as OpensteerCursorConfig, y as OpensteerAgentExecuteOptions, z as OpensteerBrowserConfig } from './types-Cr10igF3.js';
4
4
  export { D as ActionWaitOptions, J as AiExtractArgs, K as AiExtractResult, M as AiResolveArgs, N as AiResolveCallbackResult, P as AiResolveResult, Q as AttributeMatchClause, R as ContextHop, U as DomPath, V as ExtractSchema, W as ExtractSchemaField, X as ExtractSchemaValue, Y as ExtractionFieldPlan, Z as ExtractionPlan, _ as MatchClause, $ as MatchOperator, a0 as OpensteerAgentMode, a1 as OpensteerAgentModelConfig, a2 as OpensteerCloudAnnouncePolicy, a3 as OpensteerCloudBrowserProfileOptions, a4 as OpensteerCloudConfig, a5 as OpensteerCloudOptions, a6 as OpensteerCursorColor, a7 as OpensteerCursorProfile, a8 as OpensteerLocalBrowserMode, a9 as OpensteerStorageConfig, aa as PathNode, ab as PathNodePosition, ac as PositionMatchClause } from './types-Cr10igF3.js';
5
- import { A as ActionFailure, e as ActionFailureCode, C as CloudErrorCode, f as CloudActionFailureDetails, g as CloudSessionCreateRequest, h as CloudSessionCreateResponse, i as CloudSelectorCacheImportRequest, j as CloudSelectorCacheImportResponse, k as CloudActionMethod, l as CloudSelectorCacheImportEntry } from './browser-profile-client-AGTsLQxT.js';
6
- export { m as ActionFailureBlocker, n as ActionFailureClassificationSource, o as ActionFailureDetails, p as BrowserProfileArchiveFormat, q as BrowserProfileClient, c as BrowserProfileCreateRequest, d as BrowserProfileDescriptor, a as BrowserProfileListRequest, b as BrowserProfileListResponse, r as BrowserProfileProxyPolicy, B as BrowserProfileStatus, s as CloudActionFailure, t as CloudActionRequest, u as CloudActionResponse, v as CloudActionSuccess, w as CloudBrowserProfileLaunchPreference, x as CloudFingerprintMode, y as CloudSessionContractVersion, z as CloudSessionLaunchConfig, D as CloudSessionSourceType, E as CloudSessionSummary, F as cloudSessionContractVersion } from './browser-profile-client-AGTsLQxT.js';
5
+ import { A as ActionFailure, e as ActionFailureCode, C as CloudErrorCode, f as CloudActionFailureDetails, g as CloudSessionCreateRequest, h as CloudSessionCreateResponse, i as CloudSelectorCacheImportRequest, j as CloudSelectorCacheImportResponse, k as CloudActionMethod, l as CloudSelectorCacheImportEntry } from './browser-profile-client-DHLzMf-K.js';
6
+ export { m as ActionFailureBlocker, n as ActionFailureClassificationSource, o as ActionFailureDetails, p as BrowserProfileArchiveFormat, q as BrowserProfileClient, c as BrowserProfileCreateRequest, d as BrowserProfileDescriptor, a as BrowserProfileListRequest, b as BrowserProfileListResponse, r as BrowserProfileProxyPolicy, B as BrowserProfileStatus, s as CloudActionFailure, t as CloudActionRequest, u as CloudActionResponse, v as CloudActionSuccess, w as CloudBrowserContextConfig, x as CloudBrowserExtensionConfig, y as CloudBrowserLaunchConfig, z as CloudBrowserProfileLaunchPreference, D as CloudFingerprintMode, E as CloudFingerprintPreference, F as CloudGeolocation, G as CloudProxyMode, H as CloudProxyPreference, I as CloudProxyProtocol, J as CloudSessionContractVersion, K as CloudSessionLaunchConfig, L as CloudSessionSourceType, M as CloudSessionStatus, N as CloudSessionSummary, O as CloudSessionVisibilityScope, P as CloudViewport, Q as cloudActionMethods, R as cloudErrorCodes, S as cloudSessionContractVersion, T as cloudSessionSourceTypes, U as cloudSessionStatuses, V as isCloudActionMethod, W as isCloudErrorCode, X as isCloudSessionSourceType, Y as isCloudSessionStatus } from './browser-profile-client-DHLzMf-K.js';
7
7
 
8
8
  interface RegistryEntry {
9
9
  file: string;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BrowserProfileClient
3
- } from "./chunk-6B6LOYU3.js";
3
+ } from "./chunk-A6LF44E3.js";
4
4
  import {
5
5
  ActionWsClient,
6
6
  BrowserPool,
@@ -40,7 +40,6 @@ import {
40
40
  clearPersistentProfileSingletons,
41
41
  cloneElementPath,
42
42
  closeTab,
43
- cloudSessionContractVersion,
44
43
  collectLocalSelectorCacheEntries,
45
44
  countArrayItemsWithPath,
46
45
  createCuaClient,
@@ -81,16 +80,25 @@ import {
81
80
  switchTab,
82
81
  typeText,
83
82
  waitForVisualStability
84
- } from "./chunk-ACRSRDRN.js";
83
+ } from "./chunk-I66RNYIW.js";
85
84
  import {
86
85
  CloudCdpClient,
87
86
  CloudSessionClient,
88
87
  OpensteerCloudError,
88
+ cloudActionMethods,
89
+ cloudErrorCodes,
89
90
  cloudNotLaunchedError,
91
+ cloudSessionContractVersion,
92
+ cloudSessionSourceTypes,
93
+ cloudSessionStatuses,
90
94
  cloudUnsupportedMethodError,
95
+ isCloudActionMethod,
96
+ isCloudErrorCode,
97
+ isCloudSessionSourceType,
98
+ isCloudSessionStatus,
91
99
  normalizeNamespace,
92
100
  resolveNamespaceDir
93
- } from "./chunk-KPPOTU3D.js";
101
+ } from "./chunk-GTT3A3RU.js";
94
102
  import {
95
103
  detectChromePaths,
96
104
  expandHome,
@@ -332,8 +340,12 @@ export {
332
340
  clearPersistentProfileSingletons,
333
341
  cloneElementPath,
334
342
  closeTab,
343
+ cloudActionMethods,
344
+ cloudErrorCodes,
335
345
  cloudNotLaunchedError,
336
346
  cloudSessionContractVersion,
347
+ cloudSessionSourceTypes,
348
+ cloudSessionStatuses,
337
349
  cloudUnsupportedMethodError,
338
350
  collectLocalSelectorCacheEntries,
339
351
  countArrayItemsWithPath,
@@ -358,6 +370,10 @@ export {
358
370
  getPageHtml,
359
371
  getPageTitle,
360
372
  importCookies,
373
+ isCloudActionMethod,
374
+ isCloudErrorCode,
375
+ isCloudSessionSourceType,
376
+ isCloudSessionStatus,
361
377
  listLocalChromeProfiles,
362
378
  listTabs,
363
379
  markInteractiveElements,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opensteer",
3
- "version": "0.6.7",
3
+ "version": "0.6.9",
4
4
  "description": "Open-source browser automation SDK and CLI that lets AI agents build complex scrapers directly in your codebase.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -12,6 +12,24 @@ const opensteer = new Opensteer({
12
12
  await opensteer.launch({ headless: false });
13
13
  await opensteer.close();
14
14
 
15
+ // Use the user's local Chrome profile state:
16
+ const opensteer = new Opensteer({
17
+ name: "my-scraper",
18
+ browser: {
19
+ mode: "real",
20
+ profileDirectory: "Default",
21
+ headless: false,
22
+ },
23
+ });
24
+ await opensteer.launch();
25
+
26
+ // Or pass real-browser mode at launch time:
27
+ await opensteer.launch({
28
+ mode: "real",
29
+ profileDirectory: "Default",
30
+ headless: false,
31
+ });
32
+
15
33
  // Wrap an existing page instance:
16
34
  const opensteer = Opensteer.from(existingPage, { name: "my-scraper" });
17
35
  ```
@@ -1,168 +0,0 @@
1
- import { O as OpensteerAuthScheme } from './types-Cr10igF3.js';
2
-
3
- type ActionFailureCode = 'TARGET_NOT_FOUND' | 'TARGET_UNAVAILABLE' | 'TARGET_STALE' | 'TARGET_AMBIGUOUS' | 'BLOCKED_BY_INTERCEPTOR' | 'NOT_VISIBLE' | 'NOT_ENABLED' | 'NOT_EDITABLE' | 'INVALID_TARGET' | 'INVALID_OPTIONS' | 'ACTION_TIMEOUT' | 'UNKNOWN';
4
- type ActionFailureClassificationSource = 'typed_error' | 'playwright_call_log' | 'dom_probe' | 'message_heuristic' | 'unknown';
5
- interface ActionFailureBlocker {
6
- tag: string;
7
- id: string | null;
8
- classes: string[];
9
- role: string | null;
10
- text: string | null;
11
- }
12
- interface ActionFailureDetails {
13
- blocker?: ActionFailureBlocker;
14
- observation?: string;
15
- }
16
- interface ActionFailure {
17
- code: ActionFailureCode;
18
- message: string;
19
- retryable: boolean;
20
- classificationSource: ActionFailureClassificationSource;
21
- details?: ActionFailureDetails;
22
- }
23
-
24
- type CloudActionMethod = 'goto' | 'snapshot' | 'state' | 'click' | 'dblclick' | 'rightclick' | 'hover' | 'input' | 'select' | 'scroll' | 'tabs' | 'newTab' | 'switchTab' | 'closeTab' | 'getCookies' | 'setCookie' | 'clearCookies' | 'pressKey' | 'type' | 'getElementText' | 'getElementValue' | 'getElementAttributes' | 'getElementBoundingBox' | 'getHtml' | 'getTitle' | 'waitForText' | 'extract' | 'extractFromPlan' | 'clearCache' | 'uploadFile' | 'exportCookies' | 'importCookies' | 'screenshot';
25
- type CloudErrorCode = 'CLOUD_AUTH_FAILED' | 'CLOUD_SESSION_NOT_FOUND' | 'CLOUD_SESSION_CLOSED' | 'CLOUD_UNSUPPORTED_METHOD' | 'CLOUD_INVALID_REQUEST' | 'CLOUD_MODEL_NOT_ALLOWED' | 'CLOUD_ACTION_FAILED' | 'CLOUD_CAPACITY_EXHAUSTED' | 'CLOUD_RUNTIME_UNAVAILABLE' | 'CLOUD_RUNTIME_MISMATCH' | 'CLOUD_SESSION_STALE' | 'CLOUD_CONTROL_PLANE_ERROR' | 'CLOUD_CONTRACT_MISMATCH' | 'CLOUD_PROXY_UNAVAILABLE' | 'CLOUD_PROXY_REQUIRED' | 'CLOUD_BILLING_LIMIT_REACHED' | 'CLOUD_RATE_LIMITED' | 'CLOUD_BROWSER_PROFILE_NOT_FOUND' | 'CLOUD_BROWSER_PROFILE_BUSY' | 'CLOUD_BROWSER_PROFILE_DISABLED' | 'CLOUD_BROWSER_PROFILE_PROXY_UNAVAILABLE' | 'CLOUD_BROWSER_PROFILE_SYNC_FAILED' | 'CLOUD_INTERNAL';
26
- declare const cloudSessionContractVersion: "v3";
27
- type CloudSessionContractVersion = typeof cloudSessionContractVersion;
28
- type CloudSessionSourceType = 'agent-thread' | 'agent-run' | 'local-cloud' | 'manual';
29
- interface CloudBrowserProfileLaunchPreference {
30
- profileId: string;
31
- reuseIfActive?: boolean;
32
- }
33
- interface CloudSessionLaunchConfig {
34
- browserProfile?: CloudBrowserProfileLaunchPreference;
35
- }
36
- interface CloudSessionCreateRequest {
37
- cloudSessionContractVersion: CloudSessionContractVersion;
38
- sourceType: 'local-cloud';
39
- clientSessionHint: string;
40
- localRunId: string;
41
- name?: string;
42
- model?: string;
43
- launchContext?: Record<string, unknown>;
44
- launchConfig?: CloudSessionLaunchConfig;
45
- }
46
- interface CloudSessionSummary {
47
- sessionId: string;
48
- workspaceId: string;
49
- state: string;
50
- createdAt: number;
51
- sourceType: CloudSessionSourceType;
52
- sourceRef?: string;
53
- label?: string;
54
- }
55
- interface CloudSessionCreateResponse {
56
- sessionId: string;
57
- actionWsUrl: string;
58
- cdpWsUrl: string;
59
- actionToken: string;
60
- cdpToken: string;
61
- expiresAt?: number;
62
- cloudSessionUrl: string;
63
- cloudSession: CloudSessionSummary;
64
- }
65
- interface CloudSelectorCacheImportEntry {
66
- namespace: string;
67
- siteOrigin: string;
68
- method: string;
69
- descriptionHash: string;
70
- path: unknown;
71
- schemaHash?: string;
72
- createdAt: number;
73
- updatedAt: number;
74
- }
75
- interface CloudSelectorCacheImportRequest {
76
- entries: CloudSelectorCacheImportEntry[];
77
- }
78
- interface CloudSelectorCacheImportResponse {
79
- imported: number;
80
- inserted: number;
81
- updated: number;
82
- skipped: number;
83
- }
84
- interface CloudActionRequest {
85
- id: number;
86
- method: CloudActionMethod;
87
- args: Record<string, unknown>;
88
- sessionId: string;
89
- token: string;
90
- }
91
- interface CloudActionSuccess {
92
- id: number;
93
- ok: true;
94
- result: unknown;
95
- }
96
- interface CloudActionFailure {
97
- id: number;
98
- ok: false;
99
- error: string;
100
- code: CloudErrorCode;
101
- details?: CloudActionFailureDetails;
102
- }
103
- type CloudActionResponse = CloudActionSuccess | CloudActionFailure;
104
- interface CloudActionFailureDetails {
105
- actionFailure?: ActionFailure;
106
- }
107
- type BrowserProfileStatus = 'active' | 'archived' | 'error';
108
- type BrowserProfileProxyPolicy = 'strict_sticky';
109
- type CloudFingerprintMode = 'off' | 'auto';
110
- type BrowserProfileArchiveFormat = 'tar.gz';
111
- interface BrowserProfileDescriptor {
112
- profileId: string;
113
- teamId: string;
114
- ownerUserId: string;
115
- name: string;
116
- status: BrowserProfileStatus;
117
- proxyPolicy: BrowserProfileProxyPolicy;
118
- stickyProxyId?: string;
119
- proxyCountryCode?: string;
120
- proxyRegion?: string;
121
- proxyCity?: string;
122
- fingerprintMode: CloudFingerprintMode;
123
- fingerprintHash?: string;
124
- activeSessionId?: string;
125
- lastSessionId?: string;
126
- lastLaunchedAt?: number;
127
- latestRevision?: number;
128
- latestStorageId?: string;
129
- latestSizeBytes?: number;
130
- latestArchiveSha256?: string;
131
- latestArchiveFormat?: BrowserProfileArchiveFormat;
132
- createdAt: number;
133
- updatedAt: number;
134
- lastError?: string;
135
- }
136
- interface BrowserProfileListResponse {
137
- profiles: BrowserProfileDescriptor[];
138
- nextCursor?: string;
139
- }
140
- interface BrowserProfileCreateRequest {
141
- name: string;
142
- proxy?: {
143
- proxyId?: string;
144
- countryCode?: string;
145
- region?: string;
146
- city?: string;
147
- };
148
- fingerprint?: {
149
- mode?: CloudFingerprintMode;
150
- };
151
- }
152
-
153
- interface BrowserProfileListRequest {
154
- cursor?: string;
155
- limit?: number;
156
- status?: BrowserProfileStatus;
157
- }
158
- declare class BrowserProfileClient {
159
- private readonly baseUrl;
160
- private readonly key;
161
- private readonly authScheme;
162
- constructor(baseUrl: string, key: string, authScheme?: OpensteerAuthScheme);
163
- list(request?: BrowserProfileListRequest): Promise<BrowserProfileListResponse>;
164
- get(profileId: string): Promise<BrowserProfileDescriptor>;
165
- create(request: BrowserProfileCreateRequest): Promise<BrowserProfileDescriptor>;
166
- }
167
-
168
- export { type ActionFailure as A, type BrowserProfileStatus as B, type CloudErrorCode as C, type CloudSessionSourceType as D, type CloudSessionSummary as E, cloudSessionContractVersion as F, type BrowserProfileListRequest as a, type BrowserProfileListResponse as b, type BrowserProfileCreateRequest as c, type BrowserProfileDescriptor as d, type ActionFailureCode as e, type CloudActionFailureDetails as f, type CloudSessionCreateRequest as g, type CloudSessionCreateResponse as h, type CloudSelectorCacheImportRequest as i, type CloudSelectorCacheImportResponse as j, type CloudActionMethod as k, type CloudSelectorCacheImportEntry as l, type ActionFailureBlocker as m, type ActionFailureClassificationSource as n, type ActionFailureDetails as o, type BrowserProfileArchiveFormat as p, BrowserProfileClient as q, type BrowserProfileProxyPolicy as r, type CloudActionFailure as s, type CloudActionRequest as t, type CloudActionResponse as u, type CloudActionSuccess as v, type CloudBrowserProfileLaunchPreference as w, type CloudFingerprintMode as x, type CloudSessionContractVersion as y, type CloudSessionLaunchConfig as z };