test-wuying-agentbay-sdk 0.13.1-beta.20251223155807 → 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.d.mts CHANGED
@@ -4094,7 +4094,8 @@ declare class Code {
4094
4094
  * Corresponds to Python's run_code() method
4095
4095
  *
4096
4096
  * @param code - The code to execute.
4097
- * @param language - The programming language of the code. Must be either 'python' or 'javascript'.
4097
+ * @param language - The programming language of the code. Case-insensitive.
4098
+ * Supported values: 'python', 'javascript', 'r', 'java'.
4098
4099
  * @param timeoutS - The timeout for the code execution in seconds. Default is 60s.
4099
4100
  * Note: Due to gateway limitations, each request cannot exceed 60 seconds.
4100
4101
  * @returns CodeExecutionResult with code execution output and requestId
@@ -4115,6 +4116,14 @@ declare class Code {
4115
4116
  * ```
4116
4117
  */
4117
4118
  runCode(code: string, language: string, timeoutS?: number): Promise<CodeExecutionResult>;
4119
+ /**
4120
+ * Alias of runCode().
4121
+ */
4122
+ run(code: string, language: string, timeoutS?: number): Promise<CodeExecutionResult>;
4123
+ /**
4124
+ * Alias of runCode().
4125
+ */
4126
+ execute(code: string, language: string, timeoutS?: number): Promise<CodeExecutionResult>;
4118
4127
  }
4119
4128
 
4120
4129
  /**
@@ -4191,6 +4200,14 @@ declare class Command {
4191
4200
  * ```
4192
4201
  */
4193
4202
  executeCommand(command: string, timeoutMs?: number, cwd?: string, envs?: Record<string, string>): Promise<CommandResult>;
4203
+ /**
4204
+ * Alias of executeCommand().
4205
+ */
4206
+ run(command: string, timeoutMs?: number, cwd?: string, envs?: Record<string, string>): Promise<CommandResult>;
4207
+ /**
4208
+ * Alias of executeCommand().
4209
+ */
4210
+ exec(command: string, timeoutMs?: number, cwd?: string, envs?: Record<string, string>): Promise<CommandResult>;
4194
4211
  }
4195
4212
 
4196
4213
  /**
@@ -5043,6 +5060,34 @@ declare class FileSystem {
5043
5060
  * ```
5044
5061
  */
5045
5062
  deleteFile(path: string): Promise<BoolResult$1>;
5063
+ /**
5064
+ * Alias of readFile().
5065
+ */
5066
+ read(path: string): Promise<FileContentResult>;
5067
+ /**
5068
+ * Alias of writeFile().
5069
+ */
5070
+ write(path: string, content: string, mode?: string): Promise<BoolResult$1>;
5071
+ /**
5072
+ * Alias of listDirectory().
5073
+ */
5074
+ list(path: string): Promise<DirectoryListResult>;
5075
+ /**
5076
+ * Alias of listDirectory().
5077
+ */
5078
+ ls(path: string): Promise<DirectoryListResult>;
5079
+ /**
5080
+ * Alias of deleteFile().
5081
+ */
5082
+ delete(path: string): Promise<BoolResult$1>;
5083
+ /**
5084
+ * Alias of deleteFile().
5085
+ */
5086
+ remove(path: string): Promise<BoolResult$1>;
5087
+ /**
5088
+ * Alias of deleteFile().
5089
+ */
5090
+ rm(path: string): Promise<BoolResult$1>;
5046
5091
  /**
5047
5092
  * Edits a file by replacing occurrences of oldText with newText.
5048
5093
  * Corresponds to Python's edit_file() method
@@ -5996,6 +6041,18 @@ declare class Session {
5996
6041
  * @param sessionId - The ID of this session.
5997
6042
  */
5998
6043
  constructor(agentBay: AgentBay, sessionId: string);
6044
+ /**
6045
+ * Alias of fileSystem.
6046
+ */
6047
+ get fs(): FileSystem;
6048
+ /**
6049
+ * Alias of fileSystem.
6050
+ */
6051
+ get filesystem(): FileSystem;
6052
+ /**
6053
+ * Alias of fileSystem.
6054
+ */
6055
+ get files(): FileSystem;
5999
6056
  /**
6000
6057
  * Return the AgentBay instance that created this session.
6001
6058
  *
package/dist/index.d.ts CHANGED
@@ -4094,7 +4094,8 @@ declare class Code {
4094
4094
  * Corresponds to Python's run_code() method
4095
4095
  *
4096
4096
  * @param code - The code to execute.
4097
- * @param language - The programming language of the code. Must be either 'python' or 'javascript'.
4097
+ * @param language - The programming language of the code. Case-insensitive.
4098
+ * Supported values: 'python', 'javascript', 'r', 'java'.
4098
4099
  * @param timeoutS - The timeout for the code execution in seconds. Default is 60s.
4099
4100
  * Note: Due to gateway limitations, each request cannot exceed 60 seconds.
4100
4101
  * @returns CodeExecutionResult with code execution output and requestId
@@ -4115,6 +4116,14 @@ declare class Code {
4115
4116
  * ```
4116
4117
  */
4117
4118
  runCode(code: string, language: string, timeoutS?: number): Promise<CodeExecutionResult>;
4119
+ /**
4120
+ * Alias of runCode().
4121
+ */
4122
+ run(code: string, language: string, timeoutS?: number): Promise<CodeExecutionResult>;
4123
+ /**
4124
+ * Alias of runCode().
4125
+ */
4126
+ execute(code: string, language: string, timeoutS?: number): Promise<CodeExecutionResult>;
4118
4127
  }
4119
4128
 
4120
4129
  /**
@@ -4191,6 +4200,14 @@ declare class Command {
4191
4200
  * ```
4192
4201
  */
4193
4202
  executeCommand(command: string, timeoutMs?: number, cwd?: string, envs?: Record<string, string>): Promise<CommandResult>;
4203
+ /**
4204
+ * Alias of executeCommand().
4205
+ */
4206
+ run(command: string, timeoutMs?: number, cwd?: string, envs?: Record<string, string>): Promise<CommandResult>;
4207
+ /**
4208
+ * Alias of executeCommand().
4209
+ */
4210
+ exec(command: string, timeoutMs?: number, cwd?: string, envs?: Record<string, string>): Promise<CommandResult>;
4194
4211
  }
4195
4212
 
4196
4213
  /**
@@ -5043,6 +5060,34 @@ declare class FileSystem {
5043
5060
  * ```
5044
5061
  */
5045
5062
  deleteFile(path: string): Promise<BoolResult$1>;
5063
+ /**
5064
+ * Alias of readFile().
5065
+ */
5066
+ read(path: string): Promise<FileContentResult>;
5067
+ /**
5068
+ * Alias of writeFile().
5069
+ */
5070
+ write(path: string, content: string, mode?: string): Promise<BoolResult$1>;
5071
+ /**
5072
+ * Alias of listDirectory().
5073
+ */
5074
+ list(path: string): Promise<DirectoryListResult>;
5075
+ /**
5076
+ * Alias of listDirectory().
5077
+ */
5078
+ ls(path: string): Promise<DirectoryListResult>;
5079
+ /**
5080
+ * Alias of deleteFile().
5081
+ */
5082
+ delete(path: string): Promise<BoolResult$1>;
5083
+ /**
5084
+ * Alias of deleteFile().
5085
+ */
5086
+ remove(path: string): Promise<BoolResult$1>;
5087
+ /**
5088
+ * Alias of deleteFile().
5089
+ */
5090
+ rm(path: string): Promise<BoolResult$1>;
5046
5091
  /**
5047
5092
  * Edits a file by replacing occurrences of oldText with newText.
5048
5093
  * Corresponds to Python's edit_file() method
@@ -5996,6 +6041,18 @@ declare class Session {
5996
6041
  * @param sessionId - The ID of this session.
5997
6042
  */
5998
6043
  constructor(agentBay: AgentBay, sessionId: string);
6044
+ /**
6045
+ * Alias of fileSystem.
6046
+ */
6047
+ get fs(): FileSystem;
6048
+ /**
6049
+ * Alias of fileSystem.
6050
+ */
6051
+ get filesystem(): FileSystem;
6052
+ /**
6053
+ * Alias of fileSystem.
6054
+ */
6055
+ get files(): FileSystem;
5999
6056
  /**
6000
6057
  * Return the AgentBay instance that created this session.
6001
6058
  *
package/dist/index.mjs CHANGED
@@ -11230,7 +11230,8 @@ var _Code = class _Code {
11230
11230
  * Corresponds to Python's run_code() method
11231
11231
  *
11232
11232
  * @param code - The code to execute.
11233
- * @param language - The programming language of the code. Must be either 'python' or 'javascript'.
11233
+ * @param language - The programming language of the code. Case-insensitive.
11234
+ * Supported values: 'python', 'javascript', 'r', 'java'.
11234
11235
  * @param timeoutS - The timeout for the code execution in seconds. Default is 60s.
11235
11236
  * Note: Due to gateway limitations, each request cannot exceed 60 seconds.
11236
11237
  * @returns CodeExecutionResult with code execution output and requestId
@@ -11252,17 +11253,28 @@ var _Code = class _Code {
11252
11253
  */
11253
11254
  async runCode(code, language, timeoutS = 60) {
11254
11255
  try {
11255
- if (language !== "python" && language !== "javascript") {
11256
+ const rawLanguage = language ?? "";
11257
+ const normalizedLanguage = String(rawLanguage).trim().toLowerCase();
11258
+ const aliases = {
11259
+ py: "python",
11260
+ python3: "python",
11261
+ js: "javascript",
11262
+ node: "javascript",
11263
+ nodejs: "javascript"
11264
+ };
11265
+ const canonicalLanguage = aliases[normalizedLanguage] || normalizedLanguage;
11266
+ const supported = /* @__PURE__ */ new Set(["python", "javascript", "r", "java"]);
11267
+ if (!supported.has(canonicalLanguage)) {
11256
11268
  return {
11257
11269
  requestId: "",
11258
11270
  success: false,
11259
11271
  result: "",
11260
- errorMessage: `Unsupported language: ${language}. Supported languages are 'python' and 'javascript'`
11272
+ errorMessage: `Unsupported language: ${rawLanguage}. Supported languages are 'python', 'javascript', 'r', and 'java'`
11261
11273
  };
11262
11274
  }
11263
11275
  const args = {
11264
11276
  code,
11265
- language,
11277
+ language: canonicalLanguage,
11266
11278
  timeout_s: timeoutS
11267
11279
  };
11268
11280
  const response = await this.session.callMcpTool("run_code", args);
@@ -11302,6 +11314,18 @@ var _Code = class _Code {
11302
11314
  };
11303
11315
  }
11304
11316
  }
11317
+ /**
11318
+ * Alias of runCode().
11319
+ */
11320
+ async run(code, language, timeoutS = 60) {
11321
+ return await this.runCode(code, language, timeoutS);
11322
+ }
11323
+ /**
11324
+ * Alias of runCode().
11325
+ */
11326
+ async execute(code, language, timeoutS = 60) {
11327
+ return await this.runCode(code, language, timeoutS);
11328
+ }
11305
11329
  };
11306
11330
  __name(_Code, "Code");
11307
11331
  var Code = _Code;
@@ -11488,6 +11512,18 @@ var _Command = class _Command {
11488
11512
  };
11489
11513
  }
11490
11514
  }
11515
+ /**
11516
+ * Alias of executeCommand().
11517
+ */
11518
+ async run(command, timeoutMs = 1e3, cwd, envs) {
11519
+ return await this.executeCommand(command, timeoutMs, cwd, envs);
11520
+ }
11521
+ /**
11522
+ * Alias of executeCommand().
11523
+ */
11524
+ async exec(command, timeoutMs = 1e3, cwd, envs) {
11525
+ return await this.executeCommand(command, timeoutMs, cwd, envs);
11526
+ }
11491
11527
  };
11492
11528
  __name(_Command, "Command");
11493
11529
  var Command = _Command;
@@ -13213,10 +13249,11 @@ var _FileTransfer = class _FileTransfer {
13213
13249
  error: `Upload exception: ${e.message || e}`
13214
13250
  };
13215
13251
  }
13252
+ const remoteDir = this.remoteDir(remotePath);
13216
13253
  let reqIdSync;
13217
13254
  try {
13218
13255
  logDebug("Triggering sync to cloud disk");
13219
- reqIdSync = await this.awaitSync("download", remotePath, this.contextId);
13256
+ reqIdSync = await this.awaitSync("download", remoteDir, this.contextId);
13220
13257
  } catch (e) {
13221
13258
  return {
13222
13259
  success: false,
@@ -13236,7 +13273,7 @@ var _FileTransfer = class _FileTransfer {
13236
13273
  if (wait) {
13237
13274
  const { success, error } = await this.waitForTask({
13238
13275
  contextId: this.contextId,
13239
- remotePath,
13276
+ remotePath: remoteDir,
13240
13277
  taskType: "download",
13241
13278
  timeout: waitTimeout,
13242
13279
  interval: pollInterval
@@ -13306,9 +13343,10 @@ var _FileTransfer = class _FileTransfer {
13306
13343
  };
13307
13344
  }
13308
13345
  }
13346
+ const remoteDir = this.remoteDir(remotePath);
13309
13347
  let reqIdSync;
13310
13348
  try {
13311
- reqIdSync = await this.awaitSync("upload", remotePath, this.contextId);
13349
+ reqIdSync = await this.awaitSync("upload", remoteDir, this.contextId);
13312
13350
  } catch (e) {
13313
13351
  return {
13314
13352
  success: false,
@@ -13322,7 +13360,7 @@ var _FileTransfer = class _FileTransfer {
13322
13360
  if (wait) {
13323
13361
  const { success, error } = await this.waitForTask({
13324
13362
  contextId: this.contextId,
13325
- remotePath,
13363
+ remotePath: remoteDir,
13326
13364
  taskType: "upload",
13327
13365
  timeout: waitTimeout,
13328
13366
  interval: pollInterval
@@ -13416,6 +13454,18 @@ var _FileTransfer = class _FileTransfer {
13416
13454
  }
13417
13455
  }
13418
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
+ }
13419
13469
  /**
13420
13470
  * Compatibility wrapper for session.context.sync which may be sync or async:
13421
13471
  * - Try async call first
@@ -13791,6 +13841,48 @@ var _FileSystem = class _FileSystem {
13791
13841
  };
13792
13842
  }
13793
13843
  }
13844
+ /**
13845
+ * Alias of readFile().
13846
+ */
13847
+ async read(path6) {
13848
+ return await this.readFile(path6);
13849
+ }
13850
+ /**
13851
+ * Alias of writeFile().
13852
+ */
13853
+ async write(path6, content, mode = "overwrite") {
13854
+ return await this.writeFile(path6, content, mode);
13855
+ }
13856
+ /**
13857
+ * Alias of listDirectory().
13858
+ */
13859
+ async list(path6) {
13860
+ return await this.listDirectory(path6);
13861
+ }
13862
+ /**
13863
+ * Alias of listDirectory().
13864
+ */
13865
+ async ls(path6) {
13866
+ return await this.listDirectory(path6);
13867
+ }
13868
+ /**
13869
+ * Alias of deleteFile().
13870
+ */
13871
+ async delete(path6) {
13872
+ return await this.deleteFile(path6);
13873
+ }
13874
+ /**
13875
+ * Alias of deleteFile().
13876
+ */
13877
+ async remove(path6) {
13878
+ return await this.deleteFile(path6);
13879
+ }
13880
+ /**
13881
+ * Alias of deleteFile().
13882
+ */
13883
+ async rm(path6) {
13884
+ return await this.deleteFile(path6);
13885
+ }
13794
13886
  /**
13795
13887
  * Edits a file by replacing occurrences of oldText with newText.
13796
13888
  * Corresponds to Python's edit_file() method
@@ -15839,6 +15931,24 @@ var _Session = class _Session {
15839
15931
  this.browser = new Browser(this);
15840
15932
  this.context = newContextManager(this);
15841
15933
  }
15934
+ /**
15935
+ * Alias of fileSystem.
15936
+ */
15937
+ get fs() {
15938
+ return this.fileSystem;
15939
+ }
15940
+ /**
15941
+ * Alias of fileSystem.
15942
+ */
15943
+ get filesystem() {
15944
+ return this.fileSystem;
15945
+ }
15946
+ /**
15947
+ * Alias of fileSystem.
15948
+ */
15949
+ get files() {
15950
+ return this.fileSystem;
15951
+ }
15842
15952
  /**
15843
15953
  * Return the AgentBay instance that created this session.
15844
15954
  *