wuying-agentbay-sdk 0.10.0 → 0.10.1

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.d.mts CHANGED
@@ -3655,15 +3655,16 @@ declare function validateExtraConfigs(extraConfigs: ExtraConfigs): void;
3655
3655
  interface BoolResult extends OperationResult {
3656
3656
  data?: boolean;
3657
3657
  }
3658
+ interface UIBounds {
3659
+ left: number;
3660
+ top: number;
3661
+ right: number;
3662
+ bottom: number;
3663
+ }
3658
3664
  interface UIElement$1 {
3659
3665
  text: string;
3660
3666
  className: string;
3661
- bounds: {
3662
- left: number;
3663
- top: number;
3664
- right: number;
3665
- bottom: number;
3666
- };
3667
+ bounds: UIBounds | string;
3667
3668
  }
3668
3669
  interface UIElementsResult extends OperationResult {
3669
3670
  elements: UIElement$1[];
package/dist/index.d.ts CHANGED
@@ -3655,15 +3655,16 @@ declare function validateExtraConfigs(extraConfigs: ExtraConfigs): void;
3655
3655
  interface BoolResult extends OperationResult {
3656
3656
  data?: boolean;
3657
3657
  }
3658
+ interface UIBounds {
3659
+ left: number;
3660
+ top: number;
3661
+ right: number;
3662
+ bottom: number;
3663
+ }
3658
3664
  interface UIElement$1 {
3659
3665
  text: string;
3660
3666
  className: string;
3661
- bounds: {
3662
- left: number;
3663
- top: number;
3664
- right: number;
3665
- bottom: number;
3666
- };
3667
+ bounds: UIBounds | string;
3667
3668
  }
3668
3669
  interface UIElementsResult extends OperationResult {
3669
3670
  elements: UIElement$1[];
package/dist/index.mjs CHANGED
@@ -570,19 +570,10 @@ function getVersionFromPackageJson() {
570
570
  }
571
571
  __name(getVersionFromPackageJson, "getVersionFromPackageJson");
572
572
  function isReleaseBuild() {
573
- if (process.env.GITHUB_ACTIONS !== "true") {
574
- return false;
575
- }
576
- const workflow = process.env.GITHUB_WORKFLOW || "";
577
- if (workflow.includes("Build and Publish to npm")) {
578
- return true;
579
- }
580
- if (process.env.AGENTBAY_RELEASE_BUILD === "true") {
581
- return true;
582
- }
583
- return false;
573
+ return __AGENTBAY_IS_RELEASE_BUILD__;
584
574
  }
585
575
  __name(isReleaseBuild, "isReleaseBuild");
576
+ var __AGENTBAY_IS_RELEASE_BUILD__ = true;
586
577
  var VERSION = getVersionFromPackageJson();
587
578
  var IS_RELEASE = isReleaseBuild();
588
579
 
@@ -9106,6 +9097,31 @@ init_esm_shims();
9106
9097
 
9107
9098
  // src/mobile/mobile.ts
9108
9099
  init_esm_shims();
9100
+ function parseBoundsString(boundsStr) {
9101
+ const parts = boundsStr.split(",");
9102
+ if (parts.length !== 4) {
9103
+ return null;
9104
+ }
9105
+ const [left, top, right, bottom] = parts.map((p) => parseInt(p.trim(), 10));
9106
+ if (isNaN(left) || isNaN(top) || isNaN(right) || isNaN(bottom)) {
9107
+ return null;
9108
+ }
9109
+ return { left, top, right, bottom };
9110
+ }
9111
+ __name(parseBoundsString, "parseBoundsString");
9112
+ function normalizeUIElement(element) {
9113
+ if (element.bounds && typeof element.bounds === "string") {
9114
+ const parsedBounds = parseBoundsString(element.bounds);
9115
+ if (parsedBounds) {
9116
+ element.bounds = parsedBounds;
9117
+ }
9118
+ }
9119
+ if (element.children && Array.isArray(element.children)) {
9120
+ element.children = element.children.map(normalizeUIElement);
9121
+ }
9122
+ return element;
9123
+ }
9124
+ __name(normalizeUIElement, "normalizeUIElement");
9109
9125
  var _Mobile = class _Mobile {
9110
9126
  constructor(session) {
9111
9127
  this.session = session;
@@ -9223,11 +9239,12 @@ var _Mobile = class _Mobile {
9223
9239
  }
9224
9240
  try {
9225
9241
  const elements = JSON.parse(result.data);
9242
+ const normalizedElements = (elements || []).map(normalizeUIElement);
9226
9243
  return {
9227
9244
  success: true,
9228
9245
  requestId: result.requestId || "",
9229
9246
  errorMessage: "",
9230
- elements: elements || []
9247
+ elements: normalizedElements
9231
9248
  };
9232
9249
  } catch (parseError) {
9233
9250
  return {
@@ -9271,11 +9288,12 @@ var _Mobile = class _Mobile {
9271
9288
  }
9272
9289
  try {
9273
9290
  const elements = JSON.parse(result.data);
9291
+ const normalizedElements = (elements || []).map(normalizeUIElement);
9274
9292
  return {
9275
9293
  success: true,
9276
9294
  requestId: result.requestId || "",
9277
9295
  errorMessage: "",
9278
- elements: elements || []
9296
+ elements: normalizedElements
9279
9297
  };
9280
9298
  } catch (parseError) {
9281
9299
  return {
@@ -11735,6 +11753,14 @@ var _AgentBay = class _AgentBay {
11735
11753
  session.token = getResult.data.token;
11736
11754
  session.resourceUrl = getResult.data.resourceUrl;
11737
11755
  }
11756
+ const contextName = `file-transfer-context-${Date.now()}`;
11757
+ const contextResult = await this.context.get(contextName, true);
11758
+ if (contextResult.success && contextResult.context) {
11759
+ session.fileTransferContextId = contextResult.context.id;
11760
+ logInfo(`\u{1F4C1} Created file transfer context for recovered session: ${contextResult.context.id}`);
11761
+ } else {
11762
+ logError(`\u26A0\uFE0F Failed to create file transfer context for recovered session: ${contextResult.errorMessage || "Unknown error"}`);
11763
+ }
11738
11764
  return {
11739
11765
  requestId: getResult.requestId,
11740
11766
  success: true,