@agentrun/sdk 0.0.3 → 0.0.4
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/README.md +20 -15
- package/dist/agent-runtime/api/index.cjs +907 -0
- package/dist/agent-runtime/api/index.cjs.map +1 -0
- package/dist/agent-runtime/api/index.d.cts +193 -0
- package/dist/agent-runtime/api/index.d.ts +193 -0
- package/dist/agent-runtime/api/index.js +882 -0
- package/dist/agent-runtime/api/index.js.map +1 -0
- package/dist/agent-runtime/index.cjs +2528 -0
- package/dist/agent-runtime/index.cjs.map +1 -0
- package/dist/agent-runtime/index.d.cts +778 -0
- package/dist/agent-runtime/index.d.ts +778 -0
- package/dist/agent-runtime/index.js +2496 -0
- package/dist/agent-runtime/index.js.map +1 -0
- package/dist/base-K1GMfJbH.d.ts +59 -0
- package/dist/base-xcWt5bua.d.cts +59 -0
- package/dist/client-DHXxjuo3.d.ts +58 -0
- package/dist/client-DPUTs69s.d.cts +58 -0
- package/dist/config-07gMelJP.d.cts +125 -0
- package/dist/config-07gMelJP.d.ts +125 -0
- package/dist/control-api-BWD4eua5.d.cts +27 -0
- package/dist/control-api-d-82Sgpr.d.ts +27 -0
- package/dist/credential/api/index.cjs +655 -0
- package/dist/credential/api/index.cjs.map +1 -0
- package/dist/credential/api/index.d.cts +93 -0
- package/dist/credential/api/index.d.ts +93 -0
- package/dist/credential/api/index.js +630 -0
- package/dist/credential/api/index.js.map +1 -0
- package/dist/credential/index.cjs +1286 -0
- package/dist/credential/index.cjs.map +1 -0
- package/dist/credential/index.d.cts +246 -0
- package/dist/credential/index.d.ts +246 -0
- package/dist/credential/index.js +1263 -0
- package/dist/credential/index.js.map +1 -0
- package/dist/data-api-B-4h9_Vf.d.ts +166 -0
- package/dist/data-api-DsG-8JRQ.d.cts +166 -0
- package/dist/exception-DM9H2Rpo.d.cts +68 -0
- package/dist/exception-DM9H2Rpo.d.ts +68 -0
- package/dist/index.cjs +29281 -1427
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +38 -4485
- package/dist/index.d.ts +38 -4485
- package/dist/index.js +29259 -1426
- package/dist/index.js.map +1 -1
- package/dist/integration/builtin/index.cjs +9399 -0
- package/dist/integration/builtin/index.cjs.map +1 -0
- package/dist/integration/builtin/index.d.cts +692 -0
- package/dist/integration/builtin/index.d.ts +692 -0
- package/dist/integration/builtin/index.js +9363 -0
- package/dist/integration/builtin/index.js.map +1 -0
- package/dist/integration/index.cjs +9524 -0
- package/dist/integration/index.cjs.map +1 -0
- package/dist/integration/index.d.cts +98 -0
- package/dist/integration/index.d.ts +98 -0
- package/dist/integration/index.js +9481 -0
- package/dist/integration/index.js.map +1 -0
- package/dist/integration/mastra/index.cjs +9383 -0
- package/dist/integration/mastra/index.cjs.map +1 -0
- package/dist/integration/mastra/index.d.cts +186 -0
- package/dist/integration/mastra/index.d.ts +186 -0
- package/dist/integration/mastra/index.js +9348 -0
- package/dist/integration/mastra/index.js.map +1 -0
- package/dist/model/index.cjs +2392 -0
- package/dist/model/index.cjs.map +1 -0
- package/dist/model/index.d.cts +97 -0
- package/dist/model/index.d.ts +97 -0
- package/dist/model/index.js +2368 -0
- package/dist/model/index.js.map +1 -0
- package/dist/model--I90nCqy.d.cts +66 -0
- package/dist/model--I90nCqy.d.ts +66 -0
- package/dist/model-BV7A6Trb.d.cts +512 -0
- package/dist/model-DGBy-o_L.d.cts +176 -0
- package/dist/model-DGBy-o_L.d.ts +176 -0
- package/dist/model-RiiiZnou.d.ts +512 -0
- package/dist/model-service-D-P2FZNi.d.ts +540 -0
- package/dist/model-service-VpzBb7rV.d.cts +540 -0
- package/dist/resource-CQovFUeh.d.cts +44 -0
- package/dist/resource-DnE_DEka.d.ts +44 -0
- package/dist/sandbox/index.cjs +3557 -0
- package/dist/sandbox/index.cjs.map +1 -0
- package/dist/sandbox/index.d.cts +1598 -0
- package/dist/sandbox/index.d.ts +1598 -0
- package/dist/sandbox/index.js +3532 -0
- package/dist/sandbox/index.js.map +1 -0
- package/dist/server/adapter/index.cjs +24886 -0
- package/dist/server/adapter/index.cjs.map +1 -0
- package/dist/server/adapter/index.d.cts +68 -0
- package/dist/server/adapter/index.d.ts +68 -0
- package/dist/server/adapter/index.js +24883 -0
- package/dist/server/adapter/index.js.map +1 -0
- package/dist/server/core/index.cjs +313 -0
- package/dist/server/core/index.cjs.map +1 -0
- package/dist/server/core/index.d.cts +58 -0
- package/dist/server/core/index.d.ts +58 -0
- package/dist/server/core/index.js +309 -0
- package/dist/server/core/index.js.map +1 -0
- package/dist/server/index.cjs +25098 -0
- package/dist/server/index.cjs.map +1 -0
- package/dist/server/index.d.cts +73 -0
- package/dist/server/index.d.ts +73 -0
- package/dist/server/index.js +25067 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/protocol/index.cjs +1057 -0
- package/dist/server/protocol/index.cjs.map +1 -0
- package/dist/server/protocol/index.d.cts +135 -0
- package/dist/server/protocol/index.d.ts +135 -0
- package/dist/server/protocol/index.js +1053 -0
- package/dist/server/protocol/index.js.map +1 -0
- package/dist/tool-CG0LY-ov.d.cts +155 -0
- package/dist/tool-JJHam0ms.d.ts +155 -0
- package/dist/toolset/api/index.cjs +754 -0
- package/dist/toolset/api/index.cjs.map +1 -0
- package/dist/toolset/api/index.d.cts +207 -0
- package/dist/toolset/api/index.d.ts +207 -0
- package/dist/toolset/api/index.js +727 -0
- package/dist/toolset/api/index.js.map +1 -0
- package/dist/toolset/index.cjs +1945 -0
- package/dist/toolset/index.cjs.map +1 -0
- package/dist/toolset/index.d.cts +182 -0
- package/dist/toolset/index.d.ts +182 -0
- package/dist/toolset/index.js +1920 -0
- package/dist/toolset/index.js.map +1 -0
- package/dist/toolset-BYDvhwRp.d.cts +394 -0
- package/dist/toolset-CSRsJxCb.d.ts +394 -0
- package/dist/utils/index.cjs +994 -0
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.d.cts +30 -0
- package/dist/utils/index.d.ts +30 -0
- package/dist/utils/index.js +951 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +65 -13
|
@@ -0,0 +1,1598 @@
|
|
|
1
|
+
import { C as Config } from '../config-07gMelJP.js';
|
|
2
|
+
import { C as CodeLanguage, p as TemplateType, N as NASConfig, O as OSSMountConfig, P as PolarFsConfig, a as SandboxData, c as SandboxState, S as SandboxCreateInput, b as SandboxListInput, g as TemplateData, e as TemplateCreateInput, q as TemplateUpdateInput, h as TemplateListInput } from '../model-RiiiZnou.js';
|
|
3
|
+
export { E as ExecuteCodeResult, F as FileInfo, r as NASMountConfig, s as OSSMountPoint, t as PolarFsMountConfig, T as TemplateArmsConfiguration, d as TemplateContainerConfiguration, f as TemplateCredentialConfiguration, i as TemplateLogConfiguration, j as TemplateMcpOptions, k as TemplateMcpState, l as TemplateNetworkConfiguration, m as TemplateNetworkMode, n as TemplateOSSPermission, o as TemplateOssConfiguration } from '../model-RiiiZnou.js';
|
|
4
|
+
import { R as ResourceBase } from '../resource-DnE_DEka.js';
|
|
5
|
+
import { S as Status } from '../model--I90nCqy.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Sandbox Data API Base Class
|
|
9
|
+
*
|
|
10
|
+
* This module provides an HTTP client for interacting with the AgentRun Sandbox Data API.
|
|
11
|
+
* 此模块提供用于与 AgentRun Sandbox Data API 交互的 HTTP 客户端。
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Resource type enum
|
|
16
|
+
*/
|
|
17
|
+
declare enum ResourceType {
|
|
18
|
+
Runtime = "runtime",
|
|
19
|
+
LiteLLM = "litellm",
|
|
20
|
+
Tool = "tool",
|
|
21
|
+
Template = "template",
|
|
22
|
+
Sandbox = "sandbox"
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Sandbox Data API Client
|
|
26
|
+
*
|
|
27
|
+
* Provides methods for making HTTP requests to sandbox data API endpoints.
|
|
28
|
+
*/
|
|
29
|
+
declare class SandboxDataAPI {
|
|
30
|
+
protected resourceName: string;
|
|
31
|
+
protected resourceType: ResourceType;
|
|
32
|
+
protected namespace: string;
|
|
33
|
+
protected config: Config;
|
|
34
|
+
protected accessToken?: string;
|
|
35
|
+
protected accessTokenMap: Map<string, string>;
|
|
36
|
+
constructor(params: {
|
|
37
|
+
sandboxId?: string;
|
|
38
|
+
templateName?: string;
|
|
39
|
+
config?: Config;
|
|
40
|
+
namespace?: string;
|
|
41
|
+
});
|
|
42
|
+
/**
|
|
43
|
+
* Refresh access token for the resource
|
|
44
|
+
*/
|
|
45
|
+
protected refreshAccessToken(params: {
|
|
46
|
+
sandboxId?: string;
|
|
47
|
+
templateName?: string;
|
|
48
|
+
config?: Config;
|
|
49
|
+
}): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Get base URL for data API
|
|
52
|
+
*/
|
|
53
|
+
protected getBaseUrl(): string;
|
|
54
|
+
/**
|
|
55
|
+
* Construct full URL with path and query parameters
|
|
56
|
+
*/
|
|
57
|
+
protected withPath(path: string, query?: Record<string, any>): string;
|
|
58
|
+
/**
|
|
59
|
+
* Authentication hook - gets access token for the resource
|
|
60
|
+
*/
|
|
61
|
+
protected auth(params: {
|
|
62
|
+
config?: Config;
|
|
63
|
+
}): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Mask token for logging
|
|
66
|
+
*/
|
|
67
|
+
protected maskToken(token: string): string;
|
|
68
|
+
/**
|
|
69
|
+
* Prepare request headers
|
|
70
|
+
*/
|
|
71
|
+
protected prepareHeaders(params: {
|
|
72
|
+
headers?: Record<string, string>;
|
|
73
|
+
config?: Config;
|
|
74
|
+
}): Record<string, string>;
|
|
75
|
+
/**
|
|
76
|
+
* Make an HTTP request
|
|
77
|
+
*/
|
|
78
|
+
protected makeRequest<T = any>(params: {
|
|
79
|
+
method: string;
|
|
80
|
+
url: string;
|
|
81
|
+
data?: any;
|
|
82
|
+
headers?: Record<string, string>;
|
|
83
|
+
query?: Record<string, any>;
|
|
84
|
+
config?: Config;
|
|
85
|
+
}): Promise<T>;
|
|
86
|
+
/**
|
|
87
|
+
* GET request
|
|
88
|
+
*/
|
|
89
|
+
get<T = any>(params: {
|
|
90
|
+
path: string;
|
|
91
|
+
query?: Record<string, any>;
|
|
92
|
+
headers?: Record<string, string>;
|
|
93
|
+
config?: Config;
|
|
94
|
+
}): Promise<T>;
|
|
95
|
+
/**
|
|
96
|
+
* POST request
|
|
97
|
+
*/
|
|
98
|
+
post<T = any>(params: {
|
|
99
|
+
path: string;
|
|
100
|
+
data?: any;
|
|
101
|
+
query?: Record<string, any>;
|
|
102
|
+
headers?: Record<string, string>;
|
|
103
|
+
config?: Config;
|
|
104
|
+
}): Promise<T>;
|
|
105
|
+
/**
|
|
106
|
+
* PUT request
|
|
107
|
+
*/
|
|
108
|
+
put<T = any>(params: {
|
|
109
|
+
path: string;
|
|
110
|
+
data?: any;
|
|
111
|
+
query?: Record<string, any>;
|
|
112
|
+
headers?: Record<string, string>;
|
|
113
|
+
config?: Config;
|
|
114
|
+
}): Promise<T>;
|
|
115
|
+
/**
|
|
116
|
+
* PATCH request
|
|
117
|
+
*/
|
|
118
|
+
patch<T = any>(params: {
|
|
119
|
+
path: string;
|
|
120
|
+
data?: any;
|
|
121
|
+
query?: Record<string, any>;
|
|
122
|
+
headers?: Record<string, string>;
|
|
123
|
+
config?: Config;
|
|
124
|
+
}): Promise<T>;
|
|
125
|
+
/**
|
|
126
|
+
* DELETE request
|
|
127
|
+
*/
|
|
128
|
+
delete<T = any>(params: {
|
|
129
|
+
path: string;
|
|
130
|
+
query?: Record<string, any>;
|
|
131
|
+
headers?: Record<string, string>;
|
|
132
|
+
config?: Config;
|
|
133
|
+
}): Promise<T>;
|
|
134
|
+
/**
|
|
135
|
+
* Check sandbox health
|
|
136
|
+
*/
|
|
137
|
+
checkHealth: (params: {
|
|
138
|
+
sandboxId: string;
|
|
139
|
+
config?: Config;
|
|
140
|
+
}) => Promise<{
|
|
141
|
+
status: string;
|
|
142
|
+
[key: string]: any;
|
|
143
|
+
}>;
|
|
144
|
+
/**
|
|
145
|
+
* Create sandbox from template
|
|
146
|
+
* 从模板创建沙箱 / Create Sandbox from Template
|
|
147
|
+
*/
|
|
148
|
+
createSandbox: (params: {
|
|
149
|
+
templateName: string;
|
|
150
|
+
sandboxIdleTimeoutSeconds?: number;
|
|
151
|
+
nasConfig?: Record<string, any>;
|
|
152
|
+
ossMountConfig?: Record<string, any>;
|
|
153
|
+
polarFsConfig?: Record<string, any>;
|
|
154
|
+
config?: Config;
|
|
155
|
+
}) => Promise<any>;
|
|
156
|
+
/**
|
|
157
|
+
* Delete sandbox
|
|
158
|
+
*/
|
|
159
|
+
deleteSandbox: (params: {
|
|
160
|
+
sandboxId: string;
|
|
161
|
+
config?: Config;
|
|
162
|
+
}) => Promise<any>;
|
|
163
|
+
/**
|
|
164
|
+
* Stop sandbox
|
|
165
|
+
*/
|
|
166
|
+
stopSandbox: (params: {
|
|
167
|
+
sandboxId: string;
|
|
168
|
+
config?: Config;
|
|
169
|
+
}) => Promise<any>;
|
|
170
|
+
/**
|
|
171
|
+
* Get sandbox info
|
|
172
|
+
*/
|
|
173
|
+
getSandbox: (params: {
|
|
174
|
+
sandboxId: string;
|
|
175
|
+
config?: Config;
|
|
176
|
+
}) => Promise<any>;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Code Interpreter Sandbox Data API
|
|
181
|
+
*
|
|
182
|
+
* This module provides data API methods for Code Interpreter sandboxes.
|
|
183
|
+
* 此模块提供代码解释器沙箱的数据 API 方法。
|
|
184
|
+
*/
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Code Interpreter Data API
|
|
188
|
+
*
|
|
189
|
+
* Provides methods for interacting with Code Interpreter sandbox data endpoints.
|
|
190
|
+
*/
|
|
191
|
+
declare class CodeInterpreterDataAPI extends SandboxDataAPI {
|
|
192
|
+
constructor(params: {
|
|
193
|
+
sandboxId: string;
|
|
194
|
+
config?: Config;
|
|
195
|
+
});
|
|
196
|
+
/**
|
|
197
|
+
* List directory contents
|
|
198
|
+
*/
|
|
199
|
+
listDirectory(params?: {
|
|
200
|
+
path?: string;
|
|
201
|
+
depth?: number;
|
|
202
|
+
config?: Config;
|
|
203
|
+
}): Promise<any>;
|
|
204
|
+
/**
|
|
205
|
+
* Get file/directory stats
|
|
206
|
+
*/
|
|
207
|
+
stat(params: {
|
|
208
|
+
path: string;
|
|
209
|
+
config?: Config;
|
|
210
|
+
}): Promise<any>;
|
|
211
|
+
/**
|
|
212
|
+
* Create directory
|
|
213
|
+
*/
|
|
214
|
+
mkdir(params: {
|
|
215
|
+
path: string;
|
|
216
|
+
parents?: boolean;
|
|
217
|
+
mode?: string;
|
|
218
|
+
config?: Config;
|
|
219
|
+
}): Promise<any>;
|
|
220
|
+
/**
|
|
221
|
+
* Move file or directory
|
|
222
|
+
*/
|
|
223
|
+
moveFile(params: {
|
|
224
|
+
source: string;
|
|
225
|
+
destination: string;
|
|
226
|
+
config?: Config;
|
|
227
|
+
}): Promise<any>;
|
|
228
|
+
/**
|
|
229
|
+
* Remove file or directory
|
|
230
|
+
*/
|
|
231
|
+
removeFile(params: {
|
|
232
|
+
path: string;
|
|
233
|
+
config?: Config;
|
|
234
|
+
}): Promise<any>;
|
|
235
|
+
/**
|
|
236
|
+
* List code execution contexts
|
|
237
|
+
*/
|
|
238
|
+
listContexts(params?: {
|
|
239
|
+
config?: Config;
|
|
240
|
+
}): Promise<any>;
|
|
241
|
+
/**
|
|
242
|
+
* Create a new code execution context
|
|
243
|
+
*/
|
|
244
|
+
createContext(params?: {
|
|
245
|
+
language?: CodeLanguage;
|
|
246
|
+
cwd?: string;
|
|
247
|
+
config?: Config;
|
|
248
|
+
}): Promise<any>;
|
|
249
|
+
/**
|
|
250
|
+
* Get context details
|
|
251
|
+
*/
|
|
252
|
+
getContext(params: {
|
|
253
|
+
contextId: string;
|
|
254
|
+
config?: Config;
|
|
255
|
+
}): Promise<any>;
|
|
256
|
+
/**
|
|
257
|
+
* Execute code in a context
|
|
258
|
+
*/
|
|
259
|
+
executeCode(params: {
|
|
260
|
+
code: string;
|
|
261
|
+
contextId?: string;
|
|
262
|
+
language?: CodeLanguage;
|
|
263
|
+
timeout?: number;
|
|
264
|
+
config?: Config;
|
|
265
|
+
}): Promise<any>;
|
|
266
|
+
/**
|
|
267
|
+
* Delete a context
|
|
268
|
+
*/
|
|
269
|
+
deleteContext(params: {
|
|
270
|
+
contextId: string;
|
|
271
|
+
config?: Config;
|
|
272
|
+
}): Promise<any>;
|
|
273
|
+
/**
|
|
274
|
+
* Read file contents
|
|
275
|
+
*/
|
|
276
|
+
readFile(params: {
|
|
277
|
+
path: string;
|
|
278
|
+
config?: Config;
|
|
279
|
+
}): Promise<any>;
|
|
280
|
+
/**
|
|
281
|
+
* Write file contents
|
|
282
|
+
*/
|
|
283
|
+
writeFile(params: {
|
|
284
|
+
path: string;
|
|
285
|
+
content: string;
|
|
286
|
+
mode?: string;
|
|
287
|
+
encoding?: string;
|
|
288
|
+
createDir?: boolean;
|
|
289
|
+
config?: Config;
|
|
290
|
+
}): Promise<any>;
|
|
291
|
+
/**
|
|
292
|
+
* Upload file to sandbox
|
|
293
|
+
*/
|
|
294
|
+
uploadFile(params: {
|
|
295
|
+
localFilePath: string;
|
|
296
|
+
targetFilePath: string;
|
|
297
|
+
config?: Config;
|
|
298
|
+
}): Promise<any>;
|
|
299
|
+
/**
|
|
300
|
+
* Download file from sandbox
|
|
301
|
+
*/
|
|
302
|
+
downloadFile(params: {
|
|
303
|
+
path: string;
|
|
304
|
+
savePath: string;
|
|
305
|
+
config?: Config;
|
|
306
|
+
}): Promise<{
|
|
307
|
+
savedPath: string;
|
|
308
|
+
size: number;
|
|
309
|
+
}>;
|
|
310
|
+
/**
|
|
311
|
+
* Execute shell command
|
|
312
|
+
*/
|
|
313
|
+
cmd(params: {
|
|
314
|
+
command: string;
|
|
315
|
+
cwd: string;
|
|
316
|
+
timeout?: number;
|
|
317
|
+
config?: Config;
|
|
318
|
+
}): Promise<any>;
|
|
319
|
+
/**
|
|
320
|
+
* List running processes
|
|
321
|
+
*/
|
|
322
|
+
listProcesses(params?: {
|
|
323
|
+
config?: Config;
|
|
324
|
+
}): Promise<any>;
|
|
325
|
+
/**
|
|
326
|
+
* Get process details
|
|
327
|
+
*/
|
|
328
|
+
getProcess(params: {
|
|
329
|
+
pid: string;
|
|
330
|
+
config?: Config;
|
|
331
|
+
}): Promise<any>;
|
|
332
|
+
/**
|
|
333
|
+
* Kill a process
|
|
334
|
+
*/
|
|
335
|
+
killProcess(params: {
|
|
336
|
+
pid: string;
|
|
337
|
+
config?: Config;
|
|
338
|
+
}): Promise<any>;
|
|
339
|
+
/**
|
|
340
|
+
* Helper method to upload file using multipart/form-data
|
|
341
|
+
*/
|
|
342
|
+
protected postFile(params: {
|
|
343
|
+
path: string;
|
|
344
|
+
localFilePath: string;
|
|
345
|
+
targetFilePath: string;
|
|
346
|
+
formData?: Record<string, any>;
|
|
347
|
+
query?: Record<string, any>;
|
|
348
|
+
headers?: Record<string, string>;
|
|
349
|
+
config?: Config;
|
|
350
|
+
}): Promise<any>;
|
|
351
|
+
/**
|
|
352
|
+
* Helper method to download file
|
|
353
|
+
*/
|
|
354
|
+
protected getFile(params: {
|
|
355
|
+
path: string;
|
|
356
|
+
savePath: string;
|
|
357
|
+
query?: Record<string, any>;
|
|
358
|
+
headers?: Record<string, string>;
|
|
359
|
+
config?: Config;
|
|
360
|
+
}): Promise<{
|
|
361
|
+
savedPath: string;
|
|
362
|
+
size: number;
|
|
363
|
+
}>;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* AIO (All-In-One) Sandbox Data API
|
|
368
|
+
*
|
|
369
|
+
* This module provides a combined data API that includes both Code Interpreter
|
|
370
|
+
* and Browser sandbox functionalities.
|
|
371
|
+
* 此模块提供包含代码解释器和浏览器沙箱功能的组合数据 API。
|
|
372
|
+
*/
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* AIO Data API
|
|
376
|
+
*
|
|
377
|
+
* Combines both Code Interpreter and Browser data API methods.
|
|
378
|
+
*/
|
|
379
|
+
declare class AioDataAPI extends CodeInterpreterDataAPI {
|
|
380
|
+
private browserAPI;
|
|
381
|
+
constructor(params: {
|
|
382
|
+
sandboxId: string;
|
|
383
|
+
config?: Config;
|
|
384
|
+
});
|
|
385
|
+
/**
|
|
386
|
+
* Get CDP WebSocket URL for browser automation
|
|
387
|
+
*/
|
|
388
|
+
getCdpUrl(record?: boolean): string;
|
|
389
|
+
/**
|
|
390
|
+
* Get VNC WebSocket URL for live view
|
|
391
|
+
*/
|
|
392
|
+
getVncUrl(record?: boolean): string;
|
|
393
|
+
/**
|
|
394
|
+
* List browser recordings
|
|
395
|
+
*/
|
|
396
|
+
listRecordings: (params?: {
|
|
397
|
+
config?: Config;
|
|
398
|
+
}) => Promise<any>;
|
|
399
|
+
/**
|
|
400
|
+
* Delete a recording
|
|
401
|
+
*/
|
|
402
|
+
deleteRecording: (params: {
|
|
403
|
+
filename: string;
|
|
404
|
+
config?: Config;
|
|
405
|
+
}) => Promise<any>;
|
|
406
|
+
/**
|
|
407
|
+
* Download a recording
|
|
408
|
+
*/
|
|
409
|
+
downloadRecording: (params: {
|
|
410
|
+
filename: string;
|
|
411
|
+
savePath: string;
|
|
412
|
+
}) => Promise<{
|
|
413
|
+
savedPath: string;
|
|
414
|
+
size: number;
|
|
415
|
+
}>;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Browser Sandbox Data API
|
|
420
|
+
*
|
|
421
|
+
* This module provides data API methods for Browser sandboxes.
|
|
422
|
+
* 此模块提供浏览器沙箱的数据 API 方法。
|
|
423
|
+
*/
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* Browser Data API
|
|
427
|
+
*
|
|
428
|
+
* Provides methods for interacting with Browser sandbox data endpoints.
|
|
429
|
+
*/
|
|
430
|
+
declare class BrowserDataAPI extends SandboxDataAPI {
|
|
431
|
+
protected sandboxId: string;
|
|
432
|
+
constructor(params: {
|
|
433
|
+
sandboxId: string;
|
|
434
|
+
config?: Config;
|
|
435
|
+
});
|
|
436
|
+
/**
|
|
437
|
+
* Generate the WebSocket URL for Chrome DevTools Protocol (CDP) connection
|
|
438
|
+
*/
|
|
439
|
+
getCdpUrl(record?: boolean): string;
|
|
440
|
+
/**
|
|
441
|
+
* Generate the WebSocket URL for VNC (Virtual Network Computing) live view connection
|
|
442
|
+
*/
|
|
443
|
+
getVncUrl(record?: boolean): string;
|
|
444
|
+
/**
|
|
445
|
+
* List all recordings
|
|
446
|
+
*/
|
|
447
|
+
listRecordings: (params?: {
|
|
448
|
+
config?: Config;
|
|
449
|
+
}) => Promise<any>;
|
|
450
|
+
/**
|
|
451
|
+
* Delete a recording
|
|
452
|
+
*/
|
|
453
|
+
deleteRecording: (params: {
|
|
454
|
+
filename: string;
|
|
455
|
+
config?: Config;
|
|
456
|
+
}) => Promise<any>;
|
|
457
|
+
/**
|
|
458
|
+
* Download a recording video file
|
|
459
|
+
*/
|
|
460
|
+
downloadRecording: (params: {
|
|
461
|
+
filename: string;
|
|
462
|
+
savePath: string;
|
|
463
|
+
}) => Promise<{
|
|
464
|
+
savedPath: string;
|
|
465
|
+
size: number;
|
|
466
|
+
}>;
|
|
467
|
+
/**
|
|
468
|
+
* Helper method to download video file
|
|
469
|
+
*/
|
|
470
|
+
protected getVideo(params: {
|
|
471
|
+
path: string;
|
|
472
|
+
savePath: string;
|
|
473
|
+
query?: Record<string, any>;
|
|
474
|
+
headers?: Record<string, string>;
|
|
475
|
+
config?: Config;
|
|
476
|
+
}): Promise<{
|
|
477
|
+
savedPath: string;
|
|
478
|
+
size: number;
|
|
479
|
+
}>;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Browser Sandbox
|
|
484
|
+
*
|
|
485
|
+
* High-level API for browser sandboxes with CDP/VNC connectivity
|
|
486
|
+
* and recording management.
|
|
487
|
+
*/
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* Browser Sandbox
|
|
491
|
+
*
|
|
492
|
+
* High-level API for interacting with browser sandboxes.
|
|
493
|
+
*/
|
|
494
|
+
declare class BrowserSandbox extends Sandbox {
|
|
495
|
+
static templateType: TemplateType;
|
|
496
|
+
/**
|
|
497
|
+
* Create a Browser Sandbox from template
|
|
498
|
+
* 从模板创建浏览器沙箱 / Create Browser Sandbox from Template
|
|
499
|
+
*/
|
|
500
|
+
static createFromTemplate(templateName: string, options?: {
|
|
501
|
+
sandboxIdleTimeoutSeconds?: number;
|
|
502
|
+
nasConfig?: NASConfig;
|
|
503
|
+
ossMountConfig?: OSSMountConfig;
|
|
504
|
+
polarFsConfig?: PolarFsConfig;
|
|
505
|
+
}, config?: Config): Promise<BrowserSandbox>;
|
|
506
|
+
constructor(sandbox: Sandbox, config?: Config);
|
|
507
|
+
private _dataApi?;
|
|
508
|
+
/**
|
|
509
|
+
* Get data API client
|
|
510
|
+
*/
|
|
511
|
+
get dataApi(): BrowserDataAPI;
|
|
512
|
+
/**
|
|
513
|
+
* Check sandbox health
|
|
514
|
+
*/
|
|
515
|
+
checkHealth: (params?: {
|
|
516
|
+
config?: Config;
|
|
517
|
+
}) => Promise<{
|
|
518
|
+
status: string;
|
|
519
|
+
[key: string]: any;
|
|
520
|
+
}>;
|
|
521
|
+
/**
|
|
522
|
+
* Get CDP WebSocket URL for browser automation
|
|
523
|
+
*/
|
|
524
|
+
getCdpUrl(record?: boolean): string;
|
|
525
|
+
/**
|
|
526
|
+
* Get VNC WebSocket URL for live view
|
|
527
|
+
*/
|
|
528
|
+
getVncUrl(record?: boolean): string;
|
|
529
|
+
/**
|
|
530
|
+
* List all recordings
|
|
531
|
+
*/
|
|
532
|
+
listRecordings: (params?: {
|
|
533
|
+
config?: Config;
|
|
534
|
+
}) => Promise<any>;
|
|
535
|
+
/**
|
|
536
|
+
* Download a recording video file
|
|
537
|
+
*/
|
|
538
|
+
downloadRecording: (params: {
|
|
539
|
+
filename: string;
|
|
540
|
+
savePath: string;
|
|
541
|
+
}) => Promise<{
|
|
542
|
+
savedPath: string;
|
|
543
|
+
size: number;
|
|
544
|
+
}>;
|
|
545
|
+
/**
|
|
546
|
+
* Delete a recording
|
|
547
|
+
*/
|
|
548
|
+
deleteRecording: (params: {
|
|
549
|
+
filename: string;
|
|
550
|
+
config?: Config;
|
|
551
|
+
}) => Promise<any>;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* Code Interpreter Sandbox
|
|
556
|
+
*
|
|
557
|
+
* High-level API for code interpreter sandboxes with file, filesystem,
|
|
558
|
+
* context, and process management operations.
|
|
559
|
+
*/
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* File upload/download operations
|
|
563
|
+
*/
|
|
564
|
+
declare class FileOperations {
|
|
565
|
+
private sandbox;
|
|
566
|
+
constructor(sandbox: CodeInterpreterSandbox);
|
|
567
|
+
/**
|
|
568
|
+
* Read a file from the code interpreter
|
|
569
|
+
*/
|
|
570
|
+
read: (params: {
|
|
571
|
+
path: string;
|
|
572
|
+
}) => Promise<any>;
|
|
573
|
+
/**
|
|
574
|
+
* Write a file to the code interpreter
|
|
575
|
+
*/
|
|
576
|
+
write: (params: {
|
|
577
|
+
path: string;
|
|
578
|
+
content: string;
|
|
579
|
+
mode?: string;
|
|
580
|
+
encoding?: string;
|
|
581
|
+
createDir?: boolean;
|
|
582
|
+
}) => Promise<any>;
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* File system operations (list, move, remove, stat, mkdir)
|
|
586
|
+
*/
|
|
587
|
+
declare class FileSystemOperations {
|
|
588
|
+
private sandbox;
|
|
589
|
+
constructor(sandbox: CodeInterpreterSandbox);
|
|
590
|
+
/**
|
|
591
|
+
* List directory contents
|
|
592
|
+
*/
|
|
593
|
+
list: (params?: {
|
|
594
|
+
path?: string;
|
|
595
|
+
depth?: number;
|
|
596
|
+
}) => Promise<any>;
|
|
597
|
+
/**
|
|
598
|
+
* Move a file or directory
|
|
599
|
+
*/
|
|
600
|
+
move: (params: {
|
|
601
|
+
source: string;
|
|
602
|
+
destination: string;
|
|
603
|
+
}) => Promise<any>;
|
|
604
|
+
/**
|
|
605
|
+
* Remove a file or directory
|
|
606
|
+
*/
|
|
607
|
+
remove: (params: {
|
|
608
|
+
path: string;
|
|
609
|
+
}) => Promise<any>;
|
|
610
|
+
/**
|
|
611
|
+
* Get file or directory statistics
|
|
612
|
+
*/
|
|
613
|
+
stat: (params: {
|
|
614
|
+
path: string;
|
|
615
|
+
}) => Promise<any>;
|
|
616
|
+
/**
|
|
617
|
+
* Create a directory
|
|
618
|
+
*/
|
|
619
|
+
mkdir: (params: {
|
|
620
|
+
path: string;
|
|
621
|
+
parents?: boolean;
|
|
622
|
+
mode?: string;
|
|
623
|
+
}) => Promise<any>;
|
|
624
|
+
/**
|
|
625
|
+
* Upload a file to the code interpreter
|
|
626
|
+
*/
|
|
627
|
+
upload: (params: {
|
|
628
|
+
localFilePath: string;
|
|
629
|
+
targetFilePath: string;
|
|
630
|
+
}) => Promise<any>;
|
|
631
|
+
/**
|
|
632
|
+
* Download a file from the code interpreter
|
|
633
|
+
*/
|
|
634
|
+
download: (params: {
|
|
635
|
+
path: string;
|
|
636
|
+
savePath: string;
|
|
637
|
+
}) => Promise<{
|
|
638
|
+
savedPath: string;
|
|
639
|
+
size: number;
|
|
640
|
+
}>;
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* Process management operations
|
|
644
|
+
*/
|
|
645
|
+
declare class ProcessOperations {
|
|
646
|
+
private sandbox;
|
|
647
|
+
constructor(sandbox: CodeInterpreterSandbox);
|
|
648
|
+
/**
|
|
649
|
+
* Execute a command in the code interpreter
|
|
650
|
+
*/
|
|
651
|
+
cmd: (params: {
|
|
652
|
+
command: string;
|
|
653
|
+
cwd: string;
|
|
654
|
+
timeout?: number;
|
|
655
|
+
}) => Promise<any>;
|
|
656
|
+
/**
|
|
657
|
+
* List all processes
|
|
658
|
+
*/
|
|
659
|
+
list: (params?: {
|
|
660
|
+
config?: Config;
|
|
661
|
+
}) => Promise<any>;
|
|
662
|
+
/**
|
|
663
|
+
* Get a specific process by PID
|
|
664
|
+
*/
|
|
665
|
+
get: (params: {
|
|
666
|
+
pid: string;
|
|
667
|
+
}) => Promise<any>;
|
|
668
|
+
/**
|
|
669
|
+
* Kill a specific process by PID
|
|
670
|
+
*/
|
|
671
|
+
kill: (params: {
|
|
672
|
+
pid: string;
|
|
673
|
+
}) => Promise<any>;
|
|
674
|
+
}
|
|
675
|
+
/**
|
|
676
|
+
* Context management operations
|
|
677
|
+
*/
|
|
678
|
+
declare class ContextOperations {
|
|
679
|
+
private sandbox;
|
|
680
|
+
private _contextId?;
|
|
681
|
+
private _language?;
|
|
682
|
+
private _cwd?;
|
|
683
|
+
constructor(sandbox: CodeInterpreterSandbox);
|
|
684
|
+
/**
|
|
685
|
+
* Get the current context ID
|
|
686
|
+
*/
|
|
687
|
+
get contextId(): string | undefined;
|
|
688
|
+
/**
|
|
689
|
+
* List all contexts
|
|
690
|
+
*/
|
|
691
|
+
list: (params?: {
|
|
692
|
+
config?: Config;
|
|
693
|
+
}) => Promise<any>;
|
|
694
|
+
/**
|
|
695
|
+
* Create a new context and save its ID
|
|
696
|
+
*/
|
|
697
|
+
create: (params?: {
|
|
698
|
+
language?: CodeLanguage;
|
|
699
|
+
cwd?: string;
|
|
700
|
+
}) => Promise<ContextOperations>;
|
|
701
|
+
/**
|
|
702
|
+
* Get a specific context by ID
|
|
703
|
+
*/
|
|
704
|
+
get: (params?: {
|
|
705
|
+
contextId?: string;
|
|
706
|
+
}) => Promise<ContextOperations>;
|
|
707
|
+
/**
|
|
708
|
+
* Execute code in a context
|
|
709
|
+
*/
|
|
710
|
+
execute: (params: {
|
|
711
|
+
code: string;
|
|
712
|
+
language?: CodeLanguage;
|
|
713
|
+
contextId?: string;
|
|
714
|
+
timeout?: number;
|
|
715
|
+
}) => Promise<any>;
|
|
716
|
+
/**
|
|
717
|
+
* Delete a context
|
|
718
|
+
*/
|
|
719
|
+
delete: (params?: {
|
|
720
|
+
contextId?: string;
|
|
721
|
+
}) => Promise<any>;
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* Code Interpreter Sandbox
|
|
725
|
+
*
|
|
726
|
+
* High-level API for interacting with code interpreter sandboxes.
|
|
727
|
+
*/
|
|
728
|
+
declare class CodeInterpreterSandbox extends Sandbox {
|
|
729
|
+
static templateType: TemplateType;
|
|
730
|
+
/**
|
|
731
|
+
* Create a Code Interpreter Sandbox from template
|
|
732
|
+
* 从模板创建代码解释器沙箱 / Create Code Interpreter Sandbox from Template
|
|
733
|
+
*/
|
|
734
|
+
static createFromTemplate(templateName: string, options?: {
|
|
735
|
+
sandboxIdleTimeoutSeconds?: number;
|
|
736
|
+
nasConfig?: NASConfig;
|
|
737
|
+
ossMountConfig?: OSSMountConfig;
|
|
738
|
+
polarFsConfig?: PolarFsConfig;
|
|
739
|
+
}, config?: Config): Promise<CodeInterpreterSandbox>;
|
|
740
|
+
constructor(sandbox: Sandbox, config?: Config);
|
|
741
|
+
private _dataApi?;
|
|
742
|
+
private _file?;
|
|
743
|
+
private _fileSystem?;
|
|
744
|
+
private _context?;
|
|
745
|
+
private _process?;
|
|
746
|
+
/**
|
|
747
|
+
* Get data API client
|
|
748
|
+
*/
|
|
749
|
+
get dataApi(): CodeInterpreterDataAPI;
|
|
750
|
+
/**
|
|
751
|
+
* Access file upload/download operations
|
|
752
|
+
*/
|
|
753
|
+
get file(): FileOperations;
|
|
754
|
+
/**
|
|
755
|
+
* Access file system operations
|
|
756
|
+
*/
|
|
757
|
+
get fileSystem(): FileSystemOperations;
|
|
758
|
+
/**
|
|
759
|
+
* Access context management operations
|
|
760
|
+
*/
|
|
761
|
+
get context(): ContextOperations;
|
|
762
|
+
/**
|
|
763
|
+
* Access process management operations
|
|
764
|
+
*/
|
|
765
|
+
get process(): ProcessOperations;
|
|
766
|
+
/**
|
|
767
|
+
* Check sandbox health
|
|
768
|
+
*/
|
|
769
|
+
checkHealth: (params?: {
|
|
770
|
+
config?: Config;
|
|
771
|
+
}) => Promise<{
|
|
772
|
+
status: string;
|
|
773
|
+
[key: string]: any;
|
|
774
|
+
}>;
|
|
775
|
+
/**
|
|
776
|
+
* Execute code (convenience method delegating to context.execute)
|
|
777
|
+
*/
|
|
778
|
+
execute: (params: {
|
|
779
|
+
code: string;
|
|
780
|
+
language?: CodeLanguage;
|
|
781
|
+
contextId?: string;
|
|
782
|
+
timeout?: number;
|
|
783
|
+
}) => Promise<any>;
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
/**
|
|
787
|
+
* Custom Sandbox
|
|
788
|
+
*
|
|
789
|
+
* 自定义镜像沙箱 / Custom Image Sandbox
|
|
790
|
+
*/
|
|
791
|
+
|
|
792
|
+
/**
|
|
793
|
+
* Custom Sandbox
|
|
794
|
+
*
|
|
795
|
+
* 自定义镜像沙箱类 / Custom Image Sandbox Class
|
|
796
|
+
*/
|
|
797
|
+
declare class CustomSandbox extends Sandbox {
|
|
798
|
+
static templateType: TemplateType;
|
|
799
|
+
/**
|
|
800
|
+
* Create a Custom Sandbox from template
|
|
801
|
+
* 从模板创建自定义沙箱 / Create Custom Sandbox from Template
|
|
802
|
+
*/
|
|
803
|
+
static createFromTemplate(templateName: string, options?: {
|
|
804
|
+
sandboxIdleTimeoutSeconds?: number;
|
|
805
|
+
nasConfig?: NASConfig;
|
|
806
|
+
ossMountConfig?: OSSMountConfig;
|
|
807
|
+
polarFsConfig?: PolarFsConfig;
|
|
808
|
+
}, config?: Config): Promise<CustomSandbox>;
|
|
809
|
+
constructor(sandbox: Sandbox, config?: Config);
|
|
810
|
+
private _dataApi?;
|
|
811
|
+
/**
|
|
812
|
+
* Get data API client
|
|
813
|
+
*/
|
|
814
|
+
get dataApi(): SandboxDataAPI;
|
|
815
|
+
/**
|
|
816
|
+
* Get base URL for the sandbox
|
|
817
|
+
* 获取沙箱的基础 URL / Get base URL for the sandbox
|
|
818
|
+
*
|
|
819
|
+
* @returns 基础 URL / Base URL
|
|
820
|
+
*/
|
|
821
|
+
getBaseUrl(): string;
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* Base Sandbox Resource
|
|
826
|
+
*
|
|
827
|
+
* 此模块定义基础 Sandbox 资源类。
|
|
828
|
+
* This module defines the base Sandbox resource class.
|
|
829
|
+
*/
|
|
830
|
+
|
|
831
|
+
/**
|
|
832
|
+
* Base Sandbox resource class
|
|
833
|
+
* 基础沙箱资源类 / Base Sandbox Resource Class
|
|
834
|
+
*/
|
|
835
|
+
declare class Sandbox extends ResourceBase implements SandboxData {
|
|
836
|
+
templateType?: TemplateType;
|
|
837
|
+
/**
|
|
838
|
+
* 沙箱 ID / Sandbox ID
|
|
839
|
+
*/
|
|
840
|
+
sandboxId?: string;
|
|
841
|
+
/**
|
|
842
|
+
* 沙箱名称 / Sandbox Name
|
|
843
|
+
*/
|
|
844
|
+
sandboxName?: string;
|
|
845
|
+
/**
|
|
846
|
+
* 模板 ID / Template ID
|
|
847
|
+
*/
|
|
848
|
+
templateId?: string;
|
|
849
|
+
/**
|
|
850
|
+
* 模板名称 / Template Name
|
|
851
|
+
*/
|
|
852
|
+
templateName?: string;
|
|
853
|
+
/**
|
|
854
|
+
* 沙箱状态 / Sandbox State
|
|
855
|
+
*/
|
|
856
|
+
state?: SandboxState;
|
|
857
|
+
/**
|
|
858
|
+
* 状态原因 / State Reason
|
|
859
|
+
*/
|
|
860
|
+
stateReason?: string;
|
|
861
|
+
/**
|
|
862
|
+
* 沙箱创建时间 / Sandbox Creation Time
|
|
863
|
+
*/
|
|
864
|
+
createdAt?: string;
|
|
865
|
+
/**
|
|
866
|
+
* 最后更新时间 / Last Updated Time
|
|
867
|
+
*/
|
|
868
|
+
lastUpdatedAt?: string;
|
|
869
|
+
/**
|
|
870
|
+
* 沙箱空闲超时时间(秒) / Sandbox Idle Timeout (seconds)
|
|
871
|
+
*/
|
|
872
|
+
sandboxIdleTimeoutSeconds?: number;
|
|
873
|
+
/**
|
|
874
|
+
* 沙箱结束时间 / Sandbox End Time
|
|
875
|
+
*/
|
|
876
|
+
endedAt?: string;
|
|
877
|
+
/**
|
|
878
|
+
* 元数据 / Metadata
|
|
879
|
+
*/
|
|
880
|
+
metadata?: Record<string, any>;
|
|
881
|
+
/**
|
|
882
|
+
* 沙箱全局唯一资源名称 / Sandbox ARN
|
|
883
|
+
*/
|
|
884
|
+
sandboxArn?: string;
|
|
885
|
+
/**
|
|
886
|
+
* 沙箱空闲 TTL(秒) / Sandbox Idle TTL (seconds)
|
|
887
|
+
*/
|
|
888
|
+
sandboxIdleTTLInSeconds?: number;
|
|
889
|
+
protected _config?: Config;
|
|
890
|
+
constructor(data?: Partial<SandboxData>, config?: Config);
|
|
891
|
+
/**
|
|
892
|
+
* Create sandbox from SDK response object
|
|
893
|
+
* 从 SDK 响应对象创建沙箱 / Create Sandbox from SDK Response Object
|
|
894
|
+
*/
|
|
895
|
+
static fromInnerObject(obj: any, config?: Config): Sandbox;
|
|
896
|
+
private static getClient;
|
|
897
|
+
/**
|
|
898
|
+
* Create a new Sandbox
|
|
899
|
+
* 创建新沙箱 / Create a New Sandbox
|
|
900
|
+
*/
|
|
901
|
+
static create(params: {
|
|
902
|
+
input: SandboxCreateInput;
|
|
903
|
+
templateType: TemplateType.AIO;
|
|
904
|
+
config?: Config;
|
|
905
|
+
}): Promise<AioSandbox>;
|
|
906
|
+
static create(params: {
|
|
907
|
+
input: SandboxCreateInput;
|
|
908
|
+
templateType: TemplateType.BROWSER;
|
|
909
|
+
config?: Config;
|
|
910
|
+
}): Promise<BrowserSandbox>;
|
|
911
|
+
static create(params: {
|
|
912
|
+
input: SandboxCreateInput;
|
|
913
|
+
templateType: TemplateType.CODE_INTERPRETER;
|
|
914
|
+
config?: Config;
|
|
915
|
+
}): Promise<CodeInterpreterSandbox>;
|
|
916
|
+
static create(params: {
|
|
917
|
+
input: SandboxCreateInput;
|
|
918
|
+
templateType: TemplateType.CUSTOM;
|
|
919
|
+
config?: Config;
|
|
920
|
+
}): Promise<CustomSandbox>;
|
|
921
|
+
static create(params: {
|
|
922
|
+
input: SandboxCreateInput;
|
|
923
|
+
templateType?: TemplateType;
|
|
924
|
+
config?: Config;
|
|
925
|
+
}): Promise<Sandbox>;
|
|
926
|
+
/** @deprecated Use create({ input, config }) instead. */
|
|
927
|
+
static create(input: SandboxCreateInput, config?: Config): Promise<Sandbox>;
|
|
928
|
+
/**
|
|
929
|
+
* Delete a Sandbox by ID
|
|
930
|
+
*/
|
|
931
|
+
static delete(params: {
|
|
932
|
+
id: string;
|
|
933
|
+
config?: Config;
|
|
934
|
+
}): Promise<Sandbox>;
|
|
935
|
+
/** @deprecated Use delete({ id, config }) instead. */
|
|
936
|
+
static delete(id: string, config?: Config): Promise<Sandbox>;
|
|
937
|
+
/**
|
|
938
|
+
* Stop a Sandbox by ID
|
|
939
|
+
*/
|
|
940
|
+
static stop(params: {
|
|
941
|
+
id: string;
|
|
942
|
+
config?: Config;
|
|
943
|
+
}): Promise<Sandbox>;
|
|
944
|
+
/** @deprecated Use stop({ id, config }) instead. */
|
|
945
|
+
static stop(id: string, config?: Config): Promise<Sandbox>;
|
|
946
|
+
/**
|
|
947
|
+
* Get a Sandbox by ID
|
|
948
|
+
*/
|
|
949
|
+
static get(params: {
|
|
950
|
+
id: string;
|
|
951
|
+
templateType?: TemplateType;
|
|
952
|
+
config?: Config;
|
|
953
|
+
}): Promise<Sandbox>;
|
|
954
|
+
/** @deprecated Use get({ id, templateType, config }) instead. */
|
|
955
|
+
static get(id: string, templateType?: TemplateType, config?: Config): Promise<Sandbox>;
|
|
956
|
+
/**
|
|
957
|
+
* List Sandboxes
|
|
958
|
+
*/
|
|
959
|
+
static list(params?: {
|
|
960
|
+
input?: SandboxListInput;
|
|
961
|
+
config?: Config;
|
|
962
|
+
}): Promise<Sandbox[]>;
|
|
963
|
+
/** @deprecated Use list({ input, config }) instead. */
|
|
964
|
+
static list(input: SandboxListInput, config?: Config): Promise<Sandbox[]>;
|
|
965
|
+
get: (params?: {
|
|
966
|
+
config?: Config;
|
|
967
|
+
}) => Promise<Sandbox>;
|
|
968
|
+
/**
|
|
969
|
+
* Delete this sandbox
|
|
970
|
+
*/
|
|
971
|
+
delete: (params?: {
|
|
972
|
+
config?: Config;
|
|
973
|
+
}) => Promise<Sandbox>;
|
|
974
|
+
/**
|
|
975
|
+
* Stop this sandbox
|
|
976
|
+
*/
|
|
977
|
+
stop: (params?: {
|
|
978
|
+
config?: Config;
|
|
979
|
+
}) => Promise<Sandbox>;
|
|
980
|
+
/**
|
|
981
|
+
* Refresh this sandbox's data
|
|
982
|
+
*/
|
|
983
|
+
refresh: (params?: {
|
|
984
|
+
config?: Config;
|
|
985
|
+
}) => Promise<Sandbox>;
|
|
986
|
+
/**
|
|
987
|
+
* Wait until the sandbox is running
|
|
988
|
+
*/
|
|
989
|
+
waitUntilRunning: (options?: {
|
|
990
|
+
timeoutSeconds?: number;
|
|
991
|
+
intervalSeconds?: number;
|
|
992
|
+
beforeCheck?: (sandbox: Sandbox) => void;
|
|
993
|
+
}, config?: Config) => Promise<Sandbox>;
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
/**
|
|
997
|
+
* AIO (All-In-One) Sandbox
|
|
998
|
+
*
|
|
999
|
+
* Combines both Code Interpreter and Browser sandbox functionalities
|
|
1000
|
+
* into a single unified interface.
|
|
1001
|
+
*/
|
|
1002
|
+
|
|
1003
|
+
/**
|
|
1004
|
+
* File upload/download operations
|
|
1005
|
+
*/
|
|
1006
|
+
declare class AioFileOperations {
|
|
1007
|
+
private sandbox;
|
|
1008
|
+
constructor(sandbox: AioSandbox);
|
|
1009
|
+
/**
|
|
1010
|
+
* Read a file from the sandbox
|
|
1011
|
+
*/
|
|
1012
|
+
read: (path: string) => Promise<any>;
|
|
1013
|
+
/**
|
|
1014
|
+
* Write a file to the sandbox
|
|
1015
|
+
*/
|
|
1016
|
+
write: (params: {
|
|
1017
|
+
path: string;
|
|
1018
|
+
content: string;
|
|
1019
|
+
mode?: string;
|
|
1020
|
+
encoding?: string;
|
|
1021
|
+
createDir?: boolean;
|
|
1022
|
+
}) => Promise<any>;
|
|
1023
|
+
}
|
|
1024
|
+
/**
|
|
1025
|
+
* File system operations (list, move, remove, stat, mkdir)
|
|
1026
|
+
*/
|
|
1027
|
+
declare class AioFileSystemOperations {
|
|
1028
|
+
private sandbox;
|
|
1029
|
+
constructor(sandbox: AioSandbox);
|
|
1030
|
+
/**
|
|
1031
|
+
* List directory contents
|
|
1032
|
+
*/
|
|
1033
|
+
list: (params?: {
|
|
1034
|
+
path?: string;
|
|
1035
|
+
depth?: number;
|
|
1036
|
+
}) => Promise<any>;
|
|
1037
|
+
/**
|
|
1038
|
+
* Move a file or directory
|
|
1039
|
+
*/
|
|
1040
|
+
move: (params: {
|
|
1041
|
+
source: string;
|
|
1042
|
+
destination: string;
|
|
1043
|
+
}) => Promise<any>;
|
|
1044
|
+
/**
|
|
1045
|
+
* Remove a file or directory
|
|
1046
|
+
*/
|
|
1047
|
+
remove: (params: {
|
|
1048
|
+
path: string;
|
|
1049
|
+
}) => Promise<any>;
|
|
1050
|
+
/**
|
|
1051
|
+
* Get file or directory statistics
|
|
1052
|
+
*/
|
|
1053
|
+
stat: (params: {
|
|
1054
|
+
path: string;
|
|
1055
|
+
}) => Promise<any>;
|
|
1056
|
+
/**
|
|
1057
|
+
* Create a directory
|
|
1058
|
+
*/
|
|
1059
|
+
mkdir: (params: {
|
|
1060
|
+
path: string;
|
|
1061
|
+
parents?: boolean;
|
|
1062
|
+
mode?: string;
|
|
1063
|
+
}) => Promise<any>;
|
|
1064
|
+
/**
|
|
1065
|
+
* Upload a file to the sandbox
|
|
1066
|
+
*/
|
|
1067
|
+
upload: (params: {
|
|
1068
|
+
localFilePath: string;
|
|
1069
|
+
targetFilePath: string;
|
|
1070
|
+
}) => Promise<any>;
|
|
1071
|
+
/**
|
|
1072
|
+
* Download a file from the sandbox
|
|
1073
|
+
*/
|
|
1074
|
+
download: (params: {
|
|
1075
|
+
path: string;
|
|
1076
|
+
savePath: string;
|
|
1077
|
+
}) => Promise<{
|
|
1078
|
+
savedPath: string;
|
|
1079
|
+
size: number;
|
|
1080
|
+
}>;
|
|
1081
|
+
}
|
|
1082
|
+
/**
|
|
1083
|
+
* Process management operations
|
|
1084
|
+
*/
|
|
1085
|
+
declare class AioProcessOperations {
|
|
1086
|
+
private sandbox;
|
|
1087
|
+
constructor(sandbox: AioSandbox);
|
|
1088
|
+
/**
|
|
1089
|
+
* Execute a command in the sandbox
|
|
1090
|
+
*/
|
|
1091
|
+
cmd: (params: {
|
|
1092
|
+
command: string;
|
|
1093
|
+
cwd: string;
|
|
1094
|
+
timeout?: number;
|
|
1095
|
+
}) => Promise<any>;
|
|
1096
|
+
/**
|
|
1097
|
+
* List all processes
|
|
1098
|
+
*/
|
|
1099
|
+
list: (params?: {
|
|
1100
|
+
config?: Config;
|
|
1101
|
+
}) => Promise<any>;
|
|
1102
|
+
/**
|
|
1103
|
+
* Get a specific process by PID
|
|
1104
|
+
*/
|
|
1105
|
+
get: (params: {
|
|
1106
|
+
pid: string;
|
|
1107
|
+
}) => Promise<any>;
|
|
1108
|
+
/**
|
|
1109
|
+
* Kill a specific process by PID
|
|
1110
|
+
*/
|
|
1111
|
+
kill: (params: {
|
|
1112
|
+
pid: string;
|
|
1113
|
+
}) => Promise<any>;
|
|
1114
|
+
}
|
|
1115
|
+
/**
|
|
1116
|
+
* Context management operations
|
|
1117
|
+
*/
|
|
1118
|
+
declare class AioContextOperations {
|
|
1119
|
+
private sandbox;
|
|
1120
|
+
private _contextId?;
|
|
1121
|
+
private _language?;
|
|
1122
|
+
private _cwd?;
|
|
1123
|
+
constructor(sandbox: AioSandbox);
|
|
1124
|
+
/**
|
|
1125
|
+
* Get the current context ID
|
|
1126
|
+
*/
|
|
1127
|
+
get contextId(): string | undefined;
|
|
1128
|
+
/**
|
|
1129
|
+
* List all contexts
|
|
1130
|
+
*/
|
|
1131
|
+
list: (params?: {
|
|
1132
|
+
config?: Config;
|
|
1133
|
+
}) => Promise<any>;
|
|
1134
|
+
/**
|
|
1135
|
+
* Create a new context and save its ID
|
|
1136
|
+
*/
|
|
1137
|
+
create: (params?: {
|
|
1138
|
+
language?: CodeLanguage;
|
|
1139
|
+
cwd?: string;
|
|
1140
|
+
}) => Promise<AioContextOperations>;
|
|
1141
|
+
/**
|
|
1142
|
+
* Get a specific context by ID
|
|
1143
|
+
*/
|
|
1144
|
+
get: (params?: {
|
|
1145
|
+
contextId?: string;
|
|
1146
|
+
}) => Promise<AioContextOperations>;
|
|
1147
|
+
/**
|
|
1148
|
+
* Execute code in a context
|
|
1149
|
+
*/
|
|
1150
|
+
execute: (params: {
|
|
1151
|
+
code: string;
|
|
1152
|
+
language?: CodeLanguage;
|
|
1153
|
+
contextId?: string;
|
|
1154
|
+
timeout?: number;
|
|
1155
|
+
}) => Promise<any>;
|
|
1156
|
+
/**
|
|
1157
|
+
* Delete a context
|
|
1158
|
+
*/
|
|
1159
|
+
delete: (params?: {
|
|
1160
|
+
contextId?: string;
|
|
1161
|
+
}) => Promise<any>;
|
|
1162
|
+
}
|
|
1163
|
+
/**
|
|
1164
|
+
* AIO (All-In-One) Sandbox
|
|
1165
|
+
*
|
|
1166
|
+
* Combines both Code Interpreter and Browser sandbox functionalities.
|
|
1167
|
+
*/
|
|
1168
|
+
declare class AioSandbox extends Sandbox {
|
|
1169
|
+
static templateType: TemplateType;
|
|
1170
|
+
/**
|
|
1171
|
+
* Create an AIO Sandbox from template
|
|
1172
|
+
* 从模板创建 AIO 沙箱 / Create AIO Sandbox from Template
|
|
1173
|
+
*/
|
|
1174
|
+
static createFromTemplate(templateName: string, options?: {
|
|
1175
|
+
sandboxIdleTimeoutSeconds?: number;
|
|
1176
|
+
nasConfig?: NASConfig;
|
|
1177
|
+
ossMountConfig?: OSSMountConfig;
|
|
1178
|
+
polarFsConfig?: PolarFsConfig;
|
|
1179
|
+
}, config?: Config): Promise<AioSandbox>;
|
|
1180
|
+
constructor(sandbox: Sandbox, config?: Config);
|
|
1181
|
+
private _dataApi?;
|
|
1182
|
+
private _file?;
|
|
1183
|
+
private _fileSystem?;
|
|
1184
|
+
private _context?;
|
|
1185
|
+
private _process?;
|
|
1186
|
+
/**
|
|
1187
|
+
* Get data API client
|
|
1188
|
+
*/
|
|
1189
|
+
get dataApi(): AioDataAPI;
|
|
1190
|
+
/**
|
|
1191
|
+
* Access file upload/download operations
|
|
1192
|
+
*/
|
|
1193
|
+
get file(): AioFileOperations;
|
|
1194
|
+
/**
|
|
1195
|
+
* Access file system operations
|
|
1196
|
+
*/
|
|
1197
|
+
get fileSystem(): AioFileSystemOperations;
|
|
1198
|
+
/**
|
|
1199
|
+
* Access context management operations
|
|
1200
|
+
*/
|
|
1201
|
+
get context(): AioContextOperations;
|
|
1202
|
+
/**
|
|
1203
|
+
* Access process management operations
|
|
1204
|
+
*/
|
|
1205
|
+
get process(): AioProcessOperations;
|
|
1206
|
+
/**
|
|
1207
|
+
* Check sandbox health
|
|
1208
|
+
*/
|
|
1209
|
+
checkHealth: (params?: {
|
|
1210
|
+
config?: Config;
|
|
1211
|
+
}) => Promise<{
|
|
1212
|
+
status: string;
|
|
1213
|
+
[key: string]: any;
|
|
1214
|
+
}>;
|
|
1215
|
+
/**
|
|
1216
|
+
* Get CDP WebSocket URL for browser automation
|
|
1217
|
+
*/
|
|
1218
|
+
getCdpUrl(record?: boolean): string;
|
|
1219
|
+
/**
|
|
1220
|
+
* Get VNC WebSocket URL for live view
|
|
1221
|
+
*/
|
|
1222
|
+
getVncUrl(record?: boolean): string;
|
|
1223
|
+
/**
|
|
1224
|
+
* List all browser recordings
|
|
1225
|
+
*/
|
|
1226
|
+
listRecordings: (params?: {
|
|
1227
|
+
config?: Config;
|
|
1228
|
+
}) => Promise<any>;
|
|
1229
|
+
/**
|
|
1230
|
+
* Download a recording video file
|
|
1231
|
+
*/
|
|
1232
|
+
downloadRecording: (params: {
|
|
1233
|
+
filename: string;
|
|
1234
|
+
savePath: string;
|
|
1235
|
+
}) => Promise<{
|
|
1236
|
+
savedPath: string;
|
|
1237
|
+
size: number;
|
|
1238
|
+
}>;
|
|
1239
|
+
/**
|
|
1240
|
+
* Delete a recording
|
|
1241
|
+
*/
|
|
1242
|
+
deleteRecording: (params: {
|
|
1243
|
+
filename: string;
|
|
1244
|
+
config?: Config;
|
|
1245
|
+
}) => Promise<any>;
|
|
1246
|
+
/**
|
|
1247
|
+
* Execute code (convenience method delegating to context.execute)
|
|
1248
|
+
*/
|
|
1249
|
+
execute: (params: {
|
|
1250
|
+
code: string;
|
|
1251
|
+
language?: CodeLanguage;
|
|
1252
|
+
contextId?: string;
|
|
1253
|
+
timeout?: number;
|
|
1254
|
+
}) => Promise<any>;
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
/**
|
|
1258
|
+
* Template Resource
|
|
1259
|
+
*
|
|
1260
|
+
* 此模块定义 Template 资源类。
|
|
1261
|
+
* This module defines the Template resource class.
|
|
1262
|
+
*/
|
|
1263
|
+
|
|
1264
|
+
/**
|
|
1265
|
+
* Template resource class
|
|
1266
|
+
* 模板资源类 / Template Resource Class
|
|
1267
|
+
*/
|
|
1268
|
+
declare class Template extends ResourceBase implements TemplateData {
|
|
1269
|
+
/**
|
|
1270
|
+
* 模板 ARN / Template ARN
|
|
1271
|
+
*/
|
|
1272
|
+
templateArn?: string;
|
|
1273
|
+
/**
|
|
1274
|
+
* 模板 ID / Template ID
|
|
1275
|
+
*/
|
|
1276
|
+
templateId?: string;
|
|
1277
|
+
/**
|
|
1278
|
+
* 模板名称 / Template Name
|
|
1279
|
+
*/
|
|
1280
|
+
templateName?: string;
|
|
1281
|
+
/**
|
|
1282
|
+
* 模板类型 / Template Type
|
|
1283
|
+
*/
|
|
1284
|
+
templateType?: TemplateType;
|
|
1285
|
+
/**
|
|
1286
|
+
* CPU 核数 / CPU Cores
|
|
1287
|
+
*/
|
|
1288
|
+
cpu?: number;
|
|
1289
|
+
/**
|
|
1290
|
+
* 内存大小(MB) / Memory Size (MB)
|
|
1291
|
+
*/
|
|
1292
|
+
memory?: number;
|
|
1293
|
+
/**
|
|
1294
|
+
* 创建时间 / Creation Time
|
|
1295
|
+
*/
|
|
1296
|
+
createdAt?: string;
|
|
1297
|
+
/**
|
|
1298
|
+
* 描述 / Description
|
|
1299
|
+
*/
|
|
1300
|
+
description?: string;
|
|
1301
|
+
/**
|
|
1302
|
+
* 执行角色 ARN / Execution Role ARN
|
|
1303
|
+
*/
|
|
1304
|
+
executionRoleArn?: string;
|
|
1305
|
+
/**
|
|
1306
|
+
* 最后更新时间 / Last Updated Time
|
|
1307
|
+
*/
|
|
1308
|
+
lastUpdatedAt?: string;
|
|
1309
|
+
/**
|
|
1310
|
+
* 资源名称 / Resource Name
|
|
1311
|
+
*/
|
|
1312
|
+
resourceName?: string;
|
|
1313
|
+
/**
|
|
1314
|
+
* 沙箱空闲超时时间(秒) / Sandbox Idle Timeout (seconds)
|
|
1315
|
+
*/
|
|
1316
|
+
sandboxIdleTimeoutInSeconds?: number;
|
|
1317
|
+
/**
|
|
1318
|
+
* 沙箱存活时间(秒) / Sandbox TTL (seconds)
|
|
1319
|
+
*/
|
|
1320
|
+
sandboxTtlInSeconds?: number;
|
|
1321
|
+
/**
|
|
1322
|
+
* 每个沙箱的最大并发会话数 / Max Concurrency Limit Per Sandbox
|
|
1323
|
+
*/
|
|
1324
|
+
shareConcurrencyLimitPerSandbox?: number;
|
|
1325
|
+
/**
|
|
1326
|
+
* 状态 / Status
|
|
1327
|
+
*/
|
|
1328
|
+
status?: Status;
|
|
1329
|
+
/**
|
|
1330
|
+
* 状态原因 / Status Reason
|
|
1331
|
+
*/
|
|
1332
|
+
statusReason?: string;
|
|
1333
|
+
/**
|
|
1334
|
+
* 磁盘大小(GB) / Disk Size (GB)
|
|
1335
|
+
*/
|
|
1336
|
+
diskSize?: number;
|
|
1337
|
+
/**
|
|
1338
|
+
* 是否允许匿名管理 / Whether to allow anonymous management
|
|
1339
|
+
*/
|
|
1340
|
+
allowAnonymousManage?: boolean;
|
|
1341
|
+
protected _config?: Config;
|
|
1342
|
+
constructor(data?: any, config?: Config);
|
|
1343
|
+
uniqIdCallback: () => string | undefined;
|
|
1344
|
+
private static getClient;
|
|
1345
|
+
/**
|
|
1346
|
+
* Create a new Template
|
|
1347
|
+
*/
|
|
1348
|
+
static create(params: {
|
|
1349
|
+
input: TemplateCreateInput;
|
|
1350
|
+
config?: Config;
|
|
1351
|
+
}): Promise<Template>;
|
|
1352
|
+
/**
|
|
1353
|
+
* Delete a Template by name
|
|
1354
|
+
*/
|
|
1355
|
+
static delete(params: {
|
|
1356
|
+
name: string;
|
|
1357
|
+
config?: Config;
|
|
1358
|
+
}): Promise<Template>;
|
|
1359
|
+
/**
|
|
1360
|
+
* Update a Template by name
|
|
1361
|
+
*/
|
|
1362
|
+
static update(params: {
|
|
1363
|
+
name: string;
|
|
1364
|
+
input: TemplateUpdateInput;
|
|
1365
|
+
config?: Config;
|
|
1366
|
+
}): Promise<Template>;
|
|
1367
|
+
/**
|
|
1368
|
+
* Get a Template by name
|
|
1369
|
+
*/
|
|
1370
|
+
static get(params: {
|
|
1371
|
+
name: string;
|
|
1372
|
+
config?: Config;
|
|
1373
|
+
}): Promise<Template>;
|
|
1374
|
+
/**
|
|
1375
|
+
* List Templates
|
|
1376
|
+
*/
|
|
1377
|
+
static list(params?: {
|
|
1378
|
+
input?: TemplateListInput;
|
|
1379
|
+
config?: Config;
|
|
1380
|
+
}): Promise<Template[]>;
|
|
1381
|
+
/**
|
|
1382
|
+
* List all Templates (with pagination)
|
|
1383
|
+
*/
|
|
1384
|
+
static listAll: (params?: (Omit<TemplateListInput, "pageNumber" | "pageSize"> & {
|
|
1385
|
+
config?: Config;
|
|
1386
|
+
}) | undefined) => Promise<any[]>;
|
|
1387
|
+
get: (params?: {
|
|
1388
|
+
config?: Config;
|
|
1389
|
+
}) => Promise<Template>;
|
|
1390
|
+
/**
|
|
1391
|
+
* Delete this template
|
|
1392
|
+
*/
|
|
1393
|
+
delete: (params?: {
|
|
1394
|
+
config?: Config;
|
|
1395
|
+
}) => Promise<Template>;
|
|
1396
|
+
/**
|
|
1397
|
+
* Update this template
|
|
1398
|
+
*/
|
|
1399
|
+
update: (params: {
|
|
1400
|
+
input: TemplateUpdateInput;
|
|
1401
|
+
config?: Config;
|
|
1402
|
+
}) => Promise<Template>;
|
|
1403
|
+
/**
|
|
1404
|
+
* Refresh this template's data
|
|
1405
|
+
*/
|
|
1406
|
+
refresh: (params?: {
|
|
1407
|
+
config?: Config;
|
|
1408
|
+
}) => Promise<Template>;
|
|
1409
|
+
private normalizeNumericFields;
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
/**
|
|
1413
|
+
* Sandbox Client
|
|
1414
|
+
*
|
|
1415
|
+
* 此模块提供 Sandbox 的客户端 API。
|
|
1416
|
+
* This module provides the client API for Sandbox.
|
|
1417
|
+
*/
|
|
1418
|
+
|
|
1419
|
+
/**
|
|
1420
|
+
* Sandbox Client
|
|
1421
|
+
*
|
|
1422
|
+
* 提供 Sandbox 和 Template 的管理功能。
|
|
1423
|
+
*/
|
|
1424
|
+
declare class SandboxClient {
|
|
1425
|
+
private config?;
|
|
1426
|
+
private controlApi;
|
|
1427
|
+
constructor(config?: Config);
|
|
1428
|
+
/**
|
|
1429
|
+
* Create a Template
|
|
1430
|
+
*/
|
|
1431
|
+
createTemplate: {
|
|
1432
|
+
(params: {
|
|
1433
|
+
input: TemplateCreateInput;
|
|
1434
|
+
config?: Config;
|
|
1435
|
+
}): Promise<Template>;
|
|
1436
|
+
/** @deprecated Use createTemplate({ input, config }) instead. */
|
|
1437
|
+
(input: TemplateCreateInput, config?: Config): Promise<Template>;
|
|
1438
|
+
};
|
|
1439
|
+
/**
|
|
1440
|
+
* Delete a Template
|
|
1441
|
+
*/
|
|
1442
|
+
deleteTemplate: {
|
|
1443
|
+
(params: {
|
|
1444
|
+
name: string;
|
|
1445
|
+
config?: Config;
|
|
1446
|
+
}): Promise<Template>;
|
|
1447
|
+
/** @deprecated Use deleteTemplate({ name, config }) instead. */
|
|
1448
|
+
(name: string, config?: Config): Promise<Template>;
|
|
1449
|
+
};
|
|
1450
|
+
/**
|
|
1451
|
+
* Update a Template
|
|
1452
|
+
*/
|
|
1453
|
+
updateTemplate: {
|
|
1454
|
+
(params: {
|
|
1455
|
+
name: string;
|
|
1456
|
+
input: TemplateUpdateInput;
|
|
1457
|
+
config?: Config;
|
|
1458
|
+
}): Promise<Template>;
|
|
1459
|
+
/** @deprecated Use updateTemplate({ name, input, config }) instead. */
|
|
1460
|
+
(name: string, input: TemplateUpdateInput, config?: Config): Promise<Template>;
|
|
1461
|
+
};
|
|
1462
|
+
/**
|
|
1463
|
+
* Get a Template
|
|
1464
|
+
*/
|
|
1465
|
+
getTemplate: {
|
|
1466
|
+
(params: {
|
|
1467
|
+
name: string;
|
|
1468
|
+
config?: Config;
|
|
1469
|
+
}): Promise<Template>;
|
|
1470
|
+
/** @deprecated Use getTemplate({ name, config }) instead. */
|
|
1471
|
+
(name: string, config?: Config): Promise<Template>;
|
|
1472
|
+
};
|
|
1473
|
+
/**
|
|
1474
|
+
* List Templates
|
|
1475
|
+
*/
|
|
1476
|
+
listTemplates: {
|
|
1477
|
+
(params?: {
|
|
1478
|
+
input?: TemplateListInput;
|
|
1479
|
+
config?: Config;
|
|
1480
|
+
}): Promise<Template[]>;
|
|
1481
|
+
/** @deprecated Use listTemplates({ input, config }) instead. */
|
|
1482
|
+
(input: TemplateListInput, config?: Config): Promise<Template[]>;
|
|
1483
|
+
};
|
|
1484
|
+
/**
|
|
1485
|
+
* Create a Sandbox
|
|
1486
|
+
*/
|
|
1487
|
+
createSandbox: {
|
|
1488
|
+
(params: {
|
|
1489
|
+
input: SandboxCreateInput;
|
|
1490
|
+
templateType: TemplateType.AIO;
|
|
1491
|
+
config?: Config;
|
|
1492
|
+
}): Promise<AioSandbox>;
|
|
1493
|
+
(params: {
|
|
1494
|
+
input: SandboxCreateInput;
|
|
1495
|
+
templateType: TemplateType.BROWSER;
|
|
1496
|
+
config?: Config;
|
|
1497
|
+
}): Promise<BrowserSandbox>;
|
|
1498
|
+
(params: {
|
|
1499
|
+
input: SandboxCreateInput;
|
|
1500
|
+
templateType: TemplateType.CODE_INTERPRETER;
|
|
1501
|
+
config?: Config;
|
|
1502
|
+
}): Promise<CodeInterpreterSandbox>;
|
|
1503
|
+
(params: {
|
|
1504
|
+
input: SandboxCreateInput;
|
|
1505
|
+
templateType: TemplateType.CUSTOM;
|
|
1506
|
+
config?: Config;
|
|
1507
|
+
}): Promise<CustomSandbox>;
|
|
1508
|
+
(params: {
|
|
1509
|
+
input: SandboxCreateInput;
|
|
1510
|
+
templateType?: TemplateType;
|
|
1511
|
+
config?: Config;
|
|
1512
|
+
}): Promise<Sandbox>;
|
|
1513
|
+
/** @deprecated Use createSandbox({ input, config }) instead. */
|
|
1514
|
+
(input: SandboxCreateInput, config?: Config): Promise<Sandbox>;
|
|
1515
|
+
};
|
|
1516
|
+
/**
|
|
1517
|
+
* Create a Code Interpreter Sandbox
|
|
1518
|
+
* 创建代码解释器沙箱 / Create Code Interpreter Sandbox
|
|
1519
|
+
*/
|
|
1520
|
+
createCodeInterpreterSandbox: (params: {
|
|
1521
|
+
templateName: string;
|
|
1522
|
+
options?: {
|
|
1523
|
+
sandboxIdleTimeoutSeconds?: number;
|
|
1524
|
+
nasConfig?: NASConfig;
|
|
1525
|
+
ossMountConfig?: OSSMountConfig;
|
|
1526
|
+
polarFsConfig?: PolarFsConfig;
|
|
1527
|
+
};
|
|
1528
|
+
config?: Config;
|
|
1529
|
+
}) => Promise<CodeInterpreterSandbox>;
|
|
1530
|
+
/**
|
|
1531
|
+
* Create a Browser Sandbox
|
|
1532
|
+
* 创建浏览器沙箱 / Create Browser Sandbox
|
|
1533
|
+
*/
|
|
1534
|
+
createBrowserSandbox: (params: {
|
|
1535
|
+
templateName: string;
|
|
1536
|
+
options?: {
|
|
1537
|
+
sandboxIdleTimeoutSeconds?: number;
|
|
1538
|
+
nasConfig?: NASConfig;
|
|
1539
|
+
ossMountConfig?: OSSMountConfig;
|
|
1540
|
+
polarFsConfig?: PolarFsConfig;
|
|
1541
|
+
};
|
|
1542
|
+
config?: Config;
|
|
1543
|
+
}) => Promise<BrowserSandbox>;
|
|
1544
|
+
/**
|
|
1545
|
+
* Delete a Sandbox
|
|
1546
|
+
*/
|
|
1547
|
+
deleteSandbox: {
|
|
1548
|
+
(params: {
|
|
1549
|
+
id: string;
|
|
1550
|
+
config?: Config;
|
|
1551
|
+
}): Promise<Sandbox>;
|
|
1552
|
+
/** @deprecated Use deleteSandbox({ id, config }) instead. */
|
|
1553
|
+
(id: string, config?: Config): Promise<Sandbox>;
|
|
1554
|
+
};
|
|
1555
|
+
/**
|
|
1556
|
+
* Stop a Sandbox
|
|
1557
|
+
*/
|
|
1558
|
+
stopSandbox: {
|
|
1559
|
+
(params: {
|
|
1560
|
+
id: string;
|
|
1561
|
+
config?: Config;
|
|
1562
|
+
}): Promise<Sandbox>;
|
|
1563
|
+
/** @deprecated Use stopSandbox({ id, config }) instead. */
|
|
1564
|
+
(id: string, config?: Config): Promise<Sandbox>;
|
|
1565
|
+
};
|
|
1566
|
+
/**
|
|
1567
|
+
* Get a Sandbox
|
|
1568
|
+
*
|
|
1569
|
+
* @param params.id - Sandbox ID
|
|
1570
|
+
* @param params.templateType - Template type to cast the result to the appropriate subclass
|
|
1571
|
+
* @param params.config - Configuration
|
|
1572
|
+
*/
|
|
1573
|
+
getSandbox: {
|
|
1574
|
+
(params: {
|
|
1575
|
+
id: string;
|
|
1576
|
+
templateType?: TemplateType;
|
|
1577
|
+
config?: Config;
|
|
1578
|
+
}): Promise<Sandbox>;
|
|
1579
|
+
/** @deprecated Use getSandbox({ id, templateType, config }) instead. */
|
|
1580
|
+
(id: string, templateType?: TemplateType, config?: Config): Promise<Sandbox>;
|
|
1581
|
+
};
|
|
1582
|
+
/**
|
|
1583
|
+
* List Sandboxes
|
|
1584
|
+
*/
|
|
1585
|
+
listSandboxes: {
|
|
1586
|
+
(params?: {
|
|
1587
|
+
input?: SandboxListInput;
|
|
1588
|
+
config?: Config;
|
|
1589
|
+
}): Promise<Sandbox[]>;
|
|
1590
|
+
/** @deprecated Use listSandboxes({ input, config }) instead. */
|
|
1591
|
+
(input: SandboxListInput, config?: Config): Promise<Sandbox[]>;
|
|
1592
|
+
};
|
|
1593
|
+
private prepareTemplateCreateInput;
|
|
1594
|
+
private getTemplateDefaults;
|
|
1595
|
+
private validateTemplateCreateInput;
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
export { AioDataAPI, AioSandbox, BrowserDataAPI, BrowserSandbox, CodeInterpreterDataAPI, CodeInterpreterSandbox, CodeLanguage, CustomSandbox, NASConfig, OSSMountConfig, PolarFsConfig, Sandbox, SandboxClient, SandboxCreateInput, SandboxData, SandboxDataAPI, SandboxListInput, SandboxState, Template, TemplateCreateInput, TemplateData, TemplateListInput, TemplateType, TemplateUpdateInput };
|