@agentrun/sdk 0.0.2-test.20909811203 → 0.0.2-test.20910143561
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.cjs
CHANGED
|
@@ -2114,18 +2114,29 @@ var init_sandbox_data = __esm({
|
|
|
2114
2114
|
};
|
|
2115
2115
|
/**
|
|
2116
2116
|
* Create sandbox from template
|
|
2117
|
+
* 从模板创建沙箱 / Create Sandbox from Template
|
|
2117
2118
|
*/
|
|
2118
2119
|
createSandbox = async (params) => {
|
|
2119
2120
|
await this.refreshAccessToken({
|
|
2120
2121
|
templateName: params.templateName,
|
|
2121
2122
|
config: params.config
|
|
2122
2123
|
});
|
|
2124
|
+
const data = {
|
|
2125
|
+
templateName: params.templateName,
|
|
2126
|
+
sandboxIdleTimeoutSeconds: params.sandboxIdleTimeoutSeconds || 600
|
|
2127
|
+
};
|
|
2128
|
+
if (params.nasConfig !== void 0) {
|
|
2129
|
+
data.nasConfig = params.nasConfig;
|
|
2130
|
+
}
|
|
2131
|
+
if (params.ossMountConfig !== void 0) {
|
|
2132
|
+
data.ossMountConfig = params.ossMountConfig;
|
|
2133
|
+
}
|
|
2134
|
+
if (params.polarFsConfig !== void 0) {
|
|
2135
|
+
data.polarFsConfig = params.polarFsConfig;
|
|
2136
|
+
}
|
|
2123
2137
|
return this.post({
|
|
2124
2138
|
path: "/",
|
|
2125
|
-
data
|
|
2126
|
-
templateName: params.templateName,
|
|
2127
|
-
sandboxIdleTimeoutSeconds: params.sandboxIdleTimeoutSeconds || 600
|
|
2128
|
-
}
|
|
2139
|
+
data
|
|
2129
2140
|
});
|
|
2130
2141
|
};
|
|
2131
2142
|
/**
|
|
@@ -2786,12 +2797,16 @@ var init_code_interpreter_sandbox = __esm({
|
|
|
2786
2797
|
static templateType = "CodeInterpreter" /* CODE_INTERPRETER */;
|
|
2787
2798
|
/**
|
|
2788
2799
|
* Create a Code Interpreter Sandbox from template
|
|
2800
|
+
* 从模板创建代码解释器沙箱 / Create Code Interpreter Sandbox from Template
|
|
2789
2801
|
*/
|
|
2790
2802
|
static async createFromTemplate(templateName, options, config2) {
|
|
2791
2803
|
const sandbox = await exports.Sandbox.create(
|
|
2792
2804
|
{
|
|
2793
2805
|
templateName,
|
|
2794
|
-
sandboxIdleTimeoutSeconds: options?.sandboxIdleTimeoutSeconds
|
|
2806
|
+
sandboxIdleTimeoutSeconds: options?.sandboxIdleTimeoutSeconds,
|
|
2807
|
+
nasConfig: options?.nasConfig,
|
|
2808
|
+
ossMountConfig: options?.ossMountConfig,
|
|
2809
|
+
polarFsConfig: options?.polarFsConfig
|
|
2795
2810
|
},
|
|
2796
2811
|
config2
|
|
2797
2812
|
);
|
|
@@ -3162,12 +3177,16 @@ var init_aio_sandbox = __esm({
|
|
|
3162
3177
|
static templateType = "AllInOne" /* AIO */;
|
|
3163
3178
|
/**
|
|
3164
3179
|
* Create an AIO Sandbox from template
|
|
3180
|
+
* 从模板创建 AIO 沙箱 / Create AIO Sandbox from Template
|
|
3165
3181
|
*/
|
|
3166
3182
|
static async createFromTemplate(templateName, options, config2) {
|
|
3167
3183
|
const sandbox = await exports.Sandbox.create(
|
|
3168
3184
|
{
|
|
3169
3185
|
templateName,
|
|
3170
|
-
sandboxIdleTimeoutSeconds: options?.sandboxIdleTimeoutSeconds
|
|
3186
|
+
sandboxIdleTimeoutSeconds: options?.sandboxIdleTimeoutSeconds,
|
|
3187
|
+
nasConfig: options?.nasConfig,
|
|
3188
|
+
ossMountConfig: options?.ossMountConfig,
|
|
3189
|
+
polarFsConfig: options?.polarFsConfig
|
|
3171
3190
|
},
|
|
3172
3191
|
config2
|
|
3173
3192
|
);
|
|
@@ -3326,15 +3345,58 @@ var init_sandbox = __esm({
|
|
|
3326
3345
|
init_sandbox_data();
|
|
3327
3346
|
init_model3();
|
|
3328
3347
|
exports.Sandbox = class _Sandbox {
|
|
3348
|
+
/**
|
|
3349
|
+
* 沙箱 ID / Sandbox ID
|
|
3350
|
+
*/
|
|
3329
3351
|
sandboxId;
|
|
3352
|
+
/**
|
|
3353
|
+
* 沙箱名称 / Sandbox Name
|
|
3354
|
+
*/
|
|
3330
3355
|
sandboxName;
|
|
3356
|
+
/**
|
|
3357
|
+
* 模板 ID / Template ID
|
|
3358
|
+
*/
|
|
3331
3359
|
templateId;
|
|
3360
|
+
/**
|
|
3361
|
+
* 模板名称 / Template Name
|
|
3362
|
+
*/
|
|
3332
3363
|
templateName;
|
|
3364
|
+
/**
|
|
3365
|
+
* 沙箱状态 / Sandbox State
|
|
3366
|
+
*/
|
|
3333
3367
|
state;
|
|
3368
|
+
/**
|
|
3369
|
+
* 状态原因 / State Reason
|
|
3370
|
+
*/
|
|
3334
3371
|
stateReason;
|
|
3372
|
+
/**
|
|
3373
|
+
* 沙箱创建时间 / Sandbox Creation Time
|
|
3374
|
+
*/
|
|
3335
3375
|
createdAt;
|
|
3376
|
+
/**
|
|
3377
|
+
* 最后更新时间 / Last Updated Time
|
|
3378
|
+
*/
|
|
3336
3379
|
lastUpdatedAt;
|
|
3380
|
+
/**
|
|
3381
|
+
* 沙箱空闲超时时间(秒) / Sandbox Idle Timeout (seconds)
|
|
3382
|
+
*/
|
|
3337
3383
|
sandboxIdleTimeoutSeconds;
|
|
3384
|
+
/**
|
|
3385
|
+
* 沙箱结束时间 / Sandbox End Time
|
|
3386
|
+
*/
|
|
3387
|
+
endedAt;
|
|
3388
|
+
/**
|
|
3389
|
+
* 元数据 / Metadata
|
|
3390
|
+
*/
|
|
3391
|
+
metadata;
|
|
3392
|
+
/**
|
|
3393
|
+
* 沙箱全局唯一资源名称 / Sandbox ARN
|
|
3394
|
+
*/
|
|
3395
|
+
sandboxArn;
|
|
3396
|
+
/**
|
|
3397
|
+
* 沙箱空闲 TTL(秒) / Sandbox Idle TTL (seconds)
|
|
3398
|
+
*/
|
|
3399
|
+
sandboxIdleTTLInSeconds;
|
|
3338
3400
|
_config;
|
|
3339
3401
|
constructor(data, config2) {
|
|
3340
3402
|
if (data) {
|
|
@@ -3344,6 +3406,7 @@ var init_sandbox = __esm({
|
|
|
3344
3406
|
}
|
|
3345
3407
|
/**
|
|
3346
3408
|
* Create sandbox from SDK response object
|
|
3409
|
+
* 从 SDK 响应对象创建沙箱 / Create Sandbox from SDK Response Object
|
|
3347
3410
|
*/
|
|
3348
3411
|
static fromInnerObject(obj, config2) {
|
|
3349
3412
|
return new _Sandbox(
|
|
@@ -3357,7 +3420,12 @@ var init_sandbox = __esm({
|
|
|
3357
3420
|
stateReason: obj.stateReason,
|
|
3358
3421
|
createdAt: obj.createdAt,
|
|
3359
3422
|
lastUpdatedAt: obj.lastUpdatedAt,
|
|
3360
|
-
sandboxIdleTimeoutSeconds: obj.sandboxIdleTimeoutSeconds
|
|
3423
|
+
sandboxIdleTimeoutSeconds: obj.sandboxIdleTimeoutSeconds,
|
|
3424
|
+
// New fields / 新增字段
|
|
3425
|
+
endedAt: obj.endedAt,
|
|
3426
|
+
metadata: obj.metadata,
|
|
3427
|
+
sandboxArn: obj.sandboxArn,
|
|
3428
|
+
sandboxIdleTTLInSeconds: obj.sandboxIdleTTLInSeconds
|
|
3361
3429
|
},
|
|
3362
3430
|
config2
|
|
3363
3431
|
);
|
|
@@ -3368,6 +3436,7 @@ var init_sandbox = __esm({
|
|
|
3368
3436
|
}
|
|
3369
3437
|
/**
|
|
3370
3438
|
* Create a new Sandbox
|
|
3439
|
+
* 创建新沙箱 / Create a New Sandbox
|
|
3371
3440
|
*/
|
|
3372
3441
|
static async create(input, config2) {
|
|
3373
3442
|
try {
|
|
@@ -3380,6 +3449,9 @@ var init_sandbox = __esm({
|
|
|
3380
3449
|
const result = await dataApi.createSandbox({
|
|
3381
3450
|
templateName: input.templateName,
|
|
3382
3451
|
sandboxIdleTimeoutSeconds: input.sandboxIdleTimeoutSeconds,
|
|
3452
|
+
nasConfig: input.nasConfig,
|
|
3453
|
+
ossMountConfig: input.ossMountConfig,
|
|
3454
|
+
polarFsConfig: input.polarFsConfig,
|
|
3383
3455
|
config: cfg
|
|
3384
3456
|
});
|
|
3385
3457
|
if (result.code !== "SUCCESS") {
|
|
@@ -3642,12 +3714,16 @@ var init_browser_sandbox = __esm({
|
|
|
3642
3714
|
static templateType = "Browser" /* BROWSER */;
|
|
3643
3715
|
/**
|
|
3644
3716
|
* Create a Browser Sandbox from template
|
|
3717
|
+
* 从模板创建浏览器沙箱 / Create Browser Sandbox from Template
|
|
3645
3718
|
*/
|
|
3646
3719
|
static async createFromTemplate(templateName, options, config2) {
|
|
3647
3720
|
const sandbox = await exports.Sandbox.create(
|
|
3648
3721
|
{
|
|
3649
3722
|
templateName,
|
|
3650
|
-
sandboxIdleTimeoutSeconds: options?.sandboxIdleTimeoutSeconds
|
|
3723
|
+
sandboxIdleTimeoutSeconds: options?.sandboxIdleTimeoutSeconds,
|
|
3724
|
+
nasConfig: options?.nasConfig,
|
|
3725
|
+
ossMountConfig: options?.ossMountConfig,
|
|
3726
|
+
polarFsConfig: options?.polarFsConfig
|
|
3651
3727
|
},
|
|
3652
3728
|
config2
|
|
3653
3729
|
);
|
|
@@ -7514,23 +7590,78 @@ init_model();
|
|
|
7514
7590
|
init_resource();
|
|
7515
7591
|
init_model3();
|
|
7516
7592
|
var Template = class _Template {
|
|
7593
|
+
/**
|
|
7594
|
+
* 模板 ARN / Template ARN
|
|
7595
|
+
*/
|
|
7517
7596
|
templateArn;
|
|
7597
|
+
/**
|
|
7598
|
+
* 模板 ID / Template ID
|
|
7599
|
+
*/
|
|
7518
7600
|
templateId;
|
|
7601
|
+
/**
|
|
7602
|
+
* 模板名称 / Template Name
|
|
7603
|
+
*/
|
|
7519
7604
|
templateName;
|
|
7605
|
+
/**
|
|
7606
|
+
* 模板类型 / Template Type
|
|
7607
|
+
*/
|
|
7520
7608
|
templateType;
|
|
7609
|
+
/**
|
|
7610
|
+
* CPU 核数 / CPU Cores
|
|
7611
|
+
*/
|
|
7521
7612
|
cpu;
|
|
7613
|
+
/**
|
|
7614
|
+
* 内存大小(MB) / Memory Size (MB)
|
|
7615
|
+
*/
|
|
7522
7616
|
memory;
|
|
7617
|
+
/**
|
|
7618
|
+
* 创建时间 / Creation Time
|
|
7619
|
+
*/
|
|
7523
7620
|
createdAt;
|
|
7621
|
+
/**
|
|
7622
|
+
* 描述 / Description
|
|
7623
|
+
*/
|
|
7524
7624
|
description;
|
|
7625
|
+
/**
|
|
7626
|
+
* 执行角色 ARN / Execution Role ARN
|
|
7627
|
+
*/
|
|
7525
7628
|
executionRoleArn;
|
|
7629
|
+
/**
|
|
7630
|
+
* 最后更新时间 / Last Updated Time
|
|
7631
|
+
*/
|
|
7526
7632
|
lastUpdatedAt;
|
|
7633
|
+
/**
|
|
7634
|
+
* 资源名称 / Resource Name
|
|
7635
|
+
*/
|
|
7527
7636
|
resourceName;
|
|
7637
|
+
/**
|
|
7638
|
+
* 沙箱空闲超时时间(秒) / Sandbox Idle Timeout (seconds)
|
|
7639
|
+
*/
|
|
7528
7640
|
sandboxIdleTimeoutInSeconds;
|
|
7641
|
+
/**
|
|
7642
|
+
* 沙箱存活时间(秒) / Sandbox TTL (seconds)
|
|
7643
|
+
*/
|
|
7529
7644
|
sandboxTtlInSeconds;
|
|
7645
|
+
/**
|
|
7646
|
+
* 每个沙箱的最大并发会话数 / Max Concurrency Limit Per Sandbox
|
|
7647
|
+
*/
|
|
7530
7648
|
shareConcurrencyLimitPerSandbox;
|
|
7649
|
+
/**
|
|
7650
|
+
* 状态 / Status
|
|
7651
|
+
*/
|
|
7531
7652
|
status;
|
|
7653
|
+
/**
|
|
7654
|
+
* 状态原因 / Status Reason
|
|
7655
|
+
*/
|
|
7532
7656
|
statusReason;
|
|
7657
|
+
/**
|
|
7658
|
+
* 磁盘大小(GB) / Disk Size (GB)
|
|
7659
|
+
*/
|
|
7533
7660
|
diskSize;
|
|
7661
|
+
/**
|
|
7662
|
+
* 是否允许匿名管理 / Whether to allow anonymous management
|
|
7663
|
+
*/
|
|
7664
|
+
allowAnonymousManage;
|
|
7534
7665
|
_config;
|
|
7535
7666
|
constructor(data, config2) {
|
|
7536
7667
|
if (data) {
|
|
@@ -7540,6 +7671,7 @@ var Template = class _Template {
|
|
|
7540
7671
|
}
|
|
7541
7672
|
/**
|
|
7542
7673
|
* Create template from SDK response object
|
|
7674
|
+
* 从 SDK 响应对象创建模板 / Create Template from SDK Response Object
|
|
7543
7675
|
*/
|
|
7544
7676
|
static fromInnerObject(obj, config2) {
|
|
7545
7677
|
return new _Template(
|
|
@@ -7559,7 +7691,9 @@ var Template = class _Template {
|
|
|
7559
7691
|
sandboxTtlInSeconds: obj.sandboxTTLInSeconds ? parseInt(obj.sandboxTTLInSeconds, 10) : void 0,
|
|
7560
7692
|
status: obj.status,
|
|
7561
7693
|
statusReason: obj.statusReason,
|
|
7562
|
-
diskSize: obj.diskSize
|
|
7694
|
+
diskSize: obj.diskSize,
|
|
7695
|
+
// New field / 新增字段
|
|
7696
|
+
allowAnonymousManage: obj.allowAnonymousManage
|
|
7563
7697
|
},
|
|
7564
7698
|
config2
|
|
7565
7699
|
);
|
|
@@ -7597,7 +7731,9 @@ var Template = class _Template {
|
|
|
7597
7731
|
diskSize: finalInput.diskSize,
|
|
7598
7732
|
networkConfiguration: finalInput.networkConfiguration ? new $AgentRun4__namespace.NetworkConfiguration({
|
|
7599
7733
|
networkMode: finalInput.networkConfiguration.networkMode
|
|
7600
|
-
}) : void 0
|
|
7734
|
+
}) : void 0,
|
|
7735
|
+
// New field / 新增字段
|
|
7736
|
+
allowAnonymousManage: finalInput.allowAnonymousManage
|
|
7601
7737
|
})
|
|
7602
7738
|
});
|
|
7603
7739
|
const response = await client.createTemplateWithOptions(
|
|
@@ -7954,6 +8090,7 @@ var SandboxClient = class {
|
|
|
7954
8090
|
};
|
|
7955
8091
|
/**
|
|
7956
8092
|
* Create a Code Interpreter Sandbox
|
|
8093
|
+
* 创建代码解释器沙箱 / Create Code Interpreter Sandbox
|
|
7957
8094
|
*/
|
|
7958
8095
|
createCodeInterpreterSandbox = async (params) => {
|
|
7959
8096
|
const { templateName, options, config: config2 } = params;
|
|
@@ -7965,6 +8102,7 @@ var SandboxClient = class {
|
|
|
7965
8102
|
};
|
|
7966
8103
|
/**
|
|
7967
8104
|
* Create a Browser Sandbox
|
|
8105
|
+
* 创建浏览器沙箱 / Create Browser Sandbox
|
|
7968
8106
|
*/
|
|
7969
8107
|
createBrowserSandbox = async (params) => {
|
|
7970
8108
|
const { templateName, options, config: config2 } = params;
|