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.cjs CHANGED
@@ -556,19 +556,10 @@ function getVersionFromPackageJson() {
556
556
  }
557
557
  _chunk4IPTHWLMcjs.__name.call(void 0, getVersionFromPackageJson, "getVersionFromPackageJson");
558
558
  function isReleaseBuild() {
559
- if (process.env.GITHUB_ACTIONS !== "true") {
560
- return false;
561
- }
562
- const workflow = process.env.GITHUB_WORKFLOW || "";
563
- if (workflow.includes("Build and Publish to npm")) {
564
- return true;
565
- }
566
- if (process.env.AGENTBAY_RELEASE_BUILD === "true") {
567
- return true;
568
- }
569
- return false;
559
+ return __AGENTBAY_IS_RELEASE_BUILD__;
570
560
  }
571
561
  _chunk4IPTHWLMcjs.__name.call(void 0, isReleaseBuild, "isReleaseBuild");
562
+ var __AGENTBAY_IS_RELEASE_BUILD__ = true;
572
563
  var VERSION = getVersionFromPackageJson();
573
564
  var IS_RELEASE = isReleaseBuild();
574
565
 
@@ -9092,6 +9083,31 @@ _chunk4IPTHWLMcjs.init_cjs_shims.call(void 0, );
9092
9083
 
9093
9084
  // src/mobile/mobile.ts
9094
9085
  _chunk4IPTHWLMcjs.init_cjs_shims.call(void 0, );
9086
+ function parseBoundsString(boundsStr) {
9087
+ const parts = boundsStr.split(",");
9088
+ if (parts.length !== 4) {
9089
+ return null;
9090
+ }
9091
+ const [left, top, right, bottom] = parts.map((p) => parseInt(p.trim(), 10));
9092
+ if (isNaN(left) || isNaN(top) || isNaN(right) || isNaN(bottom)) {
9093
+ return null;
9094
+ }
9095
+ return { left, top, right, bottom };
9096
+ }
9097
+ _chunk4IPTHWLMcjs.__name.call(void 0, parseBoundsString, "parseBoundsString");
9098
+ function normalizeUIElement(element) {
9099
+ if (element.bounds && typeof element.bounds === "string") {
9100
+ const parsedBounds = parseBoundsString(element.bounds);
9101
+ if (parsedBounds) {
9102
+ element.bounds = parsedBounds;
9103
+ }
9104
+ }
9105
+ if (element.children && Array.isArray(element.children)) {
9106
+ element.children = element.children.map(normalizeUIElement);
9107
+ }
9108
+ return element;
9109
+ }
9110
+ _chunk4IPTHWLMcjs.__name.call(void 0, normalizeUIElement, "normalizeUIElement");
9095
9111
  var _Mobile = class _Mobile {
9096
9112
  constructor(session) {
9097
9113
  this.session = session;
@@ -9209,11 +9225,12 @@ var _Mobile = class _Mobile {
9209
9225
  }
9210
9226
  try {
9211
9227
  const elements = JSON.parse(result.data);
9228
+ const normalizedElements = (elements || []).map(normalizeUIElement);
9212
9229
  return {
9213
9230
  success: true,
9214
9231
  requestId: result.requestId || "",
9215
9232
  errorMessage: "",
9216
- elements: elements || []
9233
+ elements: normalizedElements
9217
9234
  };
9218
9235
  } catch (parseError) {
9219
9236
  return {
@@ -9257,11 +9274,12 @@ var _Mobile = class _Mobile {
9257
9274
  }
9258
9275
  try {
9259
9276
  const elements = JSON.parse(result.data);
9277
+ const normalizedElements = (elements || []).map(normalizeUIElement);
9260
9278
  return {
9261
9279
  success: true,
9262
9280
  requestId: result.requestId || "",
9263
9281
  errorMessage: "",
9264
- elements: elements || []
9282
+ elements: normalizedElements
9265
9283
  };
9266
9284
  } catch (parseError) {
9267
9285
  return {
@@ -11721,6 +11739,14 @@ var _AgentBay = class _AgentBay {
11721
11739
  session.token = getResult.data.token;
11722
11740
  session.resourceUrl = getResult.data.resourceUrl;
11723
11741
  }
11742
+ const contextName = `file-transfer-context-${Date.now()}`;
11743
+ const contextResult = await this.context.get(contextName, true);
11744
+ if (contextResult.success && contextResult.context) {
11745
+ session.fileTransferContextId = contextResult.context.id;
11746
+ logInfo(`\u{1F4C1} Created file transfer context for recovered session: ${contextResult.context.id}`);
11747
+ } else {
11748
+ logError(`\u26A0\uFE0F Failed to create file transfer context for recovered session: ${contextResult.errorMessage || "Unknown error"}`);
11749
+ }
11724
11750
  return {
11725
11751
  requestId: getResult.requestId,
11726
11752
  success: true,