test-wuying-agentbay-sdk 0.13.1-beta.20251223155807 → 0.13.1-beta.20251223163333
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 +100 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +58 -1
- package/dist/index.d.ts +58 -1
- package/dist/index.mjs +100 -4
- package/dist/index.mjs.map +1 -1
- package/docs/api/codespace/code.md +43 -1
- package/docs/api/common-features/basics/command.md +44 -0
- package/docs/api/common-features/basics/filesystem.md +135 -0
- package/docs/api/common-features/basics/session-params.md +1 -1
- package/docs/api/common-features/basics/session.md +42 -0
- package/docs/examples/README.md +5 -1
- package/docs/examples/codespace/automation/automation-example.ts +1 -1
- package/docs/examples/codespace/jupyter_context_persistence_r_java/index.ts +85 -0
- package/docs/examples/common-features/basics/command-example/command-example.ts +4 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -11216,7 +11216,8 @@ var _Code = class _Code {
|
|
|
11216
11216
|
* Corresponds to Python's run_code() method
|
|
11217
11217
|
*
|
|
11218
11218
|
* @param code - The code to execute.
|
|
11219
|
-
* @param language - The programming language of the code.
|
|
11219
|
+
* @param language - The programming language of the code. Case-insensitive.
|
|
11220
|
+
* Supported values: 'python', 'javascript', 'r', 'java'.
|
|
11220
11221
|
* @param timeoutS - The timeout for the code execution in seconds. Default is 60s.
|
|
11221
11222
|
* Note: Due to gateway limitations, each request cannot exceed 60 seconds.
|
|
11222
11223
|
* @returns CodeExecutionResult with code execution output and requestId
|
|
@@ -11238,17 +11239,28 @@ var _Code = class _Code {
|
|
|
11238
11239
|
*/
|
|
11239
11240
|
async runCode(code, language, timeoutS = 60) {
|
|
11240
11241
|
try {
|
|
11241
|
-
|
|
11242
|
+
const rawLanguage = _nullishCoalesce(language, () => ( ""));
|
|
11243
|
+
const normalizedLanguage = String(rawLanguage).trim().toLowerCase();
|
|
11244
|
+
const aliases = {
|
|
11245
|
+
py: "python",
|
|
11246
|
+
python3: "python",
|
|
11247
|
+
js: "javascript",
|
|
11248
|
+
node: "javascript",
|
|
11249
|
+
nodejs: "javascript"
|
|
11250
|
+
};
|
|
11251
|
+
const canonicalLanguage = aliases[normalizedLanguage] || normalizedLanguage;
|
|
11252
|
+
const supported = /* @__PURE__ */ new Set(["python", "javascript", "r", "java"]);
|
|
11253
|
+
if (!supported.has(canonicalLanguage)) {
|
|
11242
11254
|
return {
|
|
11243
11255
|
requestId: "",
|
|
11244
11256
|
success: false,
|
|
11245
11257
|
result: "",
|
|
11246
|
-
errorMessage: `Unsupported language: ${
|
|
11258
|
+
errorMessage: `Unsupported language: ${rawLanguage}. Supported languages are 'python', 'javascript', 'r', and 'java'`
|
|
11247
11259
|
};
|
|
11248
11260
|
}
|
|
11249
11261
|
const args = {
|
|
11250
11262
|
code,
|
|
11251
|
-
language,
|
|
11263
|
+
language: canonicalLanguage,
|
|
11252
11264
|
timeout_s: timeoutS
|
|
11253
11265
|
};
|
|
11254
11266
|
const response = await this.session.callMcpTool("run_code", args);
|
|
@@ -11288,6 +11300,18 @@ var _Code = class _Code {
|
|
|
11288
11300
|
};
|
|
11289
11301
|
}
|
|
11290
11302
|
}
|
|
11303
|
+
/**
|
|
11304
|
+
* Alias of runCode().
|
|
11305
|
+
*/
|
|
11306
|
+
async run(code, language, timeoutS = 60) {
|
|
11307
|
+
return await this.runCode(code, language, timeoutS);
|
|
11308
|
+
}
|
|
11309
|
+
/**
|
|
11310
|
+
* Alias of runCode().
|
|
11311
|
+
*/
|
|
11312
|
+
async execute(code, language, timeoutS = 60) {
|
|
11313
|
+
return await this.runCode(code, language, timeoutS);
|
|
11314
|
+
}
|
|
11291
11315
|
};
|
|
11292
11316
|
_chunk4IPTHWLMcjs.__name.call(void 0, _Code, "Code");
|
|
11293
11317
|
var Code = _Code;
|
|
@@ -11474,6 +11498,18 @@ var _Command = class _Command {
|
|
|
11474
11498
|
};
|
|
11475
11499
|
}
|
|
11476
11500
|
}
|
|
11501
|
+
/**
|
|
11502
|
+
* Alias of executeCommand().
|
|
11503
|
+
*/
|
|
11504
|
+
async run(command, timeoutMs = 1e3, cwd, envs) {
|
|
11505
|
+
return await this.executeCommand(command, timeoutMs, cwd, envs);
|
|
11506
|
+
}
|
|
11507
|
+
/**
|
|
11508
|
+
* Alias of executeCommand().
|
|
11509
|
+
*/
|
|
11510
|
+
async exec(command, timeoutMs = 1e3, cwd, envs) {
|
|
11511
|
+
return await this.executeCommand(command, timeoutMs, cwd, envs);
|
|
11512
|
+
}
|
|
11477
11513
|
};
|
|
11478
11514
|
_chunk4IPTHWLMcjs.__name.call(void 0, _Command, "Command");
|
|
11479
11515
|
var Command = _Command;
|
|
@@ -13777,6 +13813,48 @@ var _FileSystem = class _FileSystem {
|
|
|
13777
13813
|
};
|
|
13778
13814
|
}
|
|
13779
13815
|
}
|
|
13816
|
+
/**
|
|
13817
|
+
* Alias of readFile().
|
|
13818
|
+
*/
|
|
13819
|
+
async read(path6) {
|
|
13820
|
+
return await this.readFile(path6);
|
|
13821
|
+
}
|
|
13822
|
+
/**
|
|
13823
|
+
* Alias of writeFile().
|
|
13824
|
+
*/
|
|
13825
|
+
async write(path6, content, mode = "overwrite") {
|
|
13826
|
+
return await this.writeFile(path6, content, mode);
|
|
13827
|
+
}
|
|
13828
|
+
/**
|
|
13829
|
+
* Alias of listDirectory().
|
|
13830
|
+
*/
|
|
13831
|
+
async list(path6) {
|
|
13832
|
+
return await this.listDirectory(path6);
|
|
13833
|
+
}
|
|
13834
|
+
/**
|
|
13835
|
+
* Alias of listDirectory().
|
|
13836
|
+
*/
|
|
13837
|
+
async ls(path6) {
|
|
13838
|
+
return await this.listDirectory(path6);
|
|
13839
|
+
}
|
|
13840
|
+
/**
|
|
13841
|
+
* Alias of deleteFile().
|
|
13842
|
+
*/
|
|
13843
|
+
async delete(path6) {
|
|
13844
|
+
return await this.deleteFile(path6);
|
|
13845
|
+
}
|
|
13846
|
+
/**
|
|
13847
|
+
* Alias of deleteFile().
|
|
13848
|
+
*/
|
|
13849
|
+
async remove(path6) {
|
|
13850
|
+
return await this.deleteFile(path6);
|
|
13851
|
+
}
|
|
13852
|
+
/**
|
|
13853
|
+
* Alias of deleteFile().
|
|
13854
|
+
*/
|
|
13855
|
+
async rm(path6) {
|
|
13856
|
+
return await this.deleteFile(path6);
|
|
13857
|
+
}
|
|
13780
13858
|
/**
|
|
13781
13859
|
* Edits a file by replacing occurrences of oldText with newText.
|
|
13782
13860
|
* Corresponds to Python's edit_file() method
|
|
@@ -15825,6 +15903,24 @@ var _Session = class _Session {
|
|
|
15825
15903
|
this.browser = new Browser(this);
|
|
15826
15904
|
this.context = newContextManager(this);
|
|
15827
15905
|
}
|
|
15906
|
+
/**
|
|
15907
|
+
* Alias of fileSystem.
|
|
15908
|
+
*/
|
|
15909
|
+
get fs() {
|
|
15910
|
+
return this.fileSystem;
|
|
15911
|
+
}
|
|
15912
|
+
/**
|
|
15913
|
+
* Alias of fileSystem.
|
|
15914
|
+
*/
|
|
15915
|
+
get filesystem() {
|
|
15916
|
+
return this.fileSystem;
|
|
15917
|
+
}
|
|
15918
|
+
/**
|
|
15919
|
+
* Alias of fileSystem.
|
|
15920
|
+
*/
|
|
15921
|
+
get files() {
|
|
15922
|
+
return this.fileSystem;
|
|
15923
|
+
}
|
|
15828
15924
|
/**
|
|
15829
15925
|
* Return the AgentBay instance that created this session.
|
|
15830
15926
|
*
|