test-wuying-agentbay-sdk 0.13.1-beta.20251223163333 → 0.13.1-beta.20251223194518

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.mjs CHANGED
@@ -13249,10 +13249,11 @@ var _FileTransfer = class _FileTransfer {
13249
13249
  error: `Upload exception: ${e.message || e}`
13250
13250
  };
13251
13251
  }
13252
+ const remoteDir = this.remoteDir(remotePath);
13252
13253
  let reqIdSync;
13253
13254
  try {
13254
13255
  logDebug("Triggering sync to cloud disk");
13255
- reqIdSync = await this.awaitSync("download", remotePath, this.contextId);
13256
+ reqIdSync = await this.awaitSync("download", remoteDir, this.contextId);
13256
13257
  } catch (e) {
13257
13258
  return {
13258
13259
  success: false,
@@ -13272,7 +13273,7 @@ var _FileTransfer = class _FileTransfer {
13272
13273
  if (wait) {
13273
13274
  const { success, error } = await this.waitForTask({
13274
13275
  contextId: this.contextId,
13275
- remotePath,
13276
+ remotePath: remoteDir,
13276
13277
  taskType: "download",
13277
13278
  timeout: waitTimeout,
13278
13279
  interval: pollInterval
@@ -13342,9 +13343,10 @@ var _FileTransfer = class _FileTransfer {
13342
13343
  };
13343
13344
  }
13344
13345
  }
13346
+ const remoteDir = this.remoteDir(remotePath);
13345
13347
  let reqIdSync;
13346
13348
  try {
13347
- reqIdSync = await this.awaitSync("upload", remotePath, this.contextId);
13349
+ reqIdSync = await this.awaitSync("upload", remoteDir, this.contextId);
13348
13350
  } catch (e) {
13349
13351
  return {
13350
13352
  success: false,
@@ -13358,7 +13360,7 @@ var _FileTransfer = class _FileTransfer {
13358
13360
  if (wait) {
13359
13361
  const { success, error } = await this.waitForTask({
13360
13362
  contextId: this.contextId,
13361
- remotePath,
13363
+ remotePath: remoteDir,
13362
13364
  taskType: "upload",
13363
13365
  timeout: waitTimeout,
13364
13366
  interval: pollInterval
@@ -13452,6 +13454,18 @@ var _FileTransfer = class _FileTransfer {
13452
13454
  }
13453
13455
  }
13454
13456
  // ========== Internal Utilities ==========
13457
+ /**
13458
+ * Ensure sync path is a directory: strip filename, keep directory inputs.
13459
+ */
13460
+ remoteDir(remotePath) {
13461
+ if (!remotePath) return "";
13462
+ if (remotePath.endsWith("/")) {
13463
+ const trimmed = remotePath.replace(/\/+$/, "");
13464
+ return trimmed || "/";
13465
+ }
13466
+ const dir = path4.posix.dirname(remotePath);
13467
+ return dir === "." ? "/" : dir;
13468
+ }
13455
13469
  /**
13456
13470
  * Compatibility wrapper for session.context.sync which may be sync or async:
13457
13471
  * - Try async call first