opensteer 0.6.8 → 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.
@@ -2,7 +2,7 @@ import {
2
2
  cloudAuthHeaders,
3
3
  normalizeCloudBaseUrl,
4
4
  parseCloudHttpError
5
- } from "./chunk-LTREUXLO.js";
5
+ } from "./chunk-GTT3A3RU.js";
6
6
 
7
7
  // src/cloud/browser-profile-client.ts
8
8
  var BrowserProfileClient = class {
@@ -1344,7 +1344,17 @@ function formatFieldPath(field, parent) {
1344
1344
  return parent ? `"${parent}.${field}"` : `"${field}"`;
1345
1345
  }
1346
1346
  function formatAllowedValues(values) {
1347
- return values.map((value) => `"${value}"`).join(", ");
1347
+ if (values.length === 0) {
1348
+ return "";
1349
+ }
1350
+ if (values.length === 1) {
1351
+ return `"${values[0]}"`;
1352
+ }
1353
+ if (values.length === 2) {
1354
+ return `"${values[0]}" or "${values[1]}"`;
1355
+ }
1356
+ const quotedValues = values.map((value) => `"${value}"`);
1357
+ return `${quotedValues.slice(0, -1).join(", ")}, or ${quotedValues[quotedValues.length - 1]}`;
1348
1358
  }
1349
1359
  function zeroImportResponse() {
1350
1360
  return {
@@ -14,7 +14,7 @@ import {
14
14
  resolveNamespaceDir,
15
15
  selectCloudCredential,
16
16
  withTokenQuery
17
- } from "./chunk-LTREUXLO.js";
17
+ } from "./chunk-GTT3A3RU.js";
18
18
  import {
19
19
  detectChromePaths,
20
20
  expandHome,
@@ -3127,6 +3127,47 @@ async function markInteractiveElements(page, {
3127
3127
  "search",
3128
3128
  "searchbox"
3129
3129
  ]);
3130
+ function isExplicitlyHidden(el, style) {
3131
+ if (el.hasAttribute("hidden")) {
3132
+ return true;
3133
+ }
3134
+ if (el.getAttribute("aria-hidden") === "true") {
3135
+ return true;
3136
+ }
3137
+ if (style.display === "none") {
3138
+ return true;
3139
+ }
3140
+ if (style.visibility === "hidden" || style.visibility === "collapse") {
3141
+ return true;
3142
+ }
3143
+ const opacity = Number.parseFloat(style.opacity);
3144
+ return Number.isFinite(opacity) && opacity <= 0;
3145
+ }
3146
+ function hasVisibleOutOfFlowChild(el) {
3147
+ const children = el.children;
3148
+ for (let i = 0; i < children.length; i++) {
3149
+ const child = children[i];
3150
+ const childStyle = window.getComputedStyle(child);
3151
+ if (childStyle.position !== "fixed" && childStyle.position !== "absolute") {
3152
+ continue;
3153
+ }
3154
+ const childRect = child.getBoundingClientRect();
3155
+ if (childRect.width > 0 && childRect.height > 0) {
3156
+ return true;
3157
+ }
3158
+ }
3159
+ return false;
3160
+ }
3161
+ function isHiddenByOwnRect(el, style) {
3162
+ if (style.display === "contents") {
3163
+ return false;
3164
+ }
3165
+ const rect = el.getBoundingClientRect();
3166
+ if (rect.width > 0 && rect.height > 0) {
3167
+ return false;
3168
+ }
3169
+ return !hasVisibleOutOfFlowChild(el);
3170
+ }
3130
3171
  const roots = [document];
3131
3172
  while (roots.length) {
3132
3173
  const root = roots.pop();
@@ -3142,42 +3183,7 @@ async function markInteractiveElements(page, {
3142
3183
  continue;
3143
3184
  }
3144
3185
  const style = window.getComputedStyle(el);
3145
- let hidden = false;
3146
- if (el.hasAttribute("hidden")) {
3147
- hidden = true;
3148
- } else if (el.getAttribute("aria-hidden") === "true") {
3149
- hidden = true;
3150
- } else if (style.display === "none") {
3151
- hidden = true;
3152
- } else if (style.visibility === "hidden" || style.visibility === "collapse") {
3153
- hidden = true;
3154
- }
3155
- if (!hidden) {
3156
- const opacity = Number.parseFloat(style.opacity);
3157
- if (Number.isFinite(opacity) && opacity <= 0) {
3158
- hidden = true;
3159
- }
3160
- }
3161
- if (!hidden) {
3162
- const rect = el.getBoundingClientRect();
3163
- if (rect.width <= 0 || rect.height <= 0) {
3164
- hidden = true;
3165
- const children = el.children;
3166
- for (let i = 0; i < children.length; i++) {
3167
- const childStyle = window.getComputedStyle(
3168
- children[i]
3169
- );
3170
- if (childStyle.position !== "fixed" && childStyle.position !== "absolute") {
3171
- continue;
3172
- }
3173
- const childRect = children[i].getBoundingClientRect();
3174
- if (childRect.width > 0 && childRect.height > 0) {
3175
- hidden = false;
3176
- break;
3177
- }
3178
- }
3179
- }
3180
- }
3186
+ const hidden = isExplicitlyHidden(el, style) || isHiddenByOwnRect(el, style);
3181
3187
  if (hidden) {
3182
3188
  el.setAttribute(hiddenAttr, "1");
3183
3189
  el.removeAttribute(markAttribute2);
@@ -5,7 +5,7 @@ import {
5
5
  resolveConfigWithEnv,
6
6
  selectCloudCredential,
7
7
  stripTrailingSlashes
8
- } from "./chunk-LTREUXLO.js";
8
+ } from "./chunk-GTT3A3RU.js";
9
9
 
10
10
  // src/cli/auth.ts
11
11
  import open from "open";
package/dist/cli/auth.js CHANGED
@@ -4,8 +4,8 @@ import {
4
4
  isCloudModeEnabledForRootDir,
5
5
  parseOpensteerAuthArgs,
6
6
  runOpensteerAuthCli
7
- } from "../chunk-UQYVMJOZ.js";
8
- import "../chunk-LTREUXLO.js";
7
+ } from "../chunk-K7DQUSZG.js";
8
+ import "../chunk-GTT3A3RU.js";
9
9
  export {
10
10
  ensureCloudCredentialsForCommand,
11
11
  ensureCloudCredentialsForOpenCommand,
@@ -4496,6 +4496,47 @@ async function markInteractiveElements(page, {
4496
4496
  "search",
4497
4497
  "searchbox"
4498
4498
  ]);
4499
+ function isExplicitlyHidden(el, style) {
4500
+ if (el.hasAttribute("hidden")) {
4501
+ return true;
4502
+ }
4503
+ if (el.getAttribute("aria-hidden") === "true") {
4504
+ return true;
4505
+ }
4506
+ if (style.display === "none") {
4507
+ return true;
4508
+ }
4509
+ if (style.visibility === "hidden" || style.visibility === "collapse") {
4510
+ return true;
4511
+ }
4512
+ const opacity = Number.parseFloat(style.opacity);
4513
+ return Number.isFinite(opacity) && opacity <= 0;
4514
+ }
4515
+ function hasVisibleOutOfFlowChild(el) {
4516
+ const children = el.children;
4517
+ for (let i = 0; i < children.length; i++) {
4518
+ const child = children[i];
4519
+ const childStyle = window.getComputedStyle(child);
4520
+ if (childStyle.position !== "fixed" && childStyle.position !== "absolute") {
4521
+ continue;
4522
+ }
4523
+ const childRect = child.getBoundingClientRect();
4524
+ if (childRect.width > 0 && childRect.height > 0) {
4525
+ return true;
4526
+ }
4527
+ }
4528
+ return false;
4529
+ }
4530
+ function isHiddenByOwnRect(el, style) {
4531
+ if (style.display === "contents") {
4532
+ return false;
4533
+ }
4534
+ const rect = el.getBoundingClientRect();
4535
+ if (rect.width > 0 && rect.height > 0) {
4536
+ return false;
4537
+ }
4538
+ return !hasVisibleOutOfFlowChild(el);
4539
+ }
4499
4540
  const roots = [document];
4500
4541
  while (roots.length) {
4501
4542
  const root = roots.pop();
@@ -4511,42 +4552,7 @@ async function markInteractiveElements(page, {
4511
4552
  continue;
4512
4553
  }
4513
4554
  const style = window.getComputedStyle(el);
4514
- let hidden = false;
4515
- if (el.hasAttribute("hidden")) {
4516
- hidden = true;
4517
- } else if (el.getAttribute("aria-hidden") === "true") {
4518
- hidden = true;
4519
- } else if (style.display === "none") {
4520
- hidden = true;
4521
- } else if (style.visibility === "hidden" || style.visibility === "collapse") {
4522
- hidden = true;
4523
- }
4524
- if (!hidden) {
4525
- const opacity = Number.parseFloat(style.opacity);
4526
- if (Number.isFinite(opacity) && opacity <= 0) {
4527
- hidden = true;
4528
- }
4529
- }
4530
- if (!hidden) {
4531
- const rect = el.getBoundingClientRect();
4532
- if (rect.width <= 0 || rect.height <= 0) {
4533
- hidden = true;
4534
- const children = el.children;
4535
- for (let i = 0; i < children.length; i++) {
4536
- const childStyle = window.getComputedStyle(
4537
- children[i]
4538
- );
4539
- if (childStyle.position !== "fixed" && childStyle.position !== "absolute") {
4540
- continue;
4541
- }
4542
- const childRect = children[i].getBoundingClientRect();
4543
- if (childRect.width > 0 && childRect.height > 0) {
4544
- hidden = false;
4545
- break;
4546
- }
4547
- }
4548
- }
4549
- }
4555
+ const hidden = isExplicitlyHidden(el, style) || isHiddenByOwnRect(el, style);
4550
4556
  if (hidden) {
4551
4557
  el.setAttribute(hiddenAttr, "1");
4552
4558
  el.removeAttribute(markAttribute2);
@@ -9628,7 +9634,17 @@ function formatFieldPath(field, parent) {
9628
9634
  return parent ? `"${parent}.${field}"` : `"${field}"`;
9629
9635
  }
9630
9636
  function formatAllowedValues(values) {
9631
- return values.map((value) => `"${value}"`).join(", ");
9637
+ if (values.length === 0) {
9638
+ return "";
9639
+ }
9640
+ if (values.length === 1) {
9641
+ return `"${values[0]}"`;
9642
+ }
9643
+ if (values.length === 2) {
9644
+ return `"${values[0]}" or "${values[1]}"`;
9645
+ }
9646
+ const quotedValues = values.map((value) => `"${value}"`);
9647
+ return `${quotedValues.slice(0, -1).join(", ")}, or ${quotedValues[quotedValues.length - 1]}`;
9632
9648
  }
9633
9649
  function zeroImportResponse() {
9634
9650
  return {
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  BrowserProfileClient
3
- } from "../chunk-O4HVMKX2.js";
3
+ } from "../chunk-A6LF44E3.js";
4
4
  import {
5
5
  createKeychainStore,
6
6
  ensureCloudCredentialsForCommand
7
- } from "../chunk-UQYVMJOZ.js";
7
+ } from "../chunk-K7DQUSZG.js";
8
8
  import {
9
9
  Opensteer
10
- } from "../chunk-C6AJL5XU.js";
10
+ } from "../chunk-I66RNYIW.js";
11
11
  import {
12
12
  resolveConfigWithEnv
13
- } from "../chunk-LTREUXLO.js";
13
+ } from "../chunk-GTT3A3RU.js";
14
14
  import {
15
15
  expandHome
16
16
  } from "../chunk-K5CL76MG.js";
@@ -4489,6 +4489,47 @@ async function markInteractiveElements(page, {
4489
4489
  "search",
4490
4490
  "searchbox"
4491
4491
  ]);
4492
+ function isExplicitlyHidden(el, style) {
4493
+ if (el.hasAttribute("hidden")) {
4494
+ return true;
4495
+ }
4496
+ if (el.getAttribute("aria-hidden") === "true") {
4497
+ return true;
4498
+ }
4499
+ if (style.display === "none") {
4500
+ return true;
4501
+ }
4502
+ if (style.visibility === "hidden" || style.visibility === "collapse") {
4503
+ return true;
4504
+ }
4505
+ const opacity = Number.parseFloat(style.opacity);
4506
+ return Number.isFinite(opacity) && opacity <= 0;
4507
+ }
4508
+ function hasVisibleOutOfFlowChild(el) {
4509
+ const children = el.children;
4510
+ for (let i = 0; i < children.length; i++) {
4511
+ const child = children[i];
4512
+ const childStyle = window.getComputedStyle(child);
4513
+ if (childStyle.position !== "fixed" && childStyle.position !== "absolute") {
4514
+ continue;
4515
+ }
4516
+ const childRect = child.getBoundingClientRect();
4517
+ if (childRect.width > 0 && childRect.height > 0) {
4518
+ return true;
4519
+ }
4520
+ }
4521
+ return false;
4522
+ }
4523
+ function isHiddenByOwnRect(el, style) {
4524
+ if (style.display === "contents") {
4525
+ return false;
4526
+ }
4527
+ const rect = el.getBoundingClientRect();
4528
+ if (rect.width > 0 && rect.height > 0) {
4529
+ return false;
4530
+ }
4531
+ return !hasVisibleOutOfFlowChild(el);
4532
+ }
4492
4533
  const roots = [document];
4493
4534
  while (roots.length) {
4494
4535
  const root = roots.pop();
@@ -4504,42 +4545,7 @@ async function markInteractiveElements(page, {
4504
4545
  continue;
4505
4546
  }
4506
4547
  const style = window.getComputedStyle(el);
4507
- let hidden = false;
4508
- if (el.hasAttribute("hidden")) {
4509
- hidden = true;
4510
- } else if (el.getAttribute("aria-hidden") === "true") {
4511
- hidden = true;
4512
- } else if (style.display === "none") {
4513
- hidden = true;
4514
- } else if (style.visibility === "hidden" || style.visibility === "collapse") {
4515
- hidden = true;
4516
- }
4517
- if (!hidden) {
4518
- const opacity = Number.parseFloat(style.opacity);
4519
- if (Number.isFinite(opacity) && opacity <= 0) {
4520
- hidden = true;
4521
- }
4522
- }
4523
- if (!hidden) {
4524
- const rect = el.getBoundingClientRect();
4525
- if (rect.width <= 0 || rect.height <= 0) {
4526
- hidden = true;
4527
- const children = el.children;
4528
- for (let i = 0; i < children.length; i++) {
4529
- const childStyle = window.getComputedStyle(
4530
- children[i]
4531
- );
4532
- if (childStyle.position !== "fixed" && childStyle.position !== "absolute") {
4533
- continue;
4534
- }
4535
- const childRect = children[i].getBoundingClientRect();
4536
- if (childRect.width > 0 && childRect.height > 0) {
4537
- hidden = false;
4538
- break;
4539
- }
4540
- }
4541
- }
4542
- }
4548
+ const hidden = isExplicitlyHidden(el, style) || isHiddenByOwnRect(el, style);
4543
4549
  if (hidden) {
4544
4550
  el.setAttribute(hiddenAttr, "1");
4545
4551
  el.removeAttribute(markAttribute2);
@@ -9621,7 +9627,17 @@ function formatFieldPath(field, parent) {
9621
9627
  return parent ? `"${parent}.${field}"` : `"${field}"`;
9622
9628
  }
9623
9629
  function formatAllowedValues(values) {
9624
- return values.map((value) => `"${value}"`).join(", ");
9630
+ if (values.length === 0) {
9631
+ return "";
9632
+ }
9633
+ if (values.length === 1) {
9634
+ return `"${values[0]}"`;
9635
+ }
9636
+ if (values.length === 2) {
9637
+ return `"${values[0]}" or "${values[1]}"`;
9638
+ }
9639
+ const quotedValues = values.map((value) => `"${value}"`);
9640
+ return `${quotedValues.slice(0, -1).join(", ")}, or ${quotedValues[quotedValues.length - 1]}`;
9625
9641
  }
9626
9642
  function zeroImportResponse() {
9627
9643
  return {
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  Opensteer
3
- } from "../chunk-C6AJL5XU.js";
3
+ } from "../chunk-I66RNYIW.js";
4
4
  import {
5
5
  normalizeError,
6
6
  resolveCloudSelection,
7
7
  resolveConfigWithEnv
8
- } from "../chunk-LTREUXLO.js";
8
+ } from "../chunk-GTT3A3RU.js";
9
9
  import "../chunk-K5CL76MG.js";
10
10
  import "../chunk-3H5RRIMZ.js";
11
11
 
package/dist/index.cjs CHANGED
@@ -4594,6 +4594,47 @@ async function markInteractiveElements(page, {
4594
4594
  "search",
4595
4595
  "searchbox"
4596
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
+ }
4597
4638
  const roots = [document];
4598
4639
  while (roots.length) {
4599
4640
  const root = roots.pop();
@@ -4609,42 +4650,7 @@ async function markInteractiveElements(page, {
4609
4650
  continue;
4610
4651
  }
4611
4652
  const style = window.getComputedStyle(el);
4612
- let hidden = false;
4613
- if (el.hasAttribute("hidden")) {
4614
- hidden = true;
4615
- } else if (el.getAttribute("aria-hidden") === "true") {
4616
- hidden = true;
4617
- } else if (style.display === "none") {
4618
- hidden = true;
4619
- } else if (style.visibility === "hidden" || style.visibility === "collapse") {
4620
- hidden = true;
4621
- }
4622
- if (!hidden) {
4623
- const opacity = Number.parseFloat(style.opacity);
4624
- if (Number.isFinite(opacity) && opacity <= 0) {
4625
- hidden = true;
4626
- }
4627
- }
4628
- if (!hidden) {
4629
- const rect = el.getBoundingClientRect();
4630
- if (rect.width <= 0 || rect.height <= 0) {
4631
- hidden = true;
4632
- const children = el.children;
4633
- for (let i = 0; i < children.length; i++) {
4634
- const childStyle = window.getComputedStyle(
4635
- children[i]
4636
- );
4637
- if (childStyle.position !== "fixed" && childStyle.position !== "absolute") {
4638
- continue;
4639
- }
4640
- const childRect = children[i].getBoundingClientRect();
4641
- if (childRect.width > 0 && childRect.height > 0) {
4642
- hidden = false;
4643
- break;
4644
- }
4645
- }
4646
- }
4647
- }
4653
+ const hidden = isExplicitlyHidden(el, style) || isHiddenByOwnRect(el, style);
4648
4654
  if (hidden) {
4649
4655
  el.setAttribute(hiddenAttr, "1");
4650
4656
  el.removeAttribute(markAttribute2);
@@ -9739,7 +9745,17 @@ function formatFieldPath(field, parent) {
9739
9745
  return parent ? `"${parent}.${field}"` : `"${field}"`;
9740
9746
  }
9741
9747
  function formatAllowedValues(values) {
9742
- return values.map((value) => `"${value}"`).join(", ");
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]}`;
9743
9759
  }
9744
9760
  function zeroImportResponse() {
9745
9761
  return {
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BrowserProfileClient
3
- } from "./chunk-O4HVMKX2.js";
3
+ } from "./chunk-A6LF44E3.js";
4
4
  import {
5
5
  ActionWsClient,
6
6
  BrowserPool,
@@ -80,7 +80,7 @@ import {
80
80
  switchTab,
81
81
  typeText,
82
82
  waitForVisualStability
83
- } from "./chunk-C6AJL5XU.js";
83
+ } from "./chunk-I66RNYIW.js";
84
84
  import {
85
85
  CloudCdpClient,
86
86
  CloudSessionClient,
@@ -98,7 +98,7 @@ import {
98
98
  isCloudSessionStatus,
99
99
  normalizeNamespace,
100
100
  resolveNamespaceDir
101
- } from "./chunk-LTREUXLO.js";
101
+ } from "./chunk-GTT3A3RU.js";
102
102
  import {
103
103
  detectChromePaths,
104
104
  expandHome,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opensteer",
3
- "version": "0.6.8",
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
  ```