test-wuying-agentbay-sdk 0.13.1-beta.20251223140234 → 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.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.
|
|
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.
|
|
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.
|
|
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
|
-
|
|
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: ${
|
|
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;
|
|
@@ -13791,6 +13827,48 @@ var _FileSystem = class _FileSystem {
|
|
|
13791
13827
|
};
|
|
13792
13828
|
}
|
|
13793
13829
|
}
|
|
13830
|
+
/**
|
|
13831
|
+
* Alias of readFile().
|
|
13832
|
+
*/
|
|
13833
|
+
async read(path6) {
|
|
13834
|
+
return await this.readFile(path6);
|
|
13835
|
+
}
|
|
13836
|
+
/**
|
|
13837
|
+
* Alias of writeFile().
|
|
13838
|
+
*/
|
|
13839
|
+
async write(path6, content, mode = "overwrite") {
|
|
13840
|
+
return await this.writeFile(path6, content, mode);
|
|
13841
|
+
}
|
|
13842
|
+
/**
|
|
13843
|
+
* Alias of listDirectory().
|
|
13844
|
+
*/
|
|
13845
|
+
async list(path6) {
|
|
13846
|
+
return await this.listDirectory(path6);
|
|
13847
|
+
}
|
|
13848
|
+
/**
|
|
13849
|
+
* Alias of listDirectory().
|
|
13850
|
+
*/
|
|
13851
|
+
async ls(path6) {
|
|
13852
|
+
return await this.listDirectory(path6);
|
|
13853
|
+
}
|
|
13854
|
+
/**
|
|
13855
|
+
* Alias of deleteFile().
|
|
13856
|
+
*/
|
|
13857
|
+
async delete(path6) {
|
|
13858
|
+
return await this.deleteFile(path6);
|
|
13859
|
+
}
|
|
13860
|
+
/**
|
|
13861
|
+
* Alias of deleteFile().
|
|
13862
|
+
*/
|
|
13863
|
+
async remove(path6) {
|
|
13864
|
+
return await this.deleteFile(path6);
|
|
13865
|
+
}
|
|
13866
|
+
/**
|
|
13867
|
+
* Alias of deleteFile().
|
|
13868
|
+
*/
|
|
13869
|
+
async rm(path6) {
|
|
13870
|
+
return await this.deleteFile(path6);
|
|
13871
|
+
}
|
|
13794
13872
|
/**
|
|
13795
13873
|
* Edits a file by replacing occurrences of oldText with newText.
|
|
13796
13874
|
* Corresponds to Python's edit_file() method
|
|
@@ -15839,6 +15917,24 @@ var _Session = class _Session {
|
|
|
15839
15917
|
this.browser = new Browser(this);
|
|
15840
15918
|
this.context = newContextManager(this);
|
|
15841
15919
|
}
|
|
15920
|
+
/**
|
|
15921
|
+
* Alias of fileSystem.
|
|
15922
|
+
*/
|
|
15923
|
+
get fs() {
|
|
15924
|
+
return this.fileSystem;
|
|
15925
|
+
}
|
|
15926
|
+
/**
|
|
15927
|
+
* Alias of fileSystem.
|
|
15928
|
+
*/
|
|
15929
|
+
get filesystem() {
|
|
15930
|
+
return this.fileSystem;
|
|
15931
|
+
}
|
|
15932
|
+
/**
|
|
15933
|
+
* Alias of fileSystem.
|
|
15934
|
+
*/
|
|
15935
|
+
get files() {
|
|
15936
|
+
return this.fileSystem;
|
|
15937
|
+
}
|
|
15842
15938
|
/**
|
|
15843
15939
|
* Return the AgentBay instance that created this session.
|
|
15844
15940
|
*
|