@agentrun/sdk 0.0.2-test.20909811203 → 0.0.2-test.20911071940
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 +148 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +389 -0
- package/dist/index.d.ts +389 -0
- package/dist/index.js +148 -10
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2080,18 +2080,29 @@ var init_sandbox_data = __esm({
|
|
|
2080
2080
|
};
|
|
2081
2081
|
/**
|
|
2082
2082
|
* Create sandbox from template
|
|
2083
|
+
* 从模板创建沙箱 / Create Sandbox from Template
|
|
2083
2084
|
*/
|
|
2084
2085
|
createSandbox = async (params) => {
|
|
2085
2086
|
await this.refreshAccessToken({
|
|
2086
2087
|
templateName: params.templateName,
|
|
2087
2088
|
config: params.config
|
|
2088
2089
|
});
|
|
2090
|
+
const data = {
|
|
2091
|
+
templateName: params.templateName,
|
|
2092
|
+
sandboxIdleTimeoutSeconds: params.sandboxIdleTimeoutSeconds || 600
|
|
2093
|
+
};
|
|
2094
|
+
if (params.nasConfig !== void 0) {
|
|
2095
|
+
data.nasConfig = params.nasConfig;
|
|
2096
|
+
}
|
|
2097
|
+
if (params.ossMountConfig !== void 0) {
|
|
2098
|
+
data.ossMountConfig = params.ossMountConfig;
|
|
2099
|
+
}
|
|
2100
|
+
if (params.polarFsConfig !== void 0) {
|
|
2101
|
+
data.polarFsConfig = params.polarFsConfig;
|
|
2102
|
+
}
|
|
2089
2103
|
return this.post({
|
|
2090
2104
|
path: "/",
|
|
2091
|
-
data
|
|
2092
|
-
templateName: params.templateName,
|
|
2093
|
-
sandboxIdleTimeoutSeconds: params.sandboxIdleTimeoutSeconds || 600
|
|
2094
|
-
}
|
|
2105
|
+
data
|
|
2095
2106
|
});
|
|
2096
2107
|
};
|
|
2097
2108
|
/**
|
|
@@ -2752,12 +2763,16 @@ var init_code_interpreter_sandbox = __esm({
|
|
|
2752
2763
|
static templateType = "CodeInterpreter" /* CODE_INTERPRETER */;
|
|
2753
2764
|
/**
|
|
2754
2765
|
* Create a Code Interpreter Sandbox from template
|
|
2766
|
+
* 从模板创建代码解释器沙箱 / Create Code Interpreter Sandbox from Template
|
|
2755
2767
|
*/
|
|
2756
2768
|
static async createFromTemplate(templateName, options, config2) {
|
|
2757
2769
|
const sandbox = await Sandbox.create(
|
|
2758
2770
|
{
|
|
2759
2771
|
templateName,
|
|
2760
|
-
sandboxIdleTimeoutSeconds: options?.sandboxIdleTimeoutSeconds
|
|
2772
|
+
sandboxIdleTimeoutSeconds: options?.sandboxIdleTimeoutSeconds,
|
|
2773
|
+
nasConfig: options?.nasConfig,
|
|
2774
|
+
ossMountConfig: options?.ossMountConfig,
|
|
2775
|
+
polarFsConfig: options?.polarFsConfig
|
|
2761
2776
|
},
|
|
2762
2777
|
config2
|
|
2763
2778
|
);
|
|
@@ -3128,12 +3143,16 @@ var init_aio_sandbox = __esm({
|
|
|
3128
3143
|
static templateType = "AllInOne" /* AIO */;
|
|
3129
3144
|
/**
|
|
3130
3145
|
* Create an AIO Sandbox from template
|
|
3146
|
+
* 从模板创建 AIO 沙箱 / Create AIO Sandbox from Template
|
|
3131
3147
|
*/
|
|
3132
3148
|
static async createFromTemplate(templateName, options, config2) {
|
|
3133
3149
|
const sandbox = await Sandbox.create(
|
|
3134
3150
|
{
|
|
3135
3151
|
templateName,
|
|
3136
|
-
sandboxIdleTimeoutSeconds: options?.sandboxIdleTimeoutSeconds
|
|
3152
|
+
sandboxIdleTimeoutSeconds: options?.sandboxIdleTimeoutSeconds,
|
|
3153
|
+
nasConfig: options?.nasConfig,
|
|
3154
|
+
ossMountConfig: options?.ossMountConfig,
|
|
3155
|
+
polarFsConfig: options?.polarFsConfig
|
|
3137
3156
|
},
|
|
3138
3157
|
config2
|
|
3139
3158
|
);
|
|
@@ -3292,15 +3311,58 @@ var init_sandbox = __esm({
|
|
|
3292
3311
|
init_sandbox_data();
|
|
3293
3312
|
init_model3();
|
|
3294
3313
|
Sandbox = class _Sandbox {
|
|
3314
|
+
/**
|
|
3315
|
+
* 沙箱 ID / Sandbox ID
|
|
3316
|
+
*/
|
|
3295
3317
|
sandboxId;
|
|
3318
|
+
/**
|
|
3319
|
+
* 沙箱名称 / Sandbox Name
|
|
3320
|
+
*/
|
|
3296
3321
|
sandboxName;
|
|
3322
|
+
/**
|
|
3323
|
+
* 模板 ID / Template ID
|
|
3324
|
+
*/
|
|
3297
3325
|
templateId;
|
|
3326
|
+
/**
|
|
3327
|
+
* 模板名称 / Template Name
|
|
3328
|
+
*/
|
|
3298
3329
|
templateName;
|
|
3330
|
+
/**
|
|
3331
|
+
* 沙箱状态 / Sandbox State
|
|
3332
|
+
*/
|
|
3299
3333
|
state;
|
|
3334
|
+
/**
|
|
3335
|
+
* 状态原因 / State Reason
|
|
3336
|
+
*/
|
|
3300
3337
|
stateReason;
|
|
3338
|
+
/**
|
|
3339
|
+
* 沙箱创建时间 / Sandbox Creation Time
|
|
3340
|
+
*/
|
|
3301
3341
|
createdAt;
|
|
3342
|
+
/**
|
|
3343
|
+
* 最后更新时间 / Last Updated Time
|
|
3344
|
+
*/
|
|
3302
3345
|
lastUpdatedAt;
|
|
3346
|
+
/**
|
|
3347
|
+
* 沙箱空闲超时时间(秒) / Sandbox Idle Timeout (seconds)
|
|
3348
|
+
*/
|
|
3303
3349
|
sandboxIdleTimeoutSeconds;
|
|
3350
|
+
/**
|
|
3351
|
+
* 沙箱结束时间 / Sandbox End Time
|
|
3352
|
+
*/
|
|
3353
|
+
endedAt;
|
|
3354
|
+
/**
|
|
3355
|
+
* 元数据 / Metadata
|
|
3356
|
+
*/
|
|
3357
|
+
metadata;
|
|
3358
|
+
/**
|
|
3359
|
+
* 沙箱全局唯一资源名称 / Sandbox ARN
|
|
3360
|
+
*/
|
|
3361
|
+
sandboxArn;
|
|
3362
|
+
/**
|
|
3363
|
+
* 沙箱空闲 TTL(秒) / Sandbox Idle TTL (seconds)
|
|
3364
|
+
*/
|
|
3365
|
+
sandboxIdleTTLInSeconds;
|
|
3304
3366
|
_config;
|
|
3305
3367
|
constructor(data, config2) {
|
|
3306
3368
|
if (data) {
|
|
@@ -3310,6 +3372,7 @@ var init_sandbox = __esm({
|
|
|
3310
3372
|
}
|
|
3311
3373
|
/**
|
|
3312
3374
|
* Create sandbox from SDK response object
|
|
3375
|
+
* 从 SDK 响应对象创建沙箱 / Create Sandbox from SDK Response Object
|
|
3313
3376
|
*/
|
|
3314
3377
|
static fromInnerObject(obj, config2) {
|
|
3315
3378
|
return new _Sandbox(
|
|
@@ -3323,7 +3386,12 @@ var init_sandbox = __esm({
|
|
|
3323
3386
|
stateReason: obj.stateReason,
|
|
3324
3387
|
createdAt: obj.createdAt,
|
|
3325
3388
|
lastUpdatedAt: obj.lastUpdatedAt,
|
|
3326
|
-
sandboxIdleTimeoutSeconds: obj.sandboxIdleTimeoutSeconds
|
|
3389
|
+
sandboxIdleTimeoutSeconds: obj.sandboxIdleTimeoutSeconds,
|
|
3390
|
+
// New fields / 新增字段
|
|
3391
|
+
endedAt: obj.endedAt,
|
|
3392
|
+
metadata: obj.metadata,
|
|
3393
|
+
sandboxArn: obj.sandboxArn,
|
|
3394
|
+
sandboxIdleTTLInSeconds: obj.sandboxIdleTTLInSeconds
|
|
3327
3395
|
},
|
|
3328
3396
|
config2
|
|
3329
3397
|
);
|
|
@@ -3334,6 +3402,7 @@ var init_sandbox = __esm({
|
|
|
3334
3402
|
}
|
|
3335
3403
|
/**
|
|
3336
3404
|
* Create a new Sandbox
|
|
3405
|
+
* 创建新沙箱 / Create a New Sandbox
|
|
3337
3406
|
*/
|
|
3338
3407
|
static async create(input, config2) {
|
|
3339
3408
|
try {
|
|
@@ -3346,6 +3415,9 @@ var init_sandbox = __esm({
|
|
|
3346
3415
|
const result = await dataApi.createSandbox({
|
|
3347
3416
|
templateName: input.templateName,
|
|
3348
3417
|
sandboxIdleTimeoutSeconds: input.sandboxIdleTimeoutSeconds,
|
|
3418
|
+
nasConfig: input.nasConfig,
|
|
3419
|
+
ossMountConfig: input.ossMountConfig,
|
|
3420
|
+
polarFsConfig: input.polarFsConfig,
|
|
3349
3421
|
config: cfg
|
|
3350
3422
|
});
|
|
3351
3423
|
if (result.code !== "SUCCESS") {
|
|
@@ -3608,12 +3680,16 @@ var init_browser_sandbox = __esm({
|
|
|
3608
3680
|
static templateType = "Browser" /* BROWSER */;
|
|
3609
3681
|
/**
|
|
3610
3682
|
* Create a Browser Sandbox from template
|
|
3683
|
+
* 从模板创建浏览器沙箱 / Create Browser Sandbox from Template
|
|
3611
3684
|
*/
|
|
3612
3685
|
static async createFromTemplate(templateName, options, config2) {
|
|
3613
3686
|
const sandbox = await Sandbox.create(
|
|
3614
3687
|
{
|
|
3615
3688
|
templateName,
|
|
3616
|
-
sandboxIdleTimeoutSeconds: options?.sandboxIdleTimeoutSeconds
|
|
3689
|
+
sandboxIdleTimeoutSeconds: options?.sandboxIdleTimeoutSeconds,
|
|
3690
|
+
nasConfig: options?.nasConfig,
|
|
3691
|
+
ossMountConfig: options?.ossMountConfig,
|
|
3692
|
+
polarFsConfig: options?.polarFsConfig
|
|
3617
3693
|
},
|
|
3618
3694
|
config2
|
|
3619
3695
|
);
|
|
@@ -7480,23 +7556,78 @@ init_model();
|
|
|
7480
7556
|
init_resource();
|
|
7481
7557
|
init_model3();
|
|
7482
7558
|
var Template = class _Template {
|
|
7559
|
+
/**
|
|
7560
|
+
* 模板 ARN / Template ARN
|
|
7561
|
+
*/
|
|
7483
7562
|
templateArn;
|
|
7563
|
+
/**
|
|
7564
|
+
* 模板 ID / Template ID
|
|
7565
|
+
*/
|
|
7484
7566
|
templateId;
|
|
7567
|
+
/**
|
|
7568
|
+
* 模板名称 / Template Name
|
|
7569
|
+
*/
|
|
7485
7570
|
templateName;
|
|
7571
|
+
/**
|
|
7572
|
+
* 模板类型 / Template Type
|
|
7573
|
+
*/
|
|
7486
7574
|
templateType;
|
|
7575
|
+
/**
|
|
7576
|
+
* CPU 核数 / CPU Cores
|
|
7577
|
+
*/
|
|
7487
7578
|
cpu;
|
|
7579
|
+
/**
|
|
7580
|
+
* 内存大小(MB) / Memory Size (MB)
|
|
7581
|
+
*/
|
|
7488
7582
|
memory;
|
|
7583
|
+
/**
|
|
7584
|
+
* 创建时间 / Creation Time
|
|
7585
|
+
*/
|
|
7489
7586
|
createdAt;
|
|
7587
|
+
/**
|
|
7588
|
+
* 描述 / Description
|
|
7589
|
+
*/
|
|
7490
7590
|
description;
|
|
7591
|
+
/**
|
|
7592
|
+
* 执行角色 ARN / Execution Role ARN
|
|
7593
|
+
*/
|
|
7491
7594
|
executionRoleArn;
|
|
7595
|
+
/**
|
|
7596
|
+
* 最后更新时间 / Last Updated Time
|
|
7597
|
+
*/
|
|
7492
7598
|
lastUpdatedAt;
|
|
7599
|
+
/**
|
|
7600
|
+
* 资源名称 / Resource Name
|
|
7601
|
+
*/
|
|
7493
7602
|
resourceName;
|
|
7603
|
+
/**
|
|
7604
|
+
* 沙箱空闲超时时间(秒) / Sandbox Idle Timeout (seconds)
|
|
7605
|
+
*/
|
|
7494
7606
|
sandboxIdleTimeoutInSeconds;
|
|
7607
|
+
/**
|
|
7608
|
+
* 沙箱存活时间(秒) / Sandbox TTL (seconds)
|
|
7609
|
+
*/
|
|
7495
7610
|
sandboxTtlInSeconds;
|
|
7611
|
+
/**
|
|
7612
|
+
* 每个沙箱的最大并发会话数 / Max Concurrency Limit Per Sandbox
|
|
7613
|
+
*/
|
|
7496
7614
|
shareConcurrencyLimitPerSandbox;
|
|
7615
|
+
/**
|
|
7616
|
+
* 状态 / Status
|
|
7617
|
+
*/
|
|
7497
7618
|
status;
|
|
7619
|
+
/**
|
|
7620
|
+
* 状态原因 / Status Reason
|
|
7621
|
+
*/
|
|
7498
7622
|
statusReason;
|
|
7623
|
+
/**
|
|
7624
|
+
* 磁盘大小(GB) / Disk Size (GB)
|
|
7625
|
+
*/
|
|
7499
7626
|
diskSize;
|
|
7627
|
+
/**
|
|
7628
|
+
* 是否允许匿名管理 / Whether to allow anonymous management
|
|
7629
|
+
*/
|
|
7630
|
+
allowAnonymousManage;
|
|
7500
7631
|
_config;
|
|
7501
7632
|
constructor(data, config2) {
|
|
7502
7633
|
if (data) {
|
|
@@ -7506,6 +7637,7 @@ var Template = class _Template {
|
|
|
7506
7637
|
}
|
|
7507
7638
|
/**
|
|
7508
7639
|
* Create template from SDK response object
|
|
7640
|
+
* 从 SDK 响应对象创建模板 / Create Template from SDK Response Object
|
|
7509
7641
|
*/
|
|
7510
7642
|
static fromInnerObject(obj, config2) {
|
|
7511
7643
|
return new _Template(
|
|
@@ -7525,7 +7657,9 @@ var Template = class _Template {
|
|
|
7525
7657
|
sandboxTtlInSeconds: obj.sandboxTTLInSeconds ? parseInt(obj.sandboxTTLInSeconds, 10) : void 0,
|
|
7526
7658
|
status: obj.status,
|
|
7527
7659
|
statusReason: obj.statusReason,
|
|
7528
|
-
diskSize: obj.diskSize
|
|
7660
|
+
diskSize: obj.diskSize,
|
|
7661
|
+
// New field / 新增字段
|
|
7662
|
+
allowAnonymousManage: obj.allowAnonymousManage
|
|
7529
7663
|
},
|
|
7530
7664
|
config2
|
|
7531
7665
|
);
|
|
@@ -7563,7 +7697,9 @@ var Template = class _Template {
|
|
|
7563
7697
|
diskSize: finalInput.diskSize,
|
|
7564
7698
|
networkConfiguration: finalInput.networkConfiguration ? new $AgentRun4.NetworkConfiguration({
|
|
7565
7699
|
networkMode: finalInput.networkConfiguration.networkMode
|
|
7566
|
-
}) : void 0
|
|
7700
|
+
}) : void 0,
|
|
7701
|
+
// New field / 新增字段
|
|
7702
|
+
allowAnonymousManage: finalInput.allowAnonymousManage
|
|
7567
7703
|
})
|
|
7568
7704
|
});
|
|
7569
7705
|
const response = await client.createTemplateWithOptions(
|
|
@@ -7920,6 +8056,7 @@ var SandboxClient = class {
|
|
|
7920
8056
|
};
|
|
7921
8057
|
/**
|
|
7922
8058
|
* Create a Code Interpreter Sandbox
|
|
8059
|
+
* 创建代码解释器沙箱 / Create Code Interpreter Sandbox
|
|
7923
8060
|
*/
|
|
7924
8061
|
createCodeInterpreterSandbox = async (params) => {
|
|
7925
8062
|
const { templateName, options, config: config2 } = params;
|
|
@@ -7931,6 +8068,7 @@ var SandboxClient = class {
|
|
|
7931
8068
|
};
|
|
7932
8069
|
/**
|
|
7933
8070
|
* Create a Browser Sandbox
|
|
8071
|
+
* 创建浏览器沙箱 / Create Browser Sandbox
|
|
7934
8072
|
*/
|
|
7935
8073
|
createBrowserSandbox = async (params) => {
|
|
7936
8074
|
const { templateName, options, config: config2 } = params;
|