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.
@@ -1,6 +1,6 @@
1
1
  import { Cookie } from 'playwright';
2
2
  import { O as OpensteerAuthScheme, a as OpensteerConfig, C as CookieParam } from '../types-Cr10igF3.js';
3
- import { B as BrowserProfileStatus, a as BrowserProfileListRequest, b as BrowserProfileListResponse, c as BrowserProfileCreateRequest, d as BrowserProfileDescriptor } from '../browser-profile-client-AGTsLQxT.js';
3
+ import { B as BrowserProfileStatus, a as BrowserProfileListRequest, b as BrowserProfileListResponse, c as BrowserProfileCreateRequest, d as BrowserProfileDescriptor } from '../browser-profile-client-DHLzMf-K.js';
4
4
 
5
5
  type ParsedProfileArgs = {
6
6
  mode: 'help';
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  BrowserProfileClient
3
- } from "../chunk-6B6LOYU3.js";
3
+ } from "../chunk-A6LF44E3.js";
4
4
  import {
5
5
  createKeychainStore,
6
6
  ensureCloudCredentialsForCommand
7
- } from "../chunk-54KNQTOL.js";
7
+ } from "../chunk-K7DQUSZG.js";
8
8
  import {
9
9
  Opensteer
10
- } from "../chunk-ACRSRDRN.js";
10
+ } from "../chunk-I66RNYIW.js";
11
11
  import {
12
12
  resolveConfigWithEnv
13
- } from "../chunk-KPPOTU3D.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);
@@ -8909,7 +8915,96 @@ function stripPositionClauses2(path5) {
8909
8915
  }
8910
8916
 
8911
8917
  // src/cloud/contracts.ts
8918
+ var cloudActionMethods = [
8919
+ "goto",
8920
+ "snapshot",
8921
+ "screenshot",
8922
+ "state",
8923
+ "click",
8924
+ "dblclick",
8925
+ "rightclick",
8926
+ "hover",
8927
+ "input",
8928
+ "select",
8929
+ "scroll",
8930
+ "tabs",
8931
+ "newTab",
8932
+ "switchTab",
8933
+ "closeTab",
8934
+ "getCookies",
8935
+ "setCookie",
8936
+ "clearCookies",
8937
+ "pressKey",
8938
+ "type",
8939
+ "getElementText",
8940
+ "getElementValue",
8941
+ "getElementAttributes",
8942
+ "getElementBoundingBox",
8943
+ "getHtml",
8944
+ "getTitle",
8945
+ "uploadFile",
8946
+ "exportCookies",
8947
+ "importCookies",
8948
+ "waitForText",
8949
+ "extract",
8950
+ "extractFromPlan",
8951
+ "clearCache"
8952
+ ];
8953
+ var cloudErrorCodes = [
8954
+ "CLOUD_AUTH_FAILED",
8955
+ "CLOUD_SESSION_NOT_FOUND",
8956
+ "CLOUD_SESSION_CLOSED",
8957
+ "CLOUD_UNSUPPORTED_METHOD",
8958
+ "CLOUD_INVALID_REQUEST",
8959
+ "CLOUD_MODEL_NOT_ALLOWED",
8960
+ "CLOUD_ACTION_FAILED",
8961
+ "CLOUD_CAPACITY_EXHAUSTED",
8962
+ "CLOUD_RUNTIME_UNAVAILABLE",
8963
+ "CLOUD_RUNTIME_MISMATCH",
8964
+ "CLOUD_SESSION_STALE",
8965
+ "CLOUD_CONTROL_PLANE_ERROR",
8966
+ "CLOUD_CONTRACT_MISMATCH",
8967
+ "CLOUD_PROXY_UNAVAILABLE",
8968
+ "CLOUD_PROXY_REQUIRED",
8969
+ "CLOUD_BILLING_LIMIT_REACHED",
8970
+ "CLOUD_RATE_LIMITED",
8971
+ "CLOUD_BROWSER_PROFILE_NOT_FOUND",
8972
+ "CLOUD_BROWSER_PROFILE_BUSY",
8973
+ "CLOUD_BROWSER_PROFILE_DISABLED",
8974
+ "CLOUD_BROWSER_PROFILE_PROXY_UNAVAILABLE",
8975
+ "CLOUD_BROWSER_PROFILE_SYNC_FAILED",
8976
+ "CLOUD_INTERNAL"
8977
+ ];
8978
+ var cloudSessionStatuses = [
8979
+ "provisioning",
8980
+ "active",
8981
+ "closing",
8982
+ "closed",
8983
+ "failed"
8984
+ ];
8912
8985
  var cloudSessionContractVersion = "v3";
8986
+ var cloudSessionSourceTypes = [
8987
+ "agent-thread",
8988
+ "agent-run",
8989
+ "project-agent-run",
8990
+ "local-cloud",
8991
+ "manual"
8992
+ ];
8993
+ var cloudActionMethodSet = new Set(cloudActionMethods);
8994
+ var cloudErrorCodeSet = new Set(cloudErrorCodes);
8995
+ var cloudSessionSourceTypeSet = new Set(
8996
+ cloudSessionSourceTypes
8997
+ );
8998
+ var cloudSessionStatusSet = new Set(cloudSessionStatuses);
8999
+ function isCloudErrorCode(value) {
9000
+ return typeof value === "string" && cloudErrorCodeSet.has(value);
9001
+ }
9002
+ function isCloudSessionSourceType(value) {
9003
+ return typeof value === "string" && cloudSessionSourceTypeSet.has(value);
9004
+ }
9005
+ function isCloudSessionStatus(value) {
9006
+ return typeof value === "string" && cloudSessionStatusSet.has(value);
9007
+ }
8913
9008
 
8914
9009
  // src/cloud/action-ws-client.ts
8915
9010
  var import_ws2 = __toESM(require("ws"), 1);
@@ -8940,6 +9035,13 @@ function cloudNotLaunchedError() {
8940
9035
  );
8941
9036
  }
8942
9037
 
9038
+ // src/cloud/ws-url.ts
9039
+ function withTokenQuery(wsUrl, token) {
9040
+ const url = new URL(wsUrl);
9041
+ url.searchParams.set("token", token);
9042
+ return url.toString();
9043
+ }
9044
+
8943
9045
  // src/cloud/action-ws-client.ts
8944
9046
  var ActionWsClient = class _ActionWsClient {
8945
9047
  ws;
@@ -9068,11 +9170,6 @@ function rawDataToUtf8(raw) {
9068
9170
  if (Array.isArray(raw)) return Buffer.concat(raw).toString("utf8");
9069
9171
  return raw.toString("utf8");
9070
9172
  }
9071
- function withTokenQuery(wsUrl, token) {
9072
- const url = new URL(wsUrl);
9073
- url.searchParams.set("token", token);
9074
- return url.toString();
9075
- }
9076
9173
 
9077
9174
  // src/cloud/local-cache-sync.ts
9078
9175
  var import_fs4 = __toESM(require("fs"), 1);
@@ -9212,7 +9309,7 @@ function dedupeNewest(entries) {
9212
9309
  var import_playwright2 = require("playwright");
9213
9310
  var CloudCdpClient = class {
9214
9311
  async connect(args) {
9215
- const endpoint = withTokenQuery2(args.wsUrl, args.token);
9312
+ const endpoint = withTokenQuery(args.wsUrl, args.token);
9216
9313
  let browser;
9217
9314
  try {
9218
9315
  browser = await import_playwright2.chromium.connectOverCDP(endpoint);
@@ -9264,11 +9361,6 @@ function isInternalOrEmptyUrl(url) {
9264
9361
  if (url === "about:blank") return true;
9265
9362
  return url.startsWith("chrome://") || url.startsWith("devtools://") || url.startsWith("edge://");
9266
9363
  }
9267
- function withTokenQuery2(wsUrl, token) {
9268
- const url = new URL(wsUrl);
9269
- url.searchParams.set("token", token);
9270
- return url.toString();
9271
- }
9272
9364
 
9273
9365
  // src/utils/strip-trailing-slashes.ts
9274
9366
  function stripTrailingSlashes(value) {
@@ -9305,10 +9397,7 @@ async function parseCloudHttpError(response) {
9305
9397
  return new OpensteerCloudError(code, message, response.status, body?.details);
9306
9398
  }
9307
9399
  function toCloudErrorCode(code) {
9308
- 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") {
9309
- return code;
9310
- }
9311
- return "CLOUD_TRANSPORT_ERROR";
9400
+ return isCloudErrorCode(code) ? code : "CLOUD_TRANSPORT_ERROR";
9312
9401
  }
9313
9402
 
9314
9403
  // src/cloud/session-client.ts
@@ -9415,7 +9504,12 @@ function parseCreateResponse(body, status) {
9415
9504
  status,
9416
9505
  "cloudSession"
9417
9506
  ),
9418
- state: requireString(cloudSessionRoot, "state", status, "cloudSession"),
9507
+ state: requireSessionStatus(
9508
+ cloudSessionRoot,
9509
+ "state",
9510
+ status,
9511
+ "cloudSession"
9512
+ ),
9419
9513
  createdAt: requireNumber(cloudSessionRoot, "createdAt", status, "cloudSession"),
9420
9514
  sourceType: requireSourceType(cloudSessionRoot, "sourceType", status, "cloudSession"),
9421
9515
  sourceRef: optionalString(cloudSessionRoot, "sourceRef", status, "cloudSession"),
@@ -9503,7 +9597,21 @@ function optionalNumber(source, field, status, parent) {
9503
9597
  }
9504
9598
  function requireSourceType(source, field, status, parent) {
9505
9599
  const value = source[field];
9506
- if (value === "agent-thread" || value === "agent-run" || value === "local-cloud" || value === "manual") {
9600
+ if (isCloudSessionSourceType(value)) {
9601
+ return value;
9602
+ }
9603
+ throw new OpensteerCloudError(
9604
+ "CLOUD_CONTRACT_MISMATCH",
9605
+ `Invalid cloud session create response: ${formatFieldPath(
9606
+ field,
9607
+ parent
9608
+ )} must be one of ${formatAllowedValues(cloudSessionSourceTypes)}.`,
9609
+ status
9610
+ );
9611
+ }
9612
+ function requireSessionStatus(source, field, status, parent) {
9613
+ const value = source[field];
9614
+ if (isCloudSessionStatus(value)) {
9507
9615
  return value;
9508
9616
  }
9509
9617
  throw new OpensteerCloudError(
@@ -9511,13 +9619,26 @@ function requireSourceType(source, field, status, parent) {
9511
9619
  `Invalid cloud session create response: ${formatFieldPath(
9512
9620
  field,
9513
9621
  parent
9514
- )} must be one of "agent-thread", "agent-run", "local-cloud", or "manual".`,
9622
+ )} must be one of ${formatAllowedValues(cloudSessionStatuses)}.`,
9515
9623
  status
9516
9624
  );
9517
9625
  }
9518
9626
  function formatFieldPath(field, parent) {
9519
9627
  return parent ? `"${parent}.${field}"` : `"${field}"`;
9520
9628
  }
9629
+ function formatAllowedValues(values) {
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]}`;
9641
+ }
9521
9642
  function zeroImportResponse() {
9522
9643
  return {
9523
9644
  imported: 0,
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  Opensteer
3
- } from "../chunk-ACRSRDRN.js";
3
+ } from "../chunk-I66RNYIW.js";
4
4
  import {
5
5
  normalizeError,
6
6
  resolveCloudSelection,
7
7
  resolveConfigWithEnv
8
- } from "../chunk-KPPOTU3D.js";
8
+ } from "../chunk-GTT3A3RU.js";
9
9
  import "../chunk-K5CL76MG.js";
10
10
  import "../chunk-3H5RRIMZ.js";
11
11